From: Andrea Bianco Date: Sun, 29 Aug 2021 17:39:16 +0000 (+0200) Subject: Built motion from commit fa1ea1af.|2.5.34 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css//%22javascript:;/%22?a=commitdiff_plain;h=7fee4332d01abeb7bc90a152b78f2f652e240d86;p=motion2.git Built motion from commit fa1ea1af.|2.5.34 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 62429e9..1980c68 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-08-29T17:00:00.135Z", + "time": "2021-08-29T17:31:57.563Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 103b237..e65ac47 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-08-29T17:00:00.135Z", + "time": "2021-08-29T17:31:57.563Z", "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 dab3e2b..29f723c 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 _0xa71c=['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]','sequelize','exports','VIRTUAL','getDataValue','action','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'];(function(_0x3a0186,_0x55535d){var _0x22d4ba=function(_0x165f33){while(--_0x165f33){_0x3a0186['push'](_0x3a0186['shift']());}};_0x22d4ba(++_0x55535d);}(_0xa71c,0x93));var _0xca71=function(_0x4db7e6,_0x3a65bf){_0x4db7e6=_0x4db7e6-0x0;var _0x3e4891=_0xa71c[_0x4db7e6];return _0x3e4891;};'use strict';var Sequelize=require(_0xca71('0x0'));module[_0xca71('0x1')]={'name':{'type':Sequelize[_0xca71('0x2')],'get':function(_0x25f3d3){return this[_0xca71('0x3')](_0xca71('0x4'));}},'action':{'type':Sequelize[_0xca71('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0xca71('0x6'),_0xca71('0x7'),_0xca71('0x8'),_0xca71('0x9'),_0xca71('0xa'),_0xca71('0xb'),_0xca71('0xc'),_0xca71('0xd')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0xca71('0xe')},'data1':{'type':Sequelize[_0xca71('0x5')](0x1000),'comment':_0xca71('0xf')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0xca71('0x10')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0xca71('0x11')},'data4':{'type':Sequelize[_0xca71('0x5')](0x1000)},'data5':{'type':Sequelize[_0xca71('0x5')](0x1000)},'data6':{'type':Sequelize['STRING']},'data7':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xe678=['motionbar','urlForward','browser','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','exports','VIRTUAL','getDataValue','contactManager','integration'];(function(_0x3337b6,_0x42c7f9){var _0x568270=function(_0x56e5df){while(--_0x56e5df){_0x3337b6['push'](_0x3337b6['shift']());}};_0x568270(++_0x42c7f9);}(_0xe678,0xcc));var _0x8e67=function(_0x33bd4b,_0x403f89){_0x33bd4b=_0x33bd4b-0x0;var _0x37b2d4=_0xe678[_0x33bd4b];return _0x37b2d4;};'use strict';var Sequelize=require(_0x8e67('0x0'));module[_0x8e67('0x1')]={'name':{'type':Sequelize[_0x8e67('0x2')],'get':function(_0x1b1801){return this[_0x8e67('0x3')]('action');}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x8e67('0x4'),_0x8e67('0x5'),_0x8e67('0x6'),'jscripty',_0x8e67('0x7'),_0x8e67('0x8'),'bot','script']],'msg':_0x8e67('0x9')}},'comment':_0x8e67('0x9')},'data1':{'type':Sequelize[_0x8e67('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[_0x8e67('0xa')](0x1000),'comment':_0x8e67('0xb')},'data3':{'type':Sequelize[_0x8e67('0xa')](0x1000),'comment':_0x8e67('0xc')},'data4':{'type':Sequelize[_0x8e67('0xa')](0x1000)},'data5':{'type':Sequelize['STRING'](0x1000)},'data6':{'type':Sequelize[_0x8e67('0xa')]},'data7':{'type':Sequelize[_0x8e67('0xd')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 75cb2e2..cc344ad 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 _0xef32=['ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','apply','reject','update','then','destroy','stack','name','send','body','find','params','Action','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv'];(function(_0x58cc40,_0x183602){var _0x19f72b=function(_0x26cc96){while(--_0x26cc96){_0x58cc40['push'](_0x58cc40['shift']());}};_0x19f72b(++_0x183602);}(_0xef32,0x1f0));var _0x2ef3=function(_0x26da89,_0x264785){_0x26da89=_0x26da89-0x0;var _0xc95b7b=_0xef32[_0x26da89];return _0xc95b7b;};'use strict';var emlformat=require(_0x2ef3('0x0'));var rimraf=require(_0x2ef3('0x1'));var zipdir=require(_0x2ef3('0x2'));var jsonpatch=require(_0x2ef3('0x3'));var rp=require(_0x2ef3('0x4'));var moment=require(_0x2ef3('0x5'));var BPromise=require(_0x2ef3('0x6'));var Mustache=require('mustache');var util=require(_0x2ef3('0x7'));var path=require('path');var sox=require(_0x2ef3('0x8'));var csv=require(_0x2ef3('0x9'));var ejs=require(_0x2ef3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2ef3('0xb'));var squel=require(_0x2ef3('0xc'));var crypto=require(_0x2ef3('0xd'));var jsforce=require(_0x2ef3('0xe'));var deskjs=require(_0x2ef3('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2ef3('0x10'));var Papa=require('papaparse');var Redis=require(_0x2ef3('0x11'));var authService=require(_0x2ef3('0x12'));var qs=require(_0x2ef3('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2ef3('0x14'));var logger=require(_0x2ef3('0x15'))('api');var utils=require(_0x2ef3('0x16'));var config=require(_0x2ef3('0x17'));var licenseUtil=require(_0x2ef3('0x18'));var db=require(_0x2ef3('0x19'))['db'];function respondWithStatusCode(_0x35f409,_0x16299a){_0x16299a=_0x16299a||0xcc;return function(_0x365ee6){if(_0x365ee6){return _0x35f409[_0x2ef3('0x1a')](_0x16299a);}return _0x35f409[_0x2ef3('0x1b')](_0x16299a)['end']();};}function respondWithResult(_0x2efe53,_0x581c2e){_0x581c2e=_0x581c2e||0xc8;return function(_0x2dea5b){if(_0x2dea5b){return _0x2efe53[_0x2ef3('0x1b')](_0x581c2e)[_0x2ef3('0x1c')](_0x2dea5b);}};}function respondWithFilteredResult(_0xa1b7a5,_0x2c5ff3){return function(_0x26e26c){if(_0x26e26c){var _0x1b6521=typeof _0x2c5ff3[_0x2ef3('0x1d')]===_0x2ef3('0x1e')&&typeof _0x2c5ff3[_0x2ef3('0x1f')]==='undefined';var _0x46d4c6=_0x26e26c['count'];var _0x239998=_0x1b6521?0x0:_0x2c5ff3['offset'];var _0x2b18ae=_0x1b6521?_0x26e26c[_0x2ef3('0x20')]:_0x2c5ff3[_0x2ef3('0x1d')]+_0x2c5ff3[_0x2ef3('0x1f')];var _0x3aa5f3;if(_0x2b18ae>=_0x46d4c6){_0x2b18ae=_0x46d4c6;_0x3aa5f3=0xc8;}else{_0x3aa5f3=0xce;}_0xa1b7a5[_0x2ef3('0x1b')](_0x3aa5f3);return _0xa1b7a5['set']('Content-Range',_0x239998+'-'+_0x2b18ae+'/'+_0x46d4c6)[_0x2ef3('0x1c')](_0x26e26c);}return null;};}function patchUpdates(_0x130d47){return function(_0x44dd11){try{jsonpatch[_0x2ef3('0x21')](_0x44dd11,_0x130d47,!![]);}catch(_0x5aee16){return BPromise[_0x2ef3('0x22')](_0x5aee16);}return _0x44dd11['save']();};}function saveUpdates(_0x4faf72,_0x3c0375){return function(_0x522c20){if(_0x522c20){return _0x522c20[_0x2ef3('0x23')](_0x4faf72)[_0x2ef3('0x24')](function(_0x54770c){return _0x54770c;});}return null;};}function removeEntity(_0x362b9c,_0xaf9b3f){return function(_0x576cc0){if(_0x576cc0){return _0x576cc0[_0x2ef3('0x25')]()[_0x2ef3('0x24')](function(){_0x362b9c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c8e99,_0x32c9c0){return function(_0x1e9373){if(!_0x1e9373){_0x2c8e99[_0x2ef3('0x1a')](0x194);}return _0x1e9373;};}function handleError(_0x560ac6,_0x145e02){_0x145e02=_0x145e02||0x1f4;return function(_0x141388){logger['error'](_0x141388[_0x2ef3('0x26')]);if(_0x141388[_0x2ef3('0x27')]){delete _0x141388[_0x2ef3('0x27')];}_0x560ac6[_0x2ef3('0x1b')](_0x145e02)[_0x2ef3('0x28')](_0x141388);};}exports[_0x2ef3('0x23')]=function(_0x42c5a1,_0x271973){if(_0x42c5a1[_0x2ef3('0x29')]['id']){delete _0x42c5a1[_0x2ef3('0x29')]['id'];}return db['Action'][_0x2ef3('0x2a')]({'where':{'id':_0x42c5a1[_0x2ef3('0x2b')]['id']}})['then'](handleEntityNotFound(_0x271973,null))['then'](saveUpdates(_0x42c5a1[_0x2ef3('0x29')],null))[_0x2ef3('0x24')](respondWithResult(_0x271973,null))['catch'](handleError(_0x271973,null));};exports['destroy']=function(_0x29a0a8,_0x1403c2){return db[_0x2ef3('0x2c')][_0x2ef3('0x2a')]({'where':{'id':_0x29a0a8[_0x2ef3('0x2b')]['id']}})[_0x2ef3('0x24')](handleEntityNotFound(_0x1403c2,null))[_0x2ef3('0x24')](removeEntity(_0x1403c2,null))[_0x2ef3('0x2d')](handleError(_0x1403c2,null));}; \ No newline at end of file +var _0xa0b5=['name','send','body','Action','find','catch','destroy','params','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','squel','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','apply','save','update','then','error'];(function(_0xaa4927,_0x1a0cbe){var _0x4cd355=function(_0x4f1901){while(--_0x4f1901){_0xaa4927['push'](_0xaa4927['shift']());}};_0x4cd355(++_0x1a0cbe);}(_0xa0b5,0x8c));var _0x5a0b=function(_0x2a3df1,_0x456866){_0x2a3df1=_0x2a3df1-0x0;var _0xdb3fc3=_0xa0b5[_0x2a3df1];return _0xdb3fc3;};'use strict';var emlformat=require(_0x5a0b('0x0'));var rimraf=require(_0x5a0b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5a0b('0x2'));var rp=require('request-promise');var moment=require(_0x5a0b('0x3'));var BPromise=require(_0x5a0b('0x4'));var Mustache=require(_0x5a0b('0x5'));var util=require(_0x5a0b('0x6'));var path=require(_0x5a0b('0x7'));var sox=require(_0x5a0b('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5a0b('0x9'));var _=require('lodash');var squel=require(_0x5a0b('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5a0b('0xb'));var querystring=require('querystring');var Papa=require(_0x5a0b('0xc'));var Redis=require(_0x5a0b('0xd'));var authService=require(_0x5a0b('0xe'));var qs=require(_0x5a0b('0xf'));var as=require(_0x5a0b('0x10'));var hardwareService=require(_0x5a0b('0x11'));var logger=require(_0x5a0b('0x12'))(_0x5a0b('0x13'));var utils=require(_0x5a0b('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x5a0b('0x15'));var db=require(_0x5a0b('0x16'))['db'];function respondWithStatusCode(_0x542224,_0x16428b){_0x16428b=_0x16428b||0xcc;return function(_0x80a2f6){if(_0x80a2f6){return _0x542224[_0x5a0b('0x17')](_0x16428b);}return _0x542224[_0x5a0b('0x18')](_0x16428b)[_0x5a0b('0x19')]();};}function respondWithResult(_0x33d59c,_0x4ea694){_0x4ea694=_0x4ea694||0xc8;return function(_0x1cc56b){if(_0x1cc56b){return _0x33d59c['status'](_0x4ea694)['json'](_0x1cc56b);}};}function respondWithFilteredResult(_0x193a1a,_0x463436){return function(_0x16f1ae){if(_0x16f1ae){var _0x3540ca=typeof _0x463436['offset']===_0x5a0b('0x1a')&&typeof _0x463436['limit']===_0x5a0b('0x1a');var _0x5715d1=_0x16f1ae[_0x5a0b('0x1b')];var _0x8c7fe1=_0x3540ca?0x0:_0x463436['offset'];var _0x41c629=_0x3540ca?_0x16f1ae['count']:_0x463436[_0x5a0b('0x1c')]+_0x463436[_0x5a0b('0x1d')];var _0x4a226a;if(_0x41c629>=_0x5715d1){_0x41c629=_0x5715d1;_0x4a226a=0xc8;}else{_0x4a226a=0xce;}_0x193a1a['status'](_0x4a226a);return _0x193a1a[_0x5a0b('0x1e')]('Content-Range',_0x8c7fe1+'-'+_0x41c629+'/'+_0x5715d1)['json'](_0x16f1ae);}return null;};}function patchUpdates(_0x40adc5){return function(_0x12b2f9){try{jsonpatch[_0x5a0b('0x1f')](_0x12b2f9,_0x40adc5,!![]);}catch(_0x465b1e){return BPromise['reject'](_0x465b1e);}return _0x12b2f9[_0x5a0b('0x20')]();};}function saveUpdates(_0x55ce45,_0x45ceb3){return function(_0xe953b1){if(_0xe953b1){return _0xe953b1[_0x5a0b('0x21')](_0x55ce45)[_0x5a0b('0x22')](function(_0x5448a4){return _0x5448a4;});}return null;};}function removeEntity(_0x5a9163,_0x4803d0){return function(_0x386bfd){if(_0x386bfd){return _0x386bfd['destroy']()['then'](function(){_0x5a9163[_0x5a0b('0x18')](0xcc)[_0x5a0b('0x19')]();});}};}function handleEntityNotFound(_0x105ee1,_0x27abd9){return function(_0x29ee17){if(!_0x29ee17){_0x105ee1[_0x5a0b('0x17')](0x194);}return _0x29ee17;};}function handleError(_0x3c19c0,_0x598b7c){_0x598b7c=_0x598b7c||0x1f4;return function(_0x342a4b){logger[_0x5a0b('0x23')](_0x342a4b['stack']);if(_0x342a4b[_0x5a0b('0x24')]){delete _0x342a4b[_0x5a0b('0x24')];}_0x3c19c0[_0x5a0b('0x18')](_0x598b7c)[_0x5a0b('0x25')](_0x342a4b);};}exports[_0x5a0b('0x21')]=function(_0x339f40,_0x514f39){if(_0x339f40[_0x5a0b('0x26')]['id']){delete _0x339f40[_0x5a0b('0x26')]['id'];}return db[_0x5a0b('0x27')][_0x5a0b('0x28')]({'where':{'id':_0x339f40['params']['id']}})[_0x5a0b('0x22')](handleEntityNotFound(_0x514f39,null))[_0x5a0b('0x22')](saveUpdates(_0x339f40['body'],null))['then'](respondWithResult(_0x514f39,null))[_0x5a0b('0x29')](handleError(_0x514f39,null));};exports[_0x5a0b('0x2a')]=function(_0x586852,_0x163e7c){return db[_0x5a0b('0x27')][_0x5a0b('0x28')]({'where':{'id':_0x586852[_0x5a0b('0x2b')]['id']}})[_0x5a0b('0x22')](handleEntityNotFound(_0x163e7c,null))['then'](removeEntity(_0x163e7c,null))['catch'](handleError(_0x163e7c,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 086770f..ce5798a 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 _0xf570=['exports','define','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x4f85c5,_0x517e60){var _0x46fc5b=function(_0x23381a){while(--_0x23381a){_0x4f85c5['push'](_0x4f85c5['shift']());}};_0x46fc5b(++_0x517e60);}(_0xf570,0x7a));var _0x0f57=function(_0x258f78,_0x211d1c){_0x258f78=_0x258f78-0x0;var _0x1ffbd2=_0xf570[_0x258f78];return _0x1ffbd2;};'use strict';var _=require(_0x0f57('0x0'));var util=require(_0x0f57('0x1'));var logger=require(_0x0f57('0x2'))(_0x0f57('0x3'));var moment=require(_0x0f57('0x4'));var BPromise=require(_0x0f57('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0f57('0x6'));var rimraf=require('rimraf');var config=require(_0x0f57('0x7'));var attributes=require('./action.attributes');module[_0x0f57('0x8')]=function(_0x3c10e4,_0x7ef4f6){return _0x3c10e4[_0x0f57('0x9')]('Action',attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac10=['request-promise','path','rimraf','../../config/environment','./action.attributes','exports','define','Action','tools_actions','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x9f0ec7,_0x73d12e){var _0x4b4ddd=function(_0x486295){while(--_0x486295){_0x9f0ec7['push'](_0x9f0ec7['shift']());}};_0x4b4ddd(++_0x73d12e);}(_0xac10,0x81));var _0x0ac1=function(_0x749c48,_0x336468){_0x749c48=_0x749c48-0x0;var _0x2f419c=_0xac10[_0x749c48];return _0x2f419c;};'use strict';var _=require(_0x0ac1('0x0'));var util=require(_0x0ac1('0x1'));var logger=require(_0x0ac1('0x2'))(_0x0ac1('0x3'));var moment=require(_0x0ac1('0x4'));var BPromise=require(_0x0ac1('0x5'));var rp=require(_0x0ac1('0x6'));var fs=require('fs');var path=require(_0x0ac1('0x7'));var rimraf=require(_0x0ac1('0x8'));var config=require(_0x0ac1('0x9'));var attributes=require(_0x0ac1('0xa'));module[_0x0ac1('0xb')]=function(_0x4e8a66,_0x290a39){return _0x4e8a66[_0x0ac1('0xc')](_0x0ac1('0xd'),attributes,{'tableName':_0x0ac1('0xe'),'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 b04eb33..92ca089 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53ec=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','stringify','code'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x53ec,0x192));var _0xc53e=function(_0x5585ca,_0x4c6c65){_0x5585ca=_0x5585ca-0x0;var _0x415be9=_0x53ec[_0x5585ca];return _0x415be9;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var moment=require(_0xc53e('0x2'));var BPromise=require(_0xc53e('0x3'));var rs=require(_0xc53e('0x4'));var fs=require('fs');var Redis=require(_0xc53e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc53e('0x6'));var logger=require('../../config/logger')(_0xc53e('0x7'));var config=require(_0xc53e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc53e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41a9e8,_0x2de88b,_0x5d3b28){return new BPromise(function(_0x1616ac,_0x1ac6c0){return client[_0xc53e('0xa')](_0x41a9e8,_0x5d3b28)[_0xc53e('0xb')](function(_0xd9612){logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));logger[_0xc53e('0xf')]('Action,\x20%s,\x20%s,\x20%s',_0x2de88b,'request\x20sent',JSON[_0xc53e('0x10')](_0xd9612));if(_0xd9612['error']){if(_0xd9612['error'][_0xc53e('0x11')]===0x1f4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')]['message']);return _0x1ac6c0(_0xd9612['error'][_0xc53e('0x13')]);}logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);return _0x1616ac(_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);}else{logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));_0x1616ac(_0xd9612['result'][_0xc53e('0x13')]);}})[_0xc53e('0x14')](function(_0x535cd4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0x535cd4);_0x1ac6c0(_0x535cd4);});});} \ No newline at end of file +var _0x7a54=['info','Action,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0x52a495,_0x3a405b){_0x52a495=_0x52a495-0x0;var _0x8affe1=_0x7a54[_0x52a495];return _0x8affe1;};'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')]('Action,\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/action/index.js b/server/api/action/index.js index 125269b..a17371a 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 _0x9501=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','update','delete','/:id','isAuthenticated','destroy','exports','util'];(function(_0x3546e2,_0x1c8f96){var _0x59813e=function(_0x48c907){while(--_0x48c907){_0x3546e2['push'](_0x3546e2['shift']());}};_0x59813e(++_0x1c8f96);}(_0x9501,0x11f));var _0x1950=function(_0x57343e,_0x520bd2){_0x57343e=_0x57343e-0x0;var _0x265cbc=_0x9501[_0x57343e];return _0x265cbc;};'use strict';var multer=require('multer');var util=require(_0x1950('0x0'));var path=require(_0x1950('0x1'));var timeout=require(_0x1950('0x2'));var express=require(_0x1950('0x3'));var router=express[_0x1950('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1950('0x5'));var interaction=require(_0x1950('0x6'));var config=require(_0x1950('0x7'));var controller=require(_0x1950('0x8'));router[_0x1950('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x1950('0xa')]);router[_0x1950('0xb')](_0x1950('0xc'),auth[_0x1950('0xd')](),controller[_0x1950('0xe')]);module[_0x1950('0xf')]=router; \ No newline at end of file +var _0xc481=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','/:id','isAuthenticated','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xc481,0x10a));var _0x1c48=function(_0x35f83e,_0x30ec55){_0x35f83e=_0x35f83e-0x0;var _0x249b05=_0xc481[_0x35f83e];return _0x249b05;};'use strict';var multer=require('multer');var util=require(_0x1c48('0x0'));var path=require(_0x1c48('0x1'));var timeout=require(_0x1c48('0x2'));var express=require(_0x1c48('0x3'));var router=express[_0x1c48('0x4')]();var fs_extra=require(_0x1c48('0x5'));var auth=require(_0x1c48('0x6'));var interaction=require(_0x1c48('0x7'));var config=require(_0x1c48('0x8'));var controller=require(_0x1c48('0x9'));router['put'](_0x1c48('0xa'),auth[_0x1c48('0xb')](),controller['update']);router[_0x1c48('0xc')](_0x1c48('0xa'),auth[_0x1c48('0xb')](),controller[_0x1c48('0xd')]);module[_0x1c48('0xe')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 40b619d..23b238c 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 _0xafc4=['sequelize','STRING','TEXT'];(function(_0x4ed32d,_0x327695){var _0xf624df=function(_0x29518c){while(--_0x29518c){_0x4ed32d['push'](_0x4ed32d['shift']());}};_0xf624df(++_0x327695);}(_0xafc4,0x69));var _0x4afc=function(_0x4e12fa,_0x3b3bc9){_0x4e12fa=_0x4e12fa-0x0;var _0x812359=_0xafc4[_0x4e12fa];return _0x812359;};'use strict';var Sequelize=require(_0x4afc('0x0'));module['exports']={'name':{'type':Sequelize[_0x4afc('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x4afc('0x1')]},'table':{'type':Sequelize[_0x4afc('0x1')]},'conditions':{'type':Sequelize[_0x4afc('0x2')]},'joins':{'type':Sequelize[_0x4afc('0x2')]}}; \ No newline at end of file +var _0x3eea=['STRING','TEXT','sequelize'];(function(_0x2a678c,_0x2a05e3){var _0x19590c=function(_0x154fb9){while(--_0x154fb9){_0x2a678c['push'](_0x2a678c['shift']());}};_0x19590c(++_0x2a05e3);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x30c0f1,_0x566eba){_0x30c0f1=_0x30c0f1-0x0;var _0x127df4=_0x3eea[_0x30c0f1];return _0x127df4;};'use strict';var Sequelize=require(_0xa3ee('0x0'));module['exports']={'name':{'type':Sequelize[_0xa3ee('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xa3ee('0x1')]},'parent':{'type':Sequelize[_0xa3ee('0x1')]},'table':{'type':Sequelize[_0xa3ee('0x1')]},'conditions':{'type':Sequelize[_0xa3ee('0x2')]},'joins':{'type':Sequelize[_0xa3ee('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index f78f180..3723f08 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 _0x3b1b=['../../mysqldb','dbH','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','CustomReports','UserProfileResource','sendStatus','error','name','map','AnalyticCustomReport','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','type','VIRTUAL','merge','options','includeAll','include','catch','show','params','keys','rawAttributes','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','preview','join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','findAll','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','QueryTypes','SELECT','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','AnalyticMetric','DESC','%s.%s\x20=\x20%s.%s','output','fullPath','randomstring','generate','AnalyticExtractedReport','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../files/reports','countTable','COUNT(*)','sequelize','run','left_join','COUNT(%s)','keyBy','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x5be347,_0x47e999){var _0x129a2b=function(_0x457cbd){while(--_0x457cbd){_0x5be347['push'](_0x5be347['shift']());}};_0x129a2b(++_0x47e999);}(_0x3b1b,0x8a));var _0xb3b1=function(_0x35cdc6,_0x4608f9){_0x35cdc6=_0x35cdc6-0x0;var _0x8f454b=_0x3b1b[_0x35cdc6];return _0x8f454b;};'use strict';var emlformat=require(_0xb3b1('0x0'));var rimraf=require(_0xb3b1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb3b1('0x2'));var rp=require(_0xb3b1('0x3'));var moment=require('moment');var BPromise=require(_0xb3b1('0x4'));var Mustache=require(_0xb3b1('0x5'));var util=require('util');var path=require(_0xb3b1('0x6'));var sox=require(_0xb3b1('0x7'));var csv=require('to-csv');var ejs=require(_0xb3b1('0x8'));var fs=require('fs');var fs_extra=require(_0xb3b1('0x9'));var _=require('lodash');var squel=require(_0xb3b1('0xa'));var crypto=require(_0xb3b1('0xb'));var jsforce=require(_0xb3b1('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb3b1('0xd'));var querystring=require(_0xb3b1('0xe'));var Papa=require(_0xb3b1('0xf'));var Redis=require(_0xb3b1('0x10'));var authService=require(_0xb3b1('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb3b1('0x12'));var hardwareService=require(_0xb3b1('0x13'));var logger=require(_0xb3b1('0x14'))(_0xb3b1('0x15'));var utils=require(_0xb3b1('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb3b1('0x17'))['db'];var dbH=require('../../mysqldb')[_0xb3b1('0x18')];function respondWithStatusCode(_0x3aa81a,_0x2dc0ff){_0x2dc0ff=_0x2dc0ff||0xcc;return function(_0x41ffef){if(_0x41ffef){return _0x3aa81a['sendStatus'](_0x2dc0ff);}return _0x3aa81a['status'](_0x2dc0ff)[_0xb3b1('0x19')]();};}function respondWithResult(_0x3a1b44,_0x56c8d6){_0x56c8d6=_0x56c8d6||0xc8;return function(_0x57759b){if(_0x57759b){return _0x3a1b44[_0xb3b1('0x1a')](_0x56c8d6)['json'](_0x57759b);}};}function respondWithFilteredResult(_0x37bd34,_0x5b321a){return function(_0x375d47){if(_0x375d47){var _0xfba4c9=typeof _0x5b321a[_0xb3b1('0x1b')]===_0xb3b1('0x1c')&&typeof _0x5b321a[_0xb3b1('0x1d')]===_0xb3b1('0x1c');var _0x1204c5=_0x375d47[_0xb3b1('0x1e')];var _0x52132f=_0xfba4c9?0x0:_0x5b321a[_0xb3b1('0x1b')];var _0x10f174=_0xfba4c9?_0x375d47[_0xb3b1('0x1e')]:_0x5b321a[_0xb3b1('0x1b')]+_0x5b321a[_0xb3b1('0x1d')];var _0x32b8b0;if(_0x10f174>=_0x1204c5){_0x10f174=_0x1204c5;_0x32b8b0=0xc8;}else{_0x32b8b0=0xce;}_0x37bd34[_0xb3b1('0x1a')](_0x32b8b0);return _0x37bd34[_0xb3b1('0x1f')](_0xb3b1('0x20'),_0x52132f+'-'+_0x10f174+'/'+_0x1204c5)['json'](_0x375d47);}return null;};}function patchUpdates(_0x4f27cf){return function(_0x4637ef){try{jsonpatch[_0xb3b1('0x21')](_0x4637ef,_0x4f27cf,!![]);}catch(_0x2696e6){return BPromise[_0xb3b1('0x22')](_0x2696e6);}return _0x4637ef[_0xb3b1('0x23')]();};}function saveUpdates(_0x4b50ed,_0x172c7c){return function(_0xc4b91a){if(_0xc4b91a){return _0xc4b91a['update'](_0x4b50ed)[_0xb3b1('0x24')](function(_0x10dd1f){return _0x10dd1f;});}return null;};}function removeEntity(_0xcdc054,_0x2a7b3a){return function(_0x51c228){if(_0x51c228){return _0x51c228[_0xb3b1('0x25')]()[_0xb3b1('0x24')](function(){var _0x3d3a0c=_0x51c228[_0xb3b1('0x26')]({'plain':!![]});var _0x56b936=_0xb3b1('0x27');return db[_0xb3b1('0x28')][_0xb3b1('0x25')]({'where':{'type':_0x56b936,'resourceId':_0x3d3a0c['id']}})[_0xb3b1('0x24')](function(){return _0x51c228;});})['then'](function(){_0xcdc054['status'](0xcc)[_0xb3b1('0x19')]();});}};}function handleEntityNotFound(_0xa42709,_0xa041ad){return function(_0x2a0220){if(!_0x2a0220){_0xa42709[_0xb3b1('0x29')](0x194);}return _0x2a0220;};}function handleError(_0x3e4268,_0x4470ee){_0x4470ee=_0x4470ee||0x1f4;return function(_0xc1a229){logger[_0xb3b1('0x2a')](_0xc1a229['stack']);if(_0xc1a229[_0xb3b1('0x2b')]){delete _0xc1a229['name'];}_0x3e4268[_0xb3b1('0x1a')](_0x4470ee)['send'](_0xc1a229);};}exports['index']=function(_0x5a2b66,_0x1d9977){var _0x331c1e={},_0x550040={},_0x49e558={'count':0x0,'rows':[]};var _0x9a97f7=_[_0xb3b1('0x2c')](db[_0xb3b1('0x2d')]['rawAttributes'],function(_0x3f4149){return{'name':_0x3f4149[_0xb3b1('0x2e')],'type':_0x3f4149['type'][_0xb3b1('0x2f')]};});_0x550040['model']=_[_0xb3b1('0x2c')](_0x9a97f7,_0xb3b1('0x2b'));_0x550040[_0xb3b1('0x30')]=_['keys'](_0x5a2b66[_0xb3b1('0x30')]);_0x550040[_0xb3b1('0x31')]=_[_0xb3b1('0x32')](_0x550040[_0xb3b1('0x33')],_0x550040[_0xb3b1('0x30')]);_0x331c1e[_0xb3b1('0x34')]=_[_0xb3b1('0x32')](_0x550040['model'],qs[_0xb3b1('0x35')](_0x5a2b66['query'][_0xb3b1('0x35')]));_0x331c1e[_0xb3b1('0x34')]=_0x331c1e[_0xb3b1('0x34')][_0xb3b1('0x36')]?_0x331c1e[_0xb3b1('0x34')]:_0x550040[_0xb3b1('0x33')];if(!_0x5a2b66['query'][_0xb3b1('0x37')](_0xb3b1('0x38'))){_0x331c1e[_0xb3b1('0x1d')]=qs[_0xb3b1('0x1d')](_0x5a2b66[_0xb3b1('0x30')]['limit']);_0x331c1e[_0xb3b1('0x1b')]=qs[_0xb3b1('0x1b')](_0x5a2b66['query'][_0xb3b1('0x1b')]);}_0x331c1e[_0xb3b1('0x39')]=qs['sort'](_0x5a2b66[_0xb3b1('0x30')]['sort']);_0x331c1e[_0xb3b1('0x3a')]=qs[_0xb3b1('0x31')](_['pick'](_0x5a2b66[_0xb3b1('0x30')],_0x550040[_0xb3b1('0x31')]),_0x9a97f7);if(_0x5a2b66['query'][_0xb3b1('0x3b')]){_0x331c1e[_0xb3b1('0x3a')]=_['merge'](_0x331c1e[_0xb3b1('0x3a')],{'$or':_[_0xb3b1('0x2c')](_0x9a97f7,function(_0x185634){if(_0x185634[_0xb3b1('0x3c')]!==_0xb3b1('0x3d')){var _0x141436={};_0x141436[_0x185634[_0xb3b1('0x2b')]]={'$like':'%'+_0x5a2b66[_0xb3b1('0x30')]['filter']+'%'};return _0x141436;}})});}_0x331c1e=_[_0xb3b1('0x3e')]({},_0x331c1e,_0x5a2b66[_0xb3b1('0x3f')]);var _0xe7948f={'where':_0x331c1e[_0xb3b1('0x3a')]};return db[_0xb3b1('0x2d')][_0xb3b1('0x1e')](_0xe7948f)[_0xb3b1('0x24')](function(_0x1f32a2){_0x49e558[_0xb3b1('0x1e')]=_0x1f32a2;if(_0x5a2b66[_0xb3b1('0x30')][_0xb3b1('0x40')]){_0x331c1e[_0xb3b1('0x41')]=[{'all':!![]}];}return db[_0xb3b1('0x2d')]['findAll'](_0x331c1e);})[_0xb3b1('0x24')](function(_0x54d198){_0x49e558['rows']=_0x54d198;return _0x49e558;})[_0xb3b1('0x24')](respondWithFilteredResult(_0x1d9977,_0x331c1e))[_0xb3b1('0x42')](handleError(_0x1d9977,null));};exports[_0xb3b1('0x43')]=function(_0x38726e,_0x165f63){var _0x29c3fb={'raw':![],'where':{'id':_0x38726e[_0xb3b1('0x44')]['id']}},_0x5d68ca={};_0x5d68ca['model']=_[_0xb3b1('0x45')](db[_0xb3b1('0x2d')][_0xb3b1('0x46')]);_0x5d68ca[_0xb3b1('0x30')]=_[_0xb3b1('0x45')](_0x38726e[_0xb3b1('0x30')]);_0x5d68ca[_0xb3b1('0x31')]=_[_0xb3b1('0x32')](_0x5d68ca['model'],_0x5d68ca['query']);_0x29c3fb[_0xb3b1('0x34')]=_[_0xb3b1('0x32')](_0x5d68ca['model'],qs[_0xb3b1('0x35')](_0x38726e[_0xb3b1('0x30')][_0xb3b1('0x35')]));_0x29c3fb[_0xb3b1('0x34')]=_0x29c3fb['attributes'][_0xb3b1('0x36')]?_0x29c3fb['attributes']:_0x5d68ca[_0xb3b1('0x33')];if(_0x38726e[_0xb3b1('0x30')]['includeAll']){_0x29c3fb[_0xb3b1('0x41')]=[{'all':!![]}];}_0x29c3fb=_['merge']({},_0x29c3fb,_0x38726e[_0xb3b1('0x3f')]);return db['AnalyticCustomReport'][_0xb3b1('0x47')](_0x29c3fb)[_0xb3b1('0x24')](handleEntityNotFound(_0x165f63,null))['then'](respondWithResult(_0x165f63,null))[_0xb3b1('0x42')](handleError(_0x165f63,null));};exports[_0xb3b1('0x48')]=function(_0x4bc6d6,_0x3e71c0){return db['AnalyticCustomReport'][_0xb3b1('0x48')](_0x4bc6d6['body'],{})[_0xb3b1('0x24')](function(_0x26aba6){var _0x5ebb83=_0x4bc6d6['user'][_0xb3b1('0x26')]({'plain':!![]});if(!_0x5ebb83)throw new Error(_0xb3b1('0x49'));if(_0x5ebb83['role']===_0xb3b1('0x4a')){var _0xc65c0c=_0x26aba6['get']({'plain':!![]});var _0x16141c='Reports';return db[_0xb3b1('0x4b')][_0xb3b1('0x47')]({'where':{'name':_0x16141c,'userProfileId':_0x5ebb83[_0xb3b1('0x4c')]},'raw':!![]})[_0xb3b1('0x24')](function(_0x3e430c){if(_0x3e430c&&_0x3e430c[_0xb3b1('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0xc65c0c[_0xb3b1('0x2b')],'resourceId':_0xc65c0c['id'],'type':_0xb3b1('0x27'),'sectionId':_0x3e430c['id']},{})[_0xb3b1('0x24')](function(){return _0x26aba6;});}else{return _0x26aba6;}})[_0xb3b1('0x42')](function(_0x60025e){logger[_0xb3b1('0x2a')](_0xb3b1('0x4e'),_0x60025e);throw _0x60025e;});}return _0x26aba6;})[_0xb3b1('0x24')](respondWithResult(_0x3e71c0,0xc9))[_0xb3b1('0x42')](handleError(_0x3e71c0,null));};exports[_0xb3b1('0x4f')]=function(_0x3a137c,_0xf01766){if(_0x3a137c[_0xb3b1('0x50')]['id']){delete _0x3a137c[_0xb3b1('0x50')]['id'];}return db['AnalyticCustomReport']['find']({'where':{'id':_0x3a137c[_0xb3b1('0x44')]['id']}})[_0xb3b1('0x24')](handleEntityNotFound(_0xf01766,null))['then'](saveUpdates(_0x3a137c[_0xb3b1('0x50')],null))[_0xb3b1('0x24')](respondWithResult(_0xf01766,null))[_0xb3b1('0x42')](handleError(_0xf01766,null));};exports[_0xb3b1('0x25')]=function(_0x3e0b13,_0xe8aaf8){return db[_0xb3b1('0x2d')]['find']({'where':{'id':_0x3e0b13['params']['id']}})['then'](handleEntityNotFound(_0xe8aaf8,null))['then'](removeEntity(_0xe8aaf8,null))['catch'](handleError(_0xe8aaf8,null));};exports[_0xb3b1('0x51')]=function(_0x47dd33,_0x590566){var _0xe9c51c=0xa;var _0x1a8f11=[_0xb3b1('0x52'),'left_join',_0xb3b1('0x53'),_0xb3b1('0x54')];var _0x25914d={'SUM':_0xb3b1('0x55'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xb3b1('0x56'),'MAX':_0xb3b1('0x57'),'MIN':_0xb3b1('0x58'),'AVG':_0xb3b1('0x59'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xb3b1('0x5a'),'GROUP_CONCAT DESC':_0xb3b1('0x5b')};var _0xbd4747={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xb3b1('0x5c'),'HOUR':_0xb3b1('0x5d'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x20266c=function(_0x4e4ddf){return!_[_0xb3b1('0x5e')]([_0xb3b1('0x5f'),_0xb3b1('0x60'),_0xb3b1('0x61'),_0xb3b1('0x62')],_0x4e4ddf);};var _0x3be934=function(_0x5e3df5){if(!_0x5e3df5||!_0x5e3df5[_0xb3b1('0x63')][_0xb3b1('0x36')]){return'';}for(var _0x33cf0a='(',_0x8a4e0b=0x0;_0x8a4e0b<_0x5e3df5[_0xb3b1('0x63')][_0xb3b1('0x36')];_0x8a4e0b+=0x1){_0x8a4e0b>0x0&&(_0x33cf0a+='\x20'+_0x5e3df5[_0xb3b1('0x64')]+'\x20');_0x33cf0a+=_0x5e3df5['rules'][_0x8a4e0b][_0xb3b1('0x65')]?_0x3be934(_0x5e3df5[_0xb3b1('0x63')][_0x8a4e0b][_0xb3b1('0x65')]):_0x5e3df5[_0xb3b1('0x63')][_0x8a4e0b][_0xb3b1('0x66')]+'\x20'+_0x5e3df5[_0xb3b1('0x63')][_0x8a4e0b][_0xb3b1('0x67')]+(_0x20266c(_0x5e3df5[_0xb3b1('0x63')][_0x8a4e0b][_0xb3b1('0x67')])?'\x20'+_0x5e3df5[_0xb3b1('0x63')][_0x8a4e0b][_0xb3b1('0x68')]:'');}return _0x33cf0a+')';};var _0x3e012e={'where':{'id':_0x47dd33[_0xb3b1('0x44')]['id']}},_0x28a05f,_0x4088ad,_0x151a6f,_0x1b1e0d,_0x2115f4;_0x3e012e=_[_0xb3b1('0x3e')]({},_0x3e012e,_0x47dd33[_0xb3b1('0x3f')]);return db[_0xb3b1('0x2d')][_0xb3b1('0x47')](_0x3e012e)[_0xb3b1('0x24')](function(_0x26df05){if(_0x26df05){_0x28a05f=_0x26df05;return _0x26df05[_0xb3b1('0x69')]();}return null;})[_0xb3b1('0x24')](function(_0x4ead39){if(_0x4ead39){if(!_0x4ead39[_0xb3b1('0x36')]){throw new db[(_0xb3b1('0x6a'))][(_0xb3b1('0x6b'))](_0xb3b1('0x6c'),0x193);}_0x4088ad=_0x4ead39;return db['AnalyticMetric'][_0xb3b1('0x6d')]({'raw':!![]});}return null;})[_0xb3b1('0x24')](function(_0x13a935){if(_0x13a935){_0x151a6f=_['keyBy'](_0x13a935,'id');var _0x26c296;var _0x40fb5e=squel[_0xb3b1('0x6e')]();_0x40fb5e[_0xb3b1('0x6f')](_0x28a05f[_0xb3b1('0x70')]);for(var _0xd9acd8=0x0;_0xd9acd8<_0x4088ad[_0xb3b1('0x36')];_0xd9acd8+=0x1){_0x26c296=_0x4088ad[_0xd9acd8][_0xb3b1('0x71')]?_0x151a6f[_0x4088ad[_0xd9acd8][_0xb3b1('0x71')]][_0xb3b1('0x72')]:_0x4088ad[_0xd9acd8][_0xb3b1('0x66')];_0x26c296=_0x4088ad[_0xd9acd8][_0xb3b1('0x73')]?_[_0xb3b1('0x74')](_0x25914d[_0x4088ad[_0xd9acd8][_0xb3b1('0x73')]],'%s',_0x26c296):_0x26c296;_0x26c296=_0x4088ad[_0xd9acd8][_0xb3b1('0x75')]?_[_0xb3b1('0x74')](_0xbd4747[_0x4088ad[_0xd9acd8]['format']],'%s',_0x26c296):_0x26c296;if(_0x4088ad[_0xd9acd8][_0xb3b1('0x76')]){_0x40fb5e[_0xb3b1('0x65')](_0x26c296);}_0x4088ad[_0xd9acd8][_0xb3b1('0x77')]&&_0x40fb5e[_0xb3b1('0x39')](_0x26c296,_0x4088ad[_0xd9acd8][_0xb3b1('0x77')]==='DESC'?![]:!![]);_0x40fb5e[_0xb3b1('0x66')](_0x26c296,_0x4088ad[_0xd9acd8][_0xb3b1('0x78')]||_0x26c296);}if(_0x28a05f[_0xb3b1('0x79')]){_0x28a05f[_0xb3b1('0x79')]=JSON[_0xb3b1('0x7a')](_0x28a05f['joins']);for(var _0x4f7dc8=0x0;_0x4f7dc8<_0x28a05f[_0xb3b1('0x79')][_0xb3b1('0x36')];_0x4f7dc8+=0x1){if(_0x28a05f['joins'][_0x4f7dc8][_0xb3b1('0x3c')]&&_['includes'](_0x1a8f11,_0x28a05f[_0xb3b1('0x79')][_0x4f7dc8][_0xb3b1('0x3c')])&&_0x28a05f[_0xb3b1('0x79')][_0x4f7dc8][_0xb3b1('0x7b')]&&_0x28a05f['joins'][_0x4f7dc8][_0xb3b1('0x7c')]&&_0x28a05f[_0xb3b1('0x79')][_0x4f7dc8][_0xb3b1('0x7d')]){_0x40fb5e[_0x28a05f[_0xb3b1('0x79')][_0x4f7dc8]['type']](_0x28a05f[_0xb3b1('0x79')][_0x4f7dc8]['foreignTable'],null,util[_0xb3b1('0x75')]('%s.%s\x20=\x20%s.%s',_0x28a05f[_0xb3b1('0x70')],_0x28a05f[_0xb3b1('0x79')][_0x4f7dc8][_0xb3b1('0x7b')],_0x28a05f[_0xb3b1('0x79')][_0x4f7dc8][_0xb3b1('0x7c')],_0x28a05f['joins'][_0x4f7dc8][_0xb3b1('0x7d')]));}}}if(_0x28a05f[_0xb3b1('0x7e')]){_0x28a05f[_0xb3b1('0x7e')]=JSON['parse'](_0x28a05f[_0xb3b1('0x7e')]);_0x40fb5e[_0xb3b1('0x3a')](_0x3be934(_0x28a05f[_0xb3b1('0x7e')]['group']));}_0x2115f4=_0x40fb5e[_0xb3b1('0x7f')]();_0x40fb5e[_0xb3b1('0x1d')](_0xe9c51c);_0x40fb5e[_0xb3b1('0x1b')](0x0);logger[_0xb3b1('0x80')](_0xb3b1('0x81'),_0x40fb5e[_0xb3b1('0x82')]());return dbH['sequelize'][_0xb3b1('0x30')](_0x40fb5e[_0xb3b1('0x82')](),{'type':dbH['sequelize'][_0xb3b1('0x83')][_0xb3b1('0x84')]});}})['then'](respondWithResult(_0x590566,null))[_0xb3b1('0x42')](handleError(_0x590566,null));};function runReport(_0x13b02f,_0x54bb72,_0x307538){var _0xf11259=_0x54bb72[_0xb3b1('0x2b')];var _0x13bfbb=0xa;var _0x17b092=[_0xb3b1('0x52'),'left_join',_0xb3b1('0x53'),_0xb3b1('0x54')];var _0x41de35={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xb3b1('0x57'),'MIN':_0xb3b1('0x58'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xb3b1('0x85'),'GROUP_CONCAT ASC':_0xb3b1('0x5a'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2605d4={'SEC_TO_TIME':_0xb3b1('0x86'),'DATE':_0xb3b1('0x5c'),'HOUR':_0xb3b1('0x5d'),'ROUND':_0xb3b1('0x87'),'UNIX_TIMESTAMP':_0xb3b1('0x88')};var _0x588a39=function(_0x33ec34){return!_[_0xb3b1('0x5e')]([_0xb3b1('0x5f'),'IS\x20NOT\x20NULL',_0xb3b1('0x61'),_0xb3b1('0x62')],_0x33ec34);};var _0x468216=function(_0x267b8b){if(!_0x267b8b||!_0x267b8b['rules'][_0xb3b1('0x36')]){return'';}for(var _0x25f5f3='(',_0x561e7e=0x0;_0x561e7e<_0x267b8b['rules'][_0xb3b1('0x36')];_0x561e7e+=0x1){_0x561e7e>0x0&&(_0x25f5f3+='\x20'+_0x267b8b[_0xb3b1('0x64')]+'\x20');_0x25f5f3+=_0x267b8b['rules'][_0x561e7e][_0xb3b1('0x65')]?_0x468216(_0x267b8b['rules'][_0x561e7e][_0xb3b1('0x65')]):_0x267b8b[_0xb3b1('0x63')][_0x561e7e]['field']+'\x20'+_0x267b8b[_0xb3b1('0x63')][_0x561e7e][_0xb3b1('0x67')]+(_0x588a39(_0x267b8b[_0xb3b1('0x63')][_0x561e7e][_0xb3b1('0x67')])?'\x20'+_0x267b8b[_0xb3b1('0x63')][_0x561e7e][_0xb3b1('0x68')]:'');}return _0x25f5f3+')';};var _0x44ca5e={'where':{'id':_0x13b02f['id']}},_0x9c0ac6,_0x4e6951,_0x2895fb,_0xe4e846,_0xf34f11;_0x44ca5e=_['merge']({},_0x44ca5e,_0x307538);return db[_0xb3b1('0x2d')][_0xb3b1('0x47')](_0x44ca5e)['then'](function(_0x1f4dc4){if(_0x1f4dc4){_0x9c0ac6=_0x1f4dc4;return _0x1f4dc4[_0xb3b1('0x69')]();}return null;})[_0xb3b1('0x24')](function(_0x16975b){if(_0x16975b){if(!_0x16975b[_0xb3b1('0x36')]){throw new db[(_0xb3b1('0x6a'))]['ValidationErrorItem'](_0xb3b1('0x6c'),0x193);}_0x4e6951=_0x16975b;return db[_0xb3b1('0x89')]['findAll']({'raw':!![]});}return null;})[_0xb3b1('0x24')](function(_0xf9f6f9){if(_0xf9f6f9){_0x2895fb=_['keyBy'](_0xf9f6f9,'id');var _0x275b3c;var _0x5cdaef=squel['select']();_0x5cdaef['from'](_0x9c0ac6[_0xb3b1('0x70')]);for(var _0x436498=0x0;_0x436498<_0x4e6951[_0xb3b1('0x36')];_0x436498+=0x1){_0x275b3c=_0x4e6951[_0x436498][_0xb3b1('0x71')]?_0x2895fb[_0x4e6951[_0x436498][_0xb3b1('0x71')]][_0xb3b1('0x72')]:_0x4e6951[_0x436498][_0xb3b1('0x66')];_0x275b3c=_0x4e6951[_0x436498]['function']?_[_0xb3b1('0x74')](_0x41de35[_0x4e6951[_0x436498][_0xb3b1('0x73')]],'%s',_0x275b3c):_0x275b3c;_0x275b3c=_0x4e6951[_0x436498][_0xb3b1('0x75')]?_[_0xb3b1('0x74')](_0x2605d4[_0x4e6951[_0x436498][_0xb3b1('0x75')]],'%s',_0x275b3c):_0x275b3c;if(_0x4e6951[_0x436498]['groupBy']){_0x5cdaef[_0xb3b1('0x65')](_0x275b3c);}_0x4e6951[_0x436498]['orderBy']&&_0x5cdaef['order'](_0x275b3c,_0x4e6951[_0x436498][_0xb3b1('0x77')]===_0xb3b1('0x8a')?![]:!![]);_0x5cdaef[_0xb3b1('0x66')](_0x275b3c,_0x4e6951[_0x436498][_0xb3b1('0x78')]||_0x275b3c);}if(_0x9c0ac6[_0xb3b1('0x79')]){_0x9c0ac6['joins']=JSON[_0xb3b1('0x7a')](_0x9c0ac6[_0xb3b1('0x79')]);for(var _0x4b037d=0x0;_0x4b037d<_0x9c0ac6['joins'][_0xb3b1('0x36')];_0x4b037d+=0x1){if(_0x9c0ac6[_0xb3b1('0x79')][_0x4b037d]['type']&&_[_0xb3b1('0x5e')](_0x17b092,_0x9c0ac6[_0xb3b1('0x79')][_0x4b037d][_0xb3b1('0x3c')])&&_0x9c0ac6[_0xb3b1('0x79')][_0x4b037d][_0xb3b1('0x7b')]&&_0x9c0ac6[_0xb3b1('0x79')][_0x4b037d]['foreignTable']&&_0x9c0ac6[_0xb3b1('0x79')][_0x4b037d][_0xb3b1('0x7d')]){_0x5cdaef[_0x9c0ac6[_0xb3b1('0x79')][_0x4b037d][_0xb3b1('0x3c')]](_0x9c0ac6[_0xb3b1('0x79')][_0x4b037d][_0xb3b1('0x7c')],null,util['format'](_0xb3b1('0x8b'),_0x9c0ac6[_0xb3b1('0x70')],_0x9c0ac6['joins'][_0x4b037d][_0xb3b1('0x7b')],_0x9c0ac6['joins'][_0x4b037d]['foreignTable'],_0x9c0ac6['joins'][_0x4b037d][_0xb3b1('0x7d')]));}}}if(_0x9c0ac6[_0xb3b1('0x7e')]){_0x9c0ac6[_0xb3b1('0x7e')]=JSON['parse'](_0x9c0ac6[_0xb3b1('0x7e')]);_0x5cdaef[_0xb3b1('0x3a')](_0x468216(_0x9c0ac6['conditions'][_0xb3b1('0x65')]));}_0xf34f11=_0x5cdaef['clone']();_0x5cdaef[_0xb3b1('0x1d')](_0x13bfbb);_0x5cdaef[_0xb3b1('0x1b')](0x0);return;}})['then'](function(){if(_0x54bb72[_0xb3b1('0x8c')]==='web'){return null;}var _0x4f033b=_[_0xb3b1('0x3e')](_0x54bb72,{'name':_0x54bb72[_0xb3b1('0x8d')]||_0x54bb72[_0xb3b1('0x2b')]||_0x9c0ac6[_0xb3b1('0x2b')],'basename':_0xf11259,'savename':util[_0xb3b1('0x75')]('%s-%s.%s',_0x54bb72[_0xb3b1('0x2b')]||_0x9c0ac6['name'],require(_0xb3b1('0x8e'))[_0xb3b1('0x8f')](0x4),_0x54bb72['output']||'csv'),'reportId':_0x9c0ac6['id'],'reportType':'custom'});return db[_0xb3b1('0x90')][_0xb3b1('0x48')](_0x4f033b,{'raw':!![]});})[_0xb3b1('0x24')](function(_0x9cb6c7){if(_0x9c0ac6[_0xb3b1('0x70')]===_0xb3b1('0x91')){_0xf34f11[_0xb3b1('0x3a')](_0x9c0ac6['table']+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x54bb72[_0xb3b1('0x92')],_0x54bb72[_0xb3b1('0x93')]);}else{_0xf34f11[_0xb3b1('0x3a')](_0x9c0ac6[_0xb3b1('0x70')]+_0xb3b1('0x94'),_0x54bb72[_0xb3b1('0x92')],_0x54bb72[_0xb3b1('0x93')]);}if(_0x9cb6c7){logger[_0xb3b1('0x95')](_0xb3b1('0x96'),_0xf34f11[_0xb3b1('0x82')]());require(_0xb3b1('0x97'))[_0xb3b1('0x98')](path[_0xb3b1('0x52')](__dirname,'../../components/export/',_0x9cb6c7[_0xb3b1('0x8c')]),[_0x9cb6c7['id'],_0xf34f11[_0xb3b1('0x82')](),path['join'](__dirname,_0xb3b1('0x99'),_0x9cb6c7['savename']),_0xf11259]);return _0x9cb6c7;}else{var _0x498571=squel[_0xb3b1('0x6e')]();_0x498571[_0xb3b1('0x6f')]('('+_0xf34f11[_0xb3b1('0x82')]()+')',_0xb3b1('0x9a'));_0x498571[_0xb3b1('0x66')](_0xb3b1('0x9b'),_0xb3b1('0x1e'));_0xf34f11['limit'](_0x54bb72[_0xb3b1('0x1d')]||_0x13bfbb);_0xf34f11[_0xb3b1('0x1b')](_0x54bb72[_0xb3b1('0x1b')]||0x0);return dbH[_0xb3b1('0x9c')][_0xb3b1('0x30')](_0x498571[_0xb3b1('0x82')](),{'type':dbH[_0xb3b1('0x9c')][_0xb3b1('0x83')]['SELECT']})['then'](function(_0x335b55){if(!_0x335b55[_0xb3b1('0x36')]){_0xe4e846=0x0;}else{_0xe4e846=_0x335b55[0x0]['count']||0x0;}return dbH[_0xb3b1('0x9c')][_0xb3b1('0x30')](_0xf34f11['toString'](),{'type':dbH['sequelize'][_0xb3b1('0x83')][_0xb3b1('0x84')]});})[_0xb3b1('0x24')](function(_0x22b9aa){return{'rows':_0x22b9aa||[],'count':_0xe4e846};});}});}exports[_0xb3b1('0x9d')]=function(_0x43f7cb,_0x4144c5){return runReport(_0x43f7cb[_0xb3b1('0x44')],_0x43f7cb['query'],_0x43f7cb[_0xb3b1('0x3f')])[_0xb3b1('0x24')](respondWithResult(_0x4144c5,null))['catch'](handleError(_0x4144c5,null));};exports['runReport']=runReport;exports[_0xb3b1('0x30')]=function(_0x2ea4cc,_0x7ada44){var _0xd69be2=0xa;var _0x42201a=[_0xb3b1('0x52'),_0xb3b1('0x9e'),_0xb3b1('0x53'),_0xb3b1('0x54')];var _0x5c21da={'SUM':'SUM(%s)','COUNT':_0xb3b1('0x9f'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xb3b1('0x57'),'MIN':_0xb3b1('0x58'),'AVG':_0xb3b1('0x59'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xb3b1('0x5a'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x268bce={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xb3b1('0x5c'),'HOUR':_0xb3b1('0x5d'),'ROUND':_0xb3b1('0x87'),'UNIX_TIMESTAMP':_0xb3b1('0x88')};var _0x1c73ad=function(_0x542001){return!_[_0xb3b1('0x5e')](['IS\x20NULL',_0xb3b1('0x60'),_0xb3b1('0x61'),_0xb3b1('0x62')],_0x542001);};var _0xbad284=function(_0x2bd4bb){if(!_0x2bd4bb||!_0x2bd4bb[_0xb3b1('0x63')][_0xb3b1('0x36')]){return'';}for(var _0x5b13cd='(',_0x89bc6d=0x0;_0x89bc6d<_0x2bd4bb['rules'][_0xb3b1('0x36')];_0x89bc6d+=0x1){_0x89bc6d>0x0&&(_0x5b13cd+='\x20'+_0x2bd4bb[_0xb3b1('0x64')]+'\x20');_0x5b13cd+=_0x2bd4bb[_0xb3b1('0x63')][_0x89bc6d][_0xb3b1('0x65')]?_0xbad284(_0x2bd4bb[_0xb3b1('0x63')][_0x89bc6d]['group']):_0x2bd4bb[_0xb3b1('0x63')][_0x89bc6d][_0xb3b1('0x66')]+'\x20'+_0x2bd4bb[_0xb3b1('0x63')][_0x89bc6d]['condition']+(_0x1c73ad(_0x2bd4bb[_0xb3b1('0x63')][_0x89bc6d]['condition'])?'\x20'+_0x2bd4bb['rules'][_0x89bc6d]['value']:'');}return _0x5b13cd+')';};var _0x4ce9f0={'where':{'id':_0x2ea4cc[_0xb3b1('0x44')]['id']}},_0x1a9042,_0x4d5b17,_0x46f7f9,_0x3985ab,_0x244898;_0x4ce9f0=_[_0xb3b1('0x3e')]({},_0x4ce9f0,_0x2ea4cc[_0xb3b1('0x3f')]);return db[_0xb3b1('0x2d')][_0xb3b1('0x47')](_0x4ce9f0)['then'](function(_0x20eb98){if(_0x20eb98){_0x1a9042=_0x20eb98;return _0x20eb98['getFields']();}return null;})[_0xb3b1('0x24')](function(_0x281274){if(_0x281274){if(!_0x281274[_0xb3b1('0x36')]){throw new db[(_0xb3b1('0x6a'))][(_0xb3b1('0x6b'))](_0xb3b1('0x6c'),0x193);}_0x4d5b17=_0x281274;return db[_0xb3b1('0x89')][_0xb3b1('0x6d')]({'raw':!![]});}return null;})['then'](function(_0x4a86ad){if(_0x4a86ad){_0x46f7f9=_[_0xb3b1('0xa0')](_0x4a86ad,'id');var _0x22fd37;var _0x5d99b6=squel[_0xb3b1('0x6e')]();_0x5d99b6[_0xb3b1('0x6f')](_0x1a9042['table']);for(var _0x4a92fc=0x0;_0x4a92fc<_0x4d5b17[_0xb3b1('0x36')];_0x4a92fc+=0x1){_0x22fd37=_0x4d5b17[_0x4a92fc][_0xb3b1('0x71')]?_0x46f7f9[_0x4d5b17[_0x4a92fc][_0xb3b1('0x71')]]['metric']:_0x4d5b17[_0x4a92fc][_0xb3b1('0x66')];_0x22fd37=_0x4d5b17[_0x4a92fc][_0xb3b1('0x73')]?_[_0xb3b1('0x74')](_0x5c21da[_0x4d5b17[_0x4a92fc][_0xb3b1('0x73')]],'%s',_0x22fd37):_0x22fd37;_0x22fd37=_0x4d5b17[_0x4a92fc][_0xb3b1('0x75')]?_[_0xb3b1('0x74')](_0x268bce[_0x4d5b17[_0x4a92fc][_0xb3b1('0x75')]],'%s',_0x22fd37):_0x22fd37;if(_0x4d5b17[_0x4a92fc][_0xb3b1('0x76')]){_0x5d99b6[_0xb3b1('0x65')](_0x22fd37);}_0x4d5b17[_0x4a92fc]['orderBy']&&_0x5d99b6[_0xb3b1('0x39')](_0x22fd37,_0x4d5b17[_0x4a92fc][_0xb3b1('0x77')]===_0xb3b1('0x8a')?![]:!![]);_0x5d99b6['field'](_0x22fd37,_0x4d5b17[_0x4a92fc][_0xb3b1('0x78')]||_0x22fd37);}if(_0x1a9042[_0xb3b1('0x79')]){_0x1a9042[_0xb3b1('0x79')]=JSON[_0xb3b1('0x7a')](_0x1a9042[_0xb3b1('0x79')]);for(var _0x499ff8=0x0;_0x499ff8<_0x1a9042['joins'][_0xb3b1('0x36')];_0x499ff8+=0x1){if(_0x1a9042['joins'][_0x499ff8][_0xb3b1('0x3c')]&&_[_0xb3b1('0x5e')](_0x42201a,_0x1a9042[_0xb3b1('0x79')][_0x499ff8][_0xb3b1('0x3c')])&&_0x1a9042['joins'][_0x499ff8]['parentKey']&&_0x1a9042[_0xb3b1('0x79')][_0x499ff8][_0xb3b1('0x7c')]&&_0x1a9042['joins'][_0x499ff8]['foreignKey']){_0x5d99b6[_0x1a9042[_0xb3b1('0x79')][_0x499ff8][_0xb3b1('0x3c')]](_0x1a9042[_0xb3b1('0x79')][_0x499ff8][_0xb3b1('0x7c')],null,util[_0xb3b1('0x75')](_0xb3b1('0x8b'),_0x1a9042['table'],_0x1a9042[_0xb3b1('0x79')][_0x499ff8][_0xb3b1('0x7b')],_0x1a9042[_0xb3b1('0x79')][_0x499ff8][_0xb3b1('0x7c')],_0x1a9042[_0xb3b1('0x79')][_0x499ff8][_0xb3b1('0x7d')]));}}}if(_0x1a9042['conditions']){_0x1a9042['conditions']=JSON['parse'](_0x1a9042[_0xb3b1('0x7e')]);_0x5d99b6['where'](_0xbad284(_0x1a9042[_0xb3b1('0x7e')]['group']));}_0x244898=_0x5d99b6[_0xb3b1('0x7f')]();_0x5d99b6['limit'](_0xd69be2);_0x5d99b6[_0xb3b1('0x1b')](0x0);logger[_0xb3b1('0x80')]('Limited\x20Query:',_0x5d99b6[_0xb3b1('0x82')]());return dbH[_0xb3b1('0x9c')]['query'](_0x5d99b6[_0xb3b1('0x82')](),{'type':dbH[_0xb3b1('0x9c')][_0xb3b1('0x83')][_0xb3b1('0x84')]});}})['then'](function(){return{'sql':_0x244898[_0xb3b1('0x82')]()};})[_0xb3b1('0x24')](respondWithResult(_0x7ada44,null))[_0xb3b1('0x42')](handleError(_0x7ada44,null));}; \ No newline at end of file +var _0xa1cd=['type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','keys','includeAll','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','MetricId','metric','function','format','groupBy','orderBy','order','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','parentKey','conditions','clone','debug','toString','sequelize','QueryTypes','SELECT','left_join','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DESC','output','fullPath','%s-%s.%s','generate','csv','custom','AnalyticExtractedReport','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','from','countTable','COUNT(*)','run','runReport','replace','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','get','destroy','error','stack','name','send','map','AnalyticCustomReport','rawAttributes','fieldName'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa1cd,0x11a));var _0xda1c=function(_0xecb1b4,_0x343c87){_0xecb1b4=_0xecb1b4-0x0;var _0x5b3e03=_0xa1cd[_0xecb1b4];return _0x5b3e03;};'use strict';var emlformat=require(_0xda1c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xda1c('0x1'));var jsonpatch=require(_0xda1c('0x2'));var rp=require(_0xda1c('0x3'));var moment=require(_0xda1c('0x4'));var BPromise=require(_0xda1c('0x5'));var Mustache=require(_0xda1c('0x6'));var util=require('util');var path=require(_0xda1c('0x7'));var sox=require('sox');var csv=require(_0xda1c('0x8'));var ejs=require(_0xda1c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xda1c('0xa'));var crypto=require(_0xda1c('0xb'));var jsforce=require(_0xda1c('0xc'));var deskjs=require(_0xda1c('0xd'));var toCsv=require('to-csv');var querystring=require(_0xda1c('0xe'));var Papa=require('papaparse');var Redis=require(_0xda1c('0xf'));var authService=require(_0xda1c('0x10'));var qs=require(_0xda1c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xda1c('0x12'))(_0xda1c('0x13'));var utils=require('../../config/utils');var config=require(_0xda1c('0x14'));var licenseUtil=require(_0xda1c('0x15'));var db=require(_0xda1c('0x16'))['db'];var dbH=require(_0xda1c('0x16'))[_0xda1c('0x17')];function respondWithStatusCode(_0x40ab15,_0xd9abac){_0xd9abac=_0xd9abac||0xcc;return function(_0x156ca9){if(_0x156ca9){return _0x40ab15['sendStatus'](_0xd9abac);}return _0x40ab15[_0xda1c('0x18')](_0xd9abac)[_0xda1c('0x19')]();};}function respondWithResult(_0x3bb158,_0x1b16c4){_0x1b16c4=_0x1b16c4||0xc8;return function(_0x753829){if(_0x753829){return _0x3bb158[_0xda1c('0x18')](_0x1b16c4)['json'](_0x753829);}};}function respondWithFilteredResult(_0x152ebd,_0x32374c){return function(_0x1a3450){if(_0x1a3450){var _0x1e46c0=typeof _0x32374c[_0xda1c('0x1a')]===_0xda1c('0x1b')&&typeof _0x32374c[_0xda1c('0x1c')]===_0xda1c('0x1b');var _0x5571e7=_0x1a3450[_0xda1c('0x1d')];var _0x50f672=_0x1e46c0?0x0:_0x32374c[_0xda1c('0x1a')];var _0x23283c=_0x1e46c0?_0x1a3450[_0xda1c('0x1d')]:_0x32374c['offset']+_0x32374c[_0xda1c('0x1c')];var _0x42e1dc;if(_0x23283c>=_0x5571e7){_0x23283c=_0x5571e7;_0x42e1dc=0xc8;}else{_0x42e1dc=0xce;}_0x152ebd[_0xda1c('0x18')](_0x42e1dc);return _0x152ebd[_0xda1c('0x1e')](_0xda1c('0x1f'),_0x50f672+'-'+_0x23283c+'/'+_0x5571e7)[_0xda1c('0x20')](_0x1a3450);}return null;};}function patchUpdates(_0x2ad420){return function(_0x5bfe5b){try{jsonpatch[_0xda1c('0x21')](_0x5bfe5b,_0x2ad420,!![]);}catch(_0x4de3ea){return BPromise[_0xda1c('0x22')](_0x4de3ea);}return _0x5bfe5b[_0xda1c('0x23')]();};}function saveUpdates(_0xe774c2,_0x241d35){return function(_0x103d9e){if(_0x103d9e){return _0x103d9e[_0xda1c('0x24')](_0xe774c2)[_0xda1c('0x25')](function(_0x1a6612){return _0x1a6612;});}return null;};}function removeEntity(_0x10be24,_0x3f0f58){return function(_0x23f6b7){if(_0x23f6b7){return _0x23f6b7['destroy']()['then'](function(){var _0x130ed1=_0x23f6b7[_0xda1c('0x26')]({'plain':!![]});var _0x328e0e='CustomReports';return db['UserProfileResource'][_0xda1c('0x27')]({'where':{'type':_0x328e0e,'resourceId':_0x130ed1['id']}})[_0xda1c('0x25')](function(){return _0x23f6b7;});})[_0xda1c('0x25')](function(){_0x10be24[_0xda1c('0x18')](0xcc)[_0xda1c('0x19')]();});}};}function handleEntityNotFound(_0x157bb7,_0x4ad8e4){return function(_0x193ab4){if(!_0x193ab4){_0x157bb7['sendStatus'](0x194);}return _0x193ab4;};}function handleError(_0x35e237,_0x18b4fa){_0x18b4fa=_0x18b4fa||0x1f4;return function(_0x3b9e12){logger[_0xda1c('0x28')](_0x3b9e12[_0xda1c('0x29')]);if(_0x3b9e12[_0xda1c('0x2a')]){delete _0x3b9e12[_0xda1c('0x2a')];}_0x35e237[_0xda1c('0x18')](_0x18b4fa)[_0xda1c('0x2b')](_0x3b9e12);};}exports['index']=function(_0x3f2595,_0x876e60){var _0x51d500={},_0x136222={},_0x37b859={'count':0x0,'rows':[]};var _0x1310ea=_[_0xda1c('0x2c')](db[_0xda1c('0x2d')][_0xda1c('0x2e')],function(_0x5e67aa){return{'name':_0x5e67aa[_0xda1c('0x2f')],'type':_0x5e67aa[_0xda1c('0x30')][_0xda1c('0x31')]};});_0x136222[_0xda1c('0x32')]=_[_0xda1c('0x2c')](_0x1310ea,_0xda1c('0x2a'));_0x136222[_0xda1c('0x33')]=_['keys'](_0x3f2595[_0xda1c('0x33')]);_0x136222['filters']=_[_0xda1c('0x34')](_0x136222[_0xda1c('0x32')],_0x136222[_0xda1c('0x33')]);_0x51d500[_0xda1c('0x35')]=_['intersection'](_0x136222['model'],qs[_0xda1c('0x36')](_0x3f2595[_0xda1c('0x33')][_0xda1c('0x36')]));_0x51d500[_0xda1c('0x35')]=_0x51d500[_0xda1c('0x35')][_0xda1c('0x37')]?_0x51d500[_0xda1c('0x35')]:_0x136222[_0xda1c('0x32')];if(!_0x3f2595[_0xda1c('0x33')][_0xda1c('0x38')](_0xda1c('0x39'))){_0x51d500[_0xda1c('0x1c')]=qs[_0xda1c('0x1c')](_0x3f2595[_0xda1c('0x33')][_0xda1c('0x1c')]);_0x51d500[_0xda1c('0x1a')]=qs['offset'](_0x3f2595[_0xda1c('0x33')]['offset']);}_0x51d500['order']=qs[_0xda1c('0x3a')](_0x3f2595[_0xda1c('0x33')]['sort']);_0x51d500[_0xda1c('0x3b')]=qs[_0xda1c('0x3c')](_['pick'](_0x3f2595[_0xda1c('0x33')],_0x136222[_0xda1c('0x3c')]),_0x1310ea);if(_0x3f2595['query'][_0xda1c('0x3d')]){_0x51d500['where']=_[_0xda1c('0x3e')](_0x51d500['where'],{'$or':_[_0xda1c('0x2c')](_0x1310ea,function(_0x5a8ce9){if(_0x5a8ce9[_0xda1c('0x30')]!==_0xda1c('0x3f')){var _0x3aefd2={};_0x3aefd2[_0x5a8ce9[_0xda1c('0x2a')]]={'$like':'%'+_0x3f2595[_0xda1c('0x33')][_0xda1c('0x3d')]+'%'};return _0x3aefd2;}})});}_0x51d500=_['merge']({},_0x51d500,_0x3f2595[_0xda1c('0x40')]);var _0x1f89c5={'where':_0x51d500['where']};return db[_0xda1c('0x2d')]['count'](_0x1f89c5)[_0xda1c('0x25')](function(_0x4ffeb0){_0x37b859[_0xda1c('0x1d')]=_0x4ffeb0;if(_0x3f2595[_0xda1c('0x33')]['includeAll']){_0x51d500[_0xda1c('0x41')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0xda1c('0x42')](_0x51d500);})[_0xda1c('0x25')](function(_0xc4a652){_0x37b859[_0xda1c('0x43')]=_0xc4a652;return _0x37b859;})['then'](respondWithFilteredResult(_0x876e60,_0x51d500))['catch'](handleError(_0x876e60,null));};exports[_0xda1c('0x44')]=function(_0x37a799,_0x3a44fa){var _0x3744f2={'raw':![],'where':{'id':_0x37a799[_0xda1c('0x45')]['id']}},_0x52c8f5={};_0x52c8f5[_0xda1c('0x32')]=_[_0xda1c('0x46')](db[_0xda1c('0x2d')][_0xda1c('0x2e')]);_0x52c8f5['query']=_[_0xda1c('0x46')](_0x37a799[_0xda1c('0x33')]);_0x52c8f5['filters']=_[_0xda1c('0x34')](_0x52c8f5[_0xda1c('0x32')],_0x52c8f5[_0xda1c('0x33')]);_0x3744f2['attributes']=_[_0xda1c('0x34')](_0x52c8f5['model'],qs[_0xda1c('0x36')](_0x37a799[_0xda1c('0x33')]['fields']));_0x3744f2[_0xda1c('0x35')]=_0x3744f2[_0xda1c('0x35')]['length']?_0x3744f2[_0xda1c('0x35')]:_0x52c8f5[_0xda1c('0x32')];if(_0x37a799['query'][_0xda1c('0x47')]){_0x3744f2[_0xda1c('0x41')]=[{'all':!![]}];}_0x3744f2=_[_0xda1c('0x3e')]({},_0x3744f2,_0x37a799[_0xda1c('0x40')]);return db['AnalyticCustomReport'][_0xda1c('0x48')](_0x3744f2)['then'](handleEntityNotFound(_0x3a44fa,null))['then'](respondWithResult(_0x3a44fa,null))[_0xda1c('0x49')](handleError(_0x3a44fa,null));};exports[_0xda1c('0x4a')]=function(_0x8bcb00,_0x3ca87b){return db[_0xda1c('0x2d')][_0xda1c('0x4a')](_0x8bcb00[_0xda1c('0x4b')],{})[_0xda1c('0x25')](function(_0x5d3ca7){var _0x17472b=_0x8bcb00['user'][_0xda1c('0x26')]({'plain':!![]});if(!_0x17472b)throw new Error(_0xda1c('0x4c'));if(_0x17472b[_0xda1c('0x4d')]===_0xda1c('0x4e')){var _0x3cbbb6=_0x5d3ca7['get']({'plain':!![]});var _0x2f3a32=_0xda1c('0x4f');return db['UserProfileSection'][_0xda1c('0x48')]({'where':{'name':_0x2f3a32,'userProfileId':_0x17472b[_0xda1c('0x50')]},'raw':!![]})['then'](function(_0x8a8ab){if(_0x8a8ab&&_0x8a8ab[_0xda1c('0x51')]===0x0){return db[_0xda1c('0x52')][_0xda1c('0x4a')]({'name':_0x3cbbb6['name'],'resourceId':_0x3cbbb6['id'],'type':'CustomReports','sectionId':_0x8a8ab['id']},{})['then'](function(){return _0x5d3ca7;});}else{return _0x5d3ca7;}})[_0xda1c('0x49')](function(_0x231055){logger[_0xda1c('0x28')](_0xda1c('0x53'),_0x231055);throw _0x231055;});}return _0x5d3ca7;})[_0xda1c('0x25')](respondWithResult(_0x3ca87b,0xc9))[_0xda1c('0x49')](handleError(_0x3ca87b,null));};exports[_0xda1c('0x24')]=function(_0x565748,_0x24e6cc){if(_0x565748[_0xda1c('0x4b')]['id']){delete _0x565748[_0xda1c('0x4b')]['id'];}return db[_0xda1c('0x2d')][_0xda1c('0x48')]({'where':{'id':_0x565748['params']['id']}})[_0xda1c('0x25')](handleEntityNotFound(_0x24e6cc,null))[_0xda1c('0x25')](saveUpdates(_0x565748[_0xda1c('0x4b')],null))[_0xda1c('0x25')](respondWithResult(_0x24e6cc,null))[_0xda1c('0x49')](handleError(_0x24e6cc,null));};exports[_0xda1c('0x27')]=function(_0x3cb6b1,_0xc12cf2){return db[_0xda1c('0x2d')][_0xda1c('0x48')]({'where':{'id':_0x3cb6b1['params']['id']}})['then'](handleEntityNotFound(_0xc12cf2,null))[_0xda1c('0x25')](removeEntity(_0xc12cf2,null))[_0xda1c('0x49')](handleError(_0xc12cf2,null));};exports[_0xda1c('0x54')]=function(_0xd3da10,_0x48a49e){var _0xd3b7ee=0xa;var _0x10343e=[_0xda1c('0x55'),'left_join',_0xda1c('0x56'),_0xda1c('0x57')];var _0x1f00ff={'SUM':_0xda1c('0x58'),'COUNT':_0xda1c('0x59'),'COUNT DISTINCT':_0xda1c('0x5a'),'MAX':_0xda1c('0x5b'),'MIN':_0xda1c('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xda1c('0x5d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4c6ebb={'SEC_TO_TIME':_0xda1c('0x5e'),'DATE':_0xda1c('0x5f'),'HOUR':_0xda1c('0x60'),'ROUND':_0xda1c('0x61'),'UNIX_TIMESTAMP':_0xda1c('0x62')};var _0x5c3aa7=function(_0x1f741b){return!_[_0xda1c('0x63')]([_0xda1c('0x64'),_0xda1c('0x65'),_0xda1c('0x66'),'IS\x20NOT\x20EMPTY'],_0x1f741b);};var _0x326d43=function(_0x4134d8){if(!_0x4134d8||!_0x4134d8[_0xda1c('0x67')]['length']){return'';}for(var _0x317b32='(',_0x4b0df0=0x0;_0x4b0df0<_0x4134d8[_0xda1c('0x67')][_0xda1c('0x37')];_0x4b0df0+=0x1){_0x4b0df0>0x0&&(_0x317b32+='\x20'+_0x4134d8[_0xda1c('0x68')]+'\x20');_0x317b32+=_0x4134d8[_0xda1c('0x67')][_0x4b0df0][_0xda1c('0x69')]?_0x326d43(_0x4134d8[_0xda1c('0x67')][_0x4b0df0][_0xda1c('0x69')]):_0x4134d8['rules'][_0x4b0df0][_0xda1c('0x6a')]+'\x20'+_0x4134d8[_0xda1c('0x67')][_0x4b0df0][_0xda1c('0x6b')]+(_0x5c3aa7(_0x4134d8[_0xda1c('0x67')][_0x4b0df0][_0xda1c('0x6b')])?'\x20'+_0x4134d8[_0xda1c('0x67')][_0x4b0df0][_0xda1c('0x6c')]:'');}return _0x317b32+')';};var _0x479af4={'where':{'id':_0xd3da10[_0xda1c('0x45')]['id']}},_0x22df6b,_0x1f4439,_0x5b661c,_0x1b69c5,_0x44c7c4;_0x479af4=_['merge']({},_0x479af4,_0xd3da10['options']);return db[_0xda1c('0x2d')]['find'](_0x479af4)[_0xda1c('0x25')](function(_0x54368d){if(_0x54368d){_0x22df6b=_0x54368d;return _0x54368d[_0xda1c('0x6d')]();}return null;})[_0xda1c('0x25')](function(_0x5abd46){if(_0x5abd46){if(!_0x5abd46[_0xda1c('0x37')]){throw new db[(_0xda1c('0x6e'))][(_0xda1c('0x6f'))](_0xda1c('0x70'),0x193);}_0x1f4439=_0x5abd46;return db[_0xda1c('0x71')][_0xda1c('0x42')]({'raw':!![]});}return null;})[_0xda1c('0x25')](function(_0x186206){if(_0x186206){_0x5b661c=_[_0xda1c('0x72')](_0x186206,'id');var _0x1e53a6;var _0x870252=squel[_0xda1c('0x73')]();_0x870252['from'](_0x22df6b['table']);for(var _0x563cff=0x0;_0x563cff<_0x1f4439[_0xda1c('0x37')];_0x563cff+=0x1){_0x1e53a6=_0x1f4439[_0x563cff][_0xda1c('0x74')]?_0x5b661c[_0x1f4439[_0x563cff][_0xda1c('0x74')]][_0xda1c('0x75')]:_0x1f4439[_0x563cff][_0xda1c('0x6a')];_0x1e53a6=_0x1f4439[_0x563cff][_0xda1c('0x76')]?_['replace'](_0x1f00ff[_0x1f4439[_0x563cff]['function']],'%s',_0x1e53a6):_0x1e53a6;_0x1e53a6=_0x1f4439[_0x563cff][_0xda1c('0x77')]?_['replace'](_0x4c6ebb[_0x1f4439[_0x563cff]['format']],'%s',_0x1e53a6):_0x1e53a6;if(_0x1f4439[_0x563cff][_0xda1c('0x78')]){_0x870252[_0xda1c('0x69')](_0x1e53a6);}_0x1f4439[_0x563cff][_0xda1c('0x79')]&&_0x870252[_0xda1c('0x7a')](_0x1e53a6,_0x1f4439[_0x563cff][_0xda1c('0x79')]==='DESC'?![]:!![]);_0x870252[_0xda1c('0x6a')](_0x1e53a6,_0x1f4439[_0x563cff][_0xda1c('0x7b')]||_0x1e53a6);}if(_0x22df6b[_0xda1c('0x7c')]){_0x22df6b[_0xda1c('0x7c')]=JSON[_0xda1c('0x7d')](_0x22df6b[_0xda1c('0x7c')]);for(var _0x1d615b=0x0;_0x1d615b<_0x22df6b[_0xda1c('0x7c')]['length'];_0x1d615b+=0x1){if(_0x22df6b[_0xda1c('0x7c')][_0x1d615b][_0xda1c('0x30')]&&_[_0xda1c('0x63')](_0x10343e,_0x22df6b[_0xda1c('0x7c')][_0x1d615b][_0xda1c('0x30')])&&_0x22df6b[_0xda1c('0x7c')][_0x1d615b]['parentKey']&&_0x22df6b['joins'][_0x1d615b][_0xda1c('0x7e')]&&_0x22df6b[_0xda1c('0x7c')][_0x1d615b][_0xda1c('0x7f')]){_0x870252[_0x22df6b[_0xda1c('0x7c')][_0x1d615b][_0xda1c('0x30')]](_0x22df6b['joins'][_0x1d615b]['foreignTable'],null,util[_0xda1c('0x77')](_0xda1c('0x80'),_0x22df6b[_0xda1c('0x81')],_0x22df6b['joins'][_0x1d615b][_0xda1c('0x82')],_0x22df6b[_0xda1c('0x7c')][_0x1d615b]['foreignTable'],_0x22df6b[_0xda1c('0x7c')][_0x1d615b][_0xda1c('0x7f')]));}}}if(_0x22df6b[_0xda1c('0x83')]){_0x22df6b[_0xda1c('0x83')]=JSON[_0xda1c('0x7d')](_0x22df6b['conditions']);_0x870252['where'](_0x326d43(_0x22df6b['conditions']['group']));}_0x44c7c4=_0x870252[_0xda1c('0x84')]();_0x870252[_0xda1c('0x1c')](_0xd3b7ee);_0x870252[_0xda1c('0x1a')](0x0);logger[_0xda1c('0x85')]('Limited\x20Query:',_0x870252[_0xda1c('0x86')]());return dbH[_0xda1c('0x87')][_0xda1c('0x33')](_0x870252[_0xda1c('0x86')](),{'type':dbH[_0xda1c('0x87')][_0xda1c('0x88')][_0xda1c('0x89')]});}})[_0xda1c('0x25')](respondWithResult(_0x48a49e,null))['catch'](handleError(_0x48a49e,null));};function runReport(_0x16e856,_0x252774,_0x5c62fc){var _0x3d7f89=_0x252774[_0xda1c('0x2a')];var _0x415230=0xa;var _0x1addb3=[_0xda1c('0x55'),_0xda1c('0x8a'),_0xda1c('0x56'),_0xda1c('0x57')];var _0x42ba03={'SUM':_0xda1c('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xda1c('0x5a'),'MAX':_0xda1c('0x5b'),'MIN':_0xda1c('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xda1c('0x8b'),'GROUP_CONCAT ASC':_0xda1c('0x5d'),'GROUP_CONCAT DESC':_0xda1c('0x8c')};var _0x542eda={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xda1c('0x60'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x19950c=function(_0x2d4367){return!_[_0xda1c('0x63')](['IS\x20NULL','IS\x20NOT\x20NULL',_0xda1c('0x66'),'IS\x20NOT\x20EMPTY'],_0x2d4367);};var _0x15afa6=function(_0x561048){if(!_0x561048||!_0x561048[_0xda1c('0x67')][_0xda1c('0x37')]){return'';}for(var _0x485e7c='(',_0x5d8a5d=0x0;_0x5d8a5d<_0x561048[_0xda1c('0x67')]['length'];_0x5d8a5d+=0x1){_0x5d8a5d>0x0&&(_0x485e7c+='\x20'+_0x561048['operator']+'\x20');_0x485e7c+=_0x561048['rules'][_0x5d8a5d][_0xda1c('0x69')]?_0x15afa6(_0x561048[_0xda1c('0x67')][_0x5d8a5d][_0xda1c('0x69')]):_0x561048[_0xda1c('0x67')][_0x5d8a5d]['field']+'\x20'+_0x561048[_0xda1c('0x67')][_0x5d8a5d]['condition']+(_0x19950c(_0x561048['rules'][_0x5d8a5d][_0xda1c('0x6b')])?'\x20'+_0x561048[_0xda1c('0x67')][_0x5d8a5d][_0xda1c('0x6c')]:'');}return _0x485e7c+')';};var _0x19dfc8={'where':{'id':_0x16e856['id']}},_0x3fee40,_0x10aea3,_0x5c79f9,_0x31af6f,_0x14b683;_0x19dfc8=_[_0xda1c('0x3e')]({},_0x19dfc8,_0x5c62fc);return db[_0xda1c('0x2d')][_0xda1c('0x48')](_0x19dfc8)['then'](function(_0x25dccf){if(_0x25dccf){_0x3fee40=_0x25dccf;return _0x25dccf['getFields']();}return null;})['then'](function(_0x1c0236){if(_0x1c0236){if(!_0x1c0236[_0xda1c('0x37')]){throw new db[(_0xda1c('0x6e'))][(_0xda1c('0x6f'))](_0xda1c('0x70'),0x193);}_0x10aea3=_0x1c0236;return db[_0xda1c('0x71')][_0xda1c('0x42')]({'raw':!![]});}return null;})[_0xda1c('0x25')](function(_0xd454ff){if(_0xd454ff){_0x5c79f9=_[_0xda1c('0x72')](_0xd454ff,'id');var _0x248fee;var _0x39bceb=squel[_0xda1c('0x73')]();_0x39bceb['from'](_0x3fee40[_0xda1c('0x81')]);for(var _0x55a7a2=0x0;_0x55a7a2<_0x10aea3[_0xda1c('0x37')];_0x55a7a2+=0x1){_0x248fee=_0x10aea3[_0x55a7a2][_0xda1c('0x74')]?_0x5c79f9[_0x10aea3[_0x55a7a2][_0xda1c('0x74')]]['metric']:_0x10aea3[_0x55a7a2][_0xda1c('0x6a')];_0x248fee=_0x10aea3[_0x55a7a2][_0xda1c('0x76')]?_['replace'](_0x42ba03[_0x10aea3[_0x55a7a2][_0xda1c('0x76')]],'%s',_0x248fee):_0x248fee;_0x248fee=_0x10aea3[_0x55a7a2]['format']?_['replace'](_0x542eda[_0x10aea3[_0x55a7a2][_0xda1c('0x77')]],'%s',_0x248fee):_0x248fee;if(_0x10aea3[_0x55a7a2][_0xda1c('0x78')]){_0x39bceb[_0xda1c('0x69')](_0x248fee);}_0x10aea3[_0x55a7a2][_0xda1c('0x79')]&&_0x39bceb[_0xda1c('0x7a')](_0x248fee,_0x10aea3[_0x55a7a2][_0xda1c('0x79')]===_0xda1c('0x8d')?![]:!![]);_0x39bceb[_0xda1c('0x6a')](_0x248fee,_0x10aea3[_0x55a7a2][_0xda1c('0x7b')]||_0x248fee);}if(_0x3fee40[_0xda1c('0x7c')]){_0x3fee40['joins']=JSON[_0xda1c('0x7d')](_0x3fee40[_0xda1c('0x7c')]);for(var _0x2349ba=0x0;_0x2349ba<_0x3fee40[_0xda1c('0x7c')][_0xda1c('0x37')];_0x2349ba+=0x1){if(_0x3fee40[_0xda1c('0x7c')][_0x2349ba][_0xda1c('0x30')]&&_[_0xda1c('0x63')](_0x1addb3,_0x3fee40[_0xda1c('0x7c')][_0x2349ba][_0xda1c('0x30')])&&_0x3fee40[_0xda1c('0x7c')][_0x2349ba][_0xda1c('0x82')]&&_0x3fee40[_0xda1c('0x7c')][_0x2349ba]['foreignTable']&&_0x3fee40[_0xda1c('0x7c')][_0x2349ba][_0xda1c('0x7f')]){_0x39bceb[_0x3fee40['joins'][_0x2349ba][_0xda1c('0x30')]](_0x3fee40[_0xda1c('0x7c')][_0x2349ba][_0xda1c('0x7e')],null,util[_0xda1c('0x77')]('%s.%s\x20=\x20%s.%s',_0x3fee40[_0xda1c('0x81')],_0x3fee40[_0xda1c('0x7c')][_0x2349ba][_0xda1c('0x82')],_0x3fee40[_0xda1c('0x7c')][_0x2349ba][_0xda1c('0x7e')],_0x3fee40[_0xda1c('0x7c')][_0x2349ba][_0xda1c('0x7f')]));}}}if(_0x3fee40[_0xda1c('0x83')]){_0x3fee40['conditions']=JSON[_0xda1c('0x7d')](_0x3fee40['conditions']);_0x39bceb[_0xda1c('0x3b')](_0x15afa6(_0x3fee40['conditions'][_0xda1c('0x69')]));}_0x14b683=_0x39bceb[_0xda1c('0x84')]();_0x39bceb[_0xda1c('0x1c')](_0x415230);_0x39bceb['offset'](0x0);return;}})[_0xda1c('0x25')](function(){if(_0x252774[_0xda1c('0x8e')]==='web'){return null;}var _0x236f2e=_[_0xda1c('0x3e')](_0x252774,{'name':_0x252774[_0xda1c('0x8f')]||_0x252774[_0xda1c('0x2a')]||_0x3fee40[_0xda1c('0x2a')],'basename':_0x3d7f89,'savename':util[_0xda1c('0x77')](_0xda1c('0x90'),_0x252774['name']||_0x3fee40[_0xda1c('0x2a')],require('randomstring')[_0xda1c('0x91')](0x4),_0x252774[_0xda1c('0x8e')]||_0xda1c('0x92')),'reportId':_0x3fee40['id'],'reportType':_0xda1c('0x93')});return db[_0xda1c('0x94')][_0xda1c('0x4a')](_0x236f2e,{'raw':!![]});})[_0xda1c('0x25')](function(_0x68f9ed){if(_0x3fee40['table']===_0xda1c('0x95')){_0x14b683['where'](_0x3fee40[_0xda1c('0x81')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x252774[_0xda1c('0x96')],_0x252774[_0xda1c('0x97')]);}else{_0x14b683[_0xda1c('0x3b')](_0x3fee40['table']+_0xda1c('0x98'),_0x252774[_0xda1c('0x96')],_0x252774[_0xda1c('0x97')]);}if(_0x68f9ed){logger['info'](_0xda1c('0x99'),_0x14b683['toString']());require(_0xda1c('0x9a'))[_0xda1c('0x9b')](path[_0xda1c('0x55')](__dirname,_0xda1c('0x9c'),_0x68f9ed[_0xda1c('0x8e')]),[_0x68f9ed['id'],_0x14b683[_0xda1c('0x86')](),path[_0xda1c('0x55')](__dirname,_0xda1c('0x9d'),_0x68f9ed[_0xda1c('0x9e')]),_0x3d7f89]);return _0x68f9ed;}else{var _0x43d6e5=squel['select']();_0x43d6e5[_0xda1c('0x9f')]('('+_0x14b683[_0xda1c('0x86')]()+')',_0xda1c('0xa0'));_0x43d6e5[_0xda1c('0x6a')](_0xda1c('0xa1'),_0xda1c('0x1d'));_0x14b683['limit'](_0x252774['limit']||_0x415230);_0x14b683[_0xda1c('0x1a')](_0x252774[_0xda1c('0x1a')]||0x0);return dbH[_0xda1c('0x87')][_0xda1c('0x33')](_0x43d6e5[_0xda1c('0x86')](),{'type':dbH['sequelize'][_0xda1c('0x88')][_0xda1c('0x89')]})[_0xda1c('0x25')](function(_0x261d02){if(!_0x261d02[_0xda1c('0x37')]){_0x31af6f=0x0;}else{_0x31af6f=_0x261d02[0x0][_0xda1c('0x1d')]||0x0;}return dbH['sequelize']['query'](_0x14b683[_0xda1c('0x86')](),{'type':dbH[_0xda1c('0x87')][_0xda1c('0x88')][_0xda1c('0x89')]});})[_0xda1c('0x25')](function(_0x5672c8){return{'rows':_0x5672c8||[],'count':_0x31af6f};});}});}exports[_0xda1c('0xa2')]=function(_0x106cb3,_0x5a144a){return runReport(_0x106cb3['params'],_0x106cb3[_0xda1c('0x33')],_0x106cb3[_0xda1c('0x40')])[_0xda1c('0x25')](respondWithResult(_0x5a144a,null))[_0xda1c('0x49')](handleError(_0x5a144a,null));};exports[_0xda1c('0xa3')]=runReport;exports[_0xda1c('0x33')]=function(_0x348ba4,_0x4bba1f){var _0x5b31a7=0xa;var _0x2b6150=['join',_0xda1c('0x8a'),_0xda1c('0x56'),_0xda1c('0x57')];var _0x21995e={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xda1c('0x5a'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xda1c('0x8b'),'GROUP_CONCAT ASC':_0xda1c('0x5d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0xde5483={'SEC_TO_TIME':_0xda1c('0x5e'),'DATE':'DATE(%s)','HOUR':_0xda1c('0x60'),'ROUND':_0xda1c('0x61'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1c9388=function(_0x2c9b3a){return!_[_0xda1c('0x63')](['IS\x20NULL',_0xda1c('0x65'),_0xda1c('0x66'),'IS\x20NOT\x20EMPTY'],_0x2c9b3a);};var _0x4acb9c=function(_0x5dd842){if(!_0x5dd842||!_0x5dd842[_0xda1c('0x67')][_0xda1c('0x37')]){return'';}for(var _0x4567af='(',_0x262d4f=0x0;_0x262d4f<_0x5dd842['rules'][_0xda1c('0x37')];_0x262d4f+=0x1){_0x262d4f>0x0&&(_0x4567af+='\x20'+_0x5dd842[_0xda1c('0x68')]+'\x20');_0x4567af+=_0x5dd842[_0xda1c('0x67')][_0x262d4f][_0xda1c('0x69')]?_0x4acb9c(_0x5dd842[_0xda1c('0x67')][_0x262d4f]['group']):_0x5dd842[_0xda1c('0x67')][_0x262d4f]['field']+'\x20'+_0x5dd842['rules'][_0x262d4f][_0xda1c('0x6b')]+(_0x1c9388(_0x5dd842[_0xda1c('0x67')][_0x262d4f]['condition'])?'\x20'+_0x5dd842[_0xda1c('0x67')][_0x262d4f][_0xda1c('0x6c')]:'');}return _0x4567af+')';};var _0x488eec={'where':{'id':_0x348ba4['params']['id']}},_0x2d2e75,_0x33d94,_0x479cb2,_0x598c28,_0x562aab;_0x488eec=_[_0xda1c('0x3e')]({},_0x488eec,_0x348ba4['options']);return db[_0xda1c('0x2d')][_0xda1c('0x48')](_0x488eec)[_0xda1c('0x25')](function(_0x2f2cd7){if(_0x2f2cd7){_0x2d2e75=_0x2f2cd7;return _0x2f2cd7[_0xda1c('0x6d')]();}return null;})['then'](function(_0x433849){if(_0x433849){if(!_0x433849[_0xda1c('0x37')]){throw new db[(_0xda1c('0x6e'))][(_0xda1c('0x6f'))](_0xda1c('0x70'),0x193);}_0x33d94=_0x433849;return db['AnalyticMetric'][_0xda1c('0x42')]({'raw':!![]});}return null;})[_0xda1c('0x25')](function(_0x15395d){if(_0x15395d){_0x479cb2=_['keyBy'](_0x15395d,'id');var _0x1a5d6b;var _0xa2e22d=squel[_0xda1c('0x73')]();_0xa2e22d[_0xda1c('0x9f')](_0x2d2e75[_0xda1c('0x81')]);for(var _0x396af4=0x0;_0x396af4<_0x33d94[_0xda1c('0x37')];_0x396af4+=0x1){_0x1a5d6b=_0x33d94[_0x396af4][_0xda1c('0x74')]?_0x479cb2[_0x33d94[_0x396af4][_0xda1c('0x74')]][_0xda1c('0x75')]:_0x33d94[_0x396af4][_0xda1c('0x6a')];_0x1a5d6b=_0x33d94[_0x396af4]['function']?_[_0xda1c('0xa4')](_0x21995e[_0x33d94[_0x396af4][_0xda1c('0x76')]],'%s',_0x1a5d6b):_0x1a5d6b;_0x1a5d6b=_0x33d94[_0x396af4]['format']?_['replace'](_0xde5483[_0x33d94[_0x396af4][_0xda1c('0x77')]],'%s',_0x1a5d6b):_0x1a5d6b;if(_0x33d94[_0x396af4][_0xda1c('0x78')]){_0xa2e22d[_0xda1c('0x69')](_0x1a5d6b);}_0x33d94[_0x396af4][_0xda1c('0x79')]&&_0xa2e22d[_0xda1c('0x7a')](_0x1a5d6b,_0x33d94[_0x396af4][_0xda1c('0x79')]==='DESC'?![]:!![]);_0xa2e22d['field'](_0x1a5d6b,_0x33d94[_0x396af4][_0xda1c('0x7b')]||_0x1a5d6b);}if(_0x2d2e75[_0xda1c('0x7c')]){_0x2d2e75['joins']=JSON[_0xda1c('0x7d')](_0x2d2e75['joins']);for(var _0xe143e7=0x0;_0xe143e7<_0x2d2e75[_0xda1c('0x7c')][_0xda1c('0x37')];_0xe143e7+=0x1){if(_0x2d2e75[_0xda1c('0x7c')][_0xe143e7]['type']&&_[_0xda1c('0x63')](_0x2b6150,_0x2d2e75[_0xda1c('0x7c')][_0xe143e7][_0xda1c('0x30')])&&_0x2d2e75[_0xda1c('0x7c')][_0xe143e7][_0xda1c('0x82')]&&_0x2d2e75['joins'][_0xe143e7][_0xda1c('0x7e')]&&_0x2d2e75[_0xda1c('0x7c')][_0xe143e7][_0xda1c('0x7f')]){_0xa2e22d[_0x2d2e75[_0xda1c('0x7c')][_0xe143e7][_0xda1c('0x30')]](_0x2d2e75[_0xda1c('0x7c')][_0xe143e7][_0xda1c('0x7e')],null,util['format'](_0xda1c('0x80'),_0x2d2e75[_0xda1c('0x81')],_0x2d2e75['joins'][_0xe143e7]['parentKey'],_0x2d2e75[_0xda1c('0x7c')][_0xe143e7]['foreignTable'],_0x2d2e75[_0xda1c('0x7c')][_0xe143e7][_0xda1c('0x7f')]));}}}if(_0x2d2e75['conditions']){_0x2d2e75[_0xda1c('0x83')]=JSON[_0xda1c('0x7d')](_0x2d2e75[_0xda1c('0x83')]);_0xa2e22d['where'](_0x4acb9c(_0x2d2e75[_0xda1c('0x83')][_0xda1c('0x69')]));}_0x562aab=_0xa2e22d['clone']();_0xa2e22d[_0xda1c('0x1c')](_0x5b31a7);_0xa2e22d['offset'](0x0);logger['debug']('Limited\x20Query:',_0xa2e22d[_0xda1c('0x86')]());return dbH[_0xda1c('0x87')]['query'](_0xa2e22d[_0xda1c('0x86')](),{'type':dbH[_0xda1c('0x87')]['QueryTypes'][_0xda1c('0x89')]});}})['then'](function(){return{'sql':_0x562aab[_0xda1c('0x86')]()};})['then'](respondWithResult(_0x4bba1f,null))['catch'](handleError(_0x4bba1f,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index a3c6c32..a6ff356 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 _0xb098=['define','lodash','util','api','moment','request-promise','path','../../config/environment','./analyticCustomReport.attributes','exports'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xb098,0x173));var _0x8b09=function(_0x2d040e,_0x32b09b){_0x2d040e=_0x2d040e-0x0;var _0x4b5a90=_0xb098[_0x2d040e];return _0x4b5a90;};'use strict';var _=require(_0x8b09('0x0'));var util=require(_0x8b09('0x1'));var logger=require('../../config/logger')(_0x8b09('0x2'));var moment=require(_0x8b09('0x3'));var BPromise=require('bluebird');var rp=require(_0x8b09('0x4'));var fs=require('fs');var path=require(_0x8b09('0x5'));var rimraf=require('rimraf');var config=require(_0x8b09('0x6'));var attributes=require(_0x8b09('0x7'));module[_0x8b09('0x8')]=function(_0x16f78a,_0x1dd508){return _0x16f78a[_0x8b09('0x9')]('AnalyticCustomReport',attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x48dc=['bluebird','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','lodash','util','api','moment'];(function(_0x59edd0,_0x13ad1b){var _0x30ff26=function(_0x1423b4){while(--_0x1423b4){_0x59edd0['push'](_0x59edd0['shift']());}};_0x30ff26(++_0x13ad1b);}(_0x48dc,0x8b));var _0xc48d=function(_0x2d6197,_0x82ebfb){_0x2d6197=_0x2d6197-0x0;var _0x4d0e75=_0x48dc[_0x2d6197];return _0x4d0e75;};'use strict';var _=require(_0xc48d('0x0'));var util=require(_0xc48d('0x1'));var logger=require('../../config/logger')(_0xc48d('0x2'));var moment=require(_0xc48d('0x3'));var BPromise=require(_0xc48d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc48d('0x5'));var config=require(_0xc48d('0x6'));var attributes=require(_0xc48d('0x7'));module[_0xc48d('0x8')]=function(_0x24d8d3,_0x178ee5){return _0x24d8d3[_0xc48d('0x9')](_0xc48d('0xa'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index caed895..06768f6 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 _0x0382=['info','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','error','AnalyticCustomReport,\x20%s,\x20%s','message'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x0382,0x133));var _0x2038=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x0382[_0x53ccf2];return _0x5a2964;};'use strict';var _=require('lodash');var util=require(_0x2038('0x0'));var moment=require(_0x2038('0x1'));var BPromise=require(_0x2038('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2038('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2038('0x4'));var logger=require(_0x2038('0x5'))(_0x2038('0x6'));var config=require(_0x2038('0x7'));var jayson=require(_0x2038('0x8'));var client=jayson[_0x2038('0x9')][_0x2038('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x56ef38,_0x426a33,_0x46d984){return new BPromise(function(_0x282a75,_0x18bb09){return client[_0x2038('0xb')](_0x56ef38,_0x46d984)['then'](function(_0x3ad107){logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x426a33,'request\x20sent');logger['debug']('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x426a33,_0x2038('0xc'),JSON['stringify'](_0x3ad107));if(_0x3ad107[_0x2038('0xd')]){if(_0x3ad107[_0x2038('0xd')]['code']===0x1f4){logger['error'](_0x2038('0xe'),_0x426a33,_0x3ad107[_0x2038('0xd')][_0x2038('0xf')]);return _0x18bb09(_0x3ad107['error']['message']);}logger['error'](_0x2038('0xe'),_0x426a33,_0x3ad107[_0x2038('0xd')]['message']);return _0x282a75(_0x3ad107['error']['message']);}else{logger[_0x2038('0x10')](_0x2038('0xe'),_0x426a33,'request\x20sent');_0x282a75(_0x3ad107['result'][_0x2038('0xf')]);}})['catch'](function(_0x5563dd){logger[_0x2038('0xd')](_0x2038('0xe'),_0x426a33,_0x5563dd);_0x18bb09(_0x5563dd);});});} \ No newline at end of file +var _0x29fb=['info','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','request\x20sent','stringify','error','code','AnalyticCustomReport,\x20%s,\x20%s','message'];(function(_0x36aaad,_0x4123c5){var _0x383ce2=function(_0x49f08b){while(--_0x49f08b){_0x36aaad['push'](_0x36aaad['shift']());}};_0x383ce2(++_0x4123c5);}(_0x29fb,0x16b));var _0xb29f=function(_0x46d1b5,_0x167007){_0x46d1b5=_0x46d1b5-0x0;var _0x5002cc=_0x29fb[_0x46d1b5];return _0x5002cc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb29f('0x0'));var BPromise=require(_0xb29f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb29f('0x2'));var db=require(_0xb29f('0x3'))['db'];var utils=require(_0xb29f('0x4'));var logger=require(_0xb29f('0x5'))(_0xb29f('0x6'));var config=require(_0xb29f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb29f('0x8')][_0xb29f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b385d,_0x5cb8dc,_0x4e4bab){return new BPromise(function(_0x4008d7,_0x5a05d6){return client['request'](_0x3b385d,_0x4e4bab)[_0xb29f('0xa')](function(_0x16ccb0){logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x5cb8dc,_0xb29f('0xb'));logger['debug']('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x5cb8dc,_0xb29f('0xb'),JSON[_0xb29f('0xc')](_0x16ccb0));if(_0x16ccb0[_0xb29f('0xd')]){if(_0x16ccb0[_0xb29f('0xd')][_0xb29f('0xe')]===0x1f4){logger[_0xb29f('0xd')](_0xb29f('0xf'),_0x5cb8dc,_0x16ccb0[_0xb29f('0xd')][_0xb29f('0x10')]);return _0x5a05d6(_0x16ccb0[_0xb29f('0xd')][_0xb29f('0x10')]);}logger[_0xb29f('0xd')](_0xb29f('0xf'),_0x5cb8dc,_0x16ccb0[_0xb29f('0xd')]['message']);return _0x4008d7(_0x16ccb0[_0xb29f('0xd')][_0xb29f('0x10')]);}else{logger[_0xb29f('0x11')](_0xb29f('0xf'),_0x5cb8dc,_0xb29f('0xb'));_0x4008d7(_0x16ccb0[_0xb29f('0x12')][_0xb29f('0x10')]);}})[_0xb29f('0x13')](function(_0x1c6559){logger[_0xb29f('0xd')](_0xb29f('0xf'),_0x5cb8dc,_0x1c6559);_0x5a05d6(_0x1c6559);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 5bf5df5..ad5248d 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 _0xaa75=['util','connect-timeout','express','Router','fs-extra','./analyticCustomReport.controller','isAuthenticated','index','get','/:id','show','/:id/preview','run','/:id/query','query','post','delete','destroy','exports','multer'];(function(_0x53af5c,_0x4d4879){var _0x12c96f=function(_0x16ece5){while(--_0x16ece5){_0x53af5c['push'](_0x53af5c['shift']());}};_0x12c96f(++_0x4d4879);}(_0xaa75,0xb3));var _0x5aa7=function(_0x326ce2,_0x57b888){_0x326ce2=_0x326ce2-0x0;var _0x53c217=_0xaa75[_0x326ce2];return _0x53c217;};'use strict';var multer=require(_0x5aa7('0x0'));var util=require(_0x5aa7('0x1'));var path=require('path');var timeout=require(_0x5aa7('0x2'));var express=require(_0x5aa7('0x3'));var router=express[_0x5aa7('0x4')]();var fs_extra=require(_0x5aa7('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5aa7('0x6'));router['get']('/',auth[_0x5aa7('0x7')](),controller[_0x5aa7('0x8')]);router[_0x5aa7('0x9')](_0x5aa7('0xa'),auth[_0x5aa7('0x7')](),controller[_0x5aa7('0xb')]);router[_0x5aa7('0x9')](_0x5aa7('0xc'),auth[_0x5aa7('0x7')](),controller['preview']);router['get']('/:id/run',auth[_0x5aa7('0x7')](),controller[_0x5aa7('0xd')]);router['get'](_0x5aa7('0xe'),auth[_0x5aa7('0x7')](),controller[_0x5aa7('0xf')]);router[_0x5aa7('0x10')]('/',auth[_0x5aa7('0x7')](),controller['create']);router['put']('/:id',auth[_0x5aa7('0x7')](),controller['update']);router[_0x5aa7('0x11')](_0x5aa7('0xa'),auth['isAuthenticated'](),controller[_0x5aa7('0x12')]);module[_0x5aa7('0x13')]=router; \ No newline at end of file +var _0xf421=['../../config/environment','isAuthenticated','index','get','show','/:id/preview','/:id/run','run','/:id/query','query','put','/:id','update','delete','multer','path','connect-timeout','express','Router'];(function(_0x3c9fbc,_0x47cae5){var _0x355ce9=function(_0x2af3f9){while(--_0x2af3f9){_0x3c9fbc['push'](_0x3c9fbc['shift']());}};_0x355ce9(++_0x47cae5);}(_0xf421,0x1b0));var _0x1f42=function(_0x50499c,_0x188984){_0x50499c=_0x50499c-0x0;var _0xd422b3=_0xf421[_0x50499c];return _0xd422b3;};'use strict';var multer=require(_0x1f42('0x0'));var util=require('util');var path=require(_0x1f42('0x1'));var timeout=require(_0x1f42('0x2'));var express=require(_0x1f42('0x3'));var router=express[_0x1f42('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1f42('0x5'));var controller=require('./analyticCustomReport.controller');router['get']('/',auth[_0x1f42('0x6')](),controller[_0x1f42('0x7')]);router[_0x1f42('0x8')]('/:id',auth[_0x1f42('0x6')](),controller[_0x1f42('0x9')]);router['get'](_0x1f42('0xa'),auth[_0x1f42('0x6')](),controller['preview']);router['get'](_0x1f42('0xb'),auth[_0x1f42('0x6')](),controller[_0x1f42('0xc')]);router[_0x1f42('0x8')](_0x1f42('0xd'),auth[_0x1f42('0x6')](),controller[_0x1f42('0xe')]);router['post']('/',auth[_0x1f42('0x6')](),controller['create']);router[_0x1f42('0xf')](_0x1f42('0x10'),auth[_0x1f42('0x6')](),controller[_0x1f42('0x11')]);router[_0x1f42('0x12')](_0x1f42('0x10'),auth[_0x1f42('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 1782c5d..9b9588b 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 _0x326f=['STRING','TEXT','sequelize'];(function(_0x43b07c,_0x52f771){var _0x53b142=function(_0x5d3e5e){while(--_0x5d3e5e){_0x43b07c['push'](_0x43b07c['shift']());}};_0x53b142(++_0x52f771);}(_0x326f,0xd1));var _0xf326=function(_0x1aab34,_0x324732){_0x1aab34=_0x1aab34-0x0;var _0x12b2d8=_0x326f[_0x1aab34];return _0x12b2d8;};'use strict';var Sequelize=require(_0xf326('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xf326('0x1')]},'parent':{'type':Sequelize[_0xf326('0x1')]},'table':{'type':Sequelize[_0xf326('0x1')]},'conditions':{'type':Sequelize[_0xf326('0x2')]},'joins':{'type':Sequelize[_0xf326('0x2')]}}; \ No newline at end of file +var _0x7dfd=['STRING','TEXT','sequelize','exports'];(function(_0x358610,_0x36bc12){var _0x45594d=function(_0x19b149){while(--_0x19b149){_0x358610['push'](_0x358610['shift']());}};_0x45594d(++_0x36bc12);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd7df('0x0'));module[_0xd7df('0x1')]={'name':{'type':Sequelize[_0xd7df('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xd7df('0x2')]},'parent':{'type':Sequelize[_0xd7df('0x2')]},'table':{'type':Sequelize[_0xd7df('0x2')]},'conditions':{'type':Sequelize[_0xd7df('0x3')]},'joins':{'type':Sequelize[_0xd7df('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 5256474..1d67985 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 _0x4819=['keyBy','table','metric','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','select','from','countTable','COUNT(*)','SELECT','run','cross_join','COUNT(DISTINCT\x20%s)','debug','Limited\x20Query:','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','get','DefaultReports','UserProfileResource','destroy','error','stack','name','send','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','AnalyticDefaultReport','includeAll','include','findAll','rows','show','params','keys','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','body','preview','join','left_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','field','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','MetricId','function','replace','format','groupBy','group','orderBy','DESC','alias','joins','parse','includes','parentKey','foreignTable','foreignKey','conditions','clone','toString','sequelize','QueryTypes','right_join','SEC_TO_TIME(%s)','IS\x20NULL','IS\x20EMPTY','operator','condition'];(function(_0x41f5ba,_0xd0ffa8){var _0x535e03=function(_0x7b8c37){while(--_0x7b8c37){_0x41f5ba['push'](_0x41f5ba['shift']());}};_0x535e03(++_0xd0ffa8);}(_0x4819,0xcd));var _0x9481=function(_0x117ab9,_0x45c7b6){_0x117ab9=_0x117ab9-0x0;var _0x258a48=_0x4819[_0x117ab9];return _0x258a48;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9481('0x0'));var zipdir=require(_0x9481('0x1'));var jsonpatch=require(_0x9481('0x2'));var rp=require(_0x9481('0x3'));var moment=require(_0x9481('0x4'));var BPromise=require(_0x9481('0x5'));var Mustache=require(_0x9481('0x6'));var util=require(_0x9481('0x7'));var path=require(_0x9481('0x8'));var sox=require(_0x9481('0x9'));var csv=require('to-csv');var ejs=require(_0x9481('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9481('0xb'));var crypto=require(_0x9481('0xc'));var jsforce=require(_0x9481('0xd'));var deskjs=require(_0x9481('0xe'));var toCsv=require(_0x9481('0xf'));var querystring=require('querystring');var Papa=require(_0x9481('0x10'));var Redis=require('ioredis');var authService=require(_0x9481('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9481('0x12'));var hardwareService=require(_0x9481('0x13'));var logger=require(_0x9481('0x14'))(_0x9481('0x15'));var utils=require(_0x9481('0x16'));var config=require(_0x9481('0x17'));var licenseUtil=require(_0x9481('0x18'));var db=require(_0x9481('0x19'))['db'];var dbH=require(_0x9481('0x19'))['dbH'];function respondWithStatusCode(_0x5aac02,_0xce6fa2){_0xce6fa2=_0xce6fa2||0xcc;return function(_0x150276){if(_0x150276){return _0x5aac02[_0x9481('0x1a')](_0xce6fa2);}return _0x5aac02[_0x9481('0x1b')](_0xce6fa2)[_0x9481('0x1c')]();};}function respondWithResult(_0xc7a0b5,_0x3fb97f){_0x3fb97f=_0x3fb97f||0xc8;return function(_0x495b30){if(_0x495b30){return _0xc7a0b5[_0x9481('0x1b')](_0x3fb97f)[_0x9481('0x1d')](_0x495b30);}};}function respondWithFilteredResult(_0x5b1fe6,_0x2266d5){return function(_0x518150){if(_0x518150){var _0x34108d=typeof _0x2266d5[_0x9481('0x1e')]===_0x9481('0x1f')&&typeof _0x2266d5[_0x9481('0x20')]==='undefined';var _0x5eda66=_0x518150[_0x9481('0x21')];var _0x50a559=_0x34108d?0x0:_0x2266d5['offset'];var _0x26671c=_0x34108d?_0x518150[_0x9481('0x21')]:_0x2266d5[_0x9481('0x1e')]+_0x2266d5[_0x9481('0x20')];var _0x7000e7;if(_0x26671c>=_0x5eda66){_0x26671c=_0x5eda66;_0x7000e7=0xc8;}else{_0x7000e7=0xce;}_0x5b1fe6[_0x9481('0x1b')](_0x7000e7);return _0x5b1fe6['set'](_0x9481('0x22'),_0x50a559+'-'+_0x26671c+'/'+_0x5eda66)[_0x9481('0x1d')](_0x518150);}return null;};}function patchUpdates(_0x45f9df){return function(_0x615e02){try{jsonpatch[_0x9481('0x23')](_0x615e02,_0x45f9df,!![]);}catch(_0x56da97){return BPromise[_0x9481('0x24')](_0x56da97);}return _0x615e02[_0x9481('0x25')]();};}function saveUpdates(_0x572599,_0x2bcf37){return function(_0xd1cd1a){if(_0xd1cd1a){return _0xd1cd1a[_0x9481('0x26')](_0x572599)[_0x9481('0x27')](function(_0x2dc02e){return _0x2dc02e;});}return null;};}function removeEntity(_0x49ecfa,_0x91e3d9){return function(_0x22f0b5){if(_0x22f0b5){return _0x22f0b5['destroy']()['then'](function(){var _0x12b0c3=_0x22f0b5[_0x9481('0x28')]({'plain':!![]});var _0x550fce=_0x9481('0x29');return db[_0x9481('0x2a')][_0x9481('0x2b')]({'where':{'type':_0x550fce,'resourceId':_0x12b0c3['id']}})[_0x9481('0x27')](function(){return _0x22f0b5;});})['then'](function(){_0x49ecfa[_0x9481('0x1b')](0xcc)[_0x9481('0x1c')]();});}};}function handleEntityNotFound(_0x3c2585,_0x587706){return function(_0x1791b2){if(!_0x1791b2){_0x3c2585['sendStatus'](0x194);}return _0x1791b2;};}function handleError(_0x2e1eff,_0xe153ab){_0xe153ab=_0xe153ab||0x1f4;return function(_0x22ab26){logger[_0x9481('0x2c')](_0x22ab26[_0x9481('0x2d')]);if(_0x22ab26['name']){delete _0x22ab26[_0x9481('0x2e')];}_0x2e1eff[_0x9481('0x1b')](_0xe153ab)[_0x9481('0x2f')](_0x22ab26);};}exports['index']=function(_0x56752e,_0x1addc8){var _0x427c25={},_0x42df68={},_0x2b33f8={'count':0x0,'rows':[]};var _0x5d9926=_['map'](db['AnalyticDefaultReport'][_0x9481('0x30')],function(_0x5d6c65){return{'name':_0x5d6c65[_0x9481('0x31')],'type':_0x5d6c65['type'][_0x9481('0x32')]};});_0x42df68[_0x9481('0x33')]=_[_0x9481('0x34')](_0x5d9926,_0x9481('0x2e'));_0x42df68[_0x9481('0x35')]=_['keys'](_0x56752e[_0x9481('0x35')]);_0x42df68[_0x9481('0x36')]=_[_0x9481('0x37')](_0x42df68['model'],_0x42df68[_0x9481('0x35')]);_0x427c25[_0x9481('0x38')]=_[_0x9481('0x37')](_0x42df68[_0x9481('0x33')],qs[_0x9481('0x39')](_0x56752e[_0x9481('0x35')]['fields']));_0x427c25[_0x9481('0x38')]=_0x427c25['attributes'][_0x9481('0x3a')]?_0x427c25[_0x9481('0x38')]:_0x42df68[_0x9481('0x33')];if(!_0x56752e[_0x9481('0x35')][_0x9481('0x3b')](_0x9481('0x3c'))){_0x427c25['limit']=qs[_0x9481('0x20')](_0x56752e[_0x9481('0x35')]['limit']);_0x427c25['offset']=qs[_0x9481('0x1e')](_0x56752e['query'][_0x9481('0x1e')]);}_0x427c25[_0x9481('0x3d')]=qs[_0x9481('0x3e')](_0x56752e[_0x9481('0x35')]['sort']);_0x427c25[_0x9481('0x3f')]=qs['filters'](_[_0x9481('0x40')](_0x56752e['query'],_0x42df68[_0x9481('0x36')]),_0x5d9926);if(_0x56752e['query'][_0x9481('0x41')]){_0x427c25[_0x9481('0x3f')]=_[_0x9481('0x42')](_0x427c25[_0x9481('0x3f')],{'$or':_[_0x9481('0x34')](_0x5d9926,function(_0x3b7998){if(_0x3b7998[_0x9481('0x43')]!=='VIRTUAL'){var _0x464080={};_0x464080[_0x3b7998[_0x9481('0x2e')]]={'$like':'%'+_0x56752e[_0x9481('0x35')][_0x9481('0x41')]+'%'};return _0x464080;}})});}_0x427c25=_[_0x9481('0x42')]({},_0x427c25,_0x56752e[_0x9481('0x44')]);var _0x2e4241={'where':_0x427c25['where']};return db[_0x9481('0x45')][_0x9481('0x21')](_0x2e4241)['then'](function(_0x704e81){_0x2b33f8[_0x9481('0x21')]=_0x704e81;if(_0x56752e[_0x9481('0x35')][_0x9481('0x46')]){_0x427c25[_0x9481('0x47')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x9481('0x48')](_0x427c25);})['then'](function(_0x23811a){_0x2b33f8[_0x9481('0x49')]=_0x23811a;return _0x2b33f8;})['then'](respondWithFilteredResult(_0x1addc8,_0x427c25))['catch'](handleError(_0x1addc8,null));};exports[_0x9481('0x4a')]=function(_0x1d0df0,_0x42b19a){var _0x4c4caf={'raw':!![],'where':{'id':_0x1d0df0[_0x9481('0x4b')]['id']}},_0x4402f6={};_0x4402f6['model']=_['keys'](db[_0x9481('0x45')]['rawAttributes']);_0x4402f6[_0x9481('0x35')]=_[_0x9481('0x4c')](_0x1d0df0[_0x9481('0x35')]);_0x4402f6[_0x9481('0x36')]=_[_0x9481('0x37')](_0x4402f6['model'],_0x4402f6[_0x9481('0x35')]);_0x4c4caf[_0x9481('0x38')]=_['intersection'](_0x4402f6[_0x9481('0x33')],qs[_0x9481('0x39')](_0x1d0df0[_0x9481('0x35')][_0x9481('0x39')]));_0x4c4caf[_0x9481('0x38')]=_0x4c4caf[_0x9481('0x38')][_0x9481('0x3a')]?_0x4c4caf[_0x9481('0x38')]:_0x4402f6[_0x9481('0x33')];if(_0x1d0df0['query'][_0x9481('0x46')]){_0x4c4caf['include']=[{'all':!![]}];}_0x4c4caf=_['merge']({},_0x4c4caf,_0x1d0df0[_0x9481('0x44')]);return db['AnalyticDefaultReport'][_0x9481('0x4d')](_0x4c4caf)[_0x9481('0x27')](handleEntityNotFound(_0x42b19a,null))['then'](respondWithResult(_0x42b19a,null))[_0x9481('0x4e')](handleError(_0x42b19a,null));};exports[_0x9481('0x4f')]=function(_0x2f3413,_0x13b674){return db[_0x9481('0x45')][_0x9481('0x4f')](_0x2f3413['body'],{})['then'](function(_0x424b22){var _0x44d7e0=_0x2f3413[_0x9481('0x50')][_0x9481('0x28')]({'plain':!![]});if(!_0x44d7e0)throw new Error(_0x9481('0x51'));if(_0x44d7e0[_0x9481('0x52')]===_0x9481('0x50')){var _0x3d2250=_0x424b22['get']({'plain':!![]});var _0x3972c1=_0x9481('0x53');return db[_0x9481('0x54')][_0x9481('0x4d')]({'where':{'name':_0x3972c1,'userProfileId':_0x44d7e0[_0x9481('0x55')]},'raw':!![]})['then'](function(_0x4c3048){if(_0x4c3048&&_0x4c3048[_0x9481('0x56')]===0x0){return db[_0x9481('0x2a')][_0x9481('0x4f')]({'name':_0x3d2250['name'],'resourceId':_0x3d2250['id'],'type':'DefaultReports','sectionId':_0x4c3048['id']},{})['then'](function(){return _0x424b22;});}else{return _0x424b22;}})['catch'](function(_0x538507){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x538507);throw _0x538507;});}return _0x424b22;})[_0x9481('0x27')](respondWithResult(_0x13b674,0xc9))[_0x9481('0x4e')](handleError(_0x13b674,null));};exports['update']=function(_0xd8351c,_0x5f210c){if(_0xd8351c[_0x9481('0x57')]['id']){delete _0xd8351c[_0x9481('0x57')]['id'];}return db[_0x9481('0x45')][_0x9481('0x4d')]({'where':{'id':_0xd8351c[_0x9481('0x4b')]['id']}})[_0x9481('0x27')](handleEntityNotFound(_0x5f210c,null))[_0x9481('0x27')](saveUpdates(_0xd8351c['body'],null))[_0x9481('0x27')](respondWithResult(_0x5f210c,null))[_0x9481('0x4e')](handleError(_0x5f210c,null));};exports['destroy']=function(_0x16416a,_0x1240dc){return db[_0x9481('0x45')][_0x9481('0x4d')]({'where':{'id':_0x16416a[_0x9481('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1240dc,null))[_0x9481('0x27')](removeEntity(_0x1240dc,null))[_0x9481('0x4e')](handleError(_0x1240dc,null));};exports[_0x9481('0x58')]=function(_0x3fc0f9,_0x559dd2){var _0x3ac428=0xa;var _0x2927f5=[_0x9481('0x59'),_0x9481('0x5a'),'right_join','cross_join'];var _0x5b4234={'SUM':_0x9481('0x5b'),'COUNT':_0x9481('0x5c'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x9481('0x5d'),'MIN':_0x9481('0x5e'),'AVG':_0x9481('0x5f'),'GROUP_CONCAT':_0x9481('0x60'),'GROUP_CONCAT ASC':_0x9481('0x61'),'GROUP_CONCAT DESC':_0x9481('0x62')};var _0x589b16={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x9481('0x63'),'HOUR':_0x9481('0x64'),'ROUND':_0x9481('0x65'),'UNIX_TIMESTAMP':_0x9481('0x66')};var _0x239676=function(_0x205b96){return!_['includes'](['IS\x20NULL',_0x9481('0x67'),'IS\x20EMPTY',_0x9481('0x68')],_0x205b96);};var _0x59637f=function(_0x9af916){if(!_0x9af916||!_0x9af916[_0x9481('0x69')][_0x9481('0x3a')]){return'';}for(var _0x492464='(',_0x28d331=0x0;_0x28d331<_0x9af916[_0x9481('0x69')]['length'];_0x28d331+=0x1){_0x28d331>0x0&&(_0x492464+='\x20'+_0x9af916['operator']+'\x20');_0x492464+=_0x9af916['rules'][_0x28d331]['group']?_0x59637f(_0x9af916[_0x9481('0x69')][_0x28d331]['group']):_0x9af916[_0x9481('0x69')][_0x28d331][_0x9481('0x6a')]+'\x20'+_0x9af916[_0x9481('0x69')][_0x28d331]['condition']+(_0x239676(_0x9af916[_0x9481('0x69')][_0x28d331]['condition'])?'\x20'+_0x9af916[_0x9481('0x69')][_0x28d331][_0x9481('0x6b')]:'');}return _0x492464+')';};var _0x3c267b={'where':{'id':_0x3fc0f9[_0x9481('0x4b')]['id']}},_0x4f157d,_0x2f20b4,_0x40fed2,_0x4ff016,_0x321972;_0x3c267b=_[_0x9481('0x42')]({},_0x3c267b,_0x3fc0f9[_0x9481('0x44')]);return db[_0x9481('0x45')][_0x9481('0x4d')](_0x3c267b)[_0x9481('0x27')](function(_0x32ebde){if(_0x32ebde){_0x4f157d=_0x32ebde;return _0x32ebde[_0x9481('0x6c')]();}return null;})[_0x9481('0x27')](function(_0x237d9b){if(_0x237d9b){if(!_0x237d9b[_0x9481('0x3a')]){throw new db[(_0x9481('0x6d'))][(_0x9481('0x6e'))](_0x9481('0x6f'),0x193);}_0x2f20b4=_0x237d9b;return db[_0x9481('0x70')][_0x9481('0x48')]({'raw':!![]});}return null;})['then'](function(_0x1e05f8){if(_0x1e05f8){_0x40fed2=_['keyBy'](_0x1e05f8,'id');var _0x47bf37;var _0x1a7892=squel['select']();_0x1a7892['from'](_0x4f157d['table']);for(var _0x1b1967=0x0;_0x1b1967<_0x2f20b4[_0x9481('0x3a')];_0x1b1967+=0x1){_0x47bf37=_0x2f20b4[_0x1b1967][_0x9481('0x71')]?_0x40fed2[_0x2f20b4[_0x1b1967][_0x9481('0x71')]]['metric']:_0x2f20b4[_0x1b1967][_0x9481('0x6a')];_0x47bf37=_0x2f20b4[_0x1b1967][_0x9481('0x72')]?_[_0x9481('0x73')](_0x5b4234[_0x2f20b4[_0x1b1967][_0x9481('0x72')]],'%s',_0x47bf37):_0x47bf37;_0x47bf37=_0x2f20b4[_0x1b1967]['format']?_['replace'](_0x589b16[_0x2f20b4[_0x1b1967][_0x9481('0x74')]],'%s',_0x47bf37):_0x47bf37;if(_0x2f20b4[_0x1b1967][_0x9481('0x75')]){_0x1a7892[_0x9481('0x76')](_0x47bf37);}_0x2f20b4[_0x1b1967][_0x9481('0x77')]&&_0x1a7892[_0x9481('0x3d')](_0x47bf37,_0x2f20b4[_0x1b1967]['orderBy']===_0x9481('0x78')?![]:!![]);_0x1a7892[_0x9481('0x6a')](_0x47bf37,_0x2f20b4[_0x1b1967][_0x9481('0x79')]||_0x47bf37);}if(_0x4f157d[_0x9481('0x7a')]){_0x4f157d[_0x9481('0x7a')]=JSON[_0x9481('0x7b')](_0x4f157d[_0x9481('0x7a')]);for(var _0x42a6d2=0x0;_0x42a6d2<_0x4f157d[_0x9481('0x7a')][_0x9481('0x3a')];_0x42a6d2+=0x1){if(_0x4f157d[_0x9481('0x7a')][_0x42a6d2][_0x9481('0x43')]&&_[_0x9481('0x7c')](_0x2927f5,_0x4f157d[_0x9481('0x7a')][_0x42a6d2][_0x9481('0x43')])&&_0x4f157d['joins'][_0x42a6d2][_0x9481('0x7d')]&&_0x4f157d[_0x9481('0x7a')][_0x42a6d2][_0x9481('0x7e')]&&_0x4f157d[_0x9481('0x7a')][_0x42a6d2][_0x9481('0x7f')]){_0x1a7892[_0x4f157d[_0x9481('0x7a')][_0x42a6d2][_0x9481('0x43')]](_0x4f157d['joins'][_0x42a6d2][_0x9481('0x7e')],null,util[_0x9481('0x74')]('%s.%s\x20=\x20%s.%s',_0x4f157d['table'],_0x4f157d[_0x9481('0x7a')][_0x42a6d2]['parentKey'],_0x4f157d['joins'][_0x42a6d2][_0x9481('0x7e')],_0x4f157d['joins'][_0x42a6d2][_0x9481('0x7f')]));}}}if(_0x4f157d[_0x9481('0x80')]){_0x4f157d[_0x9481('0x80')]=JSON[_0x9481('0x7b')](_0x4f157d['conditions']);_0x1a7892[_0x9481('0x3f')](_0x59637f(_0x4f157d['conditions'][_0x9481('0x76')]));}_0x321972=_0x1a7892[_0x9481('0x81')]();_0x1a7892[_0x9481('0x20')](_0x3ac428);_0x1a7892['offset'](0x0);logger['debug']('Limited\x20Query:',_0x1a7892[_0x9481('0x82')]());return dbH['sequelize']['query'](_0x1a7892[_0x9481('0x82')](),{'type':dbH[_0x9481('0x83')][_0x9481('0x84')]['SELECT']});}})[_0x9481('0x27')](respondWithResult(_0x559dd2,null))[_0x9481('0x4e')](handleError(_0x559dd2,null));};function runReport(_0x545457,_0x226932,_0x3c8241){var _0x1ea93a=_0x226932[_0x9481('0x2e')];var _0x5f4be2=0xa;var _0x2e585d=['join',_0x9481('0x5a'),_0x9481('0x85'),'cross_join'];var _0x1c82a1={'SUM':_0x9481('0x5b'),'COUNT':_0x9481('0x5c'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x9481('0x5e'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x9481('0x60'),'GROUP_CONCAT ASC':_0x9481('0x61'),'GROUP_CONCAT DESC':_0x9481('0x62')};var _0x55b428={'SEC_TO_TIME':_0x9481('0x86'),'DATE':_0x9481('0x63'),'HOUR':_0x9481('0x64'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x9481('0x66')};var _0x31e097=function(_0x339a30){return!_[_0x9481('0x7c')]([_0x9481('0x87'),_0x9481('0x67'),_0x9481('0x88'),_0x9481('0x68')],_0x339a30);};var _0x22e787=function(_0x31b70b){if(!_0x31b70b||!_0x31b70b['rules'][_0x9481('0x3a')]){return'';}for(var _0x5c430e='(',_0x4f55b5=0x0;_0x4f55b5<_0x31b70b['rules'][_0x9481('0x3a')];_0x4f55b5+=0x1){_0x4f55b5>0x0&&(_0x5c430e+='\x20'+_0x31b70b[_0x9481('0x89')]+'\x20');_0x5c430e+=_0x31b70b[_0x9481('0x69')][_0x4f55b5][_0x9481('0x76')]?_0x22e787(_0x31b70b[_0x9481('0x69')][_0x4f55b5]['group']):_0x31b70b[_0x9481('0x69')][_0x4f55b5][_0x9481('0x6a')]+'\x20'+_0x31b70b[_0x9481('0x69')][_0x4f55b5][_0x9481('0x8a')]+(_0x31e097(_0x31b70b[_0x9481('0x69')][_0x4f55b5][_0x9481('0x8a')])?'\x20'+_0x31b70b[_0x9481('0x69')][_0x4f55b5][_0x9481('0x6b')]:'');}return _0x5c430e+')';};var _0x28d924={'where':{'id':_0x545457['id']}},_0x426d56,_0x5808c8,_0x27be69,_0x1d49ba,_0x458a6f;_0x28d924=_[_0x9481('0x42')]({},_0x28d924,_0x3c8241);return db[_0x9481('0x45')][_0x9481('0x4d')](_0x28d924)[_0x9481('0x27')](function(_0x1173e9){if(_0x1173e9){_0x426d56=_0x1173e9;return _0x1173e9[_0x9481('0x6c')]();}return null;})[_0x9481('0x27')](function(_0x5557d7){if(_0x5557d7){if(!_0x5557d7[_0x9481('0x3a')]){throw new db[(_0x9481('0x6d'))][(_0x9481('0x6e'))](_0x9481('0x6f'),0x193);}_0x5808c8=_0x5557d7;return db[_0x9481('0x70')][_0x9481('0x48')]({'raw':!![]});}return null;})[_0x9481('0x27')](function(_0x3ae3e2){if(_0x3ae3e2){_0x27be69=_[_0x9481('0x8b')](_0x3ae3e2,'id');var _0x538fe0;var _0x44e2c2=squel['select']();_0x44e2c2['from'](_0x426d56[_0x9481('0x8c')]);for(var _0x382455=0x0;_0x382455<_0x5808c8[_0x9481('0x3a')];_0x382455+=0x1){_0x538fe0=_0x5808c8[_0x382455][_0x9481('0x71')]?_0x27be69[_0x5808c8[_0x382455][_0x9481('0x71')]][_0x9481('0x8d')]:_0x5808c8[_0x382455]['field'];_0x538fe0=_0x5808c8[_0x382455][_0x9481('0x72')]?_['replace'](_0x1c82a1[_0x5808c8[_0x382455][_0x9481('0x72')]],'%s',_0x538fe0):_0x538fe0;_0x538fe0=_0x5808c8[_0x382455][_0x9481('0x74')]?_[_0x9481('0x73')](_0x55b428[_0x5808c8[_0x382455]['format']],'%s',_0x538fe0):_0x538fe0;if(_0x5808c8[_0x382455]['groupBy']){_0x44e2c2[_0x9481('0x76')](_0x538fe0);}_0x5808c8[_0x382455][_0x9481('0x77')]&&_0x44e2c2[_0x9481('0x3d')](_0x538fe0,_0x5808c8[_0x382455][_0x9481('0x77')]===_0x9481('0x78')?![]:!![]);_0x44e2c2[_0x9481('0x6a')](_0x538fe0,_0x5808c8[_0x382455][_0x9481('0x79')]||_0x538fe0);}if(_0x426d56[_0x9481('0x7a')]){_0x426d56[_0x9481('0x7a')]=JSON['parse'](_0x426d56[_0x9481('0x7a')]);for(var _0xd64114=0x0;_0xd64114<_0x426d56['joins'][_0x9481('0x3a')];_0xd64114+=0x1){if(_0x426d56['joins'][_0xd64114][_0x9481('0x43')]&&_[_0x9481('0x7c')](_0x2e585d,_0x426d56['joins'][_0xd64114][_0x9481('0x43')])&&_0x426d56[_0x9481('0x7a')][_0xd64114][_0x9481('0x7d')]&&_0x426d56['joins'][_0xd64114][_0x9481('0x7e')]&&_0x426d56[_0x9481('0x7a')][_0xd64114]['foreignKey']){_0x44e2c2[_0x426d56[_0x9481('0x7a')][_0xd64114]['type']](_0x426d56[_0x9481('0x7a')][_0xd64114][_0x9481('0x7e')],null,util[_0x9481('0x74')]('%s.%s\x20=\x20%s.%s',_0x426d56['table'],_0x426d56[_0x9481('0x7a')][_0xd64114][_0x9481('0x7d')],_0x426d56[_0x9481('0x7a')][_0xd64114][_0x9481('0x7e')],_0x426d56[_0x9481('0x7a')][_0xd64114][_0x9481('0x7f')]));}}}if(_0x426d56['conditions']){_0x426d56[_0x9481('0x80')]=JSON[_0x9481('0x7b')](_0x426d56[_0x9481('0x80')]);_0x44e2c2[_0x9481('0x3f')](_0x22e787(_0x426d56[_0x9481('0x80')][_0x9481('0x76')]));}_0x458a6f=_0x44e2c2[_0x9481('0x81')]();_0x44e2c2['limit'](_0x5f4be2);_0x44e2c2[_0x9481('0x1e')](0x0);return;}})[_0x9481('0x27')](function(){if(_0x226932[_0x9481('0x8e')]===_0x9481('0x8f')){return null;}var _0x4e5a8d=_[_0x9481('0x42')](_0x226932,{'name':_0x226932[_0x9481('0x90')]||_0x226932[_0x9481('0x2e')]||_0x426d56[_0x9481('0x2e')],'basename':_0x1ea93a,'savename':util['format'](_0x9481('0x91'),_0x226932[_0x9481('0x2e')]||_0x426d56[_0x9481('0x2e')],require(_0x9481('0x92'))[_0x9481('0x93')](0x4),_0x226932[_0x9481('0x8e')]||_0x9481('0x94')),'reportId':_0x426d56['id'],'reportType':_0x9481('0x95')});return db[_0x9481('0x96')][_0x9481('0x4f')](_0x4e5a8d,{'raw':!![]});})[_0x9481('0x27')](function(_0x5930d6){if(_0x426d56[_0x9481('0x8c')]==='cdr'){_0x458a6f[_0x9481('0x3f')](_0x426d56[_0x9481('0x8c')]+_0x9481('0x97'),_0x226932[_0x9481('0x98')],_0x226932[_0x9481('0x99')]);}else{_0x458a6f['where'](_0x426d56[_0x9481('0x8c')]+_0x9481('0x9a'),_0x226932[_0x9481('0x98')],_0x226932[_0x9481('0x99')]);}if(_0x5930d6){logger[_0x9481('0x9b')](_0x9481('0x9c'),_0x458a6f['toString']());require(_0x9481('0x9d'))[_0x9481('0x9e')](path[_0x9481('0x59')](__dirname,_0x9481('0x9f'),_0x5930d6[_0x9481('0x8e')]),[_0x5930d6['id'],_0x458a6f[_0x9481('0x82')](),path[_0x9481('0x59')](__dirname,_0x9481('0xa0'),_0x5930d6[_0x9481('0xa1')]),_0x1ea93a]);return _0x5930d6;}else{var _0x26a666=squel[_0x9481('0xa2')]();_0x26a666[_0x9481('0xa3')]('('+_0x458a6f['toString']()+')',_0x9481('0xa4'));_0x26a666[_0x9481('0x6a')](_0x9481('0xa5'),_0x9481('0x21'));_0x458a6f[_0x9481('0x20')](_0x226932[_0x9481('0x20')]||_0x5f4be2);_0x458a6f[_0x9481('0x1e')](_0x226932[_0x9481('0x1e')]||0x0);return dbH[_0x9481('0x83')][_0x9481('0x35')](_0x26a666[_0x9481('0x82')](),{'type':dbH[_0x9481('0x83')][_0x9481('0x84')][_0x9481('0xa6')]})[_0x9481('0x27')](function(_0xcf83d2){if(!_0xcf83d2[_0x9481('0x3a')]){_0x1d49ba=0x0;}else{_0x1d49ba=_0xcf83d2[0x0][_0x9481('0x21')]||0x0;}return dbH[_0x9481('0x83')][_0x9481('0x35')](_0x458a6f['toString'](),{'type':dbH[_0x9481('0x83')][_0x9481('0x84')][_0x9481('0xa6')]});})[_0x9481('0x27')](function(_0x4553fc){return{'rows':_0x4553fc||[],'count':_0x1d49ba};});}});}exports[_0x9481('0xa7')]=function(_0x55c4ab,_0x57928a){return runReport(_0x55c4ab[_0x9481('0x4b')],_0x55c4ab[_0x9481('0x35')],_0x55c4ab[_0x9481('0x44')])[_0x9481('0x27')](respondWithResult(_0x57928a,null))['catch'](handleError(_0x57928a,null));};exports['runReport']=runReport;exports['query']=function(_0x52b980,_0x5792b1){var _0x3a199b=0xa;var _0x4b779b=[_0x9481('0x59'),_0x9481('0x5a'),_0x9481('0x85'),_0x9481('0xa8')];var _0x55a65f={'SUM':_0x9481('0x5b'),'COUNT':_0x9481('0x5c'),'COUNT DISTINCT':_0x9481('0xa9'),'MAX':_0x9481('0x5d'),'MIN':_0x9481('0x5e'),'AVG':_0x9481('0x5f'),'GROUP_CONCAT':_0x9481('0x60'),'GROUP_CONCAT ASC':_0x9481('0x61'),'GROUP_CONCAT DESC':_0x9481('0x62')};var _0x583490={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x9481('0x63'),'HOUR':'HOUR(%s)','ROUND':_0x9481('0x65'),'UNIX_TIMESTAMP':_0x9481('0x66')};var _0x1e40fe=function(_0x26c87b){return!_[_0x9481('0x7c')](['IS\x20NULL',_0x9481('0x67'),_0x9481('0x88'),'IS\x20NOT\x20EMPTY'],_0x26c87b);};var _0x4ea411=function(_0x1cdca0){if(!_0x1cdca0||!_0x1cdca0[_0x9481('0x69')][_0x9481('0x3a')]){return'';}for(var _0x15c53f='(',_0x7ee854=0x0;_0x7ee854<_0x1cdca0[_0x9481('0x69')][_0x9481('0x3a')];_0x7ee854+=0x1){_0x7ee854>0x0&&(_0x15c53f+='\x20'+_0x1cdca0[_0x9481('0x89')]+'\x20');_0x15c53f+=_0x1cdca0[_0x9481('0x69')][_0x7ee854][_0x9481('0x76')]?_0x4ea411(_0x1cdca0['rules'][_0x7ee854][_0x9481('0x76')]):_0x1cdca0[_0x9481('0x69')][_0x7ee854][_0x9481('0x6a')]+'\x20'+_0x1cdca0[_0x9481('0x69')][_0x7ee854][_0x9481('0x8a')]+(_0x1e40fe(_0x1cdca0['rules'][_0x7ee854][_0x9481('0x8a')])?'\x20'+_0x1cdca0[_0x9481('0x69')][_0x7ee854]['value']:'');}return _0x15c53f+')';};var _0x49a6db={'where':{'id':_0x52b980['params']['id']}},_0x224b16,_0x83543f,_0x58c043,_0x97a67a,_0xe157e4;_0x49a6db=_[_0x9481('0x42')]({},_0x49a6db,_0x52b980[_0x9481('0x44')]);return db[_0x9481('0x45')][_0x9481('0x4d')](_0x49a6db)['then'](function(_0x1a1058){if(_0x1a1058){_0x224b16=_0x1a1058;return _0x1a1058['getFields']();}return null;})[_0x9481('0x27')](function(_0x206661){if(_0x206661){if(!_0x206661[_0x9481('0x3a')]){throw new db[(_0x9481('0x6d'))][(_0x9481('0x6e'))](_0x9481('0x6f'),0x193);}_0x83543f=_0x206661;return db['AnalyticMetric'][_0x9481('0x48')]({'raw':!![]});}return null;})[_0x9481('0x27')](function(_0x40cdf9){if(_0x40cdf9){_0x58c043=_['keyBy'](_0x40cdf9,'id');var _0x5467fe;var _0x440d88=squel['select']();_0x440d88[_0x9481('0xa3')](_0x224b16['table']);for(var _0x2a0367=0x0;_0x2a0367<_0x83543f[_0x9481('0x3a')];_0x2a0367+=0x1){_0x5467fe=_0x83543f[_0x2a0367]['MetricId']?_0x58c043[_0x83543f[_0x2a0367][_0x9481('0x71')]][_0x9481('0x8d')]:_0x83543f[_0x2a0367][_0x9481('0x6a')];_0x5467fe=_0x83543f[_0x2a0367]['function']?_[_0x9481('0x73')](_0x55a65f[_0x83543f[_0x2a0367][_0x9481('0x72')]],'%s',_0x5467fe):_0x5467fe;_0x5467fe=_0x83543f[_0x2a0367][_0x9481('0x74')]?_[_0x9481('0x73')](_0x583490[_0x83543f[_0x2a0367][_0x9481('0x74')]],'%s',_0x5467fe):_0x5467fe;if(_0x83543f[_0x2a0367][_0x9481('0x75')]){_0x440d88[_0x9481('0x76')](_0x5467fe);}_0x83543f[_0x2a0367]['orderBy']&&_0x440d88[_0x9481('0x3d')](_0x5467fe,_0x83543f[_0x2a0367][_0x9481('0x77')]===_0x9481('0x78')?![]:!![]);_0x440d88[_0x9481('0x6a')](_0x5467fe,_0x83543f[_0x2a0367][_0x9481('0x79')]||_0x5467fe);}if(_0x224b16['joins']){_0x224b16[_0x9481('0x7a')]=JSON[_0x9481('0x7b')](_0x224b16[_0x9481('0x7a')]);for(var _0x527ef6=0x0;_0x527ef6<_0x224b16['joins'][_0x9481('0x3a')];_0x527ef6+=0x1){if(_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x43')]&&_[_0x9481('0x7c')](_0x4b779b,_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x43')])&&_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x7d')]&&_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x7e')]&&_0x224b16['joins'][_0x527ef6][_0x9481('0x7f')]){_0x440d88[_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x43')]](_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x7e')],null,util[_0x9481('0x74')]('%s.%s\x20=\x20%s.%s',_0x224b16[_0x9481('0x8c')],_0x224b16[_0x9481('0x7a')][_0x527ef6]['parentKey'],_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x7e')],_0x224b16[_0x9481('0x7a')][_0x527ef6]['foreignKey']));}}}if(_0x224b16[_0x9481('0x80')]){_0x224b16[_0x9481('0x80')]=JSON[_0x9481('0x7b')](_0x224b16[_0x9481('0x80')]);_0x440d88['where'](_0x4ea411(_0x224b16[_0x9481('0x80')][_0x9481('0x76')]));}_0xe157e4=_0x440d88[_0x9481('0x81')]();_0x440d88[_0x9481('0x20')](_0x3a199b);_0x440d88['offset'](0x0);logger[_0x9481('0xaa')](_0x9481('0xab'),_0x440d88[_0x9481('0x82')]());return dbH[_0x9481('0x83')][_0x9481('0x35')](_0x440d88[_0x9481('0x82')](),{'type':dbH[_0x9481('0x83')][_0x9481('0x84')][_0x9481('0xa6')]});}})[_0x9481('0x27')](function(){return{'sql':_0xe157e4['toString']()};})[_0x9481('0x27')](respondWithResult(_0x5792b1,null))[_0x9481('0x4e')](handleError(_0x5792b1,null));}; \ No newline at end of file +var _0x7a54=['options','AnalyticDefaultReport','includeAll','include','show','keys','attributes','create','body','user','role','get','Reports','UserProfileSection','userProfileId','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','params','right_join','cross_join','SUM(%s)','COUNT(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','group','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','MetricId','metric','field','function','replace','format','orderBy','DESC','joins','parse','type','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','debug','toString','sequelize','QueryTypes','SELECT','join','left_join','COUNT(DISTINCT\x20%s)','MAX(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20EMPTY','operator','groupBy','alias','output','web','fullPath','%s-%s.%s','generate','default','AnalyticExtractedReport','cdr','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','getFields','clone','Limited\x20Query:','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','limit','count','offset','Content-Range','apply','save','then','destroy','DefaultReports','error','stack','name','index','map','fieldName','model','query','filters','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge'];(function(_0x126af7,_0x25fa06){var _0x25b500=function(_0x10ffe7){while(--_0x10ffe7){_0x126af7['push'](_0x126af7['shift']());}};_0x25b500(++_0x25fa06);}(_0x7a54,0x106));var _0x47a5=function(_0x559536,_0x39afd8){_0x559536=_0x559536-0x0;var _0x1632ee=_0x7a54[_0x559536];return _0x1632ee;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];var dbH=require(_0x47a5('0x15'))[_0x47a5('0x16')];function respondWithStatusCode(_0x5beb89,_0x44bd3e){_0x44bd3e=_0x44bd3e||0xcc;return function(_0x221b54){if(_0x221b54){return _0x5beb89[_0x47a5('0x17')](_0x44bd3e);}return _0x5beb89[_0x47a5('0x18')](_0x44bd3e)[_0x47a5('0x19')]();};}function respondWithResult(_0x620ee9,_0x3c6c46){_0x3c6c46=_0x3c6c46||0xc8;return function(_0x190faa){if(_0x190faa){return _0x620ee9['status'](_0x3c6c46)[_0x47a5('0x1a')](_0x190faa);}};}function respondWithFilteredResult(_0x11faf5,_0x3b001e){return function(_0x2a2cbb){if(_0x2a2cbb){var _0x1ef44c=typeof _0x3b001e['offset']==='undefined'&&typeof _0x3b001e[_0x47a5('0x1b')]==='undefined';var _0x5247fd=_0x2a2cbb[_0x47a5('0x1c')];var _0xaf70a6=_0x1ef44c?0x0:_0x3b001e[_0x47a5('0x1d')];var _0x1ef371=_0x1ef44c?_0x2a2cbb[_0x47a5('0x1c')]:_0x3b001e[_0x47a5('0x1d')]+_0x3b001e[_0x47a5('0x1b')];var _0xe3c618;if(_0x1ef371>=_0x5247fd){_0x1ef371=_0x5247fd;_0xe3c618=0xc8;}else{_0xe3c618=0xce;}_0x11faf5[_0x47a5('0x18')](_0xe3c618);return _0x11faf5['set'](_0x47a5('0x1e'),_0xaf70a6+'-'+_0x1ef371+'/'+_0x5247fd)[_0x47a5('0x1a')](_0x2a2cbb);}return null;};}function patchUpdates(_0x47cf3c){return function(_0x2b0360){try{jsonpatch[_0x47a5('0x1f')](_0x2b0360,_0x47cf3c,!![]);}catch(_0x36874d){return BPromise['reject'](_0x36874d);}return _0x2b0360[_0x47a5('0x20')]();};}function saveUpdates(_0x2f142b,_0x23db32){return function(_0x7a9f9e){if(_0x7a9f9e){return _0x7a9f9e['update'](_0x2f142b)[_0x47a5('0x21')](function(_0x385687){return _0x385687;});}return null;};}function removeEntity(_0x513981,_0x28747d){return function(_0xc4cd63){if(_0xc4cd63){return _0xc4cd63[_0x47a5('0x22')]()[_0x47a5('0x21')](function(){var _0x3abd6a=_0xc4cd63['get']({'plain':!![]});var _0x53078a=_0x47a5('0x23');return db['UserProfileResource'][_0x47a5('0x22')]({'where':{'type':_0x53078a,'resourceId':_0x3abd6a['id']}})['then'](function(){return _0xc4cd63;});})[_0x47a5('0x21')](function(){_0x513981[_0x47a5('0x18')](0xcc)[_0x47a5('0x19')]();});}};}function handleEntityNotFound(_0x1dac65,_0x21f296){return function(_0x3ba0b7){if(!_0x3ba0b7){_0x1dac65[_0x47a5('0x17')](0x194);}return _0x3ba0b7;};}function handleError(_0x136b14,_0x16631f){_0x16631f=_0x16631f||0x1f4;return function(_0x361bfa){logger[_0x47a5('0x24')](_0x361bfa[_0x47a5('0x25')]);if(_0x361bfa[_0x47a5('0x26')]){delete _0x361bfa['name'];}_0x136b14[_0x47a5('0x18')](_0x16631f)['send'](_0x361bfa);};}exports[_0x47a5('0x27')]=function(_0x9ac908,_0x16901f){var _0x4d6b57={},_0x256650={},_0x625952={'count':0x0,'rows':[]};var _0x39b50b=_[_0x47a5('0x28')](db['AnalyticDefaultReport']['rawAttributes'],function(_0x6f9a12){return{'name':_0x6f9a12[_0x47a5('0x29')],'type':_0x6f9a12['type']['key']};});_0x256650[_0x47a5('0x2a')]=_[_0x47a5('0x28')](_0x39b50b,'name');_0x256650[_0x47a5('0x2b')]=_['keys'](_0x9ac908[_0x47a5('0x2b')]);_0x256650[_0x47a5('0x2c')]=_['intersection'](_0x256650['model'],_0x256650[_0x47a5('0x2b')]);_0x4d6b57['attributes']=_[_0x47a5('0x2d')](_0x256650[_0x47a5('0x2a')],qs[_0x47a5('0x2e')](_0x9ac908['query'][_0x47a5('0x2e')]));_0x4d6b57['attributes']=_0x4d6b57['attributes'][_0x47a5('0x2f')]?_0x4d6b57['attributes']:_0x256650[_0x47a5('0x2a')];if(!_0x9ac908['query'][_0x47a5('0x30')](_0x47a5('0x31'))){_0x4d6b57[_0x47a5('0x1b')]=qs[_0x47a5('0x1b')](_0x9ac908[_0x47a5('0x2b')][_0x47a5('0x1b')]);_0x4d6b57[_0x47a5('0x1d')]=qs[_0x47a5('0x1d')](_0x9ac908[_0x47a5('0x2b')]['offset']);}_0x4d6b57[_0x47a5('0x32')]=qs[_0x47a5('0x33')](_0x9ac908['query'][_0x47a5('0x33')]);_0x4d6b57[_0x47a5('0x34')]=qs[_0x47a5('0x2c')](_['pick'](_0x9ac908[_0x47a5('0x2b')],_0x256650[_0x47a5('0x2c')]),_0x39b50b);if(_0x9ac908['query'][_0x47a5('0x35')]){_0x4d6b57[_0x47a5('0x34')]=_['merge'](_0x4d6b57['where'],{'$or':_['map'](_0x39b50b,function(_0x12d9f2){if(_0x12d9f2['type']!==_0x47a5('0x36')){var _0x1f9631={};_0x1f9631[_0x12d9f2[_0x47a5('0x26')]]={'$like':'%'+_0x9ac908[_0x47a5('0x2b')][_0x47a5('0x35')]+'%'};return _0x1f9631;}})});}_0x4d6b57=_[_0x47a5('0x37')]({},_0x4d6b57,_0x9ac908[_0x47a5('0x38')]);var _0x1f3d01={'where':_0x4d6b57[_0x47a5('0x34')]};return db[_0x47a5('0x39')][_0x47a5('0x1c')](_0x1f3d01)[_0x47a5('0x21')](function(_0x23d6d8){_0x625952['count']=_0x23d6d8;if(_0x9ac908[_0x47a5('0x2b')][_0x47a5('0x3a')]){_0x4d6b57[_0x47a5('0x3b')]=[{'all':!![]}];}return db[_0x47a5('0x39')]['findAll'](_0x4d6b57);})[_0x47a5('0x21')](function(_0x528ef3){_0x625952['rows']=_0x528ef3;return _0x625952;})['then'](respondWithFilteredResult(_0x16901f,_0x4d6b57))['catch'](handleError(_0x16901f,null));};exports[_0x47a5('0x3c')]=function(_0x5ec4e5,_0x2bb502){var _0x3a740b={'raw':!![],'where':{'id':_0x5ec4e5['params']['id']}},_0x448610={};_0x448610[_0x47a5('0x2a')]=_[_0x47a5('0x3d')](db['AnalyticDefaultReport']['rawAttributes']);_0x448610[_0x47a5('0x2b')]=_['keys'](_0x5ec4e5[_0x47a5('0x2b')]);_0x448610[_0x47a5('0x2c')]=_[_0x47a5('0x2d')](_0x448610[_0x47a5('0x2a')],_0x448610[_0x47a5('0x2b')]);_0x3a740b[_0x47a5('0x3e')]=_[_0x47a5('0x2d')](_0x448610[_0x47a5('0x2a')],qs[_0x47a5('0x2e')](_0x5ec4e5[_0x47a5('0x2b')][_0x47a5('0x2e')]));_0x3a740b[_0x47a5('0x3e')]=_0x3a740b[_0x47a5('0x3e')][_0x47a5('0x2f')]?_0x3a740b[_0x47a5('0x3e')]:_0x448610[_0x47a5('0x2a')];if(_0x5ec4e5['query'][_0x47a5('0x3a')]){_0x3a740b[_0x47a5('0x3b')]=[{'all':!![]}];}_0x3a740b=_['merge']({},_0x3a740b,_0x5ec4e5['options']);return db[_0x47a5('0x39')]['find'](_0x3a740b)[_0x47a5('0x21')](handleEntityNotFound(_0x2bb502,null))[_0x47a5('0x21')](respondWithResult(_0x2bb502,null))['catch'](handleError(_0x2bb502,null));};exports['create']=function(_0x3d85cc,_0x52d409){return db[_0x47a5('0x39')][_0x47a5('0x3f')](_0x3d85cc[_0x47a5('0x40')],{})[_0x47a5('0x21')](function(_0x44fe8a){var _0x26acd2=_0x3d85cc[_0x47a5('0x41')]['get']({'plain':!![]});if(!_0x26acd2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x26acd2[_0x47a5('0x42')]===_0x47a5('0x41')){var _0x1163e3=_0x44fe8a[_0x47a5('0x43')]({'plain':!![]});var _0x2c7020=_0x47a5('0x44');return db[_0x47a5('0x45')]['find']({'where':{'name':_0x2c7020,'userProfileId':_0x26acd2[_0x47a5('0x46')]},'raw':!![]})[_0x47a5('0x21')](function(_0x5f6a){if(_0x5f6a&&_0x5f6a['autoAssociation']===0x0){return db[_0x47a5('0x47')]['create']({'name':_0x1163e3[_0x47a5('0x26')],'resourceId':_0x1163e3['id'],'type':_0x47a5('0x23'),'sectionId':_0x5f6a['id']},{})[_0x47a5('0x21')](function(){return _0x44fe8a;});}else{return _0x44fe8a;}})[_0x47a5('0x48')](function(_0x588551){logger[_0x47a5('0x24')](_0x47a5('0x49'),_0x588551);throw _0x588551;});}return _0x44fe8a;})[_0x47a5('0x21')](respondWithResult(_0x52d409,0xc9))[_0x47a5('0x48')](handleError(_0x52d409,null));};exports[_0x47a5('0x4a')]=function(_0x6a53b3,_0x24e9f4){if(_0x6a53b3['body']['id']){delete _0x6a53b3[_0x47a5('0x40')]['id'];}return db[_0x47a5('0x39')][_0x47a5('0x4b')]({'where':{'id':_0x6a53b3[_0x47a5('0x4c')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x24e9f4,null))[_0x47a5('0x21')](saveUpdates(_0x6a53b3['body'],null))[_0x47a5('0x21')](respondWithResult(_0x24e9f4,null))[_0x47a5('0x48')](handleError(_0x24e9f4,null));};exports[_0x47a5('0x22')]=function(_0x53871e,_0x4c5ed){return db[_0x47a5('0x39')][_0x47a5('0x4b')]({'where':{'id':_0x53871e['params']['id']}})['then'](handleEntityNotFound(_0x4c5ed,null))[_0x47a5('0x21')](removeEntity(_0x4c5ed,null))[_0x47a5('0x48')](handleError(_0x4c5ed,null));};exports['preview']=function(_0x4cf792,_0x6d6b2b){var _0x4d6a82=0xa;var _0x16bb8a=['join','left_join',_0x47a5('0x4d'),_0x47a5('0x4e')];var _0x53eedf={'SUM':_0x47a5('0x4f'),'COUNT':_0x47a5('0x50'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x47a5('0x51'),'AVG':_0x47a5('0x52'),'GROUP_CONCAT':_0x47a5('0x53'),'GROUP_CONCAT ASC':_0x47a5('0x54'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x199621={'SEC_TO_TIME':_0x47a5('0x55'),'DATE':_0x47a5('0x56'),'HOUR':'HOUR(%s)','ROUND':_0x47a5('0x57'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x485e3c=function(_0x470da6){return!_[_0x47a5('0x58')]([_0x47a5('0x59'),_0x47a5('0x5a'),'IS\x20EMPTY',_0x47a5('0x5b')],_0x470da6);};var _0x5d1550=function(_0x5cbe97){if(!_0x5cbe97||!_0x5cbe97['rules']['length']){return'';}for(var _0x212d92='(',_0x6cd4ea=0x0;_0x6cd4ea<_0x5cbe97[_0x47a5('0x5c')]['length'];_0x6cd4ea+=0x1){_0x6cd4ea>0x0&&(_0x212d92+='\x20'+_0x5cbe97['operator']+'\x20');_0x212d92+=_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea][_0x47a5('0x5d')]?_0x5d1550(_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea][_0x47a5('0x5d')]):_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea]['field']+'\x20'+_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea]['condition']+(_0x485e3c(_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea][_0x47a5('0x5e')])?'\x20'+_0x5cbe97['rules'][_0x6cd4ea][_0x47a5('0x5f')]:'');}return _0x212d92+')';};var _0x345104={'where':{'id':_0x4cf792[_0x47a5('0x4c')]['id']}},_0x132854,_0x3e8274,_0x2d6494,_0x215634,_0x35cca8;_0x345104=_['merge']({},_0x345104,_0x4cf792[_0x47a5('0x38')]);return db[_0x47a5('0x39')][_0x47a5('0x4b')](_0x345104)[_0x47a5('0x21')](function(_0x396cb0){if(_0x396cb0){_0x132854=_0x396cb0;return _0x396cb0['getFields']();}return null;})[_0x47a5('0x21')](function(_0xdfcecc){if(_0xdfcecc){if(!_0xdfcecc[_0x47a5('0x2f')]){throw new db[(_0x47a5('0x60'))][(_0x47a5('0x61'))](_0x47a5('0x62'),0x193);}_0x3e8274=_0xdfcecc;return db[_0x47a5('0x63')][_0x47a5('0x64')]({'raw':!![]});}return null;})[_0x47a5('0x21')](function(_0x44cb90){if(_0x44cb90){_0x2d6494=_[_0x47a5('0x65')](_0x44cb90,'id');var _0x44fda9;var _0x3c0006=squel[_0x47a5('0x66')]();_0x3c0006[_0x47a5('0x67')](_0x132854['table']);for(var _0x42dd7d=0x0;_0x42dd7d<_0x3e8274[_0x47a5('0x2f')];_0x42dd7d+=0x1){_0x44fda9=_0x3e8274[_0x42dd7d][_0x47a5('0x68')]?_0x2d6494[_0x3e8274[_0x42dd7d]['MetricId']][_0x47a5('0x69')]:_0x3e8274[_0x42dd7d][_0x47a5('0x6a')];_0x44fda9=_0x3e8274[_0x42dd7d][_0x47a5('0x6b')]?_[_0x47a5('0x6c')](_0x53eedf[_0x3e8274[_0x42dd7d]['function']],'%s',_0x44fda9):_0x44fda9;_0x44fda9=_0x3e8274[_0x42dd7d][_0x47a5('0x6d')]?_['replace'](_0x199621[_0x3e8274[_0x42dd7d][_0x47a5('0x6d')]],'%s',_0x44fda9):_0x44fda9;if(_0x3e8274[_0x42dd7d]['groupBy']){_0x3c0006[_0x47a5('0x5d')](_0x44fda9);}_0x3e8274[_0x42dd7d]['orderBy']&&_0x3c0006[_0x47a5('0x32')](_0x44fda9,_0x3e8274[_0x42dd7d][_0x47a5('0x6e')]===_0x47a5('0x6f')?![]:!![]);_0x3c0006['field'](_0x44fda9,_0x3e8274[_0x42dd7d]['alias']||_0x44fda9);}if(_0x132854['joins']){_0x132854[_0x47a5('0x70')]=JSON[_0x47a5('0x71')](_0x132854[_0x47a5('0x70')]);for(var _0x117510=0x0;_0x117510<_0x132854['joins'][_0x47a5('0x2f')];_0x117510+=0x1){if(_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x72')]&&_[_0x47a5('0x58')](_0x16bb8a,_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x72')])&&_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x73')]&&_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x74')]&&_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x75')]){_0x3c0006[_0x132854['joins'][_0x117510][_0x47a5('0x72')]](_0x132854['joins'][_0x117510][_0x47a5('0x74')],null,util[_0x47a5('0x6d')](_0x47a5('0x76'),_0x132854[_0x47a5('0x77')],_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x73')],_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x74')],_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x75')]));}}}if(_0x132854[_0x47a5('0x78')]){_0x132854[_0x47a5('0x78')]=JSON[_0x47a5('0x71')](_0x132854[_0x47a5('0x78')]);_0x3c0006[_0x47a5('0x34')](_0x5d1550(_0x132854['conditions']['group']));}_0x35cca8=_0x3c0006['clone']();_0x3c0006['limit'](_0x4d6a82);_0x3c0006[_0x47a5('0x1d')](0x0);logger[_0x47a5('0x79')]('Limited\x20Query:',_0x3c0006[_0x47a5('0x7a')]());return dbH[_0x47a5('0x7b')][_0x47a5('0x2b')](_0x3c0006[_0x47a5('0x7a')](),{'type':dbH[_0x47a5('0x7b')][_0x47a5('0x7c')][_0x47a5('0x7d')]});}})[_0x47a5('0x21')](respondWithResult(_0x6d6b2b,null))[_0x47a5('0x48')](handleError(_0x6d6b2b,null));};function runReport(_0x1ffe3c,_0x24a6c1,_0x5e5f16){var _0x18fa31=_0x24a6c1[_0x47a5('0x26')];var _0x420671=0xa;var _0x4f35ff=[_0x47a5('0x7e'),_0x47a5('0x7f'),_0x47a5('0x4d'),'cross_join'];var _0x19dc8c={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x47a5('0x80'),'MAX':_0x47a5('0x81'),'MIN':_0x47a5('0x51'),'AVG':_0x47a5('0x52'),'GROUP_CONCAT':_0x47a5('0x53'),'GROUP_CONCAT ASC':_0x47a5('0x54'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x592322={'SEC_TO_TIME':_0x47a5('0x55'),'DATE':'DATE(%s)','HOUR':_0x47a5('0x82'),'ROUND':_0x47a5('0x57'),'UNIX_TIMESTAMP':_0x47a5('0x83')};var _0xb16bdd=function(_0x53ea2b){return!_[_0x47a5('0x58')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x47a5('0x84'),_0x47a5('0x5b')],_0x53ea2b);};var _0x5b91f7=function(_0x1926bd){if(!_0x1926bd||!_0x1926bd[_0x47a5('0x5c')][_0x47a5('0x2f')]){return'';}for(var _0x4c25ec='(',_0x280372=0x0;_0x280372<_0x1926bd['rules'][_0x47a5('0x2f')];_0x280372+=0x1){_0x280372>0x0&&(_0x4c25ec+='\x20'+_0x1926bd[_0x47a5('0x85')]+'\x20');_0x4c25ec+=_0x1926bd[_0x47a5('0x5c')][_0x280372]['group']?_0x5b91f7(_0x1926bd[_0x47a5('0x5c')][_0x280372][_0x47a5('0x5d')]):_0x1926bd[_0x47a5('0x5c')][_0x280372]['field']+'\x20'+_0x1926bd[_0x47a5('0x5c')][_0x280372]['condition']+(_0xb16bdd(_0x1926bd[_0x47a5('0x5c')][_0x280372]['condition'])?'\x20'+_0x1926bd[_0x47a5('0x5c')][_0x280372][_0x47a5('0x5f')]:'');}return _0x4c25ec+')';};var _0x20a742={'where':{'id':_0x1ffe3c['id']}},_0x211fbf,_0x51738b,_0x42fcce,_0x2ae130,_0x23c393;_0x20a742=_[_0x47a5('0x37')]({},_0x20a742,_0x5e5f16);return db[_0x47a5('0x39')]['find'](_0x20a742)['then'](function(_0x569550){if(_0x569550){_0x211fbf=_0x569550;return _0x569550['getFields']();}return null;})[_0x47a5('0x21')](function(_0xa8809a){if(_0xa8809a){if(!_0xa8809a[_0x47a5('0x2f')]){throw new db['Sequelize'][(_0x47a5('0x61'))](_0x47a5('0x62'),0x193);}_0x51738b=_0xa8809a;return db['AnalyticMetric'][_0x47a5('0x64')]({'raw':!![]});}return null;})[_0x47a5('0x21')](function(_0x19acfa){if(_0x19acfa){_0x42fcce=_[_0x47a5('0x65')](_0x19acfa,'id');var _0x58dacd;var _0x4b5353=squel[_0x47a5('0x66')]();_0x4b5353[_0x47a5('0x67')](_0x211fbf['table']);for(var _0x27d422=0x0;_0x27d422<_0x51738b[_0x47a5('0x2f')];_0x27d422+=0x1){_0x58dacd=_0x51738b[_0x27d422]['MetricId']?_0x42fcce[_0x51738b[_0x27d422][_0x47a5('0x68')]][_0x47a5('0x69')]:_0x51738b[_0x27d422][_0x47a5('0x6a')];_0x58dacd=_0x51738b[_0x27d422]['function']?_[_0x47a5('0x6c')](_0x19dc8c[_0x51738b[_0x27d422]['function']],'%s',_0x58dacd):_0x58dacd;_0x58dacd=_0x51738b[_0x27d422][_0x47a5('0x6d')]?_['replace'](_0x592322[_0x51738b[_0x27d422][_0x47a5('0x6d')]],'%s',_0x58dacd):_0x58dacd;if(_0x51738b[_0x27d422][_0x47a5('0x86')]){_0x4b5353['group'](_0x58dacd);}_0x51738b[_0x27d422][_0x47a5('0x6e')]&&_0x4b5353['order'](_0x58dacd,_0x51738b[_0x27d422][_0x47a5('0x6e')]===_0x47a5('0x6f')?![]:!![]);_0x4b5353[_0x47a5('0x6a')](_0x58dacd,_0x51738b[_0x27d422][_0x47a5('0x87')]||_0x58dacd);}if(_0x211fbf['joins']){_0x211fbf[_0x47a5('0x70')]=JSON['parse'](_0x211fbf['joins']);for(var _0x2bb2df=0x0;_0x2bb2df<_0x211fbf[_0x47a5('0x70')][_0x47a5('0x2f')];_0x2bb2df+=0x1){if(_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x72')]&&_['includes'](_0x4f35ff,_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x72')])&&_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x73')]&&_0x211fbf['joins'][_0x2bb2df][_0x47a5('0x74')]&&_0x211fbf['joins'][_0x2bb2df][_0x47a5('0x75')]){_0x4b5353[_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x72')]](_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x74')],null,util[_0x47a5('0x6d')](_0x47a5('0x76'),_0x211fbf[_0x47a5('0x77')],_0x211fbf[_0x47a5('0x70')][_0x2bb2df]['parentKey'],_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x74')],_0x211fbf['joins'][_0x2bb2df][_0x47a5('0x75')]));}}}if(_0x211fbf[_0x47a5('0x78')]){_0x211fbf[_0x47a5('0x78')]=JSON['parse'](_0x211fbf['conditions']);_0x4b5353[_0x47a5('0x34')](_0x5b91f7(_0x211fbf[_0x47a5('0x78')]['group']));}_0x23c393=_0x4b5353['clone']();_0x4b5353[_0x47a5('0x1b')](_0x420671);_0x4b5353[_0x47a5('0x1d')](0x0);return;}})['then'](function(){if(_0x24a6c1[_0x47a5('0x88')]===_0x47a5('0x89')){return null;}var _0x4c9e6a=_[_0x47a5('0x37')](_0x24a6c1,{'name':_0x24a6c1[_0x47a5('0x8a')]||_0x24a6c1[_0x47a5('0x26')]||_0x211fbf[_0x47a5('0x26')],'basename':_0x18fa31,'savename':util[_0x47a5('0x6d')](_0x47a5('0x8b'),_0x24a6c1['name']||_0x211fbf['name'],require('randomstring')[_0x47a5('0x8c')](0x4),_0x24a6c1[_0x47a5('0x88')]||'csv'),'reportId':_0x211fbf['id'],'reportType':_0x47a5('0x8d')});return db[_0x47a5('0x8e')][_0x47a5('0x3f')](_0x4c9e6a,{'raw':!![]});})[_0x47a5('0x21')](function(_0xcdbfd7){if(_0x211fbf['table']===_0x47a5('0x8f')){_0x23c393['where'](_0x211fbf['table']+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x24a6c1[_0x47a5('0x90')],_0x24a6c1['endDate']);}else{_0x23c393[_0x47a5('0x34')](_0x211fbf[_0x47a5('0x77')]+_0x47a5('0x91'),_0x24a6c1['startDate'],_0x24a6c1[_0x47a5('0x92')]);}if(_0xcdbfd7){logger[_0x47a5('0x93')](_0x47a5('0x94'),_0x23c393[_0x47a5('0x7a')]());require(_0x47a5('0x95'))['fork'](path[_0x47a5('0x7e')](__dirname,_0x47a5('0x96'),_0xcdbfd7['output']),[_0xcdbfd7['id'],_0x23c393[_0x47a5('0x7a')](),path[_0x47a5('0x7e')](__dirname,_0x47a5('0x97'),_0xcdbfd7[_0x47a5('0x98')]),_0x18fa31]);return _0xcdbfd7;}else{var _0x3c117a=squel[_0x47a5('0x66')]();_0x3c117a['from']('('+_0x23c393[_0x47a5('0x7a')]()+')',_0x47a5('0x99'));_0x3c117a['field'](_0x47a5('0x9a'),_0x47a5('0x1c'));_0x23c393[_0x47a5('0x1b')](_0x24a6c1[_0x47a5('0x1b')]||_0x420671);_0x23c393['offset'](_0x24a6c1['offset']||0x0);return dbH['sequelize']['query'](_0x3c117a[_0x47a5('0x7a')](),{'type':dbH[_0x47a5('0x7b')][_0x47a5('0x7c')][_0x47a5('0x7d')]})[_0x47a5('0x21')](function(_0x6bc37b){if(!_0x6bc37b[_0x47a5('0x2f')]){_0x2ae130=0x0;}else{_0x2ae130=_0x6bc37b[0x0][_0x47a5('0x1c')]||0x0;}return dbH['sequelize'][_0x47a5('0x2b')](_0x23c393[_0x47a5('0x7a')](),{'type':dbH[_0x47a5('0x7b')][_0x47a5('0x7c')]['SELECT']});})['then'](function(_0x3770ae){return{'rows':_0x3770ae||[],'count':_0x2ae130};});}});}exports['run']=function(_0x4cb8e4,_0x1b6a5c){return runReport(_0x4cb8e4[_0x47a5('0x4c')],_0x4cb8e4['query'],_0x4cb8e4[_0x47a5('0x38')])[_0x47a5('0x21')](respondWithResult(_0x1b6a5c,null))[_0x47a5('0x48')](handleError(_0x1b6a5c,null));};exports['runReport']=runReport;exports[_0x47a5('0x2b')]=function(_0xee23c7,_0x48a491){var _0x1172fd=0xa;var _0x280b7b=[_0x47a5('0x7e'),_0x47a5('0x7f'),_0x47a5('0x4d'),_0x47a5('0x4e')];var _0x482c87={'SUM':_0x47a5('0x4f'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x47a5('0x80'),'MAX':_0x47a5('0x81'),'MIN':_0x47a5('0x51'),'AVG':_0x47a5('0x52'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x47a5('0x54'),'GROUP_CONCAT DESC':_0x47a5('0x9b')};var _0x151540={'SEC_TO_TIME':_0x47a5('0x55'),'DATE':_0x47a5('0x56'),'HOUR':_0x47a5('0x82'),'ROUND':_0x47a5('0x57'),'UNIX_TIMESTAMP':_0x47a5('0x83')};var _0x1b3e82=function(_0xa2045c){return!_[_0x47a5('0x58')]([_0x47a5('0x59'),'IS\x20NOT\x20NULL',_0x47a5('0x84'),_0x47a5('0x5b')],_0xa2045c);};var _0x591bde=function(_0x55d955){if(!_0x55d955||!_0x55d955[_0x47a5('0x5c')][_0x47a5('0x2f')]){return'';}for(var _0x2ccf21='(',_0x2ff467=0x0;_0x2ff467<_0x55d955['rules'][_0x47a5('0x2f')];_0x2ff467+=0x1){_0x2ff467>0x0&&(_0x2ccf21+='\x20'+_0x55d955[_0x47a5('0x85')]+'\x20');_0x2ccf21+=_0x55d955[_0x47a5('0x5c')][_0x2ff467][_0x47a5('0x5d')]?_0x591bde(_0x55d955[_0x47a5('0x5c')][_0x2ff467][_0x47a5('0x5d')]):_0x55d955[_0x47a5('0x5c')][_0x2ff467]['field']+'\x20'+_0x55d955['rules'][_0x2ff467][_0x47a5('0x5e')]+(_0x1b3e82(_0x55d955['rules'][_0x2ff467][_0x47a5('0x5e')])?'\x20'+_0x55d955['rules'][_0x2ff467][_0x47a5('0x5f')]:'');}return _0x2ccf21+')';};var _0x8b4354={'where':{'id':_0xee23c7[_0x47a5('0x4c')]['id']}},_0x134c1a,_0x2bc7ae,_0x49cb8c,_0x220557,_0x11f07b;_0x8b4354=_['merge']({},_0x8b4354,_0xee23c7['options']);return db[_0x47a5('0x39')][_0x47a5('0x4b')](_0x8b4354)[_0x47a5('0x21')](function(_0xfccf9c){if(_0xfccf9c){_0x134c1a=_0xfccf9c;return _0xfccf9c[_0x47a5('0x9c')]();}return null;})[_0x47a5('0x21')](function(_0x1c0323){if(_0x1c0323){if(!_0x1c0323[_0x47a5('0x2f')]){throw new db['Sequelize'][(_0x47a5('0x61'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2bc7ae=_0x1c0323;return db[_0x47a5('0x63')][_0x47a5('0x64')]({'raw':!![]});}return null;})['then'](function(_0x48d4cf){if(_0x48d4cf){_0x49cb8c=_[_0x47a5('0x65')](_0x48d4cf,'id');var _0x41d2da;var _0x530387=squel[_0x47a5('0x66')]();_0x530387[_0x47a5('0x67')](_0x134c1a[_0x47a5('0x77')]);for(var _0x44567e=0x0;_0x44567e<_0x2bc7ae['length'];_0x44567e+=0x1){_0x41d2da=_0x2bc7ae[_0x44567e][_0x47a5('0x68')]?_0x49cb8c[_0x2bc7ae[_0x44567e]['MetricId']]['metric']:_0x2bc7ae[_0x44567e]['field'];_0x41d2da=_0x2bc7ae[_0x44567e][_0x47a5('0x6b')]?_['replace'](_0x482c87[_0x2bc7ae[_0x44567e][_0x47a5('0x6b')]],'%s',_0x41d2da):_0x41d2da;_0x41d2da=_0x2bc7ae[_0x44567e][_0x47a5('0x6d')]?_[_0x47a5('0x6c')](_0x151540[_0x2bc7ae[_0x44567e][_0x47a5('0x6d')]],'%s',_0x41d2da):_0x41d2da;if(_0x2bc7ae[_0x44567e][_0x47a5('0x86')]){_0x530387[_0x47a5('0x5d')](_0x41d2da);}_0x2bc7ae[_0x44567e][_0x47a5('0x6e')]&&_0x530387[_0x47a5('0x32')](_0x41d2da,_0x2bc7ae[_0x44567e][_0x47a5('0x6e')]===_0x47a5('0x6f')?![]:!![]);_0x530387[_0x47a5('0x6a')](_0x41d2da,_0x2bc7ae[_0x44567e][_0x47a5('0x87')]||_0x41d2da);}if(_0x134c1a[_0x47a5('0x70')]){_0x134c1a[_0x47a5('0x70')]=JSON[_0x47a5('0x71')](_0x134c1a['joins']);for(var _0xdd95c8=0x0;_0xdd95c8<_0x134c1a[_0x47a5('0x70')][_0x47a5('0x2f')];_0xdd95c8+=0x1){if(_0x134c1a[_0x47a5('0x70')][_0xdd95c8]['type']&&_[_0x47a5('0x58')](_0x280b7b,_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x72')])&&_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x73')]&&_0x134c1a[_0x47a5('0x70')][_0xdd95c8][_0x47a5('0x74')]&&_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x75')]){_0x530387[_0x134c1a[_0x47a5('0x70')][_0xdd95c8][_0x47a5('0x72')]](_0x134c1a['joins'][_0xdd95c8]['foreignTable'],null,util[_0x47a5('0x6d')](_0x47a5('0x76'),_0x134c1a[_0x47a5('0x77')],_0x134c1a[_0x47a5('0x70')][_0xdd95c8][_0x47a5('0x73')],_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x74')],_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x75')]));}}}if(_0x134c1a[_0x47a5('0x78')]){_0x134c1a[_0x47a5('0x78')]=JSON[_0x47a5('0x71')](_0x134c1a['conditions']);_0x530387['where'](_0x591bde(_0x134c1a[_0x47a5('0x78')][_0x47a5('0x5d')]));}_0x11f07b=_0x530387[_0x47a5('0x9d')]();_0x530387[_0x47a5('0x1b')](_0x1172fd);_0x530387[_0x47a5('0x1d')](0x0);logger[_0x47a5('0x79')](_0x47a5('0x9e'),_0x530387[_0x47a5('0x7a')]());return dbH[_0x47a5('0x7b')]['query'](_0x530387['toString'](),{'type':dbH[_0x47a5('0x7b')]['QueryTypes'][_0x47a5('0x7d')]});}})[_0x47a5('0x21')](function(){return{'sql':_0x11f07b[_0x47a5('0x7a')]()};})['then'](respondWithResult(_0x48a491,null))[_0x47a5('0x48')](handleError(_0x48a491,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 5097078..817cc6e 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 _0xeebc=['analytics_default_reports','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','AnalyticDefaultReport'];(function(_0x44bb10,_0x19d1ad){var _0x18f26a=function(_0x12b3be){while(--_0x12b3be){_0x44bb10['push'](_0x44bb10['shift']());}};_0x18f26a(++_0x19d1ad);}(_0xeebc,0x6d));var _0xceeb=function(_0xab9e34,_0x41c35f){_0xab9e34=_0xab9e34-0x0;var _0x2ed9e0=_0xeebc[_0xab9e34];return _0x2ed9e0;};'use strict';var _=require(_0xceeb('0x0'));var util=require(_0xceeb('0x1'));var logger=require('../../config/logger')(_0xceeb('0x2'));var moment=require(_0xceeb('0x3'));var BPromise=require(_0xceeb('0x4'));var rp=require(_0xceeb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xceeb('0x6'));var config=require(_0xceeb('0x7'));var attributes=require('./analyticDefaultReport.attributes');module[_0xceeb('0x8')]=function(_0x16bbe0,_0xe94df7){return _0x16bbe0[_0xceeb('0x9')](_0xceeb('0xa'),attributes,{'tableName':_0xceeb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeac7=['analytics_default_reports','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','define','AnalyticDefaultReport'];(function(_0x582737,_0x56cd7a){var _0x514b49=function(_0x404d40){while(--_0x404d40){_0x582737['push'](_0x582737['shift']());}};_0x514b49(++_0x56cd7a);}(_0xeac7,0x6d));var _0x7eac=function(_0x391634,_0x2ab03a){_0x391634=_0x391634-0x0;var _0x58a6f1=_0xeac7[_0x391634];return _0x58a6f1;};'use strict';var _=require(_0x7eac('0x0'));var util=require(_0x7eac('0x1'));var logger=require(_0x7eac('0x2'))('api');var moment=require(_0x7eac('0x3'));var BPromise=require('bluebird');var rp=require(_0x7eac('0x4'));var fs=require('fs');var path=require(_0x7eac('0x5'));var rimraf=require(_0x7eac('0x6'));var config=require(_0x7eac('0x7'));var attributes=require(_0x7eac('0x8'));module['exports']=function(_0x128b80,_0x1b3213){return _0x128b80[_0x7eac('0x9')](_0x7eac('0xa'),attributes,{'tableName':_0x7eac('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 473586a..f4dcded 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 _0xfe12=['jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xfe12,0x1d8));var _0x2fe1=function(_0x18df6a,_0x3938b6){_0x18df6a=_0x18df6a-0x0;var _0x3b154d=_0xfe12[_0x18df6a];return _0x3b154d;};'use strict';var _=require('lodash');var util=require(_0x2fe1('0x0'));var moment=require(_0x2fe1('0x1'));var BPromise=require(_0x2fe1('0x2'));var rs=require(_0x2fe1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2fe1('0x4'))['db'];var utils=require(_0x2fe1('0x5'));var logger=require(_0x2fe1('0x6'))(_0x2fe1('0x7'));var config=require('../../config/environment');var jayson=require(_0x2fe1('0x8'));var client=jayson[_0x2fe1('0x9')][_0x2fe1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x435082,_0x2ba712,_0x2cb8f7){return new BPromise(function(_0xcc445d,_0x56df09){return client[_0x2fe1('0xb')](_0x435082,_0x2cb8f7)[_0x2fe1('0xc')](function(_0x5e78b6){logger[_0x2fe1('0xd')](_0x2fe1('0xe'),_0x2ba712,_0x2fe1('0xf'));logger[_0x2fe1('0x10')](_0x2fe1('0x11'),_0x2ba712,_0x2fe1('0xf'),JSON[_0x2fe1('0x12')](_0x5e78b6));if(_0x5e78b6[_0x2fe1('0x13')]){if(_0x5e78b6[_0x2fe1('0x13')][_0x2fe1('0x14')]===0x1f4){logger[_0x2fe1('0x13')](_0x2fe1('0xe'),_0x2ba712,_0x5e78b6['error'][_0x2fe1('0x15')]);return _0x56df09(_0x5e78b6[_0x2fe1('0x13')][_0x2fe1('0x15')]);}logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x2ba712,_0x5e78b6[_0x2fe1('0x13')][_0x2fe1('0x15')]);return _0xcc445d(_0x5e78b6['error']['message']);}else{logger[_0x2fe1('0xd')](_0x2fe1('0xe'),_0x2ba712,'request\x20sent');_0xcc445d(_0x5e78b6[_0x2fe1('0x16')][_0x2fe1('0x15')]);}})[_0x2fe1('0x17')](function(_0x3672fb){logger[_0x2fe1('0x13')](_0x2fe1('0xe'),_0x2ba712,_0x3672fb);_0x56df09(_0x3672fb);});});} \ No newline at end of file +var _0x5e6d=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','lodash'];(function(_0x26b0c8,_0x43b8bc){var _0x15135b=function(_0x64c08){while(--_0x64c08){_0x26b0c8['push'](_0x26b0c8['shift']());}};_0x15135b(++_0x43b8bc);}(_0x5e6d,0x1a3));var _0xd5e6=function(_0x4ed520,_0x21be63){_0x4ed520=_0x4ed520-0x0;var _0x4415a6=_0x5e6d[_0x4ed520];return _0x4415a6;};'use strict';var _=require(_0xd5e6('0x0'));var util=require(_0xd5e6('0x1'));var moment=require(_0xd5e6('0x2'));var BPromise=require(_0xd5e6('0x3'));var rs=require(_0xd5e6('0x4'));var fs=require('fs');var Redis=require(_0xd5e6('0x5'));var db=require(_0xd5e6('0x6'))['db'];var utils=require(_0xd5e6('0x7'));var logger=require(_0xd5e6('0x8'))(_0xd5e6('0x9'));var config=require(_0xd5e6('0xa'));var jayson=require(_0xd5e6('0xb'));var client=jayson[_0xd5e6('0xc')][_0xd5e6('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2095c1,_0x42860b,_0x4ca4b9){return new BPromise(function(_0x3d1160,_0x32024f){return client['request'](_0x2095c1,_0x4ca4b9)['then'](function(_0x33b998){logger[_0xd5e6('0xe')](_0xd5e6('0xf'),_0x42860b,_0xd5e6('0x10'));logger[_0xd5e6('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x42860b,_0xd5e6('0x10'),JSON['stringify'](_0x33b998));if(_0x33b998[_0xd5e6('0x12')]){if(_0x33b998[_0xd5e6('0x12')]['code']===0x1f4){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x42860b,_0x33b998[_0xd5e6('0x12')]['message']);return _0x32024f(_0x33b998['error'][_0xd5e6('0x13')]);}logger[_0xd5e6('0x12')](_0xd5e6('0xf'),_0x42860b,_0x33b998[_0xd5e6('0x12')][_0xd5e6('0x13')]);return _0x3d1160(_0x33b998[_0xd5e6('0x12')][_0xd5e6('0x13')]);}else{logger['info'](_0xd5e6('0xf'),_0x42860b,'request\x20sent');_0x3d1160(_0x33b998['result'][_0xd5e6('0x13')]);}})[_0xd5e6('0x14')](function(_0x4a4699){logger[_0xd5e6('0x12')](_0xd5e6('0xf'),_0x42860b,_0x4a4699);_0x32024f(_0x4a4699);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index a1470f6..ab81644 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 _0x78e7=['run','/:id/query','query','create','update','delete','destroy','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run'];(function(_0x306368,_0x2fc5e4){var _0x294718=function(_0x4445ba){while(--_0x4445ba){_0x306368['push'](_0x306368['shift']());}};_0x294718(++_0x2fc5e4);}(_0x78e7,0x17d));var _0x778e=function(_0x5f20ae,_0x2463cf){_0x5f20ae=_0x5f20ae-0x0;var _0x314ecd=_0x78e7[_0x5f20ae];return _0x314ecd;};'use strict';var multer=require('multer');var util=require(_0x778e('0x0'));var path=require(_0x778e('0x1'));var timeout=require('connect-timeout');var express=require(_0x778e('0x2'));var router=express['Router']();var fs_extra=require(_0x778e('0x3'));var auth=require(_0x778e('0x4'));var interaction=require(_0x778e('0x5'));var config=require(_0x778e('0x6'));var controller=require('./analyticDefaultReport.controller');router[_0x778e('0x7')]('/',auth[_0x778e('0x8')](),controller[_0x778e('0x9')]);router[_0x778e('0x7')](_0x778e('0xa'),auth[_0x778e('0x8')](),controller[_0x778e('0xb')]);router['get'](_0x778e('0xc'),auth[_0x778e('0x8')](),controller[_0x778e('0xd')]);router[_0x778e('0x7')](_0x778e('0xe'),auth[_0x778e('0x8')](),controller[_0x778e('0xf')]);router[_0x778e('0x7')](_0x778e('0x10'),auth[_0x778e('0x8')](),controller[_0x778e('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x778e('0x12')]);router['put'](_0x778e('0xa'),auth['isAuthenticated'](),controller[_0x778e('0x13')]);router[_0x778e('0x14')](_0x778e('0xa'),auth['isAuthenticated'](),controller[_0x778e('0x15')]);module['exports']=router; \ No newline at end of file +var _0xbc71=['express','fs-extra','../../config/environment','./analyticDefaultReport.controller','get','index','/:id','isAuthenticated','/:id/run','run','/:id/query','post','put','update','delete','multer','path'];(function(_0x398527,_0x4867a5){var _0x310998=function(_0x5e9394){while(--_0x5e9394){_0x398527['push'](_0x398527['shift']());}};_0x310998(++_0x4867a5);}(_0xbc71,0x86));var _0x1bc7=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xbc71[_0x4709c0];return _0x13348b;};'use strict';var multer=require(_0x1bc7('0x0'));var util=require('util');var path=require(_0x1bc7('0x1'));var timeout=require('connect-timeout');var express=require(_0x1bc7('0x2'));var router=express['Router']();var fs_extra=require(_0x1bc7('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1bc7('0x4'));var controller=require(_0x1bc7('0x5'));router[_0x1bc7('0x6')]('/',auth['isAuthenticated'](),controller[_0x1bc7('0x7')]);router[_0x1bc7('0x6')](_0x1bc7('0x8'),auth[_0x1bc7('0x9')](),controller['show']);router[_0x1bc7('0x6')]('/:id/preview',auth[_0x1bc7('0x9')](),controller['preview']);router[_0x1bc7('0x6')](_0x1bc7('0xa'),auth['isAuthenticated'](),controller[_0x1bc7('0xb')]);router[_0x1bc7('0x6')](_0x1bc7('0xc'),auth[_0x1bc7('0x9')](),controller['query']);router[_0x1bc7('0xd')]('/',auth[_0x1bc7('0x9')](),controller['create']);router[_0x1bc7('0xe')](_0x1bc7('0x8'),auth[_0x1bc7('0x9')](),controller[_0x1bc7('0xf')]);router[_0x1bc7('0x10')]('/:id',auth[_0x1bc7('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index ecddd9f..37d5fe5 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 _0xf99e=['Loading','manual','scheduled','UNSIGNED','sequelize','moment','exports','ENUM','pdf','STRING','DATE'];(function(_0x5e67be,_0x271ac8){var _0x45c259=function(_0x5eb9d7){while(--_0x5eb9d7){_0x5e67be['push'](_0x5e67be['shift']());}};_0x45c259(++_0x271ac8);}(_0xf99e,0x67));var _0xef99=function(_0x307d2b,_0x3796e0){_0x307d2b=_0x307d2b-0x0;var _0xe82587=_0xf99e[_0x307d2b];return _0xe82587;};'use strict';var Sequelize=require(_0xef99('0x0'));var moment=require(_0xef99('0x1'));module[_0xef99('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0xef99('0x3')]('csv',_0xef99('0x4'),'xlsx'),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0xef99('0x5')],'allowNull':![]},'startDate':{'type':Sequelize[_0xef99('0x6')]},'endDate':{'type':Sequelize[_0xef99('0x6')]},'status':{'type':Sequelize[_0xef99('0x5')],'defaultValue':_0xef99('0x7')},'type':{'type':Sequelize[_0xef99('0x3')](_0xef99('0x8'),_0xef99('0x9')),'allowNull':![],'defaultValue':_0xef99('0x8')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0xef99('0xa')]},'reportType':{'type':Sequelize[_0xef99('0x5')]}}; \ No newline at end of file +var _0x017c=['xlsx','DATE','Loading','ENUM','manual','INTEGER','UNSIGNED','sequelize','moment','STRING','csv','pdf'];(function(_0x585d0b,_0x3a692a){var _0x25d2ec=function(_0x5412a0){while(--_0x5412a0){_0x585d0b['push'](_0x585d0b['shift']());}};_0x25d2ec(++_0x3a692a);}(_0x017c,0x127));var _0xc017=function(_0x113e32,_0x5339f0){_0x113e32=_0x113e32-0x0;var _0x4ff939=_0x017c[_0x113e32];return _0x4ff939;};'use strict';var Sequelize=require(_0xc017('0x0'));var moment=require(_0xc017('0x1'));module['exports']={'name':{'type':Sequelize[_0xc017('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0xc017('0x3'),_0xc017('0x4'),_0xc017('0x5')),'allowNull':![],'defaultValue':_0xc017('0x3')},'savename':{'type':Sequelize[_0xc017('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0xc017('0x6')]},'endDate':{'type':Sequelize[_0xc017('0x6')]},'status':{'type':Sequelize[_0xc017('0x2')],'defaultValue':_0xc017('0x7')},'type':{'type':Sequelize[_0xc017('0x8')]('manual','scheduled'),'allowNull':![],'defaultValue':_0xc017('0x9')},'reportId':{'type':Sequelize[_0xc017('0xa')](0xb)[_0xc017('0xb')]},'reportType':{'type':Sequelize[_0xc017('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 4a9eacb..313ae97 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 _0x4bd0=['../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','save','update','then','get','ExtractedReports','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','sort','pick','filter','merge','where','VIRTUAL','include','findAll','catch','show','params','keys','filters','includeAll','options','find','body','user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','existsSync','join','root','savename','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','server/files/reports','format','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x498791,_0x55101b){var _0x1a79ce=function(_0x4d2571){while(--_0x4d2571){_0x498791['push'](_0x498791['shift']());}};_0x1a79ce(++_0x55101b);}(_0x4bd0,0x172));var _0x04bd=function(_0x169a8a,_0x3526b1){_0x169a8a=_0x169a8a-0x0;var _0x2e8502=_0x4bd0[_0x169a8a];return _0x2e8502;};'use strict';var emlformat=require(_0x04bd('0x0'));var rimraf=require(_0x04bd('0x1'));var zipdir=require(_0x04bd('0x2'));var jsonpatch=require(_0x04bd('0x3'));var rp=require(_0x04bd('0x4'));var moment=require(_0x04bd('0x5'));var BPromise=require(_0x04bd('0x6'));var Mustache=require(_0x04bd('0x7'));var util=require(_0x04bd('0x8'));var path=require(_0x04bd('0x9'));var sox=require(_0x04bd('0xa'));var csv=require(_0x04bd('0xb'));var ejs=require(_0x04bd('0xc'));var fs=require('fs');var fs_extra=require(_0x04bd('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x04bd('0xe'));var jsforce=require(_0x04bd('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x04bd('0xb'));var querystring=require(_0x04bd('0x10'));var Papa=require(_0x04bd('0x11'));var Redis=require(_0x04bd('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x04bd('0x13'));var as=require(_0x04bd('0x14'));var hardwareService=require(_0x04bd('0x15'));var logger=require(_0x04bd('0x16'))(_0x04bd('0x17'));var utils=require('../../config/utils');var config=require(_0x04bd('0x18'));var licenseUtil=require(_0x04bd('0x19'));var db=require(_0x04bd('0x1a'))['db'];function respondWithStatusCode(_0x1e9140,_0x44e947){_0x44e947=_0x44e947||0xcc;return function(_0x425e70){if(_0x425e70){return _0x1e9140[_0x04bd('0x1b')](_0x44e947);}return _0x1e9140[_0x04bd('0x1c')](_0x44e947)[_0x04bd('0x1d')]();};}function respondWithResult(_0x4c05da,_0x189d1f){_0x189d1f=_0x189d1f||0xc8;return function(_0x2bfe5f){if(_0x2bfe5f){return _0x4c05da[_0x04bd('0x1c')](_0x189d1f)[_0x04bd('0x1e')](_0x2bfe5f);}};}function respondWithFilteredResult(_0x364687,_0x2fd626){return function(_0x5df0da){if(_0x5df0da){var _0x466a54=typeof _0x2fd626[_0x04bd('0x1f')]===_0x04bd('0x20')&&typeof _0x2fd626[_0x04bd('0x21')]==='undefined';var _0x394125=_0x5df0da[_0x04bd('0x22')];var _0x3e0bd3=_0x466a54?0x0:_0x2fd626[_0x04bd('0x1f')];var _0x4bc328=_0x466a54?_0x5df0da[_0x04bd('0x22')]:_0x2fd626['offset']+_0x2fd626[_0x04bd('0x21')];var _0x4b987e;if(_0x4bc328>=_0x394125){_0x4bc328=_0x394125;_0x4b987e=0xc8;}else{_0x4b987e=0xce;}_0x364687['status'](_0x4b987e);return _0x364687[_0x04bd('0x23')]('Content-Range',_0x3e0bd3+'-'+_0x4bc328+'/'+_0x394125)[_0x04bd('0x1e')](_0x5df0da);}return null;};}function patchUpdates(_0x63f762){return function(_0x16d191){try{jsonpatch['apply'](_0x16d191,_0x63f762,!![]);}catch(_0xac435e){return BPromise['reject'](_0xac435e);}return _0x16d191[_0x04bd('0x24')]();};}function saveUpdates(_0x19f8c0,_0x41749b){return function(_0x5a82a7){if(_0x5a82a7){return _0x5a82a7[_0x04bd('0x25')](_0x19f8c0)[_0x04bd('0x26')](function(_0x53938d){return _0x53938d;});}return null;};}function removeEntity(_0x1b13ea,_0x160f66){return function(_0x30fdc9){if(_0x30fdc9){return _0x30fdc9['destroy']()[_0x04bd('0x26')](function(){var _0xaca9e6=_0x30fdc9[_0x04bd('0x27')]({'plain':!![]});var _0x4f77ce=_0x04bd('0x28');return db[_0x04bd('0x29')][_0x04bd('0x2a')]({'where':{'type':_0x4f77ce,'resourceId':_0xaca9e6['id']}})[_0x04bd('0x26')](function(){return _0x30fdc9;});})[_0x04bd('0x26')](function(){_0x1b13ea[_0x04bd('0x1c')](0xcc)[_0x04bd('0x1d')]();});}};}function handleEntityNotFound(_0x5491b5,_0x40e3df){return function(_0x4dea72){if(!_0x4dea72){_0x5491b5[_0x04bd('0x1b')](0x194);}return _0x4dea72;};}function handleError(_0xbb5381,_0x53e7c0){_0x53e7c0=_0x53e7c0||0x1f4;return function(_0x2a8c75){logger[_0x04bd('0x2b')](_0x2a8c75[_0x04bd('0x2c')]);if(_0x2a8c75[_0x04bd('0x2d')]){delete _0x2a8c75[_0x04bd('0x2d')];}_0xbb5381['status'](_0x53e7c0)[_0x04bd('0x2e')](_0x2a8c75);};}exports[_0x04bd('0x2f')]=function(_0x20a4ff,_0x546029){var _0x43de2f={},_0x1888e8={},_0xe2c9c={'count':0x0,'rows':[]};var _0xa741dd=_[_0x04bd('0x30')](db[_0x04bd('0x31')][_0x04bd('0x32')],function(_0x5fcc6d){return{'name':_0x5fcc6d[_0x04bd('0x33')],'type':_0x5fcc6d[_0x04bd('0x34')][_0x04bd('0x35')]};});_0x1888e8[_0x04bd('0x36')]=_[_0x04bd('0x30')](_0xa741dd,_0x04bd('0x2d'));_0x1888e8[_0x04bd('0x37')]=_['keys'](_0x20a4ff[_0x04bd('0x37')]);_0x1888e8['filters']=_[_0x04bd('0x38')](_0x1888e8[_0x04bd('0x36')],_0x1888e8[_0x04bd('0x37')]);_0x43de2f['attributes']=_[_0x04bd('0x38')](_0x1888e8[_0x04bd('0x36')],qs['fields'](_0x20a4ff[_0x04bd('0x37')][_0x04bd('0x39')]));_0x43de2f[_0x04bd('0x3a')]=_0x43de2f[_0x04bd('0x3a')][_0x04bd('0x3b')]?_0x43de2f[_0x04bd('0x3a')]:_0x1888e8['model'];if(!_0x20a4ff[_0x04bd('0x37')]['hasOwnProperty'](_0x04bd('0x3c'))){_0x43de2f[_0x04bd('0x21')]=qs[_0x04bd('0x21')](_0x20a4ff[_0x04bd('0x37')]['limit']);_0x43de2f['offset']=qs['offset'](_0x20a4ff['query'][_0x04bd('0x1f')]);}_0x43de2f['order']=qs[_0x04bd('0x3d')](_0x20a4ff[_0x04bd('0x37')][_0x04bd('0x3d')]);_0x43de2f['where']=qs['filters'](_[_0x04bd('0x3e')](_0x20a4ff[_0x04bd('0x37')],_0x1888e8['filters']),_0xa741dd);if(_0x20a4ff['query'][_0x04bd('0x3f')]){_0x43de2f['where']=_[_0x04bd('0x40')](_0x43de2f[_0x04bd('0x41')],{'$or':_[_0x04bd('0x30')](_0xa741dd,function(_0x2e352a){if(_0x2e352a[_0x04bd('0x34')]!==_0x04bd('0x42')){var _0x141bca={};_0x141bca[_0x2e352a[_0x04bd('0x2d')]]={'$like':'%'+_0x20a4ff[_0x04bd('0x37')][_0x04bd('0x3f')]+'%'};return _0x141bca;}})});}_0x43de2f=_[_0x04bd('0x40')]({},_0x43de2f,_0x20a4ff['options']);var _0x38b2eb={'where':_0x43de2f[_0x04bd('0x41')]};return db[_0x04bd('0x31')][_0x04bd('0x22')](_0x38b2eb)['then'](function(_0x180e19){_0xe2c9c[_0x04bd('0x22')]=_0x180e19;if(_0x20a4ff[_0x04bd('0x37')]['includeAll']){_0x43de2f[_0x04bd('0x43')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x04bd('0x44')](_0x43de2f);})['then'](function(_0x47ac59){_0xe2c9c['rows']=_0x47ac59;return _0xe2c9c;})[_0x04bd('0x26')](respondWithFilteredResult(_0x546029,_0x43de2f))[_0x04bd('0x45')](handleError(_0x546029,null));};exports[_0x04bd('0x46')]=function(_0x40a2b9,_0x133b7b){var _0x4b4104={'raw':!![],'where':{'id':_0x40a2b9[_0x04bd('0x47')]['id']}},_0x154875={};_0x154875['model']=_[_0x04bd('0x48')](db['AnalyticExtractedReport']['rawAttributes']);_0x154875[_0x04bd('0x37')]=_[_0x04bd('0x48')](_0x40a2b9[_0x04bd('0x37')]);_0x154875[_0x04bd('0x49')]=_[_0x04bd('0x38')](_0x154875[_0x04bd('0x36')],_0x154875['query']);_0x4b4104['attributes']=_[_0x04bd('0x38')](_0x154875[_0x04bd('0x36')],qs[_0x04bd('0x39')](_0x40a2b9[_0x04bd('0x37')]['fields']));_0x4b4104[_0x04bd('0x3a')]=_0x4b4104[_0x04bd('0x3a')][_0x04bd('0x3b')]?_0x4b4104[_0x04bd('0x3a')]:_0x154875[_0x04bd('0x36')];if(_0x40a2b9['query'][_0x04bd('0x4a')]){_0x4b4104['include']=[{'all':!![]}];}_0x4b4104=_[_0x04bd('0x40')]({},_0x4b4104,_0x40a2b9[_0x04bd('0x4b')]);return db[_0x04bd('0x31')][_0x04bd('0x4c')](_0x4b4104)[_0x04bd('0x26')](handleEntityNotFound(_0x133b7b,null))['then'](respondWithResult(_0x133b7b,null))[_0x04bd('0x45')](handleError(_0x133b7b,null));};exports['create']=function(_0x32f673,_0x11e3f7){return db['AnalyticExtractedReport']['create'](_0x32f673[_0x04bd('0x4d')],{})[_0x04bd('0x26')](function(_0x177ee9){var _0x2a93b7=_0x32f673[_0x04bd('0x4e')][_0x04bd('0x27')]({'plain':!![]});if(!_0x2a93b7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2a93b7[_0x04bd('0x4f')]===_0x04bd('0x4e')){var _0x171a51=_0x177ee9[_0x04bd('0x27')]({'plain':!![]});var _0x4def66='ExtractedReports';return db[_0x04bd('0x50')][_0x04bd('0x4c')]({'where':{'name':_0x4def66,'userProfileId':_0x2a93b7[_0x04bd('0x51')]},'raw':!![]})[_0x04bd('0x26')](function(_0x126cfd){if(_0x126cfd&&_0x126cfd[_0x04bd('0x52')]===0x0){return db[_0x04bd('0x29')][_0x04bd('0x53')]({'name':_0x171a51[_0x04bd('0x2d')],'resourceId':_0x171a51['id'],'type':_0x126cfd[_0x04bd('0x2d')],'sectionId':_0x126cfd['id']},{})[_0x04bd('0x26')](function(){return _0x177ee9;});}else{return _0x177ee9;}})[_0x04bd('0x45')](function(_0x409d53){logger[_0x04bd('0x2b')](_0x04bd('0x54'),_0x409d53);throw _0x409d53;});}return _0x177ee9;})['then'](respondWithResult(_0x11e3f7,0xc9))['catch'](handleError(_0x11e3f7,null));};exports[_0x04bd('0x25')]=function(_0x43390a,_0x20a134){if(_0x43390a[_0x04bd('0x4d')]['id']){delete _0x43390a[_0x04bd('0x4d')]['id'];}return db[_0x04bd('0x31')][_0x04bd('0x4c')]({'where':{'id':_0x43390a['params']['id']}})[_0x04bd('0x26')](handleEntityNotFound(_0x20a134,null))[_0x04bd('0x26')](saveUpdates(_0x43390a[_0x04bd('0x4d')],null))['then'](respondWithResult(_0x20a134,null))[_0x04bd('0x45')](handleError(_0x20a134,null));};exports[_0x04bd('0x2a')]=function(_0x5b8a19,_0x57edb6){return db[_0x04bd('0x31')][_0x04bd('0x4c')]({'where':{'id':_0x5b8a19[_0x04bd('0x47')]['id']}})[_0x04bd('0x26')](handleEntityNotFound(_0x57edb6,null))[_0x04bd('0x26')](removeEntity(_0x57edb6,null))[_0x04bd('0x45')](handleError(_0x57edb6,null));};exports[_0x04bd('0x55')]=function(_0x3ee8b5,_0x2b061e,_0x1d3ad4){return db[_0x04bd('0x31')][_0x04bd('0x4c')]({'where':{'id':_0x3ee8b5[_0x04bd('0x47')]['id']},'attributes':[_0x04bd('0x2d'),_0x04bd('0x56'),'savename','output'],'raw':!![]})[_0x04bd('0x26')](handleEntityNotFound(_0x2b061e,null))[_0x04bd('0x26')](function(_0x17e54d){if(_0x17e54d){if(!fs[_0x04bd('0x57')](path[_0x04bd('0x58')](config[_0x04bd('0x59')],'server/files/reports',_0x17e54d[_0x04bd('0x5a')]))){throw new db['Sequelize'][(_0x04bd('0x5b'))](_0x04bd('0x5c'));}if(_0x3ee8b5[_0x04bd('0x37')][_0x04bd('0x5d')]){return _0x2b061e[_0x04bd('0x1b')](0xc8);}return _0x2b061e['download'](path[_0x04bd('0x58')](config[_0x04bd('0x59')],_0x04bd('0x5e'),_0x17e54d[_0x04bd('0x5a')]),util[_0x04bd('0x5f')](_0x04bd('0x60'),_0x17e54d[_0x04bd('0x56')]||_0x17e54d[_0x04bd('0x2d')],_0x17e54d['output'][_0x04bd('0x61')]()));}})['catch'](handleError(_0x2b061e,null));}; \ No newline at end of file +var _0x632e=['include','rows','catch','params','keys','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','ExtractedReports','UserProfileSection','userProfileId','error','update','download','savename','output','existsSync','join','root','server/files/reports','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','basename','toLowerCase','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','end','sendStatus','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','pick','where','merge','VIRTUAL','filter','includeAll'];(function(_0x576fad,_0x42b670){var _0xf6604e=function(_0x479463){while(--_0x479463){_0x576fad['push'](_0x576fad['shift']());}};_0xf6604e(++_0x42b670);}(_0x632e,0x142));var _0xe632=function(_0x369534,_0x5557c4){_0x369534=_0x369534-0x0;var _0x524bf9=_0x632e[_0x369534];return _0x524bf9;};'use strict';var emlformat=require(_0xe632('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe632('0x1'));var jsonpatch=require(_0xe632('0x2'));var rp=require('request-promise');var moment=require(_0xe632('0x3'));var BPromise=require(_0xe632('0x4'));var Mustache=require(_0xe632('0x5'));var util=require(_0xe632('0x6'));var path=require(_0xe632('0x7'));var sox=require(_0xe632('0x8'));var csv=require(_0xe632('0x9'));var ejs=require(_0xe632('0xa'));var fs=require('fs');var fs_extra=require(_0xe632('0xb'));var _=require('lodash');var squel=require(_0xe632('0xc'));var crypto=require(_0xe632('0xd'));var jsforce=require(_0xe632('0xe'));var deskjs=require(_0xe632('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe632('0x10'));var Papa=require(_0xe632('0x11'));var Redis=require(_0xe632('0x12'));var authService=require(_0xe632('0x13'));var qs=require(_0xe632('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe632('0x15'));var logger=require(_0xe632('0x16'))(_0xe632('0x17'));var utils=require(_0xe632('0x18'));var config=require(_0xe632('0x19'));var licenseUtil=require(_0xe632('0x1a'));var db=require(_0xe632('0x1b'))['db'];function respondWithStatusCode(_0x4a643d,_0x462a8d){_0x462a8d=_0x462a8d||0xcc;return function(_0x1f4ed4){if(_0x1f4ed4){return _0x4a643d['sendStatus'](_0x462a8d);}return _0x4a643d[_0xe632('0x1c')](_0x462a8d)['end']();};}function respondWithResult(_0x510ad4,_0x33fe9a){_0x33fe9a=_0x33fe9a||0xc8;return function(_0x50307b){if(_0x50307b){return _0x510ad4[_0xe632('0x1c')](_0x33fe9a)[_0xe632('0x1d')](_0x50307b);}};}function respondWithFilteredResult(_0x14736f,_0x928715){return function(_0x301320){if(_0x301320){var _0x435071=typeof _0x928715[_0xe632('0x1e')]===_0xe632('0x1f')&&typeof _0x928715[_0xe632('0x20')]===_0xe632('0x1f');var _0x5888fe=_0x301320[_0xe632('0x21')];var _0x15a281=_0x435071?0x0:_0x928715[_0xe632('0x1e')];var _0x2cceb2=_0x435071?_0x301320[_0xe632('0x21')]:_0x928715[_0xe632('0x1e')]+_0x928715[_0xe632('0x20')];var _0x57eebc;if(_0x2cceb2>=_0x5888fe){_0x2cceb2=_0x5888fe;_0x57eebc=0xc8;}else{_0x57eebc=0xce;}_0x14736f['status'](_0x57eebc);return _0x14736f[_0xe632('0x22')](_0xe632('0x23'),_0x15a281+'-'+_0x2cceb2+'/'+_0x5888fe)['json'](_0x301320);}return null;};}function patchUpdates(_0x4426f0){return function(_0x350f72){try{jsonpatch[_0xe632('0x24')](_0x350f72,_0x4426f0,!![]);}catch(_0xd44823){return BPromise['reject'](_0xd44823);}return _0x350f72[_0xe632('0x25')]();};}function saveUpdates(_0x1b70af,_0xfbdcc6){return function(_0x1df51c){if(_0x1df51c){return _0x1df51c['update'](_0x1b70af)[_0xe632('0x26')](function(_0x4956bf){return _0x4956bf;});}return null;};}function removeEntity(_0x9da700,_0x545251){return function(_0x2122e7){if(_0x2122e7){return _0x2122e7[_0xe632('0x27')]()[_0xe632('0x26')](function(){var _0x524219=_0x2122e7['get']({'plain':!![]});var _0x277b60='ExtractedReports';return db['UserProfileResource'][_0xe632('0x27')]({'where':{'type':_0x277b60,'resourceId':_0x524219['id']}})['then'](function(){return _0x2122e7;});})['then'](function(){_0x9da700['status'](0xcc)[_0xe632('0x28')]();});}};}function handleEntityNotFound(_0xb971af,_0x289cac){return function(_0x2e75fa){if(!_0x2e75fa){_0xb971af[_0xe632('0x29')](0x194);}return _0x2e75fa;};}function handleError(_0x4059cd,_0x5a2996){_0x5a2996=_0x5a2996||0x1f4;return function(_0x1555e7){logger['error'](_0x1555e7[_0xe632('0x2a')]);if(_0x1555e7['name']){delete _0x1555e7[_0xe632('0x2b')];}_0x4059cd[_0xe632('0x1c')](_0x5a2996)[_0xe632('0x2c')](_0x1555e7);};}exports[_0xe632('0x2d')]=function(_0x2d2d53,_0x4e4380){var _0x423c49={},_0x545763={},_0x2d5e71={'count':0x0,'rows':[]};var _0x59ab2d=_[_0xe632('0x2e')](db[_0xe632('0x2f')][_0xe632('0x30')],function(_0x41d206){return{'name':_0x41d206['fieldName'],'type':_0x41d206[_0xe632('0x31')][_0xe632('0x32')]};});_0x545763[_0xe632('0x33')]=_[_0xe632('0x2e')](_0x59ab2d,_0xe632('0x2b'));_0x545763[_0xe632('0x34')]=_['keys'](_0x2d2d53[_0xe632('0x34')]);_0x545763[_0xe632('0x35')]=_[_0xe632('0x36')](_0x545763[_0xe632('0x33')],_0x545763[_0xe632('0x34')]);_0x423c49[_0xe632('0x37')]=_[_0xe632('0x36')](_0x545763[_0xe632('0x33')],qs[_0xe632('0x38')](_0x2d2d53[_0xe632('0x34')][_0xe632('0x38')]));_0x423c49[_0xe632('0x37')]=_0x423c49[_0xe632('0x37')][_0xe632('0x39')]?_0x423c49['attributes']:_0x545763[_0xe632('0x33')];if(!_0x2d2d53[_0xe632('0x34')]['hasOwnProperty'](_0xe632('0x3a'))){_0x423c49[_0xe632('0x20')]=qs['limit'](_0x2d2d53[_0xe632('0x34')]['limit']);_0x423c49[_0xe632('0x1e')]=qs['offset'](_0x2d2d53[_0xe632('0x34')][_0xe632('0x1e')]);}_0x423c49['order']=qs[_0xe632('0x3b')](_0x2d2d53[_0xe632('0x34')][_0xe632('0x3b')]);_0x423c49['where']=qs[_0xe632('0x35')](_[_0xe632('0x3c')](_0x2d2d53[_0xe632('0x34')],_0x545763[_0xe632('0x35')]),_0x59ab2d);if(_0x2d2d53[_0xe632('0x34')]['filter']){_0x423c49[_0xe632('0x3d')]=_[_0xe632('0x3e')](_0x423c49[_0xe632('0x3d')],{'$or':_['map'](_0x59ab2d,function(_0x570a47){if(_0x570a47[_0xe632('0x31')]!==_0xe632('0x3f')){var _0x57b687={};_0x57b687[_0x570a47['name']]={'$like':'%'+_0x2d2d53[_0xe632('0x34')][_0xe632('0x40')]+'%'};return _0x57b687;}})});}_0x423c49=_['merge']({},_0x423c49,_0x2d2d53['options']);var _0x50e9f1={'where':_0x423c49['where']};return db[_0xe632('0x2f')][_0xe632('0x21')](_0x50e9f1)[_0xe632('0x26')](function(_0x87e0bb){_0x2d5e71['count']=_0x87e0bb;if(_0x2d2d53[_0xe632('0x34')][_0xe632('0x41')]){_0x423c49[_0xe632('0x42')]=[{'all':!![]}];}return db[_0xe632('0x2f')]['findAll'](_0x423c49);})[_0xe632('0x26')](function(_0x5bc67f){_0x2d5e71[_0xe632('0x43')]=_0x5bc67f;return _0x2d5e71;})[_0xe632('0x26')](respondWithFilteredResult(_0x4e4380,_0x423c49))[_0xe632('0x44')](handleError(_0x4e4380,null));};exports['show']=function(_0x1bf386,_0x3a43a8){var _0x364be4={'raw':!![],'where':{'id':_0x1bf386[_0xe632('0x45')]['id']}},_0x390bf0={};_0x390bf0[_0xe632('0x33')]=_[_0xe632('0x46')](db[_0xe632('0x2f')]['rawAttributes']);_0x390bf0['query']=_[_0xe632('0x46')](_0x1bf386[_0xe632('0x34')]);_0x390bf0[_0xe632('0x35')]=_[_0xe632('0x36')](_0x390bf0['model'],_0x390bf0[_0xe632('0x34')]);_0x364be4[_0xe632('0x37')]=_['intersection'](_0x390bf0[_0xe632('0x33')],qs[_0xe632('0x38')](_0x1bf386['query'][_0xe632('0x38')]));_0x364be4[_0xe632('0x37')]=_0x364be4[_0xe632('0x37')][_0xe632('0x39')]?_0x364be4[_0xe632('0x37')]:_0x390bf0[_0xe632('0x33')];if(_0x1bf386[_0xe632('0x34')][_0xe632('0x41')]){_0x364be4['include']=[{'all':!![]}];}_0x364be4=_[_0xe632('0x3e')]({},_0x364be4,_0x1bf386[_0xe632('0x47')]);return db['AnalyticExtractedReport'][_0xe632('0x48')](_0x364be4)[_0xe632('0x26')](handleEntityNotFound(_0x3a43a8,null))[_0xe632('0x26')](respondWithResult(_0x3a43a8,null))[_0xe632('0x44')](handleError(_0x3a43a8,null));};exports[_0xe632('0x49')]=function(_0x5134ca,_0x19e725){return db[_0xe632('0x2f')]['create'](_0x5134ca[_0xe632('0x4a')],{})['then'](function(_0x37b652){var _0x27041a=_0x5134ca['user']['get']({'plain':!![]});if(!_0x27041a)throw new Error(_0xe632('0x4b'));if(_0x27041a[_0xe632('0x4c')]==='user'){var _0x14d734=_0x37b652[_0xe632('0x4d')]({'plain':!![]});var _0x43be2f=_0xe632('0x4e');return db[_0xe632('0x4f')][_0xe632('0x48')]({'where':{'name':_0x43be2f,'userProfileId':_0x27041a[_0xe632('0x50')]},'raw':!![]})[_0xe632('0x26')](function(_0x1bd78d){if(_0x1bd78d&&_0x1bd78d['autoAssociation']===0x0){return db['UserProfileResource'][_0xe632('0x49')]({'name':_0x14d734[_0xe632('0x2b')],'resourceId':_0x14d734['id'],'type':_0x1bd78d[_0xe632('0x2b')],'sectionId':_0x1bd78d['id']},{})[_0xe632('0x26')](function(){return _0x37b652;});}else{return _0x37b652;}})['catch'](function(_0x122901){logger[_0xe632('0x51')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x122901);throw _0x122901;});}return _0x37b652;})[_0xe632('0x26')](respondWithResult(_0x19e725,0xc9))[_0xe632('0x44')](handleError(_0x19e725,null));};exports[_0xe632('0x52')]=function(_0x58a4cd,_0x16a160){if(_0x58a4cd[_0xe632('0x4a')]['id']){delete _0x58a4cd[_0xe632('0x4a')]['id'];}return db[_0xe632('0x2f')]['find']({'where':{'id':_0x58a4cd['params']['id']}})['then'](handleEntityNotFound(_0x16a160,null))[_0xe632('0x26')](saveUpdates(_0x58a4cd['body'],null))[_0xe632('0x26')](respondWithResult(_0x16a160,null))[_0xe632('0x44')](handleError(_0x16a160,null));};exports[_0xe632('0x27')]=function(_0x2ccfa0,_0x13bb6c){return db['AnalyticExtractedReport'][_0xe632('0x48')]({'where':{'id':_0x2ccfa0[_0xe632('0x45')]['id']}})[_0xe632('0x26')](handleEntityNotFound(_0x13bb6c,null))[_0xe632('0x26')](removeEntity(_0x13bb6c,null))[_0xe632('0x44')](handleError(_0x13bb6c,null));};exports[_0xe632('0x53')]=function(_0xe4496f,_0x3549d4,_0x7eb6fd){return db[_0xe632('0x2f')][_0xe632('0x48')]({'where':{'id':_0xe4496f['params']['id']},'attributes':[_0xe632('0x2b'),'basename',_0xe632('0x54'),_0xe632('0x55')],'raw':!![]})[_0xe632('0x26')](handleEntityNotFound(_0x3549d4,null))[_0xe632('0x26')](function(_0x4c9110){if(_0x4c9110){if(!fs[_0xe632('0x56')](path[_0xe632('0x57')](config[_0xe632('0x58')],_0xe632('0x59'),_0x4c9110['savename']))){throw new db[(_0xe632('0x5a'))]['ValidationError'](_0xe632('0x5b'));}if(_0xe4496f[_0xe632('0x34')][_0xe632('0x5c')]){return _0x3549d4[_0xe632('0x29')](0xc8);}return _0x3549d4[_0xe632('0x53')](path[_0xe632('0x57')](config[_0xe632('0x58')],_0xe632('0x59'),_0x4c9110[_0xe632('0x54')]),util[_0xe632('0x5d')](_0xe632('0x5e'),_0x4c9110[_0xe632('0x5f')]||_0x4c9110['name'],_0x4c9110[_0xe632('0x55')][_0xe632('0x60')]()));}})['catch'](handleError(_0x3549d4,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 5a396bd..3c74c3e 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 _0x7840=['exports','analytics_extracted_reports','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment'];(function(_0x17a754,_0x5f1052){var _0x545d3e=function(_0x24ec39){while(--_0x24ec39){_0x17a754['push'](_0x17a754['shift']());}};_0x545d3e(++_0x5f1052);}(_0x7840,0xb6));var _0x0784=function(_0x598596,_0x3cec09){_0x598596=_0x598596-0x0;var _0x509ff1=_0x7840[_0x598596];return _0x509ff1;};'use strict';var _=require(_0x0784('0x0'));var util=require(_0x0784('0x1'));var logger=require(_0x0784('0x2'))('api');var moment=require(_0x0784('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0784('0x4'));var rimraf=require(_0x0784('0x5'));var config=require(_0x0784('0x6'));var attributes=require('./analyticExtractedReport.attributes');module[_0x0784('0x7')]=function(_0x2ab8c5,_0x5e947b){return _0x2ab8c5['define']('AnalyticExtractedReport',attributes,{'tableName':_0x0784('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5d2f=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','AnalyticExtractedReport','analytics_extracted_reports'];(function(_0x229128,_0x273558){var _0x1875b9=function(_0x275e35){while(--_0x275e35){_0x229128['push'](_0x229128['shift']());}};_0x1875b9(++_0x273558);}(_0x5d2f,0x168));var _0xf5d2=function(_0x5e9d1f,_0x37c578){_0x5e9d1f=_0x5e9d1f-0x0;var _0x895bea=_0x5d2f[_0x5e9d1f];return _0x895bea;};'use strict';var _=require(_0xf5d2('0x0'));var util=require(_0xf5d2('0x1'));var logger=require(_0xf5d2('0x2'))(_0xf5d2('0x3'));var moment=require(_0xf5d2('0x4'));var BPromise=require(_0xf5d2('0x5'));var rp=require(_0xf5d2('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf5d2('0x7'));var config=require(_0xf5d2('0x8'));var attributes=require('./analyticExtractedReport.attributes');module[_0xf5d2('0x9')]=function(_0x5ab8b5,_0x22c1f9){return _0x5ab8b5['define'](_0xf5d2('0xa'),attributes,{'tableName':_0xf5d2('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 9c7b45b..769f3e8 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 _0x463e=['client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x463e,0x87));var _0xe463=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x463e[_0x2a6809];return _0x11c371;};'use strict';var _=require(_0xe463('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe463('0x1'));var rs=require(_0xe463('0x2'));var fs=require('fs');var Redis=require(_0xe463('0x3'));var db=require(_0xe463('0x4'))['db'];var utils=require(_0xe463('0x5'));var logger=require(_0xe463('0x6'))(_0xe463('0x7'));var config=require(_0xe463('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe463('0x9')][_0xe463('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37cc01,_0x455477,_0x1f2e5b){return new BPromise(function(_0x34e71e,_0x38a66d){return client[_0xe463('0xb')](_0x37cc01,_0x1f2e5b)[_0xe463('0xc')](function(_0x5d7f3d){logger[_0xe463('0xd')](_0xe463('0xe'),_0x455477,_0xe463('0xf'));logger[_0xe463('0x10')](_0xe463('0x11'),_0x455477,_0xe463('0xf'),JSON[_0xe463('0x12')](_0x5d7f3d));if(_0x5d7f3d['error']){if(_0x5d7f3d[_0xe463('0x13')][_0xe463('0x14')]===0x1f4){logger[_0xe463('0x13')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x455477,_0x5d7f3d[_0xe463('0x13')]['message']);return _0x38a66d(_0x5d7f3d[_0xe463('0x13')]['message']);}logger[_0xe463('0x13')](_0xe463('0xe'),_0x455477,_0x5d7f3d[_0xe463('0x13')][_0xe463('0x15')]);return _0x34e71e(_0x5d7f3d[_0xe463('0x13')][_0xe463('0x15')]);}else{logger[_0xe463('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x455477,_0xe463('0xf'));_0x34e71e(_0x5d7f3d[_0xe463('0x16')]['message']);}})[_0xe463('0x17')](function(_0x1eaa50){logger[_0xe463('0x13')](_0xe463('0xe'),_0x455477,_0x1eaa50);_0x38a66d(_0x1eaa50);});});} \ No newline at end of file +var _0x55af=['info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then'];(function(_0x5a3a81,_0x5e862f){var _0x59f7fa=function(_0x445a70){while(--_0x445a70){_0x5a3a81['push'](_0x5a3a81['shift']());}};_0x59f7fa(++_0x5e862f);}(_0x55af,0x1ab));var _0xf55a=function(_0x592239,_0x582549){_0x592239=_0x592239-0x0;var _0x434b8c=_0x55af[_0x592239];return _0x434b8c;};'use strict';var _=require(_0xf55a('0x0'));var util=require(_0xf55a('0x1'));var moment=require(_0xf55a('0x2'));var BPromise=require(_0xf55a('0x3'));var rs=require(_0xf55a('0x4'));var fs=require('fs');var Redis=require(_0xf55a('0x5'));var db=require(_0xf55a('0x6'))['db'];var utils=require(_0xf55a('0x7'));var logger=require(_0xf55a('0x8'))(_0xf55a('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf55a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe7e23d,_0x997482,_0x2f9d8e){return new BPromise(function(_0x295293,_0x306f2e){return client[_0xf55a('0xb')](_0xe7e23d,_0x2f9d8e)[_0xf55a('0xc')](function(_0x41a041){logger[_0xf55a('0xd')](_0xf55a('0xe'),_0x997482,_0xf55a('0xf'));logger[_0xf55a('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x997482,_0xf55a('0xf'),JSON['stringify'](_0x41a041));if(_0x41a041[_0xf55a('0x11')]){if(_0x41a041[_0xf55a('0x11')][_0xf55a('0x12')]===0x1f4){logger[_0xf55a('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x997482,_0x41a041[_0xf55a('0x11')][_0xf55a('0x13')]);return _0x306f2e(_0x41a041[_0xf55a('0x11')][_0xf55a('0x13')]);}logger['error'](_0xf55a('0xe'),_0x997482,_0x41a041[_0xf55a('0x11')][_0xf55a('0x13')]);return _0x295293(_0x41a041[_0xf55a('0x11')][_0xf55a('0x13')]);}else{logger['info'](_0xf55a('0xe'),_0x997482,_0xf55a('0xf'));_0x295293(_0x41a041[_0xf55a('0x14')][_0xf55a('0x13')]);}})[_0xf55a('0x15')](function(_0x18aa9b){logger[_0xf55a('0x11')](_0xf55a('0xe'),_0x997482,_0x18aa9b);_0x306f2e(_0x18aa9b);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 065b3e7..0629347 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 _0x4283=['isAuthenticated','index','/:id','show','/:id/download','post','create','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4283,0x131));var _0x3428=function(_0x533c6f,_0x338d51){_0x533c6f=_0x533c6f-0x0;var _0x4f3926=_0x4283[_0x533c6f];return _0x4f3926;};'use strict';var multer=require('multer');var util=require(_0x3428('0x0'));var path=require(_0x3428('0x1'));var timeout=require(_0x3428('0x2'));var express=require(_0x3428('0x3'));var router=express['Router']();var fs_extra=require(_0x3428('0x4'));var auth=require(_0x3428('0x5'));var interaction=require(_0x3428('0x6'));var config=require(_0x3428('0x7'));var controller=require(_0x3428('0x8'));router[_0x3428('0x9')]('/',auth[_0x3428('0xa')](),controller[_0x3428('0xb')]);router[_0x3428('0x9')](_0x3428('0xc'),auth[_0x3428('0xa')](),controller[_0x3428('0xd')]);router['get'](_0x3428('0xe'),auth[_0x3428('0xa')](),controller['download']);router[_0x3428('0xf')]('/',auth[_0x3428('0xa')](),controller[_0x3428('0x10')]);router['put'](_0x3428('0xc'),auth[_0x3428('0xa')](),controller[_0x3428('0x11')]);router[_0x3428('0x12')](_0x3428('0xc'),auth['isAuthenticated'](),controller[_0x3428('0x13')]);module[_0x3428('0x14')]=router; \ No newline at end of file +var _0x93a0=['exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','show','/:id/download','post','/:id','update'];(function(_0x53f897,_0x539857){var _0x6879f8=function(_0xa3c36){while(--_0xa3c36){_0x53f897['push'](_0x53f897['shift']());}};_0x6879f8(++_0x539857);}(_0x93a0,0x1aa));var _0x093a=function(_0x268cc1,_0x42368b){_0x268cc1=_0x268cc1-0x0;var _0x121299=_0x93a0[_0x268cc1];return _0x121299;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x093a('0x0'));var timeout=require(_0x093a('0x1'));var express=require(_0x093a('0x2'));var router=express['Router']();var fs_extra=require(_0x093a('0x3'));var auth=require(_0x093a('0x4'));var interaction=require(_0x093a('0x5'));var config=require(_0x093a('0x6'));var controller=require(_0x093a('0x7'));router[_0x093a('0x8')]('/',auth[_0x093a('0x9')](),controller[_0x093a('0xa')]);router[_0x093a('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x093a('0xb')]);router[_0x093a('0x8')](_0x093a('0xc'),auth[_0x093a('0x9')](),controller['download']);router[_0x093a('0xd')]('/',auth[_0x093a('0x9')](),controller['create']);router['put'](_0x093a('0xe'),auth['isAuthenticated'](),controller[_0x093a('0xf')]);router['delete'](_0x093a('0xe'),auth[_0x093a('0x9')](),controller['destroy']);module[_0x093a('0x10')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 1bbb443..1bf56ab 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 _0x7574=['exports','STRING','BOOLEAN'];(function(_0x17714e,_0x41c46f){var _0x65d270=function(_0x1e4b43){while(--_0x1e4b43){_0x17714e['push'](_0x17714e['shift']());}};_0x65d270(++_0x41c46f);}(_0x7574,0xab));var _0x4757=function(_0x30ae49,_0x1a0dd0){_0x30ae49=_0x30ae49-0x0;var _0x1bf02c=_0x7574[_0x30ae49];return _0x1bf02c;};'use strict';var Sequelize=require('sequelize');module[_0x4757('0x0')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x4757('0x1')]},'function':{'type':Sequelize[_0x4757('0x1')]},'format':{'type':Sequelize[_0x4757('0x1')]},'groupBy':{'type':Sequelize[_0x4757('0x2')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0x4757('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x4ff4=['BOOLEAN','sequelize','TEXT','STRING'];(function(_0x566e25,_0x3a602d){var _0x494556=function(_0x2a5183){while(--_0x2a5183){_0x566e25['push'](_0x566e25['shift']());}};_0x494556(++_0x3a602d);}(_0x4ff4,0x17d));var _0x44ff=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0x4ff4[_0xbf8ebe];return _0x1e25e8;};'use strict';var Sequelize=require(_0x44ff('0x0'));module['exports']={'field':{'type':Sequelize[_0x44ff('0x1')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x44ff('0x2')]},'format':{'type':Sequelize[_0x44ff('0x2')]},'groupBy':{'type':Sequelize[_0x44ff('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0x44ff('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index b3141b7..6068114 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 _0x9d98=['fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','json','reject','save','then','destroy','error','stack','name','send','index','map','AnalyticFieldReport','fieldName','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','bulkCreate','body','update','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs'];(function(_0x20b9f0,_0xeb34e1){var _0x405e13=function(_0x5dbad8){while(--_0x5dbad8){_0x20b9f0['push'](_0x20b9f0['shift']());}};_0x405e13(++_0xeb34e1);}(_0x9d98,0xf0));var _0x89d9=function(_0x21c683,_0x187b2b){_0x21c683=_0x21c683-0x0;var _0x59f136=_0x9d98[_0x21c683];return _0x59f136;};'use strict';var emlformat=require(_0x89d9('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x89d9('0x1'));var rp=require(_0x89d9('0x2'));var moment=require('moment');var BPromise=require(_0x89d9('0x3'));var Mustache=require(_0x89d9('0x4'));var util=require('util');var path=require(_0x89d9('0x5'));var sox=require(_0x89d9('0x6'));var csv=require(_0x89d9('0x7'));var ejs=require(_0x89d9('0x8'));var fs=require('fs');var fs_extra=require(_0x89d9('0x9'));var _=require(_0x89d9('0xa'));var squel=require(_0x89d9('0xb'));var crypto=require(_0x89d9('0xc'));var jsforce=require(_0x89d9('0xd'));var deskjs=require(_0x89d9('0xe'));var toCsv=require(_0x89d9('0x7'));var querystring=require(_0x89d9('0xf'));var Papa=require('papaparse');var Redis=require(_0x89d9('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x89d9('0x11'));var as=require(_0x89d9('0x12'));var hardwareService=require(_0x89d9('0x13'));var logger=require(_0x89d9('0x14'))(_0x89d9('0x15'));var utils=require(_0x89d9('0x16'));var config=require(_0x89d9('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x89d9('0x18'))['db'];function respondWithStatusCode(_0x4bd6d9,_0x1e1f27){_0x1e1f27=_0x1e1f27||0xcc;return function(_0x9359ef){if(_0x9359ef){return _0x4bd6d9[_0x89d9('0x19')](_0x1e1f27);}return _0x4bd6d9[_0x89d9('0x1a')](_0x1e1f27)[_0x89d9('0x1b')]();};}function respondWithResult(_0x4f06fa,_0x52fc0a){_0x52fc0a=_0x52fc0a||0xc8;return function(_0x3a4d42){if(_0x3a4d42){return _0x4f06fa[_0x89d9('0x1a')](_0x52fc0a)['json'](_0x3a4d42);}};}function respondWithFilteredResult(_0x2aaa3c,_0x584852){return function(_0x5b4a8e){if(_0x5b4a8e){var _0x33cd2b=typeof _0x584852[_0x89d9('0x1c')]===_0x89d9('0x1d')&&typeof _0x584852['limit']==='undefined';var _0x12c84c=_0x5b4a8e[_0x89d9('0x1e')];var _0x2d7170=_0x33cd2b?0x0:_0x584852[_0x89d9('0x1c')];var _0x4f181f=_0x33cd2b?_0x5b4a8e[_0x89d9('0x1e')]:_0x584852[_0x89d9('0x1c')]+_0x584852[_0x89d9('0x1f')];var _0x40ce02;if(_0x4f181f>=_0x12c84c){_0x4f181f=_0x12c84c;_0x40ce02=0xc8;}else{_0x40ce02=0xce;}_0x2aaa3c[_0x89d9('0x1a')](_0x40ce02);return _0x2aaa3c['set']('Content-Range',_0x2d7170+'-'+_0x4f181f+'/'+_0x12c84c)[_0x89d9('0x20')](_0x5b4a8e);}return null;};}function patchUpdates(_0x1a2ffe){return function(_0x1c6715){try{jsonpatch['apply'](_0x1c6715,_0x1a2ffe,!![]);}catch(_0x57211f){return BPromise[_0x89d9('0x21')](_0x57211f);}return _0x1c6715[_0x89d9('0x22')]();};}function saveUpdates(_0x169525,_0x59239b){return function(_0x358c55){if(_0x358c55){return _0x358c55['update'](_0x169525)[_0x89d9('0x23')](function(_0x1b9aec){return _0x1b9aec;});}return null;};}function removeEntity(_0x3f37cd,_0x3ab186){return function(_0x3e1cbf){if(_0x3e1cbf){return _0x3e1cbf[_0x89d9('0x24')]()['then'](function(){_0x3f37cd[_0x89d9('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29c8bd,_0x78dd4d){return function(_0x18c95d){if(!_0x18c95d){_0x29c8bd[_0x89d9('0x19')](0x194);}return _0x18c95d;};}function handleError(_0x24427f,_0x13e06d){_0x13e06d=_0x13e06d||0x1f4;return function(_0x35798e){logger[_0x89d9('0x25')](_0x35798e[_0x89d9('0x26')]);if(_0x35798e['name']){delete _0x35798e[_0x89d9('0x27')];}_0x24427f['status'](_0x13e06d)[_0x89d9('0x28')](_0x35798e);};}exports[_0x89d9('0x29')]=function(_0x3c0a29,_0x37b01c){var _0x39590e={},_0x384154={},_0x4afdeb={'count':0x0,'rows':[]};var _0x2675a3=_[_0x89d9('0x2a')](db[_0x89d9('0x2b')]['rawAttributes'],function(_0x46f81c){return{'name':_0x46f81c[_0x89d9('0x2c')],'type':_0x46f81c['type'][_0x89d9('0x2d')]};});_0x384154[_0x89d9('0x2e')]=_[_0x89d9('0x2a')](_0x2675a3,_0x89d9('0x27'));_0x384154[_0x89d9('0x2f')]=_['keys'](_0x3c0a29[_0x89d9('0x2f')]);_0x384154[_0x89d9('0x30')]=_[_0x89d9('0x31')](_0x384154[_0x89d9('0x2e')],_0x384154[_0x89d9('0x2f')]);_0x39590e['attributes']=_[_0x89d9('0x31')](_0x384154['model'],qs['fields'](_0x3c0a29['query']['fields']));_0x39590e[_0x89d9('0x32')]=_0x39590e[_0x89d9('0x32')][_0x89d9('0x33')]?_0x39590e['attributes']:_0x384154[_0x89d9('0x2e')];if(!_0x3c0a29[_0x89d9('0x2f')][_0x89d9('0x34')](_0x89d9('0x35'))){_0x39590e['limit']=qs[_0x89d9('0x1f')](_0x3c0a29['query']['limit']);_0x39590e['offset']=qs[_0x89d9('0x1c')](_0x3c0a29[_0x89d9('0x2f')][_0x89d9('0x1c')]);}_0x39590e['order']=qs[_0x89d9('0x36')](_0x3c0a29['query']['sort']);_0x39590e['where']=qs[_0x89d9('0x30')](_[_0x89d9('0x37')](_0x3c0a29[_0x89d9('0x2f')],_0x384154['filters']),_0x2675a3);if(_0x3c0a29[_0x89d9('0x2f')][_0x89d9('0x38')]){_0x39590e[_0x89d9('0x39')]=_[_0x89d9('0x3a')](_0x39590e[_0x89d9('0x39')],{'$or':_[_0x89d9('0x2a')](_0x2675a3,function(_0xcbd87a){if(_0xcbd87a[_0x89d9('0x3b')]!==_0x89d9('0x3c')){var _0x1ee86b={};_0x1ee86b[_0xcbd87a[_0x89d9('0x27')]]={'$like':'%'+_0x3c0a29['query']['filter']+'%'};return _0x1ee86b;}})});}_0x39590e=_[_0x89d9('0x3a')]({},_0x39590e,_0x3c0a29[_0x89d9('0x3d')]);var _0x2ab55c={'where':_0x39590e[_0x89d9('0x39')]};return db[_0x89d9('0x2b')]['count'](_0x2ab55c)['then'](function(_0x29886d){_0x4afdeb[_0x89d9('0x1e')]=_0x29886d;if(_0x3c0a29[_0x89d9('0x2f')][_0x89d9('0x3e')]){_0x39590e[_0x89d9('0x3f')]=[{'all':!![]}];}return db[_0x89d9('0x2b')][_0x89d9('0x40')](_0x39590e);})[_0x89d9('0x23')](function(_0x5e2330){_0x4afdeb[_0x89d9('0x41')]=_0x5e2330;return _0x4afdeb;})[_0x89d9('0x23')](respondWithFilteredResult(_0x37b01c,_0x39590e))[_0x89d9('0x42')](handleError(_0x37b01c,null));};exports[_0x89d9('0x43')]=function(_0x555698,_0x58c5d7){var _0x35cb42={'raw':![],'where':{'id':_0x555698[_0x89d9('0x44')]['id']}},_0x1f7ca5={};_0x1f7ca5[_0x89d9('0x2e')]=_[_0x89d9('0x45')](db[_0x89d9('0x2b')]['rawAttributes']);_0x1f7ca5[_0x89d9('0x2f')]=_[_0x89d9('0x45')](_0x555698['query']);_0x1f7ca5[_0x89d9('0x30')]=_['intersection'](_0x1f7ca5[_0x89d9('0x2e')],_0x1f7ca5[_0x89d9('0x2f')]);_0x35cb42[_0x89d9('0x32')]=_[_0x89d9('0x31')](_0x1f7ca5[_0x89d9('0x2e')],qs['fields'](_0x555698['query']['fields']));_0x35cb42[_0x89d9('0x32')]=_0x35cb42[_0x89d9('0x32')]['length']?_0x35cb42['attributes']:_0x1f7ca5[_0x89d9('0x2e')];if(_0x555698[_0x89d9('0x2f')][_0x89d9('0x3e')]){_0x35cb42[_0x89d9('0x3f')]=[{'all':!![]}];}_0x35cb42=_[_0x89d9('0x3a')]({},_0x35cb42,_0x555698[_0x89d9('0x3d')]);return db[_0x89d9('0x2b')][_0x89d9('0x46')](_0x35cb42)['then'](handleEntityNotFound(_0x58c5d7,null))['then'](respondWithResult(_0x58c5d7,null))[_0x89d9('0x42')](handleError(_0x58c5d7,null));};exports[_0x89d9('0x47')]=function(_0x44613f,_0x2c1a61){return db[_0x89d9('0x2b')][_0x89d9('0x47')](_0x44613f['body'],{})['then'](respondWithResult(_0x2c1a61,0xc9))[_0x89d9('0x42')](handleError(_0x2c1a61,null));};exports[_0x89d9('0x48')]=function(_0x127145,_0x46dfce){return db[_0x89d9('0x2b')][_0x89d9('0x48')](_0x127145[_0x89d9('0x49')],{'raw':![],'individualHooks':!![]})[_0x89d9('0x23')](respondWithResult(_0x46dfce,0xc9))[_0x89d9('0x42')](handleError(_0x46dfce,null));};exports[_0x89d9('0x4a')]=function(_0x586f9d,_0x3bfaf0){if(_0x586f9d[_0x89d9('0x49')]['id']){delete _0x586f9d['body']['id'];}return db[_0x89d9('0x2b')][_0x89d9('0x46')]({'where':{'id':_0x586f9d[_0x89d9('0x44')]['id']}})[_0x89d9('0x23')](handleEntityNotFound(_0x3bfaf0,null))['then'](saveUpdates(_0x586f9d[_0x89d9('0x49')],null))['then'](respondWithResult(_0x3bfaf0,null))[_0x89d9('0x42')](handleError(_0x3bfaf0,null));};exports[_0x89d9('0x24')]=function(_0x4581b9,_0x206fdd){return db['AnalyticFieldReport'][_0x89d9('0x46')]({'where':{'id':_0x4581b9[_0x89d9('0x44')]['id']}})[_0x89d9('0x23')](handleEntityNotFound(_0x206fdd,null))[_0x89d9('0x23')](removeEntity(_0x206fdd,null))[_0x89d9('0x42')](handleError(_0x206fdd,null));};exports[_0x89d9('0x4b')]=function(_0x54e8b4,_0x4f34fd){return db['AnalyticFieldReport']['destroy']({'where':{'id':_0x54e8b4['query'][_0x89d9('0x4c')]||[]},'raw':![],'individualHooks':!![]})[_0x89d9('0x23')](respondWithResult(_0x4f34fd,0xcc))[_0x89d9('0x42')](handleError(_0x4f34fd,null));};exports[_0x89d9('0x4d')]=function(_0x3da3af,_0x513ae3,_0x5db0ad){return db[_0x89d9('0x4e')][_0x89d9('0x4f')]({'where':{'id':_0x3da3af[_0x89d9('0x44')]['id']}})[_0x89d9('0x23')](handleEntityNotFound(_0x513ae3,null))[_0x89d9('0x23')](function(_0xe64aa8){if(_0xe64aa8){return db[_0x89d9('0x50')][_0x89d9('0x51')](function(_0x376904){return db[_0x89d9('0x2b')]['destroy']({'where':{'CustomReportId':_0x3da3af[_0x89d9('0x44')]['id']},'transaction':_0x376904})['then'](function(_0x22c217){var _0x2fdb85=_[_0x89d9('0x2a')](_0x3da3af['body'],function(_0x5835a9){delete _0x5835a9['id'];_0x5835a9[_0x89d9('0x52')]=_0x3da3af['params']['id'];return _0x5835a9;});return db[_0x89d9('0x2b')][_0x89d9('0x48')](_0x2fdb85,{'transaction':_0x376904});});})[_0x89d9('0x23')](function(){return db[_0x89d9('0x2b')][_0x89d9('0x40')]({'where':{'CustomReportId':_0x3da3af['params']['id']}});});}})['then'](respondWithResult(_0x513ae3,null))[_0x89d9('0x42')](handleError(_0x513ae3,null));}; \ No newline at end of file +var _0x5042=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','reject','then','error','stack','name','send','index','map','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','AnalyticFieldReport','includeAll','include','findAll','catch','show','params','length','find','create','bulkCreate','body','update','destroy','bulkDestroy','addFields','AnalyticCustomReport','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x271a65,_0xadc011){var _0x88d8e=function(_0x2ff125){while(--_0x2ff125){_0x271a65['push'](_0x271a65['shift']());}};_0x88d8e(++_0xadc011);}(_0x5042,0x146));var _0x2504=function(_0x247549,_0x24cbbf){_0x247549=_0x247549-0x0;var _0x3982aa=_0x5042[_0x247549];return _0x3982aa;};'use strict';var emlformat=require(_0x2504('0x0'));var rimraf=require(_0x2504('0x1'));var zipdir=require(_0x2504('0x2'));var jsonpatch=require(_0x2504('0x3'));var rp=require(_0x2504('0x4'));var moment=require(_0x2504('0x5'));var BPromise=require(_0x2504('0x6'));var Mustache=require(_0x2504('0x7'));var util=require(_0x2504('0x8'));var path=require(_0x2504('0x9'));var sox=require(_0x2504('0xa'));var csv=require(_0x2504('0xb'));var ejs=require(_0x2504('0xc'));var fs=require('fs');var fs_extra=require(_0x2504('0xd'));var _=require('lodash');var squel=require(_0x2504('0xe'));var crypto=require(_0x2504('0xf'));var jsforce=require(_0x2504('0x10'));var deskjs=require(_0x2504('0x11'));var toCsv=require(_0x2504('0xb'));var querystring=require(_0x2504('0x12'));var Papa=require('papaparse');var Redis=require(_0x2504('0x13'));var authService=require(_0x2504('0x14'));var qs=require(_0x2504('0x15'));var as=require(_0x2504('0x16'));var hardwareService=require(_0x2504('0x17'));var logger=require(_0x2504('0x18'))(_0x2504('0x19'));var utils=require(_0x2504('0x1a'));var config=require(_0x2504('0x1b'));var licenseUtil=require(_0x2504('0x1c'));var db=require(_0x2504('0x1d'))['db'];function respondWithStatusCode(_0x307e56,_0x19b9f6){_0x19b9f6=_0x19b9f6||0xcc;return function(_0x6a60b9){if(_0x6a60b9){return _0x307e56[_0x2504('0x1e')](_0x19b9f6);}return _0x307e56[_0x2504('0x1f')](_0x19b9f6)[_0x2504('0x20')]();};}function respondWithResult(_0x275e39,_0x777f77){_0x777f77=_0x777f77||0xc8;return function(_0x417279){if(_0x417279){return _0x275e39[_0x2504('0x1f')](_0x777f77)['json'](_0x417279);}};}function respondWithFilteredResult(_0x4e0390,_0x5069f0){return function(_0x499a92){if(_0x499a92){var _0x30ceba=typeof _0x5069f0['offset']===_0x2504('0x21')&&typeof _0x5069f0[_0x2504('0x22')]==='undefined';var _0x18ca31=_0x499a92[_0x2504('0x23')];var _0x559b8e=_0x30ceba?0x0:_0x5069f0[_0x2504('0x24')];var _0x1fa6f4=_0x30ceba?_0x499a92[_0x2504('0x23')]:_0x5069f0[_0x2504('0x24')]+_0x5069f0[_0x2504('0x22')];var _0x1c60e6;if(_0x1fa6f4>=_0x18ca31){_0x1fa6f4=_0x18ca31;_0x1c60e6=0xc8;}else{_0x1c60e6=0xce;}_0x4e0390['status'](_0x1c60e6);return _0x4e0390[_0x2504('0x25')](_0x2504('0x26'),_0x559b8e+'-'+_0x1fa6f4+'/'+_0x18ca31)[_0x2504('0x27')](_0x499a92);}return null;};}function patchUpdates(_0x3e61cc){return function(_0x38d002){try{jsonpatch['apply'](_0x38d002,_0x3e61cc,!![]);}catch(_0x68751e){return BPromise[_0x2504('0x28')](_0x68751e);}return _0x38d002['save']();};}function saveUpdates(_0x289d64,_0x418aa2){return function(_0x324f39){if(_0x324f39){return _0x324f39['update'](_0x289d64)[_0x2504('0x29')](function(_0x213b98){return _0x213b98;});}return null;};}function removeEntity(_0x3c984d,_0x25167c){return function(_0x315317){if(_0x315317){return _0x315317['destroy']()[_0x2504('0x29')](function(){_0x3c984d[_0x2504('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d34b3,_0x417f4f){return function(_0xf42412){if(!_0xf42412){_0x4d34b3[_0x2504('0x1e')](0x194);}return _0xf42412;};}function handleError(_0x1bda95,_0x14c028){_0x14c028=_0x14c028||0x1f4;return function(_0x3264ea){logger[_0x2504('0x2a')](_0x3264ea[_0x2504('0x2b')]);if(_0x3264ea['name']){delete _0x3264ea[_0x2504('0x2c')];}_0x1bda95['status'](_0x14c028)[_0x2504('0x2d')](_0x3264ea);};}exports[_0x2504('0x2e')]=function(_0x46308a,_0x3619c1){var _0x5cfb30={},_0x543571={},_0x5caba6={'count':0x0,'rows':[]};var _0x5f0358=_[_0x2504('0x2f')](db['AnalyticFieldReport'][_0x2504('0x30')],function(_0x2295df){return{'name':_0x2295df['fieldName'],'type':_0x2295df[_0x2504('0x31')][_0x2504('0x32')]};});_0x543571[_0x2504('0x33')]=_[_0x2504('0x2f')](_0x5f0358,_0x2504('0x2c'));_0x543571['query']=_[_0x2504('0x34')](_0x46308a[_0x2504('0x35')]);_0x543571[_0x2504('0x36')]=_[_0x2504('0x37')](_0x543571[_0x2504('0x33')],_0x543571['query']);_0x5cfb30[_0x2504('0x38')]=_[_0x2504('0x37')](_0x543571[_0x2504('0x33')],qs[_0x2504('0x39')](_0x46308a[_0x2504('0x35')][_0x2504('0x39')]));_0x5cfb30[_0x2504('0x38')]=_0x5cfb30[_0x2504('0x38')]['length']?_0x5cfb30[_0x2504('0x38')]:_0x543571[_0x2504('0x33')];if(!_0x46308a[_0x2504('0x35')][_0x2504('0x3a')](_0x2504('0x3b'))){_0x5cfb30[_0x2504('0x22')]=qs[_0x2504('0x22')](_0x46308a['query'][_0x2504('0x22')]);_0x5cfb30['offset']=qs[_0x2504('0x24')](_0x46308a[_0x2504('0x35')][_0x2504('0x24')]);}_0x5cfb30['order']=qs[_0x2504('0x3c')](_0x46308a['query']['sort']);_0x5cfb30['where']=qs[_0x2504('0x36')](_[_0x2504('0x3d')](_0x46308a[_0x2504('0x35')],_0x543571[_0x2504('0x36')]),_0x5f0358);if(_0x46308a[_0x2504('0x35')][_0x2504('0x3e')]){_0x5cfb30[_0x2504('0x3f')]=_['merge'](_0x5cfb30[_0x2504('0x3f')],{'$or':_[_0x2504('0x2f')](_0x5f0358,function(_0x13c28c){if(_0x13c28c[_0x2504('0x31')]!==_0x2504('0x40')){var _0x4d423f={};_0x4d423f[_0x13c28c['name']]={'$like':'%'+_0x46308a[_0x2504('0x35')][_0x2504('0x3e')]+'%'};return _0x4d423f;}})});}_0x5cfb30=_[_0x2504('0x41')]({},_0x5cfb30,_0x46308a[_0x2504('0x42')]);var _0x48c0bd={'where':_0x5cfb30['where']};return db[_0x2504('0x43')][_0x2504('0x23')](_0x48c0bd)[_0x2504('0x29')](function(_0x3768a7){_0x5caba6[_0x2504('0x23')]=_0x3768a7;if(_0x46308a[_0x2504('0x35')][_0x2504('0x44')]){_0x5cfb30[_0x2504('0x45')]=[{'all':!![]}];}return db[_0x2504('0x43')][_0x2504('0x46')](_0x5cfb30);})['then'](function(_0xd367a1){_0x5caba6['rows']=_0xd367a1;return _0x5caba6;})[_0x2504('0x29')](respondWithFilteredResult(_0x3619c1,_0x5cfb30))[_0x2504('0x47')](handleError(_0x3619c1,null));};exports[_0x2504('0x48')]=function(_0x2c8ad7,_0x2eb377){var _0x240af8={'raw':![],'where':{'id':_0x2c8ad7[_0x2504('0x49')]['id']}},_0x2ffb9e={};_0x2ffb9e['model']=_[_0x2504('0x34')](db['AnalyticFieldReport'][_0x2504('0x30')]);_0x2ffb9e[_0x2504('0x35')]=_['keys'](_0x2c8ad7[_0x2504('0x35')]);_0x2ffb9e[_0x2504('0x36')]=_[_0x2504('0x37')](_0x2ffb9e[_0x2504('0x33')],_0x2ffb9e[_0x2504('0x35')]);_0x240af8[_0x2504('0x38')]=_[_0x2504('0x37')](_0x2ffb9e['model'],qs[_0x2504('0x39')](_0x2c8ad7[_0x2504('0x35')][_0x2504('0x39')]));_0x240af8[_0x2504('0x38')]=_0x240af8[_0x2504('0x38')][_0x2504('0x4a')]?_0x240af8['attributes']:_0x2ffb9e['model'];if(_0x2c8ad7[_0x2504('0x35')][_0x2504('0x44')]){_0x240af8['include']=[{'all':!![]}];}_0x240af8=_['merge']({},_0x240af8,_0x2c8ad7[_0x2504('0x42')]);return db[_0x2504('0x43')][_0x2504('0x4b')](_0x240af8)['then'](handleEntityNotFound(_0x2eb377,null))[_0x2504('0x29')](respondWithResult(_0x2eb377,null))[_0x2504('0x47')](handleError(_0x2eb377,null));};exports[_0x2504('0x4c')]=function(_0x2a7931,_0x5ef280){return db[_0x2504('0x43')][_0x2504('0x4c')](_0x2a7931['body'],{})[_0x2504('0x29')](respondWithResult(_0x5ef280,0xc9))[_0x2504('0x47')](handleError(_0x5ef280,null));};exports[_0x2504('0x4d')]=function(_0x129c58,_0x3f8fd2){return db[_0x2504('0x43')][_0x2504('0x4d')](_0x129c58[_0x2504('0x4e')],{'raw':![],'individualHooks':!![]})[_0x2504('0x29')](respondWithResult(_0x3f8fd2,0xc9))[_0x2504('0x47')](handleError(_0x3f8fd2,null));};exports[_0x2504('0x4f')]=function(_0x358aec,_0x9d31ba){if(_0x358aec[_0x2504('0x4e')]['id']){delete _0x358aec['body']['id'];}return db[_0x2504('0x43')]['find']({'where':{'id':_0x358aec['params']['id']}})[_0x2504('0x29')](handleEntityNotFound(_0x9d31ba,null))[_0x2504('0x29')](saveUpdates(_0x358aec[_0x2504('0x4e')],null))[_0x2504('0x29')](respondWithResult(_0x9d31ba,null))[_0x2504('0x47')](handleError(_0x9d31ba,null));};exports[_0x2504('0x50')]=function(_0x3224d4,_0x5e4470){return db[_0x2504('0x43')][_0x2504('0x4b')]({'where':{'id':_0x3224d4[_0x2504('0x49')]['id']}})[_0x2504('0x29')](handleEntityNotFound(_0x5e4470,null))[_0x2504('0x29')](removeEntity(_0x5e4470,null))[_0x2504('0x47')](handleError(_0x5e4470,null));};exports[_0x2504('0x51')]=function(_0x148ce4,_0x5b81b3){return db['AnalyticFieldReport'][_0x2504('0x50')]({'where':{'id':_0x148ce4[_0x2504('0x35')]['ids']||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x5b81b3,0xcc))['catch'](handleError(_0x5b81b3,null));};exports[_0x2504('0x52')]=function(_0x248d99,_0x426af8,_0x2dcd5c){return db[_0x2504('0x53')]['findOne']({'where':{'id':_0x248d99['params']['id']}})[_0x2504('0x29')](handleEntityNotFound(_0x426af8,null))[_0x2504('0x29')](function(_0x5b4470){if(_0x5b4470){return db[_0x2504('0x54')][_0x2504('0x55')](function(_0x49ca7a){return db[_0x2504('0x43')][_0x2504('0x50')]({'where':{'CustomReportId':_0x248d99[_0x2504('0x49')]['id']},'transaction':_0x49ca7a})['then'](function(_0xcd9624){var _0x599ae5=_['map'](_0x248d99[_0x2504('0x4e')],function(_0x41d0c5){delete _0x41d0c5['id'];_0x41d0c5[_0x2504('0x56')]=_0x248d99[_0x2504('0x49')]['id'];return _0x41d0c5;});return db[_0x2504('0x43')][_0x2504('0x4d')](_0x599ae5,{'transaction':_0x49ca7a});});})[_0x2504('0x29')](function(){return db[_0x2504('0x43')]['findAll']({'where':{'CustomReportId':_0x248d99[_0x2504('0x49')]['id']}});});}})[_0x2504('0x29')](respondWithResult(_0x426af8,null))[_0x2504('0x47')](handleError(_0x426af8,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 119f1de..02b2536 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 _0x23b9=['lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','AnalyticFieldReport','analytics_report_fields'];(function(_0x59f066,_0x3d8a42){var _0x21187c=function(_0x17a6ee){while(--_0x17a6ee){_0x59f066['push'](_0x59f066['shift']());}};_0x21187c(++_0x3d8a42);}(_0x23b9,0x9c));var _0x923b=function(_0x315cc9,_0x40ca3b){_0x315cc9=_0x315cc9-0x0;var _0x3b3e42=_0x23b9[_0x315cc9];return _0x3b3e42;};'use strict';var _=require(_0x923b('0x0'));var util=require(_0x923b('0x1'));var logger=require(_0x923b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x923b('0x3'));var rp=require(_0x923b('0x4'));var fs=require('fs');var path=require(_0x923b('0x5'));var rimraf=require(_0x923b('0x6'));var config=require(_0x923b('0x7'));var attributes=require('./analyticFieldReport.attributes');module[_0x923b('0x8')]=function(_0x367767,_0x55e560){return _0x367767[_0x923b('0x9')](_0x923b('0xa'),attributes,{'tableName':_0x923b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc7fa=['path','rimraf','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x2b3b07,_0xa237cb){var _0x553ac5=function(_0x3d9297){while(--_0x3d9297){_0x2b3b07['push'](_0x2b3b07['shift']());}};_0x553ac5(++_0xa237cb);}(_0xc7fa,0x7e));var _0xac7f=function(_0x66a74f,_0x192e2d){_0x66a74f=_0x66a74f-0x0;var _0x314c38=_0xc7fa[_0x66a74f];return _0x314c38;};'use strict';var _=require(_0xac7f('0x0'));var util=require(_0xac7f('0x1'));var logger=require(_0xac7f('0x2'))(_0xac7f('0x3'));var moment=require(_0xac7f('0x4'));var BPromise=require('bluebird');var rp=require(_0xac7f('0x5'));var fs=require('fs');var path=require(_0xac7f('0x6'));var rimraf=require(_0xac7f('0x7'));var config=require('../../config/environment');var attributes=require('./analyticFieldReport.attributes');module[_0xac7f('0x8')]=function(_0x1fdcb4,_0xfc8794){return _0x1fdcb4[_0xac7f('0x9')](_0xac7f('0xa'),attributes,{'tableName':_0xac7f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 1d2a48d..a84948c 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 _0x18cc=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0x18cc,0xe5));var _0xc18c=function(_0x8e02e3,_0xc1ff5){_0x8e02e3=_0x8e02e3-0x0;var _0x27512f=_0x18cc[_0x8e02e3];return _0x27512f;};'use strict';var _=require(_0xc18c('0x0'));var util=require(_0xc18c('0x1'));var moment=require('moment');var BPromise=require(_0xc18c('0x2'));var rs=require(_0xc18c('0x3'));var fs=require('fs');var Redis=require(_0xc18c('0x4'));var db=require(_0xc18c('0x5'))['db'];var utils=require(_0xc18c('0x6'));var logger=require(_0xc18c('0x7'))(_0xc18c('0x8'));var config=require(_0xc18c('0x9'));var jayson=require(_0xc18c('0xa'));var client=jayson[_0xc18c('0xb')][_0xc18c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x13f576,_0x521879,_0x2a655a){return new BPromise(function(_0x2249bc,_0x473450){return client['request'](_0x13f576,_0x2a655a)['then'](function(_0x57d07c){logger[_0xc18c('0xd')](_0xc18c('0xe'),_0x521879,_0xc18c('0xf'));logger[_0xc18c('0x10')](_0xc18c('0x11'),_0x521879,'request\x20sent',JSON[_0xc18c('0x12')](_0x57d07c));if(_0x57d07c[_0xc18c('0x13')]){if(_0x57d07c[_0xc18c('0x13')]['code']===0x1f4){logger[_0xc18c('0x13')]('AnalyticFieldReport,\x20%s,\x20%s',_0x521879,_0x57d07c[_0xc18c('0x13')][_0xc18c('0x14')]);return _0x473450(_0x57d07c[_0xc18c('0x13')][_0xc18c('0x14')]);}logger[_0xc18c('0x13')](_0xc18c('0xe'),_0x521879,_0x57d07c['error'][_0xc18c('0x14')]);return _0x2249bc(_0x57d07c[_0xc18c('0x13')][_0xc18c('0x14')]);}else{logger[_0xc18c('0xd')](_0xc18c('0xe'),_0x521879,_0xc18c('0xf'));_0x2249bc(_0x57d07c[_0xc18c('0x15')][_0xc18c('0x14')]);}})[_0xc18c('0x16')](function(_0xa46086){logger[_0xc18c('0x13')]('AnalyticFieldReport,\x20%s,\x20%s',_0x521879,_0xa46086);_0x473450(_0xa46086);});});} \ No newline at end of file +var _0x632e=['client','http','request','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x4c4042,_0x1ea485){var _0xbd10dc=function(_0x164b20){while(--_0x164b20){_0x4c4042['push'](_0x4c4042['shift']());}};_0xbd10dc(++_0x1ea485);}(_0x632e,0x97));var _0xe632=function(_0x4e5552,_0x19ec4e){_0x4e5552=_0x4e5552-0x0;var _0x60a338=_0x632e[_0x4e5552];return _0x60a338;};'use strict';var _=require(_0xe632('0x0'));var util=require(_0xe632('0x1'));var moment=require(_0xe632('0x2'));var BPromise=require(_0xe632('0x3'));var rs=require(_0xe632('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe632('0x5'))['db'];var utils=require(_0xe632('0x6'));var logger=require('../../config/logger')(_0xe632('0x7'));var config=require(_0xe632('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe632('0x9')][_0xe632('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28bedb,_0x505a63,_0x5be77e){return new BPromise(function(_0x2f0097,_0x3e9d96){return client[_0xe632('0xb')](_0x28bedb,_0x5be77e)['then'](function(_0xe078db){logger[_0xe632('0xc')](_0xe632('0xd'),_0x505a63,_0xe632('0xe'));logger['debug']('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x505a63,_0xe632('0xe'),JSON[_0xe632('0xf')](_0xe078db));if(_0xe078db[_0xe632('0x10')]){if(_0xe078db[_0xe632('0x10')]['code']===0x1f4){logger[_0xe632('0x10')](_0xe632('0xd'),_0x505a63,_0xe078db[_0xe632('0x10')][_0xe632('0x11')]);return _0x3e9d96(_0xe078db[_0xe632('0x10')][_0xe632('0x11')]);}logger[_0xe632('0x10')](_0xe632('0xd'),_0x505a63,_0xe078db[_0xe632('0x10')][_0xe632('0x11')]);return _0x2f0097(_0xe078db[_0xe632('0x10')][_0xe632('0x11')]);}else{logger[_0xe632('0xc')]('AnalyticFieldReport,\x20%s,\x20%s',_0x505a63,_0xe632('0xe'));_0x2f0097(_0xe078db[_0xe632('0x12')][_0xe632('0x11')]);}})[_0xe632('0x13')](function(_0x5c6a62){logger[_0xe632('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x505a63,_0x5c6a62);_0x3e9d96(_0x5c6a62);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 4559c78..e1fd706 100644 --- a/server/api/analyticFieldReport/index.js +++ b/server/api/analyticFieldReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','index','/:id','post','/create_many','isAuthenticated','bulkCreate','/:id/create_many','update'];(function(_0x3828df,_0x453607){var _0x132d03=function(_0x188a61){while(--_0x188a61){_0x3828df['push'](_0x3828df['shift']());}};_0x132d03(++_0x453607);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router; \ No newline at end of file +var _0xa9e0=['delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','index','/:id','post','/create_many','isAuthenticated','bulkCreate','/:id/create_many','update'];(function(_0x1e87fe,_0x3707d6){var _0x558d64=function(_0x566f1e){while(--_0x566f1e){_0x1e87fe['push'](_0x1e87fe['shift']());}};_0x558d64(++_0x3707d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 397f3a7..26da861 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 _0x2917=['name','TEXT','sequelize','exports','STRING'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x2917,0x142));var _0x7291=function(_0x473738,_0x15ea31){_0x473738=_0x473738-0x0;var _0x1df4ae=_0x2917[_0x473738];return _0x1df4ae;};'use strict';var Sequelize=require(_0x7291('0x0'));module[_0x7291('0x1')]={'name':{'type':Sequelize[_0x7291('0x2')],'allowNull':![],'unique':_0x7291('0x3')},'table':{'type':Sequelize[_0x7291('0x2')]},'metric':{'type':Sequelize[_0x7291('0x4')]},'description':{'type':Sequelize[_0x7291('0x2')]}}; \ No newline at end of file +var _0xfbac=['STRING','name','TEXT','exports'];(function(_0x5403d5,_0xf406eb){var _0xd87ca2=function(_0x498015){while(--_0x498015){_0x5403d5['push'](_0x5403d5['shift']());}};_0xd87ca2(++_0xf406eb);}(_0xfbac,0x167));var _0xcfba=function(_0x1bc29b,_0x5e1235){_0x1bc29b=_0x1bc29b-0x0;var _0x19f05a=_0xfbac[_0x1bc29b];return _0x19f05a;};'use strict';var Sequelize=require('sequelize');module[_0xcfba('0x0')]={'name':{'type':Sequelize[_0xcfba('0x1')],'allowNull':![],'unique':_0xcfba('0x2')},'table':{'type':Sequelize[_0xcfba('0x1')]},'metric':{'type':Sequelize[_0xcfba('0x3')]},'description':{'type':Sequelize[_0xcfba('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 9c6f367..37d5539 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 _0x9957=['fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','Metrics','UserProfileResource','end','error','name','map','type','key','model','keys','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','AnalyticMetric','include','findAll','rawAttributes','intersection','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){var _0x472195=_0x563799['get']({'plain':!![]});var _0x39df42=_0x7995('0x28');return db[_0x7995('0x29')][_0x7995('0x27')]({'where':{'type':_0x39df42,'resourceId':_0x472195['id']}})[_0x7995('0x26')](function(){return _0x563799;});})[_0x7995('0x26')](function(){_0x204507['status'](0xcc)[_0x7995('0x2a')]();});}};}function handleEntityNotFound(_0x5911c3,_0x229742){return function(_0x49bc7e){if(!_0x49bc7e){_0x5911c3[_0x7995('0x1b')](0x194);}return _0x49bc7e;};}function handleError(_0x132a42,_0x11c1eb){_0x11c1eb=_0x11c1eb||0x1f4;return function(_0x4b6f99){logger[_0x7995('0x2b')](_0x4b6f99['stack']);if(_0x4b6f99[_0x7995('0x2c')]){delete _0x4b6f99[_0x7995('0x2c')];}_0x132a42[_0x7995('0x1c')](_0x11c1eb)['send'](_0x4b6f99);};}exports['index']=function(_0x48e573,_0x3573be){var _0xe6b0b3={},_0x327a81={},_0x2b874d={'count':0x0,'rows':[]};var _0x2e3493=_[_0x7995('0x2d')](db['AnalyticMetric']['rawAttributes'],function(_0xfa8f15){return{'name':_0xfa8f15['fieldName'],'type':_0xfa8f15[_0x7995('0x2e')][_0x7995('0x2f')]};});_0x327a81[_0x7995('0x30')]=_[_0x7995('0x2d')](_0x2e3493,_0x7995('0x2c'));_0x327a81['query']=_[_0x7995('0x31')](_0x48e573[_0x7995('0x32')]);_0x327a81['filters']=_['intersection'](_0x327a81['model'],_0x327a81[_0x7995('0x32')]);_0xe6b0b3[_0x7995('0x33')]=_['intersection'](_0x327a81[_0x7995('0x30')],qs['fields'](_0x48e573[_0x7995('0x32')][_0x7995('0x34')]));_0xe6b0b3[_0x7995('0x33')]=_0xe6b0b3['attributes']['length']?_0xe6b0b3[_0x7995('0x33')]:_0x327a81['model'];if(!_0x48e573['query'][_0x7995('0x35')](_0x7995('0x36'))){_0xe6b0b3['limit']=qs[_0x7995('0x21')](_0x48e573[_0x7995('0x32')][_0x7995('0x21')]);_0xe6b0b3[_0x7995('0x20')]=qs[_0x7995('0x20')](_0x48e573['query'][_0x7995('0x20')]);}_0xe6b0b3[_0x7995('0x37')]=qs[_0x7995('0x38')](_0x48e573[_0x7995('0x32')]['sort']);_0xe6b0b3[_0x7995('0x39')]=qs[_0x7995('0x3a')](_[_0x7995('0x3b')](_0x48e573[_0x7995('0x32')],_0x327a81[_0x7995('0x3a')]),_0x2e3493);if(_0x48e573[_0x7995('0x32')]['filter']){_0xe6b0b3[_0x7995('0x39')]=_[_0x7995('0x3c')](_0xe6b0b3[_0x7995('0x39')],{'$or':_[_0x7995('0x2d')](_0x2e3493,function(_0x2e04cd){if(_0x2e04cd[_0x7995('0x2e')]!==_0x7995('0x3d')){var _0x270c0e={};_0x270c0e[_0x2e04cd[_0x7995('0x2c')]]={'$like':'%'+_0x48e573[_0x7995('0x32')][_0x7995('0x3e')]+'%'};return _0x270c0e;}})});}_0xe6b0b3=_[_0x7995('0x3c')]({},_0xe6b0b3,_0x48e573[_0x7995('0x3f')]);var _0x53cda2={'where':_0xe6b0b3['where']};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x53cda2)['then'](function(_0x4b0855){_0x2b874d[_0x7995('0x1f')]=_0x4b0855;if(_0x48e573['query']['includeAll']){_0xe6b0b3[_0x7995('0x41')]=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x42')](_0xe6b0b3);})['then'](function(_0x46ac4f){_0x2b874d['rows']=_0x46ac4f;return _0x2b874d;})[_0x7995('0x26')](respondWithFilteredResult(_0x3573be,_0xe6b0b3))['catch'](handleError(_0x3573be,null));};exports['show']=function(_0x39c5b8,_0x403f54){var _0xc04e5={'raw':!![],'where':{'id':_0x39c5b8['params']['id']}},_0x3f1c35={};_0x3f1c35[_0x7995('0x30')]=_[_0x7995('0x31')](db[_0x7995('0x40')][_0x7995('0x43')]);_0x3f1c35['query']=_['keys'](_0x39c5b8[_0x7995('0x32')]);_0x3f1c35['filters']=_[_0x7995('0x44')](_0x3f1c35['model'],_0x3f1c35[_0x7995('0x32')]);_0xc04e5['attributes']=_[_0x7995('0x44')](_0x3f1c35[_0x7995('0x30')],qs['fields'](_0x39c5b8[_0x7995('0x32')][_0x7995('0x34')]));_0xc04e5[_0x7995('0x33')]=_0xc04e5[_0x7995('0x33')]['length']?_0xc04e5[_0x7995('0x33')]:_0x3f1c35[_0x7995('0x30')];if(_0x39c5b8[_0x7995('0x32')]['includeAll']){_0xc04e5[_0x7995('0x41')]=[{'all':!![]}];}_0xc04e5=_[_0x7995('0x3c')]({},_0xc04e5,_0x39c5b8[_0x7995('0x3f')]);return db[_0x7995('0x40')][_0x7995('0x45')](_0xc04e5)['then'](handleEntityNotFound(_0x403f54,null))[_0x7995('0x26')](respondWithResult(_0x403f54,null))[_0x7995('0x46')](handleError(_0x403f54,null));};exports['create']=function(_0x3d1dbb,_0x5843ba){return db[_0x7995('0x40')][_0x7995('0x47')](_0x3d1dbb[_0x7995('0x48')],{})[_0x7995('0x26')](function(_0xddf537){var _0x14b537=_0x3d1dbb[_0x7995('0x49')]['get']({'plain':!![]});if(!_0x14b537)throw new Error(_0x7995('0x4a'));if(_0x14b537[_0x7995('0x4b')]===_0x7995('0x49')){var _0x4ffc8a=_0xddf537[_0x7995('0x4c')]({'plain':!![]});var _0x1fe77e=_0x7995('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x1fe77e,'userProfileId':_0x14b537['userProfileId']},'raw':!![]})[_0x7995('0x26')](function(_0x1fd1ca){if(_0x1fd1ca&&_0x1fd1ca['autoAssociation']===0x0){return db[_0x7995('0x29')][_0x7995('0x47')]({'name':_0x4ffc8a[_0x7995('0x2c')],'resourceId':_0x4ffc8a['id'],'type':_0x1fd1ca[_0x7995('0x2c')],'sectionId':_0x1fd1ca['id']},{})[_0x7995('0x26')](function(){return _0xddf537;});}else{return _0xddf537;}})['catch'](function(_0x29ee32){logger['error'](_0x7995('0x4d'),_0x29ee32);throw _0x29ee32;});}return _0xddf537;})[_0x7995('0x26')](respondWithResult(_0x5843ba,0xc9))[_0x7995('0x46')](handleError(_0x5843ba,null));};exports['update']=function(_0x5e1f34,_0x54e2b1){if(_0x5e1f34['body']['id']){delete _0x5e1f34[_0x7995('0x48')]['id'];}return db[_0x7995('0x40')][_0x7995('0x45')]({'where':{'id':_0x5e1f34[_0x7995('0x4e')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x54e2b1,null))[_0x7995('0x26')](saveUpdates(_0x5e1f34[_0x7995('0x48')],null))[_0x7995('0x26')](respondWithResult(_0x54e2b1,null))[_0x7995('0x46')](handleError(_0x54e2b1,null));};exports[_0x7995('0x27')]=function(_0xa7af8c,_0x133c63){return db[_0x7995('0x40')][_0x7995('0x45')]({'where':{'id':_0xa7af8c[_0x7995('0x4e')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x133c63,null))[_0x7995('0x26')](removeEntity(_0x133c63,null))[_0x7995('0x46')](handleError(_0x133c63,null));}; \ No newline at end of file +var _0x7217=['Content-Range','apply','reject','save','update','then','destroy','get','Metrics','UserProfileResource','sendStatus','error','stack','name','send','index','map','AnalyticMetric','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set'];(function(_0x3df208,_0x3681f2){var _0x529cbe=function(_0x3120c0){while(--_0x3120c0){_0x3df208['push'](_0x3df208['shift']());}};_0x529cbe(++_0x3681f2);}(_0x7217,0x19e));var _0x7721=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0x7217[_0x3c4737];return _0x2bb926;};'use strict';var emlformat=require(_0x7721('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7721('0x1'));var jsonpatch=require(_0x7721('0x2'));var rp=require(_0x7721('0x3'));var moment=require(_0x7721('0x4'));var BPromise=require(_0x7721('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7721('0x6'));var sox=require(_0x7721('0x7'));var csv=require(_0x7721('0x8'));var ejs=require(_0x7721('0x9'));var fs=require('fs');var fs_extra=require(_0x7721('0xa'));var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x8'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var licenseUtil=require(_0x7721('0x1a'));var db=require(_0x7721('0x1b'))['db'];function respondWithStatusCode(_0x55b4ca,_0x2911ec){_0x2911ec=_0x2911ec||0xcc;return function(_0x199930){if(_0x199930){return _0x55b4ca['sendStatus'](_0x2911ec);}return _0x55b4ca[_0x7721('0x1c')](_0x2911ec)[_0x7721('0x1d')]();};}function respondWithResult(_0x3f01c5,_0x2e9752){_0x2e9752=_0x2e9752||0xc8;return function(_0x5069da){if(_0x5069da){return _0x3f01c5[_0x7721('0x1c')](_0x2e9752)[_0x7721('0x1e')](_0x5069da);}};}function respondWithFilteredResult(_0x534f1b,_0x4e199a){return function(_0x4b183e){if(_0x4b183e){var _0x5ed54=typeof _0x4e199a[_0x7721('0x1f')]===_0x7721('0x20')&&typeof _0x4e199a[_0x7721('0x21')]==='undefined';var _0x20f669=_0x4b183e['count'];var _0x3fc09e=_0x5ed54?0x0:_0x4e199a['offset'];var _0xfec626=_0x5ed54?_0x4b183e[_0x7721('0x22')]:_0x4e199a[_0x7721('0x1f')]+_0x4e199a[_0x7721('0x21')];var _0x2286e5;if(_0xfec626>=_0x20f669){_0xfec626=_0x20f669;_0x2286e5=0xc8;}else{_0x2286e5=0xce;}_0x534f1b[_0x7721('0x1c')](_0x2286e5);return _0x534f1b[_0x7721('0x23')](_0x7721('0x24'),_0x3fc09e+'-'+_0xfec626+'/'+_0x20f669)[_0x7721('0x1e')](_0x4b183e);}return null;};}function patchUpdates(_0xaeccc4){return function(_0x4ce1db){try{jsonpatch[_0x7721('0x25')](_0x4ce1db,_0xaeccc4,!![]);}catch(_0x2c1583){return BPromise[_0x7721('0x26')](_0x2c1583);}return _0x4ce1db[_0x7721('0x27')]();};}function saveUpdates(_0x57140c,_0x28f5a6){return function(_0x512f31){if(_0x512f31){return _0x512f31[_0x7721('0x28')](_0x57140c)[_0x7721('0x29')](function(_0x3e8a4e){return _0x3e8a4e;});}return null;};}function removeEntity(_0x1caad8,_0x121cc4){return function(_0x395b15){if(_0x395b15){return _0x395b15[_0x7721('0x2a')]()['then'](function(){var _0x216f20=_0x395b15[_0x7721('0x2b')]({'plain':!![]});var _0x125564=_0x7721('0x2c');return db[_0x7721('0x2d')][_0x7721('0x2a')]({'where':{'type':_0x125564,'resourceId':_0x216f20['id']}})[_0x7721('0x29')](function(){return _0x395b15;});})[_0x7721('0x29')](function(){_0x1caad8[_0x7721('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x258ddf,_0x5b0551){return function(_0x499b87){if(!_0x499b87){_0x258ddf[_0x7721('0x2e')](0x194);}return _0x499b87;};}function handleError(_0x343c19,_0x53c904){_0x53c904=_0x53c904||0x1f4;return function(_0x158d98){logger[_0x7721('0x2f')](_0x158d98[_0x7721('0x30')]);if(_0x158d98[_0x7721('0x31')]){delete _0x158d98[_0x7721('0x31')];}_0x343c19['status'](_0x53c904)[_0x7721('0x32')](_0x158d98);};}exports[_0x7721('0x33')]=function(_0x497f9f,_0x4a25c9){var _0xfde9ec={},_0x220bbf={},_0x48f329={'count':0x0,'rows':[]};var _0x46f772=_[_0x7721('0x34')](db[_0x7721('0x35')]['rawAttributes'],function(_0x3d9a32){return{'name':_0x3d9a32[_0x7721('0x36')],'type':_0x3d9a32[_0x7721('0x37')][_0x7721('0x38')]};});_0x220bbf[_0x7721('0x39')]=_['map'](_0x46f772,_0x7721('0x31'));_0x220bbf[_0x7721('0x3a')]=_[_0x7721('0x3b')](_0x497f9f['query']);_0x220bbf[_0x7721('0x3c')]=_[_0x7721('0x3d')](_0x220bbf['model'],_0x220bbf[_0x7721('0x3a')]);_0xfde9ec['attributes']=_[_0x7721('0x3d')](_0x220bbf[_0x7721('0x39')],qs[_0x7721('0x3e')](_0x497f9f[_0x7721('0x3a')][_0x7721('0x3e')]));_0xfde9ec[_0x7721('0x3f')]=_0xfde9ec[_0x7721('0x3f')][_0x7721('0x40')]?_0xfde9ec[_0x7721('0x3f')]:_0x220bbf[_0x7721('0x39')];if(!_0x497f9f[_0x7721('0x3a')]['hasOwnProperty'](_0x7721('0x41'))){_0xfde9ec['limit']=qs[_0x7721('0x21')](_0x497f9f[_0x7721('0x3a')][_0x7721('0x21')]);_0xfde9ec[_0x7721('0x1f')]=qs[_0x7721('0x1f')](_0x497f9f[_0x7721('0x3a')]['offset']);}_0xfde9ec['order']=qs['sort'](_0x497f9f['query'][_0x7721('0x42')]);_0xfde9ec[_0x7721('0x43')]=qs[_0x7721('0x3c')](_[_0x7721('0x44')](_0x497f9f['query'],_0x220bbf[_0x7721('0x3c')]),_0x46f772);if(_0x497f9f['query'][_0x7721('0x45')]){_0xfde9ec[_0x7721('0x43')]=_['merge'](_0xfde9ec[_0x7721('0x43')],{'$or':_[_0x7721('0x34')](_0x46f772,function(_0x4e77ff){if(_0x4e77ff['type']!==_0x7721('0x46')){var _0xfc4dc4={};_0xfc4dc4[_0x4e77ff[_0x7721('0x31')]]={'$like':'%'+_0x497f9f[_0x7721('0x3a')]['filter']+'%'};return _0xfc4dc4;}})});}_0xfde9ec=_[_0x7721('0x47')]({},_0xfde9ec,_0x497f9f[_0x7721('0x48')]);var _0x40ce8c={'where':_0xfde9ec[_0x7721('0x43')]};return db[_0x7721('0x35')]['count'](_0x40ce8c)[_0x7721('0x29')](function(_0x4a2c28){_0x48f329[_0x7721('0x22')]=_0x4a2c28;if(_0x497f9f['query'][_0x7721('0x49')]){_0xfde9ec[_0x7721('0x4a')]=[{'all':!![]}];}return db[_0x7721('0x35')]['findAll'](_0xfde9ec);})[_0x7721('0x29')](function(_0x11d853){_0x48f329[_0x7721('0x4b')]=_0x11d853;return _0x48f329;})['then'](respondWithFilteredResult(_0x4a25c9,_0xfde9ec))[_0x7721('0x4c')](handleError(_0x4a25c9,null));};exports[_0x7721('0x4d')]=function(_0xdb3033,_0x2d5f35){var _0x135dbc={'raw':!![],'where':{'id':_0xdb3033[_0x7721('0x4e')]['id']}},_0x57d09b={};_0x57d09b['model']=_['keys'](db[_0x7721('0x35')][_0x7721('0x4f')]);_0x57d09b[_0x7721('0x3a')]=_[_0x7721('0x3b')](_0xdb3033[_0x7721('0x3a')]);_0x57d09b[_0x7721('0x3c')]=_[_0x7721('0x3d')](_0x57d09b[_0x7721('0x39')],_0x57d09b[_0x7721('0x3a')]);_0x135dbc[_0x7721('0x3f')]=_['intersection'](_0x57d09b['model'],qs[_0x7721('0x3e')](_0xdb3033[_0x7721('0x3a')][_0x7721('0x3e')]));_0x135dbc[_0x7721('0x3f')]=_0x135dbc['attributes'][_0x7721('0x40')]?_0x135dbc[_0x7721('0x3f')]:_0x57d09b['model'];if(_0xdb3033[_0x7721('0x3a')]['includeAll']){_0x135dbc[_0x7721('0x4a')]=[{'all':!![]}];}_0x135dbc=_['merge']({},_0x135dbc,_0xdb3033[_0x7721('0x48')]);return db[_0x7721('0x35')][_0x7721('0x50')](_0x135dbc)['then'](handleEntityNotFound(_0x2d5f35,null))[_0x7721('0x29')](respondWithResult(_0x2d5f35,null))[_0x7721('0x4c')](handleError(_0x2d5f35,null));};exports['create']=function(_0x223d93,_0x1196c2){return db[_0x7721('0x35')]['create'](_0x223d93[_0x7721('0x51')],{})['then'](function(_0xdb1ca8){var _0x310549=_0x223d93[_0x7721('0x52')][_0x7721('0x2b')]({'plain':!![]});if(!_0x310549)throw new Error(_0x7721('0x53'));if(_0x310549[_0x7721('0x54')]===_0x7721('0x52')){var _0x7fbb73=_0xdb1ca8[_0x7721('0x2b')]({'plain':!![]});var _0x3386aa=_0x7721('0x2c');return db[_0x7721('0x55')][_0x7721('0x50')]({'where':{'name':_0x3386aa,'userProfileId':_0x310549[_0x7721('0x56')]},'raw':!![]})[_0x7721('0x29')](function(_0x5b741d){if(_0x5b741d&&_0x5b741d[_0x7721('0x57')]===0x0){return db[_0x7721('0x2d')][_0x7721('0x58')]({'name':_0x7fbb73[_0x7721('0x31')],'resourceId':_0x7fbb73['id'],'type':_0x5b741d[_0x7721('0x31')],'sectionId':_0x5b741d['id']},{})[_0x7721('0x29')](function(){return _0xdb1ca8;});}else{return _0xdb1ca8;}})[_0x7721('0x4c')](function(_0x57484c){logger[_0x7721('0x2f')](_0x7721('0x59'),_0x57484c);throw _0x57484c;});}return _0xdb1ca8;})[_0x7721('0x29')](respondWithResult(_0x1196c2,0xc9))[_0x7721('0x4c')](handleError(_0x1196c2,null));};exports[_0x7721('0x28')]=function(_0x9c0d4,_0x7fbd6c){if(_0x9c0d4[_0x7721('0x51')]['id']){delete _0x9c0d4[_0x7721('0x51')]['id'];}return db[_0x7721('0x35')][_0x7721('0x50')]({'where':{'id':_0x9c0d4['params']['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x7fbd6c,null))[_0x7721('0x29')](saveUpdates(_0x9c0d4[_0x7721('0x51')],null))[_0x7721('0x29')](respondWithResult(_0x7fbd6c,null))[_0x7721('0x4c')](handleError(_0x7fbd6c,null));};exports[_0x7721('0x2a')]=function(_0x41644f,_0x36fe6f){return db[_0x7721('0x35')][_0x7721('0x50')]({'where':{'id':_0x41644f[_0x7721('0x4e')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x36fe6f,null))[_0x7721('0x29')](removeEntity(_0x36fe6f,null))[_0x7721('0x4c')](handleError(_0x36fe6f,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 947cd12..a505da0 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 _0x80c3=['define','AnalyticMetric','analytics_metrics','lodash','api','bluebird','request-promise','path','exports'];(function(_0x4765dd,_0x266998){var _0x2f98dc=function(_0x24ef13){while(--_0x24ef13){_0x4765dd['push'](_0x4765dd['shift']());}};_0x2f98dc(++_0x266998);}(_0x80c3,0x18f));var _0x380c=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x80c3[_0xc6be3a];return _0x56a310;};'use strict';var _=require(_0x380c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x380c('0x1'));var moment=require('moment');var BPromise=require(_0x380c('0x2'));var rp=require(_0x380c('0x3'));var fs=require('fs');var path=require(_0x380c('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./analyticMetric.attributes');module[_0x380c('0x5')]=function(_0x595b66,_0x581c96){return _0x595b66[_0x380c('0x6')](_0x380c('0x7'),attributes,{'tableName':_0x380c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x15b2=['rimraf','../../config/environment','exports','define','AnalyticMetric','analytics_metrics','util','api','moment','request-promise','path'];(function(_0x443847,_0x1e25fa){var _0x4e8088=function(_0x3fac0d){while(--_0x3fac0d){_0x443847['push'](_0x443847['shift']());}};_0x4e8088(++_0x1e25fa);}(_0x15b2,0x145));var _0x215b=function(_0xdb810a,_0x3007f8){_0xdb810a=_0xdb810a-0x0;var _0x3954ba=_0x15b2[_0xdb810a];return _0x3954ba;};'use strict';var _=require('lodash');var util=require(_0x215b('0x0'));var logger=require('../../config/logger')(_0x215b('0x1'));var moment=require(_0x215b('0x2'));var BPromise=require('bluebird');var rp=require(_0x215b('0x3'));var fs=require('fs');var path=require(_0x215b('0x4'));var rimraf=require(_0x215b('0x5'));var config=require(_0x215b('0x6'));var attributes=require('./analyticMetric.attributes');module[_0x215b('0x7')]=function(_0x4ffb8e,_0x2d8ea5){return _0x4ffb8e[_0x215b('0x8')](_0x215b('0x9'),attributes,{'tableName':_0x215b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 9bdf003..b701548 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 _0xe2c4=['AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info'];(function(_0xf9a37a,_0x49a7f1){var _0x2eed8e=function(_0x3035ad){while(--_0x3035ad){_0xf9a37a['push'](_0xf9a37a['shift']());}};_0x2eed8e(++_0x49a7f1);}(_0xe2c4,0x80));var _0x4e2c=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xe2c4[_0x11005e];return _0x29338f;};'use strict';var _=require(_0x4e2c('0x0'));var util=require(_0x4e2c('0x1'));var moment=require('moment');var BPromise=require(_0x4e2c('0x2'));var rs=require(_0x4e2c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4e2c('0x4'))['db'];var utils=require(_0x4e2c('0x5'));var logger=require(_0x4e2c('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4e2c('0x7'));var client=jayson[_0x4e2c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48b7de,_0x464a9f,_0x189b30){return new BPromise(function(_0x1392c3,_0x4a3567){return client[_0x4e2c('0x9')](_0x48b7de,_0x189b30)[_0x4e2c('0xa')](function(_0x109442){logger[_0x4e2c('0xb')](_0x4e2c('0xc'),_0x464a9f,_0x4e2c('0xd'));logger[_0x4e2c('0xe')](_0x4e2c('0xf'),_0x464a9f,_0x4e2c('0xd'),JSON['stringify'](_0x109442));if(_0x109442[_0x4e2c('0x10')]){if(_0x109442[_0x4e2c('0x10')][_0x4e2c('0x11')]===0x1f4){logger[_0x4e2c('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x464a9f,_0x109442[_0x4e2c('0x10')][_0x4e2c('0x12')]);return _0x4a3567(_0x109442['error'][_0x4e2c('0x12')]);}logger[_0x4e2c('0x10')](_0x4e2c('0xc'),_0x464a9f,_0x109442[_0x4e2c('0x10')][_0x4e2c('0x12')]);return _0x1392c3(_0x109442[_0x4e2c('0x10')]['message']);}else{logger[_0x4e2c('0xb')](_0x4e2c('0xc'),_0x464a9f,_0x4e2c('0xd'));_0x1392c3(_0x109442[_0x4e2c('0x13')]['message']);}})['catch'](function(_0x2b7109){logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x464a9f,_0x2b7109);_0x4a3567(_0x2b7109);});});} \ No newline at end of file +var _0x2110=['../../config/environment','jayson/promise','then','info','AnalyticMetric,\x20%s,\x20%s','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','bluebird','../../mysqldb','../../config/logger','rpc'];(function(_0x2e9703,_0x299227){var _0x5056a3=function(_0x36990e){while(--_0x36990e){_0x2e9703['push'](_0x2e9703['shift']());}};_0x5056a3(++_0x299227);}(_0x2110,0x1d6));var _0x0211=function(_0x29f250,_0x258820){_0x29f250=_0x29f250-0x0;var _0x27a149=_0x2110[_0x29f250];return _0x27a149;};'use strict';var _=require(_0x0211('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0211('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0211('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x0211('0x3'))(_0x0211('0x4'));var config=require(_0x0211('0x5'));var jayson=require(_0x0211('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x20f075,_0x12c1c2,_0x912747){return new BPromise(function(_0xb3d19c,_0x39f9cf){return client['request'](_0x20f075,_0x912747)[_0x0211('0x7')](function(_0x5effc5){logger[_0x0211('0x8')](_0x0211('0x9'),_0x12c1c2,'request\x20sent');logger[_0x0211('0xa')](_0x0211('0xb'),_0x12c1c2,_0x0211('0xc'),JSON[_0x0211('0xd')](_0x5effc5));if(_0x5effc5[_0x0211('0xe')]){if(_0x5effc5[_0x0211('0xe')][_0x0211('0xf')]===0x1f4){logger[_0x0211('0xe')](_0x0211('0x9'),_0x12c1c2,_0x5effc5['error'][_0x0211('0x10')]);return _0x39f9cf(_0x5effc5['error'][_0x0211('0x10')]);}logger['error'](_0x0211('0x9'),_0x12c1c2,_0x5effc5[_0x0211('0xe')][_0x0211('0x10')]);return _0xb3d19c(_0x5effc5[_0x0211('0xe')][_0x0211('0x10')]);}else{logger['info'](_0x0211('0x9'),_0x12c1c2,_0x0211('0xc'));_0xb3d19c(_0x5effc5[_0x0211('0x11')]['message']);}})[_0x0211('0x12')](function(_0x50ba0f){logger[_0x0211('0xe')]('AnalyticMetric,\x20%s,\x20%s',_0x12c1c2,_0x50ba0f);_0x39f9cf(_0x50ba0f);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index b72c293..7276f81 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 _0xb091=['/:id','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../config/environment','./analyticMetric.controller','isAuthenticated','index','get','show','post','create','put'];(function(_0x4257b6,_0x2348c7){var _0x4ad68c=function(_0x33a6e8){while(--_0x33a6e8){_0x4257b6['push'](_0x4257b6['shift']());}};_0x4ad68c(++_0x2348c7);}(_0xb091,0x16e));var _0x1b09=function(_0x832044,_0x3bbbb8){_0x832044=_0x832044-0x0;var _0x50759a=_0xb091[_0x832044];return _0x50759a;};'use strict';var multer=require('multer');var util=require(_0x1b09('0x0'));var path=require(_0x1b09('0x1'));var timeout=require(_0x1b09('0x2'));var express=require(_0x1b09('0x3'));var router=express['Router']();var fs_extra=require(_0x1b09('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1b09('0x5'));var controller=require(_0x1b09('0x6'));router['get']('/',auth[_0x1b09('0x7')](),controller[_0x1b09('0x8')]);router[_0x1b09('0x9')]('/:id',auth[_0x1b09('0x7')](),controller[_0x1b09('0xa')]);router[_0x1b09('0xb')]('/',auth[_0x1b09('0x7')](),controller[_0x1b09('0xc')]);router[_0x1b09('0xd')](_0x1b09('0xe'),auth[_0x1b09('0x7')](),controller[_0x1b09('0xf')]);router[_0x1b09('0x10')](_0x1b09('0xe'),auth['isAuthenticated'](),controller[_0x1b09('0x11')]);module[_0x1b09('0x12')]=router; \ No newline at end of file +var _0xeedf=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','post','/:id','update','delete','destroy','exports','multer','util','path','express'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0xeedf,0x12c));var _0xfeed=function(_0xe04363,_0x16fb55){_0xe04363=_0xe04363-0x0;var _0x3aaa62=_0xeedf[_0xe04363];return _0x3aaa62;};'use strict';var multer=require(_0xfeed('0x0'));var util=require(_0xfeed('0x1'));var path=require(_0xfeed('0x2'));var timeout=require('connect-timeout');var express=require(_0xfeed('0x3'));var router=express['Router']();var fs_extra=require(_0xfeed('0x4'));var auth=require(_0xfeed('0x5'));var interaction=require(_0xfeed('0x6'));var config=require(_0xfeed('0x7'));var controller=require('./analyticMetric.controller');router[_0xfeed('0x8')]('/',auth[_0xfeed('0x9')](),controller['index']);router[_0xfeed('0x8')]('/:id',auth[_0xfeed('0x9')](),controller['show']);router[_0xfeed('0xa')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xfeed('0xb'),auth[_0xfeed('0x9')](),controller[_0xfeed('0xc')]);router[_0xfeed('0xd')]('/:id',auth[_0xfeed('0x9')](),controller[_0xfeed('0xe')]);module[_0xfeed('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 98d7f35..7044ac3 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 _0xdaff=['TEXT','sequelize','exports'];(function(_0x541103,_0x357bfe){var _0x5776ea=function(_0x501632){while(--_0x501632){_0x541103['push'](_0x541103['shift']());}};_0x5776ea(++_0x357bfe);}(_0xdaff,0x151));var _0xfdaf=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xdaff[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0xfdaf('0x0'));module[_0xfdaf('0x1')]={'tree':{'type':Sequelize[_0xfdaf('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xcac8=['exports','sequelize'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0xcac8,0x163));var _0x8cac=function(_0x191bba,_0x4f9a31){_0x191bba=_0x191bba-0x0;var _0x20e095=_0xcac8[_0x191bba];return _0x20e095;};'use strict';var Sequelize=require(_0x8cac('0x0'));module[_0x8cac('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 100b9ec..21e1786 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 _0x02bb=['send','index','map','AnalyticTreeReport','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','options','include','findAll','catch','show','params','includeAll','find','create','body','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','reject','update','destroy','then','stack','name'];(function(_0x294190,_0xeedc7a){var _0x5c1ac9=function(_0x5393e6){while(--_0x5393e6){_0x294190['push'](_0x294190['shift']());}};_0x5c1ac9(++_0xeedc7a);}(_0x02bb,0x121));var _0xb02b=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x02bb[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb02b('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb02b('0x1'));var moment=require('moment');var BPromise=require(_0xb02b('0x2'));var Mustache=require(_0xb02b('0x3'));var util=require(_0xb02b('0x4'));var path=require(_0xb02b('0x5'));var sox=require(_0xb02b('0x6'));var csv=require('to-csv');var ejs=require(_0xb02b('0x7'));var fs=require('fs');var fs_extra=require(_0xb02b('0x8'));var _=require(_0xb02b('0x9'));var squel=require(_0xb02b('0xa'));var crypto=require(_0xb02b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb02b('0xc'));var toCsv=require(_0xb02b('0xd'));var querystring=require(_0xb02b('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb02b('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xb02b('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xb02b('0x11'));var config=require(_0xb02b('0x12'));var licenseUtil=require(_0xb02b('0x13'));var db=require(_0xb02b('0x14'))['db'];function respondWithStatusCode(_0x221a3a,_0x29cf14){_0x29cf14=_0x29cf14||0xcc;return function(_0x1c2b77){if(_0x1c2b77){return _0x221a3a[_0xb02b('0x15')](_0x29cf14);}return _0x221a3a[_0xb02b('0x16')](_0x29cf14)[_0xb02b('0x17')]();};}function respondWithResult(_0x4e3943,_0x8dc1d6){_0x8dc1d6=_0x8dc1d6||0xc8;return function(_0x5ef0ff){if(_0x5ef0ff){return _0x4e3943['status'](_0x8dc1d6)[_0xb02b('0x18')](_0x5ef0ff);}};}function respondWithFilteredResult(_0x459087,_0xd47316){return function(_0xb06d64){if(_0xb06d64){var _0x2b78a1=typeof _0xd47316['offset']===_0xb02b('0x19')&&typeof _0xd47316[_0xb02b('0x1a')]===_0xb02b('0x19');var _0x16b966=_0xb06d64[_0xb02b('0x1b')];var _0x42f9e6=_0x2b78a1?0x0:_0xd47316[_0xb02b('0x1c')];var _0x312b26=_0x2b78a1?_0xb06d64['count']:_0xd47316[_0xb02b('0x1c')]+_0xd47316['limit'];var _0x1aab52;if(_0x312b26>=_0x16b966){_0x312b26=_0x16b966;_0x1aab52=0xc8;}else{_0x1aab52=0xce;}_0x459087[_0xb02b('0x16')](_0x1aab52);return _0x459087[_0xb02b('0x1d')]('Content-Range',_0x42f9e6+'-'+_0x312b26+'/'+_0x16b966)[_0xb02b('0x18')](_0xb06d64);}return null;};}function patchUpdates(_0x59245b){return function(_0x241960){try{jsonpatch['apply'](_0x241960,_0x59245b,!![]);}catch(_0x3bec73){return BPromise[_0xb02b('0x1e')](_0x3bec73);}return _0x241960['save']();};}function saveUpdates(_0x5298d7,_0x455fbe){return function(_0x30fe13){if(_0x30fe13){return _0x30fe13[_0xb02b('0x1f')](_0x5298d7)['then'](function(_0x17465c){return _0x17465c;});}return null;};}function removeEntity(_0x128a93,_0x2f600e){return function(_0x1520d1){if(_0x1520d1){return _0x1520d1[_0xb02b('0x20')]()[_0xb02b('0x21')](function(){_0x128a93[_0xb02b('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x406934,_0xe2b979){return function(_0x3aff98){if(!_0x3aff98){_0x406934['sendStatus'](0x194);}return _0x3aff98;};}function handleError(_0x4d4692,_0x5e9fb8){_0x5e9fb8=_0x5e9fb8||0x1f4;return function(_0x2e0300){logger['error'](_0x2e0300[_0xb02b('0x22')]);if(_0x2e0300[_0xb02b('0x23')]){delete _0x2e0300['name'];}_0x4d4692[_0xb02b('0x16')](_0x5e9fb8)[_0xb02b('0x24')](_0x2e0300);};}exports[_0xb02b('0x25')]=function(_0x102b40,_0x28f3bd){var _0xf60185={},_0x57248e={},_0x2d7247={'count':0x0,'rows':[]};var _0x6ab09b=_[_0xb02b('0x26')](db[_0xb02b('0x27')][_0xb02b('0x28')],function(_0x20c970){return{'name':_0x20c970['fieldName'],'type':_0x20c970[_0xb02b('0x29')]['key']};});_0x57248e[_0xb02b('0x2a')]=_['map'](_0x6ab09b,_0xb02b('0x23'));_0x57248e['query']=_[_0xb02b('0x2b')](_0x102b40[_0xb02b('0x2c')]);_0x57248e[_0xb02b('0x2d')]=_[_0xb02b('0x2e')](_0x57248e[_0xb02b('0x2a')],_0x57248e[_0xb02b('0x2c')]);_0xf60185[_0xb02b('0x2f')]=_[_0xb02b('0x2e')](_0x57248e[_0xb02b('0x2a')],qs[_0xb02b('0x30')](_0x102b40[_0xb02b('0x2c')][_0xb02b('0x30')]));_0xf60185['attributes']=_0xf60185['attributes'][_0xb02b('0x31')]?_0xf60185[_0xb02b('0x2f')]:_0x57248e[_0xb02b('0x2a')];if(!_0x102b40[_0xb02b('0x2c')][_0xb02b('0x32')]('nolimit')){_0xf60185[_0xb02b('0x1a')]=qs[_0xb02b('0x1a')](_0x102b40[_0xb02b('0x2c')]['limit']);_0xf60185['offset']=qs[_0xb02b('0x1c')](_0x102b40[_0xb02b('0x2c')][_0xb02b('0x1c')]);}_0xf60185[_0xb02b('0x33')]=qs[_0xb02b('0x34')](_0x102b40[_0xb02b('0x2c')]['sort']);_0xf60185[_0xb02b('0x35')]=qs[_0xb02b('0x2d')](_['pick'](_0x102b40[_0xb02b('0x2c')],_0x57248e['filters']),_0x6ab09b);if(_0x102b40[_0xb02b('0x2c')]['filter']){_0xf60185['where']=_[_0xb02b('0x36')](_0xf60185[_0xb02b('0x35')],{'$or':_[_0xb02b('0x26')](_0x6ab09b,function(_0x2ff7cc){if(_0x2ff7cc[_0xb02b('0x29')]!=='VIRTUAL'){var _0x5f1b08={};_0x5f1b08[_0x2ff7cc[_0xb02b('0x23')]]={'$like':'%'+_0x102b40[_0xb02b('0x2c')]['filter']+'%'};return _0x5f1b08;}})});}_0xf60185=_[_0xb02b('0x36')]({},_0xf60185,_0x102b40[_0xb02b('0x37')]);var _0x286b78={'where':_0xf60185[_0xb02b('0x35')]};return db[_0xb02b('0x27')][_0xb02b('0x1b')](_0x286b78)[_0xb02b('0x21')](function(_0x358fb7){_0x2d7247[_0xb02b('0x1b')]=_0x358fb7;if(_0x102b40[_0xb02b('0x2c')]['includeAll']){_0xf60185[_0xb02b('0x38')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0xb02b('0x39')](_0xf60185);})[_0xb02b('0x21')](function(_0xe29262){_0x2d7247['rows']=_0xe29262;return _0x2d7247;})[_0xb02b('0x21')](respondWithFilteredResult(_0x28f3bd,_0xf60185))[_0xb02b('0x3a')](handleError(_0x28f3bd,null));};exports[_0xb02b('0x3b')]=function(_0x158a0d,_0x42bdb7){var _0xa00bdc={'raw':!![],'where':{'id':_0x158a0d[_0xb02b('0x3c')]['id']}},_0x5068c4={};_0x5068c4[_0xb02b('0x2a')]=_[_0xb02b('0x2b')](db[_0xb02b('0x27')][_0xb02b('0x28')]);_0x5068c4[_0xb02b('0x2c')]=_[_0xb02b('0x2b')](_0x158a0d[_0xb02b('0x2c')]);_0x5068c4[_0xb02b('0x2d')]=_[_0xb02b('0x2e')](_0x5068c4[_0xb02b('0x2a')],_0x5068c4[_0xb02b('0x2c')]);_0xa00bdc['attributes']=_['intersection'](_0x5068c4[_0xb02b('0x2a')],qs[_0xb02b('0x30')](_0x158a0d[_0xb02b('0x2c')][_0xb02b('0x30')]));_0xa00bdc[_0xb02b('0x2f')]=_0xa00bdc['attributes'][_0xb02b('0x31')]?_0xa00bdc[_0xb02b('0x2f')]:_0x5068c4[_0xb02b('0x2a')];if(_0x158a0d[_0xb02b('0x2c')][_0xb02b('0x3d')]){_0xa00bdc[_0xb02b('0x38')]=[{'all':!![]}];}_0xa00bdc=_[_0xb02b('0x36')]({},_0xa00bdc,_0x158a0d['options']);return db['AnalyticTreeReport'][_0xb02b('0x3e')](_0xa00bdc)['then'](handleEntityNotFound(_0x42bdb7,null))[_0xb02b('0x21')](respondWithResult(_0x42bdb7,null))[_0xb02b('0x3a')](handleError(_0x42bdb7,null));};exports['create']=function(_0x13bd46,_0x39ff43){return db[_0xb02b('0x27')][_0xb02b('0x3f')](_0x13bd46[_0xb02b('0x40')],{})[_0xb02b('0x21')](respondWithResult(_0x39ff43,0xc9))[_0xb02b('0x3a')](handleError(_0x39ff43,null));};exports['update']=function(_0x483447,_0x4ad69e){if(_0x483447[_0xb02b('0x40')]['id']){delete _0x483447['body']['id'];}return db[_0xb02b('0x27')][_0xb02b('0x3e')]({'where':{'id':_0x483447[_0xb02b('0x3c')]['id']}})[_0xb02b('0x21')](handleEntityNotFound(_0x4ad69e,null))['then'](saveUpdates(_0x483447[_0xb02b('0x40')],null))[_0xb02b('0x21')](respondWithResult(_0x4ad69e,null))[_0xb02b('0x3a')](handleError(_0x4ad69e,null));};exports['destroy']=function(_0xc5b171,_0x4a3069){return db[_0xb02b('0x27')]['find']({'where':{'id':_0xc5b171['params']['id']}})[_0xb02b('0x21')](handleEntityNotFound(_0x4a3069,null))['then'](removeEntity(_0x4a3069,null))[_0xb02b('0x3a')](handleError(_0x4a3069,null));}; \ No newline at end of file +var _0xc143=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','sendStatus','end','status','json','offset','undefined','limit','count','set','save','then','error','stack','name','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','create','body','update','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0xc143,0x7f));var _0x3c14=function(_0x4022dd,_0x3c66b3){_0x4022dd=_0x4022dd-0x0;var _0x3ce86e=_0xc143[_0x4022dd];return _0x3ce86e;};'use strict';var emlformat=require(_0x3c14('0x0'));var rimraf=require(_0x3c14('0x1'));var zipdir=require(_0x3c14('0x2'));var jsonpatch=require(_0x3c14('0x3'));var rp=require(_0x3c14('0x4'));var moment=require(_0x3c14('0x5'));var BPromise=require(_0x3c14('0x6'));var Mustache=require(_0x3c14('0x7'));var util=require('util');var path=require(_0x3c14('0x8'));var sox=require(_0x3c14('0x9'));var csv=require(_0x3c14('0xa'));var ejs=require(_0x3c14('0xb'));var fs=require('fs');var fs_extra=require(_0x3c14('0xc'));var _=require(_0x3c14('0xd'));var squel=require(_0x3c14('0xe'));var crypto=require(_0x3c14('0xf'));var jsforce=require(_0x3c14('0x10'));var deskjs=require(_0x3c14('0x11'));var toCsv=require('to-csv');var querystring=require(_0x3c14('0x12'));var Papa=require('papaparse');var Redis=require(_0x3c14('0x13'));var authService=require(_0x3c14('0x14'));var qs=require(_0x3c14('0x15'));var as=require(_0x3c14('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3c14('0x17'))(_0x3c14('0x18'));var utils=require(_0x3c14('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x241e52,_0x2483ab){_0x2483ab=_0x2483ab||0xcc;return function(_0x13411e){if(_0x13411e){return _0x241e52[_0x3c14('0x1a')](_0x2483ab);}return _0x241e52['status'](_0x2483ab)[_0x3c14('0x1b')]();};}function respondWithResult(_0xbe8b83,_0x4cb2ec){_0x4cb2ec=_0x4cb2ec||0xc8;return function(_0x17886f){if(_0x17886f){return _0xbe8b83[_0x3c14('0x1c')](_0x4cb2ec)[_0x3c14('0x1d')](_0x17886f);}};}function respondWithFilteredResult(_0x5dc65b,_0x16e081){return function(_0x48e38b){if(_0x48e38b){var _0x273220=typeof _0x16e081[_0x3c14('0x1e')]===_0x3c14('0x1f')&&typeof _0x16e081[_0x3c14('0x20')]===_0x3c14('0x1f');var _0x49d1c0=_0x48e38b[_0x3c14('0x21')];var _0x4f5d00=_0x273220?0x0:_0x16e081[_0x3c14('0x1e')];var _0x587fbe=_0x273220?_0x48e38b[_0x3c14('0x21')]:_0x16e081['offset']+_0x16e081[_0x3c14('0x20')];var _0x4f053e;if(_0x587fbe>=_0x49d1c0){_0x587fbe=_0x49d1c0;_0x4f053e=0xc8;}else{_0x4f053e=0xce;}_0x5dc65b[_0x3c14('0x1c')](_0x4f053e);return _0x5dc65b[_0x3c14('0x22')]('Content-Range',_0x4f5d00+'-'+_0x587fbe+'/'+_0x49d1c0)[_0x3c14('0x1d')](_0x48e38b);}return null;};}function patchUpdates(_0x5ae146){return function(_0x270e9e){try{jsonpatch['apply'](_0x270e9e,_0x5ae146,!![]);}catch(_0xbfc428){return BPromise['reject'](_0xbfc428);}return _0x270e9e[_0x3c14('0x23')]();};}function saveUpdates(_0x3ccf6b,_0x34804e){return function(_0x246140){if(_0x246140){return _0x246140['update'](_0x3ccf6b)[_0x3c14('0x24')](function(_0x39f6b4){return _0x39f6b4;});}return null;};}function removeEntity(_0x5ec1eb,_0x5b32ed){return function(_0xd54ee){if(_0xd54ee){return _0xd54ee['destroy']()['then'](function(){_0x5ec1eb[_0x3c14('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d8c59,_0x3ec186){return function(_0x125381){if(!_0x125381){_0x2d8c59[_0x3c14('0x1a')](0x194);}return _0x125381;};}function handleError(_0x1d1964,_0x88db49){_0x88db49=_0x88db49||0x1f4;return function(_0x4d32e5){logger[_0x3c14('0x25')](_0x4d32e5[_0x3c14('0x26')]);if(_0x4d32e5[_0x3c14('0x27')]){delete _0x4d32e5[_0x3c14('0x27')];}_0x1d1964['status'](_0x88db49)['send'](_0x4d32e5);};}exports['index']=function(_0xffe014,_0x5c0ea8){var _0x516fe2={},_0x492f04={},_0x3a348a={'count':0x0,'rows':[]};var _0x5711cd=_['map'](db[_0x3c14('0x28')][_0x3c14('0x29')],function(_0x2c791f){return{'name':_0x2c791f[_0x3c14('0x2a')],'type':_0x2c791f[_0x3c14('0x2b')][_0x3c14('0x2c')]};});_0x492f04[_0x3c14('0x2d')]=_[_0x3c14('0x2e')](_0x5711cd,_0x3c14('0x27'));_0x492f04[_0x3c14('0x2f')]=_['keys'](_0xffe014[_0x3c14('0x2f')]);_0x492f04['filters']=_[_0x3c14('0x30')](_0x492f04['model'],_0x492f04[_0x3c14('0x2f')]);_0x516fe2[_0x3c14('0x31')]=_['intersection'](_0x492f04[_0x3c14('0x2d')],qs[_0x3c14('0x32')](_0xffe014[_0x3c14('0x2f')][_0x3c14('0x32')]));_0x516fe2[_0x3c14('0x31')]=_0x516fe2[_0x3c14('0x31')]['length']?_0x516fe2[_0x3c14('0x31')]:_0x492f04[_0x3c14('0x2d')];if(!_0xffe014[_0x3c14('0x2f')][_0x3c14('0x33')](_0x3c14('0x34'))){_0x516fe2[_0x3c14('0x20')]=qs[_0x3c14('0x20')](_0xffe014[_0x3c14('0x2f')][_0x3c14('0x20')]);_0x516fe2['offset']=qs[_0x3c14('0x1e')](_0xffe014[_0x3c14('0x2f')][_0x3c14('0x1e')]);}_0x516fe2[_0x3c14('0x35')]=qs[_0x3c14('0x36')](_0xffe014[_0x3c14('0x2f')][_0x3c14('0x36')]);_0x516fe2[_0x3c14('0x37')]=qs[_0x3c14('0x38')](_[_0x3c14('0x39')](_0xffe014['query'],_0x492f04['filters']),_0x5711cd);if(_0xffe014[_0x3c14('0x2f')][_0x3c14('0x3a')]){_0x516fe2[_0x3c14('0x37')]=_[_0x3c14('0x3b')](_0x516fe2['where'],{'$or':_[_0x3c14('0x2e')](_0x5711cd,function(_0x10799e){if(_0x10799e['type']!==_0x3c14('0x3c')){var _0x46a4be={};_0x46a4be[_0x10799e['name']]={'$like':'%'+_0xffe014[_0x3c14('0x2f')]['filter']+'%'};return _0x46a4be;}})});}_0x516fe2=_[_0x3c14('0x3b')]({},_0x516fe2,_0xffe014[_0x3c14('0x3d')]);var _0x13acfb={'where':_0x516fe2[_0x3c14('0x37')]};return db['AnalyticTreeReport']['count'](_0x13acfb)[_0x3c14('0x24')](function(_0x3ac865){_0x3a348a[_0x3c14('0x21')]=_0x3ac865;if(_0xffe014[_0x3c14('0x2f')][_0x3c14('0x3e')]){_0x516fe2[_0x3c14('0x3f')]=[{'all':!![]}];}return db[_0x3c14('0x28')][_0x3c14('0x40')](_0x516fe2);})[_0x3c14('0x24')](function(_0x2d05d5){_0x3a348a['rows']=_0x2d05d5;return _0x3a348a;})['then'](respondWithFilteredResult(_0x5c0ea8,_0x516fe2))[_0x3c14('0x41')](handleError(_0x5c0ea8,null));};exports[_0x3c14('0x42')]=function(_0x375ae2,_0x504168){var _0x26c5cd={'raw':!![],'where':{'id':_0x375ae2[_0x3c14('0x43')]['id']}},_0x557273={};_0x557273[_0x3c14('0x2d')]=_['keys'](db['AnalyticTreeReport']['rawAttributes']);_0x557273[_0x3c14('0x2f')]=_[_0x3c14('0x44')](_0x375ae2[_0x3c14('0x2f')]);_0x557273[_0x3c14('0x38')]=_['intersection'](_0x557273['model'],_0x557273['query']);_0x26c5cd[_0x3c14('0x31')]=_[_0x3c14('0x30')](_0x557273[_0x3c14('0x2d')],qs[_0x3c14('0x32')](_0x375ae2[_0x3c14('0x2f')][_0x3c14('0x32')]));_0x26c5cd['attributes']=_0x26c5cd[_0x3c14('0x31')]['length']?_0x26c5cd['attributes']:_0x557273[_0x3c14('0x2d')];if(_0x375ae2[_0x3c14('0x2f')][_0x3c14('0x3e')]){_0x26c5cd[_0x3c14('0x3f')]=[{'all':!![]}];}_0x26c5cd=_[_0x3c14('0x3b')]({},_0x26c5cd,_0x375ae2[_0x3c14('0x3d')]);return db[_0x3c14('0x28')]['find'](_0x26c5cd)[_0x3c14('0x24')](handleEntityNotFound(_0x504168,null))['then'](respondWithResult(_0x504168,null))[_0x3c14('0x41')](handleError(_0x504168,null));};exports[_0x3c14('0x45')]=function(_0x207621,_0x5a6ccc){return db['AnalyticTreeReport'][_0x3c14('0x45')](_0x207621[_0x3c14('0x46')],{})[_0x3c14('0x24')](respondWithResult(_0x5a6ccc,0xc9))[_0x3c14('0x41')](handleError(_0x5a6ccc,null));};exports[_0x3c14('0x47')]=function(_0x238243,_0x1c7e96){if(_0x238243[_0x3c14('0x46')]['id']){delete _0x238243['body']['id'];}return db[_0x3c14('0x28')][_0x3c14('0x48')]({'where':{'id':_0x238243[_0x3c14('0x43')]['id']}})[_0x3c14('0x24')](handleEntityNotFound(_0x1c7e96,null))[_0x3c14('0x24')](saveUpdates(_0x238243[_0x3c14('0x46')],null))[_0x3c14('0x24')](respondWithResult(_0x1c7e96,null))[_0x3c14('0x41')](handleError(_0x1c7e96,null));};exports[_0x3c14('0x49')]=function(_0x52c6cf,_0x543ab9){return db[_0x3c14('0x28')][_0x3c14('0x48')]({'where':{'id':_0x52c6cf[_0x3c14('0x43')]['id']}})[_0x3c14('0x24')](handleEntityNotFound(_0x543ab9,null))[_0x3c14('0x24')](removeEntity(_0x543ab9,null))[_0x3c14('0x41')](handleError(_0x543ab9,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index b7c57e8..7a5bf49 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 _0x5ad9=['request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird'];(function(_0x26462e,_0x416ff7){var _0x31c3f0=function(_0xd387ea){while(--_0xd387ea){_0x26462e['push'](_0x26462e['shift']());}};_0x31c3f0(++_0x416ff7);}(_0x5ad9,0xc7));var _0x95ad=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x5ad9[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x95ad('0x0'));var util=require('util');var logger=require(_0x95ad('0x1'))(_0x95ad('0x2'));var moment=require(_0x95ad('0x3'));var BPromise=require(_0x95ad('0x4'));var rp=require(_0x95ad('0x5'));var fs=require('fs');var path=require(_0x95ad('0x6'));var rimraf=require(_0x95ad('0x7'));var config=require(_0x95ad('0x8'));var attributes=require(_0x95ad('0x9'));module[_0x95ad('0xa')]=function(_0x31cdb4,_0xe49a61){return _0x31cdb4[_0x95ad('0xb')]('AnalyticTreeReport',attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdae9=['analytics_report_trees','util','api','bluebird','path','rimraf','../../config/environment','exports','define','AnalyticTreeReport'];(function(_0x57ac3b,_0x32e884){var _0x4204c9=function(_0x54a70e){while(--_0x54a70e){_0x57ac3b['push'](_0x57ac3b['shift']());}};_0x4204c9(++_0x32e884);}(_0xdae9,0x155));var _0x9dae=function(_0x4de586,_0x183427){_0x4de586=_0x4de586-0x0;var _0x46baf5=_0xdae9[_0x4de586];return _0x46baf5;};'use strict';var _=require('lodash');var util=require(_0x9dae('0x0'));var logger=require('../../config/logger')(_0x9dae('0x1'));var moment=require('moment');var BPromise=require(_0x9dae('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9dae('0x3'));var rimraf=require(_0x9dae('0x4'));var config=require(_0x9dae('0x5'));var attributes=require('./analyticTreeReport.attributes');module[_0x9dae('0x6')]=function(_0x19b8ad,_0x4edb2e){return _0x19b8ad[_0x9dae('0x7')](_0x9dae('0x8'),attributes,{'tableName':_0x9dae('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 081cbaf..1576c04 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 _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x22e162,_0x525978){var _0x34ea12=function(_0xfc0866){while(--_0xfc0866){_0x22e162['push'](_0x22e162['shift']());}};_0x34ea12(++_0x525978);}(_0x5f66,0x1a0));var _0x65f6=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5f66[_0x17d9e3];return _0x14192d;};'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});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('AnalyticTreeReport,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file +var _0x1261=['then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x34aa7b,_0x2f63a4){var _0x414d26=function(_0x4ba495){while(--_0x4ba495){_0x34aa7b['push'](_0x34aa7b['shift']());}};_0x414d26(++_0x2f63a4);}(_0x1261,0x144));var _0x1126=function(_0x1cd585,_0x54276b){_0x1cd585=_0x1cd585-0x0;var _0x3ca87f=_0x1261[_0x1cd585];return _0x3ca87f;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index bc3d99a..ac91afa 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 _0x75da=['isAuthenticated','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get'];(function(_0x59e26c,_0x225c23){var _0x5881af=function(_0x33050c){while(--_0x33050c){_0x59e26c['push'](_0x59e26c['shift']());}};_0x5881af(++_0x225c23);}(_0x75da,0x15d));var _0xa75d=function(_0x5aedbc,_0x41eab8){_0x5aedbc=_0x5aedbc-0x0;var _0xc9a701=_0x75da[_0x5aedbc];return _0xc9a701;};'use strict';var multer=require(_0xa75d('0x0'));var util=require(_0xa75d('0x1'));var path=require(_0xa75d('0x2'));var timeout=require('connect-timeout');var express=require(_0xa75d('0x3'));var router=express[_0xa75d('0x4')]();var fs_extra=require(_0xa75d('0x5'));var auth=require(_0xa75d('0x6'));var interaction=require(_0xa75d('0x7'));var config=require(_0xa75d('0x8'));var controller=require(_0xa75d('0x9'));router[_0xa75d('0xa')]('/',auth[_0xa75d('0xb')](),controller['index']);router[_0xa75d('0xa')](_0xa75d('0xc'),auth[_0xa75d('0xb')](),controller[_0xa75d('0xd')]);router[_0xa75d('0xe')]('/',auth[_0xa75d('0xb')](),controller[_0xa75d('0xf')]);router['put'](_0xa75d('0xc'),auth[_0xa75d('0xb')](),controller[_0xa75d('0x10')]);router[_0xa75d('0x11')](_0xa75d('0xc'),auth[_0xa75d('0xb')](),controller[_0xa75d('0x12')]);module[_0xa75d('0x13')]=router; \ No newline at end of file +var _0x0be5=['../../components/interaction/service','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x13639d,_0x3c996b){var _0x52ef14=function(_0x3faf51){while(--_0x3faf51){_0x13639d['push'](_0x13639d['shift']());}};_0x52ef14(++_0x3c996b);}(_0x0be5,0x177));var _0x50be=function(_0x23ca2f,_0x271c2b){_0x23ca2f=_0x23ca2f-0x0;var _0x4f4b51=_0x0be5[_0x23ca2f];return _0x4f4b51;};'use strict';var multer=require(_0x50be('0x0'));var util=require(_0x50be('0x1'));var path=require(_0x50be('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x50be('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x50be('0x4'));var interaction=require(_0x50be('0x5'));var config=require('../../config/environment');var controller=require(_0x50be('0x6'));router[_0x50be('0x7')]('/',auth[_0x50be('0x8')](),controller[_0x50be('0x9')]);router[_0x50be('0x7')](_0x50be('0xa'),auth[_0x50be('0x8')](),controller[_0x50be('0xb')]);router[_0x50be('0xc')]('/',auth['isAuthenticated'](),controller[_0x50be('0xd')]);router[_0x50be('0xe')](_0x50be('0xa'),auth[_0x50be('0x8')](),controller[_0x50be('0xf')]);router[_0x50be('0x10')](_0x50be('0xa'),auth[_0x50be('0x8')](),controller[_0x50be('0x11')]);module[_0x50be('0x12')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index abf1a38..8df5ebd 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 _0x402f=['STRING','sequelize'];(function(_0x413280,_0x4e63cf){var _0xd03c26=function(_0x1ee1d2){while(--_0x1ee1d2){_0x413280['push'](_0x413280['shift']());}};_0xd03c26(++_0x4e63cf);}(_0x402f,0x6f));var _0xf402=function(_0x371233,_0x406e5e){_0x371233=_0x371233-0x0;var _0x4bd097=_0x402f[_0x371233];return _0x4bd097;};'use strict';var Sequelize=require(_0xf402('0x0'));module['exports']={'name':{'type':Sequelize[_0xf402('0x1')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6658=['sequelize','exports','STRING'];(function(_0x404fff,_0x6ddf8){var _0x31700b=function(_0x1b7fd9){while(--_0x1b7fd9){_0x404fff['push'](_0x404fff['shift']());}};_0x31700b(++_0x6ddf8);}(_0x6658,0x198));var _0x8665=function(_0x4b8793,_0x24d145){_0x4b8793=_0x4b8793-0x0;var _0x3a8b37=_0x6658[_0x4b8793];return _0x3a8b37;};'use strict';var Sequelize=require(_0x8665('0x0'));module[_0x8665('0x1')]={'name':{'type':Sequelize[_0x8665('0x2')]},'basename':{'type':Sequelize[_0x8665('0x2')]},'type':{'type':Sequelize[_0x8665('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index fc95cc5..96d346a 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 _0x5c48=['key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','Attachment','count','includeAll','include','findAll','rows','show','params','find','catch','clone','get','omit','createdAt','updatedAt','body','create','originalname','filename','file','mimetype','download','ChatOfflineMessageId','server/files/attachments/','join','offline-chat/','basename','rimraf','moment','mustache','sox','to-csv','ejs','lodash','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','Content-Range','json','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','rawAttributes','type'];(function(_0x435938,_0x2142c7){var _0x2e660a=function(_0x43378e){while(--_0x43378e){_0x435938['push'](_0x435938['shift']());}};_0x2e660a(++_0x2142c7);}(_0x5c48,0x125));var _0x85c4=function(_0x4c6ee3,_0x296be9){_0x4c6ee3=_0x4c6ee3-0x0;var _0x750506=_0x5c48[_0x4c6ee3];return _0x750506;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x85c4('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x85c4('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x85c4('0x2'));var util=require('util');var path=require('path');var sox=require(_0x85c4('0x3'));var csv=require(_0x85c4('0x4'));var ejs=require(_0x85c4('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x85c4('0x6'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x85c4('0x7'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x85c4('0x8'));var Redis=require('ioredis');var authService=require(_0x85c4('0x9'));var qs=require(_0x85c4('0xa'));var as=require(_0x85c4('0xb'));var hardwareService=require(_0x85c4('0xc'));var logger=require('../../config/logger')(_0x85c4('0xd'));var utils=require(_0x85c4('0xe'));var config=require(_0x85c4('0xf'));var licenseUtil=require(_0x85c4('0x10'));var db=require(_0x85c4('0x11'))['db'];function respondWithStatusCode(_0x6ac06e,_0x38dfa7){_0x38dfa7=_0x38dfa7||0xcc;return function(_0x4d1638){if(_0x4d1638){return _0x6ac06e[_0x85c4('0x12')](_0x38dfa7);}return _0x6ac06e['status'](_0x38dfa7)['end']();};}function respondWithResult(_0x587549,_0x4758d2){_0x4758d2=_0x4758d2||0xc8;return function(_0x43294d){if(_0x43294d){return _0x587549[_0x85c4('0x13')](_0x4758d2)['json'](_0x43294d);}};}function respondWithFilteredResult(_0x5aeae9,_0x41bc0b){return function(_0x1a670e){if(_0x1a670e){var _0x4f4888=typeof _0x41bc0b[_0x85c4('0x14')]===_0x85c4('0x15')&&typeof _0x41bc0b[_0x85c4('0x16')]==='undefined';var _0xdfd361=_0x1a670e['count'];var _0x3652c9=_0x4f4888?0x0:_0x41bc0b[_0x85c4('0x14')];var _0x3abd05=_0x4f4888?_0x1a670e['count']:_0x41bc0b[_0x85c4('0x14')]+_0x41bc0b[_0x85c4('0x16')];var _0x463634;if(_0x3abd05>=_0xdfd361){_0x3abd05=_0xdfd361;_0x463634=0xc8;}else{_0x463634=0xce;}_0x5aeae9['status'](_0x463634);return _0x5aeae9['set'](_0x85c4('0x17'),_0x3652c9+'-'+_0x3abd05+'/'+_0xdfd361)[_0x85c4('0x18')](_0x1a670e);}return null;};}function patchUpdates(_0x4982ac){return function(_0x31c778){try{jsonpatch[_0x85c4('0x19')](_0x31c778,_0x4982ac,!![]);}catch(_0x244373){return BPromise[_0x85c4('0x1a')](_0x244373);}return _0x31c778[_0x85c4('0x1b')]();};}function saveUpdates(_0x333f14,_0x36fef4){return function(_0x33a00e){if(_0x33a00e){return _0x33a00e[_0x85c4('0x1c')](_0x333f14)[_0x85c4('0x1d')](function(_0x1bb24c){return _0x1bb24c;});}return null;};}function removeEntity(_0x670dc0,_0x1fabf5){return function(_0x3787f0){if(_0x3787f0){return _0x3787f0[_0x85c4('0x1e')]()[_0x85c4('0x1d')](function(){_0x670dc0[_0x85c4('0x13')](0xcc)[_0x85c4('0x1f')]();});}};}function handleEntityNotFound(_0x414dc6,_0x135f60){return function(_0x41ac56){if(!_0x41ac56){_0x414dc6[_0x85c4('0x12')](0x194);}return _0x41ac56;};}function handleError(_0x2624db,_0x484c6b){_0x484c6b=_0x484c6b||0x1f4;return function(_0x23a963){logger['error'](_0x23a963[_0x85c4('0x20')]);if(_0x23a963[_0x85c4('0x21')]){delete _0x23a963[_0x85c4('0x21')];}_0x2624db[_0x85c4('0x13')](_0x484c6b)[_0x85c4('0x22')](_0x23a963);};}exports[_0x85c4('0x23')]=function(_0x11faf3,_0x41f774){var _0xd102e2={},_0x1acc9c={},_0x30958e={'count':0x0,'rows':[]};var _0x106515=_[_0x85c4('0x24')](db['Attachment'][_0x85c4('0x25')],function(_0x37fb57){return{'name':_0x37fb57['fieldName'],'type':_0x37fb57[_0x85c4('0x26')][_0x85c4('0x27')]};});_0x1acc9c[_0x85c4('0x28')]=_[_0x85c4('0x24')](_0x106515,_0x85c4('0x21'));_0x1acc9c[_0x85c4('0x29')]=_[_0x85c4('0x2a')](_0x11faf3['query']);_0x1acc9c[_0x85c4('0x2b')]=_[_0x85c4('0x2c')](_0x1acc9c[_0x85c4('0x28')],_0x1acc9c[_0x85c4('0x29')]);_0xd102e2[_0x85c4('0x2d')]=_[_0x85c4('0x2c')](_0x1acc9c['model'],qs[_0x85c4('0x2e')](_0x11faf3[_0x85c4('0x29')][_0x85c4('0x2e')]));_0xd102e2[_0x85c4('0x2d')]=_0xd102e2['attributes'][_0x85c4('0x2f')]?_0xd102e2['attributes']:_0x1acc9c[_0x85c4('0x28')];if(!_0x11faf3[_0x85c4('0x29')][_0x85c4('0x30')](_0x85c4('0x31'))){_0xd102e2[_0x85c4('0x16')]=qs[_0x85c4('0x16')](_0x11faf3['query'][_0x85c4('0x16')]);_0xd102e2[_0x85c4('0x14')]=qs[_0x85c4('0x14')](_0x11faf3['query']['offset']);}_0xd102e2[_0x85c4('0x32')]=qs['sort'](_0x11faf3[_0x85c4('0x29')][_0x85c4('0x33')]);_0xd102e2[_0x85c4('0x34')]=qs[_0x85c4('0x2b')](_['pick'](_0x11faf3[_0x85c4('0x29')],_0x1acc9c[_0x85c4('0x2b')]),_0x106515);if(_0x11faf3[_0x85c4('0x29')][_0x85c4('0x35')]){_0xd102e2[_0x85c4('0x34')]=_['merge'](_0xd102e2[_0x85c4('0x34')],{'$or':_['map'](_0x106515,function(_0x5eaac2){if(_0x5eaac2[_0x85c4('0x26')]!==_0x85c4('0x36')){var _0x54ffb7={};_0x54ffb7[_0x5eaac2['name']]={'$like':'%'+_0x11faf3[_0x85c4('0x29')][_0x85c4('0x35')]+'%'};return _0x54ffb7;}})});}_0xd102e2=_[_0x85c4('0x37')]({},_0xd102e2,_0x11faf3['options']);var _0x212d56={'where':_0xd102e2[_0x85c4('0x34')]};return db[_0x85c4('0x38')][_0x85c4('0x39')](_0x212d56)[_0x85c4('0x1d')](function(_0x31035f){_0x30958e[_0x85c4('0x39')]=_0x31035f;if(_0x11faf3[_0x85c4('0x29')][_0x85c4('0x3a')]){_0xd102e2[_0x85c4('0x3b')]=[{'all':!![]}];}return db[_0x85c4('0x38')][_0x85c4('0x3c')](_0xd102e2);})[_0x85c4('0x1d')](function(_0x52e552){_0x30958e[_0x85c4('0x3d')]=_0x52e552;return _0x30958e;})[_0x85c4('0x1d')](respondWithFilteredResult(_0x41f774,_0xd102e2))['catch'](handleError(_0x41f774,null));};exports[_0x85c4('0x3e')]=function(_0x22863c,_0x18732a){var _0x2e7a59={'raw':!![],'where':{'id':_0x22863c[_0x85c4('0x3f')]['id']}},_0x586903={};_0x586903[_0x85c4('0x28')]=_[_0x85c4('0x2a')](db['Attachment'][_0x85c4('0x25')]);_0x586903[_0x85c4('0x29')]=_[_0x85c4('0x2a')](_0x22863c[_0x85c4('0x29')]);_0x586903[_0x85c4('0x2b')]=_[_0x85c4('0x2c')](_0x586903[_0x85c4('0x28')],_0x586903[_0x85c4('0x29')]);_0x2e7a59[_0x85c4('0x2d')]=_[_0x85c4('0x2c')](_0x586903['model'],qs['fields'](_0x22863c[_0x85c4('0x29')][_0x85c4('0x2e')]));_0x2e7a59[_0x85c4('0x2d')]=_0x2e7a59['attributes'][_0x85c4('0x2f')]?_0x2e7a59['attributes']:_0x586903['model'];if(_0x22863c['query'][_0x85c4('0x3a')]){_0x2e7a59[_0x85c4('0x3b')]=[{'all':!![]}];}_0x2e7a59=_[_0x85c4('0x37')]({},_0x2e7a59,_0x22863c['options']);return db[_0x85c4('0x38')][_0x85c4('0x40')](_0x2e7a59)[_0x85c4('0x1d')](handleEntityNotFound(_0x18732a,null))[_0x85c4('0x1d')](respondWithResult(_0x18732a,null))[_0x85c4('0x41')](handleError(_0x18732a,null));};exports[_0x85c4('0x42')]=function(_0x176e1e,_0x34cb79){var _0x214683={'where':{'id':_0x176e1e['params']['id']}},_0x5c9d41={};_0x5c9d41[_0x85c4('0x28')]=_[_0x85c4('0x2a')](db[_0x85c4('0x38')][_0x85c4('0x25')]);_0x214683['attributes']=_['intersection'](_0x5c9d41[_0x85c4('0x28')],qs['fields'](_0x176e1e[_0x85c4('0x29')][_0x85c4('0x2e')]));_0x214683[_0x85c4('0x2d')]=_0x214683[_0x85c4('0x2d')][_0x85c4('0x2f')]?_0x214683['attributes']:_0x5c9d41['model'];if(_0x176e1e[_0x85c4('0x29')][_0x85c4('0x3a')]){_0x214683[_0x85c4('0x3b')]=[{'all':!![]}];}_0x214683=_[_0x85c4('0x37')]({},_0x214683,_0x176e1e['options']);return db['Attachment'][_0x85c4('0x40')](_0x214683)[_0x85c4('0x1d')](handleEntityNotFound(_0x34cb79,null))[_0x85c4('0x1d')](function(_0x59d6bd){if(_0x59d6bd){var _0x1759eb=_0x59d6bd[_0x85c4('0x43')]({'plain':!![]});_0x1759eb=qs[_0x85c4('0x44')](_0x1759eb,['id',_0x85c4('0x45'),_0x85c4('0x46')]);_0x176e1e[_0x85c4('0x47')]=_[_0x85c4('0x44')](_0x176e1e[_0x85c4('0x47')],['id',_0x85c4('0x45'),_0x85c4('0x46')]);return db[_0x85c4('0x38')][_0x85c4('0x48')](_[_0x85c4('0x37')](_0x1759eb,_0x176e1e['body']),{'include':_0x176e1e[_0x85c4('0x29')][_0x85c4('0x3a')]?[{'all':!![]}]:undefined});}})[_0x85c4('0x1d')](respondWithResult(_0x34cb79,0xc9))[_0x85c4('0x41')](handleError(_0x34cb79,null));};exports[_0x85c4('0x1c')]=function(_0x5e7bd9,_0x513744){if(_0x5e7bd9[_0x85c4('0x47')]['id']){delete _0x5e7bd9[_0x85c4('0x47')]['id'];}return db['Attachment'][_0x85c4('0x40')]({'where':{'id':_0x5e7bd9[_0x85c4('0x3f')]['id']}})[_0x85c4('0x1d')](handleEntityNotFound(_0x513744,null))[_0x85c4('0x1d')](saveUpdates(_0x5e7bd9[_0x85c4('0x47')],null))[_0x85c4('0x1d')](respondWithResult(_0x513744,null))[_0x85c4('0x41')](handleError(_0x513744,null));};exports[_0x85c4('0x1e')]=function(_0x3fb2f3,_0x21a704){return db[_0x85c4('0x38')]['find']({'where':{'id':_0x3fb2f3[_0x85c4('0x3f')]['id']}})[_0x85c4('0x1d')](handleEntityNotFound(_0x21a704,null))[_0x85c4('0x1d')](removeEntity(_0x21a704,null))['catch'](handleError(_0x21a704,null));};exports['create']=function(_0x2f4fa2,_0x578e7b,_0x42fecb){_0x2f4fa2[_0x85c4('0x47')]['name']=_0x2f4fa2['file'][_0x85c4('0x49')];_0x2f4fa2[_0x85c4('0x47')]['basename']=_0x2f4fa2['file'][_0x85c4('0x4a')];_0x2f4fa2[_0x85c4('0x47')][_0x85c4('0x26')]=_0x2f4fa2[_0x85c4('0x4b')][_0x85c4('0x4c')];return db['Attachment']['create'](_0x2f4fa2['body'])[_0x85c4('0x1d')](respondWithResult(_0x578e7b,0xc9))[_0x85c4('0x41')](handleError(_0x578e7b,null));};exports[_0x85c4('0x4d')]=function(_0x3a7a6b,_0x2c2f5f,_0x21f585){return db[_0x85c4('0x38')]['findOne']({'where':{'id':_0x3a7a6b[_0x85c4('0x3f')]['id']},'raw':!![]})[_0x85c4('0x1d')](handleEntityNotFound(_0x2c2f5f,null))[_0x85c4('0x1d')](function(_0x586912){if(_0x586912){var _0x203147=_0x586912[_0x85c4('0x4e')]!==null;var _0xb53e03=path['join'](config['root'],_0x85c4('0x4f'));if(_0x203147){_0xb53e03=path[_0x85c4('0x50')](_0xb53e03,_0x85c4('0x51'));}var _0x34501d=path['join'](_0xb53e03,_0x586912[_0x85c4('0x52')]);return _0x2c2f5f[_0x85c4('0x4d')](_0x34501d);}})[_0x85c4('0x41')](handleError(_0x2c2f5f,null));}; \ No newline at end of file +var _0x2c2a=['includeAll','find','get','omit','updatedAt','body','createdAt','create','file','originalname','basename','filename','mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','name','send','index','map','Attachment','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','then','include','findAll','rows','catch','show','params'];(function(_0x2efa92,_0x2557f6){var _0x32704b=function(_0x190985){while(--_0x190985){_0x2efa92['push'](_0x2efa92['shift']());}};_0x32704b(++_0x2557f6);}(_0x2c2a,0xc2));var _0xa2c2=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x2c2a[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0xa2c2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa2c2('0x1'));var jsonpatch=require(_0xa2c2('0x2'));var rp=require('request-promise');var moment=require(_0xa2c2('0x3'));var BPromise=require(_0xa2c2('0x4'));var Mustache=require('mustache');var util=require(_0xa2c2('0x5'));var path=require('path');var sox=require(_0xa2c2('0x6'));var csv=require(_0xa2c2('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa2c2('0x8'));var _=require('lodash');var squel=require(_0xa2c2('0x9'));var crypto=require(_0xa2c2('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xa2c2('0xb'));var toCsv=require(_0xa2c2('0x7'));var querystring=require(_0xa2c2('0xc'));var Papa=require('papaparse');var Redis=require(_0xa2c2('0xd'));var authService=require(_0xa2c2('0xe'));var qs=require(_0xa2c2('0xf'));var as=require(_0xa2c2('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa2c2('0x11'));var utils=require(_0xa2c2('0x12'));var config=require(_0xa2c2('0x13'));var licenseUtil=require(_0xa2c2('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f86f1,_0x8f0b99){_0x8f0b99=_0x8f0b99||0xcc;return function(_0x2eee31){if(_0x2eee31){return _0x3f86f1[_0xa2c2('0x15')](_0x8f0b99);}return _0x3f86f1[_0xa2c2('0x16')](_0x8f0b99)[_0xa2c2('0x17')]();};}function respondWithResult(_0x25161b,_0x2dc2ee){_0x2dc2ee=_0x2dc2ee||0xc8;return function(_0x39e7e4){if(_0x39e7e4){return _0x25161b[_0xa2c2('0x16')](_0x2dc2ee)[_0xa2c2('0x18')](_0x39e7e4);}};}function respondWithFilteredResult(_0xe35aec,_0x2f35ce){return function(_0x1ac1a3){if(_0x1ac1a3){var _0x24c044=typeof _0x2f35ce[_0xa2c2('0x19')]===_0xa2c2('0x1a')&&typeof _0x2f35ce[_0xa2c2('0x1b')]==='undefined';var _0x363c48=_0x1ac1a3['count'];var _0xc40f8d=_0x24c044?0x0:_0x2f35ce['offset'];var _0x331cac=_0x24c044?_0x1ac1a3[_0xa2c2('0x1c')]:_0x2f35ce[_0xa2c2('0x19')]+_0x2f35ce[_0xa2c2('0x1b')];var _0x44ae96;if(_0x331cac>=_0x363c48){_0x331cac=_0x363c48;_0x44ae96=0xc8;}else{_0x44ae96=0xce;}_0xe35aec[_0xa2c2('0x16')](_0x44ae96);return _0xe35aec[_0xa2c2('0x1d')](_0xa2c2('0x1e'),_0xc40f8d+'-'+_0x331cac+'/'+_0x363c48)[_0xa2c2('0x18')](_0x1ac1a3);}return null;};}function patchUpdates(_0x46e0b2){return function(_0x310c48){try{jsonpatch[_0xa2c2('0x1f')](_0x310c48,_0x46e0b2,!![]);}catch(_0x5e41bd){return BPromise[_0xa2c2('0x20')](_0x5e41bd);}return _0x310c48[_0xa2c2('0x21')]();};}function saveUpdates(_0x475b38,_0x1c624c){return function(_0x38c0fd){if(_0x38c0fd){return _0x38c0fd[_0xa2c2('0x22')](_0x475b38)['then'](function(_0x4a6db1){return _0x4a6db1;});}return null;};}function removeEntity(_0x301b78,_0x1ca6f0){return function(_0x155b2b){if(_0x155b2b){return _0x155b2b[_0xa2c2('0x23')]()['then'](function(){_0x301b78[_0xa2c2('0x16')](0xcc)[_0xa2c2('0x17')]();});}};}function handleEntityNotFound(_0x5a97dd,_0x41e197){return function(_0x1eff4a){if(!_0x1eff4a){_0x5a97dd[_0xa2c2('0x15')](0x194);}return _0x1eff4a;};}function handleError(_0x1f09d3,_0x5bb17a){_0x5bb17a=_0x5bb17a||0x1f4;return function(_0x2d92c6){logger['error'](_0x2d92c6['stack']);if(_0x2d92c6[_0xa2c2('0x24')]){delete _0x2d92c6[_0xa2c2('0x24')];}_0x1f09d3[_0xa2c2('0x16')](_0x5bb17a)[_0xa2c2('0x25')](_0x2d92c6);};}exports[_0xa2c2('0x26')]=function(_0x1dc0c2,_0x3f74f5){var _0x8db358={},_0x11be31={},_0x39dec6={'count':0x0,'rows':[]};var _0x303714=_[_0xa2c2('0x27')](db[_0xa2c2('0x28')][_0xa2c2('0x29')],function(_0x497012){return{'name':_0x497012['fieldName'],'type':_0x497012[_0xa2c2('0x2a')][_0xa2c2('0x2b')]};});_0x11be31[_0xa2c2('0x2c')]=_['map'](_0x303714,_0xa2c2('0x24'));_0x11be31[_0xa2c2('0x2d')]=_[_0xa2c2('0x2e')](_0x1dc0c2[_0xa2c2('0x2d')]);_0x11be31['filters']=_[_0xa2c2('0x2f')](_0x11be31['model'],_0x11be31[_0xa2c2('0x2d')]);_0x8db358[_0xa2c2('0x30')]=_[_0xa2c2('0x2f')](_0x11be31[_0xa2c2('0x2c')],qs[_0xa2c2('0x31')](_0x1dc0c2[_0xa2c2('0x2d')][_0xa2c2('0x31')]));_0x8db358['attributes']=_0x8db358[_0xa2c2('0x30')][_0xa2c2('0x32')]?_0x8db358[_0xa2c2('0x30')]:_0x11be31[_0xa2c2('0x2c')];if(!_0x1dc0c2[_0xa2c2('0x2d')]['hasOwnProperty']('nolimit')){_0x8db358[_0xa2c2('0x1b')]=qs[_0xa2c2('0x1b')](_0x1dc0c2['query'][_0xa2c2('0x1b')]);_0x8db358[_0xa2c2('0x19')]=qs['offset'](_0x1dc0c2['query'][_0xa2c2('0x19')]);}_0x8db358[_0xa2c2('0x33')]=qs[_0xa2c2('0x34')](_0x1dc0c2['query'][_0xa2c2('0x34')]);_0x8db358['where']=qs[_0xa2c2('0x35')](_[_0xa2c2('0x36')](_0x1dc0c2[_0xa2c2('0x2d')],_0x11be31[_0xa2c2('0x35')]),_0x303714);if(_0x1dc0c2[_0xa2c2('0x2d')][_0xa2c2('0x37')]){_0x8db358[_0xa2c2('0x38')]=_['merge'](_0x8db358['where'],{'$or':_['map'](_0x303714,function(_0x32a581){if(_0x32a581['type']!==_0xa2c2('0x39')){var _0x25bf74={};_0x25bf74[_0x32a581[_0xa2c2('0x24')]]={'$like':'%'+_0x1dc0c2['query'][_0xa2c2('0x37')]+'%'};return _0x25bf74;}})});}_0x8db358=_[_0xa2c2('0x3a')]({},_0x8db358,_0x1dc0c2[_0xa2c2('0x3b')]);var _0x51b5d5={'where':_0x8db358[_0xa2c2('0x38')]};return db[_0xa2c2('0x28')][_0xa2c2('0x1c')](_0x51b5d5)[_0xa2c2('0x3c')](function(_0x2e031e){_0x39dec6[_0xa2c2('0x1c')]=_0x2e031e;if(_0x1dc0c2[_0xa2c2('0x2d')]['includeAll']){_0x8db358[_0xa2c2('0x3d')]=[{'all':!![]}];}return db['Attachment'][_0xa2c2('0x3e')](_0x8db358);})[_0xa2c2('0x3c')](function(_0x3f36d4){_0x39dec6[_0xa2c2('0x3f')]=_0x3f36d4;return _0x39dec6;})[_0xa2c2('0x3c')](respondWithFilteredResult(_0x3f74f5,_0x8db358))[_0xa2c2('0x40')](handleError(_0x3f74f5,null));};exports[_0xa2c2('0x41')]=function(_0x29ff1b,_0x12a3ab){var _0x20ca88={'raw':!![],'where':{'id':_0x29ff1b[_0xa2c2('0x42')]['id']}},_0x452e1b={};_0x452e1b[_0xa2c2('0x2c')]=_['keys'](db[_0xa2c2('0x28')][_0xa2c2('0x29')]);_0x452e1b[_0xa2c2('0x2d')]=_['keys'](_0x29ff1b['query']);_0x452e1b[_0xa2c2('0x35')]=_[_0xa2c2('0x2f')](_0x452e1b[_0xa2c2('0x2c')],_0x452e1b[_0xa2c2('0x2d')]);_0x20ca88[_0xa2c2('0x30')]=_['intersection'](_0x452e1b[_0xa2c2('0x2c')],qs[_0xa2c2('0x31')](_0x29ff1b['query']['fields']));_0x20ca88[_0xa2c2('0x30')]=_0x20ca88['attributes'][_0xa2c2('0x32')]?_0x20ca88[_0xa2c2('0x30')]:_0x452e1b[_0xa2c2('0x2c')];if(_0x29ff1b[_0xa2c2('0x2d')][_0xa2c2('0x43')]){_0x20ca88[_0xa2c2('0x3d')]=[{'all':!![]}];}_0x20ca88=_[_0xa2c2('0x3a')]({},_0x20ca88,_0x29ff1b[_0xa2c2('0x3b')]);return db[_0xa2c2('0x28')][_0xa2c2('0x44')](_0x20ca88)['then'](handleEntityNotFound(_0x12a3ab,null))[_0xa2c2('0x3c')](respondWithResult(_0x12a3ab,null))[_0xa2c2('0x40')](handleError(_0x12a3ab,null));};exports['clone']=function(_0xced6ac,_0x37e601){var _0x147bb6={'where':{'id':_0xced6ac[_0xa2c2('0x42')]['id']}},_0x2eb8ce={};_0x2eb8ce['model']=_[_0xa2c2('0x2e')](db['Attachment'][_0xa2c2('0x29')]);_0x147bb6[_0xa2c2('0x30')]=_['intersection'](_0x2eb8ce[_0xa2c2('0x2c')],qs['fields'](_0xced6ac[_0xa2c2('0x2d')][_0xa2c2('0x31')]));_0x147bb6[_0xa2c2('0x30')]=_0x147bb6[_0xa2c2('0x30')][_0xa2c2('0x32')]?_0x147bb6['attributes']:_0x2eb8ce[_0xa2c2('0x2c')];if(_0xced6ac[_0xa2c2('0x2d')][_0xa2c2('0x43')]){_0x147bb6[_0xa2c2('0x3d')]=[{'all':!![]}];}_0x147bb6=_[_0xa2c2('0x3a')]({},_0x147bb6,_0xced6ac[_0xa2c2('0x3b')]);return db[_0xa2c2('0x28')][_0xa2c2('0x44')](_0x147bb6)[_0xa2c2('0x3c')](handleEntityNotFound(_0x37e601,null))[_0xa2c2('0x3c')](function(_0x5ef981){if(_0x5ef981){var _0x3ae5c7=_0x5ef981[_0xa2c2('0x45')]({'plain':!![]});_0x3ae5c7=qs[_0xa2c2('0x46')](_0x3ae5c7,['id','createdAt',_0xa2c2('0x47')]);_0xced6ac['body']=_[_0xa2c2('0x46')](_0xced6ac[_0xa2c2('0x48')],['id',_0xa2c2('0x49'),_0xa2c2('0x47')]);return db[_0xa2c2('0x28')]['create'](_['merge'](_0x3ae5c7,_0xced6ac[_0xa2c2('0x48')]),{'include':_0xced6ac[_0xa2c2('0x2d')][_0xa2c2('0x43')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x37e601,0xc9))[_0xa2c2('0x40')](handleError(_0x37e601,null));};exports[_0xa2c2('0x22')]=function(_0x249049,_0x1ebbbd){if(_0x249049[_0xa2c2('0x48')]['id']){delete _0x249049[_0xa2c2('0x48')]['id'];}return db['Attachment'][_0xa2c2('0x44')]({'where':{'id':_0x249049[_0xa2c2('0x42')]['id']}})[_0xa2c2('0x3c')](handleEntityNotFound(_0x1ebbbd,null))[_0xa2c2('0x3c')](saveUpdates(_0x249049['body'],null))['then'](respondWithResult(_0x1ebbbd,null))[_0xa2c2('0x40')](handleError(_0x1ebbbd,null));};exports['destroy']=function(_0x40f54a,_0x4ccab6){return db[_0xa2c2('0x28')][_0xa2c2('0x44')]({'where':{'id':_0x40f54a[_0xa2c2('0x42')]['id']}})[_0xa2c2('0x3c')](handleEntityNotFound(_0x4ccab6,null))['then'](removeEntity(_0x4ccab6,null))['catch'](handleError(_0x4ccab6,null));};exports[_0xa2c2('0x4a')]=function(_0x5251bf,_0x31e4ac,_0x487847){_0x5251bf[_0xa2c2('0x48')]['name']=_0x5251bf[_0xa2c2('0x4b')][_0xa2c2('0x4c')];_0x5251bf[_0xa2c2('0x48')][_0xa2c2('0x4d')]=_0x5251bf[_0xa2c2('0x4b')][_0xa2c2('0x4e')];_0x5251bf['body'][_0xa2c2('0x2a')]=_0x5251bf['file'][_0xa2c2('0x4f')];return db[_0xa2c2('0x28')]['create'](_0x5251bf[_0xa2c2('0x48')])[_0xa2c2('0x3c')](respondWithResult(_0x31e4ac,0xc9))[_0xa2c2('0x40')](handleError(_0x31e4ac,null));};exports[_0xa2c2('0x50')]=function(_0x2348e6,_0x11818c,_0x5155c0){return db['Attachment'][_0xa2c2('0x51')]({'where':{'id':_0x2348e6['params']['id']},'raw':!![]})[_0xa2c2('0x3c')](handleEntityNotFound(_0x11818c,null))[_0xa2c2('0x3c')](function(_0x44e6a3){if(_0x44e6a3){var _0x43c441=_0x44e6a3[_0xa2c2('0x52')]!==null;var _0x88a983=path[_0xa2c2('0x53')](config[_0xa2c2('0x54')],_0xa2c2('0x55'));if(_0x43c441){_0x88a983=path[_0xa2c2('0x53')](_0x88a983,_0xa2c2('0x56'));}var _0x20930c=path[_0xa2c2('0x53')](_0x88a983,_0x44e6a3[_0xa2c2('0x4d')]);return _0x11818c[_0xa2c2('0x50')](_0x20930c);}})[_0xa2c2('0x40')](handleError(_0x11818c,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index fa21f72..395ab17 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 _0x02a5=['define','attachments','util','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x53d081,_0x3e7da8){var _0x2044c9=function(_0x530e45){while(--_0x530e45){_0x53d081['push'](_0x53d081['shift']());}};_0x2044c9(++_0x3e7da8);}(_0x02a5,0x9b));var _0x502a=function(_0x286a2c,_0x587871){_0x286a2c=_0x286a2c-0x0;var _0x356e75=_0x02a5[_0x286a2c];return _0x356e75;};'use strict';var _=require('lodash');var util=require(_0x502a('0x0'));var logger=require(_0x502a('0x1'))(_0x502a('0x2'));var moment=require(_0x502a('0x3'));var BPromise=require(_0x502a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x502a('0x5'));var rimraf=require('rimraf');var config=require(_0x502a('0x6'));var attributes=require('./attachment.attributes');module['exports']=function(_0x341744,_0x308533){return _0x341744[_0x502a('0x7')]('Attachment',attributes,{'tableName':_0x502a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb4f6=['attachments','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./attachment.attributes','exports','define','Attachment'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0xb4f6,0x197));var _0x6b4f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb4f6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6b4f('0x0'));var util=require(_0x6b4f('0x1'));var logger=require(_0x6b4f('0x2'))(_0x6b4f('0x3'));var moment=require(_0x6b4f('0x4'));var BPromise=require(_0x6b4f('0x5'));var rp=require(_0x6b4f('0x6'));var fs=require('fs');var path=require(_0x6b4f('0x7'));var rimraf=require('rimraf');var config=require(_0x6b4f('0x8'));var attributes=require(_0x6b4f('0x9'));module[_0x6b4f('0xa')]=function(_0x10c2ea,_0x387d33){return _0x10c2ea[_0x6b4f('0xb')](_0x6b4f('0xc'),attributes,{'tableName':_0x6b4f('0xd'),'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 cc5e109..c3ddea0 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 _0x1ba2=['http','then','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','Attachment','create','body','options','raw','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x34cc39,_0x43ae41){var _0x37f874=function(_0x3aa675){while(--_0x3aa675){_0x34cc39['push'](_0x34cc39['shift']());}};_0x37f874(++_0x43ae41);}(_0x1ba2,0xb4));var _0x21ba=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1ba2[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x21ba('0x0'));var util=require('util');var moment=require(_0x21ba('0x1'));var BPromise=require('bluebird');var rs=require(_0x21ba('0x2'));var fs=require('fs');var Redis=require(_0x21ba('0x3'));var db=require(_0x21ba('0x4'))['db'];var utils=require(_0x21ba('0x5'));var logger=require(_0x21ba('0x6'))('rpc');var config=require(_0x21ba('0x7'));var jayson=require(_0x21ba('0x8'));var client=jayson['client'][_0x21ba('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x53b3e0,_0x44eb71,_0x23c3b7){return new BPromise(function(_0x5c50aa,_0x17755a){return client['request'](_0x53b3e0,_0x23c3b7)[_0x21ba('0xa')](function(_0x261a15){logger['info'](_0x21ba('0xb'),_0x44eb71,_0x21ba('0xc'));logger[_0x21ba('0xd')](_0x21ba('0xe'),_0x44eb71,_0x21ba('0xc'),JSON[_0x21ba('0xf')](_0x261a15));if(_0x261a15[_0x21ba('0x10')]){if(_0x261a15[_0x21ba('0x10')][_0x21ba('0x11')]===0x1f4){logger[_0x21ba('0x10')](_0x21ba('0xb'),_0x44eb71,_0x261a15[_0x21ba('0x10')]['message']);return _0x17755a(_0x261a15['error'][_0x21ba('0x12')]);}logger[_0x21ba('0x10')](_0x21ba('0xb'),_0x44eb71,_0x261a15['error']['message']);return _0x5c50aa(_0x261a15[_0x21ba('0x10')]['message']);}else{logger[_0x21ba('0x13')]('Attachment,\x20%s,\x20%s',_0x44eb71,_0x21ba('0xc'));_0x5c50aa(_0x261a15[_0x21ba('0x14')][_0x21ba('0x12')]);}})[_0x21ba('0x15')](function(_0x10b9e6){logger['error'](_0x21ba('0xb'),_0x44eb71,_0x10b9e6);_0x17755a(_0x10b9e6);});});}exports['CreateAttachment']=function(_0xc995ee){var _0xa1022=this;return new Promise(function(_0x1f2f48,_0x154ef4){return db[_0x21ba('0x16')][_0x21ba('0x17')](_0xc995ee[_0x21ba('0x18')],{'raw':_0xc995ee[_0x21ba('0x19')]?_0xc995ee['options'][_0x21ba('0x1a')]===undefined?!![]:![]:!![]})[_0x21ba('0xa')](function(_0x58ba99){logger[_0x21ba('0x13')]('CreateAttachment',_0xc995ee);logger[_0x21ba('0xd')]('CreateAttachment',_0xc995ee,JSON[_0x21ba('0xf')](_0x58ba99));_0x1f2f48(_0x58ba99);})[_0x21ba('0x15')](function(_0x30ac7a){logger[_0x21ba('0x10')]('CreateAttachment',_0x30ac7a['message'],_0xc995ee);_0x154ef4(_0xa1022['error'](0x1f4,_0x30ac7a['message']));});});}; \ No newline at end of file +var _0x0e35=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateAttachment','create','options','lodash','util'];(function(_0x59e821,_0x86c723){var _0x5333f6=function(_0x5dc2c9){while(--_0x5dc2c9){_0x59e821['push'](_0x59e821['shift']());}};_0x5333f6(++_0x86c723);}(_0x0e35,0xc2));var _0x50e3=function(_0xb72cda,_0x2f7a3f){_0xb72cda=_0xb72cda-0x0;var _0x58a7a5=_0x0e35[_0xb72cda];return _0x58a7a5;};'use strict';var _=require(_0x50e3('0x0'));var util=require(_0x50e3('0x1'));var moment=require(_0x50e3('0x2'));var BPromise=require(_0x50e3('0x3'));var rs=require(_0x50e3('0x4'));var fs=require('fs');var Redis=require(_0x50e3('0x5'));var db=require(_0x50e3('0x6'))['db'];var utils=require(_0x50e3('0x7'));var logger=require(_0x50e3('0x8'))(_0x50e3('0x9'));var config=require('../../config/environment');var jayson=require(_0x50e3('0xa'));var client=jayson[_0x50e3('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5defe6,_0x2ac084,_0x1ed6ec){return new BPromise(function(_0x57bb5f,_0x48382f){return client[_0x50e3('0xc')](_0x5defe6,_0x1ed6ec)[_0x50e3('0xd')](function(_0x3e0a06){logger[_0x50e3('0xe')](_0x50e3('0xf'),_0x2ac084,_0x50e3('0x10'));logger[_0x50e3('0x11')](_0x50e3('0x12'),_0x2ac084,_0x50e3('0x10'),JSON[_0x50e3('0x13')](_0x3e0a06));if(_0x3e0a06[_0x50e3('0x14')]){if(_0x3e0a06[_0x50e3('0x14')][_0x50e3('0x15')]===0x1f4){logger['error'](_0x50e3('0xf'),_0x2ac084,_0x3e0a06[_0x50e3('0x14')][_0x50e3('0x16')]);return _0x48382f(_0x3e0a06[_0x50e3('0x14')]['message']);}logger[_0x50e3('0x14')](_0x50e3('0xf'),_0x2ac084,_0x3e0a06['error'][_0x50e3('0x16')]);return _0x57bb5f(_0x3e0a06[_0x50e3('0x14')][_0x50e3('0x16')]);}else{logger[_0x50e3('0xe')](_0x50e3('0xf'),_0x2ac084,'request\x20sent');_0x57bb5f(_0x3e0a06[_0x50e3('0x17')]['message']);}})[_0x50e3('0x18')](function(_0x1bf9df){logger[_0x50e3('0x14')]('Attachment,\x20%s,\x20%s',_0x2ac084,_0x1bf9df);_0x48382f(_0x1bf9df);});});}exports[_0x50e3('0x19')]=function(_0x2d25e6){var _0x1b4279=this;return new Promise(function(_0x3e56b6,_0x47ea2c){return db['Attachment'][_0x50e3('0x1a')](_0x2d25e6['body'],{'raw':_0x2d25e6[_0x50e3('0x1b')]?_0x2d25e6[_0x50e3('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x635288){logger[_0x50e3('0xe')]('CreateAttachment',_0x2d25e6);logger[_0x50e3('0x11')](_0x50e3('0x19'),_0x2d25e6,JSON[_0x50e3('0x13')](_0x635288));_0x3e56b6(_0x635288);})[_0x50e3('0x18')](function(_0x3fdd65){logger[_0x50e3('0x14')]('CreateAttachment',_0x3fdd65[_0x50e3('0x16')],_0x2d25e6);_0x47ea2c(_0x1b4279[_0x50e3('0x14')](0x1f4,_0x3fdd65[_0x50e3('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 20586a5..1a72ef6 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['./attachment.controller','get','isAuthenticated','index','/:id','show','download','/:id/clone','clone','root','server/files/attachments/','now','post','single','file','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x4af998,_0x12986e){var _0xd87a26=function(_0x2892a7){while(--_0x2892a7){_0x4af998['push'](_0x4af998['shift']());}};_0xd87a26(++_0x12986e);}(_0x2032,0xd9));var _0x2203=function(_0x279d9c,_0x25dd8e){_0x279d9c=_0x279d9c-0x0;var _0x295780=_0x2032[_0x279d9c];return _0x295780;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['post'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x849049,_0x4a6832,_0x3f690a){_0x3f690a(null,path['join'](config[_0x2203('0x10')],_0x2203('0x11')));},'filename':function(_0x4b9376,_0x583bc7,_0x585c76){_0x585c76(null,util['format']('%s-%s',Date[_0x2203('0x12')](),_0x583bc7['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2203('0x13')]('/',upload[_0x2203('0x14')](_0x2203('0x15')),controller[_0x2203('0x16')]);router[_0x2203('0x17')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0x18')]);router[_0x2203('0x19')](_0x2203('0xb'),auth['isAuthenticated'](),controller[_0x2203('0x1a')]);module[_0x2203('0x1b')]=router; \ No newline at end of file +var _0xadb5=['root','format','%s-%s','originalname','replace','file','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','/:id/clone'];(function(_0x1a820e,_0x269a18){var _0x476c5b=function(_0x43c889){while(--_0x43c889){_0x1a820e['push'](_0x1a820e['shift']());}};_0x476c5b(++_0x269a18);}(_0xadb5,0xad));var _0x5adb=function(_0x3c64a0,_0x34e5b7){_0x3c64a0=_0x3c64a0-0x0;var _0xf597cc=_0xadb5[_0x3c64a0];return _0xf597cc;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./attachment.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller['clone']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1a8f66,_0x1ea238,_0x82e67e){_0x82e67e(null,path['join'](config[_0x5adb('0x10')],'server/files/attachments/'));},'filename':function(_0x2a0b70,_0x5433bf,_0x8cfcc6){_0x8cfcc6(null,util[_0x5adb('0x11')](_0x5adb('0x12'),Date['now'](),_0x5433bf[_0x5adb('0x13')][_0x5adb('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5adb('0xe')]('/',upload['single'](_0x5adb('0x15')),controller['create']);router[_0x5adb('0x16')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x17')]);router[_0x5adb('0x18')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x19')]);module[_0x5adb('0x1a')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 607b331..4193d31 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 _0x537f=['clientID','secret','Setting','findOne','allowedLoginAttempts','then','User','emails','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','minutes','clearBlockUser','getLicense','lodash','passport-google-oauth20','Strategy','moment','../../config/environment','../../components/auth/service','signToken','../../config/utils','login','/login','profile','email','callback','authenticate','google','use'];(function(_0x2d0bfd,_0x2ba336){var _0x4d806c=function(_0x47938d){while(--_0x47938d){_0x2d0bfd['push'](_0x2d0bfd['shift']());}};_0x4d806c(++_0x2ba336);}(_0x537f,0x108));var _0xf537=function(_0x4a9c9d,_0x1d4c19){_0x4a9c9d=_0x4a9c9d-0x0;var _0x3f387a=_0x537f[_0x4a9c9d];return _0x3f387a;};'use strict';var _=require(_0xf537('0x0'));var passport=require('passport');var GoogleStrategy=require(_0xf537('0x1'))[_0xf537('0x2')];var moment=require(_0xf537('0x3'));var db=require('../../mysqldb')['db'];var config=require(_0xf537('0x4'));var signToken=require(_0xf537('0x5'))[_0xf537('0x6')];var utils=require(_0xf537('0x7'));exports[_0xf537('0x8')]=passport['authenticate']('google',{'failureRedirect':_0xf537('0x9'),'scope':[_0xf537('0xa'),_0xf537('0xb')],'session':![]});exports[_0xf537('0xc')]=passport[_0xf537('0xd')](_0xf537('0xe'),{'failureRedirect':_0xf537('0x9'),'session':![]});passport[_0xf537('0xf')](new GoogleStrategy({'clientID':config[_0xf537('0xe')]?config[_0xf537('0xe')][_0xf537('0x10')]:'id','clientSecret':config['google']?config[_0xf537('0xe')]['clientSecret']:_0xf537('0x11'),'callbackURL':config['google']?config[_0xf537('0xe')]['callbackURL']:''},function(_0x40347e,_0x7ba037,_0xf1e951,_0xfe0c9e){var _0x1e1ded,_0x52f841;return db[_0xf537('0x12')][_0xf537('0x13')]({'where':{'id':0x1},'attributes':[_0xf537('0x14'),'blockDuration'],'raw':!![]})[_0xf537('0x15')](function(_0x104fd5){_0x1e1ded=_0x104fd5;return db[_0xf537('0x16')]['find']({'where':{'email':_['map'](_0xf1e951[_0xf537('0x17')],'value'),'role':{'$or':[_0xf537('0x18'),_0xf537('0x19'),_0xf537('0x1a')]}}});})[_0xf537('0x15')](function(_0x3933db){_0x52f841=_0x3933db;if(_0x52f841){if(_0x52f841['disabled']){return _0xfe0c9e(_0xf537('0x1b'));}else if(_0x1e1ded[_0xf537('0x1c')]>0x0){if(_0x52f841[_0xf537('0x1d')]){if(moment(_0x52f841[_0xf537('0x1e')])[_0xf537('0x1f')](_0x1e1ded[_0xf537('0x1c')],_0xf537('0x20'))>moment()){return _0xfe0c9e(_0xf537('0x1b'));}else{return utils[_0xf537('0x21')](_0x52f841,0x0,![],null)['then'](function(){return utils[_0xf537('0x22')](_0x52f841);})[_0xf537('0x15')](function(){return _0xfe0c9e(null,_0x52f841);});}}else{return utils[_0xf537('0x22')](_0x52f841)[_0xf537('0x15')](function(){return _0xfe0c9e(null,_0x52f841);});}}else{return utils[_0xf537('0x22')](_0x52f841)[_0xf537('0x15')](function(){return _0xfe0c9e(null,_0x52f841);});}}return _0xfe0c9e('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');})['catch'](function(_0x4a4b83){_0xfe0c9e(_0x4a4b83);});})); \ No newline at end of file +var _0x3ecc=['google','/login','email','callback','use','clientSecret','secret','Setting','allowedLoginAttempts','blockDuration','then','User','find','emails','value','admin','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','moment','../../mysqldb','../../config/environment','../../components/auth/service','../../config/utils','login','authenticate'];(function(_0x15942a,_0x13b58c){var _0x36a9fb=function(_0x549c27){while(--_0x549c27){_0x15942a['push'](_0x15942a['shift']());}};_0x36a9fb(++_0x13b58c);}(_0x3ecc,0x1df));var _0xc3ec=function(_0x28bafe,_0x216293){_0x28bafe=_0x28bafe-0x0;var _0x1ac283=_0x3ecc[_0x28bafe];return _0x1ac283;};'use strict';var _=require(_0xc3ec('0x0'));var passport=require(_0xc3ec('0x1'));var GoogleStrategy=require(_0xc3ec('0x2'))[_0xc3ec('0x3')];var moment=require(_0xc3ec('0x4'));var db=require(_0xc3ec('0x5'))['db'];var config=require(_0xc3ec('0x6'));var signToken=require(_0xc3ec('0x7'))['signToken'];var utils=require(_0xc3ec('0x8'));exports[_0xc3ec('0x9')]=passport[_0xc3ec('0xa')](_0xc3ec('0xb'),{'failureRedirect':_0xc3ec('0xc'),'scope':['profile',_0xc3ec('0xd')],'session':![]});exports[_0xc3ec('0xe')]=passport[_0xc3ec('0xa')](_0xc3ec('0xb'),{'failureRedirect':_0xc3ec('0xc'),'session':![]});passport[_0xc3ec('0xf')](new GoogleStrategy({'clientID':config[_0xc3ec('0xb')]?config[_0xc3ec('0xb')]['clientID']:'id','clientSecret':config[_0xc3ec('0xb')]?config[_0xc3ec('0xb')][_0xc3ec('0x10')]:_0xc3ec('0x11'),'callbackURL':config['google']?config['google']['callbackURL']:''},function(_0x28a88b,_0x13f06a,_0x462cd0,_0xaf1356){var _0x558cae,_0x72bc3;return db[_0xc3ec('0x12')]['findOne']({'where':{'id':0x1},'attributes':[_0xc3ec('0x13'),_0xc3ec('0x14')],'raw':!![]})[_0xc3ec('0x15')](function(_0x199a9a){_0x558cae=_0x199a9a;return db[_0xc3ec('0x16')][_0xc3ec('0x17')]({'where':{'email':_['map'](_0x462cd0[_0xc3ec('0x18')],_0xc3ec('0x19')),'role':{'$or':[_0xc3ec('0x1a'),'user',_0xc3ec('0x1b')]}}});})[_0xc3ec('0x15')](function(_0x596989){_0x72bc3=_0x596989;if(_0x72bc3){if(_0x72bc3[_0xc3ec('0x1c')]){return _0xaf1356(_0xc3ec('0x1d'));}else if(_0x558cae[_0xc3ec('0x14')]>0x0){if(_0x72bc3[_0xc3ec('0x1e')]){if(moment(_0x72bc3[_0xc3ec('0x1f')])['add'](_0x558cae[_0xc3ec('0x14')],'minutes')>moment()){return _0xaf1356('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{return utils[_0xc3ec('0x20')](_0x72bc3,0x0,![],null)['then'](function(){return utils[_0xc3ec('0x21')](_0x72bc3);})['then'](function(){return _0xaf1356(null,_0x72bc3);});}}else{return utils['getLicense'](_0x72bc3)['then'](function(){return _0xaf1356(null,_0x72bc3);});}}else{return utils[_0xc3ec('0x21')](_0x72bc3)[_0xc3ec('0x15')](function(){return _0xaf1356(null,_0x72bc3);});}}return _0xaf1356('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');})[_0xc3ec('0x22')](function(_0x531beb){_0xaf1356(_0x531beb);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 4e98fd5..35c117a 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 _0x15ae=['setTokenCookie','passport','./authGoogle.controller','get','login','isMiddleware'];(function(_0x18b58c,_0x3fd0e9){var _0x4cccbf=function(_0x5f87c3){while(--_0x5f87c3){_0x18b58c['push'](_0x18b58c['shift']());}};_0x4cccbf(++_0x3fd0e9);}(_0x15ae,0x10f));var _0xe15a=function(_0x165817,_0x491b00){_0x165817=_0x165817-0x0;var _0x5e4c3b=_0x15ae[_0x165817];return _0x5e4c3b;};'use strict';var express=require('express');var passport=require(_0xe15a('0x0'));var router=express['Router']();var controller=require(_0xe15a('0x1'));var userController=require('../user/user.controller.js');var authService=require('../../components/auth/service');router[_0xe15a('0x2')]('/',controller[_0xe15a('0x3')]);router[_0xe15a('0x2')]('/callback',controller['callback'],authService[_0xe15a('0x4')],userController[_0xe15a('0x3')],authService[_0xe15a('0x5')]);module['exports']=router; \ No newline at end of file +var _0xbb7f=['../../components/auth/service','login','get','/callback','callback','setTokenCookie','exports','express','passport','./authGoogle.controller','../user/user.controller.js'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xbb7f,0xe3));var _0xfbb7=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xbb7f[_0x3bf83f];return _0x22c4a9;};'use strict';var express=require(_0xfbb7('0x0'));var passport=require(_0xfbb7('0x1'));var router=express['Router']();var controller=require(_0xfbb7('0x2'));var userController=require(_0xfbb7('0x3'));var authService=require(_0xfbb7('0x4'));router['get']('/',controller[_0xfbb7('0x5')]);router[_0xfbb7('0x6')](_0xfbb7('0x7'),controller[_0xfbb7('0x8')],authService['isMiddleware'],userController[_0xfbb7('0x5')],authService[_0xfbb7('0x9')]);module[_0xfbb7('0xa')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 7ef50ff..890e3ef 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 _0xf151=['User','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','client','Setting','findOne','then','name','salt','role','disabled','blocked','admin','user','agent','authenticate','loginAttempts','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','allowedLoginAttempts','add','blockDuration','minutes','clearBlockUser','blockedAt','getLicense','catch','MailAccount','find','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','pass','merge','request','SendMail','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','error','message','stringify','send','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','body','email','Email\x20parameter\x20is\x20missing','trim','toLowerCase','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','Reset\x20Email\x20sent!','reset','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','password','previousPasswords','validatePasswordHistory','resetPasswordExpires','use'];(function(_0x3faf51,_0x4535f3){var _0x4685b7=function(_0x4c1839){while(--_0x4c1839){_0x3faf51['push'](_0x3faf51['shift']());}};_0x4685b7(++_0x4535f3);}(_0xf151,0xab));var _0x1f15=function(_0x4e5040,_0x2c288a){_0x4e5040=_0x4e5040-0x0;var _0x396234=_0xf151[_0x4e5040];return _0x396234;};'use strict';var util=require('util');var passport=require('passport');var LocalStrategy=require(_0x1f15('0x0'))[_0x1f15('0x1')];var jayson=require(_0x1f15('0x2'));var _=require(_0x1f15('0x3'));var rs=require(_0x1f15('0x4'));var moment=require(_0x1f15('0x5'));var db=require(_0x1f15('0x6'))['db'];var authService=require(_0x1f15('0x7'));var utils=require('../../config/utils');var client=jayson[_0x1f15('0x8')]['http']({'port':0x232b});function localAuthenticate(_0x4cfc7b,_0x5ecda5,_0x1a1c65,_0x166156){var _0xc7ae4b,_0x5d0bc8;return db[_0x1f15('0x9')][_0x1f15('0xa')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})[_0x1f15('0xb')](function(_0x2baa12){_0xc7ae4b=_0x2baa12;return _0x4cfc7b[_0x1f15('0xa')]({'attributes':['id',_0x1f15('0xc'),'password',_0x1f15('0xd'),_0x1f15('0xe'),_0x1f15('0xf'),_0x1f15('0x10'),'blockedAt','loginAttempts'],'where':{'name':_0x5ecda5,'role':{'$or':[_0x1f15('0x11'),_0x1f15('0x12'),_0x1f15('0x13')]}}});})[_0x1f15('0xb')](function(_0x2b2711){if(!_0x2b2711||_0x2b2711&&_0x2b2711[_0x1f15('0xc')]!==_0x5ecda5){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x5d0bc8=_0x2b2711;return _0x5d0bc8;}})[_0x1f15('0xb')](function(){_0x5d0bc8[_0x1f15('0x14')](_0x1a1c65,function(_0x276ee0,_0x387c36){var _0x48ef33=_0x5d0bc8[_0x1f15('0x15')]+0x1;if(_0x276ee0){return _0x166156(_0x276ee0);}else if(!_0x387c36){if(_0x5d0bc8['disabled']){return _0x166156(null,![],{'message':_0x1f15('0x16')});}else if(_0xc7ae4b[_0x1f15('0x17')]>0x0){if(_0x5d0bc8[_0x1f15('0x10')]){if(_0xc7ae4b['blockDuration']>0x0){if(moment(_0x5d0bc8['blockedAt'])[_0x1f15('0x18')](_0xc7ae4b[_0x1f15('0x19')],_0x1f15('0x1a'))>moment()){return _0x166156(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x1f15('0x1b')](_0x5d0bc8,_0x48ef33,![],null)['then'](function(){return _0x166156(null,![],{'message':_0x1f15('0x16')});});}}else{return _0x166156(null,![],{'message':_0x1f15('0x16')});}}else{if(_0x48ef33>=_0xc7ae4b['allowedLoginAttempts']){return utils['clearBlockUser'](_0x5d0bc8,0x0,!![],moment())[_0x1f15('0xb')](function(){return _0x166156(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x1f15('0x1b')](_0x5d0bc8,_0x48ef33,![],null)[_0x1f15('0xb')](function(){return _0x166156(null,![],{'message':_0x1f15('0x16')});});}}}else{return _0x166156(null,![],{'message':_0x1f15('0x16')});}}else{if(_0x5d0bc8[_0x1f15('0xf')]){return _0x166156(null,![],{'message':_0x1f15('0x16')});}else if(_0xc7ae4b[_0x1f15('0x17')]>0x0){if(_0x5d0bc8['blocked']){if(_0xc7ae4b['blockDuration']>0x0){if(moment(_0x5d0bc8[_0x1f15('0x1c')])[_0x1f15('0x18')](_0xc7ae4b['blockDuration'],'minutes')>moment()){return _0x166156(null,![],{'message':_0x1f15('0x16')});}else{return utils[_0x1f15('0x1b')](_0x5d0bc8,0x0,![],null)[_0x1f15('0xb')](function(){return utils['getLicense'](_0x5d0bc8);})[_0x1f15('0xb')](function(){return _0x166156(null,_0x5d0bc8);});}}else{return _0x166156(null,![],{'message':_0x1f15('0x16')});}}else{return utils[_0x1f15('0x1b')](_0x5d0bc8,0x0,![],null)[_0x1f15('0xb')](function(){return utils[_0x1f15('0x1d')](_0x5d0bc8);})[_0x1f15('0xb')](function(){return _0x166156(null,_0x5d0bc8);})[_0x1f15('0x1e')](function(_0x317bfc){return _0x166156(null,![],_0x317bfc);});}}else{if(_0x5d0bc8[_0x1f15('0x10')]){return _0x166156(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x1f15('0x1d')](_0x5d0bc8)['then'](function(){return _0x166156(null,_0x5d0bc8);});}}}});})[_0x1f15('0x1e')](function(_0xe42369){return _0x166156(null,![],_0xe42369);});}function sendServiceMail(_0x5660e6){return db[_0x1f15('0x1f')][_0x1f15('0x20')]({'where':{'service':!![]},'attributes':['id',_0x1f15('0xc'),'email'],'include':[{'model':db[_0x1f15('0x21')],'as':_0x1f15('0x22')}]})[_0x1f15('0xb')](function(_0x51b054){if(!_0x51b054){throw new Error(_0x1f15('0x23'));}var _0x4a4eff={'tls':{'rejectUnauthorized':![]}};if(_0x51b054[_0x1f15('0x22')]['service']){_0x4a4eff[_0x1f15('0x24')]=_0x51b054[_0x1f15('0x22')][_0x1f15('0x24')];}else{_0x4a4eff[_0x1f15('0x25')]=_0x51b054[_0x1f15('0x22')][_0x1f15('0x25')];_0x4a4eff[_0x1f15('0x26')]=_0x51b054[_0x1f15('0x22')]['port'];_0x4a4eff['secure']=_0x51b054[_0x1f15('0x22')][_0x1f15('0x27')];}if(_0x51b054[_0x1f15('0x22')][_0x1f15('0x28')]){_0x4a4eff[_0x1f15('0x29')]={'user':_0x51b054[_0x1f15('0x22')]['user'],'pass':_0x51b054[_0x1f15('0x22')][_0x1f15('0x2a')]};}var _0x246554={'account':_0x4a4eff,'message':_[_0x1f15('0x2b')]({'from':util['format']('\x22%s\x22\x20<%s>',_0x51b054['name'],_0x51b054['email']||_0x51b054[_0x1f15('0x22')][_0x1f15('0x12')])},_0x5660e6)};return client[_0x1f15('0x2c')](_0x1f15('0x2d'),_0x246554);})['then'](function(_0x1915f4){if(_0x1915f4['error']){throw new Error(util[_0x1f15('0x2e')](_0x1f15('0x2f'),_0x1915f4[_0x1f15('0x30')][_0x1f15('0x31')]||JSON[_0x1f15('0x32')](_0x1915f4[_0x1f15('0x30')])));}return!![];});}function handleError(_0x56fc97,_0x1d2256,_0x24ea8f){return _0x56fc97['status'](_0x1d2256||0x1f4)[_0x1f15('0x33')]({'message':_0x24ea8f?_0x24ea8f[_0x1f15('0x31')]||_0x24ea8f:''});}exports[_0x1f15('0x34')]=function(_0x5dee16,_0x371478,_0x24cc03){passport['authenticate']('local',function(_0x327db9,_0x42d9ca,_0x57d2cf){var _0x21785a=_0x327db9||_0x57d2cf;if(_0x21785a){return handleError(_0x371478,0x191,_0x21785a);}if(!_0x42d9ca){return handleError(_0x371478,0x194,{'message':_0x1f15('0x35')});}else{var _0x54d39d={'payload':{'id':_0x42d9ca['id'],'role':_0x42d9ca[_0x1f15('0xe')]},'options':{'expiresIn':0x15180}};return authService[_0x1f15('0x36')](_0x54d39d)['then'](function(_0x112b38){_0x371478['json']({'id':_0x42d9ca['id'],'token':_0x112b38,'statusCall':'','isAlreadyLogged':_0x42d9ca['online']});});}})(_0x5dee16,_0x371478,_0x24cc03);};exports['forgot']=function(_0x49f78b,_0x3f19b9,_0x1a0c9e){if(!_0x49f78b[_0x1f15('0x37')][_0x1f15('0x38')]){return handleError(_0x3f19b9,0x1f4,{'message':_0x1f15('0x39')});}var _0x4fbfae=rs['generate']();_0x49f78b[_0x1f15('0x37')]['email']=_0x49f78b[_0x1f15('0x37')]['email'][_0x1f15('0x3a')]()[_0x1f15('0x3b')]();var _0xadb025;return db[_0x1f15('0x9')]['findOne']({'where':{'id':0x1},'attributes':[_0x1f15('0x17'),_0x1f15('0x19')],'raw':!![]})[_0x1f15('0xb')](function(_0x110495){_0xadb025=_0x110495;return db['User'][_0x1f15('0x20')]({'where':{'email':_0x49f78b[_0x1f15('0x37')]['email']}});})[_0x1f15('0xb')](function(_0x4d4df4){if(!_0x4d4df4){throw new Error(_0x1f15('0x3c'));}if(_0x4d4df4[_0x1f15('0xf')]){throw new Error(_0x1f15('0x3d'));}if(_0x4d4df4[_0x1f15('0x10')]){if(moment(_0x4d4df4[_0x1f15('0x1c')])[_0x1f15('0x18')](_0xadb025[_0x1f15('0x19')],_0x1f15('0x1a'))>moment()){throw new Error(_0x1f15('0x3e'));}else{_0x4d4df4['blocked']=![];_0x4d4df4[_0x1f15('0x1c')]=null;}}_0x4d4df4[_0x1f15('0x3f')]=_0x4fbfae;_0x4d4df4['resetPasswordExpires']=Date[_0x1f15('0x40')]()+0x36ee80;return _0x4d4df4[_0x1f15('0x41')]();})[_0x1f15('0xb')](function(){return sendServiceMail({'to':_0x49f78b['body'][_0x1f15('0x38')],'subject':_0x1f15('0x42'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x1f15('0x43')+'https://'+_0x49f78b[_0x1f15('0x44')][_0x1f15('0x25')]+_0x1f15('0x45')+_0x4fbfae+'\x0a\x0a'+_0x1f15('0x46')});})['then'](function(){_0x3f19b9[_0x1f15('0x47')](0xc8)[_0x1f15('0x33')]({'message':_0x1f15('0x48')});})[_0x1f15('0x1e')](function(_0x37dfdd){return handleError(_0x3f19b9,0x1f4,_0x37dfdd);});};exports[_0x1f15('0x49')]=function(_0x391332,_0x2cbcb7,_0x421eb7){return db['User'][_0x1f15('0x20')]({'where':{'resetPasswordToken':_0x391332[_0x1f15('0x4a')]['token'],'resetPasswordExpires':{'$gt':Date[_0x1f15('0x40')]()}}})[_0x1f15('0xb')](function(_0x265d74){if(!_0x265d74){throw new Error(_0x1f15('0x4b'));}return db[_0x1f15('0x9')]['findOne']({'attributes':['id',_0x1f15('0x4c'),_0x1f15('0x4d'),_0x1f15('0x4e')]})[_0x1f15('0xb')](function(_0x246d33){if(_0x246d33[_0x1f15('0x4c')])authService['validatePasswordPattern'](_0x391332[_0x1f15('0x37')][_0x1f15('0x4f')]);if(!_0x246d33[_0x1f15('0x4d')]||!_0x265d74[_0x1f15('0x50')])return _0x265d74;authService[_0x1f15('0x51')](_0x391332[_0x1f15('0x37')][_0x1f15('0x4f')],_0x265d74['previousPasswords'],_0x246d33['passwordHistoryLimit']);return _0x265d74;})[_0x1f15('0xb')](function(){_0x265d74[_0x1f15('0x4f')]=_0x391332[_0x1f15('0x37')][_0x1f15('0x4f')];_0x265d74[_0x1f15('0x3f')]=null;_0x265d74[_0x1f15('0x52')]=null;return _0x265d74['save']();});})[_0x1f15('0xb')](function(){_0x2cbcb7[_0x1f15('0x47')](0xc8)[_0x1f15('0x33')]({'message':'Password\x20reset!'});})['catch'](function(_0x282756){return handleError(_0x2cbcb7,0x1f4,_0x282756);});};passport[_0x1f15('0x53')](new LocalStrategy({'usernameField':'name','passwordField':_0x1f15('0x4f')},function(_0x4f6118,_0x5ed4c4,_0x29f8cb){return localAuthenticate(db[_0x1f15('0x54')],_0x4f6118,_0x5ed4c4,_0x29f8cb);})); \ No newline at end of file +var _0x8a56=['findOne','allowedLoginAttempts','name','password','salt','role','disabled','blocked','loginAttempts','admin','user','agent','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blockDuration','blockedAt','add','minutes','clearBlockUser','catch','getLicense','email','MailServerOut','Smtp','service','host','port','secure','authentication','auth','merge','format','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','status','send','message','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','body','toLowerCase','User','find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','Reset\x20Email\x20sent!','reset','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','Password\x20reset!','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','../../mysqldb','../../components/auth/service','../../config/utils','client','Setting'];(function(_0x41a0b6,_0x626e80){var _0x10ca8a=function(_0x4edd24){while(--_0x4edd24){_0x41a0b6['push'](_0x41a0b6['shift']());}};_0x10ca8a(++_0x626e80);}(_0x8a56,0xf0));var _0x68a5=function(_0x29aefc,_0x4dcf53){_0x29aefc=_0x29aefc-0x0;var _0x11be36=_0x8a56[_0x29aefc];return _0x11be36;};'use strict';var util=require(_0x68a5('0x0'));var passport=require(_0x68a5('0x1'));var LocalStrategy=require(_0x68a5('0x2'))[_0x68a5('0x3')];var jayson=require(_0x68a5('0x4'));var _=require(_0x68a5('0x5'));var rs=require(_0x68a5('0x6'));var moment=require('moment');var db=require(_0x68a5('0x7'))['db'];var authService=require(_0x68a5('0x8'));var utils=require(_0x68a5('0x9'));var client=jayson[_0x68a5('0xa')]['http']({'port':0x232b});function localAuthenticate(_0x3ac385,_0x329c96,_0x185cb1,_0x43d7d2){var _0x123b79,_0x181846;return db[_0x68a5('0xb')][_0x68a5('0xc')]({'where':{'id':0x1},'attributes':[_0x68a5('0xd'),'blockDuration'],'raw':!![]})['then'](function(_0x56104e){_0x123b79=_0x56104e;return _0x3ac385[_0x68a5('0xc')]({'attributes':['id',_0x68a5('0xe'),_0x68a5('0xf'),_0x68a5('0x10'),_0x68a5('0x11'),_0x68a5('0x12'),_0x68a5('0x13'),'blockedAt',_0x68a5('0x14')],'where':{'name':_0x329c96,'role':{'$or':[_0x68a5('0x15'),_0x68a5('0x16'),_0x68a5('0x17')]}}});})[_0x68a5('0x18')](function(_0x8521fd){if(!_0x8521fd||_0x8521fd&&_0x8521fd[_0x68a5('0xe')]!==_0x329c96){throw new Error(_0x68a5('0x19'));}else{_0x181846=_0x8521fd;return _0x181846;}})['then'](function(){_0x181846[_0x68a5('0x1a')](_0x185cb1,function(_0x3f2f5b,_0xc8a8bd){var _0x3a83c7=_0x181846[_0x68a5('0x14')]+0x1;if(_0x3f2f5b){return _0x43d7d2(_0x3f2f5b);}else if(!_0xc8a8bd){if(_0x181846['disabled']){return _0x43d7d2(null,![],{'message':_0x68a5('0x19')});}else if(_0x123b79[_0x68a5('0xd')]>0x0){if(_0x181846[_0x68a5('0x13')]){if(_0x123b79[_0x68a5('0x1b')]>0x0){if(moment(_0x181846[_0x68a5('0x1c')])[_0x68a5('0x1d')](_0x123b79[_0x68a5('0x1b')],_0x68a5('0x1e'))>moment()){return _0x43d7d2(null,![],{'message':_0x68a5('0x19')});}else{return utils[_0x68a5('0x1f')](_0x181846,_0x3a83c7,![],null)[_0x68a5('0x18')](function(){return _0x43d7d2(null,![],{'message':_0x68a5('0x19')});});}}else{return _0x43d7d2(null,![],{'message':_0x68a5('0x19')});}}else{if(_0x3a83c7>=_0x123b79[_0x68a5('0xd')]){return utils[_0x68a5('0x1f')](_0x181846,0x0,!![],moment())[_0x68a5('0x18')](function(){return _0x43d7d2(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x68a5('0x1f')](_0x181846,_0x3a83c7,![],null)[_0x68a5('0x18')](function(){return _0x43d7d2(null,![],{'message':_0x68a5('0x19')});});}}}else{return _0x43d7d2(null,![],{'message':_0x68a5('0x19')});}}else{if(_0x181846['disabled']){return _0x43d7d2(null,![],{'message':_0x68a5('0x19')});}else if(_0x123b79[_0x68a5('0xd')]>0x0){if(_0x181846[_0x68a5('0x13')]){if(_0x123b79['blockDuration']>0x0){if(moment(_0x181846[_0x68a5('0x1c')])[_0x68a5('0x1d')](_0x123b79[_0x68a5('0x1b')],_0x68a5('0x1e'))>moment()){return _0x43d7d2(null,![],{'message':_0x68a5('0x19')});}else{return utils['clearBlockUser'](_0x181846,0x0,![],null)[_0x68a5('0x18')](function(){return utils['getLicense'](_0x181846);})[_0x68a5('0x18')](function(){return _0x43d7d2(null,_0x181846);});}}else{return _0x43d7d2(null,![],{'message':_0x68a5('0x19')});}}else{return utils['clearBlockUser'](_0x181846,0x0,![],null)['then'](function(){return utils['getLicense'](_0x181846);})[_0x68a5('0x18')](function(){return _0x43d7d2(null,_0x181846);})[_0x68a5('0x20')](function(_0x333439){return _0x43d7d2(null,![],_0x333439);});}}else{if(_0x181846[_0x68a5('0x13')]){return _0x43d7d2(null,![],{'message':_0x68a5('0x19')});}else{return utils[_0x68a5('0x21')](_0x181846)['then'](function(){return _0x43d7d2(null,_0x181846);});}}}});})['catch'](function(_0x4764fa){return _0x43d7d2(null,![],_0x4764fa);});}function sendServiceMail(_0x4d38e0){return db['MailAccount']['find']({'where':{'service':!![]},'attributes':['id',_0x68a5('0xe'),_0x68a5('0x22')],'include':[{'model':db[_0x68a5('0x23')],'as':_0x68a5('0x24')}]})['then'](function(_0x14a82b){if(!_0x14a82b){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x10377a={'tls':{'rejectUnauthorized':![]}};if(_0x14a82b[_0x68a5('0x24')][_0x68a5('0x25')]){_0x10377a[_0x68a5('0x25')]=_0x14a82b[_0x68a5('0x24')][_0x68a5('0x25')];}else{_0x10377a['host']=_0x14a82b[_0x68a5('0x24')][_0x68a5('0x26')];_0x10377a[_0x68a5('0x27')]=_0x14a82b[_0x68a5('0x24')][_0x68a5('0x27')];_0x10377a[_0x68a5('0x28')]=_0x14a82b[_0x68a5('0x24')][_0x68a5('0x28')];}if(_0x14a82b[_0x68a5('0x24')][_0x68a5('0x29')]){_0x10377a[_0x68a5('0x2a')]={'user':_0x14a82b['Smtp']['user'],'pass':_0x14a82b['Smtp']['pass']};}var _0x162267={'account':_0x10377a,'message':_[_0x68a5('0x2b')]({'from':util[_0x68a5('0x2c')](_0x68a5('0x2d'),_0x14a82b[_0x68a5('0xe')],_0x14a82b[_0x68a5('0x22')]||_0x14a82b[_0x68a5('0x24')]['user'])},_0x4d38e0)};return client[_0x68a5('0x2e')](_0x68a5('0x2f'),_0x162267);})['then'](function(_0x4a3257){if(_0x4a3257[_0x68a5('0x30')]){throw new Error(util[_0x68a5('0x2c')](_0x68a5('0x31'),_0x4a3257[_0x68a5('0x30')]['message']||JSON[_0x68a5('0x32')](_0x4a3257[_0x68a5('0x30')])));}return!![];});}function handleError(_0x3c6367,_0x301411,_0x348f04){return _0x3c6367[_0x68a5('0x33')](_0x301411||0x1f4)[_0x68a5('0x34')]({'message':_0x348f04?_0x348f04[_0x68a5('0x35')]||_0x348f04:''});}exports[_0x68a5('0x36')]=function(_0x536d21,_0x2f15c1,_0x483247){passport[_0x68a5('0x1a')](_0x68a5('0x37'),function(_0x50206d,_0x206ed0,_0x28c2ee){var _0x49b0b5=_0x50206d||_0x28c2ee;if(_0x49b0b5){return handleError(_0x2f15c1,0x191,_0x49b0b5);}if(!_0x206ed0){return handleError(_0x2f15c1,0x194,{'message':_0x68a5('0x38')});}else{var _0x1ab720={'payload':{'id':_0x206ed0['id'],'role':_0x206ed0['role']},'options':{'expiresIn':0x15180}};return authService[_0x68a5('0x39')](_0x1ab720)['then'](function(_0x3f4fc4){_0x2f15c1[_0x68a5('0x3a')]({'id':_0x206ed0['id'],'token':_0x3f4fc4,'statusCall':'','isAlreadyLogged':_0x206ed0[_0x68a5('0x3b')]});});}})(_0x536d21,_0x2f15c1,_0x483247);};exports['forgot']=function(_0x319334,_0x369c7f,_0x1d87d5){if(!_0x319334[_0x68a5('0x3c')][_0x68a5('0x22')]){return handleError(_0x369c7f,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x538187=rs['generate']();_0x319334[_0x68a5('0x3c')][_0x68a5('0x22')]=_0x319334[_0x68a5('0x3c')]['email']['trim']()[_0x68a5('0x3d')]();var _0x8c80c0;return db['Setting'][_0x68a5('0xc')]({'where':{'id':0x1},'attributes':[_0x68a5('0xd'),_0x68a5('0x1b')],'raw':!![]})['then'](function(_0x158cc3){_0x8c80c0=_0x158cc3;return db[_0x68a5('0x3e')][_0x68a5('0x3f')]({'where':{'email':_0x319334[_0x68a5('0x3c')][_0x68a5('0x22')]}});})[_0x68a5('0x18')](function(_0x35f18a){if(!_0x35f18a){throw new Error(_0x68a5('0x40'));}if(_0x35f18a[_0x68a5('0x12')]){throw new Error(_0x68a5('0x41'));}if(_0x35f18a[_0x68a5('0x13')]){if(moment(_0x35f18a['blockedAt'])[_0x68a5('0x1d')](_0x8c80c0[_0x68a5('0x1b')],'minutes')>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x35f18a[_0x68a5('0x13')]=![];_0x35f18a[_0x68a5('0x1c')]=null;}}_0x35f18a[_0x68a5('0x42')]=_0x538187;_0x35f18a[_0x68a5('0x43')]=Date[_0x68a5('0x44')]()+0x36ee80;return _0x35f18a[_0x68a5('0x45')]();})['then'](function(){return sendServiceMail({'to':_0x319334[_0x68a5('0x3c')][_0x68a5('0x22')],'subject':_0x68a5('0x46'),'text':_0x68a5('0x47')+_0x68a5('0x48')+_0x68a5('0x49')+_0x319334[_0x68a5('0x4a')][_0x68a5('0x26')]+'/reset/'+_0x538187+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})['then'](function(){_0x369c7f[_0x68a5('0x33')](0xc8)[_0x68a5('0x34')]({'message':_0x68a5('0x4b')});})[_0x68a5('0x20')](function(_0x594703){return handleError(_0x369c7f,0x1f4,_0x594703);});};exports[_0x68a5('0x4c')]=function(_0x1e39e5,_0x247145,_0x168f30){return db[_0x68a5('0x3e')]['find']({'where':{'resetPasswordToken':_0x1e39e5[_0x68a5('0x4d')]['token'],'resetPasswordExpires':{'$gt':Date[_0x68a5('0x44')]()}}})[_0x68a5('0x18')](function(_0x32cecd){if(!_0x32cecd){throw new Error(_0x68a5('0x4e'));}return db[_0x68a5('0xb')][_0x68a5('0xc')]({'attributes':['id',_0x68a5('0x4f'),_0x68a5('0x50'),_0x68a5('0x51')]})[_0x68a5('0x18')](function(_0x53e212){if(_0x53e212[_0x68a5('0x4f')])authService['validatePasswordPattern'](_0x1e39e5['body']['password']);if(!_0x53e212[_0x68a5('0x50')]||!_0x32cecd[_0x68a5('0x52')])return _0x32cecd;authService['validatePasswordHistory'](_0x1e39e5['body'][_0x68a5('0xf')],_0x32cecd[_0x68a5('0x52')],_0x53e212[_0x68a5('0x51')]);return _0x32cecd;})[_0x68a5('0x18')](function(){_0x32cecd[_0x68a5('0xf')]=_0x1e39e5[_0x68a5('0x3c')]['password'];_0x32cecd['resetPasswordToken']=null;_0x32cecd[_0x68a5('0x43')]=null;return _0x32cecd['save']();});})['then'](function(){_0x247145[_0x68a5('0x33')](0xc8)[_0x68a5('0x34')]({'message':_0x68a5('0x53')});})[_0x68a5('0x20')](function(_0xcc3352){return handleError(_0x247145,0x1f4,_0xcc3352);});};passport['use'](new LocalStrategy({'usernameField':'name','passwordField':_0x68a5('0xf')},function(_0x1e99f7,_0x284665,_0x37cb14){return localAuthenticate(db[_0x68a5('0x3e')],_0x1e99f7,_0x284665,_0x37cb14);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 361b28e..0c5cda0 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 _0x14a5=['forgot','/reset/:token','exports','express','Router','./authLocal.controller','post','/forgot'];(function(_0x48c5b8,_0x48b283){var _0xcc6ccf=function(_0x213faa){while(--_0x213faa){_0x48c5b8['push'](_0x48c5b8['shift']());}};_0xcc6ccf(++_0x48b283);}(_0x14a5,0xd3));var _0x514a=function(_0x58a336,_0x1fb755){_0x58a336=_0x58a336-0x0;var _0x145add=_0x14a5[_0x58a336];return _0x145add;};'use strict';var express=require(_0x514a('0x0'));var router=express[_0x514a('0x1')]();var controller=require(_0x514a('0x2'));router[_0x514a('0x3')]('/',controller['login']);router['post'](_0x514a('0x4'),controller[_0x514a('0x5')]);router[_0x514a('0x3')](_0x514a('0x6'),controller['reset']);module[_0x514a('0x7')]=router; \ No newline at end of file +var _0xb363=['login','/forgot','reset','exports','Router','post'];(function(_0x396bd5,_0x474e60){var _0x426082=function(_0x2d5971){while(--_0x2d5971){_0x396bd5['push'](_0x396bd5['shift']());}};_0x426082(++_0x474e60);}(_0xb363,0x8e));var _0x3b36=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xb363[_0xefd519];return _0x4bb882;};'use strict';var express=require('express');var router=express[_0x3b36('0x0')]();var controller=require('./authLocal.controller');router[_0x3b36('0x1')]('/',controller[_0x3b36('0x2')]);router[_0x3b36('0x1')](_0x3b36('0x3'),controller['forgot']);router[_0x3b36('0x1')]('/reset/:token',controller[_0x3b36('0x4')]);module[_0x3b36('0x5')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 4339d73..c7ebf87 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 _0x762a=['sequelize','STRING','BOOLEAN','INTEGER'];(function(_0x4bc65f,_0x39ec43){var _0x44f85f=function(_0x175343){while(--_0x175343){_0x4bc65f['push'](_0x4bc65f['shift']());}};_0x44f85f(++_0x39ec43);}(_0x762a,0x194));var _0xa762=function(_0x4837bf,_0x1115ad){_0x4837bf=_0x4837bf-0x0;var _0x4ae19e=_0x762a[_0x4837bf];return _0x4ae19e;};'use strict';var Sequelize=require(_0xa762('0x0'));module['exports']={'name':{'type':Sequelize[_0xa762('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0xa762('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xa762('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xa762('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0x947f=['STRING','exports'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x947f,0x12d));var _0xf947=function(_0x11deef,_0x34bbdb){_0x11deef=_0x11deef-0x0;var _0xe9ba85=_0x947f[_0x11deef];return _0xe9ba85;};'use strict';var Sequelize=require('sequelize');module[_0xf947('0x0')]={'name':{'type':Sequelize[_0xf947('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0xf947('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'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 0294fee..b6c39b7 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 _0x70ee=['includeAll','include','findAll','rows','catch','show','params','model','length','create','body','update','find','addConditions','Condition','ids','omit','getConditions','order','options','Action','addActions','findOne','getActions','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','sendStatus','stack','name','send','index','map','Automation','rawAttributes','fieldName','type','key','keys','query','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL'];(function(_0x34dd46,_0x589427){var _0x531e94=function(_0x45086f){while(--_0x45086f){_0x34dd46['push'](_0x34dd46['shift']());}};_0x531e94(++_0x589427);}(_0x70ee,0x1c6));var _0xe70e=function(_0x366171,_0x160e18){_0x366171=_0x366171-0x0;var _0x2fb0af=_0x70ee[_0x366171];return _0x2fb0af;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe70e('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe70e('0x1'));var BPromise=require(_0xe70e('0x2'));var Mustache=require(_0xe70e('0x3'));var util=require(_0xe70e('0x4'));var path=require('path');var sox=require(_0xe70e('0x5'));var csv=require(_0xe70e('0x6'));var ejs=require(_0xe70e('0x7'));var fs=require('fs');var fs_extra=require(_0xe70e('0x8'));var _=require(_0xe70e('0x9'));var squel=require(_0xe70e('0xa'));var crypto=require('crypto');var jsforce=require(_0xe70e('0xb'));var deskjs=require(_0xe70e('0xc'));var toCsv=require(_0xe70e('0x6'));var querystring=require(_0xe70e('0xd'));var Papa=require(_0xe70e('0xe'));var Redis=require(_0xe70e('0xf'));var authService=require(_0xe70e('0x10'));var qs=require(_0xe70e('0x11'));var as=require(_0xe70e('0x12'));var hardwareService=require(_0xe70e('0x13'));var logger=require('../../config/logger')(_0xe70e('0x14'));var utils=require(_0xe70e('0x15'));var config=require(_0xe70e('0x16'));var licenseUtil=require(_0xe70e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e8203,_0x451956){_0x451956=_0x451956||0xcc;return function(_0x322a32){if(_0x322a32){return _0x5e8203['sendStatus'](_0x451956);}return _0x5e8203[_0xe70e('0x18')](_0x451956)[_0xe70e('0x19')]();};}function respondWithResult(_0x547144,_0x26f994){_0x26f994=_0x26f994||0xc8;return function(_0x458572){if(_0x458572){return _0x547144[_0xe70e('0x18')](_0x26f994)[_0xe70e('0x1a')](_0x458572);}};}function respondWithFilteredResult(_0x57a4b0,_0x308156){return function(_0x66baeb){if(_0x66baeb){var _0x352eda=typeof _0x308156[_0xe70e('0x1b')]===_0xe70e('0x1c')&&typeof _0x308156[_0xe70e('0x1d')]===_0xe70e('0x1c');var _0x5a11b5=_0x66baeb[_0xe70e('0x1e')];var _0xf645f8=_0x352eda?0x0:_0x308156[_0xe70e('0x1b')];var _0x1b6d86=_0x352eda?_0x66baeb[_0xe70e('0x1e')]:_0x308156[_0xe70e('0x1b')]+_0x308156[_0xe70e('0x1d')];var _0x3072d5;if(_0x1b6d86>=_0x5a11b5){_0x1b6d86=_0x5a11b5;_0x3072d5=0xc8;}else{_0x3072d5=0xce;}_0x57a4b0[_0xe70e('0x18')](_0x3072d5);return _0x57a4b0[_0xe70e('0x1f')](_0xe70e('0x20'),_0xf645f8+'-'+_0x1b6d86+'/'+_0x5a11b5)['json'](_0x66baeb);}return null;};}function patchUpdates(_0x44967b){return function(_0x5406a3){try{jsonpatch[_0xe70e('0x21')](_0x5406a3,_0x44967b,!![]);}catch(_0x463861){return BPromise[_0xe70e('0x22')](_0x463861);}return _0x5406a3['save']();};}function saveUpdates(_0x3be8a7,_0x3873f8){return function(_0x225533){if(_0x225533){return _0x225533['update'](_0x3be8a7)[_0xe70e('0x23')](function(_0x678372){return _0x678372;});}return null;};}function removeEntity(_0x5c609c,_0x55c9c7){return function(_0x325700){if(_0x325700){return _0x325700[_0xe70e('0x24')]()[_0xe70e('0x23')](function(){_0x5c609c[_0xe70e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6b822,_0xfd934f){return function(_0x1f863f){if(!_0x1f863f){_0x6b822[_0xe70e('0x25')](0x194);}return _0x1f863f;};}function handleError(_0x200631,_0x586d72){_0x586d72=_0x586d72||0x1f4;return function(_0x528567){logger['error'](_0x528567[_0xe70e('0x26')]);if(_0x528567['name']){delete _0x528567[_0xe70e('0x27')];}_0x200631[_0xe70e('0x18')](_0x586d72)[_0xe70e('0x28')](_0x528567);};}exports[_0xe70e('0x29')]=function(_0x14c9b5,_0x1d80a2){var _0x5221de={},_0x4bd08a={},_0x3e967d={'count':0x0,'rows':[]};var _0x10a277=_[_0xe70e('0x2a')](db[_0xe70e('0x2b')][_0xe70e('0x2c')],function(_0x2dacf5){return{'name':_0x2dacf5[_0xe70e('0x2d')],'type':_0x2dacf5[_0xe70e('0x2e')][_0xe70e('0x2f')]};});_0x4bd08a['model']=_[_0xe70e('0x2a')](_0x10a277,_0xe70e('0x27'));_0x4bd08a['query']=_[_0xe70e('0x30')](_0x14c9b5[_0xe70e('0x31')]);_0x4bd08a['filters']=_['intersection'](_0x4bd08a['model'],_0x4bd08a[_0xe70e('0x31')]);_0x5221de[_0xe70e('0x32')]=_[_0xe70e('0x33')](_0x4bd08a['model'],qs[_0xe70e('0x34')](_0x14c9b5[_0xe70e('0x31')][_0xe70e('0x34')]));_0x5221de['attributes']=_0x5221de[_0xe70e('0x32')]['length']?_0x5221de[_0xe70e('0x32')]:_0x4bd08a['model'];if(!_0x14c9b5['query'][_0xe70e('0x35')](_0xe70e('0x36'))){_0x5221de[_0xe70e('0x1d')]=qs[_0xe70e('0x1d')](_0x14c9b5[_0xe70e('0x31')][_0xe70e('0x1d')]);_0x5221de[_0xe70e('0x1b')]=qs[_0xe70e('0x1b')](_0x14c9b5[_0xe70e('0x31')][_0xe70e('0x1b')]);}_0x5221de['order']=qs[_0xe70e('0x37')](_0x14c9b5['query'][_0xe70e('0x37')]);_0x5221de[_0xe70e('0x38')]=qs[_0xe70e('0x39')](_[_0xe70e('0x3a')](_0x14c9b5[_0xe70e('0x31')],_0x4bd08a[_0xe70e('0x39')]),_0x10a277);if(_0x14c9b5[_0xe70e('0x31')][_0xe70e('0x3b')]){_0x5221de[_0xe70e('0x38')]=_[_0xe70e('0x3c')](_0x5221de[_0xe70e('0x38')],{'$or':_['map'](_0x10a277,function(_0x39242a){if(_0x39242a[_0xe70e('0x2e')]!==_0xe70e('0x3d')){var _0x169f37={};_0x169f37[_0x39242a[_0xe70e('0x27')]]={'$like':'%'+_0x14c9b5[_0xe70e('0x31')][_0xe70e('0x3b')]+'%'};return _0x169f37;}})});}_0x5221de=_[_0xe70e('0x3c')]({},_0x5221de,_0x14c9b5['options']);var _0x31477e={'where':_0x5221de['where']};return db[_0xe70e('0x2b')]['count'](_0x31477e)['then'](function(_0xbf5c1d){_0x3e967d[_0xe70e('0x1e')]=_0xbf5c1d;if(_0x14c9b5[_0xe70e('0x31')][_0xe70e('0x3e')]){_0x5221de[_0xe70e('0x3f')]=[{'all':!![]}];}return db[_0xe70e('0x2b')][_0xe70e('0x40')](_0x5221de);})[_0xe70e('0x23')](function(_0x12517b){_0x3e967d[_0xe70e('0x41')]=_0x12517b;return _0x3e967d;})[_0xe70e('0x23')](respondWithFilteredResult(_0x1d80a2,_0x5221de))[_0xe70e('0x42')](handleError(_0x1d80a2,null));};exports[_0xe70e('0x43')]=function(_0x384b8f,_0x279529){var _0x370676={'raw':![],'where':{'id':_0x384b8f[_0xe70e('0x44')]['id']}},_0xd0eaad={};_0xd0eaad['model']=_[_0xe70e('0x30')](db[_0xe70e('0x2b')]['rawAttributes']);_0xd0eaad[_0xe70e('0x31')]=_[_0xe70e('0x30')](_0x384b8f[_0xe70e('0x31')]);_0xd0eaad[_0xe70e('0x39')]=_[_0xe70e('0x33')](_0xd0eaad[_0xe70e('0x45')],_0xd0eaad[_0xe70e('0x31')]);_0x370676[_0xe70e('0x32')]=_[_0xe70e('0x33')](_0xd0eaad[_0xe70e('0x45')],qs[_0xe70e('0x34')](_0x384b8f[_0xe70e('0x31')][_0xe70e('0x34')]));_0x370676[_0xe70e('0x32')]=_0x370676[_0xe70e('0x32')][_0xe70e('0x46')]?_0x370676[_0xe70e('0x32')]:_0xd0eaad['model'];if(_0x384b8f[_0xe70e('0x31')][_0xe70e('0x3e')]){_0x370676[_0xe70e('0x3f')]=[{'all':!![]}];}_0x370676=_[_0xe70e('0x3c')]({},_0x370676,_0x384b8f['options']);return db['Automation']['find'](_0x370676)[_0xe70e('0x23')](handleEntityNotFound(_0x279529,null))['then'](respondWithResult(_0x279529,null))[_0xe70e('0x42')](handleError(_0x279529,null));};exports[_0xe70e('0x47')]=function(_0x5c97d5,_0x547336){return db['Automation'][_0xe70e('0x47')](_0x5c97d5[_0xe70e('0x48')],{})[_0xe70e('0x23')](respondWithResult(_0x547336,0xc9))['catch'](handleError(_0x547336,null));};exports[_0xe70e('0x49')]=function(_0x3070ad,_0x5cbd77){if(_0x3070ad[_0xe70e('0x48')]['id']){delete _0x3070ad['body']['id'];}return db[_0xe70e('0x2b')]['find']({'where':{'id':_0x3070ad[_0xe70e('0x44')]['id']}})[_0xe70e('0x23')](handleEntityNotFound(_0x5cbd77,null))['then'](saveUpdates(_0x3070ad['body'],null))[_0xe70e('0x23')](respondWithResult(_0x5cbd77,null))[_0xe70e('0x42')](handleError(_0x5cbd77,null));};exports[_0xe70e('0x24')]=function(_0x3799eb,_0x19222b){return db[_0xe70e('0x2b')][_0xe70e('0x4a')]({'where':{'id':_0x3799eb[_0xe70e('0x44')]['id']}})[_0xe70e('0x23')](handleEntityNotFound(_0x19222b,null))[_0xe70e('0x23')](removeEntity(_0x19222b,null))[_0xe70e('0x42')](handleError(_0x19222b,null));};exports[_0xe70e('0x4b')]=function(_0x2b4164,_0x145294,_0x398de5){return db[_0xe70e('0x4c')]['find']({'where':{'id':_0x2b4164[_0xe70e('0x44')]['id']}})[_0xe70e('0x23')](handleEntityNotFound(_0x145294,null))[_0xe70e('0x23')](function(_0x38b8d2){if(_0x38b8d2){return _0x38b8d2[_0xe70e('0x4b')](_0x2b4164['body'][_0xe70e('0x4d')],_[_0xe70e('0x4e')](_0x2b4164[_0xe70e('0x48')],[_0xe70e('0x4d'),'id'])||{});}})[_0xe70e('0x23')](respondWithResult(_0x145294,null))['catch'](handleError(_0x145294,null));};exports[_0xe70e('0x4f')]=function(_0x10961b,_0x38a986,_0xb5a8db){var _0x8380b0={};var _0x475c90={};var _0x5d2896;var _0x2e7e9b;return db[_0xe70e('0x2b')]['findOne']({'where':{'id':_0x10961b[_0xe70e('0x44')]['id']}})[_0xe70e('0x23')](handleEntityNotFound(_0x38a986,null))[_0xe70e('0x23')](function(_0x15c4b9){if(_0x15c4b9){_0x5d2896=_0x15c4b9;_0x475c90[_0xe70e('0x45')]=_[_0xe70e('0x30')](db[_0xe70e('0x4c')][_0xe70e('0x2c')]);_0x475c90[_0xe70e('0x31')]=_[_0xe70e('0x30')](_0x10961b[_0xe70e('0x31')]);_0x475c90[_0xe70e('0x39')]=_[_0xe70e('0x33')](_0x475c90[_0xe70e('0x45')],_0x475c90['query']);_0x8380b0[_0xe70e('0x32')]=_[_0xe70e('0x33')](_0x475c90[_0xe70e('0x45')],qs[_0xe70e('0x34')](_0x10961b[_0xe70e('0x31')][_0xe70e('0x34')]));_0x8380b0[_0xe70e('0x32')]=_0x8380b0[_0xe70e('0x32')][_0xe70e('0x46')]?_0x8380b0['attributes']:_0x475c90[_0xe70e('0x45')];_0x8380b0[_0xe70e('0x50')]=qs[_0xe70e('0x37')](_0x10961b['query'][_0xe70e('0x37')]);_0x8380b0[_0xe70e('0x38')]=qs[_0xe70e('0x39')](_[_0xe70e('0x3a')](_0x10961b['query'],_0x475c90['filters']));if(_0x10961b[_0xe70e('0x31')][_0xe70e('0x3b')]){_0x8380b0[_0xe70e('0x38')]=_['merge'](_0x8380b0[_0xe70e('0x38')],{'$or':_['map'](_0x8380b0[_0xe70e('0x32')],function(_0x9cb7cf){var _0x31eb90={};_0x31eb90[_0x9cb7cf]={'$like':'%'+_0x10961b[_0xe70e('0x31')][_0xe70e('0x3b')]+'%'};return _0x31eb90;})});}_0x8380b0=_[_0xe70e('0x3c')]({},_0x8380b0,_0x10961b[_0xe70e('0x51')]);return _0x5d2896['getConditions'](_0x8380b0);}})['then'](function(_0x3ea581){if(_0x3ea581){_0x2e7e9b=_0x3ea581['length'];if(!_0x10961b[_0xe70e('0x31')][_0xe70e('0x35')](_0xe70e('0x36'))){_0x8380b0[_0xe70e('0x1d')]=qs['limit'](_0x10961b[_0xe70e('0x31')][_0xe70e('0x1d')]);_0x8380b0[_0xe70e('0x1b')]=qs[_0xe70e('0x1b')](_0x10961b[_0xe70e('0x31')][_0xe70e('0x1b')]);}return _0x5d2896[_0xe70e('0x4f')](_0x8380b0);}})[_0xe70e('0x23')](function(_0x584567){if(_0x584567){return _0x584567?{'count':_0x2e7e9b,'rows':_0x584567}:null;}})['then'](respondWithResult(_0x38a986,null))[_0xe70e('0x42')](handleError(_0x38a986,null));};exports['addActions']=function(_0x345797,_0x48af3c,_0x389a3f){return db[_0xe70e('0x52')]['find']({'where':{'id':_0x345797['params']['id']}})[_0xe70e('0x23')](handleEntityNotFound(_0x48af3c,null))['then'](function(_0x3a4986){if(_0x3a4986){return _0x3a4986[_0xe70e('0x53')](_0x345797[_0xe70e('0x48')][_0xe70e('0x4d')],_['omit'](_0x345797[_0xe70e('0x48')],['ids','id'])||{});}})['then'](respondWithResult(_0x48af3c,null))[_0xe70e('0x42')](handleError(_0x48af3c,null));};exports['getActions']=function(_0x348ac5,_0x2b17b5,_0x4841af){var _0x4ae2f2={};var _0x13f050={};var _0x44d894;var _0x56ff2b;return db[_0xe70e('0x2b')][_0xe70e('0x54')]({'where':{'id':_0x348ac5[_0xe70e('0x44')]['id']}})['then'](handleEntityNotFound(_0x2b17b5,null))['then'](function(_0x233c11){if(_0x233c11){_0x44d894=_0x233c11;_0x13f050[_0xe70e('0x45')]=_['keys'](db[_0xe70e('0x52')][_0xe70e('0x2c')]);_0x13f050['query']=_[_0xe70e('0x30')](_0x348ac5['query']);_0x13f050[_0xe70e('0x39')]=_[_0xe70e('0x33')](_0x13f050['model'],_0x13f050[_0xe70e('0x31')]);_0x4ae2f2[_0xe70e('0x32')]=_[_0xe70e('0x33')](_0x13f050['model'],qs[_0xe70e('0x34')](_0x348ac5[_0xe70e('0x31')][_0xe70e('0x34')]));_0x4ae2f2['attributes']=_0x4ae2f2[_0xe70e('0x32')][_0xe70e('0x46')]?_0x4ae2f2[_0xe70e('0x32')]:_0x13f050['model'];_0x4ae2f2[_0xe70e('0x50')]=qs[_0xe70e('0x37')](_0x348ac5['query'][_0xe70e('0x37')]);_0x4ae2f2[_0xe70e('0x38')]=qs[_0xe70e('0x39')](_[_0xe70e('0x3a')](_0x348ac5[_0xe70e('0x31')],_0x13f050[_0xe70e('0x39')]));if(_0x348ac5[_0xe70e('0x31')]['filter']){_0x4ae2f2[_0xe70e('0x38')]=_['merge'](_0x4ae2f2['where'],{'$or':_[_0xe70e('0x2a')](_0x4ae2f2[_0xe70e('0x32')],function(_0x2d7dc8){var _0x510067={};_0x510067[_0x2d7dc8]={'$like':'%'+_0x348ac5[_0xe70e('0x31')][_0xe70e('0x3b')]+'%'};return _0x510067;})});}_0x4ae2f2=_[_0xe70e('0x3c')]({},_0x4ae2f2,_0x348ac5[_0xe70e('0x51')]);return _0x44d894[_0xe70e('0x55')](_0x4ae2f2);}})[_0xe70e('0x23')](function(_0x4d747f){if(_0x4d747f){_0x56ff2b=_0x4d747f['length'];if(!_0x348ac5[_0xe70e('0x31')][_0xe70e('0x35')]('nolimit')){_0x4ae2f2[_0xe70e('0x1d')]=qs[_0xe70e('0x1d')](_0x348ac5[_0xe70e('0x31')][_0xe70e('0x1d')]);_0x4ae2f2[_0xe70e('0x1b')]=qs[_0xe70e('0x1b')](_0x348ac5[_0xe70e('0x31')][_0xe70e('0x1b')]);}return _0x44d894[_0xe70e('0x55')](_0x4ae2f2);}})[_0xe70e('0x23')](function(_0x3b40e4){if(_0x3b40e4){return _0x3b40e4?{'count':_0x56ff2b,'rows':_0x3b40e4}:null;}})[_0xe70e('0x23')](respondWithResult(_0x2b17b5,null))[_0xe70e('0x42')](handleError(_0x2b17b5,null));}; \ No newline at end of file +var _0x181d=['intersection','model','fields','attributes','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','options','include','findAll','rows','catch','show','length','includeAll','find','create','body','params','addConditions','Condition','ids','omit','getConditions','addActions','Action','findOne','getActions','nolimit','rimraf','zip-dir','util','path','sox','to-csv','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','status','set','apply','reject','save','update','then','destroy','stack','name','send','map','Automation','rawAttributes','fieldName','type','key','query','keys'];(function(_0x45ff8d,_0x5adde4){var _0x4c63cc=function(_0x4535a0){while(--_0x4535a0){_0x45ff8d['push'](_0x45ff8d['shift']());}};_0x4c63cc(++_0x5adde4);}(_0x181d,0xbf));var _0xd181=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x181d[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd181('0x0'));var zipdir=require(_0xd181('0x1'));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(_0xd181('0x2'));var path=require(_0xd181('0x3'));var sox=require(_0xd181('0x4'));var csv=require(_0xd181('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd181('0x6'));var squel=require(_0xd181('0x7'));var crypto=require(_0xd181('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd181('0x5'));var querystring=require('querystring');var Papa=require(_0xd181('0x9'));var Redis=require(_0xd181('0xa'));var authService=require(_0xd181('0xb'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd181('0xc'));var logger=require(_0xd181('0xd'))('api');var utils=require(_0xd181('0xe'));var config=require(_0xd181('0xf'));var licenseUtil=require(_0xd181('0x10'));var db=require(_0xd181('0x11'))['db'];function respondWithStatusCode(_0x47fd23,_0x5eaa01){_0x5eaa01=_0x5eaa01||0xcc;return function(_0x2a193e){if(_0x2a193e){return _0x47fd23[_0xd181('0x12')](_0x5eaa01);}return _0x47fd23['status'](_0x5eaa01)[_0xd181('0x13')]();};}function respondWithResult(_0xee752b,_0x1daf7c){_0x1daf7c=_0x1daf7c||0xc8;return function(_0x51522c){if(_0x51522c){return _0xee752b['status'](_0x1daf7c)[_0xd181('0x14')](_0x51522c);}};}function respondWithFilteredResult(_0x409dcc,_0x244058){return function(_0x4cd054){if(_0x4cd054){var _0x115016=typeof _0x244058[_0xd181('0x15')]===_0xd181('0x16')&&typeof _0x244058['limit']===_0xd181('0x16');var _0x1c6c0b=_0x4cd054[_0xd181('0x17')];var _0x534188=_0x115016?0x0:_0x244058[_0xd181('0x15')];var _0x193f8d=_0x115016?_0x4cd054[_0xd181('0x17')]:_0x244058[_0xd181('0x15')]+_0x244058['limit'];var _0x59b973;if(_0x193f8d>=_0x1c6c0b){_0x193f8d=_0x1c6c0b;_0x59b973=0xc8;}else{_0x59b973=0xce;}_0x409dcc[_0xd181('0x18')](_0x59b973);return _0x409dcc[_0xd181('0x19')]('Content-Range',_0x534188+'-'+_0x193f8d+'/'+_0x1c6c0b)[_0xd181('0x14')](_0x4cd054);}return null;};}function patchUpdates(_0x33a715){return function(_0x1a0fce){try{jsonpatch[_0xd181('0x1a')](_0x1a0fce,_0x33a715,!![]);}catch(_0x57b195){return BPromise[_0xd181('0x1b')](_0x57b195);}return _0x1a0fce[_0xd181('0x1c')]();};}function saveUpdates(_0x1f6860,_0x281abb){return function(_0x3061c3){if(_0x3061c3){return _0x3061c3[_0xd181('0x1d')](_0x1f6860)[_0xd181('0x1e')](function(_0x371a00){return _0x371a00;});}return null;};}function removeEntity(_0x194cc8,_0x5938ed){return function(_0x4e7feb){if(_0x4e7feb){return _0x4e7feb[_0xd181('0x1f')]()[_0xd181('0x1e')](function(){_0x194cc8[_0xd181('0x18')](0xcc)[_0xd181('0x13')]();});}};}function handleEntityNotFound(_0xc34d42,_0x2fc6c7){return function(_0x54126d){if(!_0x54126d){_0xc34d42[_0xd181('0x12')](0x194);}return _0x54126d;};}function handleError(_0x16ea54,_0x2f2aac){_0x2f2aac=_0x2f2aac||0x1f4;return function(_0x376460){logger['error'](_0x376460[_0xd181('0x20')]);if(_0x376460[_0xd181('0x21')]){delete _0x376460[_0xd181('0x21')];}_0x16ea54['status'](_0x2f2aac)[_0xd181('0x22')](_0x376460);};}exports['index']=function(_0x36c63d,_0x3a3b01){var _0xdeebd3={},_0x383166={},_0x3512b1={'count':0x0,'rows':[]};var _0x41708f=_[_0xd181('0x23')](db[_0xd181('0x24')][_0xd181('0x25')],function(_0x8143ba){return{'name':_0x8143ba[_0xd181('0x26')],'type':_0x8143ba[_0xd181('0x27')][_0xd181('0x28')]};});_0x383166['model']=_[_0xd181('0x23')](_0x41708f,_0xd181('0x21'));_0x383166[_0xd181('0x29')]=_[_0xd181('0x2a')](_0x36c63d[_0xd181('0x29')]);_0x383166['filters']=_[_0xd181('0x2b')](_0x383166[_0xd181('0x2c')],_0x383166[_0xd181('0x29')]);_0xdeebd3['attributes']=_[_0xd181('0x2b')](_0x383166['model'],qs[_0xd181('0x2d')](_0x36c63d[_0xd181('0x29')][_0xd181('0x2d')]));_0xdeebd3[_0xd181('0x2e')]=_0xdeebd3[_0xd181('0x2e')]['length']?_0xdeebd3[_0xd181('0x2e')]:_0x383166[_0xd181('0x2c')];if(!_0x36c63d[_0xd181('0x29')][_0xd181('0x2f')]('nolimit')){_0xdeebd3[_0xd181('0x30')]=qs[_0xd181('0x30')](_0x36c63d[_0xd181('0x29')][_0xd181('0x30')]);_0xdeebd3[_0xd181('0x15')]=qs['offset'](_0x36c63d[_0xd181('0x29')][_0xd181('0x15')]);}_0xdeebd3[_0xd181('0x31')]=qs['sort'](_0x36c63d[_0xd181('0x29')][_0xd181('0x32')]);_0xdeebd3[_0xd181('0x33')]=qs[_0xd181('0x34')](_[_0xd181('0x35')](_0x36c63d[_0xd181('0x29')],_0x383166[_0xd181('0x34')]),_0x41708f);if(_0x36c63d[_0xd181('0x29')][_0xd181('0x36')]){_0xdeebd3[_0xd181('0x33')]=_['merge'](_0xdeebd3[_0xd181('0x33')],{'$or':_[_0xd181('0x23')](_0x41708f,function(_0xee1967){if(_0xee1967[_0xd181('0x27')]!=='VIRTUAL'){var _0x1c3370={};_0x1c3370[_0xee1967[_0xd181('0x21')]]={'$like':'%'+_0x36c63d['query'][_0xd181('0x36')]+'%'};return _0x1c3370;}})});}_0xdeebd3=_[_0xd181('0x37')]({},_0xdeebd3,_0x36c63d[_0xd181('0x38')]);var _0x479596={'where':_0xdeebd3[_0xd181('0x33')]};return db['Automation'][_0xd181('0x17')](_0x479596)[_0xd181('0x1e')](function(_0x147365){_0x3512b1[_0xd181('0x17')]=_0x147365;if(_0x36c63d[_0xd181('0x29')]['includeAll']){_0xdeebd3[_0xd181('0x39')]=[{'all':!![]}];}return db[_0xd181('0x24')][_0xd181('0x3a')](_0xdeebd3);})[_0xd181('0x1e')](function(_0x13feed){_0x3512b1[_0xd181('0x3b')]=_0x13feed;return _0x3512b1;})[_0xd181('0x1e')](respondWithFilteredResult(_0x3a3b01,_0xdeebd3))[_0xd181('0x3c')](handleError(_0x3a3b01,null));};exports[_0xd181('0x3d')]=function(_0x19b46c,_0x365fbb){var _0x378938={'raw':![],'where':{'id':_0x19b46c['params']['id']}},_0x238564={};_0x238564[_0xd181('0x2c')]=_[_0xd181('0x2a')](db['Automation'][_0xd181('0x25')]);_0x238564[_0xd181('0x29')]=_[_0xd181('0x2a')](_0x19b46c[_0xd181('0x29')]);_0x238564[_0xd181('0x34')]=_['intersection'](_0x238564[_0xd181('0x2c')],_0x238564[_0xd181('0x29')]);_0x378938[_0xd181('0x2e')]=_['intersection'](_0x238564['model'],qs['fields'](_0x19b46c[_0xd181('0x29')]['fields']));_0x378938[_0xd181('0x2e')]=_0x378938[_0xd181('0x2e')][_0xd181('0x3e')]?_0x378938[_0xd181('0x2e')]:_0x238564[_0xd181('0x2c')];if(_0x19b46c[_0xd181('0x29')][_0xd181('0x3f')]){_0x378938[_0xd181('0x39')]=[{'all':!![]}];}_0x378938=_[_0xd181('0x37')]({},_0x378938,_0x19b46c[_0xd181('0x38')]);return db[_0xd181('0x24')][_0xd181('0x40')](_0x378938)[_0xd181('0x1e')](handleEntityNotFound(_0x365fbb,null))[_0xd181('0x1e')](respondWithResult(_0x365fbb,null))[_0xd181('0x3c')](handleError(_0x365fbb,null));};exports[_0xd181('0x41')]=function(_0x10055b,_0x1ffb8c){return db[_0xd181('0x24')]['create'](_0x10055b[_0xd181('0x42')],{})[_0xd181('0x1e')](respondWithResult(_0x1ffb8c,0xc9))[_0xd181('0x3c')](handleError(_0x1ffb8c,null));};exports[_0xd181('0x1d')]=function(_0x5d2a6a,_0x28c715){if(_0x5d2a6a['body']['id']){delete _0x5d2a6a[_0xd181('0x42')]['id'];}return db[_0xd181('0x24')][_0xd181('0x40')]({'where':{'id':_0x5d2a6a[_0xd181('0x43')]['id']}})['then'](handleEntityNotFound(_0x28c715,null))['then'](saveUpdates(_0x5d2a6a['body'],null))[_0xd181('0x1e')](respondWithResult(_0x28c715,null))[_0xd181('0x3c')](handleError(_0x28c715,null));};exports[_0xd181('0x1f')]=function(_0x1b1f41,_0x376c88){return db[_0xd181('0x24')][_0xd181('0x40')]({'where':{'id':_0x1b1f41[_0xd181('0x43')]['id']}})[_0xd181('0x1e')](handleEntityNotFound(_0x376c88,null))[_0xd181('0x1e')](removeEntity(_0x376c88,null))[_0xd181('0x3c')](handleError(_0x376c88,null));};exports[_0xd181('0x44')]=function(_0xe3711d,_0x50b7a3,_0x574785){return db[_0xd181('0x45')][_0xd181('0x40')]({'where':{'id':_0xe3711d['params']['id']}})[_0xd181('0x1e')](handleEntityNotFound(_0x50b7a3,null))[_0xd181('0x1e')](function(_0x46a4db){if(_0x46a4db){return _0x46a4db[_0xd181('0x44')](_0xe3711d['body'][_0xd181('0x46')],_[_0xd181('0x47')](_0xe3711d[_0xd181('0x42')],['ids','id'])||{});}})['then'](respondWithResult(_0x50b7a3,null))[_0xd181('0x3c')](handleError(_0x50b7a3,null));};exports[_0xd181('0x48')]=function(_0x42d31d,_0x3dce33,_0x1b7103){var _0x39b478={};var _0x31d2ed={};var _0x20bfa8;var _0x58fb97;return db[_0xd181('0x24')]['findOne']({'where':{'id':_0x42d31d[_0xd181('0x43')]['id']}})['then'](handleEntityNotFound(_0x3dce33,null))[_0xd181('0x1e')](function(_0x220bce){if(_0x220bce){_0x20bfa8=_0x220bce;_0x31d2ed[_0xd181('0x2c')]=_[_0xd181('0x2a')](db['Condition']['rawAttributes']);_0x31d2ed['query']=_['keys'](_0x42d31d['query']);_0x31d2ed['filters']=_[_0xd181('0x2b')](_0x31d2ed[_0xd181('0x2c')],_0x31d2ed['query']);_0x39b478[_0xd181('0x2e')]=_['intersection'](_0x31d2ed[_0xd181('0x2c')],qs[_0xd181('0x2d')](_0x42d31d[_0xd181('0x29')][_0xd181('0x2d')]));_0x39b478[_0xd181('0x2e')]=_0x39b478[_0xd181('0x2e')][_0xd181('0x3e')]?_0x39b478[_0xd181('0x2e')]:_0x31d2ed[_0xd181('0x2c')];_0x39b478[_0xd181('0x31')]=qs[_0xd181('0x32')](_0x42d31d[_0xd181('0x29')]['sort']);_0x39b478['where']=qs['filters'](_['pick'](_0x42d31d[_0xd181('0x29')],_0x31d2ed[_0xd181('0x34')]));if(_0x42d31d[_0xd181('0x29')][_0xd181('0x36')]){_0x39b478[_0xd181('0x33')]=_[_0xd181('0x37')](_0x39b478[_0xd181('0x33')],{'$or':_[_0xd181('0x23')](_0x39b478[_0xd181('0x2e')],function(_0xddfb59){var _0x28e8e2={};_0x28e8e2[_0xddfb59]={'$like':'%'+_0x42d31d[_0xd181('0x29')][_0xd181('0x36')]+'%'};return _0x28e8e2;})});}_0x39b478=_[_0xd181('0x37')]({},_0x39b478,_0x42d31d[_0xd181('0x38')]);return _0x20bfa8[_0xd181('0x48')](_0x39b478);}})[_0xd181('0x1e')](function(_0x17f510){if(_0x17f510){_0x58fb97=_0x17f510['length'];if(!_0x42d31d[_0xd181('0x29')][_0xd181('0x2f')]('nolimit')){_0x39b478[_0xd181('0x30')]=qs['limit'](_0x42d31d[_0xd181('0x29')][_0xd181('0x30')]);_0x39b478[_0xd181('0x15')]=qs[_0xd181('0x15')](_0x42d31d[_0xd181('0x29')][_0xd181('0x15')]);}return _0x20bfa8[_0xd181('0x48')](_0x39b478);}})[_0xd181('0x1e')](function(_0x1c48d8){if(_0x1c48d8){return _0x1c48d8?{'count':_0x58fb97,'rows':_0x1c48d8}:null;}})[_0xd181('0x1e')](respondWithResult(_0x3dce33,null))['catch'](handleError(_0x3dce33,null));};exports[_0xd181('0x49')]=function(_0x2b868d,_0x35a5a0,_0x4cb3ce){return db[_0xd181('0x4a')][_0xd181('0x40')]({'where':{'id':_0x2b868d[_0xd181('0x43')]['id']}})[_0xd181('0x1e')](handleEntityNotFound(_0x35a5a0,null))['then'](function(_0x385c49){if(_0x385c49){return _0x385c49[_0xd181('0x49')](_0x2b868d[_0xd181('0x42')][_0xd181('0x46')],_[_0xd181('0x47')](_0x2b868d[_0xd181('0x42')],[_0xd181('0x46'),'id'])||{});}})[_0xd181('0x1e')](respondWithResult(_0x35a5a0,null))[_0xd181('0x3c')](handleError(_0x35a5a0,null));};exports['getActions']=function(_0x54ecf4,_0x2d1923,_0x4b4644){var _0x44078f={};var _0x4f525d={};var _0x50b41b;var _0x3bd647;return db[_0xd181('0x24')][_0xd181('0x4b')]({'where':{'id':_0x54ecf4['params']['id']}})[_0xd181('0x1e')](handleEntityNotFound(_0x2d1923,null))['then'](function(_0x4d668b){if(_0x4d668b){_0x50b41b=_0x4d668b;_0x4f525d[_0xd181('0x2c')]=_[_0xd181('0x2a')](db[_0xd181('0x4a')][_0xd181('0x25')]);_0x4f525d[_0xd181('0x29')]=_[_0xd181('0x2a')](_0x54ecf4[_0xd181('0x29')]);_0x4f525d[_0xd181('0x34')]=_['intersection'](_0x4f525d[_0xd181('0x2c')],_0x4f525d['query']);_0x44078f[_0xd181('0x2e')]=_['intersection'](_0x4f525d[_0xd181('0x2c')],qs[_0xd181('0x2d')](_0x54ecf4[_0xd181('0x29')][_0xd181('0x2d')]));_0x44078f[_0xd181('0x2e')]=_0x44078f[_0xd181('0x2e')][_0xd181('0x3e')]?_0x44078f[_0xd181('0x2e')]:_0x4f525d[_0xd181('0x2c')];_0x44078f[_0xd181('0x31')]=qs[_0xd181('0x32')](_0x54ecf4[_0xd181('0x29')][_0xd181('0x32')]);_0x44078f['where']=qs[_0xd181('0x34')](_['pick'](_0x54ecf4[_0xd181('0x29')],_0x4f525d[_0xd181('0x34')]));if(_0x54ecf4[_0xd181('0x29')][_0xd181('0x36')]){_0x44078f['where']=_[_0xd181('0x37')](_0x44078f[_0xd181('0x33')],{'$or':_[_0xd181('0x23')](_0x44078f[_0xd181('0x2e')],function(_0x599252){var _0x2c5756={};_0x2c5756[_0x599252]={'$like':'%'+_0x54ecf4[_0xd181('0x29')][_0xd181('0x36')]+'%'};return _0x2c5756;})});}_0x44078f=_[_0xd181('0x37')]({},_0x44078f,_0x54ecf4[_0xd181('0x38')]);return _0x50b41b[_0xd181('0x4c')](_0x44078f);}})[_0xd181('0x1e')](function(_0x4dc2d8){if(_0x4dc2d8){_0x3bd647=_0x4dc2d8[_0xd181('0x3e')];if(!_0x54ecf4[_0xd181('0x29')][_0xd181('0x2f')](_0xd181('0x4d'))){_0x44078f[_0xd181('0x30')]=qs[_0xd181('0x30')](_0x54ecf4['query'][_0xd181('0x30')]);_0x44078f['offset']=qs[_0xd181('0x15')](_0x54ecf4[_0xd181('0x29')][_0xd181('0x15')]);}return _0x50b41b['getActions'](_0x44078f);}})[_0xd181('0x1e')](function(_0x4e8138){if(_0x4e8138){return _0x4e8138?{'count':_0x3bd647,'rows':_0x4e8138}:null;}})['then'](respondWithResult(_0x2d1923,null))[_0xd181('0x3c')](handleError(_0x2d1923,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 3769046..e2abf96 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 _0xeb61=['exports','define','Automation','tools_automations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./automation.attributes'];(function(_0x3cd91b,_0x2619fc){var _0x31c1c7=function(_0x391981){while(--_0x391981){_0x3cd91b['push'](_0x3cd91b['shift']());}};_0x31c1c7(++_0x2619fc);}(_0xeb61,0x1a8));var _0x1eb6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xeb61[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1eb6('0x0'));var util=require(_0x1eb6('0x1'));var logger=require(_0x1eb6('0x2'))(_0x1eb6('0x3'));var moment=require(_0x1eb6('0x4'));var BPromise=require(_0x1eb6('0x5'));var rp=require(_0x1eb6('0x6'));var fs=require('fs');var path=require(_0x1eb6('0x7'));var rimraf=require(_0x1eb6('0x8'));var config=require(_0x1eb6('0x9'));var attributes=require(_0x1eb6('0xa'));module[_0x1eb6('0xb')]=function(_0x3f9500,_0x4a0122){return _0x3f9500[_0x1eb6('0xc')](_0x1eb6('0xd'),attributes,{'tableName':_0x1eb6('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf446=['define','lodash','util','request-promise','rimraf','../../config/environment','./automation.attributes','exports'];(function(_0x4b2c99,_0x4d101f){var _0xb4e918=function(_0x1a0375){while(--_0x1a0375){_0x4b2c99['push'](_0x4b2c99['shift']());}};_0xb4e918(++_0x4d101f);}(_0xf446,0x189));var _0x6f44=function(_0x5f5327,_0x52b78c){_0x5f5327=_0x5f5327-0x0;var _0x21301b=_0xf446[_0x5f5327];return _0x21301b;};'use strict';var _=require(_0x6f44('0x0'));var util=require(_0x6f44('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6f44('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6f44('0x3'));var config=require(_0x6f44('0x4'));var attributes=require(_0x6f44('0x5'));module[_0x6f44('0x6')]=function(_0x34526d,_0x3bb0a9){return _0x34526d[_0x6f44('0x7')]('Automation',attributes,{'tableName':'tools_automations','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 4773208..b10074a 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 _0x5942=['stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','Automation,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2135df,_0x16cd72){var _0x24397e=function(_0x3d3ac7){while(--_0x3d3ac7){_0x2135df['push'](_0x2135df['shift']());}};_0x24397e(++_0x16cd72);}(_0x5942,0x16a));var _0x2594=function(_0x4fa40f,_0x14d5c5){_0x4fa40f=_0x4fa40f-0x0;var _0x2b0e0c=_0x5942[_0x4fa40f];return _0x2b0e0c;};'use strict';var _=require(_0x2594('0x0'));var util=require(_0x2594('0x1'));var moment=require(_0x2594('0x2'));var BPromise=require(_0x2594('0x3'));var rs=require(_0x2594('0x4'));var fs=require('fs');var Redis=require(_0x2594('0x5'));var db=require(_0x2594('0x6'))['db'];var utils=require(_0x2594('0x7'));var logger=require(_0x2594('0x8'))(_0x2594('0x9'));var config=require(_0x2594('0xa'));var jayson=require(_0x2594('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x381472,_0xd0ada5,_0x3d20aa){return new BPromise(function(_0x5707a0,_0x2b42d3){return client[_0x2594('0xc')](_0x381472,_0x3d20aa)['then'](function(_0x29517f){logger['info'](_0x2594('0xd'),_0xd0ada5,_0x2594('0xe'));logger[_0x2594('0xf')]('Automation,\x20%s,\x20%s,\x20%s',_0xd0ada5,_0x2594('0xe'),JSON[_0x2594('0x10')](_0x29517f));if(_0x29517f[_0x2594('0x11')]){if(_0x29517f[_0x2594('0x11')]['code']===0x1f4){logger[_0x2594('0x11')](_0x2594('0xd'),_0xd0ada5,_0x29517f[_0x2594('0x11')][_0x2594('0x12')]);return _0x2b42d3(_0x29517f[_0x2594('0x11')][_0x2594('0x12')]);}logger[_0x2594('0x11')](_0x2594('0xd'),_0xd0ada5,_0x29517f[_0x2594('0x11')]['message']);return _0x5707a0(_0x29517f[_0x2594('0x11')][_0x2594('0x12')]);}else{logger['info'](_0x2594('0xd'),_0xd0ada5,'request\x20sent');_0x5707a0(_0x29517f[_0x2594('0x13')][_0x2594('0x12')]);}})[_0x2594('0x14')](function(_0x33b4bc){logger[_0x2594('0x11')]('Automation,\x20%s,\x20%s',_0xd0ada5,_0x33b4bc);_0x2b42d3(_0x33b4bc);});});} \ No newline at end of file +var _0xcf2f=['stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s'];(function(_0x5e8584,_0xab5d1f){var _0x500b5a=function(_0x5b4223){while(--_0x5b4223){_0x5e8584['push'](_0x5e8584['shift']());}};_0x500b5a(++_0xab5d1f);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x7e9e04,_0xb3b10){_0x7e9e04=_0x7e9e04-0x0;var _0x1e501b=_0xcf2f[_0x7e9e04];return _0x1e501b;};'use strict';var _=require(_0xfcf2('0x0'));var util=require(_0xfcf2('0x1'));var moment=require(_0xfcf2('0x2'));var BPromise=require(_0xfcf2('0x3'));var rs=require(_0xfcf2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfcf2('0x5'))['db'];var utils=require(_0xfcf2('0x6'));var logger=require(_0xfcf2('0x7'))(_0xfcf2('0x8'));var config=require(_0xfcf2('0x9'));var jayson=require(_0xfcf2('0xa'));var client=jayson[_0xfcf2('0xb')][_0xfcf2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x41d4bd,_0x157f48,_0x16b6b2){return new BPromise(function(_0x34f444,_0xb4c510){return client[_0xfcf2('0xd')](_0x41d4bd,_0x16b6b2)['then'](function(_0x575f33){logger['info'](_0xfcf2('0xe'),_0x157f48,_0xfcf2('0xf'));logger['debug'](_0xfcf2('0x10'),_0x157f48,_0xfcf2('0xf'),JSON[_0xfcf2('0x11')](_0x575f33));if(_0x575f33[_0xfcf2('0x12')]){if(_0x575f33['error']['code']===0x1f4){logger[_0xfcf2('0x12')](_0xfcf2('0xe'),_0x157f48,_0x575f33[_0xfcf2('0x12')][_0xfcf2('0x13')]);return _0xb4c510(_0x575f33['error'][_0xfcf2('0x13')]);}logger['error']('Automation,\x20%s,\x20%s',_0x157f48,_0x575f33['error'][_0xfcf2('0x13')]);return _0x34f444(_0x575f33['error'][_0xfcf2('0x13')]);}else{logger[_0xfcf2('0x14')](_0xfcf2('0xe'),_0x157f48,_0xfcf2('0xf'));_0x34f444(_0x575f33[_0xfcf2('0x15')][_0xfcf2('0x13')]);}})[_0xfcf2('0x16')](function(_0x4d64ce){logger[_0xfcf2('0x12')](_0xfcf2('0xe'),_0x157f48,_0x4d64ce);_0xb4c510(_0x4d64ce);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 1148158..aeae7c4 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 _0xeec3=['destroy','multer','util','../../components/auth/service','../../components/interaction/service','./automation.controller','isAuthenticated','index','/:id','show','get','/:id/conditions','getConditions','post','create','addActions','put','update'];(function(_0x541260,_0x4c7f2e){var _0x1dd2b5=function(_0x4140de){while(--_0x4140de){_0x541260['push'](_0x541260['shift']());}};_0x1dd2b5(++_0x4c7f2e);}(_0xeec3,0x1c3));var _0x3eec=function(_0x3178be,_0x45cb3e){_0x3178be=_0x3178be-0x0;var _0x118180=_0xeec3[_0x3178be];return _0x118180;};'use strict';var multer=require(_0x3eec('0x0'));var util=require(_0x3eec('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3eec('0x2'));var interaction=require(_0x3eec('0x3'));var config=require('../../config/environment');var controller=require(_0x3eec('0x4'));router['get']('/',auth[_0x3eec('0x5')](),controller[_0x3eec('0x6')]);router['get'](_0x3eec('0x7'),auth[_0x3eec('0x5')](),controller[_0x3eec('0x8')]);router[_0x3eec('0x9')](_0x3eec('0xa'),auth[_0x3eec('0x5')](),controller[_0x3eec('0xb')]);router[_0x3eec('0x9')]('/:id/actions',auth[_0x3eec('0x5')](),controller['getActions']);router[_0x3eec('0xc')]('/',auth[_0x3eec('0x5')](),controller[_0x3eec('0xd')]);router[_0x3eec('0xc')]('/:id/conditions',auth[_0x3eec('0x5')](),controller['addConditions']);router['post']('/:id/actions',auth[_0x3eec('0x5')](),controller[_0x3eec('0xe')]);router[_0x3eec('0xf')](_0x3eec('0x7'),auth['isAuthenticated'](),controller[_0x3eec('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x3eec('0x11')]);module['exports']=router; \ No newline at end of file +var _0x5da1=['addConditions','addActions','put','update','delete','destroy','exports','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./automation.controller','isAuthenticated','index','get','/:id','show','/:id/conditions','getConditions','getActions','post','create'];(function(_0x5d31c5,_0x5414c8){var _0x48ff31=function(_0x381a23){while(--_0x381a23){_0x5d31c5['push'](_0x5d31c5['shift']());}};_0x48ff31(++_0x5414c8);}(_0x5da1,0xbf));var _0x15da=function(_0x2e150a,_0x3253d3){_0x2e150a=_0x2e150a-0x0;var _0x16cc6f=_0x5da1[_0x2e150a];return _0x16cc6f;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x15da('0x0'));var express=require(_0x15da('0x1'));var router=express[_0x15da('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x15da('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x15da('0x4'));var controller=require(_0x15da('0x5'));router['get']('/',auth[_0x15da('0x6')](),controller[_0x15da('0x7')]);router[_0x15da('0x8')](_0x15da('0x9'),auth[_0x15da('0x6')](),controller[_0x15da('0xa')]);router[_0x15da('0x8')](_0x15da('0xb'),auth['isAuthenticated'](),controller[_0x15da('0xc')]);router[_0x15da('0x8')]('/:id/actions',auth[_0x15da('0x6')](),controller[_0x15da('0xd')]);router[_0x15da('0xe')]('/',auth['isAuthenticated'](),controller[_0x15da('0xf')]);router['post'](_0x15da('0xb'),auth['isAuthenticated'](),controller[_0x15da('0x10')]);router[_0x15da('0xe')]('/:id/actions',auth[_0x15da('0x6')](),controller[_0x15da('0x11')]);router[_0x15da('0x12')](_0x15da('0x9'),auth[_0x15da('0x6')](),controller[_0x15da('0x13')]);router[_0x15da('0x14')]('/:id',auth[_0x15da('0x6')](),controller[_0x15da('0x15')]);module[_0x15da('0x16')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index d4252fb..e59449a 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 _0xe695=['#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','ENUM','ivr','STRING','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','INTEGER','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)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','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','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x18583c,_0x3d1c08){var _0x16f5b2=function(_0x361a4b){while(--_0x361a4b){_0x18583c['push'](_0x18583c['shift']());}};_0x16f5b2(++_0x3d1c08);}(_0xe695,0x1cb));var _0x5e69=function(_0x20fbad,_0x4337bc){_0x20fbad=_0x20fbad-0x0;var _0x11cb63=_0xe695[_0x20fbad];return _0x11cb63;};'use strict';var Sequelize=require(_0x5e69('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x5e69('0x1')](_0x5e69('0x2')),'allowNull':![],'defaultValue':_0x5e69('0x2')},'description':{'type':Sequelize[_0x5e69('0x3')]},'active':{'type':Sequelize[_0x5e69('0x4')],'defaultValue':0x0,'comment':_0x5e69('0x5')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x5e69('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x5e69('0x3')]},'dialOriginateTimeout':{'type':Sequelize[_0x5e69('0x7')](0x3)[_0x5e69('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5e69('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0x5e69('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5e69('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x5e69('0x7')](0x5)[_0x5e69('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5e69('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0x5e69('0x7')](0x3)[_0x5e69('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5e69('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0x5e69('0x7')](0x5)[_0x5e69('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x5e69('0x7')](0x3)[_0x5e69('0x6')],'defaultValue':0x3,'comment':_0x5e69('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x5e69('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x5e69('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x5e69('0xd')},'dialTimezone':{'type':Sequelize[_0x5e69('0x3')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x5e69('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0x5e69('0x1')](_0x5e69('0xf'),_0x5e69('0x10'),_0x5e69('0x11')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x5e69('0x4')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x5e69('0x7')](0x9)[_0x5e69('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x5e69('0x12')},'dialAMDGreeting':{'type':Sequelize[_0x5e69('0x7')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x5e69('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x5e69('0x7')](0x9)[_0x5e69('0x6')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x5e69('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x5e69('0x7')](0x9)[_0x5e69('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5e69('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0x5e69('0x7')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x5e69('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x5e69('0x7')](0x9)[_0x5e69('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x5e69('0x7')](0x9)[_0x5e69('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x5e69('0x6')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x5e69('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x5e69('0x7')](0x9)[_0x5e69('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5e69('0x18')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x5e69('0x19')),'defaultValue':_0x5e69('0x1a')},'dialPrefix':{'type':Sequelize[_0x5e69('0x3')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x5e69('0x7')](0x3)[_0x5e69('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5e69('0x1b')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x5e69('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5e69('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x5e69('0x7')](0x3)[_0x5e69('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5e69('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x5e69('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5e69('0x1e')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5e69('0x1f')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5e69('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x5e69('0x7')](0x3)[_0x5e69('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5e69('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x5e69('0x7')](0x5)[_0x5e69('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5e69('0x22')},'dialMachineMaxRetry':{'type':Sequelize[_0x5e69('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5e69('0x23')},'dialMachineRetryFrequency':{'type':Sequelize[_0x5e69('0x7')](0x5)[_0x5e69('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x5e69('0x7')](0x3)[_0x5e69('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5e69('0x24')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5e69('0x25')}}; \ No newline at end of file +var _0xb675=['#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','STRING','name','ENUM','ivr','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','onlyIfOpen','always','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xb675,0xe6));var _0x5b67=function(_0x30faec,_0x18940b){_0x30faec=_0x30faec-0x0;var _0x29484f=_0xb675[_0x30faec];return _0x29484f;};'use strict';var Sequelize=require(_0x5b67('0x0'));module['exports']={'name':{'type':Sequelize[_0x5b67('0x1')],'unique':_0x5b67('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x5b67('0x3')]('ivr'),'allowNull':![],'defaultValue':_0x5b67('0x4')},'description':{'type':Sequelize[_0x5b67('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x5b67('0x5')](0x4)[_0x5b67('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x5b67('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0x5b67('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x5b67('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x5b67('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5b67('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0x5b67('0x5')](0x3)[_0x5b67('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x5b67('0x5')](0x5)[_0x5b67('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5b67('0x9')},'dialBusyMaxRetry':{'type':Sequelize[_0x5b67('0x5')](0x3)[_0x5b67('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x5b67('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5b67('0xa')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x5b67('0x5')](0x3)[_0x5b67('0x6')],'defaultValue':0x3,'comment':_0x5b67('0xb')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5b67('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5b67('0xc')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5b67('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x5b67('0xd')},'dialTimezone':{'type':Sequelize[_0x5b67('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x5b67('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0x5b67('0x3')]('always',_0x5b67('0xf'),_0x5b67('0x10')),'defaultValue':_0x5b67('0x11')},'dialAMDActive':{'type':Sequelize[_0x5b67('0x12')],'defaultValue':0x0,'comment':_0x5b67('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0x5b67('0x5')](0x9)[_0x5b67('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x5b67('0x6')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x5b67('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x5b67('0x5')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x5b67('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5b67('0x16')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x5b67('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x5b67('0x5')](0x9)[_0x5b67('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x5b67('0x5')](0x9)[_0x5b67('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x5b67('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x5b67('0x5')](0x5)[_0x5b67('0x6')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x5b67('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5b67('0x18')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x5b67('0x19'),_0x5b67('0x1a')),'defaultValue':_0x5b67('0x19')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x5b67('0x5')](0x3)[_0x5b67('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5b67('0x1b')},'dialCutDigit':{'type':Sequelize[_0x5b67('0x5')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5b67('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x5b67('0x5')](0x3)[_0x5b67('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x5b67('0x5')](0x5)[_0x5b67('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5b67('0x1d')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5b67('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5b67('0x1e')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5b67('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x5b67('0x5')](0x3)[_0x5b67('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5b67('0x20')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5b67('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5b67('0x21')},'dialMachineMaxRetry':{'type':Sequelize[_0x5b67('0x5')](0x3)[_0x5b67('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5b67('0x22')},'dialMachineRetryFrequency':{'type':Sequelize[_0x5b67('0x5')](0x5)[_0x5b67('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5b67('0x23')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x5b67('0x5')](0x3)[_0x5b67('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5b67('0x24')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5b67('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5b67('0x25')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 28e41ee..925fb9c 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 _0xd931=['ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','get','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','Campaign','includeAll','findAll','rows','catch','show','params','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','IvrCampaigns','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','length','omit','createdAt','updatedAt','nolimit','filter','CmHopper','findOne','CampaignId','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','ids','dialCheckDuplicateType','insert','into','cm_hopper','ContactId','ListId','field','phone','NOW()','CmListId','toString','from','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','fromQuery','scheduledAt','deletedAt\x20IS\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','push','sequelize','all','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x537501,_0x1509e4){var _0x54bfc2=function(_0x29bd68){while(--_0x29bd68){_0x537501['push'](_0x537501['shift']());}};_0x54bfc2(++_0x1509e4);}(_0xd931,0x191));var _0x1d93=function(_0x1ca93c,_0x3271ab){_0x1ca93c=_0x1ca93c-0x0;var _0x185169=_0xd931[_0x1ca93c];return _0x185169;};'use strict';var emlformat=require(_0x1d93('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1d93('0x1'));var jsonpatch=require(_0x1d93('0x2'));var rp=require(_0x1d93('0x3'));var moment=require(_0x1d93('0x4'));var BPromise=require(_0x1d93('0x5'));var Mustache=require(_0x1d93('0x6'));var util=require(_0x1d93('0x7'));var path=require(_0x1d93('0x8'));var sox=require(_0x1d93('0x9'));var csv=require('to-csv');var ejs=require(_0x1d93('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1d93('0xb'));var squel=require('squel');var crypto=require(_0x1d93('0xc'));var jsforce=require(_0x1d93('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1d93('0xe'));var querystring=require(_0x1d93('0xf'));var Papa=require(_0x1d93('0x10'));var Redis=require(_0x1d93('0x11'));var authService=require(_0x1d93('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1d93('0x13'));var hardwareService=require(_0x1d93('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1d93('0x15'));var config=require(_0x1d93('0x16'));var licenseUtil=require(_0x1d93('0x17'));var db=require(_0x1d93('0x18'))['db'];function respondWithStatusCode(_0x27ef31,_0x90338d){_0x90338d=_0x90338d||0xcc;return function(_0x50ddd7){if(_0x50ddd7){return _0x27ef31['sendStatus'](_0x90338d);}return _0x27ef31[_0x1d93('0x19')](_0x90338d)[_0x1d93('0x1a')]();};}function respondWithResult(_0x511444,_0x3f2e8f){_0x3f2e8f=_0x3f2e8f||0xc8;return function(_0x2f3211){if(_0x2f3211){return _0x511444['status'](_0x3f2e8f)[_0x1d93('0x1b')](_0x2f3211);}};}function respondWithFilteredResult(_0x500efe,_0x31e24e){return function(_0x14c7f4){if(_0x14c7f4){var _0x595521=typeof _0x31e24e[_0x1d93('0x1c')]==='undefined'&&typeof _0x31e24e[_0x1d93('0x1d')]===_0x1d93('0x1e');var _0x48ea00=_0x14c7f4[_0x1d93('0x1f')];var _0x35679c=_0x595521?0x0:_0x31e24e[_0x1d93('0x1c')];var _0x1848e9=_0x595521?_0x14c7f4[_0x1d93('0x1f')]:_0x31e24e[_0x1d93('0x1c')]+_0x31e24e[_0x1d93('0x1d')];var _0xa265f4;if(_0x1848e9>=_0x48ea00){_0x1848e9=_0x48ea00;_0xa265f4=0xc8;}else{_0xa265f4=0xce;}_0x500efe[_0x1d93('0x19')](_0xa265f4);return _0x500efe[_0x1d93('0x20')](_0x1d93('0x21'),_0x35679c+'-'+_0x1848e9+'/'+_0x48ea00)[_0x1d93('0x1b')](_0x14c7f4);}return null;};}function patchUpdates(_0x5a8715){return function(_0x37e9c9){try{jsonpatch[_0x1d93('0x22')](_0x37e9c9,_0x5a8715,!![]);}catch(_0x2c7259){return BPromise[_0x1d93('0x23')](_0x2c7259);}return _0x37e9c9[_0x1d93('0x24')]();};}function saveUpdates(_0x1b9b31,_0x106048){return function(_0x575082){if(_0x575082){return _0x575082[_0x1d93('0x25')](_0x1b9b31)[_0x1d93('0x26')](function(_0x15845b){return _0x15845b;});}return null;};}function removeEntity(_0x16d539,_0x19a8ff){return function(_0x222f7c){if(_0x222f7c){return _0x222f7c['destroy']()[_0x1d93('0x26')](function(){var _0x4921f0=_0x222f7c[_0x1d93('0x27')]({'plain':!![]});var _0x147ad3='IvrCampaigns';return db['UserProfileResource'][_0x1d93('0x28')]({'where':{'type':_0x147ad3,'resourceId':_0x4921f0['id']}})[_0x1d93('0x26')](function(){return _0x222f7c;});})[_0x1d93('0x26')](function(){_0x16d539[_0x1d93('0x19')](0xcc)[_0x1d93('0x1a')]();});}};}function handleEntityNotFound(_0x3d9d90,_0x4f632f){return function(_0x1b9441){if(!_0x1b9441){_0x3d9d90[_0x1d93('0x29')](0x194);}return _0x1b9441;};}function handleError(_0x2f51b5,_0x2e6527){_0x2e6527=_0x2e6527||0x1f4;return function(_0x8443fc){logger[_0x1d93('0x2a')](_0x8443fc[_0x1d93('0x2b')]);if(_0x8443fc[_0x1d93('0x2c')]){delete _0x8443fc[_0x1d93('0x2c')];}_0x2f51b5[_0x1d93('0x19')](_0x2e6527)[_0x1d93('0x2d')](_0x8443fc);};}exports[_0x1d93('0x2e')]=function(_0xbf8772,_0x12d8c5){var _0x5b6342={},_0x95b469={},_0x5a94c7={'count':0x0,'rows':[]};var _0x49f0cc=_[_0x1d93('0x2f')](db['Campaign'][_0x1d93('0x30')],function(_0x3db7d3){return{'name':_0x3db7d3[_0x1d93('0x31')],'type':_0x3db7d3[_0x1d93('0x32')]['key']};});_0x95b469[_0x1d93('0x33')]=_[_0x1d93('0x2f')](_0x49f0cc,_0x1d93('0x2c'));_0x95b469[_0x1d93('0x34')]=_[_0x1d93('0x35')](_0xbf8772[_0x1d93('0x34')]);_0x95b469[_0x1d93('0x36')]=_[_0x1d93('0x37')](_0x95b469['model'],_0x95b469[_0x1d93('0x34')]);_0x5b6342['attributes']=_[_0x1d93('0x37')](_0x95b469['model'],qs[_0x1d93('0x38')](_0xbf8772[_0x1d93('0x34')]['fields']));_0x5b6342[_0x1d93('0x39')]=_0x5b6342[_0x1d93('0x39')]['length']?_0x5b6342[_0x1d93('0x39')]:_0x95b469['model'];if(!_0xbf8772[_0x1d93('0x34')][_0x1d93('0x3a')]('nolimit')){_0x5b6342[_0x1d93('0x1d')]=qs[_0x1d93('0x1d')](_0xbf8772[_0x1d93('0x34')][_0x1d93('0x1d')]);_0x5b6342[_0x1d93('0x1c')]=qs[_0x1d93('0x1c')](_0xbf8772[_0x1d93('0x34')]['offset']);}_0x5b6342[_0x1d93('0x3b')]=qs[_0x1d93('0x3c')](_0xbf8772['query'][_0x1d93('0x3c')]);_0x5b6342[_0x1d93('0x3d')]=qs[_0x1d93('0x36')](_[_0x1d93('0x3e')](_0xbf8772['query'],_0x95b469[_0x1d93('0x36')]),_0x49f0cc);if(_0xbf8772[_0x1d93('0x34')]['filter']){_0x5b6342[_0x1d93('0x3d')]=_[_0x1d93('0x3f')](_0x5b6342['where'],{'$or':_[_0x1d93('0x2f')](_0x49f0cc,function(_0x475fe3){if(_0x475fe3[_0x1d93('0x32')]!==_0x1d93('0x40')){var _0x44167f={};_0x44167f[_0x475fe3[_0x1d93('0x2c')]]={'$like':'%'+_0xbf8772[_0x1d93('0x34')]['filter']+'%'};return _0x44167f;}})});}_0x5b6342=_[_0x1d93('0x3f')]({},_0x5b6342,_0xbf8772[_0x1d93('0x41')]);var _0xda8311={'where':_0x5b6342[_0x1d93('0x3d')]};return db[_0x1d93('0x42')][_0x1d93('0x1f')](_0xda8311)['then'](function(_0x5ecccc){_0x5a94c7[_0x1d93('0x1f')]=_0x5ecccc;if(_0xbf8772[_0x1d93('0x34')][_0x1d93('0x43')]){_0x5b6342['include']=[{'all':!![]}];}return db[_0x1d93('0x42')][_0x1d93('0x44')](_0x5b6342);})[_0x1d93('0x26')](function(_0x4c3a7a){_0x5a94c7[_0x1d93('0x45')]=_0x4c3a7a;return _0x5a94c7;})['then'](respondWithFilteredResult(_0x12d8c5,_0x5b6342))[_0x1d93('0x46')](handleError(_0x12d8c5,null));};exports[_0x1d93('0x47')]=function(_0x1a646a,_0x2b3252){var _0x4545fd={'raw':![],'where':{'id':_0x1a646a[_0x1d93('0x48')]['id']}},_0x4294d1={};_0x4294d1[_0x1d93('0x33')]=_[_0x1d93('0x35')](db['Campaign']['rawAttributes']);_0x4294d1['query']=_[_0x1d93('0x35')](_0x1a646a['query']);_0x4294d1['filters']=_[_0x1d93('0x37')](_0x4294d1[_0x1d93('0x33')],_0x4294d1[_0x1d93('0x34')]);_0x4545fd[_0x1d93('0x39')]=_[_0x1d93('0x37')](_0x4294d1[_0x1d93('0x33')],qs[_0x1d93('0x38')](_0x1a646a[_0x1d93('0x34')][_0x1d93('0x38')]));_0x4545fd[_0x1d93('0x39')]=_0x4545fd[_0x1d93('0x39')]['length']?_0x4545fd['attributes']:_0x4294d1['model'];if(_0x1a646a[_0x1d93('0x34')]['includeAll']){_0x4545fd[_0x1d93('0x49')]=[{'all':!![]}];}_0x4545fd=_[_0x1d93('0x3f')]({},_0x4545fd,_0x1a646a[_0x1d93('0x41')]);return db['Campaign'][_0x1d93('0x4a')](_0x4545fd)[_0x1d93('0x26')](handleEntityNotFound(_0x2b3252,null))[_0x1d93('0x26')](respondWithResult(_0x2b3252,null))[_0x1d93('0x46')](handleError(_0x2b3252,null));};exports[_0x1d93('0x4b')]=function(_0x4d5e62,_0x4eaa9b){return db['Campaign'][_0x1d93('0x4b')](_0x4d5e62[_0x1d93('0x4c')],{})[_0x1d93('0x26')](function(_0x22e8f3){var _0xbb3807=_0x4d5e62['user'][_0x1d93('0x27')]({'plain':!![]});if(!_0xbb3807)throw new Error(_0x1d93('0x4d'));if(_0xbb3807[_0x1d93('0x4e')]===_0x1d93('0x4f')){var _0x20aa10=_0x22e8f3[_0x1d93('0x27')]({'plain':!![]});var _0x63ee96=_0x1d93('0x50');return db[_0x1d93('0x51')][_0x1d93('0x4a')]({'where':{'name':_0x63ee96,'userProfileId':_0xbb3807[_0x1d93('0x52')]},'raw':!![]})['then'](function(_0x2eae5d){if(_0x2eae5d&&_0x2eae5d[_0x1d93('0x53')]===0x0){return db['UserProfileResource'][_0x1d93('0x4b')]({'name':_0x20aa10[_0x1d93('0x2c')],'resourceId':_0x20aa10['id'],'type':_0x2eae5d['name'],'sectionId':_0x2eae5d['id']},{})[_0x1d93('0x26')](function(){return _0x22e8f3;});}else{return _0x22e8f3;}})['catch'](function(_0x16718c){logger[_0x1d93('0x2a')](_0x1d93('0x54'),_0x16718c);throw _0x16718c;});}return _0x22e8f3;})[_0x1d93('0x26')](respondWithResult(_0x4eaa9b,0xc9))['catch'](handleError(_0x4eaa9b,null));};exports[_0x1d93('0x55')]=function(_0x4bc044,_0x202f1c){var _0x2fc544={'where':{'id':_0x4bc044['params']['id']}},_0x512dc0={};_0x512dc0[_0x1d93('0x33')]=_[_0x1d93('0x35')](db[_0x1d93('0x42')][_0x1d93('0x30')]);_0x2fc544[_0x1d93('0x39')]=_[_0x1d93('0x37')](_0x512dc0[_0x1d93('0x33')],qs[_0x1d93('0x38')](_0x4bc044[_0x1d93('0x34')][_0x1d93('0x38')]));_0x2fc544[_0x1d93('0x39')]=_0x2fc544['attributes'][_0x1d93('0x56')]?_0x2fc544[_0x1d93('0x39')]:_0x512dc0[_0x1d93('0x33')];if(_0x4bc044[_0x1d93('0x34')][_0x1d93('0x43')]){_0x2fc544[_0x1d93('0x49')]=[{'all':!![]}];}_0x2fc544=_[_0x1d93('0x3f')]({},_0x2fc544,_0x4bc044['options']);return db[_0x1d93('0x42')][_0x1d93('0x4a')](_0x2fc544)[_0x1d93('0x26')](handleEntityNotFound(_0x202f1c,null))['then'](function(_0x1f3658){if(_0x1f3658){var _0xef3912=_0x1f3658['get']({'plain':!![]});_0xef3912=qs['omit'](_0xef3912,['id','createdAt','updatedAt']);_0x4bc044['body']=_[_0x1d93('0x57')](_0x4bc044[_0x1d93('0x4c')],['id',_0x1d93('0x58'),_0x1d93('0x59')]);return db[_0x1d93('0x42')]['create'](_['merge'](_0xef3912,_0x4bc044[_0x1d93('0x4c')]),{'include':_0x4bc044[_0x1d93('0x34')]['includeAll']?[{'all':!![]}]:undefined})[_0x1d93('0x26')](function(_0x2c1298){var _0x1c1185=_0x4bc044['user'][_0x1d93('0x27')]({'plain':!![]});if(!_0x1c1185)throw new Error(_0x1d93('0x4d'));if(_0x1c1185['role']===_0x1d93('0x4f')){var _0x4d67b2=_0x2c1298[_0x1d93('0x27')]({'plain':!![]});var _0x305f63=_0x1d93('0x50');return db['UserProfileSection']['find']({'where':{'name':_0x305f63,'userProfileId':_0x1c1185[_0x1d93('0x52')]},'raw':!![]})[_0x1d93('0x26')](function(_0x2f7be1){if(_0x2f7be1&&_0x2f7be1[_0x1d93('0x53')]===0x0){return db['UserProfileResource'][_0x1d93('0x4b')]({'name':_0x4d67b2[_0x1d93('0x2c')],'resourceId':_0x4d67b2['id'],'type':_0x2f7be1[_0x1d93('0x2c')],'sectionId':_0x2f7be1['id']},{})[_0x1d93('0x26')](function(){return _0x2c1298;});}else{return _0x2c1298;}})[_0x1d93('0x46')](function(_0x53bae7){logger[_0x1d93('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53bae7);throw _0x53bae7;});}return _0x2c1298;});}})['then'](respondWithResult(_0x202f1c,0xc9))[_0x1d93('0x46')](handleError(_0x202f1c,null));};exports['update']=function(_0x3beb37,_0x57af8a){if(_0x3beb37[_0x1d93('0x4c')]['id']){delete _0x3beb37['body']['id'];}return db[_0x1d93('0x42')]['find']({'where':{'id':_0x3beb37[_0x1d93('0x48')]['id']}})['then'](handleEntityNotFound(_0x57af8a,null))[_0x1d93('0x26')](saveUpdates(_0x3beb37['body'],null))[_0x1d93('0x26')](respondWithResult(_0x57af8a,null))[_0x1d93('0x46')](handleError(_0x57af8a,null));};exports['destroy']=function(_0x2fecff,_0x2441dc){return db[_0x1d93('0x42')][_0x1d93('0x4a')]({'where':{'id':_0x2fecff[_0x1d93('0x48')]['id']}})[_0x1d93('0x26')](handleEntityNotFound(_0x2441dc,null))['then'](removeEntity(_0x2441dc,null))['catch'](handleError(_0x2441dc,null));};exports['getHoppers']=function(_0xe4fe34,_0xa26138,_0x7db463){var _0x26a0f0={'raw':!![],'where':{}};var _0x257058={};var _0x4dbb1b={'count':0x0,'rows':[]};return db[_0x1d93('0x42')]['findOne']({'where':{'id':_0xe4fe34[_0x1d93('0x48')]['id']}})[_0x1d93('0x26')](handleEntityNotFound(_0xa26138,null))[_0x1d93('0x26')](function(_0x1a609e){if(_0x1a609e){_0x257058[_0x1d93('0x33')]=_[_0x1d93('0x35')](db['CmHopper']['rawAttributes']);_0x257058[_0x1d93('0x34')]=_[_0x1d93('0x35')](_0xe4fe34[_0x1d93('0x34')]);_0x257058['filters']=_[_0x1d93('0x37')](_0x257058[_0x1d93('0x33')],_0x257058[_0x1d93('0x34')]);_0x26a0f0['attributes']=_[_0x1d93('0x37')](_0x257058['model'],qs[_0x1d93('0x38')](_0xe4fe34['query'][_0x1d93('0x38')]));_0x26a0f0[_0x1d93('0x39')]=_0x26a0f0[_0x1d93('0x39')]['length']?_0x26a0f0['attributes']:_0x257058[_0x1d93('0x33')];if(!_0xe4fe34[_0x1d93('0x34')][_0x1d93('0x3a')](_0x1d93('0x5a'))){_0x26a0f0['limit']=qs[_0x1d93('0x1d')](_0xe4fe34['query']['limit']);_0x26a0f0[_0x1d93('0x1c')]=qs['offset'](_0xe4fe34['query']['offset']);}_0x26a0f0['order']=qs[_0x1d93('0x3c')](_0xe4fe34[_0x1d93('0x34')][_0x1d93('0x3c')]);_0x26a0f0['where']=qs['filters'](_['pick'](_0xe4fe34[_0x1d93('0x34')],_0x257058['filters']));_0x26a0f0[_0x1d93('0x3d')]['CampaignId']=_0x1a609e['id'];if(_0xe4fe34['query'][_0x1d93('0x5b')]){_0x26a0f0['where']=_[_0x1d93('0x3f')](_0x26a0f0[_0x1d93('0x3d')],{'$or':_[_0x1d93('0x2f')](_0x26a0f0[_0x1d93('0x39')],function(_0x37280f){var _0x1814f4={};_0x1814f4[_0x37280f]={'$like':'%'+_0xe4fe34[_0x1d93('0x34')][_0x1d93('0x5b')]+'%'};return _0x1814f4;})});}_0x26a0f0=_[_0x1d93('0x3f')]({},_0x26a0f0,_0xe4fe34[_0x1d93('0x41')]);return db[_0x1d93('0x5c')][_0x1d93('0x1f')]({'where':_0x26a0f0[_0x1d93('0x3d')]})[_0x1d93('0x26')](function(_0x3efd4a){_0x4dbb1b[_0x1d93('0x1f')]=_0x3efd4a;if(_0xe4fe34[_0x1d93('0x34')][_0x1d93('0x43')]){_0x26a0f0['include']=[{'all':!![]}];}return db[_0x1d93('0x5c')]['findAll'](_0x26a0f0);})[_0x1d93('0x26')](function(_0x4e2f5b){_0x4dbb1b[_0x1d93('0x45')]=_0x4e2f5b;return _0x4dbb1b;});}})[_0x1d93('0x26')](respondWithFilteredResult(_0xa26138,_0x26a0f0))[_0x1d93('0x46')](handleError(_0xa26138,null));};exports['getHopperHistories']=function(_0x6e69b2,_0x327133,_0x4cbec3){var _0x48d04a={'raw':!![],'where':{}};var _0x3835da={};var _0x3ee6ed={'count':0x0,'rows':[]};return db[_0x1d93('0x42')][_0x1d93('0x5d')]({'where':{'id':_0x6e69b2['params']['id']}})[_0x1d93('0x26')](handleEntityNotFound(_0x327133,null))['then'](function(_0xf15070){if(_0xf15070){_0x3835da[_0x1d93('0x33')]=_[_0x1d93('0x35')](db['CmHopperHistory'][_0x1d93('0x30')]);_0x3835da[_0x1d93('0x34')]=_['keys'](_0x6e69b2[_0x1d93('0x34')]);_0x3835da[_0x1d93('0x36')]=_['intersection'](_0x3835da[_0x1d93('0x33')],_0x3835da[_0x1d93('0x34')]);_0x48d04a[_0x1d93('0x39')]=_[_0x1d93('0x37')](_0x3835da[_0x1d93('0x33')],qs[_0x1d93('0x38')](_0x6e69b2[_0x1d93('0x34')]['fields']));_0x48d04a[_0x1d93('0x39')]=_0x48d04a[_0x1d93('0x39')][_0x1d93('0x56')]?_0x48d04a['attributes']:_0x3835da[_0x1d93('0x33')];if(!_0x6e69b2[_0x1d93('0x34')][_0x1d93('0x3a')](_0x1d93('0x5a'))){_0x48d04a[_0x1d93('0x1d')]=qs['limit'](_0x6e69b2[_0x1d93('0x34')][_0x1d93('0x1d')]);_0x48d04a[_0x1d93('0x1c')]=qs[_0x1d93('0x1c')](_0x6e69b2[_0x1d93('0x34')][_0x1d93('0x1c')]);}_0x48d04a[_0x1d93('0x3b')]=qs['sort'](_0x6e69b2[_0x1d93('0x34')][_0x1d93('0x3c')]);_0x48d04a[_0x1d93('0x3d')]=qs[_0x1d93('0x36')](_['pick'](_0x6e69b2[_0x1d93('0x34')],_0x3835da[_0x1d93('0x36')]));_0x48d04a[_0x1d93('0x3d')][_0x1d93('0x5e')]=_0xf15070['id'];if(_0x6e69b2[_0x1d93('0x34')][_0x1d93('0x5b')]){_0x48d04a[_0x1d93('0x3d')]=_['merge'](_0x48d04a[_0x1d93('0x3d')],{'$or':_['map'](_0x48d04a[_0x1d93('0x39')],function(_0x50d3d1){var _0x4c78d1={};_0x4c78d1[_0x50d3d1]={'$like':'%'+_0x6e69b2[_0x1d93('0x34')][_0x1d93('0x5b')]+'%'};return _0x4c78d1;})});}_0x48d04a=_['merge']({},_0x48d04a,_0x6e69b2[_0x1d93('0x41')]);return db[_0x1d93('0x5f')]['count']({'where':_0x48d04a[_0x1d93('0x3d')]})[_0x1d93('0x26')](function(_0x4182cd){_0x3ee6ed['count']=_0x4182cd;if(_0x6e69b2[_0x1d93('0x34')]['includeAll']){_0x48d04a[_0x1d93('0x49')]=[{'all':!![]}];}return db[_0x1d93('0x5f')]['findAll'](_0x48d04a);})[_0x1d93('0x26')](function(_0x2fc7b2){_0x3ee6ed[_0x1d93('0x45')]=_0x2fc7b2;return _0x3ee6ed;});}})['then'](respondWithFilteredResult(_0x327133,_0x48d04a))[_0x1d93('0x46')](handleError(_0x327133,null));};exports[_0x1d93('0x60')]=function(_0x13b3a0,_0x331ccb,_0x323fb6){var _0x4cdf5d={'raw':!![],'where':{}};var _0x5c1c5a={};var _0x4b6111={'count':0x0,'rows':[]};return db[_0x1d93('0x42')][_0x1d93('0x5d')]({'where':{'id':_0x13b3a0[_0x1d93('0x48')]['id']}})['then'](handleEntityNotFound(_0x331ccb,null))['then'](function(_0x1781d2){if(_0x1781d2){_0x5c1c5a[_0x1d93('0x33')]=_[_0x1d93('0x35')](db[_0x1d93('0x61')][_0x1d93('0x30')]);_0x5c1c5a[_0x1d93('0x34')]=_[_0x1d93('0x35')](_0x13b3a0[_0x1d93('0x34')]);_0x5c1c5a['filters']=_[_0x1d93('0x37')](_0x5c1c5a[_0x1d93('0x33')],_0x5c1c5a[_0x1d93('0x34')]);_0x4cdf5d['attributes']=_['intersection'](_0x5c1c5a[_0x1d93('0x33')],qs[_0x1d93('0x38')](_0x13b3a0[_0x1d93('0x34')][_0x1d93('0x38')]));_0x4cdf5d[_0x1d93('0x39')]=_0x4cdf5d[_0x1d93('0x39')][_0x1d93('0x56')]?_0x4cdf5d[_0x1d93('0x39')]:_0x5c1c5a['model'];if(!_0x13b3a0[_0x1d93('0x34')][_0x1d93('0x3a')]('nolimit')){_0x4cdf5d[_0x1d93('0x1d')]=qs['limit'](_0x13b3a0[_0x1d93('0x34')][_0x1d93('0x1d')]);_0x4cdf5d[_0x1d93('0x1c')]=qs['offset'](_0x13b3a0[_0x1d93('0x34')][_0x1d93('0x1c')]);}_0x4cdf5d['order']=qs['sort'](_0x13b3a0[_0x1d93('0x34')][_0x1d93('0x3c')]);_0x4cdf5d[_0x1d93('0x3d')]=qs[_0x1d93('0x36')](_[_0x1d93('0x3e')](_0x13b3a0['query'],_0x5c1c5a[_0x1d93('0x36')]));_0x4cdf5d[_0x1d93('0x3d')]['CampaignId']=_0x1781d2['id'];if(_0x13b3a0[_0x1d93('0x34')][_0x1d93('0x5b')]){_0x4cdf5d[_0x1d93('0x3d')]=_[_0x1d93('0x3f')](_0x4cdf5d['where'],{'$or':_[_0x1d93('0x2f')](_0x4cdf5d[_0x1d93('0x39')],function(_0x490b14){var _0x54a747={};_0x54a747[_0x490b14]={'$like':'%'+_0x13b3a0[_0x1d93('0x34')][_0x1d93('0x5b')]+'%'};return _0x54a747;})});}_0x4cdf5d=_[_0x1d93('0x3f')]({},_0x4cdf5d,_0x13b3a0['options']);return db[_0x1d93('0x61')][_0x1d93('0x1f')]({'where':_0x4cdf5d[_0x1d93('0x3d')]})[_0x1d93('0x26')](function(_0x420a96){_0x4b6111[_0x1d93('0x1f')]=_0x420a96;if(_0x13b3a0[_0x1d93('0x34')][_0x1d93('0x43')]){_0x4cdf5d[_0x1d93('0x49')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x1d93('0x44')](_0x4cdf5d);})[_0x1d93('0x26')](function(_0x131a73){_0x4b6111[_0x1d93('0x45')]=_0x131a73;return _0x4b6111;});}})[_0x1d93('0x26')](respondWithFilteredResult(_0x331ccb,_0x4cdf5d))[_0x1d93('0x46')](handleError(_0x331ccb,null));};exports[_0x1d93('0x62')]=function(_0x272de3,_0x4eefd0,_0x405df9){var _0x3b65f8={'raw':!![],'where':{}};var _0x2f087d={};var _0x2bbae9={'count':0x0,'rows':[]};return db['Campaign'][_0x1d93('0x5d')]({'where':{'id':_0x272de3[_0x1d93('0x48')]['id']}})[_0x1d93('0x26')](handleEntityNotFound(_0x4eefd0,null))[_0x1d93('0x26')](function(_0x28243f){if(_0x28243f){_0x2f087d['model']=_[_0x1d93('0x35')](db['CmHopperBlack'][_0x1d93('0x30')]);_0x2f087d[_0x1d93('0x34')]=_[_0x1d93('0x35')](_0x272de3[_0x1d93('0x34')]);_0x2f087d[_0x1d93('0x36')]=_[_0x1d93('0x37')](_0x2f087d[_0x1d93('0x33')],_0x2f087d[_0x1d93('0x34')]);_0x3b65f8['attributes']=_[_0x1d93('0x37')](_0x2f087d['model'],qs[_0x1d93('0x38')](_0x272de3['query'][_0x1d93('0x38')]));_0x3b65f8[_0x1d93('0x39')]=_0x3b65f8['attributes'][_0x1d93('0x56')]?_0x3b65f8[_0x1d93('0x39')]:_0x2f087d['model'];if(!_0x272de3[_0x1d93('0x34')][_0x1d93('0x3a')](_0x1d93('0x5a'))){_0x3b65f8[_0x1d93('0x1d')]=qs[_0x1d93('0x1d')](_0x272de3['query'][_0x1d93('0x1d')]);_0x3b65f8[_0x1d93('0x1c')]=qs[_0x1d93('0x1c')](_0x272de3[_0x1d93('0x34')][_0x1d93('0x1c')]);}_0x3b65f8[_0x1d93('0x3b')]=qs[_0x1d93('0x3c')](_0x272de3[_0x1d93('0x34')][_0x1d93('0x3c')]);_0x3b65f8[_0x1d93('0x3d')]=qs[_0x1d93('0x36')](_[_0x1d93('0x3e')](_0x272de3[_0x1d93('0x34')],_0x2f087d[_0x1d93('0x36')]));_0x3b65f8[_0x1d93('0x3d')][_0x1d93('0x5e')]=_0x28243f['id'];if(_0x272de3['query'][_0x1d93('0x5b')]){_0x3b65f8[_0x1d93('0x3d')]=_[_0x1d93('0x3f')](_0x3b65f8[_0x1d93('0x3d')],{'$or':_[_0x1d93('0x2f')](_0x3b65f8[_0x1d93('0x39')],function(_0x31b913){var _0x10ca42={};_0x10ca42[_0x31b913]={'$like':'%'+_0x272de3[_0x1d93('0x34')][_0x1d93('0x5b')]+'%'};return _0x10ca42;})});}_0x3b65f8=_['merge']({},_0x3b65f8,_0x272de3['options']);return db[_0x1d93('0x63')]['count']({'where':_0x3b65f8[_0x1d93('0x3d')]})[_0x1d93('0x26')](function(_0x188bde){_0x2bbae9[_0x1d93('0x1f')]=_0x188bde;if(_0x272de3[_0x1d93('0x34')][_0x1d93('0x43')]){_0x3b65f8[_0x1d93('0x49')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x1d93('0x44')](_0x3b65f8);})[_0x1d93('0x26')](function(_0x1a9f74){_0x2bbae9[_0x1d93('0x45')]=_0x1a9f74;return _0x2bbae9;});}})[_0x1d93('0x26')](respondWithFilteredResult(_0x4eefd0,_0x3b65f8))['catch'](handleError(_0x4eefd0,null));};exports[_0x1d93('0x64')]=function(_0x4c7d3e,_0x45b780,_0x5df264){var _0x19b732={};var _0x1a73e7={};var _0x1ae3c3;var _0x5970e6;return db[_0x1d93('0x42')][_0x1d93('0x5d')]({'where':{'id':_0x4c7d3e[_0x1d93('0x48')]['id']}})['then'](handleEntityNotFound(_0x45b780,null))[_0x1d93('0x26')](function(_0x107487){if(_0x107487){_0x1ae3c3=_0x107487;_0x1a73e7[_0x1d93('0x33')]=_[_0x1d93('0x35')](db['CmList']['rawAttributes']);_0x1a73e7['query']=_[_0x1d93('0x35')](_0x4c7d3e[_0x1d93('0x34')]);_0x1a73e7['filters']=_[_0x1d93('0x37')](_0x1a73e7[_0x1d93('0x33')],_0x1a73e7[_0x1d93('0x34')]);_0x19b732['attributes']=_[_0x1d93('0x37')](_0x1a73e7[_0x1d93('0x33')],qs[_0x1d93('0x38')](_0x4c7d3e[_0x1d93('0x34')][_0x1d93('0x38')]));_0x19b732['attributes']=_0x19b732[_0x1d93('0x39')][_0x1d93('0x56')]?_0x19b732[_0x1d93('0x39')]:_0x1a73e7['model'];_0x19b732[_0x1d93('0x3b')]=qs[_0x1d93('0x3c')](_0x4c7d3e[_0x1d93('0x34')][_0x1d93('0x3c')]);_0x19b732[_0x1d93('0x3d')]=qs[_0x1d93('0x36')](_[_0x1d93('0x3e')](_0x4c7d3e[_0x1d93('0x34')],_0x1a73e7['filters']));if(_0x4c7d3e[_0x1d93('0x34')][_0x1d93('0x5b')]){_0x19b732[_0x1d93('0x3d')]=_[_0x1d93('0x3f')](_0x19b732[_0x1d93('0x3d')],{'$or':_[_0x1d93('0x2f')](_0x19b732['attributes'],function(_0x594fce){var _0x35a367={};_0x35a367[_0x594fce]={'$like':'%'+_0x4c7d3e[_0x1d93('0x34')][_0x1d93('0x5b')]+'%'};return _0x35a367;})});}_0x19b732=_[_0x1d93('0x3f')]({},_0x19b732,_0x4c7d3e[_0x1d93('0x41')]);return _0x1ae3c3['getLists'](_0x19b732);}})[_0x1d93('0x26')](function(_0xfd4e59){if(_0xfd4e59){_0x5970e6=_0xfd4e59[_0x1d93('0x56')];if(!_0x4c7d3e[_0x1d93('0x34')][_0x1d93('0x3a')](_0x1d93('0x5a'))){_0x19b732[_0x1d93('0x1d')]=qs['limit'](_0x4c7d3e['query'][_0x1d93('0x1d')]);_0x19b732['offset']=qs[_0x1d93('0x1c')](_0x4c7d3e[_0x1d93('0x34')]['offset']);}return _0x1ae3c3[_0x1d93('0x64')](_0x19b732);}})[_0x1d93('0x26')](function(_0x40d3f4){if(_0x40d3f4){return _0x40d3f4?{'count':_0x5970e6,'rows':_0x40d3f4}:null;}})[_0x1d93('0x26')](respondWithResult(_0x45b780,null))[_0x1d93('0x46')](handleError(_0x45b780,null));};exports[_0x1d93('0x65')]=function(_0xb60f59,_0x258586,_0x178b3a){var _0x2de1b5,_0x3fd6ac;return db['Campaign'][_0x1d93('0x4a')]({'where':{'id':_0xb60f59[_0x1d93('0x48')]['id']}})[_0x1d93('0x26')](handleEntityNotFound(_0x258586,null))['then'](function(_0x4bfdb9){if(_0x4bfdb9){_0x3fd6ac=_0x4bfdb9;return _0x4bfdb9[_0x1d93('0x65')](_0xb60f59['body'][_0x1d93('0x66')],_[_0x1d93('0x57')](_0xb60f59['body'],[_0x1d93('0x66'),'id'])||{});}return null;})['spread'](function(_0x42da7d){var _0x3409fc;_0x2de1b5=_0x42da7d||[];var _0x46e40b=[];if(_0x42da7d){for(var _0x329af1=0x0;_0x329af1<_0x42da7d['length'];_0x329af1+=0x1){var _0x224ff2=_0x42da7d[_0x329af1]['get']({'plain':!![]});_0x3fd6ac[_0x1d93('0x67')]=_0xb60f59[_0x1d93('0x4c')][_0x1d93('0x67')]?_0xb60f59['body'][_0x1d93('0x67')]:_0x3fd6ac[_0x1d93('0x67')];switch(_0x3fd6ac[_0x1d93('0x67')]){case'always':_0x3409fc=squel[_0x1d93('0x68')]()[_0x1d93('0x69')](_0x1d93('0x6a'))['fromQuery'](['phone','scheduledAt',_0x1d93('0x6b'),_0x1d93('0x6c'),_0x1d93('0x5e'),_0x1d93('0x58'),'updatedAt'],squel['select']()[_0x1d93('0x6d')](_0x1d93('0x6e'),_0x1d93('0x6e'))['field'](_0x1d93('0x6f'),'scheduledAt')[_0x1d93('0x6d')]('id',_0x1d93('0x6b'))[_0x1d93('0x6d')](_0x224ff2[_0x1d93('0x70')][_0x1d93('0x71')](),_0x1d93('0x6c'))['field'](_0xb60f59[_0x1d93('0x48')]['id'][_0x1d93('0x71')](),_0x1d93('0x5e'))[_0x1d93('0x6d')]('NOW()',_0x1d93('0x58'))[_0x1d93('0x6d')](_0x1d93('0x6f'),_0x1d93('0x59'))[_0x1d93('0x72')](_0x1d93('0x73'))['where']('deletedAt\x20IS\x20NULL')[_0x1d93('0x3d')](_0x1d93('0x74'),_0x224ff2[_0x1d93('0x70')][_0x1d93('0x71')]())[_0x1d93('0x3d')](_0x1d93('0x75'))[_0x1d93('0x3d')]('phone\x20NOT\x20IN\x20(?)',squel[_0x1d93('0x76')]()[_0x1d93('0x6d')](_0x1d93('0x77'))[_0x1d93('0x72')](_0x1d93('0x78'))['where'](_0x1d93('0x79'),_0xb60f59[_0x1d93('0x48')]['id']['toString']()))[_0x1d93('0x3d')]('phone\x20NOT\x20IN\x20(?)',squel[_0x1d93('0x76')]()[_0x1d93('0x6d')]('COALESCE(phone,\x27\x27)')[_0x1d93('0x72')](_0x1d93('0x6a'))[_0x1d93('0x3d')](_0x1d93('0x79'),_0xb60f59[_0x1d93('0x48')]['id'][_0x1d93('0x71')]())))[_0x1d93('0x71')]();break;case _0x1d93('0x7a'):_0x3409fc=squel['insert']()[_0x1d93('0x69')]('cm_hopper')[_0x1d93('0x7b')]([_0x1d93('0x6e'),'scheduledAt','ContactId','ListId','CampaignId',_0x1d93('0x58'),_0x1d93('0x59')],squel['select']()[_0x1d93('0x6d')](_0x1d93('0x6e'),'phone')[_0x1d93('0x6d')](_0x1d93('0x6f'),_0x1d93('0x7c'))[_0x1d93('0x6d')]('id',_0x1d93('0x6b'))[_0x1d93('0x6d')](_0x224ff2[_0x1d93('0x70')][_0x1d93('0x71')](),_0x1d93('0x6c'))['field'](_0xb60f59[_0x1d93('0x48')]['id'][_0x1d93('0x71')](),_0x1d93('0x5e'))[_0x1d93('0x6d')](_0x1d93('0x6f'),_0x1d93('0x58'))[_0x1d93('0x6d')](_0x1d93('0x6f'),'updatedAt')[_0x1d93('0x72')](_0x1d93('0x73'))[_0x1d93('0x3d')](_0x1d93('0x7d'))[_0x1d93('0x3d')](_0x1d93('0x74'),_0x224ff2[_0x1d93('0x70')]['toString']())[_0x1d93('0x3d')]('phone\x20IS\x20NOT\x20NULL')[_0x1d93('0x3d')](_0x1d93('0x7e'),squel[_0x1d93('0x76')]()[_0x1d93('0x6d')](_0x1d93('0x7f'))[_0x1d93('0x72')](_0x1d93('0x6a'))[_0x1d93('0x3d')](_0x1d93('0x79'),_0xb60f59[_0x1d93('0x48')]['id'][_0x1d93('0x71')]())))[_0x1d93('0x71')]();break;default:_0x3409fc=squel['insert']()['into'](_0x1d93('0x6a'))[_0x1d93('0x7b')]([_0x1d93('0x6e'),'scheduledAt',_0x1d93('0x6b'),'ListId','CampaignId',_0x1d93('0x58'),_0x1d93('0x59')],squel[_0x1d93('0x76')]()[_0x1d93('0x6d')](_0x1d93('0x6e'),_0x1d93('0x6e'))['field'](_0x1d93('0x6f'),'scheduledAt')[_0x1d93('0x6d')]('id',_0x1d93('0x6b'))[_0x1d93('0x6d')](_0x224ff2['CmListId'][_0x1d93('0x71')](),_0x1d93('0x6c'))[_0x1d93('0x6d')](_0xb60f59[_0x1d93('0x48')]['id'][_0x1d93('0x71')](),_0x1d93('0x5e'))[_0x1d93('0x6d')](_0x1d93('0x6f'),_0x1d93('0x58'))[_0x1d93('0x6d')](_0x1d93('0x6f'),_0x1d93('0x59'))[_0x1d93('0x72')](_0x1d93('0x73'))[_0x1d93('0x3d')](_0x1d93('0x7d'))[_0x1d93('0x3d')](_0x1d93('0x74'),_0x224ff2[_0x1d93('0x70')][_0x1d93('0x71')]())[_0x1d93('0x3d')](_0x1d93('0x75')))[_0x1d93('0x71')]();}_0x46e40b[_0x1d93('0x80')](db[_0x1d93('0x81')]['query'](_0x3409fc));}return BPromise[_0x1d93('0x82')](_0x46e40b);}})[_0x1d93('0x26')](function(){return _0x2de1b5;})['then'](respondWithResult(_0x258586,null))['catch'](handleError(_0x258586,null));};exports[_0x1d93('0x83')]=function(_0x2d1fc5,_0x6c94ef,_0x400c1d){return db[_0x1d93('0x42')][_0x1d93('0x4a')]({'where':{'id':_0x2d1fc5[_0x1d93('0x48')]['id']}})['then'](handleEntityNotFound(_0x6c94ef,null))[_0x1d93('0x26')](function(_0x585c0d){if(_0x585c0d){return _0x585c0d[_0x1d93('0x83')](_0x2d1fc5[_0x1d93('0x34')][_0x1d93('0x66')]);}})['then'](function(_0x4629b1){if(_0x4629b1){return db[_0x1d93('0x5c')][_0x1d93('0x28')]({'where':{'ListId':_0x2d1fc5['query'][_0x1d93('0x66')],'CampaignId':_0x2d1fc5['params']['id']}})[_0x1d93('0x26')](function(){return _0x4629b1;});}})[_0x1d93('0x26')](respondWithStatusCode(_0x6c94ef,null))[_0x1d93('0x46')](handleError(_0x6c94ef,null));};exports[_0x1d93('0x84')]=function(_0x39bc22,_0x20d90e,_0x2eb8c7){var _0x56a91f={};var _0x437ca7={};var _0x4b280e;var _0xe17ace;return db[_0x1d93('0x42')][_0x1d93('0x5d')]({'where':{'id':_0x39bc22[_0x1d93('0x48')]['id']}})[_0x1d93('0x26')](handleEntityNotFound(_0x20d90e,null))[_0x1d93('0x26')](function(_0x171c9b){if(_0x171c9b){_0x4b280e=_0x171c9b;_0x437ca7[_0x1d93('0x33')]=_['keys'](db[_0x1d93('0x85')][_0x1d93('0x30')]);_0x437ca7['query']=_[_0x1d93('0x35')](_0x39bc22[_0x1d93('0x34')]);_0x437ca7['filters']=_[_0x1d93('0x37')](_0x437ca7[_0x1d93('0x33')],_0x437ca7['query']);_0x56a91f['attributes']=_[_0x1d93('0x37')](_0x437ca7[_0x1d93('0x33')],qs[_0x1d93('0x38')](_0x39bc22[_0x1d93('0x34')][_0x1d93('0x38')]));_0x56a91f[_0x1d93('0x39')]=_0x56a91f[_0x1d93('0x39')][_0x1d93('0x56')]?_0x56a91f[_0x1d93('0x39')]:_0x437ca7[_0x1d93('0x33')];_0x56a91f[_0x1d93('0x3b')]=qs[_0x1d93('0x3c')](_0x39bc22[_0x1d93('0x34')]['sort']);_0x56a91f['where']=qs[_0x1d93('0x36')](_[_0x1d93('0x3e')](_0x39bc22[_0x1d93('0x34')],_0x437ca7['filters']));if(_0x39bc22[_0x1d93('0x34')][_0x1d93('0x5b')]){_0x56a91f[_0x1d93('0x3d')]=_[_0x1d93('0x3f')](_0x56a91f[_0x1d93('0x3d')],{'$or':_['map'](_0x56a91f[_0x1d93('0x39')],function(_0x537d41){var _0x114d42={};_0x114d42[_0x537d41]={'$like':'%'+_0x39bc22[_0x1d93('0x34')]['filter']+'%'};return _0x114d42;})});}_0x56a91f=_['merge']({},_0x56a91f,_0x39bc22[_0x1d93('0x41')]);return _0x4b280e['getBlackLists'](_0x56a91f);}})[_0x1d93('0x26')](function(_0x46d606){if(_0x46d606){_0xe17ace=_0x46d606[_0x1d93('0x56')];if(!_0x39bc22['query'][_0x1d93('0x3a')]('nolimit')){_0x56a91f['limit']=qs[_0x1d93('0x1d')](_0x39bc22[_0x1d93('0x34')]['limit']);_0x56a91f[_0x1d93('0x1c')]=qs[_0x1d93('0x1c')](_0x39bc22[_0x1d93('0x34')][_0x1d93('0x1c')]);}return _0x4b280e['getBlackLists'](_0x56a91f);}})['then'](function(_0x9123d5){if(_0x9123d5){return _0x9123d5?{'count':_0xe17ace,'rows':_0x9123d5}:null;}})['then'](respondWithResult(_0x20d90e,null))[_0x1d93('0x46')](handleError(_0x20d90e,null));};exports[_0x1d93('0x86')]=function(_0xb7dadf,_0x5d07c9,_0x3e3c58){var _0x2233a5,_0x998788;return db['Campaign'][_0x1d93('0x4a')]({'where':{'id':_0xb7dadf[_0x1d93('0x48')]['id']}})[_0x1d93('0x26')](handleEntityNotFound(_0x5d07c9,null))[_0x1d93('0x26')](function(_0xcfe545){if(_0xcfe545){_0x998788=_0xcfe545;return _0xcfe545[_0x1d93('0x86')](_0xb7dadf['body'][_0x1d93('0x66')],_[_0x1d93('0x57')](_0xb7dadf[_0x1d93('0x4c')],[_0x1d93('0x66'),'id'])||{});}return null;})['spread'](function(_0x5404bc){var _0x25aa1a;_0x2233a5=_0x5404bc||[];var _0x382eff=[];if(_0x5404bc){for(var _0x5736b4=0x0;_0x5736b4<_0x5404bc[_0x1d93('0x56')];_0x5736b4+=0x1){var _0x4300de=_0x5404bc[_0x5736b4][_0x1d93('0x27')]({'plain':!![]});_0x25aa1a=squel[_0x1d93('0x68')]()[_0x1d93('0x69')](_0x1d93('0x87'))[_0x1d93('0x7b')](['phone',_0x1d93('0x6b'),_0x1d93('0x6c'),_0x1d93('0x5e'),_0x1d93('0x58'),_0x1d93('0x59')],squel[_0x1d93('0x76')]()[_0x1d93('0x6d')](_0x1d93('0x6e'),'phone')['field']('id',_0x1d93('0x6b'))[_0x1d93('0x6d')](_0x4300de['CmListId'][_0x1d93('0x71')](),'ListId')[_0x1d93('0x6d')](_0xb7dadf[_0x1d93('0x48')]['id']['toString'](),_0x1d93('0x5e'))['field']('NOW()','createdAt')[_0x1d93('0x6d')](_0x1d93('0x6f'),_0x1d93('0x59'))['from']('cm_contacts')['where'](_0x1d93('0x7d'))[_0x1d93('0x3d')](_0x1d93('0x74'),_0x4300de[_0x1d93('0x70')]['toString']())[_0x1d93('0x3d')](_0x1d93('0x75')))[_0x1d93('0x71')]();_0x382eff['push'](db[_0x1d93('0x81')][_0x1d93('0x34')](_0x25aa1a));}return BPromise[_0x1d93('0x82')](_0x382eff);}})[_0x1d93('0x26')](function(){return _0x2233a5;})[_0x1d93('0x26')](respondWithResult(_0x5d07c9,null))[_0x1d93('0x46')](handleError(_0x5d07c9,null));};exports[_0x1d93('0x88')]=function(_0x1b8f4d,_0x401277,_0xae1692){return db[_0x1d93('0x42')][_0x1d93('0x4a')]({'where':{'id':_0x1b8f4d[_0x1d93('0x48')]['id']}})[_0x1d93('0x26')](handleEntityNotFound(_0x401277,null))[_0x1d93('0x26')](function(_0x31664e){if(_0x31664e){return _0x31664e['removeBlackLists'](_0x1b8f4d[_0x1d93('0x34')][_0x1d93('0x66')]);}})[_0x1d93('0x26')](function(_0x347b1e){if(_0x347b1e){return db[_0x1d93('0x63')]['destroy']({'where':{'ListId':_0x1b8f4d['query']['ids'],'CampaignId':_0x1b8f4d['params']['id']}})[_0x1d93('0x26')](function(){return _0x347b1e;});}})[_0x1d93('0x26')](respondWithStatusCode(_0x401277,null))[_0x1d93('0x46')](handleError(_0x401277,null));}; \ No newline at end of file +var _0xcd55=['insert','into','removeLists','getBlackLists','push','all','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','set','reject','save','update','destroy','then','get','IvrCampaigns','UserProfileResource','end','error','stack','send','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','Campaign','includeAll','include','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','getHoppers','findOne','pick','CmHopper','findAll','getHopperHistories','CampaignId','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','toString','NOW()','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)'];(function(_0x2b45b5,_0x474458){var _0x1d9c06=function(_0x9a3264){while(--_0x9a3264){_0x2b45b5['push'](_0x2b45b5['shift']());}};_0x1d9c06(++_0x474458);}(_0xcd55,0x19c));var _0x5cd5=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xcd55[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require(_0x5cd5('0x0'));var rimraf=require(_0x5cd5('0x1'));var zipdir=require(_0x5cd5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5cd5('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5cd5('0x4'));var util=require(_0x5cd5('0x5'));var path=require(_0x5cd5('0x6'));var sox=require(_0x5cd5('0x7'));var csv=require(_0x5cd5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5cd5('0x9'));var _=require('lodash');var squel=require(_0x5cd5('0xa'));var crypto=require(_0x5cd5('0xb'));var jsforce=require(_0x5cd5('0xc'));var deskjs=require(_0x5cd5('0xd'));var toCsv=require(_0x5cd5('0x8'));var querystring=require(_0x5cd5('0xe'));var Papa=require(_0x5cd5('0xf'));var Redis=require(_0x5cd5('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5cd5('0x11'));var as=require(_0x5cd5('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5cd5('0x13'))('api');var utils=require(_0x5cd5('0x14'));var config=require(_0x5cd5('0x15'));var licenseUtil=require(_0x5cd5('0x16'));var db=require(_0x5cd5('0x17'))['db'];function respondWithStatusCode(_0x540c2f,_0x190386){_0x190386=_0x190386||0xcc;return function(_0x1d2d09){if(_0x1d2d09){return _0x540c2f[_0x5cd5('0x18')](_0x190386);}return _0x540c2f['status'](_0x190386)['end']();};}function respondWithResult(_0xeb8cc2,_0x3a4712){_0x3a4712=_0x3a4712||0xc8;return function(_0x23e383){if(_0x23e383){return _0xeb8cc2[_0x5cd5('0x19')](_0x3a4712)[_0x5cd5('0x1a')](_0x23e383);}};}function respondWithFilteredResult(_0x204239,_0x16fcfb){return function(_0x3d13ba){if(_0x3d13ba){var _0x1fb6d1=typeof _0x16fcfb['offset']==='undefined'&&typeof _0x16fcfb[_0x5cd5('0x1b')]===_0x5cd5('0x1c');var _0x4e811b=_0x3d13ba[_0x5cd5('0x1d')];var _0x581f84=_0x1fb6d1?0x0:_0x16fcfb[_0x5cd5('0x1e')];var _0x525717=_0x1fb6d1?_0x3d13ba[_0x5cd5('0x1d')]:_0x16fcfb['offset']+_0x16fcfb['limit'];var _0x8fd539;if(_0x525717>=_0x4e811b){_0x525717=_0x4e811b;_0x8fd539=0xc8;}else{_0x8fd539=0xce;}_0x204239[_0x5cd5('0x19')](_0x8fd539);return _0x204239[_0x5cd5('0x1f')]('Content-Range',_0x581f84+'-'+_0x525717+'/'+_0x4e811b)[_0x5cd5('0x1a')](_0x3d13ba);}return null;};}function patchUpdates(_0x258587){return function(_0x328a86){try{jsonpatch['apply'](_0x328a86,_0x258587,!![]);}catch(_0x1d8f11){return BPromise[_0x5cd5('0x20')](_0x1d8f11);}return _0x328a86[_0x5cd5('0x21')]();};}function saveUpdates(_0x1aa280,_0x561df3){return function(_0x276486){if(_0x276486){return _0x276486[_0x5cd5('0x22')](_0x1aa280)['then'](function(_0x18446e){return _0x18446e;});}return null;};}function removeEntity(_0x46b375,_0x31eb36){return function(_0x481483){if(_0x481483){return _0x481483[_0x5cd5('0x23')]()[_0x5cd5('0x24')](function(){var _0x4a3741=_0x481483[_0x5cd5('0x25')]({'plain':!![]});var _0x17c7bf=_0x5cd5('0x26');return db[_0x5cd5('0x27')][_0x5cd5('0x23')]({'where':{'type':_0x17c7bf,'resourceId':_0x4a3741['id']}})[_0x5cd5('0x24')](function(){return _0x481483;});})[_0x5cd5('0x24')](function(){_0x46b375[_0x5cd5('0x19')](0xcc)[_0x5cd5('0x28')]();});}};}function handleEntityNotFound(_0x5c3b21,_0x2a1901){return function(_0x1e5405){if(!_0x1e5405){_0x5c3b21['sendStatus'](0x194);}return _0x1e5405;};}function handleError(_0x587cc9,_0x2a38e3){_0x2a38e3=_0x2a38e3||0x1f4;return function(_0x5a80a8){logger[_0x5cd5('0x29')](_0x5a80a8[_0x5cd5('0x2a')]);if(_0x5a80a8['name']){delete _0x5a80a8['name'];}_0x587cc9[_0x5cd5('0x19')](_0x2a38e3)[_0x5cd5('0x2b')](_0x5a80a8);};}exports['index']=function(_0x4f7371,_0xaaab18){var _0x116779={},_0x47f6c0={},_0x845ae7={'count':0x0,'rows':[]};var _0x1bce4f=_[_0x5cd5('0x2c')](db['Campaign'][_0x5cd5('0x2d')],function(_0x1a2a04){return{'name':_0x1a2a04[_0x5cd5('0x2e')],'type':_0x1a2a04[_0x5cd5('0x2f')][_0x5cd5('0x30')]};});_0x47f6c0[_0x5cd5('0x31')]=_[_0x5cd5('0x2c')](_0x1bce4f,_0x5cd5('0x32'));_0x47f6c0[_0x5cd5('0x33')]=_[_0x5cd5('0x34')](_0x4f7371['query']);_0x47f6c0[_0x5cd5('0x35')]=_[_0x5cd5('0x36')](_0x47f6c0[_0x5cd5('0x31')],_0x47f6c0['query']);_0x116779[_0x5cd5('0x37')]=_[_0x5cd5('0x36')](_0x47f6c0[_0x5cd5('0x31')],qs[_0x5cd5('0x38')](_0x4f7371[_0x5cd5('0x33')]['fields']));_0x116779[_0x5cd5('0x37')]=_0x116779[_0x5cd5('0x37')][_0x5cd5('0x39')]?_0x116779[_0x5cd5('0x37')]:_0x47f6c0[_0x5cd5('0x31')];if(!_0x4f7371[_0x5cd5('0x33')][_0x5cd5('0x3a')](_0x5cd5('0x3b'))){_0x116779[_0x5cd5('0x1b')]=qs['limit'](_0x4f7371[_0x5cd5('0x33')][_0x5cd5('0x1b')]);_0x116779[_0x5cd5('0x1e')]=qs['offset'](_0x4f7371[_0x5cd5('0x33')][_0x5cd5('0x1e')]);}_0x116779[_0x5cd5('0x3c')]=qs[_0x5cd5('0x3d')](_0x4f7371[_0x5cd5('0x33')][_0x5cd5('0x3d')]);_0x116779[_0x5cd5('0x3e')]=qs[_0x5cd5('0x35')](_['pick'](_0x4f7371[_0x5cd5('0x33')],_0x47f6c0[_0x5cd5('0x35')]),_0x1bce4f);if(_0x4f7371[_0x5cd5('0x33')][_0x5cd5('0x3f')]){_0x116779[_0x5cd5('0x3e')]=_[_0x5cd5('0x40')](_0x116779[_0x5cd5('0x3e')],{'$or':_[_0x5cd5('0x2c')](_0x1bce4f,function(_0x3ccb3f){if(_0x3ccb3f[_0x5cd5('0x2f')]!==_0x5cd5('0x41')){var _0x4fd2da={};_0x4fd2da[_0x3ccb3f['name']]={'$like':'%'+_0x4f7371[_0x5cd5('0x33')]['filter']+'%'};return _0x4fd2da;}})});}_0x116779=_[_0x5cd5('0x40')]({},_0x116779,_0x4f7371[_0x5cd5('0x42')]);var _0x56f2d1={'where':_0x116779['where']};return db[_0x5cd5('0x43')][_0x5cd5('0x1d')](_0x56f2d1)['then'](function(_0x2de8f9){_0x845ae7[_0x5cd5('0x1d')]=_0x2de8f9;if(_0x4f7371[_0x5cd5('0x33')][_0x5cd5('0x44')]){_0x116779[_0x5cd5('0x45')]=[{'all':!![]}];}return db[_0x5cd5('0x43')]['findAll'](_0x116779);})[_0x5cd5('0x24')](function(_0x59bb25){_0x845ae7[_0x5cd5('0x46')]=_0x59bb25;return _0x845ae7;})[_0x5cd5('0x24')](respondWithFilteredResult(_0xaaab18,_0x116779))[_0x5cd5('0x47')](handleError(_0xaaab18,null));};exports[_0x5cd5('0x48')]=function(_0x2cbfee,_0xcd7a4){var _0x25b757={'raw':![],'where':{'id':_0x2cbfee[_0x5cd5('0x49')]['id']}},_0x4a4dbf={};_0x4a4dbf[_0x5cd5('0x31')]=_['keys'](db[_0x5cd5('0x43')][_0x5cd5('0x2d')]);_0x4a4dbf[_0x5cd5('0x33')]=_[_0x5cd5('0x34')](_0x2cbfee[_0x5cd5('0x33')]);_0x4a4dbf[_0x5cd5('0x35')]=_[_0x5cd5('0x36')](_0x4a4dbf[_0x5cd5('0x31')],_0x4a4dbf[_0x5cd5('0x33')]);_0x25b757[_0x5cd5('0x37')]=_[_0x5cd5('0x36')](_0x4a4dbf[_0x5cd5('0x31')],qs[_0x5cd5('0x38')](_0x2cbfee[_0x5cd5('0x33')][_0x5cd5('0x38')]));_0x25b757[_0x5cd5('0x37')]=_0x25b757['attributes'][_0x5cd5('0x39')]?_0x25b757['attributes']:_0x4a4dbf[_0x5cd5('0x31')];if(_0x2cbfee[_0x5cd5('0x33')][_0x5cd5('0x44')]){_0x25b757[_0x5cd5('0x45')]=[{'all':!![]}];}_0x25b757=_[_0x5cd5('0x40')]({},_0x25b757,_0x2cbfee[_0x5cd5('0x42')]);return db[_0x5cd5('0x43')][_0x5cd5('0x4a')](_0x25b757)['then'](handleEntityNotFound(_0xcd7a4,null))['then'](respondWithResult(_0xcd7a4,null))[_0x5cd5('0x47')](handleError(_0xcd7a4,null));};exports['create']=function(_0x4319d3,_0x52c81c){return db[_0x5cd5('0x43')][_0x5cd5('0x4b')](_0x4319d3[_0x5cd5('0x4c')],{})[_0x5cd5('0x24')](function(_0x15897c){var _0x7c58a2=_0x4319d3[_0x5cd5('0x4d')][_0x5cd5('0x25')]({'plain':!![]});if(!_0x7c58a2)throw new Error(_0x5cd5('0x4e'));if(_0x7c58a2[_0x5cd5('0x4f')]===_0x5cd5('0x4d')){var _0x36f7e5=_0x15897c[_0x5cd5('0x25')]({'plain':!![]});var _0x1f5737=_0x5cd5('0x26');return db[_0x5cd5('0x50')][_0x5cd5('0x4a')]({'where':{'name':_0x1f5737,'userProfileId':_0x7c58a2[_0x5cd5('0x51')]},'raw':!![]})['then'](function(_0x515c9b){if(_0x515c9b&&_0x515c9b[_0x5cd5('0x52')]===0x0){return db[_0x5cd5('0x27')][_0x5cd5('0x4b')]({'name':_0x36f7e5[_0x5cd5('0x32')],'resourceId':_0x36f7e5['id'],'type':_0x515c9b[_0x5cd5('0x32')],'sectionId':_0x515c9b['id']},{})[_0x5cd5('0x24')](function(){return _0x15897c;});}else{return _0x15897c;}})[_0x5cd5('0x47')](function(_0x259d1e){logger[_0x5cd5('0x29')](_0x5cd5('0x53'),_0x259d1e);throw _0x259d1e;});}return _0x15897c;})['then'](respondWithResult(_0x52c81c,0xc9))[_0x5cd5('0x47')](handleError(_0x52c81c,null));};exports[_0x5cd5('0x54')]=function(_0x2dfb43,_0x3ff076){var _0x42870b={'where':{'id':_0x2dfb43[_0x5cd5('0x49')]['id']}},_0x26fac1={};_0x26fac1['model']=_[_0x5cd5('0x34')](db['Campaign'][_0x5cd5('0x2d')]);_0x42870b['attributes']=_['intersection'](_0x26fac1[_0x5cd5('0x31')],qs[_0x5cd5('0x38')](_0x2dfb43[_0x5cd5('0x33')][_0x5cd5('0x38')]));_0x42870b['attributes']=_0x42870b[_0x5cd5('0x37')][_0x5cd5('0x39')]?_0x42870b[_0x5cd5('0x37')]:_0x26fac1[_0x5cd5('0x31')];if(_0x2dfb43[_0x5cd5('0x33')][_0x5cd5('0x44')]){_0x42870b[_0x5cd5('0x45')]=[{'all':!![]}];}_0x42870b=_['merge']({},_0x42870b,_0x2dfb43[_0x5cd5('0x42')]);return db['Campaign'][_0x5cd5('0x4a')](_0x42870b)[_0x5cd5('0x24')](handleEntityNotFound(_0x3ff076,null))[_0x5cd5('0x24')](function(_0x418ab0){if(_0x418ab0){var _0x3d8e90=_0x418ab0['get']({'plain':!![]});_0x3d8e90=qs[_0x5cd5('0x55')](_0x3d8e90,['id','createdAt',_0x5cd5('0x56')]);_0x2dfb43['body']=_[_0x5cd5('0x55')](_0x2dfb43['body'],['id',_0x5cd5('0x57'),_0x5cd5('0x56')]);return db[_0x5cd5('0x43')]['create'](_[_0x5cd5('0x40')](_0x3d8e90,_0x2dfb43[_0x5cd5('0x4c')]),{'include':_0x2dfb43[_0x5cd5('0x33')][_0x5cd5('0x44')]?[{'all':!![]}]:undefined})[_0x5cd5('0x24')](function(_0x1269bc){var _0x38288d=_0x2dfb43['user'][_0x5cd5('0x25')]({'plain':!![]});if(!_0x38288d)throw new Error(_0x5cd5('0x4e'));if(_0x38288d[_0x5cd5('0x4f')]===_0x5cd5('0x4d')){var _0x6c6e87=_0x1269bc['get']({'plain':!![]});var _0x41109f=_0x5cd5('0x26');return db[_0x5cd5('0x50')][_0x5cd5('0x4a')]({'where':{'name':_0x41109f,'userProfileId':_0x38288d[_0x5cd5('0x51')]},'raw':!![]})[_0x5cd5('0x24')](function(_0x287294){if(_0x287294&&_0x287294[_0x5cd5('0x52')]===0x0){return db[_0x5cd5('0x27')][_0x5cd5('0x4b')]({'name':_0x6c6e87[_0x5cd5('0x32')],'resourceId':_0x6c6e87['id'],'type':_0x287294[_0x5cd5('0x32')],'sectionId':_0x287294['id']},{})[_0x5cd5('0x24')](function(){return _0x1269bc;});}else{return _0x1269bc;}})[_0x5cd5('0x47')](function(_0x426cda){logger['error'](_0x5cd5('0x53'),_0x426cda);throw _0x426cda;});}return _0x1269bc;});}})[_0x5cd5('0x24')](respondWithResult(_0x3ff076,0xc9))[_0x5cd5('0x47')](handleError(_0x3ff076,null));};exports[_0x5cd5('0x22')]=function(_0x1896ef,_0x5f5a0d){if(_0x1896ef[_0x5cd5('0x4c')]['id']){delete _0x1896ef[_0x5cd5('0x4c')]['id'];}return db[_0x5cd5('0x43')][_0x5cd5('0x4a')]({'where':{'id':_0x1896ef['params']['id']}})['then'](handleEntityNotFound(_0x5f5a0d,null))[_0x5cd5('0x24')](saveUpdates(_0x1896ef[_0x5cd5('0x4c')],null))[_0x5cd5('0x24')](respondWithResult(_0x5f5a0d,null))[_0x5cd5('0x47')](handleError(_0x5f5a0d,null));};exports[_0x5cd5('0x23')]=function(_0x50ecab,_0x489d47){return db[_0x5cd5('0x43')][_0x5cd5('0x4a')]({'where':{'id':_0x50ecab[_0x5cd5('0x49')]['id']}})[_0x5cd5('0x24')](handleEntityNotFound(_0x489d47,null))[_0x5cd5('0x24')](removeEntity(_0x489d47,null))[_0x5cd5('0x47')](handleError(_0x489d47,null));};exports[_0x5cd5('0x58')]=function(_0x262701,_0x2ee2fc,_0xbcd715){var _0x145e67={'raw':!![],'where':{}};var _0x354009={};var _0x2d2e09={'count':0x0,'rows':[]};return db['Campaign'][_0x5cd5('0x59')]({'where':{'id':_0x262701['params']['id']}})[_0x5cd5('0x24')](handleEntityNotFound(_0x2ee2fc,null))[_0x5cd5('0x24')](function(_0x4062e9){if(_0x4062e9){_0x354009['model']=_['keys'](db['CmHopper'][_0x5cd5('0x2d')]);_0x354009[_0x5cd5('0x33')]=_[_0x5cd5('0x34')](_0x262701['query']);_0x354009[_0x5cd5('0x35')]=_[_0x5cd5('0x36')](_0x354009[_0x5cd5('0x31')],_0x354009['query']);_0x145e67['attributes']=_[_0x5cd5('0x36')](_0x354009['model'],qs[_0x5cd5('0x38')](_0x262701[_0x5cd5('0x33')][_0x5cd5('0x38')]));_0x145e67[_0x5cd5('0x37')]=_0x145e67[_0x5cd5('0x37')][_0x5cd5('0x39')]?_0x145e67[_0x5cd5('0x37')]:_0x354009[_0x5cd5('0x31')];if(!_0x262701['query'][_0x5cd5('0x3a')](_0x5cd5('0x3b'))){_0x145e67[_0x5cd5('0x1b')]=qs[_0x5cd5('0x1b')](_0x262701['query']['limit']);_0x145e67[_0x5cd5('0x1e')]=qs[_0x5cd5('0x1e')](_0x262701[_0x5cd5('0x33')][_0x5cd5('0x1e')]);}_0x145e67[_0x5cd5('0x3c')]=qs[_0x5cd5('0x3d')](_0x262701['query']['sort']);_0x145e67[_0x5cd5('0x3e')]=qs['filters'](_[_0x5cd5('0x5a')](_0x262701[_0x5cd5('0x33')],_0x354009[_0x5cd5('0x35')]));_0x145e67[_0x5cd5('0x3e')]['CampaignId']=_0x4062e9['id'];if(_0x262701[_0x5cd5('0x33')][_0x5cd5('0x3f')]){_0x145e67[_0x5cd5('0x3e')]=_[_0x5cd5('0x40')](_0x145e67[_0x5cd5('0x3e')],{'$or':_[_0x5cd5('0x2c')](_0x145e67[_0x5cd5('0x37')],function(_0x890814){var _0xb831cc={};_0xb831cc[_0x890814]={'$like':'%'+_0x262701[_0x5cd5('0x33')][_0x5cd5('0x3f')]+'%'};return _0xb831cc;})});}_0x145e67=_['merge']({},_0x145e67,_0x262701[_0x5cd5('0x42')]);return db['CmHopper']['count']({'where':_0x145e67[_0x5cd5('0x3e')]})[_0x5cd5('0x24')](function(_0x1478ac){_0x2d2e09[_0x5cd5('0x1d')]=_0x1478ac;if(_0x262701[_0x5cd5('0x33')]['includeAll']){_0x145e67[_0x5cd5('0x45')]=[{'all':!![]}];}return db[_0x5cd5('0x5b')][_0x5cd5('0x5c')](_0x145e67);})[_0x5cd5('0x24')](function(_0x3a4297){_0x2d2e09[_0x5cd5('0x46')]=_0x3a4297;return _0x2d2e09;});}})[_0x5cd5('0x24')](respondWithFilteredResult(_0x2ee2fc,_0x145e67))[_0x5cd5('0x47')](handleError(_0x2ee2fc,null));};exports[_0x5cd5('0x5d')]=function(_0xd3882e,_0x57ee85,_0xb5548d){var _0x2ac085={'raw':!![],'where':{}};var _0x58dabd={};var _0x5ed443={'count':0x0,'rows':[]};return db[_0x5cd5('0x43')][_0x5cd5('0x59')]({'where':{'id':_0xd3882e[_0x5cd5('0x49')]['id']}})['then'](handleEntityNotFound(_0x57ee85,null))[_0x5cd5('0x24')](function(_0x537e2d){if(_0x537e2d){_0x58dabd[_0x5cd5('0x31')]=_['keys'](db['CmHopperHistory']['rawAttributes']);_0x58dabd[_0x5cd5('0x33')]=_[_0x5cd5('0x34')](_0xd3882e[_0x5cd5('0x33')]);_0x58dabd[_0x5cd5('0x35')]=_[_0x5cd5('0x36')](_0x58dabd[_0x5cd5('0x31')],_0x58dabd[_0x5cd5('0x33')]);_0x2ac085[_0x5cd5('0x37')]=_['intersection'](_0x58dabd[_0x5cd5('0x31')],qs[_0x5cd5('0x38')](_0xd3882e[_0x5cd5('0x33')]['fields']));_0x2ac085[_0x5cd5('0x37')]=_0x2ac085[_0x5cd5('0x37')][_0x5cd5('0x39')]?_0x2ac085['attributes']:_0x58dabd[_0x5cd5('0x31')];if(!_0xd3882e[_0x5cd5('0x33')]['hasOwnProperty'](_0x5cd5('0x3b'))){_0x2ac085[_0x5cd5('0x1b')]=qs[_0x5cd5('0x1b')](_0xd3882e[_0x5cd5('0x33')][_0x5cd5('0x1b')]);_0x2ac085['offset']=qs[_0x5cd5('0x1e')](_0xd3882e[_0x5cd5('0x33')][_0x5cd5('0x1e')]);}_0x2ac085[_0x5cd5('0x3c')]=qs[_0x5cd5('0x3d')](_0xd3882e[_0x5cd5('0x33')]['sort']);_0x2ac085[_0x5cd5('0x3e')]=qs[_0x5cd5('0x35')](_['pick'](_0xd3882e[_0x5cd5('0x33')],_0x58dabd['filters']));_0x2ac085['where'][_0x5cd5('0x5e')]=_0x537e2d['id'];if(_0xd3882e['query'][_0x5cd5('0x3f')]){_0x2ac085[_0x5cd5('0x3e')]=_['merge'](_0x2ac085[_0x5cd5('0x3e')],{'$or':_[_0x5cd5('0x2c')](_0x2ac085[_0x5cd5('0x37')],function(_0x4b4326){var _0x594826={};_0x594826[_0x4b4326]={'$like':'%'+_0xd3882e[_0x5cd5('0x33')][_0x5cd5('0x3f')]+'%'};return _0x594826;})});}_0x2ac085=_[_0x5cd5('0x40')]({},_0x2ac085,_0xd3882e[_0x5cd5('0x42')]);return db['CmHopperHistory'][_0x5cd5('0x1d')]({'where':_0x2ac085[_0x5cd5('0x3e')]})[_0x5cd5('0x24')](function(_0x2e7f7c){_0x5ed443[_0x5cd5('0x1d')]=_0x2e7f7c;if(_0xd3882e[_0x5cd5('0x33')][_0x5cd5('0x44')]){_0x2ac085[_0x5cd5('0x45')]=[{'all':!![]}];}return db[_0x5cd5('0x5f')][_0x5cd5('0x5c')](_0x2ac085);})[_0x5cd5('0x24')](function(_0x475365){_0x5ed443[_0x5cd5('0x46')]=_0x475365;return _0x5ed443;});}})[_0x5cd5('0x24')](respondWithFilteredResult(_0x57ee85,_0x2ac085))[_0x5cd5('0x47')](handleError(_0x57ee85,null));};exports[_0x5cd5('0x60')]=function(_0x514e88,_0x7ff3c8,_0x5f245a){var _0x300892={'raw':!![],'where':{}};var _0x1e0062={};var _0x4906dc={'count':0x0,'rows':[]};return db['Campaign'][_0x5cd5('0x59')]({'where':{'id':_0x514e88[_0x5cd5('0x49')]['id']}})[_0x5cd5('0x24')](handleEntityNotFound(_0x7ff3c8,null))[_0x5cd5('0x24')](function(_0x4b7cbc){if(_0x4b7cbc){_0x1e0062[_0x5cd5('0x31')]=_['keys'](db['CmHopperFinal']['rawAttributes']);_0x1e0062[_0x5cd5('0x33')]=_[_0x5cd5('0x34')](_0x514e88[_0x5cd5('0x33')]);_0x1e0062[_0x5cd5('0x35')]=_[_0x5cd5('0x36')](_0x1e0062[_0x5cd5('0x31')],_0x1e0062[_0x5cd5('0x33')]);_0x300892['attributes']=_[_0x5cd5('0x36')](_0x1e0062[_0x5cd5('0x31')],qs[_0x5cd5('0x38')](_0x514e88[_0x5cd5('0x33')]['fields']));_0x300892[_0x5cd5('0x37')]=_0x300892[_0x5cd5('0x37')][_0x5cd5('0x39')]?_0x300892[_0x5cd5('0x37')]:_0x1e0062[_0x5cd5('0x31')];if(!_0x514e88[_0x5cd5('0x33')][_0x5cd5('0x3a')]('nolimit')){_0x300892[_0x5cd5('0x1b')]=qs[_0x5cd5('0x1b')](_0x514e88['query'][_0x5cd5('0x1b')]);_0x300892['offset']=qs['offset'](_0x514e88[_0x5cd5('0x33')][_0x5cd5('0x1e')]);}_0x300892[_0x5cd5('0x3c')]=qs[_0x5cd5('0x3d')](_0x514e88[_0x5cd5('0x33')][_0x5cd5('0x3d')]);_0x300892[_0x5cd5('0x3e')]=qs[_0x5cd5('0x35')](_['pick'](_0x514e88[_0x5cd5('0x33')],_0x1e0062[_0x5cd5('0x35')]));_0x300892['where'][_0x5cd5('0x5e')]=_0x4b7cbc['id'];if(_0x514e88[_0x5cd5('0x33')]['filter']){_0x300892['where']=_[_0x5cd5('0x40')](_0x300892[_0x5cd5('0x3e')],{'$or':_['map'](_0x300892[_0x5cd5('0x37')],function(_0x3c8213){var _0x16dcc6={};_0x16dcc6[_0x3c8213]={'$like':'%'+_0x514e88[_0x5cd5('0x33')][_0x5cd5('0x3f')]+'%'};return _0x16dcc6;})});}_0x300892=_['merge']({},_0x300892,_0x514e88['options']);return db[_0x5cd5('0x61')]['count']({'where':_0x300892[_0x5cd5('0x3e')]})[_0x5cd5('0x24')](function(_0x38d40f){_0x4906dc[_0x5cd5('0x1d')]=_0x38d40f;if(_0x514e88[_0x5cd5('0x33')]['includeAll']){_0x300892['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0x5cd5('0x5c')](_0x300892);})['then'](function(_0x449bc2){_0x4906dc['rows']=_0x449bc2;return _0x4906dc;});}})[_0x5cd5('0x24')](respondWithFilteredResult(_0x7ff3c8,_0x300892))['catch'](handleError(_0x7ff3c8,null));};exports[_0x5cd5('0x62')]=function(_0x3f5399,_0x3958a6,_0x88b93){var _0x447ddf={'raw':!![],'where':{}};var _0x1f898d={};var _0x5cf4cf={'count':0x0,'rows':[]};return db[_0x5cd5('0x43')][_0x5cd5('0x59')]({'where':{'id':_0x3f5399[_0x5cd5('0x49')]['id']}})[_0x5cd5('0x24')](handleEntityNotFound(_0x3958a6,null))[_0x5cd5('0x24')](function(_0x3f1b56){if(_0x3f1b56){_0x1f898d[_0x5cd5('0x31')]=_['keys'](db[_0x5cd5('0x63')]['rawAttributes']);_0x1f898d[_0x5cd5('0x33')]=_[_0x5cd5('0x34')](_0x3f5399[_0x5cd5('0x33')]);_0x1f898d[_0x5cd5('0x35')]=_[_0x5cd5('0x36')](_0x1f898d[_0x5cd5('0x31')],_0x1f898d['query']);_0x447ddf['attributes']=_[_0x5cd5('0x36')](_0x1f898d[_0x5cd5('0x31')],qs[_0x5cd5('0x38')](_0x3f5399[_0x5cd5('0x33')][_0x5cd5('0x38')]));_0x447ddf[_0x5cd5('0x37')]=_0x447ddf[_0x5cd5('0x37')][_0x5cd5('0x39')]?_0x447ddf[_0x5cd5('0x37')]:_0x1f898d[_0x5cd5('0x31')];if(!_0x3f5399[_0x5cd5('0x33')][_0x5cd5('0x3a')](_0x5cd5('0x3b'))){_0x447ddf[_0x5cd5('0x1b')]=qs[_0x5cd5('0x1b')](_0x3f5399[_0x5cd5('0x33')][_0x5cd5('0x1b')]);_0x447ddf[_0x5cd5('0x1e')]=qs[_0x5cd5('0x1e')](_0x3f5399[_0x5cd5('0x33')]['offset']);}_0x447ddf['order']=qs[_0x5cd5('0x3d')](_0x3f5399[_0x5cd5('0x33')][_0x5cd5('0x3d')]);_0x447ddf[_0x5cd5('0x3e')]=qs[_0x5cd5('0x35')](_[_0x5cd5('0x5a')](_0x3f5399[_0x5cd5('0x33')],_0x1f898d[_0x5cd5('0x35')]));_0x447ddf[_0x5cd5('0x3e')][_0x5cd5('0x5e')]=_0x3f1b56['id'];if(_0x3f5399['query'][_0x5cd5('0x3f')]){_0x447ddf[_0x5cd5('0x3e')]=_[_0x5cd5('0x40')](_0x447ddf[_0x5cd5('0x3e')],{'$or':_['map'](_0x447ddf[_0x5cd5('0x37')],function(_0x24c009){var _0x49c575={};_0x49c575[_0x24c009]={'$like':'%'+_0x3f5399[_0x5cd5('0x33')][_0x5cd5('0x3f')]+'%'};return _0x49c575;})});}_0x447ddf=_['merge']({},_0x447ddf,_0x3f5399[_0x5cd5('0x42')]);return db[_0x5cd5('0x63')][_0x5cd5('0x1d')]({'where':_0x447ddf[_0x5cd5('0x3e')]})[_0x5cd5('0x24')](function(_0x31a72d){_0x5cf4cf[_0x5cd5('0x1d')]=_0x31a72d;if(_0x3f5399[_0x5cd5('0x33')][_0x5cd5('0x44')]){_0x447ddf['include']=[{'all':!![]}];}return db[_0x5cd5('0x63')][_0x5cd5('0x5c')](_0x447ddf);})[_0x5cd5('0x24')](function(_0x29ae68){_0x5cf4cf[_0x5cd5('0x46')]=_0x29ae68;return _0x5cf4cf;});}})[_0x5cd5('0x24')](respondWithFilteredResult(_0x3958a6,_0x447ddf))['catch'](handleError(_0x3958a6,null));};exports[_0x5cd5('0x64')]=function(_0x3f2d2c,_0x4c065e,_0x42e304){var _0x125dc7={};var _0x2cd53c={};var _0x4c501b;var _0x3b71e8;return db[_0x5cd5('0x43')][_0x5cd5('0x59')]({'where':{'id':_0x3f2d2c[_0x5cd5('0x49')]['id']}})['then'](handleEntityNotFound(_0x4c065e,null))[_0x5cd5('0x24')](function(_0x52080c){if(_0x52080c){_0x4c501b=_0x52080c;_0x2cd53c[_0x5cd5('0x31')]=_['keys'](db[_0x5cd5('0x65')][_0x5cd5('0x2d')]);_0x2cd53c[_0x5cd5('0x33')]=_[_0x5cd5('0x34')](_0x3f2d2c[_0x5cd5('0x33')]);_0x2cd53c[_0x5cd5('0x35')]=_[_0x5cd5('0x36')](_0x2cd53c[_0x5cd5('0x31')],_0x2cd53c[_0x5cd5('0x33')]);_0x125dc7[_0x5cd5('0x37')]=_[_0x5cd5('0x36')](_0x2cd53c[_0x5cd5('0x31')],qs[_0x5cd5('0x38')](_0x3f2d2c[_0x5cd5('0x33')][_0x5cd5('0x38')]));_0x125dc7[_0x5cd5('0x37')]=_0x125dc7[_0x5cd5('0x37')]['length']?_0x125dc7[_0x5cd5('0x37')]:_0x2cd53c['model'];_0x125dc7[_0x5cd5('0x3c')]=qs[_0x5cd5('0x3d')](_0x3f2d2c['query'][_0x5cd5('0x3d')]);_0x125dc7[_0x5cd5('0x3e')]=qs[_0x5cd5('0x35')](_[_0x5cd5('0x5a')](_0x3f2d2c[_0x5cd5('0x33')],_0x2cd53c[_0x5cd5('0x35')]));if(_0x3f2d2c[_0x5cd5('0x33')][_0x5cd5('0x3f')]){_0x125dc7[_0x5cd5('0x3e')]=_[_0x5cd5('0x40')](_0x125dc7[_0x5cd5('0x3e')],{'$or':_[_0x5cd5('0x2c')](_0x125dc7['attributes'],function(_0x165eec){var _0x341bc7={};_0x341bc7[_0x165eec]={'$like':'%'+_0x3f2d2c[_0x5cd5('0x33')]['filter']+'%'};return _0x341bc7;})});}_0x125dc7=_[_0x5cd5('0x40')]({},_0x125dc7,_0x3f2d2c[_0x5cd5('0x42')]);return _0x4c501b[_0x5cd5('0x64')](_0x125dc7);}})['then'](function(_0x5c0da3){if(_0x5c0da3){_0x3b71e8=_0x5c0da3[_0x5cd5('0x39')];if(!_0x3f2d2c['query']['hasOwnProperty'](_0x5cd5('0x3b'))){_0x125dc7[_0x5cd5('0x1b')]=qs[_0x5cd5('0x1b')](_0x3f2d2c[_0x5cd5('0x33')][_0x5cd5('0x1b')]);_0x125dc7[_0x5cd5('0x1e')]=qs[_0x5cd5('0x1e')](_0x3f2d2c[_0x5cd5('0x33')][_0x5cd5('0x1e')]);}return _0x4c501b[_0x5cd5('0x64')](_0x125dc7);}})[_0x5cd5('0x24')](function(_0x1286e8){if(_0x1286e8){return _0x1286e8?{'count':_0x3b71e8,'rows':_0x1286e8}:null;}})[_0x5cd5('0x24')](respondWithResult(_0x4c065e,null))[_0x5cd5('0x47')](handleError(_0x4c065e,null));};exports[_0x5cd5('0x66')]=function(_0x3ff0d5,_0x2296ad,_0x444464){var _0x2fc4be,_0x563bc8;return db[_0x5cd5('0x43')]['find']({'where':{'id':_0x3ff0d5['params']['id']}})[_0x5cd5('0x24')](handleEntityNotFound(_0x2296ad,null))['then'](function(_0x59d0f6){if(_0x59d0f6){_0x563bc8=_0x59d0f6;return _0x59d0f6[_0x5cd5('0x66')](_0x3ff0d5[_0x5cd5('0x4c')]['ids'],_['omit'](_0x3ff0d5['body'],[_0x5cd5('0x67'),'id'])||{});}return null;})[_0x5cd5('0x68')](function(_0x1756cd){var _0x394742;_0x2fc4be=_0x1756cd||[];var _0x1f4e78=[];if(_0x1756cd){for(var _0x3ea599=0x0;_0x3ea599<_0x1756cd[_0x5cd5('0x39')];_0x3ea599+=0x1){var _0x4c94d8=_0x1756cd[_0x3ea599]['get']({'plain':!![]});_0x563bc8[_0x5cd5('0x69')]=_0x3ff0d5[_0x5cd5('0x4c')][_0x5cd5('0x69')]?_0x3ff0d5['body'][_0x5cd5('0x69')]:_0x563bc8[_0x5cd5('0x69')];switch(_0x563bc8['dialCheckDuplicateType']){case _0x5cd5('0x6a'):_0x394742=squel['insert']()['into'](_0x5cd5('0x6b'))[_0x5cd5('0x6c')]([_0x5cd5('0x6d'),_0x5cd5('0x6e'),_0x5cd5('0x6f'),_0x5cd5('0x70'),_0x5cd5('0x5e'),_0x5cd5('0x57'),_0x5cd5('0x56')],squel[_0x5cd5('0x71')]()['field'](_0x5cd5('0x6d'),_0x5cd5('0x6d'))['field']('NOW()',_0x5cd5('0x6e'))[_0x5cd5('0x72')]('id','ContactId')[_0x5cd5('0x72')](_0x4c94d8['CmListId'][_0x5cd5('0x73')](),'ListId')[_0x5cd5('0x72')](_0x3ff0d5['params']['id'][_0x5cd5('0x73')](),_0x5cd5('0x5e'))[_0x5cd5('0x72')]('NOW()',_0x5cd5('0x57'))[_0x5cd5('0x72')](_0x5cd5('0x74'),_0x5cd5('0x56'))[_0x5cd5('0x75')](_0x5cd5('0x76'))[_0x5cd5('0x3e')](_0x5cd5('0x77'))[_0x5cd5('0x3e')](_0x5cd5('0x78'),_0x4c94d8[_0x5cd5('0x79')]['toString']())[_0x5cd5('0x3e')](_0x5cd5('0x7a'))[_0x5cd5('0x3e')]('phone\x20NOT\x20IN\x20(?)',squel[_0x5cd5('0x71')]()[_0x5cd5('0x72')](_0x5cd5('0x7b'))[_0x5cd5('0x75')](_0x5cd5('0x7c'))['where'](_0x5cd5('0x7d'),_0x3ff0d5[_0x5cd5('0x49')]['id'][_0x5cd5('0x73')]()))[_0x5cd5('0x3e')](_0x5cd5('0x7e'),squel[_0x5cd5('0x71')]()[_0x5cd5('0x72')](_0x5cd5('0x7f'))[_0x5cd5('0x75')]('cm_hopper')[_0x5cd5('0x3e')]('CampaignId\x20=\x20?',_0x3ff0d5['params']['id']['toString']())))[_0x5cd5('0x73')]();break;case'onlyIfOpen':_0x394742=squel[_0x5cd5('0x80')]()['into'](_0x5cd5('0x6b'))[_0x5cd5('0x6c')]([_0x5cd5('0x6d'),'scheduledAt',_0x5cd5('0x6f'),_0x5cd5('0x70'),_0x5cd5('0x5e'),_0x5cd5('0x57'),'updatedAt'],squel[_0x5cd5('0x71')]()[_0x5cd5('0x72')]('phone',_0x5cd5('0x6d'))['field'](_0x5cd5('0x74'),'scheduledAt')['field']('id','ContactId')[_0x5cd5('0x72')](_0x4c94d8[_0x5cd5('0x79')][_0x5cd5('0x73')](),'ListId')[_0x5cd5('0x72')](_0x3ff0d5['params']['id'][_0x5cd5('0x73')](),_0x5cd5('0x5e'))['field'](_0x5cd5('0x74'),_0x5cd5('0x57'))['field']('NOW()',_0x5cd5('0x56'))[_0x5cd5('0x75')](_0x5cd5('0x76'))[_0x5cd5('0x3e')]('deletedAt\x20IS\x20NULL')[_0x5cd5('0x3e')](_0x5cd5('0x78'),_0x4c94d8[_0x5cd5('0x79')][_0x5cd5('0x73')]())[_0x5cd5('0x3e')](_0x5cd5('0x7a'))[_0x5cd5('0x3e')](_0x5cd5('0x7e'),squel[_0x5cd5('0x71')]()[_0x5cd5('0x72')]('COALESCE(phone,\x27\x27)')[_0x5cd5('0x75')]('cm_hopper')[_0x5cd5('0x3e')](_0x5cd5('0x7d'),_0x3ff0d5['params']['id'][_0x5cd5('0x73')]())))[_0x5cd5('0x73')]();break;default:_0x394742=squel['insert']()[_0x5cd5('0x81')](_0x5cd5('0x6b'))[_0x5cd5('0x6c')]([_0x5cd5('0x6d'),_0x5cd5('0x6e'),'ContactId',_0x5cd5('0x70'),_0x5cd5('0x5e'),'createdAt',_0x5cd5('0x56')],squel[_0x5cd5('0x71')]()[_0x5cd5('0x72')](_0x5cd5('0x6d'),_0x5cd5('0x6d'))[_0x5cd5('0x72')]('NOW()',_0x5cd5('0x6e'))[_0x5cd5('0x72')]('id',_0x5cd5('0x6f'))[_0x5cd5('0x72')](_0x4c94d8[_0x5cd5('0x79')]['toString'](),_0x5cd5('0x70'))[_0x5cd5('0x72')](_0x3ff0d5[_0x5cd5('0x49')]['id'][_0x5cd5('0x73')](),_0x5cd5('0x5e'))[_0x5cd5('0x72')](_0x5cd5('0x74'),'createdAt')[_0x5cd5('0x72')]('NOW()',_0x5cd5('0x56'))['from'](_0x5cd5('0x76'))[_0x5cd5('0x3e')](_0x5cd5('0x77'))['where'](_0x5cd5('0x78'),_0x4c94d8[_0x5cd5('0x79')][_0x5cd5('0x73')]())['where'](_0x5cd5('0x7a')))['toString']();}_0x1f4e78['push'](db['sequelize'][_0x5cd5('0x33')](_0x394742));}return BPromise['all'](_0x1f4e78);}})[_0x5cd5('0x24')](function(){return _0x2fc4be;})['then'](respondWithResult(_0x2296ad,null))[_0x5cd5('0x47')](handleError(_0x2296ad,null));};exports[_0x5cd5('0x82')]=function(_0x92dd0,_0xcb72b9,_0x3af6ec){return db['Campaign'][_0x5cd5('0x4a')]({'where':{'id':_0x92dd0[_0x5cd5('0x49')]['id']}})[_0x5cd5('0x24')](handleEntityNotFound(_0xcb72b9,null))[_0x5cd5('0x24')](function(_0x1bf43c){if(_0x1bf43c){return _0x1bf43c[_0x5cd5('0x82')](_0x92dd0[_0x5cd5('0x33')][_0x5cd5('0x67')]);}})[_0x5cd5('0x24')](function(_0x5a93d8){if(_0x5a93d8){return db[_0x5cd5('0x5b')][_0x5cd5('0x23')]({'where':{'ListId':_0x92dd0[_0x5cd5('0x33')][_0x5cd5('0x67')],'CampaignId':_0x92dd0['params']['id']}})[_0x5cd5('0x24')](function(){return _0x5a93d8;});}})['then'](respondWithStatusCode(_0xcb72b9,null))[_0x5cd5('0x47')](handleError(_0xcb72b9,null));};exports[_0x5cd5('0x83')]=function(_0x52848c,_0x30eabb,_0x183d2f){var _0x322a83={};var _0x1ad275={};var _0xe97948;var _0x557fde;return db[_0x5cd5('0x43')][_0x5cd5('0x59')]({'where':{'id':_0x52848c['params']['id']}})[_0x5cd5('0x24')](handleEntityNotFound(_0x30eabb,null))[_0x5cd5('0x24')](function(_0x54b521){if(_0x54b521){_0xe97948=_0x54b521;_0x1ad275[_0x5cd5('0x31')]=_[_0x5cd5('0x34')](db['CmList'][_0x5cd5('0x2d')]);_0x1ad275['query']=_['keys'](_0x52848c[_0x5cd5('0x33')]);_0x1ad275['filters']=_[_0x5cd5('0x36')](_0x1ad275[_0x5cd5('0x31')],_0x1ad275[_0x5cd5('0x33')]);_0x322a83[_0x5cd5('0x37')]=_[_0x5cd5('0x36')](_0x1ad275['model'],qs[_0x5cd5('0x38')](_0x52848c['query']['fields']));_0x322a83[_0x5cd5('0x37')]=_0x322a83[_0x5cd5('0x37')][_0x5cd5('0x39')]?_0x322a83[_0x5cd5('0x37')]:_0x1ad275[_0x5cd5('0x31')];_0x322a83[_0x5cd5('0x3c')]=qs[_0x5cd5('0x3d')](_0x52848c[_0x5cd5('0x33')][_0x5cd5('0x3d')]);_0x322a83[_0x5cd5('0x3e')]=qs[_0x5cd5('0x35')](_[_0x5cd5('0x5a')](_0x52848c['query'],_0x1ad275[_0x5cd5('0x35')]));if(_0x52848c['query'][_0x5cd5('0x3f')]){_0x322a83[_0x5cd5('0x3e')]=_[_0x5cd5('0x40')](_0x322a83['where'],{'$or':_[_0x5cd5('0x2c')](_0x322a83[_0x5cd5('0x37')],function(_0x2f06bd){var _0x1043a4={};_0x1043a4[_0x2f06bd]={'$like':'%'+_0x52848c[_0x5cd5('0x33')][_0x5cd5('0x3f')]+'%'};return _0x1043a4;})});}_0x322a83=_[_0x5cd5('0x40')]({},_0x322a83,_0x52848c['options']);return _0xe97948[_0x5cd5('0x83')](_0x322a83);}})[_0x5cd5('0x24')](function(_0x36783a){if(_0x36783a){_0x557fde=_0x36783a[_0x5cd5('0x39')];if(!_0x52848c[_0x5cd5('0x33')][_0x5cd5('0x3a')](_0x5cd5('0x3b'))){_0x322a83[_0x5cd5('0x1b')]=qs[_0x5cd5('0x1b')](_0x52848c['query'][_0x5cd5('0x1b')]);_0x322a83[_0x5cd5('0x1e')]=qs[_0x5cd5('0x1e')](_0x52848c['query']['offset']);}return _0xe97948[_0x5cd5('0x83')](_0x322a83);}})['then'](function(_0x2978c4){if(_0x2978c4){return _0x2978c4?{'count':_0x557fde,'rows':_0x2978c4}:null;}})[_0x5cd5('0x24')](respondWithResult(_0x30eabb,null))[_0x5cd5('0x47')](handleError(_0x30eabb,null));};exports['addBlackLists']=function(_0x380390,_0x4643bf,_0x1e233f){var _0x12972f,_0xa0d733;return db['Campaign'][_0x5cd5('0x4a')]({'where':{'id':_0x380390[_0x5cd5('0x49')]['id']}})[_0x5cd5('0x24')](handleEntityNotFound(_0x4643bf,null))['then'](function(_0x356783){if(_0x356783){_0xa0d733=_0x356783;return _0x356783['addBlackLists'](_0x380390[_0x5cd5('0x4c')][_0x5cd5('0x67')],_[_0x5cd5('0x55')](_0x380390[_0x5cd5('0x4c')],['ids','id'])||{});}return null;})[_0x5cd5('0x68')](function(_0x1a3e51){var _0x2b197f;_0x12972f=_0x1a3e51||[];var _0x52c415=[];if(_0x1a3e51){for(var _0x147f4b=0x0;_0x147f4b<_0x1a3e51[_0x5cd5('0x39')];_0x147f4b+=0x1){var _0x28598e=_0x1a3e51[_0x147f4b][_0x5cd5('0x25')]({'plain':!![]});_0x2b197f=squel[_0x5cd5('0x80')]()[_0x5cd5('0x81')]('cm_hopper_black')['fromQuery'](['phone',_0x5cd5('0x6f'),_0x5cd5('0x70'),_0x5cd5('0x5e'),_0x5cd5('0x57'),_0x5cd5('0x56')],squel[_0x5cd5('0x71')]()[_0x5cd5('0x72')](_0x5cd5('0x6d'),_0x5cd5('0x6d'))[_0x5cd5('0x72')]('id',_0x5cd5('0x6f'))[_0x5cd5('0x72')](_0x28598e[_0x5cd5('0x79')][_0x5cd5('0x73')](),_0x5cd5('0x70'))['field'](_0x380390[_0x5cd5('0x49')]['id'][_0x5cd5('0x73')](),_0x5cd5('0x5e'))[_0x5cd5('0x72')](_0x5cd5('0x74'),_0x5cd5('0x57'))[_0x5cd5('0x72')](_0x5cd5('0x74'),_0x5cd5('0x56'))[_0x5cd5('0x75')]('cm_contacts')['where'](_0x5cd5('0x77'))[_0x5cd5('0x3e')](_0x5cd5('0x78'),_0x28598e['CmListId'][_0x5cd5('0x73')]())['where'](_0x5cd5('0x7a')))['toString']();_0x52c415[_0x5cd5('0x84')](db['sequelize'][_0x5cd5('0x33')](_0x2b197f));}return BPromise[_0x5cd5('0x85')](_0x52c415);}})[_0x5cd5('0x24')](function(){return _0x12972f;})['then'](respondWithResult(_0x4643bf,null))['catch'](handleError(_0x4643bf,null));};exports['removeBlackLists']=function(_0x33274d,_0x41dadc,_0x2bf8df){return db['Campaign'][_0x5cd5('0x4a')]({'where':{'id':_0x33274d[_0x5cd5('0x49')]['id']}})[_0x5cd5('0x24')](handleEntityNotFound(_0x41dadc,null))[_0x5cd5('0x24')](function(_0x1123a2){if(_0x1123a2){return _0x1123a2[_0x5cd5('0x86')](_0x33274d['query']['ids']);}})[_0x5cd5('0x24')](function(_0x204a3a){if(_0x204a3a){return db[_0x5cd5('0x63')][_0x5cd5('0x23')]({'where':{'ListId':_0x33274d['query']['ids'],'CampaignId':_0x33274d[_0x5cd5('0x49')]['id']}})[_0x5cd5('0x24')](function(){return _0x204a3a;});}})[_0x5cd5('0x24')](respondWithStatusCode(_0x41dadc,null))[_0x5cd5('0x47')](handleError(_0x41dadc,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 765310f..3cc355e 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x5277cc,_0x39d5a9){var _0x1bba2b=function(_0x620d20){while(--_0x620d20){_0x5277cc['push'](_0x5277cc['shift']());}};_0x1bba2b(++_0x39d5a9);}(_0x7a54,0x106));var _0x47a5=function(_0x12bb52,_0x3b6415){_0x12bb52=_0x12bb52-0x0;var _0x4ba1ed=_0x7a54[_0x12bb52];return _0x4ba1ed;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 9fe53de..b4f60c7 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 _0xf4dd=['info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetCampaign','findAll','options','raw','where','attributes','limit','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','request','then'];(function(_0x3afa79,_0x2f1a1f){var _0x4b48ef=function(_0xca9a4b){while(--_0xca9a4b){_0x3afa79['push'](_0x3afa79['shift']());}};_0x4b48ef(++_0x2f1a1f);}(_0xf4dd,0xb4));var _0xdf4d=function(_0x215de4,_0x2ba2b4){_0x215de4=_0x215de4-0x0;var _0x3607d2=_0xf4dd[_0x215de4];return _0x3607d2;};'use strict';var _=require(_0xdf4d('0x0'));var util=require(_0xdf4d('0x1'));var moment=require(_0xdf4d('0x2'));var BPromise=require(_0xdf4d('0x3'));var rs=require(_0xdf4d('0x4'));var fs=require('fs');var Redis=require(_0xdf4d('0x5'));var db=require(_0xdf4d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xdf4d('0x7'))('rpc');var config=require(_0xdf4d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xdf4d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4334b0,_0x5ee8f5,_0x64c256){return new BPromise(function(_0x4a3e29,_0x34918e){return client[_0xdf4d('0xa')](_0x4334b0,_0x64c256)[_0xdf4d('0xb')](function(_0x49c7ef){logger[_0xdf4d('0xc')](_0xdf4d('0xd'),_0x5ee8f5,_0xdf4d('0xe'));logger[_0xdf4d('0xf')](_0xdf4d('0x10'),_0x5ee8f5,_0xdf4d('0xe'),JSON[_0xdf4d('0x11')](_0x49c7ef));if(_0x49c7ef[_0xdf4d('0x12')]){if(_0x49c7ef[_0xdf4d('0x12')]['code']===0x1f4){logger[_0xdf4d('0x12')](_0xdf4d('0xd'),_0x5ee8f5,_0x49c7ef[_0xdf4d('0x12')][_0xdf4d('0x13')]);return _0x34918e(_0x49c7ef[_0xdf4d('0x12')][_0xdf4d('0x13')]);}logger[_0xdf4d('0x12')](_0xdf4d('0xd'),_0x5ee8f5,_0x49c7ef[_0xdf4d('0x12')][_0xdf4d('0x13')]);return _0x4a3e29(_0x49c7ef[_0xdf4d('0x12')][_0xdf4d('0x13')]);}else{logger[_0xdf4d('0xc')](_0xdf4d('0xd'),_0x5ee8f5,_0xdf4d('0xe'));_0x4a3e29(_0x49c7ef[_0xdf4d('0x14')][_0xdf4d('0x13')]);}})[_0xdf4d('0x15')](function(_0x357a70){logger['error']('Campaign,\x20%s,\x20%s',_0x5ee8f5,_0x357a70);_0x34918e(_0x357a70);});});}exports[_0xdf4d('0x16')]=function(_0x95b106){var _0x4f88c3=this;return new Promise(function(_0x4e02f8,_0x48aca2){return db['Campaign'][_0xdf4d('0x17')]({'raw':_0x95b106['options']?_0x95b106[_0xdf4d('0x18')][_0xdf4d('0x19')]===undefined?!![]:![]:!![],'where':_0x95b106[_0xdf4d('0x18')]?_0x95b106['options'][_0xdf4d('0x1a')]||null:null,'attributes':_0x95b106[_0xdf4d('0x18')]?_0x95b106[_0xdf4d('0x18')][_0xdf4d('0x1b')]||null:null,'limit':_0x95b106[_0xdf4d('0x18')]?_0x95b106[_0xdf4d('0x18')][_0xdf4d('0x1c')]||null:null,'include':_0x95b106[_0xdf4d('0x18')]?_0x95b106[_0xdf4d('0x18')][_0xdf4d('0x1d')]?_[_0xdf4d('0x1e')](_0x95b106[_0xdf4d('0x18')][_0xdf4d('0x1d')],function(_0x3e96a0){return{'model':db[_0x3e96a0[_0xdf4d('0x1f')]],'as':_0x3e96a0['as'],'attributes':_0x3e96a0['attributes'],'include':_0x3e96a0[_0xdf4d('0x1d')]?_['map'](_0x3e96a0[_0xdf4d('0x1d')],function(_0x5e6009){return{'model':db[_0x5e6009[_0xdf4d('0x1f')]],'as':_0x5e6009['as'],'attributes':_0x5e6009['attributes'],'include':_0x5e6009['include']?_[_0xdf4d('0x1e')](_0x5e6009[_0xdf4d('0x1d')],function(_0x34eed9){return{'model':db[_0x34eed9[_0xdf4d('0x1f')]],'as':_0x34eed9['as'],'attributes':_0x34eed9['attributes']};}):[]};}):[]};}):[]:[]})[_0xdf4d('0xb')](function(_0x397534){logger[_0xdf4d('0xc')](_0xdf4d('0x16'),_0x95b106);logger['debug'](_0xdf4d('0x16'),_0x95b106,JSON[_0xdf4d('0x11')](_0x397534));_0x4e02f8(_0x397534);})[_0xdf4d('0x15')](function(_0x44e031){logger[_0xdf4d('0x12')](_0xdf4d('0x16'),_0x44e031['message'],_0x95b106);_0x48aca2(_0x4f88c3[_0xdf4d('0x12')](0x1f4,_0x44e031[_0xdf4d('0x13')]));});});}; \ No newline at end of file +var _0x8a9c=['jayson/promise','http','request','then','request\x20sent','debug','error','message','info','Campaign,\x20%s,\x20%s','Campaign','findAll','options','where','attributes','limit','include','map','model','GetCampaign','stringify','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x9347c0,_0x16ab16){var _0xbd1531=function(_0x5d9034){while(--_0x5d9034){_0x9347c0['push'](_0x9347c0['shift']());}};_0xbd1531(++_0x16ab16);}(_0x8a9c,0x12d));var _0xc8a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8a9c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc8a9('0x0'));var util=require(_0xc8a9('0x1'));var moment=require(_0xc8a9('0x2'));var BPromise=require(_0xc8a9('0x3'));var rs=require(_0xc8a9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc8a9('0x5'))['db'];var utils=require(_0xc8a9('0x6'));var logger=require('../../config/logger')(_0xc8a9('0x7'));var config=require(_0xc8a9('0x8'));var jayson=require(_0xc8a9('0x9'));var client=jayson['client'][_0xc8a9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3dc31c,_0x1d49c8,_0x4520a2){return new BPromise(function(_0x2928f3,_0x241eae){return client[_0xc8a9('0xb')](_0x3dc31c,_0x4520a2)[_0xc8a9('0xc')](function(_0xb079ad){logger['info']('Campaign,\x20%s,\x20%s',_0x1d49c8,_0xc8a9('0xd'));logger[_0xc8a9('0xe')]('Campaign,\x20%s,\x20%s,\x20%s',_0x1d49c8,_0xc8a9('0xd'),JSON['stringify'](_0xb079ad));if(_0xb079ad[_0xc8a9('0xf')]){if(_0xb079ad[_0xc8a9('0xf')]['code']===0x1f4){logger[_0xc8a9('0xf')]('Campaign,\x20%s,\x20%s',_0x1d49c8,_0xb079ad[_0xc8a9('0xf')][_0xc8a9('0x10')]);return _0x241eae(_0xb079ad[_0xc8a9('0xf')][_0xc8a9('0x10')]);}logger[_0xc8a9('0xf')]('Campaign,\x20%s,\x20%s',_0x1d49c8,_0xb079ad['error'][_0xc8a9('0x10')]);return _0x2928f3(_0xb079ad['error'][_0xc8a9('0x10')]);}else{logger[_0xc8a9('0x11')](_0xc8a9('0x12'),_0x1d49c8,_0xc8a9('0xd'));_0x2928f3(_0xb079ad['result']['message']);}})['catch'](function(_0x4d03fe){logger[_0xc8a9('0xf')](_0xc8a9('0x12'),_0x1d49c8,_0x4d03fe);_0x241eae(_0x4d03fe);});});}exports['GetCampaign']=function(_0x43f403){var _0x2d894e=this;return new Promise(function(_0x35bd4a,_0x20b70d){return db[_0xc8a9('0x13')][_0xc8a9('0x14')]({'raw':_0x43f403[_0xc8a9('0x15')]?_0x43f403[_0xc8a9('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x43f403[_0xc8a9('0x15')]?_0x43f403[_0xc8a9('0x15')][_0xc8a9('0x16')]||null:null,'attributes':_0x43f403[_0xc8a9('0x15')]?_0x43f403[_0xc8a9('0x15')][_0xc8a9('0x17')]||null:null,'limit':_0x43f403[_0xc8a9('0x15')]?_0x43f403[_0xc8a9('0x15')][_0xc8a9('0x18')]||null:null,'include':_0x43f403['options']?_0x43f403[_0xc8a9('0x15')][_0xc8a9('0x19')]?_[_0xc8a9('0x1a')](_0x43f403['options'][_0xc8a9('0x19')],function(_0x1dad26){return{'model':db[_0x1dad26['model']],'as':_0x1dad26['as'],'attributes':_0x1dad26[_0xc8a9('0x17')],'include':_0x1dad26[_0xc8a9('0x19')]?_['map'](_0x1dad26[_0xc8a9('0x19')],function(_0x19f42e){return{'model':db[_0x19f42e[_0xc8a9('0x1b')]],'as':_0x19f42e['as'],'attributes':_0x19f42e[_0xc8a9('0x17')],'include':_0x19f42e[_0xc8a9('0x19')]?_['map'](_0x19f42e[_0xc8a9('0x19')],function(_0x17f08c){return{'model':db[_0x17f08c[_0xc8a9('0x1b')]],'as':_0x17f08c['as'],'attributes':_0x17f08c[_0xc8a9('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x25aa4d){logger[_0xc8a9('0x11')](_0xc8a9('0x1c'),_0x43f403);logger['debug'](_0xc8a9('0x1c'),_0x43f403,JSON[_0xc8a9('0x1d')](_0x25aa4d));_0x35bd4a(_0x25aa4d);})[_0xc8a9('0x1e')](function(_0x411e23){logger[_0xc8a9('0xf')](_0xc8a9('0x1c'),_0x411e23[_0xc8a9('0x10')],_0x43f403);_0x20b70d(_0x2d894e[_0xc8a9('0xf')](0x1f4,_0x411e23[_0xc8a9('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 46bec3c..8844bcc 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 _0x02c5=['connect-timeout','fs-extra','./campaign.controller','/:id','isAuthenticated','get','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','create','post','clone','addLists','addBlackLists','put','update','delete','destroy','removeBlackLists','exports','multer','util'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x02c5,0x178));var _0x502c=function(_0x458656,_0x4292d8){_0x458656=_0x458656-0x0;var _0x24e475=_0x02c5[_0x458656];return _0x24e475;};'use strict';var multer=require(_0x502c('0x0'));var util=require(_0x502c('0x1'));var path=require('path');var timeout=require(_0x502c('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x502c('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x502c('0x4'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x502c('0x5'),auth[_0x502c('0x6')](),controller['show']);router[_0x502c('0x7')](_0x502c('0x8'),auth[_0x502c('0x6')](),controller[_0x502c('0x9')]);router[_0x502c('0x7')]('/:id/hopper_histories',auth[_0x502c('0x6')](),controller[_0x502c('0xa')]);router[_0x502c('0x7')](_0x502c('0xb'),auth[_0x502c('0x6')](),controller['getHopperFinals']);router['get']('/:id/hopper_black',auth[_0x502c('0x6')](),controller[_0x502c('0xc')]);router[_0x502c('0x7')](_0x502c('0xd'),auth[_0x502c('0x6')](),controller[_0x502c('0xe')]);router[_0x502c('0x7')](_0x502c('0xf'),auth['isAuthenticated'](),controller['getBlackLists']);router['post']('/',auth[_0x502c('0x6')](),controller[_0x502c('0x10')]);router[_0x502c('0x11')]('/:id/clone',auth['isAuthenticated'](),controller[_0x502c('0x12')]);router[_0x502c('0x11')](_0x502c('0xd'),auth[_0x502c('0x6')](),controller[_0x502c('0x13')]);router['post'](_0x502c('0xf'),auth[_0x502c('0x6')](),controller[_0x502c('0x14')]);router[_0x502c('0x15')](_0x502c('0x5'),auth[_0x502c('0x6')](),controller[_0x502c('0x16')]);router[_0x502c('0x17')](_0x502c('0x5'),auth['isAuthenticated'](),controller[_0x502c('0x18')]);router['delete']('/:id/lists',auth[_0x502c('0x6')](),controller['removeLists']);router['delete'](_0x502c('0xf'),auth['isAuthenticated'](),controller[_0x502c('0x19')]);module[_0x502c('0x1a')]=router; \ No newline at end of file +var _0x93fa=['/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','/:id/lists','getLists','post','/:id/clone','addLists','/:id/blacklists','addBlackLists','put','update','delete','destroy','removeLists','removeBlackLists','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers'];(function(_0x12b8ec,_0x1655be){var _0x21af77=function(_0xe59f){while(--_0xe59f){_0x12b8ec['push'](_0x12b8ec['shift']());}};_0x21af77(++_0x1655be);}(_0x93fa,0x17b));var _0xa93f=function(_0x180391,_0x55d9ff){_0x180391=_0x180391-0x0;var _0x4ded40=_0x93fa[_0x180391];return _0x4ded40;};'use strict';var multer=require(_0xa93f('0x0'));var util=require('util');var path=require(_0xa93f('0x1'));var timeout=require(_0xa93f('0x2'));var express=require(_0xa93f('0x3'));var router=express[_0xa93f('0x4')]();var fs_extra=require(_0xa93f('0x5'));var auth=require(_0xa93f('0x6'));var interaction=require(_0xa93f('0x7'));var config=require(_0xa93f('0x8'));var controller=require(_0xa93f('0x9'));router[_0xa93f('0xa')]('/',auth[_0xa93f('0xb')](),controller[_0xa93f('0xc')]);router[_0xa93f('0xa')](_0xa93f('0xd'),auth['isAuthenticated'](),controller[_0xa93f('0xe')]);router[_0xa93f('0xa')](_0xa93f('0xf'),auth['isAuthenticated'](),controller[_0xa93f('0x10')]);router[_0xa93f('0xa')](_0xa93f('0x11'),auth[_0xa93f('0xb')](),controller[_0xa93f('0x12')]);router[_0xa93f('0xa')](_0xa93f('0x13'),auth[_0xa93f('0xb')](),controller[_0xa93f('0x14')]);router[_0xa93f('0xa')](_0xa93f('0x15'),auth[_0xa93f('0xb')](),controller['getHopperBlacks']);router[_0xa93f('0xa')](_0xa93f('0x16'),auth[_0xa93f('0xb')](),controller[_0xa93f('0x17')]);router[_0xa93f('0xa')]('/:id/blacklists',auth[_0xa93f('0xb')](),controller['getBlackLists']);router[_0xa93f('0x18')]('/',auth[_0xa93f('0xb')](),controller['create']);router[_0xa93f('0x18')](_0xa93f('0x19'),auth[_0xa93f('0xb')](),controller['clone']);router[_0xa93f('0x18')](_0xa93f('0x16'),auth['isAuthenticated'](),controller[_0xa93f('0x1a')]);router[_0xa93f('0x18')](_0xa93f('0x1b'),auth[_0xa93f('0xb')](),controller[_0xa93f('0x1c')]);router[_0xa93f('0x1d')](_0xa93f('0xd'),auth[_0xa93f('0xb')](),controller[_0xa93f('0x1e')]);router[_0xa93f('0x1f')](_0xa93f('0xd'),auth[_0xa93f('0xb')](),controller[_0xa93f('0x20')]);router[_0xa93f('0x1f')](_0xa93f('0x16'),auth[_0xa93f('0xb')](),controller[_0xa93f('0x21')]);router[_0xa93f('0x1f')]('/:id/blacklists',auth[_0xa93f('0xb')](),controller[_0xa93f('0x22')]);module[_0xa93f('0x23')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 4ce1b81..7022226 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 _0x57f6=['TEXT','VIRTUAL','getDataValue','key','exports','STRING'];(function(_0x3a7fa5,_0x515894){var _0x50319a=function(_0x249631){while(--_0x249631){_0x3a7fa5['push'](_0x3a7fa5['shift']());}};_0x50319a(++_0x515894);}(_0x57f6,0x1e4));var _0x657f=function(_0x350a01,_0x5ed763){_0x350a01=_0x350a01-0x0;var _0xc17c6b=_0x57f6[_0x350a01];return _0xc17c6b;};'use strict';var Sequelize=require('sequelize');module[_0x657f('0x0')]={'key':{'type':Sequelize[_0x657f('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x657f('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x657f('0x1')]},'name':{'type':Sequelize[_0x657f('0x3')],'get':function(){return this[_0x657f('0x4')](_0x657f('0x5'));}}}; \ No newline at end of file +var _0x3ba8=['STRING','getDataValue','key','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3ba8,0xbc));var _0x83ba=function(_0x341645,_0x408ce0){_0x341645=_0x341645-0x0;var _0x6d5d41=_0x3ba8[_0x341645];return _0x6d5d41;};'use strict';var Sequelize=require(_0x83ba('0x0'));module[_0x83ba('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x83ba('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x83ba('0x3')](_0x83ba('0x4'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 6a00c9f..95b5933 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 _0x3b0e=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','destroy','then','CannedAnswers','error','stack','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','merge','where','filter','include','findAll','catch','show','keys','length','options','find','body','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','api','../../config/environment'];(function(_0x59c14b,_0x1dbdae){var _0x17a621=function(_0x1d51d7){while(--_0x1d51d7){_0x59c14b['push'](_0x59c14b['shift']());}};_0x17a621(++_0x1dbdae);}(_0x3b0e,0xf7));var _0xe3b0=function(_0x35e9e4,_0x54e65c){_0x35e9e4=_0x35e9e4-0x0;var _0x17a7dd=_0x3b0e[_0x35e9e4];return _0x17a7dd;};'use strict';var emlformat=require(_0xe3b0('0x0'));var rimraf=require(_0xe3b0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe3b0('0x2'));var rp=require(_0xe3b0('0x3'));var moment=require(_0xe3b0('0x4'));var BPromise=require(_0xe3b0('0x5'));var Mustache=require('mustache');var util=require(_0xe3b0('0x6'));var path=require(_0xe3b0('0x7'));var sox=require(_0xe3b0('0x8'));var csv=require('to-csv');var ejs=require(_0xe3b0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe3b0('0xa'));var squel=require(_0xe3b0('0xb'));var crypto=require(_0xe3b0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe3b0('0xd'));var toCsv=require(_0xe3b0('0xe'));var querystring=require('querystring');var Papa=require(_0xe3b0('0xf'));var Redis=require(_0xe3b0('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xe3b0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe3b0('0x12'));var utils=require('../../config/utils');var config=require(_0xe3b0('0x13'));var licenseUtil=require(_0xe3b0('0x14'));var db=require(_0xe3b0('0x15'))['db'];function respondWithStatusCode(_0x1be7e9,_0x38324c){_0x38324c=_0x38324c||0xcc;return function(_0x36617d){if(_0x36617d){return _0x1be7e9[_0xe3b0('0x16')](_0x38324c);}return _0x1be7e9[_0xe3b0('0x17')](_0x38324c)[_0xe3b0('0x18')]();};}function respondWithResult(_0x5de727,_0x49876d){_0x49876d=_0x49876d||0xc8;return function(_0x525d0f){if(_0x525d0f){return _0x5de727[_0xe3b0('0x17')](_0x49876d)[_0xe3b0('0x19')](_0x525d0f);}};}function respondWithFilteredResult(_0x293ef0,_0x140903){return function(_0x2b488f){if(_0x2b488f){var _0x337006=typeof _0x140903[_0xe3b0('0x1a')]==='undefined'&&typeof _0x140903[_0xe3b0('0x1b')]===_0xe3b0('0x1c');var _0x10da63=_0x2b488f[_0xe3b0('0x1d')];var _0x139383=_0x337006?0x0:_0x140903[_0xe3b0('0x1a')];var _0x587e83=_0x337006?_0x2b488f[_0xe3b0('0x1d')]:_0x140903[_0xe3b0('0x1a')]+_0x140903[_0xe3b0('0x1b')];var _0xac4db7;if(_0x587e83>=_0x10da63){_0x587e83=_0x10da63;_0xac4db7=0xc8;}else{_0xac4db7=0xce;}_0x293ef0[_0xe3b0('0x17')](_0xac4db7);return _0x293ef0[_0xe3b0('0x1e')](_0xe3b0('0x1f'),_0x139383+'-'+_0x587e83+'/'+_0x10da63)[_0xe3b0('0x19')](_0x2b488f);}return null;};}function patchUpdates(_0x54a9ad){return function(_0x5310f9){try{jsonpatch[_0xe3b0('0x20')](_0x5310f9,_0x54a9ad,!![]);}catch(_0x369956){return BPromise['reject'](_0x369956);}return _0x5310f9[_0xe3b0('0x21')]();};}function saveUpdates(_0x25c8ac,_0x449212){return function(_0x2205a5){if(_0x2205a5){return _0x2205a5[_0xe3b0('0x22')](_0x25c8ac)['then'](function(_0x150fc7){return _0x150fc7;});}return null;};}function removeEntity(_0x4688f3,_0x46fafa){return function(_0x4c1503){if(_0x4c1503){return _0x4c1503[_0xe3b0('0x23')]()[_0xe3b0('0x24')](function(){var _0x3c089b=_0x4c1503['get']({'plain':!![]});var _0xf1ad6c=_0xe3b0('0x25');return db['UserProfileResource'][_0xe3b0('0x23')]({'where':{'type':_0xf1ad6c,'resourceId':_0x3c089b['id']}})[_0xe3b0('0x24')](function(){return _0x4c1503;});})[_0xe3b0('0x24')](function(){_0x4688f3['status'](0xcc)[_0xe3b0('0x18')]();});}};}function handleEntityNotFound(_0x6c1837,_0x31dfd8){return function(_0x22b6e4){if(!_0x22b6e4){_0x6c1837['sendStatus'](0x194);}return _0x22b6e4;};}function handleError(_0x32bcae,_0x4bdf78){_0x4bdf78=_0x4bdf78||0x1f4;return function(_0x2660e2){logger[_0xe3b0('0x26')](_0x2660e2[_0xe3b0('0x27')]);if(_0x2660e2[_0xe3b0('0x28')]){delete _0x2660e2[_0xe3b0('0x28')];}_0x32bcae[_0xe3b0('0x17')](_0x4bdf78)[_0xe3b0('0x29')](_0x2660e2);};}exports[_0xe3b0('0x2a')]=function(_0x551987,_0x127da6){var _0x17d3ec={},_0x2aa006={},_0x5c6455={'count':0x0,'rows':[]};var _0x3c9324=_[_0xe3b0('0x2b')](db[_0xe3b0('0x2c')][_0xe3b0('0x2d')],function(_0x4a8f16){return{'name':_0x4a8f16[_0xe3b0('0x2e')],'type':_0x4a8f16[_0xe3b0('0x2f')][_0xe3b0('0x30')]};});_0x2aa006[_0xe3b0('0x31')]=_[_0xe3b0('0x2b')](_0x3c9324,_0xe3b0('0x28'));_0x2aa006[_0xe3b0('0x32')]=_['keys'](_0x551987[_0xe3b0('0x32')]);_0x2aa006[_0xe3b0('0x33')]=_[_0xe3b0('0x34')](_0x2aa006[_0xe3b0('0x31')],_0x2aa006[_0xe3b0('0x32')]);_0x17d3ec[_0xe3b0('0x35')]=_['intersection'](_0x2aa006[_0xe3b0('0x31')],qs['fields'](_0x551987[_0xe3b0('0x32')][_0xe3b0('0x36')]));_0x17d3ec[_0xe3b0('0x35')]=_0x17d3ec[_0xe3b0('0x35')]['length']?_0x17d3ec[_0xe3b0('0x35')]:_0x2aa006[_0xe3b0('0x31')];if(!_0x551987['query'][_0xe3b0('0x37')](_0xe3b0('0x38'))){_0x17d3ec[_0xe3b0('0x1b')]=qs[_0xe3b0('0x1b')](_0x551987['query'][_0xe3b0('0x1b')]);_0x17d3ec[_0xe3b0('0x1a')]=qs[_0xe3b0('0x1a')](_0x551987[_0xe3b0('0x32')][_0xe3b0('0x1a')]);}_0x17d3ec[_0xe3b0('0x39')]=qs[_0xe3b0('0x3a')](_0x551987['query'][_0xe3b0('0x3a')]);_0x17d3ec['where']=qs[_0xe3b0('0x33')](_[_0xe3b0('0x3b')](_0x551987[_0xe3b0('0x32')],_0x2aa006[_0xe3b0('0x33')]),_0x3c9324);if(_0x551987[_0xe3b0('0x32')]['filter']){_0x17d3ec['where']=_[_0xe3b0('0x3c')](_0x17d3ec[_0xe3b0('0x3d')],{'$or':[{'key':{'$like':'%'+_0x551987['query']['filter']+'%'}},{'value':{'$like':'%'+_0x551987['query'][_0xe3b0('0x3e')]+'%'}}]});}_0x17d3ec=_[_0xe3b0('0x3c')]({},_0x17d3ec,_0x551987['options']);var _0x274039={'where':_0x17d3ec['where']};return db[_0xe3b0('0x2c')][_0xe3b0('0x1d')](_0x274039)[_0xe3b0('0x24')](function(_0x47095d){_0x5c6455[_0xe3b0('0x1d')]=_0x47095d;if(_0x551987[_0xe3b0('0x32')]['includeAll']){_0x17d3ec[_0xe3b0('0x3f')]=[{'all':!![]}];}return db[_0xe3b0('0x2c')][_0xe3b0('0x40')](_0x17d3ec);})[_0xe3b0('0x24')](function(_0x2f1314){_0x5c6455['rows']=_0x2f1314;return _0x5c6455;})[_0xe3b0('0x24')](respondWithFilteredResult(_0x127da6,_0x17d3ec))[_0xe3b0('0x41')](handleError(_0x127da6,null));};exports[_0xe3b0('0x42')]=function(_0x238836,_0x53cb05){var _0x389310={'raw':!![],'where':{'id':_0x238836['params']['id']}},_0x4892c4={};_0x4892c4['model']=_[_0xe3b0('0x43')](db[_0xe3b0('0x2c')][_0xe3b0('0x2d')]);_0x4892c4[_0xe3b0('0x32')]=_[_0xe3b0('0x43')](_0x238836['query']);_0x4892c4[_0xe3b0('0x33')]=_['intersection'](_0x4892c4[_0xe3b0('0x31')],_0x4892c4[_0xe3b0('0x32')]);_0x389310['attributes']=_[_0xe3b0('0x34')](_0x4892c4[_0xe3b0('0x31')],qs[_0xe3b0('0x36')](_0x238836[_0xe3b0('0x32')][_0xe3b0('0x36')]));_0x389310[_0xe3b0('0x35')]=_0x389310['attributes'][_0xe3b0('0x44')]?_0x389310['attributes']:_0x4892c4[_0xe3b0('0x31')];if(_0x238836[_0xe3b0('0x32')]['includeAll']){_0x389310['include']=[{'all':!![]}];}_0x389310=_[_0xe3b0('0x3c')]({},_0x389310,_0x238836[_0xe3b0('0x45')]);return db[_0xe3b0('0x2c')][_0xe3b0('0x46')](_0x389310)['then'](handleEntityNotFound(_0x53cb05,null))[_0xe3b0('0x24')](respondWithResult(_0x53cb05,null))[_0xe3b0('0x41')](handleError(_0x53cb05,null));};exports[_0xe3b0('0x22')]=function(_0x335006,_0x52ba48){if(_0x335006[_0xe3b0('0x47')]['id']){delete _0x335006['body']['id'];}return db['CannedAnswer']['find']({'where':{'id':_0x335006['params']['id']}})[_0xe3b0('0x24')](handleEntityNotFound(_0x52ba48,null))[_0xe3b0('0x24')](saveUpdates(_0x335006['body'],null))[_0xe3b0('0x24')](respondWithResult(_0x52ba48,null))[_0xe3b0('0x41')](handleError(_0x52ba48,null));};exports[_0xe3b0('0x23')]=function(_0xe4ee3b,_0x1595ab){return db[_0xe3b0('0x2c')][_0xe3b0('0x46')]({'where':{'id':_0xe4ee3b[_0xe3b0('0x48')]['id']}})[_0xe3b0('0x24')](handleEntityNotFound(_0x1595ab,null))[_0xe3b0('0x24')](removeEntity(_0x1595ab,null))[_0xe3b0('0x41')](handleError(_0x1595ab,null));};exports[_0xe3b0('0x49')]=function(_0x5b1a4d,_0x576a69){var _0x178f1f={'key':_0x5b1a4d['body'][_0xe3b0('0x30')]};if(_0x5b1a4d['body'][_0xe3b0('0x4a')]){_0x178f1f[_0xe3b0('0x4a')]=_0x5b1a4d['body']['MailAccountId'];}else if(_0x5b1a4d[_0xe3b0('0x47')][_0xe3b0('0x4b')]){_0x178f1f['SmsAccountId']=_0x5b1a4d[_0xe3b0('0x47')][_0xe3b0('0x4b')];}else if(_0x5b1a4d[_0xe3b0('0x47')]['OpenchannelAccountId']){_0x178f1f[_0xe3b0('0x4c')]=_0x5b1a4d[_0xe3b0('0x47')][_0xe3b0('0x4c')];}else if(_0x5b1a4d[_0xe3b0('0x47')]['ChatWebsiteId']){_0x178f1f[_0xe3b0('0x4d')]=_0x5b1a4d[_0xe3b0('0x47')][_0xe3b0('0x4d')];}return db[_0xe3b0('0x2c')][_0xe3b0('0x46')]({'where':_0x178f1f})[_0xe3b0('0x24')](function(_0x166623){if(_0x166623){throw new db[(_0xe3b0('0x4e'))][(_0xe3b0('0x4f'))](_0xe3b0('0x50'));}return db[_0xe3b0('0x2c')][_0xe3b0('0x49')](_0x5b1a4d['body']);})[_0xe3b0('0x24')](function(_0x52b3c0){var _0x7ada84=_0x5b1a4d[_0xe3b0('0x51')]['get']({'plain':!![]});if(!_0x7ada84)throw new Error(_0xe3b0('0x52'));if(_0x7ada84[_0xe3b0('0x53')]==='user'){var _0x35419c=_0x52b3c0[_0xe3b0('0x54')]({'plain':!![]});return db[_0xe3b0('0x55')][_0xe3b0('0x46')]({'where':{'name':_0xe3b0('0x25'),'userProfileId':_0x7ada84[_0xe3b0('0x56')]},'raw':!![]})[_0xe3b0('0x24')](function(_0x371425){if(_0x371425&&_0x371425[_0xe3b0('0x57')]===0x0){return db[_0xe3b0('0x58')]['create']({'name':_0x35419c[_0xe3b0('0x28')],'resourceId':_0x35419c['id'],'type':_0x371425['name'],'sectionId':_0x371425['id']},{})[_0xe3b0('0x24')](function(){return _0x52b3c0;});}else{return _0x52b3c0;}})[_0xe3b0('0x41')](function(_0xbd8ddc){logger[_0xe3b0('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xbd8ddc);throw _0xbd8ddc;});}return _0x52b3c0;})['then'](respondWithResult(_0x576a69,0xc9))[_0xe3b0('0x41')](handleError(_0x576a69,null));}; \ No newline at end of file +var _0x2415=['create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','update','then','get','CannedAnswers','UserProfileResource','error','stack','name','send','index','map','CannedAnswer','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','findAll','rows','catch','show','params','includeAll','include','find','body'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x2415,0x1bb));var _0x5241=function(_0x4a0d48,_0x4016b3){_0x4a0d48=_0x4a0d48-0x0;var _0x2abde2=_0x2415[_0x4a0d48];return _0x2abde2;};'use strict';var emlformat=require(_0x5241('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5241('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5241('0x2'));var moment=require(_0x5241('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5241('0x4'));var path=require('path');var sox=require(_0x5241('0x5'));var csv=require(_0x5241('0x6'));var ejs=require(_0x5241('0x7'));var fs=require('fs');var fs_extra=require(_0x5241('0x8'));var _=require(_0x5241('0x9'));var squel=require(_0x5241('0xa'));var crypto=require(_0x5241('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5241('0xc'));var toCsv=require(_0x5241('0x6'));var querystring=require(_0x5241('0xd'));var Papa=require(_0x5241('0xe'));var Redis=require('ioredis');var authService=require(_0x5241('0xf'));var qs=require(_0x5241('0x10'));var as=require(_0x5241('0x11'));var hardwareService=require(_0x5241('0x12'));var logger=require('../../config/logger')(_0x5241('0x13'));var utils=require('../../config/utils');var config=require(_0x5241('0x14'));var licenseUtil=require(_0x5241('0x15'));var db=require(_0x5241('0x16'))['db'];function respondWithStatusCode(_0x29e537,_0x29d59a){_0x29d59a=_0x29d59a||0xcc;return function(_0x2bb8d1){if(_0x2bb8d1){return _0x29e537[_0x5241('0x17')](_0x29d59a);}return _0x29e537['status'](_0x29d59a)[_0x5241('0x18')]();};}function respondWithResult(_0x253352,_0x16777b){_0x16777b=_0x16777b||0xc8;return function(_0x4a12ac){if(_0x4a12ac){return _0x253352['status'](_0x16777b)[_0x5241('0x19')](_0x4a12ac);}};}function respondWithFilteredResult(_0x212302,_0x18c71a){return function(_0x5dfc18){if(_0x5dfc18){var _0x4b7255=typeof _0x18c71a[_0x5241('0x1a')]===_0x5241('0x1b')&&typeof _0x18c71a[_0x5241('0x1c')]===_0x5241('0x1b');var _0x108dcd=_0x5dfc18['count'];var _0xaf9c83=_0x4b7255?0x0:_0x18c71a[_0x5241('0x1a')];var _0x567940=_0x4b7255?_0x5dfc18[_0x5241('0x1d')]:_0x18c71a['offset']+_0x18c71a[_0x5241('0x1c')];var _0x5124e5;if(_0x567940>=_0x108dcd){_0x567940=_0x108dcd;_0x5124e5=0xc8;}else{_0x5124e5=0xce;}_0x212302[_0x5241('0x1e')](_0x5124e5);return _0x212302['set'](_0x5241('0x1f'),_0xaf9c83+'-'+_0x567940+'/'+_0x108dcd)['json'](_0x5dfc18);}return null;};}function patchUpdates(_0x5c1e85){return function(_0x424393){try{jsonpatch[_0x5241('0x20')](_0x424393,_0x5c1e85,!![]);}catch(_0x3b98f9){return BPromise[_0x5241('0x21')](_0x3b98f9);}return _0x424393[_0x5241('0x22')]();};}function saveUpdates(_0x46e290,_0x2d54a8){return function(_0x1cbd44){if(_0x1cbd44){return _0x1cbd44[_0x5241('0x23')](_0x46e290)[_0x5241('0x24')](function(_0x39e80b){return _0x39e80b;});}return null;};}function removeEntity(_0x2202d7,_0x14802d){return function(_0x5297a9){if(_0x5297a9){return _0x5297a9['destroy']()[_0x5241('0x24')](function(){var _0x388e41=_0x5297a9[_0x5241('0x25')]({'plain':!![]});var _0x5a67cd=_0x5241('0x26');return db[_0x5241('0x27')]['destroy']({'where':{'type':_0x5a67cd,'resourceId':_0x388e41['id']}})[_0x5241('0x24')](function(){return _0x5297a9;});})[_0x5241('0x24')](function(){_0x2202d7[_0x5241('0x1e')](0xcc)[_0x5241('0x18')]();});}};}function handleEntityNotFound(_0xf26cbf,_0x2298fb){return function(_0x6b0b1c){if(!_0x6b0b1c){_0xf26cbf[_0x5241('0x17')](0x194);}return _0x6b0b1c;};}function handleError(_0x35b8fa,_0x19078e){_0x19078e=_0x19078e||0x1f4;return function(_0x1d62ae){logger[_0x5241('0x28')](_0x1d62ae[_0x5241('0x29')]);if(_0x1d62ae['name']){delete _0x1d62ae[_0x5241('0x2a')];}_0x35b8fa[_0x5241('0x1e')](_0x19078e)[_0x5241('0x2b')](_0x1d62ae);};}exports[_0x5241('0x2c')]=function(_0x596137,_0xf99a08){var _0x2247ea={},_0x179bbb={},_0xc85e50={'count':0x0,'rows':[]};var _0x2e8328=_[_0x5241('0x2d')](db[_0x5241('0x2e')][_0x5241('0x2f')],function(_0x5dba31){return{'name':_0x5dba31['fieldName'],'type':_0x5dba31['type']['key']};});_0x179bbb[_0x5241('0x30')]=_[_0x5241('0x2d')](_0x2e8328,_0x5241('0x2a'));_0x179bbb[_0x5241('0x31')]=_[_0x5241('0x32')](_0x596137[_0x5241('0x31')]);_0x179bbb[_0x5241('0x33')]=_[_0x5241('0x34')](_0x179bbb[_0x5241('0x30')],_0x179bbb[_0x5241('0x31')]);_0x2247ea[_0x5241('0x35')]=_[_0x5241('0x34')](_0x179bbb['model'],qs[_0x5241('0x36')](_0x596137[_0x5241('0x31')]['fields']));_0x2247ea[_0x5241('0x35')]=_0x2247ea[_0x5241('0x35')][_0x5241('0x37')]?_0x2247ea[_0x5241('0x35')]:_0x179bbb['model'];if(!_0x596137['query'][_0x5241('0x38')](_0x5241('0x39'))){_0x2247ea[_0x5241('0x1c')]=qs['limit'](_0x596137[_0x5241('0x31')][_0x5241('0x1c')]);_0x2247ea['offset']=qs[_0x5241('0x1a')](_0x596137[_0x5241('0x31')][_0x5241('0x1a')]);}_0x2247ea['order']=qs[_0x5241('0x3a')](_0x596137[_0x5241('0x31')][_0x5241('0x3a')]);_0x2247ea[_0x5241('0x3b')]=qs[_0x5241('0x33')](_[_0x5241('0x3c')](_0x596137['query'],_0x179bbb['filters']),_0x2e8328);if(_0x596137[_0x5241('0x31')][_0x5241('0x3d')]){_0x2247ea[_0x5241('0x3b')]=_[_0x5241('0x3e')](_0x2247ea[_0x5241('0x3b')],{'$or':[{'key':{'$like':'%'+_0x596137[_0x5241('0x31')][_0x5241('0x3d')]+'%'}},{'value':{'$like':'%'+_0x596137[_0x5241('0x31')]['filter']+'%'}}]});}_0x2247ea=_[_0x5241('0x3e')]({},_0x2247ea,_0x596137[_0x5241('0x3f')]);var _0x62723f={'where':_0x2247ea['where']};return db['CannedAnswer'][_0x5241('0x1d')](_0x62723f)['then'](function(_0x2a49cd){_0xc85e50[_0x5241('0x1d')]=_0x2a49cd;if(_0x596137[_0x5241('0x31')]['includeAll']){_0x2247ea['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x5241('0x40')](_0x2247ea);})[_0x5241('0x24')](function(_0x4be80c){_0xc85e50[_0x5241('0x41')]=_0x4be80c;return _0xc85e50;})['then'](respondWithFilteredResult(_0xf99a08,_0x2247ea))[_0x5241('0x42')](handleError(_0xf99a08,null));};exports[_0x5241('0x43')]=function(_0x58d1ff,_0x4c2271){var _0x207b8b={'raw':!![],'where':{'id':_0x58d1ff[_0x5241('0x44')]['id']}},_0xc6242c={};_0xc6242c[_0x5241('0x30')]=_['keys'](db[_0x5241('0x2e')][_0x5241('0x2f')]);_0xc6242c[_0x5241('0x31')]=_[_0x5241('0x32')](_0x58d1ff[_0x5241('0x31')]);_0xc6242c['filters']=_[_0x5241('0x34')](_0xc6242c[_0x5241('0x30')],_0xc6242c[_0x5241('0x31')]);_0x207b8b[_0x5241('0x35')]=_['intersection'](_0xc6242c['model'],qs[_0x5241('0x36')](_0x58d1ff['query'][_0x5241('0x36')]));_0x207b8b[_0x5241('0x35')]=_0x207b8b[_0x5241('0x35')]['length']?_0x207b8b[_0x5241('0x35')]:_0xc6242c['model'];if(_0x58d1ff['query'][_0x5241('0x45')]){_0x207b8b[_0x5241('0x46')]=[{'all':!![]}];}_0x207b8b=_['merge']({},_0x207b8b,_0x58d1ff[_0x5241('0x3f')]);return db[_0x5241('0x2e')][_0x5241('0x47')](_0x207b8b)[_0x5241('0x24')](handleEntityNotFound(_0x4c2271,null))['then'](respondWithResult(_0x4c2271,null))[_0x5241('0x42')](handleError(_0x4c2271,null));};exports[_0x5241('0x23')]=function(_0x4fa31e,_0x336656){if(_0x4fa31e[_0x5241('0x48')]['id']){delete _0x4fa31e[_0x5241('0x48')]['id'];}return db['CannedAnswer'][_0x5241('0x47')]({'where':{'id':_0x4fa31e[_0x5241('0x44')]['id']}})[_0x5241('0x24')](handleEntityNotFound(_0x336656,null))[_0x5241('0x24')](saveUpdates(_0x4fa31e[_0x5241('0x48')],null))[_0x5241('0x24')](respondWithResult(_0x336656,null))[_0x5241('0x42')](handleError(_0x336656,null));};exports['destroy']=function(_0x2616a9,_0x16d5bf){return db[_0x5241('0x2e')][_0x5241('0x47')]({'where':{'id':_0x2616a9['params']['id']}})['then'](handleEntityNotFound(_0x16d5bf,null))[_0x5241('0x24')](removeEntity(_0x16d5bf,null))[_0x5241('0x42')](handleError(_0x16d5bf,null));};exports[_0x5241('0x49')]=function(_0x1c4e51,_0x3e3cf4){var _0x5cdc07={'key':_0x1c4e51[_0x5241('0x48')]['key']};if(_0x1c4e51[_0x5241('0x48')]['MailAccountId']){_0x5cdc07[_0x5241('0x4a')]=_0x1c4e51[_0x5241('0x48')]['MailAccountId'];}else if(_0x1c4e51[_0x5241('0x48')][_0x5241('0x4b')]){_0x5cdc07[_0x5241('0x4b')]=_0x1c4e51[_0x5241('0x48')][_0x5241('0x4b')];}else if(_0x1c4e51['body'][_0x5241('0x4c')]){_0x5cdc07[_0x5241('0x4c')]=_0x1c4e51[_0x5241('0x48')][_0x5241('0x4c')];}else if(_0x1c4e51[_0x5241('0x48')][_0x5241('0x4d')]){_0x5cdc07['ChatWebsiteId']=_0x1c4e51['body'][_0x5241('0x4d')];}return db[_0x5241('0x2e')][_0x5241('0x47')]({'where':_0x5cdc07})[_0x5241('0x24')](function(_0x14343c){if(_0x14343c){throw new db['Sequelize'][(_0x5241('0x4e'))](_0x5241('0x4f'));}return db['CannedAnswer']['create'](_0x1c4e51[_0x5241('0x48')]);})[_0x5241('0x24')](function(_0x2fa59a){var _0x236d77=_0x1c4e51['user']['get']({'plain':!![]});if(!_0x236d77)throw new Error(_0x5241('0x50'));if(_0x236d77[_0x5241('0x51')]===_0x5241('0x52')){var _0x1d1643=_0x2fa59a[_0x5241('0x25')]({'plain':!![]});return db[_0x5241('0x53')]['find']({'where':{'name':_0x5241('0x26'),'userProfileId':_0x236d77[_0x5241('0x54')]},'raw':!![]})[_0x5241('0x24')](function(_0x14c63b){if(_0x14c63b&&_0x14c63b['autoAssociation']===0x0){return db[_0x5241('0x27')][_0x5241('0x49')]({'name':_0x1d1643[_0x5241('0x2a')],'resourceId':_0x1d1643['id'],'type':_0x14c63b[_0x5241('0x2a')],'sectionId':_0x14c63b['id']},{})[_0x5241('0x24')](function(){return _0x2fa59a;});}else{return _0x2fa59a;}})[_0x5241('0x42')](function(_0x4da32c){logger['error'](_0x5241('0x55'),_0x4da32c);throw _0x4da32c;});}return _0x2fa59a;})['then'](respondWithResult(_0x3e3cf4,0xc9))[_0x5241('0x42')](handleError(_0x3e3cf4,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 159e275..ea253dc 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 _0x5330=['rimraf','../../config/environment','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x589dad,_0x171fb4){var _0x369e10=function(_0x5a5b94){while(--_0x5a5b94){_0x589dad['push'](_0x589dad['shift']());}};_0x369e10(++_0x171fb4);}(_0x5330,0xe4));var _0x0533=function(_0xa1d4e4,_0x40d04b){_0xa1d4e4=_0xa1d4e4-0x0;var _0x49d602=_0x5330[_0xa1d4e4];return _0x49d602;};'use strict';var _=require(_0x0533('0x0'));var util=require('util');var logger=require(_0x0533('0x1'))(_0x0533('0x2'));var moment=require(_0x0533('0x3'));var BPromise=require(_0x0533('0x4'));var rp=require(_0x0533('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0533('0x6'));var config=require(_0x0533('0x7'));var attributes=require('./cannedAnswer.attributes');module['exports']=function(_0x1317ec,_0x18e5b3){return _0x1317ec[_0x0533('0x8')](_0x0533('0x9'),attributes,{'tableName':_0x0533('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0533('0xb'),'collate':_0x0533('0xc')});}; \ No newline at end of file +var _0x18d8=['rimraf','../../config/environment','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x17f03f,_0xf8510e){var _0x51efbb=function(_0x394384){while(--_0x394384){_0x17f03f['push'](_0x17f03f['shift']());}};_0x51efbb(++_0xf8510e);}(_0x18d8,0xa1));var _0x818d=function(_0x58422c,_0x55903e){_0x58422c=_0x58422c-0x0;var _0x4f4554=_0x18d8[_0x58422c];return _0x4f4554;};'use strict';var _=require(_0x818d('0x0'));var util=require(_0x818d('0x1'));var logger=require('../../config/logger')(_0x818d('0x2'));var moment=require(_0x818d('0x3'));var BPromise=require(_0x818d('0x4'));var rp=require(_0x818d('0x5'));var fs=require('fs');var path=require(_0x818d('0x6'));var rimraf=require(_0x818d('0x7'));var config=require(_0x818d('0x8'));var attributes=require('./cannedAnswer.attributes');module['exports']=function(_0x2a6e55,_0x1bbb8f){return _0x2a6e55[_0x818d('0x9')](_0x818d('0xa'),attributes,{'tableName':_0x818d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x818d('0xc'),'collate':_0x818d('0xd')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 7cd09d0..386dc27 100644 --- a/server/api/cannedAnswer/cannedAnswer.rpc.js +++ b/server/api/cannedAnswer/cannedAnswer.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x58cf54,_0x5b78e1){var _0x20d916=function(_0x4d3ae4){while(--_0x4d3ae4){_0x58cf54['push'](_0x58cf54['shift']());}};_0x20d916(++_0x5b78e1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x42ffc2,_0x282c59){var _0x31a437=function(_0x10c2c6){while(--_0x10c2c6){_0x42ffc2['push'](_0x42ffc2['shift']());}};_0x31a437(++_0x282c59);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index c84d7b9..3cead0c 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 _0xa7dc=['exports','util','connect-timeout','express','fs-extra','isAuthenticated','index','/:id','show','post','put','update'];(function(_0xacc118,_0x3aa0d1){var _0x51c83d=function(_0x2a9e9f){while(--_0x2a9e9f){_0xacc118['push'](_0xacc118['shift']());}};_0x51c83d(++_0x3aa0d1);}(_0xa7dc,0x109));var _0xca7d=function(_0x95bed5,_0x4bcaa9){_0x95bed5=_0x95bed5-0x0;var _0x16adeb=_0xa7dc[_0x95bed5];return _0x16adeb;};'use strict';var multer=require('multer');var util=require(_0xca7d('0x0'));var path=require('path');var timeout=require(_0xca7d('0x1'));var express=require(_0xca7d('0x2'));var router=express['Router']();var fs_extra=require(_0xca7d('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cannedAnswer.controller');router['get']('/',auth[_0xca7d('0x4')](),controller[_0xca7d('0x5')]);router['get'](_0xca7d('0x6'),auth['isAuthenticated'](),controller[_0xca7d('0x7')]);router[_0xca7d('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0xca7d('0x9')](_0xca7d('0x6'),auth[_0xca7d('0x4')](),controller[_0xca7d('0xa')]);router['delete']('/:id',auth[_0xca7d('0x4')](),controller['destroy']);module[_0xca7d('0xb')]=router; \ No newline at end of file +var _0xf740=['create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../config/environment','./cannedAnswer.controller','get','index','/:id','show','isAuthenticated'];(function(_0x65c50e,_0x1aa926){var _0x4573e7=function(_0x5bc049){while(--_0x5bc049){_0x65c50e['push'](_0x65c50e['shift']());}};_0x4573e7(++_0x1aa926);}(_0xf740,0x138));var _0x0f74=function(_0x5aa373,_0x54c7f4){_0x5aa373=_0x5aa373-0x0;var _0x590e8e=_0xf740[_0x5aa373];return _0x590e8e;};'use strict';var multer=require('multer');var util=require(_0x0f74('0x0'));var path=require(_0x0f74('0x1'));var timeout=require(_0x0f74('0x2'));var express=require('express');var router=express[_0x0f74('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0f74('0x4'));var controller=require(_0x0f74('0x5'));router[_0x0f74('0x6')]('/',auth['isAuthenticated'](),controller[_0x0f74('0x7')]);router['get'](_0x0f74('0x8'),auth['isAuthenticated'](),controller[_0x0f74('0x9')]);router['post']('/',auth[_0x0f74('0xa')](),controller[_0x0f74('0xb')]);router[_0x0f74('0xc')](_0x0f74('0x8'),auth[_0x0f74('0xa')](),controller[_0x0f74('0xd')]);router[_0x0f74('0xe')](_0x0f74('0x8'),auth[_0x0f74('0xa')](),controller[_0x0f74('0xf')]);module[_0x0f74('0x10')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 25919bc..d8d30dd 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 _0x86a8=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','exports'];(function(_0x55d8ed,_0x2fd844){var _0x5e15c3=function(_0x511b72){while(--_0x511b72){_0x55d8ed['push'](_0x55d8ed['shift']());}};_0x5e15c3(++_0x2fd844);}(_0x86a8,0x1ae));var _0x886a=function(_0x2a4205,_0x1049ee){_0x2a4205=_0x2a4205-0x0;var _0xeb857b=_0x86a8[_0x2a4205];return _0xeb857b;};'use strict';var Sequelize=require(_0x886a('0x0'));module[_0x886a('0x1')]={'calldate':{'type':Sequelize[_0x886a('0x2')],'allowNull':![],'defaultValue':_0x886a('0x3')},'clid':{'type':Sequelize[_0x886a('0x4')]},'src':{'type':Sequelize[_0x886a('0x4')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0x886a('0x4')]},'channel':{'type':Sequelize[_0x886a('0x4')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x886a('0x4')]},'lastdata':{'type':Sequelize[_0x886a('0x4')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x886a('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x886a('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x886a('0x4')]},'uniqueid':{'type':Sequelize[_0x886a('0x4')]},'linkedid':{'type':Sequelize[_0x886a('0x4')]},'sequence':{'type':Sequelize[_0x886a('0x4')]},'peeraccount':{'type':Sequelize[_0x886a('0x4')]},'type':{'type':Sequelize[_0x886a('0x4')]},'tag':{'type':Sequelize[_0x886a('0x4')]}}; \ No newline at end of file +var _0x01bb=['1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','exports','DATE'];(function(_0xf7c631,_0x342112){var _0x3f3136=function(_0x53b283){while(--_0x53b283){_0xf7c631['push'](_0xf7c631['shift']());}};_0x3f3136(++_0x342112);}(_0x01bb,0x171));var _0xb01b=function(_0x169121,_0x281dbc){_0x169121=_0x169121-0x0;var _0x731479=_0x01bb[_0x169121];return _0x731479;};'use strict';var Sequelize=require(_0xb01b('0x0'));module[_0xb01b('0x1')]={'calldate':{'type':Sequelize[_0xb01b('0x2')],'allowNull':![],'defaultValue':_0xb01b('0x3')},'clid':{'type':Sequelize[_0xb01b('0x4')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0xb01b('0x4')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xb01b('0x4')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xb01b('0x4')]},'duration':{'type':Sequelize[_0xb01b('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xb01b('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xb01b('0x4')]},'amaflags':{'type':Sequelize[_0xb01b('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xb01b('0x4')]},'userfield':{'type':Sequelize[_0xb01b('0x4')]},'uniqueid':{'type':Sequelize[_0xb01b('0x4')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0xb01b('0x4')]},'peeraccount':{'type':Sequelize[_0xb01b('0x4')]},'type':{'type':Sequelize[_0xb01b('0x4')]},'tag':{'type':Sequelize[_0xb01b('0x4')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 444218e..2cd5dc5 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 _0x106f=['path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','limit','undefined','count','status','set','Content-Range','apply','save','update','then','destroy','end','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','include','Cdr','findAll','params','create','body','catch','find','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util'];(function(_0x33ca22,_0xbcc94){var _0x1790c3=function(_0x448b06){while(--_0x448b06){_0x33ca22['push'](_0x33ca22['shift']());}};_0x1790c3(++_0xbcc94);}(_0x106f,0x162));var _0xf106=function(_0x4e8b61,_0x424fa7){_0x4e8b61=_0x4e8b61-0x0;var _0x21be7f=_0x106f[_0x4e8b61];return _0x21be7f;};'use strict';var emlformat=require(_0xf106('0x0'));var rimraf=require(_0xf106('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf106('0x2'));var rp=require(_0xf106('0x3'));var moment=require('moment');var BPromise=require(_0xf106('0x4'));var Mustache=require('mustache');var util=require(_0xf106('0x5'));var path=require(_0xf106('0x6'));var sox=require(_0xf106('0x7'));var csv=require(_0xf106('0x8'));var ejs=require(_0xf106('0x9'));var fs=require('fs');var fs_extra=require(_0xf106('0xa'));var _=require(_0xf106('0xb'));var squel=require('squel');var crypto=require(_0xf106('0xc'));var jsforce=require(_0xf106('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf106('0xe'));var qs=require(_0xf106('0xf'));var as=require(_0xf106('0x10'));var hardwareService=require(_0xf106('0x11'));var logger=require(_0xf106('0x12'))(_0xf106('0x13'));var utils=require(_0xf106('0x14'));var config=require(_0xf106('0x15'));var licenseUtil=require(_0xf106('0x16'));var db=require(_0xf106('0x17'))['db'];function respondWithStatusCode(_0x31eebf,_0x5e9da8){_0x5e9da8=_0x5e9da8||0xcc;return function(_0x2bd234){if(_0x2bd234){return _0x31eebf[_0xf106('0x18')](_0x5e9da8);}return _0x31eebf['status'](_0x5e9da8)['end']();};}function respondWithResult(_0x322351,_0x2cdbf6){_0x2cdbf6=_0x2cdbf6||0xc8;return function(_0x292a0d){if(_0x292a0d){return _0x322351['status'](_0x2cdbf6)[_0xf106('0x19')](_0x292a0d);}};}function respondWithFilteredResult(_0x26186f,_0xf05683){return function(_0x48bfdd){if(_0x48bfdd){var _0x1e17e6=typeof _0xf05683[_0xf106('0x1a')]==='undefined'&&typeof _0xf05683[_0xf106('0x1b')]===_0xf106('0x1c');var _0x62352=_0x48bfdd['count'];var _0x5d02c0=_0x1e17e6?0x0:_0xf05683[_0xf106('0x1a')];var _0x726d7c=_0x1e17e6?_0x48bfdd[_0xf106('0x1d')]:_0xf05683['offset']+_0xf05683[_0xf106('0x1b')];var _0x1a6816;if(_0x726d7c>=_0x62352){_0x726d7c=_0x62352;_0x1a6816=0xc8;}else{_0x1a6816=0xce;}_0x26186f[_0xf106('0x1e')](_0x1a6816);return _0x26186f[_0xf106('0x1f')](_0xf106('0x20'),_0x5d02c0+'-'+_0x726d7c+'/'+_0x62352)[_0xf106('0x19')](_0x48bfdd);}return null;};}function patchUpdates(_0x29ae70){return function(_0x232a54){try{jsonpatch[_0xf106('0x21')](_0x232a54,_0x29ae70,!![]);}catch(_0x4a9564){return BPromise['reject'](_0x4a9564);}return _0x232a54[_0xf106('0x22')]();};}function saveUpdates(_0x59abbc,_0x32ab30){return function(_0x3c729e){if(_0x3c729e){return _0x3c729e[_0xf106('0x23')](_0x59abbc)[_0xf106('0x24')](function(_0x450451){return _0x450451;});}return null;};}function removeEntity(_0x4f673f,_0x58febd){return function(_0x178890){if(_0x178890){return _0x178890[_0xf106('0x25')]()[_0xf106('0x24')](function(){_0x4f673f[_0xf106('0x1e')](0xcc)[_0xf106('0x26')]();});}};}function handleEntityNotFound(_0xf7de89,_0x9f99bb){return function(_0x118726){if(!_0x118726){_0xf7de89[_0xf106('0x18')](0x194);}return _0x118726;};}function handleError(_0x14b15e,_0x468fce){_0x468fce=_0x468fce||0x1f4;return function(_0x225c15){logger['error'](_0x225c15['stack']);if(_0x225c15['name']){delete _0x225c15[_0xf106('0x27')];}_0x14b15e[_0xf106('0x1e')](_0x468fce)[_0xf106('0x28')](_0x225c15);};}exports[_0xf106('0x29')]=function(_0x4265b3,_0x13b5d7){var _0x4f90d1={},_0x1394e8={},_0x269bff={'count':0x0,'rows':[]};var _0x1f8323=_[_0xf106('0x2a')](db['Cdr'][_0xf106('0x2b')],function(_0x444bde){return{'name':_0x444bde[_0xf106('0x2c')],'type':_0x444bde[_0xf106('0x2d')][_0xf106('0x2e')]};});_0x1394e8[_0xf106('0x2f')]=_['map'](_0x1f8323,_0xf106('0x27'));_0x1394e8[_0xf106('0x30')]=_[_0xf106('0x31')](_0x4265b3[_0xf106('0x30')]);_0x1394e8['filters']=_[_0xf106('0x32')](_0x1394e8[_0xf106('0x2f')],_0x1394e8['query']);_0x4f90d1[_0xf106('0x33')]=_[_0xf106('0x32')](_0x1394e8[_0xf106('0x2f')],qs[_0xf106('0x34')](_0x4265b3[_0xf106('0x30')][_0xf106('0x34')]));_0x4f90d1[_0xf106('0x33')]=_0x4f90d1[_0xf106('0x33')][_0xf106('0x35')]?_0x4f90d1[_0xf106('0x33')]:_0x1394e8[_0xf106('0x2f')];if(!_0x4265b3['query']['hasOwnProperty'](_0xf106('0x36'))){_0x4f90d1[_0xf106('0x1b')]=qs[_0xf106('0x1b')](_0x4265b3['query'][_0xf106('0x1b')]);_0x4f90d1[_0xf106('0x1a')]=qs[_0xf106('0x1a')](_0x4265b3[_0xf106('0x30')][_0xf106('0x1a')]);}_0x4f90d1['order']=qs[_0xf106('0x37')](_0x4265b3['query'][_0xf106('0x37')]);_0x4f90d1[_0xf106('0x38')]=qs[_0xf106('0x39')](_[_0xf106('0x3a')](_0x4265b3['query'],_0x1394e8[_0xf106('0x39')]),_0x1f8323);if(_0x4265b3[_0xf106('0x30')][_0xf106('0x3b')]){_0x4f90d1['where']=_['merge'](_0x4f90d1['where'],{'$or':_['map'](_0x1f8323,function(_0x58dba7){if(_0x58dba7[_0xf106('0x2d')]!=='VIRTUAL'){var _0x4beb79={};_0x4beb79[_0x58dba7[_0xf106('0x27')]]={'$like':'%'+_0x4265b3['query']['filter']+'%'};return _0x4beb79;}})});}_0x4f90d1=_[_0xf106('0x3c')]({},_0x4f90d1,_0x4265b3[_0xf106('0x3d')]);var _0x2d4c90={'where':_0x4f90d1[_0xf106('0x38')]};return db['Cdr'][_0xf106('0x1d')](_0x2d4c90)[_0xf106('0x24')](function(_0x583a72){_0x269bff[_0xf106('0x1d')]=_0x583a72;if(_0x4265b3[_0xf106('0x30')][_0xf106('0x3e')]){_0x4f90d1[_0xf106('0x3f')]=[{'all':!![]}];}return db[_0xf106('0x40')][_0xf106('0x41')](_0x4f90d1);})[_0xf106('0x24')](function(_0x57d61e){_0x269bff['rows']=_0x57d61e;return _0x269bff;})[_0xf106('0x24')](respondWithFilteredResult(_0x13b5d7,_0x4f90d1))['catch'](handleError(_0x13b5d7,null));};exports['show']=function(_0x37bb28,_0x390eee){var _0x5e6cb8={'raw':!![],'where':{'id':_0x37bb28[_0xf106('0x42')]['id']}},_0x47f4d3={};_0x47f4d3['model']=_[_0xf106('0x31')](db[_0xf106('0x40')][_0xf106('0x2b')]);_0x47f4d3[_0xf106('0x30')]=_[_0xf106('0x31')](_0x37bb28[_0xf106('0x30')]);_0x47f4d3[_0xf106('0x39')]=_[_0xf106('0x32')](_0x47f4d3[_0xf106('0x2f')],_0x47f4d3[_0xf106('0x30')]);_0x5e6cb8[_0xf106('0x33')]=_[_0xf106('0x32')](_0x47f4d3[_0xf106('0x2f')],qs[_0xf106('0x34')](_0x37bb28[_0xf106('0x30')][_0xf106('0x34')]));_0x5e6cb8[_0xf106('0x33')]=_0x5e6cb8[_0xf106('0x33')]['length']?_0x5e6cb8[_0xf106('0x33')]:_0x47f4d3[_0xf106('0x2f')];if(_0x37bb28[_0xf106('0x30')][_0xf106('0x3e')]){_0x5e6cb8[_0xf106('0x3f')]=[{'all':!![]}];}_0x5e6cb8=_['merge']({},_0x5e6cb8,_0x37bb28['options']);return db['Cdr']['find'](_0x5e6cb8)[_0xf106('0x24')](handleEntityNotFound(_0x390eee,null))['then'](respondWithResult(_0x390eee,null))['catch'](handleError(_0x390eee,null));};exports[_0xf106('0x43')]=function(_0x1a686d,_0xd50443){return db[_0xf106('0x40')]['create'](_0x1a686d[_0xf106('0x44')],{})[_0xf106('0x24')](respondWithResult(_0xd50443,0xc9))[_0xf106('0x45')](handleError(_0xd50443,null));};exports[_0xf106('0x23')]=function(_0x1bf065,_0x519192){if(_0x1bf065['body']['id']){delete _0x1bf065[_0xf106('0x44')]['id'];}return db[_0xf106('0x40')][_0xf106('0x46')]({'where':{'id':_0x1bf065['params']['id']}})[_0xf106('0x24')](handleEntityNotFound(_0x519192,null))[_0xf106('0x24')](saveUpdates(_0x1bf065[_0xf106('0x44')],null))[_0xf106('0x24')](respondWithResult(_0x519192,null))['catch'](handleError(_0x519192,null));};exports[_0xf106('0x25')]=function(_0x5b80a8,_0x50798d){return db[_0xf106('0x40')][_0xf106('0x46')]({'where':{'id':_0x5b80a8['params']['id']}})[_0xf106('0x24')](handleEntityNotFound(_0x50798d,null))[_0xf106('0x24')](removeEntity(_0x50798d,null))[_0xf106('0x45')](handleError(_0x50798d,null));};exports[_0xf106('0x47')]=function(_0x14375d,_0x391e3d){return db['Cdr']['describe']()[_0xf106('0x24')](respondWithResult(_0x391e3d,null))['catch'](handleError(_0x391e3d,null));}; \ No newline at end of file +var _0x4300=['stack','name','send','index','rawAttributes','fieldName','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','Cdr','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','describe','eml-format','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x4300,0x1a6));var _0x0430=function(_0x59e9ad,_0x4d4fd3){_0x59e9ad=_0x59e9ad-0x0;var _0x192103=_0x4300[_0x59e9ad];return _0x192103;};'use strict';var emlformat=require(_0x0430('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0430('0x1'));var BPromise=require(_0x0430('0x2'));var Mustache=require(_0x0430('0x3'));var util=require(_0x0430('0x4'));var path=require(_0x0430('0x5'));var sox=require('sox');var csv=require(_0x0430('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0430('0x7'));var _=require('lodash');var squel=require(_0x0430('0x8'));var crypto=require(_0x0430('0x9'));var jsforce=require(_0x0430('0xa'));var deskjs=require(_0x0430('0xb'));var toCsv=require(_0x0430('0x6'));var querystring=require(_0x0430('0xc'));var Papa=require(_0x0430('0xd'));var Redis=require(_0x0430('0xe'));var authService=require(_0x0430('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x0430('0x10'));var hardwareService=require(_0x0430('0x11'));var logger=require(_0x0430('0x12'))(_0x0430('0x13'));var utils=require(_0x0430('0x14'));var config=require(_0x0430('0x15'));var licenseUtil=require(_0x0430('0x16'));var db=require(_0x0430('0x17'))['db'];function respondWithStatusCode(_0x5315a3,_0x4b382a){_0x4b382a=_0x4b382a||0xcc;return function(_0x4292f7){if(_0x4292f7){return _0x5315a3[_0x0430('0x18')](_0x4b382a);}return _0x5315a3[_0x0430('0x19')](_0x4b382a)[_0x0430('0x1a')]();};}function respondWithResult(_0x671534,_0x39d4e2){_0x39d4e2=_0x39d4e2||0xc8;return function(_0x182e2c){if(_0x182e2c){return _0x671534['status'](_0x39d4e2)[_0x0430('0x1b')](_0x182e2c);}};}function respondWithFilteredResult(_0x40e6dc,_0x8fe471){return function(_0x3b34af){if(_0x3b34af){var _0x5c98c9=typeof _0x8fe471['offset']==='undefined'&&typeof _0x8fe471[_0x0430('0x1c')]==='undefined';var _0x495094=_0x3b34af[_0x0430('0x1d')];var _0x2f23b9=_0x5c98c9?0x0:_0x8fe471[_0x0430('0x1e')];var _0xd33c3c=_0x5c98c9?_0x3b34af[_0x0430('0x1d')]:_0x8fe471['offset']+_0x8fe471['limit'];var _0xf11cda;if(_0xd33c3c>=_0x495094){_0xd33c3c=_0x495094;_0xf11cda=0xc8;}else{_0xf11cda=0xce;}_0x40e6dc[_0x0430('0x19')](_0xf11cda);return _0x40e6dc[_0x0430('0x1f')](_0x0430('0x20'),_0x2f23b9+'-'+_0xd33c3c+'/'+_0x495094)['json'](_0x3b34af);}return null;};}function patchUpdates(_0x4d3af1){return function(_0x12a05c){try{jsonpatch[_0x0430('0x21')](_0x12a05c,_0x4d3af1,!![]);}catch(_0x301992){return BPromise[_0x0430('0x22')](_0x301992);}return _0x12a05c[_0x0430('0x23')]();};}function saveUpdates(_0xb17238,_0x5da567){return function(_0x11160f){if(_0x11160f){return _0x11160f[_0x0430('0x24')](_0xb17238)[_0x0430('0x25')](function(_0x1d5b51){return _0x1d5b51;});}return null;};}function removeEntity(_0x54e1a3,_0x188b12){return function(_0x28faa2){if(_0x28faa2){return _0x28faa2[_0x0430('0x26')]()[_0x0430('0x25')](function(){_0x54e1a3[_0x0430('0x19')](0xcc)[_0x0430('0x1a')]();});}};}function handleEntityNotFound(_0x345b8c,_0x3e74d8){return function(_0x36ff02){if(!_0x36ff02){_0x345b8c['sendStatus'](0x194);}return _0x36ff02;};}function handleError(_0x375e54,_0x531611){_0x531611=_0x531611||0x1f4;return function(_0x5a79d6){logger[_0x0430('0x27')](_0x5a79d6[_0x0430('0x28')]);if(_0x5a79d6['name']){delete _0x5a79d6[_0x0430('0x29')];}_0x375e54[_0x0430('0x19')](_0x531611)[_0x0430('0x2a')](_0x5a79d6);};}exports[_0x0430('0x2b')]=function(_0x2b94e4,_0x3805f7){var _0x1df9ec={},_0xd6b31a={},_0x36f6ff={'count':0x0,'rows':[]};var _0x5ae72c=_['map'](db['Cdr'][_0x0430('0x2c')],function(_0x47e1f3){return{'name':_0x47e1f3[_0x0430('0x2d')],'type':_0x47e1f3['type']['key']};});_0xd6b31a[_0x0430('0x2e')]=_[_0x0430('0x2f')](_0x5ae72c,_0x0430('0x29'));_0xd6b31a[_0x0430('0x30')]=_['keys'](_0x2b94e4['query']);_0xd6b31a[_0x0430('0x31')]=_[_0x0430('0x32')](_0xd6b31a['model'],_0xd6b31a['query']);_0x1df9ec[_0x0430('0x33')]=_[_0x0430('0x32')](_0xd6b31a[_0x0430('0x2e')],qs[_0x0430('0x34')](_0x2b94e4[_0x0430('0x30')][_0x0430('0x34')]));_0x1df9ec[_0x0430('0x33')]=_0x1df9ec[_0x0430('0x33')][_0x0430('0x35')]?_0x1df9ec['attributes']:_0xd6b31a[_0x0430('0x2e')];if(!_0x2b94e4[_0x0430('0x30')][_0x0430('0x36')]('nolimit')){_0x1df9ec[_0x0430('0x1c')]=qs['limit'](_0x2b94e4[_0x0430('0x30')]['limit']);_0x1df9ec['offset']=qs[_0x0430('0x1e')](_0x2b94e4[_0x0430('0x30')][_0x0430('0x1e')]);}_0x1df9ec[_0x0430('0x37')]=qs[_0x0430('0x38')](_0x2b94e4[_0x0430('0x30')]['sort']);_0x1df9ec[_0x0430('0x39')]=qs[_0x0430('0x31')](_[_0x0430('0x3a')](_0x2b94e4[_0x0430('0x30')],_0xd6b31a[_0x0430('0x31')]),_0x5ae72c);if(_0x2b94e4[_0x0430('0x30')][_0x0430('0x3b')]){_0x1df9ec[_0x0430('0x39')]=_[_0x0430('0x3c')](_0x1df9ec[_0x0430('0x39')],{'$or':_['map'](_0x5ae72c,function(_0x44c546){if(_0x44c546[_0x0430('0x3d')]!==_0x0430('0x3e')){var _0x314b27={};_0x314b27[_0x44c546[_0x0430('0x29')]]={'$like':'%'+_0x2b94e4[_0x0430('0x30')]['filter']+'%'};return _0x314b27;}})});}_0x1df9ec=_[_0x0430('0x3c')]({},_0x1df9ec,_0x2b94e4[_0x0430('0x3f')]);var _0x50cdcd={'where':_0x1df9ec[_0x0430('0x39')]};return db[_0x0430('0x40')][_0x0430('0x1d')](_0x50cdcd)[_0x0430('0x25')](function(_0x2d6345){_0x36f6ff[_0x0430('0x1d')]=_0x2d6345;if(_0x2b94e4[_0x0430('0x30')][_0x0430('0x41')]){_0x1df9ec[_0x0430('0x42')]=[{'all':!![]}];}return db['Cdr'][_0x0430('0x43')](_0x1df9ec);})[_0x0430('0x25')](function(_0x456f36){_0x36f6ff[_0x0430('0x44')]=_0x456f36;return _0x36f6ff;})['then'](respondWithFilteredResult(_0x3805f7,_0x1df9ec))[_0x0430('0x45')](handleError(_0x3805f7,null));};exports[_0x0430('0x46')]=function(_0x16e96c,_0x435028){var _0x26992f={'raw':!![],'where':{'id':_0x16e96c[_0x0430('0x47')]['id']}},_0x3cc598={};_0x3cc598[_0x0430('0x2e')]=_[_0x0430('0x48')](db[_0x0430('0x40')][_0x0430('0x2c')]);_0x3cc598['query']=_[_0x0430('0x48')](_0x16e96c['query']);_0x3cc598['filters']=_[_0x0430('0x32')](_0x3cc598['model'],_0x3cc598['query']);_0x26992f[_0x0430('0x33')]=_['intersection'](_0x3cc598['model'],qs[_0x0430('0x34')](_0x16e96c['query']['fields']));_0x26992f[_0x0430('0x33')]=_0x26992f['attributes']['length']?_0x26992f[_0x0430('0x33')]:_0x3cc598[_0x0430('0x2e')];if(_0x16e96c[_0x0430('0x30')]['includeAll']){_0x26992f[_0x0430('0x42')]=[{'all':!![]}];}_0x26992f=_[_0x0430('0x3c')]({},_0x26992f,_0x16e96c[_0x0430('0x3f')]);return db['Cdr']['find'](_0x26992f)[_0x0430('0x25')](handleEntityNotFound(_0x435028,null))[_0x0430('0x25')](respondWithResult(_0x435028,null))[_0x0430('0x45')](handleError(_0x435028,null));};exports[_0x0430('0x49')]=function(_0x5e84f4,_0x5a4500){return db['Cdr'][_0x0430('0x49')](_0x5e84f4[_0x0430('0x4a')],{})[_0x0430('0x25')](respondWithResult(_0x5a4500,0xc9))[_0x0430('0x45')](handleError(_0x5a4500,null));};exports[_0x0430('0x24')]=function(_0x421280,_0x5c3184){if(_0x421280['body']['id']){delete _0x421280[_0x0430('0x4a')]['id'];}return db[_0x0430('0x40')][_0x0430('0x4b')]({'where':{'id':_0x421280[_0x0430('0x47')]['id']}})[_0x0430('0x25')](handleEntityNotFound(_0x5c3184,null))[_0x0430('0x25')](saveUpdates(_0x421280[_0x0430('0x4a')],null))[_0x0430('0x25')](respondWithResult(_0x5c3184,null))[_0x0430('0x45')](handleError(_0x5c3184,null));};exports[_0x0430('0x26')]=function(_0x4387db,_0x2bdcd6){return db['Cdr']['find']({'where':{'id':_0x4387db[_0x0430('0x47')]['id']}})[_0x0430('0x25')](handleEntityNotFound(_0x2bdcd6,null))[_0x0430('0x25')](removeEntity(_0x2bdcd6,null))[_0x0430('0x45')](handleError(_0x2bdcd6,null));};exports[_0x0430('0x4c')]=function(_0x261996,_0xfa67a4){return db[_0x0430('0x40')][_0x0430('0x4c')]()[_0x0430('0x25')](respondWithResult(_0xfa67a4,null))[_0x0430('0x45')](handleError(_0xfa67a4,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 43e98a5..22f0f9b 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x5a32b8,_0x54a79f){var _0x34d9af=function(_0x58f6a1){while(--_0x58f6a1){_0x5a32b8['push'](_0x5a32b8['shift']());}};_0x34d9af(++_0x54a79f);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x2c25c7,_0x57f2d7){var _0x1e51bd=function(_0x544467){while(--_0x544467){_0x2c25c7['push'](_0x2c25c7['shift']());}};_0x1e51bd(++_0x57f2d7);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index dd26ffd..0972fa0 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 _0xa9ba=['info','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Cdr,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then'];(function(_0x1074cb,_0x132cda){var _0x2aa5c1=function(_0x44ca3d){while(--_0x44ca3d){_0x1074cb['push'](_0x1074cb['shift']());}};_0x2aa5c1(++_0x132cda);}(_0xa9ba,0x12b));var _0xaa9b=function(_0x2246cc,_0x520f93){_0x2246cc=_0x2246cc-0x0;var _0x4e172b=_0xa9ba[_0x2246cc];return _0x4e172b;};'use strict';var _=require(_0xaa9b('0x0'));var util=require('util');var moment=require(_0xaa9b('0x1'));var BPromise=require(_0xaa9b('0x2'));var rs=require(_0xaa9b('0x3'));var fs=require('fs');var Redis=require(_0xaa9b('0x4'));var db=require(_0xaa9b('0x5'))['db'];var utils=require(_0xaa9b('0x6'));var logger=require(_0xaa9b('0x7'))(_0xaa9b('0x8'));var config=require(_0xaa9b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa9b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4374aa,_0x35d0e9,_0x1f848e){return new BPromise(function(_0x478ee7,_0x94411d){return client[_0xaa9b('0xb')](_0x4374aa,_0x1f848e)[_0xaa9b('0xc')](function(_0x45ed2a){logger[_0xaa9b('0xd')]('Cdr,\x20%s,\x20%s',_0x35d0e9,_0xaa9b('0xe'));logger[_0xaa9b('0xf')](_0xaa9b('0x10'),_0x35d0e9,'request\x20sent',JSON[_0xaa9b('0x11')](_0x45ed2a));if(_0x45ed2a[_0xaa9b('0x12')]){if(_0x45ed2a[_0xaa9b('0x12')][_0xaa9b('0x13')]===0x1f4){logger[_0xaa9b('0x12')]('Cdr,\x20%s,\x20%s',_0x35d0e9,_0x45ed2a['error']['message']);return _0x94411d(_0x45ed2a[_0xaa9b('0x12')][_0xaa9b('0x14')]);}logger[_0xaa9b('0x12')](_0xaa9b('0x15'),_0x35d0e9,_0x45ed2a[_0xaa9b('0x12')][_0xaa9b('0x14')]);return _0x478ee7(_0x45ed2a[_0xaa9b('0x12')][_0xaa9b('0x14')]);}else{logger[_0xaa9b('0xd')]('Cdr,\x20%s,\x20%s',_0x35d0e9,'request\x20sent');_0x478ee7(_0x45ed2a[_0xaa9b('0x16')]['message']);}})[_0xaa9b('0x17')](function(_0x139d58){logger[_0xaa9b('0x12')]('Cdr,\x20%s,\x20%s',_0x35d0e9,_0x139d58);_0x94411d(_0x139d58);});});} \ No newline at end of file +var _0x06f5=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x366aca,_0x12199a){var _0x18e210=function(_0x58b703){while(--_0x58b703){_0x366aca['push'](_0x366aca['shift']());}};_0x18e210(++_0x12199a);}(_0x06f5,0x182));var _0x506f=function(_0x324467,_0x2b4a70){_0x324467=_0x324467-0x0;var _0x3d27d9=_0x06f5[_0x324467];return _0x3d27d9;};'use strict';var _=require(_0x506f('0x0'));var util=require(_0x506f('0x1'));var moment=require(_0x506f('0x2'));var BPromise=require(_0x506f('0x3'));var rs=require(_0x506f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x506f('0x5'))['db'];var utils=require(_0x506f('0x6'));var logger=require(_0x506f('0x7'))(_0x506f('0x8'));var config=require(_0x506f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x506f('0xa')][_0x506f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x284a10,_0x3ec73d,_0x59586c){return new BPromise(function(_0x3449a5,_0x221c55){return client['request'](_0x284a10,_0x59586c)[_0x506f('0xc')](function(_0x47cc78){logger[_0x506f('0xd')](_0x506f('0xe'),_0x3ec73d,_0x506f('0xf'));logger['debug'](_0x506f('0x10'),_0x3ec73d,'request\x20sent',JSON[_0x506f('0x11')](_0x47cc78));if(_0x47cc78[_0x506f('0x12')]){if(_0x47cc78[_0x506f('0x12')][_0x506f('0x13')]===0x1f4){logger['error']('Cdr,\x20%s,\x20%s',_0x3ec73d,_0x47cc78['error'][_0x506f('0x14')]);return _0x221c55(_0x47cc78['error']['message']);}logger[_0x506f('0x12')]('Cdr,\x20%s,\x20%s',_0x3ec73d,_0x47cc78[_0x506f('0x12')]['message']);return _0x3449a5(_0x47cc78[_0x506f('0x12')]['message']);}else{logger[_0x506f('0xd')]('Cdr,\x20%s,\x20%s',_0x3ec73d,'request\x20sent');_0x3449a5(_0x47cc78[_0x506f('0x15')][_0x506f('0x14')]);}})[_0x506f('0x16')](function(_0x1535aa){logger[_0x506f('0x12')]('Cdr,\x20%s,\x20%s',_0x3ec73d,_0x1535aa);_0x221c55(_0x1535aa);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 66d56d1..8607b1e 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x11c5da,_0x5799cf){var _0x5cfbf1=function(_0x2d23b0){while(--_0x2d23b0){_0x11c5da['push'](_0x11c5da['shift']());}};_0x5cfbf1(++_0x5799cf);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xb10b=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x50ce04,_0xd43127){var _0x4e4f68=function(_0x2c3f66){while(--_0x2c3f66){_0x50ce04['push'](_0x50ce04['shift']());}};_0x4e4f68(++_0xd43127);}(_0xb10b,0x12a));var _0xbb10=function(_0x2f20f8,_0x54a3f2){_0x2f20f8=_0x2f20f8-0x0;var _0xfcb1b7=_0xb10b[_0x2f20f8];return _0xfcb1b7;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index c84b707..1d98f1b 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 _0x73b6=['*,*,*,*','sequelize','INTEGER','STRING','noop'];(function(_0x31ec29,_0x58915c){var _0x3275fc=function(_0x435075){while(--_0x435075){_0x31ec29['push'](_0x31ec29['shift']());}};_0x3275fc(++_0x58915c);}(_0x73b6,0xce));var _0x673b=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x73b6[_0x311c35];return _0x5cc50c;};'use strict';var Sequelize=require(_0x673b('0x0'));module['exports']={'priority':{'type':Sequelize[_0x673b('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x673b('0x2')],'allowNull':![],'defaultValue':_0x673b('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x673b('0x2')],'defaultValue':_0x673b('0x4')}}; \ No newline at end of file +var _0x9ba3=['TEXT','exports','INTEGER','STRING','noop'];(function(_0x3c6310,_0x13601d){var _0x320122=function(_0x596176){while(--_0x596176){_0x3c6310['push'](_0x3c6310['shift']());}};_0x320122(++_0x13601d);}(_0x9ba3,0xc4));var _0x39ba=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x9ba3[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0x39ba('0x0')]={'priority':{'type':Sequelize[_0x39ba('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x39ba('0x2')],'allowNull':![],'defaultValue':_0x39ba('0x3')},'appdata':{'type':Sequelize[_0x39ba('0x4')]()},'description':{'type':Sequelize[_0x39ba('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index e8a2944..b8ef63f 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 _0xf2fa=['api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','show','params','model','ChatApplication','rawAttributes','keys','query','filters','intersection','attributes','fields','length','merge','options','catch','body','find','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xf2fa,0xd0));var _0xaf2f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf2fa[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xaf2f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xaf2f('0x1'));var rp=require(_0xaf2f('0x2'));var moment=require(_0xaf2f('0x3'));var BPromise=require(_0xaf2f('0x4'));var Mustache=require(_0xaf2f('0x5'));var util=require(_0xaf2f('0x6'));var path=require(_0xaf2f('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xaf2f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaf2f('0x9'));var squel=require(_0xaf2f('0xa'));var crypto=require(_0xaf2f('0xb'));var jsforce=require(_0xaf2f('0xc'));var deskjs=require(_0xaf2f('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xaf2f('0xe'));var authService=require(_0xaf2f('0xf'));var qs=require(_0xaf2f('0x10'));var as=require(_0xaf2f('0x11'));var hardwareService=require(_0xaf2f('0x12'));var logger=require(_0xaf2f('0x13'))(_0xaf2f('0x14'));var utils=require(_0xaf2f('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xaf2f('0x16'));var db=require(_0xaf2f('0x17'))['db'];function respondWithStatusCode(_0x3dea79,_0x578499){_0x578499=_0x578499||0xcc;return function(_0x57cdb0){if(_0x57cdb0){return _0x3dea79['sendStatus'](_0x578499);}return _0x3dea79[_0xaf2f('0x18')](_0x578499)[_0xaf2f('0x19')]();};}function respondWithResult(_0x580fa6,_0x305755){_0x305755=_0x305755||0xc8;return function(_0x131862){if(_0x131862){return _0x580fa6['status'](_0x305755)[_0xaf2f('0x1a')](_0x131862);}};}function respondWithFilteredResult(_0x4db0fc,_0x402485){return function(_0x30905b){if(_0x30905b){var _0x3d475a=typeof _0x402485[_0xaf2f('0x1b')]===_0xaf2f('0x1c')&&typeof _0x402485[_0xaf2f('0x1d')]===_0xaf2f('0x1c');var _0x2a5d4a=_0x30905b[_0xaf2f('0x1e')];var _0x244435=_0x3d475a?0x0:_0x402485['offset'];var _0x1a2d28=_0x3d475a?_0x30905b[_0xaf2f('0x1e')]:_0x402485['offset']+_0x402485['limit'];var _0xb64c0e;if(_0x1a2d28>=_0x2a5d4a){_0x1a2d28=_0x2a5d4a;_0xb64c0e=0xc8;}else{_0xb64c0e=0xce;}_0x4db0fc[_0xaf2f('0x18')](_0xb64c0e);return _0x4db0fc['set'](_0xaf2f('0x1f'),_0x244435+'-'+_0x1a2d28+'/'+_0x2a5d4a)['json'](_0x30905b);}return null;};}function patchUpdates(_0x2dbd9b){return function(_0x5a6c9d){try{jsonpatch[_0xaf2f('0x20')](_0x5a6c9d,_0x2dbd9b,!![]);}catch(_0xccf664){return BPromise['reject'](_0xccf664);}return _0x5a6c9d[_0xaf2f('0x21')]();};}function saveUpdates(_0x42b7ae,_0x359dc2){return function(_0x19da71){if(_0x19da71){return _0x19da71[_0xaf2f('0x22')](_0x42b7ae)[_0xaf2f('0x23')](function(_0x2fe731){return _0x2fe731;});}return null;};}function removeEntity(_0x1da2bb,_0x4f5018){return function(_0x5f199d){if(_0x5f199d){return _0x5f199d[_0xaf2f('0x24')]()[_0xaf2f('0x23')](function(){_0x1da2bb[_0xaf2f('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f7440,_0x38ecee){return function(_0x29fc22){if(!_0x29fc22){_0x1f7440[_0xaf2f('0x25')](0x194);}return _0x29fc22;};}function handleError(_0x2f2068,_0x324876){_0x324876=_0x324876||0x1f4;return function(_0x593e4d){logger['error'](_0x593e4d['stack']);if(_0x593e4d[_0xaf2f('0x26')]){delete _0x593e4d['name'];}_0x2f2068['status'](_0x324876)[_0xaf2f('0x27')](_0x593e4d);};}exports[_0xaf2f('0x28')]=function(_0x16eb77,_0x21bf39){var _0x2374dd={'raw':!![],'where':{'id':_0x16eb77[_0xaf2f('0x29')]['id']}},_0x5a752a={};_0x5a752a[_0xaf2f('0x2a')]=_['keys'](db[_0xaf2f('0x2b')][_0xaf2f('0x2c')]);_0x5a752a['query']=_[_0xaf2f('0x2d')](_0x16eb77[_0xaf2f('0x2e')]);_0x5a752a[_0xaf2f('0x2f')]=_[_0xaf2f('0x30')](_0x5a752a['model'],_0x5a752a[_0xaf2f('0x2e')]);_0x2374dd[_0xaf2f('0x31')]=_['intersection'](_0x5a752a['model'],qs[_0xaf2f('0x32')](_0x16eb77['query'][_0xaf2f('0x32')]));_0x2374dd[_0xaf2f('0x31')]=_0x2374dd[_0xaf2f('0x31')][_0xaf2f('0x33')]?_0x2374dd[_0xaf2f('0x31')]:_0x5a752a['model'];if(_0x16eb77[_0xaf2f('0x2e')]['includeAll']){_0x2374dd['include']=[{'all':!![]}];}_0x2374dd=_[_0xaf2f('0x34')]({},_0x2374dd,_0x16eb77[_0xaf2f('0x35')]);return db['ChatApplication']['find'](_0x2374dd)[_0xaf2f('0x23')](handleEntityNotFound(_0x21bf39,null))[_0xaf2f('0x23')](respondWithResult(_0x21bf39,null))[_0xaf2f('0x36')](handleError(_0x21bf39,null));};exports[_0xaf2f('0x22')]=function(_0x4c30e8,_0x552c6e){if(_0x4c30e8[_0xaf2f('0x37')]['id']){delete _0x4c30e8['body']['id'];}return db[_0xaf2f('0x2b')][_0xaf2f('0x38')]({'where':{'id':_0x4c30e8[_0xaf2f('0x29')]['id']}})[_0xaf2f('0x23')](handleEntityNotFound(_0x552c6e,null))[_0xaf2f('0x23')](saveUpdates(_0x4c30e8[_0xaf2f('0x37')],null))[_0xaf2f('0x23')](respondWithResult(_0x552c6e,null))[_0xaf2f('0x36')](handleError(_0x552c6e,null));};exports['destroy']=function(_0x5db64e,_0x3e3ca6){return db['ChatApplication'][_0xaf2f('0x38')]({'where':{'id':_0x5db64e['params']['id']}})[_0xaf2f('0x23')](handleEntityNotFound(_0x3e3ca6,null))[_0xaf2f('0x23')](removeEntity(_0x3e3ca6,null))['catch'](handleError(_0x3e3ca6,null));}; \ No newline at end of file +var _0xa788=['merge','ChatApplication','find','catch','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','fs-extra','lodash','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','limit','count','offset','set','apply','reject','save','then','destroy','sendStatus','error','stack','name','model','keys','rawAttributes','query','filters','intersection','attributes','fields'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa788,0x70));var _0x8a78=function(_0x172da2,_0x1f9378){_0x172da2=_0x172da2-0x0;var _0x3bb8dc=_0xa788[_0x172da2];return _0x3bb8dc;};'use strict';var emlformat=require(_0x8a78('0x0'));var rimraf=require(_0x8a78('0x1'));var zipdir=require(_0x8a78('0x2'));var jsonpatch=require(_0x8a78('0x3'));var rp=require('request-promise');var moment=require(_0x8a78('0x4'));var BPromise=require(_0x8a78('0x5'));var Mustache=require('mustache');var util=require(_0x8a78('0x6'));var path=require(_0x8a78('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8a78('0x8'));var _=require(_0x8a78('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8a78('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8a78('0xb'));var Papa=require(_0x8a78('0xc'));var Redis=require('ioredis');var authService=require(_0x8a78('0xd'));var qs=require(_0x8a78('0xe'));var as=require(_0x8a78('0xf'));var hardwareService=require(_0x8a78('0x10'));var logger=require(_0x8a78('0x11'))(_0x8a78('0x12'));var utils=require(_0x8a78('0x13'));var config=require(_0x8a78('0x14'));var licenseUtil=require(_0x8a78('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x299461,_0x294b34){_0x294b34=_0x294b34||0xcc;return function(_0x31b77e){if(_0x31b77e){return _0x299461['sendStatus'](_0x294b34);}return _0x299461[_0x8a78('0x16')](_0x294b34)[_0x8a78('0x17')]();};}function respondWithResult(_0x18c057,_0x4b073b){_0x4b073b=_0x4b073b||0xc8;return function(_0x423787){if(_0x423787){return _0x18c057['status'](_0x4b073b)[_0x8a78('0x18')](_0x423787);}};}function respondWithFilteredResult(_0x53001e,_0x429b2c){return function(_0x586d47){if(_0x586d47){var _0x57212b=typeof _0x429b2c['offset']===_0x8a78('0x19')&&typeof _0x429b2c[_0x8a78('0x1a')]===_0x8a78('0x19');var _0xf0c379=_0x586d47[_0x8a78('0x1b')];var _0x18269a=_0x57212b?0x0:_0x429b2c[_0x8a78('0x1c')];var _0x1f2cb9=_0x57212b?_0x586d47[_0x8a78('0x1b')]:_0x429b2c[_0x8a78('0x1c')]+_0x429b2c[_0x8a78('0x1a')];var _0x3de1ac;if(_0x1f2cb9>=_0xf0c379){_0x1f2cb9=_0xf0c379;_0x3de1ac=0xc8;}else{_0x3de1ac=0xce;}_0x53001e[_0x8a78('0x16')](_0x3de1ac);return _0x53001e[_0x8a78('0x1d')]('Content-Range',_0x18269a+'-'+_0x1f2cb9+'/'+_0xf0c379)[_0x8a78('0x18')](_0x586d47);}return null;};}function patchUpdates(_0x557e98){return function(_0xa6f4b8){try{jsonpatch[_0x8a78('0x1e')](_0xa6f4b8,_0x557e98,!![]);}catch(_0x5cf33e){return BPromise[_0x8a78('0x1f')](_0x5cf33e);}return _0xa6f4b8[_0x8a78('0x20')]();};}function saveUpdates(_0x2ceb56,_0x43b3b8){return function(_0x2d7d03){if(_0x2d7d03){return _0x2d7d03['update'](_0x2ceb56)[_0x8a78('0x21')](function(_0x4b6618){return _0x4b6618;});}return null;};}function removeEntity(_0x3532d1,_0x43305f){return function(_0x118357){if(_0x118357){return _0x118357[_0x8a78('0x22')]()[_0x8a78('0x21')](function(){_0x3532d1[_0x8a78('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c2115,_0x21908e){return function(_0x2737d0){if(!_0x2737d0){_0x5c2115[_0x8a78('0x23')](0x194);}return _0x2737d0;};}function handleError(_0x5c7d00,_0x10e6b6){_0x10e6b6=_0x10e6b6||0x1f4;return function(_0x43f182){logger[_0x8a78('0x24')](_0x43f182[_0x8a78('0x25')]);if(_0x43f182[_0x8a78('0x26')]){delete _0x43f182[_0x8a78('0x26')];}_0x5c7d00[_0x8a78('0x16')](_0x10e6b6)['send'](_0x43f182);};}exports['show']=function(_0x9054ee,_0x370927){var _0x2c26d0={'raw':!![],'where':{'id':_0x9054ee['params']['id']}},_0x19c208={};_0x19c208[_0x8a78('0x27')]=_[_0x8a78('0x28')](db['ChatApplication'][_0x8a78('0x29')]);_0x19c208[_0x8a78('0x2a')]=_[_0x8a78('0x28')](_0x9054ee[_0x8a78('0x2a')]);_0x19c208[_0x8a78('0x2b')]=_[_0x8a78('0x2c')](_0x19c208[_0x8a78('0x27')],_0x19c208[_0x8a78('0x2a')]);_0x2c26d0[_0x8a78('0x2d')]=_[_0x8a78('0x2c')](_0x19c208[_0x8a78('0x27')],qs['fields'](_0x9054ee[_0x8a78('0x2a')][_0x8a78('0x2e')]));_0x2c26d0['attributes']=_0x2c26d0[_0x8a78('0x2d')]['length']?_0x2c26d0[_0x8a78('0x2d')]:_0x19c208[_0x8a78('0x27')];if(_0x9054ee[_0x8a78('0x2a')]['includeAll']){_0x2c26d0['include']=[{'all':!![]}];}_0x2c26d0=_[_0x8a78('0x2f')]({},_0x2c26d0,_0x9054ee['options']);return db[_0x8a78('0x30')][_0x8a78('0x31')](_0x2c26d0)[_0x8a78('0x21')](handleEntityNotFound(_0x370927,null))[_0x8a78('0x21')](respondWithResult(_0x370927,null))[_0x8a78('0x32')](handleError(_0x370927,null));};exports['update']=function(_0x46ea2a,_0x1288a5){if(_0x46ea2a[_0x8a78('0x33')]['id']){delete _0x46ea2a[_0x8a78('0x33')]['id'];}return db[_0x8a78('0x30')]['find']({'where':{'id':_0x46ea2a[_0x8a78('0x34')]['id']}})[_0x8a78('0x21')](handleEntityNotFound(_0x1288a5,null))[_0x8a78('0x21')](saveUpdates(_0x46ea2a['body'],null))[_0x8a78('0x21')](respondWithResult(_0x1288a5,null))[_0x8a78('0x32')](handleError(_0x1288a5,null));};exports[_0x8a78('0x22')]=function(_0x4e1e58,_0x59a03f){return db['ChatApplication']['find']({'where':{'id':_0x4e1e58[_0x8a78('0x34')]['id']}})[_0x8a78('0x21')](handleEntityNotFound(_0x59a03f,null))[_0x8a78('0x21')](removeEntity(_0x59a03f,null))[_0x8a78('0x32')](handleError(_0x59a03f,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index cf1f6a1..f94f86a 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 _0xba91=['request-promise','rimraf','./chatApplication.attributes','exports','define','chat_applications','utf8mb4','lodash','../../config/logger','api','moment'];(function(_0x4e00ee,_0x1b59a4){var _0x1777ef=function(_0x100880){while(--_0x100880){_0x4e00ee['push'](_0x4e00ee['shift']());}};_0x1777ef(++_0x1b59a4);}(_0xba91,0xac));var _0x1ba9=function(_0x5c8d34,_0x342d14){_0x5c8d34=_0x5c8d34-0x0;var _0x10cecb=_0xba91[_0x5c8d34];return _0x10cecb;};'use strict';var _=require(_0x1ba9('0x0'));var util=require('util');var logger=require(_0x1ba9('0x1'))(_0x1ba9('0x2'));var moment=require(_0x1ba9('0x3'));var BPromise=require('bluebird');var rp=require(_0x1ba9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1ba9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1ba9('0x6'));module[_0x1ba9('0x7')]=function(_0x20a5e4,_0x5b7b79){return _0x20a5e4[_0x1ba9('0x8')]('ChatApplication',attributes,{'tableName':_0x1ba9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1ba9('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8d4c=['../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x4ed1d4,_0x512d9a){var _0x28e363=function(_0x2bdfb7){while(--_0x2bdfb7){_0x4ed1d4['push'](_0x4ed1d4['shift']());}};_0x28e363(++_0x512d9a);}(_0x8d4c,0x173));var _0xc8d4=function(_0x1e4dca,_0x44147a){_0x1e4dca=_0x1e4dca-0x0;var _0x355ca9=_0x8d4c[_0x1e4dca];return _0x355ca9;};'use strict';var _=require(_0xc8d4('0x0'));var util=require('util');var logger=require(_0xc8d4('0x1'))(_0xc8d4('0x2'));var moment=require(_0xc8d4('0x3'));var BPromise=require('bluebird');var rp=require(_0xc8d4('0x4'));var fs=require('fs');var path=require(_0xc8d4('0x5'));var rimraf=require(_0xc8d4('0x6'));var config=require(_0xc8d4('0x7'));var attributes=require(_0xc8d4('0x8'));module[_0xc8d4('0x9')]=function(_0x1838f5,_0x4258ec){return _0x1838f5[_0xc8d4('0xa')](_0xc8d4('0xb'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc8d4('0xc'),'collate':_0xc8d4('0xd')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 8499c06..1a57ef3 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 _0xfe46=['ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','http','then','info'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xfe46,0x1d7));var _0x6fe4=function(_0x228a7c,_0x752e07){_0x228a7c=_0x228a7c-0x0;var _0x22e811=_0xfe46[_0x228a7c];return _0x22e811;};'use strict';var _=require(_0x6fe4('0x0'));var util=require(_0x6fe4('0x1'));var moment=require(_0x6fe4('0x2'));var BPromise=require(_0x6fe4('0x3'));var rs=require(_0x6fe4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6fe4('0x5'))['db'];var utils=require(_0x6fe4('0x6'));var logger=require('../../config/logger')(_0x6fe4('0x7'));var config=require(_0x6fe4('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6fe4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x283467,_0x29201d,_0x433e5d){return new BPromise(function(_0x243cb0,_0x2d7a30){return client['request'](_0x283467,_0x433e5d)[_0x6fe4('0xa')](function(_0x12bb88){logger[_0x6fe4('0xb')](_0x6fe4('0xc'),_0x29201d,_0x6fe4('0xd'));logger[_0x6fe4('0xe')](_0x6fe4('0xf'),_0x29201d,_0x6fe4('0xd'),JSON[_0x6fe4('0x10')](_0x12bb88));if(_0x12bb88[_0x6fe4('0x11')]){if(_0x12bb88[_0x6fe4('0x11')][_0x6fe4('0x12')]===0x1f4){logger['error'](_0x6fe4('0xc'),_0x29201d,_0x12bb88[_0x6fe4('0x11')]['message']);return _0x2d7a30(_0x12bb88[_0x6fe4('0x11')]['message']);}logger['error'](_0x6fe4('0xc'),_0x29201d,_0x12bb88[_0x6fe4('0x11')]['message']);return _0x243cb0(_0x12bb88[_0x6fe4('0x11')][_0x6fe4('0x13')]);}else{logger[_0x6fe4('0xb')](_0x6fe4('0xc'),_0x29201d,'request\x20sent');_0x243cb0(_0x12bb88['result']['message']);}})[_0x6fe4('0x14')](function(_0x5e274c){logger[_0x6fe4('0x11')]('ChatApplication,\x20%s,\x20%s',_0x29201d,_0x5e274c);_0x2d7a30(_0x5e274c);});});} \ No newline at end of file +var _0x56b4=['util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ChatApplication,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','catch','lodash'];(function(_0x2ca794,_0x3e0030){var _0x27b67b=function(_0x40f96b){while(--_0x40f96b){_0x2ca794['push'](_0x2ca794['shift']());}};_0x27b67b(++_0x3e0030);}(_0x56b4,0x1cb));var _0x456b=function(_0x7f25b3,_0x286413){_0x7f25b3=_0x7f25b3-0x0;var _0xe148f4=_0x56b4[_0x7f25b3];return _0xe148f4;};'use strict';var _=require(_0x456b('0x0'));var util=require(_0x456b('0x1'));var moment=require(_0x456b('0x2'));var BPromise=require(_0x456b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x456b('0x4'));var db=require(_0x456b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x456b('0x6'))(_0x456b('0x7'));var config=require(_0x456b('0x8'));var jayson=require(_0x456b('0x9'));var client=jayson[_0x456b('0xa')][_0x456b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2c3868,_0x49c6fb,_0x4f65b3){return new BPromise(function(_0x4b19e,_0x5978c7){return client[_0x456b('0xc')](_0x2c3868,_0x4f65b3)[_0x456b('0xd')](function(_0x37206c){logger['info'](_0x456b('0xe'),_0x49c6fb,'request\x20sent');logger[_0x456b('0xf')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x49c6fb,_0x456b('0x10'),JSON[_0x456b('0x11')](_0x37206c));if(_0x37206c['error']){if(_0x37206c[_0x456b('0x12')][_0x456b('0x13')]===0x1f4){logger['error'](_0x456b('0xe'),_0x49c6fb,_0x37206c[_0x456b('0x12')][_0x456b('0x14')]);return _0x5978c7(_0x37206c[_0x456b('0x12')][_0x456b('0x14')]);}logger[_0x456b('0x12')]('ChatApplication,\x20%s,\x20%s',_0x49c6fb,_0x37206c[_0x456b('0x12')][_0x456b('0x14')]);return _0x4b19e(_0x37206c[_0x456b('0x12')][_0x456b('0x14')]);}else{logger[_0x456b('0x15')](_0x456b('0xe'),_0x49c6fb,_0x456b('0x10'));_0x4b19e(_0x37206c['result'][_0x456b('0x14')]);}})[_0x456b('0x16')](function(_0x23ae9e){logger[_0x456b('0x12')](_0x456b('0xe'),_0x49c6fb,_0x23ae9e);_0x5978c7(_0x23ae9e);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index ab2ee1f..38d6fdb 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 _0x4ee1=['put','update','delete','destroy','exports','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show'];(function(_0x24efc9,_0x44325b){var _0x3f92cc=function(_0x237fa3){while(--_0x237fa3){_0x24efc9['push'](_0x24efc9['shift']());}};_0x3f92cc(++_0x44325b);}(_0x4ee1,0x8c));var _0x14ee=function(_0x45ded9,_0x138893){_0x45ded9=_0x45ded9-0x0;var _0x23d3e8=_0x4ee1[_0x45ded9];return _0x23d3e8;};'use strict';var multer=require('multer');var util=require(_0x14ee('0x0'));var path=require(_0x14ee('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x14ee('0x2')]();var fs_extra=require(_0x14ee('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x14ee('0x4'));var config=require(_0x14ee('0x5'));var controller=require('./chatApplication.controller');router[_0x14ee('0x6')](_0x14ee('0x7'),auth[_0x14ee('0x8')](),controller[_0x14ee('0x9')]);router[_0x14ee('0xa')]('/:id',auth[_0x14ee('0x8')](),controller[_0x14ee('0xb')]);router[_0x14ee('0xc')](_0x14ee('0x7'),auth[_0x14ee('0x8')](),controller[_0x14ee('0xd')]);module[_0x14ee('0xe')]=router; \ No newline at end of file +var _0x4db0=['express','Router','../../components/interaction/service','../../config/environment','./chatApplication.controller','/:id','isAuthenticated','show','put','update','delete','exports','multer','util'];(function(_0x1aa9f3,_0x2f6cd4){var _0x53ef2f=function(_0x3ce1a3){while(--_0x3ce1a3){_0x1aa9f3['push'](_0x1aa9f3['shift']());}};_0x53ef2f(++_0x2f6cd4);}(_0x4db0,0x124));var _0x04db=function(_0x102789,_0x24217f){_0x102789=_0x102789-0x0;var _0x4aeb4f=_0x4db0[_0x102789];return _0x4aeb4f;};'use strict';var multer=require(_0x04db('0x0'));var util=require(_0x04db('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x04db('0x2'));var router=express[_0x04db('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x04db('0x4'));var config=require(_0x04db('0x5'));var controller=require(_0x04db('0x6'));router['get'](_0x04db('0x7'),auth[_0x04db('0x8')](),controller[_0x04db('0x9')]);router[_0x04db('0xa')]('/:id',auth[_0x04db('0x8')](),controller[_0x04db('0xb')]);router[_0x04db('0xc')](_0x04db('0x7'),auth[_0x04db('0x8')](),controller['destroy']);module[_0x04db('0xd')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 33d8525..4ed90f7 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 _0x0721=['BOOLEAN','exports','STRING'];(function(_0x1f057b,_0x37d729){var _0x13cb01=function(_0x3aa644){while(--_0x3aa644){_0x1f057b['push'](_0x1f057b['shift']());}};_0x13cb01(++_0x37d729);}(_0x0721,0x9d));var _0x1072=function(_0x50798b,_0x22ccf8){_0x50798b=_0x50798b-0x0;var _0x4b1d26=_0x0721[_0x50798b];return _0x4b1d26;};'use strict';var Sequelize=require('sequelize');module[_0x1072('0x0')]={'name':{'type':Sequelize[_0x1072('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x1072('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x4655=['sequelize','exports','STRING','BOOLEAN'];(function(_0x34896a,_0x3d94b5){var _0x5a3a02=function(_0x1e8e60){while(--_0x1e8e60){_0x34896a['push'](_0x34896a['shift']());}};_0x5a3a02(++_0x3d94b5);}(_0x4655,0x70));var _0x5465=function(_0x1613cc,_0x22772b){_0x1613cc=_0x1613cc-0x0;var _0x5bb337=_0x4655[_0x1613cc];return _0x5bb337;};'use strict';var Sequelize=require(_0x5465('0x0'));module[_0x5465('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x5465('0x2')]},'write':{'type':Sequelize[_0x5465('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 8153b86..b1ed22d 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 _0x5b4f=['../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','end','error','name','send','index','map','ChatGroup','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','include','findAll','rows','catch','show','params','rawAttributes','includeAll','options','find','create','body','describe','getUnread','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','removeMembers','addMessage','getMessages','ChatInternalMessage','$gte','format','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','fs-extra','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x5b4f,0x16f));var _0xf5b4=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x5b4f[_0x13b8f3];return _0x1a6d06;};'use strict';var emlformat=require(_0xf5b4('0x0'));var rimraf=require(_0xf5b4('0x1'));var zipdir=require(_0xf5b4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf5b4('0x3'));var moment=require('moment');var BPromise=require(_0xf5b4('0x4'));var Mustache=require(_0xf5b4('0x5'));var util=require(_0xf5b4('0x6'));var path=require('path');var sox=require(_0xf5b4('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf5b4('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf5b4('0x9'));var jsforce=require(_0xf5b4('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xf5b4('0xb'));var querystring=require(_0xf5b4('0xc'));var Papa=require('papaparse');var Redis=require(_0xf5b4('0xd'));var authService=require(_0xf5b4('0xe'));var qs=require(_0xf5b4('0xf'));var as=require(_0xf5b4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf5b4('0x11'))(_0xf5b4('0x12'));var utils=require('../../config/utils');var config=require(_0xf5b4('0x13'));var licenseUtil=require(_0xf5b4('0x14'));var db=require(_0xf5b4('0x15'))['db'];config[_0xf5b4('0x16')]=_[_0xf5b4('0x17')](config[_0xf5b4('0x16')],{'host':_0xf5b4('0x18'),'port':0x18eb});var socket=require(_0xf5b4('0x19'))(new Redis(config[_0xf5b4('0x16')]));require(_0xf5b4('0x1a'))[_0xf5b4('0x1b')](socket);function respondWithStatusCode(_0x5ba1fc,_0x186b15){_0x186b15=_0x186b15||0xcc;return function(_0x1ccd26){if(_0x1ccd26){return _0x5ba1fc[_0xf5b4('0x1c')](_0x186b15);}return _0x5ba1fc[_0xf5b4('0x1d')](_0x186b15)['end']();};}function respondWithResult(_0x2eef0b,_0x522a19){_0x522a19=_0x522a19||0xc8;return function(_0x3d972f){if(_0x3d972f){return _0x2eef0b['status'](_0x522a19)[_0xf5b4('0x1e')](_0x3d972f);}};}function respondWithFilteredResult(_0x55bae6,_0xafcac6){return function(_0x2e9c4c){if(_0x2e9c4c){var _0x598bbe=typeof _0xafcac6['offset']===_0xf5b4('0x1f')&&typeof _0xafcac6['limit']==='undefined';var _0x49b7d2=_0x2e9c4c[_0xf5b4('0x20')];var _0xd2d0d0=_0x598bbe?0x0:_0xafcac6[_0xf5b4('0x21')];var _0x1c1bce=_0x598bbe?_0x2e9c4c[_0xf5b4('0x20')]:_0xafcac6[_0xf5b4('0x21')]+_0xafcac6[_0xf5b4('0x22')];var _0x1c6248;if(_0x1c1bce>=_0x49b7d2){_0x1c1bce=_0x49b7d2;_0x1c6248=0xc8;}else{_0x1c6248=0xce;}_0x55bae6[_0xf5b4('0x1d')](_0x1c6248);return _0x55bae6[_0xf5b4('0x23')](_0xf5b4('0x24'),_0xd2d0d0+'-'+_0x1c1bce+'/'+_0x49b7d2)[_0xf5b4('0x1e')](_0x2e9c4c);}return null;};}function patchUpdates(_0xa9ac44){return function(_0x505397){try{jsonpatch['apply'](_0x505397,_0xa9ac44,!![]);}catch(_0x34f7c1){return BPromise[_0xf5b4('0x25')](_0x34f7c1);}return _0x505397[_0xf5b4('0x26')]();};}function saveUpdates(_0xd2ac04,_0x4225c3){return function(_0x403e00){if(_0x403e00){return _0x403e00[_0xf5b4('0x27')](_0xd2ac04)[_0xf5b4('0x28')](function(_0x505928){return _0x505928;});}return null;};}function removeEntity(_0x410dac,_0x213d13){return function(_0x27f3ab){if(_0x27f3ab){return _0x27f3ab[_0xf5b4('0x29')]()[_0xf5b4('0x28')](function(){_0x410dac['status'](0xcc)[_0xf5b4('0x2a')]();});}};}function handleEntityNotFound(_0x163557,_0x50d452){return function(_0x56bdff){if(!_0x56bdff){_0x163557[_0xf5b4('0x1c')](0x194);}return _0x56bdff;};}function handleError(_0x553200,_0x348a9c){_0x348a9c=_0x348a9c||0x1f4;return function(_0x330562){logger[_0xf5b4('0x2b')](_0x330562['stack']);if(_0x330562[_0xf5b4('0x2c')]){delete _0x330562[_0xf5b4('0x2c')];}_0x553200['status'](_0x348a9c)[_0xf5b4('0x2d')](_0x330562);};}exports[_0xf5b4('0x2e')]=function(_0x443b35,_0x401408){var _0x23ab64={},_0x392552={},_0x174a26={'count':0x0,'rows':[]};var _0x55b791=_[_0xf5b4('0x2f')](db[_0xf5b4('0x30')]['rawAttributes'],function(_0x34d6ce){return{'name':_0x34d6ce['fieldName'],'type':_0x34d6ce['type'][_0xf5b4('0x31')]};});_0x392552[_0xf5b4('0x32')]=_[_0xf5b4('0x2f')](_0x55b791,'name');_0x392552[_0xf5b4('0x33')]=_[_0xf5b4('0x34')](_0x443b35[_0xf5b4('0x33')]);_0x392552['filters']=_[_0xf5b4('0x35')](_0x392552['model'],_0x392552['query']);_0x23ab64[_0xf5b4('0x36')]=_['intersection'](_0x392552[_0xf5b4('0x32')],qs['fields'](_0x443b35[_0xf5b4('0x33')][_0xf5b4('0x37')]));_0x23ab64[_0xf5b4('0x36')]=_0x23ab64['attributes'][_0xf5b4('0x38')]?_0x23ab64[_0xf5b4('0x36')]:_0x392552[_0xf5b4('0x32')];if(!_0x443b35[_0xf5b4('0x33')][_0xf5b4('0x39')](_0xf5b4('0x3a'))){_0x23ab64['limit']=qs[_0xf5b4('0x22')](_0x443b35[_0xf5b4('0x33')][_0xf5b4('0x22')]);_0x23ab64[_0xf5b4('0x21')]=qs[_0xf5b4('0x21')](_0x443b35[_0xf5b4('0x33')]['offset']);}_0x23ab64[_0xf5b4('0x3b')]=qs[_0xf5b4('0x3c')](_0x443b35[_0xf5b4('0x33')][_0xf5b4('0x3c')]);_0x23ab64[_0xf5b4('0x3d')]=qs[_0xf5b4('0x3e')](_[_0xf5b4('0x3f')](_0x443b35[_0xf5b4('0x33')],_0x392552[_0xf5b4('0x3e')]),_0x55b791);if(_0x443b35[_0xf5b4('0x33')][_0xf5b4('0x40')]){_0x23ab64['where']=_['merge'](_0x23ab64[_0xf5b4('0x3d')],{'$or':_[_0xf5b4('0x2f')](_0x55b791,function(_0x3e9ffc){if(_0x3e9ffc[_0xf5b4('0x41')]!==_0xf5b4('0x42')){var _0x115a7f={};_0x115a7f[_0x3e9ffc['name']]={'$like':'%'+_0x443b35['query']['filter']+'%'};return _0x115a7f;}})});}_0x23ab64=_[_0xf5b4('0x43')]({},_0x23ab64,_0x443b35['options']);var _0x1d628e={'where':_0x23ab64[_0xf5b4('0x3d')]};return db[_0xf5b4('0x30')][_0xf5b4('0x20')](_0x1d628e)[_0xf5b4('0x28')](function(_0x25f969){_0x174a26['count']=_0x25f969;if(_0x443b35[_0xf5b4('0x33')]['includeAll']){_0x23ab64[_0xf5b4('0x44')]=[{'all':!![]}];}return db[_0xf5b4('0x30')][_0xf5b4('0x45')](_0x23ab64);})[_0xf5b4('0x28')](function(_0x55d7aa){_0x174a26[_0xf5b4('0x46')]=_0x55d7aa;return _0x174a26;})['then'](respondWithFilteredResult(_0x401408,_0x23ab64))[_0xf5b4('0x47')](handleError(_0x401408,null));};exports[_0xf5b4('0x48')]=function(_0x243e49,_0x2890af){var _0x1d6552={'raw':!![],'where':{'id':_0x243e49[_0xf5b4('0x49')]['id']}},_0x45f555={};_0x45f555[_0xf5b4('0x32')]=_[_0xf5b4('0x34')](db[_0xf5b4('0x30')][_0xf5b4('0x4a')]);_0x45f555[_0xf5b4('0x33')]=_['keys'](_0x243e49[_0xf5b4('0x33')]);_0x45f555[_0xf5b4('0x3e')]=_['intersection'](_0x45f555['model'],_0x45f555['query']);_0x1d6552[_0xf5b4('0x36')]=_['intersection'](_0x45f555['model'],qs['fields'](_0x243e49[_0xf5b4('0x33')][_0xf5b4('0x37')]));_0x1d6552[_0xf5b4('0x36')]=_0x1d6552['attributes']['length']?_0x1d6552[_0xf5b4('0x36')]:_0x45f555[_0xf5b4('0x32')];if(_0x243e49['query'][_0xf5b4('0x4b')]){_0x1d6552[_0xf5b4('0x44')]=[{'all':!![]}];}_0x1d6552=_[_0xf5b4('0x43')]({},_0x1d6552,_0x243e49[_0xf5b4('0x4c')]);return db['ChatGroup'][_0xf5b4('0x4d')](_0x1d6552)[_0xf5b4('0x28')](handleEntityNotFound(_0x2890af,null))[_0xf5b4('0x28')](respondWithResult(_0x2890af,null))['catch'](handleError(_0x2890af,null));};exports[_0xf5b4('0x4e')]=function(_0x587d36,_0x3c95d4){return db[_0xf5b4('0x30')][_0xf5b4('0x4e')](_0x587d36[_0xf5b4('0x4f')],{})[_0xf5b4('0x28')](respondWithResult(_0x3c95d4,0xc9))[_0xf5b4('0x47')](handleError(_0x3c95d4,null));};exports[_0xf5b4('0x27')]=function(_0x4e837c,_0x5a4dd1){if(_0x4e837c[_0xf5b4('0x4f')]['id']){delete _0x4e837c[_0xf5b4('0x4f')]['id'];}return db['ChatGroup'][_0xf5b4('0x4d')]({'where':{'id':_0x4e837c[_0xf5b4('0x49')]['id']}})[_0xf5b4('0x28')](handleEntityNotFound(_0x5a4dd1,null))['then'](saveUpdates(_0x4e837c[_0xf5b4('0x4f')],null))['then'](respondWithResult(_0x5a4dd1,null))['catch'](handleError(_0x5a4dd1,null));};exports[_0xf5b4('0x29')]=function(_0x47272d,_0x47a57c){return db[_0xf5b4('0x30')][_0xf5b4('0x4d')]({'where':{'id':_0x47272d[_0xf5b4('0x49')]['id']}})['then'](handleEntityNotFound(_0x47a57c,null))[_0xf5b4('0x28')](removeEntity(_0x47a57c,null))[_0xf5b4('0x47')](handleError(_0x47a57c,null));};exports[_0xf5b4('0x50')]=function(_0x5ec771,_0xda4d79){return db[_0xf5b4('0x30')][_0xf5b4('0x50')]()['then'](respondWithResult(_0xda4d79,null))[_0xf5b4('0x47')](handleError(_0xda4d79,null));};exports[_0xf5b4('0x51')]=function(_0x3d31be,_0x315e87,_0x338041){return db['ChatInternalMessage'][_0xf5b4('0x20')]({'where':{'ChatGroupId':_0x3d31be[_0xf5b4('0x49')]['id'],'ToId':_0x3d31be[_0xf5b4('0x52')]['id'],'read':![]}})[_0xf5b4('0x28')](function(_0x1d6623){return{'id':_[_0xf5b4('0x53')](_0x3d31be['params']['id']),'count':_0x1d6623};})[_0xf5b4('0x28')](respondWithResult(_0x315e87,null))[_0xf5b4('0x47')](handleError(_0x315e87,null));};exports[_0xf5b4('0x54')]=function(_0x23854e,_0x49696d,_0x485dba){return db[_0xf5b4('0x30')][_0xf5b4('0x4d')]({'where':{'id':_0x23854e[_0xf5b4('0x49')]['id']}})['then'](handleEntityNotFound(_0x49696d,null))[_0xf5b4('0x28')](function(_0x1db066){if(_0x1db066){return _0x1db066[_0xf5b4('0x54')](_0x23854e[_0xf5b4('0x4f')][_0xf5b4('0x55')],_[_0xf5b4('0x56')](_0x23854e['body'],[_0xf5b4('0x55'),'id'])||{});}})[_0xf5b4('0x28')](respondWithResult(_0x49696d,null))[_0xf5b4('0x47')](handleError(_0x49696d,null));};exports[_0xf5b4('0x57')]=function(_0x266d64,_0x3fbb2a,_0x370114){var _0x358e0d={};var _0x2e9011={};var _0x56815d;var _0x31177a;return db['ChatGroup'][_0xf5b4('0x58')]({'where':{'id':_0x266d64[_0xf5b4('0x49')]['id']}})[_0xf5b4('0x28')](handleEntityNotFound(_0x3fbb2a,null))[_0xf5b4('0x28')](function(_0x492370){if(_0x492370){_0x56815d=_0x492370;_0x2e9011[_0xf5b4('0x32')]=_[_0xf5b4('0x34')](db[_0xf5b4('0x59')][_0xf5b4('0x4a')]);_0x2e9011[_0xf5b4('0x33')]=_[_0xf5b4('0x34')](_0x266d64['query']);_0x2e9011['filters']=_[_0xf5b4('0x35')](_0x2e9011[_0xf5b4('0x32')],_0x2e9011['query']);_0x358e0d[_0xf5b4('0x36')]=_[_0xf5b4('0x35')](_0x2e9011[_0xf5b4('0x32')],qs['fields'](_0x266d64[_0xf5b4('0x33')]['fields']));_0x358e0d[_0xf5b4('0x36')]=_0x358e0d[_0xf5b4('0x36')]['length']?_0x358e0d[_0xf5b4('0x36')]:_0x2e9011[_0xf5b4('0x32')];_0x358e0d[_0xf5b4('0x3b')]=qs[_0xf5b4('0x3c')](_0x266d64[_0xf5b4('0x33')][_0xf5b4('0x3c')]);_0x358e0d[_0xf5b4('0x3d')]=qs[_0xf5b4('0x3e')](_[_0xf5b4('0x3f')](_0x266d64['query'],_0x2e9011['filters']));if(_0x266d64['query'][_0xf5b4('0x40')]){_0x358e0d[_0xf5b4('0x3d')]=_[_0xf5b4('0x43')](_0x358e0d[_0xf5b4('0x3d')],{'$or':_['map'](_0x358e0d[_0xf5b4('0x36')],function(_0x436a70){var _0x9b79b5={};_0x9b79b5[_0x436a70]={'$like':'%'+_0x266d64[_0xf5b4('0x33')][_0xf5b4('0x40')]+'%'};return _0x9b79b5;})});}_0x358e0d=_[_0xf5b4('0x43')]({},_0x358e0d,_0x266d64[_0xf5b4('0x4c')]);return _0x56815d[_0xf5b4('0x57')](_0x358e0d);}})['then'](function(_0x4df36b){if(_0x4df36b){_0x31177a=_0x4df36b['length'];if(!_0x266d64[_0xf5b4('0x33')][_0xf5b4('0x39')](_0xf5b4('0x3a'))){_0x358e0d[_0xf5b4('0x22')]=qs['limit'](_0x266d64[_0xf5b4('0x33')][_0xf5b4('0x22')]);_0x358e0d['offset']=qs[_0xf5b4('0x21')](_0x266d64[_0xf5b4('0x33')]['offset']);}return _0x56815d['getMembers'](_0x358e0d);}})['then'](function(_0x3cffb3){if(_0x3cffb3){return _0x3cffb3?{'count':_0x31177a,'rows':_0x3cffb3}:null;}})[_0xf5b4('0x28')](respondWithResult(_0x3fbb2a,null))['catch'](handleError(_0x3fbb2a,null));};exports[_0xf5b4('0x5a')]=function(_0x122972,_0x2e0eb4,_0x19de99){return db[_0xf5b4('0x30')][_0xf5b4('0x4d')]({'where':{'id':_0x122972[_0xf5b4('0x49')]['id']}})[_0xf5b4('0x28')](handleEntityNotFound(_0x2e0eb4,null))[_0xf5b4('0x28')](function(_0x58a959){if(_0x58a959){return _0x58a959[_0xf5b4('0x5a')](_0x122972[_0xf5b4('0x33')][_0xf5b4('0x55')]);}})[_0xf5b4('0x28')](respondWithStatusCode(_0x2e0eb4,null))[_0xf5b4('0x47')](handleError(_0x2e0eb4,null));};exports[_0xf5b4('0x5b')]=function(_0x79a50a,_0x3ce68d,_0x5d5f9f){if(_0x79a50a[_0xf5b4('0x4f')]['id']){delete _0x79a50a[_0xf5b4('0x4f')]['id'];}return db[_0xf5b4('0x30')]['find']({'where':{'id':_0x79a50a['params']['id']}})[_0xf5b4('0x28')](handleEntityNotFound(_0x3ce68d,null))[_0xf5b4('0x28')](function(_0x561353){if(_0x561353){_0x79a50a[_0xf5b4('0x4f')]['ChatGroupId']=_0x561353['id'];return db['ChatInternalMessage'][_0xf5b4('0x4e')](_0x79a50a[_0xf5b4('0x4f')]);}})[_0xf5b4('0x28')](respondWithResult(_0x3ce68d,null))[_0xf5b4('0x47')](handleError(_0x3ce68d,null));};exports[_0xf5b4('0x5c')]=function(_0x1dad16,_0x51005e,_0x3600f4){var _0x3f5e85={};var _0x348bdf={};var _0x18c092;var _0x508e9e;return db[_0xf5b4('0x30')]['findOne']({'where':{'id':_0x1dad16[_0xf5b4('0x49')]['id']}})['then'](handleEntityNotFound(_0x51005e,null))[_0xf5b4('0x28')](function(_0x1474c6){if(_0x1474c6){_0x18c092=_0x1474c6;_0x348bdf['model']=_[_0xf5b4('0x34')](db[_0xf5b4('0x5d')]['rawAttributes']);_0x348bdf['query']=_['keys'](_0x1dad16['query']);_0x348bdf[_0xf5b4('0x3e')]=_[_0xf5b4('0x35')](_0x348bdf['model'],_0x348bdf[_0xf5b4('0x33')]);_0x3f5e85[_0xf5b4('0x36')]=_[_0xf5b4('0x35')](_0x348bdf[_0xf5b4('0x32')],qs[_0xf5b4('0x37')](_0x1dad16['query'][_0xf5b4('0x37')]));_0x3f5e85['attributes']=_0x3f5e85['attributes'][_0xf5b4('0x38')]?_0x3f5e85[_0xf5b4('0x36')]:_0x348bdf[_0xf5b4('0x32')];_0x3f5e85[_0xf5b4('0x3b')]=qs['sort'](_0x1dad16['query']['sort']);_0x3f5e85['where']=qs[_0xf5b4('0x3e')](_[_0xf5b4('0x3f')](_0x1dad16[_0xf5b4('0x33')],_0x348bdf['filters']));if(_0x1dad16[_0xf5b4('0x33')]['filter']){_0x3f5e85[_0xf5b4('0x3d')]=_[_0xf5b4('0x43')](_0x3f5e85[_0xf5b4('0x3d')],{'$or':_['map'](_0x3f5e85[_0xf5b4('0x36')],function(_0x191d5c){var _0x39c62b={};_0x39c62b[_0x191d5c]={'$like':'%'+_0x1dad16[_0xf5b4('0x33')][_0xf5b4('0x40')]+'%'};return _0x39c62b;})});}if(_0x1dad16[_0xf5b4('0x33')]['$gte']){var _0x47ec9f=_0x1dad16[_0xf5b4('0x33')][_0xf5b4('0x5e')]['split'](',');var _0x277a33={};_0x277a33[_0x47ec9f[0x0]]={'$gte':moment(_0x47ec9f[0x1])[_0xf5b4('0x5f')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3f5e85['where']=_['merge'](_0x3f5e85[_0xf5b4('0x3d')],_0x277a33);}_0x3f5e85=_[_0xf5b4('0x43')]({},_0x3f5e85,_0x1dad16[_0xf5b4('0x4c')]);return _0x18c092[_0xf5b4('0x5c')](_0x3f5e85);}})[_0xf5b4('0x28')](function(_0x2e8e81){if(_0x2e8e81){_0x508e9e=_0x2e8e81['length'];if(!_0x1dad16[_0xf5b4('0x33')][_0xf5b4('0x39')](_0xf5b4('0x3a'))){_0x3f5e85[_0xf5b4('0x22')]=qs[_0xf5b4('0x22')](_0x1dad16[_0xf5b4('0x33')][_0xf5b4('0x22')]);_0x3f5e85[_0xf5b4('0x21')]=qs[_0xf5b4('0x21')](_0x1dad16['query'][_0xf5b4('0x21')]);}return _0x18c092[_0xf5b4('0x5c')](_0x3f5e85);}})[_0xf5b4('0x28')](function(_0x380e8d){if(_0x380e8d){return _0x380e8d?{'count':_0x508e9e,'rows':_0x380e8d}:null;}})['then'](respondWithResult(_0x51005e,null))[_0xf5b4('0x47')](handleError(_0x51005e,null));}; \ No newline at end of file +var _0x33a3=['sendStatus','status','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','end','error','stack','name','send','index','map','ChatGroup','rawAttributes','fieldName','type','key','query','keys','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','include','create','body','params','find','describe','getUnread','ChatInternalMessage','user','addMembers','ids','omit','getMembers','findOne','User','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatGroup.socket','register'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x33a3,0x1d7));var _0x333a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x33a3[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x333a('0x0'));var rimraf=require(_0x333a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x333a('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x333a('0x3'));var Mustache=require(_0x333a('0x4'));var util=require(_0x333a('0x5'));var path=require('path');var sox=require(_0x333a('0x6'));var csv=require(_0x333a('0x7'));var ejs=require(_0x333a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x333a('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x333a('0xa'));var deskjs=require(_0x333a('0xb'));var toCsv=require(_0x333a('0x7'));var querystring=require(_0x333a('0xc'));var Papa=require(_0x333a('0xd'));var Redis=require('ioredis');var authService=require(_0x333a('0xe'));var qs=require(_0x333a('0xf'));var as=require(_0x333a('0x10'));var hardwareService=require(_0x333a('0x11'));var logger=require(_0x333a('0x12'))(_0x333a('0x13'));var utils=require(_0x333a('0x14'));var config=require(_0x333a('0x15'));var licenseUtil=require(_0x333a('0x16'));var db=require(_0x333a('0x17'))['db'];config[_0x333a('0x18')]=_['defaults'](config[_0x333a('0x18')],{'host':_0x333a('0x19'),'port':0x18eb});var socket=require(_0x333a('0x1a'))(new Redis(config['redis']));require(_0x333a('0x1b'))[_0x333a('0x1c')](socket);function respondWithStatusCode(_0xfe222b,_0x3cafd7){_0x3cafd7=_0x3cafd7||0xcc;return function(_0x5d431c){if(_0x5d431c){return _0xfe222b[_0x333a('0x1d')](_0x3cafd7);}return _0xfe222b[_0x333a('0x1e')](_0x3cafd7)['end']();};}function respondWithResult(_0x5dc99f,_0x2ddb0b){_0x2ddb0b=_0x2ddb0b||0xc8;return function(_0x290ad2){if(_0x290ad2){return _0x5dc99f['status'](_0x2ddb0b)[_0x333a('0x1f')](_0x290ad2);}};}function respondWithFilteredResult(_0xaae743,_0x28a4b5){return function(_0x29db3c){if(_0x29db3c){var _0x4844b9=typeof _0x28a4b5[_0x333a('0x20')]===_0x333a('0x21')&&typeof _0x28a4b5[_0x333a('0x22')]===_0x333a('0x21');var _0x1744aa=_0x29db3c[_0x333a('0x23')];var _0x28fcfe=_0x4844b9?0x0:_0x28a4b5[_0x333a('0x20')];var _0xe51adf=_0x4844b9?_0x29db3c[_0x333a('0x23')]:_0x28a4b5['offset']+_0x28a4b5['limit'];var _0x56b0e1;if(_0xe51adf>=_0x1744aa){_0xe51adf=_0x1744aa;_0x56b0e1=0xc8;}else{_0x56b0e1=0xce;}_0xaae743[_0x333a('0x1e')](_0x56b0e1);return _0xaae743[_0x333a('0x24')]('Content-Range',_0x28fcfe+'-'+_0xe51adf+'/'+_0x1744aa)['json'](_0x29db3c);}return null;};}function patchUpdates(_0x2e3a18){return function(_0x6d9852){try{jsonpatch['apply'](_0x6d9852,_0x2e3a18,!![]);}catch(_0x365426){return BPromise[_0x333a('0x25')](_0x365426);}return _0x6d9852[_0x333a('0x26')]();};}function saveUpdates(_0x49e85a,_0x2aada6){return function(_0xf2f9a){if(_0xf2f9a){return _0xf2f9a[_0x333a('0x27')](_0x49e85a)[_0x333a('0x28')](function(_0x2fddff){return _0x2fddff;});}return null;};}function removeEntity(_0x2cadaa,_0x32c7c8){return function(_0x476d02){if(_0x476d02){return _0x476d02[_0x333a('0x29')]()[_0x333a('0x28')](function(){_0x2cadaa[_0x333a('0x1e')](0xcc)[_0x333a('0x2a')]();});}};}function handleEntityNotFound(_0x4a1c14,_0x2dd4a2){return function(_0x253d41){if(!_0x253d41){_0x4a1c14[_0x333a('0x1d')](0x194);}return _0x253d41;};}function handleError(_0x59d535,_0x4cdd84){_0x4cdd84=_0x4cdd84||0x1f4;return function(_0x5be71f){logger[_0x333a('0x2b')](_0x5be71f[_0x333a('0x2c')]);if(_0x5be71f[_0x333a('0x2d')]){delete _0x5be71f[_0x333a('0x2d')];}_0x59d535[_0x333a('0x1e')](_0x4cdd84)[_0x333a('0x2e')](_0x5be71f);};}exports[_0x333a('0x2f')]=function(_0x5d09b3,_0x460418){var _0x4815ae={},_0x23e3b3={},_0x3ed64f={'count':0x0,'rows':[]};var _0x4fbad5=_[_0x333a('0x30')](db[_0x333a('0x31')][_0x333a('0x32')],function(_0x1f9264){return{'name':_0x1f9264[_0x333a('0x33')],'type':_0x1f9264[_0x333a('0x34')][_0x333a('0x35')]};});_0x23e3b3['model']=_[_0x333a('0x30')](_0x4fbad5,'name');_0x23e3b3[_0x333a('0x36')]=_[_0x333a('0x37')](_0x5d09b3[_0x333a('0x36')]);_0x23e3b3['filters']=_[_0x333a('0x38')](_0x23e3b3['model'],_0x23e3b3['query']);_0x4815ae['attributes']=_[_0x333a('0x38')](_0x23e3b3['model'],qs[_0x333a('0x39')](_0x5d09b3[_0x333a('0x36')]['fields']));_0x4815ae[_0x333a('0x3a')]=_0x4815ae[_0x333a('0x3a')][_0x333a('0x3b')]?_0x4815ae['attributes']:_0x23e3b3[_0x333a('0x3c')];if(!_0x5d09b3[_0x333a('0x36')][_0x333a('0x3d')](_0x333a('0x3e'))){_0x4815ae[_0x333a('0x22')]=qs['limit'](_0x5d09b3[_0x333a('0x36')][_0x333a('0x22')]);_0x4815ae['offset']=qs['offset'](_0x5d09b3[_0x333a('0x36')][_0x333a('0x20')]);}_0x4815ae[_0x333a('0x3f')]=qs[_0x333a('0x40')](_0x5d09b3[_0x333a('0x36')]['sort']);_0x4815ae[_0x333a('0x41')]=qs[_0x333a('0x42')](_[_0x333a('0x43')](_0x5d09b3['query'],_0x23e3b3[_0x333a('0x42')]),_0x4fbad5);if(_0x5d09b3[_0x333a('0x36')][_0x333a('0x44')]){_0x4815ae[_0x333a('0x41')]=_[_0x333a('0x45')](_0x4815ae[_0x333a('0x41')],{'$or':_[_0x333a('0x30')](_0x4fbad5,function(_0x420b97){if(_0x420b97[_0x333a('0x34')]!==_0x333a('0x46')){var _0x5e9369={};_0x5e9369[_0x420b97[_0x333a('0x2d')]]={'$like':'%'+_0x5d09b3[_0x333a('0x36')]['filter']+'%'};return _0x5e9369;}})});}_0x4815ae=_[_0x333a('0x45')]({},_0x4815ae,_0x5d09b3[_0x333a('0x47')]);var _0x3f9ed8={'where':_0x4815ae['where']};return db[_0x333a('0x31')]['count'](_0x3f9ed8)[_0x333a('0x28')](function(_0x25447e){_0x3ed64f[_0x333a('0x23')]=_0x25447e;if(_0x5d09b3['query'][_0x333a('0x48')]){_0x4815ae['include']=[{'all':!![]}];}return db['ChatGroup'][_0x333a('0x49')](_0x4815ae);})[_0x333a('0x28')](function(_0x23b14f){_0x3ed64f[_0x333a('0x4a')]=_0x23b14f;return _0x3ed64f;})['then'](respondWithFilteredResult(_0x460418,_0x4815ae))[_0x333a('0x4b')](handleError(_0x460418,null));};exports[_0x333a('0x4c')]=function(_0x52a8c8,_0x2f060e){var _0x57d3d5={'raw':!![],'where':{'id':_0x52a8c8['params']['id']}},_0x293dab={};_0x293dab[_0x333a('0x3c')]=_['keys'](db[_0x333a('0x31')][_0x333a('0x32')]);_0x293dab[_0x333a('0x36')]=_['keys'](_0x52a8c8[_0x333a('0x36')]);_0x293dab['filters']=_['intersection'](_0x293dab[_0x333a('0x3c')],_0x293dab[_0x333a('0x36')]);_0x57d3d5['attributes']=_['intersection'](_0x293dab[_0x333a('0x3c')],qs['fields'](_0x52a8c8[_0x333a('0x36')][_0x333a('0x39')]));_0x57d3d5[_0x333a('0x3a')]=_0x57d3d5['attributes']['length']?_0x57d3d5[_0x333a('0x3a')]:_0x293dab[_0x333a('0x3c')];if(_0x52a8c8['query']['includeAll']){_0x57d3d5[_0x333a('0x4d')]=[{'all':!![]}];}_0x57d3d5=_[_0x333a('0x45')]({},_0x57d3d5,_0x52a8c8[_0x333a('0x47')]);return db[_0x333a('0x31')]['find'](_0x57d3d5)[_0x333a('0x28')](handleEntityNotFound(_0x2f060e,null))[_0x333a('0x28')](respondWithResult(_0x2f060e,null))[_0x333a('0x4b')](handleError(_0x2f060e,null));};exports[_0x333a('0x4e')]=function(_0x47a14c,_0xa58f33){return db[_0x333a('0x31')][_0x333a('0x4e')](_0x47a14c[_0x333a('0x4f')],{})[_0x333a('0x28')](respondWithResult(_0xa58f33,0xc9))[_0x333a('0x4b')](handleError(_0xa58f33,null));};exports['update']=function(_0x58cf04,_0x1b71cd){if(_0x58cf04[_0x333a('0x4f')]['id']){delete _0x58cf04[_0x333a('0x4f')]['id'];}return db[_0x333a('0x31')]['find']({'where':{'id':_0x58cf04[_0x333a('0x50')]['id']}})[_0x333a('0x28')](handleEntityNotFound(_0x1b71cd,null))[_0x333a('0x28')](saveUpdates(_0x58cf04[_0x333a('0x4f')],null))[_0x333a('0x28')](respondWithResult(_0x1b71cd,null))['catch'](handleError(_0x1b71cd,null));};exports[_0x333a('0x29')]=function(_0x434d56,_0x1fb36e){return db[_0x333a('0x31')][_0x333a('0x51')]({'where':{'id':_0x434d56[_0x333a('0x50')]['id']}})[_0x333a('0x28')](handleEntityNotFound(_0x1fb36e,null))[_0x333a('0x28')](removeEntity(_0x1fb36e,null))[_0x333a('0x4b')](handleError(_0x1fb36e,null));};exports[_0x333a('0x52')]=function(_0xf729ad,_0x492abe){return db[_0x333a('0x31')]['describe']()[_0x333a('0x28')](respondWithResult(_0x492abe,null))[_0x333a('0x4b')](handleError(_0x492abe,null));};exports[_0x333a('0x53')]=function(_0x1630d8,_0x57833f,_0x1eef68){return db[_0x333a('0x54')][_0x333a('0x23')]({'where':{'ChatGroupId':_0x1630d8['params']['id'],'ToId':_0x1630d8[_0x333a('0x55')]['id'],'read':![]}})[_0x333a('0x28')](function(_0x597114){return{'id':_['toInteger'](_0x1630d8[_0x333a('0x50')]['id']),'count':_0x597114};})['then'](respondWithResult(_0x57833f,null))[_0x333a('0x4b')](handleError(_0x57833f,null));};exports[_0x333a('0x56')]=function(_0x937316,_0x3d0532,_0x4fcbeb){return db[_0x333a('0x31')][_0x333a('0x51')]({'where':{'id':_0x937316[_0x333a('0x50')]['id']}})[_0x333a('0x28')](handleEntityNotFound(_0x3d0532,null))[_0x333a('0x28')](function(_0x595f6e){if(_0x595f6e){return _0x595f6e['addMembers'](_0x937316[_0x333a('0x4f')][_0x333a('0x57')],_[_0x333a('0x58')](_0x937316[_0x333a('0x4f')],['ids','id'])||{});}})[_0x333a('0x28')](respondWithResult(_0x3d0532,null))[_0x333a('0x4b')](handleError(_0x3d0532,null));};exports[_0x333a('0x59')]=function(_0x2e7ed3,_0x46bd87,_0x3be178){var _0x180fcd={};var _0x3933ba={};var _0xb95db1;var _0x3981dd;return db[_0x333a('0x31')][_0x333a('0x5a')]({'where':{'id':_0x2e7ed3['params']['id']}})[_0x333a('0x28')](handleEntityNotFound(_0x46bd87,null))[_0x333a('0x28')](function(_0x418bfd){if(_0x418bfd){_0xb95db1=_0x418bfd;_0x3933ba['model']=_[_0x333a('0x37')](db[_0x333a('0x5b')][_0x333a('0x32')]);_0x3933ba[_0x333a('0x36')]=_[_0x333a('0x37')](_0x2e7ed3[_0x333a('0x36')]);_0x3933ba[_0x333a('0x42')]=_[_0x333a('0x38')](_0x3933ba[_0x333a('0x3c')],_0x3933ba[_0x333a('0x36')]);_0x180fcd[_0x333a('0x3a')]=_['intersection'](_0x3933ba[_0x333a('0x3c')],qs[_0x333a('0x39')](_0x2e7ed3[_0x333a('0x36')][_0x333a('0x39')]));_0x180fcd[_0x333a('0x3a')]=_0x180fcd[_0x333a('0x3a')][_0x333a('0x3b')]?_0x180fcd[_0x333a('0x3a')]:_0x3933ba[_0x333a('0x3c')];_0x180fcd[_0x333a('0x3f')]=qs[_0x333a('0x40')](_0x2e7ed3[_0x333a('0x36')][_0x333a('0x40')]);_0x180fcd[_0x333a('0x41')]=qs['filters'](_[_0x333a('0x43')](_0x2e7ed3[_0x333a('0x36')],_0x3933ba['filters']));if(_0x2e7ed3[_0x333a('0x36')][_0x333a('0x44')]){_0x180fcd[_0x333a('0x41')]=_[_0x333a('0x45')](_0x180fcd['where'],{'$or':_[_0x333a('0x30')](_0x180fcd[_0x333a('0x3a')],function(_0x4b678c){var _0x17447d={};_0x17447d[_0x4b678c]={'$like':'%'+_0x2e7ed3[_0x333a('0x36')][_0x333a('0x44')]+'%'};return _0x17447d;})});}_0x180fcd=_[_0x333a('0x45')]({},_0x180fcd,_0x2e7ed3[_0x333a('0x47')]);return _0xb95db1['getMembers'](_0x180fcd);}})[_0x333a('0x28')](function(_0x23525a){if(_0x23525a){_0x3981dd=_0x23525a[_0x333a('0x3b')];if(!_0x2e7ed3[_0x333a('0x36')][_0x333a('0x3d')](_0x333a('0x3e'))){_0x180fcd[_0x333a('0x22')]=qs[_0x333a('0x22')](_0x2e7ed3[_0x333a('0x36')][_0x333a('0x22')]);_0x180fcd[_0x333a('0x20')]=qs[_0x333a('0x20')](_0x2e7ed3[_0x333a('0x36')][_0x333a('0x20')]);}return _0xb95db1[_0x333a('0x59')](_0x180fcd);}})[_0x333a('0x28')](function(_0xa3760c){if(_0xa3760c){return _0xa3760c?{'count':_0x3981dd,'rows':_0xa3760c}:null;}})[_0x333a('0x28')](respondWithResult(_0x46bd87,null))['catch'](handleError(_0x46bd87,null));};exports[_0x333a('0x5c')]=function(_0x792d2d,_0x44d695,_0x182cd9){return db[_0x333a('0x31')][_0x333a('0x51')]({'where':{'id':_0x792d2d['params']['id']}})[_0x333a('0x28')](handleEntityNotFound(_0x44d695,null))[_0x333a('0x28')](function(_0x1e153d){if(_0x1e153d){return _0x1e153d[_0x333a('0x5c')](_0x792d2d['query'][_0x333a('0x57')]);}})['then'](respondWithStatusCode(_0x44d695,null))['catch'](handleError(_0x44d695,null));};exports[_0x333a('0x5d')]=function(_0x285d29,_0x3646e4,_0x244f1c){if(_0x285d29[_0x333a('0x4f')]['id']){delete _0x285d29[_0x333a('0x4f')]['id'];}return db[_0x333a('0x31')][_0x333a('0x51')]({'where':{'id':_0x285d29[_0x333a('0x50')]['id']}})[_0x333a('0x28')](handleEntityNotFound(_0x3646e4,null))[_0x333a('0x28')](function(_0x5483f0){if(_0x5483f0){_0x285d29[_0x333a('0x4f')][_0x333a('0x5e')]=_0x5483f0['id'];return db[_0x333a('0x54')][_0x333a('0x4e')](_0x285d29['body']);}})['then'](respondWithResult(_0x3646e4,null))[_0x333a('0x4b')](handleError(_0x3646e4,null));};exports[_0x333a('0x5f')]=function(_0x2e86a4,_0x331a43,_0x34163a){var _0x3d3a93={};var _0x561905={};var _0x53271b;var _0x2eacd0;return db[_0x333a('0x31')][_0x333a('0x5a')]({'where':{'id':_0x2e86a4[_0x333a('0x50')]['id']}})[_0x333a('0x28')](handleEntityNotFound(_0x331a43,null))['then'](function(_0x2cfeac){if(_0x2cfeac){_0x53271b=_0x2cfeac;_0x561905[_0x333a('0x3c')]=_[_0x333a('0x37')](db[_0x333a('0x54')][_0x333a('0x32')]);_0x561905[_0x333a('0x36')]=_[_0x333a('0x37')](_0x2e86a4[_0x333a('0x36')]);_0x561905[_0x333a('0x42')]=_['intersection'](_0x561905[_0x333a('0x3c')],_0x561905[_0x333a('0x36')]);_0x3d3a93[_0x333a('0x3a')]=_[_0x333a('0x38')](_0x561905['model'],qs['fields'](_0x2e86a4[_0x333a('0x36')][_0x333a('0x39')]));_0x3d3a93[_0x333a('0x3a')]=_0x3d3a93[_0x333a('0x3a')][_0x333a('0x3b')]?_0x3d3a93['attributes']:_0x561905[_0x333a('0x3c')];_0x3d3a93[_0x333a('0x3f')]=qs[_0x333a('0x40')](_0x2e86a4[_0x333a('0x36')][_0x333a('0x40')]);_0x3d3a93['where']=qs[_0x333a('0x42')](_[_0x333a('0x43')](_0x2e86a4[_0x333a('0x36')],_0x561905['filters']));if(_0x2e86a4[_0x333a('0x36')]['filter']){_0x3d3a93[_0x333a('0x41')]=_['merge'](_0x3d3a93[_0x333a('0x41')],{'$or':_['map'](_0x3d3a93['attributes'],function(_0x3149c2){var _0x120c7d={};_0x120c7d[_0x3149c2]={'$like':'%'+_0x2e86a4['query'][_0x333a('0x44')]+'%'};return _0x120c7d;})});}if(_0x2e86a4[_0x333a('0x36')][_0x333a('0x60')]){var _0x125206=_0x2e86a4[_0x333a('0x36')][_0x333a('0x60')][_0x333a('0x61')](',');var _0x570664={};_0x570664[_0x125206[0x0]]={'$gte':moment(_0x125206[0x1])[_0x333a('0x62')](_0x333a('0x63'))};_0x3d3a93['where']=_[_0x333a('0x45')](_0x3d3a93[_0x333a('0x41')],_0x570664);}_0x3d3a93=_[_0x333a('0x45')]({},_0x3d3a93,_0x2e86a4[_0x333a('0x47')]);return _0x53271b[_0x333a('0x5f')](_0x3d3a93);}})[_0x333a('0x28')](function(_0x19584e){if(_0x19584e){_0x2eacd0=_0x19584e['length'];if(!_0x2e86a4[_0x333a('0x36')][_0x333a('0x3d')]('nolimit')){_0x3d3a93['limit']=qs['limit'](_0x2e86a4[_0x333a('0x36')]['limit']);_0x3d3a93[_0x333a('0x20')]=qs[_0x333a('0x20')](_0x2e86a4[_0x333a('0x36')][_0x333a('0x20')]);}return _0x53271b[_0x333a('0x5f')](_0x3d3a93);}})[_0x333a('0x28')](function(_0x6e6631){if(_0x6e6631){return _0x6e6631?{'count':_0x2eacd0,'rows':_0x6e6631}:null;}})[_0x333a('0x28')](respondWithResult(_0x331a43,null))[_0x333a('0x4b')](handleError(_0x331a43,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index af2bfad..f70d8de 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 _0xe3a5=['../../mysqldb','ChatGroup','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x2e3f06,_0x14f1d3){var _0x278a06=function(_0x51e0b0){while(--_0x51e0b0){_0x2e3f06['push'](_0x2e3f06['shift']());}};_0x278a06(++_0x14f1d3);}(_0xe3a5,0x127));var _0x5e3a=function(_0x4df4de,_0x1a6c46){_0x4df4de=_0x4df4de-0x0;var _0x342f7c=_0xe3a5[_0x4df4de];return _0x342f7c;};'use strict';var EventEmitter=require(_0x5e3a('0x0'));var ChatGroup=require(_0x5e3a('0x1'))['db'][_0x5e3a('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x5e3a('0x3'),'afterDestroy':_0x5e3a('0x4')};function emitEvent(_0x1e867c){return function(_0x597a22,_0x40aa58,_0x30f110){ChatGroupEvents[_0x5e3a('0x5')](_0x1e867c+':'+_0x597a22['id'],_0x597a22);ChatGroupEvents[_0x5e3a('0x5')](_0x1e867c,_0x597a22);_0x30f110(null);};}for(var e in events){if(events[_0x5e3a('0x6')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x5e3a('0x7')]=ChatGroupEvents; \ No newline at end of file +var _0x4975=['ChatGroup','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_0x4975,0x86));var _0x5497=function(_0x400767,_0x2d2b83){_0x400767=_0x400767-0x0;var _0x5dd559=_0x4975[_0x400767];return _0x5dd559;};'use strict';var EventEmitter=require(_0x5497('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0x5497('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x5497('0x2')](0x0);var events={'afterCreate':_0x5497('0x3'),'afterUpdate':_0x5497('0x4'),'afterDestroy':_0x5497('0x5')};function emitEvent(_0x235986){return function(_0x14cecb,_0xeb31af,_0xbb1888){ChatGroupEvents[_0x5497('0x6')](_0x235986+':'+_0x14cecb['id'],_0x14cecb);ChatGroupEvents['emit'](_0x235986,_0x14cecb);_0xbb1888(null);};}for(var e in events){if(events[_0x5497('0x7')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x5497('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 707370c..f8a2ec0 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 _0x5654=['path','rimraf','../../config/environment','exports','define','ChatGroup','chat_groups','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2c8743,_0x5e6301){var _0xda5447=function(_0xca8e29){while(--_0xca8e29){_0x2c8743['push'](_0x2c8743['shift']());}};_0xda5447(++_0x5e6301);}(_0x5654,0x89));var _0x4565=function(_0x41ea99,_0x46d575){_0x41ea99=_0x41ea99-0x0;var _0x2a089d=_0x5654[_0x41ea99];return _0x2a089d;};'use strict';var _=require(_0x4565('0x0'));var util=require(_0x4565('0x1'));var logger=require(_0x4565('0x2'))(_0x4565('0x3'));var moment=require(_0x4565('0x4'));var BPromise=require(_0x4565('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4565('0x6'));var rimraf=require(_0x4565('0x7'));var config=require(_0x4565('0x8'));var attributes=require('./chatGroup.attributes');module[_0x4565('0x9')]=function(_0x46c018,_0x36de4c){return _0x46c018[_0x4565('0xa')](_0x4565('0xb'),attributes,{'tableName':_0x4565('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x855d=['path','rimraf','../../config/environment','exports','ChatGroup','chat_groups','lodash','util','api','moment','request-promise'];(function(_0x326acf,_0x211565){var _0x211a77=function(_0x5af4da){while(--_0x5af4da){_0x326acf['push'](_0x326acf['shift']());}};_0x211a77(++_0x211565);}(_0x855d,0x187));var _0xd855=function(_0x406e65,_0x5ccb3b){_0x406e65=_0x406e65-0x0;var _0x69353f=_0x855d[_0x406e65];return _0x69353f;};'use strict';var _=require(_0xd855('0x0'));var util=require(_0xd855('0x1'));var logger=require('../../config/logger')(_0xd855('0x2'));var moment=require(_0xd855('0x3'));var BPromise=require('bluebird');var rp=require(_0xd855('0x4'));var fs=require('fs');var path=require(_0xd855('0x5'));var rimraf=require(_0xd855('0x6'));var config=require(_0xd855('0x7'));var attributes=require('./chatGroup.attributes');module[_0xd855('0x8')]=function(_0x2c8c68,_0x53b620){return _0x2c8c68['define'](_0xd855('0x9'),attributes,{'tableName':_0xd855('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 c3959bd..0b11095 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 _0x41d9=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','./chatGroup.socket','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','error'];(function(_0x26e89e,_0xacad9){var _0x5bf1d3=function(_0x53cbf8){while(--_0x53cbf8){_0x26e89e['push'](_0x26e89e['shift']());}};_0x5bf1d3(++_0xacad9);}(_0x41d9,0x13c));var _0x941d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x41d9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x941d('0x0'));var util=require(_0x941d('0x1'));var moment=require(_0x941d('0x2'));var BPromise=require(_0x941d('0x3'));var rs=require(_0x941d('0x4'));var fs=require('fs');var Redis=require(_0x941d('0x5'));var db=require(_0x941d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x941d('0x7'))(_0x941d('0x8'));var config=require('../../config/environment');var jayson=require(_0x941d('0x9'));var client=jayson[_0x941d('0xa')]['http']({'port':0x232a});config[_0x941d('0xb')]=_['defaults'](config[_0x941d('0xb')],{'host':_0x941d('0xc'),'port':0x18eb});var socket=require(_0x941d('0xd'))(new Redis(config[_0x941d('0xb')]));require(_0x941d('0xe'))['register'](socket);function respondWithRpcPromise(_0x176430,_0x1c5e4d,_0x40afd7){return new BPromise(function(_0x10d08e,_0x575883){return client[_0x941d('0xf')](_0x176430,_0x40afd7)[_0x941d('0x10')](function(_0xe0743b){logger[_0x941d('0x11')](_0x941d('0x12'),_0x1c5e4d,_0x941d('0x13'));logger['debug'](_0x941d('0x14'),_0x1c5e4d,'request\x20sent',JSON['stringify'](_0xe0743b));if(_0xe0743b[_0x941d('0x15')]){if(_0xe0743b[_0x941d('0x15')][_0x941d('0x16')]===0x1f4){logger[_0x941d('0x15')](_0x941d('0x12'),_0x1c5e4d,_0xe0743b[_0x941d('0x15')][_0x941d('0x17')]);return _0x575883(_0xe0743b[_0x941d('0x15')][_0x941d('0x17')]);}logger[_0x941d('0x15')](_0x941d('0x12'),_0x1c5e4d,_0xe0743b['error'][_0x941d('0x17')]);return _0x10d08e(_0xe0743b[_0x941d('0x15')][_0x941d('0x17')]);}else{logger[_0x941d('0x11')](_0x941d('0x12'),_0x1c5e4d,_0x941d('0x13'));_0x10d08e(_0xe0743b[_0x941d('0x18')][_0x941d('0x17')]);}})[_0x941d('0x19')](function(_0x546a7c){logger[_0x941d('0x15')]('ChatGroup,\x20%s,\x20%s',_0x1c5e4d,_0x546a7c);_0x575883(_0x546a7c);});});} \ No newline at end of file +var _0x98a7=['request','then','info','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','register'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0x98a7,0x9e));var _0x798a=function(_0x24507f,_0x36c8c5){_0x24507f=_0x24507f-0x0;var _0x585818=_0x98a7[_0x24507f];return _0x585818;};'use strict';var _=require(_0x798a('0x0'));var util=require(_0x798a('0x1'));var moment=require(_0x798a('0x2'));var BPromise=require(_0x798a('0x3'));var rs=require(_0x798a('0x4'));var fs=require('fs');var Redis=require(_0x798a('0x5'));var db=require(_0x798a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x798a('0x7'))(_0x798a('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x798a('0x9')][_0x798a('0xa')]({'port':0x232a});config[_0x798a('0xb')]=_[_0x798a('0xc')](config[_0x798a('0xb')],{'host':_0x798a('0xd'),'port':0x18eb});var socket=require(_0x798a('0xe'))(new Redis(config[_0x798a('0xb')]));require('./chatGroup.socket')[_0x798a('0xf')](socket);function respondWithRpcPromise(_0x7d5847,_0x18627b,_0x167f76){return new BPromise(function(_0x5aa692,_0x3f6968){return client[_0x798a('0x10')](_0x7d5847,_0x167f76)[_0x798a('0x11')](function(_0x3a21d0){logger[_0x798a('0x12')](_0x798a('0x13'),_0x18627b,'request\x20sent');logger[_0x798a('0x14')](_0x798a('0x15'),_0x18627b,_0x798a('0x16'),JSON[_0x798a('0x17')](_0x3a21d0));if(_0x3a21d0['error']){if(_0x3a21d0[_0x798a('0x18')][_0x798a('0x19')]===0x1f4){logger['error'](_0x798a('0x13'),_0x18627b,_0x3a21d0['error'][_0x798a('0x1a')]);return _0x3f6968(_0x3a21d0[_0x798a('0x18')][_0x798a('0x1a')]);}logger[_0x798a('0x18')]('ChatGroup,\x20%s,\x20%s',_0x18627b,_0x3a21d0[_0x798a('0x18')][_0x798a('0x1a')]);return _0x5aa692(_0x3a21d0['error'][_0x798a('0x1a')]);}else{logger[_0x798a('0x12')](_0x798a('0x13'),_0x18627b,_0x798a('0x16'));_0x5aa692(_0x3a21d0[_0x798a('0x1b')][_0x798a('0x1a')]);}})[_0x798a('0x1c')](function(_0x114d59){logger[_0x798a('0x18')](_0x798a('0x13'),_0x18627b,_0x114d59);_0x3f6968(_0x114d59);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index a9d0a29..d6407d9 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 _0xfedb=['removeListener','register','length','chatGroup:','./chatGroup.events','save','remove','update'];(function(_0x404957,_0x5192a4){var _0x4e0365=function(_0x4f6cd7){while(--_0x4f6cd7){_0x404957['push'](_0x404957['shift']());}};_0x4e0365(++_0x5192a4);}(_0xfedb,0x11c));var _0xbfed=function(_0xd65533,_0xa3acc8){_0xd65533=_0xd65533-0x0;var _0x7a7a9b=_0xfedb[_0xd65533];return _0x7a7a9b;};'use strict';var ChatGroupEvents=require(_0xbfed('0x0'));var events=[_0xbfed('0x1'),_0xbfed('0x2'),_0xbfed('0x3')];function createListener(_0x239717,_0xb043c8){return function(_0x2a88af){_0xb043c8['emit'](_0x239717,_0x2a88af);};}function removeListener(_0x3aa197,_0x5a1350){return function(){ChatGroupEvents[_0xbfed('0x4')](_0x3aa197,_0x5a1350);};}exports[_0xbfed('0x5')]=function(_0x856235){for(var _0x2b1912=0x0,_0x2b1a4d=events[_0xbfed('0x6')];_0x2b1912<_0x2b1a4d;_0x2b1912++){var _0x363a22=events[_0x2b1912];var _0x4fe134=createListener(_0xbfed('0x7')+_0x363a22,_0x856235);ChatGroupEvents['on'](_0x363a22,_0x4fe134);}}; \ No newline at end of file +var _0x9e39=['register','length','./chatGroup.events','save','remove','update','emit','removeListener'];(function(_0x380702,_0x938482){var _0x470ecb=function(_0x2331c2){while(--_0x2331c2){_0x380702['push'](_0x380702['shift']());}};_0x470ecb(++_0x938482);}(_0x9e39,0xc2));var _0x99e3=function(_0x6aebb,_0x4107bf){_0x6aebb=_0x6aebb-0x0;var _0x13cfd6=_0x9e39[_0x6aebb];return _0x13cfd6;};'use strict';var ChatGroupEvents=require(_0x99e3('0x0'));var events=[_0x99e3('0x1'),_0x99e3('0x2'),_0x99e3('0x3')];function createListener(_0x4f614a,_0x456f67){return function(_0x2fe763){_0x456f67[_0x99e3('0x4')](_0x4f614a,_0x2fe763);};}function removeListener(_0x1b3f6f,_0x3cc2da){return function(){ChatGroupEvents[_0x99e3('0x5')](_0x1b3f6f,_0x3cc2da);};}exports[_0x99e3('0x6')]=function(_0x4dfae1){for(var _0x5f3a27=0x0,_0x407af4=events[_0x99e3('0x7')];_0x5f3a27<_0x407af4;_0x5f3a27++){var _0x44d667=events[_0x5f3a27];var _0x39fefe=createListener('chatGroup:'+_0x44d667,_0x4dfae1);ChatGroupEvents['on'](_0x44d667,_0x39fefe);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 579e561..807d34a 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 _0x3467=['getUnread','/:id/members','getMembers','/:id/messages','post','create','addMembers','addMessage','update','delete','destroy','removeMembers','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x628eee,_0x3f3fba){var _0x447718=function(_0x38112b){while(--_0x38112b){_0x628eee['push'](_0x628eee['shift']());}};_0x447718(++_0x3f3fba);}(_0x3467,0x125));var _0x7346=function(_0x1cb8a0,_0x1dd309){_0x1cb8a0=_0x1cb8a0-0x0;var _0xb3c0bd=_0x3467[_0x1cb8a0];return _0xb3c0bd;};'use strict';var multer=require(_0x7346('0x0'));var util=require(_0x7346('0x1'));var path=require(_0x7346('0x2'));var timeout=require(_0x7346('0x3'));var express=require(_0x7346('0x4'));var router=express[_0x7346('0x5')]();var fs_extra=require(_0x7346('0x6'));var auth=require(_0x7346('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x7346('0x8'));var controller=require('./chatGroup.controller');router[_0x7346('0x9')]('/',auth[_0x7346('0xa')](),controller[_0x7346('0xb')]);router[_0x7346('0x9')](_0x7346('0xc'),auth['isAuthenticated'](),controller[_0x7346('0xd')]);router[_0x7346('0x9')](_0x7346('0xe'),auth[_0x7346('0xa')](),controller['show']);router['get']('/:id/unread',auth['isAuthenticated'](),controller[_0x7346('0xf')]);router['get'](_0x7346('0x10'),auth[_0x7346('0xa')](),controller[_0x7346('0x11')]);router[_0x7346('0x9')](_0x7346('0x12'),auth['isAuthenticated'](),controller['getMessages']);router[_0x7346('0x13')]('/',auth['isAuthenticated'](),controller[_0x7346('0x14')]);router[_0x7346('0x13')](_0x7346('0x10'),auth[_0x7346('0xa')](),controller[_0x7346('0x15')]);router[_0x7346('0x13')](_0x7346('0x12'),auth[_0x7346('0xa')](),controller[_0x7346('0x16')]);router['put'](_0x7346('0xe'),auth[_0x7346('0xa')](),controller[_0x7346('0x17')]);router[_0x7346('0x18')]('/:id',auth[_0x7346('0xa')](),controller[_0x7346('0x19')]);router['delete']('/:id/members',auth[_0x7346('0xa')](),controller[_0x7346('0x1a')]);module[_0x7346('0x1b')]=router; \ No newline at end of file +var _0x9021=['util','path','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','addMessage','put','destroy','exports','multer'];(function(_0x28aca9,_0x5c9543){var _0x3efdc1=function(_0x56a2d4){while(--_0x56a2d4){_0x28aca9['push'](_0x28aca9['shift']());}};_0x3efdc1(++_0x5c9543);}(_0x9021,0x81));var _0x1902=function(_0x175866,_0x1e48a6){_0x175866=_0x175866-0x0;var _0x4a561b=_0x9021[_0x175866];return _0x4a561b;};'use strict';var multer=require(_0x1902('0x0'));var util=require(_0x1902('0x1'));var path=require(_0x1902('0x2'));var timeout=require('connect-timeout');var express=require(_0x1902('0x3'));var router=express[_0x1902('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1902('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1902('0x6'));var controller=require('./chatGroup.controller');router[_0x1902('0x7')]('/',auth[_0x1902('0x8')](),controller[_0x1902('0x9')]);router[_0x1902('0x7')](_0x1902('0xa'),auth['isAuthenticated'](),controller[_0x1902('0xb')]);router[_0x1902('0x7')]('/:id',auth[_0x1902('0x8')](),controller[_0x1902('0xc')]);router['get'](_0x1902('0xd'),auth[_0x1902('0x8')](),controller[_0x1902('0xe')]);router[_0x1902('0x7')](_0x1902('0xf'),auth[_0x1902('0x8')](),controller[_0x1902('0x10')]);router[_0x1902('0x7')](_0x1902('0x11'),auth[_0x1902('0x8')](),controller[_0x1902('0x12')]);router[_0x1902('0x13')]('/',auth[_0x1902('0x8')](),controller[_0x1902('0x14')]);router[_0x1902('0x13')](_0x1902('0xf'),auth[_0x1902('0x8')](),controller[_0x1902('0x15')]);router[_0x1902('0x13')](_0x1902('0x11'),auth[_0x1902('0x8')](),controller[_0x1902('0x16')]);router[_0x1902('0x17')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x1902('0x8')](),controller[_0x1902('0x18')]);router['delete'](_0x1902('0xf'),auth['isAuthenticated'](),controller['removeMembers']);module[_0x1902('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 bef2327..ea117f4 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 _0x6b20=['DATE','long','ENUM','out','BOOLEAN','sequelize','exports','INTEGER','star','thumb','TEXT','STRING'];(function(_0x3d8085,_0x4f22fe){var _0x5e3ec0=function(_0x17228f){while(--_0x17228f){_0x3d8085['push'](_0x3d8085['shift']());}};_0x5e3ec0(++_0x4f22fe);}(_0x6b20,0xd1));var _0x06b2=function(_0x318559,_0x464bb4){_0x318559=_0x318559-0x0;var _0x1ee5a2=_0x6b20[_0x318559];return _0x1ee5a2;};'use strict';var Sequelize=require(_0x06b2('0x0'));module[_0x06b2('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x06b2('0x2')]},'ratingType':{'type':Sequelize['ENUM'](_0x06b2('0x3'),_0x06b2('0x4')),'defaultValue':_0x06b2('0x3')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x06b2('0x5')]},'mailTranscript':{'type':Sequelize[_0x06b2('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x06b2('0x7')]},'disposition':{'type':Sequelize[_0x06b2('0x6')]},'secondDisposition':{'type':Sequelize[_0x06b2('0x6')]},'thirdDisposition':{'type':Sequelize[_0x06b2('0x6')]},'note':{'type':Sequelize[_0x06b2('0x6')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x06b2('0x6')]},'osName':{'type':Sequelize[_0x06b2('0x6')]},'osVersion':{'type':Sequelize[_0x06b2('0x6')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x06b2('0x6')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x06b2('0x5')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT'](_0x06b2('0x8'))},'read1stAt':{'type':Sequelize[_0x06b2('0x7')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x06b2('0x9')]('in',_0x06b2('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x06b2('0x6')]},'customerPort':{'type':Sequelize[_0x06b2('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x06b2('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0x06b2('0xb')],'defaultValue':![]}}; \ No newline at end of file +var _0x00ea=['BOOLEAN','ENUM','star','thumb','TEXT','DATE','STRING','long','exports'];(function(_0x3cf4d3,_0x48065e){var _0x4e547b=function(_0x28f85a){while(--_0x28f85a){_0x3cf4d3['push'](_0x3cf4d3['shift']());}};_0x4e547b(++_0x48065e);}(_0x00ea,0x19d));var _0xa00e=function(_0x17a6aa,_0x4d33bf){_0x17a6aa=_0x17a6aa-0x0;var _0x475154=_0x00ea[_0x17a6aa];return _0x475154;};'use strict';var Sequelize=require('sequelize');module[_0xa00e('0x0')]={'closed':{'type':Sequelize[_0xa00e('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0xa00e('0x2')](_0xa00e('0x3'),_0xa00e('0x4')),'defaultValue':_0xa00e('0x3')},'ratingMessage':{'type':Sequelize[_0xa00e('0x5')]},'pathTranscript':{'type':Sequelize[_0xa00e('0x5')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xa00e('0x6')]},'disposition':{'type':Sequelize[_0xa00e('0x7')]},'secondDisposition':{'type':Sequelize[_0xa00e('0x7')]},'thirdDisposition':{'type':Sequelize[_0xa00e('0x7')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0xa00e('0x7')]},'browserVersion':{'type':Sequelize[_0xa00e('0x7')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0xa00e('0x7')]},'deviceModel':{'type':Sequelize[_0xa00e('0x7')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0xa00e('0x7')]},'referer':{'type':Sequelize[_0xa00e('0x5')]},'customerIp':{'type':Sequelize[_0xa00e('0x7')]},'formData':{'type':Sequelize['TEXT'](_0xa00e('0x8'))},'read1stAt':{'type':Sequelize[_0xa00e('0x6')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xa00e('0x2')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xa00e('0x7')]},'customerPort':{'type':Sequelize[_0xa00e('0x7')]},'vidaooSessionId':{'type':Sequelize[_0xa00e('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0xa00e('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 273bcf1..2d5a38e 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 _0x087b=['jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','ChatInteraction,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','name','render','body','contact','agent','interaction','Users','map','fullname','TagIds','Tags','split','forEach','index','ChatInteraction','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filters','select','field','color','from','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','keys','compact','isEmpty','ChatWebsiteId','concat','createdAt','parse','$gte','null','where','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','isNumeric','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)','contactName','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName','c.email','Contact.email','Contact.phone','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','push','all','show','params','rawAttributes','include','options','catch','create','describe','ChatWebsite','findOne','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','vidaooApiKey','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','updateAttributes','CmContact','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','entity\x20not\x20found','disposition','file','filename','attachmentDownload','closed','Unauthorized','Attachment','attachId','ChatOfflineMessageId','join','root','offline-chat/','basename','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','%s%d','agentAlias','System','customer','Visitor','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','auth','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','omit','ids','getMessages','nolimit','filter','findAll','rows','getMyMessages','includeAll','addTags','setTags','chatInteractionTags:save','removeTags','unix','files','server','attachments','transcript-%d-%s.zip','firstName','Account','Owner','YYYY-MM-DD\x20HH:mm:ss','referer','customerIp','customerPort','N.A.','tail','existsSync','pipe','createWriteStream','out','lastName','downloadInteraction.ejs','transcript-','.pdf','log','err','unlinkSync','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatInteraction.socket','register'];(function(_0x5ab321,_0x543926){var _0x1dc03c=function(_0x3a4545){while(--_0x3a4545){_0x5ab321['push'](_0x5ab321['shift']());}};_0x1dc03c(++_0x543926);}(_0x087b,0x11a));var _0xb087=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0x087b[_0x9dfc10];return _0x4f938a;};'use strict';var emlformat=require(_0xb087('0x0'));var rimraf=require(_0xb087('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb087('0x2'));var moment=require('moment');var BPromise=require(_0xb087('0x3'));var Mustache=require(_0xb087('0x4'));var util=require(_0xb087('0x5'));var path=require(_0xb087('0x6'));var sox=require(_0xb087('0x7'));var csv=require(_0xb087('0x8'));var ejs=require(_0xb087('0x9'));var fs=require('fs');var fs_extra=require(_0xb087('0xa'));var _=require(_0xb087('0xb'));var squel=require(_0xb087('0xc'));var crypto=require(_0xb087('0xd'));var jsforce=require(_0xb087('0xe'));var deskjs=require(_0xb087('0xf'));var toCsv=require(_0xb087('0x8'));var querystring=require(_0xb087('0x10'));var Papa=require(_0xb087('0x11'));var Redis=require(_0xb087('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb087('0x13'));var as=require(_0xb087('0x14'));var pdf=require(_0xb087('0x15'));var hardwareService=require(_0xb087('0x16'));var logger=require(_0xb087('0x17'))(_0xb087('0x18'));var utils=require(_0xb087('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xb087('0x1a'));var db=require(_0xb087('0x1b'))['db'];config[_0xb087('0x1c')]=_['defaults'](config[_0xb087('0x1c')],{'host':_0xb087('0x1d'),'port':0x18eb});var socket=require(_0xb087('0x1e'))(new Redis(config[_0xb087('0x1c')]));require(_0xb087('0x1f'))[_0xb087('0x20')](socket);var jayson=require(_0xb087('0x21'));var client=jayson[_0xb087('0x22')][_0xb087('0x23')]({'port':0x232b});var client9004=jayson[_0xb087('0x22')]['http']({'port':0x232c});function respondWithRpcPromise(_0x43e576,_0x412b48,_0x597478,_0xcc4426){return new BPromise(function(_0x2b83b7,_0x2e9e74){var _0x5bb80b=_0xcc4426||client;return _0x5bb80b[_0xb087('0x24')](_0x43e576,_0x597478)[_0xb087('0x25')](function(_0x17200d){logger[_0xb087('0x26')]('ChatInteraction,\x20%s,\x20%s',_0x412b48,_0xb087('0x27'));logger[_0xb087('0x28')](_0xb087('0x29'),_0x412b48,_0xb087('0x27'),JSON['stringify'](_0x17200d));if(_0x17200d['error']){if(_0x17200d['error']['code']===0x1f4){logger[_0xb087('0x2a')](_0xb087('0x2b'),_0x412b48,_0x17200d[_0xb087('0x2a')][_0xb087('0x2c')]);return _0x2e9e74(_0x17200d[_0xb087('0x2a')][_0xb087('0x2c')]);}logger[_0xb087('0x2a')]('ChatInteraction,\x20%s,\x20%s',_0x412b48,_0x17200d[_0xb087('0x2a')][_0xb087('0x2c')]);return _0x2b83b7(_0x17200d[_0xb087('0x2a')][_0xb087('0x2c')]);}else{logger[_0xb087('0x26')]('ChatInteraction,\x20%s,\x20%s',_0x412b48,_0xb087('0x27'));_0x2b83b7(_0x17200d[_0xb087('0x2d')]['message']);}})['catch'](function(_0x50745a){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x412b48,_0x50745a);_0x2e9e74(_0x50745a);});});}function respondWithStatusCode(_0x304840,_0x45685d){_0x45685d=_0x45685d||0xcc;return function(_0x1d124f){if(_0x1d124f){return _0x304840[_0xb087('0x2e')](_0x45685d);}return _0x304840[_0xb087('0x2f')](_0x45685d)[_0xb087('0x30')]();};}function respondWithResult(_0xf3f41f,_0x35a52c){_0x35a52c=_0x35a52c||0xc8;return function(_0x6cfb22){if(_0x6cfb22){return _0xf3f41f[_0xb087('0x2f')](_0x35a52c)[_0xb087('0x31')](_0x6cfb22);}};}function respondWithFilteredResult(_0x31e3e6,_0xb0baf6){return function(_0x263259){if(_0x263259){var _0x593b78=typeof _0xb0baf6[_0xb087('0x32')]===_0xb087('0x33')&&typeof _0xb0baf6[_0xb087('0x34')]===_0xb087('0x33');var _0x22d441=_0x263259[_0xb087('0x35')];var _0x2e1c57=_0x593b78?0x0:_0xb0baf6[_0xb087('0x32')];var _0x53a535=_0x593b78?_0x263259['count']:_0xb0baf6[_0xb087('0x32')]+_0xb0baf6[_0xb087('0x34')];var _0x4cb5a8;if(_0x53a535>=_0x22d441){_0x53a535=_0x22d441;_0x4cb5a8=0xc8;}else{_0x4cb5a8=0xce;}_0x31e3e6[_0xb087('0x2f')](_0x4cb5a8);return _0x31e3e6[_0xb087('0x36')](_0xb087('0x37'),_0x2e1c57+'-'+_0x53a535+'/'+_0x22d441)[_0xb087('0x31')](_0x263259);}return null;};}function patchUpdates(_0x3c61c4){return function(_0x427905){try{jsonpatch[_0xb087('0x38')](_0x427905,_0x3c61c4,!![]);}catch(_0x3b7ace){return BPromise[_0xb087('0x39')](_0x3b7ace);}return _0x427905[_0xb087('0x3a')]();};}function saveUpdates(_0x442a5e,_0x3069b5){return function(_0x57ae94){if(_0x57ae94){return _0x57ae94[_0xb087('0x3b')](_0x442a5e)['then'](function(_0x906987){return _0x906987;});}return null;};}function removeEntity(_0x296e9b,_0x738e68){return function(_0xd0659e){if(_0xd0659e){return _0xd0659e[_0xb087('0x3c')]()[_0xb087('0x25')](function(){_0x296e9b[_0xb087('0x2f')](0xcc)[_0xb087('0x30')]();});}};}function handleEntityNotFound(_0x8a4c3c,_0x521c3f){return function(_0x5814c2){if(!_0x5814c2){_0x8a4c3c[_0xb087('0x2e')](0x194);}return _0x5814c2;};}function handleError(_0x3c4f33,_0x1ce1ef){_0x1ce1ef=_0x1ce1ef||0x1f4;return function(_0x2d2902){logger[_0xb087('0x2a')](_0x2d2902['stack']);if(_0x2d2902[_0xb087('0x3d')]){delete _0x2d2902[_0xb087('0x3d')];}_0x3c4f33['status'](_0x1ce1ef)['send'](_0x2d2902);};}function getMustacheRender(_0x1726c2,_0x1c7d90){return Mustache[_0xb087('0x3e')](_0x1726c2,_['merge'](_0x1c7d90[_0xb087('0x3f')],{'contact':_0x1c7d90[_0xb087('0x40')],'message':_0x1c7d90[_0xb087('0x2c')],'agent':_0x1c7d90[_0xb087('0x41')],'interaction':_0x1c7d90[_0xb087('0x42')],'account':_0x1c7d90['account']}))||'';}function getInteractionUsers(_0x7e1315,_0x5bb6bc){return new BPromise(function(_0x18e23f,_0x5a582d){try{if(_0x5bb6bc[_0x7e1315['id']]){_0x7e1315[_0xb087('0x43')]=_[_0xb087('0x44')](_0x5bb6bc[_0x7e1315['id']],function(_0x513332){return{'id':_0x513332['id'],'fullname':_0x513332[_0xb087('0x45')]};});}}catch(_0x5aa11d){_0x5a582d(_0x5aa11d);}_0x18e23f(_0x7e1315);});}function getInteractionTags(_0x46d12a,_0x4a360c){return new BPromise(function(_0x2d2c74,_0x326934){try{if(_0x46d12a[_0xb087('0x46')]){_0x46d12a[_0xb087('0x47')]=[];_0x46d12a[_0xb087('0x46')][_0xb087('0x48')](',')[_0xb087('0x49')](function(_0x5e7690){_0x46d12a[_0xb087('0x47')]['push'](_0x4a360c[_0x5e7690]);});}delete _0x46d12a[_0xb087('0x46')];}catch(_0x2d71c2){_0x326934(_0x2d71c2);}_0x2d2c74(_0x46d12a);});}function updateChatInteraction(_0x5b6924,_0xb662bf,_0x45dc6f){return new BPromise(function(_0x7650c5,_0x4c33cc){return getInteractionUsers(_0x5b6924,_0x45dc6f)[_0xb087('0x25')](function(_0x4a9ccb){return getInteractionTags(_0x4a9ccb,_0xb662bf);})[_0xb087('0x25')](function(_0x32b9d3){_0x7650c5(_0x32b9d3);})['catch'](function(_0x38cb9d){_0x4c33cc(_0x38cb9d);});});}exports[_0xb087('0x4a')]=function(_0x4addbd,_0x2b969a){var _0x171778={},_0x54eb11={},_0x93ada7={'count':0x0,'rows':[]};var _0x46c713=_[_0xb087('0x44')](db[_0xb087('0x4b')]['rawAttributes'],function(_0x47902e){return{'name':_0x47902e[_0xb087('0x4c')],'type':_0x47902e[_0xb087('0x4d')][_0xb087('0x4e')]};});_0x54eb11[_0xb087('0x4f')]=_[_0xb087('0x44')](_0x46c713,_0xb087('0x3d'));_0x54eb11['query']=_['keys'](_0x4addbd[_0xb087('0x50')]);_0x54eb11['filters']=_[_0xb087('0x51')](_0x54eb11[_0xb087('0x4f')],_0x54eb11[_0xb087('0x50')]);_0x171778[_0xb087('0x52')]=_['intersection'](_0x54eb11[_0xb087('0x4f')],qs['fields'](_0x4addbd[_0xb087('0x50')][_0xb087('0x53')]));_0x171778[_0xb087('0x52')]=_0x171778[_0xb087('0x52')][_0xb087('0x54')]?_0x171778['attributes']:_0x54eb11[_0xb087('0x4f')];if(!_0x4addbd[_0xb087('0x50')][_0xb087('0x55')]('nolimit')){_0x171778[_0xb087('0x34')]=qs['limit'](_0x4addbd['query'][_0xb087('0x34')]);_0x171778[_0xb087('0x32')]=qs['offset'](_0x4addbd[_0xb087('0x50')][_0xb087('0x32')]);}_0x171778[_0xb087('0x56')]=qs['sort'](_0x4addbd['query'][_0xb087('0x57')]);_0x171778['where']=qs['filters'](_[_0xb087('0x58')](_0x4addbd[_0xb087('0x50')],_0x54eb11[_0xb087('0x59')]),_0x46c713);var _0x4067cf=[];var _0x2bf92f=squel[_0xb087('0x5a')]()[_0xb087('0x5b')]('id')[_0xb087('0x5b')](_0xb087('0x3d'))[_0xb087('0x5b')](_0xb087('0x5c'))[_0xb087('0x5d')]('tools_tags');var _0x46d570=squel[_0xb087('0x5a')]()['field'](_0xb087('0x5e'))[_0xb087('0x5b')](_0xb087('0x5f'))[_0xb087('0x5b')](_0xb087('0x60'))[_0xb087('0x5d')](_0xb087('0x61'),'ui')[_0xb087('0x62')](_0xb087('0x63'),'u',_0xb087('0x64'));var _0x17c6d0=squel['select']()[_0xb087('0x5d')]('chat_interactions','i')[_0xb087('0x62')]('cm_contacts','c',_0xb087('0x65'))[_0xb087('0x62')](_0xb087('0x63'),'o',_0xb087('0x66'))[_0xb087('0x62')](_0xb087('0x67'),'a',_0xb087('0x68'))[_0xb087('0x62')](_0xb087('0x69'),'me',_0xb087('0x6a'))[_0xb087('0x62')](_0xb087('0x6b'),'it',_0xb087('0x6c'))[_0xb087('0x62')](_0xb087('0x6d'),'t',_0xb087('0x6e'));var _0x217f26=squel[_0xb087('0x6f')]();var _0x40ff74=[];var _0xe3cb2=squel[_0xb087('0x6f')]();var _0x459c5b;if(_0x4addbd['query'][_0xb087('0x70')]){_0x459c5b=as[_0xb087('0x71')](_0x4addbd[_0xb087('0x50')]['search']);var _0x4099cc=_0x459c5b[_0xb087('0x72')];for(var _0x5685b1=0x0;_0x5685b1<_0x459c5b[_0xb087('0x73')][_0xb087('0x54')];_0x5685b1++){var _0x2e3a14=_0x459c5b['conditions'][_0x5685b1];var _0x133c58='i';var _0x257894=_[_0xb087('0x74')](_0x46c713,[_0xb087('0x3d'),_0x2e3a14[_0xb087('0x5b')]]);if(!_0x257894){switch(_0x2e3a14[_0xb087('0x5b')]){case _0xb087('0x75'):if(_0x2e3a14[_0xb087('0x76')]==0x1){_0x17c6d0['having']('`'+_0x2e3a14[_0xb087('0x5b')]+_0xb087('0x77'));}else{_0x17c6d0[_0xb087('0x78')]('`'+_0x2e3a14['field']+_0xb087('0x79'));}break;case'Contact':if(_0x2e3a14['operator']===_0xb087('0x7a')){if(_0x2e3a14[_0xb087('0x76')]['split']('\x20')[_0xb087('0x54')]>0x1){_0x217f26[_0x4099cc]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb087('0x7b')](_0x2e3a14[_0xb087('0x76')]),null);}else{var _0x5938ad='%'+_0x2e3a14['value']+'%';_0x217f26[_0x4099cc](_0xb087('0x7c'),_0x5938ad,_0x5938ad,_0x5938ad);}}else{_0x257894=_['find'](_0x46c713,['name',_0xb087('0x7d')]);_0x2e3a14['field']=_0xb087('0x7d');_0x390309=as['buildExpression'](_0x133c58,_0x257894[_0xb087('0x4d')],_0x2e3a14);_0x217f26[_0x4099cc](_0x390309[_0xb087('0x7e')],_0x390309[_0xb087('0x76')][_0xb087('0x7f')],_0x390309[_0xb087('0x76')][_0xb087('0x30')]);}break;case'Tag':var _0x200869=_0x2e3a14['value'][_0xb087('0x48')](',')[_0xb087('0x44')](function(_0x1060e1){return Number(_0x1060e1);});_0x200869['forEach'](function(_0x298bbb){_0xe3cb2['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x298bbb+',%');});_0x40ff74=_[_0xb087('0x80')](_0x40ff74,_0x200869);break;case _0xb087('0x81'):if(_0x2e3a14[_0xb087('0x82')]===_0xb087('0x7a')){_0x217f26[_0x4099cc](_0xb087('0x83'),'%'+_0x2e3a14[_0xb087('0x76')]+'%',null);}else{_0x257894=_['find'](_0x46c713,[_0xb087('0x3d'),_0xb087('0x84')]);_0x2e3a14['field']=_0xb087('0x84');_0x390309=as['buildExpression'](_0x133c58,_0x257894[_0xb087('0x4d')],_0x2e3a14);_0x217f26[_0x4099cc](_0x390309[_0xb087('0x7e')],_0x390309[_0xb087('0x76')][_0xb087('0x7f')],_0x390309[_0xb087('0x76')][_0xb087('0x30')]);}break;case _0xb087('0x3f'):_0x390309=as[_0xb087('0x85')]('me',null,_0x2e3a14);_0x217f26[_0x4099cc](_0x390309['text'],_0x390309['value']['start'],_0x390309[_0xb087('0x76')]['end']);break;}}else{var _0x390309=as['buildExpression'](_0x133c58,_0x257894[_0xb087('0x4d')],_0x2e3a14);_0x217f26[_0x4099cc](_0x390309[_0xb087('0x7e')],_0x390309[_0xb087('0x76')][_0xb087('0x7f')],_0x390309['value'][_0xb087('0x30')]);}}}else{var _0x53f04a=_(_0x4addbd[_0xb087('0x50')])[_0xb087('0x86')]()[_0xb087('0x44')](function(_0x42f4a3){return _['some'](_0x46c713,['name',_0x42f4a3])?_0x42f4a3:undefined;})[_0xb087('0x87')]()['value']();if(!_[_0xb087('0x88')](_0x53f04a)){_0x53f04a[_0xb087('0x49')](function(_0x2ca987){if(_0x2ca987===_0xb087('0x89')){_0x17c6d0['where']('i.ChatWebsiteId\x20IN\x20?',[][_0xb087('0x8a')](_0x4addbd['query'][_0x2ca987]));}else if(_0x2ca987===_0xb087('0x8b')){var _0x1c7cd7=JSON[_0xb087('0x8c')](_0x4addbd[_0xb087('0x50')][_0x2ca987])[_0xb087('0x8d')];var _0x581ad4=JSON[_0xb087('0x8c')](_0x4addbd[_0xb087('0x50')][_0x2ca987])['$lte'];_0x17c6d0['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x1c7cd7,_0x581ad4);}else{if(_0x4addbd[_0xb087('0x50')][_0x2ca987]===_0xb087('0x8e')){_0x17c6d0[_0xb087('0x8f')]('i.'+_0x2ca987+_0xb087('0x90'));}else{_0x17c6d0[_0xb087('0x8f')]('i.'+_0x2ca987+_0xb087('0x91'),_0x4addbd['query'][_0x2ca987]);}}});}if(_0x4addbd[_0xb087('0x50')][_0xb087('0x92')]){if(_0x4addbd[_0xb087('0x50')][_0xb087('0x92')]==0x1){_0x17c6d0[_0xb087('0x78')](_0xb087('0x93'));}else{_0x17c6d0[_0xb087('0x78')]('`unreadMessages`\x20>\x200');}}if(_0x4addbd[_0xb087('0x50')][_0xb087('0x94')]){_0x40ff74=_[_0xb087('0x95')](_0x4addbd['query'][_0xb087('0x94')])?_0x4addbd['query'][_0xb087('0x94')]:new Array(_0x4addbd[_0xb087('0x50')][_0xb087('0x94')]);_0x40ff74[_0xb087('0x49')](function(_0x463791){_0xe3cb2['or'](_0xb087('0x96'),'%,'+_0x463791+',%');});}if(_0x4addbd['query']['filter']){var _0x1e7a22=_0x4addbd[_0xb087('0x50')]['filter'][_0xb087('0x97')]('\x5c','\x5c\x5c')[_0xb087('0x97')](/'/g,'\x27\x27');if(qs[_0xb087('0x98')](_0x1e7a22)){_0x217f26['or'](_0xb087('0x99'),_0x1e7a22+'%');}else{_0x217f26['or'](_0xb087('0x9a'),qs[_0xb087('0x7b')](_0x1e7a22))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x1e7a22+'%');}}}_0x17c6d0[_0xb087('0x8f')](_0x217f26);_0x17c6d0[_0xb087('0x9b')](_0xb087('0x9c'));var _0x3114ce={'type':db[_0xb087('0x9d')][_0xb087('0x9e')][_0xb087('0x9f')],'raw':!![]};var _0x1fc613=_0x17c6d0[_0xb087('0xa0')]();_0x1fc613['field'](_0xb087('0x9c'));_0x1fc613['field'](_0xb087('0xa1'),_0xb087('0x75'));if(_0x171778['order']){_0x171778[_0xb087('0x56')][_0xb087('0x49')](function(_0x8b1a5b){var _0x2a076b=_0x8b1a5b[0x0]===_0xb087('0xa2')?_0x8b1a5b[0x0]:'i.'+_0x8b1a5b[0x0];_0x17c6d0[_0xb087('0x56')](_0x2a076b,_0x8b1a5b[0x1]==='DESC'?![]:!![]);});}if(!_[_0xb087('0x88')](_0x40ff74)){_0x17c6d0[_0xb087('0x78')](_0xe3cb2);_0x1fc613[_0xb087('0x8f')](_0xb087('0xa3'),_0x40ff74);}BPromise[_0xb087('0xa4')]()['then'](function(){if(!_0x459c5b){if(_0x4addbd[_0xb087('0x50')][_0xb087('0x89')])return;_0x1fc613[_0xb087('0x8f')](_0xb087('0xa5'));_0x17c6d0[_0xb087('0x8f')](_0xb087('0xa5'));return;}if(_0x4addbd[_0xb087('0xa6')][_0xb087('0xa7')]!==_0xb087('0x41'))return;return _0x4addbd[_0xb087('0xa6')][_0xb087('0xa8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x59121a){if(_[_0xb087('0x88')](_0x59121a)){_0x1fc613[_0xb087('0x8f')](_0xb087('0xa9'));_0x17c6d0[_0xb087('0x8f')](_0xb087('0xa9'));}else{_0x1fc613['where'](_0xb087('0xaa'),_[_0xb087('0x44')](_0x59121a,'id'));_0x17c6d0[_0xb087('0x8f')](_0xb087('0xaa'),_[_0xb087('0x44')](_0x59121a,'id'));}});})[_0xb087('0x25')](function(){if(_0x4addbd['user'][_0xb087('0xa7')]==='agent'&&!_0x459c5b&&!_0x4addbd['query'][_0xb087('0x89')])return[];return db[_0xb087('0xab')][_0xb087('0x50')](_0x1fc613[_0xb087('0xac')](),_0x3114ce);})['then'](function(_0x313c9b){_0x93ada7[_0xb087('0x35')]=_0x313c9b['length'];if(_0x93ada7[_0xb087('0x35')]===0x0)return[];return db['sequelize']['query'](_0x2bf92f[_0xb087('0xac')](),_0x3114ce)[_0xb087('0x25')](function(_0x414cb4){_0x4067cf=_[_0xb087('0xad')](_0x414cb4,'id');_0x3114ce=_[_0xb087('0xae')](_0x3114ce,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4addbd[_0xb087('0x50')][_0xb087('0x53')]){_0x171778[_0xb087('0x52')][_0xb087('0x49')](function(_0x48e2c6){_0x17c6d0['field']('i.'+_0x48e2c6);});}else{_0x17c6d0['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xb087('0x75'));_0x17c6d0[_0xb087('0x5b')](_0xb087('0xaf'),_0xb087('0xb0'));_0x17c6d0[_0xb087('0x5b')](_0xb087('0xb1'),_0xb087('0xb2'));_0x17c6d0['field']('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0xb087('0xa2'));_0x17c6d0[_0xb087('0x5b')](_0xb087('0xb3'));_0x17c6d0[_0xb087('0x5b')]('c.firstName',_0xb087('0xb4'));_0x17c6d0['field'](_0xb087('0xb5'),'Contact.lastName');_0x17c6d0[_0xb087('0x5b')](_0xb087('0xb6'),_0xb087('0xb7'));_0x17c6d0[_0xb087('0x5b')]('c.phone',_0xb087('0xb8'));_0x17c6d0['field']('c.mobile','Contact.mobile');_0x17c6d0[_0xb087('0x5b')]('c.fax',_0xb087('0xb9'));_0x17c6d0[_0xb087('0x5b')](_0xb087('0xba'),_0xb087('0xbb'));_0x17c6d0[_0xb087('0x5b')](_0xb087('0xbc'),_0xb087('0xbd'));_0x17c6d0[_0xb087('0x5b')](_0xb087('0xbe'),_0xb087('0x46'));}if(_0x171778[_0xb087('0x34')])_0x17c6d0[_0xb087('0x34')](_0x171778[_0xb087('0x34')]);if(_0x171778[_0xb087('0x32')])_0x17c6d0[_0xb087('0x32')](_0x171778[_0xb087('0x32')]);return db[_0xb087('0xab')][_0xb087('0x50')](_0x17c6d0['toString'](),_0x3114ce);})[_0xb087('0x25')](function(_0x5c2a14){if(_0x5c2a14[_0xb087('0x54')]>0x0)_0x46d570[_0xb087('0x8f')](_0xb087('0xbf'),_[_0xb087('0x44')](_0x5c2a14,'id'));return db[_0xb087('0xab')][_0xb087('0x50')](_0x46d570[_0xb087('0xac')](),_0x3114ce)['then'](function(_0x5103ab){var _0x5194f2=_[_0xb087('0xc0')](_0x5103ab,_0xb087('0xc1'));var _0x3a403f=[];_0x5c2a14[_0xb087('0x49')](function(_0x18b90b){_0x3a403f[_0xb087('0xc2')](updateChatInteraction(_0x18b90b,_0x4067cf,_0x5194f2));});return BPromise[_0xb087('0xc3')](_0x3a403f);});});})[_0xb087('0x25')](function(_0x181c56){_0x93ada7['rows']=_0x181c56;return _0x93ada7;})[_0xb087('0x25')](respondWithFilteredResult(_0x2b969a,_0x171778))['catch'](handleError(_0x2b969a,null));};exports[_0xb087('0xc4')]=function(_0x25910a,_0x597d80){var _0x4c3aef={'raw':![],'where':{'id':_0x25910a[_0xb087('0xc5')]['id']}},_0x2f2597={};_0x2f2597[_0xb087('0x4f')]=_[_0xb087('0x86')](db['ChatInteraction'][_0xb087('0xc6')]);_0x2f2597[_0xb087('0x50')]=_['keys'](_0x25910a['query']);_0x2f2597[_0xb087('0x59')]=_['intersection'](_0x2f2597['model'],_0x2f2597[_0xb087('0x50')]);_0x4c3aef['attributes']=_[_0xb087('0x51')](_0x2f2597[_0xb087('0x4f')],qs[_0xb087('0x53')](_0x25910a[_0xb087('0x50')][_0xb087('0x53')]));_0x4c3aef[_0xb087('0x52')]=_0x4c3aef[_0xb087('0x52')][_0xb087('0x54')]?_0x4c3aef['attributes']:_0x2f2597[_0xb087('0x4f')];if(_0x25910a['query']['includeAll']){_0x4c3aef[_0xb087('0xc7')]=[{'all':!![]}];}_0x4c3aef=_[_0xb087('0xae')]({},_0x4c3aef,_0x25910a[_0xb087('0xc8')]);return db['ChatInteraction'][_0xb087('0x74')](_0x4c3aef)[_0xb087('0x25')](handleEntityNotFound(_0x597d80,null))[_0xb087('0x25')](respondWithResult(_0x597d80,null))[_0xb087('0xc9')](handleError(_0x597d80,null));};exports['create']=function(_0x1f3ecb,_0x3e865d){return db[_0xb087('0x4b')][_0xb087('0xca')](_0x1f3ecb[_0xb087('0x3f')],{})[_0xb087('0x25')](respondWithResult(_0x3e865d,0xc9))[_0xb087('0xc9')](handleError(_0x3e865d,null));};exports['update']=function(_0x1de68b,_0xfc3490){if(_0x1de68b[_0xb087('0x3f')]['id']){delete _0x1de68b[_0xb087('0x3f')]['id'];}return db[_0xb087('0x4b')][_0xb087('0x74')]({'where':{'id':_0x1de68b['params']['id']}})[_0xb087('0x25')](handleEntityNotFound(_0xfc3490,null))[_0xb087('0x25')](saveUpdates(_0x1de68b[_0xb087('0x3f')],null))['then'](respondWithResult(_0xfc3490,null))['catch'](handleError(_0xfc3490,null));};exports[_0xb087('0x3c')]=function(_0x12c676,_0xee09f5){return db[_0xb087('0x4b')][_0xb087('0x74')]({'where':{'id':_0x12c676[_0xb087('0xc5')]['id']}})[_0xb087('0x25')](handleEntityNotFound(_0xee09f5,null))[_0xb087('0x25')](removeEntity(_0xee09f5,null))[_0xb087('0xc9')](handleError(_0xee09f5,null));};exports[_0xb087('0xcb')]=function(_0x5ef263,_0x1a7486){return db[_0xb087('0x4b')][_0xb087('0xcb')]()[_0xb087('0x25')](respondWithResult(_0x1a7486,null))[_0xb087('0xc9')](handleError(_0x1a7486,null));};exports['createVidaooSession']=function(_0x33756c,_0x2e8eb1){var _0x189e0a=_0x33756c[_0xb087('0xc5')]['id'];var _0x52268a;var _0x259ac0;var _0x547968;return db[_0xb087('0x4b')]['findOne']({'where':{'id':_0x189e0a}})['then'](function(_0x321da9){_0x52268a=_0x321da9;return db[_0xb087('0xcc')][_0xb087('0xcd')]({'where':{'id':_0x321da9['ChatWebsiteId']},'attributes':['id','vidaooApiKey',_0xb087('0xce'),_0xb087('0xcf'),_0xb087('0xd0'),_0xb087('0xd1')],'raw':!![]});})[_0xb087('0x25')](function(_0x48a94f){if(_0x48a94f&&_0x48a94f[_0xb087('0xd2')]&&_0x48a94f[_0xb087('0xce')]){_0x259ac0=_0x48a94f;var _0x290338={'interaction':{'id':_0x189e0a},'agent':{'id':_0x33756c[_0xb087('0xa6')]['id'],'name':_0x33756c[_0xb087('0xa6')][_0xb087('0x3d')],'fullname':_0x33756c['user']['fullname'],'email':_0x33756c[_0xb087('0xa6')][_0xb087('0xd3')]},'contact':_0x33756c['body'][_0xb087('0x40')],'account':_0x33756c['body']['account']};var _0x471c54={'rejectUnauthorized':![],'method':_0xb087('0xd4'),'url':_0xb087('0xd5'),'headers':{'X-APIKEY':_0x48a94f[_0xb087('0xd2')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x33756c[_0xb087('0xa6')][_0xb087('0xd3')]],'buttons':null,'topic':_0x259ac0[_0xb087('0xcf')],'note':_[_0xb087('0xd6')](_0x259ac0[_0xb087('0xd0')])?null:getMustacheRender(_0x259ac0[_0xb087('0xd0')],_0x290338),'metadata':null},'redirect':'follow','json':!![]};try{if(!_['isNull'](_0x259ac0['vidaooMetadata'])){var _0x2ebe58=getMustacheRender(_0x259ac0['vidaooMetadata'],_0x290338);var _0x173a1b=JSON['parse'](_0x2ebe58);_0x471c54['body'][_0xb087('0xd7')]=_0x173a1b;}}catch(_0x2e3036){throw new db[(_0xb087('0x9d'))][(_0xb087('0xd8'))](_0xb087('0xd9'));}return rp(_0x471c54);}else{throw new db[(_0xb087('0x9d'))][(_0xb087('0xd8'))](_0xb087('0xda'));}})[_0xb087('0x25')](function(_0x2fdcee){_0x547968=_0x2fdcee;if(_0x547968['id']){var _0x5ae13d={'body':_0x547968[_0xb087('0xdb')],'ChatWebsiteId':_0x259ac0['id'],'ChatInteractionId':_0x52268a['id'],'direction':'out','UserId':_0x33756c[_0xb087('0xa6')]['id']};return db[_0xb087('0xdc')]['create'](_0x5ae13d,{});}else{throw new db[(_0xb087('0x9d'))][(_0xb087('0xd8'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})['then'](function(){return _0x52268a[_0xb087('0xdd')]({'vidaooSessionId':_0x547968['id']});})['then'](respondWithResult(_0x2e8eb1,null))[_0xb087('0xc9')](handleError(_0x2e8eb1,null));};exports['customUpdate']=function(_0x1e04ff,_0x1a99a3){if(_0x1e04ff[_0xb087('0x3f')]['id']){delete _0x1e04ff['body']['id'];}return db[_0xb087('0x4b')][_0xb087('0x74')]({'where':{'id':_0x1e04ff[_0xb087('0xc5')]['id']},'include':[{'model':db[_0xb087('0xde')],'as':_0xb087('0xdf')}]})[_0xb087('0x25')](handleEntityNotFound(_0x1a99a3,null))[_0xb087('0x25')](saveUpdates(_0x1e04ff[_0xb087('0x3f')],null))[_0xb087('0x25')](respondWithResult(_0x1a99a3,null))[_0xb087('0xc9')](handleError(_0x1a99a3,null));};exports['abandon']=function(_0x3a5432,_0x520aa9,_0x31d03d){if(_0x3a5432[_0xb087('0x3f')]['id']){delete _0x3a5432[_0xb087('0x3f')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x3a5432['params']['id']}})[_0xb087('0x25')](function(_0xfaa17f){if(!_0xfaa17f){logger[_0xb087('0x2a')](_0xb087('0xe0'),_0xb087('0xe1'),0x194,_0xb087('0xe2'));_0x520aa9[_0xb087('0x2e')](0x194);}else{if(_0xfaa17f['UserId']){throw new db[(_0xb087('0x9d'))]['ValidationError']('Interaction\x20already\x20assigned');}}return _0xfaa17f;})['then'](function(_0x4cde01){if(_0x4cde01){return _0x4cde01[_0xb087('0x3b')]({'closed':_0x3a5432[_0xb087('0x3f')]['closed'],'disposition':_0x3a5432[_0xb087('0x3f')][_0xb087('0xe3')]})[_0xb087('0x25')](function(_0x500a2b){return _0x500a2b;});}})[_0xb087('0x25')](function(_0x11a1a5){return respondWithRpcPromise('AbandonInteraction',_0xb087('0xe1'),_0x3a5432[_0xb087('0x3f')],client9004);})[_0xb087('0x25')](respondWithResult(_0x520aa9,null))[_0xb087('0xc9')](handleError(_0x520aa9,null));};exports['attachmentUpload']=function(_0x270e65,_0x10c680,_0x164371){_0x270e65[_0xb087('0x3f')][_0xb087('0x3d')]=_0x270e65[_0xb087('0xe4')]['originalname'];_0x270e65[_0xb087('0x3f')]['basename']=_0x270e65[_0xb087('0xe4')][_0xb087('0xe5')];_0x270e65['body'][_0xb087('0x4d')]=_0x270e65['file']['mimetype'];return db['Attachment'][_0xb087('0xca')](_0x270e65[_0xb087('0x3f')])[_0xb087('0x25')](respondWithResult(_0x10c680,0xc9))[_0xb087('0xc9')](handleError(_0x10c680,null));};exports[_0xb087('0xe6')]=function(_0x1e0751,_0x2831b4,_0x218fe3){return db['ChatInteraction'][_0xb087('0xcd')]({'where':{'id':_0x1e0751['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x2831b4,null))[_0xb087('0x25')](function(_0x1babd3){if(_0x1babd3){if(_0x1babd3[_0xb087('0xe7')]){return _0x2831b4['status'](0x193)['json']({'status':0x193,'message':_0xb087('0xe8')});}return db[_0xb087('0xe9')][_0xb087('0xcd')]({'where':{'id':_0x1e0751[_0xb087('0x50')][_0xb087('0xea')]},'raw':!![]})[_0xb087('0x25')](handleEntityNotFound(_0x2831b4,null));}})['then'](function(_0x52341e){if(_0x52341e){var _0x54eed6=_0x52341e[_0xb087('0xeb')]!==null;var _0x12d277=path[_0xb087('0xec')](config[_0xb087('0xed')],'server/files/attachments/');if(_0x54eed6){_0x12d277=path[_0xb087('0xec')](_0x12d277,_0xb087('0xee'));}var _0x1b5422=path[_0xb087('0xec')](_0x12d277,_0x52341e[_0xb087('0xef')]);return _0x2831b4[_0xb087('0xf0')](_0x1b5422);}})[_0xb087('0xc9')](handleError(_0x2831b4,null));};exports[_0xb087('0xf1')]=function(_0x120012,_0x385065){var _0x56e768=null;var _0x5a2142=null;var _0x24171a=null;var _0x39577d=null;if(_0x120012[_0xb087('0x3f')]['id']){delete _0x120012[_0xb087('0x3f')]['id'];}if(_0x120012[_0xb087('0x3f')][_0xb087('0xf2')]){_0x39577d=path[_0xb087('0xec')](config[_0xb087('0xed')],_0xb087('0xf3'),util[_0xb087('0xf4')](_0xb087('0xf5'),Date[_0xb087('0xf6')]()));_0x120012[_0xb087('0x3f')][_0xb087('0xf7')]=_0x39577d;}return db[_0xb087('0x4b')][_0xb087('0x74')]({'where':{'id':_0x120012[_0xb087('0xc5')]['id']},'include':[{'model':db[_0xb087('0xdc')],'as':_0xb087('0xf8'),'include':[{'model':db[_0xb087('0x81')],'as':_0xb087('0x81')}]}]})[_0xb087('0x25')](handleEntityNotFound(_0x385065,null))[_0xb087('0x25')](saveUpdates(_0x120012[_0xb087('0x3f')],null))[_0xb087('0x25')](function(_0x365d41){if(_0x365d41){_0x56e768=_0x365d41;return db[_0xb087('0xcc')][_0xb087('0x74')]({'where':{'id':_0x56e768[_0xb087('0x89')]}});}})[_0xb087('0x25')](function(_0x159082){if(_0x159082){_0x24171a=_0x159082;return db[_0xb087('0xde')][_0xb087('0x74')]({'where':{'id':_0x56e768[_0xb087('0x7d')]}});}})[_0xb087('0x25')](function(_0x2d8c34){if(_0x2d8c34){_0x5a2142=_0x2d8c34;if(_0x39577d){var _0x5a50a1=null;for(var _0x57186a=0x1;_0x57186a<_0x56e768['Messages'][_0xb087('0x54')];++_0x57186a){_0x5a50a1=_0x56e768[_0xb087('0xf8')][_0x57186a];var _0x4cbc90=_0x5a50a1[_0xb087('0x84')]?util['format'](_0xb087('0xf9'),_0x24171a[_0xb087('0xfa')],_0x5a50a1[_0xb087('0x84')]):_0xb087('0xfb');var _0x39f701=_0x120012[_0xb087('0x3f')][_0xb087('0xfc')]||util[_0xb087('0xf4')](_0xb087('0xf9'),_0xb087('0xfd'),_0x5a50a1[_0xb087('0x7d')]);switch(_0x24171a['agentIdentifier']){case _0xb087('0xfe'):_0x4cbc90=_0x5a50a1[_0xb087('0x84')]?util[_0xb087('0xf4')](_0xb087('0xf9'),_0x24171a['agentAlias'],_0x5a50a1[_0xb087('0x84')]):_0xb087('0xfb');break;case _0xb087('0xff'):_0x4cbc90=_0x5a50a1[_0xb087('0x84')]?_0x5a50a1[_0xb087('0x81')][_0xb087('0x100')]||_0x5a50a1[_0xb087('0x81')][_0xb087('0x45')]:_0xb087('0xfb');break;case _0xb087('0x101'):_0x4cbc90=_0x5a50a1[_0xb087('0x84')]?_0x5a50a1[_0xb087('0x81')][_0xb087('0x45')]:_0xb087('0xfb');break;default:_0x4cbc90=_0x5a50a1[_0xb087('0x84')]?util[_0xb087('0xf4')](_0xb087('0xf9'),_0x24171a[_0xb087('0xfa')],_0x5a50a1['UserId']):_0xb087('0xfb');}var _0x2c85ed=util[_0xb087('0xf4')](_0xb087('0x102'),moment(_0x5a50a1['createdAt'])[_0xb087('0xf4')](_0xb087('0x103')),_0x5a50a1[_0xb087('0x104')]==='in'?_0x39f701:_0x4cbc90,_0x5a50a1[_0xb087('0x3f')]);if(!_0x5a50a1[_0xb087('0x105')]){fs['appendFileSync'](_0x39577d,_0x2c85ed);}}return db[_0xb087('0x106')][_0xb087('0xcd')]({'where':{'service':!![]},'include':[{'model':db[_0xb087('0x107')],'as':_0xb087('0x108'),'raw':!![]}]});}}})[_0xb087('0x25')](function(_0x17ad89){if(_0x17ad89&&_0x17ad89[_0xb087('0x108')]&&_0x120012[_0xb087('0x3f')]){var _0x58a76b={'tls':{'rejectUnauthorized':![]}};if(_0x17ad89[_0xb087('0x108')][_0xb087('0x109')]){_0x58a76b['service']=_0x17ad89[_0xb087('0x108')][_0xb087('0x109')];}else{_0x58a76b['host']=_0x17ad89[_0xb087('0x108')][_0xb087('0x10a')];_0x58a76b[_0xb087('0x10b')]=_0x17ad89[_0xb087('0x108')][_0xb087('0x10b')];_0x58a76b[_0xb087('0x10c')]=_0x17ad89[_0xb087('0x108')]['secure'];}if(_0x17ad89[_0xb087('0x108')][_0xb087('0x10d')]){_0x58a76b[_0xb087('0x10e')]={'user':_0x17ad89[_0xb087('0x108')][_0xb087('0xa6')],'pass':_0x17ad89[_0xb087('0x108')]['pass']};}return respondWithRpcPromise(_0xb087('0x10f'),_0xb087('0x110'),{'account':_0x58a76b,'message':{'from':util[_0xb087('0xf4')](_0xb087('0x111'),_0x17ad89[_0xb087('0x3d')],_0x17ad89['email']||_0x17ad89[_0xb087('0x108')][_0xb087('0xa6')]),'to':_0x120012[_0xb087('0x3f')]['mailTranscript'],'subject':_0xb087('0x112'),'text':util['format'](_0xb087('0x113'),_0x120012['body'][_0xb087('0xf2')]),'attachments':[{'path':_0x39577d}]}})['then'](function(){return _0x56e768;})[_0xb087('0xc9')](function(_0x3d916e){console['error'](_0x3d916e);});}else{return _0x56e768;}})[_0xb087('0x25')](respondWithStatusCode(_0x385065,0xc8))['catch'](handleError(_0x385065,null));};exports['addMessage']=function(_0x5180ad,_0x396660,_0x4b2169){return db[_0xb087('0xdc')]['find']({'where':{'id':_0x5180ad['params']['id']}})[_0xb087('0x25')](handleEntityNotFound(_0x396660,null))[_0xb087('0x25')](function(_0x371655){if(_0x371655){return _0x371655[_0xb087('0x114')](_0x5180ad[_0xb087('0x3f')]['ids'],_[_0xb087('0x115')](_0x5180ad[_0xb087('0x3f')],[_0xb087('0x116'),'id'])||{});}})[_0xb087('0x25')](respondWithResult(_0x396660,null))[_0xb087('0xc9')](handleError(_0x396660,null));};exports[_0xb087('0x117')]=function(_0x1ca818,_0x2ec638,_0x57d42a){var _0x451c8a={'raw':![],'where':{}};var _0x3768db={};var _0x1db8ba={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xb087('0xcd')]({'where':{'id':_0x1ca818[_0xb087('0xc5')]['id']}})[_0xb087('0x25')](handleEntityNotFound(_0x2ec638,null))['then'](function(_0x4904ea){if(_0x4904ea){_0x3768db[_0xb087('0x4f')]=_[_0xb087('0x86')](db[_0xb087('0xdc')][_0xb087('0xc6')]);_0x3768db['query']=_[_0xb087('0x86')](_0x1ca818[_0xb087('0x50')]);_0x3768db[_0xb087('0x59')]=_[_0xb087('0x51')](_0x3768db[_0xb087('0x4f')],_0x3768db['query']);_0x451c8a['attributes']=_[_0xb087('0x51')](_0x3768db[_0xb087('0x4f')],qs['fields'](_0x1ca818[_0xb087('0x50')][_0xb087('0x53')]));_0x451c8a[_0xb087('0x52')]=_0x451c8a[_0xb087('0x52')][_0xb087('0x54')]?_0x451c8a[_0xb087('0x52')]:_0x3768db[_0xb087('0x4f')];if(!_0x1ca818['query'][_0xb087('0x55')](_0xb087('0x118'))){_0x451c8a[_0xb087('0x34')]=qs['limit'](_0x1ca818['query'][_0xb087('0x34')]);_0x451c8a[_0xb087('0x32')]=qs[_0xb087('0x32')](_0x1ca818[_0xb087('0x50')]['offset']);}_0x451c8a[_0xb087('0x56')]=qs[_0xb087('0x57')](_0x1ca818[_0xb087('0x50')]['sort']);_0x451c8a['where']=qs[_0xb087('0x59')](_['pick'](_0x1ca818[_0xb087('0x50')],_0x3768db[_0xb087('0x59')]));_0x451c8a['where']['ChatInteractionId']=_0x4904ea['id'];if(_0x1ca818[_0xb087('0x50')][_0xb087('0x119')]){_0x451c8a[_0xb087('0x8f')]=_[_0xb087('0xae')](_0x451c8a['where'],{'$or':_[_0xb087('0x44')](_0x451c8a['attributes'],function(_0x52cc1a){var _0x117552={};_0x117552[_0x52cc1a]={'$like':'%'+_0x1ca818[_0xb087('0x50')][_0xb087('0x119')]+'%'};return _0x117552;})});}if(_0x1ca818[_0xb087('0x50')][_0xb087('0x8d')]){var _0x484bb5=_0x1ca818[_0xb087('0x50')]['$gte']['split'](',');var _0x46f8cf={};_0x46f8cf[_0x484bb5[0x0]]={'$gte':moment(_0x484bb5[0x1])[_0xb087('0xf4')]('YYYY-MM-DD\x20HH:mm:ss')};_0x451c8a[_0xb087('0x8f')]=_[_0xb087('0xae')](_0x451c8a[_0xb087('0x8f')],_0x46f8cf);}_0x451c8a=_[_0xb087('0xae')]({},_0x451c8a,_0x1ca818['options']);return db[_0xb087('0xdc')][_0xb087('0x35')]({'where':_0x451c8a[_0xb087('0x8f')]})[_0xb087('0x25')](function(_0x2c3d1b){_0x1db8ba['count']=_0x2c3d1b;if(_0x1ca818['query']['includeAll']){_0x451c8a[_0xb087('0xc7')]=[{'all':!![]}];}return db['ChatMessage'][_0xb087('0x11a')](_0x451c8a);})[_0xb087('0x25')](function(_0x4c1577){_0x1db8ba[_0xb087('0x11b')]=_0x4c1577;return _0x1db8ba;});}})[_0xb087('0x25')](respondWithFilteredResult(_0x2ec638,_0x451c8a))[_0xb087('0xc9')](handleError(_0x2ec638,null));};exports[_0xb087('0x11c')]=function(_0xad3eae,_0xb6682a,_0x1dbeb1){var _0x2caa79={'where':{}},_0x521e0c={},_0x1ffbd9={'count':0x0,'rows':[]};return db[_0xb087('0x4b')][_0xb087('0xcd')]({'where':{'id':_0xad3eae['params']['id']}})[_0xb087('0x25')](handleEntityNotFound(_0xb6682a,null))[_0xb087('0x25')](function(_0x3fd51b){if(_0x3fd51b){_0x521e0c[_0xb087('0x4f')]=_['keys'](db['ChatMessage'][_0xb087('0xc6')]);_0x521e0c[_0xb087('0x50')]=_[_0xb087('0x86')](_0xad3eae[_0xb087('0x50')]);_0x521e0c[_0xb087('0x59')]=_[_0xb087('0x51')](_0x521e0c['model'],_0x521e0c['query']);_0x2caa79[_0xb087('0x52')]=_[_0xb087('0x51')](_0x521e0c[_0xb087('0x4f')],qs[_0xb087('0x53')](_0xad3eae['query'][_0xb087('0x53')]));_0x2caa79[_0xb087('0x52')]=_0x2caa79[_0xb087('0x52')][_0xb087('0x54')]?_0x2caa79[_0xb087('0x52')]:_0x521e0c[_0xb087('0x4f')];if(!_0xad3eae[_0xb087('0x50')][_0xb087('0x55')](_0xb087('0x118'))){_0x2caa79[_0xb087('0x34')]=qs[_0xb087('0x34')](_0xad3eae[_0xb087('0x50')][_0xb087('0x34')]);_0x2caa79[_0xb087('0x32')]=qs[_0xb087('0x32')](_0xad3eae[_0xb087('0x50')][_0xb087('0x32')]);}_0x2caa79[_0xb087('0x56')]=qs[_0xb087('0x57')](_0xad3eae[_0xb087('0x50')]['sort']);_0x2caa79[_0xb087('0x8f')]=qs[_0xb087('0x59')](_['pick'](_0xad3eae[_0xb087('0x50')],_0x521e0c[_0xb087('0x59')]));_0x2caa79[_0xb087('0x8f')]['ChatInteractionId']=_0x3fd51b['id'];if(_0xad3eae[_0xb087('0x50')]['filter']){_0x2caa79['where']=_[_0xb087('0xae')](_0x2caa79[_0xb087('0x8f')],{'$or':_[_0xb087('0x44')](_0x2caa79[_0xb087('0x52')],function(_0x4a1749){var _0x300e08={};_0x300e08[_0x4a1749]={'$like':'%'+_0xad3eae['query'][_0xb087('0x119')]+'%'};return _0x300e08;})});}_0x2caa79[_0xb087('0x8f')][_0xb087('0x105')]=![];if(_0xad3eae['query']['id']){_0x2caa79['where']['id']={'$gt':_0xad3eae[_0xb087('0x50')]['id']};}_0x2caa79=_['merge']({},_0x2caa79,_0xad3eae['options']);return db[_0xb087('0xdc')][_0xb087('0x35')]({'where':_0x2caa79['where']})[_0xb087('0x25')](function(_0x241c68){_0x1ffbd9[_0xb087('0x35')]=_0x241c68;_0x2caa79[_0xb087('0xc7')]=[];if(_0xad3eae['query']['includeAgent']){_0x2caa79[_0xb087('0xc7')][_0xb087('0xc2')]({'model':db[_0xb087('0x81')],'as':_0xb087('0x81'),'attributes':['id','fullname',_0xb087('0x100')]});}if(_0xad3eae[_0xb087('0x50')][_0xb087('0x11d')]){_0x2caa79[_0xb087('0xc7')]=[{'all':!![]}];}return db[_0xb087('0xdc')][_0xb087('0x11a')](_0x2caa79);})[_0xb087('0x25')](function(_0x3b5740){_0x1ffbd9['rows']=_0x3b5740;return _0x1ffbd9;});}})[_0xb087('0x25')](respondWithFilteredResult(_0xb6682a,_0x2caa79))[_0xb087('0xc9')](handleError(_0xb6682a,null));};exports[_0xb087('0x11e')]=function(_0x594ddc,_0x30521e,_0x13acd8){return db[_0xb087('0x4b')][_0xb087('0x74')]({'where':{'id':_0x594ddc[_0xb087('0xc5')]['id']}})[_0xb087('0x25')](handleEntityNotFound(_0x30521e,null))['then'](function(_0x528edd){if(_0x528edd){return _0x528edd[_0xb087('0x11f')](_0x594ddc[_0xb087('0x3f')][_0xb087('0x116')],_[_0xb087('0x115')](_0x594ddc[_0xb087('0x3f')],[_0xb087('0x116'),'id'])||{})['spread'](function(){return db['Tag'][_0xb087('0x11a')]({'attributes':['id',_0xb087('0x3d'),'color'],'where':{'id':_0x594ddc['body'][_0xb087('0x116')]}});})[_0xb087('0x25')](function(_0x24ae87){socket['emit'](_0xb087('0x120'),{'id':Number(_0x594ddc[_0xb087('0xc5')]['id']),'tags':_0x24ae87||[]});return{'id':Number(_0x594ddc['params']['id']),'tags':_0x24ae87||[]};});}})[_0xb087('0x25')](respondWithResult(_0x30521e,null))['catch'](handleError(_0x30521e,null));};exports['removeTags']=function(_0x592d18,_0x5cbda4,_0x5a182e){return db[_0xb087('0x4b')]['find']({'where':{'id':_0x592d18[_0xb087('0xc5')]['id']}})[_0xb087('0x25')](handleEntityNotFound(_0x5cbda4,null))['then'](function(_0x12f2b2){if(_0x12f2b2){return _0x12f2b2[_0xb087('0x121')](_0x592d18[_0xb087('0x50')][_0xb087('0x116')]);}})['then'](respondWithStatusCode(_0x5cbda4,null))[_0xb087('0xc9')](handleError(_0x5cbda4,null));};exports[_0xb087('0xf0')]=function(_0x17d60b,_0x5df18d){var _0x538812=moment()[_0xb087('0x122')]()[_0xb087('0xac')]();var _0x39732b=path[_0xb087('0xec')](config[_0xb087('0xed')],'server',_0xb087('0x123'),'tmp');var _0x1d8582=path[_0xb087('0xec')](config['root'],_0xb087('0x124'),'files',_0xb087('0x125'));var _0x3f2e19=path[_0xb087('0xec')](_0x39732b,_0x538812);var _0x2d500c=util[_0xb087('0xf4')](_0xb087('0x126'),_0x17d60b[_0xb087('0xc5')]['id'],_0x538812);var _0x407837=path['join'](_0x39732b,_0x2d500c);var _0x220896=[];_0x220896[_0xb087('0xc2')]({'model':db[_0xb087('0x81')],'as':_0xb087('0x81'),'attributes':['id',_0xb087('0x45')],'raw':!![]});_0x220896[_0xb087('0xc2')]({'model':db[_0xb087('0xde')],'as':_0xb087('0xdf'),'attributes':['id',_0xb087('0x127'),'lastName'],'raw':!![]});if(_0x17d60b[_0xb087('0x50')][_0xb087('0x125')]){_0x220896[_0xb087('0xc2')]({'model':db[_0xb087('0xe9')],'as':_0xb087('0xe9'),'raw':!![]});}var _0x6fa760=[{'model':db['ChatMessage'],'as':_0xb087('0xf8'),'attributes':['id',_0xb087('0x3f'),_0xb087('0x8b'),'direction',_0xb087('0x105'),_0xb087('0x92')],'include':_0x220896}];_0x6fa760[_0xb087('0xc2')]({'model':db['ChatWebsite'],'as':_0xb087('0x128'),'attributes':['id',_0xb087('0x3d')]});_0x6fa760['push']({'model':db[_0xb087('0x81')],'as':_0xb087('0x129'),'attributes':['id',_0xb087('0x45')]});return db[_0xb087('0x4b')][_0xb087('0x74')]({'where':{'id':_0x17d60b['params']['id']},'include':_0x6fa760})[_0xb087('0x25')](handleEntityNotFound(_0x5df18d,null))[_0xb087('0x25')](function(_0x196111){if(_0x196111){var _0x2711ed=_0x196111['get']({'plain':!![]});fs['mkdirSync'](_0x3f2e19);var _0x2aa136={'channel':'Chat','account':_0x2711ed[_0xb087('0x128')][_0xb087('0x3d')],'agent':_0x2711ed['Owner']?_0x2711ed[_0xb087('0x129')][_0xb087('0x45')]:'N.A.','createdAt':moment(_0x2711ed['createdAt'])[_0xb087('0xf4')](_0xb087('0x12a'))[_0xb087('0xac')](),'closedAt':_0x2711ed['closed']?moment(_0x2711ed['closedAt'])['format'](_0xb087('0x12a'))[_0xb087('0xac')]():'','disposition':_0x2711ed[_0xb087('0xe3')],'chatInfo':{'browser':_0x2711ed['browserName'],'os':_0x2711ed['osName'],'referer':_0x2711ed[_0xb087('0x12b')],'customerIp':_0x2711ed[_0xb087('0x12c')],'customerPort':_0x2711ed[_0xb087('0x12d')]?_0x2711ed[_0xb087('0x12d')]:_0xb087('0x12e')},'messages':_(_0x2711ed[_0xb087('0xf8')])[_0xb087('0x12f')]()[_0xb087('0x119')]({'secret':![]})[_0xb087('0x44')](function(_0x4392f7){if(_0x4392f7[_0xb087('0xe9')]){var _0x2ce41b=path[_0xb087('0xec')](_0x1d8582,_0x4392f7[_0xb087('0xe9')][_0xb087('0xef')]);if(fs[_0xb087('0x130')](_0x2ce41b)){fs['createReadStream'](_0x2ce41b)[_0xb087('0x131')](fs[_0xb087('0x132')](path['join'](_0x3f2e19,_0x4392f7['Attachment'][_0xb087('0xef')])));}}return{'date':moment(_0x4392f7[_0xb087('0x8b')])[_0xb087('0xf4')](_0xb087('0x12a'))['toString'](),'sender':_0x4392f7[_0xb087('0x104')]===_0xb087('0x133')?_0x4392f7['User']?_0x4392f7['User'][_0xb087('0x45')]:_0xb087('0xfb'):_0x4392f7[_0xb087('0xdf')]['firstName']+(_0x4392f7[_0xb087('0xdf')][_0xb087('0x134')]?'\x20'+_0x4392f7[_0xb087('0xdf')][_0xb087('0x134')]:''),'body':_0x4392f7[_0xb087('0xe9')]?_0x4392f7[_0xb087('0xe9')][_0xb087('0xef')]:_0x4392f7['body'],'direction':_0x4392f7[_0xb087('0x104')]===_0xb087('0x133')?'A':'C','secret':_0x4392f7[_0xb087('0x105')],'read':_0x4392f7[_0xb087('0x92')],'attachment':_0x4392f7[_0xb087('0xe9')]};})['value']()};return ejs['renderFile'](path[_0xb087('0xec')](config[_0xb087('0xed')],_0xb087('0x124'),'views',_0xb087('0x135')),{'interaction':_0x2aa136})[_0xb087('0x25')](function(_0x3e4bec){var _0x52b038=path[_0xb087('0xec')](_0x3f2e19,_0xb087('0x136')+_0x2711ed['id']+'-'+_0x538812+_0xb087('0x137'));var _0x4e6b9f={'path':_0x52b038,'channel':'Chat','interactionId':_0x2711ed['id']};return pdf['createPdfFromHTML'](_0x3e4bec,_0x4e6b9f);})[_0xb087('0x25')](function(){return new BPromise(function(_0x22dea9,_0x1c9337){zipdir(_0x3f2e19,{'saveTo':_0x407837},function(_0x3d0278,_0x1c8982){if(_0x3d0278)return _0x1c9337(_0x3d0278);return _0x22dea9(_0x1c8982);});})[_0xb087('0x25')](function(){return new BPromise(function(_0x31b3e7,_0x6b8337){rimraf(_0x3f2e19,function(_0x348c92){if(_0x348c92)_0x6b8337(_0x348c92);return _0x31b3e7();});});})[_0xb087('0x25')](function(){return _0x5df18d[_0xb087('0xf0')](_0x407837,_0x2d500c,function(_0x218e1c){if(_0x218e1c){console[_0xb087('0x138')](_0xb087('0x139'),_0x218e1c);}else{fs[_0xb087('0x13a')](_0x407837);}});});});}else{return _0x5df18d[_0xb087('0x2e')](0xc8);}})[_0xb087('0xc9')](handleError(_0x5df18d,null));}; \ No newline at end of file +var _0xea28=['fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','catch','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','destroy','sendStatus','stack','name','merge','contact','agent','interaction','account','Users','map','TagIds','Tags','split','forEach','index','ChatInteraction','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','u.id','ui.ChatInteractionId','from','user_has_chat_interactions','users','u.id\x20=\x20ui.UserId','chat_interactions','left_join','cm_contacts','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','search','parseSearch','conditions','find','unreadMessages','having','`\x20=\x200','Contact','$substring','value','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','Tag','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','compact','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','role','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','Contact.lastName','Contact.email','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','push','all','params','includeAll','options','create','body','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooNote','vidaooMetadata','POST','https://api-vidaoo.xcally.com/api/v1/meetings','email','isNull','follow','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','join_url','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','attachmentDownload','closed','Unauthorized','Attachment','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','now','pathTranscript','%s%d','agentAlias','System','customer','format','Visitor','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','fullname','[%s]\x20%s:\x20%s\x0a','direction','appendFileSync','MailServerOut','Smtp','service','port','secure','authentication','auth','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','addMessage','ids','omit','getMessages','include','findAll','rows','getMyMessages','secret','includeAgent','addTags','setTags','spread','emit','removeTags','files','attachments','transcript-%d-%s.zip','firstName','lastName','Messages','read','Account','Chat','Owner','YYYY-MM-DD\x20HH:mm:ss','browserName','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','out','renderFile','views','downloadInteraction.ejs','transcript-','log','unlinkSync','eml-format','rimraf','zip-dir'];(function(_0x42cb8d,_0x273bca){var _0x2713b6=function(_0x15b77f){while(--_0x15b77f){_0x42cb8d['push'](_0x42cb8d['shift']());}};_0x2713b6(++_0x273bca);}(_0xea28,0x13a));var _0x8ea2=function(_0x588881,_0xda26b8){_0x588881=_0x588881-0x0;var _0x4d3d2c=_0xea28[_0x588881];return _0x4d3d2c;};'use strict';var emlformat=require(_0x8ea2('0x0'));var rimraf=require(_0x8ea2('0x1'));var zipdir=require(_0x8ea2('0x2'));var jsonpatch=require(_0x8ea2('0x3'));var rp=require(_0x8ea2('0x4'));var moment=require(_0x8ea2('0x5'));var BPromise=require(_0x8ea2('0x6'));var Mustache=require(_0x8ea2('0x7'));var util=require('util');var path=require(_0x8ea2('0x8'));var sox=require(_0x8ea2('0x9'));var csv=require(_0x8ea2('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8ea2('0xb'));var _=require(_0x8ea2('0xc'));var squel=require(_0x8ea2('0xd'));var crypto=require(_0x8ea2('0xe'));var jsforce=require(_0x8ea2('0xf'));var deskjs=require(_0x8ea2('0x10'));var toCsv=require(_0x8ea2('0xa'));var querystring=require(_0x8ea2('0x11'));var Papa=require(_0x8ea2('0x12'));var Redis=require(_0x8ea2('0x13'));var authService=require(_0x8ea2('0x14'));var qs=require(_0x8ea2('0x15'));var as=require('../../components/parsers/advancedSearch');var pdf=require('../../components/export/pdf');var hardwareService=require(_0x8ea2('0x16'));var logger=require(_0x8ea2('0x17'))(_0x8ea2('0x18'));var utils=require('../../config/utils');var config=require(_0x8ea2('0x19'));var licenseUtil=require(_0x8ea2('0x1a'));var db=require(_0x8ea2('0x1b'))['db'];config[_0x8ea2('0x1c')]=_[_0x8ea2('0x1d')](config['redis'],{'host':_0x8ea2('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8ea2('0x1f'))[_0x8ea2('0x20')](socket);var jayson=require(_0x8ea2('0x21'));var client=jayson[_0x8ea2('0x22')][_0x8ea2('0x23')]({'port':0x232b});var client9004=jayson[_0x8ea2('0x22')][_0x8ea2('0x23')]({'port':0x232c});function respondWithRpcPromise(_0x11f5e8,_0x474873,_0x396aab,_0x2dfa7c){return new BPromise(function(_0x1c1715,_0x3bc774){var _0xaa8abf=_0x2dfa7c||client;return _0xaa8abf[_0x8ea2('0x24')](_0x11f5e8,_0x396aab)[_0x8ea2('0x25')](function(_0x467045){logger[_0x8ea2('0x26')](_0x8ea2('0x27'),_0x474873,_0x8ea2('0x28'));logger[_0x8ea2('0x29')](_0x8ea2('0x2a'),_0x474873,'request\x20sent',JSON['stringify'](_0x467045));if(_0x467045[_0x8ea2('0x2b')]){if(_0x467045[_0x8ea2('0x2b')][_0x8ea2('0x2c')]===0x1f4){logger['error'](_0x8ea2('0x27'),_0x474873,_0x467045[_0x8ea2('0x2b')]['message']);return _0x3bc774(_0x467045[_0x8ea2('0x2b')][_0x8ea2('0x2d')]);}logger[_0x8ea2('0x2b')](_0x8ea2('0x27'),_0x474873,_0x467045[_0x8ea2('0x2b')][_0x8ea2('0x2d')]);return _0x1c1715(_0x467045[_0x8ea2('0x2b')][_0x8ea2('0x2d')]);}else{logger[_0x8ea2('0x26')]('ChatInteraction,\x20%s,\x20%s',_0x474873,_0x8ea2('0x28'));_0x1c1715(_0x467045['result'][_0x8ea2('0x2d')]);}})[_0x8ea2('0x2e')](function(_0x29b38f){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x474873,_0x29b38f);_0x3bc774(_0x29b38f);});});}function respondWithStatusCode(_0x2e4da3,_0x4dc7bf){_0x4dc7bf=_0x4dc7bf||0xcc;return function(_0x200a49){if(_0x200a49){return _0x2e4da3['sendStatus'](_0x4dc7bf);}return _0x2e4da3[_0x8ea2('0x2f')](_0x4dc7bf)[_0x8ea2('0x30')]();};}function respondWithResult(_0x21c526,_0x266db8){_0x266db8=_0x266db8||0xc8;return function(_0x4e1b90){if(_0x4e1b90){return _0x21c526['status'](_0x266db8)[_0x8ea2('0x31')](_0x4e1b90);}};}function respondWithFilteredResult(_0x4da5b3,_0x4a9875){return function(_0x287078){if(_0x287078){var _0x24f187=typeof _0x4a9875[_0x8ea2('0x32')]===_0x8ea2('0x33')&&typeof _0x4a9875[_0x8ea2('0x34')]===_0x8ea2('0x33');var _0x316707=_0x287078[_0x8ea2('0x35')];var _0x9c5fac=_0x24f187?0x0:_0x4a9875['offset'];var _0x5b7ff9=_0x24f187?_0x287078[_0x8ea2('0x35')]:_0x4a9875[_0x8ea2('0x32')]+_0x4a9875['limit'];var _0x4a110f;if(_0x5b7ff9>=_0x316707){_0x5b7ff9=_0x316707;_0x4a110f=0xc8;}else{_0x4a110f=0xce;}_0x4da5b3[_0x8ea2('0x2f')](_0x4a110f);return _0x4da5b3['set'](_0x8ea2('0x36'),_0x9c5fac+'-'+_0x5b7ff9+'/'+_0x316707)[_0x8ea2('0x31')](_0x287078);}return null;};}function patchUpdates(_0x53fd06){return function(_0x17b21c){try{jsonpatch[_0x8ea2('0x37')](_0x17b21c,_0x53fd06,!![]);}catch(_0x33abc8){return BPromise['reject'](_0x33abc8);}return _0x17b21c['save']();};}function saveUpdates(_0x49a252,_0x3880c3){return function(_0x233e12){if(_0x233e12){return _0x233e12[_0x8ea2('0x38')](_0x49a252)['then'](function(_0x456487){return _0x456487;});}return null;};}function removeEntity(_0x391b08,_0x3d5bf0){return function(_0x278e5d){if(_0x278e5d){return _0x278e5d[_0x8ea2('0x39')]()[_0x8ea2('0x25')](function(){_0x391b08[_0x8ea2('0x2f')](0xcc)[_0x8ea2('0x30')]();});}};}function handleEntityNotFound(_0x5e9b1f,_0x955ef3){return function(_0x29e3f5){if(!_0x29e3f5){_0x5e9b1f[_0x8ea2('0x3a')](0x194);}return _0x29e3f5;};}function handleError(_0x467d97,_0x4eebc1){_0x4eebc1=_0x4eebc1||0x1f4;return function(_0x2a1f14){logger['error'](_0x2a1f14[_0x8ea2('0x3b')]);if(_0x2a1f14[_0x8ea2('0x3c')]){delete _0x2a1f14[_0x8ea2('0x3c')];}_0x467d97[_0x8ea2('0x2f')](_0x4eebc1)['send'](_0x2a1f14);};}function getMustacheRender(_0x2bed24,_0x531979){return Mustache['render'](_0x2bed24,_[_0x8ea2('0x3d')](_0x531979['body'],{'contact':_0x531979[_0x8ea2('0x3e')],'message':_0x531979[_0x8ea2('0x2d')],'agent':_0x531979[_0x8ea2('0x3f')],'interaction':_0x531979[_0x8ea2('0x40')],'account':_0x531979[_0x8ea2('0x41')]}))||'';}function getInteractionUsers(_0x4ae536,_0x84685d){return new BPromise(function(_0x5c5d2d,_0x12a6c2){try{if(_0x84685d[_0x4ae536['id']]){_0x4ae536[_0x8ea2('0x42')]=_[_0x8ea2('0x43')](_0x84685d[_0x4ae536['id']],function(_0x3995ff){return{'id':_0x3995ff['id'],'fullname':_0x3995ff['fullname']};});}}catch(_0x44e8bc){_0x12a6c2(_0x44e8bc);}_0x5c5d2d(_0x4ae536);});}function getInteractionTags(_0x57a6b8,_0x3f0c78){return new BPromise(function(_0x5ba351,_0x2ee78b){try{if(_0x57a6b8[_0x8ea2('0x44')]){_0x57a6b8[_0x8ea2('0x45')]=[];_0x57a6b8[_0x8ea2('0x44')][_0x8ea2('0x46')](',')[_0x8ea2('0x47')](function(_0x2f4fa8){_0x57a6b8['Tags']['push'](_0x3f0c78[_0x2f4fa8]);});}delete _0x57a6b8[_0x8ea2('0x44')];}catch(_0x53455a){_0x2ee78b(_0x53455a);}_0x5ba351(_0x57a6b8);});}function updateChatInteraction(_0x4b03fa,_0x59e2fa,_0x3cbc09){return new BPromise(function(_0x5d9ba0,_0x40a532){return getInteractionUsers(_0x4b03fa,_0x3cbc09)[_0x8ea2('0x25')](function(_0x39c944){return getInteractionTags(_0x39c944,_0x59e2fa);})[_0x8ea2('0x25')](function(_0x989d9b){_0x5d9ba0(_0x989d9b);})[_0x8ea2('0x2e')](function(_0x3b2219){_0x40a532(_0x3b2219);});});}exports[_0x8ea2('0x48')]=function(_0x5352b9,_0x3afb80){var _0x1ef615={},_0x1db25c={},_0x5cb6ad={'count':0x0,'rows':[]};var _0x2d6bbb=_[_0x8ea2('0x43')](db[_0x8ea2('0x49')][_0x8ea2('0x4a')],function(_0x20992d){return{'name':_0x20992d['fieldName'],'type':_0x20992d[_0x8ea2('0x4b')][_0x8ea2('0x4c')]};});_0x1db25c[_0x8ea2('0x4d')]=_['map'](_0x2d6bbb,_0x8ea2('0x3c'));_0x1db25c[_0x8ea2('0x4e')]=_[_0x8ea2('0x4f')](_0x5352b9[_0x8ea2('0x4e')]);_0x1db25c[_0x8ea2('0x50')]=_[_0x8ea2('0x51')](_0x1db25c[_0x8ea2('0x4d')],_0x1db25c[_0x8ea2('0x4e')]);_0x1ef615[_0x8ea2('0x52')]=_[_0x8ea2('0x51')](_0x1db25c[_0x8ea2('0x4d')],qs[_0x8ea2('0x53')](_0x5352b9[_0x8ea2('0x4e')][_0x8ea2('0x53')]));_0x1ef615['attributes']=_0x1ef615[_0x8ea2('0x52')][_0x8ea2('0x54')]?_0x1ef615[_0x8ea2('0x52')]:_0x1db25c[_0x8ea2('0x4d')];if(!_0x5352b9[_0x8ea2('0x4e')][_0x8ea2('0x55')](_0x8ea2('0x56'))){_0x1ef615[_0x8ea2('0x34')]=qs['limit'](_0x5352b9[_0x8ea2('0x4e')][_0x8ea2('0x34')]);_0x1ef615[_0x8ea2('0x32')]=qs['offset'](_0x5352b9['query'][_0x8ea2('0x32')]);}_0x1ef615[_0x8ea2('0x57')]=qs[_0x8ea2('0x58')](_0x5352b9['query'][_0x8ea2('0x58')]);_0x1ef615[_0x8ea2('0x59')]=qs[_0x8ea2('0x50')](_[_0x8ea2('0x5a')](_0x5352b9[_0x8ea2('0x4e')],_0x1db25c['filters']),_0x2d6bbb);var _0x4afd85=[];var _0x24a22a=squel[_0x8ea2('0x5b')]()[_0x8ea2('0x5c')]('id')['field'](_0x8ea2('0x3c'))[_0x8ea2('0x5c')](_0x8ea2('0x5d'))['from']('tools_tags');var _0x48aebf=squel['select']()['field'](_0x8ea2('0x5e'))[_0x8ea2('0x5c')]('u.fullname')['field'](_0x8ea2('0x5f'))[_0x8ea2('0x60')](_0x8ea2('0x61'),'ui')['left_join'](_0x8ea2('0x62'),'u',_0x8ea2('0x63'));var _0x59e3df=squel[_0x8ea2('0x5b')]()[_0x8ea2('0x60')](_0x8ea2('0x64'),'i')[_0x8ea2('0x65')](_0x8ea2('0x66'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join']('users','o',_0x8ea2('0x67'))[_0x8ea2('0x65')](_0x8ea2('0x68'),'a',_0x8ea2('0x69'))[_0x8ea2('0x65')](_0x8ea2('0x6a'),'me',_0x8ea2('0x6b'))['left_join']('chat_interaction_has_tags','it','it.ChatInteractionId\x20=\x20i.id')[_0x8ea2('0x65')](_0x8ea2('0x6c'),'t',_0x8ea2('0x6d'));var _0x2bbec0=squel['expr']();var _0x11824e=[];var _0x2b8662=squel['expr']();var _0x21485a;if(_0x5352b9[_0x8ea2('0x4e')][_0x8ea2('0x6e')]){_0x21485a=as[_0x8ea2('0x6f')](_0x5352b9[_0x8ea2('0x4e')]['search']);var _0x479c05=_0x21485a['sqlOperator'];for(var _0x53a62c=0x0;_0x53a62c<_0x21485a[_0x8ea2('0x70')][_0x8ea2('0x54')];_0x53a62c++){var _0x2d8221=_0x21485a[_0x8ea2('0x70')][_0x53a62c];var _0x491d3d='i';var _0x461d32=_[_0x8ea2('0x71')](_0x2d6bbb,[_0x8ea2('0x3c'),_0x2d8221[_0x8ea2('0x5c')]]);if(!_0x461d32){switch(_0x2d8221['field']){case _0x8ea2('0x72'):if(_0x2d8221['value']==0x1){_0x59e3df[_0x8ea2('0x73')]('`'+_0x2d8221['field']+_0x8ea2('0x74'));}else{_0x59e3df[_0x8ea2('0x73')]('`'+_0x2d8221['field']+'`\x20>\x200');}break;case _0x8ea2('0x75'):if(_0x2d8221['operator']===_0x8ea2('0x76')){if(_0x2d8221[_0x8ea2('0x77')][_0x8ea2('0x46')]('\x20')[_0x8ea2('0x54')]>0x1){_0x2bbec0[_0x479c05]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x8ea2('0x78')](_0x2d8221[_0x8ea2('0x77')]),null);}else{var _0x39776d='%'+_0x2d8221[_0x8ea2('0x77')]+'%';_0x2bbec0[_0x479c05](_0x8ea2('0x79'),_0x39776d,_0x39776d,_0x39776d);}}else{_0x461d32=_[_0x8ea2('0x71')](_0x2d6bbb,[_0x8ea2('0x3c'),_0x8ea2('0x7a')]);_0x2d8221[_0x8ea2('0x5c')]=_0x8ea2('0x7a');_0x3d55db=as[_0x8ea2('0x7b')](_0x491d3d,_0x461d32[_0x8ea2('0x4b')],_0x2d8221);_0x2bbec0[_0x479c05](_0x3d55db['text'],_0x3d55db[_0x8ea2('0x77')][_0x8ea2('0x7c')],_0x3d55db[_0x8ea2('0x77')][_0x8ea2('0x30')]);}break;case _0x8ea2('0x7d'):var _0x219f78=_0x2d8221[_0x8ea2('0x77')][_0x8ea2('0x46')](',')[_0x8ea2('0x43')](function(_0xefb7b){return Number(_0xefb7b);});_0x219f78[_0x8ea2('0x47')](function(_0x35cfc5){_0x2b8662['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x35cfc5+',%');});_0x11824e=_[_0x8ea2('0x7e')](_0x11824e,_0x219f78);break;case _0x8ea2('0x7f'):if(_0x2d8221[_0x8ea2('0x80')]===_0x8ea2('0x76')){_0x2bbec0[_0x479c05](_0x8ea2('0x81'),'%'+_0x2d8221['value']+'%',null);}else{_0x461d32=_['find'](_0x2d6bbb,['name',_0x8ea2('0x82')]);_0x2d8221[_0x8ea2('0x5c')]=_0x8ea2('0x82');_0x3d55db=as[_0x8ea2('0x7b')](_0x491d3d,_0x461d32[_0x8ea2('0x4b')],_0x2d8221);_0x2bbec0[_0x479c05](_0x3d55db[_0x8ea2('0x83')],_0x3d55db['value'][_0x8ea2('0x7c')],_0x3d55db[_0x8ea2('0x77')]['end']);}break;case'body':_0x3d55db=as[_0x8ea2('0x7b')]('me',null,_0x2d8221);_0x2bbec0[_0x479c05](_0x3d55db[_0x8ea2('0x83')],_0x3d55db[_0x8ea2('0x77')][_0x8ea2('0x7c')],_0x3d55db[_0x8ea2('0x77')][_0x8ea2('0x30')]);break;}}else{var _0x3d55db=as['buildExpression'](_0x491d3d,_0x461d32[_0x8ea2('0x4b')],_0x2d8221);_0x2bbec0[_0x479c05](_0x3d55db[_0x8ea2('0x83')],_0x3d55db[_0x8ea2('0x77')][_0x8ea2('0x7c')],_0x3d55db['value'][_0x8ea2('0x30')]);}}}else{var _0x356099=_(_0x5352b9[_0x8ea2('0x4e')])['keys']()[_0x8ea2('0x43')](function(_0x5c2d05){return _['some'](_0x2d6bbb,[_0x8ea2('0x3c'),_0x5c2d05])?_0x5c2d05:undefined;})[_0x8ea2('0x84')]()['value']();if(!_['isEmpty'](_0x356099)){_0x356099['forEach'](function(_0x167f15){if(_0x167f15==='ChatWebsiteId'){_0x59e3df['where'](_0x8ea2('0x85'),[][_0x8ea2('0x86')](_0x5352b9[_0x8ea2('0x4e')][_0x167f15]));}else if(_0x167f15===_0x8ea2('0x87')){var _0x1681d8=JSON[_0x8ea2('0x88')](_0x5352b9[_0x8ea2('0x4e')][_0x167f15])[_0x8ea2('0x89')];var _0x14a5de=JSON[_0x8ea2('0x88')](_0x5352b9[_0x8ea2('0x4e')][_0x167f15])[_0x8ea2('0x8a')];_0x59e3df[_0x8ea2('0x59')](_0x8ea2('0x8b'),_0x1681d8,_0x14a5de);}else{if(_0x5352b9['query'][_0x167f15]===_0x8ea2('0x8c')){_0x59e3df[_0x8ea2('0x59')]('i.'+_0x167f15+_0x8ea2('0x8d'));}else{_0x59e3df['where']('i.'+_0x167f15+_0x8ea2('0x8e'),_0x5352b9['query'][_0x167f15]);}}});}if(_0x5352b9[_0x8ea2('0x4e')]['read']){if(_0x5352b9[_0x8ea2('0x4e')]['read']==0x1){_0x59e3df[_0x8ea2('0x73')](_0x8ea2('0x8f'));}else{_0x59e3df['having'](_0x8ea2('0x90'));}}if(_0x5352b9['query'][_0x8ea2('0x91')]){_0x11824e=_[_0x8ea2('0x92')](_0x5352b9[_0x8ea2('0x4e')][_0x8ea2('0x91')])?_0x5352b9[_0x8ea2('0x4e')]['tag']:new Array(_0x5352b9['query'][_0x8ea2('0x91')]);_0x11824e['forEach'](function(_0x410f78){_0x2b8662['or'](_0x8ea2('0x93'),'%,'+_0x410f78+',%');});}if(_0x5352b9[_0x8ea2('0x4e')][_0x8ea2('0x94')]){var _0x262cef=_0x5352b9[_0x8ea2('0x4e')]['filter']['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x8ea2('0x95')](_0x262cef)){_0x2bbec0['or']('i.id\x20LIKE\x20?',_0x262cef+'%');}else{_0x2bbec0['or'](_0x8ea2('0x96'),qs[_0x8ea2('0x78')](_0x262cef))['or'](_0x8ea2('0x97'),_0x262cef+'%');}}}_0x59e3df[_0x8ea2('0x59')](_0x2bbec0);_0x59e3df[_0x8ea2('0x98')](_0x8ea2('0x99'));var _0x4b4d64={'type':db[_0x8ea2('0x9a')][_0x8ea2('0x9b')][_0x8ea2('0x9c')],'raw':!![]};var _0x335a96=_0x59e3df[_0x8ea2('0x9d')]();_0x335a96['field']('i.id');_0x335a96[_0x8ea2('0x5c')](_0x8ea2('0x9e'),_0x8ea2('0x72'));if(_0x1ef615[_0x8ea2('0x57')]){_0x1ef615[_0x8ea2('0x57')][_0x8ea2('0x47')](function(_0x2e0bbe){var _0x9c4960=_0x2e0bbe[0x0]===_0x8ea2('0x9f')?_0x2e0bbe[0x0]:'i.'+_0x2e0bbe[0x0];_0x59e3df[_0x8ea2('0x57')](_0x9c4960,_0x2e0bbe[0x1]===_0x8ea2('0xa0')?![]:!![]);});}if(!_[_0x8ea2('0xa1')](_0x11824e)){_0x59e3df[_0x8ea2('0x73')](_0x2b8662);_0x335a96[_0x8ea2('0x59')](_0x8ea2('0xa2'),_0x11824e);}BPromise[_0x8ea2('0xa3')]()[_0x8ea2('0x25')](function(){if(!_0x21485a){if(_0x5352b9['query']['ChatWebsiteId'])return;_0x335a96[_0x8ea2('0x59')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x59e3df[_0x8ea2('0x59')](_0x8ea2('0xa4'));return;}if(_0x5352b9['user'][_0x8ea2('0xa5')]!=='agent')return;return _0x5352b9[_0x8ea2('0xa6')][_0x8ea2('0xa7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x17dee8){if(_[_0x8ea2('0xa1')](_0x17dee8)){_0x335a96[_0x8ea2('0x59')](_0x8ea2('0xa8'));_0x59e3df[_0x8ea2('0x59')](_0x8ea2('0xa8'));}else{_0x335a96[_0x8ea2('0x59')](_0x8ea2('0x85'),_[_0x8ea2('0x43')](_0x17dee8,'id'));_0x59e3df[_0x8ea2('0x59')]('i.ChatWebsiteId\x20IN\x20?',_[_0x8ea2('0x43')](_0x17dee8,'id'));}});})[_0x8ea2('0x25')](function(){if(_0x5352b9['user'][_0x8ea2('0xa5')]==='agent'&&!_0x21485a&&!_0x5352b9['query']['ChatWebsiteId'])return[];return db[_0x8ea2('0xa9')]['query'](_0x335a96[_0x8ea2('0xaa')](),_0x4b4d64);})[_0x8ea2('0x25')](function(_0x12ed20){_0x5cb6ad[_0x8ea2('0x35')]=_0x12ed20[_0x8ea2('0x54')];if(_0x5cb6ad[_0x8ea2('0x35')]===0x0)return[];return db['sequelize'][_0x8ea2('0x4e')](_0x24a22a['toString'](),_0x4b4d64)[_0x8ea2('0x25')](function(_0x18aa81){_0x4afd85=_[_0x8ea2('0xab')](_0x18aa81,'id');_0x4b4d64=_[_0x8ea2('0x3d')](_0x4b4d64,{'model':db[_0x8ea2('0x49')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5352b9['query'][_0x8ea2('0x53')]){_0x1ef615[_0x8ea2('0x52')][_0x8ea2('0x47')](function(_0x2a82b2){_0x59e3df[_0x8ea2('0x5c')]('i.'+_0x2a82b2);});}else{_0x59e3df[_0x8ea2('0x5c')](_0x8ea2('0x9e'),_0x8ea2('0x72'));_0x59e3df[_0x8ea2('0x5c')](_0x8ea2('0xac'),_0x8ea2('0xad'));_0x59e3df[_0x8ea2('0x5c')](_0x8ea2('0xae'),_0x8ea2('0xaf'));_0x59e3df[_0x8ea2('0x5c')](_0x8ea2('0xb0'),_0x8ea2('0x9f'));_0x59e3df['field'](_0x8ea2('0xb1'));_0x59e3df['field']('c.firstName',_0x8ea2('0xb2'));_0x59e3df[_0x8ea2('0x5c')]('c.lastName',_0x8ea2('0xb3'));_0x59e3df[_0x8ea2('0x5c')]('c.email',_0x8ea2('0xb4'));_0x59e3df[_0x8ea2('0x5c')]('c.phone',_0x8ea2('0xb5'));_0x59e3df[_0x8ea2('0x5c')](_0x8ea2('0xb6'),_0x8ea2('0xb7'));_0x59e3df[_0x8ea2('0x5c')]('c.fax',_0x8ea2('0xb8'));_0x59e3df[_0x8ea2('0x5c')](_0x8ea2('0xb9'),_0x8ea2('0xba'));_0x59e3df[_0x8ea2('0x5c')](_0x8ea2('0xbb'),_0x8ea2('0xbc'));_0x59e3df[_0x8ea2('0x5c')](_0x8ea2('0xbd'),'TagIds');}if(_0x1ef615[_0x8ea2('0x34')])_0x59e3df['limit'](_0x1ef615[_0x8ea2('0x34')]);if(_0x1ef615[_0x8ea2('0x32')])_0x59e3df[_0x8ea2('0x32')](_0x1ef615[_0x8ea2('0x32')]);return db[_0x8ea2('0xa9')]['query'](_0x59e3df[_0x8ea2('0xaa')](),_0x4b4d64);})[_0x8ea2('0x25')](function(_0x4fdd16){if(_0x4fdd16['length']>0x0)_0x48aebf[_0x8ea2('0x59')](_0x8ea2('0xbe'),_['map'](_0x4fdd16,'id'));return db['sequelize'][_0x8ea2('0x4e')](_0x48aebf[_0x8ea2('0xaa')](),_0x4b4d64)['then'](function(_0x2b7e80){var _0x2f6673=_[_0x8ea2('0xbf')](_0x2b7e80,_0x8ea2('0xc0'));var _0xdf4de9=[];_0x4fdd16['forEach'](function(_0x2e3a5d){_0xdf4de9[_0x8ea2('0xc1')](updateChatInteraction(_0x2e3a5d,_0x4afd85,_0x2f6673));});return BPromise[_0x8ea2('0xc2')](_0xdf4de9);});});})[_0x8ea2('0x25')](function(_0x412af1){_0x5cb6ad['rows']=_0x412af1;return _0x5cb6ad;})[_0x8ea2('0x25')](respondWithFilteredResult(_0x3afb80,_0x1ef615))['catch'](handleError(_0x3afb80,null));};exports['show']=function(_0x9468be,_0x17e9fc){var _0x5c95ec={'raw':![],'where':{'id':_0x9468be[_0x8ea2('0xc3')]['id']}},_0x239516={};_0x239516[_0x8ea2('0x4d')]=_[_0x8ea2('0x4f')](db[_0x8ea2('0x49')][_0x8ea2('0x4a')]);_0x239516['query']=_[_0x8ea2('0x4f')](_0x9468be[_0x8ea2('0x4e')]);_0x239516[_0x8ea2('0x50')]=_['intersection'](_0x239516[_0x8ea2('0x4d')],_0x239516[_0x8ea2('0x4e')]);_0x5c95ec[_0x8ea2('0x52')]=_[_0x8ea2('0x51')](_0x239516[_0x8ea2('0x4d')],qs['fields'](_0x9468be[_0x8ea2('0x4e')][_0x8ea2('0x53')]));_0x5c95ec[_0x8ea2('0x52')]=_0x5c95ec[_0x8ea2('0x52')]['length']?_0x5c95ec['attributes']:_0x239516[_0x8ea2('0x4d')];if(_0x9468be['query'][_0x8ea2('0xc4')]){_0x5c95ec['include']=[{'all':!![]}];}_0x5c95ec=_[_0x8ea2('0x3d')]({},_0x5c95ec,_0x9468be[_0x8ea2('0xc5')]);return db[_0x8ea2('0x49')][_0x8ea2('0x71')](_0x5c95ec)[_0x8ea2('0x25')](handleEntityNotFound(_0x17e9fc,null))[_0x8ea2('0x25')](respondWithResult(_0x17e9fc,null))[_0x8ea2('0x2e')](handleError(_0x17e9fc,null));};exports['create']=function(_0x2c5677,_0x224fca){return db[_0x8ea2('0x49')][_0x8ea2('0xc6')](_0x2c5677[_0x8ea2('0xc7')],{})[_0x8ea2('0x25')](respondWithResult(_0x224fca,0xc9))['catch'](handleError(_0x224fca,null));};exports[_0x8ea2('0x38')]=function(_0x463372,_0x76085){if(_0x463372[_0x8ea2('0xc7')]['id']){delete _0x463372['body']['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x463372[_0x8ea2('0xc3')]['id']}})[_0x8ea2('0x25')](handleEntityNotFound(_0x76085,null))[_0x8ea2('0x25')](saveUpdates(_0x463372['body'],null))[_0x8ea2('0x25')](respondWithResult(_0x76085,null))[_0x8ea2('0x2e')](handleError(_0x76085,null));};exports[_0x8ea2('0x39')]=function(_0x500b47,_0x331019){return db[_0x8ea2('0x49')]['find']({'where':{'id':_0x500b47[_0x8ea2('0xc3')]['id']}})['then'](handleEntityNotFound(_0x331019,null))['then'](removeEntity(_0x331019,null))[_0x8ea2('0x2e')](handleError(_0x331019,null));};exports[_0x8ea2('0xc8')]=function(_0x405020,_0x5c9359){return db[_0x8ea2('0x49')][_0x8ea2('0xc8')]()[_0x8ea2('0x25')](respondWithResult(_0x5c9359,null))[_0x8ea2('0x2e')](handleError(_0x5c9359,null));};exports[_0x8ea2('0xc9')]=function(_0x11c59e,_0x11b02a){var _0x5ab2c4=_0x11c59e[_0x8ea2('0xc3')]['id'];var _0x111f97;var _0xf76d70;var _0x384500;return db[_0x8ea2('0x49')][_0x8ea2('0xca')]({'where':{'id':_0x5ab2c4}})[_0x8ea2('0x25')](function(_0x568581){_0x111f97=_0x568581;return db[_0x8ea2('0xcb')][_0x8ea2('0xca')]({'where':{'id':_0x568581[_0x8ea2('0xcc')]},'attributes':['id',_0x8ea2('0xcd'),_0x8ea2('0xce'),'vidaooTopic',_0x8ea2('0xcf'),_0x8ea2('0xd0')],'raw':!![]});})[_0x8ea2('0x25')](function(_0x1c336e){if(_0x1c336e&&_0x1c336e[_0x8ea2('0xcd')]&&_0x1c336e[_0x8ea2('0xce')]){_0xf76d70=_0x1c336e;var _0x473ae2={'interaction':{'id':_0x5ab2c4},'agent':{'id':_0x11c59e[_0x8ea2('0xa6')]['id'],'name':_0x11c59e[_0x8ea2('0xa6')]['name'],'fullname':_0x11c59e['user']['fullname'],'email':_0x11c59e[_0x8ea2('0xa6')]['email']},'contact':_0x11c59e[_0x8ea2('0xc7')][_0x8ea2('0x3e')],'account':_0x11c59e[_0x8ea2('0xc7')][_0x8ea2('0x41')]};var _0x6c0ccc={'rejectUnauthorized':![],'method':_0x8ea2('0xd1'),'url':_0x8ea2('0xd2'),'headers':{'X-APIKEY':_0x1c336e[_0x8ea2('0xcd')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x11c59e[_0x8ea2('0xa6')][_0x8ea2('0xd3')]],'buttons':null,'topic':_0xf76d70['vidaooTopic'],'note':_[_0x8ea2('0xd4')](_0xf76d70[_0x8ea2('0xcf')])?null:getMustacheRender(_0xf76d70[_0x8ea2('0xcf')],_0x473ae2),'metadata':null},'redirect':_0x8ea2('0xd5'),'json':!![]};try{if(!_[_0x8ea2('0xd4')](_0xf76d70[_0x8ea2('0xd0')])){var _0xc6888c=getMustacheRender(_0xf76d70[_0x8ea2('0xd0')],_0x473ae2);var _0x152d46=JSON[_0x8ea2('0x88')](_0xc6888c);_0x6c0ccc[_0x8ea2('0xc7')][_0x8ea2('0xd6')]=_0x152d46;}}catch(_0x465e7f){throw new db[(_0x8ea2('0x9a'))][(_0x8ea2('0xd7'))](_0x8ea2('0xd8'));}return rp(_0x6c0ccc);}else{throw new db[(_0x8ea2('0x9a'))]['ValidationError']('Error\x20in\x20Vidaoo\x20configuration');}})['then'](function(_0x4b2c0f){_0x384500=_0x4b2c0f;if(_0x384500['id']){var _0x2fcddc={'body':_0x384500[_0x8ea2('0xd9')],'ChatWebsiteId':_0xf76d70['id'],'ChatInteractionId':_0x111f97['id'],'direction':'out','UserId':_0x11c59e[_0x8ea2('0xa6')]['id']};return db[_0x8ea2('0xda')][_0x8ea2('0xc6')](_0x2fcddc,{});}else{throw new db[(_0x8ea2('0x9a'))]['ValidationError'](_0x8ea2('0xdb'));}})['then'](function(){return _0x111f97[_0x8ea2('0xdc')]({'vidaooSessionId':_0x384500['id']});})[_0x8ea2('0x25')](respondWithResult(_0x11b02a,null))[_0x8ea2('0x2e')](handleError(_0x11b02a,null));};exports[_0x8ea2('0xdd')]=function(_0x3b6b03,_0x3292bc){if(_0x3b6b03['body']['id']){delete _0x3b6b03['body']['id'];}return db[_0x8ea2('0x49')][_0x8ea2('0x71')]({'where':{'id':_0x3b6b03['params']['id']},'include':[{'model':db[_0x8ea2('0xde')],'as':'Contact'}]})[_0x8ea2('0x25')](handleEntityNotFound(_0x3292bc,null))[_0x8ea2('0x25')](saveUpdates(_0x3b6b03[_0x8ea2('0xc7')],null))[_0x8ea2('0x25')](respondWithResult(_0x3292bc,null))[_0x8ea2('0x2e')](handleError(_0x3292bc,null));};exports[_0x8ea2('0xdf')]=function(_0x1383b4,_0x4c1b9d,_0x3f3822){if(_0x1383b4[_0x8ea2('0xc7')]['id']){delete _0x1383b4[_0x8ea2('0xc7')]['id'];}return db[_0x8ea2('0x49')][_0x8ea2('0x71')]({'where':{'id':_0x1383b4[_0x8ea2('0xc3')]['id']}})[_0x8ea2('0x25')](function(_0x1c974d){if(!_0x1c974d){logger[_0x8ea2('0x2b')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x8ea2('0xdf'),0x194,_0x8ea2('0xe0'));_0x4c1b9d[_0x8ea2('0x3a')](0x194);}else{if(_0x1c974d['UserId']){throw new db[(_0x8ea2('0x9a'))][(_0x8ea2('0xd7'))](_0x8ea2('0xe1'));}}return _0x1c974d;})[_0x8ea2('0x25')](function(_0xe18090){if(_0xe18090){return _0xe18090[_0x8ea2('0x38')]({'closed':_0x1383b4['body']['closed'],'disposition':_0x1383b4[_0x8ea2('0xc7')][_0x8ea2('0xe2')]})[_0x8ea2('0x25')](function(_0x695f4a){return _0x695f4a;});}})[_0x8ea2('0x25')](function(_0x57ff72){return respondWithRpcPromise(_0x8ea2('0xe3'),'abandon',_0x1383b4[_0x8ea2('0xc7')],client9004);})[_0x8ea2('0x25')](respondWithResult(_0x4c1b9d,null))['catch'](handleError(_0x4c1b9d,null));};exports[_0x8ea2('0xe4')]=function(_0x254b51,_0x2c11d2,_0x2aaa88){_0x254b51[_0x8ea2('0xc7')][_0x8ea2('0x3c')]=_0x254b51[_0x8ea2('0xe5')][_0x8ea2('0xe6')];_0x254b51[_0x8ea2('0xc7')][_0x8ea2('0xe7')]=_0x254b51['file'][_0x8ea2('0xe8')];_0x254b51[_0x8ea2('0xc7')][_0x8ea2('0x4b')]=_0x254b51['file'][_0x8ea2('0xe9')];return db['Attachment'][_0x8ea2('0xc6')](_0x254b51[_0x8ea2('0xc7')])[_0x8ea2('0x25')](respondWithResult(_0x2c11d2,0xc9))[_0x8ea2('0x2e')](handleError(_0x2c11d2,null));};exports[_0x8ea2('0xea')]=function(_0x1786ac,_0x7a45a8,_0x3a68e2){return db[_0x8ea2('0x49')]['findOne']({'where':{'id':_0x1786ac[_0x8ea2('0xc3')]['id']},'raw':!![]})[_0x8ea2('0x25')](handleEntityNotFound(_0x7a45a8,null))[_0x8ea2('0x25')](function(_0x8d4abd){if(_0x8d4abd){if(_0x8d4abd[_0x8ea2('0xeb')]){return _0x7a45a8[_0x8ea2('0x2f')](0x193)[_0x8ea2('0x31')]({'status':0x193,'message':_0x8ea2('0xec')});}return db[_0x8ea2('0xed')]['findOne']({'where':{'id':_0x1786ac[_0x8ea2('0x4e')][_0x8ea2('0xee')]},'raw':!![]})[_0x8ea2('0x25')](handleEntityNotFound(_0x7a45a8,null));}})[_0x8ea2('0x25')](function(_0xcbb6b3){if(_0xcbb6b3){var _0x4bdbe0=_0xcbb6b3[_0x8ea2('0xef')]!==null;var _0x44791f=path[_0x8ea2('0xf0')](config[_0x8ea2('0xf1')],_0x8ea2('0xf2'));if(_0x4bdbe0){_0x44791f=path['join'](_0x44791f,_0x8ea2('0xf3'));}var _0x4e7aff=path[_0x8ea2('0xf0')](_0x44791f,_0xcbb6b3[_0x8ea2('0xe7')]);return _0x7a45a8[_0x8ea2('0xf4')](_0x4e7aff);}})['catch'](handleError(_0x7a45a8,null));};exports[_0x8ea2('0xf5')]=function(_0x48a2e2,_0x4e804c){var _0x487bab=null;var _0x1a0966=null;var _0x50087b=null;var _0x196b89=null;if(_0x48a2e2[_0x8ea2('0xc7')]['id']){delete _0x48a2e2[_0x8ea2('0xc7')]['id'];}if(_0x48a2e2[_0x8ea2('0xc7')][_0x8ea2('0xf6')]){_0x196b89=path[_0x8ea2('0xf0')](config[_0x8ea2('0xf1')],_0x8ea2('0xf7'),util['format']('transcript-%s.txt',Date[_0x8ea2('0xf8')]()));_0x48a2e2[_0x8ea2('0xc7')][_0x8ea2('0xf9')]=_0x196b89;}return db['ChatInteraction']['find']({'where':{'id':_0x48a2e2['params']['id']},'include':[{'model':db[_0x8ea2('0xda')],'as':'Messages','include':[{'model':db['User'],'as':_0x8ea2('0x7f')}]}]})[_0x8ea2('0x25')](handleEntityNotFound(_0x4e804c,null))['then'](saveUpdates(_0x48a2e2['body'],null))[_0x8ea2('0x25')](function(_0x48eac8){if(_0x48eac8){_0x487bab=_0x48eac8;return db['ChatWebsite'][_0x8ea2('0x71')]({'where':{'id':_0x487bab[_0x8ea2('0xcc')]}});}})[_0x8ea2('0x25')](function(_0x54da21){if(_0x54da21){_0x50087b=_0x54da21;return db[_0x8ea2('0xde')][_0x8ea2('0x71')]({'where':{'id':_0x487bab[_0x8ea2('0x7a')]}});}})[_0x8ea2('0x25')](function(_0x3a43d5){if(_0x3a43d5){_0x1a0966=_0x3a43d5;if(_0x196b89){var _0x535b01=null;for(var _0x22e4cd=0x1;_0x22e4cd<_0x487bab['Messages'][_0x8ea2('0x54')];++_0x22e4cd){_0x535b01=_0x487bab['Messages'][_0x22e4cd];var _0x230a70=_0x535b01['UserId']?util['format'](_0x8ea2('0xfa'),_0x50087b[_0x8ea2('0xfb')],_0x535b01[_0x8ea2('0x82')]):_0x8ea2('0xfc');var _0x332670=_0x48a2e2[_0x8ea2('0xc7')][_0x8ea2('0xfd')]||util[_0x8ea2('0xfe')]('%s%d',_0x8ea2('0xff'),_0x535b01[_0x8ea2('0x7a')]);switch(_0x50087b[_0x8ea2('0x100')]){case _0x8ea2('0x101'):_0x230a70=_0x535b01[_0x8ea2('0x82')]?util['format'](_0x8ea2('0xfa'),_0x50087b['agentAlias'],_0x535b01[_0x8ea2('0x82')]):'System';break;case _0x8ea2('0x102'):_0x230a70=_0x535b01[_0x8ea2('0x82')]?_0x535b01[_0x8ea2('0x7f')][_0x8ea2('0x103')]||_0x535b01['User']['fullname']:'System';break;case _0x8ea2('0x104'):_0x230a70=_0x535b01[_0x8ea2('0x82')]?_0x535b01['User'][_0x8ea2('0x105')]:_0x8ea2('0xfc');break;default:_0x230a70=_0x535b01[_0x8ea2('0x82')]?util[_0x8ea2('0xfe')](_0x8ea2('0xfa'),_0x50087b[_0x8ea2('0xfb')],_0x535b01[_0x8ea2('0x82')]):_0x8ea2('0xfc');}var _0x422280=util[_0x8ea2('0xfe')](_0x8ea2('0x106'),moment(_0x535b01[_0x8ea2('0x87')])[_0x8ea2('0xfe')]('MM/DD/YYYY\x20HH:mm:ss'),_0x535b01[_0x8ea2('0x107')]==='in'?_0x332670:_0x230a70,_0x535b01['body']);if(!_0x535b01['secret']){fs[_0x8ea2('0x108')](_0x196b89,_0x422280);}}return db['MailAccount'][_0x8ea2('0xca')]({'where':{'service':!![]},'include':[{'model':db[_0x8ea2('0x109')],'as':_0x8ea2('0x10a'),'raw':!![]}]});}}})[_0x8ea2('0x25')](function(_0xff0fae){if(_0xff0fae&&_0xff0fae['Smtp']&&_0x48a2e2[_0x8ea2('0xc7')]){var _0x3f5688={'tls':{'rejectUnauthorized':![]}};if(_0xff0fae[_0x8ea2('0x10a')]['service']){_0x3f5688['service']=_0xff0fae[_0x8ea2('0x10a')][_0x8ea2('0x10b')];}else{_0x3f5688['host']=_0xff0fae[_0x8ea2('0x10a')]['host'];_0x3f5688[_0x8ea2('0x10c')]=_0xff0fae[_0x8ea2('0x10a')][_0x8ea2('0x10c')];_0x3f5688[_0x8ea2('0x10d')]=_0xff0fae[_0x8ea2('0x10a')][_0x8ea2('0x10d')];}if(_0xff0fae[_0x8ea2('0x10a')][_0x8ea2('0x10e')]){_0x3f5688[_0x8ea2('0x10f')]={'user':_0xff0fae['Smtp']['user'],'pass':_0xff0fae[_0x8ea2('0x10a')]['pass']};}return respondWithRpcPromise(_0x8ea2('0x110'),_0x8ea2('0x111'),{'account':_0x3f5688,'message':{'from':util[_0x8ea2('0xfe')](_0x8ea2('0x112'),_0xff0fae['name'],_0xff0fae[_0x8ea2('0xd3')]||_0xff0fae[_0x8ea2('0x10a')]['user']),'to':_0x48a2e2[_0x8ea2('0xc7')][_0x8ea2('0xf6')],'subject':_0x8ea2('0x113'),'text':util['format']('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x48a2e2['body'][_0x8ea2('0xf6')]),'attachments':[{'path':_0x196b89}]}})['then'](function(){return _0x487bab;})[_0x8ea2('0x2e')](function(_0x488acb){console[_0x8ea2('0x2b')](_0x488acb);});}else{return _0x487bab;}})[_0x8ea2('0x25')](respondWithStatusCode(_0x4e804c,0xc8))[_0x8ea2('0x2e')](handleError(_0x4e804c,null));};exports[_0x8ea2('0x114')]=function(_0x54925a,_0x295339,_0x55c23c){return db['ChatMessage']['find']({'where':{'id':_0x54925a[_0x8ea2('0xc3')]['id']}})[_0x8ea2('0x25')](handleEntityNotFound(_0x295339,null))[_0x8ea2('0x25')](function(_0x48b51d){if(_0x48b51d){return _0x48b51d[_0x8ea2('0x114')](_0x54925a[_0x8ea2('0xc7')][_0x8ea2('0x115')],_[_0x8ea2('0x116')](_0x54925a[_0x8ea2('0xc7')],[_0x8ea2('0x115'),'id'])||{});}})[_0x8ea2('0x25')](respondWithResult(_0x295339,null))[_0x8ea2('0x2e')](handleError(_0x295339,null));};exports[_0x8ea2('0x117')]=function(_0x102d70,_0x2b014d,_0xc35654){var _0x355b91={'raw':![],'where':{}};var _0x1cf414={};var _0x48e543={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x8ea2('0xca')]({'where':{'id':_0x102d70['params']['id']}})[_0x8ea2('0x25')](handleEntityNotFound(_0x2b014d,null))[_0x8ea2('0x25')](function(_0x3ebbc8){if(_0x3ebbc8){_0x1cf414['model']=_[_0x8ea2('0x4f')](db['ChatMessage']['rawAttributes']);_0x1cf414[_0x8ea2('0x4e')]=_[_0x8ea2('0x4f')](_0x102d70[_0x8ea2('0x4e')]);_0x1cf414[_0x8ea2('0x50')]=_[_0x8ea2('0x51')](_0x1cf414[_0x8ea2('0x4d')],_0x1cf414[_0x8ea2('0x4e')]);_0x355b91['attributes']=_[_0x8ea2('0x51')](_0x1cf414[_0x8ea2('0x4d')],qs[_0x8ea2('0x53')](_0x102d70['query'][_0x8ea2('0x53')]));_0x355b91[_0x8ea2('0x52')]=_0x355b91[_0x8ea2('0x52')]['length']?_0x355b91[_0x8ea2('0x52')]:_0x1cf414[_0x8ea2('0x4d')];if(!_0x102d70[_0x8ea2('0x4e')]['hasOwnProperty']('nolimit')){_0x355b91[_0x8ea2('0x34')]=qs['limit'](_0x102d70[_0x8ea2('0x4e')]['limit']);_0x355b91[_0x8ea2('0x32')]=qs[_0x8ea2('0x32')](_0x102d70[_0x8ea2('0x4e')][_0x8ea2('0x32')]);}_0x355b91[_0x8ea2('0x57')]=qs['sort'](_0x102d70[_0x8ea2('0x4e')][_0x8ea2('0x58')]);_0x355b91[_0x8ea2('0x59')]=qs[_0x8ea2('0x50')](_[_0x8ea2('0x5a')](_0x102d70[_0x8ea2('0x4e')],_0x1cf414['filters']));_0x355b91['where'][_0x8ea2('0xc0')]=_0x3ebbc8['id'];if(_0x102d70[_0x8ea2('0x4e')]['filter']){_0x355b91[_0x8ea2('0x59')]=_[_0x8ea2('0x3d')](_0x355b91[_0x8ea2('0x59')],{'$or':_[_0x8ea2('0x43')](_0x355b91['attributes'],function(_0x19ea2b){var _0x4450e8={};_0x4450e8[_0x19ea2b]={'$like':'%'+_0x102d70['query'][_0x8ea2('0x94')]+'%'};return _0x4450e8;})});}if(_0x102d70['query'][_0x8ea2('0x89')]){var _0x479b40=_0x102d70['query'][_0x8ea2('0x89')][_0x8ea2('0x46')](',');var _0xbb5964={};_0xbb5964[_0x479b40[0x0]]={'$gte':moment(_0x479b40[0x1])[_0x8ea2('0xfe')]('YYYY-MM-DD\x20HH:mm:ss')};_0x355b91[_0x8ea2('0x59')]=_[_0x8ea2('0x3d')](_0x355b91[_0x8ea2('0x59')],_0xbb5964);}_0x355b91=_['merge']({},_0x355b91,_0x102d70[_0x8ea2('0xc5')]);return db[_0x8ea2('0xda')][_0x8ea2('0x35')]({'where':_0x355b91[_0x8ea2('0x59')]})[_0x8ea2('0x25')](function(_0x46d38e){_0x48e543[_0x8ea2('0x35')]=_0x46d38e;if(_0x102d70['query'][_0x8ea2('0xc4')]){_0x355b91[_0x8ea2('0x118')]=[{'all':!![]}];}return db[_0x8ea2('0xda')][_0x8ea2('0x119')](_0x355b91);})[_0x8ea2('0x25')](function(_0x23f247){_0x48e543[_0x8ea2('0x11a')]=_0x23f247;return _0x48e543;});}})[_0x8ea2('0x25')](respondWithFilteredResult(_0x2b014d,_0x355b91))[_0x8ea2('0x2e')](handleError(_0x2b014d,null));};exports[_0x8ea2('0x11b')]=function(_0x3a37fb,_0x455009,_0x556919){var _0x58a0e5={'where':{}},_0x3be2ce={},_0x56a973={'count':0x0,'rows':[]};return db[_0x8ea2('0x49')][_0x8ea2('0xca')]({'where':{'id':_0x3a37fb[_0x8ea2('0xc3')]['id']}})[_0x8ea2('0x25')](handleEntityNotFound(_0x455009,null))[_0x8ea2('0x25')](function(_0x515381){if(_0x515381){_0x3be2ce[_0x8ea2('0x4d')]=_[_0x8ea2('0x4f')](db['ChatMessage'][_0x8ea2('0x4a')]);_0x3be2ce[_0x8ea2('0x4e')]=_[_0x8ea2('0x4f')](_0x3a37fb[_0x8ea2('0x4e')]);_0x3be2ce['filters']=_[_0x8ea2('0x51')](_0x3be2ce[_0x8ea2('0x4d')],_0x3be2ce[_0x8ea2('0x4e')]);_0x58a0e5[_0x8ea2('0x52')]=_['intersection'](_0x3be2ce[_0x8ea2('0x4d')],qs[_0x8ea2('0x53')](_0x3a37fb[_0x8ea2('0x4e')]['fields']));_0x58a0e5[_0x8ea2('0x52')]=_0x58a0e5[_0x8ea2('0x52')][_0x8ea2('0x54')]?_0x58a0e5['attributes']:_0x3be2ce['model'];if(!_0x3a37fb[_0x8ea2('0x4e')]['hasOwnProperty'](_0x8ea2('0x56'))){_0x58a0e5[_0x8ea2('0x34')]=qs[_0x8ea2('0x34')](_0x3a37fb[_0x8ea2('0x4e')]['limit']);_0x58a0e5[_0x8ea2('0x32')]=qs['offset'](_0x3a37fb['query']['offset']);}_0x58a0e5['order']=qs[_0x8ea2('0x58')](_0x3a37fb[_0x8ea2('0x4e')][_0x8ea2('0x58')]);_0x58a0e5[_0x8ea2('0x59')]=qs[_0x8ea2('0x50')](_['pick'](_0x3a37fb['query'],_0x3be2ce[_0x8ea2('0x50')]));_0x58a0e5['where']['ChatInteractionId']=_0x515381['id'];if(_0x3a37fb[_0x8ea2('0x4e')][_0x8ea2('0x94')]){_0x58a0e5[_0x8ea2('0x59')]=_['merge'](_0x58a0e5[_0x8ea2('0x59')],{'$or':_['map'](_0x58a0e5[_0x8ea2('0x52')],function(_0x4041ec){var _0x56178b={};_0x56178b[_0x4041ec]={'$like':'%'+_0x3a37fb[_0x8ea2('0x4e')][_0x8ea2('0x94')]+'%'};return _0x56178b;})});}_0x58a0e5['where'][_0x8ea2('0x11c')]=![];if(_0x3a37fb[_0x8ea2('0x4e')]['id']){_0x58a0e5[_0x8ea2('0x59')]['id']={'$gt':_0x3a37fb[_0x8ea2('0x4e')]['id']};}_0x58a0e5=_[_0x8ea2('0x3d')]({},_0x58a0e5,_0x3a37fb[_0x8ea2('0xc5')]);return db[_0x8ea2('0xda')][_0x8ea2('0x35')]({'where':_0x58a0e5[_0x8ea2('0x59')]})['then'](function(_0xcedece){_0x56a973['count']=_0xcedece;_0x58a0e5[_0x8ea2('0x118')]=[];if(_0x3a37fb[_0x8ea2('0x4e')][_0x8ea2('0x11d')]){_0x58a0e5[_0x8ea2('0x118')][_0x8ea2('0xc1')]({'model':db[_0x8ea2('0x7f')],'as':_0x8ea2('0x7f'),'attributes':['id',_0x8ea2('0x105'),'alias']});}if(_0x3a37fb['query'][_0x8ea2('0xc4')]){_0x58a0e5[_0x8ea2('0x118')]=[{'all':!![]}];}return db[_0x8ea2('0xda')][_0x8ea2('0x119')](_0x58a0e5);})[_0x8ea2('0x25')](function(_0x52bf7c){_0x56a973[_0x8ea2('0x11a')]=_0x52bf7c;return _0x56a973;});}})[_0x8ea2('0x25')](respondWithFilteredResult(_0x455009,_0x58a0e5))['catch'](handleError(_0x455009,null));};exports[_0x8ea2('0x11e')]=function(_0x3be5d0,_0x3ac848,_0x52ce76){return db['ChatInteraction'][_0x8ea2('0x71')]({'where':{'id':_0x3be5d0['params']['id']}})[_0x8ea2('0x25')](handleEntityNotFound(_0x3ac848,null))[_0x8ea2('0x25')](function(_0x1030c9){if(_0x1030c9){return _0x1030c9[_0x8ea2('0x11f')](_0x3be5d0[_0x8ea2('0xc7')][_0x8ea2('0x115')],_[_0x8ea2('0x116')](_0x3be5d0[_0x8ea2('0xc7')],[_0x8ea2('0x115'),'id'])||{})[_0x8ea2('0x120')](function(){return db[_0x8ea2('0x7d')][_0x8ea2('0x119')]({'attributes':['id',_0x8ea2('0x3c'),_0x8ea2('0x5d')],'where':{'id':_0x3be5d0[_0x8ea2('0xc7')][_0x8ea2('0x115')]}});})[_0x8ea2('0x25')](function(_0x452b94){socket[_0x8ea2('0x121')]('chatInteractionTags:save',{'id':Number(_0x3be5d0['params']['id']),'tags':_0x452b94||[]});return{'id':Number(_0x3be5d0['params']['id']),'tags':_0x452b94||[]};});}})[_0x8ea2('0x25')](respondWithResult(_0x3ac848,null))[_0x8ea2('0x2e')](handleError(_0x3ac848,null));};exports[_0x8ea2('0x122')]=function(_0x9410dd,_0x497671,_0x5e3e8d){return db[_0x8ea2('0x49')]['find']({'where':{'id':_0x9410dd[_0x8ea2('0xc3')]['id']}})[_0x8ea2('0x25')](handleEntityNotFound(_0x497671,null))[_0x8ea2('0x25')](function(_0x19b042){if(_0x19b042){return _0x19b042[_0x8ea2('0x122')](_0x9410dd[_0x8ea2('0x4e')][_0x8ea2('0x115')]);}})['then'](respondWithStatusCode(_0x497671,null))[_0x8ea2('0x2e')](handleError(_0x497671,null));};exports[_0x8ea2('0xf4')]=function(_0x2dc450,_0x34e1c5){var _0x5b929c=moment()['unix']()[_0x8ea2('0xaa')]();var _0x263123=path[_0x8ea2('0xf0')](config['root'],'server',_0x8ea2('0x123'),'tmp');var _0x40e8e6=path[_0x8ea2('0xf0')](config[_0x8ea2('0xf1')],'server',_0x8ea2('0x123'),_0x8ea2('0x124'));var _0x2dfabc=path[_0x8ea2('0xf0')](_0x263123,_0x5b929c);var _0x515049=util['format'](_0x8ea2('0x125'),_0x2dc450[_0x8ea2('0xc3')]['id'],_0x5b929c);var _0x39000d=path['join'](_0x263123,_0x515049);var _0x3a1752=[];_0x3a1752['push']({'model':db[_0x8ea2('0x7f')],'as':'User','attributes':['id',_0x8ea2('0x105')],'raw':!![]});_0x3a1752['push']({'model':db[_0x8ea2('0xde')],'as':_0x8ea2('0x75'),'attributes':['id',_0x8ea2('0x126'),_0x8ea2('0x127')],'raw':!![]});if(_0x2dc450['query'][_0x8ea2('0x124')]){_0x3a1752[_0x8ea2('0xc1')]({'model':db[_0x8ea2('0xed')],'as':_0x8ea2('0xed'),'raw':!![]});}var _0x5ba508=[{'model':db[_0x8ea2('0xda')],'as':_0x8ea2('0x128'),'attributes':['id',_0x8ea2('0xc7'),_0x8ea2('0x87'),_0x8ea2('0x107'),'secret',_0x8ea2('0x129')],'include':_0x3a1752}];_0x5ba508[_0x8ea2('0xc1')]({'model':db[_0x8ea2('0xcb')],'as':_0x8ea2('0x12a'),'attributes':['id','name']});_0x5ba508[_0x8ea2('0xc1')]({'model':db[_0x8ea2('0x7f')],'as':'Owner','attributes':['id','fullname']});return db['ChatInteraction'][_0x8ea2('0x71')]({'where':{'id':_0x2dc450[_0x8ea2('0xc3')]['id']},'include':_0x5ba508})[_0x8ea2('0x25')](handleEntityNotFound(_0x34e1c5,null))[_0x8ea2('0x25')](function(_0x3c9013){if(_0x3c9013){var _0x103c43=_0x3c9013['get']({'plain':!![]});fs['mkdirSync'](_0x2dfabc);var _0xc099b6={'channel':_0x8ea2('0x12b'),'account':_0x103c43[_0x8ea2('0x12a')]['name'],'agent':_0x103c43['Owner']?_0x103c43[_0x8ea2('0x12c')][_0x8ea2('0x105')]:'N.A.','createdAt':moment(_0x103c43[_0x8ea2('0x87')])['format'](_0x8ea2('0x12d'))[_0x8ea2('0xaa')](),'closedAt':_0x103c43[_0x8ea2('0xeb')]?moment(_0x103c43['closedAt'])[_0x8ea2('0xfe')](_0x8ea2('0x12d'))['toString']():'','disposition':_0x103c43[_0x8ea2('0xe2')],'chatInfo':{'browser':_0x103c43[_0x8ea2('0x12e')],'os':_0x103c43['osName'],'referer':_0x103c43['referer'],'customerIp':_0x103c43[_0x8ea2('0x12f')],'customerPort':_0x103c43[_0x8ea2('0x130')]?_0x103c43[_0x8ea2('0x130')]:'N.A.'},'messages':_(_0x103c43[_0x8ea2('0x128')])[_0x8ea2('0x131')]()[_0x8ea2('0x94')]({'secret':![]})[_0x8ea2('0x43')](function(_0x36799a){if(_0x36799a['Attachment']){var _0x1cc1d9=path['join'](_0x40e8e6,_0x36799a[_0x8ea2('0xed')]['basename']);if(fs[_0x8ea2('0x132')](_0x1cc1d9)){fs[_0x8ea2('0x133')](_0x1cc1d9)[_0x8ea2('0x134')](fs[_0x8ea2('0x135')](path['join'](_0x2dfabc,_0x36799a[_0x8ea2('0xed')][_0x8ea2('0xe7')])));}}return{'date':moment(_0x36799a[_0x8ea2('0x87')])[_0x8ea2('0xfe')](_0x8ea2('0x12d'))[_0x8ea2('0xaa')](),'sender':_0x36799a[_0x8ea2('0x107')]===_0x8ea2('0x136')?_0x36799a[_0x8ea2('0x7f')]?_0x36799a[_0x8ea2('0x7f')][_0x8ea2('0x105')]:'System':_0x36799a[_0x8ea2('0x75')][_0x8ea2('0x126')]+(_0x36799a[_0x8ea2('0x75')]['lastName']?'\x20'+_0x36799a[_0x8ea2('0x75')][_0x8ea2('0x127')]:''),'body':_0x36799a[_0x8ea2('0xed')]?_0x36799a[_0x8ea2('0xed')][_0x8ea2('0xe7')]:_0x36799a[_0x8ea2('0xc7')],'direction':_0x36799a[_0x8ea2('0x107')]===_0x8ea2('0x136')?'A':'C','secret':_0x36799a[_0x8ea2('0x11c')],'read':_0x36799a[_0x8ea2('0x129')],'attachment':_0x36799a['Attachment']};})[_0x8ea2('0x77')]()};return ejs[_0x8ea2('0x137')](path[_0x8ea2('0xf0')](config[_0x8ea2('0xf1')],'server',_0x8ea2('0x138'),_0x8ea2('0x139')),{'interaction':_0xc099b6})[_0x8ea2('0x25')](function(_0x10d2b3){var _0x12a217=path[_0x8ea2('0xf0')](_0x2dfabc,_0x8ea2('0x13a')+_0x103c43['id']+'-'+_0x5b929c+'.pdf');var _0x44b0dc={'path':_0x12a217,'channel':_0x8ea2('0x12b'),'interactionId':_0x103c43['id']};return pdf['createPdfFromHTML'](_0x10d2b3,_0x44b0dc);})[_0x8ea2('0x25')](function(){return new BPromise(function(_0x27f5e9,_0x19b678){zipdir(_0x2dfabc,{'saveTo':_0x39000d},function(_0x50ebcd,_0x5d6c63){if(_0x50ebcd)return _0x19b678(_0x50ebcd);return _0x27f5e9(_0x5d6c63);});})[_0x8ea2('0x25')](function(){return new BPromise(function(_0x55b3a1,_0x57e228){rimraf(_0x2dfabc,function(_0x3c669b){if(_0x3c669b)_0x57e228(_0x3c669b);return _0x55b3a1();});});})[_0x8ea2('0x25')](function(){return _0x34e1c5['download'](_0x39000d,_0x515049,function(_0x688d21){if(_0x688d21){console[_0x8ea2('0x13b')]('err',_0x688d21);}else{fs[_0x8ea2('0x13c')](_0x39000d);}});});});}else{return _0x34e1c5['sendStatus'](0xc8);}})[_0x8ea2('0x2e')](handleError(_0x34e1c5,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 600604d..1a7660c 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 _0xfe58=['hasOwnProperty','hook','events','../../mysqldb','ChatInteraction','setMaxListeners','save','update','remove','getUsers','then','map','findAll','setDataValue','length','emit','catch'];(function(_0x4cbf20,_0x1bfa66){var _0x582ae4=function(_0x5eca38){while(--_0x5eca38){_0x4cbf20['push'](_0x4cbf20['shift']());}};_0x582ae4(++_0x1bfa66);}(_0xfe58,0x145));var _0x8fe5=function(_0x681d17,_0x163432){_0x681d17=_0x681d17-0x0;var _0x1fdb92=_0xfe58[_0x681d17];return _0x1fdb92;};'use strict';var EventEmitter=require(_0x8fe5('0x0'));var ChatInteraction=require(_0x8fe5('0x1'))['db'][_0x8fe5('0x2')];var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x8fe5('0x3')](0x0);var events={'afterCreate':_0x8fe5('0x4'),'afterUpdate':_0x8fe5('0x5'),'afterDestroy':_0x8fe5('0x6')};function emitEvent(_0x22a257){return function(_0x35c983,_0x55b0a9,_0x1360cf){_0x35c983[_0x8fe5('0x7')]({'attributes':['id'],'raw':!![]})[_0x8fe5('0x8')](function(_0x2ebfde){_0x35c983['setDataValue']('Users',_0x2ebfde[_0x8fe5('0x9')](function(_0x4b362e){return{'id':_0x4b362e['id']};}));return ChatMessage[_0x8fe5('0xa')]({'where':{'ChatInteractionId':_0x35c983['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8fe5('0x8')](function(_0x4fa36){_0x35c983[_0x8fe5('0xb')]('unreadMessages',_0x4fa36[_0x8fe5('0xc')]);ChatInteractionEvents['emit'](_0x22a257+':'+_0x35c983['id'],_0x35c983);ChatInteractionEvents[_0x8fe5('0xd')](_0x22a257,_0x35c983);_0x1360cf(null);})[_0x8fe5('0xe')](_0x1360cf(null));};}for(var e in events){if(events[_0x8fe5('0xf')](e)){var event=events[e];ChatInteraction[_0x8fe5('0x10')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0x423a=['length','emit','catch','exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','map','findAll','unreadMessages'];(function(_0x4032c2,_0x5e5fd8){var _0x22fa70=function(_0x3723ca){while(--_0x3723ca){_0x4032c2['push'](_0x4032c2['shift']());}};_0x22fa70(++_0x5e5fd8);}(_0x423a,0x1a2));var _0xa423=function(_0xead522,_0x43b39b){_0xead522=_0xead522-0x0;var _0x4fb90a=_0x423a[_0xead522];return _0x4fb90a;};'use strict';var EventEmitter=require(_0xa423('0x0'));var ChatInteraction=require(_0xa423('0x1'))['db'][_0xa423('0x2')];var ChatMessage=require(_0xa423('0x1'))['db'][_0xa423('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xa423('0x4')](0x0);var events={'afterCreate':_0xa423('0x5'),'afterUpdate':_0xa423('0x6'),'afterDestroy':_0xa423('0x7')};function emitEvent(_0x12738e){return function(_0x19e1b3,_0x536c83,_0x49f6b5){_0x19e1b3['getUsers']({'attributes':['id'],'raw':!![]})[_0xa423('0x8')](function(_0x4be3b3){_0x19e1b3[_0xa423('0x9')](_0xa423('0xa'),_0x4be3b3[_0xa423('0xb')](function(_0x11afa4){return{'id':_0x11afa4['id']};}));return ChatMessage[_0xa423('0xc')]({'where':{'ChatInteractionId':_0x19e1b3['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa423('0x8')](function(_0x42e9d1){_0x19e1b3[_0xa423('0x9')](_0xa423('0xd'),_0x42e9d1[_0xa423('0xe')]);ChatInteractionEvents[_0xa423('0xf')](_0x12738e+':'+_0x19e1b3['id'],_0x19e1b3);ChatInteractionEvents['emit'](_0x12738e,_0x19e1b3);_0x49f6b5(null);})[_0xa423('0x10')](_0x49f6b5(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0xa423('0x11')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 5a7a529..7d7786c 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 _0x88a9=['../../config/environment','./chatInteraction.attributes','exports','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x2baa3a,_0x25661f){var _0x2f724a=function(_0x194380){while(--_0x194380){_0x2baa3a['push'](_0x2baa3a['shift']());}};_0x2f724a(++_0x25661f);}(_0x88a9,0x81));var _0x988a=function(_0x5c09a7,_0x27f20e){_0x5c09a7=_0x5c09a7-0x0;var _0x4cb42b=_0x88a9[_0x5c09a7];return _0x4cb42b;};'use strict';var _=require(_0x988a('0x0'));var util=require(_0x988a('0x1'));var logger=require(_0x988a('0x2'))(_0x988a('0x3'));var moment=require(_0x988a('0x4'));var BPromise=require('bluebird');var rp=require(_0x988a('0x5'));var fs=require('fs');var path=require(_0x988a('0x6'));var rimraf=require('rimraf');var config=require(_0x988a('0x7'));var attributes=require(_0x988a('0x8'));module[_0x988a('0x9')]=function(_0x6fc154,_0xa9620){return _0x6fc154['define']('ChatInteraction',attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x22ed02,_0x38ce12,_0x50fbfe){if(_0x22ed02[_0x988a('0xa')](_0x988a('0xb'))){_0x22ed02[_0x988a('0xc')]=moment()[_0x988a('0xd')](_0x988a('0xe'));}_0x50fbfe(null,_0x22ed02);}},'charset':_0x988a('0xf'),'collate':_0x988a('0x10')});}; \ No newline at end of file +var _0x0564=['../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','path','rimraf'];(function(_0x2d0d25,_0x3c8a96){var _0x5c3fbf=function(_0x263e59){while(--_0x263e59){_0x2d0d25['push'](_0x2d0d25['shift']());}};_0x5c3fbf(++_0x3c8a96);}(_0x0564,0x108));var _0x4056=function(_0x3f8b13,_0x3ddfd7){_0x3f8b13=_0x3f8b13-0x0;var _0x1ce0af=_0x0564[_0x3f8b13];return _0x1ce0af;};'use strict';var _=require(_0x4056('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4056('0x1'));var moment=require(_0x4056('0x2'));var BPromise=require(_0x4056('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4056('0x4'));var rimraf=require(_0x4056('0x5'));var config=require(_0x4056('0x6'));var attributes=require(_0x4056('0x7'));module[_0x4056('0x8')]=function(_0x39801d,_0x27e002){return _0x39801d[_0x4056('0x9')](_0x4056('0xa'),attributes,{'tableName':_0x4056('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x34d231,_0x4a83eb,_0x12bcbf){if(_0x34d231[_0x4056('0xc')](_0x4056('0xd'))){_0x34d231['closedAt']=moment()[_0x4056('0xe')](_0x4056('0xf'));}_0x12bcbf(null,_0x34d231);}},'charset':_0x4056('0x10'),'collate':_0x4056('0x11')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 652548c..a0beae4 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 _0x9325=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','./chatInteraction.socket','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','UpdateChatInteraction','ChatInteraction','body','options','where','attributes','AddTagsToChatInteraction','find','ids','omit','spread','AddTags','catch','lodash','util'];(function(_0x198fd7,_0x1aa9b1){var _0x574ead=function(_0x311fc3){while(--_0x311fc3){_0x198fd7['push'](_0x198fd7['shift']());}};_0x574ead(++_0x1aa9b1);}(_0x9325,0xd0));var _0x5932=function(_0x3f0f9a,_0x3aec73){_0x3f0f9a=_0x3f0f9a-0x0;var _0x1c1a4b=_0x9325[_0x3f0f9a];return _0x1c1a4b;};'use strict';var _=require(_0x5932('0x0'));var util=require(_0x5932('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5932('0x2'));var fs=require('fs');var Redis=require(_0x5932('0x3'));var db=require(_0x5932('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5932('0x5'))(_0x5932('0x6'));var config=require('../../config/environment');var jayson=require(_0x5932('0x7'));var client=jayson[_0x5932('0x8')]['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5932('0x9')]));require(_0x5932('0xa'))['register'](socket);function respondWithRpcPromise(_0x392e12,_0x2b00d9,_0x5c8482){return new BPromise(function(_0x248abe,_0x595fac){return client[_0x5932('0xb')](_0x392e12,_0x5c8482)[_0x5932('0xc')](function(_0x342cf2){logger[_0x5932('0xd')]('ChatInteraction,\x20%s,\x20%s',_0x2b00d9,_0x5932('0xe'));logger[_0x5932('0xf')](_0x5932('0x10'),_0x2b00d9,_0x5932('0xe'),JSON[_0x5932('0x11')](_0x342cf2));if(_0x342cf2[_0x5932('0x12')]){if(_0x342cf2[_0x5932('0x12')][_0x5932('0x13')]===0x1f4){logger['error'](_0x5932('0x14'),_0x2b00d9,_0x342cf2['error'][_0x5932('0x15')]);return _0x595fac(_0x342cf2[_0x5932('0x12')]['message']);}logger[_0x5932('0x12')](_0x5932('0x14'),_0x2b00d9,_0x342cf2['error'][_0x5932('0x15')]);return _0x248abe(_0x342cf2[_0x5932('0x12')][_0x5932('0x15')]);}else{logger['info'](_0x5932('0x14'),_0x2b00d9,'request\x20sent');_0x248abe(_0x342cf2['result'][_0x5932('0x15')]);}})['catch'](function(_0x5f5130){logger[_0x5932('0x12')](_0x5932('0x14'),_0x2b00d9,_0x5f5130);_0x595fac(_0x5f5130);});});}exports[_0x5932('0x16')]=function(_0x4552e6){var _0x3f9edc=this;return new Promise(function(_0x291d64,_0x2060d2){return db[_0x5932('0x17')]['update'](_0x4552e6[_0x5932('0x18')],{'raw':_0x4552e6[_0x5932('0x19')]?_0x4552e6[_0x5932('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4552e6[_0x5932('0x19')]?_0x4552e6[_0x5932('0x19')][_0x5932('0x1a')]||null:null,'attributes':_0x4552e6[_0x5932('0x19')]?_0x4552e6['options'][_0x5932('0x1b')]||null:null,'limit':_0x4552e6[_0x5932('0x19')]?_0x4552e6[_0x5932('0x19')]['limit']||null:null})[_0x5932('0xc')](function(_0x4a6257){logger[_0x5932('0xd')](_0x5932('0x16'),_0x4552e6);logger['debug']('UpdateChatInteraction',_0x4552e6,JSON[_0x5932('0x11')](_0x4a6257));_0x291d64(_0x4a6257);})['catch'](function(_0x787348){logger[_0x5932('0x12')](_0x5932('0x16'),_0x787348[_0x5932('0x15')],_0x4552e6);_0x2060d2(_0x3f9edc[_0x5932('0x12')](0x1f4,_0x787348[_0x5932('0x15')]));});});};exports[_0x5932('0x1c')]=function(_0x3a9d86){return new Promise(function(_0x194588,_0x1ef947){return db['ChatInteraction'][_0x5932('0x1d')]({'where':_0x3a9d86['options']?_0x3a9d86[_0x5932('0x19')][_0x5932('0x1a')]||null:null})[_0x5932('0xc')](function(_0x15d699){if(_0x15d699){return _0x15d699['addTags'](_0x3a9d86[_0x5932('0x18')][_0x5932('0x1e')],_[_0x5932('0x1f')](_0x3a9d86[_0x5932('0x18')],[_0x5932('0x1e'),'id'])||{});}})[_0x5932('0x20')](function(_0x59c4d0){logger[_0x5932('0xd')](_0x5932('0x21'),_0x3a9d86);logger[_0x5932('0xf')](_0x5932('0x21'),_0x3a9d86,JSON[_0x5932('0x11')](_0x59c4d0));_0x194588(_0x59c4d0);})[_0x5932('0x22')](function(_0x30b24a){logger[_0x5932('0x12')](_0x5932('0x21'),_0x30b24a[_0x5932('0x15')],_0x3a9d86);_0x1ef947(_this[_0x5932('0x12')](0x1f4,_0x30b24a[_0x5932('0x15')]));});});}; \ No newline at end of file +var _0x189c=['AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','ChatInteraction,\x20%s,\x20%s','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','where','attributes','limit','info','debug','AddTagsToChatInteraction','addTags','ids','omit','spread'];(function(_0x537dc2,_0x1fc1d6){var _0x1224b8=function(_0xd166e3){while(--_0xd166e3){_0x537dc2['push'](_0x537dc2['shift']());}};_0x1224b8(++_0x1fc1d6);}(_0x189c,0x159));var _0xc189=function(_0xf9bdd8,_0x30938e){_0xf9bdd8=_0xf9bdd8-0x0;var _0x4133e8=_0x189c[_0xf9bdd8];return _0x4133e8;};'use strict';var _=require(_0xc189('0x0'));var util=require('util');var moment=require(_0xc189('0x1'));var BPromise=require(_0xc189('0x2'));var rs=require(_0xc189('0x3'));var fs=require('fs');var Redis=require(_0xc189('0x4'));var db=require(_0xc189('0x5'))['db'];var utils=require(_0xc189('0x6'));var logger=require(_0xc189('0x7'))(_0xc189('0x8'));var config=require('../../config/environment');var jayson=require(_0xc189('0x9'));var client=jayson[_0xc189('0xa')][_0xc189('0xb')]({'port':0x232a});config['redis']=_[_0xc189('0xc')](config[_0xc189('0xd')],{'host':_0xc189('0xe'),'port':0x18eb});var socket=require(_0xc189('0xf'))(new Redis(config[_0xc189('0xd')]));require('./chatInteraction.socket')[_0xc189('0x10')](socket);function respondWithRpcPromise(_0x10c720,_0x5ca777,_0x11479c){return new BPromise(function(_0x1ce57a,_0x3dbf60){return client[_0xc189('0x11')](_0x10c720,_0x11479c)[_0xc189('0x12')](function(_0x3af765){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x5ca777,_0xc189('0x13'));logger['debug'](_0xc189('0x14'),_0x5ca777,_0xc189('0x13'),JSON[_0xc189('0x15')](_0x3af765));if(_0x3af765[_0xc189('0x16')]){if(_0x3af765[_0xc189('0x16')]['code']===0x1f4){logger[_0xc189('0x16')](_0xc189('0x17'),_0x5ca777,_0x3af765[_0xc189('0x16')]['message']);return _0x3dbf60(_0x3af765['error'][_0xc189('0x18')]);}logger[_0xc189('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x5ca777,_0x3af765[_0xc189('0x16')][_0xc189('0x18')]);return _0x1ce57a(_0x3af765[_0xc189('0x16')][_0xc189('0x18')]);}else{logger['info'](_0xc189('0x17'),_0x5ca777,'request\x20sent');_0x1ce57a(_0x3af765[_0xc189('0x19')][_0xc189('0x18')]);}})[_0xc189('0x1a')](function(_0xece6e0){logger[_0xc189('0x16')](_0xc189('0x17'),_0x5ca777,_0xece6e0);_0x3dbf60(_0xece6e0);});});}exports[_0xc189('0x1b')]=function(_0x14aa57){var _0x33f08f=this;return new Promise(function(_0x552150,_0x314837){return db[_0xc189('0x1c')][_0xc189('0x1d')](_0x14aa57[_0xc189('0x1e')],{'raw':_0x14aa57[_0xc189('0x1f')]?_0x14aa57[_0xc189('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14aa57[_0xc189('0x1f')]?_0x14aa57[_0xc189('0x1f')][_0xc189('0x20')]||null:null,'attributes':_0x14aa57[_0xc189('0x1f')]?_0x14aa57[_0xc189('0x1f')][_0xc189('0x21')]||null:null,'limit':_0x14aa57[_0xc189('0x1f')]?_0x14aa57['options'][_0xc189('0x22')]||null:null})[_0xc189('0x12')](function(_0x471455){logger[_0xc189('0x23')](_0xc189('0x1b'),_0x14aa57);logger[_0xc189('0x24')](_0xc189('0x1b'),_0x14aa57,JSON[_0xc189('0x15')](_0x471455));_0x552150(_0x471455);})['catch'](function(_0x43b942){logger['error'](_0xc189('0x1b'),_0x43b942[_0xc189('0x18')],_0x14aa57);_0x314837(_0x33f08f[_0xc189('0x16')](0x1f4,_0x43b942[_0xc189('0x18')]));});});};exports[_0xc189('0x25')]=function(_0x7eb374){return new Promise(function(_0x3a5965,_0x531048){return db['ChatInteraction']['find']({'where':_0x7eb374['options']?_0x7eb374[_0xc189('0x1f')][_0xc189('0x20')]||null:null})[_0xc189('0x12')](function(_0x1a98ce){if(_0x1a98ce){return _0x1a98ce[_0xc189('0x26')](_0x7eb374[_0xc189('0x1e')][_0xc189('0x27')],_[_0xc189('0x28')](_0x7eb374[_0xc189('0x1e')],[_0xc189('0x27'),'id'])||{});}})[_0xc189('0x29')](function(_0x6c144a){logger[_0xc189('0x23')](_0xc189('0x2a'),_0x7eb374);logger[_0xc189('0x24')](_0xc189('0x2a'),_0x7eb374,JSON['stringify'](_0x6c144a));_0x3a5965(_0x6c144a);})[_0xc189('0x1a')](function(_0xd8e5f2){logger[_0xc189('0x16')](_0xc189('0x2a'),_0xd8e5f2[_0xc189('0x18')],_0x7eb374);_0x531048(_this['error'](0x1f4,_0xd8e5f2[_0xc189('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 1365755..e28338e 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 _0x29f0=['remove','update','emit','removeListener','register','chatInteraction:','./chatInteraction.events'];(function(_0x3a9661,_0x530b12){var _0x5bb119=function(_0x1278f){while(--_0x1278f){_0x3a9661['push'](_0x3a9661['shift']());}};_0x5bb119(++_0x530b12);}(_0x29f0,0x172));var _0x029f=function(_0x44d6b3,_0x12ca0b){_0x44d6b3=_0x44d6b3-0x0;var _0x4aae79=_0x29f0[_0x44d6b3];return _0x4aae79;};'use strict';var ChatInteractionEvents=require(_0x029f('0x0'));var events=['save',_0x029f('0x1'),_0x029f('0x2')];function createListener(_0x9b27a6,_0x2dd961){return function(_0x3f5c90){_0x2dd961[_0x029f('0x3')](_0x9b27a6,_0x3f5c90);};}function removeListener(_0x3173b3,_0x36087a){return function(){ChatInteractionEvents[_0x029f('0x4')](_0x3173b3,_0x36087a);};}exports[_0x029f('0x5')]=function(_0x147275){for(var _0x4162c8=0x0,_0x50d9dd=events['length'];_0x4162c8<_0x50d9dd;_0x4162c8++){var _0x1c15c9=events[_0x4162c8];var _0x491263=createListener(_0x029f('0x6')+_0x1c15c9,_0x147275);ChatInteractionEvents['on'](_0x1c15c9,_0x491263);}}; \ No newline at end of file +var _0x6d4f=['removeListener','register','length','chatInteraction:','./chatInteraction.events','emit'];(function(_0x4831d7,_0x384d17){var _0x1ea2e8=function(_0xdd1209){while(--_0xdd1209){_0x4831d7['push'](_0x4831d7['shift']());}};_0x1ea2e8(++_0x384d17);}(_0x6d4f,0xee));var _0xf6d4=function(_0xf43cb,_0x465374){_0xf43cb=_0xf43cb-0x0;var _0x14e869=_0x6d4f[_0xf43cb];return _0x14e869;};'use strict';var ChatInteractionEvents=require(_0xf6d4('0x0'));var events=['save','remove','update'];function createListener(_0x32b23d,_0x191fde){return function(_0x1dfb1d){_0x191fde[_0xf6d4('0x1')](_0x32b23d,_0x1dfb1d);};}function removeListener(_0x247b57,_0x3168d3){return function(){ChatInteractionEvents[_0xf6d4('0x2')](_0x247b57,_0x3168d3);};}exports[_0xf6d4('0x3')]=function(_0xac0926){for(var _0x40088e=0x0,_0x303ece=events[_0xf6d4('0x4')];_0x40088e<_0x303ece;_0x40088e++){var _0xfe5a6a=events[_0x40088e];var _0x46f8c5=createListener(_0xf6d4('0x5')+_0xfe5a6a,_0xac0926);ChatInteractionEvents['on'](_0xfe5a6a,_0x46f8c5);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 7efa0a0..dbedeea 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 _0x24db=['isAuthenticated','/:id/my_messages','getMyMessages','/:id/download','download','post','/:id/vidaoo','createVidaooSession','join','root','server/files/attachments/','format','%s-%s','now','replace','single','file','attachmentUpload','/:id/messages','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','/:id/custom_update','customUpdate','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','index','/describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download'];(function(_0x3bbd7a,_0x381a73){var _0x3d3166=function(_0x2ae67d){while(--_0x2ae67d){_0x3bbd7a['push'](_0x3bbd7a['shift']());}};_0x3d3166(++_0x381a73);}(_0x24db,0x148));var _0xb24d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x24db[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xb24d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb24d('0x1'));var express=require(_0xb24d('0x2'));var router=express['Router']();var fs_extra=require(_0xb24d('0x3'));var auth=require(_0xb24d('0x4'));var interaction=require(_0xb24d('0x5'));var config=require(_0xb24d('0x6'));var controller=require(_0xb24d('0x7'));router[_0xb24d('0x8')]('/',auth['isAuthenticated'](),controller[_0xb24d('0x9')]);router[_0xb24d('0x8')](_0xb24d('0xa'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xb24d('0xb'),auth[_0xb24d('0xc')](),controller[_0xb24d('0xd')]);router[_0xb24d('0x8')](_0xb24d('0xe'),auth[_0xb24d('0xc')](),controller['attachmentDownload']);router[_0xb24d('0x8')]('/:id/messages',auth[_0xb24d('0xf')](),controller['getMessages']);router[_0xb24d('0x8')](_0xb24d('0x10'),auth['isChatInteractionAuthorized'](),controller[_0xb24d('0x11')]);router[_0xb24d('0x8')](_0xb24d('0x12'),auth[_0xb24d('0xf')](),controller[_0xb24d('0x13')]);router[_0xb24d('0x14')]('/',auth[_0xb24d('0xf')](),controller['create']);router[_0xb24d('0x14')](_0xb24d('0x15'),auth['isAuthenticated'](),controller[_0xb24d('0x16')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x10398e,_0x18d501,_0x34e4d3){_0x34e4d3(null,path[_0xb24d('0x17')](config[_0xb24d('0x18')],_0xb24d('0x19')));},'filename':function(_0x5373b4,_0x572b14,_0x4056a4){_0x4056a4(null,util[_0xb24d('0x1a')](_0xb24d('0x1b'),Date[_0xb24d('0x1c')](),_0x572b14['originalname'][_0xb24d('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xb24d('0x14')]('/:id/attachment_upload',upload[_0xb24d('0x1e')](_0xb24d('0x1f')),controller[_0xb24d('0x20')]);router[_0xb24d('0x14')](_0xb24d('0x21'),auth[_0xb24d('0xc')](),controller[_0xb24d('0x22')]);router[_0xb24d('0x14')](_0xb24d('0x23'),auth['isAuthenticated'](),interaction[_0xb24d('0x24')](_0xb24d('0x25'),_0xb24d('0x26')),controller[_0xb24d('0x27')]);router[_0xb24d('0x28')](_0xb24d('0xb'),auth['isAuthenticated'](),interaction[_0xb24d('0x24')]('chat','chatinteraction:update'),controller['update']);router[_0xb24d('0x28')](_0xb24d('0x29'),controller[_0xb24d('0x2a')]);router[_0xb24d('0x28')]('/:id/abandon',auth[_0xb24d('0xc')](),controller[_0xb24d('0x2b')]);router[_0xb24d('0x28')](_0xb24d('0x2c'),controller[_0xb24d('0x2d')]);router[_0xb24d('0x2e')]('/:id',auth[_0xb24d('0xf')](),interaction['tracked'](_0xb24d('0x25'),_0xb24d('0x2f')),controller[_0xb24d('0x30')]);router[_0xb24d('0x2e')](_0xb24d('0x23'),auth[_0xb24d('0xf')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0x853f=['%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','/:id/tags','tracked','chat','chatinteraction:addtags','put','chatinteraction:update','/:id/custom_update','customUpdate','abandon','/:id/close','close','destroy','delete','removeTags','exports','multer','express','Router','fs-extra','../../config/environment','./chatInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','join','root','server/files/attachments/','format'];(function(_0x7d1a4c,_0x10187e){var _0x74453c=function(_0x46f176){while(--_0x46f176){_0x7d1a4c['push'](_0x7d1a4c['shift']());}};_0x74453c(++_0x10187e);}(_0x853f,0xdf));var _0xf853=function(_0x328c26,_0x468b31){_0x328c26=_0x328c26-0x0;var _0x3ac777=_0x853f[_0x328c26];return _0x3ac777;};'use strict';var multer=require(_0xf853('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf853('0x1'));var router=express[_0xf853('0x2')]();var fs_extra=require(_0xf853('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf853('0x4'));var controller=require(_0xf853('0x5'));router[_0xf853('0x6')]('/',auth[_0xf853('0x7')](),controller['index']);router['get'](_0xf853('0x8'),auth[_0xf853('0x7')](),controller[_0xf853('0x9')]);router[_0xf853('0x6')](_0xf853('0xa'),auth['isChatInteractionAuthorized'](),controller[_0xf853('0xb')]);router[_0xf853('0x6')]('/:id/attachment_download',auth['isChatInteractionAuthorized'](),controller[_0xf853('0xc')]);router['get'](_0xf853('0xd'),auth[_0xf853('0x7')](),controller[_0xf853('0xe')]);router['get'](_0xf853('0xf'),auth['isChatInteractionAuthorized'](),controller[_0xf853('0x10')]);router[_0xf853('0x6')](_0xf853('0x11'),auth[_0xf853('0x7')](),controller[_0xf853('0x12')]);router[_0xf853('0x13')]('/',auth[_0xf853('0x7')](),controller[_0xf853('0x14')]);router[_0xf853('0x13')](_0xf853('0x15'),auth['isAuthenticated'](),controller[_0xf853('0x16')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3fb3c5,_0x369592,_0x407868){_0x407868(null,path[_0xf853('0x17')](config[_0xf853('0x18')],_0xf853('0x19')));},'filename':function(_0x5baa53,_0x1bf73c,_0x145732){_0x145732(null,util[_0xf853('0x1a')](_0xf853('0x1b'),Date[_0xf853('0x1c')](),_0x1bf73c[_0xf853('0x1d')][_0xf853('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf853('0x13')](_0xf853('0x1f'),upload[_0xf853('0x20')](_0xf853('0x21')),controller[_0xf853('0x22')]);router[_0xf853('0x13')](_0xf853('0xd'),auth['isChatInteractionAuthorized'](),controller['addMessage']);router[_0xf853('0x13')](_0xf853('0x23'),auth[_0xf853('0x7')](),interaction[_0xf853('0x24')](_0xf853('0x25'),_0xf853('0x26')),controller['addTags']);router[_0xf853('0x27')](_0xf853('0xa'),auth[_0xf853('0x7')](),interaction[_0xf853('0x24')](_0xf853('0x25'),_0xf853('0x28')),controller['update']);router['put'](_0xf853('0x29'),controller[_0xf853('0x2a')]);router[_0xf853('0x27')]('/:id/abandon',auth['isChatInteractionAuthorized'](),controller[_0xf853('0x2b')]);router['put'](_0xf853('0x2c'),controller[_0xf853('0x2d')]);router['delete'](_0xf853('0xa'),auth[_0xf853('0x7')](),interaction[_0xf853('0x24')](_0xf853('0x25'),'chatinteraction:destroy'),controller[_0xf853('0x2e')]);router[_0xf853('0x2f')]('/:id/tags',auth[_0xf853('0x7')](),controller[_0xf853('0x30')]);module[_0xf853('0x31')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 5a1a162..be4650b 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 _0xe416=['BOOLEAN','INTEGER','exports','medium'];(function(_0x467ca1,_0xf345b5){var _0x280dd8=function(_0x5b6a04){while(--_0x5b6a04){_0x467ca1['push'](_0x467ca1['shift']());}};_0x280dd8(++_0xf345b5);}(_0xe416,0x14a));var _0x6e41=function(_0x4d5103,_0x3129b8){_0x4d5103=_0x4d5103-0x0;var _0x447fa5=_0xe416[_0x4d5103];return _0x447fa5;};'use strict';var Sequelize=require('sequelize');module[_0x6e41('0x0')]={'body':{'type':Sequelize['TEXT'](_0x6e41('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x6e41('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x6e41('0x3')]}}; \ No newline at end of file +var _0xb0db=['medium','BOOLEAN','INTEGER','sequelize','exports','TEXT'];(function(_0x1fa5c1,_0x2e45c0){var _0x31b578=function(_0x5c634b){while(--_0x5c634b){_0x1fa5c1['push'](_0x1fa5c1['shift']());}};_0x31b578(++_0x2e45c0);}(_0xb0db,0x183));var _0xbb0d=function(_0x2f1be2,_0x377541){_0x2f1be2=_0x2f1be2-0x0;var _0x31c5aa=_0xb0db[_0x2f1be2];return _0x31c5aa;};'use strict';var Sequelize=require(_0xbb0d('0x0'));module[_0xbb0d('0x1')]={'body':{'type':Sequelize[_0xbb0d('0x2')](_0xbb0d('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xbb0d('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xbb0d('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index d53c5e6..6547d1d 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 _0x7f82=['UserProfileResource','isEmpty','filter','agent','push','messages','FromId','ToId','read','-createdAt','eml-format','rimraf','fast-json-patch','request-promise','moment','path','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','error','stack','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','name','query','attributes','intersection','fields','length','order','sort','filters','pick','where','VIRTUAL','merge','options','includeAll','include','catch','show','params','keys','find','create','body','destroy','describe','lastMessageAt','createdAt','YYYY-MM-DD\x20HH:mm:ss','lastMessage','User','findAll','admin','fullname','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','get','role','user','userProfileId'];(function(_0x121203,_0x48082e){var _0x15e54d=function(_0x526e40){while(--_0x526e40){_0x121203['push'](_0x121203['shift']());}};_0x15e54d(++_0x48082e);}(_0x7f82,0x1ae));var _0x27f8=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x7f82[_0x297fd3];return _0x2af381;};'use strict';var emlformat=require(_0x27f8('0x0'));var rimraf=require(_0x27f8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x27f8('0x2'));var rp=require(_0x27f8('0x3'));var moment=require(_0x27f8('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x27f8('0x5'));var sox=require('sox');var csv=require(_0x27f8('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x27f8('0x7'));var squel=require(_0x27f8('0x8'));var crypto=require(_0x27f8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x27f8('0xa'));var toCsv=require('to-csv');var querystring=require(_0x27f8('0xb'));var Papa=require('papaparse');var Redis=require(_0x27f8('0xc'));var authService=require(_0x27f8('0xd'));var qs=require(_0x27f8('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x27f8('0xf'));var utils=require(_0x27f8('0x10'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x27f8('0x11'))['db'];config[_0x27f8('0x12')]=_[_0x27f8('0x13')](config[_0x27f8('0x12')],{'host':_0x27f8('0x14'),'port':0x18eb});var socket=require(_0x27f8('0x15'))(new Redis(config[_0x27f8('0x12')]));require(_0x27f8('0x16'))[_0x27f8('0x17')](socket);function respondWithStatusCode(_0x359ece,_0x1a40eb){_0x1a40eb=_0x1a40eb||0xcc;return function(_0x26ec9d){if(_0x26ec9d){return _0x359ece[_0x27f8('0x18')](_0x1a40eb);}return _0x359ece[_0x27f8('0x19')](_0x1a40eb)['end']();};}function respondWithResult(_0x126ed9,_0x45cf2f){_0x45cf2f=_0x45cf2f||0xc8;return function(_0x3b52c3){if(_0x3b52c3){return _0x126ed9['status'](_0x45cf2f)[_0x27f8('0x1a')](_0x3b52c3);}};}function respondWithFilteredResult(_0x37123c,_0x674723){return function(_0x4f7e8a){if(_0x4f7e8a){var _0x6af749=typeof _0x674723[_0x27f8('0x1b')]===_0x27f8('0x1c')&&typeof _0x674723[_0x27f8('0x1d')]===_0x27f8('0x1c');var _0x26d296=_0x4f7e8a['count'];var _0x542972=_0x6af749?0x0:_0x674723['offset'];var _0x2b23b1=_0x6af749?_0x4f7e8a[_0x27f8('0x1e')]:_0x674723['offset']+_0x674723['limit'];var _0x2a7bea;if(_0x2b23b1>=_0x26d296){_0x2b23b1=_0x26d296;_0x2a7bea=0xc8;}else{_0x2a7bea=0xce;}_0x37123c[_0x27f8('0x19')](_0x2a7bea);return _0x37123c[_0x27f8('0x1f')](_0x27f8('0x20'),_0x542972+'-'+_0x2b23b1+'/'+_0x26d296)[_0x27f8('0x1a')](_0x4f7e8a);}return null;};}function patchUpdates(_0x5c9bf0){return function(_0x58188c){try{jsonpatch[_0x27f8('0x21')](_0x58188c,_0x5c9bf0,!![]);}catch(_0x29c0b7){return BPromise[_0x27f8('0x22')](_0x29c0b7);}return _0x58188c[_0x27f8('0x23')]();};}function saveUpdates(_0x2c16ce,_0x1d811b){return function(_0x4253a3){if(_0x4253a3){return _0x4253a3[_0x27f8('0x24')](_0x2c16ce)[_0x27f8('0x25')](function(_0x34e787){return _0x34e787;});}return null;};}function removeEntity(_0x31451e,_0x4cdf01){return function(_0x3b92ba){if(_0x3b92ba){return _0x3b92ba['destroy']()[_0x27f8('0x25')](function(){_0x31451e[_0x27f8('0x19')](0xcc)[_0x27f8('0x26')]();});}};}function handleEntityNotFound(_0x1c358f,_0x5329f6){return function(_0x8cf9fa){if(!_0x8cf9fa){_0x1c358f[_0x27f8('0x18')](0x194);}return _0x8cf9fa;};}function handleError(_0x35f0f4,_0x4b2910){_0x4b2910=_0x4b2910||0x1f4;return function(_0x16bd46){logger[_0x27f8('0x27')](_0x16bd46[_0x27f8('0x28')]);if(_0x16bd46['name']){delete _0x16bd46['name'];}_0x35f0f4['status'](_0x4b2910)['send'](_0x16bd46);};}exports[_0x27f8('0x29')]=function(_0x6fb526,_0x357e17){var _0x3ff2b1={},_0xee079f={},_0x488bc5={'count':0x0,'rows':[]};var _0x3cb594=_[_0x27f8('0x2a')](db[_0x27f8('0x2b')][_0x27f8('0x2c')],function(_0x1b256f){return{'name':_0x1b256f[_0x27f8('0x2d')],'type':_0x1b256f[_0x27f8('0x2e')][_0x27f8('0x2f')]};});_0xee079f[_0x27f8('0x30')]=_[_0x27f8('0x2a')](_0x3cb594,_0x27f8('0x31'));_0xee079f['query']=_['keys'](_0x6fb526[_0x27f8('0x32')]);_0xee079f['filters']=_['intersection'](_0xee079f[_0x27f8('0x30')],_0xee079f[_0x27f8('0x32')]);_0x3ff2b1[_0x27f8('0x33')]=_[_0x27f8('0x34')](_0xee079f[_0x27f8('0x30')],qs[_0x27f8('0x35')](_0x6fb526[_0x27f8('0x32')][_0x27f8('0x35')]));_0x3ff2b1['attributes']=_0x3ff2b1[_0x27f8('0x33')][_0x27f8('0x36')]?_0x3ff2b1[_0x27f8('0x33')]:_0xee079f['model'];if(!_0x6fb526['query']['hasOwnProperty']('nolimit')){_0x3ff2b1[_0x27f8('0x1d')]=qs['limit'](_0x6fb526[_0x27f8('0x32')][_0x27f8('0x1d')]);_0x3ff2b1[_0x27f8('0x1b')]=qs['offset'](_0x6fb526[_0x27f8('0x32')]['offset']);}_0x3ff2b1[_0x27f8('0x37')]=qs[_0x27f8('0x38')](_0x6fb526['query'][_0x27f8('0x38')]);_0x3ff2b1['where']=qs[_0x27f8('0x39')](_[_0x27f8('0x3a')](_0x6fb526[_0x27f8('0x32')],_0xee079f[_0x27f8('0x39')]),_0x3cb594);if(_0x6fb526[_0x27f8('0x32')]['filter']){_0x3ff2b1[_0x27f8('0x3b')]=_['merge'](_0x3ff2b1[_0x27f8('0x3b')],{'$or':_[_0x27f8('0x2a')](_0x3cb594,function(_0xff4097){if(_0xff4097[_0x27f8('0x2e')]!==_0x27f8('0x3c')){var _0x483c37={};_0x483c37[_0xff4097[_0x27f8('0x31')]]={'$like':'%'+_0x6fb526[_0x27f8('0x32')]['filter']+'%'};return _0x483c37;}})});}_0x3ff2b1=_[_0x27f8('0x3d')]({},_0x3ff2b1,_0x6fb526[_0x27f8('0x3e')]);var _0x5a4e45={'where':_0x3ff2b1[_0x27f8('0x3b')]};return db[_0x27f8('0x2b')]['count'](_0x5a4e45)['then'](function(_0x5116f6){_0x488bc5[_0x27f8('0x1e')]=_0x5116f6;if(_0x6fb526[_0x27f8('0x32')][_0x27f8('0x3f')]){_0x3ff2b1[_0x27f8('0x40')]=[{'all':!![]}];}return db[_0x27f8('0x2b')]['findAll'](_0x3ff2b1);})[_0x27f8('0x25')](function(_0x5f05e8){_0x488bc5['rows']=_0x5f05e8;return _0x488bc5;})['then'](respondWithFilteredResult(_0x357e17,_0x3ff2b1))[_0x27f8('0x41')](handleError(_0x357e17,null));};exports[_0x27f8('0x42')]=function(_0x35bc05,_0x53ff6d){var _0x46fa8e={'raw':!![],'where':{'id':_0x35bc05[_0x27f8('0x43')]['id']}},_0x2f9930={};_0x2f9930[_0x27f8('0x30')]=_['keys'](db[_0x27f8('0x2b')][_0x27f8('0x2c')]);_0x2f9930[_0x27f8('0x32')]=_[_0x27f8('0x44')](_0x35bc05[_0x27f8('0x32')]);_0x2f9930[_0x27f8('0x39')]=_[_0x27f8('0x34')](_0x2f9930[_0x27f8('0x30')],_0x2f9930['query']);_0x46fa8e[_0x27f8('0x33')]=_[_0x27f8('0x34')](_0x2f9930[_0x27f8('0x30')],qs[_0x27f8('0x35')](_0x35bc05[_0x27f8('0x32')][_0x27f8('0x35')]));_0x46fa8e[_0x27f8('0x33')]=_0x46fa8e[_0x27f8('0x33')]['length']?_0x46fa8e[_0x27f8('0x33')]:_0x2f9930[_0x27f8('0x30')];if(_0x35bc05[_0x27f8('0x32')][_0x27f8('0x3f')]){_0x46fa8e[_0x27f8('0x40')]=[{'all':!![]}];}_0x46fa8e=_['merge']({},_0x46fa8e,_0x35bc05['options']);return db[_0x27f8('0x2b')][_0x27f8('0x45')](_0x46fa8e)[_0x27f8('0x25')](handleEntityNotFound(_0x53ff6d,null))['then'](respondWithResult(_0x53ff6d,null))[_0x27f8('0x41')](handleError(_0x53ff6d,null));};exports[_0x27f8('0x46')]=function(_0xb7460d,_0x46f2dc){return db[_0x27f8('0x2b')][_0x27f8('0x46')](_0xb7460d['body'],{})[_0x27f8('0x25')](respondWithResult(_0x46f2dc,0xc9))[_0x27f8('0x41')](handleError(_0x46f2dc,null));};exports['update']=function(_0x5a8db0,_0x55308c){if(_0x5a8db0[_0x27f8('0x47')]['id']){delete _0x5a8db0[_0x27f8('0x47')]['id'];}return db['ChatInternalMessage']['find']({'where':{'id':_0x5a8db0[_0x27f8('0x43')]['id']}})[_0x27f8('0x25')](handleEntityNotFound(_0x55308c,null))[_0x27f8('0x25')](saveUpdates(_0x5a8db0['body'],null))[_0x27f8('0x25')](respondWithResult(_0x55308c,null))[_0x27f8('0x41')](handleError(_0x55308c,null));};exports[_0x27f8('0x48')]=function(_0xf33a1,_0x1be763){return db[_0x27f8('0x2b')][_0x27f8('0x45')]({'where':{'id':_0xf33a1[_0x27f8('0x43')]['id']}})[_0x27f8('0x25')](handleEntityNotFound(_0x1be763,null))['then'](removeEntity(_0x1be763,null))[_0x27f8('0x41')](handleError(_0x1be763,null));};exports[_0x27f8('0x49')]=function(_0x4fcc91,_0x472110){return db[_0x27f8('0x2b')][_0x27f8('0x49')]()[_0x27f8('0x25')](respondWithResult(_0x472110,null))[_0x27f8('0x41')](handleError(_0x472110,null));};function wrapUser(_0x2bbbd6){return function(_0x103d04){var _0x1f36a7=_0x2bbbd6['get']({'plain':!![]});_0x1f36a7['messages']=[];if(_0x103d04){_0x1f36a7[_0x27f8('0x4a')]=_0x103d04[_0x27f8('0x4b')];_0x1f36a7['lastMessage']=_0x103d04;}else{_0x1f36a7[_0x27f8('0x4a')]=moment(0x0)['format'](_0x27f8('0x4c'));_0x1f36a7[_0x27f8('0x4d')]={};}return _0x1f36a7;};}exports['getUsers']=function(_0x242f2e,_0x48acc1,_0x42323d){var _0x374731=[];return db[_0x27f8('0x4e')][_0x27f8('0x4f')]({'where':{'role':['agent',_0x27f8('0x50'),'user']},'attributes':['id',_0x27f8('0x51'),_0x27f8('0x31'),'role',_0x27f8('0x52'),_0x27f8('0x53'),_0x27f8('0x54'),_0x27f8('0x55'),_0x27f8('0x56'),_0x27f8('0x57')],'order':qs[_0x27f8('0x38')](_0x27f8('0x58')),'include':[{'model':db[_0x27f8('0x59')],'as':_0x27f8('0x5a'),'attributes':['id',_0x27f8('0x31'),_0x27f8('0x2e')],'through':{'attributes':[]}}]})[_0x27f8('0x25')](function(_0x2ae14f){if(_0x2ae14f){var _0x3d4a7c=_0x242f2e['user'][_0x27f8('0x5b')]({'plain':!![]});if(!_0x3d4a7c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3d4a7c[_0x27f8('0x5c')]===_0x27f8('0x5d')){return db['UserProfileSection'][_0x27f8('0x45')]({'where':{'name':'Agents','userProfileId':_0x3d4a7c[_0x27f8('0x5e')]},'raw':!![]})[_0x27f8('0x25')](function(_0x4743e3){if(_0x4743e3){if(_0x4743e3['autoAssociation']===0x0){return db[_0x27f8('0x5f')][_0x27f8('0x4f')]({'where':{'sectionId':_0x4743e3['id']},'raw':!![]})['then'](function(_0x4a6415){var _0x385b2b=[];if(_[_0x27f8('0x60')](_0x4a6415)){_0x385b2b=_[_0x27f8('0x61')](_0x2ae14f,function(_0x167893){if(_0x167893['role']!==_0x27f8('0x62')){return _0x167893;}});return _0x385b2b;}else{for(var _0x489d0f=0x0;_0x489d0f<_0x2ae14f[_0x27f8('0x36')];_0x489d0f++){var _0xa1c2c0=_0x2ae14f[_0x489d0f];if(_0xa1c2c0[_0x27f8('0x5c')]===_0x27f8('0x62')){var _0x4d84b8=_[_0x27f8('0x45')](_0x4a6415,function(_0x1bec8a){return _0x1bec8a['resourceId']===_0xa1c2c0['id'];});if(_0x4d84b8)_0x385b2b[_0x27f8('0x63')](_0xa1c2c0);}else{_0x385b2b[_0x27f8('0x63')](_0xa1c2c0);}}return _0x385b2b;}});}else{return _0x2ae14f;}}else{var _0x15c6b5=_[_0x27f8('0x61')](_0x2ae14f,function(_0x475460){if(_0x475460['role']!==_0x27f8('0x62')){return _0x475460;}});return _0x15c6b5;}});}else{return _0x2ae14f;}}})[_0x27f8('0x25')](function(_0x3bcbb1){var _0x167ea4=[];if(_0x3bcbb1){_0x374731=_0x3bcbb1;for(var _0x284346=0x0;_0x284346<_0x3bcbb1[_0x27f8('0x36')];_0x284346+=0x1){_0x374731[_0x284346][_0x27f8('0x64')]=[];_0x167ea4[_0x27f8('0x63')](db[_0x27f8('0x2b')][_0x27f8('0x45')]({'where':{'FromId':[_0x242f2e[_0x27f8('0x5d')]['id'],_0x3bcbb1[_0x284346]['id']],'ToId':[_0x242f2e[_0x27f8('0x5d')]['id'],_0x3bcbb1[_0x284346]['id']],'ChatGroupId':null},'attributes':['id',_0x27f8('0x4b'),_0x27f8('0x65'),_0x27f8('0x66'),_0x27f8('0x67'),_0x27f8('0x47')],'order':qs[_0x27f8('0x38')](_0x27f8('0x68')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x27f8('0x25')](wrapUser(_0x3bcbb1[_0x284346])));}return BPromise['all'](_0x167ea4);}return[];})[_0x27f8('0x25')](function(_0x35b16e){return{'rows':_0x35b16e,'count':_0x35b16e[_0x27f8('0x36')]};})[_0x27f8('0x25')](respondWithResult(_0x48acc1,null))[_0x27f8('0x41')](handleError(_0x48acc1,null));}; \ No newline at end of file +var _0xa4d5=['register','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','update','destroy','then','end','error','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','pick','where','VIRTUAL','filter','options','include','findAll','rows','params','includeAll','find','create','body','catch','describe','get','lastMessageAt','lastMessage','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','admin','user','role','userpic','internal','online','lastLoginAt','showWebBar','-online','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','UserProfileResource','isEmpty','agent','resourceId','push','messages','createdAt','ToId','eml-format','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatInternalMessage.socket'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa4d5,0x1f3));var _0x5a4d=function(_0x3369c5,_0xce66ba){_0x3369c5=_0x3369c5-0x0;var _0x10fae9=_0xa4d5[_0x3369c5];return _0x10fae9;};'use strict';var emlformat=require(_0x5a4d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5a4d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5a4d('0x2'));var moment=require('moment');var BPromise=require(_0x5a4d('0x3'));var Mustache=require(_0x5a4d('0x4'));var util=require('util');var path=require(_0x5a4d('0x5'));var sox=require(_0x5a4d('0x6'));var csv=require(_0x5a4d('0x7'));var ejs=require(_0x5a4d('0x8'));var fs=require('fs');var fs_extra=require(_0x5a4d('0x9'));var _=require(_0x5a4d('0xa'));var squel=require(_0x5a4d('0xb'));var crypto=require(_0x5a4d('0xc'));var jsforce=require(_0x5a4d('0xd'));var deskjs=require(_0x5a4d('0xe'));var toCsv=require(_0x5a4d('0x7'));var querystring=require(_0x5a4d('0xf'));var Papa=require(_0x5a4d('0x10'));var Redis=require(_0x5a4d('0x11'));var authService=require(_0x5a4d('0x12'));var qs=require(_0x5a4d('0x13'));var as=require(_0x5a4d('0x14'));var hardwareService=require(_0x5a4d('0x15'));var logger=require(_0x5a4d('0x16'))(_0x5a4d('0x17'));var utils=require(_0x5a4d('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x5a4d('0x19'));var db=require(_0x5a4d('0x1a'))['db'];config[_0x5a4d('0x1b')]=_[_0x5a4d('0x1c')](config[_0x5a4d('0x1b')],{'host':_0x5a4d('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5a4d('0x1b')]));require(_0x5a4d('0x1e'))[_0x5a4d('0x1f')](socket);function respondWithStatusCode(_0x2293de,_0x14a0e4){_0x14a0e4=_0x14a0e4||0xcc;return function(_0x1a28de){if(_0x1a28de){return _0x2293de[_0x5a4d('0x20')](_0x14a0e4);}return _0x2293de[_0x5a4d('0x21')](_0x14a0e4)['end']();};}function respondWithResult(_0x3f9861,_0x2e85a0){_0x2e85a0=_0x2e85a0||0xc8;return function(_0x118161){if(_0x118161){return _0x3f9861['status'](_0x2e85a0)[_0x5a4d('0x22')](_0x118161);}};}function respondWithFilteredResult(_0x1ebc24,_0x3a1e23){return function(_0x23ca2d){if(_0x23ca2d){var _0x24cd21=typeof _0x3a1e23[_0x5a4d('0x23')]==='undefined'&&typeof _0x3a1e23[_0x5a4d('0x24')]==='undefined';var _0x3d65de=_0x23ca2d['count'];var _0x2fc15c=_0x24cd21?0x0:_0x3a1e23[_0x5a4d('0x23')];var _0x30d4df=_0x24cd21?_0x23ca2d[_0x5a4d('0x25')]:_0x3a1e23[_0x5a4d('0x23')]+_0x3a1e23[_0x5a4d('0x24')];var _0x42a2f2;if(_0x30d4df>=_0x3d65de){_0x30d4df=_0x3d65de;_0x42a2f2=0xc8;}else{_0x42a2f2=0xce;}_0x1ebc24[_0x5a4d('0x21')](_0x42a2f2);return _0x1ebc24[_0x5a4d('0x26')](_0x5a4d('0x27'),_0x2fc15c+'-'+_0x30d4df+'/'+_0x3d65de)[_0x5a4d('0x22')](_0x23ca2d);}return null;};}function patchUpdates(_0x2458fb){return function(_0x276e64){try{jsonpatch[_0x5a4d('0x28')](_0x276e64,_0x2458fb,!![]);}catch(_0x1dd9d0){return BPromise[_0x5a4d('0x29')](_0x1dd9d0);}return _0x276e64['save']();};}function saveUpdates(_0x4e262c,_0x193380){return function(_0xadbded){if(_0xadbded){return _0xadbded[_0x5a4d('0x2a')](_0x4e262c)['then'](function(_0x482b16){return _0x482b16;});}return null;};}function removeEntity(_0x16dfd3,_0x54aa02){return function(_0x5b60e3){if(_0x5b60e3){return _0x5b60e3[_0x5a4d('0x2b')]()[_0x5a4d('0x2c')](function(){_0x16dfd3[_0x5a4d('0x21')](0xcc)[_0x5a4d('0x2d')]();});}};}function handleEntityNotFound(_0x325edb,_0x5e3257){return function(_0x4c8574){if(!_0x4c8574){_0x325edb[_0x5a4d('0x20')](0x194);}return _0x4c8574;};}function handleError(_0x343bfd,_0x48c0c1){_0x48c0c1=_0x48c0c1||0x1f4;return function(_0x58ade6){logger[_0x5a4d('0x2e')](_0x58ade6['stack']);if(_0x58ade6[_0x5a4d('0x2f')]){delete _0x58ade6[_0x5a4d('0x2f')];}_0x343bfd[_0x5a4d('0x21')](_0x48c0c1)[_0x5a4d('0x30')](_0x58ade6);};}exports[_0x5a4d('0x31')]=function(_0xbd61b1,_0x3dbcfa){var _0x46b166={},_0x461e74={},_0x13561f={'count':0x0,'rows':[]};var _0xe202b4=_[_0x5a4d('0x32')](db[_0x5a4d('0x33')][_0x5a4d('0x34')],function(_0x1cfe14){return{'name':_0x1cfe14[_0x5a4d('0x35')],'type':_0x1cfe14[_0x5a4d('0x36')]['key']};});_0x461e74[_0x5a4d('0x37')]=_[_0x5a4d('0x32')](_0xe202b4,_0x5a4d('0x2f'));_0x461e74[_0x5a4d('0x38')]=_[_0x5a4d('0x39')](_0xbd61b1[_0x5a4d('0x38')]);_0x461e74[_0x5a4d('0x3a')]=_[_0x5a4d('0x3b')](_0x461e74[_0x5a4d('0x37')],_0x461e74['query']);_0x46b166[_0x5a4d('0x3c')]=_[_0x5a4d('0x3b')](_0x461e74[_0x5a4d('0x37')],qs[_0x5a4d('0x3d')](_0xbd61b1['query'][_0x5a4d('0x3d')]));_0x46b166['attributes']=_0x46b166['attributes'][_0x5a4d('0x3e')]?_0x46b166['attributes']:_0x461e74[_0x5a4d('0x37')];if(!_0xbd61b1['query']['hasOwnProperty'](_0x5a4d('0x3f'))){_0x46b166[_0x5a4d('0x24')]=qs[_0x5a4d('0x24')](_0xbd61b1[_0x5a4d('0x38')][_0x5a4d('0x24')]);_0x46b166[_0x5a4d('0x23')]=qs['offset'](_0xbd61b1['query'][_0x5a4d('0x23')]);}_0x46b166['order']=qs[_0x5a4d('0x40')](_0xbd61b1[_0x5a4d('0x38')][_0x5a4d('0x40')]);_0x46b166['where']=qs[_0x5a4d('0x3a')](_[_0x5a4d('0x41')](_0xbd61b1[_0x5a4d('0x38')],_0x461e74[_0x5a4d('0x3a')]),_0xe202b4);if(_0xbd61b1[_0x5a4d('0x38')]['filter']){_0x46b166[_0x5a4d('0x42')]=_['merge'](_0x46b166[_0x5a4d('0x42')],{'$or':_[_0x5a4d('0x32')](_0xe202b4,function(_0x29be2c){if(_0x29be2c[_0x5a4d('0x36')]!==_0x5a4d('0x43')){var _0x31d48f={};_0x31d48f[_0x29be2c[_0x5a4d('0x2f')]]={'$like':'%'+_0xbd61b1[_0x5a4d('0x38')][_0x5a4d('0x44')]+'%'};return _0x31d48f;}})});}_0x46b166=_['merge']({},_0x46b166,_0xbd61b1[_0x5a4d('0x45')]);var _0x209c49={'where':_0x46b166[_0x5a4d('0x42')]};return db[_0x5a4d('0x33')][_0x5a4d('0x25')](_0x209c49)['then'](function(_0x2260ad){_0x13561f[_0x5a4d('0x25')]=_0x2260ad;if(_0xbd61b1[_0x5a4d('0x38')]['includeAll']){_0x46b166[_0x5a4d('0x46')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0x5a4d('0x47')](_0x46b166);})[_0x5a4d('0x2c')](function(_0x57c148){_0x13561f[_0x5a4d('0x48')]=_0x57c148;return _0x13561f;})[_0x5a4d('0x2c')](respondWithFilteredResult(_0x3dbcfa,_0x46b166))['catch'](handleError(_0x3dbcfa,null));};exports['show']=function(_0x545d6c,_0x1ea000){var _0x445dfe={'raw':!![],'where':{'id':_0x545d6c[_0x5a4d('0x49')]['id']}},_0x292faf={};_0x292faf[_0x5a4d('0x37')]=_['keys'](db['ChatInternalMessage'][_0x5a4d('0x34')]);_0x292faf[_0x5a4d('0x38')]=_[_0x5a4d('0x39')](_0x545d6c[_0x5a4d('0x38')]);_0x292faf['filters']=_[_0x5a4d('0x3b')](_0x292faf[_0x5a4d('0x37')],_0x292faf[_0x5a4d('0x38')]);_0x445dfe[_0x5a4d('0x3c')]=_[_0x5a4d('0x3b')](_0x292faf[_0x5a4d('0x37')],qs[_0x5a4d('0x3d')](_0x545d6c[_0x5a4d('0x38')][_0x5a4d('0x3d')]));_0x445dfe[_0x5a4d('0x3c')]=_0x445dfe[_0x5a4d('0x3c')]['length']?_0x445dfe[_0x5a4d('0x3c')]:_0x292faf['model'];if(_0x545d6c[_0x5a4d('0x38')][_0x5a4d('0x4a')]){_0x445dfe[_0x5a4d('0x46')]=[{'all':!![]}];}_0x445dfe=_['merge']({},_0x445dfe,_0x545d6c[_0x5a4d('0x45')]);return db[_0x5a4d('0x33')][_0x5a4d('0x4b')](_0x445dfe)[_0x5a4d('0x2c')](handleEntityNotFound(_0x1ea000,null))[_0x5a4d('0x2c')](respondWithResult(_0x1ea000,null))['catch'](handleError(_0x1ea000,null));};exports[_0x5a4d('0x4c')]=function(_0x325250,_0x552f80){return db['ChatInternalMessage'][_0x5a4d('0x4c')](_0x325250[_0x5a4d('0x4d')],{})[_0x5a4d('0x2c')](respondWithResult(_0x552f80,0xc9))['catch'](handleError(_0x552f80,null));};exports['update']=function(_0x9ecdbc,_0x74dbe2){if(_0x9ecdbc[_0x5a4d('0x4d')]['id']){delete _0x9ecdbc[_0x5a4d('0x4d')]['id'];}return db[_0x5a4d('0x33')]['find']({'where':{'id':_0x9ecdbc[_0x5a4d('0x49')]['id']}})['then'](handleEntityNotFound(_0x74dbe2,null))[_0x5a4d('0x2c')](saveUpdates(_0x9ecdbc['body'],null))['then'](respondWithResult(_0x74dbe2,null))[_0x5a4d('0x4e')](handleError(_0x74dbe2,null));};exports[_0x5a4d('0x2b')]=function(_0x312d3b,_0x13a04e){return db[_0x5a4d('0x33')][_0x5a4d('0x4b')]({'where':{'id':_0x312d3b[_0x5a4d('0x49')]['id']}})[_0x5a4d('0x2c')](handleEntityNotFound(_0x13a04e,null))[_0x5a4d('0x2c')](removeEntity(_0x13a04e,null))['catch'](handleError(_0x13a04e,null));};exports[_0x5a4d('0x4f')]=function(_0x1ac9b6,_0x204009){return db[_0x5a4d('0x33')][_0x5a4d('0x4f')]()[_0x5a4d('0x2c')](respondWithResult(_0x204009,null))[_0x5a4d('0x4e')](handleError(_0x204009,null));};function wrapUser(_0x104109){return function(_0x1afb99){var _0x373feb=_0x104109[_0x5a4d('0x50')]({'plain':!![]});_0x373feb['messages']=[];if(_0x1afb99){_0x373feb[_0x5a4d('0x51')]=_0x1afb99['createdAt'];_0x373feb[_0x5a4d('0x52')]=_0x1afb99;}else{_0x373feb['lastMessageAt']=moment(0x0)['format'](_0x5a4d('0x53'));_0x373feb['lastMessage']={};}return _0x373feb;};}exports[_0x5a4d('0x54')]=function(_0x4869fb,_0x14c6f8,_0x29c317){var _0x253b93=[];return db[_0x5a4d('0x55')][_0x5a4d('0x47')]({'where':{'role':['agent',_0x5a4d('0x56'),_0x5a4d('0x57')]},'attributes':['id','fullname',_0x5a4d('0x2f'),_0x5a4d('0x58'),_0x5a4d('0x59'),_0x5a4d('0x5a'),_0x5a4d('0x5b'),_0x5a4d('0x5c'),'allowmessenger',_0x5a4d('0x5d')],'order':qs['sort'](_0x5a4d('0x5e')),'include':[{'model':db['VoiceQueue'],'as':_0x5a4d('0x5f'),'attributes':['id','name',_0x5a4d('0x36')],'through':{'attributes':[]}}]})['then'](function(_0x12d387){if(_0x12d387){var _0xc416fa=_0x4869fb['user'][_0x5a4d('0x50')]({'plain':!![]});if(!_0xc416fa)throw new Error(_0x5a4d('0x60'));if(_0xc416fa[_0x5a4d('0x58')]===_0x5a4d('0x57')){return db['UserProfileSection'][_0x5a4d('0x4b')]({'where':{'name':_0x5a4d('0x61'),'userProfileId':_0xc416fa['userProfileId']},'raw':!![]})[_0x5a4d('0x2c')](function(_0x5577f8){if(_0x5577f8){if(_0x5577f8['autoAssociation']===0x0){return db[_0x5a4d('0x62')][_0x5a4d('0x47')]({'where':{'sectionId':_0x5577f8['id']},'raw':!![]})[_0x5a4d('0x2c')](function(_0x1ccafc){var _0x26b9e7=[];if(_[_0x5a4d('0x63')](_0x1ccafc)){_0x26b9e7=_[_0x5a4d('0x44')](_0x12d387,function(_0x3cfc31){if(_0x3cfc31[_0x5a4d('0x58')]!=='agent'){return _0x3cfc31;}});return _0x26b9e7;}else{for(var _0x297280=0x0;_0x297280<_0x12d387[_0x5a4d('0x3e')];_0x297280++){var _0x2bebf1=_0x12d387[_0x297280];if(_0x2bebf1[_0x5a4d('0x58')]===_0x5a4d('0x64')){var _0x90d312=_['find'](_0x1ccafc,function(_0x5ac6dc){return _0x5ac6dc[_0x5a4d('0x65')]===_0x2bebf1['id'];});if(_0x90d312)_0x26b9e7[_0x5a4d('0x66')](_0x2bebf1);}else{_0x26b9e7[_0x5a4d('0x66')](_0x2bebf1);}}return _0x26b9e7;}});}else{return _0x12d387;}}else{var _0x429dd4=_['filter'](_0x12d387,function(_0x3b5819){if(_0x3b5819['role']!==_0x5a4d('0x64')){return _0x3b5819;}});return _0x429dd4;}});}else{return _0x12d387;}}})[_0x5a4d('0x2c')](function(_0x591a53){var _0x31caae=[];if(_0x591a53){_0x253b93=_0x591a53;for(var _0x520f24=0x0;_0x520f24<_0x591a53['length'];_0x520f24+=0x1){_0x253b93[_0x520f24][_0x5a4d('0x67')]=[];_0x31caae[_0x5a4d('0x66')](db[_0x5a4d('0x33')][_0x5a4d('0x4b')]({'where':{'FromId':[_0x4869fb['user']['id'],_0x591a53[_0x520f24]['id']],'ToId':[_0x4869fb[_0x5a4d('0x57')]['id'],_0x591a53[_0x520f24]['id']],'ChatGroupId':null},'attributes':['id',_0x5a4d('0x68'),'FromId',_0x5a4d('0x69'),'read',_0x5a4d('0x4d')],'order':qs[_0x5a4d('0x40')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x5a4d('0x2c')](wrapUser(_0x591a53[_0x520f24])));}return BPromise['all'](_0x31caae);}return[];})[_0x5a4d('0x2c')](function(_0x5e0101){return{'rows':_0x5e0101,'count':_0x5e0101[_0x5a4d('0x3e')]};})['then'](respondWithResult(_0x14c6f8,null))['catch'](handleError(_0x14c6f8,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index eafee73..0dcc7e9 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 _0x0ca9=['exports','events','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x1f11e1,_0xd4457){var _0x205483=function(_0x27f7ba){while(--_0x27f7ba){_0x1f11e1['push'](_0x1f11e1['shift']());}};_0x205483(++_0xd4457);}(_0x0ca9,0x99));var _0x90ca=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0ca9[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x90ca('0x0'));var ChatInternalMessage=require(_0x90ca('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x90ca('0x2')](0x0);var events={'afterCreate':_0x90ca('0x3'),'afterUpdate':_0x90ca('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5de2ae){return function(_0x5e0176,_0xd0d745,_0x1e2a91){ChatInternalMessageEvents[_0x90ca('0x5')](_0x5de2ae+':'+_0x5e0176['id'],_0x5e0176);ChatInternalMessageEvents[_0x90ca('0x5')](_0x5de2ae,_0x5e0176);_0x1e2a91(null);};}for(var e in events){if(events[_0x90ca('0x6')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x90ca('0x7')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x0490=['events','ChatInternalMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x5628b8,_0x145582){var _0x3ce423=function(_0x114c97){while(--_0x114c97){_0x5628b8['push'](_0x5628b8['shift']());}};_0x3ce423(++_0x145582);}(_0x0490,0x14d));var _0x0049=function(_0x1464f3,_0x7e1fd7){_0x1464f3=_0x1464f3-0x0;var _0x5730f8=_0x0490[_0x1464f3];return _0x5730f8;};'use strict';var EventEmitter=require(_0x0049('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0x0049('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x0049('0x2')](0x0);var events={'afterCreate':_0x0049('0x3'),'afterUpdate':_0x0049('0x4'),'afterDestroy':_0x0049('0x5')};function emitEvent(_0x3a6ba7){return function(_0x3e2b3c,_0x503c9a,_0x1878d2){ChatInternalMessageEvents[_0x0049('0x6')](_0x3a6ba7+':'+_0x3e2b3c['id'],_0x3e2b3c);ChatInternalMessageEvents[_0x0049('0x6')](_0x3a6ba7,_0x3e2b3c);_0x1878d2(null);};}for(var e in events){if(events[_0x0049('0x7')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x0049('0x8')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 1e37049..9945278 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 _0x94ab=['ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatInternalMessage.attributes','exports'];(function(_0x3fcc20,_0x57c31b){var _0x15d3ce=function(_0x575619){while(--_0x575619){_0x3fcc20['push'](_0x3fcc20['shift']());}};_0x15d3ce(++_0x57c31b);}(_0x94ab,0x7c));var _0xb94a=function(_0x17da1b,_0x3db616){_0x17da1b=_0x17da1b-0x0;var _0x1bc8ca=_0x94ab[_0x17da1b];return _0x1bc8ca;};'use strict';var _=require(_0xb94a('0x0'));var util=require(_0xb94a('0x1'));var logger=require(_0xb94a('0x2'))(_0xb94a('0x3'));var moment=require(_0xb94a('0x4'));var BPromise=require(_0xb94a('0x5'));var rp=require(_0xb94a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb94a('0x7'));var config=require(_0xb94a('0x8'));var attributes=require(_0xb94a('0x9'));module[_0xb94a('0xa')]=function(_0x4f1f98,_0x4e30d9){return _0x4f1f98['define'](_0xb94a('0xb'),attributes,{'tableName':_0xb94a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb94a('0xd'),'collate':_0xb94a('0xe')});}; \ No newline at end of file +var _0xeb10=['bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api'];(function(_0x29d132,_0x545dcf){var _0x161e31=function(_0x32ddb6){while(--_0x32ddb6){_0x29d132['push'](_0x29d132['shift']());}};_0x161e31(++_0x545dcf);}(_0xeb10,0x147));var _0x0eb1=function(_0x3fb8a9,_0x112ea9){_0x3fb8a9=_0x3fb8a9-0x0;var _0x33fe3b=_0xeb10[_0x3fb8a9];return _0x33fe3b;};'use strict';var _=require(_0x0eb1('0x0'));var util=require('util');var logger=require(_0x0eb1('0x1'))(_0x0eb1('0x2'));var moment=require('moment');var BPromise=require(_0x0eb1('0x3'));var rp=require(_0x0eb1('0x4'));var fs=require('fs');var path=require(_0x0eb1('0x5'));var rimraf=require(_0x0eb1('0x6'));var config=require(_0x0eb1('0x7'));var attributes=require(_0x0eb1('0x8'));module[_0x0eb1('0x9')]=function(_0x45ff24,_0x11e765){return _0x45ff24[_0x0eb1('0xa')](_0x0eb1('0xb'),attributes,{'tableName':_0x0eb1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0eb1('0xd'),'collate':_0x0eb1('0xe')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 962ff5b..09f73c8 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 _0x7de4=['ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','defaults','redis','socket.io-emitter','./chatInternalMessage.socket','register','request','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x16629d,_0x492375){var _0x56ccee=function(_0xa982b7){while(--_0xa982b7){_0x16629d['push'](_0x16629d['shift']());}};_0x56ccee(++_0x492375);}(_0x7de4,0xb4));var _0x47de=function(_0x49ee1d,_0x5d8938){_0x49ee1d=_0x49ee1d-0x0;var _0x2af3ed=_0x7de4[_0x49ee1d];return _0x2af3ed;};'use strict';var _=require(_0x47de('0x0'));var util=require('util');var moment=require(_0x47de('0x1'));var BPromise=require(_0x47de('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x47de('0x3'));var db=require(_0x47de('0x4'))['db'];var utils=require(_0x47de('0x5'));var logger=require(_0x47de('0x6'))(_0x47de('0x7'));var config=require(_0x47de('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x47de('0x9')]({'port':0x232a});config['redis']=_[_0x47de('0xa')](config[_0x47de('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x47de('0xc'))(new Redis(config[_0x47de('0xb')]));require(_0x47de('0xd'))[_0x47de('0xe')](socket);function respondWithRpcPromise(_0x1aeb62,_0x52a64c,_0x533eb5){return new BPromise(function(_0x3ce7b2,_0x54cded){return client[_0x47de('0xf')](_0x1aeb62,_0x533eb5)['then'](function(_0xaaa70c){logger[_0x47de('0x10')](_0x47de('0x11'),_0x52a64c,_0x47de('0x12'));logger[_0x47de('0x13')](_0x47de('0x14'),_0x52a64c,'request\x20sent',JSON['stringify'](_0xaaa70c));if(_0xaaa70c[_0x47de('0x15')]){if(_0xaaa70c[_0x47de('0x15')][_0x47de('0x16')]===0x1f4){logger[_0x47de('0x15')](_0x47de('0x11'),_0x52a64c,_0xaaa70c['error'][_0x47de('0x17')]);return _0x54cded(_0xaaa70c[_0x47de('0x15')][_0x47de('0x17')]);}logger[_0x47de('0x15')](_0x47de('0x11'),_0x52a64c,_0xaaa70c['error'][_0x47de('0x17')]);return _0x3ce7b2(_0xaaa70c[_0x47de('0x15')][_0x47de('0x17')]);}else{logger['info'](_0x47de('0x11'),_0x52a64c,_0x47de('0x12'));_0x3ce7b2(_0xaaa70c[_0x47de('0x18')][_0x47de('0x17')]);}})['catch'](function(_0x3b3c82){logger[_0x47de('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x52a64c,_0x3b3c82);_0x54cded(_0x3b3c82);});});} \ No newline at end of file +var _0x4874=['result','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','defaults','localhost','socket.io-emitter','redis','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x3b35ff,_0x1f5e62){var _0x2f737c=function(_0x58ff61){while(--_0x58ff61){_0x3b35ff['push'](_0x3b35ff['shift']());}};_0x2f737c(++_0x1f5e62);}(_0x4874,0x17b));var _0x4487=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x4874[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var util=require(_0x4487('0x0'));var moment=require(_0x4487('0x1'));var BPromise=require(_0x4487('0x2'));var rs=require(_0x4487('0x3'));var fs=require('fs');var Redis=require(_0x4487('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4487('0x5'));var logger=require(_0x4487('0x6'))('rpc');var config=require(_0x4487('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4487('0x8')][_0x4487('0x9')]({'port':0x232a});config['redis']=_[_0x4487('0xa')](config['redis'],{'host':_0x4487('0xb'),'port':0x18eb});var socket=require(_0x4487('0xc'))(new Redis(config[_0x4487('0xd')]));require(_0x4487('0xe'))[_0x4487('0xf')](socket);function respondWithRpcPromise(_0x2165b7,_0x1ed07f,_0x646303){return new BPromise(function(_0x4f2a37,_0x43fc17){return client[_0x4487('0x10')](_0x2165b7,_0x646303)[_0x4487('0x11')](function(_0x58811a){logger[_0x4487('0x12')](_0x4487('0x13'),_0x1ed07f,_0x4487('0x14'));logger[_0x4487('0x15')](_0x4487('0x16'),_0x1ed07f,_0x4487('0x14'),JSON['stringify'](_0x58811a));if(_0x58811a[_0x4487('0x17')]){if(_0x58811a[_0x4487('0x17')][_0x4487('0x18')]===0x1f4){logger[_0x4487('0x17')](_0x4487('0x13'),_0x1ed07f,_0x58811a[_0x4487('0x17')][_0x4487('0x19')]);return _0x43fc17(_0x58811a[_0x4487('0x17')]['message']);}logger[_0x4487('0x17')](_0x4487('0x13'),_0x1ed07f,_0x58811a[_0x4487('0x17')][_0x4487('0x19')]);return _0x4f2a37(_0x58811a['error'][_0x4487('0x19')]);}else{logger[_0x4487('0x12')](_0x4487('0x13'),_0x1ed07f,_0x4487('0x14'));_0x4f2a37(_0x58811a[_0x4487('0x1a')][_0x4487('0x19')]);}})['catch'](function(_0x24c7e2){logger[_0x4487('0x17')](_0x4487('0x13'),_0x1ed07f,_0x24c7e2);_0x43fc17(_0x24c7e2);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 48648d3..4f0b9b1 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 _0x73a1=['update','emit','removeListener','register','chatInternalMessage:','save','remove'];(function(_0x3f7854,_0x58eeae){var _0x119409=function(_0xc2d98e){while(--_0xc2d98e){_0x3f7854['push'](_0x3f7854['shift']());}};_0x119409(++_0x58eeae);}(_0x73a1,0x83));var _0x173a=function(_0x5e3701,_0x596265){_0x5e3701=_0x5e3701-0x0;var _0x345dcf=_0x73a1[_0x5e3701];return _0x345dcf;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x173a('0x0'),_0x173a('0x1'),_0x173a('0x2')];function createListener(_0x51b0ce,_0x3c4e86){return function(_0x21c93f){_0x3c4e86[_0x173a('0x3')](_0x51b0ce,_0x21c93f);};}function removeListener(_0x28bab5,_0x14e7e0){return function(){ChatInternalMessageEvents[_0x173a('0x4')](_0x28bab5,_0x14e7e0);};}exports[_0x173a('0x5')]=function(_0x4e5915){for(var _0x57480e=0x0,_0x337c01=events['length'];_0x57480e<_0x337c01;_0x57480e++){var _0x41b677=events[_0x57480e];var _0x2fc183=createListener(_0x173a('0x6')+_0x41b677,_0x4e5915);ChatInternalMessageEvents['on'](_0x41b677,_0x2fc183);}}; \ No newline at end of file +var _0x69cb=['emit','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','save'];(function(_0x5f5769,_0x20bcd4){var _0x1c5f91=function(_0x59fcae){while(--_0x59fcae){_0x5f5769['push'](_0x5f5769['shift']());}};_0x1c5f91(++_0x20bcd4);}(_0x69cb,0x11d));var _0xb69c=function(_0x253b45,_0x32b9da){_0x253b45=_0x253b45-0x0;var _0x3e1947=_0x69cb[_0x253b45];return _0x3e1947;};'use strict';var ChatInternalMessageEvents=require(_0xb69c('0x0'));var events=[_0xb69c('0x1'),'remove','update'];function createListener(_0x40c987,_0x2c10c3){return function(_0x15b8ad){_0x2c10c3[_0xb69c('0x2')](_0x40c987,_0x15b8ad);};}function removeListener(_0x4e851f,_0x144579){return function(){ChatInternalMessageEvents[_0xb69c('0x3')](_0x4e851f,_0x144579);};}exports[_0xb69c('0x4')]=function(_0x1d88ef){for(var _0x4a5818=0x0,_0x56419=events[_0xb69c('0x5')];_0x4a5818<_0x56419;_0x4a5818++){var _0x7dfd33=events[_0x4a5818];var _0x2328fb=createListener(_0xb69c('0x6')+_0x7dfd33,_0x1d88ef);ChatInternalMessageEvents['on'](_0x7dfd33,_0x2328fb);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 921a69f..ea2dd60 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 _0x94e3=['Router','fs-extra','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','/users','getUsers','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0xe2b9bf,_0x567caf){var _0x3a5d23=function(_0x1a3765){while(--_0x1a3765){_0xe2b9bf['push'](_0xe2b9bf['shift']());}};_0x3a5d23(++_0x567caf);}(_0x94e3,0x1c4));var _0x394e=function(_0x10ebe3,_0x44f9d5){_0x10ebe3=_0x10ebe3-0x0;var _0x269243=_0x94e3[_0x10ebe3];return _0x269243;};'use strict';var multer=require(_0x394e('0x0'));var util=require(_0x394e('0x1'));var path=require('path');var timeout=require(_0x394e('0x2'));var express=require(_0x394e('0x3'));var router=express[_0x394e('0x4')]();var fs_extra=require(_0x394e('0x5'));var auth=require(_0x394e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x394e('0x7'));var controller=require(_0x394e('0x8'));router[_0x394e('0x9')]('/',auth[_0x394e('0xa')](),controller[_0x394e('0xb')]);router[_0x394e('0x9')](_0x394e('0xc'),auth[_0x394e('0xa')](),controller['describe']);router[_0x394e('0x9')](_0x394e('0xd'),auth[_0x394e('0xa')](),controller[_0x394e('0xe')]);router['get'](_0x394e('0xf'),auth[_0x394e('0xa')](),controller[_0x394e('0x10')]);router[_0x394e('0x11')]('/',auth[_0x394e('0xa')](),controller[_0x394e('0x12')]);router[_0x394e('0x13')](_0x394e('0xf'),controller[_0x394e('0x14')]);router[_0x394e('0x15')]('/:id',auth[_0x394e('0xa')](),controller[_0x394e('0x16')]);module[_0x394e('0x17')]=router; \ No newline at end of file +var _0x397d=['/users','getUsers','/:id','show','post','create','put','update','delete','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0x397d,0xb9));var _0xd397=function(_0x5b13be,_0x470b8c){_0x5b13be=_0x5b13be-0x0;var _0x118500=_0x397d[_0x5b13be];return _0x118500;};'use strict';var multer=require(_0xd397('0x0'));var util=require(_0xd397('0x1'));var path=require(_0xd397('0x2'));var timeout=require('connect-timeout');var express=require(_0xd397('0x3'));var router=express[_0xd397('0x4')]();var fs_extra=require(_0xd397('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd397('0x6'));var config=require(_0xd397('0x7'));var controller=require('./chatInternalMessage.controller');router[_0xd397('0x8')]('/',auth['isAuthenticated'](),controller[_0xd397('0x9')]);router[_0xd397('0x8')](_0xd397('0xa'),auth[_0xd397('0xb')](),controller[_0xd397('0xc')]);router[_0xd397('0x8')](_0xd397('0xd'),auth[_0xd397('0xb')](),controller[_0xd397('0xe')]);router[_0xd397('0x8')](_0xd397('0xf'),auth[_0xd397('0xb')](),controller[_0xd397('0x10')]);router[_0xd397('0x11')]('/',auth[_0xd397('0xb')](),controller[_0xd397('0x12')]);router[_0xd397('0x13')](_0xd397('0xf'),controller[_0xd397('0x14')]);router[_0xd397('0x15')](_0xd397('0xf'),auth[_0xd397('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 166f8a4..0838971 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 _0x80cd=['BOOLEAN','ENUM','out','STRING','exports','TEXT','medium'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x80cd,0x146));var _0xd80c=function(_0x12d6c2,_0x409bc8){_0x12d6c2=_0x12d6c2-0x0;var _0x1c9825=_0x80cd[_0x12d6c2];return _0x1c9825;};'use strict';var Sequelize=require('sequelize');module[_0xd80c('0x0')]={'body':{'type':Sequelize[_0xd80c('0x1')](_0xd80c('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xd80c('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xd80c('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd80c('0x4')]('in',_0xd80c('0x5')),'defaultValue':_0xd80c('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xd80c('0x6')]},'providerResponse':{'type':Sequelize[_0xd80c('0x1')]}}; \ No newline at end of file +var _0x1d21=['sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x34a8c8,_0x31e259){var _0x1fe6e5=function(_0x30f28d){while(--_0x30f28d){_0x34a8c8['push'](_0x34a8c8['shift']());}};_0x1fe6e5(++_0x31e259);}(_0x1d21,0x158));var _0x11d2=function(_0x28e2cd,_0x153b42){_0x28e2cd=_0x28e2cd-0x0;var _0x11fd46=_0x1d21[_0x28e2cd];return _0x11fd46;};'use strict';var Sequelize=require(_0x11d2('0x0'));module[_0x11d2('0x1')]={'body':{'type':Sequelize[_0x11d2('0x2')](_0x11d2('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x11d2('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x11d2('0x5')]('in',_0x11d2('0x6')),'defaultValue':_0x11d2('0x6'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x11d2('0x7')]},'providerResponse':{'type':Sequelize[_0x11d2('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index d4d4b7a..5ecc023 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 _0xa9e0=['interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','contact','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','parse','formData','chat-interactions','chat','ChatInteraction','RejectMessage','rejectMessage','Sequelize','QueryTypes','SELECT','fullname','rejectmessage','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatMessage.socket','register','jayson/promise','client','http','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','stack','name','send','map','ChatMessage','fieldName','type','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','body','find','describe','../../config/logger','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','ChatInteractionId','isNil','read1stAt','format'];(function(_0x4f50aa,_0x4f0efd){var _0x4a675b=function(_0x43559d){while(--_0x43559d){_0x4f50aa['push'](_0x4f50aa['shift']());}};_0x4a675b(++_0x4f0efd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];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);var jayson=require(_0x0a9e('0x1a'));var client=jayson[_0x0a9e('0x1b')][_0x0a9e('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0x0a9e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x5d0880,_0x1985b6,_0x519dfd,_0x16033c){return new BPromise(function(_0x12066b,_0x48f32d){var _0x225616=_0x16033c||client;return _0x225616['request'](_0x5d0880,_0x519dfd)[_0x0a9e('0x1d')](function(_0x478723){logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x1985b6,_0x0a9e('0x20'));logger[_0x0a9e('0x21')](_0x0a9e('0x22'),_0x1985b6,_0x0a9e('0x20'),JSON[_0x0a9e('0x23')](_0x478723));if(_0x478723[_0x0a9e('0x24')]){if(_0x478723[_0x0a9e('0x24')][_0x0a9e('0x25')]===0x1f4){logger['error'](_0x0a9e('0x1f'),_0x1985b6,_0x478723[_0x0a9e('0x24')]['message']);return _0x48f32d(_0x478723[_0x0a9e('0x24')]['message']);}logger['error'](_0x0a9e('0x1f'),_0x1985b6,_0x478723[_0x0a9e('0x24')][_0x0a9e('0x26')]);return _0x12066b(_0x478723[_0x0a9e('0x24')]['message']);}else{logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x1985b6,_0x0a9e('0x20'));_0x12066b(_0x478723[_0x0a9e('0x27')][_0x0a9e('0x26')]);}})[_0x0a9e('0x28')](function(_0x16b1ca){logger['error']('ChatMessage,\x20%s,\x20%s',_0x1985b6,_0x16b1ca);_0x48f32d(_0x16b1ca);});});}function respondWithStatusCode(_0x197ec0,_0x3a8e58){_0x3a8e58=_0x3a8e58||0xcc;return function(_0x40c424){if(_0x40c424){return _0x197ec0[_0x0a9e('0x29')](_0x3a8e58);}return _0x197ec0['status'](_0x3a8e58)[_0x0a9e('0x2a')]();};}function respondWithResult(_0x479bc4,_0x45a1e7){_0x45a1e7=_0x45a1e7||0xc8;return function(_0x5bfb33){if(_0x5bfb33){return _0x479bc4[_0x0a9e('0x2b')](_0x45a1e7)[_0x0a9e('0x2c')](_0x5bfb33);}};}function respondWithFilteredResult(_0x25fba9,_0x14433c){return function(_0x140511){if(_0x140511){var _0x1538a4=typeof _0x14433c[_0x0a9e('0x2d')]===_0x0a9e('0x2e')&&typeof _0x14433c['limit']===_0x0a9e('0x2e');var _0x468813=_0x140511[_0x0a9e('0x2f')];var _0x2ec755=_0x1538a4?0x0:_0x14433c['offset'];var _0x15b200=_0x1538a4?_0x140511[_0x0a9e('0x2f')]:_0x14433c[_0x0a9e('0x2d')]+_0x14433c[_0x0a9e('0x30')];var _0x58b06f;if(_0x15b200>=_0x468813){_0x15b200=_0x468813;_0x58b06f=0xc8;}else{_0x58b06f=0xce;}_0x25fba9[_0x0a9e('0x2b')](_0x58b06f);return _0x25fba9[_0x0a9e('0x31')](_0x0a9e('0x32'),_0x2ec755+'-'+_0x15b200+'/'+_0x468813)[_0x0a9e('0x2c')](_0x140511);}return null;};}function patchUpdates(_0x540530){return function(_0x426950){try{jsonpatch['apply'](_0x426950,_0x540530,!![]);}catch(_0x2407f9){return BPromise[_0x0a9e('0x33')](_0x2407f9);}return _0x426950[_0x0a9e('0x34')]();};}function saveUpdates(_0x33bdb7,_0x25ce3a){return function(_0x5180f1){if(_0x5180f1){return _0x5180f1[_0x0a9e('0x35')](_0x33bdb7)[_0x0a9e('0x1d')](function(_0x40cb85){return _0x40cb85;});}return null;};}function removeEntity(_0x2da5c0,_0x2b45ea){return function(_0x409319){if(_0x409319){return _0x409319[_0x0a9e('0x36')]()[_0x0a9e('0x1d')](function(){_0x2da5c0['status'](0xcc)[_0x0a9e('0x2a')]();});}};}function handleEntityNotFound(_0x5e7238,_0x2cc7a0){return function(_0x14b13f){if(!_0x14b13f){_0x5e7238[_0x0a9e('0x29')](0x194);}return _0x14b13f;};}function handleError(_0x3f3d41,_0x567193){_0x567193=_0x567193||0x1f4;return function(_0x191e91){logger[_0x0a9e('0x24')](_0x191e91[_0x0a9e('0x37')]);if(_0x191e91[_0x0a9e('0x38')]){delete _0x191e91['name'];}_0x3f3d41['status'](_0x567193)[_0x0a9e('0x39')](_0x191e91);};}exports['index']=function(_0x24936a,_0x3d9717){var _0x381c37={},_0x1ef87a={},_0x4f41ae={'count':0x0,'rows':[]};var _0x31916f=_[_0x0a9e('0x3a')](db[_0x0a9e('0x3b')]['rawAttributes'],function(_0x1dbf74){return{'name':_0x1dbf74[_0x0a9e('0x3c')],'type':_0x1dbf74[_0x0a9e('0x3d')]['key']};});_0x1ef87a['model']=_[_0x0a9e('0x3a')](_0x31916f,_0x0a9e('0x38'));_0x1ef87a['query']=_[_0x0a9e('0x3e')](_0x24936a[_0x0a9e('0x3f')]);_0x1ef87a[_0x0a9e('0x40')]=_[_0x0a9e('0x41')](_0x1ef87a['model'],_0x1ef87a['query']);_0x381c37[_0x0a9e('0x42')]=_[_0x0a9e('0x41')](_0x1ef87a['model'],qs[_0x0a9e('0x43')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x381c37['attributes']=_0x381c37[_0x0a9e('0x42')][_0x0a9e('0x44')]?_0x381c37[_0x0a9e('0x42')]:_0x1ef87a[_0x0a9e('0x45')];if(!_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x46')](_0x0a9e('0x47'))){_0x381c37[_0x0a9e('0x30')]=qs[_0x0a9e('0x30')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x30')]);_0x381c37[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x2d')]);}_0x381c37['order']=qs['sort'](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x48')]);_0x381c37[_0x0a9e('0x49')]=qs[_0x0a9e('0x40')](_[_0x0a9e('0x4a')](_0x24936a[_0x0a9e('0x3f')],_0x1ef87a[_0x0a9e('0x40')]),_0x31916f);if(_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4b')]){_0x381c37[_0x0a9e('0x49')]=_[_0x0a9e('0x4c')](_0x381c37[_0x0a9e('0x49')],{'$or':_['map'](_0x31916f,function(_0x117c99){if(_0x117c99[_0x0a9e('0x3d')]!==_0x0a9e('0x4d')){var _0xfbd5ad={};_0xfbd5ad[_0x117c99[_0x0a9e('0x38')]]={'$like':'%'+_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4b')]+'%'};return _0xfbd5ad;}})});}_0x381c37=_[_0x0a9e('0x4c')]({},_0x381c37,_0x24936a['options']);var _0x2e9d90={'where':_0x381c37['where']};return db[_0x0a9e('0x3b')][_0x0a9e('0x2f')](_0x2e9d90)[_0x0a9e('0x1d')](function(_0x562fb4){_0x4f41ae[_0x0a9e('0x2f')]=_0x562fb4;if(_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4e')]){_0x381c37[_0x0a9e('0x4f')]=[{'all':!![]}];}return db[_0x0a9e('0x3b')][_0x0a9e('0x50')](_0x381c37);})[_0x0a9e('0x1d')](function(_0x5bbcde){_0x4f41ae[_0x0a9e('0x51')]=_0x5bbcde;return _0x4f41ae;})[_0x0a9e('0x1d')](respondWithFilteredResult(_0x3d9717,_0x381c37))[_0x0a9e('0x28')](handleError(_0x3d9717,null));};exports[_0x0a9e('0x52')]=function(_0x409789,_0x992c77){var _0x6054ee={'raw':!![],'where':{'id':_0x409789[_0x0a9e('0x53')]['id']}},_0x19383e={};_0x19383e['model']=_[_0x0a9e('0x3e')](db[_0x0a9e('0x3b')]['rawAttributes']);_0x19383e['query']=_['keys'](_0x409789[_0x0a9e('0x3f')]);_0x19383e[_0x0a9e('0x40')]=_[_0x0a9e('0x41')](_0x19383e[_0x0a9e('0x45')],_0x19383e[_0x0a9e('0x3f')]);_0x6054ee[_0x0a9e('0x42')]=_[_0x0a9e('0x41')](_0x19383e[_0x0a9e('0x45')],qs['fields'](_0x409789['query']['fields']));_0x6054ee[_0x0a9e('0x42')]=_0x6054ee[_0x0a9e('0x42')][_0x0a9e('0x44')]?_0x6054ee['attributes']:_0x19383e[_0x0a9e('0x45')];if(_0x409789[_0x0a9e('0x3f')]['includeAll']){_0x6054ee['include']=[{'all':!![]}];}_0x6054ee=_[_0x0a9e('0x4c')]({},_0x6054ee,_0x409789['options']);return db[_0x0a9e('0x3b')]['find'](_0x6054ee)[_0x0a9e('0x1d')](handleEntityNotFound(_0x992c77,null))[_0x0a9e('0x1d')](respondWithResult(_0x992c77,null))[_0x0a9e('0x28')](handleError(_0x992c77,null));};exports['create']=function(_0x2f82da,_0x1bf38a){return db['ChatMessage']['create'](_0x2f82da[_0x0a9e('0x54')],{})[_0x0a9e('0x1d')](respondWithResult(_0x1bf38a,0xc9))['catch'](handleError(_0x1bf38a,null));};exports[_0x0a9e('0x35')]=function(_0x5ce9ac,_0x211ef9){if(_0x5ce9ac['body']['id']){delete _0x5ce9ac[_0x0a9e('0x54')]['id'];}return db['ChatMessage']['find']({'where':{'id':_0x5ce9ac['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x211ef9,null))['then'](saveUpdates(_0x5ce9ac[_0x0a9e('0x54')],null))[_0x0a9e('0x1d')](respondWithResult(_0x211ef9,null))[_0x0a9e('0x28')](handleError(_0x211ef9,null));};exports[_0x0a9e('0x36')]=function(_0x232830,_0x272738){return db[_0x0a9e('0x3b')][_0x0a9e('0x55')]({'where':{'id':_0x232830['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x272738,null))[_0x0a9e('0x1d')](removeEntity(_0x272738,null))[_0x0a9e('0x28')](handleError(_0x272738,null));};exports[_0x0a9e('0x56')]=function(_0xb83dfd,_0x156662){return db['ChatMessage'][_0x0a9e('0x56')]()[_0x0a9e('0x1d')](respondWithResult(_0x156662,null))['catch'](handleError(_0x156662,null));};var interaction_log=require(_0x0a9e('0x57'))('chat-interactions');exports[_0x0a9e('0x58')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee){var _0x273cb5={'agent':{},'channel':'chat'};if(_0x5ba1f9[_0x0a9e('0x54')]['id']){delete _0x5ba1f9[_0x0a9e('0x54')]['id'];}_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x59')]=!![];_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5a')]=moment()['format'](_0x0a9e('0x5b'));_0x5ba1f9['body'][_0x0a9e('0x5c')]=_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')]||_0x5ba1f9['user']['id'];_0x273cb5[_0x0a9e('0x5d')]['id']=_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x5ba1f9[_0x0a9e('0x53')]['id'],'UserId':null}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4b3c1a,null))['then'](saveUpdates(_0x5ba1f9[_0x0a9e('0x54')],null))[_0x0a9e('0x1d')](function(_0x88dcbf){if(_0x88dcbf){_0x273cb5[_0x0a9e('0x26')]=_0x88dcbf[_0x0a9e('0x5e')]({'plain':!![]});return db['ChatInteraction'][_0x0a9e('0x55')]({'where':{'id':_0x88dcbf[_0x0a9e('0x5f')]}});}return null;})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4b3c1a,null))['then'](function(_0x3528b7){if(_0x3528b7){return _0x3528b7['update']({'UserId':_0x5ba1f9['body'][_0x0a9e('0x5c')],'read1stAt':_[_0x0a9e('0x60')](_0x3528b7[_0x0a9e('0x61')])?moment()[_0x0a9e('0x62')](_0x0a9e('0x5b')):undefined});}return null;})[_0x0a9e('0x1d')](function(_0x387489){if(_0x387489){_0x273cb5[_0x0a9e('0x63')]=_0x387489[_0x0a9e('0x5e')]({'plain':!![]});interaction_log[_0x0a9e('0x1e')](_0x0a9e('0x64'),_0x5ba1f9[_0x0a9e('0x65')]['id'],_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x38')],_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x66')],_0x273cb5[_0x0a9e('0x63')]['id'],_0x5ba1f9[_0x0a9e('0x54')]?JSON['stringify'](_0x5ba1f9[_0x0a9e('0x54')]):_0x0a9e('0x67'));return respondWithRpcPromise(_0x0a9e('0x68'),'acceptMessage',_0x273cb5);}return null;})[_0x0a9e('0x1d')](function(_0x30944e){var _0x4b341d=_0x0a9e('0x69')+_0x30944e[_0x0a9e('0x26')][_0x0a9e('0x6a')];return db[_0x0a9e('0x6b')][_0x0a9e('0x3f')](_0x4b341d,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x0a9e('0x1d')](function(_0x18bf5d){return _0x18bf5d;});})[_0x0a9e('0x1d')](function(_0x23a7d3){if(_0x23a7d3){_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x6c')]=_0x23a7d3[0x0];if(!_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')])return;return db['User'][_0x0a9e('0x55')]({'where':{'id':_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')],'role':'agent'},'attributes':['id',_0x0a9e('0x38'),'fullname',_0x0a9e('0x6d'),_0x0a9e('0x6e')],'raw':!![]});}return null;})['then'](function(_0x2ed01e){if(!_0x2ed01e)return null;_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x5d')]=_0x2ed01e;return _0x273cb5;})[_0x0a9e('0x1d')](function(_0x542ece){if(_0x542ece){if(_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x6f')]){_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x70')]=util['format'](_0x0a9e('0x71'),_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x38')]);_0x273cb5[_0x0a9e('0x26')]['channel']=_0x273cb5[_0x0a9e('0x72')];_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x73')]=_0x0a9e('0x58');return respondWithRpcPromise(_0x0a9e('0x74'),_0x0a9e('0x74'),{'event':_0x0a9e('0x75'),'message':_[_0x0a9e('0x4c')](_0x273cb5[_0x0a9e('0x26')],JSON[_0x0a9e('0x76')](_0x273cb5[_0x0a9e('0x63')][_0x0a9e('0x77')]))},client9002)[_0x0a9e('0x1d')](function(){return _0x273cb5;});}return _0x273cb5;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x4b3c1a,null))['catch'](handleError(_0x4b3c1a,null));};var interaction_log=require(_0x0a9e('0x57'))(_0x0a9e('0x78'));exports[_0x0a9e('0x33')]=function(_0x563627,_0x3736e0,_0x33dda0){var _0x8cea96={'agent':{},'channel':_0x0a9e('0x79')};if(_0x563627['body']['id']){delete _0x563627['body']['id'];}_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')]=_0x563627['body'][_0x0a9e('0x5c')]||_0x563627['user']['id'];_0x8cea96[_0x0a9e('0x5d')]['id']=_0x563627[_0x0a9e('0x54')]['UserId'];return db[_0x0a9e('0x3b')][_0x0a9e('0x55')]({'where':{'id':_0x563627[_0x0a9e('0x53')]['id'],'UserId':null}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x3736e0,null))[_0x0a9e('0x1d')](function(_0x1f42a0){if(_0x1f42a0){_0x8cea96[_0x0a9e('0x26')]=_0x1f42a0['get']({'plain':!![]});return db[_0x0a9e('0x7a')][_0x0a9e('0x55')]({'where':{'id':_0x1f42a0[_0x0a9e('0x5f')]}});}return null;})[_0x0a9e('0x1d')](handleEntityNotFound(_0x3736e0,null))['then'](function(_0xf51744){if(_0xf51744){_0x8cea96[_0x0a9e('0x63')]=_0xf51744['get']({'plain':!![]});interaction_log[_0x0a9e('0x1e')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x563627[_0x0a9e('0x65')]['id'],_0x563627[_0x0a9e('0x65')][_0x0a9e('0x38')],_0x563627[_0x0a9e('0x65')]['role'],_0x8cea96['interaction']['id'],_0x563627[_0x0a9e('0x54')]?JSON[_0x0a9e('0x23')](_0x563627[_0x0a9e('0x54')]):'null');return respondWithRpcPromise(_0x0a9e('0x7b'),_0x0a9e('0x7c'),_0x8cea96);}return null;})['then'](function(_0x4e46b2){var _0xf0a802='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4e46b2['message']['ContactId'];return db[_0x0a9e('0x6b')][_0x0a9e('0x3f')](_0xf0a802,{'type':db[_0x0a9e('0x7d')][_0x0a9e('0x7e')][_0x0a9e('0x7f')],'raw':!![]})[_0x0a9e('0x1d')](function(_0x5a8854){return _0x5a8854;});})[_0x0a9e('0x1d')](function(_0x5955f1){if(_0x5955f1){_0x8cea96[_0x0a9e('0x26')][_0x0a9e('0x6c')]=_0x5955f1[0x0];if(!_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')])return;return db['User'][_0x0a9e('0x55')]({'where':{'id':_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')],'role':'agent'},'attributes':['id',_0x0a9e('0x38'),_0x0a9e('0x80'),_0x0a9e('0x6d'),_0x0a9e('0x6e')],'raw':!![]});}return null;})[_0x0a9e('0x1d')](function(_0x1910bf){if(!_0x1910bf)return null;_0x8cea96[_0x0a9e('0x26')][_0x0a9e('0x5d')]=_0x1910bf;return _0x8cea96;})['then'](function(_0x2645d6){if(_0x2645d6){_0x2645d6[_0x0a9e('0x26')]['interface']=util[_0x0a9e('0x62')](_0x0a9e('0x71'),_0x563627[_0x0a9e('0x65')]['name']);_0x2645d6[_0x0a9e('0x26')]['channel']=_0x8cea96[_0x0a9e('0x72')];_0x2645d6[_0x0a9e('0x26')][_0x0a9e('0x73')]=_0x0a9e('0x33');respondWithRpcPromise(_0x0a9e('0x74'),_0x0a9e('0x74'),{'event':_0x0a9e('0x81'),'message':_[_0x0a9e('0x4c')](_0x8cea96['message'],JSON[_0x0a9e('0x76')](_0x8cea96[_0x0a9e('0x63')][_0x0a9e('0x77')]))},client9002);return _0x8cea96;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x3736e0,null))[_0x0a9e('0x28')](handleError(_0x3736e0,null));}; \ No newline at end of file +var _0xa9e0=['interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','contact','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','parse','formData','chat-interactions','chat','ChatInteraction','RejectMessage','rejectMessage','Sequelize','QueryTypes','SELECT','fullname','rejectmessage','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatMessage.socket','register','jayson/promise','client','http','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','stack','name','send','map','ChatMessage','fieldName','type','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','body','find','describe','../../config/logger','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','ChatInteractionId','isNil','read1stAt','format'];(function(_0x18ecae,_0x2bf366){var _0x2fe95b=function(_0x5143a5){while(--_0x5143a5){_0x18ecae['push'](_0x18ecae['shift']());}};_0x2fe95b(++_0x2bf366);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];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);var jayson=require(_0x0a9e('0x1a'));var client=jayson[_0x0a9e('0x1b')][_0x0a9e('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0x0a9e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x5d0880,_0x1985b6,_0x519dfd,_0x16033c){return new BPromise(function(_0x12066b,_0x48f32d){var _0x225616=_0x16033c||client;return _0x225616['request'](_0x5d0880,_0x519dfd)[_0x0a9e('0x1d')](function(_0x478723){logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x1985b6,_0x0a9e('0x20'));logger[_0x0a9e('0x21')](_0x0a9e('0x22'),_0x1985b6,_0x0a9e('0x20'),JSON[_0x0a9e('0x23')](_0x478723));if(_0x478723[_0x0a9e('0x24')]){if(_0x478723[_0x0a9e('0x24')][_0x0a9e('0x25')]===0x1f4){logger['error'](_0x0a9e('0x1f'),_0x1985b6,_0x478723[_0x0a9e('0x24')]['message']);return _0x48f32d(_0x478723[_0x0a9e('0x24')]['message']);}logger['error'](_0x0a9e('0x1f'),_0x1985b6,_0x478723[_0x0a9e('0x24')][_0x0a9e('0x26')]);return _0x12066b(_0x478723[_0x0a9e('0x24')]['message']);}else{logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x1985b6,_0x0a9e('0x20'));_0x12066b(_0x478723[_0x0a9e('0x27')][_0x0a9e('0x26')]);}})[_0x0a9e('0x28')](function(_0x16b1ca){logger['error']('ChatMessage,\x20%s,\x20%s',_0x1985b6,_0x16b1ca);_0x48f32d(_0x16b1ca);});});}function respondWithStatusCode(_0x197ec0,_0x3a8e58){_0x3a8e58=_0x3a8e58||0xcc;return function(_0x40c424){if(_0x40c424){return _0x197ec0[_0x0a9e('0x29')](_0x3a8e58);}return _0x197ec0['status'](_0x3a8e58)[_0x0a9e('0x2a')]();};}function respondWithResult(_0x479bc4,_0x45a1e7){_0x45a1e7=_0x45a1e7||0xc8;return function(_0x5bfb33){if(_0x5bfb33){return _0x479bc4[_0x0a9e('0x2b')](_0x45a1e7)[_0x0a9e('0x2c')](_0x5bfb33);}};}function respondWithFilteredResult(_0x25fba9,_0x14433c){return function(_0x140511){if(_0x140511){var _0x1538a4=typeof _0x14433c[_0x0a9e('0x2d')]===_0x0a9e('0x2e')&&typeof _0x14433c['limit']===_0x0a9e('0x2e');var _0x468813=_0x140511[_0x0a9e('0x2f')];var _0x2ec755=_0x1538a4?0x0:_0x14433c['offset'];var _0x15b200=_0x1538a4?_0x140511[_0x0a9e('0x2f')]:_0x14433c[_0x0a9e('0x2d')]+_0x14433c[_0x0a9e('0x30')];var _0x58b06f;if(_0x15b200>=_0x468813){_0x15b200=_0x468813;_0x58b06f=0xc8;}else{_0x58b06f=0xce;}_0x25fba9[_0x0a9e('0x2b')](_0x58b06f);return _0x25fba9[_0x0a9e('0x31')](_0x0a9e('0x32'),_0x2ec755+'-'+_0x15b200+'/'+_0x468813)[_0x0a9e('0x2c')](_0x140511);}return null;};}function patchUpdates(_0x540530){return function(_0x426950){try{jsonpatch['apply'](_0x426950,_0x540530,!![]);}catch(_0x2407f9){return BPromise[_0x0a9e('0x33')](_0x2407f9);}return _0x426950[_0x0a9e('0x34')]();};}function saveUpdates(_0x33bdb7,_0x25ce3a){return function(_0x5180f1){if(_0x5180f1){return _0x5180f1[_0x0a9e('0x35')](_0x33bdb7)[_0x0a9e('0x1d')](function(_0x40cb85){return _0x40cb85;});}return null;};}function removeEntity(_0x2da5c0,_0x2b45ea){return function(_0x409319){if(_0x409319){return _0x409319[_0x0a9e('0x36')]()[_0x0a9e('0x1d')](function(){_0x2da5c0['status'](0xcc)[_0x0a9e('0x2a')]();});}};}function handleEntityNotFound(_0x5e7238,_0x2cc7a0){return function(_0x14b13f){if(!_0x14b13f){_0x5e7238[_0x0a9e('0x29')](0x194);}return _0x14b13f;};}function handleError(_0x3f3d41,_0x567193){_0x567193=_0x567193||0x1f4;return function(_0x191e91){logger[_0x0a9e('0x24')](_0x191e91[_0x0a9e('0x37')]);if(_0x191e91[_0x0a9e('0x38')]){delete _0x191e91['name'];}_0x3f3d41['status'](_0x567193)[_0x0a9e('0x39')](_0x191e91);};}exports['index']=function(_0x24936a,_0x3d9717){var _0x381c37={},_0x1ef87a={},_0x4f41ae={'count':0x0,'rows':[]};var _0x31916f=_[_0x0a9e('0x3a')](db[_0x0a9e('0x3b')]['rawAttributes'],function(_0x1dbf74){return{'name':_0x1dbf74[_0x0a9e('0x3c')],'type':_0x1dbf74[_0x0a9e('0x3d')]['key']};});_0x1ef87a['model']=_[_0x0a9e('0x3a')](_0x31916f,_0x0a9e('0x38'));_0x1ef87a['query']=_[_0x0a9e('0x3e')](_0x24936a[_0x0a9e('0x3f')]);_0x1ef87a[_0x0a9e('0x40')]=_[_0x0a9e('0x41')](_0x1ef87a['model'],_0x1ef87a['query']);_0x381c37[_0x0a9e('0x42')]=_[_0x0a9e('0x41')](_0x1ef87a['model'],qs[_0x0a9e('0x43')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x381c37['attributes']=_0x381c37[_0x0a9e('0x42')][_0x0a9e('0x44')]?_0x381c37[_0x0a9e('0x42')]:_0x1ef87a[_0x0a9e('0x45')];if(!_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x46')](_0x0a9e('0x47'))){_0x381c37[_0x0a9e('0x30')]=qs[_0x0a9e('0x30')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x30')]);_0x381c37[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x2d')]);}_0x381c37['order']=qs['sort'](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x48')]);_0x381c37[_0x0a9e('0x49')]=qs[_0x0a9e('0x40')](_[_0x0a9e('0x4a')](_0x24936a[_0x0a9e('0x3f')],_0x1ef87a[_0x0a9e('0x40')]),_0x31916f);if(_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4b')]){_0x381c37[_0x0a9e('0x49')]=_[_0x0a9e('0x4c')](_0x381c37[_0x0a9e('0x49')],{'$or':_['map'](_0x31916f,function(_0x117c99){if(_0x117c99[_0x0a9e('0x3d')]!==_0x0a9e('0x4d')){var _0xfbd5ad={};_0xfbd5ad[_0x117c99[_0x0a9e('0x38')]]={'$like':'%'+_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4b')]+'%'};return _0xfbd5ad;}})});}_0x381c37=_[_0x0a9e('0x4c')]({},_0x381c37,_0x24936a['options']);var _0x2e9d90={'where':_0x381c37['where']};return db[_0x0a9e('0x3b')][_0x0a9e('0x2f')](_0x2e9d90)[_0x0a9e('0x1d')](function(_0x562fb4){_0x4f41ae[_0x0a9e('0x2f')]=_0x562fb4;if(_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4e')]){_0x381c37[_0x0a9e('0x4f')]=[{'all':!![]}];}return db[_0x0a9e('0x3b')][_0x0a9e('0x50')](_0x381c37);})[_0x0a9e('0x1d')](function(_0x5bbcde){_0x4f41ae[_0x0a9e('0x51')]=_0x5bbcde;return _0x4f41ae;})[_0x0a9e('0x1d')](respondWithFilteredResult(_0x3d9717,_0x381c37))[_0x0a9e('0x28')](handleError(_0x3d9717,null));};exports[_0x0a9e('0x52')]=function(_0x409789,_0x992c77){var _0x6054ee={'raw':!![],'where':{'id':_0x409789[_0x0a9e('0x53')]['id']}},_0x19383e={};_0x19383e['model']=_[_0x0a9e('0x3e')](db[_0x0a9e('0x3b')]['rawAttributes']);_0x19383e['query']=_['keys'](_0x409789[_0x0a9e('0x3f')]);_0x19383e[_0x0a9e('0x40')]=_[_0x0a9e('0x41')](_0x19383e[_0x0a9e('0x45')],_0x19383e[_0x0a9e('0x3f')]);_0x6054ee[_0x0a9e('0x42')]=_[_0x0a9e('0x41')](_0x19383e[_0x0a9e('0x45')],qs['fields'](_0x409789['query']['fields']));_0x6054ee[_0x0a9e('0x42')]=_0x6054ee[_0x0a9e('0x42')][_0x0a9e('0x44')]?_0x6054ee['attributes']:_0x19383e[_0x0a9e('0x45')];if(_0x409789[_0x0a9e('0x3f')]['includeAll']){_0x6054ee['include']=[{'all':!![]}];}_0x6054ee=_[_0x0a9e('0x4c')]({},_0x6054ee,_0x409789['options']);return db[_0x0a9e('0x3b')]['find'](_0x6054ee)[_0x0a9e('0x1d')](handleEntityNotFound(_0x992c77,null))[_0x0a9e('0x1d')](respondWithResult(_0x992c77,null))[_0x0a9e('0x28')](handleError(_0x992c77,null));};exports['create']=function(_0x2f82da,_0x1bf38a){return db['ChatMessage']['create'](_0x2f82da[_0x0a9e('0x54')],{})[_0x0a9e('0x1d')](respondWithResult(_0x1bf38a,0xc9))['catch'](handleError(_0x1bf38a,null));};exports[_0x0a9e('0x35')]=function(_0x5ce9ac,_0x211ef9){if(_0x5ce9ac['body']['id']){delete _0x5ce9ac[_0x0a9e('0x54')]['id'];}return db['ChatMessage']['find']({'where':{'id':_0x5ce9ac['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x211ef9,null))['then'](saveUpdates(_0x5ce9ac[_0x0a9e('0x54')],null))[_0x0a9e('0x1d')](respondWithResult(_0x211ef9,null))[_0x0a9e('0x28')](handleError(_0x211ef9,null));};exports[_0x0a9e('0x36')]=function(_0x232830,_0x272738){return db[_0x0a9e('0x3b')][_0x0a9e('0x55')]({'where':{'id':_0x232830['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x272738,null))[_0x0a9e('0x1d')](removeEntity(_0x272738,null))[_0x0a9e('0x28')](handleError(_0x272738,null));};exports[_0x0a9e('0x56')]=function(_0xb83dfd,_0x156662){return db['ChatMessage'][_0x0a9e('0x56')]()[_0x0a9e('0x1d')](respondWithResult(_0x156662,null))['catch'](handleError(_0x156662,null));};var interaction_log=require(_0x0a9e('0x57'))('chat-interactions');exports[_0x0a9e('0x58')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee){var _0x273cb5={'agent':{},'channel':'chat'};if(_0x5ba1f9[_0x0a9e('0x54')]['id']){delete _0x5ba1f9[_0x0a9e('0x54')]['id'];}_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x59')]=!![];_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5a')]=moment()['format'](_0x0a9e('0x5b'));_0x5ba1f9['body'][_0x0a9e('0x5c')]=_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')]||_0x5ba1f9['user']['id'];_0x273cb5[_0x0a9e('0x5d')]['id']=_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x5ba1f9[_0x0a9e('0x53')]['id'],'UserId':null}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4b3c1a,null))['then'](saveUpdates(_0x5ba1f9[_0x0a9e('0x54')],null))[_0x0a9e('0x1d')](function(_0x88dcbf){if(_0x88dcbf){_0x273cb5[_0x0a9e('0x26')]=_0x88dcbf[_0x0a9e('0x5e')]({'plain':!![]});return db['ChatInteraction'][_0x0a9e('0x55')]({'where':{'id':_0x88dcbf[_0x0a9e('0x5f')]}});}return null;})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4b3c1a,null))['then'](function(_0x3528b7){if(_0x3528b7){return _0x3528b7['update']({'UserId':_0x5ba1f9['body'][_0x0a9e('0x5c')],'read1stAt':_[_0x0a9e('0x60')](_0x3528b7[_0x0a9e('0x61')])?moment()[_0x0a9e('0x62')](_0x0a9e('0x5b')):undefined});}return null;})[_0x0a9e('0x1d')](function(_0x387489){if(_0x387489){_0x273cb5[_0x0a9e('0x63')]=_0x387489[_0x0a9e('0x5e')]({'plain':!![]});interaction_log[_0x0a9e('0x1e')](_0x0a9e('0x64'),_0x5ba1f9[_0x0a9e('0x65')]['id'],_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x38')],_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x66')],_0x273cb5[_0x0a9e('0x63')]['id'],_0x5ba1f9[_0x0a9e('0x54')]?JSON['stringify'](_0x5ba1f9[_0x0a9e('0x54')]):_0x0a9e('0x67'));return respondWithRpcPromise(_0x0a9e('0x68'),'acceptMessage',_0x273cb5);}return null;})[_0x0a9e('0x1d')](function(_0x30944e){var _0x4b341d=_0x0a9e('0x69')+_0x30944e[_0x0a9e('0x26')][_0x0a9e('0x6a')];return db[_0x0a9e('0x6b')][_0x0a9e('0x3f')](_0x4b341d,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x0a9e('0x1d')](function(_0x18bf5d){return _0x18bf5d;});})[_0x0a9e('0x1d')](function(_0x23a7d3){if(_0x23a7d3){_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x6c')]=_0x23a7d3[0x0];if(!_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')])return;return db['User'][_0x0a9e('0x55')]({'where':{'id':_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')],'role':'agent'},'attributes':['id',_0x0a9e('0x38'),'fullname',_0x0a9e('0x6d'),_0x0a9e('0x6e')],'raw':!![]});}return null;})['then'](function(_0x2ed01e){if(!_0x2ed01e)return null;_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x5d')]=_0x2ed01e;return _0x273cb5;})[_0x0a9e('0x1d')](function(_0x542ece){if(_0x542ece){if(_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x6f')]){_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x70')]=util['format'](_0x0a9e('0x71'),_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x38')]);_0x273cb5[_0x0a9e('0x26')]['channel']=_0x273cb5[_0x0a9e('0x72')];_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x73')]=_0x0a9e('0x58');return respondWithRpcPromise(_0x0a9e('0x74'),_0x0a9e('0x74'),{'event':_0x0a9e('0x75'),'message':_[_0x0a9e('0x4c')](_0x273cb5[_0x0a9e('0x26')],JSON[_0x0a9e('0x76')](_0x273cb5[_0x0a9e('0x63')][_0x0a9e('0x77')]))},client9002)[_0x0a9e('0x1d')](function(){return _0x273cb5;});}return _0x273cb5;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x4b3c1a,null))['catch'](handleError(_0x4b3c1a,null));};var interaction_log=require(_0x0a9e('0x57'))(_0x0a9e('0x78'));exports[_0x0a9e('0x33')]=function(_0x563627,_0x3736e0,_0x33dda0){var _0x8cea96={'agent':{},'channel':_0x0a9e('0x79')};if(_0x563627['body']['id']){delete _0x563627['body']['id'];}_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')]=_0x563627['body'][_0x0a9e('0x5c')]||_0x563627['user']['id'];_0x8cea96[_0x0a9e('0x5d')]['id']=_0x563627[_0x0a9e('0x54')]['UserId'];return db[_0x0a9e('0x3b')][_0x0a9e('0x55')]({'where':{'id':_0x563627[_0x0a9e('0x53')]['id'],'UserId':null}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x3736e0,null))[_0x0a9e('0x1d')](function(_0x1f42a0){if(_0x1f42a0){_0x8cea96[_0x0a9e('0x26')]=_0x1f42a0['get']({'plain':!![]});return db[_0x0a9e('0x7a')][_0x0a9e('0x55')]({'where':{'id':_0x1f42a0[_0x0a9e('0x5f')]}});}return null;})[_0x0a9e('0x1d')](handleEntityNotFound(_0x3736e0,null))['then'](function(_0xf51744){if(_0xf51744){_0x8cea96[_0x0a9e('0x63')]=_0xf51744['get']({'plain':!![]});interaction_log[_0x0a9e('0x1e')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x563627[_0x0a9e('0x65')]['id'],_0x563627[_0x0a9e('0x65')][_0x0a9e('0x38')],_0x563627[_0x0a9e('0x65')]['role'],_0x8cea96['interaction']['id'],_0x563627[_0x0a9e('0x54')]?JSON[_0x0a9e('0x23')](_0x563627[_0x0a9e('0x54')]):'null');return respondWithRpcPromise(_0x0a9e('0x7b'),_0x0a9e('0x7c'),_0x8cea96);}return null;})['then'](function(_0x4e46b2){var _0xf0a802='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4e46b2['message']['ContactId'];return db[_0x0a9e('0x6b')][_0x0a9e('0x3f')](_0xf0a802,{'type':db[_0x0a9e('0x7d')][_0x0a9e('0x7e')][_0x0a9e('0x7f')],'raw':!![]})[_0x0a9e('0x1d')](function(_0x5a8854){return _0x5a8854;});})[_0x0a9e('0x1d')](function(_0x5955f1){if(_0x5955f1){_0x8cea96[_0x0a9e('0x26')][_0x0a9e('0x6c')]=_0x5955f1[0x0];if(!_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')])return;return db['User'][_0x0a9e('0x55')]({'where':{'id':_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')],'role':'agent'},'attributes':['id',_0x0a9e('0x38'),_0x0a9e('0x80'),_0x0a9e('0x6d'),_0x0a9e('0x6e')],'raw':!![]});}return null;})[_0x0a9e('0x1d')](function(_0x1910bf){if(!_0x1910bf)return null;_0x8cea96[_0x0a9e('0x26')][_0x0a9e('0x5d')]=_0x1910bf;return _0x8cea96;})['then'](function(_0x2645d6){if(_0x2645d6){_0x2645d6[_0x0a9e('0x26')]['interface']=util[_0x0a9e('0x62')](_0x0a9e('0x71'),_0x563627[_0x0a9e('0x65')]['name']);_0x2645d6[_0x0a9e('0x26')]['channel']=_0x8cea96[_0x0a9e('0x72')];_0x2645d6[_0x0a9e('0x26')][_0x0a9e('0x73')]=_0x0a9e('0x33');respondWithRpcPromise(_0x0a9e('0x74'),_0x0a9e('0x74'),{'event':_0x0a9e('0x81'),'message':_[_0x0a9e('0x4c')](_0x8cea96['message'],JSON[_0x0a9e('0x76')](_0x8cea96[_0x0a9e('0x63')][_0x0a9e('0x77')]))},client9002);return _0x8cea96;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x3736e0,null))[_0x0a9e('0x28')](handleError(_0x3736e0,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 39c0c60..c0e8add 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 _0x4494=['save','remove','emit','hook','events','setMaxListeners'];(function(_0x590e74,_0x49de34){var _0x192110=function(_0x479fad){while(--_0x479fad){_0x590e74['push'](_0x590e74['shift']());}};_0x192110(++_0x49de34);}(_0x4494,0x1c0));var _0x4449=function(_0x227fba,_0x33df5c){_0x227fba=_0x227fba-0x0;var _0x56ff80=_0x4494[_0x227fba];return _0x56ff80;};'use strict';var EventEmitter=require(_0x4449('0x0'));var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x4449('0x1')](0x0);var events={'afterCreate':_0x4449('0x2'),'afterUpdate':'update','afterDestroy':_0x4449('0x3')};function emitEvent(_0xa9be76){return function(_0x1dc84d,_0x2cd062,_0x5a7f25){ChatMessageEvents[_0x4449('0x4')](_0xa9be76+':'+_0x1dc84d['id'],_0x1dc84d);ChatMessageEvents['emit'](_0xa9be76,_0x1dc84d);_0x5a7f25(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x4449('0x5')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0x3a36=['update','remove','emit','hook','exports','ChatMessage','setMaxListeners','save'];(function(_0x12c3d7,_0x30320a){var _0x43178f=function(_0x5cb92b){while(--_0x5cb92b){_0x12c3d7['push'](_0x12c3d7['shift']());}};_0x43178f(++_0x30320a);}(_0x3a36,0x12d));var _0x63a3=function(_0x29f07b,_0x20fc7a){_0x29f07b=_0x29f07b-0x0;var _0x24f90d=_0x3a36[_0x29f07b];return _0x24f90d;};'use strict';var EventEmitter=require('events');var ChatMessage=require('../../mysqldb')['db'][_0x63a3('0x0')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x63a3('0x1')](0x0);var events={'afterCreate':_0x63a3('0x2'),'afterUpdate':_0x63a3('0x3'),'afterDestroy':_0x63a3('0x4')};function emitEvent(_0x1b3fe5){return function(_0x512b92,_0x100d1e,_0x1f345f){ChatMessageEvents[_0x63a3('0x5')](_0x1b3fe5+':'+_0x512b92['id'],_0x512b92);ChatMessageEvents[_0x63a3('0x5')](_0x1b3fe5,_0x512b92);_0x1f345f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x63a3('0x6')](e,emitEvent(event));}}module[_0x63a3('0x7')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 03e3d48..ef156a1 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 _0x4907=['get','direction','toLowerCase','out','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./chatMessage.attributes','define','fti_chat_messages','body','FULLTEXT','models'];(function(_0x56ab7e,_0x3d47af){var _0x4205b9=function(_0x362220){while(--_0x362220){_0x56ab7e['push'](_0x56ab7e['shift']());}};_0x4205b9(++_0x3d47af);}(_0x4907,0x131));var _0x7490=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4907[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7490('0x0'));var util=require(_0x7490('0x1'));var logger=require(_0x7490('0x2'))(_0x7490('0x3'));var moment=require('moment');var BPromise=require(_0x7490('0x4'));var rp=require(_0x7490('0x5'));var fs=require('fs');var path=require(_0x7490('0x6'));var rimraf=require('rimraf');var config=require(_0x7490('0x7'));var attributes=require(_0x7490('0x8'));module['exports']=function(_0x383096,_0x2e88c3){return _0x383096[_0x7490('0x9')]('ChatMessage',attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0x7490('0xa'),'fields':[_0x7490('0xb')],'type':_0x7490('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x163606,_0x2b65e0,_0x24eb89){var _0x2e84b6=_0x383096[_0x7490('0xd')];var _0x4297b9=_0x163606[_0x7490('0xe')]({'plain':!![]});if(_0x4297b9['direction']['toLowerCase']()==='in'||_0x4297b9[_0x7490('0xf')][_0x7490('0x10')]()===_0x7490('0x11')&&!_0x4297b9['secret']&&!_[_0x7490('0x12')](_0x4297b9[_0x7490('0x13')])){_0x2e84b6[_0x7490('0x14')][_0x7490('0x15')]({'where':{'id':_0x4297b9[_0x7490('0x16')]}})['then'](function(_0x49c919){if(_0x49c919){_0x49c919[_0x7490('0x17')]({'lastMsgAt':_0x4297b9[_0x7490('0x18')],'lastMsgDirection':_0x4297b9[_0x7490('0xf')]['toLowerCase']()});}})[_0x7490('0x19')](function(_0xb2d744){console[_0x7490('0x1a')](_0xb2d744);});}_0x24eb89();}},'charset':_0x7490('0x1b'),'collate':_0x7490('0x1c')});}; \ No newline at end of file +var _0x4d84=['body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages'];(function(_0x5801f9,_0x3d95dd){var _0x34230d=function(_0x58150b){while(--_0x58150b){_0x5801f9['push'](_0x5801f9['shift']());}};_0x34230d(++_0x3d95dd);}(_0x4d84,0xad));var _0x44d8=function(_0x55c76f,_0x13b7f4){_0x55c76f=_0x55c76f-0x0;var _0x1571ff=_0x4d84[_0x55c76f];return _0x1571ff;};'use strict';var _=require(_0x44d8('0x0'));var util=require(_0x44d8('0x1'));var logger=require(_0x44d8('0x2'))(_0x44d8('0x3'));var moment=require(_0x44d8('0x4'));var BPromise=require(_0x44d8('0x5'));var rp=require(_0x44d8('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x44d8('0x7'));module[_0x44d8('0x8')]=function(_0x2cade6,_0x4ade8b){return _0x2cade6[_0x44d8('0x9')](_0x44d8('0xa'),attributes,{'tableName':_0x44d8('0xb'),'paranoid':![],'indexes':[{'name':_0x44d8('0xc'),'fields':[_0x44d8('0xd')],'type':_0x44d8('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x31a49c,_0x37201b,_0x5ea9ef){var _0x55e275=_0x2cade6['models'];var _0x454fcf=_0x31a49c[_0x44d8('0xf')]({'plain':!![]});if(_0x454fcf[_0x44d8('0x10')][_0x44d8('0x11')]()==='in'||_0x454fcf['direction'][_0x44d8('0x11')]()===_0x44d8('0x12')&&!_0x454fcf[_0x44d8('0x13')]&&!_[_0x44d8('0x14')](_0x454fcf[_0x44d8('0x15')])){_0x55e275[_0x44d8('0x16')][_0x44d8('0x17')]({'where':{'id':_0x454fcf[_0x44d8('0x18')]}})[_0x44d8('0x19')](function(_0xe4150c){if(_0xe4150c){_0xe4150c['update']({'lastMsgAt':_0x454fcf[_0x44d8('0x1a')],'lastMsgDirection':_0x454fcf[_0x44d8('0x10')][_0x44d8('0x11')]()});}})[_0x44d8('0x1b')](function(_0xf2f189){console[_0x44d8('0x1c')](_0xf2f189);});}_0x5ea9ef();}},'charset':_0x44d8('0x1d'),'collate':_0x44d8('0x1e')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 9508601..a4f1205 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 _0xf69c=['ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateChatMessage','ChatMessage','create','body','options','raw','then','info','lodash','moment','bluebird','ioredis','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','request'];(function(_0x3ad9b3,_0x5c76e9){var _0x4ef8d1=function(_0x239036){while(--_0x239036){_0x3ad9b3['push'](_0x3ad9b3['shift']());}};_0x4ef8d1(++_0x5c76e9);}(_0xf69c,0x151));var _0xcf69=function(_0x55a7c2,_0x365314){_0x55a7c2=_0x55a7c2-0x0;var _0xd12715=_0xf69c[_0x55a7c2];return _0xd12715;};'use strict';var _=require(_0xcf69('0x0'));var util=require('util');var moment=require(_0xcf69('0x1'));var BPromise=require(_0xcf69('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcf69('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcf69('0x4'));var logger=require('../../config/logger')(_0xcf69('0x5'));var config=require('../../config/environment');var jayson=require(_0xcf69('0x6'));var client=jayson[_0xcf69('0x7')][_0xcf69('0x8')]({'port':0x232a});config[_0xcf69('0x9')]=_[_0xcf69('0xa')](config['redis'],{'host':_0xcf69('0xb'),'port':0x18eb});var socket=require(_0xcf69('0xc'))(new Redis(config[_0xcf69('0x9')]));require(_0xcf69('0xd'))['register'](socket);function respondWithRpcPromise(_0xd73ebd,_0x38489e,_0x914e95){return new BPromise(function(_0x19b782,_0x449f75){return client[_0xcf69('0xe')](_0xd73ebd,_0x914e95)['then'](function(_0x1e4e74){logger['info'](_0xcf69('0xf'),_0x38489e,_0xcf69('0x10'));logger[_0xcf69('0x11')](_0xcf69('0x12'),_0x38489e,_0xcf69('0x10'),JSON[_0xcf69('0x13')](_0x1e4e74));if(_0x1e4e74[_0xcf69('0x14')]){if(_0x1e4e74[_0xcf69('0x14')]['code']===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0x38489e,_0x1e4e74['error'][_0xcf69('0x15')]);return _0x449f75(_0x1e4e74['error'][_0xcf69('0x15')]);}logger[_0xcf69('0x14')](_0xcf69('0xf'),_0x38489e,_0x1e4e74[_0xcf69('0x14')]['message']);return _0x19b782(_0x1e4e74[_0xcf69('0x14')][_0xcf69('0x15')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x38489e,_0xcf69('0x10'));_0x19b782(_0x1e4e74[_0xcf69('0x16')][_0xcf69('0x15')]);}})[_0xcf69('0x17')](function(_0xcdd2d8){logger[_0xcf69('0x14')](_0xcf69('0xf'),_0x38489e,_0xcdd2d8);_0x449f75(_0xcdd2d8);});});}exports[_0xcf69('0x18')]=function(_0x53666e){var _0x19b5ed=this;return new Promise(function(_0x5c35e3,_0xbe9cd5){return db[_0xcf69('0x19')][_0xcf69('0x1a')](_0x53666e[_0xcf69('0x1b')],{'raw':_0x53666e[_0xcf69('0x1c')]?_0x53666e[_0xcf69('0x1c')][_0xcf69('0x1d')]===undefined?!![]:![]:!![]})[_0xcf69('0x1e')](function(_0x3a159f){logger[_0xcf69('0x1f')](_0xcf69('0x18'),_0x53666e);logger[_0xcf69('0x11')](_0xcf69('0x18'),_0x53666e,JSON[_0xcf69('0x13')](_0x3a159f));_0x5c35e3(_0x3a159f);})[_0xcf69('0x17')](function(_0x5d16ef){logger[_0xcf69('0x14')](_0xcf69('0x18'),_0x5d16ef[_0xcf69('0x15')],_0x53666e);_0xbe9cd5(_0x19b5ed[_0xcf69('0x14')](0x1f4,_0x5d16ef[_0xcf69('0x15')]));});});}; \ No newline at end of file +var _0xdf55=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatMessage.socket','register','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateChatMessage','create','body','options','raw','then','catch','lodash','util','bluebird','randomstring','../../mysqldb'];(function(_0x1d900d,_0x1dcaf4){var _0x500261=function(_0x1bb144){while(--_0x1bb144){_0x1d900d['push'](_0x1d900d['shift']());}};_0x500261(++_0x1dcaf4);}(_0xdf55,0x83));var _0x5df5=function(_0xc5775d,_0x3701ab){_0xc5775d=_0xc5775d-0x0;var _0x3b4edd=_0xdf55[_0xc5775d];return _0x3b4edd;};'use strict';var _=require(_0x5df5('0x0'));var util=require(_0x5df5('0x1'));var moment=require('moment');var BPromise=require(_0x5df5('0x2'));var rs=require(_0x5df5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5df5('0x4'))['db'];var utils=require(_0x5df5('0x5'));var logger=require(_0x5df5('0x6'))('rpc');var config=require(_0x5df5('0x7'));var jayson=require(_0x5df5('0x8'));var client=jayson[_0x5df5('0x9')][_0x5df5('0xa')]({'port':0x232a});config[_0x5df5('0xb')]=_[_0x5df5('0xc')](config[_0x5df5('0xb')],{'host':_0x5df5('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5df5('0xb')]));require(_0x5df5('0xe'))[_0x5df5('0xf')](socket);function respondWithRpcPromise(_0x4787f1,_0x52ed26,_0x39711b){return new BPromise(function(_0x4e80bd,_0x45ad13){return client[_0x5df5('0x10')](_0x4787f1,_0x39711b)['then'](function(_0x59d273){logger[_0x5df5('0x11')](_0x5df5('0x12'),_0x52ed26,_0x5df5('0x13'));logger[_0x5df5('0x14')](_0x5df5('0x15'),_0x52ed26,_0x5df5('0x13'),JSON[_0x5df5('0x16')](_0x59d273));if(_0x59d273[_0x5df5('0x17')]){if(_0x59d273[_0x5df5('0x17')][_0x5df5('0x18')]===0x1f4){logger['error'](_0x5df5('0x12'),_0x52ed26,_0x59d273['error'][_0x5df5('0x19')]);return _0x45ad13(_0x59d273[_0x5df5('0x17')][_0x5df5('0x19')]);}logger[_0x5df5('0x17')](_0x5df5('0x12'),_0x52ed26,_0x59d273['error'][_0x5df5('0x19')]);return _0x4e80bd(_0x59d273[_0x5df5('0x17')]['message']);}else{logger[_0x5df5('0x11')](_0x5df5('0x12'),_0x52ed26,_0x5df5('0x13'));_0x4e80bd(_0x59d273[_0x5df5('0x1a')][_0x5df5('0x19')]);}})['catch'](function(_0x589093){logger[_0x5df5('0x17')]('ChatMessage,\x20%s,\x20%s',_0x52ed26,_0x589093);_0x45ad13(_0x589093);});});}exports[_0x5df5('0x1b')]=function(_0x40a8f5){var _0xa939e4=this;return new Promise(function(_0x34b107,_0x1deae7){return db['ChatMessage'][_0x5df5('0x1c')](_0x40a8f5[_0x5df5('0x1d')],{'raw':_0x40a8f5[_0x5df5('0x1e')]?_0x40a8f5[_0x5df5('0x1e')][_0x5df5('0x1f')]===undefined?!![]:![]:!![]})[_0x5df5('0x20')](function(_0x59ff67){logger[_0x5df5('0x11')](_0x5df5('0x1b'),_0x40a8f5);logger[_0x5df5('0x14')](_0x5df5('0x1b'),_0x40a8f5,JSON['stringify'](_0x59ff67));_0x34b107(_0x59ff67);})[_0x5df5('0x21')](function(_0x13369c){logger[_0x5df5('0x17')]('CreateChatMessage',_0x13369c['message'],_0x40a8f5);_0x1deae7(_0xa939e4['error'](0x1f4,_0x13369c[_0x5df5('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index ecb4cca..37264dc 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 _0xfd6e=['./chatMessage.events','remove','length'];(function(_0x2c3ff1,_0x4999f6){var _0x296c5e=function(_0x560c05){while(--_0x560c05){_0x2c3ff1['push'](_0x2c3ff1['shift']());}};_0x296c5e(++_0x4999f6);}(_0xfd6e,0x16e));var _0xefd6=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xfd6e[_0x2641f9];return _0x585741;};'use strict';var ChatMessageEvents=require(_0xefd6('0x0'));var events=['save',_0xefd6('0x1'),'update'];function createListener(_0x229dfe,_0x41b7d0){return function(_0x54e608){_0x41b7d0['emit'](_0x229dfe,_0x54e608);};}function removeListener(_0x5f4c49,_0x27d881){return function(){ChatMessageEvents['removeListener'](_0x5f4c49,_0x27d881);};}exports['register']=function(_0x24af45){for(var _0x23f8c3=0x0,_0x26e108=events[_0xefd6('0x2')];_0x23f8c3<_0x26e108;_0x23f8c3++){var _0x340765=events[_0x23f8c3];var _0x5da399=createListener('chatMessage:'+_0x340765,_0x24af45);ChatMessageEvents['on'](_0x340765,_0x5da399);}}; \ No newline at end of file +var _0x207c=['length','chatMessage:','save','remove','update','emit'];(function(_0x339781,_0xe299e9){var _0x5cfb6a=function(_0x37f3de){while(--_0x37f3de){_0x339781['push'](_0x339781['shift']());}};_0x5cfb6a(++_0xe299e9);}(_0x207c,0x1e8));var _0xc207=function(_0x4583d0,_0x24551f){_0x4583d0=_0x4583d0-0x0;var _0x7b3c5a=_0x207c[_0x4583d0];return _0x7b3c5a;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0xc207('0x0'),_0xc207('0x1'),_0xc207('0x2')];function createListener(_0xaaba3d,_0x2b40be){return function(_0x12f1f2){_0x2b40be[_0xc207('0x3')](_0xaaba3d,_0x12f1f2);};}function removeListener(_0x4b9daa,_0x38ff02){return function(){ChatMessageEvents['removeListener'](_0x4b9daa,_0x38ff02);};}exports['register']=function(_0x55023e){for(var _0xc88789=0x0,_0x314561=events[_0xc207('0x4')];_0xc88789<_0x314561;_0xc88789++){var _0x59ff6f=events[_0xc88789];var _0x25cb97=createListener(_0xc207('0x5')+_0x59ff6f,_0x55023e);ChatMessageEvents['on'](_0x59ff6f,_0x25cb97);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 36b2d15..44a46ea 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 _0x2503=['exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','post','tracked','chat','chatmessage:create','create','put','accept','/:id/reject','reject','delete'];(function(_0x264ff9,_0x39585b){var _0x59485a=function(_0x3372de){while(--_0x3372de){_0x264ff9['push'](_0x264ff9['shift']());}};_0x59485a(++_0x39585b);}(_0x2503,0x1dc));var _0x3250=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2503[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x3250('0x0'));var util=require(_0x3250('0x1'));var path=require(_0x3250('0x2'));var timeout=require(_0x3250('0x3'));var express=require(_0x3250('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3250('0x5'));var config=require(_0x3250('0x6'));var controller=require('./chatMessage.controller');router['get']('/',auth[_0x3250('0x7')](),controller[_0x3250('0x8')]);router[_0x3250('0x9')](_0x3250('0xa'),auth[_0x3250('0x7')](),controller[_0x3250('0xb')]);router['get'](_0x3250('0xc'),auth[_0x3250('0x7')](),controller[_0x3250('0xd')]);router[_0x3250('0xe')]('/',auth['isAuthenticated'](),interaction[_0x3250('0xf')](_0x3250('0x10'),_0x3250('0x11')),controller[_0x3250('0x12')]);router[_0x3250('0x13')](_0x3250('0xc'),controller['update']);router[_0x3250('0x13')]('/:id/accept',auth[_0x3250('0x7')](),controller[_0x3250('0x14')]);router['put'](_0x3250('0x15'),auth['isAuthenticated'](),controller[_0x3250('0x16')]);router[_0x3250('0x17')](_0x3250('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x3250('0x18')]=router; \ No newline at end of file +var _0x0e6b=['/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','post','chatmessage:create','put'];(function(_0x3dc538,_0x4f7702){var _0x72c2fd=function(_0x5a7260){while(--_0x5a7260){_0x3dc538['push'](_0x3dc538['shift']());}};_0x72c2fd(++_0x4f7702);}(_0x0e6b,0x74));var _0xb0e6=function(_0x284bc3,_0x22dffe){_0x284bc3=_0x284bc3-0x0;var _0x41ac81=_0x0e6b[_0x284bc3];return _0x41ac81;};'use strict';var multer=require(_0xb0e6('0x0'));var util=require(_0xb0e6('0x1'));var path=require(_0xb0e6('0x2'));var timeout=require('connect-timeout');var express=require(_0xb0e6('0x3'));var router=express[_0xb0e6('0x4')]();var fs_extra=require(_0xb0e6('0x5'));var auth=require(_0xb0e6('0x6'));var interaction=require(_0xb0e6('0x7'));var config=require(_0xb0e6('0x8'));var controller=require('./chatMessage.controller');router[_0xb0e6('0x9')]('/',auth[_0xb0e6('0xa')](),controller['index']);router[_0xb0e6('0x9')]('/describe',auth[_0xb0e6('0xa')](),controller[_0xb0e6('0xb')]);router[_0xb0e6('0x9')](_0xb0e6('0xc'),auth[_0xb0e6('0xa')](),controller['show']);router[_0xb0e6('0xd')]('/',auth[_0xb0e6('0xa')](),interaction['tracked']('chat',_0xb0e6('0xe')),controller['create']);router[_0xb0e6('0xf')](_0xb0e6('0xc'),controller['update']);router[_0xb0e6('0xf')](_0xb0e6('0x10'),auth['isAuthenticated'](),controller[_0xb0e6('0x11')]);router[_0xb0e6('0xf')](_0xb0e6('0x12'),auth['isAuthenticated'](),controller['reject']);router[_0xb0e6('0x13')]('/:id',auth[_0xb0e6('0xa')](),controller[_0xb0e6('0x14')]);module[_0xb0e6('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index aae9873..c3e55fa 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 _0x8ae1=['sequelize','exports','TEXT','medium'];(function(_0x39a06d,_0x2c467c){var _0x11db85=function(_0x20e6d4){while(--_0x20e6d4){_0x39a06d['push'](_0x39a06d['shift']());}};_0x11db85(++_0x2c467c);}(_0x8ae1,0x1c8));var _0x18ae=function(_0x2e4a,_0x5a9111){_0x2e4a=_0x2e4a-0x0;var _0x590ee8=_0x8ae1[_0x2e4a];return _0x590ee8;};'use strict';var Sequelize=require(_0x18ae('0x0'));module[_0x18ae('0x1')]={'body':{'type':Sequelize[_0x18ae('0x2')](_0x18ae('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0xf246=['exports','TEXT','sequelize'];(function(_0x35007a,_0x58a0d4){var _0x574f68=function(_0xd1c129){while(--_0xd1c129){_0x35007a['push'](_0x35007a['shift']());}};_0x574f68(++_0x58a0d4);}(_0xf246,0x74));var _0x6f24=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf246[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x6f24('0x0'));module[_0x6f24('0x1')]={'body':{'type':Sequelize[_0x6f24('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 3dac645..0abaff9 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0x7a54,0x106));var _0x47a5=function(_0x2700c5,_0x5c4c1e){_0x2700c5=_0x2700c5-0x0;var _0xf2dc53=_0x7a54[_0x2700c5];return _0xf2dc53;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0x7a54,0x106));var _0x47a5=function(_0x5e1187,_0x16d9e1){_0x5e1187=_0x5e1187-0x0;var _0x58fbd4=_0x7a54[_0x5e1187];return _0x58fbd4;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index eba1530..b653e14 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 _0x2ed7=['api','moment','bluebird','rimraf','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4_unicode_ci','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2ed7,0xfa));var _0x72ed=function(_0x3e3bbc,_0x327081){_0x3e3bbc=_0x3e3bbc-0x0;var _0x1c2330=_0x2ed7[_0x3e3bbc];return _0x1c2330;};'use strict';var _=require(_0x72ed('0x0'));var util=require(_0x72ed('0x1'));var logger=require('../../config/logger')(_0x72ed('0x2'));var moment=require(_0x72ed('0x3'));var BPromise=require(_0x72ed('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x72ed('0x5'));var config=require('../../config/environment');var attributes=require(_0x72ed('0x6'));module[_0x72ed('0x7')]=function(_0x4f6707,_0x548eb0){return _0x4f6707[_0x72ed('0x8')](_0x72ed('0x9'),attributes,{'tableName':_0x72ed('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x72ed('0xb')});}; \ No newline at end of file +var _0x7881=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4_unicode_ci','util'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x7881,0xd7));var _0x1788=function(_0x24e9f2,_0x187ea5){_0x24e9f2=_0x24e9f2-0x0;var _0x359108=_0x7881[_0x24e9f2];return _0x359108;};'use strict';var _=require('lodash');var util=require(_0x1788('0x0'));var logger=require(_0x1788('0x1'))('api');var moment=require(_0x1788('0x2'));var BPromise=require(_0x1788('0x3'));var rp=require(_0x1788('0x4'));var fs=require('fs');var path=require(_0x1788('0x5'));var rimraf=require('rimraf');var config=require(_0x1788('0x6'));var attributes=require('./chatOfflineMessage.attributes');module[_0x1788('0x7')]=function(_0x46aaea,_0x377c24){return _0x46aaea[_0x1788('0x8')](_0x1788('0x9'),attributes,{'tableName':_0x1788('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x1788('0xb')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index e4df8f5..a2853f0 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 _0x91c7=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','info','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x91c7,0x10e));var _0x791c=function(_0xb301d4,_0x27ed18){_0xb301d4=_0xb301d4-0x0;var _0x3b5bde=_0x91c7[_0xb301d4];return _0x3b5bde;};'use strict';var _=require(_0x791c('0x0'));var util=require(_0x791c('0x1'));var moment=require(_0x791c('0x2'));var BPromise=require(_0x791c('0x3'));var rs=require(_0x791c('0x4'));var fs=require('fs');var Redis=require(_0x791c('0x5'));var db=require(_0x791c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x791c('0x7'))(_0x791c('0x8'));var config=require('../../config/environment');var jayson=require(_0x791c('0x9'));var client=jayson[_0x791c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9ceea4,_0x3027e4,_0x34a4ab){return new BPromise(function(_0x36ba9c,_0x32c2c7){return client[_0x791c('0xb')](_0x9ceea4,_0x34a4ab)['then'](function(_0x32136e){logger[_0x791c('0xc')]('ChatOfflineMessage,\x20%s,\x20%s',_0x3027e4,_0x791c('0xd'));logger[_0x791c('0xe')](_0x791c('0xf'),_0x3027e4,_0x791c('0xd'),JSON[_0x791c('0x10')](_0x32136e));if(_0x32136e[_0x791c('0x11')]){if(_0x32136e[_0x791c('0x11')][_0x791c('0x12')]===0x1f4){logger[_0x791c('0x11')](_0x791c('0x13'),_0x3027e4,_0x32136e[_0x791c('0x11')][_0x791c('0x14')]);return _0x32c2c7(_0x32136e[_0x791c('0x11')][_0x791c('0x14')]);}logger[_0x791c('0x11')](_0x791c('0x13'),_0x3027e4,_0x32136e[_0x791c('0x11')][_0x791c('0x14')]);return _0x36ba9c(_0x32136e[_0x791c('0x11')][_0x791c('0x14')]);}else{logger[_0x791c('0xc')](_0x791c('0x13'),_0x3027e4,_0x791c('0xd'));_0x36ba9c(_0x32136e[_0x791c('0x15')][_0x791c('0x14')]);}})[_0x791c('0x16')](function(_0x3b7f91){logger['error'](_0x791c('0x13'),_0x3027e4,_0x3b7f91);_0x32c2c7(_0x3b7f91);});});} \ No newline at end of file +var _0x1b4e=['message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x596f6e,_0x3f8857){var _0x1e0803=function(_0x31f91f){while(--_0x31f91f){_0x596f6e['push'](_0x596f6e['shift']());}};_0x1e0803(++_0x3f8857);}(_0x1b4e,0x1ad));var _0xe1b4=function(_0x300f1c,_0x34005a){_0x300f1c=_0x300f1c-0x0;var _0x3b1556=_0x1b4e[_0x300f1c];return _0x3b1556;};'use strict';var _=require(_0xe1b4('0x0'));var util=require(_0xe1b4('0x1'));var moment=require(_0xe1b4('0x2'));var BPromise=require(_0xe1b4('0x3'));var rs=require(_0xe1b4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe1b4('0x5'))['db'];var utils=require(_0xe1b4('0x6'));var logger=require(_0xe1b4('0x7'))(_0xe1b4('0x8'));var config=require(_0xe1b4('0x9'));var jayson=require(_0xe1b4('0xa'));var client=jayson[_0xe1b4('0xb')][_0xe1b4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5648fb,_0x310fb6,_0x13f259){return new BPromise(function(_0x2ba587,_0x4e5583){return client[_0xe1b4('0xd')](_0x5648fb,_0x13f259)['then'](function(_0x37154f){logger['info'](_0xe1b4('0xe'),_0x310fb6,_0xe1b4('0xf'));logger[_0xe1b4('0x10')](_0xe1b4('0x11'),_0x310fb6,_0xe1b4('0xf'),JSON[_0xe1b4('0x12')](_0x37154f));if(_0x37154f[_0xe1b4('0x13')]){if(_0x37154f[_0xe1b4('0x13')][_0xe1b4('0x14')]===0x1f4){logger[_0xe1b4('0x13')](_0xe1b4('0xe'),_0x310fb6,_0x37154f[_0xe1b4('0x13')][_0xe1b4('0x15')]);return _0x4e5583(_0x37154f[_0xe1b4('0x13')][_0xe1b4('0x15')]);}logger[_0xe1b4('0x13')](_0xe1b4('0xe'),_0x310fb6,_0x37154f[_0xe1b4('0x13')][_0xe1b4('0x15')]);return _0x2ba587(_0x37154f[_0xe1b4('0x13')][_0xe1b4('0x15')]);}else{logger[_0xe1b4('0x16')](_0xe1b4('0xe'),_0x310fb6,'request\x20sent');_0x2ba587(_0x37154f[_0xe1b4('0x17')][_0xe1b4('0x15')]);}})[_0xe1b4('0x18')](function(_0x33586a){logger[_0xe1b4('0x13')](_0xe1b4('0xe'),_0x310fb6,_0x33586a);_0x4e5583(_0x33586a);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index ba237ea..3b89d9f 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 _0x5539=['put','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','isAuthenticated','index','/describe','describe','get','/:id','show','post'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5539,0x192));var _0x9553=function(_0xc064ef,_0x4fcf13){_0xc064ef=_0xc064ef-0x0;var _0x43bed0=_0x5539[_0xc064ef];return _0x43bed0;};'use strict';var multer=require(_0x9553('0x0'));var util=require(_0x9553('0x1'));var path=require(_0x9553('0x2'));var timeout=require(_0x9553('0x3'));var express=require(_0x9553('0x4'));var router=express[_0x9553('0x5')]();var fs_extra=require(_0x9553('0x6'));var auth=require(_0x9553('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x9553('0x8'));var controller=require(_0x9553('0x9'));router['get']('/',auth[_0x9553('0xa')](),controller[_0x9553('0xb')]);router['get'](_0x9553('0xc'),auth['isAuthenticated'](),controller[_0x9553('0xd')]);router[_0x9553('0xe')](_0x9553('0xf'),auth[_0x9553('0xa')](),controller[_0x9553('0x10')]);router[_0x9553('0x11')]('/',auth[_0x9553('0xa')](),controller['create']);router[_0x9553('0x12')](_0x9553('0xf'),auth[_0x9553('0xa')](),controller['update']);router['delete'](_0x9553('0xf'),auth[_0x9553('0xa')](),controller[_0x9553('0x13')]);module[_0x9553('0x14')]=router; \ No newline at end of file +var _0x7bc7=['multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','show','create','put','update','delete','destroy'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7bc7,0x8c));var _0x77bc=function(_0x5bdad6,_0x665e9a){_0x5bdad6=_0x5bdad6-0x0;var _0x223c78=_0x7bc7[_0x5bdad6];return _0x223c78;};'use strict';var multer=require(_0x77bc('0x0'));var util=require('util');var path=require(_0x77bc('0x1'));var timeout=require(_0x77bc('0x2'));var express=require('express');var router=express[_0x77bc('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x77bc('0x4'));var interaction=require(_0x77bc('0x5'));var config=require(_0x77bc('0x6'));var controller=require(_0x77bc('0x7'));router[_0x77bc('0x8')]('/',auth['isAuthenticated'](),controller[_0x77bc('0x9')]);router[_0x77bc('0x8')](_0x77bc('0xa'),auth[_0x77bc('0xb')](),controller[_0x77bc('0xc')]);router[_0x77bc('0x8')](_0x77bc('0xd'),auth[_0x77bc('0xb')](),controller[_0x77bc('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x77bc('0xf')]);router[_0x77bc('0x10')](_0x77bc('0xd'),auth[_0x77bc('0xb')](),controller[_0x77bc('0x11')]);router[_0x77bc('0x12')](_0x77bc('0xd'),auth['isAuthenticated'](),controller[_0x77bc('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 76230d7..bd151e2 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 _0x4a8a=['timeout','INTEGER','sequelize','exports','STRING','mouseOver'];(function(_0x9e74e6,_0x27eaf4){var _0x14de1c=function(_0x5a4163){while(--_0x5a4163){_0x9e74e6['push'](_0x9e74e6['shift']());}};_0x14de1c(++_0x27eaf4);}(_0x4a8a,0x182));var _0xa4a8=function(_0xfedc72,_0x292f02){_0xfedc72=_0xfedc72-0x0;var _0x2c7c78=_0x4a8a[_0xfedc72];return _0x2c7c78;};'use strict';var Sequelize=require(_0xa4a8('0x0'));module[_0xa4a8('0x1')]={'name':{'type':Sequelize[_0xa4a8('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xa4a8('0x3'),_0xa4a8('0x4')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0xa4a8('0x2')]},'timeout':{'type':Sequelize[_0xa4a8('0x5')]}}; \ No newline at end of file +var _0xda68=['ENUM','timeout','STRING','INTEGER','sequelize','exports'];(function(_0x293837,_0x4d44e3){var _0x2d84d2=function(_0x4caa58){while(--_0x4caa58){_0x293837['push'](_0x293837['shift']());}};_0x2d84d2(++_0x4d44e3);}(_0xda68,0x76));var _0x8da6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xda68[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x8da6('0x0'));module[_0x8da6('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x8da6('0x2')]('mouseOver',_0x8da6('0x3')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0x8da6('0x4')]},'timeout':{'type':Sequelize[_0x8da6('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 17a1321..4f1b1e2 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 _0xb717=['limit','count','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','includeAll','include','merge','ChatProactiveAction','find','catch','create','body','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined'];(function(_0x25e10c,_0x49596a){var _0x5dfd94=function(_0x2f4bfb){while(--_0x2f4bfb){_0x25e10c['push'](_0x25e10c['shift']());}};_0x5dfd94(++_0x49596a);}(_0xb717,0x1b4));var _0x7b71=function(_0xed6bab,_0x5b0a47){_0xed6bab=_0xed6bab-0x0;var _0x45c2b0=_0xb717[_0xed6bab];return _0x45c2b0;};'use strict';var emlformat=require(_0x7b71('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7b71('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7b71('0x2'));var moment=require(_0x7b71('0x3'));var BPromise=require(_0x7b71('0x4'));var Mustache=require('mustache');var util=require(_0x7b71('0x5'));var path=require(_0x7b71('0x6'));var sox=require(_0x7b71('0x7'));var csv=require(_0x7b71('0x8'));var ejs=require(_0x7b71('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7b71('0xa'));var squel=require(_0x7b71('0xb'));var crypto=require(_0x7b71('0xc'));var jsforce=require(_0x7b71('0xd'));var deskjs=require(_0x7b71('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7b71('0xf'));var Papa=require(_0x7b71('0x10'));var Redis=require('ioredis');var authService=require(_0x7b71('0x11'));var qs=require(_0x7b71('0x12'));var as=require(_0x7b71('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7b71('0x14'))('api');var utils=require(_0x7b71('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x7b71('0x16'));var db=require(_0x7b71('0x17'))['db'];function respondWithStatusCode(_0x291ba5,_0x101181){_0x101181=_0x101181||0xcc;return function(_0x45c890){if(_0x45c890){return _0x291ba5['sendStatus'](_0x101181);}return _0x291ba5[_0x7b71('0x18')](_0x101181)['end']();};}function respondWithResult(_0x121e8f,_0x22114a){_0x22114a=_0x22114a||0xc8;return function(_0x4f1f41){if(_0x4f1f41){return _0x121e8f[_0x7b71('0x18')](_0x22114a)[_0x7b71('0x19')](_0x4f1f41);}};}function respondWithFilteredResult(_0x4266e5,_0x5888f9){return function(_0x5e7c3a){if(_0x5e7c3a){var _0xadd51e=typeof _0x5888f9[_0x7b71('0x1a')]===_0x7b71('0x1b')&&typeof _0x5888f9[_0x7b71('0x1c')]==='undefined';var _0x268090=_0x5e7c3a['count'];var _0x4adce8=_0xadd51e?0x0:_0x5888f9[_0x7b71('0x1a')];var _0xbde25=_0xadd51e?_0x5e7c3a[_0x7b71('0x1d')]:_0x5888f9[_0x7b71('0x1a')]+_0x5888f9[_0x7b71('0x1c')];var _0x51d647;if(_0xbde25>=_0x268090){_0xbde25=_0x268090;_0x51d647=0xc8;}else{_0x51d647=0xce;}_0x4266e5[_0x7b71('0x18')](_0x51d647);return _0x4266e5[_0x7b71('0x1e')](_0x7b71('0x1f'),_0x4adce8+'-'+_0xbde25+'/'+_0x268090)[_0x7b71('0x19')](_0x5e7c3a);}return null;};}function patchUpdates(_0x206000){return function(_0x297918){try{jsonpatch['apply'](_0x297918,_0x206000,!![]);}catch(_0x459c8b){return BPromise[_0x7b71('0x20')](_0x459c8b);}return _0x297918[_0x7b71('0x21')]();};}function saveUpdates(_0x375f85,_0x47d933){return function(_0x55ed9c){if(_0x55ed9c){return _0x55ed9c[_0x7b71('0x22')](_0x375f85)[_0x7b71('0x23')](function(_0x467f1a){return _0x467f1a;});}return null;};}function removeEntity(_0x33ad80,_0x3aca34){return function(_0x478dd8){if(_0x478dd8){return _0x478dd8[_0x7b71('0x24')]()['then'](function(){_0x33ad80[_0x7b71('0x18')](0xcc)[_0x7b71('0x25')]();});}};}function handleEntityNotFound(_0x19a6f5,_0x292430){return function(_0x49ce76){if(!_0x49ce76){_0x19a6f5['sendStatus'](0x194);}return _0x49ce76;};}function handleError(_0x103774,_0x28841d){_0x28841d=_0x28841d||0x1f4;return function(_0x598102){logger[_0x7b71('0x26')](_0x598102[_0x7b71('0x27')]);if(_0x598102[_0x7b71('0x28')]){delete _0x598102[_0x7b71('0x28')];}_0x103774[_0x7b71('0x18')](_0x28841d)['send'](_0x598102);};}exports['show']=function(_0x2b323b,_0x57c86c){var _0x360d4c={'raw':!![],'where':{'id':_0x2b323b[_0x7b71('0x29')]['id']}},_0x514237={};_0x514237[_0x7b71('0x2a')]=_[_0x7b71('0x2b')](db['ChatProactiveAction'][_0x7b71('0x2c')]);_0x514237[_0x7b71('0x2d')]=_[_0x7b71('0x2b')](_0x2b323b['query']);_0x514237[_0x7b71('0x2e')]=_[_0x7b71('0x2f')](_0x514237[_0x7b71('0x2a')],_0x514237[_0x7b71('0x2d')]);_0x360d4c[_0x7b71('0x30')]=_[_0x7b71('0x2f')](_0x514237[_0x7b71('0x2a')],qs[_0x7b71('0x31')](_0x2b323b['query'][_0x7b71('0x31')]));_0x360d4c[_0x7b71('0x30')]=_0x360d4c[_0x7b71('0x30')]['length']?_0x360d4c[_0x7b71('0x30')]:_0x514237[_0x7b71('0x2a')];if(_0x2b323b[_0x7b71('0x2d')][_0x7b71('0x32')]){_0x360d4c[_0x7b71('0x33')]=[{'all':!![]}];}_0x360d4c=_[_0x7b71('0x34')]({},_0x360d4c,_0x2b323b['options']);return db[_0x7b71('0x35')][_0x7b71('0x36')](_0x360d4c)[_0x7b71('0x23')](handleEntityNotFound(_0x57c86c,null))[_0x7b71('0x23')](respondWithResult(_0x57c86c,null))[_0x7b71('0x37')](handleError(_0x57c86c,null));};exports['create']=function(_0x32bcbd,_0x31e0d1){return db[_0x7b71('0x35')][_0x7b71('0x38')](_0x32bcbd[_0x7b71('0x39')],{})[_0x7b71('0x23')](respondWithResult(_0x31e0d1,0xc9))[_0x7b71('0x37')](handleError(_0x31e0d1,null));};exports[_0x7b71('0x22')]=function(_0x53fffa,_0x3be99c){if(_0x53fffa[_0x7b71('0x39')]['id']){delete _0x53fffa[_0x7b71('0x39')]['id'];}return db[_0x7b71('0x35')][_0x7b71('0x36')]({'where':{'id':_0x53fffa[_0x7b71('0x29')]['id']}})[_0x7b71('0x23')](handleEntityNotFound(_0x3be99c,null))['then'](saveUpdates(_0x53fffa[_0x7b71('0x39')],null))[_0x7b71('0x23')](respondWithResult(_0x3be99c,null))[_0x7b71('0x37')](handleError(_0x3be99c,null));};exports[_0x7b71('0x24')]=function(_0x568c7b,_0x15676c){return db[_0x7b71('0x35')][_0x7b71('0x36')]({'where':{'id':_0x568c7b[_0x7b71('0x29')]['id']}})[_0x7b71('0x23')](handleEntityNotFound(_0x15676c,null))[_0x7b71('0x23')](removeEntity(_0x15676c,null))[_0x7b71('0x37')](handleError(_0x15676c,null));}; \ No newline at end of file +var _0x9f75=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','show','params','model','ChatProactiveAction','rawAttributes','query','keys','filters','intersection','attributes','fields','length','include','merge','options','find','catch','create','body','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring'];(function(_0x2b3696,_0x2b45ca){var _0x56a91c=function(_0x1723c6){while(--_0x1723c6){_0x2b3696['push'](_0x2b3696['shift']());}};_0x56a91c(++_0x2b45ca);}(_0x9f75,0x15a));var _0x59f7=function(_0x4fc100,_0x177252){_0x4fc100=_0x4fc100-0x0;var _0x2d204a=_0x9f75[_0x4fc100];return _0x2d204a;};'use strict';var emlformat=require(_0x59f7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x59f7('0x1'));var jsonpatch=require(_0x59f7('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x59f7('0x3'));var Mustache=require(_0x59f7('0x4'));var util=require(_0x59f7('0x5'));var path=require(_0x59f7('0x6'));var sox=require('sox');var csv=require(_0x59f7('0x7'));var ejs=require(_0x59f7('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x59f7('0x9'));var crypto=require(_0x59f7('0xa'));var jsforce=require(_0x59f7('0xb'));var deskjs=require(_0x59f7('0xc'));var toCsv=require(_0x59f7('0x7'));var querystring=require(_0x59f7('0xd'));var Papa=require('papaparse');var Redis=require(_0x59f7('0xe'));var authService=require(_0x59f7('0xf'));var qs=require(_0x59f7('0x10'));var as=require(_0x59f7('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x59f7('0x12'))('api');var utils=require(_0x59f7('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x59f7('0x14'));var db=require(_0x59f7('0x15'))['db'];function respondWithStatusCode(_0x4cee9f,_0x585044){_0x585044=_0x585044||0xcc;return function(_0xf44f98){if(_0xf44f98){return _0x4cee9f[_0x59f7('0x16')](_0x585044);}return _0x4cee9f[_0x59f7('0x17')](_0x585044)[_0x59f7('0x18')]();};}function respondWithResult(_0x3b97ec,_0x2e9923){_0x2e9923=_0x2e9923||0xc8;return function(_0x5c5167){if(_0x5c5167){return _0x3b97ec['status'](_0x2e9923)['json'](_0x5c5167);}};}function respondWithFilteredResult(_0x232f99,_0x512067){return function(_0xa3aa79){if(_0xa3aa79){var _0x446b66=typeof _0x512067[_0x59f7('0x19')]===_0x59f7('0x1a')&&typeof _0x512067[_0x59f7('0x1b')]===_0x59f7('0x1a');var _0x21ca8d=_0xa3aa79[_0x59f7('0x1c')];var _0x2f1d2b=_0x446b66?0x0:_0x512067[_0x59f7('0x19')];var _0x1f14f4=_0x446b66?_0xa3aa79[_0x59f7('0x1c')]:_0x512067['offset']+_0x512067[_0x59f7('0x1b')];var _0x21d0af;if(_0x1f14f4>=_0x21ca8d){_0x1f14f4=_0x21ca8d;_0x21d0af=0xc8;}else{_0x21d0af=0xce;}_0x232f99[_0x59f7('0x17')](_0x21d0af);return _0x232f99[_0x59f7('0x1d')](_0x59f7('0x1e'),_0x2f1d2b+'-'+_0x1f14f4+'/'+_0x21ca8d)[_0x59f7('0x1f')](_0xa3aa79);}return null;};}function patchUpdates(_0x4986ce){return function(_0x2d2990){try{jsonpatch[_0x59f7('0x20')](_0x2d2990,_0x4986ce,!![]);}catch(_0x5f4394){return BPromise[_0x59f7('0x21')](_0x5f4394);}return _0x2d2990[_0x59f7('0x22')]();};}function saveUpdates(_0x2d658c,_0x2ca762){return function(_0x1a4d80){if(_0x1a4d80){return _0x1a4d80[_0x59f7('0x23')](_0x2d658c)[_0x59f7('0x24')](function(_0x25c521){return _0x25c521;});}return null;};}function removeEntity(_0x1cc78d,_0xeff590){return function(_0x1cdb9f){if(_0x1cdb9f){return _0x1cdb9f[_0x59f7('0x25')]()[_0x59f7('0x24')](function(){_0x1cc78d[_0x59f7('0x17')](0xcc)[_0x59f7('0x18')]();});}};}function handleEntityNotFound(_0x2b83c0,_0xd2ea31){return function(_0x1edda0){if(!_0x1edda0){_0x2b83c0[_0x59f7('0x16')](0x194);}return _0x1edda0;};}function handleError(_0x38a21c,_0x246ab4){_0x246ab4=_0x246ab4||0x1f4;return function(_0x5751f0){logger[_0x59f7('0x26')](_0x5751f0['stack']);if(_0x5751f0[_0x59f7('0x27')]){delete _0x5751f0['name'];}_0x38a21c[_0x59f7('0x17')](_0x246ab4)[_0x59f7('0x28')](_0x5751f0);};}exports[_0x59f7('0x29')]=function(_0x4c01f9,_0x659655){var _0x179526={'raw':!![],'where':{'id':_0x4c01f9[_0x59f7('0x2a')]['id']}},_0x392b5f={};_0x392b5f[_0x59f7('0x2b')]=_['keys'](db[_0x59f7('0x2c')][_0x59f7('0x2d')]);_0x392b5f[_0x59f7('0x2e')]=_[_0x59f7('0x2f')](_0x4c01f9[_0x59f7('0x2e')]);_0x392b5f[_0x59f7('0x30')]=_[_0x59f7('0x31')](_0x392b5f[_0x59f7('0x2b')],_0x392b5f['query']);_0x179526[_0x59f7('0x32')]=_['intersection'](_0x392b5f['model'],qs[_0x59f7('0x33')](_0x4c01f9[_0x59f7('0x2e')]['fields']));_0x179526[_0x59f7('0x32')]=_0x179526[_0x59f7('0x32')][_0x59f7('0x34')]?_0x179526[_0x59f7('0x32')]:_0x392b5f[_0x59f7('0x2b')];if(_0x4c01f9[_0x59f7('0x2e')]['includeAll']){_0x179526[_0x59f7('0x35')]=[{'all':!![]}];}_0x179526=_[_0x59f7('0x36')]({},_0x179526,_0x4c01f9[_0x59f7('0x37')]);return db[_0x59f7('0x2c')][_0x59f7('0x38')](_0x179526)[_0x59f7('0x24')](handleEntityNotFound(_0x659655,null))[_0x59f7('0x24')](respondWithResult(_0x659655,null))[_0x59f7('0x39')](handleError(_0x659655,null));};exports[_0x59f7('0x3a')]=function(_0x5d0c87,_0x42aedc){return db['ChatProactiveAction'][_0x59f7('0x3a')](_0x5d0c87['body'],{})[_0x59f7('0x24')](respondWithResult(_0x42aedc,0xc9))['catch'](handleError(_0x42aedc,null));};exports['update']=function(_0x494b26,_0x4ab3c5){if(_0x494b26[_0x59f7('0x3b')]['id']){delete _0x494b26[_0x59f7('0x3b')]['id'];}return db[_0x59f7('0x2c')][_0x59f7('0x38')]({'where':{'id':_0x494b26[_0x59f7('0x2a')]['id']}})[_0x59f7('0x24')](handleEntityNotFound(_0x4ab3c5,null))[_0x59f7('0x24')](saveUpdates(_0x494b26[_0x59f7('0x3b')],null))[_0x59f7('0x24')](respondWithResult(_0x4ab3c5,null))[_0x59f7('0x39')](handleError(_0x4ab3c5,null));};exports[_0x59f7('0x25')]=function(_0x32d108,_0x4062fa){return db[_0x59f7('0x2c')][_0x59f7('0x38')]({'where':{'id':_0x32d108[_0x59f7('0x2a')]['id']}})[_0x59f7('0x24')](handleEntityNotFound(_0x4062fa,null))[_0x59f7('0x24')](removeEntity(_0x4062fa,null))[_0x59f7('0x39')](handleError(_0x4062fa,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index c67ce58..3d42033 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 _0xa830=['rimraf','../../config/environment','./chatProactiveAction.attributes','exports','ChatProactiveAction','lodash','util','moment','bluebird','request-promise'];(function(_0x3a2b17,_0x57d0f3){var _0x413e3c=function(_0x175aa5){while(--_0x175aa5){_0x3a2b17['push'](_0x3a2b17['shift']());}};_0x413e3c(++_0x57d0f3);}(_0xa830,0x131));var _0x0a83=function(_0x254d9f,_0x54ddb5){_0x254d9f=_0x254d9f-0x0;var _0x1eedb9=_0xa830[_0x254d9f];return _0x1eedb9;};'use strict';var _=require(_0x0a83('0x0'));var util=require(_0x0a83('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0a83('0x2'));var BPromise=require(_0x0a83('0x3'));var rp=require(_0x0a83('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0a83('0x5'));var config=require(_0x0a83('0x6'));var attributes=require(_0x0a83('0x7'));module[_0x0a83('0x8')]=function(_0x5bd97a,_0x56ca1f){return _0x5bd97a['define'](_0x0a83('0x9'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f1f=['define','util','../../config/logger','api','request-promise','path','rimraf','./chatProactiveAction.attributes','exports'];(function(_0x425f01,_0x383af5){var _0x455e9d=function(_0x4bb062){while(--_0x4bb062){_0x425f01['push'](_0x425f01['shift']());}};_0x455e9d(++_0x383af5);}(_0x9f1f,0xc7));var _0xf9f1=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x9f1f[_0x4a747d];return _0x3a5b5c;};'use strict';var _=require('lodash');var util=require(_0xf9f1('0x0'));var logger=require(_0xf9f1('0x1'))(_0xf9f1('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf9f1('0x3'));var fs=require('fs');var path=require(_0xf9f1('0x4'));var rimraf=require(_0xf9f1('0x5'));var config=require('../../config/environment');var attributes=require(_0xf9f1('0x6'));module[_0xf9f1('0x7')]=function(_0x40ad8b,_0x214725){return _0x40ad8b[_0xf9f1('0x8')]('ChatProactiveAction',attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 8fd08c4..d114404 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 _0x6321=['jayson/promise','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x6321,0x158));var _0x1632=function(_0x5b95f3,_0x576375){_0x5b95f3=_0x5b95f3-0x0;var _0x58a5ef=_0x6321[_0x5b95f3];return _0x58a5ef;};'use strict';var _=require(_0x1632('0x0'));var util=require(_0x1632('0x1'));var moment=require('moment');var BPromise=require(_0x1632('0x2'));var rs=require(_0x1632('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1632('0x4'))['db'];var utils=require(_0x1632('0x5'));var logger=require(_0x1632('0x6'))(_0x1632('0x7'));var config=require('../../config/environment');var jayson=require(_0x1632('0x8'));var client=jayson[_0x1632('0x9')][_0x1632('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52ba65,_0x2ad7dc,_0x5cbf44){return new BPromise(function(_0x42f940,_0x367f8d){return client[_0x1632('0xb')](_0x52ba65,_0x5cbf44)[_0x1632('0xc')](function(_0x1b1c9c){logger[_0x1632('0xd')](_0x1632('0xe'),_0x2ad7dc,_0x1632('0xf'));logger[_0x1632('0x10')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x2ad7dc,'request\x20sent',JSON[_0x1632('0x11')](_0x1b1c9c));if(_0x1b1c9c[_0x1632('0x12')]){if(_0x1b1c9c[_0x1632('0x12')]['code']===0x1f4){logger[_0x1632('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x2ad7dc,_0x1b1c9c['error'][_0x1632('0x13')]);return _0x367f8d(_0x1b1c9c[_0x1632('0x12')][_0x1632('0x13')]);}logger[_0x1632('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x2ad7dc,_0x1b1c9c['error'][_0x1632('0x13')]);return _0x42f940(_0x1b1c9c[_0x1632('0x12')][_0x1632('0x13')]);}else{logger[_0x1632('0xd')](_0x1632('0xe'),_0x2ad7dc,'request\x20sent');_0x42f940(_0x1b1c9c[_0x1632('0x14')][_0x1632('0x13')]);}})[_0x1632('0x15')](function(_0x2a4434){logger['error'](_0x1632('0xe'),_0x2ad7dc,_0x2a4434);_0x367f8d(_0x2a4434);});});} \ No newline at end of file +var _0x753c=['request','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5b3e6e,_0x210ab2){var _0x493c1d=function(_0x400d0d){while(--_0x400d0d){_0x5b3e6e['push'](_0x5b3e6e['shift']());}};_0x493c1d(++_0x210ab2);}(_0x753c,0x79));var _0xc753=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x753c[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0xc753('0x0'));var util=require(_0xc753('0x1'));var moment=require(_0xc753('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc753('0x3'));var db=require(_0xc753('0x4'))['db'];var utils=require(_0xc753('0x5'));var logger=require('../../config/logger')(_0xc753('0x6'));var config=require(_0xc753('0x7'));var jayson=require(_0xc753('0x8'));var client=jayson[_0xc753('0x9')][_0xc753('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e55e8,_0x272691,_0x33c5b3){return new BPromise(function(_0x1c0e83,_0x216e92){return client[_0xc753('0xb')](_0x4e55e8,_0x33c5b3)['then'](function(_0x49df66){logger['info'](_0xc753('0xc'),_0x272691,_0xc753('0xd'));logger[_0xc753('0xe')](_0xc753('0xf'),_0x272691,_0xc753('0xd'),JSON[_0xc753('0x10')](_0x49df66));if(_0x49df66[_0xc753('0x11')]){if(_0x49df66[_0xc753('0x11')][_0xc753('0x12')]===0x1f4){logger['error'](_0xc753('0xc'),_0x272691,_0x49df66[_0xc753('0x11')][_0xc753('0x13')]);return _0x216e92(_0x49df66['error']['message']);}logger[_0xc753('0x11')]('ChatProactiveAction,\x20%s,\x20%s',_0x272691,_0x49df66['error'][_0xc753('0x13')]);return _0x1c0e83(_0x49df66[_0xc753('0x11')][_0xc753('0x13')]);}else{logger[_0xc753('0x14')]('ChatProactiveAction,\x20%s,\x20%s',_0x272691,_0xc753('0xd'));_0x1c0e83(_0x49df66[_0xc753('0x15')][_0xc753('0x13')]);}})['catch'](function(_0x1b515d){logger[_0xc753('0x11')](_0xc753('0xc'),_0x272691,_0x1b515d);_0x216e92(_0x1b515d);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index ecfb422..dad08bc 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 _0x7fbe=['show','post','create','put','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated'];(function(_0x1e70e2,_0x2dbc29){var _0x3aff27=function(_0x3625d2){while(--_0x3625d2){_0x1e70e2['push'](_0x1e70e2['shift']());}};_0x3aff27(++_0x2dbc29);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x38223f,_0x3a0dfc){_0x38223f=_0x38223f-0x0;var _0x3e3fab=_0x7fbe[_0x38223f];return _0x3e3fab;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var fs_extra=require(_0xe7fb('0x4'));var auth=require(_0xe7fb('0x5'));var interaction=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var controller=require(_0xe7fb('0x8'));router[_0xe7fb('0x9')](_0xe7fb('0xa'),auth[_0xe7fb('0xb')](),controller[_0xe7fb('0xc')]);router[_0xe7fb('0xd')]('/',auth['isAuthenticated'](),controller[_0xe7fb('0xe')]);router[_0xe7fb('0xf')](_0xe7fb('0xa'),auth[_0xe7fb('0xb')](),controller['update']);router['delete'](_0xe7fb('0xa'),auth[_0xe7fb('0xb')](),controller[_0xe7fb('0x10')]);module[_0xe7fb('0x11')]=router; \ No newline at end of file +var _0xae24=['destroy','exports','multer','path','express','Router','../../components/interaction/service','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','put','update','delete'];(function(_0x544cd7,_0x20f588){var _0x43c000=function(_0x3d71cf){while(--_0x3d71cf){_0x544cd7['push'](_0x544cd7['shift']());}};_0x43c000(++_0x20f588);}(_0xae24,0x182));var _0x4ae2=function(_0x3735f4,_0x3c81c2){_0x3735f4=_0x3735f4-0x0;var _0x40e0e3=_0xae24[_0x3735f4];return _0x40e0e3;};'use strict';var multer=require(_0x4ae2('0x0'));var util=require('util');var path=require(_0x4ae2('0x1'));var timeout=require('connect-timeout');var express=require(_0x4ae2('0x2'));var router=express[_0x4ae2('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4ae2('0x4'));var config=require('../../config/environment');var controller=require(_0x4ae2('0x5'));router[_0x4ae2('0x6')](_0x4ae2('0x7'),auth[_0x4ae2('0x8')](),controller[_0x4ae2('0x9')]);router[_0x4ae2('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4ae2('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x4ae2('0xc')]);router[_0x4ae2('0xd')]('/:id',auth[_0x4ae2('0x8')](),controller[_0x4ae2('0xe')]);module[_0x4ae2('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 41ea1e4..e485868 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 _0x82d0=['sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x1395eb,_0x271736){var _0x2f0c26=function(_0xb19134){while(--_0xb19134){_0x1395eb['push'](_0x1395eb['shift']());}};_0x2f0c26(++_0x271736);}(_0x82d0,0x120));var _0x082d=function(_0x312428,_0x458f28){_0x312428=_0x312428-0x0;var _0x583514=_0x82d0[_0x312428];return _0x583514;};'use strict';var Sequelize=require(_0x082d('0x0'));module[_0x082d('0x1')]={'name':{'type':Sequelize[_0x082d('0x2')],'unique':_0x082d('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x082d('0x2')]},'timeout':{'type':Sequelize[_0x082d('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x082d('0x5')](_0x082d('0x6'),_0x082d('0x7'),'roundrobin')}}; \ No newline at end of file +var _0x803c=['roundrobin','sequelize','STRING','name','ENUM','rrmemory'];(function(_0x163b15,_0x35758d){var _0xa1fc11=function(_0x1dc11f){while(--_0x1dc11f){_0x163b15['push'](_0x163b15['shift']());}};_0xa1fc11(++_0x35758d);}(_0x803c,0xd3));var _0xc803=function(_0x3b2df4,_0x524a3e){_0x3b2df4=_0x3b2df4-0x0;var _0x2d9395=_0x803c[_0x3b2df4];return _0x2d9395;};'use strict';var Sequelize=require(_0xc803('0x0'));module['exports']={'name':{'type':Sequelize[_0xc803('0x1')],'unique':_0xc803('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc803('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc803('0x3')](_0xc803('0x4'),'beepall',_0xc803('0x5'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index e7d3c5b..fc55aac 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 _0xbbea=['getAgents','zip-dir','moment','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','client','http','request','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','get','ChatQueues','UserProfileResource','destroy','end','name','index','ChatQueue','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','map','type','VIRTUAL','options','show','params','includeAll','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','UserChatQueue','nolimit','findAll','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','findOne','Team','order','addTeams','Agents','online','interface','flatMap','sequelize','transaction','each','forEach','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','union','compact','removeAgents','emit','userChatQueue:remove','addAgents','ids','omit','isArray'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xbbea,0x95));var _0xabbe=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xbbea[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xabbe('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xabbe('0x1'));var BPromise=require(_0xabbe('0x2'));var Mustache=require('mustache');var util=require(_0xabbe('0x3'));var path=require(_0xabbe('0x4'));var sox=require(_0xabbe('0x5'));var csv=require('to-csv');var ejs=require(_0xabbe('0x6'));var fs=require('fs');var fs_extra=require(_0xabbe('0x7'));var _=require('lodash');var squel=require(_0xabbe('0x8'));var crypto=require(_0xabbe('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xabbe('0xa'));var toCsv=require('to-csv');var querystring=require(_0xabbe('0xb'));var Papa=require(_0xabbe('0xc'));var Redis=require('ioredis');var authService=require(_0xabbe('0xd'));var qs=require(_0xabbe('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xabbe('0xf'));var logger=require(_0xabbe('0x10'))(_0xabbe('0x11'));var utils=require(_0xabbe('0x12'));var config=require(_0xabbe('0x13'));var licenseUtil=require(_0xabbe('0x14'));var db=require('../../mysqldb')['db'];config[_0xabbe('0x15')]=_[_0xabbe('0x16')](config[_0xabbe('0x15')],{'host':_0xabbe('0x17'),'port':0x18eb});var socket=require(_0xabbe('0x18'))(new Redis(config['redis']));require(_0xabbe('0x19'))[_0xabbe('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0xabbe('0x1b')][_0xabbe('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x51f933,_0x500c13,_0x4d1c31,_0x2e7ff7){return new BPromise(function(_0x3bfcee,_0x14b567){var _0x4d2b1c=_0x2e7ff7||client;return _0x4d2b1c[_0xabbe('0x1d')](_0x51f933,_0x4d1c31)['then'](function(_0x57001d){logger[_0xabbe('0x1e')]('ChatQueue,\x20%s,\x20%s',_0x500c13,_0xabbe('0x1f'));logger[_0xabbe('0x20')](_0xabbe('0x21'),_0x500c13,'request\x20sent',JSON['stringify'](_0x57001d));if(_0x57001d[_0xabbe('0x22')]){if(_0x57001d[_0xabbe('0x22')][_0xabbe('0x23')]===0x1f4){logger[_0xabbe('0x22')](_0xabbe('0x24'),_0x500c13,_0x57001d[_0xabbe('0x22')]['message']);return _0x14b567(_0x57001d[_0xabbe('0x22')][_0xabbe('0x25')]);}logger[_0xabbe('0x22')](_0xabbe('0x24'),_0x500c13,_0x57001d[_0xabbe('0x22')][_0xabbe('0x25')]);return _0x3bfcee(_0x57001d['error']['message']);}else{logger['info'](_0xabbe('0x24'),_0x500c13,_0xabbe('0x1f'));_0x3bfcee(_0x57001d[_0xabbe('0x26')][_0xabbe('0x25')]);}})[_0xabbe('0x27')](function(_0x2fcfc4){logger['error']('ChatQueue,\x20%s,\x20%s',_0x500c13,_0x2fcfc4);_0x14b567(_0x2fcfc4);});});}function respondWithStatusCode(_0x5b2af6,_0x249ca9){_0x249ca9=_0x249ca9||0xcc;return function(_0x192bd9){if(_0x192bd9){return _0x5b2af6[_0xabbe('0x28')](_0x249ca9);}return _0x5b2af6[_0xabbe('0x29')](_0x249ca9)['end']();};}function respondWithResult(_0x245933,_0x1e73b8){_0x1e73b8=_0x1e73b8||0xc8;return function(_0x12efec){if(_0x12efec){return _0x245933[_0xabbe('0x29')](_0x1e73b8)[_0xabbe('0x2a')](_0x12efec);}};}function respondWithFilteredResult(_0x3e2792,_0x501f3d){return function(_0x482973){if(_0x482973){var _0x419d62=typeof _0x501f3d[_0xabbe('0x2b')]===_0xabbe('0x2c')&&typeof _0x501f3d['limit']===_0xabbe('0x2c');var _0x41bc9f=_0x482973[_0xabbe('0x2d')];var _0x54fda6=_0x419d62?0x0:_0x501f3d['offset'];var _0x4a5c6d=_0x419d62?_0x482973[_0xabbe('0x2d')]:_0x501f3d[_0xabbe('0x2b')]+_0x501f3d[_0xabbe('0x2e')];var _0xdc1978;if(_0x4a5c6d>=_0x41bc9f){_0x4a5c6d=_0x41bc9f;_0xdc1978=0xc8;}else{_0xdc1978=0xce;}_0x3e2792[_0xabbe('0x29')](_0xdc1978);return _0x3e2792[_0xabbe('0x2f')](_0xabbe('0x30'),_0x54fda6+'-'+_0x4a5c6d+'/'+_0x41bc9f)['json'](_0x482973);}return null;};}function patchUpdates(_0x46fffd){return function(_0x2e8aa2){try{jsonpatch[_0xabbe('0x31')](_0x2e8aa2,_0x46fffd,!![]);}catch(_0x22c2ef){return BPromise['reject'](_0x22c2ef);}return _0x2e8aa2['save']();};}function saveUpdates(_0x3f1c6e,_0x5f2f35){return function(_0x10e2b4){if(_0x10e2b4){return _0x10e2b4[_0xabbe('0x32')](_0x3f1c6e)[_0xabbe('0x33')](function(_0x2ecaff){return _0x2ecaff;});}return null;};}function removeEntity(_0x1185e5,_0x23813a){return function(_0x595d4d){if(_0x595d4d){return _0x595d4d['destroy']()[_0xabbe('0x33')](function(){var _0x5c6679=_0x595d4d[_0xabbe('0x34')]({'plain':!![]});var _0x7e7766=_0xabbe('0x35');return db[_0xabbe('0x36')][_0xabbe('0x37')]({'where':{'type':_0x7e7766,'resourceId':_0x5c6679['id']}})[_0xabbe('0x33')](function(){return _0x595d4d;});})[_0xabbe('0x33')](function(){_0x1185e5[_0xabbe('0x29')](0xcc)[_0xabbe('0x38')]();});}};}function handleEntityNotFound(_0x1ae953,_0x4a2d6f){return function(_0x3ab75d){if(!_0x3ab75d){_0x1ae953[_0xabbe('0x28')](0x194);}return _0x3ab75d;};}function handleError(_0x330dc7,_0x27390f){_0x27390f=_0x27390f||0x1f4;return function(_0x1615c9){logger['error'](_0x1615c9['stack']);if(_0x1615c9[_0xabbe('0x39')]){delete _0x1615c9[_0xabbe('0x39')];}_0x330dc7[_0xabbe('0x29')](_0x27390f)['send'](_0x1615c9);};}exports[_0xabbe('0x3a')]=function(_0x393d2d,_0x1fa7ff){var _0x1aedda={},_0x519816={},_0x58d9fa={'count':0x0,'rows':[]};var _0x42dd47=_['map'](db[_0xabbe('0x3b')][_0xabbe('0x3c')],function(_0x1c3add){return{'name':_0x1c3add['fieldName'],'type':_0x1c3add['type'][_0xabbe('0x3d')]};});_0x519816[_0xabbe('0x3e')]=_['map'](_0x42dd47,_0xabbe('0x39'));_0x519816[_0xabbe('0x3f')]=_[_0xabbe('0x40')](_0x393d2d[_0xabbe('0x3f')]);_0x519816[_0xabbe('0x41')]=_[_0xabbe('0x42')](_0x519816[_0xabbe('0x3e')],_0x519816[_0xabbe('0x3f')]);_0x1aedda['attributes']=_['intersection'](_0x519816['model'],qs[_0xabbe('0x43')](_0x393d2d[_0xabbe('0x3f')][_0xabbe('0x43')]));_0x1aedda[_0xabbe('0x44')]=_0x1aedda['attributes'][_0xabbe('0x45')]?_0x1aedda[_0xabbe('0x44')]:_0x519816[_0xabbe('0x3e')];if(!_0x393d2d[_0xabbe('0x3f')][_0xabbe('0x46')]('nolimit')){_0x1aedda[_0xabbe('0x2e')]=qs[_0xabbe('0x2e')](_0x393d2d['query'][_0xabbe('0x2e')]);_0x1aedda[_0xabbe('0x2b')]=qs[_0xabbe('0x2b')](_0x393d2d[_0xabbe('0x3f')][_0xabbe('0x2b')]);}_0x1aedda['order']=qs[_0xabbe('0x47')](_0x393d2d[_0xabbe('0x3f')][_0xabbe('0x47')]);_0x1aedda[_0xabbe('0x48')]=qs[_0xabbe('0x41')](_[_0xabbe('0x49')](_0x393d2d[_0xabbe('0x3f')],_0x519816[_0xabbe('0x41')]),_0x42dd47);if(_0x393d2d[_0xabbe('0x3f')][_0xabbe('0x4a')]){_0x1aedda[_0xabbe('0x48')]=_[_0xabbe('0x4b')](_0x1aedda['where'],{'$or':_[_0xabbe('0x4c')](_0x42dd47,function(_0x359bea){if(_0x359bea[_0xabbe('0x4d')]!==_0xabbe('0x4e')){var _0x46f52b={};_0x46f52b[_0x359bea[_0xabbe('0x39')]]={'$like':'%'+_0x393d2d[_0xabbe('0x3f')][_0xabbe('0x4a')]+'%'};return _0x46f52b;}})});}_0x1aedda=_['merge']({},_0x1aedda,_0x393d2d[_0xabbe('0x4f')]);var _0x3148f7={'where':_0x1aedda[_0xabbe('0x48')]};return db['ChatQueue'][_0xabbe('0x2d')](_0x3148f7)[_0xabbe('0x33')](function(_0x1a7861){_0x58d9fa[_0xabbe('0x2d')]=_0x1a7861;if(_0x393d2d[_0xabbe('0x3f')]['includeAll']){_0x1aedda['include']=[{'all':!![]}];}return db[_0xabbe('0x3b')]['findAll'](_0x1aedda);})[_0xabbe('0x33')](function(_0x5976bc){_0x58d9fa['rows']=_0x5976bc;return _0x58d9fa;})[_0xabbe('0x33')](respondWithFilteredResult(_0x1fa7ff,_0x1aedda))[_0xabbe('0x27')](handleError(_0x1fa7ff,null));};exports[_0xabbe('0x50')]=function(_0x540994,_0x3d0d10){var _0x25ed27={'raw':!![],'where':{'id':_0x540994[_0xabbe('0x51')]['id']}},_0x15f87b={};_0x15f87b[_0xabbe('0x3e')]=_[_0xabbe('0x40')](db[_0xabbe('0x3b')][_0xabbe('0x3c')]);_0x15f87b[_0xabbe('0x3f')]=_[_0xabbe('0x40')](_0x540994[_0xabbe('0x3f')]);_0x15f87b['filters']=_[_0xabbe('0x42')](_0x15f87b[_0xabbe('0x3e')],_0x15f87b[_0xabbe('0x3f')]);_0x25ed27[_0xabbe('0x44')]=_[_0xabbe('0x42')](_0x15f87b[_0xabbe('0x3e')],qs['fields'](_0x540994[_0xabbe('0x3f')]['fields']));_0x25ed27['attributes']=_0x25ed27['attributes'][_0xabbe('0x45')]?_0x25ed27[_0xabbe('0x44')]:_0x15f87b[_0xabbe('0x3e')];if(_0x540994[_0xabbe('0x3f')][_0xabbe('0x52')]){_0x25ed27[_0xabbe('0x53')]=[{'all':!![]}];}_0x25ed27=_[_0xabbe('0x4b')]({},_0x25ed27,_0x540994[_0xabbe('0x4f')]);return db[_0xabbe('0x3b')][_0xabbe('0x54')](_0x25ed27)[_0xabbe('0x33')](handleEntityNotFound(_0x3d0d10,null))[_0xabbe('0x33')](respondWithResult(_0x3d0d10,null))['catch'](handleError(_0x3d0d10,null));};exports[_0xabbe('0x55')]=function(_0x185438,_0x1d4443){return db[_0xabbe('0x3b')][_0xabbe('0x55')](_0x185438['body'],{})['then'](function(_0x414a12){var _0x3308c5=_0x185438['user'][_0xabbe('0x34')]({'plain':!![]});if(!_0x3308c5)throw new Error(_0xabbe('0x56'));if(_0x3308c5['role']===_0xabbe('0x57')){var _0x414283=_0x414a12[_0xabbe('0x34')]({'plain':!![]});var _0x1a1d5b='ChatQueues';return db[_0xabbe('0x58')][_0xabbe('0x54')]({'where':{'name':_0x1a1d5b,'userProfileId':_0x3308c5[_0xabbe('0x59')]},'raw':!![]})['then'](function(_0x307a2e){if(_0x307a2e&&_0x307a2e[_0xabbe('0x5a')]===0x0){return db[_0xabbe('0x36')][_0xabbe('0x55')]({'name':_0x414283[_0xabbe('0x39')],'resourceId':_0x414283['id'],'type':_0x307a2e['name'],'sectionId':_0x307a2e['id']},{})[_0xabbe('0x33')](function(){return _0x414a12;});}else{return _0x414a12;}})['catch'](function(_0x4f0fb7){logger[_0xabbe('0x22')](_0xabbe('0x5b'),_0x4f0fb7);throw _0x4f0fb7;});}return _0x414a12;})[_0xabbe('0x33')](respondWithResult(_0x1d4443,0xc9))['catch'](handleError(_0x1d4443,null));};exports[_0xabbe('0x32')]=function(_0x998032,_0x34eefb){if(_0x998032[_0xabbe('0x5c')]['id']){delete _0x998032[_0xabbe('0x5c')]['id'];}return db[_0xabbe('0x3b')][_0xabbe('0x54')]({'where':{'id':_0x998032[_0xabbe('0x51')]['id']}})[_0xabbe('0x33')](handleEntityNotFound(_0x34eefb,null))[_0xabbe('0x33')](saveUpdates(_0x998032['body'],null))[_0xabbe('0x33')](respondWithResult(_0x34eefb,null))[_0xabbe('0x27')](handleError(_0x34eefb,null));};exports[_0xabbe('0x37')]=function(_0x256a64,_0xd7c9a7){return db[_0xabbe('0x3b')]['find']({'where':{'id':_0x256a64[_0xabbe('0x51')]['id']}})[_0xabbe('0x33')](handleEntityNotFound(_0xd7c9a7,null))[_0xabbe('0x33')](removeEntity(_0xd7c9a7,null))['catch'](handleError(_0xd7c9a7,null));};exports[_0xabbe('0x5d')]=function(_0x7a0b69,_0xe0dde8){return db[_0xabbe('0x3b')]['describe']()[_0xabbe('0x33')](respondWithResult(_0xe0dde8,null))[_0xabbe('0x27')](handleError(_0xe0dde8,null));};exports[_0xabbe('0x5e')]=function(_0x386b3a,_0x5c599c,_0x2cf71c){var _0x4638a3={'raw':!![],'where':{}},_0x49fd89={},_0x53bb5b;return db[_0xabbe('0x3b')]['findOne']({'where':{'id':_0x386b3a[_0xabbe('0x51')]['id']}})[_0xabbe('0x33')](handleEntityNotFound(_0x5c599c,null))['then'](function(_0x17c1a3){if(_0x17c1a3){_0x53bb5b=_0x17c1a3[_0xabbe('0x34')]({'plain':!![]});_0x49fd89['model']=_[_0xabbe('0x40')](db[_0xabbe('0x5f')][_0xabbe('0x3c')]);_0x49fd89['query']=_[_0xabbe('0x40')](_0x386b3a['query']);_0x49fd89[_0xabbe('0x41')]=_[_0xabbe('0x42')](_0x49fd89[_0xabbe('0x3e')],_0x49fd89['query']);_0x4638a3['attributes']=_[_0xabbe('0x42')](_0x49fd89[_0xabbe('0x3e')],qs['fields'](_0x386b3a['query'][_0xabbe('0x43')]));_0x4638a3['attributes']=_0x4638a3[_0xabbe('0x44')][_0xabbe('0x45')]?_0x4638a3[_0xabbe('0x44')]:_0x49fd89['model'];if(!_0x386b3a[_0xabbe('0x3f')][_0xabbe('0x46')](_0xabbe('0x60'))){_0x4638a3[_0xabbe('0x2e')]=qs[_0xabbe('0x2e')](_0x386b3a[_0xabbe('0x3f')][_0xabbe('0x2e')]);_0x4638a3[_0xabbe('0x2b')]=qs['offset'](_0x386b3a[_0xabbe('0x3f')]['offset']);}_0x4638a3['order']=qs[_0xabbe('0x47')](_0x386b3a[_0xabbe('0x3f')][_0xabbe('0x47')]);_0x4638a3[_0xabbe('0x48')]=qs[_0xabbe('0x41')](_['pick'](_0x386b3a[_0xabbe('0x3f')],_0x49fd89[_0xabbe('0x41')]));_0x4638a3['where']['ChatQueueId']=_0x17c1a3['id'];if(_0x386b3a[_0xabbe('0x3f')][_0xabbe('0x4a')]){_0x4638a3[_0xabbe('0x48')]=_[_0xabbe('0x4b')](_0x4638a3[_0xabbe('0x48')],{'$or':_[_0xabbe('0x4c')](_0x4638a3[_0xabbe('0x44')],function(_0x56b6dd){var _0x29b81={};_0x29b81[_0x56b6dd]={'$like':'%'+_0x386b3a[_0xabbe('0x3f')][_0xabbe('0x4a')]+'%'};return _0x29b81;})});}_0x4638a3=_[_0xabbe('0x4b')]({},_0x4638a3,_0x386b3a[_0xabbe('0x4f')]);return db['UserChatQueue'][_0xabbe('0x61')](_0x4638a3);}})[_0xabbe('0x33')](function(_0x4c4510){if(_0x4c4510){return db[_0xabbe('0x62')][_0xabbe('0x63')]({'where':{'id':_[_0xabbe('0x4c')](_0x4c4510,_0xabbe('0x64')),'role':_0xabbe('0x65')},'attributes':['id','name',_0xabbe('0x66'),_0xabbe('0x67'),_0xabbe('0x68')]});}})[_0xabbe('0x33')](function(_0x46f1d9){if(_0x46f1d9){return{'count':_0x46f1d9[_0xabbe('0x2d')],'rows':_['map'](_0x46f1d9[_0xabbe('0x69')],function(_0x464128){return{'membername':_0x464128[_0xabbe('0x39')],'UserId':_0x464128['id'],'queue_name':_0x53bb5b[_0xabbe('0x39')],'ChatQueueId':_0x53bb5b['id'],'interface':util[_0xabbe('0x6a')](_0xabbe('0x6b'),_0xabbe('0x6c'),_0x464128[_0xabbe('0x39')]),'penalty':0x0,'paused':_0x464128[_0xabbe('0x66')],'createdAt':_0x464128[_0xabbe('0x68')],'updatedAt':_0x464128[_0xabbe('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xabbe('0x33')](respondWithFilteredResult(_0x5c599c,_0x4638a3))[_0xabbe('0x27')](handleError(_0x5c599c,null));};exports[_0xabbe('0x6d')]=function(_0x5a547f,_0x10ebe0,_0x4d21c2){var _0x4905ad={};var _0x182a7f={};var _0x481f49;var _0x22672a;return db[_0xabbe('0x3b')][_0xabbe('0x6e')]({'where':{'id':_0x5a547f[_0xabbe('0x51')]['id']}})[_0xabbe('0x33')](handleEntityNotFound(_0x10ebe0,null))[_0xabbe('0x33')](function(_0x4ba9ec){if(_0x4ba9ec){_0x481f49=_0x4ba9ec;_0x182a7f[_0xabbe('0x3e')]=_[_0xabbe('0x40')](db[_0xabbe('0x6f')][_0xabbe('0x3c')]);_0x182a7f[_0xabbe('0x3f')]=_[_0xabbe('0x40')](_0x5a547f[_0xabbe('0x3f')]);_0x182a7f['filters']=_['intersection'](_0x182a7f['model'],_0x182a7f[_0xabbe('0x3f')]);_0x4905ad[_0xabbe('0x44')]=_[_0xabbe('0x42')](_0x182a7f['model'],qs[_0xabbe('0x43')](_0x5a547f['query'][_0xabbe('0x43')]));_0x4905ad['attributes']=_0x4905ad[_0xabbe('0x44')][_0xabbe('0x45')]?_0x4905ad[_0xabbe('0x44')]:_0x182a7f[_0xabbe('0x3e')];_0x4905ad[_0xabbe('0x70')]=qs[_0xabbe('0x47')](_0x5a547f['query']['sort']);_0x4905ad['where']=qs[_0xabbe('0x41')](_[_0xabbe('0x49')](_0x5a547f['query'],_0x182a7f[_0xabbe('0x41')]));if(_0x5a547f[_0xabbe('0x3f')][_0xabbe('0x4a')]){_0x4905ad['where']=_[_0xabbe('0x4b')](_0x4905ad[_0xabbe('0x48')],{'$or':_[_0xabbe('0x4c')](_0x4905ad[_0xabbe('0x44')],function(_0x287283){var _0x5c9844={};_0x5c9844[_0x287283]={'$like':'%'+_0x5a547f[_0xabbe('0x3f')]['filter']+'%'};return _0x5c9844;})});}_0x4905ad=_[_0xabbe('0x4b')]({},_0x4905ad,_0x5a547f[_0xabbe('0x4f')]);return _0x481f49[_0xabbe('0x6d')](_0x4905ad);}})[_0xabbe('0x33')](function(_0xf29ef4){if(_0xf29ef4){_0x22672a=_0xf29ef4[_0xabbe('0x45')];if(!_0x5a547f[_0xabbe('0x3f')][_0xabbe('0x46')](_0xabbe('0x60'))){_0x4905ad[_0xabbe('0x2e')]=qs[_0xabbe('0x2e')](_0x5a547f[_0xabbe('0x3f')][_0xabbe('0x2e')]);_0x4905ad[_0xabbe('0x2b')]=qs[_0xabbe('0x2b')](_0x5a547f['query'][_0xabbe('0x2b')]);}return _0x481f49[_0xabbe('0x6d')](_0x4905ad);}})[_0xabbe('0x33')](function(_0x3f5c02){if(_0x3f5c02){return _0x3f5c02?{'count':_0x22672a,'rows':_0x3f5c02}:null;}})[_0xabbe('0x33')](respondWithResult(_0x10ebe0,null))[_0xabbe('0x27')](handleError(_0x10ebe0,null));};exports[_0xabbe('0x71')]=function(_0x2d70c4,_0x4f55c7,_0x5246ac){var _0x4a91ad=_0x2d70c4['body']['ids'];return db['Team'][_0xabbe('0x61')]({'where':{'id':_0x4a91ad},'attributes':['id'],'include':[{'model':db[_0xabbe('0x62')],'as':_0xabbe('0x72'),'attributes':['id',_0xabbe('0x39'),_0xabbe('0x73'),'voicePause',_0xabbe('0x74')],'raw':!![]}]})[_0xabbe('0x33')](function(_0x19860a){if(_0x19860a){var _0x174eaf=_[_0xabbe('0x75')](_0x19860a,function(_0x500915){var _0x389428=_0x500915['get']({'plain':!![]});return _0x389428[_0xabbe('0x72')];});return db[_0xabbe('0x3b')][_0xabbe('0x54')]({'where':{'id':_0x2d70c4[_0xabbe('0x51')]['id']}})[_0xabbe('0x33')](function(_0x28737b){return db[_0xabbe('0x76')][_0xabbe('0x77')](function(_0x31c59b){return _0x28737b[_0xabbe('0x71')](_0x4a91ad,{'transaction':_0x31c59b})[_0xabbe('0x33')](function(){return BPromise[_0xabbe('0x78')](_0x174eaf,function(_0x48e894){return db[_0xabbe('0x5f')]['findOrCreate']({'where':{'UserId':_0x48e894['id'],'ChatQueueId':_0x2d70c4[_0xabbe('0x51')]['id']},'transaction':_0x31c59b});});})[_0xabbe('0x33')](function(){_0x174eaf[_0xabbe('0x79')](function(_0xad26b5){socket['emit']('userChatQueue:save',{'UserId':_0xad26b5['id'],'ChatQueueId':_0x28737b['id']});});});});});}})[_0xabbe('0x33')](respondWithStatusCode(_0x4f55c7,null))[_0xabbe('0x27')](handleError(_0x4f55c7,null));};exports[_0xabbe('0x7a')]=function(_0x3f8a36,_0x337d17,_0x330d6b){return db[_0xabbe('0x6f')]['findAll']({'where':{'id':_0x3f8a36[_0xabbe('0x3f')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xabbe('0x72'),'attributes':['id'],'raw':!![]}]})[_0xabbe('0x33')](handleEntityNotFound(_0x337d17,null))['then'](function(_0x3c0008){var _0x1e25bf=_[_0xabbe('0x4c')](_0x3c0008,'id');var _0x2ccd36=[];var _0x29b3c6=[];var _0x3539dc=squel[_0xabbe('0x7b')]();_0x3539dc[_0xabbe('0x7c')](_0xabbe('0x7d'))[_0xabbe('0x7e')](_0xabbe('0x7f'),'tq')['join'](_0xabbe('0x80'),'ut',_0xabbe('0x81'))['where'](_0xabbe('0x82'),_0x3f8a36[_0xabbe('0x51')]['id']);for(var _0x2f6568=0x0;_0x2f6568<_0x3c0008[_0xabbe('0x45')];_0x2f6568+=0x1){let _0x272156=_0x3c0008[_0x2f6568];for(var _0x5d203b=0x0;_0x5d203b<_0x272156[_0xabbe('0x72')]['length'];_0x5d203b+=0x1){let _0x46fb47=_0x272156[_0xabbe('0x72')][_0x5d203b];var _0x1794b4=_0x3539dc[_0xabbe('0x83')]();_0x1794b4[_0xabbe('0x48')](_0xabbe('0x84'),_0x46fb47['id']);_0x29b3c6[_0xabbe('0x85')](db[_0xabbe('0x76')][_0xabbe('0x3f')](_0x1794b4[_0xabbe('0x86')](),{'type':db[_0xabbe('0x76')]['QueryTypes'][_0xabbe('0x87')]})[_0xabbe('0x33')](function(_0x5f5dba){if(_0x5f5dba['length']===0x1){return _0x46fb47['id'];}else{var _0xe03452=_[_0xabbe('0x88')](_['map'](_0x5f5dba,_0xabbe('0x89')),function(_0x1ffc2b){return _['includes'](_0x1e25bf,_0x1ffc2b);});if(_0xe03452){return _0x46fb47['id'];}}}));}}return BPromise['all'](_0x29b3c6)[_0xabbe('0x33')](function(_0x3c0da2){_0x2ccd36=_(_0x2ccd36)[_0xabbe('0x8a')](_0x3c0da2)[_0xabbe('0x8b')]()['value']();return db[_0xabbe('0x3b')][_0xabbe('0x54')]({'where':{'id':_0x3f8a36[_0xabbe('0x51')]['id']}})[_0xabbe('0x33')](function(_0x143ac8){return db[_0xabbe('0x76')][_0xabbe('0x77')](function(_0x7fc9fa){return _0x143ac8[_0xabbe('0x7a')](_0x3f8a36[_0xabbe('0x3f')]['ids'],{'transaction':_0x7fc9fa})[_0xabbe('0x33')](function(){if(!_['isEmpty'](_0x2ccd36)){return _0x143ac8[_0xabbe('0x8c')](_0x2ccd36,{'transaction':_0x7fc9fa});}})[_0xabbe('0x33')](function(){_0x2ccd36[_0xabbe('0x79')](function(_0x308a7e){socket[_0xabbe('0x8d')](_0xabbe('0x8e'),{'UserId':_0x308a7e,'ChatQueueId':_0x143ac8['id']});});});});});});})[_0xabbe('0x33')](respondWithStatusCode(_0x337d17,null))[_0xabbe('0x27')](handleError(_0x337d17,null));};exports[_0xabbe('0x8f')]=function(_0x1b5595,_0x53d711,_0x5906d5){return db['ChatQueue']['find']({'where':{'id':_0x1b5595[_0xabbe('0x51')]['id']}})[_0xabbe('0x33')](handleEntityNotFound(_0x53d711,null))[_0xabbe('0x33')](function(_0x499bf6){if(_0x499bf6){return _0x499bf6['addAgents'](_0x1b5595['body'][_0xabbe('0x90')],_[_0xabbe('0x91')](_0x1b5595['body'],[_0xabbe('0x90'),'id'])||{})['spread'](function(_0x51d238){for(var _0x12b5e3=0x0;_0x12b5e3<_0x1b5595[_0xabbe('0x5c')][_0xabbe('0x90')]['length'];_0x12b5e3+=0x1){socket['emit']('userChatQueue:save',{'UserId':Number(_0x1b5595[_0xabbe('0x5c')][_0xabbe('0x90')][_0x12b5e3]),'ChatQueueId':Number(_0x1b5595[_0xabbe('0x51')]['id'])});}return _0x51d238;});}})[_0xabbe('0x33')](respondWithResult(_0x53d711,null))[_0xabbe('0x27')](handleError(_0x53d711,null));};exports[_0xabbe('0x8c')]=function(_0x26a4db,_0x9b4570,_0x3bee24){return db[_0xabbe('0x3b')][_0xabbe('0x54')]({'where':{'id':_0x26a4db[_0xabbe('0x51')]['id']}})['then'](handleEntityNotFound(_0x9b4570,null))[_0xabbe('0x33')](function(_0x1cb056){if(_0x1cb056){return _0x1cb056['removeAgents'](_0x26a4db[_0xabbe('0x3f')]['ids'])['then'](function(){if(_[_0xabbe('0x92')](_0x26a4db[_0xabbe('0x3f')]['ids'])){for(var _0x1bc803=0x0;_0x1bc803<_0x26a4db[_0xabbe('0x3f')]['ids'][_0xabbe('0x45')];_0x1bc803+=0x1){socket[_0xabbe('0x8d')](_0xabbe('0x8e'),{'UserId':Number(_0x26a4db[_0xabbe('0x3f')][_0xabbe('0x90')][_0x1bc803]),'ChatQueueId':Number(_0x26a4db[_0xabbe('0x51')]['id'])});}}else{socket[_0xabbe('0x8d')](_0xabbe('0x8e'),{'UserId':Number(_0x26a4db[_0xabbe('0x3f')][_0xabbe('0x90')]),'ChatQueueId':Number(_0x26a4db[_0xabbe('0x51')]['id'])});}});}})[_0xabbe('0x33')](respondWithStatusCode(_0x9b4570,null))[_0xabbe('0x27')](handleError(_0x9b4570,null));};exports['getAgents']=function(_0x2862ca,_0xe5a4ec,_0x18d0cb){var _0x575bcd={};var _0x3ea8ff={};var _0x475d74;var _0x1cc4ea;return db[_0xabbe('0x3b')]['findOne']({'where':{'id':_0x2862ca[_0xabbe('0x51')]['id']}})[_0xabbe('0x33')](handleEntityNotFound(_0xe5a4ec,null))[_0xabbe('0x33')](function(_0x1cf424){if(_0x1cf424){_0x475d74=_0x1cf424;_0x3ea8ff[_0xabbe('0x3e')]=_[_0xabbe('0x40')](db[_0xabbe('0x62')][_0xabbe('0x3c')]);_0x3ea8ff[_0xabbe('0x3f')]=_[_0xabbe('0x40')](_0x2862ca[_0xabbe('0x3f')]);_0x3ea8ff[_0xabbe('0x41')]=_[_0xabbe('0x42')](_0x3ea8ff[_0xabbe('0x3e')],_0x3ea8ff[_0xabbe('0x3f')]);_0x575bcd['attributes']=_[_0xabbe('0x42')](_0x3ea8ff[_0xabbe('0x3e')],qs['fields'](_0x2862ca[_0xabbe('0x3f')][_0xabbe('0x43')]));_0x575bcd[_0xabbe('0x44')]=_0x575bcd[_0xabbe('0x44')][_0xabbe('0x45')]?_0x575bcd[_0xabbe('0x44')]:_0x3ea8ff['model'];_0x575bcd[_0xabbe('0x70')]=qs[_0xabbe('0x47')](_0x2862ca[_0xabbe('0x3f')][_0xabbe('0x47')]);_0x575bcd[_0xabbe('0x48')]=qs[_0xabbe('0x41')](_['pick'](_0x2862ca[_0xabbe('0x3f')],_0x3ea8ff[_0xabbe('0x41')]));if(_0x2862ca[_0xabbe('0x3f')][_0xabbe('0x4a')]){_0x575bcd[_0xabbe('0x48')]=_[_0xabbe('0x4b')](_0x575bcd[_0xabbe('0x48')],{'$or':_[_0xabbe('0x4c')](_0x575bcd[_0xabbe('0x44')],function(_0x108876){var _0x5b2d95={};_0x5b2d95[_0x108876]={'$like':'%'+_0x2862ca['query']['filter']+'%'};return _0x5b2d95;})});}_0x575bcd=_[_0xabbe('0x4b')]({},_0x575bcd,_0x2862ca['options']);return _0x475d74[_0xabbe('0x93')](_0x575bcd);}})[_0xabbe('0x33')](function(_0x217f4d){if(_0x217f4d){_0x1cc4ea=_0x217f4d[_0xabbe('0x45')];if(!_0x2862ca[_0xabbe('0x3f')][_0xabbe('0x46')]('nolimit')){_0x575bcd[_0xabbe('0x2e')]=qs[_0xabbe('0x2e')](_0x2862ca[_0xabbe('0x3f')][_0xabbe('0x2e')]);_0x575bcd['offset']=qs[_0xabbe('0x2b')](_0x2862ca['query'][_0xabbe('0x2b')]);}return _0x475d74['getAgents'](_0x575bcd);}})['then'](function(_0x429d20){if(_0x429d20){return _0x429d20?{'count':_0x1cc4ea,'rows':_0x429d20}:null;}})[_0xabbe('0x33')](respondWithResult(_0xe5a4ec,null))[_0xabbe('0x27')](handleError(_0xe5a4ec,null));}; \ No newline at end of file +var _0xa7a4=['lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./chatQueue.socket','register','jayson/promise','client','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','get','ChatQueues','stack','name','send','index','map','ChatQueue','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','where','filters','pick','filter','VIRTUAL','options','includeAll','include','rows','show','params','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','hasOwnProperty','sort','ChatQueueId','merge','findAll','User','UserId','agent','chatPause','updatedAt','createdAt','format','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','select','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','union','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra'];(function(_0x1573cb,_0xb77ccf){var _0x3da854=function(_0x2dfc20){while(--_0x2dfc20){_0x1573cb['push'](_0x1573cb['shift']());}};_0x3da854(++_0xb77ccf);}(_0xa7a4,0x1d9));var _0x4a7a=function(_0x187718,_0x427383){_0x187718=_0x187718-0x0;var _0x29ddf4=_0xa7a4[_0x187718];return _0x29ddf4;};'use strict';var emlformat=require(_0x4a7a('0x0'));var rimraf=require(_0x4a7a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4a7a('0x2'));var moment=require(_0x4a7a('0x3'));var BPromise=require(_0x4a7a('0x4'));var Mustache=require('mustache');var util=require(_0x4a7a('0x5'));var path=require(_0x4a7a('0x6'));var sox=require('sox');var csv=require(_0x4a7a('0x7'));var ejs=require(_0x4a7a('0x8'));var fs=require('fs');var fs_extra=require(_0x4a7a('0x9'));var _=require(_0x4a7a('0xa'));var squel=require(_0x4a7a('0xb'));var crypto=require(_0x4a7a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4a7a('0xd'));var toCsv=require(_0x4a7a('0x7'));var querystring=require('querystring');var Papa=require(_0x4a7a('0xe'));var Redis=require(_0x4a7a('0xf'));var authService=require(_0x4a7a('0x10'));var qs=require(_0x4a7a('0x11'));var as=require(_0x4a7a('0x12'));var hardwareService=require(_0x4a7a('0x13'));var logger=require(_0x4a7a('0x14'))(_0x4a7a('0x15'));var utils=require(_0x4a7a('0x16'));var config=require(_0x4a7a('0x17'));var licenseUtil=require(_0x4a7a('0x18'));var db=require('../../mysqldb')['db'];config[_0x4a7a('0x19')]=_[_0x4a7a('0x1a')](config[_0x4a7a('0x19')],{'host':_0x4a7a('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4a7a('0x19')]));require(_0x4a7a('0x1c'))[_0x4a7a('0x1d')](socket);var jayson=require(_0x4a7a('0x1e'));var client=jayson[_0x4a7a('0x1f')][_0x4a7a('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x2be882,_0x382574,_0x4ecd4a,_0x327d62){return new BPromise(function(_0x1b904c,_0x12e737){var _0x167ff9=_0x327d62||client;return _0x167ff9[_0x4a7a('0x21')](_0x2be882,_0x4ecd4a)[_0x4a7a('0x22')](function(_0x251c7f){logger[_0x4a7a('0x23')](_0x4a7a('0x24'),_0x382574,_0x4a7a('0x25'));logger[_0x4a7a('0x26')](_0x4a7a('0x27'),_0x382574,_0x4a7a('0x25'),JSON[_0x4a7a('0x28')](_0x251c7f));if(_0x251c7f['error']){if(_0x251c7f[_0x4a7a('0x29')][_0x4a7a('0x2a')]===0x1f4){logger[_0x4a7a('0x29')](_0x4a7a('0x24'),_0x382574,_0x251c7f[_0x4a7a('0x29')][_0x4a7a('0x2b')]);return _0x12e737(_0x251c7f[_0x4a7a('0x29')]['message']);}logger[_0x4a7a('0x29')]('ChatQueue,\x20%s,\x20%s',_0x382574,_0x251c7f[_0x4a7a('0x29')][_0x4a7a('0x2b')]);return _0x1b904c(_0x251c7f[_0x4a7a('0x29')][_0x4a7a('0x2b')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x382574,_0x4a7a('0x25'));_0x1b904c(_0x251c7f[_0x4a7a('0x2c')][_0x4a7a('0x2b')]);}})[_0x4a7a('0x2d')](function(_0x4aabe4){logger[_0x4a7a('0x29')](_0x4a7a('0x24'),_0x382574,_0x4aabe4);_0x12e737(_0x4aabe4);});});}function respondWithStatusCode(_0x3e1687,_0x238702){_0x238702=_0x238702||0xcc;return function(_0x48b0de){if(_0x48b0de){return _0x3e1687[_0x4a7a('0x2e')](_0x238702);}return _0x3e1687[_0x4a7a('0x2f')](_0x238702)[_0x4a7a('0x30')]();};}function respondWithResult(_0x378c9b,_0x35b01f){_0x35b01f=_0x35b01f||0xc8;return function(_0x3da849){if(_0x3da849){return _0x378c9b[_0x4a7a('0x2f')](_0x35b01f)[_0x4a7a('0x31')](_0x3da849);}};}function respondWithFilteredResult(_0x13cf7a,_0x56bfb0){return function(_0xd192f8){if(_0xd192f8){var _0x5c540e=typeof _0x56bfb0[_0x4a7a('0x32')]===_0x4a7a('0x33')&&typeof _0x56bfb0[_0x4a7a('0x34')]===_0x4a7a('0x33');var _0xa033f1=_0xd192f8['count'];var _0x5c33b7=_0x5c540e?0x0:_0x56bfb0['offset'];var _0x215ccf=_0x5c540e?_0xd192f8[_0x4a7a('0x35')]:_0x56bfb0[_0x4a7a('0x32')]+_0x56bfb0[_0x4a7a('0x34')];var _0xc7552d;if(_0x215ccf>=_0xa033f1){_0x215ccf=_0xa033f1;_0xc7552d=0xc8;}else{_0xc7552d=0xce;}_0x13cf7a[_0x4a7a('0x2f')](_0xc7552d);return _0x13cf7a[_0x4a7a('0x36')](_0x4a7a('0x37'),_0x5c33b7+'-'+_0x215ccf+'/'+_0xa033f1)[_0x4a7a('0x31')](_0xd192f8);}return null;};}function patchUpdates(_0x2eecd2){return function(_0x23dd62){try{jsonpatch['apply'](_0x23dd62,_0x2eecd2,!![]);}catch(_0x50edc1){return BPromise[_0x4a7a('0x38')](_0x50edc1);}return _0x23dd62[_0x4a7a('0x39')]();};}function saveUpdates(_0x467de1,_0x50a28b){return function(_0x2c4509){if(_0x2c4509){return _0x2c4509[_0x4a7a('0x3a')](_0x467de1)[_0x4a7a('0x22')](function(_0x4031a4){return _0x4031a4;});}return null;};}function removeEntity(_0x4f606d,_0x40d416){return function(_0x6aef06){if(_0x6aef06){return _0x6aef06[_0x4a7a('0x3b')]()[_0x4a7a('0x22')](function(){var _0x10e04e=_0x6aef06[_0x4a7a('0x3c')]({'plain':!![]});var _0x1c7813=_0x4a7a('0x3d');return db['UserProfileResource'][_0x4a7a('0x3b')]({'where':{'type':_0x1c7813,'resourceId':_0x10e04e['id']}})[_0x4a7a('0x22')](function(){return _0x6aef06;});})[_0x4a7a('0x22')](function(){_0x4f606d[_0x4a7a('0x2f')](0xcc)[_0x4a7a('0x30')]();});}};}function handleEntityNotFound(_0x3201b4,_0x4df310){return function(_0x209504){if(!_0x209504){_0x3201b4[_0x4a7a('0x2e')](0x194);}return _0x209504;};}function handleError(_0xf64f23,_0x52fc3f){_0x52fc3f=_0x52fc3f||0x1f4;return function(_0x306642){logger[_0x4a7a('0x29')](_0x306642[_0x4a7a('0x3e')]);if(_0x306642[_0x4a7a('0x3f')]){delete _0x306642[_0x4a7a('0x3f')];}_0xf64f23[_0x4a7a('0x2f')](_0x52fc3f)[_0x4a7a('0x40')](_0x306642);};}exports[_0x4a7a('0x41')]=function(_0x29d762,_0x323997){var _0x5ba9e2={},_0x242b8d={},_0x7c2d72={'count':0x0,'rows':[]};var _0x3cb8bb=_[_0x4a7a('0x42')](db[_0x4a7a('0x43')][_0x4a7a('0x44')],function(_0x4e3789){return{'name':_0x4e3789['fieldName'],'type':_0x4e3789[_0x4a7a('0x45')][_0x4a7a('0x46')]};});_0x242b8d[_0x4a7a('0x47')]=_[_0x4a7a('0x42')](_0x3cb8bb,'name');_0x242b8d[_0x4a7a('0x48')]=_[_0x4a7a('0x49')](_0x29d762[_0x4a7a('0x48')]);_0x242b8d['filters']=_[_0x4a7a('0x4a')](_0x242b8d['model'],_0x242b8d[_0x4a7a('0x48')]);_0x5ba9e2[_0x4a7a('0x4b')]=_['intersection'](_0x242b8d['model'],qs[_0x4a7a('0x4c')](_0x29d762['query'][_0x4a7a('0x4c')]));_0x5ba9e2[_0x4a7a('0x4b')]=_0x5ba9e2[_0x4a7a('0x4b')][_0x4a7a('0x4d')]?_0x5ba9e2[_0x4a7a('0x4b')]:_0x242b8d[_0x4a7a('0x47')];if(!_0x29d762[_0x4a7a('0x48')]['hasOwnProperty'](_0x4a7a('0x4e'))){_0x5ba9e2[_0x4a7a('0x34')]=qs['limit'](_0x29d762['query']['limit']);_0x5ba9e2[_0x4a7a('0x32')]=qs['offset'](_0x29d762[_0x4a7a('0x48')][_0x4a7a('0x32')]);}_0x5ba9e2[_0x4a7a('0x4f')]=qs['sort'](_0x29d762[_0x4a7a('0x48')]['sort']);_0x5ba9e2[_0x4a7a('0x50')]=qs[_0x4a7a('0x51')](_[_0x4a7a('0x52')](_0x29d762[_0x4a7a('0x48')],_0x242b8d[_0x4a7a('0x51')]),_0x3cb8bb);if(_0x29d762['query'][_0x4a7a('0x53')]){_0x5ba9e2[_0x4a7a('0x50')]=_['merge'](_0x5ba9e2[_0x4a7a('0x50')],{'$or':_[_0x4a7a('0x42')](_0x3cb8bb,function(_0x10176a){if(_0x10176a[_0x4a7a('0x45')]!==_0x4a7a('0x54')){var _0xea891f={};_0xea891f[_0x10176a[_0x4a7a('0x3f')]]={'$like':'%'+_0x29d762[_0x4a7a('0x48')][_0x4a7a('0x53')]+'%'};return _0xea891f;}})});}_0x5ba9e2=_['merge']({},_0x5ba9e2,_0x29d762[_0x4a7a('0x55')]);var _0x2eedca={'where':_0x5ba9e2['where']};return db[_0x4a7a('0x43')][_0x4a7a('0x35')](_0x2eedca)[_0x4a7a('0x22')](function(_0x17634d){_0x7c2d72[_0x4a7a('0x35')]=_0x17634d;if(_0x29d762[_0x4a7a('0x48')][_0x4a7a('0x56')]){_0x5ba9e2[_0x4a7a('0x57')]=[{'all':!![]}];}return db[_0x4a7a('0x43')]['findAll'](_0x5ba9e2);})[_0x4a7a('0x22')](function(_0x485064){_0x7c2d72[_0x4a7a('0x58')]=_0x485064;return _0x7c2d72;})[_0x4a7a('0x22')](respondWithFilteredResult(_0x323997,_0x5ba9e2))['catch'](handleError(_0x323997,null));};exports[_0x4a7a('0x59')]=function(_0x47250b,_0x3a7b60){var _0x7d0937={'raw':!![],'where':{'id':_0x47250b[_0x4a7a('0x5a')]['id']}},_0x3bb8ea={};_0x3bb8ea[_0x4a7a('0x47')]=_[_0x4a7a('0x49')](db[_0x4a7a('0x43')][_0x4a7a('0x44')]);_0x3bb8ea[_0x4a7a('0x48')]=_[_0x4a7a('0x49')](_0x47250b[_0x4a7a('0x48')]);_0x3bb8ea[_0x4a7a('0x51')]=_['intersection'](_0x3bb8ea[_0x4a7a('0x47')],_0x3bb8ea[_0x4a7a('0x48')]);_0x7d0937['attributes']=_[_0x4a7a('0x4a')](_0x3bb8ea['model'],qs['fields'](_0x47250b[_0x4a7a('0x48')][_0x4a7a('0x4c')]));_0x7d0937[_0x4a7a('0x4b')]=_0x7d0937[_0x4a7a('0x4b')]['length']?_0x7d0937[_0x4a7a('0x4b')]:_0x3bb8ea[_0x4a7a('0x47')];if(_0x47250b[_0x4a7a('0x48')][_0x4a7a('0x56')]){_0x7d0937[_0x4a7a('0x57')]=[{'all':!![]}];}_0x7d0937=_['merge']({},_0x7d0937,_0x47250b[_0x4a7a('0x55')]);return db['ChatQueue']['find'](_0x7d0937)[_0x4a7a('0x22')](handleEntityNotFound(_0x3a7b60,null))[_0x4a7a('0x22')](respondWithResult(_0x3a7b60,null))['catch'](handleError(_0x3a7b60,null));};exports[_0x4a7a('0x5b')]=function(_0xcdbfc1,_0x321577){return db['ChatQueue'][_0x4a7a('0x5b')](_0xcdbfc1[_0x4a7a('0x5c')],{})[_0x4a7a('0x22')](function(_0x3cd85e){var _0x19ac61=_0xcdbfc1['user']['get']({'plain':!![]});if(!_0x19ac61)throw new Error(_0x4a7a('0x5d'));if(_0x19ac61[_0x4a7a('0x5e')]===_0x4a7a('0x5f')){var _0x39a274=_0x3cd85e[_0x4a7a('0x3c')]({'plain':!![]});var _0x4becb6=_0x4a7a('0x3d');return db[_0x4a7a('0x60')][_0x4a7a('0x61')]({'where':{'name':_0x4becb6,'userProfileId':_0x19ac61[_0x4a7a('0x62')]},'raw':!![]})[_0x4a7a('0x22')](function(_0x1eb32a){if(_0x1eb32a&&_0x1eb32a[_0x4a7a('0x63')]===0x0){return db[_0x4a7a('0x64')][_0x4a7a('0x5b')]({'name':_0x39a274[_0x4a7a('0x3f')],'resourceId':_0x39a274['id'],'type':_0x1eb32a[_0x4a7a('0x3f')],'sectionId':_0x1eb32a['id']},{})[_0x4a7a('0x22')](function(){return _0x3cd85e;});}else{return _0x3cd85e;}})[_0x4a7a('0x2d')](function(_0x5824da){logger[_0x4a7a('0x29')](_0x4a7a('0x65'),_0x5824da);throw _0x5824da;});}return _0x3cd85e;})[_0x4a7a('0x22')](respondWithResult(_0x321577,0xc9))[_0x4a7a('0x2d')](handleError(_0x321577,null));};exports['update']=function(_0x3dc776,_0x3c146c){if(_0x3dc776[_0x4a7a('0x5c')]['id']){delete _0x3dc776[_0x4a7a('0x5c')]['id'];}return db[_0x4a7a('0x43')]['find']({'where':{'id':_0x3dc776['params']['id']}})['then'](handleEntityNotFound(_0x3c146c,null))[_0x4a7a('0x22')](saveUpdates(_0x3dc776['body'],null))[_0x4a7a('0x22')](respondWithResult(_0x3c146c,null))[_0x4a7a('0x2d')](handleError(_0x3c146c,null));};exports[_0x4a7a('0x3b')]=function(_0x55bb13,_0x1bdfab){return db['ChatQueue'][_0x4a7a('0x61')]({'where':{'id':_0x55bb13['params']['id']}})[_0x4a7a('0x22')](handleEntityNotFound(_0x1bdfab,null))['then'](removeEntity(_0x1bdfab,null))[_0x4a7a('0x2d')](handleError(_0x1bdfab,null));};exports[_0x4a7a('0x66')]=function(_0x4503fc,_0x5a6e5a){return db['ChatQueue'][_0x4a7a('0x66')]()['then'](respondWithResult(_0x5a6e5a,null))['catch'](handleError(_0x5a6e5a,null));};exports[_0x4a7a('0x67')]=function(_0x505af4,_0xa71e7c,_0x3dfe77){var _0x4af9ec={'raw':!![],'where':{}},_0x2af79d={},_0x5b572e;return db[_0x4a7a('0x43')][_0x4a7a('0x68')]({'where':{'id':_0x505af4[_0x4a7a('0x5a')]['id']}})[_0x4a7a('0x22')](handleEntityNotFound(_0xa71e7c,null))[_0x4a7a('0x22')](function(_0x17abd5){if(_0x17abd5){_0x5b572e=_0x17abd5['get']({'plain':!![]});_0x2af79d[_0x4a7a('0x47')]=_[_0x4a7a('0x49')](db[_0x4a7a('0x69')][_0x4a7a('0x44')]);_0x2af79d[_0x4a7a('0x48')]=_[_0x4a7a('0x49')](_0x505af4[_0x4a7a('0x48')]);_0x2af79d[_0x4a7a('0x51')]=_[_0x4a7a('0x4a')](_0x2af79d['model'],_0x2af79d[_0x4a7a('0x48')]);_0x4af9ec[_0x4a7a('0x4b')]=_[_0x4a7a('0x4a')](_0x2af79d[_0x4a7a('0x47')],qs[_0x4a7a('0x4c')](_0x505af4[_0x4a7a('0x48')][_0x4a7a('0x4c')]));_0x4af9ec[_0x4a7a('0x4b')]=_0x4af9ec[_0x4a7a('0x4b')][_0x4a7a('0x4d')]?_0x4af9ec[_0x4a7a('0x4b')]:_0x2af79d[_0x4a7a('0x47')];if(!_0x505af4[_0x4a7a('0x48')][_0x4a7a('0x6a')](_0x4a7a('0x4e'))){_0x4af9ec[_0x4a7a('0x34')]=qs[_0x4a7a('0x34')](_0x505af4['query']['limit']);_0x4af9ec['offset']=qs[_0x4a7a('0x32')](_0x505af4[_0x4a7a('0x48')][_0x4a7a('0x32')]);}_0x4af9ec[_0x4a7a('0x4f')]=qs['sort'](_0x505af4['query'][_0x4a7a('0x6b')]);_0x4af9ec[_0x4a7a('0x50')]=qs[_0x4a7a('0x51')](_['pick'](_0x505af4[_0x4a7a('0x48')],_0x2af79d['filters']));_0x4af9ec[_0x4a7a('0x50')][_0x4a7a('0x6c')]=_0x17abd5['id'];if(_0x505af4[_0x4a7a('0x48')][_0x4a7a('0x53')]){_0x4af9ec[_0x4a7a('0x50')]=_[_0x4a7a('0x6d')](_0x4af9ec[_0x4a7a('0x50')],{'$or':_[_0x4a7a('0x42')](_0x4af9ec[_0x4a7a('0x4b')],function(_0x9743a9){var _0xb05a2a={};_0xb05a2a[_0x9743a9]={'$like':'%'+_0x505af4[_0x4a7a('0x48')]['filter']+'%'};return _0xb05a2a;})});}_0x4af9ec=_[_0x4a7a('0x6d')]({},_0x4af9ec,_0x505af4[_0x4a7a('0x55')]);return db[_0x4a7a('0x69')][_0x4a7a('0x6e')](_0x4af9ec);}})[_0x4a7a('0x22')](function(_0x17c0f4){if(_0x17c0f4){return db[_0x4a7a('0x6f')]['findAndCountAll']({'where':{'id':_[_0x4a7a('0x42')](_0x17c0f4,_0x4a7a('0x70')),'role':_0x4a7a('0x71')},'attributes':['id',_0x4a7a('0x3f'),_0x4a7a('0x72'),_0x4a7a('0x73'),_0x4a7a('0x74')]});}})[_0x4a7a('0x22')](function(_0x1b5234){if(_0x1b5234){return{'count':_0x1b5234[_0x4a7a('0x35')],'rows':_[_0x4a7a('0x42')](_0x1b5234[_0x4a7a('0x58')],function(_0x19045f){return{'membername':_0x19045f['name'],'UserId':_0x19045f['id'],'queue_name':_0x5b572e[_0x4a7a('0x3f')],'ChatQueueId':_0x5b572e['id'],'interface':util[_0x4a7a('0x75')]('%s/%s',_0x4a7a('0x76'),_0x19045f[_0x4a7a('0x3f')]),'penalty':0x0,'paused':_0x19045f['chatPause'],'createdAt':_0x19045f['createdAt'],'updatedAt':_0x19045f[_0x4a7a('0x73')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x4a7a('0x22')](respondWithFilteredResult(_0xa71e7c,_0x4af9ec))[_0x4a7a('0x2d')](handleError(_0xa71e7c,null));};exports[_0x4a7a('0x77')]=function(_0x1d88c3,_0x16d4bc,_0x1b44ce){var _0x371161={};var _0x146cf6={};var _0x31d69c;var _0x430128;return db[_0x4a7a('0x43')][_0x4a7a('0x68')]({'where':{'id':_0x1d88c3['params']['id']}})[_0x4a7a('0x22')](handleEntityNotFound(_0x16d4bc,null))[_0x4a7a('0x22')](function(_0x4bfccc){if(_0x4bfccc){_0x31d69c=_0x4bfccc;_0x146cf6[_0x4a7a('0x47')]=_[_0x4a7a('0x49')](db[_0x4a7a('0x78')][_0x4a7a('0x44')]);_0x146cf6[_0x4a7a('0x48')]=_[_0x4a7a('0x49')](_0x1d88c3[_0x4a7a('0x48')]);_0x146cf6[_0x4a7a('0x51')]=_[_0x4a7a('0x4a')](_0x146cf6[_0x4a7a('0x47')],_0x146cf6[_0x4a7a('0x48')]);_0x371161['attributes']=_['intersection'](_0x146cf6['model'],qs[_0x4a7a('0x4c')](_0x1d88c3[_0x4a7a('0x48')][_0x4a7a('0x4c')]));_0x371161['attributes']=_0x371161[_0x4a7a('0x4b')][_0x4a7a('0x4d')]?_0x371161['attributes']:_0x146cf6['model'];_0x371161['order']=qs['sort'](_0x1d88c3[_0x4a7a('0x48')][_0x4a7a('0x6b')]);_0x371161[_0x4a7a('0x50')]=qs[_0x4a7a('0x51')](_[_0x4a7a('0x52')](_0x1d88c3[_0x4a7a('0x48')],_0x146cf6['filters']));if(_0x1d88c3['query'][_0x4a7a('0x53')]){_0x371161['where']=_[_0x4a7a('0x6d')](_0x371161[_0x4a7a('0x50')],{'$or':_['map'](_0x371161[_0x4a7a('0x4b')],function(_0x1f3ebd){var _0x3227f1={};_0x3227f1[_0x1f3ebd]={'$like':'%'+_0x1d88c3[_0x4a7a('0x48')][_0x4a7a('0x53')]+'%'};return _0x3227f1;})});}_0x371161=_[_0x4a7a('0x6d')]({},_0x371161,_0x1d88c3['options']);return _0x31d69c[_0x4a7a('0x77')](_0x371161);}})['then'](function(_0x49f7b2){if(_0x49f7b2){_0x430128=_0x49f7b2['length'];if(!_0x1d88c3[_0x4a7a('0x48')]['hasOwnProperty'](_0x4a7a('0x4e'))){_0x371161['limit']=qs[_0x4a7a('0x34')](_0x1d88c3[_0x4a7a('0x48')][_0x4a7a('0x34')]);_0x371161['offset']=qs[_0x4a7a('0x32')](_0x1d88c3[_0x4a7a('0x48')][_0x4a7a('0x32')]);}return _0x31d69c['getTeams'](_0x371161);}})[_0x4a7a('0x22')](function(_0x2294ee){if(_0x2294ee){return _0x2294ee?{'count':_0x430128,'rows':_0x2294ee}:null;}})[_0x4a7a('0x22')](respondWithResult(_0x16d4bc,null))['catch'](handleError(_0x16d4bc,null));};exports[_0x4a7a('0x79')]=function(_0x409ced,_0x539020,_0x597f68){var _0x56098c=_0x409ced[_0x4a7a('0x5c')][_0x4a7a('0x7a')];return db[_0x4a7a('0x78')]['findAll']({'where':{'id':_0x56098c},'attributes':['id'],'include':[{'model':db[_0x4a7a('0x6f')],'as':_0x4a7a('0x7b'),'attributes':['id',_0x4a7a('0x3f'),_0x4a7a('0x7c'),_0x4a7a('0x7d'),_0x4a7a('0x7e')],'raw':!![]}]})['then'](function(_0x2fcb9b){if(_0x2fcb9b){var _0x4fb27c=_[_0x4a7a('0x7f')](_0x2fcb9b,function(_0x508ed3){var _0x534d97=_0x508ed3[_0x4a7a('0x3c')]({'plain':!![]});return _0x534d97[_0x4a7a('0x7b')];});return db['ChatQueue'][_0x4a7a('0x61')]({'where':{'id':_0x409ced['params']['id']}})[_0x4a7a('0x22')](function(_0x52c039){return db['sequelize'][_0x4a7a('0x80')](function(_0x2b7c40){return _0x52c039[_0x4a7a('0x79')](_0x56098c,{'transaction':_0x2b7c40})[_0x4a7a('0x22')](function(){return BPromise[_0x4a7a('0x81')](_0x4fb27c,function(_0x56aac){return db['UserChatQueue'][_0x4a7a('0x82')]({'where':{'UserId':_0x56aac['id'],'ChatQueueId':_0x409ced[_0x4a7a('0x5a')]['id']},'transaction':_0x2b7c40});});})[_0x4a7a('0x22')](function(){_0x4fb27c[_0x4a7a('0x83')](function(_0x39b51b){socket[_0x4a7a('0x84')](_0x4a7a('0x85'),{'UserId':_0x39b51b['id'],'ChatQueueId':_0x52c039['id']});});});});});}})[_0x4a7a('0x22')](respondWithStatusCode(_0x539020,null))['catch'](handleError(_0x539020,null));};exports[_0x4a7a('0x86')]=function(_0x154038,_0x179a7f,_0x4d5922){return db[_0x4a7a('0x78')][_0x4a7a('0x6e')]({'where':{'id':_0x154038[_0x4a7a('0x48')]['ids']},'attributes':['id'],'include':[{'model':db[_0x4a7a('0x6f')],'as':_0x4a7a('0x7b'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x179a7f,null))[_0x4a7a('0x22')](function(_0x267f15){var _0x467fbd=_['map'](_0x267f15,'id');var _0x50b80d=[];var _0x23c150=[];var _0x222fc9=squel[_0x4a7a('0x87')]();_0x222fc9['field'](_0x4a7a('0x88'))[_0x4a7a('0x89')]('team_has_chat_queues','tq')[_0x4a7a('0x8a')](_0x4a7a('0x8b'),'ut',_0x4a7a('0x8c'))[_0x4a7a('0x50')](_0x4a7a('0x8d'),_0x154038[_0x4a7a('0x5a')]['id']);for(var _0xd7ec96=0x0;_0xd7ec96<_0x267f15[_0x4a7a('0x4d')];_0xd7ec96+=0x1){let _0x4c4d8e=_0x267f15[_0xd7ec96];for(var _0x2ce28e=0x0;_0x2ce28e<_0x4c4d8e[_0x4a7a('0x7b')][_0x4a7a('0x4d')];_0x2ce28e+=0x1){let _0x3b45d8=_0x4c4d8e[_0x4a7a('0x7b')][_0x2ce28e];var _0x5c13b6=_0x222fc9[_0x4a7a('0x8e')]();_0x5c13b6[_0x4a7a('0x50')](_0x4a7a('0x8f'),_0x3b45d8['id']);_0x23c150[_0x4a7a('0x90')](db[_0x4a7a('0x91')][_0x4a7a('0x48')](_0x5c13b6[_0x4a7a('0x92')](),{'type':db[_0x4a7a('0x91')][_0x4a7a('0x93')][_0x4a7a('0x94')]})[_0x4a7a('0x22')](function(_0x3a542d){if(_0x3a542d[_0x4a7a('0x4d')]===0x1){return _0x3b45d8['id'];}else{var _0x5067a7=_[_0x4a7a('0x95')](_[_0x4a7a('0x42')](_0x3a542d,_0x4a7a('0x96')),function(_0x2a42e3){return _['includes'](_0x467fbd,_0x2a42e3);});if(_0x5067a7){return _0x3b45d8['id'];}}}));}}return BPromise['all'](_0x23c150)[_0x4a7a('0x22')](function(_0x5e421d){_0x50b80d=_(_0x50b80d)[_0x4a7a('0x97')](_0x5e421d)['compact']()[_0x4a7a('0x98')]();return db[_0x4a7a('0x43')][_0x4a7a('0x61')]({'where':{'id':_0x154038['params']['id']}})[_0x4a7a('0x22')](function(_0x31df6d){return db[_0x4a7a('0x91')]['transaction'](function(_0x45dde8){return _0x31df6d['removeTeams'](_0x154038['query'][_0x4a7a('0x7a')],{'transaction':_0x45dde8})['then'](function(){if(!_[_0x4a7a('0x99')](_0x50b80d)){return _0x31df6d[_0x4a7a('0x9a')](_0x50b80d,{'transaction':_0x45dde8});}})[_0x4a7a('0x22')](function(){_0x50b80d['forEach'](function(_0x13a6db){socket[_0x4a7a('0x84')](_0x4a7a('0x9b'),{'UserId':_0x13a6db,'ChatQueueId':_0x31df6d['id']});});});});});});})[_0x4a7a('0x22')](respondWithStatusCode(_0x179a7f,null))['catch'](handleError(_0x179a7f,null));};exports['addAgents']=function(_0x406787,_0xc8dde3,_0xc93ed9){return db['ChatQueue'][_0x4a7a('0x61')]({'where':{'id':_0x406787[_0x4a7a('0x5a')]['id']}})['then'](handleEntityNotFound(_0xc8dde3,null))['then'](function(_0x3143c2){if(_0x3143c2){return _0x3143c2[_0x4a7a('0x9c')](_0x406787[_0x4a7a('0x5c')][_0x4a7a('0x7a')],_[_0x4a7a('0x9d')](_0x406787['body'],[_0x4a7a('0x7a'),'id'])||{})[_0x4a7a('0x9e')](function(_0x3a65e6){for(var _0x5968e7=0x0;_0x5968e7<_0x406787['body'][_0x4a7a('0x7a')][_0x4a7a('0x4d')];_0x5968e7+=0x1){socket[_0x4a7a('0x84')](_0x4a7a('0x85'),{'UserId':Number(_0x406787[_0x4a7a('0x5c')][_0x4a7a('0x7a')][_0x5968e7]),'ChatQueueId':Number(_0x406787[_0x4a7a('0x5a')]['id'])});}return _0x3a65e6;});}})[_0x4a7a('0x22')](respondWithResult(_0xc8dde3,null))[_0x4a7a('0x2d')](handleError(_0xc8dde3,null));};exports[_0x4a7a('0x9a')]=function(_0x153092,_0x54bdc6,_0xbb2a9a){return db['ChatQueue']['find']({'where':{'id':_0x153092[_0x4a7a('0x5a')]['id']}})['then'](handleEntityNotFound(_0x54bdc6,null))[_0x4a7a('0x22')](function(_0x66657b){if(_0x66657b){return _0x66657b[_0x4a7a('0x9a')](_0x153092['query'][_0x4a7a('0x7a')])['then'](function(){if(_[_0x4a7a('0x9f')](_0x153092[_0x4a7a('0x48')][_0x4a7a('0x7a')])){for(var _0x7c780b=0x0;_0x7c780b<_0x153092['query']['ids'][_0x4a7a('0x4d')];_0x7c780b+=0x1){socket[_0x4a7a('0x84')](_0x4a7a('0x9b'),{'UserId':Number(_0x153092[_0x4a7a('0x48')][_0x4a7a('0x7a')][_0x7c780b]),'ChatQueueId':Number(_0x153092['params']['id'])});}}else{socket[_0x4a7a('0x84')](_0x4a7a('0x9b'),{'UserId':Number(_0x153092[_0x4a7a('0x48')][_0x4a7a('0x7a')]),'ChatQueueId':Number(_0x153092[_0x4a7a('0x5a')]['id'])});}});}})[_0x4a7a('0x22')](respondWithStatusCode(_0x54bdc6,null))[_0x4a7a('0x2d')](handleError(_0x54bdc6,null));};exports[_0x4a7a('0xa0')]=function(_0x12a0b0,_0x5c1b8d,_0x1f3a2b){var _0x5f5cd3={};var _0x4204ad={};var _0xdd72ca;var _0x49a932;return db[_0x4a7a('0x43')][_0x4a7a('0x68')]({'where':{'id':_0x12a0b0['params']['id']}})[_0x4a7a('0x22')](handleEntityNotFound(_0x5c1b8d,null))[_0x4a7a('0x22')](function(_0x597272){if(_0x597272){_0xdd72ca=_0x597272;_0x4204ad[_0x4a7a('0x47')]=_[_0x4a7a('0x49')](db['User'][_0x4a7a('0x44')]);_0x4204ad['query']=_[_0x4a7a('0x49')](_0x12a0b0[_0x4a7a('0x48')]);_0x4204ad['filters']=_[_0x4a7a('0x4a')](_0x4204ad[_0x4a7a('0x47')],_0x4204ad[_0x4a7a('0x48')]);_0x5f5cd3[_0x4a7a('0x4b')]=_[_0x4a7a('0x4a')](_0x4204ad[_0x4a7a('0x47')],qs['fields'](_0x12a0b0['query'][_0x4a7a('0x4c')]));_0x5f5cd3[_0x4a7a('0x4b')]=_0x5f5cd3[_0x4a7a('0x4b')]['length']?_0x5f5cd3[_0x4a7a('0x4b')]:_0x4204ad['model'];_0x5f5cd3[_0x4a7a('0x4f')]=qs[_0x4a7a('0x6b')](_0x12a0b0[_0x4a7a('0x48')][_0x4a7a('0x6b')]);_0x5f5cd3[_0x4a7a('0x50')]=qs[_0x4a7a('0x51')](_['pick'](_0x12a0b0[_0x4a7a('0x48')],_0x4204ad[_0x4a7a('0x51')]));if(_0x12a0b0['query'][_0x4a7a('0x53')]){_0x5f5cd3['where']=_['merge'](_0x5f5cd3[_0x4a7a('0x50')],{'$or':_[_0x4a7a('0x42')](_0x5f5cd3[_0x4a7a('0x4b')],function(_0xe20af3){var _0x2acba4={};_0x2acba4[_0xe20af3]={'$like':'%'+_0x12a0b0['query'][_0x4a7a('0x53')]+'%'};return _0x2acba4;})});}_0x5f5cd3=_[_0x4a7a('0x6d')]({},_0x5f5cd3,_0x12a0b0[_0x4a7a('0x55')]);return _0xdd72ca['getAgents'](_0x5f5cd3);}})['then'](function(_0x1a2953){if(_0x1a2953){_0x49a932=_0x1a2953[_0x4a7a('0x4d')];if(!_0x12a0b0['query']['hasOwnProperty'](_0x4a7a('0x4e'))){_0x5f5cd3[_0x4a7a('0x34')]=qs[_0x4a7a('0x34')](_0x12a0b0[_0x4a7a('0x48')][_0x4a7a('0x34')]);_0x5f5cd3[_0x4a7a('0x32')]=qs[_0x4a7a('0x32')](_0x12a0b0[_0x4a7a('0x48')]['offset']);}return _0xdd72ca[_0x4a7a('0xa0')](_0x5f5cd3);}})[_0x4a7a('0x22')](function(_0x47bdc5){if(_0x47bdc5){return _0x47bdc5?{'count':_0x49a932,'rows':_0x47bdc5}:null;}})['then'](respondWithResult(_0x5c1b8d,null))['catch'](handleError(_0x5c1b8d,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 46337b0..e038c83 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 _0xa372=['exports','events','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x537c37,_0x536e74){var _0x241f84=function(_0x3fe709){while(--_0x3fe709){_0x537c37['push'](_0x537c37['shift']());}};_0x241f84(++_0x536e74);}(_0xa372,0x133));var _0x2a37=function(_0x1051c7,_0x116ac5){_0x1051c7=_0x1051c7-0x0;var _0x5828b6=_0xa372[_0x1051c7];return _0x5828b6;};'use strict';var EventEmitter=require(_0x2a37('0x0'));var ChatQueue=require('../../mysqldb')['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x2a37('0x1')](0x0);var events={'afterCreate':_0x2a37('0x2'),'afterUpdate':_0x2a37('0x3'),'afterDestroy':_0x2a37('0x4')};function emitEvent(_0x5e1068){return function(_0x581fce,_0x188768,_0x2078f2){ChatQueueEvents[_0x2a37('0x5')](_0x5e1068+':'+_0x581fce['id'],_0x581fce);ChatQueueEvents[_0x2a37('0x5')](_0x5e1068,_0x581fce);_0x2078f2(null);};}for(var e in events){if(events[_0x2a37('0x6')](e)){var event=events[e];ChatQueue[_0x2a37('0x7')](e,emitEvent(event));}}module[_0x2a37('0x8')]=ChatQueueEvents; \ No newline at end of file +var _0xe7e4=['emit','hasOwnProperty','exports','../../mysqldb','ChatQueue','save','update','remove'];(function(_0xf80b3,_0x25d5f3){var _0x10c489=function(_0x3c5aee){while(--_0x3c5aee){_0xf80b3['push'](_0xf80b3['shift']());}};_0x10c489(++_0x25d5f3);}(_0xe7e4,0xa3));var _0x4e7e=function(_0x15dda5,_0x4fd827){_0x15dda5=_0x15dda5-0x0;var _0x446d4e=_0xe7e4[_0x15dda5];return _0x446d4e;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x4e7e('0x0'))['db'][_0x4e7e('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4e7e('0x2'),'afterUpdate':_0x4e7e('0x3'),'afterDestroy':_0x4e7e('0x4')};function emitEvent(_0x3d4f7e){return function(_0x2d15e4,_0x2eaf1e,_0x224848){ChatQueueEvents[_0x4e7e('0x5')](_0x3d4f7e+':'+_0x2d15e4['id'],_0x2d15e4);ChatQueueEvents['emit'](_0x3d4f7e,_0x2d15e4);_0x224848(null);};}for(var e in events){if(events[_0x4e7e('0x6')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0x4e7e('0x7')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 59d43d7..ad26868 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 _0x0169=['bluebird','request-promise','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','util','api','moment'];(function(_0x4dc57d,_0x2a4081){var _0x1f8a87=function(_0x408b27){while(--_0x408b27){_0x4dc57d['push'](_0x4dc57d['shift']());}};_0x1f8a87(++_0x2a4081);}(_0x0169,0x14e));var _0x9016=function(_0x33b257,_0x392a6b){_0x33b257=_0x33b257-0x0;var _0x36ba13=_0x0169[_0x33b257];return _0x36ba13;};'use strict';var _=require(_0x9016('0x0'));var util=require(_0x9016('0x1'));var logger=require('../../config/logger')(_0x9016('0x2'));var moment=require(_0x9016('0x3'));var BPromise=require(_0x9016('0x4'));var rp=require(_0x9016('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9016('0x6'));var config=require(_0x9016('0x7'));var attributes=require(_0x9016('0x8'));module[_0x9016('0x9')]=function(_0x33263e,_0x16002c){return _0x33263e[_0x9016('0xa')](_0x9016('0xb'),attributes,{'tableName':_0x9016('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b1c=['rimraf','../../config/environment','exports','define','ChatQueue','api','moment','request-promise'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3b1c,0x6d));var _0xc3b1=function(_0xd3fc0b,_0x596d26){_0xd3fc0b=_0xd3fc0b-0x0;var _0x542125=_0x3b1c[_0xd3fc0b];return _0x542125;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xc3b1('0x0'));var moment=require(_0xc3b1('0x1'));var BPromise=require('bluebird');var rp=require(_0xc3b1('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc3b1('0x3'));var config=require(_0xc3b1('0x4'));var attributes=require('./chatQueue.attributes');module[_0xc3b1('0x5')]=function(_0x435b49,_0x6a202a){return _0x435b49[_0xc3b1('0x6')](_0xc3b1('0x7'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 7ef0d5f..9afe527 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 _0x8185=['register','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','include','map','model','ShowChatQueue','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x26647c,_0x45c83a){var _0x3fbf4d=function(_0x47fd85){while(--_0x47fd85){_0x26647c['push'](_0x26647c['shift']());}};_0x3fbf4d(++_0x45c83a);}(_0x8185,0xb8));var _0x5818=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x8185[_0x11005e];return _0x29338f;};'use strict';var _=require(_0x5818('0x0'));var util=require(_0x5818('0x1'));var moment=require(_0x5818('0x2'));var BPromise=require('bluebird');var rs=require(_0x5818('0x3'));var fs=require('fs');var Redis=require(_0x5818('0x4'));var db=require(_0x5818('0x5'))['db'];var utils=require(_0x5818('0x6'));var logger=require(_0x5818('0x7'))('rpc');var config=require(_0x5818('0x8'));var jayson=require(_0x5818('0x9'));var client=jayson[_0x5818('0xa')][_0x5818('0xb')]({'port':0x232a});config[_0x5818('0xc')]=_[_0x5818('0xd')](config[_0x5818('0xc')],{'host':_0x5818('0xe'),'port':0x18eb});var socket=require(_0x5818('0xf'))(new Redis(config[_0x5818('0xc')]));require('./chatQueue.socket')[_0x5818('0x10')](socket);function respondWithRpcPromise(_0x1196f7,_0x5ec895,_0x3f18d7){return new BPromise(function(_0x1154bc,_0x54f7f2){return client['request'](_0x1196f7,_0x3f18d7)[_0x5818('0x11')](function(_0x21df2b){logger['info'](_0x5818('0x12'),_0x5ec895,_0x5818('0x13'));logger[_0x5818('0x14')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x5ec895,_0x5818('0x13'),JSON[_0x5818('0x15')](_0x21df2b));if(_0x21df2b[_0x5818('0x16')]){if(_0x21df2b[_0x5818('0x16')][_0x5818('0x17')]===0x1f4){logger['error'](_0x5818('0x12'),_0x5ec895,_0x21df2b[_0x5818('0x16')][_0x5818('0x18')]);return _0x54f7f2(_0x21df2b[_0x5818('0x16')][_0x5818('0x18')]);}logger[_0x5818('0x16')](_0x5818('0x12'),_0x5ec895,_0x21df2b['error'][_0x5818('0x18')]);return _0x1154bc(_0x21df2b['error']['message']);}else{logger[_0x5818('0x19')]('ChatQueue,\x20%s,\x20%s',_0x5ec895,_0x5818('0x13'));_0x1154bc(_0x21df2b[_0x5818('0x1a')][_0x5818('0x18')]);}})[_0x5818('0x1b')](function(_0x4501dc){logger['error'](_0x5818('0x12'),_0x5ec895,_0x4501dc);_0x54f7f2(_0x4501dc);});});}exports[_0x5818('0x1c')]=function(_0x3e49ba){var _0x1d7873=this;return new Promise(function(_0xae2494,_0x381da6){return db[_0x5818('0x1d')][_0x5818('0x1e')]({'raw':_0x3e49ba[_0x5818('0x1f')]?_0x3e49ba[_0x5818('0x1f')][_0x5818('0x20')]===undefined?!![]:![]:!![],'where':_0x3e49ba[_0x5818('0x1f')]?_0x3e49ba['options'][_0x5818('0x21')]||null:null,'attributes':_0x3e49ba['options']?_0x3e49ba[_0x5818('0x1f')][_0x5818('0x22')]||null:null,'limit':_0x3e49ba[_0x5818('0x1f')]?_0x3e49ba[_0x5818('0x1f')]['limit']||null:null,'include':_0x3e49ba[_0x5818('0x1f')]?_0x3e49ba['options'][_0x5818('0x23')]?_[_0x5818('0x24')](_0x3e49ba[_0x5818('0x1f')][_0x5818('0x23')],function(_0x350fdf){return{'model':db[_0x350fdf['model']],'as':_0x350fdf['as'],'attributes':_0x350fdf[_0x5818('0x22')],'include':_0x350fdf[_0x5818('0x23')]?_[_0x5818('0x24')](_0x350fdf[_0x5818('0x23')],function(_0x504efd){return{'model':db[_0x504efd[_0x5818('0x25')]],'as':_0x504efd['as'],'attributes':_0x504efd[_0x5818('0x22')],'include':_0x504efd['include']?_[_0x5818('0x24')](_0x504efd[_0x5818('0x23')],function(_0x5e3a6f){return{'model':db[_0x5e3a6f['model']],'as':_0x5e3a6f['as'],'attributes':_0x5e3a6f[_0x5818('0x22')]};}):[]};}):[]};}):[]:[]})[_0x5818('0x11')](function(_0x2ae9b7){logger['info'](_0x5818('0x1c'),_0x3e49ba);logger[_0x5818('0x14')]('GetChatQueue',_0x3e49ba,JSON[_0x5818('0x15')](_0x2ae9b7));_0xae2494(_0x2ae9b7);})['catch'](function(_0x2c110f){logger['error']('GetChatQueue',_0x2c110f['message'],_0x3e49ba);_0x381da6(_0x1d7873[_0x5818('0x16')](0x1f4,_0x2c110f[_0x5818('0x18')]));});});};exports[_0x5818('0x26')]=function(_0xf639fb){var _0x44c2ad=this;return new Promise(function(_0x28df75,_0x303901){return db[_0x5818('0x1d')][_0x5818('0x27')]({'raw':_0xf639fb[_0x5818('0x1f')]?_0xf639fb['options'][_0x5818('0x20')]===undefined?!![]:![]:!![],'where':_0xf639fb[_0x5818('0x1f')]?_0xf639fb[_0x5818('0x1f')][_0x5818('0x21')]||null:null,'attributes':_0xf639fb['options']?_0xf639fb['options']['attributes']||null:null,'include':_0xf639fb[_0x5818('0x1f')]?_0xf639fb[_0x5818('0x1f')]['include']?_[_0x5818('0x24')](_0xf639fb[_0x5818('0x1f')][_0x5818('0x23')],function(_0x5a8df1){return{'model':db[_0x5a8df1['model']],'as':_0x5a8df1['as'],'attributes':_0x5a8df1[_0x5818('0x22')],'include':_0x5a8df1[_0x5818('0x23')]?_[_0x5818('0x24')](_0x5a8df1['include'],function(_0x305987){return{'model':db[_0x305987[_0x5818('0x25')]],'as':_0x305987['as'],'attributes':_0x305987[_0x5818('0x22')],'include':_0x305987['include']?_[_0x5818('0x24')](_0x305987['include'],function(_0x3d54a0){return{'model':db[_0x3d54a0[_0x5818('0x25')]],'as':_0x3d54a0['as'],'attributes':_0x3d54a0[_0x5818('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ef890){logger[_0x5818('0x19')](_0x5818('0x26'),_0xf639fb);logger[_0x5818('0x14')](_0x5818('0x26'),_0xf639fb,JSON[_0x5818('0x15')](_0x1ef890));_0x28df75(_0x1ef890);})[_0x5818('0x1b')](function(_0xade866){logger['error'](_0x5818('0x26'),_0xade866[_0x5818('0x18')],_0xf639fb);_0x303901(_0x44c2ad[_0x5818('0x16')](0x1f4,_0xade866[_0x5818('0x18')]));});});}; \ No newline at end of file +var _0xa24a=['where','attributes','include','map','model','debug','ShowChatQueue','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','info','result','catch','GetChatQueue','ChatQueue','findAll','options'];(function(_0x5c4d21,_0x2df83f){var _0x30f18c=function(_0x422df5){while(--_0x422df5){_0x5c4d21['push'](_0x5c4d21['shift']());}};_0x30f18c(++_0x2df83f);}(_0xa24a,0x1a2));var _0xaa24=function(_0x4dd465,_0x28b334){_0x4dd465=_0x4dd465-0x0;var _0x4c7c91=_0xa24a[_0x4dd465];return _0x4c7c91;};'use strict';var _=require(_0xaa24('0x0'));var util=require(_0xaa24('0x1'));var moment=require(_0xaa24('0x2'));var BPromise=require(_0xaa24('0x3'));var rs=require(_0xaa24('0x4'));var fs=require('fs');var Redis=require(_0xaa24('0x5'));var db=require(_0xaa24('0x6'))['db'];var utils=require(_0xaa24('0x7'));var logger=require(_0xaa24('0x8'))(_0xaa24('0x9'));var config=require('../../config/environment');var jayson=require(_0xaa24('0xa'));var client=jayson[_0xaa24('0xb')]['http']({'port':0x232a});config[_0xaa24('0xc')]=_[_0xaa24('0xd')](config['redis'],{'host':_0xaa24('0xe'),'port':0x18eb});var socket=require(_0xaa24('0xf'))(new Redis(config['redis']));require('./chatQueue.socket')[_0xaa24('0x10')](socket);function respondWithRpcPromise(_0x3537b3,_0x385743,_0x325ffb){return new BPromise(function(_0x16a029,_0x3667ee){return client[_0xaa24('0x11')](_0x3537b3,_0x325ffb)[_0xaa24('0x12')](function(_0x212c67){logger['info']('ChatQueue,\x20%s,\x20%s',_0x385743,_0xaa24('0x13'));logger['debug'](_0xaa24('0x14'),_0x385743,_0xaa24('0x13'),JSON[_0xaa24('0x15')](_0x212c67));if(_0x212c67[_0xaa24('0x16')]){if(_0x212c67['error'][_0xaa24('0x17')]===0x1f4){logger[_0xaa24('0x16')](_0xaa24('0x18'),_0x385743,_0x212c67[_0xaa24('0x16')][_0xaa24('0x19')]);return _0x3667ee(_0x212c67['error'][_0xaa24('0x19')]);}logger['error'](_0xaa24('0x18'),_0x385743,_0x212c67[_0xaa24('0x16')][_0xaa24('0x19')]);return _0x16a029(_0x212c67[_0xaa24('0x16')][_0xaa24('0x19')]);}else{logger[_0xaa24('0x1a')]('ChatQueue,\x20%s,\x20%s',_0x385743,_0xaa24('0x13'));_0x16a029(_0x212c67[_0xaa24('0x1b')]['message']);}})[_0xaa24('0x1c')](function(_0xcddd8a){logger[_0xaa24('0x16')](_0xaa24('0x18'),_0x385743,_0xcddd8a);_0x3667ee(_0xcddd8a);});});}exports[_0xaa24('0x1d')]=function(_0xfd43c9){var _0xcbcafd=this;return new Promise(function(_0x81723c,_0x181c7e){return db[_0xaa24('0x1e')][_0xaa24('0x1f')]({'raw':_0xfd43c9[_0xaa24('0x20')]?_0xfd43c9[_0xaa24('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0xfd43c9[_0xaa24('0x20')]?_0xfd43c9['options'][_0xaa24('0x21')]||null:null,'attributes':_0xfd43c9[_0xaa24('0x20')]?_0xfd43c9[_0xaa24('0x20')][_0xaa24('0x22')]||null:null,'limit':_0xfd43c9['options']?_0xfd43c9['options']['limit']||null:null,'include':_0xfd43c9[_0xaa24('0x20')]?_0xfd43c9[_0xaa24('0x20')][_0xaa24('0x23')]?_[_0xaa24('0x24')](_0xfd43c9['options'][_0xaa24('0x23')],function(_0x53eaae){return{'model':db[_0x53eaae['model']],'as':_0x53eaae['as'],'attributes':_0x53eaae[_0xaa24('0x22')],'include':_0x53eaae['include']?_[_0xaa24('0x24')](_0x53eaae['include'],function(_0x1f85f9){return{'model':db[_0x1f85f9[_0xaa24('0x25')]],'as':_0x1f85f9['as'],'attributes':_0x1f85f9['attributes'],'include':_0x1f85f9[_0xaa24('0x23')]?_[_0xaa24('0x24')](_0x1f85f9[_0xaa24('0x23')],function(_0x40dbdd){return{'model':db[_0x40dbdd[_0xaa24('0x25')]],'as':_0x40dbdd['as'],'attributes':_0x40dbdd[_0xaa24('0x22')]};}):[]};}):[]};}):[]:[]})[_0xaa24('0x12')](function(_0x5b8539){logger['info'](_0xaa24('0x1d'),_0xfd43c9);logger[_0xaa24('0x26')]('GetChatQueue',_0xfd43c9,JSON[_0xaa24('0x15')](_0x5b8539));_0x81723c(_0x5b8539);})[_0xaa24('0x1c')](function(_0x59c675){logger[_0xaa24('0x16')](_0xaa24('0x1d'),_0x59c675[_0xaa24('0x19')],_0xfd43c9);_0x181c7e(_0xcbcafd[_0xaa24('0x16')](0x1f4,_0x59c675[_0xaa24('0x19')]));});});};exports[_0xaa24('0x27')]=function(_0xb69c6){var _0x877767=this;return new Promise(function(_0x415701,_0x2c2ca4){return db[_0xaa24('0x1e')]['find']({'raw':_0xb69c6[_0xaa24('0x20')]?_0xb69c6[_0xaa24('0x20')][_0xaa24('0x28')]===undefined?!![]:![]:!![],'where':_0xb69c6[_0xaa24('0x20')]?_0xb69c6[_0xaa24('0x20')]['where']||null:null,'attributes':_0xb69c6[_0xaa24('0x20')]?_0xb69c6['options']['attributes']||null:null,'include':_0xb69c6[_0xaa24('0x20')]?_0xb69c6[_0xaa24('0x20')]['include']?_[_0xaa24('0x24')](_0xb69c6[_0xaa24('0x20')][_0xaa24('0x23')],function(_0xe1e920){return{'model':db[_0xe1e920[_0xaa24('0x25')]],'as':_0xe1e920['as'],'attributes':_0xe1e920[_0xaa24('0x22')],'include':_0xe1e920['include']?_[_0xaa24('0x24')](_0xe1e920[_0xaa24('0x23')],function(_0x2e9d92){return{'model':db[_0x2e9d92[_0xaa24('0x25')]],'as':_0x2e9d92['as'],'attributes':_0x2e9d92['attributes'],'include':_0x2e9d92[_0xaa24('0x23')]?_[_0xaa24('0x24')](_0x2e9d92[_0xaa24('0x23')],function(_0x2809b1){return{'model':db[_0x2809b1[_0xaa24('0x25')]],'as':_0x2809b1['as'],'attributes':_0x2809b1[_0xaa24('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1421a1){logger[_0xaa24('0x1a')](_0xaa24('0x27'),_0xb69c6);logger[_0xaa24('0x26')](_0xaa24('0x27'),_0xb69c6,JSON[_0xaa24('0x15')](_0x1421a1));_0x415701(_0x1421a1);})[_0xaa24('0x1c')](function(_0x40c0e2){logger['error'](_0xaa24('0x27'),_0x40c0e2[_0xaa24('0x19')],_0xb69c6);_0x2c2ca4(_0x877767[_0xaa24('0x16')](0x1f4,_0x40c0e2[_0xaa24('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index bd346c8..196aed1 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 _0xa8a8=['length','chatQueue:','./chatQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x24c984,_0x5a2069){var _0x3c872e=function(_0x3c47cb){while(--_0x3c47cb){_0x24c984['push'](_0x24c984['shift']());}};_0x3c872e(++_0x5a2069);}(_0xa8a8,0xec));var _0x8a8a=function(_0x53820f,_0x5e03c7){_0x53820f=_0x53820f-0x0;var _0x558393=_0xa8a8[_0x53820f];return _0x558393;};'use strict';var ChatQueueEvents=require(_0x8a8a('0x0'));var events=[_0x8a8a('0x1'),_0x8a8a('0x2'),_0x8a8a('0x3')];function createListener(_0x5221bc,_0x2a2676){return function(_0x3296a6){_0x2a2676[_0x8a8a('0x4')](_0x5221bc,_0x3296a6);};}function removeListener(_0x3ed1de,_0x45515d){return function(){ChatQueueEvents[_0x8a8a('0x5')](_0x3ed1de,_0x45515d);};}exports[_0x8a8a('0x6')]=function(_0x12db82){for(var _0x2e8193=0x0,_0x315fe9=events[_0x8a8a('0x7')];_0x2e8193<_0x315fe9;_0x2e8193++){var _0x8e7aa0=events[_0x2e8193];var _0x4225b9=createListener(_0x8a8a('0x8')+_0x8e7aa0,_0x12db82);ChatQueueEvents['on'](_0x8e7aa0,_0x4225b9);}}; \ No newline at end of file +var _0xb66c=['chatQueue:','./chatQueue.events','remove','removeListener','register','length'];(function(_0x490be3,_0xf0fca3){var _0x3f5140=function(_0x15fa80){while(--_0x15fa80){_0x490be3['push'](_0x490be3['shift']());}};_0x3f5140(++_0xf0fca3);}(_0xb66c,0x175));var _0xcb66=function(_0x2dfcb0,_0x516f3a){_0x2dfcb0=_0x2dfcb0-0x0;var _0x4de6e2=_0xb66c[_0x2dfcb0];return _0x4de6e2;};'use strict';var ChatQueueEvents=require(_0xcb66('0x0'));var events=['save',_0xcb66('0x1'),'update'];function createListener(_0x2afcb8,_0x24ea13){return function(_0xf7ccc5){_0x24ea13['emit'](_0x2afcb8,_0xf7ccc5);};}function removeListener(_0x35d439,_0x386241){return function(){ChatQueueEvents[_0xcb66('0x2')](_0x35d439,_0x386241);};}exports[_0xcb66('0x3')]=function(_0x5d766d){for(var _0x518163=0x0,_0x19adf5=events[_0xcb66('0x4')];_0x518163<_0x19adf5;_0x518163++){var _0xa3993=events[_0x518163];var _0x439f3d=createListener(_0xcb66('0x5')+_0xa3993,_0x5d766d);ChatQueueEvents['on'](_0xa3993,_0x439f3d);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 780947a..f0ae2f5 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','/:id/users','post','create','addTeams','put'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0x5fc3,0xa8));var _0x35fc=function(_0x533110,_0x20937f){_0x533110=_0x533110-0x0;var _0xc3c866=_0x5fc3[_0x533110];return _0xc3c866;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x9')]('/:id/members',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['getTeams']);router[_0x35fc('0x9')](_0x35fc('0x10'),auth['isAuthenticated'](),controller['getAgents']);router[_0x35fc('0x11')]('/',auth['isAuthenticated'](),controller[_0x35fc('0x12')]);router[_0x35fc('0x11')](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x13')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x35fc('0x14')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x15')]);router[_0x35fc('0x16')](_0x35fc('0xc'),auth['isAuthenticated'](),controller[_0x35fc('0x17')]);router[_0x35fc('0x16')]('/:id/teams',auth[_0x35fc('0xa')](),controller[_0x35fc('0x18')]);router[_0x35fc('0x16')]('/:id/users',auth[_0x35fc('0xa')](),controller[_0x35fc('0x19')]);module[_0x35fc('0x1a')]=router; \ No newline at end of file +var _0xe14b=['/describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','removeAgents','exports','multer','util','express','Router','../../components/auth/service','./chatQueue.controller','get','isAuthenticated','index'];(function(_0x23b56d,_0x769483){var _0x3e2c6f=function(_0x53b369){while(--_0x53b369){_0x23b56d['push'](_0x23b56d['shift']());}};_0x3e2c6f(++_0x769483);}(_0xe14b,0x93));var _0xbe14=function(_0x1d617f,_0x131c06){_0x1d617f=_0x1d617f-0x0;var _0xc07500=_0xe14b[_0x1d617f];return _0xc07500;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getMembers']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x10')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x10')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x12')]);router[_0xbe14('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x13')]);router[_0xbe14('0x14')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0x16')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x16')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeTeams']);router[_0xbe14('0x16')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);module[_0xbe14('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 1e4148c..42485ec 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 _0x5872=['moment','sequelize','exports','STRING','DATE'];(function(_0x12f570,_0x2bdad1){var _0x820efc=function(_0xb209d7){while(--_0xb209d7){_0x12f570['push'](_0x12f570['shift']());}};_0x820efc(++_0x2bdad1);}(_0x5872,0x18b));var _0x2587=function(_0x28e2cd,_0x153b42){_0x28e2cd=_0x28e2cd-0x0;var _0x11fd46=_0x5872[_0x28e2cd];return _0x11fd46;};'use strict';var moment=require(_0x2587('0x0'));var Sequelize=require(_0x2587('0x1'));module[_0x2587('0x2')]={'uniqueid':{'type':Sequelize[_0x2587('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x2587('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x2587('0x4')]},'acceptAt':{'type':Sequelize[_0x2587('0x4')]},'exitAt':{'type':Sequelize[_0x2587('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xed1f=['DATE','moment','sequelize','exports','STRING'];(function(_0x488e3d,_0x4f7e2a){var _0x3ee2b2=function(_0x5b6b37){while(--_0x5b6b37){_0x488e3d['push'](_0x488e3d['shift']());}};_0x3ee2b2(++_0x4f7e2a);}(_0xed1f,0x6a));var _0xfed1=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0xed1f[_0x3e44fa];return _0x2a0aba;};'use strict';var moment=require(_0xfed1('0x0'));var Sequelize=require(_0xfed1('0x1'));module[_0xfed1('0x2')]={'uniqueid':{'type':Sequelize[_0xfed1('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xfed1('0x3')]},'joinAt':{'type':Sequelize[_0xfed1('0x4')]},'leaveAt':{'type':Sequelize[_0xfed1('0x4')]},'acceptAt':{'type':Sequelize[_0xfed1('0x4')]},'exitAt':{'type':Sequelize[_0xfed1('0x4')]},'reason':{'type':Sequelize[_0xfed1('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index b589dc0..6207c3f 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 _0xe944=['destroy','describe','eml-format','fast-json-patch','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','create','body','find'];(function(_0x1e1b18,_0x5d471b){var _0x3da8f2=function(_0x51fe71){while(--_0x51fe71){_0x1e1b18['push'](_0x1e1b18['shift']());}};_0x3da8f2(++_0x5d471b);}(_0xe944,0x174));var _0x4e94=function(_0x2b3e9d,_0x4d4cf6){_0x2b3e9d=_0x2b3e9d-0x0;var _0x3c1bc8=_0xe944[_0x2b3e9d];return _0x3c1bc8;};'use strict';var emlformat=require(_0x4e94('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4e94('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4e94('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4e94('0x3'));var sox=require(_0x4e94('0x4'));var csv=require(_0x4e94('0x5'));var ejs=require(_0x4e94('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4e94('0x7'));var squel=require(_0x4e94('0x8'));var crypto=require(_0x4e94('0x9'));var jsforce=require(_0x4e94('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x4e94('0x5'));var querystring=require('querystring');var Papa=require(_0x4e94('0xb'));var Redis=require(_0x4e94('0xc'));var authService=require(_0x4e94('0xd'));var qs=require(_0x4e94('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4e94('0xf'));var logger=require(_0x4e94('0x10'))(_0x4e94('0x11'));var utils=require(_0x4e94('0x12'));var config=require(_0x4e94('0x13'));var licenseUtil=require(_0x4e94('0x14'));var db=require(_0x4e94('0x15'))['db'];function respondWithStatusCode(_0x5b7b98,_0x5f14cc){_0x5f14cc=_0x5f14cc||0xcc;return function(_0x132129){if(_0x132129){return _0x5b7b98[_0x4e94('0x16')](_0x5f14cc);}return _0x5b7b98[_0x4e94('0x17')](_0x5f14cc)[_0x4e94('0x18')]();};}function respondWithResult(_0x2e2350,_0x538498){_0x538498=_0x538498||0xc8;return function(_0x377212){if(_0x377212){return _0x2e2350[_0x4e94('0x17')](_0x538498)[_0x4e94('0x19')](_0x377212);}};}function respondWithFilteredResult(_0x17d5a9,_0x14b942){return function(_0x3ea67f){if(_0x3ea67f){var _0x22b4ca=typeof _0x14b942[_0x4e94('0x1a')]===_0x4e94('0x1b')&&typeof _0x14b942[_0x4e94('0x1c')]===_0x4e94('0x1b');var _0x41d8dc=_0x3ea67f['count'];var _0x58034c=_0x22b4ca?0x0:_0x14b942[_0x4e94('0x1a')];var _0x950aba=_0x22b4ca?_0x3ea67f[_0x4e94('0x1d')]:_0x14b942[_0x4e94('0x1a')]+_0x14b942[_0x4e94('0x1c')];var _0x4ddddf;if(_0x950aba>=_0x41d8dc){_0x950aba=_0x41d8dc;_0x4ddddf=0xc8;}else{_0x4ddddf=0xce;}_0x17d5a9[_0x4e94('0x17')](_0x4ddddf);return _0x17d5a9[_0x4e94('0x1e')](_0x4e94('0x1f'),_0x58034c+'-'+_0x950aba+'/'+_0x41d8dc)[_0x4e94('0x19')](_0x3ea67f);}return null;};}function patchUpdates(_0x4f2107){return function(_0xf1d49a){try{jsonpatch['apply'](_0xf1d49a,_0x4f2107,!![]);}catch(_0x2c4c7){return BPromise[_0x4e94('0x20')](_0x2c4c7);}return _0xf1d49a['save']();};}function saveUpdates(_0x596039,_0xf03522){return function(_0xe3ad9c){if(_0xe3ad9c){return _0xe3ad9c[_0x4e94('0x21')](_0x596039)[_0x4e94('0x22')](function(_0x2c93de){return _0x2c93de;});}return null;};}function removeEntity(_0x3b5f86,_0x2edbd5){return function(_0x1ea50b){if(_0x1ea50b){return _0x1ea50b['destroy']()[_0x4e94('0x22')](function(){_0x3b5f86[_0x4e94('0x17')](0xcc)[_0x4e94('0x18')]();});}};}function handleEntityNotFound(_0x57178a,_0x2b9e93){return function(_0x567cd8){if(!_0x567cd8){_0x57178a['sendStatus'](0x194);}return _0x567cd8;};}function handleError(_0x1b10b3,_0x3e8f86){_0x3e8f86=_0x3e8f86||0x1f4;return function(_0x4a0f22){logger[_0x4e94('0x23')](_0x4a0f22[_0x4e94('0x24')]);if(_0x4a0f22[_0x4e94('0x25')]){delete _0x4a0f22['name'];}_0x1b10b3[_0x4e94('0x17')](_0x3e8f86)[_0x4e94('0x26')](_0x4a0f22);};}exports[_0x4e94('0x27')]=function(_0xf6ef8e,_0x543a94){var _0x3b0d27={},_0x100b68={},_0x25bd26={'count':0x0,'rows':[]};var _0xa7d015=_[_0x4e94('0x28')](db[_0x4e94('0x29')][_0x4e94('0x2a')],function(_0x42ea2a){return{'name':_0x42ea2a[_0x4e94('0x2b')],'type':_0x42ea2a['type'][_0x4e94('0x2c')]};});_0x100b68[_0x4e94('0x2d')]=_[_0x4e94('0x28')](_0xa7d015,_0x4e94('0x25'));_0x100b68[_0x4e94('0x2e')]=_[_0x4e94('0x2f')](_0xf6ef8e[_0x4e94('0x2e')]);_0x100b68['filters']=_[_0x4e94('0x30')](_0x100b68[_0x4e94('0x2d')],_0x100b68['query']);_0x3b0d27[_0x4e94('0x31')]=_[_0x4e94('0x30')](_0x100b68[_0x4e94('0x2d')],qs['fields'](_0xf6ef8e['query'][_0x4e94('0x32')]));_0x3b0d27['attributes']=_0x3b0d27[_0x4e94('0x31')][_0x4e94('0x33')]?_0x3b0d27[_0x4e94('0x31')]:_0x100b68[_0x4e94('0x2d')];if(!_0xf6ef8e[_0x4e94('0x2e')][_0x4e94('0x34')](_0x4e94('0x35'))){_0x3b0d27[_0x4e94('0x1c')]=qs[_0x4e94('0x1c')](_0xf6ef8e['query'][_0x4e94('0x1c')]);_0x3b0d27[_0x4e94('0x1a')]=qs[_0x4e94('0x1a')](_0xf6ef8e['query'][_0x4e94('0x1a')]);}_0x3b0d27[_0x4e94('0x36')]=qs[_0x4e94('0x37')](_0xf6ef8e[_0x4e94('0x2e')][_0x4e94('0x37')]);_0x3b0d27[_0x4e94('0x38')]=qs[_0x4e94('0x39')](_[_0x4e94('0x3a')](_0xf6ef8e[_0x4e94('0x2e')],_0x100b68[_0x4e94('0x39')]),_0xa7d015);if(_0xf6ef8e[_0x4e94('0x2e')][_0x4e94('0x3b')]){_0x3b0d27[_0x4e94('0x38')]=_[_0x4e94('0x3c')](_0x3b0d27['where'],{'$or':_[_0x4e94('0x28')](_0xa7d015,function(_0x198bb4){if(_0x198bb4['type']!==_0x4e94('0x3d')){var _0x5765f0={};_0x5765f0[_0x198bb4['name']]={'$like':'%'+_0xf6ef8e[_0x4e94('0x2e')]['filter']+'%'};return _0x5765f0;}})});}_0x3b0d27=_[_0x4e94('0x3c')]({},_0x3b0d27,_0xf6ef8e[_0x4e94('0x3e')]);var _0x7ce1ce={'where':_0x3b0d27[_0x4e94('0x38')]};return db['ChatQueueReport'][_0x4e94('0x1d')](_0x7ce1ce)[_0x4e94('0x22')](function(_0x33bb9d){_0x25bd26[_0x4e94('0x1d')]=_0x33bb9d;if(_0xf6ef8e['query'][_0x4e94('0x3f')]){_0x3b0d27[_0x4e94('0x40')]=[{'all':!![]}];}return db[_0x4e94('0x29')][_0x4e94('0x41')](_0x3b0d27);})[_0x4e94('0x22')](function(_0x1cd95a){_0x25bd26['rows']=_0x1cd95a;return _0x25bd26;})[_0x4e94('0x22')](respondWithFilteredResult(_0x543a94,_0x3b0d27))[_0x4e94('0x42')](handleError(_0x543a94,null));};exports[_0x4e94('0x43')]=function(_0x4acb90,_0x366f70){var _0x16bc26={'raw':!![],'where':{'id':_0x4acb90[_0x4e94('0x44')]['id']}},_0x5424d6={};_0x5424d6[_0x4e94('0x2d')]=_[_0x4e94('0x2f')](db['ChatQueueReport']['rawAttributes']);_0x5424d6[_0x4e94('0x2e')]=_[_0x4e94('0x2f')](_0x4acb90[_0x4e94('0x2e')]);_0x5424d6['filters']=_[_0x4e94('0x30')](_0x5424d6[_0x4e94('0x2d')],_0x5424d6[_0x4e94('0x2e')]);_0x16bc26[_0x4e94('0x31')]=_[_0x4e94('0x30')](_0x5424d6[_0x4e94('0x2d')],qs['fields'](_0x4acb90[_0x4e94('0x2e')]['fields']));_0x16bc26[_0x4e94('0x31')]=_0x16bc26[_0x4e94('0x31')]['length']?_0x16bc26[_0x4e94('0x31')]:_0x5424d6['model'];if(_0x4acb90[_0x4e94('0x2e')]['includeAll']){_0x16bc26[_0x4e94('0x40')]=[{'all':!![]}];}_0x16bc26=_[_0x4e94('0x3c')]({},_0x16bc26,_0x4acb90[_0x4e94('0x3e')]);return db[_0x4e94('0x29')]['find'](_0x16bc26)['then'](handleEntityNotFound(_0x366f70,null))[_0x4e94('0x22')](respondWithResult(_0x366f70,null))[_0x4e94('0x42')](handleError(_0x366f70,null));};exports[_0x4e94('0x45')]=function(_0x3dfe12,_0xb955f7){return db[_0x4e94('0x29')][_0x4e94('0x45')](_0x3dfe12[_0x4e94('0x46')],{})['then'](respondWithResult(_0xb955f7,0xc9))['catch'](handleError(_0xb955f7,null));};exports[_0x4e94('0x21')]=function(_0x3d3040,_0x4779b7){if(_0x3d3040[_0x4e94('0x46')]['id']){delete _0x3d3040['body']['id'];}return db[_0x4e94('0x29')][_0x4e94('0x47')]({'where':{'id':_0x3d3040['params']['id']}})['then'](handleEntityNotFound(_0x4779b7,null))[_0x4e94('0x22')](saveUpdates(_0x3d3040[_0x4e94('0x46')],null))[_0x4e94('0x22')](respondWithResult(_0x4779b7,null))['catch'](handleError(_0x4779b7,null));};exports[_0x4e94('0x48')]=function(_0x4340f4,_0x59bd65){return db[_0x4e94('0x29')][_0x4e94('0x47')]({'where':{'id':_0x4340f4[_0x4e94('0x44')]['id']}})[_0x4e94('0x22')](handleEntityNotFound(_0x59bd65,null))['then'](removeEntity(_0x59bd65,null))[_0x4e94('0x42')](handleError(_0x59bd65,null));};exports['describe']=function(_0x4611d3,_0x318073){return db[_0x4e94('0x29')][_0x4e94('0x49')]()[_0x4e94('0x22')](respondWithResult(_0x318073,null))['catch'](handleError(_0x318073,null));}; \ No newline at end of file +var _0xa498=['VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','describe','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','map','ChatQueueReport','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','merge'];(function(_0x654add,_0x551f9){var _0x393413=function(_0x27eab0){while(--_0x27eab0){_0x654add['push'](_0x654add['shift']());}};_0x393413(++_0x551f9);}(_0xa498,0x1d6));var _0x8a49=function(_0x15482e,_0x25b23c){_0x15482e=_0x15482e-0x0;var _0x4a0651=_0xa498[_0x15482e];return _0x4a0651;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8a49('0x0'));var zipdir=require(_0x8a49('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8a49('0x2'));var BPromise=require(_0x8a49('0x3'));var Mustache=require(_0x8a49('0x4'));var util=require(_0x8a49('0x5'));var path=require(_0x8a49('0x6'));var sox=require('sox');var csv=require(_0x8a49('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8a49('0x8'));var _=require(_0x8a49('0x9'));var squel=require(_0x8a49('0xa'));var crypto=require('crypto');var jsforce=require(_0x8a49('0xb'));var deskjs=require(_0x8a49('0xc'));var toCsv=require(_0x8a49('0x7'));var querystring=require(_0x8a49('0xd'));var Papa=require(_0x8a49('0xe'));var Redis=require(_0x8a49('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x8a49('0x10'));var as=require(_0x8a49('0x11'));var hardwareService=require(_0x8a49('0x12'));var logger=require(_0x8a49('0x13'))(_0x8a49('0x14'));var utils=require(_0x8a49('0x15'));var config=require(_0x8a49('0x16'));var licenseUtil=require(_0x8a49('0x17'));var db=require(_0x8a49('0x18'))['db'];function respondWithStatusCode(_0x5b8111,_0x352528){_0x352528=_0x352528||0xcc;return function(_0x6ee27b){if(_0x6ee27b){return _0x5b8111[_0x8a49('0x19')](_0x352528);}return _0x5b8111['status'](_0x352528)[_0x8a49('0x1a')]();};}function respondWithResult(_0x57b350,_0x4454de){_0x4454de=_0x4454de||0xc8;return function(_0x2fe212){if(_0x2fe212){return _0x57b350['status'](_0x4454de)[_0x8a49('0x1b')](_0x2fe212);}};}function respondWithFilteredResult(_0x902ee2,_0x329a7b){return function(_0x4760d7){if(_0x4760d7){var _0x5275aa=typeof _0x329a7b['offset']===_0x8a49('0x1c')&&typeof _0x329a7b[_0x8a49('0x1d')]===_0x8a49('0x1c');var _0x2d0261=_0x4760d7['count'];var _0x47604e=_0x5275aa?0x0:_0x329a7b[_0x8a49('0x1e')];var _0x47328a=_0x5275aa?_0x4760d7[_0x8a49('0x1f')]:_0x329a7b[_0x8a49('0x1e')]+_0x329a7b['limit'];var _0x5ac3ca;if(_0x47328a>=_0x2d0261){_0x47328a=_0x2d0261;_0x5ac3ca=0xc8;}else{_0x5ac3ca=0xce;}_0x902ee2[_0x8a49('0x20')](_0x5ac3ca);return _0x902ee2[_0x8a49('0x21')](_0x8a49('0x22'),_0x47604e+'-'+_0x47328a+'/'+_0x2d0261)['json'](_0x4760d7);}return null;};}function patchUpdates(_0x2baa30){return function(_0x2e45fc){try{jsonpatch[_0x8a49('0x23')](_0x2e45fc,_0x2baa30,!![]);}catch(_0x21f407){return BPromise[_0x8a49('0x24')](_0x21f407);}return _0x2e45fc[_0x8a49('0x25')]();};}function saveUpdates(_0x16072f,_0x4bc3bc){return function(_0x304372){if(_0x304372){return _0x304372[_0x8a49('0x26')](_0x16072f)['then'](function(_0x3b6220){return _0x3b6220;});}return null;};}function removeEntity(_0x479bca,_0x41bee7){return function(_0x52811c){if(_0x52811c){return _0x52811c[_0x8a49('0x27')]()[_0x8a49('0x28')](function(){_0x479bca[_0x8a49('0x20')](0xcc)[_0x8a49('0x1a')]();});}};}function handleEntityNotFound(_0xe2ca8b,_0x2b5d8b){return function(_0x1b0a01){if(!_0x1b0a01){_0xe2ca8b['sendStatus'](0x194);}return _0x1b0a01;};}function handleError(_0x2fc60e,_0x4d72a3){_0x4d72a3=_0x4d72a3||0x1f4;return function(_0x29af9f){logger['error'](_0x29af9f[_0x8a49('0x29')]);if(_0x29af9f[_0x8a49('0x2a')]){delete _0x29af9f['name'];}_0x2fc60e['status'](_0x4d72a3)[_0x8a49('0x2b')](_0x29af9f);};}exports[_0x8a49('0x2c')]=function(_0x387b06,_0x30fffd){var _0x484a57={},_0x29de89={},_0xef6542={'count':0x0,'rows':[]};var _0x33d7c6=_[_0x8a49('0x2d')](db[_0x8a49('0x2e')]['rawAttributes'],function(_0x223ed9){return{'name':_0x223ed9[_0x8a49('0x2f')],'type':_0x223ed9[_0x8a49('0x30')][_0x8a49('0x31')]};});_0x29de89[_0x8a49('0x32')]=_[_0x8a49('0x2d')](_0x33d7c6,_0x8a49('0x2a'));_0x29de89['query']=_['keys'](_0x387b06[_0x8a49('0x33')]);_0x29de89[_0x8a49('0x34')]=_[_0x8a49('0x35')](_0x29de89[_0x8a49('0x32')],_0x29de89['query']);_0x484a57[_0x8a49('0x36')]=_[_0x8a49('0x35')](_0x29de89['model'],qs[_0x8a49('0x37')](_0x387b06['query'][_0x8a49('0x37')]));_0x484a57[_0x8a49('0x36')]=_0x484a57[_0x8a49('0x36')][_0x8a49('0x38')]?_0x484a57['attributes']:_0x29de89[_0x8a49('0x32')];if(!_0x387b06[_0x8a49('0x33')][_0x8a49('0x39')]('nolimit')){_0x484a57[_0x8a49('0x1d')]=qs['limit'](_0x387b06['query'][_0x8a49('0x1d')]);_0x484a57[_0x8a49('0x1e')]=qs[_0x8a49('0x1e')](_0x387b06[_0x8a49('0x33')]['offset']);}_0x484a57['order']=qs[_0x8a49('0x3a')](_0x387b06[_0x8a49('0x33')][_0x8a49('0x3a')]);_0x484a57[_0x8a49('0x3b')]=qs['filters'](_[_0x8a49('0x3c')](_0x387b06[_0x8a49('0x33')],_0x29de89[_0x8a49('0x34')]),_0x33d7c6);if(_0x387b06['query']['filter']){_0x484a57[_0x8a49('0x3b')]=_[_0x8a49('0x3d')](_0x484a57[_0x8a49('0x3b')],{'$or':_['map'](_0x33d7c6,function(_0x158d8c){if(_0x158d8c[_0x8a49('0x30')]!==_0x8a49('0x3e')){var _0x7b71bb={};_0x7b71bb[_0x158d8c[_0x8a49('0x2a')]]={'$like':'%'+_0x387b06[_0x8a49('0x33')]['filter']+'%'};return _0x7b71bb;}})});}_0x484a57=_[_0x8a49('0x3d')]({},_0x484a57,_0x387b06[_0x8a49('0x3f')]);var _0x309482={'where':_0x484a57[_0x8a49('0x3b')]};return db[_0x8a49('0x2e')][_0x8a49('0x1f')](_0x309482)['then'](function(_0x2c9838){_0xef6542[_0x8a49('0x1f')]=_0x2c9838;if(_0x387b06[_0x8a49('0x33')][_0x8a49('0x40')]){_0x484a57[_0x8a49('0x41')]=[{'all':!![]}];}return db[_0x8a49('0x2e')][_0x8a49('0x42')](_0x484a57);})[_0x8a49('0x28')](function(_0x41b6c2){_0xef6542[_0x8a49('0x43')]=_0x41b6c2;return _0xef6542;})[_0x8a49('0x28')](respondWithFilteredResult(_0x30fffd,_0x484a57))['catch'](handleError(_0x30fffd,null));};exports[_0x8a49('0x44')]=function(_0x1b4b6d,_0x2938a8){var _0x4aac2b={'raw':!![],'where':{'id':_0x1b4b6d[_0x8a49('0x45')]['id']}},_0x411c9d={};_0x411c9d[_0x8a49('0x32')]=_[_0x8a49('0x46')](db[_0x8a49('0x2e')]['rawAttributes']);_0x411c9d[_0x8a49('0x33')]=_[_0x8a49('0x46')](_0x1b4b6d['query']);_0x411c9d[_0x8a49('0x34')]=_['intersection'](_0x411c9d['model'],_0x411c9d[_0x8a49('0x33')]);_0x4aac2b['attributes']=_[_0x8a49('0x35')](_0x411c9d[_0x8a49('0x32')],qs[_0x8a49('0x37')](_0x1b4b6d[_0x8a49('0x33')]['fields']));_0x4aac2b[_0x8a49('0x36')]=_0x4aac2b[_0x8a49('0x36')][_0x8a49('0x38')]?_0x4aac2b[_0x8a49('0x36')]:_0x411c9d[_0x8a49('0x32')];if(_0x1b4b6d[_0x8a49('0x33')][_0x8a49('0x40')]){_0x4aac2b['include']=[{'all':!![]}];}_0x4aac2b=_['merge']({},_0x4aac2b,_0x1b4b6d[_0x8a49('0x3f')]);return db[_0x8a49('0x2e')][_0x8a49('0x47')](_0x4aac2b)[_0x8a49('0x28')](handleEntityNotFound(_0x2938a8,null))[_0x8a49('0x28')](respondWithResult(_0x2938a8,null))[_0x8a49('0x48')](handleError(_0x2938a8,null));};exports[_0x8a49('0x49')]=function(_0x33ec7a,_0x5a428a){return db[_0x8a49('0x2e')][_0x8a49('0x49')](_0x33ec7a[_0x8a49('0x4a')],{})[_0x8a49('0x28')](respondWithResult(_0x5a428a,0xc9))[_0x8a49('0x48')](handleError(_0x5a428a,null));};exports[_0x8a49('0x26')]=function(_0x3d8fcc,_0xe3e213){if(_0x3d8fcc[_0x8a49('0x4a')]['id']){delete _0x3d8fcc[_0x8a49('0x4a')]['id'];}return db[_0x8a49('0x2e')]['find']({'where':{'id':_0x3d8fcc['params']['id']}})[_0x8a49('0x28')](handleEntityNotFound(_0xe3e213,null))[_0x8a49('0x28')](saveUpdates(_0x3d8fcc[_0x8a49('0x4a')],null))[_0x8a49('0x28')](respondWithResult(_0xe3e213,null))[_0x8a49('0x48')](handleError(_0xe3e213,null));};exports[_0x8a49('0x27')]=function(_0x3e066e,_0x4d9306){return db['ChatQueueReport']['find']({'where':{'id':_0x3e066e[_0x8a49('0x45')]['id']}})[_0x8a49('0x28')](handleEntityNotFound(_0x4d9306,null))[_0x8a49('0x28')](removeEntity(_0x4d9306,null))['catch'](handleError(_0x4d9306,null));};exports[_0x8a49('0x4b')]=function(_0x1debb8,_0x3746ff){return db[_0x8a49('0x2e')][_0x8a49('0x4b')]()[_0x8a49('0x28')](respondWithResult(_0x3746ff,null))[_0x8a49('0x48')](handleError(_0x3746ff,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 31c8797..f44af31 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['define','report_chat_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1b166c,_0x39300f){var _0x5d3a16=function(_0x45b75d){while(--_0x45b75d){_0x1b166c['push'](_0x1b166c['shift']());}};_0x5d3a16(++_0x39300f);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./chatQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid'];(function(_0x561771,_0x554760){var _0x54d16e=function(_0x381c1f){while(--_0x381c1f){_0x561771['push'](_0x561771['shift']());}};_0x54d16e(++_0x554760);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 66efac1..47b61c7 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 _0xb7f9=['CreateChatQueueReport','ChatQueueReport','body','options','debug','UpdateChatQueueReport','update','raw','where','attributes','limit','lodash','util','moment','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x5e05be,_0x4dd828){var _0x5a0d61=function(_0x2b3e23){while(--_0x2b3e23){_0x5e05be['push'](_0x5e05be['shift']());}};_0x5a0d61(++_0x4dd828);}(_0xb7f9,0xab));var _0x9b7f=function(_0x171ca9,_0x2bb32d){_0x171ca9=_0x171ca9-0x0;var _0x31668f=_0xb7f9[_0x171ca9];return _0x31668f;};'use strict';var _=require(_0x9b7f('0x0'));var util=require(_0x9b7f('0x1'));var moment=require(_0x9b7f('0x2'));var BPromise=require('bluebird');var rs=require(_0x9b7f('0x3'));var fs=require('fs');var Redis=require(_0x9b7f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9b7f('0x5'));var config=require(_0x9b7f('0x6'));var jayson=require(_0x9b7f('0x7'));var client=jayson[_0x9b7f('0x8')][_0x9b7f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x415ec9,_0x522dc,_0x3d95ac){return new BPromise(function(_0x2287a3,_0x4f39cc){return client[_0x9b7f('0xa')](_0x415ec9,_0x3d95ac)[_0x9b7f('0xb')](function(_0x462385){logger[_0x9b7f('0xc')](_0x9b7f('0xd'),_0x522dc,_0x9b7f('0xe'));logger['debug']('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x522dc,_0x9b7f('0xe'),JSON[_0x9b7f('0xf')](_0x462385));if(_0x462385[_0x9b7f('0x10')]){if(_0x462385[_0x9b7f('0x10')][_0x9b7f('0x11')]===0x1f4){logger[_0x9b7f('0x10')](_0x9b7f('0xd'),_0x522dc,_0x462385['error'][_0x9b7f('0x12')]);return _0x4f39cc(_0x462385[_0x9b7f('0x10')][_0x9b7f('0x12')]);}logger[_0x9b7f('0x10')](_0x9b7f('0xd'),_0x522dc,_0x462385[_0x9b7f('0x10')][_0x9b7f('0x12')]);return _0x2287a3(_0x462385[_0x9b7f('0x10')][_0x9b7f('0x12')]);}else{logger[_0x9b7f('0xc')](_0x9b7f('0xd'),_0x522dc,'request\x20sent');_0x2287a3(_0x462385[_0x9b7f('0x13')][_0x9b7f('0x12')]);}})[_0x9b7f('0x14')](function(_0x4ee6e6){logger['error'](_0x9b7f('0xd'),_0x522dc,_0x4ee6e6);_0x4f39cc(_0x4ee6e6);});});}exports[_0x9b7f('0x15')]=function(_0x22e0e5){var _0x408034=this;return new Promise(function(_0x40f98a,_0x4733d9){return db[_0x9b7f('0x16')]['create'](_0x22e0e5[_0x9b7f('0x17')],{'raw':_0x22e0e5['options']?_0x22e0e5[_0x9b7f('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x9b7f('0xb')](function(_0x2923cc){logger[_0x9b7f('0xc')](_0x9b7f('0x15'),_0x22e0e5);logger[_0x9b7f('0x19')](_0x9b7f('0x15'),_0x22e0e5,JSON['stringify'](_0x2923cc));_0x40f98a(_0x2923cc);})[_0x9b7f('0x14')](function(_0x3c8fda){logger[_0x9b7f('0x10')](_0x9b7f('0x15'),_0x3c8fda[_0x9b7f('0x12')],_0x22e0e5);_0x4733d9(_0x408034[_0x9b7f('0x10')](0x1f4,_0x3c8fda[_0x9b7f('0x12')]));});});};exports[_0x9b7f('0x1a')]=function(_0x3e8b77){var _0x279875=this;return new Promise(function(_0x1bf87d,_0x19d635){return db['ChatQueueReport'][_0x9b7f('0x1b')](_0x3e8b77[_0x9b7f('0x17')],{'raw':_0x3e8b77[_0x9b7f('0x18')]?_0x3e8b77['options'][_0x9b7f('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e8b77['options']?_0x3e8b77[_0x9b7f('0x18')][_0x9b7f('0x1d')]||null:null,'attributes':_0x3e8b77[_0x9b7f('0x18')]?_0x3e8b77['options'][_0x9b7f('0x1e')]||null:null,'limit':_0x3e8b77[_0x9b7f('0x18')]?_0x3e8b77[_0x9b7f('0x18')][_0x9b7f('0x1f')]||null:null})[_0x9b7f('0xb')](function(_0x2e6134){logger[_0x9b7f('0xc')]('UpdateChatQueueReport',_0x3e8b77);logger['debug']('UpdateChatQueueReport',_0x3e8b77,JSON['stringify'](_0x2e6134));_0x1bf87d(_0x2e6134);})[_0x9b7f('0x14')](function(_0x395f11){logger[_0x9b7f('0x10')](_0x9b7f('0x1a'),_0x395f11[_0x9b7f('0x12')],_0x3e8b77);_0x19d635(_0x279875['error'](0x1f4,_0x395f11[_0x9b7f('0x12')]));});});}; \ No newline at end of file +var _0x75b5=['ioredis','../../config/logger','rpc','jayson/promise','request','then','info','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','ChatQueueReport,\x20%s,\x20%s','message','result','CreateChatQueueReport','ChatQueueReport','options','raw','catch','UpdateChatQueueReport','update','body','where','lodash','util','moment','bluebird','randomstring'];(function(_0x521956,_0x37281f){var _0x25a9a1=function(_0x5ce9c7){while(--_0x5ce9c7){_0x521956['push'](_0x521956['shift']());}};_0x25a9a1(++_0x37281f);}(_0x75b5,0x11d));var _0x575b=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0x75b5[_0x1abb09];return _0xea1c07;};'use strict';var _=require(_0x575b('0x0'));var util=require(_0x575b('0x1'));var moment=require(_0x575b('0x2'));var BPromise=require(_0x575b('0x3'));var rs=require(_0x575b('0x4'));var fs=require('fs');var Redis=require(_0x575b('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x575b('0x6'))(_0x575b('0x7'));var config=require('../../config/environment');var jayson=require(_0x575b('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3e7541,_0x4d6cec,_0x3a312b){return new BPromise(function(_0x2854b0,_0x3a1071){return client[_0x575b('0x9')](_0x3e7541,_0x3a312b)[_0x575b('0xa')](function(_0x28fd9a){logger[_0x575b('0xb')]('ChatQueueReport,\x20%s,\x20%s',_0x4d6cec,_0x575b('0xc'));logger[_0x575b('0xd')](_0x575b('0xe'),_0x4d6cec,_0x575b('0xc'),JSON[_0x575b('0xf')](_0x28fd9a));if(_0x28fd9a[_0x575b('0x10')]){if(_0x28fd9a[_0x575b('0x10')]['code']===0x1f4){logger[_0x575b('0x10')](_0x575b('0x11'),_0x4d6cec,_0x28fd9a[_0x575b('0x10')][_0x575b('0x12')]);return _0x3a1071(_0x28fd9a[_0x575b('0x10')][_0x575b('0x12')]);}logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x4d6cec,_0x28fd9a['error'][_0x575b('0x12')]);return _0x2854b0(_0x28fd9a['error'][_0x575b('0x12')]);}else{logger['info'](_0x575b('0x11'),_0x4d6cec,'request\x20sent');_0x2854b0(_0x28fd9a[_0x575b('0x13')]['message']);}})['catch'](function(_0x15af02){logger[_0x575b('0x10')](_0x575b('0x11'),_0x4d6cec,_0x15af02);_0x3a1071(_0x15af02);});});}exports[_0x575b('0x14')]=function(_0x3d627e){var _0x504ac3=this;return new Promise(function(_0x3ce80d,_0x46243f){return db[_0x575b('0x15')]['create'](_0x3d627e['body'],{'raw':_0x3d627e[_0x575b('0x16')]?_0x3d627e[_0x575b('0x16')][_0x575b('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x434b19){logger[_0x575b('0xb')]('CreateChatQueueReport',_0x3d627e);logger[_0x575b('0xd')](_0x575b('0x14'),_0x3d627e,JSON[_0x575b('0xf')](_0x434b19));_0x3ce80d(_0x434b19);})[_0x575b('0x18')](function(_0xdfa4b){logger[_0x575b('0x10')]('CreateChatQueueReport',_0xdfa4b[_0x575b('0x12')],_0x3d627e);_0x46243f(_0x504ac3[_0x575b('0x10')](0x1f4,_0xdfa4b[_0x575b('0x12')]));});});};exports[_0x575b('0x19')]=function(_0x1c77d2){var _0x2a3286=this;return new Promise(function(_0x4cd39f,_0x2f0048){return db['ChatQueueReport'][_0x575b('0x1a')](_0x1c77d2[_0x575b('0x1b')],{'raw':_0x1c77d2[_0x575b('0x16')]?_0x1c77d2[_0x575b('0x16')][_0x575b('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c77d2[_0x575b('0x16')]?_0x1c77d2[_0x575b('0x16')][_0x575b('0x1c')]||null:null,'attributes':_0x1c77d2['options']?_0x1c77d2['options']['attributes']||null:null,'limit':_0x1c77d2[_0x575b('0x16')]?_0x1c77d2[_0x575b('0x16')]['limit']||null:null})['then'](function(_0x556556){logger[_0x575b('0xb')](_0x575b('0x19'),_0x1c77d2);logger['debug']('UpdateChatQueueReport',_0x1c77d2,JSON[_0x575b('0xf')](_0x556556));_0x4cd39f(_0x556556);})['catch'](function(_0x1169a0){logger[_0x575b('0x10')](_0x575b('0x19'),_0x1169a0[_0x575b('0x12')],_0x1c77d2);_0x2f0048(_0x2a3286[_0x575b('0x10')](0x1f4,_0x1169a0[_0x575b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index f89a412..2e5f78a 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 _0x3b2e=['get','/describe','describe','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueueReport.controller','isAuthenticated','index'];(function(_0x27c515,_0x3e122e){var _0x180319=function(_0x3002e3){while(--_0x3002e3){_0x27c515['push'](_0x27c515['shift']());}};_0x180319(++_0x3e122e);}(_0x3b2e,0xb3));var _0xe3b2=function(_0x1e49ee,_0x3257b6){_0x1e49ee=_0x1e49ee-0x0;var _0x3dcf1e=_0x3b2e[_0x1e49ee];return _0x3dcf1e;};'use strict';var multer=require('multer');var util=require(_0xe3b2('0x0'));var path=require(_0xe3b2('0x1'));var timeout=require(_0xe3b2('0x2'));var express=require(_0xe3b2('0x3'));var router=express[_0xe3b2('0x4')]();var fs_extra=require(_0xe3b2('0x5'));var auth=require(_0xe3b2('0x6'));var interaction=require(_0xe3b2('0x7'));var config=require('../../config/environment');var controller=require(_0xe3b2('0x8'));router['get']('/',auth[_0xe3b2('0x9')](),controller[_0xe3b2('0xa')]);router[_0xe3b2('0xb')](_0xe3b2('0xc'),auth[_0xe3b2('0x9')](),controller[_0xe3b2('0xd')]);router[_0xe3b2('0xb')](_0xe3b2('0xe'),auth[_0xe3b2('0x9')](),controller['show']);router['post']('/',auth[_0xe3b2('0x9')](),controller['create']);router['put'](_0xe3b2('0xe'),auth['isAuthenticated'](),controller[_0xe3b2('0xf')]);router[_0xe3b2('0x10')](_0xe3b2('0xe'),auth[_0xe3b2('0x9')](),controller[_0xe3b2('0x11')]);module[_0xe3b2('0x12')]=router; \ No newline at end of file +var _0x4346=['util','path','connect-timeout','../../components/interaction/service','./chatQueueReport.controller','get','isAuthenticated','/describe','describe','show','create','put','/:id','update','destroy','exports','multer'];(function(_0x4e0359,_0x205155){var _0x450f0a=function(_0x2056c6){while(--_0x2056c6){_0x4e0359['push'](_0x4e0359['shift']());}};_0x450f0a(++_0x205155);}(_0x4346,0x120));var _0x6434=function(_0x5de532,_0x2941c4){_0x5de532=_0x5de532-0x0;var _0x4e9192=_0x4346[_0x5de532];return _0x4e9192;};'use strict';var multer=require(_0x6434('0x0'));var util=require(_0x6434('0x1'));var path=require(_0x6434('0x2'));var timeout=require(_0x6434('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6434('0x4'));var config=require('../../config/environment');var controller=require(_0x6434('0x5'));router[_0x6434('0x6')]('/',auth[_0x6434('0x7')](),controller['index']);router['get'](_0x6434('0x8'),auth['isAuthenticated'](),controller[_0x6434('0x9')]);router[_0x6434('0x6')]('/:id',auth[_0x6434('0x7')](),controller[_0x6434('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6434('0xb')]);router[_0x6434('0xc')](_0x6434('0xd'),auth[_0x6434('0x7')](),controller[_0x6434('0xe')]);router['delete'](_0x6434('0xd'),auth[_0x6434('0x7')](),controller[_0x6434('0xf')]);module[_0x6434('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index a10cdaf..e0eae61 100644 --- a/server/api/chatTransferReport/chatTransferReport.attributes.js +++ b/server/api/chatTransferReport/chatTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x19046c,_0x2494b5){var _0x469c79=function(_0x59cd03){while(--_0x59cd03){_0x19046c['push'](_0x19046c['shift']());}};_0x469c79(++_0x2494b5);}(_0x008c,0x188));var _0xc008=function(_0x5657bb,_0x2f1219){_0x5657bb=_0x5657bb-0x0;var _0x2a5ecb=_0x008c[_0x5657bb];return _0x2a5ecb;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x5d6cf0,_0x3296fa){var _0x664405=function(_0x4e3027){while(--_0x4e3027){_0x5d6cf0['push'](_0x5d6cf0['shift']());}};_0x664405(++_0x3296fa);}(_0x00bb,0x1d8));var _0xb00b=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x00bb[_0x42245d];return _0x4b211a;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 05b7ad3..997c3e3 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 _0xe824=['create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','to-csv','ejs','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ChatTransferReport','includeAll','include','findAll','rows','catch','show','find'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0xe824,0x98));var _0x4e82=function(_0x316904,_0x1e8b77){_0x316904=_0x316904-0x0;var _0xfa9a21=_0xe824[_0x316904];return _0xfa9a21;};'use strict';var emlformat=require(_0x4e82('0x0'));var rimraf=require(_0x4e82('0x1'));var zipdir=require(_0x4e82('0x2'));var jsonpatch=require(_0x4e82('0x3'));var rp=require('request-promise');var moment=require(_0x4e82('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4e82('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x4e82('0x6'));var ejs=require(_0x4e82('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4e82('0x8'));var crypto=require('crypto');var jsforce=require(_0x4e82('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4e82('0xa'));var Papa=require(_0x4e82('0xb'));var Redis=require('ioredis');var authService=require(_0x4e82('0xc'));var qs=require(_0x4e82('0xd'));var as=require(_0x4e82('0xe'));var hardwareService=require(_0x4e82('0xf'));var logger=require(_0x4e82('0x10'))('api');var utils=require(_0x4e82('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x4e82('0x12'));var db=require(_0x4e82('0x13'))['db'];function respondWithStatusCode(_0x109560,_0x140270){_0x140270=_0x140270||0xcc;return function(_0x2fbdf4){if(_0x2fbdf4){return _0x109560['sendStatus'](_0x140270);}return _0x109560[_0x4e82('0x14')](_0x140270)[_0x4e82('0x15')]();};}function respondWithResult(_0x3b8a7c,_0x56c5ee){_0x56c5ee=_0x56c5ee||0xc8;return function(_0x4e46b4){if(_0x4e46b4){return _0x3b8a7c[_0x4e82('0x14')](_0x56c5ee)[_0x4e82('0x16')](_0x4e46b4);}};}function respondWithFilteredResult(_0x50f432,_0xbce717){return function(_0x3db3dd){if(_0x3db3dd){var _0x48a7c7=typeof _0xbce717[_0x4e82('0x17')]===_0x4e82('0x18')&&typeof _0xbce717[_0x4e82('0x19')]===_0x4e82('0x18');var _0x518594=_0x3db3dd[_0x4e82('0x1a')];var _0x1f4f79=_0x48a7c7?0x0:_0xbce717[_0x4e82('0x17')];var _0x4b794b=_0x48a7c7?_0x3db3dd[_0x4e82('0x1a')]:_0xbce717[_0x4e82('0x17')]+_0xbce717[_0x4e82('0x19')];var _0x1d9c6a;if(_0x4b794b>=_0x518594){_0x4b794b=_0x518594;_0x1d9c6a=0xc8;}else{_0x1d9c6a=0xce;}_0x50f432[_0x4e82('0x14')](_0x1d9c6a);return _0x50f432[_0x4e82('0x1b')](_0x4e82('0x1c'),_0x1f4f79+'-'+_0x4b794b+'/'+_0x518594)[_0x4e82('0x16')](_0x3db3dd);}return null;};}function patchUpdates(_0x20ce54){return function(_0x563701){try{jsonpatch[_0x4e82('0x1d')](_0x563701,_0x20ce54,!![]);}catch(_0x439638){return BPromise[_0x4e82('0x1e')](_0x439638);}return _0x563701[_0x4e82('0x1f')]();};}function saveUpdates(_0xedd5dc,_0x52e13e){return function(_0x4889f8){if(_0x4889f8){return _0x4889f8[_0x4e82('0x20')](_0xedd5dc)[_0x4e82('0x21')](function(_0x9d1bab){return _0x9d1bab;});}return null;};}function removeEntity(_0x31bb77,_0x3a6815){return function(_0xafd8e0){if(_0xafd8e0){return _0xafd8e0[_0x4e82('0x22')]()[_0x4e82('0x21')](function(){_0x31bb77[_0x4e82('0x14')](0xcc)[_0x4e82('0x15')]();});}};}function handleEntityNotFound(_0x11b05f,_0x1b08ed){return function(_0x2c75eb){if(!_0x2c75eb){_0x11b05f[_0x4e82('0x23')](0x194);}return _0x2c75eb;};}function handleError(_0x592116,_0x24d0d0){_0x24d0d0=_0x24d0d0||0x1f4;return function(_0x23fc77){logger[_0x4e82('0x24')](_0x23fc77[_0x4e82('0x25')]);if(_0x23fc77[_0x4e82('0x26')]){delete _0x23fc77[_0x4e82('0x26')];}_0x592116[_0x4e82('0x14')](_0x24d0d0)[_0x4e82('0x27')](_0x23fc77);};}exports['index']=function(_0x3f0d0a,_0x1fe362){var _0x17c854={},_0x3cde2f={},_0x337f4d={'count':0x0,'rows':[]};var _0x558a91=_[_0x4e82('0x28')](db['ChatTransferReport'][_0x4e82('0x29')],function(_0x230779){return{'name':_0x230779[_0x4e82('0x2a')],'type':_0x230779[_0x4e82('0x2b')]['key']};});_0x3cde2f['model']=_[_0x4e82('0x28')](_0x558a91,_0x4e82('0x26'));_0x3cde2f[_0x4e82('0x2c')]=_[_0x4e82('0x2d')](_0x3f0d0a['query']);_0x3cde2f[_0x4e82('0x2e')]=_[_0x4e82('0x2f')](_0x3cde2f['model'],_0x3cde2f[_0x4e82('0x2c')]);_0x17c854[_0x4e82('0x30')]=_[_0x4e82('0x2f')](_0x3cde2f['model'],qs[_0x4e82('0x31')](_0x3f0d0a[_0x4e82('0x2c')]['fields']));_0x17c854[_0x4e82('0x30')]=_0x17c854[_0x4e82('0x30')][_0x4e82('0x32')]?_0x17c854[_0x4e82('0x30')]:_0x3cde2f[_0x4e82('0x33')];if(!_0x3f0d0a['query'][_0x4e82('0x34')](_0x4e82('0x35'))){_0x17c854[_0x4e82('0x19')]=qs[_0x4e82('0x19')](_0x3f0d0a[_0x4e82('0x2c')][_0x4e82('0x19')]);_0x17c854['offset']=qs[_0x4e82('0x17')](_0x3f0d0a['query']['offset']);}_0x17c854[_0x4e82('0x36')]=qs[_0x4e82('0x37')](_0x3f0d0a['query'][_0x4e82('0x37')]);_0x17c854[_0x4e82('0x38')]=qs['filters'](_[_0x4e82('0x39')](_0x3f0d0a[_0x4e82('0x2c')],_0x3cde2f[_0x4e82('0x2e')]),_0x558a91);if(_0x3f0d0a['query'][_0x4e82('0x3a')]){_0x17c854[_0x4e82('0x38')]=_[_0x4e82('0x3b')](_0x17c854['where'],{'$or':_[_0x4e82('0x28')](_0x558a91,function(_0x311c03){if(_0x311c03['type']!==_0x4e82('0x3c')){var _0x5783ad={};_0x5783ad[_0x311c03[_0x4e82('0x26')]]={'$like':'%'+_0x3f0d0a[_0x4e82('0x2c')][_0x4e82('0x3a')]+'%'};return _0x5783ad;}})});}_0x17c854=_['merge']({},_0x17c854,_0x3f0d0a[_0x4e82('0x3d')]);var _0x3b23ef={'where':_0x17c854['where']};return db[_0x4e82('0x3e')][_0x4e82('0x1a')](_0x3b23ef)['then'](function(_0x4af23b){_0x337f4d['count']=_0x4af23b;if(_0x3f0d0a[_0x4e82('0x2c')][_0x4e82('0x3f')]){_0x17c854[_0x4e82('0x40')]=[{'all':!![]}];}return db[_0x4e82('0x3e')][_0x4e82('0x41')](_0x17c854);})[_0x4e82('0x21')](function(_0x27eabb){_0x337f4d[_0x4e82('0x42')]=_0x27eabb;return _0x337f4d;})['then'](respondWithFilteredResult(_0x1fe362,_0x17c854))[_0x4e82('0x43')](handleError(_0x1fe362,null));};exports[_0x4e82('0x44')]=function(_0x30a905,_0x43b8d7){var _0x1e4e6d={'raw':!![],'where':{'id':_0x30a905['params']['id']}},_0x124b60={};_0x124b60[_0x4e82('0x33')]=_[_0x4e82('0x2d')](db[_0x4e82('0x3e')][_0x4e82('0x29')]);_0x124b60['query']=_['keys'](_0x30a905[_0x4e82('0x2c')]);_0x124b60['filters']=_[_0x4e82('0x2f')](_0x124b60['model'],_0x124b60['query']);_0x1e4e6d['attributes']=_[_0x4e82('0x2f')](_0x124b60[_0x4e82('0x33')],qs[_0x4e82('0x31')](_0x30a905[_0x4e82('0x2c')]['fields']));_0x1e4e6d[_0x4e82('0x30')]=_0x1e4e6d['attributes'][_0x4e82('0x32')]?_0x1e4e6d[_0x4e82('0x30')]:_0x124b60[_0x4e82('0x33')];if(_0x30a905['query']['includeAll']){_0x1e4e6d[_0x4e82('0x40')]=[{'all':!![]}];}_0x1e4e6d=_[_0x4e82('0x3b')]({},_0x1e4e6d,_0x30a905['options']);return db[_0x4e82('0x3e')][_0x4e82('0x45')](_0x1e4e6d)[_0x4e82('0x21')](handleEntityNotFound(_0x43b8d7,null))[_0x4e82('0x21')](respondWithResult(_0x43b8d7,null))[_0x4e82('0x43')](handleError(_0x43b8d7,null));};exports[_0x4e82('0x46')]=function(_0x8526e7,_0x20b633){return db[_0x4e82('0x3e')][_0x4e82('0x46')](_0x8526e7[_0x4e82('0x47')],{})[_0x4e82('0x21')](respondWithResult(_0x20b633,0xc9))[_0x4e82('0x43')](handleError(_0x20b633,null));};exports[_0x4e82('0x20')]=function(_0x2696b6,_0x48bb38){if(_0x2696b6[_0x4e82('0x47')]['id']){delete _0x2696b6[_0x4e82('0x47')]['id'];}return db['ChatTransferReport'][_0x4e82('0x45')]({'where':{'id':_0x2696b6['params']['id']}})[_0x4e82('0x21')](handleEntityNotFound(_0x48bb38,null))[_0x4e82('0x21')](saveUpdates(_0x2696b6[_0x4e82('0x47')],null))[_0x4e82('0x21')](respondWithResult(_0x48bb38,null))[_0x4e82('0x43')](handleError(_0x48bb38,null));};exports[_0x4e82('0x22')]=function(_0x44ddfa,_0x31648a){return db['ChatTransferReport']['find']({'where':{'id':_0x44ddfa[_0x4e82('0x48')]['id']}})['then'](handleEntityNotFound(_0x31648a,null))[_0x4e82('0x21')](removeEntity(_0x31648a,null))['catch'](handleError(_0x31648a,null));};exports[_0x4e82('0x49')]=function(_0x273fce,_0x140555){return db[_0x4e82('0x3e')][_0x4e82('0x49')]()[_0x4e82('0x21')](respondWithResult(_0x140555,null))[_0x4e82('0x43')](handleError(_0x140555,null));}; \ No newline at end of file +var _0x1264=['fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','then','error','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','keys','include','find','create','update','describe','eml-format','rimraf','zip-dir'];(function(_0xda501a,_0x159d6a){var _0x44be3a=function(_0x5c1c5f){while(--_0x5c1c5f){_0xda501a['push'](_0xda501a['shift']());}};_0x44be3a(++_0x159d6a);}(_0x1264,0xde));var _0x4126=function(_0x4fbb86,_0x374ed0){_0x4fbb86=_0x4fbb86-0x0;var _0xb141fe=_0x1264[_0x4fbb86];return _0xb141fe;};'use strict';var emlformat=require(_0x4126('0x0'));var rimraf=require(_0x4126('0x1'));var zipdir=require(_0x4126('0x2'));var jsonpatch=require(_0x4126('0x3'));var rp=require(_0x4126('0x4'));var moment=require(_0x4126('0x5'));var BPromise=require(_0x4126('0x6'));var Mustache=require('mustache');var util=require(_0x4126('0x7'));var path=require('path');var sox=require(_0x4126('0x8'));var csv=require(_0x4126('0x9'));var ejs=require(_0x4126('0xa'));var fs=require('fs');var fs_extra=require(_0x4126('0xb'));var _=require(_0x4126('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4126('0xd'));var deskjs=require(_0x4126('0xe'));var toCsv=require(_0x4126('0x9'));var querystring=require(_0x4126('0xf'));var Papa=require(_0x4126('0x10'));var Redis=require('ioredis');var authService=require(_0x4126('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4126('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4126('0x13'))(_0x4126('0x14'));var utils=require(_0x4126('0x15'));var config=require(_0x4126('0x16'));var licenseUtil=require(_0x4126('0x17'));var db=require(_0x4126('0x18'))['db'];function respondWithStatusCode(_0x4e2f27,_0x590a82){_0x590a82=_0x590a82||0xcc;return function(_0x42aa52){if(_0x42aa52){return _0x4e2f27[_0x4126('0x19')](_0x590a82);}return _0x4e2f27[_0x4126('0x1a')](_0x590a82)[_0x4126('0x1b')]();};}function respondWithResult(_0x16da8e,_0x2d1602){_0x2d1602=_0x2d1602||0xc8;return function(_0x51917b){if(_0x51917b){return _0x16da8e[_0x4126('0x1a')](_0x2d1602)[_0x4126('0x1c')](_0x51917b);}};}function respondWithFilteredResult(_0x147f3d,_0x173400){return function(_0x5c4510){if(_0x5c4510){var _0x13ff17=typeof _0x173400[_0x4126('0x1d')]==='undefined'&&typeof _0x173400[_0x4126('0x1e')]==='undefined';var _0x578820=_0x5c4510['count'];var _0x139425=_0x13ff17?0x0:_0x173400[_0x4126('0x1d')];var _0x49a0de=_0x13ff17?_0x5c4510[_0x4126('0x1f')]:_0x173400['offset']+_0x173400[_0x4126('0x1e')];var _0x1e7e87;if(_0x49a0de>=_0x578820){_0x49a0de=_0x578820;_0x1e7e87=0xc8;}else{_0x1e7e87=0xce;}_0x147f3d[_0x4126('0x1a')](_0x1e7e87);return _0x147f3d[_0x4126('0x20')](_0x4126('0x21'),_0x139425+'-'+_0x49a0de+'/'+_0x578820)['json'](_0x5c4510);}return null;};}function patchUpdates(_0x1b8987){return function(_0x1565cc){try{jsonpatch[_0x4126('0x22')](_0x1565cc,_0x1b8987,!![]);}catch(_0x2015db){return BPromise['reject'](_0x2015db);}return _0x1565cc['save']();};}function saveUpdates(_0x52d98a,_0x10db53){return function(_0x58846f){if(_0x58846f){return _0x58846f['update'](_0x52d98a)[_0x4126('0x23')](function(_0x221bb3){return _0x221bb3;});}return null;};}function removeEntity(_0xaff954,_0x50bf8a){return function(_0x4df224){if(_0x4df224){return _0x4df224['destroy']()[_0x4126('0x23')](function(){_0xaff954[_0x4126('0x1a')](0xcc)[_0x4126('0x1b')]();});}};}function handleEntityNotFound(_0x6db5f4,_0x12a947){return function(_0xc6e1b9){if(!_0xc6e1b9){_0x6db5f4[_0x4126('0x19')](0x194);}return _0xc6e1b9;};}function handleError(_0x2079de,_0x3a4df5){_0x3a4df5=_0x3a4df5||0x1f4;return function(_0x1834a3){logger[_0x4126('0x24')](_0x1834a3[_0x4126('0x25')]);if(_0x1834a3[_0x4126('0x26')]){delete _0x1834a3[_0x4126('0x26')];}_0x2079de[_0x4126('0x1a')](_0x3a4df5)[_0x4126('0x27')](_0x1834a3);};}exports[_0x4126('0x28')]=function(_0x36633e,_0x51c5b7){var _0x5d9a96={},_0x1c4aca={},_0x19e481={'count':0x0,'rows':[]};var _0x6bacec=_[_0x4126('0x29')](db[_0x4126('0x2a')][_0x4126('0x2b')],function(_0x201691){return{'name':_0x201691[_0x4126('0x2c')],'type':_0x201691[_0x4126('0x2d')][_0x4126('0x2e')]};});_0x1c4aca[_0x4126('0x2f')]=_['map'](_0x6bacec,'name');_0x1c4aca[_0x4126('0x30')]=_['keys'](_0x36633e[_0x4126('0x30')]);_0x1c4aca[_0x4126('0x31')]=_[_0x4126('0x32')](_0x1c4aca[_0x4126('0x2f')],_0x1c4aca[_0x4126('0x30')]);_0x5d9a96[_0x4126('0x33')]=_[_0x4126('0x32')](_0x1c4aca[_0x4126('0x2f')],qs['fields'](_0x36633e[_0x4126('0x30')][_0x4126('0x34')]));_0x5d9a96[_0x4126('0x33')]=_0x5d9a96[_0x4126('0x33')][_0x4126('0x35')]?_0x5d9a96[_0x4126('0x33')]:_0x1c4aca[_0x4126('0x2f')];if(!_0x36633e[_0x4126('0x30')][_0x4126('0x36')](_0x4126('0x37'))){_0x5d9a96['limit']=qs[_0x4126('0x1e')](_0x36633e[_0x4126('0x30')][_0x4126('0x1e')]);_0x5d9a96[_0x4126('0x1d')]=qs[_0x4126('0x1d')](_0x36633e[_0x4126('0x30')][_0x4126('0x1d')]);}_0x5d9a96[_0x4126('0x38')]=qs[_0x4126('0x39')](_0x36633e[_0x4126('0x30')][_0x4126('0x39')]);_0x5d9a96[_0x4126('0x3a')]=qs[_0x4126('0x31')](_[_0x4126('0x3b')](_0x36633e[_0x4126('0x30')],_0x1c4aca[_0x4126('0x31')]),_0x6bacec);if(_0x36633e['query'][_0x4126('0x3c')]){_0x5d9a96[_0x4126('0x3a')]=_[_0x4126('0x3d')](_0x5d9a96[_0x4126('0x3a')],{'$or':_[_0x4126('0x29')](_0x6bacec,function(_0x44797b){if(_0x44797b[_0x4126('0x2d')]!==_0x4126('0x3e')){var _0xbe3211={};_0xbe3211[_0x44797b[_0x4126('0x26')]]={'$like':'%'+_0x36633e[_0x4126('0x30')]['filter']+'%'};return _0xbe3211;}})});}_0x5d9a96=_[_0x4126('0x3d')]({},_0x5d9a96,_0x36633e[_0x4126('0x3f')]);var _0xe8cd52={'where':_0x5d9a96[_0x4126('0x3a')]};return db[_0x4126('0x2a')][_0x4126('0x1f')](_0xe8cd52)[_0x4126('0x23')](function(_0x1ea540){_0x19e481[_0x4126('0x1f')]=_0x1ea540;if(_0x36633e['query'][_0x4126('0x40')]){_0x5d9a96['include']=[{'all':!![]}];}return db[_0x4126('0x2a')]['findAll'](_0x5d9a96);})[_0x4126('0x23')](function(_0x4dc8f3){_0x19e481[_0x4126('0x41')]=_0x4dc8f3;return _0x19e481;})[_0x4126('0x23')](respondWithFilteredResult(_0x51c5b7,_0x5d9a96))[_0x4126('0x42')](handleError(_0x51c5b7,null));};exports[_0x4126('0x43')]=function(_0x234704,_0x4180df){var _0xbb5415={'raw':!![],'where':{'id':_0x234704[_0x4126('0x44')]['id']}},_0x333b6e={};_0x333b6e[_0x4126('0x2f')]=_[_0x4126('0x45')](db[_0x4126('0x2a')][_0x4126('0x2b')]);_0x333b6e[_0x4126('0x30')]=_[_0x4126('0x45')](_0x234704[_0x4126('0x30')]);_0x333b6e['filters']=_['intersection'](_0x333b6e[_0x4126('0x2f')],_0x333b6e['query']);_0xbb5415[_0x4126('0x33')]=_['intersection'](_0x333b6e[_0x4126('0x2f')],qs['fields'](_0x234704[_0x4126('0x30')][_0x4126('0x34')]));_0xbb5415[_0x4126('0x33')]=_0xbb5415[_0x4126('0x33')][_0x4126('0x35')]?_0xbb5415['attributes']:_0x333b6e[_0x4126('0x2f')];if(_0x234704[_0x4126('0x30')][_0x4126('0x40')]){_0xbb5415[_0x4126('0x46')]=[{'all':!![]}];}_0xbb5415=_[_0x4126('0x3d')]({},_0xbb5415,_0x234704['options']);return db[_0x4126('0x2a')][_0x4126('0x47')](_0xbb5415)['then'](handleEntityNotFound(_0x4180df,null))['then'](respondWithResult(_0x4180df,null))[_0x4126('0x42')](handleError(_0x4180df,null));};exports[_0x4126('0x48')]=function(_0x31fd6a,_0x40e586){return db['ChatTransferReport'][_0x4126('0x48')](_0x31fd6a['body'],{})[_0x4126('0x23')](respondWithResult(_0x40e586,0xc9))['catch'](handleError(_0x40e586,null));};exports[_0x4126('0x49')]=function(_0x4a27c2,_0x54506f){if(_0x4a27c2['body']['id']){delete _0x4a27c2['body']['id'];}return db[_0x4126('0x2a')][_0x4126('0x47')]({'where':{'id':_0x4a27c2[_0x4126('0x44')]['id']}})[_0x4126('0x23')](handleEntityNotFound(_0x54506f,null))['then'](saveUpdates(_0x4a27c2['body'],null))['then'](respondWithResult(_0x54506f,null))[_0x4126('0x42')](handleError(_0x54506f,null));};exports['destroy']=function(_0x6a31f4,_0x1bee92){return db[_0x4126('0x2a')]['find']({'where':{'id':_0x6a31f4[_0x4126('0x44')]['id']}})[_0x4126('0x23')](handleEntityNotFound(_0x1bee92,null))[_0x4126('0x23')](removeEntity(_0x1bee92,null))[_0x4126('0x42')](handleError(_0x1bee92,null));};exports['describe']=function(_0x2e50a5,_0x4342f7){return db[_0x4126('0x2a')][_0x4126('0x4a')]()['then'](respondWithResult(_0x4342f7,null))[_0x4126('0x42')](handleError(_0x4342f7,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index ee36713..c5125aa 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 _0x305c=['moment','bluebird','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','lodash','util','api'];(function(_0x20e555,_0x40aea6){var _0x182077=function(_0x1d0d69){while(--_0x1d0d69){_0x20e555['push'](_0x20e555['shift']());}};_0x182077(++_0x40aea6);}(_0x305c,0x75));var _0xc305=function(_0xca78f1,_0x2c90c8){_0xca78f1=_0xca78f1-0x0;var _0xda435e=_0x305c[_0xca78f1];return _0xda435e;};'use strict';var _=require(_0xc305('0x0'));var util=require(_0xc305('0x1'));var logger=require('../../config/logger')(_0xc305('0x2'));var moment=require(_0xc305('0x3'));var BPromise=require(_0xc305('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc305('0x5'));var config=require(_0xc305('0x6'));var attributes=require(_0xc305('0x7'));module[_0xc305('0x8')]=function(_0x553e0a,_0x5d1a9f){return _0x553e0a[_0xc305('0x9')]('ChatTransferReport',attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x760d=['../../config/logger','api','bluebird','request-promise','path','rimraf','./chatTransferReport.attributes','exports','define','report_chat_transfer','uniqueid','lodash','util'];(function(_0xcfe623,_0x4d1bc7){var _0x2a9a3c=function(_0x407ae0){while(--_0x407ae0){_0xcfe623['push'](_0xcfe623['shift']());}};_0x2a9a3c(++_0x4d1bc7);}(_0x760d,0x1c5));var _0xd760=function(_0x588a77,_0x1fefc7){_0x588a77=_0x588a77-0x0;var _0xa808b8=_0x760d[_0x588a77];return _0xa808b8;};'use strict';var _=require(_0xd760('0x0'));var util=require(_0xd760('0x1'));var logger=require(_0xd760('0x2'))(_0xd760('0x3'));var moment=require('moment');var BPromise=require(_0xd760('0x4'));var rp=require(_0xd760('0x5'));var fs=require('fs');var path=require(_0xd760('0x6'));var rimraf=require(_0xd760('0x7'));var config=require('../../config/environment');var attributes=require(_0xd760('0x8'));module[_0xd760('0x9')]=function(_0x2063c6,_0x57627a){return _0x2063c6[_0xd760('0xa')]('ChatTransferReport',attributes,{'tableName':_0xd760('0xb'),'paranoid':![],'indexes':[{'name':_0xd760('0xc'),'fields':[_0xd760('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 3fd4603..4ec1192 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 _0x7045=['code','ChatTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2b3248,_0x4681c3){var _0x4c273=function(_0xd66761){while(--_0xd66761){_0x2b3248['push'](_0x2b3248['shift']());}};_0x4c273(++_0x4681c3);}(_0x7045,0xec));var _0x5704=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7045[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5704('0x0'));var util=require(_0x5704('0x1'));var moment=require(_0x5704('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5704('0x3'))['db'];var utils=require(_0x5704('0x4'));var logger=require(_0x5704('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5704('0x6'));var client=jayson[_0x5704('0x7')][_0x5704('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x50f8a2,_0x390b31,_0x2cdf7f){return new BPromise(function(_0x577c2c,_0xad0d2){return client[_0x5704('0x9')](_0x50f8a2,_0x2cdf7f)['then'](function(_0x1ae945){logger[_0x5704('0xa')]('ChatTransferReport,\x20%s,\x20%s',_0x390b31,_0x5704('0xb'));logger[_0x5704('0xc')](_0x5704('0xd'),_0x390b31,_0x5704('0xb'),JSON[_0x5704('0xe')](_0x1ae945));if(_0x1ae945[_0x5704('0xf')]){if(_0x1ae945[_0x5704('0xf')][_0x5704('0x10')]===0x1f4){logger['error'](_0x5704('0x11'),_0x390b31,_0x1ae945['error'][_0x5704('0x12')]);return _0xad0d2(_0x1ae945[_0x5704('0xf')][_0x5704('0x12')]);}logger['error'](_0x5704('0x11'),_0x390b31,_0x1ae945['error']['message']);return _0x577c2c(_0x1ae945[_0x5704('0xf')][_0x5704('0x12')]);}else{logger['info'](_0x5704('0x11'),_0x390b31,_0x5704('0xb'));_0x577c2c(_0x1ae945[_0x5704('0x13')][_0x5704('0x12')]);}})[_0x5704('0x14')](function(_0x32d994){logger[_0x5704('0xf')](_0x5704('0x11'),_0x390b31,_0x32d994);_0xad0d2(_0x32d994);});});} \ No newline at end of file +var _0xe678=['result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatTransferReport,\x20%s,\x20%s','message'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0xe678,0x1ce));var _0x8e67=function(_0x1d3f85,_0x23b5b2){_0x1d3f85=_0x1d3f85-0x0;var _0x448d86=_0xe678[_0x1d3f85];return _0x448d86;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8e67('0x0'));var BPromise=require(_0x8e67('0x1'));var rs=require(_0x8e67('0x2'));var fs=require('fs');var Redis=require(_0x8e67('0x3'));var db=require(_0x8e67('0x4'))['db'];var utils=require(_0x8e67('0x5'));var logger=require(_0x8e67('0x6'))(_0x8e67('0x7'));var config=require(_0x8e67('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8e67('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x187ed0,_0x3f2bc9,_0x5c9acd){return new BPromise(function(_0x36811f,_0x5223bc){return client[_0x8e67('0xa')](_0x187ed0,_0x5c9acd)[_0x8e67('0xb')](function(_0x3c4308){logger[_0x8e67('0xc')]('ChatTransferReport,\x20%s,\x20%s',_0x3f2bc9,_0x8e67('0xd'));logger[_0x8e67('0xe')](_0x8e67('0xf'),_0x3f2bc9,_0x8e67('0xd'),JSON[_0x8e67('0x10')](_0x3c4308));if(_0x3c4308[_0x8e67('0x11')]){if(_0x3c4308[_0x8e67('0x11')][_0x8e67('0x12')]===0x1f4){logger[_0x8e67('0x11')](_0x8e67('0x13'),_0x3f2bc9,_0x3c4308['error'][_0x8e67('0x14')]);return _0x5223bc(_0x3c4308[_0x8e67('0x11')][_0x8e67('0x14')]);}logger[_0x8e67('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0x3f2bc9,_0x3c4308[_0x8e67('0x11')][_0x8e67('0x14')]);return _0x36811f(_0x3c4308['error'][_0x8e67('0x14')]);}else{logger[_0x8e67('0xc')]('ChatTransferReport,\x20%s,\x20%s',_0x3f2bc9,_0x8e67('0xd'));_0x36811f(_0x3c4308[_0x8e67('0x15')][_0x8e67('0x14')]);}})[_0x8e67('0x16')](function(_0x14291c){logger[_0x8e67('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0x3f2bc9,_0x14291c);_0x5223bc(_0x14291c);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 00b699a..66226ac 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 _0xe403=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','/:id','post','create','put','update','delete'];(function(_0x2abe83,_0x224e2f){var _0x4a5f74=function(_0xf82f58){while(--_0xf82f58){_0x2abe83['push'](_0x2abe83['shift']());}};_0x4a5f74(++_0x224e2f);}(_0xe403,0x166));var _0x3e40=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe403[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x3e40('0x0'));var util=require(_0x3e40('0x1'));var path=require(_0x3e40('0x2'));var timeout=require(_0x3e40('0x3'));var express=require('express');var router=express[_0x3e40('0x4')]();var fs_extra=require(_0x3e40('0x5'));var auth=require(_0x3e40('0x6'));var interaction=require(_0x3e40('0x7'));var config=require(_0x3e40('0x8'));var controller=require(_0x3e40('0x9'));router[_0x3e40('0xa')]('/',auth[_0x3e40('0xb')](),controller[_0x3e40('0xc')]);router[_0x3e40('0xa')](_0x3e40('0xd'),auth[_0x3e40('0xb')](),controller['describe']);router[_0x3e40('0xa')](_0x3e40('0xe'),auth[_0x3e40('0xb')](),controller['show']);router[_0x3e40('0xf')]('/',auth[_0x3e40('0xb')](),controller[_0x3e40('0x10')]);router[_0x3e40('0x11')](_0x3e40('0xe'),auth['isAuthenticated'](),controller[_0x3e40('0x12')]);router[_0x3e40('0x13')](_0x3e40('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x3e40('0x14')]=router; \ No newline at end of file +var _0x4f49=['delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','./chatTransferReport.controller','get','index','isAuthenticated','describe','/:id','show','create'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4f49,0xdf));var _0x94f4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4f49[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x94f4('0x0'));var util=require(_0x94f4('0x1'));var path=require(_0x94f4('0x2'));var timeout=require(_0x94f4('0x3'));var express=require('express');var router=express[_0x94f4('0x4')]();var fs_extra=require(_0x94f4('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x94f4('0x6'));var controller=require(_0x94f4('0x7'));router[_0x94f4('0x8')]('/',auth['isAuthenticated'](),controller[_0x94f4('0x9')]);router['get']('/describe',auth[_0x94f4('0xa')](),controller[_0x94f4('0xb')]);router[_0x94f4('0x8')](_0x94f4('0xc'),auth['isAuthenticated'](),controller[_0x94f4('0xd')]);router['post']('/',auth[_0x94f4('0xa')](),controller[_0x94f4('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x94f4('0xf')](_0x94f4('0xc'),auth[_0x94f4('0xa')](),controller[_0x94f4('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 3bdcc6a..f92756e 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 _0xe9db=['Send','TEXT','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','name','input','onlineForm','parse','getDataValue','stringify','textarea','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','Your\x20request\x20has\x20not\x20been\x20processed.','bottom_right','alternate','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','Chat'];(function(_0x2c41b9,_0x3e8305){var _0x52e0a5=function(_0x49e469){while(--_0x49e469){_0x2c41b9['push'](_0x2c41b9['shift']());}};_0x52e0a5(++_0x3e8305);}(_0xe9db,0xd8));var _0xbe9d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe9db[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xbe9d('0x0'));module[_0xbe9d('0x1')]={'name':{'type':Sequelize[_0xbe9d('0x2')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xbe9d('0x3')},'description':{'type':Sequelize[_0xbe9d('0x2')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0xbe9d('0x2')],'defaultValue':_0xbe9d('0x4')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xbe9d('0x2')],'defaultValue':_0xbe9d('0x5')},'customerAlias':{'type':Sequelize[_0xbe9d('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xbe9d('0x2')],'allowNull':![],'defaultValue':_0xbe9d('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xbe9d('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xbe9d('0x2')],'allowNull':![],'defaultValue':_0xbe9d('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xbe9d('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xbe9d('0x2')]},'animation':{'type':Sequelize[_0xbe9d('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xbe9d('0xa')](_0xbe9d('0xb'),_0xbe9d('0xc')),'defaultValue':'rounded'},'header_online':{'type':Sequelize['STRING'],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0xbe9d('0x2')],'defaultValue':_0xbe9d('0xd')},'offline_chat_button':{'type':Sequelize[_0xbe9d('0x2')],'defaultValue':_0xbe9d('0xe')},'header_offline':{'type':Sequelize[_0xbe9d('0x2')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0xbe9d('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xbe9d('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xbe9d('0x2')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0xbe9d('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xbe9d('0xf')]},'closingQuestion':{'type':Sequelize[_0xbe9d('0x2')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0xbe9d('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0xbe9d('0x2')],'defaultValue':_0xbe9d('0x11')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0xbe9d('0x12')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0xbe9d('0x13')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xbe9d('0x14')},'closingMessageButton':{'type':Sequelize[_0xbe9d('0x2')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0xbe9d('0x2')],'defaultValue':_0xbe9d('0x15')},'conditionAgreement':{'type':Sequelize[_0xbe9d('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xbe9d('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xbe9d('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xbe9d('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0xbe9d('0x16')},'ratingType':{'type':Sequelize[_0xbe9d('0xa')](_0xbe9d('0x17'),_0xbe9d('0x18')),'defaultValue':_0xbe9d('0x17')},'ratingStarsNumber':{'type':Sequelize[_0xbe9d('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xbe9d('0xf')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','variable':null,'config':{'placeholder':_0xbe9d('0x19'),'type':'text','required':!![]},'props':{'title':_0xbe9d('0x19'),'helpText':''}},{'type':_0xbe9d('0x1a'),'props':{'title':_0xbe9d('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xbe9d('0x4'),'type':_0xbe9d('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0xbe9d('0x1b'))?JSON[_0xbe9d('0x1c')](this[_0xbe9d('0x1d')](_0xbe9d('0x1b'))):{};},'set':function(_0x39d58f){return this['setDataValue'](_0xbe9d('0x1b'),JSON[_0xbe9d('0x1e')](_0x39d58f));}},'offlineForm':{'type':Sequelize[_0xbe9d('0xf')],'defaultValue':function(){return JSON[_0xbe9d('0x1e')]({'items':[{'type':_0xbe9d('0x1a'),'props':{'title':_0xbe9d('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xbe9d('0x4')},'variable':null},{'type':_0xbe9d('0x1f'),'config':{'placeholder':_0xbe9d('0x20')},'props':{'title':_0xbe9d('0x20'),'helpText':_0xbe9d('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0xbe9d('0x1d')]('offlineForm')?JSON[_0xbe9d('0x1c')](this[_0xbe9d('0x1d')](_0xbe9d('0x22'))):{};},'set':function(_0x1ddce1){return this[_0xbe9d('0x23')]('offlineForm',JSON[_0xbe9d('0x1e')](_0x1ddce1));}},'token':{'type':Sequelize[_0xbe9d('0x2')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0xbe9d('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xbe9d('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xbe9d('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xbe9d('0x2')]},'forwardOffline':{'type':Sequelize[_0xbe9d('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xbe9d('0x2')]},'waitingTitle':{'type':Sequelize[_0xbe9d('0x2')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0xbe9d('0x2')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0xbe9d('0x2')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0xbe9d('0x2')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0xbe9d('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xbe9d('0x2')],'defaultValue':_0xbe9d('0x24')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xbe9d('0x15')},'sendUnmanaged':{'type':Sequelize[_0xbe9d('0x2')],'defaultValue':_0xbe9d('0xe')},'enableCustomerAttachment':{'type':Sequelize[_0xbe9d('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xbe9d('0xf')]},'showAgentAvatar':{'type':Sequelize[_0xbe9d('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xbe9d('0x2')]},'notificationTemplate':{'type':Sequelize[_0xbe9d('0xf')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xbe9d('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xbe9d('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xbe9d('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xbe9d('0x2')],'defaultValue':_0xbe9d('0x25')},'verticalAlignment':{'type':Sequelize[_0xbe9d('0x8')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xbe9d('0x2')],'defaultValue':_0xbe9d('0x26')},'defaultTitle':{'type':Sequelize[_0xbe9d('0x2')]},'customerAvatar':{'type':Sequelize[_0xbe9d('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0xbe9d('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xbe9d('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xbe9d('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbe9d('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xbe9d('0x2')],'defaultValue':_0xbe9d('0x27')},'systemAvatar':{'type':Sequelize[_0xbe9d('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbe9d('0x8')],'comment':_0xbe9d('0x28')},'mandatoryDisposition':{'type':Sequelize[_0xbe9d('0x9')],'defaultValue':![],'comment':_0xbe9d('0x29'),'set':function(_0x34ef02){if(!_0x34ef02)this[_0xbe9d('0x23')](_0xbe9d('0x2a'),null);this[_0xbe9d('0x23')](_0xbe9d('0x2b'),_0x34ef02);}},'vidaooEscalation':{'type':Sequelize[_0xbe9d('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xbe9d('0x2')]},'vidaooTopic':{'type':Sequelize[_0xbe9d('0x2')],'allowNull':![],'defaultValue':_0xbe9d('0x2c')},'vidaooNote':{'type':Sequelize[_0xbe9d('0x2')],'defaultValue':function(){return _0xbe9d('0x2d');}},'vidaooMetadata':{'type':Sequelize[_0xbe9d('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xbe9d('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xbe9d('0xf')]}}; \ No newline at end of file +var _0x1380=['star','stringify','input','name','text','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','#fafafa','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','sequelize','randomstring','exports','STRING','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','ENUM'];(function(_0x12fb2c,_0xad4eb9){var _0x1431cf=function(_0x387d5d){while(--_0x387d5d){_0x12fb2c['push'](_0x12fb2c['shift']());}};_0x1431cf(++_0xad4eb9);}(_0x1380,0x80));var _0x0138=function(_0x5a333e,_0x43d78c){_0x5a333e=_0x5a333e-0x0;var _0x5c9ba5=_0x1380[_0x5a333e];return _0x5c9ba5;};'use strict';var Sequelize=require(_0x0138('0x0'));var rs=require(_0x0138('0x1'));module[_0x0138('0x2')]={'name':{'type':Sequelize[_0x0138('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x0138('0x3')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x0138('0x3')]},'mapKey':{'type':Sequelize[_0x0138('0x3')],'defaultValue':_0x0138('0x4')},'mapKeyOffline':{'type':Sequelize[_0x0138('0x3')],'defaultValue':'email'},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x0138('0x3')],'defaultValue':_0x0138('0x5')},'customerAlias':{'type':Sequelize[_0x0138('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x0138('0x3')],'allowNull':![],'defaultValue':_0x0138('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x0138('0x3')],'allowNull':![],'defaultValue':_0x0138('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x0138('0x3')],'allowNull':![],'defaultValue':_0x0138('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x0138('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x0138('0x3')]},'animation':{'type':Sequelize[_0x0138('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x0138('0xa'),_0x0138('0xb')),'defaultValue':_0x0138('0xa')},'header_online':{'type':Sequelize[_0x0138('0x3')],'defaultValue':_0x0138('0xc')},'start_chat_button':{'type':Sequelize[_0x0138('0x3')],'defaultValue':_0x0138('0xd')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x0138('0xe')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x0138('0xf')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x0138('0x3')],'defaultValue':_0x0138('0x10')},'defaultWhiteLabel':{'type':Sequelize[_0x0138('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x0138('0x11')]},'closingQuestion':{'type':Sequelize[_0x0138('0x3')],'defaultValue':_0x0138('0x12')},'formSubmitSuccessMessage':{'type':Sequelize[_0x0138('0x3')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x0138('0x3')],'defaultValue':_0x0138('0x13')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x0138('0x14')},'closingMessage':{'type':Sequelize[_0x0138('0x3')],'defaultValue':_0x0138('0x15')},'closingMessageButton':{'type':Sequelize[_0x0138('0x3')],'defaultValue':_0x0138('0xe')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x0138('0x16')},'conditionAgreement':{'type':Sequelize[_0x0138('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x0138('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x0138('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x0138('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x0138('0x3')],'defaultValue':_0x0138('0x17')},'ratingType':{'type':Sequelize[_0x0138('0x18')](_0x0138('0x19'),'thumb'),'defaultValue':_0x0138('0x19')},'ratingStarsNumber':{'type':Sequelize[_0x0138('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x0138('0x11')],'defaultValue':function(){return JSON[_0x0138('0x1a')]({'items':[{'type':_0x0138('0x1b'),'variable':null,'config':{'placeholder':_0x0138('0x1c'),'type':_0x0138('0x1d'),'required':!![]},'props':{'title':_0x0138('0x1c'),'helpText':''}},{'type':_0x0138('0x1b'),'props':{'title':_0x0138('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x0138('0x4'),'type':_0x0138('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x0138('0x1e')](_0x0138('0x1f'))?JSON[_0x0138('0x20')](this['getDataValue'](_0x0138('0x1f'))):{};},'set':function(_0x517282){return this[_0x0138('0x21')](_0x0138('0x1f'),JSON['stringify'](_0x517282));}},'offlineForm':{'type':Sequelize[_0x0138('0x11')],'defaultValue':function(){return JSON[_0x0138('0x1a')]({'items':[{'type':_0x0138('0x1b'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x0138('0x4'),'type':_0x0138('0x4')},'variable':null},{'type':_0x0138('0x22'),'config':{'placeholder':_0x0138('0x23')},'props':{'title':_0x0138('0x23'),'helpText':_0x0138('0x24')}}],'fromKey':0x0});},'get':function(){return this[_0x0138('0x1e')]('offlineForm')?JSON[_0x0138('0x20')](this[_0x0138('0x1e')]('offlineForm')):{};},'set':function(_0x158184){return this['setDataValue'](_0x0138('0x25'),JSON[_0x0138('0x1a')](_0x158184));}},'token':{'type':Sequelize[_0x0138('0x3')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x0138('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x0138('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x0138('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x0138('0x3')]},'forwardOffline':{'type':Sequelize[_0x0138('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x0138('0x3')]},'waitingTitle':{'type':Sequelize[_0x0138('0x3')],'defaultValue':_0x0138('0x26')},'waitingMessage':{'type':Sequelize[_0x0138('0x3')],'defaultValue':_0x0138('0x27')},'offlineMessageSubject':{'type':Sequelize[_0x0138('0x3')],'defaultValue':_0x0138('0x28')},'offlineMessageBody':{'type':Sequelize[_0x0138('0x3')],'defaultValue':_0x0138('0x29')},'enableUnmanagedNote':{'type':Sequelize[_0x0138('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x0138('0x3')],'defaultValue':_0x0138('0x2a')},'skipUnmanaged':{'type':Sequelize[_0x0138('0x3')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x0138('0x3')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x0138('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x0138('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x0138('0x11')]},'showAgentAvatar':{'type':Sequelize[_0x0138('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x0138('0x3')]},'notificationTemplate':{'type':Sequelize[_0x0138('0x11')],'defaultValue':function(){return _0x0138('0x2b');}},'notificationSound':{'type':Sequelize[_0x0138('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0138('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x0138('0x3')],'defaultValue':_0x0138('0x2c')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x0138('0x3')],'defaultValue':_0x0138('0x2d')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x0138('0x3')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x0138('0x11')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x0138('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x0138('0x3')],'allowNull':![],'defaultValue':_0x0138('0x2e'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x0138('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0138('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0138('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0138('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x0138('0x3')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0x0138('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x0138('0x9')],'defaultValue':![],'comment':_0x0138('0x2f'),'set':function(_0x5401c7){if(!_0x5401c7)this[_0x0138('0x21')](_0x0138('0x30'),null);this['setDataValue'](_0x0138('0x31'),_0x5401c7);}},'vidaooEscalation':{'type':Sequelize[_0x0138('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0138('0x32')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x0138('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x0138('0x11')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index be64269..689ae41 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 _0x2afc=['server/files/images/logos/default_logo.svg','getLicense','custom','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/customer_avatar.png','isNil','existsSync','getSystemAvatar','server/files/images/avatars/system_avatar.png','server/files/images/avatars/','notify','user-agent-parser','headers','CmContact','Sequelize','ValidationError','updatedAt','difference','createdAt','CompanyId','ListId','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','List','account','applications','list','orderBy','priority','Applications','Contacts','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','browser','name','version','format','%s\x20%s','device','%s\x20%s\x20%s','vendor','threadId','ChatInteraction','externalUrl','interaction','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','User','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','files','no\x20available\x20attributes','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','spread','readFileSync','utf8','render','offlineMessageBody','ChatOfflineMessage','originalname','mimetype','server','attachments','offline-chat','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailAccount','MailServerOut','Smtp','service','host','port','secure','auth','pass','SendMail','sendMail','email','forwardOfflineAddress','offlineMessageSubject','mapValues','Chat','MailAccountId','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','fullname','internal','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','inspect','No\x20timezone','Interval','Intervals','getProactiveActions','virtual','increment','chatLicenseExceeded','some','server/files/chat/iframe.ejs','remote','x-real-ip','connection','remoteAddress','referer','replace','alignment','verticalAlignment','textColor','backgroundColor','addApplications','ChatApplication','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','getFields','online','offlineForm','onlineForm','items','fromKey','getOfflineMessages','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatWebsite.socket','jayson/promise','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','UserProfileResource','end','send','index','Pause','map','ChatWebsite','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','include','findAll','show','params','mandatoryDispositionPause','includeAll','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatWebsites','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','ChatWebsiteId','Disposition','getDispositions','findOne','rows','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','file','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','filename','addSystemAvatar','systemAvatar','getLogo','join','root'];(function(_0x48749c,_0x354f08){var _0x211834=function(_0x248187){while(--_0x248187){_0x48749c['push'](_0x48749c['shift']());}};_0x211834(++_0x354f08);}(_0x2afc,0x1df));var _0xc2af=function(_0x5933fb,_0x9115ad){_0x5933fb=_0x5933fb-0x0;var _0x44d988=_0x2afc[_0x5933fb];return _0x44d988;};'use strict';var emlformat=require(_0xc2af('0x0'));var rimraf=require(_0xc2af('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc2af('0x2'));var rp=require(_0xc2af('0x3'));var moment=require(_0xc2af('0x4'));var BPromise=require(_0xc2af('0x5'));var Mustache=require('mustache');var util=require(_0xc2af('0x6'));var path=require(_0xc2af('0x7'));var sox=require(_0xc2af('0x8'));var csv=require(_0xc2af('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc2af('0xa'));var squel=require(_0xc2af('0xb'));var crypto=require(_0xc2af('0xc'));var jsforce=require(_0xc2af('0xd'));var deskjs=require(_0xc2af('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc2af('0xf'));var Redis=require(_0xc2af('0x10'));var authService=require(_0xc2af('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc2af('0x12'));var hardwareService=require(_0xc2af('0x13'));var logger=require(_0xc2af('0x14'))(_0xc2af('0x15'));var utils=require(_0xc2af('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xc2af('0x17'));var db=require(_0xc2af('0x18'))['db'];config[_0xc2af('0x19')]=_[_0xc2af('0x1a')](config[_0xc2af('0x19')],{'host':_0xc2af('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc2af('0x19')]));require(_0xc2af('0x1c'))['register'](socket);var jayson=require(_0xc2af('0x1d'));var client=jayson[_0xc2af('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0xc2af('0x1e')][_0xc2af('0x1f')]({'port':0x232a});var client9003=jayson['client'][_0xc2af('0x1f')]({'port':0x232b});var client9001=jayson[_0xc2af('0x1e')][_0xc2af('0x1f')]({'port':0x2329});function respondWithRpcPromise(_0x34de65,_0x5d66c8,_0x9b6135,_0x46af9c){return new BPromise(function(_0x4b616d,_0x216224){var _0x341725=_0x46af9c||client;return _0x341725[_0xc2af('0x20')](_0x34de65,_0x9b6135)[_0xc2af('0x21')](function(_0x12af6c){logger[_0xc2af('0x22')](_0xc2af('0x23'),_0x5d66c8,_0xc2af('0x24'));logger[_0xc2af('0x25')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x5d66c8,'request\x20sent',JSON[_0xc2af('0x26')](_0x12af6c));if(_0x12af6c['error']){if(_0x12af6c[_0xc2af('0x27')]['code']===0x1f4){logger[_0xc2af('0x27')]('ChatWebsite,\x20%s,\x20%s',_0x5d66c8,_0x12af6c['error'][_0xc2af('0x28')]);return _0x216224(_0x12af6c[_0xc2af('0x27')][_0xc2af('0x28')]);}logger[_0xc2af('0x27')](_0xc2af('0x23'),_0x5d66c8,_0x12af6c[_0xc2af('0x27')]['message']);return _0x4b616d(_0x12af6c[_0xc2af('0x27')][_0xc2af('0x28')]);}else{logger[_0xc2af('0x22')](_0xc2af('0x23'),_0x5d66c8,'request\x20sent');_0x4b616d(_0x12af6c[_0xc2af('0x29')][_0xc2af('0x28')]);}})['catch'](function(_0x369bd1){logger[_0xc2af('0x27')]('ChatWebsite,\x20%s,\x20%s',_0x5d66c8,_0x369bd1);_0x216224(_0x369bd1);});});}function respondWithStatusCode(_0x54a522,_0xf64819){_0xf64819=_0xf64819||0xcc;return function(_0xd2a9c){if(_0xd2a9c){return _0x54a522[_0xc2af('0x2a')](_0xf64819);}return _0x54a522[_0xc2af('0x2b')](_0xf64819)['end']();};}function respondWithResult(_0x1cc106,_0x4a8dc4){_0x4a8dc4=_0x4a8dc4||0xc8;return function(_0xd97387){if(_0xd97387){return _0x1cc106[_0xc2af('0x2b')](_0x4a8dc4)[_0xc2af('0x2c')](_0xd97387);}};}function respondWithFilteredResult(_0x2eaa9e,_0x5d71a4){return function(_0x155c19){if(_0x155c19){var _0x3b2693=typeof _0x5d71a4[_0xc2af('0x2d')]===_0xc2af('0x2e')&&typeof _0x5d71a4[_0xc2af('0x2f')]===_0xc2af('0x2e');var _0x3049dd=_0x155c19[_0xc2af('0x30')];var _0x3f5877=_0x3b2693?0x0:_0x5d71a4[_0xc2af('0x2d')];var _0x38d710=_0x3b2693?_0x155c19[_0xc2af('0x30')]:_0x5d71a4[_0xc2af('0x2d')]+_0x5d71a4[_0xc2af('0x2f')];var _0x582bff;if(_0x38d710>=_0x3049dd){_0x38d710=_0x3049dd;_0x582bff=0xc8;}else{_0x582bff=0xce;}_0x2eaa9e[_0xc2af('0x2b')](_0x582bff);return _0x2eaa9e['set'](_0xc2af('0x31'),_0x3f5877+'-'+_0x38d710+'/'+_0x3049dd)['json'](_0x155c19);}return null;};}function patchUpdates(_0x12d45b){return function(_0x245d89){try{jsonpatch[_0xc2af('0x32')](_0x245d89,_0x12d45b,!![]);}catch(_0x1671c3){return BPromise['reject'](_0x1671c3);}return _0x245d89[_0xc2af('0x33')]();};}function saveUpdates(_0x47827c,_0x1fff4e){return function(_0x3db82d){if(_0x3db82d){return _0x3db82d[_0xc2af('0x34')](_0x47827c)[_0xc2af('0x21')](function(_0x457651){return _0x457651;});}return null;};}function removeEntity(_0x163d5d,_0x3afe59){return function(_0x21847a){if(_0x21847a){return _0x21847a[_0xc2af('0x35')]()[_0xc2af('0x21')](function(){var _0x455e06=_0x21847a['get']({'plain':!![]});var _0x5b87c2='ChatWebsites';return db[_0xc2af('0x36')][_0xc2af('0x35')]({'where':{'type':_0x5b87c2,'resourceId':_0x455e06['id']}})[_0xc2af('0x21')](function(){return _0x21847a;});})[_0xc2af('0x21')](function(){_0x163d5d[_0xc2af('0x2b')](0xcc)[_0xc2af('0x37')]();});}};}function handleEntityNotFound(_0x126607,_0x59034a){return function(_0x27927c){if(!_0x27927c){_0x126607[_0xc2af('0x2a')](0x194);}return _0x27927c;};}function handleError(_0x36f462,_0x303683){_0x303683=_0x303683||0x1f4;return function(_0x3ac046){logger[_0xc2af('0x27')](_0x3ac046['stack']);if(_0x3ac046['name']){delete _0x3ac046['name'];}_0x36f462[_0xc2af('0x2b')](_0x303683)[_0xc2af('0x38')](_0x3ac046);};}exports[_0xc2af('0x39')]=function(_0x1f3207,_0x495c05){var _0xcfaee9={'include':[{'model':db[_0xc2af('0x3a')],'as':'mandatoryDispositionPause'}]},_0x388035={},_0x6c4256={'count':0x0,'rows':[]};var _0xad0f9=_[_0xc2af('0x3b')](db[_0xc2af('0x3c')][_0xc2af('0x3d')],function(_0x26c9de){return{'name':_0x26c9de[_0xc2af('0x3e')],'type':_0x26c9de[_0xc2af('0x3f')][_0xc2af('0x40')]};});_0x388035[_0xc2af('0x41')]=_['map'](_0xad0f9,'name');_0x388035[_0xc2af('0x42')]=_[_0xc2af('0x43')](_0x1f3207[_0xc2af('0x42')]);_0x388035['filters']=_[_0xc2af('0x44')](_0x388035[_0xc2af('0x41')],_0x388035[_0xc2af('0x42')]);_0xcfaee9[_0xc2af('0x45')]=_[_0xc2af('0x44')](_0x388035[_0xc2af('0x41')],qs[_0xc2af('0x46')](_0x1f3207[_0xc2af('0x42')][_0xc2af('0x46')]));_0xcfaee9['attributes']=_0xcfaee9[_0xc2af('0x45')][_0xc2af('0x47')]?_0xcfaee9[_0xc2af('0x45')]:_0x388035['model'];if(!_0x1f3207[_0xc2af('0x42')][_0xc2af('0x48')](_0xc2af('0x49'))){_0xcfaee9[_0xc2af('0x2f')]=qs['limit'](_0x1f3207[_0xc2af('0x42')][_0xc2af('0x2f')]);_0xcfaee9['offset']=qs[_0xc2af('0x2d')](_0x1f3207[_0xc2af('0x42')][_0xc2af('0x2d')]);}_0xcfaee9[_0xc2af('0x4a')]=qs[_0xc2af('0x4b')](_0x1f3207[_0xc2af('0x42')]['sort']);_0xcfaee9[_0xc2af('0x4c')]=qs[_0xc2af('0x4d')](_[_0xc2af('0x4e')](_0x1f3207[_0xc2af('0x42')],_0x388035[_0xc2af('0x4d')]),_0xad0f9);if(_0x1f3207[_0xc2af('0x42')]['filter']){_0xcfaee9[_0xc2af('0x4c')]=_[_0xc2af('0x4f')](_0xcfaee9[_0xc2af('0x4c')],{'$or':_[_0xc2af('0x3b')](_0xad0f9,function(_0xdd06d2){if(_0xdd06d2[_0xc2af('0x3f')]!==_0xc2af('0x50')){var _0x54e939={};_0x54e939[_0xdd06d2['name']]={'$like':'%'+_0x1f3207['query'][_0xc2af('0x51')]+'%'};return _0x54e939;}})});}_0xcfaee9=_['merge']({},_0xcfaee9,_0x1f3207[_0xc2af('0x52')]);var _0x455596={'where':_0xcfaee9[_0xc2af('0x4c')]};return db[_0xc2af('0x3c')]['count'](_0x455596)['then'](function(_0xdf5581){_0x6c4256[_0xc2af('0x30')]=_0xdf5581;if(_0x1f3207[_0xc2af('0x42')]['includeAll']){_0xcfaee9[_0xc2af('0x53')]=[{'all':!![]}];}return db[_0xc2af('0x3c')][_0xc2af('0x54')](_0xcfaee9);})['then'](function(_0x8c69d8){_0x6c4256['rows']=_0x8c69d8;return _0x6c4256;})[_0xc2af('0x21')](respondWithFilteredResult(_0x495c05,_0xcfaee9))['catch'](handleError(_0x495c05,null));};exports[_0xc2af('0x55')]=function(_0x16feed,_0x569ce6){var _0x2433b9={'raw':![],'where':{'id':_0x16feed[_0xc2af('0x56')]['id']},'include':[{'model':db[_0xc2af('0x3a')],'as':_0xc2af('0x57')}]},_0x5b801c={};_0x5b801c[_0xc2af('0x41')]=_[_0xc2af('0x43')](db[_0xc2af('0x3c')][_0xc2af('0x3d')]);_0x5b801c[_0xc2af('0x42')]=_[_0xc2af('0x43')](_0x16feed['query']);_0x5b801c[_0xc2af('0x4d')]=_[_0xc2af('0x44')](_0x5b801c[_0xc2af('0x41')],_0x5b801c[_0xc2af('0x42')]);_0x2433b9['attributes']=_[_0xc2af('0x44')](_0x5b801c[_0xc2af('0x41')],qs[_0xc2af('0x46')](_0x16feed[_0xc2af('0x42')]['fields']));_0x2433b9[_0xc2af('0x45')]=_0x2433b9['attributes'][_0xc2af('0x47')]?_0x2433b9[_0xc2af('0x45')]:_0x5b801c[_0xc2af('0x41')];if(_0x16feed[_0xc2af('0x42')][_0xc2af('0x58')]){_0x2433b9[_0xc2af('0x53')]=[{'all':!![]}];}_0x2433b9=_['merge']({},_0x2433b9,_0x16feed['options']);return db[_0xc2af('0x3c')][_0xc2af('0x59')](_0x2433b9)[_0xc2af('0x21')](handleEntityNotFound(_0x569ce6,null))[_0xc2af('0x21')](respondWithResult(_0x569ce6,null))[_0xc2af('0x5a')](handleError(_0x569ce6,null));};exports[_0xc2af('0x5b')]=function(_0x33faf4,_0x40e315){return db[_0xc2af('0x3c')]['create'](_0x33faf4[_0xc2af('0x5c')],{})[_0xc2af('0x21')](function(_0x22e883){var _0xf1e4d3=_0x33faf4[_0xc2af('0x5d')][_0xc2af('0x5e')]({'plain':!![]});if(!_0xf1e4d3)throw new Error(_0xc2af('0x5f'));if(_0xf1e4d3[_0xc2af('0x60')]==='user'){var _0x3e4ef2=_0x22e883[_0xc2af('0x5e')]({'plain':!![]});var _0x546043=_0xc2af('0x61');return db[_0xc2af('0x62')]['find']({'where':{'name':_0x546043,'userProfileId':_0xf1e4d3['userProfileId']},'raw':!![]})[_0xc2af('0x21')](function(_0x1d0051){if(_0x1d0051&&_0x1d0051[_0xc2af('0x63')]===0x0){return db[_0xc2af('0x36')]['create']({'name':_0x3e4ef2['name'],'resourceId':_0x3e4ef2['id'],'type':_0x1d0051['name'],'sectionId':_0x1d0051['id']},{})['then'](function(){return _0x22e883;});}else{return _0x22e883;}})[_0xc2af('0x5a')](function(_0x6cb3a){logger['error'](_0xc2af('0x64'),_0x6cb3a);throw _0x6cb3a;});}return _0x22e883;})['then'](respondWithResult(_0x40e315,0xc9))[_0xc2af('0x5a')](handleError(_0x40e315,null));};exports['update']=function(_0xaabf1d,_0x1281ba){if(_0xaabf1d[_0xc2af('0x5c')]['id']){delete _0xaabf1d[_0xc2af('0x5c')]['id'];}return db[_0xc2af('0x3c')][_0xc2af('0x59')]({'where':{'id':_0xaabf1d[_0xc2af('0x56')]['id']},'include':[{'model':db['Pause'],'as':_0xc2af('0x57')}]})['then'](handleEntityNotFound(_0x1281ba,null))[_0xc2af('0x21')](saveUpdates(_0xaabf1d[_0xc2af('0x5c')],null))['then'](respondWithResult(_0x1281ba,null))['catch'](handleError(_0x1281ba,null));};exports['destroy']=function(_0xbf98d5,_0x53245d){return db[_0xc2af('0x3c')][_0xc2af('0x59')]({'where':{'id':_0xbf98d5['params']['id']}})['then'](handleEntityNotFound(_0x53245d,null))[_0xc2af('0x21')](removeEntity(_0x53245d,null))['catch'](handleError(_0x53245d,null));};exports[_0xc2af('0x65')]=function(_0x1323da,_0x4ad28e){return db['ChatWebsite'][_0xc2af('0x65')]()[_0xc2af('0x21')](respondWithResult(_0x4ad28e,null))[_0xc2af('0x5a')](handleError(_0x4ad28e,null));};exports['addDisposition']=function(_0x2b3ed6,_0x1a669d,_0x4a060e){if(_0x2b3ed6[_0xc2af('0x5c')]['id']){delete _0x2b3ed6[_0xc2af('0x5c')]['id'];}return db[_0xc2af('0x3c')][_0xc2af('0x59')]({'where':{'id':_0x2b3ed6[_0xc2af('0x56')]['id']}})[_0xc2af('0x21')](handleEntityNotFound(_0x1a669d,null))[_0xc2af('0x21')](function(_0x101f44){if(_0x101f44){_0x2b3ed6[_0xc2af('0x5c')][_0xc2af('0x66')]=_0x101f44['id'];return db[_0xc2af('0x67')][_0xc2af('0x5b')](_0x2b3ed6[_0xc2af('0x5c')]);}})[_0xc2af('0x21')](respondWithResult(_0x1a669d,null))[_0xc2af('0x5a')](handleError(_0x1a669d,null));};exports[_0xc2af('0x68')]=function(_0x40c825,_0x31a9a2,_0x2e588f){var _0xb025f5={'raw':![],'where':{}};var _0x1b29dd={};var _0x4e82bc={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xc2af('0x69')]({'where':{'id':_0x40c825[_0xc2af('0x56')]['id']}})[_0xc2af('0x21')](handleEntityNotFound(_0x31a9a2,null))['then'](function(_0x32bfbb){if(_0x32bfbb){_0x1b29dd[_0xc2af('0x41')]=_['keys'](db[_0xc2af('0x67')]['rawAttributes']);_0x1b29dd['query']=_[_0xc2af('0x43')](_0x40c825['query']);_0x1b29dd['filters']=_[_0xc2af('0x44')](_0x1b29dd[_0xc2af('0x41')],_0x1b29dd[_0xc2af('0x42')]);_0xb025f5[_0xc2af('0x45')]=_[_0xc2af('0x44')](_0x1b29dd[_0xc2af('0x41')],qs[_0xc2af('0x46')](_0x40c825[_0xc2af('0x42')][_0xc2af('0x46')]));_0xb025f5[_0xc2af('0x45')]=_0xb025f5['attributes'][_0xc2af('0x47')]?_0xb025f5[_0xc2af('0x45')]:_0x1b29dd[_0xc2af('0x41')];if(!_0x40c825[_0xc2af('0x42')][_0xc2af('0x48')]('nolimit')){_0xb025f5[_0xc2af('0x2f')]=qs[_0xc2af('0x2f')](_0x40c825[_0xc2af('0x42')][_0xc2af('0x2f')]);_0xb025f5['offset']=qs[_0xc2af('0x2d')](_0x40c825[_0xc2af('0x42')]['offset']);}_0xb025f5['order']=qs[_0xc2af('0x4b')](_0x40c825[_0xc2af('0x42')]['sort']);_0xb025f5[_0xc2af('0x4c')]=qs[_0xc2af('0x4d')](_['pick'](_0x40c825[_0xc2af('0x42')],_0x1b29dd[_0xc2af('0x4d')]));_0xb025f5[_0xc2af('0x4c')][_0xc2af('0x66')]=_0x32bfbb['id'];if(_0x40c825['query'][_0xc2af('0x51')]){_0xb025f5['where']=_[_0xc2af('0x4f')](_0xb025f5[_0xc2af('0x4c')],{'$or':_[_0xc2af('0x3b')](_0xb025f5[_0xc2af('0x45')],function(_0x460878){var _0x26224b={};_0x26224b[_0x460878]={'$like':'%'+_0x40c825[_0xc2af('0x42')][_0xc2af('0x51')]+'%'};return _0x26224b;})});}_0xb025f5=_[_0xc2af('0x4f')]({},_0xb025f5,_0x40c825[_0xc2af('0x52')]);return db[_0xc2af('0x67')][_0xc2af('0x30')]({'where':_0xb025f5['where']})[_0xc2af('0x21')](function(_0x4c5ac9){_0x4e82bc[_0xc2af('0x30')]=_0x4c5ac9;if(_0x40c825[_0xc2af('0x42')][_0xc2af('0x58')]){_0xb025f5[_0xc2af('0x53')]=[{'all':!![]}];}return db[_0xc2af('0x67')]['findAll'](_0xb025f5);})[_0xc2af('0x21')](function(_0x4ffeb8){_0x4e82bc[_0xc2af('0x6a')]=_0x4ffeb8;return _0x4e82bc;});}})['then'](respondWithFilteredResult(_0x31a9a2,_0xb025f5))[_0xc2af('0x5a')](handleError(_0x31a9a2,null));};exports[_0xc2af('0x6b')]=function(_0x376bea,_0x46d043,_0x356dfa){return db[_0xc2af('0x3c')]['find']({'where':{'id':_0x376bea['params']['id']}})[_0xc2af('0x21')](handleEntityNotFound(_0x46d043,null))[_0xc2af('0x21')](function(_0x32e4cd){if(_0x32e4cd){return _0x32e4cd[_0xc2af('0x6b')](_0x376bea[_0xc2af('0x42')][_0xc2af('0x6c')]);}})[_0xc2af('0x21')](respondWithStatusCode(_0x46d043,null))[_0xc2af('0x5a')](handleError(_0x46d043,null));};exports['addAnswer']=function(_0x308a78,_0x3f7893,_0x5ad490){if(_0x308a78[_0xc2af('0x5c')]['id']){delete _0x308a78[_0xc2af('0x5c')]['id'];}return db[_0xc2af('0x3c')][_0xc2af('0x59')]({'where':{'id':_0x308a78[_0xc2af('0x56')]['id']}})['then'](handleEntityNotFound(_0x3f7893,null))[_0xc2af('0x21')](function(_0x5db8de){if(_0x5db8de){_0x308a78[_0xc2af('0x5c')][_0xc2af('0x66')]=_0x5db8de['id'];return db[_0xc2af('0x6d')][_0xc2af('0x5b')](_0x308a78[_0xc2af('0x5c')]);}})['then'](respondWithResult(_0x3f7893,null))['catch'](handleError(_0x3f7893,null));};exports[_0xc2af('0x6e')]=function(_0xc8903,_0x42ac8c,_0x574374){var _0x304f42={'raw':![],'where':{}};var _0x206e6a={};var _0x1811db={'count':0x0,'rows':[]};return db[_0xc2af('0x3c')]['findOne']({'where':{'id':_0xc8903[_0xc2af('0x56')]['id']}})[_0xc2af('0x21')](handleEntityNotFound(_0x42ac8c,null))[_0xc2af('0x21')](function(_0xc7c192){if(_0xc7c192){_0x206e6a[_0xc2af('0x41')]=_[_0xc2af('0x43')](db['CannedAnswer'][_0xc2af('0x3d')]);_0x206e6a['query']=_[_0xc2af('0x43')](_0xc8903[_0xc2af('0x42')]);_0x206e6a[_0xc2af('0x4d')]=_[_0xc2af('0x44')](_0x206e6a[_0xc2af('0x41')],_0x206e6a[_0xc2af('0x42')]);_0x304f42[_0xc2af('0x45')]=_[_0xc2af('0x44')](_0x206e6a[_0xc2af('0x41')],qs[_0xc2af('0x46')](_0xc8903['query'][_0xc2af('0x46')]));_0x304f42[_0xc2af('0x45')]=_0x304f42[_0xc2af('0x45')][_0xc2af('0x47')]?_0x304f42['attributes']:_0x206e6a[_0xc2af('0x41')];if(!_0xc8903[_0xc2af('0x42')][_0xc2af('0x48')](_0xc2af('0x49'))){_0x304f42[_0xc2af('0x2f')]=qs[_0xc2af('0x2f')](_0xc8903['query'][_0xc2af('0x2f')]);_0x304f42[_0xc2af('0x2d')]=qs[_0xc2af('0x2d')](_0xc8903[_0xc2af('0x42')][_0xc2af('0x2d')]);}_0x304f42[_0xc2af('0x4a')]=qs[_0xc2af('0x4b')](_0xc8903['query'][_0xc2af('0x4b')]);_0x304f42[_0xc2af('0x4c')]=qs[_0xc2af('0x4d')](_['pick'](_0xc8903[_0xc2af('0x42')],_0x206e6a[_0xc2af('0x4d')]));_0x304f42[_0xc2af('0x4c')][_0xc2af('0x66')]=_0xc7c192['id'];if(_0xc8903[_0xc2af('0x42')][_0xc2af('0x51')]){_0x304f42[_0xc2af('0x4c')]=_[_0xc2af('0x4f')](_0x304f42['where'],{'$or':_[_0xc2af('0x3b')](_0x304f42[_0xc2af('0x45')],function(_0x402ade){var _0x535114={};_0x535114[_0x402ade]={'$like':'%'+_0xc8903['query'][_0xc2af('0x51')]+'%'};return _0x535114;})});}_0x304f42=_['merge']({},_0x304f42,_0xc8903[_0xc2af('0x52')]);return db[_0xc2af('0x6d')][_0xc2af('0x30')]({'where':_0x304f42[_0xc2af('0x4c')]})[_0xc2af('0x21')](function(_0x11ba68){_0x1811db[_0xc2af('0x30')]=_0x11ba68;if(_0xc8903['query']['includeAll']){_0x304f42[_0xc2af('0x53')]=[{'all':!![]}];}return db['CannedAnswer'][_0xc2af('0x54')](_0x304f42);})[_0xc2af('0x21')](function(_0x5f3937){_0x1811db[_0xc2af('0x6a')]=_0x5f3937;return _0x1811db;});}})[_0xc2af('0x21')](respondWithFilteredResult(_0x42ac8c,_0x304f42))[_0xc2af('0x5a')](handleError(_0x42ac8c,null));};exports[_0xc2af('0x6f')]=function(_0x175822,_0x3348c2,_0x3b1338){return db[_0xc2af('0x3c')][_0xc2af('0x59')]({'where':{'id':_0x175822['params']['id']}})[_0xc2af('0x21')](handleEntityNotFound(_0x3348c2,null))[_0xc2af('0x21')](function(_0x5cc600){if(_0x5cc600){return _0x5cc600[_0xc2af('0x6f')](_0x175822[_0xc2af('0x42')]['ids']);}})[_0xc2af('0x21')](respondWithStatusCode(_0x3348c2,null))[_0xc2af('0x5a')](handleError(_0x3348c2,null));};exports[_0xc2af('0x70')]=function(_0x12b2e3,_0x49eb92,_0x573e76){_0x12b2e3[_0xc2af('0x5c')][_0xc2af('0x71')]=_0x12b2e3[_0xc2af('0x72')]['filename'];return db[_0xc2af('0x3c')][_0xc2af('0x59')]({'where':{'id':_0x12b2e3[_0xc2af('0x56')]['id']}})['then'](handleEntityNotFound(_0x49eb92,null))[_0xc2af('0x21')](saveUpdates(_0x12b2e3[_0xc2af('0x5c')],null))[_0xc2af('0x21')](respondWithResult(_0x49eb92,null))['catch'](handleError(_0x49eb92,null));};exports[_0xc2af('0x73')]=function(_0x39de08,_0x4595e4,_0x8c78e0){_0x39de08[_0xc2af('0x5c')][_0xc2af('0x74')]=_0x39de08[_0xc2af('0x72')]['filename'];return db[_0xc2af('0x3c')][_0xc2af('0x59')]({'where':{'id':_0x39de08[_0xc2af('0x56')]['id']}})[_0xc2af('0x21')](handleEntityNotFound(_0x4595e4,null))[_0xc2af('0x21')](saveUpdates(_0x39de08[_0xc2af('0x5c')],null))[_0xc2af('0x21')](respondWithResult(_0x4595e4,null))['catch'](handleError(_0x4595e4,null));};exports[_0xc2af('0x75')]=function(_0x6328c0,_0x159d62,_0x6f7da1){_0x6328c0[_0xc2af('0x5c')][_0xc2af('0x76')]=_0x6328c0['file'][_0xc2af('0x77')];return db[_0xc2af('0x3c')][_0xc2af('0x59')]({'where':{'id':_0x6328c0[_0xc2af('0x56')]['id']}})[_0xc2af('0x21')](handleEntityNotFound(_0x159d62,null))['then'](saveUpdates(_0x6328c0[_0xc2af('0x5c')],null))[_0xc2af('0x21')](respondWithResult(_0x159d62,null))[_0xc2af('0x5a')](handleError(_0x159d62,null));};exports[_0xc2af('0x78')]=function(_0x18bdc1,_0x22334d,_0x193fa2){_0x18bdc1[_0xc2af('0x5c')][_0xc2af('0x79')]=_0x18bdc1[_0xc2af('0x72')][_0xc2af('0x77')];return db[_0xc2af('0x3c')][_0xc2af('0x59')]({'where':{'id':_0x18bdc1[_0xc2af('0x56')]['id']}})['then'](handleEntityNotFound(_0x22334d,null))[_0xc2af('0x21')](saveUpdates(_0x18bdc1[_0xc2af('0x5c')],null))['then'](respondWithResult(_0x22334d,null))[_0xc2af('0x5a')](handleError(_0x22334d,null));};exports[_0xc2af('0x7a')]=function(_0x2f9d84,_0x1b23c9,_0x24c4a0){var _0x276a0b=path[_0xc2af('0x7b')](config[_0xc2af('0x7c')],_0xc2af('0x7d'));var _0x3aad6d={'where':{'id':_0x2f9d84[_0xc2af('0x56')]['id']},'attributes':['id',_0xc2af('0x71')],'raw':!![]};var _0x13542f=![];return require(_0xc2af('0x17'))[_0xc2af('0x7e')]()['then'](function(_0x2ebc4d){if(_0x2ebc4d){_0x13542f=_0x2ebc4d[_0xc2af('0x7f')];}})[_0xc2af('0x21')](function(){return db[_0xc2af('0x3c')]['find'](_0x3aad6d);})[_0xc2af('0x21')](handleEntityNotFound(_0x1b23c9,null))[_0xc2af('0x21')](function(_0x553bfd){if(_0x553bfd){if(!_['isNil'](_0x553bfd[_0xc2af('0x71')])){if(fs['existsSync'](path[_0xc2af('0x7b')](config['root'],'server/files/images/logos/',_0x553bfd[_0xc2af('0x71')]))&&_0x13542f){_0x276a0b=path[_0xc2af('0x7b')](config[_0xc2af('0x7c')],_0xc2af('0x80'),_0x553bfd[_0xc2af('0x71')]);}}return _0x1b23c9[_0xc2af('0x81')](_0x276a0b);}})[_0xc2af('0x5a')](handleError(_0x1b23c9,null));};exports[_0xc2af('0x82')]=function(_0x33f754,_0x155c75,_0x406ede){var _0x262687=path[_0xc2af('0x7b')](config[_0xc2af('0x7c')],_0xc2af('0x83'));var _0x136eb0={'where':{'id':_0x33f754[_0xc2af('0x56')]['id']},'attributes':['id',_0xc2af('0x74')],'raw':!![]};return db[_0xc2af('0x3c')]['find'](_0x136eb0)[_0xc2af('0x21')](handleEntityNotFound(_0x155c75,null))[_0xc2af('0x21')](function(_0x3614e4){if(_0x3614e4){if(!_['isNil'](_0x3614e4[_0xc2af('0x74')])){if(fs['existsSync'](path[_0xc2af('0x7b')](config[_0xc2af('0x7c')],'server/files/images/avatars/',_0x3614e4[_0xc2af('0x74')]))){_0x262687=path['join'](config[_0xc2af('0x7c')],'server/files/images/avatars/',_0x3614e4['agentAvatar']);}}return _0x155c75['download'](_0x262687);}})['catch'](handleError(_0x155c75,null));};exports['getCustomerAvatar']=function(_0x448e81,_0x27c536,_0x4b5dbe){var _0x1f9f80=path['join'](config[_0xc2af('0x7c')],_0xc2af('0x84'));var _0x1e4925={'where':{'id':_0x448e81[_0xc2af('0x56')]['id']},'attributes':['id',_0xc2af('0x76'),'showCustomerAvatar'],'raw':!![]};return db['ChatWebsite'][_0xc2af('0x59')](_0x1e4925)['then'](handleEntityNotFound(_0x27c536,null))[_0xc2af('0x21')](function(_0x42c194){if(_0x42c194){if(!_[_0xc2af('0x85')](_0x42c194[_0xc2af('0x76')])){if(fs[_0xc2af('0x86')](path[_0xc2af('0x7b')](config[_0xc2af('0x7c')],'server/files/images/avatars/',_0x42c194[_0xc2af('0x76')]))&&_0x42c194['showCustomerAvatar']){_0x1f9f80=path['join'](config[_0xc2af('0x7c')],'server/files/images/avatars/',_0x42c194[_0xc2af('0x76')]);}}return _0x27c536[_0xc2af('0x81')](_0x1f9f80);}})['catch'](handleError(_0x27c536,null));};exports[_0xc2af('0x87')]=function(_0x5e3d96,_0x29a5e3,_0x430c70){var _0x19a923=path[_0xc2af('0x7b')](config['root'],_0xc2af('0x88'));var _0x26641c={'where':{'id':_0x5e3d96[_0xc2af('0x56')]['id']},'attributes':['id',_0xc2af('0x79')],'raw':!![]};return db[_0xc2af('0x3c')][_0xc2af('0x59')](_0x26641c)['then'](handleEntityNotFound(_0x29a5e3,null))[_0xc2af('0x21')](function(_0x570d3d){if(_0x570d3d){if(!_[_0xc2af('0x85')](_0x570d3d[_0xc2af('0x79')])){if(fs[_0xc2af('0x86')](path[_0xc2af('0x7b')](config[_0xc2af('0x7c')],'server/files/images/avatars/',_0x570d3d[_0xc2af('0x79')]))){_0x19a923=path['join'](config[_0xc2af('0x7c')],_0xc2af('0x89'),_0x570d3d[_0xc2af('0x79')]);}}return _0x29a5e3[_0xc2af('0x81')](_0x19a923);}})[_0xc2af('0x5a')](handleError(_0x29a5e3,null));};exports[_0xc2af('0x8a')]=function(_0x4ce57d,_0x23786c,_0x2f655f){var _0x138bcc=require(_0xc2af('0x8b'));var _0x1c8b3a=new _0x138bcc();var _0x14daab=_0x1c8b3a['setUA'](_0x4ce57d[_0xc2af('0x8c')]['user-agent'])['getResult']();var _0x1700f9={'body':_0x4ce57d['body'],'channel':'chat'};var _0x52baf5=[];var _0x4caca6=[];var _0x48f0d9={};var _0x507aed=![];return db[_0xc2af('0x8d')]['describe']()[_0xc2af('0x21')](function(_0x40e622){if(!_0x40e622){throw new db[(_0xc2af('0x8e'))][(_0xc2af('0x8f'))]('no\x20available\x20attributes');}_0x52baf5=_['difference'](_[_0xc2af('0x43')](_0x40e622),['createdAt',_0xc2af('0x90')]);_0x4caca6=_[_0xc2af('0x91')](_['keys'](_0x40e622),[_0xc2af('0x92'),_0xc2af('0x90'),_0xc2af('0x93'),_0xc2af('0x94')]);if(_0x4ce57d[_0xc2af('0x5c')]['id']){delete _0x4ce57d[_0xc2af('0x5c')]['id'];}if(_[_0xc2af('0x85')](_0x4ce57d[_0xc2af('0x5c')][_0xc2af('0x95')])){throw new db[(_0xc2af('0x8e'))][(_0xc2af('0x8f'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x4ce57d['body'][_0xc2af('0x5c')])||_0x4ce57d[_0xc2af('0x5c')]['body']===''){throw new db[(_0xc2af('0x8e'))]['ValidationError'](_0xc2af('0x96'));}if(_['isNil'](_0x4ce57d[_0xc2af('0x5c')][_0xc2af('0x97')])){throw new db[(_0xc2af('0x8e'))][(_0xc2af('0x8f'))](_0xc2af('0x98')+_0x4caca6);}if(!_['includes'](_0x4caca6,_0x4ce57d[_0xc2af('0x5c')][_0xc2af('0x97')])){throw new db[(_0xc2af('0x8e'))][(_0xc2af('0x8f'))](_0xc2af('0x99')+_0x4caca6);}_0x48f0d9[_0x4ce57d[_0xc2af('0x5c')]['mapKey']]=_0x4ce57d[_0xc2af('0x5c')][_0xc2af('0x95')];})[_0xc2af('0x21')](function(){return db[_0xc2af('0x3c')][_0xc2af('0x59')]({'where':{'id':_0x4ce57d[_0xc2af('0x56')]['id']},'include':[{'model':db[_0xc2af('0x9a')],'as':'List','include':[{'model':db[_0xc2af('0x8d')],'as':'Contacts','where':_0x48f0d9,'limit':0x1,'order':[[_0xc2af('0x90'),_0xc2af('0x9b')]]}]},{'model':db['ChatApplication'],'as':'Applications'}]});})[_0xc2af('0x21')](handleEntityNotFound(_0x23786c,null))[_0xc2af('0x21')](function(_0x83ce56){if(_0x83ce56&&_0x83ce56[_0xc2af('0x9c')]){_0x1700f9[_0xc2af('0x9d')]=_0x83ce56;_0x1700f9[_0xc2af('0x9e')]=_0x83ce56['Applications'];_0x1700f9[_0xc2af('0x9f')]=_0x83ce56[_0xc2af('0x9c')];_0x1700f9[_0xc2af('0x9e')]=_[_0xc2af('0xa0')](_0x1700f9[_0xc2af('0x9e')],[_0xc2af('0xa1')],['asc']);if(_0x1700f9[_0xc2af('0x9d')][_0xc2af('0xa2')]){delete _0x1700f9[_0xc2af('0x9d')][_0xc2af('0xa2')];}if(_0x1700f9[_0xc2af('0x9d')]['List']&&_0x1700f9[_0xc2af('0x9d')][_0xc2af('0x9c')][_0xc2af('0xa3')][_0xc2af('0x47')]){return _0x1700f9['account'][_0xc2af('0x9c')][_0xc2af('0xa3')][0x0];}var _0x51790e=_['defaults'](_0x4ce57d[_0xc2af('0x5c')],{'firstName':_0x4ce57d['body'][_0xc2af('0x95')],'ListId':_0x83ce56[_0xc2af('0x94')]});_0x51790e[_0x4ce57d[_0xc2af('0x5c')][_0xc2af('0x97')]]=_0x4ce57d['body'][_0xc2af('0x95')];return db[_0xc2af('0x8d')]['create'](_0x51790e,{'fields':_0x52baf5,'raw':!![]});}})['then'](handleEntityNotFound(_0x23786c,null))[_0xc2af('0x21')](function(_0x194855){_0x1700f9[_0xc2af('0xa4')]=_0x194855;var _0x211c34=_0x4ce57d['body'][_0xc2af('0xa5')];if(_0x4ce57d[_0xc2af('0x8c')][_0xc2af('0xa6')]){_0x211c34=_0x4ce57d[_0xc2af('0x8c')][_0xc2af('0xa6')];}else if(_0x4ce57d['headers'][_0xc2af('0xa7')]){_0x211c34=_[_0xc2af('0xa8')](_0x4ce57d[_0xc2af('0x8c')][_0xc2af('0xa7')][_0xc2af('0xa9')](','));}if(_0x194855){var _0x39588e={'ContactId':_0x194855['id'],'ChatWebsiteId':_0x4ce57d[_0xc2af('0x56')]['id'],'from':(_0x194855[_0xc2af('0xaa')]||'')+'\x20'+(_0x194855[_0xc2af('0xab')]||''),'customerIp':_0x211c34,'customerPort':_0x4ce57d[_0xc2af('0x8c')][_0xc2af('0xac')]?_0x4ce57d['headers']['x-real-port']:null,'referer':_0x4ce57d['body']['referer'],'browserName':_0x14daab[_0xc2af('0xad')][_0xc2af('0xae')]&&_0x14daab['browser'][_0xc2af('0xaf')]?util['format']('%s\x20%s',_0x14daab[_0xc2af('0xad')]['name'],_0x14daab[_0xc2af('0xad')][_0xc2af('0xaf')]):'unknown','browserVersion':_0x14daab[_0xc2af('0xad')][_0xc2af('0xaf')]||'unknown','osName':util[_0xc2af('0xb0')](_0xc2af('0xb1'),_0x14daab['os'][_0xc2af('0xae')],_0x14daab['os'][_0xc2af('0xaf')]),'osVersion':_0x14daab['os']['version'],'deviceModel':_0x14daab[_0xc2af('0xb2')]['model']&&_0x14daab[_0xc2af('0xb2')]['vendor']?util[_0xc2af('0xb0')](_0xc2af('0xb3'),_0x14daab[_0xc2af('0xb2')]['model'],_0x14daab[_0xc2af('0xb2')][_0xc2af('0xb4')],_0x14daab[_0xc2af('0xb2')]['type']):null,'deviceVendor':_0x14daab[_0xc2af('0xb2')][_0xc2af('0xb4')],'deviceType':_0x14daab[_0xc2af('0xb2')][_0xc2af('0x3f')],'formData':JSON[_0xc2af('0x26')](_0x4ce57d[_0xc2af('0x5c')])};var _0x173b0d={'ChatWebsiteId':_0x4ce57d[_0xc2af('0x56')]['id'],'closed':![]};if(_0x4ce57d['body'][_0xc2af('0xb5')]){_0x173b0d['threadId']=_0x4ce57d['body'][_0xc2af('0xb5')];return db[_0xc2af('0xb6')]['find']({'where':_0x173b0d})[_0xc2af('0x21')](function(_0x3acdae){if(_0x3acdae){return[_0x3acdae,![]];}_0x39588e['threadId']=_0x4ce57d[_0xc2af('0x5c')][_0xc2af('0xb5')];_0x39588e[_0xc2af('0xb7')]=_0x4ce57d[_0xc2af('0x5c')][_0xc2af('0xb7')];return db[_0xc2af('0xb6')][_0xc2af('0x5b')](_0x39588e)[_0xc2af('0x21')](function(_0xbb0ad9){return[_0xbb0ad9,!![]];});});}_0x173b0d['ContactId']=_0x194855['id'];if(_0x4ce57d[_0xc2af('0x5c')][_0xc2af('0xb8')]&&_0x4ce57d[_0xc2af('0x5c')][_0xc2af('0xb8')]['id']){_0x173b0d['id']=_0x4ce57d[_0xc2af('0x5c')]['interaction']['id'];return db[_0xc2af('0xb6')][_0xc2af('0x59')]({'where':_0x173b0d})['then'](function(_0x1bb302){if(_0x1bb302){return[_0x1bb302,![]];}return db[_0xc2af('0xb6')]['create'](_0x39588e)['then'](function(_0x331ea4){return[_0x331ea4,!![]];});});}return db[_0xc2af('0xb6')][_0xc2af('0x5b')](_0x39588e)[_0xc2af('0x21')](function(_0x35957f){return[_0x35957f,!![]];});}})['spread'](function(_0x16ed69,_0x4975e6){if(_0x16ed69){_0x507aed=_0x4975e6;if(!_0x4975e6){var _0x555498={'from':(_0x1700f9['contact'][_0xc2af('0xaa')]||'')+'\x20'+(_0x1700f9[_0xc2af('0xa4')][_0xc2af('0xab')]||'')};if(_0x4ce57d['body']['threadId']&&_0x4ce57d[_0xc2af('0x5c')]['messageId']&&_0x4ce57d[_0xc2af('0x5c')][_0xc2af('0xb5')]!=_0x4ce57d[_0xc2af('0x5c')]['messageId']){_0x555498[_0xc2af('0xb5')]=_0x4ce57d[_0xc2af('0x5c')][_0xc2af('0xb9')];}return _0x16ed69['update'](_0x555498);}else{return _0x16ed69;}}})[_0xc2af('0x21')](function(_0x507a55){_0x1700f9[_0xc2af('0xb8')]=_0x507a55[_0xc2af('0x5e')]({'plain':!![]});_0x1700f9[_0xc2af('0xb8')]['created']=_0x507aed;if(_0x1700f9[_0xc2af('0xb8')][_0xc2af('0xba')]){if(_0x1700f9[_0xc2af('0x9d')][_0xc2af('0xbb')]){_0x1700f9['applications'][_0xc2af('0xbc')]({'id':0x0,'priority':_0x1700f9['applications'][_0xc2af('0x47')]+0x1,'app':_0xc2af('0xbd'),'appdata':_0xc2af('0xbe'),'interval':_0xc2af('0xbf')});}}return db[_0xc2af('0xc0')]['create']({'body':_0x4ce57d[_0xc2af('0x5c')][_0xc2af('0x5c')],'ChatWebsiteId':_0x4ce57d[_0xc2af('0x56')]['id'],'ChatInteractionId':_0x507a55['id'],'direction':'in','ContactId':_0x1700f9[_0xc2af('0xa4')]['id'],'AttachmentId':_0x4ce57d[_0xc2af('0x5c')][_0xc2af('0xc1')]});})[_0xc2af('0x21')](function(_0x4bf0fc){_0x1700f9[_0xc2af('0x28')]=_0x4bf0fc;if(_0x1700f9[_0xc2af('0xb8')]['UserId']){return db[_0xc2af('0xc2')]['find']({'attributes':['id',_0xc2af('0xae')],'where':{'id':_0x1700f9['interaction']['UserId']}})['then'](function(_0x1caeb0){if(_0x1caeb0){_0x1700f9[_0xc2af('0x9e')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1caeb0[_0xc2af('0xae')]+','+(_0x1700f9[_0xc2af('0x9d')][_0xc2af('0xc3')]||0xa),'interval':'*,*,*,*'});_0x1700f9[_0xc2af('0xc4')]=!![];}return respondWithRpcPromise(_0xc2af('0xc5'),_0xc2af('0xc6'),_0x1700f9);});}return respondWithRpcPromise('Start',_0xc2af('0xc6'),_0x1700f9);})[_0xc2af('0x21')](function(_0x10044d){respondWithRpcPromise(_0xc2af('0xc7'),'EventManager',{'event':_0xc2af('0x8a'),'message':_0x10044d},client9002);return _0x10044d;})[_0xc2af('0x21')](respondWithResult(_0x23786c,null))[_0xc2af('0x5a')](handleError(_0x23786c,null));};exports['offline']=function(_0x5a0f53,_0x3cbd60,_0x251dcb){var _0x2eecab,_0x55fa15,_0x236b6e;var _0xc24b11=[];var _0x45a98e=[];var _0x56fc89={};var _0x34e418=_0x5a0f53[_0xc2af('0xc8')]||[];var _0x40e680=[];var _0x489a01;return db[_0xc2af('0x8d')][_0xc2af('0x65')]()[_0xc2af('0x21')](function(_0x529e7e){if(!_0x529e7e){throw new db[(_0xc2af('0x8e'))][(_0xc2af('0x8f'))](_0xc2af('0xc9'));}_0x45a98e=_[_0xc2af('0x91')](_[_0xc2af('0x43')](_0x529e7e),[_0xc2af('0x92'),_0xc2af('0x90')]);_0xc24b11=_['difference'](_[_0xc2af('0x43')](_0x529e7e),[_0xc2af('0x92'),_0xc2af('0x90'),_0xc2af('0x93'),'ListId']);if(_0x5a0f53[_0xc2af('0x5c')]['id']){delete _0x5a0f53[_0xc2af('0x5c')]['id'];}if(_[_0xc2af('0x85')](_0x5a0f53[_0xc2af('0x5c')]['from'])){throw _0x3cbd60['status'](0x1f4)['send'](new db[(_0xc2af('0x8e'))]['ValidationError']('from\x20is\x20mandatory'));}if(_[_0xc2af('0x85')](_0x5a0f53[_0xc2af('0x5c')][_0xc2af('0x5c')])||_0x5a0f53[_0xc2af('0x5c')][_0xc2af('0x5c')]===''){throw _0x3cbd60[_0xc2af('0x2b')](0x1f4)[_0xc2af('0x38')](new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xc2af('0x85')](_0x5a0f53[_0xc2af('0x5c')][_0xc2af('0xca')])){throw _0x3cbd60[_0xc2af('0x2b')](0x1f4)[_0xc2af('0x38')](new db['Sequelize'][(_0xc2af('0x8f'))](_0xc2af('0xcb')+_0xc24b11));}if(!_[_0xc2af('0xcc')](_0xc24b11,_0x5a0f53[_0xc2af('0x5c')][_0xc2af('0xca')])){throw _0x3cbd60[_0xc2af('0x2b')](0x1f4)[_0xc2af('0x38')](new db[(_0xc2af('0x8e'))][(_0xc2af('0x8f'))](_0xc2af('0xcd')+_0xc24b11));}_0x56fc89[_0x5a0f53[_0xc2af('0x5c')][_0xc2af('0xca')]]=_0x5a0f53[_0xc2af('0x5c')][_0xc2af('0x95')];})[_0xc2af('0x21')](function(){return db[_0xc2af('0x3c')][_0xc2af('0x59')]({'where':{'id':_0x5a0f53['params']['id']},'include':[{'model':db[_0xc2af('0x9a')],'as':_0xc2af('0x9c')},{'model':db['MailAccount'],'as':'MailAccount'}]});})[_0xc2af('0x21')](handleEntityNotFound(_0x3cbd60,null))[_0xc2af('0x21')](function(_0xd7fe6c){if(_0xd7fe6c&&_0xd7fe6c[_0xc2af('0x9c')]){_0x55fa15=_0xd7fe6c;var _0x4ff4a1=_['defaults'](_0x5a0f53['body'],{'firstName':_0x5a0f53[_0xc2af('0x5c')]['from'],'phone':_0x5a0f53[_0xc2af('0x5c')][_0xc2af('0x95')],'ListId':_0xd7fe6c[_0xc2af('0x94')]});_0x4ff4a1[_0x5a0f53['body'][_0xc2af('0xca')]]=_0x5a0f53[_0xc2af('0x5c')][_0xc2af('0x95')];return db['CmContact']['findOrCreate']({'where':_0x56fc89,'defaults':_0x4ff4a1});}})[_0xc2af('0xce')](function(_0x3368d1){if(_0x3368d1){_0x236b6e=_0x3368d1;var _0x3e641e=fs[_0xc2af('0xcf')](path[_0xc2af('0x7b')](config[_0xc2af('0x7c')],'server/files/templates/chatOfflineMessage.ejs'),_0xc2af('0xd0'));var _0x37048d=ejs[_0xc2af('0xd1')](_0x3e641e,{'body':_['toPairs'](_0x5a0f53[_0xc2af('0x5c')]['body']),'bodyTitle':_0x55fa15[_0xc2af('0xd2')]});return db[_0xc2af('0xd3')]['create']({'body':_0x37048d,'ContactId':_0x3368d1['id'],'ChatWebsiteId':_0x55fa15['id']});}})[_0xc2af('0x21')](function(_0xb27a44){_0x489a01=_0xb27a44;if(_0x34e418['length']){var _0x2be0d5=_0x34e418[_0xc2af('0x3b')](function(_0xf06f04){return{'name':_0xf06f04[_0xc2af('0xd4')],'basename':_0xf06f04[_0xc2af('0x77')],'type':_0xf06f04[_0xc2af('0xd5')],'ChatOfflineMessageId':_0xb27a44['id']};});_0x40e680=_0x2be0d5['map'](_0x5cafc1=>{var _0xe96109={'filename':_0x5cafc1['name'],'path':path['join'](config[_0xc2af('0x7c')],_0xc2af('0xd6'),_0xc2af('0xc8'),_0xc2af('0xd7'),_0xc2af('0xd8'),_0x5cafc1['basename'])};return _0xe96109;});if(!_0x55fa15[_0xc2af('0xd9')]){return db[_0xc2af('0xda')][_0xc2af('0xdb')](function(_0x947c1){return db[_0xc2af('0xdc')][_0xc2af('0xdd')](_0x2be0d5,{'transaction':_0x947c1});});}}})[_0xc2af('0x21')](function(){if(_0x489a01){_0x2eecab=_0x489a01;return db[_0xc2af('0xde')][_0xc2af('0x69')]({'where':{'active':!![]},'include':[{'model':db[_0xc2af('0xdf')],'as':_0xc2af('0xe0'),'raw':!![]}]});}})[_0xc2af('0x21')](function(_0xbde353){if(_0xbde353&&_0xbde353[_0xc2af('0xe0')]&&_0x55fa15['forwardOffline']&&_0x55fa15['forwardOfflineAddress']){var _0x2e9fae={'tls':{'rejectUnauthorized':![]}};if(_0xbde353[_0xc2af('0xe0')][_0xc2af('0xe1')]){_0x2e9fae[_0xc2af('0xe1')]=_0xbde353['Smtp']['service'];}else{_0x2e9fae[_0xc2af('0xe2')]=_0xbde353[_0xc2af('0xe0')]['host'];_0x2e9fae[_0xc2af('0xe3')]=_0xbde353['Smtp']['port'];_0x2e9fae[_0xc2af('0xe4')]=_0xbde353[_0xc2af('0xe0')]['secure'];}if(_0xbde353['Smtp']['authentication']){_0x2e9fae[_0xc2af('0xe5')]={'user':_0xbde353[_0xc2af('0xe0')][_0xc2af('0x5d')],'pass':_0xbde353['Smtp'][_0xc2af('0xe6')]};}return respondWithRpcPromise(_0xc2af('0xe7'),_0xc2af('0xe8'),{'account':_0x2e9fae,'message':{'from':util[_0xc2af('0xb0')]('\x22%s\x22\x20<%s>',_0xbde353[_0xc2af('0xae')],_0xbde353[_0xc2af('0xe9')]||_0xbde353[_0xc2af('0xe0')][_0xc2af('0x5d')]),'to':_0x55fa15[_0xc2af('0xea')],'subject':_0x55fa15[_0xc2af('0xeb')],'html':_0x2eecab[_0xc2af('0x5c')],'attachments':_0x40e680}},client9003)[_0xc2af('0x21')](function(){return _0x2eecab;})[_0xc2af('0x5a')](function(_0x5b33e3){console[_0xc2af('0x27')](_0x5b33e3);});}})[_0xc2af('0x21')](function(){if(_0x55fa15&&_0x55fa15['openNewInteraction']&&_0x55fa15['MailAccountId']){var _0x369edb=[];if(_0x34e418['length']){_0x369edb=_0x34e418[_0xc2af('0x3b')](function(_0x16e671){return{'name':_0x16e671[_0xc2af('0xd4')],'basename':_0x16e671[_0xc2af('0x77')],'type':_0x16e671[_0xc2af('0xd5')],'ChatOfflineMessageId':_0x489a01['id']};});}var _0x1fd7ad;if(!_[_0xc2af('0x85')](_0x55fa15['subjectOffline'])){var _0x29b502=_[_0xc2af('0x3b')](_0x5a0f53[_0xc2af('0x5c')],function(_0x255c1d){return _0x255c1d;});var _0x382790=_['toPairsIn'](_0x29b502)[0x0];var _0x5cee0b=_[_0xc2af('0xec')](_0x382790,function(_0x2fb0ef){return _0x2fb0ef;});_0x1fd7ad=_0x5cee0b[0x1][_0x55fa15['subjectOffline']];}var _0x640006={'from':_0x236b6e[_0xc2af('0xe9')],'firstName':_0x236b6e[_0xc2af('0xaa')],'lastName':_0x236b6e[_0xc2af('0xab')],'mapKey':_0xc2af('0xe9'),'message':{'from':_0x236b6e['email'],'to':_0x55fa15['MailAccount'][_0xc2af('0xe9')],'cc':'','subject':_[_0xc2af('0x85')](_0x1fd7ad)?_0x55fa15['offlineMessageSubject']:_0x1fd7ad,'messageId':'','sentAt':new Date(),'attach':_0x369edb[_0xc2af('0x47')],'attachments':_0x369edb,'originChannel':_0xc2af('0xed'),'ChatWebsiteId':_0x55fa15['id'],'ChatOfflineMessageId':_0x2eecab['id'],'originTo':_0x55fa15[_0xc2af('0xde')][_0xc2af('0xe9')]},'body':_0x2eecab[_0xc2af('0x5c')]};var _0x242f9f={'account':{'id':_0x55fa15[_0xc2af('0xee')]},'body':_0x640006,'log':_0xc2af('0xef')};return respondWithRpcPromise(_0xc2af('0xef'),_0xc2af('0xf0'),_0x242f9f,client9001)[_0xc2af('0x21')](function(){return _0x2eecab;})[_0xc2af('0x5a')](function(_0x149270){console[_0xc2af('0x27')](_0x149270);});}return;})[_0xc2af('0x21')](function(){if(_0x2eecab){return _0x2eecab;}})[_0xc2af('0x21')](respondWithResult(_0x3cbd60,null))[_0xc2af('0x5a')](function(_0x2fe569){console[_0xc2af('0x27')](_0xc2af('0x5a'),_0x2fe569);for(var _0x4206b5 of _0x34e418){var _0x4e7dd1=path[_0xc2af('0x7b')](config[_0xc2af('0x7c')],_0xc2af('0xd6'),_0xc2af('0xc8'),'attachments',_0xc2af('0xd8'),_0x4206b5[_0xc2af('0x77')]);fs_extra[_0xc2af('0xf1')](_0x4e7dd1)[_0xc2af('0x5a')](function(_0x2967b4){console[_0xc2af('0x27')](_0xc2af('0xf2'),_0x4e7dd1,_0x2967b4);});}});};exports[_0xc2af('0xf3')]=function(_0x295848,_0x57d256,_0x376fd2){return db[_0xc2af('0xb6')][_0xc2af('0x59')]({'where':{'id':_0x295848['params']['id']}})['then'](handleEntityNotFound(_0x57d256,null))['then'](function(_0x48e7c5){if(_0x48e7c5){return _0x48e7c5[_0xc2af('0xf3')](_0x295848[_0xc2af('0x5c')][_0xc2af('0x6c')],_[_0xc2af('0xf4')](_0x295848['body'],[_0xc2af('0x6c'),'id'])||{});}})[_0xc2af('0x21')](respondWithResult(_0x57d256,null))['catch'](handleError(_0x57d256,null));};exports[_0xc2af('0xf5')]=function(_0x263cf9,_0x366c4c,_0x434e7e){var _0x1880dd={'raw':![],'where':{}};var _0xbf9eaf={};var _0x2fb30a={'count':0x0,'rows':[]};return db[_0xc2af('0x3c')][_0xc2af('0x69')]({'where':{'id':_0x263cf9['params']['id']}})[_0xc2af('0x21')](handleEntityNotFound(_0x366c4c,null))['then'](function(_0x33978b){if(_0x33978b){_0xbf9eaf[_0xc2af('0x41')]=_[_0xc2af('0x43')](db['ChatInteraction']['rawAttributes']);_0xbf9eaf[_0xc2af('0x42')]=_['keys'](_0x263cf9[_0xc2af('0x42')]);_0xbf9eaf[_0xc2af('0x4d')]=_[_0xc2af('0x44')](_0xbf9eaf[_0xc2af('0x41')],_0xbf9eaf['query']);_0x1880dd['attributes']=_['intersection'](_0xbf9eaf[_0xc2af('0x41')],qs[_0xc2af('0x46')](_0x263cf9[_0xc2af('0x42')][_0xc2af('0x46')]));_0x1880dd[_0xc2af('0x45')]=_0x1880dd[_0xc2af('0x45')][_0xc2af('0x47')]?_0x1880dd[_0xc2af('0x45')]:_0xbf9eaf['model'];if(!_0x263cf9[_0xc2af('0x42')]['hasOwnProperty'](_0xc2af('0x49'))){_0x1880dd[_0xc2af('0x2f')]=qs[_0xc2af('0x2f')](_0x263cf9[_0xc2af('0x42')][_0xc2af('0x2f')]);_0x1880dd['offset']=qs[_0xc2af('0x2d')](_0x263cf9[_0xc2af('0x42')][_0xc2af('0x2d')]);}_0x1880dd['order']=qs[_0xc2af('0x4b')](_0x263cf9['query'][_0xc2af('0x4b')]);_0x1880dd[_0xc2af('0x4c')]=qs[_0xc2af('0x4d')](_[_0xc2af('0x4e')](_0x263cf9[_0xc2af('0x42')],_0xbf9eaf['filters']));_0x1880dd[_0xc2af('0x4c')][_0xc2af('0x66')]=_0x33978b['id'];if(_0x263cf9[_0xc2af('0x42')][_0xc2af('0x51')]){_0x1880dd[_0xc2af('0x4c')]=_[_0xc2af('0x4f')](_0x1880dd['where'],{'$or':_[_0xc2af('0x3b')](_0x1880dd[_0xc2af('0x45')],function(_0x33c2d3){var _0x441e20={};_0x441e20[_0x33c2d3]={'$like':'%'+_0x263cf9[_0xc2af('0x42')]['filter']+'%'};return _0x441e20;})});}_0x1880dd=_[_0xc2af('0x4f')]({},_0x1880dd,_0x263cf9[_0xc2af('0x52')]);return db[_0xc2af('0xb6')]['count']({'where':_0x1880dd[_0xc2af('0x4c')]})[_0xc2af('0x21')](function(_0x49d5d0){_0x2fb30a[_0xc2af('0x30')]=_0x49d5d0;if(_0x263cf9[_0xc2af('0x42')]['includeAll']){_0x1880dd['include']=[{'model':db[_0xc2af('0x8d')],'as':_0xc2af('0xf6'),'required':![]},{'model':db[_0xc2af('0xc2')],'as':'Owner','attributes':[_0xc2af('0xae'),_0xc2af('0xf7'),_0xc2af('0xf8')],'required':![]},{'model':db[_0xc2af('0xf9')],'as':_0xc2af('0xfa'),'attributes':['id',_0xc2af('0xae'),_0xc2af('0xfb')],'where':_0x263cf9[_0xc2af('0x42')][_0xc2af('0xfc')]?{'id':_0x263cf9[_0xc2af('0x42')][_0xc2af('0xfc')]}:undefined,'required':_0x263cf9['query'][_0xc2af('0xfc')]?!![]:![]}];}return db['ChatInteraction'][_0xc2af('0x54')](_0x1880dd);})[_0xc2af('0x21')](function(_0xd6fe25){_0x2fb30a[_0xc2af('0x6a')]=_0xd6fe25;return _0x2fb30a;});}})[_0xc2af('0x21')](respondWithFilteredResult(_0x366c4c,_0x1880dd))[_0xc2af('0x5a')](handleError(_0x366c4c,null));};function iftimePromise(_0x2fe776,_0x5ea18b){return respondWithRpcPromise(_0xc2af('0xfd'),_0xc2af('0xfe'),{'command':_0x5ea18b[_0xc2af('0xff')]?util[_0xc2af('0xb0')](_0xc2af('0x100'),_0x2fe776[_0xc2af('0x101')],_0x5ea18b[_0xc2af('0xff')]):util['format'](_0xc2af('0x102'),_0x2fe776[_0xc2af('0x101')])},client9002)[_0xc2af('0x21')](function(_0x154d7f){var _0x5bd51a=_0x154d7f&&_0x154d7f['indexOf']('true')>=0x0?!![]:![];logger[_0xc2af('0x22')](_0xc2af('0x103'),_0x5ea18b['id'],_0x2fe776['id'],_0x2fe776[_0xc2af('0x101')],_0x5bd51a?_0xc2af('0x104'):_0xc2af('0x105'),_0x5ea18b[_0xc2af('0xff')]?_0x5ea18b[_0xc2af('0xff')]:'No\x20timezone');return _0x5bd51a;})[_0xc2af('0x5a')](function(_0x598a80){logger['error'](_0xc2af('0x103'),_0x5ea18b['id'],_0x2fe776['id'],_0x2fe776[_0xc2af('0x101')],util[_0xc2af('0x106')](_0x598a80,{'showHidden':![],'depth':null}),_0x5ea18b[_0xc2af('0xff')]?_0x5ea18b[_0xc2af('0xff')]:_0xc2af('0x107'));return![];});}exports[_0xc2af('0xfe')]=function(_0x395d44,_0x5c8423,_0x23add1){var _0x16ecc3=0x0;var _0x16e3a5=0x0;var _0x43481f=![];var _0x4c5c35;var _0x31f963;return db[_0xc2af('0x3c')][_0xc2af('0x59')]({'where':{'id':_0x395d44[_0xc2af('0x56')]['id']},'include':[{'model':db[_0xc2af('0x108')],'as':_0xc2af('0x108'),'include':[{'model':db[_0xc2af('0x108')],'as':_0xc2af('0x109'),'attributes':['id',_0xc2af('0x101')],'raw':!![]}]}]})[_0xc2af('0x21')](handleEntityNotFound(_0x5c8423,null))[_0xc2af('0x21')](function(_0xd83dfe){if(_0xd83dfe){_0x4c5c35=_0xd83dfe;return _0xd83dfe[_0xc2af('0x10a')]({'raw':!![]});}})[_0xc2af('0x21')](function(_0x5d415e){if(_0x4c5c35){if(_0x5d415e){_0x31f963=_0x5d415e;}}return require(_0xc2af('0x17'))['getLicense']();})['then'](function(_0x12bddf){if(_0x12bddf){_0x16e3a5=_0x12bddf[_0xc2af('0x10b')];_0x43481f=_0x12bddf['custom'];}})[_0xc2af('0x21')](function(){return db['ChatInteraction'][_0xc2af('0x30')]({'where':{'closed':![]}});})[_0xc2af('0x21')](function(_0x349b6f){_0x16ecc3=_0x349b6f;if(_0x16e3a5&&_0x349b6f>_0x16e3a5){return db['License'][_0xc2af('0x69')]({'where':{'id':0x1}})[_0xc2af('0x21')](function(_0x374559){if(_0x374559){_0x374559[_0xc2af('0x10c')](_0xc2af('0x10d'));}});}})['then'](function(){if(_0x4c5c35[_0xc2af('0x108')]&&_0x4c5c35[_0xc2af('0x108')][_0xc2af('0x109')]){var _0x21db72=[];for(var _0x2a3fce=0x0;_0x2a3fce<_0x4c5c35['Interval']['Intervals'][_0xc2af('0x47')];_0x2a3fce++){var _0x26d3b3=_0x4c5c35['Interval'][_0xc2af('0x109')][_0x2a3fce][_0xc2af('0x5e')]({'plain':!![]});_0x21db72[_0xc2af('0xbc')](iftimePromise(_0x26d3b3,_0x4c5c35));}return BPromise['all'](_0x21db72)['then'](function(_0x1eb706){return _[_0xc2af('0x10e')](_0x1eb706);});}else{return!![];}})[_0xc2af('0x21')](function(_0xc209e){var _0x479020=fs[_0xc2af('0xcf')](path['join'](config[_0xc2af('0x7c')],_0xc2af('0x10f')),'utf8');var _0x174a9a={'remote':_0x4c5c35[_0xc2af('0x110')],'query':querystring[_0xc2af('0x26')](_[_0xc2af('0x4f')](_0x4c5c35[_0xc2af('0x5e')]({'plain':!![]}),{'customerIp':_0x395d44['headers']['x-forwarded-for']||_0x395d44[_0xc2af('0x8c')][_0xc2af('0x111')]||_0x395d44[_0xc2af('0x112')][_0xc2af('0x113')]||_0x395d44['ip'],'referer':_0x395d44[_0xc2af('0x8c')][_0xc2af('0x114')],'openedInteractions':_0x16ecc3,'maxInteractions':_0x16e3a5,'virtual':_0x43481f['virtual'],'online':_0xc209e,'custom':_0x43481f}))[_0xc2af('0x115')](/'/g,'\x5c\x27')};_0x5c8423[_0xc2af('0x38')](ejs[_0xc2af('0xd1')](Mustache[_0xc2af('0xd1')](_0x479020,_0x174a9a),{'proactiveActions':_0x31f963,'alignment':_0x4c5c35[_0xc2af('0x116')],'verticalAlignment':_0x4c5c35[_0xc2af('0x117')],'div_color':_0x4c5c35[_0xc2af('0xfb')],'text_color':_0x4c5c35[_0xc2af('0x118')],'button_color':_0x4c5c35['color_button'],'background_color':_0x4c5c35[_0xc2af('0x119')]}));})[_0xc2af('0x5a')](handleError(_0x5c8423,null));};exports[_0xc2af('0x11a')]=function(_0x159288,_0x329de5,_0x38df63){return db['ChatWebsite'][_0xc2af('0x69')]({'where':{'id':_0x159288['params']['id']}})[_0xc2af('0x21')](handleEntityNotFound(_0x329de5,null))['then'](function(_0x4149ce){if(_0x4149ce){return db[_0xc2af('0xda')][_0xc2af('0xdb')](function(_0xa4b71e){return db[_0xc2af('0x11b')][_0xc2af('0x35')]({'where':{'ChatWebsiteId':_0x159288[_0xc2af('0x56')]['id']},'transaction':_0xa4b71e})['then'](function(_0x4f3089){var _0x45b1a4=_[_0xc2af('0x3b')](_0x159288[_0xc2af('0x5c')],function(_0x502ad8){_0x502ad8[_0xc2af('0x66')]=_0x159288[_0xc2af('0x56')]['id'];return _0x502ad8;});return db[_0xc2af('0x11b')]['bulkCreate'](_0x45b1a4,{'transaction':_0xa4b71e});});})['then'](function(){return db[_0xc2af('0x11b')][_0xc2af('0x11c')]({'where':{'ChatWebsiteId':_0x159288['params']['id']},'order':_0xc2af('0xa1')});});}})['then'](respondWithResult(_0x329de5,null))[_0xc2af('0x5a')](handleError(_0x329de5,null));};exports[_0xc2af('0x11d')]=function(_0x4f4adc,_0xc97bf6,_0x3e5d29){var _0x1d30e1={};var _0x5491c2={};var _0x1dbf30;var _0x33be67;return db['ChatWebsite'][_0xc2af('0x69')]({'where':{'id':_0x4f4adc['params']['id']}})[_0xc2af('0x21')](handleEntityNotFound(_0xc97bf6,null))['then'](function(_0x2d3d92){if(_0x2d3d92){_0x1dbf30=_0x2d3d92;_0x5491c2[_0xc2af('0x41')]=_[_0xc2af('0x43')](db[_0xc2af('0x11b')][_0xc2af('0x3d')]);_0x5491c2[_0xc2af('0x42')]=_[_0xc2af('0x43')](_0x4f4adc['query']);_0x5491c2[_0xc2af('0x4d')]=_[_0xc2af('0x44')](_0x5491c2[_0xc2af('0x41')],_0x5491c2[_0xc2af('0x42')]);_0x1d30e1[_0xc2af('0x45')]=_[_0xc2af('0x44')](_0x5491c2[_0xc2af('0x41')],qs['fields'](_0x4f4adc[_0xc2af('0x42')]['fields']));_0x1d30e1[_0xc2af('0x45')]=_0x1d30e1[_0xc2af('0x45')][_0xc2af('0x47')]?_0x1d30e1['attributes']:_0x5491c2[_0xc2af('0x41')];_0x1d30e1[_0xc2af('0x4a')]=qs[_0xc2af('0x4b')](_0x4f4adc[_0xc2af('0x42')]['sort']);_0x1d30e1['where']=qs[_0xc2af('0x4d')](_[_0xc2af('0x4e')](_0x4f4adc[_0xc2af('0x42')],_0x5491c2[_0xc2af('0x4d')]));if(_0x4f4adc[_0xc2af('0x42')][_0xc2af('0x51')]){_0x1d30e1[_0xc2af('0x4c')]=_[_0xc2af('0x4f')](_0x1d30e1[_0xc2af('0x4c')],{'$or':_[_0xc2af('0x3b')](_0x1d30e1[_0xc2af('0x45')],function(_0x42895a){var _0x4afc0e={};_0x4afc0e[_0x42895a]={'$like':'%'+_0x4f4adc[_0xc2af('0x42')]['filter']+'%'};return _0x4afc0e;})});}_0x1d30e1=_[_0xc2af('0x4f')]({},_0x1d30e1,_0x4f4adc[_0xc2af('0x52')]);return _0x1dbf30['getApplications'](_0x1d30e1);}})[_0xc2af('0x21')](function(_0x31e56e){if(_0x31e56e){_0x33be67=_0x31e56e['length'];if(!_0x4f4adc[_0xc2af('0x42')][_0xc2af('0x48')](_0xc2af('0x49'))){_0x1d30e1[_0xc2af('0x2f')]=qs[_0xc2af('0x2f')](_0x4f4adc['query'][_0xc2af('0x2f')]);_0x1d30e1[_0xc2af('0x2d')]=qs[_0xc2af('0x2d')](_0x4f4adc[_0xc2af('0x42')][_0xc2af('0x2d')]);}return _0x1dbf30[_0xc2af('0x11d')](_0x1d30e1);}})[_0xc2af('0x21')](function(_0xf1b60){if(_0xf1b60){return _0xf1b60?{'count':_0x33be67,'rows':_0xf1b60}:null;}})[_0xc2af('0x21')](respondWithResult(_0xc97bf6,null))['catch'](handleError(_0xc97bf6,null));};exports[_0xc2af('0x11e')]=function(_0x1dc14c,_0x171dce,_0xb8df3){return db[_0xc2af('0x11f')]['find']({'where':{'id':_0x1dc14c['params']['id']}})['then'](handleEntityNotFound(_0x171dce,null))['then'](function(_0x5b3015){if(_0x5b3015){return _0x5b3015['addProactiveActions'](_0x1dc14c[_0xc2af('0x5c')][_0xc2af('0x6c')],_[_0xc2af('0xf4')](_0x1dc14c[_0xc2af('0x5c')],[_0xc2af('0x6c'),'id'])||{});}})[_0xc2af('0x21')](respondWithResult(_0x171dce,null))[_0xc2af('0x5a')](handleError(_0x171dce,null));};exports[_0xc2af('0x10a')]=function(_0x2db5cd,_0x4cc6c2,_0x2d5cdc){var _0x32fb54={};var _0x346c88={};var _0x4d7bac;var _0x3926d6;return db[_0xc2af('0x3c')][_0xc2af('0x69')]({'where':{'id':_0x2db5cd[_0xc2af('0x56')]['id']}})['then'](handleEntityNotFound(_0x4cc6c2,null))[_0xc2af('0x21')](function(_0xb7f547){if(_0xb7f547){_0x4d7bac=_0xb7f547;_0x346c88['model']=_[_0xc2af('0x43')](db['ChatProactiveAction'][_0xc2af('0x3d')]);_0x346c88[_0xc2af('0x42')]=_['keys'](_0x2db5cd[_0xc2af('0x42')]);_0x346c88[_0xc2af('0x4d')]=_[_0xc2af('0x44')](_0x346c88[_0xc2af('0x41')],_0x346c88[_0xc2af('0x42')]);_0x32fb54[_0xc2af('0x45')]=_[_0xc2af('0x44')](_0x346c88['model'],qs[_0xc2af('0x46')](_0x2db5cd[_0xc2af('0x42')][_0xc2af('0x46')]));_0x32fb54['attributes']=_0x32fb54['attributes'][_0xc2af('0x47')]?_0x32fb54['attributes']:_0x346c88[_0xc2af('0x41')];_0x32fb54[_0xc2af('0x4a')]=qs[_0xc2af('0x4b')](_0x2db5cd['query'][_0xc2af('0x4b')]);_0x32fb54['where']=qs[_0xc2af('0x4d')](_[_0xc2af('0x4e')](_0x2db5cd['query'],_0x346c88[_0xc2af('0x4d')]));if(_0x2db5cd['query']['filter']){_0x32fb54[_0xc2af('0x4c')]=_[_0xc2af('0x4f')](_0x32fb54['where'],{'$or':_['map'](_0x32fb54[_0xc2af('0x45')],function(_0x54a0c6){var _0x235e57={};_0x235e57[_0x54a0c6]={'$like':'%'+_0x2db5cd[_0xc2af('0x42')][_0xc2af('0x51')]+'%'};return _0x235e57;})});}_0x32fb54=_[_0xc2af('0x4f')]({},_0x32fb54,_0x2db5cd['options']);return _0x4d7bac[_0xc2af('0x10a')](_0x32fb54);}})[_0xc2af('0x21')](function(_0x3e5214){if(_0x3e5214){_0x3926d6=_0x3e5214['length'];if(!_0x2db5cd[_0xc2af('0x42')][_0xc2af('0x48')](_0xc2af('0x49'))){_0x32fb54['limit']=qs[_0xc2af('0x2f')](_0x2db5cd[_0xc2af('0x42')][_0xc2af('0x2f')]);_0x32fb54[_0xc2af('0x2d')]=qs[_0xc2af('0x2d')](_0x2db5cd['query'][_0xc2af('0x2d')]);}return _0x4d7bac['getProactiveActions'](_0x32fb54);}})[_0xc2af('0x21')](function(_0x19d2fa){if(_0x19d2fa){return _0x19d2fa?{'count':_0x3926d6,'rows':_0x19d2fa}:null;}})[_0xc2af('0x21')](respondWithResult(_0x4cc6c2,null))[_0xc2af('0x5a')](handleError(_0x4cc6c2,null));};exports[_0xc2af('0x120')]=function(_0x35366d,_0x4eadd9,_0x485f3e){var _0x4e5183=_0x35366d[_0xc2af('0x42')][_0xc2af('0x121')]==='false'?_0xc2af('0x122'):_0xc2af('0x123');return db[_0xc2af('0x3c')][_0xc2af('0x59')]({'attributes':['id',_0x4e5183],'where':{'id':_0x35366d['params']['id']}})[_0xc2af('0x21')](handleEntityNotFound(_0x4eadd9,null))[_0xc2af('0x21')](function(_0x491b36){if(_0x491b36){var _0x3d8033=_0x491b36[_0x4e5183];var _0x3f58fa=_0x3d8033&&_0x3d8033['items']?_0x3d8033[_0xc2af('0x124')]:[];_0x4eadd9[_0xc2af('0x38')]({'fromKey':_[_0xc2af('0x85')](_0x3d8033[_0xc2af('0x125')])?undefined:_0x3d8033['fromKey'],'count':_0x3f58fa[_0xc2af('0x47')],'rows':_0x3f58fa});}})[_0xc2af('0x5a')](handleError(_0x4eadd9,null));};exports[_0xc2af('0x126')]=function(_0xdf2c35,_0x4a940c,_0x5a0f47){var _0x4f9b58={'raw':![],'where':{}};var _0x4e7776={};var _0x36bb0b={'count':0x0,'rows':[]};return db[_0xc2af('0x3c')][_0xc2af('0x69')]({'where':{'id':_0xdf2c35[_0xc2af('0x56')]['id']}})[_0xc2af('0x21')](handleEntityNotFound(_0x4a940c,null))['then'](function(_0x298684){if(_0x298684){_0x4e7776[_0xc2af('0x41')]=_[_0xc2af('0x43')](db[_0xc2af('0xd3')][_0xc2af('0x3d')]);_0x4e7776['query']=_['keys'](_0xdf2c35['query']);_0x4e7776[_0xc2af('0x4d')]=_['intersection'](_0x4e7776['model'],_0x4e7776['query']);_0x4f9b58[_0xc2af('0x45')]=_[_0xc2af('0x44')](_0x4e7776[_0xc2af('0x41')],qs[_0xc2af('0x46')](_0xdf2c35[_0xc2af('0x42')][_0xc2af('0x46')]));_0x4f9b58[_0xc2af('0x45')]=_0x4f9b58[_0xc2af('0x45')][_0xc2af('0x47')]?_0x4f9b58[_0xc2af('0x45')]:_0x4e7776[_0xc2af('0x41')];if(!_0xdf2c35[_0xc2af('0x42')][_0xc2af('0x48')](_0xc2af('0x49'))){_0x4f9b58[_0xc2af('0x2f')]=qs[_0xc2af('0x2f')](_0xdf2c35[_0xc2af('0x42')][_0xc2af('0x2f')]);_0x4f9b58['offset']=qs[_0xc2af('0x2d')](_0xdf2c35['query'][_0xc2af('0x2d')]);}_0x4f9b58[_0xc2af('0x4a')]=qs[_0xc2af('0x4b')](_0xdf2c35[_0xc2af('0x42')][_0xc2af('0x4b')]);_0x4f9b58[_0xc2af('0x4c')]=qs[_0xc2af('0x4d')](_['pick'](_0xdf2c35['query'],_0x4e7776['filters']));_0x4f9b58[_0xc2af('0x4c')][_0xc2af('0x66')]=_0x298684['id'];if(_0xdf2c35[_0xc2af('0x42')]['filter']){_0x4f9b58[_0xc2af('0x4c')]=_[_0xc2af('0x4f')](_0x4f9b58[_0xc2af('0x4c')],{'$or':_[_0xc2af('0x3b')](_0x4f9b58[_0xc2af('0x45')],function(_0xcdde2f){var _0xa1ce75={};_0xa1ce75[_0xcdde2f]={'$like':'%'+_0xdf2c35[_0xc2af('0x42')]['filter']+'%'};return _0xa1ce75;})});}_0x4f9b58=_[_0xc2af('0x4f')]({},_0x4f9b58,_0xdf2c35[_0xc2af('0x52')]);return db['ChatOfflineMessage'][_0xc2af('0x30')]({'where':_0x4f9b58['where']})[_0xc2af('0x21')](function(_0x239616){_0x36bb0b[_0xc2af('0x30')]=_0x239616;if(_0xdf2c35[_0xc2af('0x42')][_0xc2af('0x58')]){_0x4f9b58[_0xc2af('0x53')]=[{'all':!![]}];}else{_0x4f9b58['include']=[{'model':db[_0xc2af('0x8d')],'as':'Contact','required':![]},{'model':db[_0xc2af('0xdc')],'as':'Attachments','required':![]}];}return db[_0xc2af('0xd3')][_0xc2af('0x54')](_0x4f9b58);})[_0xc2af('0x21')](function(_0xf9bfbc){_0x36bb0b[_0xc2af('0x6a')]=_0xf9bfbc;return _0x36bb0b;});}})[_0xc2af('0x21')](respondWithFilteredResult(_0x4a940c,_0x4f9b58))[_0xc2af('0x5a')](handleError(_0x4a940c,null));};exports[_0xc2af('0x127')]=function(_0x406fe4,_0x36420d,_0x2bf29a){return db[_0xc2af('0x3c')][_0xc2af('0x59')]({'where':{'id':_0x406fe4[_0xc2af('0x56')]['id']}})[_0xc2af('0x21')](handleEntityNotFound(_0x36420d,null))[_0xc2af('0x21')](function(_0x4cd1d7){if(_0x4cd1d7){return _0x4cd1d7[_0xc2af('0x127')](_0x406fe4[_0xc2af('0x5c')][_0xc2af('0x6c')],_[_0xc2af('0xf4')](_0x406fe4[_0xc2af('0x5c')],[_0xc2af('0x6c'),'id'])||{})[_0xc2af('0xce')](function(_0x4af09f){for(var _0x393a31=0x0;_0x393a31<_0x406fe4[_0xc2af('0x5c')]['ids'][_0xc2af('0x47')];_0x393a31+=0x1){socket[_0xc2af('0x128')](_0xc2af('0x129'),{'UserId':Number(_0x406fe4[_0xc2af('0x5c')][_0xc2af('0x6c')][_0x393a31]),'ChatWebsiteId':Number(_0x406fe4[_0xc2af('0x56')]['id'])});}return _0x4af09f;});}})[_0xc2af('0x21')](respondWithResult(_0x36420d,null))[_0xc2af('0x5a')](handleError(_0x36420d,null));};exports['removeAgents']=function(_0x243ba0,_0x426db0,_0x2d5158){return db['ChatWebsite'][_0xc2af('0x59')]({'where':{'id':_0x243ba0['params']['id']}})['then'](handleEntityNotFound(_0x426db0,null))['then'](function(_0x33b4f9){if(_0x33b4f9){return _0x33b4f9[_0xc2af('0x12a')](_0x243ba0[_0xc2af('0x42')][_0xc2af('0x6c')])[_0xc2af('0x21')](function(){if(_[_0xc2af('0x12b')](_0x243ba0[_0xc2af('0x42')][_0xc2af('0x6c')])){for(var _0x4ccddf=0x0;_0x4ccddf<_0x243ba0[_0xc2af('0x42')][_0xc2af('0x6c')][_0xc2af('0x47')];_0x4ccddf+=0x1){socket[_0xc2af('0x128')](_0xc2af('0x12c'),{'UserId':Number(_0x243ba0[_0xc2af('0x42')][_0xc2af('0x6c')][_0x4ccddf]),'ChatWebsiteId':Number(_0x243ba0[_0xc2af('0x56')]['id'])});}}else{socket[_0xc2af('0x128')](_0xc2af('0x12c'),{'UserId':Number(_0x243ba0['query'][_0xc2af('0x6c')]),'ChatWebsiteId':Number(_0x243ba0[_0xc2af('0x56')]['id'])});}});}})[_0xc2af('0x21')](respondWithStatusCode(_0x426db0,null))['catch'](handleError(_0x426db0,null));};exports[_0xc2af('0x12d')]=function(_0x213e20,_0x4f0db2,_0x310804){var _0x211df2={};var _0x3efce2={};var _0x5d2b75;var _0x508cc7;return db[_0xc2af('0x3c')][_0xc2af('0x69')]({'where':{'id':_0x213e20[_0xc2af('0x56')]['id']}})[_0xc2af('0x21')](handleEntityNotFound(_0x4f0db2,null))[_0xc2af('0x21')](function(_0x5088d8){if(_0x5088d8){_0x5d2b75=_0x5088d8;_0x3efce2[_0xc2af('0x41')]=_['keys'](db['User']['rawAttributes']);_0x3efce2[_0xc2af('0x42')]=_[_0xc2af('0x43')](_0x213e20['query']);_0x3efce2[_0xc2af('0x4d')]=_[_0xc2af('0x44')](_0x3efce2[_0xc2af('0x41')],_0x3efce2['query']);_0x211df2['attributes']=_[_0xc2af('0x44')](_0x3efce2['model'],qs['fields'](_0x213e20['query'][_0xc2af('0x46')]));_0x211df2['attributes']=_0x211df2['attributes'][_0xc2af('0x47')]?_0x211df2['attributes']:_0x3efce2[_0xc2af('0x41')];_0x211df2['order']=qs[_0xc2af('0x4b')](_0x213e20[_0xc2af('0x42')][_0xc2af('0x4b')]);_0x211df2[_0xc2af('0x4c')]=qs['filters'](_['pick'](_0x213e20[_0xc2af('0x42')],_0x3efce2[_0xc2af('0x4d')]));if(_0x213e20[_0xc2af('0x42')][_0xc2af('0x51')]){_0x211df2[_0xc2af('0x4c')]=_[_0xc2af('0x4f')](_0x211df2[_0xc2af('0x4c')],{'$or':_[_0xc2af('0x3b')](_0x211df2[_0xc2af('0x45')],function(_0xddd97f){var _0x5a5f25={};_0x5a5f25[_0xddd97f]={'$like':'%'+_0x213e20[_0xc2af('0x42')]['filter']+'%'};return _0x5a5f25;})});}_0x211df2=_['merge']({},_0x211df2,_0x213e20[_0xc2af('0x52')]);return _0x5d2b75[_0xc2af('0x12d')](_0x211df2);}})[_0xc2af('0x21')](function(_0x2de575){if(_0x2de575){_0x508cc7=_0x2de575[_0xc2af('0x47')];if(!_0x213e20[_0xc2af('0x42')][_0xc2af('0x48')](_0xc2af('0x49'))){_0x211df2[_0xc2af('0x2f')]=qs[_0xc2af('0x2f')](_0x213e20[_0xc2af('0x42')]['limit']);_0x211df2['offset']=qs['offset'](_0x213e20[_0xc2af('0x42')][_0xc2af('0x2d')]);}return _0x5d2b75[_0xc2af('0x12d')](_0x211df2);}})[_0xc2af('0x21')](function(_0x4256f7){if(_0x4256f7){return _0x4256f7?{'count':_0x508cc7,'rows':_0x4256f7}:null;}})[_0xc2af('0x21')](respondWithResult(_0x4f0db2,null))[_0xc2af('0x5a')](handleError(_0x4f0db2,null));}; \ No newline at end of file +var _0xadd4=['notify','offline','files','no\x20available\x20attributes','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','originalname','mimetype','attachments','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','MailAccount','Smtp','forwardOfflineAddress','service','host','port','authentication','pass','sendMail','email','MailAccountId','mapValues','subjectOffline','offlineMessageSubject','Chat','NotifyMailAccount','notifyMail','server','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','ids','omit','getInteractions','Contact','User','Owner','fullname','internal','Tag','tag','Command','interval','timezone','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','No\x20timezone','inspect','getSnippet','Intervals','getProactiveActions','getLicense','virtual','custom','License','increment','chatLicenseExceeded','Interval','all','some','server/files/chat/iframe.ejs','remote','x-real-ip','connection','remoteAddress','referer','replace','alignment','verticalAlignment','color','textColor','color_button','backgroundColor','bulkCreate','findAndCountAll','priority','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','false','offlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','http','client','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','message','result','end','status','json','offset','undefined','count','limit','apply','reject','save','destroy','get','ChatWebsites','UserProfileResource','stack','name','send','index','Pause','ChatWebsite','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','nolimit','sort','filter','where','map','VIRTUAL','merge','options','includeAll','include','findAll','show','params','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','hasOwnProperty','order','pick','removeDispositions','addAnswer','CannedAnswer','getAnswers','rows','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','systemAvatar','join','root','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','setUA','headers','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','ChatApplication','Applications','List','account','applications','list','customerIp','cf-connecting-ip','first','x-forwarded-for','split','firstName','lastName','x-real-port','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','stringify','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','contact','messageId','created','autoclose','push','*,*,*,*','AttachmentId','UserId','unshift','forcedOwnership','Start','startRouting','EventManager'];(function(_0xaf025d,_0x586d7a){var _0x1c77cb=function(_0x560b3a){while(--_0x560b3a){_0xaf025d['push'](_0xaf025d['shift']());}};_0x1c77cb(++_0x586d7a);}(_0xadd4,0x6d));var _0x4add=function(_0x14997d,_0x23725b){_0x14997d=_0x14997d-0x0;var _0x2ae1e4=_0xadd4[_0x14997d];return _0x2ae1e4;};'use strict';var emlformat=require(_0x4add('0x0'));var rimraf=require(_0x4add('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4add('0x2'));var rp=require(_0x4add('0x3'));var moment=require(_0x4add('0x4'));var BPromise=require(_0x4add('0x5'));var Mustache=require(_0x4add('0x6'));var util=require(_0x4add('0x7'));var path=require(_0x4add('0x8'));var sox=require(_0x4add('0x9'));var csv=require(_0x4add('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4add('0xb'));var _=require(_0x4add('0xc'));var squel=require(_0x4add('0xd'));var crypto=require(_0x4add('0xe'));var jsforce=require(_0x4add('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x4add('0xa'));var querystring=require(_0x4add('0x10'));var Papa=require(_0x4add('0x11'));var Redis=require(_0x4add('0x12'));var authService=require(_0x4add('0x13'));var qs=require(_0x4add('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4add('0x15'));var logger=require(_0x4add('0x16'))(_0x4add('0x17'));var utils=require('../../config/utils');var config=require(_0x4add('0x18'));var licenseUtil=require(_0x4add('0x19'));var db=require(_0x4add('0x1a'))['db'];config[_0x4add('0x1b')]=_[_0x4add('0x1c')](config['redis'],{'host':_0x4add('0x1d'),'port':0x18eb});var socket=require(_0x4add('0x1e'))(new Redis(config[_0x4add('0x1b')]));require('./chatWebsite.socket')[_0x4add('0x1f')](socket);var jayson=require(_0x4add('0x20'));var client=jayson['client'][_0x4add('0x21')]({'port':0x232c});var client9002=jayson[_0x4add('0x22')][_0x4add('0x21')]({'port':0x232a});var client9003=jayson[_0x4add('0x22')][_0x4add('0x21')]({'port':0x232b});var client9001=jayson[_0x4add('0x22')][_0x4add('0x21')]({'port':0x2329});function respondWithRpcPromise(_0x3c503f,_0x270ecd,_0x154f02,_0x5361b4){return new BPromise(function(_0x5ada18,_0x3ba57){var _0x392d0c=_0x5361b4||client;return _0x392d0c['request'](_0x3c503f,_0x154f02)[_0x4add('0x23')](function(_0xa9a9df){logger[_0x4add('0x24')](_0x4add('0x25'),_0x270ecd,_0x4add('0x26'));logger[_0x4add('0x27')](_0x4add('0x28'),_0x270ecd,_0x4add('0x26'),JSON['stringify'](_0xa9a9df));if(_0xa9a9df[_0x4add('0x29')]){if(_0xa9a9df[_0x4add('0x29')]['code']===0x1f4){logger[_0x4add('0x29')](_0x4add('0x25'),_0x270ecd,_0xa9a9df[_0x4add('0x29')][_0x4add('0x2a')]);return _0x3ba57(_0xa9a9df[_0x4add('0x29')][_0x4add('0x2a')]);}logger['error'](_0x4add('0x25'),_0x270ecd,_0xa9a9df[_0x4add('0x29')][_0x4add('0x2a')]);return _0x5ada18(_0xa9a9df[_0x4add('0x29')][_0x4add('0x2a')]);}else{logger[_0x4add('0x24')](_0x4add('0x25'),_0x270ecd,_0x4add('0x26'));_0x5ada18(_0xa9a9df[_0x4add('0x2b')]['message']);}})['catch'](function(_0x18d5bb){logger[_0x4add('0x29')](_0x4add('0x25'),_0x270ecd,_0x18d5bb);_0x3ba57(_0x18d5bb);});});}function respondWithStatusCode(_0x1d2ab4,_0x13ef8e){_0x13ef8e=_0x13ef8e||0xcc;return function(_0x3edebe){if(_0x3edebe){return _0x1d2ab4['sendStatus'](_0x13ef8e);}return _0x1d2ab4['status'](_0x13ef8e)[_0x4add('0x2c')]();};}function respondWithResult(_0x4103e2,_0x499578){_0x499578=_0x499578||0xc8;return function(_0x370a22){if(_0x370a22){return _0x4103e2[_0x4add('0x2d')](_0x499578)[_0x4add('0x2e')](_0x370a22);}};}function respondWithFilteredResult(_0x2be470,_0x576a0d){return function(_0x1b9d46){if(_0x1b9d46){var _0x39f28f=typeof _0x576a0d[_0x4add('0x2f')]===_0x4add('0x30')&&typeof _0x576a0d['limit']===_0x4add('0x30');var _0x1d4351=_0x1b9d46[_0x4add('0x31')];var _0x450248=_0x39f28f?0x0:_0x576a0d[_0x4add('0x2f')];var _0x42b49d=_0x39f28f?_0x1b9d46[_0x4add('0x31')]:_0x576a0d[_0x4add('0x2f')]+_0x576a0d[_0x4add('0x32')];var _0x3d61cd;if(_0x42b49d>=_0x1d4351){_0x42b49d=_0x1d4351;_0x3d61cd=0xc8;}else{_0x3d61cd=0xce;}_0x2be470[_0x4add('0x2d')](_0x3d61cd);return _0x2be470['set']('Content-Range',_0x450248+'-'+_0x42b49d+'/'+_0x1d4351)[_0x4add('0x2e')](_0x1b9d46);}return null;};}function patchUpdates(_0x3933c7){return function(_0x3ba2d6){try{jsonpatch[_0x4add('0x33')](_0x3ba2d6,_0x3933c7,!![]);}catch(_0x4622da){return BPromise[_0x4add('0x34')](_0x4622da);}return _0x3ba2d6[_0x4add('0x35')]();};}function saveUpdates(_0x229f00,_0x34062b){return function(_0x55f73b){if(_0x55f73b){return _0x55f73b['update'](_0x229f00)['then'](function(_0x3a64a5){return _0x3a64a5;});}return null;};}function removeEntity(_0x1547cb,_0x21edc8){return function(_0x2c40f5){if(_0x2c40f5){return _0x2c40f5[_0x4add('0x36')]()[_0x4add('0x23')](function(){var _0x331fbb=_0x2c40f5[_0x4add('0x37')]({'plain':!![]});var _0x54f9d6=_0x4add('0x38');return db[_0x4add('0x39')]['destroy']({'where':{'type':_0x54f9d6,'resourceId':_0x331fbb['id']}})[_0x4add('0x23')](function(){return _0x2c40f5;});})['then'](function(){_0x1547cb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xf3f6cf,_0x297647){return function(_0x1c0316){if(!_0x1c0316){_0xf3f6cf['sendStatus'](0x194);}return _0x1c0316;};}function handleError(_0x22354e,_0x18a35c){_0x18a35c=_0x18a35c||0x1f4;return function(_0x5c851f){logger[_0x4add('0x29')](_0x5c851f[_0x4add('0x3a')]);if(_0x5c851f[_0x4add('0x3b')]){delete _0x5c851f[_0x4add('0x3b')];}_0x22354e[_0x4add('0x2d')](_0x18a35c)[_0x4add('0x3c')](_0x5c851f);};}exports[_0x4add('0x3d')]=function(_0x648350,_0x2bc14d){var _0x1a7d7a={'include':[{'model':db[_0x4add('0x3e')],'as':'mandatoryDispositionPause'}]},_0x54eea2={},_0x29ab30={'count':0x0,'rows':[]};var _0x48a567=_['map'](db[_0x4add('0x3f')][_0x4add('0x40')],function(_0x25c2a3){return{'name':_0x25c2a3[_0x4add('0x41')],'type':_0x25c2a3[_0x4add('0x42')][_0x4add('0x43')]};});_0x54eea2[_0x4add('0x44')]=_['map'](_0x48a567,'name');_0x54eea2['query']=_[_0x4add('0x45')](_0x648350[_0x4add('0x46')]);_0x54eea2[_0x4add('0x47')]=_['intersection'](_0x54eea2[_0x4add('0x44')],_0x54eea2[_0x4add('0x46')]);_0x1a7d7a['attributes']=_[_0x4add('0x48')](_0x54eea2[_0x4add('0x44')],qs[_0x4add('0x49')](_0x648350['query']['fields']));_0x1a7d7a[_0x4add('0x4a')]=_0x1a7d7a[_0x4add('0x4a')]['length']?_0x1a7d7a[_0x4add('0x4a')]:_0x54eea2[_0x4add('0x44')];if(!_0x648350['query']['hasOwnProperty'](_0x4add('0x4b'))){_0x1a7d7a[_0x4add('0x32')]=qs[_0x4add('0x32')](_0x648350[_0x4add('0x46')][_0x4add('0x32')]);_0x1a7d7a[_0x4add('0x2f')]=qs[_0x4add('0x2f')](_0x648350[_0x4add('0x46')]['offset']);}_0x1a7d7a['order']=qs[_0x4add('0x4c')](_0x648350[_0x4add('0x46')][_0x4add('0x4c')]);_0x1a7d7a['where']=qs[_0x4add('0x47')](_['pick'](_0x648350[_0x4add('0x46')],_0x54eea2[_0x4add('0x47')]),_0x48a567);if(_0x648350[_0x4add('0x46')][_0x4add('0x4d')]){_0x1a7d7a[_0x4add('0x4e')]=_['merge'](_0x1a7d7a[_0x4add('0x4e')],{'$or':_[_0x4add('0x4f')](_0x48a567,function(_0x496272){if(_0x496272[_0x4add('0x42')]!==_0x4add('0x50')){var _0x4fcdf5={};_0x4fcdf5[_0x496272['name']]={'$like':'%'+_0x648350[_0x4add('0x46')][_0x4add('0x4d')]+'%'};return _0x4fcdf5;}})});}_0x1a7d7a=_[_0x4add('0x51')]({},_0x1a7d7a,_0x648350[_0x4add('0x52')]);var _0x5ef35c={'where':_0x1a7d7a[_0x4add('0x4e')]};return db[_0x4add('0x3f')][_0x4add('0x31')](_0x5ef35c)[_0x4add('0x23')](function(_0x396322){_0x29ab30[_0x4add('0x31')]=_0x396322;if(_0x648350[_0x4add('0x46')][_0x4add('0x53')]){_0x1a7d7a[_0x4add('0x54')]=[{'all':!![]}];}return db['ChatWebsite'][_0x4add('0x55')](_0x1a7d7a);})['then'](function(_0x1b01b3){_0x29ab30['rows']=_0x1b01b3;return _0x29ab30;})[_0x4add('0x23')](respondWithFilteredResult(_0x2bc14d,_0x1a7d7a))['catch'](handleError(_0x2bc14d,null));};exports[_0x4add('0x56')]=function(_0x13a9e7,_0x1d05f0){var _0x17e67c={'raw':![],'where':{'id':_0x13a9e7[_0x4add('0x57')]['id']},'include':[{'model':db[_0x4add('0x3e')],'as':'mandatoryDispositionPause'}]},_0x1db69f={};_0x1db69f[_0x4add('0x44')]=_[_0x4add('0x45')](db[_0x4add('0x3f')][_0x4add('0x40')]);_0x1db69f[_0x4add('0x46')]=_[_0x4add('0x45')](_0x13a9e7[_0x4add('0x46')]);_0x1db69f[_0x4add('0x47')]=_['intersection'](_0x1db69f['model'],_0x1db69f[_0x4add('0x46')]);_0x17e67c[_0x4add('0x4a')]=_[_0x4add('0x48')](_0x1db69f[_0x4add('0x44')],qs['fields'](_0x13a9e7[_0x4add('0x46')][_0x4add('0x49')]));_0x17e67c[_0x4add('0x4a')]=_0x17e67c[_0x4add('0x4a')][_0x4add('0x58')]?_0x17e67c[_0x4add('0x4a')]:_0x1db69f[_0x4add('0x44')];if(_0x13a9e7[_0x4add('0x46')][_0x4add('0x53')]){_0x17e67c[_0x4add('0x54')]=[{'all':!![]}];}_0x17e67c=_[_0x4add('0x51')]({},_0x17e67c,_0x13a9e7[_0x4add('0x52')]);return db[_0x4add('0x3f')][_0x4add('0x59')](_0x17e67c)[_0x4add('0x23')](handleEntityNotFound(_0x1d05f0,null))[_0x4add('0x23')](respondWithResult(_0x1d05f0,null))[_0x4add('0x5a')](handleError(_0x1d05f0,null));};exports[_0x4add('0x5b')]=function(_0x47935b,_0x2fad3e){return db[_0x4add('0x3f')][_0x4add('0x5b')](_0x47935b[_0x4add('0x5c')],{})['then'](function(_0x8b41a6){var _0x36dff9=_0x47935b[_0x4add('0x5d')][_0x4add('0x37')]({'plain':!![]});if(!_0x36dff9)throw new Error(_0x4add('0x5e'));if(_0x36dff9[_0x4add('0x5f')]==='user'){var _0x4c8818=_0x8b41a6[_0x4add('0x37')]({'plain':!![]});var _0x519203=_0x4add('0x38');return db[_0x4add('0x60')][_0x4add('0x59')]({'where':{'name':_0x519203,'userProfileId':_0x36dff9[_0x4add('0x61')]},'raw':!![]})[_0x4add('0x23')](function(_0x2e2ab3){if(_0x2e2ab3&&_0x2e2ab3[_0x4add('0x62')]===0x0){return db[_0x4add('0x39')][_0x4add('0x5b')]({'name':_0x4c8818[_0x4add('0x3b')],'resourceId':_0x4c8818['id'],'type':_0x2e2ab3[_0x4add('0x3b')],'sectionId':_0x2e2ab3['id']},{})[_0x4add('0x23')](function(){return _0x8b41a6;});}else{return _0x8b41a6;}})[_0x4add('0x5a')](function(_0x1d87d7){logger[_0x4add('0x29')](_0x4add('0x63'),_0x1d87d7);throw _0x1d87d7;});}return _0x8b41a6;})[_0x4add('0x23')](respondWithResult(_0x2fad3e,0xc9))[_0x4add('0x5a')](handleError(_0x2fad3e,null));};exports[_0x4add('0x64')]=function(_0x2753b3,_0x44ad90){if(_0x2753b3['body']['id']){delete _0x2753b3['body']['id'];}return db[_0x4add('0x3f')][_0x4add('0x59')]({'where':{'id':_0x2753b3['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x44ad90,null))[_0x4add('0x23')](saveUpdates(_0x2753b3[_0x4add('0x5c')],null))[_0x4add('0x23')](respondWithResult(_0x44ad90,null))[_0x4add('0x5a')](handleError(_0x44ad90,null));};exports['destroy']=function(_0xba682,_0x39143b){return db[_0x4add('0x3f')]['find']({'where':{'id':_0xba682[_0x4add('0x57')]['id']}})[_0x4add('0x23')](handleEntityNotFound(_0x39143b,null))['then'](removeEntity(_0x39143b,null))[_0x4add('0x5a')](handleError(_0x39143b,null));};exports[_0x4add('0x65')]=function(_0xa8da51,_0x4a66f6){return db[_0x4add('0x3f')]['describe']()['then'](respondWithResult(_0x4a66f6,null))[_0x4add('0x5a')](handleError(_0x4a66f6,null));};exports[_0x4add('0x66')]=function(_0x3cb710,_0x5b326f,_0x2b8e71){if(_0x3cb710[_0x4add('0x5c')]['id']){delete _0x3cb710[_0x4add('0x5c')]['id'];}return db[_0x4add('0x3f')][_0x4add('0x59')]({'where':{'id':_0x3cb710[_0x4add('0x57')]['id']}})['then'](handleEntityNotFound(_0x5b326f,null))['then'](function(_0x563a09){if(_0x563a09){_0x3cb710[_0x4add('0x5c')][_0x4add('0x67')]=_0x563a09['id'];return db[_0x4add('0x68')][_0x4add('0x5b')](_0x3cb710[_0x4add('0x5c')]);}})[_0x4add('0x23')](respondWithResult(_0x5b326f,null))[_0x4add('0x5a')](handleError(_0x5b326f,null));};exports[_0x4add('0x69')]=function(_0x2b7614,_0x3e8c3c,_0x268d2d){var _0x25d7f0={'raw':![],'where':{}};var _0x5771b2={};var _0xf96746={'count':0x0,'rows':[]};return db[_0x4add('0x3f')][_0x4add('0x6a')]({'where':{'id':_0x2b7614['params']['id']}})[_0x4add('0x23')](handleEntityNotFound(_0x3e8c3c,null))[_0x4add('0x23')](function(_0x4ad22b){if(_0x4ad22b){_0x5771b2['model']=_[_0x4add('0x45')](db[_0x4add('0x68')][_0x4add('0x40')]);_0x5771b2[_0x4add('0x46')]=_[_0x4add('0x45')](_0x2b7614['query']);_0x5771b2[_0x4add('0x47')]=_[_0x4add('0x48')](_0x5771b2[_0x4add('0x44')],_0x5771b2['query']);_0x25d7f0[_0x4add('0x4a')]=_['intersection'](_0x5771b2[_0x4add('0x44')],qs['fields'](_0x2b7614[_0x4add('0x46')][_0x4add('0x49')]));_0x25d7f0[_0x4add('0x4a')]=_0x25d7f0[_0x4add('0x4a')]['length']?_0x25d7f0['attributes']:_0x5771b2[_0x4add('0x44')];if(!_0x2b7614[_0x4add('0x46')][_0x4add('0x6b')](_0x4add('0x4b'))){_0x25d7f0[_0x4add('0x32')]=qs['limit'](_0x2b7614[_0x4add('0x46')][_0x4add('0x32')]);_0x25d7f0[_0x4add('0x2f')]=qs['offset'](_0x2b7614[_0x4add('0x46')][_0x4add('0x2f')]);}_0x25d7f0[_0x4add('0x6c')]=qs[_0x4add('0x4c')](_0x2b7614[_0x4add('0x46')][_0x4add('0x4c')]);_0x25d7f0[_0x4add('0x4e')]=qs[_0x4add('0x47')](_[_0x4add('0x6d')](_0x2b7614[_0x4add('0x46')],_0x5771b2[_0x4add('0x47')]));_0x25d7f0['where'][_0x4add('0x67')]=_0x4ad22b['id'];if(_0x2b7614[_0x4add('0x46')][_0x4add('0x4d')]){_0x25d7f0['where']=_['merge'](_0x25d7f0[_0x4add('0x4e')],{'$or':_[_0x4add('0x4f')](_0x25d7f0[_0x4add('0x4a')],function(_0x5acb8f){var _0x13c4bd={};_0x13c4bd[_0x5acb8f]={'$like':'%'+_0x2b7614[_0x4add('0x46')][_0x4add('0x4d')]+'%'};return _0x13c4bd;})});}_0x25d7f0=_[_0x4add('0x51')]({},_0x25d7f0,_0x2b7614['options']);return db[_0x4add('0x68')][_0x4add('0x31')]({'where':_0x25d7f0[_0x4add('0x4e')]})[_0x4add('0x23')](function(_0x38e706){_0xf96746[_0x4add('0x31')]=_0x38e706;if(_0x2b7614[_0x4add('0x46')][_0x4add('0x53')]){_0x25d7f0[_0x4add('0x54')]=[{'all':!![]}];}return db[_0x4add('0x68')][_0x4add('0x55')](_0x25d7f0);})[_0x4add('0x23')](function(_0x48e7a9){_0xf96746['rows']=_0x48e7a9;return _0xf96746;});}})[_0x4add('0x23')](respondWithFilteredResult(_0x3e8c3c,_0x25d7f0))[_0x4add('0x5a')](handleError(_0x3e8c3c,null));};exports[_0x4add('0x6e')]=function(_0x52cefc,_0x9ea819,_0x429164){return db[_0x4add('0x3f')]['find']({'where':{'id':_0x52cefc['params']['id']}})[_0x4add('0x23')](handleEntityNotFound(_0x9ea819,null))[_0x4add('0x23')](function(_0x24855b){if(_0x24855b){return _0x24855b[_0x4add('0x6e')](_0x52cefc['query']['ids']);}})[_0x4add('0x23')](respondWithStatusCode(_0x9ea819,null))[_0x4add('0x5a')](handleError(_0x9ea819,null));};exports[_0x4add('0x6f')]=function(_0x14a31b,_0x504f45,_0x493591){if(_0x14a31b[_0x4add('0x5c')]['id']){delete _0x14a31b[_0x4add('0x5c')]['id'];}return db[_0x4add('0x3f')][_0x4add('0x59')]({'where':{'id':_0x14a31b['params']['id']}})[_0x4add('0x23')](handleEntityNotFound(_0x504f45,null))[_0x4add('0x23')](function(_0x578a9a){if(_0x578a9a){_0x14a31b['body'][_0x4add('0x67')]=_0x578a9a['id'];return db[_0x4add('0x70')][_0x4add('0x5b')](_0x14a31b[_0x4add('0x5c')]);}})[_0x4add('0x23')](respondWithResult(_0x504f45,null))[_0x4add('0x5a')](handleError(_0x504f45,null));};exports[_0x4add('0x71')]=function(_0x24297e,_0x15ac76,_0x2dede6){var _0x244104={'raw':![],'where':{}};var _0x44364d={};var _0x42a102={'count':0x0,'rows':[]};return db[_0x4add('0x3f')][_0x4add('0x6a')]({'where':{'id':_0x24297e['params']['id']}})[_0x4add('0x23')](handleEntityNotFound(_0x15ac76,null))[_0x4add('0x23')](function(_0x1fe271){if(_0x1fe271){_0x44364d['model']=_[_0x4add('0x45')](db[_0x4add('0x70')][_0x4add('0x40')]);_0x44364d[_0x4add('0x46')]=_[_0x4add('0x45')](_0x24297e[_0x4add('0x46')]);_0x44364d[_0x4add('0x47')]=_[_0x4add('0x48')](_0x44364d[_0x4add('0x44')],_0x44364d[_0x4add('0x46')]);_0x244104[_0x4add('0x4a')]=_[_0x4add('0x48')](_0x44364d['model'],qs[_0x4add('0x49')](_0x24297e[_0x4add('0x46')][_0x4add('0x49')]));_0x244104[_0x4add('0x4a')]=_0x244104[_0x4add('0x4a')][_0x4add('0x58')]?_0x244104[_0x4add('0x4a')]:_0x44364d[_0x4add('0x44')];if(!_0x24297e[_0x4add('0x46')][_0x4add('0x6b')](_0x4add('0x4b'))){_0x244104[_0x4add('0x32')]=qs[_0x4add('0x32')](_0x24297e[_0x4add('0x46')][_0x4add('0x32')]);_0x244104['offset']=qs[_0x4add('0x2f')](_0x24297e[_0x4add('0x46')][_0x4add('0x2f')]);}_0x244104['order']=qs['sort'](_0x24297e['query'][_0x4add('0x4c')]);_0x244104[_0x4add('0x4e')]=qs[_0x4add('0x47')](_[_0x4add('0x6d')](_0x24297e[_0x4add('0x46')],_0x44364d[_0x4add('0x47')]));_0x244104[_0x4add('0x4e')]['ChatWebsiteId']=_0x1fe271['id'];if(_0x24297e[_0x4add('0x46')][_0x4add('0x4d')]){_0x244104[_0x4add('0x4e')]=_[_0x4add('0x51')](_0x244104[_0x4add('0x4e')],{'$or':_['map'](_0x244104[_0x4add('0x4a')],function(_0xa7bee){var _0x4a15f4={};_0x4a15f4[_0xa7bee]={'$like':'%'+_0x24297e[_0x4add('0x46')][_0x4add('0x4d')]+'%'};return _0x4a15f4;})});}_0x244104=_[_0x4add('0x51')]({},_0x244104,_0x24297e[_0x4add('0x52')]);return db['CannedAnswer'][_0x4add('0x31')]({'where':_0x244104[_0x4add('0x4e')]})['then'](function(_0x1a6ecb){_0x42a102[_0x4add('0x31')]=_0x1a6ecb;if(_0x24297e[_0x4add('0x46')]['includeAll']){_0x244104['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x244104);})[_0x4add('0x23')](function(_0x582993){_0x42a102[_0x4add('0x72')]=_0x582993;return _0x42a102;});}})[_0x4add('0x23')](respondWithFilteredResult(_0x15ac76,_0x244104))[_0x4add('0x5a')](handleError(_0x15ac76,null));};exports['removeAnswers']=function(_0x5c9110,_0x2e46a8,_0x5f046c){return db[_0x4add('0x3f')]['find']({'where':{'id':_0x5c9110[_0x4add('0x57')]['id']}})[_0x4add('0x23')](handleEntityNotFound(_0x2e46a8,null))[_0x4add('0x23')](function(_0x4fba48){if(_0x4fba48){return _0x4fba48[_0x4add('0x73')](_0x5c9110[_0x4add('0x46')]['ids']);}})[_0x4add('0x23')](respondWithStatusCode(_0x2e46a8,null))[_0x4add('0x5a')](handleError(_0x2e46a8,null));};exports[_0x4add('0x74')]=function(_0x220632,_0x1e3ca3,_0x438365){_0x220632[_0x4add('0x5c')][_0x4add('0x75')]=_0x220632[_0x4add('0x76')][_0x4add('0x77')];return db['ChatWebsite'][_0x4add('0x59')]({'where':{'id':_0x220632[_0x4add('0x57')]['id']}})[_0x4add('0x23')](handleEntityNotFound(_0x1e3ca3,null))[_0x4add('0x23')](saveUpdates(_0x220632[_0x4add('0x5c')],null))[_0x4add('0x23')](respondWithResult(_0x1e3ca3,null))['catch'](handleError(_0x1e3ca3,null));};exports[_0x4add('0x78')]=function(_0x1a6c64,_0x14cf44,_0x11805c){_0x1a6c64[_0x4add('0x5c')][_0x4add('0x79')]=_0x1a6c64[_0x4add('0x76')][_0x4add('0x77')];return db[_0x4add('0x3f')]['find']({'where':{'id':_0x1a6c64[_0x4add('0x57')]['id']}})[_0x4add('0x23')](handleEntityNotFound(_0x14cf44,null))[_0x4add('0x23')](saveUpdates(_0x1a6c64['body'],null))['then'](respondWithResult(_0x14cf44,null))['catch'](handleError(_0x14cf44,null));};exports[_0x4add('0x7a')]=function(_0xdd5fd2,_0x20e812,_0x20771b){_0xdd5fd2[_0x4add('0x5c')][_0x4add('0x7b')]=_0xdd5fd2[_0x4add('0x76')][_0x4add('0x77')];return db[_0x4add('0x3f')][_0x4add('0x59')]({'where':{'id':_0xdd5fd2[_0x4add('0x57')]['id']}})[_0x4add('0x23')](handleEntityNotFound(_0x20e812,null))[_0x4add('0x23')](saveUpdates(_0xdd5fd2[_0x4add('0x5c')],null))['then'](respondWithResult(_0x20e812,null))['catch'](handleError(_0x20e812,null));};exports['addSystemAvatar']=function(_0x204219,_0x1b5350,_0x2c856e){_0x204219['body'][_0x4add('0x7c')]=_0x204219[_0x4add('0x76')][_0x4add('0x77')];return db['ChatWebsite'][_0x4add('0x59')]({'where':{'id':_0x204219[_0x4add('0x57')]['id']}})[_0x4add('0x23')](handleEntityNotFound(_0x1b5350,null))[_0x4add('0x23')](saveUpdates(_0x204219['body'],null))[_0x4add('0x23')](respondWithResult(_0x1b5350,null))[_0x4add('0x5a')](handleError(_0x1b5350,null));};exports['getLogo']=function(_0x3d1153,_0x2dc1fa,_0x22eefa){var _0x517df8=path[_0x4add('0x7d')](config[_0x4add('0x7e')],'server/files/images/logos/default_logo.svg');var _0x3c84d1={'where':{'id':_0x3d1153[_0x4add('0x57')]['id']},'attributes':['id',_0x4add('0x75')],'raw':!![]};var _0x10085c=![];return require(_0x4add('0x19'))['getLicense']()[_0x4add('0x23')](function(_0x561673){if(_0x561673){_0x10085c=_0x561673['custom'];}})[_0x4add('0x23')](function(){return db[_0x4add('0x3f')][_0x4add('0x59')](_0x3c84d1);})[_0x4add('0x23')](handleEntityNotFound(_0x2dc1fa,null))[_0x4add('0x23')](function(_0xaf9864){if(_0xaf9864){if(!_[_0x4add('0x7f')](_0xaf9864[_0x4add('0x75')])){if(fs[_0x4add('0x80')](path[_0x4add('0x7d')](config[_0x4add('0x7e')],'server/files/images/logos/',_0xaf9864[_0x4add('0x75')]))&&_0x10085c){_0x517df8=path[_0x4add('0x7d')](config[_0x4add('0x7e')],_0x4add('0x81'),_0xaf9864['sitepic']);}}return _0x2dc1fa[_0x4add('0x82')](_0x517df8);}})['catch'](handleError(_0x2dc1fa,null));};exports[_0x4add('0x83')]=function(_0x373fb9,_0x4b9871,_0x1a1969){var _0x104b70=path[_0x4add('0x7d')](config[_0x4add('0x7e')],'server/files/images/avatars/default_avatar.png');var _0xb0838a={'where':{'id':_0x373fb9[_0x4add('0x57')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db['ChatWebsite'][_0x4add('0x59')](_0xb0838a)[_0x4add('0x23')](handleEntityNotFound(_0x4b9871,null))['then'](function(_0x42dc62){if(_0x42dc62){if(!_[_0x4add('0x7f')](_0x42dc62[_0x4add('0x79')])){if(fs['existsSync'](path[_0x4add('0x7d')](config[_0x4add('0x7e')],_0x4add('0x84'),_0x42dc62[_0x4add('0x79')]))){_0x104b70=path['join'](config[_0x4add('0x7e')],_0x4add('0x84'),_0x42dc62[_0x4add('0x79')]);}}return _0x4b9871[_0x4add('0x82')](_0x104b70);}})[_0x4add('0x5a')](handleError(_0x4b9871,null));};exports[_0x4add('0x85')]=function(_0x4d4349,_0x11f438,_0xad69ac){var _0x239598=path['join'](config[_0x4add('0x7e')],'server/files/images/avatars/customer_avatar.png');var _0x585100={'where':{'id':_0x4d4349['params']['id']},'attributes':['id','customerAvatar',_0x4add('0x86')],'raw':!![]};return db[_0x4add('0x3f')][_0x4add('0x59')](_0x585100)[_0x4add('0x23')](handleEntityNotFound(_0x11f438,null))[_0x4add('0x23')](function(_0x2af3c3){if(_0x2af3c3){if(!_[_0x4add('0x7f')](_0x2af3c3['customerAvatar'])){if(fs[_0x4add('0x80')](path[_0x4add('0x7d')](config[_0x4add('0x7e')],'server/files/images/avatars/',_0x2af3c3[_0x4add('0x7b')]))&&_0x2af3c3['showCustomerAvatar']){_0x239598=path[_0x4add('0x7d')](config[_0x4add('0x7e')],_0x4add('0x84'),_0x2af3c3['customerAvatar']);}}return _0x11f438[_0x4add('0x82')](_0x239598);}})['catch'](handleError(_0x11f438,null));};exports[_0x4add('0x87')]=function(_0x3ad71d,_0x39edb5,_0x38c586){var _0x339415=path[_0x4add('0x7d')](config[_0x4add('0x7e')],_0x4add('0x88'));var _0x385229={'where':{'id':_0x3ad71d[_0x4add('0x57')]['id']},'attributes':['id',_0x4add('0x7c')],'raw':!![]};return db[_0x4add('0x3f')]['find'](_0x385229)[_0x4add('0x23')](handleEntityNotFound(_0x39edb5,null))[_0x4add('0x23')](function(_0xf67285){if(_0xf67285){if(!_[_0x4add('0x7f')](_0xf67285[_0x4add('0x7c')])){if(fs[_0x4add('0x80')](path[_0x4add('0x7d')](config[_0x4add('0x7e')],'server/files/images/avatars/',_0xf67285[_0x4add('0x7c')]))){_0x339415=path[_0x4add('0x7d')](config[_0x4add('0x7e')],_0x4add('0x84'),_0xf67285[_0x4add('0x7c')]);}}return _0x39edb5[_0x4add('0x82')](_0x339415);}})[_0x4add('0x5a')](handleError(_0x39edb5,null));};exports['notify']=function(_0x38dec5,_0x1cbe43,_0x2c891b){var _0x3e0b24=require('user-agent-parser');var _0x2152c9=new _0x3e0b24();var _0x995697=_0x2152c9[_0x4add('0x89')](_0x38dec5[_0x4add('0x8a')][_0x4add('0x8b')])[_0x4add('0x8c')]();var _0x5a0150={'body':_0x38dec5['body'],'channel':_0x4add('0x8d')};var _0x168dfe=[];var _0x5cc9bc=[];var _0x331c40={};var _0x3969c9=![];return db[_0x4add('0x8e')][_0x4add('0x65')]()[_0x4add('0x23')](function(_0x439e9c){if(!_0x439e9c){throw new db[(_0x4add('0x8f'))][(_0x4add('0x90'))]('no\x20available\x20attributes');}_0x168dfe=_[_0x4add('0x91')](_['keys'](_0x439e9c),[_0x4add('0x92'),_0x4add('0x93')]);_0x5cc9bc=_[_0x4add('0x91')](_[_0x4add('0x45')](_0x439e9c),['createdAt',_0x4add('0x93'),_0x4add('0x94'),_0x4add('0x95')]);if(_0x38dec5['body']['id']){delete _0x38dec5['body']['id'];}if(_[_0x4add('0x7f')](_0x38dec5['body'][_0x4add('0x96')])){throw new db[(_0x4add('0x8f'))]['ValidationError'](_0x4add('0x97'));}if(_[_0x4add('0x7f')](_0x38dec5['body']['body'])||_0x38dec5[_0x4add('0x5c')][_0x4add('0x5c')]===''){throw new db[(_0x4add('0x8f'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x4add('0x7f')](_0x38dec5[_0x4add('0x5c')][_0x4add('0x98')])){throw new db[(_0x4add('0x8f'))]['ValidationError'](_0x4add('0x99')+_0x5cc9bc);}if(!_[_0x4add('0x9a')](_0x5cc9bc,_0x38dec5['body'][_0x4add('0x98')])){throw new db['Sequelize'][(_0x4add('0x90'))](_0x4add('0x9b')+_0x5cc9bc);}_0x331c40[_0x38dec5[_0x4add('0x5c')][_0x4add('0x98')]]=_0x38dec5['body'][_0x4add('0x96')];})[_0x4add('0x23')](function(){return db[_0x4add('0x3f')][_0x4add('0x59')]({'where':{'id':_0x38dec5['params']['id']},'include':[{'model':db[_0x4add('0x9c')],'as':'List','include':[{'model':db['CmContact'],'as':_0x4add('0x9d'),'where':_0x331c40,'limit':0x1,'order':[['updatedAt',_0x4add('0x9e')]]}]},{'model':db[_0x4add('0x9f')],'as':_0x4add('0xa0')}]});})[_0x4add('0x23')](handleEntityNotFound(_0x1cbe43,null))[_0x4add('0x23')](function(_0x19b573){if(_0x19b573&&_0x19b573[_0x4add('0xa1')]){_0x5a0150[_0x4add('0xa2')]=_0x19b573;_0x5a0150[_0x4add('0xa3')]=_0x19b573[_0x4add('0xa0')];_0x5a0150[_0x4add('0xa4')]=_0x19b573['List'];_0x5a0150['applications']=_['orderBy'](_0x5a0150['applications'],['priority'],['asc']);if(_0x5a0150[_0x4add('0xa2')][_0x4add('0xa0')]){delete _0x5a0150[_0x4add('0xa2')][_0x4add('0xa0')];}if(_0x5a0150[_0x4add('0xa2')]['List']&&_0x5a0150[_0x4add('0xa2')][_0x4add('0xa1')][_0x4add('0x9d')][_0x4add('0x58')]){return _0x5a0150['account'][_0x4add('0xa1')][_0x4add('0x9d')][0x0];}var _0x25706c=_[_0x4add('0x1c')](_0x38dec5[_0x4add('0x5c')],{'firstName':_0x38dec5['body'][_0x4add('0x96')],'ListId':_0x19b573[_0x4add('0x95')]});_0x25706c[_0x38dec5['body'][_0x4add('0x98')]]=_0x38dec5[_0x4add('0x5c')][_0x4add('0x96')];return db[_0x4add('0x8e')][_0x4add('0x5b')](_0x25706c,{'fields':_0x168dfe,'raw':!![]});}})[_0x4add('0x23')](handleEntityNotFound(_0x1cbe43,null))[_0x4add('0x23')](function(_0x19f08d){_0x5a0150['contact']=_0x19f08d;var _0x14d282=_0x38dec5[_0x4add('0x5c')][_0x4add('0xa5')];if(_0x38dec5[_0x4add('0x8a')]['cf-connecting-ip']){_0x14d282=_0x38dec5[_0x4add('0x8a')][_0x4add('0xa6')];}else if(_0x38dec5['headers']['x-forwarded-for']){_0x14d282=_[_0x4add('0xa7')](_0x38dec5['headers'][_0x4add('0xa8')][_0x4add('0xa9')](','));}if(_0x19f08d){var _0x574b8d={'ContactId':_0x19f08d['id'],'ChatWebsiteId':_0x38dec5[_0x4add('0x57')]['id'],'from':(_0x19f08d[_0x4add('0xaa')]||'')+'\x20'+(_0x19f08d[_0x4add('0xab')]||''),'customerIp':_0x14d282,'customerPort':_0x38dec5['headers'][_0x4add('0xac')]?_0x38dec5[_0x4add('0x8a')][_0x4add('0xac')]:null,'referer':_0x38dec5[_0x4add('0x5c')]['referer'],'browserName':_0x995697[_0x4add('0xad')]['name']&&_0x995697[_0x4add('0xad')][_0x4add('0xae')]?util[_0x4add('0xaf')](_0x4add('0xb0'),_0x995697[_0x4add('0xad')][_0x4add('0x3b')],_0x995697['browser'][_0x4add('0xae')]):_0x4add('0xb1'),'browserVersion':_0x995697['browser'][_0x4add('0xae')]||_0x4add('0xb1'),'osName':util[_0x4add('0xaf')]('%s\x20%s',_0x995697['os'][_0x4add('0x3b')],_0x995697['os'][_0x4add('0xae')]),'osVersion':_0x995697['os']['version'],'deviceModel':_0x995697[_0x4add('0xb2')][_0x4add('0x44')]&&_0x995697[_0x4add('0xb2')][_0x4add('0xb3')]?util['format'](_0x4add('0xb4'),_0x995697[_0x4add('0xb2')][_0x4add('0x44')],_0x995697[_0x4add('0xb2')][_0x4add('0xb3')],_0x995697[_0x4add('0xb2')]['type']):null,'deviceVendor':_0x995697[_0x4add('0xb2')]['vendor'],'deviceType':_0x995697[_0x4add('0xb2')][_0x4add('0x42')],'formData':JSON[_0x4add('0xb5')](_0x38dec5['body'])};var _0x51d1d0={'ChatWebsiteId':_0x38dec5['params']['id'],'closed':![]};if(_0x38dec5[_0x4add('0x5c')][_0x4add('0xb6')]){_0x51d1d0['threadId']=_0x38dec5[_0x4add('0x5c')]['threadId'];return db[_0x4add('0xb7')]['find']({'where':_0x51d1d0})['then'](function(_0x339e28){if(_0x339e28){return[_0x339e28,![]];}_0x574b8d[_0x4add('0xb6')]=_0x38dec5[_0x4add('0x5c')][_0x4add('0xb6')];_0x574b8d[_0x4add('0xb8')]=_0x38dec5[_0x4add('0x5c')][_0x4add('0xb8')];return db[_0x4add('0xb7')][_0x4add('0x5b')](_0x574b8d)['then'](function(_0x58b10c){return[_0x58b10c,!![]];});});}_0x51d1d0[_0x4add('0xb9')]=_0x19f08d['id'];if(_0x38dec5[_0x4add('0x5c')]['interaction']&&_0x38dec5[_0x4add('0x5c')]['interaction']['id']){_0x51d1d0['id']=_0x38dec5['body'][_0x4add('0xba')]['id'];return db[_0x4add('0xb7')][_0x4add('0x59')]({'where':_0x51d1d0})[_0x4add('0x23')](function(_0x35bc1e){if(_0x35bc1e){return[_0x35bc1e,![]];}return db[_0x4add('0xb7')][_0x4add('0x5b')](_0x574b8d)[_0x4add('0x23')](function(_0x493cde){return[_0x493cde,!![]];});});}return db[_0x4add('0xb7')][_0x4add('0x5b')](_0x574b8d)[_0x4add('0x23')](function(_0x17d409){return[_0x17d409,!![]];});}})[_0x4add('0xbb')](function(_0x4619cc,_0x2019c9){if(_0x4619cc){_0x3969c9=_0x2019c9;if(!_0x2019c9){var _0x2f2649={'from':(_0x5a0150[_0x4add('0xbc')]['firstName']||'')+'\x20'+(_0x5a0150['contact'][_0x4add('0xab')]||'')};if(_0x38dec5[_0x4add('0x5c')][_0x4add('0xb6')]&&_0x38dec5['body'][_0x4add('0xbd')]&&_0x38dec5[_0x4add('0x5c')][_0x4add('0xb6')]!=_0x38dec5[_0x4add('0x5c')][_0x4add('0xbd')]){_0x2f2649['threadId']=_0x38dec5[_0x4add('0x5c')][_0x4add('0xbd')];}return _0x4619cc['update'](_0x2f2649);}else{return _0x4619cc;}}})['then'](function(_0x44953a){_0x5a0150[_0x4add('0xba')]=_0x44953a[_0x4add('0x37')]({'plain':!![]});_0x5a0150['interaction'][_0x4add('0xbe')]=_0x3969c9;if(_0x5a0150['interaction'][_0x4add('0xbe')]){if(_0x5a0150[_0x4add('0xa2')][_0x4add('0xbf')]){_0x5a0150[_0x4add('0xa3')][_0x4add('0xc0')]({'id':0x0,'priority':_0x5a0150['applications'][_0x4add('0x58')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x4add('0xc1')});}}return db['ChatMessage'][_0x4add('0x5b')]({'body':_0x38dec5[_0x4add('0x5c')][_0x4add('0x5c')],'ChatWebsiteId':_0x38dec5[_0x4add('0x57')]['id'],'ChatInteractionId':_0x44953a['id'],'direction':'in','ContactId':_0x5a0150['contact']['id'],'AttachmentId':_0x38dec5[_0x4add('0x5c')][_0x4add('0xc2')]});})[_0x4add('0x23')](function(_0x2732cc){_0x5a0150[_0x4add('0x2a')]=_0x2732cc;if(_0x5a0150['interaction'][_0x4add('0xc3')]){return db['User']['find']({'attributes':['id',_0x4add('0x3b')],'where':{'id':_0x5a0150[_0x4add('0xba')][_0x4add('0xc3')]}})['then'](function(_0x2aa186){if(_0x2aa186){_0x5a0150[_0x4add('0xa3')][_0x4add('0xc4')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x2aa186[_0x4add('0x3b')]+','+(_0x5a0150[_0x4add('0xa2')]['waitForTheAssignedAgent']||0xa),'interval':_0x4add('0xc1')});_0x5a0150[_0x4add('0xc5')]=!![];}return respondWithRpcPromise(_0x4add('0xc6'),_0x4add('0xc7'),_0x5a0150);});}return respondWithRpcPromise(_0x4add('0xc6'),_0x4add('0xc7'),_0x5a0150);})[_0x4add('0x23')](function(_0x512539){respondWithRpcPromise(_0x4add('0xc8'),_0x4add('0xc8'),{'event':_0x4add('0xc9'),'message':_0x512539},client9002);return _0x512539;})[_0x4add('0x23')](respondWithResult(_0x1cbe43,null))[_0x4add('0x5a')](handleError(_0x1cbe43,null));};exports[_0x4add('0xca')]=function(_0x582cce,_0x524c77,_0x5f106d){var _0x3b824b,_0x364f6d,_0x1b48b9;var _0x27ad05=[];var _0x2a9609=[];var _0x3fefd9={};var _0x2954b1=_0x582cce[_0x4add('0xcb')]||[];var _0x59d08f=[];var _0x57829d;return db['CmContact'][_0x4add('0x65')]()['then'](function(_0x26fe6a){if(!_0x26fe6a){throw new db[(_0x4add('0x8f'))]['ValidationError'](_0x4add('0xcc'));}_0x2a9609=_['difference'](_[_0x4add('0x45')](_0x26fe6a),[_0x4add('0x92'),'updatedAt']);_0x27ad05=_[_0x4add('0x91')](_['keys'](_0x26fe6a),[_0x4add('0x92'),_0x4add('0x93'),_0x4add('0x94'),_0x4add('0x95')]);if(_0x582cce[_0x4add('0x5c')]['id']){delete _0x582cce['body']['id'];}if(_[_0x4add('0x7f')](_0x582cce[_0x4add('0x5c')][_0x4add('0x96')])){throw _0x524c77[_0x4add('0x2d')](0x1f4)[_0x4add('0x3c')](new db['Sequelize'][(_0x4add('0x90'))](_0x4add('0x97')));}if(_['isNil'](_0x582cce[_0x4add('0x5c')][_0x4add('0x5c')])||_0x582cce[_0x4add('0x5c')][_0x4add('0x5c')]===''){throw _0x524c77['status'](0x1f4)['send'](new db['Sequelize'][(_0x4add('0x90'))](_0x4add('0xcd')));}if(_[_0x4add('0x7f')](_0x582cce[_0x4add('0x5c')]['mapKeyOffline'])){throw _0x524c77['status'](0x1f4)['send'](new db[(_0x4add('0x8f'))][(_0x4add('0x90'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x27ad05));}if(!_[_0x4add('0x9a')](_0x27ad05,_0x582cce[_0x4add('0x5c')][_0x4add('0xce')])){throw _0x524c77['status'](0x1f4)[_0x4add('0x3c')](new db[(_0x4add('0x8f'))]['ValidationError']('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x27ad05));}_0x3fefd9[_0x582cce['body'][_0x4add('0xce')]]=_0x582cce[_0x4add('0x5c')]['from'];})[_0x4add('0x23')](function(){return db[_0x4add('0x3f')][_0x4add('0x59')]({'where':{'id':_0x582cce[_0x4add('0x57')]['id']},'include':[{'model':db[_0x4add('0x9c')],'as':_0x4add('0xa1')},{'model':db['MailAccount'],'as':'MailAccount'}]});})[_0x4add('0x23')](handleEntityNotFound(_0x524c77,null))[_0x4add('0x23')](function(_0x37a4ab){if(_0x37a4ab&&_0x37a4ab[_0x4add('0xa1')]){_0x364f6d=_0x37a4ab;var _0x50fbf9=_[_0x4add('0x1c')](_0x582cce['body'],{'firstName':_0x582cce[_0x4add('0x5c')][_0x4add('0x96')],'phone':_0x582cce[_0x4add('0x5c')][_0x4add('0x96')],'ListId':_0x37a4ab[_0x4add('0x95')]});_0x50fbf9[_0x582cce[_0x4add('0x5c')][_0x4add('0xce')]]=_0x582cce['body'][_0x4add('0x96')];return db['CmContact'][_0x4add('0xcf')]({'where':_0x3fefd9,'defaults':_0x50fbf9});}})['spread'](function(_0x1ed0cf){if(_0x1ed0cf){_0x1b48b9=_0x1ed0cf;var _0x3fa542=fs['readFileSync'](path[_0x4add('0x7d')](config[_0x4add('0x7e')],_0x4add('0xd0')),_0x4add('0xd1'));var _0x38ae3d=ejs[_0x4add('0xd2')](_0x3fa542,{'body':_[_0x4add('0xd3')](_0x582cce[_0x4add('0x5c')][_0x4add('0x5c')]),'bodyTitle':_0x364f6d[_0x4add('0xd4')]});return db[_0x4add('0xd5')][_0x4add('0x5b')]({'body':_0x38ae3d,'ContactId':_0x1ed0cf['id'],'ChatWebsiteId':_0x364f6d['id']});}})['then'](function(_0xf94f1f){_0x57829d=_0xf94f1f;if(_0x2954b1[_0x4add('0x58')]){var _0x5548e4=_0x2954b1[_0x4add('0x4f')](function(_0x132671){return{'name':_0x132671[_0x4add('0xd6')],'basename':_0x132671['filename'],'type':_0x132671[_0x4add('0xd7')],'ChatOfflineMessageId':_0xf94f1f['id']};});_0x59d08f=_0x5548e4[_0x4add('0x4f')](_0x2bac54=>{var _0x564cc9={'filename':_0x2bac54['name'],'path':path[_0x4add('0x7d')](config[_0x4add('0x7e')],'server',_0x4add('0xcb'),_0x4add('0xd8'),_0x4add('0xd9'),_0x2bac54[_0x4add('0xda')])};return _0x564cc9;});if(!_0x364f6d[_0x4add('0xdb')]){return db[_0x4add('0xdc')][_0x4add('0xdd')](function(_0x180a43){return db[_0x4add('0xde')]['bulkCreate'](_0x5548e4,{'transaction':_0x180a43});});}}})[_0x4add('0x23')](function(){if(_0x57829d){_0x3b824b=_0x57829d;return db[_0x4add('0xdf')][_0x4add('0x6a')]({'where':{'active':!![]},'include':[{'model':db['MailServerOut'],'as':_0x4add('0xe0'),'raw':!![]}]});}})[_0x4add('0x23')](function(_0x423b04){if(_0x423b04&&_0x423b04[_0x4add('0xe0')]&&_0x364f6d['forwardOffline']&&_0x364f6d[_0x4add('0xe1')]){var _0x13b52a={'tls':{'rejectUnauthorized':![]}};if(_0x423b04['Smtp']['service']){_0x13b52a[_0x4add('0xe2')]=_0x423b04[_0x4add('0xe0')]['service'];}else{_0x13b52a[_0x4add('0xe3')]=_0x423b04[_0x4add('0xe0')]['host'];_0x13b52a[_0x4add('0xe4')]=_0x423b04[_0x4add('0xe0')][_0x4add('0xe4')];_0x13b52a['secure']=_0x423b04[_0x4add('0xe0')]['secure'];}if(_0x423b04['Smtp'][_0x4add('0xe5')]){_0x13b52a['auth']={'user':_0x423b04['Smtp'][_0x4add('0x5d')],'pass':_0x423b04[_0x4add('0xe0')][_0x4add('0xe6')]};}return respondWithRpcPromise('SendMail',_0x4add('0xe7'),{'account':_0x13b52a,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x423b04[_0x4add('0x3b')],_0x423b04[_0x4add('0xe8')]||_0x423b04[_0x4add('0xe0')][_0x4add('0x5d')]),'to':_0x364f6d[_0x4add('0xe1')],'subject':_0x364f6d['offlineMessageSubject'],'html':_0x3b824b['body'],'attachments':_0x59d08f}},client9003)[_0x4add('0x23')](function(){return _0x3b824b;})[_0x4add('0x5a')](function(_0x5e0444){console[_0x4add('0x29')](_0x5e0444);});}})[_0x4add('0x23')](function(){if(_0x364f6d&&_0x364f6d[_0x4add('0xdb')]&&_0x364f6d[_0x4add('0xe9')]){var _0x5613b1=[];if(_0x2954b1['length']){_0x5613b1=_0x2954b1[_0x4add('0x4f')](function(_0x57955b){return{'name':_0x57955b[_0x4add('0xd6')],'basename':_0x57955b[_0x4add('0x77')],'type':_0x57955b[_0x4add('0xd7')],'ChatOfflineMessageId':_0x57829d['id']};});}var _0x54b884;if(!_[_0x4add('0x7f')](_0x364f6d['subjectOffline'])){var _0x20d9fb=_[_0x4add('0x4f')](_0x582cce[_0x4add('0x5c')],function(_0x400600){return _0x400600;});var _0x138f29=_['toPairsIn'](_0x20d9fb)[0x0];var _0x36bd44=_[_0x4add('0xea')](_0x138f29,function(_0x469210){return _0x469210;});_0x54b884=_0x36bd44[0x1][_0x364f6d[_0x4add('0xeb')]];}var _0x1986d5={'from':_0x1b48b9[_0x4add('0xe8')],'firstName':_0x1b48b9[_0x4add('0xaa')],'lastName':_0x1b48b9[_0x4add('0xab')],'mapKey':_0x4add('0xe8'),'message':{'from':_0x1b48b9[_0x4add('0xe8')],'to':_0x364f6d[_0x4add('0xdf')][_0x4add('0xe8')],'cc':'','subject':_['isNil'](_0x54b884)?_0x364f6d[_0x4add('0xec')]:_0x54b884,'messageId':'','sentAt':new Date(),'attach':_0x5613b1['length'],'attachments':_0x5613b1,'originChannel':_0x4add('0xed'),'ChatWebsiteId':_0x364f6d['id'],'ChatOfflineMessageId':_0x3b824b['id'],'originTo':_0x364f6d[_0x4add('0xdf')][_0x4add('0xe8')]},'body':_0x3b824b[_0x4add('0x5c')]};var _0x410254={'account':{'id':_0x364f6d[_0x4add('0xe9')]},'body':_0x1986d5,'log':_0x4add('0xee')};return respondWithRpcPromise('NotifyMailAccount',_0x4add('0xef'),_0x410254,client9001)[_0x4add('0x23')](function(){return _0x3b824b;})[_0x4add('0x5a')](function(_0x133846){console[_0x4add('0x29')](_0x133846);});}return;})[_0x4add('0x23')](function(){if(_0x3b824b){return _0x3b824b;}})[_0x4add('0x23')](respondWithResult(_0x524c77,null))[_0x4add('0x5a')](function(_0x1fbc02){console[_0x4add('0x29')](_0x4add('0x5a'),_0x1fbc02);for(var _0x5e4501 of _0x2954b1){var _0x3e010b=path[_0x4add('0x7d')](config[_0x4add('0x7e')],_0x4add('0xf0'),_0x4add('0xcb'),_0x4add('0xd8'),_0x4add('0xd9'),_0x5e4501[_0x4add('0x77')]);fs_extra[_0x4add('0xf1')](_0x3e010b)['catch'](function(_0x1965a3){console[_0x4add('0x29')](_0x4add('0xf2'),_0x3e010b,_0x1965a3);});}});};exports[_0x4add('0xf3')]=function(_0x16071a,_0x413ff0,_0x62ca3d){return db[_0x4add('0xb7')][_0x4add('0x59')]({'where':{'id':_0x16071a[_0x4add('0x57')]['id']}})[_0x4add('0x23')](handleEntityNotFound(_0x413ff0,null))['then'](function(_0x5d08c3){if(_0x5d08c3){return _0x5d08c3[_0x4add('0xf3')](_0x16071a[_0x4add('0x5c')][_0x4add('0xf4')],_[_0x4add('0xf5')](_0x16071a[_0x4add('0x5c')],[_0x4add('0xf4'),'id'])||{});}})[_0x4add('0x23')](respondWithResult(_0x413ff0,null))[_0x4add('0x5a')](handleError(_0x413ff0,null));};exports[_0x4add('0xf6')]=function(_0x21fe08,_0x3069a7,_0x3f9fb6){var _0x1cf852={'raw':![],'where':{}};var _0x59fe65={};var _0x314586={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x4add('0x6a')]({'where':{'id':_0x21fe08[_0x4add('0x57')]['id']}})[_0x4add('0x23')](handleEntityNotFound(_0x3069a7,null))[_0x4add('0x23')](function(_0x2489e7){if(_0x2489e7){_0x59fe65[_0x4add('0x44')]=_[_0x4add('0x45')](db[_0x4add('0xb7')]['rawAttributes']);_0x59fe65['query']=_[_0x4add('0x45')](_0x21fe08[_0x4add('0x46')]);_0x59fe65['filters']=_['intersection'](_0x59fe65[_0x4add('0x44')],_0x59fe65['query']);_0x1cf852['attributes']=_[_0x4add('0x48')](_0x59fe65['model'],qs[_0x4add('0x49')](_0x21fe08[_0x4add('0x46')][_0x4add('0x49')]));_0x1cf852[_0x4add('0x4a')]=_0x1cf852[_0x4add('0x4a')][_0x4add('0x58')]?_0x1cf852[_0x4add('0x4a')]:_0x59fe65[_0x4add('0x44')];if(!_0x21fe08[_0x4add('0x46')][_0x4add('0x6b')](_0x4add('0x4b'))){_0x1cf852[_0x4add('0x32')]=qs[_0x4add('0x32')](_0x21fe08[_0x4add('0x46')]['limit']);_0x1cf852[_0x4add('0x2f')]=qs['offset'](_0x21fe08[_0x4add('0x46')][_0x4add('0x2f')]);}_0x1cf852['order']=qs[_0x4add('0x4c')](_0x21fe08[_0x4add('0x46')]['sort']);_0x1cf852[_0x4add('0x4e')]=qs[_0x4add('0x47')](_[_0x4add('0x6d')](_0x21fe08[_0x4add('0x46')],_0x59fe65['filters']));_0x1cf852['where'][_0x4add('0x67')]=_0x2489e7['id'];if(_0x21fe08[_0x4add('0x46')][_0x4add('0x4d')]){_0x1cf852['where']=_[_0x4add('0x51')](_0x1cf852[_0x4add('0x4e')],{'$or':_[_0x4add('0x4f')](_0x1cf852['attributes'],function(_0x213386){var _0x31aef5={};_0x31aef5[_0x213386]={'$like':'%'+_0x21fe08['query']['filter']+'%'};return _0x31aef5;})});}_0x1cf852=_[_0x4add('0x51')]({},_0x1cf852,_0x21fe08[_0x4add('0x52')]);return db['ChatInteraction'][_0x4add('0x31')]({'where':_0x1cf852[_0x4add('0x4e')]})[_0x4add('0x23')](function(_0x5862dc){_0x314586[_0x4add('0x31')]=_0x5862dc;if(_0x21fe08[_0x4add('0x46')][_0x4add('0x53')]){_0x1cf852[_0x4add('0x54')]=[{'model':db[_0x4add('0x8e')],'as':_0x4add('0xf7'),'required':![]},{'model':db[_0x4add('0xf8')],'as':_0x4add('0xf9'),'attributes':[_0x4add('0x3b'),_0x4add('0xfa'),_0x4add('0xfb')],'required':![]},{'model':db[_0x4add('0xfc')],'as':'Tags','attributes':['id',_0x4add('0x3b'),'color'],'where':_0x21fe08['query'][_0x4add('0xfd')]?{'id':_0x21fe08[_0x4add('0x46')]['tag']}:undefined,'required':_0x21fe08[_0x4add('0x46')][_0x4add('0xfd')]?!![]:![]}];}return db[_0x4add('0xb7')][_0x4add('0x55')](_0x1cf852);})[_0x4add('0x23')](function(_0x209550){_0x314586[_0x4add('0x72')]=_0x209550;return _0x314586;});}})[_0x4add('0x23')](respondWithFilteredResult(_0x3069a7,_0x1cf852))['catch'](handleError(_0x3069a7,null));};function iftimePromise(_0xfaada6,_0x4b52db){return respondWithRpcPromise(_0x4add('0xfe'),'getSnippet',{'command':_0x4b52db['timezone']?util['format']('iftime\x20%s,%s',_0xfaada6[_0x4add('0xff')],_0x4b52db[_0x4add('0x100')]):util['format'](_0x4add('0x101'),_0xfaada6[_0x4add('0xff')])},client9002)['then'](function(_0xeabea1){var _0x559d46=_0xeabea1&&_0xeabea1[_0x4add('0x102')](_0x4add('0x103'))>=0x0?!![]:![];logger['info'](_0x4add('0x104'),_0x4b52db['id'],_0xfaada6['id'],_0xfaada6[_0x4add('0xff')],_0x559d46?_0x4add('0x105'):'OFFLINE',_0x4b52db['timezone']?_0x4b52db[_0x4add('0x100')]:_0x4add('0x106'));return _0x559d46;})[_0x4add('0x5a')](function(_0xf4479a){logger[_0x4add('0x29')](_0x4add('0x104'),_0x4b52db['id'],_0xfaada6['id'],_0xfaada6[_0x4add('0xff')],util[_0x4add('0x107')](_0xf4479a,{'showHidden':![],'depth':null}),_0x4b52db[_0x4add('0x100')]?_0x4b52db[_0x4add('0x100')]:'No\x20timezone');return![];});}exports[_0x4add('0x108')]=function(_0x142b29,_0x509b70,_0x53c6e2){var _0x2bce66=0x0;var _0x36b97c=0x0;var _0x45fba2=![];var _0x1ce64e;var _0x5c6e6d;return db[_0x4add('0x3f')][_0x4add('0x59')]({'where':{'id':_0x142b29[_0x4add('0x57')]['id']},'include':[{'model':db['Interval'],'as':'Interval','include':[{'model':db['Interval'],'as':_0x4add('0x109'),'attributes':['id','interval'],'raw':!![]}]}]})[_0x4add('0x23')](handleEntityNotFound(_0x509b70,null))[_0x4add('0x23')](function(_0x5969f6){if(_0x5969f6){_0x1ce64e=_0x5969f6;return _0x5969f6[_0x4add('0x10a')]({'raw':!![]});}})['then'](function(_0x4170ff){if(_0x1ce64e){if(_0x4170ff){_0x5c6e6d=_0x4170ff;}}return require(_0x4add('0x19'))[_0x4add('0x10b')]();})[_0x4add('0x23')](function(_0x8a3b91){if(_0x8a3b91){_0x36b97c=_0x8a3b91[_0x4add('0x10c')];_0x45fba2=_0x8a3b91[_0x4add('0x10d')];}})[_0x4add('0x23')](function(){return db['ChatInteraction']['count']({'where':{'closed':![]}});})[_0x4add('0x23')](function(_0x3032a5){_0x2bce66=_0x3032a5;if(_0x36b97c&&_0x3032a5>_0x36b97c){return db[_0x4add('0x10e')][_0x4add('0x6a')]({'where':{'id':0x1}})[_0x4add('0x23')](function(_0x2a1f28){if(_0x2a1f28){_0x2a1f28[_0x4add('0x10f')](_0x4add('0x110'));}});}})[_0x4add('0x23')](function(){if(_0x1ce64e['Interval']&&_0x1ce64e[_0x4add('0x111')][_0x4add('0x109')]){var _0x21a58e=[];for(var _0x1cc67b=0x0;_0x1cc67b<_0x1ce64e[_0x4add('0x111')][_0x4add('0x109')][_0x4add('0x58')];_0x1cc67b++){var _0x368cb8=_0x1ce64e[_0x4add('0x111')][_0x4add('0x109')][_0x1cc67b][_0x4add('0x37')]({'plain':!![]});_0x21a58e[_0x4add('0xc0')](iftimePromise(_0x368cb8,_0x1ce64e));}return BPromise[_0x4add('0x112')](_0x21a58e)['then'](function(_0x9a36ef){return _[_0x4add('0x113')](_0x9a36ef);});}else{return!![];}})[_0x4add('0x23')](function(_0x540cee){var _0x58baa2=fs['readFileSync'](path[_0x4add('0x7d')](config[_0x4add('0x7e')],_0x4add('0x114')),_0x4add('0xd1'));var _0x317d0a={'remote':_0x1ce64e[_0x4add('0x115')],'query':querystring[_0x4add('0xb5')](_[_0x4add('0x51')](_0x1ce64e[_0x4add('0x37')]({'plain':!![]}),{'customerIp':_0x142b29[_0x4add('0x8a')][_0x4add('0xa8')]||_0x142b29[_0x4add('0x8a')][_0x4add('0x116')]||_0x142b29[_0x4add('0x117')][_0x4add('0x118')]||_0x142b29['ip'],'referer':_0x142b29[_0x4add('0x8a')][_0x4add('0x119')],'openedInteractions':_0x2bce66,'maxInteractions':_0x36b97c,'virtual':_0x45fba2[_0x4add('0x10c')],'online':_0x540cee,'custom':_0x45fba2}))[_0x4add('0x11a')](/'/g,'\x5c\x27')};_0x509b70[_0x4add('0x3c')](ejs[_0x4add('0xd2')](Mustache[_0x4add('0xd2')](_0x58baa2,_0x317d0a),{'proactiveActions':_0x5c6e6d,'alignment':_0x1ce64e[_0x4add('0x11b')],'verticalAlignment':_0x1ce64e[_0x4add('0x11c')],'div_color':_0x1ce64e[_0x4add('0x11d')],'text_color':_0x1ce64e[_0x4add('0x11e')],'button_color':_0x1ce64e[_0x4add('0x11f')],'background_color':_0x1ce64e[_0x4add('0x120')]}));})[_0x4add('0x5a')](handleError(_0x509b70,null));};exports['addApplications']=function(_0x4921f8,_0x3321b0,_0x25d3fa){return db['ChatWebsite'][_0x4add('0x6a')]({'where':{'id':_0x4921f8[_0x4add('0x57')]['id']}})[_0x4add('0x23')](handleEntityNotFound(_0x3321b0,null))[_0x4add('0x23')](function(_0x2ab334){if(_0x2ab334){return db['sequelize']['transaction'](function(_0x14a0a9){return db[_0x4add('0x9f')][_0x4add('0x36')]({'where':{'ChatWebsiteId':_0x4921f8['params']['id']},'transaction':_0x14a0a9})[_0x4add('0x23')](function(_0x388f0c){var _0x11306b=_[_0x4add('0x4f')](_0x4921f8[_0x4add('0x5c')],function(_0x249ec4){_0x249ec4[_0x4add('0x67')]=_0x4921f8[_0x4add('0x57')]['id'];return _0x249ec4;});return db[_0x4add('0x9f')][_0x4add('0x121')](_0x11306b,{'transaction':_0x14a0a9});});})['then'](function(){return db[_0x4add('0x9f')][_0x4add('0x122')]({'where':{'ChatWebsiteId':_0x4921f8[_0x4add('0x57')]['id']},'order':_0x4add('0x123')});});}})[_0x4add('0x23')](respondWithResult(_0x3321b0,null))[_0x4add('0x5a')](handleError(_0x3321b0,null));};exports['getApplications']=function(_0x2bfa05,_0x2afcec,_0x5244bc){var _0x566147={};var _0x10375c={};var _0x3331f4;var _0x3a4dd8;return db['ChatWebsite']['findOne']({'where':{'id':_0x2bfa05[_0x4add('0x57')]['id']}})[_0x4add('0x23')](handleEntityNotFound(_0x2afcec,null))['then'](function(_0x458f35){if(_0x458f35){_0x3331f4=_0x458f35;_0x10375c['model']=_[_0x4add('0x45')](db['ChatApplication'][_0x4add('0x40')]);_0x10375c['query']=_['keys'](_0x2bfa05[_0x4add('0x46')]);_0x10375c['filters']=_[_0x4add('0x48')](_0x10375c['model'],_0x10375c[_0x4add('0x46')]);_0x566147[_0x4add('0x4a')]=_['intersection'](_0x10375c[_0x4add('0x44')],qs['fields'](_0x2bfa05[_0x4add('0x46')][_0x4add('0x49')]));_0x566147[_0x4add('0x4a')]=_0x566147['attributes']['length']?_0x566147[_0x4add('0x4a')]:_0x10375c[_0x4add('0x44')];_0x566147['order']=qs[_0x4add('0x4c')](_0x2bfa05[_0x4add('0x46')][_0x4add('0x4c')]);_0x566147[_0x4add('0x4e')]=qs[_0x4add('0x47')](_[_0x4add('0x6d')](_0x2bfa05['query'],_0x10375c[_0x4add('0x47')]));if(_0x2bfa05[_0x4add('0x46')]['filter']){_0x566147[_0x4add('0x4e')]=_[_0x4add('0x51')](_0x566147[_0x4add('0x4e')],{'$or':_[_0x4add('0x4f')](_0x566147['attributes'],function(_0x484972){var _0x453e42={};_0x453e42[_0x484972]={'$like':'%'+_0x2bfa05[_0x4add('0x46')][_0x4add('0x4d')]+'%'};return _0x453e42;})});}_0x566147=_[_0x4add('0x51')]({},_0x566147,_0x2bfa05['options']);return _0x3331f4[_0x4add('0x124')](_0x566147);}})[_0x4add('0x23')](function(_0x4239d3){if(_0x4239d3){_0x3a4dd8=_0x4239d3['length'];if(!_0x2bfa05[_0x4add('0x46')][_0x4add('0x6b')](_0x4add('0x4b'))){_0x566147[_0x4add('0x32')]=qs['limit'](_0x2bfa05[_0x4add('0x46')][_0x4add('0x32')]);_0x566147[_0x4add('0x2f')]=qs[_0x4add('0x2f')](_0x2bfa05[_0x4add('0x46')]['offset']);}return _0x3331f4[_0x4add('0x124')](_0x566147);}})[_0x4add('0x23')](function(_0x6c7647){if(_0x6c7647){return _0x6c7647?{'count':_0x3a4dd8,'rows':_0x6c7647}:null;}})[_0x4add('0x23')](respondWithResult(_0x2afcec,null))[_0x4add('0x5a')](handleError(_0x2afcec,null));};exports[_0x4add('0x125')]=function(_0x40b05e,_0x4b2b27,_0x3a9775){return db[_0x4add('0x126')][_0x4add('0x59')]({'where':{'id':_0x40b05e[_0x4add('0x57')]['id']}})[_0x4add('0x23')](handleEntityNotFound(_0x4b2b27,null))[_0x4add('0x23')](function(_0x58cae6){if(_0x58cae6){return _0x58cae6[_0x4add('0x125')](_0x40b05e[_0x4add('0x5c')][_0x4add('0xf4')],_[_0x4add('0xf5')](_0x40b05e[_0x4add('0x5c')],[_0x4add('0xf4'),'id'])||{});}})[_0x4add('0x23')](respondWithResult(_0x4b2b27,null))['catch'](handleError(_0x4b2b27,null));};exports['getProactiveActions']=function(_0x4f6574,_0x37163b,_0x111968){var _0x2f0874={};var _0x34d4f3={};var _0x35b5ad;var _0x1b6973;return db[_0x4add('0x3f')][_0x4add('0x6a')]({'where':{'id':_0x4f6574[_0x4add('0x57')]['id']}})[_0x4add('0x23')](handleEntityNotFound(_0x37163b,null))[_0x4add('0x23')](function(_0x1bad4d){if(_0x1bad4d){_0x35b5ad=_0x1bad4d;_0x34d4f3[_0x4add('0x44')]=_[_0x4add('0x45')](db[_0x4add('0x127')]['rawAttributes']);_0x34d4f3[_0x4add('0x46')]=_[_0x4add('0x45')](_0x4f6574['query']);_0x34d4f3[_0x4add('0x47')]=_[_0x4add('0x48')](_0x34d4f3[_0x4add('0x44')],_0x34d4f3[_0x4add('0x46')]);_0x2f0874[_0x4add('0x4a')]=_[_0x4add('0x48')](_0x34d4f3[_0x4add('0x44')],qs[_0x4add('0x49')](_0x4f6574[_0x4add('0x46')]['fields']));_0x2f0874[_0x4add('0x4a')]=_0x2f0874[_0x4add('0x4a')][_0x4add('0x58')]?_0x2f0874[_0x4add('0x4a')]:_0x34d4f3[_0x4add('0x44')];_0x2f0874['order']=qs[_0x4add('0x4c')](_0x4f6574[_0x4add('0x46')][_0x4add('0x4c')]);_0x2f0874[_0x4add('0x4e')]=qs[_0x4add('0x47')](_[_0x4add('0x6d')](_0x4f6574[_0x4add('0x46')],_0x34d4f3[_0x4add('0x47')]));if(_0x4f6574[_0x4add('0x46')][_0x4add('0x4d')]){_0x2f0874['where']=_[_0x4add('0x51')](_0x2f0874[_0x4add('0x4e')],{'$or':_[_0x4add('0x4f')](_0x2f0874['attributes'],function(_0x151e03){var _0x108b1f={};_0x108b1f[_0x151e03]={'$like':'%'+_0x4f6574[_0x4add('0x46')]['filter']+'%'};return _0x108b1f;})});}_0x2f0874=_[_0x4add('0x51')]({},_0x2f0874,_0x4f6574[_0x4add('0x52')]);return _0x35b5ad[_0x4add('0x10a')](_0x2f0874);}})['then'](function(_0x2ddc0b){if(_0x2ddc0b){_0x1b6973=_0x2ddc0b[_0x4add('0x58')];if(!_0x4f6574[_0x4add('0x46')][_0x4add('0x6b')](_0x4add('0x4b'))){_0x2f0874['limit']=qs[_0x4add('0x32')](_0x4f6574['query']['limit']);_0x2f0874['offset']=qs[_0x4add('0x2f')](_0x4f6574[_0x4add('0x46')][_0x4add('0x2f')]);}return _0x35b5ad[_0x4add('0x10a')](_0x2f0874);}})[_0x4add('0x23')](function(_0x555b99){if(_0x555b99){return _0x555b99?{'count':_0x1b6973,'rows':_0x555b99}:null;}})[_0x4add('0x23')](respondWithResult(_0x37163b,null))[_0x4add('0x5a')](handleError(_0x37163b,null));};exports[_0x4add('0x128')]=function(_0x55eb63,_0x48e970,_0xc41f41){var _0x2b4ad9=_0x55eb63[_0x4add('0x46')]['online']===_0x4add('0x129')?_0x4add('0x12a'):'onlineForm';return db[_0x4add('0x3f')][_0x4add('0x59')]({'attributes':['id',_0x2b4ad9],'where':{'id':_0x55eb63['params']['id']}})[_0x4add('0x23')](handleEntityNotFound(_0x48e970,null))['then'](function(_0x2704b0){if(_0x2704b0){var _0x3e7bb8=_0x2704b0[_0x2b4ad9];var _0xecfc41=_0x3e7bb8&&_0x3e7bb8[_0x4add('0x12b')]?_0x3e7bb8['items']:[];_0x48e970[_0x4add('0x3c')]({'fromKey':_[_0x4add('0x7f')](_0x3e7bb8['fromKey'])?undefined:_0x3e7bb8[_0x4add('0x12c')],'count':_0xecfc41['length'],'rows':_0xecfc41});}})[_0x4add('0x5a')](handleError(_0x48e970,null));};exports[_0x4add('0x12d')]=function(_0x55dcc6,_0x41626b,_0x1d060a){var _0x196a5e={'raw':![],'where':{}};var _0x168058={};var _0x9f192d={'count':0x0,'rows':[]};return db[_0x4add('0x3f')][_0x4add('0x6a')]({'where':{'id':_0x55dcc6[_0x4add('0x57')]['id']}})[_0x4add('0x23')](handleEntityNotFound(_0x41626b,null))[_0x4add('0x23')](function(_0x2ca2bc){if(_0x2ca2bc){_0x168058[_0x4add('0x44')]=_[_0x4add('0x45')](db['ChatOfflineMessage'][_0x4add('0x40')]);_0x168058[_0x4add('0x46')]=_['keys'](_0x55dcc6['query']);_0x168058[_0x4add('0x47')]=_[_0x4add('0x48')](_0x168058['model'],_0x168058[_0x4add('0x46')]);_0x196a5e[_0x4add('0x4a')]=_['intersection'](_0x168058['model'],qs[_0x4add('0x49')](_0x55dcc6[_0x4add('0x46')][_0x4add('0x49')]));_0x196a5e[_0x4add('0x4a')]=_0x196a5e['attributes'][_0x4add('0x58')]?_0x196a5e[_0x4add('0x4a')]:_0x168058['model'];if(!_0x55dcc6[_0x4add('0x46')][_0x4add('0x6b')](_0x4add('0x4b'))){_0x196a5e['limit']=qs[_0x4add('0x32')](_0x55dcc6[_0x4add('0x46')]['limit']);_0x196a5e[_0x4add('0x2f')]=qs[_0x4add('0x2f')](_0x55dcc6['query']['offset']);}_0x196a5e['order']=qs[_0x4add('0x4c')](_0x55dcc6[_0x4add('0x46')][_0x4add('0x4c')]);_0x196a5e[_0x4add('0x4e')]=qs[_0x4add('0x47')](_['pick'](_0x55dcc6[_0x4add('0x46')],_0x168058[_0x4add('0x47')]));_0x196a5e[_0x4add('0x4e')][_0x4add('0x67')]=_0x2ca2bc['id'];if(_0x55dcc6['query'][_0x4add('0x4d')]){_0x196a5e[_0x4add('0x4e')]=_[_0x4add('0x51')](_0x196a5e[_0x4add('0x4e')],{'$or':_[_0x4add('0x4f')](_0x196a5e['attributes'],function(_0x4c7521){var _0x522348={};_0x522348[_0x4c7521]={'$like':'%'+_0x55dcc6[_0x4add('0x46')][_0x4add('0x4d')]+'%'};return _0x522348;})});}_0x196a5e=_[_0x4add('0x51')]({},_0x196a5e,_0x55dcc6['options']);return db[_0x4add('0xd5')][_0x4add('0x31')]({'where':_0x196a5e[_0x4add('0x4e')]})[_0x4add('0x23')](function(_0x1ccafd){_0x9f192d[_0x4add('0x31')]=_0x1ccafd;if(_0x55dcc6['query'][_0x4add('0x53')]){_0x196a5e[_0x4add('0x54')]=[{'all':!![]}];}else{_0x196a5e[_0x4add('0x54')]=[{'model':db[_0x4add('0x8e')],'as':'Contact','required':![]},{'model':db[_0x4add('0xde')],'as':_0x4add('0x12e'),'required':![]}];}return db[_0x4add('0xd5')][_0x4add('0x55')](_0x196a5e);})[_0x4add('0x23')](function(_0x23284c){_0x9f192d[_0x4add('0x72')]=_0x23284c;return _0x9f192d;});}})[_0x4add('0x23')](respondWithFilteredResult(_0x41626b,_0x196a5e))['catch'](handleError(_0x41626b,null));};exports[_0x4add('0x12f')]=function(_0x49a89b,_0x214cbd,_0x379af6){return db[_0x4add('0x3f')][_0x4add('0x59')]({'where':{'id':_0x49a89b[_0x4add('0x57')]['id']}})[_0x4add('0x23')](handleEntityNotFound(_0x214cbd,null))[_0x4add('0x23')](function(_0xaf5cdc){if(_0xaf5cdc){return _0xaf5cdc[_0x4add('0x12f')](_0x49a89b['body'][_0x4add('0xf4')],_[_0x4add('0xf5')](_0x49a89b['body'],[_0x4add('0xf4'),'id'])||{})['spread'](function(_0x46f35c){for(var _0x5c9988=0x0;_0x5c9988<_0x49a89b['body'][_0x4add('0xf4')][_0x4add('0x58')];_0x5c9988+=0x1){socket[_0x4add('0x130')](_0x4add('0x131'),{'UserId':Number(_0x49a89b[_0x4add('0x5c')][_0x4add('0xf4')][_0x5c9988]),'ChatWebsiteId':Number(_0x49a89b[_0x4add('0x57')]['id'])});}return _0x46f35c;});}})[_0x4add('0x23')](respondWithResult(_0x214cbd,null))[_0x4add('0x5a')](handleError(_0x214cbd,null));};exports[_0x4add('0x132')]=function(_0x5ab8d0,_0x1dc37f,_0x203a05){return db[_0x4add('0x3f')][_0x4add('0x59')]({'where':{'id':_0x5ab8d0[_0x4add('0x57')]['id']}})[_0x4add('0x23')](handleEntityNotFound(_0x1dc37f,null))['then'](function(_0xbf48f1){if(_0xbf48f1){return _0xbf48f1['removeAgents'](_0x5ab8d0['query'][_0x4add('0xf4')])[_0x4add('0x23')](function(){if(_[_0x4add('0x133')](_0x5ab8d0[_0x4add('0x46')][_0x4add('0xf4')])){for(var _0x12c275=0x0;_0x12c275<_0x5ab8d0[_0x4add('0x46')][_0x4add('0xf4')][_0x4add('0x58')];_0x12c275+=0x1){socket[_0x4add('0x130')](_0x4add('0x134'),{'UserId':Number(_0x5ab8d0[_0x4add('0x46')][_0x4add('0xf4')][_0x12c275]),'ChatWebsiteId':Number(_0x5ab8d0['params']['id'])});}}else{socket[_0x4add('0x130')](_0x4add('0x134'),{'UserId':Number(_0x5ab8d0[_0x4add('0x46')][_0x4add('0xf4')]),'ChatWebsiteId':Number(_0x5ab8d0['params']['id'])});}});}})[_0x4add('0x23')](respondWithStatusCode(_0x1dc37f,null))['catch'](handleError(_0x1dc37f,null));};exports[_0x4add('0x135')]=function(_0x4ca47a,_0x4ca917,_0xb166d5){var _0x42b640={};var _0x5bc2dc={};var _0x684b3f;var _0x52a17b;return db[_0x4add('0x3f')]['findOne']({'where':{'id':_0x4ca47a[_0x4add('0x57')]['id']}})[_0x4add('0x23')](handleEntityNotFound(_0x4ca917,null))['then'](function(_0x18a5d3){if(_0x18a5d3){_0x684b3f=_0x18a5d3;_0x5bc2dc[_0x4add('0x44')]=_['keys'](db[_0x4add('0xf8')][_0x4add('0x40')]);_0x5bc2dc[_0x4add('0x46')]=_[_0x4add('0x45')](_0x4ca47a[_0x4add('0x46')]);_0x5bc2dc[_0x4add('0x47')]=_[_0x4add('0x48')](_0x5bc2dc['model'],_0x5bc2dc[_0x4add('0x46')]);_0x42b640[_0x4add('0x4a')]=_[_0x4add('0x48')](_0x5bc2dc[_0x4add('0x44')],qs['fields'](_0x4ca47a[_0x4add('0x46')][_0x4add('0x49')]));_0x42b640[_0x4add('0x4a')]=_0x42b640[_0x4add('0x4a')][_0x4add('0x58')]?_0x42b640[_0x4add('0x4a')]:_0x5bc2dc[_0x4add('0x44')];_0x42b640[_0x4add('0x6c')]=qs[_0x4add('0x4c')](_0x4ca47a[_0x4add('0x46')][_0x4add('0x4c')]);_0x42b640[_0x4add('0x4e')]=qs['filters'](_[_0x4add('0x6d')](_0x4ca47a['query'],_0x5bc2dc[_0x4add('0x47')]));if(_0x4ca47a[_0x4add('0x46')]['filter']){_0x42b640[_0x4add('0x4e')]=_[_0x4add('0x51')](_0x42b640[_0x4add('0x4e')],{'$or':_[_0x4add('0x4f')](_0x42b640[_0x4add('0x4a')],function(_0x2c1a16){var _0x39fc2a={};_0x39fc2a[_0x2c1a16]={'$like':'%'+_0x4ca47a['query'][_0x4add('0x4d')]+'%'};return _0x39fc2a;})});}_0x42b640=_[_0x4add('0x51')]({},_0x42b640,_0x4ca47a[_0x4add('0x52')]);return _0x684b3f[_0x4add('0x135')](_0x42b640);}})[_0x4add('0x23')](function(_0x26c004){if(_0x26c004){_0x52a17b=_0x26c004['length'];if(!_0x4ca47a[_0x4add('0x46')]['hasOwnProperty']('nolimit')){_0x42b640[_0x4add('0x32')]=qs['limit'](_0x4ca47a['query'][_0x4add('0x32')]);_0x42b640[_0x4add('0x2f')]=qs[_0x4add('0x2f')](_0x4ca47a[_0x4add('0x46')][_0x4add('0x2f')]);}return _0x684b3f[_0x4add('0x135')](_0x42b640);}})[_0x4add('0x23')](function(_0x286721){if(_0x286721){return _0x286721?{'count':_0x52a17b,'rows':_0x286721}:null;}})['then'](respondWithResult(_0x4ca917,null))[_0x4add('0x5a')](handleError(_0x4ca917,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index ac517ac..8b9ea93 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 _0xef39=['hook','exports','../../mysqldb','ChatWebsite','setMaxListeners','save','update','remove','emit'];(function(_0x586c70,_0x4a8cb3){var _0x26db79=function(_0xbfa842){while(--_0xbfa842){_0x586c70['push'](_0x586c70['shift']());}};_0x26db79(++_0x4a8cb3);}(_0xef39,0x92));var _0x9ef3=function(_0x2bcc6c,_0x4f54af){_0x2bcc6c=_0x2bcc6c-0x0;var _0x37c9ac=_0xef39[_0x2bcc6c];return _0x37c9ac;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0x9ef3('0x0'))['db'][_0x9ef3('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x9ef3('0x2')](0x0);var events={'afterCreate':_0x9ef3('0x3'),'afterUpdate':_0x9ef3('0x4'),'afterDestroy':_0x9ef3('0x5')};function emitEvent(_0x15e14e){return function(_0x162196,_0x2c4541,_0x2e1afa){ChatWebsiteEvents[_0x9ef3('0x6')](_0x15e14e+':'+_0x162196['id'],_0x162196);ChatWebsiteEvents[_0x9ef3('0x6')](_0x15e14e,_0x162196);_0x2e1afa(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x9ef3('0x7')](e,emitEvent(event));}}module[_0x9ef3('0x8')]=ChatWebsiteEvents; \ No newline at end of file +var _0x8ccb=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x132558,_0x521d93){var _0x34f138=function(_0x3e3541){while(--_0x3e3541){_0x132558['push'](_0x132558['shift']());}};_0x34f138(++_0x521d93);}(_0x8ccb,0x1c4));var _0xb8cc=function(_0x244862,_0x3da79e){_0x244862=_0x244862-0x0;var _0x2bce23=_0x8ccb[_0x244862];return _0x2bce23;};'use strict';var EventEmitter=require(_0xb8cc('0x0'));var ChatWebsite=require(_0xb8cc('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xb8cc('0x2')](0x0);var events={'afterCreate':_0xb8cc('0x3'),'afterUpdate':_0xb8cc('0x4'),'afterDestroy':_0xb8cc('0x5')};function emitEvent(_0x5ede44){return function(_0x4e1ed7,_0x115fdc,_0x3672bc){ChatWebsiteEvents[_0xb8cc('0x6')](_0x5ede44+':'+_0x4e1ed7['id'],_0x4e1ed7);ChatWebsiteEvents['emit'](_0x5ede44,_0x4e1ed7);_0x3672bc(null);};}for(var e in events){if(events[_0xb8cc('0x7')](e)){var event=events[e];ChatWebsite[_0xb8cc('0x8')](e,emitEvent(event));}}module[_0xb8cc('0x9')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index ad87c73..6157e92 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 _0x4a7c=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatWebsite.attributes','exports','chat_websites','lodash','util','../../config/logger'];(function(_0x188cc8,_0xd39746){var _0x4cb155=function(_0x2d2a6c){while(--_0x2d2a6c){_0x188cc8['push'](_0x188cc8['shift']());}};_0x4cb155(++_0xd39746);}(_0x4a7c,0x129));var _0xc4a7=function(_0x25184c,_0x31c137){_0x25184c=_0x25184c-0x0;var _0x10ea3f=_0x4a7c[_0x25184c];return _0x10ea3f;};'use strict';var _=require(_0xc4a7('0x0'));var util=require(_0xc4a7('0x1'));var logger=require(_0xc4a7('0x2'))(_0xc4a7('0x3'));var moment=require(_0xc4a7('0x4'));var BPromise=require(_0xc4a7('0x5'));var rp=require(_0xc4a7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc4a7('0x7'));var config=require(_0xc4a7('0x8'));var attributes=require(_0xc4a7('0x9'));module[_0xc4a7('0xa')]=function(_0x5b97a8,_0x3be6b6){return _0x5b97a8['define']('ChatWebsite',attributes,{'tableName':_0xc4a7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x00b6=['./chatWebsite.attributes','exports','ChatWebsite','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x22608c,_0x20fac7){var _0xf01d6d=function(_0x31ffbc){while(--_0x31ffbc){_0x22608c['push'](_0x22608c['shift']());}};_0xf01d6d(++_0x20fac7);}(_0x00b6,0x16b));var _0x600b=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0x00b6[_0x3305de];return _0x3b5a84;};'use strict';var _=require(_0x600b('0x0'));var util=require(_0x600b('0x1'));var logger=require(_0x600b('0x2'))(_0x600b('0x3'));var moment=require(_0x600b('0x4'));var BPromise=require(_0x600b('0x5'));var rp=require(_0x600b('0x6'));var fs=require('fs');var path=require(_0x600b('0x7'));var rimraf=require(_0x600b('0x8'));var config=require('../../config/environment');var attributes=require(_0x600b('0x9'));module[_0x600b('0xa')]=function(_0x2a3d4b,_0x20b164){return _0x2a3d4b['define'](_0x600b('0xb'),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 adb813b..b7a045e 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 _0x6b52=['ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','localhost','register','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent'];(function(_0x1dc7c8,_0x1c18f9){var _0x4c3b3e=function(_0x537222){while(--_0x537222){_0x1dc7c8['push'](_0x1dc7c8['shift']());}};_0x4c3b3e(++_0x1c18f9);}(_0x6b52,0xaf));var _0x26b5=function(_0x38e233,_0x42e068){_0x38e233=_0x38e233-0x0;var _0x488064=_0x6b52[_0x38e233];return _0x488064;};'use strict';var _=require(_0x26b5('0x0'));var util=require(_0x26b5('0x1'));var moment=require(_0x26b5('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x26b5('0x3'));var db=require(_0x26b5('0x4'))['db'];var utils=require(_0x26b5('0x5'));var logger=require(_0x26b5('0x6'))('rpc');var config=require(_0x26b5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x26b5('0x8')][_0x26b5('0x9')]({'port':0x232a});config[_0x26b5('0xa')]=_['defaults'](config[_0x26b5('0xa')],{'host':_0x26b5('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x26b5('0xa')]));require('./chatWebsite.socket')[_0x26b5('0xc')](socket);function respondWithRpcPromise(_0x130fef,_0x36e7a5,_0x297c83){return new BPromise(function(_0x578948,_0x2f555a){return client[_0x26b5('0xd')](_0x130fef,_0x297c83)['then'](function(_0x4ce244){logger[_0x26b5('0xe')](_0x26b5('0xf'),_0x36e7a5,_0x26b5('0x10'));logger['debug'](_0x26b5('0x11'),_0x36e7a5,_0x26b5('0x10'),JSON[_0x26b5('0x12')](_0x4ce244));if(_0x4ce244[_0x26b5('0x13')]){if(_0x4ce244['error'][_0x26b5('0x14')]===0x1f4){logger[_0x26b5('0x13')](_0x26b5('0xf'),_0x36e7a5,_0x4ce244[_0x26b5('0x13')]['message']);return _0x2f555a(_0x4ce244[_0x26b5('0x13')][_0x26b5('0x15')]);}logger[_0x26b5('0x13')](_0x26b5('0xf'),_0x36e7a5,_0x4ce244[_0x26b5('0x13')][_0x26b5('0x15')]);return _0x578948(_0x4ce244[_0x26b5('0x13')]['message']);}else{logger['info'](_0x26b5('0xf'),_0x36e7a5,_0x26b5('0x10'));_0x578948(_0x4ce244[_0x26b5('0x16')][_0x26b5('0x15')]);}})[_0x26b5('0x17')](function(_0xe7d175){logger['error'](_0x26b5('0xf'),_0x36e7a5,_0xe7d175);_0x2f555a(_0xe7d175);});});} \ No newline at end of file +var _0x4f73=['util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','defaults','./chatWebsite.socket','register','request','then','info','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','ChatWebsite,\x20%s,\x20%s','result','catch','lodash'];(function(_0x42e988,_0xd8abe0){var _0x5ce1fb=function(_0x2531bc){while(--_0x2531bc){_0x42e988['push'](_0x42e988['shift']());}};_0x5ce1fb(++_0xd8abe0);}(_0x4f73,0xe0));var _0x34f7=function(_0x5b013d,_0xc7691c){_0x5b013d=_0x5b013d-0x0;var _0x2b6eef=_0x4f73[_0x5b013d];return _0x2b6eef;};'use strict';var _=require(_0x34f7('0x0'));var util=require(_0x34f7('0x1'));var moment=require(_0x34f7('0x2'));var BPromise=require(_0x34f7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x34f7('0x4'));var db=require(_0x34f7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x34f7('0x6'))('rpc');var config=require(_0x34f7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x34f7('0x8')][_0x34f7('0x9')]({'port':0x232a});config[_0x34f7('0xa')]=_[_0x34f7('0xb')](config[_0x34f7('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x34f7('0xa')]));require(_0x34f7('0xc'))[_0x34f7('0xd')](socket);function respondWithRpcPromise(_0x50f35d,_0x1b5893,_0x52abe8){return new BPromise(function(_0x161af4,_0x1e74ed){return client[_0x34f7('0xe')](_0x50f35d,_0x52abe8)[_0x34f7('0xf')](function(_0x367c5b){logger[_0x34f7('0x10')]('ChatWebsite,\x20%s,\x20%s',_0x1b5893,_0x34f7('0x11'));logger['debug'](_0x34f7('0x12'),_0x1b5893,_0x34f7('0x11'),JSON[_0x34f7('0x13')](_0x367c5b));if(_0x367c5b['error']){if(_0x367c5b[_0x34f7('0x14')]['code']===0x1f4){logger[_0x34f7('0x14')]('ChatWebsite,\x20%s,\x20%s',_0x1b5893,_0x367c5b[_0x34f7('0x14')]['message']);return _0x1e74ed(_0x367c5b[_0x34f7('0x14')][_0x34f7('0x15')]);}logger[_0x34f7('0x14')](_0x34f7('0x16'),_0x1b5893,_0x367c5b[_0x34f7('0x14')][_0x34f7('0x15')]);return _0x161af4(_0x367c5b[_0x34f7('0x14')][_0x34f7('0x15')]);}else{logger[_0x34f7('0x10')]('ChatWebsite,\x20%s,\x20%s',_0x1b5893,_0x34f7('0x11'));_0x161af4(_0x367c5b[_0x34f7('0x17')][_0x34f7('0x15')]);}})[_0x34f7('0x18')](function(_0x579cac){logger[_0x34f7('0x14')](_0x34f7('0x16'),_0x1b5893,_0x579cac);_0x1e74ed(_0x579cac);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index a916200..93672e8 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 _0x434d=['update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x11e001,_0xb3367b){var _0x417419=function(_0x33f535){while(--_0x33f535){_0x11e001['push'](_0x11e001['shift']());}};_0x417419(++_0xb3367b);}(_0x434d,0x1ce));var _0xd434=function(_0x5e6473,_0x2ad2a6){_0x5e6473=_0x5e6473-0x0;var _0x3b4f9a=_0x434d[_0x5e6473];return _0x3b4f9a;};'use strict';var ChatWebsiteEvents=require(_0xd434('0x0'));var events=[_0xd434('0x1'),'remove',_0xd434('0x2')];function createListener(_0x200bd0,_0x1d4827){return function(_0x15ced3){_0x1d4827[_0xd434('0x3')](_0x200bd0,_0x15ced3);};}function removeListener(_0x526ed7,_0x114cf4){return function(){ChatWebsiteEvents[_0xd434('0x4')](_0x526ed7,_0x114cf4);};}exports[_0xd434('0x5')]=function(_0x2cab73){for(var _0x43b52e=0x0,_0x472cde=events[_0xd434('0x6')];_0x43b52e<_0x472cde;_0x43b52e++){var _0x1341b3=events[_0x43b52e];var _0x2a1aab=createListener(_0xd434('0x7')+_0x1341b3,_0x2cab73);ChatWebsiteEvents['on'](_0x1341b3,_0x2a1aab);}}; \ No newline at end of file +var _0xb3aa=['remove','register','chatWebsite:','save'];(function(_0x5e95cd,_0x5f49be){var _0x386bb6=function(_0x4d5e19){while(--_0x4d5e19){_0x5e95cd['push'](_0x5e95cd['shift']());}};_0x386bb6(++_0x5f49be);}(_0xb3aa,0xd7));var _0xab3a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb3aa[_0x20a584];return _0x4b41a8;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0xab3a('0x0'),_0xab3a('0x1'),'update'];function createListener(_0x1a638a,_0x202181){return function(_0x3f87cb){_0x202181['emit'](_0x1a638a,_0x3f87cb);};}function removeListener(_0x399c3e,_0x233977){return function(){ChatWebsiteEvents['removeListener'](_0x399c3e,_0x233977);};}exports[_0xab3a('0x2')]=function(_0x4f6cd5){for(var _0x749db0=0x0,_0x554d96=events['length'];_0x749db0<_0x554d96;_0x749db0++){var _0x55b7b8=events[_0x749db0];var _0x31a30d=createListener(_0xab3a('0x3')+_0x55b7b8,_0x4f6cd5);ChatWebsiteEvents['on'](_0x55b7b8,_0x31a30d);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 2e3ce88..cdec796 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 _0xc5d7=['server/files/images/logos/','format','%s-%s','now','originalname','single','file','addLogo','diskStorage','root','server/files/images/avatars/','addAvatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','offline-chat','replace','extname','/:id/offline','offline','addInteraction','addApplications','addProactiveActions','addAgents','put','/:id','update','destroy','delete','removeAnswers','removeAgents','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','getFields','/:id/users','getAgents','post','create','addDisposition','join'];(function(_0x4c5778,_0x499674){var _0xaacba6=function(_0x3d6029){while(--_0x3d6029){_0x4c5778['push'](_0x4c5778['shift']());}};_0xaacba6(++_0x499674);}(_0xc5d7,0x13e));var _0x7c5d=function(_0x20768a,_0xc40b0e){_0x20768a=_0x20768a-0x0;var _0x2c5006=_0xc5d7[_0x20768a];return _0x2c5006;};'use strict';var multer=require('multer');var util=require(_0x7c5d('0x0'));var path=require(_0x7c5d('0x1'));var timeout=require('connect-timeout');var express=require(_0x7c5d('0x2'));var router=express[_0x7c5d('0x3')]();var fs_extra=require(_0x7c5d('0x4'));var auth=require(_0x7c5d('0x5'));var interaction=require(_0x7c5d('0x6'));var config=require(_0x7c5d('0x7'));var controller=require(_0x7c5d('0x8'));router[_0x7c5d('0x9')]('/',auth['isAuthenticated'](),controller[_0x7c5d('0xa')]);router[_0x7c5d('0x9')](_0x7c5d('0xb'),auth[_0x7c5d('0xc')](),controller['describe']);router['get']('/:id',auth[_0x7c5d('0xc')](),controller['show']);router[_0x7c5d('0x9')](_0x7c5d('0xd'),auth[_0x7c5d('0xc')](),controller[_0x7c5d('0xe')]);router[_0x7c5d('0x9')](_0x7c5d('0xf'),auth[_0x7c5d('0xc')](),controller[_0x7c5d('0x10')]);router[_0x7c5d('0x9')](_0x7c5d('0x11'),controller[_0x7c5d('0x12')]);router[_0x7c5d('0x9')](_0x7c5d('0x13'),controller['getAvatar']);router[_0x7c5d('0x9')](_0x7c5d('0x14'),controller['getCustomerAvatar']);router[_0x7c5d('0x9')](_0x7c5d('0x15'),controller[_0x7c5d('0x16')]);router[_0x7c5d('0x9')](_0x7c5d('0x17'),auth['isAuthenticated'](),controller[_0x7c5d('0x18')]);router[_0x7c5d('0x9')]('/:id/snippet',controller[_0x7c5d('0x19')]);router[_0x7c5d('0x9')](_0x7c5d('0x1a'),auth[_0x7c5d('0xc')](),controller[_0x7c5d('0x1b')]);router['get'](_0x7c5d('0x1c'),auth[_0x7c5d('0xc')](),controller[_0x7c5d('0x1d')]);router[_0x7c5d('0x9')]('/:id/fields',controller[_0x7c5d('0x1e')]);router[_0x7c5d('0x9')]('/:id/offline_messages',auth[_0x7c5d('0xc')](),controller['getOfflineMessages']);router['get'](_0x7c5d('0x1f'),auth[_0x7c5d('0xc')](),controller[_0x7c5d('0x20')]);router[_0x7c5d('0x21')]('/',auth['isAuthenticated'](),controller[_0x7c5d('0x22')]);router[_0x7c5d('0x21')](_0x7c5d('0xd'),auth[_0x7c5d('0xc')](),controller[_0x7c5d('0x23')]);router[_0x7c5d('0x21')](_0x7c5d('0xf'),auth[_0x7c5d('0xc')](),controller['addAnswer']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53d913,_0x5f1c1c,_0x19a96f){_0x19a96f(null,path[_0x7c5d('0x24')](config['root'],_0x7c5d('0x25')));},'filename':function(_0x36c887,_0x199621,_0x38e0f7){_0x38e0f7(null,util[_0x7c5d('0x26')](_0x7c5d('0x27'),Date[_0x7c5d('0x28')](),_0x199621[_0x7c5d('0x29')]));}})});router[_0x7c5d('0x21')](_0x7c5d('0x11'),upload[_0x7c5d('0x2a')](_0x7c5d('0x2b')),controller[_0x7c5d('0x2c')]);var upload=multer({'storage':multer[_0x7c5d('0x2d')]({'destination':function(_0x516c52,_0x1a6916,_0x349d82){_0x349d82(null,path['join'](config[_0x7c5d('0x2e')],_0x7c5d('0x2f')));},'filename':function(_0x479a29,_0x29b533,_0x23dfe1){_0x23dfe1(null,util[_0x7c5d('0x26')](_0x7c5d('0x27'),Date[_0x7c5d('0x28')](),_0x29b533[_0x7c5d('0x29')]));}})});router[_0x7c5d('0x21')](_0x7c5d('0x13'),upload[_0x7c5d('0x2a')](_0x7c5d('0x2b')),controller[_0x7c5d('0x30')]);var upload=multer({'storage':multer[_0x7c5d('0x2d')]({'destination':function(_0x23778d,_0x2a8b19,_0x4c635c){_0x4c635c(null,path[_0x7c5d('0x24')](config[_0x7c5d('0x2e')],_0x7c5d('0x2f')));},'filename':function(_0x4b1060,_0x17665e,_0xaa734c){_0xaa734c(null,util[_0x7c5d('0x26')](_0x7c5d('0x27'),Date[_0x7c5d('0x28')](),_0x17665e['originalname']));}})});router[_0x7c5d('0x21')]('/:id/customer_avatar',upload[_0x7c5d('0x2a')](_0x7c5d('0x2b')),controller[_0x7c5d('0x31')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2432ab,_0x14ae16,_0x542c4e){_0x542c4e(null,path[_0x7c5d('0x24')](config[_0x7c5d('0x2e')],_0x7c5d('0x2f')));},'filename':function(_0x349034,_0x20ebd7,_0x4638a8){_0x4638a8(null,util['format']('%s-%s',Date[_0x7c5d('0x28')](),_0x20ebd7[_0x7c5d('0x29')]));}})});router[_0x7c5d('0x21')](_0x7c5d('0x15'),upload[_0x7c5d('0x2a')](_0x7c5d('0x2b')),controller[_0x7c5d('0x32')]);router['post'](_0x7c5d('0x33'),controller[_0x7c5d('0x34')]);const offlineUploadMulter=multer({'storage':multer[_0x7c5d('0x2d')]({'destination':function(_0x1627c4,_0x12e11c,_0x3836da){const _0xeb5229=path[_0x7c5d('0x24')](config[_0x7c5d('0x2e')],_0x7c5d('0x35'),'attachments',_0x7c5d('0x36'));fs_extra['ensureDir'](_0xeb5229,function(){_0x3836da(null,_0xeb5229);});},'filename':function(_0x38de49,_0x35bd1d,_0x549c79){const _0x152dc5=_0x35bd1d[_0x7c5d('0x29')][_0x7c5d('0x37')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x2a3280=path[_0x7c5d('0x38')](_0x152dc5);const _0x509784=Date[_0x7c5d('0x28')]()+'-'+_0x152dc5['replace'](_0x2a3280,'')+_0x2a3280;_0x549c79(null,_0x509784);}})});router[_0x7c5d('0x21')](_0x7c5d('0x39'),offlineUploadMulter['any'](),controller[_0x7c5d('0x3a')]);router['post'](_0x7c5d('0x17'),auth[_0x7c5d('0xc')](),controller[_0x7c5d('0x3b')]);router[_0x7c5d('0x21')](_0x7c5d('0x1a'),auth[_0x7c5d('0xc')](),controller[_0x7c5d('0x3c')]);router[_0x7c5d('0x21')]('/:id/proactive_actions',auth[_0x7c5d('0xc')](),controller[_0x7c5d('0x3d')]);router[_0x7c5d('0x21')](_0x7c5d('0x1f'),auth[_0x7c5d('0xc')](),controller[_0x7c5d('0x3e')]);router[_0x7c5d('0x3f')](_0x7c5d('0x40'),auth[_0x7c5d('0xc')](),controller[_0x7c5d('0x41')]);router['delete'](_0x7c5d('0x40'),auth[_0x7c5d('0xc')](),controller[_0x7c5d('0x42')]);router[_0x7c5d('0x43')](_0x7c5d('0xd'),auth[_0x7c5d('0xc')](),controller['removeDispositions']);router['delete'](_0x7c5d('0xf'),auth[_0x7c5d('0xc')](),controller[_0x7c5d('0x44')]);router[_0x7c5d('0x43')](_0x7c5d('0x1f'),auth[_0x7c5d('0xc')](),controller[_0x7c5d('0x45')]);module[_0x7c5d('0x46')]=router; \ No newline at end of file +var _0x268c=['server/files','ensureDir','replace','extname','/:id/offline','addInteraction','addApplications','addProactiveActions','/:id/users','addAgents','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/:id','/:id/dispositions','getDispositions','getAnswers','getLogo','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','create','addDisposition','post','/:id/canned_answers','addAnswer','diskStorage','join','format','%s-%s','now','originalname','file','addLogo','root','server/files/images/avatars/','/:id/avatar','single','addCustomerAvatar','addSystemAvatar','/:id/notify','notify'];(function(_0x1c296e,_0x39ce65){var _0x108ba1=function(_0x316fd1){while(--_0x316fd1){_0x1c296e['push'](_0x1c296e['shift']());}};_0x108ba1(++_0x39ce65);}(_0x268c,0x158));var _0xc268=function(_0x34a8c8,_0x31e259){_0x34a8c8=_0x34a8c8-0x0;var _0x1fe6e5=_0x268c[_0x34a8c8];return _0x1fe6e5;};'use strict';var multer=require(_0xc268('0x0'));var util=require('util');var path=require(_0xc268('0x1'));var timeout=require('connect-timeout');var express=require(_0xc268('0x2'));var router=express[_0xc268('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc268('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc268('0x5'));var controller=require(_0xc268('0x6'));router[_0xc268('0x7')]('/',auth[_0xc268('0x8')](),controller[_0xc268('0x9')]);router[_0xc268('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xc268('0x7')](_0xc268('0xa'),auth[_0xc268('0x8')](),controller['show']);router['get'](_0xc268('0xb'),auth[_0xc268('0x8')](),controller[_0xc268('0xc')]);router['get']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xc268('0xd')]);router[_0xc268('0x7')]('/:id/logo',controller[_0xc268('0xe')]);router[_0xc268('0x7')]('/:id/avatar',controller[_0xc268('0xf')]);router[_0xc268('0x7')](_0xc268('0x10'),controller[_0xc268('0x11')]);router[_0xc268('0x7')](_0xc268('0x12'),controller[_0xc268('0x13')]);router[_0xc268('0x7')](_0xc268('0x14'),auth[_0xc268('0x8')](),controller[_0xc268('0x15')]);router[_0xc268('0x7')](_0xc268('0x16'),controller[_0xc268('0x17')]);router[_0xc268('0x7')](_0xc268('0x18'),auth[_0xc268('0x8')](),controller['getApplications']);router[_0xc268('0x7')](_0xc268('0x19'),auth[_0xc268('0x8')](),controller[_0xc268('0x1a')]);router['get'](_0xc268('0x1b'),controller[_0xc268('0x1c')]);router[_0xc268('0x7')](_0xc268('0x1d'),auth['isAuthenticated'](),controller[_0xc268('0x1e')]);router[_0xc268('0x7')]('/:id/users',auth[_0xc268('0x8')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0xc268('0x1f')]);router['post'](_0xc268('0xb'),auth[_0xc268('0x8')](),controller[_0xc268('0x20')]);router[_0xc268('0x21')](_0xc268('0x22'),auth[_0xc268('0x8')](),controller[_0xc268('0x23')]);var upload=multer({'storage':multer[_0xc268('0x24')]({'destination':function(_0x2c43a8,_0x40242b,_0x3fdccf){_0x3fdccf(null,path[_0xc268('0x25')](config['root'],'server/files/images/logos/'));},'filename':function(_0x1783a7,_0x16b366,_0x3a4471){_0x3a4471(null,util[_0xc268('0x26')](_0xc268('0x27'),Date[_0xc268('0x28')](),_0x16b366[_0xc268('0x29')]));}})});router[_0xc268('0x21')]('/:id/logo',upload['single'](_0xc268('0x2a')),controller[_0xc268('0x2b')]);var upload=multer({'storage':multer[_0xc268('0x24')]({'destination':function(_0x562aad,_0x28f0aa,_0x370713){_0x370713(null,path['join'](config[_0xc268('0x2c')],_0xc268('0x2d')));},'filename':function(_0xf6e923,_0x2590d8,_0x2a8394){_0x2a8394(null,util['format'](_0xc268('0x27'),Date[_0xc268('0x28')](),_0x2590d8[_0xc268('0x29')]));}})});router['post'](_0xc268('0x2e'),upload[_0xc268('0x2f')]('file'),controller['addAvatar']);var upload=multer({'storage':multer[_0xc268('0x24')]({'destination':function(_0x387b1b,_0x5ca419,_0x57ac59){_0x57ac59(null,path[_0xc268('0x25')](config[_0xc268('0x2c')],_0xc268('0x2d')));},'filename':function(_0xa3c1a6,_0x56688e,_0x5ecc35){_0x5ecc35(null,util[_0xc268('0x26')](_0xc268('0x27'),Date['now'](),_0x56688e['originalname']));}})});router[_0xc268('0x21')](_0xc268('0x10'),upload[_0xc268('0x2f')]('file'),controller[_0xc268('0x30')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x19ca3f,_0x40cdb5,_0x5cbc2a){_0x5cbc2a(null,path[_0xc268('0x25')](config[_0xc268('0x2c')],_0xc268('0x2d')));},'filename':function(_0x594481,_0x1ef7cf,_0x4018e6){_0x4018e6(null,util[_0xc268('0x26')](_0xc268('0x27'),Date['now'](),_0x1ef7cf['originalname']));}})});router['post'](_0xc268('0x12'),upload[_0xc268('0x2f')]('file'),controller[_0xc268('0x31')]);router[_0xc268('0x21')](_0xc268('0x32'),controller[_0xc268('0x33')]);const offlineUploadMulter=multer({'storage':multer[_0xc268('0x24')]({'destination':function(_0x3998fa,_0x437bf4,_0x32caec){const _0x176522=path[_0xc268('0x25')](config[_0xc268('0x2c')],_0xc268('0x34'),'attachments','offline-chat');fs_extra[_0xc268('0x35')](_0x176522,function(){_0x32caec(null,_0x176522);});},'filename':function(_0x5bb95b,_0x9e5f55,_0x3b48b9){const _0x4dca9c=_0x9e5f55[_0xc268('0x29')][_0xc268('0x36')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x326fc7=path[_0xc268('0x37')](_0x4dca9c);const _0x468653=Date[_0xc268('0x28')]()+'-'+_0x4dca9c[_0xc268('0x36')](_0x326fc7,'')+_0x326fc7;_0x3b48b9(null,_0x468653);}})});router['post'](_0xc268('0x38'),offlineUploadMulter['any'](),controller['offline']);router[_0xc268('0x21')](_0xc268('0x14'),auth[_0xc268('0x8')](),controller[_0xc268('0x39')]);router[_0xc268('0x21')](_0xc268('0x18'),auth[_0xc268('0x8')](),controller[_0xc268('0x3a')]);router[_0xc268('0x21')](_0xc268('0x19'),auth['isAuthenticated'](),controller[_0xc268('0x3b')]);router[_0xc268('0x21')](_0xc268('0x3c'),auth[_0xc268('0x8')](),controller[_0xc268('0x3d')]);router['put'](_0xc268('0xa'),auth[_0xc268('0x8')](),controller[_0xc268('0x3e')]);router[_0xc268('0x3f')](_0xc268('0xa'),auth[_0xc268('0x8')](),controller[_0xc268('0x40')]);router[_0xc268('0x3f')](_0xc268('0xb'),auth[_0xc268('0x8')](),controller['removeDispositions']);router[_0xc268('0x3f')]('/:id/canned_answers',auth[_0xc268('0x8')](),controller['removeAnswers']);router[_0xc268('0x3f')]('/:id/users',auth[_0xc268('0x8')](),controller['removeAgents']);module[_0xc268('0x41')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 7e3f07b..6d423bb 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 _0x2e88=['exports','STRING','ENUM','AmazonAWS','Google','sequelize'];(function(_0x52a529,_0x42c718){var _0x3668e7=function(_0x5e7297){while(--_0x5e7297){_0x52a529['push'](_0x52a529['shift']());}};_0x3668e7(++_0x42c718);}(_0x2e88,0x95));var _0x82e8=function(_0x4164f2,_0x38669f){_0x4164f2=_0x4164f2-0x0;var _0x2575c7=_0x2e88[_0x4164f2];return _0x2575c7;};'use strict';var Sequelize=require(_0x82e8('0x0'));module[_0x82e8('0x1')]={'name':{'type':Sequelize[_0x82e8('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x82e8('0x3')](_0x82e8('0x4'),_0x82e8('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x82e8('0x2')]}}; \ No newline at end of file +var _0xc963=['AmazonAWS','Google','STRING','sequelize','ENUM'];(function(_0x5d6c36,_0x20eba2){var _0x40ce50=function(_0x60281a){while(--_0x60281a){_0x5d6c36['push'](_0x5d6c36['shift']());}};_0x40ce50(++_0x20eba2);}(_0xc963,0x17f));var _0x3c96=function(_0x5a7e78,_0x400b57){_0x5a7e78=_0x5a7e78-0x0;var _0xa8d4a1=_0xc963[_0x5a7e78];return _0xa8d4a1;};'use strict';var Sequelize=require(_0x3c96('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x3c96('0x1')](_0x3c96('0x2'),_0x3c96('0x3')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x3c96('0x4')]},'data2':{'type':Sequelize[_0x3c96('0x4')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 5dfef50..bb2cde2 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 _0x7a54=['offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','CloudProvider','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x3a9e33,_0x5bbf05){var _0x19064f=function(_0x5374be){while(--_0x5374be){_0x3a9e33['push'](_0x3a9e33['shift']());}};_0x19064f(++_0x5bbf05);}(_0x7a54,0x106));var _0x47a5=function(_0x2472a6,_0x3f9da9){_0x2472a6=_0x2472a6-0x0;var _0x6a0cf3=_0x7a54[_0x2472a6];return _0x6a0cf3;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['CloudProvider'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['CloudProvider']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['CloudProvider']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));}; \ No newline at end of file +var _0x7a54=['offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','CloudProvider','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x15b6d8,_0x5dc45a){var _0x403ec4=function(_0x58f80e){while(--_0x58f80e){_0x15b6d8['push'](_0x15b6d8['shift']());}};_0x403ec4(++_0x5dc45a);}(_0x7a54,0x106));var _0x47a5=function(_0x3f22e3,_0x361330){_0x3f22e3=_0x3f22e3-0x0;var _0x2b6428=_0x7a54[_0x3f22e3];return _0x2b6428;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['CloudProvider'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['CloudProvider']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['CloudProvider']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index be2836a..d46fecd 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 _0x9104=['path','../../config/environment','exports','define','CloudProvider','cloud_providers','util','../../config/logger','api','bluebird','request-promise'];(function(_0x18cac4,_0x57a4d5){var _0x2227c6=function(_0x72934d){while(--_0x72934d){_0x18cac4['push'](_0x18cac4['shift']());}};_0x2227c6(++_0x57a4d5);}(_0x9104,0x69));var _0x4910=function(_0x1cddba,_0x24ce1a){_0x1cddba=_0x1cddba-0x0;var _0x492533=_0x9104[_0x1cddba];return _0x492533;};'use strict';var _=require('lodash');var util=require(_0x4910('0x0'));var logger=require(_0x4910('0x1'))(_0x4910('0x2'));var moment=require('moment');var BPromise=require(_0x4910('0x3'));var rp=require(_0x4910('0x4'));var fs=require('fs');var path=require(_0x4910('0x5'));var rimraf=require('rimraf');var config=require(_0x4910('0x6'));var attributes=require('./cloudProvider.attributes');module[_0x4910('0x7')]=function(_0x1ff4ca,_0x2f7b45){return _0x1ff4ca[_0x4910('0x8')](_0x4910('0x9'),attributes,{'tableName':_0x4910('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc645=['bluebird','request-promise','path','rimraf','../../config/environment','lodash','moment'];(function(_0x3f61ae,_0xb85d6c){var _0x57d7e7=function(_0x23226a){while(--_0x23226a){_0x3f61ae['push'](_0x3f61ae['shift']());}};_0x57d7e7(++_0xb85d6c);}(_0xc645,0x18d));var _0x5c64=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0xc645[_0x411017];return _0x2adeea;};'use strict';var _=require(_0x5c64('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5c64('0x1'));var BPromise=require(_0x5c64('0x2'));var rp=require(_0x5c64('0x3'));var fs=require('fs');var path=require(_0x5c64('0x4'));var rimraf=require(_0x5c64('0x5'));var config=require(_0x5c64('0x6'));var attributes=require('./cloudProvider.attributes');module['exports']=function(_0x134d1e,_0x51740e){return _0x134d1e['define']('CloudProvider',attributes,{'tableName':'cloud_providers','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 574df63..7b3bb3f 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 _0xf1f9=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x50bd30,_0x45ecd0){var _0x5bdd72=function(_0x59638a){while(--_0x59638a){_0x50bd30['push'](_0x50bd30['shift']());}};_0x5bdd72(++_0x45ecd0);}(_0xf1f9,0x1cd));var _0x9f1f=function(_0x26997d,_0x5a64f8){_0x26997d=_0x26997d-0x0;var _0x44fe89=_0xf1f9[_0x26997d];return _0x44fe89;};'use strict';var _=require(_0x9f1f('0x0'));var util=require(_0x9f1f('0x1'));var moment=require(_0x9f1f('0x2'));var BPromise=require(_0x9f1f('0x3'));var rs=require(_0x9f1f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9f1f('0x5'))['db'];var utils=require(_0x9f1f('0x6'));var logger=require(_0x9f1f('0x7'))(_0x9f1f('0x8'));var config=require(_0x9f1f('0x9'));var jayson=require(_0x9f1f('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x363d26,_0x373b98,_0x117fa5){return new BPromise(function(_0x12309e,_0x4e6054){return client[_0x9f1f('0xb')](_0x363d26,_0x117fa5)[_0x9f1f('0xc')](function(_0x3efac2){logger[_0x9f1f('0xd')](_0x9f1f('0xe'),_0x373b98,_0x9f1f('0xf'));logger[_0x9f1f('0x10')](_0x9f1f('0x11'),_0x373b98,'request\x20sent',JSON[_0x9f1f('0x12')](_0x3efac2));if(_0x3efac2[_0x9f1f('0x13')]){if(_0x3efac2[_0x9f1f('0x13')]['code']===0x1f4){logger['error'](_0x9f1f('0xe'),_0x373b98,_0x3efac2['error'][_0x9f1f('0x14')]);return _0x4e6054(_0x3efac2[_0x9f1f('0x13')][_0x9f1f('0x14')]);}logger[_0x9f1f('0x13')](_0x9f1f('0xe'),_0x373b98,_0x3efac2[_0x9f1f('0x13')][_0x9f1f('0x14')]);return _0x12309e(_0x3efac2['error'][_0x9f1f('0x14')]);}else{logger['info'](_0x9f1f('0xe'),_0x373b98,_0x9f1f('0xf'));_0x12309e(_0x3efac2[_0x9f1f('0x15')][_0x9f1f('0x14')]);}})[_0x9f1f('0x16')](function(_0x5645fc){logger[_0x9f1f('0x13')](_0x9f1f('0xe'),_0x373b98,_0x5645fc);_0x4e6054(_0x5645fc);});});} \ No newline at end of file +var _0xd448=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','CloudProvider,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x1a5ec7,_0x471384){var _0x54d7a7=function(_0x353ebc){while(--_0x353ebc){_0x1a5ec7['push'](_0x1a5ec7['shift']());}};_0x54d7a7(++_0x471384);}(_0xd448,0x172));var _0x8d44=function(_0x40dcfe,_0xea7784){_0x40dcfe=_0x40dcfe-0x0;var _0x389191=_0xd448[_0x40dcfe];return _0x389191;};'use strict';var _=require('lodash');var util=require(_0x8d44('0x0'));var moment=require(_0x8d44('0x1'));var BPromise=require(_0x8d44('0x2'));var rs=require(_0x8d44('0x3'));var fs=require('fs');var Redis=require(_0x8d44('0x4'));var db=require(_0x8d44('0x5'))['db'];var utils=require(_0x8d44('0x6'));var logger=require(_0x8d44('0x7'))(_0x8d44('0x8'));var config=require(_0x8d44('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8d44('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56539b,_0x3b352e,_0x2cdb53){return new BPromise(function(_0x1680eb,_0x441fd3){return client['request'](_0x56539b,_0x2cdb53)[_0x8d44('0xb')](function(_0x2a5da6){logger['info']('CloudProvider,\x20%s,\x20%s',_0x3b352e,_0x8d44('0xc'));logger[_0x8d44('0xd')](_0x8d44('0xe'),_0x3b352e,'request\x20sent',JSON[_0x8d44('0xf')](_0x2a5da6));if(_0x2a5da6[_0x8d44('0x10')]){if(_0x2a5da6[_0x8d44('0x10')][_0x8d44('0x11')]===0x1f4){logger['error'](_0x8d44('0x12'),_0x3b352e,_0x2a5da6[_0x8d44('0x10')][_0x8d44('0x13')]);return _0x441fd3(_0x2a5da6[_0x8d44('0x10')][_0x8d44('0x13')]);}logger['error'](_0x8d44('0x12'),_0x3b352e,_0x2a5da6[_0x8d44('0x10')][_0x8d44('0x13')]);return _0x1680eb(_0x2a5da6[_0x8d44('0x10')][_0x8d44('0x13')]);}else{logger['info'](_0x8d44('0x12'),_0x3b352e,_0x8d44('0xc'));_0x1680eb(_0x2a5da6[_0x8d44('0x14')][_0x8d44('0x13')]);}})[_0x8d44('0x15')](function(_0x2e7d11){logger[_0x8d44('0x10')](_0x8d44('0x12'),_0x3b352e,_0x2e7d11);_0x441fd3(_0x2e7d11);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index d6200cb..633de6a 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 _0xe676=['isAuthenticated','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cloudProvider.controller','get'];(function(_0x149b83,_0x3d5689){var _0x142701=function(_0x26d0da){while(--_0x26d0da){_0x149b83['push'](_0x149b83['shift']());}};_0x142701(++_0x3d5689);}(_0xe676,0x1d5));var _0x6e67=function(_0x54de5d,_0x1f8b26){_0x54de5d=_0x54de5d-0x0;var _0x1b349e=_0xe676[_0x54de5d];return _0x1b349e;};'use strict';var multer=require(_0x6e67('0x0'));var util=require(_0x6e67('0x1'));var path=require(_0x6e67('0x2'));var timeout=require(_0x6e67('0x3'));var express=require(_0x6e67('0x4'));var router=express[_0x6e67('0x5')]();var fs_extra=require(_0x6e67('0x6'));var auth=require(_0x6e67('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x6e67('0x8'));var controller=require(_0x6e67('0x9'));router[_0x6e67('0xa')]('/',auth[_0x6e67('0xb')](),controller['index']);router[_0x6e67('0xa')](_0x6e67('0xc'),auth['isAuthenticated'](),controller[_0x6e67('0xd')]);router[_0x6e67('0xe')]('/',auth[_0x6e67('0xb')](),controller[_0x6e67('0xf')]);router[_0x6e67('0x10')](_0x6e67('0xc'),auth[_0x6e67('0xb')](),controller['update']);router[_0x6e67('0x11')](_0x6e67('0xc'),auth['isAuthenticated'](),controller[_0x6e67('0x12')]);module[_0x6e67('0x13')]=router; \ No newline at end of file +var _0xec79=['Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','put','update','delete','destroy','exports','path','connect-timeout','express'];(function(_0xd25b59,_0x217f8a){var _0x4cab47=function(_0x26362d){while(--_0x26362d){_0xd25b59['push'](_0xd25b59['shift']());}};_0x4cab47(++_0x217f8a);}(_0xec79,0x1b7));var _0x9ec7=function(_0x37f030,_0x1d5e22){_0x37f030=_0x37f030-0x0;var _0x55a37f=_0xec79[_0x37f030];return _0x55a37f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9ec7('0x0'));var timeout=require(_0x9ec7('0x1'));var express=require(_0x9ec7('0x2'));var router=express[_0x9ec7('0x3')]();var fs_extra=require(_0x9ec7('0x4'));var auth=require(_0x9ec7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9ec7('0x6'));var controller=require('./cloudProvider.controller');router[_0x9ec7('0x7')]('/',auth[_0x9ec7('0x8')](),controller[_0x9ec7('0x9')]);router[_0x9ec7('0x7')](_0x9ec7('0xa'),auth[_0x9ec7('0x8')](),controller[_0x9ec7('0xb')]);router['post']('/',auth[_0x9ec7('0x8')](),controller['create']);router[_0x9ec7('0xc')](_0x9ec7('0xa'),auth['isAuthenticated'](),controller[_0x9ec7('0xd')]);router[_0x9ec7('0xe')](_0x9ec7('0xa'),auth['isAuthenticated'](),controller[_0x9ec7('0xf')]);module[_0x9ec7('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 4a906b9..bd5b01e 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 _0x1641=['sequelize','exports','STRING'];(function(_0x558269,_0x54602e){var _0x15fd3c=function(_0x3a5a21){while(--_0x3a5a21){_0x558269['push'](_0x558269['shift']());}};_0x15fd3c(++_0x54602e);}(_0x1641,0x153));var _0x1164=function(_0x98b329,_0x534954){_0x98b329=_0x98b329-0x0;var _0x3afe18=_0x1641[_0x98b329];return _0x3afe18;};'use strict';var Sequelize=require(_0x1164('0x0'));module[_0x1164('0x1')]={'name':{'type':Sequelize[_0x1164('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x1164('0x2')]},'companyId':{'type':Sequelize[_0x1164('0x2')]},'website':{'type':Sequelize[_0x1164('0x2')]},'phone':{'type':Sequelize[_0x1164('0x2')]},'fax':{'type':Sequelize[_0x1164('0x2')]},'type':{'type':Sequelize[_0x1164('0x2')]},'street':{'type':Sequelize[_0x1164('0x2')]},'postalCode':{'type':Sequelize[_0x1164('0x2')]},'city':{'type':Sequelize[_0x1164('0x2')]},'country':{'type':Sequelize[_0x1164('0x2')]},'email':{'type':Sequelize[_0x1164('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x1164('0x2')]},'sStreet':{'type':Sequelize[_0x1164('0x2')]},'sPostalCode':{'type':Sequelize[_0x1164('0x2')]},'sCity':{'type':Sequelize[_0x1164('0x2')]},'sCountry':{'type':Sequelize[_0x1164('0x2')]},'description':{'type':Sequelize[_0x1164('0x2')]}}; \ No newline at end of file +var _0xc16b=['STRING','name','sequelize','exports'];(function(_0x4579cb,_0x3d835d){var _0xf31830=function(_0x58825b){while(--_0x58825b){_0x4579cb['push'](_0x4579cb['shift']());}};_0xf31830(++_0x3d835d);}(_0xc16b,0x76));var _0xbc16=function(_0xa665a8,_0x5e7725){_0xa665a8=_0xa665a8-0x0;var _0x1ae40d=_0xc16b[_0xa665a8];return _0x1ae40d;};'use strict';var Sequelize=require(_0xbc16('0x0'));module[_0xbc16('0x1')]={'name':{'type':Sequelize[_0xbc16('0x2')],'unique':_0xbc16('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xbc16('0x2')]},'companyId':{'type':Sequelize[_0xbc16('0x2')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xbc16('0x2')]},'street':{'type':Sequelize[_0xbc16('0x2')]},'postalCode':{'type':Sequelize[_0xbc16('0x2')]},'city':{'type':Sequelize[_0xbc16('0x2')]},'country':{'type':Sequelize[_0xbc16('0x2')]},'email':{'type':Sequelize[_0xbc16('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0xbc16('0x2')]},'sPostalCode':{'type':Sequelize[_0xbc16('0x2')]},'sCity':{'type':Sequelize[_0xbc16('0x2')]},'sCountry':{'type':Sequelize[_0xbc16('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index d97a4c1..9eb32ac 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 _0x92c5=['zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','reject','save','update','then','destroy','UserProfileResource','name','index','describe','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','map','filter','CmCompany','includeAll','include','findAll','rows','catch','params','rawAttributes','options','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Companies','UserProfileSection','find','addContacts','CmContact','ids','omit','getContacts','findOne','rimraf'];(function(_0x9f2ed2,_0x575454){var _0x524305=function(_0x5ae103){while(--_0x5ae103){_0x9f2ed2['push'](_0x9f2ed2['shift']());}};_0x524305(++_0x575454);}(_0x92c5,0x18f));var _0x592c=function(_0x113c0f,_0x56aeec){_0x113c0f=_0x113c0f-0x0;var _0x19bdab=_0x92c5[_0x113c0f];return _0x19bdab;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x592c('0x0'));var zipdir=require(_0x592c('0x1'));var jsonpatch=require(_0x592c('0x2'));var rp=require(_0x592c('0x3'));var moment=require(_0x592c('0x4'));var BPromise=require(_0x592c('0x5'));var Mustache=require('mustache');var util=require(_0x592c('0x6'));var path=require(_0x592c('0x7'));var sox=require(_0x592c('0x8'));var csv=require('to-csv');var ejs=require(_0x592c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x592c('0xa'));var crypto=require(_0x592c('0xb'));var jsforce=require(_0x592c('0xc'));var deskjs=require(_0x592c('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x592c('0xe'));var authService=require(_0x592c('0xf'));var qs=require(_0x592c('0x10'));var as=require(_0x592c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x592c('0x12'))(_0x592c('0x13'));var utils=require(_0x592c('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x592c('0x15'))['db'];function respondWithStatusCode(_0x20a5ff,_0x426a44){_0x426a44=_0x426a44||0xcc;return function(_0xf565f4){if(_0xf565f4){return _0x20a5ff[_0x592c('0x16')](_0x426a44);}return _0x20a5ff['status'](_0x426a44)['end']();};}function respondWithResult(_0x4b2a58,_0x3700fa){_0x3700fa=_0x3700fa||0xc8;return function(_0x316265){if(_0x316265){return _0x4b2a58[_0x592c('0x17')](_0x3700fa)[_0x592c('0x18')](_0x316265);}};}function respondWithFilteredResult(_0x36608a,_0x329320){return function(_0x43853f){if(_0x43853f){var _0x463e2d=typeof _0x329320['offset']==='undefined'&&typeof _0x329320[_0x592c('0x19')]===_0x592c('0x1a');var _0x42c44a=_0x43853f[_0x592c('0x1b')];var _0x585f7a=_0x463e2d?0x0:_0x329320[_0x592c('0x1c')];var _0x53e9e8=_0x463e2d?_0x43853f[_0x592c('0x1b')]:_0x329320[_0x592c('0x1c')]+_0x329320[_0x592c('0x19')];var _0x4183a0;if(_0x53e9e8>=_0x42c44a){_0x53e9e8=_0x42c44a;_0x4183a0=0xc8;}else{_0x4183a0=0xce;}_0x36608a[_0x592c('0x17')](_0x4183a0);return _0x36608a[_0x592c('0x1d')](_0x592c('0x1e'),_0x585f7a+'-'+_0x53e9e8+'/'+_0x42c44a)['json'](_0x43853f);}return null;};}function patchUpdates(_0x2b70ee){return function(_0x29be7b){try{jsonpatch['apply'](_0x29be7b,_0x2b70ee,!![]);}catch(_0x2b01eb){return BPromise[_0x592c('0x1f')](_0x2b01eb);}return _0x29be7b[_0x592c('0x20')]();};}function saveUpdates(_0x3b461f,_0x7fd1c1){return function(_0x588403){if(_0x588403){return _0x588403[_0x592c('0x21')](_0x3b461f)[_0x592c('0x22')](function(_0x1c7684){return _0x1c7684;});}return null;};}function removeEntity(_0x39d209,_0x4dd8fc){return function(_0x2fca76){if(_0x2fca76){return _0x2fca76[_0x592c('0x23')]()[_0x592c('0x22')](function(){var _0x384c8c=_0x2fca76['get']({'plain':!![]});var _0x151dd8='Companies';return db[_0x592c('0x24')][_0x592c('0x23')]({'where':{'type':_0x151dd8,'resourceId':_0x384c8c['id']}})[_0x592c('0x22')](function(){return _0x2fca76;});})[_0x592c('0x22')](function(){_0x39d209[_0x592c('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5acc11,_0x2c76eb){return function(_0x5a85b6){if(!_0x5a85b6){_0x5acc11['sendStatus'](0x194);}return _0x5a85b6;};}function handleError(_0x3cf9cd,_0x24b680){_0x24b680=_0x24b680||0x1f4;return function(_0x3508ce){logger['error'](_0x3508ce['stack']);if(_0x3508ce['name']){delete _0x3508ce[_0x592c('0x25')];}_0x3cf9cd['status'](_0x24b680)['send'](_0x3508ce);};}exports[_0x592c('0x26')]=function(_0x2970d8,_0x1213b3){var _0x26f864={},_0x41218f={},_0xe7395={'count':0x0,'rows':[]};return db['CmCompany'][_0x592c('0x27')]()['then'](function(_0x292e78){_0x41218f[_0x592c('0x28')]=_[_0x592c('0x29')](_0x292e78);_0x41218f['query']=_['keys'](_0x2970d8['query']);_0x41218f['filters']=_[_0x592c('0x2a')](_0x41218f[_0x592c('0x28')],_0x41218f[_0x592c('0x2b')]);_0x26f864[_0x592c('0x2c')]=_['intersection'](_0x41218f[_0x592c('0x28')],qs[_0x592c('0x2d')](_0x2970d8['query'][_0x592c('0x2d')]));_0x26f864[_0x592c('0x2c')]=_0x26f864[_0x592c('0x2c')][_0x592c('0x2e')]?_0x26f864[_0x592c('0x2c')]:_0x41218f[_0x592c('0x28')];if(!_0x2970d8['query'][_0x592c('0x2f')](_0x592c('0x30'))){_0x26f864[_0x592c('0x19')]=qs['limit'](_0x2970d8[_0x592c('0x2b')][_0x592c('0x19')]);_0x26f864[_0x592c('0x1c')]=qs[_0x592c('0x1c')](_0x2970d8[_0x592c('0x2b')][_0x592c('0x1c')]);}_0x26f864[_0x592c('0x31')]=qs[_0x592c('0x32')](_0x2970d8[_0x592c('0x2b')]['sort']);_0x26f864[_0x592c('0x33')]=qs[_0x592c('0x34')](_[_0x592c('0x35')](_0x2970d8['query'],_0x41218f[_0x592c('0x34')]),_0x292e78);if(_0x2970d8['query']['filter']){_0x26f864[_0x592c('0x33')]=_[_0x592c('0x36')](_0x26f864[_0x592c('0x33')],{'$or':_[_0x592c('0x37')](_0x26f864['attributes'],function(_0x4840b){var _0x1ba059={};_0x1ba059[_0x4840b]={'$like':'%'+_0x2970d8[_0x592c('0x2b')][_0x592c('0x38')]+'%'};return _0x1ba059;})});}_0x26f864=_[_0x592c('0x36')]({},_0x26f864,_0x2970d8['options']);var _0x2e3f15={'where':_0x26f864[_0x592c('0x33')]};return db[_0x592c('0x39')]['count'](_0x2e3f15)[_0x592c('0x22')](function(_0x56876f){_0xe7395[_0x592c('0x1b')]=_0x56876f;if(_0x2970d8[_0x592c('0x2b')][_0x592c('0x3a')]){_0x26f864[_0x592c('0x3b')]=[{'all':!![]}];}return db[_0x592c('0x39')][_0x592c('0x3c')](_0x26f864);})[_0x592c('0x22')](function(_0x33220b){_0xe7395[_0x592c('0x3d')]=_0x33220b;return _0xe7395;})[_0x592c('0x22')](respondWithFilteredResult(_0x1213b3,_0x26f864))[_0x592c('0x3e')](handleError(_0x1213b3,null));})[_0x592c('0x3e')](handleError(_0x1213b3,null));};exports['show']=function(_0x5477d9,_0x559480){var _0x3fee88={'raw':![],'where':{'id':_0x5477d9[_0x592c('0x3f')]['id']}},_0x2db637={};_0x2db637['model']=_['keys'](db[_0x592c('0x39')][_0x592c('0x40')]);_0x2db637[_0x592c('0x2b')]=_[_0x592c('0x29')](_0x5477d9[_0x592c('0x2b')]);_0x2db637[_0x592c('0x34')]=_[_0x592c('0x2a')](_0x2db637[_0x592c('0x28')],_0x2db637[_0x592c('0x2b')]);_0x3fee88[_0x592c('0x2c')]=_[_0x592c('0x2a')](_0x2db637['model'],qs['fields'](_0x5477d9['query']['fields']));_0x3fee88[_0x592c('0x2c')]=_0x3fee88['attributes'][_0x592c('0x2e')]?_0x3fee88[_0x592c('0x2c')]:_0x2db637[_0x592c('0x28')];if(_0x5477d9[_0x592c('0x2b')][_0x592c('0x3a')]){_0x3fee88[_0x592c('0x3b')]=[{'all':!![]}];}_0x3fee88=_[_0x592c('0x36')]({},_0x3fee88,_0x5477d9[_0x592c('0x41')]);return db[_0x592c('0x39')]['find'](_0x3fee88)[_0x592c('0x22')](handleEntityNotFound(_0x559480,null))[_0x592c('0x22')](respondWithResult(_0x559480,null))[_0x592c('0x3e')](handleError(_0x559480,null));};exports[_0x592c('0x42')]=function(_0x4dbd59,_0x59bf59){return db[_0x592c('0x39')][_0x592c('0x42')](_0x4dbd59[_0x592c('0x43')],{})[_0x592c('0x22')](function(_0x2ead30){var _0x118c5c=_0x4dbd59['user'][_0x592c('0x44')]({'plain':!![]});if(!_0x118c5c)throw new Error(_0x592c('0x45'));if(_0x118c5c[_0x592c('0x46')]==='user'){var _0x37f482=_0x2ead30[_0x592c('0x44')]({'plain':!![]});var _0x3af676=_0x592c('0x47');return db[_0x592c('0x48')][_0x592c('0x49')]({'where':{'name':_0x3af676,'userProfileId':_0x118c5c['userProfileId']},'raw':!![]})[_0x592c('0x22')](function(_0xaa9bdb){if(_0xaa9bdb&&_0xaa9bdb['autoAssociation']===0x0){return db[_0x592c('0x24')][_0x592c('0x42')]({'name':_0x37f482[_0x592c('0x25')],'resourceId':_0x37f482['id'],'type':_0xaa9bdb['name'],'sectionId':_0xaa9bdb['id']},{})['then'](function(){return _0x2ead30;});}else{return _0x2ead30;}})[_0x592c('0x3e')](function(_0x1077b4){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1077b4);throw _0x1077b4;});}return _0x2ead30;})[_0x592c('0x22')](respondWithResult(_0x59bf59,0xc9))[_0x592c('0x3e')](handleError(_0x59bf59,null));};exports['update']=function(_0xed0663,_0x596e18){if(_0xed0663['body']['id']){delete _0xed0663['body']['id'];}return db[_0x592c('0x39')]['find']({'where':{'id':_0xed0663['params']['id']}})[_0x592c('0x22')](handleEntityNotFound(_0x596e18,null))[_0x592c('0x22')](saveUpdates(_0xed0663[_0x592c('0x43')],null))[_0x592c('0x22')](respondWithResult(_0x596e18,null))[_0x592c('0x3e')](handleError(_0x596e18,null));};exports[_0x592c('0x23')]=function(_0x1a12b7,_0x42d73c){return db[_0x592c('0x39')][_0x592c('0x49')]({'where':{'id':_0x1a12b7[_0x592c('0x3f')]['id']}})[_0x592c('0x22')](handleEntityNotFound(_0x42d73c,null))[_0x592c('0x22')](removeEntity(_0x42d73c,null))[_0x592c('0x3e')](handleError(_0x42d73c,null));};exports[_0x592c('0x27')]=function(_0x971ed0,_0x1235a8){return db[_0x592c('0x39')]['describe']()[_0x592c('0x22')](respondWithResult(_0x1235a8,null))[_0x592c('0x3e')](handleError(_0x1235a8,null));};exports[_0x592c('0x4a')]=function(_0x2001c6,_0x36a21f,_0x216178){return db[_0x592c('0x4b')][_0x592c('0x49')]({'where':{'id':_0x2001c6[_0x592c('0x3f')]['id']}})[_0x592c('0x22')](handleEntityNotFound(_0x36a21f,null))[_0x592c('0x22')](function(_0x53e01c){if(_0x53e01c){return _0x53e01c['addContacts'](_0x2001c6[_0x592c('0x43')][_0x592c('0x4c')],_[_0x592c('0x4d')](_0x2001c6['body'],[_0x592c('0x4c'),'id'])||{});}})[_0x592c('0x22')](respondWithResult(_0x36a21f,null))[_0x592c('0x3e')](handleError(_0x36a21f,null));};exports[_0x592c('0x4e')]=function(_0x16ee9f,_0x20c874,_0x216a1c){var _0xbcab10={};var _0x3fc9a8={};var _0x425025;var _0x5afbed;return db['CmCompany'][_0x592c('0x4f')]({'where':{'id':_0x16ee9f[_0x592c('0x3f')]['id']}})[_0x592c('0x22')](handleEntityNotFound(_0x20c874,null))[_0x592c('0x22')](function(_0x5cc0b3){if(_0x5cc0b3){_0x425025=_0x5cc0b3;_0x3fc9a8[_0x592c('0x28')]=_[_0x592c('0x29')](db[_0x592c('0x4b')][_0x592c('0x40')]);_0x3fc9a8['query']=_[_0x592c('0x29')](_0x16ee9f[_0x592c('0x2b')]);_0x3fc9a8['filters']=_['intersection'](_0x3fc9a8['model'],_0x3fc9a8['query']);_0xbcab10[_0x592c('0x2c')]=_[_0x592c('0x2a')](_0x3fc9a8[_0x592c('0x28')],qs['fields'](_0x16ee9f[_0x592c('0x2b')][_0x592c('0x2d')]));_0xbcab10[_0x592c('0x2c')]=_0xbcab10[_0x592c('0x2c')][_0x592c('0x2e')]?_0xbcab10['attributes']:_0x3fc9a8[_0x592c('0x28')];_0xbcab10[_0x592c('0x31')]=qs[_0x592c('0x32')](_0x16ee9f[_0x592c('0x2b')][_0x592c('0x32')]);_0xbcab10['where']=qs['filters'](_['pick'](_0x16ee9f[_0x592c('0x2b')],_0x3fc9a8[_0x592c('0x34')]));if(_0x16ee9f[_0x592c('0x2b')][_0x592c('0x38')]){_0xbcab10[_0x592c('0x33')]=_[_0x592c('0x36')](_0xbcab10[_0x592c('0x33')],{'$or':_['map'](_0xbcab10[_0x592c('0x2c')],function(_0x57bcfb){var _0x487454={};_0x487454[_0x57bcfb]={'$like':'%'+_0x16ee9f[_0x592c('0x2b')]['filter']+'%'};return _0x487454;})});}_0xbcab10=_[_0x592c('0x36')]({},_0xbcab10,_0x16ee9f[_0x592c('0x41')]);return _0x425025[_0x592c('0x4e')](_0xbcab10);}})[_0x592c('0x22')](function(_0x56d07e){if(_0x56d07e){_0x5afbed=_0x56d07e[_0x592c('0x2e')];if(!_0x16ee9f[_0x592c('0x2b')][_0x592c('0x2f')](_0x592c('0x30'))){_0xbcab10[_0x592c('0x19')]=qs['limit'](_0x16ee9f[_0x592c('0x2b')][_0x592c('0x19')]);_0xbcab10[_0x592c('0x1c')]=qs['offset'](_0x16ee9f['query'][_0x592c('0x1c')]);}return _0x425025[_0x592c('0x4e')](_0xbcab10);}})[_0x592c('0x22')](function(_0x5176ec){if(_0x5176ec){return _0x5176ec?{'count':_0x5afbed,'rows':_0x5176ec}:null;}})[_0x592c('0x22')](respondWithResult(_0x20c874,null))[_0x592c('0x3e')](handleError(_0x20c874,null));}; \ No newline at end of file +var _0x0854=['where','pick','filter','merge','map','options','include','findAll','rows','catch','show','rawAttributes','intersection','length','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','CmContact','addContacts','ids','omit','findOne','order','getContacts','eml-format','rimraf','fast-json-patch','moment','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','destroy','then','Companies','UserProfileResource','error','name','send','index','CmCompany','describe','model','keys','query','filters','attributes','fields','hasOwnProperty','nolimit','sort'];(function(_0x3fd782,_0x86863){var _0x2bef90=function(_0x1301ce){while(--_0x1301ce){_0x3fd782['push'](_0x3fd782['shift']());}};_0x2bef90(++_0x86863);}(_0x0854,0x168));var _0x4085=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x0854[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x4085('0x0'));var rimraf=require(_0x4085('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4085('0x2'));var rp=require('request-promise');var moment=require(_0x4085('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4085('0x4'));var util=require('util');var path=require('path');var sox=require(_0x4085('0x5'));var csv=require('to-csv');var ejs=require(_0x4085('0x6'));var fs=require('fs');var fs_extra=require(_0x4085('0x7'));var _=require(_0x4085('0x8'));var squel=require(_0x4085('0x9'));var crypto=require(_0x4085('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x4085('0xb'));var toCsv=require('to-csv');var querystring=require(_0x4085('0xc'));var Papa=require(_0x4085('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4085('0xe'));var as=require(_0x4085('0xf'));var hardwareService=require(_0x4085('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x4085('0x11'));var config=require(_0x4085('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x4085('0x13'))['db'];function respondWithStatusCode(_0x2a388e,_0x2285ab){_0x2285ab=_0x2285ab||0xcc;return function(_0x3d6f3c){if(_0x3d6f3c){return _0x2a388e['sendStatus'](_0x2285ab);}return _0x2a388e[_0x4085('0x14')](_0x2285ab)[_0x4085('0x15')]();};}function respondWithResult(_0x6e810,_0x54d3a8){_0x54d3a8=_0x54d3a8||0xc8;return function(_0x2a8b53){if(_0x2a8b53){return _0x6e810['status'](_0x54d3a8)[_0x4085('0x16')](_0x2a8b53);}};}function respondWithFilteredResult(_0x1d3371,_0x20231c){return function(_0x3baafc){if(_0x3baafc){var _0x117546=typeof _0x20231c[_0x4085('0x17')]===_0x4085('0x18')&&typeof _0x20231c[_0x4085('0x19')]==='undefined';var _0x461d81=_0x3baafc[_0x4085('0x1a')];var _0x218411=_0x117546?0x0:_0x20231c[_0x4085('0x17')];var _0x5041df=_0x117546?_0x3baafc[_0x4085('0x1a')]:_0x20231c[_0x4085('0x17')]+_0x20231c[_0x4085('0x19')];var _0x6124c7;if(_0x5041df>=_0x461d81){_0x5041df=_0x461d81;_0x6124c7=0xc8;}else{_0x6124c7=0xce;}_0x1d3371[_0x4085('0x14')](_0x6124c7);return _0x1d3371[_0x4085('0x1b')](_0x4085('0x1c'),_0x218411+'-'+_0x5041df+'/'+_0x461d81)[_0x4085('0x16')](_0x3baafc);}return null;};}function patchUpdates(_0x3227da){return function(_0x2c1ca7){try{jsonpatch['apply'](_0x2c1ca7,_0x3227da,!![]);}catch(_0x5edd2f){return BPromise['reject'](_0x5edd2f);}return _0x2c1ca7[_0x4085('0x1d')]();};}function saveUpdates(_0x5326c0,_0x4b1a2a){return function(_0x338dc5){if(_0x338dc5){return _0x338dc5[_0x4085('0x1e')](_0x5326c0)['then'](function(_0x5c165e){return _0x5c165e;});}return null;};}function removeEntity(_0x553b90,_0x5b7d30){return function(_0x4b9f9b){if(_0x4b9f9b){return _0x4b9f9b[_0x4085('0x1f')]()[_0x4085('0x20')](function(){var _0x444ad2=_0x4b9f9b['get']({'plain':!![]});var _0x82fa77=_0x4085('0x21');return db[_0x4085('0x22')]['destroy']({'where':{'type':_0x82fa77,'resourceId':_0x444ad2['id']}})[_0x4085('0x20')](function(){return _0x4b9f9b;});})[_0x4085('0x20')](function(){_0x553b90[_0x4085('0x14')](0xcc)[_0x4085('0x15')]();});}};}function handleEntityNotFound(_0x328386,_0x5dc080){return function(_0x42c8e1){if(!_0x42c8e1){_0x328386['sendStatus'](0x194);}return _0x42c8e1;};}function handleError(_0x139823,_0x4aca23){_0x4aca23=_0x4aca23||0x1f4;return function(_0x48118a){logger[_0x4085('0x23')](_0x48118a['stack']);if(_0x48118a[_0x4085('0x24')]){delete _0x48118a[_0x4085('0x24')];}_0x139823[_0x4085('0x14')](_0x4aca23)[_0x4085('0x25')](_0x48118a);};}exports[_0x4085('0x26')]=function(_0x10e2a0,_0x47cabd){var _0x882601={},_0x24b67a={},_0x6326f8={'count':0x0,'rows':[]};return db[_0x4085('0x27')][_0x4085('0x28')]()[_0x4085('0x20')](function(_0x35d960){_0x24b67a[_0x4085('0x29')]=_[_0x4085('0x2a')](_0x35d960);_0x24b67a[_0x4085('0x2b')]=_[_0x4085('0x2a')](_0x10e2a0[_0x4085('0x2b')]);_0x24b67a[_0x4085('0x2c')]=_['intersection'](_0x24b67a[_0x4085('0x29')],_0x24b67a[_0x4085('0x2b')]);_0x882601[_0x4085('0x2d')]=_['intersection'](_0x24b67a[_0x4085('0x29')],qs[_0x4085('0x2e')](_0x10e2a0[_0x4085('0x2b')]['fields']));_0x882601[_0x4085('0x2d')]=_0x882601[_0x4085('0x2d')]['length']?_0x882601[_0x4085('0x2d')]:_0x24b67a[_0x4085('0x29')];if(!_0x10e2a0[_0x4085('0x2b')][_0x4085('0x2f')](_0x4085('0x30'))){_0x882601[_0x4085('0x19')]=qs[_0x4085('0x19')](_0x10e2a0[_0x4085('0x2b')][_0x4085('0x19')]);_0x882601['offset']=qs[_0x4085('0x17')](_0x10e2a0[_0x4085('0x2b')]['offset']);}_0x882601['order']=qs['sort'](_0x10e2a0[_0x4085('0x2b')][_0x4085('0x31')]);_0x882601[_0x4085('0x32')]=qs[_0x4085('0x2c')](_[_0x4085('0x33')](_0x10e2a0[_0x4085('0x2b')],_0x24b67a[_0x4085('0x2c')]),_0x35d960);if(_0x10e2a0[_0x4085('0x2b')][_0x4085('0x34')]){_0x882601[_0x4085('0x32')]=_[_0x4085('0x35')](_0x882601[_0x4085('0x32')],{'$or':_[_0x4085('0x36')](_0x882601[_0x4085('0x2d')],function(_0x5c821f){var _0x464579={};_0x464579[_0x5c821f]={'$like':'%'+_0x10e2a0[_0x4085('0x2b')]['filter']+'%'};return _0x464579;})});}_0x882601=_[_0x4085('0x35')]({},_0x882601,_0x10e2a0[_0x4085('0x37')]);var _0x23565c={'where':_0x882601[_0x4085('0x32')]};return db['CmCompany'][_0x4085('0x1a')](_0x23565c)[_0x4085('0x20')](function(_0x4a21ca){_0x6326f8[_0x4085('0x1a')]=_0x4a21ca;if(_0x10e2a0[_0x4085('0x2b')]['includeAll']){_0x882601[_0x4085('0x38')]=[{'all':!![]}];}return db[_0x4085('0x27')][_0x4085('0x39')](_0x882601);})[_0x4085('0x20')](function(_0x54e255){_0x6326f8[_0x4085('0x3a')]=_0x54e255;return _0x6326f8;})[_0x4085('0x20')](respondWithFilteredResult(_0x47cabd,_0x882601))[_0x4085('0x3b')](handleError(_0x47cabd,null));})['catch'](handleError(_0x47cabd,null));};exports[_0x4085('0x3c')]=function(_0x35a58f,_0x962f34){var _0x58f74e={'raw':![],'where':{'id':_0x35a58f['params']['id']}},_0x4c0d6b={};_0x4c0d6b[_0x4085('0x29')]=_[_0x4085('0x2a')](db[_0x4085('0x27')][_0x4085('0x3d')]);_0x4c0d6b[_0x4085('0x2b')]=_[_0x4085('0x2a')](_0x35a58f[_0x4085('0x2b')]);_0x4c0d6b[_0x4085('0x2c')]=_['intersection'](_0x4c0d6b['model'],_0x4c0d6b[_0x4085('0x2b')]);_0x58f74e['attributes']=_[_0x4085('0x3e')](_0x4c0d6b[_0x4085('0x29')],qs['fields'](_0x35a58f[_0x4085('0x2b')]['fields']));_0x58f74e[_0x4085('0x2d')]=_0x58f74e[_0x4085('0x2d')][_0x4085('0x3f')]?_0x58f74e[_0x4085('0x2d')]:_0x4c0d6b[_0x4085('0x29')];if(_0x35a58f[_0x4085('0x2b')][_0x4085('0x40')]){_0x58f74e[_0x4085('0x38')]=[{'all':!![]}];}_0x58f74e=_[_0x4085('0x35')]({},_0x58f74e,_0x35a58f[_0x4085('0x37')]);return db[_0x4085('0x27')][_0x4085('0x41')](_0x58f74e)[_0x4085('0x20')](handleEntityNotFound(_0x962f34,null))['then'](respondWithResult(_0x962f34,null))[_0x4085('0x3b')](handleError(_0x962f34,null));};exports[_0x4085('0x42')]=function(_0x9f030f,_0xbd228e){return db[_0x4085('0x27')]['create'](_0x9f030f[_0x4085('0x43')],{})[_0x4085('0x20')](function(_0x2ddfaa){var _0x47c575=_0x9f030f[_0x4085('0x44')][_0x4085('0x45')]({'plain':!![]});if(!_0x47c575)throw new Error(_0x4085('0x46'));if(_0x47c575[_0x4085('0x47')]===_0x4085('0x44')){var _0x3567c5=_0x2ddfaa[_0x4085('0x45')]({'plain':!![]});var _0x5b868e='Companies';return db[_0x4085('0x48')][_0x4085('0x41')]({'where':{'name':_0x5b868e,'userProfileId':_0x47c575['userProfileId']},'raw':!![]})[_0x4085('0x20')](function(_0x4d8597){if(_0x4d8597&&_0x4d8597['autoAssociation']===0x0){return db[_0x4085('0x22')]['create']({'name':_0x3567c5[_0x4085('0x24')],'resourceId':_0x3567c5['id'],'type':_0x4d8597[_0x4085('0x24')],'sectionId':_0x4d8597['id']},{})['then'](function(){return _0x2ddfaa;});}else{return _0x2ddfaa;}})[_0x4085('0x3b')](function(_0x4b1503){logger[_0x4085('0x23')](_0x4085('0x49'),_0x4b1503);throw _0x4b1503;});}return _0x2ddfaa;})[_0x4085('0x20')](respondWithResult(_0xbd228e,0xc9))['catch'](handleError(_0xbd228e,null));};exports[_0x4085('0x1e')]=function(_0xb40a8a,_0x24019b){if(_0xb40a8a[_0x4085('0x43')]['id']){delete _0xb40a8a[_0x4085('0x43')]['id'];}return db[_0x4085('0x27')][_0x4085('0x41')]({'where':{'id':_0xb40a8a['params']['id']}})[_0x4085('0x20')](handleEntityNotFound(_0x24019b,null))[_0x4085('0x20')](saveUpdates(_0xb40a8a[_0x4085('0x43')],null))[_0x4085('0x20')](respondWithResult(_0x24019b,null))[_0x4085('0x3b')](handleError(_0x24019b,null));};exports[_0x4085('0x1f')]=function(_0x389a6c,_0x1a9027){return db['CmCompany']['find']({'where':{'id':_0x389a6c[_0x4085('0x4a')]['id']}})[_0x4085('0x20')](handleEntityNotFound(_0x1a9027,null))[_0x4085('0x20')](removeEntity(_0x1a9027,null))['catch'](handleError(_0x1a9027,null));};exports[_0x4085('0x28')]=function(_0x1f2d1d,_0x4835b0){return db[_0x4085('0x27')][_0x4085('0x28')]()[_0x4085('0x20')](respondWithResult(_0x4835b0,null))[_0x4085('0x3b')](handleError(_0x4835b0,null));};exports['addContacts']=function(_0x33b685,_0x134ebd,_0x5838a1){return db[_0x4085('0x4b')]['find']({'where':{'id':_0x33b685['params']['id']}})[_0x4085('0x20')](handleEntityNotFound(_0x134ebd,null))[_0x4085('0x20')](function(_0x3cf41a){if(_0x3cf41a){return _0x3cf41a[_0x4085('0x4c')](_0x33b685[_0x4085('0x43')][_0x4085('0x4d')],_[_0x4085('0x4e')](_0x33b685[_0x4085('0x43')],[_0x4085('0x4d'),'id'])||{});}})[_0x4085('0x20')](respondWithResult(_0x134ebd,null))[_0x4085('0x3b')](handleError(_0x134ebd,null));};exports['getContacts']=function(_0x34846e,_0x4905e5,_0x49c211){var _0x5edf7c={};var _0x377005={};var _0x76838a;var _0x451c16;return db[_0x4085('0x27')][_0x4085('0x4f')]({'where':{'id':_0x34846e[_0x4085('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4905e5,null))[_0x4085('0x20')](function(_0x2c5b81){if(_0x2c5b81){_0x76838a=_0x2c5b81;_0x377005[_0x4085('0x29')]=_[_0x4085('0x2a')](db[_0x4085('0x4b')][_0x4085('0x3d')]);_0x377005[_0x4085('0x2b')]=_[_0x4085('0x2a')](_0x34846e['query']);_0x377005[_0x4085('0x2c')]=_['intersection'](_0x377005[_0x4085('0x29')],_0x377005[_0x4085('0x2b')]);_0x5edf7c['attributes']=_[_0x4085('0x3e')](_0x377005['model'],qs['fields'](_0x34846e[_0x4085('0x2b')][_0x4085('0x2e')]));_0x5edf7c[_0x4085('0x2d')]=_0x5edf7c['attributes']['length']?_0x5edf7c[_0x4085('0x2d')]:_0x377005[_0x4085('0x29')];_0x5edf7c[_0x4085('0x50')]=qs['sort'](_0x34846e[_0x4085('0x2b')][_0x4085('0x31')]);_0x5edf7c[_0x4085('0x32')]=qs[_0x4085('0x2c')](_[_0x4085('0x33')](_0x34846e[_0x4085('0x2b')],_0x377005[_0x4085('0x2c')]));if(_0x34846e['query']['filter']){_0x5edf7c[_0x4085('0x32')]=_[_0x4085('0x35')](_0x5edf7c[_0x4085('0x32')],{'$or':_[_0x4085('0x36')](_0x5edf7c['attributes'],function(_0x2a6d77){var _0x4b3c7b={};_0x4b3c7b[_0x2a6d77]={'$like':'%'+_0x34846e['query'][_0x4085('0x34')]+'%'};return _0x4b3c7b;})});}_0x5edf7c=_[_0x4085('0x35')]({},_0x5edf7c,_0x34846e[_0x4085('0x37')]);return _0x76838a[_0x4085('0x51')](_0x5edf7c);}})[_0x4085('0x20')](function(_0x522ca3){if(_0x522ca3){_0x451c16=_0x522ca3[_0x4085('0x3f')];if(!_0x34846e[_0x4085('0x2b')][_0x4085('0x2f')](_0x4085('0x30'))){_0x5edf7c[_0x4085('0x19')]=qs[_0x4085('0x19')](_0x34846e[_0x4085('0x2b')][_0x4085('0x19')]);_0x5edf7c[_0x4085('0x17')]=qs[_0x4085('0x17')](_0x34846e[_0x4085('0x2b')]['offset']);}return _0x76838a['getContacts'](_0x5edf7c);}})['then'](function(_0x5785ed){if(_0x5785ed){return _0x5785ed?{'count':_0x451c16,'rows':_0x5785ed}:null;}})['then'](respondWithResult(_0x4905e5,null))['catch'](handleError(_0x4905e5,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index b55acbe..e3d7439 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 _0xf1ab=['./cmCompany.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x5ee2db,_0x47ea25){var _0x2cab07=function(_0x4643f7){while(--_0x4643f7){_0x5ee2db['push'](_0x5ee2db['shift']());}};_0x2cab07(++_0x47ea25);}(_0xf1ab,0x1cf));var _0xbf1a=function(_0xc0b0dc,_0x575b4d){_0xc0b0dc=_0xc0b0dc-0x0;var _0x20e68e=_0xf1ab[_0xc0b0dc];return _0x20e68e;};'use strict';var _=require(_0xbf1a('0x0'));var util=require('util');var logger=require(_0xbf1a('0x1'))(_0xbf1a('0x2'));var moment=require(_0xbf1a('0x3'));var BPromise=require(_0xbf1a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbf1a('0x5'));var rimraf=require('rimraf');var config=require(_0xbf1a('0x6'));var attributes=require(_0xbf1a('0x7'));module[_0xbf1a('0x8')]=function(_0x58e991,_0x548486){return _0x58e991[_0xbf1a('0x9')]('CmCompany',attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x174d=['request-promise','path','./cmCompany.attributes','exports','define','CmCompany','cm_companies','util','../../config/logger','api','moment'];(function(_0xe83ac5,_0x279b67){var _0x3df16e=function(_0x5a1577){while(--_0x5a1577){_0xe83ac5['push'](_0xe83ac5['shift']());}};_0x3df16e(++_0x279b67);}(_0x174d,0x1ca));var _0xd174=function(_0x4b9e48,_0x3e80f9){_0x4b9e48=_0x4b9e48-0x0;var _0x26fdc4=_0x174d[_0x4b9e48];return _0x26fdc4;};'use strict';var _=require('lodash');var util=require(_0xd174('0x0'));var logger=require(_0xd174('0x1'))(_0xd174('0x2'));var moment=require(_0xd174('0x3'));var BPromise=require('bluebird');var rp=require(_0xd174('0x4'));var fs=require('fs');var path=require(_0xd174('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd174('0x6'));module[_0xd174('0x7')]=function(_0x39df8f,_0x724d48){return _0x39df8f[_0xd174('0x8')](_0xd174('0x9'),attributes,{'tableName':_0xd174('0xa'),'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 6bd01e3..3a655e7 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 _0x148b=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','bluebird','ioredis'];(function(_0x1a12c8,_0x2df4dc){var _0x305109=function(_0x438bfb){while(--_0x438bfb){_0x1a12c8['push'](_0x1a12c8['shift']());}};_0x305109(++_0x2df4dc);}(_0x148b,0x179));var _0xb148=function(_0x1bafe3,_0x2a22aa){_0x1bafe3=_0x1bafe3-0x0;var _0x15c0d3=_0x148b[_0x1bafe3];return _0x15c0d3;};'use strict';var _=require(_0xb148('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb148('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb148('0x2'));var db=require(_0xb148('0x3'))['db'];var utils=require(_0xb148('0x4'));var logger=require(_0xb148('0x5'))(_0xb148('0x6'));var config=require(_0xb148('0x7'));var jayson=require(_0xb148('0x8'));var client=jayson[_0xb148('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5abc46,_0x146e06,_0x16132f){return new BPromise(function(_0x26839b,_0x3aab04){return client['request'](_0x5abc46,_0x16132f)['then'](function(_0x358bfb){logger[_0xb148('0xa')](_0xb148('0xb'),_0x146e06,_0xb148('0xc'));logger[_0xb148('0xd')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x146e06,'request\x20sent',JSON['stringify'](_0x358bfb));if(_0x358bfb[_0xb148('0xe')]){if(_0x358bfb['error'][_0xb148('0xf')]===0x1f4){logger[_0xb148('0xe')](_0xb148('0xb'),_0x146e06,_0x358bfb[_0xb148('0xe')][_0xb148('0x10')]);return _0x3aab04(_0x358bfb[_0xb148('0xe')]['message']);}logger[_0xb148('0xe')]('CmCompany,\x20%s,\x20%s',_0x146e06,_0x358bfb['error'][_0xb148('0x10')]);return _0x26839b(_0x358bfb[_0xb148('0xe')][_0xb148('0x10')]);}else{logger[_0xb148('0xa')](_0xb148('0xb'),_0x146e06,_0xb148('0xc'));_0x26839b(_0x358bfb[_0xb148('0x11')][_0xb148('0x10')]);}})[_0xb148('0x12')](function(_0x2a39cd){logger[_0xb148('0xe')](_0xb148('0xb'),_0x146e06,_0x2a39cd);_0x3aab04(_0x2a39cd);});});} \ No newline at end of file +var _0x26b5=['../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info','CmCompany,\x20%s,\x20%s','debug','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x26b5,0xf8));var _0x526b=function(_0x39396d,_0x17465a){_0x39396d=_0x39396d-0x0;var _0x15eb10=_0x26b5[_0x39396d];return _0x15eb10;};'use strict';var _=require(_0x526b('0x0'));var util=require(_0x526b('0x1'));var moment=require(_0x526b('0x2'));var BPromise=require(_0x526b('0x3'));var rs=require(_0x526b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x526b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x526b('0x6'))(_0x526b('0x7'));var config=require('../../config/environment');var jayson=require(_0x526b('0x8'));var client=jayson['client'][_0x526b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3f8b07,_0x1225c3,_0x5d0c39){return new BPromise(function(_0x44d2cc,_0x459a44){return client[_0x526b('0xa')](_0x3f8b07,_0x5d0c39)[_0x526b('0xb')](function(_0x311413){logger[_0x526b('0xc')](_0x526b('0xd'),_0x1225c3,'request\x20sent');logger[_0x526b('0xe')](_0x526b('0xf'),_0x1225c3,_0x526b('0x10'),JSON[_0x526b('0x11')](_0x311413));if(_0x311413['error']){if(_0x311413[_0x526b('0x12')][_0x526b('0x13')]===0x1f4){logger[_0x526b('0x12')](_0x526b('0xd'),_0x1225c3,_0x311413[_0x526b('0x12')][_0x526b('0x14')]);return _0x459a44(_0x311413[_0x526b('0x12')][_0x526b('0x14')]);}logger[_0x526b('0x12')](_0x526b('0xd'),_0x1225c3,_0x311413[_0x526b('0x12')]['message']);return _0x44d2cc(_0x311413[_0x526b('0x12')]['message']);}else{logger['info'](_0x526b('0xd'),_0x1225c3,_0x526b('0x10'));_0x44d2cc(_0x311413[_0x526b('0x15')]['message']);}})[_0x526b('0x16')](function(_0x5c3611){logger[_0x526b('0x12')](_0x526b('0xd'),_0x1225c3,_0x5c3611);_0x459a44(_0x5c3611);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 99116a9..38231fe 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 _0x6a55=['express','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/contacts','getContacts','post','create','addContacts','put','/:id','update','destroy','exports','multer'];(function(_0x42ffa2,_0x4b3b89){var _0x281f01=function(_0x101e47){while(--_0x101e47){_0x42ffa2['push'](_0x42ffa2['shift']());}};_0x281f01(++_0x4b3b89);}(_0x6a55,0xdb));var _0x56a5=function(_0x1a7e4b,_0x2fbd40){_0x1a7e4b=_0x1a7e4b-0x0;var _0x37a8fd=_0x6a55[_0x1a7e4b];return _0x37a8fd;};'use strict';var multer=require(_0x56a5('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x56a5('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x56a5('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x56a5('0x3'));var controller=require('./cmCompany.controller');router[_0x56a5('0x4')]('/',auth[_0x56a5('0x5')](),controller[_0x56a5('0x6')]);router[_0x56a5('0x4')](_0x56a5('0x7'),auth[_0x56a5('0x5')](),controller[_0x56a5('0x8')]);router[_0x56a5('0x4')]('/:id',auth[_0x56a5('0x5')](),controller[_0x56a5('0x9')]);router[_0x56a5('0x4')](_0x56a5('0xa'),auth[_0x56a5('0x5')](),controller[_0x56a5('0xb')]);router[_0x56a5('0xc')]('/',auth[_0x56a5('0x5')](),controller[_0x56a5('0xd')]);router['post']('/:id/contacts',auth[_0x56a5('0x5')](),controller[_0x56a5('0xe')]);router[_0x56a5('0xf')](_0x56a5('0x10'),auth[_0x56a5('0x5')](),controller[_0x56a5('0x11')]);router['delete']('/:id',auth[_0x56a5('0x5')](),controller[_0x56a5('0x12')]);module[_0x56a5('0x13')]=router; \ No newline at end of file +var _0xc9d7=['create','/:id/contacts','addContacts','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','show','post'];(function(_0x20702a,_0x424179){var _0x350cd7=function(_0x55679c){while(--_0x55679c){_0x20702a['push'](_0x20702a['shift']());}};_0x350cd7(++_0x424179);}(_0xc9d7,0x110));var _0x7c9d=function(_0x382a62,_0x1baa5e){_0x382a62=_0x382a62-0x0;var _0x490a25=_0xc9d7[_0x382a62];return _0x490a25;};'use strict';var multer=require(_0x7c9d('0x0'));var util=require(_0x7c9d('0x1'));var path=require(_0x7c9d('0x2'));var timeout=require(_0x7c9d('0x3'));var express=require(_0x7c9d('0x4'));var router=express[_0x7c9d('0x5')]();var fs_extra=require(_0x7c9d('0x6'));var auth=require(_0x7c9d('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x7c9d('0x8'));var controller=require(_0x7c9d('0x9'));router[_0x7c9d('0xa')]('/',auth[_0x7c9d('0xb')](),controller[_0x7c9d('0xc')]);router['get'](_0x7c9d('0xd'),auth[_0x7c9d('0xb')](),controller['describe']);router[_0x7c9d('0xa')]('/:id',auth[_0x7c9d('0xb')](),controller[_0x7c9d('0xe')]);router[_0x7c9d('0xa')]('/:id/contacts',auth['isAuthenticated'](),controller['getContacts']);router[_0x7c9d('0xf')]('/',auth[_0x7c9d('0xb')](),controller[_0x7c9d('0x10')]);router[_0x7c9d('0xf')](_0x7c9d('0x11'),auth['isAuthenticated'](),controller[_0x7c9d('0x12')]);router['put'](_0x7c9d('0x13'),auth[_0x7c9d('0xb')](),controller[_0x7c9d('0x14')]);router[_0x7c9d('0x15')](_0x7c9d('0x13'),auth[_0x7c9d('0xb')](),controller[_0x7c9d('0x16')]);module[_0x7c9d('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index a218c78..a3ff238 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 _0x72c4=['TEXT','INTEGER','UNSIGNED','DATE','sequelize','exports','STRING'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x72c4,0x162));var _0x472c=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x72c4[_0x618414];return _0x21c19a;};'use strict';var _=require('lodash');var Sequelize=require(_0x472c('0x0'));module[_0x472c('0x1')]={'firstName':{'type':Sequelize[_0x472c('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x472c('0x2')]},'street':{'type':Sequelize[_0x472c('0x2')]},'postalCode':{'type':Sequelize[_0x472c('0x2')]},'city':{'type':Sequelize[_0x472c('0x2')]},'country':{'type':Sequelize[_0x472c('0x2')]},'dateOfBirth':{'type':Sequelize[_0x472c('0x2')]},'description':{'type':Sequelize[_0x472c('0x3')]},'phone':{'type':Sequelize[_0x472c('0x2')]},'mobile':{'type':Sequelize[_0x472c('0x2')]},'fax':{'type':Sequelize[_0x472c('0x2')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0x472c('0x2')]},'twitter':{'type':Sequelize[_0x472c('0x2')]},'skype':{'type':Sequelize[_0x472c('0x2')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x472c('0x2')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x472c('0x2')]},'telegram':{'type':Sequelize[_0x472c('0x2')]},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize[_0x472c('0x4')](0x2)[_0x472c('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x472c('0x6')],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xa9f9=['NOW','lodash','exports','STRING','TEXT','INTEGER','UNSIGNED','DATE'];(function(_0x28ac4f,_0x3e9885){var _0x501804=function(_0x45379e){while(--_0x45379e){_0x28ac4f['push'](_0x28ac4f['shift']());}};_0x501804(++_0x3e9885);}(_0xa9f9,0x1b1));var _0x9a9f=function(_0x518849,_0x1b8936){_0x518849=_0x518849-0x0;var _0xc1829e=_0xa9f9[_0x518849];return _0xc1829e;};'use strict';var _=require(_0x9a9f('0x0'));var Sequelize=require('sequelize');module[_0x9a9f('0x1')]={'firstName':{'type':Sequelize[_0x9a9f('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x9a9f('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x9a9f('0x2')]},'city':{'type':Sequelize[_0x9a9f('0x2')]},'country':{'type':Sequelize[_0x9a9f('0x2')]},'dateOfBirth':{'type':Sequelize[_0x9a9f('0x2')]},'description':{'type':Sequelize[_0x9a9f('0x3')]},'phone':{'type':Sequelize[_0x9a9f('0x2')]},'mobile':{'type':Sequelize[_0x9a9f('0x2')]},'fax':{'type':Sequelize[_0x9a9f('0x2')]},'email':{'type':Sequelize[_0x9a9f('0x2')]},'url':{'type':Sequelize[_0x9a9f('0x2')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x9a9f('0x2')]},'skype':{'type':Sequelize[_0x9a9f('0x2')]},'teams':{'type':Sequelize[_0x9a9f('0x2')]},'viber':{'type':Sequelize[_0x9a9f('0x2')]},'line':{'type':Sequelize[_0x9a9f('0x2')]},'wechat':{'type':Sequelize[_0x9a9f('0x2')]},'telegram':{'type':Sequelize[_0x9a9f('0x2')]},'UserId':{'type':Sequelize[_0x9a9f('0x4')]},'priority':{'type':Sequelize[_0x9a9f('0x4')](0x2)[_0x9a9f('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x9a9f('0x6')],'defaultValue':Sequelize[_0x9a9f('0x7')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 5a1f8e8..400038b 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 _0x1af2=['intersection','options','nolimit','setTags','ids','getHoppers','ContactId','includeAll','rows','getHopperHistories','include','getHopperFinals','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','No\x20association\x20values\x20specified!','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_values','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','child_process','fork','pid','upload','createReadStream','import','binding','socket_timestamp','stringify','message','start\x20child\x20process\x20correctly!','exit','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','includes','channel','parse','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','type','source','destination','starttime','endtime','duration','note','createdAt','userSecondDisposition','userThirdDisposition','alias','findAndCountAll','startCase','Website','closed','closedAt','disposition','secondDisposition','thirdDisposition','UserId','Account','key','Owner','fullname','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingType','ratingValue','externalUrl','threadId','Interaction','flatten','sortBy','reverse','slice','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./cmContact.socket','register','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','describe','keys','length','startsWith','push','CmCustomField','findOne','cf_','all','fieldType','model','query','filters','fields','attributes','hasOwnProperty','limit','order','sort','where','pick','field','color','tools_tags','from','cm_contacts','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','left_join','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','sqlOperator','conditions','find','value','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','dateOfBirth','datetime','castTo','DATE','buildExpression','text','filter','Contact','isEmpty','c.ListId\x20IN\x20?','concat','\x20=\x20?','isArray','tag','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','c.email\x20LIKE\x20?','group','c.id','QueryTypes','DESC','t.id\x20IN\x20?','resolve','user','role','agent','User','c.ListId\x20IS\x20NULL','ListId','sequelize','c.firstName','c.lastName','c.phone','c.mobile','c.ListId','c.createdAt','c.deletedAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','catch','CmContact','params','tags','displayName','custom','values','columnName','merge','body','get','mergeWith','join','info','CmHopper','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappMessage','WhatsappQueueReport','create','bulkCreate','each','duplicates','$or','spread','Tag','$and','omit','format','cf_%d','findAll','pickBy','table','setFields','id\x20=\x20?','toParam','phone','getTags','rawAttributes'];(function(_0x3d3467,_0x26bf05){var _0x38b4c5=function(_0x2b5ebb){while(--_0x2b5ebb){_0x3d3467['push'](_0x3d3467['shift']());}};_0x38b4c5(++_0x26bf05);}(_0x1af2,0x18b));var _0x21af=function(_0x3144b3,_0x45f961){_0x3144b3=_0x3144b3-0x0;var _0x2517a9=_0x1af2[_0x3144b3];return _0x2517a9;};'use strict';var emlformat=require(_0x21af('0x0'));var rimraf=require(_0x21af('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x21af('0x2'));var rp=require(_0x21af('0x3'));var moment=require(_0x21af('0x4'));var BPromise=require(_0x21af('0x5'));var Mustache=require(_0x21af('0x6'));var util=require(_0x21af('0x7'));var path=require(_0x21af('0x8'));var sox=require(_0x21af('0x9'));var csv=require('to-csv');var ejs=require(_0x21af('0xa'));var fs=require('fs');var fs_extra=require(_0x21af('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x21af('0xc'));var jsforce=require(_0x21af('0xd'));var deskjs=require(_0x21af('0xe'));var toCsv=require(_0x21af('0xf'));var querystring=require(_0x21af('0x10'));var Papa=require(_0x21af('0x11'));var Redis=require(_0x21af('0x12'));var authService=require(_0x21af('0x13'));var qs=require(_0x21af('0x14'));var as=require(_0x21af('0x15'));var hardwareService=require(_0x21af('0x16'));var logger=require('../../config/logger')(_0x21af('0x17'));var utils=require('../../config/utils');var config=require(_0x21af('0x18'));var licenseUtil=require(_0x21af('0x19'));var db=require(_0x21af('0x1a'))['db'];config['redis']=_[_0x21af('0x1b')](config[_0x21af('0x1c')],{'host':_0x21af('0x1d'),'port':0x18eb});var socket=require(_0x21af('0x1e'))(new Redis(config[_0x21af('0x1c')]));require(_0x21af('0x1f'))[_0x21af('0x20')](socket);function respondWithStatusCode(_0x1206c6,_0x14d59e){_0x14d59e=_0x14d59e||0xcc;return function(_0x444ff4){if(_0x444ff4){return _0x1206c6[_0x21af('0x21')](_0x14d59e);}return _0x1206c6[_0x21af('0x22')](_0x14d59e)[_0x21af('0x23')]();};}function respondWithResult(_0x2b5c3e,_0x527471){_0x527471=_0x527471||0xc8;return function(_0x292bb2){if(_0x292bb2){return _0x2b5c3e[_0x21af('0x22')](_0x527471)[_0x21af('0x24')](_0x292bb2);}};}function respondWithFilteredResult(_0x567e93,_0x33dd9f){return function(_0x534bf9){if(_0x534bf9){var _0x132aa6=typeof _0x33dd9f[_0x21af('0x25')]===_0x21af('0x26')&&typeof _0x33dd9f['limit']==='undefined';var _0x4ef7ac=_0x534bf9[_0x21af('0x27')];var _0x525ce4=_0x132aa6?0x0:_0x33dd9f[_0x21af('0x25')];var _0x2e8ce5=_0x132aa6?_0x534bf9[_0x21af('0x27')]:_0x33dd9f[_0x21af('0x25')]+_0x33dd9f['limit'];var _0x5caff6;if(_0x2e8ce5>=_0x4ef7ac){_0x2e8ce5=_0x4ef7ac;_0x5caff6=0xc8;}else{_0x5caff6=0xce;}_0x567e93[_0x21af('0x22')](_0x5caff6);return _0x567e93['set'](_0x21af('0x28'),_0x525ce4+'-'+_0x2e8ce5+'/'+_0x4ef7ac)[_0x21af('0x24')](_0x534bf9);}return null;};}function patchUpdates(_0x4010b7){return function(_0x1daf11){try{jsonpatch[_0x21af('0x29')](_0x1daf11,_0x4010b7,!![]);}catch(_0x25a751){return BPromise['reject'](_0x25a751);}return _0x1daf11[_0x21af('0x2a')]();};}function saveUpdates(_0x15076f,_0x4b1524){return function(_0x36221f){if(_0x36221f){return _0x36221f[_0x21af('0x2b')](_0x15076f)[_0x21af('0x2c')](function(_0x39dd5c){return _0x39dd5c;});}return null;};}function removeEntity(_0x2321f1,_0x379511){return function(_0x33f101){if(_0x33f101){return _0x33f101[_0x21af('0x2d')]()['then'](function(){_0x2321f1[_0x21af('0x22')](0xcc)[_0x21af('0x23')]();});}};}function handleEntityNotFound(_0x5b5d11,_0x9a16ce){return function(_0x57006f){if(!_0x57006f){_0x5b5d11[_0x21af('0x21')](0x194);}return _0x57006f;};}function handleError(_0x234cad,_0x1c3f5f){_0x1c3f5f=_0x1c3f5f||0x1f4;return function(_0x33ad8f){logger[_0x21af('0x2e')](_0x33ad8f[_0x21af('0x2f')]);if(_0x33ad8f[_0x21af('0x30')]){delete _0x33ad8f[_0x21af('0x30')];}_0x234cad['status'](_0x1c3f5f)[_0x21af('0x31')](_0x33ad8f);};}exports[_0x21af('0x32')]=function(_0x262919,_0x394991){var _0x333f3d={},_0x334121={},_0x58558d={'count':0x0,'rows':[]};return db['CmContact'][_0x21af('0x33')]()[_0x21af('0x2c')](function(_0xd916bf){var _0x42f0e7=[];for(var _0x176d07=0x0;_0x176d070x1){_0x3ec984['or'](_0x21af('0x6f'),qs['getFullTextValue'](_0x2e6175),null);}else{if(qs['isNumeric'](_0x2e6175)){_0x3ec984['or'](_0x21af('0x70'),_0x2e6175+'%');_0x3ec984['or'](_0x21af('0x71'),_0x2e6175+'%');_0x3ec984['or'](_0x21af('0x72'),_0x2e6175+'%');_0x3ec984['or']('c.fax\x20LIKE\x20?',_0x2e6175+'%');}else if(qs['isEmail'](_0x2e6175)){_0x3ec984['or']('c.email\x20LIKE\x20?',_0x2e6175+'%');}else{_0x3ec984['or'](_0x21af('0x73'),'%'+_0x2e6175+'%');_0x3ec984['or'](_0x21af('0x74'),'%'+_0x2e6175+'%');_0x3ec984['or'](_0x21af('0x75'),'%'+_0x2e6175+'%');}}}}_0x469e6c[_0x21af('0x46')](_0x3ec984);_0x469e6c[_0x21af('0x76')](_0x21af('0x77'));var _0x5c6042={'type':db['Sequelize'][_0x21af('0x78')]['SELECT'],'raw':!![]};var _0xdebf5c=_0x469e6c['clone']()[_0x21af('0x48')](_0x21af('0x77'));if(_0x333f3d['order']){_0x333f3d[_0x21af('0x44')][_0x21af('0x5d')](function(_0xc907c){_0x469e6c[_0x21af('0x44')]('c.'+_0xc907c[0x0],_0xc907c[0x1]===_0x21af('0x79')?![]:!![]);});}if(!_[_0x21af('0x68')](_0x306871)){_0x469e6c['having'](_0x21c322);_0xdebf5c[_0x21af('0x46')](_0x21af('0x7a'),_0x306871);}BPromise[_0x21af('0x7b')]()[_0x21af('0x2c')](function(){if(!_0x1cfee3)return;if(_0x262919[_0x21af('0x7c')][_0x21af('0x7d')]!==_0x21af('0x7e'))return;if(!_['some'](_0x1cfee3[_0x21af('0x58')],['field',_0x21af('0x7f')])){return _0x262919[_0x21af('0x7c')]['getLists']({'attributes':['id'],'raw':!![]})['then'](function(_0x1fd4db){if(_[_0x21af('0x68')](_0x1fd4db)){_0xdebf5c['where'](_0x21af('0x80'));_0x469e6c[_0x21af('0x46')](_0x21af('0x80'));}else{_0xdebf5c[_0x21af('0x46')]('c.ListId\x20IN\x20?',_['map'](_0x1fd4db,'id'));_0x469e6c[_0x21af('0x46')]('c.ListId\x20IN\x20?',_['map'](_0x1fd4db,'id'));}});}})[_0x21af('0x2c')](function(){if(_0x262919[_0x21af('0x7c')][_0x21af('0x7d')]===_0x21af('0x7e')&&!_0x1cfee3&&!_0x262919[_0x21af('0x3e')][_0x21af('0x81')])return[];return db[_0x21af('0x82')]['query'](_0xdebf5c['toString'](),_0x5c6042);})[_0x21af('0x2c')](function(_0x103522){_0x58558d[_0x21af('0x27')]=_0x103522[_0x21af('0x35')];if(_0x58558d[_0x21af('0x27')]===0x0)return[];return db[_0x21af('0x82')][_0x21af('0x3e')](_0x2faec1['toString'](),_0x5c6042)[_0x21af('0x2c')](function(_0x4ad3fa){_0x35c381=_['keyBy'](_0x4ad3fa,'id');_0x5c6042=_['merge'](_0x5c6042,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x262919[_0x21af('0x3e')][_0x21af('0x40')]){_0x333f3d['attributes'][_0x21af('0x5d')](function(_0x13ac3d){_0x469e6c['field']('c.'+_0x13ac3d);});}else{_0x469e6c['field'](_0x21af('0x77'));_0x469e6c[_0x21af('0x48')](_0x21af('0x83'));_0x469e6c[_0x21af('0x48')](_0x21af('0x84'));_0x469e6c['field'](_0x21af('0x85'));_0x469e6c[_0x21af('0x48')](_0x21af('0x86'));_0x469e6c[_0x21af('0x48')]('c.fax');_0x469e6c[_0x21af('0x48')]('c.email');_0x469e6c['field'](_0x21af('0x87'));_0x469e6c[_0x21af('0x48')](_0x21af('0x88'));_0x469e6c[_0x21af('0x48')](_0x21af('0x89'));_0x469e6c[_0x21af('0x48')](_0x21af('0x8a'));_0x469e6c[_0x21af('0x48')](_0x21af('0x8b'),_0x21af('0x8c'));}if(_0x333f3d[_0x21af('0x43')])_0x469e6c[_0x21af('0x43')](_0x333f3d[_0x21af('0x43')]);if(_0x333f3d[_0x21af('0x25')])_0x469e6c[_0x21af('0x25')](_0x333f3d[_0x21af('0x25')]);return db[_0x21af('0x82')][_0x21af('0x3e')](_0x469e6c['toString'](),_0x5c6042);});})['then'](function(_0x23634e){_0x23634e[_0x21af('0x5d')](function(_0xaa2182){if(_0xaa2182[_0x21af('0x8c')]){_0xaa2182['Tags']=[];_0xaa2182[_0x21af('0x8c')][_0x21af('0x5b')](',')['forEach'](function(_0x282260){_0xaa2182[_0x21af('0x8d')][_0x21af('0x37')](_0x35c381[_0x282260]);});}delete _0xaa2182[_0x21af('0x8c')];});_0x58558d['rows']=_0x23634e;return _0x58558d;})[_0x21af('0x2c')](respondWithFilteredResult(_0x394991,_0x333f3d));})[_0x21af('0x8e')](handleError(_0x394991,null));};exports[_0x21af('0x2d')]=function(_0xe8e214,_0x43c072){return db[_0x21af('0x8f')][_0x21af('0x59')]({'where':{'id':_0xe8e214[_0x21af('0x90')]['id']}})[_0x21af('0x2c')](handleEntityNotFound(_0x43c072,null))[_0x21af('0x2c')](removeEntity(_0x43c072,null))[_0x21af('0x8e')](handleError(_0x43c072,null));};exports[_0x21af('0x33')]=function(_0x59c092,_0x1d39eb){return db[_0x21af('0x8f')][_0x21af('0x33')]()[_0x21af('0x2c')](function(_0x52c24e){delete _0x52c24e[_0x21af('0x91')];for(var _0x40ef67=0x0;_0x40ef67=_0x89e81d){_0x357eb5=_0x89e81d;_0x2831d1=0xc8;}else{_0x2831d1=0xce;}_0x4c177a[_0x742d('0x1a')](_0x2831d1);return _0x4c177a[_0x742d('0x20')](_0x742d('0x21'),_0x554ee6+'-'+_0x357eb5+'/'+_0x89e81d)['json'](_0x1c83fa);}return null;};}function patchUpdates(_0x382979){return function(_0x2ff827){try{jsonpatch[_0x742d('0x22')](_0x2ff827,_0x382979,!![]);}catch(_0x31a842){return BPromise[_0x742d('0x23')](_0x31a842);}return _0x2ff827[_0x742d('0x24')]();};}function saveUpdates(_0x25bba8,_0x4d962a){return function(_0x4040b0){if(_0x4040b0){return _0x4040b0[_0x742d('0x25')](_0x25bba8)[_0x742d('0x26')](function(_0x283a17){return _0x283a17;});}return null;};}function removeEntity(_0x30ed11,_0x383bc6){return function(_0x5eb921){if(_0x5eb921){return _0x5eb921[_0x742d('0x27')]()[_0x742d('0x26')](function(){_0x30ed11['status'](0xcc)[_0x742d('0x1b')]();});}};}function handleEntityNotFound(_0x2de746,_0x421409){return function(_0x5bcc66){if(!_0x5bcc66){_0x2de746[_0x742d('0x19')](0x194);}return _0x5bcc66;};}function handleError(_0x5f5404,_0x1f86de){_0x1f86de=_0x1f86de||0x1f4;return function(_0x1d2ac0){logger[_0x742d('0x28')](_0x1d2ac0[_0x742d('0x29')]);if(_0x1d2ac0[_0x742d('0x2a')]){delete _0x1d2ac0[_0x742d('0x2a')];}_0x5f5404[_0x742d('0x1a')](_0x1f86de)[_0x742d('0x2b')](_0x1d2ac0);};}exports[_0x742d('0x2c')]=function(_0x4799ab,_0x5c47c2){var _0x445fc6={},_0x407057={},_0x181814={'count':0x0,'rows':[]};return db['CmContact'][_0x742d('0x2d')]()[_0x742d('0x26')](function(_0x16f831){var _0xd8edc0=[];for(var _0x46c6da=0x0;_0x46c6da0x1){_0x1f120b['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x742d('0x6c')](_0x2179e6),null);}else{if(qs[_0x742d('0x6d')](_0x2179e6)){_0x1f120b['or'](_0x742d('0x6e'),_0x2179e6+'%');_0x1f120b['or'](_0x742d('0x6f'),_0x2179e6+'%');_0x1f120b['or'](_0x742d('0x70'),_0x2179e6+'%');_0x1f120b['or'](_0x742d('0x71'),_0x2179e6+'%');}else if(qs[_0x742d('0x72')](_0x2179e6)){_0x1f120b['or'](_0x742d('0x73'),_0x2179e6+'%');}else{_0x1f120b['or']('c.firstName\x20LIKE\x20?','%'+_0x2179e6+'%');_0x1f120b['or'](_0x742d('0x74'),'%'+_0x2179e6+'%');_0x1f120b['or'](_0x742d('0x73'),'%'+_0x2179e6+'%');}}}}_0x329c38['where'](_0x1f120b);_0x329c38['group'](_0x742d('0x75'));var _0x3b3d79={'type':db[_0x742d('0x76')][_0x742d('0x77')]['SELECT'],'raw':!![]};var _0x133131=_0x329c38['clone']()[_0x742d('0x42')](_0x742d('0x75'));if(_0x445fc6[_0x742d('0x3e')]){_0x445fc6['order'][_0x742d('0x62')](function(_0x436d6d){_0x329c38[_0x742d('0x3e')]('c.'+_0x436d6d[0x0],_0x436d6d[0x1]===_0x742d('0x78')?![]:!![]);});}if(!_[_0x742d('0x61')](_0x29e42b)){_0x329c38[_0x742d('0x79')](_0x2629b9);_0x133131[_0x742d('0x40')](_0x742d('0x7a'),_0x29e42b);}BPromise[_0x742d('0x7b')]()[_0x742d('0x26')](function(){if(!_0x37c22a)return;if(_0x4799ab['user'][_0x742d('0x7c')]!=='agent')return;if(!_[_0x742d('0x7d')](_0x37c22a[_0x742d('0x50')],['field','User'])){return _0x4799ab[_0x742d('0x7e')]['getLists']({'attributes':['id'],'raw':!![]})[_0x742d('0x26')](function(_0x2a9e77){if(_[_0x742d('0x61')](_0x2a9e77)){_0x133131[_0x742d('0x40')](_0x742d('0x7f'));_0x329c38[_0x742d('0x40')]('c.ListId\x20IS\x20NULL');}else{_0x133131[_0x742d('0x40')](_0x742d('0x80'),_['map'](_0x2a9e77,'id'));_0x329c38[_0x742d('0x40')](_0x742d('0x80'),_[_0x742d('0x5f')](_0x2a9e77,'id'));}});}})[_0x742d('0x26')](function(){if(_0x4799ab['user'][_0x742d('0x7c')]===_0x742d('0x81')&&!_0x37c22a&&!_0x4799ab[_0x742d('0x3c')][_0x742d('0x63')])return[];return db[_0x742d('0x82')][_0x742d('0x3c')](_0x133131[_0x742d('0x83')](),_0x3b3d79);})[_0x742d('0x26')](function(_0x1a9af7){_0x181814['count']=_0x1a9af7['length'];if(_0x181814[_0x742d('0x1e')]===0x0)return[];return db[_0x742d('0x82')][_0x742d('0x3c')](_0x18c8db[_0x742d('0x83')](),_0x3b3d79)[_0x742d('0x26')](function(_0x3dd80a){_0x5d6aab=_['keyBy'](_0x3dd80a,'id');_0x3b3d79=_[_0x742d('0x84')](_0x3b3d79,{'model':db[_0x742d('0x85')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4799ab[_0x742d('0x3c')][_0x742d('0x3b')]){_0x445fc6[_0x742d('0x3a')][_0x742d('0x62')](function(_0x57235a){_0x329c38[_0x742d('0x42')]('c.'+_0x57235a);});}else{_0x329c38['field'](_0x742d('0x75'));_0x329c38['field'](_0x742d('0x86'));_0x329c38[_0x742d('0x42')](_0x742d('0x87'));_0x329c38[_0x742d('0x42')](_0x742d('0x88'));_0x329c38['field'](_0x742d('0x89'));_0x329c38[_0x742d('0x42')](_0x742d('0x8a'));_0x329c38['field'](_0x742d('0x8b'));_0x329c38[_0x742d('0x42')](_0x742d('0x8c'));_0x329c38['field'](_0x742d('0x8d'));_0x329c38[_0x742d('0x42')]('c.deletedAt');_0x329c38[_0x742d('0x42')](_0x742d('0x8e'));_0x329c38['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x742d('0x8f'));}if(_0x445fc6[_0x742d('0x1c')])_0x329c38[_0x742d('0x1c')](_0x445fc6['limit']);if(_0x445fc6[_0x742d('0x1f')])_0x329c38[_0x742d('0x1f')](_0x445fc6[_0x742d('0x1f')]);return db[_0x742d('0x82')][_0x742d('0x3c')](_0x329c38['toString'](),_0x3b3d79);});})[_0x742d('0x26')](function(_0x1fb9e2){_0x1fb9e2[_0x742d('0x62')](function(_0x5663a1){if(_0x5663a1[_0x742d('0x8f')]){_0x5663a1['Tags']=[];_0x5663a1[_0x742d('0x8f')][_0x742d('0x54')](',')['forEach'](function(_0x560e1d){_0x5663a1[_0x742d('0x90')][_0x742d('0x30')](_0x5d6aab[_0x560e1d]);});}delete _0x5663a1[_0x742d('0x8f')];});_0x181814['rows']=_0x1fb9e2;return _0x181814;})[_0x742d('0x26')](respondWithFilteredResult(_0x5c47c2,_0x445fc6));})['catch'](handleError(_0x5c47c2,null));};exports[_0x742d('0x27')]=function(_0x160c29,_0x4c9e8e){return db['CmContact']['find']({'where':{'id':_0x160c29[_0x742d('0x91')]['id']}})[_0x742d('0x26')](handleEntityNotFound(_0x4c9e8e,null))[_0x742d('0x26')](removeEntity(_0x4c9e8e,null))[_0x742d('0x92')](handleError(_0x4c9e8e,null));};exports[_0x742d('0x2d')]=function(_0x25ac0c,_0x287527){return db[_0x742d('0x85')][_0x742d('0x2d')]()[_0x742d('0x26')](function(_0x415175){delete _0x415175[_0x742d('0x93')];for(var _0x4d1bb8=0x0;_0x4d1bb8{}\s\\|]/g,'-');_0x4d5c73(null,util[_0x36ad('0x27')](_0x36ad('0x28'),path[_0x36ad('0x29')](_0x20f50e[_0x36ad('0x25')],path[_0x36ad('0x2a')](_0x20f50e['originalname'])),Date['now'](),path[_0x36ad('0x2a')](_0x20f50e['originalname'])));}})});router[_0x36ad('0x1c')](_0x36ad('0x2b'),upload['single'](_0x36ad('0x2c')),controller[_0x36ad('0x2d')]);var upload=multer({'storage':multer[_0x36ad('0x21')]({'destination':function(_0x3b8eb3,_0x5e3078,_0x562932){_0x562932(null,path[_0x36ad('0x22')](config[_0x36ad('0x23')],_0x36ad('0x24')));},'filename':function(_0x30dc5f,_0x40513f,_0x3a23c8){_0x40513f[_0x36ad('0x25')]=_0x40513f[_0x36ad('0x25')][_0x36ad('0x26')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3a23c8(null,util[_0x36ad('0x27')](_0x36ad('0x28'),path[_0x36ad('0x29')](_0x40513f['originalname'],path[_0x36ad('0x2a')](_0x40513f['originalname'])),Date['now'](),path[_0x36ad('0x2a')](_0x40513f[_0x36ad('0x25')])));}})});router[_0x36ad('0x1c')](_0x36ad('0x2e'),upload[_0x36ad('0x2f')](_0x36ad('0x2c')),controller[_0x36ad('0x30')]);router[_0x36ad('0x1c')](_0x36ad('0x31'),auth[_0x36ad('0xc')](),controller[_0x36ad('0x32')]);router[_0x36ad('0x33')](_0x36ad('0x10'),auth['isAuthenticated'](),controller[_0x36ad('0x34')]);router[_0x36ad('0x35')]('/:id',auth[_0x36ad('0xc')](),controller['destroy']);module[_0x36ad('0x36')]=router; \ No newline at end of file +var _0x5a9f=['/:id/jscripty_sessions','getJscriptySessions','getJourney','post','/merge','merge','create','/create_many','bulkCreate','setTags','diskStorage','join','server/files/tmp','originalname','replace','%s-%s%s','basename','now','extname','/csv','single','file','uploadCsv','root','format','/upload','upload','/upload/:id','import','put','update','delete','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','isAuthenticated','index','get','/:id','show','/:id/tags','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals'];(function(_0x179e97,_0x2673dd){var _0x526952=function(_0x53f373){while(--_0x53f373){_0x179e97['push'](_0x179e97['shift']());}};_0x526952(++_0x2673dd);}(_0x5a9f,0x8f));var _0xf5a9=function(_0x481854,_0x37c5d8){_0x481854=_0x481854-0x0;var _0x587be4=_0x5a9f[_0x481854];return _0x587be4;};'use strict';var multer=require(_0xf5a9('0x0'));var util=require('util');var path=require(_0xf5a9('0x1'));var timeout=require(_0xf5a9('0x2'));var express=require('express');var router=express[_0xf5a9('0x3')]();var fs_extra=require(_0xf5a9('0x4'));var auth=require(_0xf5a9('0x5'));var interaction=require(_0xf5a9('0x6'));var config=require(_0xf5a9('0x7'));var controller=require(_0xf5a9('0x8'));router['get']('/',auth[_0xf5a9('0x9')](),controller[_0xf5a9('0xa')]);router[_0xf5a9('0xb')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xf5a9('0xb')](_0xf5a9('0xc'),auth[_0xf5a9('0x9')](),controller[_0xf5a9('0xd')]);router['get'](_0xf5a9('0xe'),auth[_0xf5a9('0x9')](),controller[_0xf5a9('0xf')]);router[_0xf5a9('0xb')](_0xf5a9('0x10'),auth[_0xf5a9('0x9')](),controller[_0xf5a9('0x11')]);router[_0xf5a9('0xb')](_0xf5a9('0x12'),auth[_0xf5a9('0x9')](),controller[_0xf5a9('0x13')]);router[_0xf5a9('0xb')](_0xf5a9('0x14'),auth[_0xf5a9('0x9')](),controller[_0xf5a9('0x15')]);router['get'](_0xf5a9('0x16'),auth['isAuthenticated'](),controller[_0xf5a9('0x17')]);router[_0xf5a9('0xb')]('/:id/journey',auth['isAuthenticated'](),controller[_0xf5a9('0x18')]);router[_0xf5a9('0x19')](_0xf5a9('0x1a'),auth[_0xf5a9('0x9')](),controller[_0xf5a9('0x1b')]);router[_0xf5a9('0x19')]('/',auth[_0xf5a9('0x9')](),controller[_0xf5a9('0x1c')]);router[_0xf5a9('0x19')](_0xf5a9('0x1d'),auth[_0xf5a9('0x9')](),controller[_0xf5a9('0x1e')]);router['post'](_0xf5a9('0xe'),auth[_0xf5a9('0x9')](),controller[_0xf5a9('0x1f')]);var upload=multer({'storage':multer[_0xf5a9('0x20')]({'destination':function(_0x2045b7,_0xdf3d76,_0x389cd9){_0x389cd9(null,path[_0xf5a9('0x21')](config['root'],_0xf5a9('0x22')));},'filename':function(_0x173dc7,_0x4a3c4d,_0x4217b5){_0x4a3c4d[_0xf5a9('0x23')]=_0x4a3c4d['originalname'][_0xf5a9('0x24')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4217b5(null,util['format'](_0xf5a9('0x25'),path[_0xf5a9('0x26')](_0x4a3c4d[_0xf5a9('0x23')],path['extname'](_0x4a3c4d[_0xf5a9('0x23')])),Date[_0xf5a9('0x27')](),path[_0xf5a9('0x28')](_0x4a3c4d[_0xf5a9('0x23')])));}})});router['post'](_0xf5a9('0x29'),upload[_0xf5a9('0x2a')](_0xf5a9('0x2b')),controller[_0xf5a9('0x2c')]);var upload=multer({'storage':multer[_0xf5a9('0x20')]({'destination':function(_0x59493f,_0x313cf3,_0x29749a){_0x29749a(null,path[_0xf5a9('0x21')](config[_0xf5a9('0x2d')],_0xf5a9('0x22')));},'filename':function(_0x25a104,_0x2429af,_0x2c8770){_0x2429af['originalname']=_0x2429af[_0xf5a9('0x23')][_0xf5a9('0x24')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2c8770(null,util[_0xf5a9('0x2e')]('%s-%s%s',path[_0xf5a9('0x26')](_0x2429af[_0xf5a9('0x23')],path['extname'](_0x2429af['originalname'])),Date[_0xf5a9('0x27')](),path[_0xf5a9('0x28')](_0x2429af[_0xf5a9('0x23')])));}})});router['post'](_0xf5a9('0x2f'),upload[_0xf5a9('0x2a')](_0xf5a9('0x2b')),controller[_0xf5a9('0x30')]);router[_0xf5a9('0x19')](_0xf5a9('0x31'),auth[_0xf5a9('0x9')](),controller[_0xf5a9('0x32')]);router[_0xf5a9('0x33')](_0xf5a9('0xc'),auth[_0xf5a9('0x9')](),controller[_0xf5a9('0x34')]);router[_0xf5a9('0x35')](_0xf5a9('0xc'),auth[_0xf5a9('0x9')](),controller[_0xf5a9('0x36')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index dc6121d..35703d4 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 _0x75e1=['isArray','setDataValue','stringify','BOOLEAN','ENUM','voice','lodash','alias','STRING','getDataValue','name','TEXT','long','type','select','parse','values'];(function(_0x35f7f5,_0x4e2ee1){var _0x5567a4=function(_0x3e5df0){while(--_0x3e5df0){_0x35f7f5['push'](_0x35f7f5['shift']());}};_0x5567a4(++_0x4e2ee1);}(_0x75e1,0xf4));var _0x175e=function(_0x33154d,_0x854047){_0x33154d=_0x33154d-0x0;var _0x3b2f03=_0x75e1[_0x33154d];return _0x3b2f03;};'use strict';var Sequelize=require('sequelize');var _=require(_0x175e('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x170421){return this['getDataValue'](_0x175e('0x1'));}},'alias':{'type':Sequelize[_0x175e('0x2')],'allowNull':![],'set':function(_0x131616){this['setDataValue'](_0x175e('0x1'),_0x131616?_0x131616:this[_0x175e('0x3')](_0x175e('0x4')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x175e('0x5')](_0x175e('0x6')),'get':function(){if(this[_0x175e('0x3')](_0x175e('0x7'))===_0x175e('0x8')){return JSON[_0x175e('0x9')](this[_0x175e('0x3')](_0x175e('0xa')));}else{return this[_0x175e('0x3')]('values');}},'set':function(_0x58e7c7){if(Array[_0x175e('0xb')](_0x58e7c7)){this[_0x175e('0xc')](_0x175e('0xa'),JSON[_0x175e('0xd')](_0x58e7c7));}else{this['setDataValue'](_0x175e('0xa'),_0x58e7c7);}}},'required':{'type':Sequelize[_0x175e('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x175e('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x175e('0xf')](_0x175e('0x10'))}}; \ No newline at end of file +var _0x0a10=['sequelize','lodash','VIRTUAL','getDataValue','STRING','setDataValue','alias','name','TEXT','long','select','parse','isArray','values','BOOLEAN','ENUM','voice'];(function(_0x209ee8,_0x4e4cd6){var _0x101de4=function(_0x4c1046){while(--_0x4c1046){_0x209ee8['push'](_0x209ee8['shift']());}};_0x101de4(++_0x4e4cd6);}(_0x0a10,0x88));var _0x00a1=function(_0x102376,_0x16c6a2){_0x102376=_0x102376-0x0;var _0x29bc9c=_0x0a10[_0x102376];return _0x29bc9c;};'use strict';var Sequelize=require(_0x00a1('0x0'));var _=require(_0x00a1('0x1'));module['exports']={'name':{'type':Sequelize[_0x00a1('0x2')],'get':function(_0x4fa622){return this[_0x00a1('0x3')]('alias');}},'alias':{'type':Sequelize[_0x00a1('0x4')],'allowNull':![],'set':function(_0x377dc5){this[_0x00a1('0x5')](_0x00a1('0x6'),_0x377dc5?_0x377dc5:this[_0x00a1('0x3')](_0x00a1('0x7')));}},'type':{'type':Sequelize[_0x00a1('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0x00a1('0x8')](_0x00a1('0x9')),'get':function(){if(this[_0x00a1('0x3')]('type')===_0x00a1('0xa')){return JSON[_0x00a1('0xb')](this[_0x00a1('0x3')]('values'));}else{return this[_0x00a1('0x3')]('values');}},'set':function(_0x96d7d9){if(Array[_0x00a1('0xc')](_0x96d7d9)){this[_0x00a1('0x5')]('values',JSON['stringify'](_0x96d7d9));}else{this['setDataValue'](_0x00a1('0xd'),_0x96d7d9);}}},'required':{'type':Sequelize[_0x00a1('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x00a1('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x00a1('0xf')](_0x00a1('0x10'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index bfdffe9..37a2d4c 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 _0x69ab=['error','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','differenceBy','query','keys','filters','intersection','attributes','model','fields','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','find','body','create','sequelize','transaction','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','queryInterface','cm_contacts','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','end'];(function(_0x49b662,_0x5ab10c){var _0x387b20=function(_0x1cbf05){while(--_0x1cbf05){_0x49b662['push'](_0x49b662['shift']());}};_0x387b20(++_0x5ab10c);}(_0x69ab,0xd8));var _0xb69a=function(_0x583337,_0x5658be){_0x583337=_0x583337-0x0;var _0x43075e=_0x69ab[_0x583337];return _0x43075e;};'use strict';var emlformat=require(_0xb69a('0x0'));var rimraf=require(_0xb69a('0x1'));var zipdir=require(_0xb69a('0x2'));var jsonpatch=require(_0xb69a('0x3'));var rp=require('request-promise');var moment=require(_0xb69a('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb69a('0x5'));var path=require('path');var sox=require(_0xb69a('0x6'));var csv=require(_0xb69a('0x7'));var ejs=require(_0xb69a('0x8'));var fs=require('fs');var fs_extra=require(_0xb69a('0x9'));var _=require(_0xb69a('0xa'));var squel=require(_0xb69a('0xb'));var crypto=require(_0xb69a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb69a('0xd'));var toCsv=require(_0xb69a('0x7'));var querystring=require(_0xb69a('0xe'));var Papa=require(_0xb69a('0xf'));var Redis=require(_0xb69a('0x10'));var authService=require(_0xb69a('0x11'));var qs=require(_0xb69a('0x12'));var as=require(_0xb69a('0x13'));var hardwareService=require(_0xb69a('0x14'));var logger=require(_0xb69a('0x15'))(_0xb69a('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb69a('0x17'));var db=require(_0xb69a('0x18'))['db'];function respondWithStatusCode(_0x49844e,_0x30acb2){_0x30acb2=_0x30acb2||0xcc;return function(_0x16fc5b){if(_0x16fc5b){return _0x49844e[_0xb69a('0x19')](_0x30acb2);}return _0x49844e[_0xb69a('0x1a')](_0x30acb2)['end']();};}function respondWithResult(_0x43335b,_0x51fdee){_0x51fdee=_0x51fdee||0xc8;return function(_0x564737){if(_0x564737){return _0x43335b[_0xb69a('0x1a')](_0x51fdee)[_0xb69a('0x1b')](_0x564737);}};}function respondWithFilteredResult(_0x4f3e6f,_0xaa4e9b){return function(_0x476be0){if(_0x476be0){var _0x439020=typeof _0xaa4e9b[_0xb69a('0x1c')]===_0xb69a('0x1d')&&typeof _0xaa4e9b[_0xb69a('0x1e')]===_0xb69a('0x1d');var _0x193a19=_0x476be0[_0xb69a('0x1f')];var _0x794555=_0x439020?0x0:_0xaa4e9b[_0xb69a('0x1c')];var _0x1ed2fd=_0x439020?_0x476be0[_0xb69a('0x1f')]:_0xaa4e9b[_0xb69a('0x1c')]+_0xaa4e9b[_0xb69a('0x1e')];var _0x1e35a0;if(_0x1ed2fd>=_0x193a19){_0x1ed2fd=_0x193a19;_0x1e35a0=0xc8;}else{_0x1e35a0=0xce;}_0x4f3e6f['status'](_0x1e35a0);return _0x4f3e6f['set'](_0xb69a('0x20'),_0x794555+'-'+_0x1ed2fd+'/'+_0x193a19)[_0xb69a('0x1b')](_0x476be0);}return null;};}function patchUpdates(_0x4567f5){return function(_0x3778c6){try{jsonpatch[_0xb69a('0x21')](_0x3778c6,_0x4567f5,!![]);}catch(_0xae2189){return BPromise[_0xb69a('0x22')](_0xae2189);}return _0x3778c6['save']();};}function saveUpdates(_0xf4f50,_0x3620d8){return function(_0x37c85f){if(_0x37c85f){return _0x37c85f[_0xb69a('0x23')](_0xf4f50)[_0xb69a('0x24')](function(_0x4f2920){return _0x4f2920;});}return null;};}function removeEntity(_0x296e2d,_0x351dab){return function(_0x3cf6bd){if(_0x3cf6bd){return _0x3cf6bd[_0xb69a('0x25')]()['then'](function(){_0x296e2d[_0xb69a('0x1a')](0xcc)[_0xb69a('0x26')]();});}};}function handleEntityNotFound(_0x25122d,_0x37362b){return function(_0x52a384){if(!_0x52a384){_0x25122d[_0xb69a('0x19')](0x194);}return _0x52a384;};}function handleError(_0x25d0b8,_0x525e6a){_0x525e6a=_0x525e6a||0x1f4;return function(_0x17f778){logger[_0xb69a('0x27')](_0x17f778[_0xb69a('0x28')]);if(_0x17f778[_0xb69a('0x29')]){delete _0x17f778[_0xb69a('0x29')];}_0x25d0b8[_0xb69a('0x1a')](_0x525e6a)[_0xb69a('0x2a')](_0x17f778);};}exports[_0xb69a('0x2b')]=function(_0x3449ac,_0x2a5fd0){var _0x26e5b2={},_0x99662d={},_0x13ec90={'count':0x0,'rows':[]};var _0x945d31=_[_0xb69a('0x2c')](db[_0xb69a('0x2d')][_0xb69a('0x2e')],function(_0x21b4ca){return{'name':_0x21b4ca[_0xb69a('0x2f')],'type':_0x21b4ca[_0xb69a('0x30')]['key']};});_0x99662d['model']=_[_0xb69a('0x31')](_[_0xb69a('0x2c')](_0x945d31,_0xb69a('0x29')),[_0xb69a('0x29')]);_0x99662d[_0xb69a('0x32')]=_[_0xb69a('0x33')](_0x3449ac[_0xb69a('0x32')]);_0x99662d[_0xb69a('0x34')]=_[_0xb69a('0x35')](_0x99662d['model'],_0x99662d[_0xb69a('0x32')]);_0x26e5b2[_0xb69a('0x36')]=_['intersection'](_0x99662d[_0xb69a('0x37')],qs[_0xb69a('0x38')](_0x3449ac[_0xb69a('0x32')][_0xb69a('0x38')]));_0x26e5b2['attributes']=_0x26e5b2['attributes']['length']?_0x26e5b2['attributes']:_0x99662d[_0xb69a('0x37')];if(!_0x3449ac['query']['hasOwnProperty'](_0xb69a('0x39'))){_0x26e5b2[_0xb69a('0x1e')]=qs['limit'](_0x3449ac[_0xb69a('0x32')][_0xb69a('0x1e')]);_0x26e5b2[_0xb69a('0x1c')]=qs[_0xb69a('0x1c')](_0x3449ac[_0xb69a('0x32')]['offset']);}_0x26e5b2[_0xb69a('0x3a')]=qs[_0xb69a('0x3b')](_0x3449ac[_0xb69a('0x32')][_0xb69a('0x3b')]);_0x26e5b2[_0xb69a('0x3c')]=qs['filters'](_['pick'](_0x3449ac[_0xb69a('0x32')],_0x99662d[_0xb69a('0x34')]),_0x945d31);if(_0x3449ac[_0xb69a('0x32')][_0xb69a('0x3d')]){_0x26e5b2[_0xb69a('0x3c')]=_[_0xb69a('0x3e')](_0x26e5b2[_0xb69a('0x3c')],{'$or':_[_0xb69a('0x2c')](_0x945d31,function(_0x3e7f3c){if(_0x3e7f3c[_0xb69a('0x30')]!==_0xb69a('0x3f')){var _0x53ee32={};_0x53ee32[_0x3e7f3c[_0xb69a('0x29')]]={'$like':'%'+_0x3449ac['query'][_0xb69a('0x3d')]+'%'};return _0x53ee32;}})});}_0x26e5b2=_[_0xb69a('0x3e')]({},_0x26e5b2,_0x3449ac['options']);var _0x18477a={'where':_0x26e5b2[_0xb69a('0x3c')]};return db[_0xb69a('0x2d')][_0xb69a('0x1f')](_0x18477a)[_0xb69a('0x24')](function(_0x4c7e35){_0x13ec90['count']=_0x4c7e35;if(_0x3449ac[_0xb69a('0x32')][_0xb69a('0x40')]){_0x26e5b2[_0xb69a('0x41')]=[{'all':!![]}];}return db['CmCustomField'][_0xb69a('0x42')](_0x26e5b2);})[_0xb69a('0x24')](function(_0x206e72){_0x13ec90[_0xb69a('0x43')]=_0x206e72;return _0x13ec90;})['then'](respondWithFilteredResult(_0x2a5fd0,_0x26e5b2))[_0xb69a('0x44')](handleError(_0x2a5fd0,null));};exports[_0xb69a('0x45')]=function(_0x197efd,_0x2effb4){var _0x2a8d17={'raw':!![],'where':{'id':_0x197efd[_0xb69a('0x46')]['id']}},_0x4a42da={};_0x4a42da[_0xb69a('0x37')]=_[_0xb69a('0x33')](db[_0xb69a('0x2d')]['rawAttributes']);_0x4a42da[_0xb69a('0x32')]=_[_0xb69a('0x33')](_0x197efd[_0xb69a('0x32')]);_0x4a42da['filters']=_[_0xb69a('0x35')](_0x4a42da[_0xb69a('0x37')],_0x4a42da[_0xb69a('0x32')]);_0x2a8d17[_0xb69a('0x36')]=_[_0xb69a('0x35')](_0x4a42da[_0xb69a('0x37')],qs[_0xb69a('0x38')](_0x197efd[_0xb69a('0x32')]['fields']));_0x2a8d17[_0xb69a('0x36')]=_0x2a8d17[_0xb69a('0x36')][_0xb69a('0x47')]?_0x2a8d17[_0xb69a('0x36')]:_0x4a42da['model'];if(_0x197efd[_0xb69a('0x32')][_0xb69a('0x40')]){_0x2a8d17['include']=[{'all':!![]}];}_0x2a8d17=_[_0xb69a('0x3e')]({},_0x2a8d17,_0x197efd['options']);return db[_0xb69a('0x2d')][_0xb69a('0x48')](_0x2a8d17)['then'](handleEntityNotFound(_0x2effb4,null))['then'](respondWithResult(_0x2effb4,null))[_0xb69a('0x44')](handleError(_0x2effb4,null));};exports[_0xb69a('0x23')]=function(_0x28509b,_0x47c841){if(_0x28509b['body']['id']){delete _0x28509b['body']['id'];}return db[_0xb69a('0x2d')][_0xb69a('0x48')]({'where':{'id':_0x28509b[_0xb69a('0x46')]['id']}})[_0xb69a('0x24')](handleEntityNotFound(_0x47c841,null))['then'](saveUpdates(_0x28509b[_0xb69a('0x49')],null))['then'](respondWithResult(_0x47c841,null))[_0xb69a('0x44')](handleError(_0x47c841,null));};exports[_0xb69a('0x25')]=function(_0x417f8b,_0x4e09bd){return db['CmCustomField'][_0xb69a('0x48')]({'where':{'id':_0x417f8b[_0xb69a('0x46')]['id']}})[_0xb69a('0x24')](handleEntityNotFound(_0x4e09bd,null))[_0xb69a('0x24')](removeEntity(_0x4e09bd,null))[_0xb69a('0x44')](handleError(_0x4e09bd,null));};exports[_0xb69a('0x4a')]=function(_0x13cb7a,_0x233f59){var _0x4ca08b;return db[_0xb69a('0x4b')][_0xb69a('0x4c')](function(_0x313bb4){return db[_0xb69a('0x2d')][_0xb69a('0x4a')](_0x13cb7a['body'],{'transaction':_0x313bb4})[_0xb69a('0x24')](function(_0x347a25){_0x4ca08b=_0x347a25;var _0x47ba5a={'type':db[_0xb69a('0x4d')][_0xb69a('0x4e')],'transaction':_0x313bb4};switch(_0x13cb7a['body'][_0xb69a('0x30')]){case'text':_0x47ba5a[_0xb69a('0x30')]=db[_0xb69a('0x4d')][_0xb69a('0x4e')];break;case _0xb69a('0x4f'):_0x47ba5a[_0xb69a('0x30')]=db[_0xb69a('0x4d')][_0xb69a('0x50')];break;case _0xb69a('0x51'):_0x47ba5a['type']=db[_0xb69a('0x4d')][_0xb69a('0x52')];_0x47ba5a['defaultValue']=![];break;default:}return db[_0xb69a('0x4b')][_0xb69a('0x53')]['addColumn'](_0xb69a('0x54'),util['format']('cf_%d',_0x4ca08b['id']),_0x47ba5a);})[_0xb69a('0x24')](function(){return _0x4ca08b;});})[_0xb69a('0x24')](respondWithResult(_0x233f59,0xc9))[_0xb69a('0x44')](handleError(_0x233f59,null));}; \ No newline at end of file +var _0x2ace=['crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','CmCustomField','fieldName','key','query','keys','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','params','rawAttributes','include','find','body','sequelize','transaction','create','Sequelize','text','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','cm_contacts','cf_%d','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0x366caf,_0x47472c){var _0x142dae=function(_0xb81d3d){while(--_0xb81d3d){_0x366caf['push'](_0x366caf['shift']());}};_0x142dae(++_0x47472c);}(_0x2ace,0x100));var _0xe2ac=function(_0x1551af,_0x5223c3){_0x1551af=_0x1551af-0x0;var _0xd8eb82=_0x2ace[_0x1551af];return _0xd8eb82;};'use strict';var emlformat=require(_0xe2ac('0x0'));var rimraf=require(_0xe2ac('0x1'));var zipdir=require(_0xe2ac('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe2ac('0x3'));var moment=require(_0xe2ac('0x4'));var BPromise=require(_0xe2ac('0x5'));var Mustache=require(_0xe2ac('0x6'));var util=require(_0xe2ac('0x7'));var path=require(_0xe2ac('0x8'));var sox=require(_0xe2ac('0x9'));var csv=require(_0xe2ac('0xa'));var ejs=require(_0xe2ac('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe2ac('0xc'));var squel=require(_0xe2ac('0xd'));var crypto=require(_0xe2ac('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe2ac('0xa'));var querystring=require(_0xe2ac('0xf'));var Papa=require(_0xe2ac('0x10'));var Redis=require(_0xe2ac('0x11'));var authService=require(_0xe2ac('0x12'));var qs=require(_0xe2ac('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe2ac('0x14'));var logger=require(_0xe2ac('0x15'))(_0xe2ac('0x16'));var utils=require(_0xe2ac('0x17'));var config=require(_0xe2ac('0x18'));var licenseUtil=require(_0xe2ac('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e0ced,_0x344326){_0x344326=_0x344326||0xcc;return function(_0x15cb55){if(_0x15cb55){return _0x4e0ced[_0xe2ac('0x1a')](_0x344326);}return _0x4e0ced['status'](_0x344326)[_0xe2ac('0x1b')]();};}function respondWithResult(_0xc636dd,_0x51ca2d){_0x51ca2d=_0x51ca2d||0xc8;return function(_0x4f6098){if(_0x4f6098){return _0xc636dd[_0xe2ac('0x1c')](_0x51ca2d)[_0xe2ac('0x1d')](_0x4f6098);}};}function respondWithFilteredResult(_0x5784d0,_0x4e7364){return function(_0x4908d6){if(_0x4908d6){var _0x33f9b2=typeof _0x4e7364['offset']===_0xe2ac('0x1e')&&typeof _0x4e7364[_0xe2ac('0x1f')]===_0xe2ac('0x1e');var _0x3f3a03=_0x4908d6['count'];var _0x247c14=_0x33f9b2?0x0:_0x4e7364[_0xe2ac('0x20')];var _0x43a361=_0x33f9b2?_0x4908d6[_0xe2ac('0x21')]:_0x4e7364['offset']+_0x4e7364['limit'];var _0x1d3547;if(_0x43a361>=_0x3f3a03){_0x43a361=_0x3f3a03;_0x1d3547=0xc8;}else{_0x1d3547=0xce;}_0x5784d0[_0xe2ac('0x1c')](_0x1d3547);return _0x5784d0[_0xe2ac('0x22')](_0xe2ac('0x23'),_0x247c14+'-'+_0x43a361+'/'+_0x3f3a03)[_0xe2ac('0x1d')](_0x4908d6);}return null;};}function patchUpdates(_0x206670){return function(_0x40338b){try{jsonpatch[_0xe2ac('0x24')](_0x40338b,_0x206670,!![]);}catch(_0x23fbd0){return BPromise[_0xe2ac('0x25')](_0x23fbd0);}return _0x40338b[_0xe2ac('0x26')]();};}function saveUpdates(_0x4a8742,_0x255913){return function(_0x1fe33d){if(_0x1fe33d){return _0x1fe33d[_0xe2ac('0x27')](_0x4a8742)[_0xe2ac('0x28')](function(_0x23f547){return _0x23f547;});}return null;};}function removeEntity(_0x31e1e4,_0x4c711c){return function(_0x43f207){if(_0x43f207){return _0x43f207[_0xe2ac('0x29')]()[_0xe2ac('0x28')](function(){_0x31e1e4[_0xe2ac('0x1c')](0xcc)[_0xe2ac('0x1b')]();});}};}function handleEntityNotFound(_0x42ed19,_0x22ffb3){return function(_0x5b33cd){if(!_0x5b33cd){_0x42ed19[_0xe2ac('0x1a')](0x194);}return _0x5b33cd;};}function handleError(_0x3afdd1,_0x4705c7){_0x4705c7=_0x4705c7||0x1f4;return function(_0x1e0f89){logger['error'](_0x1e0f89[_0xe2ac('0x2a')]);if(_0x1e0f89[_0xe2ac('0x2b')]){delete _0x1e0f89[_0xe2ac('0x2b')];}_0x3afdd1[_0xe2ac('0x1c')](_0x4705c7)['send'](_0x1e0f89);};}exports[_0xe2ac('0x2c')]=function(_0x211280,_0x4de58a){var _0x13ebdd={},_0x4aeb37={},_0x5abeed={'count':0x0,'rows':[]};var _0x1b1639=_[_0xe2ac('0x2d')](db[_0xe2ac('0x2e')]['rawAttributes'],function(_0x51b870){return{'name':_0x51b870[_0xe2ac('0x2f')],'type':_0x51b870['type'][_0xe2ac('0x30')]};});_0x4aeb37['model']=_['differenceBy'](_['map'](_0x1b1639,_0xe2ac('0x2b')),[_0xe2ac('0x2b')]);_0x4aeb37[_0xe2ac('0x31')]=_[_0xe2ac('0x32')](_0x211280[_0xe2ac('0x31')]);_0x4aeb37[_0xe2ac('0x33')]=_['intersection'](_0x4aeb37[_0xe2ac('0x34')],_0x4aeb37['query']);_0x13ebdd[_0xe2ac('0x35')]=_[_0xe2ac('0x36')](_0x4aeb37[_0xe2ac('0x34')],qs[_0xe2ac('0x37')](_0x211280[_0xe2ac('0x31')]['fields']));_0x13ebdd[_0xe2ac('0x35')]=_0x13ebdd['attributes'][_0xe2ac('0x38')]?_0x13ebdd[_0xe2ac('0x35')]:_0x4aeb37[_0xe2ac('0x34')];if(!_0x211280[_0xe2ac('0x31')]['hasOwnProperty'](_0xe2ac('0x39'))){_0x13ebdd[_0xe2ac('0x1f')]=qs[_0xe2ac('0x1f')](_0x211280['query'][_0xe2ac('0x1f')]);_0x13ebdd[_0xe2ac('0x20')]=qs[_0xe2ac('0x20')](_0x211280['query'][_0xe2ac('0x20')]);}_0x13ebdd[_0xe2ac('0x3a')]=qs[_0xe2ac('0x3b')](_0x211280[_0xe2ac('0x31')][_0xe2ac('0x3b')]);_0x13ebdd[_0xe2ac('0x3c')]=qs['filters'](_[_0xe2ac('0x3d')](_0x211280[_0xe2ac('0x31')],_0x4aeb37['filters']),_0x1b1639);if(_0x211280['query'][_0xe2ac('0x3e')]){_0x13ebdd[_0xe2ac('0x3c')]=_[_0xe2ac('0x3f')](_0x13ebdd['where'],{'$or':_['map'](_0x1b1639,function(_0x52fbab){if(_0x52fbab[_0xe2ac('0x40')]!==_0xe2ac('0x41')){var _0x475b7b={};_0x475b7b[_0x52fbab[_0xe2ac('0x2b')]]={'$like':'%'+_0x211280[_0xe2ac('0x31')]['filter']+'%'};return _0x475b7b;}})});}_0x13ebdd=_[_0xe2ac('0x3f')]({},_0x13ebdd,_0x211280[_0xe2ac('0x42')]);var _0x26a1ab={'where':_0x13ebdd['where']};return db[_0xe2ac('0x2e')][_0xe2ac('0x21')](_0x26a1ab)[_0xe2ac('0x28')](function(_0x2063a1){_0x5abeed[_0xe2ac('0x21')]=_0x2063a1;if(_0x211280[_0xe2ac('0x31')][_0xe2ac('0x43')]){_0x13ebdd['include']=[{'all':!![]}];}return db['CmCustomField'][_0xe2ac('0x44')](_0x13ebdd);})['then'](function(_0x91f86){_0x5abeed[_0xe2ac('0x45')]=_0x91f86;return _0x5abeed;})[_0xe2ac('0x28')](respondWithFilteredResult(_0x4de58a,_0x13ebdd))['catch'](handleError(_0x4de58a,null));};exports['show']=function(_0x10316c,_0x59bb0e){var _0x2d449d={'raw':!![],'where':{'id':_0x10316c[_0xe2ac('0x46')]['id']}},_0x57c097={};_0x57c097[_0xe2ac('0x34')]=_['keys'](db[_0xe2ac('0x2e')][_0xe2ac('0x47')]);_0x57c097[_0xe2ac('0x31')]=_[_0xe2ac('0x32')](_0x10316c[_0xe2ac('0x31')]);_0x57c097['filters']=_[_0xe2ac('0x36')](_0x57c097[_0xe2ac('0x34')],_0x57c097['query']);_0x2d449d[_0xe2ac('0x35')]=_[_0xe2ac('0x36')](_0x57c097[_0xe2ac('0x34')],qs[_0xe2ac('0x37')](_0x10316c[_0xe2ac('0x31')][_0xe2ac('0x37')]));_0x2d449d[_0xe2ac('0x35')]=_0x2d449d[_0xe2ac('0x35')][_0xe2ac('0x38')]?_0x2d449d[_0xe2ac('0x35')]:_0x57c097['model'];if(_0x10316c[_0xe2ac('0x31')][_0xe2ac('0x43')]){_0x2d449d[_0xe2ac('0x48')]=[{'all':!![]}];}_0x2d449d=_['merge']({},_0x2d449d,_0x10316c[_0xe2ac('0x42')]);return db['CmCustomField'][_0xe2ac('0x49')](_0x2d449d)[_0xe2ac('0x28')](handleEntityNotFound(_0x59bb0e,null))[_0xe2ac('0x28')](respondWithResult(_0x59bb0e,null))['catch'](handleError(_0x59bb0e,null));};exports[_0xe2ac('0x27')]=function(_0x59d1cb,_0x52f7e2){if(_0x59d1cb['body']['id']){delete _0x59d1cb['body']['id'];}return db[_0xe2ac('0x2e')][_0xe2ac('0x49')]({'where':{'id':_0x59d1cb[_0xe2ac('0x46')]['id']}})['then'](handleEntityNotFound(_0x52f7e2,null))[_0xe2ac('0x28')](saveUpdates(_0x59d1cb[_0xe2ac('0x4a')],null))[_0xe2ac('0x28')](respondWithResult(_0x52f7e2,null))['catch'](handleError(_0x52f7e2,null));};exports[_0xe2ac('0x29')]=function(_0x11e2b2,_0x563671){return db[_0xe2ac('0x2e')][_0xe2ac('0x49')]({'where':{'id':_0x11e2b2['params']['id']}})[_0xe2ac('0x28')](handleEntityNotFound(_0x563671,null))[_0xe2ac('0x28')](removeEntity(_0x563671,null))['catch'](handleError(_0x563671,null));};exports['create']=function(_0x5ef0bf,_0x22f962){var _0x37e7a9;return db[_0xe2ac('0x4b')][_0xe2ac('0x4c')](function(_0x5b4179){return db[_0xe2ac('0x2e')][_0xe2ac('0x4d')](_0x5ef0bf[_0xe2ac('0x4a')],{'transaction':_0x5b4179})[_0xe2ac('0x28')](function(_0x551747){_0x37e7a9=_0x551747;var _0x9efdc3={'type':db[_0xe2ac('0x4e')]['TEXT'],'transaction':_0x5b4179};switch(_0x5ef0bf['body'][_0xe2ac('0x40')]){case _0xe2ac('0x4f'):_0x9efdc3['type']=db[_0xe2ac('0x4e')][_0xe2ac('0x50')];break;case _0xe2ac('0x51'):_0x9efdc3[_0xe2ac('0x40')]=db[_0xe2ac('0x4e')][_0xe2ac('0x52')];break;case _0xe2ac('0x53'):_0x9efdc3[_0xe2ac('0x40')]=db[_0xe2ac('0x4e')][_0xe2ac('0x54')];_0x9efdc3[_0xe2ac('0x55')]=![];break;default:}return db[_0xe2ac('0x4b')][_0xe2ac('0x56')]['addColumn'](_0xe2ac('0x57'),util['format'](_0xe2ac('0x58'),_0x37e7a9['id']),_0x9efdc3);})[_0xe2ac('0x28')](function(){return _0x37e7a9;});})[_0xe2ac('0x28')](respondWithResult(_0x22f962,0xc9))[_0xe2ac('0x59')](handleError(_0x22f962,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index e1d15bb..b10b207 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 _0x1672=['cm_custom_fields','lodash','api','moment','bluebird','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','CmCustomField'];(function(_0x60209e,_0x4ea630){var _0x31f07c=function(_0x3429cf){while(--_0x3429cf){_0x60209e['push'](_0x60209e['shift']());}};_0x31f07c(++_0x4ea630);}(_0x1672,0x1cf));var _0x2167=function(_0x349589,_0x401fd7){_0x349589=_0x349589-0x0;var _0x77eb25=_0x1672[_0x349589];return _0x77eb25;};'use strict';var _=require(_0x2167('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2167('0x1'));var moment=require(_0x2167('0x2'));var BPromise=require(_0x2167('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2167('0x4'));var rimraf=require(_0x2167('0x5'));var config=require(_0x2167('0x6'));var attributes=require(_0x2167('0x7'));module[_0x2167('0x8')]=function(_0x980366,_0x5c3d0f){return _0x980366['define'](_0x2167('0x9'),attributes,{'tableName':_0x2167('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe1e5=['../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','bluebird','request-promise','rimraf'];(function(_0x58641c,_0x45d8a5){var _0xd25591=function(_0x5617ba){while(--_0x5617ba){_0x58641c['push'](_0x58641c['shift']());}};_0xd25591(++_0x45d8a5);}(_0xe1e5,0x132));var _0x5e1e=function(_0x3c2722,_0x1c4748){_0x3c2722=_0x3c2722-0x0;var _0x99c954=_0xe1e5[_0x3c2722];return _0x99c954;};'use strict';var _=require(_0x5e1e('0x0'));var util=require(_0x5e1e('0x1'));var logger=require(_0x5e1e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5e1e('0x3'));var rp=require(_0x5e1e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5e1e('0x5'));var config=require(_0x5e1e('0x6'));var attributes=require(_0x5e1e('0x7'));module[_0x5e1e('0x8')]=function(_0x49a282,_0x2121dc){return _0x49a282[_0x5e1e('0x9')](_0x5e1e('0xa'),attributes,{'tableName':_0x5e1e('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 fc233e3..ef7be1c 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 _0x0dad=['code','CmCustomField,\x20%s,\x20%s','error','message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','info','request\x20sent','stringify'];(function(_0x384f21,_0x2aacbf){var _0x2c1738=function(_0x2a6975){while(--_0x2a6975){_0x384f21['push'](_0x384f21['shift']());}};_0x2c1738(++_0x2aacbf);}(_0x0dad,0x1eb));var _0xd0da=function(_0x4c2f17,_0x5c6821){_0x4c2f17=_0x4c2f17-0x0;var _0x20919e=_0x0dad[_0x4c2f17];return _0x20919e;};'use strict';var _=require('lodash');var util=require(_0xd0da('0x0'));var moment=require(_0xd0da('0x1'));var BPromise=require(_0xd0da('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd0da('0x3'));var db=require(_0xd0da('0x4'))['db'];var utils=require(_0xd0da('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xd0da('0x6'));var jayson=require(_0xd0da('0x7'));var client=jayson[_0xd0da('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3474c6,_0x4cc127,_0xf49c2e){return new BPromise(function(_0xc594e7,_0x540b52){return client[_0xd0da('0x9')](_0x3474c6,_0xf49c2e)['then'](function(_0x5347e3){logger[_0xd0da('0xa')]('CmCustomField,\x20%s,\x20%s',_0x4cc127,_0xd0da('0xb'));logger['debug']('CmCustomField,\x20%s,\x20%s,\x20%s',_0x4cc127,_0xd0da('0xb'),JSON[_0xd0da('0xc')](_0x5347e3));if(_0x5347e3['error']){if(_0x5347e3['error'][_0xd0da('0xd')]===0x1f4){logger['error'](_0xd0da('0xe'),_0x4cc127,_0x5347e3[_0xd0da('0xf')][_0xd0da('0x10')]);return _0x540b52(_0x5347e3[_0xd0da('0xf')][_0xd0da('0x10')]);}logger['error'](_0xd0da('0xe'),_0x4cc127,_0x5347e3[_0xd0da('0xf')][_0xd0da('0x10')]);return _0xc594e7(_0x5347e3['error']['message']);}else{logger[_0xd0da('0xa')]('CmCustomField,\x20%s,\x20%s',_0x4cc127,'request\x20sent');_0xc594e7(_0x5347e3['result'][_0xd0da('0x10')]);}})[_0xd0da('0x11')](function(_0x23f175){logger[_0xd0da('0xf')](_0xd0da('0xe'),_0x4cc127,_0x23f175);_0x540b52(_0x23f175);});});} \ No newline at end of file +var _0x4a20=['jayson/promise','http','request','info','request\x20sent','debug','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x377087,_0x176bb5){var _0x123abb=function(_0x2d50ba){while(--_0x2d50ba){_0x377087['push'](_0x377087['shift']());}};_0x123abb(++_0x176bb5);}(_0x4a20,0x75));var _0x04a2=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x4a20[_0x12fc8d];return _0x3f9d04;};'use strict';var _=require('lodash');var util=require(_0x04a2('0x0'));var moment=require(_0x04a2('0x1'));var BPromise=require(_0x04a2('0x2'));var rs=require(_0x04a2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x04a2('0x4'))['db'];var utils=require(_0x04a2('0x5'));var logger=require(_0x04a2('0x6'))(_0x04a2('0x7'));var config=require(_0x04a2('0x8'));var jayson=require(_0x04a2('0x9'));var client=jayson['client'][_0x04a2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x79755b,_0x1a93ba,_0x1c27da){return new BPromise(function(_0x157943,_0x4dca0c){return client[_0x04a2('0xb')](_0x79755b,_0x1c27da)['then'](function(_0x152220){logger[_0x04a2('0xc')]('CmCustomField,\x20%s,\x20%s',_0x1a93ba,_0x04a2('0xd'));logger[_0x04a2('0xe')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x1a93ba,_0x04a2('0xd'),JSON[_0x04a2('0xf')](_0x152220));if(_0x152220[_0x04a2('0x10')]){if(_0x152220[_0x04a2('0x10')][_0x04a2('0x11')]===0x1f4){logger[_0x04a2('0x10')](_0x04a2('0x12'),_0x1a93ba,_0x152220[_0x04a2('0x10')]['message']);return _0x4dca0c(_0x152220[_0x04a2('0x10')]['message']);}logger['error']('CmCustomField,\x20%s,\x20%s',_0x1a93ba,_0x152220[_0x04a2('0x10')][_0x04a2('0x13')]);return _0x157943(_0x152220[_0x04a2('0x10')][_0x04a2('0x13')]);}else{logger['info']('CmCustomField,\x20%s,\x20%s',_0x1a93ba,_0x04a2('0xd'));_0x157943(_0x152220['result']['message']);}})[_0x04a2('0x14')](function(_0x559eec){logger[_0x04a2('0x10')](_0x04a2('0x12'),_0x1a93ba,_0x559eec);_0x4dca0c(_0x559eec);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index b792def..ade6f14 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 _0x3212=['post','isAuthenticated','create','put','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','index','/:id','show'];(function(_0x5c7bdb,_0x28c954){var _0xb60cd4=function(_0x2d7c80){while(--_0x2d7c80){_0x5c7bdb['push'](_0x5c7bdb['shift']());}};_0xb60cd4(++_0x28c954);}(_0x3212,0x6f));var _0x2321=function(_0x13332c,_0x516b5a){_0x13332c=_0x13332c-0x0;var _0x4571ca=_0x3212[_0x13332c];return _0x4571ca;};'use strict';var multer=require(_0x2321('0x0'));var util=require(_0x2321('0x1'));var path=require(_0x2321('0x2'));var timeout=require(_0x2321('0x3'));var express=require(_0x2321('0x4'));var router=express[_0x2321('0x5')]();var fs_extra=require(_0x2321('0x6'));var auth=require(_0x2321('0x7'));var interaction=require(_0x2321('0x8'));var config=require(_0x2321('0x9'));var controller=require(_0x2321('0xa'));router[_0x2321('0xb')]('/',auth['isAuthenticated'](),controller[_0x2321('0xc')]);router[_0x2321('0xb')](_0x2321('0xd'),auth['isAuthenticated'](),controller[_0x2321('0xe')]);router[_0x2321('0xf')]('/',auth[_0x2321('0x10')](),controller[_0x2321('0x11')]);router[_0x2321('0x12')](_0x2321('0xd'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x2321('0x10')](),controller[_0x2321('0x13')]);module[_0x2321('0x14')]=router; \ No newline at end of file +var _0xafca=['put','destroy','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','isAuthenticated','index','get','/:id','show','post','create'];(function(_0x9edd13,_0x469585){var _0x13ef32=function(_0x181a11){while(--_0x181a11){_0x9edd13['push'](_0x9edd13['shift']());}};_0x13ef32(++_0x469585);}(_0xafca,0x1ef));var _0xaafc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xafca[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xaafc('0x0'));var util=require('util');var path=require(_0xaafc('0x1'));var timeout=require(_0xaafc('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xaafc('0x3'));var auth=require(_0xaafc('0x4'));var interaction=require(_0xaafc('0x5'));var config=require(_0xaafc('0x6'));var controller=require(_0xaafc('0x7'));router['get']('/',auth[_0xaafc('0x8')](),controller[_0xaafc('0x9')]);router[_0xaafc('0xa')](_0xaafc('0xb'),auth[_0xaafc('0x8')](),controller[_0xaafc('0xc')]);router[_0xaafc('0xd')]('/',auth[_0xaafc('0x8')](),controller[_0xaafc('0xe')]);router[_0xaafc('0xf')](_0xaafc('0xb'),auth[_0xaafc('0x8')](),controller['update']);router['delete'](_0xaafc('0xb'),auth['isAuthenticated'](),controller[_0xaafc('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index ed1b804..3f7e130 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 _0x1924=['sequelize','exports','BOOLEAN','format','INTEGER','STRING','DATE','UNSIGNED','contactListQueue'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1924,0x1cb));var _0x4192=function(_0x55ef68,_0x37f975){_0x55ef68=_0x55ef68-0x0;var _0x310990=_0x1924[_0x55ef68];return _0x310990;};'use strict';var moment=require('moment');var Sequelize=require(_0x4192('0x0'));module[_0x4192('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x4192('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x4192('0x3')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x4192('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x4192('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4192('0x4')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x4192('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x4192('0x5')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x4192('0x6')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x4192('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x4192('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x4192('0x8')},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0x4192('0x4')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x4192('0x8')},'CampaignId':{'type':Sequelize[_0x4192('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x4192('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4192('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x4192('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4192('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4192('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8404=['YYYY-MM-DD\x20HH:mm:ss','INTEGER','contactListQueue','sequelize','STRING','BOOLEAN','DATE','format'];(function(_0x5b87b3,_0x1f69fc){var _0x49c0b5=function(_0x5cb225){while(--_0x5cb225){_0x5b87b3['push'](_0x5b87b3['shift']());}};_0x49c0b5(++_0x1f69fc);}(_0x8404,0x143));var _0x4840=function(_0x29dd7c,_0x390efe){_0x29dd7c=_0x29dd7c-0x0;var _0x200c89=_0x8404[_0x29dd7c];return _0x200c89;};'use strict';var moment=require('moment');var Sequelize=require(_0x4840('0x0'));module['exports']={'phone':{'type':Sequelize[_0x4840('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0x4840('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x4840('0x3')],'defaultValue':moment()[_0x4840('0x4')](_0x4840('0x5'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x4840('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4840('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x4840('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x4840('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x4840('0x3')]},'priority':{'type':Sequelize[_0x4840('0x6')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x4840('0x6')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x4840('0x6')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0x4840('0x6')]},'VoiceQueueId':{'type':Sequelize[_0x4840('0x6')],'unique':_0x4840('0x7')},'CampaignId':{'type':Sequelize[_0x4840('0x6')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4840('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x4840('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4840('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4840('0x6')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index e756005..94fedba 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 _0x20fc=['options','CmHopper','includeAll','findAll','rows','show','catch','create','body','find','params','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','state','campaign','user','UserId','deleted','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','campaigntype','queue','ivr','CmContact','firstName','isNil','lastName','calleridname','finally','CmHopperFinal','getPreview','describe','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','transaction','direction','hopperIds','priority','ASC','scheduledAt','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','LOCK','UPDATE','CmCompany','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','path','sox','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','type','key','query','keys','filters','model','concat','$and','$or','$gte','$lt','$lte','$ne','$eq','$not','$in','$notLike','$iLike','$notILike','$like','$overlap','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x20fc,0xcd));var _0xc20f=function(_0x1bbc08,_0x444008){_0x1bbc08=_0x1bbc08-0x0;var _0x5d825b=_0x20fc[_0x1bbc08];return _0x5d825b;};'use strict';var emlformat=require(_0xc20f('0x0'));var rimraf=require(_0xc20f('0x1'));var zipdir=require(_0xc20f('0x2'));var jsonpatch=require(_0xc20f('0x3'));var rp=require(_0xc20f('0x4'));var moment=require(_0xc20f('0x5'));var BPromise=require(_0xc20f('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc20f('0x7'));var sox=require(_0xc20f('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc20f('0x9'));var _=require('lodash');var squel=require(_0xc20f('0xa'));var crypto=require(_0xc20f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xc20f('0xc'));var toCsv=require('to-csv');var querystring=require(_0xc20f('0xd'));var Papa=require(_0xc20f('0xe'));var Redis=require(_0xc20f('0xf'));var authService=require(_0xc20f('0x10'));var qs=require(_0xc20f('0x11'));var as=require(_0xc20f('0x12'));var hardwareService=require(_0xc20f('0x13'));var logger=require(_0xc20f('0x14'))(_0xc20f('0x15'));var utils=require('../../config/utils');var config=require(_0xc20f('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x238d4e,_0x2c694b){_0x2c694b=_0x2c694b||0xcc;return function(_0x4d3dcd){if(_0x4d3dcd){return _0x238d4e[_0xc20f('0x17')](_0x2c694b);}return _0x238d4e['status'](_0x2c694b)[_0xc20f('0x18')]();};}function respondWithResult(_0x210714,_0x242a3f){_0x242a3f=_0x242a3f||0xc8;return function(_0x541808){if(_0x541808){return _0x210714['status'](_0x242a3f)[_0xc20f('0x19')](_0x541808);}};}function respondWithFilteredResult(_0x24a2cc,_0xf2c07d){return function(_0x1847c2){if(_0x1847c2){var _0x2fecc1=typeof _0xf2c07d[_0xc20f('0x1a')]===_0xc20f('0x1b')&&typeof _0xf2c07d[_0xc20f('0x1c')]===_0xc20f('0x1b');var _0x109595=_0x1847c2[_0xc20f('0x1d')];var _0x3a55a0=_0x2fecc1?0x0:_0xf2c07d[_0xc20f('0x1a')];var _0x2fdeee=_0x2fecc1?_0x1847c2[_0xc20f('0x1d')]:_0xf2c07d['offset']+_0xf2c07d[_0xc20f('0x1c')];var _0x5a2398;if(_0x2fdeee>=_0x109595){_0x2fdeee=_0x109595;_0x5a2398=0xc8;}else{_0x5a2398=0xce;}_0x24a2cc[_0xc20f('0x1e')](_0x5a2398);return _0x24a2cc[_0xc20f('0x1f')](_0xc20f('0x20'),_0x3a55a0+'-'+_0x2fdeee+'/'+_0x109595)[_0xc20f('0x19')](_0x1847c2);}return null;};}function patchUpdates(_0x470a12){return function(_0x1be745){try{jsonpatch['apply'](_0x1be745,_0x470a12,!![]);}catch(_0x18e753){return BPromise['reject'](_0x18e753);}return _0x1be745[_0xc20f('0x21')]();};}function saveUpdates(_0xf4aa16,_0x267144){return function(_0x1be519){if(_0x1be519){return _0x1be519[_0xc20f('0x22')](_0xf4aa16)['then'](function(_0x307beb){return _0x307beb;});}return null;};}function removeEntity(_0x38d120,_0x1bada){return function(_0xebabce){if(_0xebabce){return _0xebabce[_0xc20f('0x23')]()[_0xc20f('0x24')](function(){_0x38d120[_0xc20f('0x1e')](0xcc)[_0xc20f('0x18')]();});}};}function handleEntityNotFound(_0x5b65ce,_0x368b75){return function(_0x26afb6){if(!_0x26afb6){_0x5b65ce[_0xc20f('0x17')](0x194);}return _0x26afb6;};}function handleError(_0xd726bc,_0x24308f){_0x24308f=_0x24308f||0x1f4;return function(_0x53e6d5){logger[_0xc20f('0x25')](_0x53e6d5[_0xc20f('0x26')]);if(_0x53e6d5[_0xc20f('0x27')]){delete _0x53e6d5[_0xc20f('0x27')];}_0xd726bc[_0xc20f('0x1e')](_0x24308f)[_0xc20f('0x28')](_0x53e6d5);};}exports[_0xc20f('0x29')]=function(_0x12b5b0,_0x532343){var _0x38af45={},_0xfd3b7e={},_0xe6362d={'count':0x0,'rows':[]};var _0x1dfd37=_[_0xc20f('0x2a')](db['CmHopper'][_0xc20f('0x2b')],function(_0x104f7b){return{'name':_0x104f7b['fieldName'],'type':_0x104f7b[_0xc20f('0x2c')][_0xc20f('0x2d')]};});_0xfd3b7e['model']=_[_0xc20f('0x2a')](_0x1dfd37,_0xc20f('0x27'));_0xfd3b7e[_0xc20f('0x2e')]=_[_0xc20f('0x2f')](_0x12b5b0[_0xc20f('0x2e')]);_0xfd3b7e[_0xc20f('0x30')]=_['intersection'](_0xfd3b7e[_0xc20f('0x31')],_0xfd3b7e[_0xc20f('0x2e')]);_0xfd3b7e[_0xc20f('0x30')]=_[_0xc20f('0x32')](_0xfd3b7e['filters'],[_0xc20f('0x33'),_0xc20f('0x34'),'$gt',_0xc20f('0x35'),_0xc20f('0x36'),_0xc20f('0x37'),_0xc20f('0x38'),_0xc20f('0x39'),_0xc20f('0x3a'),'$between','$notBetween',_0xc20f('0x3b'),'$notIn','$like',_0xc20f('0x3c'),_0xc20f('0x3d'),_0xc20f('0x3e'),_0xc20f('0x3f'),_0xc20f('0x40'),'$contains','$contained','$any']);_0x38af45[_0xc20f('0x41')]=_['intersection'](_0xfd3b7e[_0xc20f('0x31')],qs['fields'](_0x12b5b0[_0xc20f('0x2e')][_0xc20f('0x42')]));_0x38af45[_0xc20f('0x41')]=_0x38af45[_0xc20f('0x41')][_0xc20f('0x43')]?_0x38af45[_0xc20f('0x41')]:_0xfd3b7e[_0xc20f('0x31')];if(!_0x12b5b0[_0xc20f('0x2e')][_0xc20f('0x44')](_0xc20f('0x45'))){_0x38af45[_0xc20f('0x1c')]=qs[_0xc20f('0x1c')](_0x12b5b0[_0xc20f('0x2e')][_0xc20f('0x1c')]);_0x38af45[_0xc20f('0x1a')]=qs[_0xc20f('0x1a')](_0x12b5b0['query'][_0xc20f('0x1a')]);}_0x38af45[_0xc20f('0x46')]=qs[_0xc20f('0x47')](_0x12b5b0['query']['sort']);_0x38af45[_0xc20f('0x48')]=qs['filters'](_[_0xc20f('0x49')](_0x12b5b0['query'],_0xfd3b7e['filters']),_0x1dfd37);if(_0x12b5b0[_0xc20f('0x2e')][_0xc20f('0x4a')]){_0x38af45[_0xc20f('0x48')]=_[_0xc20f('0x4b')](_0x38af45['where'],{'$or':_[_0xc20f('0x2a')](_0x1dfd37,function(_0x3b718c){if(_0x3b718c[_0xc20f('0x2c')]!==_0xc20f('0x4c')){var _0x75fd22={};_0x75fd22[_0x3b718c[_0xc20f('0x27')]]={'$like':'%'+_0x12b5b0[_0xc20f('0x2e')]['filter']+'%'};return _0x75fd22;}})});}_0x38af45=_['merge']({},_0x38af45,_0x12b5b0[_0xc20f('0x4d')]);var _0x6fdacb={'where':_0x38af45['where']};return db[_0xc20f('0x4e')][_0xc20f('0x1d')](_0x6fdacb)[_0xc20f('0x24')](function(_0x1c7865){_0xe6362d['count']=_0x1c7865;if(_0x12b5b0[_0xc20f('0x2e')][_0xc20f('0x4f')]){_0x38af45['include']=[{'all':!![]}];}return db[_0xc20f('0x4e')][_0xc20f('0x50')](_0x38af45);})['then'](function(_0x2267e6){_0xe6362d[_0xc20f('0x51')]=_0x2267e6;return _0xe6362d;})['then'](respondWithFilteredResult(_0x532343,_0x38af45))['catch'](handleError(_0x532343,null));};exports[_0xc20f('0x52')]=function(_0x53af4f,_0x55e193){var _0x2c379e={'raw':!![],'where':{'id':_0x53af4f['params']['id']}},_0x58932b={};_0x58932b[_0xc20f('0x31')]=_[_0xc20f('0x2f')](db[_0xc20f('0x4e')][_0xc20f('0x2b')]);_0x58932b[_0xc20f('0x2e')]=_[_0xc20f('0x2f')](_0x53af4f['query']);_0x58932b[_0xc20f('0x30')]=_['intersection'](_0x58932b[_0xc20f('0x31')],_0x58932b[_0xc20f('0x2e')]);_0x2c379e[_0xc20f('0x41')]=_['intersection'](_0x58932b[_0xc20f('0x31')],qs[_0xc20f('0x42')](_0x53af4f[_0xc20f('0x2e')]['fields']));_0x2c379e[_0xc20f('0x41')]=_0x2c379e[_0xc20f('0x41')][_0xc20f('0x43')]?_0x2c379e['attributes']:_0x58932b[_0xc20f('0x31')];if(_0x53af4f[_0xc20f('0x2e')][_0xc20f('0x4f')]){_0x2c379e['include']=[{'all':!![]}];}_0x2c379e=_[_0xc20f('0x4b')]({},_0x2c379e,_0x53af4f[_0xc20f('0x4d')]);return db[_0xc20f('0x4e')]['find'](_0x2c379e)[_0xc20f('0x24')](handleEntityNotFound(_0x55e193,null))['then'](respondWithResult(_0x55e193,null))[_0xc20f('0x53')](handleError(_0x55e193,null));};exports[_0xc20f('0x54')]=function(_0x670b33,_0x2f1b61){return db[_0xc20f('0x4e')][_0xc20f('0x54')](_0x670b33['body'],{})[_0xc20f('0x24')](respondWithResult(_0x2f1b61,0xc9))[_0xc20f('0x53')](handleError(_0x2f1b61,null));};exports[_0xc20f('0x22')]=function(_0x473899,_0x4fe39d){if(_0x473899[_0xc20f('0x55')]['id']){delete _0x473899[_0xc20f('0x55')]['id'];}return db[_0xc20f('0x4e')][_0xc20f('0x56')]({'where':{'id':_0x473899[_0xc20f('0x57')]['id']}})[_0xc20f('0x24')](handleEntityNotFound(_0x4fe39d,null))['then'](saveUpdates(_0x473899['body'],null))[_0xc20f('0x24')](respondWithResult(_0x4fe39d,null))['catch'](handleError(_0x4fe39d,null));};exports['describe']=function(_0x5d3054,_0x366019){return db[_0xc20f('0x4e')]['describe']()['then'](respondWithResult(_0x366019,null))[_0xc20f('0x53')](handleError(_0x366019,null));};exports['destroy']=function(_0x349201,_0x198c09){var _0x564699;return db[_0xc20f('0x4e')][_0xc20f('0x56')]({'where':{'id':_0x349201['params']['id']}})['then'](handleEntityNotFound(_0x198c09,null))[_0xc20f('0x24')](function(_0x1e6b24){if(_0x1e6b24){return _0x1e6b24[_0xc20f('0x23')]()[_0xc20f('0x24')](function(_0x2d02b2){return _0x2d02b2;});}})['then'](function(_0x5ac9f0){_0x564699=_0x5ac9f0;if(_0x5ac9f0){if(_0x5ac9f0[_0xc20f('0x58')]||_0x5ac9f0[_0xc20f('0x59')]){return db[_0x5ac9f0[_0xc20f('0x58')]?_0xc20f('0x5a'):_0xc20f('0x5b')]['find']({'where':{'id':_0x5ac9f0[_0xc20f('0x58')]?_0x5ac9f0[_0xc20f('0x58')]:_0x5ac9f0[_0xc20f('0x59')]},'attributes':['id',_0xc20f('0x27')],'raw':!![]});}}})[_0xc20f('0x24')](function(_0x492386){var _0x534f2a={};if(_0x492386){_[_0xc20f('0x4b')](_0x534f2a,_[_0xc20f('0x5c')](_0x564699[_0xc20f('0x5d')],[_0xc20f('0x5e'),'updatedAt','id']));_0x534f2a[_0xc20f('0x5f')]=0x15;_0x534f2a['statedesc']='deleted';_0x534f2a[_0xc20f('0x60')]=_0x492386[_0xc20f('0x27')];_0x534f2a['membername']=_0x349201[_0xc20f('0x61')][_0xc20f('0x27')];_0x534f2a[_0xc20f('0x62')]=_0x349201[_0xc20f('0x61')]['id'];_0x534f2a[_0xc20f('0x63')]=!![];_0x534f2a[_0xc20f('0x64')]=moment()[_0xc20f('0x65')](_0xc20f('0x66'));_0x534f2a['calleridnum']=_0x564699['phone'];_0x534f2a[_0xc20f('0x67')]=_0x564699['VoiceQueueId']?_0xc20f('0x68'):_0xc20f('0x69');return db[_0xc20f('0x6a')][_0xc20f('0x56')]({'where':{'id':_0x534f2a['ContactId']},'attributes':[_0xc20f('0x6b'),'lastName']})[_0xc20f('0x24')](function(_0x201ff0){if(!_[_0xc20f('0x6c')](_0x198c09)&&!_['isNil'](_0x201ff0[_0xc20f('0x6b')])){_0x534f2a['calleridname']=_0x201ff0[_0xc20f('0x6b')];if(!_[_0xc20f('0x6c')](_0x201ff0[_0xc20f('0x6d')])){_0x534f2a[_0xc20f('0x6e')]+='\x20'+_0x201ff0[_0xc20f('0x6d')];}}})[_0xc20f('0x6f')](function(){return db[_0xc20f('0x70')][_0xc20f('0x54')](_0x534f2a);});}})['then'](function(){return _0x198c09[_0xc20f('0x1e')](0xcc)[_0xc20f('0x18')]();})[_0xc20f('0x53')](handleError(_0x198c09,null));};exports[_0xc20f('0x71')]=function(_0x20f213,_0x12ea58,_0x2656f5){var _0xbc8901=[];return db[_0xc20f('0x6a')][_0xc20f('0x72')]()[_0xc20f('0x24')](function(_0x154cb5){_0xbc8901=_['keys'](_0x154cb5);return _0x20f213[_0xc20f('0x61')][_0xc20f('0x73')]({'where':{'type':_0xc20f('0x74'),'dialActive':!![],'dialMethod':_0xc20f('0x75')},'attributes':['id',_0xc20f('0x76')],'raw':!![]});})[_0xc20f('0x24')](function(_0x55f8a6){if(_0x55f8a6&&_0x55f8a6[_0xc20f('0x43')]){return db[_0xc20f('0x77')][_0xc20f('0x78')](function(_0x4d741b){var _0x501a34={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xc20f('0x65')](_0xc20f('0x66'))},'VoiceQueueId':{'$in':_[_0xc20f('0x2a')](_0x55f8a6,'id')},'$or':[{'UserId':null},{'UserId':_0x20f213[_0xc20f('0x61')]['id']}]};var _0x2804ac=[];if(_0x20f213['body'][_0xc20f('0x79')]&&_0x20f213[_0xc20f('0x55')]['direction']==='prev'){if(!_['isEmpty'](_0x20f213[_0xc20f('0x55')][_0xc20f('0x7a')])){_0x501a34['id']={'$in':_0x20f213[_0xc20f('0x55')][_0xc20f('0x7a')]};}_0x2804ac=[[_0xc20f('0x7b'),_0xc20f('0x7c')],[_0xc20f('0x7d'),_0x55f8a6[0x0]['dialOrderByScheduledAt']===_0xc20f('0x7c')?_0xc20f('0x7e'):_0xc20f('0x7c')],db[_0xc20f('0x77')]['literal'](_0xc20f('0x7f')),['id',_0xc20f('0x7e')]];}else{if(!_['isEmpty'](_0x20f213[_0xc20f('0x55')][_0xc20f('0x7a')])){_0x501a34['id']={'$notIn':_0x20f213['body'][_0xc20f('0x7a')]};}_0x2804ac=[[_0xc20f('0x7b'),_0xc20f('0x7e')],['scheduledAt',_0x55f8a6[0x0][_0xc20f('0x76')]],db[_0xc20f('0x77')][_0xc20f('0x80')](_0xc20f('0x81')),['id',_0xc20f('0x7c')]];}return db[_0xc20f('0x4e')]['findOne']({'attributes':['id',_0xc20f('0x82')],'where':_0x501a34,'order':_0x2804ac,'transaction':_0x4d741b,'lock':_0x4d741b[_0xc20f('0x83')][_0xc20f('0x84')],'include':[{'model':db[_0xc20f('0x6a')],'as':'Contact','attributes':_0xbc8901,'include':[{'model':db[_0xc20f('0x85')],'as':'Company','attributes':['id',_0xc20f('0x27')]}]},{'model':db['CmList'],'as':_0xc20f('0x86'),'attributes':['id',_0xc20f('0x27')]},{'model':db[_0xc20f('0x5a')],'as':_0xc20f('0x87'),'attributes':['id',_0xc20f('0x27'),_0xc20f('0x88')]}]})[_0xc20f('0x24')](function(_0x50818f){if(_0x50818f){return _0x50818f[_0xc20f('0x22')]({'UserId':_0x20f213[_0xc20f('0x61')]['id']},{'transaction':_0x4d741b});}});});}})[_0xc20f('0x24')](handleEntityNotFound(_0x12ea58,null))[_0xc20f('0x24')](respondWithResult(_0x12ea58,null))[_0xc20f('0x53')](handleError(_0x12ea58,null));};exports[_0xc20f('0x89')]=function(_0x31c599,_0xff1eae,_0x2064ea){return _0x31c599[_0xc20f('0x61')][_0xc20f('0x73')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0xc20f('0x24')](function(_0x271c8c){if(_0x271c8c&&_0x271c8c[_0xc20f('0x43')]){return db['CmHopper']['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xc20f('0x65')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x271c8c,'id')},'$or':[{'UserId':null},{'UserId':_0x31c599[_0xc20f('0x61')]['id']}]}});}return 0x0;})[_0xc20f('0x24')](function(_0x49ecf5){if(!_[_0xc20f('0x6c')](_0x49ecf5)&&_[_0xc20f('0x8a')](_0x49ecf5)){return _0xff1eae[_0xc20f('0x1e')](0xc8)[_0xc20f('0x19')]({'contacts':_0x49ecf5});}else{logger[_0xc20f('0x25')](_0xc20f('0x8b'),_0xc20f('0x89'),0x194,_0xc20f('0x8c'));_0xff1eae[_0xc20f('0x17')](0x194);}})['catch'](handleError(_0xff1eae,null));}; \ No newline at end of file +var _0x933a=['status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','error','name','index','map','CmHopper','rawAttributes','fieldName','type','model','query','keys','filters','intersection','concat','$and','$or','$gte','$lt','$ne','$eq','$notBetween','$notIn','$notLike','$notILike','$like','$overlap','$contained','$any','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','find','create','update','body','VoiceQueueId','VoiceQueue','Campaign','CampaignId','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','user','UserId','deletedat','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','transaction','format','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','LOCK','UPDATE','Contact','Company','CmList','getOpenContacts','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x36abe4,_0x8a583f){var _0x544474=function(_0x314342){while(--_0x314342){_0x36abe4['push'](_0x36abe4['shift']());}};_0x544474(++_0x8a583f);}(_0x933a,0x19a));var _0xa933=function(_0x5a9aa7,_0x55b38f){_0x5a9aa7=_0x5a9aa7-0x0;var _0x298adf=_0x933a[_0x5a9aa7];return _0x298adf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa933('0x0'));var zipdir=require(_0xa933('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa933('0x2'));var moment=require(_0xa933('0x3'));var BPromise=require(_0xa933('0x4'));var Mustache=require(_0xa933('0x5'));var util=require(_0xa933('0x6'));var path=require(_0xa933('0x7'));var sox=require('sox');var csv=require(_0xa933('0x8'));var ejs=require(_0xa933('0x9'));var fs=require('fs');var fs_extra=require(_0xa933('0xa'));var _=require(_0xa933('0xb'));var squel=require(_0xa933('0xc'));var crypto=require(_0xa933('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa933('0xe'));var toCsv=require(_0xa933('0x8'));var querystring=require(_0xa933('0xf'));var Papa=require(_0xa933('0x10'));var Redis=require(_0xa933('0x11'));var authService=require(_0xa933('0x12'));var qs=require(_0xa933('0x13'));var as=require(_0xa933('0x14'));var hardwareService=require(_0xa933('0x15'));var logger=require('../../config/logger')(_0xa933('0x16'));var utils=require(_0xa933('0x17'));var config=require(_0xa933('0x18'));var licenseUtil=require(_0xa933('0x19'));var db=require(_0xa933('0x1a'))['db'];function respondWithStatusCode(_0x21ca75,_0x5d123c){_0x5d123c=_0x5d123c||0xcc;return function(_0x1fca46){if(_0x1fca46){return _0x21ca75[_0xa933('0x1b')](_0x5d123c);}return _0x21ca75[_0xa933('0x1c')](_0x5d123c)[_0xa933('0x1d')]();};}function respondWithResult(_0x3148f2,_0xd55ff5){_0xd55ff5=_0xd55ff5||0xc8;return function(_0x1a412e){if(_0x1a412e){return _0x3148f2[_0xa933('0x1c')](_0xd55ff5)['json'](_0x1a412e);}};}function respondWithFilteredResult(_0x13e6be,_0x39ee28){return function(_0xc04ce4){if(_0xc04ce4){var _0x532593=typeof _0x39ee28[_0xa933('0x1e')]===_0xa933('0x1f')&&typeof _0x39ee28[_0xa933('0x20')]==='undefined';var _0x1d34c6=_0xc04ce4[_0xa933('0x21')];var _0x156e87=_0x532593?0x0:_0x39ee28['offset'];var _0x67d3f2=_0x532593?_0xc04ce4[_0xa933('0x21')]:_0x39ee28[_0xa933('0x1e')]+_0x39ee28[_0xa933('0x20')];var _0xd7059a;if(_0x67d3f2>=_0x1d34c6){_0x67d3f2=_0x1d34c6;_0xd7059a=0xc8;}else{_0xd7059a=0xce;}_0x13e6be['status'](_0xd7059a);return _0x13e6be[_0xa933('0x22')](_0xa933('0x23'),_0x156e87+'-'+_0x67d3f2+'/'+_0x1d34c6)['json'](_0xc04ce4);}return null;};}function patchUpdates(_0x359593){return function(_0x5b38d6){try{jsonpatch[_0xa933('0x24')](_0x5b38d6,_0x359593,!![]);}catch(_0x171da3){return BPromise[_0xa933('0x25')](_0x171da3);}return _0x5b38d6[_0xa933('0x26')]();};}function saveUpdates(_0x47d381,_0x504de9){return function(_0x2d60f8){if(_0x2d60f8){return _0x2d60f8['update'](_0x47d381)['then'](function(_0x1600bb){return _0x1600bb;});}return null;};}function removeEntity(_0x3d7bec,_0x51fab2){return function(_0xadabfc){if(_0xadabfc){return _0xadabfc[_0xa933('0x27')]()[_0xa933('0x28')](function(){_0x3d7bec[_0xa933('0x1c')](0xcc)[_0xa933('0x1d')]();});}};}function handleEntityNotFound(_0x313846,_0x1237f1){return function(_0x191c33){if(!_0x191c33){_0x313846[_0xa933('0x1b')](0x194);}return _0x191c33;};}function handleError(_0x4e8039,_0xb9ff9){_0xb9ff9=_0xb9ff9||0x1f4;return function(_0x46bcd1){logger[_0xa933('0x29')](_0x46bcd1['stack']);if(_0x46bcd1[_0xa933('0x2a')]){delete _0x46bcd1[_0xa933('0x2a')];}_0x4e8039[_0xa933('0x1c')](_0xb9ff9)['send'](_0x46bcd1);};}exports[_0xa933('0x2b')]=function(_0x2dcd8e,_0x3d025e){var _0x5e3323={},_0x381354={},_0x360a5c={'count':0x0,'rows':[]};var _0x409c27=_[_0xa933('0x2c')](db[_0xa933('0x2d')][_0xa933('0x2e')],function(_0x2d21ab){return{'name':_0x2d21ab[_0xa933('0x2f')],'type':_0x2d21ab[_0xa933('0x30')]['key']};});_0x381354[_0xa933('0x31')]=_['map'](_0x409c27,'name');_0x381354[_0xa933('0x32')]=_[_0xa933('0x33')](_0x2dcd8e[_0xa933('0x32')]);_0x381354[_0xa933('0x34')]=_[_0xa933('0x35')](_0x381354[_0xa933('0x31')],_0x381354[_0xa933('0x32')]);_0x381354[_0xa933('0x34')]=_[_0xa933('0x36')](_0x381354[_0xa933('0x34')],[_0xa933('0x37'),_0xa933('0x38'),'$gt',_0xa933('0x39'),_0xa933('0x3a'),'$lte',_0xa933('0x3b'),_0xa933('0x3c'),'$not','$between',_0xa933('0x3d'),'$in',_0xa933('0x3e'),'$like',_0xa933('0x3f'),'$iLike',_0xa933('0x40'),_0xa933('0x41'),_0xa933('0x42'),'$contains',_0xa933('0x43'),_0xa933('0x44')]);_0x5e3323['attributes']=_[_0xa933('0x35')](_0x381354[_0xa933('0x31')],qs[_0xa933('0x45')](_0x2dcd8e['query'][_0xa933('0x45')]));_0x5e3323[_0xa933('0x46')]=_0x5e3323[_0xa933('0x46')][_0xa933('0x47')]?_0x5e3323[_0xa933('0x46')]:_0x381354['model'];if(!_0x2dcd8e[_0xa933('0x32')][_0xa933('0x48')](_0xa933('0x49'))){_0x5e3323['limit']=qs[_0xa933('0x20')](_0x2dcd8e[_0xa933('0x32')][_0xa933('0x20')]);_0x5e3323['offset']=qs[_0xa933('0x1e')](_0x2dcd8e[_0xa933('0x32')][_0xa933('0x1e')]);}_0x5e3323['order']=qs['sort'](_0x2dcd8e[_0xa933('0x32')][_0xa933('0x4a')]);_0x5e3323[_0xa933('0x4b')]=qs[_0xa933('0x34')](_['pick'](_0x2dcd8e[_0xa933('0x32')],_0x381354[_0xa933('0x34')]),_0x409c27);if(_0x2dcd8e[_0xa933('0x32')][_0xa933('0x4c')]){_0x5e3323[_0xa933('0x4b')]=_[_0xa933('0x4d')](_0x5e3323[_0xa933('0x4b')],{'$or':_[_0xa933('0x2c')](_0x409c27,function(_0x5456d9){if(_0x5456d9[_0xa933('0x30')]!==_0xa933('0x4e')){var _0x25e4ca={};_0x25e4ca[_0x5456d9[_0xa933('0x2a')]]={'$like':'%'+_0x2dcd8e[_0xa933('0x32')]['filter']+'%'};return _0x25e4ca;}})});}_0x5e3323=_['merge']({},_0x5e3323,_0x2dcd8e[_0xa933('0x4f')]);var _0x22d201={'where':_0x5e3323[_0xa933('0x4b')]};return db['CmHopper']['count'](_0x22d201)[_0xa933('0x28')](function(_0x1d5db0){_0x360a5c[_0xa933('0x21')]=_0x1d5db0;if(_0x2dcd8e['query'][_0xa933('0x50')]){_0x5e3323[_0xa933('0x51')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x5e3323);})[_0xa933('0x28')](function(_0xdff78c){_0x360a5c['rows']=_0xdff78c;return _0x360a5c;})[_0xa933('0x28')](respondWithFilteredResult(_0x3d025e,_0x5e3323))[_0xa933('0x52')](handleError(_0x3d025e,null));};exports[_0xa933('0x53')]=function(_0x4eac08,_0x43cb6e){var _0x4c0199={'raw':!![],'where':{'id':_0x4eac08[_0xa933('0x54')]['id']}},_0x3cc561={};_0x3cc561['model']=_['keys'](db[_0xa933('0x2d')]['rawAttributes']);_0x3cc561[_0xa933('0x32')]=_['keys'](_0x4eac08['query']);_0x3cc561[_0xa933('0x34')]=_['intersection'](_0x3cc561[_0xa933('0x31')],_0x3cc561[_0xa933('0x32')]);_0x4c0199['attributes']=_['intersection'](_0x3cc561[_0xa933('0x31')],qs['fields'](_0x4eac08[_0xa933('0x32')][_0xa933('0x45')]));_0x4c0199[_0xa933('0x46')]=_0x4c0199[_0xa933('0x46')][_0xa933('0x47')]?_0x4c0199['attributes']:_0x3cc561[_0xa933('0x31')];if(_0x4eac08[_0xa933('0x32')][_0xa933('0x50')]){_0x4c0199[_0xa933('0x51')]=[{'all':!![]}];}_0x4c0199=_[_0xa933('0x4d')]({},_0x4c0199,_0x4eac08[_0xa933('0x4f')]);return db[_0xa933('0x2d')][_0xa933('0x55')](_0x4c0199)['then'](handleEntityNotFound(_0x43cb6e,null))['then'](respondWithResult(_0x43cb6e,null))[_0xa933('0x52')](handleError(_0x43cb6e,null));};exports[_0xa933('0x56')]=function(_0x5e23e0,_0x19d218){return db[_0xa933('0x2d')][_0xa933('0x56')](_0x5e23e0['body'],{})[_0xa933('0x28')](respondWithResult(_0x19d218,0xc9))[_0xa933('0x52')](handleError(_0x19d218,null));};exports[_0xa933('0x57')]=function(_0x560a52,_0x302ec5){if(_0x560a52[_0xa933('0x58')]['id']){delete _0x560a52[_0xa933('0x58')]['id'];}return db['CmHopper'][_0xa933('0x55')]({'where':{'id':_0x560a52['params']['id']}})['then'](handleEntityNotFound(_0x302ec5,null))[_0xa933('0x28')](saveUpdates(_0x560a52[_0xa933('0x58')],null))[_0xa933('0x28')](respondWithResult(_0x302ec5,null))[_0xa933('0x52')](handleError(_0x302ec5,null));};exports['describe']=function(_0x34bf26,_0x58bc81){return db[_0xa933('0x2d')]['describe']()['then'](respondWithResult(_0x58bc81,null))['catch'](handleError(_0x58bc81,null));};exports[_0xa933('0x27')]=function(_0x20a30d,_0x1224e4){var _0x4b1da3;return db[_0xa933('0x2d')][_0xa933('0x55')]({'where':{'id':_0x20a30d['params']['id']}})[_0xa933('0x28')](handleEntityNotFound(_0x1224e4,null))['then'](function(_0x11acd2){if(_0x11acd2){return _0x11acd2[_0xa933('0x27')]()[_0xa933('0x28')](function(_0xa14662){return _0xa14662;});}})['then'](function(_0xe3d503){_0x4b1da3=_0xe3d503;if(_0xe3d503){if(_0xe3d503[_0xa933('0x59')]||_0xe3d503['CampaignId']){return db[_0xe3d503[_0xa933('0x59')]?_0xa933('0x5a'):_0xa933('0x5b')][_0xa933('0x55')]({'where':{'id':_0xe3d503[_0xa933('0x59')]?_0xe3d503['VoiceQueueId']:_0xe3d503[_0xa933('0x5c')]},'attributes':['id',_0xa933('0x2a')],'raw':!![]});}}})['then'](function(_0x40b7fb){var _0x39a0cf={};if(_0x40b7fb){_[_0xa933('0x4d')](_0x39a0cf,_[_0xa933('0x5d')](_0x4b1da3[_0xa933('0x5e')],[_0xa933('0x5f'),_0xa933('0x60'),'id']));_0x39a0cf[_0xa933('0x61')]=0x15;_0x39a0cf[_0xa933('0x62')]=_0xa933('0x63');_0x39a0cf[_0xa933('0x64')]=_0x40b7fb['name'];_0x39a0cf[_0xa933('0x65')]=_0x20a30d[_0xa933('0x66')][_0xa933('0x2a')];_0x39a0cf[_0xa933('0x67')]=_0x20a30d[_0xa933('0x66')]['id'];_0x39a0cf[_0xa933('0x63')]=!![];_0x39a0cf[_0xa933('0x68')]=moment()['format'](_0xa933('0x69'));_0x39a0cf[_0xa933('0x6a')]=_0x4b1da3[_0xa933('0x6b')];_0x39a0cf[_0xa933('0x6c')]=_0x4b1da3[_0xa933('0x59')]?'queue':_0xa933('0x6d');return db[_0xa933('0x6e')][_0xa933('0x55')]({'where':{'id':_0x39a0cf[_0xa933('0x6f')]},'attributes':[_0xa933('0x70'),_0xa933('0x71')]})[_0xa933('0x28')](function(_0x2eb8a1){if(!_[_0xa933('0x72')](_0x1224e4)&&!_[_0xa933('0x72')](_0x2eb8a1[_0xa933('0x70')])){_0x39a0cf[_0xa933('0x73')]=_0x2eb8a1['firstName'];if(!_[_0xa933('0x72')](_0x2eb8a1[_0xa933('0x71')])){_0x39a0cf['calleridname']+='\x20'+_0x2eb8a1[_0xa933('0x71')];}}})[_0xa933('0x74')](function(){return db[_0xa933('0x75')][_0xa933('0x56')](_0x39a0cf);});}})['then'](function(){return _0x1224e4[_0xa933('0x1c')](0xcc)[_0xa933('0x1d')]();})['catch'](handleError(_0x1224e4,null));};exports[_0xa933('0x76')]=function(_0x49b760,_0x1abe2e,_0x142547){var _0x505ad7=[];return db[_0xa933('0x6e')]['describe']()[_0xa933('0x28')](function(_0x4abbbc){_0x505ad7=_[_0xa933('0x33')](_0x4abbbc);return _0x49b760[_0xa933('0x66')][_0xa933('0x77')]({'where':{'type':_0xa933('0x78'),'dialActive':!![],'dialMethod':_0xa933('0x79')},'attributes':['id',_0xa933('0x7a')],'raw':!![]});})[_0xa933('0x28')](function(_0x1807ff){if(_0x1807ff&&_0x1807ff['length']){return db[_0xa933('0x7b')][_0xa933('0x7c')](function(_0x2e291e){var _0x11328e={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xa933('0x7d')](_0xa933('0x69'))},'VoiceQueueId':{'$in':_[_0xa933('0x2c')](_0x1807ff,'id')},'$or':[{'UserId':null},{'UserId':_0x49b760[_0xa933('0x66')]['id']}]};var _0x61dbac=[];if(_0x49b760[_0xa933('0x58')][_0xa933('0x7e')]&&_0x49b760[_0xa933('0x58')][_0xa933('0x7e')]===_0xa933('0x7f')){if(!_[_0xa933('0x80')](_0x49b760[_0xa933('0x58')][_0xa933('0x81')])){_0x11328e['id']={'$in':_0x49b760[_0xa933('0x58')][_0xa933('0x81')]};}_0x61dbac=[[_0xa933('0x82'),_0xa933('0x83')],[_0xa933('0x84'),_0x1807ff[0x0][_0xa933('0x7a')]===_0xa933('0x83')?_0xa933('0x85'):_0xa933('0x83')],db[_0xa933('0x7b')]['literal'](_0xa933('0x86')),['id',_0xa933('0x85')]];}else{if(!_[_0xa933('0x80')](_0x49b760[_0xa933('0x58')][_0xa933('0x81')])){_0x11328e['id']={'$notIn':_0x49b760[_0xa933('0x58')]['hopperIds']};}_0x61dbac=[[_0xa933('0x82'),_0xa933('0x85')],[_0xa933('0x84'),_0x1807ff[0x0][_0xa933('0x7a')]],db[_0xa933('0x7b')][_0xa933('0x87')](_0xa933('0x88')),['id',_0xa933('0x83')]];}return db['CmHopper'][_0xa933('0x89')]({'attributes':['id','scheduledat'],'where':_0x11328e,'order':_0x61dbac,'transaction':_0x2e291e,'lock':_0x2e291e[_0xa933('0x8a')][_0xa933('0x8b')],'include':[{'model':db[_0xa933('0x6e')],'as':_0xa933('0x8c'),'attributes':_0x505ad7,'include':[{'model':db['CmCompany'],'as':_0xa933('0x8d'),'attributes':['id','name']}]},{'model':db[_0xa933('0x8e')],'as':'List','attributes':['id',_0xa933('0x2a')]},{'model':db[_0xa933('0x5a')],'as':'Queue','attributes':['id',_0xa933('0x2a'),'dialActive']}]})[_0xa933('0x28')](function(_0xe02e39){if(_0xe02e39){return _0xe02e39[_0xa933('0x57')]({'UserId':_0x49b760[_0xa933('0x66')]['id']},{'transaction':_0x2e291e});}});});}})['then'](handleEntityNotFound(_0x1abe2e,null))[_0xa933('0x28')](respondWithResult(_0x1abe2e,null))[_0xa933('0x52')](handleError(_0x1abe2e,null));};exports[_0xa933('0x8f')]=function(_0x1fe37d,_0x35bd56,_0x57b80c){return _0x1fe37d[_0xa933('0x66')][_0xa933('0x77')]({'where':{'type':_0xa933('0x78'),'dialActive':!![],'dialMethod':_0xa933('0x79')},'attributes':['id'],'raw':!![]})[_0xa933('0x28')](function(_0x383030){if(_0x383030&&_0x383030['length']){return db[_0xa933('0x2d')][_0xa933('0x21')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xa933('0x7d')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xa933('0x2c')](_0x383030,'id')},'$or':[{'UserId':null},{'UserId':_0x1fe37d[_0xa933('0x66')]['id']}]}});}return 0x0;})[_0xa933('0x28')](function(_0x38535b){if(!_['isNil'](_0x38535b)&&_['isNumber'](_0x38535b)){return _0x35bd56[_0xa933('0x1c')](0xc8)['json']({'contacts':_0x38535b});}else{logger[_0xa933('0x29')](_0xa933('0x90'),_0xa933('0x8f'),0x194,_0xa933('0x91'));_0x35bd56[_0xa933('0x1b')](0x194);}})[_0xa933('0x52')](handleError(_0x35bd56,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index f391eaa..f55fa66 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 _0x33af=['request-promise','path','rimraf','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','util','api','moment','bluebird'];(function(_0xa002f7,_0x18fdf5){var _0x23ad9f=function(_0x55a9e8){while(--_0x55a9e8){_0xa002f7['push'](_0xa002f7['shift']());}};_0x23ad9f(++_0x18fdf5);}(_0x33af,0xec));var _0xf33a=function(_0x480fc2,_0x482fba){_0x480fc2=_0x480fc2-0x0;var _0x540a95=_0x33af[_0x480fc2];return _0x540a95;};'use strict';var _=require('lodash');var util=require(_0xf33a('0x0'));var logger=require('../../config/logger')(_0xf33a('0x1'));var moment=require(_0xf33a('0x2'));var BPromise=require(_0xf33a('0x3'));var rp=require(_0xf33a('0x4'));var fs=require('fs');var path=require(_0xf33a('0x5'));var rimraf=require(_0xf33a('0x6'));var config=require('../../config/environment');var attributes=require(_0xf33a('0x7'));module[_0xf33a('0x8')]=function(_0x583e54,_0xc0dd13){return _0x583e54[_0xf33a('0x9')](_0xf33a('0xa'),attributes,{'tableName':_0xf33a('0xb'),'paranoid':![],'indexes':[{'name':_0xf33a('0xc'),'fields':[_0xf33a('0xc')]},{'name':'phone','fields':[_0xf33a('0xd')]},{'name':_0xf33a('0xe'),'fields':[_0xf33a('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['define','CmHopper','cm_hopper','phone','priority','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','./cmHopper.attributes','exports'];(function(_0x449511,_0x244bca){var _0x56caa5=function(_0x400fe6){while(--_0x400fe6){_0x449511['push'](_0x449511['shift']());}};_0x56caa5(++_0x244bca);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xc4aa[_0x5a776b];return _0xbbef59;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':['scheduledat']},{'name':_0xac4a('0xc'),'fields':[_0xac4a('0xc')]},{'name':_0xac4a('0xd'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 4806a03..4f62612 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 _0x2c96=['request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','findAll','options','raw','where','attributes','limit','include','map','model','then','GetCmHopper','ShowCmHopper','CmHopper','find','CreateCmHopper','create','UpdateCmHopper','update','body','destroy','DestroyCmHopper','GetContactDialer','CmContact','describe','transaction','Contact','keys','User','Agent','voicePause','UserId','push','includes','all','sequelize','CmHopperFinal','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','order','LOCK','UPDATE','length','GetContactRecallMe','GetCmHopperPreview','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','CmHopper,\x20%s,\x20%s'];(function(_0xac3b20,_0x48e68c){var _0x580caf=function(_0xa07fcd){while(--_0xa07fcd){_0xac3b20['push'](_0xac3b20['shift']());}};_0x580caf(++_0x48e68c);}(_0x2c96,0x83));var _0x62c9=function(_0x916f5f,_0x4b52e9){_0x916f5f=_0x916f5f-0x0;var _0x3a05d5=_0x2c96[_0x916f5f];return _0x3a05d5;};'use strict';var _=require(_0x62c9('0x0'));var util=require(_0x62c9('0x1'));var moment=require('moment');var BPromise=require(_0x62c9('0x2'));var rs=require(_0x62c9('0x3'));var fs=require('fs');var Redis=require(_0x62c9('0x4'));var db=require(_0x62c9('0x5'))['db'];var utils=require(_0x62c9('0x6'));var logger=require(_0x62c9('0x7'))(_0x62c9('0x8'));var config=require('../../config/environment');var jayson=require(_0x62c9('0x9'));var client=jayson[_0x62c9('0xa')][_0x62c9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4897e0,_0x179c6f,_0x23046f){return new BPromise(function(_0x4cca80,_0xcd970a){return client[_0x62c9('0xc')](_0x4897e0,_0x23046f)['then'](function(_0x3ad9e1){logger[_0x62c9('0xd')](_0x62c9('0xe'),_0x179c6f,_0x62c9('0xf'));logger[_0x62c9('0x10')](_0x62c9('0x11'),_0x179c6f,_0x62c9('0xf'),JSON[_0x62c9('0x12')](_0x3ad9e1));if(_0x3ad9e1[_0x62c9('0x13')]){if(_0x3ad9e1[_0x62c9('0x13')][_0x62c9('0x14')]===0x1f4){logger[_0x62c9('0x13')]('CmHopper,\x20%s,\x20%s',_0x179c6f,_0x3ad9e1['error'][_0x62c9('0x15')]);return _0xcd970a(_0x3ad9e1[_0x62c9('0x13')][_0x62c9('0x15')]);}logger[_0x62c9('0x13')](_0x62c9('0xe'),_0x179c6f,_0x3ad9e1[_0x62c9('0x13')][_0x62c9('0x15')]);return _0x4cca80(_0x3ad9e1[_0x62c9('0x13')][_0x62c9('0x15')]);}else{logger[_0x62c9('0xd')](_0x62c9('0xe'),_0x179c6f,_0x62c9('0xf'));_0x4cca80(_0x3ad9e1['result'][_0x62c9('0x15')]);}})[_0x62c9('0x16')](function(_0x1ba89c){logger[_0x62c9('0x13')]('CmHopper,\x20%s,\x20%s',_0x179c6f,_0x1ba89c);_0xcd970a(_0x1ba89c);});});}exports['GetCmHopper']=function(_0x14b6a0){var _0x198f1b=this;return new Promise(function(_0x4c10b7,_0x241280){return db['CmHopper'][_0x62c9('0x17')]({'raw':_0x14b6a0[_0x62c9('0x18')]?_0x14b6a0[_0x62c9('0x18')][_0x62c9('0x19')]===undefined?!![]:![]:!![],'where':_0x14b6a0[_0x62c9('0x18')]?_0x14b6a0['options'][_0x62c9('0x1a')]||null:null,'attributes':_0x14b6a0[_0x62c9('0x18')]?_0x14b6a0[_0x62c9('0x18')][_0x62c9('0x1b')]||null:null,'limit':_0x14b6a0[_0x62c9('0x18')]?_0x14b6a0[_0x62c9('0x18')][_0x62c9('0x1c')]||null:null,'include':_0x14b6a0[_0x62c9('0x18')]?_0x14b6a0[_0x62c9('0x18')][_0x62c9('0x1d')]?_[_0x62c9('0x1e')](_0x14b6a0[_0x62c9('0x18')]['include'],function(_0x5390e9){return{'model':db[_0x5390e9[_0x62c9('0x1f')]],'as':_0x5390e9['as'],'attributes':_0x5390e9[_0x62c9('0x1b')],'include':_0x5390e9[_0x62c9('0x1d')]?_[_0x62c9('0x1e')](_0x5390e9[_0x62c9('0x1d')],function(_0x27eb1e){return{'model':db[_0x27eb1e['model']],'as':_0x27eb1e['as'],'attributes':_0x27eb1e['attributes'],'include':_0x27eb1e['include']?_[_0x62c9('0x1e')](_0x27eb1e['include'],function(_0x492a0f){return{'model':db[_0x492a0f[_0x62c9('0x1f')]],'as':_0x492a0f['as'],'attributes':_0x492a0f[_0x62c9('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x62c9('0x20')](function(_0x19c310){logger[_0x62c9('0xd')]('GetCmHopper',_0x14b6a0);logger[_0x62c9('0x10')](_0x62c9('0x21'),_0x14b6a0,JSON[_0x62c9('0x12')](_0x19c310));_0x4c10b7(_0x19c310);})['catch'](function(_0x1bb75a){logger[_0x62c9('0x13')]('GetCmHopper',_0x1bb75a[_0x62c9('0x15')],_0x14b6a0);_0x241280(_0x198f1b[_0x62c9('0x13')](0x1f4,_0x1bb75a[_0x62c9('0x15')]));});});};exports[_0x62c9('0x22')]=function(_0x34445d){var _0x41b3b2=this;return new Promise(function(_0x563752,_0x520933){return db[_0x62c9('0x23')][_0x62c9('0x24')]({'raw':_0x34445d[_0x62c9('0x18')]?_0x34445d['options'][_0x62c9('0x19')]===undefined?!![]:![]:!![],'where':_0x34445d[_0x62c9('0x18')]?_0x34445d[_0x62c9('0x18')][_0x62c9('0x1a')]||null:null,'attributes':_0x34445d['options']?_0x34445d['options'][_0x62c9('0x1b')]||null:null,'include':_0x34445d['options']?_0x34445d[_0x62c9('0x18')][_0x62c9('0x1d')]?_[_0x62c9('0x1e')](_0x34445d[_0x62c9('0x18')][_0x62c9('0x1d')],function(_0x5e8037){return{'model':db[_0x5e8037[_0x62c9('0x1f')]],'as':_0x5e8037['as'],'attributes':_0x5e8037[_0x62c9('0x1b')],'include':_0x5e8037[_0x62c9('0x1d')]?_[_0x62c9('0x1e')](_0x5e8037[_0x62c9('0x1d')],function(_0x418109){return{'model':db[_0x418109[_0x62c9('0x1f')]],'as':_0x418109['as'],'attributes':_0x418109[_0x62c9('0x1b')],'include':_0x418109[_0x62c9('0x1d')]?_[_0x62c9('0x1e')](_0x418109[_0x62c9('0x1d')],function(_0x2a043b){return{'model':db[_0x2a043b[_0x62c9('0x1f')]],'as':_0x2a043b['as'],'attributes':_0x2a043b[_0x62c9('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x62c9('0x20')](function(_0x27758d){logger[_0x62c9('0xd')](_0x62c9('0x22'),_0x34445d);logger[_0x62c9('0x10')](_0x62c9('0x22'),_0x34445d,JSON['stringify'](_0x27758d));_0x563752(_0x27758d);})[_0x62c9('0x16')](function(_0x26ab7d){logger[_0x62c9('0x13')](_0x62c9('0x22'),_0x26ab7d[_0x62c9('0x15')],_0x34445d);_0x520933(_0x41b3b2[_0x62c9('0x13')](0x1f4,_0x26ab7d['message']));});});};exports[_0x62c9('0x25')]=function(_0x2f8c2){var _0x464d0d=this;return new Promise(function(_0x25597e,_0x80a4db){return db[_0x62c9('0x23')][_0x62c9('0x26')](_0x2f8c2['body'],{'raw':_0x2f8c2[_0x62c9('0x18')]?_0x2f8c2[_0x62c9('0x18')][_0x62c9('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1c33ee){logger[_0x62c9('0xd')]('CreateCmHopper',_0x2f8c2);logger[_0x62c9('0x10')](_0x62c9('0x25'),_0x2f8c2,JSON[_0x62c9('0x12')](_0x1c33ee));_0x25597e(_0x1c33ee);})[_0x62c9('0x16')](function(_0x3028bd){logger['error'](_0x62c9('0x25'),_0x3028bd[_0x62c9('0x15')],_0x2f8c2);_0x80a4db(_0x464d0d[_0x62c9('0x13')](0x1f4,_0x3028bd['message']));});});};exports[_0x62c9('0x27')]=function(_0x4622d9){var _0x275634=this;return new Promise(function(_0x28f88a,_0x17d16e){return db[_0x62c9('0x23')][_0x62c9('0x28')](_0x4622d9[_0x62c9('0x29')],{'raw':_0x4622d9[_0x62c9('0x18')]?_0x4622d9[_0x62c9('0x18')][_0x62c9('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4622d9['options']?_0x4622d9['options'][_0x62c9('0x1a')]||null:null,'attributes':_0x4622d9[_0x62c9('0x18')]?_0x4622d9[_0x62c9('0x18')][_0x62c9('0x1b')]||null:null,'limit':_0x4622d9[_0x62c9('0x18')]?_0x4622d9[_0x62c9('0x18')][_0x62c9('0x1c')]||null:null})[_0x62c9('0x20')](function(_0x4881cb){logger[_0x62c9('0xd')](_0x62c9('0x27'),_0x4622d9);logger[_0x62c9('0x10')]('UpdateCmHopper',_0x4622d9,JSON[_0x62c9('0x12')](_0x4881cb));_0x28f88a(_0x4881cb);})['catch'](function(_0x349ec9){logger[_0x62c9('0x13')](_0x62c9('0x27'),_0x349ec9['message'],_0x4622d9);_0x17d16e(_0x275634['error'](0x1f4,_0x349ec9[_0x62c9('0x15')]));});});};exports['DestroyCmHopper']=function(_0x5ebe5b){var _0x30ecbc=this;return new Promise(function(_0x2ba8f6,_0x5cc1a7){return db[_0x62c9('0x23')][_0x62c9('0x2a')]({'where':_0x5ebe5b[_0x62c9('0x18')]?_0x5ebe5b['options'][_0x62c9('0x1a')]||null:null})[_0x62c9('0x20')](function(_0x16aca1){logger[_0x62c9('0xd')]('DestroyCmHopper',_0x5ebe5b);logger[_0x62c9('0x10')](_0x62c9('0x2b'),_0x5ebe5b,JSON[_0x62c9('0x12')](_0x16aca1));_0x2ba8f6(_0x16aca1);})['catch'](function(_0xe65128){logger['error'](_0x62c9('0x2b'),_0xe65128[_0x62c9('0x15')],_0x5ebe5b);_0x5cc1a7(_0x30ecbc[_0x62c9('0x13')](0x1f4,_0xe65128[_0x62c9('0x15')]));});});};exports[_0x62c9('0x2c')]=function(_0x1c3010){var _0x108fb2=this;return new Promise(function(_0x454d6c,_0x22485a){return db[_0x62c9('0x2d')][_0x62c9('0x2e')]()[_0x62c9('0x20')](function(_0xdc835b){return db['sequelize'][_0x62c9('0x2f')](function(_0x107010){return db['CmHopper'][_0x62c9('0x17')]({'where':_0x1c3010[_0x62c9('0x18')]?_0x1c3010[_0x62c9('0x18')][_0x62c9('0x1a')]||null:null,'attributes':_0x1c3010[_0x62c9('0x18')]?_0x1c3010['options']['attributes']||null:null,'limit':_0x1c3010[_0x62c9('0x18')]?_0x1c3010['options'][_0x62c9('0x1c')]||null:null,'order':_0x1c3010['options']?_0x1c3010[_0x62c9('0x18')]['order']||null:null,'transaction':_0x107010,'lock':_0x107010['LOCK']['UPDATE'],'include':[{'model':db[_0x62c9('0x2d')],'as':_0x62c9('0x30'),'attributes':_[_0x62c9('0x31')](_0xdc835b)},{'model':db[_0x62c9('0x32')],'as':_0x62c9('0x33'),'attributes':['id','name',_0x62c9('0x34')]}]})[_0x62c9('0x20')](function(_0x2ab98b){var _0x5e9231=[];var _0x3fdd4d=[];for(var _0x228672=0x0;_0x228672<_0x2ab98b['length'];_0x228672+=0x1){var _0x4a464f=_0x2ab98b[_0x228672][_0x62c9('0x35')];if(_0x4a464f===null){_0x5e9231[_0x62c9('0x36')](_0x2ab98b[_0x228672][_0x62c9('0x28')](_0x1c3010[_0x62c9('0x29')],{'transaction':_0x107010}));}else if(!_0x3fdd4d[_0x62c9('0x37')](_0x4a464f)){_0x3fdd4d['push'](_0x4a464f);_0x5e9231[_0x62c9('0x36')](_0x2ab98b[_0x228672]['update'](_0x1c3010[_0x62c9('0x29')],{'transaction':_0x107010}));}}return BPromise[_0x62c9('0x38')](_0x5e9231);});})[_0x62c9('0x20')](function(_0x41a345){logger[_0x62c9('0xd')](_0x62c9('0x2c'),_0x1c3010);logger[_0x62c9('0x10')](_0x62c9('0x2c'),_0x1c3010,JSON['stringify'](_0x41a345));_0x454d6c(_0x41a345);})[_0x62c9('0x16')](function(_0xdae9aa){logger[_0x62c9('0x13')](_0x62c9('0x2c'),_0xdae9aa[_0x62c9('0x15')],_0x1c3010);_0x22485a(_0x108fb2[_0x62c9('0x13')](0x1f4,_0xdae9aa[_0x62c9('0x15')]));});});});};exports['MoveContactManagedDialer']=function(_0x27585b){var _0x1a18bb=this;return new Promise(function(_0x178080,_0x10de8b){return db[_0x62c9('0x39')][_0x62c9('0x2f')](function(_0x6aa51){return db[_0x62c9('0x3a')][_0x62c9('0x26')](_0x27585b[_0x62c9('0x29')],{'raw':_0x27585b[_0x62c9('0x18')]?_0x27585b['options'][_0x62c9('0x19')]===undefined?!![]:![]:!![],'transaction':_0x6aa51})['then'](function(){return db['CmHopper'][_0x62c9('0x2a')]({'where':_0x27585b[_0x62c9('0x18')]?_0x27585b['options']['where']||null:null,'transaction':_0x6aa51});});})['then'](function(_0x151722){logger[_0x62c9('0xd')]('MoveContactManagedDialer',_0x27585b);logger[_0x62c9('0x10')]('MoveContactManagedDialer',_0x27585b,JSON[_0x62c9('0x12')](_0x151722));_0x178080(_0x151722);})[_0x62c9('0x16')](function(_0x30ca57){logger[_0x62c9('0x13')]('MoveContactManagedDialer',_0x30ca57[_0x62c9('0x15')],_0x27585b);_0x10de8b(_0x1a18bb['error'](0x1f4,_0x30ca57[_0x62c9('0x15')]));});});};exports[_0x62c9('0x3b')]=function(_0x17d88e){var _0x2524b0=this;return new Promise(function(_0x5cdd0f,_0x551e8b){return db[_0x62c9('0x23')]['findAll']({'raw':_0x17d88e[_0x62c9('0x18')]?_0x17d88e[_0x62c9('0x18')][_0x62c9('0x19')]===undefined?!![]:![]:!![],'where':_0x17d88e[_0x62c9('0x18')]?_0x17d88e['options'][_0x62c9('0x1a')]||null:null,'attributes':[[db[_0x62c9('0x39')]['fn'](_0x62c9('0x3c'),db[_0x62c9('0x39')]['fn']('IF',db[_0x62c9('0x39')][_0x62c9('0x3d')](_0x62c9('0x3e')+util[_0x62c9('0x3f')](_0x62c9('0x40'),moment()[_0x62c9('0x3f')](_0x62c9('0x41')))+_0x62c9('0x42')))),'contactsRescheduled']]})[_0x62c9('0x20')](function(_0x449a0a){logger[_0x62c9('0xd')]('CountReScheduled',_0x17d88e);logger['debug'](_0x62c9('0x3b'),_0x17d88e,JSON[_0x62c9('0x12')](_0x449a0a));_0x5cdd0f(_0x449a0a);})[_0x62c9('0x16')](function(_0x5e545b){logger[_0x62c9('0x13')](_0x62c9('0x3b'),_0x5e545b[_0x62c9('0x15')],_0x17d88e);_0x551e8b(_0x2524b0[_0x62c9('0x13')](0x1f4,_0x5e545b[_0x62c9('0x15')]));});});};exports['GetContactRecallMe']=function(_0x3bff5d){var _0x3d7d6a=this;return new Promise(function(_0x57bd7d,_0x16452b){return db[_0x62c9('0x2d')][_0x62c9('0x2e')]()[_0x62c9('0x20')](function(_0x2712e0){return db[_0x62c9('0x39')][_0x62c9('0x2f')](function(_0x2fa832){return db[_0x62c9('0x23')][_0x62c9('0x17')]({'where':_0x3bff5d[_0x62c9('0x18')]?_0x3bff5d[_0x62c9('0x18')][_0x62c9('0x1a')]||null:null,'attributes':_0x3bff5d[_0x62c9('0x18')]?_0x3bff5d[_0x62c9('0x18')][_0x62c9('0x1b')]||null:null,'limit':0x1,'order':_0x3bff5d[_0x62c9('0x18')]?_0x3bff5d[_0x62c9('0x18')][_0x62c9('0x43')]||null:null,'group':db['CmHopper'][_0x62c9('0x35')],'transaction':_0x2fa832,'lock':_0x2fa832[_0x62c9('0x44')][_0x62c9('0x45')],'include':_0x3bff5d[_0x62c9('0x18')]?_0x3bff5d[_0x62c9('0x18')][_0x62c9('0x1d')]?_[_0x62c9('0x1e')](_0x3bff5d[_0x62c9('0x18')][_0x62c9('0x1d')],function(_0x2a7ca4){return{'model':db[_0x2a7ca4[_0x62c9('0x1f')]],'as':_0x2a7ca4['as'],'attributes':_0x2a7ca4[_0x62c9('0x1b')],'include':_0x2a7ca4[_0x62c9('0x1d')]?_[_0x62c9('0x1e')](_0x2a7ca4[_0x62c9('0x1d')],function(_0x1a7a3e){return{'model':db[_0x1a7a3e[_0x62c9('0x1f')]],'as':_0x1a7a3e['as'],'attributes':_0x1a7a3e['attributes'],'include':_0x1a7a3e['include']?_[_0x62c9('0x1e')](_0x1a7a3e[_0x62c9('0x1d')],function(_0x2b23dc){return{'model':db[_0x2b23dc[_0x62c9('0x1f')]],'as':_0x2b23dc['as'],'attributes':_0x2b23dc[_0x62c9('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x62c9('0x20')](function(_0x34cde6){var _0x56def5=[];for(var _0x40fd70=0x0;_0x40fd70<_0x34cde6[_0x62c9('0x46')];_0x40fd70+=0x1){_0x56def5['push'](_0x34cde6[_0x40fd70]['update'](_0x3bff5d['body'],{'transaction':_0x2fa832}));}return BPromise['all'](_0x56def5);});})[_0x62c9('0x20')](function(_0x248af6){logger[_0x62c9('0xd')](_0x62c9('0x47'),_0x3bff5d);logger[_0x62c9('0x10')](_0x62c9('0x47'),_0x3bff5d,JSON[_0x62c9('0x12')](_0x248af6));_0x57bd7d(_0x248af6);})[_0x62c9('0x16')](function(_0x49fa03){logger[_0x62c9('0x13')](_0x62c9('0x47'),_0x49fa03[_0x62c9('0x15')],_0x3bff5d);_0x16452b(_0x3d7d6a[_0x62c9('0x13')](0x1f4,_0x49fa03['message']));});});});};exports[_0x62c9('0x48')]=function(_0x4f0cf2){var _0xef75d3=this;return new Promise(function(_0x3baed9,_0x39ad63){db['CmContact'][_0x62c9('0x2e')]()['then'](function(_0x29e46e){return db[_0x62c9('0x23')][_0x62c9('0x17')]({'raw':_0x4f0cf2['options']?_0x4f0cf2['options'][_0x62c9('0x19')]===undefined?!![]:![]:!![],'where':_0x4f0cf2[_0x62c9('0x18')]?_0x4f0cf2[_0x62c9('0x18')][_0x62c9('0x1a')]||null:null,'attributes':_0x4f0cf2[_0x62c9('0x18')]?_0x4f0cf2[_0x62c9('0x18')]['attributes']||null:null,'limit':_0x4f0cf2[_0x62c9('0x18')]?_0x4f0cf2[_0x62c9('0x18')][_0x62c9('0x1c')]||null:null,'include':_0x4f0cf2[_0x62c9('0x18')]?_0x4f0cf2['options']['include']?_['map'](_0x4f0cf2[_0x62c9('0x18')][_0x62c9('0x1d')],function(_0x3b3288){return{'model':db[_0x3b3288[_0x62c9('0x1f')]],'as':_0x3b3288['as'],'attributes':_0x3b3288['as']===_0x62c9('0x30')?_[_0x62c9('0x31')](_0x29e46e):_0x3b3288['attributes'],'include':_0x3b3288[_0x62c9('0x1d')]?_[_0x62c9('0x1e')](_0x3b3288[_0x62c9('0x1d')],function(_0x28c0bf){return{'model':db[_0x28c0bf[_0x62c9('0x1f')]],'as':_0x28c0bf['as'],'attributes':_0x28c0bf[_0x62c9('0x1b')],'include':_0x28c0bf['include']?_[_0x62c9('0x1e')](_0x28c0bf[_0x62c9('0x1d')],function(_0x58189){return{'model':db[_0x58189[_0x62c9('0x1f')]],'as':_0x58189['as'],'attributes':_0x58189[_0x62c9('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x62c9('0x20')](function(_0x5121fc){logger['info']('GetCmHopper',_0x4f0cf2);logger[_0x62c9('0x10')](_0x62c9('0x21'),_0x4f0cf2,JSON[_0x62c9('0x12')](_0x5121fc));_0x3baed9(_0x5121fc);})[_0x62c9('0x16')](function(_0x54e7f5){logger['error'](_0x62c9('0x21'),_0x54e7f5[_0x62c9('0x15')],_0x4f0cf2);_0x39ad63(_0xef75d3[_0x62c9('0x13')](0x1f4,_0x54e7f5[_0x62c9('0x15')]));});});});}; \ No newline at end of file +var _0xcae6=['Contact','keys','Agent','name','length','UserId','push','includes','all','MoveContactManagedDialer','create','CountReScheduled','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','GetCmHopperPreview','limit','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','include','map','model','ShowCmHopper','CreateCmHopper','body','UpdateCmHopper','update','destroy','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction','order','LOCK','UPDATE'];(function(_0x5b6ae6,_0x48db30){var _0x22a4ee=function(_0x2125e5){while(--_0x2125e5){_0x5b6ae6['push'](_0x5b6ae6['shift']());}};_0x22a4ee(++_0x48db30);}(_0xcae6,0xdd));var _0x6cae=function(_0x594e11,_0x28f652){_0x594e11=_0x594e11-0x0;var _0x5418ad=_0xcae6[_0x594e11];return _0x5418ad;};'use strict';var _=require(_0x6cae('0x0'));var util=require(_0x6cae('0x1'));var moment=require(_0x6cae('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6cae('0x3'));var db=require(_0x6cae('0x4'))['db'];var utils=require(_0x6cae('0x5'));var logger=require('../../config/logger')(_0x6cae('0x6'));var config=require(_0x6cae('0x7'));var jayson=require(_0x6cae('0x8'));var client=jayson[_0x6cae('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7e9667,_0x221d50,_0x9e9035){return new BPromise(function(_0x2eec6b,_0x24c04d){return client[_0x6cae('0xa')](_0x7e9667,_0x9e9035)[_0x6cae('0xb')](function(_0x345a80){logger[_0x6cae('0xc')](_0x6cae('0xd'),_0x221d50,_0x6cae('0xe'));logger[_0x6cae('0xf')](_0x6cae('0x10'),_0x221d50,'request\x20sent',JSON[_0x6cae('0x11')](_0x345a80));if(_0x345a80['error']){if(_0x345a80[_0x6cae('0x12')]['code']===0x1f4){logger['error'](_0x6cae('0xd'),_0x221d50,_0x345a80[_0x6cae('0x12')]['message']);return _0x24c04d(_0x345a80[_0x6cae('0x12')][_0x6cae('0x13')]);}logger['error'](_0x6cae('0xd'),_0x221d50,_0x345a80[_0x6cae('0x12')]['message']);return _0x2eec6b(_0x345a80[_0x6cae('0x12')][_0x6cae('0x13')]);}else{logger[_0x6cae('0xc')](_0x6cae('0xd'),_0x221d50,_0x6cae('0xe'));_0x2eec6b(_0x345a80[_0x6cae('0x14')][_0x6cae('0x13')]);}})[_0x6cae('0x15')](function(_0x1f546d){logger[_0x6cae('0x12')]('CmHopper,\x20%s,\x20%s',_0x221d50,_0x1f546d);_0x24c04d(_0x1f546d);});});}exports[_0x6cae('0x16')]=function(_0x50fec6){var _0x34499e=this;return new Promise(function(_0x17509d,_0x2d5c83){return db[_0x6cae('0x17')][_0x6cae('0x18')]({'raw':_0x50fec6[_0x6cae('0x19')]?_0x50fec6[_0x6cae('0x19')][_0x6cae('0x1a')]===undefined?!![]:![]:!![],'where':_0x50fec6['options']?_0x50fec6[_0x6cae('0x19')][_0x6cae('0x1b')]||null:null,'attributes':_0x50fec6[_0x6cae('0x19')]?_0x50fec6[_0x6cae('0x19')][_0x6cae('0x1c')]||null:null,'limit':_0x50fec6[_0x6cae('0x19')]?_0x50fec6[_0x6cae('0x19')]['limit']||null:null,'include':_0x50fec6[_0x6cae('0x19')]?_0x50fec6[_0x6cae('0x19')][_0x6cae('0x1d')]?_[_0x6cae('0x1e')](_0x50fec6[_0x6cae('0x19')][_0x6cae('0x1d')],function(_0x1dc53e){return{'model':db[_0x1dc53e[_0x6cae('0x1f')]],'as':_0x1dc53e['as'],'attributes':_0x1dc53e[_0x6cae('0x1c')],'include':_0x1dc53e[_0x6cae('0x1d')]?_[_0x6cae('0x1e')](_0x1dc53e[_0x6cae('0x1d')],function(_0x463fb5){return{'model':db[_0x463fb5[_0x6cae('0x1f')]],'as':_0x463fb5['as'],'attributes':_0x463fb5[_0x6cae('0x1c')],'include':_0x463fb5[_0x6cae('0x1d')]?_['map'](_0x463fb5[_0x6cae('0x1d')],function(_0x153c86){return{'model':db[_0x153c86[_0x6cae('0x1f')]],'as':_0x153c86['as'],'attributes':_0x153c86[_0x6cae('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x40140b){logger[_0x6cae('0xc')]('GetCmHopper',_0x50fec6);logger[_0x6cae('0xf')](_0x6cae('0x16'),_0x50fec6,JSON['stringify'](_0x40140b));_0x17509d(_0x40140b);})[_0x6cae('0x15')](function(_0x4ff62e){logger[_0x6cae('0x12')](_0x6cae('0x16'),_0x4ff62e[_0x6cae('0x13')],_0x50fec6);_0x2d5c83(_0x34499e[_0x6cae('0x12')](0x1f4,_0x4ff62e[_0x6cae('0x13')]));});});};exports[_0x6cae('0x20')]=function(_0x553a58){var _0x18042b=this;return new Promise(function(_0x5184c6,_0xfab427){return db[_0x6cae('0x17')]['find']({'raw':_0x553a58[_0x6cae('0x19')]?_0x553a58['options'][_0x6cae('0x1a')]===undefined?!![]:![]:!![],'where':_0x553a58['options']?_0x553a58[_0x6cae('0x19')][_0x6cae('0x1b')]||null:null,'attributes':_0x553a58[_0x6cae('0x19')]?_0x553a58[_0x6cae('0x19')][_0x6cae('0x1c')]||null:null,'include':_0x553a58[_0x6cae('0x19')]?_0x553a58[_0x6cae('0x19')][_0x6cae('0x1d')]?_[_0x6cae('0x1e')](_0x553a58['options'][_0x6cae('0x1d')],function(_0xac0814){return{'model':db[_0xac0814[_0x6cae('0x1f')]],'as':_0xac0814['as'],'attributes':_0xac0814['attributes'],'include':_0xac0814['include']?_[_0x6cae('0x1e')](_0xac0814[_0x6cae('0x1d')],function(_0x402a18){return{'model':db[_0x402a18[_0x6cae('0x1f')]],'as':_0x402a18['as'],'attributes':_0x402a18[_0x6cae('0x1c')],'include':_0x402a18[_0x6cae('0x1d')]?_['map'](_0x402a18[_0x6cae('0x1d')],function(_0x5c8798){return{'model':db[_0x5c8798[_0x6cae('0x1f')]],'as':_0x5c8798['as'],'attributes':_0x5c8798[_0x6cae('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6cae('0xb')](function(_0x406f73){logger['info'](_0x6cae('0x20'),_0x553a58);logger[_0x6cae('0xf')](_0x6cae('0x20'),_0x553a58,JSON[_0x6cae('0x11')](_0x406f73));_0x5184c6(_0x406f73);})[_0x6cae('0x15')](function(_0x404ef6){logger[_0x6cae('0x12')](_0x6cae('0x20'),_0x404ef6[_0x6cae('0x13')],_0x553a58);_0xfab427(_0x18042b[_0x6cae('0x12')](0x1f4,_0x404ef6[_0x6cae('0x13')]));});});};exports[_0x6cae('0x21')]=function(_0x54d257){var _0x237fa6=this;return new Promise(function(_0x1e206d,_0xaab2a8){return db['CmHopper']['create'](_0x54d257[_0x6cae('0x22')],{'raw':_0x54d257['options']?_0x54d257[_0x6cae('0x19')][_0x6cae('0x1a')]===undefined?!![]:![]:!![]})[_0x6cae('0xb')](function(_0x1212ae){logger[_0x6cae('0xc')](_0x6cae('0x21'),_0x54d257);logger[_0x6cae('0xf')]('CreateCmHopper',_0x54d257,JSON[_0x6cae('0x11')](_0x1212ae));_0x1e206d(_0x1212ae);})[_0x6cae('0x15')](function(_0x502d4e){logger['error'](_0x6cae('0x21'),_0x502d4e['message'],_0x54d257);_0xaab2a8(_0x237fa6[_0x6cae('0x12')](0x1f4,_0x502d4e[_0x6cae('0x13')]));});});};exports[_0x6cae('0x23')]=function(_0x3d9bc8){var _0x4d5e17=this;return new Promise(function(_0x1b6bf4,_0x46713e){return db['CmHopper'][_0x6cae('0x24')](_0x3d9bc8[_0x6cae('0x22')],{'raw':_0x3d9bc8[_0x6cae('0x19')]?_0x3d9bc8[_0x6cae('0x19')][_0x6cae('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d9bc8[_0x6cae('0x19')]?_0x3d9bc8[_0x6cae('0x19')][_0x6cae('0x1b')]||null:null,'attributes':_0x3d9bc8[_0x6cae('0x19')]?_0x3d9bc8['options']['attributes']||null:null,'limit':_0x3d9bc8[_0x6cae('0x19')]?_0x3d9bc8[_0x6cae('0x19')]['limit']||null:null})[_0x6cae('0xb')](function(_0x46c57f){logger[_0x6cae('0xc')](_0x6cae('0x23'),_0x3d9bc8);logger[_0x6cae('0xf')](_0x6cae('0x23'),_0x3d9bc8,JSON[_0x6cae('0x11')](_0x46c57f));_0x1b6bf4(_0x46c57f);})[_0x6cae('0x15')](function(_0x1a2165){logger['error'](_0x6cae('0x23'),_0x1a2165['message'],_0x3d9bc8);_0x46713e(_0x4d5e17['error'](0x1f4,_0x1a2165[_0x6cae('0x13')]));});});};exports['DestroyCmHopper']=function(_0x552ce3){var _0x708523=this;return new Promise(function(_0x289fd3,_0x4b4ead){return db[_0x6cae('0x17')][_0x6cae('0x25')]({'where':_0x552ce3[_0x6cae('0x19')]?_0x552ce3['options'][_0x6cae('0x1b')]||null:null})[_0x6cae('0xb')](function(_0x23bf52){logger[_0x6cae('0xc')]('DestroyCmHopper',_0x552ce3);logger[_0x6cae('0xf')](_0x6cae('0x26'),_0x552ce3,JSON['stringify'](_0x23bf52));_0x289fd3(_0x23bf52);})['catch'](function(_0x44b660){logger[_0x6cae('0x12')](_0x6cae('0x26'),_0x44b660[_0x6cae('0x13')],_0x552ce3);_0x4b4ead(_0x708523[_0x6cae('0x12')](0x1f4,_0x44b660['message']));});});};exports[_0x6cae('0x27')]=function(_0xbba52a){var _0x1c82ae=this;return new Promise(function(_0x142f91,_0x5b07f9){return db[_0x6cae('0x28')][_0x6cae('0x29')]()[_0x6cae('0xb')](function(_0x5d71c2){return db[_0x6cae('0x2a')][_0x6cae('0x2b')](function(_0x4d54a4){return db[_0x6cae('0x17')]['findAll']({'where':_0xbba52a[_0x6cae('0x19')]?_0xbba52a[_0x6cae('0x19')][_0x6cae('0x1b')]||null:null,'attributes':_0xbba52a[_0x6cae('0x19')]?_0xbba52a['options']['attributes']||null:null,'limit':_0xbba52a['options']?_0xbba52a[_0x6cae('0x19')]['limit']||null:null,'order':_0xbba52a[_0x6cae('0x19')]?_0xbba52a[_0x6cae('0x19')][_0x6cae('0x2c')]||null:null,'transaction':_0x4d54a4,'lock':_0x4d54a4[_0x6cae('0x2d')][_0x6cae('0x2e')],'include':[{'model':db[_0x6cae('0x28')],'as':_0x6cae('0x2f'),'attributes':_[_0x6cae('0x30')](_0x5d71c2)},{'model':db['User'],'as':_0x6cae('0x31'),'attributes':['id',_0x6cae('0x32'),'voicePause']}]})[_0x6cae('0xb')](function(_0x5ef3aa){var _0x582489=[];var _0x45e042=[];for(var _0x4a52c6=0x0;_0x4a52c6<_0x5ef3aa[_0x6cae('0x33')];_0x4a52c6+=0x1){var _0x42a266=_0x5ef3aa[_0x4a52c6][_0x6cae('0x34')];if(_0x42a266===null){_0x582489[_0x6cae('0x35')](_0x5ef3aa[_0x4a52c6][_0x6cae('0x24')](_0xbba52a[_0x6cae('0x22')],{'transaction':_0x4d54a4}));}else if(!_0x45e042[_0x6cae('0x36')](_0x42a266)){_0x45e042[_0x6cae('0x35')](_0x42a266);_0x582489[_0x6cae('0x35')](_0x5ef3aa[_0x4a52c6][_0x6cae('0x24')](_0xbba52a['body'],{'transaction':_0x4d54a4}));}}return BPromise[_0x6cae('0x37')](_0x582489);});})['then'](function(_0x3d7dfe){logger['info']('GetContactDialer',_0xbba52a);logger[_0x6cae('0xf')]('GetContactDialer',_0xbba52a,JSON[_0x6cae('0x11')](_0x3d7dfe));_0x142f91(_0x3d7dfe);})['catch'](function(_0x509a06){logger[_0x6cae('0x12')](_0x6cae('0x27'),_0x509a06[_0x6cae('0x13')],_0xbba52a);_0x5b07f9(_0x1c82ae[_0x6cae('0x12')](0x1f4,_0x509a06[_0x6cae('0x13')]));});});});};exports[_0x6cae('0x38')]=function(_0x16f13f){var _0x31d2a2=this;return new Promise(function(_0x9006a4,_0x4dca4e){return db['sequelize']['transaction'](function(_0x447c2e){return db['CmHopperFinal'][_0x6cae('0x39')](_0x16f13f[_0x6cae('0x22')],{'raw':_0x16f13f[_0x6cae('0x19')]?_0x16f13f[_0x6cae('0x19')][_0x6cae('0x1a')]===undefined?!![]:![]:!![],'transaction':_0x447c2e})[_0x6cae('0xb')](function(){return db[_0x6cae('0x17')][_0x6cae('0x25')]({'where':_0x16f13f[_0x6cae('0x19')]?_0x16f13f[_0x6cae('0x19')][_0x6cae('0x1b')]||null:null,'transaction':_0x447c2e});});})[_0x6cae('0xb')](function(_0x44e28a){logger[_0x6cae('0xc')](_0x6cae('0x38'),_0x16f13f);logger[_0x6cae('0xf')](_0x6cae('0x38'),_0x16f13f,JSON['stringify'](_0x44e28a));_0x9006a4(_0x44e28a);})[_0x6cae('0x15')](function(_0x36d3ee){logger[_0x6cae('0x12')](_0x6cae('0x38'),_0x36d3ee[_0x6cae('0x13')],_0x16f13f);_0x4dca4e(_0x31d2a2[_0x6cae('0x12')](0x1f4,_0x36d3ee[_0x6cae('0x13')]));});});};exports[_0x6cae('0x3a')]=function(_0x743127){var _0x25c54b=this;return new Promise(function(_0x545897,_0x536527){return db[_0x6cae('0x17')][_0x6cae('0x18')]({'raw':_0x743127['options']?_0x743127[_0x6cae('0x19')][_0x6cae('0x1a')]===undefined?!![]:![]:!![],'where':_0x743127[_0x6cae('0x19')]?_0x743127[_0x6cae('0x19')][_0x6cae('0x1b')]||null:null,'attributes':[[db[_0x6cae('0x2a')]['fn']('COUNT',db[_0x6cae('0x2a')]['fn']('IF',db[_0x6cae('0x2a')]['literal'](_0x6cae('0x3b')+util[_0x6cae('0x3c')](_0x6cae('0x3d'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'))+_0x6cae('0x3e')))),_0x6cae('0x3f')]]})[_0x6cae('0xb')](function(_0x36b599){logger['info'](_0x6cae('0x3a'),_0x743127);logger[_0x6cae('0xf')]('CountReScheduled',_0x743127,JSON[_0x6cae('0x11')](_0x36b599));_0x545897(_0x36b599);})[_0x6cae('0x15')](function(_0x440dac){logger[_0x6cae('0x12')](_0x6cae('0x3a'),_0x440dac[_0x6cae('0x13')],_0x743127);_0x536527(_0x25c54b[_0x6cae('0x12')](0x1f4,_0x440dac['message']));});});};exports[_0x6cae('0x40')]=function(_0x24ee74){var _0x410aa3=this;return new Promise(function(_0x4a3015,_0x26e3a4){return db[_0x6cae('0x28')][_0x6cae('0x29')]()[_0x6cae('0xb')](function(_0x25054f){return db[_0x6cae('0x2a')][_0x6cae('0x2b')](function(_0x1cd9e3){return db[_0x6cae('0x17')]['findAll']({'where':_0x24ee74[_0x6cae('0x19')]?_0x24ee74[_0x6cae('0x19')]['where']||null:null,'attributes':_0x24ee74[_0x6cae('0x19')]?_0x24ee74[_0x6cae('0x19')][_0x6cae('0x1c')]||null:null,'limit':0x1,'order':_0x24ee74[_0x6cae('0x19')]?_0x24ee74[_0x6cae('0x19')][_0x6cae('0x2c')]||null:null,'group':db[_0x6cae('0x17')]['UserId'],'transaction':_0x1cd9e3,'lock':_0x1cd9e3[_0x6cae('0x2d')][_0x6cae('0x2e')],'include':_0x24ee74[_0x6cae('0x19')]?_0x24ee74[_0x6cae('0x19')][_0x6cae('0x1d')]?_[_0x6cae('0x1e')](_0x24ee74[_0x6cae('0x19')]['include'],function(_0x144924){return{'model':db[_0x144924[_0x6cae('0x1f')]],'as':_0x144924['as'],'attributes':_0x144924['attributes'],'include':_0x144924[_0x6cae('0x1d')]?_[_0x6cae('0x1e')](_0x144924[_0x6cae('0x1d')],function(_0x150a69){return{'model':db[_0x150a69['model']],'as':_0x150a69['as'],'attributes':_0x150a69[_0x6cae('0x1c')],'include':_0x150a69[_0x6cae('0x1d')]?_[_0x6cae('0x1e')](_0x150a69[_0x6cae('0x1d')],function(_0x34c2a9){return{'model':db[_0x34c2a9['model']],'as':_0x34c2a9['as'],'attributes':_0x34c2a9['attributes']};}):[]};}):[]};}):[]:[]})[_0x6cae('0xb')](function(_0x346369){var _0x26796c=[];for(var _0x2edffa=0x0;_0x2edffa<_0x346369[_0x6cae('0x33')];_0x2edffa+=0x1){_0x26796c['push'](_0x346369[_0x2edffa][_0x6cae('0x24')](_0x24ee74[_0x6cae('0x22')],{'transaction':_0x1cd9e3}));}return BPromise[_0x6cae('0x37')](_0x26796c);});})[_0x6cae('0xb')](function(_0x39a6b3){logger[_0x6cae('0xc')]('GetContactRecallMe',_0x24ee74);logger['debug']('GetContactRecallMe',_0x24ee74,JSON[_0x6cae('0x11')](_0x39a6b3));_0x4a3015(_0x39a6b3);})[_0x6cae('0x15')](function(_0x35390c){logger[_0x6cae('0x12')](_0x6cae('0x40'),_0x35390c[_0x6cae('0x13')],_0x24ee74);_0x26e3a4(_0x410aa3[_0x6cae('0x12')](0x1f4,_0x35390c[_0x6cae('0x13')]));});});});};exports[_0x6cae('0x41')]=function(_0x2c6fa0){var _0x2a5354=this;return new Promise(function(_0x4a3c4a,_0x5b759d){db[_0x6cae('0x28')][_0x6cae('0x29')]()['then'](function(_0x85c5c5){return db[_0x6cae('0x17')][_0x6cae('0x18')]({'raw':_0x2c6fa0[_0x6cae('0x19')]?_0x2c6fa0[_0x6cae('0x19')][_0x6cae('0x1a')]===undefined?!![]:![]:!![],'where':_0x2c6fa0[_0x6cae('0x19')]?_0x2c6fa0['options']['where']||null:null,'attributes':_0x2c6fa0[_0x6cae('0x19')]?_0x2c6fa0[_0x6cae('0x19')]['attributes']||null:null,'limit':_0x2c6fa0[_0x6cae('0x19')]?_0x2c6fa0[_0x6cae('0x19')][_0x6cae('0x42')]||null:null,'include':_0x2c6fa0[_0x6cae('0x19')]?_0x2c6fa0[_0x6cae('0x19')][_0x6cae('0x1d')]?_[_0x6cae('0x1e')](_0x2c6fa0[_0x6cae('0x19')][_0x6cae('0x1d')],function(_0x5849ac){return{'model':db[_0x5849ac[_0x6cae('0x1f')]],'as':_0x5849ac['as'],'attributes':_0x5849ac['as']===_0x6cae('0x2f')?_['keys'](_0x85c5c5):_0x5849ac[_0x6cae('0x1c')],'include':_0x5849ac[_0x6cae('0x1d')]?_[_0x6cae('0x1e')](_0x5849ac[_0x6cae('0x1d')],function(_0x3da3c){return{'model':db[_0x3da3c[_0x6cae('0x1f')]],'as':_0x3da3c['as'],'attributes':_0x3da3c[_0x6cae('0x1c')],'include':_0x3da3c[_0x6cae('0x1d')]?_[_0x6cae('0x1e')](_0x3da3c[_0x6cae('0x1d')],function(_0xb71a6a){return{'model':db[_0xb71a6a[_0x6cae('0x1f')]],'as':_0xb71a6a['as'],'attributes':_0xb71a6a[_0x6cae('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6cae('0xb')](function(_0x30fa66){logger['info'](_0x6cae('0x16'),_0x2c6fa0);logger[_0x6cae('0xf')](_0x6cae('0x16'),_0x2c6fa0,JSON[_0x6cae('0x11')](_0x30fa66));_0x4a3c4a(_0x30fa66);})[_0x6cae('0x15')](function(_0x554035){logger[_0x6cae('0x12')]('GetCmHopper',_0x554035[_0x6cae('0x13')],_0x2c6fa0);_0x5b759d(_0x2a5354['error'](0x1f4,_0x554035['message']));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 02f3ced..9e84ede 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 _0x94a6=['getOpenContacts','show','post','getPreview','put','/:id','update','delete','destroy','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','/opencontacts'];(function(_0x1965e5,_0x44689f){var _0x46304a=function(_0x461e72){while(--_0x461e72){_0x1965e5['push'](_0x1965e5['shift']());}};_0x46304a(++_0x44689f);}(_0x94a6,0x1ec));var _0x694a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x94a6[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x694a('0x0'));var util=require(_0x694a('0x1'));var path=require('path');var timeout=require(_0x694a('0x2'));var express=require('express');var router=express[_0x694a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x694a('0x4'));var interaction=require(_0x694a('0x5'));var config=require(_0x694a('0x6'));var controller=require(_0x694a('0x7'));router[_0x694a('0x8')]('/',auth[_0x694a('0x9')](),controller[_0x694a('0xa')]);router[_0x694a('0x8')](_0x694a('0xb'),auth['isAuthenticated'](),controller[_0x694a('0xc')]);router['get'](_0x694a('0xd'),auth[_0x694a('0x9')](),controller[_0x694a('0xe')]);router[_0x694a('0x8')]('/:id',auth[_0x694a('0x9')](),controller[_0x694a('0xf')]);router[_0x694a('0x10')]('/',auth[_0x694a('0x9')](),controller['create']);router[_0x694a('0x10')]('/preview',auth[_0x694a('0x9')](),controller[_0x694a('0x11')]);router[_0x694a('0x12')](_0x694a('0x13'),auth[_0x694a('0x9')](),controller[_0x694a('0x14')]);router[_0x694a('0x15')](_0x694a('0x13'),auth[_0x694a('0x9')](),controller[_0x694a('0x16')]);module['exports']=router; \ No newline at end of file +var _0x7188=['/describe','describe','/opencontacts','getOpenContacts','show','post','create','/preview','getPreview','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','index'];(function(_0xdf05cb,_0x38a188){var _0x1fe6ac=function(_0x34a864){while(--_0x34a864){_0xdf05cb['push'](_0xdf05cb['shift']());}};_0x1fe6ac(++_0x38a188);}(_0x7188,0xb0));var _0x8718=function(_0x2bdeef,_0x21f965){_0x2bdeef=_0x2bdeef-0x0;var _0x59664b=_0x7188[_0x2bdeef];return _0x59664b;};'use strict';var multer=require(_0x8718('0x0'));var util=require(_0x8718('0x1'));var path=require(_0x8718('0x2'));var timeout=require(_0x8718('0x3'));var express=require(_0x8718('0x4'));var router=express[_0x8718('0x5')]();var fs_extra=require(_0x8718('0x6'));var auth=require(_0x8718('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8718('0x8'));var controller=require(_0x8718('0x9'));router[_0x8718('0xa')]('/',auth[_0x8718('0xb')](),controller[_0x8718('0xc')]);router[_0x8718('0xa')](_0x8718('0xd'),auth[_0x8718('0xb')](),controller[_0x8718('0xe')]);router[_0x8718('0xa')](_0x8718('0xf'),auth['isAuthenticated'](),controller[_0x8718('0x10')]);router[_0x8718('0xa')]('/:id',auth[_0x8718('0xb')](),controller[_0x8718('0x11')]);router[_0x8718('0x12')]('/',auth[_0x8718('0xb')](),controller[_0x8718('0x13')]);router['post'](_0x8718('0x14'),auth['isAuthenticated'](),controller[_0x8718('0x15')]);router[_0x8718('0x16')](_0x8718('0x17'),auth[_0x8718('0xb')](),controller[_0x8718('0x18')]);router[_0x8718('0x19')](_0x8718('0x17'),auth[_0x8718('0xb')](),controller[_0x8718('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index f2c93db..2739406 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 _0xc4b3=['contactListQueue','moment','STRING','INTEGER'];(function(_0x5c1cb2,_0x3cd0dc){var _0xaddd55=function(_0x1d5b5d){while(--_0x1d5b5d){_0x5c1cb2['push'](_0x5c1cb2['shift']());}};_0xaddd55(++_0x3cd0dc);}(_0xc4b3,0x179));var _0x3c4b=function(_0x403d30,_0x52f2c1){_0x403d30=_0x403d30-0x0;var _0x5729b6=_0xc4b3[_0x403d30];return _0x5729b6;};'use strict';var moment=require(_0x3c4b('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize[_0x3c4b('0x1')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x3c4b('0x2')],'unique':_0x3c4b('0x3')},'ListId':{'type':Sequelize[_0x3c4b('0x2')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x3c4b('0x2')],'unique':'contactListQueue'}}; \ No newline at end of file +var _0x8cc1=['INTEGER','contactListQueue','sequelize','STRING'];(function(_0x5a5176,_0x2daa82){var _0x506434=function(_0x533236){while(--_0x533236){_0x5a5176['push'](_0x5a5176['shift']());}};_0x506434(++_0x2daa82);}(_0x8cc1,0x14e));var _0x18cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8cc1[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require('moment');var Sequelize=require(_0x18cc('0x0'));module['exports']={'phone':{'type':Sequelize[_0x18cc('0x1')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x18cc('0x2')],'unique':_0x18cc('0x3')},'ListId':{'type':Sequelize[_0x18cc('0x2')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x18cc('0x2')],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 08a1de8..3da1d1a 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 _0xd718=['map','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','CmHopperBlack','includeAll','include','findAll','rows','catch','show','params','find','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','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','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','reject','save','update','then','destroy','error','name','send'];(function(_0x5d1894,_0xee69a7){var _0x152539=function(_0x41368c){while(--_0x41368c){_0x5d1894['push'](_0x5d1894['shift']());}};_0x152539(++_0xee69a7);}(_0xd718,0x1dc));var _0x8d71=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0xd718[_0x4e9d3c];return _0x2d0825;};'use strict';var emlformat=require(_0x8d71('0x0'));var rimraf=require(_0x8d71('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8d71('0x2'));var rp=require(_0x8d71('0x3'));var moment=require(_0x8d71('0x4'));var BPromise=require(_0x8d71('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x8d71('0x6'));var ejs=require(_0x8d71('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8d71('0x8'));var squel=require(_0x8d71('0x9'));var crypto=require(_0x8d71('0xa'));var jsforce=require(_0x8d71('0xb'));var deskjs=require(_0x8d71('0xc'));var toCsv=require('to-csv');var querystring=require(_0x8d71('0xd'));var Papa=require('papaparse');var Redis=require(_0x8d71('0xe'));var authService=require(_0x8d71('0xf'));var qs=require(_0x8d71('0x10'));var as=require(_0x8d71('0x11'));var hardwareService=require(_0x8d71('0x12'));var logger=require(_0x8d71('0x13'))(_0x8d71('0x14'));var utils=require(_0x8d71('0x15'));var config=require(_0x8d71('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8d71('0x17'))['db'];function respondWithStatusCode(_0x3a847b,_0x2ff7f5){_0x2ff7f5=_0x2ff7f5||0xcc;return function(_0x52ecce){if(_0x52ecce){return _0x3a847b[_0x8d71('0x18')](_0x2ff7f5);}return _0x3a847b[_0x8d71('0x19')](_0x2ff7f5)[_0x8d71('0x1a')]();};}function respondWithResult(_0x7c1324,_0x564c07){_0x564c07=_0x564c07||0xc8;return function(_0xe5a9e2){if(_0xe5a9e2){return _0x7c1324[_0x8d71('0x19')](_0x564c07)['json'](_0xe5a9e2);}};}function respondWithFilteredResult(_0x2bfdb9,_0x57485d){return function(_0x5397fe){if(_0x5397fe){var _0x414d2f=typeof _0x57485d[_0x8d71('0x1b')]==='undefined'&&typeof _0x57485d[_0x8d71('0x1c')]===_0x8d71('0x1d');var _0x5e0bd8=_0x5397fe[_0x8d71('0x1e')];var _0x52e675=_0x414d2f?0x0:_0x57485d[_0x8d71('0x1b')];var _0x32d155=_0x414d2f?_0x5397fe[_0x8d71('0x1e')]:_0x57485d['offset']+_0x57485d['limit'];var _0x2e322a;if(_0x32d155>=_0x5e0bd8){_0x32d155=_0x5e0bd8;_0x2e322a=0xc8;}else{_0x2e322a=0xce;}_0x2bfdb9[_0x8d71('0x19')](_0x2e322a);return _0x2bfdb9[_0x8d71('0x1f')](_0x8d71('0x20'),_0x52e675+'-'+_0x32d155+'/'+_0x5e0bd8)[_0x8d71('0x21')](_0x5397fe);}return null;};}function patchUpdates(_0x574d07){return function(_0x3390fe){try{jsonpatch['apply'](_0x3390fe,_0x574d07,!![]);}catch(_0x108d34){return BPromise[_0x8d71('0x22')](_0x108d34);}return _0x3390fe[_0x8d71('0x23')]();};}function saveUpdates(_0xe40219,_0x19dae7){return function(_0x4ecab1){if(_0x4ecab1){return _0x4ecab1[_0x8d71('0x24')](_0xe40219)[_0x8d71('0x25')](function(_0x2eafa0){return _0x2eafa0;});}return null;};}function removeEntity(_0x31b483,_0x1da8f8){return function(_0xa573d0){if(_0xa573d0){return _0xa573d0[_0x8d71('0x26')]()['then'](function(){_0x31b483[_0x8d71('0x19')](0xcc)[_0x8d71('0x1a')]();});}};}function handleEntityNotFound(_0x14e597,_0x15bb19){return function(_0x26a9b6){if(!_0x26a9b6){_0x14e597['sendStatus'](0x194);}return _0x26a9b6;};}function handleError(_0x5ce3b9,_0x335515){_0x335515=_0x335515||0x1f4;return function(_0x328e60){logger[_0x8d71('0x27')](_0x328e60['stack']);if(_0x328e60['name']){delete _0x328e60[_0x8d71('0x28')];}_0x5ce3b9['status'](_0x335515)[_0x8d71('0x29')](_0x328e60);};}exports['index']=function(_0x3d6477,_0x3a62f7){var _0x1cb634={},_0x4fb157={},_0x38d0f4={'count':0x0,'rows':[]};var _0x3b2023=_[_0x8d71('0x2a')](db['CmHopperBlack'][_0x8d71('0x2b')],function(_0x22b119){return{'name':_0x22b119[_0x8d71('0x2c')],'type':_0x22b119['type']['key']};});_0x4fb157[_0x8d71('0x2d')]=_[_0x8d71('0x2a')](_0x3b2023,_0x8d71('0x28'));_0x4fb157[_0x8d71('0x2e')]=_[_0x8d71('0x2f')](_0x3d6477[_0x8d71('0x2e')]);_0x4fb157[_0x8d71('0x30')]=_['intersection'](_0x4fb157[_0x8d71('0x2d')],_0x4fb157[_0x8d71('0x2e')]);_0x1cb634['attributes']=_[_0x8d71('0x31')](_0x4fb157[_0x8d71('0x2d')],qs[_0x8d71('0x32')](_0x3d6477[_0x8d71('0x2e')][_0x8d71('0x32')]));_0x1cb634['attributes']=_0x1cb634[_0x8d71('0x33')][_0x8d71('0x34')]?_0x1cb634[_0x8d71('0x33')]:_0x4fb157[_0x8d71('0x2d')];if(!_0x3d6477[_0x8d71('0x2e')][_0x8d71('0x35')]('nolimit')){_0x1cb634[_0x8d71('0x1c')]=qs[_0x8d71('0x1c')](_0x3d6477[_0x8d71('0x2e')][_0x8d71('0x1c')]);_0x1cb634[_0x8d71('0x1b')]=qs['offset'](_0x3d6477[_0x8d71('0x2e')]['offset']);}_0x1cb634[_0x8d71('0x36')]=qs[_0x8d71('0x37')](_0x3d6477[_0x8d71('0x2e')][_0x8d71('0x37')]);_0x1cb634[_0x8d71('0x38')]=qs[_0x8d71('0x30')](_[_0x8d71('0x39')](_0x3d6477[_0x8d71('0x2e')],_0x4fb157['filters']),_0x3b2023);if(_0x3d6477['query'][_0x8d71('0x3a')]){_0x1cb634[_0x8d71('0x38')]=_[_0x8d71('0x3b')](_0x1cb634[_0x8d71('0x38')],{'$or':_[_0x8d71('0x2a')](_0x3b2023,function(_0x21a27d){if(_0x21a27d[_0x8d71('0x3c')]!==_0x8d71('0x3d')){var _0x2fda4c={};_0x2fda4c[_0x21a27d[_0x8d71('0x28')]]={'$like':'%'+_0x3d6477['query'][_0x8d71('0x3a')]+'%'};return _0x2fda4c;}})});}_0x1cb634=_[_0x8d71('0x3b')]({},_0x1cb634,_0x3d6477[_0x8d71('0x3e')]);var _0x3a821c={'where':_0x1cb634[_0x8d71('0x38')]};return db[_0x8d71('0x3f')][_0x8d71('0x1e')](_0x3a821c)[_0x8d71('0x25')](function(_0x2d5f0e){_0x38d0f4[_0x8d71('0x1e')]=_0x2d5f0e;if(_0x3d6477['query'][_0x8d71('0x40')]){_0x1cb634[_0x8d71('0x41')]=[{'all':!![]}];}return db[_0x8d71('0x3f')][_0x8d71('0x42')](_0x1cb634);})[_0x8d71('0x25')](function(_0xe6243b){_0x38d0f4[_0x8d71('0x43')]=_0xe6243b;return _0x38d0f4;})['then'](respondWithFilteredResult(_0x3a62f7,_0x1cb634))[_0x8d71('0x44')](handleError(_0x3a62f7,null));};exports[_0x8d71('0x45')]=function(_0x322ce4,_0x438302){var _0x6da952={'raw':!![],'where':{'id':_0x322ce4[_0x8d71('0x46')]['id']}},_0x2ebce2={};_0x2ebce2[_0x8d71('0x2d')]=_[_0x8d71('0x2f')](db[_0x8d71('0x3f')][_0x8d71('0x2b')]);_0x2ebce2[_0x8d71('0x2e')]=_['keys'](_0x322ce4[_0x8d71('0x2e')]);_0x2ebce2['filters']=_[_0x8d71('0x31')](_0x2ebce2[_0x8d71('0x2d')],_0x2ebce2[_0x8d71('0x2e')]);_0x6da952[_0x8d71('0x33')]=_[_0x8d71('0x31')](_0x2ebce2[_0x8d71('0x2d')],qs[_0x8d71('0x32')](_0x322ce4['query'][_0x8d71('0x32')]));_0x6da952[_0x8d71('0x33')]=_0x6da952[_0x8d71('0x33')][_0x8d71('0x34')]?_0x6da952[_0x8d71('0x33')]:_0x2ebce2['model'];if(_0x322ce4[_0x8d71('0x2e')]['includeAll']){_0x6da952[_0x8d71('0x41')]=[{'all':!![]}];}_0x6da952=_['merge']({},_0x6da952,_0x322ce4['options']);return db[_0x8d71('0x3f')][_0x8d71('0x47')](_0x6da952)[_0x8d71('0x25')](handleEntityNotFound(_0x438302,null))[_0x8d71('0x25')](respondWithResult(_0x438302,null))[_0x8d71('0x44')](handleError(_0x438302,null));};exports[_0x8d71('0x24')]=function(_0x52c363,_0x4b9b73){if(_0x52c363[_0x8d71('0x48')]['id']){delete _0x52c363[_0x8d71('0x48')]['id'];}return db[_0x8d71('0x3f')][_0x8d71('0x47')]({'where':{'id':_0x52c363[_0x8d71('0x46')]['id']}})[_0x8d71('0x25')](handleEntityNotFound(_0x4b9b73,null))[_0x8d71('0x25')](saveUpdates(_0x52c363['body'],null))[_0x8d71('0x25')](respondWithResult(_0x4b9b73,null))[_0x8d71('0x44')](handleError(_0x4b9b73,null));};exports[_0x8d71('0x26')]=function(_0x32a0ee,_0x5465fd){return db[_0x8d71('0x3f')][_0x8d71('0x47')]({'where':{'id':_0x32a0ee['params']['id']}})['then'](handleEntityNotFound(_0x5465fd,null))[_0x8d71('0x25')](removeEntity(_0x5465fd,null))[_0x8d71('0x44')](handleError(_0x5465fd,null));};exports[_0x8d71('0x49')]=function(_0xd2d289,_0x230c78){return db[_0x8d71('0x3f')]['describe']()[_0x8d71('0x25')](respondWithResult(_0x230c78,null))['catch'](handleError(_0x230c78,null));}; \ No newline at end of file +var _0x2558=['moment','bluebird','mustache','util','path','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','status','error','name','index','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','options','CmHopperBlack','includeAll','findAll','catch','include','find','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x2558,0x1a0));var _0x8255=function(_0xe0e895,_0xf51c5c){_0xe0e895=_0xe0e895-0x0;var _0x222093=_0x2558[_0xe0e895];return _0x222093;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8255('0x0'));var zipdir=require(_0x8255('0x1'));var jsonpatch=require(_0x8255('0x2'));var rp=require(_0x8255('0x3'));var moment=require(_0x8255('0x4'));var BPromise=require(_0x8255('0x5'));var Mustache=require(_0x8255('0x6'));var util=require(_0x8255('0x7'));var path=require(_0x8255('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8255('0x9'));var _=require('lodash');var squel=require(_0x8255('0xa'));var crypto=require(_0x8255('0xb'));var jsforce=require(_0x8255('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8255('0xd'));var Papa=require('papaparse');var Redis=require(_0x8255('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8255('0xf'));var hardwareService=require(_0x8255('0x10'));var logger=require(_0x8255('0x11'))(_0x8255('0x12'));var utils=require(_0x8255('0x13'));var config=require(_0x8255('0x14'));var licenseUtil=require(_0x8255('0x15'));var db=require(_0x8255('0x16'))['db'];function respondWithStatusCode(_0x300bf9,_0x4407b6){_0x4407b6=_0x4407b6||0xcc;return function(_0x461a12){if(_0x461a12){return _0x300bf9[_0x8255('0x17')](_0x4407b6);}return _0x300bf9['status'](_0x4407b6)[_0x8255('0x18')]();};}function respondWithResult(_0x3a3ad1,_0x193576){_0x193576=_0x193576||0xc8;return function(_0x10b119){if(_0x10b119){return _0x3a3ad1['status'](_0x193576)[_0x8255('0x19')](_0x10b119);}};}function respondWithFilteredResult(_0x4d7d6c,_0x4848da){return function(_0x556475){if(_0x556475){var _0x223b45=typeof _0x4848da[_0x8255('0x1a')]===_0x8255('0x1b')&&typeof _0x4848da[_0x8255('0x1c')]===_0x8255('0x1b');var _0x26fce7=_0x556475[_0x8255('0x1d')];var _0xed4430=_0x223b45?0x0:_0x4848da[_0x8255('0x1a')];var _0x28f1f6=_0x223b45?_0x556475[_0x8255('0x1d')]:_0x4848da[_0x8255('0x1a')]+_0x4848da[_0x8255('0x1c')];var _0x43fbcc;if(_0x28f1f6>=_0x26fce7){_0x28f1f6=_0x26fce7;_0x43fbcc=0xc8;}else{_0x43fbcc=0xce;}_0x4d7d6c['status'](_0x43fbcc);return _0x4d7d6c[_0x8255('0x1e')](_0x8255('0x1f'),_0xed4430+'-'+_0x28f1f6+'/'+_0x26fce7)[_0x8255('0x19')](_0x556475);}return null;};}function patchUpdates(_0x1ea262){return function(_0x26499f){try{jsonpatch[_0x8255('0x20')](_0x26499f,_0x1ea262,!![]);}catch(_0x166dcf){return BPromise[_0x8255('0x21')](_0x166dcf);}return _0x26499f['save']();};}function saveUpdates(_0x41c807,_0x565fe8){return function(_0x4b0c61){if(_0x4b0c61){return _0x4b0c61[_0x8255('0x22')](_0x41c807)[_0x8255('0x23')](function(_0x2e5359){return _0x2e5359;});}return null;};}function removeEntity(_0x24afa0,_0x2bdf3f){return function(_0x1883ef){if(_0x1883ef){return _0x1883ef[_0x8255('0x24')]()[_0x8255('0x23')](function(){_0x24afa0[_0x8255('0x25')](0xcc)[_0x8255('0x18')]();});}};}function handleEntityNotFound(_0x41143a,_0x16c679){return function(_0x5ee87f){if(!_0x5ee87f){_0x41143a['sendStatus'](0x194);}return _0x5ee87f;};}function handleError(_0x1edf31,_0x4c18d5){_0x4c18d5=_0x4c18d5||0x1f4;return function(_0x15a6e4){logger[_0x8255('0x26')](_0x15a6e4['stack']);if(_0x15a6e4[_0x8255('0x27')]){delete _0x15a6e4[_0x8255('0x27')];}_0x1edf31[_0x8255('0x25')](_0x4c18d5)['send'](_0x15a6e4);};}exports[_0x8255('0x28')]=function(_0x300e94,_0x1ce26c){var _0x458157={},_0x768098={},_0x1f4d51={'count':0x0,'rows':[]};var _0x5aecde=_['map'](db['CmHopperBlack'][_0x8255('0x29')],function(_0x210161){return{'name':_0x210161[_0x8255('0x2a')],'type':_0x210161[_0x8255('0x2b')][_0x8255('0x2c')]};});_0x768098[_0x8255('0x2d')]=_[_0x8255('0x2e')](_0x5aecde,_0x8255('0x27'));_0x768098['query']=_[_0x8255('0x2f')](_0x300e94[_0x8255('0x30')]);_0x768098[_0x8255('0x31')]=_[_0x8255('0x32')](_0x768098[_0x8255('0x2d')],_0x768098[_0x8255('0x30')]);_0x458157[_0x8255('0x33')]=_['intersection'](_0x768098[_0x8255('0x2d')],qs[_0x8255('0x34')](_0x300e94[_0x8255('0x30')][_0x8255('0x34')]));_0x458157['attributes']=_0x458157[_0x8255('0x33')][_0x8255('0x35')]?_0x458157['attributes']:_0x768098[_0x8255('0x2d')];if(!_0x300e94[_0x8255('0x30')][_0x8255('0x36')](_0x8255('0x37'))){_0x458157[_0x8255('0x1c')]=qs['limit'](_0x300e94[_0x8255('0x30')][_0x8255('0x1c')]);_0x458157[_0x8255('0x1a')]=qs[_0x8255('0x1a')](_0x300e94[_0x8255('0x30')][_0x8255('0x1a')]);}_0x458157[_0x8255('0x38')]=qs[_0x8255('0x39')](_0x300e94[_0x8255('0x30')][_0x8255('0x39')]);_0x458157[_0x8255('0x3a')]=qs[_0x8255('0x31')](_['pick'](_0x300e94[_0x8255('0x30')],_0x768098[_0x8255('0x31')]),_0x5aecde);if(_0x300e94[_0x8255('0x30')]['filter']){_0x458157[_0x8255('0x3a')]=_[_0x8255('0x3b')](_0x458157[_0x8255('0x3a')],{'$or':_['map'](_0x5aecde,function(_0x57468c){if(_0x57468c[_0x8255('0x2b')]!=='VIRTUAL'){var _0xb5e643={};_0xb5e643[_0x57468c['name']]={'$like':'%'+_0x300e94[_0x8255('0x30')]['filter']+'%'};return _0xb5e643;}})});}_0x458157=_[_0x8255('0x3b')]({},_0x458157,_0x300e94[_0x8255('0x3c')]);var _0x4e674a={'where':_0x458157[_0x8255('0x3a')]};return db[_0x8255('0x3d')][_0x8255('0x1d')](_0x4e674a)['then'](function(_0x2e0171){_0x1f4d51[_0x8255('0x1d')]=_0x2e0171;if(_0x300e94[_0x8255('0x30')][_0x8255('0x3e')]){_0x458157['include']=[{'all':!![]}];}return db[_0x8255('0x3d')][_0x8255('0x3f')](_0x458157);})['then'](function(_0x523eaf){_0x1f4d51['rows']=_0x523eaf;return _0x1f4d51;})['then'](respondWithFilteredResult(_0x1ce26c,_0x458157))[_0x8255('0x40')](handleError(_0x1ce26c,null));};exports['show']=function(_0x106d82,_0x98b650){var _0x4dd774={'raw':!![],'where':{'id':_0x106d82['params']['id']}},_0x2a21f8={};_0x2a21f8[_0x8255('0x2d')]=_[_0x8255('0x2f')](db[_0x8255('0x3d')][_0x8255('0x29')]);_0x2a21f8['query']=_['keys'](_0x106d82[_0x8255('0x30')]);_0x2a21f8[_0x8255('0x31')]=_[_0x8255('0x32')](_0x2a21f8[_0x8255('0x2d')],_0x2a21f8['query']);_0x4dd774[_0x8255('0x33')]=_[_0x8255('0x32')](_0x2a21f8[_0x8255('0x2d')],qs[_0x8255('0x34')](_0x106d82['query'][_0x8255('0x34')]));_0x4dd774[_0x8255('0x33')]=_0x4dd774[_0x8255('0x33')][_0x8255('0x35')]?_0x4dd774[_0x8255('0x33')]:_0x2a21f8[_0x8255('0x2d')];if(_0x106d82[_0x8255('0x30')][_0x8255('0x3e')]){_0x4dd774[_0x8255('0x41')]=[{'all':!![]}];}_0x4dd774=_[_0x8255('0x3b')]({},_0x4dd774,_0x106d82[_0x8255('0x3c')]);return db['CmHopperBlack'][_0x8255('0x42')](_0x4dd774)[_0x8255('0x23')](handleEntityNotFound(_0x98b650,null))[_0x8255('0x23')](respondWithResult(_0x98b650,null))[_0x8255('0x40')](handleError(_0x98b650,null));};exports[_0x8255('0x22')]=function(_0x5519c6,_0x2d3c38){if(_0x5519c6['body']['id']){delete _0x5519c6[_0x8255('0x43')]['id'];}return db['CmHopperBlack'][_0x8255('0x42')]({'where':{'id':_0x5519c6['params']['id']}})[_0x8255('0x23')](handleEntityNotFound(_0x2d3c38,null))['then'](saveUpdates(_0x5519c6[_0x8255('0x43')],null))[_0x8255('0x23')](respondWithResult(_0x2d3c38,null))[_0x8255('0x40')](handleError(_0x2d3c38,null));};exports[_0x8255('0x24')]=function(_0x25869f,_0x57d1b1){return db['CmHopperBlack'][_0x8255('0x42')]({'where':{'id':_0x25869f[_0x8255('0x44')]['id']}})[_0x8255('0x23')](handleEntityNotFound(_0x57d1b1,null))[_0x8255('0x23')](removeEntity(_0x57d1b1,null))[_0x8255('0x40')](handleError(_0x57d1b1,null));};exports['describe']=function(_0x5cc942,_0x155706){return db['CmHopperBlack'][_0x8255('0x45')]()[_0x8255('0x23')](respondWithResult(_0x155706,null))['catch'](handleError(_0x155706,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 1cd80ff..76e6cb1 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 _0x2c6a=['cm_hopper_black','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack'];(function(_0x3e0699,_0x2dc6c6){var _0x284abf=function(_0x35807e){while(--_0x35807e){_0x3e0699['push'](_0x3e0699['shift']());}};_0x284abf(++_0x2dc6c6);}(_0x2c6a,0x11e));var _0xa2c6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c6a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa2c6('0x0'));var util=require(_0xa2c6('0x1'));var logger=require(_0xa2c6('0x2'))(_0xa2c6('0x3'));var moment=require(_0xa2c6('0x4'));var BPromise=require(_0xa2c6('0x5'));var rp=require(_0xa2c6('0x6'));var fs=require('fs');var path=require(_0xa2c6('0x7'));var rimraf=require(_0xa2c6('0x8'));var config=require(_0xa2c6('0x9'));var attributes=require(_0xa2c6('0xa'));module[_0xa2c6('0xb')]=function(_0x2a044c,_0x4d1018){return _0x2a044c[_0xa2c6('0xc')](_0xa2c6('0xd'),attributes,{'tableName':_0xa2c6('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7ad3=['../../config/logger','api','moment','bluebird','path','./cmHopperBlack.attributes','CmHopperBlack','cm_hopper_black','lodash'];(function(_0x56922c,_0x347c88){var _0xf896d7=function(_0x214e47){while(--_0x214e47){_0x56922c['push'](_0x56922c['shift']());}};_0xf896d7(++_0x347c88);}(_0x7ad3,0x15e));var _0x37ad=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x7ad3[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require(_0x37ad('0x0'));var util=require('util');var logger=require(_0x37ad('0x1'))(_0x37ad('0x2'));var moment=require(_0x37ad('0x3'));var BPromise=require(_0x37ad('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x37ad('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x37ad('0x6'));module['exports']=function(_0xce2266,_0x332e71){return _0xce2266['define'](_0x37ad('0x7'),attributes,{'tableName':_0x37ad('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 00b9855..3e8800d 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 _0x53c2=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','request','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','message','info','GetCmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','model','catch','UpdateCmHopperBlack','CmHopperBlack','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring'];(function(_0x48f550,_0x4e1685){var _0x5308b5=function(_0x265a3a){while(--_0x265a3a){_0x48f550['push'](_0x48f550['shift']());}};_0x5308b5(++_0x4e1685);}(_0x53c2,0x1d7));var _0x253c=function(_0x497792,_0x430e8c){_0x497792=_0x497792-0x0;var _0xcf3be9=_0x53c2[_0x497792];return _0xcf3be9;};'use strict';var _=require(_0x253c('0x0'));var util=require(_0x253c('0x1'));var moment=require(_0x253c('0x2'));var BPromise=require(_0x253c('0x3'));var rs=require(_0x253c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x253c('0x5'))['db'];var utils=require(_0x253c('0x6'));var logger=require(_0x253c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x253c('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4656f0,_0x464ffe,_0x7de0c7){return new BPromise(function(_0x23f76f,_0x5a513b){return client[_0x253c('0x9')](_0x4656f0,_0x7de0c7)[_0x253c('0xa')](function(_0x352a44){logger['info'](_0x253c('0xb'),_0x464ffe,_0x253c('0xc'));logger[_0x253c('0xd')](_0x253c('0xe'),_0x464ffe,'request\x20sent',JSON[_0x253c('0xf')](_0x352a44));if(_0x352a44['error']){if(_0x352a44[_0x253c('0x10')]['code']===0x1f4){logger[_0x253c('0x10')](_0x253c('0xb'),_0x464ffe,_0x352a44[_0x253c('0x10')][_0x253c('0x11')]);return _0x5a513b(_0x352a44[_0x253c('0x10')][_0x253c('0x11')]);}logger[_0x253c('0x10')](_0x253c('0xb'),_0x464ffe,_0x352a44[_0x253c('0x10')][_0x253c('0x11')]);return _0x23f76f(_0x352a44[_0x253c('0x10')][_0x253c('0x11')]);}else{logger[_0x253c('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x464ffe,_0x253c('0xc'));_0x23f76f(_0x352a44['result'][_0x253c('0x11')]);}})['catch'](function(_0xaeb654){logger[_0x253c('0x10')](_0x253c('0xb'),_0x464ffe,_0xaeb654);_0x5a513b(_0xaeb654);});});}exports[_0x253c('0x13')]=function(_0x590ba7){var _0x5b0119=this;return new Promise(function(_0x36f86b,_0x1ac0e8){return db['CmHopperBlack'][_0x253c('0x14')]({'raw':_0x590ba7[_0x253c('0x15')]?_0x590ba7['options'][_0x253c('0x16')]===undefined?!![]:![]:!![],'where':_0x590ba7[_0x253c('0x15')]?_0x590ba7['options'][_0x253c('0x17')]||null:null,'attributes':_0x590ba7[_0x253c('0x15')]?_0x590ba7['options'][_0x253c('0x18')]||null:null,'limit':_0x590ba7[_0x253c('0x15')]?_0x590ba7[_0x253c('0x15')][_0x253c('0x19')]||null:null,'include':_0x590ba7[_0x253c('0x15')]?_0x590ba7[_0x253c('0x15')][_0x253c('0x1a')]?_['map'](_0x590ba7['options'][_0x253c('0x1a')],function(_0x4b2383){return{'model':db[_0x4b2383['model']],'as':_0x4b2383['as'],'attributes':_0x4b2383['attributes'],'include':_0x4b2383[_0x253c('0x1a')]?_[_0x253c('0x1b')](_0x4b2383[_0x253c('0x1a')],function(_0x59a509){return{'model':db[_0x59a509[_0x253c('0x1c')]],'as':_0x59a509['as'],'attributes':_0x59a509['attributes'],'include':_0x59a509['include']?_[_0x253c('0x1b')](_0x59a509[_0x253c('0x1a')],function(_0x35881b){return{'model':db[_0x35881b[_0x253c('0x1c')]],'as':_0x35881b['as'],'attributes':_0x35881b[_0x253c('0x18')]};}):[]};}):[]};}):[]:[]})[_0x253c('0xa')](function(_0x3f61fc){logger['info'](_0x253c('0x13'),_0x590ba7);logger['debug'](_0x253c('0x13'),_0x590ba7,JSON['stringify'](_0x3f61fc));_0x36f86b(_0x3f61fc);})[_0x253c('0x1d')](function(_0x218e29){logger[_0x253c('0x10')](_0x253c('0x13'),_0x218e29[_0x253c('0x11')],_0x590ba7);_0x1ac0e8(_0x5b0119['error'](0x1f4,_0x218e29[_0x253c('0x11')]));});});};exports[_0x253c('0x1e')]=function(_0x41c957){var _0x3a9bc8=this;return new Promise(function(_0x17e8ce,_0x52101b){return db[_0x253c('0x1f')]['update'](_0x41c957['body'],{'raw':_0x41c957[_0x253c('0x15')]?_0x41c957[_0x253c('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41c957['options']?_0x41c957['options'][_0x253c('0x17')]||null:null,'attributes':_0x41c957[_0x253c('0x15')]?_0x41c957[_0x253c('0x15')][_0x253c('0x18')]||null:null,'limit':_0x41c957['options']?_0x41c957[_0x253c('0x15')]['limit']||null:null})[_0x253c('0xa')](function(_0xb761c0){logger[_0x253c('0x12')](_0x253c('0x1e'),_0x41c957);logger[_0x253c('0xd')](_0x253c('0x1e'),_0x41c957,JSON[_0x253c('0xf')](_0xb761c0));_0x17e8ce(_0xb761c0);})[_0x253c('0x1d')](function(_0x4affab){logger[_0x253c('0x10')](_0x253c('0x1e'),_0x4affab[_0x253c('0x11')],_0x41c957);_0x52101b(_0x3a9bc8[_0x253c('0x10')](0x1f4,_0x4affab['message']));});});};exports[_0x253c('0x20')]=function(_0x484c43){var _0x4668aa=this;return new Promise(function(_0x1e5f07,_0x3c79b4){return db[_0x253c('0x1f')][_0x253c('0x21')]({'where':_0x484c43[_0x253c('0x15')]?_0x484c43[_0x253c('0x15')]['where']||null:null})[_0x253c('0xa')](function(_0x252cb0){logger[_0x253c('0x12')](_0x253c('0x20'),_0x484c43);logger[_0x253c('0xd')]('DestroyCmHopperBlack',_0x484c43,JSON[_0x253c('0xf')](_0x252cb0));_0x1e5f07(_0x252cb0);})[_0x253c('0x1d')](function(_0x5e3d32){logger[_0x253c('0x10')](_0x253c('0x20'),_0x5e3d32['message'],_0x484c43);_0x3c79b4(_0x4668aa[_0x253c('0x10')](0x1f4,_0x5e3d32[_0x253c('0x11')]));});});}; \ No newline at end of file +var _0xaa3a=['http','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','CmHopperBlack','findAll','options','where','attributes','include','map','model','GetCmHopperBlack','debug','UpdateCmHopperBlack','update','body','raw','stringify','DestroyCmHopperBlack','destroy','lodash','util','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x263e17,_0x244755){var _0x3c1b7f=function(_0xcab000){while(--_0xcab000){_0x263e17['push'](_0x263e17['shift']());}};_0x3c1b7f(++_0x244755);}(_0xaa3a,0x13b));var _0xaaa3=function(_0x2644f8,_0x40977c){_0x2644f8=_0x2644f8-0x0;var _0x233fea=_0xaa3a[_0x2644f8];return _0x233fea;};'use strict';var _=require(_0xaaa3('0x0'));var util=require(_0xaaa3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xaaa3('0x2'));var fs=require('fs');var Redis=require(_0xaaa3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xaaa3('0x4'));var logger=require('../../config/logger')(_0xaaa3('0x5'));var config=require(_0xaaa3('0x6'));var jayson=require(_0xaaa3('0x7'));var client=jayson[_0xaaa3('0x8')][_0xaaa3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x313216,_0x456a8a,_0x27b7ed){return new BPromise(function(_0x103bd8,_0x4eb7c4){return client['request'](_0x313216,_0x27b7ed)[_0xaaa3('0xa')](function(_0x384d5b){logger['info'](_0xaaa3('0xb'),_0x456a8a,_0xaaa3('0xc'));logger['debug'](_0xaaa3('0xd'),_0x456a8a,'request\x20sent',JSON['stringify'](_0x384d5b));if(_0x384d5b[_0xaaa3('0xe')]){if(_0x384d5b['error']['code']===0x1f4){logger['error'](_0xaaa3('0xb'),_0x456a8a,_0x384d5b[_0xaaa3('0xe')][_0xaaa3('0xf')]);return _0x4eb7c4(_0x384d5b['error'][_0xaaa3('0xf')]);}logger[_0xaaa3('0xe')](_0xaaa3('0xb'),_0x456a8a,_0x384d5b['error']['message']);return _0x103bd8(_0x384d5b['error'][_0xaaa3('0xf')]);}else{logger[_0xaaa3('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x456a8a,_0xaaa3('0xc'));_0x103bd8(_0x384d5b[_0xaaa3('0x11')][_0xaaa3('0xf')]);}})[_0xaaa3('0x12')](function(_0x4ba7ed){logger[_0xaaa3('0xe')](_0xaaa3('0xb'),_0x456a8a,_0x4ba7ed);_0x4eb7c4(_0x4ba7ed);});});}exports['GetCmHopperBlack']=function(_0x2d5341){var _0x4f5ae1=this;return new Promise(function(_0x2b4766,_0x1f27ed){return db[_0xaaa3('0x13')][_0xaaa3('0x14')]({'raw':_0x2d5341[_0xaaa3('0x15')]?_0x2d5341[_0xaaa3('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x2d5341['options']?_0x2d5341['options'][_0xaaa3('0x16')]||null:null,'attributes':_0x2d5341[_0xaaa3('0x15')]?_0x2d5341[_0xaaa3('0x15')][_0xaaa3('0x17')]||null:null,'limit':_0x2d5341['options']?_0x2d5341['options']['limit']||null:null,'include':_0x2d5341[_0xaaa3('0x15')]?_0x2d5341[_0xaaa3('0x15')][_0xaaa3('0x18')]?_[_0xaaa3('0x19')](_0x2d5341[_0xaaa3('0x15')]['include'],function(_0x2b1d15){return{'model':db[_0x2b1d15[_0xaaa3('0x1a')]],'as':_0x2b1d15['as'],'attributes':_0x2b1d15[_0xaaa3('0x17')],'include':_0x2b1d15['include']?_[_0xaaa3('0x19')](_0x2b1d15[_0xaaa3('0x18')],function(_0x4a2857){return{'model':db[_0x4a2857[_0xaaa3('0x1a')]],'as':_0x4a2857['as'],'attributes':_0x4a2857[_0xaaa3('0x17')],'include':_0x4a2857[_0xaaa3('0x18')]?_[_0xaaa3('0x19')](_0x4a2857[_0xaaa3('0x18')],function(_0x47aa70){return{'model':db[_0x47aa70[_0xaaa3('0x1a')]],'as':_0x47aa70['as'],'attributes':_0x47aa70[_0xaaa3('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x953547){logger[_0xaaa3('0x10')](_0xaaa3('0x1b'),_0x2d5341);logger[_0xaaa3('0x1c')](_0xaaa3('0x1b'),_0x2d5341,JSON['stringify'](_0x953547));_0x2b4766(_0x953547);})[_0xaaa3('0x12')](function(_0x56b881){logger[_0xaaa3('0xe')](_0xaaa3('0x1b'),_0x56b881[_0xaaa3('0xf')],_0x2d5341);_0x1f27ed(_0x4f5ae1[_0xaaa3('0xe')](0x1f4,_0x56b881[_0xaaa3('0xf')]));});});};exports[_0xaaa3('0x1d')]=function(_0x5535f0){var _0xa3f835=this;return new Promise(function(_0x2d5f50,_0x2eac93){return db[_0xaaa3('0x13')][_0xaaa3('0x1e')](_0x5535f0[_0xaaa3('0x1f')],{'raw':_0x5535f0[_0xaaa3('0x15')]?_0x5535f0[_0xaaa3('0x15')][_0xaaa3('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5535f0[_0xaaa3('0x15')]?_0x5535f0[_0xaaa3('0x15')][_0xaaa3('0x16')]||null:null,'attributes':_0x5535f0[_0xaaa3('0x15')]?_0x5535f0[_0xaaa3('0x15')][_0xaaa3('0x17')]||null:null,'limit':_0x5535f0[_0xaaa3('0x15')]?_0x5535f0['options']['limit']||null:null})[_0xaaa3('0xa')](function(_0x4e96d1){logger[_0xaaa3('0x10')](_0xaaa3('0x1d'),_0x5535f0);logger[_0xaaa3('0x1c')](_0xaaa3('0x1d'),_0x5535f0,JSON[_0xaaa3('0x21')](_0x4e96d1));_0x2d5f50(_0x4e96d1);})[_0xaaa3('0x12')](function(_0x5a8e9b){logger['error'](_0xaaa3('0x1d'),_0x5a8e9b['message'],_0x5535f0);_0x2eac93(_0xa3f835[_0xaaa3('0xe')](0x1f4,_0x5a8e9b[_0xaaa3('0xf')]));});});};exports[_0xaaa3('0x22')]=function(_0x59d1e8){var _0x18c6a6=this;return new Promise(function(_0x2f4279,_0x829242){return db[_0xaaa3('0x13')][_0xaaa3('0x23')]({'where':_0x59d1e8[_0xaaa3('0x15')]?_0x59d1e8[_0xaaa3('0x15')]['where']||null:null})[_0xaaa3('0xa')](function(_0x8bf034){logger[_0xaaa3('0x10')]('DestroyCmHopperBlack',_0x59d1e8);logger[_0xaaa3('0x1c')](_0xaaa3('0x22'),_0x59d1e8,JSON[_0xaaa3('0x21')](_0x8bf034));_0x2f4279(_0x8bf034);})[_0xaaa3('0x12')](function(_0xca376f){logger[_0xaaa3('0xe')]('DestroyCmHopperBlack',_0xca376f[_0xaaa3('0xf')],_0x59d1e8);_0x829242(_0x18c6a6['error'](0x1f4,_0xca376f['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 56f9d2d..e9a2754 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 _0xafc4=['multer','path','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','/:id','show','put','delete','destroy'];(function(_0x4bf753,_0x8c5d38){var _0x4ee4c2=function(_0x4fb2b8){while(--_0x4fb2b8){_0x4bf753['push'](_0x4bf753['shift']());}};_0x4ee4c2(++_0x8c5d38);}(_0xafc4,0x69));var _0x4afc=function(_0x2767a0,_0x4b16a5){_0x2767a0=_0x2767a0-0x0;var _0x23488c=_0xafc4[_0x2767a0];return _0x23488c;};'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 fs_extra=require(_0x4afc('0x4'));var auth=require(_0x4afc('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmHopperBlack.controller');router[_0x4afc('0x6')]('/',auth[_0x4afc('0x7')](),controller[_0x4afc('0x8')]);router[_0x4afc('0x6')](_0x4afc('0x9'),auth[_0x4afc('0x7')](),controller['describe']);router[_0x4afc('0x6')](_0x4afc('0xa'),auth[_0x4afc('0x7')](),controller[_0x4afc('0xb')]);router[_0x4afc('0xc')](_0x4afc('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x4afc('0xd')]('/:id',auth[_0x4afc('0x7')](),controller[_0x4afc('0xe')]);module['exports']=router; \ No newline at end of file +var _0xd117=['/describe','describe','/:id','show','put','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0xd117,0x182));var _0x7d11=function(_0x408de5,_0x24fa7b){_0x408de5=_0x408de5-0x0;var _0x2015a1=_0xd117[_0x408de5];return _0x2015a1;};'use strict';var multer=require(_0x7d11('0x0'));var util=require(_0x7d11('0x1'));var path=require(_0x7d11('0x2'));var timeout=require(_0x7d11('0x3'));var express=require(_0x7d11('0x4'));var router=express[_0x7d11('0x5')]();var fs_extra=require(_0x7d11('0x6'));var auth=require(_0x7d11('0x7'));var interaction=require(_0x7d11('0x8'));var config=require(_0x7d11('0x9'));var controller=require(_0x7d11('0xa'));router[_0x7d11('0xb')]('/',auth[_0x7d11('0xc')](),controller[_0x7d11('0xd')]);router[_0x7d11('0xb')](_0x7d11('0xe'),auth['isAuthenticated'](),controller[_0x7d11('0xf')]);router[_0x7d11('0xb')](_0x7d11('0x10'),auth['isAuthenticated'](),controller[_0x7d11('0x11')]);router[_0x7d11('0x12')](_0x7d11('0x10'),auth['isAuthenticated'](),controller[_0x7d11('0x13')]);router['delete']('/:id',auth[_0x7d11('0xc')](),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 af85068..d5bbd48 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 _0x35fe=['setDataValue','followuptime','diff','seconds','dispositionat','BOOLEAN','sequelize','moment','INTEGER','STRING','DATE','getDataValue','endtime'];(function(_0x3ad2e5,_0x94d414){var _0xc4e565=function(_0x2c96e3){while(--_0x2c96e3){_0x3ad2e5['push'](_0x3ad2e5['shift']());}};_0xc4e565(++_0x94d414);}(_0x35fe,0x1f4));var _0xe35f=function(_0x2077c2,_0x275ab5){_0x2077c2=_0x2077c2-0x0;var _0x312f9f=_0x35fe[_0x2077c2];return _0x312f9f;};'use strict';var Sequelize=require(_0xe35f('0x0'));var moment=require(_0xe35f('0x1'));module['exports']={'state':{'type':Sequelize[_0xe35f('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xe35f('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xe35f('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xe35f('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xe35f('0x3')]},'calleridnum':{'type':Sequelize[_0xe35f('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xe35f('0x4')]},'responsetime':{'type':Sequelize[_0xe35f('0x4')]},'answertime':{'type':Sequelize[_0xe35f('0x4')]},'droptime':{'type':Sequelize[_0xe35f('0x4')]},'endtime':{'type':Sequelize[_0xe35f('0x4')]},'ringtime':{'type':Sequelize[_0xe35f('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xe35f('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xe35f('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xe35f('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xe35f('0x3')]},'membername':{'type':Sequelize[_0xe35f('0x3')]},'reason':{'type':Sequelize[_0xe35f('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xe35f('0x3')]},'thirdDisposition':{'type':Sequelize[_0xe35f('0x3')]},'dispositionat':{'type':Sequelize[_0xe35f('0x4')],'set':function(_0x1536cd){var _0x393481=this[_0xe35f('0x5')](_0xe35f('0x6'));if(_0x393481&&_0x1536cd){this[_0xe35f('0x7')](_0xe35f('0x8'),moment(_0x1536cd)[_0xe35f('0x9')](moment(_0x393481),_0xe35f('0xa')));}return this[_0xe35f('0x7')](_0xe35f('0xb'),_0x1536cd);}},'amd':{'type':Sequelize[_0xe35f('0xc')],'defaultValue':![]},'fax':{'type':Sequelize[_0xe35f('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xe35f('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0xe35f('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xe35f('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0xe35f('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xe35f('0x4')]},'recallme':{'type':Sequelize[_0xe35f('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xe35f('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0xe35f('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xe35f('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0ded=['followuptime','diff','setDataValue','dispositionat','BOOLEAN','sequelize','exports','INTEGER','DATE','STRING','getDataValue','endtime'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0x0ded,0x10d));var _0xd0de=function(_0x310504,_0x26ad95){_0x310504=_0x310504-0x0;var _0x5b36d0=_0x0ded[_0x310504];return _0x5b36d0;};'use strict';var Sequelize=require(_0xd0de('0x0'));var moment=require('moment');module[_0xd0de('0x1')]={'state':{'type':Sequelize[_0xd0de('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xd0de('0x3')]},'countbusyretry':{'type':Sequelize[_0xd0de('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xd0de('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xd0de('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xd0de('0x4')]},'originatecalleridnum':{'type':Sequelize[_0xd0de('0x4')]},'originatecalleridname':{'type':Sequelize[_0xd0de('0x4')]},'calleridnum':{'type':Sequelize[_0xd0de('0x4')]},'calleridname':{'type':Sequelize[_0xd0de('0x4')]},'starttime':{'type':Sequelize[_0xd0de('0x3')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xd0de('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xd0de('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xd0de('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xd0de('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xd0de('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xd0de('0x4')]},'campaign':{'type':Sequelize[_0xd0de('0x4')]},'campaigntype':{'type':Sequelize[_0xd0de('0x4')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xd0de('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xd0de('0x4')]},'thirdDisposition':{'type':Sequelize[_0xd0de('0x4')]},'dispositionat':{'type':Sequelize[_0xd0de('0x3')],'set':function(_0x1bc958){var _0x1b705a=this[_0xd0de('0x5')](_0xd0de('0x6'));if(_0x1b705a&&_0x1bc958){this['setDataValue'](_0xd0de('0x7'),moment(_0x1bc958)[_0xd0de('0x8')](moment(_0x1b705a),'seconds'));}return this[_0xd0de('0x9')](_0xd0de('0xa'),_0x1bc958);}},'amd':{'type':Sequelize[_0xd0de('0xb')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xd0de('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xd0de('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xd0de('0x3')]},'callback':{'type':Sequelize[_0xd0de('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xd0de('0x3')]},'deleted':{'type':Sequelize[_0xd0de('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xd0de('0x3')]},'recallme':{'type':Sequelize[_0xd0de('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xd0de('0x3')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xd0de('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd0de('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xd0de('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 34752ae..d400680 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 _0x326f=['type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','merge','VIRTUAL','options','CmHopperFinal','includeAll','include','rows','catch','show','params','find','describe','uniqueid','body','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','noSuchContacts','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','scheduledAt','ContactId','createdAt','select','field','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','VoiceQueueId','updatedAt','from','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','calleridnum\x20NOT\x20IN\x20(?)','toString','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','fromQuery','phone','CampaignId','ANY_VALUE(CampaignId)','cm_hopper_final','calleridnum\x20IS\x20NOT\x20NULL','CampaignId\x20=\x20?','checkContactHopper','CmHopper','eml-format','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/logger','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','stack','name','send','map','rawAttributes','fieldName'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x326f,0xd1));var _0xf326=function(_0x4f2077,_0x36f1f8){_0x4f2077=_0x4f2077-0x0;var _0x4a229f=_0x326f[_0x4f2077];return _0x4a229f;};'use strict';var emlformat=require(_0xf326('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf326('0x1'));var rp=require(_0xf326('0x2'));var moment=require(_0xf326('0x3'));var BPromise=require(_0xf326('0x4'));var Mustache=require(_0xf326('0x5'));var util=require(_0xf326('0x6'));var path=require(_0xf326('0x7'));var sox=require(_0xf326('0x8'));var csv=require(_0xf326('0x9'));var ejs=require(_0xf326('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf326('0xb'));var squel=require(_0xf326('0xc'));var crypto=require(_0xf326('0xd'));var jsforce=require(_0xf326('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf326('0xf'));var Redis=require(_0xf326('0x10'));var authService=require(_0xf326('0x11'));var qs=require(_0xf326('0x12'));var as=require(_0xf326('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf326('0x14'))('api');var utils=require(_0xf326('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf326('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3162f9,_0x9ed463){_0x9ed463=_0x9ed463||0xcc;return function(_0x4b3966){if(_0x4b3966){return _0x3162f9[_0xf326('0x17')](_0x9ed463);}return _0x3162f9[_0xf326('0x18')](_0x9ed463)[_0xf326('0x19')]();};}function respondWithResult(_0x17a098,_0x5c8483){_0x5c8483=_0x5c8483||0xc8;return function(_0x45c1b6){if(_0x45c1b6){return _0x17a098['status'](_0x5c8483)['json'](_0x45c1b6);}};}function respondWithFilteredResult(_0xdf21d9,_0x11f6d2){return function(_0x1f2e5a){if(_0x1f2e5a){var _0xa63d1a=typeof _0x11f6d2[_0xf326('0x1a')]===_0xf326('0x1b')&&typeof _0x11f6d2[_0xf326('0x1c')]===_0xf326('0x1b');var _0x5a682a=_0x1f2e5a[_0xf326('0x1d')];var _0x453100=_0xa63d1a?0x0:_0x11f6d2[_0xf326('0x1a')];var _0x31ffb9=_0xa63d1a?_0x1f2e5a[_0xf326('0x1d')]:_0x11f6d2[_0xf326('0x1a')]+_0x11f6d2['limit'];var _0x4a5b6c;if(_0x31ffb9>=_0x5a682a){_0x31ffb9=_0x5a682a;_0x4a5b6c=0xc8;}else{_0x4a5b6c=0xce;}_0xdf21d9['status'](_0x4a5b6c);return _0xdf21d9[_0xf326('0x1e')](_0xf326('0x1f'),_0x453100+'-'+_0x31ffb9+'/'+_0x5a682a)['json'](_0x1f2e5a);}return null;};}function patchUpdates(_0x4cabce){return function(_0x128c68){try{jsonpatch['apply'](_0x128c68,_0x4cabce,!![]);}catch(_0x5b6d3c){return BPromise[_0xf326('0x20')](_0x5b6d3c);}return _0x128c68[_0xf326('0x21')]();};}function saveUpdates(_0x549b46,_0x5aa184){return function(_0x19b8ba){if(_0x19b8ba){return _0x19b8ba[_0xf326('0x22')](_0x549b46)['then'](function(_0x337ed5){return _0x337ed5;});}return null;};}function removeEntity(_0x1b9039,_0x43c53e){return function(_0x295752){if(_0x295752){return _0x295752[_0xf326('0x23')]()[_0xf326('0x24')](function(){_0x1b9039['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f31f6,_0x520d85){return function(_0x1a2c4e){if(!_0x1a2c4e){_0x4f31f6[_0xf326('0x17')](0x194);}return _0x1a2c4e;};}function handleError(_0x1ff2b5,_0x148953){_0x148953=_0x148953||0x1f4;return function(_0x410237){logger['error'](_0x410237[_0xf326('0x25')]);if(_0x410237[_0xf326('0x26')]){delete _0x410237[_0xf326('0x26')];}_0x1ff2b5['status'](_0x148953)[_0xf326('0x27')](_0x410237);};}exports['index']=function(_0x4a9abf,_0x6a8e89){var _0x1ae23a={},_0x2fa28e={},_0x5dbe63={'count':0x0,'rows':[]};var _0xc115d9=_[_0xf326('0x28')](db['CmHopperFinal'][_0xf326('0x29')],function(_0x119ab8){return{'name':_0x119ab8[_0xf326('0x2a')],'type':_0x119ab8[_0xf326('0x2b')][_0xf326('0x2c')]};});_0x2fa28e[_0xf326('0x2d')]=_[_0xf326('0x28')](_0xc115d9,_0xf326('0x26'));_0x2fa28e[_0xf326('0x2e')]=_[_0xf326('0x2f')](_0x4a9abf['query']);_0x2fa28e[_0xf326('0x30')]=_[_0xf326('0x31')](_0x2fa28e[_0xf326('0x2d')],_0x2fa28e['query']);_0x1ae23a[_0xf326('0x32')]=_[_0xf326('0x31')](_0x2fa28e[_0xf326('0x2d')],qs['fields'](_0x4a9abf['query'][_0xf326('0x33')]));_0x1ae23a[_0xf326('0x32')]=_0x1ae23a[_0xf326('0x32')][_0xf326('0x34')]?_0x1ae23a[_0xf326('0x32')]:_0x2fa28e[_0xf326('0x2d')];if(!_0x4a9abf[_0xf326('0x2e')][_0xf326('0x35')]('nolimit')){_0x1ae23a[_0xf326('0x1c')]=qs[_0xf326('0x1c')](_0x4a9abf['query'][_0xf326('0x1c')]);_0x1ae23a['offset']=qs[_0xf326('0x1a')](_0x4a9abf['query']['offset']);}_0x1ae23a[_0xf326('0x36')]=qs['sort'](_0x4a9abf[_0xf326('0x2e')]['sort']);_0x1ae23a[_0xf326('0x37')]=qs[_0xf326('0x30')](_[_0xf326('0x38')](_0x4a9abf['query'],_0x2fa28e[_0xf326('0x30')]),_0xc115d9);if(_0x4a9abf[_0xf326('0x2e')]['filter']){_0x1ae23a[_0xf326('0x37')]=_[_0xf326('0x39')](_0x1ae23a[_0xf326('0x37')],{'$or':_[_0xf326('0x28')](_0xc115d9,function(_0x51076c){if(_0x51076c[_0xf326('0x2b')]!==_0xf326('0x3a')){var _0x1e69b1={};_0x1e69b1[_0x51076c[_0xf326('0x26')]]={'$like':'%'+_0x4a9abf[_0xf326('0x2e')]['filter']+'%'};return _0x1e69b1;}})});}_0x1ae23a=_[_0xf326('0x39')]({},_0x1ae23a,_0x4a9abf[_0xf326('0x3b')]);var _0x5cfb97={'where':_0x1ae23a['where']};return db[_0xf326('0x3c')]['count'](_0x5cfb97)['then'](function(_0x22d462){_0x5dbe63['count']=_0x22d462;if(_0x4a9abf[_0xf326('0x2e')][_0xf326('0x3d')]){_0x1ae23a[_0xf326('0x3e')]=[{'all':!![]}];}return db[_0xf326('0x3c')]['findAll'](_0x1ae23a);})[_0xf326('0x24')](function(_0x45d344){_0x5dbe63[_0xf326('0x3f')]=_0x45d344;return _0x5dbe63;})[_0xf326('0x24')](respondWithFilteredResult(_0x6a8e89,_0x1ae23a))[_0xf326('0x40')](handleError(_0x6a8e89,null));};exports[_0xf326('0x41')]=function(_0x2ad841,_0x224a32){var _0x31283b={'raw':!![],'where':{'id':_0x2ad841[_0xf326('0x42')]['id']}},_0x1227d3={};_0x1227d3[_0xf326('0x2d')]=_['keys'](db[_0xf326('0x3c')][_0xf326('0x29')]);_0x1227d3[_0xf326('0x2e')]=_[_0xf326('0x2f')](_0x2ad841[_0xf326('0x2e')]);_0x1227d3[_0xf326('0x30')]=_['intersection'](_0x1227d3[_0xf326('0x2d')],_0x1227d3[_0xf326('0x2e')]);_0x31283b['attributes']=_[_0xf326('0x31')](_0x1227d3[_0xf326('0x2d')],qs[_0xf326('0x33')](_0x2ad841[_0xf326('0x2e')][_0xf326('0x33')]));_0x31283b['attributes']=_0x31283b['attributes'][_0xf326('0x34')]?_0x31283b[_0xf326('0x32')]:_0x1227d3['model'];if(_0x2ad841['query'][_0xf326('0x3d')]){_0x31283b[_0xf326('0x3e')]=[{'all':!![]}];}_0x31283b=_[_0xf326('0x39')]({},_0x31283b,_0x2ad841['options']);return db[_0xf326('0x3c')][_0xf326('0x43')](_0x31283b)[_0xf326('0x24')](handleEntityNotFound(_0x224a32,null))[_0xf326('0x24')](respondWithResult(_0x224a32,null))[_0xf326('0x40')](handleError(_0x224a32,null));};exports[_0xf326('0x44')]=function(_0x12792c,_0x3b90dc){return db[_0xf326('0x3c')][_0xf326('0x44')]()[_0xf326('0x24')](respondWithResult(_0x3b90dc,null))[_0xf326('0x40')](handleError(_0x3b90dc,null));};exports[_0xf326('0x22')]=function(_0x395b1e,_0xeac1a1){if(_0x395b1e['body'][_0xf326('0x45')]){delete _0x395b1e[_0xf326('0x46')][_0xf326('0x45')];}return db[_0xf326('0x3c')]['find']({'where':{'uniqueid':_0x395b1e[_0xf326('0x42')]['id']}})[_0xf326('0x24')](handleEntityNotFound(_0xeac1a1,null))[_0xf326('0x24')](saveUpdates(_0x395b1e[_0xf326('0x46')],null))['then'](respondWithResult(_0xeac1a1,null))[_0xf326('0x40')](handleError(_0xeac1a1,null));};exports[_0xf326('0x47')]=function(_0x145a77,_0x451ac7,_0x39ba25){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'VoiceQueueId':_0x145a77[_0xf326('0x42')]['id']},'attributes':[[db[_0xf326('0x48')]['fn'](_0xf326('0x49'),db['sequelize']['fn']('IF',db[_0xf326('0x48')][_0xf326('0x4a')](_0xf326('0x4b')))),'noSuchContacts'],[db['sequelize']['fn'](_0xf326('0x49'),db['sequelize']['fn']('IF',db[_0xf326('0x48')]['literal'](_0xf326('0x4c')))),_0xf326('0x4d')],[db[_0xf326('0x48')]['fn'](_0xf326('0x49'),db[_0xf326('0x48')]['fn']('IF',db[_0xf326('0x48')][_0xf326('0x4a')]('`state`\x20=\x205,\x201,\x20null'))),_0xf326('0x4e')],[db[_0xf326('0x48')]['fn'](_0xf326('0x49'),db['sequelize']['fn']('IF',db[_0xf326('0x48')][_0xf326('0x4a')](_0xf326('0x4f')))),_0xf326('0x50')],[db[_0xf326('0x48')]['fn']('COUNT',db[_0xf326('0x48')]['fn']('IF',db[_0xf326('0x48')][_0xf326('0x4a')](_0xf326('0x51')))),'dropContacts'],[db[_0xf326('0x48')]['fn'](_0xf326('0x49'),db[_0xf326('0x48')]['fn']('IF',db[_0xf326('0x48')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xf326('0x52')],[db[_0xf326('0x48')]['fn']('COUNT',db[_0xf326('0x48')]['fn']('IF',db[_0xf326('0x48')][_0xf326('0x4a')](_0xf326('0x53')))),'reCallContacts'],[db[_0xf326('0x48')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xf326('0x48')]['literal'](_0xf326('0x54')))),_0xf326('0x55')]]})[_0xf326('0x24')](handleEntityNotFound(_0x451ac7,null))['then'](respondWithResult(_0x451ac7,null))['catch'](handleError(_0x451ac7,null));};exports[_0xf326('0x56')]=function(_0xa85a42,_0x33b259,_0x5d0177){return db[_0xf326('0x3c')]['findAll']({'raw':![],'where':{'CampaignId':_0xa85a42[_0xf326('0x42')]['id']},'attributes':[[db[_0xf326('0x48')]['fn'](_0xf326('0x49'),db[_0xf326('0x48')]['fn']('IF',db[_0xf326('0x48')][_0xf326('0x4a')](_0xf326('0x4b')))),_0xf326('0x57')],[db[_0xf326('0x48')]['fn'](_0xf326('0x49'),db[_0xf326('0x48')]['fn']('IF',db[_0xf326('0x48')][_0xf326('0x4a')]('`state`\x20=\x203,\x201,\x20null'))),_0xf326('0x4d')],[db['sequelize']['fn'](_0xf326('0x49'),db[_0xf326('0x48')]['fn']('IF',db['sequelize'][_0xf326('0x4a')]('`state`\x20=\x205,\x201,\x20null'))),_0xf326('0x4e')],[db[_0xf326('0x48')]['fn'](_0xf326('0x49'),db[_0xf326('0x48')]['fn']('IF',db[_0xf326('0x48')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0xf326('0x50')],[db[_0xf326('0x48')]['fn'](_0xf326('0x49'),db[_0xf326('0x48')]['fn']('IF',db[_0xf326('0x48')]['literal'](_0xf326('0x51')))),_0xf326('0x58')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xf326('0x48')][_0xf326('0x4a')](_0xf326('0x59')))),_0xf326('0x52')],[db[_0xf326('0x48')]['fn'](_0xf326('0x49'),db[_0xf326('0x48')]['fn']('IF',db['sequelize'][_0xf326('0x4a')](_0xf326('0x53')))),_0xf326('0x5a')],[db[_0xf326('0x48')]['fn']('COUNT',db[_0xf326('0x48')]['fn']('IF',db['sequelize']['literal'](_0xf326('0x54')))),'answeringMachine']]})[_0xf326('0x24')](handleEntityNotFound(_0x33b259,null))[_0xf326('0x24')](respondWithResult(_0x33b259,null))[_0xf326('0x40')](handleError(_0x33b259,null));};exports[_0xf326('0x5b')]=function(_0x17cd36,_0x541491,_0x4a053c){return db['VoiceQueue'][_0xf326('0x43')]({'where':{'id':_0x17cd36[_0xf326('0x42')]['id']}})[_0xf326('0x24')](handleEntityNotFound(_0x541491,null))[_0xf326('0x24')](function(_0xec5857){var _0x5e874b;if(_0xec5857){_0x5e874b=squel[_0xf326('0x5c')]()[_0xf326('0x5d')](_0xf326('0x5e'))['fromQuery'](['phone',_0xf326('0x5f'),_0xf326('0x60'),'ListId','VoiceQueueId',_0xf326('0x61'),'updatedAt'],squel[_0xf326('0x62')]()['field']('ANY_VALUE(calleridnum)','phone')[_0xf326('0x63')](_0xf326('0x64'),_0xf326('0x5f'))['field'](_0xf326('0x65'),_0xf326('0x60'))[_0xf326('0x63')](_0xf326('0x66'),_0xf326('0x67'))[_0xf326('0x63')](_0xf326('0x68'),_0xf326('0x69'))[_0xf326('0x63')]('NOW()',_0xf326('0x61'))['field'](_0xf326('0x64'),_0xf326('0x6a'))[_0xf326('0x6b')]('cm_hopper_final')[_0xf326('0x37')](_0xf326('0x6c'),_0x17cd36[_0xf326('0x42')]['id']['toString']())[_0xf326('0x37')](_0xf326('0x6d'),_0x17cd36[_0xf326('0x46')][_0xf326('0x6e')]['toString']())[_0xf326('0x37')]('calleridnum\x20IS\x20NOT\x20NULL')['where'](_0xf326('0x6f'),squel[_0xf326('0x62')]()['field']('phone')['from'](_0xf326('0x5e'))['where'](_0xf326('0x6c'),_0x17cd36[_0xf326('0x42')]['id'][_0xf326('0x70')]()))[_0xf326('0x37')](_0xf326('0x6f'),squel[_0xf326('0x62')]()['field'](_0xf326('0x71'))[_0xf326('0x6b')]('cm_hopper_final')['where'](_0xf326('0x6c'),_0x17cd36['params']['id'][_0xf326('0x70')]())[_0xf326('0x37')](_0xf326('0x72')))[_0xf326('0x73')](_0xf326('0x60')))[_0xf326('0x70')]();return db[_0xf326('0x48')][_0xf326('0x2e')](_0x5e874b);}return[];})[_0xf326('0x24')](respondWithResult(_0x541491,null))['catch'](handleError(_0x541491,null));};exports[_0xf326('0x74')]=function(_0x26bbb1,_0x4ac90e,_0x3c82cf){return db['Campaign'][_0xf326('0x43')]({'where':{'id':_0x26bbb1[_0xf326('0x42')]['id']}})[_0xf326('0x24')](handleEntityNotFound(_0x4ac90e,null))['then'](function(_0x2b4414){var _0x1c86c8;if(_0x2b4414){_0x1c86c8=squel[_0xf326('0x5c')]()[_0xf326('0x5d')](_0xf326('0x5e'))[_0xf326('0x75')]([_0xf326('0x76'),_0xf326('0x5f'),_0xf326('0x60'),_0xf326('0x67'),_0xf326('0x77'),_0xf326('0x61'),_0xf326('0x6a')],squel[_0xf326('0x62')]()[_0xf326('0x63')]('ANY_VALUE(calleridnum)',_0xf326('0x76'))[_0xf326('0x63')]('NOW()',_0xf326('0x5f'))[_0xf326('0x63')]('ANY_VALUE(ContactId)',_0xf326('0x60'))[_0xf326('0x63')](_0xf326('0x66'),_0xf326('0x67'))[_0xf326('0x63')](_0xf326('0x78'),_0xf326('0x77'))['field'](_0xf326('0x64'),_0xf326('0x61'))[_0xf326('0x63')](_0xf326('0x64'),_0xf326('0x6a'))[_0xf326('0x6b')](_0xf326('0x79'))[_0xf326('0x37')]('CampaignId\x20=\x20?',_0x26bbb1[_0xf326('0x42')]['id'][_0xf326('0x70')]())['where'](_0xf326('0x6d'),_0x26bbb1['body'][_0xf326('0x6e')][_0xf326('0x70')]())[_0xf326('0x37')](_0xf326('0x7a'))[_0xf326('0x37')](_0xf326('0x6f'),squel[_0xf326('0x62')]()[_0xf326('0x63')](_0xf326('0x76'))[_0xf326('0x6b')](_0xf326('0x5e'))[_0xf326('0x37')](_0xf326('0x7b'),_0x26bbb1[_0xf326('0x42')]['id']['toString']()))[_0xf326('0x37')](_0xf326('0x6f'),squel[_0xf326('0x62')]()[_0xf326('0x63')](_0xf326('0x71'))['from'](_0xf326('0x79'))[_0xf326('0x37')](_0xf326('0x7b'),_0x26bbb1[_0xf326('0x42')]['id'][_0xf326('0x70')]())['where']('state\x20=\x204'))[_0xf326('0x73')]('ContactId'))[_0xf326('0x70')]();return db[_0xf326('0x48')][_0xf326('0x2e')](_0x1c86c8);}return[];})['then'](respondWithResult(_0x4ac90e,null))['catch'](handleError(_0x4ac90e,null));};exports[_0xf326('0x7c')]=function(_0x2d92e4,_0x167ac9,_0x34870c){return db[_0xf326('0x7d')]['findOne']({'where':{'VoiceQueueId':_0x2d92e4[_0xf326('0x46')][_0xf326('0x69')],'CampaignId':_0x2d92e4[_0xf326('0x46')]['CampaignId'],'ContactId':_0x2d92e4['body']['ContactId']}})[_0xf326('0x24')](handleEntityNotFound(_0x167ac9,null))[_0xf326('0x24')](function(_0x2d275d){if(_0x2d275d){return _0x2d275d;}return null;})[_0xf326('0x24')](respondWithResult(_0x167ac9,null))[_0xf326('0x40')](handleError(_0x167ac9,null));}; \ No newline at end of file +var _0x2a07=['jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','error','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','catch','show','params','fields','includeAll','describe','body','uniqueid','find','findAll','sequelize','COUNT','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','`state`\x20=\x2010\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','congestionContacts','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','ANY_VALUE(calleridnum)','phone','field','NOW()','scheduledAt','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','toString','Campaign','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','group','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x51652f,_0x42bbee){var _0x1cdbf2=function(_0x5b12b2){while(--_0x5b12b2){_0x51652f['push'](_0x51652f['shift']());}};_0x1cdbf2(++_0x42bbee);}(_0x2a07,0x74));var _0x72a0=function(_0x3dcab,_0x58860f){_0x3dcab=_0x3dcab-0x0;var _0x517c6a=_0x2a07[_0x3dcab];return _0x517c6a;};'use strict';var emlformat=require(_0x72a0('0x0'));var rimraf=require(_0x72a0('0x1'));var zipdir=require(_0x72a0('0x2'));var jsonpatch=require(_0x72a0('0x3'));var rp=require(_0x72a0('0x4'));var moment=require('moment');var BPromise=require(_0x72a0('0x5'));var Mustache=require(_0x72a0('0x6'));var util=require(_0x72a0('0x7'));var path=require(_0x72a0('0x8'));var sox=require(_0x72a0('0x9'));var csv=require(_0x72a0('0xa'));var ejs=require(_0x72a0('0xb'));var fs=require('fs');var fs_extra=require(_0x72a0('0xc'));var _=require(_0x72a0('0xd'));var squel=require(_0x72a0('0xe'));var crypto=require(_0x72a0('0xf'));var jsforce=require(_0x72a0('0x10'));var deskjs=require(_0x72a0('0x11'));var toCsv=require(_0x72a0('0xa'));var querystring=require(_0x72a0('0x12'));var Papa=require(_0x72a0('0x13'));var Redis=require('ioredis');var authService=require(_0x72a0('0x14'));var qs=require(_0x72a0('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x72a0('0x16'));var logger=require(_0x72a0('0x17'))(_0x72a0('0x18'));var utils=require(_0x72a0('0x19'));var config=require(_0x72a0('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x72a0('0x1b'))['db'];function respondWithStatusCode(_0x335b9f,_0x123ca4){_0x123ca4=_0x123ca4||0xcc;return function(_0xf91a82){if(_0xf91a82){return _0x335b9f[_0x72a0('0x1c')](_0x123ca4);}return _0x335b9f[_0x72a0('0x1d')](_0x123ca4)[_0x72a0('0x1e')]();};}function respondWithResult(_0x5e0b5f,_0x4930c5){_0x4930c5=_0x4930c5||0xc8;return function(_0xe103dc){if(_0xe103dc){return _0x5e0b5f[_0x72a0('0x1d')](_0x4930c5)[_0x72a0('0x1f')](_0xe103dc);}};}function respondWithFilteredResult(_0x1d1133,_0x23b001){return function(_0x3f3d62){if(_0x3f3d62){var _0x4ab55e=typeof _0x23b001[_0x72a0('0x20')]===_0x72a0('0x21')&&typeof _0x23b001[_0x72a0('0x22')]===_0x72a0('0x21');var _0x2d1e95=_0x3f3d62['count'];var _0x100d8f=_0x4ab55e?0x0:_0x23b001[_0x72a0('0x20')];var _0x131b73=_0x4ab55e?_0x3f3d62['count']:_0x23b001[_0x72a0('0x20')]+_0x23b001[_0x72a0('0x22')];var _0x30899b;if(_0x131b73>=_0x2d1e95){_0x131b73=_0x2d1e95;_0x30899b=0xc8;}else{_0x30899b=0xce;}_0x1d1133[_0x72a0('0x1d')](_0x30899b);return _0x1d1133['set'](_0x72a0('0x23'),_0x100d8f+'-'+_0x131b73+'/'+_0x2d1e95)['json'](_0x3f3d62);}return null;};}function patchUpdates(_0x3d0607){return function(_0x315413){try{jsonpatch[_0x72a0('0x24')](_0x315413,_0x3d0607,!![]);}catch(_0x5c7479){return BPromise[_0x72a0('0x25')](_0x5c7479);}return _0x315413[_0x72a0('0x26')]();};}function saveUpdates(_0x1d22d8,_0x3d1965){return function(_0x5d6145){if(_0x5d6145){return _0x5d6145[_0x72a0('0x27')](_0x1d22d8)[_0x72a0('0x28')](function(_0x1ddd54){return _0x1ddd54;});}return null;};}function removeEntity(_0x23b918,_0x3022b0){return function(_0x174b1b){if(_0x174b1b){return _0x174b1b['destroy']()['then'](function(){_0x23b918[_0x72a0('0x1d')](0xcc)[_0x72a0('0x1e')]();});}};}function handleEntityNotFound(_0x123df4,_0x1504ed){return function(_0xf5cb49){if(!_0xf5cb49){_0x123df4[_0x72a0('0x1c')](0x194);}return _0xf5cb49;};}function handleError(_0xa5bda0,_0x15922a){_0x15922a=_0x15922a||0x1f4;return function(_0xee99e2){logger[_0x72a0('0x29')](_0xee99e2['stack']);if(_0xee99e2[_0x72a0('0x2a')]){delete _0xee99e2[_0x72a0('0x2a')];}_0xa5bda0[_0x72a0('0x1d')](_0x15922a)[_0x72a0('0x2b')](_0xee99e2);};}exports[_0x72a0('0x2c')]=function(_0x177a3a,_0x432179){var _0x12eda2={},_0x23c96a={},_0x916733={'count':0x0,'rows':[]};var _0x4ba037=_[_0x72a0('0x2d')](db[_0x72a0('0x2e')][_0x72a0('0x2f')],function(_0xfbe9b3){return{'name':_0xfbe9b3[_0x72a0('0x30')],'type':_0xfbe9b3[_0x72a0('0x31')][_0x72a0('0x32')]};});_0x23c96a['model']=_[_0x72a0('0x2d')](_0x4ba037,_0x72a0('0x2a'));_0x23c96a[_0x72a0('0x33')]=_[_0x72a0('0x34')](_0x177a3a[_0x72a0('0x33')]);_0x23c96a[_0x72a0('0x35')]=_[_0x72a0('0x36')](_0x23c96a[_0x72a0('0x37')],_0x23c96a['query']);_0x12eda2[_0x72a0('0x38')]=_[_0x72a0('0x36')](_0x23c96a[_0x72a0('0x37')],qs['fields'](_0x177a3a[_0x72a0('0x33')]['fields']));_0x12eda2[_0x72a0('0x38')]=_0x12eda2[_0x72a0('0x38')][_0x72a0('0x39')]?_0x12eda2[_0x72a0('0x38')]:_0x23c96a[_0x72a0('0x37')];if(!_0x177a3a[_0x72a0('0x33')][_0x72a0('0x3a')](_0x72a0('0x3b'))){_0x12eda2[_0x72a0('0x22')]=qs[_0x72a0('0x22')](_0x177a3a[_0x72a0('0x33')][_0x72a0('0x22')]);_0x12eda2['offset']=qs[_0x72a0('0x20')](_0x177a3a['query'][_0x72a0('0x20')]);}_0x12eda2[_0x72a0('0x3c')]=qs[_0x72a0('0x3d')](_0x177a3a[_0x72a0('0x33')][_0x72a0('0x3d')]);_0x12eda2[_0x72a0('0x3e')]=qs[_0x72a0('0x35')](_[_0x72a0('0x3f')](_0x177a3a[_0x72a0('0x33')],_0x23c96a['filters']),_0x4ba037);if(_0x177a3a['query'][_0x72a0('0x40')]){_0x12eda2[_0x72a0('0x3e')]=_[_0x72a0('0x41')](_0x12eda2[_0x72a0('0x3e')],{'$or':_[_0x72a0('0x2d')](_0x4ba037,function(_0x512a06){if(_0x512a06[_0x72a0('0x31')]!==_0x72a0('0x42')){var _0x582c90={};_0x582c90[_0x512a06[_0x72a0('0x2a')]]={'$like':'%'+_0x177a3a['query']['filter']+'%'};return _0x582c90;}})});}_0x12eda2=_['merge']({},_0x12eda2,_0x177a3a[_0x72a0('0x43')]);var _0x49633b={'where':_0x12eda2[_0x72a0('0x3e')]};return db[_0x72a0('0x2e')][_0x72a0('0x44')](_0x49633b)[_0x72a0('0x28')](function(_0x4bf56e){_0x916733['count']=_0x4bf56e;if(_0x177a3a['query']['includeAll']){_0x12eda2[_0x72a0('0x45')]=[{'all':!![]}];}return db[_0x72a0('0x2e')]['findAll'](_0x12eda2);})[_0x72a0('0x28')](function(_0x35d790){_0x916733['rows']=_0x35d790;return _0x916733;})[_0x72a0('0x28')](respondWithFilteredResult(_0x432179,_0x12eda2))[_0x72a0('0x46')](handleError(_0x432179,null));};exports[_0x72a0('0x47')]=function(_0xe4abe1,_0x340153){var _0x341451={'raw':!![],'where':{'id':_0xe4abe1[_0x72a0('0x48')]['id']}},_0x50eb7f={};_0x50eb7f['model']=_[_0x72a0('0x34')](db['CmHopperFinal'][_0x72a0('0x2f')]);_0x50eb7f[_0x72a0('0x33')]=_['keys'](_0xe4abe1[_0x72a0('0x33')]);_0x50eb7f['filters']=_[_0x72a0('0x36')](_0x50eb7f[_0x72a0('0x37')],_0x50eb7f[_0x72a0('0x33')]);_0x341451['attributes']=_[_0x72a0('0x36')](_0x50eb7f[_0x72a0('0x37')],qs[_0x72a0('0x49')](_0xe4abe1['query']['fields']));_0x341451[_0x72a0('0x38')]=_0x341451['attributes'][_0x72a0('0x39')]?_0x341451[_0x72a0('0x38')]:_0x50eb7f[_0x72a0('0x37')];if(_0xe4abe1[_0x72a0('0x33')][_0x72a0('0x4a')]){_0x341451[_0x72a0('0x45')]=[{'all':!![]}];}_0x341451=_[_0x72a0('0x41')]({},_0x341451,_0xe4abe1[_0x72a0('0x43')]);return db[_0x72a0('0x2e')]['find'](_0x341451)[_0x72a0('0x28')](handleEntityNotFound(_0x340153,null))[_0x72a0('0x28')](respondWithResult(_0x340153,null))[_0x72a0('0x46')](handleError(_0x340153,null));};exports[_0x72a0('0x4b')]=function(_0x3a669d,_0x304400){return db[_0x72a0('0x2e')]['describe']()['then'](respondWithResult(_0x304400,null))[_0x72a0('0x46')](handleError(_0x304400,null));};exports[_0x72a0('0x27')]=function(_0xe38fb3,_0x3cab6a){if(_0xe38fb3[_0x72a0('0x4c')][_0x72a0('0x4d')]){delete _0xe38fb3[_0x72a0('0x4c')][_0x72a0('0x4d')];}return db[_0x72a0('0x2e')][_0x72a0('0x4e')]({'where':{'uniqueid':_0xe38fb3['params']['id']}})[_0x72a0('0x28')](handleEntityNotFound(_0x3cab6a,null))[_0x72a0('0x28')](saveUpdates(_0xe38fb3[_0x72a0('0x4c')],null))[_0x72a0('0x28')](respondWithResult(_0x3cab6a,null))[_0x72a0('0x46')](handleError(_0x3cab6a,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x143410,_0x595243,_0x4d712b){return db[_0x72a0('0x2e')][_0x72a0('0x4f')]({'raw':![],'where':{'VoiceQueueId':_0x143410[_0x72a0('0x48')]['id']},'attributes':[[db[_0x72a0('0x50')]['fn'](_0x72a0('0x51'),db['sequelize']['fn']('IF',db[_0x72a0('0x50')][_0x72a0('0x52')]('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db[_0x72a0('0x50')]['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db[_0x72a0('0x50')][_0x72a0('0x52')](_0x72a0('0x53')))),_0x72a0('0x54')],[db[_0x72a0('0x50')]['fn']('COUNT',db[_0x72a0('0x50')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x72a0('0x55')],[db[_0x72a0('0x50')]['fn']('COUNT',db[_0x72a0('0x50')]['fn']('IF',db['sequelize'][_0x72a0('0x52')]('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db[_0x72a0('0x50')]['fn'](_0x72a0('0x51'),db['sequelize']['fn']('IF',db[_0x72a0('0x50')]['literal'](_0x72a0('0x56')))),'dropContacts'],[db['sequelize']['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db[_0x72a0('0x50')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x72a0('0x57')],[db['sequelize']['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db[_0x72a0('0x50')][_0x72a0('0x52')](_0x72a0('0x58')))),_0x72a0('0x59')],[db[_0x72a0('0x50')]['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db[_0x72a0('0x50')][_0x72a0('0x52')](_0x72a0('0x5a')))),'answeringMachine']]})[_0x72a0('0x28')](handleEntityNotFound(_0x595243,null))['then'](respondWithResult(_0x595243,null))['catch'](handleError(_0x595243,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x522ee2,_0x237025,_0x4e5d05){return db[_0x72a0('0x2e')]['findAll']({'raw':![],'where':{'CampaignId':_0x522ee2[_0x72a0('0x48')]['id']},'attributes':[[db['sequelize']['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db['sequelize'][_0x72a0('0x52')](_0x72a0('0x5b')))),_0x72a0('0x5c')],[db[_0x72a0('0x50')]['fn']('COUNT',db[_0x72a0('0x50')]['fn']('IF',db['sequelize'][_0x72a0('0x52')](_0x72a0('0x53')))),_0x72a0('0x54')],[db['sequelize']['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db[_0x72a0('0x50')][_0x72a0('0x52')](_0x72a0('0x5d')))),'busyContacts'],[db['sequelize']['fn'](_0x72a0('0x51'),db['sequelize']['fn']('IF',db[_0x72a0('0x50')]['literal'](_0x72a0('0x5e')))),_0x72a0('0x5f')],[db['sequelize']['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db[_0x72a0('0x50')]['literal'](_0x72a0('0x56')))),'dropContacts'],[db[_0x72a0('0x50')]['fn'](_0x72a0('0x51'),db['sequelize']['fn']('IF',db[_0x72a0('0x50')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db[_0x72a0('0x50')]['fn']('COUNT',db[_0x72a0('0x50')]['fn']('IF',db['sequelize'][_0x72a0('0x52')](_0x72a0('0x58')))),_0x72a0('0x59')],[db['sequelize']['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db[_0x72a0('0x50')][_0x72a0('0x52')](_0x72a0('0x5a')))),'answeringMachine']]})[_0x72a0('0x28')](handleEntityNotFound(_0x237025,null))[_0x72a0('0x28')](respondWithResult(_0x237025,null))[_0x72a0('0x46')](handleError(_0x237025,null));};exports[_0x72a0('0x60')]=function(_0x4f0944,_0x3dd25d,_0x647e75){return db['VoiceQueue'][_0x72a0('0x4e')]({'where':{'id':_0x4f0944['params']['id']}})[_0x72a0('0x28')](handleEntityNotFound(_0x3dd25d,null))[_0x72a0('0x28')](function(_0xb17e09){var _0x1238a3;if(_0xb17e09){_0x1238a3=squel[_0x72a0('0x61')]()[_0x72a0('0x62')](_0x72a0('0x63'))['fromQuery'](['phone','scheduledAt',_0x72a0('0x64'),_0x72a0('0x65'),_0x72a0('0x66'),_0x72a0('0x67'),_0x72a0('0x68')],squel[_0x72a0('0x69')]()['field'](_0x72a0('0x6a'),_0x72a0('0x6b'))[_0x72a0('0x6c')](_0x72a0('0x6d'),_0x72a0('0x6e'))[_0x72a0('0x6c')](_0x72a0('0x6f'),'ContactId')[_0x72a0('0x6c')](_0x72a0('0x70'),_0x72a0('0x65'))[_0x72a0('0x6c')](_0x72a0('0x71'),_0x72a0('0x66'))['field'](_0x72a0('0x6d'),'createdAt')[_0x72a0('0x6c')](_0x72a0('0x6d'),_0x72a0('0x68'))[_0x72a0('0x72')](_0x72a0('0x73'))['where'](_0x72a0('0x74'),_0x4f0944[_0x72a0('0x48')]['id']['toString']())[_0x72a0('0x3e')](_0x72a0('0x75'),_0x4f0944[_0x72a0('0x4c')][_0x72a0('0x76')]['toString']())[_0x72a0('0x3e')](_0x72a0('0x77'))[_0x72a0('0x3e')](_0x72a0('0x78'),squel[_0x72a0('0x69')]()[_0x72a0('0x6c')](_0x72a0('0x6b'))[_0x72a0('0x72')](_0x72a0('0x63'))[_0x72a0('0x3e')](_0x72a0('0x74'),_0x4f0944[_0x72a0('0x48')]['id']['toString']()))[_0x72a0('0x3e')](_0x72a0('0x78'),squel[_0x72a0('0x69')]()[_0x72a0('0x6c')](_0x72a0('0x79'))[_0x72a0('0x72')](_0x72a0('0x73'))[_0x72a0('0x3e')]('VoiceQueueId\x20=\x20?',_0x4f0944[_0x72a0('0x48')]['id']['toString']())['where'](_0x72a0('0x7a')))['group']('ContactId'))[_0x72a0('0x7b')]();return db['sequelize'][_0x72a0('0x33')](_0x1238a3);}return[];})[_0x72a0('0x28')](respondWithResult(_0x3dd25d,null))[_0x72a0('0x46')](handleError(_0x3dd25d,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x344a69,_0x179ca2,_0x3832d7){return db[_0x72a0('0x7c')][_0x72a0('0x4e')]({'where':{'id':_0x344a69['params']['id']}})[_0x72a0('0x28')](handleEntityNotFound(_0x179ca2,null))[_0x72a0('0x28')](function(_0x38736e){var _0x4f421f;if(_0x38736e){_0x4f421f=squel[_0x72a0('0x61')]()[_0x72a0('0x62')](_0x72a0('0x63'))['fromQuery']([_0x72a0('0x6b'),_0x72a0('0x6e'),_0x72a0('0x64'),_0x72a0('0x65'),_0x72a0('0x7d'),_0x72a0('0x67'),_0x72a0('0x68')],squel[_0x72a0('0x69')]()[_0x72a0('0x6c')]('ANY_VALUE(calleridnum)',_0x72a0('0x6b'))[_0x72a0('0x6c')](_0x72a0('0x6d'),_0x72a0('0x6e'))[_0x72a0('0x6c')]('ANY_VALUE(ContactId)',_0x72a0('0x64'))[_0x72a0('0x6c')](_0x72a0('0x70'),_0x72a0('0x65'))['field'](_0x72a0('0x7e'),_0x72a0('0x7d'))[_0x72a0('0x6c')]('NOW()','createdAt')[_0x72a0('0x6c')](_0x72a0('0x6d'),_0x72a0('0x68'))[_0x72a0('0x72')](_0x72a0('0x73'))['where']('CampaignId\x20=\x20?',_0x344a69['params']['id'][_0x72a0('0x7b')]())['where'](_0x72a0('0x75'),_0x344a69['body']['state']['toString']())['where'](_0x72a0('0x77'))[_0x72a0('0x3e')](_0x72a0('0x78'),squel[_0x72a0('0x69')]()['field'](_0x72a0('0x6b'))[_0x72a0('0x72')]('cm_hopper')[_0x72a0('0x3e')](_0x72a0('0x7f'),_0x344a69['params']['id'][_0x72a0('0x7b')]()))[_0x72a0('0x3e')](_0x72a0('0x78'),squel[_0x72a0('0x69')]()['field']('calleridnum')[_0x72a0('0x72')](_0x72a0('0x73'))[_0x72a0('0x3e')](_0x72a0('0x7f'),_0x344a69[_0x72a0('0x48')]['id'][_0x72a0('0x7b')]())['where']('state\x20=\x204'))[_0x72a0('0x80')](_0x72a0('0x64')))['toString']();return db[_0x72a0('0x50')][_0x72a0('0x33')](_0x4f421f);}return[];})[_0x72a0('0x28')](respondWithResult(_0x179ca2,null))[_0x72a0('0x46')](handleError(_0x179ca2,null));};exports[_0x72a0('0x81')]=function(_0x167a80,_0x7533ea,_0x56bdf5){return db[_0x72a0('0x82')][_0x72a0('0x83')]({'where':{'VoiceQueueId':_0x167a80[_0x72a0('0x4c')]['VoiceQueueId'],'CampaignId':_0x167a80[_0x72a0('0x4c')][_0x72a0('0x7d')],'ContactId':_0x167a80[_0x72a0('0x4c')][_0x72a0('0x64')]}})[_0x72a0('0x28')](handleEntityNotFound(_0x7533ea,null))['then'](function(_0xc16765){if(_0xc16765){return _0xc16765;}return null;})[_0x72a0('0x28')](respondWithResult(_0x7533ea,null))[_0x72a0('0x46')](handleError(_0x7533ea,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 2b3426b..1a70684 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 _0x4021=['request-promise','path','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','calleridnum','uniqueid','lodash','util','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4021,0x1bb));var _0x1402=function(_0x38ed42,_0x3d9a37){_0x38ed42=_0x38ed42-0x0;var _0x474931=_0x4021[_0x38ed42];return _0x474931;};'use strict';var _=require(_0x1402('0x0'));var util=require(_0x1402('0x1'));var logger=require('../../config/logger')(_0x1402('0x2'));var moment=require(_0x1402('0x3'));var BPromise=require(_0x1402('0x4'));var rp=require(_0x1402('0x5'));var fs=require('fs');var path=require(_0x1402('0x6'));var rimraf=require('rimraf');var config=require(_0x1402('0x7'));var attributes=require(_0x1402('0x8'));module[_0x1402('0x9')]=function(_0x5bf910,_0x433b11){return _0x5bf910[_0x1402('0xa')](_0x1402('0xb'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x1402('0xc'),'fields':[_0x1402('0xc')]},{'name':'uniqueid','fields':[_0x1402('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdff8=['bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','CmHopperFinal','cm_hopper_final','uniqueid','util','../../config/logger','api','moment'];(function(_0x53ab54,_0x2d92d7){var _0x139eb6=function(_0x3fd337){while(--_0x3fd337){_0x53ab54['push'](_0x53ab54['shift']());}};_0x139eb6(++_0x2d92d7);}(_0xdff8,0x15a));var _0x8dff=function(_0x3eed3f,_0x5253b5){_0x3eed3f=_0x3eed3f-0x0;var _0xd68fd8=_0xdff8[_0x3eed3f];return _0xd68fd8;};'use strict';var _=require('lodash');var util=require(_0x8dff('0x0'));var logger=require(_0x8dff('0x1'))(_0x8dff('0x2'));var moment=require(_0x8dff('0x3'));var BPromise=require(_0x8dff('0x4'));var rp=require(_0x8dff('0x5'));var fs=require('fs');var path=require(_0x8dff('0x6'));var rimraf=require(_0x8dff('0x7'));var config=require(_0x8dff('0x8'));var attributes=require(_0x8dff('0x9'));module[_0x8dff('0xa')]=function(_0x1facae,_0xeac1a3){return _0x1facae['define'](_0x8dff('0xb'),attributes,{'tableName':_0x8dff('0xc'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':['calleridnum']},{'name':_0x8dff('0xd'),'fields':[_0x8dff('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 bc256a6..08e9587 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x3b3cc8,_0x1eb58c){var _0x3e690e=function(_0x5c42bf){while(--_0x5c42bf){_0x3b3cc8['push'](_0x3b3cc8['shift']());}};_0x3e690e(++_0x1eb58c);}(_0xb10b,0x12a));var _0xbb10=function(_0x40ab41,_0x5d535e){_0x40ab41=_0x40ab41-0x0;var _0x36962d=_0xb10b[_0x40ab41];return _0x36962d;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x263f5f,_0x29dd8e){var _0x2200d2=function(_0x235aa9){while(--_0x235aa9){_0x263f5f['push'](_0x263f5f['shift']());}};_0x2200d2(++_0x29dd8e);}(_0xb10b,0x12a));var _0xbb10=function(_0xd816e2,_0x5edac2){_0xd816e2=_0xd816e2-0x0;var _0x1f5924=_0xb10b[_0xd816e2];return _0x1f5924;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index db6c186..ddf434c 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 _0xb6f8=['update','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','/checkContactHopper','checkContactHopper','put'];(function(_0x31f0f4,_0x56eb1a){var _0x21f7d8=function(_0x437df6){while(--_0x437df6){_0x31f0f4['push'](_0x31f0f4['shift']());}};_0x21f7d8(++_0x56eb1a);}(_0xb6f8,0x9d));var _0x8b6f=function(_0x5391ef,_0x3c8788){_0x5391ef=_0x5391ef-0x0;var _0x136499=_0xb6f8[_0x5391ef];return _0x136499;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8b6f('0x0'));var timeout=require(_0x8b6f('0x1'));var express=require('express');var router=express[_0x8b6f('0x2')]();var fs_extra=require(_0x8b6f('0x3'));var auth=require(_0x8b6f('0x4'));var interaction=require(_0x8b6f('0x5'));var config=require(_0x8b6f('0x6'));var controller=require(_0x8b6f('0x7'));router[_0x8b6f('0x8')]('/',auth[_0x8b6f('0x9')](),controller[_0x8b6f('0xa')]);router['get'](_0x8b6f('0xb'),auth[_0x8b6f('0x9')](),controller[_0x8b6f('0xc')]);router[_0x8b6f('0x8')](_0x8b6f('0xd'),auth[_0x8b6f('0x9')](),controller[_0x8b6f('0xe')]);router[_0x8b6f('0x8')](_0x8b6f('0xf'),auth[_0x8b6f('0x9')](),controller[_0x8b6f('0x10')]);router[_0x8b6f('0x8')](_0x8b6f('0x11'),auth[_0x8b6f('0x9')](),controller['countContactsIvrCampaignHopperFinal']);router['post'](_0x8b6f('0x12'),auth['isAuthenticated'](),controller[_0x8b6f('0x13')]);router[_0x8b6f('0x14')](_0x8b6f('0x15'),auth[_0x8b6f('0x9')](),controller['moveContactsIvrCampaignHopperFinal']);router['post'](_0x8b6f('0x16'),auth[_0x8b6f('0x9')](),controller[_0x8b6f('0x17')]);router[_0x8b6f('0x18')](_0x8b6f('0xd'),auth[_0x8b6f('0x9')](),controller[_0x8b6f('0x19')]);module['exports']=router; \ No newline at end of file +var _0x60e0=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','/checkContactHopper','update','exports','multer','connect-timeout','Router','fs-extra'];(function(_0x4fdb3d,_0x43d139){var _0x57f4a3=function(_0xac666){while(--_0xac666){_0x4fdb3d['push'](_0x4fdb3d['shift']());}};_0x57f4a3(++_0x43d139);}(_0x60e0,0x176));var _0x060e=function(_0x327e56,_0x729ab2){_0x327e56=_0x327e56-0x0;var _0x2f8d39=_0x60e0[_0x327e56];return _0x2f8d39;};'use strict';var multer=require(_0x060e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x060e('0x1'));var express=require('express');var router=express[_0x060e('0x2')]();var fs_extra=require(_0x060e('0x3'));var auth=require(_0x060e('0x4'));var interaction=require(_0x060e('0x5'));var config=require(_0x060e('0x6'));var controller=require('./cmHopperFinal.controller');router[_0x060e('0x7')]('/',auth[_0x060e('0x8')](),controller[_0x060e('0x9')]);router['get']('/describe',auth[_0x060e('0x8')](),controller[_0x060e('0xa')]);router[_0x060e('0x7')](_0x060e('0xb'),auth[_0x060e('0x8')](),controller['show']);router['get']('/voice/queue/countAttributes/:id',auth[_0x060e('0x8')](),controller[_0x060e('0xc')]);router[_0x060e('0x7')]('/campaign/countAttributes/:id',auth[_0x060e('0x8')](),controller[_0x060e('0xd')]);router[_0x060e('0xe')](_0x060e('0xf'),auth['isAuthenticated'](),controller[_0x060e('0x10')]);router['post'](_0x060e('0x11'),auth[_0x060e('0x8')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x060e('0xe')](_0x060e('0x12'),auth[_0x060e('0x8')](),controller['checkContactHopper']);router['put'](_0x060e('0xb'),auth[_0x060e('0x8')](),controller[_0x060e('0x13')]);module[_0x060e('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 a9f4b81..c6bbb20 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 _0x49bf=['exports','INTEGER','STRING','DATE','BOOLEAN','sequelize'];(function(_0x4d6ac0,_0x201628){var _0x5296c4=function(_0x3d0b3d){while(--_0x3d0b3d){_0x4d6ac0['push'](_0x4d6ac0['shift']());}};_0x5296c4(++_0x201628);}(_0x49bf,0x16d));var _0xf49b=function(_0x1b236b,_0x2b7b59){_0x1b236b=_0x1b236b-0x0;var _0x48fb77=_0x49bf[_0x1b236b];return _0x48fb77;};'use strict';var Sequelize=require(_0xf49b('0x0'));module[_0xf49b('0x1')]={'state':{'type':Sequelize[_0xf49b('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xf49b('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xf49b('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xf49b('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf49b('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xf49b('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xf49b('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xf49b('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xf49b('0x3')]},'starttime':{'type':Sequelize[_0xf49b('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xf49b('0x4')]},'droptime':{'type':Sequelize[_0xf49b('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xf49b('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xf49b('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xf49b('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xf49b('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xf49b('0x3')]},'campaigntype':{'type':Sequelize[_0xf49b('0x3')]},'membername':{'type':Sequelize[_0xf49b('0x3')]},'reason':{'type':Sequelize[_0xf49b('0x3')]},'amd':{'type':Sequelize[_0xf49b('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xf49b('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xf49b('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xf49b('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xf49b('0x4')]},'recallme':{'type':Sequelize[_0xf49b('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0xf49b('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xf49b('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xf49b('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x7b55=['INTEGER','STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x45bf86,_0x75586e){var _0x1f02b7=function(_0x1ea8a3){while(--_0x1ea8a3){_0x45bf86['push'](_0x45bf86['shift']());}};_0x1f02b7(++_0x75586e);}(_0x7b55,0x16c));var _0x57b5=function(_0x556429,_0x47ae3b){_0x556429=_0x556429-0x0;var _0xba7b3c=_0x7b55[_0x556429];return _0xba7b3c;};'use strict';var Sequelize=require(_0x57b5('0x0'));module[_0x57b5('0x1')]={'state':{'type':Sequelize[_0x57b5('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x57b5('0x3')]},'scheduledat':{'type':Sequelize[_0x57b5('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x57b5('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x57b5('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x57b5('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x57b5('0x3')]},'originatecalleridname':{'type':Sequelize[_0x57b5('0x3')]},'calleridnum':{'type':Sequelize[_0x57b5('0x3')]},'calleridname':{'type':Sequelize[_0x57b5('0x3')]},'starttime':{'type':Sequelize[_0x57b5('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x57b5('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x57b5('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x57b5('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x57b5('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x57b5('0x3')]},'campaign':{'type':Sequelize[_0x57b5('0x3')]},'campaigntype':{'type':Sequelize[_0x57b5('0x3')]},'membername':{'type':Sequelize[_0x57b5('0x3')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x57b5('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x57b5('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x57b5('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x57b5('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x57b5('0x4')]},'recallme':{'type':Sequelize[_0x57b5('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x57b5('0x4')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x57b5('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x57b5('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x57b5('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x57b5('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 95003fd..adb0ef4 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 _0x5a69=['options','includeAll','include','catch','params','rawAttributes','find','create','body','describe','uniqueid','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','status','end','offset','undefined','limit','count','set','json','save','update','then','sendStatus','error','stack','name','send','index','map','CmHopperHistory','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge'];(function(_0x497025,_0x16baa8){var _0x19a6db=function(_0x1aa4c9){while(--_0x1aa4c9){_0x497025['push'](_0x497025['shift']());}};_0x19a6db(++_0x16baa8);}(_0x5a69,0x9f));var _0x95a6=function(_0x4f2ab9,_0xacf272){_0x4f2ab9=_0x4f2ab9-0x0;var _0x2f22e1=_0x5a69[_0x4f2ab9];return _0x2f22e1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x95a6('0x0'));var jsonpatch=require(_0x95a6('0x1'));var rp=require(_0x95a6('0x2'));var moment=require(_0x95a6('0x3'));var BPromise=require(_0x95a6('0x4'));var Mustache=require(_0x95a6('0x5'));var util=require(_0x95a6('0x6'));var path=require(_0x95a6('0x7'));var sox=require(_0x95a6('0x8'));var csv=require(_0x95a6('0x9'));var ejs=require(_0x95a6('0xa'));var fs=require('fs');var fs_extra=require(_0x95a6('0xb'));var _=require('lodash');var squel=require(_0x95a6('0xc'));var crypto=require(_0x95a6('0xd'));var jsforce=require(_0x95a6('0xe'));var deskjs=require(_0x95a6('0xf'));var toCsv=require(_0x95a6('0x9'));var querystring=require(_0x95a6('0x10'));var Papa=require(_0x95a6('0x11'));var Redis=require(_0x95a6('0x12'));var authService=require(_0x95a6('0x13'));var qs=require(_0x95a6('0x14'));var as=require(_0x95a6('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x95a6('0x16'));var utils=require('../../config/utils');var config=require(_0x95a6('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x263dc6,_0x25d833){_0x25d833=_0x25d833||0xcc;return function(_0x37c4bf){if(_0x37c4bf){return _0x263dc6['sendStatus'](_0x25d833);}return _0x263dc6[_0x95a6('0x18')](_0x25d833)[_0x95a6('0x19')]();};}function respondWithResult(_0x588930,_0x4a6905){_0x4a6905=_0x4a6905||0xc8;return function(_0x3fc2e7){if(_0x3fc2e7){return _0x588930[_0x95a6('0x18')](_0x4a6905)['json'](_0x3fc2e7);}};}function respondWithFilteredResult(_0x5c5c34,_0x577c23){return function(_0x449c8b){if(_0x449c8b){var _0x59e466=typeof _0x577c23[_0x95a6('0x1a')]===_0x95a6('0x1b')&&typeof _0x577c23[_0x95a6('0x1c')]===_0x95a6('0x1b');var _0x312c73=_0x449c8b[_0x95a6('0x1d')];var _0x36c104=_0x59e466?0x0:_0x577c23[_0x95a6('0x1a')];var _0x218687=_0x59e466?_0x449c8b[_0x95a6('0x1d')]:_0x577c23[_0x95a6('0x1a')]+_0x577c23[_0x95a6('0x1c')];var _0x4e1415;if(_0x218687>=_0x312c73){_0x218687=_0x312c73;_0x4e1415=0xc8;}else{_0x4e1415=0xce;}_0x5c5c34[_0x95a6('0x18')](_0x4e1415);return _0x5c5c34[_0x95a6('0x1e')]('Content-Range',_0x36c104+'-'+_0x218687+'/'+_0x312c73)[_0x95a6('0x1f')](_0x449c8b);}return null;};}function patchUpdates(_0x411c1c){return function(_0x115887){try{jsonpatch['apply'](_0x115887,_0x411c1c,!![]);}catch(_0x5b1ffb){return BPromise['reject'](_0x5b1ffb);}return _0x115887[_0x95a6('0x20')]();};}function saveUpdates(_0x381c97,_0x41f9e2){return function(_0x421304){if(_0x421304){return _0x421304[_0x95a6('0x21')](_0x381c97)['then'](function(_0x176a9b){return _0x176a9b;});}return null;};}function removeEntity(_0x456dd2,_0x387ac6){return function(_0x20f6fb){if(_0x20f6fb){return _0x20f6fb['destroy']()[_0x95a6('0x22')](function(){_0x456dd2['status'](0xcc)[_0x95a6('0x19')]();});}};}function handleEntityNotFound(_0x8dbe7f,_0x4bfa7e){return function(_0x34bb1e){if(!_0x34bb1e){_0x8dbe7f[_0x95a6('0x23')](0x194);}return _0x34bb1e;};}function handleError(_0x1a7a0b,_0x5637ca){_0x5637ca=_0x5637ca||0x1f4;return function(_0x290d91){logger[_0x95a6('0x24')](_0x290d91[_0x95a6('0x25')]);if(_0x290d91[_0x95a6('0x26')]){delete _0x290d91[_0x95a6('0x26')];}_0x1a7a0b[_0x95a6('0x18')](_0x5637ca)[_0x95a6('0x27')](_0x290d91);};}exports[_0x95a6('0x28')]=function(_0x1c3f99,_0x900c17){var _0x36738e={},_0x4ce5cd={},_0x4c22d8={'count':0x0,'rows':[]};var _0x2ed3d3=_[_0x95a6('0x29')](db[_0x95a6('0x2a')]['rawAttributes'],function(_0x471854){return{'name':_0x471854[_0x95a6('0x2b')],'type':_0x471854[_0x95a6('0x2c')][_0x95a6('0x2d')]};});_0x4ce5cd['model']=_['map'](_0x2ed3d3,_0x95a6('0x26'));_0x4ce5cd[_0x95a6('0x2e')]=_[_0x95a6('0x2f')](_0x1c3f99[_0x95a6('0x2e')]);_0x4ce5cd[_0x95a6('0x30')]=_[_0x95a6('0x31')](_0x4ce5cd[_0x95a6('0x32')],_0x4ce5cd[_0x95a6('0x2e')]);_0x36738e[_0x95a6('0x33')]=_[_0x95a6('0x31')](_0x4ce5cd[_0x95a6('0x32')],qs[_0x95a6('0x34')](_0x1c3f99[_0x95a6('0x2e')][_0x95a6('0x34')]));_0x36738e['attributes']=_0x36738e[_0x95a6('0x33')][_0x95a6('0x35')]?_0x36738e[_0x95a6('0x33')]:_0x4ce5cd[_0x95a6('0x32')];if(!_0x1c3f99[_0x95a6('0x2e')][_0x95a6('0x36')](_0x95a6('0x37'))){_0x36738e[_0x95a6('0x1c')]=qs[_0x95a6('0x1c')](_0x1c3f99[_0x95a6('0x2e')][_0x95a6('0x1c')]);_0x36738e[_0x95a6('0x1a')]=qs[_0x95a6('0x1a')](_0x1c3f99[_0x95a6('0x2e')][_0x95a6('0x1a')]);}_0x36738e[_0x95a6('0x38')]=qs[_0x95a6('0x39')](_0x1c3f99[_0x95a6('0x2e')][_0x95a6('0x39')]);_0x36738e[_0x95a6('0x3a')]=qs[_0x95a6('0x30')](_[_0x95a6('0x3b')](_0x1c3f99[_0x95a6('0x2e')],_0x4ce5cd[_0x95a6('0x30')]),_0x2ed3d3);if(_0x1c3f99['query'][_0x95a6('0x3c')]){_0x36738e[_0x95a6('0x3a')]=_['merge'](_0x36738e[_0x95a6('0x3a')],{'$or':_['map'](_0x2ed3d3,function(_0x1b1f41){if(_0x1b1f41['type']!==_0x95a6('0x3d')){var _0x16200a={};_0x16200a[_0x1b1f41[_0x95a6('0x26')]]={'$like':'%'+_0x1c3f99[_0x95a6('0x2e')][_0x95a6('0x3c')]+'%'};return _0x16200a;}})});}_0x36738e=_[_0x95a6('0x3e')]({},_0x36738e,_0x1c3f99[_0x95a6('0x3f')]);var _0x5ce16a={'where':_0x36738e['where']};return db[_0x95a6('0x2a')][_0x95a6('0x1d')](_0x5ce16a)[_0x95a6('0x22')](function(_0x4d37f5){_0x4c22d8[_0x95a6('0x1d')]=_0x4d37f5;if(_0x1c3f99[_0x95a6('0x2e')][_0x95a6('0x40')]){_0x36738e[_0x95a6('0x41')]=[{'all':!![]}];}return db[_0x95a6('0x2a')]['findAll'](_0x36738e);})[_0x95a6('0x22')](function(_0x38dacd){_0x4c22d8['rows']=_0x38dacd;return _0x4c22d8;})['then'](respondWithFilteredResult(_0x900c17,_0x36738e))[_0x95a6('0x42')](handleError(_0x900c17,null));};exports['show']=function(_0x1ef24e,_0xcf3212){var _0x46c53e={'raw':!![],'where':{'id':_0x1ef24e[_0x95a6('0x43')]['id']}},_0xfd5522={};_0xfd5522[_0x95a6('0x32')]=_[_0x95a6('0x2f')](db['CmHopperHistory'][_0x95a6('0x44')]);_0xfd5522[_0x95a6('0x2e')]=_[_0x95a6('0x2f')](_0x1ef24e['query']);_0xfd5522[_0x95a6('0x30')]=_['intersection'](_0xfd5522[_0x95a6('0x32')],_0xfd5522[_0x95a6('0x2e')]);_0x46c53e[_0x95a6('0x33')]=_[_0x95a6('0x31')](_0xfd5522[_0x95a6('0x32')],qs[_0x95a6('0x34')](_0x1ef24e['query'][_0x95a6('0x34')]));_0x46c53e[_0x95a6('0x33')]=_0x46c53e[_0x95a6('0x33')][_0x95a6('0x35')]?_0x46c53e[_0x95a6('0x33')]:_0xfd5522[_0x95a6('0x32')];if(_0x1ef24e[_0x95a6('0x2e')][_0x95a6('0x40')]){_0x46c53e[_0x95a6('0x41')]=[{'all':!![]}];}_0x46c53e=_[_0x95a6('0x3e')]({},_0x46c53e,_0x1ef24e[_0x95a6('0x3f')]);return db['CmHopperHistory'][_0x95a6('0x45')](_0x46c53e)[_0x95a6('0x22')](handleEntityNotFound(_0xcf3212,null))['then'](respondWithResult(_0xcf3212,null))[_0x95a6('0x42')](handleError(_0xcf3212,null));};exports[_0x95a6('0x46')]=function(_0x9f0432,_0x56290e){return db[_0x95a6('0x2a')]['create'](_0x9f0432[_0x95a6('0x47')],{})[_0x95a6('0x22')](respondWithResult(_0x56290e,0xc9))[_0x95a6('0x42')](handleError(_0x56290e,null));};exports['describe']=function(_0x2a5510,_0x945478){return db['CmHopperHistory'][_0x95a6('0x48')]()[_0x95a6('0x22')](respondWithResult(_0x945478,null))[_0x95a6('0x42')](handleError(_0x945478,null));};exports['update']=function(_0x10feef,_0x1fd2b2){if(_0x10feef[_0x95a6('0x47')][_0x95a6('0x49')]){delete _0x10feef[_0x95a6('0x47')][_0x95a6('0x49')];}return db[_0x95a6('0x2a')]['find']({'where':{'uniqueid':_0x10feef['params']['id']}})[_0x95a6('0x22')](handleEntityNotFound(_0x1fd2b2,null))[_0x95a6('0x22')](saveUpdates(_0x10feef[_0x95a6('0x47')],null))[_0x95a6('0x22')](respondWithResult(_0x1fd2b2,null))[_0x95a6('0x42')](handleError(_0x1fd2b2,null));}; \ No newline at end of file +var _0x0b13=['send','index','map','CmHopperHistory','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','nolimit','sort','where','type','options','count','include','findAll','catch','params','includeAll','find','create','body','describe','update','uniqueid','eml-format','rimraf','zip-dir','request-promise','bluebird','util','sox','fs-extra','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','set','Content-Range','apply','reject','save','then','destroy','error','stack','name'];(function(_0x56c4de,_0xf1c874){var _0xd799af=function(_0x30fb9){while(--_0x30fb9){_0x56c4de['push'](_0x56c4de['shift']());}};_0xd799af(++_0xf1c874);}(_0x0b13,0xa3));var _0x30b1=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x0b13[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0x30b1('0x0'));var rimraf=require(_0x30b1('0x1'));var zipdir=require(_0x30b1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x30b1('0x3'));var moment=require('moment');var BPromise=require(_0x30b1('0x4'));var Mustache=require('mustache');var util=require(_0x30b1('0x5'));var path=require('path');var sox=require(_0x30b1('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x30b1('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x30b1('0x8'));var querystring=require(_0x30b1('0x9'));var Papa=require(_0x30b1('0xa'));var Redis=require('ioredis');var authService=require(_0x30b1('0xb'));var qs=require(_0x30b1('0xc'));var as=require(_0x30b1('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x30b1('0xe'));var utils=require(_0x30b1('0xf'));var config=require(_0x30b1('0x10'));var licenseUtil=require(_0x30b1('0x11'));var db=require(_0x30b1('0x12'))['db'];function respondWithStatusCode(_0x7bf625,_0x21afe5){_0x21afe5=_0x21afe5||0xcc;return function(_0x3bfbb2){if(_0x3bfbb2){return _0x7bf625[_0x30b1('0x13')](_0x21afe5);}return _0x7bf625['status'](_0x21afe5)['end']();};}function respondWithResult(_0x1627f7,_0x257d39){_0x257d39=_0x257d39||0xc8;return function(_0x45ede6){if(_0x45ede6){return _0x1627f7[_0x30b1('0x14')](_0x257d39)[_0x30b1('0x15')](_0x45ede6);}};}function respondWithFilteredResult(_0x431977,_0x733b33){return function(_0x256a06){if(_0x256a06){var _0x3a6f67=typeof _0x733b33[_0x30b1('0x16')]==='undefined'&&typeof _0x733b33[_0x30b1('0x17')]===_0x30b1('0x18');var _0x9862=_0x256a06['count'];var _0x37d86f=_0x3a6f67?0x0:_0x733b33[_0x30b1('0x16')];var _0x3f7e66=_0x3a6f67?_0x256a06['count']:_0x733b33[_0x30b1('0x16')]+_0x733b33[_0x30b1('0x17')];var _0x34012e;if(_0x3f7e66>=_0x9862){_0x3f7e66=_0x9862;_0x34012e=0xc8;}else{_0x34012e=0xce;}_0x431977[_0x30b1('0x14')](_0x34012e);return _0x431977[_0x30b1('0x19')](_0x30b1('0x1a'),_0x37d86f+'-'+_0x3f7e66+'/'+_0x9862)[_0x30b1('0x15')](_0x256a06);}return null;};}function patchUpdates(_0x5ef1e0){return function(_0x588ec4){try{jsonpatch[_0x30b1('0x1b')](_0x588ec4,_0x5ef1e0,!![]);}catch(_0x26436c){return BPromise[_0x30b1('0x1c')](_0x26436c);}return _0x588ec4[_0x30b1('0x1d')]();};}function saveUpdates(_0x3b3138,_0x1abb42){return function(_0x5d4e8b){if(_0x5d4e8b){return _0x5d4e8b['update'](_0x3b3138)[_0x30b1('0x1e')](function(_0x2d60bb){return _0x2d60bb;});}return null;};}function removeEntity(_0x3da23c,_0x3a66d6){return function(_0x11645c){if(_0x11645c){return _0x11645c[_0x30b1('0x1f')]()[_0x30b1('0x1e')](function(){_0x3da23c[_0x30b1('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d1bda,_0x3ed064){return function(_0x37039e){if(!_0x37039e){_0x1d1bda[_0x30b1('0x13')](0x194);}return _0x37039e;};}function handleError(_0x385f51,_0x3d5d74){_0x3d5d74=_0x3d5d74||0x1f4;return function(_0x4c563f){logger[_0x30b1('0x20')](_0x4c563f[_0x30b1('0x21')]);if(_0x4c563f[_0x30b1('0x22')]){delete _0x4c563f['name'];}_0x385f51[_0x30b1('0x14')](_0x3d5d74)[_0x30b1('0x23')](_0x4c563f);};}exports[_0x30b1('0x24')]=function(_0x41038f,_0x2f4898){var _0x3594a8={},_0x53380b={},_0x318654={'count':0x0,'rows':[]};var _0x39a5b2=_[_0x30b1('0x25')](db[_0x30b1('0x26')][_0x30b1('0x27')],function(_0x524792){return{'name':_0x524792[_0x30b1('0x28')],'type':_0x524792['type'][_0x30b1('0x29')]};});_0x53380b[_0x30b1('0x2a')]=_[_0x30b1('0x25')](_0x39a5b2,_0x30b1('0x22'));_0x53380b['query']=_[_0x30b1('0x2b')](_0x41038f[_0x30b1('0x2c')]);_0x53380b[_0x30b1('0x2d')]=_[_0x30b1('0x2e')](_0x53380b[_0x30b1('0x2a')],_0x53380b[_0x30b1('0x2c')]);_0x3594a8[_0x30b1('0x2f')]=_[_0x30b1('0x2e')](_0x53380b['model'],qs[_0x30b1('0x30')](_0x41038f[_0x30b1('0x2c')][_0x30b1('0x30')]));_0x3594a8[_0x30b1('0x2f')]=_0x3594a8['attributes']['length']?_0x3594a8['attributes']:_0x53380b[_0x30b1('0x2a')];if(!_0x41038f[_0x30b1('0x2c')]['hasOwnProperty'](_0x30b1('0x31'))){_0x3594a8[_0x30b1('0x17')]=qs[_0x30b1('0x17')](_0x41038f['query'][_0x30b1('0x17')]);_0x3594a8[_0x30b1('0x16')]=qs[_0x30b1('0x16')](_0x41038f['query']['offset']);}_0x3594a8['order']=qs[_0x30b1('0x32')](_0x41038f[_0x30b1('0x2c')][_0x30b1('0x32')]);_0x3594a8[_0x30b1('0x33')]=qs[_0x30b1('0x2d')](_['pick'](_0x41038f[_0x30b1('0x2c')],_0x53380b[_0x30b1('0x2d')]),_0x39a5b2);if(_0x41038f['query']['filter']){_0x3594a8[_0x30b1('0x33')]=_['merge'](_0x3594a8[_0x30b1('0x33')],{'$or':_['map'](_0x39a5b2,function(_0x122361){if(_0x122361[_0x30b1('0x34')]!=='VIRTUAL'){var _0x3bdf5b={};_0x3bdf5b[_0x122361[_0x30b1('0x22')]]={'$like':'%'+_0x41038f[_0x30b1('0x2c')]['filter']+'%'};return _0x3bdf5b;}})});}_0x3594a8=_['merge']({},_0x3594a8,_0x41038f[_0x30b1('0x35')]);var _0x3be7a4={'where':_0x3594a8[_0x30b1('0x33')]};return db[_0x30b1('0x26')]['count'](_0x3be7a4)[_0x30b1('0x1e')](function(_0x5d6146){_0x318654[_0x30b1('0x36')]=_0x5d6146;if(_0x41038f[_0x30b1('0x2c')]['includeAll']){_0x3594a8[_0x30b1('0x37')]=[{'all':!![]}];}return db[_0x30b1('0x26')][_0x30b1('0x38')](_0x3594a8);})['then'](function(_0x58e87d){_0x318654['rows']=_0x58e87d;return _0x318654;})[_0x30b1('0x1e')](respondWithFilteredResult(_0x2f4898,_0x3594a8))[_0x30b1('0x39')](handleError(_0x2f4898,null));};exports['show']=function(_0x4b2c17,_0x189546){var _0x12f1b9={'raw':!![],'where':{'id':_0x4b2c17[_0x30b1('0x3a')]['id']}},_0x380b56={};_0x380b56['model']=_[_0x30b1('0x2b')](db['CmHopperHistory']['rawAttributes']);_0x380b56['query']=_[_0x30b1('0x2b')](_0x4b2c17[_0x30b1('0x2c')]);_0x380b56[_0x30b1('0x2d')]=_[_0x30b1('0x2e')](_0x380b56[_0x30b1('0x2a')],_0x380b56[_0x30b1('0x2c')]);_0x12f1b9[_0x30b1('0x2f')]=_[_0x30b1('0x2e')](_0x380b56[_0x30b1('0x2a')],qs[_0x30b1('0x30')](_0x4b2c17[_0x30b1('0x2c')][_0x30b1('0x30')]));_0x12f1b9[_0x30b1('0x2f')]=_0x12f1b9['attributes']['length']?_0x12f1b9['attributes']:_0x380b56[_0x30b1('0x2a')];if(_0x4b2c17['query'][_0x30b1('0x3b')]){_0x12f1b9['include']=[{'all':!![]}];}_0x12f1b9=_['merge']({},_0x12f1b9,_0x4b2c17[_0x30b1('0x35')]);return db[_0x30b1('0x26')][_0x30b1('0x3c')](_0x12f1b9)[_0x30b1('0x1e')](handleEntityNotFound(_0x189546,null))[_0x30b1('0x1e')](respondWithResult(_0x189546,null))['catch'](handleError(_0x189546,null));};exports[_0x30b1('0x3d')]=function(_0x455ca8,_0x23f8d2){return db['CmHopperHistory'][_0x30b1('0x3d')](_0x455ca8[_0x30b1('0x3e')],{})[_0x30b1('0x1e')](respondWithResult(_0x23f8d2,0xc9))['catch'](handleError(_0x23f8d2,null));};exports[_0x30b1('0x3f')]=function(_0x631492,_0x543af6){return db['CmHopperHistory'][_0x30b1('0x3f')]()['then'](respondWithResult(_0x543af6,null))['catch'](handleError(_0x543af6,null));};exports[_0x30b1('0x40')]=function(_0x138738,_0x66aff){if(_0x138738[_0x30b1('0x3e')]['uniqueid']){delete _0x138738[_0x30b1('0x3e')][_0x30b1('0x41')];}return db['CmHopperHistory'][_0x30b1('0x3c')]({'where':{'uniqueid':_0x138738[_0x30b1('0x3a')]['id']}})['then'](handleEntityNotFound(_0x66aff,null))['then'](saveUpdates(_0x138738[_0x30b1('0x3e')],null))[_0x30b1('0x1e')](respondWithResult(_0x66aff,null))[_0x30b1('0x39')](handleError(_0x66aff,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index d532fb5..d0b24d2 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 _0xf03a=['util','../../config/logger','api','moment','request-promise','path','../../config/environment','./cmHopperHistory.attributes','exports','define','cm_hopper_history','endtime','uniqueid'];(function(_0x2f40b0,_0x40122e){var _0x5bc71b=function(_0xcb1864){while(--_0xcb1864){_0x2f40b0['push'](_0x2f40b0['shift']());}};_0x5bc71b(++_0x40122e);}(_0xf03a,0x1a0));var _0xaf03=function(_0x161c66,_0x565d77){_0x161c66=_0x161c66-0x0;var _0x18dcce=_0xf03a[_0x161c66];return _0x18dcce;};'use strict';var _=require('lodash');var util=require(_0xaf03('0x0'));var logger=require(_0xaf03('0x1'))(_0xaf03('0x2'));var moment=require(_0xaf03('0x3'));var BPromise=require('bluebird');var rp=require(_0xaf03('0x4'));var fs=require('fs');var path=require(_0xaf03('0x5'));var rimraf=require('rimraf');var config=require(_0xaf03('0x6'));var attributes=require(_0xaf03('0x7'));module[_0xaf03('0x8')]=function(_0x2e05f7,_0x58a29b){return _0x2e05f7[_0xaf03('0x9')]('CmHopperHistory',attributes,{'tableName':_0xaf03('0xa'),'paranoid':![],'indexes':[{'name':_0xaf03('0xb'),'fields':[_0xaf03('0xb')]},{'name':_0xaf03('0xc'),'fields':[_0xaf03('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xda2d=['api','moment','bluebird','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','util','../../config/logger'];(function(_0x505e13,_0x5d5991){var _0x5ed753=function(_0x15b3d9){while(--_0x15b3d9){_0x505e13['push'](_0x505e13['shift']());}};_0x5ed753(++_0x5d5991);}(_0xda2d,0x102));var _0xdda2=function(_0xa16c4,_0x4e4b81){_0xa16c4=_0xa16c4-0x0;var _0x36d54a=_0xda2d[_0xa16c4];return _0x36d54a;};'use strict';var _=require('lodash');var util=require(_0xdda2('0x0'));var logger=require(_0xdda2('0x1'))(_0xdda2('0x2'));var moment=require(_0xdda2('0x3'));var BPromise=require(_0xdda2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdda2('0x5'));var attributes=require(_0xdda2('0x6'));module[_0xdda2('0x7')]=function(_0x39f6c9,_0xc256bc){return _0x39f6c9[_0xdda2('0x8')](_0xdda2('0x9'),attributes,{'tableName':_0xdda2('0xa'),'paranoid':![],'indexes':[{'name':_0xdda2('0xb'),'fields':[_0xdda2('0xb')]},{'name':'uniqueid','fields':[_0xdda2('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 7d2a9cf..a2443dc 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 _0xcdc2=['`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','GetCampaignHopperHistory','CmHopperHistory','name','col','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','CmHopperHistory,\x20%s,\x20%s','message','catch','CreateCmHopperHistory','create','body','options','findAll','where','COUNT','predictiveIntervalTotalCalls','sequelize','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','AvgHandleTime','GetVoiceQueueHopperHistory','raw','campaign'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xcdc2,0x13d));var _0x2cdc=function(_0x5cbb34,_0x363478){_0x5cbb34=_0x5cbb34-0x0;var _0x2ea818=_0xcdc2[_0x5cbb34];return _0x2ea818;};'use strict';var _=require(_0x2cdc('0x0'));var util=require(_0x2cdc('0x1'));var moment=require(_0x2cdc('0x2'));var BPromise=require(_0x2cdc('0x3'));var rs=require(_0x2cdc('0x4'));var fs=require('fs');var Redis=require(_0x2cdc('0x5'));var db=require(_0x2cdc('0x6'))['db'];var utils=require(_0x2cdc('0x7'));var logger=require('../../config/logger')(_0x2cdc('0x8'));var config=require(_0x2cdc('0x9'));var jayson=require(_0x2cdc('0xa'));var client=jayson[_0x2cdc('0xb')][_0x2cdc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xb2bdfd,_0x5e438b,_0x492329){return new BPromise(function(_0xe2c158,_0x3e5b2a){return client[_0x2cdc('0xd')](_0xb2bdfd,_0x492329)[_0x2cdc('0xe')](function(_0x5e7b2a){logger[_0x2cdc('0xf')]('CmHopperHistory,\x20%s,\x20%s',_0x5e438b,'request\x20sent');logger[_0x2cdc('0x10')](_0x2cdc('0x11'),_0x5e438b,_0x2cdc('0x12'),JSON[_0x2cdc('0x13')](_0x5e7b2a));if(_0x5e7b2a['error']){if(_0x5e7b2a[_0x2cdc('0x14')][_0x2cdc('0x15')]===0x1f4){logger['error'](_0x2cdc('0x16'),_0x5e438b,_0x5e7b2a[_0x2cdc('0x14')][_0x2cdc('0x17')]);return _0x3e5b2a(_0x5e7b2a[_0x2cdc('0x14')][_0x2cdc('0x17')]);}logger[_0x2cdc('0x14')](_0x2cdc('0x16'),_0x5e438b,_0x5e7b2a[_0x2cdc('0x14')][_0x2cdc('0x17')]);return _0xe2c158(_0x5e7b2a['error']['message']);}else{logger[_0x2cdc('0xf')](_0x2cdc('0x16'),_0x5e438b,_0x2cdc('0x12'));_0xe2c158(_0x5e7b2a['result'][_0x2cdc('0x17')]);}})[_0x2cdc('0x18')](function(_0x5697df){logger[_0x2cdc('0x14')](_0x2cdc('0x16'),_0x5e438b,_0x5697df);_0x3e5b2a(_0x5697df);});});}exports[_0x2cdc('0x19')]=function(_0x576a65){var _0x4acc6b=this;return new Promise(function(_0x47b6dd,_0x3ec7c7){return db['CmHopperHistory'][_0x2cdc('0x1a')](_0x576a65[_0x2cdc('0x1b')],{'raw':_0x576a65['options']?_0x576a65[_0x2cdc('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x2cdc('0xe')](function(_0x315dba){logger[_0x2cdc('0xf')]('CreateCmHopperHistory',_0x576a65);logger[_0x2cdc('0x10')](_0x2cdc('0x19'),_0x576a65,JSON[_0x2cdc('0x13')](_0x315dba));_0x47b6dd(_0x315dba);})[_0x2cdc('0x18')](function(_0x5ec22c){logger[_0x2cdc('0x14')](_0x2cdc('0x19'),_0x5ec22c[_0x2cdc('0x17')],_0x576a65);_0x3ec7c7(_0x4acc6b[_0x2cdc('0x14')](0x1f4,_0x5ec22c[_0x2cdc('0x17')]));});});};exports['AvgHandleTime']=function(_0x2bb3b7){var _0x4ba120=this;return new Promise(function(_0x25ecc3,_0x37cc8f){return db['CmHopperHistory'][_0x2cdc('0x1d')]({'raw':_0x2bb3b7[_0x2cdc('0x1c')]?_0x2bb3b7[_0x2cdc('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x2bb3b7[_0x2cdc('0x1c')]?_0x2bb3b7[_0x2cdc('0x1c')][_0x2cdc('0x1e')]||null:null,'attributes':[[db['sequelize']['fn'](_0x2cdc('0x1f'),db['sequelize']['col']('id')),_0x2cdc('0x20')],[db[_0x2cdc('0x21')]['fn']('COUNT',db[_0x2cdc('0x21')]['fn']('IF',db['sequelize'][_0x2cdc('0x22')](_0x2cdc('0x23')))),_0x2cdc('0x24')],[db[_0x2cdc('0x21')]['fn'](_0x2cdc('0x1f'),db['sequelize']['fn']('IF',db[_0x2cdc('0x21')][_0x2cdc('0x22')](_0x2cdc('0x25')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x2cdc('0x21')]['fn'](_0x2cdc('0x1f'),db[_0x2cdc('0x21')]['fn']('IF',db[_0x2cdc('0x21')][_0x2cdc('0x22')](_0x2cdc('0x26')))),_0x2cdc('0x27')],[db[_0x2cdc('0x21')]['fn'](_0x2cdc('0x28'),db[_0x2cdc('0x21')]['fn']('IF',db[_0x2cdc('0x21')][_0x2cdc('0x22')](_0x2cdc('0x29')))),_0x2cdc('0x2a')],[db[_0x2cdc('0x21')]['fn'](_0x2cdc('0x28'),db['sequelize']['fn']('IF',db['sequelize'][_0x2cdc('0x22')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x2cdc('0x2b')]]})['then'](function(_0x13a18b){logger['info']('AvgHandleTime',_0x2bb3b7);logger[_0x2cdc('0x10')](_0x2cdc('0x2c'),_0x2bb3b7,JSON['stringify'](_0x13a18b));_0x25ecc3(_0x13a18b);})[_0x2cdc('0x18')](function(_0x112b7d){logger[_0x2cdc('0x14')](_0x2cdc('0x2c'),_0x112b7d[_0x2cdc('0x17')],_0x2bb3b7);_0x37cc8f(_0x4ba120['error'](0x1f4,_0x112b7d[_0x2cdc('0x17')]));});});};exports[_0x2cdc('0x2d')]=function(_0x33d508){var _0x5efcb2=this;return new Promise(function(_0x21add5,_0x3f80f6){return db['CmHopperHistory'][_0x2cdc('0x1d')]({'raw':_0x33d508[_0x2cdc('0x1c')]?_0x33d508[_0x2cdc('0x1c')][_0x2cdc('0x2e')]===undefined?!![]:![]:!![],'where':_0x33d508['options']?_0x33d508[_0x2cdc('0x1c')]['where']||null:null,'attributes':[[_0x2cdc('0x2f'),'name'],[db['sequelize']['fn'](_0x2cdc('0x1f'),db[_0x2cdc('0x21')]['fn']('IF',db[_0x2cdc('0x21')][_0x2cdc('0x22')](_0x2cdc('0x30')))),_0x2cdc('0x31')],[db[_0x2cdc('0x21')]['fn'](_0x2cdc('0x1f'),db[_0x2cdc('0x21')]['fn']('IF',db[_0x2cdc('0x21')]['literal'](_0x2cdc('0x32')))),_0x2cdc('0x33')],[db['sequelize']['fn'](_0x2cdc('0x1f'),db[_0x2cdc('0x21')]['fn']('IF',db[_0x2cdc('0x21')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x2cdc('0x34')],[db[_0x2cdc('0x21')]['fn'](_0x2cdc('0x1f'),db[_0x2cdc('0x21')]['fn']('IF',db['sequelize']['literal'](_0x2cdc('0x35')))),_0x2cdc('0x36')],[db[_0x2cdc('0x21')]['fn'](_0x2cdc('0x1f'),db[_0x2cdc('0x21')]['fn']('IF',db[_0x2cdc('0x21')][_0x2cdc('0x22')]('`state`\x20=\x208,\x201,\x20null'))),_0x2cdc('0x37')],[db['sequelize']['fn'](_0x2cdc('0x1f'),db['sequelize']['fn']('IF',db[_0x2cdc('0x21')]['literal'](_0x2cdc('0x38')))),_0x2cdc('0x39')],[db[_0x2cdc('0x21')]['fn'](_0x2cdc('0x1f'),db['sequelize']['fn']('IF',db['sequelize'][_0x2cdc('0x22')]('`state`\x20=\x2011\x20,\x201,\x20null'))),'outboundDropCallsDayCallersExit'],[db['sequelize']['fn']('COUNT',db[_0x2cdc('0x21')]['fn']('IF',db[_0x2cdc('0x21')][_0x2cdc('0x22')]('`state`\x20=\x2012,\x201,\x20null'))),_0x2cdc('0x3a')],[db[_0x2cdc('0x21')]['fn'](_0x2cdc('0x1f'),db['sequelize']['fn']('IF',db[_0x2cdc('0x21')][_0x2cdc('0x22')](_0x2cdc('0x3b')))),_0x2cdc('0x3c')],[db['sequelize']['fn'](_0x2cdc('0x1f'),db[_0x2cdc('0x21')]['fn']('IF',db[_0x2cdc('0x21')]['literal'](_0x2cdc('0x3d')))),_0x2cdc('0x3e')],[db[_0x2cdc('0x21')]['fn']('COUNT',db[_0x2cdc('0x21')]['fn']('IF',db[_0x2cdc('0x21')][_0x2cdc('0x22')](_0x2cdc('0x3f')))),'outboundRejectCallsDay'],[db['sequelize']['fn'](_0x2cdc('0x1f'),db[_0x2cdc('0x21')]['fn']('IF',db[_0x2cdc('0x21')]['literal']('`state`\x20=\x2016,\x201,\x20null'))),_0x2cdc('0x40')],[db[_0x2cdc('0x21')]['fn'](_0x2cdc('0x1f'),db[_0x2cdc('0x21')]['fn']('IF',db[_0x2cdc('0x21')][_0x2cdc('0x22')](_0x2cdc('0x41')))),_0x2cdc('0x42')],[db[_0x2cdc('0x21')]['fn'](_0x2cdc('0x1f'),db[_0x2cdc('0x21')]['fn']('IF',db['sequelize']['literal'](_0x2cdc('0x43')))),'outboundReCallsDay']],'group':['campaign']})[_0x2cdc('0xe')](function(_0x72cc55){logger[_0x2cdc('0xf')]('GetVoiceQueueHopperHistory',_0x33d508);logger[_0x2cdc('0x10')](_0x2cdc('0x2d'),_0x33d508,JSON['stringify'](_0x72cc55));_0x21add5(_0x72cc55);})['catch'](function(_0x282d16){logger[_0x2cdc('0x14')]('GetVoiceQueueHopperHistory',_0x282d16[_0x2cdc('0x17')],_0x33d508);_0x3f80f6(_0x5efcb2[_0x2cdc('0x14')](0x1f4,_0x282d16[_0x2cdc('0x17')]));});});};exports[_0x2cdc('0x44')]=function(_0x12ee2e){var _0x54648c=this;return new Promise(function(_0x54e7e3,_0x57d7bf){return db[_0x2cdc('0x45')][_0x2cdc('0x1d')]({'raw':_0x12ee2e[_0x2cdc('0x1c')]?_0x12ee2e[_0x2cdc('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x12ee2e[_0x2cdc('0x1c')]?_0x12ee2e['options'][_0x2cdc('0x1e')]||null:null,'attributes':[['campaign',_0x2cdc('0x46')],[db[_0x2cdc('0x21')]['fn']('COUNT',db[_0x2cdc('0x21')][_0x2cdc('0x47')]('id')),'ivrTotalCallsDays'],[db[_0x2cdc('0x21')]['fn'](_0x2cdc('0x1f'),db[_0x2cdc('0x21')]['fn']('IF',db['sequelize'][_0x2cdc('0x22')](_0x2cdc('0x23')))),_0x2cdc('0x48')]],'group':[_0x2cdc('0x2f')]})[_0x2cdc('0xe')](function(_0x56988f){logger[_0x2cdc('0xf')](_0x2cdc('0x44'),_0x12ee2e);logger[_0x2cdc('0x10')](_0x2cdc('0x44'),_0x12ee2e,JSON[_0x2cdc('0x13')](_0x56988f));_0x54e7e3(_0x56988f);})[_0x2cdc('0x18')](function(_0x21d04e){logger['error'](_0x2cdc('0x44'),_0x21d04e[_0x2cdc('0x17')],_0x12ee2e);_0x57d7bf(_0x54648c[_0x2cdc('0x14')](0x1f4,_0x21d04e[_0x2cdc('0x17')]));});});}; \ No newline at end of file +var _0x6b1c=['predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','where','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','campaign','GetCampaignHopperHistory','ivrTotalCallsDays','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','CmHopperHistory','create','options','raw','CreateCmHopperHistory','catch','AvgHandleTime','findAll','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null'];(function(_0x1e081a,_0x482d6b){var _0x428209=function(_0x524b53){while(--_0x524b53){_0x1e081a['push'](_0x1e081a['shift']());}};_0x428209(++_0x482d6b);}(_0x6b1c,0xf3));var _0xc6b1=function(_0x5411af,_0x1a4cff){_0x5411af=_0x5411af-0x0;var _0x264d74=_0x6b1c[_0x5411af];return _0x264d74;};'use strict';var _=require(_0xc6b1('0x0'));var util=require('util');var moment=require(_0xc6b1('0x1'));var BPromise=require(_0xc6b1('0x2'));var rs=require(_0xc6b1('0x3'));var fs=require('fs');var Redis=require(_0xc6b1('0x4'));var db=require(_0xc6b1('0x5'))['db'];var utils=require(_0xc6b1('0x6'));var logger=require('../../config/logger')(_0xc6b1('0x7'));var config=require('../../config/environment');var jayson=require(_0xc6b1('0x8'));var client=jayson[_0xc6b1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f8295,_0x1de8b5,_0x362814){return new BPromise(function(_0x1e0dfb,_0x4f6509){return client[_0xc6b1('0xa')](_0x1f8295,_0x362814)[_0xc6b1('0xb')](function(_0x5a8dac){logger['info'](_0xc6b1('0xc'),_0x1de8b5,_0xc6b1('0xd'));logger[_0xc6b1('0xe')](_0xc6b1('0xf'),_0x1de8b5,_0xc6b1('0xd'),JSON[_0xc6b1('0x10')](_0x5a8dac));if(_0x5a8dac['error']){if(_0x5a8dac[_0xc6b1('0x11')][_0xc6b1('0x12')]===0x1f4){logger[_0xc6b1('0x11')](_0xc6b1('0xc'),_0x1de8b5,_0x5a8dac[_0xc6b1('0x11')]['message']);return _0x4f6509(_0x5a8dac[_0xc6b1('0x11')][_0xc6b1('0x13')]);}logger[_0xc6b1('0x11')](_0xc6b1('0xc'),_0x1de8b5,_0x5a8dac['error']['message']);return _0x1e0dfb(_0x5a8dac[_0xc6b1('0x11')][_0xc6b1('0x13')]);}else{logger[_0xc6b1('0x14')](_0xc6b1('0xc'),_0x1de8b5,_0xc6b1('0xd'));_0x1e0dfb(_0x5a8dac[_0xc6b1('0x15')]['message']);}})['catch'](function(_0xaed550){logger[_0xc6b1('0x11')](_0xc6b1('0xc'),_0x1de8b5,_0xaed550);_0x4f6509(_0xaed550);});});}exports['CreateCmHopperHistory']=function(_0x2c4bae){var _0x40a267=this;return new Promise(function(_0x5d732e,_0x41370b){return db[_0xc6b1('0x16')][_0xc6b1('0x17')](_0x2c4bae['body'],{'raw':_0x2c4bae[_0xc6b1('0x18')]?_0x2c4bae[_0xc6b1('0x18')][_0xc6b1('0x19')]===undefined?!![]:![]:!![]})[_0xc6b1('0xb')](function(_0x57a253){logger['info'](_0xc6b1('0x1a'),_0x2c4bae);logger[_0xc6b1('0xe')](_0xc6b1('0x1a'),_0x2c4bae,JSON[_0xc6b1('0x10')](_0x57a253));_0x5d732e(_0x57a253);})[_0xc6b1('0x1b')](function(_0x9cef9f){logger[_0xc6b1('0x11')](_0xc6b1('0x1a'),_0x9cef9f[_0xc6b1('0x13')],_0x2c4bae);_0x41370b(_0x40a267[_0xc6b1('0x11')](0x1f4,_0x9cef9f[_0xc6b1('0x13')]));});});};exports[_0xc6b1('0x1c')]=function(_0x279fbf){var _0x9a919c=this;return new Promise(function(_0x311b3f,_0x3976df){return db['CmHopperHistory'][_0xc6b1('0x1d')]({'raw':_0x279fbf['options']?_0x279fbf[_0xc6b1('0x18')][_0xc6b1('0x19')]===undefined?!![]:![]:!![],'where':_0x279fbf[_0xc6b1('0x18')]?_0x279fbf[_0xc6b1('0x18')]['where']||null:null,'attributes':[[db[_0xc6b1('0x1e')]['fn'](_0xc6b1('0x1f'),db[_0xc6b1('0x1e')][_0xc6b1('0x20')]('id')),_0xc6b1('0x21')],[db[_0xc6b1('0x1e')]['fn'](_0xc6b1('0x1f'),db['sequelize']['fn']('IF',db[_0xc6b1('0x1e')][_0xc6b1('0x22')](_0xc6b1('0x23')))),_0xc6b1('0x24')],[db[_0xc6b1('0x1e')]['fn'](_0xc6b1('0x1f'),db['sequelize']['fn']('IF',db[_0xc6b1('0x1e')][_0xc6b1('0x22')](_0xc6b1('0x25')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0xc6b1('0x1e')]['fn'](_0xc6b1('0x1f'),db[_0xc6b1('0x1e')]['fn']('IF',db[_0xc6b1('0x1e')]['literal']('`state`\x20=\x2011,\x201,\x20null'))),_0xc6b1('0x26')],[db['sequelize']['fn'](_0xc6b1('0x27'),db[_0xc6b1('0x1e')]['fn']('IF',db[_0xc6b1('0x1e')][_0xc6b1('0x22')](_0xc6b1('0x28')))),_0xc6b1('0x29')],[db[_0xc6b1('0x1e')]['fn'](_0xc6b1('0x27'),db[_0xc6b1('0x1e')]['fn']('IF',db[_0xc6b1('0x1e')]['literal']('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0xc6b1('0x2a')]]})['then'](function(_0x1aea81){logger[_0xc6b1('0x14')](_0xc6b1('0x1c'),_0x279fbf);logger[_0xc6b1('0xe')](_0xc6b1('0x1c'),_0x279fbf,JSON[_0xc6b1('0x10')](_0x1aea81));_0x311b3f(_0x1aea81);})[_0xc6b1('0x1b')](function(_0x185d26){logger[_0xc6b1('0x11')]('AvgHandleTime',_0x185d26[_0xc6b1('0x13')],_0x279fbf);_0x3976df(_0x9a919c[_0xc6b1('0x11')](0x1f4,_0x185d26[_0xc6b1('0x13')]));});});};exports[_0xc6b1('0x2b')]=function(_0x455a41){var _0x117ecd=this;return new Promise(function(_0x140006,_0x29b5e4){return db['CmHopperHistory']['findAll']({'raw':_0x455a41['options']?_0x455a41['options'][_0xc6b1('0x19')]===undefined?!![]:![]:!![],'where':_0x455a41[_0xc6b1('0x18')]?_0x455a41[_0xc6b1('0x18')][_0xc6b1('0x2c')]||null:null,'attributes':[['campaign',_0xc6b1('0x2d')],[db[_0xc6b1('0x1e')]['fn'](_0xc6b1('0x1f'),db['sequelize']['fn']('IF',db[_0xc6b1('0x1e')][_0xc6b1('0x22')](_0xc6b1('0x2e')))),_0xc6b1('0x2f')],[db[_0xc6b1('0x1e')]['fn'](_0xc6b1('0x1f'),db['sequelize']['fn']('IF',db[_0xc6b1('0x1e')][_0xc6b1('0x22')](_0xc6b1('0x30')))),_0xc6b1('0x31')],[db['sequelize']['fn'](_0xc6b1('0x1f'),db[_0xc6b1('0x1e')]['fn']('IF',db[_0xc6b1('0x1e')][_0xc6b1('0x22')](_0xc6b1('0x23')))),'outboundAnswerCallsDay'],[db['sequelize']['fn'](_0xc6b1('0x1f'),db['sequelize']['fn']('IF',db[_0xc6b1('0x1e')]['literal'](_0xc6b1('0x32')))),_0xc6b1('0x33')],[db[_0xc6b1('0x1e')]['fn'](_0xc6b1('0x1f'),db[_0xc6b1('0x1e')]['fn']('IF',db[_0xc6b1('0x1e')][_0xc6b1('0x22')](_0xc6b1('0x34')))),_0xc6b1('0x35')],[db[_0xc6b1('0x1e')]['fn'](_0xc6b1('0x1f'),db[_0xc6b1('0x1e')]['fn']('IF',db[_0xc6b1('0x1e')][_0xc6b1('0x22')](_0xc6b1('0x36')))),_0xc6b1('0x37')],[db['sequelize']['fn'](_0xc6b1('0x1f'),db[_0xc6b1('0x1e')]['fn']('IF',db[_0xc6b1('0x1e')][_0xc6b1('0x22')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xc6b1('0x38')],[db['sequelize']['fn'](_0xc6b1('0x1f'),db[_0xc6b1('0x1e')]['fn']('IF',db[_0xc6b1('0x1e')][_0xc6b1('0x22')](_0xc6b1('0x39')))),'outboundUnknownCallsDay'],[db[_0xc6b1('0x1e')]['fn'](_0xc6b1('0x1f'),db[_0xc6b1('0x1e')]['fn']('IF',db[_0xc6b1('0x1e')][_0xc6b1('0x22')](_0xc6b1('0x3a')))),_0xc6b1('0x3b')],[db['sequelize']['fn'](_0xc6b1('0x1f'),db[_0xc6b1('0x1e')]['fn']('IF',db[_0xc6b1('0x1e')][_0xc6b1('0x22')]('`state`\x20=\x2014,\x201,\x20null'))),_0xc6b1('0x3c')],[db[_0xc6b1('0x1e')]['fn'](_0xc6b1('0x1f'),db['sequelize']['fn']('IF',db['sequelize'][_0xc6b1('0x22')](_0xc6b1('0x3d')))),_0xc6b1('0x3e')],[db[_0xc6b1('0x1e')]['fn'](_0xc6b1('0x1f'),db[_0xc6b1('0x1e')]['fn']('IF',db[_0xc6b1('0x1e')][_0xc6b1('0x22')](_0xc6b1('0x3f')))),_0xc6b1('0x40')],[db[_0xc6b1('0x1e')]['fn']('COUNT',db[_0xc6b1('0x1e')]['fn']('IF',db[_0xc6b1('0x1e')][_0xc6b1('0x22')](_0xc6b1('0x41')))),_0xc6b1('0x3e')],[db[_0xc6b1('0x1e')]['fn'](_0xc6b1('0x1f'),db[_0xc6b1('0x1e')]['fn']('IF',db['sequelize'][_0xc6b1('0x22')](_0xc6b1('0x42')))),_0xc6b1('0x43')]],'group':[_0xc6b1('0x44')]})[_0xc6b1('0xb')](function(_0x298ccf){logger[_0xc6b1('0x14')](_0xc6b1('0x2b'),_0x455a41);logger[_0xc6b1('0xe')](_0xc6b1('0x2b'),_0x455a41,JSON['stringify'](_0x298ccf));_0x140006(_0x298ccf);})[_0xc6b1('0x1b')](function(_0x2f8340){logger[_0xc6b1('0x11')]('GetVoiceQueueHopperHistory',_0x2f8340['message'],_0x455a41);_0x29b5e4(_0x117ecd[_0xc6b1('0x11')](0x1f4,_0x2f8340['message']));});});};exports[_0xc6b1('0x45')]=function(_0x5c57ab){var _0x490855=this;return new Promise(function(_0x5f1877,_0x4ff871){return db['CmHopperHistory'][_0xc6b1('0x1d')]({'raw':_0x5c57ab[_0xc6b1('0x18')]?_0x5c57ab[_0xc6b1('0x18')][_0xc6b1('0x19')]===undefined?!![]:![]:!![],'where':_0x5c57ab[_0xc6b1('0x18')]?_0x5c57ab['options'][_0xc6b1('0x2c')]||null:null,'attributes':[[_0xc6b1('0x44'),_0xc6b1('0x2d')],[db[_0xc6b1('0x1e')]['fn'](_0xc6b1('0x1f'),db[_0xc6b1('0x1e')][_0xc6b1('0x20')]('id')),_0xc6b1('0x46')],[db[_0xc6b1('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xc6b1('0x1e')][_0xc6b1('0x22')](_0xc6b1('0x23')))),'ivrAnswerCallsDay']],'group':[_0xc6b1('0x44')]})[_0xc6b1('0xb')](function(_0xa0d139){logger[_0xc6b1('0x14')](_0xc6b1('0x45'),_0x5c57ab);logger[_0xc6b1('0xe')](_0xc6b1('0x45'),_0x5c57ab,JSON[_0xc6b1('0x10')](_0xa0d139));_0x5f1877(_0xa0d139);})['catch'](function(_0x1be09b){logger[_0xc6b1('0x11')]('GetCampaignHopperHistory',_0x1be09b[_0xc6b1('0x13')],_0x5c57ab);_0x4ff871(_0x490855['error'](0x1f4,_0x1be09b[_0xc6b1('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index e82f72e..634c3f8 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 _0xe113=['/:id','update','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','index','get','/describe','isAuthenticated','describe','create','put'];(function(_0x75fd7b,_0x412b29){var _0x4e2182=function(_0x29bcf2){while(--_0x29bcf2){_0x75fd7b['push'](_0x75fd7b['shift']());}};_0x4e2182(++_0x412b29);}(_0xe113,0x159));var _0x3e11=function(_0x147641,_0x3ee411){_0x147641=_0x147641-0x0;var _0x32e0b8=_0xe113[_0x147641];return _0x32e0b8;};'use strict';var multer=require(_0x3e11('0x0'));var util=require(_0x3e11('0x1'));var path=require(_0x3e11('0x2'));var timeout=require('connect-timeout');var express=require(_0x3e11('0x3'));var router=express['Router']();var fs_extra=require(_0x3e11('0x4'));var auth=require(_0x3e11('0x5'));var interaction=require(_0x3e11('0x6'));var config=require(_0x3e11('0x7'));var controller=require(_0x3e11('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x3e11('0x9')]);router[_0x3e11('0xa')](_0x3e11('0xb'),auth[_0x3e11('0xc')](),controller[_0x3e11('0xd')]);router[_0x3e11('0xa')]('/:id',auth[_0x3e11('0xc')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x3e11('0xe')]);router[_0x3e11('0xf')](_0x3e11('0x10'),auth['isAuthenticated'](),controller[_0x3e11('0x11')]);module[_0x3e11('0x12')]=router; \ No newline at end of file +var _0x90b4=['../../config/environment','./cmHopperHistory.controller','isAuthenticated','index','/describe','describe','get','/:id','post','create','put','update','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x54f84e,_0x412dca){var _0x6e4315=function(_0x8ab4b7){while(--_0x8ab4b7){_0x54f84e['push'](_0x54f84e['shift']());}};_0x6e4315(++_0x412dca);}(_0x90b4,0xa5));var _0x490b=function(_0x4060e9,_0x4c788d){_0x4060e9=_0x4060e9-0x0;var _0x253f3d=_0x90b4[_0x4060e9];return _0x253f3d;};'use strict';var multer=require(_0x490b('0x0'));var util=require(_0x490b('0x1'));var path=require(_0x490b('0x2'));var timeout=require(_0x490b('0x3'));var express=require(_0x490b('0x4'));var router=express[_0x490b('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x490b('0x6'));var controller=require(_0x490b('0x7'));router['get']('/',auth[_0x490b('0x8')](),controller[_0x490b('0x9')]);router['get'](_0x490b('0xa'),auth['isAuthenticated'](),controller[_0x490b('0xb')]);router[_0x490b('0xc')](_0x490b('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x490b('0xe')]('/',auth[_0x490b('0x8')](),controller[_0x490b('0xf')]);router[_0x490b('0x10')](_0x490b('0xd'),auth[_0x490b('0x8')](),controller[_0x490b('0x11')]);module[_0x490b('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 195873a..4f2c449 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 _0x294b=['sequelize','STRING','name'];(function(_0x21d1ab,_0x4e2eb0){var _0x59254c=function(_0x5e4930){while(--_0x5e4930){_0x21d1ab['push'](_0x21d1ab['shift']());}};_0x59254c(++_0x4e2eb0);}(_0x294b,0xea));var _0xb294=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x294b[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xb294('0x0'));module['exports']={'name':{'type':Sequelize[_0xb294('0x1')],'unique':_0xb294('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb294('0x1')]},'dialPrefix':{'type':Sequelize[_0xb294('0x1')]}}; \ No newline at end of file +var _0xf2cb=['STRING','exports','name'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xf2cb,0x130));var _0xbf2c=function(_0x3f1ef9,_0x3ae19b){_0x3f1ef9=_0x3f1ef9-0x0;var _0x13459f=_0xf2cb[_0x3f1ef9];return _0x13459f;};'use strict';var Sequelize=require('sequelize');module[_0xbf2c('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xbf2c('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0xbf2c('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index aed4b2a..13afceb 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 _0xce2f=['removeAgents','emit','userCmList:remove','User','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./cmList.socket','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','get','Lists','UserProfileResource','stack','name','send','index','map','fieldName','type','key','model','query','keys','attributes','intersection','length','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','CmList','includeAll','include','findAll','rows','catch','show','params','rawAttributes','fields','merge','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','ListId','Disposition','findOne','hasOwnProperty','ids','addContacts','CmContact','isArray','tags','join','push','each','success','dataValues','errors','message','getContacts','CmCustomField','CustomFields','concat','cf_%d','raw','format','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','sequelize','addCustomFields','Sequelize','TEXT','text','number','INTEGER','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','getCustomFields','findAndCountAll','addAgents','omit','spread','userCmList:save'];(function(_0x238f8a,_0x49de01){var _0x176856=function(_0x26966c){while(--_0x26966c){_0x238f8a['push'](_0x238f8a['shift']());}};_0x176856(++_0x49de01);}(_0xce2f,0x99));var _0xfce2=function(_0x2bac0d,_0x72d006){_0x2bac0d=_0x2bac0d-0x0;var _0x19d2e7=_0xce2f[_0x2bac0d];return _0x19d2e7;};'use strict';var emlformat=require(_0xfce2('0x0'));var rimraf=require(_0xfce2('0x1'));var zipdir=require(_0xfce2('0x2'));var jsonpatch=require(_0xfce2('0x3'));var rp=require('request-promise');var moment=require(_0xfce2('0x4'));var BPromise=require(_0xfce2('0x5'));var Mustache=require(_0xfce2('0x6'));var util=require(_0xfce2('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfce2('0x8'));var fs=require('fs');var fs_extra=require(_0xfce2('0x9'));var _=require(_0xfce2('0xa'));var squel=require(_0xfce2('0xb'));var crypto=require(_0xfce2('0xc'));var jsforce=require(_0xfce2('0xd'));var deskjs=require(_0xfce2('0xe'));var toCsv=require(_0xfce2('0xf'));var querystring=require(_0xfce2('0x10'));var Papa=require(_0xfce2('0x11'));var Redis=require('ioredis');var authService=require(_0xfce2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xfce2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfce2('0x14'))(_0xfce2('0x15'));var utils=require(_0xfce2('0x16'));var config=require(_0xfce2('0x17'));var licenseUtil=require(_0xfce2('0x18'));var db=require(_0xfce2('0x19'))['db'];config['redis']=_[_0xfce2('0x1a')](config[_0xfce2('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xfce2('0x1c'))(new Redis(config[_0xfce2('0x1b')]));require(_0xfce2('0x1d'))['register'](socket);function respondWithStatusCode(_0x1fe034,_0x1885c3){_0x1885c3=_0x1885c3||0xcc;return function(_0x39e6f4){if(_0x39e6f4){return _0x1fe034[_0xfce2('0x1e')](_0x1885c3);}return _0x1fe034[_0xfce2('0x1f')](_0x1885c3)[_0xfce2('0x20')]();};}function respondWithResult(_0x5167f4,_0x358e27){_0x358e27=_0x358e27||0xc8;return function(_0x99d81d){if(_0x99d81d){return _0x5167f4['status'](_0x358e27)[_0xfce2('0x21')](_0x99d81d);}};}function respondWithFilteredResult(_0x1f2ae4,_0x252300){return function(_0x17cbe0){if(_0x17cbe0){var _0x17125b=typeof _0x252300[_0xfce2('0x22')]===_0xfce2('0x23')&&typeof _0x252300['limit']===_0xfce2('0x23');var _0x596728=_0x17cbe0[_0xfce2('0x24')];var _0x540a47=_0x17125b?0x0:_0x252300['offset'];var _0x2206ab=_0x17125b?_0x17cbe0[_0xfce2('0x24')]:_0x252300[_0xfce2('0x22')]+_0x252300[_0xfce2('0x25')];var _0x4335f3;if(_0x2206ab>=_0x596728){_0x2206ab=_0x596728;_0x4335f3=0xc8;}else{_0x4335f3=0xce;}_0x1f2ae4[_0xfce2('0x1f')](_0x4335f3);return _0x1f2ae4[_0xfce2('0x26')](_0xfce2('0x27'),_0x540a47+'-'+_0x2206ab+'/'+_0x596728)[_0xfce2('0x21')](_0x17cbe0);}return null;};}function patchUpdates(_0x589e38){return function(_0x1fb87c){try{jsonpatch[_0xfce2('0x28')](_0x1fb87c,_0x589e38,!![]);}catch(_0x537e95){return BPromise['reject'](_0x537e95);}return _0x1fb87c[_0xfce2('0x29')]();};}function saveUpdates(_0x2ed05b,_0x534229){return function(_0x5c6ba9){if(_0x5c6ba9){return _0x5c6ba9['update'](_0x2ed05b)[_0xfce2('0x2a')](function(_0x43fdb6){return _0x43fdb6;});}return null;};}function removeEntity(_0x1927d1,_0x496c86){return function(_0x11efec){if(_0x11efec){return _0x11efec[_0xfce2('0x2b')]()[_0xfce2('0x2a')](function(){var _0x36a77a=_0x11efec[_0xfce2('0x2c')]({'plain':!![]});var _0x2c8847=_0xfce2('0x2d');return db[_0xfce2('0x2e')][_0xfce2('0x2b')]({'where':{'type':_0x2c8847,'resourceId':_0x36a77a['id']}})[_0xfce2('0x2a')](function(){return _0x11efec;});})[_0xfce2('0x2a')](function(){_0x1927d1[_0xfce2('0x1f')](0xcc)[_0xfce2('0x20')]();});}};}function handleEntityNotFound(_0x724f5e,_0xca49c5){return function(_0x40f7cb){if(!_0x40f7cb){_0x724f5e['sendStatus'](0x194);}return _0x40f7cb;};}function handleError(_0x41e42c,_0x540696){_0x540696=_0x540696||0x1f4;return function(_0x4a3374){logger['error'](_0x4a3374[_0xfce2('0x2f')]);if(_0x4a3374[_0xfce2('0x30')]){delete _0x4a3374[_0xfce2('0x30')];}_0x41e42c[_0xfce2('0x1f')](_0x540696)[_0xfce2('0x31')](_0x4a3374);};}exports[_0xfce2('0x32')]=function(_0x4d6438,_0x341827){var _0x163425={},_0x5b9c3d={},_0xea569e={'count':0x0,'rows':[]};var _0x354686=_[_0xfce2('0x33')](db['CmList']['rawAttributes'],function(_0x5a6d6a){return{'name':_0x5a6d6a[_0xfce2('0x34')],'type':_0x5a6d6a[_0xfce2('0x35')][_0xfce2('0x36')]};});_0x5b9c3d[_0xfce2('0x37')]=_['map'](_0x354686,_0xfce2('0x30'));_0x5b9c3d[_0xfce2('0x38')]=_[_0xfce2('0x39')](_0x4d6438['query']);_0x5b9c3d['filters']=_['intersection'](_0x5b9c3d[_0xfce2('0x37')],_0x5b9c3d[_0xfce2('0x38')]);_0x163425[_0xfce2('0x3a')]=_[_0xfce2('0x3b')](_0x5b9c3d[_0xfce2('0x37')],qs['fields'](_0x4d6438[_0xfce2('0x38')]['fields']));_0x163425['attributes']=_0x163425[_0xfce2('0x3a')][_0xfce2('0x3c')]?_0x163425[_0xfce2('0x3a')]:_0x5b9c3d[_0xfce2('0x37')];if(!_0x4d6438[_0xfce2('0x38')]['hasOwnProperty'](_0xfce2('0x3d'))){_0x163425[_0xfce2('0x25')]=qs[_0xfce2('0x25')](_0x4d6438[_0xfce2('0x38')][_0xfce2('0x25')]);_0x163425[_0xfce2('0x22')]=qs[_0xfce2('0x22')](_0x4d6438[_0xfce2('0x38')]['offset']);}_0x163425[_0xfce2('0x3e')]=qs[_0xfce2('0x3f')](_0x4d6438['query']['sort']);_0x163425[_0xfce2('0x40')]=qs[_0xfce2('0x41')](_[_0xfce2('0x42')](_0x4d6438['query'],_0x5b9c3d[_0xfce2('0x41')]),_0x354686);if(_0x4d6438[_0xfce2('0x38')][_0xfce2('0x43')]){_0x163425[_0xfce2('0x40')]=_['merge'](_0x163425['where'],{'$or':_[_0xfce2('0x33')](_0x354686,function(_0x563265){if(_0x563265[_0xfce2('0x35')]!==_0xfce2('0x44')){var _0x3dbcba={};_0x3dbcba[_0x563265[_0xfce2('0x30')]]={'$like':'%'+_0x4d6438[_0xfce2('0x38')][_0xfce2('0x43')]+'%'};return _0x3dbcba;}})});}_0x163425=_['merge']({},_0x163425,_0x4d6438['options']);var _0x522f93={'where':_0x163425['where']};return db[_0xfce2('0x45')]['count'](_0x522f93)[_0xfce2('0x2a')](function(_0x3aca34){_0xea569e[_0xfce2('0x24')]=_0x3aca34;if(_0x4d6438[_0xfce2('0x38')][_0xfce2('0x46')]){_0x163425[_0xfce2('0x47')]=[{'all':!![]}];}return db[_0xfce2('0x45')][_0xfce2('0x48')](_0x163425);})['then'](function(_0xb51b0e){_0xea569e[_0xfce2('0x49')]=_0xb51b0e;return _0xea569e;})[_0xfce2('0x2a')](respondWithFilteredResult(_0x341827,_0x163425))[_0xfce2('0x4a')](handleError(_0x341827,null));};exports[_0xfce2('0x4b')]=function(_0x39685e,_0x1372ce){var _0x1b54d4={'raw':![],'where':{'id':_0x39685e[_0xfce2('0x4c')]['id']}},_0x57d8e4={};_0x57d8e4['model']=_[_0xfce2('0x39')](db[_0xfce2('0x45')][_0xfce2('0x4d')]);_0x57d8e4[_0xfce2('0x38')]=_[_0xfce2('0x39')](_0x39685e[_0xfce2('0x38')]);_0x57d8e4[_0xfce2('0x41')]=_['intersection'](_0x57d8e4['model'],_0x57d8e4[_0xfce2('0x38')]);_0x1b54d4[_0xfce2('0x3a')]=_[_0xfce2('0x3b')](_0x57d8e4['model'],qs[_0xfce2('0x4e')](_0x39685e[_0xfce2('0x38')][_0xfce2('0x4e')]));_0x1b54d4[_0xfce2('0x3a')]=_0x1b54d4['attributes'][_0xfce2('0x3c')]?_0x1b54d4[_0xfce2('0x3a')]:_0x57d8e4[_0xfce2('0x37')];if(_0x39685e[_0xfce2('0x38')][_0xfce2('0x46')]){_0x1b54d4[_0xfce2('0x47')]=[{'all':!![]}];}_0x1b54d4=_[_0xfce2('0x4f')]({},_0x1b54d4,_0x39685e[_0xfce2('0x50')]);return db[_0xfce2('0x45')][_0xfce2('0x51')](_0x1b54d4)[_0xfce2('0x2a')](handleEntityNotFound(_0x1372ce,null))['then'](respondWithResult(_0x1372ce,null))[_0xfce2('0x4a')](handleError(_0x1372ce,null));};exports[_0xfce2('0x52')]=function(_0x2d7198,_0x4ee796){return db[_0xfce2('0x45')][_0xfce2('0x52')](_0x2d7198[_0xfce2('0x53')],{})[_0xfce2('0x2a')](function(_0x39262b){var _0x2f68b6=_0x2d7198['user'][_0xfce2('0x2c')]({'plain':!![]});if(!_0x2f68b6)throw new Error(_0xfce2('0x54'));if(_0x2f68b6[_0xfce2('0x55')]===_0xfce2('0x56')){var _0x5a3a3c=_0x39262b['get']({'plain':!![]});var _0x2a1cfa=_0xfce2('0x2d');return db[_0xfce2('0x57')][_0xfce2('0x51')]({'where':{'name':_0x2a1cfa,'userProfileId':_0x2f68b6[_0xfce2('0x58')]},'raw':!![]})[_0xfce2('0x2a')](function(_0x363a49){if(_0x363a49&&_0x363a49[_0xfce2('0x59')]===0x0){return db['UserProfileResource'][_0xfce2('0x52')]({'name':_0x5a3a3c[_0xfce2('0x30')],'resourceId':_0x5a3a3c['id'],'type':_0x363a49[_0xfce2('0x30')],'sectionId':_0x363a49['id']},{})[_0xfce2('0x2a')](function(){return _0x39262b;});}else{return _0x39262b;}})[_0xfce2('0x4a')](function(_0x4e20fc){logger[_0xfce2('0x5a')](_0xfce2('0x5b'),_0x4e20fc);throw _0x4e20fc;});}return _0x39262b;})[_0xfce2('0x2a')](respondWithResult(_0x4ee796,0xc9))[_0xfce2('0x4a')](handleError(_0x4ee796,null));};exports[_0xfce2('0x5c')]=function(_0x2f88fd,_0xbbdca7){if(_0x2f88fd[_0xfce2('0x53')]['id']){delete _0x2f88fd['body']['id'];}return db['CmList']['find']({'where':{'id':_0x2f88fd[_0xfce2('0x4c')]['id']}})[_0xfce2('0x2a')](handleEntityNotFound(_0xbbdca7,null))[_0xfce2('0x2a')](saveUpdates(_0x2f88fd[_0xfce2('0x53')],null))[_0xfce2('0x2a')](respondWithResult(_0xbbdca7,null))[_0xfce2('0x4a')](handleError(_0xbbdca7,null));};exports[_0xfce2('0x2b')]=function(_0x148d2a,_0x40a64b){return db[_0xfce2('0x45')][_0xfce2('0x51')]({'where':{'id':_0x148d2a['params']['id']}})[_0xfce2('0x2a')](handleEntityNotFound(_0x40a64b,null))[_0xfce2('0x2a')](removeEntity(_0x40a64b,null))[_0xfce2('0x4a')](handleError(_0x40a64b,null));};exports[_0xfce2('0x5d')]=function(_0x142441,_0x39bb5d){return db['CmList'][_0xfce2('0x5d')]()[_0xfce2('0x2a')](respondWithResult(_0x39bb5d,null))[_0xfce2('0x4a')](handleError(_0x39bb5d,null));};exports[_0xfce2('0x5e')]=function(_0x20612a,_0x9415d9,_0x5e210d){if(_0x20612a[_0xfce2('0x53')]['id']){delete _0x20612a['body']['id'];}return db[_0xfce2('0x45')][_0xfce2('0x51')]({'where':{'id':_0x20612a[_0xfce2('0x4c')]['id']}})['then'](handleEntityNotFound(_0x9415d9,null))['then'](function(_0x473b60){if(_0x473b60){_0x20612a[_0xfce2('0x53')][_0xfce2('0x5f')]=_0x473b60['id'];return db[_0xfce2('0x60')]['create'](_0x20612a[_0xfce2('0x53')]);}})[_0xfce2('0x2a')](respondWithResult(_0x9415d9,null))['catch'](handleError(_0x9415d9,null));};exports['getDispositions']=function(_0x4135dd,_0x34fd12,_0x3dc4b5){var _0x3c92d2={'raw':![],'where':{}};var _0x94b939={};var _0xe75d90={'count':0x0,'rows':[]};return db[_0xfce2('0x45')][_0xfce2('0x61')]({'where':{'id':_0x4135dd['params']['id']}})[_0xfce2('0x2a')](handleEntityNotFound(_0x34fd12,null))[_0xfce2('0x2a')](function(_0x5c33ac){if(_0x5c33ac){_0x94b939[_0xfce2('0x37')]=_[_0xfce2('0x39')](db[_0xfce2('0x60')][_0xfce2('0x4d')]);_0x94b939[_0xfce2('0x38')]=_[_0xfce2('0x39')](_0x4135dd[_0xfce2('0x38')]);_0x94b939[_0xfce2('0x41')]=_[_0xfce2('0x3b')](_0x94b939[_0xfce2('0x37')],_0x94b939[_0xfce2('0x38')]);_0x3c92d2[_0xfce2('0x3a')]=_[_0xfce2('0x3b')](_0x94b939['model'],qs['fields'](_0x4135dd['query'][_0xfce2('0x4e')]));_0x3c92d2[_0xfce2('0x3a')]=_0x3c92d2[_0xfce2('0x3a')][_0xfce2('0x3c')]?_0x3c92d2['attributes']:_0x94b939[_0xfce2('0x37')];if(!_0x4135dd[_0xfce2('0x38')][_0xfce2('0x62')](_0xfce2('0x3d'))){_0x3c92d2[_0xfce2('0x25')]=qs[_0xfce2('0x25')](_0x4135dd[_0xfce2('0x38')][_0xfce2('0x25')]);_0x3c92d2[_0xfce2('0x22')]=qs[_0xfce2('0x22')](_0x4135dd[_0xfce2('0x38')][_0xfce2('0x22')]);}_0x3c92d2[_0xfce2('0x3e')]=qs['sort'](_0x4135dd[_0xfce2('0x38')][_0xfce2('0x3f')]);_0x3c92d2[_0xfce2('0x40')]=qs[_0xfce2('0x41')](_[_0xfce2('0x42')](_0x4135dd[_0xfce2('0x38')],_0x94b939[_0xfce2('0x41')]));_0x3c92d2[_0xfce2('0x40')][_0xfce2('0x5f')]=_0x5c33ac['id'];if(_0x4135dd[_0xfce2('0x38')][_0xfce2('0x43')]){_0x3c92d2[_0xfce2('0x40')]=_[_0xfce2('0x4f')](_0x3c92d2[_0xfce2('0x40')],{'$or':_['map'](_0x3c92d2[_0xfce2('0x3a')],function(_0x231d52){var _0x53e604={};_0x53e604[_0x231d52]={'$like':'%'+_0x4135dd['query'][_0xfce2('0x43')]+'%'};return _0x53e604;})});}_0x3c92d2=_['merge']({},_0x3c92d2,_0x4135dd[_0xfce2('0x50')]);return db[_0xfce2('0x60')][_0xfce2('0x24')]({'where':_0x3c92d2['where']})[_0xfce2('0x2a')](function(_0x30a425){_0xe75d90[_0xfce2('0x24')]=_0x30a425;if(_0x4135dd['query'][_0xfce2('0x46')]){_0x3c92d2[_0xfce2('0x47')]=[{'all':!![]}];}return db[_0xfce2('0x60')][_0xfce2('0x48')](_0x3c92d2);})[_0xfce2('0x2a')](function(_0x3568cf){_0xe75d90[_0xfce2('0x49')]=_0x3568cf;return _0xe75d90;});}})[_0xfce2('0x2a')](respondWithFilteredResult(_0x34fd12,_0x3c92d2))['catch'](handleError(_0x34fd12,null));};exports['removeDispositions']=function(_0x5d1340,_0x31ec66,_0x5a52c3){return db[_0xfce2('0x45')][_0xfce2('0x51')]({'where':{'id':_0x5d1340[_0xfce2('0x4c')]['id']}})['then'](handleEntityNotFound(_0x31ec66,null))[_0xfce2('0x2a')](function(_0x4498c9){if(_0x4498c9){return _0x4498c9['removeDispositions'](_0x5d1340['query'][_0xfce2('0x63')]);}})['then'](respondWithStatusCode(_0x31ec66,null))[_0xfce2('0x4a')](handleError(_0x31ec66,null));};exports[_0xfce2('0x64')]=function(_0x5f55b5,_0x2c0f86,_0x4ba599){return db[_0xfce2('0x45')][_0xfce2('0x51')]({'where':{'id':_0x5f55b5['params']['id']}})[_0xfce2('0x2a')](handleEntityNotFound(_0x2c0f86,null))['then'](function(_0x17008e){if(_0x17008e){var _0x16265f=[];var _0x5886ac={'success':[],'errors':[]};return db[_0xfce2('0x65')]['describe']()[_0xfce2('0x2a')](function(_0x2261ef){if(_0x5f55b5[_0xfce2('0x53')]['tags']&&_[_0xfce2('0x66')](_0x5f55b5[_0xfce2('0x53')][_0xfce2('0x67')])){if(_0x5f55b5['body']['tags'][_0xfce2('0x3c')]){_0x5f55b5[_0xfce2('0x53')][_0xfce2('0x67')]=_0x5f55b5[_0xfce2('0x53')][_0xfce2('0x67')][_0xfce2('0x68')](';')+';';}else{_0x5f55b5['body'][_0xfce2('0x67')]=null;}}else{_0x5f55b5['body'][_0xfce2('0x67')]=null;}if(_0x5f55b5[_0xfce2('0x53')]&&_[_0xfce2('0x66')](_0x5f55b5[_0xfce2('0x53')])){for(var _0x4201ea=0x0;_0x4201ea<_0x5f55b5[_0xfce2('0x53')][_0xfce2('0x3c')];_0x4201ea+=0x1){_0x5f55b5[_0xfce2('0x53')][_0x4201ea][_0xfce2('0x5f')]=_0x5f55b5[_0xfce2('0x4c')]['id'];_0x16265f[_0xfce2('0x69')](_0x5f55b5[_0xfce2('0x53')][_0x4201ea]);}return BPromise[_0xfce2('0x6a')](_0x16265f,function(_0x362fb4){return db[_0xfce2('0x65')][_0xfce2('0x52')](_['omit'](_0x362fb4,[_0xfce2('0x63'),'id'])||{},{'fields':_[_0xfce2('0x39')](_0x2261ef),'raw':!![]})[_0xfce2('0x2a')](function(_0x34be73){_0x5886ac[_0xfce2('0x6b')][_0xfce2('0x69')](_0x34be73[_0xfce2('0x6c')]);})[_0xfce2('0x4a')](function(_0x3e9ff0){_0x5886ac[_0xfce2('0x6d')][_0xfce2('0x69')]({'data':_0x362fb4,'error':_0x3e9ff0[_0xfce2('0x6e')]});});})[_0xfce2('0x2a')](function(_0x2faadf){return _0x5886ac;})[_0xfce2('0x4a')](function(_0x51979d){return _0x51979d;});}else{_0x2c0f86['status'](0x190)[_0xfce2('0x21')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0xfce2('0x2a')](respondWithResult(_0x2c0f86,null))[_0xfce2('0x4a')](handleError(_0x2c0f86,null));};exports[_0xfce2('0x6f')]=function(_0xb41740,_0x107d47,_0x33ae1e){var _0x5bb64b;return db['CmList']['find']({'where':{'id':_0xb41740[_0xfce2('0x4c')]['id']},'include':[{'model':db[_0xfce2('0x70')],'as':_0xfce2('0x71')}]})['then'](handleEntityNotFound(_0x107d47,null))[_0xfce2('0x2a')](function(_0x9876db){if(_0x9876db){_0x5bb64b=_0x9876db;return db['CmContact'][_0xfce2('0x4d')];}})[_0xfce2('0x2a')](function(_0x32c7a3){if(_0x32c7a3){var _0x1ba366={};var _0x56b408={};_0x56b408['model']=_[_0xfce2('0x72')](_[_0xfce2('0x39')](_0x32c7a3),_[_0xfce2('0x33')](_0x5bb64b[_0xfce2('0x71')],function(_0x31bcc1){return util['format'](_0xfce2('0x73'),_0x31bcc1['id']);}));_0x56b408['query']=_[_0xfce2('0x39')](_0xb41740[_0xfce2('0x38')]);_0x56b408[_0xfce2('0x41')]=_[_0xfce2('0x3b')](_0x56b408[_0xfce2('0x37')],_0x56b408['query']);_0x1ba366[_0xfce2('0x3a')]=_[_0xfce2('0x3b')](_0x56b408[_0xfce2('0x37')],qs['fields'](_0xb41740[_0xfce2('0x38')]['fields']));_0x1ba366['attributes']=_0x1ba366[_0xfce2('0x3a')][_0xfce2('0x3c')]?_0x1ba366[_0xfce2('0x3a')]:_0x56b408[_0xfce2('0x37')];if(!_0xb41740[_0xfce2('0x38')][_0xfce2('0x62')](_0xfce2('0x3d'))){_0x1ba366[_0xfce2('0x25')]=qs[_0xfce2('0x25')](_0xb41740[_0xfce2('0x38')][_0xfce2('0x25')]);_0x1ba366[_0xfce2('0x22')]=qs[_0xfce2('0x22')](_0xb41740['query'][_0xfce2('0x22')]);}_0x1ba366[_0xfce2('0x3e')]=qs[_0xfce2('0x3f')](_0xb41740[_0xfce2('0x38')][_0xfce2('0x3f')]);_0x1ba366[_0xfce2('0x40')]=qs[_0xfce2('0x41')](_['pick'](_0xb41740[_0xfce2('0x38')],_0x56b408[_0xfce2('0x41')]));_0x1ba366[_0xfce2('0x74')]=!![];if(_0xb41740[_0xfce2('0x38')]['filter']){_0x1ba366[_0xfce2('0x40')]=_[_0xfce2('0x4f')](_0x1ba366[_0xfce2('0x40')],{'$or':_[_0xfce2('0x33')](_0x1ba366[_0xfce2('0x3a')],function(_0x44e5e7){var _0x272c03={};_0x272c03[_0x44e5e7]={'$like':'%'+_0xb41740['query'][_0xfce2('0x43')]+'%'};return _0x272c03;})});}_0x1ba366=_[_0xfce2('0x4f')]({},_0x1ba366,_0xb41740[_0xfce2('0x50')]);return _0x5bb64b['getContacts'](_0x1ba366);}})[_0xfce2('0x2a')](respondWithResult(_0x107d47,null))[_0xfce2('0x4a')](handleError(_0x107d47,null));};exports['getContactsCsv']=function(_0x586bb0,_0x3d37fa,_0x4d32ab){var _0x5a0551;return db[_0xfce2('0x45')][_0xfce2('0x51')]({'where':{'id':_0x586bb0[_0xfce2('0x4c')]['id']},'include':[{'model':db['CmCustomField'],'as':'CustomFields'}]})[_0xfce2('0x2a')](handleEntityNotFound(_0x3d37fa,null))[_0xfce2('0x2a')](function(_0x31d249){if(_0x31d249){_0x5a0551=_0x31d249;return db['CmContact'][_0xfce2('0x4d')];}})[_0xfce2('0x2a')](function(_0x4b250d){if(_0x4b250d){var _0x4c89de={};var _0x136700={};_0x136700[_0xfce2('0x37')]=_['concat'](_[_0xfce2('0x39')](_0x4b250d),_[_0xfce2('0x33')](_0x5a0551[_0xfce2('0x71')],function(_0x335ad4){return util[_0xfce2('0x75')]('cf_%d',_0x335ad4['id']);}));_0x136700[_0xfce2('0x38')]=_[_0xfce2('0x39')](_0x586bb0[_0xfce2('0x38')]);_0x136700[_0xfce2('0x41')]=_[_0xfce2('0x3b')](_0x136700[_0xfce2('0x37')],_0x136700[_0xfce2('0x38')]);_0x4c89de[_0xfce2('0x3a')]=_['intersection'](_0x136700[_0xfce2('0x37')],qs[_0xfce2('0x4e')](_0x586bb0[_0xfce2('0x38')][_0xfce2('0x4e')]));_0x4c89de[_0xfce2('0x3a')]=_0x4c89de['attributes'][_0xfce2('0x3c')]?_0x4c89de[_0xfce2('0x3a')]:_0x136700[_0xfce2('0x37')];if(!_0x586bb0['query'][_0xfce2('0x62')]('nolimit')){_0x4c89de[_0xfce2('0x25')]=qs[_0xfce2('0x25')](_0x586bb0[_0xfce2('0x38')][_0xfce2('0x25')]);_0x4c89de[_0xfce2('0x22')]=qs[_0xfce2('0x22')](_0x586bb0[_0xfce2('0x38')][_0xfce2('0x22')]);}_0x4c89de['order']=qs[_0xfce2('0x3f')](_0x586bb0[_0xfce2('0x38')]['sort']);_0x4c89de[_0xfce2('0x40')]=qs[_0xfce2('0x41')](_[_0xfce2('0x42')](_0x586bb0[_0xfce2('0x38')],_0x136700[_0xfce2('0x41')]));_0x4c89de[_0xfce2('0x74')]=!![];if(_0x586bb0[_0xfce2('0x38')][_0xfce2('0x43')]){_0x4c89de[_0xfce2('0x40')]=_[_0xfce2('0x4f')](_0x4c89de[_0xfce2('0x40')],{'$or':_[_0xfce2('0x33')](_0x4c89de['attributes'],function(_0x1aeec3){var _0x4a58a9={};_0x4a58a9[_0x1aeec3]={'$like':'%'+_0x586bb0[_0xfce2('0x38')][_0xfce2('0x43')]+'%'};return _0x4a58a9;})});}_0x4c89de=_['merge']({},_0x4c89de,_0x586bb0[_0xfce2('0x50')]);return _0x5a0551['getContacts'](_0x4c89de);}})[_0xfce2('0x2a')](function(_0x2c3445){if(!_[_0xfce2('0x76')](_0x2c3445)){var _0x4e5870=toCsv(_0x2c3445);var _0x14a2ee=Date[_0xfce2('0x77')]();fs[_0xfce2('0x78')](util[_0xfce2('0x75')](_0xfce2('0x79'),_0x5a0551['id'],_0x14a2ee),_0x4e5870);_0x3d37fa[_0xfce2('0x7a')]('Content-disposition',_0xfce2('0x7b')+util[_0xfce2('0x75')](_0xfce2('0x7c'),_0x5a0551['id'],_0x14a2ee));_0x3d37fa[_0xfce2('0x7a')](_0xfce2('0x7d'),_0xfce2('0x7e'));return _0x3d37fa['download'](util['format'](_0xfce2('0x79'),_0x5a0551['id'],_0x14a2ee));}else{return _0x3d37fa[_0xfce2('0x1e')](0xcc);}})[_0xfce2('0x4a')](handleError(_0x3d37fa,null));};exports['addCustomField']=function(_0xb0ec3,_0x191219,_0x1bbc1d){var _0x299862;delete _0xb0ec3[_0xfce2('0x53')]['id'];return db[_0xfce2('0x45')][_0xfce2('0x61')]({'where':{'id':_0xb0ec3[_0xfce2('0x4c')]['id']}})[_0xfce2('0x2a')](handleEntityNotFound(_0x191219,null))['then'](function(_0xec3649){if(_0xec3649){return db[_0xfce2('0x7f')]['transaction'](function(_0x554cae){return db[_0xfce2('0x70')][_0xfce2('0x52')](_0xb0ec3[_0xfce2('0x53')],{'transaction':_0x554cae})[_0xfce2('0x2a')](function(_0x2814e1){_0x299862=_0x2814e1;return _0xec3649[_0xfce2('0x80')](_0x2814e1,{'transaction':_0x554cae});})[_0xfce2('0x2a')](function(){var _0x5ecf44={'type':db[_0xfce2('0x81')][_0xfce2('0x82')],'transaction':_0x554cae};switch(_0xb0ec3[_0xfce2('0x53')][_0xfce2('0x35')]){case _0xfce2('0x83'):_0x5ecf44['type']=db[_0xfce2('0x81')]['TEXT'];break;case _0xfce2('0x84'):_0x5ecf44[_0xfce2('0x35')]=db['Sequelize'][_0xfce2('0x85')];break;case'switch':_0x5ecf44['type']=db['Sequelize'][_0xfce2('0x86')];_0x5ecf44[_0xfce2('0x87')]=![];break;default:}return db[_0xfce2('0x7f')][_0xfce2('0x88')][_0xfce2('0x89')](_0xfce2('0x8a'),util[_0xfce2('0x75')]('cf_%s',_0x299862['id']),_0x5ecf44);})[_0xfce2('0x2a')](function(){return _0x299862;});});}})[_0xfce2('0x2a')](respondWithResult(_0x191219,null))[_0xfce2('0x4a')](handleError(_0x191219,null));};exports[_0xfce2('0x8b')]=function(_0x42f107,_0x4e9488,_0x4c2a53){var _0x2d7bca={};var _0x4a3495={};var _0x1cf029;var _0x2a4c7d;return db['CmList'][_0xfce2('0x61')]({'where':{'id':_0x42f107['params']['id']}})['then'](handleEntityNotFound(_0x4e9488,null))[_0xfce2('0x2a')](function(_0x2454fa){if(_0x2454fa){_0x1cf029=_0x2454fa;_0x4a3495[_0xfce2('0x37')]=_[_0xfce2('0x39')](db['CmCustomField'][_0xfce2('0x4d')]);_0x4a3495[_0xfce2('0x38')]=_[_0xfce2('0x39')](_0x42f107[_0xfce2('0x38')]);_0x4a3495[_0xfce2('0x41')]=_[_0xfce2('0x3b')](_0x4a3495[_0xfce2('0x37')],_0x4a3495[_0xfce2('0x38')]);_0x2d7bca[_0xfce2('0x3a')]=_['intersection'](_0x4a3495[_0xfce2('0x37')],qs[_0xfce2('0x4e')](_0x42f107['query'][_0xfce2('0x4e')]));_0x2d7bca['attributes']=_0x2d7bca[_0xfce2('0x3a')][_0xfce2('0x3c')]?_0x2d7bca[_0xfce2('0x3a')]:_0x4a3495[_0xfce2('0x37')];_0x2d7bca[_0xfce2('0x3e')]=qs[_0xfce2('0x3f')](_0x42f107[_0xfce2('0x38')][_0xfce2('0x3f')]);_0x2d7bca[_0xfce2('0x40')]=qs[_0xfce2('0x41')](_[_0xfce2('0x42')](_0x42f107['query'],_0x4a3495[_0xfce2('0x41')]));_0x2d7bca[_0xfce2('0x40')]=_[_0xfce2('0x4f')](_0x2d7bca[_0xfce2('0x40')],{'$or':[{'ListId':_0x2454fa['id']},{'ListId':null}]});if(_0x42f107['query']['filter']){_0x2d7bca['where']=_[_0xfce2('0x4f')](_0x2d7bca[_0xfce2('0x40')],{'$or':_[_0xfce2('0x33')](_0x2d7bca['attributes'],function(_0x1f6ecc){var _0x86fe65={};_0x86fe65[_0x1f6ecc]={'$like':'%'+_0x42f107[_0xfce2('0x38')][_0xfce2('0x43')]+'%'};return _0x86fe65;})});}_0x2d7bca=_[_0xfce2('0x4f')]({},_0x2d7bca,_0x42f107['options']);return db[_0xfce2('0x70')][_0xfce2('0x8c')](_0x2d7bca);}})[_0xfce2('0x2a')](respondWithResult(_0x4e9488,null))['catch'](handleError(_0x4e9488,null));};exports[_0xfce2('0x8d')]=function(_0x56bebd,_0x22fb96,_0x4bda3a){return db['CmList'][_0xfce2('0x51')]({'where':{'id':_0x56bebd['params']['id']}})[_0xfce2('0x2a')](handleEntityNotFound(_0x22fb96,null))[_0xfce2('0x2a')](function(_0x29c9f0){if(_0x29c9f0){return _0x29c9f0[_0xfce2('0x8d')](_0x56bebd[_0xfce2('0x53')][_0xfce2('0x63')],_[_0xfce2('0x8e')](_0x56bebd[_0xfce2('0x53')],['ids','id'])||{})[_0xfce2('0x8f')](function(_0x2622b6){for(var _0x1fb44b=0x0;_0x1fb44b<_0x56bebd[_0xfce2('0x53')][_0xfce2('0x63')][_0xfce2('0x3c')];_0x1fb44b+=0x1){socket['emit'](_0xfce2('0x90'),{'UserId':Number(_0x56bebd[_0xfce2('0x53')][_0xfce2('0x63')][_0x1fb44b]),'CmListId':Number(_0x56bebd['params']['id'])});}return _0x2622b6;});}})[_0xfce2('0x2a')](respondWithResult(_0x22fb96,null))[_0xfce2('0x4a')](handleError(_0x22fb96,null));};exports[_0xfce2('0x91')]=function(_0x1fbc1d,_0x12dca3,_0x3d344c){return db[_0xfce2('0x45')][_0xfce2('0x51')]({'where':{'id':_0x1fbc1d[_0xfce2('0x4c')]['id']}})['then'](handleEntityNotFound(_0x12dca3,null))['then'](function(_0xdec5ff){if(_0xdec5ff){return _0xdec5ff['removeAgents'](_0x1fbc1d[_0xfce2('0x38')][_0xfce2('0x63')])[_0xfce2('0x2a')](function(){if(_[_0xfce2('0x66')](_0x1fbc1d[_0xfce2('0x38')][_0xfce2('0x63')])){for(var _0x42296d=0x0;_0x42296d<_0x1fbc1d[_0xfce2('0x38')][_0xfce2('0x63')][_0xfce2('0x3c')];_0x42296d+=0x1){socket[_0xfce2('0x92')](_0xfce2('0x93'),{'UserId':Number(_0x1fbc1d['query'][_0xfce2('0x63')][_0x42296d]),'CmListId':Number(_0x1fbc1d['params']['id'])});}}else{socket[_0xfce2('0x92')](_0xfce2('0x93'),{'UserId':Number(_0x1fbc1d[_0xfce2('0x38')][_0xfce2('0x63')]),'CmListId':Number(_0x1fbc1d[_0xfce2('0x4c')]['id'])});}});}})['then'](respondWithStatusCode(_0x12dca3,null))[_0xfce2('0x4a')](handleError(_0x12dca3,null));};exports['getAgents']=function(_0x4afdeb,_0x3d7f10,_0x379a01){var _0x94627a={};var _0x16e7f9={};var _0x1e0050;var _0x3c77a5;return db[_0xfce2('0x45')][_0xfce2('0x61')]({'where':{'id':_0x4afdeb[_0xfce2('0x4c')]['id']}})[_0xfce2('0x2a')](handleEntityNotFound(_0x3d7f10,null))[_0xfce2('0x2a')](function(_0x5edd3b){if(_0x5edd3b){_0x1e0050=_0x5edd3b;_0x16e7f9[_0xfce2('0x37')]=_[_0xfce2('0x39')](db[_0xfce2('0x94')]['rawAttributes']);_0x16e7f9['query']=_['keys'](_0x4afdeb[_0xfce2('0x38')]);_0x16e7f9[_0xfce2('0x41')]=_[_0xfce2('0x3b')](_0x16e7f9[_0xfce2('0x37')],_0x16e7f9['query']);_0x94627a[_0xfce2('0x3a')]=_['intersection'](_0x16e7f9[_0xfce2('0x37')],qs['fields'](_0x4afdeb[_0xfce2('0x38')][_0xfce2('0x4e')]));_0x94627a[_0xfce2('0x3a')]=_0x94627a['attributes'][_0xfce2('0x3c')]?_0x94627a['attributes']:_0x16e7f9[_0xfce2('0x37')];_0x94627a['order']=qs[_0xfce2('0x3f')](_0x4afdeb[_0xfce2('0x38')][_0xfce2('0x3f')]);_0x94627a[_0xfce2('0x40')]=qs[_0xfce2('0x41')](_['pick'](_0x4afdeb[_0xfce2('0x38')],_0x16e7f9['filters']));if(_0x4afdeb[_0xfce2('0x38')][_0xfce2('0x43')]){_0x94627a[_0xfce2('0x40')]=_['merge'](_0x94627a[_0xfce2('0x40')],{'$or':_[_0xfce2('0x33')](_0x94627a[_0xfce2('0x3a')],function(_0x473a16){var _0x16fab3={};_0x16fab3[_0x473a16]={'$like':'%'+_0x4afdeb[_0xfce2('0x38')][_0xfce2('0x43')]+'%'};return _0x16fab3;})});}_0x94627a=_[_0xfce2('0x4f')]({},_0x94627a,_0x4afdeb[_0xfce2('0x50')]);return _0x1e0050['getAgents'](_0x94627a);}})[_0xfce2('0x2a')](function(_0xef645a){if(_0xef645a){_0x3c77a5=_0xef645a['length'];if(!_0x4afdeb[_0xfce2('0x38')][_0xfce2('0x62')](_0xfce2('0x3d'))){_0x94627a[_0xfce2('0x25')]=qs[_0xfce2('0x25')](_0x4afdeb['query'][_0xfce2('0x25')]);_0x94627a[_0xfce2('0x22')]=qs[_0xfce2('0x22')](_0x4afdeb[_0xfce2('0x38')][_0xfce2('0x22')]);}return _0x1e0050['getAgents'](_0x94627a);}})[_0xfce2('0x2a')](function(_0x39e142){if(_0x39e142){return _0x39e142?{'count':_0x3c77a5,'rows':_0x39e142}:null;}})[_0xfce2('0x2a')](respondWithResult(_0x3d7f10,null))['catch'](handleError(_0x3d7f10,null));}; \ No newline at end of file +var _0xc804=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./cmList.socket','sendStatus','end','status','json','limit','offset','count','set','Content-Range','apply','save','destroy','then','get','Lists','UserProfileResource','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','addDisposition','ListId','Disposition','getDispositions','findOne','sort','removeDispositions','addContacts','tags','isArray','push','each','CmContact','omit','ids','success','dataValues','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','format','hasOwnProperty','order','raw','getContactsCsv','concat','cf_%d','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','text/csv','download','sequelize','addCustomFields','TEXT','text','Sequelize','number','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs'];(function(_0x3d7c9e,_0x4b0158){var _0x5defda=function(_0x483c54){while(--_0x483c54){_0x3d7c9e['push'](_0x3d7c9e['shift']());}};_0x5defda(++_0x4b0158);}(_0xc804,0x82));var _0x4c80=function(_0x14dec9,_0xf3ac9c){_0x14dec9=_0x14dec9-0x0;var _0x5e9b01=_0xc804[_0x14dec9];return _0x5e9b01;};'use strict';var emlformat=require(_0x4c80('0x0'));var rimraf=require(_0x4c80('0x1'));var zipdir=require(_0x4c80('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4c80('0x3'));var moment=require(_0x4c80('0x4'));var BPromise=require(_0x4c80('0x5'));var Mustache=require(_0x4c80('0x6'));var util=require(_0x4c80('0x7'));var path=require(_0x4c80('0x8'));var sox=require(_0x4c80('0x9'));var csv=require(_0x4c80('0xa'));var ejs=require(_0x4c80('0xb'));var fs=require('fs');var fs_extra=require(_0x4c80('0xc'));var _=require(_0x4c80('0xd'));var squel=require(_0x4c80('0xe'));var crypto=require(_0x4c80('0xf'));var jsforce=require(_0x4c80('0x10'));var deskjs=require(_0x4c80('0x11'));var toCsv=require(_0x4c80('0xa'));var querystring=require(_0x4c80('0x12'));var Papa=require(_0x4c80('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4c80('0x14'));var as=require(_0x4c80('0x15'));var hardwareService=require(_0x4c80('0x16'));var logger=require(_0x4c80('0x17'))(_0x4c80('0x18'));var utils=require(_0x4c80('0x19'));var config=require(_0x4c80('0x1a'));var licenseUtil=require(_0x4c80('0x1b'));var db=require('../../mysqldb')['db'];config[_0x4c80('0x1c')]=_[_0x4c80('0x1d')](config[_0x4c80('0x1c')],{'host':_0x4c80('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4c80('0x1c')]));require(_0x4c80('0x1f'))['register'](socket);function respondWithStatusCode(_0x2d5cf0,_0x5b68e2){_0x5b68e2=_0x5b68e2||0xcc;return function(_0x35288b){if(_0x35288b){return _0x2d5cf0[_0x4c80('0x20')](_0x5b68e2);}return _0x2d5cf0['status'](_0x5b68e2)[_0x4c80('0x21')]();};}function respondWithResult(_0x1bf480,_0x420b49){_0x420b49=_0x420b49||0xc8;return function(_0x446986){if(_0x446986){return _0x1bf480[_0x4c80('0x22')](_0x420b49)[_0x4c80('0x23')](_0x446986);}};}function respondWithFilteredResult(_0x36255e,_0x242463){return function(_0x31d4e4){if(_0x31d4e4){var _0x470975=typeof _0x242463['offset']==='undefined'&&typeof _0x242463[_0x4c80('0x24')]==='undefined';var _0x4b0e0b=_0x31d4e4['count'];var _0x347cdc=_0x470975?0x0:_0x242463[_0x4c80('0x25')];var _0x555ee6=_0x470975?_0x31d4e4[_0x4c80('0x26')]:_0x242463[_0x4c80('0x25')]+_0x242463[_0x4c80('0x24')];var _0x19cfe7;if(_0x555ee6>=_0x4b0e0b){_0x555ee6=_0x4b0e0b;_0x19cfe7=0xc8;}else{_0x19cfe7=0xce;}_0x36255e['status'](_0x19cfe7);return _0x36255e[_0x4c80('0x27')](_0x4c80('0x28'),_0x347cdc+'-'+_0x555ee6+'/'+_0x4b0e0b)[_0x4c80('0x23')](_0x31d4e4);}return null;};}function patchUpdates(_0x1e3425){return function(_0x3a8558){try{jsonpatch[_0x4c80('0x29')](_0x3a8558,_0x1e3425,!![]);}catch(_0x5f2310){return BPromise['reject'](_0x5f2310);}return _0x3a8558[_0x4c80('0x2a')]();};}function saveUpdates(_0x2dd03d,_0x31a6c7){return function(_0x5e3bd3){if(_0x5e3bd3){return _0x5e3bd3['update'](_0x2dd03d)['then'](function(_0xd0c827){return _0xd0c827;});}return null;};}function removeEntity(_0x297962,_0x46fe05){return function(_0x17f41e){if(_0x17f41e){return _0x17f41e[_0x4c80('0x2b')]()[_0x4c80('0x2c')](function(){var _0xb36a05=_0x17f41e[_0x4c80('0x2d')]({'plain':!![]});var _0x4dbb56=_0x4c80('0x2e');return db[_0x4c80('0x2f')][_0x4c80('0x2b')]({'where':{'type':_0x4dbb56,'resourceId':_0xb36a05['id']}})[_0x4c80('0x2c')](function(){return _0x17f41e;});})[_0x4c80('0x2c')](function(){_0x297962[_0x4c80('0x22')](0xcc)[_0x4c80('0x21')]();});}};}function handleEntityNotFound(_0x49025a,_0x33c44f){return function(_0x52542c){if(!_0x52542c){_0x49025a[_0x4c80('0x20')](0x194);}return _0x52542c;};}function handleError(_0x5dedf0,_0x4b9da6){_0x4b9da6=_0x4b9da6||0x1f4;return function(_0x215e46){logger['error'](_0x215e46[_0x4c80('0x30')]);if(_0x215e46[_0x4c80('0x31')]){delete _0x215e46['name'];}_0x5dedf0['status'](_0x4b9da6)[_0x4c80('0x32')](_0x215e46);};}exports[_0x4c80('0x33')]=function(_0x3b05fc,_0x44dfe1){var _0x1c3758={},_0x169a66={},_0x4109bd={'count':0x0,'rows':[]};var _0x82fc2a=_[_0x4c80('0x34')](db[_0x4c80('0x35')][_0x4c80('0x36')],function(_0x2a4c31){return{'name':_0x2a4c31[_0x4c80('0x37')],'type':_0x2a4c31[_0x4c80('0x38')][_0x4c80('0x39')]};});_0x169a66[_0x4c80('0x3a')]=_[_0x4c80('0x34')](_0x82fc2a,_0x4c80('0x31'));_0x169a66[_0x4c80('0x3b')]=_[_0x4c80('0x3c')](_0x3b05fc[_0x4c80('0x3b')]);_0x169a66[_0x4c80('0x3d')]=_[_0x4c80('0x3e')](_0x169a66[_0x4c80('0x3a')],_0x169a66['query']);_0x1c3758['attributes']=_['intersection'](_0x169a66[_0x4c80('0x3a')],qs['fields'](_0x3b05fc[_0x4c80('0x3b')][_0x4c80('0x3f')]));_0x1c3758[_0x4c80('0x40')]=_0x1c3758[_0x4c80('0x40')][_0x4c80('0x41')]?_0x1c3758['attributes']:_0x169a66['model'];if(!_0x3b05fc[_0x4c80('0x3b')]['hasOwnProperty'](_0x4c80('0x42'))){_0x1c3758[_0x4c80('0x24')]=qs['limit'](_0x3b05fc[_0x4c80('0x3b')][_0x4c80('0x24')]);_0x1c3758[_0x4c80('0x25')]=qs['offset'](_0x3b05fc[_0x4c80('0x3b')]['offset']);}_0x1c3758['order']=qs['sort'](_0x3b05fc['query']['sort']);_0x1c3758['where']=qs[_0x4c80('0x3d')](_[_0x4c80('0x43')](_0x3b05fc[_0x4c80('0x3b')],_0x169a66[_0x4c80('0x3d')]),_0x82fc2a);if(_0x3b05fc[_0x4c80('0x3b')][_0x4c80('0x44')]){_0x1c3758[_0x4c80('0x45')]=_[_0x4c80('0x46')](_0x1c3758[_0x4c80('0x45')],{'$or':_[_0x4c80('0x34')](_0x82fc2a,function(_0x3a817d){if(_0x3a817d[_0x4c80('0x38')]!==_0x4c80('0x47')){var _0x268e5a={};_0x268e5a[_0x3a817d[_0x4c80('0x31')]]={'$like':'%'+_0x3b05fc[_0x4c80('0x3b')]['filter']+'%'};return _0x268e5a;}})});}_0x1c3758=_['merge']({},_0x1c3758,_0x3b05fc[_0x4c80('0x48')]);var _0x174507={'where':_0x1c3758[_0x4c80('0x45')]};return db['CmList'][_0x4c80('0x26')](_0x174507)['then'](function(_0x53b53){_0x4109bd[_0x4c80('0x26')]=_0x53b53;if(_0x3b05fc[_0x4c80('0x3b')][_0x4c80('0x49')]){_0x1c3758[_0x4c80('0x4a')]=[{'all':!![]}];}return db[_0x4c80('0x35')][_0x4c80('0x4b')](_0x1c3758);})[_0x4c80('0x2c')](function(_0x621843){_0x4109bd[_0x4c80('0x4c')]=_0x621843;return _0x4109bd;})[_0x4c80('0x2c')](respondWithFilteredResult(_0x44dfe1,_0x1c3758))[_0x4c80('0x4d')](handleError(_0x44dfe1,null));};exports[_0x4c80('0x4e')]=function(_0x325bca,_0x596035){var _0x122a14={'raw':![],'where':{'id':_0x325bca['params']['id']}},_0x356d4e={};_0x356d4e[_0x4c80('0x3a')]=_['keys'](db[_0x4c80('0x35')][_0x4c80('0x36')]);_0x356d4e['query']=_[_0x4c80('0x3c')](_0x325bca[_0x4c80('0x3b')]);_0x356d4e[_0x4c80('0x3d')]=_[_0x4c80('0x3e')](_0x356d4e[_0x4c80('0x3a')],_0x356d4e['query']);_0x122a14['attributes']=_[_0x4c80('0x3e')](_0x356d4e[_0x4c80('0x3a')],qs['fields'](_0x325bca['query']['fields']));_0x122a14[_0x4c80('0x40')]=_0x122a14[_0x4c80('0x40')][_0x4c80('0x41')]?_0x122a14[_0x4c80('0x40')]:_0x356d4e[_0x4c80('0x3a')];if(_0x325bca[_0x4c80('0x3b')]['includeAll']){_0x122a14[_0x4c80('0x4a')]=[{'all':!![]}];}_0x122a14=_[_0x4c80('0x46')]({},_0x122a14,_0x325bca[_0x4c80('0x48')]);return db[_0x4c80('0x35')][_0x4c80('0x4f')](_0x122a14)['then'](handleEntityNotFound(_0x596035,null))['then'](respondWithResult(_0x596035,null))[_0x4c80('0x4d')](handleError(_0x596035,null));};exports['create']=function(_0xd72833,_0x294b73){return db[_0x4c80('0x35')][_0x4c80('0x50')](_0xd72833[_0x4c80('0x51')],{})[_0x4c80('0x2c')](function(_0x1a45db){var _0x59368b=_0xd72833[_0x4c80('0x52')][_0x4c80('0x2d')]({'plain':!![]});if(!_0x59368b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x59368b[_0x4c80('0x53')]==='user'){var _0x653ef1=_0x1a45db['get']({'plain':!![]});var _0x345806=_0x4c80('0x2e');return db[_0x4c80('0x54')]['find']({'where':{'name':_0x345806,'userProfileId':_0x59368b[_0x4c80('0x55')]},'raw':!![]})['then'](function(_0x5ea3d7){if(_0x5ea3d7&&_0x5ea3d7[_0x4c80('0x56')]===0x0){return db[_0x4c80('0x2f')][_0x4c80('0x50')]({'name':_0x653ef1[_0x4c80('0x31')],'resourceId':_0x653ef1['id'],'type':_0x5ea3d7[_0x4c80('0x31')],'sectionId':_0x5ea3d7['id']},{})['then'](function(){return _0x1a45db;});}else{return _0x1a45db;}})[_0x4c80('0x4d')](function(_0x3d19a4){logger[_0x4c80('0x57')](_0x4c80('0x58'),_0x3d19a4);throw _0x3d19a4;});}return _0x1a45db;})[_0x4c80('0x2c')](respondWithResult(_0x294b73,0xc9))[_0x4c80('0x4d')](handleError(_0x294b73,null));};exports[_0x4c80('0x59')]=function(_0x57756d,_0x19b907){if(_0x57756d[_0x4c80('0x51')]['id']){delete _0x57756d[_0x4c80('0x51')]['id'];}return db[_0x4c80('0x35')][_0x4c80('0x4f')]({'where':{'id':_0x57756d['params']['id']}})[_0x4c80('0x2c')](handleEntityNotFound(_0x19b907,null))[_0x4c80('0x2c')](saveUpdates(_0x57756d[_0x4c80('0x51')],null))[_0x4c80('0x2c')](respondWithResult(_0x19b907,null))[_0x4c80('0x4d')](handleError(_0x19b907,null));};exports[_0x4c80('0x2b')]=function(_0x22ee5e,_0x12a70f){return db['CmList']['find']({'where':{'id':_0x22ee5e[_0x4c80('0x5a')]['id']}})[_0x4c80('0x2c')](handleEntityNotFound(_0x12a70f,null))[_0x4c80('0x2c')](removeEntity(_0x12a70f,null))[_0x4c80('0x4d')](handleError(_0x12a70f,null));};exports['describe']=function(_0x425a91,_0x48fea1){return db[_0x4c80('0x35')][_0x4c80('0x5b')]()[_0x4c80('0x2c')](respondWithResult(_0x48fea1,null))[_0x4c80('0x4d')](handleError(_0x48fea1,null));};exports[_0x4c80('0x5c')]=function(_0x277d76,_0x3a526f,_0x485e2f){if(_0x277d76[_0x4c80('0x51')]['id']){delete _0x277d76[_0x4c80('0x51')]['id'];}return db[_0x4c80('0x35')][_0x4c80('0x4f')]({'where':{'id':_0x277d76[_0x4c80('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3a526f,null))[_0x4c80('0x2c')](function(_0x50721d){if(_0x50721d){_0x277d76['body'][_0x4c80('0x5d')]=_0x50721d['id'];return db[_0x4c80('0x5e')][_0x4c80('0x50')](_0x277d76[_0x4c80('0x51')]);}})[_0x4c80('0x2c')](respondWithResult(_0x3a526f,null))[_0x4c80('0x4d')](handleError(_0x3a526f,null));};exports[_0x4c80('0x5f')]=function(_0xa2d8a5,_0xf7a6b0,_0x1e8d16){var _0x274354={'raw':![],'where':{}};var _0x1c74b4={};var _0x431763={'count':0x0,'rows':[]};return db[_0x4c80('0x35')][_0x4c80('0x60')]({'where':{'id':_0xa2d8a5['params']['id']}})[_0x4c80('0x2c')](handleEntityNotFound(_0xf7a6b0,null))[_0x4c80('0x2c')](function(_0x1a0e88){if(_0x1a0e88){_0x1c74b4[_0x4c80('0x3a')]=_[_0x4c80('0x3c')](db[_0x4c80('0x5e')][_0x4c80('0x36')]);_0x1c74b4['query']=_[_0x4c80('0x3c')](_0xa2d8a5[_0x4c80('0x3b')]);_0x1c74b4['filters']=_['intersection'](_0x1c74b4['model'],_0x1c74b4[_0x4c80('0x3b')]);_0x274354[_0x4c80('0x40')]=_[_0x4c80('0x3e')](_0x1c74b4['model'],qs[_0x4c80('0x3f')](_0xa2d8a5[_0x4c80('0x3b')][_0x4c80('0x3f')]));_0x274354[_0x4c80('0x40')]=_0x274354[_0x4c80('0x40')][_0x4c80('0x41')]?_0x274354[_0x4c80('0x40')]:_0x1c74b4['model'];if(!_0xa2d8a5[_0x4c80('0x3b')]['hasOwnProperty'](_0x4c80('0x42'))){_0x274354['limit']=qs[_0x4c80('0x24')](_0xa2d8a5[_0x4c80('0x3b')][_0x4c80('0x24')]);_0x274354[_0x4c80('0x25')]=qs[_0x4c80('0x25')](_0xa2d8a5[_0x4c80('0x3b')][_0x4c80('0x25')]);}_0x274354['order']=qs['sort'](_0xa2d8a5[_0x4c80('0x3b')][_0x4c80('0x61')]);_0x274354['where']=qs['filters'](_['pick'](_0xa2d8a5[_0x4c80('0x3b')],_0x1c74b4[_0x4c80('0x3d')]));_0x274354['where'][_0x4c80('0x5d')]=_0x1a0e88['id'];if(_0xa2d8a5[_0x4c80('0x3b')][_0x4c80('0x44')]){_0x274354['where']=_['merge'](_0x274354[_0x4c80('0x45')],{'$or':_[_0x4c80('0x34')](_0x274354[_0x4c80('0x40')],function(_0x4440dc){var _0x31059c={};_0x31059c[_0x4440dc]={'$like':'%'+_0xa2d8a5['query'][_0x4c80('0x44')]+'%'};return _0x31059c;})});}_0x274354=_['merge']({},_0x274354,_0xa2d8a5[_0x4c80('0x48')]);return db[_0x4c80('0x5e')][_0x4c80('0x26')]({'where':_0x274354['where']})[_0x4c80('0x2c')](function(_0x4b0fa5){_0x431763['count']=_0x4b0fa5;if(_0xa2d8a5[_0x4c80('0x3b')][_0x4c80('0x49')]){_0x274354['include']=[{'all':!![]}];}return db[_0x4c80('0x5e')][_0x4c80('0x4b')](_0x274354);})[_0x4c80('0x2c')](function(_0x401c10){_0x431763[_0x4c80('0x4c')]=_0x401c10;return _0x431763;});}})[_0x4c80('0x2c')](respondWithFilteredResult(_0xf7a6b0,_0x274354))[_0x4c80('0x4d')](handleError(_0xf7a6b0,null));};exports[_0x4c80('0x62')]=function(_0x1926e9,_0x25e625,_0x3d0fed){return db[_0x4c80('0x35')]['find']({'where':{'id':_0x1926e9[_0x4c80('0x5a')]['id']}})[_0x4c80('0x2c')](handleEntityNotFound(_0x25e625,null))[_0x4c80('0x2c')](function(_0x2486ad){if(_0x2486ad){return _0x2486ad['removeDispositions'](_0x1926e9[_0x4c80('0x3b')]['ids']);}})['then'](respondWithStatusCode(_0x25e625,null))[_0x4c80('0x4d')](handleError(_0x25e625,null));};exports[_0x4c80('0x63')]=function(_0x1e684d,_0x53ebf6,_0x40002c){return db[_0x4c80('0x35')][_0x4c80('0x4f')]({'where':{'id':_0x1e684d[_0x4c80('0x5a')]['id']}})[_0x4c80('0x2c')](handleEntityNotFound(_0x53ebf6,null))['then'](function(_0x47cc42){if(_0x47cc42){var _0x403a4c=[];var _0x26cf81={'success':[],'errors':[]};return db['CmContact']['describe']()['then'](function(_0x381369){if(_0x1e684d['body'][_0x4c80('0x64')]&&_[_0x4c80('0x65')](_0x1e684d['body'][_0x4c80('0x64')])){if(_0x1e684d[_0x4c80('0x51')][_0x4c80('0x64')][_0x4c80('0x41')]){_0x1e684d['body'][_0x4c80('0x64')]=_0x1e684d[_0x4c80('0x51')]['tags']['join'](';')+';';}else{_0x1e684d[_0x4c80('0x51')]['tags']=null;}}else{_0x1e684d[_0x4c80('0x51')][_0x4c80('0x64')]=null;}if(_0x1e684d[_0x4c80('0x51')]&&_[_0x4c80('0x65')](_0x1e684d['body'])){for(var _0x47564e=0x0;_0x47564e<_0x1e684d[_0x4c80('0x51')]['length'];_0x47564e+=0x1){_0x1e684d[_0x4c80('0x51')][_0x47564e]['ListId']=_0x1e684d[_0x4c80('0x5a')]['id'];_0x403a4c[_0x4c80('0x66')](_0x1e684d[_0x4c80('0x51')][_0x47564e]);}return BPromise[_0x4c80('0x67')](_0x403a4c,function(_0x111bd7){return db[_0x4c80('0x68')][_0x4c80('0x50')](_[_0x4c80('0x69')](_0x111bd7,[_0x4c80('0x6a'),'id'])||{},{'fields':_[_0x4c80('0x3c')](_0x381369),'raw':!![]})['then'](function(_0x3a8d7f){_0x26cf81[_0x4c80('0x6b')][_0x4c80('0x66')](_0x3a8d7f[_0x4c80('0x6c')]);})[_0x4c80('0x4d')](function(_0x466a70){_0x26cf81['errors'][_0x4c80('0x66')]({'data':_0x111bd7,'error':_0x466a70[_0x4c80('0x6d')]});});})[_0x4c80('0x2c')](function(_0x1196ca){return _0x26cf81;})[_0x4c80('0x4d')](function(_0x3291f2){return _0x3291f2;});}else{_0x53ebf6['status'](0x190)[_0x4c80('0x23')]({'message':_0x4c80('0x6e')});}});}})[_0x4c80('0x2c')](respondWithResult(_0x53ebf6,null))[_0x4c80('0x4d')](handleError(_0x53ebf6,null));};exports[_0x4c80('0x6f')]=function(_0xfe1e7a,_0x2f8bf0,_0x2a73f8){var _0x171c2b;return db[_0x4c80('0x35')][_0x4c80('0x4f')]({'where':{'id':_0xfe1e7a[_0x4c80('0x5a')]['id']},'include':[{'model':db[_0x4c80('0x70')],'as':_0x4c80('0x71')}]})[_0x4c80('0x2c')](handleEntityNotFound(_0x2f8bf0,null))[_0x4c80('0x2c')](function(_0x12a639){if(_0x12a639){_0x171c2b=_0x12a639;return db[_0x4c80('0x68')][_0x4c80('0x36')];}})[_0x4c80('0x2c')](function(_0x3bd990){if(_0x3bd990){var _0x3e2772={};var _0x1f15e0={};_0x1f15e0['model']=_['concat'](_[_0x4c80('0x3c')](_0x3bd990),_['map'](_0x171c2b[_0x4c80('0x71')],function(_0x51957c){return util[_0x4c80('0x72')]('cf_%d',_0x51957c['id']);}));_0x1f15e0[_0x4c80('0x3b')]=_[_0x4c80('0x3c')](_0xfe1e7a['query']);_0x1f15e0[_0x4c80('0x3d')]=_[_0x4c80('0x3e')](_0x1f15e0[_0x4c80('0x3a')],_0x1f15e0['query']);_0x3e2772[_0x4c80('0x40')]=_['intersection'](_0x1f15e0[_0x4c80('0x3a')],qs[_0x4c80('0x3f')](_0xfe1e7a[_0x4c80('0x3b')][_0x4c80('0x3f')]));_0x3e2772['attributes']=_0x3e2772[_0x4c80('0x40')][_0x4c80('0x41')]?_0x3e2772['attributes']:_0x1f15e0['model'];if(!_0xfe1e7a[_0x4c80('0x3b')][_0x4c80('0x73')]('nolimit')){_0x3e2772[_0x4c80('0x24')]=qs[_0x4c80('0x24')](_0xfe1e7a['query'][_0x4c80('0x24')]);_0x3e2772[_0x4c80('0x25')]=qs[_0x4c80('0x25')](_0xfe1e7a[_0x4c80('0x3b')]['offset']);}_0x3e2772[_0x4c80('0x74')]=qs[_0x4c80('0x61')](_0xfe1e7a[_0x4c80('0x3b')][_0x4c80('0x61')]);_0x3e2772['where']=qs[_0x4c80('0x3d')](_['pick'](_0xfe1e7a[_0x4c80('0x3b')],_0x1f15e0[_0x4c80('0x3d')]));_0x3e2772[_0x4c80('0x75')]=!![];if(_0xfe1e7a[_0x4c80('0x3b')]['filter']){_0x3e2772[_0x4c80('0x45')]=_[_0x4c80('0x46')](_0x3e2772[_0x4c80('0x45')],{'$or':_[_0x4c80('0x34')](_0x3e2772[_0x4c80('0x40')],function(_0x13b5e8){var _0x36ed70={};_0x36ed70[_0x13b5e8]={'$like':'%'+_0xfe1e7a[_0x4c80('0x3b')]['filter']+'%'};return _0x36ed70;})});}_0x3e2772=_['merge']({},_0x3e2772,_0xfe1e7a[_0x4c80('0x48')]);return _0x171c2b['getContacts'](_0x3e2772);}})[_0x4c80('0x2c')](respondWithResult(_0x2f8bf0,null))[_0x4c80('0x4d')](handleError(_0x2f8bf0,null));};exports[_0x4c80('0x76')]=function(_0x50d5dc,_0x5544c6,_0xf84f55){var _0x2fbc93;return db[_0x4c80('0x35')][_0x4c80('0x4f')]({'where':{'id':_0x50d5dc['params']['id']},'include':[{'model':db[_0x4c80('0x70')],'as':_0x4c80('0x71')}]})['then'](handleEntityNotFound(_0x5544c6,null))[_0x4c80('0x2c')](function(_0x1e31bf){if(_0x1e31bf){_0x2fbc93=_0x1e31bf;return db[_0x4c80('0x68')][_0x4c80('0x36')];}})[_0x4c80('0x2c')](function(_0x4971dd){if(_0x4971dd){var _0x522c7f={};var _0x5e200={};_0x5e200['model']=_[_0x4c80('0x77')](_['keys'](_0x4971dd),_[_0x4c80('0x34')](_0x2fbc93[_0x4c80('0x71')],function(_0x7f763f){return util['format'](_0x4c80('0x78'),_0x7f763f['id']);}));_0x5e200[_0x4c80('0x3b')]=_[_0x4c80('0x3c')](_0x50d5dc['query']);_0x5e200[_0x4c80('0x3d')]=_[_0x4c80('0x3e')](_0x5e200[_0x4c80('0x3a')],_0x5e200[_0x4c80('0x3b')]);_0x522c7f[_0x4c80('0x40')]=_['intersection'](_0x5e200['model'],qs[_0x4c80('0x3f')](_0x50d5dc[_0x4c80('0x3b')][_0x4c80('0x3f')]));_0x522c7f[_0x4c80('0x40')]=_0x522c7f[_0x4c80('0x40')]['length']?_0x522c7f[_0x4c80('0x40')]:_0x5e200[_0x4c80('0x3a')];if(!_0x50d5dc[_0x4c80('0x3b')][_0x4c80('0x73')](_0x4c80('0x42'))){_0x522c7f[_0x4c80('0x24')]=qs[_0x4c80('0x24')](_0x50d5dc[_0x4c80('0x3b')][_0x4c80('0x24')]);_0x522c7f[_0x4c80('0x25')]=qs[_0x4c80('0x25')](_0x50d5dc[_0x4c80('0x3b')][_0x4c80('0x25')]);}_0x522c7f[_0x4c80('0x74')]=qs[_0x4c80('0x61')](_0x50d5dc['query']['sort']);_0x522c7f['where']=qs[_0x4c80('0x3d')](_[_0x4c80('0x43')](_0x50d5dc['query'],_0x5e200[_0x4c80('0x3d')]));_0x522c7f[_0x4c80('0x75')]=!![];if(_0x50d5dc[_0x4c80('0x3b')][_0x4c80('0x44')]){_0x522c7f[_0x4c80('0x45')]=_[_0x4c80('0x46')](_0x522c7f[_0x4c80('0x45')],{'$or':_[_0x4c80('0x34')](_0x522c7f[_0x4c80('0x40')],function(_0xe49ea6){var _0x19f6c0={};_0x19f6c0[_0xe49ea6]={'$like':'%'+_0x50d5dc[_0x4c80('0x3b')]['filter']+'%'};return _0x19f6c0;})});}_0x522c7f=_['merge']({},_0x522c7f,_0x50d5dc[_0x4c80('0x48')]);return _0x2fbc93[_0x4c80('0x6f')](_0x522c7f);}})[_0x4c80('0x2c')](function(_0x2ed7d0){if(!_['isEmpty'](_0x2ed7d0)){var _0x4a22f7=toCsv(_0x2ed7d0);var _0x274c0a=Date[_0x4c80('0x79')]();fs[_0x4c80('0x7a')](util[_0x4c80('0x72')](_0x4c80('0x7b'),_0x2fbc93['id'],_0x274c0a),_0x4a22f7);_0x5544c6[_0x4c80('0x7c')](_0x4c80('0x7d'),_0x4c80('0x7e')+util[_0x4c80('0x72')](_0x4c80('0x7f'),_0x2fbc93['id'],_0x274c0a));_0x5544c6['setHeader']('Content-type',_0x4c80('0x80'));return _0x5544c6[_0x4c80('0x81')](util['format'](_0x4c80('0x7b'),_0x2fbc93['id'],_0x274c0a));}else{return _0x5544c6[_0x4c80('0x20')](0xcc);}})['catch'](handleError(_0x5544c6,null));};exports['addCustomField']=function(_0x49b5e5,_0x39088f,_0x3de42b){var _0x39e92b;delete _0x49b5e5[_0x4c80('0x51')]['id'];return db[_0x4c80('0x35')]['findOne']({'where':{'id':_0x49b5e5[_0x4c80('0x5a')]['id']}})['then'](handleEntityNotFound(_0x39088f,null))[_0x4c80('0x2c')](function(_0x57d998){if(_0x57d998){return db[_0x4c80('0x82')]['transaction'](function(_0x377529){return db[_0x4c80('0x70')]['create'](_0x49b5e5[_0x4c80('0x51')],{'transaction':_0x377529})[_0x4c80('0x2c')](function(_0x48ee7a){_0x39e92b=_0x48ee7a;return _0x57d998[_0x4c80('0x83')](_0x48ee7a,{'transaction':_0x377529});})['then'](function(){var _0xb93d8d={'type':db['Sequelize'][_0x4c80('0x84')],'transaction':_0x377529};switch(_0x49b5e5[_0x4c80('0x51')][_0x4c80('0x38')]){case _0x4c80('0x85'):_0xb93d8d[_0x4c80('0x38')]=db[_0x4c80('0x86')][_0x4c80('0x84')];break;case _0x4c80('0x87'):_0xb93d8d[_0x4c80('0x38')]=db[_0x4c80('0x86')]['INTEGER'];break;case _0x4c80('0x88'):_0xb93d8d[_0x4c80('0x38')]=db[_0x4c80('0x86')][_0x4c80('0x89')];_0xb93d8d[_0x4c80('0x8a')]=![];break;default:}return db[_0x4c80('0x82')][_0x4c80('0x8b')][_0x4c80('0x8c')](_0x4c80('0x8d'),util[_0x4c80('0x72')](_0x4c80('0x8e'),_0x39e92b['id']),_0xb93d8d);})['then'](function(){return _0x39e92b;});});}})[_0x4c80('0x2c')](respondWithResult(_0x39088f,null))[_0x4c80('0x4d')](handleError(_0x39088f,null));};exports[_0x4c80('0x8f')]=function(_0x52b859,_0x395c1b,_0x4574cf){var _0x1ba8e7={};var _0x3faacb={};var _0x40704a;var _0x11976f;return db['CmList'][_0x4c80('0x60')]({'where':{'id':_0x52b859[_0x4c80('0x5a')]['id']}})['then'](handleEntityNotFound(_0x395c1b,null))[_0x4c80('0x2c')](function(_0x3011a3){if(_0x3011a3){_0x40704a=_0x3011a3;_0x3faacb['model']=_[_0x4c80('0x3c')](db[_0x4c80('0x70')]['rawAttributes']);_0x3faacb['query']=_[_0x4c80('0x3c')](_0x52b859[_0x4c80('0x3b')]);_0x3faacb[_0x4c80('0x3d')]=_['intersection'](_0x3faacb[_0x4c80('0x3a')],_0x3faacb[_0x4c80('0x3b')]);_0x1ba8e7[_0x4c80('0x40')]=_[_0x4c80('0x3e')](_0x3faacb[_0x4c80('0x3a')],qs[_0x4c80('0x3f')](_0x52b859[_0x4c80('0x3b')][_0x4c80('0x3f')]));_0x1ba8e7[_0x4c80('0x40')]=_0x1ba8e7[_0x4c80('0x40')][_0x4c80('0x41')]?_0x1ba8e7[_0x4c80('0x40')]:_0x3faacb[_0x4c80('0x3a')];_0x1ba8e7[_0x4c80('0x74')]=qs[_0x4c80('0x61')](_0x52b859[_0x4c80('0x3b')]['sort']);_0x1ba8e7[_0x4c80('0x45')]=qs['filters'](_[_0x4c80('0x43')](_0x52b859[_0x4c80('0x3b')],_0x3faacb[_0x4c80('0x3d')]));_0x1ba8e7[_0x4c80('0x45')]=_[_0x4c80('0x46')](_0x1ba8e7['where'],{'$or':[{'ListId':_0x3011a3['id']},{'ListId':null}]});if(_0x52b859[_0x4c80('0x3b')][_0x4c80('0x44')]){_0x1ba8e7[_0x4c80('0x45')]=_[_0x4c80('0x46')](_0x1ba8e7[_0x4c80('0x45')],{'$or':_['map'](_0x1ba8e7[_0x4c80('0x40')],function(_0x24f500){var _0x53ccf9={};_0x53ccf9[_0x24f500]={'$like':'%'+_0x52b859['query'][_0x4c80('0x44')]+'%'};return _0x53ccf9;})});}_0x1ba8e7=_[_0x4c80('0x46')]({},_0x1ba8e7,_0x52b859[_0x4c80('0x48')]);return db[_0x4c80('0x70')][_0x4c80('0x90')](_0x1ba8e7);}})[_0x4c80('0x2c')](respondWithResult(_0x395c1b,null))[_0x4c80('0x4d')](handleError(_0x395c1b,null));};exports['addAgents']=function(_0x3ef2a8,_0xecfacb,_0x2f9d74){return db['CmList'][_0x4c80('0x4f')]({'where':{'id':_0x3ef2a8[_0x4c80('0x5a')]['id']}})[_0x4c80('0x2c')](handleEntityNotFound(_0xecfacb,null))['then'](function(_0x134d53){if(_0x134d53){return _0x134d53[_0x4c80('0x91')](_0x3ef2a8['body'][_0x4c80('0x6a')],_['omit'](_0x3ef2a8[_0x4c80('0x51')],[_0x4c80('0x6a'),'id'])||{})['spread'](function(_0x10ae80){for(var _0xbdb5a3=0x0;_0xbdb5a3<_0x3ef2a8[_0x4c80('0x51')][_0x4c80('0x6a')]['length'];_0xbdb5a3+=0x1){socket[_0x4c80('0x92')](_0x4c80('0x93'),{'UserId':Number(_0x3ef2a8[_0x4c80('0x51')][_0x4c80('0x6a')][_0xbdb5a3]),'CmListId':Number(_0x3ef2a8[_0x4c80('0x5a')]['id'])});}return _0x10ae80;});}})['then'](respondWithResult(_0xecfacb,null))['catch'](handleError(_0xecfacb,null));};exports[_0x4c80('0x94')]=function(_0x35a617,_0x31e41c,_0x2ad110){return db[_0x4c80('0x35')][_0x4c80('0x4f')]({'where':{'id':_0x35a617[_0x4c80('0x5a')]['id']}})[_0x4c80('0x2c')](handleEntityNotFound(_0x31e41c,null))[_0x4c80('0x2c')](function(_0x1c5455){if(_0x1c5455){return _0x1c5455[_0x4c80('0x94')](_0x35a617[_0x4c80('0x3b')]['ids'])[_0x4c80('0x2c')](function(){if(_['isArray'](_0x35a617[_0x4c80('0x3b')]['ids'])){for(var _0x2ec017=0x0;_0x2ec017<_0x35a617['query'][_0x4c80('0x6a')][_0x4c80('0x41')];_0x2ec017+=0x1){socket[_0x4c80('0x92')](_0x4c80('0x95'),{'UserId':Number(_0x35a617[_0x4c80('0x3b')][_0x4c80('0x6a')][_0x2ec017]),'CmListId':Number(_0x35a617['params']['id'])});}}else{socket[_0x4c80('0x92')](_0x4c80('0x95'),{'UserId':Number(_0x35a617[_0x4c80('0x3b')]['ids']),'CmListId':Number(_0x35a617[_0x4c80('0x5a')]['id'])});}});}})[_0x4c80('0x2c')](respondWithStatusCode(_0x31e41c,null))[_0x4c80('0x4d')](handleError(_0x31e41c,null));};exports[_0x4c80('0x96')]=function(_0xb98230,_0x1987d7,_0x590f8f){var _0x58756c={};var _0x598a02={};var _0x7ab1a8;var _0x43fa7c;return db[_0x4c80('0x35')][_0x4c80('0x60')]({'where':{'id':_0xb98230['params']['id']}})[_0x4c80('0x2c')](handleEntityNotFound(_0x1987d7,null))[_0x4c80('0x2c')](function(_0x27071a){if(_0x27071a){_0x7ab1a8=_0x27071a;_0x598a02['model']=_[_0x4c80('0x3c')](db['User'][_0x4c80('0x36')]);_0x598a02[_0x4c80('0x3b')]=_[_0x4c80('0x3c')](_0xb98230[_0x4c80('0x3b')]);_0x598a02[_0x4c80('0x3d')]=_[_0x4c80('0x3e')](_0x598a02[_0x4c80('0x3a')],_0x598a02['query']);_0x58756c[_0x4c80('0x40')]=_[_0x4c80('0x3e')](_0x598a02['model'],qs[_0x4c80('0x3f')](_0xb98230[_0x4c80('0x3b')][_0x4c80('0x3f')]));_0x58756c[_0x4c80('0x40')]=_0x58756c[_0x4c80('0x40')][_0x4c80('0x41')]?_0x58756c[_0x4c80('0x40')]:_0x598a02[_0x4c80('0x3a')];_0x58756c[_0x4c80('0x74')]=qs[_0x4c80('0x61')](_0xb98230[_0x4c80('0x3b')][_0x4c80('0x61')]);_0x58756c['where']=qs[_0x4c80('0x3d')](_[_0x4c80('0x43')](_0xb98230['query'],_0x598a02[_0x4c80('0x3d')]));if(_0xb98230[_0x4c80('0x3b')]['filter']){_0x58756c['where']=_['merge'](_0x58756c['where'],{'$or':_[_0x4c80('0x34')](_0x58756c[_0x4c80('0x40')],function(_0x345036){var _0x9cdf7c={};_0x9cdf7c[_0x345036]={'$like':'%'+_0xb98230[_0x4c80('0x3b')][_0x4c80('0x44')]+'%'};return _0x9cdf7c;})});}_0x58756c=_[_0x4c80('0x46')]({},_0x58756c,_0xb98230[_0x4c80('0x48')]);return _0x7ab1a8[_0x4c80('0x96')](_0x58756c);}})[_0x4c80('0x2c')](function(_0x54830b){if(_0x54830b){_0x43fa7c=_0x54830b[_0x4c80('0x41')];if(!_0xb98230[_0x4c80('0x3b')][_0x4c80('0x73')](_0x4c80('0x42'))){_0x58756c[_0x4c80('0x24')]=qs[_0x4c80('0x24')](_0xb98230[_0x4c80('0x3b')][_0x4c80('0x24')]);_0x58756c['offset']=qs[_0x4c80('0x25')](_0xb98230[_0x4c80('0x3b')][_0x4c80('0x25')]);}return _0x7ab1a8['getAgents'](_0x58756c);}})[_0x4c80('0x2c')](function(_0x3d58bc){if(_0x3d58bc){return _0x3d58bc?{'count':_0x43fa7c,'rows':_0x3d58bc}:null;}})[_0x4c80('0x2c')](respondWithResult(_0x1987d7,null))[_0x4c80('0x4d')](handleError(_0x1987d7,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index f087762..9c1519d 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 _0x55ca=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x243217,_0x522951){var _0x478029=function(_0x18d053){while(--_0x18d053){_0x243217['push'](_0x243217['shift']());}};_0x478029(++_0x522951);}(_0x55ca,0x126));var _0xa55c=function(_0x13f980,_0x1e1c56){_0x13f980=_0x13f980-0x0;var _0x27153c=_0x55ca[_0x13f980];return _0x27153c;};'use strict';var EventEmitter=require(_0xa55c('0x0'));var CmList=require(_0xa55c('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa55c('0x2'),'afterDestroy':_0xa55c('0x3')};function emitEvent(_0x5dc716){return function(_0x3b478a,_0x2db02a,_0xcb02e3){CmListEvents[_0xa55c('0x4')](_0x5dc716+':'+_0x3b478a['id'],_0x3b478a);CmListEvents[_0xa55c('0x4')](_0x5dc716,_0x3b478a);_0xcb02e3(null);};}for(var e in events){if(events[_0xa55c('0x5')](e)){var event=events[e];CmList[_0xa55c('0x6')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file +var _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x1742b8,_0x2a48dd){var _0x64cd5a=function(_0x3adf13){while(--_0x3adf13){_0x1742b8['push'](_0x1742b8['shift']());}};_0x64cd5a(++_0x2a48dd);}(_0x814b,0x1a2));var _0xb814=function(_0x345de7,_0x1de531){_0x345de7=_0x345de7-0x0;var _0x26ffc7=_0x814b[_0x345de7];return _0x26ffc7;};'use strict';var EventEmitter=require(_0xb814('0x0'));var CmList=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb814('0x3')](0x0);var events={'afterCreate':_0xb814('0x4'),'afterUpdate':_0xb814('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38c21a){return function(_0x3e1e9,_0x258866,_0x4237bc){CmListEvents[_0xb814('0x6')](_0x38c21a+':'+_0x3e1e9['id'],_0x3e1e9);CmListEvents[_0xb814('0x6')](_0x38c21a,_0x3e1e9);_0x4237bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xb814('0x7')](e,emitEvent(event));}}module[_0xb814('0x8')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 575a558..5cf5112 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 _0xbdb7=['request-promise','path','rimraf','./cmList.attributes','define','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x245b57,_0x420f33){_0x245b57=_0x245b57-0x0;var _0x1d07d9=_0xbdb7[_0x245b57];return _0x1d07d9;};'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')]('CmList',attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf109=['CmList','cm_lists','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define'];(function(_0x248ca3,_0x3de09b){var _0x3cb7aa=function(_0x3acf7e){while(--_0x3acf7e){_0x248ca3['push'](_0x248ca3['shift']());}};_0x3cb7aa(++_0x3de09b);}(_0xf109,0xce));var _0x9f10=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0xf109[_0x1762b4];return _0x29beda;};'use strict';var _=require(_0x9f10('0x0'));var util=require(_0x9f10('0x1'));var logger=require(_0x9f10('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9f10('0x3'));var fs=require('fs');var path=require(_0x9f10('0x4'));var rimraf=require(_0x9f10('0x5'));var config=require(_0x9f10('0x6'));var attributes=require(_0x9f10('0x7'));module[_0x9f10('0x8')]=function(_0x408fe8,_0xd3137b){return _0x408fe8[_0x9f10('0x9')](_0x9f10('0xa'),attributes,{'tableName':_0x9f10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index d07f203..5a824b0 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 _0xb431=['debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./cmList.socket','register','request','then','CmList,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb431,0x1e4));var _0x1b43=function(_0x33029f,_0x1544b4){_0x33029f=_0x33029f-0x0;var _0x55a6d9=_0xb431[_0x33029f];return _0x55a6d9;};'use strict';var _=require(_0x1b43('0x0'));var util=require(_0x1b43('0x1'));var moment=require('moment');var BPromise=require(_0x1b43('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1b43('0x3'))['db'];var utils=require(_0x1b43('0x4'));var logger=require(_0x1b43('0x5'))(_0x1b43('0x6'));var config=require(_0x1b43('0x7'));var jayson=require(_0x1b43('0x8'));var client=jayson[_0x1b43('0x9')][_0x1b43('0xa')]({'port':0x232a});config[_0x1b43('0xb')]=_['defaults'](config[_0x1b43('0xb')],{'host':_0x1b43('0xc'),'port':0x18eb});var socket=require(_0x1b43('0xd'))(new Redis(config['redis']));require(_0x1b43('0xe'))[_0x1b43('0xf')](socket);function respondWithRpcPromise(_0x25c037,_0x2b768f,_0x7b7c19){return new BPromise(function(_0x3cbcde,_0x5aff05){return client[_0x1b43('0x10')](_0x25c037,_0x7b7c19)[_0x1b43('0x11')](function(_0xd54b44){logger['info'](_0x1b43('0x12'),_0x2b768f,_0x1b43('0x13'));logger[_0x1b43('0x14')](_0x1b43('0x15'),_0x2b768f,_0x1b43('0x13'),JSON[_0x1b43('0x16')](_0xd54b44));if(_0xd54b44[_0x1b43('0x17')]){if(_0xd54b44[_0x1b43('0x17')][_0x1b43('0x18')]===0x1f4){logger['error'](_0x1b43('0x12'),_0x2b768f,_0xd54b44[_0x1b43('0x17')][_0x1b43('0x19')]);return _0x5aff05(_0xd54b44[_0x1b43('0x17')]['message']);}logger[_0x1b43('0x17')](_0x1b43('0x12'),_0x2b768f,_0xd54b44[_0x1b43('0x17')]['message']);return _0x3cbcde(_0xd54b44[_0x1b43('0x17')]['message']);}else{logger['info'](_0x1b43('0x12'),_0x2b768f,_0x1b43('0x13'));_0x3cbcde(_0xd54b44[_0x1b43('0x1a')]['message']);}})[_0x1b43('0x1b')](function(_0x2d06c4){logger[_0x1b43('0x17')](_0x1b43('0x12'),_0x2b768f,_0x2d06c4);_0x5aff05(_0x2d06c4);});});} \ No newline at end of file +var _0xea54=['redis','localhost','then','info','CmList,\x20%s,\x20%s','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x16d190,_0x3f58c6){var _0x3c7e95=function(_0x1caaaf){while(--_0x1caaaf){_0x16d190['push'](_0x16d190['shift']());}};_0x3c7e95(++_0x3f58c6);}(_0xea54,0x139));var _0x4ea5=function(_0x176e91,_0x55e6c5){_0x176e91=_0x176e91-0x0;var _0x4aa245=_0xea54[_0x176e91];return _0x4aa245;};'use strict';var _=require('lodash');var util=require(_0x4ea5('0x0'));var moment=require(_0x4ea5('0x1'));var BPromise=require(_0x4ea5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4ea5('0x3'));var db=require(_0x4ea5('0x4'))['db'];var utils=require(_0x4ea5('0x5'));var logger=require(_0x4ea5('0x6'))(_0x4ea5('0x7'));var config=require(_0x4ea5('0x8'));var jayson=require(_0x4ea5('0x9'));var client=jayson[_0x4ea5('0xa')][_0x4ea5('0xb')]({'port':0x232a});config[_0x4ea5('0xc')]=_['defaults'](config[_0x4ea5('0xc')],{'host':_0x4ea5('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4ea5('0xc')]));require('./cmList.socket')['register'](socket);function respondWithRpcPromise(_0x25e9bb,_0x20fef8,_0x2160bb){return new BPromise(function(_0x2adb9a,_0x3d310a){return client['request'](_0x25e9bb,_0x2160bb)[_0x4ea5('0xe')](function(_0xf4606c){logger[_0x4ea5('0xf')](_0x4ea5('0x10'),_0x20fef8,'request\x20sent');logger[_0x4ea5('0x11')](_0x4ea5('0x12'),_0x20fef8,'request\x20sent',JSON[_0x4ea5('0x13')](_0xf4606c));if(_0xf4606c[_0x4ea5('0x14')]){if(_0xf4606c['error']['code']===0x1f4){logger['error'](_0x4ea5('0x10'),_0x20fef8,_0xf4606c[_0x4ea5('0x14')][_0x4ea5('0x15')]);return _0x3d310a(_0xf4606c[_0x4ea5('0x14')][_0x4ea5('0x15')]);}logger['error'](_0x4ea5('0x10'),_0x20fef8,_0xf4606c[_0x4ea5('0x14')][_0x4ea5('0x15')]);return _0x2adb9a(_0xf4606c[_0x4ea5('0x14')]['message']);}else{logger[_0x4ea5('0xf')]('CmList,\x20%s,\x20%s',_0x20fef8,_0x4ea5('0x16'));_0x2adb9a(_0xf4606c[_0x4ea5('0x17')][_0x4ea5('0x15')]);}})[_0x4ea5('0x18')](function(_0x5d4a7e){logger['error'](_0x4ea5('0x10'),_0x20fef8,_0x5d4a7e);_0x3d310a(_0x5d4a7e);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 179e798..7e9a322 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 _0xc3bd=['emit','removeListener','register','length','cmList:','save','remove','update'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0xc3bd,0x75));var _0xdc3b=function(_0x3de1f6,_0x329c14){_0x3de1f6=_0x3de1f6-0x0;var _0x2a18a5=_0xc3bd[_0x3de1f6];return _0x2a18a5;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0xdc3b('0x0'),_0xdc3b('0x1'),_0xdc3b('0x2')];function createListener(_0x1d9e7b,_0x369890){return function(_0x29434c){_0x369890[_0xdc3b('0x3')](_0x1d9e7b,_0x29434c);};}function removeListener(_0x574c74,_0x5e338b){return function(){CmListEvents[_0xdc3b('0x4')](_0x574c74,_0x5e338b);};}exports[_0xdc3b('0x5')]=function(_0x393a93){for(var _0x5905db=0x0,_0x4b3925=events[_0xdc3b('0x6')];_0x5905db<_0x4b3925;_0x5905db++){var _0x2b7ad7=events[_0x5905db];var _0x2e1c1e=createListener(_0xdc3b('0x7')+_0x2b7ad7,_0x393a93);CmListEvents['on'](_0x2b7ad7,_0x2e1c1e);}}; \ No newline at end of file +var _0x6b96=['register','cmList:','./cmList.events','save','remove','emit','removeListener'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x6b96,0xbf));var _0x66b9=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x6b96[_0x138adb];return _0x1b27f2;};'use strict';var CmListEvents=require(_0x66b9('0x0'));var events=[_0x66b9('0x1'),_0x66b9('0x2'),'update'];function createListener(_0x3f839d,_0x5550f3){return function(_0x3f5c13){_0x5550f3[_0x66b9('0x3')](_0x3f839d,_0x3f5c13);};}function removeListener(_0x3b4a3c,_0xac9b94){return function(){CmListEvents[_0x66b9('0x4')](_0x3b4a3c,_0xac9b94);};}exports[_0x66b9('0x5')]=function(_0x5e2c47){for(var _0x459dc5=0x0,_0x5a8219=events['length'];_0x459dc5<_0x5a8219;_0x459dc5++){var _0x517e09=events[_0x459dc5];var _0x53553a=createListener(_0x66b9('0x6')+_0x517e09,_0x5e2c47);CmListEvents['on'](_0x517e09,_0x53553a);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 2b73c4e..8c3c819 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 _0xd0d8=['addCustomField','addAgents','put','delete','removeDispositions','removeAgents','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','/:id/fields','/:id/users','post','addDisposition','addContacts'];(function(_0x5ce2e1,_0x63015e){var _0x3092cc=function(_0x43cb3c){while(--_0x43cb3c){_0x5ce2e1['push'](_0x5ce2e1['shift']());}};_0x3092cc(++_0x63015e);}(_0xd0d8,0x192));var _0x8d0d=function(_0x3c5a41,_0x558b2c){_0x3c5a41=_0x3c5a41-0x0;var _0x5389f5=_0xd0d8[_0x3c5a41];return _0x5389f5;};'use strict';var multer=require(_0x8d0d('0x0'));var util=require('util');var path=require(_0x8d0d('0x1'));var timeout=require(_0x8d0d('0x2'));var express=require(_0x8d0d('0x3'));var router=express[_0x8d0d('0x4')]();var fs_extra=require(_0x8d0d('0x5'));var auth=require(_0x8d0d('0x6'));var interaction=require(_0x8d0d('0x7'));var config=require(_0x8d0d('0x8'));var controller=require(_0x8d0d('0x9'));router['get']('/',auth[_0x8d0d('0xa')](),controller[_0x8d0d('0xb')]);router[_0x8d0d('0xc')](_0x8d0d('0xd'),auth[_0x8d0d('0xa')](),controller[_0x8d0d('0xe')]);router[_0x8d0d('0xc')](_0x8d0d('0xf'),auth['isAuthenticated'](),controller[_0x8d0d('0x10')]);router[_0x8d0d('0xc')](_0x8d0d('0x11'),auth[_0x8d0d('0xa')](),controller[_0x8d0d('0x12')]);router[_0x8d0d('0xc')](_0x8d0d('0x13'),auth['isAuthenticated'](),controller[_0x8d0d('0x14')]);router[_0x8d0d('0xc')](_0x8d0d('0x15'),auth[_0x8d0d('0xa')](),controller['getContactsCsv']);router[_0x8d0d('0xc')](_0x8d0d('0x16'),auth[_0x8d0d('0xa')](),controller['getCustomFields']);router[_0x8d0d('0xc')](_0x8d0d('0x17'),auth[_0x8d0d('0xa')](),controller['getAgents']);router[_0x8d0d('0x18')]('/',auth[_0x8d0d('0xa')](),controller['create']);router[_0x8d0d('0x18')](_0x8d0d('0x11'),auth['isAuthenticated'](),controller[_0x8d0d('0x19')]);router['post'](_0x8d0d('0x13'),auth[_0x8d0d('0xa')](),controller[_0x8d0d('0x1a')]);router[_0x8d0d('0x18')](_0x8d0d('0x16'),auth['isAuthenticated'](),controller[_0x8d0d('0x1b')]);router[_0x8d0d('0x18')]('/:id/users',auth[_0x8d0d('0xa')](),controller[_0x8d0d('0x1c')]);router[_0x8d0d('0x1d')](_0x8d0d('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x8d0d('0x1e')](_0x8d0d('0xf'),auth[_0x8d0d('0xa')](),controller['destroy']);router[_0x8d0d('0x1e')]('/:id/dispositions',auth[_0x8d0d('0xa')](),controller[_0x8d0d('0x1f')]);router['delete'](_0x8d0d('0x17'),auth['isAuthenticated'](),controller[_0x8d0d('0x20')]);module['exports']=router; \ No newline at end of file +var _0x2528=['/:id','getDispositions','getContacts','/:id/contacts/csv','getContactsCsv','getCustomFields','/:id/users','getAgents','post','/:id/dispositions','addDisposition','addContacts','/:id/fields','addCustomField','addAgents','put','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./cmList.controller','get','isAuthenticated','index','/describe'];(function(_0x185188,_0x491ab8){var _0x3ff6bf=function(_0x186e24){while(--_0x186e24){_0x185188['push'](_0x185188['shift']());}};_0x3ff6bf(++_0x491ab8);}(_0x2528,0x9d));var _0x8252=function(_0x331ca2,_0x1ac9df){_0x331ca2=_0x331ca2-0x0;var _0x4f8916=_0x2528[_0x331ca2];return _0x4f8916;};'use strict';var multer=require(_0x8252('0x0'));var util=require(_0x8252('0x1'));var path=require(_0x8252('0x2'));var timeout=require(_0x8252('0x3'));var express=require(_0x8252('0x4'));var router=express[_0x8252('0x5')]();var fs_extra=require(_0x8252('0x6'));var auth=require(_0x8252('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8252('0x8'));router[_0x8252('0x9')]('/',auth[_0x8252('0xa')](),controller[_0x8252('0xb')]);router[_0x8252('0x9')](_0x8252('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x8252('0x9')](_0x8252('0xd'),auth[_0x8252('0xa')](),controller['show']);router['get']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x8252('0xe')]);router['get']('/:id/contacts',auth[_0x8252('0xa')](),controller[_0x8252('0xf')]);router['get'](_0x8252('0x10'),auth[_0x8252('0xa')](),controller[_0x8252('0x11')]);router[_0x8252('0x9')]('/:id/fields',auth[_0x8252('0xa')](),controller[_0x8252('0x12')]);router[_0x8252('0x9')](_0x8252('0x13'),auth[_0x8252('0xa')](),controller[_0x8252('0x14')]);router[_0x8252('0x15')]('/',auth[_0x8252('0xa')](),controller['create']);router[_0x8252('0x15')](_0x8252('0x16'),auth[_0x8252('0xa')](),controller[_0x8252('0x17')]);router[_0x8252('0x15')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x8252('0x18')]);router[_0x8252('0x15')](_0x8252('0x19'),auth[_0x8252('0xa')](),controller[_0x8252('0x1a')]);router[_0x8252('0x15')](_0x8252('0x13'),auth[_0x8252('0xa')](),controller[_0x8252('0x1b')]);router[_0x8252('0x1c')](_0x8252('0xd'),auth[_0x8252('0xa')](),controller['update']);router[_0x8252('0x1d')]('/:id',auth[_0x8252('0xa')](),controller[_0x8252('0x1e')]);router[_0x8252('0x1d')](_0x8252('0x16'),auth[_0x8252('0xa')](),controller[_0x8252('0x1f')]);router[_0x8252('0x1d')]('/:id/users',auth['isAuthenticated'](),controller[_0x8252('0x20')]);module[_0x8252('0x21')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 7510c81..94ca54d 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 _0x3587=['VIRTUAL','getDataValue','STRING'];(function(_0x52e02d,_0x337975){var _0x573205=function(_0x5e5158){while(--_0x5e5158){_0x52e02d['push'](_0x52e02d['shift']());}};_0x573205(++_0x337975);}(_0x3587,0x18f));var _0x7358=function(_0x2ad575,_0x52f0a9){_0x2ad575=_0x2ad575-0x0;var _0x1980af=_0x3587[_0x2ad575];return _0x1980af;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7358('0x0')],'get':function(_0x24979e){return this[_0x7358('0x1')]('field');}},'field':{'type':Sequelize[_0x7358('0x2')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x7358('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x65b0=['exports','VIRTUAL','getDataValue','field','STRING','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x65b0,0x1cd));var _0x065b=function(_0x4680c2,_0x1c7102){_0x4680c2=_0x4680c2-0x0;var _0x158e8d=_0x65b0[_0x4680c2];return _0x158e8d;};'use strict';var Sequelize=require(_0x065b('0x0'));module[_0x065b('0x1')]={'name':{'type':Sequelize[_0x065b('0x2')],'get':function(_0x52943b){return this[_0x065b('0x3')](_0x065b('0x4'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x065b('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0x065b('0x5')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index d4f21fd..357cbf8 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x28254c,_0x5973ea){var _0x3d947e=function(_0x4b0d4c){while(--_0x4b0d4c){_0x28254c['push'](_0x28254c['shift']());}};_0x3d947e(++_0x5973ea);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x57d9b1,_0x43a431){var _0x39593b=function(_0x12bb7a){while(--_0x12bb7a){_0x57d9b1['push'](_0x57d9b1['shift']());}};_0x39593b(++_0x43a431);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 83d4e5a..1b7ff14 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 _0x74bd=['define','Condition','moment','bluebird','path','rimraf','../../config/environment','./condition.attributes'];(function(_0x139a2b,_0x17e2ed){var _0x587f67=function(_0x272b5c){while(--_0x272b5c){_0x139a2b['push'](_0x139a2b['shift']());}};_0x587f67(++_0x17e2ed);}(_0x74bd,0x182));var _0xd74b=function(_0xee1ec9,_0x2f0599){_0xee1ec9=_0xee1ec9-0x0;var _0x102a53=_0x74bd[_0xee1ec9];return _0x102a53;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xd74b('0x0'));var BPromise=require(_0xd74b('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd74b('0x2'));var rimraf=require(_0xd74b('0x3'));var config=require(_0xd74b('0x4'));var attributes=require(_0xd74b('0x5'));module['exports']=function(_0x5b2945,_0x2b75dd){return _0x5b2945[_0xd74b('0x6')](_0xd74b('0x7'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ed5=['tools_conditions','lodash','util','../../config/logger','request-promise','path','rimraf','./condition.attributes','exports','Condition'];(function(_0x2cedba,_0x4d462f){var _0x300978=function(_0x256bc1){while(--_0x256bc1){_0x2cedba['push'](_0x2cedba['shift']());}};_0x300978(++_0x4d462f);}(_0x6ed5,0x1e1));var _0x56ed=function(_0x1ee5be,_0x5f46e3){_0x1ee5be=_0x1ee5be-0x0;var _0x177140=_0x6ed5[_0x1ee5be];return _0x177140;};'use strict';var _=require(_0x56ed('0x0'));var util=require(_0x56ed('0x1'));var logger=require(_0x56ed('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x56ed('0x3'));var fs=require('fs');var path=require(_0x56ed('0x4'));var rimraf=require(_0x56ed('0x5'));var config=require('../../config/environment');var attributes=require(_0x56ed('0x6'));module[_0x56ed('0x7')]=function(_0x3d6094,_0x1c67c4){return _0x3d6094['define'](_0x56ed('0x8'),attributes,{'tableName':_0x56ed('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 14eebc1..2fb8dc6 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 _0xd3c3=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Condition,\x20%s,\x20%s','info','util','ioredis','../../mysqldb'];(function(_0x457cff,_0x4beaf6){var _0x314e85=function(_0xf1b590){while(--_0xf1b590){_0x457cff['push'](_0x457cff['shift']());}};_0x314e85(++_0x4beaf6);}(_0xd3c3,0x18c));var _0x3d3c=function(_0x2d6355,_0x999990){_0x2d6355=_0x2d6355-0x0;var _0x522924=_0xd3c3[_0x2d6355];return _0x522924;};'use strict';var _=require('lodash');var util=require(_0x3d3c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d3c('0x1'));var db=require(_0x3d3c('0x2'))['db'];var utils=require(_0x3d3c('0x3'));var logger=require(_0x3d3c('0x4'))(_0x3d3c('0x5'));var config=require(_0x3d3c('0x6'));var jayson=require(_0x3d3c('0x7'));var client=jayson[_0x3d3c('0x8')][_0x3d3c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d64b8,_0x2c5074,_0x454912){return new BPromise(function(_0x27c5f5,_0xd5ddb1){return client[_0x3d3c('0xa')](_0x2d64b8,_0x454912)[_0x3d3c('0xb')](function(_0x209931){logger['info']('Condition,\x20%s,\x20%s',_0x2c5074,_0x3d3c('0xc'));logger[_0x3d3c('0xd')](_0x3d3c('0xe'),_0x2c5074,_0x3d3c('0xc'),JSON[_0x3d3c('0xf')](_0x209931));if(_0x209931['error']){if(_0x209931[_0x3d3c('0x10')][_0x3d3c('0x11')]===0x1f4){logger[_0x3d3c('0x10')]('Condition,\x20%s,\x20%s',_0x2c5074,_0x209931[_0x3d3c('0x10')][_0x3d3c('0x12')]);return _0xd5ddb1(_0x209931['error'][_0x3d3c('0x12')]);}logger[_0x3d3c('0x10')](_0x3d3c('0x13'),_0x2c5074,_0x209931['error']['message']);return _0x27c5f5(_0x209931[_0x3d3c('0x10')][_0x3d3c('0x12')]);}else{logger[_0x3d3c('0x14')](_0x3d3c('0x13'),_0x2c5074,_0x3d3c('0xc'));_0x27c5f5(_0x209931['result'][_0x3d3c('0x12')]);}})['catch'](function(_0x45f0a1){logger[_0x3d3c('0x10')](_0x3d3c('0x13'),_0x2c5074,_0x45f0a1);_0xd5ddb1(_0x45f0a1);});});} \ No newline at end of file +var _0x2530=['../../config/environment','jayson/promise','request','info','Condition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xc79556,_0x27b148){var _0x19f18a=function(_0x434e45){while(--_0x434e45){_0xc79556['push'](_0xc79556['shift']());}};_0x19f18a(++_0x27b148);}(_0x2530,0xb4));var _0x0253=function(_0x4254d0,_0x4f2571){_0x4254d0=_0x4254d0-0x0;var _0x9c8f42=_0x2530[_0x4254d0];return _0x9c8f42;};'use strict';var _=require(_0x0253('0x0'));var util=require('util');var moment=require(_0x0253('0x1'));var BPromise=require(_0x0253('0x2'));var rs=require(_0x0253('0x3'));var fs=require('fs');var Redis=require(_0x0253('0x4'));var db=require(_0x0253('0x5'))['db'];var utils=require(_0x0253('0x6'));var logger=require(_0x0253('0x7'))(_0x0253('0x8'));var config=require(_0x0253('0x9'));var jayson=require(_0x0253('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1deea3,_0x4cf62d,_0x85e94c){return new BPromise(function(_0x56e10d,_0x30b650){return client[_0x0253('0xb')](_0x1deea3,_0x85e94c)['then'](function(_0x51683d){logger[_0x0253('0xc')](_0x0253('0xd'),_0x4cf62d,_0x0253('0xe'));logger[_0x0253('0xf')]('Condition,\x20%s,\x20%s,\x20%s',_0x4cf62d,_0x0253('0xe'),JSON[_0x0253('0x10')](_0x51683d));if(_0x51683d[_0x0253('0x11')]){if(_0x51683d[_0x0253('0x11')][_0x0253('0x12')]===0x1f4){logger[_0x0253('0x11')]('Condition,\x20%s,\x20%s',_0x4cf62d,_0x51683d[_0x0253('0x11')][_0x0253('0x13')]);return _0x30b650(_0x51683d['error']['message']);}logger[_0x0253('0x11')]('Condition,\x20%s,\x20%s',_0x4cf62d,_0x51683d['error'][_0x0253('0x13')]);return _0x56e10d(_0x51683d[_0x0253('0x11')][_0x0253('0x13')]);}else{logger[_0x0253('0xc')](_0x0253('0xd'),_0x4cf62d,_0x0253('0xe'));_0x56e10d(_0x51683d['result'][_0x0253('0x13')]);}})[_0x0253('0x14')](function(_0x11e2a1){logger['error'](_0x0253('0xd'),_0x4cf62d,_0x11e2a1);_0x30b650(_0x11e2a1);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 177b710..dd6c1ef 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 _0xce74=['../../components/auth/service','../../components/interaction/service','../../config/environment','put','update','delete','/:id','isAuthenticated','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x4b46cc,_0x1259c2){var _0x1f58fe=function(_0x5c9662){while(--_0x5c9662){_0x4b46cc['push'](_0x4b46cc['shift']());}};_0x1f58fe(++_0x1259c2);}(_0xce74,0xfa));var _0x4ce7=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xce74[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x4ce7('0x0'));var util=require(_0x4ce7('0x1'));var path=require(_0x4ce7('0x2'));var timeout=require(_0x4ce7('0x3'));var express=require(_0x4ce7('0x4'));var router=express[_0x4ce7('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4ce7('0x6'));var interaction=require(_0x4ce7('0x7'));var config=require(_0x4ce7('0x8'));var controller=require('./condition.controller');router[_0x4ce7('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x4ce7('0xa')]);router[_0x4ce7('0xb')](_0x4ce7('0xc'),auth[_0x4ce7('0xd')](),controller[_0x4ce7('0xe')]);module[_0x4ce7('0xf')]=router; \ No newline at end of file +var _0x6fb1=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','put','isAuthenticated','update','delete','/:id','destroy','multer','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6fb1,0x194));var _0x16fb=function(_0x57ff3b,_0x380ef5){_0x57ff3b=_0x57ff3b-0x0;var _0x374882=_0x6fb1[_0x57ff3b];return _0x374882;};'use strict';var multer=require(_0x16fb('0x0'));var util=require('util');var path=require(_0x16fb('0x1'));var timeout=require(_0x16fb('0x2'));var express=require(_0x16fb('0x3'));var router=express[_0x16fb('0x4')]();var fs_extra=require(_0x16fb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x16fb('0x6'));var config=require(_0x16fb('0x7'));var controller=require('./condition.controller');router[_0x16fb('0x8')]('/:id',auth[_0x16fb('0x9')](),controller[_0x16fb('0xa')]);router[_0x16fb('0xb')](_0x16fb('0xc'),auth['isAuthenticated'](),controller[_0x16fb('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index dc3aace..a6294ae 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 _0x757a=['exports','STRING'];(function(_0x2ed6b8,_0x3f1355){var _0x3d9557=function(_0x4eb791){while(--_0x4eb791){_0x2ed6b8['push'](_0x2ed6b8['shift']());}};_0x3d9557(++_0x3f1355);}(_0x757a,0xde));var _0xa757=function(_0x3842b1,_0x1aa5b6){_0x3842b1=_0x3842b1-0x0;var _0x4ac29d=_0x757a[_0x3842b1];return _0x4ac29d;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2032=['name','exports','STRING'];(function(_0x413c1d,_0x3a671b){var _0x5402d5=function(_0x5da336){while(--_0x5da336){_0x413c1d['push'](_0x413c1d['shift']());}};_0x5402d5(++_0x3a671b);}(_0x2032,0xd9));var _0x2203=function(_0x39717b,_0x1490b1){_0x39717b=_0x39717b-0x0;var _0x2fb8af=_0x2032[_0x39717b];return _0x2fb8af;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 83cc9a5..993c6a6 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 _0x408e=['querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./dashboard.socket','register','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','get','CustomDashboards','UserProfileResource','error','name','map','Dashboard','fieldName','type','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','catch','params','rawAttributes','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','attrUrl','attrs','value','https://','custom','attrPath','clock','attrTimezone','attrFontSize','attrMetric','total','attrVoiceQueues','attrSerie1','attrSerie2','attrSerie3','web-report','reportType','attrReport','widgetAttributes:\x20%s','stringify','addItem','DashboardId','getItems','findOne','pick','eml-format','zip-dir','request-promise','bluebird','mustache','util','to-csv','ejs','squel','crypto','jsforce','desk.js'];(function(_0x372a03,_0x38011c){var _0x98ab84=function(_0x2a162e){while(--_0x2a162e){_0x372a03['push'](_0x372a03['shift']());}};_0x98ab84(++_0x38011c);}(_0x408e,0xd0));var _0xe408=function(_0x4f7014,_0x3649ef){_0x4f7014=_0x4f7014-0x0;var _0x8fa130=_0x408e[_0x4f7014];return _0x8fa130;};'use strict';var emlformat=require(_0xe408('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe408('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe408('0x2'));var moment=require('moment');var BPromise=require(_0xe408('0x3'));var Mustache=require(_0xe408('0x4'));var util=require(_0xe408('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xe408('0x6'));var ejs=require(_0xe408('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe408('0x8'));var crypto=require(_0xe408('0x9'));var jsforce=require(_0xe408('0xa'));var deskjs=require(_0xe408('0xb'));var toCsv=require('to-csv');var querystring=require(_0xe408('0xc'));var Papa=require(_0xe408('0xd'));var Redis=require(_0xe408('0xe'));var authService=require(_0xe408('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe408('0x10'))(_0xe408('0x11'));var utils=require(_0xe408('0x12'));var config=require(_0xe408('0x13'));var licenseUtil=require(_0xe408('0x14'));var db=require(_0xe408('0x15'))['db'];config[_0xe408('0x16')]=_[_0xe408('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe408('0x18'))(new Redis(config['redis']));require(_0xe408('0x19'))[_0xe408('0x1a')](socket);function respondWithStatusCode(_0x2124a5,_0x5edd63){_0x5edd63=_0x5edd63||0xcc;return function(_0x24a7f2){if(_0x24a7f2){return _0x2124a5['sendStatus'](_0x5edd63);}return _0x2124a5[_0xe408('0x1b')](_0x5edd63)[_0xe408('0x1c')]();};}function respondWithResult(_0x234282,_0x3242a9){_0x3242a9=_0x3242a9||0xc8;return function(_0x431616){if(_0x431616){return _0x234282[_0xe408('0x1b')](_0x3242a9)[_0xe408('0x1d')](_0x431616);}};}function respondWithFilteredResult(_0x585c92,_0x57d80f){return function(_0x439b3f){if(_0x439b3f){var _0x47c54c=typeof _0x57d80f[_0xe408('0x1e')]===_0xe408('0x1f')&&typeof _0x57d80f[_0xe408('0x20')]==='undefined';var _0x167068=_0x439b3f[_0xe408('0x21')];var _0x830d2f=_0x47c54c?0x0:_0x57d80f[_0xe408('0x1e')];var _0x325889=_0x47c54c?_0x439b3f[_0xe408('0x21')]:_0x57d80f[_0xe408('0x1e')]+_0x57d80f['limit'];var _0x88abc7;if(_0x325889>=_0x167068){_0x325889=_0x167068;_0x88abc7=0xc8;}else{_0x88abc7=0xce;}_0x585c92[_0xe408('0x1b')](_0x88abc7);return _0x585c92['set'](_0xe408('0x22'),_0x830d2f+'-'+_0x325889+'/'+_0x167068)[_0xe408('0x1d')](_0x439b3f);}return null;};}function patchUpdates(_0x310764){return function(_0x2e3514){try{jsonpatch[_0xe408('0x23')](_0x2e3514,_0x310764,!![]);}catch(_0x4dc232){return BPromise[_0xe408('0x24')](_0x4dc232);}return _0x2e3514[_0xe408('0x25')]();};}function saveUpdates(_0xbeb739,_0x3275f9){return function(_0xe57d98){if(_0xe57d98){return _0xe57d98[_0xe408('0x26')](_0xbeb739)['then'](function(_0x108105){return _0x108105;});}return null;};}function removeEntity(_0x1a5c72,_0x47894a){return function(_0x42cb56){if(_0x42cb56){return _0x42cb56[_0xe408('0x27')]()[_0xe408('0x28')](function(){var _0x237193=_0x42cb56[_0xe408('0x29')]({'plain':!![]});var _0x8476c2=_0xe408('0x2a');return db[_0xe408('0x2b')][_0xe408('0x27')]({'where':{'type':_0x8476c2,'resourceId':_0x237193['id']}})['then'](function(){return _0x42cb56;});})['then'](function(){_0x1a5c72[_0xe408('0x1b')](0xcc)[_0xe408('0x1c')]();});}};}function handleEntityNotFound(_0x4dff2b,_0x17804e){return function(_0x497f70){if(!_0x497f70){_0x4dff2b['sendStatus'](0x194);}return _0x497f70;};}function handleError(_0x2ef0bc,_0x48b0a1){_0x48b0a1=_0x48b0a1||0x1f4;return function(_0x558287){logger[_0xe408('0x2c')](_0x558287['stack']);if(_0x558287[_0xe408('0x2d')]){delete _0x558287[_0xe408('0x2d')];}_0x2ef0bc[_0xe408('0x1b')](_0x48b0a1)['send'](_0x558287);};}exports['index']=function(_0xb0e503,_0x1bd468){var _0x1ec57e={},_0x3e86c7={},_0x1c3987={'count':0x0,'rows':[]};var _0x42981f=_[_0xe408('0x2e')](db[_0xe408('0x2f')]['rawAttributes'],function(_0x5e0424){return{'name':_0x5e0424[_0xe408('0x30')],'type':_0x5e0424[_0xe408('0x31')]['key']};});_0x3e86c7['model']=_[_0xe408('0x2e')](_0x42981f,_0xe408('0x2d'));_0x3e86c7[_0xe408('0x32')]=_[_0xe408('0x33')](_0xb0e503[_0xe408('0x32')]);_0x3e86c7[_0xe408('0x34')]=_['intersection'](_0x3e86c7[_0xe408('0x35')],_0x3e86c7[_0xe408('0x32')]);_0x1ec57e[_0xe408('0x36')]=_['intersection'](_0x3e86c7['model'],qs[_0xe408('0x37')](_0xb0e503[_0xe408('0x32')][_0xe408('0x37')]));_0x1ec57e['attributes']=_0x1ec57e[_0xe408('0x36')][_0xe408('0x38')]?_0x1ec57e['attributes']:_0x3e86c7['model'];if(!_0xb0e503[_0xe408('0x32')][_0xe408('0x39')](_0xe408('0x3a'))){_0x1ec57e[_0xe408('0x20')]=qs[_0xe408('0x20')](_0xb0e503[_0xe408('0x32')][_0xe408('0x20')]);_0x1ec57e[_0xe408('0x1e')]=qs[_0xe408('0x1e')](_0xb0e503[_0xe408('0x32')]['offset']);}_0x1ec57e[_0xe408('0x3b')]=qs[_0xe408('0x3c')](_0xb0e503[_0xe408('0x32')]['sort']);_0x1ec57e[_0xe408('0x3d')]=qs[_0xe408('0x34')](_['pick'](_0xb0e503[_0xe408('0x32')],_0x3e86c7[_0xe408('0x34')]),_0x42981f);if(_0xb0e503[_0xe408('0x32')][_0xe408('0x3e')]){_0x1ec57e[_0xe408('0x3d')]=_[_0xe408('0x3f')](_0x1ec57e['where'],{'$or':_[_0xe408('0x2e')](_0x42981f,function(_0x353ef2){if(_0x353ef2[_0xe408('0x31')]!==_0xe408('0x40')){var _0x2d8dfa={};_0x2d8dfa[_0x353ef2[_0xe408('0x2d')]]={'$like':'%'+_0xb0e503['query'][_0xe408('0x3e')]+'%'};return _0x2d8dfa;}})});}_0x1ec57e=_[_0xe408('0x3f')]({},_0x1ec57e,_0xb0e503[_0xe408('0x41')]);var _0x362a74={'where':_0x1ec57e['where']};return db['Dashboard'][_0xe408('0x21')](_0x362a74)[_0xe408('0x28')](function(_0xd02501){_0x1c3987[_0xe408('0x21')]=_0xd02501;if(_0xb0e503[_0xe408('0x32')][_0xe408('0x42')]){_0x1ec57e[_0xe408('0x43')]=[{'all':!![]}];}return db[_0xe408('0x2f')]['findAll'](_0x1ec57e);})[_0xe408('0x28')](function(_0x11afd9){_0x1c3987['rows']=_0x11afd9;return _0x1c3987;})[_0xe408('0x28')](respondWithFilteredResult(_0x1bd468,_0x1ec57e))[_0xe408('0x44')](handleError(_0x1bd468,null));};exports['show']=function(_0x2d6c85,_0x4dd2c3){var _0x4ee24d={'raw':![],'where':{'id':_0x2d6c85[_0xe408('0x45')]['id']}},_0x293bb1={};_0x293bb1[_0xe408('0x35')]=_['keys'](db[_0xe408('0x2f')][_0xe408('0x46')]);_0x293bb1['query']=_[_0xe408('0x33')](_0x2d6c85['query']);_0x293bb1[_0xe408('0x34')]=_[_0xe408('0x47')](_0x293bb1['model'],_0x293bb1[_0xe408('0x32')]);_0x4ee24d[_0xe408('0x36')]=_[_0xe408('0x47')](_0x293bb1[_0xe408('0x35')],qs['fields'](_0x2d6c85[_0xe408('0x32')]['fields']));_0x4ee24d[_0xe408('0x36')]=_0x4ee24d['attributes'][_0xe408('0x38')]?_0x4ee24d[_0xe408('0x36')]:_0x293bb1[_0xe408('0x35')];if(_0x2d6c85['query']['includeAll']){_0x4ee24d[_0xe408('0x43')]=[{'all':!![]}];}_0x4ee24d=_[_0xe408('0x3f')]({},_0x4ee24d,_0x2d6c85[_0xe408('0x41')]);return db['Dashboard'][_0xe408('0x48')](_0x4ee24d)[_0xe408('0x28')](handleEntityNotFound(_0x4dd2c3,null))[_0xe408('0x28')](respondWithResult(_0x4dd2c3,null))[_0xe408('0x44')](handleError(_0x4dd2c3,null));};exports[_0xe408('0x49')]=function(_0x1c60c6,_0x3651a0){return db[_0xe408('0x2f')][_0xe408('0x49')](_0x1c60c6[_0xe408('0x4a')],{})[_0xe408('0x28')](function(_0x5281c0){var _0x197a3e=_0x1c60c6[_0xe408('0x4b')][_0xe408('0x29')]({'plain':!![]});if(!_0x197a3e)throw new Error(_0xe408('0x4c'));if(_0x197a3e['role']===_0xe408('0x4b')){var _0x38c9b3=_0x5281c0['get']({'plain':!![]});var _0x14103f=_0xe408('0x2a');return db[_0xe408('0x4d')][_0xe408('0x48')]({'where':{'name':_0x14103f,'userProfileId':_0x197a3e[_0xe408('0x4e')]},'raw':!![]})[_0xe408('0x28')](function(_0x52de94){if(_0x52de94&&_0x52de94[_0xe408('0x4f')]===0x0){return db['UserProfileResource'][_0xe408('0x49')]({'name':_0x38c9b3[_0xe408('0x2d')],'resourceId':_0x38c9b3['id'],'type':_0x52de94['name'],'sectionId':_0x52de94['id']},{})[_0xe408('0x28')](function(){return _0x5281c0;});}else{return _0x5281c0;}})['catch'](function(_0x737384){logger[_0xe408('0x2c')](_0xe408('0x50'),_0x737384);throw _0x737384;});}return _0x5281c0;})['then'](respondWithResult(_0x3651a0,0xc9))['catch'](handleError(_0x3651a0,null));};exports[_0xe408('0x51')]=function(_0x4124c0,_0x15d7d7){var _0x5ede87={'where':{'id':_0x4124c0[_0xe408('0x45')]['id']}},_0x1e79e4={};_0x1e79e4[_0xe408('0x35')]=_[_0xe408('0x33')](db[_0xe408('0x2f')]['rawAttributes']);_0x5ede87[_0xe408('0x36')]=_[_0xe408('0x47')](_0x1e79e4['model'],qs['fields'](_0x4124c0[_0xe408('0x32')][_0xe408('0x37')]));_0x5ede87['attributes']=_0x5ede87['attributes'][_0xe408('0x38')]?_0x5ede87[_0xe408('0x36')]:_0x1e79e4['model'];if(_0x4124c0['query'][_0xe408('0x42')]){_0x5ede87[_0xe408('0x43')]=[{'all':!![]}];}_0x5ede87=_[_0xe408('0x3f')]({},_0x5ede87,_0x4124c0[_0xe408('0x41')]);return db[_0xe408('0x2f')][_0xe408('0x48')](_0x5ede87)[_0xe408('0x28')](handleEntityNotFound(_0x15d7d7,null))[_0xe408('0x28')](function(_0x7a1238){if(_0x7a1238){var _0x5a1f71=_0x7a1238['get']({'plain':!![]});_0x5a1f71=qs[_0xe408('0x52')](_0x5a1f71,['id',_0xe408('0x53'),_0xe408('0x54')]);_0x4124c0[_0xe408('0x4a')]=_[_0xe408('0x52')](_0x4124c0[_0xe408('0x4a')],['id',_0xe408('0x53'),'updatedAt']);return db[_0xe408('0x2f')]['create'](_['merge'](_0x5a1f71,_0x4124c0[_0xe408('0x4a')]),{'include':_0x4124c0['query'][_0xe408('0x42')]?[{'all':!![]}]:undefined})[_0xe408('0x28')](function(_0x4c9c23){var _0x293aa8=_0x4124c0['user'][_0xe408('0x29')]({'plain':!![]});if(!_0x293aa8)throw new Error(_0xe408('0x4c'));if(_0x293aa8['role']===_0xe408('0x4b')){var _0x498eed=_0x4c9c23['get']({'plain':!![]});var _0x44b02e='CustomDashboards';return db[_0xe408('0x4d')]['find']({'where':{'name':_0x44b02e,'userProfileId':_0x293aa8[_0xe408('0x4e')]},'raw':!![]})[_0xe408('0x28')](function(_0x3d5cb0){if(_0x3d5cb0&&_0x3d5cb0[_0xe408('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0x498eed['name'],'resourceId':_0x498eed['id'],'type':_0x3d5cb0[_0xe408('0x2d')],'sectionId':_0x3d5cb0['id']},{})[_0xe408('0x28')](function(){return _0x4c9c23;});}else{return _0x4c9c23;}})[_0xe408('0x44')](function(_0x1e41be){logger['error'](_0xe408('0x50'),_0x1e41be);throw _0x1e41be;});}return _0x4c9c23;});}})[_0xe408('0x28')](respondWithResult(_0x15d7d7,0xc9))[_0xe408('0x44')](handleError(_0x15d7d7,null));};exports[_0xe408('0x26')]=function(_0x1a85fe,_0x3279ee){if(_0x1a85fe['body']['id']){delete _0x1a85fe[_0xe408('0x4a')]['id'];}return db[_0xe408('0x2f')][_0xe408('0x48')]({'where':{'id':_0x1a85fe[_0xe408('0x45')]['id']}})['then'](handleEntityNotFound(_0x3279ee,null))[_0xe408('0x28')](saveUpdates(_0x1a85fe[_0xe408('0x4a')],null))['then'](respondWithResult(_0x3279ee,null))['catch'](handleError(_0x3279ee,null));};exports[_0xe408('0x27')]=function(_0x30f943,_0x94a1f1){return db['Dashboard'][_0xe408('0x48')]({'where':{'id':_0x30f943[_0xe408('0x45')]['id']}})[_0xe408('0x28')](handleEntityNotFound(_0x94a1f1,null))[_0xe408('0x28')](removeEntity(_0x94a1f1,null))[_0xe408('0x44')](handleError(_0x94a1f1,null));};function widgetAttributes(_0x2830a2){try{switch(_0x2830a2['type']){case'iframe':return[{'name':'attrUrl','value':_0x2830a2[_0xe408('0x55')]||(_0x2830a2[_0xe408('0x56')]&&_0x2830a2['attrs'][0x0]?_0x2830a2[_0xe408('0x56')][0x0][_0xe408('0x57')]:undefined)||_0xe408('0x58')}];case _0xe408('0x59'):return[{'name':'attrPath','value':_0x2830a2[_0xe408('0x5a')]||(_0x2830a2['attrs']&&_0x2830a2[_0xe408('0x56')][0x0]?_0x2830a2[_0xe408('0x56')][0x0][_0xe408('0x57')]:undefined)||''}];case _0xe408('0x5b'):return[{'name':'attrHourFormat','value':_0x2830a2['attrHourFormat']||(_0x2830a2[_0xe408('0x56')]&&_0x2830a2[_0xe408('0x56')][0x0]?_0x2830a2[_0xe408('0x56')][0x0][_0xe408('0x57')]:undefined)||'HH:mm:ss'},{'name':_0xe408('0x5c'),'value':_0x2830a2[_0xe408('0x5c')]||(_0x2830a2['attrs']&&_0x2830a2[_0xe408('0x56')][0x1]?_0x2830a2['attrs'][0x1][_0xe408('0x57')]:undefined)||'0.00'},{'name':_0xe408('0x5d'),'value':_0x2830a2[_0xe408('0x5d')]||(_0x2830a2[_0xe408('0x56')]&&_0x2830a2[_0xe408('0x56')][0x2]?_0x2830a2[_0xe408('0x56')][0x2][_0xe408('0x57')]:undefined)||0xc}];case'counter':return[{'name':_0xe408('0x5e'),'value':_0x2830a2[_0xe408('0x5e')]||(_0x2830a2[_0xe408('0x56')]&&_0x2830a2[_0xe408('0x56')][0x0]?_0x2830a2[_0xe408('0x56')][0x0][_0xe408('0x57')]:undefined)||_0xe408('0x5f')},{'name':'attrVoiceQueues','value':_0x2830a2[_0xe408('0x60')]||(_0x2830a2[_0xe408('0x56')]&&_0x2830a2[_0xe408('0x56')][0x1]?_0x2830a2[_0xe408('0x56')][0x1][_0xe408('0x57')]:undefined)||[]},{'name':_0xe408('0x5d'),'value':_0x2830a2[_0xe408('0x5d')]||(_0x2830a2['attrs']&&_0x2830a2['attrs'][0x2]?_0x2830a2[_0xe408('0x56')][0x2][_0xe408('0x57')]:undefined)||0x14}];case'multibar-chart':case'pie-chart':return[{'name':_0xe408('0x61'),'value':_0x2830a2[_0xe408('0x61')]||(_0x2830a2['attrs']&&_0x2830a2['attrs'][0x0]?_0x2830a2['attrs'][0x0][_0xe408('0x57')]:undefined)||_0xe408('0x5f')},{'name':_0xe408('0x62'),'value':_0x2830a2[_0xe408('0x62')]||(_0x2830a2[_0xe408('0x56')]&&_0x2830a2[_0xe408('0x56')][0x1]?_0x2830a2[_0xe408('0x56')][0x1][_0xe408('0x57')]:undefined)||null},{'name':'attrSerie3','value':_0x2830a2[_0xe408('0x63')]||(_0x2830a2[_0xe408('0x56')]&&_0x2830a2[_0xe408('0x56')][0x2]?_0x2830a2[_0xe408('0x56')][0x2][_0xe408('0x57')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x2830a2['attrVoiceQueues']||(_0x2830a2['attrs']&&_0x2830a2[_0xe408('0x56')][0x3]?_0x2830a2[_0xe408('0x56')][0x3][_0xe408('0x57')]:undefined)||[]}];case _0xe408('0x64'):return[{'name':'attrReport','type':_0x2830a2[_0xe408('0x65')]||(_0x2830a2[_0xe408('0x56')]&&_0x2830a2['attrs'][0x0]?_0x2830a2[_0xe408('0x56')][0x0][_0xe408('0x31')]:undefined)||null,'value':_0x2830a2[_0xe408('0x66')]||(_0x2830a2[_0xe408('0x56')]&&_0x2830a2[_0xe408('0x56')][0x0]?_0x2830a2[_0xe408('0x56')][0x0][_0xe408('0x57')]:undefined)||null},{'name':'attrRefresh','value':_0x2830a2['attrRefresh']||(_0x2830a2[_0xe408('0x56')]&&_0x2830a2[_0xe408('0x56')][0x1]?_0x2830a2[_0xe408('0x56')][0x1][_0xe408('0x57')]:undefined)||0x0}];default:return[];}}catch(_0x6520d2){logger['error'](_0xe408('0x67'),JSON[_0xe408('0x68')](_0x6520d2));return[];}}exports[_0xe408('0x69')]=function(_0x251b43,_0x1cbc92,_0x22593e){if(_0x251b43[_0xe408('0x4a')]['id']){delete _0x251b43[_0xe408('0x4a')]['id'];}return db['Dashboard']['find']({'where':{'id':_0x251b43[_0xe408('0x45')]['id']}})[_0xe408('0x28')](handleEntityNotFound(_0x1cbc92,null))[_0xe408('0x28')](function(_0x2f40e5){if(_0x2f40e5){_0x251b43[_0xe408('0x4a')][_0xe408('0x6a')]=_0x2f40e5['id'];_0x251b43[_0xe408('0x4a')][_0xe408('0x56')]=widgetAttributes(_0x251b43[_0xe408('0x4a')]);return db['DashboardItem'][_0xe408('0x49')](_0x251b43[_0xe408('0x4a')]);}})[_0xe408('0x28')](respondWithResult(_0x1cbc92,null))[_0xe408('0x44')](handleError(_0x1cbc92,null));};exports[_0xe408('0x6b')]=function(_0x1d1c8b,_0x5781a7,_0x5790e3){var _0x2b323a={};var _0x5d032b={};var _0x3fc9e2;var _0x4d1f8d;return db[_0xe408('0x2f')][_0xe408('0x6c')]({'where':{'id':_0x1d1c8b[_0xe408('0x45')]['id']}})[_0xe408('0x28')](handleEntityNotFound(_0x5781a7,null))['then'](function(_0x5213ae){if(_0x5213ae){_0x3fc9e2=_0x5213ae;_0x5d032b[_0xe408('0x35')]=_[_0xe408('0x33')](db['DashboardItem'][_0xe408('0x46')]);_0x5d032b[_0xe408('0x32')]=_[_0xe408('0x33')](_0x1d1c8b[_0xe408('0x32')]);_0x5d032b['filters']=_[_0xe408('0x47')](_0x5d032b[_0xe408('0x35')],_0x5d032b[_0xe408('0x32')]);_0x2b323a['attributes']=_[_0xe408('0x47')](_0x5d032b[_0xe408('0x35')],qs['fields'](_0x1d1c8b[_0xe408('0x32')][_0xe408('0x37')]));_0x2b323a[_0xe408('0x36')]=_0x2b323a[_0xe408('0x36')][_0xe408('0x38')]?_0x2b323a['attributes']:_0x5d032b[_0xe408('0x35')];_0x2b323a[_0xe408('0x3b')]=qs['sort'](_0x1d1c8b['query'][_0xe408('0x3c')]);_0x2b323a[_0xe408('0x3d')]=qs[_0xe408('0x34')](_[_0xe408('0x6d')](_0x1d1c8b[_0xe408('0x32')],_0x5d032b['filters']));if(_0x1d1c8b['query'][_0xe408('0x3e')]){_0x2b323a[_0xe408('0x3d')]=_[_0xe408('0x3f')](_0x2b323a[_0xe408('0x3d')],{'$or':_[_0xe408('0x2e')](_0x2b323a[_0xe408('0x36')],function(_0x53190c){var _0x1f3ba6={};_0x1f3ba6[_0x53190c]={'$like':'%'+_0x1d1c8b[_0xe408('0x32')][_0xe408('0x3e')]+'%'};return _0x1f3ba6;})});}_0x2b323a=_['merge']({},_0x2b323a,_0x1d1c8b[_0xe408('0x41')]);return _0x3fc9e2[_0xe408('0x6b')](_0x2b323a);}})['then'](function(_0x5148d0){if(_0x5148d0){_0x4d1f8d=_0x5148d0[_0xe408('0x38')];if(!_0x1d1c8b[_0xe408('0x32')][_0xe408('0x39')](_0xe408('0x3a'))){_0x2b323a['limit']=qs[_0xe408('0x20')](_0x1d1c8b['query']['limit']);_0x2b323a['offset']=qs[_0xe408('0x1e')](_0x1d1c8b[_0xe408('0x32')][_0xe408('0x1e')]);}return _0x3fc9e2[_0xe408('0x6b')](_0x2b323a);}})[_0xe408('0x28')](function(_0x22c85f){if(_0x22c85f){return _0x22c85f?{'count':_0x4d1f8d,'rows':_0x22c85f}:null;}})[_0xe408('0x28')](respondWithResult(_0x5781a7,null))[_0xe408('0x44')](handleError(_0x5781a7,null));}; \ No newline at end of file +var _0x3114=['status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','update','destroy','then','get','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','type','model','keys','query','filters','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','Dashboard','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','length','omit','createdAt','updatedAt','body','CustomDashboards','UserProfileSection','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrVoiceQueues','web-report','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardId','DashboardItem','getItems','findOne','filter','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','sendStatus'];(function(_0x10a152,_0x9ce783){var _0x5d87ea=function(_0x41ea17){while(--_0x41ea17){_0x10a152['push'](_0x10a152['shift']());}};_0x5d87ea(++_0x9ce783);}(_0x3114,0x1d3));var _0x4311=function(_0x61240e,_0x473b3d){_0x61240e=_0x61240e-0x0;var _0x36d377=_0x3114[_0x61240e];return _0x36d377;};'use strict';var emlformat=require(_0x4311('0x0'));var rimraf=require(_0x4311('0x1'));var zipdir=require(_0x4311('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4311('0x3'));var moment=require(_0x4311('0x4'));var BPromise=require(_0x4311('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x4311('0x6'));var ejs=require(_0x4311('0x7'));var fs=require('fs');var fs_extra=require(_0x4311('0x8'));var _=require(_0x4311('0x9'));var squel=require(_0x4311('0xa'));var crypto=require(_0x4311('0xb'));var jsforce=require(_0x4311('0xc'));var deskjs=require(_0x4311('0xd'));var toCsv=require(_0x4311('0x6'));var querystring=require(_0x4311('0xe'));var Papa=require(_0x4311('0xf'));var Redis=require(_0x4311('0x10'));var authService=require(_0x4311('0x11'));var qs=require(_0x4311('0x12'));var as=require(_0x4311('0x13'));var hardwareService=require(_0x4311('0x14'));var logger=require(_0x4311('0x15'))(_0x4311('0x16'));var utils=require(_0x4311('0x17'));var config=require(_0x4311('0x18'));var licenseUtil=require(_0x4311('0x19'));var db=require(_0x4311('0x1a'))['db'];config[_0x4311('0x1b')]=_[_0x4311('0x1c')](config[_0x4311('0x1b')],{'host':_0x4311('0x1d'),'port':0x18eb});var socket=require(_0x4311('0x1e'))(new Redis(config['redis']));require(_0x4311('0x1f'))['register'](socket);function respondWithStatusCode(_0x37fcbf,_0xe832c9){_0xe832c9=_0xe832c9||0xcc;return function(_0x16febe){if(_0x16febe){return _0x37fcbf[_0x4311('0x20')](_0xe832c9);}return _0x37fcbf[_0x4311('0x21')](_0xe832c9)[_0x4311('0x22')]();};}function respondWithResult(_0x231359,_0x1a178c){_0x1a178c=_0x1a178c||0xc8;return function(_0x3423b5){if(_0x3423b5){return _0x231359[_0x4311('0x21')](_0x1a178c)['json'](_0x3423b5);}};}function respondWithFilteredResult(_0x33d97c,_0x40d681){return function(_0x22d034){if(_0x22d034){var _0x471db8=typeof _0x40d681[_0x4311('0x23')]===_0x4311('0x24')&&typeof _0x40d681['limit']==='undefined';var _0x8c884c=_0x22d034[_0x4311('0x25')];var _0x336039=_0x471db8?0x0:_0x40d681[_0x4311('0x23')];var _0x258ade=_0x471db8?_0x22d034[_0x4311('0x25')]:_0x40d681[_0x4311('0x23')]+_0x40d681[_0x4311('0x26')];var _0x38039f;if(_0x258ade>=_0x8c884c){_0x258ade=_0x8c884c;_0x38039f=0xc8;}else{_0x38039f=0xce;}_0x33d97c[_0x4311('0x21')](_0x38039f);return _0x33d97c[_0x4311('0x27')](_0x4311('0x28'),_0x336039+'-'+_0x258ade+'/'+_0x8c884c)[_0x4311('0x29')](_0x22d034);}return null;};}function patchUpdates(_0x26ba41){return function(_0x8e73fc){try{jsonpatch[_0x4311('0x2a')](_0x8e73fc,_0x26ba41,!![]);}catch(_0x1f0ac3){return BPromise[_0x4311('0x2b')](_0x1f0ac3);}return _0x8e73fc['save']();};}function saveUpdates(_0x54ea61,_0x4b8cef){return function(_0x4280b4){if(_0x4280b4){return _0x4280b4[_0x4311('0x2c')](_0x54ea61)['then'](function(_0x896f3b){return _0x896f3b;});}return null;};}function removeEntity(_0x7970fd,_0x2e977e){return function(_0x567b7c){if(_0x567b7c){return _0x567b7c[_0x4311('0x2d')]()[_0x4311('0x2e')](function(){var _0x3e6e59=_0x567b7c[_0x4311('0x2f')]({'plain':!![]});var _0x504889='CustomDashboards';return db[_0x4311('0x30')]['destroy']({'where':{'type':_0x504889,'resourceId':_0x3e6e59['id']}})[_0x4311('0x2e')](function(){return _0x567b7c;});})['then'](function(){_0x7970fd[_0x4311('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x83ab7a,_0x2b6d80){return function(_0x5c11f3){if(!_0x5c11f3){_0x83ab7a[_0x4311('0x20')](0x194);}return _0x5c11f3;};}function handleError(_0x54171b,_0x4c7c68){_0x4c7c68=_0x4c7c68||0x1f4;return function(_0x24776e){logger[_0x4311('0x31')](_0x24776e[_0x4311('0x32')]);if(_0x24776e[_0x4311('0x33')]){delete _0x24776e['name'];}_0x54171b[_0x4311('0x21')](_0x4c7c68)[_0x4311('0x34')](_0x24776e);};}exports['index']=function(_0x441e32,_0xc5100){var _0x4f8051={},_0x23f341={},_0x41b7bc={'count':0x0,'rows':[]};var _0xf7c3b2=_[_0x4311('0x35')](db['Dashboard'][_0x4311('0x36')],function(_0x348cfd){return{'name':_0x348cfd[_0x4311('0x37')],'type':_0x348cfd[_0x4311('0x38')]['key']};});_0x23f341[_0x4311('0x39')]=_[_0x4311('0x35')](_0xf7c3b2,_0x4311('0x33'));_0x23f341['query']=_[_0x4311('0x3a')](_0x441e32[_0x4311('0x3b')]);_0x23f341[_0x4311('0x3c')]=_['intersection'](_0x23f341[_0x4311('0x39')],_0x23f341['query']);_0x4f8051[_0x4311('0x3d')]=_['intersection'](_0x23f341[_0x4311('0x39')],qs[_0x4311('0x3e')](_0x441e32[_0x4311('0x3b')]['fields']));_0x4f8051['attributes']=_0x4f8051[_0x4311('0x3d')]['length']?_0x4f8051[_0x4311('0x3d')]:_0x23f341[_0x4311('0x39')];if(!_0x441e32[_0x4311('0x3b')][_0x4311('0x3f')]('nolimit')){_0x4f8051['limit']=qs['limit'](_0x441e32[_0x4311('0x3b')][_0x4311('0x26')]);_0x4f8051[_0x4311('0x23')]=qs[_0x4311('0x23')](_0x441e32[_0x4311('0x3b')][_0x4311('0x23')]);}_0x4f8051[_0x4311('0x40')]=qs[_0x4311('0x41')](_0x441e32[_0x4311('0x3b')][_0x4311('0x41')]);_0x4f8051[_0x4311('0x42')]=qs[_0x4311('0x3c')](_[_0x4311('0x43')](_0x441e32[_0x4311('0x3b')],_0x23f341[_0x4311('0x3c')]),_0xf7c3b2);if(_0x441e32[_0x4311('0x3b')]['filter']){_0x4f8051[_0x4311('0x42')]=_[_0x4311('0x44')](_0x4f8051[_0x4311('0x42')],{'$or':_['map'](_0xf7c3b2,function(_0xed54e7){if(_0xed54e7['type']!==_0x4311('0x45')){var _0x49fd41={};_0x49fd41[_0xed54e7[_0x4311('0x33')]]={'$like':'%'+_0x441e32[_0x4311('0x3b')]['filter']+'%'};return _0x49fd41;}})});}_0x4f8051=_['merge']({},_0x4f8051,_0x441e32[_0x4311('0x46')]);var _0x5c6d27={'where':_0x4f8051[_0x4311('0x42')]};return db[_0x4311('0x47')]['count'](_0x5c6d27)[_0x4311('0x2e')](function(_0x404002){_0x41b7bc['count']=_0x404002;if(_0x441e32[_0x4311('0x3b')][_0x4311('0x48')]){_0x4f8051[_0x4311('0x49')]=[{'all':!![]}];}return db['Dashboard'][_0x4311('0x4a')](_0x4f8051);})[_0x4311('0x2e')](function(_0x271d4d){_0x41b7bc[_0x4311('0x4b')]=_0x271d4d;return _0x41b7bc;})[_0x4311('0x2e')](respondWithFilteredResult(_0xc5100,_0x4f8051))[_0x4311('0x4c')](handleError(_0xc5100,null));};exports[_0x4311('0x4d')]=function(_0x3463ab,_0xc2266){var _0xf6cc8d={'raw':![],'where':{'id':_0x3463ab[_0x4311('0x4e')]['id']}},_0x52e4c3={};_0x52e4c3[_0x4311('0x39')]=_[_0x4311('0x3a')](db[_0x4311('0x47')][_0x4311('0x36')]);_0x52e4c3[_0x4311('0x3b')]=_[_0x4311('0x3a')](_0x3463ab[_0x4311('0x3b')]);_0x52e4c3[_0x4311('0x3c')]=_[_0x4311('0x4f')](_0x52e4c3[_0x4311('0x39')],_0x52e4c3['query']);_0xf6cc8d[_0x4311('0x3d')]=_[_0x4311('0x4f')](_0x52e4c3[_0x4311('0x39')],qs[_0x4311('0x3e')](_0x3463ab['query']['fields']));_0xf6cc8d[_0x4311('0x3d')]=_0xf6cc8d[_0x4311('0x3d')]['length']?_0xf6cc8d[_0x4311('0x3d')]:_0x52e4c3['model'];if(_0x3463ab[_0x4311('0x3b')][_0x4311('0x48')]){_0xf6cc8d[_0x4311('0x49')]=[{'all':!![]}];}_0xf6cc8d=_['merge']({},_0xf6cc8d,_0x3463ab['options']);return db[_0x4311('0x47')][_0x4311('0x50')](_0xf6cc8d)[_0x4311('0x2e')](handleEntityNotFound(_0xc2266,null))[_0x4311('0x2e')](respondWithResult(_0xc2266,null))[_0x4311('0x4c')](handleError(_0xc2266,null));};exports['create']=function(_0x38e800,_0x280586){return db['Dashboard'][_0x4311('0x51')](_0x38e800['body'],{})[_0x4311('0x2e')](function(_0x59c816){var _0x40696b=_0x38e800[_0x4311('0x52')][_0x4311('0x2f')]({'plain':!![]});if(!_0x40696b)throw new Error(_0x4311('0x53'));if(_0x40696b[_0x4311('0x54')]==='user'){var _0x37f346=_0x59c816[_0x4311('0x2f')]({'plain':!![]});var _0x5701de='CustomDashboards';return db['UserProfileSection'][_0x4311('0x50')]({'where':{'name':_0x5701de,'userProfileId':_0x40696b[_0x4311('0x55')]},'raw':!![]})['then'](function(_0x8004a0){if(_0x8004a0&&_0x8004a0[_0x4311('0x56')]===0x0){return db[_0x4311('0x30')][_0x4311('0x51')]({'name':_0x37f346[_0x4311('0x33')],'resourceId':_0x37f346['id'],'type':_0x8004a0[_0x4311('0x33')],'sectionId':_0x8004a0['id']},{})[_0x4311('0x2e')](function(){return _0x59c816;});}else{return _0x59c816;}})['catch'](function(_0x2f4f52){logger['error'](_0x4311('0x57'),_0x2f4f52);throw _0x2f4f52;});}return _0x59c816;})[_0x4311('0x2e')](respondWithResult(_0x280586,0xc9))[_0x4311('0x4c')](handleError(_0x280586,null));};exports[_0x4311('0x58')]=function(_0x10dce4,_0x32f08f){var _0x24e43c={'where':{'id':_0x10dce4[_0x4311('0x4e')]['id']}},_0xed4e20={};_0xed4e20[_0x4311('0x39')]=_[_0x4311('0x3a')](db[_0x4311('0x47')]['rawAttributes']);_0x24e43c[_0x4311('0x3d')]=_[_0x4311('0x4f')](_0xed4e20[_0x4311('0x39')],qs['fields'](_0x10dce4['query'][_0x4311('0x3e')]));_0x24e43c[_0x4311('0x3d')]=_0x24e43c['attributes'][_0x4311('0x59')]?_0x24e43c[_0x4311('0x3d')]:_0xed4e20['model'];if(_0x10dce4['query'][_0x4311('0x48')]){_0x24e43c[_0x4311('0x49')]=[{'all':!![]}];}_0x24e43c=_[_0x4311('0x44')]({},_0x24e43c,_0x10dce4['options']);return db['Dashboard'][_0x4311('0x50')](_0x24e43c)['then'](handleEntityNotFound(_0x32f08f,null))[_0x4311('0x2e')](function(_0x4b998f){if(_0x4b998f){var _0x2712db=_0x4b998f[_0x4311('0x2f')]({'plain':!![]});_0x2712db=qs[_0x4311('0x5a')](_0x2712db,['id',_0x4311('0x5b'),_0x4311('0x5c')]);_0x10dce4[_0x4311('0x5d')]=_[_0x4311('0x5a')](_0x10dce4[_0x4311('0x5d')],['id','createdAt',_0x4311('0x5c')]);return db['Dashboard'][_0x4311('0x51')](_[_0x4311('0x44')](_0x2712db,_0x10dce4[_0x4311('0x5d')]),{'include':_0x10dce4[_0x4311('0x3b')][_0x4311('0x48')]?[{'all':!![]}]:undefined})['then'](function(_0x3c2398){var _0x17249e=_0x10dce4[_0x4311('0x52')]['get']({'plain':!![]});if(!_0x17249e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x17249e['role']===_0x4311('0x52')){var _0x9b8c17=_0x3c2398['get']({'plain':!![]});var _0x1a5430=_0x4311('0x5e');return db[_0x4311('0x5f')][_0x4311('0x50')]({'where':{'name':_0x1a5430,'userProfileId':_0x17249e['userProfileId']},'raw':!![]})[_0x4311('0x2e')](function(_0x3ca6a1){if(_0x3ca6a1&&_0x3ca6a1[_0x4311('0x56')]===0x0){return db[_0x4311('0x30')]['create']({'name':_0x9b8c17[_0x4311('0x33')],'resourceId':_0x9b8c17['id'],'type':_0x3ca6a1[_0x4311('0x33')],'sectionId':_0x3ca6a1['id']},{})[_0x4311('0x2e')](function(){return _0x3c2398;});}else{return _0x3c2398;}})['catch'](function(_0x5b1955){logger[_0x4311('0x31')](_0x4311('0x57'),_0x5b1955);throw _0x5b1955;});}return _0x3c2398;});}})[_0x4311('0x2e')](respondWithResult(_0x32f08f,0xc9))[_0x4311('0x4c')](handleError(_0x32f08f,null));};exports[_0x4311('0x2c')]=function(_0x4c7d00,_0x17170a){if(_0x4c7d00[_0x4311('0x5d')]['id']){delete _0x4c7d00[_0x4311('0x5d')]['id'];}return db[_0x4311('0x47')]['find']({'where':{'id':_0x4c7d00[_0x4311('0x4e')]['id']}})['then'](handleEntityNotFound(_0x17170a,null))[_0x4311('0x2e')](saveUpdates(_0x4c7d00[_0x4311('0x5d')],null))[_0x4311('0x2e')](respondWithResult(_0x17170a,null))[_0x4311('0x4c')](handleError(_0x17170a,null));};exports[_0x4311('0x2d')]=function(_0x225d02,_0x48a013){return db['Dashboard'][_0x4311('0x50')]({'where':{'id':_0x225d02[_0x4311('0x4e')]['id']}})[_0x4311('0x2e')](handleEntityNotFound(_0x48a013,null))[_0x4311('0x2e')](removeEntity(_0x48a013,null))[_0x4311('0x4c')](handleError(_0x48a013,null));};function widgetAttributes(_0x1bef87){try{switch(_0x1bef87[_0x4311('0x38')]){case _0x4311('0x60'):return[{'name':_0x4311('0x61'),'value':_0x1bef87[_0x4311('0x61')]||(_0x1bef87[_0x4311('0x62')]&&_0x1bef87[_0x4311('0x62')][0x0]?_0x1bef87[_0x4311('0x62')][0x0][_0x4311('0x63')]:undefined)||_0x4311('0x64')}];case'custom':return[{'name':_0x4311('0x65'),'value':_0x1bef87[_0x4311('0x65')]||(_0x1bef87[_0x4311('0x62')]&&_0x1bef87[_0x4311('0x62')][0x0]?_0x1bef87[_0x4311('0x62')][0x0][_0x4311('0x63')]:undefined)||''}];case _0x4311('0x66'):return[{'name':_0x4311('0x67'),'value':_0x1bef87[_0x4311('0x67')]||(_0x1bef87[_0x4311('0x62')]&&_0x1bef87['attrs'][0x0]?_0x1bef87['attrs'][0x0][_0x4311('0x63')]:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x1bef87[_0x4311('0x68')]||(_0x1bef87[_0x4311('0x62')]&&_0x1bef87[_0x4311('0x62')][0x1]?_0x1bef87[_0x4311('0x62')][0x1]['value']:undefined)||_0x4311('0x69')},{'name':'attrFontSize','value':_0x1bef87[_0x4311('0x6a')]||(_0x1bef87[_0x4311('0x62')]&&_0x1bef87[_0x4311('0x62')][0x2]?_0x1bef87[_0x4311('0x62')][0x2][_0x4311('0x63')]:undefined)||0xc}];case _0x4311('0x6b'):return[{'name':'attrMetric','value':_0x1bef87[_0x4311('0x6c')]||(_0x1bef87[_0x4311('0x62')]&&_0x1bef87['attrs'][0x0]?_0x1bef87[_0x4311('0x62')][0x0][_0x4311('0x63')]:undefined)||_0x4311('0x6d')},{'name':'attrVoiceQueues','value':_0x1bef87['attrVoiceQueues']||(_0x1bef87[_0x4311('0x62')]&&_0x1bef87[_0x4311('0x62')][0x1]?_0x1bef87[_0x4311('0x62')][0x1]['value']:undefined)||[]},{'name':_0x4311('0x6a'),'value':_0x1bef87[_0x4311('0x6a')]||(_0x1bef87[_0x4311('0x62')]&&_0x1bef87['attrs'][0x2]?_0x1bef87[_0x4311('0x62')][0x2]['value']:undefined)||0x14}];case _0x4311('0x6e'):case _0x4311('0x6f'):return[{'name':_0x4311('0x70'),'value':_0x1bef87[_0x4311('0x70')]||(_0x1bef87['attrs']&&_0x1bef87[_0x4311('0x62')][0x0]?_0x1bef87['attrs'][0x0]['value']:undefined)||'total'},{'name':_0x4311('0x71'),'value':_0x1bef87['attrSerie2']||(_0x1bef87[_0x4311('0x62')]&&_0x1bef87[_0x4311('0x62')][0x1]?_0x1bef87[_0x4311('0x62')][0x1]['value']:undefined)||null},{'name':_0x4311('0x72'),'value':_0x1bef87[_0x4311('0x72')]||(_0x1bef87[_0x4311('0x62')]&&_0x1bef87[_0x4311('0x62')][0x2]?_0x1bef87['attrs'][0x2]['value']:undefined)||null},{'name':_0x4311('0x73'),'value':_0x1bef87[_0x4311('0x73')]||(_0x1bef87['attrs']&&_0x1bef87[_0x4311('0x62')][0x3]?_0x1bef87[_0x4311('0x62')][0x3][_0x4311('0x63')]:undefined)||[]}];case _0x4311('0x74'):return[{'name':'attrReport','type':_0x1bef87['reportType']||(_0x1bef87[_0x4311('0x62')]&&_0x1bef87[_0x4311('0x62')][0x0]?_0x1bef87['attrs'][0x0]['type']:undefined)||null,'value':_0x1bef87['attrReport']||(_0x1bef87[_0x4311('0x62')]&&_0x1bef87[_0x4311('0x62')][0x0]?_0x1bef87['attrs'][0x0]['value']:undefined)||null},{'name':_0x4311('0x75'),'value':_0x1bef87[_0x4311('0x75')]||(_0x1bef87[_0x4311('0x62')]&&_0x1bef87[_0x4311('0x62')][0x1]?_0x1bef87[_0x4311('0x62')][0x1][_0x4311('0x63')]:undefined)||0x0}];default:return[];}}catch(_0x41f002){logger[_0x4311('0x31')](_0x4311('0x76'),JSON['stringify'](_0x41f002));return[];}}exports[_0x4311('0x77')]=function(_0x29db09,_0x47d246,_0x37440f){if(_0x29db09[_0x4311('0x5d')]['id']){delete _0x29db09[_0x4311('0x5d')]['id'];}return db[_0x4311('0x47')][_0x4311('0x50')]({'where':{'id':_0x29db09['params']['id']}})[_0x4311('0x2e')](handleEntityNotFound(_0x47d246,null))[_0x4311('0x2e')](function(_0x1f678c){if(_0x1f678c){_0x29db09['body'][_0x4311('0x78')]=_0x1f678c['id'];_0x29db09[_0x4311('0x5d')][_0x4311('0x62')]=widgetAttributes(_0x29db09['body']);return db[_0x4311('0x79')][_0x4311('0x51')](_0x29db09[_0x4311('0x5d')]);}})[_0x4311('0x2e')](respondWithResult(_0x47d246,null))[_0x4311('0x4c')](handleError(_0x47d246,null));};exports[_0x4311('0x7a')]=function(_0x2f6e82,_0x4b70a5,_0x5057a7){var _0x3257e0={};var _0x3c3183={};var _0x175186;var _0x531d92;return db['Dashboard'][_0x4311('0x7b')]({'where':{'id':_0x2f6e82[_0x4311('0x4e')]['id']}})[_0x4311('0x2e')](handleEntityNotFound(_0x4b70a5,null))[_0x4311('0x2e')](function(_0x570405){if(_0x570405){_0x175186=_0x570405;_0x3c3183[_0x4311('0x39')]=_[_0x4311('0x3a')](db['DashboardItem'][_0x4311('0x36')]);_0x3c3183['query']=_[_0x4311('0x3a')](_0x2f6e82[_0x4311('0x3b')]);_0x3c3183[_0x4311('0x3c')]=_[_0x4311('0x4f')](_0x3c3183[_0x4311('0x39')],_0x3c3183[_0x4311('0x3b')]);_0x3257e0[_0x4311('0x3d')]=_[_0x4311('0x4f')](_0x3c3183[_0x4311('0x39')],qs[_0x4311('0x3e')](_0x2f6e82[_0x4311('0x3b')][_0x4311('0x3e')]));_0x3257e0[_0x4311('0x3d')]=_0x3257e0[_0x4311('0x3d')][_0x4311('0x59')]?_0x3257e0['attributes']:_0x3c3183['model'];_0x3257e0[_0x4311('0x40')]=qs[_0x4311('0x41')](_0x2f6e82['query'][_0x4311('0x41')]);_0x3257e0['where']=qs[_0x4311('0x3c')](_[_0x4311('0x43')](_0x2f6e82[_0x4311('0x3b')],_0x3c3183[_0x4311('0x3c')]));if(_0x2f6e82[_0x4311('0x3b')][_0x4311('0x7c')]){_0x3257e0['where']=_['merge'](_0x3257e0[_0x4311('0x42')],{'$or':_[_0x4311('0x35')](_0x3257e0[_0x4311('0x3d')],function(_0x12162f){var _0x52eb78={};_0x52eb78[_0x12162f]={'$like':'%'+_0x2f6e82['query']['filter']+'%'};return _0x52eb78;})});}_0x3257e0=_[_0x4311('0x44')]({},_0x3257e0,_0x2f6e82['options']);return _0x175186['getItems'](_0x3257e0);}})[_0x4311('0x2e')](function(_0x800ed8){if(_0x800ed8){_0x531d92=_0x800ed8['length'];if(!_0x2f6e82[_0x4311('0x3b')][_0x4311('0x3f')]('nolimit')){_0x3257e0[_0x4311('0x26')]=qs['limit'](_0x2f6e82[_0x4311('0x3b')]['limit']);_0x3257e0[_0x4311('0x23')]=qs[_0x4311('0x23')](_0x2f6e82[_0x4311('0x3b')][_0x4311('0x23')]);}return _0x175186['getItems'](_0x3257e0);}})['then'](function(_0xda6b36){if(_0xda6b36){return _0xda6b36?{'count':_0x531d92,'rows':_0xda6b36}:null;}})[_0x4311('0x2e')](respondWithResult(_0x4b70a5,null))['catch'](handleError(_0x4b70a5,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 446c31e..8fdff68 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 _0xca9e=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','Dashboard'];(function(_0x5440f7,_0x38ad71){var _0x4c69d2=function(_0x2e3734){while(--_0x2e3734){_0x5440f7['push'](_0x5440f7['shift']());}};_0x4c69d2(++_0x38ad71);}(_0xca9e,0x167));var _0xeca9=function(_0x41d911,_0x32819c){_0x41d911=_0x41d911-0x0;var _0x2308d6=_0xca9e[_0x41d911];return _0x2308d6;};'use strict';var EventEmitter=require('events');var Dashboard=require('../../mysqldb')['db'][_0xeca9('0x0')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xeca9('0x1')](0x0);var events={'afterCreate':_0xeca9('0x2'),'afterUpdate':_0xeca9('0x3'),'afterDestroy':_0xeca9('0x4')};function emitEvent(_0x472167){return function(_0x37cf4a,_0x59536b,_0x1e4bea){DashboardEvents[_0xeca9('0x5')](_0x472167+':'+_0x37cf4a['id'],_0x37cf4a);DashboardEvents[_0xeca9('0x5')](_0x472167,_0x37cf4a);_0x1e4bea(null);};}for(var e in events){if(events[_0xeca9('0x6')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0xeca9('0x7')]=DashboardEvents; \ No newline at end of file +var _0x9fee=['Dashboard','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x372ded,_0x1d3b4f){var _0x3cdb70=function(_0x3e2051){while(--_0x3e2051){_0x372ded['push'](_0x372ded['shift']());}};_0x3cdb70(++_0x1d3b4f);}(_0x9fee,0x1e7));var _0xe9fe=function(_0x492641,_0x507fb0){_0x492641=_0x492641-0x0;var _0x175606=_0x9fee[_0x492641];return _0x175606;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0xe9fe('0x0'))['db'][_0xe9fe('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xe9fe('0x2'),'afterDestroy':_0xe9fe('0x3')};function emitEvent(_0x16d3a5){return function(_0x31aae7,_0x16f9f5,_0x119b0d){DashboardEvents[_0xe9fe('0x4')](_0x16d3a5+':'+_0x31aae7['id'],_0x31aae7);DashboardEvents['emit'](_0x16d3a5,_0x31aae7);_0x119b0d(null);};}for(var e in events){if(events[_0xe9fe('0x5')](e)){var event=events[e];Dashboard[_0xe9fe('0x6')](e,emitEvent(event));}}module[_0xe9fe('0x7')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 40b22d9..b84c016 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 _0xcdd6=['bluebird','request-promise','path','../../config/environment','./dashboard.attributes','exports','define','dashboards','lodash','util','../../config/logger','api','moment'];(function(_0x424a0b,_0x1c58da){var _0x3d4928=function(_0x107097){while(--_0x107097){_0x424a0b['push'](_0x424a0b['shift']());}};_0x3d4928(++_0x1c58da);}(_0xcdd6,0xbe));var _0x6cdd=function(_0x830a21,_0x299083){_0x830a21=_0x830a21-0x0;var _0x1e612e=_0xcdd6[_0x830a21];return _0x1e612e;};'use strict';var _=require(_0x6cdd('0x0'));var util=require(_0x6cdd('0x1'));var logger=require(_0x6cdd('0x2'))(_0x6cdd('0x3'));var moment=require(_0x6cdd('0x4'));var BPromise=require(_0x6cdd('0x5'));var rp=require(_0x6cdd('0x6'));var fs=require('fs');var path=require(_0x6cdd('0x7'));var rimraf=require('rimraf');var config=require(_0x6cdd('0x8'));var attributes=require(_0x6cdd('0x9'));module[_0x6cdd('0xa')]=function(_0x59b25a,_0x7fc617){return _0x59b25a[_0x6cdd('0xb')]('Dashboard',attributes,{'tableName':_0x6cdd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6db2=['Dashboard','dashboards','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3e1884,_0x5b48e6){var _0x3fe176=function(_0x2c9d9b){while(--_0x2c9d9b){_0x3e1884['push'](_0x3e1884['shift']());}};_0x3fe176(++_0x5b48e6);}(_0x6db2,0x16a));var _0x26db=function(_0x3d5aef,_0x64e2d5){_0x3d5aef=_0x3d5aef-0x0;var _0x33e385=_0x6db2[_0x3d5aef];return _0x33e385;};'use strict';var _=require('lodash');var util=require(_0x26db('0x0'));var logger=require('../../config/logger')(_0x26db('0x1'));var moment=require(_0x26db('0x2'));var BPromise=require(_0x26db('0x3'));var rp=require(_0x26db('0x4'));var fs=require('fs');var path=require(_0x26db('0x5'));var rimraf=require(_0x26db('0x6'));var config=require('../../config/environment');var attributes=require('./dashboard.attributes');module['exports']=function(_0x2dbe3a,_0x179b70){return _0x2dbe3a['define'](_0x26db('0x7'),attributes,{'tableName':_0x26db('0x8'),'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 6f66e1e..d25aedf 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 _0xbafa=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x1f5738,_0x43324e){var _0x18d808=function(_0x251a09){while(--_0x251a09){_0x1f5738['push'](_0x1f5738['shift']());}};_0x18d808(++_0x43324e);}(_0xbafa,0x81));var _0xabaf=function(_0x266d96,_0x4b9053){_0x266d96=_0x266d96-0x0;var _0x5c494b=_0xbafa[_0x266d96];return _0x5c494b;};'use strict';var _=require(_0xabaf('0x0'));var util=require(_0xabaf('0x1'));var moment=require(_0xabaf('0x2'));var BPromise=require(_0xabaf('0x3'));var rs=require(_0xabaf('0x4'));var fs=require('fs');var Redis=require(_0xabaf('0x5'));var db=require(_0xabaf('0x6'))['db'];var utils=require(_0xabaf('0x7'));var logger=require(_0xabaf('0x8'))(_0xabaf('0x9'));var config=require('../../config/environment');var jayson=require(_0xabaf('0xa'));var client=jayson[_0xabaf('0xb')][_0xabaf('0xc')]({'port':0x232a});config[_0xabaf('0xd')]=_['defaults'](config[_0xabaf('0xd')],{'host':_0xabaf('0xe'),'port':0x18eb});var socket=require(_0xabaf('0xf'))(new Redis(config['redis']));require('./dashboard.socket')[_0xabaf('0x10')](socket);function respondWithRpcPromise(_0xa70ca9,_0x2cef74,_0x1561bd){return new BPromise(function(_0x4beb0c,_0x3d1be3){return client['request'](_0xa70ca9,_0x1561bd)[_0xabaf('0x11')](function(_0x5a4337){logger[_0xabaf('0x12')](_0xabaf('0x13'),_0x2cef74,_0xabaf('0x14'));logger[_0xabaf('0x15')](_0xabaf('0x16'),_0x2cef74,_0xabaf('0x14'),JSON['stringify'](_0x5a4337));if(_0x5a4337[_0xabaf('0x17')]){if(_0x5a4337[_0xabaf('0x17')]['code']===0x1f4){logger[_0xabaf('0x17')](_0xabaf('0x13'),_0x2cef74,_0x5a4337[_0xabaf('0x17')]['message']);return _0x3d1be3(_0x5a4337[_0xabaf('0x17')]['message']);}logger['error'](_0xabaf('0x13'),_0x2cef74,_0x5a4337[_0xabaf('0x17')][_0xabaf('0x18')]);return _0x4beb0c(_0x5a4337[_0xabaf('0x17')][_0xabaf('0x18')]);}else{logger[_0xabaf('0x12')](_0xabaf('0x13'),_0x2cef74,'request\x20sent');_0x4beb0c(_0x5a4337[_0xabaf('0x19')][_0xabaf('0x18')]);}})[_0xabaf('0x1a')](function(_0xb2302){logger[_0xabaf('0x17')](_0xabaf('0x13'),_0x2cef74,_0xb2302);_0x3d1be3(_0xb2302);});});} \ No newline at end of file +var _0xaae6=['redis','localhost','socket.io-emitter','register','request','then','info','error','code','message','Dashboard,\x20%s,\x20%s','request\x20sent','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise'];(function(_0x513627,_0x2ad74a){var _0x2f6fcb=function(_0x439aba){while(--_0x439aba){_0x513627['push'](_0x513627['shift']());}};_0x2f6fcb(++_0x2ad74a);}(_0xaae6,0xd3));var _0x6aae=function(_0x3c239f,_0x2b1c00){_0x3c239f=_0x3c239f-0x0;var _0x314ede=_0xaae6[_0x3c239f];return _0x314ede;};'use strict';var _=require(_0x6aae('0x0'));var util=require(_0x6aae('0x1'));var moment=require(_0x6aae('0x2'));var BPromise=require(_0x6aae('0x3'));var rs=require(_0x6aae('0x4'));var fs=require('fs');var Redis=require(_0x6aae('0x5'));var db=require(_0x6aae('0x6'))['db'];var utils=require(_0x6aae('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x6aae('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x6aae('0x9')]=_['defaults'](config['redis'],{'host':_0x6aae('0xa'),'port':0x18eb});var socket=require(_0x6aae('0xb'))(new Redis(config[_0x6aae('0x9')]));require('./dashboard.socket')[_0x6aae('0xc')](socket);function respondWithRpcPromise(_0x51e732,_0x1305f3,_0x1f6b28){return new BPromise(function(_0x4dc2de,_0x2887af){return client[_0x6aae('0xd')](_0x51e732,_0x1f6b28)[_0x6aae('0xe')](function(_0x6cc9ce){logger[_0x6aae('0xf')]('Dashboard,\x20%s,\x20%s',_0x1305f3,'request\x20sent');logger['debug']('Dashboard,\x20%s,\x20%s,\x20%s',_0x1305f3,'request\x20sent',JSON['stringify'](_0x6cc9ce));if(_0x6cc9ce[_0x6aae('0x10')]){if(_0x6cc9ce['error'][_0x6aae('0x11')]===0x1f4){logger[_0x6aae('0x10')]('Dashboard,\x20%s,\x20%s',_0x1305f3,_0x6cc9ce[_0x6aae('0x10')][_0x6aae('0x12')]);return _0x2887af(_0x6cc9ce['error'][_0x6aae('0x12')]);}logger[_0x6aae('0x10')](_0x6aae('0x13'),_0x1305f3,_0x6cc9ce[_0x6aae('0x10')]['message']);return _0x4dc2de(_0x6cc9ce[_0x6aae('0x10')][_0x6aae('0x12')]);}else{logger['info']('Dashboard,\x20%s,\x20%s',_0x1305f3,_0x6aae('0x14'));_0x4dc2de(_0x6cc9ce[_0x6aae('0x15')][_0x6aae('0x12')]);}})['catch'](function(_0x58c84a){logger[_0x6aae('0x10')](_0x6aae('0x13'),_0x1305f3,_0x58c84a);_0x2887af(_0x58c84a);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index fe5fb55..1a7a807 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 _0x5843=['emit','removeListener','register','length','dashboard:','./dashboard.events','save','update'];(function(_0x5948dd,_0x1f6ac8){var _0xb1f8be=function(_0x31a8d2){while(--_0x31a8d2){_0x5948dd['push'](_0x5948dd['shift']());}};_0xb1f8be(++_0x1f6ac8);}(_0x5843,0x125));var _0x3584=function(_0x4140ae,_0xcb01d1){_0x4140ae=_0x4140ae-0x0;var _0x53efca=_0x5843[_0x4140ae];return _0x53efca;};'use strict';var DashboardEvents=require(_0x3584('0x0'));var events=[_0x3584('0x1'),'remove',_0x3584('0x2')];function createListener(_0x1761f5,_0x5da417){return function(_0x54b76a){_0x5da417[_0x3584('0x3')](_0x1761f5,_0x54b76a);};}function removeListener(_0x1fb789,_0x57ad40){return function(){DashboardEvents[_0x3584('0x4')](_0x1fb789,_0x57ad40);};}exports[_0x3584('0x5')]=function(_0x6f357b){for(var _0x4dff1c=0x0,_0x2eec25=events[_0x3584('0x6')];_0x4dff1c<_0x2eec25;_0x4dff1c++){var _0x3a4333=events[_0x4dff1c];var _0x2fdba9=createListener(_0x3584('0x7')+_0x3a4333,_0x6f357b);DashboardEvents['on'](_0x3a4333,_0x2fdba9);}}; \ No newline at end of file +var _0xc44e=['update','removeListener','register','length','dashboard:','remove'];(function(_0x4b4638,_0xe99cda){var _0x59e92b=function(_0x2817ea){while(--_0x2817ea){_0x4b4638['push'](_0x4b4638['shift']());}};_0x59e92b(++_0xe99cda);}(_0xc44e,0x173));var _0xec44=function(_0x22ca29,_0x17a9b3){_0x22ca29=_0x22ca29-0x0;var _0x5194b6=_0xc44e[_0x22ca29];return _0x5194b6;};'use strict';var DashboardEvents=require('./dashboard.events');var events=['save',_0xec44('0x0'),_0xec44('0x1')];function createListener(_0x3bcbfa,_0x44724d){return function(_0x43eff5){_0x44724d['emit'](_0x3bcbfa,_0x43eff5);};}function removeListener(_0x570cd3,_0xf37be1){return function(){DashboardEvents[_0xec44('0x2')](_0x570cd3,_0xf37be1);};}exports[_0xec44('0x3')]=function(_0x91bc1d){for(var _0x40cead=0x0,_0x210f58=events[_0xec44('0x4')];_0x40cead<_0x210f58;_0x40cead++){var _0x3d49d4=events[_0x40cead];var _0x468bfb=createListener(_0xec44('0x5')+_0x3d49d4,_0x91bc1d);DashboardEvents['on'](_0x3d49d4,_0x468bfb);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 153c5c2..19ba55c 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 _0xa0b9=['/:id','/:id/items','getItems','post','create','/:id/clone','clone','addItem','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./dashboard.controller','get','isAuthenticated','index'];(function(_0xcce3fa,_0x108755){var _0x58f1ed=function(_0x5f38ec){while(--_0x5f38ec){_0xcce3fa['push'](_0xcce3fa['shift']());}};_0x58f1ed(++_0x108755);}(_0xa0b9,0x1ef));var _0x9a0b=function(_0x35f677,_0x4cc714){_0x35f677=_0x35f677-0x0;var _0x321dec=_0xa0b9[_0x35f677];return _0x321dec;};'use strict';var multer=require(_0x9a0b('0x0'));var util=require(_0x9a0b('0x1'));var path=require('path');var timeout=require(_0x9a0b('0x2'));var express=require(_0x9a0b('0x3'));var router=express[_0x9a0b('0x4')]();var fs_extra=require(_0x9a0b('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9a0b('0x6'));var controller=require(_0x9a0b('0x7'));router[_0x9a0b('0x8')]('/',auth[_0x9a0b('0x9')](),controller[_0x9a0b('0xa')]);router['get'](_0x9a0b('0xb'),auth[_0x9a0b('0x9')](),controller['show']);router[_0x9a0b('0x8')](_0x9a0b('0xc'),auth['isAuthenticated'](),controller[_0x9a0b('0xd')]);router[_0x9a0b('0xe')]('/',auth[_0x9a0b('0x9')](),controller[_0x9a0b('0xf')]);router['post'](_0x9a0b('0x10'),auth['isAuthenticated'](),controller[_0x9a0b('0x11')]);router[_0x9a0b('0xe')]('/:id/items',auth[_0x9a0b('0x9')](),controller[_0x9a0b('0x12')]);router[_0x9a0b('0x13')](_0x9a0b('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x9a0b('0x14')](_0x9a0b('0xb'),auth[_0x9a0b('0x9')](),controller[_0x9a0b('0x15')]);module[_0x9a0b('0x16')]=router; \ No newline at end of file +var _0xd457=['./dashboard.controller','get','isAuthenticated','/:id','show','post','create','/:id/clone','clone','/:id/items','update','delete','destroy','exports','multer','path','Router','../../components/interaction/service'];(function(_0x1aeda3,_0x1c091e){var _0x5f074d=function(_0x53330b){while(--_0x53330b){_0x1aeda3['push'](_0x1aeda3['shift']());}};_0x5f074d(++_0x1c091e);}(_0xd457,0x1ac));var _0x7d45=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xd457[_0xaa0309];return _0x5de7ce;};'use strict';var multer=require(_0x7d45('0x0'));var util=require('util');var path=require(_0x7d45('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7d45('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7d45('0x3'));var config=require('../../config/environment');var controller=require(_0x7d45('0x4'));router[_0x7d45('0x5')]('/',auth[_0x7d45('0x6')](),controller['index']);router[_0x7d45('0x5')](_0x7d45('0x7'),auth[_0x7d45('0x6')](),controller[_0x7d45('0x8')]);router[_0x7d45('0x5')]('/:id/items',auth[_0x7d45('0x6')](),controller['getItems']);router[_0x7d45('0x9')]('/',auth['isAuthenticated'](),controller[_0x7d45('0xa')]);router[_0x7d45('0x9')](_0x7d45('0xb'),auth[_0x7d45('0x6')](),controller[_0x7d45('0xc')]);router[_0x7d45('0x9')](_0x7d45('0xd'),auth[_0x7d45('0x6')](),controller['addItem']);router['put'](_0x7d45('0x7'),auth[_0x7d45('0x6')](),controller[_0x7d45('0xe')]);router[_0x7d45('0xf')]('/:id',auth[_0x7d45('0x6')](),controller[_0x7d45('0x10')]);module[_0x7d45('0x11')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index ca7da17..e5b0126 100644 --- a/server/api/dashboardItem/dashboardItem.attributes.js +++ b/server/api/dashboardItem/dashboardItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['#2196f3','sequelize','exports','STRING','TEXT','long','parse','getDataValue','attrs','stringify','setDataValue','INTEGER','#ffffff'];(function(_0x3c7e89,_0x1012cf){var _0x4917eb=function(_0x200ae0){while(--_0x200ae0){_0x3c7e89['push'](_0x3c7e89['shift']());}};_0x4917eb(++_0x1012cf);}(_0x326f,0xd1));var _0xf326=function(_0x43e269,_0x55c171){_0x43e269=_0x43e269-0x0;var _0x57518a=_0x326f[_0x43e269];return _0x57518a;};'use strict';var Sequelize=require(_0xf326('0x0'));var squel=require('squel');var _=require('lodash');module[_0xf326('0x1')]={'title':{'type':Sequelize[_0xf326('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf326('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xf326('0x3')](_0xf326('0x4')),'get':function(){try{return JSON[_0xf326('0x5')](this[_0xf326('0x6')](_0xf326('0x7')));}catch(_0x1b5a56){return[];}},'set':function(_0x3ace29){try{this['setDataValue'](_0xf326('0x7'),JSON[_0xf326('0x8')](_0x3ace29));}catch(_0x165f95){this[_0xf326('0x9')]('attrs',JSON['stringify']([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xf326('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xf326('0xa')]},'col':{'type':Sequelize[_0xf326('0xa')]},'background':{'type':Sequelize[_0xf326('0x2')],'allowNull':![],'defaultValue':_0xf326('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf326('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0xf326('0xa')],'defaultValue':0xc}}; \ No newline at end of file +var _0x4975=['parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize','lodash','exports','STRING','TEXT','long'];(function(_0x5023ae,_0x2c8f4a){var _0x1179b4=function(_0x45e5f2){while(--_0x45e5f2){_0x5023ae['push'](_0x5023ae['shift']());}};_0x1179b4(++_0x2c8f4a);}(_0x4975,0x86));var _0x5497=function(_0x5f4ce7,_0x4a3a21){_0x5f4ce7=_0x5f4ce7-0x0;var _0x539884=_0x4975[_0x5f4ce7];return _0x539884;};'use strict';var Sequelize=require(_0x5497('0x0'));var squel=require('squel');var _=require(_0x5497('0x1'));module[_0x5497('0x2')]={'title':{'type':Sequelize[_0x5497('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x5497('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x5497('0x4')](_0x5497('0x5')),'get':function(){try{return JSON[_0x5497('0x6')](this[_0x5497('0x7')](_0x5497('0x8')));}catch(_0x5d5272){return[];}},'set':function(_0x539a27){try{this[_0x5497('0x9')]('attrs',JSON[_0x5497('0xa')](_0x539a27));}catch(_0x674a2a){this[_0x5497('0x9')]('attrs',JSON[_0x5497('0xa')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x5497('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x5497('0xb')]},'col':{'type':Sequelize[_0x5497('0xb')]},'background':{'type':Sequelize[_0x5497('0x3')],'allowNull':![],'defaultValue':_0x5497('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x5497('0x3')],'allowNull':![],'defaultValue':_0x5497('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x5497('0x3')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index a62400a..8e6f2bf 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 _0xc30e=['model','keys','rawAttributes','query','intersection','attributes','fields','length','includeAll','include','options','find','DashboardItem','catch','type','iframe','attrs','https://','custom','attrPath','attrHourFormat','HH:mm:ss','value','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','stack','name','send','show'];(function(_0x4f925f,_0x310069){var _0x4b76cf=function(_0x113b4b){while(--_0x113b4b){_0x4f925f['push'](_0x4f925f['shift']());}};_0x4b76cf(++_0x310069);}(_0xc30e,0x1d8));var _0xec30=function(_0x1aa324,_0x38a422){_0x1aa324=_0x1aa324-0x0;var _0x53fedd=_0xc30e[_0x1aa324];return _0x53fedd;};'use strict';var emlformat=require(_0xec30('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xec30('0x1'));var jsonpatch=require(_0xec30('0x2'));var rp=require(_0xec30('0x3'));var moment=require(_0xec30('0x4'));var BPromise=require(_0xec30('0x5'));var Mustache=require(_0xec30('0x6'));var util=require(_0xec30('0x7'));var path=require('path');var sox=require(_0xec30('0x8'));var csv=require(_0xec30('0x9'));var ejs=require(_0xec30('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xec30('0xb'));var squel=require(_0xec30('0xc'));var crypto=require(_0xec30('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xec30('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xec30('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xec30('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xec30('0x11'))(_0xec30('0x12'));var utils=require(_0xec30('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xec30('0x14'));var db=require('../../mysqldb')['db'];config[_0xec30('0x15')]=_[_0xec30('0x16')](config[_0xec30('0x15')],{'host':_0xec30('0x17'),'port':0x18eb});var socket=require(_0xec30('0x18'))(new Redis(config[_0xec30('0x15')]));require('./dashboardItem.socket')['register'](socket);function respondWithStatusCode(_0xad1adb,_0x26619a){_0x26619a=_0x26619a||0xcc;return function(_0x3eecd2){if(_0x3eecd2){return _0xad1adb[_0xec30('0x19')](_0x26619a);}return _0xad1adb[_0xec30('0x1a')](_0x26619a)[_0xec30('0x1b')]();};}function respondWithResult(_0x7346c7,_0x168286){_0x168286=_0x168286||0xc8;return function(_0x4ff6df){if(_0x4ff6df){return _0x7346c7[_0xec30('0x1a')](_0x168286)[_0xec30('0x1c')](_0x4ff6df);}};}function respondWithFilteredResult(_0x599dad,_0x22d3fb){return function(_0x522025){if(_0x522025){var _0xc925c1=typeof _0x22d3fb[_0xec30('0x1d')]===_0xec30('0x1e')&&typeof _0x22d3fb[_0xec30('0x1f')]===_0xec30('0x1e');var _0x50d146=_0x522025[_0xec30('0x20')];var _0x574270=_0xc925c1?0x0:_0x22d3fb[_0xec30('0x1d')];var _0x81c47f=_0xc925c1?_0x522025[_0xec30('0x20')]:_0x22d3fb[_0xec30('0x1d')]+_0x22d3fb[_0xec30('0x1f')];var _0x5efcd9;if(_0x81c47f>=_0x50d146){_0x81c47f=_0x50d146;_0x5efcd9=0xc8;}else{_0x5efcd9=0xce;}_0x599dad[_0xec30('0x1a')](_0x5efcd9);return _0x599dad[_0xec30('0x21')](_0xec30('0x22'),_0x574270+'-'+_0x81c47f+'/'+_0x50d146)[_0xec30('0x1c')](_0x522025);}return null;};}function patchUpdates(_0x4ca8a5){return function(_0x3afc05){try{jsonpatch[_0xec30('0x23')](_0x3afc05,_0x4ca8a5,!![]);}catch(_0x4ad9e9){return BPromise['reject'](_0x4ad9e9);}return _0x3afc05[_0xec30('0x24')]();};}function saveUpdates(_0x417d9e,_0x47b999){return function(_0x42d795){if(_0x42d795){return _0x42d795['update'](_0x417d9e)[_0xec30('0x25')](function(_0x2102c4){return _0x2102c4;});}return null;};}function removeEntity(_0x269b78,_0x3a34ea){return function(_0x4c042f){if(_0x4c042f){return _0x4c042f[_0xec30('0x26')]()['then'](function(){_0x269b78['status'](0xcc)[_0xec30('0x1b')]();});}};}function handleEntityNotFound(_0x5c49e2,_0x10df17){return function(_0x4077ed){if(!_0x4077ed){_0x5c49e2[_0xec30('0x19')](0x194);}return _0x4077ed;};}function handleError(_0x518c8b,_0x1a13e9){_0x1a13e9=_0x1a13e9||0x1f4;return function(_0x501f4f){logger[_0xec30('0x27')](_0x501f4f[_0xec30('0x28')]);if(_0x501f4f[_0xec30('0x29')]){delete _0x501f4f['name'];}_0x518c8b['status'](_0x1a13e9)[_0xec30('0x2a')](_0x501f4f);};}exports[_0xec30('0x2b')]=function(_0x38a409,_0x2b0c6f){var _0x200bee={'raw':![],'where':{'id':_0x38a409['params']['id']}},_0x4961f6={};_0x4961f6[_0xec30('0x2c')]=_[_0xec30('0x2d')](db['DashboardItem'][_0xec30('0x2e')]);_0x4961f6['query']=_[_0xec30('0x2d')](_0x38a409[_0xec30('0x2f')]);_0x4961f6['filters']=_[_0xec30('0x30')](_0x4961f6['model'],_0x4961f6['query']);_0x200bee[_0xec30('0x31')]=_[_0xec30('0x30')](_0x4961f6['model'],qs[_0xec30('0x32')](_0x38a409['query'][_0xec30('0x32')]));_0x200bee[_0xec30('0x31')]=_0x200bee[_0xec30('0x31')][_0xec30('0x33')]?_0x200bee['attributes']:_0x4961f6[_0xec30('0x2c')];if(_0x38a409[_0xec30('0x2f')][_0xec30('0x34')]){_0x200bee[_0xec30('0x35')]=[{'all':!![]}];}_0x200bee=_['merge']({},_0x200bee,_0x38a409[_0xec30('0x36')]);return db['DashboardItem'][_0xec30('0x37')](_0x200bee)['then'](handleEntityNotFound(_0x2b0c6f,null))[_0xec30('0x25')](respondWithResult(_0x2b0c6f,null))['catch'](handleError(_0x2b0c6f,null));};exports[_0xec30('0x26')]=function(_0x168cfb,_0x369bc6){return db[_0xec30('0x38')][_0xec30('0x37')]({'where':{'id':_0x168cfb['params']['id']}})[_0xec30('0x25')](handleEntityNotFound(_0x369bc6,null))['then'](removeEntity(_0x369bc6,null))[_0xec30('0x39')](handleError(_0x369bc6,null));};function widgetAttributes(_0x52f6ce){try{switch(_0x52f6ce[_0xec30('0x3a')]){case _0xec30('0x3b'):return[{'name':'attrUrl','value':_0x52f6ce['attrUrl']||(_0x52f6ce[_0xec30('0x3c')]&&_0x52f6ce[_0xec30('0x3c')][0x0]?_0x52f6ce['attrs'][0x0]['value']:undefined)||_0xec30('0x3d')}];case _0xec30('0x3e'):return[{'name':_0xec30('0x3f'),'value':_0x52f6ce[_0xec30('0x3f')]||(_0x52f6ce[_0xec30('0x3c')]&&_0x52f6ce[_0xec30('0x3c')][0x0]?_0x52f6ce[_0xec30('0x3c')][0x0]['value']:undefined)||''}];case'clock':return[{'name':_0xec30('0x40'),'value':_0x52f6ce[_0xec30('0x40')]||(_0x52f6ce[_0xec30('0x3c')]&&_0x52f6ce[_0xec30('0x3c')][0x0]?_0x52f6ce[_0xec30('0x3c')][0x0]['value']:undefined)||_0xec30('0x41')},{'name':'attrTimezone','value':_0x52f6ce['attrTimezone']||(_0x52f6ce[_0xec30('0x3c')]&&_0x52f6ce[_0xec30('0x3c')][0x1]?_0x52f6ce['attrs'][0x1][_0xec30('0x42')]:undefined)||_0xec30('0x43')},{'name':_0xec30('0x44'),'value':_0x52f6ce[_0xec30('0x44')]||(_0x52f6ce[_0xec30('0x3c')]&&_0x52f6ce['attrs'][0x2]?_0x52f6ce['attrs'][0x2][_0xec30('0x42')]:undefined)||0xc}];case _0xec30('0x45'):return[{'name':_0xec30('0x46'),'value':_0x52f6ce[_0xec30('0x46')]||(_0x52f6ce[_0xec30('0x3c')]&&_0x52f6ce[_0xec30('0x3c')][0x0]?_0x52f6ce['attrs'][0x0]['value']:undefined)||_0xec30('0x47')},{'name':_0xec30('0x48'),'value':_0x52f6ce[_0xec30('0x48')]||(_0x52f6ce['attrs']&&_0x52f6ce[_0xec30('0x3c')][0x1]?_0x52f6ce[_0xec30('0x3c')][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x52f6ce[_0xec30('0x44')]||(_0x52f6ce[_0xec30('0x3c')]&&_0x52f6ce[_0xec30('0x3c')][0x2]?_0x52f6ce[_0xec30('0x3c')][0x2]['value']:undefined)||0x14}];case _0xec30('0x49'):case _0xec30('0x4a'):return[{'name':_0xec30('0x4b'),'value':_0x52f6ce['attrSerie1']||(_0x52f6ce[_0xec30('0x3c')]&&_0x52f6ce['attrs'][0x0]?_0x52f6ce[_0xec30('0x3c')][0x0][_0xec30('0x42')]:undefined)||_0xec30('0x47')},{'name':_0xec30('0x4c'),'value':_0x52f6ce[_0xec30('0x4c')]||(_0x52f6ce[_0xec30('0x3c')]&&_0x52f6ce[_0xec30('0x3c')][0x1]?_0x52f6ce[_0xec30('0x3c')][0x1][_0xec30('0x42')]:undefined)||null},{'name':'attrSerie3','value':_0x52f6ce[_0xec30('0x4d')]||(_0x52f6ce[_0xec30('0x3c')]&&_0x52f6ce[_0xec30('0x3c')][0x2]?_0x52f6ce[_0xec30('0x3c')][0x2]['value']:undefined)||null},{'name':_0xec30('0x48'),'value':_0x52f6ce['attrVoiceQueues']||(_0x52f6ce[_0xec30('0x3c')]&&_0x52f6ce['attrs'][0x3]?_0x52f6ce['attrs'][0x3][_0xec30('0x42')]:undefined)||[]}];case _0xec30('0x4e'):return[{'name':_0xec30('0x4f'),'type':_0x52f6ce[_0xec30('0x50')]||(_0x52f6ce[_0xec30('0x3c')]&&_0x52f6ce['attrs'][0x0]?_0x52f6ce[_0xec30('0x3c')][0x0][_0xec30('0x3a')]:undefined)||null,'value':_0x52f6ce[_0xec30('0x4f')]||(_0x52f6ce[_0xec30('0x3c')]&&_0x52f6ce[_0xec30('0x3c')][0x0]?_0x52f6ce[_0xec30('0x3c')][0x0][_0xec30('0x42')]:undefined)||null},{'name':_0xec30('0x51'),'value':_0x52f6ce[_0xec30('0x51')]||(_0x52f6ce[_0xec30('0x3c')]&&_0x52f6ce[_0xec30('0x3c')][0x1]?_0x52f6ce[_0xec30('0x3c')][0x1][_0xec30('0x42')]:undefined)||0x0}];default:return[];}}catch(_0x535f87){logger[_0xec30('0x27')](_0xec30('0x52'),JSON['stringify'](_0x535f87));return[];}}exports[_0xec30('0x53')]=function(_0x4484f6,_0x42d15f){if(_0x4484f6[_0xec30('0x54')]){_0x4484f6[_0xec30('0x54')][_0xec30('0x3c')]=widgetAttributes(_0x4484f6[_0xec30('0x54')]);}return db[_0xec30('0x38')][_0xec30('0x53')](_0x4484f6[_0xec30('0x54')],{})[_0xec30('0x25')](respondWithResult(_0x42d15f,0xc9))[_0xec30('0x39')](handleError(_0x42d15f,null));};exports['update']=function(_0x14049b,_0x52bd97){if(_0x14049b[_0xec30('0x54')]['id']){delete _0x14049b['body']['id'];}_0x14049b[_0xec30('0x54')]['attrs']=widgetAttributes(_0x14049b[_0xec30('0x54')]);return db[_0xec30('0x38')][_0xec30('0x37')]({'where':{'id':_0x14049b[_0xec30('0x55')]['id']}})[_0xec30('0x25')](handleEntityNotFound(_0x52bd97,null))[_0xec30('0x25')](saveUpdates(_0x14049b[_0xec30('0x54')],null))[_0xec30('0x25')](respondWithResult(_0x52bd97,null))[_0xec30('0x39')](handleError(_0x52bd97,null));}; \ No newline at end of file +var _0x6b8f=['includeAll','include','merge','options','find','catch','destroy','type','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','json','undefined','limit','count','offset','status','set','Content-Range','apply','save','update','then','end','error','stack','name','send','params','model','DashboardItem','rawAttributes','query','keys','filters','intersection','fields','attributes','length'];(function(_0x460497,_0x53cd21){var _0x19af1b=function(_0x58d626){while(--_0x58d626){_0x460497['push'](_0x460497['shift']());}};_0x19af1b(++_0x53cd21);}(_0x6b8f,0xdc));var _0xf6b8=function(_0x588471,_0x40db5a){_0x588471=_0x588471-0x0;var _0x7e131d=_0x6b8f[_0x588471];return _0x7e131d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf6b8('0x0'));var rp=require(_0xf6b8('0x1'));var moment=require(_0xf6b8('0x2'));var BPromise=require(_0xf6b8('0x3'));var Mustache=require(_0xf6b8('0x4'));var util=require(_0xf6b8('0x5'));var path=require('path');var sox=require(_0xf6b8('0x6'));var csv=require('to-csv');var ejs=require(_0xf6b8('0x7'));var fs=require('fs');var fs_extra=require(_0xf6b8('0x8'));var _=require(_0xf6b8('0x9'));var squel=require(_0xf6b8('0xa'));var crypto=require(_0xf6b8('0xb'));var jsforce=require(_0xf6b8('0xc'));var deskjs=require(_0xf6b8('0xd'));var toCsv=require(_0xf6b8('0xe'));var querystring=require('querystring');var Papa=require(_0xf6b8('0xf'));var Redis=require(_0xf6b8('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf6b8('0x11'));var as=require(_0xf6b8('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf6b8('0x13'))(_0xf6b8('0x14'));var utils=require(_0xf6b8('0x15'));var config=require(_0xf6b8('0x16'));var licenseUtil=require(_0xf6b8('0x17'));var db=require(_0xf6b8('0x18'))['db'];config[_0xf6b8('0x19')]=_[_0xf6b8('0x1a')](config[_0xf6b8('0x19')],{'host':_0xf6b8('0x1b'),'port':0x18eb});var socket=require(_0xf6b8('0x1c'))(new Redis(config[_0xf6b8('0x19')]));require('./dashboardItem.socket')[_0xf6b8('0x1d')](socket);function respondWithStatusCode(_0x1c684,_0x44a075){_0x44a075=_0x44a075||0xcc;return function(_0x41aa4a){if(_0x41aa4a){return _0x1c684[_0xf6b8('0x1e')](_0x44a075);}return _0x1c684['status'](_0x44a075)['end']();};}function respondWithResult(_0x15a8e9,_0x273a64){_0x273a64=_0x273a64||0xc8;return function(_0x2faf03){if(_0x2faf03){return _0x15a8e9['status'](_0x273a64)[_0xf6b8('0x1f')](_0x2faf03);}};}function respondWithFilteredResult(_0x1a2b25,_0x3e9c7c){return function(_0x51dae8){if(_0x51dae8){var _0x35da7b=typeof _0x3e9c7c['offset']===_0xf6b8('0x20')&&typeof _0x3e9c7c[_0xf6b8('0x21')]==='undefined';var _0x5088cd=_0x51dae8[_0xf6b8('0x22')];var _0x9518c=_0x35da7b?0x0:_0x3e9c7c[_0xf6b8('0x23')];var _0x47849=_0x35da7b?_0x51dae8[_0xf6b8('0x22')]:_0x3e9c7c['offset']+_0x3e9c7c[_0xf6b8('0x21')];var _0x38fe68;if(_0x47849>=_0x5088cd){_0x47849=_0x5088cd;_0x38fe68=0xc8;}else{_0x38fe68=0xce;}_0x1a2b25[_0xf6b8('0x24')](_0x38fe68);return _0x1a2b25[_0xf6b8('0x25')](_0xf6b8('0x26'),_0x9518c+'-'+_0x47849+'/'+_0x5088cd)[_0xf6b8('0x1f')](_0x51dae8);}return null;};}function patchUpdates(_0xbbc09c){return function(_0xb51d60){try{jsonpatch[_0xf6b8('0x27')](_0xb51d60,_0xbbc09c,!![]);}catch(_0x3b31b4){return BPromise['reject'](_0x3b31b4);}return _0xb51d60[_0xf6b8('0x28')]();};}function saveUpdates(_0x503fa2,_0x435675){return function(_0x28cfde){if(_0x28cfde){return _0x28cfde[_0xf6b8('0x29')](_0x503fa2)[_0xf6b8('0x2a')](function(_0x2c9d75){return _0x2c9d75;});}return null;};}function removeEntity(_0x2cf6ce,_0x542d8b){return function(_0x32b182){if(_0x32b182){return _0x32b182['destroy']()['then'](function(){_0x2cf6ce[_0xf6b8('0x24')](0xcc)[_0xf6b8('0x2b')]();});}};}function handleEntityNotFound(_0x4f6a31,_0x5c749b){return function(_0x2cf766){if(!_0x2cf766){_0x4f6a31['sendStatus'](0x194);}return _0x2cf766;};}function handleError(_0x2e7ca0,_0x53eead){_0x53eead=_0x53eead||0x1f4;return function(_0x416fe8){logger[_0xf6b8('0x2c')](_0x416fe8[_0xf6b8('0x2d')]);if(_0x416fe8['name']){delete _0x416fe8[_0xf6b8('0x2e')];}_0x2e7ca0[_0xf6b8('0x24')](_0x53eead)[_0xf6b8('0x2f')](_0x416fe8);};}exports['show']=function(_0x54ee9b,_0x3a5448){var _0x3bdbc3={'raw':![],'where':{'id':_0x54ee9b[_0xf6b8('0x30')]['id']}},_0x14b512={};_0x14b512[_0xf6b8('0x31')]=_['keys'](db[_0xf6b8('0x32')][_0xf6b8('0x33')]);_0x14b512[_0xf6b8('0x34')]=_[_0xf6b8('0x35')](_0x54ee9b[_0xf6b8('0x34')]);_0x14b512[_0xf6b8('0x36')]=_[_0xf6b8('0x37')](_0x14b512[_0xf6b8('0x31')],_0x14b512[_0xf6b8('0x34')]);_0x3bdbc3['attributes']=_[_0xf6b8('0x37')](_0x14b512['model'],qs[_0xf6b8('0x38')](_0x54ee9b['query'][_0xf6b8('0x38')]));_0x3bdbc3[_0xf6b8('0x39')]=_0x3bdbc3[_0xf6b8('0x39')][_0xf6b8('0x3a')]?_0x3bdbc3[_0xf6b8('0x39')]:_0x14b512['model'];if(_0x54ee9b[_0xf6b8('0x34')][_0xf6b8('0x3b')]){_0x3bdbc3[_0xf6b8('0x3c')]=[{'all':!![]}];}_0x3bdbc3=_[_0xf6b8('0x3d')]({},_0x3bdbc3,_0x54ee9b[_0xf6b8('0x3e')]);return db[_0xf6b8('0x32')][_0xf6b8('0x3f')](_0x3bdbc3)[_0xf6b8('0x2a')](handleEntityNotFound(_0x3a5448,null))[_0xf6b8('0x2a')](respondWithResult(_0x3a5448,null))[_0xf6b8('0x40')](handleError(_0x3a5448,null));};exports[_0xf6b8('0x41')]=function(_0x5ee641,_0x35ce6e){return db[_0xf6b8('0x32')]['find']({'where':{'id':_0x5ee641['params']['id']}})[_0xf6b8('0x2a')](handleEntityNotFound(_0x35ce6e,null))['then'](removeEntity(_0x35ce6e,null))['catch'](handleError(_0x35ce6e,null));};function widgetAttributes(_0x210bf8){try{switch(_0x210bf8[_0xf6b8('0x42')]){case _0xf6b8('0x43'):return[{'name':'attrUrl','value':_0x210bf8[_0xf6b8('0x44')]||(_0x210bf8[_0xf6b8('0x45')]&&_0x210bf8[_0xf6b8('0x45')][0x0]?_0x210bf8[_0xf6b8('0x45')][0x0][_0xf6b8('0x46')]:undefined)||'https://'}];case _0xf6b8('0x47'):return[{'name':_0xf6b8('0x48'),'value':_0x210bf8['attrPath']||(_0x210bf8[_0xf6b8('0x45')]&&_0x210bf8['attrs'][0x0]?_0x210bf8[_0xf6b8('0x45')][0x0]['value']:undefined)||''}];case _0xf6b8('0x49'):return[{'name':_0xf6b8('0x4a'),'value':_0x210bf8['attrHourFormat']||(_0x210bf8[_0xf6b8('0x45')]&&_0x210bf8[_0xf6b8('0x45')][0x0]?_0x210bf8[_0xf6b8('0x45')][0x0][_0xf6b8('0x46')]:undefined)||_0xf6b8('0x4b')},{'name':_0xf6b8('0x4c'),'value':_0x210bf8[_0xf6b8('0x4c')]||(_0x210bf8['attrs']&&_0x210bf8['attrs'][0x1]?_0x210bf8['attrs'][0x1]['value']:undefined)||_0xf6b8('0x4d')},{'name':_0xf6b8('0x4e'),'value':_0x210bf8[_0xf6b8('0x4e')]||(_0x210bf8[_0xf6b8('0x45')]&&_0x210bf8[_0xf6b8('0x45')][0x2]?_0x210bf8['attrs'][0x2][_0xf6b8('0x46')]:undefined)||0xc}];case'counter':return[{'name':_0xf6b8('0x4f'),'value':_0x210bf8[_0xf6b8('0x4f')]||(_0x210bf8['attrs']&&_0x210bf8[_0xf6b8('0x45')][0x0]?_0x210bf8[_0xf6b8('0x45')][0x0]['value']:undefined)||_0xf6b8('0x50')},{'name':_0xf6b8('0x51'),'value':_0x210bf8[_0xf6b8('0x51')]||(_0x210bf8[_0xf6b8('0x45')]&&_0x210bf8['attrs'][0x1]?_0x210bf8[_0xf6b8('0x45')][0x1]['value']:undefined)||[]},{'name':_0xf6b8('0x4e'),'value':_0x210bf8[_0xf6b8('0x4e')]||(_0x210bf8[_0xf6b8('0x45')]&&_0x210bf8[_0xf6b8('0x45')][0x2]?_0x210bf8[_0xf6b8('0x45')][0x2][_0xf6b8('0x46')]:undefined)||0x14}];case'multibar-chart':case'pie-chart':return[{'name':_0xf6b8('0x52'),'value':_0x210bf8[_0xf6b8('0x52')]||(_0x210bf8['attrs']&&_0x210bf8[_0xf6b8('0x45')][0x0]?_0x210bf8[_0xf6b8('0x45')][0x0]['value']:undefined)||_0xf6b8('0x50')},{'name':_0xf6b8('0x53'),'value':_0x210bf8[_0xf6b8('0x53')]||(_0x210bf8['attrs']&&_0x210bf8[_0xf6b8('0x45')][0x1]?_0x210bf8['attrs'][0x1][_0xf6b8('0x46')]:undefined)||null},{'name':_0xf6b8('0x54'),'value':_0x210bf8['attrSerie3']||(_0x210bf8['attrs']&&_0x210bf8[_0xf6b8('0x45')][0x2]?_0x210bf8[_0xf6b8('0x45')][0x2][_0xf6b8('0x46')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x210bf8['attrVoiceQueues']||(_0x210bf8[_0xf6b8('0x45')]&&_0x210bf8['attrs'][0x3]?_0x210bf8[_0xf6b8('0x45')][0x3][_0xf6b8('0x46')]:undefined)||[]}];case _0xf6b8('0x55'):return[{'name':_0xf6b8('0x56'),'type':_0x210bf8[_0xf6b8('0x57')]||(_0x210bf8[_0xf6b8('0x45')]&&_0x210bf8[_0xf6b8('0x45')][0x0]?_0x210bf8[_0xf6b8('0x45')][0x0][_0xf6b8('0x42')]:undefined)||null,'value':_0x210bf8['attrReport']||(_0x210bf8[_0xf6b8('0x45')]&&_0x210bf8['attrs'][0x0]?_0x210bf8['attrs'][0x0]['value']:undefined)||null},{'name':_0xf6b8('0x58'),'value':_0x210bf8[_0xf6b8('0x58')]||(_0x210bf8[_0xf6b8('0x45')]&&_0x210bf8[_0xf6b8('0x45')][0x1]?_0x210bf8[_0xf6b8('0x45')][0x1][_0xf6b8('0x46')]:undefined)||0x0}];default:return[];}}catch(_0x2eb4b6){logger[_0xf6b8('0x2c')](_0xf6b8('0x59'),JSON[_0xf6b8('0x5a')](_0x2eb4b6));return[];}}exports[_0xf6b8('0x5b')]=function(_0x70d372,_0x1467b4){if(_0x70d372[_0xf6b8('0x5c')]){_0x70d372[_0xf6b8('0x5c')][_0xf6b8('0x45')]=widgetAttributes(_0x70d372[_0xf6b8('0x5c')]);}return db[_0xf6b8('0x32')][_0xf6b8('0x5b')](_0x70d372[_0xf6b8('0x5c')],{})['then'](respondWithResult(_0x1467b4,0xc9))[_0xf6b8('0x40')](handleError(_0x1467b4,null));};exports[_0xf6b8('0x29')]=function(_0x7ed8e6,_0x1f131d){if(_0x7ed8e6[_0xf6b8('0x5c')]['id']){delete _0x7ed8e6[_0xf6b8('0x5c')]['id'];}_0x7ed8e6[_0xf6b8('0x5c')]['attrs']=widgetAttributes(_0x7ed8e6[_0xf6b8('0x5c')]);return db[_0xf6b8('0x32')][_0xf6b8('0x3f')]({'where':{'id':_0x7ed8e6[_0xf6b8('0x30')]['id']}})[_0xf6b8('0x2a')](handleEntityNotFound(_0x1f131d,null))['then'](saveUpdates(_0x7ed8e6[_0xf6b8('0x5c')],null))[_0xf6b8('0x2a')](respondWithResult(_0x1f131d,null))[_0xf6b8('0x40')](handleError(_0x1f131d,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 96bead2..1e90c54 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 _0xfbbc=['DashboardItem','setMaxListeners','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x50bb1e,_0x2e9729){var _0x218f40=function(_0x2b96f1){while(--_0x2b96f1){_0x50bb1e['push'](_0x50bb1e['shift']());}};_0x218f40(++_0x2e9729);}(_0xfbbc,0x86));var _0xcfbb=function(_0x446392,_0x13fb3f){_0x446392=_0x446392-0x0;var _0xb6428d=_0xfbbc[_0x446392];return _0xb6428d;};'use strict';var EventEmitter=require(_0xcfbb('0x0'));var DashboardItem=require(_0xcfbb('0x1'))['db'][_0xcfbb('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xcfbb('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xcfbb('0x4')};function emitEvent(_0x4ebe7e){return function(_0x3241db,_0x5c974b,_0x22571f){DashboardItemEvents[_0xcfbb('0x5')](_0x4ebe7e+':'+_0x3241db['id'],_0x3241db);DashboardItemEvents['emit'](_0x4ebe7e,_0x3241db);_0x22571f(null);};}for(var e in events){if(events[_0xcfbb('0x6')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0xcfbb('0x7')]=DashboardItemEvents; \ No newline at end of file +var _0x1883=['DashboardItem','update','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x535f43,_0x59611f){var _0x34b84a=function(_0x4a3730){while(--_0x4a3730){_0x535f43['push'](_0x535f43['shift']());}};_0x34b84a(++_0x59611f);}(_0x1883,0x1e8));var _0x3188=function(_0x22c0f8,_0x180e08){_0x22c0f8=_0x22c0f8-0x0;var _0x13cdc2=_0x1883[_0x22c0f8];return _0x13cdc2;};'use strict';var EventEmitter=require(_0x3188('0x0'));var DashboardItem=require(_0x3188('0x1'))['db'][_0x3188('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x3188('0x3'),'afterDestroy':_0x3188('0x4')};function emitEvent(_0xd39424){return function(_0x41f6ba,_0x579388,_0x4816a0){DashboardItemEvents[_0x3188('0x5')](_0xd39424+':'+_0x41f6ba['id'],_0x41f6ba);DashboardItemEvents[_0x3188('0x5')](_0xd39424,_0x41f6ba);_0x4816a0(null);};}for(var e in events){if(events[_0x3188('0x6')](e)){var event=events[e];DashboardItem['hook'](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 ad73a9d..09f41e7 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 _0x871e=['define','DashboardItem','dashboard_items','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./dashboardItem.attributes','exports'];(function(_0x1a6c24,_0x850253){var _0x57c210=function(_0x2ea3b1){while(--_0x2ea3b1){_0x1a6c24['push'](_0x1a6c24['shift']());}};_0x57c210(++_0x850253);}(_0x871e,0x1b0));var _0xe871=function(_0x1c6eb9,_0x35aa17){_0x1c6eb9=_0x1c6eb9-0x0;var _0xf15241=_0x871e[_0x1c6eb9];return _0xf15241;};'use strict';var _=require(_0xe871('0x0'));var util=require('util');var logger=require(_0xe871('0x1'))(_0xe871('0x2'));var moment=require(_0xe871('0x3'));var BPromise=require(_0xe871('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe871('0x5'));var rimraf=require(_0xe871('0x6'));var config=require(_0xe871('0x7'));var attributes=require(_0xe871('0x8'));module[_0xe871('0x9')]=function(_0x2c0254,_0x1068cc){return _0x2c0254[_0xe871('0xa')](_0xe871('0xb'),attributes,{'tableName':_0xe871('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x271d=['dashboard_items','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem'];(function(_0x1d4427,_0x2da4d4){var _0xd45d22=function(_0x511655){while(--_0x511655){_0x1d4427['push'](_0x1d4427['shift']());}};_0xd45d22(++_0x2da4d4);}(_0x271d,0xc4));var _0xd271=function(_0x495523,_0x2a6005){_0x495523=_0x495523-0x0;var _0x2433d7=_0x271d[_0x495523];return _0x2433d7;};'use strict';var _=require(_0xd271('0x0'));var util=require(_0xd271('0x1'));var logger=require('../../config/logger')(_0xd271('0x2'));var moment=require('moment');var BPromise=require(_0xd271('0x3'));var rp=require(_0xd271('0x4'));var fs=require('fs');var path=require(_0xd271('0x5'));var rimraf=require(_0xd271('0x6'));var config=require(_0xd271('0x7'));var attributes=require(_0xd271('0x8'));module[_0xd271('0x9')]=function(_0x3a1c19,_0xdcd18c){return _0x3a1c19[_0xd271('0xa')](_0xd271('0xb'),attributes,{'tableName':_0xd271('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 9753cc5..2aee426 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 _0xf70f=['request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register'];(function(_0x29b648,_0x5c1f31){var _0x5ab03a=function(_0x5291af){while(--_0x5291af){_0x29b648['push'](_0x29b648['shift']());}};_0x5ab03a(++_0x5c1f31);}(_0xf70f,0x93));var _0xff70=function(_0x25402e,_0x1ab8f2){_0x25402e=_0x25402e-0x0;var _0x168dbb=_0xf70f[_0x25402e];return _0x168dbb;};'use strict';var _=require('lodash');var util=require(_0xff70('0x0'));var moment=require(_0xff70('0x1'));var BPromise=require(_0xff70('0x2'));var rs=require(_0xff70('0x3'));var fs=require('fs');var Redis=require(_0xff70('0x4'));var db=require(_0xff70('0x5'))['db'];var utils=require(_0xff70('0x6'));var logger=require(_0xff70('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xff70('0x8'));var client=jayson['client'][_0xff70('0x9')]({'port':0x232a});config[_0xff70('0xa')]=_[_0xff70('0xb')](config[_0xff70('0xa')],{'host':_0xff70('0xc'),'port':0x18eb});var socket=require(_0xff70('0xd'))(new Redis(config['redis']));require('./dashboardItem.socket')[_0xff70('0xe')](socket);function respondWithRpcPromise(_0x2709da,_0x268498,_0x226be5){return new BPromise(function(_0x558e04,_0x1df9d2){return client[_0xff70('0xf')](_0x2709da,_0x226be5)[_0xff70('0x10')](function(_0x2d1ac4){logger[_0xff70('0x11')](_0xff70('0x12'),_0x268498,_0xff70('0x13'));logger[_0xff70('0x14')](_0xff70('0x15'),_0x268498,_0xff70('0x13'),JSON[_0xff70('0x16')](_0x2d1ac4));if(_0x2d1ac4[_0xff70('0x17')]){if(_0x2d1ac4[_0xff70('0x17')][_0xff70('0x18')]===0x1f4){logger[_0xff70('0x17')](_0xff70('0x12'),_0x268498,_0x2d1ac4[_0xff70('0x17')][_0xff70('0x19')]);return _0x1df9d2(_0x2d1ac4[_0xff70('0x17')][_0xff70('0x19')]);}logger[_0xff70('0x17')](_0xff70('0x12'),_0x268498,_0x2d1ac4[_0xff70('0x17')]['message']);return _0x558e04(_0x2d1ac4['error']['message']);}else{logger[_0xff70('0x11')](_0xff70('0x12'),_0x268498,_0xff70('0x13'));_0x558e04(_0x2d1ac4['result']['message']);}})[_0xff70('0x1a')](function(_0xb814bd){logger[_0xff70('0x17')](_0xff70('0x12'),_0x268498,_0xb814bd);_0x1df9d2(_0xb814bd);});});} \ No newline at end of file +var _0xefc4=['randomstring','ioredis','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment'];(function(_0x45e441,_0x44c801){var _0x403718=function(_0x267635){while(--_0x267635){_0x45e441['push'](_0x45e441['shift']());}};_0x403718(++_0x44c801);}(_0xefc4,0x135));var _0x4efc=function(_0x54a761,_0x431fd4){_0x54a761=_0x54a761-0x0;var _0x37d1da=_0xefc4[_0x54a761];return _0x37d1da;};'use strict';var _=require(_0x4efc('0x0'));var util=require(_0x4efc('0x1'));var moment=require(_0x4efc('0x2'));var BPromise=require('bluebird');var rs=require(_0x4efc('0x3'));var fs=require('fs');var Redis=require(_0x4efc('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4efc('0x5'))(_0x4efc('0x6'));var config=require(_0x4efc('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4efc('0x8')]({'port':0x232a});config[_0x4efc('0x9')]=_[_0x4efc('0xa')](config[_0x4efc('0x9')],{'host':_0x4efc('0xb'),'port':0x18eb});var socket=require(_0x4efc('0xc'))(new Redis(config[_0x4efc('0x9')]));require(_0x4efc('0xd'))[_0x4efc('0xe')](socket);function respondWithRpcPromise(_0x5466d6,_0x1cd9bf,_0x2d9d55){return new BPromise(function(_0xb79e2f,_0x40cd1f){return client['request'](_0x5466d6,_0x2d9d55)[_0x4efc('0xf')](function(_0x515802){logger[_0x4efc('0x10')](_0x4efc('0x11'),_0x1cd9bf,_0x4efc('0x12'));logger[_0x4efc('0x13')](_0x4efc('0x14'),_0x1cd9bf,'request\x20sent',JSON[_0x4efc('0x15')](_0x515802));if(_0x515802['error']){if(_0x515802[_0x4efc('0x16')][_0x4efc('0x17')]===0x1f4){logger[_0x4efc('0x16')]('DashboardItem,\x20%s,\x20%s',_0x1cd9bf,_0x515802[_0x4efc('0x16')][_0x4efc('0x18')]);return _0x40cd1f(_0x515802['error'][_0x4efc('0x18')]);}logger['error']('DashboardItem,\x20%s,\x20%s',_0x1cd9bf,_0x515802[_0x4efc('0x16')][_0x4efc('0x18')]);return _0xb79e2f(_0x515802[_0x4efc('0x16')][_0x4efc('0x18')]);}else{logger[_0x4efc('0x10')](_0x4efc('0x11'),_0x1cd9bf,_0x4efc('0x12'));_0xb79e2f(_0x515802[_0x4efc('0x19')][_0x4efc('0x18')]);}})['catch'](function(_0x2f0a60){logger[_0x4efc('0x16')](_0x4efc('0x11'),_0x1cd9bf,_0x2f0a60);_0x40cd1f(_0x2f0a60);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 31cfd4e..e4da405 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 _0xf59c=['emit','removeListener','register','length','dashboardItem:','./dashboardItem.events','save','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf59c,0x14d));var _0xcf59=function(_0x27bfd8,_0x47df12){_0x27bfd8=_0x27bfd8-0x0;var _0x39af6c=_0xf59c[_0x27bfd8];return _0x39af6c;};'use strict';var DashboardItemEvents=require(_0xcf59('0x0'));var events=[_0xcf59('0x1'),'remove',_0xcf59('0x2')];function createListener(_0x52353b,_0x101203){return function(_0x3926e6){_0x101203[_0xcf59('0x3')](_0x52353b,_0x3926e6);};}function removeListener(_0x1d26cd,_0x1b3dbd){return function(){DashboardItemEvents[_0xcf59('0x4')](_0x1d26cd,_0x1b3dbd);};}exports[_0xcf59('0x5')]=function(_0x46e68c){for(var _0xbe1e61=0x0,_0x496c4c=events[_0xcf59('0x6')];_0xbe1e61<_0x496c4c;_0xbe1e61++){var _0x42bc9b=events[_0xbe1e61];var _0x228578=createListener(_0xcf59('0x7')+_0x42bc9b,_0x46e68c);DashboardItemEvents['on'](_0x42bc9b,_0x228578);}}; \ No newline at end of file +var _0x4d96=['emit','removeListener','length','dashboardItem:','save','remove','update'];(function(_0x16390d,_0x1f5784){var _0x61e3ab=function(_0x37878e){while(--_0x37878e){_0x16390d['push'](_0x16390d['shift']());}};_0x61e3ab(++_0x1f5784);}(_0x4d96,0x177));var _0x64d9=function(_0x44f2e4,_0xfca3ad){_0x44f2e4=_0x44f2e4-0x0;var _0x45f236=_0x4d96[_0x44f2e4];return _0x45f236;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x64d9('0x0'),_0x64d9('0x1'),_0x64d9('0x2')];function createListener(_0x484544,_0x1a43f9){return function(_0xc3941f){_0x1a43f9[_0x64d9('0x3')](_0x484544,_0xc3941f);};}function removeListener(_0x13daf0,_0x2918f7){return function(){DashboardItemEvents[_0x64d9('0x4')](_0x13daf0,_0x2918f7);};}exports['register']=function(_0x298cfb){for(var _0x42eb8d=0x0,_0x4d3851=events[_0x64d9('0x5')];_0x42eb8d<_0x4d3851;_0x42eb8d++){var _0x175284=events[_0x42eb8d];var _0x358939=createListener(_0x64d9('0x6')+_0x175284,_0x298cfb);DashboardItemEvents['on'](_0x175284,_0x358939);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index a436783..ff3b584 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 _0xcd17=['fs-extra','../../components/auth/service','./dashboardItem.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','multer','util','connect-timeout','express','Router'];(function(_0x5f2afa,_0x3d2cd2){var _0xc21b56=function(_0x14825b){while(--_0x14825b){_0x5f2afa['push'](_0x5f2afa['shift']());}};_0xc21b56(++_0x3d2cd2);}(_0xcd17,0x11c));var _0x7cd1=function(_0x3cb8f9,_0x2ed215){_0x3cb8f9=_0x3cb8f9-0x0;var _0x394fae=_0xcd17[_0x3cb8f9];return _0x394fae;};'use strict';var multer=require(_0x7cd1('0x0'));var util=require(_0x7cd1('0x1'));var path=require('path');var timeout=require(_0x7cd1('0x2'));var express=require(_0x7cd1('0x3'));var router=express[_0x7cd1('0x4')]();var fs_extra=require(_0x7cd1('0x5'));var auth=require(_0x7cd1('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7cd1('0x7'));router[_0x7cd1('0x8')](_0x7cd1('0x9'),auth[_0x7cd1('0xa')](),controller[_0x7cd1('0xb')]);router[_0x7cd1('0xc')]('/',auth['isAuthenticated'](),controller[_0x7cd1('0xd')]);router[_0x7cd1('0xe')](_0x7cd1('0x9'),auth[_0x7cd1('0xa')](),controller[_0x7cd1('0xf')]);router[_0x7cd1('0x10')]('/:id',auth[_0x7cd1('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xdedb=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./dashboardItem.controller','get','show','post','isAuthenticated','create','put','/:id','update','delete','destroy'];(function(_0x21e855,_0x4e36fe){var _0x3fb9a8=function(_0x2bd840){while(--_0x2bd840){_0x21e855['push'](_0x21e855['shift']());}};_0x3fb9a8(++_0x4e36fe);}(_0xdedb,0x19e));var _0xbded=function(_0x524f9a,_0x2f32b4){_0x524f9a=_0x524f9a-0x0;var _0x167a92=_0xdedb[_0x524f9a];return _0x167a92;};'use strict';var multer=require(_0xbded('0x0'));var util=require(_0xbded('0x1'));var path=require('path');var timeout=require(_0xbded('0x2'));var express=require(_0xbded('0x3'));var router=express[_0xbded('0x4')]();var fs_extra=require(_0xbded('0x5'));var auth=require(_0xbded('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbded('0x7'));router[_0xbded('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xbded('0x9')]);router[_0xbded('0xa')]('/',auth[_0xbded('0xb')](),controller[_0xbded('0xc')]);router[_0xbded('0xd')](_0xbded('0xe'),auth[_0xbded('0xb')](),controller[_0xbded('0xf')]);router[_0xbded('0x10')]('/:id',auth[_0xbded('0xb')](),controller[_0xbded('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index c42ceb3..ee50b6c 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 _0x0458=['ENUM','third','first','sequelize','exports','STRING'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x0458,0x81));var _0x8045=function(_0x361cd7,_0x2e0843){_0x361cd7=_0x361cd7-0x0;var _0x33b3c0=_0x0458[_0x361cd7];return _0x33b3c0;};'use strict';var Sequelize=require(_0x8045('0x0'));module[_0x8045('0x1')]={'name':{'type':Sequelize[_0x8045('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x8045('0x3')]('first','second',_0x8045('0x4')),'allowNull':![],'defaultValue':_0x8045('0x5')},'description':{'type':Sequelize[_0x8045('0x2')]}}; \ No newline at end of file +var _0x9516=['STRING','ENUM','first','third','sequelize'];(function(_0x9917f4,_0x3bd1b6){var _0x43ba40=function(_0x4205bf){while(--_0x4205bf){_0x9917f4['push'](_0x9917f4['shift']());}};_0x43ba40(++_0x3bd1b6);}(_0x9516,0xb8));var _0x6951=function(_0x5ad771,_0x34186f){_0x5ad771=_0x5ad771-0x0;var _0x5b5dce=_0x9516[_0x5ad771];return _0x5b5dce;};'use strict';var Sequelize=require(_0x6951('0x0'));module['exports']={'name':{'type':Sequelize[_0x6951('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x6951('0x2')](_0x6951('0x3'),'second',_0x6951('0x4')),'allowNull':![],'defaultValue':_0x6951('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 5814a99..e83fc46 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 _0x79a3=['save','update','then','destroy','get','Dispositions','UserProfileResource','error','stack','name','send','index','map','Disposition','rawAttributes','type','key','model','query','attributes','intersection','fields','length','order','sort','where','filters','pick','filter','merge','options','includeAll','findAll','rows','catch','params','keys','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply'];(function(_0x2b30b5,_0x35c104){var _0x38f2ff=function(_0x410a3f){while(--_0x410a3f){_0x2b30b5['push'](_0x2b30b5['shift']());}};_0x38f2ff(++_0x35c104);}(_0x79a3,0x113));var _0x379a=function(_0x1d29ec,_0x3e7fed){_0x1d29ec=_0x1d29ec-0x0;var _0x2a2bf7=_0x79a3[_0x1d29ec];return _0x2a2bf7;};'use strict';var emlformat=require(_0x379a('0x0'));var rimraf=require(_0x379a('0x1'));var zipdir=require(_0x379a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x379a('0x3'));var moment=require('moment');var BPromise=require(_0x379a('0x4'));var Mustache=require(_0x379a('0x5'));var util=require(_0x379a('0x6'));var path=require(_0x379a('0x7'));var sox=require('sox');var csv=require(_0x379a('0x8'));var ejs=require(_0x379a('0x9'));var fs=require('fs');var fs_extra=require(_0x379a('0xa'));var _=require('lodash');var squel=require(_0x379a('0xb'));var crypto=require('crypto');var jsforce=require(_0x379a('0xc'));var deskjs=require(_0x379a('0xd'));var toCsv=require('to-csv');var querystring=require(_0x379a('0xe'));var Papa=require(_0x379a('0xf'));var Redis=require('ioredis');var authService=require(_0x379a('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x379a('0x11'));var logger=require(_0x379a('0x12'))(_0x379a('0x13'));var utils=require(_0x379a('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x379a('0x15'))['db'];function respondWithStatusCode(_0x3002fc,_0x1b3909){_0x1b3909=_0x1b3909||0xcc;return function(_0x1878e1){if(_0x1878e1){return _0x3002fc[_0x379a('0x16')](_0x1b3909);}return _0x3002fc[_0x379a('0x17')](_0x1b3909)[_0x379a('0x18')]();};}function respondWithResult(_0xef7a62,_0x35729c){_0x35729c=_0x35729c||0xc8;return function(_0x1bfbf7){if(_0x1bfbf7){return _0xef7a62[_0x379a('0x17')](_0x35729c)[_0x379a('0x19')](_0x1bfbf7);}};}function respondWithFilteredResult(_0x1c8a32,_0x2fc22d){return function(_0x185bd7){if(_0x185bd7){var _0xa93ee3=typeof _0x2fc22d['offset']===_0x379a('0x1a')&&typeof _0x2fc22d[_0x379a('0x1b')]==='undefined';var _0x21e252=_0x185bd7[_0x379a('0x1c')];var _0x319be1=_0xa93ee3?0x0:_0x2fc22d[_0x379a('0x1d')];var _0x1acc2c=_0xa93ee3?_0x185bd7[_0x379a('0x1c')]:_0x2fc22d[_0x379a('0x1d')]+_0x2fc22d[_0x379a('0x1b')];var _0x126467;if(_0x1acc2c>=_0x21e252){_0x1acc2c=_0x21e252;_0x126467=0xc8;}else{_0x126467=0xce;}_0x1c8a32[_0x379a('0x17')](_0x126467);return _0x1c8a32[_0x379a('0x1e')](_0x379a('0x1f'),_0x319be1+'-'+_0x1acc2c+'/'+_0x21e252)['json'](_0x185bd7);}return null;};}function patchUpdates(_0xc9380c){return function(_0x3db1bd){try{jsonpatch[_0x379a('0x20')](_0x3db1bd,_0xc9380c,!![]);}catch(_0x28aa55){return BPromise['reject'](_0x28aa55);}return _0x3db1bd[_0x379a('0x21')]();};}function saveUpdates(_0x45355f,_0x552b7d){return function(_0x340c3e){if(_0x340c3e){return _0x340c3e[_0x379a('0x22')](_0x45355f)[_0x379a('0x23')](function(_0x3198ed){return _0x3198ed;});}return null;};}function removeEntity(_0x2d453c,_0x3d1af0){return function(_0x2a2e96){if(_0x2a2e96){return _0x2a2e96[_0x379a('0x24')]()[_0x379a('0x23')](function(){var _0x42dc59=_0x2a2e96[_0x379a('0x25')]({'plain':!![]});var _0x3b0669=_0x379a('0x26');return db[_0x379a('0x27')][_0x379a('0x24')]({'where':{'type':_0x3b0669,'resourceId':_0x42dc59['id']}})[_0x379a('0x23')](function(){return _0x2a2e96;});})[_0x379a('0x23')](function(){_0x2d453c['status'](0xcc)[_0x379a('0x18')]();});}};}function handleEntityNotFound(_0x133c11,_0x4f4cde){return function(_0x27c1e3){if(!_0x27c1e3){_0x133c11['sendStatus'](0x194);}return _0x27c1e3;};}function handleError(_0x2c7bbc,_0x42d040){_0x42d040=_0x42d040||0x1f4;return function(_0x3cddb7){logger[_0x379a('0x28')](_0x3cddb7[_0x379a('0x29')]);if(_0x3cddb7['name']){delete _0x3cddb7[_0x379a('0x2a')];}_0x2c7bbc[_0x379a('0x17')](_0x42d040)[_0x379a('0x2b')](_0x3cddb7);};}exports[_0x379a('0x2c')]=function(_0x770516,_0x553528){var _0x2ab3ca={},_0x15b233={},_0x24dae6={'count':0x0,'rows':[]};var _0x36ce58=_[_0x379a('0x2d')](db[_0x379a('0x2e')][_0x379a('0x2f')],function(_0x1897f0){return{'name':_0x1897f0['fieldName'],'type':_0x1897f0[_0x379a('0x30')][_0x379a('0x31')]};});_0x15b233[_0x379a('0x32')]=_['map'](_0x36ce58,'name');_0x15b233[_0x379a('0x33')]=_['keys'](_0x770516['query']);_0x15b233['filters']=_['intersection'](_0x15b233['model'],_0x15b233['query']);_0x2ab3ca[_0x379a('0x34')]=_[_0x379a('0x35')](_0x15b233[_0x379a('0x32')],qs[_0x379a('0x36')](_0x770516[_0x379a('0x33')][_0x379a('0x36')]));_0x2ab3ca[_0x379a('0x34')]=_0x2ab3ca[_0x379a('0x34')][_0x379a('0x37')]?_0x2ab3ca['attributes']:_0x15b233[_0x379a('0x32')];if(!_0x770516['query']['hasOwnProperty']('nolimit')){_0x2ab3ca['limit']=qs[_0x379a('0x1b')](_0x770516[_0x379a('0x33')][_0x379a('0x1b')]);_0x2ab3ca['offset']=qs['offset'](_0x770516['query']['offset']);}_0x2ab3ca[_0x379a('0x38')]=qs[_0x379a('0x39')](_0x770516[_0x379a('0x33')][_0x379a('0x39')]);_0x2ab3ca[_0x379a('0x3a')]=qs[_0x379a('0x3b')](_[_0x379a('0x3c')](_0x770516[_0x379a('0x33')],_0x15b233[_0x379a('0x3b')]),_0x36ce58);if(_0x770516['query'][_0x379a('0x3d')]){_0x2ab3ca[_0x379a('0x3a')]=_[_0x379a('0x3e')](_0x2ab3ca['where'],{'$or':_[_0x379a('0x2d')](_0x36ce58,function(_0x2af949){if(_0x2af949[_0x379a('0x30')]!=='VIRTUAL'){var _0x18c9ea={};_0x18c9ea[_0x2af949['name']]={'$like':'%'+_0x770516[_0x379a('0x33')][_0x379a('0x3d')]+'%'};return _0x18c9ea;}})});}_0x2ab3ca=_[_0x379a('0x3e')]({},_0x2ab3ca,_0x770516[_0x379a('0x3f')]);var _0x4d9bfd={'where':_0x2ab3ca[_0x379a('0x3a')]};return db['Disposition']['count'](_0x4d9bfd)[_0x379a('0x23')](function(_0x143787){_0x24dae6[_0x379a('0x1c')]=_0x143787;if(_0x770516[_0x379a('0x33')][_0x379a('0x40')]){_0x2ab3ca['include']=[{'all':!![]}];}return db[_0x379a('0x2e')][_0x379a('0x41')](_0x2ab3ca);})[_0x379a('0x23')](function(_0x46b93a){_0x24dae6[_0x379a('0x42')]=_0x46b93a;return _0x24dae6;})[_0x379a('0x23')](respondWithFilteredResult(_0x553528,_0x2ab3ca))[_0x379a('0x43')](handleError(_0x553528,null));};exports['show']=function(_0x4d3d34,_0x193b5f){var _0x1846bc={'raw':!![],'where':{'id':_0x4d3d34[_0x379a('0x44')]['id']}},_0x4af80e={};_0x4af80e[_0x379a('0x32')]=_[_0x379a('0x45')](db[_0x379a('0x2e')]['rawAttributes']);_0x4af80e[_0x379a('0x33')]=_[_0x379a('0x45')](_0x4d3d34[_0x379a('0x33')]);_0x4af80e[_0x379a('0x3b')]=_['intersection'](_0x4af80e[_0x379a('0x32')],_0x4af80e[_0x379a('0x33')]);_0x1846bc[_0x379a('0x34')]=_[_0x379a('0x35')](_0x4af80e['model'],qs['fields'](_0x4d3d34[_0x379a('0x33')][_0x379a('0x36')]));_0x1846bc[_0x379a('0x34')]=_0x1846bc[_0x379a('0x34')]['length']?_0x1846bc[_0x379a('0x34')]:_0x4af80e[_0x379a('0x32')];if(_0x4d3d34['query'][_0x379a('0x40')]){_0x1846bc['include']=[{'all':!![]}];}_0x1846bc=_[_0x379a('0x3e')]({},_0x1846bc,_0x4d3d34['options']);return db[_0x379a('0x2e')][_0x379a('0x46')](_0x1846bc)[_0x379a('0x23')](handleEntityNotFound(_0x193b5f,null))['then'](respondWithResult(_0x193b5f,null))[_0x379a('0x43')](handleError(_0x193b5f,null));};exports[_0x379a('0x47')]=function(_0x3a9e78,_0x5f0ec2){return db[_0x379a('0x2e')][_0x379a('0x47')](_0x3a9e78['body'],{})[_0x379a('0x23')](function(_0x232de2){var _0x1e72f0=_0x3a9e78['user'][_0x379a('0x25')]({'plain':!![]});if(!_0x1e72f0)throw new Error(_0x379a('0x48'));if(_0x1e72f0['role']===_0x379a('0x49')){var _0x668c8d=_0x232de2['get']({'plain':!![]});var _0x532760=_0x379a('0x26');return db['UserProfileSection'][_0x379a('0x46')]({'where':{'name':_0x532760,'userProfileId':_0x1e72f0['userProfileId']},'raw':!![]})[_0x379a('0x23')](function(_0x5600b0){if(_0x5600b0&&_0x5600b0[_0x379a('0x4a')]===0x0){return db[_0x379a('0x27')]['create']({'name':_0x668c8d[_0x379a('0x2a')],'resourceId':_0x668c8d['id'],'type':_0x5600b0['name'],'sectionId':_0x5600b0['id']},{})[_0x379a('0x23')](function(){return _0x232de2;});}else{return _0x232de2;}})[_0x379a('0x43')](function(_0x31b9c1){logger[_0x379a('0x28')](_0x379a('0x4b'),_0x31b9c1);throw _0x31b9c1;});}return _0x232de2;})[_0x379a('0x23')](respondWithResult(_0x5f0ec2,0xc9))[_0x379a('0x43')](handleError(_0x5f0ec2,null));};exports[_0x379a('0x22')]=function(_0x4c5b48,_0x52a41b){if(_0x4c5b48[_0x379a('0x4c')]['id']){delete _0x4c5b48['body']['id'];}return db[_0x379a('0x2e')][_0x379a('0x46')]({'where':{'id':_0x4c5b48[_0x379a('0x44')]['id']}})[_0x379a('0x23')](handleEntityNotFound(_0x52a41b,null))[_0x379a('0x23')](saveUpdates(_0x4c5b48[_0x379a('0x4c')],null))[_0x379a('0x23')](respondWithResult(_0x52a41b,null))[_0x379a('0x43')](handleError(_0x52a41b,null));};exports['destroy']=function(_0x34e664,_0x3914b9){return db[_0x379a('0x2e')][_0x379a('0x46')]({'where':{'id':_0x34e664['params']['id']}})[_0x379a('0x23')](handleEntityNotFound(_0x3914b9,null))[_0x379a('0x23')](removeEntity(_0x3914b9,null))[_0x379a('0x43')](handleError(_0x3914b9,null));}; \ No newline at end of file +var _0xfd6e=['set','Content-Range','apply','reject','save','update','then','get','Dispositions','UserProfileResource','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','Disposition','includeAll','findAll','catch','show','params','include','find','create','user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','request-promise','moment','path','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count'];(function(_0x311fa2,_0x5944e0){var _0x3580a2=function(_0x1af7de){while(--_0x1af7de){_0x311fa2['push'](_0x311fa2['shift']());}};_0x3580a2(++_0x5944e0);}(_0xfd6e,0x16e));var _0xefd6=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xfd6e[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0xefd6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xefd6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xefd6('0x2'));var moment=require(_0xefd6('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xefd6('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xefd6('0x5'));var fs=require('fs');var fs_extra=require(_0xefd6('0x6'));var _=require(_0xefd6('0x7'));var squel=require(_0xefd6('0x8'));var crypto=require(_0xefd6('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xefd6('0xa'));var querystring=require(_0xefd6('0xb'));var Papa=require(_0xefd6('0xc'));var Redis=require('ioredis');var authService=require(_0xefd6('0xd'));var qs=require(_0xefd6('0xe'));var as=require(_0xefd6('0xf'));var hardwareService=require(_0xefd6('0x10'));var logger=require('../../config/logger')(_0xefd6('0x11'));var utils=require(_0xefd6('0x12'));var config=require(_0xefd6('0x13'));var licenseUtil=require(_0xefd6('0x14'));var db=require(_0xefd6('0x15'))['db'];function respondWithStatusCode(_0x34ad42,_0x3a8259){_0x3a8259=_0x3a8259||0xcc;return function(_0x1069f3){if(_0x1069f3){return _0x34ad42['sendStatus'](_0x3a8259);}return _0x34ad42[_0xefd6('0x16')](_0x3a8259)[_0xefd6('0x17')]();};}function respondWithResult(_0x45ac7f,_0x1ade7c){_0x1ade7c=_0x1ade7c||0xc8;return function(_0x1a8cc9){if(_0x1a8cc9){return _0x45ac7f['status'](_0x1ade7c)[_0xefd6('0x18')](_0x1a8cc9);}};}function respondWithFilteredResult(_0x4be0f8,_0x23d864){return function(_0x4d72ca){if(_0x4d72ca){var _0x25a39d=typeof _0x23d864[_0xefd6('0x19')]==='undefined'&&typeof _0x23d864[_0xefd6('0x1a')]===_0xefd6('0x1b');var _0x41e998=_0x4d72ca[_0xefd6('0x1c')];var _0xd59458=_0x25a39d?0x0:_0x23d864[_0xefd6('0x19')];var _0x469c17=_0x25a39d?_0x4d72ca[_0xefd6('0x1c')]:_0x23d864[_0xefd6('0x19')]+_0x23d864[_0xefd6('0x1a')];var _0x1aa125;if(_0x469c17>=_0x41e998){_0x469c17=_0x41e998;_0x1aa125=0xc8;}else{_0x1aa125=0xce;}_0x4be0f8['status'](_0x1aa125);return _0x4be0f8[_0xefd6('0x1d')](_0xefd6('0x1e'),_0xd59458+'-'+_0x469c17+'/'+_0x41e998)[_0xefd6('0x18')](_0x4d72ca);}return null;};}function patchUpdates(_0x3a26c5){return function(_0x122009){try{jsonpatch[_0xefd6('0x1f')](_0x122009,_0x3a26c5,!![]);}catch(_0x499c9b){return BPromise[_0xefd6('0x20')](_0x499c9b);}return _0x122009[_0xefd6('0x21')]();};}function saveUpdates(_0x586388,_0x2b0442){return function(_0x36d030){if(_0x36d030){return _0x36d030[_0xefd6('0x22')](_0x586388)['then'](function(_0x587643){return _0x587643;});}return null;};}function removeEntity(_0x1a0a7f,_0x1b1d41){return function(_0xe763eb){if(_0xe763eb){return _0xe763eb['destroy']()[_0xefd6('0x23')](function(){var _0x351a6d=_0xe763eb[_0xefd6('0x24')]({'plain':!![]});var _0x5347fd=_0xefd6('0x25');return db[_0xefd6('0x26')]['destroy']({'where':{'type':_0x5347fd,'resourceId':_0x351a6d['id']}})[_0xefd6('0x23')](function(){return _0xe763eb;});})[_0xefd6('0x23')](function(){_0x1a0a7f[_0xefd6('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44b937,_0x1a2242){return function(_0x174fbf){if(!_0x174fbf){_0x44b937[_0xefd6('0x27')](0x194);}return _0x174fbf;};}function handleError(_0x281a84,_0x160139){_0x160139=_0x160139||0x1f4;return function(_0x320e4f){logger[_0xefd6('0x28')](_0x320e4f['stack']);if(_0x320e4f[_0xefd6('0x29')]){delete _0x320e4f[_0xefd6('0x29')];}_0x281a84[_0xefd6('0x16')](_0x160139)[_0xefd6('0x2a')](_0x320e4f);};}exports[_0xefd6('0x2b')]=function(_0x5aed31,_0x98f69b){var _0x2feac2={},_0x171fe7={},_0x15c67e={'count':0x0,'rows':[]};var _0x3225e7=_[_0xefd6('0x2c')](db['Disposition'][_0xefd6('0x2d')],function(_0x2f013d){return{'name':_0x2f013d[_0xefd6('0x2e')],'type':_0x2f013d[_0xefd6('0x2f')][_0xefd6('0x30')]};});_0x171fe7[_0xefd6('0x31')]=_[_0xefd6('0x2c')](_0x3225e7,'name');_0x171fe7[_0xefd6('0x32')]=_[_0xefd6('0x33')](_0x5aed31[_0xefd6('0x32')]);_0x171fe7[_0xefd6('0x34')]=_['intersection'](_0x171fe7[_0xefd6('0x31')],_0x171fe7[_0xefd6('0x32')]);_0x2feac2['attributes']=_[_0xefd6('0x35')](_0x171fe7[_0xefd6('0x31')],qs[_0xefd6('0x36')](_0x5aed31[_0xefd6('0x32')][_0xefd6('0x36')]));_0x2feac2[_0xefd6('0x37')]=_0x2feac2[_0xefd6('0x37')][_0xefd6('0x38')]?_0x2feac2[_0xefd6('0x37')]:_0x171fe7['model'];if(!_0x5aed31[_0xefd6('0x32')][_0xefd6('0x39')](_0xefd6('0x3a'))){_0x2feac2[_0xefd6('0x1a')]=qs[_0xefd6('0x1a')](_0x5aed31[_0xefd6('0x32')]['limit']);_0x2feac2[_0xefd6('0x19')]=qs[_0xefd6('0x19')](_0x5aed31[_0xefd6('0x32')][_0xefd6('0x19')]);}_0x2feac2['order']=qs[_0xefd6('0x3b')](_0x5aed31[_0xefd6('0x32')]['sort']);_0x2feac2[_0xefd6('0x3c')]=qs[_0xefd6('0x34')](_['pick'](_0x5aed31[_0xefd6('0x32')],_0x171fe7[_0xefd6('0x34')]),_0x3225e7);if(_0x5aed31[_0xefd6('0x32')][_0xefd6('0x3d')]){_0x2feac2[_0xefd6('0x3c')]=_[_0xefd6('0x3e')](_0x2feac2['where'],{'$or':_[_0xefd6('0x2c')](_0x3225e7,function(_0x113fc7){if(_0x113fc7['type']!==_0xefd6('0x3f')){var _0x3722ba={};_0x3722ba[_0x113fc7['name']]={'$like':'%'+_0x5aed31['query']['filter']+'%'};return _0x3722ba;}})});}_0x2feac2=_[_0xefd6('0x3e')]({},_0x2feac2,_0x5aed31[_0xefd6('0x40')]);var _0x2f312a={'where':_0x2feac2[_0xefd6('0x3c')]};return db[_0xefd6('0x41')][_0xefd6('0x1c')](_0x2f312a)[_0xefd6('0x23')](function(_0x544dc0){_0x15c67e[_0xefd6('0x1c')]=_0x544dc0;if(_0x5aed31[_0xefd6('0x32')][_0xefd6('0x42')]){_0x2feac2['include']=[{'all':!![]}];}return db[_0xefd6('0x41')][_0xefd6('0x43')](_0x2feac2);})[_0xefd6('0x23')](function(_0x4f2bfb){_0x15c67e['rows']=_0x4f2bfb;return _0x15c67e;})['then'](respondWithFilteredResult(_0x98f69b,_0x2feac2))[_0xefd6('0x44')](handleError(_0x98f69b,null));};exports[_0xefd6('0x45')]=function(_0x56d300,_0x1b87d5){var _0x95acd6={'raw':!![],'where':{'id':_0x56d300[_0xefd6('0x46')]['id']}},_0x324c59={};_0x324c59[_0xefd6('0x31')]=_['keys'](db[_0xefd6('0x41')][_0xefd6('0x2d')]);_0x324c59[_0xefd6('0x32')]=_[_0xefd6('0x33')](_0x56d300[_0xefd6('0x32')]);_0x324c59[_0xefd6('0x34')]=_[_0xefd6('0x35')](_0x324c59[_0xefd6('0x31')],_0x324c59[_0xefd6('0x32')]);_0x95acd6['attributes']=_[_0xefd6('0x35')](_0x324c59['model'],qs[_0xefd6('0x36')](_0x56d300[_0xefd6('0x32')][_0xefd6('0x36')]));_0x95acd6[_0xefd6('0x37')]=_0x95acd6[_0xefd6('0x37')][_0xefd6('0x38')]?_0x95acd6[_0xefd6('0x37')]:_0x324c59['model'];if(_0x56d300['query'][_0xefd6('0x42')]){_0x95acd6[_0xefd6('0x47')]=[{'all':!![]}];}_0x95acd6=_[_0xefd6('0x3e')]({},_0x95acd6,_0x56d300[_0xefd6('0x40')]);return db[_0xefd6('0x41')][_0xefd6('0x48')](_0x95acd6)[_0xefd6('0x23')](handleEntityNotFound(_0x1b87d5,null))[_0xefd6('0x23')](respondWithResult(_0x1b87d5,null))[_0xefd6('0x44')](handleError(_0x1b87d5,null));};exports[_0xefd6('0x49')]=function(_0x48af3d,_0x34e45d){return db[_0xefd6('0x41')]['create'](_0x48af3d['body'],{})[_0xefd6('0x23')](function(_0x48f79a){var _0x5735b9=_0x48af3d[_0xefd6('0x4a')]['get']({'plain':!![]});if(!_0x5735b9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5735b9[_0xefd6('0x4b')]===_0xefd6('0x4a')){var _0xca5f8a=_0x48f79a[_0xefd6('0x24')]({'plain':!![]});var _0x16448e=_0xefd6('0x25');return db['UserProfileSection'][_0xefd6('0x48')]({'where':{'name':_0x16448e,'userProfileId':_0x5735b9['userProfileId']},'raw':!![]})[_0xefd6('0x23')](function(_0x315b11){if(_0x315b11&&_0x315b11[_0xefd6('0x4c')]===0x0){return db[_0xefd6('0x26')][_0xefd6('0x49')]({'name':_0xca5f8a[_0xefd6('0x29')],'resourceId':_0xca5f8a['id'],'type':_0x315b11[_0xefd6('0x29')],'sectionId':_0x315b11['id']},{})[_0xefd6('0x23')](function(){return _0x48f79a;});}else{return _0x48f79a;}})[_0xefd6('0x44')](function(_0x4e73af){logger[_0xefd6('0x28')](_0xefd6('0x4d'),_0x4e73af);throw _0x4e73af;});}return _0x48f79a;})[_0xefd6('0x23')](respondWithResult(_0x34e45d,0xc9))[_0xefd6('0x44')](handleError(_0x34e45d,null));};exports[_0xefd6('0x22')]=function(_0x2b984f,_0x55d0af){if(_0x2b984f[_0xefd6('0x4e')]['id']){delete _0x2b984f[_0xefd6('0x4e')]['id'];}return db[_0xefd6('0x41')][_0xefd6('0x48')]({'where':{'id':_0x2b984f[_0xefd6('0x46')]['id']}})[_0xefd6('0x23')](handleEntityNotFound(_0x55d0af,null))['then'](saveUpdates(_0x2b984f[_0xefd6('0x4e')],null))[_0xefd6('0x23')](respondWithResult(_0x55d0af,null))[_0xefd6('0x44')](handleError(_0x55d0af,null));};exports['destroy']=function(_0xf1feb9,_0x25fd93){return db[_0xefd6('0x41')][_0xefd6('0x48')]({'where':{'id':_0xf1feb9[_0xefd6('0x46')]['id']}})[_0xefd6('0x23')](handleEntityNotFound(_0x25fd93,null))['then'](removeEntity(_0x25fd93,null))[_0xefd6('0x44')](handleError(_0x25fd93,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 72d6a00..e4160eb 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 _0x5a66=['name_chat','ChatWebsiteId','name_mail','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','api','moment','bluebird','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name'];(function(_0x3c4005,_0x3e1b6e){var _0x561538=function(_0x375427){while(--_0x375427){_0x3c4005['push'](_0x3c4005['shift']());}};_0x561538(++_0x3e1b6e);}(_0x5a66,0x15b));var _0x65a6=function(_0x20234e,_0x384a42){_0x20234e=_0x20234e-0x0;var _0x4df7c4=_0x5a66[_0x20234e];return _0x4df7c4;};'use strict';var _=require(_0x65a6('0x0'));var util=require(_0x65a6('0x1'));var logger=require('../../config/logger')(_0x65a6('0x2'));var moment=require(_0x65a6('0x3'));var BPromise=require(_0x65a6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x65a6('0x5'));var config=require(_0x65a6('0x6'));var attributes=require(_0x65a6('0x7'));module[_0x65a6('0x8')]=function(_0x56e4ea,_0x2376eb){return _0x56e4ea[_0x65a6('0x9')](_0x65a6('0xa'),attributes,{'tableName':_0x65a6('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x65a6('0xc'),'ListId']},{'unique':!![],'name':_0x65a6('0xd'),'fields':[_0x65a6('0xc'),_0x65a6('0xe')]},{'unique':!![],'name':_0x65a6('0xf'),'fields':[_0x65a6('0xc'),'MailAccountId']},{'unique':!![],'name':_0x65a6('0x10'),'fields':[_0x65a6('0xc'),_0x65a6('0x11')]},{'unique':!![],'name':_0x65a6('0x12'),'fields':[_0x65a6('0xc'),_0x65a6('0x13')]},{'unique':!![],'name':_0x65a6('0x14'),'fields':[_0x65a6('0xc'),_0x65a6('0x15')]},{'unique':!![],'name':_0x65a6('0x16'),'fields':[_0x65a6('0xc'),_0x65a6('0x17')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x275c=['tools_dispositions','ListId','name','ChatWebsiteId','name_mail','MailAccountId','name_sms','name_fax','FaxAccountId','OpenchannelAccountId','name_whatsapp','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition'];(function(_0x39cb96,_0x5dbaa9){var _0x3170d5=function(_0x3993f3){while(--_0x3993f3){_0x39cb96['push'](_0x39cb96['shift']());}};_0x3170d5(++_0x5dbaa9);}(_0x275c,0x7e));var _0xc275=function(_0x25fab2,_0x157f73){_0x25fab2=_0x25fab2-0x0;var _0xaa7e23=_0x275c[_0x25fab2];return _0xaa7e23;};'use strict';var _=require(_0xc275('0x0'));var util=require(_0xc275('0x1'));var logger=require(_0xc275('0x2'))('api');var moment=require(_0xc275('0x3'));var BPromise=require(_0xc275('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc275('0x5'));var rimraf=require(_0xc275('0x6'));var config=require(_0xc275('0x7'));var attributes=require(_0xc275('0x8'));module[_0xc275('0x9')]=function(_0xb0b46e,_0x551c16){return _0xb0b46e[_0xc275('0xa')](_0xc275('0xb'),attributes,{'tableName':_0xc275('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':['name',_0xc275('0xd')]},{'unique':!![],'name':'name_chat','fields':[_0xc275('0xe'),_0xc275('0xf')]},{'unique':!![],'name':_0xc275('0x10'),'fields':['name',_0xc275('0x11')]},{'unique':!![],'name':_0xc275('0x12'),'fields':[_0xc275('0xe'),'SmsAccountId']},{'unique':!![],'name':_0xc275('0x13'),'fields':['name',_0xc275('0x14')]},{'unique':!![],'name':'name_openchannel','fields':['name',_0xc275('0x15')]},{'unique':!![],'name':_0xc275('0x16'),'fields':['name','WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 71c1352..0600057 100644 --- a/server/api/disposition/disposition.rpc.js +++ b/server/api/disposition/disposition.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4557f5,_0x5db62a){var _0x391a73=function(_0x1af7a1){while(--_0x1af7a1){_0x4557f5['push'](_0x4557f5['shift']());}};_0x391a73(++_0x5db62a);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x39d35d,_0x43d6d2){var _0x309acb=function(_0xea9e6){while(--_0xea9e6){_0x39d35d['push'](_0x39d35d['shift']());}};_0x309acb(++_0x43d6d2);}(_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 diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index ed81b72..91e68e8 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 _0xc324=['index','get','/:id','show','post','create','delete','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','./disposition.controller','isAuthenticated'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xc324,0x1c9));var _0x4c32=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc324[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x4c32('0x0'));var util=require(_0x4c32('0x1'));var path=require('path');var timeout=require(_0x4c32('0x2'));var express=require(_0x4c32('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4c32('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4c32('0x5'));var controller=require(_0x4c32('0x6'));router['get']('/',auth[_0x4c32('0x7')](),controller[_0x4c32('0x8')]);router[_0x4c32('0x9')](_0x4c32('0xa'),auth[_0x4c32('0x7')](),controller[_0x4c32('0xb')]);router[_0x4c32('0xc')]('/',auth['isAuthenticated'](),controller[_0x4c32('0xd')]);router['put']('/:id',auth[_0x4c32('0x7')](),controller['update']);router[_0x4c32('0xe')](_0x4c32('0xa'),auth[_0x4c32('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x083b=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./disposition.controller','isAuthenticated','index','get','/:id','show','post','create','put','delete','exports','multer','util','connect-timeout'];(function(_0x3c168f,_0x598c19){var _0x551ad8=function(_0x45ad1e){while(--_0x45ad1e){_0x3c168f['push'](_0x3c168f['shift']());}};_0x551ad8(++_0x598c19);}(_0x083b,0x95));var _0xb083=function(_0x113a6c,_0x10df30){_0x113a6c=_0x113a6c-0x0;var _0x1ac632=_0x083b[_0x113a6c];return _0x1ac632;};'use strict';var multer=require(_0xb083('0x0'));var util=require(_0xb083('0x1'));var path=require('path');var timeout=require(_0xb083('0x2'));var express=require(_0xb083('0x3'));var router=express[_0xb083('0x4')]();var fs_extra=require(_0xb083('0x5'));var auth=require(_0xb083('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb083('0x7'));var controller=require(_0xb083('0x8'));router['get']('/',auth[_0xb083('0x9')](),controller[_0xb083('0xa')]);router[_0xb083('0xb')](_0xb083('0xc'),auth['isAuthenticated'](),controller[_0xb083('0xd')]);router[_0xb083('0xe')]('/',auth[_0xb083('0x9')](),controller[_0xb083('0xf')]);router[_0xb083('0x10')](_0xb083('0xc'),auth[_0xb083('0x9')](),controller['update']);router[_0xb083('0x11')]('/:id',auth[_0xb083('0x9')](),controller['destroy']);module[_0xb083('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 8c2006f..acb1abd 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 _0x87fc=['IAX','DADHI','KHOMP','SIP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','12000','14400','v17,v27,v29'];(function(_0x34d346,_0x4c6502){var _0x122d76=function(_0x22a5fd){while(--_0x22a5fd){_0x34d346['push'](_0x34d346['shift']());}};_0x122d76(++_0x4c6502);}(_0x87fc,0x151));var _0xc87f=function(_0x1b0a06,_0x7677f4){_0x1b0a06=_0x1b0a06-0x0;var _0x13d55a=_0x87fc[_0x1b0a06];return _0x13d55a;};'use strict';var Sequelize=require('sequelize');module[_0xc87f('0x0')]={'name':{'type':Sequelize[_0xc87f('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xc87f('0x1')]},'ecm':{'type':Sequelize[_0xc87f('0x2')](_0xc87f('0x3'),'no'),'defaultValue':_0xc87f('0x3')},'headerinfo':{'type':Sequelize[_0xc87f('0x1')],'defaultValue':_0xc87f('0x4')},'localstationid':{'type':Sequelize[_0xc87f('0x1')],'unique':_0xc87f('0x5')},'minrate':{'type':Sequelize[_0xc87f('0x2')](_0xc87f('0x6'),_0xc87f('0x7'),_0xc87f('0x8'),_0xc87f('0x9'),_0xc87f('0xa'),_0xc87f('0xb')),'defaultValue':_0xc87f('0x7')},'maxrate':{'type':Sequelize[_0xc87f('0x2')](_0xc87f('0x6'),_0xc87f('0x7'),_0xc87f('0x8'),'9600',_0xc87f('0xa'),_0xc87f('0xb')),'defaultValue':'14400'},'modem':{'type':Sequelize['STRING'],'defaultValue':_0xc87f('0xc')},'gateway':{'type':Sequelize[_0xc87f('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xc87f('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xc87f('0x2')]('SIP',_0xc87f('0xd'),_0xc87f('0xe'),_0xc87f('0xf')),'defaultValue':_0xc87f('0x10')},'key':{'type':Sequelize[_0xc87f('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xc87f('0x11')],'defaultValue':function(){return _0xc87f('0x12');}},'notificationSound':{'type':Sequelize[_0xc87f('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc87f('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc87f('0x14')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc87f('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc87f('0x14')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc87f('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc87f('0x14')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc87f('0x14')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xc87f('0x15'),'set':function(_0xf9102e){if(!_0xf9102e)this[_0xc87f('0x16')](_0xc87f('0x17'),null);this[_0xc87f('0x16')](_0xc87f('0x18'),_0xf9102e);}}}; \ No newline at end of file +var _0xbd60=['mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','localstationid','4800','7200','9600','12000','14400','2400','v17,v27,v29','DADHI','KHOMP','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(_0x3bfdde,_0x306be4){var _0x3f752a=function(_0x3b6751){while(--_0x3b6751){_0x3bfdde['push'](_0x3bfdde['shift']());}};_0x3f752a(++_0x306be4);}(_0xbd60,0x162));var _0x0bd6=function(_0x30123b,_0x2b155d){_0x30123b=_0x30123b-0x0;var _0x24eb6f=_0xbd60[_0x30123b];return _0x24eb6f;};'use strict';var Sequelize=require(_0x0bd6('0x0'));module[_0x0bd6('0x1')]={'name':{'type':Sequelize[_0x0bd6('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0bd6('0x2')]},'ecm':{'type':Sequelize[_0x0bd6('0x3')](_0x0bd6('0x4'),'no'),'defaultValue':_0x0bd6('0x4')},'headerinfo':{'type':Sequelize[_0x0bd6('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x0bd6('0x2')],'unique':_0x0bd6('0x5')},'minrate':{'type':Sequelize[_0x0bd6('0x3')]('2400',_0x0bd6('0x6'),_0x0bd6('0x7'),_0x0bd6('0x8'),_0x0bd6('0x9'),_0x0bd6('0xa')),'defaultValue':_0x0bd6('0x6')},'maxrate':{'type':Sequelize[_0x0bd6('0x3')](_0x0bd6('0xb'),_0x0bd6('0x6'),'7200',_0x0bd6('0x8'),_0x0bd6('0x9'),_0x0bd6('0xa')),'defaultValue':_0x0bd6('0xa')},'modem':{'type':Sequelize[_0x0bd6('0x2')],'defaultValue':_0x0bd6('0xc')},'gateway':{'type':Sequelize[_0x0bd6('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM']('SIP','IAX',_0x0bd6('0xd'),_0x0bd6('0xe')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x0bd6('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x0bd6('0xf')],'defaultValue':function(){return _0x0bd6('0x10');}},'notificationSound':{'type':Sequelize[_0x0bd6('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0bd6('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0bd6('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0bd6('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0bd6('0x12')],'allowNull':!![],'defaultValue':null,'comment':_0x0bd6('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x0bd6('0x11')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1cd639){if(!_0x1cd639)this['setDataValue'](_0x0bd6('0x14'),null);this['setDataValue'](_0x0bd6('0x15'),_0x1cd639);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 238aabc..a2ac0d3 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 _0x01b5=['userFaxAccount:remove','emit','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','./faxAccount.socket','register','http','client','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','FaxAccount,\x20%s,\x20%s','message','result','status','offset','limit','undefined','count','set','json','apply','reject','save','update','destroy','get','FaxAccounts','UserProfileResource','end','sendStatus','stack','name','send','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','FaxAccountId','Disposition','order','pick','includeAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','rows','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','CmContact','Contact','User','Owner','fullname','Tags','color','tag','addApplications','sequelize','bulkCreate','FaxApplication','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','localstationid','app','system','Fax\x20Extension','push','Answer','Set','gateway','faxdetect','headerinfo','modem','t38timeout','FAXOPT(','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','transaction','updateAccountApplications','VoiceExtension','tech','createdAt','TrunkId','ListId','findById','FaxMessage','nolimit','$gte','List','updatedAt','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','format','\x22%s\x22\x20<%s>','Contacts','List\x20not\x20found','Send\x20Fax\x20failed','out','Messages','Contact\x20not\x20found','spread','filename','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','removeAgents','isArray'];(function(_0x50ba2b,_0x564442){var _0x2558d9=function(_0x4f54db){while(--_0x4f54db){_0x50ba2b['push'](_0x50ba2b['shift']());}};_0x2558d9(++_0x564442);}(_0x01b5,0x17b));var _0x501b=function(_0x2572fb,_0x2cde32){_0x2572fb=_0x2572fb-0x0;var _0x2e7c75=_0x01b5[_0x2572fb];return _0x2e7c75;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x501b('0x0'));var zipdir=require(_0x501b('0x1'));var jsonpatch=require(_0x501b('0x2'));var rp=require(_0x501b('0x3'));var moment=require(_0x501b('0x4'));var BPromise=require(_0x501b('0x5'));var Mustache=require(_0x501b('0x6'));var util=require(_0x501b('0x7'));var path=require(_0x501b('0x8'));var sox=require(_0x501b('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x501b('0xa'));var squel=require('squel');var crypto=require(_0x501b('0xb'));var jsforce=require(_0x501b('0xc'));var deskjs=require(_0x501b('0xd'));var toCsv=require(_0x501b('0xe'));var querystring=require('querystring');var Papa=require(_0x501b('0xf'));var Redis=require(_0x501b('0x10'));var authService=require(_0x501b('0x11'));var qs=require(_0x501b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x501b('0x13'));var utils=require('../../config/utils');var config=require(_0x501b('0x14'));var licenseUtil=require(_0x501b('0x15'));var db=require(_0x501b('0x16'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x501b('0x17'),'port':0x18eb});var socket=require(_0x501b('0x18'))(new Redis(config['redis']));require(_0x501b('0x19'))[_0x501b('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x501b('0x1b')]({'port':0x232c});var client9002=jayson[_0x501b('0x1c')][_0x501b('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x48780c,_0x480996,_0x1253ec,_0x1ed84e){return new BPromise(function(_0x2967ba,_0x5ccc61){var _0x40e375=_0x1ed84e||client;return _0x40e375[_0x501b('0x1d')](_0x48780c,_0x1253ec)[_0x501b('0x1e')](function(_0x1a305b){logger[_0x501b('0x1f')]('FaxAccount,\x20%s,\x20%s',_0x480996,_0x501b('0x20'));logger[_0x501b('0x21')](_0x501b('0x22'),_0x480996,_0x501b('0x20'),JSON['stringify'](_0x1a305b));if(_0x1a305b[_0x501b('0x23')]){if(_0x1a305b['error'][_0x501b('0x24')]===0x1f4){logger[_0x501b('0x23')](_0x501b('0x25'),_0x480996,_0x1a305b[_0x501b('0x23')][_0x501b('0x26')]);return _0x5ccc61(_0x1a305b[_0x501b('0x23')][_0x501b('0x26')]);}logger[_0x501b('0x23')](_0x501b('0x25'),_0x480996,_0x1a305b[_0x501b('0x23')]['message']);return _0x2967ba(_0x1a305b[_0x501b('0x23')][_0x501b('0x26')]);}else{logger[_0x501b('0x1f')](_0x501b('0x25'),_0x480996,_0x501b('0x20'));_0x2967ba(_0x1a305b[_0x501b('0x27')][_0x501b('0x26')]);}})['catch'](function(_0x12dafd){logger[_0x501b('0x23')](_0x501b('0x25'),_0x480996,_0x12dafd);_0x5ccc61(_0x12dafd);});});}function respondWithStatusCode(_0x4b6280,_0x41a644){_0x41a644=_0x41a644||0xcc;return function(_0x6198f2){if(_0x6198f2){return _0x4b6280['sendStatus'](_0x41a644);}return _0x4b6280[_0x501b('0x28')](_0x41a644)['end']();};}function respondWithResult(_0x2b20e4,_0x1b5362){_0x1b5362=_0x1b5362||0xc8;return function(_0x1dc479){if(_0x1dc479){return _0x2b20e4[_0x501b('0x28')](_0x1b5362)['json'](_0x1dc479);}};}function respondWithFilteredResult(_0x13f11c,_0x3e5dac){return function(_0x1e851b){if(_0x1e851b){var _0x2d6591=typeof _0x3e5dac[_0x501b('0x29')]==='undefined'&&typeof _0x3e5dac[_0x501b('0x2a')]===_0x501b('0x2b');var _0x3a1232=_0x1e851b['count'];var _0x4174d8=_0x2d6591?0x0:_0x3e5dac[_0x501b('0x29')];var _0x5dd9fb=_0x2d6591?_0x1e851b[_0x501b('0x2c')]:_0x3e5dac[_0x501b('0x29')]+_0x3e5dac[_0x501b('0x2a')];var _0x37f198;if(_0x5dd9fb>=_0x3a1232){_0x5dd9fb=_0x3a1232;_0x37f198=0xc8;}else{_0x37f198=0xce;}_0x13f11c[_0x501b('0x28')](_0x37f198);return _0x13f11c[_0x501b('0x2d')]('Content-Range',_0x4174d8+'-'+_0x5dd9fb+'/'+_0x3a1232)[_0x501b('0x2e')](_0x1e851b);}return null;};}function patchUpdates(_0x30bd25){return function(_0xf62bc5){try{jsonpatch[_0x501b('0x2f')](_0xf62bc5,_0x30bd25,!![]);}catch(_0x5b0964){return BPromise[_0x501b('0x30')](_0x5b0964);}return _0xf62bc5[_0x501b('0x31')]();};}function saveUpdates(_0x15245a,_0x50ca63){return function(_0x1ebb17){if(_0x1ebb17){return _0x1ebb17[_0x501b('0x32')](_0x15245a)[_0x501b('0x1e')](function(_0x3a03c0){return _0x3a03c0;});}return null;};}function removeEntity(_0x2a0390,_0x5608da){return function(_0x13def7){if(_0x13def7){return _0x13def7[_0x501b('0x33')]()[_0x501b('0x1e')](function(){var _0x5eb3cd=_0x13def7[_0x501b('0x34')]({'plain':!![]});var _0x96a3c=_0x501b('0x35');return db[_0x501b('0x36')][_0x501b('0x33')]({'where':{'type':_0x96a3c,'resourceId':_0x5eb3cd['id']}})['then'](function(){return _0x13def7;});})[_0x501b('0x1e')](function(){_0x2a0390[_0x501b('0x28')](0xcc)[_0x501b('0x37')]();});}};}function handleEntityNotFound(_0xc86014,_0x2bfc11){return function(_0x434213){if(!_0x434213){_0xc86014[_0x501b('0x38')](0x194);}return _0x434213;};}function handleError(_0x4cb47f,_0x546861){_0x546861=_0x546861||0x1f4;return function(_0x4eedb3){logger[_0x501b('0x23')](_0x4eedb3[_0x501b('0x39')]);if(_0x4eedb3['name']){delete _0x4eedb3[_0x501b('0x3a')];}_0x4cb47f[_0x501b('0x28')](_0x546861)[_0x501b('0x3b')](_0x4eedb3);};}exports['index']=function(_0x59084a,_0x2f06b){var _0x33b353={'include':[{'model':db[_0x501b('0x3c')],'as':_0x501b('0x3d')}]},_0x1db0a0={},_0x534e71={'count':0x0,'rows':[]};var _0x216af9=_[_0x501b('0x3e')](db[_0x501b('0x3f')][_0x501b('0x40')],function(_0x4631d0){return{'name':_0x4631d0[_0x501b('0x41')],'type':_0x4631d0[_0x501b('0x42')]['key']};});_0x1db0a0[_0x501b('0x43')]=_['map'](_0x216af9,'name');_0x1db0a0[_0x501b('0x44')]=_[_0x501b('0x45')](_0x59084a[_0x501b('0x44')]);_0x1db0a0[_0x501b('0x46')]=_[_0x501b('0x47')](_0x1db0a0[_0x501b('0x43')],_0x1db0a0[_0x501b('0x44')]);_0x33b353[_0x501b('0x48')]=_[_0x501b('0x47')](_0x1db0a0[_0x501b('0x43')],qs[_0x501b('0x49')](_0x59084a[_0x501b('0x44')]['fields']));_0x33b353['attributes']=_0x33b353[_0x501b('0x48')][_0x501b('0x4a')]?_0x33b353[_0x501b('0x48')]:_0x1db0a0['model'];if(!_0x59084a['query'][_0x501b('0x4b')]('nolimit')){_0x33b353[_0x501b('0x2a')]=qs[_0x501b('0x2a')](_0x59084a['query'][_0x501b('0x2a')]);_0x33b353[_0x501b('0x29')]=qs['offset'](_0x59084a['query'][_0x501b('0x29')]);}_0x33b353['order']=qs[_0x501b('0x4c')](_0x59084a[_0x501b('0x44')][_0x501b('0x4c')]);_0x33b353[_0x501b('0x4d')]=qs[_0x501b('0x46')](_['pick'](_0x59084a[_0x501b('0x44')],_0x1db0a0[_0x501b('0x46')]),_0x216af9);if(_0x59084a[_0x501b('0x44')][_0x501b('0x4e')]){_0x33b353[_0x501b('0x4d')]=_[_0x501b('0x4f')](_0x33b353[_0x501b('0x4d')],{'$or':_[_0x501b('0x3e')](_0x216af9,function(_0x2102a4){if(_0x2102a4[_0x501b('0x42')]!==_0x501b('0x50')){var _0xa9d483={};_0xa9d483[_0x2102a4[_0x501b('0x3a')]]={'$like':'%'+_0x59084a[_0x501b('0x44')][_0x501b('0x4e')]+'%'};return _0xa9d483;}})});}_0x33b353=_[_0x501b('0x4f')]({},_0x33b353,_0x59084a[_0x501b('0x51')]);var _0x51eea7={'where':_0x33b353[_0x501b('0x4d')]};return db[_0x501b('0x3f')][_0x501b('0x2c')](_0x51eea7)[_0x501b('0x1e')](function(_0x4fe04e){_0x534e71[_0x501b('0x2c')]=_0x4fe04e;if(_0x59084a[_0x501b('0x44')]['includeAll']){_0x33b353[_0x501b('0x52')]=[{'all':!![]}];}return db[_0x501b('0x3f')][_0x501b('0x53')](_0x33b353);})['then'](function(_0x3720f6){_0x534e71['rows']=_0x3720f6;return _0x534e71;})[_0x501b('0x1e')](respondWithFilteredResult(_0x2f06b,_0x33b353))[_0x501b('0x54')](handleError(_0x2f06b,null));};exports[_0x501b('0x55')]=function(_0x5b1c5b,_0x51dae5){var _0x277e44={'raw':![],'where':{'id':_0x5b1c5b[_0x501b('0x56')]['id']},'include':[{'model':db[_0x501b('0x3c')],'as':_0x501b('0x3d')}]},_0x382879={};_0x382879[_0x501b('0x43')]=_['keys'](db[_0x501b('0x3f')]['rawAttributes']);_0x382879[_0x501b('0x44')]=_['keys'](_0x5b1c5b[_0x501b('0x44')]);_0x382879[_0x501b('0x46')]=_[_0x501b('0x47')](_0x382879[_0x501b('0x43')],_0x382879[_0x501b('0x44')]);_0x277e44[_0x501b('0x48')]=_[_0x501b('0x47')](_0x382879[_0x501b('0x43')],qs[_0x501b('0x49')](_0x5b1c5b[_0x501b('0x44')][_0x501b('0x49')]));_0x277e44[_0x501b('0x48')]=_0x277e44[_0x501b('0x48')][_0x501b('0x4a')]?_0x277e44[_0x501b('0x48')]:_0x382879[_0x501b('0x43')];if(_0x5b1c5b[_0x501b('0x44')]['includeAll']){_0x277e44[_0x501b('0x52')]=[{'all':!![]}];}_0x277e44=_[_0x501b('0x4f')]({},_0x277e44,_0x5b1c5b[_0x501b('0x51')]);return db[_0x501b('0x3f')][_0x501b('0x57')](_0x277e44)['then'](handleEntityNotFound(_0x51dae5,null))[_0x501b('0x1e')](respondWithResult(_0x51dae5,null))['catch'](handleError(_0x51dae5,null));};exports['create']=function(_0x2e1a40,_0x58a783){return db[_0x501b('0x3f')][_0x501b('0x58')](_0x2e1a40[_0x501b('0x59')],{})[_0x501b('0x1e')](function(_0x8e00a7){var _0x1451ec=_0x2e1a40[_0x501b('0x5a')]['get']({'plain':!![]});if(!_0x1451ec)throw new Error(_0x501b('0x5b'));if(_0x1451ec['role']===_0x501b('0x5a')){var _0x515008=_0x8e00a7['get']({'plain':!![]});var _0x3884a6=_0x501b('0x35');return db[_0x501b('0x5c')][_0x501b('0x57')]({'where':{'name':_0x3884a6,'userProfileId':_0x1451ec['userProfileId']},'raw':!![]})[_0x501b('0x1e')](function(_0x21b27a){if(_0x21b27a&&_0x21b27a['autoAssociation']===0x0){return db[_0x501b('0x36')][_0x501b('0x58')]({'name':_0x515008[_0x501b('0x3a')],'resourceId':_0x515008['id'],'type':_0x21b27a[_0x501b('0x3a')],'sectionId':_0x21b27a['id']},{})[_0x501b('0x1e')](function(){return _0x8e00a7;});}else{return _0x8e00a7;}})['catch'](function(_0x4e38d6){logger['error'](_0x501b('0x5d'),_0x4e38d6);throw _0x4e38d6;});}return _0x8e00a7;})[_0x501b('0x1e')](respondWithResult(_0x58a783,0xc9))[_0x501b('0x54')](handleError(_0x58a783,null));};exports[_0x501b('0x32')]=function(_0x51f717,_0x41f964){if(_0x51f717['body']['id']){delete _0x51f717[_0x501b('0x59')]['id'];}return db[_0x501b('0x3f')]['find']({'where':{'id':_0x51f717[_0x501b('0x56')]['id']},'include':[{'model':db[_0x501b('0x3c')],'as':_0x501b('0x3d')}]})['then'](handleEntityNotFound(_0x41f964,null))['then'](saveUpdates(_0x51f717['body'],null))[_0x501b('0x1e')](respondWithResult(_0x41f964,null))[_0x501b('0x54')](handleError(_0x41f964,null));};exports[_0x501b('0x33')]=function(_0x1fd3de,_0x2082d7){return db['FaxAccount'][_0x501b('0x57')]({'where':{'id':_0x1fd3de[_0x501b('0x56')]['id']}})[_0x501b('0x1e')](handleEntityNotFound(_0x2082d7,null))['then'](removeEntity(_0x2082d7,null))[_0x501b('0x54')](handleError(_0x2082d7,null));};exports[_0x501b('0x5e')]=function(_0x589d82,_0x1943f2){return db[_0x501b('0x3f')]['describe']()[_0x501b('0x1e')](respondWithResult(_0x1943f2,null))[_0x501b('0x54')](handleError(_0x1943f2,null));};exports['addDisposition']=function(_0x575f79,_0x44d40f,_0x49f899){if(_0x575f79[_0x501b('0x59')]['id']){delete _0x575f79[_0x501b('0x59')]['id'];}return db[_0x501b('0x3f')][_0x501b('0x57')]({'where':{'id':_0x575f79[_0x501b('0x56')]['id']}})[_0x501b('0x1e')](handleEntityNotFound(_0x44d40f,null))[_0x501b('0x1e')](function(_0x4c011e){if(_0x4c011e){_0x575f79[_0x501b('0x59')][_0x501b('0x5f')]=_0x4c011e['id'];return db[_0x501b('0x60')][_0x501b('0x58')](_0x575f79['body']);}})[_0x501b('0x1e')](respondWithResult(_0x44d40f,null))[_0x501b('0x54')](handleError(_0x44d40f,null));};exports['getDispositions']=function(_0x3bb291,_0x2ea09c,_0x2f1be6){var _0x453aa8={'raw':![],'where':{}};var _0x4d9d59={};var _0x5c19ac={'count':0x0,'rows':[]};return db[_0x501b('0x3f')]['findOne']({'where':{'id':_0x3bb291['params']['id']}})['then'](handleEntityNotFound(_0x2ea09c,null))[_0x501b('0x1e')](function(_0x2d6cba){if(_0x2d6cba){_0x4d9d59[_0x501b('0x43')]=_[_0x501b('0x45')](db[_0x501b('0x60')][_0x501b('0x40')]);_0x4d9d59['query']=_[_0x501b('0x45')](_0x3bb291[_0x501b('0x44')]);_0x4d9d59[_0x501b('0x46')]=_[_0x501b('0x47')](_0x4d9d59[_0x501b('0x43')],_0x4d9d59[_0x501b('0x44')]);_0x453aa8[_0x501b('0x48')]=_[_0x501b('0x47')](_0x4d9d59[_0x501b('0x43')],qs[_0x501b('0x49')](_0x3bb291[_0x501b('0x44')][_0x501b('0x49')]));_0x453aa8[_0x501b('0x48')]=_0x453aa8[_0x501b('0x48')][_0x501b('0x4a')]?_0x453aa8[_0x501b('0x48')]:_0x4d9d59[_0x501b('0x43')];if(!_0x3bb291[_0x501b('0x44')]['hasOwnProperty']('nolimit')){_0x453aa8[_0x501b('0x2a')]=qs[_0x501b('0x2a')](_0x3bb291['query']['limit']);_0x453aa8[_0x501b('0x29')]=qs['offset'](_0x3bb291[_0x501b('0x44')]['offset']);}_0x453aa8[_0x501b('0x61')]=qs[_0x501b('0x4c')](_0x3bb291[_0x501b('0x44')]['sort']);_0x453aa8[_0x501b('0x4d')]=qs[_0x501b('0x46')](_[_0x501b('0x62')](_0x3bb291['query'],_0x4d9d59[_0x501b('0x46')]));_0x453aa8['where'][_0x501b('0x5f')]=_0x2d6cba['id'];if(_0x3bb291['query'][_0x501b('0x4e')]){_0x453aa8[_0x501b('0x4d')]=_['merge'](_0x453aa8[_0x501b('0x4d')],{'$or':_[_0x501b('0x3e')](_0x453aa8[_0x501b('0x48')],function(_0x349aae){var _0x3befc3={};_0x3befc3[_0x349aae]={'$like':'%'+_0x3bb291[_0x501b('0x44')]['filter']+'%'};return _0x3befc3;})});}_0x453aa8=_[_0x501b('0x4f')]({},_0x453aa8,_0x3bb291['options']);return db['Disposition']['count']({'where':_0x453aa8[_0x501b('0x4d')]})[_0x501b('0x1e')](function(_0x1af5a9){_0x5c19ac[_0x501b('0x2c')]=_0x1af5a9;if(_0x3bb291[_0x501b('0x44')][_0x501b('0x63')]){_0x453aa8[_0x501b('0x52')]=[{'all':!![]}];}return db[_0x501b('0x60')]['findAll'](_0x453aa8);})[_0x501b('0x1e')](function(_0x5b4db7){_0x5c19ac['rows']=_0x5b4db7;return _0x5c19ac;});}})[_0x501b('0x1e')](respondWithFilteredResult(_0x2ea09c,_0x453aa8))[_0x501b('0x54')](handleError(_0x2ea09c,null));};exports[_0x501b('0x64')]=function(_0x5ca58c,_0x5302de,_0x2f6e84){return db[_0x501b('0x3f')][_0x501b('0x57')]({'where':{'id':_0x5ca58c[_0x501b('0x56')]['id']}})[_0x501b('0x1e')](handleEntityNotFound(_0x5302de,null))[_0x501b('0x1e')](function(_0x3ed1e9){if(_0x3ed1e9){return _0x3ed1e9[_0x501b('0x64')](_0x5ca58c['query'][_0x501b('0x65')]);}})['then'](respondWithStatusCode(_0x5302de,null))['catch'](handleError(_0x5302de,null));};exports[_0x501b('0x66')]=function(_0x5db2ec,_0x256b38,_0x2f50d1){if(_0x5db2ec['body']['id']){delete _0x5db2ec[_0x501b('0x59')]['id'];}return db['FaxAccount'][_0x501b('0x57')]({'where':{'id':_0x5db2ec[_0x501b('0x56')]['id']}})[_0x501b('0x1e')](handleEntityNotFound(_0x256b38,null))[_0x501b('0x1e')](function(_0x941d43){if(_0x941d43){_0x5db2ec[_0x501b('0x59')]['FaxAccountId']=_0x941d43['id'];return db[_0x501b('0x67')][_0x501b('0x58')](_0x5db2ec['body']);}})[_0x501b('0x1e')](respondWithResult(_0x256b38,null))[_0x501b('0x54')](handleError(_0x256b38,null));};exports[_0x501b('0x68')]=function(_0x5a7a54,_0x59de9a,_0x75880f){var _0x5146ff={'raw':![],'where':{}};var _0xd1ec8e={};var _0x452a95={'count':0x0,'rows':[]};return db[_0x501b('0x3f')][_0x501b('0x69')]({'where':{'id':_0x5a7a54[_0x501b('0x56')]['id']}})[_0x501b('0x1e')](handleEntityNotFound(_0x59de9a,null))[_0x501b('0x1e')](function(_0x39d13e){if(_0x39d13e){_0xd1ec8e[_0x501b('0x43')]=_['keys'](db[_0x501b('0x67')][_0x501b('0x40')]);_0xd1ec8e[_0x501b('0x44')]=_[_0x501b('0x45')](_0x5a7a54[_0x501b('0x44')]);_0xd1ec8e[_0x501b('0x46')]=_[_0x501b('0x47')](_0xd1ec8e[_0x501b('0x43')],_0xd1ec8e[_0x501b('0x44')]);_0x5146ff['attributes']=_[_0x501b('0x47')](_0xd1ec8e['model'],qs[_0x501b('0x49')](_0x5a7a54['query'][_0x501b('0x49')]));_0x5146ff[_0x501b('0x48')]=_0x5146ff['attributes'][_0x501b('0x4a')]?_0x5146ff[_0x501b('0x48')]:_0xd1ec8e[_0x501b('0x43')];if(!_0x5a7a54['query'][_0x501b('0x4b')]('nolimit')){_0x5146ff[_0x501b('0x2a')]=qs[_0x501b('0x2a')](_0x5a7a54[_0x501b('0x44')][_0x501b('0x2a')]);_0x5146ff[_0x501b('0x29')]=qs[_0x501b('0x29')](_0x5a7a54['query'][_0x501b('0x29')]);}_0x5146ff[_0x501b('0x61')]=qs[_0x501b('0x4c')](_0x5a7a54[_0x501b('0x44')]['sort']);_0x5146ff['where']=qs[_0x501b('0x46')](_['pick'](_0x5a7a54['query'],_0xd1ec8e[_0x501b('0x46')]));_0x5146ff[_0x501b('0x4d')][_0x501b('0x5f')]=_0x39d13e['id'];if(_0x5a7a54[_0x501b('0x44')][_0x501b('0x4e')]){_0x5146ff[_0x501b('0x4d')]=_[_0x501b('0x4f')](_0x5146ff[_0x501b('0x4d')],{'$or':_['map'](_0x5146ff[_0x501b('0x48')],function(_0x5b8924){var _0x549bb1={};_0x549bb1[_0x5b8924]={'$like':'%'+_0x5a7a54[_0x501b('0x44')]['filter']+'%'};return _0x549bb1;})});}_0x5146ff=_['merge']({},_0x5146ff,_0x5a7a54[_0x501b('0x51')]);return db[_0x501b('0x67')]['count']({'where':_0x5146ff[_0x501b('0x4d')]})[_0x501b('0x1e')](function(_0x41fc08){_0x452a95['count']=_0x41fc08;if(_0x5a7a54[_0x501b('0x44')][_0x501b('0x63')]){_0x5146ff[_0x501b('0x52')]=[{'all':!![]}];}return db[_0x501b('0x67')][_0x501b('0x53')](_0x5146ff);})[_0x501b('0x1e')](function(_0x274b81){_0x452a95[_0x501b('0x6a')]=_0x274b81;return _0x452a95;});}})['then'](respondWithFilteredResult(_0x59de9a,_0x5146ff))[_0x501b('0x54')](handleError(_0x59de9a,null));};exports[_0x501b('0x6b')]=function(_0x5527fc,_0x373c4d,_0x1c7770){return db[_0x501b('0x3f')][_0x501b('0x57')]({'where':{'id':_0x5527fc['params']['id']}})[_0x501b('0x1e')](handleEntityNotFound(_0x373c4d,null))[_0x501b('0x1e')](function(_0x4e6fd6){if(_0x4e6fd6){return _0x4e6fd6['removeAnswers'](_0x5527fc[_0x501b('0x44')]['ids']);}})[_0x501b('0x1e')](respondWithStatusCode(_0x373c4d,null))[_0x501b('0x54')](handleError(_0x373c4d,null));};exports['addInteraction']=function(_0x14bd88,_0x5487fe,_0x10b957){return db['FaxInteraction'][_0x501b('0x57')]({'where':{'id':_0x14bd88[_0x501b('0x56')]['id']}})['then'](handleEntityNotFound(_0x5487fe,null))[_0x501b('0x1e')](function(_0x1f1361){if(_0x1f1361){return _0x1f1361[_0x501b('0x6c')](_0x14bd88[_0x501b('0x59')]['ids'],_[_0x501b('0x6d')](_0x14bd88['body'],['ids','id'])||{});}})[_0x501b('0x1e')](respondWithResult(_0x5487fe,null))[_0x501b('0x54')](handleError(_0x5487fe,null));};exports[_0x501b('0x6e')]=function(_0x548601,_0x30c45c,_0x43a5fe){var _0x3921d8={'raw':![],'where':{}};var _0x5aecc5={};var _0x545775={'count':0x0,'rows':[]};return db[_0x501b('0x3f')][_0x501b('0x69')]({'where':{'id':_0x548601['params']['id']}})[_0x501b('0x1e')](handleEntityNotFound(_0x30c45c,null))['then'](function(_0x1e42d3){if(_0x1e42d3){_0x5aecc5['model']=_[_0x501b('0x45')](db[_0x501b('0x6f')][_0x501b('0x40')]);_0x5aecc5[_0x501b('0x44')]=_[_0x501b('0x45')](_0x548601['query']);_0x5aecc5[_0x501b('0x46')]=_[_0x501b('0x47')](_0x5aecc5[_0x501b('0x43')],_0x5aecc5[_0x501b('0x44')]);_0x3921d8[_0x501b('0x48')]=_[_0x501b('0x47')](_0x5aecc5[_0x501b('0x43')],qs[_0x501b('0x49')](_0x548601[_0x501b('0x44')][_0x501b('0x49')]));_0x3921d8[_0x501b('0x48')]=_0x3921d8[_0x501b('0x48')][_0x501b('0x4a')]?_0x3921d8[_0x501b('0x48')]:_0x5aecc5[_0x501b('0x43')];if(!_0x548601[_0x501b('0x44')]['hasOwnProperty']('nolimit')){_0x3921d8[_0x501b('0x2a')]=qs[_0x501b('0x2a')](_0x548601[_0x501b('0x44')][_0x501b('0x2a')]);_0x3921d8[_0x501b('0x29')]=qs['offset'](_0x548601[_0x501b('0x44')][_0x501b('0x29')]);}_0x3921d8['order']=qs[_0x501b('0x4c')](_0x548601['query'][_0x501b('0x4c')]);_0x3921d8[_0x501b('0x4d')]=qs[_0x501b('0x46')](_[_0x501b('0x62')](_0x548601[_0x501b('0x44')],_0x5aecc5[_0x501b('0x46')]));_0x3921d8[_0x501b('0x4d')]['FaxAccountId']=_0x1e42d3['id'];if(_0x548601['query'][_0x501b('0x4e')]){_0x3921d8[_0x501b('0x4d')]=_[_0x501b('0x4f')](_0x3921d8[_0x501b('0x4d')],{'$or':_['map'](_0x3921d8['attributes'],function(_0x2fc378){var _0x4d544b={};_0x4d544b[_0x2fc378]={'$like':'%'+_0x548601[_0x501b('0x44')][_0x501b('0x4e')]+'%'};return _0x4d544b;})});}_0x3921d8=_[_0x501b('0x4f')]({},_0x3921d8,_0x548601[_0x501b('0x51')]);return db[_0x501b('0x6f')][_0x501b('0x2c')]({'where':_0x3921d8['where']})['then'](function(_0x1ca354){_0x545775[_0x501b('0x2c')]=_0x1ca354;if(_0x548601['query'][_0x501b('0x63')]){_0x3921d8[_0x501b('0x52')]=[{'model':db[_0x501b('0x70')],'as':_0x501b('0x71'),'required':![]},{'model':db[_0x501b('0x72')],'as':_0x501b('0x73'),'attributes':[_0x501b('0x3a'),_0x501b('0x74'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x501b('0x75'),'attributes':['id',_0x501b('0x3a'),_0x501b('0x76')],'where':_0x548601[_0x501b('0x44')][_0x501b('0x77')]?{'id':_0x548601[_0x501b('0x44')][_0x501b('0x77')]}:undefined,'required':_0x548601[_0x501b('0x44')][_0x501b('0x77')]?!![]:![]}];}return db[_0x501b('0x6f')][_0x501b('0x53')](_0x3921d8);})[_0x501b('0x1e')](function(_0x56fb41){_0x545775[_0x501b('0x6a')]=_0x56fb41;return _0x545775;});}})[_0x501b('0x1e')](respondWithFilteredResult(_0x30c45c,_0x3921d8))[_0x501b('0x54')](handleError(_0x30c45c,null));};exports[_0x501b('0x78')]=function(_0x4e5557,_0x2070ac,_0x358744){return db[_0x501b('0x3f')][_0x501b('0x69')]({'where':{'id':_0x4e5557['params']['id']}})[_0x501b('0x1e')](handleEntityNotFound(_0x2070ac,null))[_0x501b('0x1e')](function(_0x49ff6d){if(_0x49ff6d){return db[_0x501b('0x79')]['transaction'](function(_0x129c45){return db['FaxApplication'][_0x501b('0x33')]({'where':{'FaxAccountId':_0x4e5557['params']['id']},'transaction':_0x129c45})[_0x501b('0x1e')](function(_0x2a50dc){var _0x2572c9=_[_0x501b('0x3e')](_0x4e5557[_0x501b('0x59')],function(_0x247a81){_0x247a81['FaxAccountId']=_0x4e5557['params']['id'];return _0x247a81;});return db['FaxApplication'][_0x501b('0x7a')](_0x2572c9,{'transaction':_0x129c45});});})[_0x501b('0x1e')](function(){return db[_0x501b('0x7b')][_0x501b('0x7c')]({'where':{'FaxAccountId':_0x4e5557[_0x501b('0x56')]['id']},'order':_0x501b('0x7d')});});}})[_0x501b('0x1e')](respondWithResult(_0x2070ac,null))[_0x501b('0x54')](handleError(_0x2070ac,null));};exports['getApplications']=function(_0xad2f34,_0x3e8031,_0x536729){var _0x76e513={};var _0x2f0d3b={};var _0x223254;var _0x325d09;return db[_0x501b('0x3f')][_0x501b('0x69')]({'where':{'id':_0xad2f34[_0x501b('0x56')]['id']}})[_0x501b('0x1e')](handleEntityNotFound(_0x3e8031,null))['then'](function(_0x5a468e){if(_0x5a468e){_0x223254=_0x5a468e;_0x2f0d3b[_0x501b('0x43')]=_[_0x501b('0x45')](db[_0x501b('0x7b')][_0x501b('0x40')]);_0x2f0d3b[_0x501b('0x44')]=_[_0x501b('0x45')](_0xad2f34[_0x501b('0x44')]);_0x2f0d3b[_0x501b('0x46')]=_[_0x501b('0x47')](_0x2f0d3b[_0x501b('0x43')],_0x2f0d3b[_0x501b('0x44')]);_0x76e513[_0x501b('0x48')]=_[_0x501b('0x47')](_0x2f0d3b[_0x501b('0x43')],qs[_0x501b('0x49')](_0xad2f34[_0x501b('0x44')][_0x501b('0x49')]));_0x76e513[_0x501b('0x48')]=_0x76e513[_0x501b('0x48')][_0x501b('0x4a')]?_0x76e513[_0x501b('0x48')]:_0x2f0d3b['model'];_0x76e513[_0x501b('0x61')]=qs['sort'](_0xad2f34[_0x501b('0x44')][_0x501b('0x4c')]);_0x76e513[_0x501b('0x4d')]=qs['filters'](_[_0x501b('0x62')](_0xad2f34[_0x501b('0x44')],_0x2f0d3b[_0x501b('0x46')]));if(_0xad2f34[_0x501b('0x44')][_0x501b('0x4e')]){_0x76e513[_0x501b('0x4d')]=_[_0x501b('0x4f')](_0x76e513[_0x501b('0x4d')],{'$or':_[_0x501b('0x3e')](_0x76e513[_0x501b('0x48')],function(_0x118828){var _0x4f188c={};_0x4f188c[_0x118828]={'$like':'%'+_0xad2f34[_0x501b('0x44')][_0x501b('0x4e')]+'%'};return _0x4f188c;})});}_0x76e513=_[_0x501b('0x4f')]({},_0x76e513,_0xad2f34[_0x501b('0x51')]);return _0x223254[_0x501b('0x7e')](_0x76e513);}})['then'](function(_0x106adf){if(_0x106adf){_0x325d09=_0x106adf[_0x501b('0x4a')];if(!_0xad2f34['query']['hasOwnProperty']('nolimit')){_0x76e513[_0x501b('0x2a')]=qs[_0x501b('0x2a')](_0xad2f34[_0x501b('0x44')]['limit']);_0x76e513[_0x501b('0x29')]=qs[_0x501b('0x29')](_0xad2f34[_0x501b('0x44')][_0x501b('0x29')]);}return _0x223254[_0x501b('0x7e')](_0x76e513);}})[_0x501b('0x1e')](function(_0x3ca9f0){if(_0x3ca9f0){return _0x3ca9f0?{'count':_0x325d09,'rows':_0x3ca9f0}:null;}})[_0x501b('0x1e')](respondWithResult(_0x3e8031,null))[_0x501b('0x54')](handleError(_0x3e8031,null));};function Extension(_0x4dacb7,_0x5cc26e,_0x3f0951,_0xe4927e){this[_0x501b('0x7f')]=_0x501b('0x80');this[_0x501b('0x81')]=_0x4dacb7[_0x501b('0x82')];this[_0x501b('0x83')]=_0xe4927e;this['type']=_0x501b('0x84');this['description']=_0x501b('0x85');this[_0x501b('0x5f')]=_0x4dacb7['id'];this[_0x501b('0x7d')]=_0x5cc26e;this['appdata']=_0x3f0951;}function createExtensionsReciveFax(_0x4ed4d7){var _0x99532b=0x1;var _0x5da359=[];_0x5da359[_0x501b('0x86')](new Extension(_0x4ed4d7,_0x99532b,'',_0x501b('0x87')));_0x99532b+=0x1;_0x5da359[_0x501b('0x86')](new Extension(_0x4ed4d7,_0x99532b,'CDR(type)=inbound-fax',_0x501b('0x88')));_0x99532b+=0x1;for(var _0x160335 in _0x4ed4d7){if(_0x4ed4d7[_0x501b('0x4b')](_0x160335)&&(_0x160335==='ecm'||_0x160335===_0x501b('0x82')||_0x160335===_0x501b('0x89')||_0x160335===_0x501b('0x8a')||_0x160335===_0x501b('0x8b')||_0x160335==='maxrate'||_0x160335==='minrate'||_0x160335===_0x501b('0x8c')||_0x160335===_0x501b('0x8d'))){_0x5da359['push'](new Extension(_0x4ed4d7,_0x99532b,_0x501b('0x8e')+_0x160335+')='+_0x4ed4d7[_0x160335],'Set'));_0x99532b+=0x1;}}_0x5da359[_0x501b('0x86')](new Extension(_0x4ed4d7,_0x99532b,'6',_0x501b('0x8f')));_0x99532b+=0x1;_0x5da359['push'](new Extension(_0x4ed4d7,_0x99532b,_0x501b('0x90'),_0x501b('0x91')));_0x99532b=0x0;return _0x5da359;}exports[_0x501b('0x92')]=function(_0x24fa41,_0x3216e8,_0xb11beb){var _0x42f4dc;return db[_0x501b('0x79')][_0x501b('0x93')](function(_0x273e85){return db['FaxAccount']['create'](_0x24fa41[_0x501b('0x59')],{'transaction':_0x273e85})[_0x501b('0x1e')](function(_0x3c4fcf){_0x42f4dc=_0x3c4fcf[_0x501b('0x34')]({'plain':!![]});return db['VoiceExtension'][_0x501b('0x7a')](createExtensionsReciveFax(_0x42f4dc),{'transaction':_0x273e85});});})[_0x501b('0x1e')](function(){return _0x42f4dc;})['then'](respondWithResult(_0x3216e8,null))['catch'](handleError(_0x3216e8,null));};exports[_0x501b('0x94')]=function(_0x363891,_0x3ecb5e,_0x573ea4){var _0x19ed36;return db[_0x501b('0x79')][_0x501b('0x93')](function(_0x366d89){return db[_0x501b('0x3f')][_0x501b('0x32')](_0x363891[_0x501b('0x59')],{'where':{'id':_0x363891[_0x501b('0x59')]['id']},'transaction':_0x366d89})[_0x501b('0x1e')](function(_0x4abdfa){return db[_0x501b('0x95')]['destroy']({'where':{'FaxAccountId':_0x363891[_0x501b('0x59')]['id']},'transaction':_0x366d89})['then'](function(_0x107277){return db[_0x501b('0x95')][_0x501b('0x7a')](createExtensionsReciveFax(_[_0x501b('0x6d')](_0x363891[_0x501b('0x59')],[_0x501b('0x96'),'key',_0x501b('0x97'),'updatedAt',_0x501b('0x98'),_0x501b('0x99')])),{'transaction':_0x366d89});});});})['then'](function(){return db[_0x501b('0x3f')][_0x501b('0x9a')](_0x363891['body']['id']);})[_0x501b('0x1e')](respondWithResult(_0x3ecb5e,null))[_0x501b('0x54')](handleError(_0x3ecb5e,null));};exports['getMessages']=function(_0x24de3b,_0x4df1a1,_0x541684){var _0x40e837={'raw':!![],'where':{}};var _0xd71adf={};var _0x7ef8bb={'count':0x0,'rows':[]};return db['FaxAccount'][_0x501b('0x69')]({'where':{'id':_0x24de3b[_0x501b('0x56')]['id']}})['then'](handleEntityNotFound(_0x4df1a1,null))[_0x501b('0x1e')](function(_0x3a8dcd){if(_0x3a8dcd){_0xd71adf[_0x501b('0x43')]=_['keys'](db[_0x501b('0x9b')][_0x501b('0x40')]);_0xd71adf[_0x501b('0x44')]=_[_0x501b('0x45')](_0x24de3b[_0x501b('0x44')]);_0xd71adf['filters']=_[_0x501b('0x47')](_0xd71adf[_0x501b('0x43')],_0xd71adf[_0x501b('0x44')]);_0x40e837[_0x501b('0x48')]=_['intersection'](_0xd71adf[_0x501b('0x43')],qs[_0x501b('0x49')](_0x24de3b[_0x501b('0x44')]['fields']));_0x40e837[_0x501b('0x48')]=_0x40e837[_0x501b('0x48')]['length']?_0x40e837['attributes']:_0xd71adf[_0x501b('0x43')];if(!_0x24de3b['query']['hasOwnProperty'](_0x501b('0x9c'))){_0x40e837[_0x501b('0x2a')]=qs[_0x501b('0x2a')](_0x24de3b[_0x501b('0x44')][_0x501b('0x2a')]);_0x40e837[_0x501b('0x29')]=qs['offset'](_0x24de3b['query']['offset']);}_0x40e837[_0x501b('0x61')]=qs[_0x501b('0x4c')](_0x24de3b[_0x501b('0x44')][_0x501b('0x4c')]);_0x40e837['where']=qs[_0x501b('0x46')](_[_0x501b('0x62')](_0x24de3b['query'],_0xd71adf[_0x501b('0x46')]));_0x40e837['where'][_0x501b('0x5f')]=_0x3a8dcd['id'];if(_0x24de3b[_0x501b('0x44')]['filter']){_0x40e837[_0x501b('0x4d')]=_[_0x501b('0x4f')](_0x40e837[_0x501b('0x4d')],{'$or':_[_0x501b('0x3e')](_0x40e837['attributes'],function(_0x20ec02){var _0x2bc4c0={};_0x2bc4c0[_0x20ec02]={'$like':'%'+_0x24de3b[_0x501b('0x44')][_0x501b('0x4e')]+'%'};return _0x2bc4c0;})});}if(_0x24de3b[_0x501b('0x44')][_0x501b('0x9d')]){var _0x285fb2=_0x24de3b[_0x501b('0x44')]['$gte']['split'](',');var _0x20429b={};_0x20429b[_0x285fb2[0x0]]={'$gte':moment(_0x285fb2[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x40e837[_0x501b('0x4d')]=_[_0x501b('0x4f')](_0x40e837[_0x501b('0x4d')],_0x20429b);}_0x40e837=_[_0x501b('0x4f')]({},_0x40e837,_0x24de3b[_0x501b('0x51')]);return db[_0x501b('0x9b')][_0x501b('0x2c')]({'where':_0x40e837[_0x501b('0x4d')]})[_0x501b('0x1e')](function(_0x16be8d){_0x7ef8bb['count']=_0x16be8d;if(_0x24de3b['query']['includeAll']){_0x40e837[_0x501b('0x52')]=[{'all':!![]}];}return db[_0x501b('0x9b')][_0x501b('0x53')](_0x40e837);})[_0x501b('0x1e')](function(_0x287a7d){_0x7ef8bb[_0x501b('0x6a')]=_0x287a7d;return _0x7ef8bb;});}})[_0x501b('0x1e')](respondWithFilteredResult(_0x4df1a1,_0x40e837))['catch'](handleError(_0x4df1a1,null));};exports[_0x501b('0x3b')]=function(_0x22c166,_0x2dc8c2,_0x248f40){var _0x49960f,_0x3f94e8={},_0x29392a;if(_0x22c166['body']['to']){_0x29392a=_0x22c166[_0x501b('0x59')]['to'][0x0];}return db['FaxAccount']['find']({'where':{'id':_0x22c166[_0x501b('0x56')]['id']},'include':[{'model':db['CmList'],'as':_0x501b('0x9e'),'include':[{'model':db[_0x501b('0x70')],'as':'Contacts','where':{'fax':_0x29392a},'limit':0x1,'order':[[_0x501b('0x9f'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x2dc8c2,null))[_0x501b('0x1e')](function(_0x472f5d){_0x49960f=_0x472f5d;if(_0x22c166[_0x501b('0x59')][_0x501b('0xa0')]&&_0x22c166[_0x501b('0x59')]['attachments'][_0x501b('0x4a')]){for(var _0x526cb6=0x0;_0x526cb6<_0x22c166[_0x501b('0x59')]['attachments']['length'];_0x526cb6+=0x1){_0x22c166['body']['attachments'][_0x526cb6]={'filename':_0x22c166[_0x501b('0x59')][_0x501b('0xa0')][_0x526cb6][_0x501b('0x3a')],'id':_0x22c166[_0x501b('0x59')]['attachments'][_0x526cb6]['id'],'path':path[_0x501b('0xa1')](config[_0x501b('0xa2')],_0x501b('0xa3'),_0x22c166[_0x501b('0x59')][_0x501b('0xa0')][_0x526cb6][_0x501b('0xa4')])};}}return respondWithRpcPromise('CheckAfterSend',_0x501b('0xa5'),{'FaxAccountId':_[_0x501b('0xa6')](_0x22c166[_0x501b('0x56')]['id'])?undefined:_0x22c166['params']['id'],'path':_[_0x501b('0xa6')](_0x22c166[_0x501b('0x59')][_0x501b('0xa0')][0x0][_0x501b('0x8')])?undefined:_0x22c166[_0x501b('0x59')]['attachments'][0x0][_0x501b('0x8')],'fax':_[_0x501b('0xa6')](_0x22c166[_0x501b('0x59')]['to'][0x0])?undefined:_0x22c166[_0x501b('0x59')]['to'][0x0]},client9002);})[_0x501b('0x1e')](function(){if(_0x49960f){if(_[_0x501b('0xa6')](_0x22c166[_0x501b('0x59')]['from'])){_0x22c166[_0x501b('0x59')][_0x501b('0xa7')]=util[_0x501b('0xa8')](_0x501b('0xa9'),_0x49960f[_0x501b('0x3a')],_0x49960f['fax']);}if(_0x49960f['List']){if(_0x49960f[_0x501b('0x9e')]['Contacts'][_0x501b('0x4a')]){return _0x49960f['List'][_0x501b('0xaa')][0x0];}else{return db[_0x501b('0x70')][_0x501b('0x58')](_['defaults'](_0x22c166['body'],{'firstName':_0x22c166[_0x501b('0x59')]['to'][0x0],'phone':_0x22c166['body']['to'][0x0],'fax':_0x22c166[_0x501b('0x59')]['to'][0x0],'ListId':_0x49960f[_0x501b('0x99')]}));}}else{throw new Error(_0x501b('0xab'));}}else{throw new Error(_0x501b('0xac'));}})['then'](function(_0x3a29ed){if(_0x3a29ed){return db['FaxInteraction']['find']({'where':{'ContactId':_0x3a29ed['id'],'closed':![],'FaxAccountId':_0x49960f['id']}})[_0x501b('0x1e')](function(_0x18ee28){if(_0x18ee28){return[_0x18ee28,![]];}return db[_0x501b('0x6f')][_0x501b('0x58')]({'UserId':_0x22c166['user']['id'],'ContactId':_0x3a29ed['id'],'FaxAccountId':_0x49960f['id'],'fax':_0x22c166['body']['to'][0x0],'firstMsgDirection':_0x501b('0xad'),'Messages':[_['merge'](_0x22c166[_0x501b('0x59')],{'read':![],'body':_0x22c166['body'][_0x501b('0xa0')][0x0]['filename'],'FaxAccountId':_0x49960f['id'],'UserId':_0x22c166['user']['id'],'ContactId':_0x3a29ed['id'],'AttachmentId':_0x22c166['body'][_0x501b('0xa0')][0x0]['id']})]},{'include':[{'model':db[_0x501b('0x9b')],'as':_0x501b('0xae')}]})['then'](function(_0x5ba8d0){return[_0x5ba8d0,!![]];});});}else{throw new Error(_0x501b('0xaf'));}})[_0x501b('0xb0')](function(_0x4fcb68,_0x2739a4){if(_0x2739a4){return _0x4fcb68;}return db[_0x501b('0x9b')][_0x501b('0x58')]({'direction':_0x501b('0xad'),'read':![],'body':_0x22c166[_0x501b('0x59')][_0x501b('0xa0')][0x0][_0x501b('0xb1')],'FaxAccountId':_0x49960f['id'],'FaxInteractionId':_0x4fcb68['id'],'UserId':_0x22c166[_0x501b('0x5a')]['id'],'ContactId':_0x4fcb68[_0x501b('0xb2')],'AttachmentId':_0x22c166[_0x501b('0x59')][_0x501b('0xa0')][0x0]['id']})['then'](function(_0x2ab671){_0x4fcb68['dataValues'][_0x501b('0xae')]=[];_0x4fcb68['dataValues'][_0x501b('0xae')][_0x501b('0x86')](_0x2ab671[_0x501b('0xb3')]);return _0x4fcb68;});})[_0x501b('0x1e')](function(_0x1f49ae){respondWithRpcPromise(_0x501b('0xb4'),_0x501b('0xb4'),{'FaxAccountId':_[_0x501b('0xa6')](_0x22c166[_0x501b('0x56')]['id'])?undefined:_0x22c166['params']['id'],'path':_[_0x501b('0xa6')](_0x22c166[_0x501b('0x59')][_0x501b('0xa0')][0x0][_0x501b('0x8')])?undefined:_0x22c166['body']['attachments'][0x0][_0x501b('0x8')],'fax':_[_0x501b('0xa6')](_0x22c166['body']['to'][0x0])?undefined:_0x22c166[_0x501b('0x59')]['to'][0x0],'AttachmentId':_0x22c166['body'][_0x501b('0xa0')][0x0]['id']},client9002)[_0x501b('0x1e')](function(_0x56a048){logger[_0x501b('0x1f')](_0x501b('0xb5'),_0x56a048);})[_0x501b('0x54')](function(_0xa3547b){logger[_0x501b('0x1f')](_0x501b('0xb5'),_0xa3547b);});return _0x1f49ae;})[_0x501b('0x1e')](respondWithResult(_0x2dc8c2,null))[_0x501b('0x54')](handleError(_0x2dc8c2,null));};exports[_0x501b('0xb6')]=function(_0x4125ac,_0x39ca9a,_0x471e41){return db['FaxAccount'][_0x501b('0x57')]({'where':{'id':_0x4125ac[_0x501b('0x56')]['id']}})[_0x501b('0x1e')](handleEntityNotFound(_0x39ca9a,null))[_0x501b('0x1e')](function(_0x34c21e){if(_0x34c21e){return _0x34c21e[_0x501b('0xb6')](_0x4125ac[_0x501b('0x59')][_0x501b('0x65')],_[_0x501b('0x6d')](_0x4125ac[_0x501b('0x59')],['ids','id'])||{})['spread'](function(_0x425465){for(var _0x125fe2=0x0;_0x125fe2<_0x4125ac['body'][_0x501b('0x65')][_0x501b('0x4a')];_0x125fe2+=0x1){socket['emit']('userFaxAccount:save',{'UserId':Number(_0x4125ac[_0x501b('0x59')]['ids'][_0x125fe2]),'FaxAccountId':Number(_0x4125ac[_0x501b('0x56')]['id'])});}return _0x425465;});}})[_0x501b('0x1e')](respondWithResult(_0x39ca9a,null))[_0x501b('0x54')](handleError(_0x39ca9a,null));};exports[_0x501b('0xb7')]=function(_0x13cab6,_0x359f5b,_0x49052d){return db[_0x501b('0x3f')][_0x501b('0x57')]({'where':{'id':_0x13cab6[_0x501b('0x56')]['id']}})[_0x501b('0x1e')](handleEntityNotFound(_0x359f5b,null))[_0x501b('0x1e')](function(_0x54e841){if(_0x54e841){return _0x54e841[_0x501b('0xb7')](_0x13cab6[_0x501b('0x44')][_0x501b('0x65')])[_0x501b('0x1e')](function(){if(_[_0x501b('0xb8')](_0x13cab6[_0x501b('0x44')][_0x501b('0x65')])){for(var _0x18ff60=0x0;_0x18ff60<_0x13cab6[_0x501b('0x44')][_0x501b('0x65')][_0x501b('0x4a')];_0x18ff60+=0x1){socket['emit'](_0x501b('0xb9'),{'UserId':Number(_0x13cab6[_0x501b('0x44')][_0x501b('0x65')][_0x18ff60]),'FaxAccountId':Number(_0x13cab6[_0x501b('0x56')]['id'])});}}else{socket[_0x501b('0xba')](_0x501b('0xb9'),{'UserId':Number(_0x13cab6[_0x501b('0x44')][_0x501b('0x65')]),'FaxAccountId':Number(_0x13cab6['params']['id'])});}});}})[_0x501b('0x1e')](respondWithStatusCode(_0x359f5b,null))[_0x501b('0x54')](handleError(_0x359f5b,null));};exports['getAgents']=function(_0x14c93a,_0x96ff73,_0x2cbcfd){var _0x2c1a76={};var _0x323f0f={};var _0x2223d8;var _0x172cf0;return db[_0x501b('0x3f')][_0x501b('0x69')]({'where':{'id':_0x14c93a['params']['id']}})[_0x501b('0x1e')](handleEntityNotFound(_0x96ff73,null))[_0x501b('0x1e')](function(_0x38864d){if(_0x38864d){_0x2223d8=_0x38864d;_0x323f0f[_0x501b('0x43')]=_[_0x501b('0x45')](db[_0x501b('0x72')]['rawAttributes']);_0x323f0f['query']=_[_0x501b('0x45')](_0x14c93a[_0x501b('0x44')]);_0x323f0f[_0x501b('0x46')]=_[_0x501b('0x47')](_0x323f0f[_0x501b('0x43')],_0x323f0f[_0x501b('0x44')]);_0x2c1a76[_0x501b('0x48')]=_[_0x501b('0x47')](_0x323f0f[_0x501b('0x43')],qs[_0x501b('0x49')](_0x14c93a[_0x501b('0x44')][_0x501b('0x49')]));_0x2c1a76[_0x501b('0x48')]=_0x2c1a76[_0x501b('0x48')][_0x501b('0x4a')]?_0x2c1a76[_0x501b('0x48')]:_0x323f0f[_0x501b('0x43')];_0x2c1a76['order']=qs[_0x501b('0x4c')](_0x14c93a[_0x501b('0x44')][_0x501b('0x4c')]);_0x2c1a76[_0x501b('0x4d')]=qs[_0x501b('0x46')](_[_0x501b('0x62')](_0x14c93a['query'],_0x323f0f[_0x501b('0x46')]));if(_0x14c93a[_0x501b('0x44')][_0x501b('0x4e')]){_0x2c1a76[_0x501b('0x4d')]=_[_0x501b('0x4f')](_0x2c1a76[_0x501b('0x4d')],{'$or':_[_0x501b('0x3e')](_0x2c1a76[_0x501b('0x48')],function(_0x5690ec){var _0x409e8e={};_0x409e8e[_0x5690ec]={'$like':'%'+_0x14c93a[_0x501b('0x44')][_0x501b('0x4e')]+'%'};return _0x409e8e;})});}_0x2c1a76=_[_0x501b('0x4f')]({},_0x2c1a76,_0x14c93a[_0x501b('0x51')]);return _0x2223d8[_0x501b('0xbb')](_0x2c1a76);}})[_0x501b('0x1e')](function(_0xe37008){if(_0xe37008){_0x172cf0=_0xe37008[_0x501b('0x4a')];if(!_0x14c93a[_0x501b('0x44')][_0x501b('0x4b')](_0x501b('0x9c'))){_0x2c1a76[_0x501b('0x2a')]=qs['limit'](_0x14c93a['query'][_0x501b('0x2a')]);_0x2c1a76[_0x501b('0x29')]=qs[_0x501b('0x29')](_0x14c93a[_0x501b('0x44')][_0x501b('0x29')]);}return _0x2223d8['getAgents'](_0x2c1a76);}})[_0x501b('0x1e')](function(_0x4288ca){if(_0x4288ca){return _0x4288ca?{'count':_0x172cf0,'rows':_0x4288ca}:null;}})[_0x501b('0x1e')](respondWithResult(_0x96ff73,null))[_0x501b('0x54')](handleError(_0x96ff73,null));}; \ No newline at end of file +var _0x3f5e=['type','VIRTUAL','name','includeAll','include','findAll','rows','show','params','rawAttributes','options','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxAccounts','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','FaxAccountId','Disposition','getDispositions','hasOwnProperty','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','FaxInteraction','addInteraction','omit','getInteractions','findOne','CmContact','Contact','Owner','internal','Tag','tag','addApplications','transaction','FaxApplication','bulkCreate','findAndCountAll','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','gateway','headerinfo','maxrate','minrate','t38timeout','FAXOPT(','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','sequelize','VoiceExtension','updateAccountApplications','tech','createdAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','updatedAt','DESC','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','List','Contacts','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./faxAccount.socket','register','jayson/promise','client','http','request','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','UserProfileResource','end','stack','send','index','Pause','mandatoryDispositionPause','FaxAccount','fieldName','key','map','query','keys','filters','intersection','model','attributes','fields','length','order','sort','where','pick','filter','merge'];(function(_0x5083ff,_0x29bcbb){var _0x6d08c3=function(_0x1cc7ef){while(--_0x1cc7ef){_0x5083ff['push'](_0x5083ff['shift']());}};_0x6d08c3(++_0x29bcbb);}(_0x3f5e,0x7a));var _0xe3f5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3f5e[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xe3f5('0x0'));var rimraf=require(_0xe3f5('0x1'));var zipdir=require(_0xe3f5('0x2'));var jsonpatch=require(_0xe3f5('0x3'));var rp=require(_0xe3f5('0x4'));var moment=require('moment');var BPromise=require(_0xe3f5('0x5'));var Mustache=require(_0xe3f5('0x6'));var util=require(_0xe3f5('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xe3f5('0x8'));var ejs=require(_0xe3f5('0x9'));var fs=require('fs');var fs_extra=require(_0xe3f5('0xa'));var _=require(_0xe3f5('0xb'));var squel=require(_0xe3f5('0xc'));var crypto=require(_0xe3f5('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe3f5('0xe'));var toCsv=require(_0xe3f5('0x8'));var querystring=require(_0xe3f5('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe3f5('0x10'));var qs=require(_0xe3f5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe3f5('0x12'));var logger=require(_0xe3f5('0x13'))(_0xe3f5('0x14'));var utils=require('../../config/utils');var config=require(_0xe3f5('0x15'));var licenseUtil=require(_0xe3f5('0x16'));var db=require(_0xe3f5('0x17'))['db'];config['redis']=_[_0xe3f5('0x18')](config[_0xe3f5('0x19')],{'host':_0xe3f5('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe3f5('0x1b'))[_0xe3f5('0x1c')](socket);var jayson=require(_0xe3f5('0x1d'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xe3f5('0x1e')][_0xe3f5('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x50ca06,_0x4299ac,_0x283dda,_0x17bca){return new BPromise(function(_0xfca9d,_0x23f7e2){var _0x55d840=_0x17bca||client;return _0x55d840[_0xe3f5('0x20')](_0x50ca06,_0x283dda)['then'](function(_0x1a433e){logger['info'](_0xe3f5('0x21'),_0x4299ac,_0xe3f5('0x22'));logger[_0xe3f5('0x23')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x4299ac,_0xe3f5('0x22'),JSON['stringify'](_0x1a433e));if(_0x1a433e[_0xe3f5('0x24')]){if(_0x1a433e['error'][_0xe3f5('0x25')]===0x1f4){logger['error'](_0xe3f5('0x21'),_0x4299ac,_0x1a433e[_0xe3f5('0x24')][_0xe3f5('0x26')]);return _0x23f7e2(_0x1a433e[_0xe3f5('0x24')]['message']);}logger['error'](_0xe3f5('0x21'),_0x4299ac,_0x1a433e[_0xe3f5('0x24')]['message']);return _0xfca9d(_0x1a433e[_0xe3f5('0x24')][_0xe3f5('0x26')]);}else{logger[_0xe3f5('0x27')](_0xe3f5('0x21'),_0x4299ac,_0xe3f5('0x22'));_0xfca9d(_0x1a433e[_0xe3f5('0x28')][_0xe3f5('0x26')]);}})[_0xe3f5('0x29')](function(_0x4aff73){logger['error'](_0xe3f5('0x21'),_0x4299ac,_0x4aff73);_0x23f7e2(_0x4aff73);});});}function respondWithStatusCode(_0x5c126b,_0x57af7f){_0x57af7f=_0x57af7f||0xcc;return function(_0x12d678){if(_0x12d678){return _0x5c126b[_0xe3f5('0x2a')](_0x57af7f);}return _0x5c126b[_0xe3f5('0x2b')](_0x57af7f)['end']();};}function respondWithResult(_0x52924a,_0x2fdd11){_0x2fdd11=_0x2fdd11||0xc8;return function(_0x4b42ce){if(_0x4b42ce){return _0x52924a[_0xe3f5('0x2b')](_0x2fdd11)[_0xe3f5('0x2c')](_0x4b42ce);}};}function respondWithFilteredResult(_0x5980c3,_0x4e3aa2){return function(_0x31649d){if(_0x31649d){var _0x36cde2=typeof _0x4e3aa2[_0xe3f5('0x2d')]===_0xe3f5('0x2e')&&typeof _0x4e3aa2[_0xe3f5('0x2f')]===_0xe3f5('0x2e');var _0x2b8bc1=_0x31649d[_0xe3f5('0x30')];var _0x1d21a3=_0x36cde2?0x0:_0x4e3aa2['offset'];var _0x16c17f=_0x36cde2?_0x31649d['count']:_0x4e3aa2[_0xe3f5('0x2d')]+_0x4e3aa2['limit'];var _0x129563;if(_0x16c17f>=_0x2b8bc1){_0x16c17f=_0x2b8bc1;_0x129563=0xc8;}else{_0x129563=0xce;}_0x5980c3[_0xe3f5('0x2b')](_0x129563);return _0x5980c3[_0xe3f5('0x31')](_0xe3f5('0x32'),_0x1d21a3+'-'+_0x16c17f+'/'+_0x2b8bc1)['json'](_0x31649d);}return null;};}function patchUpdates(_0xff85f3){return function(_0x22d835){try{jsonpatch[_0xe3f5('0x33')](_0x22d835,_0xff85f3,!![]);}catch(_0x349e9c){return BPromise[_0xe3f5('0x34')](_0x349e9c);}return _0x22d835['save']();};}function saveUpdates(_0x255807,_0x6d1b14){return function(_0x384e23){if(_0x384e23){return _0x384e23[_0xe3f5('0x35')](_0x255807)[_0xe3f5('0x36')](function(_0x1ea9d3){return _0x1ea9d3;});}return null;};}function removeEntity(_0x1ba72f,_0xbcdc70){return function(_0x51974f){if(_0x51974f){return _0x51974f[_0xe3f5('0x37')]()[_0xe3f5('0x36')](function(){var _0x1465e1=_0x51974f['get']({'plain':!![]});var _0x122235='FaxAccounts';return db[_0xe3f5('0x38')]['destroy']({'where':{'type':_0x122235,'resourceId':_0x1465e1['id']}})[_0xe3f5('0x36')](function(){return _0x51974f;});})[_0xe3f5('0x36')](function(){_0x1ba72f[_0xe3f5('0x2b')](0xcc)[_0xe3f5('0x39')]();});}};}function handleEntityNotFound(_0x23e331,_0x4f60b){return function(_0x455ed8){if(!_0x455ed8){_0x23e331['sendStatus'](0x194);}return _0x455ed8;};}function handleError(_0xb9ecea,_0x17bbef){_0x17bbef=_0x17bbef||0x1f4;return function(_0x337afa){logger[_0xe3f5('0x24')](_0x337afa[_0xe3f5('0x3a')]);if(_0x337afa['name']){delete _0x337afa['name'];}_0xb9ecea[_0xe3f5('0x2b')](_0x17bbef)[_0xe3f5('0x3b')](_0x337afa);};}exports[_0xe3f5('0x3c')]=function(_0x53bb5b,_0x1ad9ad){var _0x47f18e={'include':[{'model':db[_0xe3f5('0x3d')],'as':_0xe3f5('0x3e')}]},_0x4bfef5={},_0x30025b={'count':0x0,'rows':[]};var _0x1dfae3=_['map'](db[_0xe3f5('0x3f')]['rawAttributes'],function(_0x3f5dd8){return{'name':_0x3f5dd8[_0xe3f5('0x40')],'type':_0x3f5dd8['type'][_0xe3f5('0x41')]};});_0x4bfef5['model']=_[_0xe3f5('0x42')](_0x1dfae3,'name');_0x4bfef5[_0xe3f5('0x43')]=_[_0xe3f5('0x44')](_0x53bb5b[_0xe3f5('0x43')]);_0x4bfef5[_0xe3f5('0x45')]=_[_0xe3f5('0x46')](_0x4bfef5[_0xe3f5('0x47')],_0x4bfef5['query']);_0x47f18e[_0xe3f5('0x48')]=_[_0xe3f5('0x46')](_0x4bfef5['model'],qs['fields'](_0x53bb5b[_0xe3f5('0x43')][_0xe3f5('0x49')]));_0x47f18e[_0xe3f5('0x48')]=_0x47f18e[_0xe3f5('0x48')][_0xe3f5('0x4a')]?_0x47f18e[_0xe3f5('0x48')]:_0x4bfef5[_0xe3f5('0x47')];if(!_0x53bb5b[_0xe3f5('0x43')]['hasOwnProperty']('nolimit')){_0x47f18e[_0xe3f5('0x2f')]=qs['limit'](_0x53bb5b[_0xe3f5('0x43')][_0xe3f5('0x2f')]);_0x47f18e['offset']=qs[_0xe3f5('0x2d')](_0x53bb5b[_0xe3f5('0x43')][_0xe3f5('0x2d')]);}_0x47f18e[_0xe3f5('0x4b')]=qs['sort'](_0x53bb5b[_0xe3f5('0x43')][_0xe3f5('0x4c')]);_0x47f18e[_0xe3f5('0x4d')]=qs[_0xe3f5('0x45')](_[_0xe3f5('0x4e')](_0x53bb5b[_0xe3f5('0x43')],_0x4bfef5[_0xe3f5('0x45')]),_0x1dfae3);if(_0x53bb5b['query'][_0xe3f5('0x4f')]){_0x47f18e[_0xe3f5('0x4d')]=_[_0xe3f5('0x50')](_0x47f18e[_0xe3f5('0x4d')],{'$or':_[_0xe3f5('0x42')](_0x1dfae3,function(_0x82e1f){if(_0x82e1f[_0xe3f5('0x51')]!==_0xe3f5('0x52')){var _0xb28507={};_0xb28507[_0x82e1f[_0xe3f5('0x53')]]={'$like':'%'+_0x53bb5b[_0xe3f5('0x43')][_0xe3f5('0x4f')]+'%'};return _0xb28507;}})});}_0x47f18e=_[_0xe3f5('0x50')]({},_0x47f18e,_0x53bb5b['options']);var _0x4e7c1f={'where':_0x47f18e[_0xe3f5('0x4d')]};return db[_0xe3f5('0x3f')][_0xe3f5('0x30')](_0x4e7c1f)['then'](function(_0x4b48d1){_0x30025b[_0xe3f5('0x30')]=_0x4b48d1;if(_0x53bb5b[_0xe3f5('0x43')][_0xe3f5('0x54')]){_0x47f18e[_0xe3f5('0x55')]=[{'all':!![]}];}return db[_0xe3f5('0x3f')][_0xe3f5('0x56')](_0x47f18e);})['then'](function(_0x1a78c6){_0x30025b[_0xe3f5('0x57')]=_0x1a78c6;return _0x30025b;})[_0xe3f5('0x36')](respondWithFilteredResult(_0x1ad9ad,_0x47f18e))[_0xe3f5('0x29')](handleError(_0x1ad9ad,null));};exports[_0xe3f5('0x58')]=function(_0x5ad633,_0x44630b){var _0x3069d5={'raw':![],'where':{'id':_0x5ad633[_0xe3f5('0x59')]['id']},'include':[{'model':db[_0xe3f5('0x3d')],'as':_0xe3f5('0x3e')}]},_0x4a1f88={};_0x4a1f88['model']=_[_0xe3f5('0x44')](db['FaxAccount'][_0xe3f5('0x5a')]);_0x4a1f88[_0xe3f5('0x43')]=_[_0xe3f5('0x44')](_0x5ad633[_0xe3f5('0x43')]);_0x4a1f88[_0xe3f5('0x45')]=_[_0xe3f5('0x46')](_0x4a1f88[_0xe3f5('0x47')],_0x4a1f88['query']);_0x3069d5[_0xe3f5('0x48')]=_[_0xe3f5('0x46')](_0x4a1f88[_0xe3f5('0x47')],qs[_0xe3f5('0x49')](_0x5ad633['query']['fields']));_0x3069d5[_0xe3f5('0x48')]=_0x3069d5[_0xe3f5('0x48')][_0xe3f5('0x4a')]?_0x3069d5[_0xe3f5('0x48')]:_0x4a1f88[_0xe3f5('0x47')];if(_0x5ad633[_0xe3f5('0x43')][_0xe3f5('0x54')]){_0x3069d5[_0xe3f5('0x55')]=[{'all':!![]}];}_0x3069d5=_[_0xe3f5('0x50')]({},_0x3069d5,_0x5ad633[_0xe3f5('0x5b')]);return db[_0xe3f5('0x3f')]['find'](_0x3069d5)['then'](handleEntityNotFound(_0x44630b,null))[_0xe3f5('0x36')](respondWithResult(_0x44630b,null))['catch'](handleError(_0x44630b,null));};exports[_0xe3f5('0x5c')]=function(_0x200c0a,_0x258cb6){return db[_0xe3f5('0x3f')][_0xe3f5('0x5c')](_0x200c0a['body'],{})[_0xe3f5('0x36')](function(_0x233887){var _0x106312=_0x200c0a[_0xe3f5('0x5d')][_0xe3f5('0x5e')]({'plain':!![]});if(!_0x106312)throw new Error(_0xe3f5('0x5f'));if(_0x106312[_0xe3f5('0x60')]===_0xe3f5('0x5d')){var _0xb0c02a=_0x233887[_0xe3f5('0x5e')]({'plain':!![]});var _0x1a32d=_0xe3f5('0x61');return db[_0xe3f5('0x62')][_0xe3f5('0x63')]({'where':{'name':_0x1a32d,'userProfileId':_0x106312[_0xe3f5('0x64')]},'raw':!![]})['then'](function(_0xa1a184){if(_0xa1a184&&_0xa1a184[_0xe3f5('0x65')]===0x0){return db[_0xe3f5('0x38')]['create']({'name':_0xb0c02a[_0xe3f5('0x53')],'resourceId':_0xb0c02a['id'],'type':_0xa1a184[_0xe3f5('0x53')],'sectionId':_0xa1a184['id']},{})['then'](function(){return _0x233887;});}else{return _0x233887;}})[_0xe3f5('0x29')](function(_0x4c680a){logger[_0xe3f5('0x24')](_0xe3f5('0x66'),_0x4c680a);throw _0x4c680a;});}return _0x233887;})[_0xe3f5('0x36')](respondWithResult(_0x258cb6,0xc9))[_0xe3f5('0x29')](handleError(_0x258cb6,null));};exports['update']=function(_0x9ee048,_0x192ecf){if(_0x9ee048[_0xe3f5('0x67')]['id']){delete _0x9ee048['body']['id'];}return db[_0xe3f5('0x3f')][_0xe3f5('0x63')]({'where':{'id':_0x9ee048[_0xe3f5('0x59')]['id']},'include':[{'model':db[_0xe3f5('0x3d')],'as':_0xe3f5('0x3e')}]})[_0xe3f5('0x36')](handleEntityNotFound(_0x192ecf,null))[_0xe3f5('0x36')](saveUpdates(_0x9ee048[_0xe3f5('0x67')],null))['then'](respondWithResult(_0x192ecf,null))[_0xe3f5('0x29')](handleError(_0x192ecf,null));};exports[_0xe3f5('0x37')]=function(_0x599255,_0x5c22dc){return db['FaxAccount'][_0xe3f5('0x63')]({'where':{'id':_0x599255[_0xe3f5('0x59')]['id']}})[_0xe3f5('0x36')](handleEntityNotFound(_0x5c22dc,null))[_0xe3f5('0x36')](removeEntity(_0x5c22dc,null))[_0xe3f5('0x29')](handleError(_0x5c22dc,null));};exports[_0xe3f5('0x68')]=function(_0xe9d0c,_0x289abf){return db[_0xe3f5('0x3f')][_0xe3f5('0x68')]()[_0xe3f5('0x36')](respondWithResult(_0x289abf,null))[_0xe3f5('0x29')](handleError(_0x289abf,null));};exports[_0xe3f5('0x69')]=function(_0x4d7635,_0x315395,_0x1ae309){if(_0x4d7635[_0xe3f5('0x67')]['id']){delete _0x4d7635['body']['id'];}return db['FaxAccount'][_0xe3f5('0x63')]({'where':{'id':_0x4d7635[_0xe3f5('0x59')]['id']}})['then'](handleEntityNotFound(_0x315395,null))['then'](function(_0x52964c){if(_0x52964c){_0x4d7635[_0xe3f5('0x67')][_0xe3f5('0x6a')]=_0x52964c['id'];return db[_0xe3f5('0x6b')][_0xe3f5('0x5c')](_0x4d7635['body']);}})[_0xe3f5('0x36')](respondWithResult(_0x315395,null))[_0xe3f5('0x29')](handleError(_0x315395,null));};exports[_0xe3f5('0x6c')]=function(_0x3707bb,_0xec808b,_0x3cb20f){var _0x1a9d59={'raw':![],'where':{}};var _0x4b1360={};var _0x1d03c7={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x3707bb[_0xe3f5('0x59')]['id']}})[_0xe3f5('0x36')](handleEntityNotFound(_0xec808b,null))[_0xe3f5('0x36')](function(_0x5b6ccf){if(_0x5b6ccf){_0x4b1360['model']=_[_0xe3f5('0x44')](db[_0xe3f5('0x6b')][_0xe3f5('0x5a')]);_0x4b1360['query']=_[_0xe3f5('0x44')](_0x3707bb[_0xe3f5('0x43')]);_0x4b1360[_0xe3f5('0x45')]=_[_0xe3f5('0x46')](_0x4b1360[_0xe3f5('0x47')],_0x4b1360[_0xe3f5('0x43')]);_0x1a9d59['attributes']=_[_0xe3f5('0x46')](_0x4b1360['model'],qs[_0xe3f5('0x49')](_0x3707bb['query'][_0xe3f5('0x49')]));_0x1a9d59[_0xe3f5('0x48')]=_0x1a9d59['attributes'][_0xe3f5('0x4a')]?_0x1a9d59[_0xe3f5('0x48')]:_0x4b1360[_0xe3f5('0x47')];if(!_0x3707bb[_0xe3f5('0x43')][_0xe3f5('0x6d')](_0xe3f5('0x6e'))){_0x1a9d59[_0xe3f5('0x2f')]=qs['limit'](_0x3707bb[_0xe3f5('0x43')]['limit']);_0x1a9d59[_0xe3f5('0x2d')]=qs[_0xe3f5('0x2d')](_0x3707bb[_0xe3f5('0x43')][_0xe3f5('0x2d')]);}_0x1a9d59['order']=qs['sort'](_0x3707bb[_0xe3f5('0x43')]['sort']);_0x1a9d59[_0xe3f5('0x4d')]=qs['filters'](_[_0xe3f5('0x4e')](_0x3707bb[_0xe3f5('0x43')],_0x4b1360[_0xe3f5('0x45')]));_0x1a9d59[_0xe3f5('0x4d')]['FaxAccountId']=_0x5b6ccf['id'];if(_0x3707bb[_0xe3f5('0x43')][_0xe3f5('0x4f')]){_0x1a9d59[_0xe3f5('0x4d')]=_[_0xe3f5('0x50')](_0x1a9d59['where'],{'$or':_[_0xe3f5('0x42')](_0x1a9d59[_0xe3f5('0x48')],function(_0x4685c8){var _0x59b4ff={};_0x59b4ff[_0x4685c8]={'$like':'%'+_0x3707bb[_0xe3f5('0x43')][_0xe3f5('0x4f')]+'%'};return _0x59b4ff;})});}_0x1a9d59=_['merge']({},_0x1a9d59,_0x3707bb[_0xe3f5('0x5b')]);return db[_0xe3f5('0x6b')]['count']({'where':_0x1a9d59[_0xe3f5('0x4d')]})['then'](function(_0x352914){_0x1d03c7[_0xe3f5('0x30')]=_0x352914;if(_0x3707bb['query'][_0xe3f5('0x54')]){_0x1a9d59[_0xe3f5('0x55')]=[{'all':!![]}];}return db[_0xe3f5('0x6b')][_0xe3f5('0x56')](_0x1a9d59);})['then'](function(_0x11ac10){_0x1d03c7[_0xe3f5('0x57')]=_0x11ac10;return _0x1d03c7;});}})[_0xe3f5('0x36')](respondWithFilteredResult(_0xec808b,_0x1a9d59))[_0xe3f5('0x29')](handleError(_0xec808b,null));};exports[_0xe3f5('0x6f')]=function(_0xf3b5d3,_0x1985a2,_0x2077c3){return db[_0xe3f5('0x3f')][_0xe3f5('0x63')]({'where':{'id':_0xf3b5d3[_0xe3f5('0x59')]['id']}})[_0xe3f5('0x36')](handleEntityNotFound(_0x1985a2,null))['then'](function(_0x5a2621){if(_0x5a2621){return _0x5a2621['removeDispositions'](_0xf3b5d3[_0xe3f5('0x43')][_0xe3f5('0x70')]);}})[_0xe3f5('0x36')](respondWithStatusCode(_0x1985a2,null))[_0xe3f5('0x29')](handleError(_0x1985a2,null));};exports[_0xe3f5('0x71')]=function(_0x22f2e2,_0x5ecab9,_0x4c94a5){if(_0x22f2e2[_0xe3f5('0x67')]['id']){delete _0x22f2e2[_0xe3f5('0x67')]['id'];}return db[_0xe3f5('0x3f')][_0xe3f5('0x63')]({'where':{'id':_0x22f2e2['params']['id']}})[_0xe3f5('0x36')](handleEntityNotFound(_0x5ecab9,null))['then'](function(_0x449675){if(_0x449675){_0x22f2e2[_0xe3f5('0x67')][_0xe3f5('0x6a')]=_0x449675['id'];return db[_0xe3f5('0x72')][_0xe3f5('0x5c')](_0x22f2e2[_0xe3f5('0x67')]);}})[_0xe3f5('0x36')](respondWithResult(_0x5ecab9,null))[_0xe3f5('0x29')](handleError(_0x5ecab9,null));};exports[_0xe3f5('0x73')]=function(_0x31ef98,_0x14390f,_0x428893){var _0x41f069={'raw':![],'where':{}};var _0x5a8f5d={};var _0x253b03={'count':0x0,'rows':[]};return db[_0xe3f5('0x3f')]['findOne']({'where':{'id':_0x31ef98[_0xe3f5('0x59')]['id']}})[_0xe3f5('0x36')](handleEntityNotFound(_0x14390f,null))[_0xe3f5('0x36')](function(_0x4fc58b){if(_0x4fc58b){_0x5a8f5d[_0xe3f5('0x47')]=_[_0xe3f5('0x44')](db[_0xe3f5('0x72')][_0xe3f5('0x5a')]);_0x5a8f5d[_0xe3f5('0x43')]=_['keys'](_0x31ef98[_0xe3f5('0x43')]);_0x5a8f5d[_0xe3f5('0x45')]=_[_0xe3f5('0x46')](_0x5a8f5d[_0xe3f5('0x47')],_0x5a8f5d[_0xe3f5('0x43')]);_0x41f069[_0xe3f5('0x48')]=_[_0xe3f5('0x46')](_0x5a8f5d[_0xe3f5('0x47')],qs['fields'](_0x31ef98[_0xe3f5('0x43')][_0xe3f5('0x49')]));_0x41f069[_0xe3f5('0x48')]=_0x41f069['attributes']['length']?_0x41f069['attributes']:_0x5a8f5d[_0xe3f5('0x47')];if(!_0x31ef98['query'][_0xe3f5('0x6d')](_0xe3f5('0x6e'))){_0x41f069['limit']=qs[_0xe3f5('0x2f')](_0x31ef98[_0xe3f5('0x43')][_0xe3f5('0x2f')]);_0x41f069[_0xe3f5('0x2d')]=qs[_0xe3f5('0x2d')](_0x31ef98['query'][_0xe3f5('0x2d')]);}_0x41f069[_0xe3f5('0x4b')]=qs[_0xe3f5('0x4c')](_0x31ef98['query'][_0xe3f5('0x4c')]);_0x41f069[_0xe3f5('0x4d')]=qs[_0xe3f5('0x45')](_['pick'](_0x31ef98['query'],_0x5a8f5d[_0xe3f5('0x45')]));_0x41f069[_0xe3f5('0x4d')][_0xe3f5('0x6a')]=_0x4fc58b['id'];if(_0x31ef98[_0xe3f5('0x43')]['filter']){_0x41f069[_0xe3f5('0x4d')]=_['merge'](_0x41f069['where'],{'$or':_[_0xe3f5('0x42')](_0x41f069['attributes'],function(_0x396e3d){var _0x5224cc={};_0x5224cc[_0x396e3d]={'$like':'%'+_0x31ef98[_0xe3f5('0x43')]['filter']+'%'};return _0x5224cc;})});}_0x41f069=_['merge']({},_0x41f069,_0x31ef98[_0xe3f5('0x5b')]);return db[_0xe3f5('0x72')][_0xe3f5('0x30')]({'where':_0x41f069[_0xe3f5('0x4d')]})['then'](function(_0x1c239d){_0x253b03['count']=_0x1c239d;if(_0x31ef98[_0xe3f5('0x43')][_0xe3f5('0x54')]){_0x41f069[_0xe3f5('0x55')]=[{'all':!![]}];}return db[_0xe3f5('0x72')][_0xe3f5('0x56')](_0x41f069);})[_0xe3f5('0x36')](function(_0x1a2bf3){_0x253b03[_0xe3f5('0x57')]=_0x1a2bf3;return _0x253b03;});}})[_0xe3f5('0x36')](respondWithFilteredResult(_0x14390f,_0x41f069))[_0xe3f5('0x29')](handleError(_0x14390f,null));};exports['removeAnswers']=function(_0x2aa225,_0x3c2ff9,_0x542997){return db['FaxAccount'][_0xe3f5('0x63')]({'where':{'id':_0x2aa225[_0xe3f5('0x59')]['id']}})[_0xe3f5('0x36')](handleEntityNotFound(_0x3c2ff9,null))[_0xe3f5('0x36')](function(_0x49a739){if(_0x49a739){return _0x49a739[_0xe3f5('0x74')](_0x2aa225[_0xe3f5('0x43')][_0xe3f5('0x70')]);}})['then'](respondWithStatusCode(_0x3c2ff9,null))['catch'](handleError(_0x3c2ff9,null));};exports['addInteraction']=function(_0x4caf8f,_0x22539e,_0x2e5361){return db[_0xe3f5('0x75')]['find']({'where':{'id':_0x4caf8f[_0xe3f5('0x59')]['id']}})['then'](handleEntityNotFound(_0x22539e,null))['then'](function(_0x546da1){if(_0x546da1){return _0x546da1[_0xe3f5('0x76')](_0x4caf8f[_0xe3f5('0x67')][_0xe3f5('0x70')],_[_0xe3f5('0x77')](_0x4caf8f['body'],[_0xe3f5('0x70'),'id'])||{});}})['then'](respondWithResult(_0x22539e,null))[_0xe3f5('0x29')](handleError(_0x22539e,null));};exports[_0xe3f5('0x78')]=function(_0x59050c,_0x4560db,_0x5267ec){var _0x89bd8c={'raw':![],'where':{}};var _0x5ef6ad={};var _0x59cb20={'count':0x0,'rows':[]};return db[_0xe3f5('0x3f')][_0xe3f5('0x79')]({'where':{'id':_0x59050c['params']['id']}})[_0xe3f5('0x36')](handleEntityNotFound(_0x4560db,null))[_0xe3f5('0x36')](function(_0x5c81f7){if(_0x5c81f7){_0x5ef6ad[_0xe3f5('0x47')]=_['keys'](db[_0xe3f5('0x75')][_0xe3f5('0x5a')]);_0x5ef6ad[_0xe3f5('0x43')]=_[_0xe3f5('0x44')](_0x59050c['query']);_0x5ef6ad[_0xe3f5('0x45')]=_['intersection'](_0x5ef6ad[_0xe3f5('0x47')],_0x5ef6ad[_0xe3f5('0x43')]);_0x89bd8c['attributes']=_[_0xe3f5('0x46')](_0x5ef6ad['model'],qs[_0xe3f5('0x49')](_0x59050c[_0xe3f5('0x43')][_0xe3f5('0x49')]));_0x89bd8c[_0xe3f5('0x48')]=_0x89bd8c['attributes'][_0xe3f5('0x4a')]?_0x89bd8c[_0xe3f5('0x48')]:_0x5ef6ad['model'];if(!_0x59050c[_0xe3f5('0x43')]['hasOwnProperty']('nolimit')){_0x89bd8c[_0xe3f5('0x2f')]=qs[_0xe3f5('0x2f')](_0x59050c[_0xe3f5('0x43')][_0xe3f5('0x2f')]);_0x89bd8c[_0xe3f5('0x2d')]=qs[_0xe3f5('0x2d')](_0x59050c['query']['offset']);}_0x89bd8c[_0xe3f5('0x4b')]=qs[_0xe3f5('0x4c')](_0x59050c[_0xe3f5('0x43')][_0xe3f5('0x4c')]);_0x89bd8c['where']=qs[_0xe3f5('0x45')](_[_0xe3f5('0x4e')](_0x59050c[_0xe3f5('0x43')],_0x5ef6ad[_0xe3f5('0x45')]));_0x89bd8c['where'][_0xe3f5('0x6a')]=_0x5c81f7['id'];if(_0x59050c[_0xe3f5('0x43')][_0xe3f5('0x4f')]){_0x89bd8c[_0xe3f5('0x4d')]=_[_0xe3f5('0x50')](_0x89bd8c['where'],{'$or':_[_0xe3f5('0x42')](_0x89bd8c[_0xe3f5('0x48')],function(_0x132491){var _0x4e3f8e={};_0x4e3f8e[_0x132491]={'$like':'%'+_0x59050c['query'][_0xe3f5('0x4f')]+'%'};return _0x4e3f8e;})});}_0x89bd8c=_[_0xe3f5('0x50')]({},_0x89bd8c,_0x59050c['options']);return db[_0xe3f5('0x75')]['count']({'where':_0x89bd8c['where']})[_0xe3f5('0x36')](function(_0x5edbcb){_0x59cb20[_0xe3f5('0x30')]=_0x5edbcb;if(_0x59050c['query'][_0xe3f5('0x54')]){_0x89bd8c[_0xe3f5('0x55')]=[{'model':db[_0xe3f5('0x7a')],'as':_0xe3f5('0x7b'),'required':![]},{'model':db['User'],'as':_0xe3f5('0x7c'),'attributes':[_0xe3f5('0x53'),'fullname',_0xe3f5('0x7d')],'required':![]},{'model':db[_0xe3f5('0x7e')],'as':'Tags','attributes':['id',_0xe3f5('0x53'),'color'],'where':_0x59050c[_0xe3f5('0x43')][_0xe3f5('0x7f')]?{'id':_0x59050c[_0xe3f5('0x43')][_0xe3f5('0x7f')]}:undefined,'required':_0x59050c['query'][_0xe3f5('0x7f')]?!![]:![]}];}return db[_0xe3f5('0x75')][_0xe3f5('0x56')](_0x89bd8c);})[_0xe3f5('0x36')](function(_0x80c68a){_0x59cb20[_0xe3f5('0x57')]=_0x80c68a;return _0x59cb20;});}})[_0xe3f5('0x36')](respondWithFilteredResult(_0x4560db,_0x89bd8c))['catch'](handleError(_0x4560db,null));};exports[_0xe3f5('0x80')]=function(_0x2e7905,_0x4c0076,_0x5c2ea9){return db['FaxAccount']['findOne']({'where':{'id':_0x2e7905[_0xe3f5('0x59')]['id']}})[_0xe3f5('0x36')](handleEntityNotFound(_0x4c0076,null))[_0xe3f5('0x36')](function(_0x26ff50){if(_0x26ff50){return db['sequelize'][_0xe3f5('0x81')](function(_0x4e1848){return db[_0xe3f5('0x82')][_0xe3f5('0x37')]({'where':{'FaxAccountId':_0x2e7905[_0xe3f5('0x59')]['id']},'transaction':_0x4e1848})[_0xe3f5('0x36')](function(_0x227630){var _0x1a3cda=_[_0xe3f5('0x42')](_0x2e7905[_0xe3f5('0x67')],function(_0x4dc7e3){_0x4dc7e3['FaxAccountId']=_0x2e7905[_0xe3f5('0x59')]['id'];return _0x4dc7e3;});return db[_0xe3f5('0x82')][_0xe3f5('0x83')](_0x1a3cda,{'transaction':_0x4e1848});});})[_0xe3f5('0x36')](function(){return db[_0xe3f5('0x82')][_0xe3f5('0x84')]({'where':{'FaxAccountId':_0x2e7905['params']['id']},'order':'priority'});});}})[_0xe3f5('0x36')](respondWithResult(_0x4c0076,null))['catch'](handleError(_0x4c0076,null));};exports[_0xe3f5('0x85')]=function(_0x3f9a20,_0x5a1010,_0x2a859a){var _0x291176={};var _0x379306={};var _0x44a9b5;var _0x80e501;return db[_0xe3f5('0x3f')][_0xe3f5('0x79')]({'where':{'id':_0x3f9a20[_0xe3f5('0x59')]['id']}})[_0xe3f5('0x36')](handleEntityNotFound(_0x5a1010,null))[_0xe3f5('0x36')](function(_0x33979c){if(_0x33979c){_0x44a9b5=_0x33979c;_0x379306[_0xe3f5('0x47')]=_[_0xe3f5('0x44')](db[_0xe3f5('0x82')]['rawAttributes']);_0x379306['query']=_[_0xe3f5('0x44')](_0x3f9a20['query']);_0x379306[_0xe3f5('0x45')]=_[_0xe3f5('0x46')](_0x379306['model'],_0x379306['query']);_0x291176[_0xe3f5('0x48')]=_[_0xe3f5('0x46')](_0x379306[_0xe3f5('0x47')],qs[_0xe3f5('0x49')](_0x3f9a20[_0xe3f5('0x43')][_0xe3f5('0x49')]));_0x291176[_0xe3f5('0x48')]=_0x291176[_0xe3f5('0x48')][_0xe3f5('0x4a')]?_0x291176['attributes']:_0x379306[_0xe3f5('0x47')];_0x291176[_0xe3f5('0x4b')]=qs[_0xe3f5('0x4c')](_0x3f9a20[_0xe3f5('0x43')][_0xe3f5('0x4c')]);_0x291176[_0xe3f5('0x4d')]=qs[_0xe3f5('0x45')](_[_0xe3f5('0x4e')](_0x3f9a20[_0xe3f5('0x43')],_0x379306['filters']));if(_0x3f9a20[_0xe3f5('0x43')][_0xe3f5('0x4f')]){_0x291176[_0xe3f5('0x4d')]=_[_0xe3f5('0x50')](_0x291176[_0xe3f5('0x4d')],{'$or':_[_0xe3f5('0x42')](_0x291176['attributes'],function(_0x6b5aa3){var _0x236dda={};_0x236dda[_0x6b5aa3]={'$like':'%'+_0x3f9a20['query'][_0xe3f5('0x4f')]+'%'};return _0x236dda;})});}_0x291176=_[_0xe3f5('0x50')]({},_0x291176,_0x3f9a20[_0xe3f5('0x5b')]);return _0x44a9b5[_0xe3f5('0x85')](_0x291176);}})['then'](function(_0x2640dd){if(_0x2640dd){_0x80e501=_0x2640dd[_0xe3f5('0x4a')];if(!_0x3f9a20[_0xe3f5('0x43')][_0xe3f5('0x6d')](_0xe3f5('0x6e'))){_0x291176[_0xe3f5('0x2f')]=qs[_0xe3f5('0x2f')](_0x3f9a20['query'][_0xe3f5('0x2f')]);_0x291176[_0xe3f5('0x2d')]=qs[_0xe3f5('0x2d')](_0x3f9a20[_0xe3f5('0x43')][_0xe3f5('0x2d')]);}return _0x44a9b5['getApplications'](_0x291176);}})[_0xe3f5('0x36')](function(_0x26c073){if(_0x26c073){return _0x26c073?{'count':_0x80e501,'rows':_0x26c073}:null;}})[_0xe3f5('0x36')](respondWithResult(_0x5a1010,null))['catch'](handleError(_0x5a1010,null));};function Extension(_0x34c395,_0x59a22a,_0x24d414,_0x2fe9db){this[_0xe3f5('0x86')]=_0xe3f5('0x87');this[_0xe3f5('0x88')]=_0x34c395[_0xe3f5('0x89')];this[_0xe3f5('0x8a')]=_0x2fe9db;this[_0xe3f5('0x51')]=_0xe3f5('0x8b');this[_0xe3f5('0x8c')]=_0xe3f5('0x8d');this['FaxAccountId']=_0x34c395['id'];this['priority']=_0x59a22a;this[_0xe3f5('0x8e')]=_0x24d414;}function createExtensionsReciveFax(_0x33e02a){var _0x182598=0x1;var _0x446165=[];_0x446165[_0xe3f5('0x8f')](new Extension(_0x33e02a,_0x182598,'',_0xe3f5('0x90')));_0x182598+=0x1;_0x446165[_0xe3f5('0x8f')](new Extension(_0x33e02a,_0x182598,_0xe3f5('0x91'),_0xe3f5('0x92')));_0x182598+=0x1;for(var _0x435e8f in _0x33e02a){if(_0x33e02a[_0xe3f5('0x6d')](_0x435e8f)&&(_0x435e8f==='ecm'||_0x435e8f==='localstationid'||_0x435e8f===_0xe3f5('0x93')||_0x435e8f==='faxdetect'||_0x435e8f===_0xe3f5('0x94')||_0x435e8f===_0xe3f5('0x95')||_0x435e8f===_0xe3f5('0x96')||_0x435e8f==='modem'||_0x435e8f===_0xe3f5('0x97'))){_0x446165[_0xe3f5('0x8f')](new Extension(_0x33e02a,_0x182598,_0xe3f5('0x98')+_0x435e8f+')='+_0x33e02a[_0x435e8f],_0xe3f5('0x92')));_0x182598+=0x1;}}_0x446165['push'](new Extension(_0x33e02a,_0x182598,'6','Wait'));_0x182598+=0x1;_0x446165['push'](new Extension(_0x33e02a,_0x182598,_0xe3f5('0x99'),_0xe3f5('0x9a')));_0x182598=0x0;return _0x446165;}exports[_0xe3f5('0x9b')]=function(_0x2766bd,_0x4eb4af,_0x2eba9b){var _0x455480;return db[_0xe3f5('0x9c')][_0xe3f5('0x81')](function(_0x4f7d7d){return db[_0xe3f5('0x3f')][_0xe3f5('0x5c')](_0x2766bd['body'],{'transaction':_0x4f7d7d})['then'](function(_0x367abb){_0x455480=_0x367abb[_0xe3f5('0x5e')]({'plain':!![]});return db[_0xe3f5('0x9d')][_0xe3f5('0x83')](createExtensionsReciveFax(_0x455480),{'transaction':_0x4f7d7d});});})[_0xe3f5('0x36')](function(){return _0x455480;})[_0xe3f5('0x36')](respondWithResult(_0x4eb4af,null))[_0xe3f5('0x29')](handleError(_0x4eb4af,null));};exports[_0xe3f5('0x9e')]=function(_0x2f4e21,_0x1958cb,_0x31b71b){var _0x16dee5;return db[_0xe3f5('0x9c')][_0xe3f5('0x81')](function(_0x52fdaf){return db[_0xe3f5('0x3f')]['update'](_0x2f4e21['body'],{'where':{'id':_0x2f4e21[_0xe3f5('0x67')]['id']},'transaction':_0x52fdaf})[_0xe3f5('0x36')](function(_0x52c378){return db[_0xe3f5('0x9d')][_0xe3f5('0x37')]({'where':{'FaxAccountId':_0x2f4e21['body']['id']},'transaction':_0x52fdaf})['then'](function(_0x9ee7ab){return db[_0xe3f5('0x9d')][_0xe3f5('0x83')](createExtensionsReciveFax(_['omit'](_0x2f4e21['body'],[_0xe3f5('0x9f'),'key',_0xe3f5('0xa0'),'updatedAt',_0xe3f5('0xa1'),_0xe3f5('0xa2')])),{'transaction':_0x52fdaf});});});})['then'](function(){return db[_0xe3f5('0x3f')][_0xe3f5('0xa3')](_0x2f4e21[_0xe3f5('0x67')]['id']);})[_0xe3f5('0x36')](respondWithResult(_0x1958cb,null))[_0xe3f5('0x29')](handleError(_0x1958cb,null));};exports[_0xe3f5('0xa4')]=function(_0x24f849,_0x1edbb4,_0x35528b){var _0x42cf9f={'raw':!![],'where':{}};var _0x512e03={};var _0x815ebd={'count':0x0,'rows':[]};return db[_0xe3f5('0x3f')]['findOne']({'where':{'id':_0x24f849['params']['id']}})[_0xe3f5('0x36')](handleEntityNotFound(_0x1edbb4,null))[_0xe3f5('0x36')](function(_0xd18e03){if(_0xd18e03){_0x512e03[_0xe3f5('0x47')]=_[_0xe3f5('0x44')](db[_0xe3f5('0xa5')][_0xe3f5('0x5a')]);_0x512e03['query']=_[_0xe3f5('0x44')](_0x24f849[_0xe3f5('0x43')]);_0x512e03['filters']=_[_0xe3f5('0x46')](_0x512e03[_0xe3f5('0x47')],_0x512e03[_0xe3f5('0x43')]);_0x42cf9f['attributes']=_[_0xe3f5('0x46')](_0x512e03[_0xe3f5('0x47')],qs[_0xe3f5('0x49')](_0x24f849['query'][_0xe3f5('0x49')]));_0x42cf9f[_0xe3f5('0x48')]=_0x42cf9f[_0xe3f5('0x48')][_0xe3f5('0x4a')]?_0x42cf9f[_0xe3f5('0x48')]:_0x512e03[_0xe3f5('0x47')];if(!_0x24f849[_0xe3f5('0x43')]['hasOwnProperty'](_0xe3f5('0x6e'))){_0x42cf9f[_0xe3f5('0x2f')]=qs['limit'](_0x24f849['query']['limit']);_0x42cf9f[_0xe3f5('0x2d')]=qs[_0xe3f5('0x2d')](_0x24f849[_0xe3f5('0x43')][_0xe3f5('0x2d')]);}_0x42cf9f['order']=qs[_0xe3f5('0x4c')](_0x24f849[_0xe3f5('0x43')]['sort']);_0x42cf9f[_0xe3f5('0x4d')]=qs[_0xe3f5('0x45')](_[_0xe3f5('0x4e')](_0x24f849['query'],_0x512e03[_0xe3f5('0x45')]));_0x42cf9f[_0xe3f5('0x4d')][_0xe3f5('0x6a')]=_0xd18e03['id'];if(_0x24f849[_0xe3f5('0x43')][_0xe3f5('0x4f')]){_0x42cf9f[_0xe3f5('0x4d')]=_[_0xe3f5('0x50')](_0x42cf9f[_0xe3f5('0x4d')],{'$or':_[_0xe3f5('0x42')](_0x42cf9f[_0xe3f5('0x48')],function(_0xf931f9){var _0x1fb430={};_0x1fb430[_0xf931f9]={'$like':'%'+_0x24f849['query'][_0xe3f5('0x4f')]+'%'};return _0x1fb430;})});}if(_0x24f849[_0xe3f5('0x43')]['$gte']){var _0x32ba3a=_0x24f849[_0xe3f5('0x43')][_0xe3f5('0xa6')][_0xe3f5('0xa7')](',');var _0xe4f35b={};_0xe4f35b[_0x32ba3a[0x0]]={'$gte':moment(_0x32ba3a[0x1])[_0xe3f5('0xa8')](_0xe3f5('0xa9'))};_0x42cf9f['where']=_[_0xe3f5('0x50')](_0x42cf9f[_0xe3f5('0x4d')],_0xe4f35b);}_0x42cf9f=_['merge']({},_0x42cf9f,_0x24f849[_0xe3f5('0x5b')]);return db[_0xe3f5('0xa5')]['count']({'where':_0x42cf9f[_0xe3f5('0x4d')]})['then'](function(_0x3c1315){_0x815ebd[_0xe3f5('0x30')]=_0x3c1315;if(_0x24f849[_0xe3f5('0x43')][_0xe3f5('0x54')]){_0x42cf9f['include']=[{'all':!![]}];}return db['FaxMessage'][_0xe3f5('0x56')](_0x42cf9f);})[_0xe3f5('0x36')](function(_0x5052e9){_0x815ebd[_0xe3f5('0x57')]=_0x5052e9;return _0x815ebd;});}})['then'](respondWithFilteredResult(_0x1edbb4,_0x42cf9f))[_0xe3f5('0x29')](handleError(_0x1edbb4,null));};exports[_0xe3f5('0x3b')]=function(_0x4dac4c,_0x16f4b0,_0x32077d){var _0x2a43da,_0x27333a={},_0x1750d5;if(_0x4dac4c[_0xe3f5('0x67')]['to']){_0x1750d5=_0x4dac4c[_0xe3f5('0x67')]['to'][0x0];}return db['FaxAccount'][_0xe3f5('0x63')]({'where':{'id':_0x4dac4c[_0xe3f5('0x59')]['id']},'include':[{'model':db[_0xe3f5('0xaa')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':{'fax':_0x1750d5},'limit':0x1,'order':[[_0xe3f5('0xab'),_0xe3f5('0xac')]]}]}]})[_0xe3f5('0x36')](handleEntityNotFound(_0x16f4b0,null))['then'](function(_0xaaa516){_0x2a43da=_0xaaa516;if(_0x4dac4c[_0xe3f5('0x67')]['attachments']&&_0x4dac4c[_0xe3f5('0x67')][_0xe3f5('0xad')][_0xe3f5('0x4a')]){for(var _0x5a9bf2=0x0;_0x5a9bf2<_0x4dac4c[_0xe3f5('0x67')][_0xe3f5('0xad')][_0xe3f5('0x4a')];_0x5a9bf2+=0x1){_0x4dac4c['body'][_0xe3f5('0xad')][_0x5a9bf2]={'filename':_0x4dac4c['body'][_0xe3f5('0xad')][_0x5a9bf2]['name'],'id':_0x4dac4c[_0xe3f5('0x67')][_0xe3f5('0xad')][_0x5a9bf2]['id'],'path':path['join'](config[_0xe3f5('0xae')],_0xe3f5('0xaf'),_0x4dac4c[_0xe3f5('0x67')][_0xe3f5('0xad')][_0x5a9bf2][_0xe3f5('0xb0')])};}}return respondWithRpcPromise(_0xe3f5('0xb1'),_0xe3f5('0xb1'),{'FaxAccountId':_[_0xe3f5('0xb2')](_0x4dac4c[_0xe3f5('0x59')]['id'])?undefined:_0x4dac4c[_0xe3f5('0x59')]['id'],'path':_[_0xe3f5('0xb2')](_0x4dac4c[_0xe3f5('0x67')][_0xe3f5('0xad')][0x0][_0xe3f5('0xb3')])?undefined:_0x4dac4c[_0xe3f5('0x67')][_0xe3f5('0xad')][0x0][_0xe3f5('0xb3')],'fax':_['isNil'](_0x4dac4c[_0xe3f5('0x67')]['to'][0x0])?undefined:_0x4dac4c[_0xe3f5('0x67')]['to'][0x0]},client9002);})[_0xe3f5('0x36')](function(){if(_0x2a43da){if(_[_0xe3f5('0xb2')](_0x4dac4c[_0xe3f5('0x67')][_0xe3f5('0xb4')])){_0x4dac4c[_0xe3f5('0x67')][_0xe3f5('0xb4')]=util[_0xe3f5('0xa8')](_0xe3f5('0xb5'),_0x2a43da['name'],_0x2a43da[_0xe3f5('0xb6')]);}if(_0x2a43da[_0xe3f5('0xb7')]){if(_0x2a43da['List'][_0xe3f5('0xb8')][_0xe3f5('0x4a')]){return _0x2a43da[_0xe3f5('0xb7')]['Contacts'][0x0];}else{return db['CmContact'][_0xe3f5('0x5c')](_[_0xe3f5('0x18')](_0x4dac4c[_0xe3f5('0x67')],{'firstName':_0x4dac4c[_0xe3f5('0x67')]['to'][0x0],'phone':_0x4dac4c[_0xe3f5('0x67')]['to'][0x0],'fax':_0x4dac4c[_0xe3f5('0x67')]['to'][0x0],'ListId':_0x2a43da['ListId']}));}}else{throw new Error(_0xe3f5('0xb9'));}}else{throw new Error(_0xe3f5('0xba'));}})[_0xe3f5('0x36')](function(_0x299b41){if(_0x299b41){return db[_0xe3f5('0x75')][_0xe3f5('0x63')]({'where':{'ContactId':_0x299b41['id'],'closed':![],'FaxAccountId':_0x2a43da['id']}})[_0xe3f5('0x36')](function(_0x1d1880){if(_0x1d1880){return[_0x1d1880,![]];}return db[_0xe3f5('0x75')][_0xe3f5('0x5c')]({'UserId':_0x4dac4c[_0xe3f5('0x5d')]['id'],'ContactId':_0x299b41['id'],'FaxAccountId':_0x2a43da['id'],'fax':_0x4dac4c[_0xe3f5('0x67')]['to'][0x0],'firstMsgDirection':_0xe3f5('0xbb'),'Messages':[_[_0xe3f5('0x50')](_0x4dac4c[_0xe3f5('0x67')],{'read':![],'body':_0x4dac4c['body']['attachments'][0x0][_0xe3f5('0xbc')],'FaxAccountId':_0x2a43da['id'],'UserId':_0x4dac4c[_0xe3f5('0x5d')]['id'],'ContactId':_0x299b41['id'],'AttachmentId':_0x4dac4c['body'][_0xe3f5('0xad')][0x0]['id']})]},{'include':[{'model':db[_0xe3f5('0xa5')],'as':_0xe3f5('0xbd')}]})[_0xe3f5('0x36')](function(_0x18dc23){return[_0x18dc23,!![]];});});}else{throw new Error(_0xe3f5('0xbe'));}})[_0xe3f5('0xbf')](function(_0x425074,_0x2299df){if(_0x2299df){return _0x425074;}return db['FaxMessage'][_0xe3f5('0x5c')]({'direction':'out','read':![],'body':_0x4dac4c['body'][_0xe3f5('0xad')][0x0][_0xe3f5('0xbc')],'FaxAccountId':_0x2a43da['id'],'FaxInteractionId':_0x425074['id'],'UserId':_0x4dac4c[_0xe3f5('0x5d')]['id'],'ContactId':_0x425074[_0xe3f5('0xc0')],'AttachmentId':_0x4dac4c['body'][_0xe3f5('0xad')][0x0]['id']})[_0xe3f5('0x36')](function(_0x4c0486){_0x425074['dataValues'][_0xe3f5('0xbd')]=[];_0x425074[_0xe3f5('0xc1')][_0xe3f5('0xbd')]['push'](_0x4c0486[_0xe3f5('0xc1')]);return _0x425074;});})['then'](function(_0x30ee2a){respondWithRpcPromise(_0xe3f5('0xc2'),'SendFax',{'FaxAccountId':_[_0xe3f5('0xb2')](_0x4dac4c[_0xe3f5('0x59')]['id'])?undefined:_0x4dac4c[_0xe3f5('0x59')]['id'],'path':_[_0xe3f5('0xb2')](_0x4dac4c[_0xe3f5('0x67')][_0xe3f5('0xad')][0x0]['path'])?undefined:_0x4dac4c[_0xe3f5('0x67')][_0xe3f5('0xad')][0x0]['path'],'fax':_[_0xe3f5('0xb2')](_0x4dac4c['body']['to'][0x0])?undefined:_0x4dac4c['body']['to'][0x0],'AttachmentId':_0x4dac4c[_0xe3f5('0x67')][_0xe3f5('0xad')][0x0]['id']},client9002)[_0xe3f5('0x36')](function(_0x3b86ff){logger[_0xe3f5('0x27')]('SendFaxRpc,\x20%s',_0x3b86ff);})[_0xe3f5('0x29')](function(_0x3432a0){logger[_0xe3f5('0x27')]('SendFaxRpc,\x20%s',_0x3432a0);});return _0x30ee2a;})[_0xe3f5('0x36')](respondWithResult(_0x16f4b0,null))[_0xe3f5('0x29')](handleError(_0x16f4b0,null));};exports['addAgents']=function(_0x2b40f7,_0x3a9e5f,_0xbaf8c1){return db[_0xe3f5('0x3f')]['find']({'where':{'id':_0x2b40f7['params']['id']}})[_0xe3f5('0x36')](handleEntityNotFound(_0x3a9e5f,null))['then'](function(_0x465efe){if(_0x465efe){return _0x465efe[_0xe3f5('0xc3')](_0x2b40f7[_0xe3f5('0x67')][_0xe3f5('0x70')],_[_0xe3f5('0x77')](_0x2b40f7[_0xe3f5('0x67')],[_0xe3f5('0x70'),'id'])||{})[_0xe3f5('0xbf')](function(_0x758beb){for(var _0x53c4f7=0x0;_0x53c4f7<_0x2b40f7['body']['ids'][_0xe3f5('0x4a')];_0x53c4f7+=0x1){socket[_0xe3f5('0xc4')](_0xe3f5('0xc5'),{'UserId':Number(_0x2b40f7[_0xe3f5('0x67')][_0xe3f5('0x70')][_0x53c4f7]),'FaxAccountId':Number(_0x2b40f7[_0xe3f5('0x59')]['id'])});}return _0x758beb;});}})[_0xe3f5('0x36')](respondWithResult(_0x3a9e5f,null))['catch'](handleError(_0x3a9e5f,null));};exports[_0xe3f5('0xc6')]=function(_0x3d8b21,_0x296900,_0x485014){return db['FaxAccount'][_0xe3f5('0x63')]({'where':{'id':_0x3d8b21[_0xe3f5('0x59')]['id']}})[_0xe3f5('0x36')](handleEntityNotFound(_0x296900,null))[_0xe3f5('0x36')](function(_0x19cb17){if(_0x19cb17){return _0x19cb17[_0xe3f5('0xc6')](_0x3d8b21['query'][_0xe3f5('0x70')])['then'](function(){if(_[_0xe3f5('0xc7')](_0x3d8b21[_0xe3f5('0x43')][_0xe3f5('0x70')])){for(var _0x5984dc=0x0;_0x5984dc<_0x3d8b21[_0xe3f5('0x43')][_0xe3f5('0x70')][_0xe3f5('0x4a')];_0x5984dc+=0x1){socket['emit'](_0xe3f5('0xc8'),{'UserId':Number(_0x3d8b21[_0xe3f5('0x43')][_0xe3f5('0x70')][_0x5984dc]),'FaxAccountId':Number(_0x3d8b21[_0xe3f5('0x59')]['id'])});}}else{socket[_0xe3f5('0xc4')](_0xe3f5('0xc8'),{'UserId':Number(_0x3d8b21[_0xe3f5('0x43')][_0xe3f5('0x70')]),'FaxAccountId':Number(_0x3d8b21[_0xe3f5('0x59')]['id'])});}});}})['then'](respondWithStatusCode(_0x296900,null))[_0xe3f5('0x29')](handleError(_0x296900,null));};exports[_0xe3f5('0xc9')]=function(_0x30332f,_0x108779,_0x2e3d14){var _0x168a54={};var _0x3b47ca={};var _0x19202a;var _0x10e86d;return db[_0xe3f5('0x3f')]['findOne']({'where':{'id':_0x30332f[_0xe3f5('0x59')]['id']}})[_0xe3f5('0x36')](handleEntityNotFound(_0x108779,null))[_0xe3f5('0x36')](function(_0x520ae4){if(_0x520ae4){_0x19202a=_0x520ae4;_0x3b47ca[_0xe3f5('0x47')]=_['keys'](db[_0xe3f5('0xca')][_0xe3f5('0x5a')]);_0x3b47ca[_0xe3f5('0x43')]=_[_0xe3f5('0x44')](_0x30332f['query']);_0x3b47ca[_0xe3f5('0x45')]=_[_0xe3f5('0x46')](_0x3b47ca[_0xe3f5('0x47')],_0x3b47ca['query']);_0x168a54['attributes']=_['intersection'](_0x3b47ca[_0xe3f5('0x47')],qs[_0xe3f5('0x49')](_0x30332f['query'][_0xe3f5('0x49')]));_0x168a54[_0xe3f5('0x48')]=_0x168a54['attributes']['length']?_0x168a54[_0xe3f5('0x48')]:_0x3b47ca[_0xe3f5('0x47')];_0x168a54['order']=qs[_0xe3f5('0x4c')](_0x30332f[_0xe3f5('0x43')][_0xe3f5('0x4c')]);_0x168a54[_0xe3f5('0x4d')]=qs[_0xe3f5('0x45')](_[_0xe3f5('0x4e')](_0x30332f[_0xe3f5('0x43')],_0x3b47ca['filters']));if(_0x30332f[_0xe3f5('0x43')][_0xe3f5('0x4f')]){_0x168a54[_0xe3f5('0x4d')]=_[_0xe3f5('0x50')](_0x168a54[_0xe3f5('0x4d')],{'$or':_[_0xe3f5('0x42')](_0x168a54[_0xe3f5('0x48')],function(_0x483b2a){var _0x215edc={};_0x215edc[_0x483b2a]={'$like':'%'+_0x30332f['query'][_0xe3f5('0x4f')]+'%'};return _0x215edc;})});}_0x168a54=_[_0xe3f5('0x50')]({},_0x168a54,_0x30332f['options']);return _0x19202a['getAgents'](_0x168a54);}})[_0xe3f5('0x36')](function(_0x43918a){if(_0x43918a){_0x10e86d=_0x43918a[_0xe3f5('0x4a')];if(!_0x30332f[_0xe3f5('0x43')]['hasOwnProperty']('nolimit')){_0x168a54[_0xe3f5('0x2f')]=qs[_0xe3f5('0x2f')](_0x30332f['query']['limit']);_0x168a54[_0xe3f5('0x2d')]=qs[_0xe3f5('0x2d')](_0x30332f[_0xe3f5('0x43')][_0xe3f5('0x2d')]);}return _0x19202a[_0xe3f5('0xc9')](_0x168a54);}})[_0xe3f5('0x36')](function(_0x2462ab){if(_0x2462ab){return _0x2462ab?{'count':_0x10e86d,'rows':_0x2462ab}:null;}})['then'](respondWithResult(_0x108779,null))[_0xe3f5('0x29')](handleError(_0x108779,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 1c6690b..a8d72d1 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 _0x9db7=['setMaxListeners','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxAccount'];(function(_0x71107c,_0x397b6f){var _0x4ed940=function(_0x5140ae){while(--_0x5140ae){_0x71107c['push'](_0x71107c['shift']());}};_0x4ed940(++_0x397b6f);}(_0x9db7,0x1bf));var _0x79db=function(_0x1f5a18,_0x14448d){_0x1f5a18=_0x1f5a18-0x0;var _0x5fc99c=_0x9db7[_0x1f5a18];return _0x5fc99c;};'use strict';var EventEmitter=require(_0x79db('0x0'));var FaxAccount=require(_0x79db('0x1'))['db'][_0x79db('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x79db('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x79db('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3ec588){return function(_0x3a9568,_0x59ad03,_0x12ef88){FaxAccountEvents[_0x79db('0x5')](_0x3ec588+':'+_0x3a9568['id'],_0x3a9568);FaxAccountEvents[_0x79db('0x5')](_0x3ec588,_0x3a9568);_0x12ef88(null);};}for(var e in events){if(events[_0x79db('0x6')](e)){var event=events[e];FaxAccount[_0x79db('0x7')](e,emitEvent(event));}}module[_0x79db('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0xa88f=['remove','emit','events','../../mysqldb','FaxAccount','setMaxListeners'];(function(_0x4a22c2,_0x15cb19){var _0x5432bb=function(_0x26e472){while(--_0x26e472){_0x4a22c2['push'](_0x4a22c2['shift']());}};_0x5432bb(++_0x15cb19);}(_0xa88f,0x182));var _0xfa88=function(_0x2ebfe3,_0x1ad258){_0x2ebfe3=_0x2ebfe3-0x0;var _0x24716e=_0xa88f[_0x2ebfe3];return _0x24716e;};'use strict';var EventEmitter=require(_0xfa88('0x0'));var FaxAccount=require(_0xfa88('0x1'))['db'][_0xfa88('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xfa88('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xfa88('0x4')};function emitEvent(_0x178198){return function(_0x5a9570,_0x194641,_0x50541d){FaxAccountEvents[_0xfa88('0x5')](_0x178198+':'+_0x5a9570['id'],_0x5a9570);FaxAccountEvents[_0xfa88('0x5')](_0x178198,_0x5a9570);_0x50541d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index e97d1c2..8e395aa 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 _0xf17a=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','FaxAccount','fax_accounts','../../config/logger','api'];(function(_0x323103,_0x3d346f){var _0xb5512d=function(_0xfd107d){while(--_0xfd107d){_0x323103['push'](_0x323103['shift']());}};_0xb5512d(++_0x3d346f);}(_0xf17a,0x77));var _0xaf17=function(_0x5f7412,_0x51ce32){_0x5f7412=_0x5f7412-0x0;var _0x4674c1=_0xf17a[_0x5f7412];return _0x4674c1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xaf17('0x0'))(_0xaf17('0x1'));var moment=require(_0xaf17('0x2'));var BPromise=require(_0xaf17('0x3'));var rp=require(_0xaf17('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaf17('0x5'));var config=require(_0xaf17('0x6'));var attributes=require('./faxAccount.attributes');module[_0xaf17('0x7')]=function(_0x450308,_0x38fdbd){return _0x450308[_0xaf17('0x8')](_0xaf17('0x9'),attributes,{'tableName':_0xaf17('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0477=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount'];(function(_0x4f5143,_0x1fc693){var _0x4f47c6=function(_0x544086){while(--_0x544086){_0x4f5143['push'](_0x4f5143['shift']());}};_0x4f47c6(++_0x1fc693);}(_0x0477,0x15f));var _0x7047=function(_0x2f16e5,_0x2e75e0){_0x2f16e5=_0x2f16e5-0x0;var _0x5d082a=_0x0477[_0x2f16e5];return _0x5d082a;};'use strict';var _=require(_0x7047('0x0'));var util=require(_0x7047('0x1'));var logger=require(_0x7047('0x2'))(_0x7047('0x3'));var moment=require(_0x7047('0x4'));var BPromise=require(_0x7047('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7047('0x6'));var rimraf=require(_0x7047('0x7'));var config=require(_0x7047('0x8'));var attributes=require(_0x7047('0x9'));module[_0x7047('0xa')]=function(_0x20305c,_0x17f648){return _0x20305c[_0x7047('0xb')](_0x7047('0xc'),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 4924c93..ee09d1c 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 _0x9585=['difference','keys','createdAt','updatedAt','CompanyId','from','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','Contacts','DESC','FaxApplication','Applications','List','get','applications','list','orderBy','priority','length','ListId','create','contact','fax','FaxInteraction','autoclose','push','close','created','interaction','FaxMessage','AttachmentId','UserId','User','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','util','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','http','redis','defaults','localhost','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','FaxAccount','options','raw','limit','map','include','model','attributes','GetFaxAccount','NotifyFaxAccount','body','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9585,0x17f));var _0x5958=function(_0x1016de,_0x40894){_0x1016de=_0x1016de-0x0;var _0x26fb3c=_0x9585[_0x1016de];return _0x26fb3c;};'use strict';var _=require(_0x5958('0x0'));var util=require(_0x5958('0x1'));var moment=require('moment');var BPromise=require(_0x5958('0x2'));var rs=require(_0x5958('0x3'));var fs=require('fs');var Redis=require(_0x5958('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x5958('0x5'));var jayson=require(_0x5958('0x6'));var client=jayson['client'][_0x5958('0x7')]({'port':0x232c});config[_0x5958('0x8')]=_[_0x5958('0x9')](config[_0x5958('0x8')],{'host':_0x5958('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5958('0x8')]));require(_0x5958('0xb'))[_0x5958('0xc')](socket);function respondWithRpcPromise(_0x14e01a,_0x41cc03,_0x1e9279){return new BPromise(function(_0xc523c,_0x5f1885){return client[_0x5958('0xd')](_0x14e01a,_0x1e9279)[_0x5958('0xe')](function(_0x5ec42a){logger[_0x5958('0xf')](_0x5958('0x10'),_0x41cc03,'request\x20sent');logger[_0x5958('0x11')](_0x5958('0x12'),_0x41cc03,_0x5958('0x13'),JSON[_0x5958('0x14')](_0x5ec42a));if(_0x5ec42a['error']){if(_0x5ec42a[_0x5958('0x15')][_0x5958('0x16')]===0x1f4){logger['error'](_0x5958('0x10'),_0x41cc03,_0x5ec42a['error'][_0x5958('0x17')]);return _0x5f1885(_0x5ec42a[_0x5958('0x15')][_0x5958('0x17')]);}logger[_0x5958('0x15')](_0x5958('0x10'),_0x41cc03,_0x5ec42a['error'][_0x5958('0x17')]);return _0xc523c(_0x5ec42a['error']['message']);}else{logger[_0x5958('0xf')](_0x5958('0x10'),_0x41cc03,_0x5958('0x13'));_0xc523c(_0x5ec42a[_0x5958('0x18')][_0x5958('0x17')]);}})[_0x5958('0x19')](function(_0x6b988d){logger['error']('FaxAccount,\x20%s,\x20%s',_0x41cc03,_0x6b988d);_0x5f1885(_0x6b988d);});});}exports['GetFaxAccount']=function(_0x55382c){var _0x41437b=this;return new Promise(function(_0x1b5a6a,_0x30f864){return db[_0x5958('0x1a')]['findAll']({'raw':_0x55382c['options']?_0x55382c[_0x5958('0x1b')][_0x5958('0x1c')]===undefined?!![]:![]:!![],'where':_0x55382c['options']?_0x55382c[_0x5958('0x1b')]['where']||null:null,'attributes':_0x55382c['options']?_0x55382c[_0x5958('0x1b')]['attributes']||null:null,'limit':_0x55382c[_0x5958('0x1b')]?_0x55382c['options'][_0x5958('0x1d')]||null:null,'include':_0x55382c[_0x5958('0x1b')]?_0x55382c[_0x5958('0x1b')]['include']?_[_0x5958('0x1e')](_0x55382c[_0x5958('0x1b')][_0x5958('0x1f')],function(_0x30a73f){return{'model':db[_0x30a73f[_0x5958('0x20')]],'as':_0x30a73f['as'],'attributes':_0x30a73f[_0x5958('0x21')],'include':_0x30a73f[_0x5958('0x1f')]?_['map'](_0x30a73f[_0x5958('0x1f')],function(_0x6119a4){return{'model':db[_0x6119a4['model']],'as':_0x6119a4['as'],'attributes':_0x6119a4['attributes'],'include':_0x6119a4['include']?_[_0x5958('0x1e')](_0x6119a4['include'],function(_0xfa8eab){return{'model':db[_0xfa8eab[_0x5958('0x20')]],'as':_0xfa8eab['as'],'attributes':_0xfa8eab[_0x5958('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5958('0xe')](function(_0x1c889f){logger[_0x5958('0xf')]('GetFaxAccount',_0x55382c);logger[_0x5958('0x11')](_0x5958('0x22'),_0x55382c,JSON['stringify'](_0x1c889f));_0x1b5a6a(_0x1c889f);})[_0x5958('0x19')](function(_0x26e7a5){logger[_0x5958('0x15')](_0x5958('0x22'),_0x26e7a5[_0x5958('0x17')],_0x55382c);_0x30f864(_0x41437b[_0x5958('0x15')](0x1f4,_0x26e7a5[_0x5958('0x17')]));});});};exports[_0x5958('0x23')]=function(_0x2bf172,_0x3aa2b7,_0x4a3be8){var _0x4201d4=this;return new Promise(function(_0x1fb48d,_0x5635b9){var _0x169a78={'body':_0x2bf172[_0x5958('0x24')],'channel':'fax'};var _0x19bf04=[];var _0x17e0b7=[];var _0x344aef={};return db[_0x5958('0x25')][_0x5958('0x26')]()[_0x5958('0xe')](function(_0xd16149){if(!_0xd16149){throw new db[(_0x5958('0x27'))][(_0x5958('0x28'))](_0x5958('0x29'));}_0x19bf04=_[_0x5958('0x2a')](_[_0x5958('0x2b')](_0xd16149),[_0x5958('0x2c'),_0x5958('0x2d')]);_0x17e0b7=_[_0x5958('0x2a')](_[_0x5958('0x2b')](_0xd16149),[_0x5958('0x2c'),_0x5958('0x2d'),_0x5958('0x2e'),'ListId']);if(_0x2bf172['body']['id']){delete _0x2bf172['body']['id'];}if(_['isNil'](_0x2bf172['body'][_0x5958('0x2f')])){throw new db[(_0x5958('0x27'))][(_0x5958('0x28'))]('from\x20is\x20mandatory');}if(_[_0x5958('0x30')](_0x2bf172['body'][_0x5958('0x24')])||_0x2bf172[_0x5958('0x24')][_0x5958('0x24')]===''){throw new db[(_0x5958('0x27'))][(_0x5958('0x28'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x5958('0x30')](_0x2bf172[_0x5958('0x24')][_0x5958('0x31')])){throw new db[(_0x5958('0x27'))][(_0x5958('0x28'))](_0x5958('0x32')+_0x17e0b7);}if(!_['includes'](_0x17e0b7,_0x2bf172[_0x5958('0x24')][_0x5958('0x31')])){throw new db[(_0x5958('0x27'))][(_0x5958('0x28'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x17e0b7);}_0x344aef[_0x2bf172[_0x5958('0x24')][_0x5958('0x31')]]=_0x2bf172['body']['from'];})[_0x5958('0xe')](function(){return db[_0x5958('0x1a')][_0x5958('0x33')]({'where':{'id':_0x2bf172[_0x5958('0x34')]['id']},'include':[{'model':db[_0x5958('0x35')],'as':'List','include':[{'model':db[_0x5958('0x25')],'as':_0x5958('0x36'),'where':_0x344aef,'limit':0x1,'order':[[_0x5958('0x2d'),_0x5958('0x37')]]}]},{'model':db[_0x5958('0x38')],'as':_0x5958('0x39')}]});})[_0x5958('0xe')](function(_0xcd1da6){if(_0xcd1da6&&_0xcd1da6[_0x5958('0x3a')]){var _0xa015bd=_0xcd1da6[_0x5958('0x3b')]({'plain':!![]});_0x169a78[_0x5958('0x34')]=_0xa015bd;_0x169a78[_0x5958('0x3c')]=_0xa015bd[_0x5958('0x39')];_0x169a78[_0x5958('0x3d')]=_0xa015bd[_0x5958('0x3a')];_0x169a78[_0x5958('0x3c')]=_[_0x5958('0x3e')](_0x169a78[_0x5958('0x3c')],[_0x5958('0x3f')],['asc']);if(_0x169a78['account'][_0x5958('0x39')]){delete _0x169a78[_0x5958('0x34')][_0x5958('0x39')];}if(_0x169a78['account'][_0x5958('0x3a')]&&_0x169a78[_0x5958('0x34')][_0x5958('0x3a')]['Contacts'][_0x5958('0x40')]){return _0x169a78[_0x5958('0x34')]['List'][_0x5958('0x36')][0x0];}var _0x22bf9d=_[_0x5958('0x9')](_0x2bf172[_0x5958('0x24')],{'firstName':_0x2bf172[_0x5958('0x24')][_0x5958('0x2f')],'ListId':_0xa015bd[_0x5958('0x41')]});_0x22bf9d[_0x2bf172[_0x5958('0x24')]['mapKey']]=_0x2bf172['body'][_0x5958('0x2f')];return db['CmContact'][_0x5958('0x42')](_0x22bf9d,{'fields':_0x19bf04,'raw':!![]});}})[_0x5958('0xe')](function(_0x10c6c5){_0x169a78[_0x5958('0x43')]=_0x10c6c5;if(_0x10c6c5){var _0x53e00a={'ContactId':_0x10c6c5['id'],'FaxAccountId':_0x2bf172['account']['id'],'fax':_0x10c6c5[_0x5958('0x44')]};return db['FaxInteraction'][_0x5958('0x33')]({'where':{'ContactId':_0x10c6c5['id'],'closed':![],'FaxAccountId':_0x2bf172[_0x5958('0x34')]['id']}})[_0x5958('0xe')](function(_0x2d934e){if(_0x2d934e){return[_0x2d934e,![]];}return db[_0x5958('0x45')][_0x5958('0x42')](_0x53e00a)[_0x5958('0xe')](function(_0x247879){return[_0x247879,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x3b5e34,_0x368756){var _0x5332e9=_0x3b5e34[_0x5958('0x3b')]({'plain':!![]});if(_0x368756){if(_0x169a78[_0x5958('0x34')][_0x5958('0x46')]){_0x169a78['applications'][_0x5958('0x47')]({'id':0x0,'priority':_0x169a78[_0x5958('0x3c')][_0x5958('0x40')]+0x1,'app':_0x5958('0x48'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x5332e9['created']=!![];}else{_0x5332e9[_0x5958('0x49')]=![];}_0x169a78[_0x5958('0x4a')]=_0x5332e9;return db[_0x5958('0x4b')][_0x5958('0x42')]({'body':_0x2bf172['body'][_0x5958('0x24')],'FaxAccountId':_0x2bf172[_0x5958('0x34')]['id'],'FaxInteractionId':_0x3b5e34['id'],'direction':'in','ContactId':_0x3b5e34['ContactId'],'AttachmentId':_0x2bf172['body'][_0x5958('0x4c')]});})[_0x5958('0xe')](function(_0x3113ae){_0x169a78[_0x5958('0x17')]=_0x3113ae;if(_0x169a78['interaction'][_0x5958('0x4d')]){return db[_0x5958('0x4e')][_0x5958('0x33')]({'attributes':['id','name'],'where':{'id':_0x169a78['interaction'][_0x5958('0x4d')]}})[_0x5958('0xe')](function(_0xd57d6e){if(_0xd57d6e){_0x169a78[_0x5958('0x3c')][_0x5958('0x4f')]({'id':0x0,'priority':0x0,'app':_0x5958('0x50'),'appdata':_0xd57d6e[_0x5958('0x51')]+','+(_0x169a78[_0x5958('0x34')][_0x5958('0x52')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x5958('0x53'),_0x5958('0x54'),_0x169a78);});}return respondWithRpcPromise('Start','startRouting',_0x169a78);})['then'](function(_0x4c88e2){_0x1fb48d(_0x4c88e2);})[_0x5958('0x19')](function(_0x23fa8a){_0x5635b9(_0x4201d4['error'](0x1f4,_0x23fa8a[_0x5958('0x17')]));});});}; \ No newline at end of file +var _0x4fdd=['CmList','List','Contacts','FaxApplication','Applications','get','list','applications','orderBy','priority','asc','length','create','contact','FaxInteraction','Contact\x20not\x20found','push','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','UserId','User','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','FaxAccount,\x20%s,\x20%s','message','info','result','catch','GetFaxAccount','FaxAccount','options','raw','where','attributes','limit','include','map','model','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','ListId','from','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account'];(function(_0x2941a8,_0x4602c8){var _0x18c51f=function(_0x21aa8c){while(--_0x21aa8c){_0x2941a8['push'](_0x2941a8['shift']());}};_0x18c51f(++_0x4602c8);}(_0x4fdd,0x1e2));var _0xd4fd=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x4fdd[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0xd4fd('0x0'));var util=require(_0xd4fd('0x1'));var moment=require('moment');var BPromise=require(_0xd4fd('0x2'));var rs=require(_0xd4fd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd4fd('0x4'))['db'];var utils=require(_0xd4fd('0x5'));var logger=require('../../config/logger')(_0xd4fd('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xd4fd('0x7')]({'port':0x232c});config[_0xd4fd('0x8')]=_[_0xd4fd('0x9')](config[_0xd4fd('0x8')],{'host':_0xd4fd('0xa'),'port':0x18eb});var socket=require(_0xd4fd('0xb'))(new Redis(config[_0xd4fd('0x8')]));require(_0xd4fd('0xc'))[_0xd4fd('0xd')](socket);function respondWithRpcPromise(_0x25a2c8,_0x595523,_0x327e44){return new BPromise(function(_0x32a155,_0x4fe97e){return client[_0xd4fd('0xe')](_0x25a2c8,_0x327e44)[_0xd4fd('0xf')](function(_0x4fe177){logger['info']('FaxAccount,\x20%s,\x20%s',_0x595523,_0xd4fd('0x10'));logger[_0xd4fd('0x11')](_0xd4fd('0x12'),_0x595523,_0xd4fd('0x10'),JSON['stringify'](_0x4fe177));if(_0x4fe177[_0xd4fd('0x13')]){if(_0x4fe177[_0xd4fd('0x13')][_0xd4fd('0x14')]===0x1f4){logger[_0xd4fd('0x13')](_0xd4fd('0x15'),_0x595523,_0x4fe177[_0xd4fd('0x13')][_0xd4fd('0x16')]);return _0x4fe97e(_0x4fe177[_0xd4fd('0x13')]['message']);}logger[_0xd4fd('0x13')](_0xd4fd('0x15'),_0x595523,_0x4fe177[_0xd4fd('0x13')][_0xd4fd('0x16')]);return _0x32a155(_0x4fe177[_0xd4fd('0x13')]['message']);}else{logger[_0xd4fd('0x17')](_0xd4fd('0x15'),_0x595523,_0xd4fd('0x10'));_0x32a155(_0x4fe177[_0xd4fd('0x18')][_0xd4fd('0x16')]);}})[_0xd4fd('0x19')](function(_0x2e0e05){logger[_0xd4fd('0x13')](_0xd4fd('0x15'),_0x595523,_0x2e0e05);_0x4fe97e(_0x2e0e05);});});}exports[_0xd4fd('0x1a')]=function(_0x3ea0a8){var _0x1142ce=this;return new Promise(function(_0x14c059,_0x544f00){return db[_0xd4fd('0x1b')]['findAll']({'raw':_0x3ea0a8[_0xd4fd('0x1c')]?_0x3ea0a8['options'][_0xd4fd('0x1d')]===undefined?!![]:![]:!![],'where':_0x3ea0a8[_0xd4fd('0x1c')]?_0x3ea0a8[_0xd4fd('0x1c')][_0xd4fd('0x1e')]||null:null,'attributes':_0x3ea0a8[_0xd4fd('0x1c')]?_0x3ea0a8[_0xd4fd('0x1c')][_0xd4fd('0x1f')]||null:null,'limit':_0x3ea0a8[_0xd4fd('0x1c')]?_0x3ea0a8['options'][_0xd4fd('0x20')]||null:null,'include':_0x3ea0a8[_0xd4fd('0x1c')]?_0x3ea0a8['options'][_0xd4fd('0x21')]?_[_0xd4fd('0x22')](_0x3ea0a8[_0xd4fd('0x1c')][_0xd4fd('0x21')],function(_0x1f2369){return{'model':db[_0x1f2369[_0xd4fd('0x23')]],'as':_0x1f2369['as'],'attributes':_0x1f2369[_0xd4fd('0x1f')],'include':_0x1f2369[_0xd4fd('0x21')]?_[_0xd4fd('0x22')](_0x1f2369[_0xd4fd('0x21')],function(_0x2359da){return{'model':db[_0x2359da[_0xd4fd('0x23')]],'as':_0x2359da['as'],'attributes':_0x2359da[_0xd4fd('0x1f')],'include':_0x2359da['include']?_[_0xd4fd('0x22')](_0x2359da[_0xd4fd('0x21')],function(_0x419471){return{'model':db[_0x419471[_0xd4fd('0x23')]],'as':_0x419471['as'],'attributes':_0x419471['attributes']};}):[]};}):[]};}):[]:[]})[_0xd4fd('0xf')](function(_0x431fb1){logger['info']('GetFaxAccount',_0x3ea0a8);logger['debug']('GetFaxAccount',_0x3ea0a8,JSON['stringify'](_0x431fb1));_0x14c059(_0x431fb1);})[_0xd4fd('0x19')](function(_0x22e9a9){logger[_0xd4fd('0x13')](_0xd4fd('0x1a'),_0x22e9a9[_0xd4fd('0x16')],_0x3ea0a8);_0x544f00(_0x1142ce[_0xd4fd('0x13')](0x1f4,_0x22e9a9['message']));});});};exports[_0xd4fd('0x24')]=function(_0x4f6255,_0x19b54c,_0x134239){var _0x1e0e6f=this;return new Promise(function(_0x12ad64,_0x291dce){var _0x1b461a={'body':_0x4f6255[_0xd4fd('0x25')],'channel':_0xd4fd('0x26')};var _0x365570=[];var _0xb89edc=[];var _0x252124={};return db[_0xd4fd('0x27')][_0xd4fd('0x28')]()[_0xd4fd('0xf')](function(_0x38fb8d){if(!_0x38fb8d){throw new db[(_0xd4fd('0x29'))][(_0xd4fd('0x2a'))](_0xd4fd('0x2b'));}_0x365570=_[_0xd4fd('0x2c')](_[_0xd4fd('0x2d')](_0x38fb8d),[_0xd4fd('0x2e'),'updatedAt']);_0xb89edc=_['difference'](_[_0xd4fd('0x2d')](_0x38fb8d),[_0xd4fd('0x2e'),_0xd4fd('0x2f'),'CompanyId',_0xd4fd('0x30')]);if(_0x4f6255[_0xd4fd('0x25')]['id']){delete _0x4f6255[_0xd4fd('0x25')]['id'];}if(_['isNil'](_0x4f6255[_0xd4fd('0x25')][_0xd4fd('0x31')])){throw new db[(_0xd4fd('0x29'))][(_0xd4fd('0x2a'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x4f6255[_0xd4fd('0x25')][_0xd4fd('0x25')])||_0x4f6255[_0xd4fd('0x25')][_0xd4fd('0x25')]===''){throw new db['Sequelize'][(_0xd4fd('0x2a'))](_0xd4fd('0x32'));}if(_[_0xd4fd('0x33')](_0x4f6255[_0xd4fd('0x25')][_0xd4fd('0x34')])){throw new db['Sequelize']['ValidationError'](_0xd4fd('0x35')+_0xb89edc);}if(!_[_0xd4fd('0x36')](_0xb89edc,_0x4f6255[_0xd4fd('0x25')]['mapKey'])){throw new db[(_0xd4fd('0x29'))][(_0xd4fd('0x2a'))](_0xd4fd('0x37')+_0xb89edc);}_0x252124[_0x4f6255[_0xd4fd('0x25')][_0xd4fd('0x34')]]=_0x4f6255['body']['from'];})[_0xd4fd('0xf')](function(){return db['FaxAccount'][_0xd4fd('0x38')]({'where':{'id':_0x4f6255[_0xd4fd('0x39')]['id']},'include':[{'model':db[_0xd4fd('0x3a')],'as':_0xd4fd('0x3b'),'include':[{'model':db[_0xd4fd('0x27')],'as':_0xd4fd('0x3c'),'where':_0x252124,'limit':0x1,'order':[[_0xd4fd('0x2f'),'DESC']]}]},{'model':db[_0xd4fd('0x3d')],'as':_0xd4fd('0x3e')}]});})[_0xd4fd('0xf')](function(_0x3bc4bf){if(_0x3bc4bf&&_0x3bc4bf[_0xd4fd('0x3b')]){var _0x1133c8=_0x3bc4bf[_0xd4fd('0x3f')]({'plain':!![]});_0x1b461a[_0xd4fd('0x39')]=_0x1133c8;_0x1b461a['applications']=_0x1133c8['Applications'];_0x1b461a[_0xd4fd('0x40')]=_0x1133c8['List'];_0x1b461a[_0xd4fd('0x41')]=_[_0xd4fd('0x42')](_0x1b461a[_0xd4fd('0x41')],[_0xd4fd('0x43')],[_0xd4fd('0x44')]);if(_0x1b461a[_0xd4fd('0x39')][_0xd4fd('0x3e')]){delete _0x1b461a[_0xd4fd('0x39')][_0xd4fd('0x3e')];}if(_0x1b461a['account']['List']&&_0x1b461a[_0xd4fd('0x39')][_0xd4fd('0x3b')][_0xd4fd('0x3c')][_0xd4fd('0x45')]){return _0x1b461a['account'][_0xd4fd('0x3b')][_0xd4fd('0x3c')][0x0];}var _0x5207d4=_[_0xd4fd('0x9')](_0x4f6255[_0xd4fd('0x25')],{'firstName':_0x4f6255['body'][_0xd4fd('0x31')],'ListId':_0x1133c8[_0xd4fd('0x30')]});_0x5207d4[_0x4f6255[_0xd4fd('0x25')]['mapKey']]=_0x4f6255[_0xd4fd('0x25')][_0xd4fd('0x31')];return db[_0xd4fd('0x27')][_0xd4fd('0x46')](_0x5207d4,{'fields':_0x365570,'raw':!![]});}})[_0xd4fd('0xf')](function(_0x5da0f4){_0x1b461a[_0xd4fd('0x47')]=_0x5da0f4;if(_0x5da0f4){var _0x2e5050={'ContactId':_0x5da0f4['id'],'FaxAccountId':_0x4f6255[_0xd4fd('0x39')]['id'],'fax':_0x5da0f4[_0xd4fd('0x26')]};return db[_0xd4fd('0x48')][_0xd4fd('0x38')]({'where':{'ContactId':_0x5da0f4['id'],'closed':![],'FaxAccountId':_0x4f6255['account']['id']}})[_0xd4fd('0xf')](function(_0x27188c){if(_0x27188c){return[_0x27188c,![]];}return db[_0xd4fd('0x48')][_0xd4fd('0x46')](_0x2e5050)[_0xd4fd('0xf')](function(_0x5e5c0b){return[_0x5e5c0b,!![]];});});}else{throw new Error(_0xd4fd('0x49'));}})['spread'](function(_0x4efb11,_0x405166){var _0x1888ef=_0x4efb11[_0xd4fd('0x3f')]({'plain':!![]});if(_0x405166){if(_0x1b461a['account']['autoclose']){_0x1b461a[_0xd4fd('0x41')][_0xd4fd('0x4a')]({'id':0x0,'priority':_0x1b461a['applications']['length']+0x1,'app':_0xd4fd('0x4b'),'appdata':_0xd4fd('0x4c'),'interval':_0xd4fd('0x4d')});}_0x1888ef[_0xd4fd('0x4e')]=!![];}else{_0x1888ef[_0xd4fd('0x4e')]=![];}_0x1b461a[_0xd4fd('0x4f')]=_0x1888ef;return db[_0xd4fd('0x50')][_0xd4fd('0x46')]({'body':_0x4f6255[_0xd4fd('0x25')]['body'],'FaxAccountId':_0x4f6255[_0xd4fd('0x39')]['id'],'FaxInteractionId':_0x4efb11['id'],'direction':'in','ContactId':_0x4efb11[_0xd4fd('0x51')],'AttachmentId':_0x4f6255[_0xd4fd('0x25')]['AttachmentId']});})['then'](function(_0x3ecdb7){_0x1b461a[_0xd4fd('0x16')]=_0x3ecdb7;if(_0x1b461a[_0xd4fd('0x4f')][_0xd4fd('0x52')]){return db[_0xd4fd('0x53')]['find']({'attributes':['id','name'],'where':{'id':_0x1b461a[_0xd4fd('0x4f')]['UserId']}})['then'](function(_0x4ba246){if(_0x4ba246){_0x1b461a['applications'][_0xd4fd('0x54')]({'id':0x0,'priority':0x0,'app':_0xd4fd('0x55'),'appdata':_0x4ba246[_0xd4fd('0x56')]+','+(_0x1b461a[_0xd4fd('0x39')][_0xd4fd('0x57')]||0xa),'interval':_0xd4fd('0x4d')});}return respondWithRpcPromise(_0xd4fd('0x58'),'startRouting',_0x1b461a);});}return respondWithRpcPromise(_0xd4fd('0x58'),_0xd4fd('0x59'),_0x1b461a);})[_0xd4fd('0xf')](function(_0x474550){_0x12ad64(_0x474550);})['catch'](function(_0x50baf9){_0x291dce(_0x1e0e6f[_0xd4fd('0x13')](0x1f4,_0x50baf9[_0xd4fd('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 5502165..f8cea4e 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 _0x050b=['register','faxAccount:','./faxAccount.events','remove','update','emit','removeListener'];(function(_0x278775,_0x5912ca){var _0x458456=function(_0x284e51){while(--_0x284e51){_0x278775['push'](_0x278775['shift']());}};_0x458456(++_0x5912ca);}(_0x050b,0x1d7));var _0xb050=function(_0x31b5c1,_0x4569e4){_0x31b5c1=_0x31b5c1-0x0;var _0x9bfac0=_0x050b[_0x31b5c1];return _0x9bfac0;};'use strict';var FaxAccountEvents=require(_0xb050('0x0'));var events=['save',_0xb050('0x1'),_0xb050('0x2')];function createListener(_0x594fc9,_0x245dcc){return function(_0x303bea){_0x245dcc[_0xb050('0x3')](_0x594fc9,_0x303bea);};}function removeListener(_0x500de3,_0xbeb9cd){return function(){FaxAccountEvents[_0xb050('0x4')](_0x500de3,_0xbeb9cd);};}exports[_0xb050('0x5')]=function(_0x56246f){for(var _0x44a17c=0x0,_0x547d0b=events['length'];_0x44a17c<_0x547d0b;_0x44a17c++){var _0x3254d1=events[_0x44a17c];var _0x2c5e75=createListener(_0xb050('0x6')+_0x3254d1,_0x56246f);FaxAccountEvents['on'](_0x3254d1,_0x2c5e75);}}; \ No newline at end of file +var _0x4044=['emit','removeListener','register','length','faxAccount:','save','update'];(function(_0x13db91,_0x1abc8c){var _0x508b3f=function(_0x594c94){while(--_0x594c94){_0x13db91['push'](_0x13db91['shift']());}};_0x508b3f(++_0x1abc8c);}(_0x4044,0x186));var _0x4404=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x4044[_0x502c7d];return _0x30b7ed;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x4404('0x0'),'remove',_0x4404('0x1')];function createListener(_0x1f37d7,_0x361886){return function(_0x2ade2f){_0x361886[_0x4404('0x2')](_0x1f37d7,_0x2ade2f);};}function removeListener(_0x2a0ed2,_0x3e57f3){return function(){FaxAccountEvents[_0x4404('0x3')](_0x2a0ed2,_0x3e57f3);};}exports[_0x4404('0x4')]=function(_0x3f01bd){for(var _0x20599f=0x0,_0x3febc0=events[_0x4404('0x5')];_0x20599f<_0x3febc0;_0x20599f++){var _0x3ebbbf=events[_0x20599f];var _0x303858=createListener(_0x4404('0x6')+_0x3ebbbf,_0x3f01bd);FaxAccountEvents['on'](_0x3ebbbf,_0x303858);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index df8592b..8a970d2 100644 --- a/server/api/faxAccount/index.js +++ b/server/api/faxAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x26ff84,_0x55f92d){var _0x585e43=function(_0xd59974){while(--_0xd59974){_0x26ff84['push'](_0x26ff84['shift']());}};_0x585e43(++_0x55f92d);}(_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 fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x570a66,_0x399546){var _0x16a9aa=function(_0x264cb8){while(--_0x264cb8){_0x570a66['push'](_0x570a66['shift']());}};_0x16a9aa(++_0x399546);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index c701b83..26839f3 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 _0xcb39=['*,*,*,*','sequelize','exports','INTEGER','TEXT','STRING'];(function(_0x188411,_0x4c22ee){var _0x559d6e=function(_0x47b153){while(--_0x47b153){_0x188411['push'](_0x188411['shift']());}};_0x559d6e(++_0x4c22ee);}(_0xcb39,0x1b1));var _0x9cb3=function(_0xec33d0,_0x3452c9){_0xec33d0=_0xec33d0-0x0;var _0x1e01bb=_0xcb39[_0xec33d0];return _0x1e01bb;};'use strict';var Sequelize=require(_0x9cb3('0x0'));module[_0x9cb3('0x1')]={'priority':{'type':Sequelize[_0x9cb3('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x9cb3('0x3')]()},'description':{'type':Sequelize[_0x9cb3('0x4')]},'interval':{'type':Sequelize[_0x9cb3('0x4')],'defaultValue':_0x9cb3('0x5')}}; \ No newline at end of file +var _0x5a39=['TEXT','STRING','*,*,*,*','sequelize','noop'];(function(_0x199c03,_0x3254aa){var _0x11a7d4=function(_0x49e1da){while(--_0x49e1da){_0x199c03['push'](_0x199c03['shift']());}};_0x11a7d4(++_0x3254aa);}(_0x5a39,0x1b6));var _0x95a3=function(_0x2bd0db,_0x1509b8){_0x2bd0db=_0x2bd0db-0x0;var _0x5dafba=_0x5a39[_0x2bd0db];return _0x5dafba;};'use strict';var Sequelize=require(_0x95a3('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x95a3('0x1')},'appdata':{'type':Sequelize[_0x95a3('0x2')]()},'description':{'type':Sequelize[_0x95a3('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x95a3('0x4')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 60db884..39bff8a 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 _0xc261=['sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch','show','params','FaxApplication','rawAttributes','include','find','create','body','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x272588,_0x5af04f){var _0x4cdb44=function(_0x4a7595){while(--_0x4a7595){_0x272588['push'](_0x272588['shift']());}};_0x4cdb44(++_0x5af04f);}(_0xc261,0x83));var _0x1c26=function(_0x12777b,_0x459822){_0x12777b=_0x12777b-0x0;var _0x45b0aa=_0xc261[_0x12777b];return _0x45b0aa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1c26('0x0'));var zipdir=require(_0x1c26('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1c26('0x2'));var moment=require(_0x1c26('0x3'));var BPromise=require(_0x1c26('0x4'));var Mustache=require(_0x1c26('0x5'));var util=require('util');var path=require(_0x1c26('0x6'));var sox=require(_0x1c26('0x7'));var csv=require(_0x1c26('0x8'));var ejs=require(_0x1c26('0x9'));var fs=require('fs');var fs_extra=require(_0x1c26('0xa'));var _=require(_0x1c26('0xb'));var squel=require(_0x1c26('0xc'));var crypto=require(_0x1c26('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1c26('0x8'));var querystring=require(_0x1c26('0xe'));var Papa=require(_0x1c26('0xf'));var Redis=require(_0x1c26('0x10'));var authService=require(_0x1c26('0x11'));var qs=require(_0x1c26('0x12'));var as=require(_0x1c26('0x13'));var hardwareService=require(_0x1c26('0x14'));var logger=require(_0x1c26('0x15'))('api');var utils=require(_0x1c26('0x16'));var config=require(_0x1c26('0x17'));var licenseUtil=require(_0x1c26('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25c41e,_0x5dafa8){_0x5dafa8=_0x5dafa8||0xcc;return function(_0x447b59){if(_0x447b59){return _0x25c41e[_0x1c26('0x19')](_0x5dafa8);}return _0x25c41e[_0x1c26('0x1a')](_0x5dafa8)[_0x1c26('0x1b')]();};}function respondWithResult(_0x505c40,_0x3eea0f){_0x3eea0f=_0x3eea0f||0xc8;return function(_0xc15806){if(_0xc15806){return _0x505c40[_0x1c26('0x1a')](_0x3eea0f)[_0x1c26('0x1c')](_0xc15806);}};}function respondWithFilteredResult(_0x25ee64,_0x10c006){return function(_0xc120c3){if(_0xc120c3){var _0x114756=typeof _0x10c006[_0x1c26('0x1d')]===_0x1c26('0x1e')&&typeof _0x10c006[_0x1c26('0x1f')]===_0x1c26('0x1e');var _0x53c7f0=_0xc120c3['count'];var _0x210ff0=_0x114756?0x0:_0x10c006['offset'];var _0x3a7aef=_0x114756?_0xc120c3[_0x1c26('0x20')]:_0x10c006[_0x1c26('0x1d')]+_0x10c006[_0x1c26('0x1f')];var _0x1faa6c;if(_0x3a7aef>=_0x53c7f0){_0x3a7aef=_0x53c7f0;_0x1faa6c=0xc8;}else{_0x1faa6c=0xce;}_0x25ee64[_0x1c26('0x1a')](_0x1faa6c);return _0x25ee64['set'](_0x1c26('0x21'),_0x210ff0+'-'+_0x3a7aef+'/'+_0x53c7f0)[_0x1c26('0x1c')](_0xc120c3);}return null;};}function patchUpdates(_0x1fa690){return function(_0xb8f081){try{jsonpatch[_0x1c26('0x22')](_0xb8f081,_0x1fa690,!![]);}catch(_0x4791ae){return BPromise[_0x1c26('0x23')](_0x4791ae);}return _0xb8f081[_0x1c26('0x24')]();};}function saveUpdates(_0x14d090,_0x3570b7){return function(_0x461a5e){if(_0x461a5e){return _0x461a5e[_0x1c26('0x25')](_0x14d090)[_0x1c26('0x26')](function(_0x1c02c9){return _0x1c02c9;});}return null;};}function removeEntity(_0x4b6026,_0x5905af){return function(_0x91f90f){if(_0x91f90f){return _0x91f90f[_0x1c26('0x27')]()[_0x1c26('0x26')](function(){_0x4b6026['status'](0xcc)[_0x1c26('0x1b')]();});}};}function handleEntityNotFound(_0x55066b,_0x27ede5){return function(_0x479b87){if(!_0x479b87){_0x55066b[_0x1c26('0x19')](0x194);}return _0x479b87;};}function handleError(_0xcf2a3,_0x2fd8de){_0x2fd8de=_0x2fd8de||0x1f4;return function(_0x369424){logger[_0x1c26('0x28')](_0x369424[_0x1c26('0x29')]);if(_0x369424[_0x1c26('0x2a')]){delete _0x369424[_0x1c26('0x2a')];}_0xcf2a3['status'](_0x2fd8de)[_0x1c26('0x2b')](_0x369424);};}exports[_0x1c26('0x2c')]=function(_0x2a1aa5,_0x281283){var _0x1eeb58={},_0x2b16d6={},_0x1ed1c6={'count':0x0,'rows':[]};var _0x2be54c=_[_0x1c26('0x2d')](db['FaxApplication']['rawAttributes'],function(_0x300169){return{'name':_0x300169[_0x1c26('0x2e')],'type':_0x300169[_0x1c26('0x2f')]['key']};});_0x2b16d6[_0x1c26('0x30')]=_[_0x1c26('0x2d')](_0x2be54c,'name');_0x2b16d6[_0x1c26('0x31')]=_[_0x1c26('0x32')](_0x2a1aa5[_0x1c26('0x31')]);_0x2b16d6[_0x1c26('0x33')]=_[_0x1c26('0x34')](_0x2b16d6['model'],_0x2b16d6[_0x1c26('0x31')]);_0x1eeb58['attributes']=_[_0x1c26('0x34')](_0x2b16d6[_0x1c26('0x30')],qs['fields'](_0x2a1aa5[_0x1c26('0x31')][_0x1c26('0x35')]));_0x1eeb58['attributes']=_0x1eeb58[_0x1c26('0x36')][_0x1c26('0x37')]?_0x1eeb58[_0x1c26('0x36')]:_0x2b16d6[_0x1c26('0x30')];if(!_0x2a1aa5['query'][_0x1c26('0x38')](_0x1c26('0x39'))){_0x1eeb58[_0x1c26('0x1f')]=qs[_0x1c26('0x1f')](_0x2a1aa5['query'][_0x1c26('0x1f')]);_0x1eeb58[_0x1c26('0x1d')]=qs[_0x1c26('0x1d')](_0x2a1aa5[_0x1c26('0x31')][_0x1c26('0x1d')]);}_0x1eeb58[_0x1c26('0x3a')]=qs['sort'](_0x2a1aa5['query'][_0x1c26('0x3b')]);_0x1eeb58[_0x1c26('0x3c')]=qs['filters'](_[_0x1c26('0x3d')](_0x2a1aa5[_0x1c26('0x31')],_0x2b16d6[_0x1c26('0x33')]),_0x2be54c);if(_0x2a1aa5[_0x1c26('0x31')]['filter']){_0x1eeb58[_0x1c26('0x3c')]=_['merge'](_0x1eeb58[_0x1c26('0x3c')],{'$or':_[_0x1c26('0x2d')](_0x2be54c,function(_0x402043){if(_0x402043['type']!==_0x1c26('0x3e')){var _0x534191={};_0x534191[_0x402043[_0x1c26('0x2a')]]={'$like':'%'+_0x2a1aa5['query'][_0x1c26('0x3f')]+'%'};return _0x534191;}})});}_0x1eeb58=_[_0x1c26('0x40')]({},_0x1eeb58,_0x2a1aa5[_0x1c26('0x41')]);var _0x295009={'where':_0x1eeb58['where']};return db['FaxApplication'][_0x1c26('0x20')](_0x295009)[_0x1c26('0x26')](function(_0x5e4a59){_0x1ed1c6[_0x1c26('0x20')]=_0x5e4a59;if(_0x2a1aa5[_0x1c26('0x31')][_0x1c26('0x42')]){_0x1eeb58['include']=[{'all':!![]}];}return db['FaxApplication'][_0x1c26('0x43')](_0x1eeb58);})['then'](function(_0x1632a3){_0x1ed1c6[_0x1c26('0x44')]=_0x1632a3;return _0x1ed1c6;})[_0x1c26('0x26')](respondWithFilteredResult(_0x281283,_0x1eeb58))[_0x1c26('0x45')](handleError(_0x281283,null));};exports[_0x1c26('0x46')]=function(_0x3bcc69,_0xc4235c){var _0x3ce133={'raw':!![],'where':{'id':_0x3bcc69[_0x1c26('0x47')]['id']}},_0x315eb2={};_0x315eb2['model']=_[_0x1c26('0x32')](db[_0x1c26('0x48')][_0x1c26('0x49')]);_0x315eb2['query']=_[_0x1c26('0x32')](_0x3bcc69['query']);_0x315eb2[_0x1c26('0x33')]=_[_0x1c26('0x34')](_0x315eb2[_0x1c26('0x30')],_0x315eb2[_0x1c26('0x31')]);_0x3ce133['attributes']=_[_0x1c26('0x34')](_0x315eb2[_0x1c26('0x30')],qs['fields'](_0x3bcc69[_0x1c26('0x31')]['fields']));_0x3ce133[_0x1c26('0x36')]=_0x3ce133[_0x1c26('0x36')][_0x1c26('0x37')]?_0x3ce133[_0x1c26('0x36')]:_0x315eb2[_0x1c26('0x30')];if(_0x3bcc69[_0x1c26('0x31')][_0x1c26('0x42')]){_0x3ce133[_0x1c26('0x4a')]=[{'all':!![]}];}_0x3ce133=_['merge']({},_0x3ce133,_0x3bcc69[_0x1c26('0x41')]);return db['FaxApplication'][_0x1c26('0x4b')](_0x3ce133)[_0x1c26('0x26')](handleEntityNotFound(_0xc4235c,null))[_0x1c26('0x26')](respondWithResult(_0xc4235c,null))['catch'](handleError(_0xc4235c,null));};exports[_0x1c26('0x4c')]=function(_0x3e8f63,_0x4fac0d){return db[_0x1c26('0x48')][_0x1c26('0x4c')](_0x3e8f63[_0x1c26('0x4d')],{})[_0x1c26('0x26')](respondWithResult(_0x4fac0d,0xc9))[_0x1c26('0x45')](handleError(_0x4fac0d,null));};exports['update']=function(_0x13d99f,_0x439aa3){if(_0x13d99f[_0x1c26('0x4d')]['id']){delete _0x13d99f[_0x1c26('0x4d')]['id'];}return db[_0x1c26('0x48')][_0x1c26('0x4b')]({'where':{'id':_0x13d99f[_0x1c26('0x47')]['id']}})[_0x1c26('0x26')](handleEntityNotFound(_0x439aa3,null))['then'](saveUpdates(_0x13d99f[_0x1c26('0x4d')],null))['then'](respondWithResult(_0x439aa3,null))[_0x1c26('0x45')](handleError(_0x439aa3,null));};exports[_0x1c26('0x27')]=function(_0x43339b,_0x58223b){return db['FaxApplication'][_0x1c26('0x4b')]({'where':{'id':_0x43339b[_0x1c26('0x47')]['id']}})['then'](handleEntityNotFound(_0x58223b,null))[_0x1c26('0x26')](removeEntity(_0x58223b,null))[_0x1c26('0x45')](handleError(_0x58223b,null));}; \ No newline at end of file +var _0xc883=['includeAll','options','create','body','find','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','limit','offset','set','apply','update','then','error','stack','name','send','index','FaxApplication','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','filter','merge','type','VIRTUAL','count','include','findAll','rows','catch','show','params','keys'];(function(_0x428e6f,_0x265edf){var _0x4c6fa0=function(_0x17a4d1){while(--_0x17a4d1){_0x428e6f['push'](_0x428e6f['shift']());}};_0x4c6fa0(++_0x265edf);}(_0xc883,0x178));var _0x3c88=function(_0x35f5bb,_0x354149){_0x35f5bb=_0x35f5bb-0x0;var _0xf8d19e=_0xc883[_0x35f5bb];return _0xf8d19e;};'use strict';var emlformat=require(_0x3c88('0x0'));var rimraf=require(_0x3c88('0x1'));var zipdir=require(_0x3c88('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3c88('0x3'));var moment=require(_0x3c88('0x4'));var BPromise=require(_0x3c88('0x5'));var Mustache=require(_0x3c88('0x6'));var util=require(_0x3c88('0x7'));var path=require('path');var sox=require(_0x3c88('0x8'));var csv=require(_0x3c88('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3c88('0xa'));var _=require(_0x3c88('0xb'));var squel=require('squel');var crypto=require(_0x3c88('0xc'));var jsforce=require(_0x3c88('0xd'));var deskjs=require(_0x3c88('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3c88('0xf'));var Papa=require(_0x3c88('0x10'));var Redis=require('ioredis');var authService=require(_0x3c88('0x11'));var qs=require(_0x3c88('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3c88('0x13'));var logger=require(_0x3c88('0x14'))(_0x3c88('0x15'));var utils=require(_0x3c88('0x16'));var config=require(_0x3c88('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1218c9,_0x3df3d0){_0x3df3d0=_0x3df3d0||0xcc;return function(_0x737f63){if(_0x737f63){return _0x1218c9[_0x3c88('0x18')](_0x3df3d0);}return _0x1218c9[_0x3c88('0x19')](_0x3df3d0)[_0x3c88('0x1a')]();};}function respondWithResult(_0x3bb890,_0x3120d7){_0x3120d7=_0x3120d7||0xc8;return function(_0x3c13b8){if(_0x3c13b8){return _0x3bb890[_0x3c88('0x19')](_0x3120d7)[_0x3c88('0x1b')](_0x3c13b8);}};}function respondWithFilteredResult(_0x36d941,_0x57323e){return function(_0x3ed849){if(_0x3ed849){var _0x39d0e8=typeof _0x57323e['offset']===_0x3c88('0x1c')&&typeof _0x57323e[_0x3c88('0x1d')]==='undefined';var _0x591190=_0x3ed849['count'];var _0x30bce1=_0x39d0e8?0x0:_0x57323e[_0x3c88('0x1e')];var _0x583754=_0x39d0e8?_0x3ed849['count']:_0x57323e['offset']+_0x57323e[_0x3c88('0x1d')];var _0x1d9196;if(_0x583754>=_0x591190){_0x583754=_0x591190;_0x1d9196=0xc8;}else{_0x1d9196=0xce;}_0x36d941['status'](_0x1d9196);return _0x36d941[_0x3c88('0x1f')]('Content-Range',_0x30bce1+'-'+_0x583754+'/'+_0x591190)[_0x3c88('0x1b')](_0x3ed849);}return null;};}function patchUpdates(_0x254a16){return function(_0x2216d1){try{jsonpatch[_0x3c88('0x20')](_0x2216d1,_0x254a16,!![]);}catch(_0x2dfedb){return BPromise['reject'](_0x2dfedb);}return _0x2216d1['save']();};}function saveUpdates(_0x3f6660,_0x4699e8){return function(_0x3b9666){if(_0x3b9666){return _0x3b9666[_0x3c88('0x21')](_0x3f6660)['then'](function(_0x4a2ba0){return _0x4a2ba0;});}return null;};}function removeEntity(_0x1ca01d,_0x1651c9){return function(_0xca0c68){if(_0xca0c68){return _0xca0c68['destroy']()[_0x3c88('0x22')](function(){_0x1ca01d[_0x3c88('0x19')](0xcc)[_0x3c88('0x1a')]();});}};}function handleEntityNotFound(_0x12f69f,_0xd7b8a9){return function(_0x58b76d){if(!_0x58b76d){_0x12f69f[_0x3c88('0x18')](0x194);}return _0x58b76d;};}function handleError(_0x32fad2,_0x24f524){_0x24f524=_0x24f524||0x1f4;return function(_0x4e0be2){logger[_0x3c88('0x23')](_0x4e0be2[_0x3c88('0x24')]);if(_0x4e0be2[_0x3c88('0x25')]){delete _0x4e0be2[_0x3c88('0x25')];}_0x32fad2['status'](_0x24f524)[_0x3c88('0x26')](_0x4e0be2);};}exports[_0x3c88('0x27')]=function(_0x37cf1e,_0x39a230){var _0x8cc036={},_0x175af6={},_0x559963={'count':0x0,'rows':[]};var _0x523084=_['map'](db[_0x3c88('0x28')][_0x3c88('0x29')],function(_0x276a6a){return{'name':_0x276a6a[_0x3c88('0x2a')],'type':_0x276a6a['type'][_0x3c88('0x2b')]};});_0x175af6[_0x3c88('0x2c')]=_[_0x3c88('0x2d')](_0x523084,_0x3c88('0x25'));_0x175af6[_0x3c88('0x2e')]=_['keys'](_0x37cf1e[_0x3c88('0x2e')]);_0x175af6[_0x3c88('0x2f')]=_[_0x3c88('0x30')](_0x175af6[_0x3c88('0x2c')],_0x175af6[_0x3c88('0x2e')]);_0x8cc036[_0x3c88('0x31')]=_[_0x3c88('0x30')](_0x175af6['model'],qs[_0x3c88('0x32')](_0x37cf1e[_0x3c88('0x2e')]['fields']));_0x8cc036['attributes']=_0x8cc036[_0x3c88('0x31')][_0x3c88('0x33')]?_0x8cc036[_0x3c88('0x31')]:_0x175af6[_0x3c88('0x2c')];if(!_0x37cf1e[_0x3c88('0x2e')][_0x3c88('0x34')]('nolimit')){_0x8cc036[_0x3c88('0x1d')]=qs[_0x3c88('0x1d')](_0x37cf1e[_0x3c88('0x2e')][_0x3c88('0x1d')]);_0x8cc036[_0x3c88('0x1e')]=qs[_0x3c88('0x1e')](_0x37cf1e['query']['offset']);}_0x8cc036[_0x3c88('0x35')]=qs['sort'](_0x37cf1e[_0x3c88('0x2e')]['sort']);_0x8cc036[_0x3c88('0x36')]=qs[_0x3c88('0x2f')](_[_0x3c88('0x37')](_0x37cf1e[_0x3c88('0x2e')],_0x175af6[_0x3c88('0x2f')]),_0x523084);if(_0x37cf1e[_0x3c88('0x2e')][_0x3c88('0x38')]){_0x8cc036[_0x3c88('0x36')]=_[_0x3c88('0x39')](_0x8cc036['where'],{'$or':_[_0x3c88('0x2d')](_0x523084,function(_0x16d8b8){if(_0x16d8b8[_0x3c88('0x3a')]!==_0x3c88('0x3b')){var _0x75714e={};_0x75714e[_0x16d8b8[_0x3c88('0x25')]]={'$like':'%'+_0x37cf1e[_0x3c88('0x2e')][_0x3c88('0x38')]+'%'};return _0x75714e;}})});}_0x8cc036=_[_0x3c88('0x39')]({},_0x8cc036,_0x37cf1e['options']);var _0x5a8948={'where':_0x8cc036[_0x3c88('0x36')]};return db['FaxApplication'][_0x3c88('0x3c')](_0x5a8948)[_0x3c88('0x22')](function(_0x1f92c5){_0x559963['count']=_0x1f92c5;if(_0x37cf1e['query']['includeAll']){_0x8cc036[_0x3c88('0x3d')]=[{'all':!![]}];}return db[_0x3c88('0x28')][_0x3c88('0x3e')](_0x8cc036);})['then'](function(_0x461c12){_0x559963[_0x3c88('0x3f')]=_0x461c12;return _0x559963;})['then'](respondWithFilteredResult(_0x39a230,_0x8cc036))[_0x3c88('0x40')](handleError(_0x39a230,null));};exports[_0x3c88('0x41')]=function(_0x2180fe,_0x4607ad){var _0x498d51={'raw':!![],'where':{'id':_0x2180fe[_0x3c88('0x42')]['id']}},_0x2bed34={};_0x2bed34[_0x3c88('0x2c')]=_[_0x3c88('0x43')](db[_0x3c88('0x28')]['rawAttributes']);_0x2bed34[_0x3c88('0x2e')]=_[_0x3c88('0x43')](_0x2180fe[_0x3c88('0x2e')]);_0x2bed34[_0x3c88('0x2f')]=_['intersection'](_0x2bed34[_0x3c88('0x2c')],_0x2bed34['query']);_0x498d51[_0x3c88('0x31')]=_['intersection'](_0x2bed34[_0x3c88('0x2c')],qs['fields'](_0x2180fe['query'][_0x3c88('0x32')]));_0x498d51['attributes']=_0x498d51[_0x3c88('0x31')][_0x3c88('0x33')]?_0x498d51['attributes']:_0x2bed34[_0x3c88('0x2c')];if(_0x2180fe[_0x3c88('0x2e')][_0x3c88('0x44')]){_0x498d51[_0x3c88('0x3d')]=[{'all':!![]}];}_0x498d51=_[_0x3c88('0x39')]({},_0x498d51,_0x2180fe[_0x3c88('0x45')]);return db[_0x3c88('0x28')]['find'](_0x498d51)[_0x3c88('0x22')](handleEntityNotFound(_0x4607ad,null))[_0x3c88('0x22')](respondWithResult(_0x4607ad,null))[_0x3c88('0x40')](handleError(_0x4607ad,null));};exports[_0x3c88('0x46')]=function(_0x59b577,_0x315371){return db['FaxApplication'][_0x3c88('0x46')](_0x59b577['body'],{})[_0x3c88('0x22')](respondWithResult(_0x315371,0xc9))[_0x3c88('0x40')](handleError(_0x315371,null));};exports['update']=function(_0x5d9e96,_0x18d964){if(_0x5d9e96[_0x3c88('0x47')]['id']){delete _0x5d9e96['body']['id'];}return db[_0x3c88('0x28')][_0x3c88('0x48')]({'where':{'id':_0x5d9e96[_0x3c88('0x42')]['id']}})[_0x3c88('0x22')](handleEntityNotFound(_0x18d964,null))['then'](saveUpdates(_0x5d9e96[_0x3c88('0x47')],null))[_0x3c88('0x22')](respondWithResult(_0x18d964,null))['catch'](handleError(_0x18d964,null));};exports[_0x3c88('0x49')]=function(_0x49f8dc,_0x3b0608){return db[_0x3c88('0x28')]['find']({'where':{'id':_0x49f8dc[_0x3c88('0x42')]['id']}})[_0x3c88('0x22')](handleEntityNotFound(_0x3b0608,null))[_0x3c88('0x22')](removeEntity(_0x3b0608,null))['catch'](handleError(_0x3b0608,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index dc48933..c926dd8 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 _0xbb3a=['bluebird','path','../../config/environment','exports','define','FaxApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment'];(function(_0x53f4ac,_0x564abe){var _0x5c5ccd=function(_0xd9ae1a){while(--_0xd9ae1a){_0x53f4ac['push'](_0x53f4ac['shift']());}};_0x5c5ccd(++_0x564abe);}(_0xbb3a,0x110));var _0xabb3=function(_0x32bf49,_0xb28946){_0x32bf49=_0x32bf49-0x0;var _0x15f90f=_0xbb3a[_0x32bf49];return _0x15f90f;};'use strict';var _=require(_0xabb3('0x0'));var util=require(_0xabb3('0x1'));var logger=require('../../config/logger')(_0xabb3('0x2'));var moment=require(_0xabb3('0x3'));var BPromise=require(_0xabb3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xabb3('0x5'));var rimraf=require('rimraf');var config=require(_0xabb3('0x6'));var attributes=require('./faxApplication.attributes');module[_0xabb3('0x7')]=function(_0x3585d1,_0x288da5){return _0x3585d1[_0xabb3('0x8')](_0xabb3('0x9'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xabb3('0xa'),'collate':_0xabb3('0xb')});}; \ No newline at end of file +var _0xf7f7=['./faxApplication.attributes','exports','FaxApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0xf3fcd2,_0x167784){var _0x2af4f8=function(_0x941a4a){while(--_0x941a4a){_0xf3fcd2['push'](_0xf3fcd2['shift']());}};_0x2af4f8(++_0x167784);}(_0xf7f7,0xad));var _0x7f7f=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xf7f7[_0x1cfa0d];return _0xe33279;};'use strict';var _=require(_0x7f7f('0x0'));var util=require(_0x7f7f('0x1'));var logger=require('../../config/logger')(_0x7f7f('0x2'));var moment=require('moment');var BPromise=require(_0x7f7f('0x3'));var rp=require(_0x7f7f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7f7f('0x5'));var config=require(_0x7f7f('0x6'));var attributes=require(_0x7f7f('0x7'));module[_0x7f7f('0x8')]=function(_0x40460b,_0x1d0677){return _0x40460b['define'](_0x7f7f('0x9'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7f7f('0xa'),'collate':_0x7f7f('0xb')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 165e017..77337dd 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 _0x6ce8=['moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateFaxApplication','update','body','options','where','attributes','debug','stringify','lodash'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x6ce8,0x13e));var _0x86ce=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0x6ce8[_0x88cd7b];return _0x56fcc8;};'use strict';var _=require(_0x86ce('0x0'));var util=require('util');var moment=require(_0x86ce('0x1'));var BPromise=require('bluebird');var rs=require(_0x86ce('0x2'));var fs=require('fs');var Redis=require(_0x86ce('0x3'));var db=require(_0x86ce('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x86ce('0x5'))(_0x86ce('0x6'));var config=require(_0x86ce('0x7'));var jayson=require(_0x86ce('0x8'));var client=jayson[_0x86ce('0x9')][_0x86ce('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28d407,_0x40766c,_0x453ff4){return new BPromise(function(_0xfc6cae,_0x13bf81){return client['request'](_0x28d407,_0x453ff4)[_0x86ce('0xb')](function(_0x1acb99){logger[_0x86ce('0xc')](_0x86ce('0xd'),_0x40766c,_0x86ce('0xe'));logger['debug'](_0x86ce('0xf'),_0x40766c,_0x86ce('0xe'),JSON['stringify'](_0x1acb99));if(_0x1acb99[_0x86ce('0x10')]){if(_0x1acb99[_0x86ce('0x10')][_0x86ce('0x11')]===0x1f4){logger[_0x86ce('0x10')](_0x86ce('0xd'),_0x40766c,_0x1acb99[_0x86ce('0x10')][_0x86ce('0x12')]);return _0x13bf81(_0x1acb99['error'][_0x86ce('0x12')]);}logger[_0x86ce('0x10')](_0x86ce('0xd'),_0x40766c,_0x1acb99[_0x86ce('0x10')][_0x86ce('0x12')]);return _0xfc6cae(_0x1acb99[_0x86ce('0x10')]['message']);}else{logger[_0x86ce('0xc')](_0x86ce('0xd'),_0x40766c,_0x86ce('0xe'));_0xfc6cae(_0x1acb99[_0x86ce('0x13')][_0x86ce('0x12')]);}})[_0x86ce('0x14')](function(_0x556525){logger[_0x86ce('0x10')]('FaxApplication,\x20%s,\x20%s',_0x40766c,_0x556525);_0x13bf81(_0x556525);});});}exports[_0x86ce('0x15')]=function(_0x46229f){var _0x5033b2=this;return new Promise(function(_0x9f3765,_0x65e030){return db['FaxApplication'][_0x86ce('0x16')](_0x46229f[_0x86ce('0x17')],{'raw':_0x46229f['options']?_0x46229f[_0x86ce('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46229f[_0x86ce('0x18')]?_0x46229f['options'][_0x86ce('0x19')]||null:null,'attributes':_0x46229f[_0x86ce('0x18')]?_0x46229f['options'][_0x86ce('0x1a')]||null:null,'limit':_0x46229f['options']?_0x46229f[_0x86ce('0x18')]['limit']||null:null})['then'](function(_0x33be86){logger[_0x86ce('0xc')](_0x86ce('0x15'),_0x46229f);logger[_0x86ce('0x1b')](_0x86ce('0x15'),_0x46229f,JSON[_0x86ce('0x1c')](_0x33be86));_0x9f3765(_0x33be86);})[_0x86ce('0x14')](function(_0x429b0d){logger[_0x86ce('0x10')]('UpdateFaxApplication',_0x429b0d[_0x86ce('0x12')],_0x46229f);_0x65e030(_0x5033b2[_0x86ce('0x10')](0x1f4,_0x429b0d[_0x86ce('0x12')]));});});}; \ No newline at end of file +var _0xa888=['where','attributes','limit','UpdateFaxApplication','stringify','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','FaxApplication','update','body','options','raw'];(function(_0x4ed4d2,_0x47acf7){var _0x15ae2e=function(_0x3199f0){while(--_0x3199f0){_0x4ed4d2['push'](_0x4ed4d2['shift']());}};_0x15ae2e(++_0x47acf7);}(_0xa888,0x89));var _0x8a88=function(_0x4f153a,_0x3281ee){_0x4f153a=_0x4f153a-0x0;var _0x383e58=_0xa888[_0x4f153a];return _0x383e58;};'use strict';var _=require('lodash');var util=require(_0x8a88('0x0'));var moment=require(_0x8a88('0x1'));var BPromise=require(_0x8a88('0x2'));var rs=require(_0x8a88('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8a88('0x4'))['db'];var utils=require(_0x8a88('0x5'));var logger=require(_0x8a88('0x6'))('rpc');var config=require(_0x8a88('0x7'));var jayson=require(_0x8a88('0x8'));var client=jayson[_0x8a88('0x9')][_0x8a88('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b6697,_0x4afc47,_0x3be2a1){return new BPromise(function(_0x26a3e0,_0x4a2906){return client[_0x8a88('0xb')](_0x4b6697,_0x3be2a1)[_0x8a88('0xc')](function(_0x1785df){logger['info'](_0x8a88('0xd'),_0x4afc47,_0x8a88('0xe'));logger[_0x8a88('0xf')](_0x8a88('0x10'),_0x4afc47,_0x8a88('0xe'),JSON['stringify'](_0x1785df));if(_0x1785df[_0x8a88('0x11')]){if(_0x1785df[_0x8a88('0x11')][_0x8a88('0x12')]===0x1f4){logger[_0x8a88('0x11')](_0x8a88('0xd'),_0x4afc47,_0x1785df['error'][_0x8a88('0x13')]);return _0x4a2906(_0x1785df[_0x8a88('0x11')][_0x8a88('0x13')]);}logger['error'](_0x8a88('0xd'),_0x4afc47,_0x1785df[_0x8a88('0x11')][_0x8a88('0x13')]);return _0x26a3e0(_0x1785df['error'][_0x8a88('0x13')]);}else{logger[_0x8a88('0x14')](_0x8a88('0xd'),_0x4afc47,_0x8a88('0xe'));_0x26a3e0(_0x1785df[_0x8a88('0x15')][_0x8a88('0x13')]);}})[_0x8a88('0x16')](function(_0x45388a){logger[_0x8a88('0x11')]('FaxApplication,\x20%s,\x20%s',_0x4afc47,_0x45388a);_0x4a2906(_0x45388a);});});}exports['UpdateFaxApplication']=function(_0x51f5a2){var _0x14985a=this;return new Promise(function(_0x3ab964,_0x4e092a){return db[_0x8a88('0x17')][_0x8a88('0x18')](_0x51f5a2[_0x8a88('0x19')],{'raw':_0x51f5a2[_0x8a88('0x1a')]?_0x51f5a2[_0x8a88('0x1a')][_0x8a88('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51f5a2[_0x8a88('0x1a')]?_0x51f5a2[_0x8a88('0x1a')][_0x8a88('0x1c')]||null:null,'attributes':_0x51f5a2[_0x8a88('0x1a')]?_0x51f5a2['options'][_0x8a88('0x1d')]||null:null,'limit':_0x51f5a2[_0x8a88('0x1a')]?_0x51f5a2[_0x8a88('0x1a')][_0x8a88('0x1e')]||null:null})[_0x8a88('0xc')](function(_0x43b6f8){logger[_0x8a88('0x14')](_0x8a88('0x1f'),_0x51f5a2);logger['debug'](_0x8a88('0x1f'),_0x51f5a2,JSON[_0x8a88('0x20')](_0x43b6f8));_0x3ab964(_0x43b6f8);})[_0x8a88('0x16')](function(_0x913f90){logger[_0x8a88('0x11')]('UpdateFaxApplication',_0x913f90[_0x8a88('0x13')],_0x51f5a2);_0x4e092a(_0x14985a['error'](0x1f4,_0x913f90[_0x8a88('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 49f01bd..dad38aa 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 _0x6324=['util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','update','delete','/:id','destroy','exports','multer'];(function(_0x5e9886,_0x4e82ec){var _0x114dc8=function(_0x5a0466){while(--_0x5a0466){_0x5e9886['push'](_0x5e9886['shift']());}};_0x114dc8(++_0x4e82ec);}(_0x6324,0x142));var _0x4632=function(_0x49d931,_0x121258){_0x49d931=_0x49d931-0x0;var _0x491a2a=_0x6324[_0x49d931];return _0x491a2a;};'use strict';var multer=require(_0x4632('0x0'));var util=require(_0x4632('0x1'));var path=require(_0x4632('0x2'));var timeout=require(_0x4632('0x3'));var express=require('express');var router=express[_0x4632('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4632('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4632('0x6'));var controller=require('./faxApplication.controller');router[_0x4632('0x7')]('/',auth[_0x4632('0x8')](),controller[_0x4632('0x9')]);router[_0x4632('0x7')]('/:id',auth[_0x4632('0x8')](),controller[_0x4632('0xa')]);router[_0x4632('0xb')]('/',auth['isAuthenticated'](),controller[_0x4632('0xc')]);router[_0x4632('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x4632('0xe')]);router[_0x4632('0xf')](_0x4632('0x10'),auth[_0x4632('0x8')](),controller[_0x4632('0x11')]);module[_0x4632('0x12')]=router; \ No newline at end of file +var _0xe511=['/:id','isAuthenticated','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','index','show','post','put'];(function(_0x4fd38a,_0x37c5ed){var _0x5bb98f=function(_0x43a37b){while(--_0x43a37b){_0x4fd38a['push'](_0x4fd38a['shift']());}};_0x5bb98f(++_0x37c5ed);}(_0xe511,0x16f));var _0x1e51=function(_0x29c3b2,_0x3c12ac){_0x29c3b2=_0x29c3b2-0x0;var _0x4b3aa7=_0xe511[_0x29c3b2];return _0x4b3aa7;};'use strict';var multer=require(_0x1e51('0x0'));var util=require(_0x1e51('0x1'));var path=require('path');var timeout=require(_0x1e51('0x2'));var express=require('express');var router=express[_0x1e51('0x3')]();var fs_extra=require(_0x1e51('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1e51('0x5'));var config=require(_0x1e51('0x6'));var controller=require(_0x1e51('0x7'));router[_0x1e51('0x8')]('/',auth['isAuthenticated'](),controller[_0x1e51('0x9')]);router[_0x1e51('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x1e51('0xa')]);router[_0x1e51('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1e51('0xc')](_0x1e51('0xd'),auth[_0x1e51('0xe')](),controller[_0x1e51('0xf')]);router[_0x1e51('0x10')](_0x1e51('0xd'),auth['isAuthenticated'](),controller[_0x1e51('0x11')]);module[_0x1e51('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 2e6db53..0977991 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 _0x9813=['out','sequelize','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x9813,0x112));var _0x3981=function(_0x3889aa,_0xe4f9f2){_0x3889aa=_0x3889aa-0x0;var _0x17e467=_0x9813[_0x3889aa];return _0x17e467;};'use strict';var Sequelize=require(_0x3981('0x0'));module[_0x3981('0x1')]={'closed':{'type':Sequelize[_0x3981('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3981('0x3')]},'disposition':{'type':Sequelize[_0x3981('0x4')]},'secondDisposition':{'type':Sequelize[_0x3981('0x4')]},'thirdDisposition':{'type':Sequelize[_0x3981('0x4')]},'note':{'type':Sequelize[_0x3981('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x3981('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x3981('0x5')]('in',_0x3981('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3981('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x3981('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x940b=['DATE','STRING','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x18f0ca,_0x3076ab){var _0x51d26b=function(_0x5f139e){while(--_0x5f139e){_0x18f0ca['push'](_0x18f0ca['shift']());}};_0x51d26b(++_0x3076ab);}(_0x940b,0x1d2));var _0xb940=function(_0x35b57f,_0x53ada0){_0x35b57f=_0x35b57f-0x0;var _0x382791=_0x940b[_0x35b57f];return _0x382791;};'use strict';var Sequelize=require(_0xb940('0x0'));module[_0xb940('0x1')]={'closed':{'type':Sequelize[_0xb940('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb940('0x3')]},'disposition':{'type':Sequelize[_0xb940('0x4')]},'secondDisposition':{'type':Sequelize[_0xb940('0x4')]},'thirdDisposition':{'type':Sequelize[_0xb940('0x4')]},'note':{'type':Sequelize[_0xb940('0x4')]},'read1stAt':{'type':Sequelize[_0xb940('0x3')]},'fax':{'type':Sequelize[_0xb940('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xb940('0x5')]('in',_0xb940('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xb940('0x5')]('in','out'),'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 35d3332..f9a5942 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 _0x9877=['fullname','TagIds','Tags','split','push','index','FaxInteraction','rawAttributes','fieldName','type','model','keys','attributes','intersection','query','hasOwnProperty','nolimit','order','sort','where','filters','pick','select','field','color','from','tools_tags','u.fullname','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','find','unreadMessages','value','having','`\x20=\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','forEach','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','contactName','DESC','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','show','params','fields','includeAll','include','options','create','catch','describe','FaxMessage','ids','omit','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','Tag','emit','faxInteractionTags:save','removeTags','unix','root','server','files','tmp','join','transcript-%d-%s.zip','Attachment','Messages','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','download','log','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','redis','defaults','localhost','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','Users','map'];(function(_0x595f71,_0x3b37d6){var _0x448a13=function(_0x38a7d8){while(--_0x38a7d8){_0x595f71['push'](_0x595f71['shift']());}};_0x448a13(++_0x3b37d6);}(_0x9877,0x189));var _0x7987=function(_0x139473,_0xdf087){_0x139473=_0x139473-0x0;var _0x5af61e=_0x9877[_0x139473];return _0x5af61e;};'use strict';var emlformat=require(_0x7987('0x0'));var rimraf=require(_0x7987('0x1'));var zipdir=require(_0x7987('0x2'));var jsonpatch=require(_0x7987('0x3'));var rp=require(_0x7987('0x4'));var moment=require(_0x7987('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7987('0x6'));var util=require(_0x7987('0x7'));var path=require(_0x7987('0x8'));var sox=require(_0x7987('0x9'));var csv=require(_0x7987('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7987('0xb'));var _=require('lodash');var squel=require(_0x7987('0xc'));var crypto=require(_0x7987('0xd'));var jsforce=require(_0x7987('0xe'));var deskjs=require(_0x7987('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7987('0x10'));var as=require(_0x7987('0x11'));var hardwareService=require(_0x7987('0x12'));var logger=require('../../config/logger')(_0x7987('0x13'));var utils=require(_0x7987('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x7987('0x15')]=_[_0x7987('0x16')](config[_0x7987('0x15')],{'host':_0x7987('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7987('0x15')]));require('./faxInteraction.socket')[_0x7987('0x18')](socket);function respondWithStatusCode(_0x510ce9,_0x234760){_0x234760=_0x234760||0xcc;return function(_0x562866){if(_0x562866){return _0x510ce9[_0x7987('0x19')](_0x234760);}return _0x510ce9[_0x7987('0x1a')](_0x234760)[_0x7987('0x1b')]();};}function respondWithResult(_0x579945,_0x4160f9){_0x4160f9=_0x4160f9||0xc8;return function(_0x356a3d){if(_0x356a3d){return _0x579945['status'](_0x4160f9)[_0x7987('0x1c')](_0x356a3d);}};}function respondWithFilteredResult(_0x40ae5c,_0x1a236f){return function(_0x12c775){if(_0x12c775){var _0x3aba30=typeof _0x1a236f[_0x7987('0x1d')]===_0x7987('0x1e')&&typeof _0x1a236f[_0x7987('0x1f')]===_0x7987('0x1e');var _0x3ce7a0=_0x12c775[_0x7987('0x20')];var _0x551c99=_0x3aba30?0x0:_0x1a236f[_0x7987('0x1d')];var _0x341e9e=_0x3aba30?_0x12c775[_0x7987('0x20')]:_0x1a236f[_0x7987('0x1d')]+_0x1a236f[_0x7987('0x1f')];var _0x57e7bd;if(_0x341e9e>=_0x3ce7a0){_0x341e9e=_0x3ce7a0;_0x57e7bd=0xc8;}else{_0x57e7bd=0xce;}_0x40ae5c[_0x7987('0x1a')](_0x57e7bd);return _0x40ae5c[_0x7987('0x21')](_0x7987('0x22'),_0x551c99+'-'+_0x341e9e+'/'+_0x3ce7a0)[_0x7987('0x1c')](_0x12c775);}return null;};}function patchUpdates(_0x189f30){return function(_0x49d9c9){try{jsonpatch[_0x7987('0x23')](_0x49d9c9,_0x189f30,!![]);}catch(_0x3d333d){return BPromise[_0x7987('0x24')](_0x3d333d);}return _0x49d9c9[_0x7987('0x25')]();};}function saveUpdates(_0x5813fd,_0x3f6230){return function(_0x366f30){if(_0x366f30){return _0x366f30[_0x7987('0x26')](_0x5813fd)[_0x7987('0x27')](function(_0x457307){return _0x457307;});}return null;};}function removeEntity(_0x3cc530,_0x4011ed){return function(_0x2f851e){if(_0x2f851e){return _0x2f851e[_0x7987('0x28')]()[_0x7987('0x27')](function(){_0x3cc530[_0x7987('0x1a')](0xcc)[_0x7987('0x1b')]();});}};}function handleEntityNotFound(_0x4d742c,_0x5413a9){return function(_0x5b5674){if(!_0x5b5674){_0x4d742c['sendStatus'](0x194);}return _0x5b5674;};}function handleError(_0x51e208,_0x645225){_0x645225=_0x645225||0x1f4;return function(_0x2c7b56){logger[_0x7987('0x29')](_0x2c7b56[_0x7987('0x2a')]);if(_0x2c7b56[_0x7987('0x2b')]){delete _0x2c7b56[_0x7987('0x2b')];}_0x51e208[_0x7987('0x1a')](_0x645225)[_0x7987('0x2c')](_0x2c7b56);};}function getInteractionUsers(_0x363005,_0x44b4c3){return new BPromise(function(_0x29b1c6,_0x2a3224){try{if(_0x44b4c3[_0x363005['id']]){_0x363005[_0x7987('0x2d')]=_[_0x7987('0x2e')](_0x44b4c3[_0x363005['id']],function(_0xa82308){return{'id':_0xa82308['id'],'fullname':_0xa82308[_0x7987('0x2f')]};});}}catch(_0x1c6315){_0x2a3224(_0x1c6315);}_0x29b1c6(_0x363005);});}function getInteractionTags(_0x43fef5,_0x4b35d4){return new BPromise(function(_0x2d7e95,_0x1233dc){try{if(_0x43fef5[_0x7987('0x30')]){_0x43fef5[_0x7987('0x31')]=[];_0x43fef5[_0x7987('0x30')][_0x7987('0x32')](',')['forEach'](function(_0x241e79){_0x43fef5['Tags'][_0x7987('0x33')](_0x4b35d4[_0x241e79]);});}delete _0x43fef5[_0x7987('0x30')];}catch(_0x579652){_0x1233dc(_0x579652);}_0x2d7e95(_0x43fef5);});}function updateFaxInteraction(_0x34a99d,_0xd8ec39,_0x23fe5a){return new BPromise(function(_0x434b20,_0x47dc35){return getInteractionUsers(_0x34a99d,_0x23fe5a)['then'](function(_0x375e60){return getInteractionTags(_0x375e60,_0xd8ec39);})['then'](function(_0x317c72){_0x434b20(_0x317c72);})['catch'](function(_0x24e33d){_0x47dc35(_0x24e33d);});});}exports[_0x7987('0x34')]=function(_0x537ef5,_0x42550a){var _0x243468={},_0x3ca88b={},_0x4f5ac7={'count':0x0,'rows':[]};var _0x1cb42a=_[_0x7987('0x2e')](db[_0x7987('0x35')][_0x7987('0x36')],function(_0x33eb1c){return{'name':_0x33eb1c[_0x7987('0x37')],'type':_0x33eb1c[_0x7987('0x38')]['key']};});_0x3ca88b[_0x7987('0x39')]=_[_0x7987('0x2e')](_0x1cb42a,_0x7987('0x2b'));_0x3ca88b['query']=_[_0x7987('0x3a')](_0x537ef5['query']);_0x3ca88b['filters']=_['intersection'](_0x3ca88b[_0x7987('0x39')],_0x3ca88b['query']);_0x243468[_0x7987('0x3b')]=_[_0x7987('0x3c')](_0x3ca88b['model'],qs['fields'](_0x537ef5[_0x7987('0x3d')]['fields']));_0x243468[_0x7987('0x3b')]=_0x243468['attributes']['length']?_0x243468[_0x7987('0x3b')]:_0x3ca88b[_0x7987('0x39')];if(!_0x537ef5[_0x7987('0x3d')][_0x7987('0x3e')](_0x7987('0x3f'))){_0x243468[_0x7987('0x1f')]=qs[_0x7987('0x1f')](_0x537ef5[_0x7987('0x3d')]['limit']);_0x243468[_0x7987('0x1d')]=qs[_0x7987('0x1d')](_0x537ef5[_0x7987('0x3d')]['offset']);}_0x243468[_0x7987('0x40')]=qs[_0x7987('0x41')](_0x537ef5[_0x7987('0x3d')][_0x7987('0x41')]);_0x243468[_0x7987('0x42')]=qs[_0x7987('0x43')](_[_0x7987('0x44')](_0x537ef5[_0x7987('0x3d')],_0x3ca88b[_0x7987('0x43')]),_0x1cb42a);var _0x4f0ec8=[];var _0x2c72ad=squel[_0x7987('0x45')]()[_0x7987('0x46')]('id')[_0x7987('0x46')](_0x7987('0x2b'))[_0x7987('0x46')](_0x7987('0x47'))[_0x7987('0x48')](_0x7987('0x49'));var _0xb4e5a=squel['select']()[_0x7987('0x46')]('u.id')[_0x7987('0x46')](_0x7987('0x4a'))['field']('ui.FaxInteractionId')['from'](_0x7987('0x4b'),'ui')[_0x7987('0x4c')](_0x7987('0x4d'),'u',_0x7987('0x4e'));var _0x520258=squel[_0x7987('0x45')]()['from'](_0x7987('0x4f'),'i')[_0x7987('0x4c')](_0x7987('0x50'),'c',_0x7987('0x51'))['left_join']('users','o',_0x7987('0x52'))[_0x7987('0x4c')](_0x7987('0x53'),'a','a.id\x20=\x20i.FaxAccountId')['left_join'](_0x7987('0x54'),'me',_0x7987('0x55'))[_0x7987('0x4c')](_0x7987('0x56'),'it',_0x7987('0x57'))[_0x7987('0x4c')](_0x7987('0x49'),'t',_0x7987('0x58'));var _0xbe0fc4=squel[_0x7987('0x59')]();var _0x263043=[];var _0x1f549d=squel[_0x7987('0x59')]();var _0x323107;if(_0x537ef5[_0x7987('0x3d')][_0x7987('0x5a')]){_0x323107=as[_0x7987('0x5b')](_0x537ef5[_0x7987('0x3d')][_0x7987('0x5a')]);var _0x8a9426=_0x323107[_0x7987('0x5c')];for(var _0x2e1252=0x0;_0x2e1252<_0x323107[_0x7987('0x5d')][_0x7987('0x5e')];_0x2e1252++){var _0xa99ad1=_0x323107[_0x7987('0x5d')][_0x2e1252];var _0xf30081='i';var _0x3523ab=_[_0x7987('0x5f')](_0x1cb42a,[_0x7987('0x2b'),_0xa99ad1[_0x7987('0x46')]]);if(!_0x3523ab){switch(_0xa99ad1['field']){case _0x7987('0x60'):if(_0xa99ad1[_0x7987('0x61')]==0x1){_0x520258[_0x7987('0x62')]('`'+_0xa99ad1[_0x7987('0x46')]+_0x7987('0x63'));}else{_0x520258['having']('`'+_0xa99ad1[_0x7987('0x46')]+'`\x20>\x200');}break;case _0x7987('0x64'):if(_0xa99ad1['operator']===_0x7987('0x65')){if(_0xa99ad1[_0x7987('0x61')]['split']('\x20')[_0x7987('0x5e')]>0x1){_0xbe0fc4[_0x8a9426](_0x7987('0x66'),qs['getFullTextValue'](_0xa99ad1[_0x7987('0x61')]),null);}else{var _0x2e594a='%'+_0xa99ad1[_0x7987('0x61')]+'%';_0xbe0fc4[_0x8a9426](_0x7987('0x67'),_0x2e594a,_0x2e594a,_0x2e594a);}}else{_0x3523ab=_[_0x7987('0x5f')](_0x1cb42a,[_0x7987('0x2b'),_0x7987('0x68')]);_0xa99ad1[_0x7987('0x46')]=_0x7987('0x68');_0x367223=as[_0x7987('0x69')](_0xf30081,_0x3523ab[_0x7987('0x38')],_0xa99ad1);_0xbe0fc4[_0x8a9426](_0x367223[_0x7987('0x6a')],_0x367223['value'][_0x7987('0x6b')],_0x367223[_0x7987('0x61')][_0x7987('0x1b')]);}break;case'Tag':var _0x164694=_0xa99ad1[_0x7987('0x61')][_0x7987('0x32')](',')[_0x7987('0x2e')](function(_0x29e89d){return Number(_0x29e89d);});_0x164694[_0x7987('0x6c')](function(_0x12de59){_0x1f549d['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x12de59+',%');});_0x263043=_[_0x7987('0x6d')](_0x263043,_0x164694);break;case _0x7987('0x6e'):if(_0xa99ad1['operator']==='$substring'){_0xbe0fc4[_0x8a9426](_0x7987('0x6f'),'%'+_0xa99ad1[_0x7987('0x61')]+'%',null);}else{_0x3523ab=_[_0x7987('0x5f')](_0x1cb42a,[_0x7987('0x2b'),_0x7987('0x70')]);_0xa99ad1[_0x7987('0x46')]=_0x7987('0x70');_0x367223=as[_0x7987('0x69')](_0xf30081,_0x3523ab[_0x7987('0x38')],_0xa99ad1);_0xbe0fc4[_0x8a9426](_0x367223['text'],_0x367223[_0x7987('0x61')][_0x7987('0x6b')],_0x367223[_0x7987('0x61')][_0x7987('0x1b')]);}break;case _0x7987('0x71'):_0x367223=as['buildExpression']('me',null,_0xa99ad1);_0xbe0fc4[_0x8a9426](_0x367223['text'],_0x367223[_0x7987('0x61')]['start'],_0x367223[_0x7987('0x61')]['end']);break;}}else{var _0x367223=as[_0x7987('0x69')](_0xf30081,_0x3523ab[_0x7987('0x38')],_0xa99ad1);_0xbe0fc4[_0x8a9426](_0x367223[_0x7987('0x6a')],_0x367223[_0x7987('0x61')][_0x7987('0x6b')],_0x367223['value'][_0x7987('0x1b')]);}}}else{var _0x2c7a06=_(_0x537ef5[_0x7987('0x3d')])['keys']()[_0x7987('0x2e')](function(_0x21cdbc){return _['some'](_0x1cb42a,['name',_0x21cdbc])?_0x21cdbc:undefined;})['compact']()['value']();if(!_[_0x7987('0x72')](_0x2c7a06)){_0x2c7a06[_0x7987('0x6c')](function(_0x5a580e){if(_0x5a580e===_0x7987('0x73')){_0x520258['where'](_0x7987('0x74'),[]['concat'](_0x537ef5['query'][_0x5a580e]));}else if(_0x5a580e===_0x7987('0x75')){var _0x4cae7f=JSON[_0x7987('0x76')](_0x537ef5[_0x7987('0x3d')][_0x5a580e])[_0x7987('0x77')];var _0x2716da=JSON[_0x7987('0x76')](_0x537ef5['query'][_0x5a580e])[_0x7987('0x78')];_0x520258['where'](_0x7987('0x79'),_0x4cae7f,_0x2716da);}else{if(_0x537ef5['query'][_0x5a580e]===_0x7987('0x7a')){_0x520258[_0x7987('0x42')]('i.'+_0x5a580e+_0x7987('0x7b'));}else{_0x520258[_0x7987('0x42')]('i.'+_0x5a580e+_0x7987('0x7c'),_0x537ef5['query'][_0x5a580e]);}}});}if(_0x537ef5[_0x7987('0x3d')]['read']){if(_0x537ef5[_0x7987('0x3d')][_0x7987('0x7d')]==0x1){_0x520258[_0x7987('0x62')]('`unreadMessages`\x20=\x200');}else{_0x520258['having'](_0x7987('0x7e'));}}if(_0x537ef5[_0x7987('0x3d')][_0x7987('0x7f')]){_0x263043=_[_0x7987('0x80')](_0x537ef5['query'][_0x7987('0x7f')])?_0x537ef5[_0x7987('0x3d')][_0x7987('0x7f')]:new Array(_0x537ef5[_0x7987('0x3d')][_0x7987('0x7f')]);_0x263043[_0x7987('0x6c')](function(_0xa3ed25){_0x1f549d['or'](_0x7987('0x81'),'%,'+_0xa3ed25+',%');});}if(_0x537ef5[_0x7987('0x3d')][_0x7987('0x82')]){var _0x54a67b=_0x537ef5[_0x7987('0x3d')]['filter'][_0x7987('0x83')]('\x5c','\x5c\x5c')[_0x7987('0x83')](/'/g,'\x27\x27');if(qs[_0x7987('0x84')](_0x54a67b)){_0xbe0fc4['or'](_0x7987('0x85'),_0x54a67b+'%')['or'](_0x7987('0x86'),_0x54a67b+'%');}_0xbe0fc4['or'](_0x7987('0x87'),_0x54a67b+'%');}}_0x520258[_0x7987('0x42')](_0xbe0fc4);_0x520258[_0x7987('0x88')](_0x7987('0x89'));var _0x28606c={'type':db[_0x7987('0x8a')][_0x7987('0x8b')][_0x7987('0x8c')],'raw':!![]};var _0x3964db=_0x520258[_0x7987('0x8d')]();_0x3964db['field'](_0x7987('0x89'));_0x3964db[_0x7987('0x46')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x7987('0x60'));if(_0x243468[_0x7987('0x40')]){_0x243468[_0x7987('0x40')][_0x7987('0x6c')](function(_0x58c92a){var _0x49f98c=_0x58c92a[0x0]===_0x7987('0x8e')?_0x58c92a[0x0]:'i.'+_0x58c92a[0x0];_0x520258[_0x7987('0x40')](_0x49f98c,_0x58c92a[0x1]===_0x7987('0x8f')?![]:!![]);});}if(!_[_0x7987('0x72')](_0x263043)){_0x520258[_0x7987('0x62')](_0x1f549d);_0x3964db[_0x7987('0x42')](_0x7987('0x90'),_0x263043);}BPromise[_0x7987('0x91')]()[_0x7987('0x27')](function(){if(!_0x323107){if(_0x537ef5['query'][_0x7987('0x73')])return;_0x3964db[_0x7987('0x42')](_0x7987('0x92'));_0x520258['where']('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x537ef5[_0x7987('0x93')][_0x7987('0x94')]!==_0x7987('0x95'))return;return _0x537ef5[_0x7987('0x93')][_0x7987('0x96')]({'attributes':['id'],'raw':!![]})[_0x7987('0x27')](function(_0x503c7d){if(_[_0x7987('0x72')](_0x503c7d)){_0x3964db['where'](_0x7987('0x97'));_0x520258[_0x7987('0x42')](_0x7987('0x97'));}else{_0x3964db[_0x7987('0x42')]('i.FaxAccountId\x20IN\x20?',_[_0x7987('0x2e')](_0x503c7d,'id'));_0x520258[_0x7987('0x42')](_0x7987('0x74'),_['map'](_0x503c7d,'id'));}});})[_0x7987('0x27')](function(){if(_0x537ef5[_0x7987('0x93')][_0x7987('0x94')]===_0x7987('0x95')&&!_0x323107&&!_0x537ef5['query'][_0x7987('0x73')])return[];return db[_0x7987('0x98')][_0x7987('0x3d')](_0x3964db[_0x7987('0x99')](),_0x28606c);})['then'](function(_0x53301f){_0x4f5ac7[_0x7987('0x20')]=_0x53301f['length'];if(_0x4f5ac7[_0x7987('0x20')]===0x0)return[];return db['sequelize']['query'](_0x2c72ad['toString'](),_0x28606c)[_0x7987('0x27')](function(_0x511236){_0x4f0ec8=_['keyBy'](_0x511236,'id');_0x28606c=_[_0x7987('0x9a')](_0x28606c,{'model':db[_0x7987('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x537ef5['query']['fields']){_0x243468[_0x7987('0x3b')][_0x7987('0x6c')](function(_0x38f42c){_0x520258[_0x7987('0x46')]('i.'+_0x38f42c);});}else{_0x520258['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x7987('0x60'));_0x520258[_0x7987('0x46')](_0x7987('0x9b'),_0x7987('0x9c'));_0x520258[_0x7987('0x46')](_0x7987('0x9d'),_0x7987('0x9e'));_0x520258['field']('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x7987('0x8e'));_0x520258[_0x7987('0x46')](_0x7987('0x9f'));_0x520258['field'](_0x7987('0xa0'),_0x7987('0xa1'));_0x520258[_0x7987('0x46')](_0x7987('0xa2'),_0x7987('0xa3'));_0x520258[_0x7987('0x46')](_0x7987('0xa4'),_0x7987('0xa5'));_0x520258[_0x7987('0x46')](_0x7987('0xa6'),_0x7987('0xa7'));_0x520258[_0x7987('0x46')](_0x7987('0xa8'),_0x7987('0xa9'));_0x520258['field']('c.fax','Contact.fax');_0x520258[_0x7987('0x46')](_0x7987('0xaa'),_0x7987('0xab'));_0x520258[_0x7987('0x46')](_0x7987('0xac'),_0x7987('0xad'));_0x520258['field'](_0x7987('0xae'),_0x7987('0x30'));}if(_0x243468[_0x7987('0x1f')])_0x520258[_0x7987('0x1f')](_0x243468[_0x7987('0x1f')]);if(_0x243468[_0x7987('0x1d')])_0x520258[_0x7987('0x1d')](_0x243468['offset']);return db[_0x7987('0x98')][_0x7987('0x3d')](_0x520258['toString'](),_0x28606c);})[_0x7987('0x27')](function(_0x10d929){if(_0x10d929[_0x7987('0x5e')]>0x0)_0xb4e5a[_0x7987('0x42')](_0x7987('0xaf'),_[_0x7987('0x2e')](_0x10d929,'id'));return db['sequelize'][_0x7987('0x3d')](_0xb4e5a['toString'](),_0x28606c)[_0x7987('0x27')](function(_0x3c7712){var _0x26104d=_[_0x7987('0xb0')](_0x3c7712,_0x7987('0xb1'));var _0x1bb7d0=[];_0x10d929['forEach'](function(_0x706a6d){_0x1bb7d0[_0x7987('0x33')](updateFaxInteraction(_0x706a6d,_0x4f0ec8,_0x26104d));});return BPromise[_0x7987('0xb2')](_0x1bb7d0);});});})[_0x7987('0x27')](function(_0x3890b0){_0x4f5ac7[_0x7987('0xb3')]=_0x3890b0;return _0x4f5ac7;})[_0x7987('0x27')](respondWithFilteredResult(_0x42550a,_0x243468))['catch'](handleError(_0x42550a,null));};exports[_0x7987('0xb4')]=function(_0x12cb9d,_0x30a490){var _0x2acf71={'raw':![],'where':{'id':_0x12cb9d[_0x7987('0xb5')]['id']}},_0x1c33aa={};_0x1c33aa[_0x7987('0x39')]=_[_0x7987('0x3a')](db[_0x7987('0x35')][_0x7987('0x36')]);_0x1c33aa[_0x7987('0x3d')]=_['keys'](_0x12cb9d[_0x7987('0x3d')]);_0x1c33aa[_0x7987('0x43')]=_['intersection'](_0x1c33aa[_0x7987('0x39')],_0x1c33aa[_0x7987('0x3d')]);_0x2acf71['attributes']=_[_0x7987('0x3c')](_0x1c33aa[_0x7987('0x39')],qs[_0x7987('0xb6')](_0x12cb9d[_0x7987('0x3d')]['fields']));_0x2acf71['attributes']=_0x2acf71[_0x7987('0x3b')][_0x7987('0x5e')]?_0x2acf71[_0x7987('0x3b')]:_0x1c33aa[_0x7987('0x39')];if(_0x12cb9d[_0x7987('0x3d')][_0x7987('0xb7')]){_0x2acf71[_0x7987('0xb8')]=[{'all':!![]}];}_0x2acf71=_[_0x7987('0x9a')]({},_0x2acf71,_0x12cb9d[_0x7987('0xb9')]);return db[_0x7987('0x35')][_0x7987('0x5f')](_0x2acf71)['then'](handleEntityNotFound(_0x30a490,null))['then'](respondWithResult(_0x30a490,null))['catch'](handleError(_0x30a490,null));};exports[_0x7987('0xba')]=function(_0x264c14,_0x458b9e){return db[_0x7987('0x35')][_0x7987('0xba')](_0x264c14[_0x7987('0x71')],{})[_0x7987('0x27')](respondWithResult(_0x458b9e,0xc9))[_0x7987('0xbb')](handleError(_0x458b9e,null));};exports[_0x7987('0x26')]=function(_0x51cad7,_0x28e8d0){if(_0x51cad7[_0x7987('0x71')]['id']){delete _0x51cad7[_0x7987('0x71')]['id'];}return db['FaxInteraction'][_0x7987('0x5f')]({'where':{'id':_0x51cad7['params']['id']}})[_0x7987('0x27')](handleEntityNotFound(_0x28e8d0,null))[_0x7987('0x27')](saveUpdates(_0x51cad7[_0x7987('0x71')],null))['then'](respondWithResult(_0x28e8d0,null))[_0x7987('0xbb')](handleError(_0x28e8d0,null));};exports[_0x7987('0x28')]=function(_0x154071,_0x1639df){return db[_0x7987('0x35')][_0x7987('0x5f')]({'where':{'id':_0x154071[_0x7987('0xb5')]['id']}})[_0x7987('0x27')](handleEntityNotFound(_0x1639df,null))['then'](removeEntity(_0x1639df,null))[_0x7987('0xbb')](handleError(_0x1639df,null));};exports[_0x7987('0xbc')]=function(_0xcd05e7,_0x588e3a){return db['FaxInteraction'][_0x7987('0xbc')]()['then'](respondWithResult(_0x588e3a,null))[_0x7987('0xbb')](handleError(_0x588e3a,null));};exports['addMessage']=function(_0x4037dd,_0x3e9bdf,_0x596768){return db[_0x7987('0xbd')][_0x7987('0x5f')]({'where':{'id':_0x4037dd[_0x7987('0xb5')]['id']}})[_0x7987('0x27')](handleEntityNotFound(_0x3e9bdf,null))[_0x7987('0x27')](function(_0x219755){if(_0x219755){return _0x219755['addMessage'](_0x4037dd[_0x7987('0x71')][_0x7987('0xbe')],_[_0x7987('0xbf')](_0x4037dd['body'],[_0x7987('0xbe'),'id'])||{});}})[_0x7987('0x27')](respondWithResult(_0x3e9bdf,null))['catch'](handleError(_0x3e9bdf,null));};exports[_0x7987('0xc0')]=function(_0x44facf,_0x3af680,_0x1e0672){var _0x4abe39={'raw':![],'where':{}};var _0xe2826c={};var _0x3e6a5e={'count':0x0,'rows':[]};return db[_0x7987('0x35')][_0x7987('0xc1')]({'where':{'id':_0x44facf['params']['id']}})[_0x7987('0x27')](handleEntityNotFound(_0x3af680,null))['then'](function(_0x22e238){if(_0x22e238){_0xe2826c['model']=_[_0x7987('0x3a')](db[_0x7987('0xbd')]['rawAttributes']);_0xe2826c[_0x7987('0x3d')]=_[_0x7987('0x3a')](_0x44facf[_0x7987('0x3d')]);_0xe2826c['filters']=_[_0x7987('0x3c')](_0xe2826c[_0x7987('0x39')],_0xe2826c[_0x7987('0x3d')]);_0x4abe39[_0x7987('0x3b')]=_['intersection'](_0xe2826c['model'],qs[_0x7987('0xb6')](_0x44facf[_0x7987('0x3d')][_0x7987('0xb6')]));_0x4abe39[_0x7987('0x3b')]=_0x4abe39[_0x7987('0x3b')]['length']?_0x4abe39[_0x7987('0x3b')]:_0xe2826c[_0x7987('0x39')];if(!_0x44facf['query']['hasOwnProperty'](_0x7987('0x3f'))){_0x4abe39['limit']=qs['limit'](_0x44facf[_0x7987('0x3d')][_0x7987('0x1f')]);_0x4abe39[_0x7987('0x1d')]=qs[_0x7987('0x1d')](_0x44facf['query'][_0x7987('0x1d')]);}_0x4abe39[_0x7987('0x40')]=qs['sort'](_0x44facf[_0x7987('0x3d')]['sort']);_0x4abe39[_0x7987('0x42')]=qs[_0x7987('0x43')](_['pick'](_0x44facf['query'],_0xe2826c[_0x7987('0x43')]));_0x4abe39[_0x7987('0x42')]['FaxInteractionId']=_0x22e238['id'];if(_0x44facf['query'][_0x7987('0x82')]){_0x4abe39[_0x7987('0x42')]=_[_0x7987('0x9a')](_0x4abe39['where'],{'$or':_['map'](_0x4abe39[_0x7987('0x3b')],function(_0x4fbefd){var _0x2d6e61={};_0x2d6e61[_0x4fbefd]={'$like':'%'+_0x44facf[_0x7987('0x3d')]['filter']+'%'};return _0x2d6e61;})});}if(_0x44facf[_0x7987('0x3d')]['$gte']){var _0x4c143e=_0x44facf['query'][_0x7987('0x77')][_0x7987('0x32')](',');var _0x4121d6={};_0x4121d6[_0x4c143e[0x0]]={'$gte':moment(_0x4c143e[0x1])[_0x7987('0xc2')](_0x7987('0xc3'))};_0x4abe39[_0x7987('0x42')]=_[_0x7987('0x9a')](_0x4abe39[_0x7987('0x42')],_0x4121d6);}_0x4abe39=_['merge']({},_0x4abe39,_0x44facf[_0x7987('0xb9')]);return db[_0x7987('0xbd')][_0x7987('0x20')]({'where':_0x4abe39[_0x7987('0x42')]})['then'](function(_0x29cef7){_0x3e6a5e[_0x7987('0x20')]=_0x29cef7;if(_0x44facf[_0x7987('0x3d')][_0x7987('0xb7')]){_0x4abe39['include']=[{'all':!![]}];}return db['FaxMessage'][_0x7987('0xc4')](_0x4abe39);})[_0x7987('0x27')](function(_0x8c55ce){_0x3e6a5e['rows']=_0x8c55ce;return _0x3e6a5e;});}})['then'](respondWithFilteredResult(_0x3af680,_0x4abe39))[_0x7987('0xbb')](handleError(_0x3af680,null));};exports[_0x7987('0xc5')]=function(_0x584848,_0x227f88,_0x5aadfe){return db[_0x7987('0x35')]['find']({'where':{'id':_0x584848['params']['id']}})[_0x7987('0x27')](handleEntityNotFound(_0x227f88,null))[_0x7987('0x27')](function(_0x175ccc){if(_0x175ccc){return _0x175ccc['setTags'](_0x584848['body'][_0x7987('0xbe')],_[_0x7987('0xbf')](_0x584848['body'],['ids','id'])||{})['spread'](function(){return db[_0x7987('0xc6')]['findAll']({'attributes':['id',_0x7987('0x2b'),_0x7987('0x47')],'where':{'id':_0x584848[_0x7987('0x71')][_0x7987('0xbe')]}});})['then'](function(_0x339151){socket[_0x7987('0xc7')](_0x7987('0xc8'),{'id':Number(_0x584848[_0x7987('0xb5')]['id']),'tags':_0x339151||[]});return{'id':Number(_0x584848['params']['id']),'tags':_0x339151||[]};});}})['then'](respondWithResult(_0x227f88,null))['catch'](handleError(_0x227f88,null));};exports[_0x7987('0xc9')]=function(_0x4752d6,_0x309fbb,_0x548f86){return db['FaxInteraction'][_0x7987('0x5f')]({'where':{'id':_0x4752d6[_0x7987('0xb5')]['id']}})[_0x7987('0x27')](handleEntityNotFound(_0x309fbb,null))[_0x7987('0x27')](function(_0x5e4f33){if(_0x5e4f33){return _0x5e4f33['removeTags'](_0x4752d6[_0x7987('0x3d')][_0x7987('0xbe')]);}})[_0x7987('0x27')](respondWithStatusCode(_0x309fbb,null))[_0x7987('0xbb')](handleError(_0x309fbb,null));};exports['download']=function(_0x4e0f15,_0x1ca810){var _0x1ac886=moment()[_0x7987('0xca')]()[_0x7987('0x99')]();var _0x3aa932=path['join'](config[_0x7987('0xcb')],_0x7987('0xcc'),_0x7987('0xcd'),_0x7987('0xce'));var _0x20c2da=path['join'](config['root'],_0x7987('0xcc'),_0x7987('0xcd'),'attachments');var _0x2be2ee=path[_0x7987('0xcf')](_0x3aa932,_0x1ac886);var _0x465ec6=util[_0x7987('0xc2')](_0x7987('0xd0'),_0x4e0f15[_0x7987('0xb5')]['id'],_0x1ac886);var _0x3fc66e=path['join'](_0x3aa932,_0x465ec6);var _0x367e06=[];_0x367e06[_0x7987('0x33')]({'model':db['Attachment'],'as':_0x7987('0xd1'),'raw':!![]});var _0x7553ac=[{'model':db[_0x7987('0xbd')],'as':'Messages','attributes':['id',_0x7987('0x71'),_0x7987('0x75')],'include':_0x367e06}];return db[_0x7987('0x35')][_0x7987('0x5f')]({'where':{'id':_0x4e0f15[_0x7987('0xb5')]['id']},'include':_0x7553ac})[_0x7987('0x27')](handleEntityNotFound(_0x1ca810,null))['then'](function(_0x342cf3){if(_0x342cf3&&_0x342cf3[_0x7987('0xd2')]){var _0xb92f27=_0x342cf3['get']({'plain':!![]});fs[_0x7987('0xd3')](_0x2be2ee);for(var _0xe7eaa7=0x0;_0xe7eaa7<_0xb92f27[_0x7987('0xd2')][_0x7987('0x5e')];_0xe7eaa7++){var _0x3bf884=_0xb92f27[_0x7987('0xd2')][_0xe7eaa7]['Attachment'];if(_0x3bf884){var _0x51d3f9=path['join'](_0x20c2da,_0x3bf884[_0x7987('0xd4')]);if(fs[_0x7987('0xd5')](_0x51d3f9)){fs[_0x7987('0xd6')](_0x51d3f9)[_0x7987('0xd7')](fs[_0x7987('0xd8')](path[_0x7987('0xcf')](_0x2be2ee,_0x3bf884[_0x7987('0xd4')])));}}}return BPromise[_0x7987('0x91')]()['then'](function(){return new BPromise(function(_0x3621a5,_0x450123){zipdir(_0x2be2ee,{'saveTo':_0x3fc66e},function(_0x1d9660,_0x34e4d9){if(_0x1d9660)return _0x450123(_0x1d9660);return _0x3621a5(_0x34e4d9);});})['then'](function(){return new BPromise(function(_0x151599,_0x67b67f){rimraf(_0x2be2ee,function(_0x2cb3e){if(_0x2cb3e)_0x67b67f(_0x2cb3e);return _0x151599();});});})['then'](function(){return _0x1ca810[_0x7987('0xd9')](_0x3fc66e,_0x465ec6,function(_0xcab12f){if(_0xcab12f){console[_0x7987('0xda')]('err',_0xcab12f);}else{fs[_0x7987('0xdb')](_0x3fc66e);}});});});}else{return _0x1ca810[_0x7987('0x19')](0xc8);}})['catch'](handleError(_0x1ca810,null));}; \ No newline at end of file +var _0x96a8=['filters','pick','select','field','from','tools_tags','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','o.id\x20=\x20i.UserId','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','find','unreadMessages','value','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','body','compact','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','having','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','filter','replace','isNumeric','i.fax\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','agent','user','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','role','sequelize','toString','keyBy','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','catch','show','params','keys','includeAll','include','merge','create','update','destroy','describe','addMessage','FaxMessage','omit','ids','getMessages','findOne','$gte','format','YYYY-MM-DD\x20HH:mm:ss','rows','setTags','spread','Tag','findAll','color','emit','removeTags','unix','join','root','server','files','tmp','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','pipe','createWriteStream','download','log','err','unlinkSync','rimraf','fast-json-patch','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','offset','undefined','count','set','json','apply','reject','save','then','end','stack','name','send','Users','TagIds','split','forEach','Tags','push','index','map','FaxInteraction','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where'];(function(_0x50dae4,_0x209b01){var _0x17434c=function(_0x3109ee){while(--_0x3109ee){_0x50dae4['push'](_0x50dae4['shift']());}};_0x17434c(++_0x209b01);}(_0x96a8,0x93));var _0x896a=function(_0x4ff291,_0x41e16d){_0x4ff291=_0x4ff291-0x0;var _0x1dc5f9=_0x96a8[_0x4ff291];return _0x1dc5f9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x896a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x896a('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x896a('0x2'));var Mustache=require(_0x896a('0x3'));var util=require('util');var path=require('path');var sox=require(_0x896a('0x4'));var csv=require(_0x896a('0x5'));var ejs=require(_0x896a('0x6'));var fs=require('fs');var fs_extra=require(_0x896a('0x7'));var _=require(_0x896a('0x8'));var squel=require(_0x896a('0x9'));var crypto=require(_0x896a('0xa'));var jsforce=require(_0x896a('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x896a('0x5'));var querystring=require(_0x896a('0xc'));var Papa=require(_0x896a('0xd'));var Redis=require('ioredis');var authService=require(_0x896a('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x896a('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x896a('0x10'))(_0x896a('0x11'));var utils=require(_0x896a('0x12'));var config=require(_0x896a('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x896a('0x14')]=_[_0x896a('0x15')](config['redis'],{'host':_0x896a('0x16'),'port':0x18eb});var socket=require(_0x896a('0x17'))(new Redis(config[_0x896a('0x14')]));require(_0x896a('0x18'))[_0x896a('0x19')](socket);function respondWithStatusCode(_0x315cdb,_0x3c46bd){_0x3c46bd=_0x3c46bd||0xcc;return function(_0x5d9eb7){if(_0x5d9eb7){return _0x315cdb[_0x896a('0x1a')](_0x3c46bd);}return _0x315cdb['status'](_0x3c46bd)['end']();};}function respondWithResult(_0x1f328d,_0x1ed212){_0x1ed212=_0x1ed212||0xc8;return function(_0x26771b){if(_0x26771b){return _0x1f328d[_0x896a('0x1b')](_0x1ed212)['json'](_0x26771b);}};}function respondWithFilteredResult(_0x666242,_0x529dc7){return function(_0x116bb9){if(_0x116bb9){var _0x2011aa=typeof _0x529dc7[_0x896a('0x1c')]===_0x896a('0x1d')&&typeof _0x529dc7['limit']===_0x896a('0x1d');var _0x28f468=_0x116bb9[_0x896a('0x1e')];var _0x4fef49=_0x2011aa?0x0:_0x529dc7[_0x896a('0x1c')];var _0x425e69=_0x2011aa?_0x116bb9['count']:_0x529dc7[_0x896a('0x1c')]+_0x529dc7['limit'];var _0x5e459d;if(_0x425e69>=_0x28f468){_0x425e69=_0x28f468;_0x5e459d=0xc8;}else{_0x5e459d=0xce;}_0x666242['status'](_0x5e459d);return _0x666242[_0x896a('0x1f')]('Content-Range',_0x4fef49+'-'+_0x425e69+'/'+_0x28f468)[_0x896a('0x20')](_0x116bb9);}return null;};}function patchUpdates(_0x2ebf4d){return function(_0x35ab97){try{jsonpatch[_0x896a('0x21')](_0x35ab97,_0x2ebf4d,!![]);}catch(_0x49ce60){return BPromise[_0x896a('0x22')](_0x49ce60);}return _0x35ab97[_0x896a('0x23')]();};}function saveUpdates(_0x4f0b35,_0x3ff701){return function(_0x440c79){if(_0x440c79){return _0x440c79['update'](_0x4f0b35)[_0x896a('0x24')](function(_0x3908ba){return _0x3908ba;});}return null;};}function removeEntity(_0x3b6cdf,_0xa2543){return function(_0x3fa3ed){if(_0x3fa3ed){return _0x3fa3ed['destroy']()[_0x896a('0x24')](function(){_0x3b6cdf[_0x896a('0x1b')](0xcc)[_0x896a('0x25')]();});}};}function handleEntityNotFound(_0x21d690,_0x1acb95){return function(_0x1e835a){if(!_0x1e835a){_0x21d690['sendStatus'](0x194);}return _0x1e835a;};}function handleError(_0x204386,_0xc87be7){_0xc87be7=_0xc87be7||0x1f4;return function(_0x3c0c23){logger['error'](_0x3c0c23[_0x896a('0x26')]);if(_0x3c0c23['name']){delete _0x3c0c23[_0x896a('0x27')];}_0x204386[_0x896a('0x1b')](_0xc87be7)[_0x896a('0x28')](_0x3c0c23);};}function getInteractionUsers(_0x3f7d80,_0x552f9c){return new BPromise(function(_0x461e5c,_0x3f674c){try{if(_0x552f9c[_0x3f7d80['id']]){_0x3f7d80[_0x896a('0x29')]=_['map'](_0x552f9c[_0x3f7d80['id']],function(_0x6df987){return{'id':_0x6df987['id'],'fullname':_0x6df987['fullname']};});}}catch(_0x419bb7){_0x3f674c(_0x419bb7);}_0x461e5c(_0x3f7d80);});}function getInteractionTags(_0x7ec698,_0x1ff95e){return new BPromise(function(_0x4408a2,_0x31f75c){try{if(_0x7ec698[_0x896a('0x2a')]){_0x7ec698['Tags']=[];_0x7ec698[_0x896a('0x2a')][_0x896a('0x2b')](',')[_0x896a('0x2c')](function(_0x5d184c){_0x7ec698[_0x896a('0x2d')][_0x896a('0x2e')](_0x1ff95e[_0x5d184c]);});}delete _0x7ec698['TagIds'];}catch(_0x4ee6ea){_0x31f75c(_0x4ee6ea);}_0x4408a2(_0x7ec698);});}function updateFaxInteraction(_0x26070e,_0x41fb6b,_0x5a5b80){return new BPromise(function(_0x42c1bd,_0x1d58b0){return getInteractionUsers(_0x26070e,_0x5a5b80)[_0x896a('0x24')](function(_0x532d37){return getInteractionTags(_0x532d37,_0x41fb6b);})[_0x896a('0x24')](function(_0x20f70d){_0x42c1bd(_0x20f70d);})['catch'](function(_0x3e69f7){_0x1d58b0(_0x3e69f7);});});}exports[_0x896a('0x2f')]=function(_0x5b0b07,_0x48b15b){var _0x40841f={},_0x465635={},_0x47c905={'count':0x0,'rows':[]};var _0xec55ad=_[_0x896a('0x30')](db[_0x896a('0x31')][_0x896a('0x32')],function(_0x237b03){return{'name':_0x237b03[_0x896a('0x33')],'type':_0x237b03[_0x896a('0x34')][_0x896a('0x35')]};});_0x465635[_0x896a('0x36')]=_[_0x896a('0x30')](_0xec55ad,_0x896a('0x27'));_0x465635[_0x896a('0x37')]=_['keys'](_0x5b0b07[_0x896a('0x37')]);_0x465635['filters']=_[_0x896a('0x38')](_0x465635[_0x896a('0x36')],_0x465635[_0x896a('0x37')]);_0x40841f[_0x896a('0x39')]=_['intersection'](_0x465635[_0x896a('0x36')],qs[_0x896a('0x3a')](_0x5b0b07[_0x896a('0x37')][_0x896a('0x3a')]));_0x40841f['attributes']=_0x40841f[_0x896a('0x39')]['length']?_0x40841f[_0x896a('0x39')]:_0x465635[_0x896a('0x36')];if(!_0x5b0b07[_0x896a('0x37')][_0x896a('0x3b')](_0x896a('0x3c'))){_0x40841f[_0x896a('0x3d')]=qs[_0x896a('0x3d')](_0x5b0b07[_0x896a('0x37')][_0x896a('0x3d')]);_0x40841f['offset']=qs[_0x896a('0x1c')](_0x5b0b07['query'][_0x896a('0x1c')]);}_0x40841f[_0x896a('0x3e')]=qs[_0x896a('0x3f')](_0x5b0b07[_0x896a('0x37')][_0x896a('0x3f')]);_0x40841f[_0x896a('0x40')]=qs[_0x896a('0x41')](_[_0x896a('0x42')](_0x5b0b07[_0x896a('0x37')],_0x465635[_0x896a('0x41')]),_0xec55ad);var _0x27c3fb=[];var _0x53e8a1=squel[_0x896a('0x43')]()['field']('id')[_0x896a('0x44')](_0x896a('0x27'))[_0x896a('0x44')]('color')[_0x896a('0x45')](_0x896a('0x46'));var _0x44e689=squel[_0x896a('0x43')]()[_0x896a('0x44')]('u.id')[_0x896a('0x44')]('u.fullname')['field'](_0x896a('0x47'))[_0x896a('0x45')](_0x896a('0x48'),'ui')[_0x896a('0x49')](_0x896a('0x4a'),'u',_0x896a('0x4b'));var _0x1a85cf=squel['select']()['from'](_0x896a('0x4c'),'i')[_0x896a('0x49')](_0x896a('0x4d'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x896a('0x49')](_0x896a('0x4a'),'o',_0x896a('0x4e'))[_0x896a('0x49')]('fax_accounts','a',_0x896a('0x4f'))['left_join'](_0x896a('0x50'),'me',_0x896a('0x51'))[_0x896a('0x49')]('fax_interaction_has_tags','it',_0x896a('0x52'))[_0x896a('0x49')](_0x896a('0x46'),'t',_0x896a('0x53'));var _0x4b2e6a=squel[_0x896a('0x54')]();var _0x22d2f1=[];var _0x20f20a=squel[_0x896a('0x54')]();var _0x24e59;if(_0x5b0b07[_0x896a('0x37')][_0x896a('0x55')]){_0x24e59=as[_0x896a('0x56')](_0x5b0b07['query'][_0x896a('0x55')]);var _0xc3f187=_0x24e59[_0x896a('0x57')];for(var _0x54900f=0x0;_0x54900f<_0x24e59[_0x896a('0x58')][_0x896a('0x59')];_0x54900f++){var _0x7dc4e9=_0x24e59['conditions'][_0x54900f];var _0x269edf='i';var _0x26f6e8=_[_0x896a('0x5a')](_0xec55ad,[_0x896a('0x27'),_0x7dc4e9[_0x896a('0x44')]]);if(!_0x26f6e8){switch(_0x7dc4e9[_0x896a('0x44')]){case _0x896a('0x5b'):if(_0x7dc4e9[_0x896a('0x5c')]==0x1){_0x1a85cf['having']('`'+_0x7dc4e9[_0x896a('0x44')]+_0x896a('0x5d'));}else{_0x1a85cf['having']('`'+_0x7dc4e9[_0x896a('0x44')]+_0x896a('0x5e'));}break;case _0x896a('0x5f'):if(_0x7dc4e9[_0x896a('0x60')]===_0x896a('0x61')){if(_0x7dc4e9[_0x896a('0x5c')][_0x896a('0x2b')]('\x20')[_0x896a('0x59')]>0x1){_0x4b2e6a[_0xc3f187](_0x896a('0x62'),qs[_0x896a('0x63')](_0x7dc4e9['value']),null);}else{var _0x272e81='%'+_0x7dc4e9[_0x896a('0x5c')]+'%';_0x4b2e6a[_0xc3f187]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x272e81,_0x272e81,_0x272e81);}}else{_0x26f6e8=_[_0x896a('0x5a')](_0xec55ad,[_0x896a('0x27'),_0x896a('0x64')]);_0x7dc4e9[_0x896a('0x44')]=_0x896a('0x64');_0x545d83=as[_0x896a('0x65')](_0x269edf,_0x26f6e8[_0x896a('0x34')],_0x7dc4e9);_0x4b2e6a[_0xc3f187](_0x545d83['text'],_0x545d83['value'][_0x896a('0x66')],_0x545d83['value']['end']);}break;case'Tag':var _0x51d599=_0x7dc4e9[_0x896a('0x5c')][_0x896a('0x2b')](',')[_0x896a('0x30')](function(_0x158a8b){return Number(_0x158a8b);});_0x51d599['forEach'](function(_0x404042){_0x20f20a['or'](_0x896a('0x67'),'%,'+_0x404042+',%');});_0x22d2f1=_['union'](_0x22d2f1,_0x51d599);break;case _0x896a('0x68'):if(_0x7dc4e9['operator']===_0x896a('0x61')){_0x4b2e6a[_0xc3f187](_0x896a('0x69'),'%'+_0x7dc4e9[_0x896a('0x5c')]+'%',null);}else{_0x26f6e8=_['find'](_0xec55ad,[_0x896a('0x27'),_0x896a('0x6a')]);_0x7dc4e9[_0x896a('0x44')]=_0x896a('0x6a');_0x545d83=as[_0x896a('0x65')](_0x269edf,_0x26f6e8[_0x896a('0x34')],_0x7dc4e9);_0x4b2e6a[_0xc3f187](_0x545d83[_0x896a('0x6b')],_0x545d83[_0x896a('0x5c')][_0x896a('0x66')],_0x545d83['value'][_0x896a('0x25')]);}break;case _0x896a('0x6c'):_0x545d83=as[_0x896a('0x65')]('me',null,_0x7dc4e9);_0x4b2e6a[_0xc3f187](_0x545d83['text'],_0x545d83[_0x896a('0x5c')]['start'],_0x545d83[_0x896a('0x5c')][_0x896a('0x25')]);break;}}else{var _0x545d83=as[_0x896a('0x65')](_0x269edf,_0x26f6e8[_0x896a('0x34')],_0x7dc4e9);_0x4b2e6a[_0xc3f187](_0x545d83[_0x896a('0x6b')],_0x545d83[_0x896a('0x5c')][_0x896a('0x66')],_0x545d83['value']['end']);}}}else{var _0x4c341e=_(_0x5b0b07[_0x896a('0x37')])['keys']()[_0x896a('0x30')](function(_0x338b21){return _['some'](_0xec55ad,['name',_0x338b21])?_0x338b21:undefined;})[_0x896a('0x6d')]()[_0x896a('0x5c')]();if(!_[_0x896a('0x6e')](_0x4c341e)){_0x4c341e[_0x896a('0x2c')](function(_0x483120){if(_0x483120===_0x896a('0x6f')){_0x1a85cf['where'](_0x896a('0x70'),[][_0x896a('0x71')](_0x5b0b07[_0x896a('0x37')][_0x483120]));}else if(_0x483120===_0x896a('0x72')){var _0x1a7e69=JSON[_0x896a('0x73')](_0x5b0b07[_0x896a('0x37')][_0x483120])['$gte'];var _0x44e751=JSON['parse'](_0x5b0b07[_0x896a('0x37')][_0x483120])[_0x896a('0x74')];_0x1a85cf[_0x896a('0x40')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x1a7e69,_0x44e751);}else{if(_0x5b0b07[_0x896a('0x37')][_0x483120]===_0x896a('0x75')){_0x1a85cf[_0x896a('0x40')]('i.'+_0x483120+_0x896a('0x76'));}else{_0x1a85cf[_0x896a('0x40')]('i.'+_0x483120+_0x896a('0x77'),_0x5b0b07['query'][_0x483120]);}}});}if(_0x5b0b07[_0x896a('0x37')][_0x896a('0x78')]){if(_0x5b0b07['query']['read']==0x1){_0x1a85cf[_0x896a('0x79')](_0x896a('0x7a'));}else{_0x1a85cf[_0x896a('0x79')](_0x896a('0x7b'));}}if(_0x5b0b07[_0x896a('0x37')]['tag']){_0x22d2f1=_['isArray'](_0x5b0b07['query']['tag'])?_0x5b0b07['query']['tag']:new Array(_0x5b0b07['query']['tag']);_0x22d2f1['forEach'](function(_0x1f06ed){_0x20f20a['or'](_0x896a('0x67'),'%,'+_0x1f06ed+',%');});}if(_0x5b0b07[_0x896a('0x37')][_0x896a('0x7c')]){var _0x1af630=_0x5b0b07[_0x896a('0x37')][_0x896a('0x7c')][_0x896a('0x7d')]('\x5c','\x5c\x5c')[_0x896a('0x7d')](/'/g,'\x27\x27');if(qs[_0x896a('0x7e')](_0x1af630)){_0x4b2e6a['or']('i.id\x20LIKE\x20?',_0x1af630+'%')['or'](_0x896a('0x7f'),_0x1af630+'%');}_0x4b2e6a['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x1af630+'%');}}_0x1a85cf[_0x896a('0x40')](_0x4b2e6a);_0x1a85cf['group'](_0x896a('0x80'));var _0x2170ea={'type':db[_0x896a('0x81')][_0x896a('0x82')][_0x896a('0x83')],'raw':!![]};var _0x9b8c82=_0x1a85cf[_0x896a('0x84')]();_0x9b8c82[_0x896a('0x44')](_0x896a('0x80'));_0x9b8c82[_0x896a('0x44')](_0x896a('0x85'),_0x896a('0x5b'));if(_0x40841f[_0x896a('0x3e')]){_0x40841f[_0x896a('0x3e')]['forEach'](function(_0xbb96b7){var _0x402b01=_0xbb96b7[0x0]===_0x896a('0x86')?_0xbb96b7[0x0]:'i.'+_0xbb96b7[0x0];_0x1a85cf['order'](_0x402b01,_0xbb96b7[0x1]===_0x896a('0x87')?![]:!![]);});}if(!_[_0x896a('0x6e')](_0x22d2f1)){_0x1a85cf['having'](_0x20f20a);_0x9b8c82[_0x896a('0x40')](_0x896a('0x88'),_0x22d2f1);}BPromise[_0x896a('0x89')]()[_0x896a('0x24')](function(){if(!_0x24e59){if(_0x5b0b07[_0x896a('0x37')][_0x896a('0x6f')])return;_0x9b8c82[_0x896a('0x40')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x1a85cf['where'](_0x896a('0x8a'));return;}if(_0x5b0b07['user']['role']!==_0x896a('0x8b'))return;return _0x5b0b07[_0x896a('0x8c')][_0x896a('0x8d')]({'attributes':['id'],'raw':!![]})[_0x896a('0x24')](function(_0x261084){if(_[_0x896a('0x6e')](_0x261084)){_0x9b8c82[_0x896a('0x40')](_0x896a('0x8e'));_0x1a85cf[_0x896a('0x40')](_0x896a('0x8e'));}else{_0x9b8c82[_0x896a('0x40')]('i.FaxAccountId\x20IN\x20?',_[_0x896a('0x30')](_0x261084,'id'));_0x1a85cf['where'](_0x896a('0x70'),_[_0x896a('0x30')](_0x261084,'id'));}});})[_0x896a('0x24')](function(){if(_0x5b0b07[_0x896a('0x8c')][_0x896a('0x8f')]===_0x896a('0x8b')&&!_0x24e59&&!_0x5b0b07[_0x896a('0x37')][_0x896a('0x6f')])return[];return db[_0x896a('0x90')][_0x896a('0x37')](_0x9b8c82[_0x896a('0x91')](),_0x2170ea);})[_0x896a('0x24')](function(_0x1aeed4){_0x47c905['count']=_0x1aeed4[_0x896a('0x59')];if(_0x47c905[_0x896a('0x1e')]===0x0)return[];return db[_0x896a('0x90')][_0x896a('0x37')](_0x53e8a1[_0x896a('0x91')](),_0x2170ea)[_0x896a('0x24')](function(_0x4c0d6e){_0x27c3fb=_[_0x896a('0x92')](_0x4c0d6e,'id');_0x2170ea=_['merge'](_0x2170ea,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5b0b07[_0x896a('0x37')][_0x896a('0x3a')]){_0x40841f[_0x896a('0x39')][_0x896a('0x2c')](function(_0x1d2802){_0x1a85cf[_0x896a('0x44')]('i.'+_0x1d2802);});}else{_0x1a85cf[_0x896a('0x44')](_0x896a('0x85'),_0x896a('0x5b'));_0x1a85cf[_0x896a('0x44')](_0x896a('0x93'),_0x896a('0x94'));_0x1a85cf[_0x896a('0x44')]('a.mandatoryDisposition',_0x896a('0x95'));_0x1a85cf['field'](_0x896a('0x96'),_0x896a('0x86'));_0x1a85cf[_0x896a('0x44')](_0x896a('0x97'));_0x1a85cf[_0x896a('0x44')]('c.firstName','Contact.firstName');_0x1a85cf[_0x896a('0x44')]('c.lastName',_0x896a('0x98'));_0x1a85cf['field'](_0x896a('0x99'),_0x896a('0x9a'));_0x1a85cf[_0x896a('0x44')](_0x896a('0x9b'),'Contact.phone');_0x1a85cf[_0x896a('0x44')](_0x896a('0x9c'),_0x896a('0x9d'));_0x1a85cf[_0x896a('0x44')](_0x896a('0x9e'),'Contact.fax');_0x1a85cf[_0x896a('0x44')](_0x896a('0x9f'),'Owner.fullname');_0x1a85cf[_0x896a('0x44')]('o.internal',_0x896a('0xa0'));_0x1a85cf[_0x896a('0x44')](_0x896a('0xa1'),_0x896a('0x2a'));}if(_0x40841f['limit'])_0x1a85cf[_0x896a('0x3d')](_0x40841f[_0x896a('0x3d')]);if(_0x40841f['offset'])_0x1a85cf[_0x896a('0x1c')](_0x40841f[_0x896a('0x1c')]);return db[_0x896a('0x90')][_0x896a('0x37')](_0x1a85cf[_0x896a('0x91')](),_0x2170ea);})['then'](function(_0x3de1e1){if(_0x3de1e1['length']>0x0)_0x44e689[_0x896a('0x40')](_0x896a('0xa2'),_[_0x896a('0x30')](_0x3de1e1,'id'));return db[_0x896a('0x90')][_0x896a('0x37')](_0x44e689[_0x896a('0x91')](),_0x2170ea)['then'](function(_0xaaa6b){var _0x1f9e7d=_[_0x896a('0xa3')](_0xaaa6b,_0x896a('0xa4'));var _0x588a47=[];_0x3de1e1[_0x896a('0x2c')](function(_0x281a5f){_0x588a47[_0x896a('0x2e')](updateFaxInteraction(_0x281a5f,_0x27c3fb,_0x1f9e7d));});return BPromise[_0x896a('0xa5')](_0x588a47);});});})[_0x896a('0x24')](function(_0x374c03){_0x47c905['rows']=_0x374c03;return _0x47c905;})[_0x896a('0x24')](respondWithFilteredResult(_0x48b15b,_0x40841f))[_0x896a('0xa6')](handleError(_0x48b15b,null));};exports[_0x896a('0xa7')]=function(_0x4b8501,_0x185bad){var _0x299618={'raw':![],'where':{'id':_0x4b8501[_0x896a('0xa8')]['id']}},_0xe2d063={};_0xe2d063[_0x896a('0x36')]=_[_0x896a('0xa9')](db[_0x896a('0x31')][_0x896a('0x32')]);_0xe2d063[_0x896a('0x37')]=_['keys'](_0x4b8501[_0x896a('0x37')]);_0xe2d063[_0x896a('0x41')]=_['intersection'](_0xe2d063['model'],_0xe2d063['query']);_0x299618['attributes']=_[_0x896a('0x38')](_0xe2d063[_0x896a('0x36')],qs[_0x896a('0x3a')](_0x4b8501['query']['fields']));_0x299618[_0x896a('0x39')]=_0x299618[_0x896a('0x39')]['length']?_0x299618[_0x896a('0x39')]:_0xe2d063[_0x896a('0x36')];if(_0x4b8501[_0x896a('0x37')][_0x896a('0xaa')]){_0x299618[_0x896a('0xab')]=[{'all':!![]}];}_0x299618=_[_0x896a('0xac')]({},_0x299618,_0x4b8501['options']);return db['FaxInteraction'][_0x896a('0x5a')](_0x299618)[_0x896a('0x24')](handleEntityNotFound(_0x185bad,null))[_0x896a('0x24')](respondWithResult(_0x185bad,null))[_0x896a('0xa6')](handleError(_0x185bad,null));};exports[_0x896a('0xad')]=function(_0x5165f2,_0x4b0732){return db[_0x896a('0x31')][_0x896a('0xad')](_0x5165f2[_0x896a('0x6c')],{})[_0x896a('0x24')](respondWithResult(_0x4b0732,0xc9))[_0x896a('0xa6')](handleError(_0x4b0732,null));};exports[_0x896a('0xae')]=function(_0x28bda9,_0x48c155){if(_0x28bda9[_0x896a('0x6c')]['id']){delete _0x28bda9['body']['id'];}return db['FaxInteraction'][_0x896a('0x5a')]({'where':{'id':_0x28bda9[_0x896a('0xa8')]['id']}})[_0x896a('0x24')](handleEntityNotFound(_0x48c155,null))[_0x896a('0x24')](saveUpdates(_0x28bda9[_0x896a('0x6c')],null))[_0x896a('0x24')](respondWithResult(_0x48c155,null))[_0x896a('0xa6')](handleError(_0x48c155,null));};exports[_0x896a('0xaf')]=function(_0x53ec05,_0x4739c3){return db[_0x896a('0x31')][_0x896a('0x5a')]({'where':{'id':_0x53ec05[_0x896a('0xa8')]['id']}})[_0x896a('0x24')](handleEntityNotFound(_0x4739c3,null))[_0x896a('0x24')](removeEntity(_0x4739c3,null))['catch'](handleError(_0x4739c3,null));};exports[_0x896a('0xb0')]=function(_0x496775,_0x27ccbc){return db['FaxInteraction'][_0x896a('0xb0')]()[_0x896a('0x24')](respondWithResult(_0x27ccbc,null))[_0x896a('0xa6')](handleError(_0x27ccbc,null));};exports[_0x896a('0xb1')]=function(_0x2dd3d4,_0x389f2a,_0x5dd07e){return db[_0x896a('0xb2')][_0x896a('0x5a')]({'where':{'id':_0x2dd3d4[_0x896a('0xa8')]['id']}})[_0x896a('0x24')](handleEntityNotFound(_0x389f2a,null))[_0x896a('0x24')](function(_0x5742d7){if(_0x5742d7){return _0x5742d7[_0x896a('0xb1')](_0x2dd3d4[_0x896a('0x6c')]['ids'],_[_0x896a('0xb3')](_0x2dd3d4[_0x896a('0x6c')],[_0x896a('0xb4'),'id'])||{});}})[_0x896a('0x24')](respondWithResult(_0x389f2a,null))[_0x896a('0xa6')](handleError(_0x389f2a,null));};exports[_0x896a('0xb5')]=function(_0x3acec5,_0x260c76,_0x500268){var _0x4dbbcd={'raw':![],'where':{}};var _0x1e9a42={};var _0xa5cd89={'count':0x0,'rows':[]};return db[_0x896a('0x31')][_0x896a('0xb6')]({'where':{'id':_0x3acec5[_0x896a('0xa8')]['id']}})['then'](handleEntityNotFound(_0x260c76,null))[_0x896a('0x24')](function(_0x2b6487){if(_0x2b6487){_0x1e9a42[_0x896a('0x36')]=_[_0x896a('0xa9')](db[_0x896a('0xb2')][_0x896a('0x32')]);_0x1e9a42[_0x896a('0x37')]=_[_0x896a('0xa9')](_0x3acec5[_0x896a('0x37')]);_0x1e9a42['filters']=_[_0x896a('0x38')](_0x1e9a42[_0x896a('0x36')],_0x1e9a42[_0x896a('0x37')]);_0x4dbbcd[_0x896a('0x39')]=_['intersection'](_0x1e9a42[_0x896a('0x36')],qs['fields'](_0x3acec5['query']['fields']));_0x4dbbcd[_0x896a('0x39')]=_0x4dbbcd[_0x896a('0x39')]['length']?_0x4dbbcd[_0x896a('0x39')]:_0x1e9a42[_0x896a('0x36')];if(!_0x3acec5[_0x896a('0x37')]['hasOwnProperty'](_0x896a('0x3c'))){_0x4dbbcd[_0x896a('0x3d')]=qs[_0x896a('0x3d')](_0x3acec5[_0x896a('0x37')][_0x896a('0x3d')]);_0x4dbbcd[_0x896a('0x1c')]=qs[_0x896a('0x1c')](_0x3acec5[_0x896a('0x37')][_0x896a('0x1c')]);}_0x4dbbcd[_0x896a('0x3e')]=qs['sort'](_0x3acec5[_0x896a('0x37')][_0x896a('0x3f')]);_0x4dbbcd[_0x896a('0x40')]=qs[_0x896a('0x41')](_['pick'](_0x3acec5['query'],_0x1e9a42[_0x896a('0x41')]));_0x4dbbcd['where'][_0x896a('0xa4')]=_0x2b6487['id'];if(_0x3acec5[_0x896a('0x37')][_0x896a('0x7c')]){_0x4dbbcd[_0x896a('0x40')]=_[_0x896a('0xac')](_0x4dbbcd['where'],{'$or':_['map'](_0x4dbbcd['attributes'],function(_0x33eeda){var _0xbf2dde={};_0xbf2dde[_0x33eeda]={'$like':'%'+_0x3acec5[_0x896a('0x37')][_0x896a('0x7c')]+'%'};return _0xbf2dde;})});}if(_0x3acec5['query'][_0x896a('0xb7')]){var _0x4b5f8f=_0x3acec5['query']['$gte']['split'](',');var _0x2efa94={};_0x2efa94[_0x4b5f8f[0x0]]={'$gte':moment(_0x4b5f8f[0x1])[_0x896a('0xb8')](_0x896a('0xb9'))};_0x4dbbcd['where']=_[_0x896a('0xac')](_0x4dbbcd['where'],_0x2efa94);}_0x4dbbcd=_['merge']({},_0x4dbbcd,_0x3acec5['options']);return db[_0x896a('0xb2')]['count']({'where':_0x4dbbcd[_0x896a('0x40')]})[_0x896a('0x24')](function(_0x58de63){_0xa5cd89[_0x896a('0x1e')]=_0x58de63;if(_0x3acec5[_0x896a('0x37')]['includeAll']){_0x4dbbcd[_0x896a('0xab')]=[{'all':!![]}];}return db[_0x896a('0xb2')]['findAll'](_0x4dbbcd);})[_0x896a('0x24')](function(_0x2a3afd){_0xa5cd89[_0x896a('0xba')]=_0x2a3afd;return _0xa5cd89;});}})[_0x896a('0x24')](respondWithFilteredResult(_0x260c76,_0x4dbbcd))[_0x896a('0xa6')](handleError(_0x260c76,null));};exports['addTags']=function(_0x180763,_0x4c2225,_0x42d5f7){return db['FaxInteraction'][_0x896a('0x5a')]({'where':{'id':_0x180763[_0x896a('0xa8')]['id']}})['then'](handleEntityNotFound(_0x4c2225,null))['then'](function(_0x34c99c){if(_0x34c99c){return _0x34c99c[_0x896a('0xbb')](_0x180763['body'][_0x896a('0xb4')],_[_0x896a('0xb3')](_0x180763[_0x896a('0x6c')],[_0x896a('0xb4'),'id'])||{})[_0x896a('0xbc')](function(){return db[_0x896a('0xbd')][_0x896a('0xbe')]({'attributes':['id',_0x896a('0x27'),_0x896a('0xbf')],'where':{'id':_0x180763[_0x896a('0x6c')]['ids']}});})[_0x896a('0x24')](function(_0x16f65a){socket[_0x896a('0xc0')]('faxInteractionTags:save',{'id':Number(_0x180763[_0x896a('0xa8')]['id']),'tags':_0x16f65a||[]});return{'id':Number(_0x180763[_0x896a('0xa8')]['id']),'tags':_0x16f65a||[]};});}})[_0x896a('0x24')](respondWithResult(_0x4c2225,null))[_0x896a('0xa6')](handleError(_0x4c2225,null));};exports[_0x896a('0xc1')]=function(_0x40eed4,_0x72538e,_0xb5479b){return db[_0x896a('0x31')][_0x896a('0x5a')]({'where':{'id':_0x40eed4[_0x896a('0xa8')]['id']}})[_0x896a('0x24')](handleEntityNotFound(_0x72538e,null))[_0x896a('0x24')](function(_0x330f5b){if(_0x330f5b){return _0x330f5b['removeTags'](_0x40eed4[_0x896a('0x37')][_0x896a('0xb4')]);}})[_0x896a('0x24')](respondWithStatusCode(_0x72538e,null))[_0x896a('0xa6')](handleError(_0x72538e,null));};exports['download']=function(_0x597051,_0x171fde){var _0x1d4cfd=moment()[_0x896a('0xc2')]()[_0x896a('0x91')]();var _0x23d4ca=path[_0x896a('0xc3')](config[_0x896a('0xc4')],_0x896a('0xc5'),_0x896a('0xc6'),_0x896a('0xc7'));var _0x55d6b9=path[_0x896a('0xc3')](config[_0x896a('0xc4')],_0x896a('0xc5'),_0x896a('0xc6'),'attachments');var _0x3d526e=path['join'](_0x23d4ca,_0x1d4cfd);var _0x2bdb19=util[_0x896a('0xb8')](_0x896a('0xc8'),_0x597051[_0x896a('0xa8')]['id'],_0x1d4cfd);var _0x4ff5b4=path[_0x896a('0xc3')](_0x23d4ca,_0x2bdb19);var _0x2daa14=[];_0x2daa14[_0x896a('0x2e')]({'model':db[_0x896a('0xc9')],'as':_0x896a('0xc9'),'raw':!![]});var _0x1b8efb=[{'model':db[_0x896a('0xb2')],'as':_0x896a('0xca'),'attributes':['id',_0x896a('0x6c'),_0x896a('0x72')],'include':_0x2daa14}];return db[_0x896a('0x31')][_0x896a('0x5a')]({'where':{'id':_0x597051['params']['id']},'include':_0x1b8efb})[_0x896a('0x24')](handleEntityNotFound(_0x171fde,null))[_0x896a('0x24')](function(_0x18f7ef){if(_0x18f7ef&&_0x18f7ef[_0x896a('0xca')]){var _0x2cb372=_0x18f7ef[_0x896a('0xcb')]({'plain':!![]});fs[_0x896a('0xcc')](_0x3d526e);for(var _0x18c6b0=0x0;_0x18c6b0<_0x2cb372['Messages'][_0x896a('0x59')];_0x18c6b0++){var _0x16f8ed=_0x2cb372[_0x896a('0xca')][_0x18c6b0][_0x896a('0xc9')];if(_0x16f8ed){var _0x98da51=path[_0x896a('0xc3')](_0x55d6b9,_0x16f8ed[_0x896a('0xcd')]);if(fs['existsSync'](_0x98da51)){fs['createReadStream'](_0x98da51)[_0x896a('0xce')](fs[_0x896a('0xcf')](path[_0x896a('0xc3')](_0x3d526e,_0x16f8ed[_0x896a('0xcd')])));}}}return BPromise[_0x896a('0x89')]()['then'](function(){return new BPromise(function(_0x475108,_0x40591c){zipdir(_0x3d526e,{'saveTo':_0x4ff5b4},function(_0xb0ff56,_0x4ec45b){if(_0xb0ff56)return _0x40591c(_0xb0ff56);return _0x475108(_0x4ec45b);});})['then'](function(){return new BPromise(function(_0x5378f6,_0x573226){rimraf(_0x3d526e,function(_0x6ff828){if(_0x6ff828)_0x573226(_0x6ff828);return _0x5378f6();});});})[_0x896a('0x24')](function(){return _0x171fde[_0x896a('0xd0')](_0x4ff5b4,_0x2bdb19,function(_0x5310f9){if(_0x5310f9){console[_0x896a('0xd1')](_0x896a('0xd2'),_0x5310f9);}else{fs[_0x896a('0xd3')](_0x4ff5b4);}});});});}else{return _0x171fde['sendStatus'](0xc8);}})[_0x896a('0xa6')](handleError(_0x171fde,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 70f871c..119dcc3 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 _0x2db5=['setDataValue','Users','findAll','length','emit','catch','hook','exports','events','../../mysqldb','FaxInteraction','setMaxListeners','save','update','remove','getUsers','then'];(function(_0x56fb02,_0x179d7a){var _0x177f5b=function(_0x47e149){while(--_0x47e149){_0x56fb02['push'](_0x56fb02['shift']());}};_0x177f5b(++_0x179d7a);}(_0x2db5,0xf6));var _0x52db=function(_0x12f9e3,_0x3fadc1){_0x12f9e3=_0x12f9e3-0x0;var _0x2de0c8=_0x2db5[_0x12f9e3];return _0x2de0c8;};'use strict';var EventEmitter=require(_0x52db('0x0'));var FaxInteraction=require(_0x52db('0x1'))['db'][_0x52db('0x2')];var FaxMessage=require('../../mysqldb')['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x52db('0x3')](0x0);var events={'afterCreate':_0x52db('0x4'),'afterUpdate':_0x52db('0x5'),'afterDestroy':_0x52db('0x6')};function emitEvent(_0x1469dd){return function(_0x34e538,_0x3995fd,_0x2f72b2){_0x34e538[_0x52db('0x7')]({'attributes':['id'],'raw':!![]})[_0x52db('0x8')](function(_0x43cd56){_0x34e538[_0x52db('0x9')](_0x52db('0xa'),_0x43cd56['map'](function(_0xad551a){return{'id':_0xad551a['id']};}));return FaxMessage[_0x52db('0xb')]({'where':{'FaxInteractionId':_0x34e538['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x47362c){_0x34e538[_0x52db('0x9')]('unreadMessages',_0x47362c[_0x52db('0xc')]);FaxInteractionEvents[_0x52db('0xd')](_0x1469dd+':'+_0x34e538['id'],_0x34e538);FaxInteractionEvents[_0x52db('0xd')](_0x1469dd,_0x34e538);_0x2f72b2(null);})[_0x52db('0xe')](_0x2f72b2(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0x52db('0xf')](e,emitEvent(event));}}module[_0x52db('0x10')]=FaxInteractionEvents; \ No newline at end of file +var _0x46b8=['findAll','setDataValue','unreadMessages','length','emit','hasOwnProperty','exports','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','getUsers','then','map'];(function(_0x28f32c,_0x4cc342){var _0x355402=function(_0xdb5032){while(--_0xdb5032){_0x28f32c['push'](_0x28f32c['shift']());}};_0x355402(++_0x4cc342);}(_0x46b8,0x128));var _0x846b=function(_0x1eb4bb,_0x4caaed){_0x1eb4bb=_0x1eb4bb-0x0;var _0x54e245=_0x46b8[_0x1eb4bb];return _0x54e245;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x846b('0x0'))['db'][_0x846b('0x1')];var FaxMessage=require(_0x846b('0x0'))['db'][_0x846b('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x846b('0x3')](0x0);var events={'afterCreate':_0x846b('0x4'),'afterUpdate':_0x846b('0x5'),'afterDestroy':_0x846b('0x6')};function emitEvent(_0x2d5f2e){return function(_0x2716fc,_0x58d3cd,_0x44e934){_0x2716fc[_0x846b('0x7')]({'attributes':['id'],'raw':!![]})[_0x846b('0x8')](function(_0x16a5f4){_0x2716fc['setDataValue']('Users',_0x16a5f4[_0x846b('0x9')](function(_0x2102b2){return{'id':_0x2102b2['id']};}));return FaxMessage[_0x846b('0xa')]({'where':{'FaxInteractionId':_0x2716fc['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5a1c93){_0x2716fc[_0x846b('0xb')](_0x846b('0xc'),_0x5a1c93[_0x846b('0xd')]);FaxInteractionEvents[_0x846b('0xe')](_0x2d5f2e+':'+_0x2716fc['id'],_0x2716fc);FaxInteractionEvents[_0x846b('0xe')](_0x2d5f2e,_0x2716fc);_0x44e934(null);})['catch'](_0x44e934(null));};}for(var e in events){if(events[_0x846b('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x846b('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 d625a48..70460df 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 _0xdf4d=['../../config/environment','define','FaxInteraction','fax_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x4b3358,_0x5cda77){var _0x1ea011=function(_0x1a17ea){while(--_0x1a17ea){_0x4b3358['push'](_0x4b3358['shift']());}};_0x1ea011(++_0x5cda77);}(_0xdf4d,0xcb));var _0xddf4=function(_0x55370e,_0x5f49af){_0x55370e=_0x55370e-0x0;var _0x50d6f3=_0xdf4d[_0x55370e];return _0x50d6f3;};'use strict';var _=require('lodash');var util=require(_0xddf4('0x0'));var logger=require(_0xddf4('0x1'))('api');var moment=require(_0xddf4('0x2'));var BPromise=require(_0xddf4('0x3'));var rp=require(_0xddf4('0x4'));var fs=require('fs');var path=require(_0xddf4('0x5'));var rimraf=require(_0xddf4('0x6'));var config=require(_0xddf4('0x7'));var attributes=require('./faxInteraction.attributes');module['exports']=function(_0x1472f7,_0x33cca5){return _0x1472f7[_0xddf4('0x8')](_0xddf4('0x9'),attributes,{'tableName':_0xddf4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x76de3b,_0x3ab323,_0x215512){if(_0x76de3b[_0xddf4('0xb')](_0xddf4('0xc'))){_0x76de3b[_0xddf4('0xd')]=moment()['format'](_0xddf4('0xe'));}_0x215512(null,_0x76de3b);}}});}; \ No newline at end of file +var _0xabf6=['closedAt','format','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','FaxInteraction','fax_interactions'];(function(_0x5e7599,_0xe83d60){var _0x3c6efc=function(_0x57ca1d){while(--_0x57ca1d){_0x5e7599['push'](_0x5e7599['shift']());}};_0x3c6efc(++_0xe83d60);}(_0xabf6,0x1c4));var _0x6abf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xabf6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6abf('0x0'));var util=require(_0x6abf('0x1'));var logger=require(_0x6abf('0x2'))(_0x6abf('0x3'));var moment=require(_0x6abf('0x4'));var BPromise=require(_0x6abf('0x5'));var rp=require(_0x6abf('0x6'));var fs=require('fs');var path=require(_0x6abf('0x7'));var rimraf=require(_0x6abf('0x8'));var config=require(_0x6abf('0x9'));var attributes=require('./faxInteraction.attributes');module['exports']=function(_0x389f4b,_0x5490ac){return _0x389f4b[_0x6abf('0xa')](_0x6abf('0xb'),attributes,{'tableName':_0x6abf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2502cb,_0x1f8ff2,_0x2ecd99){if(_0x2502cb['changed']('closed')){_0x2502cb[_0x6abf('0xd')]=moment()[_0x6abf('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2ecd99(null,_0x2502cb);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 22d9c44..aca1121 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 _0xc8a8=['error','code','message','info','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','AddTagsToFaxInteraction','find','addTags','ids','omit','spread','AddTags','stringify','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./faxInteraction.socket','request','then','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x26d927,_0x1dab1a){var _0x3f3a39=function(_0xef1780){while(--_0xef1780){_0x26d927['push'](_0x26d927['shift']());}};_0x3f3a39(++_0x1dab1a);}(_0xc8a8,0x12d));var _0x8c8a=function(_0x212a37,_0xf35b2e){_0x212a37=_0x212a37-0x0;var _0x5d0bf9=_0xc8a8[_0x212a37];return _0x5d0bf9;};'use strict';var _=require(_0x8c8a('0x0'));var util=require(_0x8c8a('0x1'));var moment=require('moment');var BPromise=require(_0x8c8a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c8a('0x3'))['db'];var utils=require(_0x8c8a('0x4'));var logger=require(_0x8c8a('0x5'))(_0x8c8a('0x6'));var config=require(_0x8c8a('0x7'));var jayson=require(_0x8c8a('0x8'));var client=jayson[_0x8c8a('0x9')]['http']({'port':0x232a});config[_0x8c8a('0xa')]=_[_0x8c8a('0xb')](config[_0x8c8a('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x8c8a('0xc'))(new Redis(config[_0x8c8a('0xa')]));require(_0x8c8a('0xd'))['register'](socket);function respondWithRpcPromise(_0x4576f5,_0x22a198,_0x562a30){return new BPromise(function(_0x3093be,_0x39fc10){return client[_0x8c8a('0xe')](_0x4576f5,_0x562a30)[_0x8c8a('0xf')](function(_0x201003){logger['info'](_0x8c8a('0x10'),_0x22a198,_0x8c8a('0x11'));logger[_0x8c8a('0x12')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x22a198,_0x8c8a('0x11'),JSON['stringify'](_0x201003));if(_0x201003[_0x8c8a('0x13')]){if(_0x201003['error'][_0x8c8a('0x14')]===0x1f4){logger[_0x8c8a('0x13')](_0x8c8a('0x10'),_0x22a198,_0x201003[_0x8c8a('0x13')][_0x8c8a('0x15')]);return _0x39fc10(_0x201003[_0x8c8a('0x13')][_0x8c8a('0x15')]);}logger[_0x8c8a('0x13')](_0x8c8a('0x10'),_0x22a198,_0x201003[_0x8c8a('0x13')][_0x8c8a('0x15')]);return _0x3093be(_0x201003[_0x8c8a('0x13')]['message']);}else{logger[_0x8c8a('0x16')](_0x8c8a('0x10'),_0x22a198,_0x8c8a('0x11'));_0x3093be(_0x201003[_0x8c8a('0x17')]['message']);}})[_0x8c8a('0x18')](function(_0x20bacd){logger[_0x8c8a('0x13')](_0x8c8a('0x10'),_0x22a198,_0x20bacd);_0x39fc10(_0x20bacd);});});}exports[_0x8c8a('0x19')]=function(_0x47a684){var _0x33f9bb=this;return new Promise(function(_0x34f15c,_0x281e98){return db[_0x8c8a('0x1a')][_0x8c8a('0x1b')](_0x47a684[_0x8c8a('0x1c')],{'raw':_0x47a684[_0x8c8a('0x1d')]?_0x47a684[_0x8c8a('0x1d')][_0x8c8a('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47a684['options']?_0x47a684[_0x8c8a('0x1d')][_0x8c8a('0x1f')]||null:null,'attributes':_0x47a684['options']?_0x47a684[_0x8c8a('0x1d')]['attributes']||null:null,'limit':_0x47a684[_0x8c8a('0x1d')]?_0x47a684[_0x8c8a('0x1d')]['limit']||null:null})['then'](function(_0x10a615){logger[_0x8c8a('0x16')]('UpdateFaxInteraction',_0x47a684);logger[_0x8c8a('0x12')]('UpdateFaxInteraction',_0x47a684,JSON['stringify'](_0x10a615));_0x34f15c(_0x10a615);})[_0x8c8a('0x18')](function(_0x4876d5){logger['error'](_0x8c8a('0x19'),_0x4876d5['message'],_0x47a684);_0x281e98(_0x33f9bb[_0x8c8a('0x13')](0x1f4,_0x4876d5[_0x8c8a('0x15')]));});});};exports[_0x8c8a('0x20')]=function(_0x401592){return new Promise(function(_0x5a2862,_0x494059){return db[_0x8c8a('0x1a')][_0x8c8a('0x21')]({'where':_0x401592[_0x8c8a('0x1d')]?_0x401592[_0x8c8a('0x1d')][_0x8c8a('0x1f')]||null:null})[_0x8c8a('0xf')](function(_0x2abba0){if(_0x2abba0){return _0x2abba0[_0x8c8a('0x22')](_0x401592[_0x8c8a('0x1c')][_0x8c8a('0x23')],_[_0x8c8a('0x24')](_0x401592[_0x8c8a('0x1c')],['ids','id'])||{});}})[_0x8c8a('0x25')](function(_0x1c3013){logger['info'](_0x8c8a('0x26'),_0x401592);logger[_0x8c8a('0x12')](_0x8c8a('0x26'),_0x401592,JSON[_0x8c8a('0x27')](_0x1c3013));_0x5a2862(_0x1c3013);})['catch'](function(_0x485c3b){logger[_0x8c8a('0x13')](_0x8c8a('0x26'),_0x485c3b[_0x8c8a('0x15')],_0x401592);_0x494059(_this[_0x8c8a('0x13')](0x1f4,_0x485c3b[_0x8c8a('0x15')]));});});}; \ No newline at end of file +var _0xedb5=['defaults','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','UpdateFaxInteraction','body','options','raw','where','attributes','limit','AddTagsToFaxInteraction','FaxInteraction','find','addTags','ids','omit','spread','AddTags','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis'];(function(_0x58236d,_0x365c03){var _0x322688=function(_0x11a225){while(--_0x11a225){_0x58236d['push'](_0x58236d['shift']());}};_0x322688(++_0x365c03);}(_0xedb5,0x172));var _0x5edb=function(_0x40ba48,_0x421d2c){_0x40ba48=_0x40ba48-0x0;var _0xb6ace1=_0xedb5[_0x40ba48];return _0xb6ace1;};'use strict';var _=require('lodash');var util=require(_0x5edb('0x0'));var moment=require(_0x5edb('0x1'));var BPromise=require(_0x5edb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5edb('0x3'))['db'];var utils=require(_0x5edb('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x5edb('0x5'));var jayson=require(_0x5edb('0x6'));var client=jayson[_0x5edb('0x7')][_0x5edb('0x8')]({'port':0x232a});config[_0x5edb('0x9')]=_[_0x5edb('0xa')](config[_0x5edb('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5edb('0x9')]));require('./faxInteraction.socket')[_0x5edb('0xb')](socket);function respondWithRpcPromise(_0x4f6212,_0x4291d9,_0xf47731){return new BPromise(function(_0x1468a5,_0x1619ab){return client[_0x5edb('0xc')](_0x4f6212,_0xf47731)[_0x5edb('0xd')](function(_0x30b536){logger[_0x5edb('0xe')](_0x5edb('0xf'),_0x4291d9,_0x5edb('0x10'));logger[_0x5edb('0x11')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x4291d9,_0x5edb('0x10'),JSON[_0x5edb('0x12')](_0x30b536));if(_0x30b536['error']){if(_0x30b536[_0x5edb('0x13')][_0x5edb('0x14')]===0x1f4){logger[_0x5edb('0x13')](_0x5edb('0xf'),_0x4291d9,_0x30b536[_0x5edb('0x13')][_0x5edb('0x15')]);return _0x1619ab(_0x30b536[_0x5edb('0x13')][_0x5edb('0x15')]);}logger[_0x5edb('0x13')]('FaxInteraction,\x20%s,\x20%s',_0x4291d9,_0x30b536[_0x5edb('0x13')]['message']);return _0x1468a5(_0x30b536[_0x5edb('0x13')][_0x5edb('0x15')]);}else{logger[_0x5edb('0xe')]('FaxInteraction,\x20%s,\x20%s',_0x4291d9,_0x5edb('0x10'));_0x1468a5(_0x30b536['result'][_0x5edb('0x15')]);}})[_0x5edb('0x16')](function(_0x5315ad){logger[_0x5edb('0x13')](_0x5edb('0xf'),_0x4291d9,_0x5315ad);_0x1619ab(_0x5315ad);});});}exports[_0x5edb('0x17')]=function(_0x10400e){var _0x542824=this;return new Promise(function(_0x3ea2f5,_0x27aed9){return db['FaxInteraction']['update'](_0x10400e[_0x5edb('0x18')],{'raw':_0x10400e['options']?_0x10400e[_0x5edb('0x19')][_0x5edb('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10400e[_0x5edb('0x19')]?_0x10400e['options'][_0x5edb('0x1b')]||null:null,'attributes':_0x10400e[_0x5edb('0x19')]?_0x10400e[_0x5edb('0x19')][_0x5edb('0x1c')]||null:null,'limit':_0x10400e['options']?_0x10400e[_0x5edb('0x19')][_0x5edb('0x1d')]||null:null})[_0x5edb('0xd')](function(_0x314b34){logger[_0x5edb('0xe')]('UpdateFaxInteraction',_0x10400e);logger[_0x5edb('0x11')]('UpdateFaxInteraction',_0x10400e,JSON[_0x5edb('0x12')](_0x314b34));_0x3ea2f5(_0x314b34);})['catch'](function(_0x7238d6){logger[_0x5edb('0x13')](_0x5edb('0x17'),_0x7238d6[_0x5edb('0x15')],_0x10400e);_0x27aed9(_0x542824['error'](0x1f4,_0x7238d6[_0x5edb('0x15')]));});});};exports[_0x5edb('0x1e')]=function(_0x506198){return new Promise(function(_0x1c5d22,_0x5e91be){return db[_0x5edb('0x1f')][_0x5edb('0x20')]({'where':_0x506198[_0x5edb('0x19')]?_0x506198['options']['where']||null:null})['then'](function(_0x3dbeb5){if(_0x3dbeb5){return _0x3dbeb5[_0x5edb('0x21')](_0x506198[_0x5edb('0x18')][_0x5edb('0x22')],_[_0x5edb('0x23')](_0x506198[_0x5edb('0x18')],[_0x5edb('0x22'),'id'])||{});}})[_0x5edb('0x24')](function(_0x40e43a){logger[_0x5edb('0xe')]('AddTags',_0x506198);logger[_0x5edb('0x11')]('AddTags',_0x506198,JSON['stringify'](_0x40e43a));_0x1c5d22(_0x40e43a);})[_0x5edb('0x16')](function(_0x3db4c6){logger[_0x5edb('0x13')](_0x5edb('0x25'),_0x3db4c6[_0x5edb('0x15')],_0x506198);_0x5e91be(_this[_0x5edb('0x13')](0x1f4,_0x3db4c6[_0x5edb('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index c078097..15f5161 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 _0xd01a=['faxInteraction:','./faxInteraction.events','remove','emit','removeListener','register','length'];(function(_0x77e3fd,_0x2d48c0){var _0x4e0079=function(_0x2939ea){while(--_0x2939ea){_0x77e3fd['push'](_0x77e3fd['shift']());}};_0x4e0079(++_0x2d48c0);}(_0xd01a,0x189));var _0xad01=function(_0x473da2,_0x1a7aba){_0x473da2=_0x473da2-0x0;var _0x1c2168=_0xd01a[_0x473da2];return _0x1c2168;};'use strict';var FaxInteractionEvents=require(_0xad01('0x0'));var events=['save',_0xad01('0x1'),'update'];function createListener(_0x1a395a,_0x417787){return function(_0x3ff83c){_0x417787[_0xad01('0x2')](_0x1a395a,_0x3ff83c);};}function removeListener(_0xfae99e,_0x25132b){return function(){FaxInteractionEvents[_0xad01('0x3')](_0xfae99e,_0x25132b);};}exports[_0xad01('0x4')]=function(_0x56f242){for(var _0x13f24f=0x0,_0xe97075=events[_0xad01('0x5')];_0x13f24f<_0xe97075;_0x13f24f++){var _0x2715f0=events[_0x13f24f];var _0x2c2928=createListener(_0xad01('0x6')+_0x2715f0,_0x56f242);FaxInteractionEvents['on'](_0x2715f0,_0x2c2928);}}; \ No newline at end of file +var _0xbdee=['faxInteraction:','./faxInteraction.events','save','update','emit','removeListener','register','length'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbdee,0xd1));var _0xebde=function(_0x3c16f7,_0x162e28){_0x3c16f7=_0x3c16f7-0x0;var _0x528692=_0xbdee[_0x3c16f7];return _0x528692;};'use strict';var FaxInteractionEvents=require(_0xebde('0x0'));var events=[_0xebde('0x1'),'remove',_0xebde('0x2')];function createListener(_0x2e2cba,_0x2c425d){return function(_0x381b63){_0x2c425d[_0xebde('0x3')](_0x2e2cba,_0x381b63);};}function removeListener(_0x519eeb,_0x15f691){return function(){FaxInteractionEvents[_0xebde('0x4')](_0x519eeb,_0x15f691);};}exports[_0xebde('0x5')]=function(_0x2f0791){for(var _0x5743db=0x0,_0x8d4c4=events[_0xebde('0x6')];_0x5743db<_0x8d4c4;_0x5743db++){var _0x257d34=events[_0x5743db];var _0x5a21ad=createListener(_0xebde('0x7')+_0x257d34,_0x2f0791);FaxInteractionEvents['on'](_0x257d34,_0x5a21ad);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index b996bdd..cedce97 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 _0x0bd0=['/:id/download','download','post','addMessage','/:id/tags','faxinteraction:addtags','fax','faxinteraction:update','update','delete','tracked','faxinteraction:destroy','removeTags','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','index','get','isAuthenticated','describe','/:id','show','/:id/messages'];(function(_0x36c96d,_0x3d4949){var _0x496939=function(_0x4f9236){while(--_0x4f9236){_0x36c96d['push'](_0x36c96d['shift']());}};_0x496939(++_0x3d4949);}(_0x0bd0,0x194));var _0x00bd=function(_0x3b7b42,_0x31badd){_0x3b7b42=_0x3b7b42-0x0;var _0x1ebaad=_0x0bd0[_0x3b7b42];return _0x1ebaad;};'use strict';var multer=require('multer');var util=require(_0x00bd('0x0'));var path=require(_0x00bd('0x1'));var timeout=require(_0x00bd('0x2'));var express=require('express');var router=express[_0x00bd('0x3')]();var fs_extra=require(_0x00bd('0x4'));var auth=require(_0x00bd('0x5'));var interaction=require(_0x00bd('0x6'));var config=require(_0x00bd('0x7'));var controller=require(_0x00bd('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x00bd('0x9')]);router[_0x00bd('0xa')]('/describe',auth[_0x00bd('0xb')](),controller[_0x00bd('0xc')]);router[_0x00bd('0xa')](_0x00bd('0xd'),auth[_0x00bd('0xb')](),controller[_0x00bd('0xe')]);router['get'](_0x00bd('0xf'),auth['isAuthenticated'](),controller['getMessages']);router[_0x00bd('0xa')](_0x00bd('0x10'),auth[_0x00bd('0xb')](),controller[_0x00bd('0x11')]);router[_0x00bd('0x12')]('/',auth[_0x00bd('0xb')](),controller['create']);router[_0x00bd('0x12')](_0x00bd('0xf'),auth[_0x00bd('0xb')](),controller[_0x00bd('0x13')]);router[_0x00bd('0x12')](_0x00bd('0x14'),auth[_0x00bd('0xb')](),interaction['tracked']('fax',_0x00bd('0x15')),controller['addTags']);router['put'](_0x00bd('0xd'),auth['isAuthenticated'](),interaction['tracked'](_0x00bd('0x16'),_0x00bd('0x17')),controller[_0x00bd('0x18')]);router[_0x00bd('0x19')](_0x00bd('0xd'),auth['isAuthenticated'](),interaction[_0x00bd('0x1a')](_0x00bd('0x16'),_0x00bd('0x1b')),controller['destroy']);router['delete']('/:id/tags',auth['isAuthenticated'](),controller[_0x00bd('0x1c')]);module[_0x00bd('0x1d')]=router; \ No newline at end of file +var _0x8e0c=['Router','../../components/auth/service','../../components/interaction/service','./faxInteraction.controller','get','isAuthenticated','/describe','describe','show','getMessages','download','post','/:id/messages','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','put','/:id','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','removeTags','multer','path','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8e0c,0xe5));var _0xc8e0=function(_0x1a971c,_0x52bd0f){_0x1a971c=_0x1a971c-0x0;var _0x47baab=_0x8e0c[_0x1a971c];return _0x47baab;};'use strict';var multer=require(_0xc8e0('0x0'));var util=require('util');var path=require(_0xc8e0('0x1'));var timeout=require(_0xc8e0('0x2'));var express=require('express');var router=express[_0xc8e0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc8e0('0x4'));var interaction=require(_0xc8e0('0x5'));var config=require('../../config/environment');var controller=require(_0xc8e0('0x6'));router[_0xc8e0('0x7')]('/',auth[_0xc8e0('0x8')](),controller['index']);router[_0xc8e0('0x7')](_0xc8e0('0x9'),auth[_0xc8e0('0x8')](),controller[_0xc8e0('0xa')]);router[_0xc8e0('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xc8e0('0xb')]);router[_0xc8e0('0x7')]('/:id/messages',auth['isAuthenticated'](),controller[_0xc8e0('0xc')]);router[_0xc8e0('0x7')]('/:id/download',auth[_0xc8e0('0x8')](),controller[_0xc8e0('0xd')]);router[_0xc8e0('0xe')]('/',auth[_0xc8e0('0x8')](),controller['create']);router['post'](_0xc8e0('0xf'),auth[_0xc8e0('0x8')](),controller[_0xc8e0('0x10')]);router[_0xc8e0('0xe')](_0xc8e0('0x11'),auth[_0xc8e0('0x8')](),interaction[_0xc8e0('0x12')](_0xc8e0('0x13'),_0xc8e0('0x14')),controller['addTags']);router[_0xc8e0('0x15')](_0xc8e0('0x16'),auth[_0xc8e0('0x8')](),interaction['tracked']('fax',_0xc8e0('0x17')),controller[_0xc8e0('0x18')]);router[_0xc8e0('0x19')](_0xc8e0('0x16'),auth['isAuthenticated'](),interaction[_0xc8e0('0x12')]('fax',_0xc8e0('0x1a')),controller[_0xc8e0('0x1b')]);router[_0xc8e0('0x19')](_0xc8e0('0x11'),auth[_0xc8e0('0x8')](),controller[_0xc8e0('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 7f40510..494dd7d 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 _0x8128=['DATE','sequelize','medium','BOOLEAN','out','TEXT'];(function(_0x3bb6a7,_0x2eb088){var _0x2ad28a=function(_0x1dcf1a){while(--_0x1dcf1a){_0x3bb6a7['push'](_0x3bb6a7['shift']());}};_0x2ad28a(++_0x2eb088);}(_0x8128,0x1b1));var _0x8812=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x8128[_0x209941];return _0x1e8729;};'use strict';var Sequelize=require(_0x8812('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x8812('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x8812('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x8812('0x3'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x8812('0x4')],'defaultValue':null},'readAt':{'type':Sequelize[_0x8812('0x5')]}}; \ No newline at end of file +var _0x7a72=['BOOLEAN','out','exports','TEXT'];(function(_0xf854be,_0x3844cf){var _0x3e2b21=function(_0x5cfe2f){while(--_0x5cfe2f){_0xf854be['push'](_0xf854be['shift']());}};_0x3e2b21(++_0x3844cf);}(_0x7a72,0x1be));var _0x27a7=function(_0x95de44,_0x34b767){_0x95de44=_0x95de44-0x0;var _0x4da598=_0x7a72[_0x95de44];return _0x4da598;};'use strict';var Sequelize=require('sequelize');module[_0x27a7('0x0')]={'body':{'type':Sequelize[_0x27a7('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x27a7('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x27a7('0x3')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x27a7('0x1')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index e75410e..7276e80 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 _0xdd82=['../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxMessage,\x20%s,\x20%s','result','catch','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','reject','save','update','then','stack','name','send','index','map','FaxMessage','rawAttributes','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','filter','merge','type','includeAll','include','findAll','rows','params','options','find','body','destroy','describe','fax-interactions','accept','fax','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','FaxInteraction','FaxInteractionId','isNil','format','interaction','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','User','agent','email','internal','manual','interface','SIP/%s','channel','event','EventManager','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','rejectMessage','ContactId','contact','fullname','rejectmessage','create','CmContact','findOne','SendFax','FaxAccountId','basename','download','join','root','files','attachments','Attachment','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0xb645db,_0x19ae9a){var _0xb64a56=function(_0x490041){while(--_0x490041){_0xb645db['push'](_0xb645db['shift']());}};_0xb64a56(++_0x19ae9a);}(_0xdd82,0x78));var _0x2dd8=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xdd82[_0x432682];return _0x463d05;};'use strict';var emlformat=require(_0x2dd8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2dd8('0x1'));var jsonpatch=require(_0x2dd8('0x2'));var rp=require(_0x2dd8('0x3'));var moment=require(_0x2dd8('0x4'));var BPromise=require(_0x2dd8('0x5'));var Mustache=require('mustache');var util=require(_0x2dd8('0x6'));var path=require(_0x2dd8('0x7'));var sox=require(_0x2dd8('0x8'));var csv=require(_0x2dd8('0x9'));var ejs=require(_0x2dd8('0xa'));var fs=require('fs');var fs_extra=require(_0x2dd8('0xb'));var _=require('lodash');var squel=require(_0x2dd8('0xc'));var crypto=require(_0x2dd8('0xd'));var jsforce=require(_0x2dd8('0xe'));var deskjs=require(_0x2dd8('0xf'));var toCsv=require(_0x2dd8('0x9'));var querystring=require(_0x2dd8('0x10'));var Papa=require(_0x2dd8('0x11'));var Redis=require(_0x2dd8('0x12'));var authService=require(_0x2dd8('0x13'));var qs=require(_0x2dd8('0x14'));var as=require(_0x2dd8('0x15'));var hardwareService=require(_0x2dd8('0x16'));var logger=require(_0x2dd8('0x17'))(_0x2dd8('0x18'));var utils=require(_0x2dd8('0x19'));var config=require(_0x2dd8('0x1a'));var licenseUtil=require(_0x2dd8('0x1b'));var db=require('../../mysqldb')['db'];config[_0x2dd8('0x1c')]=_[_0x2dd8('0x1d')](config[_0x2dd8('0x1c')],{'host':_0x2dd8('0x1e'),'port':0x18eb});var socket=require(_0x2dd8('0x1f'))(new Redis(config[_0x2dd8('0x1c')]));require(_0x2dd8('0x20'))[_0x2dd8('0x21')](socket);var jayson=require(_0x2dd8('0x22'));var client=jayson[_0x2dd8('0x23')][_0x2dd8('0x24')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x206eaf,_0x5369c8,_0x31a936,_0x3bb879){return new BPromise(function(_0x25b5c2,_0x21d49a){var _0x4346c8=_0x3bb879||client;return _0x4346c8[_0x2dd8('0x25')](_0x206eaf,_0x31a936)['then'](function(_0x3deed3){logger[_0x2dd8('0x26')]('FaxMessage,\x20%s,\x20%s',_0x5369c8,_0x2dd8('0x27'));logger[_0x2dd8('0x28')](_0x2dd8('0x29'),_0x5369c8,_0x2dd8('0x27'),JSON[_0x2dd8('0x2a')](_0x3deed3));if(_0x3deed3[_0x2dd8('0x2b')]){if(_0x3deed3[_0x2dd8('0x2b')][_0x2dd8('0x2c')]===0x1f4){logger[_0x2dd8('0x2b')]('FaxMessage,\x20%s,\x20%s',_0x5369c8,_0x3deed3[_0x2dd8('0x2b')][_0x2dd8('0x2d')]);return _0x21d49a(_0x3deed3['error'][_0x2dd8('0x2d')]);}logger['error'](_0x2dd8('0x2e'),_0x5369c8,_0x3deed3[_0x2dd8('0x2b')]['message']);return _0x25b5c2(_0x3deed3[_0x2dd8('0x2b')][_0x2dd8('0x2d')]);}else{logger[_0x2dd8('0x26')](_0x2dd8('0x2e'),_0x5369c8,'request\x20sent');_0x25b5c2(_0x3deed3[_0x2dd8('0x2f')][_0x2dd8('0x2d')]);}})[_0x2dd8('0x30')](function(_0x35b4dd){logger[_0x2dd8('0x2b')](_0x2dd8('0x2e'),_0x5369c8,_0x35b4dd);_0x21d49a(_0x35b4dd);});});}function respondWithStatusCode(_0x2ba633,_0x1ebb5b){_0x1ebb5b=_0x1ebb5b||0xcc;return function(_0x4c0064){if(_0x4c0064){return _0x2ba633[_0x2dd8('0x31')](_0x1ebb5b);}return _0x2ba633['status'](_0x1ebb5b)[_0x2dd8('0x32')]();};}function respondWithResult(_0x33c10e,_0x186051){_0x186051=_0x186051||0xc8;return function(_0x742b45){if(_0x742b45){return _0x33c10e[_0x2dd8('0x33')](_0x186051)[_0x2dd8('0x34')](_0x742b45);}};}function respondWithFilteredResult(_0x5151a0,_0x23e00e){return function(_0x182d9f){if(_0x182d9f){var _0x47c679=typeof _0x23e00e[_0x2dd8('0x35')]===_0x2dd8('0x36')&&typeof _0x23e00e['limit']===_0x2dd8('0x36');var _0x1d14f4=_0x182d9f[_0x2dd8('0x37')];var _0x4f2bba=_0x47c679?0x0:_0x23e00e[_0x2dd8('0x35')];var _0x21ef64=_0x47c679?_0x182d9f[_0x2dd8('0x37')]:_0x23e00e[_0x2dd8('0x35')]+_0x23e00e['limit'];var _0x5c5ba0;if(_0x21ef64>=_0x1d14f4){_0x21ef64=_0x1d14f4;_0x5c5ba0=0xc8;}else{_0x5c5ba0=0xce;}_0x5151a0[_0x2dd8('0x33')](_0x5c5ba0);return _0x5151a0[_0x2dd8('0x38')](_0x2dd8('0x39'),_0x4f2bba+'-'+_0x21ef64+'/'+_0x1d14f4)[_0x2dd8('0x34')](_0x182d9f);}return null;};}function patchUpdates(_0x63f93a){return function(_0x2c8654){try{jsonpatch['apply'](_0x2c8654,_0x63f93a,!![]);}catch(_0x3ffb9f){return BPromise[_0x2dd8('0x3a')](_0x3ffb9f);}return _0x2c8654[_0x2dd8('0x3b')]();};}function saveUpdates(_0x408108,_0x1b944c){return function(_0x36c556){if(_0x36c556){return _0x36c556[_0x2dd8('0x3c')](_0x408108)[_0x2dd8('0x3d')](function(_0x4a6ad2){return _0x4a6ad2;});}return null;};}function removeEntity(_0x4eef99,_0x5b4bec){return function(_0x216f59){if(_0x216f59){return _0x216f59['destroy']()[_0x2dd8('0x3d')](function(){_0x4eef99[_0x2dd8('0x33')](0xcc)[_0x2dd8('0x32')]();});}};}function handleEntityNotFound(_0x3ce9bb,_0x437770){return function(_0x102d1d){if(!_0x102d1d){_0x3ce9bb['sendStatus'](0x194);}return _0x102d1d;};}function handleError(_0x15a513,_0x16781b){_0x16781b=_0x16781b||0x1f4;return function(_0x4802f9){logger['error'](_0x4802f9[_0x2dd8('0x3e')]);if(_0x4802f9[_0x2dd8('0x3f')]){delete _0x4802f9[_0x2dd8('0x3f')];}_0x15a513[_0x2dd8('0x33')](_0x16781b)[_0x2dd8('0x40')](_0x4802f9);};}exports[_0x2dd8('0x41')]=function(_0x3b5758,_0x5e3319){var _0x41d375={},_0x10da5c={},_0x312cb8={'count':0x0,'rows':[]};var _0x4f6c9e=_[_0x2dd8('0x42')](db[_0x2dd8('0x43')][_0x2dd8('0x44')],function(_0x28693a){return{'name':_0x28693a['fieldName'],'type':_0x28693a['type'][_0x2dd8('0x45')]};});_0x10da5c[_0x2dd8('0x46')]=_[_0x2dd8('0x42')](_0x4f6c9e,'name');_0x10da5c[_0x2dd8('0x47')]=_[_0x2dd8('0x48')](_0x3b5758['query']);_0x10da5c['filters']=_['intersection'](_0x10da5c[_0x2dd8('0x46')],_0x10da5c['query']);_0x41d375[_0x2dd8('0x49')]=_[_0x2dd8('0x4a')](_0x10da5c[_0x2dd8('0x46')],qs[_0x2dd8('0x4b')](_0x3b5758[_0x2dd8('0x47')][_0x2dd8('0x4b')]));_0x41d375['attributes']=_0x41d375[_0x2dd8('0x49')][_0x2dd8('0x4c')]?_0x41d375[_0x2dd8('0x49')]:_0x10da5c[_0x2dd8('0x46')];if(!_0x3b5758[_0x2dd8('0x47')][_0x2dd8('0x4d')](_0x2dd8('0x4e'))){_0x41d375[_0x2dd8('0x4f')]=qs[_0x2dd8('0x4f')](_0x3b5758[_0x2dd8('0x47')][_0x2dd8('0x4f')]);_0x41d375['offset']=qs['offset'](_0x3b5758['query'][_0x2dd8('0x35')]);}_0x41d375['order']=qs[_0x2dd8('0x50')](_0x3b5758[_0x2dd8('0x47')]['sort']);_0x41d375[_0x2dd8('0x51')]=qs[_0x2dd8('0x52')](_[_0x2dd8('0x53')](_0x3b5758[_0x2dd8('0x47')],_0x10da5c['filters']),_0x4f6c9e);if(_0x3b5758[_0x2dd8('0x47')][_0x2dd8('0x54')]){_0x41d375[_0x2dd8('0x51')]=_[_0x2dd8('0x55')](_0x41d375[_0x2dd8('0x51')],{'$or':_[_0x2dd8('0x42')](_0x4f6c9e,function(_0x163392){if(_0x163392[_0x2dd8('0x56')]!=='VIRTUAL'){var _0xa24479={};_0xa24479[_0x163392[_0x2dd8('0x3f')]]={'$like':'%'+_0x3b5758[_0x2dd8('0x47')][_0x2dd8('0x54')]+'%'};return _0xa24479;}})});}_0x41d375=_['merge']({},_0x41d375,_0x3b5758['options']);var _0x25a53e={'where':_0x41d375[_0x2dd8('0x51')]};return db[_0x2dd8('0x43')][_0x2dd8('0x37')](_0x25a53e)[_0x2dd8('0x3d')](function(_0xd6baa9){_0x312cb8[_0x2dd8('0x37')]=_0xd6baa9;if(_0x3b5758['query'][_0x2dd8('0x57')]){_0x41d375[_0x2dd8('0x58')]=[{'all':!![]}];}return db[_0x2dd8('0x43')][_0x2dd8('0x59')](_0x41d375);})['then'](function(_0x188e64){_0x312cb8[_0x2dd8('0x5a')]=_0x188e64;return _0x312cb8;})[_0x2dd8('0x3d')](respondWithFilteredResult(_0x5e3319,_0x41d375))[_0x2dd8('0x30')](handleError(_0x5e3319,null));};exports['show']=function(_0x25c1e3,_0x2f68c4){var _0x17d2d7={'raw':!![],'where':{'id':_0x25c1e3[_0x2dd8('0x5b')]['id']}},_0x50b162={};_0x50b162[_0x2dd8('0x46')]=_[_0x2dd8('0x48')](db[_0x2dd8('0x43')]['rawAttributes']);_0x50b162['query']=_[_0x2dd8('0x48')](_0x25c1e3[_0x2dd8('0x47')]);_0x50b162['filters']=_[_0x2dd8('0x4a')](_0x50b162[_0x2dd8('0x46')],_0x50b162[_0x2dd8('0x47')]);_0x17d2d7[_0x2dd8('0x49')]=_[_0x2dd8('0x4a')](_0x50b162[_0x2dd8('0x46')],qs[_0x2dd8('0x4b')](_0x25c1e3[_0x2dd8('0x47')][_0x2dd8('0x4b')]));_0x17d2d7[_0x2dd8('0x49')]=_0x17d2d7[_0x2dd8('0x49')][_0x2dd8('0x4c')]?_0x17d2d7['attributes']:_0x50b162['model'];if(_0x25c1e3['query'][_0x2dd8('0x57')]){_0x17d2d7['include']=[{'all':!![]}];}_0x17d2d7=_[_0x2dd8('0x55')]({},_0x17d2d7,_0x25c1e3[_0x2dd8('0x5c')]);return db[_0x2dd8('0x43')][_0x2dd8('0x5d')](_0x17d2d7)[_0x2dd8('0x3d')](handleEntityNotFound(_0x2f68c4,null))[_0x2dd8('0x3d')](respondWithResult(_0x2f68c4,null))[_0x2dd8('0x30')](handleError(_0x2f68c4,null));};exports[_0x2dd8('0x3c')]=function(_0x9ec66c,_0x341297){if(_0x9ec66c['body']['id']){delete _0x9ec66c['body']['id'];}return db[_0x2dd8('0x43')][_0x2dd8('0x5d')]({'where':{'id':_0x9ec66c[_0x2dd8('0x5b')]['id']}})['then'](handleEntityNotFound(_0x341297,null))['then'](saveUpdates(_0x9ec66c[_0x2dd8('0x5e')],null))[_0x2dd8('0x3d')](respondWithResult(_0x341297,null))[_0x2dd8('0x30')](handleError(_0x341297,null));};exports[_0x2dd8('0x5f')]=function(_0x228a1a,_0x502d83){return db['FaxMessage']['find']({'where':{'id':_0x228a1a['params']['id']}})[_0x2dd8('0x3d')](handleEntityNotFound(_0x502d83,null))[_0x2dd8('0x3d')](removeEntity(_0x502d83,null))['catch'](handleError(_0x502d83,null));};exports[_0x2dd8('0x60')]=function(_0x4bd5b6,_0x4f6c3a){return db[_0x2dd8('0x43')][_0x2dd8('0x60')]()['then'](respondWithResult(_0x4f6c3a,null))['catch'](handleError(_0x4f6c3a,null));};var interaction_log=require(_0x2dd8('0x17'))(_0x2dd8('0x61'));exports[_0x2dd8('0x62')]=function(_0x340e5f,_0x394e6f,_0x5757b5){var _0x29a780={'agent':{},'channel':_0x2dd8('0x63')};if(_0x340e5f[_0x2dd8('0x5e')]['id']){delete _0x340e5f[_0x2dd8('0x5e')]['id'];}_0x340e5f[_0x2dd8('0x5e')]['read']=!![];_0x340e5f['body'][_0x2dd8('0x64')]=moment()['format'](_0x2dd8('0x65'));_0x340e5f['body'][_0x2dd8('0x66')]=_0x340e5f['body'][_0x2dd8('0x66')]||_0x340e5f[_0x2dd8('0x67')]['id'];_0x29a780['agent']['id']=_0x340e5f['body'][_0x2dd8('0x66')];return db[_0x2dd8('0x43')][_0x2dd8('0x5d')]({'where':{'id':_0x340e5f[_0x2dd8('0x5b')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x394e6f,null))[_0x2dd8('0x3d')](saveUpdates(_0x340e5f[_0x2dd8('0x5e')],null))['then'](function(_0x84f588){if(_0x84f588){_0x29a780[_0x2dd8('0x2d')]=_0x84f588['get']({'plain':!![]});return db[_0x2dd8('0x68')]['find']({'where':{'id':_0x84f588[_0x2dd8('0x69')]}});}return null;})[_0x2dd8('0x3d')](handleEntityNotFound(_0x394e6f,null))[_0x2dd8('0x3d')](function(_0x25bc5b){if(_0x25bc5b){return _0x25bc5b[_0x2dd8('0x3c')]({'UserId':_0x340e5f['body'][_0x2dd8('0x66')],'read1stAt':_[_0x2dd8('0x6a')](_0x25bc5b['read1stAt'])?moment()[_0x2dd8('0x6b')](_0x2dd8('0x65')):undefined});}return null;})[_0x2dd8('0x3d')](function(_0x57a7c3){if(_0x57a7c3){_0x29a780[_0x2dd8('0x6c')]=_0x57a7c3[_0x2dd8('0x6d')]({'plain':!![]});interaction_log[_0x2dd8('0x26')](_0x2dd8('0x6e'),_0x340e5f[_0x2dd8('0x67')]['id'],_0x340e5f[_0x2dd8('0x67')][_0x2dd8('0x3f')],_0x340e5f[_0x2dd8('0x67')]['role'],_0x29a780['interaction']['id'],_0x340e5f[_0x2dd8('0x5e')]?JSON[_0x2dd8('0x2a')](_0x340e5f['body']):'null');return respondWithRpcPromise('AcceptMessage',_0x2dd8('0x6f'),_0x29a780);}return null;})[_0x2dd8('0x3d')](function(_0x5eb375){var _0x2c6afc=_0x2dd8('0x70')+_0x5eb375[_0x2dd8('0x2d')]['ContactId'];return db[_0x2dd8('0x71')][_0x2dd8('0x47')](_0x2c6afc,{'type':db[_0x2dd8('0x72')][_0x2dd8('0x73')]['SELECT'],'raw':!![]})[_0x2dd8('0x3d')](function(_0x55a860){return _0x55a860;});})['then'](function(_0x9be451){if(_0x9be451){_0x29a780[_0x2dd8('0x2d')]['contact']=_0x9be451[0x0];if(!_0x340e5f[_0x2dd8('0x5e')][_0x2dd8('0x66')])return;return db[_0x2dd8('0x74')][_0x2dd8('0x5d')]({'where':{'id':_0x340e5f[_0x2dd8('0x5e')][_0x2dd8('0x66')],'role':_0x2dd8('0x75')},'attributes':['id',_0x2dd8('0x3f'),'fullname',_0x2dd8('0x76'),_0x2dd8('0x77')],'raw':!![]});}return null;})[_0x2dd8('0x3d')](function(_0x29a897){if(!_0x29a897)return null;_0x29a780['message'][_0x2dd8('0x75')]=_0x29a897;return _0x29a780;})[_0x2dd8('0x3d')](function(_0x5b5f42){if(_0x5b5f42){if(_0x340e5f[_0x2dd8('0x5e')][_0x2dd8('0x78')]){_0x29a780['message'][_0x2dd8('0x79')]=util[_0x2dd8('0x6b')](_0x2dd8('0x7a'),_0x340e5f[_0x2dd8('0x67')][_0x2dd8('0x3f')]);_0x29a780[_0x2dd8('0x2d')][_0x2dd8('0x7b')]=_0x29a780['channel'];_0x29a780['message'][_0x2dd8('0x7c')]='accept';return respondWithRpcPromise(_0x2dd8('0x7d'),_0x2dd8('0x7d'),{'event':'acceptmessage','message':_0x29a780[_0x2dd8('0x2d')]},client9002)['then'](function(){return _0x29a780;});}return _0x29a780;}return null;})[_0x2dd8('0x3d')](respondWithResult(_0x394e6f,null))[_0x2dd8('0x30')](handleError(_0x394e6f,null));};var interaction_log=require('../../config/logger')(_0x2dd8('0x61'));exports[_0x2dd8('0x3a')]=function(_0xff5eb0,_0x1f9c79,_0x3f570d){var _0x2130dc={'agent':{},'channel':_0x2dd8('0x63')};if(_0xff5eb0[_0x2dd8('0x5e')]['id']){delete _0xff5eb0[_0x2dd8('0x5e')]['id'];}_0xff5eb0[_0x2dd8('0x5e')][_0x2dd8('0x66')]=_0xff5eb0['body'][_0x2dd8('0x66')]||_0xff5eb0['user']['id'];_0x2130dc['agent']['id']=_0xff5eb0[_0x2dd8('0x5e')]['UserId'];return db[_0x2dd8('0x43')][_0x2dd8('0x5d')]({'where':{'id':_0xff5eb0[_0x2dd8('0x5b')]['id'],'UserId':null}})[_0x2dd8('0x3d')](handleEntityNotFound(_0x1f9c79,null))[_0x2dd8('0x3d')](function(_0x3f74c2){if(_0x3f74c2){_0x2130dc['message']=_0x3f74c2[_0x2dd8('0x6d')]({'plain':!![]});return db[_0x2dd8('0x68')][_0x2dd8('0x5d')]({'where':{'id':_0x3f74c2[_0x2dd8('0x69')]}});}return null;})[_0x2dd8('0x3d')](handleEntityNotFound(_0x1f9c79,null))[_0x2dd8('0x3d')](function(_0x38a9c6){if(_0x38a9c6){_0x2130dc[_0x2dd8('0x6c')]=_0x38a9c6['get']({'plain':!![]});interaction_log['info'](_0x2dd8('0x7e'),_0xff5eb0[_0x2dd8('0x67')]['id'],_0xff5eb0[_0x2dd8('0x67')]['name'],_0xff5eb0[_0x2dd8('0x67')][_0x2dd8('0x7f')],_0x2130dc['interaction']['id'],_0xff5eb0[_0x2dd8('0x5e')]?JSON['stringify'](_0xff5eb0[_0x2dd8('0x5e')]):_0x2dd8('0x80'));return respondWithRpcPromise('RejectMessage',_0x2dd8('0x81'),_0x2130dc);}return null;})[_0x2dd8('0x3d')](function(_0x15ac96){var _0x347942=_0x2dd8('0x70')+_0x15ac96[_0x2dd8('0x2d')][_0x2dd8('0x82')];return db['sequelize'][_0x2dd8('0x47')](_0x347942,{'type':db[_0x2dd8('0x72')]['QueryTypes']['SELECT'],'raw':!![]})[_0x2dd8('0x3d')](function(_0x58c12d){return _0x58c12d;});})[_0x2dd8('0x3d')](function(_0x33e00c){if(_0x33e00c){_0x2130dc[_0x2dd8('0x2d')][_0x2dd8('0x83')]=_0x33e00c[0x0];if(!_0xff5eb0[_0x2dd8('0x5e')][_0x2dd8('0x66')])return;return db[_0x2dd8('0x74')][_0x2dd8('0x5d')]({'where':{'id':_0xff5eb0[_0x2dd8('0x5e')][_0x2dd8('0x66')],'role':'agent'},'attributes':['id',_0x2dd8('0x3f'),_0x2dd8('0x84'),_0x2dd8('0x76'),_0x2dd8('0x77')],'raw':!![]});}return null;})[_0x2dd8('0x3d')](function(_0x118df4){if(!_0x118df4)return null;_0x2130dc['message'][_0x2dd8('0x75')]=_0x118df4;return _0x2130dc;})[_0x2dd8('0x3d')](function(_0x371db2){if(_0x371db2){_0x371db2['message']['interface']=util[_0x2dd8('0x6b')](_0x2dd8('0x7a'),_0xff5eb0[_0x2dd8('0x67')][_0x2dd8('0x3f')]);_0x371db2['message'][_0x2dd8('0x7b')]=_0x2130dc[_0x2dd8('0x7b')];_0x371db2['message']['event']=_0x2dd8('0x3a');respondWithRpcPromise(_0x2dd8('0x7d'),_0x2dd8('0x7d'),{'event':_0x2dd8('0x85'),'message':_0x371db2[_0x2dd8('0x2d')]},client9002);return _0x2130dc;}return null;})[_0x2dd8('0x3d')](respondWithResult(_0x1f9c79,null))['catch'](handleError(_0x1f9c79,null));};exports[_0x2dd8('0x86')]=function(_0x57fca2,_0x30e720){var _0x409503;return db[_0x2dd8('0x43')]['create'](_0x57fca2[_0x2dd8('0x5e')],{})[_0x2dd8('0x3d')](function(_0x52f2c7){_0x409503=_0x52f2c7;return db[_0x2dd8('0x87')][_0x2dd8('0x88')]({'where':{'id':_0x409503[_0x2dd8('0x82')]}});})[_0x2dd8('0x3d')](function(_0x479fc5){if(_[_0x2dd8('0x6a')](_0x479fc5)){return;}else{_0x409503[_0x2dd8('0x63')]=_0x479fc5[_0x2dd8('0x63')];return db['Attachment'][_0x2dd8('0x88')]({'where':{'id':_0x409503['AttachmentId']}});}})[_0x2dd8('0x3d')](function(_0x2b2f6d){return respondWithRpcPromise(_0x2dd8('0x89'),_0x2dd8('0x89'),{'FaxAccountId':_[_0x2dd8('0x6a')](_0x57fca2[_0x2dd8('0x5e')])?undefined:_0x57fca2['body'][_0x2dd8('0x8a')],'path':_[_0x2dd8('0x6a')](_0x2b2f6d)?undefined:util[_0x2dd8('0x6b')]('/var/opt/motion2/server/files/attachments/%s',_0x2b2f6d[_0x2dd8('0x8b')]),'fax':_[_0x2dd8('0x6a')](_0x409503[_0x2dd8('0x63')])?undefined:_0x409503[_0x2dd8('0x63')],'AttachmentId':_0x409503['AttachmentId']},client9002);})['then'](respondWithResult(_0x30e720,0xc9))[_0x2dd8('0x30')](handleError(_0x30e720,null));};exports[_0x2dd8('0x8c')]=function(_0x21b104,_0x2b342f){var _0x392b2a=path[_0x2dd8('0x8d')](config[_0x2dd8('0x8e')],'server',_0x2dd8('0x8f'),_0x2dd8('0x90'));return db['FaxMessage'][_0x2dd8('0x5d')]({'where':{'id':_0x21b104[_0x2dd8('0x5b')]['id']},'include':[{'model':db[_0x2dd8('0x91')],'as':_0x2dd8('0x91')}]})[_0x2dd8('0x3d')](handleEntityNotFound(_0x2b342f,null))[_0x2dd8('0x3d')](function(_0x3cff6e){if(_0x3cff6e){return _0x2b342f[_0x2dd8('0x8c')](path[_0x2dd8('0x8d')](_0x392b2a,_0x3cff6e[_0x2dd8('0x91')]['basename']));}})[_0x2dd8('0x30')](handleError(_0x2b342f,null));}; \ No newline at end of file +var _0xd0ee=['email','internal','agent','manual','SIP/%s','channel','event','EventManager','acceptmessage','FaxInteraction','interaction','role','null','rejectMessage','User','fullname','interface','rejectmessage','create','CmContact','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','root','server','files','attachments','join','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./faxMessage.socket','client','http','then','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','FaxMessage,\x20%s,\x20%s','info','result','catch','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','reject','save','name','send','index','map','FaxMessage','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','VIRTUAL','merge','include','findAll','rows','includeAll','options','find','update','body','destroy','params','describe','../../config/logger','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','isNil','read1stAt','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact'];(function(_0x48774e,_0x291576){var _0x384e0e=function(_0x13b565){while(--_0x13b565){_0x48774e['push'](_0x48774e['shift']());}};_0x384e0e(++_0x291576);}(_0xd0ee,0x1d7));var _0xed0e=function(_0x3bb0a7,_0x4a5b6){_0x3bb0a7=_0x3bb0a7-0x0;var _0x5abf35=_0xd0ee[_0x3bb0a7];return _0x5abf35;};'use strict';var emlformat=require(_0xed0e('0x0'));var rimraf=require(_0xed0e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xed0e('0x2'));var rp=require(_0xed0e('0x3'));var moment=require(_0xed0e('0x4'));var BPromise=require(_0xed0e('0x5'));var Mustache=require(_0xed0e('0x6'));var util=require(_0xed0e('0x7'));var path=require(_0xed0e('0x8'));var sox=require(_0xed0e('0x9'));var csv=require(_0xed0e('0xa'));var ejs=require(_0xed0e('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xed0e('0xc'));var squel=require(_0xed0e('0xd'));var crypto=require('crypto');var jsforce=require(_0xed0e('0xe'));var deskjs=require(_0xed0e('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xed0e('0x10'));var Redis=require(_0xed0e('0x11'));var authService=require(_0xed0e('0x12'));var qs=require(_0xed0e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xed0e('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xed0e('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xed0e('0x16'))['db'];config['redis']=_[_0xed0e('0x17')](config['redis'],{'host':_0xed0e('0x18'),'port':0x18eb});var socket=require(_0xed0e('0x19'))(new Redis(config[_0xed0e('0x1a')]));require(_0xed0e('0x1b'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xed0e('0x1c')][_0xed0e('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x45997a,_0x6bb4a4,_0x3b24cd,_0x4ed5d5){return new BPromise(function(_0x49a77d,_0x479dc4){var _0x5048d0=_0x4ed5d5||client;return _0x5048d0['request'](_0x45997a,_0x3b24cd)[_0xed0e('0x1e')](function(_0x5d9469){logger['info']('FaxMessage,\x20%s,\x20%s',_0x6bb4a4,'request\x20sent');logger[_0xed0e('0x1f')](_0xed0e('0x20'),_0x6bb4a4,_0xed0e('0x21'),JSON[_0xed0e('0x22')](_0x5d9469));if(_0x5d9469['error']){if(_0x5d9469[_0xed0e('0x23')][_0xed0e('0x24')]===0x1f4){logger[_0xed0e('0x23')]('FaxMessage,\x20%s,\x20%s',_0x6bb4a4,_0x5d9469[_0xed0e('0x23')]['message']);return _0x479dc4(_0x5d9469[_0xed0e('0x23')][_0xed0e('0x25')]);}logger[_0xed0e('0x23')](_0xed0e('0x26'),_0x6bb4a4,_0x5d9469[_0xed0e('0x23')][_0xed0e('0x25')]);return _0x49a77d(_0x5d9469['error'][_0xed0e('0x25')]);}else{logger[_0xed0e('0x27')](_0xed0e('0x26'),_0x6bb4a4,_0xed0e('0x21'));_0x49a77d(_0x5d9469[_0xed0e('0x28')][_0xed0e('0x25')]);}})[_0xed0e('0x29')](function(_0x5846f9){logger[_0xed0e('0x23')](_0xed0e('0x26'),_0x6bb4a4,_0x5846f9);_0x479dc4(_0x5846f9);});});}function respondWithStatusCode(_0x1ff063,_0x388da8){_0x388da8=_0x388da8||0xcc;return function(_0x7ad032){if(_0x7ad032){return _0x1ff063[_0xed0e('0x2a')](_0x388da8);}return _0x1ff063[_0xed0e('0x2b')](_0x388da8)[_0xed0e('0x2c')]();};}function respondWithResult(_0x186a32,_0x109750){_0x109750=_0x109750||0xc8;return function(_0x541826){if(_0x541826){return _0x186a32[_0xed0e('0x2b')](_0x109750)[_0xed0e('0x2d')](_0x541826);}};}function respondWithFilteredResult(_0x14b95d,_0x142213){return function(_0x14276a){if(_0x14276a){var _0x3cbe03=typeof _0x142213['offset']==='undefined'&&typeof _0x142213[_0xed0e('0x2e')]===_0xed0e('0x2f');var _0x213016=_0x14276a[_0xed0e('0x30')];var _0x25c4f5=_0x3cbe03?0x0:_0x142213[_0xed0e('0x31')];var _0xe8c877=_0x3cbe03?_0x14276a['count']:_0x142213[_0xed0e('0x31')]+_0x142213['limit'];var _0x407330;if(_0xe8c877>=_0x213016){_0xe8c877=_0x213016;_0x407330=0xc8;}else{_0x407330=0xce;}_0x14b95d[_0xed0e('0x2b')](_0x407330);return _0x14b95d[_0xed0e('0x32')](_0xed0e('0x33'),_0x25c4f5+'-'+_0xe8c877+'/'+_0x213016)[_0xed0e('0x2d')](_0x14276a);}return null;};}function patchUpdates(_0xd34bf7){return function(_0x7b85da){try{jsonpatch['apply'](_0x7b85da,_0xd34bf7,!![]);}catch(_0x540d3b){return BPromise[_0xed0e('0x34')](_0x540d3b);}return _0x7b85da[_0xed0e('0x35')]();};}function saveUpdates(_0x530bd0,_0x1c1fd8){return function(_0x3b6f1e){if(_0x3b6f1e){return _0x3b6f1e['update'](_0x530bd0)[_0xed0e('0x1e')](function(_0xd80def){return _0xd80def;});}return null;};}function removeEntity(_0x553b30,_0x555fdc){return function(_0x1f2a9e){if(_0x1f2a9e){return _0x1f2a9e['destroy']()[_0xed0e('0x1e')](function(){_0x553b30[_0xed0e('0x2b')](0xcc)[_0xed0e('0x2c')]();});}};}function handleEntityNotFound(_0x244957,_0xaa64c){return function(_0x47a8a1){if(!_0x47a8a1){_0x244957[_0xed0e('0x2a')](0x194);}return _0x47a8a1;};}function handleError(_0x30cf7f,_0x4ff61f){_0x4ff61f=_0x4ff61f||0x1f4;return function(_0x34c717){logger['error'](_0x34c717['stack']);if(_0x34c717['name']){delete _0x34c717[_0xed0e('0x36')];}_0x30cf7f[_0xed0e('0x2b')](_0x4ff61f)[_0xed0e('0x37')](_0x34c717);};}exports[_0xed0e('0x38')]=function(_0x437954,_0x4175d3){var _0x54567a={},_0x46344b={},_0x62c328={'count':0x0,'rows':[]};var _0x26511a=_[_0xed0e('0x39')](db[_0xed0e('0x3a')][_0xed0e('0x3b')],function(_0x736108){return{'name':_0x736108[_0xed0e('0x3c')],'type':_0x736108[_0xed0e('0x3d')][_0xed0e('0x3e')]};});_0x46344b[_0xed0e('0x3f')]=_['map'](_0x26511a,_0xed0e('0x36'));_0x46344b[_0xed0e('0x40')]=_[_0xed0e('0x41')](_0x437954[_0xed0e('0x40')]);_0x46344b['filters']=_[_0xed0e('0x42')](_0x46344b[_0xed0e('0x3f')],_0x46344b['query']);_0x54567a[_0xed0e('0x43')]=_[_0xed0e('0x42')](_0x46344b[_0xed0e('0x3f')],qs[_0xed0e('0x44')](_0x437954[_0xed0e('0x40')][_0xed0e('0x44')]));_0x54567a[_0xed0e('0x43')]=_0x54567a['attributes'][_0xed0e('0x45')]?_0x54567a[_0xed0e('0x43')]:_0x46344b[_0xed0e('0x3f')];if(!_0x437954['query'][_0xed0e('0x46')](_0xed0e('0x47'))){_0x54567a[_0xed0e('0x2e')]=qs[_0xed0e('0x2e')](_0x437954[_0xed0e('0x40')][_0xed0e('0x2e')]);_0x54567a[_0xed0e('0x31')]=qs[_0xed0e('0x31')](_0x437954[_0xed0e('0x40')]['offset']);}_0x54567a[_0xed0e('0x48')]=qs[_0xed0e('0x49')](_0x437954[_0xed0e('0x40')]['sort']);_0x54567a['where']=qs['filters'](_[_0xed0e('0x4a')](_0x437954['query'],_0x46344b[_0xed0e('0x4b')]),_0x26511a);if(_0x437954[_0xed0e('0x40')][_0xed0e('0x4c')]){_0x54567a[_0xed0e('0x4d')]=_['merge'](_0x54567a[_0xed0e('0x4d')],{'$or':_['map'](_0x26511a,function(_0x4a1776){if(_0x4a1776['type']!==_0xed0e('0x4e')){var _0x3ae74b={};_0x3ae74b[_0x4a1776[_0xed0e('0x36')]]={'$like':'%'+_0x437954[_0xed0e('0x40')][_0xed0e('0x4c')]+'%'};return _0x3ae74b;}})});}_0x54567a=_[_0xed0e('0x4f')]({},_0x54567a,_0x437954['options']);var _0x3324a2={'where':_0x54567a[_0xed0e('0x4d')]};return db[_0xed0e('0x3a')]['count'](_0x3324a2)['then'](function(_0xd6df8c){_0x62c328['count']=_0xd6df8c;if(_0x437954['query']['includeAll']){_0x54567a[_0xed0e('0x50')]=[{'all':!![]}];}return db[_0xed0e('0x3a')][_0xed0e('0x51')](_0x54567a);})[_0xed0e('0x1e')](function(_0x2077aa){_0x62c328[_0xed0e('0x52')]=_0x2077aa;return _0x62c328;})['then'](respondWithFilteredResult(_0x4175d3,_0x54567a))[_0xed0e('0x29')](handleError(_0x4175d3,null));};exports['show']=function(_0x4eef4d,_0x57b814){var _0xa84a39={'raw':!![],'where':{'id':_0x4eef4d['params']['id']}},_0x5a78ee={};_0x5a78ee[_0xed0e('0x3f')]=_['keys'](db[_0xed0e('0x3a')][_0xed0e('0x3b')]);_0x5a78ee[_0xed0e('0x40')]=_['keys'](_0x4eef4d[_0xed0e('0x40')]);_0x5a78ee['filters']=_[_0xed0e('0x42')](_0x5a78ee['model'],_0x5a78ee['query']);_0xa84a39[_0xed0e('0x43')]=_[_0xed0e('0x42')](_0x5a78ee[_0xed0e('0x3f')],qs['fields'](_0x4eef4d['query']['fields']));_0xa84a39[_0xed0e('0x43')]=_0xa84a39[_0xed0e('0x43')][_0xed0e('0x45')]?_0xa84a39[_0xed0e('0x43')]:_0x5a78ee[_0xed0e('0x3f')];if(_0x4eef4d['query'][_0xed0e('0x53')]){_0xa84a39['include']=[{'all':!![]}];}_0xa84a39=_['merge']({},_0xa84a39,_0x4eef4d[_0xed0e('0x54')]);return db[_0xed0e('0x3a')][_0xed0e('0x55')](_0xa84a39)[_0xed0e('0x1e')](handleEntityNotFound(_0x57b814,null))['then'](respondWithResult(_0x57b814,null))['catch'](handleError(_0x57b814,null));};exports[_0xed0e('0x56')]=function(_0x2207ef,_0x4c56b9){if(_0x2207ef[_0xed0e('0x57')]['id']){delete _0x2207ef[_0xed0e('0x57')]['id'];}return db[_0xed0e('0x3a')][_0xed0e('0x55')]({'where':{'id':_0x2207ef['params']['id']}})[_0xed0e('0x1e')](handleEntityNotFound(_0x4c56b9,null))['then'](saveUpdates(_0x2207ef[_0xed0e('0x57')],null))[_0xed0e('0x1e')](respondWithResult(_0x4c56b9,null))[_0xed0e('0x29')](handleError(_0x4c56b9,null));};exports[_0xed0e('0x58')]=function(_0x105a24,_0x32f52a){return db[_0xed0e('0x3a')][_0xed0e('0x55')]({'where':{'id':_0x105a24[_0xed0e('0x59')]['id']}})[_0xed0e('0x1e')](handleEntityNotFound(_0x32f52a,null))[_0xed0e('0x1e')](removeEntity(_0x32f52a,null))[_0xed0e('0x29')](handleError(_0x32f52a,null));};exports[_0xed0e('0x5a')]=function(_0x1d37d8,_0x481c26){return db[_0xed0e('0x3a')][_0xed0e('0x5a')]()[_0xed0e('0x1e')](respondWithResult(_0x481c26,null))[_0xed0e('0x29')](handleError(_0x481c26,null));};var interaction_log=require(_0xed0e('0x5b'))(_0xed0e('0x5c'));exports[_0xed0e('0x5d')]=function(_0x46da48,_0x14a112,_0xc9c42a){var _0x122a1d={'agent':{},'channel':_0xed0e('0x5e')};if(_0x46da48[_0xed0e('0x57')]['id']){delete _0x46da48[_0xed0e('0x57')]['id'];}_0x46da48[_0xed0e('0x57')][_0xed0e('0x5f')]=!![];_0x46da48[_0xed0e('0x57')][_0xed0e('0x60')]=moment()[_0xed0e('0x61')](_0xed0e('0x62'));_0x46da48['body'][_0xed0e('0x63')]=_0x46da48[_0xed0e('0x57')][_0xed0e('0x63')]||_0x46da48[_0xed0e('0x64')]['id'];_0x122a1d['agent']['id']=_0x46da48[_0xed0e('0x57')][_0xed0e('0x63')];return db[_0xed0e('0x3a')][_0xed0e('0x55')]({'where':{'id':_0x46da48['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x14a112,null))['then'](saveUpdates(_0x46da48[_0xed0e('0x57')],null))[_0xed0e('0x1e')](function(_0x23ec64){if(_0x23ec64){_0x122a1d['message']=_0x23ec64[_0xed0e('0x65')]({'plain':!![]});return db['FaxInteraction'][_0xed0e('0x55')]({'where':{'id':_0x23ec64['FaxInteractionId']}});}return null;})[_0xed0e('0x1e')](handleEntityNotFound(_0x14a112,null))[_0xed0e('0x1e')](function(_0xa1c2bb){if(_0xa1c2bb){return _0xa1c2bb[_0xed0e('0x56')]({'UserId':_0x46da48[_0xed0e('0x57')][_0xed0e('0x63')],'read1stAt':_[_0xed0e('0x66')](_0xa1c2bb[_0xed0e('0x67')])?moment()['format'](_0xed0e('0x62')):undefined});}return null;})[_0xed0e('0x1e')](function(_0x3c15ba){if(_0x3c15ba){_0x122a1d['interaction']=_0x3c15ba[_0xed0e('0x65')]({'plain':!![]});interaction_log['info'](_0xed0e('0x68'),_0x46da48[_0xed0e('0x64')]['id'],_0x46da48[_0xed0e('0x64')][_0xed0e('0x36')],_0x46da48[_0xed0e('0x64')]['role'],_0x122a1d['interaction']['id'],_0x46da48['body']?JSON[_0xed0e('0x22')](_0x46da48[_0xed0e('0x57')]):'null');return respondWithRpcPromise(_0xed0e('0x69'),_0xed0e('0x6a'),_0x122a1d);}return null;})['then'](function(_0x207497){var _0x4f6917=_0xed0e('0x6b')+_0x207497[_0xed0e('0x25')][_0xed0e('0x6c')];return db[_0xed0e('0x6d')][_0xed0e('0x40')](_0x4f6917,{'type':db[_0xed0e('0x6e')]['QueryTypes'][_0xed0e('0x6f')],'raw':!![]})[_0xed0e('0x1e')](function(_0x250f8d){return _0x250f8d;});})[_0xed0e('0x1e')](function(_0x31b4dc){if(_0x31b4dc){_0x122a1d[_0xed0e('0x25')][_0xed0e('0x70')]=_0x31b4dc[0x0];if(!_0x46da48[_0xed0e('0x57')][_0xed0e('0x63')])return;return db['User']['find']({'where':{'id':_0x46da48[_0xed0e('0x57')][_0xed0e('0x63')],'role':'agent'},'attributes':['id','name','fullname',_0xed0e('0x71'),_0xed0e('0x72')],'raw':!![]});}return null;})[_0xed0e('0x1e')](function(_0x1965fc){if(!_0x1965fc)return null;_0x122a1d[_0xed0e('0x25')][_0xed0e('0x73')]=_0x1965fc;return _0x122a1d;})['then'](function(_0x5de18c){if(_0x5de18c){if(_0x46da48['body'][_0xed0e('0x74')]){_0x122a1d[_0xed0e('0x25')]['interface']=util['format'](_0xed0e('0x75'),_0x46da48[_0xed0e('0x64')]['name']);_0x122a1d['message'][_0xed0e('0x76')]=_0x122a1d[_0xed0e('0x76')];_0x122a1d[_0xed0e('0x25')][_0xed0e('0x77')]=_0xed0e('0x5d');return respondWithRpcPromise(_0xed0e('0x78'),_0xed0e('0x78'),{'event':_0xed0e('0x79'),'message':_0x122a1d[_0xed0e('0x25')]},client9002)[_0xed0e('0x1e')](function(){return _0x122a1d;});}return _0x122a1d;}return null;})[_0xed0e('0x1e')](respondWithResult(_0x14a112,null))[_0xed0e('0x29')](handleError(_0x14a112,null));};var interaction_log=require(_0xed0e('0x5b'))(_0xed0e('0x5c'));exports[_0xed0e('0x34')]=function(_0x3a541d,_0xa759a8,_0x2ae6cf){var _0x396bf1={'agent':{},'channel':_0xed0e('0x5e')};if(_0x3a541d[_0xed0e('0x57')]['id']){delete _0x3a541d[_0xed0e('0x57')]['id'];}_0x3a541d[_0xed0e('0x57')]['UserId']=_0x3a541d['body'][_0xed0e('0x63')]||_0x3a541d[_0xed0e('0x64')]['id'];_0x396bf1[_0xed0e('0x73')]['id']=_0x3a541d[_0xed0e('0x57')][_0xed0e('0x63')];return db['FaxMessage'][_0xed0e('0x55')]({'where':{'id':_0x3a541d[_0xed0e('0x59')]['id'],'UserId':null}})[_0xed0e('0x1e')](handleEntityNotFound(_0xa759a8,null))[_0xed0e('0x1e')](function(_0x516a16){if(_0x516a16){_0x396bf1['message']=_0x516a16[_0xed0e('0x65')]({'plain':!![]});return db[_0xed0e('0x7a')][_0xed0e('0x55')]({'where':{'id':_0x516a16['FaxInteractionId']}});}return null;})[_0xed0e('0x1e')](handleEntityNotFound(_0xa759a8,null))[_0xed0e('0x1e')](function(_0x3a6797){if(_0x3a6797){_0x396bf1[_0xed0e('0x7b')]=_0x3a6797[_0xed0e('0x65')]({'plain':!![]});interaction_log[_0xed0e('0x27')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3a541d[_0xed0e('0x64')]['id'],_0x3a541d[_0xed0e('0x64')][_0xed0e('0x36')],_0x3a541d[_0xed0e('0x64')][_0xed0e('0x7c')],_0x396bf1['interaction']['id'],_0x3a541d[_0xed0e('0x57')]?JSON[_0xed0e('0x22')](_0x3a541d['body']):_0xed0e('0x7d'));return respondWithRpcPromise('RejectMessage',_0xed0e('0x7e'),_0x396bf1);}return null;})[_0xed0e('0x1e')](function(_0x58d388){var _0x3059d0='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x58d388['message']['ContactId'];return db[_0xed0e('0x6d')][_0xed0e('0x40')](_0x3059d0,{'type':db[_0xed0e('0x6e')]['QueryTypes'][_0xed0e('0x6f')],'raw':!![]})[_0xed0e('0x1e')](function(_0x5f08ce){return _0x5f08ce;});})[_0xed0e('0x1e')](function(_0x1f6f9e){if(_0x1f6f9e){_0x396bf1['message'][_0xed0e('0x70')]=_0x1f6f9e[0x0];if(!_0x3a541d[_0xed0e('0x57')][_0xed0e('0x63')])return;return db[_0xed0e('0x7f')]['find']({'where':{'id':_0x3a541d[_0xed0e('0x57')]['UserId'],'role':_0xed0e('0x73')},'attributes':['id',_0xed0e('0x36'),_0xed0e('0x80'),_0xed0e('0x71'),'internal'],'raw':!![]});}return null;})[_0xed0e('0x1e')](function(_0x1ed82c){if(!_0x1ed82c)return null;_0x396bf1[_0xed0e('0x25')][_0xed0e('0x73')]=_0x1ed82c;return _0x396bf1;})[_0xed0e('0x1e')](function(_0x82a0f){if(_0x82a0f){_0x82a0f[_0xed0e('0x25')][_0xed0e('0x81')]=util['format'](_0xed0e('0x75'),_0x3a541d[_0xed0e('0x64')][_0xed0e('0x36')]);_0x82a0f[_0xed0e('0x25')][_0xed0e('0x76')]=_0x396bf1[_0xed0e('0x76')];_0x82a0f[_0xed0e('0x25')][_0xed0e('0x77')]=_0xed0e('0x34');respondWithRpcPromise(_0xed0e('0x78'),_0xed0e('0x78'),{'event':_0xed0e('0x82'),'message':_0x82a0f[_0xed0e('0x25')]},client9002);return _0x396bf1;}return null;})[_0xed0e('0x1e')](respondWithResult(_0xa759a8,null))[_0xed0e('0x29')](handleError(_0xa759a8,null));};exports[_0xed0e('0x83')]=function(_0x5a9db3,_0x165428){var _0x10902e;return db['FaxMessage']['create'](_0x5a9db3[_0xed0e('0x57')],{})[_0xed0e('0x1e')](function(_0x416e0c){_0x10902e=_0x416e0c;return db[_0xed0e('0x84')][_0xed0e('0x85')]({'where':{'id':_0x10902e['ContactId']}});})[_0xed0e('0x1e')](function(_0x5c32e0){if(_[_0xed0e('0x66')](_0x5c32e0)){return;}else{_0x10902e[_0xed0e('0x5e')]=_0x5c32e0[_0xed0e('0x5e')];return db[_0xed0e('0x86')][_0xed0e('0x85')]({'where':{'id':_0x10902e[_0xed0e('0x87')]}});}})[_0xed0e('0x1e')](function(_0x3029b7){return respondWithRpcPromise(_0xed0e('0x88'),_0xed0e('0x88'),{'FaxAccountId':_[_0xed0e('0x66')](_0x5a9db3['body'])?undefined:_0x5a9db3[_0xed0e('0x57')][_0xed0e('0x89')],'path':_[_0xed0e('0x66')](_0x3029b7)?undefined:util[_0xed0e('0x61')](_0xed0e('0x8a'),_0x3029b7[_0xed0e('0x8b')]),'fax':_[_0xed0e('0x66')](_0x10902e[_0xed0e('0x5e')])?undefined:_0x10902e[_0xed0e('0x5e')],'AttachmentId':_0x10902e[_0xed0e('0x87')]},client9002);})[_0xed0e('0x1e')](respondWithResult(_0x165428,0xc9))[_0xed0e('0x29')](handleError(_0x165428,null));};exports[_0xed0e('0x8c')]=function(_0xfa0177,_0x253b1b){var _0x6284a0=path['join'](config[_0xed0e('0x8d')],_0xed0e('0x8e'),_0xed0e('0x8f'),_0xed0e('0x90'));return db[_0xed0e('0x3a')][_0xed0e('0x55')]({'where':{'id':_0xfa0177['params']['id']},'include':[{'model':db[_0xed0e('0x86')],'as':_0xed0e('0x86')}]})['then'](handleEntityNotFound(_0x253b1b,null))[_0xed0e('0x1e')](function(_0x5f0c67){if(_0x5f0c67){return _0x253b1b[_0xed0e('0x8c')](path[_0xed0e('0x91')](_0x6284a0,_0x5f0c67[_0xed0e('0x86')][_0xed0e('0x8b')]));}})[_0xed0e('0x29')](handleError(_0x253b1b,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 4fb72df..2784c88 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 _0xcd05=['exports','events','save','update','remove','hook'];(function(_0x248908,_0x327298){var _0xf49687=function(_0x39f133){while(--_0x39f133){_0x248908['push'](_0x248908['shift']());}};_0xf49687(++_0x327298);}(_0xcd05,0x163));var _0x5cd0=function(_0x31a576,_0x424419){_0x31a576=_0x31a576-0x0;var _0x30b1d3=_0xcd05[_0x31a576];return _0x30b1d3;};'use strict';var EventEmitter=require(_0x5cd0('0x0'));var FaxMessage=require('../../mysqldb')['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5cd0('0x1'),'afterUpdate':_0x5cd0('0x2'),'afterDestroy':_0x5cd0('0x3')};function emitEvent(_0x35dfb3){return function(_0x48e5ac,_0x33b92d,_0x2d88ed){FaxMessageEvents['emit'](_0x35dfb3+':'+_0x48e5ac['id'],_0x48e5ac);FaxMessageEvents['emit'](_0x35dfb3,_0x48e5ac);_0x2d88ed(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x5cd0('0x4')](e,emitEvent(event));}}module[_0x5cd0('0x5')]=FaxMessageEvents; \ No newline at end of file +var _0x2cd0=['exports','events','../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','emit','hook'];(function(_0x3e771d,_0x73cd7d){var _0x164f90=function(_0x4829c4){while(--_0x4829c4){_0x3e771d['push'](_0x3e771d['shift']());}};_0x164f90(++_0x73cd7d);}(_0x2cd0,0x10f));var _0x02cd=function(_0x3c4087,_0x5c764b){_0x3c4087=_0x3c4087-0x0;var _0x23ad1f=_0x2cd0[_0x3c4087];return _0x23ad1f;};'use strict';var EventEmitter=require(_0x02cd('0x0'));var FaxMessage=require(_0x02cd('0x1'))['db'][_0x02cd('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x02cd('0x3')](0x0);var events={'afterCreate':_0x02cd('0x4'),'afterUpdate':_0x02cd('0x5'),'afterDestroy':_0x02cd('0x6')};function emitEvent(_0x215b17){return function(_0x4fecc3,_0x3dfd49,_0x3c4a73){FaxMessageEvents[_0x02cd('0x7')](_0x215b17+':'+_0x4fecc3['id'],_0x4fecc3);FaxMessageEvents[_0x02cd('0x7')](_0x215b17,_0x4fecc3);_0x3c4a73(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x02cd('0x8')](e,emitEvent(event));}}module[_0x02cd('0x9')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index c8fd490..69aaad0 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 _0x3454=['FaxInteractionId','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','direction','toLowerCase','out','isNil','UserId','FaxInteraction','findOne'];(function(_0x7cdb1,_0x5f41b3){var _0xf4b640=function(_0x408709){while(--_0x408709){_0x7cdb1['push'](_0x7cdb1['shift']());}};_0xf4b640(++_0x5f41b3);}(_0x3454,0xd8));var _0x4345=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3454[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4345('0x0'));var util=require(_0x4345('0x1'));var logger=require('../../config/logger')(_0x4345('0x2'));var moment=require(_0x4345('0x3'));var BPromise=require(_0x4345('0x4'));var rp=require(_0x4345('0x5'));var fs=require('fs');var path=require(_0x4345('0x6'));var rimraf=require(_0x4345('0x7'));var config=require(_0x4345('0x8'));var attributes=require('./faxMessage.attributes');module[_0x4345('0x9')]=function(_0x203550,_0x3fa656){return _0x203550[_0x4345('0xa')](_0x4345('0xb'),attributes,{'tableName':_0x4345('0xc'),'paranoid':![],'indexes':[{'name':_0x4345('0xd'),'fields':[_0x4345('0xe')],'type':_0x4345('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x215ba9,_0x5ea459,_0x3ec8dc){var _0x54caa0=_0x203550[_0x4345('0x10')];var _0x58eedb=_0x215ba9['get']({'plain':!![]});if(_0x58eedb[_0x4345('0x11')][_0x4345('0x12')]()==='in'||_0x58eedb[_0x4345('0x11')][_0x4345('0x12')]()===_0x4345('0x13')&&!_0x58eedb['secret']&&!_[_0x4345('0x14')](_0x58eedb[_0x4345('0x15')])){_0x54caa0[_0x4345('0x16')][_0x4345('0x17')]({'where':{'id':_0x58eedb[_0x4345('0x18')]}})['then'](function(_0x2b9861){if(_0x2b9861){_0x2b9861[_0x4345('0x19')]({'lastMsgAt':_0x58eedb[_0x4345('0x1a')],'lastMsgDirection':_0x58eedb[_0x4345('0x11')][_0x4345('0x12')]()});}})[_0x4345('0x1b')](function(_0x21632a){console[_0x4345('0x1c')](_0x21632a);});}_0x3ec8dc();}},'charset':'utf8mb4','collate':_0x4345('0x1d')});}; \ No newline at end of file +var _0xf372=['FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','findOne','update','createdAt','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','fti_fax_messages','body'];(function(_0x37b937,_0x15d276){var _0x35c013=function(_0x4d98a1){while(--_0x4d98a1){_0x37b937['push'](_0x37b937['shift']());}};_0x35c013(++_0x15d276);}(_0xf372,0x8a));var _0x2f37=function(_0x406ccc,_0x13ffd3){_0x406ccc=_0x406ccc-0x0;var _0x18df06=_0xf372[_0x406ccc];return _0x18df06;};'use strict';var _=require(_0x2f37('0x0'));var util=require(_0x2f37('0x1'));var logger=require('../../config/logger')(_0x2f37('0x2'));var moment=require(_0x2f37('0x3'));var BPromise=require(_0x2f37('0x4'));var rp=require(_0x2f37('0x5'));var fs=require('fs');var path=require(_0x2f37('0x6'));var rimraf=require(_0x2f37('0x7'));var config=require(_0x2f37('0x8'));var attributes=require('./faxMessage.attributes');module['exports']=function(_0x286a2c,_0x200bdb){return _0x286a2c[_0x2f37('0x9')]('FaxMessage',attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x2f37('0xa'),'fields':[_0x2f37('0xb')],'type':_0x2f37('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xef8263,_0x368f99,_0x1ef89a){var _0x86dbb1=_0x286a2c[_0x2f37('0xd')];var _0x36ab71=_0xef8263['get']({'plain':!![]});if(_0x36ab71[_0x2f37('0xe')][_0x2f37('0xf')]()==='in'||_0x36ab71[_0x2f37('0xe')][_0x2f37('0xf')]()===_0x2f37('0x10')&&!_0x36ab71[_0x2f37('0x11')]&&!_[_0x2f37('0x12')](_0x36ab71[_0x2f37('0x13')])){_0x86dbb1[_0x2f37('0x14')][_0x2f37('0x15')]({'where':{'id':_0x36ab71['FaxInteractionId']}})['then'](function(_0x4f42e0){if(_0x4f42e0){_0x4f42e0[_0x2f37('0x16')]({'lastMsgAt':_0x36ab71[_0x2f37('0x17')],'lastMsgDirection':_0x36ab71[_0x2f37('0xe')][_0x2f37('0xf')]()});}})['catch'](function(_0x4bfb51){console['error'](_0x4bfb51);});}_0x1ef89a();}},'charset':'utf8mb4','collate':_0x2f37('0x18')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index c994ae8..d3ce222 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 _0x55e0=['moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./faxMessage.socket','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateFaxMessage','FaxMessage','create','body','options','raw','then','UpdateFaxMessage','update','where','attributes','limit','lodash','util'];(function(_0xc13ba,_0xcfb661){var _0xc790f9=function(_0x365a3c){while(--_0x365a3c){_0xc13ba['push'](_0xc13ba['shift']());}};_0xc790f9(++_0xcfb661);}(_0x55e0,0xdc));var _0x055e=function(_0x255227,_0x2063b0){_0x255227=_0x255227-0x0;var _0x43a3e4=_0x55e0[_0x255227];return _0x43a3e4;};'use strict';var _=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var moment=require(_0x055e('0x2'));var BPromise=require(_0x055e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x055e('0x4'))['db'];var utils=require(_0x055e('0x5'));var logger=require(_0x055e('0x6'))(_0x055e('0x7'));var config=require(_0x055e('0x8'));var jayson=require(_0x055e('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x055e('0xa')]=_['defaults'](config[_0x055e('0xa')],{'host':_0x055e('0xb'),'port':0x18eb});var socket=require(_0x055e('0xc'))(new Redis(config[_0x055e('0xa')]));require(_0x055e('0xd'))['register'](socket);function respondWithRpcPromise(_0x40779c,_0xd67814,_0xb816c){return new BPromise(function(_0xa0d384,_0x238068){return client['request'](_0x40779c,_0xb816c)['then'](function(_0x187cce){logger['info'](_0x055e('0xe'),_0xd67814,_0x055e('0xf'));logger[_0x055e('0x10')](_0x055e('0x11'),_0xd67814,_0x055e('0xf'),JSON[_0x055e('0x12')](_0x187cce));if(_0x187cce[_0x055e('0x13')]){if(_0x187cce['error'][_0x055e('0x14')]===0x1f4){logger[_0x055e('0x13')](_0x055e('0xe'),_0xd67814,_0x187cce[_0x055e('0x13')][_0x055e('0x15')]);return _0x238068(_0x187cce['error'][_0x055e('0x15')]);}logger[_0x055e('0x13')](_0x055e('0xe'),_0xd67814,_0x187cce['error'][_0x055e('0x15')]);return _0xa0d384(_0x187cce[_0x055e('0x13')][_0x055e('0x15')]);}else{logger[_0x055e('0x16')](_0x055e('0xe'),_0xd67814,'request\x20sent');_0xa0d384(_0x187cce[_0x055e('0x17')][_0x055e('0x15')]);}})[_0x055e('0x18')](function(_0x2ed6fb){logger['error'](_0x055e('0xe'),_0xd67814,_0x2ed6fb);_0x238068(_0x2ed6fb);});});}exports[_0x055e('0x19')]=function(_0x58e44a){var _0xe2b7b5=this;return new Promise(function(_0x4412f9,_0x10258f){return db[_0x055e('0x1a')][_0x055e('0x1b')](_0x58e44a[_0x055e('0x1c')],{'raw':_0x58e44a['options']?_0x58e44a[_0x055e('0x1d')][_0x055e('0x1e')]===undefined?!![]:![]:!![]})[_0x055e('0x1f')](function(_0x5930ff){logger[_0x055e('0x16')](_0x055e('0x19'),_0x58e44a);logger[_0x055e('0x10')](_0x055e('0x19'),_0x58e44a,JSON['stringify'](_0x5930ff));_0x4412f9(_0x5930ff);})[_0x055e('0x18')](function(_0x56c372){logger[_0x055e('0x13')](_0x055e('0x19'),_0x56c372[_0x055e('0x15')],_0x58e44a);_0x10258f(_0xe2b7b5[_0x055e('0x13')](0x1f4,_0x56c372[_0x055e('0x15')]));});});};exports[_0x055e('0x20')]=function(_0x58caf9){var _0x2fb49b=this;return new Promise(function(_0x1f90a9,_0x2a82f8){return db['FaxMessage'][_0x055e('0x21')](_0x58caf9[_0x055e('0x1c')],{'raw':_0x58caf9[_0x055e('0x1d')]?_0x58caf9[_0x055e('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58caf9[_0x055e('0x1d')]?_0x58caf9['options'][_0x055e('0x22')]||null:null,'attributes':_0x58caf9[_0x055e('0x1d')]?_0x58caf9[_0x055e('0x1d')][_0x055e('0x23')]||null:null,'limit':_0x58caf9[_0x055e('0x1d')]?_0x58caf9['options'][_0x055e('0x24')]||null:null})[_0x055e('0x1f')](function(_0x293062){logger[_0x055e('0x16')](_0x055e('0x20'),_0x58caf9);logger[_0x055e('0x10')](_0x055e('0x20'),_0x58caf9,JSON[_0x055e('0x12')](_0x293062));_0x1f90a9(_0x293062);})['catch'](function(_0x26d1c2){logger[_0x055e('0x13')]('UpdateFaxMessage',_0x26d1c2[_0x055e('0x15')],_0x58caf9);_0x2a82f8(_0x2fb49b[_0x055e('0x13')](0x1f4,_0x26d1c2[_0x055e('0x15')]));});});}; \ No newline at end of file +var _0xdace=['FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','FaxMessage','create','body','options','raw','CreateFaxMessage','UpdateFaxMessage','update','attributes','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','./faxMessage.socket','register','then','FaxMessage,\x20%s,\x20%s','debug'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xdace,0xc5));var _0xedac=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xdace[_0x36eaaa];return _0x461349;};'use strict';var _=require(_0xedac('0x0'));var util=require('util');var moment=require(_0xedac('0x1'));var BPromise=require(_0xedac('0x2'));var rs=require(_0xedac('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xedac('0x4'))['db'];var utils=require(_0xedac('0x5'));var logger=require(_0xedac('0x6'))(_0xedac('0x7'));var config=require('../../config/environment');var jayson=require(_0xedac('0x8'));var client=jayson[_0xedac('0x9')][_0xedac('0xa')]({'port':0x232a});config['redis']=_[_0xedac('0xb')](config[_0xedac('0xc')],{'host':_0xedac('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xedac('0xc')]));require(_0xedac('0xe'))[_0xedac('0xf')](socket);function respondWithRpcPromise(_0x4af030,_0x5e188c,_0x144368){return new BPromise(function(_0x2ea11d,_0x57e1bf){return client['request'](_0x4af030,_0x144368)[_0xedac('0x10')](function(_0x25395d){logger['info'](_0xedac('0x11'),_0x5e188c,'request\x20sent');logger[_0xedac('0x12')](_0xedac('0x13'),_0x5e188c,_0xedac('0x14'),JSON[_0xedac('0x15')](_0x25395d));if(_0x25395d[_0xedac('0x16')]){if(_0x25395d[_0xedac('0x16')][_0xedac('0x17')]===0x1f4){logger[_0xedac('0x16')]('FaxMessage,\x20%s,\x20%s',_0x5e188c,_0x25395d[_0xedac('0x16')][_0xedac('0x18')]);return _0x57e1bf(_0x25395d[_0xedac('0x16')][_0xedac('0x18')]);}logger[_0xedac('0x16')]('FaxMessage,\x20%s,\x20%s',_0x5e188c,_0x25395d[_0xedac('0x16')]['message']);return _0x2ea11d(_0x25395d[_0xedac('0x16')][_0xedac('0x18')]);}else{logger[_0xedac('0x19')](_0xedac('0x11'),_0x5e188c,'request\x20sent');_0x2ea11d(_0x25395d['result'][_0xedac('0x18')]);}})[_0xedac('0x1a')](function(_0x25fe64){logger[_0xedac('0x16')]('FaxMessage,\x20%s,\x20%s',_0x5e188c,_0x25fe64);_0x57e1bf(_0x25fe64);});});}exports['CreateFaxMessage']=function(_0x2b2ae9){var _0x17766c=this;return new Promise(function(_0x23c609,_0xcc1605){return db[_0xedac('0x1b')][_0xedac('0x1c')](_0x2b2ae9[_0xedac('0x1d')],{'raw':_0x2b2ae9[_0xedac('0x1e')]?_0x2b2ae9['options'][_0xedac('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x29cd40){logger[_0xedac('0x19')]('CreateFaxMessage',_0x2b2ae9);logger[_0xedac('0x12')](_0xedac('0x20'),_0x2b2ae9,JSON[_0xedac('0x15')](_0x29cd40));_0x23c609(_0x29cd40);})[_0xedac('0x1a')](function(_0x6b13ca){logger[_0xedac('0x16')]('CreateFaxMessage',_0x6b13ca[_0xedac('0x18')],_0x2b2ae9);_0xcc1605(_0x17766c[_0xedac('0x16')](0x1f4,_0x6b13ca[_0xedac('0x18')]));});});};exports[_0xedac('0x21')]=function(_0x1ff33e){var _0x453a3c=this;return new Promise(function(_0x40ba53,_0x26c6f7){return db[_0xedac('0x1b')][_0xedac('0x22')](_0x1ff33e['body'],{'raw':_0x1ff33e[_0xedac('0x1e')]?_0x1ff33e[_0xedac('0x1e')][_0xedac('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ff33e['options']?_0x1ff33e[_0xedac('0x1e')]['where']||null:null,'attributes':_0x1ff33e['options']?_0x1ff33e[_0xedac('0x1e')][_0xedac('0x23')]||null:null,'limit':_0x1ff33e[_0xedac('0x1e')]?_0x1ff33e[_0xedac('0x1e')]['limit']||null:null})['then'](function(_0xe813e6){logger[_0xedac('0x19')](_0xedac('0x21'),_0x1ff33e);logger[_0xedac('0x12')](_0xedac('0x21'),_0x1ff33e,JSON[_0xedac('0x15')](_0xe813e6));_0x40ba53(_0xe813e6);})[_0xedac('0x1a')](function(_0x483233){logger[_0xedac('0x16')](_0xedac('0x21'),_0x483233[_0xedac('0x18')],_0x1ff33e);_0x26c6f7(_0x453a3c['error'](0x1f4,_0x483233[_0xedac('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index a486423..625cc45 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 _0x625c=['removeListener','length','faxMessage:','./faxMessage.events','save','remove','emit'];(function(_0x4ce79f,_0x19e1bc){var _0x368d3a=function(_0x51f5a7){while(--_0x51f5a7){_0x4ce79f['push'](_0x4ce79f['shift']());}};_0x368d3a(++_0x19e1bc);}(_0x625c,0x7a));var _0xc625=function(_0x326e7d,_0x21d0ec){_0x326e7d=_0x326e7d-0x0;var _0x58596a=_0x625c[_0x326e7d];return _0x58596a;};'use strict';var FaxMessageEvents=require(_0xc625('0x0'));var events=[_0xc625('0x1'),_0xc625('0x2'),'update'];function createListener(_0x190b6f,_0x2a671e){return function(_0x4a6cfe){_0x2a671e[_0xc625('0x3')](_0x190b6f,_0x4a6cfe);};}function removeListener(_0xc746,_0x67ce88){return function(){FaxMessageEvents[_0xc625('0x4')](_0xc746,_0x67ce88);};}exports['register']=function(_0x3b2ae4){for(var _0x42ff81=0x0,_0xe2031d=events[_0xc625('0x5')];_0x42ff81<_0xe2031d;_0x42ff81++){var _0x1e014a=events[_0x42ff81];var _0x567c6b=createListener(_0xc625('0x6')+_0x1e014a,_0x3b2ae4);FaxMessageEvents['on'](_0x1e014a,_0x567c6b);}}; \ No newline at end of file +var _0x8064=['./faxMessage.events','removeListener','register','length','faxMessage:'];(function(_0x2c24df,_0x2e46a3){var _0x309b15=function(_0x5d525b){while(--_0x5d525b){_0x2c24df['push'](_0x2c24df['shift']());}};_0x309b15(++_0x2e46a3);}(_0x8064,0xcd));var _0x4806=function(_0x3da607,_0x28d205){_0x3da607=_0x3da607-0x0;var _0x4935ba=_0x8064[_0x3da607];return _0x4935ba;};'use strict';var FaxMessageEvents=require(_0x4806('0x0'));var events=['save','remove','update'];function createListener(_0x5e366e,_0x2ac58f){return function(_0x46ff15){_0x2ac58f['emit'](_0x5e366e,_0x46ff15);};}function removeListener(_0x37d4b7,_0x4f359b){return function(){FaxMessageEvents[_0x4806('0x1')](_0x37d4b7,_0x4f359b);};}exports[_0x4806('0x2')]=function(_0x466ba3){for(var _0x445559=0x0,_0x12de98=events[_0x4806('0x3')];_0x445559<_0x12de98;_0x445559++){var _0x4a33a4=events[_0x445559];var _0x12cfaa=createListener(_0x4806('0x4')+_0x4a33a4,_0x466ba3);FaxMessageEvents['on'](_0x4a33a4,_0x12cfaa);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 201ba81..350d5cf 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 _0x3140=['download','post','tracked','fax','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','/:id'];(function(_0x101205,_0x1c818c){var _0x262f1d=function(_0x527591){while(--_0x527591){_0x101205['push'](_0x101205['shift']());}};_0x262f1d(++_0x1c818c);}(_0x3140,0xaf));var _0x0314=function(_0x264609,_0x7609b9){_0x264609=_0x264609-0x0;var _0x1f38b9=_0x3140[_0x264609];return _0x1f38b9;};'use strict';var multer=require(_0x0314('0x0'));var util=require(_0x0314('0x1'));var path=require(_0x0314('0x2'));var timeout=require(_0x0314('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0314('0x4'));var auth=require(_0x0314('0x5'));var interaction=require(_0x0314('0x6'));var config=require(_0x0314('0x7'));var controller=require(_0x0314('0x8'));router[_0x0314('0x9')]('/',auth[_0x0314('0xa')](),controller[_0x0314('0xb')]);router[_0x0314('0x9')](_0x0314('0xc'),auth[_0x0314('0xa')](),controller['describe']);router[_0x0314('0x9')](_0x0314('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x0314('0x9')]('/:id/download',auth[_0x0314('0xa')](),controller[_0x0314('0xe')]);router[_0x0314('0xf')]('/',auth[_0x0314('0xa')](),interaction[_0x0314('0x10')](_0x0314('0x11'),'faxmessage:create'),controller[_0x0314('0x12')]);router[_0x0314('0x13')](_0x0314('0xd'),auth[_0x0314('0xa')](),controller[_0x0314('0x14')]);router[_0x0314('0x13')](_0x0314('0x15'),auth['isAuthenticated'](),controller[_0x0314('0x16')]);router[_0x0314('0x13')](_0x0314('0x17'),auth[_0x0314('0xa')](),controller[_0x0314('0x18')]);router[_0x0314('0x19')](_0x0314('0xd'),auth[_0x0314('0xa')](),controller['destroy']);module[_0x0314('0x1a')]=router; \ No newline at end of file +var _0x878f=['update','/:id/accept','accept','/:id/reject','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','/describe','/:id','/:id/download','isAuthenticated','post','fax','create','put'];(function(_0x151721,_0x20d5bc){var _0x2deaa7=function(_0x499812){while(--_0x499812){_0x151721['push'](_0x151721['shift']());}};_0x2deaa7(++_0x20d5bc);}(_0x878f,0x173));var _0xf878=function(_0x22600e,_0x3a071f){_0x22600e=_0x22600e-0x0;var _0x3c0bc5=_0x878f[_0x22600e];return _0x3c0bc5;};'use strict';var multer=require('multer');var util=require(_0xf878('0x0'));var path=require(_0xf878('0x1'));var timeout=require(_0xf878('0x2'));var express=require(_0xf878('0x3'));var router=express[_0xf878('0x4')]();var fs_extra=require(_0xf878('0x5'));var auth=require(_0xf878('0x6'));var interaction=require(_0xf878('0x7'));var config=require(_0xf878('0x8'));var controller=require(_0xf878('0x9'));router[_0xf878('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf878('0xa')](_0xf878('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xf878('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xf878('0xa')](_0xf878('0xd'),auth[_0xf878('0xe')](),controller['download']);router[_0xf878('0xf')]('/',auth[_0xf878('0xe')](),interaction['tracked'](_0xf878('0x10'),'faxmessage:create'),controller[_0xf878('0x11')]);router[_0xf878('0x12')](_0xf878('0xc'),auth['isAuthenticated'](),controller[_0xf878('0x13')]);router[_0xf878('0x12')](_0xf878('0x14'),auth['isAuthenticated'](),controller[_0xf878('0x15')]);router[_0xf878('0x12')](_0xf878('0x16'),auth['isAuthenticated'](),controller['reject']);router[_0xf878('0x17')](_0xf878('0xc'),auth[_0xf878('0xe')](),controller[_0xf878('0x18')]);module[_0xf878('0x19')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 56e1924..af07984 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 _0x3446=['exports','name','STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x2cd607,_0x4ed15f){var _0xdca7f1=function(_0x44c962){while(--_0x44c962){_0x2cd607['push'](_0x2cd607['shift']());}};_0xdca7f1(++_0x4ed15f);}(_0x3446,0xbc));var _0x6344=function(_0x470495,_0x518d3a){_0x470495=_0x470495-0x0;var _0x5734e5=_0x3446[_0x470495];return _0x5734e5;};'use strict';var Sequelize=require(_0x6344('0x0'));module[_0x6344('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x6344('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6344('0x3')]},'timeout':{'type':Sequelize[_0x6344('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6344('0x5')](_0x6344('0x6'),_0x6344('0x7'),_0x6344('0x8')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x6344('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7cf6=['STRING','name','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0x7cf6,0x125));var _0x67cf=function(_0x3fd75c,_0x5d9d25){_0x3fd75c=_0x3fd75c-0x0;var _0x3bf054=_0x7cf6[_0x3fd75c];return _0x3bf054;};'use strict';var Sequelize=require(_0x67cf('0x0'));module['exports']={'name':{'type':Sequelize[_0x67cf('0x1')],'unique':_0x67cf('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x67cf('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x67cf('0x3')](_0x67cf('0x4'),_0x67cf('0x5'),_0x67cf('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 330bb78..b1ea36b 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 _0x3aa1=['transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','TeamId','includes','isEmpty','removeAgents','addAgents','omit','spread','isArray','userFaxQueue:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxQueue.socket','status','end','json','offset','limit','count','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','index','map','FaxQueue','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','show','params','keys','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxQueues','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','UserFaxQueue','findAndCountAll','UserId','agent','faxPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','findOne','Team','addTeams','ids','User','voicePause','interface','flatMap','Agents'];(function(_0x10bb45,_0xa57a18){var _0x4f1846=function(_0x319b89){while(--_0x319b89){_0x10bb45['push'](_0x10bb45['shift']());}};_0x4f1846(++_0xa57a18);}(_0x3aa1,0x137));var _0x13aa=function(_0x396f95,_0x7e74b8){_0x396f95=_0x396f95-0x0;var _0x20f7d0=_0x3aa1[_0x396f95];return _0x20f7d0;};'use strict';var emlformat=require(_0x13aa('0x0'));var rimraf=require(_0x13aa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x13aa('0x2'));var rp=require(_0x13aa('0x3'));var moment=require(_0x13aa('0x4'));var BPromise=require(_0x13aa('0x5'));var Mustache=require(_0x13aa('0x6'));var util=require(_0x13aa('0x7'));var path=require(_0x13aa('0x8'));var sox=require(_0x13aa('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x13aa('0xa'));var _=require(_0x13aa('0xb'));var squel=require(_0x13aa('0xc'));var crypto=require(_0x13aa('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x13aa('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x13aa('0xf'));var Redis=require('ioredis');var authService=require(_0x13aa('0x10'));var qs=require(_0x13aa('0x11'));var as=require(_0x13aa('0x12'));var hardwareService=require(_0x13aa('0x13'));var logger=require(_0x13aa('0x14'))(_0x13aa('0x15'));var utils=require(_0x13aa('0x16'));var config=require(_0x13aa('0x17'));var licenseUtil=require(_0x13aa('0x18'));var db=require(_0x13aa('0x19'))['db'];config[_0x13aa('0x1a')]=_[_0x13aa('0x1b')](config[_0x13aa('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x13aa('0x1c'))(new Redis(config[_0x13aa('0x1a')]));require(_0x13aa('0x1d'))['register'](socket);function respondWithStatusCode(_0x4b84a6,_0x1bf8c6){_0x1bf8c6=_0x1bf8c6||0xcc;return function(_0x37756f){if(_0x37756f){return _0x4b84a6['sendStatus'](_0x1bf8c6);}return _0x4b84a6[_0x13aa('0x1e')](_0x1bf8c6)[_0x13aa('0x1f')]();};}function respondWithResult(_0x22e38f,_0x17695a){_0x17695a=_0x17695a||0xc8;return function(_0x19a73b){if(_0x19a73b){return _0x22e38f['status'](_0x17695a)[_0x13aa('0x20')](_0x19a73b);}};}function respondWithFilteredResult(_0x4034e1,_0xeeafef){return function(_0x58172d){if(_0x58172d){var _0x1a2bdc=typeof _0xeeafef[_0x13aa('0x21')]==='undefined'&&typeof _0xeeafef[_0x13aa('0x22')]==='undefined';var _0x21960c=_0x58172d[_0x13aa('0x23')];var _0x138d02=_0x1a2bdc?0x0:_0xeeafef['offset'];var _0x14187a=_0x1a2bdc?_0x58172d[_0x13aa('0x23')]:_0xeeafef[_0x13aa('0x21')]+_0xeeafef[_0x13aa('0x22')];var _0x2ac199;if(_0x14187a>=_0x21960c){_0x14187a=_0x21960c;_0x2ac199=0xc8;}else{_0x2ac199=0xce;}_0x4034e1[_0x13aa('0x1e')](_0x2ac199);return _0x4034e1['set'](_0x13aa('0x24'),_0x138d02+'-'+_0x14187a+'/'+_0x21960c)[_0x13aa('0x20')](_0x58172d);}return null;};}function patchUpdates(_0x3de7b8){return function(_0x5b720e){try{jsonpatch['apply'](_0x5b720e,_0x3de7b8,!![]);}catch(_0x21d76b){return BPromise[_0x13aa('0x25')](_0x21d76b);}return _0x5b720e[_0x13aa('0x26')]();};}function saveUpdates(_0x480890,_0x14515c){return function(_0x55a114){if(_0x55a114){return _0x55a114[_0x13aa('0x27')](_0x480890)[_0x13aa('0x28')](function(_0x151c8f){return _0x151c8f;});}return null;};}function removeEntity(_0x482640,_0x1fe325){return function(_0x59b5d5){if(_0x59b5d5){return _0x59b5d5[_0x13aa('0x29')]()['then'](function(){var _0x119436=_0x59b5d5[_0x13aa('0x2a')]({'plain':!![]});var _0xe16f8d='FaxQueues';return db[_0x13aa('0x2b')][_0x13aa('0x29')]({'where':{'type':_0xe16f8d,'resourceId':_0x119436['id']}})[_0x13aa('0x28')](function(){return _0x59b5d5;});})[_0x13aa('0x28')](function(){_0x482640[_0x13aa('0x1e')](0xcc)[_0x13aa('0x1f')]();});}};}function handleEntityNotFound(_0x54a0ae,_0x1222c0){return function(_0x1f753d){if(!_0x1f753d){_0x54a0ae[_0x13aa('0x2c')](0x194);}return _0x1f753d;};}function handleError(_0x1a17cd,_0x285861){_0x285861=_0x285861||0x1f4;return function(_0x3918ea){logger[_0x13aa('0x2d')](_0x3918ea[_0x13aa('0x2e')]);if(_0x3918ea[_0x13aa('0x2f')]){delete _0x3918ea[_0x13aa('0x2f')];}_0x1a17cd['status'](_0x285861)['send'](_0x3918ea);};}exports[_0x13aa('0x30')]=function(_0x35546e,_0x1191a0){var _0x2cada6={},_0x41a7bb={},_0x2d275e={'count':0x0,'rows':[]};var _0x1df832=_[_0x13aa('0x31')](db[_0x13aa('0x32')][_0x13aa('0x33')],function(_0x2ecf46){return{'name':_0x2ecf46[_0x13aa('0x34')],'type':_0x2ecf46[_0x13aa('0x35')][_0x13aa('0x36')]};});_0x41a7bb[_0x13aa('0x37')]=_['map'](_0x1df832,_0x13aa('0x2f'));_0x41a7bb[_0x13aa('0x38')]=_['keys'](_0x35546e[_0x13aa('0x38')]);_0x41a7bb[_0x13aa('0x39')]=_['intersection'](_0x41a7bb[_0x13aa('0x37')],_0x41a7bb[_0x13aa('0x38')]);_0x2cada6[_0x13aa('0x3a')]=_[_0x13aa('0x3b')](_0x41a7bb[_0x13aa('0x37')],qs[_0x13aa('0x3c')](_0x35546e['query'][_0x13aa('0x3c')]));_0x2cada6[_0x13aa('0x3a')]=_0x2cada6[_0x13aa('0x3a')][_0x13aa('0x3d')]?_0x2cada6[_0x13aa('0x3a')]:_0x41a7bb[_0x13aa('0x37')];if(!_0x35546e[_0x13aa('0x38')][_0x13aa('0x3e')](_0x13aa('0x3f'))){_0x2cada6['limit']=qs[_0x13aa('0x22')](_0x35546e['query']['limit']);_0x2cada6[_0x13aa('0x21')]=qs[_0x13aa('0x21')](_0x35546e['query'][_0x13aa('0x21')]);}_0x2cada6[_0x13aa('0x40')]=qs[_0x13aa('0x41')](_0x35546e['query'][_0x13aa('0x41')]);_0x2cada6[_0x13aa('0x42')]=qs['filters'](_[_0x13aa('0x43')](_0x35546e[_0x13aa('0x38')],_0x41a7bb[_0x13aa('0x39')]),_0x1df832);if(_0x35546e[_0x13aa('0x38')][_0x13aa('0x44')]){_0x2cada6[_0x13aa('0x42')]=_[_0x13aa('0x45')](_0x2cada6[_0x13aa('0x42')],{'$or':_['map'](_0x1df832,function(_0x225bc4){if(_0x225bc4[_0x13aa('0x35')]!=='VIRTUAL'){var _0x439ee6={};_0x439ee6[_0x225bc4[_0x13aa('0x2f')]]={'$like':'%'+_0x35546e[_0x13aa('0x38')][_0x13aa('0x44')]+'%'};return _0x439ee6;}})});}_0x2cada6=_[_0x13aa('0x45')]({},_0x2cada6,_0x35546e['options']);var _0x253122={'where':_0x2cada6[_0x13aa('0x42')]};return db[_0x13aa('0x32')][_0x13aa('0x23')](_0x253122)[_0x13aa('0x28')](function(_0x45b618){_0x2d275e[_0x13aa('0x23')]=_0x45b618;if(_0x35546e[_0x13aa('0x38')][_0x13aa('0x46')]){_0x2cada6[_0x13aa('0x47')]=[{'all':!![]}];}return db['FaxQueue'][_0x13aa('0x48')](_0x2cada6);})['then'](function(_0x2aba7e){_0x2d275e[_0x13aa('0x49')]=_0x2aba7e;return _0x2d275e;})[_0x13aa('0x28')](respondWithFilteredResult(_0x1191a0,_0x2cada6))['catch'](handleError(_0x1191a0,null));};exports[_0x13aa('0x4a')]=function(_0x5e8b55,_0x26b091){var _0x4cd00c={'raw':!![],'where':{'id':_0x5e8b55[_0x13aa('0x4b')]['id']}},_0x439e06={};_0x439e06[_0x13aa('0x37')]=_[_0x13aa('0x4c')](db['FaxQueue'][_0x13aa('0x33')]);_0x439e06[_0x13aa('0x38')]=_[_0x13aa('0x4c')](_0x5e8b55[_0x13aa('0x38')]);_0x439e06[_0x13aa('0x39')]=_['intersection'](_0x439e06[_0x13aa('0x37')],_0x439e06[_0x13aa('0x38')]);_0x4cd00c[_0x13aa('0x3a')]=_[_0x13aa('0x3b')](_0x439e06[_0x13aa('0x37')],qs[_0x13aa('0x3c')](_0x5e8b55['query'][_0x13aa('0x3c')]));_0x4cd00c[_0x13aa('0x3a')]=_0x4cd00c[_0x13aa('0x3a')][_0x13aa('0x3d')]?_0x4cd00c[_0x13aa('0x3a')]:_0x439e06[_0x13aa('0x37')];if(_0x5e8b55[_0x13aa('0x38')]['includeAll']){_0x4cd00c[_0x13aa('0x47')]=[{'all':!![]}];}_0x4cd00c=_[_0x13aa('0x45')]({},_0x4cd00c,_0x5e8b55[_0x13aa('0x4d')]);return db[_0x13aa('0x32')][_0x13aa('0x4e')](_0x4cd00c)['then'](handleEntityNotFound(_0x26b091,null))[_0x13aa('0x28')](respondWithResult(_0x26b091,null))[_0x13aa('0x4f')](handleError(_0x26b091,null));};exports['create']=function(_0x5f585a,_0x10e527){return db[_0x13aa('0x32')][_0x13aa('0x50')](_0x5f585a[_0x13aa('0x51')],{})[_0x13aa('0x28')](function(_0x16c6dc){var _0x2b2cc2=_0x5f585a[_0x13aa('0x52')][_0x13aa('0x2a')]({'plain':!![]});if(!_0x2b2cc2)throw new Error(_0x13aa('0x53'));if(_0x2b2cc2[_0x13aa('0x54')]==='user'){var _0x4ed44e=_0x16c6dc['get']({'plain':!![]});var _0xdb20d3=_0x13aa('0x55');return db['UserProfileSection'][_0x13aa('0x4e')]({'where':{'name':_0xdb20d3,'userProfileId':_0x2b2cc2[_0x13aa('0x56')]},'raw':!![]})[_0x13aa('0x28')](function(_0x247ca7){if(_0x247ca7&&_0x247ca7['autoAssociation']===0x0){return db[_0x13aa('0x2b')][_0x13aa('0x50')]({'name':_0x4ed44e[_0x13aa('0x2f')],'resourceId':_0x4ed44e['id'],'type':_0x247ca7[_0x13aa('0x2f')],'sectionId':_0x247ca7['id']},{})[_0x13aa('0x28')](function(){return _0x16c6dc;});}else{return _0x16c6dc;}})['catch'](function(_0x17a603){logger[_0x13aa('0x2d')](_0x13aa('0x57'),_0x17a603);throw _0x17a603;});}return _0x16c6dc;})['then'](respondWithResult(_0x10e527,0xc9))[_0x13aa('0x4f')](handleError(_0x10e527,null));};exports[_0x13aa('0x27')]=function(_0x52a8df,_0x1beaa1){if(_0x52a8df[_0x13aa('0x51')]['id']){delete _0x52a8df[_0x13aa('0x51')]['id'];}return db[_0x13aa('0x32')][_0x13aa('0x4e')]({'where':{'id':_0x52a8df[_0x13aa('0x4b')]['id']}})[_0x13aa('0x28')](handleEntityNotFound(_0x1beaa1,null))['then'](saveUpdates(_0x52a8df['body'],null))[_0x13aa('0x28')](respondWithResult(_0x1beaa1,null))[_0x13aa('0x4f')](handleError(_0x1beaa1,null));};exports[_0x13aa('0x29')]=function(_0x481b0c,_0x36f87e){return db[_0x13aa('0x32')]['find']({'where':{'id':_0x481b0c['params']['id']}})[_0x13aa('0x28')](handleEntityNotFound(_0x36f87e,null))['then'](removeEntity(_0x36f87e,null))['catch'](handleError(_0x36f87e,null));};exports[_0x13aa('0x58')]=function(_0x57b86e,_0x14a1c3){return db[_0x13aa('0x32')][_0x13aa('0x58')]()[_0x13aa('0x28')](respondWithResult(_0x14a1c3,null))[_0x13aa('0x4f')](handleError(_0x14a1c3,null));};exports['getMembers']=function(_0x27efad,_0x350d1b,_0x40b1e8){var _0x23342b={'raw':!![],'where':{}},_0x16ab46={},_0x41acf9;return db[_0x13aa('0x32')]['findOne']({'where':{'id':_0x27efad[_0x13aa('0x4b')]['id']}})[_0x13aa('0x28')](handleEntityNotFound(_0x350d1b,null))['then'](function(_0x208baa){if(_0x208baa){_0x41acf9=_0x208baa[_0x13aa('0x2a')]({'plain':!![]});_0x16ab46['model']=_['keys'](db['UserFaxQueue'][_0x13aa('0x33')]);_0x16ab46['query']=_[_0x13aa('0x4c')](_0x27efad['query']);_0x16ab46[_0x13aa('0x39')]=_[_0x13aa('0x3b')](_0x16ab46[_0x13aa('0x37')],_0x16ab46[_0x13aa('0x38')]);_0x23342b[_0x13aa('0x3a')]=_[_0x13aa('0x3b')](_0x16ab46[_0x13aa('0x37')],qs[_0x13aa('0x3c')](_0x27efad['query'][_0x13aa('0x3c')]));_0x23342b[_0x13aa('0x3a')]=_0x23342b[_0x13aa('0x3a')][_0x13aa('0x3d')]?_0x23342b['attributes']:_0x16ab46[_0x13aa('0x37')];if(!_0x27efad['query'][_0x13aa('0x3e')](_0x13aa('0x3f'))){_0x23342b[_0x13aa('0x22')]=qs[_0x13aa('0x22')](_0x27efad[_0x13aa('0x38')][_0x13aa('0x22')]);_0x23342b[_0x13aa('0x21')]=qs[_0x13aa('0x21')](_0x27efad[_0x13aa('0x38')][_0x13aa('0x21')]);}_0x23342b[_0x13aa('0x40')]=qs[_0x13aa('0x41')](_0x27efad[_0x13aa('0x38')][_0x13aa('0x41')]);_0x23342b[_0x13aa('0x42')]=qs[_0x13aa('0x39')](_[_0x13aa('0x43')](_0x27efad['query'],_0x16ab46[_0x13aa('0x39')]));_0x23342b[_0x13aa('0x42')]['FaxQueueId']=_0x208baa['id'];if(_0x27efad[_0x13aa('0x38')][_0x13aa('0x44')]){_0x23342b[_0x13aa('0x42')]=_[_0x13aa('0x45')](_0x23342b['where'],{'$or':_[_0x13aa('0x31')](_0x23342b[_0x13aa('0x3a')],function(_0x50ac1c){var _0xe0945e={};_0xe0945e[_0x50ac1c]={'$like':'%'+_0x27efad[_0x13aa('0x38')][_0x13aa('0x44')]+'%'};return _0xe0945e;})});}_0x23342b=_[_0x13aa('0x45')]({},_0x23342b,_0x27efad[_0x13aa('0x4d')]);return db[_0x13aa('0x59')]['findAll'](_0x23342b);}})['then'](function(_0x1d200c){if(_0x1d200c){return db['User'][_0x13aa('0x5a')]({'where':{'id':_[_0x13aa('0x31')](_0x1d200c,_0x13aa('0x5b')),'role':_0x13aa('0x5c')},'attributes':['id',_0x13aa('0x2f'),_0x13aa('0x5d'),'updatedAt',_0x13aa('0x5e')]});}})[_0x13aa('0x28')](function(_0x4e89c9){if(_0x4e89c9){return{'count':_0x4e89c9['count'],'rows':_['map'](_0x4e89c9[_0x13aa('0x49')],function(_0x52e72e){return{'membername':_0x52e72e[_0x13aa('0x2f')],'UserId':_0x52e72e['id'],'queue_name':_0x41acf9[_0x13aa('0x2f')],'FaxQueueId':_0x41acf9['id'],'interface':util[_0x13aa('0x5f')](_0x13aa('0x60'),_0x13aa('0x61'),_0x52e72e[_0x13aa('0x2f')]),'penalty':0x0,'paused':_0x52e72e[_0x13aa('0x5d')],'createdAt':_0x52e72e[_0x13aa('0x5e')],'updatedAt':_0x52e72e[_0x13aa('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x13aa('0x28')](respondWithFilteredResult(_0x350d1b,_0x23342b))[_0x13aa('0x4f')](handleError(_0x350d1b,null));};exports[_0x13aa('0x63')]=function(_0x14360b,_0x1e3dc2,_0x1dd93d){var _0x1eb797={};var _0x53c6cd={};var _0x28b062;var _0x3b0ff3;return db[_0x13aa('0x32')][_0x13aa('0x64')]({'where':{'id':_0x14360b[_0x13aa('0x4b')]['id']}})[_0x13aa('0x28')](handleEntityNotFound(_0x1e3dc2,null))['then'](function(_0x60d5aa){if(_0x60d5aa){_0x28b062=_0x60d5aa;_0x53c6cd[_0x13aa('0x37')]=_[_0x13aa('0x4c')](db[_0x13aa('0x65')]['rawAttributes']);_0x53c6cd[_0x13aa('0x38')]=_['keys'](_0x14360b[_0x13aa('0x38')]);_0x53c6cd[_0x13aa('0x39')]=_[_0x13aa('0x3b')](_0x53c6cd[_0x13aa('0x37')],_0x53c6cd[_0x13aa('0x38')]);_0x1eb797['attributes']=_[_0x13aa('0x3b')](_0x53c6cd[_0x13aa('0x37')],qs[_0x13aa('0x3c')](_0x14360b['query'][_0x13aa('0x3c')]));_0x1eb797['attributes']=_0x1eb797[_0x13aa('0x3a')][_0x13aa('0x3d')]?_0x1eb797[_0x13aa('0x3a')]:_0x53c6cd['model'];_0x1eb797['order']=qs['sort'](_0x14360b[_0x13aa('0x38')]['sort']);_0x1eb797[_0x13aa('0x42')]=qs['filters'](_['pick'](_0x14360b[_0x13aa('0x38')],_0x53c6cd[_0x13aa('0x39')]));if(_0x14360b['query'][_0x13aa('0x44')]){_0x1eb797[_0x13aa('0x42')]=_[_0x13aa('0x45')](_0x1eb797['where'],{'$or':_['map'](_0x1eb797[_0x13aa('0x3a')],function(_0x2c83dd){var _0xa82cd1={};_0xa82cd1[_0x2c83dd]={'$like':'%'+_0x14360b[_0x13aa('0x38')][_0x13aa('0x44')]+'%'};return _0xa82cd1;})});}_0x1eb797=_[_0x13aa('0x45')]({},_0x1eb797,_0x14360b[_0x13aa('0x4d')]);return _0x28b062[_0x13aa('0x63')](_0x1eb797);}})[_0x13aa('0x28')](function(_0x5b9987){if(_0x5b9987){_0x3b0ff3=_0x5b9987['length'];if(!_0x14360b[_0x13aa('0x38')]['hasOwnProperty'](_0x13aa('0x3f'))){_0x1eb797[_0x13aa('0x22')]=qs[_0x13aa('0x22')](_0x14360b[_0x13aa('0x38')][_0x13aa('0x22')]);_0x1eb797[_0x13aa('0x21')]=qs[_0x13aa('0x21')](_0x14360b[_0x13aa('0x38')][_0x13aa('0x21')]);}return _0x28b062[_0x13aa('0x63')](_0x1eb797);}})['then'](function(_0x10d4a3){if(_0x10d4a3){return _0x10d4a3?{'count':_0x3b0ff3,'rows':_0x10d4a3}:null;}})[_0x13aa('0x28')](respondWithResult(_0x1e3dc2,null))[_0x13aa('0x4f')](handleError(_0x1e3dc2,null));};exports[_0x13aa('0x66')]=function(_0x5589e8,_0x2ec0cc,_0x3b36a1){var _0x3897ad=_0x5589e8[_0x13aa('0x51')][_0x13aa('0x67')];return db[_0x13aa('0x65')]['findAll']({'where':{'id':_0x3897ad},'attributes':['id'],'include':[{'model':db[_0x13aa('0x68')],'as':'Agents','attributes':['id',_0x13aa('0x2f'),'online',_0x13aa('0x69'),_0x13aa('0x6a')],'raw':!![]}]})[_0x13aa('0x28')](function(_0x1ec55f){if(_0x1ec55f){var _0x2c4385=_[_0x13aa('0x6b')](_0x1ec55f,function(_0x5577fc){var _0x5876ca=_0x5577fc[_0x13aa('0x2a')]({'plain':!![]});return _0x5876ca[_0x13aa('0x6c')];});return db[_0x13aa('0x32')][_0x13aa('0x4e')]({'where':{'id':_0x5589e8['params']['id']}})[_0x13aa('0x28')](function(_0x1d11bc){return db['sequelize'][_0x13aa('0x6d')](function(_0x3927f2){return _0x1d11bc[_0x13aa('0x66')](_0x3897ad,{'transaction':_0x3927f2})['then'](function(){return BPromise[_0x13aa('0x6e')](_0x2c4385,function(_0x52e64f){return db[_0x13aa('0x59')][_0x13aa('0x6f')]({'where':{'UserId':_0x52e64f['id'],'FaxQueueId':_0x5589e8[_0x13aa('0x4b')]['id']},'transaction':_0x3927f2});});})[_0x13aa('0x28')](function(){_0x2c4385[_0x13aa('0x70')](function(_0x57f0fe){socket[_0x13aa('0x71')](_0x13aa('0x72'),{'UserId':_0x57f0fe['id'],'FaxQueueId':_0x1d11bc['id']});});});});});}})[_0x13aa('0x28')](respondWithStatusCode(_0x2ec0cc,null))[_0x13aa('0x4f')](handleError(_0x2ec0cc,null));};exports[_0x13aa('0x73')]=function(_0x1fdd81,_0x38fc56,_0x30c188){return db[_0x13aa('0x65')][_0x13aa('0x48')]({'where':{'id':_0x1fdd81['query'][_0x13aa('0x67')]},'attributes':['id'],'include':[{'model':db[_0x13aa('0x68')],'as':_0x13aa('0x6c'),'attributes':['id'],'raw':!![]}]})[_0x13aa('0x28')](handleEntityNotFound(_0x38fc56,null))['then'](function(_0x3d3bd6){var _0xca112=_[_0x13aa('0x31')](_0x3d3bd6,'id');var _0x362beb=[];var _0x306c14=[];var _0x4c40f6=squel[_0x13aa('0x74')]();_0x4c40f6[_0x13aa('0x75')](_0x13aa('0x76'))[_0x13aa('0x77')]('team_has_fax_queues','tq')[_0x13aa('0x78')]('user_has_teams','ut',_0x13aa('0x79'))[_0x13aa('0x42')](_0x13aa('0x7a'),_0x1fdd81[_0x13aa('0x4b')]['id']);for(var _0xf75e8b=0x0;_0xf75e8b<_0x3d3bd6['length'];_0xf75e8b+=0x1){let _0x2f6907=_0x3d3bd6[_0xf75e8b];for(var _0x31da48=0x0;_0x31da48<_0x2f6907[_0x13aa('0x6c')]['length'];_0x31da48+=0x1){let _0x3ca505=_0x2f6907[_0x13aa('0x6c')][_0x31da48];var _0x548dc2=_0x4c40f6[_0x13aa('0x7b')]();_0x548dc2['where'](_0x13aa('0x7c'),_0x3ca505['id']);_0x306c14[_0x13aa('0x7d')](db['sequelize'][_0x13aa('0x38')](_0x548dc2['toString'](),{'type':db[_0x13aa('0x7e')][_0x13aa('0x7f')][_0x13aa('0x80')]})[_0x13aa('0x28')](function(_0x4bb0e2){if(_0x4bb0e2[_0x13aa('0x3d')]===0x1){return _0x3ca505['id'];}else{var _0x59e2cc=_[_0x13aa('0x81')](_[_0x13aa('0x31')](_0x4bb0e2,_0x13aa('0x82')),function(_0x584d57){return _[_0x13aa('0x83')](_0xca112,_0x584d57);});if(_0x59e2cc){return _0x3ca505['id'];}}}));}}return BPromise['all'](_0x306c14)[_0x13aa('0x28')](function(_0x82613b){_0x362beb=_(_0x362beb)['union'](_0x82613b)['compact']()['value']();return db[_0x13aa('0x32')]['find']({'where':{'id':_0x1fdd81[_0x13aa('0x4b')]['id']}})[_0x13aa('0x28')](function(_0x1daa7e){return db[_0x13aa('0x7e')][_0x13aa('0x6d')](function(_0x3d3abb){return _0x1daa7e[_0x13aa('0x73')](_0x1fdd81[_0x13aa('0x38')][_0x13aa('0x67')],{'transaction':_0x3d3abb})[_0x13aa('0x28')](function(){if(!_[_0x13aa('0x84')](_0x362beb)){return _0x1daa7e[_0x13aa('0x85')](_0x362beb,{'transaction':_0x3d3abb});}})[_0x13aa('0x28')](function(){_0x362beb[_0x13aa('0x70')](function(_0x31c096){socket[_0x13aa('0x71')]('userFaxQueue:remove',{'UserId':_0x31c096,'FaxQueueId':_0x1daa7e['id']});});});});});});})[_0x13aa('0x28')](respondWithStatusCode(_0x38fc56,null))['catch'](handleError(_0x38fc56,null));};exports[_0x13aa('0x86')]=function(_0x117e41,_0x30b9b5,_0x35fc1f){return db['FaxQueue'][_0x13aa('0x4e')]({'where':{'id':_0x117e41['params']['id']}})[_0x13aa('0x28')](handleEntityNotFound(_0x30b9b5,null))['then'](function(_0x1e54b8){if(_0x1e54b8){return _0x1e54b8[_0x13aa('0x86')](_0x117e41[_0x13aa('0x51')]['ids'],_[_0x13aa('0x87')](_0x117e41['body'],[_0x13aa('0x67'),'id'])||{})[_0x13aa('0x88')](function(_0x2d4d5e){for(var _0x2b01ab=0x0;_0x2b01ab<_0x117e41[_0x13aa('0x51')]['ids'][_0x13aa('0x3d')];_0x2b01ab+=0x1){socket[_0x13aa('0x71')](_0x13aa('0x72'),{'UserId':Number(_0x117e41['body'][_0x13aa('0x67')][_0x2b01ab]),'FaxQueueId':Number(_0x117e41[_0x13aa('0x4b')]['id'])});}return _0x2d4d5e;});}})[_0x13aa('0x28')](respondWithResult(_0x30b9b5,null))[_0x13aa('0x4f')](handleError(_0x30b9b5,null));};exports[_0x13aa('0x85')]=function(_0x30d3af,_0x194ec1,_0x34752c){return db[_0x13aa('0x32')][_0x13aa('0x4e')]({'where':{'id':_0x30d3af[_0x13aa('0x4b')]['id']}})[_0x13aa('0x28')](handleEntityNotFound(_0x194ec1,null))['then'](function(_0x24bd1b){if(_0x24bd1b){return _0x24bd1b[_0x13aa('0x85')](_0x30d3af[_0x13aa('0x38')][_0x13aa('0x67')])['then'](function(){if(_[_0x13aa('0x89')](_0x30d3af['query'][_0x13aa('0x67')])){for(var _0x362cc5=0x0;_0x362cc5<_0x30d3af['query'][_0x13aa('0x67')][_0x13aa('0x3d')];_0x362cc5+=0x1){socket[_0x13aa('0x71')](_0x13aa('0x8a'),{'UserId':Number(_0x30d3af[_0x13aa('0x38')][_0x13aa('0x67')][_0x362cc5]),'FaxQueueId':Number(_0x30d3af[_0x13aa('0x4b')]['id'])});}}else{socket[_0x13aa('0x71')](_0x13aa('0x8a'),{'UserId':Number(_0x30d3af['query']['ids']),'FaxQueueId':Number(_0x30d3af[_0x13aa('0x4b')]['id'])});}});}})[_0x13aa('0x28')](respondWithStatusCode(_0x194ec1,null))[_0x13aa('0x4f')](handleError(_0x194ec1,null));};exports['getAgents']=function(_0xdaa901,_0x604cb2,_0x45cb0d){var _0x298c6f={};var _0x1f6a92={};var _0xacbe9c;var _0xa7664b;return db['FaxQueue'][_0x13aa('0x64')]({'where':{'id':_0xdaa901[_0x13aa('0x4b')]['id']}})[_0x13aa('0x28')](handleEntityNotFound(_0x604cb2,null))[_0x13aa('0x28')](function(_0x18255e){if(_0x18255e){_0xacbe9c=_0x18255e;_0x1f6a92[_0x13aa('0x37')]=_[_0x13aa('0x4c')](db[_0x13aa('0x68')]['rawAttributes']);_0x1f6a92[_0x13aa('0x38')]=_[_0x13aa('0x4c')](_0xdaa901[_0x13aa('0x38')]);_0x1f6a92[_0x13aa('0x39')]=_[_0x13aa('0x3b')](_0x1f6a92[_0x13aa('0x37')],_0x1f6a92[_0x13aa('0x38')]);_0x298c6f[_0x13aa('0x3a')]=_[_0x13aa('0x3b')](_0x1f6a92[_0x13aa('0x37')],qs[_0x13aa('0x3c')](_0xdaa901[_0x13aa('0x38')][_0x13aa('0x3c')]));_0x298c6f[_0x13aa('0x3a')]=_0x298c6f[_0x13aa('0x3a')]['length']?_0x298c6f[_0x13aa('0x3a')]:_0x1f6a92[_0x13aa('0x37')];_0x298c6f[_0x13aa('0x40')]=qs[_0x13aa('0x41')](_0xdaa901[_0x13aa('0x38')][_0x13aa('0x41')]);_0x298c6f['where']=qs[_0x13aa('0x39')](_[_0x13aa('0x43')](_0xdaa901['query'],_0x1f6a92['filters']));if(_0xdaa901[_0x13aa('0x38')][_0x13aa('0x44')]){_0x298c6f['where']=_[_0x13aa('0x45')](_0x298c6f['where'],{'$or':_['map'](_0x298c6f['attributes'],function(_0x175090){var _0x1b67b1={};_0x1b67b1[_0x175090]={'$like':'%'+_0xdaa901['query'][_0x13aa('0x44')]+'%'};return _0x1b67b1;})});}_0x298c6f=_[_0x13aa('0x45')]({},_0x298c6f,_0xdaa901[_0x13aa('0x4d')]);return _0xacbe9c[_0x13aa('0x8b')](_0x298c6f);}})[_0x13aa('0x28')](function(_0x5cb764){if(_0x5cb764){_0xa7664b=_0x5cb764[_0x13aa('0x3d')];if(!_0xdaa901[_0x13aa('0x38')][_0x13aa('0x3e')](_0x13aa('0x3f'))){_0x298c6f[_0x13aa('0x22')]=qs[_0x13aa('0x22')](_0xdaa901['query'][_0x13aa('0x22')]);_0x298c6f[_0x13aa('0x21')]=qs[_0x13aa('0x21')](_0xdaa901[_0x13aa('0x38')][_0x13aa('0x21')]);}return _0xacbe9c[_0x13aa('0x8b')](_0x298c6f);}})[_0x13aa('0x28')](function(_0x2cf177){if(_0x2cf177){return _0x2cf177?{'count':_0xa7664b,'rows':_0x2cf177}:null;}})[_0x13aa('0x28')](respondWithResult(_0x604cb2,null))[_0x13aa('0x4f')](handleError(_0x604cb2,null));}; \ No newline at end of file +var _0x2239=['team_has_fax_queues','user_has_teams','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','isEmpty','removeAgents','userFaxQueue:remove','addAgents','ids','omit','spread','userFaxQueue:save','isArray','getAgents','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','update','then','destroy','get','FaxQueues','error','stack','name','send','map','FaxQueue','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','include','findAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','keys','UserFaxQueue','FaxQueueId','options','User','findAndCountAll','UserId','faxPause','updatedAt','createdAt','format','SIP','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','sequelize','transaction','forEach','emit','removeTeams','select','tq.TeamId'];(function(_0x2e0a04,_0x6ec53){var _0x378cb4=function(_0x53f7a6){while(--_0x53f7a6){_0x2e0a04['push'](_0x2e0a04['shift']());}};_0x378cb4(++_0x6ec53);}(_0x2239,0xa5));var _0x9223=function(_0x2457b7,_0x4b0427){_0x2457b7=_0x2457b7-0x0;var _0xa22060=_0x2239[_0x2457b7];return _0xa22060;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9223('0x0'));var jsonpatch=require(_0x9223('0x1'));var rp=require(_0x9223('0x2'));var moment=require('moment');var BPromise=require(_0x9223('0x3'));var Mustache=require(_0x9223('0x4'));var util=require(_0x9223('0x5'));var path=require('path');var sox=require(_0x9223('0x6'));var csv=require(_0x9223('0x7'));var ejs=require(_0x9223('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9223('0x9'));var squel=require(_0x9223('0xa'));var crypto=require(_0x9223('0xb'));var jsforce=require(_0x9223('0xc'));var deskjs=require(_0x9223('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9223('0xe'));var Papa=require(_0x9223('0xf'));var Redis=require(_0x9223('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9223('0x11'));var as=require(_0x9223('0x12'));var hardwareService=require(_0x9223('0x13'));var logger=require(_0x9223('0x14'))('api');var utils=require(_0x9223('0x15'));var config=require(_0x9223('0x16'));var licenseUtil=require(_0x9223('0x17'));var db=require(_0x9223('0x18'))['db'];config['redis']=_[_0x9223('0x19')](config['redis'],{'host':_0x9223('0x1a'),'port':0x18eb});var socket=require(_0x9223('0x1b'))(new Redis(config['redis']));require(_0x9223('0x1c'))[_0x9223('0x1d')](socket);function respondWithStatusCode(_0x10ae0e,_0x116d3b){_0x116d3b=_0x116d3b||0xcc;return function(_0x180a49){if(_0x180a49){return _0x10ae0e['sendStatus'](_0x116d3b);}return _0x10ae0e[_0x9223('0x1e')](_0x116d3b)[_0x9223('0x1f')]();};}function respondWithResult(_0x27033f,_0x2b5964){_0x2b5964=_0x2b5964||0xc8;return function(_0x49131a){if(_0x49131a){return _0x27033f[_0x9223('0x1e')](_0x2b5964)[_0x9223('0x20')](_0x49131a);}};}function respondWithFilteredResult(_0x24d4c3,_0x38f12b){return function(_0x348911){if(_0x348911){var _0x2342b7=typeof _0x38f12b[_0x9223('0x21')]==='undefined'&&typeof _0x38f12b[_0x9223('0x22')]===_0x9223('0x23');var _0x9eeb24=_0x348911[_0x9223('0x24')];var _0xa62237=_0x2342b7?0x0:_0x38f12b['offset'];var _0xdd8df6=_0x2342b7?_0x348911[_0x9223('0x24')]:_0x38f12b['offset']+_0x38f12b[_0x9223('0x22')];var _0x4c8a6e;if(_0xdd8df6>=_0x9eeb24){_0xdd8df6=_0x9eeb24;_0x4c8a6e=0xc8;}else{_0x4c8a6e=0xce;}_0x24d4c3[_0x9223('0x1e')](_0x4c8a6e);return _0x24d4c3['set'](_0x9223('0x25'),_0xa62237+'-'+_0xdd8df6+'/'+_0x9eeb24)[_0x9223('0x20')](_0x348911);}return null;};}function patchUpdates(_0x1e9a72){return function(_0x126ea1){try{jsonpatch[_0x9223('0x26')](_0x126ea1,_0x1e9a72,!![]);}catch(_0xedc6ce){return BPromise['reject'](_0xedc6ce);}return _0x126ea1[_0x9223('0x27')]();};}function saveUpdates(_0x37e8f6,_0x4d8f91){return function(_0x19c745){if(_0x19c745){return _0x19c745[_0x9223('0x28')](_0x37e8f6)[_0x9223('0x29')](function(_0x1475bc){return _0x1475bc;});}return null;};}function removeEntity(_0x250c91,_0x5b45d1){return function(_0x43cdfc){if(_0x43cdfc){return _0x43cdfc[_0x9223('0x2a')]()[_0x9223('0x29')](function(){var _0x1e85e4=_0x43cdfc[_0x9223('0x2b')]({'plain':!![]});var _0x5f17df=_0x9223('0x2c');return db['UserProfileResource']['destroy']({'where':{'type':_0x5f17df,'resourceId':_0x1e85e4['id']}})['then'](function(){return _0x43cdfc;});})['then'](function(){_0x250c91['status'](0xcc)[_0x9223('0x1f')]();});}};}function handleEntityNotFound(_0x1bb94a,_0x5e310f){return function(_0x80453e){if(!_0x80453e){_0x1bb94a['sendStatus'](0x194);}return _0x80453e;};}function handleError(_0x55bd39,_0x2e5424){_0x2e5424=_0x2e5424||0x1f4;return function(_0x13540f){logger[_0x9223('0x2d')](_0x13540f[_0x9223('0x2e')]);if(_0x13540f[_0x9223('0x2f')]){delete _0x13540f[_0x9223('0x2f')];}_0x55bd39[_0x9223('0x1e')](_0x2e5424)[_0x9223('0x30')](_0x13540f);};}exports['index']=function(_0x27b52e,_0x4850ce){var _0x2ffe28={},_0x5078de={},_0x118aab={'count':0x0,'rows':[]};var _0x2a10e6=_[_0x9223('0x31')](db[_0x9223('0x32')][_0x9223('0x33')],function(_0x5abce9){return{'name':_0x5abce9[_0x9223('0x34')],'type':_0x5abce9[_0x9223('0x35')][_0x9223('0x36')]};});_0x5078de['model']=_[_0x9223('0x31')](_0x2a10e6,_0x9223('0x2f'));_0x5078de[_0x9223('0x37')]=_['keys'](_0x27b52e[_0x9223('0x37')]);_0x5078de[_0x9223('0x38')]=_['intersection'](_0x5078de[_0x9223('0x39')],_0x5078de['query']);_0x2ffe28[_0x9223('0x3a')]=_[_0x9223('0x3b')](_0x5078de['model'],qs['fields'](_0x27b52e[_0x9223('0x37')][_0x9223('0x3c')]));_0x2ffe28[_0x9223('0x3a')]=_0x2ffe28[_0x9223('0x3a')][_0x9223('0x3d')]?_0x2ffe28[_0x9223('0x3a')]:_0x5078de[_0x9223('0x39')];if(!_0x27b52e[_0x9223('0x37')][_0x9223('0x3e')](_0x9223('0x3f'))){_0x2ffe28[_0x9223('0x22')]=qs[_0x9223('0x22')](_0x27b52e[_0x9223('0x37')][_0x9223('0x22')]);_0x2ffe28[_0x9223('0x21')]=qs[_0x9223('0x21')](_0x27b52e[_0x9223('0x37')][_0x9223('0x21')]);}_0x2ffe28[_0x9223('0x40')]=qs[_0x9223('0x41')](_0x27b52e[_0x9223('0x37')][_0x9223('0x41')]);_0x2ffe28[_0x9223('0x42')]=qs[_0x9223('0x38')](_[_0x9223('0x43')](_0x27b52e[_0x9223('0x37')],_0x5078de[_0x9223('0x38')]),_0x2a10e6);if(_0x27b52e['query'][_0x9223('0x44')]){_0x2ffe28[_0x9223('0x42')]=_['merge'](_0x2ffe28[_0x9223('0x42')],{'$or':_[_0x9223('0x31')](_0x2a10e6,function(_0x594723){if(_0x594723[_0x9223('0x35')]!==_0x9223('0x45')){var _0x30e2df={};_0x30e2df[_0x594723[_0x9223('0x2f')]]={'$like':'%'+_0x27b52e[_0x9223('0x37')]['filter']+'%'};return _0x30e2df;}})});}_0x2ffe28=_[_0x9223('0x46')]({},_0x2ffe28,_0x27b52e['options']);var _0x354788={'where':_0x2ffe28['where']};return db[_0x9223('0x32')][_0x9223('0x24')](_0x354788)[_0x9223('0x29')](function(_0x3ed4b8){_0x118aab[_0x9223('0x24')]=_0x3ed4b8;if(_0x27b52e[_0x9223('0x37')]['includeAll']){_0x2ffe28[_0x9223('0x47')]=[{'all':!![]}];}return db['FaxQueue'][_0x9223('0x48')](_0x2ffe28);})['then'](function(_0x572fa9){_0x118aab['rows']=_0x572fa9;return _0x118aab;})['then'](respondWithFilteredResult(_0x4850ce,_0x2ffe28))['catch'](handleError(_0x4850ce,null));};exports['show']=function(_0x239458,_0x3cc778){var _0x491598={'raw':!![],'where':{'id':_0x239458['params']['id']}},_0x5da710={};_0x5da710[_0x9223('0x39')]=_['keys'](db[_0x9223('0x32')][_0x9223('0x33')]);_0x5da710[_0x9223('0x37')]=_['keys'](_0x239458[_0x9223('0x37')]);_0x5da710[_0x9223('0x38')]=_[_0x9223('0x3b')](_0x5da710[_0x9223('0x39')],_0x5da710[_0x9223('0x37')]);_0x491598[_0x9223('0x3a')]=_[_0x9223('0x3b')](_0x5da710[_0x9223('0x39')],qs['fields'](_0x239458[_0x9223('0x37')][_0x9223('0x3c')]));_0x491598[_0x9223('0x3a')]=_0x491598[_0x9223('0x3a')][_0x9223('0x3d')]?_0x491598[_0x9223('0x3a')]:_0x5da710[_0x9223('0x39')];if(_0x239458[_0x9223('0x37')]['includeAll']){_0x491598[_0x9223('0x47')]=[{'all':!![]}];}_0x491598=_[_0x9223('0x46')]({},_0x491598,_0x239458['options']);return db[_0x9223('0x32')][_0x9223('0x49')](_0x491598)[_0x9223('0x29')](handleEntityNotFound(_0x3cc778,null))[_0x9223('0x29')](respondWithResult(_0x3cc778,null))[_0x9223('0x4a')](handleError(_0x3cc778,null));};exports[_0x9223('0x4b')]=function(_0x4688df,_0x431eb2){return db[_0x9223('0x32')][_0x9223('0x4b')](_0x4688df[_0x9223('0x4c')],{})[_0x9223('0x29')](function(_0x166527){var _0x17b3f7=_0x4688df[_0x9223('0x4d')][_0x9223('0x2b')]({'plain':!![]});if(!_0x17b3f7)throw new Error(_0x9223('0x4e'));if(_0x17b3f7[_0x9223('0x4f')]===_0x9223('0x4d')){var _0x1e2aa6=_0x166527[_0x9223('0x2b')]({'plain':!![]});var _0x545e94=_0x9223('0x2c');return db[_0x9223('0x50')][_0x9223('0x49')]({'where':{'name':_0x545e94,'userProfileId':_0x17b3f7[_0x9223('0x51')]},'raw':!![]})['then'](function(_0x2ddf99){if(_0x2ddf99&&_0x2ddf99[_0x9223('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0x1e2aa6['name'],'resourceId':_0x1e2aa6['id'],'type':_0x2ddf99['name'],'sectionId':_0x2ddf99['id']},{})['then'](function(){return _0x166527;});}else{return _0x166527;}})[_0x9223('0x4a')](function(_0x3f53c8){logger[_0x9223('0x2d')](_0x9223('0x53'),_0x3f53c8);throw _0x3f53c8;});}return _0x166527;})['then'](respondWithResult(_0x431eb2,0xc9))[_0x9223('0x4a')](handleError(_0x431eb2,null));};exports[_0x9223('0x28')]=function(_0x3502f6,_0x2f9c2a){if(_0x3502f6[_0x9223('0x4c')]['id']){delete _0x3502f6[_0x9223('0x4c')]['id'];}return db[_0x9223('0x32')][_0x9223('0x49')]({'where':{'id':_0x3502f6[_0x9223('0x54')]['id']}})['then'](handleEntityNotFound(_0x2f9c2a,null))[_0x9223('0x29')](saveUpdates(_0x3502f6['body'],null))[_0x9223('0x29')](respondWithResult(_0x2f9c2a,null))[_0x9223('0x4a')](handleError(_0x2f9c2a,null));};exports[_0x9223('0x2a')]=function(_0x40c99b,_0x39ba6a){return db[_0x9223('0x32')][_0x9223('0x49')]({'where':{'id':_0x40c99b[_0x9223('0x54')]['id']}})['then'](handleEntityNotFound(_0x39ba6a,null))[_0x9223('0x29')](removeEntity(_0x39ba6a,null))[_0x9223('0x4a')](handleError(_0x39ba6a,null));};exports[_0x9223('0x55')]=function(_0x53ea91,_0x47a878){return db[_0x9223('0x32')][_0x9223('0x55')]()[_0x9223('0x29')](respondWithResult(_0x47a878,null))[_0x9223('0x4a')](handleError(_0x47a878,null));};exports[_0x9223('0x56')]=function(_0x243197,_0x1536da,_0x428db1){var _0x405d59={'raw':!![],'where':{}},_0x2ec11d={},_0x19d2c1;return db['FaxQueue'][_0x9223('0x57')]({'where':{'id':_0x243197[_0x9223('0x54')]['id']}})[_0x9223('0x29')](handleEntityNotFound(_0x1536da,null))[_0x9223('0x29')](function(_0x4e34d0){if(_0x4e34d0){_0x19d2c1=_0x4e34d0[_0x9223('0x2b')]({'plain':!![]});_0x2ec11d[_0x9223('0x39')]=_[_0x9223('0x58')](db[_0x9223('0x59')]['rawAttributes']);_0x2ec11d[_0x9223('0x37')]=_[_0x9223('0x58')](_0x243197['query']);_0x2ec11d[_0x9223('0x38')]=_['intersection'](_0x2ec11d['model'],_0x2ec11d['query']);_0x405d59[_0x9223('0x3a')]=_[_0x9223('0x3b')](_0x2ec11d[_0x9223('0x39')],qs['fields'](_0x243197['query']['fields']));_0x405d59[_0x9223('0x3a')]=_0x405d59[_0x9223('0x3a')]['length']?_0x405d59[_0x9223('0x3a')]:_0x2ec11d[_0x9223('0x39')];if(!_0x243197[_0x9223('0x37')][_0x9223('0x3e')](_0x9223('0x3f'))){_0x405d59[_0x9223('0x22')]=qs[_0x9223('0x22')](_0x243197[_0x9223('0x37')]['limit']);_0x405d59[_0x9223('0x21')]=qs[_0x9223('0x21')](_0x243197['query'][_0x9223('0x21')]);}_0x405d59['order']=qs['sort'](_0x243197[_0x9223('0x37')][_0x9223('0x41')]);_0x405d59[_0x9223('0x42')]=qs['filters'](_[_0x9223('0x43')](_0x243197[_0x9223('0x37')],_0x2ec11d[_0x9223('0x38')]));_0x405d59[_0x9223('0x42')][_0x9223('0x5a')]=_0x4e34d0['id'];if(_0x243197[_0x9223('0x37')][_0x9223('0x44')]){_0x405d59[_0x9223('0x42')]=_[_0x9223('0x46')](_0x405d59[_0x9223('0x42')],{'$or':_[_0x9223('0x31')](_0x405d59['attributes'],function(_0x575fb0){var _0x4579cd={};_0x4579cd[_0x575fb0]={'$like':'%'+_0x243197[_0x9223('0x37')][_0x9223('0x44')]+'%'};return _0x4579cd;})});}_0x405d59=_[_0x9223('0x46')]({},_0x405d59,_0x243197[_0x9223('0x5b')]);return db[_0x9223('0x59')][_0x9223('0x48')](_0x405d59);}})[_0x9223('0x29')](function(_0x2182e4){if(_0x2182e4){return db[_0x9223('0x5c')][_0x9223('0x5d')]({'where':{'id':_['map'](_0x2182e4,_0x9223('0x5e')),'role':'agent'},'attributes':['id',_0x9223('0x2f'),_0x9223('0x5f'),_0x9223('0x60'),_0x9223('0x61')]});}})[_0x9223('0x29')](function(_0x219f7f){if(_0x219f7f){return{'count':_0x219f7f[_0x9223('0x24')],'rows':_[_0x9223('0x31')](_0x219f7f['rows'],function(_0x5909fc){return{'membername':_0x5909fc['name'],'UserId':_0x5909fc['id'],'queue_name':_0x19d2c1[_0x9223('0x2f')],'FaxQueueId':_0x19d2c1['id'],'interface':util[_0x9223('0x62')]('%s/%s',_0x9223('0x63'),_0x5909fc['name']),'penalty':0x0,'paused':_0x5909fc[_0x9223('0x5f')],'createdAt':_0x5909fc[_0x9223('0x61')],'updatedAt':_0x5909fc[_0x9223('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9223('0x29')](respondWithFilteredResult(_0x1536da,_0x405d59))[_0x9223('0x4a')](handleError(_0x1536da,null));};exports[_0x9223('0x64')]=function(_0x3a6237,_0x5e53d7,_0x525810){var _0x4dff90={};var _0x4921d5={};var _0xd3b601;var _0x38bee1;return db[_0x9223('0x32')]['findOne']({'where':{'id':_0x3a6237[_0x9223('0x54')]['id']}})[_0x9223('0x29')](handleEntityNotFound(_0x5e53d7,null))[_0x9223('0x29')](function(_0x57d519){if(_0x57d519){_0xd3b601=_0x57d519;_0x4921d5[_0x9223('0x39')]=_[_0x9223('0x58')](db[_0x9223('0x65')][_0x9223('0x33')]);_0x4921d5[_0x9223('0x37')]=_['keys'](_0x3a6237[_0x9223('0x37')]);_0x4921d5['filters']=_[_0x9223('0x3b')](_0x4921d5[_0x9223('0x39')],_0x4921d5[_0x9223('0x37')]);_0x4dff90[_0x9223('0x3a')]=_[_0x9223('0x3b')](_0x4921d5[_0x9223('0x39')],qs[_0x9223('0x3c')](_0x3a6237[_0x9223('0x37')][_0x9223('0x3c')]));_0x4dff90[_0x9223('0x3a')]=_0x4dff90[_0x9223('0x3a')][_0x9223('0x3d')]?_0x4dff90[_0x9223('0x3a')]:_0x4921d5[_0x9223('0x39')];_0x4dff90[_0x9223('0x40')]=qs[_0x9223('0x41')](_0x3a6237[_0x9223('0x37')][_0x9223('0x41')]);_0x4dff90['where']=qs['filters'](_['pick'](_0x3a6237[_0x9223('0x37')],_0x4921d5[_0x9223('0x38')]));if(_0x3a6237[_0x9223('0x37')]['filter']){_0x4dff90['where']=_[_0x9223('0x46')](_0x4dff90[_0x9223('0x42')],{'$or':_['map'](_0x4dff90[_0x9223('0x3a')],function(_0x25255f){var _0x4e7e04={};_0x4e7e04[_0x25255f]={'$like':'%'+_0x3a6237[_0x9223('0x37')][_0x9223('0x44')]+'%'};return _0x4e7e04;})});}_0x4dff90=_[_0x9223('0x46')]({},_0x4dff90,_0x3a6237[_0x9223('0x5b')]);return _0xd3b601[_0x9223('0x64')](_0x4dff90);}})[_0x9223('0x29')](function(_0x23bd74){if(_0x23bd74){_0x38bee1=_0x23bd74[_0x9223('0x3d')];if(!_0x3a6237['query'][_0x9223('0x3e')](_0x9223('0x3f'))){_0x4dff90[_0x9223('0x22')]=qs[_0x9223('0x22')](_0x3a6237[_0x9223('0x37')][_0x9223('0x22')]);_0x4dff90[_0x9223('0x21')]=qs[_0x9223('0x21')](_0x3a6237[_0x9223('0x37')][_0x9223('0x21')]);}return _0xd3b601[_0x9223('0x64')](_0x4dff90);}})['then'](function(_0x3ee17f){if(_0x3ee17f){return _0x3ee17f?{'count':_0x38bee1,'rows':_0x3ee17f}:null;}})['then'](respondWithResult(_0x5e53d7,null))[_0x9223('0x4a')](handleError(_0x5e53d7,null));};exports[_0x9223('0x66')]=function(_0x5b8989,_0x1219fd,_0x42e955){var _0x4075e9=_0x5b8989[_0x9223('0x4c')]['ids'];return db[_0x9223('0x65')][_0x9223('0x48')]({'where':{'id':_0x4075e9},'attributes':['id'],'include':[{'model':db[_0x9223('0x5c')],'as':_0x9223('0x67'),'attributes':['id',_0x9223('0x2f'),_0x9223('0x68'),_0x9223('0x69'),_0x9223('0x6a')],'raw':!![]}]})['then'](function(_0x387434){if(_0x387434){var _0x44dc3f=_[_0x9223('0x6b')](_0x387434,function(_0x3e4fec){var _0x312602=_0x3e4fec['get']({'plain':!![]});return _0x312602[_0x9223('0x67')];});return db[_0x9223('0x32')][_0x9223('0x49')]({'where':{'id':_0x5b8989['params']['id']}})[_0x9223('0x29')](function(_0x47d0c8){return db[_0x9223('0x6c')][_0x9223('0x6d')](function(_0x4ebb42){return _0x47d0c8['addTeams'](_0x4075e9,{'transaction':_0x4ebb42})[_0x9223('0x29')](function(){return BPromise['each'](_0x44dc3f,function(_0x400924){return db[_0x9223('0x59')]['findOrCreate']({'where':{'UserId':_0x400924['id'],'FaxQueueId':_0x5b8989['params']['id']},'transaction':_0x4ebb42});});})[_0x9223('0x29')](function(){_0x44dc3f[_0x9223('0x6e')](function(_0x4e5090){socket[_0x9223('0x6f')]('userFaxQueue:save',{'UserId':_0x4e5090['id'],'FaxQueueId':_0x47d0c8['id']});});});});});}})['then'](respondWithStatusCode(_0x1219fd,null))[_0x9223('0x4a')](handleError(_0x1219fd,null));};exports[_0x9223('0x70')]=function(_0x2e9062,_0x17b79a,_0x3607e9){return db[_0x9223('0x65')][_0x9223('0x48')]({'where':{'id':_0x2e9062[_0x9223('0x37')]['ids']},'attributes':['id'],'include':[{'model':db[_0x9223('0x5c')],'as':_0x9223('0x67'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x17b79a,null))[_0x9223('0x29')](function(_0x3db986){var _0x1b9db1=_[_0x9223('0x31')](_0x3db986,'id');var _0xf869d6=[];var _0x12cb26=[];var _0x3bdf36=squel[_0x9223('0x71')]();_0x3bdf36['field'](_0x9223('0x72'))['from'](_0x9223('0x73'),'tq')['join'](_0x9223('0x74'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x9223('0x42')](_0x9223('0x75'),_0x2e9062[_0x9223('0x54')]['id']);for(var _0x23c0fb=0x0;_0x23c0fb<_0x3db986[_0x9223('0x3d')];_0x23c0fb+=0x1){let _0x141612=_0x3db986[_0x23c0fb];for(var _0x68fced=0x0;_0x68fced<_0x141612['Agents']['length'];_0x68fced+=0x1){let _0x429186=_0x141612['Agents'][_0x68fced];var _0x15ac90=_0x3bdf36[_0x9223('0x76')]();_0x15ac90[_0x9223('0x42')](_0x9223('0x77'),_0x429186['id']);_0x12cb26[_0x9223('0x78')](db[_0x9223('0x6c')][_0x9223('0x37')](_0x15ac90[_0x9223('0x79')](),{'type':db[_0x9223('0x6c')][_0x9223('0x7a')][_0x9223('0x7b')]})[_0x9223('0x29')](function(_0x2a3a77){if(_0x2a3a77[_0x9223('0x3d')]===0x1){return _0x429186['id'];}else{var _0x429492=_[_0x9223('0x7c')](_[_0x9223('0x31')](_0x2a3a77,_0x9223('0x7d')),function(_0x399373){return _['includes'](_0x1b9db1,_0x399373);});if(_0x429492){return _0x429186['id'];}}}));}}return BPromise[_0x9223('0x7e')](_0x12cb26)[_0x9223('0x29')](function(_0x1f39aa){_0xf869d6=_(_0xf869d6)[_0x9223('0x7f')](_0x1f39aa)[_0x9223('0x80')]()[_0x9223('0x81')]();return db[_0x9223('0x32')][_0x9223('0x49')]({'where':{'id':_0x2e9062[_0x9223('0x54')]['id']}})[_0x9223('0x29')](function(_0x145453){return db[_0x9223('0x6c')][_0x9223('0x6d')](function(_0x2e9fa6){return _0x145453[_0x9223('0x70')](_0x2e9062[_0x9223('0x37')]['ids'],{'transaction':_0x2e9fa6})[_0x9223('0x29')](function(){if(!_[_0x9223('0x82')](_0xf869d6)){return _0x145453[_0x9223('0x83')](_0xf869d6,{'transaction':_0x2e9fa6});}})['then'](function(){_0xf869d6['forEach'](function(_0x254a83){socket[_0x9223('0x6f')](_0x9223('0x84'),{'UserId':_0x254a83,'FaxQueueId':_0x145453['id']});});});});});});})[_0x9223('0x29')](respondWithStatusCode(_0x17b79a,null))['catch'](handleError(_0x17b79a,null));};exports[_0x9223('0x85')]=function(_0x34bacf,_0x441e37,_0xfe4b67){return db[_0x9223('0x32')][_0x9223('0x49')]({'where':{'id':_0x34bacf[_0x9223('0x54')]['id']}})[_0x9223('0x29')](handleEntityNotFound(_0x441e37,null))[_0x9223('0x29')](function(_0x522381){if(_0x522381){return _0x522381[_0x9223('0x85')](_0x34bacf[_0x9223('0x4c')][_0x9223('0x86')],_[_0x9223('0x87')](_0x34bacf['body'],['ids','id'])||{})[_0x9223('0x88')](function(_0x47e262){for(var _0x189826=0x0;_0x189826<_0x34bacf[_0x9223('0x4c')][_0x9223('0x86')][_0x9223('0x3d')];_0x189826+=0x1){socket['emit'](_0x9223('0x89'),{'UserId':Number(_0x34bacf[_0x9223('0x4c')]['ids'][_0x189826]),'FaxQueueId':Number(_0x34bacf[_0x9223('0x54')]['id'])});}return _0x47e262;});}})[_0x9223('0x29')](respondWithResult(_0x441e37,null))[_0x9223('0x4a')](handleError(_0x441e37,null));};exports[_0x9223('0x83')]=function(_0x2811c0,_0x3eb070,_0x44d8c8){return db[_0x9223('0x32')][_0x9223('0x49')]({'where':{'id':_0x2811c0['params']['id']}})['then'](handleEntityNotFound(_0x3eb070,null))['then'](function(_0x195d61){if(_0x195d61){return _0x195d61[_0x9223('0x83')](_0x2811c0[_0x9223('0x37')]['ids'])[_0x9223('0x29')](function(){if(_[_0x9223('0x8a')](_0x2811c0[_0x9223('0x37')][_0x9223('0x86')])){for(var _0x4499c7=0x0;_0x4499c7<_0x2811c0['query']['ids']['length'];_0x4499c7+=0x1){socket[_0x9223('0x6f')]('userFaxQueue:remove',{'UserId':Number(_0x2811c0[_0x9223('0x37')][_0x9223('0x86')][_0x4499c7]),'FaxQueueId':Number(_0x2811c0[_0x9223('0x54')]['id'])});}}else{socket[_0x9223('0x6f')](_0x9223('0x84'),{'UserId':Number(_0x2811c0[_0x9223('0x37')][_0x9223('0x86')]),'FaxQueueId':Number(_0x2811c0[_0x9223('0x54')]['id'])});}});}})[_0x9223('0x29')](respondWithStatusCode(_0x3eb070,null))[_0x9223('0x4a')](handleError(_0x3eb070,null));};exports[_0x9223('0x8b')]=function(_0x30b23a,_0x238b54,_0x41c75d){var _0xbcbc46={};var _0x4fddad={};var _0x45c133;var _0x217f4a;return db[_0x9223('0x32')]['findOne']({'where':{'id':_0x30b23a[_0x9223('0x54')]['id']}})['then'](handleEntityNotFound(_0x238b54,null))[_0x9223('0x29')](function(_0x4ed883){if(_0x4ed883){_0x45c133=_0x4ed883;_0x4fddad[_0x9223('0x39')]=_['keys'](db[_0x9223('0x5c')][_0x9223('0x33')]);_0x4fddad[_0x9223('0x37')]=_['keys'](_0x30b23a[_0x9223('0x37')]);_0x4fddad[_0x9223('0x38')]=_[_0x9223('0x3b')](_0x4fddad['model'],_0x4fddad[_0x9223('0x37')]);_0xbcbc46[_0x9223('0x3a')]=_[_0x9223('0x3b')](_0x4fddad['model'],qs[_0x9223('0x3c')](_0x30b23a['query']['fields']));_0xbcbc46[_0x9223('0x3a')]=_0xbcbc46[_0x9223('0x3a')][_0x9223('0x3d')]?_0xbcbc46[_0x9223('0x3a')]:_0x4fddad['model'];_0xbcbc46[_0x9223('0x40')]=qs['sort'](_0x30b23a[_0x9223('0x37')][_0x9223('0x41')]);_0xbcbc46[_0x9223('0x42')]=qs[_0x9223('0x38')](_['pick'](_0x30b23a[_0x9223('0x37')],_0x4fddad[_0x9223('0x38')]));if(_0x30b23a[_0x9223('0x37')]['filter']){_0xbcbc46['where']=_[_0x9223('0x46')](_0xbcbc46[_0x9223('0x42')],{'$or':_[_0x9223('0x31')](_0xbcbc46[_0x9223('0x3a')],function(_0x3fb5bb){var _0x176ab7={};_0x176ab7[_0x3fb5bb]={'$like':'%'+_0x30b23a[_0x9223('0x37')]['filter']+'%'};return _0x176ab7;})});}_0xbcbc46=_[_0x9223('0x46')]({},_0xbcbc46,_0x30b23a[_0x9223('0x5b')]);return _0x45c133[_0x9223('0x8b')](_0xbcbc46);}})['then'](function(_0x170b56){if(_0x170b56){_0x217f4a=_0x170b56[_0x9223('0x3d')];if(!_0x30b23a[_0x9223('0x37')][_0x9223('0x3e')](_0x9223('0x3f'))){_0xbcbc46[_0x9223('0x22')]=qs['limit'](_0x30b23a[_0x9223('0x37')]['limit']);_0xbcbc46[_0x9223('0x21')]=qs[_0x9223('0x21')](_0x30b23a['query'][_0x9223('0x21')]);}return _0x45c133['getAgents'](_0xbcbc46);}})[_0x9223('0x29')](function(_0x4f4909){if(_0x4f4909){return _0x4f4909?{'count':_0x217f4a,'rows':_0x4f4909}:null;}})[_0x9223('0x29')](respondWithResult(_0x238b54,null))[_0x9223('0x4a')](handleError(_0x238b54,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index ff480b4..a8ce9d1 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 _0xc0fe=['../../mysqldb','FaxQueue','setMaxListeners','save','update','remove','emit','hook','exports','events'];(function(_0x310b17,_0x661f97){var _0x5ede4d=function(_0x53e0db){while(--_0x53e0db){_0x310b17['push'](_0x310b17['shift']());}};_0x5ede4d(++_0x661f97);}(_0xc0fe,0x135));var _0xec0f=function(_0x27b192,_0x4b446){_0x27b192=_0x27b192-0x0;var _0x2a5d87=_0xc0fe[_0x27b192];return _0x2a5d87;};'use strict';var EventEmitter=require(_0xec0f('0x0'));var FaxQueue=require(_0xec0f('0x1'))['db'][_0xec0f('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xec0f('0x3')](0x0);var events={'afterCreate':_0xec0f('0x4'),'afterUpdate':_0xec0f('0x5'),'afterDestroy':_0xec0f('0x6')};function emitEvent(_0x5627a1){return function(_0x4728c9,_0x3aecdc,_0x1fb44f){FaxQueueEvents[_0xec0f('0x7')](_0x5627a1+':'+_0x4728c9['id'],_0x4728c9);FaxQueueEvents[_0xec0f('0x7')](_0x5627a1,_0x4728c9);_0x1fb44f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0xec0f('0x8')](e,emitEvent(event));}}module[_0xec0f('0x9')]=FaxQueueEvents; \ No newline at end of file +var _0x26d1=['exports','events','../../mysqldb','FaxQueue','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x3067f3,_0x55914e){var _0xcecdf4=function(_0x2a5929){while(--_0x2a5929){_0x3067f3['push'](_0x3067f3['shift']());}};_0xcecdf4(++_0x55914e);}(_0x26d1,0xd3));var _0x126d=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x26d1[_0x138adb];return _0x1b27f2;};'use strict';var EventEmitter=require(_0x126d('0x0'));var FaxQueue=require(_0x126d('0x1'))['db'][_0x126d('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x126d('0x3')](0x0);var events={'afterCreate':_0x126d('0x4'),'afterUpdate':_0x126d('0x5'),'afterDestroy':'remove'};function emitEvent(_0x46eb51){return function(_0x109b4a,_0x272b98,_0x2d5227){FaxQueueEvents[_0x126d('0x6')](_0x46eb51+':'+_0x109b4a['id'],_0x109b4a);FaxQueueEvents[_0x126d('0x6')](_0x46eb51,_0x109b4a);_0x2d5227(null);};}for(var e in events){if(events[_0x126d('0x7')](e)){var event=events[e];FaxQueue[_0x126d('0x8')](e,emitEvent(event));}}module[_0x126d('0x9')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index b36673b..9522888 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 _0x7c0d=['bluebird','request-promise','../../config/environment','./faxQueue.attributes','exports','FaxQueue','fax_queues','util','../../config/logger','api'];(function(_0x15b303,_0x53e5cb){var _0x7ba3e5=function(_0x1581b3){while(--_0x1581b3){_0x15b303['push'](_0x15b303['shift']());}};_0x7ba3e5(++_0x53e5cb);}(_0x7c0d,0x11f));var _0xd7c0=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x7c0d[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require(_0xd7c0('0x0'));var logger=require(_0xd7c0('0x1'))(_0xd7c0('0x2'));var moment=require('moment');var BPromise=require(_0xd7c0('0x3'));var rp=require(_0xd7c0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd7c0('0x5'));var attributes=require(_0xd7c0('0x6'));module[_0xd7c0('0x7')]=function(_0x1ed38f,_0x68b6de){return _0x1ed38f['define'](_0xd7c0('0x8'),attributes,{'tableName':_0xd7c0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x326c=['request-promise','rimraf','../../config/environment','./faxQueue.attributes','define','lodash','util','../../config/logger','moment','bluebird'];(function(_0x54f287,_0x497296){var _0xae1703=function(_0x122343){while(--_0x122343){_0x54f287['push'](_0x54f287['shift']());}};_0xae1703(++_0x497296);}(_0x326c,0xd7));var _0xc326=function(_0x38e8a9,_0x6dc4e1){_0x38e8a9=_0x38e8a9-0x0;var _0x544b74=_0x326c[_0x38e8a9];return _0x544b74;};'use strict';var _=require(_0xc326('0x0'));var util=require(_0xc326('0x1'));var logger=require(_0xc326('0x2'))('api');var moment=require(_0xc326('0x3'));var BPromise=require(_0xc326('0x4'));var rp=require(_0xc326('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc326('0x6'));var config=require(_0xc326('0x7'));var attributes=require(_0xc326('0x8'));module['exports']=function(_0x4105aa,_0x267de9){return _0x4105aa[_0xc326('0x9')]('FaxQueue',attributes,{'tableName':'fax_queues','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 ed8ad6b..3b70c4e 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 _0x7eeb=['include','map','attributes','model','find','ShowFaxQueue','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','register','request','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','limit'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0x7eeb,0x18c));var _0xb7ee=function(_0x2652ef,_0x234230){_0x2652ef=_0x2652ef-0x0;var _0x2db578=_0x7eeb[_0x2652ef];return _0x2db578;};'use strict';var _=require('lodash');var util=require(_0xb7ee('0x0'));var moment=require('moment');var BPromise=require(_0xb7ee('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb7ee('0x2'));var db=require(_0xb7ee('0x3'))['db'];var utils=require(_0xb7ee('0x4'));var logger=require(_0xb7ee('0x5'))(_0xb7ee('0x6'));var config=require('../../config/environment');var jayson=require(_0xb7ee('0x7'));var client=jayson[_0xb7ee('0x8')][_0xb7ee('0x9')]({'port':0x232a});config[_0xb7ee('0xa')]=_[_0xb7ee('0xb')](config[_0xb7ee('0xa')],{'host':_0xb7ee('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb7ee('0xa')]));require('./faxQueue.socket')[_0xb7ee('0xd')](socket);function respondWithRpcPromise(_0xbb60ad,_0x224b8a,_0x1cd4ff){return new BPromise(function(_0x5f2973,_0x191d95){return client[_0xb7ee('0xe')](_0xbb60ad,_0x1cd4ff)['then'](function(_0x9a3495){logger['info'](_0xb7ee('0xf'),_0x224b8a,_0xb7ee('0x10'));logger[_0xb7ee('0x11')](_0xb7ee('0x12'),_0x224b8a,_0xb7ee('0x10'),JSON[_0xb7ee('0x13')](_0x9a3495));if(_0x9a3495[_0xb7ee('0x14')]){if(_0x9a3495[_0xb7ee('0x14')][_0xb7ee('0x15')]===0x1f4){logger['error'](_0xb7ee('0xf'),_0x224b8a,_0x9a3495[_0xb7ee('0x14')][_0xb7ee('0x16')]);return _0x191d95(_0x9a3495['error'][_0xb7ee('0x16')]);}logger[_0xb7ee('0x14')]('FaxQueue,\x20%s,\x20%s',_0x224b8a,_0x9a3495[_0xb7ee('0x14')][_0xb7ee('0x16')]);return _0x5f2973(_0x9a3495['error'][_0xb7ee('0x16')]);}else{logger[_0xb7ee('0x17')]('FaxQueue,\x20%s,\x20%s',_0x224b8a,_0xb7ee('0x10'));_0x5f2973(_0x9a3495[_0xb7ee('0x18')][_0xb7ee('0x16')]);}})[_0xb7ee('0x19')](function(_0x1eef59){logger['error'](_0xb7ee('0xf'),_0x224b8a,_0x1eef59);_0x191d95(_0x1eef59);});});}exports[_0xb7ee('0x1a')]=function(_0x2ce11b){var _0x44bc24=this;return new Promise(function(_0xb8abdd,_0x322a84){return db[_0xb7ee('0x1b')][_0xb7ee('0x1c')]({'raw':_0x2ce11b[_0xb7ee('0x1d')]?_0x2ce11b['options'][_0xb7ee('0x1e')]===undefined?!![]:![]:!![],'where':_0x2ce11b[_0xb7ee('0x1d')]?_0x2ce11b[_0xb7ee('0x1d')][_0xb7ee('0x1f')]||null:null,'attributes':_0x2ce11b[_0xb7ee('0x1d')]?_0x2ce11b[_0xb7ee('0x1d')]['attributes']||null:null,'limit':_0x2ce11b[_0xb7ee('0x1d')]?_0x2ce11b[_0xb7ee('0x1d')][_0xb7ee('0x20')]||null:null,'include':_0x2ce11b[_0xb7ee('0x1d')]?_0x2ce11b['options'][_0xb7ee('0x21')]?_[_0xb7ee('0x22')](_0x2ce11b[_0xb7ee('0x1d')][_0xb7ee('0x21')],function(_0x55ba77){return{'model':db[_0x55ba77['model']],'as':_0x55ba77['as'],'attributes':_0x55ba77[_0xb7ee('0x23')],'include':_0x55ba77[_0xb7ee('0x21')]?_[_0xb7ee('0x22')](_0x55ba77[_0xb7ee('0x21')],function(_0x275d44){return{'model':db[_0x275d44[_0xb7ee('0x24')]],'as':_0x275d44['as'],'attributes':_0x275d44[_0xb7ee('0x23')],'include':_0x275d44[_0xb7ee('0x21')]?_[_0xb7ee('0x22')](_0x275d44[_0xb7ee('0x21')],function(_0x91ee37){return{'model':db[_0x91ee37[_0xb7ee('0x24')]],'as':_0x91ee37['as'],'attributes':_0x91ee37['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f9b9b){logger[_0xb7ee('0x17')](_0xb7ee('0x1a'),_0x2ce11b);logger[_0xb7ee('0x11')](_0xb7ee('0x1a'),_0x2ce11b,JSON['stringify'](_0x1f9b9b));_0xb8abdd(_0x1f9b9b);})[_0xb7ee('0x19')](function(_0x4499ff){logger[_0xb7ee('0x14')](_0xb7ee('0x1a'),_0x4499ff['message'],_0x2ce11b);_0x322a84(_0x44bc24[_0xb7ee('0x14')](0x1f4,_0x4499ff['message']));});});};exports['ShowFaxQueue']=function(_0x358c82){var _0x3f0474=this;return new Promise(function(_0x46e65d,_0x2c963f){return db[_0xb7ee('0x1b')][_0xb7ee('0x25')]({'raw':_0x358c82[_0xb7ee('0x1d')]?_0x358c82[_0xb7ee('0x1d')][_0xb7ee('0x1e')]===undefined?!![]:![]:!![],'where':_0x358c82[_0xb7ee('0x1d')]?_0x358c82[_0xb7ee('0x1d')][_0xb7ee('0x1f')]||null:null,'attributes':_0x358c82[_0xb7ee('0x1d')]?_0x358c82[_0xb7ee('0x1d')][_0xb7ee('0x23')]||null:null,'include':_0x358c82[_0xb7ee('0x1d')]?_0x358c82['options'][_0xb7ee('0x21')]?_[_0xb7ee('0x22')](_0x358c82[_0xb7ee('0x1d')][_0xb7ee('0x21')],function(_0x22d366){return{'model':db[_0x22d366[_0xb7ee('0x24')]],'as':_0x22d366['as'],'attributes':_0x22d366['attributes'],'include':_0x22d366['include']?_[_0xb7ee('0x22')](_0x22d366[_0xb7ee('0x21')],function(_0x5031b0){return{'model':db[_0x5031b0['model']],'as':_0x5031b0['as'],'attributes':_0x5031b0[_0xb7ee('0x23')],'include':_0x5031b0[_0xb7ee('0x21')]?_[_0xb7ee('0x22')](_0x5031b0['include'],function(_0x55f3e0){return{'model':db[_0x55f3e0['model']],'as':_0x55f3e0['as'],'attributes':_0x55f3e0[_0xb7ee('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xbade27){logger[_0xb7ee('0x17')](_0xb7ee('0x26'),_0x358c82);logger[_0xb7ee('0x11')]('ShowFaxQueue',_0x358c82,JSON[_0xb7ee('0x13')](_0xbade27));_0x46e65d(_0xbade27);})[_0xb7ee('0x19')](function(_0x5df9a5){logger['error'](_0xb7ee('0x26'),_0x5df9a5[_0xb7ee('0x16')],_0x358c82);_0x2c963f(_0x3f0474['error'](0x1f4,_0x5df9a5[_0xb7ee('0x16')]));});});}; \ No newline at end of file +var _0x288b=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','FaxQueue,\x20%s,\x20%s','request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowFaxQueue','find','debug','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x5bd549,_0x416d46){var _0x47a9e8=function(_0x4ad912){while(--_0x4ad912){_0x5bd549['push'](_0x5bd549['shift']());}};_0x47a9e8(++_0x416d46);}(_0x288b,0x12f));var _0xb288=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x288b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb288('0x0'));var util=require('util');var moment=require(_0xb288('0x1'));var BPromise=require(_0xb288('0x2'));var rs=require(_0xb288('0x3'));var fs=require('fs');var Redis=require(_0xb288('0x4'));var db=require(_0xb288('0x5'))['db'];var utils=require(_0xb288('0x6'));var logger=require(_0xb288('0x7'))(_0xb288('0x8'));var config=require(_0xb288('0x9'));var jayson=require(_0xb288('0xa'));var client=jayson['client'][_0xb288('0xb')]({'port':0x232a});config[_0xb288('0xc')]=_[_0xb288('0xd')](config[_0xb288('0xc')],{'host':_0xb288('0xe'),'port':0x18eb});var socket=require(_0xb288('0xf'))(new Redis(config[_0xb288('0xc')]));require(_0xb288('0x10'))[_0xb288('0x11')](socket);function respondWithRpcPromise(_0x1d4f23,_0x5734ca,_0x1f5447){return new BPromise(function(_0x131440,_0x3bdcb2){return client[_0xb288('0x12')](_0x1d4f23,_0x1f5447)[_0xb288('0x13')](function(_0x2300a7){logger['info'](_0xb288('0x14'),_0x5734ca,_0xb288('0x15'));logger['debug'](_0xb288('0x16'),_0x5734ca,_0xb288('0x15'),JSON[_0xb288('0x17')](_0x2300a7));if(_0x2300a7[_0xb288('0x18')]){if(_0x2300a7['error'][_0xb288('0x19')]===0x1f4){logger[_0xb288('0x18')]('FaxQueue,\x20%s,\x20%s',_0x5734ca,_0x2300a7[_0xb288('0x18')][_0xb288('0x1a')]);return _0x3bdcb2(_0x2300a7['error'][_0xb288('0x1a')]);}logger[_0xb288('0x18')](_0xb288('0x14'),_0x5734ca,_0x2300a7['error'][_0xb288('0x1a')]);return _0x131440(_0x2300a7[_0xb288('0x18')][_0xb288('0x1a')]);}else{logger[_0xb288('0x1b')](_0xb288('0x14'),_0x5734ca,_0xb288('0x15'));_0x131440(_0x2300a7[_0xb288('0x1c')][_0xb288('0x1a')]);}})[_0xb288('0x1d')](function(_0x36fc03){logger[_0xb288('0x18')](_0xb288('0x14'),_0x5734ca,_0x36fc03);_0x3bdcb2(_0x36fc03);});});}exports[_0xb288('0x1e')]=function(_0xf94441){var _0x13a0b3=this;return new Promise(function(_0x43a6f4,_0x4ad6ac){return db[_0xb288('0x1f')][_0xb288('0x20')]({'raw':_0xf94441[_0xb288('0x21')]?_0xf94441[_0xb288('0x21')][_0xb288('0x22')]===undefined?!![]:![]:!![],'where':_0xf94441[_0xb288('0x21')]?_0xf94441['options'][_0xb288('0x23')]||null:null,'attributes':_0xf94441[_0xb288('0x21')]?_0xf94441[_0xb288('0x21')][_0xb288('0x24')]||null:null,'limit':_0xf94441[_0xb288('0x21')]?_0xf94441[_0xb288('0x21')][_0xb288('0x25')]||null:null,'include':_0xf94441['options']?_0xf94441[_0xb288('0x21')][_0xb288('0x26')]?_[_0xb288('0x27')](_0xf94441[_0xb288('0x21')][_0xb288('0x26')],function(_0x444805){return{'model':db[_0x444805[_0xb288('0x28')]],'as':_0x444805['as'],'attributes':_0x444805[_0xb288('0x24')],'include':_0x444805[_0xb288('0x26')]?_['map'](_0x444805[_0xb288('0x26')],function(_0x1eb95c){return{'model':db[_0x1eb95c['model']],'as':_0x1eb95c['as'],'attributes':_0x1eb95c['attributes'],'include':_0x1eb95c[_0xb288('0x26')]?_[_0xb288('0x27')](_0x1eb95c[_0xb288('0x26')],function(_0x333c09){return{'model':db[_0x333c09[_0xb288('0x28')]],'as':_0x333c09['as'],'attributes':_0x333c09['attributes']};}):[]};}):[]};}):[]:[]})[_0xb288('0x13')](function(_0x1321cc){logger['info'](_0xb288('0x1e'),_0xf94441);logger['debug'](_0xb288('0x1e'),_0xf94441,JSON['stringify'](_0x1321cc));_0x43a6f4(_0x1321cc);})[_0xb288('0x1d')](function(_0x580ea3){logger[_0xb288('0x18')](_0xb288('0x1e'),_0x580ea3[_0xb288('0x1a')],_0xf94441);_0x4ad6ac(_0x13a0b3[_0xb288('0x18')](0x1f4,_0x580ea3['message']));});});};exports[_0xb288('0x29')]=function(_0xc14dd5){var _0x410af1=this;return new Promise(function(_0x2a3e0c,_0x57126d){return db[_0xb288('0x1f')][_0xb288('0x2a')]({'raw':_0xc14dd5[_0xb288('0x21')]?_0xc14dd5['options'][_0xb288('0x22')]===undefined?!![]:![]:!![],'where':_0xc14dd5[_0xb288('0x21')]?_0xc14dd5[_0xb288('0x21')][_0xb288('0x23')]||null:null,'attributes':_0xc14dd5[_0xb288('0x21')]?_0xc14dd5[_0xb288('0x21')]['attributes']||null:null,'include':_0xc14dd5[_0xb288('0x21')]?_0xc14dd5['options'][_0xb288('0x26')]?_[_0xb288('0x27')](_0xc14dd5[_0xb288('0x21')][_0xb288('0x26')],function(_0x204e57){return{'model':db[_0x204e57[_0xb288('0x28')]],'as':_0x204e57['as'],'attributes':_0x204e57[_0xb288('0x24')],'include':_0x204e57[_0xb288('0x26')]?_[_0xb288('0x27')](_0x204e57[_0xb288('0x26')],function(_0x50057b){return{'model':db[_0x50057b[_0xb288('0x28')]],'as':_0x50057b['as'],'attributes':_0x50057b[_0xb288('0x24')],'include':_0x50057b[_0xb288('0x26')]?_[_0xb288('0x27')](_0x50057b[_0xb288('0x26')],function(_0x3aecff){return{'model':db[_0x3aecff[_0xb288('0x28')]],'as':_0x3aecff['as'],'attributes':_0x3aecff[_0xb288('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23f884){logger[_0xb288('0x1b')](_0xb288('0x29'),_0xc14dd5);logger[_0xb288('0x2b')](_0xb288('0x29'),_0xc14dd5,JSON[_0xb288('0x17')](_0x23f884));_0x2a3e0c(_0x23f884);})[_0xb288('0x1d')](function(_0x367ebc){logger[_0xb288('0x18')](_0xb288('0x29'),_0x367ebc['message'],_0xc14dd5);_0x57126d(_0x410af1[_0xb288('0x18')](0x1f4,_0x367ebc['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index c94e0d9..e37120b 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 _0x8941=['emit','removeListener','length','faxQueue:','./faxQueue.events','save','remove','update'];(function(_0x1e4582,_0x2cff65){var _0xc4a0ee=function(_0xcf085b){while(--_0xcf085b){_0x1e4582['push'](_0x1e4582['shift']());}};_0xc4a0ee(++_0x2cff65);}(_0x8941,0x1b4));var _0x1894=function(_0x2c5c35,_0x4ba4e7){_0x2c5c35=_0x2c5c35-0x0;var _0x32d39e=_0x8941[_0x2c5c35];return _0x32d39e;};'use strict';var FaxQueueEvents=require(_0x1894('0x0'));var events=[_0x1894('0x1'),_0x1894('0x2'),_0x1894('0x3')];function createListener(_0x3c9756,_0x53ff05){return function(_0x19d828){_0x53ff05[_0x1894('0x4')](_0x3c9756,_0x19d828);};}function removeListener(_0x58e084,_0x3ae875){return function(){FaxQueueEvents[_0x1894('0x5')](_0x58e084,_0x3ae875);};}exports['register']=function(_0x3cdd07){for(var _0xb4a4bf=0x0,_0x45fe3c=events[_0x1894('0x6')];_0xb4a4bf<_0x45fe3c;_0xb4a4bf++){var _0x491848=events[_0xb4a4bf];var _0x2152a7=createListener(_0x1894('0x7')+_0x491848,_0x3cdd07);FaxQueueEvents['on'](_0x491848,_0x2152a7);}}; \ No newline at end of file +var _0x9589=['save','remove','update','emit','removeListener','register','length','faxQueue:','./faxQueue.events'];(function(_0x2f7a83,_0x25c64d){var _0x5bc176=function(_0x52c51f){while(--_0x52c51f){_0x2f7a83['push'](_0x2f7a83['shift']());}};_0x5bc176(++_0x25c64d);}(_0x9589,0xbc));var _0x9958=function(_0x5da1f3,_0x45ed6f){_0x5da1f3=_0x5da1f3-0x0;var _0x263aa8=_0x9589[_0x5da1f3];return _0x263aa8;};'use strict';var FaxQueueEvents=require(_0x9958('0x0'));var events=[_0x9958('0x1'),_0x9958('0x2'),_0x9958('0x3')];function createListener(_0x261b39,_0x5f379e){return function(_0x3eec38){_0x5f379e[_0x9958('0x4')](_0x261b39,_0x3eec38);};}function removeListener(_0xe7c0e,_0x4845d4){return function(){FaxQueueEvents[_0x9958('0x5')](_0xe7c0e,_0x4845d4);};}exports[_0x9958('0x6')]=function(_0xef3597){for(var _0x52386d=0x0,_0x4225da=events[_0x9958('0x7')];_0x52386d<_0x4225da;_0x52386d++){var _0x5750c5=events[_0x52386d];var _0x2ac795=createListener(_0x9958('0x8')+_0x5750c5,_0xef3597);FaxQueueEvents['on'](_0x5750c5,_0x2ac795);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 72088c0..5e6d73c 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 _0x68b3=['addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x68b3,0x1d8));var _0x368b=function(_0x2ba5db,_0x2dd01c){_0x2ba5db=_0x2ba5db-0x0;var _0x25141d=_0x68b3[_0x2ba5db];return _0x25141d;};'use strict';var multer=require(_0x368b('0x0'));var util=require(_0x368b('0x1'));var path=require(_0x368b('0x2'));var timeout=require(_0x368b('0x3'));var express=require(_0x368b('0x4'));var router=express['Router']();var fs_extra=require(_0x368b('0x5'));var auth=require(_0x368b('0x6'));var interaction=require(_0x368b('0x7'));var config=require(_0x368b('0x8'));var controller=require('./faxQueue.controller');router[_0x368b('0x9')]('/',auth[_0x368b('0xa')](),controller[_0x368b('0xb')]);router[_0x368b('0x9')](_0x368b('0xc'),auth[_0x368b('0xa')](),controller[_0x368b('0xd')]);router[_0x368b('0x9')](_0x368b('0xe'),auth[_0x368b('0xa')](),controller[_0x368b('0xf')]);router['get'](_0x368b('0x10'),auth[_0x368b('0xa')](),controller[_0x368b('0x11')]);router['get'](_0x368b('0x12'),auth[_0x368b('0xa')](),controller[_0x368b('0x13')]);router['get'](_0x368b('0x14'),auth[_0x368b('0xa')](),controller['getAgents']);router[_0x368b('0x15')]('/',auth[_0x368b('0xa')](),controller[_0x368b('0x16')]);router[_0x368b('0x15')](_0x368b('0x12'),auth['isAuthenticated'](),controller[_0x368b('0x17')]);router[_0x368b('0x15')]('/:id/users',auth[_0x368b('0xa')](),controller[_0x368b('0x18')]);router[_0x368b('0x19')]('/:id',auth[_0x368b('0xa')](),controller[_0x368b('0x1a')]);router[_0x368b('0x1b')]('/:id',auth[_0x368b('0xa')](),controller[_0x368b('0x1c')]);router[_0x368b('0x1b')]('/:id/teams',auth['isAuthenticated'](),controller[_0x368b('0x1d')]);router[_0x368b('0x1b')](_0x368b('0x14'),auth[_0x368b('0xa')](),controller[_0x368b('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x2a07=['index','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','getAgents','post','create','/:id/users','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated'];(function(_0x19a55b,_0x55e825){var _0x4956b1=function(_0x3f073a){while(--_0x3f073a){_0x19a55b['push'](_0x19a55b['shift']());}};_0x4956b1(++_0x55e825);}(_0x2a07,0x74));var _0x72a0=function(_0x81ac6c,_0x1cf87c){_0x81ac6c=_0x81ac6c-0x0;var _0x442c04=_0x2a07[_0x81ac6c];return _0x442c04;};'use strict';var multer=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var path=require(_0x72a0('0x2'));var timeout=require(_0x72a0('0x3'));var express=require(_0x72a0('0x4'));var router=express['Router']();var fs_extra=require(_0x72a0('0x5'));var auth=require(_0x72a0('0x6'));var interaction=require(_0x72a0('0x7'));var config=require(_0x72a0('0x8'));var controller=require(_0x72a0('0x9'));router[_0x72a0('0xa')]('/',auth[_0x72a0('0xb')](),controller[_0x72a0('0xc')]);router[_0x72a0('0xa')](_0x72a0('0xd'),auth[_0x72a0('0xb')](),controller[_0x72a0('0xe')]);router[_0x72a0('0xa')](_0x72a0('0xf'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x10')]);router['get'](_0x72a0('0x11'),auth[_0x72a0('0xb')](),controller['getMembers']);router[_0x72a0('0xa')](_0x72a0('0x12'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x13')]);router[_0x72a0('0xa')]('/:id/users',auth[_0x72a0('0xb')](),controller[_0x72a0('0x14')]);router[_0x72a0('0x15')]('/',auth[_0x72a0('0xb')](),controller[_0x72a0('0x16')]);router[_0x72a0('0x15')](_0x72a0('0x12'),auth['isAuthenticated'](),controller['addTeams']);router[_0x72a0('0x15')](_0x72a0('0x17'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x18')]);router[_0x72a0('0x19')](_0x72a0('0xf'),auth['isAuthenticated'](),controller[_0x72a0('0x1a')]);router[_0x72a0('0x1b')](_0x72a0('0xf'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x1c')]);router['delete'](_0x72a0('0x12'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x1d')]);router['delete'](_0x72a0('0x17'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x1e')]);module[_0x72a0('0x1f')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 28be4ff..4e3a325 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 _0x6b4b=['DATE','moment','sequelize','exports','STRING'];(function(_0x291f31,_0xcf86d3){var _0x28d499=function(_0xbb070){while(--_0xbb070){_0x291f31['push'](_0x291f31['shift']());}};_0x28d499(++_0xcf86d3);}(_0x6b4b,0x88));var _0xb6b4=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0x6b4b[_0x2080a3];return _0x8d7d17;};'use strict';var moment=require(_0xb6b4('0x0'));var Sequelize=require(_0xb6b4('0x1'));module[_0xb6b4('0x2')]={'uniqueid':{'type':Sequelize[_0xb6b4('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xb6b4('0x4')]},'acceptAt':{'type':Sequelize[_0xb6b4('0x4')]},'exitAt':{'type':Sequelize[_0xb6b4('0x4')]},'reason':{'type':Sequelize[_0xb6b4('0x3')]}}; \ No newline at end of file +var _0x4605=['moment','sequelize','exports','STRING','DATE'];(function(_0x30631d,_0x57bf3e){var _0x1dccb5=function(_0x37cede){while(--_0x37cede){_0x30631d['push'](_0x30631d['shift']());}};_0x1dccb5(++_0x57bf3e);}(_0x4605,0x1d6));var _0x5460=function(_0x78029b,_0x19ce64){_0x78029b=_0x78029b-0x0;var _0x2c1b66=_0x4605[_0x78029b];return _0x2c1b66;};'use strict';var moment=require(_0x5460('0x0'));var Sequelize=require(_0x5460('0x1'));module[_0x5460('0x2')]={'uniqueid':{'type':Sequelize[_0x5460('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x5460('0x4')]},'leaveAt':{'type':Sequelize[_0x5460('0x4')]},'acceptAt':{'type':Sequelize[_0x5460('0x4')]},'exitAt':{'type':Sequelize[_0x5460('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 0642d4a..b769ec2 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 _0xc79f=['offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','FaxQueueReport','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x196257,_0x256195){var _0x30d5c7=function(_0x100531){while(--_0x100531){_0x196257['push'](_0x196257['shift']());}};_0x30d5c7(++_0x256195);}(_0xc79f,0x82));var _0xfc79=function(_0x17565e,_0x3ac510){_0x17565e=_0x17565e-0x0;var _0x26154f=_0xc79f[_0x17565e];return _0x26154f;};'use strict';var emlformat=require(_0xfc79('0x0'));var rimraf=require(_0xfc79('0x1'));var zipdir=require(_0xfc79('0x2'));var jsonpatch=require(_0xfc79('0x3'));var rp=require(_0xfc79('0x4'));var moment=require('moment');var BPromise=require(_0xfc79('0x5'));var Mustache=require(_0xfc79('0x6'));var util=require(_0xfc79('0x7'));var path=require(_0xfc79('0x8'));var sox=require(_0xfc79('0x9'));var csv=require(_0xfc79('0xa'));var ejs=require(_0xfc79('0xb'));var fs=require('fs');var fs_extra=require(_0xfc79('0xc'));var _=require(_0xfc79('0xd'));var squel=require('squel');var crypto=require(_0xfc79('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xfc79('0xf'));var toCsv=require(_0xfc79('0xa'));var querystring=require(_0xfc79('0x10'));var Papa=require('papaparse');var Redis=require(_0xfc79('0x11'));var authService=require(_0xfc79('0x12'));var qs=require(_0xfc79('0x13'));var as=require(_0xfc79('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfc79('0x15'))(_0xfc79('0x16'));var utils=require(_0xfc79('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xfc79('0x18'));var db=require(_0xfc79('0x19'))['db'];function respondWithStatusCode(_0x4b7f0e,_0xc2f79){_0xc2f79=_0xc2f79||0xcc;return function(_0x493a04){if(_0x493a04){return _0x4b7f0e[_0xfc79('0x1a')](_0xc2f79);}return _0x4b7f0e[_0xfc79('0x1b')](_0xc2f79)[_0xfc79('0x1c')]();};}function respondWithResult(_0x4996b6,_0x33bf71){_0x33bf71=_0x33bf71||0xc8;return function(_0x29c937){if(_0x29c937){return _0x4996b6[_0xfc79('0x1b')](_0x33bf71)[_0xfc79('0x1d')](_0x29c937);}};}function respondWithFilteredResult(_0x895b17,_0x7ef734){return function(_0x4cb052){if(_0x4cb052){var _0x228dab=typeof _0x7ef734[_0xfc79('0x1e')]===_0xfc79('0x1f')&&typeof _0x7ef734[_0xfc79('0x20')]==='undefined';var _0x39983a=_0x4cb052[_0xfc79('0x21')];var _0x216501=_0x228dab?0x0:_0x7ef734[_0xfc79('0x1e')];var _0x489e9a=_0x228dab?_0x4cb052['count']:_0x7ef734[_0xfc79('0x1e')]+_0x7ef734['limit'];var _0x816333;if(_0x489e9a>=_0x39983a){_0x489e9a=_0x39983a;_0x816333=0xc8;}else{_0x816333=0xce;}_0x895b17[_0xfc79('0x1b')](_0x816333);return _0x895b17[_0xfc79('0x22')](_0xfc79('0x23'),_0x216501+'-'+_0x489e9a+'/'+_0x39983a)['json'](_0x4cb052);}return null;};}function patchUpdates(_0x8187e2){return function(_0x418f64){try{jsonpatch[_0xfc79('0x24')](_0x418f64,_0x8187e2,!![]);}catch(_0x3c3c54){return BPromise[_0xfc79('0x25')](_0x3c3c54);}return _0x418f64[_0xfc79('0x26')]();};}function saveUpdates(_0x287549,_0x5009d5){return function(_0x1d6551){if(_0x1d6551){return _0x1d6551[_0xfc79('0x27')](_0x287549)[_0xfc79('0x28')](function(_0x2042ee){return _0x2042ee;});}return null;};}function removeEntity(_0x44ab6b,_0x5a1c6e){return function(_0x4d8636){if(_0x4d8636){return _0x4d8636['destroy']()[_0xfc79('0x28')](function(){_0x44ab6b[_0xfc79('0x1b')](0xcc)[_0xfc79('0x1c')]();});}};}function handleEntityNotFound(_0x324191,_0x5dcf36){return function(_0x1c152){if(!_0x1c152){_0x324191['sendStatus'](0x194);}return _0x1c152;};}function handleError(_0x3bf898,_0x560ca0){_0x560ca0=_0x560ca0||0x1f4;return function(_0x82011){logger[_0xfc79('0x29')](_0x82011[_0xfc79('0x2a')]);if(_0x82011['name']){delete _0x82011[_0xfc79('0x2b')];}_0x3bf898[_0xfc79('0x1b')](_0x560ca0)[_0xfc79('0x2c')](_0x82011);};}exports[_0xfc79('0x2d')]=function(_0x2ae979,_0x158b2f){var _0x3daf63={},_0x4ef0f8={},_0xa9607={'count':0x0,'rows':[]};var _0x2272ca=_[_0xfc79('0x2e')](db[_0xfc79('0x2f')]['rawAttributes'],function(_0x386b1b){return{'name':_0x386b1b[_0xfc79('0x30')],'type':_0x386b1b[_0xfc79('0x31')][_0xfc79('0x32')]};});_0x4ef0f8[_0xfc79('0x33')]=_[_0xfc79('0x2e')](_0x2272ca,'name');_0x4ef0f8['query']=_[_0xfc79('0x34')](_0x2ae979['query']);_0x4ef0f8[_0xfc79('0x35')]=_[_0xfc79('0x36')](_0x4ef0f8[_0xfc79('0x33')],_0x4ef0f8[_0xfc79('0x37')]);_0x3daf63[_0xfc79('0x38')]=_[_0xfc79('0x36')](_0x4ef0f8[_0xfc79('0x33')],qs[_0xfc79('0x39')](_0x2ae979[_0xfc79('0x37')]['fields']));_0x3daf63[_0xfc79('0x38')]=_0x3daf63[_0xfc79('0x38')][_0xfc79('0x3a')]?_0x3daf63[_0xfc79('0x38')]:_0x4ef0f8[_0xfc79('0x33')];if(!_0x2ae979['query'][_0xfc79('0x3b')](_0xfc79('0x3c'))){_0x3daf63['limit']=qs['limit'](_0x2ae979['query'][_0xfc79('0x20')]);_0x3daf63[_0xfc79('0x1e')]=qs[_0xfc79('0x1e')](_0x2ae979[_0xfc79('0x37')][_0xfc79('0x1e')]);}_0x3daf63['order']=qs[_0xfc79('0x3d')](_0x2ae979[_0xfc79('0x37')][_0xfc79('0x3d')]);_0x3daf63['where']=qs[_0xfc79('0x35')](_[_0xfc79('0x3e')](_0x2ae979['query'],_0x4ef0f8['filters']),_0x2272ca);if(_0x2ae979[_0xfc79('0x37')][_0xfc79('0x3f')]){_0x3daf63[_0xfc79('0x40')]=_[_0xfc79('0x41')](_0x3daf63[_0xfc79('0x40')],{'$or':_[_0xfc79('0x2e')](_0x2272ca,function(_0x812fb5){if(_0x812fb5[_0xfc79('0x31')]!==_0xfc79('0x42')){var _0x55ad84={};_0x55ad84[_0x812fb5[_0xfc79('0x2b')]]={'$like':'%'+_0x2ae979[_0xfc79('0x37')][_0xfc79('0x3f')]+'%'};return _0x55ad84;}})});}_0x3daf63=_['merge']({},_0x3daf63,_0x2ae979[_0xfc79('0x43')]);var _0x554ea0={'where':_0x3daf63[_0xfc79('0x40')]};return db[_0xfc79('0x2f')][_0xfc79('0x21')](_0x554ea0)[_0xfc79('0x28')](function(_0x20f6ac){_0xa9607[_0xfc79('0x21')]=_0x20f6ac;if(_0x2ae979[_0xfc79('0x37')][_0xfc79('0x44')]){_0x3daf63[_0xfc79('0x45')]=[{'all':!![]}];}return db[_0xfc79('0x2f')][_0xfc79('0x46')](_0x3daf63);})[_0xfc79('0x28')](function(_0x305cec){_0xa9607[_0xfc79('0x47')]=_0x305cec;return _0xa9607;})[_0xfc79('0x28')](respondWithFilteredResult(_0x158b2f,_0x3daf63))[_0xfc79('0x48')](handleError(_0x158b2f,null));};exports[_0xfc79('0x49')]=function(_0x53a2bc,_0x14e121){var _0x537559={'raw':!![],'where':{'id':_0x53a2bc[_0xfc79('0x4a')]['id']}},_0xdfcefb={};_0xdfcefb[_0xfc79('0x33')]=_[_0xfc79('0x34')](db[_0xfc79('0x2f')][_0xfc79('0x4b')]);_0xdfcefb[_0xfc79('0x37')]=_[_0xfc79('0x34')](_0x53a2bc[_0xfc79('0x37')]);_0xdfcefb[_0xfc79('0x35')]=_[_0xfc79('0x36')](_0xdfcefb['model'],_0xdfcefb['query']);_0x537559[_0xfc79('0x38')]=_['intersection'](_0xdfcefb[_0xfc79('0x33')],qs['fields'](_0x53a2bc['query'][_0xfc79('0x39')]));_0x537559['attributes']=_0x537559[_0xfc79('0x38')][_0xfc79('0x3a')]?_0x537559[_0xfc79('0x38')]:_0xdfcefb[_0xfc79('0x33')];if(_0x53a2bc['query'][_0xfc79('0x44')]){_0x537559[_0xfc79('0x45')]=[{'all':!![]}];}_0x537559=_['merge']({},_0x537559,_0x53a2bc[_0xfc79('0x43')]);return db[_0xfc79('0x2f')][_0xfc79('0x4c')](_0x537559)[_0xfc79('0x28')](handleEntityNotFound(_0x14e121,null))[_0xfc79('0x28')](respondWithResult(_0x14e121,null))[_0xfc79('0x48')](handleError(_0x14e121,null));};exports[_0xfc79('0x4d')]=function(_0x152ecf,_0x3ffc77){return db[_0xfc79('0x2f')]['create'](_0x152ecf['body'],{})['then'](respondWithResult(_0x3ffc77,0xc9))[_0xfc79('0x48')](handleError(_0x3ffc77,null));};exports[_0xfc79('0x27')]=function(_0x4ce140,_0x549407){if(_0x4ce140[_0xfc79('0x4e')]['id']){delete _0x4ce140[_0xfc79('0x4e')]['id'];}return db[_0xfc79('0x2f')][_0xfc79('0x4c')]({'where':{'id':_0x4ce140[_0xfc79('0x4a')]['id']}})['then'](handleEntityNotFound(_0x549407,null))[_0xfc79('0x28')](saveUpdates(_0x4ce140[_0xfc79('0x4e')],null))['then'](respondWithResult(_0x549407,null))[_0xfc79('0x48')](handleError(_0x549407,null));};exports['destroy']=function(_0x2cada8,_0x1bfaa2){return db[_0xfc79('0x2f')][_0xfc79('0x4c')]({'where':{'id':_0x2cada8['params']['id']}})[_0xfc79('0x28')](handleEntityNotFound(_0x1bfaa2,null))[_0xfc79('0x28')](removeEntity(_0x1bfaa2,null))[_0xfc79('0x48')](handleError(_0x1bfaa2,null));};exports[_0xfc79('0x4f')]=function(_0x3e8356,_0x4d753c){return db[_0xfc79('0x2f')][_0xfc79('0x4f')]()['then'](respondWithResult(_0x4d753c,null))[_0xfc79('0x48')](handleError(_0x4d753c,null));}; \ No newline at end of file +var _0x8d9b=['offset','limit','set','apply','reject','save','update','then','destroy','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','params','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','lodash','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count'];(function(_0x2a55f8,_0x540ac4){var _0x245efd=function(_0x4dbc19){while(--_0x4dbc19){_0x2a55f8['push'](_0x2a55f8['shift']());}};_0x245efd(++_0x540ac4);}(_0x8d9b,0x104));var _0xb8d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8d9b[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xb8d9('0x0'));var rimraf=require(_0xb8d9('0x1'));var zipdir=require(_0xb8d9('0x2'));var jsonpatch=require(_0xb8d9('0x3'));var rp=require(_0xb8d9('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb8d9('0x5'));var util=require('util');var path=require(_0xb8d9('0x6'));var sox=require(_0xb8d9('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb8d9('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb8d9('0x9'));var toCsv=require(_0xb8d9('0xa'));var querystring=require(_0xb8d9('0xb'));var Papa=require(_0xb8d9('0xc'));var Redis=require(_0xb8d9('0xd'));var authService=require(_0xb8d9('0xe'));var qs=require(_0xb8d9('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb8d9('0x10'));var logger=require('../../config/logger')(_0xb8d9('0x11'));var utils=require(_0xb8d9('0x12'));var config=require(_0xb8d9('0x13'));var licenseUtil=require(_0xb8d9('0x14'));var db=require(_0xb8d9('0x15'))['db'];function respondWithStatusCode(_0x13b1d8,_0x10b7fe){_0x10b7fe=_0x10b7fe||0xcc;return function(_0x265472){if(_0x265472){return _0x13b1d8[_0xb8d9('0x16')](_0x10b7fe);}return _0x13b1d8[_0xb8d9('0x17')](_0x10b7fe)[_0xb8d9('0x18')]();};}function respondWithResult(_0x4b0f9,_0x1bcb02){_0x1bcb02=_0x1bcb02||0xc8;return function(_0xb3fa68){if(_0xb3fa68){return _0x4b0f9['status'](_0x1bcb02)[_0xb8d9('0x19')](_0xb3fa68);}};}function respondWithFilteredResult(_0x2c5265,_0x513edf){return function(_0x24f33a){if(_0x24f33a){var _0x283780=typeof _0x513edf['offset']==='undefined'&&typeof _0x513edf['limit']===_0xb8d9('0x1a');var _0x2d1b34=_0x24f33a[_0xb8d9('0x1b')];var _0x1183e4=_0x283780?0x0:_0x513edf['offset'];var _0x31b33f=_0x283780?_0x24f33a['count']:_0x513edf[_0xb8d9('0x1c')]+_0x513edf[_0xb8d9('0x1d')];var _0x447367;if(_0x31b33f>=_0x2d1b34){_0x31b33f=_0x2d1b34;_0x447367=0xc8;}else{_0x447367=0xce;}_0x2c5265[_0xb8d9('0x17')](_0x447367);return _0x2c5265[_0xb8d9('0x1e')]('Content-Range',_0x1183e4+'-'+_0x31b33f+'/'+_0x2d1b34)['json'](_0x24f33a);}return null;};}function patchUpdates(_0x5444a5){return function(_0x42f600){try{jsonpatch[_0xb8d9('0x1f')](_0x42f600,_0x5444a5,!![]);}catch(_0x15495f){return BPromise[_0xb8d9('0x20')](_0x15495f);}return _0x42f600[_0xb8d9('0x21')]();};}function saveUpdates(_0x48c504,_0x963afa){return function(_0x430794){if(_0x430794){return _0x430794[_0xb8d9('0x22')](_0x48c504)[_0xb8d9('0x23')](function(_0x3cefe3){return _0x3cefe3;});}return null;};}function removeEntity(_0x1d94aa,_0x3f4b9d){return function(_0x3d1659){if(_0x3d1659){return _0x3d1659[_0xb8d9('0x24')]()[_0xb8d9('0x23')](function(){_0x1d94aa['status'](0xcc)[_0xb8d9('0x18')]();});}};}function handleEntityNotFound(_0x49380d,_0x52b730){return function(_0x1eb6ee){if(!_0x1eb6ee){_0x49380d[_0xb8d9('0x16')](0x194);}return _0x1eb6ee;};}function handleError(_0x43c9f1,_0x33c75e){_0x33c75e=_0x33c75e||0x1f4;return function(_0x30b346){logger['error'](_0x30b346[_0xb8d9('0x25')]);if(_0x30b346[_0xb8d9('0x26')]){delete _0x30b346[_0xb8d9('0x26')];}_0x43c9f1['status'](_0x33c75e)[_0xb8d9('0x27')](_0x30b346);};}exports[_0xb8d9('0x28')]=function(_0x336918,_0x4ecdaa){var _0x24a9cf={},_0x12a043={},_0x523e6c={'count':0x0,'rows':[]};var _0x344e27=_[_0xb8d9('0x29')](db[_0xb8d9('0x2a')][_0xb8d9('0x2b')],function(_0x358e4d){return{'name':_0x358e4d[_0xb8d9('0x2c')],'type':_0x358e4d[_0xb8d9('0x2d')][_0xb8d9('0x2e')]};});_0x12a043[_0xb8d9('0x2f')]=_[_0xb8d9('0x29')](_0x344e27,'name');_0x12a043[_0xb8d9('0x30')]=_[_0xb8d9('0x31')](_0x336918[_0xb8d9('0x30')]);_0x12a043['filters']=_[_0xb8d9('0x32')](_0x12a043[_0xb8d9('0x2f')],_0x12a043[_0xb8d9('0x30')]);_0x24a9cf[_0xb8d9('0x33')]=_[_0xb8d9('0x32')](_0x12a043[_0xb8d9('0x2f')],qs['fields'](_0x336918['query'][_0xb8d9('0x34')]));_0x24a9cf[_0xb8d9('0x33')]=_0x24a9cf[_0xb8d9('0x33')][_0xb8d9('0x35')]?_0x24a9cf[_0xb8d9('0x33')]:_0x12a043[_0xb8d9('0x2f')];if(!_0x336918['query']['hasOwnProperty'](_0xb8d9('0x36'))){_0x24a9cf[_0xb8d9('0x1d')]=qs[_0xb8d9('0x1d')](_0x336918['query'][_0xb8d9('0x1d')]);_0x24a9cf['offset']=qs[_0xb8d9('0x1c')](_0x336918[_0xb8d9('0x30')][_0xb8d9('0x1c')]);}_0x24a9cf['order']=qs[_0xb8d9('0x37')](_0x336918[_0xb8d9('0x30')]['sort']);_0x24a9cf['where']=qs[_0xb8d9('0x38')](_[_0xb8d9('0x39')](_0x336918[_0xb8d9('0x30')],_0x12a043[_0xb8d9('0x38')]),_0x344e27);if(_0x336918[_0xb8d9('0x30')][_0xb8d9('0x3a')]){_0x24a9cf[_0xb8d9('0x3b')]=_[_0xb8d9('0x3c')](_0x24a9cf[_0xb8d9('0x3b')],{'$or':_[_0xb8d9('0x29')](_0x344e27,function(_0x307936){if(_0x307936[_0xb8d9('0x2d')]!==_0xb8d9('0x3d')){var _0x328b78={};_0x328b78[_0x307936['name']]={'$like':'%'+_0x336918['query'][_0xb8d9('0x3a')]+'%'};return _0x328b78;}})});}_0x24a9cf=_[_0xb8d9('0x3c')]({},_0x24a9cf,_0x336918[_0xb8d9('0x3e')]);var _0x7da436={'where':_0x24a9cf['where']};return db['FaxQueueReport'][_0xb8d9('0x1b')](_0x7da436)['then'](function(_0x639f96){_0x523e6c['count']=_0x639f96;if(_0x336918[_0xb8d9('0x30')]['includeAll']){_0x24a9cf[_0xb8d9('0x3f')]=[{'all':!![]}];}return db[_0xb8d9('0x2a')][_0xb8d9('0x40')](_0x24a9cf);})['then'](function(_0x40fd3e){_0x523e6c[_0xb8d9('0x41')]=_0x40fd3e;return _0x523e6c;})[_0xb8d9('0x23')](respondWithFilteredResult(_0x4ecdaa,_0x24a9cf))['catch'](handleError(_0x4ecdaa,null));};exports['show']=function(_0x580d4f,_0x587c34){var _0x4f7393={'raw':!![],'where':{'id':_0x580d4f[_0xb8d9('0x42')]['id']}},_0xc1816a={};_0xc1816a[_0xb8d9('0x2f')]=_['keys'](db['FaxQueueReport'][_0xb8d9('0x2b')]);_0xc1816a['query']=_[_0xb8d9('0x31')](_0x580d4f[_0xb8d9('0x30')]);_0xc1816a[_0xb8d9('0x38')]=_[_0xb8d9('0x32')](_0xc1816a[_0xb8d9('0x2f')],_0xc1816a['query']);_0x4f7393[_0xb8d9('0x33')]=_[_0xb8d9('0x32')](_0xc1816a['model'],qs[_0xb8d9('0x34')](_0x580d4f[_0xb8d9('0x30')]['fields']));_0x4f7393['attributes']=_0x4f7393[_0xb8d9('0x33')][_0xb8d9('0x35')]?_0x4f7393[_0xb8d9('0x33')]:_0xc1816a[_0xb8d9('0x2f')];if(_0x580d4f[_0xb8d9('0x30')]['includeAll']){_0x4f7393[_0xb8d9('0x3f')]=[{'all':!![]}];}_0x4f7393=_[_0xb8d9('0x3c')]({},_0x4f7393,_0x580d4f[_0xb8d9('0x3e')]);return db[_0xb8d9('0x2a')][_0xb8d9('0x43')](_0x4f7393)[_0xb8d9('0x23')](handleEntityNotFound(_0x587c34,null))['then'](respondWithResult(_0x587c34,null))[_0xb8d9('0x44')](handleError(_0x587c34,null));};exports[_0xb8d9('0x45')]=function(_0xa034ce,_0xc65f27){return db[_0xb8d9('0x2a')][_0xb8d9('0x45')](_0xa034ce['body'],{})[_0xb8d9('0x23')](respondWithResult(_0xc65f27,0xc9))[_0xb8d9('0x44')](handleError(_0xc65f27,null));};exports['update']=function(_0x212310,_0x41f38b){if(_0x212310['body']['id']){delete _0x212310['body']['id'];}return db[_0xb8d9('0x2a')][_0xb8d9('0x43')]({'where':{'id':_0x212310[_0xb8d9('0x42')]['id']}})[_0xb8d9('0x23')](handleEntityNotFound(_0x41f38b,null))[_0xb8d9('0x23')](saveUpdates(_0x212310[_0xb8d9('0x46')],null))[_0xb8d9('0x23')](respondWithResult(_0x41f38b,null))['catch'](handleError(_0x41f38b,null));};exports[_0xb8d9('0x24')]=function(_0x431c21,_0x341d9d){return db['FaxQueueReport'][_0xb8d9('0x43')]({'where':{'id':_0x431c21[_0xb8d9('0x42')]['id']}})['then'](handleEntityNotFound(_0x341d9d,null))['then'](removeEntity(_0x341d9d,null))[_0xb8d9('0x44')](handleError(_0x341d9d,null));};exports[_0xb8d9('0x47')]=function(_0x4e9a10,_0x1825f7){return db[_0xb8d9('0x2a')][_0xb8d9('0x47')]()[_0xb8d9('0x23')](respondWithResult(_0x1825f7,null))['catch'](handleError(_0x1825f7,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 4469232..68b4ee7 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 _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','uniqueid','lodash'];(function(_0x324539,_0x410b1f){var _0x50a61f=function(_0x461cdb){while(--_0x461cdb){_0x324539['push'](_0x324539['shift']());}};_0x50a61f(++_0x410b1f);}(_0x326f,0xd1));var _0xf326=function(_0x3b1445,_0x2e3046){_0x3b1445=_0x3b1445-0x0;var _0x59a256=_0x326f[_0x3b1445];return _0x59a256;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','define','report_fax_queue','uniqueid','util'];(function(_0x5db033,_0x23d675){var _0x256e8b=function(_0x37c156){while(--_0x37c156){_0x5db033['push'](_0x5db033['shift']());}};_0x256e8b(++_0x23d675);}(_0x1261,0x144));var _0x1126=function(_0x572706,_0xadcdb5){_0x572706=_0x572706-0x0;var _0x556ee9=_0x1261[_0x572706];return _0x556ee9;};'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')]('FaxQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index d3cf7fb..842d138 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 _0xebd6=['limit','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','FaxQueueReport','create','options','raw','CreateFaxQueueReport','UpdateFaxQueueReport','update','body','where','attributes'];(function(_0x5b16f3,_0xecd16e){var _0x334471=function(_0x56702c){while(--_0x56702c){_0x5b16f3['push'](_0x5b16f3['shift']());}};_0x334471(++_0xecd16e);}(_0xebd6,0x1c1));var _0x6ebd=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xebd6[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6ebd('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6ebd('0x1'));var db=require(_0x6ebd('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x6ebd('0x3'))(_0x6ebd('0x4'));var config=require(_0x6ebd('0x5'));var jayson=require(_0x6ebd('0x6'));var client=jayson[_0x6ebd('0x7')][_0x6ebd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x31c898,_0x5d1a56,_0x55d44c){return new BPromise(function(_0xac4b01,_0x14b1df){return client[_0x6ebd('0x9')](_0x31c898,_0x55d44c)[_0x6ebd('0xa')](function(_0x1f0b5c){logger[_0x6ebd('0xb')](_0x6ebd('0xc'),_0x5d1a56,_0x6ebd('0xd'));logger[_0x6ebd('0xe')](_0x6ebd('0xf'),_0x5d1a56,'request\x20sent',JSON[_0x6ebd('0x10')](_0x1f0b5c));if(_0x1f0b5c['error']){if(_0x1f0b5c[_0x6ebd('0x11')]['code']===0x1f4){logger[_0x6ebd('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x5d1a56,_0x1f0b5c[_0x6ebd('0x11')]['message']);return _0x14b1df(_0x1f0b5c[_0x6ebd('0x11')][_0x6ebd('0x12')]);}logger[_0x6ebd('0x11')](_0x6ebd('0xc'),_0x5d1a56,_0x1f0b5c[_0x6ebd('0x11')]['message']);return _0xac4b01(_0x1f0b5c[_0x6ebd('0x11')][_0x6ebd('0x12')]);}else{logger['info'](_0x6ebd('0xc'),_0x5d1a56,'request\x20sent');_0xac4b01(_0x1f0b5c[_0x6ebd('0x13')][_0x6ebd('0x12')]);}})[_0x6ebd('0x14')](function(_0x13017c){logger[_0x6ebd('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x5d1a56,_0x13017c);_0x14b1df(_0x13017c);});});}exports['CreateFaxQueueReport']=function(_0x1f93e6){var _0x2f2b3c=this;return new Promise(function(_0x46a800,_0x5bbef6){return db[_0x6ebd('0x15')][_0x6ebd('0x16')](_0x1f93e6['body'],{'raw':_0x1f93e6[_0x6ebd('0x17')]?_0x1f93e6['options'][_0x6ebd('0x18')]===undefined?!![]:![]:!![]})[_0x6ebd('0xa')](function(_0x1cfd79){logger[_0x6ebd('0xb')](_0x6ebd('0x19'),_0x1f93e6);logger[_0x6ebd('0xe')]('CreateFaxQueueReport',_0x1f93e6,JSON[_0x6ebd('0x10')](_0x1cfd79));_0x46a800(_0x1cfd79);})[_0x6ebd('0x14')](function(_0x21c627){logger[_0x6ebd('0x11')](_0x6ebd('0x19'),_0x21c627[_0x6ebd('0x12')],_0x1f93e6);_0x5bbef6(_0x2f2b3c[_0x6ebd('0x11')](0x1f4,_0x21c627['message']));});});};exports[_0x6ebd('0x1a')]=function(_0x3744fc){var _0x5db4f6=this;return new Promise(function(_0x117f26,_0x3f7147){return db[_0x6ebd('0x15')][_0x6ebd('0x1b')](_0x3744fc[_0x6ebd('0x1c')],{'raw':_0x3744fc[_0x6ebd('0x17')]?_0x3744fc[_0x6ebd('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3744fc['options']?_0x3744fc[_0x6ebd('0x17')][_0x6ebd('0x1d')]||null:null,'attributes':_0x3744fc[_0x6ebd('0x17')]?_0x3744fc[_0x6ebd('0x17')][_0x6ebd('0x1e')]||null:null,'limit':_0x3744fc[_0x6ebd('0x17')]?_0x3744fc['options'][_0x6ebd('0x1f')]||null:null})[_0x6ebd('0xa')](function(_0x30a98d){logger[_0x6ebd('0xb')]('UpdateFaxQueueReport',_0x3744fc);logger['debug'](_0x6ebd('0x1a'),_0x3744fc,JSON[_0x6ebd('0x10')](_0x30a98d));_0x117f26(_0x30a98d);})[_0x6ebd('0x14')](function(_0x1f5872){logger['error']('UpdateFaxQueueReport',_0x1f5872[_0x6ebd('0x12')],_0x3744fc);_0x3f7147(_0x5db4f6['error'](0x1f4,_0x1f5872[_0x6ebd('0x12')]));});});}; \ No newline at end of file +var _0xe9a6=['FaxQueueReport,\x20%s,\x20%s','message','CreateFaxQueueReport','create','options','then','catch','UpdateFaxQueueReport','body','raw','where','attributes','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x401a4d,_0x4bb835){var _0x1faaff=function(_0x57539e){while(--_0x57539e){_0x401a4d['push'](_0x401a4d['shift']());}};_0x1faaff(++_0x4bb835);}(_0xe9a6,0x192));var _0x6e9a=function(_0x4f9bfb,_0x40fc01){_0x4f9bfb=_0x4f9bfb-0x0;var _0x380598=_0xe9a6[_0x4f9bfb];return _0x380598;};'use strict';var _=require(_0x6e9a('0x0'));var util=require('util');var moment=require(_0x6e9a('0x1'));var BPromise=require(_0x6e9a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6e9a('0x3'));var db=require(_0x6e9a('0x4'))['db'];var utils=require(_0x6e9a('0x5'));var logger=require(_0x6e9a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6e9a('0x7'));var client=jayson[_0x6e9a('0x8')][_0x6e9a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3930a8,_0x497ed1,_0x3dbe77){return new BPromise(function(_0x2833f3,_0x45bbe1){return client[_0x6e9a('0xa')](_0x3930a8,_0x3dbe77)['then'](function(_0x38a6f6){logger[_0x6e9a('0xb')]('FaxQueueReport,\x20%s,\x20%s',_0x497ed1,_0x6e9a('0xc'));logger[_0x6e9a('0xd')](_0x6e9a('0xe'),_0x497ed1,_0x6e9a('0xc'),JSON[_0x6e9a('0xf')](_0x38a6f6));if(_0x38a6f6[_0x6e9a('0x10')]){if(_0x38a6f6[_0x6e9a('0x10')][_0x6e9a('0x11')]===0x1f4){logger[_0x6e9a('0x10')](_0x6e9a('0x12'),_0x497ed1,_0x38a6f6[_0x6e9a('0x10')]['message']);return _0x45bbe1(_0x38a6f6[_0x6e9a('0x10')]['message']);}logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x497ed1,_0x38a6f6[_0x6e9a('0x10')][_0x6e9a('0x13')]);return _0x2833f3(_0x38a6f6['error'][_0x6e9a('0x13')]);}else{logger[_0x6e9a('0xb')](_0x6e9a('0x12'),_0x497ed1,_0x6e9a('0xc'));_0x2833f3(_0x38a6f6['result'][_0x6e9a('0x13')]);}})['catch'](function(_0x1dde3c){logger[_0x6e9a('0x10')](_0x6e9a('0x12'),_0x497ed1,_0x1dde3c);_0x45bbe1(_0x1dde3c);});});}exports[_0x6e9a('0x14')]=function(_0xe805f3){var _0x8294b8=this;return new Promise(function(_0x25360f,_0x1a1ed2){return db['FaxQueueReport'][_0x6e9a('0x15')](_0xe805f3['body'],{'raw':_0xe805f3['options']?_0xe805f3[_0x6e9a('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x6e9a('0x17')](function(_0xbfa51b){logger[_0x6e9a('0xb')](_0x6e9a('0x14'),_0xe805f3);logger[_0x6e9a('0xd')](_0x6e9a('0x14'),_0xe805f3,JSON[_0x6e9a('0xf')](_0xbfa51b));_0x25360f(_0xbfa51b);})[_0x6e9a('0x18')](function(_0x2eabfd){logger[_0x6e9a('0x10')](_0x6e9a('0x14'),_0x2eabfd[_0x6e9a('0x13')],_0xe805f3);_0x1a1ed2(_0x8294b8['error'](0x1f4,_0x2eabfd[_0x6e9a('0x13')]));});});};exports[_0x6e9a('0x19')]=function(_0x3cdee0){var _0x5b9496=this;return new Promise(function(_0x1261f2,_0x34277d){return db['FaxQueueReport']['update'](_0x3cdee0[_0x6e9a('0x1a')],{'raw':_0x3cdee0[_0x6e9a('0x16')]?_0x3cdee0[_0x6e9a('0x16')][_0x6e9a('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3cdee0[_0x6e9a('0x16')]?_0x3cdee0[_0x6e9a('0x16')][_0x6e9a('0x1c')]||null:null,'attributes':_0x3cdee0['options']?_0x3cdee0[_0x6e9a('0x16')][_0x6e9a('0x1d')]||null:null,'limit':_0x3cdee0[_0x6e9a('0x16')]?_0x3cdee0[_0x6e9a('0x16')]['limit']||null:null})[_0x6e9a('0x17')](function(_0x52829c){logger['info'](_0x6e9a('0x19'),_0x3cdee0);logger[_0x6e9a('0xd')](_0x6e9a('0x19'),_0x3cdee0,JSON[_0x6e9a('0xf')](_0x52829c));_0x1261f2(_0x52829c);})[_0x6e9a('0x18')](function(_0x396d91){logger['error'](_0x6e9a('0x19'),_0x396d91[_0x6e9a('0x13')],_0x3cdee0);_0x34277d(_0x5b9496[_0x6e9a('0x10')](0x1f4,_0x396d91[_0x6e9a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index ab49203..67f7c46 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 _0xe785=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','update','delete','exports','multer'];(function(_0x2710e0,_0x179dc1){var _0x3b240c=function(_0x70b55){while(--_0x70b55){_0x2710e0['push'](_0x2710e0['shift']());}};_0x3b240c(++_0x179dc1);}(_0xe785,0x1a1));var _0x5e78=function(_0x3ac18a,_0x54b80a){_0x3ac18a=_0x3ac18a-0x0;var _0x245f49=_0xe785[_0x3ac18a];return _0x245f49;};'use strict';var multer=require(_0x5e78('0x0'));var util=require(_0x5e78('0x1'));var path=require(_0x5e78('0x2'));var timeout=require(_0x5e78('0x3'));var express=require(_0x5e78('0x4'));var router=express[_0x5e78('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5e78('0x6'));var config=require(_0x5e78('0x7'));var controller=require(_0x5e78('0x8'));router[_0x5e78('0x9')]('/',auth[_0x5e78('0xa')](),controller[_0x5e78('0xb')]);router[_0x5e78('0x9')](_0x5e78('0xc'),auth[_0x5e78('0xa')](),controller[_0x5e78('0xd')]);router[_0x5e78('0x9')](_0x5e78('0xe'),auth[_0x5e78('0xa')](),controller['show']);router[_0x5e78('0xf')]('/',auth[_0x5e78('0xa')](),controller['create']);router['put'](_0x5e78('0xe'),auth[_0x5e78('0xa')](),controller[_0x5e78('0x10')]);router[_0x5e78('0x11')](_0x5e78('0xe'),auth[_0x5e78('0xa')](),controller['destroy']);module[_0x5e78('0x12')]=router; \ No newline at end of file +var _0x6ad1=['multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./faxQueueReport.controller','isAuthenticated','index','/describe','describe','get','/:id','post','create','put','update','delete','destroy'];(function(_0x35b87c,_0x166a8c){var _0x24795b=function(_0x2cb112){while(--_0x2cb112){_0x35b87c['push'](_0x35b87c['shift']());}};_0x24795b(++_0x166a8c);}(_0x6ad1,0x17a));var _0x16ad=function(_0x997272,_0x1e2c9e){_0x997272=_0x997272-0x0;var _0xcdfa4=_0x6ad1[_0x997272];return _0xcdfa4;};'use strict';var multer=require(_0x16ad('0x0'));var util=require(_0x16ad('0x1'));var path=require(_0x16ad('0x2'));var timeout=require(_0x16ad('0x3'));var express=require(_0x16ad('0x4'));var router=express[_0x16ad('0x5')]();var fs_extra=require(_0x16ad('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x16ad('0x7'));var controller=require(_0x16ad('0x8'));router['get']('/',auth[_0x16ad('0x9')](),controller[_0x16ad('0xa')]);router['get'](_0x16ad('0xb'),auth[_0x16ad('0x9')](),controller[_0x16ad('0xc')]);router[_0x16ad('0xd')](_0x16ad('0xe'),auth[_0x16ad('0x9')](),controller['show']);router[_0x16ad('0xf')]('/',auth[_0x16ad('0x9')](),controller[_0x16ad('0x10')]);router[_0x16ad('0x11')](_0x16ad('0xe'),auth['isAuthenticated'](),controller[_0x16ad('0x12')]);router[_0x16ad('0x13')]('/:id',auth[_0x16ad('0x9')](),controller[_0x16ad('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 111819a..6d4db4a 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 _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x38e8b0,_0x5b8cb5){var _0x139697=function(_0x2042dd){while(--_0x2042dd){_0x38e8b0['push'](_0x38e8b0['shift']());}};_0x139697(++_0x5b8cb5);}(_0x54ef,0x112));var _0xf54e=function(_0x28b9d9,_0x53540f){_0x28b9d9=_0x28b9d9-0x0;var _0x2ac289=_0x54ef[_0x28b9d9];return _0x2ac289;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file +var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x43b06b,_0x1929c7){var _0x2c555b=function(_0x30fa8c){while(--_0x30fa8c){_0x43b06b['push'](_0x43b06b['shift']());}};_0x2c555b(++_0x1929c7);}(_0xb43b,0x1b2));var _0xbb43=function(_0x28138f,_0x55ae1e){_0x28138f=_0x28138f-0x0;var _0x3d349a=_0xb43b[_0x28138f];return _0x3d349a;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 5d03266..70fd716 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 _0x22da=['../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','apply','reject','save','update','destroy','end','error','stack','name','send','index','map','FaxTransferReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','include','findAll','rows','catch','params','rawAttributes','includeAll','find','create','body','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x10d04,_0x18d98e){var _0x3535de=function(_0x1bce29){while(--_0x1bce29){_0x10d04['push'](_0x10d04['shift']());}};_0x3535de(++_0x18d98e);}(_0x22da,0xce));var _0xa22d=function(_0x3ba540,_0x3555e7){_0x3ba540=_0x3ba540-0x0;var _0x45c4ff=_0x22da[_0x3ba540];return _0x45c4ff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa22d('0x0'));var zipdir=require(_0xa22d('0x1'));var jsonpatch=require(_0xa22d('0x2'));var rp=require('request-promise');var moment=require(_0xa22d('0x3'));var BPromise=require(_0xa22d('0x4'));var Mustache=require(_0xa22d('0x5'));var util=require(_0xa22d('0x6'));var path=require('path');var sox=require(_0xa22d('0x7'));var csv=require(_0xa22d('0x8'));var ejs=require(_0xa22d('0x9'));var fs=require('fs');var fs_extra=require(_0xa22d('0xa'));var _=require(_0xa22d('0xb'));var squel=require(_0xa22d('0xc'));var crypto=require('crypto');var jsforce=require(_0xa22d('0xd'));var deskjs=require(_0xa22d('0xe'));var toCsv=require(_0xa22d('0x8'));var querystring=require(_0xa22d('0xf'));var Papa=require(_0xa22d('0x10'));var Redis=require(_0xa22d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa22d('0x12'));var as=require(_0xa22d('0x13'));var hardwareService=require(_0xa22d('0x14'));var logger=require('../../config/logger')(_0xa22d('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa22d('0x16'))['db'];function respondWithStatusCode(_0x188c1b,_0x4df4d7){_0x4df4d7=_0x4df4d7||0xcc;return function(_0x34af4a){if(_0x34af4a){return _0x188c1b[_0xa22d('0x17')](_0x4df4d7);}return _0x188c1b[_0xa22d('0x18')](_0x4df4d7)['end']();};}function respondWithResult(_0x486917,_0x3a2ea1){_0x3a2ea1=_0x3a2ea1||0xc8;return function(_0x302f45){if(_0x302f45){return _0x486917['status'](_0x3a2ea1)[_0xa22d('0x19')](_0x302f45);}};}function respondWithFilteredResult(_0x492f03,_0x25686d){return function(_0x4e5974){if(_0x4e5974){var _0x2ffd79=typeof _0x25686d[_0xa22d('0x1a')]==='undefined'&&typeof _0x25686d[_0xa22d('0x1b')]===_0xa22d('0x1c');var _0x3fec77=_0x4e5974['count'];var _0x5a9640=_0x2ffd79?0x0:_0x25686d['offset'];var _0x460ca8=_0x2ffd79?_0x4e5974[_0xa22d('0x1d')]:_0x25686d[_0xa22d('0x1a')]+_0x25686d[_0xa22d('0x1b')];var _0x421255;if(_0x460ca8>=_0x3fec77){_0x460ca8=_0x3fec77;_0x421255=0xc8;}else{_0x421255=0xce;}_0x492f03['status'](_0x421255);return _0x492f03['set']('Content-Range',_0x5a9640+'-'+_0x460ca8+'/'+_0x3fec77)[_0xa22d('0x19')](_0x4e5974);}return null;};}function patchUpdates(_0x2b31ce){return function(_0x4d9ab4){try{jsonpatch[_0xa22d('0x1e')](_0x4d9ab4,_0x2b31ce,!![]);}catch(_0x47a2c5){return BPromise[_0xa22d('0x1f')](_0x47a2c5);}return _0x4d9ab4[_0xa22d('0x20')]();};}function saveUpdates(_0x3f45d8,_0x29e82c){return function(_0x17ea76){if(_0x17ea76){return _0x17ea76[_0xa22d('0x21')](_0x3f45d8)['then'](function(_0x3390f1){return _0x3390f1;});}return null;};}function removeEntity(_0x571607,_0x1ae1fb){return function(_0x376f18){if(_0x376f18){return _0x376f18[_0xa22d('0x22')]()['then'](function(){_0x571607[_0xa22d('0x18')](0xcc)[_0xa22d('0x23')]();});}};}function handleEntityNotFound(_0x3e62c0,_0x5cf4cf){return function(_0xe3608d){if(!_0xe3608d){_0x3e62c0[_0xa22d('0x17')](0x194);}return _0xe3608d;};}function handleError(_0xc2b774,_0x3f8837){_0x3f8837=_0x3f8837||0x1f4;return function(_0x44874d){logger[_0xa22d('0x24')](_0x44874d[_0xa22d('0x25')]);if(_0x44874d[_0xa22d('0x26')]){delete _0x44874d[_0xa22d('0x26')];}_0xc2b774[_0xa22d('0x18')](_0x3f8837)[_0xa22d('0x27')](_0x44874d);};}exports[_0xa22d('0x28')]=function(_0x4c76bb,_0x323ac0){var _0x74a8cf={},_0x34d56c={},_0x4ba6e3={'count':0x0,'rows':[]};var _0x571a67=_[_0xa22d('0x29')](db[_0xa22d('0x2a')]['rawAttributes'],function(_0x399c7b){return{'name':_0x399c7b[_0xa22d('0x2b')],'type':_0x399c7b[_0xa22d('0x2c')][_0xa22d('0x2d')]};});_0x34d56c[_0xa22d('0x2e')]=_['map'](_0x571a67,_0xa22d('0x26'));_0x34d56c[_0xa22d('0x2f')]=_[_0xa22d('0x30')](_0x4c76bb[_0xa22d('0x2f')]);_0x34d56c[_0xa22d('0x31')]=_[_0xa22d('0x32')](_0x34d56c['model'],_0x34d56c['query']);_0x74a8cf[_0xa22d('0x33')]=_[_0xa22d('0x32')](_0x34d56c['model'],qs['fields'](_0x4c76bb['query'][_0xa22d('0x34')]));_0x74a8cf[_0xa22d('0x33')]=_0x74a8cf[_0xa22d('0x33')][_0xa22d('0x35')]?_0x74a8cf[_0xa22d('0x33')]:_0x34d56c[_0xa22d('0x2e')];if(!_0x4c76bb[_0xa22d('0x2f')][_0xa22d('0x36')](_0xa22d('0x37'))){_0x74a8cf[_0xa22d('0x1b')]=qs[_0xa22d('0x1b')](_0x4c76bb[_0xa22d('0x2f')][_0xa22d('0x1b')]);_0x74a8cf[_0xa22d('0x1a')]=qs[_0xa22d('0x1a')](_0x4c76bb[_0xa22d('0x2f')]['offset']);}_0x74a8cf[_0xa22d('0x38')]=qs['sort'](_0x4c76bb[_0xa22d('0x2f')][_0xa22d('0x39')]);_0x74a8cf[_0xa22d('0x3a')]=qs[_0xa22d('0x31')](_[_0xa22d('0x3b')](_0x4c76bb[_0xa22d('0x2f')],_0x34d56c[_0xa22d('0x31')]),_0x571a67);if(_0x4c76bb[_0xa22d('0x2f')][_0xa22d('0x3c')]){_0x74a8cf['where']=_[_0xa22d('0x3d')](_0x74a8cf[_0xa22d('0x3a')],{'$or':_[_0xa22d('0x29')](_0x571a67,function(_0x361d19){if(_0x361d19[_0xa22d('0x2c')]!==_0xa22d('0x3e')){var _0x2757ea={};_0x2757ea[_0x361d19[_0xa22d('0x26')]]={'$like':'%'+_0x4c76bb[_0xa22d('0x2f')][_0xa22d('0x3c')]+'%'};return _0x2757ea;}})});}_0x74a8cf=_[_0xa22d('0x3d')]({},_0x74a8cf,_0x4c76bb[_0xa22d('0x3f')]);var _0x3abeff={'where':_0x74a8cf[_0xa22d('0x3a')]};return db[_0xa22d('0x2a')][_0xa22d('0x1d')](_0x3abeff)[_0xa22d('0x40')](function(_0x29bfcd){_0x4ba6e3['count']=_0x29bfcd;if(_0x4c76bb['query']['includeAll']){_0x74a8cf[_0xa22d('0x41')]=[{'all':!![]}];}return db[_0xa22d('0x2a')][_0xa22d('0x42')](_0x74a8cf);})['then'](function(_0x5d483a){_0x4ba6e3[_0xa22d('0x43')]=_0x5d483a;return _0x4ba6e3;})[_0xa22d('0x40')](respondWithFilteredResult(_0x323ac0,_0x74a8cf))[_0xa22d('0x44')](handleError(_0x323ac0,null));};exports['show']=function(_0x50b82d,_0x42a802){var _0x733f9e={'raw':!![],'where':{'id':_0x50b82d[_0xa22d('0x45')]['id']}},_0x26108f={};_0x26108f[_0xa22d('0x2e')]=_[_0xa22d('0x30')](db[_0xa22d('0x2a')][_0xa22d('0x46')]);_0x26108f[_0xa22d('0x2f')]=_[_0xa22d('0x30')](_0x50b82d[_0xa22d('0x2f')]);_0x26108f['filters']=_[_0xa22d('0x32')](_0x26108f[_0xa22d('0x2e')],_0x26108f[_0xa22d('0x2f')]);_0x733f9e[_0xa22d('0x33')]=_[_0xa22d('0x32')](_0x26108f[_0xa22d('0x2e')],qs[_0xa22d('0x34')](_0x50b82d['query'][_0xa22d('0x34')]));_0x733f9e['attributes']=_0x733f9e['attributes'][_0xa22d('0x35')]?_0x733f9e['attributes']:_0x26108f['model'];if(_0x50b82d['query'][_0xa22d('0x47')]){_0x733f9e[_0xa22d('0x41')]=[{'all':!![]}];}_0x733f9e=_['merge']({},_0x733f9e,_0x50b82d['options']);return db[_0xa22d('0x2a')][_0xa22d('0x48')](_0x733f9e)[_0xa22d('0x40')](handleEntityNotFound(_0x42a802,null))[_0xa22d('0x40')](respondWithResult(_0x42a802,null))[_0xa22d('0x44')](handleError(_0x42a802,null));};exports[_0xa22d('0x49')]=function(_0x102cfa,_0x30b166){return db[_0xa22d('0x2a')][_0xa22d('0x49')](_0x102cfa[_0xa22d('0x4a')],{})[_0xa22d('0x40')](respondWithResult(_0x30b166,0xc9))[_0xa22d('0x44')](handleError(_0x30b166,null));};exports[_0xa22d('0x21')]=function(_0x1adc05,_0x3cc5ca){if(_0x1adc05[_0xa22d('0x4a')]['id']){delete _0x1adc05['body']['id'];}return db[_0xa22d('0x2a')][_0xa22d('0x48')]({'where':{'id':_0x1adc05[_0xa22d('0x45')]['id']}})['then'](handleEntityNotFound(_0x3cc5ca,null))[_0xa22d('0x40')](saveUpdates(_0x1adc05[_0xa22d('0x4a')],null))[_0xa22d('0x40')](respondWithResult(_0x3cc5ca,null))[_0xa22d('0x44')](handleError(_0x3cc5ca,null));};exports[_0xa22d('0x22')]=function(_0x44cbba,_0x2952c0){return db[_0xa22d('0x2a')][_0xa22d('0x48')]({'where':{'id':_0x44cbba[_0xa22d('0x45')]['id']}})[_0xa22d('0x40')](handleEntityNotFound(_0x2952c0,null))['then'](removeEntity(_0x2952c0,null))[_0xa22d('0x44')](handleError(_0x2952c0,null));};exports[_0xa22d('0x4b')]=function(_0x5a5172,_0x5b5021){return db[_0xa22d('0x2a')][_0xa22d('0x4b')]()[_0xa22d('0x40')](respondWithResult(_0x5b5021,null))[_0xa22d('0x44')](handleError(_0x5b5021,null));}; \ No newline at end of file +var _0xbdd6=['model','hasOwnProperty','order','sort','where','pick','merge','type','filter','options','includeAll','include','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','apply','reject','update','then','destroy','error','stack','name','FaxTransferReport','rawAttributes','fieldName','map','query','keys','filters','intersection','fields','length','attributes'];(function(_0x2a68b2,_0x131299){var _0x3d522b=function(_0x2f032d){while(--_0x2f032d){_0x2a68b2['push'](_0x2a68b2['shift']());}};_0x3d522b(++_0x131299);}(_0xbdd6,0x17c));var _0x6bdd=function(_0x141e03,_0x18340e){_0x141e03=_0x141e03-0x0;var _0x2074e3=_0xbdd6[_0x141e03];return _0x2074e3;};'use strict';var emlformat=require(_0x6bdd('0x0'));var rimraf=require(_0x6bdd('0x1'));var zipdir=require(_0x6bdd('0x2'));var jsonpatch=require(_0x6bdd('0x3'));var rp=require(_0x6bdd('0x4'));var moment=require(_0x6bdd('0x5'));var BPromise=require(_0x6bdd('0x6'));var Mustache=require(_0x6bdd('0x7'));var util=require('util');var path=require(_0x6bdd('0x8'));var sox=require(_0x6bdd('0x9'));var csv=require(_0x6bdd('0xa'));var ejs=require(_0x6bdd('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6bdd('0xc'));var crypto=require(_0x6bdd('0xd'));var jsforce=require(_0x6bdd('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6bdd('0xa'));var querystring=require('querystring');var Papa=require(_0x6bdd('0xf'));var Redis=require(_0x6bdd('0x10'));var authService=require(_0x6bdd('0x11'));var qs=require(_0x6bdd('0x12'));var as=require(_0x6bdd('0x13'));var hardwareService=require(_0x6bdd('0x14'));var logger=require(_0x6bdd('0x15'))(_0x6bdd('0x16'));var utils=require('../../config/utils');var config=require(_0x6bdd('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6bdd('0x18'))['db'];function respondWithStatusCode(_0x43a5d7,_0x525091){_0x525091=_0x525091||0xcc;return function(_0x54d971){if(_0x54d971){return _0x43a5d7[_0x6bdd('0x19')](_0x525091);}return _0x43a5d7[_0x6bdd('0x1a')](_0x525091)[_0x6bdd('0x1b')]();};}function respondWithResult(_0x1c6569,_0xc9004d){_0xc9004d=_0xc9004d||0xc8;return function(_0x460e8c){if(_0x460e8c){return _0x1c6569[_0x6bdd('0x1a')](_0xc9004d)[_0x6bdd('0x1c')](_0x460e8c);}};}function respondWithFilteredResult(_0x18f72c,_0x5d74a2){return function(_0x1c58ef){if(_0x1c58ef){var _0x2e3105=typeof _0x5d74a2[_0x6bdd('0x1d')]==='undefined'&&typeof _0x5d74a2['limit']===_0x6bdd('0x1e');var _0xb44499=_0x1c58ef[_0x6bdd('0x1f')];var _0x48a365=_0x2e3105?0x0:_0x5d74a2[_0x6bdd('0x1d')];var _0x4d542d=_0x2e3105?_0x1c58ef[_0x6bdd('0x1f')]:_0x5d74a2[_0x6bdd('0x1d')]+_0x5d74a2[_0x6bdd('0x20')];var _0x9cd8a0;if(_0x4d542d>=_0xb44499){_0x4d542d=_0xb44499;_0x9cd8a0=0xc8;}else{_0x9cd8a0=0xce;}_0x18f72c[_0x6bdd('0x1a')](_0x9cd8a0);return _0x18f72c['set']('Content-Range',_0x48a365+'-'+_0x4d542d+'/'+_0xb44499)[_0x6bdd('0x1c')](_0x1c58ef);}return null;};}function patchUpdates(_0x3db687){return function(_0x18c016){try{jsonpatch[_0x6bdd('0x21')](_0x18c016,_0x3db687,!![]);}catch(_0x196cb6){return BPromise[_0x6bdd('0x22')](_0x196cb6);}return _0x18c016['save']();};}function saveUpdates(_0x47da7e,_0x213229){return function(_0x10ae37){if(_0x10ae37){return _0x10ae37[_0x6bdd('0x23')](_0x47da7e)[_0x6bdd('0x24')](function(_0x2ebdc3){return _0x2ebdc3;});}return null;};}function removeEntity(_0x288ee6,_0x1a9bc9){return function(_0xbdf5eb){if(_0xbdf5eb){return _0xbdf5eb[_0x6bdd('0x25')]()[_0x6bdd('0x24')](function(){_0x288ee6[_0x6bdd('0x1a')](0xcc)[_0x6bdd('0x1b')]();});}};}function handleEntityNotFound(_0x25165,_0x35af2d){return function(_0x2b1665){if(!_0x2b1665){_0x25165[_0x6bdd('0x19')](0x194);}return _0x2b1665;};}function handleError(_0x1c8342,_0x4d06c3){_0x4d06c3=_0x4d06c3||0x1f4;return function(_0x36c0a1){logger[_0x6bdd('0x26')](_0x36c0a1[_0x6bdd('0x27')]);if(_0x36c0a1[_0x6bdd('0x28')]){delete _0x36c0a1[_0x6bdd('0x28')];}_0x1c8342['status'](_0x4d06c3)['send'](_0x36c0a1);};}exports['index']=function(_0x13e35f,_0x4a9e59){var _0x111576={},_0x19638a={},_0x45626d={'count':0x0,'rows':[]};var _0x57c90a=_['map'](db[_0x6bdd('0x29')][_0x6bdd('0x2a')],function(_0x4292d1){return{'name':_0x4292d1[_0x6bdd('0x2b')],'type':_0x4292d1['type']['key']};});_0x19638a['model']=_[_0x6bdd('0x2c')](_0x57c90a,_0x6bdd('0x28'));_0x19638a[_0x6bdd('0x2d')]=_[_0x6bdd('0x2e')](_0x13e35f[_0x6bdd('0x2d')]);_0x19638a[_0x6bdd('0x2f')]=_[_0x6bdd('0x30')](_0x19638a['model'],_0x19638a[_0x6bdd('0x2d')]);_0x111576['attributes']=_['intersection'](_0x19638a['model'],qs[_0x6bdd('0x31')](_0x13e35f['query'][_0x6bdd('0x31')]));_0x111576['attributes']=_0x111576['attributes'][_0x6bdd('0x32')]?_0x111576[_0x6bdd('0x33')]:_0x19638a[_0x6bdd('0x34')];if(!_0x13e35f['query'][_0x6bdd('0x35')]('nolimit')){_0x111576[_0x6bdd('0x20')]=qs['limit'](_0x13e35f[_0x6bdd('0x2d')][_0x6bdd('0x20')]);_0x111576['offset']=qs[_0x6bdd('0x1d')](_0x13e35f[_0x6bdd('0x2d')]['offset']);}_0x111576[_0x6bdd('0x36')]=qs[_0x6bdd('0x37')](_0x13e35f[_0x6bdd('0x2d')][_0x6bdd('0x37')]);_0x111576[_0x6bdd('0x38')]=qs[_0x6bdd('0x2f')](_[_0x6bdd('0x39')](_0x13e35f[_0x6bdd('0x2d')],_0x19638a['filters']),_0x57c90a);if(_0x13e35f[_0x6bdd('0x2d')]['filter']){_0x111576[_0x6bdd('0x38')]=_[_0x6bdd('0x3a')](_0x111576[_0x6bdd('0x38')],{'$or':_['map'](_0x57c90a,function(_0x3b2aa3){if(_0x3b2aa3[_0x6bdd('0x3b')]!=='VIRTUAL'){var _0x3efe76={};_0x3efe76[_0x3b2aa3['name']]={'$like':'%'+_0x13e35f['query'][_0x6bdd('0x3c')]+'%'};return _0x3efe76;}})});}_0x111576=_[_0x6bdd('0x3a')]({},_0x111576,_0x13e35f[_0x6bdd('0x3d')]);var _0x54ed0e={'where':_0x111576[_0x6bdd('0x38')]};return db['FaxTransferReport']['count'](_0x54ed0e)[_0x6bdd('0x24')](function(_0x2e705d){_0x45626d[_0x6bdd('0x1f')]=_0x2e705d;if(_0x13e35f['query'][_0x6bdd('0x3e')]){_0x111576[_0x6bdd('0x3f')]=[{'all':!![]}];}return db[_0x6bdd('0x29')]['findAll'](_0x111576);})['then'](function(_0x4e091d){_0x45626d[_0x6bdd('0x40')]=_0x4e091d;return _0x45626d;})[_0x6bdd('0x24')](respondWithFilteredResult(_0x4a9e59,_0x111576))[_0x6bdd('0x41')](handleError(_0x4a9e59,null));};exports[_0x6bdd('0x42')]=function(_0x591035,_0xea3811){var _0x34b791={'raw':!![],'where':{'id':_0x591035[_0x6bdd('0x43')]['id']}},_0x3ecf03={};_0x3ecf03[_0x6bdd('0x34')]=_[_0x6bdd('0x2e')](db[_0x6bdd('0x29')]['rawAttributes']);_0x3ecf03[_0x6bdd('0x2d')]=_[_0x6bdd('0x2e')](_0x591035['query']);_0x3ecf03[_0x6bdd('0x2f')]=_[_0x6bdd('0x30')](_0x3ecf03[_0x6bdd('0x34')],_0x3ecf03[_0x6bdd('0x2d')]);_0x34b791[_0x6bdd('0x33')]=_[_0x6bdd('0x30')](_0x3ecf03[_0x6bdd('0x34')],qs['fields'](_0x591035[_0x6bdd('0x2d')]['fields']));_0x34b791['attributes']=_0x34b791[_0x6bdd('0x33')][_0x6bdd('0x32')]?_0x34b791[_0x6bdd('0x33')]:_0x3ecf03['model'];if(_0x591035['query'][_0x6bdd('0x3e')]){_0x34b791[_0x6bdd('0x3f')]=[{'all':!![]}];}_0x34b791=_[_0x6bdd('0x3a')]({},_0x34b791,_0x591035[_0x6bdd('0x3d')]);return db[_0x6bdd('0x29')][_0x6bdd('0x44')](_0x34b791)[_0x6bdd('0x24')](handleEntityNotFound(_0xea3811,null))['then'](respondWithResult(_0xea3811,null))[_0x6bdd('0x41')](handleError(_0xea3811,null));};exports[_0x6bdd('0x45')]=function(_0x285a8d,_0x26ee98){return db[_0x6bdd('0x29')][_0x6bdd('0x45')](_0x285a8d[_0x6bdd('0x46')],{})[_0x6bdd('0x24')](respondWithResult(_0x26ee98,0xc9))[_0x6bdd('0x41')](handleError(_0x26ee98,null));};exports['update']=function(_0x5eca6c,_0x3077e9){if(_0x5eca6c[_0x6bdd('0x46')]['id']){delete _0x5eca6c['body']['id'];}return db[_0x6bdd('0x29')][_0x6bdd('0x44')]({'where':{'id':_0x5eca6c[_0x6bdd('0x43')]['id']}})[_0x6bdd('0x24')](handleEntityNotFound(_0x3077e9,null))['then'](saveUpdates(_0x5eca6c[_0x6bdd('0x46')],null))['then'](respondWithResult(_0x3077e9,null))[_0x6bdd('0x41')](handleError(_0x3077e9,null));};exports[_0x6bdd('0x25')]=function(_0x57bca7,_0x9adcec){return db[_0x6bdd('0x29')]['find']({'where':{'id':_0x57bca7['params']['id']}})['then'](handleEntityNotFound(_0x9adcec,null))['then'](removeEntity(_0x9adcec,null))[_0x6bdd('0x41')](handleError(_0x9adcec,null));};exports[_0x6bdd('0x47')]=function(_0x57fd1f,_0x5f4119){return db[_0x6bdd('0x29')][_0x6bdd('0x47')]()[_0x6bdd('0x24')](respondWithResult(_0x5f4119,null))[_0x6bdd('0x41')](handleError(_0x5f4119,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 7bb4c65..a42b999 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 _0xcb29=['uniqueid','util','../../config/logger','api','request-promise','path','rimraf','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0xcb29,0x12d));var _0x9cb2=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0xcb29[_0x341e0f];return _0x59555a;};'use strict';var _=require('lodash');var util=require(_0x9cb2('0x0'));var logger=require(_0x9cb2('0x1'))(_0x9cb2('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9cb2('0x3'));var fs=require('fs');var path=require(_0x9cb2('0x4'));var rimraf=require(_0x9cb2('0x5'));var config=require('../../config/environment');var attributes=require(_0x9cb2('0x6'));module[_0x9cb2('0x7')]=function(_0x594b4e,_0x5c5f60){return _0x594b4e[_0x9cb2('0x8')](_0x9cb2('0x9'),attributes,{'tableName':_0x9cb2('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x9cb2('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd0e4=['util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','define','FaxTransferReport','uniqueid','lodash'];(function(_0x4e1d41,_0x1fbb42){var _0x54b088=function(_0x5c31dd){while(--_0x5c31dd){_0x4e1d41['push'](_0x4e1d41['shift']());}};_0x54b088(++_0x1fbb42);}(_0xd0e4,0x1d3));var _0x4d0e=function(_0x1168c2,_0x1ed2ce){_0x1168c2=_0x1168c2-0x0;var _0x5ab8b5=_0xd0e4[_0x1168c2];return _0x5ab8b5;};'use strict';var _=require(_0x4d0e('0x0'));var util=require(_0x4d0e('0x1'));var logger=require(_0x4d0e('0x2'))(_0x4d0e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4d0e('0x4'));var fs=require('fs');var path=require(_0x4d0e('0x5'));var rimraf=require(_0x4d0e('0x6'));var config=require(_0x4d0e('0x7'));var attributes=require(_0x4d0e('0x8'));module['exports']=function(_0x588895,_0x5be772){return _0x588895[_0x4d0e('0x9')](_0x4d0e('0xa'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0x4d0e('0xb'),'fields':[_0x4d0e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 0024400..4aba245 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 _0xa363=['rpc','client','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x2b8bff,_0x31d7ee){var _0x5d73f0=function(_0x507065){while(--_0x507065){_0x2b8bff['push'](_0x2b8bff['shift']());}};_0x5d73f0(++_0x31d7ee);}(_0xa363,0x133));var _0x3a36=function(_0x4eda15,_0x28fa8c){_0x4eda15=_0x4eda15-0x0;var _0x292fe7=_0xa363[_0x4eda15];return _0x292fe7;};'use strict';var _=require(_0x3a36('0x0'));var util=require(_0x3a36('0x1'));var moment=require(_0x3a36('0x2'));var BPromise=require(_0x3a36('0x3'));var rs=require(_0x3a36('0x4'));var fs=require('fs');var Redis=require(_0x3a36('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3a36('0x6'));var logger=require(_0x3a36('0x7'))(_0x3a36('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3a36('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d691c,_0x4d679d,_0xe10f71){return new BPromise(function(_0x506be2,_0x183a30){return client['request'](_0x2d691c,_0xe10f71)[_0x3a36('0xa')](function(_0x3156d1){logger['info'](_0x3a36('0xb'),_0x4d679d,_0x3a36('0xc'));logger[_0x3a36('0xd')](_0x3a36('0xe'),_0x4d679d,_0x3a36('0xc'),JSON[_0x3a36('0xf')](_0x3156d1));if(_0x3156d1[_0x3a36('0x10')]){if(_0x3156d1['error']['code']===0x1f4){logger[_0x3a36('0x10')](_0x3a36('0xb'),_0x4d679d,_0x3156d1[_0x3a36('0x10')][_0x3a36('0x11')]);return _0x183a30(_0x3156d1['error']['message']);}logger['error'](_0x3a36('0xb'),_0x4d679d,_0x3156d1[_0x3a36('0x10')][_0x3a36('0x11')]);return _0x506be2(_0x3156d1[_0x3a36('0x10')][_0x3a36('0x11')]);}else{logger[_0x3a36('0x12')](_0x3a36('0xb'),_0x4d679d,_0x3a36('0xc'));_0x506be2(_0x3156d1[_0x3a36('0x13')][_0x3a36('0x11')]);}})[_0x3a36('0x14')](function(_0x54019b){logger[_0x3a36('0x10')](_0x3a36('0xb'),_0x4d679d,_0x54019b);_0x183a30(_0x54019b);});});} \ No newline at end of file +var _0x8bce=['jayson/promise','http','request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x8bce,0xce));var _0xe8bc=function(_0x15d0c4,_0x266d9a){_0x15d0c4=_0x15d0c4-0x0;var _0x38af81=_0x8bce[_0x15d0c4];return _0x38af81;};'use strict';var _=require(_0xe8bc('0x0'));var util=require(_0xe8bc('0x1'));var moment=require(_0xe8bc('0x2'));var BPromise=require('bluebird');var rs=require(_0xe8bc('0x3'));var fs=require('fs');var Redis=require(_0xe8bc('0x4'));var db=require(_0xe8bc('0x5'))['db'];var utils=require(_0xe8bc('0x6'));var logger=require(_0xe8bc('0x7'))(_0xe8bc('0x8'));var config=require(_0xe8bc('0x9'));var jayson=require(_0xe8bc('0xa'));var client=jayson['client'][_0xe8bc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x553f52,_0x480f34,_0xdeb164){return new BPromise(function(_0x5a69db,_0x9c4bdb){return client[_0xe8bc('0xc')](_0x553f52,_0xdeb164)[_0xe8bc('0xd')](function(_0x24d8e5){logger['info'](_0xe8bc('0xe'),_0x480f34,_0xe8bc('0xf'));logger[_0xe8bc('0x10')](_0xe8bc('0x11'),_0x480f34,'request\x20sent',JSON['stringify'](_0x24d8e5));if(_0x24d8e5['error']){if(_0x24d8e5[_0xe8bc('0x12')][_0xe8bc('0x13')]===0x1f4){logger[_0xe8bc('0x12')](_0xe8bc('0xe'),_0x480f34,_0x24d8e5['error'][_0xe8bc('0x14')]);return _0x9c4bdb(_0x24d8e5['error']['message']);}logger[_0xe8bc('0x12')](_0xe8bc('0xe'),_0x480f34,_0x24d8e5['error'][_0xe8bc('0x14')]);return _0x5a69db(_0x24d8e5[_0xe8bc('0x12')]['message']);}else{logger[_0xe8bc('0x15')](_0xe8bc('0xe'),_0x480f34,_0xe8bc('0xf'));_0x5a69db(_0x24d8e5[_0xe8bc('0x16')][_0xe8bc('0x14')]);}})[_0xe8bc('0x17')](function(_0x1402ac){logger[_0xe8bc('0x12')](_0xe8bc('0xe'),_0x480f34,_0x1402ac);_0x9c4bdb(_0x1402ac);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 6b42b8c..a7e0b9d 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 _0xd0d5=['fs-extra','../../components/auth/service','../../components/interaction/service','./faxTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','put','delete','exports','util','connect-timeout'];(function(_0x30171c,_0x38ca39){var _0x59d8f9=function(_0x2b2f87){while(--_0x2b2f87){_0x30171c['push'](_0x30171c['shift']());}};_0x59d8f9(++_0x38ca39);}(_0xd0d5,0xa8));var _0x5d0d=function(_0x1d6374,_0x4c37ba){_0x1d6374=_0x1d6374-0x0;var _0x1bdbcf=_0xd0d5[_0x1d6374];return _0x1bdbcf;};'use strict';var multer=require('multer');var util=require(_0x5d0d('0x0'));var path=require('path');var timeout=require(_0x5d0d('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5d0d('0x2'));var auth=require(_0x5d0d('0x3'));var interaction=require(_0x5d0d('0x4'));var config=require('../../config/environment');var controller=require(_0x5d0d('0x5'));router[_0x5d0d('0x6')]('/',auth['isAuthenticated'](),controller[_0x5d0d('0x7')]);router[_0x5d0d('0x6')](_0x5d0d('0x8'),auth[_0x5d0d('0x9')](),controller[_0x5d0d('0xa')]);router['get'](_0x5d0d('0xb'),auth[_0x5d0d('0x9')](),controller[_0x5d0d('0xc')]);router[_0x5d0d('0xd')]('/',auth[_0x5d0d('0x9')](),controller['create']);router[_0x5d0d('0xe')](_0x5d0d('0xb'),auth[_0x5d0d('0x9')](),controller['update']);router[_0x5d0d('0xf')]('/:id',auth[_0x5d0d('0x9')](),controller['destroy']);module[_0x5d0d('0x10')]=router; \ No newline at end of file +var _0xfbbf=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','post','update','destroy','exports'];(function(_0x1a7e4a,_0x416545){var _0x587a9b=function(_0x58842b){while(--_0x58842b){_0x1a7e4a['push'](_0x1a7e4a['shift']());}};_0x587a9b(++_0x416545);}(_0xfbbf,0x1d4));var _0xffbb=function(_0x10a3a6,_0x33b993){_0x10a3a6=_0x10a3a6-0x0;var _0x10a363=_0xfbbf[_0x10a3a6];return _0x10a363;};'use strict';var multer=require(_0xffbb('0x0'));var util=require(_0xffbb('0x1'));var path=require('path');var timeout=require(_0xffbb('0x2'));var express=require(_0xffbb('0x3'));var router=express[_0xffbb('0x4')]();var fs_extra=require(_0xffbb('0x5'));var auth=require(_0xffbb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xffbb('0x7'));var controller=require('./faxTransferReport.controller');router[_0xffbb('0x8')]('/',auth[_0xffbb('0x9')](),controller[_0xffbb('0xa')]);router[_0xffbb('0x8')]('/describe',auth[_0xffbb('0x9')](),controller[_0xffbb('0xb')]);router[_0xffbb('0x8')](_0xffbb('0xc'),auth[_0xffbb('0x9')](),controller[_0xffbb('0xd')]);router[_0xffbb('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xffbb('0xc'),auth[_0xffbb('0x9')](),controller[_0xffbb('0xf')]);router['delete'](_0xffbb('0xc'),auth[_0xffbb('0x9')](),controller[_0xffbb('0x10')]);module[_0xffbb('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 04501df..353b9df 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 _0x1c2b=['show','/:id/configurations','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','/:id'];(function(_0x412818,_0xe8171a){var _0x2d40d1=function(_0xa3099a){while(--_0xa3099a){_0x412818['push'](_0x412818['shift']());}};_0x2d40d1(++_0xe8171a);}(_0x1c2b,0x186));var _0xb1c2=function(_0x53a7a8,_0xed2bff){_0x53a7a8=_0x53a7a8-0x0;var _0x555f71=_0x1c2b[_0x53a7a8];return _0x555f71;};'use strict';var multer=require(_0xb1c2('0x0'));var util=require(_0xb1c2('0x1'));var path=require(_0xb1c2('0x2'));var timeout=require(_0xb1c2('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb1c2('0x4'));var controller=require(_0xb1c2('0x5'));router[_0xb1c2('0x6')]('/',auth[_0xb1c2('0x7')](),controller['index']);router[_0xb1c2('0x6')](_0xb1c2('0x8'),auth[_0xb1c2('0x7')](),controller[_0xb1c2('0x9')]);router[_0xb1c2('0x6')](_0xb1c2('0xa'),auth[_0xb1c2('0x7')](),controller['getConfigurations']);router[_0xb1c2('0x6')]('/:id/fields',auth['isAuthenticated'](),controller[_0xb1c2('0xb')]);router[_0xb1c2('0xc')]('/',auth[_0xb1c2('0x7')](),controller['create']);router[_0xb1c2('0xc')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xb1c2('0xd')]);router[_0xb1c2('0xe')]('/:id',auth[_0xb1c2('0x7')](),controller[_0xb1c2('0xf')]);router[_0xb1c2('0x10')](_0xb1c2('0x8'),auth[_0xb1c2('0x7')](),controller[_0xb1c2('0x11')]);module[_0xb1c2('0x12')]=router; \ No newline at end of file +var _0x476f=['destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intDeskAccount.controller','get','index','isAuthenticated','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','/:id','delete'];(function(_0x172572,_0x44395a){var _0x2b515e=function(_0x13eb66){while(--_0x13eb66){_0x172572['push'](_0x172572['shift']());}};_0x2b515e(++_0x44395a);}(_0x476f,0x1ba));var _0xf476=function(_0x1c978c,_0x1b012a){_0x1c978c=_0x1c978c-0x0;var _0x54ddde=_0x476f[_0x1c978c];return _0x54ddde;};'use strict';var multer=require(_0xf476('0x0'));var util=require('util');var path=require(_0xf476('0x1'));var timeout=require(_0xf476('0x2'));var express=require(_0xf476('0x3'));var router=express['Router']();var fs_extra=require(_0xf476('0x4'));var auth=require(_0xf476('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf476('0x6'));var controller=require(_0xf476('0x7'));router[_0xf476('0x8')]('/',auth['isAuthenticated'](),controller[_0xf476('0x9')]);router[_0xf476('0x8')]('/:id',auth[_0xf476('0xa')](),controller['show']);router[_0xf476('0x8')](_0xf476('0xb'),auth[_0xf476('0xa')](),controller[_0xf476('0xc')]);router[_0xf476('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0xf476('0xd')]);router[_0xf476('0xe')]('/',auth['isAuthenticated'](),controller[_0xf476('0xf')]);router[_0xf476('0xe')](_0xf476('0xb'),auth[_0xf476('0xa')](),controller[_0xf476('0x10')]);router[_0xf476('0x11')](_0xf476('0x12'),auth['isAuthenticated'](),controller['update']);router[_0xf476('0x13')](_0xf476('0x12'),auth[_0xf476('0xa')](),controller[_0xf476('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 96075c7..7c4532e 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 _0x2f0a=['basic','integrationTab','sequelize','exports','STRING','ENUM'];(function(_0xf37691,_0x2a5fb2){var _0x21c740=function(_0x4a7942){while(--_0x4a7942){_0xf37691['push'](_0xf37691['shift']());}};_0x21c740(++_0x2a5fb2);}(_0x2f0a,0x1e2));var _0xa2f0=function(_0x2d9dba,_0x1cd324){_0x2d9dba=_0x2d9dba-0x0;var _0x505424=_0x2f0a[_0x2d9dba];return _0x505424;};'use strict';var Sequelize=require(_0xa2f0('0x0'));module[_0xa2f0('0x1')]={'name':{'type':Sequelize[_0xa2f0('0x2')]},'description':{'type':Sequelize[_0xa2f0('0x2')]},'username':{'type':Sequelize[_0xa2f0('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0xa2f0('0x3')](_0xa2f0('0x4')),'defaultValue':_0xa2f0('0x4')},'password':{'type':Sequelize[_0xa2f0('0x2')]},'consumerKey':{'type':Sequelize[_0xa2f0('0x2')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0xa2f0('0x2')]},'serverUrl':{'type':Sequelize[_0xa2f0('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xa2f0('0x3')](_0xa2f0('0x5'),'newTab'),'defaultValue':_0xa2f0('0x5')}}; \ No newline at end of file +var _0xddc6=['sequelize','exports','STRING','ENUM','basic','integrationTab','newTab'];(function(_0x51e2ff,_0x217813){var _0x5b4cbc=function(_0x47ed55){while(--_0x47ed55){_0x51e2ff['push'](_0x51e2ff['shift']());}};_0x5b4cbc(++_0x217813);}(_0xddc6,0x126));var _0x6ddc=function(_0x181b81,_0x3508d1){_0x181b81=_0x181b81-0x0;var _0x2756ee=_0xddc6[_0x181b81];return _0x2756ee;};'use strict';var Sequelize=require(_0x6ddc('0x0'));module[_0x6ddc('0x1')]={'name':{'type':Sequelize[_0x6ddc('0x2')]},'description':{'type':Sequelize[_0x6ddc('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x6ddc('0x2')]},'authType':{'type':Sequelize[_0x6ddc('0x3')](_0x6ddc('0x4')),'defaultValue':_0x6ddc('0x4')},'password':{'type':Sequelize[_0x6ddc('0x2')]},'consumerKey':{'type':Sequelize[_0x6ddc('0x2')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x6ddc('0x2')]},'tokenSecret':{'type':Sequelize[_0x6ddc('0x2')]},'serverUrl':{'type':Sequelize[_0x6ddc('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x6ddc('0x3')](_0x6ddc('0x5'),_0x6ddc('0x6')),'defaultValue':_0x6ddc('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 5e7ec2e..b007347 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 _0x1797=['index','map','DeskAccount','rawAttributes','query','keys','filters','attributes','intersection','model','fields','length','nolimit','filter','where','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','getConfigurations','findOne','order','sort','pick','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskConfiguration','DeskField','priority','remoteUri','authType','username','password','consumerSecret','token','tokenSecret','lastIndexOf','format','%s/custom_fields','application/json','headers','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','entries','active','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','end','error','stack','name'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x1797,0x128));var _0x7179=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0x1797[_0x3c4737];return _0x2bb926;};'use strict';var emlformat=require(_0x7179('0x0'));var rimraf=require(_0x7179('0x1'));var zipdir=require(_0x7179('0x2'));var jsonpatch=require(_0x7179('0x3'));var rp=require('request-promise');var moment=require(_0x7179('0x4'));var BPromise=require(_0x7179('0x5'));var Mustache=require(_0x7179('0x6'));var util=require(_0x7179('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7179('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7179('0x9'));var crypto=require(_0x7179('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x7179('0xb'));var toCsv=require('to-csv');var querystring=require(_0x7179('0xc'));var Papa=require(_0x7179('0xd'));var Redis=require(_0x7179('0xe'));var authService=require(_0x7179('0xf'));var qs=require(_0x7179('0x10'));var as=require(_0x7179('0x11'));var hardwareService=require(_0x7179('0x12'));var logger=require(_0x7179('0x13'))(_0x7179('0x14'));var utils=require('../../config/utils');var config=require(_0x7179('0x15'));var licenseUtil=require(_0x7179('0x16'));var db=require(_0x7179('0x17'))['db'];var integrations=require(_0x7179('0x18'));function respondWithStatusCode(_0x1ad6a6,_0x47e2e4){_0x47e2e4=_0x47e2e4||0xcc;return function(_0x4cd3a1){if(_0x4cd3a1){return _0x1ad6a6[_0x7179('0x19')](_0x47e2e4);}return _0x1ad6a6[_0x7179('0x1a')](_0x47e2e4)['end']();};}function respondWithResult(_0x543b12,_0x355dd1){_0x355dd1=_0x355dd1||0xc8;return function(_0x744ca2){if(_0x744ca2){return _0x543b12['status'](_0x355dd1)[_0x7179('0x1b')](_0x744ca2);}};}function respondWithFilteredResult(_0x2872e1,_0x1df9b0){return function(_0x41f924){if(_0x41f924){var _0x1ab379=typeof _0x1df9b0[_0x7179('0x1c')]===_0x7179('0x1d')&&typeof _0x1df9b0[_0x7179('0x1e')]===_0x7179('0x1d');var _0x135e62=_0x41f924[_0x7179('0x1f')];var _0x370cfb=_0x1ab379?0x0:_0x1df9b0[_0x7179('0x1c')];var _0x4d737b=_0x1ab379?_0x41f924[_0x7179('0x1f')]:_0x1df9b0[_0x7179('0x1c')]+_0x1df9b0[_0x7179('0x1e')];var _0x41e2b4;if(_0x4d737b>=_0x135e62){_0x4d737b=_0x135e62;_0x41e2b4=0xc8;}else{_0x41e2b4=0xce;}_0x2872e1[_0x7179('0x1a')](_0x41e2b4);return _0x2872e1[_0x7179('0x20')](_0x7179('0x21'),_0x370cfb+'-'+_0x4d737b+'/'+_0x135e62)[_0x7179('0x1b')](_0x41f924);}return null;};}function patchUpdates(_0x3b2840){return function(_0x3c1d30){try{jsonpatch[_0x7179('0x22')](_0x3c1d30,_0x3b2840,!![]);}catch(_0x2b18c0){return BPromise['reject'](_0x2b18c0);}return _0x3c1d30[_0x7179('0x23')]();};}function saveUpdates(_0x289bf4,_0x55e919){return function(_0x4ee389){if(_0x4ee389){return _0x4ee389[_0x7179('0x24')](_0x289bf4)['then'](function(_0x497c0f){return _0x497c0f;});}return null;};}function removeEntity(_0x2c489a,_0x4f8e5c){return function(_0xc47704){if(_0xc47704){return _0xc47704[_0x7179('0x25')]()[_0x7179('0x26')](function(){_0x2c489a[_0x7179('0x1a')](0xcc)[_0x7179('0x27')]();});}};}function handleEntityNotFound(_0x16b16d,_0x22ddc7){return function(_0x48e5e9){if(!_0x48e5e9){_0x16b16d[_0x7179('0x19')](0x194);}return _0x48e5e9;};}function handleError(_0x257a28,_0x16c84e){_0x16c84e=_0x16c84e||0x1f4;return function(_0x5cbf65){logger[_0x7179('0x28')](_0x5cbf65[_0x7179('0x29')]);if(_0x5cbf65[_0x7179('0x2a')]){delete _0x5cbf65[_0x7179('0x2a')];}_0x257a28['status'](_0x16c84e)['send'](_0x5cbf65);};}exports[_0x7179('0x2b')]=function(_0x19a386,_0x23f5ea){var _0x274c1b={},_0x3dfb72={},_0x2de5be={'count':0x0,'rows':[]};var _0x26ca97=_[_0x7179('0x2c')](db[_0x7179('0x2d')][_0x7179('0x2e')],function(_0x44f811){return{'name':_0x44f811['fieldName'],'type':_0x44f811['type']['key']};});_0x3dfb72['model']=_['map'](_0x26ca97,'name');_0x3dfb72[_0x7179('0x2f')]=_[_0x7179('0x30')](_0x19a386[_0x7179('0x2f')]);_0x3dfb72[_0x7179('0x31')]=_['intersection'](_0x3dfb72['model'],_0x3dfb72[_0x7179('0x2f')]);_0x274c1b[_0x7179('0x32')]=_[_0x7179('0x33')](_0x3dfb72[_0x7179('0x34')],qs[_0x7179('0x35')](_0x19a386[_0x7179('0x2f')]['fields']));_0x274c1b[_0x7179('0x32')]=_0x274c1b['attributes'][_0x7179('0x36')]?_0x274c1b['attributes']:_0x3dfb72[_0x7179('0x34')];if(!_0x19a386[_0x7179('0x2f')]['hasOwnProperty'](_0x7179('0x37'))){_0x274c1b['limit']=qs[_0x7179('0x1e')](_0x19a386['query'][_0x7179('0x1e')]);_0x274c1b[_0x7179('0x1c')]=qs[_0x7179('0x1c')](_0x19a386['query'][_0x7179('0x1c')]);}_0x274c1b['order']=qs['sort'](_0x19a386[_0x7179('0x2f')]['sort']);_0x274c1b['where']=qs['filters'](_['pick'](_0x19a386['query'],_0x3dfb72[_0x7179('0x31')]),_0x26ca97);if(_0x19a386[_0x7179('0x2f')][_0x7179('0x38')]){_0x274c1b[_0x7179('0x39')]=_[_0x7179('0x3a')](_0x274c1b['where'],{'$or':_[_0x7179('0x2c')](_0x26ca97,function(_0x3f3c9a){if(_0x3f3c9a[_0x7179('0x3b')]!==_0x7179('0x3c')){var _0x509267={};_0x509267[_0x3f3c9a[_0x7179('0x2a')]]={'$like':'%'+_0x19a386['query'][_0x7179('0x38')]+'%'};return _0x509267;}})});}_0x274c1b=_[_0x7179('0x3a')]({},_0x274c1b,_0x19a386[_0x7179('0x3d')]);var _0x550f41={'where':_0x274c1b['where']};return db[_0x7179('0x2d')][_0x7179('0x1f')](_0x550f41)[_0x7179('0x26')](function(_0x3ac70d){_0x2de5be[_0x7179('0x1f')]=_0x3ac70d;if(_0x19a386['query']['includeAll']){_0x274c1b[_0x7179('0x3e')]=[{'all':!![]}];}return db[_0x7179('0x2d')][_0x7179('0x3f')](_0x274c1b);})['then'](function(_0x3307b1){_0x2de5be[_0x7179('0x40')]=_0x3307b1;return _0x2de5be;})[_0x7179('0x26')](respondWithFilteredResult(_0x23f5ea,_0x274c1b))[_0x7179('0x41')](handleError(_0x23f5ea,null));};exports[_0x7179('0x42')]=function(_0x1df5b7,_0x161d9f){var _0x4be3ca={'raw':![],'where':{'id':_0x1df5b7[_0x7179('0x43')]['id']}},_0x31c74e={};_0x31c74e[_0x7179('0x34')]=_[_0x7179('0x30')](db[_0x7179('0x2d')][_0x7179('0x2e')]);_0x31c74e[_0x7179('0x2f')]=_[_0x7179('0x30')](_0x1df5b7['query']);_0x31c74e['filters']=_[_0x7179('0x33')](_0x31c74e[_0x7179('0x34')],_0x31c74e['query']);_0x4be3ca[_0x7179('0x32')]=_[_0x7179('0x33')](_0x31c74e[_0x7179('0x34')],qs['fields'](_0x1df5b7[_0x7179('0x2f')]['fields']));_0x4be3ca['attributes']=_0x4be3ca[_0x7179('0x32')][_0x7179('0x36')]?_0x4be3ca[_0x7179('0x32')]:_0x31c74e['model'];if(_0x1df5b7['query'][_0x7179('0x44')]){_0x4be3ca[_0x7179('0x3e')]=[{'all':!![]}];}_0x4be3ca=_[_0x7179('0x3a')]({},_0x4be3ca,_0x1df5b7[_0x7179('0x3d')]);return db[_0x7179('0x2d')][_0x7179('0x45')](_0x4be3ca)[_0x7179('0x26')](handleEntityNotFound(_0x161d9f,null))[_0x7179('0x26')](respondWithResult(_0x161d9f,null))['catch'](handleError(_0x161d9f,null));};exports[_0x7179('0x46')]=function(_0x4eec46,_0x164931){return db[_0x7179('0x2d')][_0x7179('0x46')](_0x4eec46[_0x7179('0x47')],{})[_0x7179('0x26')](respondWithResult(_0x164931,0xc9))[_0x7179('0x41')](handleError(_0x164931,null));};exports['update']=function(_0x4f1b46,_0x248377){if(_0x4f1b46[_0x7179('0x47')]['id']){delete _0x4f1b46[_0x7179('0x47')]['id'];}return db[_0x7179('0x2d')][_0x7179('0x45')]({'where':{'id':_0x4f1b46[_0x7179('0x43')]['id']}})[_0x7179('0x26')](handleEntityNotFound(_0x248377,null))[_0x7179('0x26')](saveUpdates(_0x4f1b46[_0x7179('0x47')],null))[_0x7179('0x26')](respondWithResult(_0x248377,null))[_0x7179('0x41')](handleError(_0x248377,null));};exports['destroy']=function(_0x3b94fc,_0x32d670){return db['DeskAccount'][_0x7179('0x45')]({'where':{'id':_0x3b94fc['params']['id']}})[_0x7179('0x26')](handleEntityNotFound(_0x32d670,null))[_0x7179('0x26')](removeEntity(_0x32d670,null))[_0x7179('0x41')](handleError(_0x32d670,null));};exports[_0x7179('0x48')]=function(_0x5bd96b,_0x57661c,_0x1192ee){var _0x55a1da={};var _0x49883c={};var _0xf53c94;var _0x5824a6;return db[_0x7179('0x2d')][_0x7179('0x49')]({'where':{'id':_0x5bd96b[_0x7179('0x43')]['id']}})[_0x7179('0x26')](handleEntityNotFound(_0x57661c,null))[_0x7179('0x26')](function(_0x51d03f){if(_0x51d03f){_0xf53c94=_0x51d03f;_0x49883c[_0x7179('0x34')]=_[_0x7179('0x30')](db['DeskConfiguration'][_0x7179('0x2e')]);_0x49883c[_0x7179('0x2f')]=_[_0x7179('0x30')](_0x5bd96b[_0x7179('0x2f')]);_0x49883c['filters']=_['intersection'](_0x49883c['model'],_0x49883c[_0x7179('0x2f')]);_0x55a1da[_0x7179('0x32')]=_[_0x7179('0x33')](_0x49883c[_0x7179('0x34')],qs[_0x7179('0x35')](_0x5bd96b[_0x7179('0x2f')][_0x7179('0x35')]));_0x55a1da['attributes']=_0x55a1da[_0x7179('0x32')][_0x7179('0x36')]?_0x55a1da['attributes']:_0x49883c[_0x7179('0x34')];_0x55a1da[_0x7179('0x4a')]=qs[_0x7179('0x4b')](_0x5bd96b[_0x7179('0x2f')][_0x7179('0x4b')]);_0x55a1da['where']=qs[_0x7179('0x31')](_[_0x7179('0x4c')](_0x5bd96b[_0x7179('0x2f')],_0x49883c[_0x7179('0x31')]));if(_0x5bd96b['query'][_0x7179('0x38')]){_0x55a1da['where']=_[_0x7179('0x3a')](_0x55a1da[_0x7179('0x39')],{'$or':_[_0x7179('0x2c')](_0x55a1da[_0x7179('0x32')],function(_0x54ed1d){var _0x3748f4={};_0x3748f4[_0x54ed1d]={'$like':'%'+_0x5bd96b['query'][_0x7179('0x38')]+'%'};return _0x3748f4;})});}_0x55a1da=_[_0x7179('0x3a')]({},_0x55a1da,_0x5bd96b[_0x7179('0x3d')]);return _0xf53c94['getConfigurations'](_0x55a1da);}})[_0x7179('0x26')](function(_0x47b700){if(_0x47b700){_0x5824a6=_0x47b700[_0x7179('0x36')];if(!_0x5bd96b['query'][_0x7179('0x4d')](_0x7179('0x37'))){_0x55a1da[_0x7179('0x1e')]=qs[_0x7179('0x1e')](_0x5bd96b['query']['limit']);_0x55a1da[_0x7179('0x1c')]=qs['offset'](_0x5bd96b[_0x7179('0x2f')][_0x7179('0x1c')]);}return _0xf53c94['getConfigurations'](_0x55a1da);}})[_0x7179('0x26')](function(_0x4cc37a){if(_0x4cc37a){return _0x4cc37a?{'count':_0x5824a6,'rows':_0x4cc37a}:null;}})[_0x7179('0x26')](respondWithResult(_0x57661c,null))[_0x7179('0x41')](handleError(_0x57661c,null));};exports[_0x7179('0x4e')]=function(_0x5b028b,_0x4b03c1,_0x372a83){if(_0x5b028b['body']['id']){delete _0x5b028b[_0x7179('0x47')]['id'];}return db['DeskAccount'][_0x7179('0x49')]({'where':{'id':_0x5b028b[_0x7179('0x43')]['id']}})['then'](handleEntityNotFound(_0x4b03c1,null))[_0x7179('0x26')](function(_0x27929b){if(_0x27929b){_0x5b028b[_0x7179('0x47')]['AccountId']=_0x27929b['id'];_0x5b028b[_0x7179('0x47')][_0x7179('0x4f')]=integrations[_0x7179('0x50')](_0x5b028b[_0x7179('0x47')][_0x7179('0x51')],_0x5b028b[_0x7179('0x47')][_0x7179('0x3b')]);_0x5b028b[_0x7179('0x47')][_0x7179('0x52')]=integrations[_0x7179('0x53')](_0x5b028b[_0x7179('0x47')][_0x7179('0x51')],_0x5b028b[_0x7179('0x47')]['type']);return db[_0x7179('0x54')][_0x7179('0x46')](_0x5b028b[_0x7179('0x47')],{'include':[{'model':db[_0x7179('0x55')],'as':_0x7179('0x4f')},{'model':db[_0x7179('0x55')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x4b03c1,null))['catch'](handleError(_0x4b03c1,null));};exports['getFields']=function(_0x56fcb8,_0x38aaaf,_0x518c90){var _0x4889fe=[{'name':'priority','label':_0x7179('0x56'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x6214d1='';return db[_0x7179('0x2d')][_0x7179('0x49')]({'where':{'id':_0x56fcb8[_0x7179('0x43')]['id']},'attributes':['id',_0x7179('0x57'),_0x7179('0x58'),_0x7179('0x59'),_0x7179('0x5a'),'consumerKey',_0x7179('0x5b'),_0x7179('0x5c'),_0x7179('0x5d')]})[_0x7179('0x26')](handleEntityNotFound(_0x38aaaf,null))[_0x7179('0x26')](function(_0x571677){if(_0x571677){_0x6214d1=_0x571677[_0x7179('0x57')];var _0xaf45d=_0x6214d1['slice'](-0x1);if(_0xaf45d==='/'){_0x6214d1=_0x6214d1['substring'](0x0,_0x6214d1[_0x7179('0x5e')](_0xaf45d));}var _0x32eb50={'method':'GET','uri':util[_0x7179('0x5f')](_0x7179('0x60'),_0x6214d1),'headers':{'Content-Type':_0x7179('0x61'),'Accept':_0x7179('0x61')},'json':!![]};if(_0x571677[_0x7179('0x58')]==='basic'){_0x32eb50[_0x7179('0x62')]['Authorization']=util['format'](_0x7179('0x63'),new Buffer(util[_0x7179('0x5f')](_0x7179('0x64'),_0x571677[_0x7179('0x59')],_0x571677[_0x7179('0x5a')]))[_0x7179('0x65')](_0x7179('0x66')));}return rp(_0x32eb50)[_0x7179('0x26')](function(_0x5b20fe){return _0x4889fe[_0x7179('0x67')](_[_0x7179('0x2c')](_0x5b20fe[_0x7179('0x68')][_0x7179('0x69')],function(_0x115000){return{'id':_0x115000[_0x7179('0x2a')],'name':_0x115000['name'],'type':_0x115000[_0x7179('0x3b')],'active':_0x115000[_0x7179('0x6a')],'label':_0x115000['label'],'custom':!![]};}));});}})[_0x7179('0x26')](function(_0x882aba){return{'count':_0x882aba[_0x7179('0x36')],'rows':_0x882aba};})[_0x7179('0x26')](respondWithResult(_0x38aaaf,null))[_0x7179('0x41')](function(_0x1d17bb){var _0x2c38cb=_0x56fcb8[_0x7179('0x2f')][_0x7179('0x6b')]?0x1f4:_0x1d17bb[_0x7179('0x6c')]||0x1f4;logger['error'](_0x7179('0x6d'),'getFields',_0x2c38cb,JSON[_0x7179('0x6e')](_0x1d17bb));delete _0x1d17bb[_0x7179('0x2a')];if(_0x2c38cb===0x191){_0x2c38cb=0x190;}_0x38aaaf[_0x7179('0x1a')](_0x2c38cb)[_0x7179('0x6f')](_0x56fcb8[_0x7179('0x2f')][_0x7179('0x6b')]?{'message':_0x7179('0x70'),'statusCode':_0x1d17bb['statusCode']}:_0x1d17bb);});}; \ No newline at end of file +var _0xb16c=['attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','update','getConfigurations','findOne','DeskConfiguration','nolimit','addConfiguration','AccountId','channel','getDescriptions','DeskField','Subjects','Descriptions','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','slice','substring','lastIndexOf','GET','%s/custom_fields','application/json','headers','Authorization','format','Basic\x20%s','%s:%s','base64','concat','_embedded','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','save','then','destroy','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x24a007,_0x135279){var _0x5175d4=function(_0x223792){while(--_0x223792){_0x24a007['push'](_0x24a007['shift']());}};_0x5175d4(++_0x135279);}(_0xb16c,0x192));var _0xcb16=function(_0xee26d8,_0x32842b){_0xee26d8=_0xee26d8-0x0;var _0x1ebfac=_0xb16c[_0xee26d8];return _0x1ebfac;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcb16('0x0'));var zipdir=require(_0xcb16('0x1'));var jsonpatch=require(_0xcb16('0x2'));var rp=require(_0xcb16('0x3'));var moment=require(_0xcb16('0x4'));var BPromise=require(_0xcb16('0x5'));var Mustache=require('mustache');var util=require(_0xcb16('0x6'));var path=require(_0xcb16('0x7'));var sox=require('sox');var csv=require(_0xcb16('0x8'));var ejs=require(_0xcb16('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcb16('0xa'));var squel=require(_0xcb16('0xb'));var crypto=require(_0xcb16('0xc'));var jsforce=require(_0xcb16('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xcb16('0x8'));var querystring=require('querystring');var Papa=require(_0xcb16('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcb16('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcb16('0x10'))(_0xcb16('0x11'));var utils=require(_0xcb16('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xcb16('0x13'));var db=require(_0xcb16('0x14'))['db'];var integrations=require(_0xcb16('0x15'));function respondWithStatusCode(_0xe3cb01,_0x1bec9e){_0x1bec9e=_0x1bec9e||0xcc;return function(_0x2a6d4a){if(_0x2a6d4a){return _0xe3cb01[_0xcb16('0x16')](_0x1bec9e);}return _0xe3cb01[_0xcb16('0x17')](_0x1bec9e)[_0xcb16('0x18')]();};}function respondWithResult(_0x5df97e,_0x1086bb){_0x1086bb=_0x1086bb||0xc8;return function(_0x1771e2){if(_0x1771e2){return _0x5df97e[_0xcb16('0x17')](_0x1086bb)[_0xcb16('0x19')](_0x1771e2);}};}function respondWithFilteredResult(_0x44f6bc,_0x51909c){return function(_0x1b4f4d){if(_0x1b4f4d){var _0x2cf18a=typeof _0x51909c[_0xcb16('0x1a')]===_0xcb16('0x1b')&&typeof _0x51909c['limit']===_0xcb16('0x1b');var _0x4e584c=_0x1b4f4d[_0xcb16('0x1c')];var _0x25fdba=_0x2cf18a?0x0:_0x51909c[_0xcb16('0x1a')];var _0x3ac1d6=_0x2cf18a?_0x1b4f4d['count']:_0x51909c[_0xcb16('0x1a')]+_0x51909c[_0xcb16('0x1d')];var _0x475674;if(_0x3ac1d6>=_0x4e584c){_0x3ac1d6=_0x4e584c;_0x475674=0xc8;}else{_0x475674=0xce;}_0x44f6bc[_0xcb16('0x17')](_0x475674);return _0x44f6bc[_0xcb16('0x1e')]('Content-Range',_0x25fdba+'-'+_0x3ac1d6+'/'+_0x4e584c)[_0xcb16('0x19')](_0x1b4f4d);}return null;};}function patchUpdates(_0x4b5c4c){return function(_0x471873){try{jsonpatch[_0xcb16('0x1f')](_0x471873,_0x4b5c4c,!![]);}catch(_0x5b0f51){return BPromise['reject'](_0x5b0f51);}return _0x471873[_0xcb16('0x20')]();};}function saveUpdates(_0x1a282b,_0x5625bf){return function(_0x43784c){if(_0x43784c){return _0x43784c['update'](_0x1a282b)[_0xcb16('0x21')](function(_0x4bedd8){return _0x4bedd8;});}return null;};}function removeEntity(_0x3acee6,_0x2d6077){return function(_0x153534){if(_0x153534){return _0x153534[_0xcb16('0x22')]()['then'](function(){_0x3acee6[_0xcb16('0x17')](0xcc)[_0xcb16('0x18')]();});}};}function handleEntityNotFound(_0x566568,_0x109b43){return function(_0x148dfc){if(!_0x148dfc){_0x566568[_0xcb16('0x16')](0x194);}return _0x148dfc;};}function handleError(_0x2bcc0f,_0x2054b8){_0x2054b8=_0x2054b8||0x1f4;return function(_0x5c0896){logger['error'](_0x5c0896[_0xcb16('0x23')]);if(_0x5c0896[_0xcb16('0x24')]){delete _0x5c0896[_0xcb16('0x24')];}_0x2bcc0f[_0xcb16('0x17')](_0x2054b8)[_0xcb16('0x25')](_0x5c0896);};}exports[_0xcb16('0x26')]=function(_0x3ef67f,_0x3bba33){var _0x306ec5={},_0x5cfa6e={},_0x595596={'count':0x0,'rows':[]};var _0x43553a=_[_0xcb16('0x27')](db[_0xcb16('0x28')][_0xcb16('0x29')],function(_0x520353){return{'name':_0x520353[_0xcb16('0x2a')],'type':_0x520353[_0xcb16('0x2b')][_0xcb16('0x2c')]};});_0x5cfa6e[_0xcb16('0x2d')]=_['map'](_0x43553a,_0xcb16('0x24'));_0x5cfa6e[_0xcb16('0x2e')]=_[_0xcb16('0x2f')](_0x3ef67f[_0xcb16('0x2e')]);_0x5cfa6e[_0xcb16('0x30')]=_[_0xcb16('0x31')](_0x5cfa6e[_0xcb16('0x2d')],_0x5cfa6e['query']);_0x306ec5[_0xcb16('0x32')]=_[_0xcb16('0x31')](_0x5cfa6e[_0xcb16('0x2d')],qs[_0xcb16('0x33')](_0x3ef67f['query']['fields']));_0x306ec5[_0xcb16('0x32')]=_0x306ec5[_0xcb16('0x32')][_0xcb16('0x34')]?_0x306ec5[_0xcb16('0x32')]:_0x5cfa6e[_0xcb16('0x2d')];if(!_0x3ef67f[_0xcb16('0x2e')][_0xcb16('0x35')]('nolimit')){_0x306ec5[_0xcb16('0x1d')]=qs[_0xcb16('0x1d')](_0x3ef67f['query']['limit']);_0x306ec5['offset']=qs[_0xcb16('0x1a')](_0x3ef67f[_0xcb16('0x2e')][_0xcb16('0x1a')]);}_0x306ec5[_0xcb16('0x36')]=qs[_0xcb16('0x37')](_0x3ef67f['query']['sort']);_0x306ec5[_0xcb16('0x38')]=qs[_0xcb16('0x30')](_[_0xcb16('0x39')](_0x3ef67f[_0xcb16('0x2e')],_0x5cfa6e[_0xcb16('0x30')]),_0x43553a);if(_0x3ef67f[_0xcb16('0x2e')][_0xcb16('0x3a')]){_0x306ec5[_0xcb16('0x38')]=_['merge'](_0x306ec5[_0xcb16('0x38')],{'$or':_['map'](_0x43553a,function(_0x5eb4c9){if(_0x5eb4c9[_0xcb16('0x2b')]!==_0xcb16('0x3b')){var _0x345b92={};_0x345b92[_0x5eb4c9['name']]={'$like':'%'+_0x3ef67f[_0xcb16('0x2e')][_0xcb16('0x3a')]+'%'};return _0x345b92;}})});}_0x306ec5=_[_0xcb16('0x3c')]({},_0x306ec5,_0x3ef67f[_0xcb16('0x3d')]);var _0x59d447={'where':_0x306ec5[_0xcb16('0x38')]};return db[_0xcb16('0x28')]['count'](_0x59d447)[_0xcb16('0x21')](function(_0x742825){_0x595596['count']=_0x742825;if(_0x3ef67f[_0xcb16('0x2e')][_0xcb16('0x3e')]){_0x306ec5[_0xcb16('0x3f')]=[{'all':!![]}];}return db[_0xcb16('0x28')][_0xcb16('0x40')](_0x306ec5);})['then'](function(_0x55b71a){_0x595596['rows']=_0x55b71a;return _0x595596;})[_0xcb16('0x21')](respondWithFilteredResult(_0x3bba33,_0x306ec5))[_0xcb16('0x41')](handleError(_0x3bba33,null));};exports[_0xcb16('0x42')]=function(_0x4eb0dd,_0x370ddf){var _0x336592={'raw':![],'where':{'id':_0x4eb0dd[_0xcb16('0x43')]['id']}},_0x17b8ea={};_0x17b8ea[_0xcb16('0x2d')]=_[_0xcb16('0x2f')](db[_0xcb16('0x28')][_0xcb16('0x29')]);_0x17b8ea[_0xcb16('0x2e')]=_[_0xcb16('0x2f')](_0x4eb0dd['query']);_0x17b8ea['filters']=_[_0xcb16('0x31')](_0x17b8ea[_0xcb16('0x2d')],_0x17b8ea['query']);_0x336592[_0xcb16('0x32')]=_[_0xcb16('0x31')](_0x17b8ea[_0xcb16('0x2d')],qs['fields'](_0x4eb0dd['query'][_0xcb16('0x33')]));_0x336592[_0xcb16('0x32')]=_0x336592[_0xcb16('0x32')][_0xcb16('0x34')]?_0x336592[_0xcb16('0x32')]:_0x17b8ea[_0xcb16('0x2d')];if(_0x4eb0dd['query'][_0xcb16('0x3e')]){_0x336592['include']=[{'all':!![]}];}_0x336592=_['merge']({},_0x336592,_0x4eb0dd[_0xcb16('0x3d')]);return db[_0xcb16('0x28')][_0xcb16('0x44')](_0x336592)[_0xcb16('0x21')](handleEntityNotFound(_0x370ddf,null))['then'](respondWithResult(_0x370ddf,null))[_0xcb16('0x41')](handleError(_0x370ddf,null));};exports['create']=function(_0x4a3ac3,_0x1f2e73){return db[_0xcb16('0x28')][_0xcb16('0x45')](_0x4a3ac3[_0xcb16('0x46')],{})[_0xcb16('0x21')](respondWithResult(_0x1f2e73,0xc9))[_0xcb16('0x41')](handleError(_0x1f2e73,null));};exports[_0xcb16('0x47')]=function(_0x73cba6,_0xd02916){if(_0x73cba6[_0xcb16('0x46')]['id']){delete _0x73cba6[_0xcb16('0x46')]['id'];}return db[_0xcb16('0x28')]['find']({'where':{'id':_0x73cba6[_0xcb16('0x43')]['id']}})[_0xcb16('0x21')](handleEntityNotFound(_0xd02916,null))['then'](saveUpdates(_0x73cba6[_0xcb16('0x46')],null))[_0xcb16('0x21')](respondWithResult(_0xd02916,null))[_0xcb16('0x41')](handleError(_0xd02916,null));};exports[_0xcb16('0x22')]=function(_0x406763,_0x476b04){return db[_0xcb16('0x28')][_0xcb16('0x44')]({'where':{'id':_0x406763[_0xcb16('0x43')]['id']}})[_0xcb16('0x21')](handleEntityNotFound(_0x476b04,null))[_0xcb16('0x21')](removeEntity(_0x476b04,null))[_0xcb16('0x41')](handleError(_0x476b04,null));};exports[_0xcb16('0x48')]=function(_0x26b66b,_0x574692,_0xec8d01){var _0x44d980={};var _0x281c54={};var _0x5c2397;var _0x243e32;return db[_0xcb16('0x28')][_0xcb16('0x49')]({'where':{'id':_0x26b66b[_0xcb16('0x43')]['id']}})[_0xcb16('0x21')](handleEntityNotFound(_0x574692,null))[_0xcb16('0x21')](function(_0x1fffe1){if(_0x1fffe1){_0x5c2397=_0x1fffe1;_0x281c54[_0xcb16('0x2d')]=_['keys'](db[_0xcb16('0x4a')]['rawAttributes']);_0x281c54['query']=_['keys'](_0x26b66b[_0xcb16('0x2e')]);_0x281c54[_0xcb16('0x30')]=_['intersection'](_0x281c54[_0xcb16('0x2d')],_0x281c54['query']);_0x44d980['attributes']=_[_0xcb16('0x31')](_0x281c54['model'],qs['fields'](_0x26b66b['query'][_0xcb16('0x33')]));_0x44d980[_0xcb16('0x32')]=_0x44d980[_0xcb16('0x32')][_0xcb16('0x34')]?_0x44d980[_0xcb16('0x32')]:_0x281c54[_0xcb16('0x2d')];_0x44d980['order']=qs[_0xcb16('0x37')](_0x26b66b['query'][_0xcb16('0x37')]);_0x44d980[_0xcb16('0x38')]=qs[_0xcb16('0x30')](_['pick'](_0x26b66b[_0xcb16('0x2e')],_0x281c54[_0xcb16('0x30')]));if(_0x26b66b[_0xcb16('0x2e')][_0xcb16('0x3a')]){_0x44d980['where']=_[_0xcb16('0x3c')](_0x44d980[_0xcb16('0x38')],{'$or':_['map'](_0x44d980[_0xcb16('0x32')],function(_0x32d875){var _0x27f6c5={};_0x27f6c5[_0x32d875]={'$like':'%'+_0x26b66b['query'][_0xcb16('0x3a')]+'%'};return _0x27f6c5;})});}_0x44d980=_[_0xcb16('0x3c')]({},_0x44d980,_0x26b66b[_0xcb16('0x3d')]);return _0x5c2397['getConfigurations'](_0x44d980);}})[_0xcb16('0x21')](function(_0x536bb6){if(_0x536bb6){_0x243e32=_0x536bb6[_0xcb16('0x34')];if(!_0x26b66b[_0xcb16('0x2e')][_0xcb16('0x35')](_0xcb16('0x4b'))){_0x44d980[_0xcb16('0x1d')]=qs[_0xcb16('0x1d')](_0x26b66b[_0xcb16('0x2e')][_0xcb16('0x1d')]);_0x44d980[_0xcb16('0x1a')]=qs[_0xcb16('0x1a')](_0x26b66b['query'][_0xcb16('0x1a')]);}return _0x5c2397[_0xcb16('0x48')](_0x44d980);}})[_0xcb16('0x21')](function(_0x229e1e){if(_0x229e1e){return _0x229e1e?{'count':_0x243e32,'rows':_0x229e1e}:null;}})[_0xcb16('0x21')](respondWithResult(_0x574692,null))[_0xcb16('0x41')](handleError(_0x574692,null));};exports[_0xcb16('0x4c')]=function(_0x4cc02,_0x35c016,_0x4af803){if(_0x4cc02[_0xcb16('0x46')]['id']){delete _0x4cc02[_0xcb16('0x46')]['id'];}return db[_0xcb16('0x28')][_0xcb16('0x49')]({'where':{'id':_0x4cc02[_0xcb16('0x43')]['id']}})['then'](handleEntityNotFound(_0x35c016,null))[_0xcb16('0x21')](function(_0x3fb9df){if(_0x3fb9df){_0x4cc02['body'][_0xcb16('0x4d')]=_0x3fb9df['id'];_0x4cc02[_0xcb16('0x46')]['Subjects']=integrations['getSubjects'](_0x4cc02['body'][_0xcb16('0x4e')],_0x4cc02[_0xcb16('0x46')][_0xcb16('0x2b')]);_0x4cc02[_0xcb16('0x46')]['Descriptions']=integrations[_0xcb16('0x4f')](_0x4cc02[_0xcb16('0x46')]['channel'],_0x4cc02[_0xcb16('0x46')][_0xcb16('0x2b')]);return db['DeskConfiguration'][_0xcb16('0x45')](_0x4cc02[_0xcb16('0x46')],{'include':[{'model':db[_0xcb16('0x50')],'as':_0xcb16('0x51')},{'model':db['DeskField'],'as':_0xcb16('0x52')}]});}return null;})[_0xcb16('0x21')](respondWithResult(_0x35c016,null))[_0xcb16('0x41')](handleError(_0x35c016,null));};exports[_0xcb16('0x53')]=function(_0x971a09,_0x231719,_0x50c9b5){var _0xe7133e=[{'name':_0xcb16('0x54'),'label':_0xcb16('0x54'),'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 _0x189b0e='';return db[_0xcb16('0x28')][_0xcb16('0x49')]({'where':{'id':_0x971a09[_0xcb16('0x43')]['id']},'attributes':['id',_0xcb16('0x55'),_0xcb16('0x56'),_0xcb16('0x57'),_0xcb16('0x58'),_0xcb16('0x59'),_0xcb16('0x5a'),_0xcb16('0x5b'),'tokenSecret']})['then'](handleEntityNotFound(_0x231719,null))[_0xcb16('0x21')](function(_0x27b3ee){if(_0x27b3ee){_0x189b0e=_0x27b3ee['remoteUri'];var _0x55598d=_0x189b0e[_0xcb16('0x5c')](-0x1);if(_0x55598d==='/'){_0x189b0e=_0x189b0e[_0xcb16('0x5d')](0x0,_0x189b0e[_0xcb16('0x5e')](_0x55598d));}var _0x239c05={'method':_0xcb16('0x5f'),'uri':util['format'](_0xcb16('0x60'),_0x189b0e),'headers':{'Content-Type':_0xcb16('0x61'),'Accept':_0xcb16('0x61')},'json':!![]};if(_0x27b3ee[_0xcb16('0x56')]==='basic'){_0x239c05[_0xcb16('0x62')][_0xcb16('0x63')]=util[_0xcb16('0x64')](_0xcb16('0x65'),new Buffer(util[_0xcb16('0x64')](_0xcb16('0x66'),_0x27b3ee[_0xcb16('0x57')],_0x27b3ee[_0xcb16('0x58')]))['toString'](_0xcb16('0x67')));}return rp(_0x239c05)[_0xcb16('0x21')](function(_0x56cd21){return _0xe7133e[_0xcb16('0x68')](_['map'](_0x56cd21[_0xcb16('0x69')]['entries'],function(_0x25beba){return{'id':_0x25beba[_0xcb16('0x24')],'name':_0x25beba['name'],'type':_0x25beba['type'],'active':_0x25beba[_0xcb16('0x6a')],'label':_0x25beba[_0xcb16('0x6b')],'custom':!![]};}));});}})[_0xcb16('0x21')](function(_0x142333){return{'count':_0x142333[_0xcb16('0x34')],'rows':_0x142333};})[_0xcb16('0x21')](respondWithResult(_0x231719,null))['catch'](function(_0x374b4b){var _0x1e5c30=_0x971a09[_0xcb16('0x2e')][_0xcb16('0x6c')]?0x1f4:_0x374b4b[_0xcb16('0x6d')]||0x1f4;logger['error'](_0xcb16('0x6e'),'getFields',_0x1e5c30,JSON[_0xcb16('0x6f')](_0x374b4b));delete _0x374b4b[_0xcb16('0x24')];if(_0x1e5c30===0x191){_0x1e5c30=0x190;}_0x231719[_0xcb16('0x17')](_0x1e5c30)[_0xcb16('0x25')](_0x971a09[_0xcb16('0x2e')][_0xcb16('0x6c')]?{'message':_0xcb16('0x70'),'statusCode':_0x374b4b['statusCode']}:_0x374b4b);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 2fbcd10..94de634 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 _0x625b=['util','moment','bluebird','request-promise','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','int_desk_accounts','lodash'];(function(_0x173d75,_0x58f947){var _0x87b741=function(_0x4071d5){while(--_0x4071d5){_0x173d75['push'](_0x173d75['shift']());}};_0x87b741(++_0x58f947);}(_0x625b,0x18b));var _0xb625=function(_0x55f5fa,_0x1d2083){_0x55f5fa=_0x55f5fa-0x0;var _0x3785c0=_0x625b[_0x55f5fa];return _0x3785c0;};'use strict';var _=require(_0xb625('0x0'));var util=require(_0xb625('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb625('0x2'));var BPromise=require(_0xb625('0x3'));var rp=require(_0xb625('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb625('0x5'));var config=require(_0xb625('0x6'));var attributes=require(_0xb625('0x7'));var integrations=require(_0xb625('0x8'));module[_0xb625('0x9')]=function(_0x3312db,_0x36b818){return _0x3312db[_0xb625('0xa')]('DeskAccount',attributes,{'tableName':_0xb625('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xefd2=['bluebird','request-promise','rimraf','../../config/environment','../../components/integrations/configuration','int_desk_accounts','lodash','util','../../config/logger','api'];(function(_0x425d5e,_0x3b9040){var _0x3cc67b=function(_0x121446){while(--_0x121446){_0x425d5e['push'](_0x425d5e['shift']());}};_0x3cc67b(++_0x3b9040);}(_0xefd2,0x1a0));var _0x2efd=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xefd2[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x2efd('0x0'));var util=require(_0x2efd('0x1'));var logger=require(_0x2efd('0x2'))(_0x2efd('0x3'));var moment=require('moment');var BPromise=require(_0x2efd('0x4'));var rp=require(_0x2efd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2efd('0x6'));var config=require(_0x2efd('0x7'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x2efd('0x8'));module['exports']=function(_0x394261,_0x52cf7b){return _0x394261['define']('DeskAccount',attributes,{'tableName':_0x2efd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index e510aa8..271c45c 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 _0xbeaa=['attributes','limit','include','map','model','ShowDeskAccount','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where'];(function(_0x49416c,_0x30ee25){var _0x57ca86=function(_0x3e4eb3){while(--_0x3e4eb3){_0x49416c['push'](_0x49416c['shift']());}};_0x57ca86(++_0x30ee25);}(_0xbeaa,0x1cd));var _0xabea=function(_0x5834f2,_0x3bc918){_0x5834f2=_0x5834f2-0x0;var _0x4d1c1f=_0xbeaa[_0x5834f2];return _0x4d1c1f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xabea('0x0'));var BPromise=require(_0xabea('0x1'));var rs=require(_0xabea('0x2'));var fs=require('fs');var Redis=require(_0xabea('0x3'));var db=require(_0xabea('0x4'))['db'];var utils=require(_0xabea('0x5'));var logger=require(_0xabea('0x6'))(_0xabea('0x7'));var config=require(_0xabea('0x8'));var jayson=require(_0xabea('0x9'));var client=jayson[_0xabea('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c0c33,_0x374143,_0x34f0ea){return new BPromise(function(_0x41b203,_0x39780c){return client[_0xabea('0xb')](_0x4c0c33,_0x34f0ea)[_0xabea('0xc')](function(_0xbe83fe){logger[_0xabea('0xd')](_0xabea('0xe'),_0x374143,_0xabea('0xf'));logger[_0xabea('0x10')](_0xabea('0x11'),_0x374143,_0xabea('0xf'),JSON[_0xabea('0x12')](_0xbe83fe));if(_0xbe83fe[_0xabea('0x13')]){if(_0xbe83fe[_0xabea('0x13')][_0xabea('0x14')]===0x1f4){logger[_0xabea('0x13')](_0xabea('0xe'),_0x374143,_0xbe83fe['error'][_0xabea('0x15')]);return _0x39780c(_0xbe83fe[_0xabea('0x13')][_0xabea('0x15')]);}logger[_0xabea('0x13')](_0xabea('0xe'),_0x374143,_0xbe83fe[_0xabea('0x13')][_0xabea('0x15')]);return _0x41b203(_0xbe83fe[_0xabea('0x13')][_0xabea('0x15')]);}else{logger[_0xabea('0xd')](_0xabea('0xe'),_0x374143,_0xabea('0xf'));_0x41b203(_0xbe83fe['result'][_0xabea('0x15')]);}})[_0xabea('0x16')](function(_0x3647b3){logger[_0xabea('0x13')](_0xabea('0xe'),_0x374143,_0x3647b3);_0x39780c(_0x3647b3);});});}exports[_0xabea('0x17')]=function(_0x28f755){var _0x4282fe=this;return new Promise(function(_0x1c2556,_0x3a01d0){return db[_0xabea('0x18')][_0xabea('0x19')]({'raw':_0x28f755[_0xabea('0x1a')]?_0x28f755[_0xabea('0x1a')][_0xabea('0x1b')]===undefined?!![]:![]:!![],'where':_0x28f755['options']?_0x28f755[_0xabea('0x1a')][_0xabea('0x1c')]||null:null,'attributes':_0x28f755[_0xabea('0x1a')]?_0x28f755[_0xabea('0x1a')][_0xabea('0x1d')]||null:null,'limit':_0x28f755[_0xabea('0x1a')]?_0x28f755[_0xabea('0x1a')][_0xabea('0x1e')]||null:null,'include':_0x28f755[_0xabea('0x1a')]?_0x28f755[_0xabea('0x1a')][_0xabea('0x1f')]?_[_0xabea('0x20')](_0x28f755[_0xabea('0x1a')][_0xabea('0x1f')],function(_0x37301e){return{'model':db[_0x37301e[_0xabea('0x21')]],'as':_0x37301e['as'],'attributes':_0x37301e[_0xabea('0x1d')],'include':_0x37301e[_0xabea('0x1f')]?_[_0xabea('0x20')](_0x37301e[_0xabea('0x1f')],function(_0x20d3f4){return{'model':db[_0x20d3f4['model']],'as':_0x20d3f4['as'],'attributes':_0x20d3f4[_0xabea('0x1d')],'include':_0x20d3f4[_0xabea('0x1f')]?_['map'](_0x20d3f4['include'],function(_0x3236cd){return{'model':db[_0x3236cd[_0xabea('0x21')]],'as':_0x3236cd['as'],'attributes':_0x3236cd[_0xabea('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xabea('0xc')](function(_0x38410e){logger['info'](_0xabea('0x17'),_0x28f755);logger[_0xabea('0x10')](_0xabea('0x17'),_0x28f755,JSON['stringify'](_0x38410e));_0x1c2556(_0x38410e);})['catch'](function(_0x956717){logger[_0xabea('0x13')](_0xabea('0x17'),_0x956717[_0xabea('0x15')],_0x28f755);_0x3a01d0(_0x4282fe[_0xabea('0x13')](0x1f4,_0x956717[_0xabea('0x15')]));});});};exports['ShowDeskAccount']=function(_0xa3ec03){var _0x137505=this;return new Promise(function(_0x323e3d,_0x5be9e7){return db['DeskAccount']['find']({'raw':_0xa3ec03['options']?_0xa3ec03['options']['raw']===undefined?!![]:![]:!![],'where':_0xa3ec03[_0xabea('0x1a')]?_0xa3ec03[_0xabea('0x1a')]['where']||null:null,'attributes':_0xa3ec03[_0xabea('0x1a')]?_0xa3ec03['options'][_0xabea('0x1d')]||null:null,'include':_0xa3ec03[_0xabea('0x1a')]?_0xa3ec03[_0xabea('0x1a')][_0xabea('0x1f')]?_[_0xabea('0x20')](_0xa3ec03[_0xabea('0x1a')]['include'],function(_0x4b1b11){return{'model':db[_0x4b1b11[_0xabea('0x21')]],'as':_0x4b1b11['as'],'attributes':_0x4b1b11[_0xabea('0x1d')],'include':_0x4b1b11[_0xabea('0x1f')]?_[_0xabea('0x20')](_0x4b1b11[_0xabea('0x1f')],function(_0xce041f){return{'model':db[_0xce041f[_0xabea('0x21')]],'as':_0xce041f['as'],'attributes':_0xce041f[_0xabea('0x1d')],'include':_0xce041f['include']?_[_0xabea('0x20')](_0xce041f[_0xabea('0x1f')],function(_0x214839){return{'model':db[_0x214839[_0xabea('0x21')]],'as':_0x214839['as'],'attributes':_0x214839[_0xabea('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x55c841){logger['info'](_0xabea('0x22'),_0xa3ec03);logger[_0xabea('0x10')](_0xabea('0x22'),_0xa3ec03,JSON[_0xabea('0x12')](_0x55c841));_0x323e3d(_0x55c841);})[_0xabea('0x16')](function(_0x57c0a9){logger[_0xabea('0x13')](_0xabea('0x22'),_0x57c0a9[_0xabea('0x15')],_0xa3ec03);_0x5be9e7(_0x137505[_0xabea('0x13')](0x1f4,_0x57c0a9[_0xabea('0x15')]));});});}; \ No newline at end of file +var _0x9c31=['model','GetDeskAccount','catch','DeskAccount','find','ShowDeskAccount','util','randomstring','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','options','raw','where','attributes','limit','include','map'];(function(_0x1f604f,_0x28fc7d){var _0x214c32=function(_0x12ba49){while(--_0x12ba49){_0x1f604f['push'](_0x1f604f['shift']());}};_0x214c32(++_0x28fc7d);}(_0x9c31,0x106));var _0x19c3=function(_0x155fcc,_0x54b353){_0x155fcc=_0x155fcc-0x0;var _0xa5d0ad=_0x9c31[_0x155fcc];return _0xa5d0ad;};'use strict';var _=require('lodash');var util=require(_0x19c3('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x19c3('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x19c3('0x2'));var logger=require('../../config/logger')('rpc');var config=require(_0x19c3('0x3'));var jayson=require(_0x19c3('0x4'));var client=jayson[_0x19c3('0x5')][_0x19c3('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x15758f,_0x52346b,_0x4d2da5){return new BPromise(function(_0x4786b2,_0x44d354){return client[_0x19c3('0x7')](_0x15758f,_0x4d2da5)[_0x19c3('0x8')](function(_0x5160be){logger[_0x19c3('0x9')](_0x19c3('0xa'),_0x52346b,_0x19c3('0xb'));logger[_0x19c3('0xc')](_0x19c3('0xd'),_0x52346b,_0x19c3('0xb'),JSON[_0x19c3('0xe')](_0x5160be));if(_0x5160be[_0x19c3('0xf')]){if(_0x5160be['error'][_0x19c3('0x10')]===0x1f4){logger['error'](_0x19c3('0xa'),_0x52346b,_0x5160be[_0x19c3('0xf')][_0x19c3('0x11')]);return _0x44d354(_0x5160be['error'][_0x19c3('0x11')]);}logger[_0x19c3('0xf')](_0x19c3('0xa'),_0x52346b,_0x5160be[_0x19c3('0xf')][_0x19c3('0x11')]);return _0x4786b2(_0x5160be[_0x19c3('0xf')]['message']);}else{logger[_0x19c3('0x9')]('DeskAccount,\x20%s,\x20%s',_0x52346b,'request\x20sent');_0x4786b2(_0x5160be[_0x19c3('0x12')]['message']);}})['catch'](function(_0x1c7953){logger[_0x19c3('0xf')](_0x19c3('0xa'),_0x52346b,_0x1c7953);_0x44d354(_0x1c7953);});});}exports['GetDeskAccount']=function(_0x58c5af){var _0x3236f7=this;return new Promise(function(_0x6befe9,_0x57caaf){return db['DeskAccount']['findAll']({'raw':_0x58c5af[_0x19c3('0x13')]?_0x58c5af[_0x19c3('0x13')][_0x19c3('0x14')]===undefined?!![]:![]:!![],'where':_0x58c5af[_0x19c3('0x13')]?_0x58c5af['options'][_0x19c3('0x15')]||null:null,'attributes':_0x58c5af[_0x19c3('0x13')]?_0x58c5af['options'][_0x19c3('0x16')]||null:null,'limit':_0x58c5af[_0x19c3('0x13')]?_0x58c5af['options'][_0x19c3('0x17')]||null:null,'include':_0x58c5af['options']?_0x58c5af[_0x19c3('0x13')][_0x19c3('0x18')]?_[_0x19c3('0x19')](_0x58c5af[_0x19c3('0x13')][_0x19c3('0x18')],function(_0x1fcec){return{'model':db[_0x1fcec[_0x19c3('0x1a')]],'as':_0x1fcec['as'],'attributes':_0x1fcec[_0x19c3('0x16')],'include':_0x1fcec['include']?_['map'](_0x1fcec[_0x19c3('0x18')],function(_0x131366){return{'model':db[_0x131366['model']],'as':_0x131366['as'],'attributes':_0x131366['attributes'],'include':_0x131366[_0x19c3('0x18')]?_[_0x19c3('0x19')](_0x131366['include'],function(_0x3ed21a){return{'model':db[_0x3ed21a[_0x19c3('0x1a')]],'as':_0x3ed21a['as'],'attributes':_0x3ed21a[_0x19c3('0x16')]};}):[]};}):[]};}):[]:[]})[_0x19c3('0x8')](function(_0x52c2b3){logger[_0x19c3('0x9')](_0x19c3('0x1b'),_0x58c5af);logger[_0x19c3('0xc')](_0x19c3('0x1b'),_0x58c5af,JSON[_0x19c3('0xe')](_0x52c2b3));_0x6befe9(_0x52c2b3);})[_0x19c3('0x1c')](function(_0x472968){logger[_0x19c3('0xf')](_0x19c3('0x1b'),_0x472968[_0x19c3('0x11')],_0x58c5af);_0x57caaf(_0x3236f7[_0x19c3('0xf')](0x1f4,_0x472968['message']));});});};exports['ShowDeskAccount']=function(_0x44ed55){var _0x4b1d89=this;return new Promise(function(_0x14b787,_0x165e93){return db[_0x19c3('0x1d')][_0x19c3('0x1e')]({'raw':_0x44ed55[_0x19c3('0x13')]?_0x44ed55[_0x19c3('0x13')][_0x19c3('0x14')]===undefined?!![]:![]:!![],'where':_0x44ed55[_0x19c3('0x13')]?_0x44ed55[_0x19c3('0x13')][_0x19c3('0x15')]||null:null,'attributes':_0x44ed55['options']?_0x44ed55[_0x19c3('0x13')]['attributes']||null:null,'include':_0x44ed55['options']?_0x44ed55['options']['include']?_[_0x19c3('0x19')](_0x44ed55[_0x19c3('0x13')][_0x19c3('0x18')],function(_0x349209){return{'model':db[_0x349209[_0x19c3('0x1a')]],'as':_0x349209['as'],'attributes':_0x349209[_0x19c3('0x16')],'include':_0x349209[_0x19c3('0x18')]?_['map'](_0x349209[_0x19c3('0x18')],function(_0x342311){return{'model':db[_0x342311[_0x19c3('0x1a')]],'as':_0x342311['as'],'attributes':_0x342311['attributes'],'include':_0x342311['include']?_[_0x19c3('0x19')](_0x342311[_0x19c3('0x18')],function(_0x18a2d6){return{'model':db[_0x18a2d6['model']],'as':_0x18a2d6['as'],'attributes':_0x18a2d6[_0x19c3('0x16')]};}):[]};}):[]};}):[]:[]})[_0x19c3('0x8')](function(_0x468ae3){logger[_0x19c3('0x9')](_0x19c3('0x1f'),_0x44ed55);logger[_0x19c3('0xc')](_0x19c3('0x1f'),_0x44ed55,JSON[_0x19c3('0xe')](_0x468ae3));_0x14b787(_0x468ae3);})[_0x19c3('0x1c')](function(_0x17182c){logger[_0x19c3('0xf')](_0x19c3('0x1f'),_0x17182c[_0x19c3('0x11')],_0x44ed55);_0x165e93(_0x4b1d89[_0x19c3('0xf')](0x1f4,_0x17182c[_0x19c3('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index f1cc022..9030baf 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x3f3a47,_0x28f84b){var _0x57a682=function(_0x1175d3){while(--_0x1175d3){_0x3f3a47['push'](_0x3f3a47['shift']());}};_0x57a682(++_0x28f84b);}(_0x55ca,0x126));var _0xa55c=function(_0x34d346,_0x4c6502){_0x34d346=_0x34d346-0x0;var _0x122d76=_0x55ca[_0x34d346];return _0x122d76;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file +var _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x4c9380,_0x2fefc0){var _0x49a523=function(_0x165e85){while(--_0x165e85){_0x4c9380['push'](_0x4c9380['shift']());}};_0x49a523(++_0x2fefc0);}(_0x55ca,0x126));var _0xa55c=function(_0x503287,_0x252ead){_0x503287=_0x503287-0x0;var _0x3709ef=_0x55ca[_0x503287];return _0x3709ef;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index aa724b3..3d89b7a 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 _0xc099=['STRING'];(function(_0x48b9b2,_0x13c839){var _0x1e69a8=function(_0x33983c){while(--_0x33983c){_0x48b9b2['push'](_0x48b9b2['shift']());}};_0x1e69a8(++_0x13c839);}(_0xc099,0x72));var _0x9c09=function(_0x209b1c,_0x33a2ec){_0x209b1c=_0x209b1c-0x0;var _0x2733fc=_0xc099[_0x209b1c];return _0x2733fc;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x9c09('0x0')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa497=['exports','STRING','sequelize'];(function(_0x1ccbcc,_0x5c948b){var _0x1e873f=function(_0x4f232e){while(--_0x4f232e){_0x1ccbcc['push'](_0x1ccbcc['shift']());}};_0x1e873f(++_0x5c948b);}(_0xa497,0x71));var _0x7a49=function(_0x51cca0,_0x5f1c69){_0x51cca0=_0x51cca0-0x0;var _0xf10777=_0xa497[_0x51cca0];return _0xf10777;};'use strict';var Sequelize=require(_0x7a49('0x0'));module[_0x7a49('0x1')]={'name':{'type':Sequelize[_0x7a49('0x2')]},'description':{'type':Sequelize[_0x7a49('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 240be00..4c74c83 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 _0x7820=['../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','DeskConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','catch','update','body','getFields','findOne','hasOwnProperty','getSubjects','getDescriptions','DeskField','getTags','setTags','ids','eml-format','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs'];(function(_0x30a648,_0xd66ff1){var _0x21a127=function(_0x3a7ecd){while(--_0x3a7ecd){_0x30a648['push'](_0x30a648['shift']());}};_0x21a127(++_0xd66ff1);}(_0x7820,0x193));var _0x0782=function(_0x172bae,_0x56c344){_0x172bae=_0x172bae-0x0;var _0x4534cb=_0x7820[_0x172bae];return _0x4534cb;};'use strict';var emlformat=require(_0x0782('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0782('0x1'));var moment=require(_0x0782('0x2'));var BPromise=require(_0x0782('0x3'));var Mustache=require(_0x0782('0x4'));var util=require('util');var path=require('path');var sox=require(_0x0782('0x5'));var csv=require(_0x0782('0x6'));var ejs=require(_0x0782('0x7'));var fs=require('fs');var fs_extra=require(_0x0782('0x8'));var _=require(_0x0782('0x9'));var squel=require(_0x0782('0xa'));var crypto=require(_0x0782('0xb'));var jsforce=require(_0x0782('0xc'));var deskjs=require(_0x0782('0xd'));var toCsv=require(_0x0782('0x6'));var querystring=require(_0x0782('0xe'));var Papa=require('papaparse');var Redis=require(_0x0782('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x0782('0x10'));var as=require(_0x0782('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0782('0x12'))('api');var utils=require(_0x0782('0x13'));var config=require(_0x0782('0x14'));var licenseUtil=require(_0x0782('0x15'));var db=require(_0x0782('0x16'))['db'];function respondWithStatusCode(_0x5de208,_0x1b9c62){_0x1b9c62=_0x1b9c62||0xcc;return function(_0x289280){if(_0x289280){return _0x5de208[_0x0782('0x17')](_0x1b9c62);}return _0x5de208[_0x0782('0x18')](_0x1b9c62)[_0x0782('0x19')]();};}function respondWithResult(_0x4cbbee,_0x242510){_0x242510=_0x242510||0xc8;return function(_0x4a24d2){if(_0x4a24d2){return _0x4cbbee[_0x0782('0x18')](_0x242510)[_0x0782('0x1a')](_0x4a24d2);}};}function respondWithFilteredResult(_0x410b35,_0x5924eb){return function(_0x21cdb4){if(_0x21cdb4){var _0x3b6de1=typeof _0x5924eb[_0x0782('0x1b')]==='undefined'&&typeof _0x5924eb[_0x0782('0x1c')]==='undefined';var _0x17c8c4=_0x21cdb4[_0x0782('0x1d')];var _0x8c236d=_0x3b6de1?0x0:_0x5924eb['offset'];var _0x206b58=_0x3b6de1?_0x21cdb4[_0x0782('0x1d')]:_0x5924eb[_0x0782('0x1b')]+_0x5924eb[_0x0782('0x1c')];var _0x15330b;if(_0x206b58>=_0x17c8c4){_0x206b58=_0x17c8c4;_0x15330b=0xc8;}else{_0x15330b=0xce;}_0x410b35[_0x0782('0x18')](_0x15330b);return _0x410b35[_0x0782('0x1e')](_0x0782('0x1f'),_0x8c236d+'-'+_0x206b58+'/'+_0x17c8c4)[_0x0782('0x1a')](_0x21cdb4);}return null;};}function patchUpdates(_0x3dafe5){return function(_0x73a3b0){try{jsonpatch[_0x0782('0x20')](_0x73a3b0,_0x3dafe5,!![]);}catch(_0x112e63){return BPromise[_0x0782('0x21')](_0x112e63);}return _0x73a3b0[_0x0782('0x22')]();};}function saveUpdates(_0x543c32,_0x1cb400){return function(_0x1a32bd){if(_0x1a32bd){return _0x1a32bd['update'](_0x543c32)[_0x0782('0x23')](function(_0x51d157){return _0x51d157;});}return null;};}function removeEntity(_0x4a49a9,_0x163af2){return function(_0x1e2417){if(_0x1e2417){return _0x1e2417[_0x0782('0x24')]()['then'](function(){_0x4a49a9[_0x0782('0x18')](0xcc)[_0x0782('0x19')]();});}};}function handleEntityNotFound(_0x49c250,_0x158e8a){return function(_0x574bf2){if(!_0x574bf2){_0x49c250[_0x0782('0x17')](0x194);}return _0x574bf2;};}function handleError(_0x29935a,_0x2b5bb3){_0x2b5bb3=_0x2b5bb3||0x1f4;return function(_0x5a8643){logger[_0x0782('0x25')](_0x5a8643[_0x0782('0x26')]);if(_0x5a8643[_0x0782('0x27')]){delete _0x5a8643[_0x0782('0x27')];}_0x29935a[_0x0782('0x18')](_0x2b5bb3)[_0x0782('0x28')](_0x5a8643);};}exports[_0x0782('0x29')]=function(_0x51afc2,_0x1cee8d){var _0x30ca1a={},_0x4015ac={},_0x5e0389={'count':0x0,'rows':[]};var _0x3875e3=_[_0x0782('0x2a')](db[_0x0782('0x2b')][_0x0782('0x2c')],function(_0x5be043){return{'name':_0x5be043['fieldName'],'type':_0x5be043[_0x0782('0x2d')][_0x0782('0x2e')]};});_0x4015ac[_0x0782('0x2f')]=_['map'](_0x3875e3,'name');_0x4015ac[_0x0782('0x30')]=_[_0x0782('0x31')](_0x51afc2[_0x0782('0x30')]);_0x4015ac[_0x0782('0x32')]=_[_0x0782('0x33')](_0x4015ac[_0x0782('0x2f')],_0x4015ac[_0x0782('0x30')]);_0x30ca1a[_0x0782('0x34')]=_[_0x0782('0x33')](_0x4015ac[_0x0782('0x2f')],qs[_0x0782('0x35')](_0x51afc2[_0x0782('0x30')]['fields']));_0x30ca1a[_0x0782('0x34')]=_0x30ca1a['attributes'][_0x0782('0x36')]?_0x30ca1a[_0x0782('0x34')]:_0x4015ac[_0x0782('0x2f')];if(!_0x51afc2[_0x0782('0x30')]['hasOwnProperty'](_0x0782('0x37'))){_0x30ca1a['limit']=qs[_0x0782('0x1c')](_0x51afc2[_0x0782('0x30')][_0x0782('0x1c')]);_0x30ca1a['offset']=qs['offset'](_0x51afc2[_0x0782('0x30')][_0x0782('0x1b')]);}_0x30ca1a[_0x0782('0x38')]=qs[_0x0782('0x39')](_0x51afc2[_0x0782('0x30')][_0x0782('0x39')]);_0x30ca1a[_0x0782('0x3a')]=qs[_0x0782('0x32')](_[_0x0782('0x3b')](_0x51afc2[_0x0782('0x30')],_0x4015ac[_0x0782('0x32')]),_0x3875e3);if(_0x51afc2[_0x0782('0x30')][_0x0782('0x3c')]){_0x30ca1a['where']=_[_0x0782('0x3d')](_0x30ca1a['where'],{'$or':_[_0x0782('0x2a')](_0x3875e3,function(_0x319090){if(_0x319090[_0x0782('0x2d')]!==_0x0782('0x3e')){var _0x2a830d={};_0x2a830d[_0x319090[_0x0782('0x27')]]={'$like':'%'+_0x51afc2['query']['filter']+'%'};return _0x2a830d;}})});}_0x30ca1a=_['merge']({},_0x30ca1a,_0x51afc2[_0x0782('0x3f')]);var _0x1b0770={'where':_0x30ca1a['where']};return db[_0x0782('0x2b')][_0x0782('0x1d')](_0x1b0770)[_0x0782('0x23')](function(_0x1b87d7){_0x5e0389[_0x0782('0x1d')]=_0x1b87d7;if(_0x51afc2[_0x0782('0x30')][_0x0782('0x40')]){_0x30ca1a[_0x0782('0x41')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x0782('0x42')](_0x30ca1a);})['then'](function(_0x2c1986){_0x5e0389[_0x0782('0x43')]=_0x2c1986;return _0x5e0389;})[_0x0782('0x23')](respondWithFilteredResult(_0x1cee8d,_0x30ca1a))['catch'](handleError(_0x1cee8d,null));};exports[_0x0782('0x44')]=function(_0x369d4a,_0x40a342){var _0x2604a4={'raw':![],'where':{'id':_0x369d4a[_0x0782('0x45')]['id']}},_0x5bede8={};_0x5bede8['model']=_[_0x0782('0x31')](db[_0x0782('0x2b')][_0x0782('0x2c')]);_0x5bede8[_0x0782('0x30')]=_[_0x0782('0x31')](_0x369d4a[_0x0782('0x30')]);_0x5bede8[_0x0782('0x32')]=_[_0x0782('0x33')](_0x5bede8[_0x0782('0x2f')],_0x5bede8[_0x0782('0x30')]);_0x2604a4[_0x0782('0x34')]=_[_0x0782('0x33')](_0x5bede8[_0x0782('0x2f')],qs[_0x0782('0x35')](_0x369d4a['query'][_0x0782('0x35')]));_0x2604a4[_0x0782('0x34')]=_0x2604a4[_0x0782('0x34')][_0x0782('0x36')]?_0x2604a4['attributes']:_0x5bede8['model'];if(_0x369d4a['query'][_0x0782('0x40')]){_0x2604a4[_0x0782('0x41')]=[{'all':!![]}];}_0x2604a4=_[_0x0782('0x3d')]({},_0x2604a4,_0x369d4a[_0x0782('0x3f')]);return db[_0x0782('0x2b')][_0x0782('0x46')](_0x2604a4)[_0x0782('0x23')](handleEntityNotFound(_0x40a342,null))[_0x0782('0x23')](respondWithResult(_0x40a342,null))['catch'](handleError(_0x40a342,null));};exports['create']=function(_0x5f5c57,_0x4b78ae){return db[_0x0782('0x2b')][_0x0782('0x47')](_0x5f5c57['body'],{})[_0x0782('0x23')](respondWithResult(_0x4b78ae,0xc9))[_0x0782('0x48')](handleError(_0x4b78ae,null));};exports[_0x0782('0x49')]=function(_0x173f65,_0x3b847f){if(_0x173f65[_0x0782('0x4a')]['id']){delete _0x173f65[_0x0782('0x4a')]['id'];}return db[_0x0782('0x2b')]['find']({'where':{'id':_0x173f65[_0x0782('0x45')]['id']}})['then'](handleEntityNotFound(_0x3b847f,null))[_0x0782('0x23')](saveUpdates(_0x173f65[_0x0782('0x4a')],null))[_0x0782('0x23')](respondWithResult(_0x3b847f,null))[_0x0782('0x48')](handleError(_0x3b847f,null));};exports['destroy']=function(_0x284afd,_0x5aedde){return db['DeskConfiguration'][_0x0782('0x46')]({'where':{'id':_0x284afd[_0x0782('0x45')]['id']}})[_0x0782('0x23')](handleEntityNotFound(_0x5aedde,null))[_0x0782('0x23')](removeEntity(_0x5aedde,null))[_0x0782('0x48')](handleError(_0x5aedde,null));};exports[_0x0782('0x4b')]=function(_0x497521,_0x21e8af,_0x3ec24d){var _0x3c241d={};var _0x3eb22f={};var _0x2671ca;var _0x359735;return db['DeskConfiguration'][_0x0782('0x4c')]({'where':{'id':_0x497521[_0x0782('0x45')]['id']}})[_0x0782('0x23')](handleEntityNotFound(_0x21e8af,null))[_0x0782('0x23')](function(_0x18c344){if(_0x18c344){_0x2671ca=_0x18c344;_0x3eb22f['model']=_[_0x0782('0x31')](db['DeskField']['rawAttributes']);_0x3eb22f['query']=_['keys'](_0x497521[_0x0782('0x30')]);_0x3eb22f[_0x0782('0x32')]=_[_0x0782('0x33')](_0x3eb22f[_0x0782('0x2f')],_0x3eb22f[_0x0782('0x30')]);_0x3c241d[_0x0782('0x34')]=_['intersection'](_0x3eb22f[_0x0782('0x2f')],qs['fields'](_0x497521[_0x0782('0x30')]['fields']));_0x3c241d[_0x0782('0x34')]=_0x3c241d[_0x0782('0x34')][_0x0782('0x36')]?_0x3c241d[_0x0782('0x34')]:_0x3eb22f[_0x0782('0x2f')];_0x3c241d[_0x0782('0x38')]=qs[_0x0782('0x39')](_0x497521[_0x0782('0x30')]['sort']);_0x3c241d[_0x0782('0x3a')]=qs[_0x0782('0x32')](_['pick'](_0x497521[_0x0782('0x30')],_0x3eb22f[_0x0782('0x32')]));if(_0x497521[_0x0782('0x30')][_0x0782('0x3c')]){_0x3c241d[_0x0782('0x3a')]=_[_0x0782('0x3d')](_0x3c241d[_0x0782('0x3a')],{'$or':_[_0x0782('0x2a')](_0x3c241d[_0x0782('0x34')],function(_0x352c5f){var _0x52df34={};_0x52df34[_0x352c5f]={'$like':'%'+_0x497521[_0x0782('0x30')][_0x0782('0x3c')]+'%'};return _0x52df34;})});}_0x3c241d=_[_0x0782('0x3d')]({},_0x3c241d,_0x497521[_0x0782('0x3f')]);return _0x2671ca['getFields'](_0x3c241d);}})[_0x0782('0x23')](function(_0x2ef8b0){if(_0x2ef8b0){_0x359735=_0x2ef8b0[_0x0782('0x36')];if(!_0x497521[_0x0782('0x30')][_0x0782('0x4d')]('nolimit')){_0x3c241d['limit']=qs[_0x0782('0x1c')](_0x497521[_0x0782('0x30')][_0x0782('0x1c')]);_0x3c241d[_0x0782('0x1b')]=qs['offset'](_0x497521['query'][_0x0782('0x1b')]);}return _0x2671ca[_0x0782('0x4b')](_0x3c241d);}})[_0x0782('0x23')](function(_0xad814c){if(_0xad814c){return _0xad814c?{'count':_0x359735,'rows':_0xad814c}:null;}})[_0x0782('0x23')](respondWithResult(_0x21e8af,null))['catch'](handleError(_0x21e8af,null));};exports[_0x0782('0x4e')]=function(_0x17aa1f,_0x317fbe,_0x301351){var _0x384bd0={};var _0x11149d={};var _0x21f831;var _0x246540;return db[_0x0782('0x2b')][_0x0782('0x4c')]({'where':{'id':_0x17aa1f['params']['id']}})[_0x0782('0x23')](handleEntityNotFound(_0x317fbe,null))['then'](function(_0x19e416){if(_0x19e416){_0x21f831=_0x19e416;_0x11149d['model']=_[_0x0782('0x31')](db['DeskField'][_0x0782('0x2c')]);_0x11149d[_0x0782('0x30')]=_[_0x0782('0x31')](_0x17aa1f['query']);_0x11149d[_0x0782('0x32')]=_['intersection'](_0x11149d[_0x0782('0x2f')],_0x11149d[_0x0782('0x30')]);_0x384bd0[_0x0782('0x34')]=_[_0x0782('0x33')](_0x11149d['model'],qs[_0x0782('0x35')](_0x17aa1f[_0x0782('0x30')][_0x0782('0x35')]));_0x384bd0[_0x0782('0x34')]=_0x384bd0['attributes'][_0x0782('0x36')]?_0x384bd0[_0x0782('0x34')]:_0x11149d[_0x0782('0x2f')];_0x384bd0[_0x0782('0x38')]=qs[_0x0782('0x39')](_0x17aa1f[_0x0782('0x30')]['sort']);_0x384bd0[_0x0782('0x3a')]=qs['filters'](_[_0x0782('0x3b')](_0x17aa1f[_0x0782('0x30')],_0x11149d[_0x0782('0x32')]));if(_0x17aa1f[_0x0782('0x30')][_0x0782('0x3c')]){_0x384bd0[_0x0782('0x3a')]=_[_0x0782('0x3d')](_0x384bd0[_0x0782('0x3a')],{'$or':_['map'](_0x384bd0[_0x0782('0x34')],function(_0x5df7d9){var _0x572ff6={};_0x572ff6[_0x5df7d9]={'$like':'%'+_0x17aa1f['query'][_0x0782('0x3c')]+'%'};return _0x572ff6;})});}_0x384bd0=_['merge']({},_0x384bd0,_0x17aa1f[_0x0782('0x3f')]);return _0x21f831['getSubjects'](_0x384bd0);}})[_0x0782('0x23')](function(_0x4356fc){if(_0x4356fc){_0x246540=_0x4356fc[_0x0782('0x36')];if(!_0x17aa1f[_0x0782('0x30')][_0x0782('0x4d')](_0x0782('0x37'))){_0x384bd0[_0x0782('0x1c')]=qs[_0x0782('0x1c')](_0x17aa1f[_0x0782('0x30')][_0x0782('0x1c')]);_0x384bd0[_0x0782('0x1b')]=qs[_0x0782('0x1b')](_0x17aa1f[_0x0782('0x30')]['offset']);}return _0x21f831[_0x0782('0x4e')](_0x384bd0);}})[_0x0782('0x23')](function(_0x9d60f7){if(_0x9d60f7){return _0x9d60f7?{'count':_0x246540,'rows':_0x9d60f7}:null;}})['then'](respondWithResult(_0x317fbe,null))[_0x0782('0x48')](handleError(_0x317fbe,null));};exports[_0x0782('0x4f')]=function(_0x514486,_0xa491f7,_0x544815){var _0x316797={};var _0x1d6627={};var _0x23f734;var _0x19f8e9;return db[_0x0782('0x2b')][_0x0782('0x4c')]({'where':{'id':_0x514486['params']['id']}})[_0x0782('0x23')](handleEntityNotFound(_0xa491f7,null))[_0x0782('0x23')](function(_0x2c0e77){if(_0x2c0e77){_0x23f734=_0x2c0e77;_0x1d6627[_0x0782('0x2f')]=_[_0x0782('0x31')](db[_0x0782('0x50')]['rawAttributes']);_0x1d6627[_0x0782('0x30')]=_['keys'](_0x514486[_0x0782('0x30')]);_0x1d6627[_0x0782('0x32')]=_[_0x0782('0x33')](_0x1d6627[_0x0782('0x2f')],_0x1d6627['query']);_0x316797[_0x0782('0x34')]=_[_0x0782('0x33')](_0x1d6627[_0x0782('0x2f')],qs[_0x0782('0x35')](_0x514486['query'][_0x0782('0x35')]));_0x316797[_0x0782('0x34')]=_0x316797[_0x0782('0x34')][_0x0782('0x36')]?_0x316797['attributes']:_0x1d6627[_0x0782('0x2f')];_0x316797[_0x0782('0x38')]=qs[_0x0782('0x39')](_0x514486['query'][_0x0782('0x39')]);_0x316797[_0x0782('0x3a')]=qs[_0x0782('0x32')](_['pick'](_0x514486[_0x0782('0x30')],_0x1d6627['filters']));if(_0x514486[_0x0782('0x30')][_0x0782('0x3c')]){_0x316797[_0x0782('0x3a')]=_[_0x0782('0x3d')](_0x316797[_0x0782('0x3a')],{'$or':_[_0x0782('0x2a')](_0x316797[_0x0782('0x34')],function(_0xbb531b){var _0x3fceaa={};_0x3fceaa[_0xbb531b]={'$like':'%'+_0x514486[_0x0782('0x30')][_0x0782('0x3c')]+'%'};return _0x3fceaa;})});}_0x316797=_['merge']({},_0x316797,_0x514486[_0x0782('0x3f')]);return _0x23f734[_0x0782('0x4f')](_0x316797);}})[_0x0782('0x23')](function(_0x4e3c2b){if(_0x4e3c2b){_0x19f8e9=_0x4e3c2b['length'];if(!_0x514486[_0x0782('0x30')][_0x0782('0x4d')](_0x0782('0x37'))){_0x316797[_0x0782('0x1c')]=qs[_0x0782('0x1c')](_0x514486[_0x0782('0x30')][_0x0782('0x1c')]);_0x316797[_0x0782('0x1b')]=qs['offset'](_0x514486[_0x0782('0x30')]['offset']);}return _0x23f734[_0x0782('0x4f')](_0x316797);}})[_0x0782('0x23')](function(_0x2e1aff){if(_0x2e1aff){return _0x2e1aff?{'count':_0x19f8e9,'rows':_0x2e1aff}:null;}})[_0x0782('0x23')](respondWithResult(_0xa491f7,null))[_0x0782('0x48')](handleError(_0xa491f7,null));};exports[_0x0782('0x51')]=function(_0x450623,_0x23ebbf,_0xb226fd){var _0x4b459f={};var _0x4446bc={};var _0x5897fe;var _0x9dc132;return db[_0x0782('0x2b')][_0x0782('0x4c')]({'where':{'id':_0x450623[_0x0782('0x45')]['id']}})[_0x0782('0x23')](handleEntityNotFound(_0x23ebbf,null))[_0x0782('0x23')](function(_0xc9444){if(_0xc9444){_0x5897fe=_0xc9444;_0x4446bc[_0x0782('0x2f')]=_[_0x0782('0x31')](db['Tag'][_0x0782('0x2c')]);_0x4446bc[_0x0782('0x30')]=_[_0x0782('0x31')](_0x450623[_0x0782('0x30')]);_0x4446bc[_0x0782('0x32')]=_['intersection'](_0x4446bc[_0x0782('0x2f')],_0x4446bc[_0x0782('0x30')]);_0x4b459f[_0x0782('0x34')]=_[_0x0782('0x33')](_0x4446bc['model'],qs['fields'](_0x450623['query'][_0x0782('0x35')]));_0x4b459f['attributes']=_0x4b459f[_0x0782('0x34')][_0x0782('0x36')]?_0x4b459f['attributes']:_0x4446bc[_0x0782('0x2f')];_0x4b459f[_0x0782('0x38')]=qs[_0x0782('0x39')](_0x450623[_0x0782('0x30')]['sort']);_0x4b459f[_0x0782('0x3a')]=qs[_0x0782('0x32')](_['pick'](_0x450623['query'],_0x4446bc[_0x0782('0x32')]));if(_0x450623[_0x0782('0x30')][_0x0782('0x3c')]){_0x4b459f[_0x0782('0x3a')]=_['merge'](_0x4b459f['where'],{'$or':_['map'](_0x4b459f[_0x0782('0x34')],function(_0x100667){var _0x177266={};_0x177266[_0x100667]={'$like':'%'+_0x450623[_0x0782('0x30')][_0x0782('0x3c')]+'%'};return _0x177266;})});}_0x4b459f=_[_0x0782('0x3d')]({},_0x4b459f,_0x450623[_0x0782('0x3f')]);return _0x5897fe[_0x0782('0x51')](_0x4b459f);}})[_0x0782('0x23')](function(_0x1cf4a9){if(_0x1cf4a9){_0x9dc132=_0x1cf4a9['length'];if(!_0x450623[_0x0782('0x30')]['hasOwnProperty'](_0x0782('0x37'))){_0x4b459f['limit']=qs[_0x0782('0x1c')](_0x450623[_0x0782('0x30')][_0x0782('0x1c')]);_0x4b459f[_0x0782('0x1b')]=qs[_0x0782('0x1b')](_0x450623['query']['offset']);}return _0x5897fe[_0x0782('0x51')](_0x4b459f);}})[_0x0782('0x23')](function(_0x38e5c3){if(_0x38e5c3){return _0x38e5c3?{'count':_0x9dc132,'rows':_0x38e5c3}:null;}})[_0x0782('0x23')](respondWithResult(_0x23ebbf,null))[_0x0782('0x48')](handleError(_0x23ebbf,null));};exports[_0x0782('0x52')]=function(_0x1b8543,_0xe65ca1,_0x1e1eed){if(_0x1b8543[_0x0782('0x4a')]['id']){delete _0x1b8543[_0x0782('0x4a')]['id'];}return db[_0x0782('0x2b')]['findOne']({'where':{'id':_0x1b8543[_0x0782('0x45')]['id']}})['then'](handleEntityNotFound(_0xe65ca1,null))[_0x0782('0x23')](function(_0x4e6ada){if(_0x4e6ada){return _0x4e6ada[_0x0782('0x52')](_0x1b8543['body'][_0x0782('0x53')]||[]);}return null;})[_0x0782('0x23')](respondWithResult(_0xe65ca1,null))[_0x0782('0x48')](handleError(_0xe65ca1,null));}; \ No newline at end of file +var _0x30e8=['sox','to-csv','ejs','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','limit','undefined','count','set','Content-Range','json','save','update','then','destroy','sendStatus','stack','name','send','map','DeskConfiguration','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','findOne','order','getFields','getSubjects','getDescriptions','DeskField','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x3e112d,_0x2bb132){var _0x531c31=function(_0x1954bc){while(--_0x1954bc){_0x3e112d['push'](_0x3e112d['shift']());}};_0x531c31(++_0x2bb132);}(_0x30e8,0x19b));var _0x830e=function(_0x277168,_0x5848d1){_0x277168=_0x277168-0x0;var _0x370536=_0x30e8[_0x277168];return _0x370536;};'use strict';var emlformat=require(_0x830e('0x0'));var rimraf=require(_0x830e('0x1'));var zipdir=require(_0x830e('0x2'));var jsonpatch=require(_0x830e('0x3'));var rp=require(_0x830e('0x4'));var moment=require(_0x830e('0x5'));var BPromise=require(_0x830e('0x6'));var Mustache=require(_0x830e('0x7'));var util=require(_0x830e('0x8'));var path=require('path');var sox=require(_0x830e('0x9'));var csv=require(_0x830e('0xa'));var ejs=require(_0x830e('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x830e('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x830e('0xd'));var toCsv=require(_0x830e('0xa'));var querystring=require(_0x830e('0xe'));var Papa=require('papaparse');var Redis=require(_0x830e('0xf'));var authService=require(_0x830e('0x10'));var qs=require(_0x830e('0x11'));var as=require(_0x830e('0x12'));var hardwareService=require(_0x830e('0x13'));var logger=require(_0x830e('0x14'))('api');var utils=require(_0x830e('0x15'));var config=require(_0x830e('0x16'));var licenseUtil=require(_0x830e('0x17'));var db=require(_0x830e('0x18'))['db'];function respondWithStatusCode(_0x1e4c1f,_0x22b87e){_0x22b87e=_0x22b87e||0xcc;return function(_0x17e69e){if(_0x17e69e){return _0x1e4c1f['sendStatus'](_0x22b87e);}return _0x1e4c1f['status'](_0x22b87e)[_0x830e('0x19')]();};}function respondWithResult(_0x42cfaa,_0x3670f3){_0x3670f3=_0x3670f3||0xc8;return function(_0x23db97){if(_0x23db97){return _0x42cfaa[_0x830e('0x1a')](_0x3670f3)['json'](_0x23db97);}};}function respondWithFilteredResult(_0x3a9861,_0x1acb2a){return function(_0x3627ae){if(_0x3627ae){var _0x52233e=typeof _0x1acb2a[_0x830e('0x1b')]==='undefined'&&typeof _0x1acb2a[_0x830e('0x1c')]===_0x830e('0x1d');var _0x452367=_0x3627ae[_0x830e('0x1e')];var _0x4335cd=_0x52233e?0x0:_0x1acb2a[_0x830e('0x1b')];var _0x3e72e8=_0x52233e?_0x3627ae[_0x830e('0x1e')]:_0x1acb2a[_0x830e('0x1b')]+_0x1acb2a[_0x830e('0x1c')];var _0x44e4d3;if(_0x3e72e8>=_0x452367){_0x3e72e8=_0x452367;_0x44e4d3=0xc8;}else{_0x44e4d3=0xce;}_0x3a9861[_0x830e('0x1a')](_0x44e4d3);return _0x3a9861[_0x830e('0x1f')](_0x830e('0x20'),_0x4335cd+'-'+_0x3e72e8+'/'+_0x452367)[_0x830e('0x21')](_0x3627ae);}return null;};}function patchUpdates(_0x9121b6){return function(_0x407a1d){try{jsonpatch['apply'](_0x407a1d,_0x9121b6,!![]);}catch(_0x1401ff){return BPromise['reject'](_0x1401ff);}return _0x407a1d[_0x830e('0x22')]();};}function saveUpdates(_0x2030b7,_0x181115){return function(_0x240dcf){if(_0x240dcf){return _0x240dcf[_0x830e('0x23')](_0x2030b7)[_0x830e('0x24')](function(_0x5e49cb){return _0x5e49cb;});}return null;};}function removeEntity(_0xffab03,_0x1a5937){return function(_0x2901ab){if(_0x2901ab){return _0x2901ab[_0x830e('0x25')]()['then'](function(){_0xffab03[_0x830e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d4176,_0xeead67){return function(_0x35ea3e){if(!_0x35ea3e){_0x3d4176[_0x830e('0x26')](0x194);}return _0x35ea3e;};}function handleError(_0x1c155e,_0x1c748e){_0x1c748e=_0x1c748e||0x1f4;return function(_0x3ad66c){logger['error'](_0x3ad66c[_0x830e('0x27')]);if(_0x3ad66c['name']){delete _0x3ad66c[_0x830e('0x28')];}_0x1c155e[_0x830e('0x1a')](_0x1c748e)[_0x830e('0x29')](_0x3ad66c);};}exports['index']=function(_0x1d589a,_0x30606c){var _0x3c4876={},_0x1080e4={},_0x176462={'count':0x0,'rows':[]};var _0xfe025=_[_0x830e('0x2a')](db[_0x830e('0x2b')]['rawAttributes'],function(_0x3d5435){return{'name':_0x3d5435[_0x830e('0x2c')],'type':_0x3d5435[_0x830e('0x2d')][_0x830e('0x2e')]};});_0x1080e4['model']=_[_0x830e('0x2a')](_0xfe025,_0x830e('0x28'));_0x1080e4[_0x830e('0x2f')]=_[_0x830e('0x30')](_0x1d589a[_0x830e('0x2f')]);_0x1080e4[_0x830e('0x31')]=_[_0x830e('0x32')](_0x1080e4[_0x830e('0x33')],_0x1080e4[_0x830e('0x2f')]);_0x3c4876[_0x830e('0x34')]=_[_0x830e('0x32')](_0x1080e4[_0x830e('0x33')],qs[_0x830e('0x35')](_0x1d589a['query'][_0x830e('0x35')]));_0x3c4876[_0x830e('0x34')]=_0x3c4876[_0x830e('0x34')][_0x830e('0x36')]?_0x3c4876[_0x830e('0x34')]:_0x1080e4['model'];if(!_0x1d589a[_0x830e('0x2f')][_0x830e('0x37')](_0x830e('0x38'))){_0x3c4876[_0x830e('0x1c')]=qs[_0x830e('0x1c')](_0x1d589a[_0x830e('0x2f')]['limit']);_0x3c4876[_0x830e('0x1b')]=qs[_0x830e('0x1b')](_0x1d589a[_0x830e('0x2f')][_0x830e('0x1b')]);}_0x3c4876['order']=qs[_0x830e('0x39')](_0x1d589a['query']['sort']);_0x3c4876[_0x830e('0x3a')]=qs[_0x830e('0x31')](_[_0x830e('0x3b')](_0x1d589a[_0x830e('0x2f')],_0x1080e4[_0x830e('0x31')]),_0xfe025);if(_0x1d589a[_0x830e('0x2f')][_0x830e('0x3c')]){_0x3c4876['where']=_[_0x830e('0x3d')](_0x3c4876[_0x830e('0x3a')],{'$or':_[_0x830e('0x2a')](_0xfe025,function(_0x4050f2){if(_0x4050f2[_0x830e('0x2d')]!==_0x830e('0x3e')){var _0xf4478c={};_0xf4478c[_0x4050f2[_0x830e('0x28')]]={'$like':'%'+_0x1d589a[_0x830e('0x2f')][_0x830e('0x3c')]+'%'};return _0xf4478c;}})});}_0x3c4876=_[_0x830e('0x3d')]({},_0x3c4876,_0x1d589a[_0x830e('0x3f')]);var _0x4e8cb9={'where':_0x3c4876[_0x830e('0x3a')]};return db[_0x830e('0x2b')][_0x830e('0x1e')](_0x4e8cb9)['then'](function(_0x2b8236){_0x176462[_0x830e('0x1e')]=_0x2b8236;if(_0x1d589a['query'][_0x830e('0x40')]){_0x3c4876[_0x830e('0x41')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x830e('0x42')](_0x3c4876);})['then'](function(_0x1d0496){_0x176462[_0x830e('0x43')]=_0x1d0496;return _0x176462;})[_0x830e('0x24')](respondWithFilteredResult(_0x30606c,_0x3c4876))[_0x830e('0x44')](handleError(_0x30606c,null));};exports[_0x830e('0x45')]=function(_0x58cf5b,_0x4ae674){var _0x184a07={'raw':![],'where':{'id':_0x58cf5b[_0x830e('0x46')]['id']}},_0x4799b0={};_0x4799b0[_0x830e('0x33')]=_[_0x830e('0x30')](db[_0x830e('0x2b')][_0x830e('0x47')]);_0x4799b0[_0x830e('0x2f')]=_[_0x830e('0x30')](_0x58cf5b['query']);_0x4799b0[_0x830e('0x31')]=_[_0x830e('0x32')](_0x4799b0['model'],_0x4799b0['query']);_0x184a07[_0x830e('0x34')]=_[_0x830e('0x32')](_0x4799b0[_0x830e('0x33')],qs[_0x830e('0x35')](_0x58cf5b[_0x830e('0x2f')][_0x830e('0x35')]));_0x184a07[_0x830e('0x34')]=_0x184a07[_0x830e('0x34')]['length']?_0x184a07[_0x830e('0x34')]:_0x4799b0[_0x830e('0x33')];if(_0x58cf5b['query'][_0x830e('0x40')]){_0x184a07[_0x830e('0x41')]=[{'all':!![]}];}_0x184a07=_[_0x830e('0x3d')]({},_0x184a07,_0x58cf5b[_0x830e('0x3f')]);return db[_0x830e('0x2b')]['find'](_0x184a07)[_0x830e('0x24')](handleEntityNotFound(_0x4ae674,null))['then'](respondWithResult(_0x4ae674,null))[_0x830e('0x44')](handleError(_0x4ae674,null));};exports[_0x830e('0x48')]=function(_0x3a4292,_0x41b7f1){return db[_0x830e('0x2b')][_0x830e('0x48')](_0x3a4292[_0x830e('0x49')],{})[_0x830e('0x24')](respondWithResult(_0x41b7f1,0xc9))[_0x830e('0x44')](handleError(_0x41b7f1,null));};exports[_0x830e('0x23')]=function(_0x12d0dd,_0x3416ef){if(_0x12d0dd[_0x830e('0x49')]['id']){delete _0x12d0dd[_0x830e('0x49')]['id'];}return db['DeskConfiguration'][_0x830e('0x4a')]({'where':{'id':_0x12d0dd['params']['id']}})[_0x830e('0x24')](handleEntityNotFound(_0x3416ef,null))['then'](saveUpdates(_0x12d0dd[_0x830e('0x49')],null))['then'](respondWithResult(_0x3416ef,null))[_0x830e('0x44')](handleError(_0x3416ef,null));};exports[_0x830e('0x25')]=function(_0x27ecaf,_0x1ce151){return db[_0x830e('0x2b')][_0x830e('0x4a')]({'where':{'id':_0x27ecaf[_0x830e('0x46')]['id']}})['then'](handleEntityNotFound(_0x1ce151,null))[_0x830e('0x24')](removeEntity(_0x1ce151,null))[_0x830e('0x44')](handleError(_0x1ce151,null));};exports['getFields']=function(_0xbc6581,_0x3c6365,_0x298ea2){var _0x8f96f3={};var _0x69a526={};var _0x5a3818;var _0x434464;return db[_0x830e('0x2b')][_0x830e('0x4b')]({'where':{'id':_0xbc6581[_0x830e('0x46')]['id']}})[_0x830e('0x24')](handleEntityNotFound(_0x3c6365,null))[_0x830e('0x24')](function(_0x4e272e){if(_0x4e272e){_0x5a3818=_0x4e272e;_0x69a526[_0x830e('0x33')]=_['keys'](db['DeskField']['rawAttributes']);_0x69a526[_0x830e('0x2f')]=_[_0x830e('0x30')](_0xbc6581[_0x830e('0x2f')]);_0x69a526['filters']=_['intersection'](_0x69a526[_0x830e('0x33')],_0x69a526[_0x830e('0x2f')]);_0x8f96f3['attributes']=_[_0x830e('0x32')](_0x69a526[_0x830e('0x33')],qs[_0x830e('0x35')](_0xbc6581['query'][_0x830e('0x35')]));_0x8f96f3['attributes']=_0x8f96f3[_0x830e('0x34')]['length']?_0x8f96f3['attributes']:_0x69a526[_0x830e('0x33')];_0x8f96f3[_0x830e('0x4c')]=qs[_0x830e('0x39')](_0xbc6581['query'][_0x830e('0x39')]);_0x8f96f3[_0x830e('0x3a')]=qs[_0x830e('0x31')](_[_0x830e('0x3b')](_0xbc6581[_0x830e('0x2f')],_0x69a526[_0x830e('0x31')]));if(_0xbc6581[_0x830e('0x2f')][_0x830e('0x3c')]){_0x8f96f3[_0x830e('0x3a')]=_[_0x830e('0x3d')](_0x8f96f3[_0x830e('0x3a')],{'$or':_[_0x830e('0x2a')](_0x8f96f3[_0x830e('0x34')],function(_0x10dd21){var _0x418648={};_0x418648[_0x10dd21]={'$like':'%'+_0xbc6581[_0x830e('0x2f')][_0x830e('0x3c')]+'%'};return _0x418648;})});}_0x8f96f3=_[_0x830e('0x3d')]({},_0x8f96f3,_0xbc6581[_0x830e('0x3f')]);return _0x5a3818['getFields'](_0x8f96f3);}})['then'](function(_0x23c43d){if(_0x23c43d){_0x434464=_0x23c43d[_0x830e('0x36')];if(!_0xbc6581[_0x830e('0x2f')][_0x830e('0x37')](_0x830e('0x38'))){_0x8f96f3[_0x830e('0x1c')]=qs[_0x830e('0x1c')](_0xbc6581[_0x830e('0x2f')][_0x830e('0x1c')]);_0x8f96f3[_0x830e('0x1b')]=qs[_0x830e('0x1b')](_0xbc6581[_0x830e('0x2f')][_0x830e('0x1b')]);}return _0x5a3818[_0x830e('0x4d')](_0x8f96f3);}})[_0x830e('0x24')](function(_0x36fbc8){if(_0x36fbc8){return _0x36fbc8?{'count':_0x434464,'rows':_0x36fbc8}:null;}})[_0x830e('0x24')](respondWithResult(_0x3c6365,null))[_0x830e('0x44')](handleError(_0x3c6365,null));};exports[_0x830e('0x4e')]=function(_0xf3e832,_0x1cc8bb,_0x41c65b){var _0x5e42b6={};var _0x7712e0={};var _0x9a6f4a;var _0x41c180;return db['DeskConfiguration'][_0x830e('0x4b')]({'where':{'id':_0xf3e832[_0x830e('0x46')]['id']}})[_0x830e('0x24')](handleEntityNotFound(_0x1cc8bb,null))[_0x830e('0x24')](function(_0x2404f0){if(_0x2404f0){_0x9a6f4a=_0x2404f0;_0x7712e0[_0x830e('0x33')]=_[_0x830e('0x30')](db['DeskField']['rawAttributes']);_0x7712e0[_0x830e('0x2f')]=_[_0x830e('0x30')](_0xf3e832[_0x830e('0x2f')]);_0x7712e0[_0x830e('0x31')]=_[_0x830e('0x32')](_0x7712e0[_0x830e('0x33')],_0x7712e0[_0x830e('0x2f')]);_0x5e42b6[_0x830e('0x34')]=_[_0x830e('0x32')](_0x7712e0[_0x830e('0x33')],qs[_0x830e('0x35')](_0xf3e832[_0x830e('0x2f')][_0x830e('0x35')]));_0x5e42b6[_0x830e('0x34')]=_0x5e42b6[_0x830e('0x34')][_0x830e('0x36')]?_0x5e42b6[_0x830e('0x34')]:_0x7712e0[_0x830e('0x33')];_0x5e42b6[_0x830e('0x4c')]=qs['sort'](_0xf3e832[_0x830e('0x2f')][_0x830e('0x39')]);_0x5e42b6[_0x830e('0x3a')]=qs[_0x830e('0x31')](_[_0x830e('0x3b')](_0xf3e832[_0x830e('0x2f')],_0x7712e0[_0x830e('0x31')]));if(_0xf3e832['query']['filter']){_0x5e42b6[_0x830e('0x3a')]=_[_0x830e('0x3d')](_0x5e42b6[_0x830e('0x3a')],{'$or':_[_0x830e('0x2a')](_0x5e42b6[_0x830e('0x34')],function(_0x412258){var _0x9c25ff={};_0x9c25ff[_0x412258]={'$like':'%'+_0xf3e832[_0x830e('0x2f')][_0x830e('0x3c')]+'%'};return _0x9c25ff;})});}_0x5e42b6=_['merge']({},_0x5e42b6,_0xf3e832['options']);return _0x9a6f4a[_0x830e('0x4e')](_0x5e42b6);}})[_0x830e('0x24')](function(_0xf0f7c5){if(_0xf0f7c5){_0x41c180=_0xf0f7c5[_0x830e('0x36')];if(!_0xf3e832[_0x830e('0x2f')][_0x830e('0x37')](_0x830e('0x38'))){_0x5e42b6['limit']=qs[_0x830e('0x1c')](_0xf3e832['query'][_0x830e('0x1c')]);_0x5e42b6[_0x830e('0x1b')]=qs[_0x830e('0x1b')](_0xf3e832[_0x830e('0x2f')][_0x830e('0x1b')]);}return _0x9a6f4a[_0x830e('0x4e')](_0x5e42b6);}})[_0x830e('0x24')](function(_0x4d85c5){if(_0x4d85c5){return _0x4d85c5?{'count':_0x41c180,'rows':_0x4d85c5}:null;}})[_0x830e('0x24')](respondWithResult(_0x1cc8bb,null))[_0x830e('0x44')](handleError(_0x1cc8bb,null));};exports[_0x830e('0x4f')]=function(_0x23bac3,_0x7fb8a,_0x2cc7bb){var _0x11fae4={};var _0x105754={};var _0x18eeef;var _0xd061d0;return db[_0x830e('0x2b')]['findOne']({'where':{'id':_0x23bac3['params']['id']}})[_0x830e('0x24')](handleEntityNotFound(_0x7fb8a,null))[_0x830e('0x24')](function(_0x290af2){if(_0x290af2){_0x18eeef=_0x290af2;_0x105754[_0x830e('0x33')]=_['keys'](db[_0x830e('0x50')][_0x830e('0x47')]);_0x105754[_0x830e('0x2f')]=_[_0x830e('0x30')](_0x23bac3['query']);_0x105754['filters']=_[_0x830e('0x32')](_0x105754[_0x830e('0x33')],_0x105754[_0x830e('0x2f')]);_0x11fae4['attributes']=_[_0x830e('0x32')](_0x105754['model'],qs[_0x830e('0x35')](_0x23bac3[_0x830e('0x2f')]['fields']));_0x11fae4[_0x830e('0x34')]=_0x11fae4['attributes'][_0x830e('0x36')]?_0x11fae4['attributes']:_0x105754[_0x830e('0x33')];_0x11fae4[_0x830e('0x4c')]=qs[_0x830e('0x39')](_0x23bac3[_0x830e('0x2f')][_0x830e('0x39')]);_0x11fae4[_0x830e('0x3a')]=qs[_0x830e('0x31')](_[_0x830e('0x3b')](_0x23bac3['query'],_0x105754[_0x830e('0x31')]));if(_0x23bac3[_0x830e('0x2f')][_0x830e('0x3c')]){_0x11fae4[_0x830e('0x3a')]=_['merge'](_0x11fae4[_0x830e('0x3a')],{'$or':_[_0x830e('0x2a')](_0x11fae4[_0x830e('0x34')],function(_0x3b0715){var _0x4de1b2={};_0x4de1b2[_0x3b0715]={'$like':'%'+_0x23bac3['query'][_0x830e('0x3c')]+'%'};return _0x4de1b2;})});}_0x11fae4=_[_0x830e('0x3d')]({},_0x11fae4,_0x23bac3[_0x830e('0x3f')]);return _0x18eeef[_0x830e('0x4f')](_0x11fae4);}})[_0x830e('0x24')](function(_0x1dc55d){if(_0x1dc55d){_0xd061d0=_0x1dc55d[_0x830e('0x36')];if(!_0x23bac3[_0x830e('0x2f')][_0x830e('0x37')](_0x830e('0x38'))){_0x11fae4[_0x830e('0x1c')]=qs[_0x830e('0x1c')](_0x23bac3[_0x830e('0x2f')][_0x830e('0x1c')]);_0x11fae4[_0x830e('0x1b')]=qs[_0x830e('0x1b')](_0x23bac3[_0x830e('0x2f')][_0x830e('0x1b')]);}return _0x18eeef[_0x830e('0x4f')](_0x11fae4);}})[_0x830e('0x24')](function(_0x3c9dad){if(_0x3c9dad){return _0x3c9dad?{'count':_0xd061d0,'rows':_0x3c9dad}:null;}})[_0x830e('0x24')](respondWithResult(_0x7fb8a,null))[_0x830e('0x44')](handleError(_0x7fb8a,null));};exports[_0x830e('0x51')]=function(_0x5d06c1,_0x12687c,_0xc29a0){var _0x27070b={};var _0xc32b09={};var _0x3469bf;var _0x3f9680;return db[_0x830e('0x2b')]['findOne']({'where':{'id':_0x5d06c1['params']['id']}})[_0x830e('0x24')](handleEntityNotFound(_0x12687c,null))[_0x830e('0x24')](function(_0x4e995d){if(_0x4e995d){_0x3469bf=_0x4e995d;_0xc32b09[_0x830e('0x33')]=_[_0x830e('0x30')](db[_0x830e('0x52')][_0x830e('0x47')]);_0xc32b09[_0x830e('0x2f')]=_[_0x830e('0x30')](_0x5d06c1['query']);_0xc32b09[_0x830e('0x31')]=_[_0x830e('0x32')](_0xc32b09[_0x830e('0x33')],_0xc32b09[_0x830e('0x2f')]);_0x27070b[_0x830e('0x34')]=_['intersection'](_0xc32b09[_0x830e('0x33')],qs['fields'](_0x5d06c1[_0x830e('0x2f')][_0x830e('0x35')]));_0x27070b['attributes']=_0x27070b[_0x830e('0x34')][_0x830e('0x36')]?_0x27070b['attributes']:_0xc32b09[_0x830e('0x33')];_0x27070b['order']=qs[_0x830e('0x39')](_0x5d06c1[_0x830e('0x2f')]['sort']);_0x27070b[_0x830e('0x3a')]=qs[_0x830e('0x31')](_['pick'](_0x5d06c1[_0x830e('0x2f')],_0xc32b09[_0x830e('0x31')]));if(_0x5d06c1[_0x830e('0x2f')][_0x830e('0x3c')]){_0x27070b[_0x830e('0x3a')]=_['merge'](_0x27070b[_0x830e('0x3a')],{'$or':_[_0x830e('0x2a')](_0x27070b['attributes'],function(_0x3f04f2){var _0x1164fb={};_0x1164fb[_0x3f04f2]={'$like':'%'+_0x5d06c1['query'][_0x830e('0x3c')]+'%'};return _0x1164fb;})});}_0x27070b=_[_0x830e('0x3d')]({},_0x27070b,_0x5d06c1[_0x830e('0x3f')]);return _0x3469bf['getTags'](_0x27070b);}})['then'](function(_0xa82991){if(_0xa82991){_0x3f9680=_0xa82991[_0x830e('0x36')];if(!_0x5d06c1['query'][_0x830e('0x37')](_0x830e('0x38'))){_0x27070b[_0x830e('0x1c')]=qs[_0x830e('0x1c')](_0x5d06c1[_0x830e('0x2f')][_0x830e('0x1c')]);_0x27070b[_0x830e('0x1b')]=qs[_0x830e('0x1b')](_0x5d06c1['query'][_0x830e('0x1b')]);}return _0x3469bf[_0x830e('0x51')](_0x27070b);}})[_0x830e('0x24')](function(_0x1e032e){if(_0x1e032e){return _0x1e032e?{'count':_0x3f9680,'rows':_0x1e032e}:null;}})[_0x830e('0x24')](respondWithResult(_0x12687c,null))[_0x830e('0x44')](handleError(_0x12687c,null));};exports[_0x830e('0x53')]=function(_0x1953d0,_0x4b7ec3,_0x493e69){if(_0x1953d0[_0x830e('0x49')]['id']){delete _0x1953d0['body']['id'];}return db[_0x830e('0x2b')][_0x830e('0x4b')]({'where':{'id':_0x1953d0[_0x830e('0x46')]['id']}})['then'](handleEntityNotFound(_0x4b7ec3,null))[_0x830e('0x24')](function(_0x4137f3){if(_0x4137f3){return _0x4137f3[_0x830e('0x53')](_0x1953d0['body']['ids']||[]);}return null;})[_0x830e('0x24')](respondWithResult(_0x4b7ec3,null))['catch'](handleError(_0x4b7ec3,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 92ee7e7..7e0573f 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 _0x3695=['DeskConfiguration','int_desk_configurations','lodash','../../config/logger','path','../../config/environment','./intDeskConfiguration.attributes','exports','define'];(function(_0x489cf7,_0x33e79f){var _0x21db4f=function(_0xfa0ebf){while(--_0xfa0ebf){_0x489cf7['push'](_0x489cf7['shift']());}};_0x21db4f(++_0x33e79f);}(_0x3695,0x1df));var _0x5369=function(_0x32ccd9,_0xaa559a){_0x32ccd9=_0x32ccd9-0x0;var _0x55988b=_0x3695[_0x32ccd9];return _0x55988b;};'use strict';var _=require(_0x5369('0x0'));var util=require('util');var logger=require(_0x5369('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5369('0x2'));var rimraf=require('rimraf');var config=require(_0x5369('0x3'));var attributes=require(_0x5369('0x4'));module[_0x5369('0x5')]=function(_0xa78a07,_0x424455){return _0xa78a07[_0x5369('0x6')](_0x5369('0x7'),attributes,{'tableName':_0x5369('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x368f=['bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x570c02,_0x265490){var _0x55e694=function(_0x5bfc0f){while(--_0x5bfc0f){_0x570c02['push'](_0x570c02['shift']());}};_0x55e694(++_0x265490);}(_0x368f,0xbe));var _0xf368=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x368f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf368('0x0'));var util=require(_0xf368('0x1'));var logger=require(_0xf368('0x2'))(_0xf368('0x3'));var moment=require(_0xf368('0x4'));var BPromise=require(_0xf368('0x5'));var rp=require(_0xf368('0x6'));var fs=require('fs');var path=require(_0xf368('0x7'));var rimraf=require(_0xf368('0x8'));var config=require(_0xf368('0x9'));var attributes=require(_0xf368('0xa'));module[_0xf368('0xb')]=function(_0x1ec9ba,_0xb573e6){return _0x1ec9ba[_0xf368('0xc')](_0xf368('0xd'),attributes,{'tableName':_0xf368('0xe'),'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 665b769..934cbf2 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 _0xc2a2=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x493a67,_0x5ebe9f){var _0x551c35=function(_0x17ea74){while(--_0x17ea74){_0x493a67['push'](_0x493a67['shift']());}};_0x551c35(++_0x5ebe9f);}(_0xc2a2,0x84));var _0x2c2a=function(_0x55a808,_0x55c07f){_0x55a808=_0x55a808-0x0;var _0xe2596f=_0xc2a2[_0x55a808];return _0xe2596f;};'use strict';var _=require(_0x2c2a('0x0'));var util=require(_0x2c2a('0x1'));var moment=require(_0x2c2a('0x2'));var BPromise=require(_0x2c2a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2c2a('0x4'));var db=require(_0x2c2a('0x5'))['db'];var utils=require(_0x2c2a('0x6'));var logger=require('../../config/logger')(_0x2c2a('0x7'));var config=require(_0x2c2a('0x8'));var jayson=require(_0x2c2a('0x9'));var client=jayson[_0x2c2a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52f476,_0x53b0c0,_0x578a80){return new BPromise(function(_0x48a901,_0x5cc8c5){return client['request'](_0x52f476,_0x578a80)[_0x2c2a('0xb')](function(_0x48ba78){logger[_0x2c2a('0xc')](_0x2c2a('0xd'),_0x53b0c0,_0x2c2a('0xe'));logger[_0x2c2a('0xf')](_0x2c2a('0x10'),_0x53b0c0,_0x2c2a('0xe'),JSON['stringify'](_0x48ba78));if(_0x48ba78['error']){if(_0x48ba78[_0x2c2a('0x11')][_0x2c2a('0x12')]===0x1f4){logger[_0x2c2a('0x11')](_0x2c2a('0xd'),_0x53b0c0,_0x48ba78[_0x2c2a('0x11')][_0x2c2a('0x13')]);return _0x5cc8c5(_0x48ba78['error'][_0x2c2a('0x13')]);}logger[_0x2c2a('0x11')]('DeskConfiguration,\x20%s,\x20%s',_0x53b0c0,_0x48ba78[_0x2c2a('0x11')]['message']);return _0x48a901(_0x48ba78[_0x2c2a('0x11')]['message']);}else{logger[_0x2c2a('0xc')](_0x2c2a('0xd'),_0x53b0c0,'request\x20sent');_0x48a901(_0x48ba78[_0x2c2a('0x14')][_0x2c2a('0x13')]);}})[_0x2c2a('0x15')](function(_0x7af854){logger[_0x2c2a('0x11')](_0x2c2a('0xd'),_0x53b0c0,_0x7af854);_0x5cc8c5(_0x7af854);});});} \ No newline at end of file +var _0x9af6=['DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','ioredis','../../config/logger','rpc','../../config/environment','client','request','then','request\x20sent','debug'];(function(_0x571c20,_0x366124){var _0x25fbad=function(_0x14c4e2){while(--_0x14c4e2){_0x571c20['push'](_0x571c20['shift']());}};_0x25fbad(++_0x366124);}(_0x9af6,0x1d7));var _0x69af=function(_0x4f3418,_0x1ce518){_0x4f3418=_0x4f3418-0x0;var _0x272d05=_0x9af6[_0x4f3418];return _0x272d05;};'use strict';var _=require(_0x69af('0x0'));var util=require(_0x69af('0x1'));var moment=require(_0x69af('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x69af('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x69af('0x4'))(_0x69af('0x5'));var config=require(_0x69af('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x69af('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1073cb,_0x1786dc,_0x408d57){return new BPromise(function(_0x17353a,_0x26ecde){return client[_0x69af('0x8')](_0x1073cb,_0x408d57)[_0x69af('0x9')](function(_0x37ee87){logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x1786dc,_0x69af('0xa'));logger[_0x69af('0xb')](_0x69af('0xc'),_0x1786dc,_0x69af('0xa'),JSON[_0x69af('0xd')](_0x37ee87));if(_0x37ee87[_0x69af('0xe')]){if(_0x37ee87[_0x69af('0xe')][_0x69af('0xf')]===0x1f4){logger['error'](_0x69af('0x10'),_0x1786dc,_0x37ee87[_0x69af('0xe')][_0x69af('0x11')]);return _0x26ecde(_0x37ee87[_0x69af('0xe')]['message']);}logger[_0x69af('0xe')](_0x69af('0x10'),_0x1786dc,_0x37ee87[_0x69af('0xe')][_0x69af('0x11')]);return _0x17353a(_0x37ee87[_0x69af('0xe')][_0x69af('0x11')]);}else{logger[_0x69af('0x12')](_0x69af('0x10'),_0x1786dc,'request\x20sent');_0x17353a(_0x37ee87[_0x69af('0x13')][_0x69af('0x11')]);}})[_0x69af('0x14')](function(_0x2ce24c){logger[_0x69af('0xe')](_0x69af('0x10'),_0x1786dc,_0x2ce24c);_0x26ecde(_0x2ce24c);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 6f0eabd..14a73df 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 _0x03fa=['isAuthenticated','index','get','/:id','show','post','create','put','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x41de8a,_0x2bb007){var _0x3fb674=function(_0x196236){while(--_0x196236){_0x41de8a['push'](_0x41de8a['shift']());}};_0x3fb674(++_0x2bb007);}(_0x03fa,0x117));var _0xa03f=function(_0x2d47c8,_0x3eac73){_0x2d47c8=_0x2d47c8-0x0;var _0x108ac8=_0x03fa[_0x2d47c8];return _0x108ac8;};'use strict';var multer=require(_0xa03f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa03f('0x1'));var express=require(_0xa03f('0x2'));var router=express[_0xa03f('0x3')]();var fs_extra=require(_0xa03f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa03f('0x5'));var config=require('../../config/environment');var controller=require('./intDeskField.controller');router['get']('/',auth[_0xa03f('0x6')](),controller[_0xa03f('0x7')]);router[_0xa03f('0x8')](_0xa03f('0x9'),auth['isAuthenticated'](),controller[_0xa03f('0xa')]);router[_0xa03f('0xb')]('/',auth[_0xa03f('0x6')](),controller[_0xa03f('0xc')]);router[_0xa03f('0xd')](_0xa03f('0x9'),auth[_0xa03f('0x6')](),controller['update']);router['delete'](_0xa03f('0x9'),auth['isAuthenticated'](),controller[_0xa03f('0xe')]);module['exports']=router; \ No newline at end of file +var _0xac9a=['destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','/:id','post','create','put'];(function(_0x522c5c,_0x4983dc){var _0x247016=function(_0x23fa00){while(--_0x23fa00){_0x522c5c['push'](_0x522c5c['shift']());}};_0x247016(++_0x4983dc);}(_0xac9a,0x131));var _0xaac9=function(_0x5b957c,_0x839f22){_0x5b957c=_0x5b957c-0x0;var _0xb0a9e3=_0xac9a[_0x5b957c];return _0xb0a9e3;};'use strict';var multer=require(_0xaac9('0x0'));var util=require(_0xaac9('0x1'));var path=require(_0xaac9('0x2'));var timeout=require(_0xaac9('0x3'));var express=require('express');var router=express[_0xaac9('0x4')]();var fs_extra=require(_0xaac9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xaac9('0x6'));var config=require(_0xaac9('0x7'));var controller=require(_0xaac9('0x8'));router[_0xaac9('0x9')]('/',auth[_0xaac9('0xa')](),controller['index']);router[_0xaac9('0x9')](_0xaac9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xaac9('0xc')]('/',auth[_0xaac9('0xa')](),controller[_0xaac9('0xd')]);router[_0xaac9('0xe')](_0xaac9('0xb'),auth[_0xaac9('0xa')](),controller['update']);router['delete']('/:id',auth[_0xaac9('0xa')](),controller[_0xaac9('0xf')]);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 4c63306..a093616 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 _0x7dbb=['string','variable','customVariable','keyValue','picklist','STRING','exports','ENUM'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x7dbb,0x96));var _0xb7db=function(_0x133cbc,_0x2dee20){_0x133cbc=_0x133cbc-0x0;var _0x25930d=_0x7dbb[_0x133cbc];return _0x25930d;};'use strict';var Sequelize=require('sequelize');module[_0xb7db('0x0')]={'type':{'type':Sequelize[_0xb7db('0x1')](_0xb7db('0x2'),_0xb7db('0x3'),_0xb7db('0x4'),_0xb7db('0x5'),_0xb7db('0x6')),'defaultValue':_0xb7db('0x2')},'content':{'type':Sequelize[_0xb7db('0x7')]},'key':{'type':Sequelize[_0xb7db('0x7')]},'keyType':{'type':Sequelize['ENUM']('string',_0xb7db('0x3'),_0xb7db('0x4'))},'keyContent':{'type':Sequelize[_0xb7db('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xb7db('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb7db('0x7')]}}; \ No newline at end of file +var _0xc53e=['picklist','string','STRING','BOOLEAN','sequelize','ENUM','variable','customVariable'];(function(_0x3e572e,_0x1ed6bf){var _0x2c69e7=function(_0x29edd0){while(--_0x29edd0){_0x3e572e['push'](_0x3e572e['shift']());}};_0x2c69e7(++_0x1ed6bf);}(_0xc53e,0x1d4));var _0xec53=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xc53e[_0x491a7f];return _0x3d8f44;};'use strict';var Sequelize=require(_0xec53('0x0'));module['exports']={'type':{'type':Sequelize[_0xec53('0x1')]('string',_0xec53('0x2'),_0xec53('0x3'),'keyValue',_0xec53('0x4')),'defaultValue':_0xec53('0x5')},'content':{'type':Sequelize[_0xec53('0x6')]},'key':{'type':Sequelize[_0xec53('0x6')]},'keyType':{'type':Sequelize['ENUM']('string','variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xec53('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xec53('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 63871cc..08d0fb1 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 _0x7e4b=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','then','destroy','error','name','index','map','DeskField','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','include','find','catch','create','body','update','params','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis'];(function(_0x3d5127,_0x5e1f01){var _0x1785fe=function(_0x13976a){while(--_0x13976a){_0x3d5127['push'](_0x3d5127['shift']());}};_0x1785fe(++_0x5e1f01);}(_0x7e4b,0x84));var _0xb7e4=function(_0xe6f6f2,_0x19f888){_0xe6f6f2=_0xe6f6f2-0x0;var _0x205c4=_0x7e4b[_0xe6f6f2];return _0x205c4;};'use strict';var emlformat=require(_0xb7e4('0x0'));var rimraf=require(_0xb7e4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb7e4('0x2'));var rp=require(_0xb7e4('0x3'));var moment=require('moment');var BPromise=require(_0xb7e4('0x4'));var Mustache=require(_0xb7e4('0x5'));var util=require(_0xb7e4('0x6'));var path=require(_0xb7e4('0x7'));var sox=require(_0xb7e4('0x8'));var csv=require(_0xb7e4('0x9'));var ejs=require(_0xb7e4('0xa'));var fs=require('fs');var fs_extra=require(_0xb7e4('0xb'));var _=require(_0xb7e4('0xc'));var squel=require('squel');var crypto=require(_0xb7e4('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb7e4('0xe'));var toCsv=require(_0xb7e4('0x9'));var querystring=require(_0xb7e4('0xf'));var Papa=require(_0xb7e4('0x10'));var Redis=require(_0xb7e4('0x11'));var authService=require(_0xb7e4('0x12'));var qs=require(_0xb7e4('0x13'));var as=require(_0xb7e4('0x14'));var hardwareService=require(_0xb7e4('0x15'));var logger=require(_0xb7e4('0x16'))(_0xb7e4('0x17'));var utils=require(_0xb7e4('0x18'));var config=require(_0xb7e4('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb7fe30,_0x1b80aa){_0x1b80aa=_0x1b80aa||0xcc;return function(_0x526944){if(_0x526944){return _0xb7fe30[_0xb7e4('0x1a')](_0x1b80aa);}return _0xb7fe30[_0xb7e4('0x1b')](_0x1b80aa)[_0xb7e4('0x1c')]();};}function respondWithResult(_0xc2be7d,_0x2acf77){_0x2acf77=_0x2acf77||0xc8;return function(_0x1b9a09){if(_0x1b9a09){return _0xc2be7d[_0xb7e4('0x1b')](_0x2acf77)[_0xb7e4('0x1d')](_0x1b9a09);}};}function respondWithFilteredResult(_0x18938c,_0x3600be){return function(_0x15653d){if(_0x15653d){var _0x983d60=typeof _0x3600be[_0xb7e4('0x1e')]===_0xb7e4('0x1f')&&typeof _0x3600be['limit']===_0xb7e4('0x1f');var _0x170e17=_0x15653d[_0xb7e4('0x20')];var _0x258ba9=_0x983d60?0x0:_0x3600be[_0xb7e4('0x1e')];var _0x88906e=_0x983d60?_0x15653d[_0xb7e4('0x20')]:_0x3600be[_0xb7e4('0x1e')]+_0x3600be[_0xb7e4('0x21')];var _0x393ffe;if(_0x88906e>=_0x170e17){_0x88906e=_0x170e17;_0x393ffe=0xc8;}else{_0x393ffe=0xce;}_0x18938c['status'](_0x393ffe);return _0x18938c[_0xb7e4('0x22')](_0xb7e4('0x23'),_0x258ba9+'-'+_0x88906e+'/'+_0x170e17)[_0xb7e4('0x1d')](_0x15653d);}return null;};}function patchUpdates(_0x59044f){return function(_0x37c71a){try{jsonpatch['apply'](_0x37c71a,_0x59044f,!![]);}catch(_0x29808b){return BPromise[_0xb7e4('0x24')](_0x29808b);}return _0x37c71a[_0xb7e4('0x25')]();};}function saveUpdates(_0x391114,_0x18e4fb){return function(_0xba07f){if(_0xba07f){return _0xba07f['update'](_0x391114)[_0xb7e4('0x26')](function(_0x1f135e){return _0x1f135e;});}return null;};}function removeEntity(_0x1c4dc4,_0x2eec58){return function(_0x56e2e6){if(_0x56e2e6){return _0x56e2e6[_0xb7e4('0x27')]()[_0xb7e4('0x26')](function(){_0x1c4dc4['status'](0xcc)[_0xb7e4('0x1c')]();});}};}function handleEntityNotFound(_0xedb514,_0x40e99b){return function(_0x557e4c){if(!_0x557e4c){_0xedb514[_0xb7e4('0x1a')](0x194);}return _0x557e4c;};}function handleError(_0x457d9e,_0x4cff42){_0x4cff42=_0x4cff42||0x1f4;return function(_0x29715c){logger[_0xb7e4('0x28')](_0x29715c['stack']);if(_0x29715c[_0xb7e4('0x29')]){delete _0x29715c[_0xb7e4('0x29')];}_0x457d9e[_0xb7e4('0x1b')](_0x4cff42)['send'](_0x29715c);};}exports[_0xb7e4('0x2a')]=function(_0x1e2b8f,_0x248cc0){var _0x4e6a2b={},_0x41011d={},_0xef3cbc={'count':0x0,'rows':[]};var _0x2cd691=_[_0xb7e4('0x2b')](db[_0xb7e4('0x2c')][_0xb7e4('0x2d')],function(_0x33a0bb){return{'name':_0x33a0bb[_0xb7e4('0x2e')],'type':_0x33a0bb[_0xb7e4('0x2f')]['key']};});_0x41011d[_0xb7e4('0x30')]=_[_0xb7e4('0x2b')](_0x2cd691,_0xb7e4('0x29'));_0x41011d[_0xb7e4('0x31')]=_['keys'](_0x1e2b8f[_0xb7e4('0x31')]);_0x41011d[_0xb7e4('0x32')]=_[_0xb7e4('0x33')](_0x41011d[_0xb7e4('0x30')],_0x41011d[_0xb7e4('0x31')]);_0x4e6a2b['attributes']=_[_0xb7e4('0x33')](_0x41011d['model'],qs[_0xb7e4('0x34')](_0x1e2b8f[_0xb7e4('0x31')][_0xb7e4('0x34')]));_0x4e6a2b[_0xb7e4('0x35')]=_0x4e6a2b[_0xb7e4('0x35')][_0xb7e4('0x36')]?_0x4e6a2b[_0xb7e4('0x35')]:_0x41011d[_0xb7e4('0x30')];if(!_0x1e2b8f[_0xb7e4('0x31')]['hasOwnProperty'](_0xb7e4('0x37'))){_0x4e6a2b[_0xb7e4('0x21')]=qs[_0xb7e4('0x21')](_0x1e2b8f[_0xb7e4('0x31')][_0xb7e4('0x21')]);_0x4e6a2b['offset']=qs[_0xb7e4('0x1e')](_0x1e2b8f[_0xb7e4('0x31')]['offset']);}_0x4e6a2b[_0xb7e4('0x38')]=qs['sort'](_0x1e2b8f['query'][_0xb7e4('0x39')]);_0x4e6a2b[_0xb7e4('0x3a')]=qs['filters'](_[_0xb7e4('0x3b')](_0x1e2b8f[_0xb7e4('0x31')],_0x41011d[_0xb7e4('0x32')]),_0x2cd691);if(_0x1e2b8f[_0xb7e4('0x31')][_0xb7e4('0x3c')]){_0x4e6a2b[_0xb7e4('0x3a')]=_[_0xb7e4('0x3d')](_0x4e6a2b[_0xb7e4('0x3a')],{'$or':_['map'](_0x2cd691,function(_0x588fba){if(_0x588fba[_0xb7e4('0x2f')]!==_0xb7e4('0x3e')){var _0x2b2514={};_0x2b2514[_0x588fba['name']]={'$like':'%'+_0x1e2b8f[_0xb7e4('0x31')][_0xb7e4('0x3c')]+'%'};return _0x2b2514;}})});}_0x4e6a2b=_['merge']({},_0x4e6a2b,_0x1e2b8f[_0xb7e4('0x3f')]);var _0x5efa7e={'where':_0x4e6a2b[_0xb7e4('0x3a')]};return db['DeskField'][_0xb7e4('0x20')](_0x5efa7e)[_0xb7e4('0x26')](function(_0x3ab782){_0xef3cbc[_0xb7e4('0x20')]=_0x3ab782;if(_0x1e2b8f['query'][_0xb7e4('0x40')]){_0x4e6a2b['include']=[{'all':!![]}];}return db[_0xb7e4('0x2c')][_0xb7e4('0x41')](_0x4e6a2b);})['then'](function(_0x27115e){_0xef3cbc[_0xb7e4('0x42')]=_0x27115e;return _0xef3cbc;})[_0xb7e4('0x26')](respondWithFilteredResult(_0x248cc0,_0x4e6a2b))['catch'](handleError(_0x248cc0,null));};exports[_0xb7e4('0x43')]=function(_0x4104ca,_0x486ade){var _0x1ebc1c={'raw':!![],'where':{'id':_0x4104ca['params']['id']}},_0x6d5f44={};_0x6d5f44[_0xb7e4('0x30')]=_['keys'](db['DeskField'][_0xb7e4('0x2d')]);_0x6d5f44[_0xb7e4('0x31')]=_['keys'](_0x4104ca[_0xb7e4('0x31')]);_0x6d5f44[_0xb7e4('0x32')]=_[_0xb7e4('0x33')](_0x6d5f44[_0xb7e4('0x30')],_0x6d5f44[_0xb7e4('0x31')]);_0x1ebc1c[_0xb7e4('0x35')]=_[_0xb7e4('0x33')](_0x6d5f44['model'],qs[_0xb7e4('0x34')](_0x4104ca[_0xb7e4('0x31')][_0xb7e4('0x34')]));_0x1ebc1c[_0xb7e4('0x35')]=_0x1ebc1c['attributes'][_0xb7e4('0x36')]?_0x1ebc1c[_0xb7e4('0x35')]:_0x6d5f44[_0xb7e4('0x30')];if(_0x4104ca[_0xb7e4('0x31')][_0xb7e4('0x40')]){_0x1ebc1c[_0xb7e4('0x44')]=[{'all':!![]}];}_0x1ebc1c=_[_0xb7e4('0x3d')]({},_0x1ebc1c,_0x4104ca[_0xb7e4('0x3f')]);return db[_0xb7e4('0x2c')][_0xb7e4('0x45')](_0x1ebc1c)[_0xb7e4('0x26')](handleEntityNotFound(_0x486ade,null))[_0xb7e4('0x26')](respondWithResult(_0x486ade,null))[_0xb7e4('0x46')](handleError(_0x486ade,null));};exports[_0xb7e4('0x47')]=function(_0x397ae3,_0x549ea1){return db[_0xb7e4('0x2c')][_0xb7e4('0x47')](_0x397ae3[_0xb7e4('0x48')],{})[_0xb7e4('0x26')](respondWithResult(_0x549ea1,0xc9))[_0xb7e4('0x46')](handleError(_0x549ea1,null));};exports[_0xb7e4('0x49')]=function(_0x962201,_0x5c71bc){if(_0x962201[_0xb7e4('0x48')]['id']){delete _0x962201['body']['id'];}return db[_0xb7e4('0x2c')][_0xb7e4('0x45')]({'where':{'id':_0x962201[_0xb7e4('0x4a')]['id']}})[_0xb7e4('0x26')](handleEntityNotFound(_0x5c71bc,null))['then'](saveUpdates(_0x962201[_0xb7e4('0x48')],null))[_0xb7e4('0x26')](respondWithResult(_0x5c71bc,null))[_0xb7e4('0x46')](handleError(_0x5c71bc,null));};exports[_0xb7e4('0x27')]=function(_0x35b549,_0x2967b4){return db['DeskField'][_0xb7e4('0x45')]({'where':{'id':_0x35b549[_0xb7e4('0x4a')]['id']}})[_0xb7e4('0x26')](handleEntityNotFound(_0x2967b4,null))[_0xb7e4('0x26')](removeEntity(_0x2967b4,null))[_0xb7e4('0x46')](handleError(_0x2967b4,null));}; \ No newline at end of file +var _0x870d=['merge','type','VIRTUAL','DeskField','includeAll','findAll','rows','catch','show','keys','intersection','include','find','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','end','stack','name','index','rawAttributes','map','query','filters','model','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0x870d,0xde));var _0xd870=function(_0x55f375,_0x4c3f8e){_0x55f375=_0x55f375-0x0;var _0x124717=_0x870d[_0x55f375];return _0x124717;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd870('0x0'));var zipdir=require(_0xd870('0x1'));var jsonpatch=require(_0xd870('0x2'));var rp=require(_0xd870('0x3'));var moment=require(_0xd870('0x4'));var BPromise=require(_0xd870('0x5'));var Mustache=require('mustache');var util=require(_0xd870('0x6'));var path=require(_0xd870('0x7'));var sox=require(_0xd870('0x8'));var csv=require(_0xd870('0x9'));var ejs=require(_0xd870('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd870('0xb'));var squel=require(_0xd870('0xc'));var crypto=require(_0xd870('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd870('0x9'));var querystring=require(_0xd870('0xe'));var Papa=require(_0xd870('0xf'));var Redis=require(_0xd870('0x10'));var authService=require(_0xd870('0x11'));var qs=require(_0xd870('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd870('0x13'))(_0xd870('0x14'));var utils=require(_0xd870('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xd870('0x16'));var db=require(_0xd870('0x17'))['db'];function respondWithStatusCode(_0x51137f,_0xd66446){_0xd66446=_0xd66446||0xcc;return function(_0x434193){if(_0x434193){return _0x51137f['sendStatus'](_0xd66446);}return _0x51137f[_0xd870('0x18')](_0xd66446)['end']();};}function respondWithResult(_0x34e325,_0x161fde){_0x161fde=_0x161fde||0xc8;return function(_0x424f06){if(_0x424f06){return _0x34e325[_0xd870('0x18')](_0x161fde)['json'](_0x424f06);}};}function respondWithFilteredResult(_0x1929ef,_0xb2308b){return function(_0x57708e){if(_0x57708e){var _0x14e306=typeof _0xb2308b[_0xd870('0x19')]===_0xd870('0x1a')&&typeof _0xb2308b['limit']===_0xd870('0x1a');var _0xc1f658=_0x57708e['count'];var _0x2b7286=_0x14e306?0x0:_0xb2308b[_0xd870('0x19')];var _0x4ed8da=_0x14e306?_0x57708e[_0xd870('0x1b')]:_0xb2308b[_0xd870('0x19')]+_0xb2308b['limit'];var _0x2e33a2;if(_0x4ed8da>=_0xc1f658){_0x4ed8da=_0xc1f658;_0x2e33a2=0xc8;}else{_0x2e33a2=0xce;}_0x1929ef[_0xd870('0x18')](_0x2e33a2);return _0x1929ef[_0xd870('0x1c')](_0xd870('0x1d'),_0x2b7286+'-'+_0x4ed8da+'/'+_0xc1f658)['json'](_0x57708e);}return null;};}function patchUpdates(_0x53fade){return function(_0x3ea237){try{jsonpatch[_0xd870('0x1e')](_0x3ea237,_0x53fade,!![]);}catch(_0x4dd75e){return BPromise['reject'](_0x4dd75e);}return _0x3ea237[_0xd870('0x1f')]();};}function saveUpdates(_0x1300c,_0xc3e06b){return function(_0x247b90){if(_0x247b90){return _0x247b90[_0xd870('0x20')](_0x1300c)[_0xd870('0x21')](function(_0x134b84){return _0x134b84;});}return null;};}function removeEntity(_0x549b1e,_0x945d1){return function(_0x44787d){if(_0x44787d){return _0x44787d[_0xd870('0x22')]()[_0xd870('0x21')](function(){_0x549b1e[_0xd870('0x18')](0xcc)[_0xd870('0x23')]();});}};}function handleEntityNotFound(_0x3dbf19,_0xf22ff7){return function(_0x2fa5bd){if(!_0x2fa5bd){_0x3dbf19['sendStatus'](0x194);}return _0x2fa5bd;};}function handleError(_0x50d66f,_0x3fcb68){_0x3fcb68=_0x3fcb68||0x1f4;return function(_0x201c8f){logger['error'](_0x201c8f[_0xd870('0x24')]);if(_0x201c8f[_0xd870('0x25')]){delete _0x201c8f[_0xd870('0x25')];}_0x50d66f[_0xd870('0x18')](_0x3fcb68)['send'](_0x201c8f);};}exports[_0xd870('0x26')]=function(_0x401c9d,_0x5bfead){var _0x4413ad={},_0x5ed1d5={},_0x1efd8d={'count':0x0,'rows':[]};var _0x4ccbdb=_['map'](db['DeskField'][_0xd870('0x27')],function(_0x1061c5){return{'name':_0x1061c5['fieldName'],'type':_0x1061c5['type']['key']};});_0x5ed1d5['model']=_[_0xd870('0x28')](_0x4ccbdb,'name');_0x5ed1d5[_0xd870('0x29')]=_['keys'](_0x401c9d['query']);_0x5ed1d5[_0xd870('0x2a')]=_['intersection'](_0x5ed1d5[_0xd870('0x2b')],_0x5ed1d5[_0xd870('0x29')]);_0x4413ad[_0xd870('0x2c')]=_['intersection'](_0x5ed1d5[_0xd870('0x2b')],qs['fields'](_0x401c9d[_0xd870('0x29')][_0xd870('0x2d')]));_0x4413ad['attributes']=_0x4413ad[_0xd870('0x2c')][_0xd870('0x2e')]?_0x4413ad[_0xd870('0x2c')]:_0x5ed1d5[_0xd870('0x2b')];if(!_0x401c9d[_0xd870('0x29')]['hasOwnProperty'](_0xd870('0x2f'))){_0x4413ad['limit']=qs[_0xd870('0x30')](_0x401c9d[_0xd870('0x29')]['limit']);_0x4413ad[_0xd870('0x19')]=qs['offset'](_0x401c9d[_0xd870('0x29')][_0xd870('0x19')]);}_0x4413ad[_0xd870('0x31')]=qs[_0xd870('0x32')](_0x401c9d[_0xd870('0x29')][_0xd870('0x32')]);_0x4413ad[_0xd870('0x33')]=qs['filters'](_[_0xd870('0x34')](_0x401c9d[_0xd870('0x29')],_0x5ed1d5[_0xd870('0x2a')]),_0x4ccbdb);if(_0x401c9d['query'][_0xd870('0x35')]){_0x4413ad[_0xd870('0x33')]=_[_0xd870('0x36')](_0x4413ad[_0xd870('0x33')],{'$or':_['map'](_0x4ccbdb,function(_0x55daa8){if(_0x55daa8[_0xd870('0x37')]!==_0xd870('0x38')){var _0x171590={};_0x171590[_0x55daa8[_0xd870('0x25')]]={'$like':'%'+_0x401c9d[_0xd870('0x29')]['filter']+'%'};return _0x171590;}})});}_0x4413ad=_[_0xd870('0x36')]({},_0x4413ad,_0x401c9d['options']);var _0x326762={'where':_0x4413ad[_0xd870('0x33')]};return db[_0xd870('0x39')]['count'](_0x326762)['then'](function(_0x516332){_0x1efd8d[_0xd870('0x1b')]=_0x516332;if(_0x401c9d[_0xd870('0x29')][_0xd870('0x3a')]){_0x4413ad['include']=[{'all':!![]}];}return db[_0xd870('0x39')][_0xd870('0x3b')](_0x4413ad);})[_0xd870('0x21')](function(_0x5e04be){_0x1efd8d[_0xd870('0x3c')]=_0x5e04be;return _0x1efd8d;})['then'](respondWithFilteredResult(_0x5bfead,_0x4413ad))[_0xd870('0x3d')](handleError(_0x5bfead,null));};exports[_0xd870('0x3e')]=function(_0x389278,_0x53291d){var _0x3adbe4={'raw':!![],'where':{'id':_0x389278['params']['id']}},_0x5ead29={};_0x5ead29[_0xd870('0x2b')]=_[_0xd870('0x3f')](db[_0xd870('0x39')][_0xd870('0x27')]);_0x5ead29[_0xd870('0x29')]=_['keys'](_0x389278[_0xd870('0x29')]);_0x5ead29['filters']=_[_0xd870('0x40')](_0x5ead29[_0xd870('0x2b')],_0x5ead29[_0xd870('0x29')]);_0x3adbe4[_0xd870('0x2c')]=_[_0xd870('0x40')](_0x5ead29[_0xd870('0x2b')],qs[_0xd870('0x2d')](_0x389278[_0xd870('0x29')][_0xd870('0x2d')]));_0x3adbe4[_0xd870('0x2c')]=_0x3adbe4[_0xd870('0x2c')][_0xd870('0x2e')]?_0x3adbe4[_0xd870('0x2c')]:_0x5ead29[_0xd870('0x2b')];if(_0x389278[_0xd870('0x29')][_0xd870('0x3a')]){_0x3adbe4[_0xd870('0x41')]=[{'all':!![]}];}_0x3adbe4=_[_0xd870('0x36')]({},_0x3adbe4,_0x389278['options']);return db['DeskField'][_0xd870('0x42')](_0x3adbe4)[_0xd870('0x21')](handleEntityNotFound(_0x53291d,null))['then'](respondWithResult(_0x53291d,null))[_0xd870('0x3d')](handleError(_0x53291d,null));};exports['create']=function(_0x428c5f,_0x255ba5){return db['DeskField']['create'](_0x428c5f[_0xd870('0x43')],{})['then'](respondWithResult(_0x255ba5,0xc9))[_0xd870('0x3d')](handleError(_0x255ba5,null));};exports[_0xd870('0x20')]=function(_0x1c6635,_0x3459b1){if(_0x1c6635[_0xd870('0x43')]['id']){delete _0x1c6635[_0xd870('0x43')]['id'];}return db[_0xd870('0x39')]['find']({'where':{'id':_0x1c6635[_0xd870('0x44')]['id']}})[_0xd870('0x21')](handleEntityNotFound(_0x3459b1,null))[_0xd870('0x21')](saveUpdates(_0x1c6635[_0xd870('0x43')],null))[_0xd870('0x21')](respondWithResult(_0x3459b1,null))[_0xd870('0x3d')](handleError(_0x3459b1,null));};exports[_0xd870('0x22')]=function(_0x4ca6a6,_0x49ef39){return db[_0xd870('0x39')]['find']({'where':{'id':_0x4ca6a6[_0xd870('0x44')]['id']}})[_0xd870('0x21')](handleEntityNotFound(_0x49ef39,null))[_0xd870('0x21')](removeEntity(_0x49ef39,null))[_0xd870('0x3d')](handleError(_0x49ef39,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index d8813d7..d5a06d5 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 _0xcc3a=['FieldId','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','idField'];(function(_0x382a62,_0x1baa5e){var _0x490a25=function(_0x1b3427){while(--_0x1b3427){_0x382a62['push'](_0x382a62['shift']());}};_0x490a25(++_0x1baa5e);}(_0xcc3a,0x131));var _0xacc3=function(_0x3df9dd,_0x26f5cd){_0x3df9dd=_0x3df9dd-0x0;var _0x4f11e4=_0xcc3a[_0x3df9dd];return _0x4f11e4;};'use strict';var _=require(_0xacc3('0x0'));var util=require('util');var logger=require(_0xacc3('0x1'))(_0xacc3('0x2'));var moment=require('moment');var BPromise=require(_0xacc3('0x3'));var rp=require(_0xacc3('0x4'));var fs=require('fs');var path=require(_0xacc3('0x5'));var rimraf=require(_0xacc3('0x6'));var config=require(_0xacc3('0x7'));var attributes=require(_0xacc3('0x8'));module[_0xacc3('0x9')]=function(_0x29c3fa,_0x2d44ba){return _0x29c3fa[_0xacc3('0xa')](_0xacc3('0xb'),attributes,{'tableName':_0xacc3('0xc'),'paranoid':![],'indexes':[{'name':_0xacc3('0xd'),'fields':[_0xacc3('0xe'),_0xacc3('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd388=['./intDeskField.attributes','exports','define','int_desk_fields','desk_unique_index','FieldId','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x6c0b0a,_0x496391){var _0x5f456a=function(_0x5ae918){while(--_0x5ae918){_0x6c0b0a['push'](_0x6c0b0a['shift']());}};_0x5f456a(++_0x496391);}(_0xd388,0x17f));var _0x8d38=function(_0x5948a9,_0x149e27){_0x5948a9=_0x5948a9-0x0;var _0x5e1139=_0xd388[_0x5948a9];return _0x5e1139;};'use strict';var _=require(_0x8d38('0x0'));var util=require('util');var logger=require(_0x8d38('0x1'))('api');var moment=require('moment');var BPromise=require(_0x8d38('0x2'));var rp=require(_0x8d38('0x3'));var fs=require('fs');var path=require(_0x8d38('0x4'));var rimraf=require(_0x8d38('0x5'));var config=require(_0x8d38('0x6'));var attributes=require(_0x8d38('0x7'));module[_0x8d38('0x8')]=function(_0xfceb55,_0x3984f3){return _0xfceb55[_0x8d38('0x9')]('DeskField',attributes,{'tableName':_0x8d38('0xa'),'paranoid':![],'indexes':[{'name':_0x8d38('0xb'),'fields':['idField',_0x8d38('0xc')],'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 9d4cf71..5d47604 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 _0x84c6=['catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x518ea6,_0x5d7886){var _0x1bd832=function(_0x2d12c1){while(--_0x2d12c1){_0x518ea6['push'](_0x518ea6['shift']());}};_0x1bd832(++_0x5d7886);}(_0x84c6,0x17b));var _0x684c=function(_0x1329ae,_0x28f239){_0x1329ae=_0x1329ae-0x0;var _0x1129cb=_0x84c6[_0x1329ae];return _0x1129cb;};'use strict';var _=require(_0x684c('0x0'));var util=require(_0x684c('0x1'));var moment=require(_0x684c('0x2'));var BPromise=require(_0x684c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x684c('0x4'))['db'];var utils=require(_0x684c('0x5'));var logger=require(_0x684c('0x6'))(_0x684c('0x7'));var config=require('../../config/environment');var jayson=require(_0x684c('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x433bb7,_0x42a64a,_0x5b4491){return new BPromise(function(_0x4efe11,_0x34150c){return client[_0x684c('0x9')](_0x433bb7,_0x5b4491)['then'](function(_0x527b8a){logger[_0x684c('0xa')](_0x684c('0xb'),_0x42a64a,_0x684c('0xc'));logger[_0x684c('0xd')](_0x684c('0xe'),_0x42a64a,'request\x20sent',JSON[_0x684c('0xf')](_0x527b8a));if(_0x527b8a[_0x684c('0x10')]){if(_0x527b8a['error'][_0x684c('0x11')]===0x1f4){logger[_0x684c('0x10')](_0x684c('0xb'),_0x42a64a,_0x527b8a[_0x684c('0x10')]['message']);return _0x34150c(_0x527b8a['error'][_0x684c('0x12')]);}logger[_0x684c('0x10')]('DeskField,\x20%s,\x20%s',_0x42a64a,_0x527b8a[_0x684c('0x10')][_0x684c('0x12')]);return _0x4efe11(_0x527b8a[_0x684c('0x10')][_0x684c('0x12')]);}else{logger[_0x684c('0xa')](_0x684c('0xb'),_0x42a64a,'request\x20sent');_0x4efe11(_0x527b8a[_0x684c('0x13')][_0x684c('0x12')]);}})[_0x684c('0x14')](function(_0x290182){logger[_0x684c('0x10')](_0x684c('0xb'),_0x42a64a,_0x290182);_0x34150c(_0x290182);});});} \ No newline at end of file +var _0x0d35=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','DeskField,\x20%s,\x20%s','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird','randomstring'];(function(_0x224514,_0x250b66){var _0x323046=function(_0x3f42b2){while(--_0x3f42b2){_0x224514['push'](_0x224514['shift']());}};_0x323046(++_0x250b66);}(_0x0d35,0x104));var _0x50d3=function(_0x59653b,_0x342e38){_0x59653b=_0x59653b-0x0;var _0xf73499=_0x0d35[_0x59653b];return _0xf73499;};'use strict';var _=require(_0x50d3('0x0'));var util=require(_0x50d3('0x1'));var moment=require('moment');var BPromise=require(_0x50d3('0x2'));var rs=require(_0x50d3('0x3'));var fs=require('fs');var Redis=require(_0x50d3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x50d3('0x5'));var logger=require(_0x50d3('0x6'))(_0x50d3('0x7'));var config=require(_0x50d3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x50d3('0x9')][_0x50d3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7f4f89,_0x5b1e43,_0x41c886){return new BPromise(function(_0xab9e93,_0x49fd3e){return client[_0x50d3('0xb')](_0x7f4f89,_0x41c886)[_0x50d3('0xc')](function(_0x954581){logger[_0x50d3('0xd')](_0x50d3('0xe'),_0x5b1e43,'request\x20sent');logger['debug'](_0x50d3('0xf'),_0x5b1e43,_0x50d3('0x10'),JSON[_0x50d3('0x11')](_0x954581));if(_0x954581[_0x50d3('0x12')]){if(_0x954581[_0x50d3('0x12')][_0x50d3('0x13')]===0x1f4){logger[_0x50d3('0x12')](_0x50d3('0xe'),_0x5b1e43,_0x954581[_0x50d3('0x12')][_0x50d3('0x14')]);return _0x49fd3e(_0x954581[_0x50d3('0x12')][_0x50d3('0x14')]);}logger[_0x50d3('0x12')](_0x50d3('0xe'),_0x5b1e43,_0x954581[_0x50d3('0x12')][_0x50d3('0x14')]);return _0xab9e93(_0x954581['error'][_0x50d3('0x14')]);}else{logger[_0x50d3('0xd')](_0x50d3('0xe'),_0x5b1e43,_0x50d3('0x10'));_0xab9e93(_0x954581['result'][_0x50d3('0x14')]);}})[_0x50d3('0x15')](function(_0x3b44c1){logger['error'](_0x50d3('0xe'),_0x5b1e43,_0x3b44c1);_0x49fd3e(_0x3b44c1);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index bba5f7b..3cf3b0f 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 _0x623a=['get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDynamics365Account.controller'];(function(_0x1a665f,_0x495252){var _0x49b082=function(_0x43bc85){while(--_0x43bc85){_0x1a665f['push'](_0x1a665f['shift']());}};_0x49b082(++_0x495252);}(_0x623a,0x10b));var _0xa623=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x623a[_0x411add];return _0x238242;};'use strict';var multer=require(_0xa623('0x0'));var util=require(_0xa623('0x1'));var path=require(_0xa623('0x2'));var timeout=require(_0xa623('0x3'));var express=require(_0xa623('0x4'));var router=express[_0xa623('0x5')]();var fs_extra=require(_0xa623('0x6'));var auth=require(_0xa623('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa623('0x8'));router[_0xa623('0x9')]('/',auth[_0xa623('0xa')](),controller[_0xa623('0xb')]);router[_0xa623('0x9')](_0xa623('0xc'),auth['isAuthenticated'](),controller[_0xa623('0xd')]);router['get'](_0xa623('0xe'),auth['isAuthenticated'](),controller[_0xa623('0xf')]);router['get'](_0xa623('0x10'),auth[_0xa623('0xa')](),controller[_0xa623('0x11')]);router[_0xa623('0x12')]('/',auth[_0xa623('0xa')](),controller[_0xa623('0x13')]);router[_0xa623('0x12')]('/:id/configurations',auth[_0xa623('0xa')](),controller[_0xa623('0x14')]);router['put'](_0xa623('0xc'),auth[_0xa623('0xa')](),controller['update']);router[_0xa623('0x15')](_0xa623('0xc'),auth[_0xa623('0xa')](),controller[_0xa623('0x16')]);module['exports']=router; \ No newline at end of file +var _0xb976=['/:id/fields','getFields','post','addConfiguration','put','update','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations'];(function(_0x4ed458,_0x5793af){var _0x132baa=function(_0x557947){while(--_0x557947){_0x4ed458['push'](_0x4ed458['shift']());}};_0x132baa(++_0x5793af);}(_0xb976,0x97));var _0x6b97=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb976[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x6b97('0x0'));var path=require(_0x6b97('0x1'));var timeout=require(_0x6b97('0x2'));var express=require(_0x6b97('0x3'));var router=express[_0x6b97('0x4')]();var fs_extra=require(_0x6b97('0x5'));var auth=require(_0x6b97('0x6'));var interaction=require(_0x6b97('0x7'));var config=require(_0x6b97('0x8'));var controller=require(_0x6b97('0x9'));router[_0x6b97('0xa')]('/',auth[_0x6b97('0xb')](),controller[_0x6b97('0xc')]);router[_0x6b97('0xa')](_0x6b97('0xd'),auth[_0x6b97('0xb')](),controller[_0x6b97('0xe')]);router[_0x6b97('0xa')](_0x6b97('0xf'),auth[_0x6b97('0xb')](),controller[_0x6b97('0x10')]);router[_0x6b97('0xa')](_0x6b97('0x11'),auth['isAuthenticated'](),controller[_0x6b97('0x12')]);router[_0x6b97('0x13')]('/',auth[_0x6b97('0xb')](),controller['create']);router['post'](_0x6b97('0xf'),auth[_0x6b97('0xb')](),controller[_0x6b97('0x14')]);router[_0x6b97('0x15')](_0x6b97('0xd'),auth[_0x6b97('0xb')](),controller[_0x6b97('0x16')]);router['delete']('/:id',auth[_0x6b97('0xb')](),controller['destroy']);module[_0x6b97('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 6894f17..a0c025c 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 _0x5269=['sequelize','STRING'];(function(_0x208505,_0x241a77){var _0x1a985f=function(_0x4a5110){while(--_0x4a5110){_0x208505['push'](_0x208505['shift']());}};_0x1a985f(++_0x241a77);}(_0x5269,0x138));var _0x9526=function(_0x595a0b,_0x2f17c7){_0x595a0b=_0x595a0b-0x0;var _0x109de8=_0x5269[_0x595a0b];return _0x109de8;};'use strict';var Sequelize=require(_0x9526('0x0'));module['exports']={'name':{'type':Sequelize[_0x9526('0x1')]},'username':{'type':Sequelize[_0x9526('0x1')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x9526('0x1')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x9526('0x1')]},'clientSecret':{'type':Sequelize[_0x9526('0x1')]},'serverUrl':{'type':Sequelize[_0x9526('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x9526('0x1')]}}; \ No newline at end of file +var _0xc188=['exports','STRING','sequelize'];(function(_0x22d761,_0x18190c){var _0x321e0b=function(_0x46d619){while(--_0x46d619){_0x22d761['push'](_0x22d761['shift']());}};_0x321e0b(++_0x18190c);}(_0xc188,0x14c));var _0x8c18=function(_0x211897,_0x12b0ac){_0x211897=_0x211897-0x0;var _0x35952f=_0xc188[_0x211897];return _0x35952f;};'use strict';var Sequelize=require(_0x8c18('0x0'));module[_0x8c18('0x1')]={'name':{'type':Sequelize[_0x8c18('0x2')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x8c18('0x2')]},'remoteUri':{'type':Sequelize[_0x8c18('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x8c18('0x2')]},'clientSecret':{'type':Sequelize[_0x8c18('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x8c18('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 899b44a..352ccc3 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 _0x4abf=['json','apply','reject','save','update','then','destroy','error','stack','name','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','find','catch','create','body','params','findOne','Dynamics365Configuration','order','getConfigurations','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','Subjects','ticketType','incident','Incident','PhoneCall','title','caseorigincode','phonenumber','regardingobjectid','directioncode','accountidname','accountidyominame','billedserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyname','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridyominame','emailaddress','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','importsequencenumber','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productserialnumber','responseby','responsiblecontactidname','responsiblecontactidyominame','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','versionnumber','concat','username','password','remoteUri','tenantId','clientId','clientSecret','slice','substring','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','4.0','value','MetadataId','EntityDefinitions(','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','isNil','BooleanAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','all','test','statusCode','Wrong\x20credentials',')/Attributes(','Bearer\x20','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false','?$select=DisplayName,LogicalName','eml-format','rimraf','fast-json-patch','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','count','set','Content-Range'];(function(_0xe4b5a0,_0x2aff67){var _0x150a37=function(_0x4975aa){while(--_0x4975aa){_0xe4b5a0['push'](_0xe4b5a0['shift']());}};_0x150a37(++_0x2aff67);}(_0x4abf,0xac));var _0xf4ab=function(_0x18c9ab,_0x6ba7e7){_0x18c9ab=_0x18c9ab-0x0;var _0x17fc37=_0x4abf[_0x18c9ab];return _0x17fc37;};'use strict';var emlformat=require(_0xf4ab('0x0'));var rimraf=require(_0xf4ab('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf4ab('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf4ab('0x3'));var util=require(_0xf4ab('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xf4ab('0x5'));var ejs=require(_0xf4ab('0x6'));var fs=require('fs');var fs_extra=require(_0xf4ab('0x7'));var _=require(_0xf4ab('0x8'));var squel=require('squel');var crypto=require(_0xf4ab('0x9'));var jsforce=require(_0xf4ab('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xf4ab('0x5'));var querystring=require('querystring');var Papa=require(_0xf4ab('0xb'));var Redis=require(_0xf4ab('0xc'));var authService=require(_0xf4ab('0xd'));var qs=require(_0xf4ab('0xe'));var as=require(_0xf4ab('0xf'));var hardwareService=require(_0xf4ab('0x10'));var logger=require(_0xf4ab('0x11'))(_0xf4ab('0x12'));var utils=require(_0xf4ab('0x13'));var config=require(_0xf4ab('0x14'));var licenseUtil=require(_0xf4ab('0x15'));var db=require(_0xf4ab('0x16'))['db'];var integrations=require(_0xf4ab('0x17'));function respondWithStatusCode(_0x552268,_0x52ab9e){_0x52ab9e=_0x52ab9e||0xcc;return function(_0x17181a){if(_0x17181a){return _0x552268[_0xf4ab('0x18')](_0x52ab9e);}return _0x552268[_0xf4ab('0x19')](_0x52ab9e)[_0xf4ab('0x1a')]();};}function respondWithResult(_0x141d64,_0x23c03d){_0x23c03d=_0x23c03d||0xc8;return function(_0x1f2d12){if(_0x1f2d12){return _0x141d64[_0xf4ab('0x19')](_0x23c03d)['json'](_0x1f2d12);}};}function respondWithFilteredResult(_0x2e7b69,_0x1c5202){return function(_0xc26111){if(_0xc26111){var _0x5d50cb=typeof _0x1c5202[_0xf4ab('0x1b')]===_0xf4ab('0x1c')&&typeof _0x1c5202['limit']===_0xf4ab('0x1c');var _0x44da8b=_0xc26111[_0xf4ab('0x1d')];var _0x2b8ac8=_0x5d50cb?0x0:_0x1c5202[_0xf4ab('0x1b')];var _0x2ac208=_0x5d50cb?_0xc26111[_0xf4ab('0x1d')]:_0x1c5202['offset']+_0x1c5202['limit'];var _0x35d4d6;if(_0x2ac208>=_0x44da8b){_0x2ac208=_0x44da8b;_0x35d4d6=0xc8;}else{_0x35d4d6=0xce;}_0x2e7b69['status'](_0x35d4d6);return _0x2e7b69[_0xf4ab('0x1e')](_0xf4ab('0x1f'),_0x2b8ac8+'-'+_0x2ac208+'/'+_0x44da8b)[_0xf4ab('0x20')](_0xc26111);}return null;};}function patchUpdates(_0x4b8632){return function(_0x32cd04){try{jsonpatch[_0xf4ab('0x21')](_0x32cd04,_0x4b8632,!![]);}catch(_0x3df1ef){return BPromise[_0xf4ab('0x22')](_0x3df1ef);}return _0x32cd04[_0xf4ab('0x23')]();};}function saveUpdates(_0x52ba53,_0xf1998f){return function(_0x4363c7){if(_0x4363c7){return _0x4363c7[_0xf4ab('0x24')](_0x52ba53)[_0xf4ab('0x25')](function(_0x152d48){return _0x152d48;});}return null;};}function removeEntity(_0xb5c618,_0x2cb4bc){return function(_0x5e4442){if(_0x5e4442){return _0x5e4442[_0xf4ab('0x26')]()['then'](function(){_0xb5c618[_0xf4ab('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x561ba5,_0x55388d){return function(_0x58015c){if(!_0x58015c){_0x561ba5['sendStatus'](0x194);}return _0x58015c;};}function handleError(_0x5641b8,_0x5f5af2){_0x5f5af2=_0x5f5af2||0x1f4;return function(_0x19d6a8){logger[_0xf4ab('0x27')](_0x19d6a8[_0xf4ab('0x28')]);if(_0x19d6a8[_0xf4ab('0x29')]){delete _0x19d6a8[_0xf4ab('0x29')];}_0x5641b8['status'](_0x5f5af2)['send'](_0x19d6a8);};}exports[_0xf4ab('0x2a')]=function(_0x3cf5b1,_0x52f419){var _0x46877c={},_0x4e2115={},_0x20482c={'count':0x0,'rows':[]};var _0x333864=_[_0xf4ab('0x2b')](db[_0xf4ab('0x2c')][_0xf4ab('0x2d')],function(_0x3dcc37){return{'name':_0x3dcc37[_0xf4ab('0x2e')],'type':_0x3dcc37[_0xf4ab('0x2f')][_0xf4ab('0x30')]};});_0x4e2115[_0xf4ab('0x31')]=_[_0xf4ab('0x2b')](_0x333864,'name');_0x4e2115[_0xf4ab('0x32')]=_['keys'](_0x3cf5b1[_0xf4ab('0x32')]);_0x4e2115[_0xf4ab('0x33')]=_['intersection'](_0x4e2115['model'],_0x4e2115[_0xf4ab('0x32')]);_0x46877c[_0xf4ab('0x34')]=_[_0xf4ab('0x35')](_0x4e2115[_0xf4ab('0x31')],qs[_0xf4ab('0x36')](_0x3cf5b1['query']['fields']));_0x46877c[_0xf4ab('0x34')]=_0x46877c[_0xf4ab('0x34')][_0xf4ab('0x37')]?_0x46877c['attributes']:_0x4e2115[_0xf4ab('0x31')];if(!_0x3cf5b1[_0xf4ab('0x32')][_0xf4ab('0x38')](_0xf4ab('0x39'))){_0x46877c[_0xf4ab('0x3a')]=qs[_0xf4ab('0x3a')](_0x3cf5b1[_0xf4ab('0x32')][_0xf4ab('0x3a')]);_0x46877c[_0xf4ab('0x1b')]=qs[_0xf4ab('0x1b')](_0x3cf5b1[_0xf4ab('0x32')][_0xf4ab('0x1b')]);}_0x46877c['order']=qs[_0xf4ab('0x3b')](_0x3cf5b1[_0xf4ab('0x32')][_0xf4ab('0x3b')]);_0x46877c[_0xf4ab('0x3c')]=qs[_0xf4ab('0x33')](_[_0xf4ab('0x3d')](_0x3cf5b1[_0xf4ab('0x32')],_0x4e2115[_0xf4ab('0x33')]),_0x333864);if(_0x3cf5b1[_0xf4ab('0x32')][_0xf4ab('0x3e')]){_0x46877c[_0xf4ab('0x3c')]=_[_0xf4ab('0x3f')](_0x46877c[_0xf4ab('0x3c')],{'$or':_[_0xf4ab('0x2b')](_0x333864,function(_0x4ed7d4){if(_0x4ed7d4[_0xf4ab('0x2f')]!==_0xf4ab('0x40')){var _0x866dcc={};_0x866dcc[_0x4ed7d4[_0xf4ab('0x29')]]={'$like':'%'+_0x3cf5b1['query'][_0xf4ab('0x3e')]+'%'};return _0x866dcc;}})});}_0x46877c=_[_0xf4ab('0x3f')]({},_0x46877c,_0x3cf5b1[_0xf4ab('0x41')]);var _0x4745d6={'where':_0x46877c['where']};return db[_0xf4ab('0x2c')][_0xf4ab('0x1d')](_0x4745d6)[_0xf4ab('0x25')](function(_0x4bde74){_0x20482c[_0xf4ab('0x1d')]=_0x4bde74;if(_0x3cf5b1[_0xf4ab('0x32')][_0xf4ab('0x42')]){_0x46877c[_0xf4ab('0x43')]=[{'all':!![]}];}return db[_0xf4ab('0x2c')][_0xf4ab('0x44')](_0x46877c);})[_0xf4ab('0x25')](function(_0x597254){_0x20482c[_0xf4ab('0x45')]=_0x597254;return _0x20482c;})[_0xf4ab('0x25')](respondWithFilteredResult(_0x52f419,_0x46877c))['catch'](handleError(_0x52f419,null));};exports[_0xf4ab('0x46')]=function(_0x2be5aa,_0x225624){var _0x4e397b={'raw':![],'where':{'id':_0x2be5aa['params']['id']}},_0x2737a7={};_0x2737a7[_0xf4ab('0x31')]=_[_0xf4ab('0x47')](db['Dynamics365Account'][_0xf4ab('0x2d')]);_0x2737a7[_0xf4ab('0x32')]=_[_0xf4ab('0x47')](_0x2be5aa[_0xf4ab('0x32')]);_0x2737a7['filters']=_['intersection'](_0x2737a7[_0xf4ab('0x31')],_0x2737a7['query']);_0x4e397b['attributes']=_[_0xf4ab('0x35')](_0x2737a7[_0xf4ab('0x31')],qs[_0xf4ab('0x36')](_0x2be5aa[_0xf4ab('0x32')][_0xf4ab('0x36')]));_0x4e397b[_0xf4ab('0x34')]=_0x4e397b[_0xf4ab('0x34')][_0xf4ab('0x37')]?_0x4e397b[_0xf4ab('0x34')]:_0x2737a7[_0xf4ab('0x31')];if(_0x2be5aa[_0xf4ab('0x32')][_0xf4ab('0x42')]){_0x4e397b[_0xf4ab('0x43')]=[{'all':!![]}];}_0x4e397b=_['merge']({},_0x4e397b,_0x2be5aa[_0xf4ab('0x41')]);return db[_0xf4ab('0x2c')][_0xf4ab('0x48')](_0x4e397b)[_0xf4ab('0x25')](handleEntityNotFound(_0x225624,null))[_0xf4ab('0x25')](respondWithResult(_0x225624,null))[_0xf4ab('0x49')](handleError(_0x225624,null));};exports['create']=function(_0x2714ce,_0x479c5c){return db[_0xf4ab('0x2c')][_0xf4ab('0x4a')](_0x2714ce[_0xf4ab('0x4b')],{})[_0xf4ab('0x25')](respondWithResult(_0x479c5c,0xc9))[_0xf4ab('0x49')](handleError(_0x479c5c,null));};exports[_0xf4ab('0x24')]=function(_0x25e6cc,_0x5d83a0){if(_0x25e6cc[_0xf4ab('0x4b')]['id']){delete _0x25e6cc[_0xf4ab('0x4b')]['id'];}return db[_0xf4ab('0x2c')][_0xf4ab('0x48')]({'where':{'id':_0x25e6cc[_0xf4ab('0x4c')]['id']}})[_0xf4ab('0x25')](handleEntityNotFound(_0x5d83a0,null))[_0xf4ab('0x25')](saveUpdates(_0x25e6cc[_0xf4ab('0x4b')],null))[_0xf4ab('0x25')](respondWithResult(_0x5d83a0,null))[_0xf4ab('0x49')](handleError(_0x5d83a0,null));};exports['destroy']=function(_0x459cc3,_0x1a9db4){return db[_0xf4ab('0x2c')][_0xf4ab('0x48')]({'where':{'id':_0x459cc3[_0xf4ab('0x4c')]['id']}})[_0xf4ab('0x25')](handleEntityNotFound(_0x1a9db4,null))[_0xf4ab('0x25')](removeEntity(_0x1a9db4,null))[_0xf4ab('0x49')](handleError(_0x1a9db4,null));};exports['getConfigurations']=function(_0x3e66cf,_0x2444b8,_0x260beb){var _0x440dfe={};var _0x47130d={};var _0x417786;var _0x3a419;return db['Dynamics365Account'][_0xf4ab('0x4d')]({'where':{'id':_0x3e66cf[_0xf4ab('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2444b8,null))[_0xf4ab('0x25')](function(_0x9f559d){if(_0x9f559d){_0x417786=_0x9f559d;_0x47130d[_0xf4ab('0x31')]=_[_0xf4ab('0x47')](db[_0xf4ab('0x4e')]['rawAttributes']);_0x47130d['query']=_[_0xf4ab('0x47')](_0x3e66cf[_0xf4ab('0x32')]);_0x47130d[_0xf4ab('0x33')]=_['intersection'](_0x47130d[_0xf4ab('0x31')],_0x47130d[_0xf4ab('0x32')]);_0x440dfe[_0xf4ab('0x34')]=_[_0xf4ab('0x35')](_0x47130d[_0xf4ab('0x31')],qs[_0xf4ab('0x36')](_0x3e66cf['query'][_0xf4ab('0x36')]));_0x440dfe[_0xf4ab('0x34')]=_0x440dfe[_0xf4ab('0x34')][_0xf4ab('0x37')]?_0x440dfe['attributes']:_0x47130d['model'];_0x440dfe[_0xf4ab('0x4f')]=qs[_0xf4ab('0x3b')](_0x3e66cf[_0xf4ab('0x32')]['sort']);_0x440dfe['where']=qs[_0xf4ab('0x33')](_[_0xf4ab('0x3d')](_0x3e66cf['query'],_0x47130d[_0xf4ab('0x33')]));if(_0x3e66cf[_0xf4ab('0x32')]['filter']){_0x440dfe[_0xf4ab('0x3c')]=_[_0xf4ab('0x3f')](_0x440dfe[_0xf4ab('0x3c')],{'$or':_['map'](_0x440dfe[_0xf4ab('0x34')],function(_0x472c37){var _0x480121={};_0x480121[_0x472c37]={'$like':'%'+_0x3e66cf['query'][_0xf4ab('0x3e')]+'%'};return _0x480121;})});}_0x440dfe=_[_0xf4ab('0x3f')]({},_0x440dfe,_0x3e66cf['options']);return _0x417786[_0xf4ab('0x50')](_0x440dfe);}})[_0xf4ab('0x25')](function(_0x2bdf30){if(_0x2bdf30){_0x3a419=_0x2bdf30[_0xf4ab('0x37')];if(!_0x3e66cf['query'][_0xf4ab('0x38')](_0xf4ab('0x39'))){_0x440dfe[_0xf4ab('0x3a')]=qs[_0xf4ab('0x3a')](_0x3e66cf[_0xf4ab('0x32')][_0xf4ab('0x3a')]);_0x440dfe['offset']=qs[_0xf4ab('0x1b')](_0x3e66cf[_0xf4ab('0x32')]['offset']);}return _0x417786[_0xf4ab('0x50')](_0x440dfe);}})[_0xf4ab('0x25')](function(_0x34cbfa){if(_0x34cbfa){return _0x34cbfa?{'count':_0x3a419,'rows':_0x34cbfa}:null;}})['then'](respondWithResult(_0x2444b8,null))[_0xf4ab('0x49')](handleError(_0x2444b8,null));};exports[_0xf4ab('0x51')]=function(_0x5904d7,_0x28d5f0,_0x3bf020){if(_0x5904d7[_0xf4ab('0x4b')]['id']){delete _0x5904d7[_0xf4ab('0x4b')]['id'];}return db[_0xf4ab('0x2c')][_0xf4ab('0x4d')]({'where':{'id':_0x5904d7[_0xf4ab('0x4c')]['id']}})[_0xf4ab('0x25')](handleEntityNotFound(_0x28d5f0,null))['then'](function(_0xaa8ecb){if(_0xaa8ecb){_0x5904d7[_0xf4ab('0x4b')][_0xf4ab('0x52')]=_0xaa8ecb['id'];_0x5904d7[_0xf4ab('0x4b')]['Subjects']=integrations[_0xf4ab('0x53')](_0x5904d7[_0xf4ab('0x4b')][_0xf4ab('0x54')],_0x5904d7['body'][_0xf4ab('0x2f')]);_0x5904d7['body'][_0xf4ab('0x55')]=integrations[_0xf4ab('0x56')](_0x5904d7[_0xf4ab('0x4b')][_0xf4ab('0x54')],_0x5904d7[_0xf4ab('0x4b')][_0xf4ab('0x2f')]);return db['Dynamics365Configuration'][_0xf4ab('0x4a')](_0x5904d7[_0xf4ab('0x4b')],{'include':[{'model':db[_0xf4ab('0x57')],'as':_0xf4ab('0x58')},{'model':db[_0xf4ab('0x57')],'as':_0xf4ab('0x55')}]});}return null;})[_0xf4ab('0x25')](respondWithResult(_0x28d5f0,null))[_0xf4ab('0x49')](handleError(_0x28d5f0,null));};exports['getFields']=function(_0x60a2a0,_0x56b0e8,_0x440d50){var _0x44911e=_0x60a2a0['query'][_0xf4ab('0x59')];var _0xce3eb6=_0x44911e===_0xf4ab('0x5a')?_0xf4ab('0x5b'):_0xf4ab('0x5c');var _0x43ce40='';var _0x44a0d6='';var _0x3d8d9e='';var _0x3617fc='';var _0x4d8864='';var _0x48f5fb='';var _0x29c733='';var _0x23a3d5='';var _0x27ce4b=[_0xf4ab('0x5d'),'description','customerid','ownerid',_0xf4ab('0x5e'),'subject',_0xf4ab('0x5f'),_0xf4ab('0x60'),_0xf4ab('0x61'),'phonecall_activity_parties'];var _0x3af0d0=[_0xf4ab('0x62'),_0xf4ab('0x63'),'actualserviceunits',_0xf4ab('0x64'),_0xf4ab('0x65'),'contactidyominame',_0xf4ab('0x66'),_0xf4ab('0x67'),_0xf4ab('0x68'),'createdbyexternalpartyyominame',_0xf4ab('0x69'),'createdbyyominame',_0xf4ab('0x6a'),_0xf4ab('0x6b'),_0xf4ab('0x6c'),_0xf4ab('0x6d'),'customeridtype',_0xf4ab('0x6e'),_0xf4ab('0x6f'),'entitlementidname',_0xf4ab('0x70'),_0xf4ab('0x71'),_0xf4ab('0x72'),_0xf4ab('0x73'),'firstresponsebykpiidname','followupby',_0xf4ab('0x74'),_0xf4ab('0x75'),_0xf4ab('0x76'),'lastonholdtime',_0xf4ab('0x77'),_0xf4ab('0x78'),'modifiedbyexternalpartyyominame',_0xf4ab('0x79'),'modifiedbyyominame','modifiedon',_0xf4ab('0x7a'),_0xf4ab('0x7b'),_0xf4ab('0x7c'),'msdyn_iotalertname',_0xf4ab('0x7d'),_0xf4ab('0x7e'),_0xf4ab('0x7f'),_0xf4ab('0x80'),_0xf4ab('0x81'),_0xf4ab('0x82'),_0xf4ab('0x83'),_0xf4ab('0x84'),_0xf4ab('0x85'),_0xf4ab('0x86'),'productidname',_0xf4ab('0x87'),'resolveby','resolvebykpiidname',_0xf4ab('0x88'),_0xf4ab('0x89'),_0xf4ab('0x8a'),'sentimentvalue','slainvokedidname',_0xf4ab('0x8b'),_0xf4ab('0x8c'),_0xf4ab('0x8d'),_0xf4ab('0x8e'),_0xf4ab('0x8f'),_0xf4ab('0x90'),_0xf4ab('0x91'),'transactioncurrencyidname','traversedpath','utcconversiontimezonecode',_0xf4ab('0x92')];var _0x1c233b=_0x27ce4b[_0xf4ab('0x93')](_0x3af0d0);return db['Dynamics365Account'][_0xf4ab('0x4d')]({'where':{'id':_0x60a2a0[_0xf4ab('0x4c')]['id']},'attributes':['id',_0xf4ab('0x94'),_0xf4ab('0x95'),_0xf4ab('0x96'),_0xf4ab('0x97'),_0xf4ab('0x98'),_0xf4ab('0x99')]})[_0xf4ab('0x25')](handleEntityNotFound(_0x56b0e8,null))['then'](function(_0x4cc612){if(_0x4cc612){_0x23a3d5=_0x4cc612[_0xf4ab('0x96')];var _0x2ffb48=_0x23a3d5[_0xf4ab('0x9a')](-0x1);if(_0x2ffb48==='/'){_0x23a3d5=_0x23a3d5[_0xf4ab('0x9b')](0x0,_0x23a3d5[_0xf4ab('0x9c')](_0x2ffb48));}_0x29c733=util[_0xf4ab('0x9d')](_0xf4ab('0x9e'),_0x23a3d5);var _0x4d25c1={'method':_0xf4ab('0x9f'),'uri':_0xf4ab('0xa0')+_0x4cc612['tenantId']+_0xf4ab('0xa1'),'form':{'client_id':_0x4cc612[_0xf4ab('0x98')],'resource':_0x23a3d5,'username':_0x4cc612['username'],'password':_0x4cc612[_0xf4ab('0x95')],'grant_type':_0xf4ab('0x95'),'client_secret':_0x4cc612[_0xf4ab('0x99')]},'json':!![]};return rp(_0x4d25c1);}})['then'](function(_0x403321){_0x48f5fb=_0x403321[_0xf4ab('0xa2')];var _0x2c452b={'method':_0xf4ab('0xa3'),'uri':encodeURI(_0x29c733+_0xf4ab('0xa4')+_0xce3eb6+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x48f5fb,'If-None-Match':null,'OData-Version':_0xf4ab('0xa5')},'json':!![]};return rp(_0x2c452b);})[_0xf4ab('0x25')](function(_0x5b180e){var _0x487663=_0x5b180e[_0xf4ab('0xa6')][0x0];var _0x3959fb=_0x487663[_0xf4ab('0xa7')];var _0x340ef0={'method':_0xf4ab('0xa3'),'uri':_0x29c733+_0xf4ab('0xa8')+_0x3959fb+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':'Bearer\x20'+_0x48f5fb,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x340ef0);})[_0xf4ab('0x25')](function(_0x49832d){_0x43ce40=_0x49832d;_0x44a0d6=_0x43ce40['Attributes'];_0x44a0d6=_[_0xf4ab('0xa9')](_0x44a0d6,function(_0x11afae){return!_0x1c233b[_0xf4ab('0xaa')](_0x11afae[_0xf4ab('0xab')]);});var _0x163da3=[];var _0xc08bdb=[];_0x44a0d6[_0xf4ab('0xac')](function(_0x24a7e8){if(_0x24a7e8['@odata.type']){var _0x33fcf3=_0x24a7e8['@odata.type'][_0xf4ab('0x9b')](_0x24a7e8[_0xf4ab('0xad')][_0xf4ab('0x9c')]('.')+0x1);if(_0x33fcf3===_0xf4ab('0xae')){_0x163da3[_0xf4ab('0xaf')](getSelectList(_0x29c733,_0x44911e,_0xc08bdb,_0x43ce40[_0xf4ab('0xa7')],_0x24a7e8['MetadataId'],_0x48f5fb));}}});return Promise['all'](_0x163da3);})['then'](function(_0x2b8800){_0x3d8d9e=_0x2b8800[0x0];var _0xf5ce7f=[];var _0xf61ad3=[];_0x44a0d6[_0xf4ab('0xac')](function(_0x150170){if(!_[_0xf4ab('0xb0')](_0x150170[_0xf4ab('0xad')])){var _0x8ba896=_0x150170[_0xf4ab('0xad')][_0xf4ab('0x9b')](_0x150170[_0xf4ab('0xad')][_0xf4ab('0x9c')]('.')+0x1);if(_0x8ba896===_0xf4ab('0xb1')){_0xf5ce7f[_0xf4ab('0xaf')](getBooleanList(_0x29c733,_0x44911e,_0xf61ad3,_0x43ce40[_0xf4ab('0xa7')],_0x150170[_0xf4ab('0xa7')],_0x48f5fb));}}});return Promise['all'](_0xf5ce7f);})[_0xf4ab('0x25')](function(_0x56b95f){_0x3617fc=_0x56b95f[0x0];var _0x23c8dd=[];var _0x2cdc40=[];_0x44a0d6[_0xf4ab('0xac')](function(_0x324a91){if(_0x324a91['@odata.type']){var _0x3a752f=_0x324a91['@odata.type'][_0xf4ab('0x9b')](_0x324a91[_0xf4ab('0xad')][_0xf4ab('0x9c')]('.')+0x1);if(_0x3a752f==='StringAttributeMetadata'||_0x3a752f===_0xf4ab('0xb2')||_0x3a752f===_0xf4ab('0xb3')||_0x3a752f===_0xf4ab('0xb4')||_0x3a752f===_0xf4ab('0xb5')||_0x3a752f==='DateTimeAttributeMetadata'||_0x3a752f===_0xf4ab('0xb6')||_0x3a752f===_0xf4ab('0xb7')||_0x3a752f===_0xf4ab('0xb8')||_0x3a752f===_0xf4ab('0xb9')){_0x23c8dd[_0xf4ab('0xaf')](getInputList(_0x29c733,_0x44911e,_0x3a752f,_0x2cdc40,_0x43ce40[_0xf4ab('0xa7')],_0x324a91[_0xf4ab('0xa7')],_0x48f5fb));}}});return Promise[_0xf4ab('0xba')](_0x23c8dd);})[_0xf4ab('0x25')](function(_0x1f8685){_0x4d8864=_0x1f8685[0x0];var _0x48f931=_0x3d8d9e['concat'](_0x3617fc)[_0xf4ab('0x93')](_0x4d8864);var _0x2db47e={'count':_0x48f931[_0xf4ab('0x37')],'rows':_0x48f931};return _0x2db47e;})[_0xf4ab('0x25')](respondWithResult(_0x56b0e8,null))[_0xf4ab('0x49')](function(_0x168a5c){var _0x1e6159=_0x60a2a0['query'][_0xf4ab('0xbb')]?0x1f4:_0x168a5c[_0xf4ab('0xbc')]||0x1f4;logger[_0xf4ab('0x27')](_0x168a5c[_0xf4ab('0x28')]);delete _0x168a5c[_0xf4ab('0x29')];if(_0x1e6159===0x191){_0x1e6159=0x190;}_0x56b0e8['status'](_0x1e6159)['send'](_0x60a2a0[_0xf4ab('0x32')][_0xf4ab('0xbb')]?{'message':_0xf4ab('0xbd'),'statusCode':_0x168a5c[_0xf4ab('0xbc')]}:_0x168a5c);});};function getSelectList(_0x618b3a,_0x2a6dde,_0x21d9a2,_0x14c7a6,_0x57d0da,_0x1d9c7a){var _0xacd0b7={'method':'GET','uri':_0x618b3a+'EntityDefinitions('+_0x14c7a6+_0xf4ab('0xbe')+_0x57d0da+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0xf4ab('0xbf')+_0x1d9c7a,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0xacd0b7)[_0xf4ab('0x25')](function(_0x346ec8){var _0x1c00d9=[];var _0x1a882f=_0x346ec8[_0xf4ab('0xc0')][_0xf4ab('0xc1')];_0x1a882f[_0xf4ab('0xac')](function(_0x48208d){_0x1c00d9[_0xf4ab('0xaf')]({'name':_0x48208d[_0xf4ab('0xc2')][_0xf4ab('0xc3')]['Label'],'value':String(_0x48208d[_0xf4ab('0xc4')])});});var _0x56fec9={'id':_0x2a6dde+'_'+_0x346ec8['LogicalName'],'name':_0x346ec8[_0xf4ab('0xc5')]['UserLocalizedLabel'][_0xf4ab('0xc2')],'custom':![],'options':_0x1c00d9};_0x21d9a2[_0xf4ab('0xaf')](_0x56fec9);return _0x21d9a2;});}function getBooleanList(_0x1fc328,_0x2ae14f,_0x9fe2d7,_0x40fe97,_0x5027f1,_0x4750ab){var _0x913a10={'method':'GET','uri':_0x1fc328+_0xf4ab('0xa8')+_0x40fe97+_0xf4ab('0xbe')+_0x5027f1+_0xf4ab('0xc6'),'headers':{'Authorization':_0xf4ab('0xbf')+_0x4750ab,'If-None-Match':null,'OData-Version':_0xf4ab('0xa5')},'json':!![]};return rp(_0x913a10)['then'](function(_0x29b0be){var _0x34ce37=[];_0x34ce37[_0xf4ab('0xaf')]({'name':_0x29b0be['OptionSet'][_0xf4ab('0xc7')][_0xf4ab('0xc2')][_0xf4ab('0xc3')][_0xf4ab('0xc2')],'value':_0xf4ab('0xc8')},{'name':_0x29b0be['OptionSet'][_0xf4ab('0xc9')][_0xf4ab('0xc2')][_0xf4ab('0xc3')]['Label'],'value':_0xf4ab('0xca')});var _0x2eb005={'id':_0x2ae14f+'_'+_0x29b0be['LogicalName'],'name':_0x29b0be[_0xf4ab('0xc5')][_0xf4ab('0xc3')][_0xf4ab('0xc2')],'custom':![],'options':_0x34ce37};_0x9fe2d7[_0xf4ab('0xaf')](_0x2eb005);return _0x9fe2d7;});}function getInputList(_0x4ca8a0,_0xa0034e,_0x21429f,_0x27eebe,_0x10d07f,_0x11c919,_0x49844e){var _0x569d4c={'method':_0xf4ab('0xa3'),'uri':_0x4ca8a0+'EntityDefinitions('+_0x10d07f+_0xf4ab('0xbe')+_0x11c919+')/Microsoft.Dynamics.CRM.'+_0x21429f+_0xf4ab('0xcb'),'headers':{'Authorization':_0xf4ab('0xbf')+_0x49844e,'If-None-Match':null,'OData-Version':_0xf4ab('0xa5')},'json':!![]};return rp(_0x569d4c)[_0xf4ab('0x25')](function(_0x506dd2){var _0x4caa28={'id':_0xa0034e+'_'+_0x506dd2['LogicalName'],'name':_0x506dd2[_0xf4ab('0xc5')][_0xf4ab('0xc3')]?_0x506dd2[_0xf4ab('0xc5')]['UserLocalizedLabel'][_0xf4ab('0xc2')]:_0x506dd2[_0xf4ab('0xab')],'custom':![],'options':[]};_0x27eebe[_0xf4ab('0xaf')](_0x4caa28);return _0x27eebe;});} \ No newline at end of file +var _0x3468=['merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','create','body','find','params','getConfigurations','findOne','Dynamics365Configuration','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','ticketType','incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyyominame','customeridtype','customeridyominame','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','productidname','productserialnumber','resolveby','responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','socialprofileidname','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','versionnumber','concat','username','password','remoteUri','tenantId','clientId','slice','lastIndexOf','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','clientSecret','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)','remove','includes','@odata.type','substring','push','BooleanAttributeMetadata','all','forEach','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','Label','UserLocalizedLabel','Value','LogicalName','DisplayName','OptionSet','true','FalseOption','false','?$select=DisplayName,LogicalName','eml-format','fast-json-patch','bluebird','mustache','util','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','map','Dynamics365Account','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter'];(function(_0x4a52d0,_0x58d1ba){var _0x51640e=function(_0x5a423b){while(--_0x5a423b){_0x4a52d0['push'](_0x4a52d0['shift']());}};_0x51640e(++_0x58d1ba);}(_0x3468,0x8d));var _0x8346=function(_0x4d36b2,_0xff514a){_0x4d36b2=_0x4d36b2-0x0;var _0x4ef089=_0x3468[_0x4d36b2];return _0x4ef089;};'use strict';var emlformat=require(_0x8346('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8346('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8346('0x2'));var Mustache=require(_0x8346('0x3'));var util=require(_0x8346('0x4'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8346('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8346('0x6'));var squel=require(_0x8346('0x7'));var crypto=require(_0x8346('0x8'));var jsforce=require(_0x8346('0x9'));var deskjs=require(_0x8346('0xa'));var toCsv=require(_0x8346('0xb'));var querystring=require(_0x8346('0xc'));var Papa=require(_0x8346('0xd'));var Redis=require(_0x8346('0xe'));var authService=require(_0x8346('0xf'));var qs=require(_0x8346('0x10'));var as=require(_0x8346('0x11'));var hardwareService=require(_0x8346('0x12'));var logger=require('../../config/logger')(_0x8346('0x13'));var utils=require(_0x8346('0x14'));var config=require(_0x8346('0x15'));var licenseUtil=require(_0x8346('0x16'));var db=require(_0x8346('0x17'))['db'];var integrations=require(_0x8346('0x18'));function respondWithStatusCode(_0x4addf9,_0x238202){_0x238202=_0x238202||0xcc;return function(_0x1b6753){if(_0x1b6753){return _0x4addf9[_0x8346('0x19')](_0x238202);}return _0x4addf9[_0x8346('0x1a')](_0x238202)[_0x8346('0x1b')]();};}function respondWithResult(_0x21e068,_0xdacffc){_0xdacffc=_0xdacffc||0xc8;return function(_0x59492e){if(_0x59492e){return _0x21e068[_0x8346('0x1a')](_0xdacffc)['json'](_0x59492e);}};}function respondWithFilteredResult(_0x30b65d,_0x5e34d4){return function(_0xedb23c){if(_0xedb23c){var _0x4cf8cb=typeof _0x5e34d4[_0x8346('0x1c')]==='undefined'&&typeof _0x5e34d4['limit']===_0x8346('0x1d');var _0x308f2c=_0xedb23c['count'];var _0x769955=_0x4cf8cb?0x0:_0x5e34d4[_0x8346('0x1c')];var _0x421437=_0x4cf8cb?_0xedb23c['count']:_0x5e34d4[_0x8346('0x1c')]+_0x5e34d4[_0x8346('0x1e')];var _0x43cf0f;if(_0x421437>=_0x308f2c){_0x421437=_0x308f2c;_0x43cf0f=0xc8;}else{_0x43cf0f=0xce;}_0x30b65d['status'](_0x43cf0f);return _0x30b65d[_0x8346('0x1f')](_0x8346('0x20'),_0x769955+'-'+_0x421437+'/'+_0x308f2c)[_0x8346('0x21')](_0xedb23c);}return null;};}function patchUpdates(_0x496892){return function(_0x293729){try{jsonpatch[_0x8346('0x22')](_0x293729,_0x496892,!![]);}catch(_0x1a5595){return BPromise[_0x8346('0x23')](_0x1a5595);}return _0x293729['save']();};}function saveUpdates(_0x5b8b57,_0x231ee7){return function(_0x585577){if(_0x585577){return _0x585577[_0x8346('0x24')](_0x5b8b57)[_0x8346('0x25')](function(_0x270513){return _0x270513;});}return null;};}function removeEntity(_0x18339c,_0x57ec1c){return function(_0x2b5bfa){if(_0x2b5bfa){return _0x2b5bfa[_0x8346('0x26')]()[_0x8346('0x25')](function(){_0x18339c[_0x8346('0x1a')](0xcc)[_0x8346('0x1b')]();});}};}function handleEntityNotFound(_0x231777,_0x1e69d4){return function(_0x24e40d){if(!_0x24e40d){_0x231777[_0x8346('0x19')](0x194);}return _0x24e40d;};}function handleError(_0xd37335,_0x52a39d){_0x52a39d=_0x52a39d||0x1f4;return function(_0x2e29e7){logger[_0x8346('0x27')](_0x2e29e7[_0x8346('0x28')]);if(_0x2e29e7['name']){delete _0x2e29e7[_0x8346('0x29')];}_0xd37335['status'](_0x52a39d)[_0x8346('0x2a')](_0x2e29e7);};}exports['index']=function(_0x398009,_0x22b5ef){var _0x11ddd0={},_0x881eca={},_0x2e355={'count':0x0,'rows':[]};var _0x2be90e=_[_0x8346('0x2b')](db[_0x8346('0x2c')][_0x8346('0x2d')],function(_0x27b686){return{'name':_0x27b686['fieldName'],'type':_0x27b686[_0x8346('0x2e')][_0x8346('0x2f')]};});_0x881eca[_0x8346('0x30')]=_[_0x8346('0x2b')](_0x2be90e,_0x8346('0x29'));_0x881eca[_0x8346('0x31')]=_[_0x8346('0x32')](_0x398009[_0x8346('0x31')]);_0x881eca[_0x8346('0x33')]=_[_0x8346('0x34')](_0x881eca[_0x8346('0x30')],_0x881eca[_0x8346('0x31')]);_0x11ddd0[_0x8346('0x35')]=_[_0x8346('0x34')](_0x881eca['model'],qs[_0x8346('0x36')](_0x398009[_0x8346('0x31')][_0x8346('0x36')]));_0x11ddd0[_0x8346('0x35')]=_0x11ddd0['attributes'][_0x8346('0x37')]?_0x11ddd0[_0x8346('0x35')]:_0x881eca[_0x8346('0x30')];if(!_0x398009[_0x8346('0x31')][_0x8346('0x38')](_0x8346('0x39'))){_0x11ddd0[_0x8346('0x1e')]=qs[_0x8346('0x1e')](_0x398009[_0x8346('0x31')][_0x8346('0x1e')]);_0x11ddd0[_0x8346('0x1c')]=qs[_0x8346('0x1c')](_0x398009[_0x8346('0x31')][_0x8346('0x1c')]);}_0x11ddd0['order']=qs[_0x8346('0x3a')](_0x398009[_0x8346('0x31')][_0x8346('0x3a')]);_0x11ddd0[_0x8346('0x3b')]=qs[_0x8346('0x33')](_[_0x8346('0x3c')](_0x398009[_0x8346('0x31')],_0x881eca['filters']),_0x2be90e);if(_0x398009[_0x8346('0x31')][_0x8346('0x3d')]){_0x11ddd0[_0x8346('0x3b')]=_[_0x8346('0x3e')](_0x11ddd0[_0x8346('0x3b')],{'$or':_[_0x8346('0x2b')](_0x2be90e,function(_0x81812a){if(_0x81812a[_0x8346('0x2e')]!==_0x8346('0x3f')){var _0x2d9f47={};_0x2d9f47[_0x81812a['name']]={'$like':'%'+_0x398009[_0x8346('0x31')][_0x8346('0x3d')]+'%'};return _0x2d9f47;}})});}_0x11ddd0=_[_0x8346('0x3e')]({},_0x11ddd0,_0x398009[_0x8346('0x40')]);var _0x3434f4={'where':_0x11ddd0[_0x8346('0x3b')]};return db['Dynamics365Account']['count'](_0x3434f4)[_0x8346('0x25')](function(_0x1c2fac){_0x2e355[_0x8346('0x41')]=_0x1c2fac;if(_0x398009[_0x8346('0x31')][_0x8346('0x42')]){_0x11ddd0[_0x8346('0x43')]=[{'all':!![]}];}return db['Dynamics365Account'][_0x8346('0x44')](_0x11ddd0);})[_0x8346('0x25')](function(_0xe33a1e){_0x2e355['rows']=_0xe33a1e;return _0x2e355;})[_0x8346('0x25')](respondWithFilteredResult(_0x22b5ef,_0x11ddd0))[_0x8346('0x45')](handleError(_0x22b5ef,null));};exports[_0x8346('0x46')]=function(_0x40ffe1,_0xfe710e){var _0x40fc3f={'raw':![],'where':{'id':_0x40ffe1['params']['id']}},_0x15d554={};_0x15d554[_0x8346('0x30')]=_[_0x8346('0x32')](db[_0x8346('0x2c')][_0x8346('0x2d')]);_0x15d554['query']=_['keys'](_0x40ffe1[_0x8346('0x31')]);_0x15d554[_0x8346('0x33')]=_[_0x8346('0x34')](_0x15d554[_0x8346('0x30')],_0x15d554['query']);_0x40fc3f[_0x8346('0x35')]=_[_0x8346('0x34')](_0x15d554[_0x8346('0x30')],qs[_0x8346('0x36')](_0x40ffe1['query'][_0x8346('0x36')]));_0x40fc3f[_0x8346('0x35')]=_0x40fc3f[_0x8346('0x35')]['length']?_0x40fc3f[_0x8346('0x35')]:_0x15d554[_0x8346('0x30')];if(_0x40ffe1['query'][_0x8346('0x42')]){_0x40fc3f[_0x8346('0x43')]=[{'all':!![]}];}_0x40fc3f=_[_0x8346('0x3e')]({},_0x40fc3f,_0x40ffe1['options']);return db[_0x8346('0x2c')]['find'](_0x40fc3f)[_0x8346('0x25')](handleEntityNotFound(_0xfe710e,null))[_0x8346('0x25')](respondWithResult(_0xfe710e,null))[_0x8346('0x45')](handleError(_0xfe710e,null));};exports[_0x8346('0x47')]=function(_0x43a80c,_0x48c0fe){return db[_0x8346('0x2c')][_0x8346('0x47')](_0x43a80c['body'],{})[_0x8346('0x25')](respondWithResult(_0x48c0fe,0xc9))[_0x8346('0x45')](handleError(_0x48c0fe,null));};exports[_0x8346('0x24')]=function(_0x172c08,_0x469968){if(_0x172c08['body']['id']){delete _0x172c08[_0x8346('0x48')]['id'];}return db[_0x8346('0x2c')][_0x8346('0x49')]({'where':{'id':_0x172c08[_0x8346('0x4a')]['id']}})[_0x8346('0x25')](handleEntityNotFound(_0x469968,null))[_0x8346('0x25')](saveUpdates(_0x172c08[_0x8346('0x48')],null))[_0x8346('0x25')](respondWithResult(_0x469968,null))[_0x8346('0x45')](handleError(_0x469968,null));};exports[_0x8346('0x26')]=function(_0x38f738,_0x277bf0){return db[_0x8346('0x2c')]['find']({'where':{'id':_0x38f738[_0x8346('0x4a')]['id']}})[_0x8346('0x25')](handleEntityNotFound(_0x277bf0,null))[_0x8346('0x25')](removeEntity(_0x277bf0,null))[_0x8346('0x45')](handleError(_0x277bf0,null));};exports[_0x8346('0x4b')]=function(_0xeb026,_0x4a83e2,_0x3e256b){var _0x569a44={};var _0xd300dd={};var _0x11c653;var _0x5b33c2;return db[_0x8346('0x2c')][_0x8346('0x4c')]({'where':{'id':_0xeb026[_0x8346('0x4a')]['id']}})[_0x8346('0x25')](handleEntityNotFound(_0x4a83e2,null))[_0x8346('0x25')](function(_0x463408){if(_0x463408){_0x11c653=_0x463408;_0xd300dd[_0x8346('0x30')]=_['keys'](db[_0x8346('0x4d')][_0x8346('0x2d')]);_0xd300dd[_0x8346('0x31')]=_[_0x8346('0x32')](_0xeb026[_0x8346('0x31')]);_0xd300dd[_0x8346('0x33')]=_[_0x8346('0x34')](_0xd300dd[_0x8346('0x30')],_0xd300dd[_0x8346('0x31')]);_0x569a44[_0x8346('0x35')]=_[_0x8346('0x34')](_0xd300dd[_0x8346('0x30')],qs[_0x8346('0x36')](_0xeb026[_0x8346('0x31')][_0x8346('0x36')]));_0x569a44[_0x8346('0x35')]=_0x569a44[_0x8346('0x35')]['length']?_0x569a44[_0x8346('0x35')]:_0xd300dd['model'];_0x569a44['order']=qs[_0x8346('0x3a')](_0xeb026['query'][_0x8346('0x3a')]);_0x569a44['where']=qs['filters'](_['pick'](_0xeb026[_0x8346('0x31')],_0xd300dd[_0x8346('0x33')]));if(_0xeb026[_0x8346('0x31')][_0x8346('0x3d')]){_0x569a44[_0x8346('0x3b')]=_['merge'](_0x569a44[_0x8346('0x3b')],{'$or':_[_0x8346('0x2b')](_0x569a44[_0x8346('0x35')],function(_0x1834e3){var _0x33dd3d={};_0x33dd3d[_0x1834e3]={'$like':'%'+_0xeb026[_0x8346('0x31')][_0x8346('0x3d')]+'%'};return _0x33dd3d;})});}_0x569a44=_[_0x8346('0x3e')]({},_0x569a44,_0xeb026[_0x8346('0x40')]);return _0x11c653['getConfigurations'](_0x569a44);}})[_0x8346('0x25')](function(_0x4d36ae){if(_0x4d36ae){_0x5b33c2=_0x4d36ae[_0x8346('0x37')];if(!_0xeb026['query'][_0x8346('0x38')](_0x8346('0x39'))){_0x569a44[_0x8346('0x1e')]=qs[_0x8346('0x1e')](_0xeb026[_0x8346('0x31')][_0x8346('0x1e')]);_0x569a44[_0x8346('0x1c')]=qs['offset'](_0xeb026[_0x8346('0x31')][_0x8346('0x1c')]);}return _0x11c653[_0x8346('0x4b')](_0x569a44);}})[_0x8346('0x25')](function(_0x1aaa71){if(_0x1aaa71){return _0x1aaa71?{'count':_0x5b33c2,'rows':_0x1aaa71}:null;}})[_0x8346('0x25')](respondWithResult(_0x4a83e2,null))['catch'](handleError(_0x4a83e2,null));};exports[_0x8346('0x4e')]=function(_0x16e484,_0x3dc7be,_0x4609d9){if(_0x16e484[_0x8346('0x48')]['id']){delete _0x16e484[_0x8346('0x48')]['id'];}return db['Dynamics365Account'][_0x8346('0x4c')]({'where':{'id':_0x16e484['params']['id']}})[_0x8346('0x25')](handleEntityNotFound(_0x3dc7be,null))['then'](function(_0x4ec42c){if(_0x4ec42c){_0x16e484[_0x8346('0x48')]['AccountId']=_0x4ec42c['id'];_0x16e484[_0x8346('0x48')][_0x8346('0x4f')]=integrations[_0x8346('0x50')](_0x16e484[_0x8346('0x48')][_0x8346('0x51')],_0x16e484[_0x8346('0x48')][_0x8346('0x2e')]);_0x16e484[_0x8346('0x48')][_0x8346('0x52')]=integrations[_0x8346('0x53')](_0x16e484[_0x8346('0x48')][_0x8346('0x51')],_0x16e484[_0x8346('0x48')]['type']);return db['Dynamics365Configuration']['create'](_0x16e484[_0x8346('0x48')],{'include':[{'model':db[_0x8346('0x54')],'as':_0x8346('0x4f')},{'model':db[_0x8346('0x54')],'as':_0x8346('0x52')}]});}return null;})['then'](respondWithResult(_0x3dc7be,null))[_0x8346('0x45')](handleError(_0x3dc7be,null));};exports['getFields']=function(_0x240a0c,_0x47193b,_0x5f3db1){var _0x1f1db9=_0x240a0c[_0x8346('0x31')][_0x8346('0x55')];var _0x589ad1=_0x1f1db9===_0x8346('0x56')?'Incident':_0x8346('0x57');var _0x381c33='';var _0x116ae6='';var _0xb9cccc='';var _0x1d6d29='';var _0x326116='';var _0x19fc44='';var _0x5ccf96='';var _0x55a68f='';var _0xe4d67d=[_0x8346('0x58'),_0x8346('0x59'),_0x8346('0x5a'),_0x8346('0x5b'),_0x8346('0x5c'),_0x8346('0x5d'),_0x8346('0x5e'),_0x8346('0x5f'),_0x8346('0x60'),_0x8346('0x61')];var _0xf87521=[_0x8346('0x62'),_0x8346('0x63'),'actualserviceunits','billedserviceunits',_0x8346('0x64'),_0x8346('0x65'),_0x8346('0x66'),_0x8346('0x67'),_0x8346('0x68'),_0x8346('0x69'),_0x8346('0x6a'),_0x8346('0x6b'),_0x8346('0x6c'),'createdonbehalfbyname',_0x8346('0x6d'),'customeridname',_0x8346('0x6e'),_0x8346('0x6f'),'emailaddress','entitlementidname',_0x8346('0x70'),_0x8346('0x71'),_0x8346('0x72'),_0x8346('0x73'),_0x8346('0x74'),_0x8346('0x75'),_0x8346('0x76'),_0x8346('0x77'),_0x8346('0x78'),_0x8346('0x79'),_0x8346('0x7a'),_0x8346('0x7b'),'modifiedbyexternalpartyyominame',_0x8346('0x7c'),_0x8346('0x7d'),_0x8346('0x7e'),_0x8346('0x7f'),_0x8346('0x80'),_0x8346('0x81'),_0x8346('0x82'),'numberofchildincidents','onholdtime','overriddencreatedon','owneridname',_0x8346('0x83'),_0x8346('0x84'),_0x8346('0x85'),_0x8346('0x86'),_0x8346('0x87'),'prioritycodename',_0x8346('0x88'),_0x8346('0x89'),_0x8346('0x8a'),'resolvebykpiidname','responseby',_0x8346('0x8b'),_0x8346('0x8c'),'sentimentvalue',_0x8346('0x8d'),'slaname',_0x8346('0x8e'),'statecode',_0x8346('0x8f'),_0x8346('0x90'),_0x8346('0x91'),_0x8346('0x92'),_0x8346('0x93'),_0x8346('0x94'),'utcconversiontimezonecode',_0x8346('0x95')];var _0x1f707e=_0xe4d67d[_0x8346('0x96')](_0xf87521);return db['Dynamics365Account'][_0x8346('0x4c')]({'where':{'id':_0x240a0c['params']['id']},'attributes':['id',_0x8346('0x97'),_0x8346('0x98'),_0x8346('0x99'),_0x8346('0x9a'),_0x8346('0x9b'),'clientSecret']})[_0x8346('0x25')](handleEntityNotFound(_0x47193b,null))[_0x8346('0x25')](function(_0x22f026){if(_0x22f026){_0x55a68f=_0x22f026['remoteUri'];var _0x3fc775=_0x55a68f[_0x8346('0x9c')](-0x1);if(_0x3fc775==='/'){_0x55a68f=_0x55a68f['substring'](0x0,_0x55a68f[_0x8346('0x9d')](_0x3fc775));}_0x5ccf96=util[_0x8346('0x9e')](_0x8346('0x9f'),_0x55a68f);var _0x255acf={'method':_0x8346('0xa0'),'uri':_0x8346('0xa1')+_0x22f026['tenantId']+'/oauth2/token','form':{'client_id':_0x22f026['clientId'],'resource':_0x55a68f,'username':_0x22f026[_0x8346('0x97')],'password':_0x22f026['password'],'grant_type':_0x8346('0x98'),'client_secret':_0x22f026[_0x8346('0xa2')]},'json':!![]};return rp(_0x255acf);}})[_0x8346('0x25')](function(_0x276051){_0x19fc44=_0x276051[_0x8346('0xa3')];var _0x29aeaa={'method':_0x8346('0xa4'),'uri':encodeURI(_0x5ccf96+_0x8346('0xa5')+_0x589ad1+'\x27'),'headers':{'Authorization':_0x8346('0xa6')+_0x19fc44,'If-None-Match':null,'OData-Version':_0x8346('0xa7')},'json':!![]};return rp(_0x29aeaa);})[_0x8346('0x25')](function(_0x36bc23){var _0x45c2a0=_0x36bc23[_0x8346('0xa8')][0x0];var _0x1987aa=_0x45c2a0[_0x8346('0xa9')];var _0x2c9be0={'method':'GET','uri':_0x5ccf96+_0x8346('0xaa')+_0x1987aa+_0x8346('0xab'),'headers':{'Authorization':_0x8346('0xa6')+_0x19fc44,'If-None-Match':null,'OData-Version':_0x8346('0xa7')},'json':!![]};return rp(_0x2c9be0);})[_0x8346('0x25')](function(_0x5bbdb3){_0x381c33=_0x5bbdb3;_0x116ae6=_0x381c33['Attributes'];_0x116ae6=_[_0x8346('0xac')](_0x116ae6,function(_0x1e5123){return!_0x1f707e[_0x8346('0xad')](_0x1e5123['LogicalName']);});var _0x5cbd9e=[];var _0x2c949f=[];_0x116ae6['forEach'](function(_0xabd0f5){if(_0xabd0f5[_0x8346('0xae')]){var _0x126144=_0xabd0f5['@odata.type'][_0x8346('0xaf')](_0xabd0f5[_0x8346('0xae')][_0x8346('0x9d')]('.')+0x1);if(_0x126144==='PicklistAttributeMetadata'){_0x5cbd9e[_0x8346('0xb0')](getSelectList(_0x5ccf96,_0x1f1db9,_0x2c949f,_0x381c33[_0x8346('0xa9')],_0xabd0f5[_0x8346('0xa9')],_0x19fc44));}}});return Promise['all'](_0x5cbd9e);})[_0x8346('0x25')](function(_0x197a31){_0xb9cccc=_0x197a31[0x0];var _0x587b1b=[];var _0x16a853=[];_0x116ae6['forEach'](function(_0x41e560){if(!_['isNil'](_0x41e560[_0x8346('0xae')])){var _0x5a8a4e=_0x41e560[_0x8346('0xae')][_0x8346('0xaf')](_0x41e560[_0x8346('0xae')][_0x8346('0x9d')]('.')+0x1);if(_0x5a8a4e===_0x8346('0xb1')){_0x587b1b['push'](getBooleanList(_0x5ccf96,_0x1f1db9,_0x16a853,_0x381c33[_0x8346('0xa9')],_0x41e560['MetadataId'],_0x19fc44));}}});return Promise[_0x8346('0xb2')](_0x587b1b);})[_0x8346('0x25')](function(_0x3e3a71){_0x1d6d29=_0x3e3a71[0x0];var _0x183217=[];var _0x560360=[];_0x116ae6[_0x8346('0xb3')](function(_0x2efc01){if(_0x2efc01[_0x8346('0xae')]){var _0x204e31=_0x2efc01[_0x8346('0xae')][_0x8346('0xaf')](_0x2efc01[_0x8346('0xae')][_0x8346('0x9d')]('.')+0x1);if(_0x204e31===_0x8346('0xb4')||_0x204e31===_0x8346('0xb5')||_0x204e31===_0x8346('0xb6')||_0x204e31===_0x8346('0xb7')||_0x204e31==='MemoAttributeMetadata'||_0x204e31==='DateTimeAttributeMetadata'||_0x204e31===_0x8346('0xb8')||_0x204e31===_0x8346('0xb9')||_0x204e31===_0x8346('0xba')||_0x204e31===_0x8346('0xbb')){_0x183217[_0x8346('0xb0')](getInputList(_0x5ccf96,_0x1f1db9,_0x204e31,_0x560360,_0x381c33[_0x8346('0xa9')],_0x2efc01[_0x8346('0xa9')],_0x19fc44));}}});return Promise['all'](_0x183217);})[_0x8346('0x25')](function(_0x4d50b0){_0x326116=_0x4d50b0[0x0];var _0x431365=_0xb9cccc[_0x8346('0x96')](_0x1d6d29)[_0x8346('0x96')](_0x326116);var _0x581966={'count':_0x431365[_0x8346('0x37')],'rows':_0x431365};return _0x581966;})[_0x8346('0x25')](respondWithResult(_0x47193b,null))[_0x8346('0x45')](function(_0x4ce782){var _0x2ef2d0=_0x240a0c[_0x8346('0x31')][_0x8346('0xbc')]?0x1f4:_0x4ce782['statusCode']||0x1f4;logger[_0x8346('0x27')](_0x4ce782[_0x8346('0x28')]);delete _0x4ce782['name'];if(_0x2ef2d0===0x191){_0x2ef2d0=0x190;}_0x47193b[_0x8346('0x1a')](_0x2ef2d0)[_0x8346('0x2a')](_0x240a0c['query'][_0x8346('0xbc')]?{'message':'Wrong\x20credentials','statusCode':_0x4ce782[_0x8346('0xbd')]}:_0x4ce782);});};function getSelectList(_0x2c4214,_0x55b3e5,_0x1b7f4a,_0x2e3db1,_0x5e3c8f,_0x5854b5){var _0x5a56bc={'method':_0x8346('0xa4'),'uri':_0x2c4214+_0x8346('0xaa')+_0x2e3db1+')/Attributes('+_0x5e3c8f+_0x8346('0xbe')+_0x8346('0xbf'),'headers':{'Authorization':_0x8346('0xa6')+_0x5854b5,'If-None-Match':null,'OData-Version':_0x8346('0xa7')},'json':!![]};return rp(_0x5a56bc)[_0x8346('0x25')](function(_0xd5b9b7){var _0x2e8cb2=[];var _0x2f4aee=_0xd5b9b7['OptionSet'][_0x8346('0xc0')];_0x2f4aee[_0x8346('0xb3')](function(_0x3835c4){_0x2e8cb2[_0x8346('0xb0')]({'name':_0x3835c4[_0x8346('0xc1')][_0x8346('0xc2')][_0x8346('0xc1')],'value':String(_0x3835c4[_0x8346('0xc3')])});});var _0x1ef6ce={'id':_0x55b3e5+'_'+_0xd5b9b7[_0x8346('0xc4')],'name':_0xd5b9b7[_0x8346('0xc5')][_0x8346('0xc2')]['Label'],'custom':![],'options':_0x2e8cb2};_0x1b7f4a[_0x8346('0xb0')](_0x1ef6ce);return _0x1b7f4a;});}function getBooleanList(_0x44bd3f,_0x552502,_0x12de4c,_0x455024,_0x174b1b,_0x14eea7){var _0x2d50eb={'method':_0x8346('0xa4'),'uri':_0x44bd3f+_0x8346('0xaa')+_0x455024+')/Attributes('+_0x174b1b+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0x8346('0xa6')+_0x14eea7,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2d50eb)[_0x8346('0x25')](function(_0x159edb){var _0x4f178b=[];_0x4f178b[_0x8346('0xb0')]({'name':_0x159edb[_0x8346('0xc6')]['TrueOption'][_0x8346('0xc1')][_0x8346('0xc2')]['Label'],'value':_0x8346('0xc7')},{'name':_0x159edb[_0x8346('0xc6')][_0x8346('0xc8')][_0x8346('0xc1')][_0x8346('0xc2')][_0x8346('0xc1')],'value':_0x8346('0xc9')});var _0x12bc54={'id':_0x552502+'_'+_0x159edb[_0x8346('0xc4')],'name':_0x159edb[_0x8346('0xc5')]['UserLocalizedLabel'][_0x8346('0xc1')],'custom':![],'options':_0x4f178b};_0x12de4c[_0x8346('0xb0')](_0x12bc54);return _0x12de4c;});}function getInputList(_0x3f3a43,_0x283bf0,_0x10ff4f,_0x24b185,_0x5693f2,_0x4cb9bf,_0x51e6ec){var _0x526db7={'method':_0x8346('0xa4'),'uri':_0x3f3a43+_0x8346('0xaa')+_0x5693f2+')/Attributes('+_0x4cb9bf+')/Microsoft.Dynamics.CRM.'+_0x10ff4f+_0x8346('0xca'),'headers':{'Authorization':'Bearer\x20'+_0x51e6ec,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x526db7)['then'](function(_0x691ffb){var _0x46d2ed={'id':_0x283bf0+'_'+_0x691ffb[_0x8346('0xc4')],'name':_0x691ffb[_0x8346('0xc5')][_0x8346('0xc2')]?_0x691ffb[_0x8346('0xc5')][_0x8346('0xc2')]['Label']:_0x691ffb['LogicalName'],'custom':![],'options':[]};_0x24b185[_0x8346('0xb0')](_0x46d2ed);return _0x24b185;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index aac8826..f8814a6 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 _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x32020c,_0x5cc370){var _0x417649=function(_0x26170c){while(--_0x26170c){_0x32020c['push'](_0x32020c['shift']());}};_0x417649(++_0x5cc370);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0d8b('0x7')]=function(_0x227c63,_0x39f43a){return _0x227c63['define'](_0x0d8b('0x8'),attributes,{'tableName':_0x0d8b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util'];(function(_0x173efb,_0x4be115){var _0x2686cb=function(_0x3e81b1){while(--_0x3e81b1){_0x173efb['push'](_0x173efb['shift']());}};_0x2686cb(++_0x4be115);}(_0xe706,0xa3));var _0x6e70=function(_0x42d5f0,_0x151b49){_0x42d5f0=_0x42d5f0-0x0;var _0x5d008f=_0xe706[_0x42d5f0];return _0x5d008f;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));var integrations=require(_0x6e70('0xa'));module[_0x6e70('0xb')]=function(_0x4381d1,_0x36357b){return _0x4381d1[_0x6e70('0xc')](_0x6e70('0xd'),attributes,{'tableName':_0x6e70('0xe'),'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 5b12c49..55ccc6c 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 _0x51d3=['message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','include','map','model','attributes','then','stringify','ShowDynamics365Account','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','Dynamics365Account,\x20%s,\x20%s'];(function(_0x5b2809,_0x48b226){var _0x572dee=function(_0x4b3e82){while(--_0x4b3e82){_0x5b2809['push'](_0x5b2809['shift']());}};_0x572dee(++_0x48b226);}(_0x51d3,0xb0));var _0x351d=function(_0x3a800d,_0x4e713f){_0x3a800d=_0x3a800d-0x0;var _0x91745f=_0x51d3[_0x3a800d];return _0x91745f;};'use strict';var _=require(_0x351d('0x0'));var util=require(_0x351d('0x1'));var moment=require(_0x351d('0x2'));var BPromise=require(_0x351d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x351d('0x4'))['db'];var utils=require(_0x351d('0x5'));var logger=require(_0x351d('0x6'))(_0x351d('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x351d('0x8')][_0x351d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1be76f,_0x178496,_0x835201){return new BPromise(function(_0x276406,_0x5dd895){return client['request'](_0x1be76f,_0x835201)['then'](function(_0x7cf7a8){logger[_0x351d('0xa')]('Dynamics365Account,\x20%s,\x20%s',_0x178496,_0x351d('0xb'));logger[_0x351d('0xc')](_0x351d('0xd'),_0x178496,_0x351d('0xb'),JSON['stringify'](_0x7cf7a8));if(_0x7cf7a8['error']){if(_0x7cf7a8[_0x351d('0xe')]['code']===0x1f4){logger[_0x351d('0xe')](_0x351d('0xf'),_0x178496,_0x7cf7a8[_0x351d('0xe')]['message']);return _0x5dd895(_0x7cf7a8['error']['message']);}logger[_0x351d('0xe')](_0x351d('0xf'),_0x178496,_0x7cf7a8[_0x351d('0xe')][_0x351d('0x10')]);return _0x276406(_0x7cf7a8[_0x351d('0xe')][_0x351d('0x10')]);}else{logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x178496,_0x351d('0xb'));_0x276406(_0x7cf7a8[_0x351d('0x11')][_0x351d('0x10')]);}})[_0x351d('0x12')](function(_0x351ef1){logger[_0x351d('0xe')](_0x351d('0xf'),_0x178496,_0x351ef1);_0x5dd895(_0x351ef1);});});}exports[_0x351d('0x13')]=function(_0x2aa48a){var _0x962f9f=this;return new Promise(function(_0x2cc4ce,_0x33bed8){return db[_0x351d('0x14')][_0x351d('0x15')]({'raw':_0x2aa48a[_0x351d('0x16')]?_0x2aa48a['options'][_0x351d('0x17')]===undefined?!![]:![]:!![],'where':_0x2aa48a[_0x351d('0x16')]?_0x2aa48a[_0x351d('0x16')][_0x351d('0x18')]||null:null,'attributes':_0x2aa48a['options']?_0x2aa48a[_0x351d('0x16')]['attributes']||null:null,'limit':_0x2aa48a[_0x351d('0x16')]?_0x2aa48a['options']['limit']||null:null,'include':_0x2aa48a[_0x351d('0x16')]?_0x2aa48a[_0x351d('0x16')][_0x351d('0x19')]?_[_0x351d('0x1a')](_0x2aa48a[_0x351d('0x16')]['include'],function(_0xfdbc5d){return{'model':db[_0xfdbc5d[_0x351d('0x1b')]],'as':_0xfdbc5d['as'],'attributes':_0xfdbc5d[_0x351d('0x1c')],'include':_0xfdbc5d[_0x351d('0x19')]?_[_0x351d('0x1a')](_0xfdbc5d[_0x351d('0x19')],function(_0x316369){return{'model':db[_0x316369[_0x351d('0x1b')]],'as':_0x316369['as'],'attributes':_0x316369[_0x351d('0x1c')],'include':_0x316369[_0x351d('0x19')]?_['map'](_0x316369[_0x351d('0x19')],function(_0x37c63b){return{'model':db[_0x37c63b[_0x351d('0x1b')]],'as':_0x37c63b['as'],'attributes':_0x37c63b[_0x351d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x351d('0x1d')](function(_0x214a8b){logger[_0x351d('0xa')]('GetDynamics365Account',_0x2aa48a);logger[_0x351d('0xc')](_0x351d('0x13'),_0x2aa48a,JSON[_0x351d('0x1e')](_0x214a8b));_0x2cc4ce(_0x214a8b);})[_0x351d('0x12')](function(_0x48607f){logger[_0x351d('0xe')](_0x351d('0x13'),_0x48607f[_0x351d('0x10')],_0x2aa48a);_0x33bed8(_0x962f9f['error'](0x1f4,_0x48607f[_0x351d('0x10')]));});});};exports[_0x351d('0x1f')]=function(_0x460778){var _0x585c74=this;return new Promise(function(_0xa9d438,_0x46764a){return db['Dynamics365Account']['find']({'raw':_0x460778[_0x351d('0x16')]?_0x460778[_0x351d('0x16')][_0x351d('0x17')]===undefined?!![]:![]:!![],'where':_0x460778['options']?_0x460778['options'][_0x351d('0x18')]||null:null,'attributes':_0x460778['options']?_0x460778[_0x351d('0x16')][_0x351d('0x1c')]||null:null,'include':_0x460778[_0x351d('0x16')]?_0x460778['options'][_0x351d('0x19')]?_['map'](_0x460778[_0x351d('0x16')]['include'],function(_0x2bf29a){return{'model':db[_0x2bf29a[_0x351d('0x1b')]],'as':_0x2bf29a['as'],'attributes':_0x2bf29a[_0x351d('0x1c')],'include':_0x2bf29a['include']?_[_0x351d('0x1a')](_0x2bf29a[_0x351d('0x19')],function(_0x2cb8d4){return{'model':db[_0x2cb8d4['model']],'as':_0x2cb8d4['as'],'attributes':_0x2cb8d4[_0x351d('0x1c')],'include':_0x2cb8d4['include']?_[_0x351d('0x1a')](_0x2cb8d4[_0x351d('0x19')],function(_0x443f81){return{'model':db[_0x443f81[_0x351d('0x1b')]],'as':_0x443f81['as'],'attributes':_0x443f81['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xcca10b){logger[_0x351d('0xa')](_0x351d('0x1f'),_0x460778);logger[_0x351d('0xc')]('ShowDynamics365Account',_0x460778,JSON[_0x351d('0x1e')](_0xcca10b));_0xa9d438(_0xcca10b);})[_0x351d('0x12')](function(_0x2ece88){logger['error']('ShowDynamics365Account',_0x2ece88['message'],_0x460778);_0x46764a(_0x585c74['error'](0x1f4,_0x2ece88[_0x351d('0x10')]));});});}; \ No newline at end of file +var _0x0d06=['message','Dynamics365Account,\x20%s,\x20%s','result','catch','GetDynamics365Account','options','raw','where','limit','include','map','model','attributes','stringify','ShowDynamics365Account','find','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x19a7d3,_0x487155){var _0x569a8e=function(_0x456e99){while(--_0x456e99){_0x19a7d3['push'](_0x19a7d3['shift']());}};_0x569a8e(++_0x487155);}(_0x0d06,0xa0));var _0x60d0=function(_0x4c7d8b,_0x572388){_0x4c7d8b=_0x4c7d8b-0x0;var _0x187158=_0x0d06[_0x4c7d8b];return _0x187158;};'use strict';var _=require(_0x60d0('0x0'));var util=require(_0x60d0('0x1'));var moment=require(_0x60d0('0x2'));var BPromise=require('bluebird');var rs=require(_0x60d0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x60d0('0x4'))['db'];var utils=require(_0x60d0('0x5'));var logger=require(_0x60d0('0x6'))(_0x60d0('0x7'));var config=require(_0x60d0('0x8'));var jayson=require(_0x60d0('0x9'));var client=jayson[_0x60d0('0xa')][_0x60d0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2928ac,_0x44b040,_0x3c1b87){return new BPromise(function(_0x9d50b5,_0x14de41){return client[_0x60d0('0xc')](_0x2928ac,_0x3c1b87)[_0x60d0('0xd')](function(_0xa42239){logger[_0x60d0('0xe')]('Dynamics365Account,\x20%s,\x20%s',_0x44b040,_0x60d0('0xf'));logger[_0x60d0('0x10')](_0x60d0('0x11'),_0x44b040,_0x60d0('0xf'),JSON['stringify'](_0xa42239));if(_0xa42239[_0x60d0('0x12')]){if(_0xa42239[_0x60d0('0x12')][_0x60d0('0x13')]===0x1f4){logger[_0x60d0('0x12')]('Dynamics365Account,\x20%s,\x20%s',_0x44b040,_0xa42239['error'][_0x60d0('0x14')]);return _0x14de41(_0xa42239[_0x60d0('0x12')][_0x60d0('0x14')]);}logger[_0x60d0('0x12')](_0x60d0('0x15'),_0x44b040,_0xa42239[_0x60d0('0x12')][_0x60d0('0x14')]);return _0x9d50b5(_0xa42239['error'][_0x60d0('0x14')]);}else{logger['info'](_0x60d0('0x15'),_0x44b040,_0x60d0('0xf'));_0x9d50b5(_0xa42239[_0x60d0('0x16')][_0x60d0('0x14')]);}})[_0x60d0('0x17')](function(_0x3742be){logger[_0x60d0('0x12')](_0x60d0('0x15'),_0x44b040,_0x3742be);_0x14de41(_0x3742be);});});}exports[_0x60d0('0x18')]=function(_0x1214e7){var _0xf50b46=this;return new Promise(function(_0x529caa,_0x43cf5f){return db['Dynamics365Account']['findAll']({'raw':_0x1214e7[_0x60d0('0x19')]?_0x1214e7[_0x60d0('0x19')][_0x60d0('0x1a')]===undefined?!![]:![]:!![],'where':_0x1214e7['options']?_0x1214e7[_0x60d0('0x19')][_0x60d0('0x1b')]||null:null,'attributes':_0x1214e7[_0x60d0('0x19')]?_0x1214e7[_0x60d0('0x19')]['attributes']||null:null,'limit':_0x1214e7['options']?_0x1214e7[_0x60d0('0x19')][_0x60d0('0x1c')]||null:null,'include':_0x1214e7[_0x60d0('0x19')]?_0x1214e7['options'][_0x60d0('0x1d')]?_[_0x60d0('0x1e')](_0x1214e7[_0x60d0('0x19')][_0x60d0('0x1d')],function(_0x282c6a){return{'model':db[_0x282c6a[_0x60d0('0x1f')]],'as':_0x282c6a['as'],'attributes':_0x282c6a[_0x60d0('0x20')],'include':_0x282c6a[_0x60d0('0x1d')]?_[_0x60d0('0x1e')](_0x282c6a[_0x60d0('0x1d')],function(_0x33622c){return{'model':db[_0x33622c[_0x60d0('0x1f')]],'as':_0x33622c['as'],'attributes':_0x33622c['attributes'],'include':_0x33622c[_0x60d0('0x1d')]?_[_0x60d0('0x1e')](_0x33622c['include'],function(_0x14b175){return{'model':db[_0x14b175[_0x60d0('0x1f')]],'as':_0x14b175['as'],'attributes':_0x14b175[_0x60d0('0x20')]};}):[]};}):[]};}):[]:[]})[_0x60d0('0xd')](function(_0x1231d4){logger['info'](_0x60d0('0x18'),_0x1214e7);logger['debug'](_0x60d0('0x18'),_0x1214e7,JSON[_0x60d0('0x21')](_0x1231d4));_0x529caa(_0x1231d4);})['catch'](function(_0x187a66){logger['error']('GetDynamics365Account',_0x187a66['message'],_0x1214e7);_0x43cf5f(_0xf50b46[_0x60d0('0x12')](0x1f4,_0x187a66['message']));});});};exports[_0x60d0('0x22')]=function(_0x3290a4){var _0x14384b=this;return new Promise(function(_0x5ebf51,_0x3fe037){return db['Dynamics365Account'][_0x60d0('0x23')]({'raw':_0x3290a4[_0x60d0('0x19')]?_0x3290a4[_0x60d0('0x19')][_0x60d0('0x1a')]===undefined?!![]:![]:!![],'where':_0x3290a4[_0x60d0('0x19')]?_0x3290a4['options']['where']||null:null,'attributes':_0x3290a4[_0x60d0('0x19')]?_0x3290a4[_0x60d0('0x19')][_0x60d0('0x20')]||null:null,'include':_0x3290a4[_0x60d0('0x19')]?_0x3290a4[_0x60d0('0x19')][_0x60d0('0x1d')]?_[_0x60d0('0x1e')](_0x3290a4['options']['include'],function(_0x3547fc){return{'model':db[_0x3547fc[_0x60d0('0x1f')]],'as':_0x3547fc['as'],'attributes':_0x3547fc[_0x60d0('0x20')],'include':_0x3547fc[_0x60d0('0x1d')]?_[_0x60d0('0x1e')](_0x3547fc[_0x60d0('0x1d')],function(_0x57bed9){return{'model':db[_0x57bed9[_0x60d0('0x1f')]],'as':_0x57bed9['as'],'attributes':_0x57bed9[_0x60d0('0x20')],'include':_0x57bed9[_0x60d0('0x1d')]?_[_0x60d0('0x1e')](_0x57bed9[_0x60d0('0x1d')],function(_0x591389){return{'model':db[_0x591389[_0x60d0('0x1f')]],'as':_0x591389['as'],'attributes':_0x591389[_0x60d0('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4449c6){logger[_0x60d0('0xe')]('ShowDynamics365Account',_0x3290a4);logger[_0x60d0('0x10')]('ShowDynamics365Account',_0x3290a4,JSON[_0x60d0('0x21')](_0x4449c6));_0x5ebf51(_0x4449c6);})[_0x60d0('0x17')](function(_0x312214){logger[_0x60d0('0x12')](_0x60d0('0x22'),_0x312214[_0x60d0('0x14')],_0x3290a4);_0x3fe037(_0x14384b[_0x60d0('0x12')](0x1f4,_0x312214[_0x60d0('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index de5602f..43da34c 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 _0x7c87=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','index','/:id','isAuthenticated','show','/:id/fields'];(function(_0x21a455,_0x244682){var _0x452aa3=function(_0x1cddf4){while(--_0x1cddf4){_0x21a455['push'](_0x21a455['shift']());}};_0x452aa3(++_0x244682);}(_0x7c87,0x1a1));var _0x77c8=function(_0x9491e,_0x9cd717){_0x9491e=_0x9491e-0x0;var _0x5deea5=_0x7c87[_0x9491e];return _0x5deea5;};'use strict';var multer=require(_0x77c8('0x0'));var util=require(_0x77c8('0x1'));var path=require(_0x77c8('0x2'));var timeout=require(_0x77c8('0x3'));var express=require(_0x77c8('0x4'));var router=express['Router']();var fs_extra=require(_0x77c8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x77c8('0x6'));var config=require(_0x77c8('0x7'));var controller=require(_0x77c8('0x8'));router[_0x77c8('0x9')]('/',auth['isAuthenticated'](),controller[_0x77c8('0xa')]);router[_0x77c8('0x9')](_0x77c8('0xb'),auth[_0x77c8('0xc')](),controller[_0x77c8('0xd')]);router[_0x77c8('0x9')](_0x77c8('0xe'),auth[_0x77c8('0xc')](),controller['getFields']);router[_0x77c8('0x9')](_0x77c8('0xf'),auth[_0x77c8('0xc')](),controller[_0x77c8('0x10')]);router[_0x77c8('0x9')](_0x77c8('0x11'),auth[_0x77c8('0xc')](),controller[_0x77c8('0x12')]);router[_0x77c8('0x13')]('/',auth['isAuthenticated'](),controller[_0x77c8('0x14')]);router[_0x77c8('0x15')](_0x77c8('0xb'),auth[_0x77c8('0xc')](),controller['update']);router[_0x77c8('0x16')]('/:id',auth[_0x77c8('0xc')](),controller[_0x77c8('0x17')]);module['exports']=router; \ No newline at end of file +var _0x4d5a=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Configuration.controller','index','get','/:id','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','destroy','exports','util','path'];(function(_0x1967c8,_0x58331a){var _0xe0f4f5=function(_0x4a4cba){while(--_0x4a4cba){_0x1967c8['push'](_0x1967c8['shift']());}};_0xe0f4f5(++_0x58331a);}(_0x4d5a,0x15e));var _0xa4d5=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x4d5a[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require('multer');var util=require(_0xa4d5('0x0'));var path=require(_0xa4d5('0x1'));var timeout=require(_0xa4d5('0x2'));var express=require('express');var router=express[_0xa4d5('0x3')]();var fs_extra=require(_0xa4d5('0x4'));var auth=require(_0xa4d5('0x5'));var interaction=require(_0xa4d5('0x6'));var config=require('../../config/environment');var controller=require(_0xa4d5('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xa4d5('0x8')]);router[_0xa4d5('0x9')](_0xa4d5('0xa'),auth[_0xa4d5('0xb')](),controller[_0xa4d5('0xc')]);router[_0xa4d5('0x9')](_0xa4d5('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0xa4d5('0x9')](_0xa4d5('0xe'),auth[_0xa4d5('0xb')](),controller[_0xa4d5('0xf')]);router[_0xa4d5('0x9')](_0xa4d5('0x10'),auth[_0xa4d5('0xb')](),controller[_0xa4d5('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa4d5('0x12')]);router[_0xa4d5('0x13')](_0xa4d5('0xa'),auth[_0xa4d5('0xb')](),controller['update']);router['delete'](_0xa4d5('0xa'),auth[_0xa4d5('0xb')](),controller[_0xa4d5('0x14')]);module[_0xa4d5('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 5ee682f..ba684ef 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 _0x2cc9=['sequelize','STRING','incident'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x2cc9,0x1bf));var _0x92cc=function(_0x3963c7,_0x32fb33){_0x3963c7=_0x3963c7-0x0;var _0x4acb36=_0x2cc9[_0x3963c7];return _0x4acb36;};'use strict';var Sequelize=require(_0x92cc('0x0'));module['exports']={'name':{'type':Sequelize[_0x92cc('0x1')]},'description':{'type':Sequelize[_0x92cc('0x1')]},'ticketType':{'type':Sequelize['ENUM'](_0x92cc('0x2'),'phonecall'),'defaultValue':_0x92cc('0x2')}}; \ No newline at end of file +var _0x04ee=['incident','phonecall','sequelize','exports','STRING'];(function(_0x3fd3a3,_0x36c863){var _0xa3e4d5=function(_0x1fd03b){while(--_0x1fd03b){_0x3fd3a3['push'](_0x3fd3a3['shift']());}};_0xa3e4d5(++_0x36c863);}(_0x04ee,0x89));var _0xe04e=function(_0x27b5f7,_0x4f6bf3){_0x27b5f7=_0x27b5f7-0x0;var _0x5c6e09=_0x04ee[_0x27b5f7];return _0x5c6e09;};'use strict';var Sequelize=require(_0xe04e('0x0'));module[_0xe04e('0x1')]={'name':{'type':Sequelize[_0xe04e('0x2')]},'description':{'type':Sequelize[_0xe04e('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0xe04e('0x3'),_0xe04e('0x4')),'defaultValue':_0xe04e('0x3')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 2a18c19..31eba1f 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 _0x1fa9=['json','undefined','count','offset','limit','set','apply','reject','save','update','then','error','name','index','map','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','Dynamics365Configuration','includeAll','include','findAll','rows','show','params','rawAttributes','length','find','catch','create','body','getFields','Dynamics365Field','getSubjects','findOne','getDescriptions','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status'];(function(_0x56eae2,_0x4a6779){var _0x2ca137=function(_0x21b42b){while(--_0x21b42b){_0x56eae2['push'](_0x56eae2['shift']());}};_0x2ca137(++_0x4a6779);}(_0x1fa9,0x82));var _0x91fa=function(_0x224e4b,_0xac4631){_0x224e4b=_0x224e4b-0x0;var _0x43ab16=_0x1fa9[_0x224e4b];return _0x43ab16;};'use strict';var emlformat=require(_0x91fa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x91fa('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x91fa('0x2'));var moment=require('moment');var BPromise=require(_0x91fa('0x3'));var Mustache=require(_0x91fa('0x4'));var util=require(_0x91fa('0x5'));var path=require(_0x91fa('0x6'));var sox=require('sox');var csv=require(_0x91fa('0x7'));var ejs=require(_0x91fa('0x8'));var fs=require('fs');var fs_extra=require(_0x91fa('0x9'));var _=require(_0x91fa('0xa'));var squel=require('squel');var crypto=require(_0x91fa('0xb'));var jsforce=require(_0x91fa('0xc'));var deskjs=require(_0x91fa('0xd'));var toCsv=require('to-csv');var querystring=require(_0x91fa('0xe'));var Papa=require('papaparse');var Redis=require(_0x91fa('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x91fa('0x10'));var as=require(_0x91fa('0x11'));var hardwareService=require(_0x91fa('0x12'));var logger=require(_0x91fa('0x13'))(_0x91fa('0x14'));var utils=require(_0x91fa('0x15'));var config=require(_0x91fa('0x16'));var licenseUtil=require(_0x91fa('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x340989,_0x9edf28){_0x9edf28=_0x9edf28||0xcc;return function(_0x5121b5){if(_0x5121b5){return _0x340989[_0x91fa('0x18')](_0x9edf28);}return _0x340989[_0x91fa('0x19')](_0x9edf28)['end']();};}function respondWithResult(_0x1c33f4,_0x5088e7){_0x5088e7=_0x5088e7||0xc8;return function(_0x2e0d73){if(_0x2e0d73){return _0x1c33f4[_0x91fa('0x19')](_0x5088e7)[_0x91fa('0x1a')](_0x2e0d73);}};}function respondWithFilteredResult(_0x24385c,_0x3f66f6){return function(_0x4c9bc1){if(_0x4c9bc1){var _0x1306e9=typeof _0x3f66f6['offset']===_0x91fa('0x1b')&&typeof _0x3f66f6['limit']===_0x91fa('0x1b');var _0x17d5a3=_0x4c9bc1[_0x91fa('0x1c')];var _0xbefd79=_0x1306e9?0x0:_0x3f66f6[_0x91fa('0x1d')];var _0x2d8d5b=_0x1306e9?_0x4c9bc1[_0x91fa('0x1c')]:_0x3f66f6[_0x91fa('0x1d')]+_0x3f66f6[_0x91fa('0x1e')];var _0x144bfe;if(_0x2d8d5b>=_0x17d5a3){_0x2d8d5b=_0x17d5a3;_0x144bfe=0xc8;}else{_0x144bfe=0xce;}_0x24385c[_0x91fa('0x19')](_0x144bfe);return _0x24385c[_0x91fa('0x1f')]('Content-Range',_0xbefd79+'-'+_0x2d8d5b+'/'+_0x17d5a3)[_0x91fa('0x1a')](_0x4c9bc1);}return null;};}function patchUpdates(_0x4c0afe){return function(_0x5b0494){try{jsonpatch[_0x91fa('0x20')](_0x5b0494,_0x4c0afe,!![]);}catch(_0x17f8b8){return BPromise[_0x91fa('0x21')](_0x17f8b8);}return _0x5b0494[_0x91fa('0x22')]();};}function saveUpdates(_0x4292ae,_0x5bff73){return function(_0x2a92e0){if(_0x2a92e0){return _0x2a92e0[_0x91fa('0x23')](_0x4292ae)[_0x91fa('0x24')](function(_0x495ba8){return _0x495ba8;});}return null;};}function removeEntity(_0xbd9037,_0x64a085){return function(_0x41a6cd){if(_0x41a6cd){return _0x41a6cd['destroy']()[_0x91fa('0x24')](function(){_0xbd9037[_0x91fa('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5eb665,_0x1b75f3){return function(_0x1b12a2){if(!_0x1b12a2){_0x5eb665['sendStatus'](0x194);}return _0x1b12a2;};}function handleError(_0x3f5b1f,_0x43e229){_0x43e229=_0x43e229||0x1f4;return function(_0x3868b8){logger[_0x91fa('0x25')](_0x3868b8['stack']);if(_0x3868b8[_0x91fa('0x26')]){delete _0x3868b8[_0x91fa('0x26')];}_0x3f5b1f[_0x91fa('0x19')](_0x43e229)['send'](_0x3868b8);};}exports[_0x91fa('0x27')]=function(_0x23b62a,_0x38bda8){var _0x1fca27={},_0x34b24e={},_0x5522e7={'count':0x0,'rows':[]};var _0x194bb3=_[_0x91fa('0x28')](db['Dynamics365Configuration']['rawAttributes'],function(_0x188fea){return{'name':_0x188fea[_0x91fa('0x29')],'type':_0x188fea[_0x91fa('0x2a')]['key']};});_0x34b24e[_0x91fa('0x2b')]=_[_0x91fa('0x28')](_0x194bb3,'name');_0x34b24e[_0x91fa('0x2c')]=_[_0x91fa('0x2d')](_0x23b62a[_0x91fa('0x2c')]);_0x34b24e[_0x91fa('0x2e')]=_[_0x91fa('0x2f')](_0x34b24e[_0x91fa('0x2b')],_0x34b24e[_0x91fa('0x2c')]);_0x1fca27[_0x91fa('0x30')]=_['intersection'](_0x34b24e[_0x91fa('0x2b')],qs[_0x91fa('0x31')](_0x23b62a[_0x91fa('0x2c')]['fields']));_0x1fca27[_0x91fa('0x30')]=_0x1fca27[_0x91fa('0x30')]['length']?_0x1fca27[_0x91fa('0x30')]:_0x34b24e[_0x91fa('0x2b')];if(!_0x23b62a[_0x91fa('0x2c')][_0x91fa('0x32')](_0x91fa('0x33'))){_0x1fca27['limit']=qs[_0x91fa('0x1e')](_0x23b62a[_0x91fa('0x2c')][_0x91fa('0x1e')]);_0x1fca27['offset']=qs[_0x91fa('0x1d')](_0x23b62a['query'][_0x91fa('0x1d')]);}_0x1fca27[_0x91fa('0x34')]=qs[_0x91fa('0x35')](_0x23b62a[_0x91fa('0x2c')][_0x91fa('0x35')]);_0x1fca27[_0x91fa('0x36')]=qs['filters'](_[_0x91fa('0x37')](_0x23b62a[_0x91fa('0x2c')],_0x34b24e[_0x91fa('0x2e')]),_0x194bb3);if(_0x23b62a[_0x91fa('0x2c')]['filter']){_0x1fca27[_0x91fa('0x36')]=_[_0x91fa('0x38')](_0x1fca27[_0x91fa('0x36')],{'$or':_['map'](_0x194bb3,function(_0x320f7c){if(_0x320f7c[_0x91fa('0x2a')]!==_0x91fa('0x39')){var _0x3f24e8={};_0x3f24e8[_0x320f7c[_0x91fa('0x26')]]={'$like':'%'+_0x23b62a[_0x91fa('0x2c')][_0x91fa('0x3a')]+'%'};return _0x3f24e8;}})});}_0x1fca27=_[_0x91fa('0x38')]({},_0x1fca27,_0x23b62a[_0x91fa('0x3b')]);var _0x5b7a11={'where':_0x1fca27['where']};return db[_0x91fa('0x3c')][_0x91fa('0x1c')](_0x5b7a11)['then'](function(_0x4e9b0f){_0x5522e7[_0x91fa('0x1c')]=_0x4e9b0f;if(_0x23b62a['query'][_0x91fa('0x3d')]){_0x1fca27[_0x91fa('0x3e')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x91fa('0x3f')](_0x1fca27);})[_0x91fa('0x24')](function(_0x137841){_0x5522e7[_0x91fa('0x40')]=_0x137841;return _0x5522e7;})[_0x91fa('0x24')](respondWithFilteredResult(_0x38bda8,_0x1fca27))['catch'](handleError(_0x38bda8,null));};exports[_0x91fa('0x41')]=function(_0x4e4a11,_0x5a93a8){var _0x369073={'raw':![],'where':{'id':_0x4e4a11[_0x91fa('0x42')]['id']}},_0x5322c2={};_0x5322c2[_0x91fa('0x2b')]=_['keys'](db[_0x91fa('0x3c')][_0x91fa('0x43')]);_0x5322c2['query']=_[_0x91fa('0x2d')](_0x4e4a11[_0x91fa('0x2c')]);_0x5322c2[_0x91fa('0x2e')]=_[_0x91fa('0x2f')](_0x5322c2[_0x91fa('0x2b')],_0x5322c2[_0x91fa('0x2c')]);_0x369073[_0x91fa('0x30')]=_[_0x91fa('0x2f')](_0x5322c2['model'],qs[_0x91fa('0x31')](_0x4e4a11[_0x91fa('0x2c')][_0x91fa('0x31')]));_0x369073[_0x91fa('0x30')]=_0x369073[_0x91fa('0x30')][_0x91fa('0x44')]?_0x369073[_0x91fa('0x30')]:_0x5322c2[_0x91fa('0x2b')];if(_0x4e4a11[_0x91fa('0x2c')][_0x91fa('0x3d')]){_0x369073[_0x91fa('0x3e')]=[{'all':!![]}];}_0x369073=_[_0x91fa('0x38')]({},_0x369073,_0x4e4a11[_0x91fa('0x3b')]);return db[_0x91fa('0x3c')][_0x91fa('0x45')](_0x369073)[_0x91fa('0x24')](handleEntityNotFound(_0x5a93a8,null))[_0x91fa('0x24')](respondWithResult(_0x5a93a8,null))[_0x91fa('0x46')](handleError(_0x5a93a8,null));};exports[_0x91fa('0x47')]=function(_0x36760e,_0x238661){return db[_0x91fa('0x3c')]['create'](_0x36760e[_0x91fa('0x48')],{})[_0x91fa('0x24')](respondWithResult(_0x238661,0xc9))['catch'](handleError(_0x238661,null));};exports[_0x91fa('0x23')]=function(_0x3043b0,_0x555032){if(_0x3043b0[_0x91fa('0x48')]['id']){delete _0x3043b0['body']['id'];}return db[_0x91fa('0x3c')][_0x91fa('0x45')]({'where':{'id':_0x3043b0[_0x91fa('0x42')]['id']}})[_0x91fa('0x24')](handleEntityNotFound(_0x555032,null))['then'](saveUpdates(_0x3043b0[_0x91fa('0x48')],null))[_0x91fa('0x24')](respondWithResult(_0x555032,null))[_0x91fa('0x46')](handleError(_0x555032,null));};exports['destroy']=function(_0x2ed1bf,_0x50b413){return db[_0x91fa('0x3c')]['find']({'where':{'id':_0x2ed1bf[_0x91fa('0x42')]['id']}})[_0x91fa('0x24')](handleEntityNotFound(_0x50b413,null))[_0x91fa('0x24')](removeEntity(_0x50b413,null))[_0x91fa('0x46')](handleError(_0x50b413,null));};exports[_0x91fa('0x49')]=function(_0x4fc77,_0x181cf9,_0x301d59){var _0x9579bc={};var _0x587b09={};var _0x4aa319;var _0x14a261;return db[_0x91fa('0x3c')]['findOne']({'where':{'id':_0x4fc77['params']['id']}})[_0x91fa('0x24')](handleEntityNotFound(_0x181cf9,null))[_0x91fa('0x24')](function(_0x142d53){if(_0x142d53){_0x4aa319=_0x142d53;_0x587b09[_0x91fa('0x2b')]=_[_0x91fa('0x2d')](db[_0x91fa('0x4a')][_0x91fa('0x43')]);_0x587b09[_0x91fa('0x2c')]=_[_0x91fa('0x2d')](_0x4fc77[_0x91fa('0x2c')]);_0x587b09[_0x91fa('0x2e')]=_[_0x91fa('0x2f')](_0x587b09[_0x91fa('0x2b')],_0x587b09['query']);_0x9579bc[_0x91fa('0x30')]=_[_0x91fa('0x2f')](_0x587b09[_0x91fa('0x2b')],qs[_0x91fa('0x31')](_0x4fc77[_0x91fa('0x2c')][_0x91fa('0x31')]));_0x9579bc[_0x91fa('0x30')]=_0x9579bc['attributes'][_0x91fa('0x44')]?_0x9579bc[_0x91fa('0x30')]:_0x587b09[_0x91fa('0x2b')];_0x9579bc[_0x91fa('0x34')]=qs[_0x91fa('0x35')](_0x4fc77['query'][_0x91fa('0x35')]);_0x9579bc[_0x91fa('0x36')]=qs[_0x91fa('0x2e')](_[_0x91fa('0x37')](_0x4fc77[_0x91fa('0x2c')],_0x587b09[_0x91fa('0x2e')]));if(_0x4fc77['query'][_0x91fa('0x3a')]){_0x9579bc[_0x91fa('0x36')]=_['merge'](_0x9579bc[_0x91fa('0x36')],{'$or':_[_0x91fa('0x28')](_0x9579bc[_0x91fa('0x30')],function(_0x22a174){var _0x5a5ad6={};_0x5a5ad6[_0x22a174]={'$like':'%'+_0x4fc77[_0x91fa('0x2c')][_0x91fa('0x3a')]+'%'};return _0x5a5ad6;})});}_0x9579bc=_[_0x91fa('0x38')]({},_0x9579bc,_0x4fc77[_0x91fa('0x3b')]);return _0x4aa319[_0x91fa('0x49')](_0x9579bc);}})[_0x91fa('0x24')](function(_0x5b8d8f){if(_0x5b8d8f){_0x14a261=_0x5b8d8f[_0x91fa('0x44')];if(!_0x4fc77['query'][_0x91fa('0x32')](_0x91fa('0x33'))){_0x9579bc[_0x91fa('0x1e')]=qs[_0x91fa('0x1e')](_0x4fc77[_0x91fa('0x2c')][_0x91fa('0x1e')]);_0x9579bc[_0x91fa('0x1d')]=qs[_0x91fa('0x1d')](_0x4fc77[_0x91fa('0x2c')][_0x91fa('0x1d')]);}return _0x4aa319[_0x91fa('0x49')](_0x9579bc);}})['then'](function(_0x1e9d0e){if(_0x1e9d0e){return _0x1e9d0e?{'count':_0x14a261,'rows':_0x1e9d0e}:null;}})[_0x91fa('0x24')](respondWithResult(_0x181cf9,null))[_0x91fa('0x46')](handleError(_0x181cf9,null));};exports[_0x91fa('0x4b')]=function(_0x3ae275,_0x4b4320,_0x4c577e){var _0x4c188c={};var _0x1928dd={};var _0x1c6b38;var _0x31852e;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x3ae275['params']['id']}})[_0x91fa('0x24')](handleEntityNotFound(_0x4b4320,null))['then'](function(_0x11708f){if(_0x11708f){_0x1c6b38=_0x11708f;_0x1928dd[_0x91fa('0x2b')]=_[_0x91fa('0x2d')](db['Dynamics365Field'][_0x91fa('0x43')]);_0x1928dd[_0x91fa('0x2c')]=_[_0x91fa('0x2d')](_0x3ae275[_0x91fa('0x2c')]);_0x1928dd[_0x91fa('0x2e')]=_[_0x91fa('0x2f')](_0x1928dd[_0x91fa('0x2b')],_0x1928dd[_0x91fa('0x2c')]);_0x4c188c[_0x91fa('0x30')]=_[_0x91fa('0x2f')](_0x1928dd[_0x91fa('0x2b')],qs[_0x91fa('0x31')](_0x3ae275[_0x91fa('0x2c')][_0x91fa('0x31')]));_0x4c188c[_0x91fa('0x30')]=_0x4c188c[_0x91fa('0x30')][_0x91fa('0x44')]?_0x4c188c[_0x91fa('0x30')]:_0x1928dd[_0x91fa('0x2b')];_0x4c188c[_0x91fa('0x34')]=qs[_0x91fa('0x35')](_0x3ae275[_0x91fa('0x2c')][_0x91fa('0x35')]);_0x4c188c[_0x91fa('0x36')]=qs[_0x91fa('0x2e')](_['pick'](_0x3ae275[_0x91fa('0x2c')],_0x1928dd[_0x91fa('0x2e')]));if(_0x3ae275[_0x91fa('0x2c')][_0x91fa('0x3a')]){_0x4c188c[_0x91fa('0x36')]=_[_0x91fa('0x38')](_0x4c188c[_0x91fa('0x36')],{'$or':_[_0x91fa('0x28')](_0x4c188c[_0x91fa('0x30')],function(_0x9d9088){var _0x35d167={};_0x35d167[_0x9d9088]={'$like':'%'+_0x3ae275['query']['filter']+'%'};return _0x35d167;})});}_0x4c188c=_[_0x91fa('0x38')]({},_0x4c188c,_0x3ae275['options']);return _0x1c6b38[_0x91fa('0x4b')](_0x4c188c);}})[_0x91fa('0x24')](function(_0x2c1f33){if(_0x2c1f33){_0x31852e=_0x2c1f33[_0x91fa('0x44')];if(!_0x3ae275[_0x91fa('0x2c')][_0x91fa('0x32')](_0x91fa('0x33'))){_0x4c188c[_0x91fa('0x1e')]=qs[_0x91fa('0x1e')](_0x3ae275[_0x91fa('0x2c')]['limit']);_0x4c188c[_0x91fa('0x1d')]=qs[_0x91fa('0x1d')](_0x3ae275[_0x91fa('0x2c')][_0x91fa('0x1d')]);}return _0x1c6b38[_0x91fa('0x4b')](_0x4c188c);}})[_0x91fa('0x24')](function(_0x3796a3){if(_0x3796a3){return _0x3796a3?{'count':_0x31852e,'rows':_0x3796a3}:null;}})[_0x91fa('0x24')](respondWithResult(_0x4b4320,null))[_0x91fa('0x46')](handleError(_0x4b4320,null));};exports['getDescriptions']=function(_0x3ffd83,_0x4d1595,_0x265167){var _0x3c4162={};var _0x50eb44={};var _0x57586e;var _0x29b4a1;return db[_0x91fa('0x3c')][_0x91fa('0x4c')]({'where':{'id':_0x3ffd83[_0x91fa('0x42')]['id']}})[_0x91fa('0x24')](handleEntityNotFound(_0x4d1595,null))['then'](function(_0x565e06){if(_0x565e06){_0x57586e=_0x565e06;_0x50eb44[_0x91fa('0x2b')]=_['keys'](db[_0x91fa('0x4a')][_0x91fa('0x43')]);_0x50eb44[_0x91fa('0x2c')]=_['keys'](_0x3ffd83[_0x91fa('0x2c')]);_0x50eb44[_0x91fa('0x2e')]=_['intersection'](_0x50eb44[_0x91fa('0x2b')],_0x50eb44[_0x91fa('0x2c')]);_0x3c4162[_0x91fa('0x30')]=_['intersection'](_0x50eb44['model'],qs[_0x91fa('0x31')](_0x3ffd83[_0x91fa('0x2c')][_0x91fa('0x31')]));_0x3c4162[_0x91fa('0x30')]=_0x3c4162[_0x91fa('0x30')][_0x91fa('0x44')]?_0x3c4162['attributes']:_0x50eb44[_0x91fa('0x2b')];_0x3c4162[_0x91fa('0x34')]=qs[_0x91fa('0x35')](_0x3ffd83[_0x91fa('0x2c')][_0x91fa('0x35')]);_0x3c4162[_0x91fa('0x36')]=qs[_0x91fa('0x2e')](_[_0x91fa('0x37')](_0x3ffd83[_0x91fa('0x2c')],_0x50eb44['filters']));if(_0x3ffd83[_0x91fa('0x2c')][_0x91fa('0x3a')]){_0x3c4162[_0x91fa('0x36')]=_[_0x91fa('0x38')](_0x3c4162[_0x91fa('0x36')],{'$or':_['map'](_0x3c4162[_0x91fa('0x30')],function(_0x627211){var _0x1f4e92={};_0x1f4e92[_0x627211]={'$like':'%'+_0x3ffd83[_0x91fa('0x2c')][_0x91fa('0x3a')]+'%'};return _0x1f4e92;})});}_0x3c4162=_[_0x91fa('0x38')]({},_0x3c4162,_0x3ffd83['options']);return _0x57586e[_0x91fa('0x4d')](_0x3c4162);}})[_0x91fa('0x24')](function(_0x55ee4f){if(_0x55ee4f){_0x29b4a1=_0x55ee4f['length'];if(!_0x3ffd83[_0x91fa('0x2c')][_0x91fa('0x32')]('nolimit')){_0x3c4162[_0x91fa('0x1e')]=qs[_0x91fa('0x1e')](_0x3ffd83[_0x91fa('0x2c')]['limit']);_0x3c4162[_0x91fa('0x1d')]=qs['offset'](_0x3ffd83[_0x91fa('0x2c')][_0x91fa('0x1d')]);}return _0x57586e[_0x91fa('0x4d')](_0x3c4162);}})[_0x91fa('0x24')](function(_0x51c7de){if(_0x51c7de){return _0x51c7de?{'count':_0x29b4a1,'rows':_0x51c7de}:null;}})[_0x91fa('0x24')](respondWithResult(_0x4d1595,null))[_0x91fa('0x46')](handleError(_0x4d1595,null));}; \ No newline at end of file +var _0x1eb8=['fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','show','params','keys','rawAttributes','find','create','body','catch','getFields','findOne','Dynamics365Field','getSubjects','order','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','Dynamics365Configuration','fieldName','type','key','model','query','filters','intersection','attributes'];(function(_0x47c392,_0x386cd4){var _0x47ed89=function(_0x1e8a1c){while(--_0x1e8a1c){_0x47c392['push'](_0x47c392['shift']());}};_0x47ed89(++_0x386cd4);}(_0x1eb8,0xbe));var _0x81eb=function(_0x1688a2,_0x4bfe3c){_0x1688a2=_0x1688a2-0x0;var _0x244acb=_0x1eb8[_0x1688a2];return _0x244acb;};'use strict';var emlformat=require(_0x81eb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x81eb('0x1'));var jsonpatch=require(_0x81eb('0x2'));var rp=require(_0x81eb('0x3'));var moment=require(_0x81eb('0x4'));var BPromise=require(_0x81eb('0x5'));var Mustache=require(_0x81eb('0x6'));var util=require(_0x81eb('0x7'));var path=require('path');var sox=require(_0x81eb('0x8'));var csv=require(_0x81eb('0x9'));var ejs=require(_0x81eb('0xa'));var fs=require('fs');var fs_extra=require(_0x81eb('0xb'));var _=require(_0x81eb('0xc'));var squel=require(_0x81eb('0xd'));var crypto=require(_0x81eb('0xe'));var jsforce=require(_0x81eb('0xf'));var deskjs=require(_0x81eb('0x10'));var toCsv=require(_0x81eb('0x9'));var querystring=require('querystring');var Papa=require(_0x81eb('0x11'));var Redis=require(_0x81eb('0x12'));var authService=require(_0x81eb('0x13'));var qs=require(_0x81eb('0x14'));var as=require(_0x81eb('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x81eb('0x16'))(_0x81eb('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x81eb('0x18'));var db=require(_0x81eb('0x19'))['db'];function respondWithStatusCode(_0x51b895,_0x4eedf9){_0x4eedf9=_0x4eedf9||0xcc;return function(_0x117b8c){if(_0x117b8c){return _0x51b895[_0x81eb('0x1a')](_0x4eedf9);}return _0x51b895[_0x81eb('0x1b')](_0x4eedf9)[_0x81eb('0x1c')]();};}function respondWithResult(_0xaeccc5,_0x5bd41f){_0x5bd41f=_0x5bd41f||0xc8;return function(_0x83ed38){if(_0x83ed38){return _0xaeccc5[_0x81eb('0x1b')](_0x5bd41f)[_0x81eb('0x1d')](_0x83ed38);}};}function respondWithFilteredResult(_0x298c60,_0x2a10dd){return function(_0xc8d2ef){if(_0xc8d2ef){var _0x4a1a91=typeof _0x2a10dd[_0x81eb('0x1e')]==='undefined'&&typeof _0x2a10dd[_0x81eb('0x1f')]===_0x81eb('0x20');var _0x2016dc=_0xc8d2ef['count'];var _0x1bd5a8=_0x4a1a91?0x0:_0x2a10dd[_0x81eb('0x1e')];var _0x593634=_0x4a1a91?_0xc8d2ef['count']:_0x2a10dd['offset']+_0x2a10dd[_0x81eb('0x1f')];var _0x6be5a8;if(_0x593634>=_0x2016dc){_0x593634=_0x2016dc;_0x6be5a8=0xc8;}else{_0x6be5a8=0xce;}_0x298c60[_0x81eb('0x1b')](_0x6be5a8);return _0x298c60['set'](_0x81eb('0x21'),_0x1bd5a8+'-'+_0x593634+'/'+_0x2016dc)[_0x81eb('0x1d')](_0xc8d2ef);}return null;};}function patchUpdates(_0x5e37eb){return function(_0x508899){try{jsonpatch['apply'](_0x508899,_0x5e37eb,!![]);}catch(_0x1b959e){return BPromise[_0x81eb('0x22')](_0x1b959e);}return _0x508899[_0x81eb('0x23')]();};}function saveUpdates(_0x149897,_0x379a1e){return function(_0x427919){if(_0x427919){return _0x427919[_0x81eb('0x24')](_0x149897)[_0x81eb('0x25')](function(_0x927535){return _0x927535;});}return null;};}function removeEntity(_0x408f48,_0x84a868){return function(_0x31f4be){if(_0x31f4be){return _0x31f4be[_0x81eb('0x26')]()[_0x81eb('0x25')](function(){_0x408f48[_0x81eb('0x1b')](0xcc)[_0x81eb('0x1c')]();});}};}function handleEntityNotFound(_0x13deb2,_0x9b2449){return function(_0x1ace34){if(!_0x1ace34){_0x13deb2[_0x81eb('0x1a')](0x194);}return _0x1ace34;};}function handleError(_0xe51814,_0x23273d){_0x23273d=_0x23273d||0x1f4;return function(_0x5032fe){logger['error'](_0x5032fe[_0x81eb('0x27')]);if(_0x5032fe[_0x81eb('0x28')]){delete _0x5032fe[_0x81eb('0x28')];}_0xe51814[_0x81eb('0x1b')](_0x23273d)[_0x81eb('0x29')](_0x5032fe);};}exports[_0x81eb('0x2a')]=function(_0xea14bf,_0x4f4c64){var _0x1fbb45={},_0xc90531={},_0x168dd9={'count':0x0,'rows':[]};var _0x4060ef=_[_0x81eb('0x2b')](db[_0x81eb('0x2c')]['rawAttributes'],function(_0x53bdfe){return{'name':_0x53bdfe[_0x81eb('0x2d')],'type':_0x53bdfe[_0x81eb('0x2e')][_0x81eb('0x2f')]};});_0xc90531[_0x81eb('0x30')]=_['map'](_0x4060ef,_0x81eb('0x28'));_0xc90531[_0x81eb('0x31')]=_['keys'](_0xea14bf['query']);_0xc90531[_0x81eb('0x32')]=_[_0x81eb('0x33')](_0xc90531[_0x81eb('0x30')],_0xc90531[_0x81eb('0x31')]);_0x1fbb45[_0x81eb('0x34')]=_[_0x81eb('0x33')](_0xc90531[_0x81eb('0x30')],qs['fields'](_0xea14bf['query'][_0x81eb('0x35')]));_0x1fbb45[_0x81eb('0x34')]=_0x1fbb45[_0x81eb('0x34')][_0x81eb('0x36')]?_0x1fbb45[_0x81eb('0x34')]:_0xc90531[_0x81eb('0x30')];if(!_0xea14bf['query'][_0x81eb('0x37')](_0x81eb('0x38'))){_0x1fbb45['limit']=qs['limit'](_0xea14bf[_0x81eb('0x31')]['limit']);_0x1fbb45[_0x81eb('0x1e')]=qs[_0x81eb('0x1e')](_0xea14bf[_0x81eb('0x31')][_0x81eb('0x1e')]);}_0x1fbb45['order']=qs[_0x81eb('0x39')](_0xea14bf['query'][_0x81eb('0x39')]);_0x1fbb45[_0x81eb('0x3a')]=qs[_0x81eb('0x32')](_[_0x81eb('0x3b')](_0xea14bf['query'],_0xc90531[_0x81eb('0x32')]),_0x4060ef);if(_0xea14bf[_0x81eb('0x31')][_0x81eb('0x3c')]){_0x1fbb45[_0x81eb('0x3a')]=_[_0x81eb('0x3d')](_0x1fbb45[_0x81eb('0x3a')],{'$or':_[_0x81eb('0x2b')](_0x4060ef,function(_0x1a22ca){if(_0x1a22ca[_0x81eb('0x2e')]!==_0x81eb('0x3e')){var _0x1a632b={};_0x1a632b[_0x1a22ca[_0x81eb('0x28')]]={'$like':'%'+_0xea14bf[_0x81eb('0x31')][_0x81eb('0x3c')]+'%'};return _0x1a632b;}})});}_0x1fbb45=_[_0x81eb('0x3d')]({},_0x1fbb45,_0xea14bf[_0x81eb('0x3f')]);var _0x2091d0={'where':_0x1fbb45['where']};return db[_0x81eb('0x2c')][_0x81eb('0x40')](_0x2091d0)[_0x81eb('0x25')](function(_0x490f69){_0x168dd9[_0x81eb('0x40')]=_0x490f69;if(_0xea14bf[_0x81eb('0x31')][_0x81eb('0x41')]){_0x1fbb45[_0x81eb('0x42')]=[{'all':!![]}];}return db[_0x81eb('0x2c')]['findAll'](_0x1fbb45);})[_0x81eb('0x25')](function(_0x3ef401){_0x168dd9['rows']=_0x3ef401;return _0x168dd9;})['then'](respondWithFilteredResult(_0x4f4c64,_0x1fbb45))['catch'](handleError(_0x4f4c64,null));};exports[_0x81eb('0x43')]=function(_0xf82bc,_0x24e1f4){var _0x4c8c66={'raw':![],'where':{'id':_0xf82bc[_0x81eb('0x44')]['id']}},_0x3dced8={};_0x3dced8['model']=_[_0x81eb('0x45')](db[_0x81eb('0x2c')][_0x81eb('0x46')]);_0x3dced8[_0x81eb('0x31')]=_[_0x81eb('0x45')](_0xf82bc['query']);_0x3dced8[_0x81eb('0x32')]=_[_0x81eb('0x33')](_0x3dced8['model'],_0x3dced8[_0x81eb('0x31')]);_0x4c8c66[_0x81eb('0x34')]=_['intersection'](_0x3dced8[_0x81eb('0x30')],qs[_0x81eb('0x35')](_0xf82bc[_0x81eb('0x31')]['fields']));_0x4c8c66[_0x81eb('0x34')]=_0x4c8c66['attributes'][_0x81eb('0x36')]?_0x4c8c66['attributes']:_0x3dced8[_0x81eb('0x30')];if(_0xf82bc[_0x81eb('0x31')][_0x81eb('0x41')]){_0x4c8c66['include']=[{'all':!![]}];}_0x4c8c66=_[_0x81eb('0x3d')]({},_0x4c8c66,_0xf82bc['options']);return db[_0x81eb('0x2c')][_0x81eb('0x47')](_0x4c8c66)['then'](handleEntityNotFound(_0x24e1f4,null))['then'](respondWithResult(_0x24e1f4,null))['catch'](handleError(_0x24e1f4,null));};exports['create']=function(_0x5b6a4c,_0xef424a){return db[_0x81eb('0x2c')][_0x81eb('0x48')](_0x5b6a4c[_0x81eb('0x49')],{})[_0x81eb('0x25')](respondWithResult(_0xef424a,0xc9))[_0x81eb('0x4a')](handleError(_0xef424a,null));};exports[_0x81eb('0x24')]=function(_0x109c67,_0x41fddb){if(_0x109c67[_0x81eb('0x49')]['id']){delete _0x109c67['body']['id'];}return db['Dynamics365Configuration'][_0x81eb('0x47')]({'where':{'id':_0x109c67['params']['id']}})[_0x81eb('0x25')](handleEntityNotFound(_0x41fddb,null))[_0x81eb('0x25')](saveUpdates(_0x109c67[_0x81eb('0x49')],null))[_0x81eb('0x25')](respondWithResult(_0x41fddb,null))[_0x81eb('0x4a')](handleError(_0x41fddb,null));};exports[_0x81eb('0x26')]=function(_0x48e200,_0x114716){return db[_0x81eb('0x2c')]['find']({'where':{'id':_0x48e200[_0x81eb('0x44')]['id']}})[_0x81eb('0x25')](handleEntityNotFound(_0x114716,null))[_0x81eb('0x25')](removeEntity(_0x114716,null))[_0x81eb('0x4a')](handleError(_0x114716,null));};exports[_0x81eb('0x4b')]=function(_0x48334f,_0x1c5b2a,_0x1633ee){var _0x3394ef={};var _0x5290b6={};var _0x5e9435;var _0x5600bc;return db[_0x81eb('0x2c')][_0x81eb('0x4c')]({'where':{'id':_0x48334f[_0x81eb('0x44')]['id']}})[_0x81eb('0x25')](handleEntityNotFound(_0x1c5b2a,null))[_0x81eb('0x25')](function(_0xb52fb7){if(_0xb52fb7){_0x5e9435=_0xb52fb7;_0x5290b6['model']=_['keys'](db[_0x81eb('0x4d')]['rawAttributes']);_0x5290b6[_0x81eb('0x31')]=_[_0x81eb('0x45')](_0x48334f[_0x81eb('0x31')]);_0x5290b6[_0x81eb('0x32')]=_['intersection'](_0x5290b6[_0x81eb('0x30')],_0x5290b6[_0x81eb('0x31')]);_0x3394ef['attributes']=_[_0x81eb('0x33')](_0x5290b6[_0x81eb('0x30')],qs[_0x81eb('0x35')](_0x48334f[_0x81eb('0x31')][_0x81eb('0x35')]));_0x3394ef['attributes']=_0x3394ef['attributes'][_0x81eb('0x36')]?_0x3394ef[_0x81eb('0x34')]:_0x5290b6[_0x81eb('0x30')];_0x3394ef['order']=qs['sort'](_0x48334f['query']['sort']);_0x3394ef['where']=qs[_0x81eb('0x32')](_['pick'](_0x48334f[_0x81eb('0x31')],_0x5290b6['filters']));if(_0x48334f[_0x81eb('0x31')][_0x81eb('0x3c')]){_0x3394ef[_0x81eb('0x3a')]=_[_0x81eb('0x3d')](_0x3394ef[_0x81eb('0x3a')],{'$or':_[_0x81eb('0x2b')](_0x3394ef[_0x81eb('0x34')],function(_0x11fc99){var _0x3e6f92={};_0x3e6f92[_0x11fc99]={'$like':'%'+_0x48334f[_0x81eb('0x31')][_0x81eb('0x3c')]+'%'};return _0x3e6f92;})});}_0x3394ef=_[_0x81eb('0x3d')]({},_0x3394ef,_0x48334f[_0x81eb('0x3f')]);return _0x5e9435['getFields'](_0x3394ef);}})['then'](function(_0x3efe69){if(_0x3efe69){_0x5600bc=_0x3efe69[_0x81eb('0x36')];if(!_0x48334f[_0x81eb('0x31')]['hasOwnProperty']('nolimit')){_0x3394ef[_0x81eb('0x1f')]=qs['limit'](_0x48334f['query'][_0x81eb('0x1f')]);_0x3394ef[_0x81eb('0x1e')]=qs['offset'](_0x48334f[_0x81eb('0x31')][_0x81eb('0x1e')]);}return _0x5e9435[_0x81eb('0x4b')](_0x3394ef);}})['then'](function(_0x36873f){if(_0x36873f){return _0x36873f?{'count':_0x5600bc,'rows':_0x36873f}:null;}})['then'](respondWithResult(_0x1c5b2a,null))['catch'](handleError(_0x1c5b2a,null));};exports[_0x81eb('0x4e')]=function(_0x4cfe9d,_0x170a04,_0x2419af){var _0x2e75b9={};var _0x53610d={};var _0x6b7c7f;var _0x362434;return db['Dynamics365Configuration'][_0x81eb('0x4c')]({'where':{'id':_0x4cfe9d[_0x81eb('0x44')]['id']}})[_0x81eb('0x25')](handleEntityNotFound(_0x170a04,null))[_0x81eb('0x25')](function(_0x32dfd9){if(_0x32dfd9){_0x6b7c7f=_0x32dfd9;_0x53610d['model']=_[_0x81eb('0x45')](db[_0x81eb('0x4d')][_0x81eb('0x46')]);_0x53610d['query']=_[_0x81eb('0x45')](_0x4cfe9d[_0x81eb('0x31')]);_0x53610d[_0x81eb('0x32')]=_[_0x81eb('0x33')](_0x53610d[_0x81eb('0x30')],_0x53610d[_0x81eb('0x31')]);_0x2e75b9[_0x81eb('0x34')]=_['intersection'](_0x53610d[_0x81eb('0x30')],qs['fields'](_0x4cfe9d[_0x81eb('0x31')][_0x81eb('0x35')]));_0x2e75b9[_0x81eb('0x34')]=_0x2e75b9[_0x81eb('0x34')][_0x81eb('0x36')]?_0x2e75b9[_0x81eb('0x34')]:_0x53610d[_0x81eb('0x30')];_0x2e75b9[_0x81eb('0x4f')]=qs[_0x81eb('0x39')](_0x4cfe9d['query'][_0x81eb('0x39')]);_0x2e75b9[_0x81eb('0x3a')]=qs['filters'](_[_0x81eb('0x3b')](_0x4cfe9d[_0x81eb('0x31')],_0x53610d['filters']));if(_0x4cfe9d[_0x81eb('0x31')][_0x81eb('0x3c')]){_0x2e75b9['where']=_[_0x81eb('0x3d')](_0x2e75b9[_0x81eb('0x3a')],{'$or':_[_0x81eb('0x2b')](_0x2e75b9[_0x81eb('0x34')],function(_0x4d171d){var _0x3a3aa3={};_0x3a3aa3[_0x4d171d]={'$like':'%'+_0x4cfe9d['query']['filter']+'%'};return _0x3a3aa3;})});}_0x2e75b9=_[_0x81eb('0x3d')]({},_0x2e75b9,_0x4cfe9d['options']);return _0x6b7c7f['getSubjects'](_0x2e75b9);}})['then'](function(_0x5e0506){if(_0x5e0506){_0x362434=_0x5e0506[_0x81eb('0x36')];if(!_0x4cfe9d['query'][_0x81eb('0x37')](_0x81eb('0x38'))){_0x2e75b9['limit']=qs[_0x81eb('0x1f')](_0x4cfe9d[_0x81eb('0x31')][_0x81eb('0x1f')]);_0x2e75b9[_0x81eb('0x1e')]=qs[_0x81eb('0x1e')](_0x4cfe9d[_0x81eb('0x31')][_0x81eb('0x1e')]);}return _0x6b7c7f[_0x81eb('0x4e')](_0x2e75b9);}})[_0x81eb('0x25')](function(_0x5db2c2){if(_0x5db2c2){return _0x5db2c2?{'count':_0x362434,'rows':_0x5db2c2}:null;}})[_0x81eb('0x25')](respondWithResult(_0x170a04,null))[_0x81eb('0x4a')](handleError(_0x170a04,null));};exports[_0x81eb('0x50')]=function(_0xa1e7ae,_0x5e52f3,_0x2398b5){var _0x137f31={};var _0x4015bb={};var _0x2becee;var _0xd8d2dd;return db['Dynamics365Configuration'][_0x81eb('0x4c')]({'where':{'id':_0xa1e7ae['params']['id']}})[_0x81eb('0x25')](handleEntityNotFound(_0x5e52f3,null))[_0x81eb('0x25')](function(_0x1e11f8){if(_0x1e11f8){_0x2becee=_0x1e11f8;_0x4015bb[_0x81eb('0x30')]=_[_0x81eb('0x45')](db['Dynamics365Field'][_0x81eb('0x46')]);_0x4015bb[_0x81eb('0x31')]=_['keys'](_0xa1e7ae[_0x81eb('0x31')]);_0x4015bb['filters']=_[_0x81eb('0x33')](_0x4015bb[_0x81eb('0x30')],_0x4015bb['query']);_0x137f31[_0x81eb('0x34')]=_[_0x81eb('0x33')](_0x4015bb[_0x81eb('0x30')],qs[_0x81eb('0x35')](_0xa1e7ae[_0x81eb('0x31')]['fields']));_0x137f31[_0x81eb('0x34')]=_0x137f31[_0x81eb('0x34')]['length']?_0x137f31[_0x81eb('0x34')]:_0x4015bb[_0x81eb('0x30')];_0x137f31[_0x81eb('0x4f')]=qs[_0x81eb('0x39')](_0xa1e7ae[_0x81eb('0x31')]['sort']);_0x137f31[_0x81eb('0x3a')]=qs[_0x81eb('0x32')](_['pick'](_0xa1e7ae[_0x81eb('0x31')],_0x4015bb[_0x81eb('0x32')]));if(_0xa1e7ae[_0x81eb('0x31')][_0x81eb('0x3c')]){_0x137f31[_0x81eb('0x3a')]=_[_0x81eb('0x3d')](_0x137f31[_0x81eb('0x3a')],{'$or':_[_0x81eb('0x2b')](_0x137f31[_0x81eb('0x34')],function(_0x187760){var _0x57f1cd={};_0x57f1cd[_0x187760]={'$like':'%'+_0xa1e7ae[_0x81eb('0x31')][_0x81eb('0x3c')]+'%'};return _0x57f1cd;})});}_0x137f31=_[_0x81eb('0x3d')]({},_0x137f31,_0xa1e7ae[_0x81eb('0x3f')]);return _0x2becee[_0x81eb('0x50')](_0x137f31);}})[_0x81eb('0x25')](function(_0xb05528){if(_0xb05528){_0xd8d2dd=_0xb05528[_0x81eb('0x36')];if(!_0xa1e7ae[_0x81eb('0x31')][_0x81eb('0x37')](_0x81eb('0x38'))){_0x137f31[_0x81eb('0x1f')]=qs[_0x81eb('0x1f')](_0xa1e7ae[_0x81eb('0x31')][_0x81eb('0x1f')]);_0x137f31['offset']=qs[_0x81eb('0x1e')](_0xa1e7ae[_0x81eb('0x31')][_0x81eb('0x1e')]);}return _0x2becee[_0x81eb('0x50')](_0x137f31);}})['then'](function(_0x31fe9d){if(_0x31fe9d){return _0x31fe9d?{'count':_0xd8d2dd,'rows':_0x31fe9d}:null;}})['then'](respondWithResult(_0x5e52f3,null))['catch'](handleError(_0x5e52f3,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 340b58e..57ba3f3 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 _0x84ab=['request-promise','path','../../config/environment','./intDynamics365Configuration.attributes','exports','Dynamics365Configuration','lodash','util','../../config/logger','api','moment'];(function(_0x67fdbf,_0xc3c2f3){var _0x3e8004=function(_0x5ee7bb){while(--_0x5ee7bb){_0x67fdbf['push'](_0x67fdbf['shift']());}};_0x3e8004(++_0xc3c2f3);}(_0x84ab,0x12f));var _0xb84a=function(_0x296754,_0x5befe9){_0x296754=_0x296754-0x0;var _0x1d9f1d=_0x84ab[_0x296754];return _0x1d9f1d;};'use strict';var _=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var logger=require(_0xb84a('0x2'))(_0xb84a('0x3'));var moment=require(_0xb84a('0x4'));var BPromise=require('bluebird');var rp=require(_0xb84a('0x5'));var fs=require('fs');var path=require(_0xb84a('0x6'));var rimraf=require('rimraf');var config=require(_0xb84a('0x7'));var attributes=require(_0xb84a('0x8'));module[_0xb84a('0x9')]=function(_0x5b9def,_0x521a64){return _0x5b9def['define'](_0xb84a('0xa'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe5b3=['request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','int_dynamics365_configurations','util','../../config/logger','api','moment','bluebird'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xe5b3,0x133));var _0x3e5b=function(_0x16084c,_0x275fd2){_0x16084c=_0x16084c-0x0;var _0x55ab0c=_0xe5b3[_0x16084c];return _0x55ab0c;};'use strict';var _=require('lodash');var util=require(_0x3e5b('0x0'));var logger=require(_0x3e5b('0x1'))(_0x3e5b('0x2'));var moment=require(_0x3e5b('0x3'));var BPromise=require(_0x3e5b('0x4'));var rp=require(_0x3e5b('0x5'));var fs=require('fs');var path=require(_0x3e5b('0x6'));var rimraf=require(_0x3e5b('0x7'));var config=require(_0x3e5b('0x8'));var attributes=require(_0x3e5b('0x9'));module[_0x3e5b('0xa')]=function(_0x54e1fb,_0x174923){return _0x54e1fb[_0x3e5b('0xb')]('Dynamics365Configuration',attributes,{'tableName':_0x3e5b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 81c3a50..45989fb 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 _0x47c3=['util','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x240dde,_0x23feff){var _0x32e9e7=function(_0x3e1a04){while(--_0x3e1a04){_0x240dde['push'](_0x240dde['shift']());}};_0x32e9e7(++_0x23feff);}(_0x47c3,0x99));var _0x347c=function(_0x1ea05b,_0x28b468){_0x1ea05b=_0x1ea05b-0x0;var _0x29c076=_0x47c3[_0x1ea05b];return _0x29c076;};'use strict';var _=require(_0x347c('0x0'));var util=require(_0x347c('0x1'));var moment=require('moment');var BPromise=require(_0x347c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x347c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x347c('0x4'));var logger=require('../../config/logger')(_0x347c('0x5'));var config=require(_0x347c('0x6'));var jayson=require(_0x347c('0x7'));var client=jayson['client'][_0x347c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x152fbd,_0x4828ae,_0x4ce6c5){return new BPromise(function(_0x226ff4,_0x4d9b7f){return client[_0x347c('0x9')](_0x152fbd,_0x4ce6c5)[_0x347c('0xa')](function(_0x6c8615){logger['info'](_0x347c('0xb'),_0x4828ae,_0x347c('0xc'));logger[_0x347c('0xd')](_0x347c('0xe'),_0x4828ae,'request\x20sent',JSON[_0x347c('0xf')](_0x6c8615));if(_0x6c8615[_0x347c('0x10')]){if(_0x6c8615[_0x347c('0x10')][_0x347c('0x11')]===0x1f4){logger[_0x347c('0x10')](_0x347c('0xb'),_0x4828ae,_0x6c8615[_0x347c('0x10')][_0x347c('0x12')]);return _0x4d9b7f(_0x6c8615[_0x347c('0x10')][_0x347c('0x12')]);}logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x4828ae,_0x6c8615['error'][_0x347c('0x12')]);return _0x226ff4(_0x6c8615['error']['message']);}else{logger[_0x347c('0x13')]('Dynamics365Configuration,\x20%s,\x20%s',_0x4828ae,_0x347c('0xc'));_0x226ff4(_0x6c8615[_0x347c('0x14')]['message']);}})[_0x347c('0x15')](function(_0x132bce){logger[_0x347c('0x10')](_0x347c('0xb'),_0x4828ae,_0x132bce);_0x4d9b7f(_0x132bce);});});} \ No newline at end of file +var _0xb741=['http','request','then','info','request\x20sent','debug','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x44ac42,_0x5f23a7){var _0x3c60cc=function(_0x14b424){while(--_0x14b424){_0x44ac42['push'](_0x44ac42['shift']());}};_0x3c60cc(++_0x5f23a7);}(_0xb741,0xae));var _0x1b74=function(_0x5a2f6c,_0x21ac01){_0x5a2f6c=_0x5a2f6c-0x0;var _0x48c09b=_0xb741[_0x5a2f6c];return _0x48c09b;};'use strict';var _=require(_0x1b74('0x0'));var util=require(_0x1b74('0x1'));var moment=require(_0x1b74('0x2'));var BPromise=require('bluebird');var rs=require(_0x1b74('0x3'));var fs=require('fs');var Redis=require(_0x1b74('0x4'));var db=require(_0x1b74('0x5'))['db'];var utils=require(_0x1b74('0x6'));var logger=require(_0x1b74('0x7'))('rpc');var config=require(_0x1b74('0x8'));var jayson=require(_0x1b74('0x9'));var client=jayson['client'][_0x1b74('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x231b8d,_0x5d0d99,_0x1b5c9e){return new BPromise(function(_0x4f0459,_0x5a8c17){return client[_0x1b74('0xb')](_0x231b8d,_0x1b5c9e)[_0x1b74('0xc')](function(_0x1ebbb2){logger[_0x1b74('0xd')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5d0d99,_0x1b74('0xe'));logger[_0x1b74('0xf')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x5d0d99,_0x1b74('0xe'),JSON[_0x1b74('0x10')](_0x1ebbb2));if(_0x1ebbb2[_0x1b74('0x11')]){if(_0x1ebbb2[_0x1b74('0x11')][_0x1b74('0x12')]===0x1f4){logger[_0x1b74('0x11')](_0x1b74('0x13'),_0x5d0d99,_0x1ebbb2[_0x1b74('0x11')]['message']);return _0x5a8c17(_0x1ebbb2[_0x1b74('0x11')][_0x1b74('0x14')]);}logger[_0x1b74('0x11')](_0x1b74('0x13'),_0x5d0d99,_0x1ebbb2[_0x1b74('0x11')][_0x1b74('0x14')]);return _0x4f0459(_0x1ebbb2['error'][_0x1b74('0x14')]);}else{logger[_0x1b74('0xd')](_0x1b74('0x13'),_0x5d0d99,'request\x20sent');_0x4f0459(_0x1ebbb2[_0x1b74('0x15')][_0x1b74('0x14')]);}})[_0x1b74('0x16')](function(_0x4e7349){logger[_0x1b74('0x11')](_0x1b74('0x13'),_0x5d0d99,_0x4e7349);_0x5a8c17(_0x4e7349);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index c6911a5..1a7a0ca 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 _0x0752=['index','/:id','show','post','create','put','delete','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated'];(function(_0x521eb2,_0x5aa0ba){var _0x32a16c=function(_0x47224e){while(--_0x47224e){_0x521eb2['push'](_0x521eb2['shift']());}};_0x32a16c(++_0x5aa0ba);}(_0x0752,0x14c));var _0x2075=function(_0x51880f,_0x1490ac){_0x51880f=_0x51880f-0x0;var _0x6cb6e6=_0x0752[_0x51880f];return _0x6cb6e6;};'use strict';var multer=require('multer');var util=require(_0x2075('0x0'));var path=require(_0x2075('0x1'));var timeout=require(_0x2075('0x2'));var express=require('express');var router=express[_0x2075('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2075('0x4'));var interaction=require(_0x2075('0x5'));var config=require(_0x2075('0x6'));var controller=require(_0x2075('0x7'));router[_0x2075('0x8')]('/',auth[_0x2075('0x9')](),controller[_0x2075('0xa')]);router[_0x2075('0x8')](_0x2075('0xb'),auth[_0x2075('0x9')](),controller[_0x2075('0xc')]);router[_0x2075('0xd')]('/',auth['isAuthenticated'](),controller[_0x2075('0xe')]);router[_0x2075('0xf')]('/:id',auth[_0x2075('0x9')](),controller['update']);router[_0x2075('0x10')](_0x2075('0xb'),auth[_0x2075('0x9')](),controller['destroy']);module[_0x2075('0x11')]=router; \ No newline at end of file +var _0x3e14=['fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','show','post','create','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x3e6aab,_0x1e0700){var _0x37e8d1=function(_0x2afa5e){while(--_0x2afa5e){_0x3e6aab['push'](_0x3e6aab['shift']());}};_0x37e8d1(++_0x1e0700);}(_0x3e14,0xea));var _0x43e1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3e14[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x43e1('0x0'));var util=require(_0x43e1('0x1'));var path=require(_0x43e1('0x2'));var timeout=require(_0x43e1('0x3'));var express=require(_0x43e1('0x4'));var router=express[_0x43e1('0x5')]();var fs_extra=require(_0x43e1('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x43e1('0x7'));var config=require(_0x43e1('0x8'));var controller=require(_0x43e1('0x9'));router[_0x43e1('0xa')]('/',auth[_0x43e1('0xb')](),controller[_0x43e1('0xc')]);router[_0x43e1('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x43e1('0xd')]);router[_0x43e1('0xe')]('/',auth[_0x43e1('0xb')](),controller[_0x43e1('0xf')]);router['put'](_0x43e1('0x10'),auth[_0x43e1('0xb')](),controller[_0x43e1('0x11')]);router[_0x43e1('0x12')](_0x43e1('0x10'),auth['isAuthenticated'](),controller[_0x43e1('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index dcf18eb..baf3f71 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 _0x7643=['STRING','BOOLEAN','exports','ENUM','string','variable','keyValue','picklist'];(function(_0x4d209b,_0x1a05e8){var _0xc5e693=function(_0x109c6e){while(--_0x109c6e){_0x4d209b['push'](_0x4d209b['shift']());}};_0xc5e693(++_0x1a05e8);}(_0x7643,0x14a));var _0x3764=function(_0x149225,_0x5869e2){_0x149225=_0x149225-0x0;var _0x21e6ac=_0x7643[_0x149225];return _0x21e6ac;};'use strict';var Sequelize=require('sequelize');module[_0x3764('0x0')]={'type':{'type':Sequelize[_0x3764('0x1')](_0x3764('0x2'),_0x3764('0x3'),'customVariable',_0x3764('0x4'),_0x3764('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x3764('0x6')]},'keyType':{'type':Sequelize[_0x3764('0x1')](_0x3764('0x2'),_0x3764('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x3764('0x6')]},'nameField':{'type':Sequelize[_0x3764('0x6')]},'customField':{'type':Sequelize[_0x3764('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3764('0x6')]}}; \ No newline at end of file +var _0x946b=['sequelize','exports','string','variable','keyValue','picklist','STRING','ENUM','customVariable','BOOLEAN'];(function(_0x538543,_0x22103f){var _0x5030a3=function(_0x4e855e){while(--_0x4e855e){_0x538543['push'](_0x538543['shift']());}};_0x5030a3(++_0x22103f);}(_0x946b,0x136));var _0xb946=function(_0x3eb0ec,_0x28b0dd){_0x3eb0ec=_0x3eb0ec-0x0;var _0x359c12=_0x946b[_0x3eb0ec];return _0x359c12;};'use strict';var Sequelize=require(_0xb946('0x0'));module[_0xb946('0x1')]={'type':{'type':Sequelize['ENUM'](_0xb946('0x2'),_0xb946('0x3'),'customVariable',_0xb946('0x4'),_0xb946('0x5')),'defaultValue':_0xb946('0x2')},'content':{'type':Sequelize[_0xb946('0x6')]},'key':{'type':Sequelize[_0xb946('0x6')]},'keyType':{'type':Sequelize[_0xb946('0x7')](_0xb946('0x2'),_0xb946('0x3'),_0xb946('0x8'))},'keyContent':{'type':Sequelize[_0xb946('0x6')]},'idField':{'type':Sequelize[_0xb946('0x6')]},'nameField':{'type':Sequelize[_0xb946('0x6')]},'customField':{'type':Sequelize[_0xb946('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb946('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 022e15e..6a2d88a 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 _0x5b37=['hasOwnProperty','nolimit','sort','pick','filter','merge','where','VIRTUAL','includeAll','include','findAll','rows','catch','params','find','create','body','eml-format','zip-dir','fast-json-patch','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','query','keys','filters','intersection','model','fields','length','attributes'];(function(_0xe6ff0d,_0xe8ce4b){var _0x4cd2a6=function(_0x420702){while(--_0x420702){_0xe6ff0d['push'](_0xe6ff0d['shift']());}};_0x4cd2a6(++_0xe8ce4b);}(_0x5b37,0x1cd));var _0x75b3=function(_0x57408b,_0xb7cbc5){_0x57408b=_0x57408b-0x0;var _0x31a897=_0x5b37[_0x57408b];return _0x31a897;};'use strict';var emlformat=require(_0x75b3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x75b3('0x1'));var jsonpatch=require(_0x75b3('0x2'));var rp=require('request-promise');var moment=require(_0x75b3('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x75b3('0x4'));var sox=require(_0x75b3('0x5'));var csv=require(_0x75b3('0x6'));var ejs=require(_0x75b3('0x7'));var fs=require('fs');var fs_extra=require(_0x75b3('0x8'));var _=require(_0x75b3('0x9'));var squel=require(_0x75b3('0xa'));var crypto=require(_0x75b3('0xb'));var jsforce=require(_0x75b3('0xc'));var deskjs=require(_0x75b3('0xd'));var toCsv=require(_0x75b3('0x6'));var querystring=require(_0x75b3('0xe'));var Papa=require(_0x75b3('0xf'));var Redis=require(_0x75b3('0x10'));var authService=require(_0x75b3('0x11'));var qs=require(_0x75b3('0x12'));var as=require(_0x75b3('0x13'));var hardwareService=require(_0x75b3('0x14'));var logger=require(_0x75b3('0x15'))(_0x75b3('0x16'));var utils=require(_0x75b3('0x17'));var config=require(_0x75b3('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4127e1,_0x49c4a7){_0x49c4a7=_0x49c4a7||0xcc;return function(_0x424068){if(_0x424068){return _0x4127e1['sendStatus'](_0x49c4a7);}return _0x4127e1[_0x75b3('0x19')](_0x49c4a7)[_0x75b3('0x1a')]();};}function respondWithResult(_0x44267a,_0x215468){_0x215468=_0x215468||0xc8;return function(_0x5a7390){if(_0x5a7390){return _0x44267a['status'](_0x215468)[_0x75b3('0x1b')](_0x5a7390);}};}function respondWithFilteredResult(_0x26a29f,_0x580aaa){return function(_0x1a9d3e){if(_0x1a9d3e){var _0x401bef=typeof _0x580aaa['offset']===_0x75b3('0x1c')&&typeof _0x580aaa[_0x75b3('0x1d')]===_0x75b3('0x1c');var _0x37aba9=_0x1a9d3e['count'];var _0x6de4dc=_0x401bef?0x0:_0x580aaa[_0x75b3('0x1e')];var _0x3c8a0c=_0x401bef?_0x1a9d3e[_0x75b3('0x1f')]:_0x580aaa[_0x75b3('0x1e')]+_0x580aaa[_0x75b3('0x1d')];var _0xbd990a;if(_0x3c8a0c>=_0x37aba9){_0x3c8a0c=_0x37aba9;_0xbd990a=0xc8;}else{_0xbd990a=0xce;}_0x26a29f[_0x75b3('0x19')](_0xbd990a);return _0x26a29f[_0x75b3('0x20')](_0x75b3('0x21'),_0x6de4dc+'-'+_0x3c8a0c+'/'+_0x37aba9)['json'](_0x1a9d3e);}return null;};}function patchUpdates(_0x566bdb){return function(_0x485655){try{jsonpatch[_0x75b3('0x22')](_0x485655,_0x566bdb,!![]);}catch(_0x9eb919){return BPromise[_0x75b3('0x23')](_0x9eb919);}return _0x485655[_0x75b3('0x24')]();};}function saveUpdates(_0x4b10c6,_0x311dfa){return function(_0x3542be){if(_0x3542be){return _0x3542be[_0x75b3('0x25')](_0x4b10c6)[_0x75b3('0x26')](function(_0x387fe5){return _0x387fe5;});}return null;};}function removeEntity(_0x3b83d6,_0x1addf5){return function(_0x3cab1c){if(_0x3cab1c){return _0x3cab1c[_0x75b3('0x27')]()[_0x75b3('0x26')](function(){_0x3b83d6[_0x75b3('0x19')](0xcc)[_0x75b3('0x1a')]();});}};}function handleEntityNotFound(_0x46e7c6,_0x518805){return function(_0x5391d1){if(!_0x5391d1){_0x46e7c6['sendStatus'](0x194);}return _0x5391d1;};}function handleError(_0x127e16,_0xc88a8b){_0xc88a8b=_0xc88a8b||0x1f4;return function(_0x7e7d29){logger[_0x75b3('0x28')](_0x7e7d29[_0x75b3('0x29')]);if(_0x7e7d29[_0x75b3('0x2a')]){delete _0x7e7d29[_0x75b3('0x2a')];}_0x127e16['status'](_0xc88a8b)[_0x75b3('0x2b')](_0x7e7d29);};}exports[_0x75b3('0x2c')]=function(_0x3cc197,_0x24240a){var _0x351f60={},_0x5baf71={},_0x32ef6c={'count':0x0,'rows':[]};var _0x2dfe1d=_[_0x75b3('0x2d')](db[_0x75b3('0x2e')][_0x75b3('0x2f')],function(_0x2cf57a){return{'name':_0x2cf57a[_0x75b3('0x30')],'type':_0x2cf57a['type']['key']};});_0x5baf71['model']=_[_0x75b3('0x2d')](_0x2dfe1d,_0x75b3('0x2a'));_0x5baf71[_0x75b3('0x31')]=_[_0x75b3('0x32')](_0x3cc197[_0x75b3('0x31')]);_0x5baf71[_0x75b3('0x33')]=_[_0x75b3('0x34')](_0x5baf71['model'],_0x5baf71[_0x75b3('0x31')]);_0x351f60['attributes']=_['intersection'](_0x5baf71[_0x75b3('0x35')],qs[_0x75b3('0x36')](_0x3cc197[_0x75b3('0x31')]['fields']));_0x351f60['attributes']=_0x351f60['attributes'][_0x75b3('0x37')]?_0x351f60[_0x75b3('0x38')]:_0x5baf71[_0x75b3('0x35')];if(!_0x3cc197[_0x75b3('0x31')][_0x75b3('0x39')](_0x75b3('0x3a'))){_0x351f60[_0x75b3('0x1d')]=qs[_0x75b3('0x1d')](_0x3cc197[_0x75b3('0x31')][_0x75b3('0x1d')]);_0x351f60[_0x75b3('0x1e')]=qs[_0x75b3('0x1e')](_0x3cc197['query'][_0x75b3('0x1e')]);}_0x351f60['order']=qs[_0x75b3('0x3b')](_0x3cc197[_0x75b3('0x31')][_0x75b3('0x3b')]);_0x351f60['where']=qs[_0x75b3('0x33')](_[_0x75b3('0x3c')](_0x3cc197['query'],_0x5baf71[_0x75b3('0x33')]),_0x2dfe1d);if(_0x3cc197[_0x75b3('0x31')][_0x75b3('0x3d')]){_0x351f60['where']=_[_0x75b3('0x3e')](_0x351f60[_0x75b3('0x3f')],{'$or':_[_0x75b3('0x2d')](_0x2dfe1d,function(_0x11eabc){if(_0x11eabc['type']!==_0x75b3('0x40')){var _0x17c98e={};_0x17c98e[_0x11eabc[_0x75b3('0x2a')]]={'$like':'%'+_0x3cc197[_0x75b3('0x31')][_0x75b3('0x3d')]+'%'};return _0x17c98e;}})});}_0x351f60=_[_0x75b3('0x3e')]({},_0x351f60,_0x3cc197['options']);var _0x2a1403={'where':_0x351f60[_0x75b3('0x3f')]};return db[_0x75b3('0x2e')][_0x75b3('0x1f')](_0x2a1403)[_0x75b3('0x26')](function(_0xb8baed){_0x32ef6c[_0x75b3('0x1f')]=_0xb8baed;if(_0x3cc197['query'][_0x75b3('0x41')]){_0x351f60[_0x75b3('0x42')]=[{'all':!![]}];}return db[_0x75b3('0x2e')][_0x75b3('0x43')](_0x351f60);})[_0x75b3('0x26')](function(_0x192aff){_0x32ef6c[_0x75b3('0x44')]=_0x192aff;return _0x32ef6c;})[_0x75b3('0x26')](respondWithFilteredResult(_0x24240a,_0x351f60))[_0x75b3('0x45')](handleError(_0x24240a,null));};exports['show']=function(_0x3be21f,_0x18f576){var _0x7d420b={'raw':!![],'where':{'id':_0x3be21f[_0x75b3('0x46')]['id']}},_0x4b8d80={};_0x4b8d80[_0x75b3('0x35')]=_['keys'](db[_0x75b3('0x2e')]['rawAttributes']);_0x4b8d80[_0x75b3('0x31')]=_[_0x75b3('0x32')](_0x3be21f[_0x75b3('0x31')]);_0x4b8d80[_0x75b3('0x33')]=_[_0x75b3('0x34')](_0x4b8d80['model'],_0x4b8d80[_0x75b3('0x31')]);_0x7d420b[_0x75b3('0x38')]=_[_0x75b3('0x34')](_0x4b8d80['model'],qs[_0x75b3('0x36')](_0x3be21f[_0x75b3('0x31')][_0x75b3('0x36')]));_0x7d420b[_0x75b3('0x38')]=_0x7d420b[_0x75b3('0x38')]['length']?_0x7d420b[_0x75b3('0x38')]:_0x4b8d80[_0x75b3('0x35')];if(_0x3be21f[_0x75b3('0x31')][_0x75b3('0x41')]){_0x7d420b[_0x75b3('0x42')]=[{'all':!![]}];}_0x7d420b=_[_0x75b3('0x3e')]({},_0x7d420b,_0x3be21f['options']);return db[_0x75b3('0x2e')][_0x75b3('0x47')](_0x7d420b)[_0x75b3('0x26')](handleEntityNotFound(_0x18f576,null))['then'](respondWithResult(_0x18f576,null))[_0x75b3('0x45')](handleError(_0x18f576,null));};exports[_0x75b3('0x48')]=function(_0xb8a0d3,_0x15aede){return db[_0x75b3('0x2e')]['create'](_0xb8a0d3[_0x75b3('0x49')],{})['then'](respondWithResult(_0x15aede,0xc9))[_0x75b3('0x45')](handleError(_0x15aede,null));};exports[_0x75b3('0x25')]=function(_0x450b2f,_0x4dabc1){if(_0x450b2f[_0x75b3('0x49')]['id']){delete _0x450b2f[_0x75b3('0x49')]['id'];}return db[_0x75b3('0x2e')][_0x75b3('0x47')]({'where':{'id':_0x450b2f[_0x75b3('0x46')]['id']}})[_0x75b3('0x26')](handleEntityNotFound(_0x4dabc1,null))[_0x75b3('0x26')](saveUpdates(_0x450b2f[_0x75b3('0x49')],null))[_0x75b3('0x26')](respondWithResult(_0x4dabc1,null))[_0x75b3('0x45')](handleError(_0x4dabc1,null));};exports[_0x75b3('0x27')]=function(_0x2c1b5d,_0x4337f3){return db['Dynamics365Field'][_0x75b3('0x47')]({'where':{'id':_0x2c1b5d[_0x75b3('0x46')]['id']}})[_0x75b3('0x26')](handleEntityNotFound(_0x4337f3,null))[_0x75b3('0x26')](removeEntity(_0x4337f3,null))[_0x75b3('0x45')](handleError(_0x4337f3,null));}; \ No newline at end of file +var _0x0ade=['desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','Dynamics365Field','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','jsforce'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x0ade,0x1bb));var _0xe0ad=function(_0x1be98c,_0x2699b0){_0x1be98c=_0x1be98c-0x0;var _0x5bec77=_0x0ade[_0x1be98c];return _0x5bec77;};'use strict';var emlformat=require(_0xe0ad('0x0'));var rimraf=require(_0xe0ad('0x1'));var zipdir=require(_0xe0ad('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0ad('0x3'));var moment=require(_0xe0ad('0x4'));var BPromise=require(_0xe0ad('0x5'));var Mustache=require('mustache');var util=require(_0xe0ad('0x6'));var path=require(_0xe0ad('0x7'));var sox=require(_0xe0ad('0x8'));var csv=require('to-csv');var ejs=require(_0xe0ad('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe0ad('0xa'));var squel=require(_0xe0ad('0xb'));var crypto=require('crypto');var jsforce=require(_0xe0ad('0xc'));var deskjs=require(_0xe0ad('0xd'));var toCsv=require(_0xe0ad('0xe'));var querystring=require(_0xe0ad('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0ad('0x10'));var authService=require(_0xe0ad('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe0ad('0x12'))('api');var utils=require(_0xe0ad('0x13'));var config=require(_0xe0ad('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0ad('0x15'))['db'];function respondWithStatusCode(_0x1d5c6b,_0x5a1735){_0x5a1735=_0x5a1735||0xcc;return function(_0x120534){if(_0x120534){return _0x1d5c6b['sendStatus'](_0x5a1735);}return _0x1d5c6b[_0xe0ad('0x16')](_0x5a1735)[_0xe0ad('0x17')]();};}function respondWithResult(_0xd9d500,_0x2a3894){_0x2a3894=_0x2a3894||0xc8;return function(_0x4984a9){if(_0x4984a9){return _0xd9d500[_0xe0ad('0x16')](_0x2a3894)[_0xe0ad('0x18')](_0x4984a9);}};}function respondWithFilteredResult(_0x5e245e,_0x182d24){return function(_0x5ca517){if(_0x5ca517){var _0x4b468e=typeof _0x182d24[_0xe0ad('0x19')]===_0xe0ad('0x1a')&&typeof _0x182d24[_0xe0ad('0x1b')]===_0xe0ad('0x1a');var _0x27fe00=_0x5ca517[_0xe0ad('0x1c')];var _0x2f2dfd=_0x4b468e?0x0:_0x182d24[_0xe0ad('0x19')];var _0x5d30bd=_0x4b468e?_0x5ca517[_0xe0ad('0x1c')]:_0x182d24[_0xe0ad('0x19')]+_0x182d24['limit'];var _0x5709de;if(_0x5d30bd>=_0x27fe00){_0x5d30bd=_0x27fe00;_0x5709de=0xc8;}else{_0x5709de=0xce;}_0x5e245e[_0xe0ad('0x16')](_0x5709de);return _0x5e245e['set'](_0xe0ad('0x1d'),_0x2f2dfd+'-'+_0x5d30bd+'/'+_0x27fe00)[_0xe0ad('0x18')](_0x5ca517);}return null;};}function patchUpdates(_0x380e82){return function(_0xee7fe2){try{jsonpatch[_0xe0ad('0x1e')](_0xee7fe2,_0x380e82,!![]);}catch(_0x3b249b){return BPromise[_0xe0ad('0x1f')](_0x3b249b);}return _0xee7fe2[_0xe0ad('0x20')]();};}function saveUpdates(_0x5e23bc,_0x1e68a6){return function(_0x32696a){if(_0x32696a){return _0x32696a[_0xe0ad('0x21')](_0x5e23bc)[_0xe0ad('0x22')](function(_0x100ea0){return _0x100ea0;});}return null;};}function removeEntity(_0x2125e4,_0x5c0ff5){return function(_0x2d95db){if(_0x2d95db){return _0x2d95db[_0xe0ad('0x23')]()[_0xe0ad('0x22')](function(){_0x2125e4[_0xe0ad('0x16')](0xcc)[_0xe0ad('0x17')]();});}};}function handleEntityNotFound(_0x1347c6,_0x2eedf2){return function(_0x217ce4){if(!_0x217ce4){_0x1347c6[_0xe0ad('0x24')](0x194);}return _0x217ce4;};}function handleError(_0x2497c3,_0x4a216e){_0x4a216e=_0x4a216e||0x1f4;return function(_0x57d404){logger[_0xe0ad('0x25')](_0x57d404[_0xe0ad('0x26')]);if(_0x57d404[_0xe0ad('0x27')]){delete _0x57d404['name'];}_0x2497c3['status'](_0x4a216e)[_0xe0ad('0x28')](_0x57d404);};}exports[_0xe0ad('0x29')]=function(_0x11a6e7,_0x54f087){var _0x47f106={},_0x31a99c={},_0x98e80e={'count':0x0,'rows':[]};var _0x19e809=_['map'](db[_0xe0ad('0x2a')][_0xe0ad('0x2b')],function(_0x4211fc){return{'name':_0x4211fc[_0xe0ad('0x2c')],'type':_0x4211fc['type'][_0xe0ad('0x2d')]};});_0x31a99c[_0xe0ad('0x2e')]=_[_0xe0ad('0x2f')](_0x19e809,'name');_0x31a99c[_0xe0ad('0x30')]=_[_0xe0ad('0x31')](_0x11a6e7[_0xe0ad('0x30')]);_0x31a99c[_0xe0ad('0x32')]=_['intersection'](_0x31a99c[_0xe0ad('0x2e')],_0x31a99c[_0xe0ad('0x30')]);_0x47f106[_0xe0ad('0x33')]=_[_0xe0ad('0x34')](_0x31a99c[_0xe0ad('0x2e')],qs[_0xe0ad('0x35')](_0x11a6e7['query'][_0xe0ad('0x35')]));_0x47f106['attributes']=_0x47f106['attributes'][_0xe0ad('0x36')]?_0x47f106[_0xe0ad('0x33')]:_0x31a99c[_0xe0ad('0x2e')];if(!_0x11a6e7[_0xe0ad('0x30')][_0xe0ad('0x37')](_0xe0ad('0x38'))){_0x47f106['limit']=qs[_0xe0ad('0x1b')](_0x11a6e7[_0xe0ad('0x30')][_0xe0ad('0x1b')]);_0x47f106['offset']=qs['offset'](_0x11a6e7['query'][_0xe0ad('0x19')]);}_0x47f106[_0xe0ad('0x39')]=qs['sort'](_0x11a6e7[_0xe0ad('0x30')][_0xe0ad('0x3a')]);_0x47f106[_0xe0ad('0x3b')]=qs['filters'](_[_0xe0ad('0x3c')](_0x11a6e7[_0xe0ad('0x30')],_0x31a99c[_0xe0ad('0x32')]),_0x19e809);if(_0x11a6e7[_0xe0ad('0x30')][_0xe0ad('0x3d')]){_0x47f106[_0xe0ad('0x3b')]=_[_0xe0ad('0x3e')](_0x47f106['where'],{'$or':_[_0xe0ad('0x2f')](_0x19e809,function(_0x91f263){if(_0x91f263[_0xe0ad('0x3f')]!==_0xe0ad('0x40')){var _0x528e46={};_0x528e46[_0x91f263[_0xe0ad('0x27')]]={'$like':'%'+_0x11a6e7[_0xe0ad('0x30')][_0xe0ad('0x3d')]+'%'};return _0x528e46;}})});}_0x47f106=_['merge']({},_0x47f106,_0x11a6e7[_0xe0ad('0x41')]);var _0x547587={'where':_0x47f106['where']};return db['Dynamics365Field'][_0xe0ad('0x1c')](_0x547587)[_0xe0ad('0x22')](function(_0x15adc4){_0x98e80e['count']=_0x15adc4;if(_0x11a6e7['query'][_0xe0ad('0x42')]){_0x47f106[_0xe0ad('0x43')]=[{'all':!![]}];}return db[_0xe0ad('0x2a')][_0xe0ad('0x44')](_0x47f106);})['then'](function(_0x2098f8){_0x98e80e[_0xe0ad('0x45')]=_0x2098f8;return _0x98e80e;})[_0xe0ad('0x22')](respondWithFilteredResult(_0x54f087,_0x47f106))[_0xe0ad('0x46')](handleError(_0x54f087,null));};exports[_0xe0ad('0x47')]=function(_0x51bf2b,_0x533ca7){var _0x3295fc={'raw':!![],'where':{'id':_0x51bf2b[_0xe0ad('0x48')]['id']}},_0x27a1de={};_0x27a1de[_0xe0ad('0x2e')]=_[_0xe0ad('0x31')](db[_0xe0ad('0x2a')][_0xe0ad('0x2b')]);_0x27a1de['query']=_[_0xe0ad('0x31')](_0x51bf2b['query']);_0x27a1de[_0xe0ad('0x32')]=_[_0xe0ad('0x34')](_0x27a1de['model'],_0x27a1de[_0xe0ad('0x30')]);_0x3295fc[_0xe0ad('0x33')]=_[_0xe0ad('0x34')](_0x27a1de[_0xe0ad('0x2e')],qs[_0xe0ad('0x35')](_0x51bf2b[_0xe0ad('0x30')][_0xe0ad('0x35')]));_0x3295fc[_0xe0ad('0x33')]=_0x3295fc[_0xe0ad('0x33')][_0xe0ad('0x36')]?_0x3295fc[_0xe0ad('0x33')]:_0x27a1de['model'];if(_0x51bf2b['query']['includeAll']){_0x3295fc['include']=[{'all':!![]}];}_0x3295fc=_[_0xe0ad('0x3e')]({},_0x3295fc,_0x51bf2b['options']);return db['Dynamics365Field']['find'](_0x3295fc)[_0xe0ad('0x22')](handleEntityNotFound(_0x533ca7,null))['then'](respondWithResult(_0x533ca7,null))[_0xe0ad('0x46')](handleError(_0x533ca7,null));};exports['create']=function(_0x3ebc70,_0x1368bf){return db[_0xe0ad('0x2a')][_0xe0ad('0x49')](_0x3ebc70[_0xe0ad('0x4a')],{})[_0xe0ad('0x22')](respondWithResult(_0x1368bf,0xc9))[_0xe0ad('0x46')](handleError(_0x1368bf,null));};exports['update']=function(_0x58f7ba,_0x31a6ed){if(_0x58f7ba[_0xe0ad('0x4a')]['id']){delete _0x58f7ba[_0xe0ad('0x4a')]['id'];}return db[_0xe0ad('0x2a')][_0xe0ad('0x4b')]({'where':{'id':_0x58f7ba['params']['id']}})[_0xe0ad('0x22')](handleEntityNotFound(_0x31a6ed,null))['then'](saveUpdates(_0x58f7ba['body'],null))[_0xe0ad('0x22')](respondWithResult(_0x31a6ed,null))[_0xe0ad('0x46')](handleError(_0x31a6ed,null));};exports[_0xe0ad('0x23')]=function(_0x4b1513,_0x843db4){return db[_0xe0ad('0x2a')][_0xe0ad('0x4b')]({'where':{'id':_0x4b1513[_0xe0ad('0x48')]['id']}})[_0xe0ad('0x22')](handleEntityNotFound(_0x843db4,null))[_0xe0ad('0x22')](removeEntity(_0x843db4,null))[_0xe0ad('0x46')](handleError(_0x843db4,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 4e89444..74f4018 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 _0x82d3=['FieldId','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','dynamics365_unique_index','idField'];(function(_0x505f51,_0x1a3e1d){var _0x5468b3=function(_0x371b35){while(--_0x371b35){_0x505f51['push'](_0x505f51['shift']());}};_0x5468b3(++_0x1a3e1d);}(_0x82d3,0x1cf));var _0x382d=function(_0x2a5181,_0x53df32){_0x2a5181=_0x2a5181-0x0;var _0x59e2aa=_0x82d3[_0x2a5181];return _0x59e2aa;};'use strict';var _=require(_0x382d('0x0'));var util=require(_0x382d('0x1'));var logger=require(_0x382d('0x2'))(_0x382d('0x3'));var moment=require(_0x382d('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x382d('0x5'));var rimraf=require(_0x382d('0x6'));var config=require(_0x382d('0x7'));var attributes=require(_0x382d('0x8'));module[_0x382d('0x9')]=function(_0x4f21aa,_0x7c30a6){return _0x4f21aa[_0x382d('0xa')]('Dynamics365Field',attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x382d('0xb'),'fields':[_0x382d('0xc'),_0x382d('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x90f5=['../../config/environment','./intDynamics365Field.attributes','Dynamics365Field','dynamics365_unique_index','lodash','util','../../config/logger','api','path'];(function(_0x3d1996,_0x1f08f0){var _0x550afd=function(_0xb3b511){while(--_0xb3b511){_0x3d1996['push'](_0x3d1996['shift']());}};_0x550afd(++_0x1f08f0);}(_0x90f5,0x1bd));var _0x590f=function(_0xb4aa55,_0x89c54){_0xb4aa55=_0xb4aa55-0x0;var _0x138c13=_0x90f5[_0xb4aa55];return _0x138c13;};'use strict';var _=require(_0x590f('0x0'));var util=require(_0x590f('0x1'));var logger=require(_0x590f('0x2'))(_0x590f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x590f('0x4'));var rimraf=require('rimraf');var config=require(_0x590f('0x5'));var attributes=require(_0x590f('0x6'));module['exports']=function(_0x2ade05,_0x273003){return _0x2ade05['define'](_0x590f('0x7'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x590f('0x8'),'fields':['idField','FieldId'],'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 3c6992b..3f5cd89 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 _0x2ccc=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','error','code','Dynamics365Field,\x20%s,\x20%s','message','result'];(function(_0x5c1353,_0x1cdbaa){var _0x5cceca=function(_0x482531){while(--_0x482531){_0x5c1353['push'](_0x5c1353['shift']());}};_0x5cceca(++_0x1cdbaa);}(_0x2ccc,0x6a));var _0xc2cc=function(_0x2355d6,_0x1f8b95){_0x2355d6=_0x2355d6-0x0;var _0x4b83eb=_0x2ccc[_0x2355d6];return _0x4b83eb;};'use strict';var _=require(_0xc2cc('0x0'));var util=require(_0xc2cc('0x1'));var moment=require(_0xc2cc('0x2'));var BPromise=require(_0xc2cc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc2cc('0x4'));var db=require(_0xc2cc('0x5'))['db'];var utils=require(_0xc2cc('0x6'));var logger=require(_0xc2cc('0x7'))(_0xc2cc('0x8'));var config=require('../../config/environment');var jayson=require(_0xc2cc('0x9'));var client=jayson[_0xc2cc('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x49fce3,_0x3748fa,_0x3992d9){return new BPromise(function(_0x581564,_0x4d1795){return client[_0xc2cc('0xb')](_0x49fce3,_0x3992d9)[_0xc2cc('0xc')](function(_0x41ffad){logger[_0xc2cc('0xd')]('Dynamics365Field,\x20%s,\x20%s',_0x3748fa,_0xc2cc('0xe'));logger['debug']('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x3748fa,'request\x20sent',JSON['stringify'](_0x41ffad));if(_0x41ffad[_0xc2cc('0xf')]){if(_0x41ffad[_0xc2cc('0xf')][_0xc2cc('0x10')]===0x1f4){logger['error'](_0xc2cc('0x11'),_0x3748fa,_0x41ffad[_0xc2cc('0xf')][_0xc2cc('0x12')]);return _0x4d1795(_0x41ffad['error'][_0xc2cc('0x12')]);}logger[_0xc2cc('0xf')](_0xc2cc('0x11'),_0x3748fa,_0x41ffad[_0xc2cc('0xf')][_0xc2cc('0x12')]);return _0x581564(_0x41ffad[_0xc2cc('0xf')][_0xc2cc('0x12')]);}else{logger[_0xc2cc('0xd')](_0xc2cc('0x11'),_0x3748fa,_0xc2cc('0xe'));_0x581564(_0x41ffad[_0xc2cc('0x13')][_0xc2cc('0x12')]);}})[_0xc2cc('0x14')](function(_0xa2573c){logger[_0xc2cc('0xf')](_0xc2cc('0x11'),_0x3748fa,_0xa2573c);_0x4d1795(_0xa2573c);});});} \ No newline at end of file +var _0xb51b=['message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0xcc4d3a,_0x104f66){var _0x20bae1=function(_0x2403f8){while(--_0x2403f8){_0xcc4d3a['push'](_0xcc4d3a['shift']());}};_0x20bae1(++_0x104f66);}(_0xb51b,0x1b9));var _0xbb51=function(_0x5daa9a,_0x2f25a){_0x5daa9a=_0x5daa9a-0x0;var _0x46f606=_0xb51b[_0x5daa9a];return _0x46f606;};'use strict';var _=require(_0xbb51('0x0'));var util=require(_0xbb51('0x1'));var moment=require('moment');var BPromise=require(_0xbb51('0x2'));var rs=require(_0xbb51('0x3'));var fs=require('fs');var Redis=require(_0xbb51('0x4'));var db=require(_0xbb51('0x5'))['db'];var utils=require(_0xbb51('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xbb51('0x7'));var jayson=require(_0xbb51('0x8'));var client=jayson['client'][_0xbb51('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23d06b,_0xd7bfb2,_0x244339){return new BPromise(function(_0x39ceaf,_0x33708c){return client[_0xbb51('0xa')](_0x23d06b,_0x244339)[_0xbb51('0xb')](function(_0x5df0eb){logger[_0xbb51('0xc')](_0xbb51('0xd'),_0xd7bfb2,_0xbb51('0xe'));logger['debug'](_0xbb51('0xf'),_0xd7bfb2,'request\x20sent',JSON[_0xbb51('0x10')](_0x5df0eb));if(_0x5df0eb[_0xbb51('0x11')]){if(_0x5df0eb['error'][_0xbb51('0x12')]===0x1f4){logger['error'](_0xbb51('0xd'),_0xd7bfb2,_0x5df0eb[_0xbb51('0x11')][_0xbb51('0x13')]);return _0x33708c(_0x5df0eb['error']['message']);}logger[_0xbb51('0x11')](_0xbb51('0xd'),_0xd7bfb2,_0x5df0eb['error'][_0xbb51('0x13')]);return _0x39ceaf(_0x5df0eb[_0xbb51('0x11')]['message']);}else{logger[_0xbb51('0xc')](_0xbb51('0xd'),_0xd7bfb2,_0xbb51('0xe'));_0x39ceaf(_0x5df0eb['result'][_0xbb51('0x13')]);}})['catch'](function(_0x2ac455){logger[_0xbb51('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0xd7bfb2,_0x2ac455);_0x33708c(_0x2ac455);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 91c4d1a..d0f15b1 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 _0x28ed=['/:id','show','getConfigurations','getFields','post','create','/:id/configurations','addConfiguration','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index'];(function(_0x2d4f14,_0x33e72d){var _0x58aa91=function(_0x55e903){while(--_0x55e903){_0x2d4f14['push'](_0x2d4f14['shift']());}};_0x58aa91(++_0x33e72d);}(_0x28ed,0x17b));var _0xd28e=function(_0x2dbfd2,_0x377d06){_0x2dbfd2=_0x2dbfd2-0x0;var _0x5eeafd=_0x28ed[_0x2dbfd2];return _0x5eeafd;};'use strict';var multer=require(_0xd28e('0x0'));var util=require('util');var path=require(_0xd28e('0x1'));var timeout=require(_0xd28e('0x2'));var express=require(_0xd28e('0x3'));var router=express['Router']();var fs_extra=require(_0xd28e('0x4'));var auth=require(_0xd28e('0x5'));var interaction=require(_0xd28e('0x6'));var config=require(_0xd28e('0x7'));var controller=require(_0xd28e('0x8'));router[_0xd28e('0x9')]('/',auth[_0xd28e('0xa')](),controller[_0xd28e('0xb')]);router[_0xd28e('0x9')](_0xd28e('0xc'),auth[_0xd28e('0xa')](),controller[_0xd28e('0xd')]);router[_0xd28e('0x9')]('/:id/configurations',auth[_0xd28e('0xa')](),controller[_0xd28e('0xe')]);router[_0xd28e('0x9')]('/:id/fields',auth[_0xd28e('0xa')](),controller[_0xd28e('0xf')]);router[_0xd28e('0x10')]('/',auth[_0xd28e('0xa')](),controller[_0xd28e('0x11')]);router[_0xd28e('0x10')](_0xd28e('0x12'),auth[_0xd28e('0xa')](),controller[_0xd28e('0x13')]);router['put'](_0xd28e('0xc'),auth[_0xd28e('0xa')](),controller['update']);router[_0xd28e('0x14')](_0xd28e('0xc'),auth[_0xd28e('0xa')](),controller[_0xd28e('0x15')]);module[_0xd28e('0x16')]=router; \ No newline at end of file +var _0x816e=['update','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getFields','post','create','addConfiguration','put'];(function(_0x25d2fa,_0x1d35c6){var _0x42d4aa=function(_0x590383){while(--_0x590383){_0x25d2fa['push'](_0x25d2fa['shift']());}};_0x42d4aa(++_0x1d35c6);}(_0x816e,0xe9));var _0xe816=function(_0x323d87,_0x4ef3f9){_0x323d87=_0x323d87-0x0;var _0x5e8f74=_0x816e[_0x323d87];return _0x5e8f74;};'use strict';var multer=require(_0xe816('0x0'));var util=require(_0xe816('0x1'));var path=require(_0xe816('0x2'));var timeout=require('connect-timeout');var express=require(_0xe816('0x3'));var router=express[_0xe816('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe816('0x5'));var interaction=require(_0xe816('0x6'));var config=require(_0xe816('0x7'));var controller=require(_0xe816('0x8'));router[_0xe816('0x9')]('/',auth[_0xe816('0xa')](),controller[_0xe816('0xb')]);router[_0xe816('0x9')](_0xe816('0xc'),auth['isAuthenticated'](),controller[_0xe816('0xd')]);router['get'](_0xe816('0xe'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xe816('0x9')]('/:id/fields',auth[_0xe816('0xa')](),controller[_0xe816('0xf')]);router[_0xe816('0x10')]('/',auth[_0xe816('0xa')](),controller[_0xe816('0x11')]);router[_0xe816('0x10')](_0xe816('0xe'),auth['isAuthenticated'](),controller[_0xe816('0x12')]);router[_0xe816('0x13')](_0xe816('0xc'),auth['isAuthenticated'](),controller[_0xe816('0x14')]);router[_0xe816('0x15')](_0xe816('0xc'),auth[_0xe816('0xa')](),controller['destroy']);module[_0xe816('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 8f4e2ba..5617060 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 _0x4213=['exports','STRING','username','remoteUri','sequelize'];(function(_0x1603f2,_0x1dead1){var _0x462243=function(_0x380ba1){while(--_0x380ba1){_0x1603f2['push'](_0x1603f2['shift']());}};_0x462243(++_0x1dead1);}(_0x4213,0x77));var _0x3421=function(_0x124ae4,_0x13b0ee){_0x124ae4=_0x124ae4-0x0;var _0x216942=_0x4213[_0x124ae4];return _0x216942;};'use strict';var Sequelize=require(_0x3421('0x0'));module[_0x3421('0x1')]={'name':{'type':Sequelize[_0x3421('0x2')]},'description':{'type':Sequelize[_0x3421('0x2')]},'username':{'type':Sequelize[_0x3421('0x2')],'unique':_0x3421('0x3')},'apiKey':{'type':Sequelize[_0x3421('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x3421('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x8603=['remoteUri','exports','STRING'];(function(_0xe330af,_0x49563b){var _0x3b1fa0=function(_0x2fcebe){while(--_0x2fcebe){_0xe330af['push'](_0xe330af['shift']());}};_0x3b1fa0(++_0x49563b);}(_0x8603,0x190));var _0x3860=function(_0x9a23f5,_0xfd4537){_0x9a23f5=_0x9a23f5-0x0;var _0x48eb4f=_0x8603[_0x9a23f5];return _0x48eb4f;};'use strict';var Sequelize=require('sequelize');module[_0x3860('0x0')]={'name':{'type':Sequelize[_0x3860('0x1')]},'description':{'type':Sequelize[_0x3860('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'apiKey':{'type':Sequelize[_0x3860('0x1')]},'remoteUri':{'type':Sequelize[_0x3860('0x1')],'unique':_0x3860('0x2')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index d3cc2b3..237a952 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 _0x1a5c=['destroy','error','stack','name','index','map','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','FreshdeskAccount','includeAll','include','findAll','params','rawAttributes','length','create','body','catch','find','getConfigurations','findOne','pick','AccountId','Subjects','channel','Descriptions','getDescriptions','FreshdeskConfiguration','FreshdeskField','getFields','remoteUri','apiKey','slice','lastIndexOf','format','%s/%s','api/v2/ticket_fields','%s:X','toString','base64','agent','priority','group','source','ticket_type','company','remove','custom_text','label','default','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','then'];(function(_0x1e4f2f,_0x35edfa){var _0xccea89=function(_0x164386){while(--_0x164386){_0x1e4f2f['push'](_0x1e4f2f['shift']());}};_0xccea89(++_0x35edfa);}(_0x1a5c,0x12c));var _0xc1a5=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0x1a5c[_0x55abd9];return _0x3e5669;};'use strict';var emlformat=require(_0xc1a5('0x0'));var rimraf=require(_0xc1a5('0x1'));var zipdir=require(_0xc1a5('0x2'));var jsonpatch=require(_0xc1a5('0x3'));var rp=require(_0xc1a5('0x4'));var moment=require(_0xc1a5('0x5'));var BPromise=require(_0xc1a5('0x6'));var Mustache=require(_0xc1a5('0x7'));var util=require(_0xc1a5('0x8'));var path=require(_0xc1a5('0x9'));var sox=require('sox');var csv=require(_0xc1a5('0xa'));var ejs=require(_0xc1a5('0xb'));var fs=require('fs');var fs_extra=require(_0xc1a5('0xc'));var _=require(_0xc1a5('0xd'));var squel=require(_0xc1a5('0xe'));var crypto=require(_0xc1a5('0xf'));var jsforce=require(_0xc1a5('0x10'));var deskjs=require(_0xc1a5('0x11'));var toCsv=require('to-csv');var querystring=require(_0xc1a5('0x12'));var Papa=require(_0xc1a5('0x13'));var Redis=require('ioredis');var authService=require(_0xc1a5('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc1a5('0x15'));var logger=require(_0xc1a5('0x16'))('api');var utils=require(_0xc1a5('0x17'));var config=require(_0xc1a5('0x18'));var licenseUtil=require(_0xc1a5('0x19'));var db=require(_0xc1a5('0x1a'))['db'];var integrations=require(_0xc1a5('0x1b'));function respondWithStatusCode(_0x52fe6d,_0x428ccf){_0x428ccf=_0x428ccf||0xcc;return function(_0x13d2cf){if(_0x13d2cf){return _0x52fe6d[_0xc1a5('0x1c')](_0x428ccf);}return _0x52fe6d[_0xc1a5('0x1d')](_0x428ccf)[_0xc1a5('0x1e')]();};}function respondWithResult(_0x1dabb5,_0x24e513){_0x24e513=_0x24e513||0xc8;return function(_0x45c431){if(_0x45c431){return _0x1dabb5[_0xc1a5('0x1d')](_0x24e513)['json'](_0x45c431);}};}function respondWithFilteredResult(_0x4b2590,_0x1b2cfb){return function(_0xfdb88e){if(_0xfdb88e){var _0x677442=typeof _0x1b2cfb['offset']===_0xc1a5('0x1f')&&typeof _0x1b2cfb[_0xc1a5('0x20')]===_0xc1a5('0x1f');var _0x5bf0bc=_0xfdb88e[_0xc1a5('0x21')];var _0x4927df=_0x677442?0x0:_0x1b2cfb[_0xc1a5('0x22')];var _0x318f71=_0x677442?_0xfdb88e[_0xc1a5('0x21')]:_0x1b2cfb[_0xc1a5('0x22')]+_0x1b2cfb[_0xc1a5('0x20')];var _0xbccfb9;if(_0x318f71>=_0x5bf0bc){_0x318f71=_0x5bf0bc;_0xbccfb9=0xc8;}else{_0xbccfb9=0xce;}_0x4b2590[_0xc1a5('0x1d')](_0xbccfb9);return _0x4b2590[_0xc1a5('0x23')](_0xc1a5('0x24'),_0x4927df+'-'+_0x318f71+'/'+_0x5bf0bc)[_0xc1a5('0x25')](_0xfdb88e);}return null;};}function patchUpdates(_0x45a3f5){return function(_0x267ee0){try{jsonpatch[_0xc1a5('0x26')](_0x267ee0,_0x45a3f5,!![]);}catch(_0x3548c5){return BPromise['reject'](_0x3548c5);}return _0x267ee0[_0xc1a5('0x27')]();};}function saveUpdates(_0x12002d,_0x4b424c){return function(_0x5a3228){if(_0x5a3228){return _0x5a3228[_0xc1a5('0x28')](_0x12002d)[_0xc1a5('0x29')](function(_0x2a8ee8){return _0x2a8ee8;});}return null;};}function removeEntity(_0x232666,_0x2e2351){return function(_0x22e02e){if(_0x22e02e){return _0x22e02e[_0xc1a5('0x2a')]()['then'](function(){_0x232666['status'](0xcc)[_0xc1a5('0x1e')]();});}};}function handleEntityNotFound(_0x259c22,_0x2d3a61){return function(_0x5c891b){if(!_0x5c891b){_0x259c22[_0xc1a5('0x1c')](0x194);}return _0x5c891b;};}function handleError(_0x4f5cc9,_0x5aba6b){_0x5aba6b=_0x5aba6b||0x1f4;return function(_0x252b2b){logger[_0xc1a5('0x2b')](_0x252b2b[_0xc1a5('0x2c')]);if(_0x252b2b[_0xc1a5('0x2d')]){delete _0x252b2b['name'];}_0x4f5cc9['status'](_0x5aba6b)['send'](_0x252b2b);};}exports[_0xc1a5('0x2e')]=function(_0x56b32a,_0x207a88){var _0x4dc158={},_0x2bef7a={},_0x3ba741={'count':0x0,'rows':[]};var _0x29c00a=_[_0xc1a5('0x2f')](db['FreshdeskAccount']['rawAttributes'],function(_0x20eb2d){return{'name':_0x20eb2d['fieldName'],'type':_0x20eb2d[_0xc1a5('0x30')][_0xc1a5('0x31')]};});_0x2bef7a[_0xc1a5('0x32')]=_[_0xc1a5('0x2f')](_0x29c00a,'name');_0x2bef7a['query']=_[_0xc1a5('0x33')](_0x56b32a[_0xc1a5('0x34')]);_0x2bef7a[_0xc1a5('0x35')]=_[_0xc1a5('0x36')](_0x2bef7a[_0xc1a5('0x32')],_0x2bef7a[_0xc1a5('0x34')]);_0x4dc158[_0xc1a5('0x37')]=_[_0xc1a5('0x36')](_0x2bef7a[_0xc1a5('0x32')],qs[_0xc1a5('0x38')](_0x56b32a[_0xc1a5('0x34')][_0xc1a5('0x38')]));_0x4dc158[_0xc1a5('0x37')]=_0x4dc158[_0xc1a5('0x37')]['length']?_0x4dc158[_0xc1a5('0x37')]:_0x2bef7a[_0xc1a5('0x32')];if(!_0x56b32a[_0xc1a5('0x34')][_0xc1a5('0x39')](_0xc1a5('0x3a'))){_0x4dc158[_0xc1a5('0x20')]=qs['limit'](_0x56b32a[_0xc1a5('0x34')][_0xc1a5('0x20')]);_0x4dc158[_0xc1a5('0x22')]=qs[_0xc1a5('0x22')](_0x56b32a['query'][_0xc1a5('0x22')]);}_0x4dc158[_0xc1a5('0x3b')]=qs[_0xc1a5('0x3c')](_0x56b32a['query']['sort']);_0x4dc158[_0xc1a5('0x3d')]=qs[_0xc1a5('0x35')](_['pick'](_0x56b32a[_0xc1a5('0x34')],_0x2bef7a['filters']),_0x29c00a);if(_0x56b32a['query'][_0xc1a5('0x3e')]){_0x4dc158[_0xc1a5('0x3d')]=_[_0xc1a5('0x3f')](_0x4dc158[_0xc1a5('0x3d')],{'$or':_[_0xc1a5('0x2f')](_0x29c00a,function(_0x5672da){if(_0x5672da[_0xc1a5('0x30')]!==_0xc1a5('0x40')){var _0xc8cd52={};_0xc8cd52[_0x5672da[_0xc1a5('0x2d')]]={'$like':'%'+_0x56b32a['query'][_0xc1a5('0x3e')]+'%'};return _0xc8cd52;}})});}_0x4dc158=_[_0xc1a5('0x3f')]({},_0x4dc158,_0x56b32a[_0xc1a5('0x41')]);var _0x40fa26={'where':_0x4dc158[_0xc1a5('0x3d')]};return db[_0xc1a5('0x42')][_0xc1a5('0x21')](_0x40fa26)['then'](function(_0x4a1fcb){_0x3ba741[_0xc1a5('0x21')]=_0x4a1fcb;if(_0x56b32a[_0xc1a5('0x34')][_0xc1a5('0x43')]){_0x4dc158[_0xc1a5('0x44')]=[{'all':!![]}];}return db[_0xc1a5('0x42')][_0xc1a5('0x45')](_0x4dc158);})[_0xc1a5('0x29')](function(_0x27e2f4){_0x3ba741['rows']=_0x27e2f4;return _0x3ba741;})['then'](respondWithFilteredResult(_0x207a88,_0x4dc158))['catch'](handleError(_0x207a88,null));};exports['show']=function(_0x2aaf8f,_0x1089d2){var _0x169aa7={'raw':![],'where':{'id':_0x2aaf8f[_0xc1a5('0x46')]['id']}},_0x5f0ea0={};_0x5f0ea0['model']=_['keys'](db['FreshdeskAccount'][_0xc1a5('0x47')]);_0x5f0ea0[_0xc1a5('0x34')]=_[_0xc1a5('0x33')](_0x2aaf8f[_0xc1a5('0x34')]);_0x5f0ea0[_0xc1a5('0x35')]=_[_0xc1a5('0x36')](_0x5f0ea0['model'],_0x5f0ea0[_0xc1a5('0x34')]);_0x169aa7[_0xc1a5('0x37')]=_[_0xc1a5('0x36')](_0x5f0ea0[_0xc1a5('0x32')],qs[_0xc1a5('0x38')](_0x2aaf8f[_0xc1a5('0x34')]['fields']));_0x169aa7[_0xc1a5('0x37')]=_0x169aa7[_0xc1a5('0x37')][_0xc1a5('0x48')]?_0x169aa7[_0xc1a5('0x37')]:_0x5f0ea0['model'];if(_0x2aaf8f['query'][_0xc1a5('0x43')]){_0x169aa7['include']=[{'all':!![]}];}_0x169aa7=_['merge']({},_0x169aa7,_0x2aaf8f[_0xc1a5('0x41')]);return db[_0xc1a5('0x42')]['find'](_0x169aa7)[_0xc1a5('0x29')](handleEntityNotFound(_0x1089d2,null))[_0xc1a5('0x29')](respondWithResult(_0x1089d2,null))['catch'](handleError(_0x1089d2,null));};exports[_0xc1a5('0x49')]=function(_0x509d44,_0x37d2b9){return db[_0xc1a5('0x42')]['create'](_0x509d44[_0xc1a5('0x4a')],{})[_0xc1a5('0x29')](respondWithResult(_0x37d2b9,0xc9))[_0xc1a5('0x4b')](handleError(_0x37d2b9,null));};exports[_0xc1a5('0x28')]=function(_0x336523,_0x309141){if(_0x336523[_0xc1a5('0x4a')]['id']){delete _0x336523['body']['id'];}return db[_0xc1a5('0x42')][_0xc1a5('0x4c')]({'where':{'id':_0x336523[_0xc1a5('0x46')]['id']}})[_0xc1a5('0x29')](handleEntityNotFound(_0x309141,null))[_0xc1a5('0x29')](saveUpdates(_0x336523[_0xc1a5('0x4a')],null))['then'](respondWithResult(_0x309141,null))[_0xc1a5('0x4b')](handleError(_0x309141,null));};exports[_0xc1a5('0x2a')]=function(_0x489d49,_0x359e47){return db[_0xc1a5('0x42')]['find']({'where':{'id':_0x489d49[_0xc1a5('0x46')]['id']}})[_0xc1a5('0x29')](handleEntityNotFound(_0x359e47,null))['then'](removeEntity(_0x359e47,null))[_0xc1a5('0x4b')](handleError(_0x359e47,null));};exports[_0xc1a5('0x4d')]=function(_0x3ac8b6,_0x3b1b9b,_0x46daf2){var _0xa050e4={};var _0x4371e2={};var _0x532e5a;var _0xabe7be;return db[_0xc1a5('0x42')][_0xc1a5('0x4e')]({'where':{'id':_0x3ac8b6['params']['id']}})[_0xc1a5('0x29')](handleEntityNotFound(_0x3b1b9b,null))[_0xc1a5('0x29')](function(_0x5405b3){if(_0x5405b3){_0x532e5a=_0x5405b3;_0x4371e2[_0xc1a5('0x32')]=_[_0xc1a5('0x33')](db['FreshdeskConfiguration'][_0xc1a5('0x47')]);_0x4371e2['query']=_[_0xc1a5('0x33')](_0x3ac8b6[_0xc1a5('0x34')]);_0x4371e2[_0xc1a5('0x35')]=_[_0xc1a5('0x36')](_0x4371e2[_0xc1a5('0x32')],_0x4371e2[_0xc1a5('0x34')]);_0xa050e4[_0xc1a5('0x37')]=_['intersection'](_0x4371e2['model'],qs['fields'](_0x3ac8b6[_0xc1a5('0x34')][_0xc1a5('0x38')]));_0xa050e4[_0xc1a5('0x37')]=_0xa050e4['attributes'][_0xc1a5('0x48')]?_0xa050e4['attributes']:_0x4371e2['model'];_0xa050e4['order']=qs['sort'](_0x3ac8b6[_0xc1a5('0x34')][_0xc1a5('0x3c')]);_0xa050e4[_0xc1a5('0x3d')]=qs[_0xc1a5('0x35')](_[_0xc1a5('0x4f')](_0x3ac8b6[_0xc1a5('0x34')],_0x4371e2[_0xc1a5('0x35')]));if(_0x3ac8b6['query'][_0xc1a5('0x3e')]){_0xa050e4[_0xc1a5('0x3d')]=_[_0xc1a5('0x3f')](_0xa050e4[_0xc1a5('0x3d')],{'$or':_[_0xc1a5('0x2f')](_0xa050e4[_0xc1a5('0x37')],function(_0x15ed13){var _0x2ff221={};_0x2ff221[_0x15ed13]={'$like':'%'+_0x3ac8b6[_0xc1a5('0x34')][_0xc1a5('0x3e')]+'%'};return _0x2ff221;})});}_0xa050e4=_[_0xc1a5('0x3f')]({},_0xa050e4,_0x3ac8b6[_0xc1a5('0x41')]);return _0x532e5a['getConfigurations'](_0xa050e4);}})[_0xc1a5('0x29')](function(_0x47ce46){if(_0x47ce46){_0xabe7be=_0x47ce46[_0xc1a5('0x48')];if(!_0x3ac8b6['query']['hasOwnProperty']('nolimit')){_0xa050e4[_0xc1a5('0x20')]=qs['limit'](_0x3ac8b6[_0xc1a5('0x34')][_0xc1a5('0x20')]);_0xa050e4[_0xc1a5('0x22')]=qs[_0xc1a5('0x22')](_0x3ac8b6['query'][_0xc1a5('0x22')]);}return _0x532e5a[_0xc1a5('0x4d')](_0xa050e4);}})[_0xc1a5('0x29')](function(_0x8742fe){if(_0x8742fe){return _0x8742fe?{'count':_0xabe7be,'rows':_0x8742fe}:null;}})['then'](respondWithResult(_0x3b1b9b,null))[_0xc1a5('0x4b')](handleError(_0x3b1b9b,null));};exports['addConfiguration']=function(_0x5ef23f,_0x2caf9e,_0x147b70){if(_0x5ef23f[_0xc1a5('0x4a')]['id']){delete _0x5ef23f[_0xc1a5('0x4a')]['id'];}return db[_0xc1a5('0x42')][_0xc1a5('0x4e')]({'where':{'id':_0x5ef23f['params']['id']}})[_0xc1a5('0x29')](handleEntityNotFound(_0x2caf9e,null))[_0xc1a5('0x29')](function(_0x116f5d){if(_0x116f5d){_0x5ef23f[_0xc1a5('0x4a')][_0xc1a5('0x50')]=_0x116f5d['id'];_0x5ef23f[_0xc1a5('0x4a')][_0xc1a5('0x51')]=integrations['getSubjects'](_0x5ef23f[_0xc1a5('0x4a')][_0xc1a5('0x52')],_0x5ef23f[_0xc1a5('0x4a')][_0xc1a5('0x30')]);_0x5ef23f[_0xc1a5('0x4a')][_0xc1a5('0x53')]=integrations[_0xc1a5('0x54')](_0x5ef23f[_0xc1a5('0x4a')][_0xc1a5('0x52')],_0x5ef23f[_0xc1a5('0x4a')][_0xc1a5('0x30')]);return db[_0xc1a5('0x55')][_0xc1a5('0x49')](_0x5ef23f[_0xc1a5('0x4a')],{'include':[{'model':db[_0xc1a5('0x56')],'as':_0xc1a5('0x51')},{'model':db[_0xc1a5('0x56')],'as':_0xc1a5('0x53')}]});}return null;})[_0xc1a5('0x29')](respondWithResult(_0x2caf9e,null))[_0xc1a5('0x4b')](handleError(_0x2caf9e,null));};exports[_0xc1a5('0x57')]=function(_0x35f06a,_0x4a1491,_0x11c4a1){var _0x218556='';return db[_0xc1a5('0x42')][_0xc1a5('0x4e')]({'where':{'id':_0x35f06a['params']['id']},'attributes':['id',_0xc1a5('0x58'),_0xc1a5('0x59')]})[_0xc1a5('0x29')](handleEntityNotFound(_0x4a1491,null))[_0xc1a5('0x29')](function(_0x6a7c2){if(_0x6a7c2){_0x218556=_0x6a7c2[_0xc1a5('0x58')];var _0x277fad=_0x218556[_0xc1a5('0x5a')](-0x1);if(_0x277fad==='/'){_0x218556=_0x218556['substring'](0x0,_0x218556[_0xc1a5('0x5b')](_0x277fad));}return rp({'method':'GET','uri':util[_0xc1a5('0x5c')](_0xc1a5('0x5d'),_0x218556,_0xc1a5('0x5e')),'headers':{'Authorization':util[_0xc1a5('0x5c')]('Basic\x20%s',new Buffer(util['format'](_0xc1a5('0x5f'),_0x6a7c2[_0xc1a5('0x59')]))[_0xc1a5('0x60')](_0xc1a5('0x61')))},'json':!![]});}})['then'](function(_0x447e69){if(_0x447e69){var _0x155d1f=['requester','subject',_0xc1a5('0x62'),'description',_0xc1a5('0x1d'),_0xc1a5('0x63'),_0xc1a5('0x64'),_0xc1a5('0x65'),_0xc1a5('0x66'),_0xc1a5('0x64'),_0xc1a5('0x67')];_[_0xc1a5('0x68')](_0x447e69,function(_0x1f99ac){return _0x155d1f['includes'](_0x1f99ac[_0xc1a5('0x2d')])||!_0x1f99ac['default']&&_0x1f99ac[_0xc1a5('0x30')]!==_0xc1a5('0x69')&&_0x1f99ac[_0xc1a5('0x30')]!=='custom_dropdown';});return{'count':_0x447e69[_0xc1a5('0x48')],'rows':_['map'](_0x447e69,function(_0x2b0bdd){return{'id':_0x2b0bdd[_0xc1a5('0x2d')],'name':_0x2b0bdd[_0xc1a5('0x6a')],'custom':!_0x2b0bdd[_0xc1a5('0x6b')],'options':_0x2b0bdd[_0xc1a5('0x6c')]?_['map'](_0x2b0bdd[_0xc1a5('0x6c')],function(_0x33d11a){return{'name':_[_0xc1a5('0x6d')](_0x33d11a),'value':_0x33d11a};}):[]};})};}})[_0xc1a5('0x29')](respondWithResult(_0x4a1491,null))[_0xc1a5('0x4b')](function(_0x59d009){var _0x1db213=_0x35f06a['query'][_0xc1a5('0x6e')]?0x1f4:_0x59d009[_0xc1a5('0x6f')]||0x1f4;logger['error'](_0xc1a5('0x70'),'getFields',_0x1db213,JSON['stringify'](_0x59d009));delete _0x59d009[_0xc1a5('0x2d')];if(_0x1db213===0x191){_0x1db213=0x190;}_0x4a1491['status'](_0x1db213)[_0xc1a5('0x71')](_0x35f06a[_0xc1a5('0x34')][_0xc1a5('0x6e')]?{'message':'Wrong\x20credentials','statusCode':_0x59d009[_0xc1a5('0x6f')]}:_0x59d009);});}; \ No newline at end of file +var _0x39c4=['destroy','findOne','FreshdeskConfiguration','Subjects','getDescriptions','channel','FreshdeskField','Descriptions','getFields','remoteUri','apiKey','slice','substring','GET','%s/%s','format','toString','base64','requester','subject','agent','priority','group','source','ticket_type','remove','includes','default','custom_text','custom_dropdown','label','choices','test','getFields,\x20%s,\x20%s,\x20%s','stringify','statusCode','rimraf','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','apply','reject','save','update','error','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','then','rows','catch','show','params','keys','includeAll','find','create','body'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x39c4,0x174));var _0x439c=function(_0x320373,_0x24e7c4){_0x320373=_0x320373-0x0;var _0x4cdffb=_0x39c4[_0x320373];return _0x4cdffb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x439c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x439c('0x1'));var moment=require(_0x439c('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x439c('0x3'));var path=require(_0x439c('0x4'));var sox=require(_0x439c('0x5'));var csv=require(_0x439c('0x6'));var ejs=require(_0x439c('0x7'));var fs=require('fs');var fs_extra=require(_0x439c('0x8'));var _=require(_0x439c('0x9'));var squel=require(_0x439c('0xa'));var crypto=require(_0x439c('0xb'));var jsforce=require(_0x439c('0xc'));var deskjs=require(_0x439c('0xd'));var toCsv=require(_0x439c('0x6'));var querystring=require(_0x439c('0xe'));var Papa=require(_0x439c('0xf'));var Redis=require(_0x439c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x439c('0x11'));var as=require(_0x439c('0x12'));var hardwareService=require(_0x439c('0x13'));var logger=require(_0x439c('0x14'))(_0x439c('0x15'));var utils=require(_0x439c('0x16'));var config=require(_0x439c('0x17'));var licenseUtil=require(_0x439c('0x18'));var db=require(_0x439c('0x19'))['db'];var integrations=require(_0x439c('0x1a'));function respondWithStatusCode(_0x305154,_0x2bd89){_0x2bd89=_0x2bd89||0xcc;return function(_0x518179){if(_0x518179){return _0x305154[_0x439c('0x1b')](_0x2bd89);}return _0x305154['status'](_0x2bd89)['end']();};}function respondWithResult(_0x1e367a,_0x47182e){_0x47182e=_0x47182e||0xc8;return function(_0x486451){if(_0x486451){return _0x1e367a[_0x439c('0x1c')](_0x47182e)[_0x439c('0x1d')](_0x486451);}};}function respondWithFilteredResult(_0x5b8898,_0x4f5b71){return function(_0x38d60d){if(_0x38d60d){var _0x5478b4=typeof _0x4f5b71[_0x439c('0x1e')]===_0x439c('0x1f')&&typeof _0x4f5b71[_0x439c('0x20')]==='undefined';var _0x33aeb1=_0x38d60d[_0x439c('0x21')];var _0x4635e7=_0x5478b4?0x0:_0x4f5b71[_0x439c('0x1e')];var _0x569a31=_0x5478b4?_0x38d60d[_0x439c('0x21')]:_0x4f5b71[_0x439c('0x1e')]+_0x4f5b71[_0x439c('0x20')];var _0x52fe98;if(_0x569a31>=_0x33aeb1){_0x569a31=_0x33aeb1;_0x52fe98=0xc8;}else{_0x52fe98=0xce;}_0x5b8898[_0x439c('0x1c')](_0x52fe98);return _0x5b8898['set']('Content-Range',_0x4635e7+'-'+_0x569a31+'/'+_0x33aeb1)[_0x439c('0x1d')](_0x38d60d);}return null;};}function patchUpdates(_0x5c6214){return function(_0x22d8e0){try{jsonpatch[_0x439c('0x22')](_0x22d8e0,_0x5c6214,!![]);}catch(_0x29958c){return BPromise[_0x439c('0x23')](_0x29958c);}return _0x22d8e0[_0x439c('0x24')]();};}function saveUpdates(_0x7cdb81,_0x193883){return function(_0x373f19){if(_0x373f19){return _0x373f19[_0x439c('0x25')](_0x7cdb81)['then'](function(_0x1b83b2){return _0x1b83b2;});}return null;};}function removeEntity(_0x1f8ef6,_0x49c1e3){return function(_0x222ccd){if(_0x222ccd){return _0x222ccd['destroy']()['then'](function(){_0x1f8ef6[_0x439c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b3109,_0x467338){return function(_0x349d75){if(!_0x349d75){_0x2b3109[_0x439c('0x1b')](0x194);}return _0x349d75;};}function handleError(_0x390e59,_0x48cbf3){_0x48cbf3=_0x48cbf3||0x1f4;return function(_0x557dae){logger[_0x439c('0x26')](_0x557dae['stack']);if(_0x557dae[_0x439c('0x27')]){delete _0x557dae['name'];}_0x390e59[_0x439c('0x1c')](_0x48cbf3)[_0x439c('0x28')](_0x557dae);};}exports[_0x439c('0x29')]=function(_0x2f670b,_0x518b94){var _0x17ecfa={},_0x1fa033={},_0x291ab0={'count':0x0,'rows':[]};var _0x1ae717=_[_0x439c('0x2a')](db[_0x439c('0x2b')][_0x439c('0x2c')],function(_0x387833){return{'name':_0x387833[_0x439c('0x2d')],'type':_0x387833[_0x439c('0x2e')][_0x439c('0x2f')]};});_0x1fa033[_0x439c('0x30')]=_[_0x439c('0x2a')](_0x1ae717,_0x439c('0x27'));_0x1fa033['query']=_['keys'](_0x2f670b[_0x439c('0x31')]);_0x1fa033[_0x439c('0x32')]=_['intersection'](_0x1fa033[_0x439c('0x30')],_0x1fa033[_0x439c('0x31')]);_0x17ecfa[_0x439c('0x33')]=_[_0x439c('0x34')](_0x1fa033[_0x439c('0x30')],qs['fields'](_0x2f670b[_0x439c('0x31')][_0x439c('0x35')]));_0x17ecfa['attributes']=_0x17ecfa[_0x439c('0x33')][_0x439c('0x36')]?_0x17ecfa[_0x439c('0x33')]:_0x1fa033[_0x439c('0x30')];if(!_0x2f670b[_0x439c('0x31')][_0x439c('0x37')](_0x439c('0x38'))){_0x17ecfa[_0x439c('0x20')]=qs[_0x439c('0x20')](_0x2f670b[_0x439c('0x31')][_0x439c('0x20')]);_0x17ecfa['offset']=qs[_0x439c('0x1e')](_0x2f670b['query'][_0x439c('0x1e')]);}_0x17ecfa[_0x439c('0x39')]=qs['sort'](_0x2f670b[_0x439c('0x31')][_0x439c('0x3a')]);_0x17ecfa['where']=qs['filters'](_[_0x439c('0x3b')](_0x2f670b['query'],_0x1fa033[_0x439c('0x32')]),_0x1ae717);if(_0x2f670b['query'][_0x439c('0x3c')]){_0x17ecfa[_0x439c('0x3d')]=_[_0x439c('0x3e')](_0x17ecfa[_0x439c('0x3d')],{'$or':_[_0x439c('0x2a')](_0x1ae717,function(_0x31ef6d){if(_0x31ef6d['type']!==_0x439c('0x3f')){var _0x47ac85={};_0x47ac85[_0x31ef6d[_0x439c('0x27')]]={'$like':'%'+_0x2f670b['query'][_0x439c('0x3c')]+'%'};return _0x47ac85;}})});}_0x17ecfa=_[_0x439c('0x3e')]({},_0x17ecfa,_0x2f670b[_0x439c('0x40')]);var _0x1a8d93={'where':_0x17ecfa[_0x439c('0x3d')]};return db[_0x439c('0x2b')][_0x439c('0x21')](_0x1a8d93)['then'](function(_0x5d3e22){_0x291ab0[_0x439c('0x21')]=_0x5d3e22;if(_0x2f670b[_0x439c('0x31')]['includeAll']){_0x17ecfa[_0x439c('0x41')]=[{'all':!![]}];}return db['FreshdeskAccount']['findAll'](_0x17ecfa);})[_0x439c('0x42')](function(_0xa44162){_0x291ab0[_0x439c('0x43')]=_0xa44162;return _0x291ab0;})[_0x439c('0x42')](respondWithFilteredResult(_0x518b94,_0x17ecfa))[_0x439c('0x44')](handleError(_0x518b94,null));};exports[_0x439c('0x45')]=function(_0x3873bb,_0x5b31d8){var _0x340e07={'raw':![],'where':{'id':_0x3873bb[_0x439c('0x46')]['id']}},_0x45b24f={};_0x45b24f[_0x439c('0x30')]=_[_0x439c('0x47')](db['FreshdeskAccount'][_0x439c('0x2c')]);_0x45b24f[_0x439c('0x31')]=_[_0x439c('0x47')](_0x3873bb[_0x439c('0x31')]);_0x45b24f['filters']=_[_0x439c('0x34')](_0x45b24f[_0x439c('0x30')],_0x45b24f['query']);_0x340e07['attributes']=_['intersection'](_0x45b24f['model'],qs[_0x439c('0x35')](_0x3873bb['query']['fields']));_0x340e07[_0x439c('0x33')]=_0x340e07[_0x439c('0x33')]['length']?_0x340e07[_0x439c('0x33')]:_0x45b24f[_0x439c('0x30')];if(_0x3873bb[_0x439c('0x31')][_0x439c('0x48')]){_0x340e07[_0x439c('0x41')]=[{'all':!![]}];}_0x340e07=_['merge']({},_0x340e07,_0x3873bb[_0x439c('0x40')]);return db[_0x439c('0x2b')][_0x439c('0x49')](_0x340e07)[_0x439c('0x42')](handleEntityNotFound(_0x5b31d8,null))[_0x439c('0x42')](respondWithResult(_0x5b31d8,null))[_0x439c('0x44')](handleError(_0x5b31d8,null));};exports[_0x439c('0x4a')]=function(_0x2a090b,_0x12e102){return db[_0x439c('0x2b')][_0x439c('0x4a')](_0x2a090b[_0x439c('0x4b')],{})['then'](respondWithResult(_0x12e102,0xc9))[_0x439c('0x44')](handleError(_0x12e102,null));};exports[_0x439c('0x25')]=function(_0x180d0c,_0x4a5c56){if(_0x180d0c[_0x439c('0x4b')]['id']){delete _0x180d0c[_0x439c('0x4b')]['id'];}return db[_0x439c('0x2b')][_0x439c('0x49')]({'where':{'id':_0x180d0c[_0x439c('0x46')]['id']}})['then'](handleEntityNotFound(_0x4a5c56,null))[_0x439c('0x42')](saveUpdates(_0x180d0c[_0x439c('0x4b')],null))[_0x439c('0x42')](respondWithResult(_0x4a5c56,null))[_0x439c('0x44')](handleError(_0x4a5c56,null));};exports[_0x439c('0x4c')]=function(_0x198648,_0x5dfebc){return db[_0x439c('0x2b')][_0x439c('0x49')]({'where':{'id':_0x198648[_0x439c('0x46')]['id']}})['then'](handleEntityNotFound(_0x5dfebc,null))[_0x439c('0x42')](removeEntity(_0x5dfebc,null))[_0x439c('0x44')](handleError(_0x5dfebc,null));};exports['getConfigurations']=function(_0x44919e,_0x5f1844,_0x565d5f){var _0x204cbf={};var _0x348847={};var _0x43ebf5;var _0x57e81e;return db[_0x439c('0x2b')][_0x439c('0x4d')]({'where':{'id':_0x44919e[_0x439c('0x46')]['id']}})[_0x439c('0x42')](handleEntityNotFound(_0x5f1844,null))['then'](function(_0x4d3f8c){if(_0x4d3f8c){_0x43ebf5=_0x4d3f8c;_0x348847['model']=_[_0x439c('0x47')](db[_0x439c('0x4e')]['rawAttributes']);_0x348847[_0x439c('0x31')]=_[_0x439c('0x47')](_0x44919e[_0x439c('0x31')]);_0x348847[_0x439c('0x32')]=_['intersection'](_0x348847[_0x439c('0x30')],_0x348847[_0x439c('0x31')]);_0x204cbf[_0x439c('0x33')]=_[_0x439c('0x34')](_0x348847['model'],qs[_0x439c('0x35')](_0x44919e[_0x439c('0x31')][_0x439c('0x35')]));_0x204cbf[_0x439c('0x33')]=_0x204cbf[_0x439c('0x33')][_0x439c('0x36')]?_0x204cbf['attributes']:_0x348847[_0x439c('0x30')];_0x204cbf[_0x439c('0x39')]=qs[_0x439c('0x3a')](_0x44919e[_0x439c('0x31')][_0x439c('0x3a')]);_0x204cbf[_0x439c('0x3d')]=qs[_0x439c('0x32')](_['pick'](_0x44919e[_0x439c('0x31')],_0x348847['filters']));if(_0x44919e[_0x439c('0x31')][_0x439c('0x3c')]){_0x204cbf[_0x439c('0x3d')]=_['merge'](_0x204cbf['where'],{'$or':_[_0x439c('0x2a')](_0x204cbf['attributes'],function(_0x16723e){var _0x37ddd4={};_0x37ddd4[_0x16723e]={'$like':'%'+_0x44919e[_0x439c('0x31')][_0x439c('0x3c')]+'%'};return _0x37ddd4;})});}_0x204cbf=_[_0x439c('0x3e')]({},_0x204cbf,_0x44919e[_0x439c('0x40')]);return _0x43ebf5['getConfigurations'](_0x204cbf);}})['then'](function(_0xbeacc1){if(_0xbeacc1){_0x57e81e=_0xbeacc1[_0x439c('0x36')];if(!_0x44919e[_0x439c('0x31')]['hasOwnProperty'](_0x439c('0x38'))){_0x204cbf[_0x439c('0x20')]=qs[_0x439c('0x20')](_0x44919e['query'][_0x439c('0x20')]);_0x204cbf[_0x439c('0x1e')]=qs[_0x439c('0x1e')](_0x44919e[_0x439c('0x31')][_0x439c('0x1e')]);}return _0x43ebf5['getConfigurations'](_0x204cbf);}})[_0x439c('0x42')](function(_0x481481){if(_0x481481){return _0x481481?{'count':_0x57e81e,'rows':_0x481481}:null;}})[_0x439c('0x42')](respondWithResult(_0x5f1844,null))[_0x439c('0x44')](handleError(_0x5f1844,null));};exports['addConfiguration']=function(_0x2aa589,_0x5bb5c4,_0x950a8e){if(_0x2aa589[_0x439c('0x4b')]['id']){delete _0x2aa589[_0x439c('0x4b')]['id'];}return db[_0x439c('0x2b')][_0x439c('0x4d')]({'where':{'id':_0x2aa589[_0x439c('0x46')]['id']}})[_0x439c('0x42')](handleEntityNotFound(_0x5bb5c4,null))[_0x439c('0x42')](function(_0x59bd8d){if(_0x59bd8d){_0x2aa589['body']['AccountId']=_0x59bd8d['id'];_0x2aa589[_0x439c('0x4b')][_0x439c('0x4f')]=integrations['getSubjects'](_0x2aa589['body']['channel'],_0x2aa589[_0x439c('0x4b')][_0x439c('0x2e')]);_0x2aa589['body']['Descriptions']=integrations[_0x439c('0x50')](_0x2aa589[_0x439c('0x4b')][_0x439c('0x51')],_0x2aa589[_0x439c('0x4b')][_0x439c('0x2e')]);return db[_0x439c('0x4e')]['create'](_0x2aa589[_0x439c('0x4b')],{'include':[{'model':db['FreshdeskField'],'as':_0x439c('0x4f')},{'model':db[_0x439c('0x52')],'as':_0x439c('0x53')}]});}return null;})[_0x439c('0x42')](respondWithResult(_0x5bb5c4,null))[_0x439c('0x44')](handleError(_0x5bb5c4,null));};exports[_0x439c('0x54')]=function(_0x338905,_0x1ddd58,_0x4543f8){var _0x3406ab='';return db[_0x439c('0x2b')][_0x439c('0x4d')]({'where':{'id':_0x338905[_0x439c('0x46')]['id']},'attributes':['id',_0x439c('0x55'),_0x439c('0x56')]})[_0x439c('0x42')](handleEntityNotFound(_0x1ddd58,null))[_0x439c('0x42')](function(_0xd3fdb0){if(_0xd3fdb0){_0x3406ab=_0xd3fdb0['remoteUri'];var _0x2c3a7f=_0x3406ab[_0x439c('0x57')](-0x1);if(_0x2c3a7f==='/'){_0x3406ab=_0x3406ab[_0x439c('0x58')](0x0,_0x3406ab['lastIndexOf'](_0x2c3a7f));}return rp({'method':_0x439c('0x59'),'uri':util['format'](_0x439c('0x5a'),_0x3406ab,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x439c('0x5b')]('Basic\x20%s',new Buffer(util[_0x439c('0x5b')]('%s:X',_0xd3fdb0['apiKey']))[_0x439c('0x5c')](_0x439c('0x5d')))},'json':!![]});}})[_0x439c('0x42')](function(_0x89692a){if(_0x89692a){var _0x357c9a=[_0x439c('0x5e'),_0x439c('0x5f'),_0x439c('0x60'),'description',_0x439c('0x1c'),_0x439c('0x61'),_0x439c('0x62'),_0x439c('0x63'),_0x439c('0x64'),_0x439c('0x62'),'company'];_[_0x439c('0x65')](_0x89692a,function(_0x593615){return _0x357c9a[_0x439c('0x66')](_0x593615['name'])||!_0x593615[_0x439c('0x67')]&&_0x593615[_0x439c('0x2e')]!==_0x439c('0x68')&&_0x593615[_0x439c('0x2e')]!==_0x439c('0x69');});return{'count':_0x89692a[_0x439c('0x36')],'rows':_[_0x439c('0x2a')](_0x89692a,function(_0x34e57f){return{'id':_0x34e57f[_0x439c('0x27')],'name':_0x34e57f[_0x439c('0x6a')],'custom':!_0x34e57f[_0x439c('0x67')],'options':_0x34e57f[_0x439c('0x6b')]?_['map'](_0x34e57f['choices'],function(_0x3fbf0b){return{'name':_['capitalize'](_0x3fbf0b),'value':_0x3fbf0b};}):[]};})};}})['then'](respondWithResult(_0x1ddd58,null))['catch'](function(_0x3c14be){var _0x11fdae=_0x338905[_0x439c('0x31')][_0x439c('0x6c')]?0x1f4:_0x3c14be['statusCode']||0x1f4;logger['error'](_0x439c('0x6d'),_0x439c('0x54'),_0x11fdae,JSON[_0x439c('0x6e')](_0x3c14be));delete _0x3c14be[_0x439c('0x27')];if(_0x11fdae===0x191){_0x11fdae=0x190;}_0x1ddd58[_0x439c('0x1c')](_0x11fdae)[_0x439c('0x28')](_0x338905['query'][_0x439c('0x6c')]?{'message':'Wrong\x20credentials','statusCode':_0x3c14be[_0x439c('0x6f')]}:_0x3c14be);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 2ced790..1e987e7 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 _0x6a5e=['rimraf','define','int_freshdesk_accounts','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x6c4581,_0x23574d){var _0x275922=function(_0x2d4ce7){while(--_0x2d4ce7){_0x6c4581['push'](_0x6c4581['shift']());}};_0x275922(++_0x23574d);}(_0x6a5e,0x11b));var _0xe6a5=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x6a5e[_0x2763f2];return _0x3ef471;};'use strict';var _=require(_0xe6a5('0x0'));var util=require(_0xe6a5('0x1'));var logger=require(_0xe6a5('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe6a5('0x3'));var rp=require(_0xe6a5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe6a5('0x5'));var config=require('../../config/environment');var attributes=require('./intFreshdeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x5439c7,_0x5e03fa){return _0x5439c7[_0xe6a5('0x6')]('FreshdeskAccount',attributes,{'tableName':_0xe6a5('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4a36=['moment','bluebird','request-promise','../../config/environment','./intFreshdeskAccount.attributes','exports','int_freshdesk_accounts','../../config/logger'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x4a36,0xcf));var _0x64a3=function(_0x4a2f5,_0x5f4788){_0x4a2f5=_0x4a2f5-0x0;var _0xb19d3b=_0x4a36[_0x4a2f5];return _0xb19d3b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x64a3('0x0'))('api');var moment=require(_0x64a3('0x1'));var BPromise=require(_0x64a3('0x2'));var rp=require(_0x64a3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x64a3('0x4'));var attributes=require(_0x64a3('0x5'));var integrations=require('../../components/integrations/configuration');module[_0x64a3('0x6')]=function(_0x21c476,_0xe69f7c){return _0x21c476['define']('FreshdeskAccount',attributes,{'tableName':_0x64a3('0x7'),'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 e2668b8..e509d5a 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 _0xa671=['GetFreshdeskAccount','FreshdeskAccount','options','raw','where','attributes','limit','include','model','map','ShowFreshdeskAccount','find','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x2367e1,_0x135d98){var _0x4858ef=function(_0x1fda33){while(--_0x1fda33){_0x2367e1['push'](_0x2367e1['shift']());}};_0x4858ef(++_0x135d98);}(_0xa671,0x1a4));var _0x1a67=function(_0x407041,_0x2571be){_0x407041=_0x407041-0x0;var _0x107d8c=_0xa671[_0x407041];return _0x107d8c;};'use strict';var _=require('lodash');var util=require(_0x1a67('0x0'));var moment=require(_0x1a67('0x1'));var BPromise=require(_0x1a67('0x2'));var rs=require(_0x1a67('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1a67('0x4'));var logger=require('../../config/logger')(_0x1a67('0x5'));var config=require(_0x1a67('0x6'));var jayson=require(_0x1a67('0x7'));var client=jayson[_0x1a67('0x8')][_0x1a67('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a5821,_0x3f6181,_0x87e7b2){return new BPromise(function(_0x13acaa,_0x2c907d){return client[_0x1a67('0xa')](_0x5a5821,_0x87e7b2)[_0x1a67('0xb')](function(_0x3a93a0){logger[_0x1a67('0xc')](_0x1a67('0xd'),_0x3f6181,_0x1a67('0xe'));logger[_0x1a67('0xf')](_0x1a67('0x10'),_0x3f6181,_0x1a67('0xe'),JSON[_0x1a67('0x11')](_0x3a93a0));if(_0x3a93a0['error']){if(_0x3a93a0[_0x1a67('0x12')][_0x1a67('0x13')]===0x1f4){logger[_0x1a67('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x3f6181,_0x3a93a0['error'][_0x1a67('0x14')]);return _0x2c907d(_0x3a93a0['error'][_0x1a67('0x14')]);}logger['error'](_0x1a67('0xd'),_0x3f6181,_0x3a93a0['error'][_0x1a67('0x14')]);return _0x13acaa(_0x3a93a0['error'][_0x1a67('0x14')]);}else{logger[_0x1a67('0xc')]('FreshdeskAccount,\x20%s,\x20%s',_0x3f6181,'request\x20sent');_0x13acaa(_0x3a93a0['result'][_0x1a67('0x14')]);}})[_0x1a67('0x15')](function(_0x10b25f){logger[_0x1a67('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x3f6181,_0x10b25f);_0x2c907d(_0x10b25f);});});}exports[_0x1a67('0x16')]=function(_0x58d74e){var _0x5eaeec=this;return new Promise(function(_0x1f6c56,_0x3f5aa7){return db[_0x1a67('0x17')]['findAll']({'raw':_0x58d74e['options']?_0x58d74e[_0x1a67('0x18')][_0x1a67('0x19')]===undefined?!![]:![]:!![],'where':_0x58d74e[_0x1a67('0x18')]?_0x58d74e[_0x1a67('0x18')][_0x1a67('0x1a')]||null:null,'attributes':_0x58d74e[_0x1a67('0x18')]?_0x58d74e[_0x1a67('0x18')][_0x1a67('0x1b')]||null:null,'limit':_0x58d74e[_0x1a67('0x18')]?_0x58d74e[_0x1a67('0x18')][_0x1a67('0x1c')]||null:null,'include':_0x58d74e['options']?_0x58d74e[_0x1a67('0x18')][_0x1a67('0x1d')]?_['map'](_0x58d74e[_0x1a67('0x18')][_0x1a67('0x1d')],function(_0x4d04dd){return{'model':db[_0x4d04dd[_0x1a67('0x1e')]],'as':_0x4d04dd['as'],'attributes':_0x4d04dd[_0x1a67('0x1b')],'include':_0x4d04dd[_0x1a67('0x1d')]?_[_0x1a67('0x1f')](_0x4d04dd['include'],function(_0x501a28){return{'model':db[_0x501a28[_0x1a67('0x1e')]],'as':_0x501a28['as'],'attributes':_0x501a28[_0x1a67('0x1b')],'include':_0x501a28[_0x1a67('0x1d')]?_[_0x1a67('0x1f')](_0x501a28['include'],function(_0x44b19d){return{'model':db[_0x44b19d[_0x1a67('0x1e')]],'as':_0x44b19d['as'],'attributes':_0x44b19d['attributes']};}):[]};}):[]};}):[]:[]})[_0x1a67('0xb')](function(_0x163b58){logger[_0x1a67('0xc')](_0x1a67('0x16'),_0x58d74e);logger[_0x1a67('0xf')](_0x1a67('0x16'),_0x58d74e,JSON['stringify'](_0x163b58));_0x1f6c56(_0x163b58);})[_0x1a67('0x15')](function(_0x5b613e){logger['error'](_0x1a67('0x16'),_0x5b613e[_0x1a67('0x14')],_0x58d74e);_0x3f5aa7(_0x5eaeec[_0x1a67('0x12')](0x1f4,_0x5b613e[_0x1a67('0x14')]));});});};exports[_0x1a67('0x20')]=function(_0x5d48a8){var _0x5bb462=this;return new Promise(function(_0x18ba79,_0x1c9428){return db['FreshdeskAccount'][_0x1a67('0x21')]({'raw':_0x5d48a8[_0x1a67('0x18')]?_0x5d48a8['options'][_0x1a67('0x19')]===undefined?!![]:![]:!![],'where':_0x5d48a8[_0x1a67('0x18')]?_0x5d48a8[_0x1a67('0x18')][_0x1a67('0x1a')]||null:null,'attributes':_0x5d48a8[_0x1a67('0x18')]?_0x5d48a8['options'][_0x1a67('0x1b')]||null:null,'include':_0x5d48a8['options']?_0x5d48a8[_0x1a67('0x18')][_0x1a67('0x1d')]?_[_0x1a67('0x1f')](_0x5d48a8[_0x1a67('0x18')][_0x1a67('0x1d')],function(_0xd75949){return{'model':db[_0xd75949[_0x1a67('0x1e')]],'as':_0xd75949['as'],'attributes':_0xd75949['attributes'],'include':_0xd75949[_0x1a67('0x1d')]?_[_0x1a67('0x1f')](_0xd75949['include'],function(_0x476f16){return{'model':db[_0x476f16[_0x1a67('0x1e')]],'as':_0x476f16['as'],'attributes':_0x476f16[_0x1a67('0x1b')],'include':_0x476f16['include']?_['map'](_0x476f16[_0x1a67('0x1d')],function(_0x541502){return{'model':db[_0x541502[_0x1a67('0x1e')]],'as':_0x541502['as'],'attributes':_0x541502['attributes']};}):[]};}):[]};}):[]:[]})[_0x1a67('0xb')](function(_0x12c512){logger[_0x1a67('0xc')](_0x1a67('0x20'),_0x5d48a8);logger[_0x1a67('0xf')]('ShowFreshdeskAccount',_0x5d48a8,JSON[_0x1a67('0x11')](_0x12c512));_0x18ba79(_0x12c512);})[_0x1a67('0x15')](function(_0x5f70b){logger['error']('ShowFreshdeskAccount',_0x5f70b[_0x1a67('0x14')],_0x5d48a8);_0x1c9428(_0x5bb462[_0x1a67('0x12')](0x1f4,_0x5f70b['message']));});});}; \ No newline at end of file +var _0x284f=['../../mysqldb','../../config/utils','../../config/environment','http','then','info','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','FreshdeskAccount,\x20%s,\x20%s','message','error','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','limit','map','include','model','attributes','find','ShowFreshdeskAccount','util','bluebird','ioredis'];(function(_0x998126,_0x23b639){var _0x3ee247=function(_0x252597){while(--_0x252597){_0x998126['push'](_0x998126['shift']());}};_0x3ee247(++_0x23b639);}(_0x284f,0x11d));var _0xf284=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x284f[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require('lodash');var util=require(_0xf284('0x0'));var moment=require('moment');var BPromise=require(_0xf284('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf284('0x2'));var db=require(_0xf284('0x3'))['db'];var utils=require(_0xf284('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xf284('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf284('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x15c6ef,_0x292ea3,_0x4c21c6){return new BPromise(function(_0x54127e,_0x4a399e){return client['request'](_0x15c6ef,_0x4c21c6)[_0xf284('0x7')](function(_0x14a6f1){logger[_0xf284('0x8')]('FreshdeskAccount,\x20%s,\x20%s',_0x292ea3,'request\x20sent');logger[_0xf284('0x9')](_0xf284('0xa'),_0x292ea3,_0xf284('0xb'),JSON[_0xf284('0xc')](_0x14a6f1));if(_0x14a6f1['error']){if(_0x14a6f1['error'][_0xf284('0xd')]===0x1f4){logger['error'](_0xf284('0xe'),_0x292ea3,_0x14a6f1['error'][_0xf284('0xf')]);return _0x4a399e(_0x14a6f1[_0xf284('0x10')][_0xf284('0xf')]);}logger['error'](_0xf284('0xe'),_0x292ea3,_0x14a6f1['error'][_0xf284('0xf')]);return _0x54127e(_0x14a6f1[_0xf284('0x10')][_0xf284('0xf')]);}else{logger[_0xf284('0x8')](_0xf284('0xe'),_0x292ea3,'request\x20sent');_0x54127e(_0x14a6f1[_0xf284('0x11')][_0xf284('0xf')]);}})[_0xf284('0x12')](function(_0x49ba9f){logger[_0xf284('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0x292ea3,_0x49ba9f);_0x4a399e(_0x49ba9f);});});}exports[_0xf284('0x13')]=function(_0x36e053){var _0x3c3da1=this;return new Promise(function(_0x5ea1f9,_0x113b44){return db[_0xf284('0x14')][_0xf284('0x15')]({'raw':_0x36e053[_0xf284('0x16')]?_0x36e053[_0xf284('0x16')][_0xf284('0x17')]===undefined?!![]:![]:!![],'where':_0x36e053[_0xf284('0x16')]?_0x36e053[_0xf284('0x16')][_0xf284('0x18')]||null:null,'attributes':_0x36e053[_0xf284('0x16')]?_0x36e053[_0xf284('0x16')]['attributes']||null:null,'limit':_0x36e053[_0xf284('0x16')]?_0x36e053[_0xf284('0x16')][_0xf284('0x19')]||null:null,'include':_0x36e053['options']?_0x36e053[_0xf284('0x16')]['include']?_[_0xf284('0x1a')](_0x36e053[_0xf284('0x16')][_0xf284('0x1b')],function(_0x542749){return{'model':db[_0x542749[_0xf284('0x1c')]],'as':_0x542749['as'],'attributes':_0x542749[_0xf284('0x1d')],'include':_0x542749[_0xf284('0x1b')]?_['map'](_0x542749[_0xf284('0x1b')],function(_0x465f62){return{'model':db[_0x465f62[_0xf284('0x1c')]],'as':_0x465f62['as'],'attributes':_0x465f62[_0xf284('0x1d')],'include':_0x465f62[_0xf284('0x1b')]?_[_0xf284('0x1a')](_0x465f62[_0xf284('0x1b')],function(_0x5a7301){return{'model':db[_0x5a7301[_0xf284('0x1c')]],'as':_0x5a7301['as'],'attributes':_0x5a7301[_0xf284('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf284('0x7')](function(_0x23cc7c){logger['info']('GetFreshdeskAccount',_0x36e053);logger[_0xf284('0x9')]('GetFreshdeskAccount',_0x36e053,JSON[_0xf284('0xc')](_0x23cc7c));_0x5ea1f9(_0x23cc7c);})['catch'](function(_0xe79ef3){logger['error'](_0xf284('0x13'),_0xe79ef3[_0xf284('0xf')],_0x36e053);_0x113b44(_0x3c3da1[_0xf284('0x10')](0x1f4,_0xe79ef3[_0xf284('0xf')]));});});};exports['ShowFreshdeskAccount']=function(_0x4bc79){var _0xbefdb8=this;return new Promise(function(_0x5865cf,_0x2a291c){return db[_0xf284('0x14')][_0xf284('0x1e')]({'raw':_0x4bc79[_0xf284('0x16')]?_0x4bc79[_0xf284('0x16')][_0xf284('0x17')]===undefined?!![]:![]:!![],'where':_0x4bc79[_0xf284('0x16')]?_0x4bc79[_0xf284('0x16')][_0xf284('0x18')]||null:null,'attributes':_0x4bc79['options']?_0x4bc79[_0xf284('0x16')][_0xf284('0x1d')]||null:null,'include':_0x4bc79['options']?_0x4bc79[_0xf284('0x16')]['include']?_[_0xf284('0x1a')](_0x4bc79[_0xf284('0x16')][_0xf284('0x1b')],function(_0x42f944){return{'model':db[_0x42f944[_0xf284('0x1c')]],'as':_0x42f944['as'],'attributes':_0x42f944['attributes'],'include':_0x42f944[_0xf284('0x1b')]?_[_0xf284('0x1a')](_0x42f944[_0xf284('0x1b')],function(_0x3ac230){return{'model':db[_0x3ac230[_0xf284('0x1c')]],'as':_0x3ac230['as'],'attributes':_0x3ac230[_0xf284('0x1d')],'include':_0x3ac230[_0xf284('0x1b')]?_[_0xf284('0x1a')](_0x3ac230[_0xf284('0x1b')],function(_0x9f6a94){return{'model':db[_0x9f6a94[_0xf284('0x1c')]],'as':_0x9f6a94['as'],'attributes':_0x9f6a94[_0xf284('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4a9098){logger['info']('ShowFreshdeskAccount',_0x4bc79);logger['debug'](_0xf284('0x1f'),_0x4bc79,JSON[_0xf284('0xc')](_0x4a9098));_0x5865cf(_0x4a9098);})['catch'](function(_0x12bcc0){logger[_0xf284('0x10')](_0xf284('0x1f'),_0x12bcc0[_0xf284('0xf')],_0x4bc79);_0x2a291c(_0xbefdb8[_0xf284('0x10')](0x1f4,_0x12bcc0[_0xf284('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 85821ef..c68d859 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 _0xedaf=['post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0xedaf,0x133));var _0xfeda=function(_0x11f279,_0xa4224e){_0x11f279=_0x11f279-0x0;var _0x882845=_0xedaf[_0x11f279];return _0x882845;};'use strict';var multer=require('multer');var util=require(_0xfeda('0x0'));var path=require(_0xfeda('0x1'));var timeout=require(_0xfeda('0x2'));var express=require(_0xfeda('0x3'));var router=express['Router']();var fs_extra=require(_0xfeda('0x4'));var auth=require(_0xfeda('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xfeda('0x6'));router[_0xfeda('0x7')]('/',auth[_0xfeda('0x8')](),controller[_0xfeda('0x9')]);router[_0xfeda('0x7')](_0xfeda('0xa'),auth[_0xfeda('0x8')](),controller[_0xfeda('0xb')]);router[_0xfeda('0x7')]('/:id/fields',auth[_0xfeda('0x8')](),controller[_0xfeda('0xc')]);router[_0xfeda('0x7')](_0xfeda('0xd'),auth[_0xfeda('0x8')](),controller[_0xfeda('0xe')]);router[_0xfeda('0x7')]('/:id/descriptions',auth[_0xfeda('0x8')](),controller[_0xfeda('0xf')]);router['get'](_0xfeda('0x10'),auth[_0xfeda('0x8')](),controller[_0xfeda('0x11')]);router[_0xfeda('0x12')]('/',auth[_0xfeda('0x8')](),controller[_0xfeda('0x13')]);router[_0xfeda('0x12')](_0xfeda('0x10'),auth[_0xfeda('0x8')](),controller['setTags']);router[_0xfeda('0x14')](_0xfeda('0xa'),auth[_0xfeda('0x8')](),controller[_0xfeda('0x15')]);router[_0xfeda('0x16')](_0xfeda('0xa'),auth['isAuthenticated'](),controller[_0xfeda('0x17')]);module[_0xfeda('0x18')]=router; \ No newline at end of file +var _0x0479=['index','/:id','show','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated'];(function(_0x493997,_0x2f4e5e){var _0x442af5=function(_0x10f324){while(--_0x10f324){_0x493997['push'](_0x493997['shift']());}};_0x442af5(++_0x2f4e5e);}(_0x0479,0x7a));var _0x9047=function(_0x2bfacd,_0x2b835f){_0x2bfacd=_0x2bfacd-0x0;var _0x19aede=_0x0479[_0x2bfacd];return _0x19aede;};'use strict';var multer=require(_0x9047('0x0'));var util=require(_0x9047('0x1'));var path=require(_0x9047('0x2'));var timeout=require(_0x9047('0x3'));var express=require(_0x9047('0x4'));var router=express[_0x9047('0x5')]();var fs_extra=require(_0x9047('0x6'));var auth=require(_0x9047('0x7'));var interaction=require(_0x9047('0x8'));var config=require(_0x9047('0x9'));var controller=require(_0x9047('0xa'));router[_0x9047('0xb')]('/',auth[_0x9047('0xc')](),controller[_0x9047('0xd')]);router[_0x9047('0xb')](_0x9047('0xe'),auth[_0x9047('0xc')](),controller[_0x9047('0xf')]);router[_0x9047('0xb')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x9047('0xb')]('/:id/subjects',auth[_0x9047('0xc')](),controller[_0x9047('0x10')]);router[_0x9047('0xb')](_0x9047('0x11'),auth['isAuthenticated'](),controller[_0x9047('0x12')]);router[_0x9047('0xb')](_0x9047('0x13'),auth[_0x9047('0xc')](),controller[_0x9047('0x14')]);router[_0x9047('0x15')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9047('0x15')](_0x9047('0x13'),auth['isAuthenticated'](),controller['setTags']);router[_0x9047('0x16')](_0x9047('0xe'),auth[_0x9047('0xc')](),controller[_0x9047('0x17')]);router[_0x9047('0x18')](_0x9047('0xe'),auth[_0x9047('0xc')](),controller[_0x9047('0x19')]);module[_0x9047('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 87ea418..97b17ef 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 _0x42e9=['exports','STRING','sequelize'];(function(_0x32f193,_0x612afc){var _0x5bb92e=function(_0x555645){while(--_0x555645){_0x32f193['push'](_0x32f193['shift']());}};_0x5bb92e(++_0x612afc);}(_0x42e9,0x101));var _0x942e=function(_0x355c57,_0x1ea71d){_0x355c57=_0x355c57-0x0;var _0x356b7b=_0x42e9[_0x355c57];return _0x356b7b;};'use strict';var Sequelize=require(_0x942e('0x0'));module[_0x942e('0x1')]={'name':{'type':Sequelize[_0x942e('0x2')]},'description':{'type':Sequelize[_0x942e('0x2')]}}; \ No newline at end of file +var _0x2141=['exports','STRING'];(function(_0x79702,_0x34931c){var _0x417e6b=function(_0x55294a){while(--_0x55294a){_0x79702['push'](_0x79702['shift']());}};_0x417e6b(++_0x34931c);}(_0x2141,0x64));var _0x1214=function(_0x2f060e,_0x257e6f){_0x2f060e=_0x2f060e-0x0;var _0x44f85a=_0x2141[_0x2f060e];return _0x44f85a;};'use strict';var Sequelize=require('sequelize');module[_0x1214('0x0')]={'name':{'type':Sequelize[_0x1214('0x1')]},'description':{'type':Sequelize[_0x1214('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index a5911d9..9dcebf9 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 _0x1973=['Content-Range','json','reject','update','then','destroy','error','name','send','index','map','FreshdeskConfiguration','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','show','includeAll','catch','create','body','params','find','getFields','FreshdeskField','pick','getSubjects','findOne','getDescriptions','Tag','getTags','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','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','end','status','offset','undefined','limit','count','set'];(function(_0x296cb9,_0x21b0e9){var _0x231321=function(_0x679ad8){while(--_0x679ad8){_0x296cb9['push'](_0x296cb9['shift']());}};_0x231321(++_0x21b0e9);}(_0x1973,0x87));var _0x3197=function(_0x176592,_0x139a07){_0x176592=_0x176592-0x0;var _0x450fcf=_0x1973[_0x176592];return _0x450fcf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3197('0x0'));var zipdir=require(_0x3197('0x1'));var jsonpatch=require(_0x3197('0x2'));var rp=require(_0x3197('0x3'));var moment=require(_0x3197('0x4'));var BPromise=require(_0x3197('0x5'));var Mustache=require(_0x3197('0x6'));var util=require(_0x3197('0x7'));var path=require('path');var sox=require(_0x3197('0x8'));var csv=require(_0x3197('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3197('0xa'));var _=require(_0x3197('0xb'));var squel=require(_0x3197('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3197('0x9'));var querystring=require(_0x3197('0xd'));var Papa=require(_0x3197('0xe'));var Redis=require(_0x3197('0xf'));var authService=require(_0x3197('0x10'));var qs=require(_0x3197('0x11'));var as=require(_0x3197('0x12'));var hardwareService=require(_0x3197('0x13'));var logger=require(_0x3197('0x14'))(_0x3197('0x15'));var utils=require(_0x3197('0x16'));var config=require(_0x3197('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x3197('0x18'))['db'];function respondWithStatusCode(_0x29541b,_0x316358){_0x316358=_0x316358||0xcc;return function(_0x4e4e5f){if(_0x4e4e5f){return _0x29541b[_0x3197('0x19')](_0x316358);}return _0x29541b['status'](_0x316358)[_0x3197('0x1a')]();};}function respondWithResult(_0x47d168,_0x16a187){_0x16a187=_0x16a187||0xc8;return function(_0x333baf){if(_0x333baf){return _0x47d168[_0x3197('0x1b')](_0x16a187)['json'](_0x333baf);}};}function respondWithFilteredResult(_0x76550e,_0x4b87b1){return function(_0xa4845e){if(_0xa4845e){var _0xacf364=typeof _0x4b87b1[_0x3197('0x1c')]===_0x3197('0x1d')&&typeof _0x4b87b1[_0x3197('0x1e')]==='undefined';var _0xa77851=_0xa4845e[_0x3197('0x1f')];var _0x4151a2=_0xacf364?0x0:_0x4b87b1[_0x3197('0x1c')];var _0x305705=_0xacf364?_0xa4845e['count']:_0x4b87b1['offset']+_0x4b87b1[_0x3197('0x1e')];var _0x48b08b;if(_0x305705>=_0xa77851){_0x305705=_0xa77851;_0x48b08b=0xc8;}else{_0x48b08b=0xce;}_0x76550e['status'](_0x48b08b);return _0x76550e[_0x3197('0x20')](_0x3197('0x21'),_0x4151a2+'-'+_0x305705+'/'+_0xa77851)[_0x3197('0x22')](_0xa4845e);}return null;};}function patchUpdates(_0x352fed){return function(_0x271690){try{jsonpatch['apply'](_0x271690,_0x352fed,!![]);}catch(_0x4ed03c){return BPromise[_0x3197('0x23')](_0x4ed03c);}return _0x271690['save']();};}function saveUpdates(_0x4eb263,_0x432739){return function(_0x328647){if(_0x328647){return _0x328647[_0x3197('0x24')](_0x4eb263)[_0x3197('0x25')](function(_0xa11899){return _0xa11899;});}return null;};}function removeEntity(_0x1c2a92,_0x143601){return function(_0x390f93){if(_0x390f93){return _0x390f93[_0x3197('0x26')]()[_0x3197('0x25')](function(){_0x1c2a92[_0x3197('0x1b')](0xcc)[_0x3197('0x1a')]();});}};}function handleEntityNotFound(_0x1300b4,_0xddae7e){return function(_0x435587){if(!_0x435587){_0x1300b4['sendStatus'](0x194);}return _0x435587;};}function handleError(_0x41d9a5,_0x16e6e5){_0x16e6e5=_0x16e6e5||0x1f4;return function(_0x3edd9e){logger[_0x3197('0x27')](_0x3edd9e['stack']);if(_0x3edd9e[_0x3197('0x28')]){delete _0x3edd9e[_0x3197('0x28')];}_0x41d9a5['status'](_0x16e6e5)[_0x3197('0x29')](_0x3edd9e);};}exports[_0x3197('0x2a')]=function(_0x4d5454,_0x73553){var _0x3d322a={},_0x1d3ff7={},_0x142bfd={'count':0x0,'rows':[]};var _0x49ff5d=_[_0x3197('0x2b')](db[_0x3197('0x2c')][_0x3197('0x2d')],function(_0x3e9cbe){return{'name':_0x3e9cbe['fieldName'],'type':_0x3e9cbe[_0x3197('0x2e')][_0x3197('0x2f')]};});_0x1d3ff7['model']=_[_0x3197('0x2b')](_0x49ff5d,_0x3197('0x28'));_0x1d3ff7[_0x3197('0x30')]=_[_0x3197('0x31')](_0x4d5454[_0x3197('0x30')]);_0x1d3ff7[_0x3197('0x32')]=_[_0x3197('0x33')](_0x1d3ff7[_0x3197('0x34')],_0x1d3ff7[_0x3197('0x30')]);_0x3d322a['attributes']=_[_0x3197('0x33')](_0x1d3ff7[_0x3197('0x34')],qs['fields'](_0x4d5454[_0x3197('0x30')][_0x3197('0x35')]));_0x3d322a['attributes']=_0x3d322a[_0x3197('0x36')][_0x3197('0x37')]?_0x3d322a[_0x3197('0x36')]:_0x1d3ff7['model'];if(!_0x4d5454[_0x3197('0x30')][_0x3197('0x38')](_0x3197('0x39'))){_0x3d322a[_0x3197('0x1e')]=qs[_0x3197('0x1e')](_0x4d5454[_0x3197('0x30')][_0x3197('0x1e')]);_0x3d322a[_0x3197('0x1c')]=qs[_0x3197('0x1c')](_0x4d5454[_0x3197('0x30')]['offset']);}_0x3d322a[_0x3197('0x3a')]=qs[_0x3197('0x3b')](_0x4d5454[_0x3197('0x30')][_0x3197('0x3b')]);_0x3d322a[_0x3197('0x3c')]=qs[_0x3197('0x32')](_['pick'](_0x4d5454[_0x3197('0x30')],_0x1d3ff7[_0x3197('0x32')]),_0x49ff5d);if(_0x4d5454[_0x3197('0x30')][_0x3197('0x3d')]){_0x3d322a[_0x3197('0x3c')]=_[_0x3197('0x3e')](_0x3d322a[_0x3197('0x3c')],{'$or':_[_0x3197('0x2b')](_0x49ff5d,function(_0xc40231){if(_0xc40231['type']!==_0x3197('0x3f')){var _0x133e29={};_0x133e29[_0xc40231[_0x3197('0x28')]]={'$like':'%'+_0x4d5454[_0x3197('0x30')]['filter']+'%'};return _0x133e29;}})});}_0x3d322a=_['merge']({},_0x3d322a,_0x4d5454[_0x3197('0x40')]);var _0x3f0fdb={'where':_0x3d322a[_0x3197('0x3c')]};return db[_0x3197('0x2c')]['count'](_0x3f0fdb)[_0x3197('0x25')](function(_0x307478){_0x142bfd['count']=_0x307478;if(_0x4d5454[_0x3197('0x30')]['includeAll']){_0x3d322a[_0x3197('0x41')]=[{'all':!![]}];}return db[_0x3197('0x2c')][_0x3197('0x42')](_0x3d322a);})[_0x3197('0x25')](function(_0x2b3b4b){_0x142bfd['rows']=_0x2b3b4b;return _0x142bfd;})[_0x3197('0x25')](respondWithFilteredResult(_0x73553,_0x3d322a))['catch'](handleError(_0x73553,null));};exports[_0x3197('0x43')]=function(_0x365746,_0x47790a){var _0x3ebc04={'raw':![],'where':{'id':_0x365746['params']['id']}},_0x3fdf1d={};_0x3fdf1d[_0x3197('0x34')]=_[_0x3197('0x31')](db[_0x3197('0x2c')][_0x3197('0x2d')]);_0x3fdf1d['query']=_[_0x3197('0x31')](_0x365746[_0x3197('0x30')]);_0x3fdf1d[_0x3197('0x32')]=_['intersection'](_0x3fdf1d['model'],_0x3fdf1d[_0x3197('0x30')]);_0x3ebc04[_0x3197('0x36')]=_['intersection'](_0x3fdf1d['model'],qs['fields'](_0x365746[_0x3197('0x30')][_0x3197('0x35')]));_0x3ebc04['attributes']=_0x3ebc04[_0x3197('0x36')][_0x3197('0x37')]?_0x3ebc04[_0x3197('0x36')]:_0x3fdf1d[_0x3197('0x34')];if(_0x365746[_0x3197('0x30')][_0x3197('0x44')]){_0x3ebc04['include']=[{'all':!![]}];}_0x3ebc04=_[_0x3197('0x3e')]({},_0x3ebc04,_0x365746[_0x3197('0x40')]);return db[_0x3197('0x2c')]['find'](_0x3ebc04)[_0x3197('0x25')](handleEntityNotFound(_0x47790a,null))[_0x3197('0x25')](respondWithResult(_0x47790a,null))[_0x3197('0x45')](handleError(_0x47790a,null));};exports['create']=function(_0x583284,_0x584d05){return db[_0x3197('0x2c')][_0x3197('0x46')](_0x583284[_0x3197('0x47')],{})[_0x3197('0x25')](respondWithResult(_0x584d05,0xc9))[_0x3197('0x45')](handleError(_0x584d05,null));};exports['update']=function(_0x12205c,_0x83ecb7){if(_0x12205c[_0x3197('0x47')]['id']){delete _0x12205c['body']['id'];}return db['FreshdeskConfiguration']['find']({'where':{'id':_0x12205c[_0x3197('0x48')]['id']}})[_0x3197('0x25')](handleEntityNotFound(_0x83ecb7,null))['then'](saveUpdates(_0x12205c[_0x3197('0x47')],null))[_0x3197('0x25')](respondWithResult(_0x83ecb7,null))[_0x3197('0x45')](handleError(_0x83ecb7,null));};exports[_0x3197('0x26')]=function(_0x11ea68,_0x492d68){return db[_0x3197('0x2c')][_0x3197('0x49')]({'where':{'id':_0x11ea68[_0x3197('0x48')]['id']}})[_0x3197('0x25')](handleEntityNotFound(_0x492d68,null))[_0x3197('0x25')](removeEntity(_0x492d68,null))[_0x3197('0x45')](handleError(_0x492d68,null));};exports[_0x3197('0x4a')]=function(_0x2e6319,_0x116a67,_0x13f7b9){var _0x5859f0={};var _0x41326a={};var _0x34a031;var _0x3d7649;return db[_0x3197('0x2c')]['findOne']({'where':{'id':_0x2e6319[_0x3197('0x48')]['id']}})[_0x3197('0x25')](handleEntityNotFound(_0x116a67,null))['then'](function(_0x2cb155){if(_0x2cb155){_0x34a031=_0x2cb155;_0x41326a[_0x3197('0x34')]=_['keys'](db[_0x3197('0x4b')][_0x3197('0x2d')]);_0x41326a[_0x3197('0x30')]=_[_0x3197('0x31')](_0x2e6319[_0x3197('0x30')]);_0x41326a['filters']=_[_0x3197('0x33')](_0x41326a[_0x3197('0x34')],_0x41326a[_0x3197('0x30')]);_0x5859f0['attributes']=_['intersection'](_0x41326a[_0x3197('0x34')],qs[_0x3197('0x35')](_0x2e6319[_0x3197('0x30')]['fields']));_0x5859f0['attributes']=_0x5859f0[_0x3197('0x36')][_0x3197('0x37')]?_0x5859f0[_0x3197('0x36')]:_0x41326a['model'];_0x5859f0[_0x3197('0x3a')]=qs[_0x3197('0x3b')](_0x2e6319[_0x3197('0x30')][_0x3197('0x3b')]);_0x5859f0[_0x3197('0x3c')]=qs[_0x3197('0x32')](_[_0x3197('0x4c')](_0x2e6319[_0x3197('0x30')],_0x41326a[_0x3197('0x32')]));if(_0x2e6319['query'][_0x3197('0x3d')]){_0x5859f0['where']=_[_0x3197('0x3e')](_0x5859f0[_0x3197('0x3c')],{'$or':_[_0x3197('0x2b')](_0x5859f0['attributes'],function(_0x49d259){var _0x85e56e={};_0x85e56e[_0x49d259]={'$like':'%'+_0x2e6319[_0x3197('0x30')][_0x3197('0x3d')]+'%'};return _0x85e56e;})});}_0x5859f0=_['merge']({},_0x5859f0,_0x2e6319['options']);return _0x34a031['getFields'](_0x5859f0);}})[_0x3197('0x25')](function(_0x5a36c5){if(_0x5a36c5){_0x3d7649=_0x5a36c5[_0x3197('0x37')];if(!_0x2e6319['query'][_0x3197('0x38')](_0x3197('0x39'))){_0x5859f0[_0x3197('0x1e')]=qs[_0x3197('0x1e')](_0x2e6319[_0x3197('0x30')][_0x3197('0x1e')]);_0x5859f0[_0x3197('0x1c')]=qs['offset'](_0x2e6319[_0x3197('0x30')][_0x3197('0x1c')]);}return _0x34a031[_0x3197('0x4a')](_0x5859f0);}})[_0x3197('0x25')](function(_0x92a533){if(_0x92a533){return _0x92a533?{'count':_0x3d7649,'rows':_0x92a533}:null;}})[_0x3197('0x25')](respondWithResult(_0x116a67,null))[_0x3197('0x45')](handleError(_0x116a67,null));};exports[_0x3197('0x4d')]=function(_0x1ebd19,_0x5e19e7,_0xc1011a){var _0x30da0c={};var _0x48d2fc={};var _0x43b194;var _0x1f8f98;return db[_0x3197('0x2c')][_0x3197('0x4e')]({'where':{'id':_0x1ebd19[_0x3197('0x48')]['id']}})[_0x3197('0x25')](handleEntityNotFound(_0x5e19e7,null))[_0x3197('0x25')](function(_0x2bcb19){if(_0x2bcb19){_0x43b194=_0x2bcb19;_0x48d2fc['model']=_[_0x3197('0x31')](db[_0x3197('0x4b')][_0x3197('0x2d')]);_0x48d2fc[_0x3197('0x30')]=_[_0x3197('0x31')](_0x1ebd19[_0x3197('0x30')]);_0x48d2fc[_0x3197('0x32')]=_[_0x3197('0x33')](_0x48d2fc[_0x3197('0x34')],_0x48d2fc[_0x3197('0x30')]);_0x30da0c[_0x3197('0x36')]=_['intersection'](_0x48d2fc[_0x3197('0x34')],qs[_0x3197('0x35')](_0x1ebd19['query'][_0x3197('0x35')]));_0x30da0c[_0x3197('0x36')]=_0x30da0c['attributes'][_0x3197('0x37')]?_0x30da0c[_0x3197('0x36')]:_0x48d2fc['model'];_0x30da0c[_0x3197('0x3a')]=qs[_0x3197('0x3b')](_0x1ebd19[_0x3197('0x30')][_0x3197('0x3b')]);_0x30da0c[_0x3197('0x3c')]=qs[_0x3197('0x32')](_[_0x3197('0x4c')](_0x1ebd19[_0x3197('0x30')],_0x48d2fc[_0x3197('0x32')]));if(_0x1ebd19[_0x3197('0x30')][_0x3197('0x3d')]){_0x30da0c[_0x3197('0x3c')]=_[_0x3197('0x3e')](_0x30da0c[_0x3197('0x3c')],{'$or':_[_0x3197('0x2b')](_0x30da0c[_0x3197('0x36')],function(_0x5e625c){var _0x5ba15f={};_0x5ba15f[_0x5e625c]={'$like':'%'+_0x1ebd19[_0x3197('0x30')][_0x3197('0x3d')]+'%'};return _0x5ba15f;})});}_0x30da0c=_[_0x3197('0x3e')]({},_0x30da0c,_0x1ebd19[_0x3197('0x40')]);return _0x43b194['getSubjects'](_0x30da0c);}})[_0x3197('0x25')](function(_0x34c46f){if(_0x34c46f){_0x1f8f98=_0x34c46f['length'];if(!_0x1ebd19['query'][_0x3197('0x38')](_0x3197('0x39'))){_0x30da0c[_0x3197('0x1e')]=qs[_0x3197('0x1e')](_0x1ebd19[_0x3197('0x30')][_0x3197('0x1e')]);_0x30da0c['offset']=qs[_0x3197('0x1c')](_0x1ebd19[_0x3197('0x30')]['offset']);}return _0x43b194[_0x3197('0x4d')](_0x30da0c);}})['then'](function(_0x3018c3){if(_0x3018c3){return _0x3018c3?{'count':_0x1f8f98,'rows':_0x3018c3}:null;}})['then'](respondWithResult(_0x5e19e7,null))[_0x3197('0x45')](handleError(_0x5e19e7,null));};exports['getDescriptions']=function(_0x3e6f4b,_0x17b689,_0x5c6060){var _0x294f73={};var _0x5bcd06={};var _0x1a3161;var _0x1511bf;return db[_0x3197('0x2c')][_0x3197('0x4e')]({'where':{'id':_0x3e6f4b[_0x3197('0x48')]['id']}})[_0x3197('0x25')](handleEntityNotFound(_0x17b689,null))[_0x3197('0x25')](function(_0x1ad74e){if(_0x1ad74e){_0x1a3161=_0x1ad74e;_0x5bcd06[_0x3197('0x34')]=_[_0x3197('0x31')](db[_0x3197('0x4b')]['rawAttributes']);_0x5bcd06['query']=_[_0x3197('0x31')](_0x3e6f4b[_0x3197('0x30')]);_0x5bcd06['filters']=_[_0x3197('0x33')](_0x5bcd06[_0x3197('0x34')],_0x5bcd06[_0x3197('0x30')]);_0x294f73[_0x3197('0x36')]=_[_0x3197('0x33')](_0x5bcd06['model'],qs[_0x3197('0x35')](_0x3e6f4b['query'][_0x3197('0x35')]));_0x294f73['attributes']=_0x294f73[_0x3197('0x36')]['length']?_0x294f73[_0x3197('0x36')]:_0x5bcd06[_0x3197('0x34')];_0x294f73['order']=qs[_0x3197('0x3b')](_0x3e6f4b[_0x3197('0x30')][_0x3197('0x3b')]);_0x294f73[_0x3197('0x3c')]=qs['filters'](_['pick'](_0x3e6f4b[_0x3197('0x30')],_0x5bcd06[_0x3197('0x32')]));if(_0x3e6f4b[_0x3197('0x30')][_0x3197('0x3d')]){_0x294f73[_0x3197('0x3c')]=_[_0x3197('0x3e')](_0x294f73[_0x3197('0x3c')],{'$or':_['map'](_0x294f73[_0x3197('0x36')],function(_0x59c0ed){var _0x2cfb4c={};_0x2cfb4c[_0x59c0ed]={'$like':'%'+_0x3e6f4b['query'][_0x3197('0x3d')]+'%'};return _0x2cfb4c;})});}_0x294f73=_[_0x3197('0x3e')]({},_0x294f73,_0x3e6f4b[_0x3197('0x40')]);return _0x1a3161['getDescriptions'](_0x294f73);}})['then'](function(_0x537798){if(_0x537798){_0x1511bf=_0x537798[_0x3197('0x37')];if(!_0x3e6f4b[_0x3197('0x30')][_0x3197('0x38')](_0x3197('0x39'))){_0x294f73[_0x3197('0x1e')]=qs[_0x3197('0x1e')](_0x3e6f4b[_0x3197('0x30')][_0x3197('0x1e')]);_0x294f73['offset']=qs[_0x3197('0x1c')](_0x3e6f4b[_0x3197('0x30')][_0x3197('0x1c')]);}return _0x1a3161[_0x3197('0x4f')](_0x294f73);}})[_0x3197('0x25')](function(_0x46b0fe){if(_0x46b0fe){return _0x46b0fe?{'count':_0x1511bf,'rows':_0x46b0fe}:null;}})[_0x3197('0x25')](respondWithResult(_0x17b689,null))[_0x3197('0x45')](handleError(_0x17b689,null));};exports['getTags']=function(_0x59ae8b,_0x10cdbb,_0x5026e8){var _0x44a6d5={};var _0x3c6ac1={};var _0x5d5cf8;var _0x58dba9;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x59ae8b['params']['id']}})[_0x3197('0x25')](handleEntityNotFound(_0x10cdbb,null))[_0x3197('0x25')](function(_0x55daa0){if(_0x55daa0){_0x5d5cf8=_0x55daa0;_0x3c6ac1[_0x3197('0x34')]=_[_0x3197('0x31')](db[_0x3197('0x50')][_0x3197('0x2d')]);_0x3c6ac1[_0x3197('0x30')]=_[_0x3197('0x31')](_0x59ae8b['query']);_0x3c6ac1[_0x3197('0x32')]=_['intersection'](_0x3c6ac1[_0x3197('0x34')],_0x3c6ac1['query']);_0x44a6d5[_0x3197('0x36')]=_[_0x3197('0x33')](_0x3c6ac1['model'],qs[_0x3197('0x35')](_0x59ae8b[_0x3197('0x30')][_0x3197('0x35')]));_0x44a6d5[_0x3197('0x36')]=_0x44a6d5[_0x3197('0x36')][_0x3197('0x37')]?_0x44a6d5[_0x3197('0x36')]:_0x3c6ac1['model'];_0x44a6d5[_0x3197('0x3a')]=qs['sort'](_0x59ae8b['query']['sort']);_0x44a6d5['where']=qs[_0x3197('0x32')](_['pick'](_0x59ae8b[_0x3197('0x30')],_0x3c6ac1[_0x3197('0x32')]));if(_0x59ae8b[_0x3197('0x30')]['filter']){_0x44a6d5[_0x3197('0x3c')]=_['merge'](_0x44a6d5[_0x3197('0x3c')],{'$or':_[_0x3197('0x2b')](_0x44a6d5[_0x3197('0x36')],function(_0x144d65){var _0x1868bc={};_0x1868bc[_0x144d65]={'$like':'%'+_0x59ae8b[_0x3197('0x30')][_0x3197('0x3d')]+'%'};return _0x1868bc;})});}_0x44a6d5=_[_0x3197('0x3e')]({},_0x44a6d5,_0x59ae8b[_0x3197('0x40')]);return _0x5d5cf8[_0x3197('0x51')](_0x44a6d5);}})[_0x3197('0x25')](function(_0x765795){if(_0x765795){_0x58dba9=_0x765795[_0x3197('0x37')];if(!_0x59ae8b[_0x3197('0x30')][_0x3197('0x38')](_0x3197('0x39'))){_0x44a6d5[_0x3197('0x1e')]=qs[_0x3197('0x1e')](_0x59ae8b[_0x3197('0x30')][_0x3197('0x1e')]);_0x44a6d5[_0x3197('0x1c')]=qs[_0x3197('0x1c')](_0x59ae8b[_0x3197('0x30')][_0x3197('0x1c')]);}return _0x5d5cf8[_0x3197('0x51')](_0x44a6d5);}})[_0x3197('0x25')](function(_0x125998){if(_0x125998){return _0x125998?{'count':_0x58dba9,'rows':_0x125998}:null;}})['then'](respondWithResult(_0x10cdbb,null))[_0x3197('0x45')](handleError(_0x10cdbb,null));};exports[_0x3197('0x52')]=function(_0x53e4bb,_0x89bb5c,_0x563802){if(_0x53e4bb[_0x3197('0x47')]['id']){delete _0x53e4bb[_0x3197('0x47')]['id'];}return db[_0x3197('0x2c')]['findOne']({'where':{'id':_0x53e4bb['params']['id']}})[_0x3197('0x25')](handleEntityNotFound(_0x89bb5c,null))[_0x3197('0x25')](function(_0x178f89){if(_0x178f89){return _0x178f89['setTags'](_0x53e4bb[_0x3197('0x47')][_0x3197('0x53')]||[]);}return null;})[_0x3197('0x25')](respondWithResult(_0x89bb5c,null))[_0x3197('0x45')](handleError(_0x89bb5c,null));}; \ No newline at end of file +var _0x22bf=['limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','key','model','map','keys','filters','intersection','query','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','FreshdeskConfiguration','findAll','then','catch','show','params','fields','includeAll','include','create','body','find','getFields','FreshdeskField','getSubjects','findOne','Tag','getTags','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset'];(function(_0xe59404,_0xc31864){var _0x23a1e1=function(_0x46d8e7){while(--_0x46d8e7){_0xe59404['push'](_0xe59404['shift']());}};_0x23a1e1(++_0xc31864);}(_0x22bf,0xe0));var _0xf22b=function(_0x53bc4a,_0x44f45e){_0x53bc4a=_0x53bc4a-0x0;var _0x312927=_0x22bf[_0x53bc4a];return _0x312927;};'use strict';var emlformat=require(_0xf22b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf22b('0x1'));var jsonpatch=require(_0xf22b('0x2'));var rp=require(_0xf22b('0x3'));var moment=require(_0xf22b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf22b('0x5'));var util=require(_0xf22b('0x6'));var path=require(_0xf22b('0x7'));var sox=require(_0xf22b('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf22b('0x9'));var squel=require(_0xf22b('0xa'));var crypto=require('crypto');var jsforce=require(_0xf22b('0xb'));var deskjs=require(_0xf22b('0xc'));var toCsv=require(_0xf22b('0xd'));var querystring=require(_0xf22b('0xe'));var Papa=require(_0xf22b('0xf'));var Redis=require(_0xf22b('0x10'));var authService=require(_0xf22b('0x11'));var qs=require(_0xf22b('0x12'));var as=require(_0xf22b('0x13'));var hardwareService=require(_0xf22b('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xf22b('0x15'));var config=require(_0xf22b('0x16'));var licenseUtil=require(_0xf22b('0x17'));var db=require(_0xf22b('0x18'))['db'];function respondWithStatusCode(_0x3aed0f,_0x48c13e){_0x48c13e=_0x48c13e||0xcc;return function(_0x9455b6){if(_0x9455b6){return _0x3aed0f['sendStatus'](_0x48c13e);}return _0x3aed0f[_0xf22b('0x19')](_0x48c13e)[_0xf22b('0x1a')]();};}function respondWithResult(_0x810ddc,_0x404f02){_0x404f02=_0x404f02||0xc8;return function(_0x5936d8){if(_0x5936d8){return _0x810ddc['status'](_0x404f02)['json'](_0x5936d8);}};}function respondWithFilteredResult(_0x2099ad,_0x5ec3d0){return function(_0x10e21e){if(_0x10e21e){var _0x382966=typeof _0x5ec3d0[_0xf22b('0x1b')]==='undefined'&&typeof _0x5ec3d0[_0xf22b('0x1c')]==='undefined';var _0x28ff52=_0x10e21e[_0xf22b('0x1d')];var _0x46c402=_0x382966?0x0:_0x5ec3d0[_0xf22b('0x1b')];var _0x20e153=_0x382966?_0x10e21e['count']:_0x5ec3d0[_0xf22b('0x1b')]+_0x5ec3d0[_0xf22b('0x1c')];var _0x21c2a1;if(_0x20e153>=_0x28ff52){_0x20e153=_0x28ff52;_0x21c2a1=0xc8;}else{_0x21c2a1=0xce;}_0x2099ad[_0xf22b('0x19')](_0x21c2a1);return _0x2099ad[_0xf22b('0x1e')](_0xf22b('0x1f'),_0x46c402+'-'+_0x20e153+'/'+_0x28ff52)['json'](_0x10e21e);}return null;};}function patchUpdates(_0x2656cf){return function(_0x327471){try{jsonpatch[_0xf22b('0x20')](_0x327471,_0x2656cf,!![]);}catch(_0x428b02){return BPromise[_0xf22b('0x21')](_0x428b02);}return _0x327471[_0xf22b('0x22')]();};}function saveUpdates(_0x5c96d6,_0xd1f08e){return function(_0x6d532a){if(_0x6d532a){return _0x6d532a[_0xf22b('0x23')](_0x5c96d6)['then'](function(_0x158845){return _0x158845;});}return null;};}function removeEntity(_0x5424ce,_0x1932a3){return function(_0x507a8c){if(_0x507a8c){return _0x507a8c[_0xf22b('0x24')]()['then'](function(){_0x5424ce['status'](0xcc)[_0xf22b('0x1a')]();});}};}function handleEntityNotFound(_0x28554f,_0x4000bc){return function(_0x171d1e){if(!_0x171d1e){_0x28554f[_0xf22b('0x25')](0x194);}return _0x171d1e;};}function handleError(_0x20f7aa,_0x47dc11){_0x47dc11=_0x47dc11||0x1f4;return function(_0x56eb42){logger[_0xf22b('0x26')](_0x56eb42[_0xf22b('0x27')]);if(_0x56eb42[_0xf22b('0x28')]){delete _0x56eb42[_0xf22b('0x28')];}_0x20f7aa['status'](_0x47dc11)[_0xf22b('0x29')](_0x56eb42);};}exports[_0xf22b('0x2a')]=function(_0x1363e5,_0x34a227){var _0x3a57bc={},_0x30c746={},_0x3f4a03={'count':0x0,'rows':[]};var _0xd1f652=_['map'](db['FreshdeskConfiguration'][_0xf22b('0x2b')],function(_0x22da91){return{'name':_0x22da91[_0xf22b('0x2c')],'type':_0x22da91['type'][_0xf22b('0x2d')]};});_0x30c746[_0xf22b('0x2e')]=_[_0xf22b('0x2f')](_0xd1f652,_0xf22b('0x28'));_0x30c746['query']=_[_0xf22b('0x30')](_0x1363e5['query']);_0x30c746[_0xf22b('0x31')]=_[_0xf22b('0x32')](_0x30c746[_0xf22b('0x2e')],_0x30c746[_0xf22b('0x33')]);_0x3a57bc['attributes']=_['intersection'](_0x30c746[_0xf22b('0x2e')],qs['fields'](_0x1363e5[_0xf22b('0x33')]['fields']));_0x3a57bc[_0xf22b('0x34')]=_0x3a57bc['attributes'][_0xf22b('0x35')]?_0x3a57bc[_0xf22b('0x34')]:_0x30c746[_0xf22b('0x2e')];if(!_0x1363e5[_0xf22b('0x33')][_0xf22b('0x36')](_0xf22b('0x37'))){_0x3a57bc[_0xf22b('0x1c')]=qs[_0xf22b('0x1c')](_0x1363e5[_0xf22b('0x33')][_0xf22b('0x1c')]);_0x3a57bc[_0xf22b('0x1b')]=qs['offset'](_0x1363e5[_0xf22b('0x33')][_0xf22b('0x1b')]);}_0x3a57bc[_0xf22b('0x38')]=qs[_0xf22b('0x39')](_0x1363e5[_0xf22b('0x33')][_0xf22b('0x39')]);_0x3a57bc[_0xf22b('0x3a')]=qs[_0xf22b('0x31')](_[_0xf22b('0x3b')](_0x1363e5[_0xf22b('0x33')],_0x30c746[_0xf22b('0x31')]),_0xd1f652);if(_0x1363e5['query'][_0xf22b('0x3c')]){_0x3a57bc[_0xf22b('0x3a')]=_[_0xf22b('0x3d')](_0x3a57bc['where'],{'$or':_[_0xf22b('0x2f')](_0xd1f652,function(_0x2fa534){if(_0x2fa534['type']!==_0xf22b('0x3e')){var _0x31321d={};_0x31321d[_0x2fa534[_0xf22b('0x28')]]={'$like':'%'+_0x1363e5[_0xf22b('0x33')][_0xf22b('0x3c')]+'%'};return _0x31321d;}})});}_0x3a57bc=_[_0xf22b('0x3d')]({},_0x3a57bc,_0x1363e5[_0xf22b('0x3f')]);var _0x536a86={'where':_0x3a57bc[_0xf22b('0x3a')]};return db[_0xf22b('0x40')][_0xf22b('0x1d')](_0x536a86)['then'](function(_0x3f31d3){_0x3f4a03[_0xf22b('0x1d')]=_0x3f31d3;if(_0x1363e5[_0xf22b('0x33')]['includeAll']){_0x3a57bc['include']=[{'all':!![]}];}return db[_0xf22b('0x40')][_0xf22b('0x41')](_0x3a57bc);})['then'](function(_0x13e17b){_0x3f4a03['rows']=_0x13e17b;return _0x3f4a03;})[_0xf22b('0x42')](respondWithFilteredResult(_0x34a227,_0x3a57bc))[_0xf22b('0x43')](handleError(_0x34a227,null));};exports[_0xf22b('0x44')]=function(_0x412e2d,_0x3da437){var _0x163e2c={'raw':![],'where':{'id':_0x412e2d[_0xf22b('0x45')]['id']}},_0x42423e={};_0x42423e[_0xf22b('0x2e')]=_[_0xf22b('0x30')](db[_0xf22b('0x40')][_0xf22b('0x2b')]);_0x42423e[_0xf22b('0x33')]=_[_0xf22b('0x30')](_0x412e2d['query']);_0x42423e['filters']=_[_0xf22b('0x32')](_0x42423e[_0xf22b('0x2e')],_0x42423e[_0xf22b('0x33')]);_0x163e2c[_0xf22b('0x34')]=_['intersection'](_0x42423e[_0xf22b('0x2e')],qs[_0xf22b('0x46')](_0x412e2d[_0xf22b('0x33')][_0xf22b('0x46')]));_0x163e2c[_0xf22b('0x34')]=_0x163e2c[_0xf22b('0x34')][_0xf22b('0x35')]?_0x163e2c[_0xf22b('0x34')]:_0x42423e[_0xf22b('0x2e')];if(_0x412e2d['query'][_0xf22b('0x47')]){_0x163e2c[_0xf22b('0x48')]=[{'all':!![]}];}_0x163e2c=_[_0xf22b('0x3d')]({},_0x163e2c,_0x412e2d['options']);return db['FreshdeskConfiguration']['find'](_0x163e2c)[_0xf22b('0x42')](handleEntityNotFound(_0x3da437,null))[_0xf22b('0x42')](respondWithResult(_0x3da437,null))[_0xf22b('0x43')](handleError(_0x3da437,null));};exports[_0xf22b('0x49')]=function(_0x7a3c13,_0x5ec55a){return db[_0xf22b('0x40')][_0xf22b('0x49')](_0x7a3c13[_0xf22b('0x4a')],{})['then'](respondWithResult(_0x5ec55a,0xc9))[_0xf22b('0x43')](handleError(_0x5ec55a,null));};exports['update']=function(_0xa95ea8,_0x5eae6c){if(_0xa95ea8[_0xf22b('0x4a')]['id']){delete _0xa95ea8[_0xf22b('0x4a')]['id'];}return db[_0xf22b('0x40')][_0xf22b('0x4b')]({'where':{'id':_0xa95ea8[_0xf22b('0x45')]['id']}})[_0xf22b('0x42')](handleEntityNotFound(_0x5eae6c,null))[_0xf22b('0x42')](saveUpdates(_0xa95ea8[_0xf22b('0x4a')],null))[_0xf22b('0x42')](respondWithResult(_0x5eae6c,null))[_0xf22b('0x43')](handleError(_0x5eae6c,null));};exports[_0xf22b('0x24')]=function(_0x12e6c3,_0x5d8795){return db[_0xf22b('0x40')][_0xf22b('0x4b')]({'where':{'id':_0x12e6c3[_0xf22b('0x45')]['id']}})[_0xf22b('0x42')](handleEntityNotFound(_0x5d8795,null))[_0xf22b('0x42')](removeEntity(_0x5d8795,null))[_0xf22b('0x43')](handleError(_0x5d8795,null));};exports[_0xf22b('0x4c')]=function(_0x27dd0f,_0x31b896,_0xa70319){var _0x5282ef={};var _0x1a49e7={};var _0x3efddd;var _0x514855;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x27dd0f[_0xf22b('0x45')]['id']}})['then'](handleEntityNotFound(_0x31b896,null))[_0xf22b('0x42')](function(_0x355f16){if(_0x355f16){_0x3efddd=_0x355f16;_0x1a49e7[_0xf22b('0x2e')]=_[_0xf22b('0x30')](db[_0xf22b('0x4d')][_0xf22b('0x2b')]);_0x1a49e7['query']=_[_0xf22b('0x30')](_0x27dd0f[_0xf22b('0x33')]);_0x1a49e7[_0xf22b('0x31')]=_[_0xf22b('0x32')](_0x1a49e7[_0xf22b('0x2e')],_0x1a49e7[_0xf22b('0x33')]);_0x5282ef[_0xf22b('0x34')]=_[_0xf22b('0x32')](_0x1a49e7[_0xf22b('0x2e')],qs[_0xf22b('0x46')](_0x27dd0f[_0xf22b('0x33')][_0xf22b('0x46')]));_0x5282ef[_0xf22b('0x34')]=_0x5282ef[_0xf22b('0x34')][_0xf22b('0x35')]?_0x5282ef[_0xf22b('0x34')]:_0x1a49e7[_0xf22b('0x2e')];_0x5282ef[_0xf22b('0x38')]=qs[_0xf22b('0x39')](_0x27dd0f['query'][_0xf22b('0x39')]);_0x5282ef[_0xf22b('0x3a')]=qs[_0xf22b('0x31')](_[_0xf22b('0x3b')](_0x27dd0f[_0xf22b('0x33')],_0x1a49e7[_0xf22b('0x31')]));if(_0x27dd0f['query'][_0xf22b('0x3c')]){_0x5282ef[_0xf22b('0x3a')]=_['merge'](_0x5282ef[_0xf22b('0x3a')],{'$or':_[_0xf22b('0x2f')](_0x5282ef[_0xf22b('0x34')],function(_0x2545d2){var _0x4bf7e0={};_0x4bf7e0[_0x2545d2]={'$like':'%'+_0x27dd0f[_0xf22b('0x33')][_0xf22b('0x3c')]+'%'};return _0x4bf7e0;})});}_0x5282ef=_[_0xf22b('0x3d')]({},_0x5282ef,_0x27dd0f['options']);return _0x3efddd[_0xf22b('0x4c')](_0x5282ef);}})[_0xf22b('0x42')](function(_0x4a10e1){if(_0x4a10e1){_0x514855=_0x4a10e1[_0xf22b('0x35')];if(!_0x27dd0f[_0xf22b('0x33')][_0xf22b('0x36')](_0xf22b('0x37'))){_0x5282ef[_0xf22b('0x1c')]=qs[_0xf22b('0x1c')](_0x27dd0f[_0xf22b('0x33')]['limit']);_0x5282ef['offset']=qs[_0xf22b('0x1b')](_0x27dd0f['query']['offset']);}return _0x3efddd[_0xf22b('0x4c')](_0x5282ef);}})['then'](function(_0x13f759){if(_0x13f759){return _0x13f759?{'count':_0x514855,'rows':_0x13f759}:null;}})[_0xf22b('0x42')](respondWithResult(_0x31b896,null))[_0xf22b('0x43')](handleError(_0x31b896,null));};exports['getSubjects']=function(_0x2b5cd8,_0x29c418,_0x358356){var _0x5bfa1e={};var _0x1f06b3={};var _0x29dba4;var _0x3703f1;return db[_0xf22b('0x40')]['findOne']({'where':{'id':_0x2b5cd8['params']['id']}})[_0xf22b('0x42')](handleEntityNotFound(_0x29c418,null))[_0xf22b('0x42')](function(_0x259786){if(_0x259786){_0x29dba4=_0x259786;_0x1f06b3[_0xf22b('0x2e')]=_[_0xf22b('0x30')](db[_0xf22b('0x4d')]['rawAttributes']);_0x1f06b3[_0xf22b('0x33')]=_[_0xf22b('0x30')](_0x2b5cd8[_0xf22b('0x33')]);_0x1f06b3[_0xf22b('0x31')]=_[_0xf22b('0x32')](_0x1f06b3['model'],_0x1f06b3[_0xf22b('0x33')]);_0x5bfa1e[_0xf22b('0x34')]=_[_0xf22b('0x32')](_0x1f06b3[_0xf22b('0x2e')],qs['fields'](_0x2b5cd8[_0xf22b('0x33')][_0xf22b('0x46')]));_0x5bfa1e[_0xf22b('0x34')]=_0x5bfa1e[_0xf22b('0x34')][_0xf22b('0x35')]?_0x5bfa1e[_0xf22b('0x34')]:_0x1f06b3[_0xf22b('0x2e')];_0x5bfa1e[_0xf22b('0x38')]=qs[_0xf22b('0x39')](_0x2b5cd8[_0xf22b('0x33')]['sort']);_0x5bfa1e[_0xf22b('0x3a')]=qs[_0xf22b('0x31')](_[_0xf22b('0x3b')](_0x2b5cd8[_0xf22b('0x33')],_0x1f06b3['filters']));if(_0x2b5cd8['query'][_0xf22b('0x3c')]){_0x5bfa1e[_0xf22b('0x3a')]=_['merge'](_0x5bfa1e[_0xf22b('0x3a')],{'$or':_[_0xf22b('0x2f')](_0x5bfa1e[_0xf22b('0x34')],function(_0x470c60){var _0x2cf5cd={};_0x2cf5cd[_0x470c60]={'$like':'%'+_0x2b5cd8['query'][_0xf22b('0x3c')]+'%'};return _0x2cf5cd;})});}_0x5bfa1e=_['merge']({},_0x5bfa1e,_0x2b5cd8[_0xf22b('0x3f')]);return _0x29dba4[_0xf22b('0x4e')](_0x5bfa1e);}})[_0xf22b('0x42')](function(_0x346858){if(_0x346858){_0x3703f1=_0x346858[_0xf22b('0x35')];if(!_0x2b5cd8[_0xf22b('0x33')]['hasOwnProperty'](_0xf22b('0x37'))){_0x5bfa1e[_0xf22b('0x1c')]=qs['limit'](_0x2b5cd8[_0xf22b('0x33')][_0xf22b('0x1c')]);_0x5bfa1e['offset']=qs[_0xf22b('0x1b')](_0x2b5cd8[_0xf22b('0x33')][_0xf22b('0x1b')]);}return _0x29dba4['getSubjects'](_0x5bfa1e);}})['then'](function(_0x2892ea){if(_0x2892ea){return _0x2892ea?{'count':_0x3703f1,'rows':_0x2892ea}:null;}})[_0xf22b('0x42')](respondWithResult(_0x29c418,null))[_0xf22b('0x43')](handleError(_0x29c418,null));};exports['getDescriptions']=function(_0x49db38,_0x4064e5,_0x45d0b0){var _0x214cab={};var _0x2a666f={};var _0x2282da;var _0x1303af;return db[_0xf22b('0x40')]['findOne']({'where':{'id':_0x49db38['params']['id']}})[_0xf22b('0x42')](handleEntityNotFound(_0x4064e5,null))['then'](function(_0x96f490){if(_0x96f490){_0x2282da=_0x96f490;_0x2a666f[_0xf22b('0x2e')]=_['keys'](db[_0xf22b('0x4d')][_0xf22b('0x2b')]);_0x2a666f[_0xf22b('0x33')]=_['keys'](_0x49db38[_0xf22b('0x33')]);_0x2a666f[_0xf22b('0x31')]=_['intersection'](_0x2a666f[_0xf22b('0x2e')],_0x2a666f[_0xf22b('0x33')]);_0x214cab[_0xf22b('0x34')]=_[_0xf22b('0x32')](_0x2a666f[_0xf22b('0x2e')],qs[_0xf22b('0x46')](_0x49db38[_0xf22b('0x33')][_0xf22b('0x46')]));_0x214cab['attributes']=_0x214cab[_0xf22b('0x34')]['length']?_0x214cab[_0xf22b('0x34')]:_0x2a666f[_0xf22b('0x2e')];_0x214cab[_0xf22b('0x38')]=qs['sort'](_0x49db38[_0xf22b('0x33')][_0xf22b('0x39')]);_0x214cab[_0xf22b('0x3a')]=qs[_0xf22b('0x31')](_[_0xf22b('0x3b')](_0x49db38[_0xf22b('0x33')],_0x2a666f[_0xf22b('0x31')]));if(_0x49db38[_0xf22b('0x33')][_0xf22b('0x3c')]){_0x214cab['where']=_[_0xf22b('0x3d')](_0x214cab[_0xf22b('0x3a')],{'$or':_[_0xf22b('0x2f')](_0x214cab[_0xf22b('0x34')],function(_0x56ce1d){var _0x31aa5a={};_0x31aa5a[_0x56ce1d]={'$like':'%'+_0x49db38[_0xf22b('0x33')][_0xf22b('0x3c')]+'%'};return _0x31aa5a;})});}_0x214cab=_[_0xf22b('0x3d')]({},_0x214cab,_0x49db38[_0xf22b('0x3f')]);return _0x2282da['getDescriptions'](_0x214cab);}})[_0xf22b('0x42')](function(_0x1f7dab){if(_0x1f7dab){_0x1303af=_0x1f7dab['length'];if(!_0x49db38[_0xf22b('0x33')][_0xf22b('0x36')]('nolimit')){_0x214cab[_0xf22b('0x1c')]=qs[_0xf22b('0x1c')](_0x49db38['query'][_0xf22b('0x1c')]);_0x214cab[_0xf22b('0x1b')]=qs[_0xf22b('0x1b')](_0x49db38[_0xf22b('0x33')][_0xf22b('0x1b')]);}return _0x2282da['getDescriptions'](_0x214cab);}})[_0xf22b('0x42')](function(_0x45400c){if(_0x45400c){return _0x45400c?{'count':_0x1303af,'rows':_0x45400c}:null;}})[_0xf22b('0x42')](respondWithResult(_0x4064e5,null))[_0xf22b('0x43')](handleError(_0x4064e5,null));};exports['getTags']=function(_0x4a775c,_0x591722,_0x4267c0){var _0x135b9c={};var _0x54625b={};var _0x5b1c95;var _0x960b8c;return db['FreshdeskConfiguration'][_0xf22b('0x4f')]({'where':{'id':_0x4a775c[_0xf22b('0x45')]['id']}})[_0xf22b('0x42')](handleEntityNotFound(_0x591722,null))[_0xf22b('0x42')](function(_0x2f6a6d){if(_0x2f6a6d){_0x5b1c95=_0x2f6a6d;_0x54625b[_0xf22b('0x2e')]=_[_0xf22b('0x30')](db[_0xf22b('0x50')][_0xf22b('0x2b')]);_0x54625b[_0xf22b('0x33')]=_[_0xf22b('0x30')](_0x4a775c[_0xf22b('0x33')]);_0x54625b[_0xf22b('0x31')]=_[_0xf22b('0x32')](_0x54625b[_0xf22b('0x2e')],_0x54625b[_0xf22b('0x33')]);_0x135b9c[_0xf22b('0x34')]=_[_0xf22b('0x32')](_0x54625b[_0xf22b('0x2e')],qs[_0xf22b('0x46')](_0x4a775c[_0xf22b('0x33')][_0xf22b('0x46')]));_0x135b9c[_0xf22b('0x34')]=_0x135b9c[_0xf22b('0x34')][_0xf22b('0x35')]?_0x135b9c[_0xf22b('0x34')]:_0x54625b[_0xf22b('0x2e')];_0x135b9c[_0xf22b('0x38')]=qs[_0xf22b('0x39')](_0x4a775c[_0xf22b('0x33')][_0xf22b('0x39')]);_0x135b9c['where']=qs[_0xf22b('0x31')](_[_0xf22b('0x3b')](_0x4a775c['query'],_0x54625b['filters']));if(_0x4a775c[_0xf22b('0x33')][_0xf22b('0x3c')]){_0x135b9c[_0xf22b('0x3a')]=_[_0xf22b('0x3d')](_0x135b9c['where'],{'$or':_[_0xf22b('0x2f')](_0x135b9c[_0xf22b('0x34')],function(_0x2529a2){var _0x5d35f8={};_0x5d35f8[_0x2529a2]={'$like':'%'+_0x4a775c[_0xf22b('0x33')]['filter']+'%'};return _0x5d35f8;})});}_0x135b9c=_[_0xf22b('0x3d')]({},_0x135b9c,_0x4a775c['options']);return _0x5b1c95[_0xf22b('0x51')](_0x135b9c);}})[_0xf22b('0x42')](function(_0x1ccf7f){if(_0x1ccf7f){_0x960b8c=_0x1ccf7f['length'];if(!_0x4a775c[_0xf22b('0x33')][_0xf22b('0x36')](_0xf22b('0x37'))){_0x135b9c[_0xf22b('0x1c')]=qs[_0xf22b('0x1c')](_0x4a775c[_0xf22b('0x33')]['limit']);_0x135b9c[_0xf22b('0x1b')]=qs[_0xf22b('0x1b')](_0x4a775c[_0xf22b('0x33')][_0xf22b('0x1b')]);}return _0x5b1c95[_0xf22b('0x51')](_0x135b9c);}})[_0xf22b('0x42')](function(_0x9f26a){if(_0x9f26a){return _0x9f26a?{'count':_0x960b8c,'rows':_0x9f26a}:null;}})['then'](respondWithResult(_0x591722,null))['catch'](handleError(_0x591722,null));};exports['setTags']=function(_0x2a51e9,_0x438a5b,_0x28fc71){if(_0x2a51e9[_0xf22b('0x4a')]['id']){delete _0x2a51e9[_0xf22b('0x4a')]['id'];}return db[_0xf22b('0x40')]['findOne']({'where':{'id':_0x2a51e9[_0xf22b('0x45')]['id']}})[_0xf22b('0x42')](handleEntityNotFound(_0x438a5b,null))[_0xf22b('0x42')](function(_0x483c3d){if(_0x483c3d){return _0x483c3d[_0xf22b('0x52')](_0x2a51e9[_0xf22b('0x4a')][_0xf22b('0x53')]||[]);}return null;})[_0xf22b('0x42')](respondWithResult(_0x438a5b,null))['catch'](handleError(_0x438a5b,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 19ede3b..c864ada 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 _0x0cea=['api','moment','bluebird','request-promise','path','../../config/environment','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','lodash','../../config/logger'];(function(_0x2220d3,_0x493e4d){var _0x376db5=function(_0x5efb21){while(--_0x5efb21){_0x2220d3['push'](_0x2220d3['shift']());}};_0x376db5(++_0x493e4d);}(_0x0cea,0xb9));var _0xa0ce=function(_0x25ac1c,_0x5b55dd){_0x25ac1c=_0x25ac1c-0x0;var _0x3f172b=_0x0cea[_0x25ac1c];return _0x3f172b;};'use strict';var _=require(_0xa0ce('0x0'));var util=require('util');var logger=require(_0xa0ce('0x1'))(_0xa0ce('0x2'));var moment=require(_0xa0ce('0x3'));var BPromise=require(_0xa0ce('0x4'));var rp=require(_0xa0ce('0x5'));var fs=require('fs');var path=require(_0xa0ce('0x6'));var rimraf=require('rimraf');var config=require(_0xa0ce('0x7'));var attributes=require(_0xa0ce('0x8'));module['exports']=function(_0x877670,_0x17e665){return _0x877670[_0xa0ce('0x9')](_0xa0ce('0xa'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1ad1=['util','../../config/logger','api','moment','bluebird','request-promise','path','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash'];(function(_0x5b7ec2,_0x33b805){var _0xaebaca=function(_0x2b7906){while(--_0x2b7906){_0x5b7ec2['push'](_0x5b7ec2['shift']());}};_0xaebaca(++_0x33b805);}(_0x1ad1,0x1ac));var _0x11ad=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x1ad1[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x11ad('0x0'));var util=require(_0x11ad('0x1'));var logger=require(_0x11ad('0x2'))(_0x11ad('0x3'));var moment=require(_0x11ad('0x4'));var BPromise=require(_0x11ad('0x5'));var rp=require(_0x11ad('0x6'));var fs=require('fs');var path=require(_0x11ad('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x11ad('0x8'));module[_0x11ad('0x9')]=function(_0x1e4e54,_0x1bf63b){return _0x1e4e54[_0x11ad('0xa')](_0x11ad('0xb'),attributes,{'tableName':_0x11ad('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 0b47d6f..c40e191 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 _0x74b9=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util'];(function(_0x426b02,_0x5ad183){var _0x1db499=function(_0x56e386){while(--_0x56e386){_0x426b02['push'](_0x426b02['shift']());}};_0x1db499(++_0x5ad183);}(_0x74b9,0xb4));var _0x974b=function(_0x936f68,_0x439b12){_0x936f68=_0x936f68-0x0;var _0x16a1c2=_0x74b9[_0x936f68];return _0x16a1c2;};'use strict';var _=require(_0x974b('0x0'));var util=require(_0x974b('0x1'));var moment=require(_0x974b('0x2'));var BPromise=require(_0x974b('0x3'));var rs=require(_0x974b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x974b('0x5'))['db'];var utils=require(_0x974b('0x6'));var logger=require(_0x974b('0x7'))(_0x974b('0x8'));var config=require(_0x974b('0x9'));var jayson=require(_0x974b('0xa'));var client=jayson[_0x974b('0xb')][_0x974b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1e5d3b,_0x301212,_0x3a1d08){return new BPromise(function(_0x1d8f5f,_0x16e06f){return client[_0x974b('0xd')](_0x1e5d3b,_0x3a1d08)[_0x974b('0xe')](function(_0x55ce3c){logger['info'](_0x974b('0xf'),_0x301212,_0x974b('0x10'));logger[_0x974b('0x11')](_0x974b('0x12'),_0x301212,_0x974b('0x10'),JSON[_0x974b('0x13')](_0x55ce3c));if(_0x55ce3c[_0x974b('0x14')]){if(_0x55ce3c[_0x974b('0x14')][_0x974b('0x15')]===0x1f4){logger[_0x974b('0x14')](_0x974b('0xf'),_0x301212,_0x55ce3c[_0x974b('0x14')][_0x974b('0x16')]);return _0x16e06f(_0x55ce3c[_0x974b('0x14')][_0x974b('0x16')]);}logger[_0x974b('0x14')](_0x974b('0xf'),_0x301212,_0x55ce3c[_0x974b('0x14')][_0x974b('0x16')]);return _0x1d8f5f(_0x55ce3c[_0x974b('0x14')][_0x974b('0x16')]);}else{logger[_0x974b('0x17')](_0x974b('0xf'),_0x301212,_0x974b('0x10'));_0x1d8f5f(_0x55ce3c[_0x974b('0x18')]['message']);}})[_0x974b('0x19')](function(_0x537f65){logger['error'](_0x974b('0xf'),_0x301212,_0x537f65);_0x16e06f(_0x537f65);});});} \ No newline at end of file +var _0x5072=['error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x5072,0xc4));var _0x2507=function(_0x48f939,_0x39b8b5){_0x48f939=_0x48f939-0x0;var _0x3f4442=_0x5072[_0x48f939];return _0x3f4442;};'use strict';var _=require(_0x2507('0x0'));var util=require('util');var moment=require(_0x2507('0x1'));var BPromise=require(_0x2507('0x2'));var rs=require(_0x2507('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2507('0x4'));var logger=require(_0x2507('0x5'))(_0x2507('0x6'));var config=require(_0x2507('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2507('0x8')][_0x2507('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xd4e02b,_0x5c9fb1,_0x497247){return new BPromise(function(_0x30d0ac,_0x854df6){return client['request'](_0xd4e02b,_0x497247)[_0x2507('0xa')](function(_0x4fb385){logger['info'](_0x2507('0xb'),_0x5c9fb1,_0x2507('0xc'));logger['debug']('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x5c9fb1,_0x2507('0xc'),JSON['stringify'](_0x4fb385));if(_0x4fb385[_0x2507('0xd')]){if(_0x4fb385[_0x2507('0xd')][_0x2507('0xe')]===0x1f4){logger[_0x2507('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x5c9fb1,_0x4fb385[_0x2507('0xd')][_0x2507('0xf')]);return _0x854df6(_0x4fb385[_0x2507('0xd')][_0x2507('0xf')]);}logger[_0x2507('0xd')](_0x2507('0xb'),_0x5c9fb1,_0x4fb385[_0x2507('0xd')][_0x2507('0xf')]);return _0x30d0ac(_0x4fb385[_0x2507('0xd')][_0x2507('0xf')]);}else{logger[_0x2507('0x10')](_0x2507('0xb'),_0x5c9fb1,_0x2507('0xc'));_0x30d0ac(_0x4fb385[_0x2507('0x11')][_0x2507('0xf')]);}})[_0x2507('0x12')](function(_0x4223dc){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x5c9fb1,_0x4223dc);_0x854df6(_0x4223dc);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 61499dd..43c6dee 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 _0x9268=['show','post','isAuthenticated','create','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','/:id'];(function(_0x55d58f,_0x2bea83){var _0x1ad6e6=function(_0x31447e){while(--_0x31447e){_0x55d58f['push'](_0x55d58f['shift']());}};_0x1ad6e6(++_0x2bea83);}(_0x9268,0x10c));var _0x8926=function(_0x51ed62,_0x574379){_0x51ed62=_0x51ed62-0x0;var _0x34aee3=_0x9268[_0x51ed62];return _0x34aee3;};'use strict';var multer=require(_0x8926('0x0'));var util=require(_0x8926('0x1'));var path=require(_0x8926('0x2'));var timeout=require('connect-timeout');var express=require(_0x8926('0x3'));var router=express[_0x8926('0x4')]();var fs_extra=require(_0x8926('0x5'));var auth=require(_0x8926('0x6'));var interaction=require(_0x8926('0x7'));var config=require(_0x8926('0x8'));var controller=require(_0x8926('0x9'));router[_0x8926('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8926('0xa')](_0x8926('0xb'),auth['isAuthenticated'](),controller[_0x8926('0xc')]);router[_0x8926('0xd')]('/',auth[_0x8926('0xe')](),controller[_0x8926('0xf')]);router[_0x8926('0x10')](_0x8926('0xb'),auth[_0x8926('0xe')](),controller['update']);router[_0x8926('0x11')](_0x8926('0xb'),auth[_0x8926('0xe')](),controller[_0x8926('0x12')]);module[_0x8926('0x13')]=router; \ No newline at end of file +var _0xe2b0=['update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','./intFreshdeskField.controller','get','isAuthenticated','show','create','/:id'];(function(_0x1d7d2d,_0x58c25c){var _0x1ffb84=function(_0x8db7b4){while(--_0x8db7b4){_0x1d7d2d['push'](_0x1d7d2d['shift']());}};_0x1ffb84(++_0x58c25c);}(_0xe2b0,0x1c6));var _0x0e2b=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xe2b0[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require('multer');var util=require(_0x0e2b('0x0'));var path=require(_0x0e2b('0x1'));var timeout=require(_0x0e2b('0x2'));var express=require('express');var router=express[_0x0e2b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0e2b('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0e2b('0x5'));router[_0x0e2b('0x6')]('/',auth[_0x0e2b('0x7')](),controller['index']);router[_0x0e2b('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x0e2b('0x8')]);router['post']('/',auth[_0x0e2b('0x7')](),controller[_0x0e2b('0x9')]);router['put'](_0x0e2b('0xa'),auth['isAuthenticated'](),controller[_0x0e2b('0xb')]);router[_0x0e2b('0xc')](_0x0e2b('0xa'),auth['isAuthenticated'](),controller[_0x0e2b('0xd')]);module[_0x0e2b('0xe')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index e028245..a4d60e6 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 _0xa634=['variable','customVariable','picklist','STRING','sequelize','exports','ENUM','string'];(function(_0x1a0967,_0x51bc82){var _0x5a169f=function(_0x43fda2){while(--_0x43fda2){_0x1a0967['push'](_0x1a0967['shift']());}};_0x5a169f(++_0x51bc82);}(_0xa634,0x1bc));var _0x4a63=function(_0x4a290a,_0x3e4010){_0x4a290a=_0x4a290a-0x0;var _0x24bd1d=_0xa634[_0x4a290a];return _0x24bd1d;};'use strict';var Sequelize=require(_0x4a63('0x0'));module[_0x4a63('0x1')]={'type':{'type':Sequelize[_0x4a63('0x2')](_0x4a63('0x3'),_0x4a63('0x4'),_0x4a63('0x5'),'keyValue',_0x4a63('0x6')),'defaultValue':_0x4a63('0x3')},'content':{'type':Sequelize[_0x4a63('0x7')]},'key':{'type':Sequelize[_0x4a63('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x4a63('0x3'),_0x4a63('0x4'),_0x4a63('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x4a63('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe817=['variable','customVariable','sequelize','ENUM','string','keyValue','picklist','STRING'];(function(_0x574162,_0x2425ea){var _0x39c245=function(_0x46653f){while(--_0x46653f){_0x574162['push'](_0x574162['shift']());}};_0x39c245(++_0x2425ea);}(_0xe817,0xb2));var _0x7e81=function(_0x3cfcfa,_0x735735){_0x3cfcfa=_0x3cfcfa-0x0;var _0x12381b=_0xe817[_0x3cfcfa];return _0x12381b;};'use strict';var Sequelize=require(_0x7e81('0x0'));module['exports']={'type':{'type':Sequelize[_0x7e81('0x1')](_0x7e81('0x2'),'variable','customVariable',_0x7e81('0x3'),_0x7e81('0x4')),'defaultValue':_0x7e81('0x2')},'content':{'type':Sequelize[_0x7e81('0x5')]},'key':{'type':Sequelize[_0x7e81('0x5')]},'keyType':{'type':Sequelize[_0x7e81('0x1')](_0x7e81('0x2'),_0x7e81('0x6'),_0x7e81('0x7'))},'keyContent':{'type':Sequelize[_0x7e81('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x7e81('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index f80a8dc..24c1965 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 _0x0bb5=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','merge','where','VIRTUAL','options','findAll','show','params','rawAttributes','includeAll','include','find','catch','create','body','update','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','end','name','send','index','map','FreshdeskField','fieldName','type','key'];(function(_0x807e7c,_0x5631ea){var _0x594069=function(_0x342502){while(--_0x342502){_0x807e7c['push'](_0x807e7c['shift']());}};_0x594069(++_0x5631ea);}(_0x0bb5,0x148));var _0x50bb=function(_0x4c93f6,_0x574abb){_0x4c93f6=_0x4c93f6-0x0;var _0x441266=_0x0bb5[_0x4c93f6];return _0x441266;};'use strict';var emlformat=require(_0x50bb('0x0'));var rimraf=require(_0x50bb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x50bb('0x2'));var moment=require(_0x50bb('0x3'));var BPromise=require(_0x50bb('0x4'));var Mustache=require(_0x50bb('0x5'));var util=require(_0x50bb('0x6'));var path=require(_0x50bb('0x7'));var sox=require(_0x50bb('0x8'));var csv=require(_0x50bb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x50bb('0xa'));var squel=require(_0x50bb('0xb'));var crypto=require(_0x50bb('0xc'));var jsforce=require(_0x50bb('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x50bb('0xe'));var Papa=require(_0x50bb('0xf'));var Redis=require(_0x50bb('0x10'));var authService=require(_0x50bb('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x50bb('0x12'));var hardwareService=require(_0x50bb('0x13'));var logger=require(_0x50bb('0x14'))(_0x50bb('0x15'));var utils=require(_0x50bb('0x16'));var config=require(_0x50bb('0x17'));var licenseUtil=require(_0x50bb('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x226370,_0x58837d){_0x58837d=_0x58837d||0xcc;return function(_0x283f04){if(_0x283f04){return _0x226370[_0x50bb('0x19')](_0x58837d);}return _0x226370[_0x50bb('0x1a')](_0x58837d)['end']();};}function respondWithResult(_0x17007f,_0x309986){_0x309986=_0x309986||0xc8;return function(_0x3094f2){if(_0x3094f2){return _0x17007f['status'](_0x309986)[_0x50bb('0x1b')](_0x3094f2);}};}function respondWithFilteredResult(_0x5e8478,_0x21befa){return function(_0x3e1a51){if(_0x3e1a51){var _0x253073=typeof _0x21befa[_0x50bb('0x1c')]===_0x50bb('0x1d')&&typeof _0x21befa['limit']===_0x50bb('0x1d');var _0x174065=_0x3e1a51['count'];var _0x24ba19=_0x253073?0x0:_0x21befa['offset'];var _0x301f61=_0x253073?_0x3e1a51[_0x50bb('0x1e')]:_0x21befa['offset']+_0x21befa['limit'];var _0x43465b;if(_0x301f61>=_0x174065){_0x301f61=_0x174065;_0x43465b=0xc8;}else{_0x43465b=0xce;}_0x5e8478[_0x50bb('0x1a')](_0x43465b);return _0x5e8478[_0x50bb('0x1f')](_0x50bb('0x20'),_0x24ba19+'-'+_0x301f61+'/'+_0x174065)['json'](_0x3e1a51);}return null;};}function patchUpdates(_0x19dc5d){return function(_0x32bfc3){try{jsonpatch[_0x50bb('0x21')](_0x32bfc3,_0x19dc5d,!![]);}catch(_0x597e95){return BPromise[_0x50bb('0x22')](_0x597e95);}return _0x32bfc3[_0x50bb('0x23')]();};}function saveUpdates(_0x1344ec,_0x4825f8){return function(_0x1dbba2){if(_0x1dbba2){return _0x1dbba2['update'](_0x1344ec)[_0x50bb('0x24')](function(_0x3391da){return _0x3391da;});}return null;};}function removeEntity(_0x1a2a0b,_0x2ee87a){return function(_0x846311){if(_0x846311){return _0x846311[_0x50bb('0x25')]()['then'](function(){_0x1a2a0b[_0x50bb('0x1a')](0xcc)[_0x50bb('0x26')]();});}};}function handleEntityNotFound(_0x284a76,_0x3462c1){return function(_0x5234d7){if(!_0x5234d7){_0x284a76[_0x50bb('0x19')](0x194);}return _0x5234d7;};}function handleError(_0x4d38f7,_0x55e87b){_0x55e87b=_0x55e87b||0x1f4;return function(_0x2befd9){logger['error'](_0x2befd9['stack']);if(_0x2befd9[_0x50bb('0x27')]){delete _0x2befd9[_0x50bb('0x27')];}_0x4d38f7[_0x50bb('0x1a')](_0x55e87b)[_0x50bb('0x28')](_0x2befd9);};}exports[_0x50bb('0x29')]=function(_0x269479,_0x41a8ad){var _0x41d479={},_0x4f7514={},_0x44ce86={'count':0x0,'rows':[]};var _0x461cf3=_[_0x50bb('0x2a')](db[_0x50bb('0x2b')]['rawAttributes'],function(_0x13dc3c){return{'name':_0x13dc3c[_0x50bb('0x2c')],'type':_0x13dc3c[_0x50bb('0x2d')][_0x50bb('0x2e')]};});_0x4f7514[_0x50bb('0x2f')]=_[_0x50bb('0x2a')](_0x461cf3,_0x50bb('0x27'));_0x4f7514[_0x50bb('0x30')]=_[_0x50bb('0x31')](_0x269479[_0x50bb('0x30')]);_0x4f7514[_0x50bb('0x32')]=_[_0x50bb('0x33')](_0x4f7514['model'],_0x4f7514[_0x50bb('0x30')]);_0x41d479[_0x50bb('0x34')]=_[_0x50bb('0x33')](_0x4f7514[_0x50bb('0x2f')],qs[_0x50bb('0x35')](_0x269479[_0x50bb('0x30')][_0x50bb('0x35')]));_0x41d479[_0x50bb('0x34')]=_0x41d479[_0x50bb('0x34')][_0x50bb('0x36')]?_0x41d479[_0x50bb('0x34')]:_0x4f7514['model'];if(!_0x269479[_0x50bb('0x30')][_0x50bb('0x37')](_0x50bb('0x38'))){_0x41d479[_0x50bb('0x39')]=qs[_0x50bb('0x39')](_0x269479[_0x50bb('0x30')]['limit']);_0x41d479['offset']=qs[_0x50bb('0x1c')](_0x269479['query'][_0x50bb('0x1c')]);}_0x41d479[_0x50bb('0x3a')]=qs[_0x50bb('0x3b')](_0x269479[_0x50bb('0x30')][_0x50bb('0x3b')]);_0x41d479['where']=qs[_0x50bb('0x32')](_['pick'](_0x269479[_0x50bb('0x30')],_0x4f7514[_0x50bb('0x32')]),_0x461cf3);if(_0x269479[_0x50bb('0x30')]['filter']){_0x41d479['where']=_[_0x50bb('0x3c')](_0x41d479[_0x50bb('0x3d')],{'$or':_[_0x50bb('0x2a')](_0x461cf3,function(_0x21a180){if(_0x21a180['type']!==_0x50bb('0x3e')){var _0x4b75dc={};_0x4b75dc[_0x21a180['name']]={'$like':'%'+_0x269479[_0x50bb('0x30')]['filter']+'%'};return _0x4b75dc;}})});}_0x41d479=_[_0x50bb('0x3c')]({},_0x41d479,_0x269479[_0x50bb('0x3f')]);var _0x1ef231={'where':_0x41d479[_0x50bb('0x3d')]};return db[_0x50bb('0x2b')][_0x50bb('0x1e')](_0x1ef231)[_0x50bb('0x24')](function(_0x1cf782){_0x44ce86[_0x50bb('0x1e')]=_0x1cf782;if(_0x269479[_0x50bb('0x30')]['includeAll']){_0x41d479['include']=[{'all':!![]}];}return db[_0x50bb('0x2b')][_0x50bb('0x40')](_0x41d479);})[_0x50bb('0x24')](function(_0x1d929d){_0x44ce86['rows']=_0x1d929d;return _0x44ce86;})[_0x50bb('0x24')](respondWithFilteredResult(_0x41a8ad,_0x41d479))['catch'](handleError(_0x41a8ad,null));};exports[_0x50bb('0x41')]=function(_0x473a4c,_0x379944){var _0x40748d={'raw':!![],'where':{'id':_0x473a4c[_0x50bb('0x42')]['id']}},_0x1c438b={};_0x1c438b[_0x50bb('0x2f')]=_[_0x50bb('0x31')](db[_0x50bb('0x2b')][_0x50bb('0x43')]);_0x1c438b[_0x50bb('0x30')]=_[_0x50bb('0x31')](_0x473a4c[_0x50bb('0x30')]);_0x1c438b[_0x50bb('0x32')]=_[_0x50bb('0x33')](_0x1c438b[_0x50bb('0x2f')],_0x1c438b['query']);_0x40748d[_0x50bb('0x34')]=_['intersection'](_0x1c438b[_0x50bb('0x2f')],qs[_0x50bb('0x35')](_0x473a4c[_0x50bb('0x30')][_0x50bb('0x35')]));_0x40748d[_0x50bb('0x34')]=_0x40748d[_0x50bb('0x34')][_0x50bb('0x36')]?_0x40748d[_0x50bb('0x34')]:_0x1c438b[_0x50bb('0x2f')];if(_0x473a4c[_0x50bb('0x30')][_0x50bb('0x44')]){_0x40748d[_0x50bb('0x45')]=[{'all':!![]}];}_0x40748d=_[_0x50bb('0x3c')]({},_0x40748d,_0x473a4c[_0x50bb('0x3f')]);return db['FreshdeskField'][_0x50bb('0x46')](_0x40748d)['then'](handleEntityNotFound(_0x379944,null))[_0x50bb('0x24')](respondWithResult(_0x379944,null))[_0x50bb('0x47')](handleError(_0x379944,null));};exports[_0x50bb('0x48')]=function(_0x35b440,_0x650e91){return db[_0x50bb('0x2b')][_0x50bb('0x48')](_0x35b440[_0x50bb('0x49')],{})['then'](respondWithResult(_0x650e91,0xc9))[_0x50bb('0x47')](handleError(_0x650e91,null));};exports[_0x50bb('0x4a')]=function(_0xf52a22,_0x13afe2){if(_0xf52a22[_0x50bb('0x49')]['id']){delete _0xf52a22['body']['id'];}return db[_0x50bb('0x2b')][_0x50bb('0x46')]({'where':{'id':_0xf52a22[_0x50bb('0x42')]['id']}})[_0x50bb('0x24')](handleEntityNotFound(_0x13afe2,null))[_0x50bb('0x24')](saveUpdates(_0xf52a22['body'],null))['then'](respondWithResult(_0x13afe2,null))[_0x50bb('0x47')](handleError(_0x13afe2,null));};exports['destroy']=function(_0x357d08,_0x57ee0e){return db[_0x50bb('0x2b')][_0x50bb('0x46')]({'where':{'id':_0x357d08[_0x50bb('0x42')]['id']}})['then'](handleEntityNotFound(_0x57ee0e,null))[_0x50bb('0x24')](removeEntity(_0x57ee0e,null))[_0x50bb('0x47')](handleError(_0x57ee0e,null));}; \ No newline at end of file +var _0x2547=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','FreshdeskField','includeAll','include','rows','catch','params','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','type','key','model','query','keys'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x2547,0x1cd));var _0x7254=function(_0x4efe8b,_0x4d7049){_0x4efe8b=_0x4efe8b-0x0;var _0x134a1f=_0x2547[_0x4efe8b];return _0x134a1f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7254('0x0'));var zipdir=require(_0x7254('0x1'));var jsonpatch=require(_0x7254('0x2'));var rp=require(_0x7254('0x3'));var moment=require(_0x7254('0x4'));var BPromise=require(_0x7254('0x5'));var Mustache=require(_0x7254('0x6'));var util=require(_0x7254('0x7'));var path=require('path');var sox=require(_0x7254('0x8'));var csv=require(_0x7254('0x9'));var ejs=require(_0x7254('0xa'));var fs=require('fs');var fs_extra=require(_0x7254('0xb'));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('0x9'));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 licenseUtil=require('../../config/license/util');var db=require(_0x7254('0x16'))['db'];function respondWithStatusCode(_0x53fc4f,_0x16c08e){_0x16c08e=_0x16c08e||0xcc;return function(_0x2bfff8){if(_0x2bfff8){return _0x53fc4f[_0x7254('0x17')](_0x16c08e);}return _0x53fc4f[_0x7254('0x18')](_0x16c08e)[_0x7254('0x19')]();};}function respondWithResult(_0x395a8a,_0x124192){_0x124192=_0x124192||0xc8;return function(_0x21cecc){if(_0x21cecc){return _0x395a8a[_0x7254('0x18')](_0x124192)[_0x7254('0x1a')](_0x21cecc);}};}function respondWithFilteredResult(_0x38a99c,_0x1ee5cb){return function(_0x163c8c){if(_0x163c8c){var _0x535065=typeof _0x1ee5cb[_0x7254('0x1b')]===_0x7254('0x1c')&&typeof _0x1ee5cb[_0x7254('0x1d')]===_0x7254('0x1c');var _0x3b5f06=_0x163c8c[_0x7254('0x1e')];var _0x2737e0=_0x535065?0x0:_0x1ee5cb['offset'];var _0x1f48f6=_0x535065?_0x163c8c[_0x7254('0x1e')]:_0x1ee5cb[_0x7254('0x1b')]+_0x1ee5cb[_0x7254('0x1d')];var _0x2a1ddc;if(_0x1f48f6>=_0x3b5f06){_0x1f48f6=_0x3b5f06;_0x2a1ddc=0xc8;}else{_0x2a1ddc=0xce;}_0x38a99c[_0x7254('0x18')](_0x2a1ddc);return _0x38a99c[_0x7254('0x1f')](_0x7254('0x20'),_0x2737e0+'-'+_0x1f48f6+'/'+_0x3b5f06)[_0x7254('0x1a')](_0x163c8c);}return null;};}function patchUpdates(_0x3b6cb6){return function(_0x2594b8){try{jsonpatch[_0x7254('0x21')](_0x2594b8,_0x3b6cb6,!![]);}catch(_0xc617b6){return BPromise[_0x7254('0x22')](_0xc617b6);}return _0x2594b8[_0x7254('0x23')]();};}function saveUpdates(_0x95ceaa,_0x2bb2fe){return function(_0x46c0a2){if(_0x46c0a2){return _0x46c0a2[_0x7254('0x24')](_0x95ceaa)[_0x7254('0x25')](function(_0x1be69b){return _0x1be69b;});}return null;};}function removeEntity(_0x50c34b,_0x493bfd){return function(_0x136ea3){if(_0x136ea3){return _0x136ea3[_0x7254('0x26')]()[_0x7254('0x25')](function(){_0x50c34b[_0x7254('0x18')](0xcc)[_0x7254('0x19')]();});}};}function handleEntityNotFound(_0x36b5d5,_0x133aee){return function(_0x5d6df5){if(!_0x5d6df5){_0x36b5d5[_0x7254('0x17')](0x194);}return _0x5d6df5;};}function handleError(_0x21a579,_0x2b4f46){_0x2b4f46=_0x2b4f46||0x1f4;return function(_0x494cdb){logger[_0x7254('0x27')](_0x494cdb['stack']);if(_0x494cdb[_0x7254('0x28')]){delete _0x494cdb[_0x7254('0x28')];}_0x21a579['status'](_0x2b4f46)[_0x7254('0x29')](_0x494cdb);};}exports[_0x7254('0x2a')]=function(_0x4f684c,_0x14cbea){var _0x6c4927={},_0x37cb5c={},_0xb9198b={'count':0x0,'rows':[]};var _0x43bf02=_[_0x7254('0x2b')](db['FreshdeskField'][_0x7254('0x2c')],function(_0x2dba3f){return{'name':_0x2dba3f['fieldName'],'type':_0x2dba3f[_0x7254('0x2d')][_0x7254('0x2e')]};});_0x37cb5c[_0x7254('0x2f')]=_['map'](_0x43bf02,_0x7254('0x28'));_0x37cb5c[_0x7254('0x30')]=_[_0x7254('0x31')](_0x4f684c[_0x7254('0x30')]);_0x37cb5c[_0x7254('0x32')]=_[_0x7254('0x33')](_0x37cb5c[_0x7254('0x2f')],_0x37cb5c['query']);_0x6c4927[_0x7254('0x34')]=_['intersection'](_0x37cb5c['model'],qs[_0x7254('0x35')](_0x4f684c[_0x7254('0x30')][_0x7254('0x35')]));_0x6c4927[_0x7254('0x34')]=_0x6c4927[_0x7254('0x34')][_0x7254('0x36')]?_0x6c4927[_0x7254('0x34')]:_0x37cb5c[_0x7254('0x2f')];if(!_0x4f684c[_0x7254('0x30')][_0x7254('0x37')](_0x7254('0x38'))){_0x6c4927[_0x7254('0x1d')]=qs[_0x7254('0x1d')](_0x4f684c[_0x7254('0x30')]['limit']);_0x6c4927[_0x7254('0x1b')]=qs[_0x7254('0x1b')](_0x4f684c[_0x7254('0x30')][_0x7254('0x1b')]);}_0x6c4927[_0x7254('0x39')]=qs['sort'](_0x4f684c[_0x7254('0x30')]['sort']);_0x6c4927[_0x7254('0x3a')]=qs[_0x7254('0x32')](_[_0x7254('0x3b')](_0x4f684c[_0x7254('0x30')],_0x37cb5c[_0x7254('0x32')]),_0x43bf02);if(_0x4f684c['query'][_0x7254('0x3c')]){_0x6c4927['where']=_[_0x7254('0x3d')](_0x6c4927[_0x7254('0x3a')],{'$or':_['map'](_0x43bf02,function(_0x1485a0){if(_0x1485a0[_0x7254('0x2d')]!==_0x7254('0x3e')){var _0x9273ee={};_0x9273ee[_0x1485a0[_0x7254('0x28')]]={'$like':'%'+_0x4f684c[_0x7254('0x30')]['filter']+'%'};return _0x9273ee;}})});}_0x6c4927=_[_0x7254('0x3d')]({},_0x6c4927,_0x4f684c[_0x7254('0x3f')]);var _0x105b8c={'where':_0x6c4927['where']};return db[_0x7254('0x40')][_0x7254('0x1e')](_0x105b8c)[_0x7254('0x25')](function(_0x4824d5){_0xb9198b[_0x7254('0x1e')]=_0x4824d5;if(_0x4f684c[_0x7254('0x30')][_0x7254('0x41')]){_0x6c4927[_0x7254('0x42')]=[{'all':!![]}];}return db[_0x7254('0x40')]['findAll'](_0x6c4927);})['then'](function(_0x25004f){_0xb9198b[_0x7254('0x43')]=_0x25004f;return _0xb9198b;})[_0x7254('0x25')](respondWithFilteredResult(_0x14cbea,_0x6c4927))[_0x7254('0x44')](handleError(_0x14cbea,null));};exports['show']=function(_0x53a7a7,_0x29821a){var _0x565cd8={'raw':!![],'where':{'id':_0x53a7a7[_0x7254('0x45')]['id']}},_0x2ae22e={};_0x2ae22e[_0x7254('0x2f')]=_[_0x7254('0x31')](db['FreshdeskField']['rawAttributes']);_0x2ae22e[_0x7254('0x30')]=_[_0x7254('0x31')](_0x53a7a7[_0x7254('0x30')]);_0x2ae22e[_0x7254('0x32')]=_[_0x7254('0x33')](_0x2ae22e['model'],_0x2ae22e['query']);_0x565cd8[_0x7254('0x34')]=_[_0x7254('0x33')](_0x2ae22e[_0x7254('0x2f')],qs['fields'](_0x53a7a7[_0x7254('0x30')][_0x7254('0x35')]));_0x565cd8['attributes']=_0x565cd8[_0x7254('0x34')][_0x7254('0x36')]?_0x565cd8[_0x7254('0x34')]:_0x2ae22e[_0x7254('0x2f')];if(_0x53a7a7['query'][_0x7254('0x41')]){_0x565cd8[_0x7254('0x42')]=[{'all':!![]}];}_0x565cd8=_['merge']({},_0x565cd8,_0x53a7a7[_0x7254('0x3f')]);return db[_0x7254('0x40')][_0x7254('0x46')](_0x565cd8)['then'](handleEntityNotFound(_0x29821a,null))[_0x7254('0x25')](respondWithResult(_0x29821a,null))[_0x7254('0x44')](handleError(_0x29821a,null));};exports['create']=function(_0x5f101e,_0x10b32f){return db['FreshdeskField'][_0x7254('0x47')](_0x5f101e[_0x7254('0x48')],{})['then'](respondWithResult(_0x10b32f,0xc9))['catch'](handleError(_0x10b32f,null));};exports[_0x7254('0x24')]=function(_0xc40bc5,_0x38bcd5){if(_0xc40bc5[_0x7254('0x48')]['id']){delete _0xc40bc5[_0x7254('0x48')]['id'];}return db[_0x7254('0x40')]['find']({'where':{'id':_0xc40bc5[_0x7254('0x45')]['id']}})['then'](handleEntityNotFound(_0x38bcd5,null))[_0x7254('0x25')](saveUpdates(_0xc40bc5[_0x7254('0x48')],null))[_0x7254('0x25')](respondWithResult(_0x38bcd5,null))['catch'](handleError(_0x38bcd5,null));};exports[_0x7254('0x26')]=function(_0x1c1a0e,_0x252758){return db['FreshdeskField'][_0x7254('0x46')]({'where':{'id':_0x1c1a0e[_0x7254('0x45')]['id']}})[_0x7254('0x25')](handleEntityNotFound(_0x252758,null))[_0x7254('0x25')](removeEntity(_0x252758,null))[_0x7254('0x44')](handleError(_0x252758,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index e9cfc7c..b4a29ba 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 _0x3066=['idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x3066,0x156));var _0x6306=function(_0x51b73e,_0xbb995e){_0x51b73e=_0x51b73e-0x0;var _0x105c5d=_0x3066[_0x51b73e];return _0x105c5d;};'use strict';var _=require(_0x6306('0x0'));var util=require(_0x6306('0x1'));var logger=require(_0x6306('0x2'))(_0x6306('0x3'));var moment=require(_0x6306('0x4'));var BPromise=require(_0x6306('0x5'));var rp=require(_0x6306('0x6'));var fs=require('fs');var path=require(_0x6306('0x7'));var rimraf=require(_0x6306('0x8'));var config=require(_0x6306('0x9'));var attributes=require(_0x6306('0xa'));module[_0x6306('0xb')]=function(_0x455380,_0x30863d){return _0x455380[_0x6306('0xc')](_0x6306('0xd'),attributes,{'tableName':_0x6306('0xe'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0x6306('0xf'),_0x6306('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf681=['int_freshdesk_fields','freshdesk_unique_index','idField','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports'];(function(_0x265378,_0x17e3af){var _0x11fadc=function(_0xdaaaf3){while(--_0xdaaaf3){_0x265378['push'](_0x265378['shift']());}};_0x11fadc(++_0x17e3af);}(_0xf681,0xc9));var _0x1f68=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xf681[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x1f68('0x0'));var logger=require(_0x1f68('0x1'))(_0x1f68('0x2'));var moment=require(_0x1f68('0x3'));var BPromise=require('bluebird');var rp=require(_0x1f68('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1f68('0x5'));var config=require(_0x1f68('0x6'));var attributes=require('./intFreshdeskField.attributes');module[_0x1f68('0x7')]=function(_0x3e76ae,_0x5c1d65){return _0x3e76ae['define']('FreshdeskField',attributes,{'tableName':_0x1f68('0x8'),'paranoid':![],'indexes':[{'name':_0x1f68('0x9'),'fields':[_0x1f68('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 6d90dbb..e51fec8 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 _0xb769=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskField,\x20%s,\x20%s','message','result','catch','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb769,0x149));var _0x9b76=function(_0x1c4840,_0x4a7dd2){_0x1c4840=_0x1c4840-0x0;var _0x2dfba7=_0xb769[_0x1c4840];return _0x2dfba7;};'use strict';var _=require('lodash');var util=require(_0x9b76('0x0'));var moment=require('moment');var BPromise=require(_0x9b76('0x1'));var rs=require(_0x9b76('0x2'));var fs=require('fs');var Redis=require(_0x9b76('0x3'));var db=require(_0x9b76('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9b76('0x5'))(_0x9b76('0x6'));var config=require(_0x9b76('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9b76('0x8')][_0x9b76('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3f7507,_0x5419aa,_0xf5a02b){return new BPromise(function(_0xb91967,_0x328587){return client['request'](_0x3f7507,_0xf5a02b)[_0x9b76('0xa')](function(_0x5c40f2){logger[_0x9b76('0xb')]('FreshdeskField,\x20%s,\x20%s',_0x5419aa,_0x9b76('0xc'));logger[_0x9b76('0xd')](_0x9b76('0xe'),_0x5419aa,'request\x20sent',JSON[_0x9b76('0xf')](_0x5c40f2));if(_0x5c40f2[_0x9b76('0x10')]){if(_0x5c40f2['error'][_0x9b76('0x11')]===0x1f4){logger[_0x9b76('0x10')](_0x9b76('0x12'),_0x5419aa,_0x5c40f2['error'][_0x9b76('0x13')]);return _0x328587(_0x5c40f2[_0x9b76('0x10')]['message']);}logger['error'](_0x9b76('0x12'),_0x5419aa,_0x5c40f2[_0x9b76('0x10')]['message']);return _0xb91967(_0x5c40f2[_0x9b76('0x10')][_0x9b76('0x13')]);}else{logger[_0x9b76('0xb')]('FreshdeskField,\x20%s,\x20%s',_0x5419aa,_0x9b76('0xc'));_0xb91967(_0x5c40f2[_0x9b76('0x14')][_0x9b76('0x13')]);}})[_0x9b76('0x15')](function(_0x5f0b30){logger['error'](_0x9b76('0x12'),_0x5419aa,_0x5f0b30);_0x328587(_0x5f0b30);});});} \ No newline at end of file +var _0x587f=['code','message','request\x20sent','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','info','FreshdeskField,\x20%s,\x20%s','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0x587f,0x76));var _0xf587=function(_0x1f239e,_0x367b43){_0x1f239e=_0x1f239e-0x0;var _0x826971=_0x587f[_0x1f239e];return _0x826971;};'use strict';var _=require('lodash');var util=require(_0xf587('0x0'));var moment=require(_0xf587('0x1'));var BPromise=require('bluebird');var rs=require(_0xf587('0x2'));var fs=require('fs');var Redis=require(_0xf587('0x3'));var db=require(_0xf587('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf587('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf587('0x6'));var client=jayson[_0xf587('0x7')][_0xf587('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x54844e,_0x3fa96b,_0x26d0e9){return new BPromise(function(_0x40fc13,_0x519930){return client['request'](_0x54844e,_0x26d0e9)['then'](function(_0x5e9b80){logger[_0xf587('0x9')](_0xf587('0xa'),_0x3fa96b,'request\x20sent');logger[_0xf587('0xb')](_0xf587('0xc'),_0x3fa96b,'request\x20sent',JSON[_0xf587('0xd')](_0x5e9b80));if(_0x5e9b80[_0xf587('0xe')]){if(_0x5e9b80[_0xf587('0xe')][_0xf587('0xf')]===0x1f4){logger['error'](_0xf587('0xa'),_0x3fa96b,_0x5e9b80[_0xf587('0xe')][_0xf587('0x10')]);return _0x519930(_0x5e9b80[_0xf587('0xe')][_0xf587('0x10')]);}logger['error'](_0xf587('0xa'),_0x3fa96b,_0x5e9b80[_0xf587('0xe')][_0xf587('0x10')]);return _0x40fc13(_0x5e9b80['error']['message']);}else{logger[_0xf587('0x9')](_0xf587('0xa'),_0x3fa96b,_0xf587('0x11'));_0x40fc13(_0x5e9b80[_0xf587('0x12')][_0xf587('0x10')]);}})['catch'](function(_0x49c846){logger[_0xf587('0xe')](_0xf587('0xa'),_0x3fa96b,_0x49c846);_0x519930(_0x49c846);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index b8e09b0..165bd4f 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 _0xaa88=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','index','/:id','isAuthenticated','show','get','getConfigurations','getFields','post','/:id/configurations','addConfiguration','put','update','delete','destroy','multer'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xaa88,0x137));var _0x8aa8=function(_0x585d81,_0xf6d74f){_0x585d81=_0x585d81-0x0;var _0x1aca0d=_0xaa88[_0x585d81];return _0x1aca0d;};'use strict';var multer=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var path=require(_0x8aa8('0x2'));var timeout=require(_0x8aa8('0x3'));var express=require('express');var router=express[_0x8aa8('0x4')]();var fs_extra=require(_0x8aa8('0x5'));var auth=require(_0x8aa8('0x6'));var interaction=require(_0x8aa8('0x7'));var config=require(_0x8aa8('0x8'));var controller=require(_0x8aa8('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x8aa8('0xa')]);router['get'](_0x8aa8('0xb'),auth[_0x8aa8('0xc')](),controller[_0x8aa8('0xd')]);router[_0x8aa8('0xe')]('/:id/configurations',auth[_0x8aa8('0xc')](),controller[_0x8aa8('0xf')]);router[_0x8aa8('0xe')]('/:id/fields',auth[_0x8aa8('0xc')](),controller[_0x8aa8('0x10')]);router[_0x8aa8('0x11')]('/',auth[_0x8aa8('0xc')](),controller['create']);router[_0x8aa8('0x11')](_0x8aa8('0x12'),auth['isAuthenticated'](),controller[_0x8aa8('0x13')]);router[_0x8aa8('0x14')](_0x8aa8('0xb'),auth['isAuthenticated'](),controller[_0x8aa8('0x15')]);router[_0x8aa8('0x16')](_0x8aa8('0xb'),auth['isAuthenticated'](),controller[_0x8aa8('0x17')]);module['exports']=router; \ No newline at end of file +var _0xea28=['index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','create','post','addConfiguration','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesAccount.controller','get'];(function(_0x46b638,_0x276b17){var _0x36dcc4=function(_0x52ead6){while(--_0x52ead6){_0x46b638['push'](_0x46b638['shift']());}};_0x36dcc4(++_0x276b17);}(_0xea28,0x13a));var _0x8ea2=function(_0x39c731,_0x2e08a1){_0x39c731=_0x39c731-0x0;var _0x6bd8ae=_0xea28[_0x39c731];return _0x6bd8ae;};'use strict';var multer=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var path=require(_0x8ea2('0x2'));var timeout=require(_0x8ea2('0x3'));var express=require(_0x8ea2('0x4'));var router=express[_0x8ea2('0x5')]();var fs_extra=require(_0x8ea2('0x6'));var auth=require(_0x8ea2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8ea2('0x8'));var controller=require(_0x8ea2('0x9'));router[_0x8ea2('0xa')]('/',auth['isAuthenticated'](),controller[_0x8ea2('0xb')]);router[_0x8ea2('0xa')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0xe')]);router[_0x8ea2('0xa')](_0x8ea2('0xf'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x10')]);router[_0x8ea2('0xa')](_0x8ea2('0x11'),auth[_0x8ea2('0xd')](),controller['getFields']);router['post']('/',auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x12')]);router[_0x8ea2('0x13')]('/:id/configurations',auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x14')]);router[_0x8ea2('0x15')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller['update']);router[_0x8ea2('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x8ea2('0x17')]);module[_0x8ea2('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 6cf0629..2bf8305 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 _0x6d38=['exports','STRING','remoteUri'];(function(_0x77d286,_0x1ddc6d){var _0x5446a5=function(_0x45e2cf){while(--_0x45e2cf){_0x77d286['push'](_0x77d286['shift']());}};_0x5446a5(++_0x1ddc6d);}(_0x6d38,0x1ef));var _0x86d3=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x6d38[_0x31e29a];return _0x32d892;};'use strict';var Sequelize=require('sequelize');module[_0x86d3('0x0')]={'name':{'type':Sequelize[_0x86d3('0x1')]},'description':{'type':Sequelize[_0x86d3('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'apiKey':{'type':Sequelize[_0x86d3('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x86d3('0x2')},'serverUrl':{'type':Sequelize[_0x86d3('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x77e6=['STRING','username','sequelize','exports'];(function(_0x644ecd,_0x397f36){var _0x1c66ce=function(_0x4cf42b){while(--_0x4cf42b){_0x644ecd['push'](_0x644ecd['shift']());}};_0x1c66ce(++_0x397f36);}(_0x77e6,0x1a6));var _0x677e=function(_0xdc25b5,_0x1a6833){_0xdc25b5=_0xdc25b5-0x0;var _0x5e6a55=_0x77e6[_0xdc25b5];return _0x5e6a55;};'use strict';var Sequelize=require(_0x677e('0x0'));module[_0x677e('0x1')]={'name':{'type':Sequelize[_0x677e('0x2')]},'description':{'type':Sequelize[_0x677e('0x2')]},'username':{'type':Sequelize[_0x677e('0x2')],'unique':_0x677e('0x3')},'apiKey':{'type':Sequelize[_0x677e('0x2')]},'remoteUri':{'type':Sequelize[_0x677e('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x677e('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 8e75dd4..256bd69 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 _0xba92=['error','stack','name','send','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','FreshsalesAccount','include','findAll','rows','show','params','find','catch','create','body','getConfigurations','findOne','FreshsalesConfiguration','rawAttributes','order','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then'];(function(_0x5abac8,_0x4a022f){var _0x256ba6=function(_0x5eb055){while(--_0x5eb055){_0x5abac8['push'](_0x5abac8['shift']());}};_0x256ba6(++_0x4a022f);}(_0xba92,0x17d));var _0x2ba9=function(_0x33f32e,_0x11b9b3){_0x33f32e=_0x33f32e-0x0;var _0x10c488=_0xba92[_0x33f32e];return _0x10c488;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2ba9('0x0'));var zipdir=require(_0x2ba9('0x1'));var jsonpatch=require(_0x2ba9('0x2'));var rp=require(_0x2ba9('0x3'));var moment=require(_0x2ba9('0x4'));var BPromise=require(_0x2ba9('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2ba9('0x6'));var sox=require(_0x2ba9('0x7'));var csv=require(_0x2ba9('0x8'));var ejs=require(_0x2ba9('0x9'));var fs=require('fs');var fs_extra=require(_0x2ba9('0xa'));var _=require(_0x2ba9('0xb'));var squel=require(_0x2ba9('0xc'));var crypto=require(_0x2ba9('0xd'));var jsforce=require(_0x2ba9('0xe'));var deskjs=require(_0x2ba9('0xf'));var toCsv=require(_0x2ba9('0x8'));var querystring=require('querystring');var Papa=require(_0x2ba9('0x10'));var Redis=require(_0x2ba9('0x11'));var authService=require(_0x2ba9('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2ba9('0x13'));var hardwareService=require(_0x2ba9('0x14'));var logger=require(_0x2ba9('0x15'))(_0x2ba9('0x16'));var utils=require(_0x2ba9('0x17'));var config=require(_0x2ba9('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x2ba9('0x19'));function respondWithStatusCode(_0x542d0e,_0x36a30d){_0x36a30d=_0x36a30d||0xcc;return function(_0x5ae950){if(_0x5ae950){return _0x542d0e[_0x2ba9('0x1a')](_0x36a30d);}return _0x542d0e[_0x2ba9('0x1b')](_0x36a30d)[_0x2ba9('0x1c')]();};}function respondWithResult(_0x4acf61,_0x16c041){_0x16c041=_0x16c041||0xc8;return function(_0x5cb836){if(_0x5cb836){return _0x4acf61[_0x2ba9('0x1b')](_0x16c041)[_0x2ba9('0x1d')](_0x5cb836);}};}function respondWithFilteredResult(_0x195c4b,_0x3ea1a1){return function(_0x56e9c0){if(_0x56e9c0){var _0xd1c65e=typeof _0x3ea1a1[_0x2ba9('0x1e')]===_0x2ba9('0x1f')&&typeof _0x3ea1a1[_0x2ba9('0x20')]===_0x2ba9('0x1f');var _0x390745=_0x56e9c0['count'];var _0x1e2acd=_0xd1c65e?0x0:_0x3ea1a1[_0x2ba9('0x1e')];var _0x3f2a12=_0xd1c65e?_0x56e9c0[_0x2ba9('0x21')]:_0x3ea1a1[_0x2ba9('0x1e')]+_0x3ea1a1['limit'];var _0x2846da;if(_0x3f2a12>=_0x390745){_0x3f2a12=_0x390745;_0x2846da=0xc8;}else{_0x2846da=0xce;}_0x195c4b[_0x2ba9('0x1b')](_0x2846da);return _0x195c4b['set'](_0x2ba9('0x22'),_0x1e2acd+'-'+_0x3f2a12+'/'+_0x390745)[_0x2ba9('0x1d')](_0x56e9c0);}return null;};}function patchUpdates(_0x59a7d6){return function(_0x22dd6a){try{jsonpatch['apply'](_0x22dd6a,_0x59a7d6,!![]);}catch(_0x485565){return BPromise[_0x2ba9('0x23')](_0x485565);}return _0x22dd6a[_0x2ba9('0x24')]();};}function saveUpdates(_0x3bf485,_0x306111){return function(_0x209c42){if(_0x209c42){return _0x209c42[_0x2ba9('0x25')](_0x3bf485)[_0x2ba9('0x26')](function(_0x5e3c11){return _0x5e3c11;});}return null;};}function removeEntity(_0x40072f,_0x13351d){return function(_0x42c361){if(_0x42c361){return _0x42c361['destroy']()[_0x2ba9('0x26')](function(){_0x40072f['status'](0xcc)[_0x2ba9('0x1c')]();});}};}function handleEntityNotFound(_0x1f3b9b,_0x4729d9){return function(_0x369a27){if(!_0x369a27){_0x1f3b9b[_0x2ba9('0x1a')](0x194);}return _0x369a27;};}function handleError(_0x45fd9f,_0x3e9eda){_0x3e9eda=_0x3e9eda||0x1f4;return function(_0x2de8d4){logger[_0x2ba9('0x27')](_0x2de8d4[_0x2ba9('0x28')]);if(_0x2de8d4[_0x2ba9('0x29')]){delete _0x2de8d4[_0x2ba9('0x29')];}_0x45fd9f['status'](_0x3e9eda)[_0x2ba9('0x2a')](_0x2de8d4);};}exports['index']=function(_0xef28e6,_0x1c22db){var _0x1e568f={},_0x404be2={},_0x3eb80e={'count':0x0,'rows':[]};var _0x2c1e1b=_[_0x2ba9('0x2b')](db['FreshsalesAccount']['rawAttributes'],function(_0x410d62){return{'name':_0x410d62[_0x2ba9('0x2c')],'type':_0x410d62[_0x2ba9('0x2d')][_0x2ba9('0x2e')]};});_0x404be2[_0x2ba9('0x2f')]=_[_0x2ba9('0x2b')](_0x2c1e1b,'name');_0x404be2[_0x2ba9('0x30')]=_[_0x2ba9('0x31')](_0xef28e6[_0x2ba9('0x30')]);_0x404be2[_0x2ba9('0x32')]=_[_0x2ba9('0x33')](_0x404be2[_0x2ba9('0x2f')],_0x404be2[_0x2ba9('0x30')]);_0x1e568f[_0x2ba9('0x34')]=_[_0x2ba9('0x33')](_0x404be2[_0x2ba9('0x2f')],qs[_0x2ba9('0x35')](_0xef28e6[_0x2ba9('0x30')][_0x2ba9('0x35')]));_0x1e568f[_0x2ba9('0x34')]=_0x1e568f[_0x2ba9('0x34')][_0x2ba9('0x36')]?_0x1e568f[_0x2ba9('0x34')]:_0x404be2[_0x2ba9('0x2f')];if(!_0xef28e6[_0x2ba9('0x30')][_0x2ba9('0x37')](_0x2ba9('0x38'))){_0x1e568f[_0x2ba9('0x20')]=qs[_0x2ba9('0x20')](_0xef28e6[_0x2ba9('0x30')]['limit']);_0x1e568f[_0x2ba9('0x1e')]=qs[_0x2ba9('0x1e')](_0xef28e6[_0x2ba9('0x30')]['offset']);}_0x1e568f['order']=qs[_0x2ba9('0x39')](_0xef28e6[_0x2ba9('0x30')]['sort']);_0x1e568f[_0x2ba9('0x3a')]=qs['filters'](_[_0x2ba9('0x3b')](_0xef28e6[_0x2ba9('0x30')],_0x404be2[_0x2ba9('0x32')]),_0x2c1e1b);if(_0xef28e6['query'][_0x2ba9('0x3c')]){_0x1e568f[_0x2ba9('0x3a')]=_[_0x2ba9('0x3d')](_0x1e568f['where'],{'$or':_['map'](_0x2c1e1b,function(_0x1cca47){if(_0x1cca47[_0x2ba9('0x2d')]!==_0x2ba9('0x3e')){var _0x4a5dfa={};_0x4a5dfa[_0x1cca47[_0x2ba9('0x29')]]={'$like':'%'+_0xef28e6[_0x2ba9('0x30')][_0x2ba9('0x3c')]+'%'};return _0x4a5dfa;}})});}_0x1e568f=_[_0x2ba9('0x3d')]({},_0x1e568f,_0xef28e6[_0x2ba9('0x3f')]);var _0x31e97e={'where':_0x1e568f[_0x2ba9('0x3a')]};return db[_0x2ba9('0x40')][_0x2ba9('0x21')](_0x31e97e)[_0x2ba9('0x26')](function(_0x3834c8){_0x3eb80e['count']=_0x3834c8;if(_0xef28e6[_0x2ba9('0x30')]['includeAll']){_0x1e568f[_0x2ba9('0x41')]=[{'all':!![]}];}return db[_0x2ba9('0x40')][_0x2ba9('0x42')](_0x1e568f);})[_0x2ba9('0x26')](function(_0x33bc2f){_0x3eb80e[_0x2ba9('0x43')]=_0x33bc2f;return _0x3eb80e;})[_0x2ba9('0x26')](respondWithFilteredResult(_0x1c22db,_0x1e568f))['catch'](handleError(_0x1c22db,null));};exports[_0x2ba9('0x44')]=function(_0xd31287,_0x38270a){var _0x7df915={'raw':![],'where':{'id':_0xd31287[_0x2ba9('0x45')]['id']}},_0x45cb17={};_0x45cb17[_0x2ba9('0x2f')]=_['keys'](db[_0x2ba9('0x40')]['rawAttributes']);_0x45cb17['query']=_[_0x2ba9('0x31')](_0xd31287[_0x2ba9('0x30')]);_0x45cb17['filters']=_[_0x2ba9('0x33')](_0x45cb17[_0x2ba9('0x2f')],_0x45cb17[_0x2ba9('0x30')]);_0x7df915[_0x2ba9('0x34')]=_['intersection'](_0x45cb17[_0x2ba9('0x2f')],qs[_0x2ba9('0x35')](_0xd31287['query']['fields']));_0x7df915[_0x2ba9('0x34')]=_0x7df915[_0x2ba9('0x34')][_0x2ba9('0x36')]?_0x7df915['attributes']:_0x45cb17[_0x2ba9('0x2f')];if(_0xd31287['query']['includeAll']){_0x7df915['include']=[{'all':!![]}];}_0x7df915=_[_0x2ba9('0x3d')]({},_0x7df915,_0xd31287[_0x2ba9('0x3f')]);return db[_0x2ba9('0x40')][_0x2ba9('0x46')](_0x7df915)[_0x2ba9('0x26')](handleEntityNotFound(_0x38270a,null))[_0x2ba9('0x26')](respondWithResult(_0x38270a,null))[_0x2ba9('0x47')](handleError(_0x38270a,null));};exports['create']=function(_0x1247a5,_0x29dea9){return db[_0x2ba9('0x40')][_0x2ba9('0x48')](_0x1247a5[_0x2ba9('0x49')],{})['then'](respondWithResult(_0x29dea9,0xc9))[_0x2ba9('0x47')](handleError(_0x29dea9,null));};exports[_0x2ba9('0x25')]=function(_0x3c7256,_0x5682dc){if(_0x3c7256['body']['id']){delete _0x3c7256[_0x2ba9('0x49')]['id'];}return db[_0x2ba9('0x40')]['find']({'where':{'id':_0x3c7256[_0x2ba9('0x45')]['id']}})[_0x2ba9('0x26')](handleEntityNotFound(_0x5682dc,null))[_0x2ba9('0x26')](saveUpdates(_0x3c7256[_0x2ba9('0x49')],null))[_0x2ba9('0x26')](respondWithResult(_0x5682dc,null))[_0x2ba9('0x47')](handleError(_0x5682dc,null));};exports['destroy']=function(_0x3b98df,_0xbb1618){return db['FreshsalesAccount'][_0x2ba9('0x46')]({'where':{'id':_0x3b98df[_0x2ba9('0x45')]['id']}})[_0x2ba9('0x26')](handleEntityNotFound(_0xbb1618,null))[_0x2ba9('0x26')](removeEntity(_0xbb1618,null))[_0x2ba9('0x47')](handleError(_0xbb1618,null));};exports[_0x2ba9('0x4a')]=function(_0x3050c7,_0x56f4ab,_0x52d475){var _0x266a60={};var _0x3004b3={};var _0x37299f;var _0x565f1f;return db[_0x2ba9('0x40')][_0x2ba9('0x4b')]({'where':{'id':_0x3050c7[_0x2ba9('0x45')]['id']}})[_0x2ba9('0x26')](handleEntityNotFound(_0x56f4ab,null))[_0x2ba9('0x26')](function(_0x47570e){if(_0x47570e){_0x37299f=_0x47570e;_0x3004b3[_0x2ba9('0x2f')]=_[_0x2ba9('0x31')](db[_0x2ba9('0x4c')][_0x2ba9('0x4d')]);_0x3004b3['query']=_[_0x2ba9('0x31')](_0x3050c7[_0x2ba9('0x30')]);_0x3004b3[_0x2ba9('0x32')]=_[_0x2ba9('0x33')](_0x3004b3[_0x2ba9('0x2f')],_0x3004b3[_0x2ba9('0x30')]);_0x266a60[_0x2ba9('0x34')]=_[_0x2ba9('0x33')](_0x3004b3[_0x2ba9('0x2f')],qs[_0x2ba9('0x35')](_0x3050c7[_0x2ba9('0x30')][_0x2ba9('0x35')]));_0x266a60[_0x2ba9('0x34')]=_0x266a60[_0x2ba9('0x34')][_0x2ba9('0x36')]?_0x266a60[_0x2ba9('0x34')]:_0x3004b3[_0x2ba9('0x2f')];_0x266a60[_0x2ba9('0x4e')]=qs['sort'](_0x3050c7['query'][_0x2ba9('0x39')]);_0x266a60[_0x2ba9('0x3a')]=qs[_0x2ba9('0x32')](_['pick'](_0x3050c7['query'],_0x3004b3[_0x2ba9('0x32')]));if(_0x3050c7[_0x2ba9('0x30')][_0x2ba9('0x3c')]){_0x266a60[_0x2ba9('0x3a')]=_[_0x2ba9('0x3d')](_0x266a60[_0x2ba9('0x3a')],{'$or':_['map'](_0x266a60['attributes'],function(_0x5e7ef0){var _0x1ee413={};_0x1ee413[_0x5e7ef0]={'$like':'%'+_0x3050c7['query'][_0x2ba9('0x3c')]+'%'};return _0x1ee413;})});}_0x266a60=_[_0x2ba9('0x3d')]({},_0x266a60,_0x3050c7['options']);return _0x37299f[_0x2ba9('0x4a')](_0x266a60);}})['then'](function(_0x516745){if(_0x516745){_0x565f1f=_0x516745[_0x2ba9('0x36')];if(!_0x3050c7['query'][_0x2ba9('0x37')](_0x2ba9('0x38'))){_0x266a60['limit']=qs[_0x2ba9('0x20')](_0x3050c7[_0x2ba9('0x30')][_0x2ba9('0x20')]);_0x266a60[_0x2ba9('0x1e')]=qs[_0x2ba9('0x1e')](_0x3050c7[_0x2ba9('0x30')][_0x2ba9('0x1e')]);}return _0x37299f['getConfigurations'](_0x266a60);}})[_0x2ba9('0x26')](function(_0x501458){if(_0x501458){return _0x501458?{'count':_0x565f1f,'rows':_0x501458}:null;}})['then'](respondWithResult(_0x56f4ab,null))[_0x2ba9('0x47')](handleError(_0x56f4ab,null));};exports[_0x2ba9('0x4f')]=function(_0x2295cb,_0x923920,_0x259493){if(_0x2295cb[_0x2ba9('0x49')]['id']){delete _0x2295cb[_0x2ba9('0x49')]['id'];}return db['FreshsalesAccount']['findOne']({'where':{'id':_0x2295cb[_0x2ba9('0x45')]['id']}})[_0x2ba9('0x26')](handleEntityNotFound(_0x923920,null))[_0x2ba9('0x26')](function(_0x5ee124){if(_0x5ee124){_0x2295cb[_0x2ba9('0x49')]['AccountId']=_0x5ee124['id'];_0x2295cb['body'][_0x2ba9('0x50')]=integrations[_0x2ba9('0x51')](_0x2295cb[_0x2ba9('0x49')][_0x2ba9('0x52')],_0x2295cb[_0x2ba9('0x49')][_0x2ba9('0x2d')]);_0x2295cb[_0x2ba9('0x49')][_0x2ba9('0x53')]=integrations[_0x2ba9('0x54')](_0x2295cb[_0x2ba9('0x49')][_0x2ba9('0x52')],_0x2295cb[_0x2ba9('0x49')][_0x2ba9('0x2d')]);return db[_0x2ba9('0x4c')][_0x2ba9('0x48')](_0x2295cb[_0x2ba9('0x49')],{'include':[{'model':db[_0x2ba9('0x55')],'as':_0x2ba9('0x50')},{'model':db[_0x2ba9('0x55')],'as':_0x2ba9('0x53')}]});}return null;})['then'](respondWithResult(_0x923920,null))[_0x2ba9('0x47')](handleError(_0x923920,null));};exports[_0x2ba9('0x56')]=function(_0x15f595,_0x117021,_0x32cdf5){var _0x14b3dd='';var _0x1d1b17='';return db[_0x2ba9('0x40')][_0x2ba9('0x4b')]({'where':{'id':_0x15f595[_0x2ba9('0x45')]['id']},'attributes':['id',_0x2ba9('0x57'),_0x2ba9('0x58'),_0x2ba9('0x59')]})['then'](handleEntityNotFound(_0x117021,null))[_0x2ba9('0x26')](function(_0x4b0d1a){if(_0x4b0d1a){_0x1d1b17=_0x4b0d1a[_0x2ba9('0x57')];_0x14b3dd=_0x4b0d1a[_0x2ba9('0x58')];var _0x406ad0=_0x4b0d1a[_0x2ba9('0x58')][_0x2ba9('0x5a')](-0x1);if(_0x406ad0==='/'){_0x14b3dd=_0x14b3dd[_0x2ba9('0x5b')](0x0,_0x14b3dd[_0x2ba9('0x5c')](_0x406ad0));}return rp({'method':_0x2ba9('0x5d'),'uri':util[_0x2ba9('0x5e')]('%s%s',_0x14b3dd,_0x2ba9('0x5f')),'headers':{'Authorization':_0x2ba9('0x60')+_0x4b0d1a[_0x2ba9('0x59')]},'json':!![]});}})[_0x2ba9('0x26')](function(_0x48d568){if(_0x48d568){var _0x4b625e=_0x48d568[_0x2ba9('0x61')];var _0x5e980e=![];var _0x3aa32e=null;for(_0x3aa32e=0x0;_0x3aa32e<_0x4b625e[_0x2ba9('0x36')];_0x3aa32e++){if(_0x4b625e[_0x3aa32e][_0x2ba9('0x62')]===_0x1d1b17){_0x5e980e=!![];}}if(_0x5e980e){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x2ba9('0x63')});}}})[_0x2ba9('0x26')](respondWithResult(_0x117021,null))[_0x2ba9('0x47')](function(_0x1bde83){var _0x5cb4a9=_0x15f595[_0x2ba9('0x30')][_0x2ba9('0x64')]?0x1f4:_0x1bde83[_0x2ba9('0x65')]||0x1f4;logger[_0x2ba9('0x27')](_0x2ba9('0x66'),_0x2ba9('0x56'),_0x5cb4a9,JSON[_0x2ba9('0x67')](_0x1bde83));delete _0x1bde83[_0x2ba9('0x29')];if(_0x5cb4a9===0x191){_0x5cb4a9=0x190;}_0x117021['status'](_0x5cb4a9)[_0x2ba9('0x2a')](_0x15f595['query'][_0x2ba9('0x64')]?{'message':_0x2ba9('0x68'),'statusCode':_0x1bde83['statusCode']}:_0x1bde83);});}; \ No newline at end of file +var _0xca2a=['send','index','map','FreshsalesAccount','rawAttributes','fieldName','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','keys','find','body','getConfigurations','findOne','FreshsalesConfiguration','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','create','FreshsalesField','username','apiKey','remoteUri','slice','substring','lastIndexOf','GET','%s%s','/api/selector/owners','Token\x20token=','users','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','reject','save','update','then','destroy','end','error','name'];(function(_0x21f9c2,_0x2b3d2a){var _0x3da17f=function(_0x57e2b9){while(--_0x57e2b9){_0x21f9c2['push'](_0x21f9c2['shift']());}};_0x3da17f(++_0x2b3d2a);}(_0xca2a,0x173));var _0xaca2=function(_0xd0cac1,_0x3f2760){_0xd0cac1=_0xd0cac1-0x0;var _0x4e677b=_0xca2a[_0xd0cac1];return _0x4e677b;};'use strict';var emlformat=require(_0xaca2('0x0'));var rimraf=require(_0xaca2('0x1'));var zipdir=require(_0xaca2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaca2('0x3'));var moment=require(_0xaca2('0x4'));var BPromise=require(_0xaca2('0x5'));var Mustache=require(_0xaca2('0x6'));var util=require(_0xaca2('0x7'));var path=require(_0xaca2('0x8'));var sox=require(_0xaca2('0x9'));var csv=require(_0xaca2('0xa'));var ejs=require(_0xaca2('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaca2('0xc'));var squel=require('squel');var crypto=require(_0xaca2('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xaca2('0xe'));var toCsv=require(_0xaca2('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xaca2('0xf'));var authService=require(_0xaca2('0x10'));var qs=require(_0xaca2('0x11'));var as=require(_0xaca2('0x12'));var hardwareService=require(_0xaca2('0x13'));var logger=require(_0xaca2('0x14'))(_0xaca2('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xaca2('0x16'))['db'];var integrations=require(_0xaca2('0x17'));function respondWithStatusCode(_0x18480e,_0x11b45f){_0x11b45f=_0x11b45f||0xcc;return function(_0x445b3e){if(_0x445b3e){return _0x18480e[_0xaca2('0x18')](_0x11b45f);}return _0x18480e[_0xaca2('0x19')](_0x11b45f)['end']();};}function respondWithResult(_0xd75a2b,_0x3fa101){_0x3fa101=_0x3fa101||0xc8;return function(_0x5405af){if(_0x5405af){return _0xd75a2b['status'](_0x3fa101)['json'](_0x5405af);}};}function respondWithFilteredResult(_0x38b1dd,_0x5a5f64){return function(_0x5be319){if(_0x5be319){var _0x1e7126=typeof _0x5a5f64[_0xaca2('0x1a')]==='undefined'&&typeof _0x5a5f64[_0xaca2('0x1b')]===_0xaca2('0x1c');var _0x36f572=_0x5be319[_0xaca2('0x1d')];var _0xff5c55=_0x1e7126?0x0:_0x5a5f64['offset'];var _0x13862f=_0x1e7126?_0x5be319['count']:_0x5a5f64[_0xaca2('0x1a')]+_0x5a5f64[_0xaca2('0x1b')];var _0x31fa1e;if(_0x13862f>=_0x36f572){_0x13862f=_0x36f572;_0x31fa1e=0xc8;}else{_0x31fa1e=0xce;}_0x38b1dd[_0xaca2('0x19')](_0x31fa1e);return _0x38b1dd[_0xaca2('0x1e')](_0xaca2('0x1f'),_0xff5c55+'-'+_0x13862f+'/'+_0x36f572)[_0xaca2('0x20')](_0x5be319);}return null;};}function patchUpdates(_0x5f738c){return function(_0x1dda6f){try{jsonpatch['apply'](_0x1dda6f,_0x5f738c,!![]);}catch(_0x2545dd){return BPromise[_0xaca2('0x21')](_0x2545dd);}return _0x1dda6f[_0xaca2('0x22')]();};}function saveUpdates(_0x222035,_0x492d78){return function(_0x2211a4){if(_0x2211a4){return _0x2211a4[_0xaca2('0x23')](_0x222035)[_0xaca2('0x24')](function(_0x5dd8f8){return _0x5dd8f8;});}return null;};}function removeEntity(_0x2a71cd,_0x15477a){return function(_0x581660){if(_0x581660){return _0x581660[_0xaca2('0x25')]()[_0xaca2('0x24')](function(){_0x2a71cd[_0xaca2('0x19')](0xcc)[_0xaca2('0x26')]();});}};}function handleEntityNotFound(_0x1b1db8,_0x5d4823){return function(_0x1eedd2){if(!_0x1eedd2){_0x1b1db8['sendStatus'](0x194);}return _0x1eedd2;};}function handleError(_0x56ad78,_0x38ede5){_0x38ede5=_0x38ede5||0x1f4;return function(_0x201c64){logger[_0xaca2('0x27')](_0x201c64['stack']);if(_0x201c64[_0xaca2('0x28')]){delete _0x201c64[_0xaca2('0x28')];}_0x56ad78[_0xaca2('0x19')](_0x38ede5)[_0xaca2('0x29')](_0x201c64);};}exports[_0xaca2('0x2a')]=function(_0x3b3063,_0x16102d){var _0x4283f6={},_0x105540={},_0x49bb8e={'count':0x0,'rows':[]};var _0x39c749=_[_0xaca2('0x2b')](db[_0xaca2('0x2c')][_0xaca2('0x2d')],function(_0x275694){return{'name':_0x275694[_0xaca2('0x2e')],'type':_0x275694['type']['key']};});_0x105540[_0xaca2('0x2f')]=_['map'](_0x39c749,_0xaca2('0x28'));_0x105540[_0xaca2('0x30')]=_['keys'](_0x3b3063['query']);_0x105540[_0xaca2('0x31')]=_[_0xaca2('0x32')](_0x105540[_0xaca2('0x2f')],_0x105540[_0xaca2('0x30')]);_0x4283f6['attributes']=_[_0xaca2('0x32')](_0x105540[_0xaca2('0x2f')],qs[_0xaca2('0x33')](_0x3b3063['query'][_0xaca2('0x33')]));_0x4283f6[_0xaca2('0x34')]=_0x4283f6[_0xaca2('0x34')][_0xaca2('0x35')]?_0x4283f6[_0xaca2('0x34')]:_0x105540[_0xaca2('0x2f')];if(!_0x3b3063[_0xaca2('0x30')][_0xaca2('0x36')]('nolimit')){_0x4283f6['limit']=qs['limit'](_0x3b3063['query'][_0xaca2('0x1b')]);_0x4283f6[_0xaca2('0x1a')]=qs[_0xaca2('0x1a')](_0x3b3063[_0xaca2('0x30')][_0xaca2('0x1a')]);}_0x4283f6[_0xaca2('0x37')]=qs[_0xaca2('0x38')](_0x3b3063[_0xaca2('0x30')]['sort']);_0x4283f6['where']=qs[_0xaca2('0x31')](_[_0xaca2('0x39')](_0x3b3063['query'],_0x105540[_0xaca2('0x31')]),_0x39c749);if(_0x3b3063[_0xaca2('0x30')]['filter']){_0x4283f6[_0xaca2('0x3a')]=_[_0xaca2('0x3b')](_0x4283f6[_0xaca2('0x3a')],{'$or':_[_0xaca2('0x2b')](_0x39c749,function(_0x1ba03b){if(_0x1ba03b[_0xaca2('0x3c')]!==_0xaca2('0x3d')){var _0x15e390={};_0x15e390[_0x1ba03b[_0xaca2('0x28')]]={'$like':'%'+_0x3b3063['query'][_0xaca2('0x3e')]+'%'};return _0x15e390;}})});}_0x4283f6=_[_0xaca2('0x3b')]({},_0x4283f6,_0x3b3063[_0xaca2('0x3f')]);var _0x38996b={'where':_0x4283f6[_0xaca2('0x3a')]};return db[_0xaca2('0x2c')]['count'](_0x38996b)['then'](function(_0x19616a){_0x49bb8e['count']=_0x19616a;if(_0x3b3063[_0xaca2('0x30')][_0xaca2('0x40')]){_0x4283f6[_0xaca2('0x41')]=[{'all':!![]}];}return db[_0xaca2('0x2c')][_0xaca2('0x42')](_0x4283f6);})[_0xaca2('0x24')](function(_0x244a80){_0x49bb8e[_0xaca2('0x43')]=_0x244a80;return _0x49bb8e;})['then'](respondWithFilteredResult(_0x16102d,_0x4283f6))[_0xaca2('0x44')](handleError(_0x16102d,null));};exports['show']=function(_0x13ebdf,_0x1250a2){var _0x3fcd12={'raw':![],'where':{'id':_0x13ebdf[_0xaca2('0x45')]['id']}},_0x42e72e={};_0x42e72e[_0xaca2('0x2f')]=_[_0xaca2('0x46')](db[_0xaca2('0x2c')]['rawAttributes']);_0x42e72e[_0xaca2('0x30')]=_[_0xaca2('0x46')](_0x13ebdf[_0xaca2('0x30')]);_0x42e72e[_0xaca2('0x31')]=_[_0xaca2('0x32')](_0x42e72e['model'],_0x42e72e[_0xaca2('0x30')]);_0x3fcd12[_0xaca2('0x34')]=_['intersection'](_0x42e72e[_0xaca2('0x2f')],qs[_0xaca2('0x33')](_0x13ebdf['query'][_0xaca2('0x33')]));_0x3fcd12['attributes']=_0x3fcd12['attributes'][_0xaca2('0x35')]?_0x3fcd12[_0xaca2('0x34')]:_0x42e72e[_0xaca2('0x2f')];if(_0x13ebdf[_0xaca2('0x30')][_0xaca2('0x40')]){_0x3fcd12[_0xaca2('0x41')]=[{'all':!![]}];}_0x3fcd12=_[_0xaca2('0x3b')]({},_0x3fcd12,_0x13ebdf[_0xaca2('0x3f')]);return db['FreshsalesAccount'][_0xaca2('0x47')](_0x3fcd12)['then'](handleEntityNotFound(_0x1250a2,null))[_0xaca2('0x24')](respondWithResult(_0x1250a2,null))[_0xaca2('0x44')](handleError(_0x1250a2,null));};exports['create']=function(_0x42385c,_0x1ef340){return db['FreshsalesAccount']['create'](_0x42385c['body'],{})[_0xaca2('0x24')](respondWithResult(_0x1ef340,0xc9))[_0xaca2('0x44')](handleError(_0x1ef340,null));};exports[_0xaca2('0x23')]=function(_0x1a26ca,_0x38792c){if(_0x1a26ca[_0xaca2('0x48')]['id']){delete _0x1a26ca[_0xaca2('0x48')]['id'];}return db[_0xaca2('0x2c')][_0xaca2('0x47')]({'where':{'id':_0x1a26ca[_0xaca2('0x45')]['id']}})['then'](handleEntityNotFound(_0x38792c,null))[_0xaca2('0x24')](saveUpdates(_0x1a26ca[_0xaca2('0x48')],null))['then'](respondWithResult(_0x38792c,null))[_0xaca2('0x44')](handleError(_0x38792c,null));};exports['destroy']=function(_0x2cb5fc,_0x4e9763){return db[_0xaca2('0x2c')]['find']({'where':{'id':_0x2cb5fc[_0xaca2('0x45')]['id']}})['then'](handleEntityNotFound(_0x4e9763,null))['then'](removeEntity(_0x4e9763,null))[_0xaca2('0x44')](handleError(_0x4e9763,null));};exports[_0xaca2('0x49')]=function(_0x176b42,_0xee24e0,_0x46264c){var _0x3405de={};var _0x2ef3b8={};var _0x2a8e54;var _0x1a02f3;return db[_0xaca2('0x2c')][_0xaca2('0x4a')]({'where':{'id':_0x176b42[_0xaca2('0x45')]['id']}})[_0xaca2('0x24')](handleEntityNotFound(_0xee24e0,null))[_0xaca2('0x24')](function(_0x1a994c){if(_0x1a994c){_0x2a8e54=_0x1a994c;_0x2ef3b8[_0xaca2('0x2f')]=_['keys'](db[_0xaca2('0x4b')][_0xaca2('0x2d')]);_0x2ef3b8['query']=_['keys'](_0x176b42[_0xaca2('0x30')]);_0x2ef3b8[_0xaca2('0x31')]=_[_0xaca2('0x32')](_0x2ef3b8[_0xaca2('0x2f')],_0x2ef3b8['query']);_0x3405de['attributes']=_[_0xaca2('0x32')](_0x2ef3b8[_0xaca2('0x2f')],qs['fields'](_0x176b42['query']['fields']));_0x3405de[_0xaca2('0x34')]=_0x3405de[_0xaca2('0x34')]['length']?_0x3405de[_0xaca2('0x34')]:_0x2ef3b8[_0xaca2('0x2f')];_0x3405de[_0xaca2('0x37')]=qs[_0xaca2('0x38')](_0x176b42['query'][_0xaca2('0x38')]);_0x3405de[_0xaca2('0x3a')]=qs[_0xaca2('0x31')](_['pick'](_0x176b42[_0xaca2('0x30')],_0x2ef3b8[_0xaca2('0x31')]));if(_0x176b42[_0xaca2('0x30')][_0xaca2('0x3e')]){_0x3405de[_0xaca2('0x3a')]=_[_0xaca2('0x3b')](_0x3405de[_0xaca2('0x3a')],{'$or':_[_0xaca2('0x2b')](_0x3405de[_0xaca2('0x34')],function(_0x43a1b0){var _0x39a72b={};_0x39a72b[_0x43a1b0]={'$like':'%'+_0x176b42[_0xaca2('0x30')][_0xaca2('0x3e')]+'%'};return _0x39a72b;})});}_0x3405de=_['merge']({},_0x3405de,_0x176b42['options']);return _0x2a8e54[_0xaca2('0x49')](_0x3405de);}})[_0xaca2('0x24')](function(_0x14a724){if(_0x14a724){_0x1a02f3=_0x14a724[_0xaca2('0x35')];if(!_0x176b42['query']['hasOwnProperty'](_0xaca2('0x4c'))){_0x3405de['limit']=qs['limit'](_0x176b42[_0xaca2('0x30')]['limit']);_0x3405de['offset']=qs[_0xaca2('0x1a')](_0x176b42[_0xaca2('0x30')]['offset']);}return _0x2a8e54[_0xaca2('0x49')](_0x3405de);}})[_0xaca2('0x24')](function(_0x44579c){if(_0x44579c){return _0x44579c?{'count':_0x1a02f3,'rows':_0x44579c}:null;}})[_0xaca2('0x24')](respondWithResult(_0xee24e0,null))[_0xaca2('0x44')](handleError(_0xee24e0,null));};exports[_0xaca2('0x4d')]=function(_0x25d238,_0x1ed15b,_0x56d3c7){if(_0x25d238[_0xaca2('0x48')]['id']){delete _0x25d238['body']['id'];}return db[_0xaca2('0x2c')][_0xaca2('0x4a')]({'where':{'id':_0x25d238[_0xaca2('0x45')]['id']}})[_0xaca2('0x24')](handleEntityNotFound(_0x1ed15b,null))['then'](function(_0x2cef43){if(_0x2cef43){_0x25d238[_0xaca2('0x48')][_0xaca2('0x4e')]=_0x2cef43['id'];_0x25d238[_0xaca2('0x48')][_0xaca2('0x4f')]=integrations[_0xaca2('0x50')](_0x25d238[_0xaca2('0x48')][_0xaca2('0x51')],_0x25d238[_0xaca2('0x48')][_0xaca2('0x3c')]);_0x25d238[_0xaca2('0x48')][_0xaca2('0x52')]=integrations['getDescriptions'](_0x25d238[_0xaca2('0x48')][_0xaca2('0x51')],_0x25d238[_0xaca2('0x48')][_0xaca2('0x3c')]);return db[_0xaca2('0x4b')][_0xaca2('0x53')](_0x25d238[_0xaca2('0x48')],{'include':[{'model':db[_0xaca2('0x54')],'as':_0xaca2('0x4f')},{'model':db[_0xaca2('0x54')],'as':'Descriptions'}]});}return null;})[_0xaca2('0x24')](respondWithResult(_0x1ed15b,null))[_0xaca2('0x44')](handleError(_0x1ed15b,null));};exports['getFields']=function(_0x357104,_0x336528,_0x3566ff){var _0x22f36e='';var _0x4e5f43='';return db[_0xaca2('0x2c')][_0xaca2('0x4a')]({'where':{'id':_0x357104[_0xaca2('0x45')]['id']},'attributes':['id',_0xaca2('0x55'),'remoteUri',_0xaca2('0x56')]})[_0xaca2('0x24')](handleEntityNotFound(_0x336528,null))['then'](function(_0x57e5c7){if(_0x57e5c7){_0x4e5f43=_0x57e5c7[_0xaca2('0x55')];_0x22f36e=_0x57e5c7[_0xaca2('0x57')];var _0x2c7284=_0x57e5c7[_0xaca2('0x57')][_0xaca2('0x58')](-0x1);if(_0x2c7284==='/'){_0x22f36e=_0x22f36e[_0xaca2('0x59')](0x0,_0x22f36e[_0xaca2('0x5a')](_0x2c7284));}return rp({'method':_0xaca2('0x5b'),'uri':util['format'](_0xaca2('0x5c'),_0x22f36e,_0xaca2('0x5d')),'headers':{'Authorization':_0xaca2('0x5e')+_0x57e5c7[_0xaca2('0x56')]},'json':!![]});}})[_0xaca2('0x24')](function(_0x3b4fad){if(_0x3b4fad){var _0x35c53e=_0x3b4fad[_0xaca2('0x5f')];var _0x2cd06b=![];var _0x4cf16d=null;for(_0x4cf16d=0x0;_0x4cf16d<_0x35c53e['length'];_0x4cf16d++){if(_0x35c53e[_0x4cf16d]['email']===_0x4e5f43){_0x2cd06b=!![];}}if(_0x2cd06b){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xaca2('0x60')});}}})[_0xaca2('0x24')](respondWithResult(_0x336528,null))['catch'](function(_0x22c770){var _0x11dc46=_0x357104[_0xaca2('0x30')][_0xaca2('0x61')]?0x1f4:_0x22c770[_0xaca2('0x62')]||0x1f4;logger[_0xaca2('0x27')](_0xaca2('0x63'),_0xaca2('0x64'),_0x11dc46,JSON[_0xaca2('0x65')](_0x22c770));delete _0x22c770[_0xaca2('0x28')];if(_0x11dc46===0x191){_0x11dc46=0x190;}_0x336528[_0xaca2('0x19')](_0x11dc46)[_0xaca2('0x29')](_0x357104[_0xaca2('0x30')][_0xaca2('0x61')]?{'message':_0xaca2('0x66'),'statusCode':_0x22c770[_0xaca2('0x62')]}:_0x22c770);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 7bff215..69d9c16 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 _0x6050=['moment','bluebird','path','rimraf','../../config/environment','int_freshsales_accounts','lodash','util','../../config/logger','api'];(function(_0x4d6026,_0xf2a19a){var _0x12ad71=function(_0x5be16c){while(--_0x5be16c){_0x4d6026['push'](_0x4d6026['shift']());}};_0x12ad71(++_0xf2a19a);}(_0x6050,0x196));var _0x0605=function(_0x179f2f,_0x1f6fc2){_0x179f2f=_0x179f2f-0x0;var _0x3e0efd=_0x6050[_0x179f2f];return _0x3e0efd;};'use strict';var _=require(_0x0605('0x0'));var util=require(_0x0605('0x1'));var logger=require(_0x0605('0x2'))(_0x0605('0x3'));var moment=require(_0x0605('0x4'));var BPromise=require(_0x0605('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0605('0x6'));var rimraf=require(_0x0605('0x7'));var config=require(_0x0605('0x8'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0xd78d96,_0x578623){return _0xd78d96['define']('FreshsalesAccount',attributes,{'tableName':_0x0605('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f8a=['exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x25390b,_0x1771ca){_0x25390b=_0x25390b-0x0;var _0x490180=_0x3f8a[_0x25390b];return _0x490180;};'use strict';var _=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var logger=require(_0xa3f8('0x2'))(_0xa3f8('0x3'));var moment=require('moment');var BPromise=require(_0xa3f8('0x4'));var rp=require(_0xa3f8('0x5'));var fs=require('fs');var path=require(_0xa3f8('0x6'));var rimraf=require(_0xa3f8('0x7'));var config=require(_0xa3f8('0x8'));var attributes=require(_0xa3f8('0x9'));var integrations=require(_0xa3f8('0xa'));module[_0xa3f8('0xb')]=function(_0x1f160a,_0xf895d9){return _0x1f160a[_0xa3f8('0xc')](_0xa3f8('0xd'),attributes,{'tableName':_0xa3f8('0xe'),'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 545d48f..803ab87 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 _0xc2c7=['FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','info','catch','find','ShowFreshsalesAccount','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xc9996,_0x19e6f3){var _0x5080a2=function(_0xfa13a6){while(--_0xfa13a6){_0xc9996['push'](_0xc9996['shift']());}};_0x5080a2(++_0x19e6f3);}(_0xc2c7,0x134));var _0x7c2c=function(_0x33e682,_0x5aace2){_0x33e682=_0x33e682-0x0;var _0x1b3087=_0xc2c7[_0x33e682];return _0x1b3087;};'use strict';var _=require('lodash');var util=require(_0x7c2c('0x0'));var moment=require(_0x7c2c('0x1'));var BPromise=require(_0x7c2c('0x2'));var rs=require(_0x7c2c('0x3'));var fs=require('fs');var Redis=require(_0x7c2c('0x4'));var db=require(_0x7c2c('0x5'))['db'];var utils=require(_0x7c2c('0x6'));var logger=require(_0x7c2c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7c2c('0x8'));var client=jayson[_0x7c2c('0x9')][_0x7c2c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54f027,_0x4abe93,_0x5a1027){return new BPromise(function(_0x2274cd,_0x29638d){return client[_0x7c2c('0xb')](_0x54f027,_0x5a1027)[_0x7c2c('0xc')](function(_0x279cff){logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));logger[_0x7c2c('0xf')](_0x7c2c('0x10'),_0x4abe93,_0x7c2c('0xe'),JSON[_0x7c2c('0x11')](_0x279cff));if(_0x279cff[_0x7c2c('0x12')]){if(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x13')]===0x1f4){logger[_0x7c2c('0x12')](_0x7c2c('0xd'),_0x4abe93,_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);return _0x29638d(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}logger[_0x7c2c('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x4abe93,_0x279cff['error'][_0x7c2c('0x14')]);return _0x2274cd(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}else{logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));_0x2274cd(_0x279cff['result'][_0x7c2c('0x14')]);}})['catch'](function(_0x1aa355){logger['error'](_0x7c2c('0xd'),_0x4abe93,_0x1aa355);_0x29638d(_0x1aa355);});});}exports[_0x7c2c('0x15')]=function(_0x14453f){var _0x2a9539=this;return new Promise(function(_0x17df4a,_0x26be0f){return db[_0x7c2c('0x16')][_0x7c2c('0x17')]({'raw':_0x14453f[_0x7c2c('0x18')]?_0x14453f[_0x7c2c('0x18')][_0x7c2c('0x19')]===undefined?!![]:![]:!![],'where':_0x14453f[_0x7c2c('0x18')]?_0x14453f['options'][_0x7c2c('0x1a')]||null:null,'attributes':_0x14453f['options']?_0x14453f['options'][_0x7c2c('0x1b')]||null:null,'limit':_0x14453f[_0x7c2c('0x18')]?_0x14453f[_0x7c2c('0x18')][_0x7c2c('0x1c')]||null:null,'include':_0x14453f[_0x7c2c('0x18')]?_0x14453f[_0x7c2c('0x18')][_0x7c2c('0x1d')]?_['map'](_0x14453f[_0x7c2c('0x18')]['include'],function(_0x302c93){return{'model':db[_0x302c93['model']],'as':_0x302c93['as'],'attributes':_0x302c93[_0x7c2c('0x1b')],'include':_0x302c93[_0x7c2c('0x1d')]?_[_0x7c2c('0x1e')](_0x302c93['include'],function(_0x4d6ec7){return{'model':db[_0x4d6ec7[_0x7c2c('0x1f')]],'as':_0x4d6ec7['as'],'attributes':_0x4d6ec7[_0x7c2c('0x1b')],'include':_0x4d6ec7[_0x7c2c('0x1d')]?_[_0x7c2c('0x1e')](_0x4d6ec7[_0x7c2c('0x1d')],function(_0xa8e145){return{'model':db[_0xa8e145[_0x7c2c('0x1f')]],'as':_0xa8e145['as'],'attributes':_0xa8e145['attributes']};}):[]};}):[]};}):[]:[]})[_0x7c2c('0xc')](function(_0xf39941){logger[_0x7c2c('0x20')](_0x7c2c('0x15'),_0x14453f);logger[_0x7c2c('0xf')](_0x7c2c('0x15'),_0x14453f,JSON[_0x7c2c('0x11')](_0xf39941));_0x17df4a(_0xf39941);})[_0x7c2c('0x21')](function(_0xa040ff){logger['error'](_0x7c2c('0x15'),_0xa040ff[_0x7c2c('0x14')],_0x14453f);_0x26be0f(_0x2a9539[_0x7c2c('0x12')](0x1f4,_0xa040ff[_0x7c2c('0x14')]));});});};exports['ShowFreshsalesAccount']=function(_0xcb98ba){var _0x30dd1c=this;return new Promise(function(_0x4192c8,_0x1ef88b){return db[_0x7c2c('0x16')][_0x7c2c('0x22')]({'raw':_0xcb98ba[_0x7c2c('0x18')]?_0xcb98ba['options'][_0x7c2c('0x19')]===undefined?!![]:![]:!![],'where':_0xcb98ba[_0x7c2c('0x18')]?_0xcb98ba[_0x7c2c('0x18')][_0x7c2c('0x1a')]||null:null,'attributes':_0xcb98ba[_0x7c2c('0x18')]?_0xcb98ba['options']['attributes']||null:null,'include':_0xcb98ba[_0x7c2c('0x18')]?_0xcb98ba['options']['include']?_[_0x7c2c('0x1e')](_0xcb98ba[_0x7c2c('0x18')][_0x7c2c('0x1d')],function(_0x156c03){return{'model':db[_0x156c03['model']],'as':_0x156c03['as'],'attributes':_0x156c03[_0x7c2c('0x1b')],'include':_0x156c03[_0x7c2c('0x1d')]?_[_0x7c2c('0x1e')](_0x156c03[_0x7c2c('0x1d')],function(_0x204968){return{'model':db[_0x204968[_0x7c2c('0x1f')]],'as':_0x204968['as'],'attributes':_0x204968[_0x7c2c('0x1b')],'include':_0x204968[_0x7c2c('0x1d')]?_[_0x7c2c('0x1e')](_0x204968[_0x7c2c('0x1d')],function(_0x3230a1){return{'model':db[_0x3230a1[_0x7c2c('0x1f')]],'as':_0x3230a1['as'],'attributes':_0x3230a1[_0x7c2c('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x54cbb7){logger[_0x7c2c('0x20')]('ShowFreshsalesAccount',_0xcb98ba);logger['debug']('ShowFreshsalesAccount',_0xcb98ba,JSON[_0x7c2c('0x11')](_0x54cbb7));_0x4192c8(_0x54cbb7);})[_0x7c2c('0x21')](function(_0x129bf0){logger[_0x7c2c('0x12')](_0x7c2c('0x23'),_0x129bf0[_0x7c2c('0x14')],_0xcb98ba);_0x1ef88b(_0x30dd1c[_0x7c2c('0x12')](0x1f4,_0x129bf0[_0x7c2c('0x14')]));});});}; \ No newline at end of file +var _0xc6ac=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','map','include','model','stringify','catch','ShowFreshsalesAccount','find','lodash','util','moment','bluebird'];(function(_0xabbd2f,_0x44d05a){var _0x34a040=function(_0x3736d9){while(--_0x3736d9){_0xabbd2f['push'](_0xabbd2f['shift']());}};_0x34a040(++_0x44d05a);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x2fb12d,_0x15bb4b){_0x2fb12d=_0x2fb12d-0x0;var _0x11bf1f=_0xc6ac[_0x2fb12d];return _0x11bf1f;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var moment=require(_0xcc6a('0x2'));var BPromise=require(_0xcc6a('0x3'));var rs=require(_0xcc6a('0x4'));var fs=require('fs');var Redis=require(_0xcc6a('0x5'));var db=require(_0xcc6a('0x6'))['db'];var utils=require(_0xcc6a('0x7'));var logger=require(_0xcc6a('0x8'))(_0xcc6a('0x9'));var config=require(_0xcc6a('0xa'));var jayson=require(_0xcc6a('0xb'));var client=jayson[_0xcc6a('0xc')][_0xcc6a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5f3887,_0x3dd497,_0x11b919){return new BPromise(function(_0xf02261,_0x560cc4){return client[_0xcc6a('0xe')](_0x5f3887,_0x11b919)[_0xcc6a('0xf')](function(_0x7806a0){logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,'request\x20sent');logger[_0xcc6a('0x12')](_0xcc6a('0x13'),_0x3dd497,_0xcc6a('0x14'),JSON['stringify'](_0x7806a0));if(_0x7806a0[_0xcc6a('0x15')]){if(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x16')]===0x1f4){logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0x560cc4(_0x7806a0[_0xcc6a('0x15')]['message']);}logger['error'](_0xcc6a('0x11'),_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0xf02261(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);}else{logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,_0xcc6a('0x14'));_0xf02261(_0x7806a0['result']['message']);}})['catch'](function(_0x395a55){logger[_0xcc6a('0x15')](_0xcc6a('0x11'),_0x3dd497,_0x395a55);_0x560cc4(_0x395a55);});});}exports[_0xcc6a('0x18')]=function(_0x33079c){var _0x12ef33=this;return new Promise(function(_0x2d9585,_0x412bc7){return db[_0xcc6a('0x19')][_0xcc6a('0x1a')]({'raw':_0x33079c[_0xcc6a('0x1b')]?_0x33079c['options'][_0xcc6a('0x1c')]===undefined?!![]:![]:!![],'where':_0x33079c[_0xcc6a('0x1b')]?_0x33079c[_0xcc6a('0x1b')][_0xcc6a('0x1d')]||null:null,'attributes':_0x33079c[_0xcc6a('0x1b')]?_0x33079c[_0xcc6a('0x1b')][_0xcc6a('0x1e')]||null:null,'limit':_0x33079c[_0xcc6a('0x1b')]?_0x33079c[_0xcc6a('0x1b')][_0xcc6a('0x1f')]||null:null,'include':_0x33079c[_0xcc6a('0x1b')]?_0x33079c[_0xcc6a('0x1b')]['include']?_[_0xcc6a('0x20')](_0x33079c[_0xcc6a('0x1b')][_0xcc6a('0x21')],function(_0x581aae){return{'model':db[_0x581aae[_0xcc6a('0x22')]],'as':_0x581aae['as'],'attributes':_0x581aae[_0xcc6a('0x1e')],'include':_0x581aae[_0xcc6a('0x21')]?_[_0xcc6a('0x20')](_0x581aae[_0xcc6a('0x21')],function(_0x5fc697){return{'model':db[_0x5fc697['model']],'as':_0x5fc697['as'],'attributes':_0x5fc697[_0xcc6a('0x1e')],'include':_0x5fc697[_0xcc6a('0x21')]?_[_0xcc6a('0x20')](_0x5fc697['include'],function(_0x3afb3a){return{'model':db[_0x3afb3a[_0xcc6a('0x22')]],'as':_0x3afb3a['as'],'attributes':_0x3afb3a['attributes']};}):[]};}):[]};}):[]:[]})[_0xcc6a('0xf')](function(_0x8b1b2b){logger[_0xcc6a('0x10')](_0xcc6a('0x18'),_0x33079c);logger['debug'](_0xcc6a('0x18'),_0x33079c,JSON[_0xcc6a('0x23')](_0x8b1b2b));_0x2d9585(_0x8b1b2b);})[_0xcc6a('0x24')](function(_0x4f176b){logger[_0xcc6a('0x15')]('GetFreshsalesAccount',_0x4f176b['message'],_0x33079c);_0x412bc7(_0x12ef33[_0xcc6a('0x15')](0x1f4,_0x4f176b[_0xcc6a('0x17')]));});});};exports[_0xcc6a('0x25')]=function(_0x11b481){var _0x2b575d=this;return new Promise(function(_0x131138,_0x4e2de4){return db[_0xcc6a('0x19')][_0xcc6a('0x26')]({'raw':_0x11b481[_0xcc6a('0x1b')]?_0x11b481[_0xcc6a('0x1b')][_0xcc6a('0x1c')]===undefined?!![]:![]:!![],'where':_0x11b481[_0xcc6a('0x1b')]?_0x11b481[_0xcc6a('0x1b')][_0xcc6a('0x1d')]||null:null,'attributes':_0x11b481['options']?_0x11b481[_0xcc6a('0x1b')][_0xcc6a('0x1e')]||null:null,'include':_0x11b481[_0xcc6a('0x1b')]?_0x11b481[_0xcc6a('0x1b')][_0xcc6a('0x21')]?_[_0xcc6a('0x20')](_0x11b481[_0xcc6a('0x1b')]['include'],function(_0x5d2287){return{'model':db[_0x5d2287['model']],'as':_0x5d2287['as'],'attributes':_0x5d2287['attributes'],'include':_0x5d2287['include']?_[_0xcc6a('0x20')](_0x5d2287[_0xcc6a('0x21')],function(_0x1101ec){return{'model':db[_0x1101ec[_0xcc6a('0x22')]],'as':_0x1101ec['as'],'attributes':_0x1101ec[_0xcc6a('0x1e')],'include':_0x1101ec['include']?_['map'](_0x1101ec[_0xcc6a('0x21')],function(_0x11173a){return{'model':db[_0x11173a[_0xcc6a('0x22')]],'as':_0x11173a['as'],'attributes':_0x11173a['attributes']};}):[]};}):[]};}):[]:[]})[_0xcc6a('0xf')](function(_0x2207df){logger[_0xcc6a('0x10')](_0xcc6a('0x25'),_0x11b481);logger[_0xcc6a('0x12')](_0xcc6a('0x25'),_0x11b481,JSON[_0xcc6a('0x23')](_0x2207df));_0x131138(_0x2207df);})[_0xcc6a('0x24')](function(_0x2a1cd2){logger[_0xcc6a('0x15')](_0xcc6a('0x25'),_0x2a1cd2[_0xcc6a('0x17')],_0x11b481);_0x4e2de4(_0x2b575d[_0xcc6a('0x15')](0x1f4,_0x2a1cd2[_0xcc6a('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 4869108..9405038 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 _0xaf9f=['update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getFields','post','create','put'];(function(_0x2004eb,_0x14fb32){var _0x4bc5a6=function(_0x4d719e){while(--_0x4d719e){_0x2004eb['push'](_0x2004eb['shift']());}};_0x4bc5a6(++_0x14fb32);}(_0xaf9f,0x17b));var _0xfaf9=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0xaf9f[_0x5a95fa];return _0x1a61b8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfaf9('0x0'));var timeout=require(_0xfaf9('0x1'));var express=require(_0xfaf9('0x2'));var router=express[_0xfaf9('0x3')]();var fs_extra=require(_0xfaf9('0x4'));var auth=require(_0xfaf9('0x5'));var interaction=require(_0xfaf9('0x6'));var config=require('../../config/environment');var controller=require(_0xfaf9('0x7'));router[_0xfaf9('0x8')]('/',auth[_0xfaf9('0x9')](),controller[_0xfaf9('0xa')]);router['get'](_0xfaf9('0xb'),auth['isAuthenticated'](),controller[_0xfaf9('0xc')]);router['get'](_0xfaf9('0xd'),auth[_0xfaf9('0x9')](),controller[_0xfaf9('0xe')]);router['get'](_0xfaf9('0xf'),auth[_0xfaf9('0x9')](),controller[_0xfaf9('0x10')]);router['get']('/:id/fields',auth[_0xfaf9('0x9')](),controller[_0xfaf9('0x11')]);router[_0xfaf9('0x12')]('/',auth[_0xfaf9('0x9')](),controller[_0xfaf9('0x13')]);router[_0xfaf9('0x14')](_0xfaf9('0xb'),auth[_0xfaf9('0x9')](),controller[_0xfaf9('0x15')]);router[_0xfaf9('0x16')](_0xfaf9('0xb'),auth[_0xfaf9('0x9')](),controller[_0xfaf9('0x17')]);module[_0xfaf9('0x18')]=router; \ No newline at end of file +var _0xbdc4=['update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','/:id/subjects','getSubjects','getFields','post','create','/:id'];(function(_0x26e63f,_0xb68ef6){var _0x2c7cdb=function(_0x1e77e6){while(--_0x1e77e6){_0x26e63f['push'](_0x26e63f['shift']());}};_0x2c7cdb(++_0xb68ef6);}(_0xbdc4,0x17f));var _0x4bdc=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0xbdc4[_0x10004e];return _0x5af990;};'use strict';var multer=require(_0x4bdc('0x0'));var util=require(_0x4bdc('0x1'));var path=require(_0x4bdc('0x2'));var timeout=require(_0x4bdc('0x3'));var express=require(_0x4bdc('0x4'));var router=express['Router']();var fs_extra=require(_0x4bdc('0x5'));var auth=require(_0x4bdc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4bdc('0x7'));var controller=require(_0x4bdc('0x8'));router[_0x4bdc('0x9')]('/',auth[_0x4bdc('0xa')](),controller['index']);router[_0x4bdc('0x9')]('/:id',auth[_0x4bdc('0xa')](),controller['show']);router[_0x4bdc('0x9')](_0x4bdc('0xb'),auth[_0x4bdc('0xa')](),controller[_0x4bdc('0xc')]);router['get']('/:id/descriptions',auth[_0x4bdc('0xa')](),controller['getDescriptions']);router[_0x4bdc('0x9')]('/:id/fields',auth[_0x4bdc('0xa')](),controller[_0x4bdc('0xd')]);router[_0x4bdc('0xe')]('/',auth[_0x4bdc('0xa')](),controller[_0x4bdc('0xf')]);router['put'](_0x4bdc('0x10'),auth[_0x4bdc('0xa')](),controller[_0x4bdc('0x11')]);router[_0x4bdc('0x12')](_0x4bdc('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0x4bdc('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index fe5d377..21a4898 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 _0x21c9=['STRING','sequelize','exports'];(function(_0x3424dc,_0x5673c5){var _0x407c7d=function(_0x466f0e){while(--_0x466f0e){_0x3424dc['push'](_0x3424dc['shift']());}};_0x407c7d(++_0x5673c5);}(_0x21c9,0x82));var _0x921c=function(_0x2928cf,_0x4d86a1){_0x2928cf=_0x2928cf-0x0;var _0x12bb8a=_0x21c9[_0x2928cf];return _0x12bb8a;};'use strict';var Sequelize=require(_0x921c('0x0'));module[_0x921c('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x921c('0x2')]}}; \ No newline at end of file +var _0x2f83=['exports','STRING','sequelize'];(function(_0x122d79,_0x4378f1){var _0x51c20e=function(_0x4b82b1){while(--_0x4b82b1){_0x122d79['push'](_0x122d79['shift']());}};_0x51c20e(++_0x4378f1);}(_0x2f83,0x1c1));var _0x32f8=function(_0x4e9a07,_0x1b49f0){_0x4e9a07=_0x4e9a07-0x0;var _0xab802a=_0x2f83[_0x4e9a07];return _0xab802a;};'use strict';var Sequelize=require(_0x32f8('0x0'));module[_0x32f8('0x1')]={'name':{'type':Sequelize[_0x32f8('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index fb70cb5..9c5de7e 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 _0x17c2=['where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','show','params','keys','options','find','create','body','update','catch','getSubjects','findOne','rawAttributes','getDescriptions','getFields','FreshsalesField','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','offset','count','Content-Range','apply','reject','save','then','destroy','end','sendStatus','error','stack','name','index','map','FreshsalesConfiguration','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x535470,_0x3767e2){var _0x3e10fc=function(_0x1adf4f){while(--_0x1adf4f){_0x535470['push'](_0x535470['shift']());}};_0x3e10fc(++_0x3767e2);}(_0x17c2,0x10a));var _0x217c=function(_0x5d12a8,_0x593aa1){_0x5d12a8=_0x5d12a8-0x0;var _0x35194f=_0x17c2[_0x5d12a8];return _0x35194f;};'use strict';var emlformat=require(_0x217c('0x0'));var rimraf=require(_0x217c('0x1'));var zipdir=require(_0x217c('0x2'));var jsonpatch=require(_0x217c('0x3'));var rp=require('request-promise');var moment=require(_0x217c('0x4'));var BPromise=require(_0x217c('0x5'));var Mustache=require('mustache');var util=require(_0x217c('0x6'));var path=require('path');var sox=require(_0x217c('0x7'));var csv=require(_0x217c('0x8'));var ejs=require(_0x217c('0x9'));var fs=require('fs');var fs_extra=require(_0x217c('0xa'));var _=require('lodash');var squel=require(_0x217c('0xb'));var crypto=require(_0x217c('0xc'));var jsforce=require(_0x217c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x217c('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x217c('0xe'));var authService=require(_0x217c('0xf'));var qs=require(_0x217c('0x10'));var as=require(_0x217c('0x11'));var hardwareService=require(_0x217c('0x12'));var logger=require(_0x217c('0x13'))(_0x217c('0x14'));var utils=require(_0x217c('0x15'));var config=require(_0x217c('0x16'));var licenseUtil=require(_0x217c('0x17'));var db=require(_0x217c('0x18'))['db'];function respondWithStatusCode(_0xb0b745,_0x4cd21a){_0x4cd21a=_0x4cd21a||0xcc;return function(_0x468d3f){if(_0x468d3f){return _0xb0b745['sendStatus'](_0x4cd21a);}return _0xb0b745[_0x217c('0x19')](_0x4cd21a)['end']();};}function respondWithResult(_0xb1e259,_0x16ca36){_0x16ca36=_0x16ca36||0xc8;return function(_0x351d16){if(_0x351d16){return _0xb1e259[_0x217c('0x19')](_0x16ca36)[_0x217c('0x1a')](_0x351d16);}};}function respondWithFilteredResult(_0x4868ca,_0x33db7c){return function(_0x44e4cb){if(_0x44e4cb){var _0x240b52=typeof _0x33db7c['offset']===_0x217c('0x1b')&&typeof _0x33db7c[_0x217c('0x1c')]==='undefined';var _0x1ba2d6=_0x44e4cb['count'];var _0x5b9067=_0x240b52?0x0:_0x33db7c[_0x217c('0x1d')];var _0x5cdf0f=_0x240b52?_0x44e4cb[_0x217c('0x1e')]:_0x33db7c['offset']+_0x33db7c[_0x217c('0x1c')];var _0x2da676;if(_0x5cdf0f>=_0x1ba2d6){_0x5cdf0f=_0x1ba2d6;_0x2da676=0xc8;}else{_0x2da676=0xce;}_0x4868ca[_0x217c('0x19')](_0x2da676);return _0x4868ca['set'](_0x217c('0x1f'),_0x5b9067+'-'+_0x5cdf0f+'/'+_0x1ba2d6)[_0x217c('0x1a')](_0x44e4cb);}return null;};}function patchUpdates(_0x31fb0d){return function(_0x530ad3){try{jsonpatch[_0x217c('0x20')](_0x530ad3,_0x31fb0d,!![]);}catch(_0x1f502b){return BPromise[_0x217c('0x21')](_0x1f502b);}return _0x530ad3[_0x217c('0x22')]();};}function saveUpdates(_0xd9597a,_0x3fac9f){return function(_0x2cd9ec){if(_0x2cd9ec){return _0x2cd9ec['update'](_0xd9597a)[_0x217c('0x23')](function(_0x429206){return _0x429206;});}return null;};}function removeEntity(_0xb988f5,_0x19b8ac){return function(_0xdf714a){if(_0xdf714a){return _0xdf714a[_0x217c('0x24')]()['then'](function(){_0xb988f5['status'](0xcc)[_0x217c('0x25')]();});}};}function handleEntityNotFound(_0x254238,_0x413faa){return function(_0x3c9519){if(!_0x3c9519){_0x254238[_0x217c('0x26')](0x194);}return _0x3c9519;};}function handleError(_0x5ab2ae,_0x480bf5){_0x480bf5=_0x480bf5||0x1f4;return function(_0x3f06f0){logger[_0x217c('0x27')](_0x3f06f0[_0x217c('0x28')]);if(_0x3f06f0['name']){delete _0x3f06f0[_0x217c('0x29')];}_0x5ab2ae['status'](_0x480bf5)['send'](_0x3f06f0);};}exports[_0x217c('0x2a')]=function(_0x279186,_0x5d914a){var _0x2c1a01={},_0x1e43e9={},_0x435493={'count':0x0,'rows':[]};var _0x3fb0db=_[_0x217c('0x2b')](db[_0x217c('0x2c')]['rawAttributes'],function(_0xbbb1ac){return{'name':_0xbbb1ac['fieldName'],'type':_0xbbb1ac[_0x217c('0x2d')][_0x217c('0x2e')]};});_0x1e43e9[_0x217c('0x2f')]=_['map'](_0x3fb0db,_0x217c('0x29'));_0x1e43e9[_0x217c('0x30')]=_['keys'](_0x279186[_0x217c('0x30')]);_0x1e43e9[_0x217c('0x31')]=_[_0x217c('0x32')](_0x1e43e9['model'],_0x1e43e9[_0x217c('0x30')]);_0x2c1a01[_0x217c('0x33')]=_[_0x217c('0x32')](_0x1e43e9['model'],qs[_0x217c('0x34')](_0x279186[_0x217c('0x30')][_0x217c('0x34')]));_0x2c1a01[_0x217c('0x33')]=_0x2c1a01['attributes'][_0x217c('0x35')]?_0x2c1a01['attributes']:_0x1e43e9[_0x217c('0x2f')];if(!_0x279186['query'][_0x217c('0x36')](_0x217c('0x37'))){_0x2c1a01[_0x217c('0x1c')]=qs['limit'](_0x279186[_0x217c('0x30')]['limit']);_0x2c1a01[_0x217c('0x1d')]=qs['offset'](_0x279186['query']['offset']);}_0x2c1a01[_0x217c('0x38')]=qs[_0x217c('0x39')](_0x279186[_0x217c('0x30')][_0x217c('0x39')]);_0x2c1a01[_0x217c('0x3a')]=qs[_0x217c('0x31')](_[_0x217c('0x3b')](_0x279186['query'],_0x1e43e9[_0x217c('0x31')]),_0x3fb0db);if(_0x279186[_0x217c('0x30')][_0x217c('0x3c')]){_0x2c1a01[_0x217c('0x3a')]=_['merge'](_0x2c1a01[_0x217c('0x3a')],{'$or':_[_0x217c('0x2b')](_0x3fb0db,function(_0x3251e0){if(_0x3251e0[_0x217c('0x2d')]!==_0x217c('0x3d')){var _0x1d2493={};_0x1d2493[_0x3251e0['name']]={'$like':'%'+_0x279186[_0x217c('0x30')][_0x217c('0x3c')]+'%'};return _0x1d2493;}})});}_0x2c1a01=_[_0x217c('0x3e')]({},_0x2c1a01,_0x279186['options']);var _0x24b9ee={'where':_0x2c1a01[_0x217c('0x3a')]};return db[_0x217c('0x2c')]['count'](_0x24b9ee)['then'](function(_0x4d41b1){_0x435493[_0x217c('0x1e')]=_0x4d41b1;if(_0x279186['query'][_0x217c('0x3f')]){_0x2c1a01[_0x217c('0x40')]=[{'all':!![]}];}return db[_0x217c('0x2c')][_0x217c('0x41')](_0x2c1a01);})['then'](function(_0x2bd37d){_0x435493['rows']=_0x2bd37d;return _0x435493;})[_0x217c('0x23')](respondWithFilteredResult(_0x5d914a,_0x2c1a01))['catch'](handleError(_0x5d914a,null));};exports[_0x217c('0x42')]=function(_0x5e3dce,_0x1d83e5){var _0xf9ae60={'raw':![],'where':{'id':_0x5e3dce[_0x217c('0x43')]['id']}},_0x27381d={};_0x27381d[_0x217c('0x2f')]=_[_0x217c('0x44')](db[_0x217c('0x2c')]['rawAttributes']);_0x27381d['query']=_[_0x217c('0x44')](_0x5e3dce[_0x217c('0x30')]);_0x27381d[_0x217c('0x31')]=_[_0x217c('0x32')](_0x27381d[_0x217c('0x2f')],_0x27381d[_0x217c('0x30')]);_0xf9ae60[_0x217c('0x33')]=_[_0x217c('0x32')](_0x27381d[_0x217c('0x2f')],qs[_0x217c('0x34')](_0x5e3dce[_0x217c('0x30')][_0x217c('0x34')]));_0xf9ae60[_0x217c('0x33')]=_0xf9ae60[_0x217c('0x33')][_0x217c('0x35')]?_0xf9ae60[_0x217c('0x33')]:_0x27381d[_0x217c('0x2f')];if(_0x5e3dce[_0x217c('0x30')][_0x217c('0x3f')]){_0xf9ae60[_0x217c('0x40')]=[{'all':!![]}];}_0xf9ae60=_[_0x217c('0x3e')]({},_0xf9ae60,_0x5e3dce[_0x217c('0x45')]);return db['FreshsalesConfiguration'][_0x217c('0x46')](_0xf9ae60)[_0x217c('0x23')](handleEntityNotFound(_0x1d83e5,null))[_0x217c('0x23')](respondWithResult(_0x1d83e5,null))['catch'](handleError(_0x1d83e5,null));};exports[_0x217c('0x47')]=function(_0x4a4357,_0x2e05e5){return db[_0x217c('0x2c')][_0x217c('0x47')](_0x4a4357[_0x217c('0x48')],{})[_0x217c('0x23')](respondWithResult(_0x2e05e5,0xc9))['catch'](handleError(_0x2e05e5,null));};exports[_0x217c('0x49')]=function(_0xbad48c,_0x3557ea){if(_0xbad48c['body']['id']){delete _0xbad48c[_0x217c('0x48')]['id'];}return db['FreshsalesConfiguration'][_0x217c('0x46')]({'where':{'id':_0xbad48c['params']['id']}})[_0x217c('0x23')](handleEntityNotFound(_0x3557ea,null))['then'](saveUpdates(_0xbad48c[_0x217c('0x48')],null))[_0x217c('0x23')](respondWithResult(_0x3557ea,null))[_0x217c('0x4a')](handleError(_0x3557ea,null));};exports[_0x217c('0x24')]=function(_0x15a8e3,_0x3557f8){return db[_0x217c('0x2c')][_0x217c('0x46')]({'where':{'id':_0x15a8e3[_0x217c('0x43')]['id']}})[_0x217c('0x23')](handleEntityNotFound(_0x3557f8,null))['then'](removeEntity(_0x3557f8,null))[_0x217c('0x4a')](handleError(_0x3557f8,null));};exports[_0x217c('0x4b')]=function(_0x5c63c3,_0x5bdb8e,_0xbd1919){var _0x576c4d={};var _0x11e5b5={};var _0x20ab49;var _0x5ca5c9;return db[_0x217c('0x2c')][_0x217c('0x4c')]({'where':{'id':_0x5c63c3[_0x217c('0x43')]['id']}})['then'](handleEntityNotFound(_0x5bdb8e,null))[_0x217c('0x23')](function(_0x209902){if(_0x209902){_0x20ab49=_0x209902;_0x11e5b5['model']=_[_0x217c('0x44')](db['FreshsalesField']['rawAttributes']);_0x11e5b5['query']=_[_0x217c('0x44')](_0x5c63c3[_0x217c('0x30')]);_0x11e5b5['filters']=_[_0x217c('0x32')](_0x11e5b5['model'],_0x11e5b5['query']);_0x576c4d[_0x217c('0x33')]=_['intersection'](_0x11e5b5[_0x217c('0x2f')],qs[_0x217c('0x34')](_0x5c63c3[_0x217c('0x30')][_0x217c('0x34')]));_0x576c4d[_0x217c('0x33')]=_0x576c4d[_0x217c('0x33')][_0x217c('0x35')]?_0x576c4d[_0x217c('0x33')]:_0x11e5b5[_0x217c('0x2f')];_0x576c4d[_0x217c('0x38')]=qs[_0x217c('0x39')](_0x5c63c3[_0x217c('0x30')][_0x217c('0x39')]);_0x576c4d['where']=qs[_0x217c('0x31')](_[_0x217c('0x3b')](_0x5c63c3[_0x217c('0x30')],_0x11e5b5[_0x217c('0x31')]));if(_0x5c63c3[_0x217c('0x30')]['filter']){_0x576c4d[_0x217c('0x3a')]=_['merge'](_0x576c4d['where'],{'$or':_[_0x217c('0x2b')](_0x576c4d[_0x217c('0x33')],function(_0x1ce8ec){var _0x444304={};_0x444304[_0x1ce8ec]={'$like':'%'+_0x5c63c3[_0x217c('0x30')][_0x217c('0x3c')]+'%'};return _0x444304;})});}_0x576c4d=_[_0x217c('0x3e')]({},_0x576c4d,_0x5c63c3['options']);return _0x20ab49[_0x217c('0x4b')](_0x576c4d);}})['then'](function(_0x1122f6){if(_0x1122f6){_0x5ca5c9=_0x1122f6[_0x217c('0x35')];if(!_0x5c63c3[_0x217c('0x30')][_0x217c('0x36')](_0x217c('0x37'))){_0x576c4d[_0x217c('0x1c')]=qs[_0x217c('0x1c')](_0x5c63c3[_0x217c('0x30')][_0x217c('0x1c')]);_0x576c4d[_0x217c('0x1d')]=qs[_0x217c('0x1d')](_0x5c63c3[_0x217c('0x30')]['offset']);}return _0x20ab49['getSubjects'](_0x576c4d);}})['then'](function(_0x533512){if(_0x533512){return _0x533512?{'count':_0x5ca5c9,'rows':_0x533512}:null;}})[_0x217c('0x23')](respondWithResult(_0x5bdb8e,null))[_0x217c('0x4a')](handleError(_0x5bdb8e,null));};exports['getDescriptions']=function(_0x5132cf,_0x516f0c,_0x25b72b){var _0x291f57={};var _0x135ab1={};var _0xc3c8fa;var _0x6450f4;return db[_0x217c('0x2c')][_0x217c('0x4c')]({'where':{'id':_0x5132cf[_0x217c('0x43')]['id']}})[_0x217c('0x23')](handleEntityNotFound(_0x516f0c,null))[_0x217c('0x23')](function(_0x32f3db){if(_0x32f3db){_0xc3c8fa=_0x32f3db;_0x135ab1[_0x217c('0x2f')]=_[_0x217c('0x44')](db['FreshsalesField'][_0x217c('0x4d')]);_0x135ab1['query']=_[_0x217c('0x44')](_0x5132cf[_0x217c('0x30')]);_0x135ab1[_0x217c('0x31')]=_[_0x217c('0x32')](_0x135ab1[_0x217c('0x2f')],_0x135ab1['query']);_0x291f57[_0x217c('0x33')]=_[_0x217c('0x32')](_0x135ab1[_0x217c('0x2f')],qs[_0x217c('0x34')](_0x5132cf[_0x217c('0x30')][_0x217c('0x34')]));_0x291f57[_0x217c('0x33')]=_0x291f57[_0x217c('0x33')][_0x217c('0x35')]?_0x291f57[_0x217c('0x33')]:_0x135ab1[_0x217c('0x2f')];_0x291f57[_0x217c('0x38')]=qs['sort'](_0x5132cf[_0x217c('0x30')][_0x217c('0x39')]);_0x291f57[_0x217c('0x3a')]=qs['filters'](_[_0x217c('0x3b')](_0x5132cf[_0x217c('0x30')],_0x135ab1['filters']));if(_0x5132cf[_0x217c('0x30')][_0x217c('0x3c')]){_0x291f57['where']=_[_0x217c('0x3e')](_0x291f57[_0x217c('0x3a')],{'$or':_[_0x217c('0x2b')](_0x291f57[_0x217c('0x33')],function(_0x457bc5){var _0x220383={};_0x220383[_0x457bc5]={'$like':'%'+_0x5132cf['query'][_0x217c('0x3c')]+'%'};return _0x220383;})});}_0x291f57=_[_0x217c('0x3e')]({},_0x291f57,_0x5132cf[_0x217c('0x45')]);return _0xc3c8fa[_0x217c('0x4e')](_0x291f57);}})[_0x217c('0x23')](function(_0x1eaff6){if(_0x1eaff6){_0x6450f4=_0x1eaff6[_0x217c('0x35')];if(!_0x5132cf['query']['hasOwnProperty'](_0x217c('0x37'))){_0x291f57[_0x217c('0x1c')]=qs['limit'](_0x5132cf[_0x217c('0x30')][_0x217c('0x1c')]);_0x291f57[_0x217c('0x1d')]=qs[_0x217c('0x1d')](_0x5132cf[_0x217c('0x30')]['offset']);}return _0xc3c8fa[_0x217c('0x4e')](_0x291f57);}})[_0x217c('0x23')](function(_0x109dcf){if(_0x109dcf){return _0x109dcf?{'count':_0x6450f4,'rows':_0x109dcf}:null;}})[_0x217c('0x23')](respondWithResult(_0x516f0c,null))[_0x217c('0x4a')](handleError(_0x516f0c,null));};exports[_0x217c('0x4f')]=function(_0x156885,_0xa11bc2,_0x3b97f1){var _0x1a4668={};var _0x104ef2={};var _0x4d9b52;var _0x2cb433;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x156885['params']['id']}})[_0x217c('0x23')](handleEntityNotFound(_0xa11bc2,null))[_0x217c('0x23')](function(_0x1c24ee){if(_0x1c24ee){_0x4d9b52=_0x1c24ee;_0x104ef2[_0x217c('0x2f')]=_['keys'](db[_0x217c('0x50')]['rawAttributes']);_0x104ef2[_0x217c('0x30')]=_['keys'](_0x156885[_0x217c('0x30')]);_0x104ef2[_0x217c('0x31')]=_[_0x217c('0x32')](_0x104ef2['model'],_0x104ef2[_0x217c('0x30')]);_0x1a4668[_0x217c('0x33')]=_[_0x217c('0x32')](_0x104ef2[_0x217c('0x2f')],qs[_0x217c('0x34')](_0x156885[_0x217c('0x30')][_0x217c('0x34')]));_0x1a4668['attributes']=_0x1a4668[_0x217c('0x33')][_0x217c('0x35')]?_0x1a4668[_0x217c('0x33')]:_0x104ef2[_0x217c('0x2f')];_0x1a4668[_0x217c('0x38')]=qs[_0x217c('0x39')](_0x156885['query'][_0x217c('0x39')]);_0x1a4668[_0x217c('0x3a')]=qs['filters'](_[_0x217c('0x3b')](_0x156885[_0x217c('0x30')],_0x104ef2[_0x217c('0x31')]));if(_0x156885['query'][_0x217c('0x3c')]){_0x1a4668[_0x217c('0x3a')]=_[_0x217c('0x3e')](_0x1a4668[_0x217c('0x3a')],{'$or':_[_0x217c('0x2b')](_0x1a4668[_0x217c('0x33')],function(_0x5c3b40){var _0x7c7a6e={};_0x7c7a6e[_0x5c3b40]={'$like':'%'+_0x156885[_0x217c('0x30')][_0x217c('0x3c')]+'%'};return _0x7c7a6e;})});}_0x1a4668=_[_0x217c('0x3e')]({},_0x1a4668,_0x156885['options']);return _0x4d9b52[_0x217c('0x4f')](_0x1a4668);}})[_0x217c('0x23')](function(_0x2d4de7){if(_0x2d4de7){_0x2cb433=_0x2d4de7['length'];if(!_0x156885[_0x217c('0x30')]['hasOwnProperty'](_0x217c('0x37'))){_0x1a4668[_0x217c('0x1c')]=qs[_0x217c('0x1c')](_0x156885[_0x217c('0x30')][_0x217c('0x1c')]);_0x1a4668[_0x217c('0x1d')]=qs[_0x217c('0x1d')](_0x156885[_0x217c('0x30')]['offset']);}return _0x4d9b52['getFields'](_0x1a4668);}})[_0x217c('0x23')](function(_0x3480f7){if(_0x3480f7){return _0x3480f7?{'count':_0x2cb433,'rows':_0x3480f7}:null;}})[_0x217c('0x23')](respondWithResult(_0xa11bc2,null))[_0x217c('0x4a')](handleError(_0xa11bc2,null));}; \ No newline at end of file +var _0x94f4=['attributes','intersection','fields','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','find','create','body','getSubjects','findOne','FreshsalesField','hasOwnProperty','getDescriptions','getFields','order','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0x2d088c,_0x539a1b){var _0x4b9713=function(_0x32b1f6){while(--_0x32b1f6){_0x2d088c['push'](_0x2d088c['shift']());}};_0x4b9713(++_0x539a1b);}(_0x94f4,0xc5));var _0x494f=function(_0x14b413,_0x12ae74){_0x14b413=_0x14b413-0x0;var _0x11eca2=_0x94f4[_0x14b413];return _0x11eca2;};'use strict';var emlformat=require(_0x494f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x494f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x494f('0x2'));var moment=require(_0x494f('0x3'));var BPromise=require(_0x494f('0x4'));var Mustache=require(_0x494f('0x5'));var util=require(_0x494f('0x6'));var path=require('path');var sox=require(_0x494f('0x7'));var csv=require(_0x494f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x494f('0x9'));var _=require(_0x494f('0xa'));var squel=require(_0x494f('0xb'));var crypto=require('crypto');var jsforce=require(_0x494f('0xc'));var deskjs=require(_0x494f('0xd'));var toCsv=require(_0x494f('0x8'));var querystring=require(_0x494f('0xe'));var Papa=require(_0x494f('0xf'));var Redis=require(_0x494f('0x10'));var authService=require(_0x494f('0x11'));var qs=require(_0x494f('0x12'));var as=require(_0x494f('0x13'));var hardwareService=require(_0x494f('0x14'));var logger=require('../../config/logger')(_0x494f('0x15'));var utils=require(_0x494f('0x16'));var config=require(_0x494f('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x494f('0x18'))['db'];function respondWithStatusCode(_0x2ed980,_0x3527db){_0x3527db=_0x3527db||0xcc;return function(_0x2bee1e){if(_0x2bee1e){return _0x2ed980[_0x494f('0x19')](_0x3527db);}return _0x2ed980[_0x494f('0x1a')](_0x3527db)[_0x494f('0x1b')]();};}function respondWithResult(_0x5ed172,_0x20b4cb){_0x20b4cb=_0x20b4cb||0xc8;return function(_0x489fe8){if(_0x489fe8){return _0x5ed172[_0x494f('0x1a')](_0x20b4cb)[_0x494f('0x1c')](_0x489fe8);}};}function respondWithFilteredResult(_0x1f8022,_0x5563f3){return function(_0x4069eb){if(_0x4069eb){var _0x1197f1=typeof _0x5563f3[_0x494f('0x1d')]===_0x494f('0x1e')&&typeof _0x5563f3[_0x494f('0x1f')]===_0x494f('0x1e');var _0x2236ac=_0x4069eb[_0x494f('0x20')];var _0x4a8450=_0x1197f1?0x0:_0x5563f3[_0x494f('0x1d')];var _0x356bbd=_0x1197f1?_0x4069eb[_0x494f('0x20')]:_0x5563f3[_0x494f('0x1d')]+_0x5563f3[_0x494f('0x1f')];var _0x3daf70;if(_0x356bbd>=_0x2236ac){_0x356bbd=_0x2236ac;_0x3daf70=0xc8;}else{_0x3daf70=0xce;}_0x1f8022[_0x494f('0x1a')](_0x3daf70);return _0x1f8022[_0x494f('0x21')](_0x494f('0x22'),_0x4a8450+'-'+_0x356bbd+'/'+_0x2236ac)[_0x494f('0x1c')](_0x4069eb);}return null;};}function patchUpdates(_0x492703){return function(_0x51b2d3){try{jsonpatch[_0x494f('0x23')](_0x51b2d3,_0x492703,!![]);}catch(_0x35e239){return BPromise[_0x494f('0x24')](_0x35e239);}return _0x51b2d3[_0x494f('0x25')]();};}function saveUpdates(_0x4cb03d,_0x1a6175){return function(_0x287a27){if(_0x287a27){return _0x287a27[_0x494f('0x26')](_0x4cb03d)[_0x494f('0x27')](function(_0x19a16c){return _0x19a16c;});}return null;};}function removeEntity(_0x38f198,_0x10f2ad){return function(_0x1d11bd){if(_0x1d11bd){return _0x1d11bd[_0x494f('0x28')]()[_0x494f('0x27')](function(){_0x38f198[_0x494f('0x1a')](0xcc)[_0x494f('0x1b')]();});}};}function handleEntityNotFound(_0x54aa6b,_0xa8b15b){return function(_0x127d1a){if(!_0x127d1a){_0x54aa6b[_0x494f('0x19')](0x194);}return _0x127d1a;};}function handleError(_0x10c484,_0x2c5a0c){_0x2c5a0c=_0x2c5a0c||0x1f4;return function(_0x2e4c24){logger[_0x494f('0x29')](_0x2e4c24[_0x494f('0x2a')]);if(_0x2e4c24[_0x494f('0x2b')]){delete _0x2e4c24[_0x494f('0x2b')];}_0x10c484[_0x494f('0x1a')](_0x2c5a0c)[_0x494f('0x2c')](_0x2e4c24);};}exports[_0x494f('0x2d')]=function(_0x5a606f,_0x2fbe35){var _0x344dd7={},_0x28a029={},_0x207b47={'count':0x0,'rows':[]};var _0x1dec51=_[_0x494f('0x2e')](db[_0x494f('0x2f')][_0x494f('0x30')],function(_0x419332){return{'name':_0x419332[_0x494f('0x31')],'type':_0x419332[_0x494f('0x32')][_0x494f('0x33')]};});_0x28a029[_0x494f('0x34')]=_[_0x494f('0x2e')](_0x1dec51,_0x494f('0x2b'));_0x28a029[_0x494f('0x35')]=_[_0x494f('0x36')](_0x5a606f[_0x494f('0x35')]);_0x28a029['filters']=_['intersection'](_0x28a029[_0x494f('0x34')],_0x28a029['query']);_0x344dd7[_0x494f('0x37')]=_[_0x494f('0x38')](_0x28a029[_0x494f('0x34')],qs[_0x494f('0x39')](_0x5a606f[_0x494f('0x35')][_0x494f('0x39')]));_0x344dd7['attributes']=_0x344dd7[_0x494f('0x37')][_0x494f('0x3a')]?_0x344dd7[_0x494f('0x37')]:_0x28a029[_0x494f('0x34')];if(!_0x5a606f[_0x494f('0x35')]['hasOwnProperty'](_0x494f('0x3b'))){_0x344dd7[_0x494f('0x1f')]=qs[_0x494f('0x1f')](_0x5a606f[_0x494f('0x35')][_0x494f('0x1f')]);_0x344dd7[_0x494f('0x1d')]=qs[_0x494f('0x1d')](_0x5a606f[_0x494f('0x35')]['offset']);}_0x344dd7['order']=qs[_0x494f('0x3c')](_0x5a606f[_0x494f('0x35')][_0x494f('0x3c')]);_0x344dd7[_0x494f('0x3d')]=qs[_0x494f('0x3e')](_[_0x494f('0x3f')](_0x5a606f[_0x494f('0x35')],_0x28a029[_0x494f('0x3e')]),_0x1dec51);if(_0x5a606f[_0x494f('0x35')][_0x494f('0x40')]){_0x344dd7[_0x494f('0x3d')]=_[_0x494f('0x41')](_0x344dd7[_0x494f('0x3d')],{'$or':_[_0x494f('0x2e')](_0x1dec51,function(_0x2bbcce){if(_0x2bbcce[_0x494f('0x32')]!==_0x494f('0x42')){var _0xc7c151={};_0xc7c151[_0x2bbcce['name']]={'$like':'%'+_0x5a606f['query']['filter']+'%'};return _0xc7c151;}})});}_0x344dd7=_[_0x494f('0x41')]({},_0x344dd7,_0x5a606f[_0x494f('0x43')]);var _0x3b5431={'where':_0x344dd7['where']};return db[_0x494f('0x2f')]['count'](_0x3b5431)[_0x494f('0x27')](function(_0x4f23de){_0x207b47[_0x494f('0x20')]=_0x4f23de;if(_0x5a606f['query']['includeAll']){_0x344dd7[_0x494f('0x44')]=[{'all':!![]}];}return db[_0x494f('0x2f')][_0x494f('0x45')](_0x344dd7);})[_0x494f('0x27')](function(_0x3dbb90){_0x207b47[_0x494f('0x46')]=_0x3dbb90;return _0x207b47;})['then'](respondWithFilteredResult(_0x2fbe35,_0x344dd7))[_0x494f('0x47')](handleError(_0x2fbe35,null));};exports['show']=function(_0x5e69d8,_0x4ca8af){var _0x472ce9={'raw':![],'where':{'id':_0x5e69d8[_0x494f('0x48')]['id']}},_0x35255b={};_0x35255b[_0x494f('0x34')]=_[_0x494f('0x36')](db[_0x494f('0x2f')][_0x494f('0x30')]);_0x35255b[_0x494f('0x35')]=_['keys'](_0x5e69d8[_0x494f('0x35')]);_0x35255b[_0x494f('0x3e')]=_[_0x494f('0x38')](_0x35255b[_0x494f('0x34')],_0x35255b[_0x494f('0x35')]);_0x472ce9[_0x494f('0x37')]=_['intersection'](_0x35255b[_0x494f('0x34')],qs[_0x494f('0x39')](_0x5e69d8['query']['fields']));_0x472ce9[_0x494f('0x37')]=_0x472ce9[_0x494f('0x37')][_0x494f('0x3a')]?_0x472ce9['attributes']:_0x35255b['model'];if(_0x5e69d8[_0x494f('0x35')][_0x494f('0x49')]){_0x472ce9['include']=[{'all':!![]}];}_0x472ce9=_[_0x494f('0x41')]({},_0x472ce9,_0x5e69d8[_0x494f('0x43')]);return db[_0x494f('0x2f')][_0x494f('0x4a')](_0x472ce9)[_0x494f('0x27')](handleEntityNotFound(_0x4ca8af,null))[_0x494f('0x27')](respondWithResult(_0x4ca8af,null))[_0x494f('0x47')](handleError(_0x4ca8af,null));};exports['create']=function(_0x1603b3,_0x4b9ae7){return db[_0x494f('0x2f')][_0x494f('0x4b')](_0x1603b3['body'],{})[_0x494f('0x27')](respondWithResult(_0x4b9ae7,0xc9))[_0x494f('0x47')](handleError(_0x4b9ae7,null));};exports[_0x494f('0x26')]=function(_0x253e73,_0x44c6b1){if(_0x253e73[_0x494f('0x4c')]['id']){delete _0x253e73[_0x494f('0x4c')]['id'];}return db[_0x494f('0x2f')]['find']({'where':{'id':_0x253e73[_0x494f('0x48')]['id']}})[_0x494f('0x27')](handleEntityNotFound(_0x44c6b1,null))[_0x494f('0x27')](saveUpdates(_0x253e73[_0x494f('0x4c')],null))[_0x494f('0x27')](respondWithResult(_0x44c6b1,null))['catch'](handleError(_0x44c6b1,null));};exports[_0x494f('0x28')]=function(_0x3bb375,_0x2c3497){return db[_0x494f('0x2f')][_0x494f('0x4a')]({'where':{'id':_0x3bb375[_0x494f('0x48')]['id']}})['then'](handleEntityNotFound(_0x2c3497,null))[_0x494f('0x27')](removeEntity(_0x2c3497,null))[_0x494f('0x47')](handleError(_0x2c3497,null));};exports[_0x494f('0x4d')]=function(_0x37edcc,_0x3b8cb0,_0xbd7974){var _0x3b4549={};var _0x2177a4={};var _0x437716;var _0x2d80ef;return db[_0x494f('0x2f')][_0x494f('0x4e')]({'where':{'id':_0x37edcc[_0x494f('0x48')]['id']}})[_0x494f('0x27')](handleEntityNotFound(_0x3b8cb0,null))[_0x494f('0x27')](function(_0x4c3d69){if(_0x4c3d69){_0x437716=_0x4c3d69;_0x2177a4[_0x494f('0x34')]=_[_0x494f('0x36')](db[_0x494f('0x4f')][_0x494f('0x30')]);_0x2177a4['query']=_['keys'](_0x37edcc[_0x494f('0x35')]);_0x2177a4['filters']=_[_0x494f('0x38')](_0x2177a4['model'],_0x2177a4[_0x494f('0x35')]);_0x3b4549['attributes']=_['intersection'](_0x2177a4[_0x494f('0x34')],qs[_0x494f('0x39')](_0x37edcc['query'][_0x494f('0x39')]));_0x3b4549[_0x494f('0x37')]=_0x3b4549['attributes'][_0x494f('0x3a')]?_0x3b4549[_0x494f('0x37')]:_0x2177a4['model'];_0x3b4549['order']=qs[_0x494f('0x3c')](_0x37edcc['query'][_0x494f('0x3c')]);_0x3b4549[_0x494f('0x3d')]=qs[_0x494f('0x3e')](_[_0x494f('0x3f')](_0x37edcc['query'],_0x2177a4[_0x494f('0x3e')]));if(_0x37edcc['query'][_0x494f('0x40')]){_0x3b4549[_0x494f('0x3d')]=_[_0x494f('0x41')](_0x3b4549['where'],{'$or':_['map'](_0x3b4549[_0x494f('0x37')],function(_0x5a57db){var _0x5505b4={};_0x5505b4[_0x5a57db]={'$like':'%'+_0x37edcc['query'][_0x494f('0x40')]+'%'};return _0x5505b4;})});}_0x3b4549=_[_0x494f('0x41')]({},_0x3b4549,_0x37edcc[_0x494f('0x43')]);return _0x437716[_0x494f('0x4d')](_0x3b4549);}})[_0x494f('0x27')](function(_0x1c3398){if(_0x1c3398){_0x2d80ef=_0x1c3398[_0x494f('0x3a')];if(!_0x37edcc['query'][_0x494f('0x50')](_0x494f('0x3b'))){_0x3b4549[_0x494f('0x1f')]=qs[_0x494f('0x1f')](_0x37edcc[_0x494f('0x35')][_0x494f('0x1f')]);_0x3b4549['offset']=qs[_0x494f('0x1d')](_0x37edcc[_0x494f('0x35')]['offset']);}return _0x437716[_0x494f('0x4d')](_0x3b4549);}})[_0x494f('0x27')](function(_0x47f4d8){if(_0x47f4d8){return _0x47f4d8?{'count':_0x2d80ef,'rows':_0x47f4d8}:null;}})[_0x494f('0x27')](respondWithResult(_0x3b8cb0,null))[_0x494f('0x47')](handleError(_0x3b8cb0,null));};exports[_0x494f('0x51')]=function(_0x18bd6d,_0x73039,_0xce02e6){var _0x51e999={};var _0x423a7c={};var _0x39a755;var _0x56f24b;return db[_0x494f('0x2f')][_0x494f('0x4e')]({'where':{'id':_0x18bd6d[_0x494f('0x48')]['id']}})[_0x494f('0x27')](handleEntityNotFound(_0x73039,null))['then'](function(_0x3cdfee){if(_0x3cdfee){_0x39a755=_0x3cdfee;_0x423a7c['model']=_['keys'](db[_0x494f('0x4f')][_0x494f('0x30')]);_0x423a7c['query']=_['keys'](_0x18bd6d[_0x494f('0x35')]);_0x423a7c['filters']=_[_0x494f('0x38')](_0x423a7c[_0x494f('0x34')],_0x423a7c[_0x494f('0x35')]);_0x51e999['attributes']=_['intersection'](_0x423a7c[_0x494f('0x34')],qs[_0x494f('0x39')](_0x18bd6d[_0x494f('0x35')][_0x494f('0x39')]));_0x51e999['attributes']=_0x51e999[_0x494f('0x37')][_0x494f('0x3a')]?_0x51e999['attributes']:_0x423a7c['model'];_0x51e999['order']=qs[_0x494f('0x3c')](_0x18bd6d[_0x494f('0x35')][_0x494f('0x3c')]);_0x51e999[_0x494f('0x3d')]=qs['filters'](_[_0x494f('0x3f')](_0x18bd6d[_0x494f('0x35')],_0x423a7c[_0x494f('0x3e')]));if(_0x18bd6d[_0x494f('0x35')]['filter']){_0x51e999[_0x494f('0x3d')]=_['merge'](_0x51e999['where'],{'$or':_[_0x494f('0x2e')](_0x51e999[_0x494f('0x37')],function(_0x2a5902){var _0x44631c={};_0x44631c[_0x2a5902]={'$like':'%'+_0x18bd6d[_0x494f('0x35')][_0x494f('0x40')]+'%'};return _0x44631c;})});}_0x51e999=_['merge']({},_0x51e999,_0x18bd6d['options']);return _0x39a755[_0x494f('0x51')](_0x51e999);}})[_0x494f('0x27')](function(_0x369341){if(_0x369341){_0x56f24b=_0x369341[_0x494f('0x3a')];if(!_0x18bd6d[_0x494f('0x35')][_0x494f('0x50')](_0x494f('0x3b'))){_0x51e999[_0x494f('0x1f')]=qs[_0x494f('0x1f')](_0x18bd6d['query'][_0x494f('0x1f')]);_0x51e999[_0x494f('0x1d')]=qs[_0x494f('0x1d')](_0x18bd6d[_0x494f('0x35')][_0x494f('0x1d')]);}return _0x39a755['getDescriptions'](_0x51e999);}})['then'](function(_0x477606){if(_0x477606){return _0x477606?{'count':_0x56f24b,'rows':_0x477606}:null;}})[_0x494f('0x27')](respondWithResult(_0x73039,null))[_0x494f('0x47')](handleError(_0x73039,null));};exports[_0x494f('0x52')]=function(_0x4a2764,_0x4799e7,_0x40cbc9){var _0x27097c={};var _0xa2cc06={};var _0x1a85d6;var _0x3ece0b;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x4a2764[_0x494f('0x48')]['id']}})[_0x494f('0x27')](handleEntityNotFound(_0x4799e7,null))[_0x494f('0x27')](function(_0x285f05){if(_0x285f05){_0x1a85d6=_0x285f05;_0xa2cc06[_0x494f('0x34')]=_[_0x494f('0x36')](db['FreshsalesField'][_0x494f('0x30')]);_0xa2cc06[_0x494f('0x35')]=_[_0x494f('0x36')](_0x4a2764[_0x494f('0x35')]);_0xa2cc06['filters']=_[_0x494f('0x38')](_0xa2cc06[_0x494f('0x34')],_0xa2cc06[_0x494f('0x35')]);_0x27097c['attributes']=_['intersection'](_0xa2cc06[_0x494f('0x34')],qs[_0x494f('0x39')](_0x4a2764[_0x494f('0x35')]['fields']));_0x27097c[_0x494f('0x37')]=_0x27097c['attributes'][_0x494f('0x3a')]?_0x27097c['attributes']:_0xa2cc06[_0x494f('0x34')];_0x27097c[_0x494f('0x53')]=qs[_0x494f('0x3c')](_0x4a2764[_0x494f('0x35')][_0x494f('0x3c')]);_0x27097c[_0x494f('0x3d')]=qs[_0x494f('0x3e')](_['pick'](_0x4a2764[_0x494f('0x35')],_0xa2cc06['filters']));if(_0x4a2764['query'][_0x494f('0x40')]){_0x27097c[_0x494f('0x3d')]=_['merge'](_0x27097c['where'],{'$or':_[_0x494f('0x2e')](_0x27097c[_0x494f('0x37')],function(_0x5159b2){var _0x513759={};_0x513759[_0x5159b2]={'$like':'%'+_0x4a2764['query'][_0x494f('0x40')]+'%'};return _0x513759;})});}_0x27097c=_['merge']({},_0x27097c,_0x4a2764[_0x494f('0x43')]);return _0x1a85d6[_0x494f('0x52')](_0x27097c);}})[_0x494f('0x27')](function(_0x3b4153){if(_0x3b4153){_0x3ece0b=_0x3b4153['length'];if(!_0x4a2764[_0x494f('0x35')]['hasOwnProperty'](_0x494f('0x3b'))){_0x27097c[_0x494f('0x1f')]=qs[_0x494f('0x1f')](_0x4a2764[_0x494f('0x35')][_0x494f('0x1f')]);_0x27097c[_0x494f('0x1d')]=qs[_0x494f('0x1d')](_0x4a2764[_0x494f('0x35')][_0x494f('0x1d')]);}return _0x1a85d6[_0x494f('0x52')](_0x27097c);}})['then'](function(_0x1cdff9){if(_0x1cdff9){return _0x1cdff9?{'count':_0x3ece0b,'rows':_0x1cdff9}:null;}})[_0x494f('0x27')](respondWithResult(_0x4799e7,null))[_0x494f('0x47')](handleError(_0x4799e7,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index d35d46c..31ec62f 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 _0x33ed=['define','FreshsalesConfiguration','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./intFreshsalesConfiguration.attributes','exports'];(function(_0x46de75,_0x3d7d51){var _0x2d64b3=function(_0x2b6597){while(--_0x2b6597){_0x46de75['push'](_0x46de75['shift']());}};_0x2d64b3(++_0x3d7d51);}(_0x33ed,0x1ee));var _0xd33e=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0x33ed[_0x5627e1];return _0x2f013f;};'use strict';var _=require(_0xd33e('0x0'));var util=require(_0xd33e('0x1'));var logger=require(_0xd33e('0x2'))(_0xd33e('0x3'));var moment=require(_0xd33e('0x4'));var BPromise=require('bluebird');var rp=require(_0xd33e('0x5'));var fs=require('fs');var path=require(_0xd33e('0x6'));var rimraf=require('rimraf');var config=require(_0xd33e('0x7'));var attributes=require(_0xd33e('0x8'));module[_0xd33e('0x9')]=function(_0xce989f,_0x3ff341){return _0xce989f[_0xd33e('0xa')](_0xd33e('0xb'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a2d=['exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes'];(function(_0x261e97,_0x26cfb9){var _0x360107=function(_0x59181e){while(--_0x59181e){_0x261e97['push'](_0x261e97['shift']());}};_0x360107(++_0x26cfb9);}(_0x5a2d,0xc8));var _0xd5a2=function(_0x221272,_0x29146a){_0x221272=_0x221272-0x0;var _0xe0a9d7=_0x5a2d[_0x221272];return _0xe0a9d7;};'use strict';var _=require(_0xd5a2('0x0'));var util=require(_0xd5a2('0x1'));var logger=require('../../config/logger')(_0xd5a2('0x2'));var moment=require(_0xd5a2('0x3'));var BPromise=require(_0xd5a2('0x4'));var rp=require(_0xd5a2('0x5'));var fs=require('fs');var path=require(_0xd5a2('0x6'));var rimraf=require(_0xd5a2('0x7'));var config=require(_0xd5a2('0x8'));var attributes=require(_0xd5a2('0x9'));module[_0xd5a2('0xa')]=function(_0x3d7454,_0x391331){return _0x3d7454[_0xd5a2('0xb')](_0xd5a2('0xc'),attributes,{'tableName':_0xd5a2('0xd'),'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 b13ea55..a7d8ed6 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 _0x0ebe=['request','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','message','info','result','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http'];(function(_0x1cc0ef,_0x220489){var _0x27991f=function(_0x111b70){while(--_0x111b70){_0x1cc0ef['push'](_0x1cc0ef['shift']());}};_0x27991f(++_0x220489);}(_0x0ebe,0x1e5));var _0xe0eb=function(_0x283642,_0x299a96){_0x283642=_0x283642-0x0;var _0x287ab3=_0x0ebe[_0x283642];return _0x287ab3;};'use strict';var _=require(_0xe0eb('0x0'));var util=require(_0xe0eb('0x1'));var moment=require('moment');var BPromise=require(_0xe0eb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe0eb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe0eb('0x4'));var logger=require(_0xe0eb('0x5'))('rpc');var config=require(_0xe0eb('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xe0eb('0x7')][_0xe0eb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x91658f,_0x21085a,_0x2b5f1b){return new BPromise(function(_0x492972,_0x3bf4b7){return client[_0xe0eb('0x9')](_0x91658f,_0x2b5f1b)[_0xe0eb('0xa')](function(_0x51a9fc){logger['info'](_0xe0eb('0xb'),_0x21085a,_0xe0eb('0xc'));logger[_0xe0eb('0xd')](_0xe0eb('0xe'),_0x21085a,_0xe0eb('0xc'),JSON['stringify'](_0x51a9fc));if(_0x51a9fc[_0xe0eb('0xf')]){if(_0x51a9fc[_0xe0eb('0xf')]['code']===0x1f4){logger[_0xe0eb('0xf')](_0xe0eb('0xb'),_0x21085a,_0x51a9fc[_0xe0eb('0xf')][_0xe0eb('0x10')]);return _0x3bf4b7(_0x51a9fc['error'][_0xe0eb('0x10')]);}logger[_0xe0eb('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x21085a,_0x51a9fc[_0xe0eb('0xf')][_0xe0eb('0x10')]);return _0x492972(_0x51a9fc[_0xe0eb('0xf')][_0xe0eb('0x10')]);}else{logger[_0xe0eb('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x21085a,'request\x20sent');_0x492972(_0x51a9fc[_0xe0eb('0x12')]['message']);}})['catch'](function(_0x3ded4a){logger[_0xe0eb('0xf')](_0xe0eb('0xb'),_0x21085a,_0x3ded4a);_0x3bf4b7(_0x3ded4a);});});} \ No newline at end of file +var _0x68e1=['FreshsalesConfiguration,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','client','http','then'];(function(_0x41c0cd,_0x17db4a){var _0x31454e=function(_0x53029b){while(--_0x53029b){_0x41c0cd['push'](_0x41c0cd['shift']());}};_0x31454e(++_0x17db4a);}(_0x68e1,0xff));var _0x168e=function(_0x3cbc72,_0x48ec89){_0x3cbc72=_0x3cbc72-0x0;var _0x37cb03=_0x68e1[_0x3cbc72];return _0x37cb03;};'use strict';var _=require(_0x168e('0x0'));var util=require(_0x168e('0x1'));var moment=require(_0x168e('0x2'));var BPromise=require(_0x168e('0x3'));var rs=require(_0x168e('0x4'));var fs=require('fs');var Redis=require(_0x168e('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x168e('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x168e('0x7'));var client=jayson[_0x168e('0x8')][_0x168e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2bd3ed,_0x225dde,_0x1ccd52){return new BPromise(function(_0x12252a,_0x143c08){return client['request'](_0x2bd3ed,_0x1ccd52)[_0x168e('0xa')](function(_0x305dec){logger['info'](_0x168e('0xb'),_0x225dde,'request\x20sent');logger[_0x168e('0xc')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x225dde,_0x168e('0xd'),JSON['stringify'](_0x305dec));if(_0x305dec[_0x168e('0xe')]){if(_0x305dec[_0x168e('0xe')][_0x168e('0xf')]===0x1f4){logger['error'](_0x168e('0xb'),_0x225dde,_0x305dec[_0x168e('0xe')][_0x168e('0x10')]);return _0x143c08(_0x305dec['error'][_0x168e('0x10')]);}logger['error'](_0x168e('0xb'),_0x225dde,_0x305dec[_0x168e('0xe')][_0x168e('0x10')]);return _0x12252a(_0x305dec[_0x168e('0xe')][_0x168e('0x10')]);}else{logger[_0x168e('0x11')](_0x168e('0xb'),_0x225dde,_0x168e('0xd'));_0x12252a(_0x305dec['result']['message']);}})[_0x168e('0x12')](function(_0x57a002){logger['error'](_0x168e('0xb'),_0x225dde,_0x57a002);_0x143c08(_0x57a002);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 324e086..7a55bd2 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 _0x44a3=['put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','post','create'];(function(_0x548e15,_0x3c7f3f){var _0x1d7e36=function(_0x1ecb55){while(--_0x1ecb55){_0x548e15['push'](_0x548e15['shift']());}};_0x1d7e36(++_0x3c7f3f);}(_0x44a3,0x1a9));var _0x344a=function(_0x5ee300,_0x59f054){_0x5ee300=_0x5ee300-0x0;var _0x15717b=_0x44a3[_0x5ee300];return _0x15717b;};'use strict';var multer=require(_0x344a('0x0'));var util=require(_0x344a('0x1'));var path=require(_0x344a('0x2'));var timeout=require(_0x344a('0x3'));var express=require(_0x344a('0x4'));var router=express[_0x344a('0x5')]();var fs_extra=require(_0x344a('0x6'));var auth=require(_0x344a('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x344a('0x8'));var controller=require(_0x344a('0x9'));router[_0x344a('0xa')]('/',auth[_0x344a('0xb')](),controller[_0x344a('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x344a('0xd')]('/',auth[_0x344a('0xb')](),controller[_0x344a('0xe')]);router[_0x344a('0xf')](_0x344a('0x10'),auth['isAuthenticated'](),controller[_0x344a('0x11')]);router[_0x344a('0x12')]('/:id',auth[_0x344a('0xb')](),controller['destroy']);module[_0x344a('0x13')]=router; \ No newline at end of file +var _0xe706=['put','update','delete','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x35007a,_0x58a0d4){var _0x574f68=function(_0xd1c129){while(--_0xd1c129){_0x35007a['push'](_0x35007a['shift']());}};_0x574f68(++_0x58a0d4);}(_0xe706,0xa3));var _0x6e70=function(_0x3ae96c,_0x5f1e7e){_0x3ae96c=_0x3ae96c-0x0;var _0x1b0c90=_0xe706[_0x3ae96c];return _0x1b0c90;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xf')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 9a8899e..fa665b0 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 _0x9213=['STRING','ENUM','BOOLEAN','sequelize','variable','customVariable','keyValue','picklist','string'];(function(_0xe96f9a,_0x48e483){var _0x243558=function(_0x1ebf12){while(--_0x1ebf12){_0xe96f9a['push'](_0xe96f9a['shift']());}};_0x243558(++_0x48e483);}(_0x9213,0x11a));var _0x3921=function(_0x44c935,_0x3653f0){_0x44c935=_0x44c935-0x0;var _0x465bee=_0x9213[_0x44c935];return _0x465bee;};'use strict';var Sequelize=require(_0x3921('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string',_0x3921('0x1'),_0x3921('0x2'),_0x3921('0x3'),_0x3921('0x4')),'defaultValue':_0x3921('0x5')},'content':{'type':Sequelize[_0x3921('0x6')]},'key':{'type':Sequelize[_0x3921('0x6')]},'keyType':{'type':Sequelize[_0x3921('0x7')](_0x3921('0x5'),_0x3921('0x1'),_0x3921('0x2'))},'keyContent':{'type':Sequelize[_0x3921('0x6')]},'idField':{'type':Sequelize[_0x3921('0x6')]},'nameField':{'type':Sequelize[_0x3921('0x6')]},'customField':{'type':Sequelize[_0x3921('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3921('0x6')]}}; \ No newline at end of file +var _0x299e=['sequelize','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN'];(function(_0xa64d7a,_0x215036){var _0x27ef5a=function(_0x34ace6){while(--_0x34ace6){_0xa64d7a['push'](_0xa64d7a['shift']());}};_0x27ef5a(++_0x215036);}(_0x299e,0x1d0));var _0xe299=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x299e[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0xe299('0x0'));module['exports']={'type':{'type':Sequelize[_0xe299('0x1')](_0xe299('0x2'),_0xe299('0x3'),_0xe299('0x4'),_0xe299('0x5'),'picklist'),'defaultValue':_0xe299('0x2')},'content':{'type':Sequelize[_0xe299('0x6')]},'key':{'type':Sequelize[_0xe299('0x6')]},'keyType':{'type':Sequelize[_0xe299('0x1')](_0xe299('0x2'),_0xe299('0x3'),_0xe299('0x4'))},'keyContent':{'type':Sequelize[_0xe299('0x6')]},'idField':{'type':Sequelize[_0xe299('0x6')]},'nameField':{'type':Sequelize[_0xe299('0x6')]},'customField':{'type':Sequelize[_0xe299('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe299('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index f0a7334..2592c15 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 _0x57b7=['send','map','FreshsalesField','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','includeAll','find','create','body','destroy','params','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','reject','update','then','error','name'];(function(_0x1da7b,_0x3ce5ec){var _0x4bf8e3=function(_0x21bed2){while(--_0x21bed2){_0x1da7b['push'](_0x1da7b['shift']());}};_0x4bf8e3(++_0x3ce5ec);}(_0x57b7,0xf7));var _0x757b=function(_0x303ec0,_0xc18c1c){_0x303ec0=_0x303ec0-0x0;var _0x46e97d=_0x57b7[_0x303ec0];return _0x46e97d;};'use strict';var emlformat=require(_0x757b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x757b('0x1'));var moment=require(_0x757b('0x2'));var BPromise=require(_0x757b('0x3'));var Mustache=require(_0x757b('0x4'));var util=require(_0x757b('0x5'));var path=require(_0x757b('0x6'));var sox=require(_0x757b('0x7'));var csv=require(_0x757b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x757b('0x9'));var _=require(_0x757b('0xa'));var squel=require(_0x757b('0xb'));var crypto=require(_0x757b('0xc'));var jsforce=require(_0x757b('0xd'));var deskjs=require(_0x757b('0xe'));var toCsv=require(_0x757b('0x8'));var querystring=require('querystring');var Papa=require(_0x757b('0xf'));var Redis=require(_0x757b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x757b('0x11'));var as=require(_0x757b('0x12'));var hardwareService=require(_0x757b('0x13'));var logger=require(_0x757b('0x14'))(_0x757b('0x15'));var utils=require(_0x757b('0x16'));var config=require(_0x757b('0x17'));var licenseUtil=require(_0x757b('0x18'));var db=require(_0x757b('0x19'))['db'];function respondWithStatusCode(_0x48ea15,_0x7f67c8){_0x7f67c8=_0x7f67c8||0xcc;return function(_0x1f313e){if(_0x1f313e){return _0x48ea15[_0x757b('0x1a')](_0x7f67c8);}return _0x48ea15[_0x757b('0x1b')](_0x7f67c8)['end']();};}function respondWithResult(_0x3b3243,_0x16936e){_0x16936e=_0x16936e||0xc8;return function(_0x3bb5a3){if(_0x3bb5a3){return _0x3b3243['status'](_0x16936e)[_0x757b('0x1c')](_0x3bb5a3);}};}function respondWithFilteredResult(_0x1e7f67,_0x4080bb){return function(_0x14c7e8){if(_0x14c7e8){var _0x412685=typeof _0x4080bb['offset']===_0x757b('0x1d')&&typeof _0x4080bb[_0x757b('0x1e')]===_0x757b('0x1d');var _0x5c02b1=_0x14c7e8[_0x757b('0x1f')];var _0x2bf0f3=_0x412685?0x0:_0x4080bb['offset'];var _0x3f5ec7=_0x412685?_0x14c7e8['count']:_0x4080bb['offset']+_0x4080bb[_0x757b('0x1e')];var _0x1d60f5;if(_0x3f5ec7>=_0x5c02b1){_0x3f5ec7=_0x5c02b1;_0x1d60f5=0xc8;}else{_0x1d60f5=0xce;}_0x1e7f67[_0x757b('0x1b')](_0x1d60f5);return _0x1e7f67['set']('Content-Range',_0x2bf0f3+'-'+_0x3f5ec7+'/'+_0x5c02b1)['json'](_0x14c7e8);}return null;};}function patchUpdates(_0x1798f7){return function(_0x317947){try{jsonpatch['apply'](_0x317947,_0x1798f7,!![]);}catch(_0x45c061){return BPromise[_0x757b('0x20')](_0x45c061);}return _0x317947['save']();};}function saveUpdates(_0x315eca,_0x220438){return function(_0x515599){if(_0x515599){return _0x515599[_0x757b('0x21')](_0x315eca)['then'](function(_0x4bfdc7){return _0x4bfdc7;});}return null;};}function removeEntity(_0x39ce3,_0x428971){return function(_0x3a010d){if(_0x3a010d){return _0x3a010d['destroy']()[_0x757b('0x22')](function(){_0x39ce3[_0x757b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x377f70,_0x4d9a93){return function(_0x974c6e){if(!_0x974c6e){_0x377f70['sendStatus'](0x194);}return _0x974c6e;};}function handleError(_0x7287ff,_0x415e68){_0x415e68=_0x415e68||0x1f4;return function(_0x37e262){logger[_0x757b('0x23')](_0x37e262['stack']);if(_0x37e262[_0x757b('0x24')]){delete _0x37e262[_0x757b('0x24')];}_0x7287ff[_0x757b('0x1b')](_0x415e68)[_0x757b('0x25')](_0x37e262);};}exports['index']=function(_0x21f1c6,_0x5c9172){var _0x5422c0={},_0x40b63f={},_0x447ba2={'count':0x0,'rows':[]};var _0x5654d1=_[_0x757b('0x26')](db[_0x757b('0x27')][_0x757b('0x28')],function(_0xd5aa16){return{'name':_0xd5aa16['fieldName'],'type':_0xd5aa16[_0x757b('0x29')][_0x757b('0x2a')]};});_0x40b63f[_0x757b('0x2b')]=_[_0x757b('0x26')](_0x5654d1,'name');_0x40b63f[_0x757b('0x2c')]=_[_0x757b('0x2d')](_0x21f1c6[_0x757b('0x2c')]);_0x40b63f[_0x757b('0x2e')]=_['intersection'](_0x40b63f['model'],_0x40b63f[_0x757b('0x2c')]);_0x5422c0[_0x757b('0x2f')]=_[_0x757b('0x30')](_0x40b63f[_0x757b('0x2b')],qs[_0x757b('0x31')](_0x21f1c6['query'][_0x757b('0x31')]));_0x5422c0[_0x757b('0x2f')]=_0x5422c0['attributes'][_0x757b('0x32')]?_0x5422c0[_0x757b('0x2f')]:_0x40b63f[_0x757b('0x2b')];if(!_0x21f1c6[_0x757b('0x2c')][_0x757b('0x33')](_0x757b('0x34'))){_0x5422c0[_0x757b('0x1e')]=qs[_0x757b('0x1e')](_0x21f1c6[_0x757b('0x2c')]['limit']);_0x5422c0[_0x757b('0x35')]=qs['offset'](_0x21f1c6[_0x757b('0x2c')][_0x757b('0x35')]);}_0x5422c0['order']=qs[_0x757b('0x36')](_0x21f1c6[_0x757b('0x2c')]['sort']);_0x5422c0[_0x757b('0x37')]=qs['filters'](_[_0x757b('0x38')](_0x21f1c6[_0x757b('0x2c')],_0x40b63f[_0x757b('0x2e')]),_0x5654d1);if(_0x21f1c6[_0x757b('0x2c')]['filter']){_0x5422c0[_0x757b('0x37')]=_['merge'](_0x5422c0['where'],{'$or':_[_0x757b('0x26')](_0x5654d1,function(_0x19b174){if(_0x19b174[_0x757b('0x29')]!=='VIRTUAL'){var _0x11a505={};_0x11a505[_0x19b174['name']]={'$like':'%'+_0x21f1c6[_0x757b('0x2c')][_0x757b('0x39')]+'%'};return _0x11a505;}})});}_0x5422c0=_[_0x757b('0x3a')]({},_0x5422c0,_0x21f1c6[_0x757b('0x3b')]);var _0x51281b={'where':_0x5422c0['where']};return db[_0x757b('0x27')]['count'](_0x51281b)[_0x757b('0x22')](function(_0x539f8d){_0x447ba2[_0x757b('0x1f')]=_0x539f8d;if(_0x21f1c6[_0x757b('0x2c')]['includeAll']){_0x5422c0[_0x757b('0x3c')]=[{'all':!![]}];}return db[_0x757b('0x27')][_0x757b('0x3d')](_0x5422c0);})[_0x757b('0x22')](function(_0x1e2067){_0x447ba2[_0x757b('0x3e')]=_0x1e2067;return _0x447ba2;})['then'](respondWithFilteredResult(_0x5c9172,_0x5422c0))[_0x757b('0x3f')](handleError(_0x5c9172,null));};exports[_0x757b('0x40')]=function(_0xe551e1,_0x252075){var _0x124a3f={'raw':!![],'where':{'id':_0xe551e1['params']['id']}},_0xc1e9f8={};_0xc1e9f8[_0x757b('0x2b')]=_[_0x757b('0x2d')](db[_0x757b('0x27')][_0x757b('0x28')]);_0xc1e9f8[_0x757b('0x2c')]=_[_0x757b('0x2d')](_0xe551e1['query']);_0xc1e9f8[_0x757b('0x2e')]=_[_0x757b('0x30')](_0xc1e9f8[_0x757b('0x2b')],_0xc1e9f8[_0x757b('0x2c')]);_0x124a3f[_0x757b('0x2f')]=_['intersection'](_0xc1e9f8[_0x757b('0x2b')],qs[_0x757b('0x31')](_0xe551e1[_0x757b('0x2c')][_0x757b('0x31')]));_0x124a3f['attributes']=_0x124a3f['attributes']['length']?_0x124a3f[_0x757b('0x2f')]:_0xc1e9f8[_0x757b('0x2b')];if(_0xe551e1['query'][_0x757b('0x41')]){_0x124a3f[_0x757b('0x3c')]=[{'all':!![]}];}_0x124a3f=_[_0x757b('0x3a')]({},_0x124a3f,_0xe551e1['options']);return db[_0x757b('0x27')][_0x757b('0x42')](_0x124a3f)[_0x757b('0x22')](handleEntityNotFound(_0x252075,null))[_0x757b('0x22')](respondWithResult(_0x252075,null))[_0x757b('0x3f')](handleError(_0x252075,null));};exports[_0x757b('0x43')]=function(_0x4b478d,_0x181a4e){return db['FreshsalesField']['create'](_0x4b478d[_0x757b('0x44')],{})['then'](respondWithResult(_0x181a4e,0xc9))['catch'](handleError(_0x181a4e,null));};exports['update']=function(_0x206778,_0x422355){if(_0x206778[_0x757b('0x44')]['id']){delete _0x206778[_0x757b('0x44')]['id'];}return db['FreshsalesField']['find']({'where':{'id':_0x206778['params']['id']}})[_0x757b('0x22')](handleEntityNotFound(_0x422355,null))['then'](saveUpdates(_0x206778[_0x757b('0x44')],null))[_0x757b('0x22')](respondWithResult(_0x422355,null))[_0x757b('0x3f')](handleError(_0x422355,null));};exports[_0x757b('0x45')]=function(_0x460aeb,_0xe0d965){return db['FreshsalesField'][_0x757b('0x42')]({'where':{'id':_0x460aeb[_0x757b('0x46')]['id']}})[_0x757b('0x22')](handleEntityNotFound(_0xe0d965,null))[_0x757b('0x22')](removeEntity(_0xe0d965,null))[_0x757b('0x3f')](handleError(_0xe0d965,null));}; \ No newline at end of file +var _0x74a4=['../../config/utils','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','FreshsalesField','type','key','model','map','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','findAll','rows','catch','show','params','rawAttributes','fields','includeAll','include','options','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0x74a4,0xce));var _0x474a=function(_0xcf1e6a,_0x48c92a){_0xcf1e6a=_0xcf1e6a-0x0;var _0x4a39bc=_0x74a4[_0xcf1e6a];return _0x4a39bc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x474a('0x0'));var zipdir=require(_0x474a('0x1'));var jsonpatch=require(_0x474a('0x2'));var rp=require(_0x474a('0x3'));var moment=require('moment');var BPromise=require(_0x474a('0x4'));var Mustache=require(_0x474a('0x5'));var util=require(_0x474a('0x6'));var path=require(_0x474a('0x7'));var sox=require(_0x474a('0x8'));var csv=require(_0x474a('0x9'));var ejs=require(_0x474a('0xa'));var fs=require('fs');var fs_extra=require(_0x474a('0xb'));var _=require(_0x474a('0xc'));var squel=require(_0x474a('0xd'));var crypto=require('crypto');var jsforce=require(_0x474a('0xe'));var deskjs=require(_0x474a('0xf'));var toCsv=require('to-csv');var querystring=require(_0x474a('0x10'));var Papa=require(_0x474a('0x11'));var Redis=require('ioredis');var authService=require(_0x474a('0x12'));var qs=require(_0x474a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x474a('0x14'))(_0x474a('0x15'));var utils=require(_0x474a('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x474a('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4756ba,_0x2e2239){_0x2e2239=_0x2e2239||0xcc;return function(_0x32d2c4){if(_0x32d2c4){return _0x4756ba[_0x474a('0x18')](_0x2e2239);}return _0x4756ba['status'](_0x2e2239)[_0x474a('0x19')]();};}function respondWithResult(_0x12c7a2,_0x1c9042){_0x1c9042=_0x1c9042||0xc8;return function(_0x3941ce){if(_0x3941ce){return _0x12c7a2[_0x474a('0x1a')](_0x1c9042)[_0x474a('0x1b')](_0x3941ce);}};}function respondWithFilteredResult(_0x8bd092,_0x14473f){return function(_0x1bd83c){if(_0x1bd83c){var _0x413cdc=typeof _0x14473f[_0x474a('0x1c')]===_0x474a('0x1d')&&typeof _0x14473f[_0x474a('0x1e')]===_0x474a('0x1d');var _0x5ed35b=_0x1bd83c[_0x474a('0x1f')];var _0x172a76=_0x413cdc?0x0:_0x14473f[_0x474a('0x1c')];var _0x3bcfbe=_0x413cdc?_0x1bd83c[_0x474a('0x1f')]:_0x14473f[_0x474a('0x1c')]+_0x14473f[_0x474a('0x1e')];var _0x553091;if(_0x3bcfbe>=_0x5ed35b){_0x3bcfbe=_0x5ed35b;_0x553091=0xc8;}else{_0x553091=0xce;}_0x8bd092[_0x474a('0x1a')](_0x553091);return _0x8bd092[_0x474a('0x20')](_0x474a('0x21'),_0x172a76+'-'+_0x3bcfbe+'/'+_0x5ed35b)[_0x474a('0x1b')](_0x1bd83c);}return null;};}function patchUpdates(_0x545d03){return function(_0x436d35){try{jsonpatch[_0x474a('0x22')](_0x436d35,_0x545d03,!![]);}catch(_0x266037){return BPromise[_0x474a('0x23')](_0x266037);}return _0x436d35['save']();};}function saveUpdates(_0x3b4b26,_0x5c3247){return function(_0x286976){if(_0x286976){return _0x286976[_0x474a('0x24')](_0x3b4b26)[_0x474a('0x25')](function(_0x2b4892){return _0x2b4892;});}return null;};}function removeEntity(_0x411c13,_0x119c4f){return function(_0x2e780b){if(_0x2e780b){return _0x2e780b[_0x474a('0x26')]()[_0x474a('0x25')](function(){_0x411c13[_0x474a('0x1a')](0xcc)[_0x474a('0x19')]();});}};}function handleEntityNotFound(_0x13e3ad,_0xe4b885){return function(_0x2f2442){if(!_0x2f2442){_0x13e3ad[_0x474a('0x18')](0x194);}return _0x2f2442;};}function handleError(_0x2338f0,_0x24d562){_0x24d562=_0x24d562||0x1f4;return function(_0x19c39d){logger[_0x474a('0x27')](_0x19c39d[_0x474a('0x28')]);if(_0x19c39d['name']){delete _0x19c39d[_0x474a('0x29')];}_0x2338f0[_0x474a('0x1a')](_0x24d562)[_0x474a('0x2a')](_0x19c39d);};}exports[_0x474a('0x2b')]=function(_0x12ecc7,_0x2ced1c){var _0x43232b={},_0x391482={},_0x21923e={'count':0x0,'rows':[]};var _0x432e75=_['map'](db[_0x474a('0x2c')]['rawAttributes'],function(_0x2302ca){return{'name':_0x2302ca['fieldName'],'type':_0x2302ca[_0x474a('0x2d')][_0x474a('0x2e')]};});_0x391482[_0x474a('0x2f')]=_[_0x474a('0x30')](_0x432e75,_0x474a('0x29'));_0x391482[_0x474a('0x31')]=_[_0x474a('0x32')](_0x12ecc7[_0x474a('0x31')]);_0x391482['filters']=_[_0x474a('0x33')](_0x391482['model'],_0x391482[_0x474a('0x31')]);_0x43232b[_0x474a('0x34')]=_[_0x474a('0x33')](_0x391482[_0x474a('0x2f')],qs['fields'](_0x12ecc7[_0x474a('0x31')]['fields']));_0x43232b['attributes']=_0x43232b[_0x474a('0x34')][_0x474a('0x35')]?_0x43232b[_0x474a('0x34')]:_0x391482[_0x474a('0x2f')];if(!_0x12ecc7[_0x474a('0x31')][_0x474a('0x36')](_0x474a('0x37'))){_0x43232b[_0x474a('0x1e')]=qs[_0x474a('0x1e')](_0x12ecc7['query'][_0x474a('0x1e')]);_0x43232b[_0x474a('0x1c')]=qs[_0x474a('0x1c')](_0x12ecc7[_0x474a('0x31')]['offset']);}_0x43232b[_0x474a('0x38')]=qs[_0x474a('0x39')](_0x12ecc7[_0x474a('0x31')][_0x474a('0x39')]);_0x43232b[_0x474a('0x3a')]=qs[_0x474a('0x3b')](_[_0x474a('0x3c')](_0x12ecc7[_0x474a('0x31')],_0x391482[_0x474a('0x3b')]),_0x432e75);if(_0x12ecc7['query'][_0x474a('0x3d')]){_0x43232b[_0x474a('0x3a')]=_['merge'](_0x43232b[_0x474a('0x3a')],{'$or':_[_0x474a('0x30')](_0x432e75,function(_0x3d68eb){if(_0x3d68eb['type']!==_0x474a('0x3e')){var _0x57af73={};_0x57af73[_0x3d68eb[_0x474a('0x29')]]={'$like':'%'+_0x12ecc7[_0x474a('0x31')][_0x474a('0x3d')]+'%'};return _0x57af73;}})});}_0x43232b=_['merge']({},_0x43232b,_0x12ecc7['options']);var _0x4eb817={'where':_0x43232b[_0x474a('0x3a')]};return db[_0x474a('0x2c')]['count'](_0x4eb817)[_0x474a('0x25')](function(_0x1611bf){_0x21923e[_0x474a('0x1f')]=_0x1611bf;if(_0x12ecc7[_0x474a('0x31')]['includeAll']){_0x43232b['include']=[{'all':!![]}];}return db[_0x474a('0x2c')][_0x474a('0x3f')](_0x43232b);})[_0x474a('0x25')](function(_0x7d2ad){_0x21923e[_0x474a('0x40')]=_0x7d2ad;return _0x21923e;})['then'](respondWithFilteredResult(_0x2ced1c,_0x43232b))[_0x474a('0x41')](handleError(_0x2ced1c,null));};exports[_0x474a('0x42')]=function(_0x49bfd9,_0x3e8d5a){var _0x18a28b={'raw':!![],'where':{'id':_0x49bfd9[_0x474a('0x43')]['id']}},_0x46bcbe={};_0x46bcbe[_0x474a('0x2f')]=_[_0x474a('0x32')](db['FreshsalesField'][_0x474a('0x44')]);_0x46bcbe[_0x474a('0x31')]=_[_0x474a('0x32')](_0x49bfd9[_0x474a('0x31')]);_0x46bcbe[_0x474a('0x3b')]=_[_0x474a('0x33')](_0x46bcbe[_0x474a('0x2f')],_0x46bcbe[_0x474a('0x31')]);_0x18a28b[_0x474a('0x34')]=_[_0x474a('0x33')](_0x46bcbe[_0x474a('0x2f')],qs['fields'](_0x49bfd9['query'][_0x474a('0x45')]));_0x18a28b[_0x474a('0x34')]=_0x18a28b[_0x474a('0x34')][_0x474a('0x35')]?_0x18a28b[_0x474a('0x34')]:_0x46bcbe[_0x474a('0x2f')];if(_0x49bfd9['query'][_0x474a('0x46')]){_0x18a28b[_0x474a('0x47')]=[{'all':!![]}];}_0x18a28b=_['merge']({},_0x18a28b,_0x49bfd9[_0x474a('0x48')]);return db[_0x474a('0x2c')]['find'](_0x18a28b)['then'](handleEntityNotFound(_0x3e8d5a,null))['then'](respondWithResult(_0x3e8d5a,null))[_0x474a('0x41')](handleError(_0x3e8d5a,null));};exports[_0x474a('0x49')]=function(_0x16cf0a,_0x19cc47){return db[_0x474a('0x2c')][_0x474a('0x49')](_0x16cf0a[_0x474a('0x4a')],{})[_0x474a('0x25')](respondWithResult(_0x19cc47,0xc9))[_0x474a('0x41')](handleError(_0x19cc47,null));};exports[_0x474a('0x24')]=function(_0x14e4a1,_0x22a3a5){if(_0x14e4a1[_0x474a('0x4a')]['id']){delete _0x14e4a1[_0x474a('0x4a')]['id'];}return db[_0x474a('0x2c')]['find']({'where':{'id':_0x14e4a1['params']['id']}})[_0x474a('0x25')](handleEntityNotFound(_0x22a3a5,null))['then'](saveUpdates(_0x14e4a1[_0x474a('0x4a')],null))['then'](respondWithResult(_0x22a3a5,null))[_0x474a('0x41')](handleError(_0x22a3a5,null));};exports[_0x474a('0x26')]=function(_0x461a94,_0xb3df4b){return db[_0x474a('0x2c')][_0x474a('0x4b')]({'where':{'id':_0x461a94['params']['id']}})[_0x474a('0x25')](handleEntityNotFound(_0xb3df4b,null))[_0x474a('0x25')](removeEntity(_0xb3df4b,null))[_0x474a('0x41')](handleError(_0xb3df4b,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 1c82c05..25b71c9 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 _0xfd7b=['FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesField.attributes','FreshsalesField','int_freshsales_fields','freshsales_unique_index'];(function(_0x11912e,_0x21f574){var _0x497c14=function(_0x6d085a){while(--_0x6d085a){_0x11912e['push'](_0x11912e['shift']());}};_0x497c14(++_0x21f574);}(_0xfd7b,0xd1));var _0xbfd7=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0xfd7b[_0x42f009];return _0x22a1e0;};'use strict';var _=require(_0xbfd7('0x0'));var util=require(_0xbfd7('0x1'));var logger=require(_0xbfd7('0x2'))('api');var moment=require(_0xbfd7('0x3'));var BPromise=require(_0xbfd7('0x4'));var rp=require(_0xbfd7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbfd7('0x6'));var config=require(_0xbfd7('0x7'));var attributes=require(_0xbfd7('0x8'));module['exports']=function(_0x134ee5,_0x3d054f){return _0x134ee5['define'](_0xbfd7('0x9'),attributes,{'tableName':_0xbfd7('0xa'),'paranoid':![],'indexes':[{'name':_0xbfd7('0xb'),'fields':['idField',_0xbfd7('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x93e9=['request-promise','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4cc176,_0x5e189d){var _0x1c9778=function(_0x107079){while(--_0x107079){_0x4cc176['push'](_0x4cc176['shift']());}};_0x1c9778(++_0x5e189d);}(_0x93e9,0xcc));var _0x993e=function(_0x5c3fbb,_0x52ecd5){_0x5c3fbb=_0x5c3fbb-0x0;var _0x27ebe3=_0x93e9[_0x5c3fbb];return _0x27ebe3;};'use strict';var _=require(_0x993e('0x0'));var util=require(_0x993e('0x1'));var logger=require(_0x993e('0x2'))(_0x993e('0x3'));var moment=require(_0x993e('0x4'));var BPromise=require(_0x993e('0x5'));var rp=require(_0x993e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x993e('0x7'));var attributes=require(_0x993e('0x8'));module[_0x993e('0x9')]=function(_0x45f52e,_0x1da414){return _0x45f52e[_0x993e('0xa')](_0x993e('0xb'),attributes,{'tableName':_0x993e('0xc'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x993e('0xd'),_0x993e('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 4dfa7f4..cd06794 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 _0x5d58=['ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x152678,_0x11e0ac){var _0x311a9=function(_0x4f5291){while(--_0x4f5291){_0x152678['push'](_0x152678['shift']());}};_0x311a9(++_0x11e0ac);}(_0x5d58,0x187));var _0x85d5=function(_0x5e6a1f,_0x536b8d){_0x5e6a1f=_0x5e6a1f-0x0;var _0x56a23a=_0x5d58[_0x5e6a1f];return _0x56a23a;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x85d5('0x0'));var db=require(_0x85d5('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0x85d5('0x2'))(_0x85d5('0x3'));var config=require('../../config/environment');var jayson=require(_0x85d5('0x4'));var client=jayson[_0x85d5('0x5')][_0x85d5('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x46e7b4,_0x5f47ec,_0x98c963){return new BPromise(function(_0x3fecca,_0x4ca293){return client[_0x85d5('0x7')](_0x46e7b4,_0x98c963)['then'](function(_0x1098be){logger[_0x85d5('0x8')](_0x85d5('0x9'),_0x5f47ec,'request\x20sent');logger['debug']('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x5f47ec,_0x85d5('0xa'),JSON[_0x85d5('0xb')](_0x1098be));if(_0x1098be[_0x85d5('0xc')]){if(_0x1098be[_0x85d5('0xc')][_0x85d5('0xd')]===0x1f4){logger[_0x85d5('0xc')](_0x85d5('0x9'),_0x5f47ec,_0x1098be['error']['message']);return _0x4ca293(_0x1098be['error'][_0x85d5('0xe')]);}logger[_0x85d5('0xc')](_0x85d5('0x9'),_0x5f47ec,_0x1098be[_0x85d5('0xc')][_0x85d5('0xe')]);return _0x3fecca(_0x1098be[_0x85d5('0xc')][_0x85d5('0xe')]);}else{logger['info'](_0x85d5('0x9'),_0x5f47ec,_0x85d5('0xa'));_0x3fecca(_0x1098be[_0x85d5('0xf')][_0x85d5('0xe')]);}})[_0x85d5('0x10')](function(_0x3dc83c){logger[_0x85d5('0xc')](_0x85d5('0x9'),_0x5f47ec,_0x3dc83c);_0x4ca293(_0x3dc83c);});});} \ No newline at end of file +var _0x4975=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0x4975,0x86));var _0x5497=function(_0x1911de,_0xcda8da){_0x1911de=_0x1911de-0x0;var _0x45c7de=_0x4975[_0x1911de];return _0x45c7de;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var moment=require(_0x5497('0x1'));var BPromise=require(_0x5497('0x2'));var rs=require(_0x5497('0x3'));var fs=require('fs');var Redis=require(_0x5497('0x4'));var db=require(_0x5497('0x5'))['db'];var utils=require(_0x5497('0x6'));var logger=require(_0x5497('0x7'))(_0x5497('0x8'));var config=require(_0x5497('0x9'));var jayson=require(_0x5497('0xa'));var client=jayson['client'][_0x5497('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f563d,_0x1d0019,_0x674a2a){return new BPromise(function(_0x368e8b,_0x57f930){return client[_0x5497('0xc')](_0x4f563d,_0x674a2a)['then'](function(_0x1f63d8){logger[_0x5497('0xd')](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));logger[_0x5497('0x10')](_0x5497('0x11'),_0x1d0019,_0x5497('0xf'),JSON[_0x5497('0x12')](_0x1f63d8));if(_0x1f63d8['error']){if(_0x1f63d8['error']['code']===0x1f4){logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x57f930(_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);}logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x368e8b(_0x1f63d8['error'][_0x5497('0x14')]);}else{logger['info'](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));_0x368e8b(_0x1f63d8[_0x5497('0x15')][_0x5497('0x14')]);}})[_0x5497('0x16')](function(_0x4073e6){logger[_0x5497('0x13')]('FreshsalesField,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index e3147e3..f07daf2 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 _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x4cad28,_0x41949a){var _0xdb808d=function(_0x3ad6f6){while(--_0x3ad6f6){_0x4cad28['push'](_0x4cad28['shift']());}};_0xdb808d(++_0x41949a);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x16ab37,_0x31bc79){var _0x58ace6=function(_0x102930){while(--_0x102930){_0x16ab37['push'](_0x16ab37['shift']());}};_0x58ace6(++_0x31bc79);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 157d0a0..80142e4 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 _0xa467=['newTab','sequelize','exports','STRING','username','ENUM','integrationTab'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xa467,0x143));var _0x7a46=function(_0x25f305,_0x7c1ea5){_0x25f305=_0x25f305-0x0;var _0x49124e=_0xa467[_0x25f305];return _0x49124e;};'use strict';var Sequelize=require(_0x7a46('0x0'));module[_0x7a46('0x1')]={'name':{'type':Sequelize[_0x7a46('0x2')]},'description':{'type':Sequelize[_0x7a46('0x2')]},'username':{'type':Sequelize[_0x7a46('0x2')],'unique':_0x7a46('0x3')},'remoteUri':{'type':Sequelize[_0x7a46('0x2')]},'password':{'type':Sequelize[_0x7a46('0x2')]},'clientId':{'type':Sequelize[_0x7a46('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x7a46('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x7a46('0x4')](_0x7a46('0x5'),_0x7a46('0x6')),'defaultValue':_0x7a46('0x5')}}; \ No newline at end of file +var _0x94e6=['STRING','username','integrationTab','newTab','sequelize'];(function(_0x5d9867,_0x5e9030){var _0x7d2118=function(_0x2e5149){while(--_0x2e5149){_0x5d9867['push'](_0x5d9867['shift']());}};_0x7d2118(++_0x5e9030);}(_0x94e6,0x194));var _0x694e=function(_0x4cc694,_0x54d336){_0x4cc694=_0x4cc694-0x0;var _0x4c29cc=_0x94e6[_0x4cc694];return _0x4c29cc;};'use strict';var Sequelize=require(_0x694e('0x0'));module['exports']={'name':{'type':Sequelize[_0x694e('0x1')]},'description':{'type':Sequelize[_0x694e('0x1')]},'username':{'type':Sequelize[_0x694e('0x1')],'unique':_0x694e('0x2')},'remoteUri':{'type':Sequelize[_0x694e('0x1')]},'password':{'type':Sequelize[_0x694e('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x694e('0x1')]},'securityToken':{'type':Sequelize[_0x694e('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x694e('0x3'),_0x694e('0x4')),'defaultValue':_0x694e('0x3')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 1f62fa3..3e188eb 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 _0x6ab4=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','reject','save','destroy','then','stack','name','SalesforceAccount','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','update','getConfigurations','findOne','SalesforceConfiguration','nolimit','addConfiguration','AccountId','getSubjects','channel','Descriptions','Subjects','SalesforceField','getFields','clientId','clientSecret','username','password','slice','substring','lastIndexOf','Connection','login','securityToken','isNil','ticketType','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Description','string','picklist','email','textarea','phone','remove','includes','label','custom','picklistValues','value','boolean','True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','moment'];(function(_0x479746,_0x574758){var _0x36d2aa=function(_0x27e29d){while(--_0x27e29d){_0x479746['push'](_0x479746['shift']());}};_0x36d2aa(++_0x574758);}(_0x6ab4,0x1f0));var _0x46ab=function(_0x2e5e78,_0x1b2b3e){_0x2e5e78=_0x2e5e78-0x0;var _0x50b947=_0x6ab4[_0x2e5e78];return _0x50b947;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x46ab('0x0'));var zipdir=require(_0x46ab('0x1'));var jsonpatch=require(_0x46ab('0x2'));var rp=require('request-promise');var moment=require(_0x46ab('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x46ab('0x4'));var path=require(_0x46ab('0x5'));var sox=require(_0x46ab('0x6'));var csv=require(_0x46ab('0x7'));var ejs=require(_0x46ab('0x8'));var fs=require('fs');var fs_extra=require(_0x46ab('0x9'));var _=require(_0x46ab('0xa'));var squel=require(_0x46ab('0xb'));var crypto=require(_0x46ab('0xc'));var jsforce=require(_0x46ab('0xd'));var deskjs=require(_0x46ab('0xe'));var toCsv=require(_0x46ab('0x7'));var querystring=require(_0x46ab('0xf'));var Papa=require(_0x46ab('0x10'));var Redis=require(_0x46ab('0x11'));var authService=require(_0x46ab('0x12'));var qs=require(_0x46ab('0x13'));var as=require(_0x46ab('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x46ab('0x15'));var utils=require(_0x46ab('0x16'));var config=require(_0x46ab('0x17'));var licenseUtil=require(_0x46ab('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x46ab('0x19'));function respondWithStatusCode(_0x243f39,_0xe29c75){_0xe29c75=_0xe29c75||0xcc;return function(_0x403784){if(_0x403784){return _0x243f39[_0x46ab('0x1a')](_0xe29c75);}return _0x243f39[_0x46ab('0x1b')](_0xe29c75)[_0x46ab('0x1c')]();};}function respondWithResult(_0x47825e,_0x17dc0a){_0x17dc0a=_0x17dc0a||0xc8;return function(_0x1b708a){if(_0x1b708a){return _0x47825e[_0x46ab('0x1b')](_0x17dc0a)['json'](_0x1b708a);}};}function respondWithFilteredResult(_0x31ee3e,_0x3cba6d){return function(_0xba7b3e){if(_0xba7b3e){var _0x111983=typeof _0x3cba6d['offset']===_0x46ab('0x1d')&&typeof _0x3cba6d[_0x46ab('0x1e')]==='undefined';var _0x566eef=_0xba7b3e[_0x46ab('0x1f')];var _0xa497ae=_0x111983?0x0:_0x3cba6d[_0x46ab('0x20')];var _0x1721a8=_0x111983?_0xba7b3e[_0x46ab('0x1f')]:_0x3cba6d[_0x46ab('0x20')]+_0x3cba6d[_0x46ab('0x1e')];var _0x58ad0f;if(_0x1721a8>=_0x566eef){_0x1721a8=_0x566eef;_0x58ad0f=0xc8;}else{_0x58ad0f=0xce;}_0x31ee3e['status'](_0x58ad0f);return _0x31ee3e[_0x46ab('0x21')]('Content-Range',_0xa497ae+'-'+_0x1721a8+'/'+_0x566eef)[_0x46ab('0x22')](_0xba7b3e);}return null;};}function patchUpdates(_0xf77def){return function(_0x38e3bd){try{jsonpatch[_0x46ab('0x23')](_0x38e3bd,_0xf77def,!![]);}catch(_0x347922){return BPromise[_0x46ab('0x24')](_0x347922);}return _0x38e3bd[_0x46ab('0x25')]();};}function saveUpdates(_0x5c3bc9,_0x13bd3a){return function(_0x586f29){if(_0x586f29){return _0x586f29['update'](_0x5c3bc9)['then'](function(_0x9ad9d0){return _0x9ad9d0;});}return null;};}function removeEntity(_0x1dc810,_0x6cd5e4){return function(_0x270f89){if(_0x270f89){return _0x270f89[_0x46ab('0x26')]()[_0x46ab('0x27')](function(){_0x1dc810[_0x46ab('0x1b')](0xcc)[_0x46ab('0x1c')]();});}};}function handleEntityNotFound(_0x10b852,_0x332026){return function(_0x1e20b7){if(!_0x1e20b7){_0x10b852[_0x46ab('0x1a')](0x194);}return _0x1e20b7;};}function handleError(_0x26496b,_0x33eaca){_0x33eaca=_0x33eaca||0x1f4;return function(_0x5cf7ad){logger['error'](_0x5cf7ad[_0x46ab('0x28')]);if(_0x5cf7ad[_0x46ab('0x29')]){delete _0x5cf7ad['name'];}_0x26496b['status'](_0x33eaca)['send'](_0x5cf7ad);};}exports['index']=function(_0x4a7856,_0x51188b){var _0x19a2d4={},_0x25ab3f={},_0x57b88f={'count':0x0,'rows':[]};var _0x40d6e6=_['map'](db[_0x46ab('0x2a')][_0x46ab('0x2b')],function(_0x41ce1c){return{'name':_0x41ce1c[_0x46ab('0x2c')],'type':_0x41ce1c[_0x46ab('0x2d')][_0x46ab('0x2e')]};});_0x25ab3f[_0x46ab('0x2f')]=_[_0x46ab('0x30')](_0x40d6e6,_0x46ab('0x29'));_0x25ab3f[_0x46ab('0x31')]=_['keys'](_0x4a7856['query']);_0x25ab3f[_0x46ab('0x32')]=_[_0x46ab('0x33')](_0x25ab3f['model'],_0x25ab3f[_0x46ab('0x31')]);_0x19a2d4[_0x46ab('0x34')]=_[_0x46ab('0x33')](_0x25ab3f[_0x46ab('0x2f')],qs[_0x46ab('0x35')](_0x4a7856[_0x46ab('0x31')]['fields']));_0x19a2d4[_0x46ab('0x34')]=_0x19a2d4['attributes'][_0x46ab('0x36')]?_0x19a2d4[_0x46ab('0x34')]:_0x25ab3f['model'];if(!_0x4a7856[_0x46ab('0x31')][_0x46ab('0x37')]('nolimit')){_0x19a2d4[_0x46ab('0x1e')]=qs['limit'](_0x4a7856['query'][_0x46ab('0x1e')]);_0x19a2d4[_0x46ab('0x20')]=qs[_0x46ab('0x20')](_0x4a7856[_0x46ab('0x31')][_0x46ab('0x20')]);}_0x19a2d4[_0x46ab('0x38')]=qs[_0x46ab('0x39')](_0x4a7856['query'][_0x46ab('0x39')]);_0x19a2d4[_0x46ab('0x3a')]=qs[_0x46ab('0x32')](_[_0x46ab('0x3b')](_0x4a7856[_0x46ab('0x31')],_0x25ab3f[_0x46ab('0x32')]),_0x40d6e6);if(_0x4a7856[_0x46ab('0x31')][_0x46ab('0x3c')]){_0x19a2d4[_0x46ab('0x3a')]=_[_0x46ab('0x3d')](_0x19a2d4[_0x46ab('0x3a')],{'$or':_[_0x46ab('0x30')](_0x40d6e6,function(_0x43ab4a){if(_0x43ab4a[_0x46ab('0x2d')]!=='VIRTUAL'){var _0x262370={};_0x262370[_0x43ab4a['name']]={'$like':'%'+_0x4a7856[_0x46ab('0x31')][_0x46ab('0x3c')]+'%'};return _0x262370;}})});}_0x19a2d4=_['merge']({},_0x19a2d4,_0x4a7856[_0x46ab('0x3e')]);var _0x15bb98={'where':_0x19a2d4[_0x46ab('0x3a')]};return db[_0x46ab('0x2a')]['count'](_0x15bb98)['then'](function(_0x236f27){_0x57b88f[_0x46ab('0x1f')]=_0x236f27;if(_0x4a7856['query'][_0x46ab('0x3f')]){_0x19a2d4[_0x46ab('0x40')]=[{'all':!![]}];}return db[_0x46ab('0x2a')][_0x46ab('0x41')](_0x19a2d4);})[_0x46ab('0x27')](function(_0xc134b7){_0x57b88f[_0x46ab('0x42')]=_0xc134b7;return _0x57b88f;})[_0x46ab('0x27')](respondWithFilteredResult(_0x51188b,_0x19a2d4))[_0x46ab('0x43')](handleError(_0x51188b,null));};exports['show']=function(_0xb9e715,_0x1ea573){var _0x4cfa64={'raw':![],'where':{'id':_0xb9e715[_0x46ab('0x44')]['id']}},_0x11b4f8={};_0x11b4f8['model']=_['keys'](db[_0x46ab('0x2a')][_0x46ab('0x2b')]);_0x11b4f8['query']=_[_0x46ab('0x45')](_0xb9e715[_0x46ab('0x31')]);_0x11b4f8['filters']=_[_0x46ab('0x33')](_0x11b4f8['model'],_0x11b4f8['query']);_0x4cfa64[_0x46ab('0x34')]=_[_0x46ab('0x33')](_0x11b4f8['model'],qs[_0x46ab('0x35')](_0xb9e715[_0x46ab('0x31')]['fields']));_0x4cfa64[_0x46ab('0x34')]=_0x4cfa64['attributes']['length']?_0x4cfa64['attributes']:_0x11b4f8[_0x46ab('0x2f')];if(_0xb9e715[_0x46ab('0x31')][_0x46ab('0x3f')]){_0x4cfa64['include']=[{'all':!![]}];}_0x4cfa64=_[_0x46ab('0x3d')]({},_0x4cfa64,_0xb9e715[_0x46ab('0x3e')]);return db[_0x46ab('0x2a')][_0x46ab('0x46')](_0x4cfa64)[_0x46ab('0x27')](handleEntityNotFound(_0x1ea573,null))[_0x46ab('0x27')](respondWithResult(_0x1ea573,null))[_0x46ab('0x43')](handleError(_0x1ea573,null));};exports[_0x46ab('0x47')]=function(_0x2c2dce,_0x38e5db){return db[_0x46ab('0x2a')][_0x46ab('0x47')](_0x2c2dce[_0x46ab('0x48')],{})[_0x46ab('0x27')](respondWithResult(_0x38e5db,0xc9))[_0x46ab('0x43')](handleError(_0x38e5db,null));};exports[_0x46ab('0x49')]=function(_0xd4065,_0x573166){if(_0xd4065[_0x46ab('0x48')]['id']){delete _0xd4065[_0x46ab('0x48')]['id'];}return db[_0x46ab('0x2a')][_0x46ab('0x46')]({'where':{'id':_0xd4065[_0x46ab('0x44')]['id']}})[_0x46ab('0x27')](handleEntityNotFound(_0x573166,null))[_0x46ab('0x27')](saveUpdates(_0xd4065[_0x46ab('0x48')],null))[_0x46ab('0x27')](respondWithResult(_0x573166,null))['catch'](handleError(_0x573166,null));};exports[_0x46ab('0x26')]=function(_0x383e25,_0x57ed04){return db['SalesforceAccount'][_0x46ab('0x46')]({'where':{'id':_0x383e25[_0x46ab('0x44')]['id']}})[_0x46ab('0x27')](handleEntityNotFound(_0x57ed04,null))[_0x46ab('0x27')](removeEntity(_0x57ed04,null))['catch'](handleError(_0x57ed04,null));};exports[_0x46ab('0x4a')]=function(_0x187a3b,_0x3f4491,_0x25f03a){var _0x4b7197={};var _0x230ffa={};var _0x3170a4;var _0x25c5db;return db[_0x46ab('0x2a')][_0x46ab('0x4b')]({'where':{'id':_0x187a3b[_0x46ab('0x44')]['id']}})[_0x46ab('0x27')](handleEntityNotFound(_0x3f4491,null))['then'](function(_0x2dc6cf){if(_0x2dc6cf){_0x3170a4=_0x2dc6cf;_0x230ffa[_0x46ab('0x2f')]=_[_0x46ab('0x45')](db[_0x46ab('0x4c')][_0x46ab('0x2b')]);_0x230ffa[_0x46ab('0x31')]=_['keys'](_0x187a3b[_0x46ab('0x31')]);_0x230ffa[_0x46ab('0x32')]=_['intersection'](_0x230ffa['model'],_0x230ffa[_0x46ab('0x31')]);_0x4b7197[_0x46ab('0x34')]=_[_0x46ab('0x33')](_0x230ffa['model'],qs[_0x46ab('0x35')](_0x187a3b[_0x46ab('0x31')][_0x46ab('0x35')]));_0x4b7197[_0x46ab('0x34')]=_0x4b7197[_0x46ab('0x34')][_0x46ab('0x36')]?_0x4b7197[_0x46ab('0x34')]:_0x230ffa[_0x46ab('0x2f')];_0x4b7197['order']=qs[_0x46ab('0x39')](_0x187a3b[_0x46ab('0x31')]['sort']);_0x4b7197['where']=qs[_0x46ab('0x32')](_[_0x46ab('0x3b')](_0x187a3b[_0x46ab('0x31')],_0x230ffa[_0x46ab('0x32')]));if(_0x187a3b[_0x46ab('0x31')][_0x46ab('0x3c')]){_0x4b7197['where']=_[_0x46ab('0x3d')](_0x4b7197[_0x46ab('0x3a')],{'$or':_[_0x46ab('0x30')](_0x4b7197[_0x46ab('0x34')],function(_0x108a58){var _0x5b68ab={};_0x5b68ab[_0x108a58]={'$like':'%'+_0x187a3b[_0x46ab('0x31')][_0x46ab('0x3c')]+'%'};return _0x5b68ab;})});}_0x4b7197=_[_0x46ab('0x3d')]({},_0x4b7197,_0x187a3b['options']);return _0x3170a4[_0x46ab('0x4a')](_0x4b7197);}})['then'](function(_0x2e7b65){if(_0x2e7b65){_0x25c5db=_0x2e7b65['length'];if(!_0x187a3b[_0x46ab('0x31')]['hasOwnProperty'](_0x46ab('0x4d'))){_0x4b7197[_0x46ab('0x1e')]=qs['limit'](_0x187a3b[_0x46ab('0x31')]['limit']);_0x4b7197[_0x46ab('0x20')]=qs['offset'](_0x187a3b[_0x46ab('0x31')][_0x46ab('0x20')]);}return _0x3170a4[_0x46ab('0x4a')](_0x4b7197);}})[_0x46ab('0x27')](function(_0x5e6cda){if(_0x5e6cda){return _0x5e6cda?{'count':_0x25c5db,'rows':_0x5e6cda}:null;}})[_0x46ab('0x27')](respondWithResult(_0x3f4491,null))[_0x46ab('0x43')](handleError(_0x3f4491,null));};exports[_0x46ab('0x4e')]=function(_0x466760,_0x3ac0e3,_0x411e87){if(_0x466760['body']['id']){delete _0x466760[_0x46ab('0x48')]['id'];}return db['SalesforceAccount'][_0x46ab('0x4b')]({'where':{'id':_0x466760[_0x46ab('0x44')]['id']}})['then'](handleEntityNotFound(_0x3ac0e3,null))[_0x46ab('0x27')](function(_0x190825){if(_0x190825){_0x466760[_0x46ab('0x48')][_0x46ab('0x4f')]=_0x190825['id'];_0x466760[_0x46ab('0x48')]['Subjects']=integrations[_0x46ab('0x50')](_0x466760[_0x46ab('0x48')][_0x46ab('0x51')],_0x466760['body'][_0x46ab('0x2d')]);_0x466760['body'][_0x46ab('0x52')]=integrations['getDescriptions'](_0x466760[_0x46ab('0x48')]['channel'],_0x466760['body'][_0x46ab('0x2d')]);return db['SalesforceConfiguration'][_0x46ab('0x47')](_0x466760[_0x46ab('0x48')],{'include':[{'model':db['SalesforceField'],'as':_0x46ab('0x53')},{'model':db[_0x46ab('0x54')],'as':_0x46ab('0x52')}]});}return null;})['then'](respondWithResult(_0x3ac0e3,null))['catch'](handleError(_0x3ac0e3,null));};exports[_0x46ab('0x55')]=function(_0x40f0ce,_0x3533c3,_0x5c2667){var _0xa779ce;var _0x37730a='';var _0x1ed7d0='Task';return db[_0x46ab('0x2a')][_0x46ab('0x4b')]({'where':{'id':_0x40f0ce[_0x46ab('0x44')]['id']},'attributes':['id','remoteUri',_0x46ab('0x56'),_0x46ab('0x57'),_0x46ab('0x58'),_0x46ab('0x59'),'securityToken']})[_0x46ab('0x27')](handleEntityNotFound(_0x3533c3,null))['then'](function(_0x335ac4){if(_0x335ac4){_0x37730a=_0x335ac4['remoteUri'];var _0x38835d=_0x37730a[_0x46ab('0x5a')](-0x1);if(_0x38835d==='/'){_0x37730a=_0x37730a[_0x46ab('0x5b')](0x0,_0x37730a[_0x46ab('0x5c')](_0x38835d));}_0xa779ce=new jsforce[(_0x46ab('0x5d'))]({'oauth2':{'loginUrl':_0x37730a,'clientId':_0x335ac4[_0x46ab('0x56')],'clientSecret':_0x335ac4[_0x46ab('0x57')]}});return _0xa779ce[_0x46ab('0x5e')](_0x335ac4['username'],_0x335ac4[_0x46ab('0x59')]['concat'](_0x335ac4[_0x46ab('0x5f')]));}})['then'](function(_0x4c78fa){if(_0x4c78fa){if(!_[_0x46ab('0x60')](_0x40f0ce[_0x46ab('0x31')][_0x46ab('0x61')])){_0x1ed7d0=_0x40f0ce[_0x46ab('0x31')][_0x46ab('0x61')];}return _0xa779ce['sobject'](_0x1ed7d0)[_0x46ab('0x62')]();}})[_0x46ab('0x27')](function(_0x8e8bbe){var _0x42c3bb=[_0x46ab('0x63'),_0x46ab('0x64'),_0x46ab('0x65'),_0x46ab('0x66'),'Subject',_0x46ab('0x67')];var _0x148b93=[_0x46ab('0x68'),'int',_0x46ab('0x69'),'boolean',_0x46ab('0x6a'),_0x46ab('0x6b'),_0x46ab('0x6c')];if(_0x8e8bbe){_[_0x46ab('0x6d')](_0x8e8bbe[_0x46ab('0x35')],function(_0x50a76b){return _0x42c3bb['includes'](_0x50a76b[_0x46ab('0x29')])||!_0x148b93[_0x46ab('0x6e')](_0x50a76b[_0x46ab('0x2d')]);});return{'count':_0x8e8bbe[_0x46ab('0x35')][_0x46ab('0x36')],'rows':_[_0x46ab('0x30')](_0x8e8bbe[_0x46ab('0x35')],function(_0x4a9bef){return{'id':_0x4a9bef['name'],'name':_0x4a9bef[_0x46ab('0x6f')],'custom':_0x4a9bef[_0x46ab('0x70')],'options':_0x4a9bef[_0x46ab('0x71')][_0x46ab('0x36')]>0x0?_[_0x46ab('0x30')](_0x4a9bef[_0x46ab('0x71')],function(_0x2d2e62){return{'name':_0x2d2e62[_0x46ab('0x6f')],'value':_0x2d2e62[_0x46ab('0x72')]};}):_0x4a9bef['type']==_0x46ab('0x73')?[{'name':_0x46ab('0x74'),'value':_0x46ab('0x75')},{'name':_0x46ab('0x76'),'value':_0x46ab('0x77')}]:[]};})};}})[_0x46ab('0x27')](respondWithResult(_0x3533c3,null))['catch'](function(_0x23df5b){var _0x57b111=_0x40f0ce[_0x46ab('0x31')][_0x46ab('0x78')]?0x1f4:_0x23df5b[_0x46ab('0x79')]||0x1f4;logger['error'](_0x46ab('0x7a'),_0x46ab('0x55'),_0x57b111,JSON['stringify'](_0x23df5b));delete _0x23df5b['name'];if(_0x57b111===0x191){_0x57b111=0x190;}_0x3533c3[_0x46ab('0x1b')](_0x57b111)[_0x46ab('0x7b')](_0x40f0ce['query'][_0x46ab('0x78')]?{'message':_0x46ab('0x7c'),'statusCode':_0x23df5b['statusCode']}:_0x23df5b);});}; \ No newline at end of file +var _0x2501=['true','False','false','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','test','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','name','send','index','map','SalesforceAccount','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','include','find','create','body','params','destroy','getConfigurations','findOne','SalesforceConfiguration','rawAttributes','order','addConfiguration','AccountId','Subjects','getSubjects','channel','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','username','password','securityToken','substring','lastIndexOf','Connection','concat','isNil','sobject','describe','OwnerId','ActivityDate','IsReminderSet','Subject','Description','int','picklist','email','textarea','remove','includes','label','picklistValues','value','True'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x2501,0x104));var _0x1250=function(_0x51bb92,_0x3b1471){_0x51bb92=_0x51bb92-0x0;var _0x48faa5=_0x2501[_0x51bb92];return _0x48faa5;};'use strict';var emlformat=require(_0x1250('0x0'));var rimraf=require(_0x1250('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1250('0x2'));var rp=require(_0x1250('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1250('0x4'));var util=require(_0x1250('0x5'));var path=require(_0x1250('0x6'));var sox=require(_0x1250('0x7'));var csv=require(_0x1250('0x8'));var ejs=require(_0x1250('0x9'));var fs=require('fs');var fs_extra=require(_0x1250('0xa'));var _=require(_0x1250('0xb'));var squel=require(_0x1250('0xc'));var crypto=require(_0x1250('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1250('0xe'));var toCsv=require(_0x1250('0x8'));var querystring=require(_0x1250('0xf'));var Papa=require('papaparse');var Redis=require(_0x1250('0x10'));var authService=require(_0x1250('0x11'));var qs=require(_0x1250('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1250('0x13'));var logger=require(_0x1250('0x14'))(_0x1250('0x15'));var utils=require(_0x1250('0x16'));var config=require(_0x1250('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x1250('0x18'))['db'];var integrations=require(_0x1250('0x19'));function respondWithStatusCode(_0x2eedb8,_0x14c1bd){_0x14c1bd=_0x14c1bd||0xcc;return function(_0x37098a){if(_0x37098a){return _0x2eedb8['sendStatus'](_0x14c1bd);}return _0x2eedb8[_0x1250('0x1a')](_0x14c1bd)[_0x1250('0x1b')]();};}function respondWithResult(_0x41714b,_0x3105e5){_0x3105e5=_0x3105e5||0xc8;return function(_0x2d5b61){if(_0x2d5b61){return _0x41714b[_0x1250('0x1a')](_0x3105e5)[_0x1250('0x1c')](_0x2d5b61);}};}function respondWithFilteredResult(_0x5a45d0,_0xdf64bd){return function(_0x2d2f9e){if(_0x2d2f9e){var _0x5127d5=typeof _0xdf64bd[_0x1250('0x1d')]===_0x1250('0x1e')&&typeof _0xdf64bd[_0x1250('0x1f')]===_0x1250('0x1e');var _0x2318a0=_0x2d2f9e[_0x1250('0x20')];var _0x37850c=_0x5127d5?0x0:_0xdf64bd[_0x1250('0x1d')];var _0x15b165=_0x5127d5?_0x2d2f9e[_0x1250('0x20')]:_0xdf64bd['offset']+_0xdf64bd[_0x1250('0x1f')];var _0x49cd8f;if(_0x15b165>=_0x2318a0){_0x15b165=_0x2318a0;_0x49cd8f=0xc8;}else{_0x49cd8f=0xce;}_0x5a45d0[_0x1250('0x1a')](_0x49cd8f);return _0x5a45d0[_0x1250('0x21')](_0x1250('0x22'),_0x37850c+'-'+_0x15b165+'/'+_0x2318a0)[_0x1250('0x1c')](_0x2d2f9e);}return null;};}function patchUpdates(_0x5b4944){return function(_0x225ed6){try{jsonpatch[_0x1250('0x23')](_0x225ed6,_0x5b4944,!![]);}catch(_0x5d6a39){return BPromise[_0x1250('0x24')](_0x5d6a39);}return _0x225ed6[_0x1250('0x25')]();};}function saveUpdates(_0x44c6ea,_0x265793){return function(_0x44ee92){if(_0x44ee92){return _0x44ee92[_0x1250('0x26')](_0x44c6ea)[_0x1250('0x27')](function(_0x9564a0){return _0x9564a0;});}return null;};}function removeEntity(_0xda972f,_0x19654e){return function(_0x251e81){if(_0x251e81){return _0x251e81['destroy']()['then'](function(){_0xda972f[_0x1250('0x1a')](0xcc)[_0x1250('0x1b')]();});}};}function handleEntityNotFound(_0x31a29e,_0x104dd5){return function(_0x2e0dc1){if(!_0x2e0dc1){_0x31a29e[_0x1250('0x28')](0x194);}return _0x2e0dc1;};}function handleError(_0x892f42,_0x6eea9e){_0x6eea9e=_0x6eea9e||0x1f4;return function(_0x358f38){logger['error'](_0x358f38['stack']);if(_0x358f38['name']){delete _0x358f38[_0x1250('0x29')];}_0x892f42[_0x1250('0x1a')](_0x6eea9e)[_0x1250('0x2a')](_0x358f38);};}exports[_0x1250('0x2b')]=function(_0x123d73,_0x268d43){var _0x3f8d81={},_0x30631b={},_0x3622db={'count':0x0,'rows':[]};var _0x42f3ed=_[_0x1250('0x2c')](db[_0x1250('0x2d')]['rawAttributes'],function(_0xd49e46){return{'name':_0xd49e46[_0x1250('0x2e')],'type':_0xd49e46[_0x1250('0x2f')][_0x1250('0x30')]};});_0x30631b[_0x1250('0x31')]=_['map'](_0x42f3ed,'name');_0x30631b[_0x1250('0x32')]=_[_0x1250('0x33')](_0x123d73['query']);_0x30631b['filters']=_[_0x1250('0x34')](_0x30631b['model'],_0x30631b[_0x1250('0x32')]);_0x3f8d81[_0x1250('0x35')]=_[_0x1250('0x34')](_0x30631b[_0x1250('0x31')],qs[_0x1250('0x36')](_0x123d73[_0x1250('0x32')][_0x1250('0x36')]));_0x3f8d81[_0x1250('0x35')]=_0x3f8d81[_0x1250('0x35')][_0x1250('0x37')]?_0x3f8d81[_0x1250('0x35')]:_0x30631b[_0x1250('0x31')];if(!_0x123d73['query'][_0x1250('0x38')](_0x1250('0x39'))){_0x3f8d81[_0x1250('0x1f')]=qs[_0x1250('0x1f')](_0x123d73['query'][_0x1250('0x1f')]);_0x3f8d81[_0x1250('0x1d')]=qs[_0x1250('0x1d')](_0x123d73['query']['offset']);}_0x3f8d81['order']=qs[_0x1250('0x3a')](_0x123d73[_0x1250('0x32')][_0x1250('0x3a')]);_0x3f8d81[_0x1250('0x3b')]=qs[_0x1250('0x3c')](_[_0x1250('0x3d')](_0x123d73[_0x1250('0x32')],_0x30631b[_0x1250('0x3c')]),_0x42f3ed);if(_0x123d73[_0x1250('0x32')][_0x1250('0x3e')]){_0x3f8d81[_0x1250('0x3b')]=_['merge'](_0x3f8d81['where'],{'$or':_[_0x1250('0x2c')](_0x42f3ed,function(_0x3fd68a){if(_0x3fd68a['type']!==_0x1250('0x3f')){var _0x3ca59d={};_0x3ca59d[_0x3fd68a[_0x1250('0x29')]]={'$like':'%'+_0x123d73[_0x1250('0x32')][_0x1250('0x3e')]+'%'};return _0x3ca59d;}})});}_0x3f8d81=_[_0x1250('0x40')]({},_0x3f8d81,_0x123d73[_0x1250('0x41')]);var _0x2a628f={'where':_0x3f8d81[_0x1250('0x3b')]};return db[_0x1250('0x2d')]['count'](_0x2a628f)[_0x1250('0x27')](function(_0x16f1cb){_0x3622db[_0x1250('0x20')]=_0x16f1cb;if(_0x123d73[_0x1250('0x32')][_0x1250('0x42')]){_0x3f8d81['include']=[{'all':!![]}];}return db[_0x1250('0x2d')][_0x1250('0x43')](_0x3f8d81);})['then'](function(_0x23d2f4){_0x3622db[_0x1250('0x44')]=_0x23d2f4;return _0x3622db;})[_0x1250('0x27')](respondWithFilteredResult(_0x268d43,_0x3f8d81))[_0x1250('0x45')](handleError(_0x268d43,null));};exports[_0x1250('0x46')]=function(_0x1d3d02,_0x7a06ab){var _0x16a366={'raw':![],'where':{'id':_0x1d3d02['params']['id']}},_0x3e084e={};_0x3e084e[_0x1250('0x31')]=_[_0x1250('0x33')](db[_0x1250('0x2d')]['rawAttributes']);_0x3e084e[_0x1250('0x32')]=_[_0x1250('0x33')](_0x1d3d02[_0x1250('0x32')]);_0x3e084e[_0x1250('0x3c')]=_[_0x1250('0x34')](_0x3e084e[_0x1250('0x31')],_0x3e084e[_0x1250('0x32')]);_0x16a366[_0x1250('0x35')]=_[_0x1250('0x34')](_0x3e084e[_0x1250('0x31')],qs[_0x1250('0x36')](_0x1d3d02[_0x1250('0x32')][_0x1250('0x36')]));_0x16a366[_0x1250('0x35')]=_0x16a366['attributes'][_0x1250('0x37')]?_0x16a366[_0x1250('0x35')]:_0x3e084e[_0x1250('0x31')];if(_0x1d3d02[_0x1250('0x32')][_0x1250('0x42')]){_0x16a366[_0x1250('0x47')]=[{'all':!![]}];}_0x16a366=_[_0x1250('0x40')]({},_0x16a366,_0x1d3d02['options']);return db[_0x1250('0x2d')][_0x1250('0x48')](_0x16a366)[_0x1250('0x27')](handleEntityNotFound(_0x7a06ab,null))['then'](respondWithResult(_0x7a06ab,null))['catch'](handleError(_0x7a06ab,null));};exports[_0x1250('0x49')]=function(_0x45a6eb,_0x235232){return db['SalesforceAccount'][_0x1250('0x49')](_0x45a6eb[_0x1250('0x4a')],{})[_0x1250('0x27')](respondWithResult(_0x235232,0xc9))[_0x1250('0x45')](handleError(_0x235232,null));};exports[_0x1250('0x26')]=function(_0x513c5a,_0x5c1594){if(_0x513c5a['body']['id']){delete _0x513c5a[_0x1250('0x4a')]['id'];}return db[_0x1250('0x2d')][_0x1250('0x48')]({'where':{'id':_0x513c5a[_0x1250('0x4b')]['id']}})[_0x1250('0x27')](handleEntityNotFound(_0x5c1594,null))[_0x1250('0x27')](saveUpdates(_0x513c5a[_0x1250('0x4a')],null))[_0x1250('0x27')](respondWithResult(_0x5c1594,null))[_0x1250('0x45')](handleError(_0x5c1594,null));};exports[_0x1250('0x4c')]=function(_0xb8f680,_0x5c2f44){return db[_0x1250('0x2d')]['find']({'where':{'id':_0xb8f680[_0x1250('0x4b')]['id']}})[_0x1250('0x27')](handleEntityNotFound(_0x5c2f44,null))[_0x1250('0x27')](removeEntity(_0x5c2f44,null))[_0x1250('0x45')](handleError(_0x5c2f44,null));};exports[_0x1250('0x4d')]=function(_0x518126,_0x27b90c,_0x52c359){var _0x292d9f={};var _0x46efac={};var _0x535b79;var _0x55505a;return db[_0x1250('0x2d')][_0x1250('0x4e')]({'where':{'id':_0x518126['params']['id']}})['then'](handleEntityNotFound(_0x27b90c,null))[_0x1250('0x27')](function(_0x372fa1){if(_0x372fa1){_0x535b79=_0x372fa1;_0x46efac[_0x1250('0x31')]=_[_0x1250('0x33')](db[_0x1250('0x4f')][_0x1250('0x50')]);_0x46efac[_0x1250('0x32')]=_['keys'](_0x518126[_0x1250('0x32')]);_0x46efac[_0x1250('0x3c')]=_[_0x1250('0x34')](_0x46efac['model'],_0x46efac[_0x1250('0x32')]);_0x292d9f[_0x1250('0x35')]=_[_0x1250('0x34')](_0x46efac[_0x1250('0x31')],qs[_0x1250('0x36')](_0x518126[_0x1250('0x32')]['fields']));_0x292d9f[_0x1250('0x35')]=_0x292d9f[_0x1250('0x35')][_0x1250('0x37')]?_0x292d9f[_0x1250('0x35')]:_0x46efac[_0x1250('0x31')];_0x292d9f[_0x1250('0x51')]=qs[_0x1250('0x3a')](_0x518126[_0x1250('0x32')][_0x1250('0x3a')]);_0x292d9f['where']=qs[_0x1250('0x3c')](_['pick'](_0x518126['query'],_0x46efac[_0x1250('0x3c')]));if(_0x518126[_0x1250('0x32')][_0x1250('0x3e')]){_0x292d9f[_0x1250('0x3b')]=_[_0x1250('0x40')](_0x292d9f[_0x1250('0x3b')],{'$or':_[_0x1250('0x2c')](_0x292d9f[_0x1250('0x35')],function(_0x5b9022){var _0x2d6cc4={};_0x2d6cc4[_0x5b9022]={'$like':'%'+_0x518126['query'][_0x1250('0x3e')]+'%'};return _0x2d6cc4;})});}_0x292d9f=_[_0x1250('0x40')]({},_0x292d9f,_0x518126[_0x1250('0x41')]);return _0x535b79['getConfigurations'](_0x292d9f);}})['then'](function(_0x552c19){if(_0x552c19){_0x55505a=_0x552c19[_0x1250('0x37')];if(!_0x518126[_0x1250('0x32')][_0x1250('0x38')](_0x1250('0x39'))){_0x292d9f[_0x1250('0x1f')]=qs['limit'](_0x518126['query']['limit']);_0x292d9f[_0x1250('0x1d')]=qs[_0x1250('0x1d')](_0x518126['query'][_0x1250('0x1d')]);}return _0x535b79[_0x1250('0x4d')](_0x292d9f);}})[_0x1250('0x27')](function(_0x3b6c8d){if(_0x3b6c8d){return _0x3b6c8d?{'count':_0x55505a,'rows':_0x3b6c8d}:null;}})[_0x1250('0x27')](respondWithResult(_0x27b90c,null))['catch'](handleError(_0x27b90c,null));};exports[_0x1250('0x52')]=function(_0x329245,_0x42b4ee,_0x4fd8d5){if(_0x329245[_0x1250('0x4a')]['id']){delete _0x329245['body']['id'];}return db['SalesforceAccount']['findOne']({'where':{'id':_0x329245[_0x1250('0x4b')]['id']}})[_0x1250('0x27')](handleEntityNotFound(_0x42b4ee,null))[_0x1250('0x27')](function(_0x266d49){if(_0x266d49){_0x329245[_0x1250('0x4a')][_0x1250('0x53')]=_0x266d49['id'];_0x329245['body'][_0x1250('0x54')]=integrations[_0x1250('0x55')](_0x329245['body'][_0x1250('0x56')],_0x329245[_0x1250('0x4a')][_0x1250('0x2f')]);_0x329245[_0x1250('0x4a')]['Descriptions']=integrations['getDescriptions'](_0x329245['body'][_0x1250('0x56')],_0x329245['body'][_0x1250('0x2f')]);return db[_0x1250('0x4f')]['create'](_0x329245[_0x1250('0x4a')],{'include':[{'model':db[_0x1250('0x57')],'as':_0x1250('0x54')},{'model':db[_0x1250('0x57')],'as':'Descriptions'}]});}return null;})[_0x1250('0x27')](respondWithResult(_0x42b4ee,null))['catch'](handleError(_0x42b4ee,null));};exports[_0x1250('0x58')]=function(_0x115cd0,_0x5653f1,_0x12442f){var _0x23ba7d;var _0x42866b='';var _0x5981a8=_0x1250('0x59');return db[_0x1250('0x2d')][_0x1250('0x4e')]({'where':{'id':_0x115cd0[_0x1250('0x4b')]['id']},'attributes':['id',_0x1250('0x5a'),_0x1250('0x5b'),_0x1250('0x5c'),_0x1250('0x5d'),_0x1250('0x5e'),_0x1250('0x5f')]})['then'](handleEntityNotFound(_0x5653f1,null))[_0x1250('0x27')](function(_0x545f71){if(_0x545f71){_0x42866b=_0x545f71[_0x1250('0x5a')];var _0x571acf=_0x42866b['slice'](-0x1);if(_0x571acf==='/'){_0x42866b=_0x42866b[_0x1250('0x60')](0x0,_0x42866b[_0x1250('0x61')](_0x571acf));}_0x23ba7d=new jsforce[(_0x1250('0x62'))]({'oauth2':{'loginUrl':_0x42866b,'clientId':_0x545f71[_0x1250('0x5b')],'clientSecret':_0x545f71[_0x1250('0x5c')]}});return _0x23ba7d['login'](_0x545f71['username'],_0x545f71['password'][_0x1250('0x63')](_0x545f71[_0x1250('0x5f')]));}})[_0x1250('0x27')](function(_0x39dc08){if(_0x39dc08){if(!_[_0x1250('0x64')](_0x115cd0[_0x1250('0x32')]['ticketType'])){_0x5981a8=_0x115cd0['query']['ticketType'];}return _0x23ba7d[_0x1250('0x65')](_0x5981a8)[_0x1250('0x66')]();}})[_0x1250('0x27')](function(_0x1345d7){var _0x4bfe06=[_0x1250('0x67'),_0x1250('0x68'),_0x1250('0x69'),'IsRecurrence',_0x1250('0x6a'),_0x1250('0x6b')];var _0x4dad94=['string',_0x1250('0x6c'),_0x1250('0x6d'),'boolean',_0x1250('0x6e'),_0x1250('0x6f'),'phone'];if(_0x1345d7){_[_0x1250('0x70')](_0x1345d7[_0x1250('0x36')],function(_0x33c177){return _0x4bfe06[_0x1250('0x71')](_0x33c177[_0x1250('0x29')])||!_0x4dad94[_0x1250('0x71')](_0x33c177[_0x1250('0x2f')]);});return{'count':_0x1345d7['fields'][_0x1250('0x37')],'rows':_[_0x1250('0x2c')](_0x1345d7[_0x1250('0x36')],function(_0x42a6fa){return{'id':_0x42a6fa[_0x1250('0x29')],'name':_0x42a6fa[_0x1250('0x72')],'custom':_0x42a6fa['custom'],'options':_0x42a6fa[_0x1250('0x73')][_0x1250('0x37')]>0x0?_[_0x1250('0x2c')](_0x42a6fa['picklistValues'],function(_0x461d59){return{'name':_0x461d59[_0x1250('0x72')],'value':_0x461d59[_0x1250('0x74')]};}):_0x42a6fa[_0x1250('0x2f')]=='boolean'?[{'name':_0x1250('0x75'),'value':_0x1250('0x76')},{'name':_0x1250('0x77'),'value':_0x1250('0x78')}]:[]};})};}})[_0x1250('0x27')](respondWithResult(_0x5653f1,null))[_0x1250('0x45')](function(_0x19708e){var _0x102e77=_0x115cd0[_0x1250('0x32')]['test']?0x1f4:_0x19708e[_0x1250('0x79')]||0x1f4;logger[_0x1250('0x7a')](_0x1250('0x7b'),_0x1250('0x58'),_0x102e77,JSON[_0x1250('0x7c')](_0x19708e));delete _0x19708e[_0x1250('0x29')];if(_0x102e77===0x191){_0x102e77=0x190;}_0x5653f1[_0x1250('0x1a')](_0x102e77)[_0x1250('0x2a')](_0x115cd0[_0x1250('0x32')][_0x1250('0x7d')]?{'message':'Wrong\x20credentials','statusCode':_0x19708e['statusCode']}:_0x19708e);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 8c8a715..033be0c 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 _0x0096=['lodash','util','../../config/logger','api','bluebird','request-promise','path','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','int_salesforce_accounts'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0x0096,0xd1));var _0x6009=function(_0x1196b0,_0x36c47a){_0x1196b0=_0x1196b0-0x0;var _0x111c52=_0x0096[_0x1196b0];return _0x111c52;};'use strict';var _=require(_0x6009('0x0'));var util=require(_0x6009('0x1'));var logger=require(_0x6009('0x2'))(_0x6009('0x3'));var moment=require('moment');var BPromise=require(_0x6009('0x4'));var rp=require(_0x6009('0x5'));var fs=require('fs');var path=require(_0x6009('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6009('0x7'));var integrations=require(_0x6009('0x8'));module[_0x6009('0x9')]=function(_0x1e653f,_0x48aa56){return _0x1e653f['define']('SalesforceAccount',attributes,{'tableName':_0x6009('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd20e=['lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','../../components/integrations/configuration','exports','define'];(function(_0x4e092e,_0x16c474){var _0x37193a=function(_0x4ae278){while(--_0x4ae278){_0x4e092e['push'](_0x4e092e['shift']());}};_0x37193a(++_0x16c474);}(_0xd20e,0xbb));var _0xed20=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0xd20e[_0x342baa];return _0x1208f3;};'use strict';var _=require(_0xed20('0x0'));var util=require(_0xed20('0x1'));var logger=require(_0xed20('0x2'))(_0xed20('0x3'));var moment=require('moment');var BPromise=require(_0xed20('0x4'));var rp=require(_0xed20('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xed20('0x6'));var config=require(_0xed20('0x7'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0xed20('0x8'));module[_0xed20('0x9')]=function(_0x408ac3,_0x4a2795){return _0x408ac3[_0xed20('0xa')]('SalesforceAccount',attributes,{'tableName':'int_salesforce_accounts','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 aa6bf50..1291edc 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 _0x0546=['options','raw','where','attributes','limit','include','map','model','GetSalesforceAccount','SalesforceAccount','find','then','ShowSalesforceAccount','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','findAll'];(function(_0x379f2e,_0x310113){var _0x34ad10=function(_0x11fae4){while(--_0x11fae4){_0x379f2e['push'](_0x379f2e['shift']());}};_0x34ad10(++_0x310113);}(_0x0546,0xe5));var _0x6054=function(_0x553150,_0x589ff3){_0x553150=_0x553150-0x0;var _0x18193d=_0x0546[_0x553150];return _0x18193d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6054('0x0'));var BPromise=require(_0x6054('0x1'));var rs=require(_0x6054('0x2'));var fs=require('fs');var Redis=require(_0x6054('0x3'));var db=require(_0x6054('0x4'))['db'];var utils=require(_0x6054('0x5'));var logger=require(_0x6054('0x6'))(_0x6054('0x7'));var config=require('../../config/environment');var jayson=require(_0x6054('0x8'));var client=jayson[_0x6054('0x9')][_0x6054('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59ec41,_0xac7505,_0x3c12c1){return new BPromise(function(_0x2c1e79,_0x23ce97){return client[_0x6054('0xb')](_0x59ec41,_0x3c12c1)['then'](function(_0x1dc82e){logger[_0x6054('0xc')](_0x6054('0xd'),_0xac7505,_0x6054('0xe'));logger[_0x6054('0xf')](_0x6054('0x10'),_0xac7505,_0x6054('0xe'),JSON[_0x6054('0x11')](_0x1dc82e));if(_0x1dc82e[_0x6054('0x12')]){if(_0x1dc82e[_0x6054('0x12')]['code']===0x1f4){logger[_0x6054('0x12')](_0x6054('0xd'),_0xac7505,_0x1dc82e[_0x6054('0x12')][_0x6054('0x13')]);return _0x23ce97(_0x1dc82e[_0x6054('0x12')][_0x6054('0x13')]);}logger[_0x6054('0x12')](_0x6054('0xd'),_0xac7505,_0x1dc82e['error'][_0x6054('0x13')]);return _0x2c1e79(_0x1dc82e['error']['message']);}else{logger[_0x6054('0xc')]('SalesforceAccount,\x20%s,\x20%s',_0xac7505,_0x6054('0xe'));_0x2c1e79(_0x1dc82e[_0x6054('0x14')][_0x6054('0x13')]);}})[_0x6054('0x15')](function(_0x50c6e3){logger[_0x6054('0x12')](_0x6054('0xd'),_0xac7505,_0x50c6e3);_0x23ce97(_0x50c6e3);});});}exports['GetSalesforceAccount']=function(_0x408b7a){var _0x15d762=this;return new Promise(function(_0x19eae8,_0x149a50){return db['SalesforceAccount'][_0x6054('0x16')]({'raw':_0x408b7a[_0x6054('0x17')]?_0x408b7a[_0x6054('0x17')][_0x6054('0x18')]===undefined?!![]:![]:!![],'where':_0x408b7a[_0x6054('0x17')]?_0x408b7a[_0x6054('0x17')][_0x6054('0x19')]||null:null,'attributes':_0x408b7a['options']?_0x408b7a[_0x6054('0x17')][_0x6054('0x1a')]||null:null,'limit':_0x408b7a[_0x6054('0x17')]?_0x408b7a[_0x6054('0x17')][_0x6054('0x1b')]||null:null,'include':_0x408b7a[_0x6054('0x17')]?_0x408b7a[_0x6054('0x17')][_0x6054('0x1c')]?_[_0x6054('0x1d')](_0x408b7a['options'][_0x6054('0x1c')],function(_0x3e6095){return{'model':db[_0x3e6095[_0x6054('0x1e')]],'as':_0x3e6095['as'],'attributes':_0x3e6095['attributes'],'include':_0x3e6095['include']?_['map'](_0x3e6095[_0x6054('0x1c')],function(_0x301ed4){return{'model':db[_0x301ed4[_0x6054('0x1e')]],'as':_0x301ed4['as'],'attributes':_0x301ed4['attributes'],'include':_0x301ed4[_0x6054('0x1c')]?_['map'](_0x301ed4[_0x6054('0x1c')],function(_0x4a0192){return{'model':db[_0x4a0192[_0x6054('0x1e')]],'as':_0x4a0192['as'],'attributes':_0x4a0192[_0x6054('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xbc31f2){logger[_0x6054('0xc')]('GetSalesforceAccount',_0x408b7a);logger[_0x6054('0xf')](_0x6054('0x1f'),_0x408b7a,JSON[_0x6054('0x11')](_0xbc31f2));_0x19eae8(_0xbc31f2);})[_0x6054('0x15')](function(_0x58631f){logger[_0x6054('0x12')](_0x6054('0x1f'),_0x58631f[_0x6054('0x13')],_0x408b7a);_0x149a50(_0x15d762[_0x6054('0x12')](0x1f4,_0x58631f[_0x6054('0x13')]));});});};exports['ShowSalesforceAccount']=function(_0x128f21){var _0x3b1782=this;return new Promise(function(_0x4c276f,_0x3aec0d){return db[_0x6054('0x20')][_0x6054('0x21')]({'raw':_0x128f21[_0x6054('0x17')]?_0x128f21['options'][_0x6054('0x18')]===undefined?!![]:![]:!![],'where':_0x128f21[_0x6054('0x17')]?_0x128f21['options'][_0x6054('0x19')]||null:null,'attributes':_0x128f21[_0x6054('0x17')]?_0x128f21[_0x6054('0x17')][_0x6054('0x1a')]||null:null,'include':_0x128f21[_0x6054('0x17')]?_0x128f21[_0x6054('0x17')][_0x6054('0x1c')]?_[_0x6054('0x1d')](_0x128f21[_0x6054('0x17')]['include'],function(_0x1ce75a){return{'model':db[_0x1ce75a[_0x6054('0x1e')]],'as':_0x1ce75a['as'],'attributes':_0x1ce75a[_0x6054('0x1a')],'include':_0x1ce75a[_0x6054('0x1c')]?_[_0x6054('0x1d')](_0x1ce75a[_0x6054('0x1c')],function(_0x550933){return{'model':db[_0x550933[_0x6054('0x1e')]],'as':_0x550933['as'],'attributes':_0x550933['attributes'],'include':_0x550933[_0x6054('0x1c')]?_[_0x6054('0x1d')](_0x550933['include'],function(_0x54f32f){return{'model':db[_0x54f32f['model']],'as':_0x54f32f['as'],'attributes':_0x54f32f[_0x6054('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6054('0x22')](function(_0x1361c5){logger[_0x6054('0xc')](_0x6054('0x23'),_0x128f21);logger[_0x6054('0xf')](_0x6054('0x23'),_0x128f21,JSON[_0x6054('0x11')](_0x1361c5));_0x4c276f(_0x1361c5);})[_0x6054('0x15')](function(_0x154db3){logger[_0x6054('0x12')](_0x6054('0x23'),_0x154db3['message'],_0x128f21);_0x3aec0d(_0x3b1782[_0x6054('0x12')](0x1f4,_0x154db3[_0x6054('0x13')]));});});}; \ No newline at end of file +var _0x9fd2=['findAll','options','raw','attributes','include','map','model','catch','ShowSalesforceAccount','where','lodash','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetSalesforceAccount','SalesforceAccount'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x9fd2,0x112));var _0x29fd=function(_0x54b0a8,_0x44035a){_0x54b0a8=_0x54b0a8-0x0;var _0x395ec5=_0x9fd2[_0x54b0a8];return _0x395ec5;};'use strict';var _=require(_0x29fd('0x0'));var util=require('util');var moment=require(_0x29fd('0x1'));var BPromise=require('bluebird');var rs=require(_0x29fd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x29fd('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x29fd('0x4'));var config=require(_0x29fd('0x5'));var jayson=require(_0x29fd('0x6'));var client=jayson[_0x29fd('0x7')][_0x29fd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x65c69a,_0x2ecb44,_0x394ca9){return new BPromise(function(_0x4b1f4d,_0x415332){return client[_0x29fd('0x9')](_0x65c69a,_0x394ca9)[_0x29fd('0xa')](function(_0x5a33df){logger['info'](_0x29fd('0xb'),_0x2ecb44,_0x29fd('0xc'));logger[_0x29fd('0xd')](_0x29fd('0xe'),_0x2ecb44,_0x29fd('0xc'),JSON[_0x29fd('0xf')](_0x5a33df));if(_0x5a33df['error']){if(_0x5a33df[_0x29fd('0x10')][_0x29fd('0x11')]===0x1f4){logger[_0x29fd('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x2ecb44,_0x5a33df[_0x29fd('0x10')][_0x29fd('0x12')]);return _0x415332(_0x5a33df[_0x29fd('0x10')]['message']);}logger[_0x29fd('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x2ecb44,_0x5a33df[_0x29fd('0x10')]['message']);return _0x4b1f4d(_0x5a33df[_0x29fd('0x10')][_0x29fd('0x12')]);}else{logger[_0x29fd('0x13')](_0x29fd('0xb'),_0x2ecb44,'request\x20sent');_0x4b1f4d(_0x5a33df[_0x29fd('0x14')][_0x29fd('0x12')]);}})['catch'](function(_0x4da386){logger[_0x29fd('0x10')](_0x29fd('0xb'),_0x2ecb44,_0x4da386);_0x415332(_0x4da386);});});}exports[_0x29fd('0x15')]=function(_0x1b652a){var _0xe58adf=this;return new Promise(function(_0x12f9d5,_0x5c6bff){return db[_0x29fd('0x16')][_0x29fd('0x17')]({'raw':_0x1b652a[_0x29fd('0x18')]?_0x1b652a['options'][_0x29fd('0x19')]===undefined?!![]:![]:!![],'where':_0x1b652a[_0x29fd('0x18')]?_0x1b652a[_0x29fd('0x18')]['where']||null:null,'attributes':_0x1b652a[_0x29fd('0x18')]?_0x1b652a[_0x29fd('0x18')][_0x29fd('0x1a')]||null:null,'limit':_0x1b652a[_0x29fd('0x18')]?_0x1b652a[_0x29fd('0x18')]['limit']||null:null,'include':_0x1b652a[_0x29fd('0x18')]?_0x1b652a[_0x29fd('0x18')][_0x29fd('0x1b')]?_[_0x29fd('0x1c')](_0x1b652a[_0x29fd('0x18')][_0x29fd('0x1b')],function(_0x5b625f){return{'model':db[_0x5b625f[_0x29fd('0x1d')]],'as':_0x5b625f['as'],'attributes':_0x5b625f['attributes'],'include':_0x5b625f['include']?_[_0x29fd('0x1c')](_0x5b625f[_0x29fd('0x1b')],function(_0x3c1f24){return{'model':db[_0x3c1f24[_0x29fd('0x1d')]],'as':_0x3c1f24['as'],'attributes':_0x3c1f24[_0x29fd('0x1a')],'include':_0x3c1f24[_0x29fd('0x1b')]?_[_0x29fd('0x1c')](_0x3c1f24[_0x29fd('0x1b')],function(_0xd28ab4){return{'model':db[_0xd28ab4[_0x29fd('0x1d')]],'as':_0xd28ab4['as'],'attributes':_0xd28ab4['attributes']};}):[]};}):[]};}):[]:[]})[_0x29fd('0xa')](function(_0x49676c){logger[_0x29fd('0x13')](_0x29fd('0x15'),_0x1b652a);logger[_0x29fd('0xd')](_0x29fd('0x15'),_0x1b652a,JSON[_0x29fd('0xf')](_0x49676c));_0x12f9d5(_0x49676c);})[_0x29fd('0x1e')](function(_0x3e5c11){logger['error'](_0x29fd('0x15'),_0x3e5c11[_0x29fd('0x12')],_0x1b652a);_0x5c6bff(_0xe58adf[_0x29fd('0x10')](0x1f4,_0x3e5c11[_0x29fd('0x12')]));});});};exports[_0x29fd('0x1f')]=function(_0x3d2732){var _0x369089=this;return new Promise(function(_0x23315c,_0xb58fd3){return db[_0x29fd('0x16')]['find']({'raw':_0x3d2732[_0x29fd('0x18')]?_0x3d2732[_0x29fd('0x18')][_0x29fd('0x19')]===undefined?!![]:![]:!![],'where':_0x3d2732['options']?_0x3d2732[_0x29fd('0x18')][_0x29fd('0x20')]||null:null,'attributes':_0x3d2732[_0x29fd('0x18')]?_0x3d2732['options'][_0x29fd('0x1a')]||null:null,'include':_0x3d2732[_0x29fd('0x18')]?_0x3d2732[_0x29fd('0x18')][_0x29fd('0x1b')]?_[_0x29fd('0x1c')](_0x3d2732['options'][_0x29fd('0x1b')],function(_0x35c4b2){return{'model':db[_0x35c4b2[_0x29fd('0x1d')]],'as':_0x35c4b2['as'],'attributes':_0x35c4b2[_0x29fd('0x1a')],'include':_0x35c4b2[_0x29fd('0x1b')]?_['map'](_0x35c4b2['include'],function(_0x1a207e){return{'model':db[_0x1a207e[_0x29fd('0x1d')]],'as':_0x1a207e['as'],'attributes':_0x1a207e[_0x29fd('0x1a')],'include':_0x1a207e['include']?_[_0x29fd('0x1c')](_0x1a207e[_0x29fd('0x1b')],function(_0x3d8c71){return{'model':db[_0x3d8c71['model']],'as':_0x3d8c71['as'],'attributes':_0x3d8c71[_0x29fd('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x29fd('0xa')](function(_0x52edc1){logger[_0x29fd('0x13')](_0x29fd('0x1f'),_0x3d2732);logger[_0x29fd('0xd')](_0x29fd('0x1f'),_0x3d2732,JSON['stringify'](_0x52edc1));_0x23315c(_0x52edc1);})[_0x29fd('0x1e')](function(_0x4c7c18){logger[_0x29fd('0x10')](_0x29fd('0x1f'),_0x4c7c18[_0x29fd('0x12')],_0x3d2732);_0xb58fd3(_0x369089[_0x29fd('0x10')](0x1f4,_0x4c7c18[_0x29fd('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 0c01743..b6f33cb 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xdb28,0x106));var _0x8db2=function(_0x2086b7,_0x225375){_0x2086b7=_0x2086b7-0x0;var _0xc06da7=_0xdb28[_0x2086b7];return _0xc06da7;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./intSalesforceConfiguration.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getDescriptions']);router[_0x8db2('0x12')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x14')](_0x8db2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8db2('0x15')](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);module[_0x8db2('0x17')]=router; \ No newline at end of file +var _0x5f2f=['Router','fs-extra','../../components/auth/service','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x3d488b,_0x533bb5){var _0x4611f6=function(_0x4d2efe){while(--_0x4d2efe){_0x3d488b['push'](_0x3d488b['shift']());}};_0x4611f6(++_0x533bb5);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3c8820,_0x27ed96){_0x3c8820=_0x3c8820-0x0;var _0x1bedf8=_0x5f2f[_0x3c8820];return _0x1bedf8;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x9')](_0xf5f2('0x10'),auth['isAuthenticated'](),controller[_0xf5f2('0x11')]);router['get']('/:id/descriptions',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x12')]);router['post']('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x13')]);router[_0xf5f2('0x14')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x15')]);router['delete'](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x16')]);module[_0xf5f2('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 2d4aefa..02d7215 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 _0x0b1f=['exports','STRING','Task','contact_lead','contact','lead','account_contact_lead','ENUM','nothing','account'];(function(_0x46efc7,_0x5eefae){var _0xc4831c=function(_0x28c38e){while(--_0x28c38e){_0x46efc7['push'](_0x46efc7['shift']());}};_0xc4831c(++_0x5eefae);}(_0x0b1f,0x82));var _0xf0b1=function(_0x258379,_0x44f295){_0x258379=_0x258379-0x0;var _0x1a1e31=_0x0b1f[_0x258379];return _0x1a1e31;};'use strict';var Sequelize=require('sequelize');module[_0xf0b1('0x0')]={'name':{'type':Sequelize[_0xf0b1('0x1')]},'description':{'type':Sequelize[_0xf0b1('0x1')]},'ticketType':{'type':Sequelize['ENUM'](_0xf0b1('0x2'),'Case'),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize['ENUM'](_0xf0b1('0x3'),_0xf0b1('0x4'),_0xf0b1('0x5'),_0xf0b1('0x6'),'account'),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0xf0b1('0x7')](_0xf0b1('0x8'),_0xf0b1('0x4'),_0xf0b1('0x5'),_0xf0b1('0x9')),'defaultValue':_0xf0b1('0x5')},'leadId':{'type':Sequelize[_0xf0b1('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0xf0b1('0x1')]},'additionalSearchContact':{'type':Sequelize[_0xf0b1('0x1')]},'additionalSearchLead':{'type':Sequelize[_0xf0b1('0x1')]}}; \ No newline at end of file +var _0x7bda=['ENUM','Task','Case','contact_lead','lead','account_contact_lead','account','nothing','contact','sequelize','exports','STRING'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x7bda,0x171));var _0xa7bd=function(_0x5ec71d,_0x2b43ce){_0x5ec71d=_0x5ec71d-0x0;var _0x45fe29=_0x7bda[_0x5ec71d];return _0x45fe29;};'use strict';var Sequelize=require(_0xa7bd('0x0'));module[_0xa7bd('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa7bd('0x2')]},'ticketType':{'type':Sequelize[_0xa7bd('0x3')](_0xa7bd('0x4'),_0xa7bd('0x5')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0xa7bd('0x3')](_0xa7bd('0x6'),'contact',_0xa7bd('0x7'),_0xa7bd('0x8'),_0xa7bd('0x9')),'defaultValue':_0xa7bd('0x6')},'moduleCreate':{'type':Sequelize[_0xa7bd('0x3')](_0xa7bd('0xa'),_0xa7bd('0xb'),_0xa7bd('0x7'),_0xa7bd('0x9')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0xa7bd('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xa7bd('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xa7bd('0x2')]},'additionalSearchLead':{'type':Sequelize[_0xa7bd('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 8700cdd..f338225 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 _0x97d5=['getFields','SalesforceField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','SalesforceConfiguration','rawAttributes','type','key','map','query','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','keys','find','create','catch','body'];(function(_0x7a2877,_0x12d80b){var _0x452d78=function(_0x5b6bf1){while(--_0x5b6bf1){_0x7a2877['push'](_0x7a2877['shift']());}};_0x452d78(++_0x12d80b);}(_0x97d5,0x199));var _0x597d=function(_0x4f3380,_0x299dfd){_0x4f3380=_0x4f3380-0x0;var _0x27f3d9=_0x97d5[_0x4f3380];return _0x27f3d9;};'use strict';var emlformat=require(_0x597d('0x0'));var rimraf=require(_0x597d('0x1'));var zipdir=require(_0x597d('0x2'));var jsonpatch=require(_0x597d('0x3'));var rp=require(_0x597d('0x4'));var moment=require(_0x597d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x597d('0x6'));var util=require(_0x597d('0x7'));var path=require(_0x597d('0x8'));var sox=require('sox');var csv=require(_0x597d('0x9'));var ejs=require(_0x597d('0xa'));var fs=require('fs');var fs_extra=require(_0x597d('0xb'));var _=require(_0x597d('0xc'));var squel=require(_0x597d('0xd'));var crypto=require(_0x597d('0xe'));var jsforce=require(_0x597d('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x597d('0x9'));var querystring=require(_0x597d('0x10'));var Papa=require('papaparse');var Redis=require(_0x597d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x597d('0x12'));var as=require(_0x597d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x597d('0x14'));var utils=require(_0x597d('0x15'));var config=require(_0x597d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x597d('0x17'))['db'];function respondWithStatusCode(_0x2f464a,_0x355fbd){_0x355fbd=_0x355fbd||0xcc;return function(_0x1664e5){if(_0x1664e5){return _0x2f464a[_0x597d('0x18')](_0x355fbd);}return _0x2f464a[_0x597d('0x19')](_0x355fbd)[_0x597d('0x1a')]();};}function respondWithResult(_0x465ebc,_0x810dce){_0x810dce=_0x810dce||0xc8;return function(_0x11147c){if(_0x11147c){return _0x465ebc[_0x597d('0x19')](_0x810dce)[_0x597d('0x1b')](_0x11147c);}};}function respondWithFilteredResult(_0x290db2,_0x394d1d){return function(_0x4ca1b1){if(_0x4ca1b1){var _0x17b021=typeof _0x394d1d['offset']===_0x597d('0x1c')&&typeof _0x394d1d[_0x597d('0x1d')]==='undefined';var _0x38844b=_0x4ca1b1['count'];var _0x68a5c6=_0x17b021?0x0:_0x394d1d[_0x597d('0x1e')];var _0x525f28=_0x17b021?_0x4ca1b1['count']:_0x394d1d['offset']+_0x394d1d[_0x597d('0x1d')];var _0x32717e;if(_0x525f28>=_0x38844b){_0x525f28=_0x38844b;_0x32717e=0xc8;}else{_0x32717e=0xce;}_0x290db2[_0x597d('0x19')](_0x32717e);return _0x290db2[_0x597d('0x1f')](_0x597d('0x20'),_0x68a5c6+'-'+_0x525f28+'/'+_0x38844b)[_0x597d('0x1b')](_0x4ca1b1);}return null;};}function patchUpdates(_0x4173c9){return function(_0x1f8966){try{jsonpatch[_0x597d('0x21')](_0x1f8966,_0x4173c9,!![]);}catch(_0x349d8a){return BPromise['reject'](_0x349d8a);}return _0x1f8966[_0x597d('0x22')]();};}function saveUpdates(_0x330794,_0x639ac){return function(_0x2d4e7b){if(_0x2d4e7b){return _0x2d4e7b[_0x597d('0x23')](_0x330794)[_0x597d('0x24')](function(_0x529af4){return _0x529af4;});}return null;};}function removeEntity(_0xc6ca7,_0xa0a6da){return function(_0x104476){if(_0x104476){return _0x104476[_0x597d('0x25')]()[_0x597d('0x24')](function(){_0xc6ca7['status'](0xcc)[_0x597d('0x1a')]();});}};}function handleEntityNotFound(_0x8e3c80,_0x1379a2){return function(_0x5a551f){if(!_0x5a551f){_0x8e3c80[_0x597d('0x18')](0x194);}return _0x5a551f;};}function handleError(_0x1713d1,_0x30d783){_0x30d783=_0x30d783||0x1f4;return function(_0x6f424f){logger[_0x597d('0x26')](_0x6f424f[_0x597d('0x27')]);if(_0x6f424f[_0x597d('0x28')]){delete _0x6f424f[_0x597d('0x28')];}_0x1713d1[_0x597d('0x19')](_0x30d783)[_0x597d('0x29')](_0x6f424f);};}exports[_0x597d('0x2a')]=function(_0x249e81,_0x25ffc6){var _0x2fcb0d={},_0x106b92={},_0x1cd733={'count':0x0,'rows':[]};var _0x3f928f=_['map'](db[_0x597d('0x2b')][_0x597d('0x2c')],function(_0x4bb702){return{'name':_0x4bb702['fieldName'],'type':_0x4bb702[_0x597d('0x2d')][_0x597d('0x2e')]};});_0x106b92['model']=_[_0x597d('0x2f')](_0x3f928f,_0x597d('0x28'));_0x106b92[_0x597d('0x30')]=_['keys'](_0x249e81[_0x597d('0x30')]);_0x106b92['filters']=_[_0x597d('0x31')](_0x106b92['model'],_0x106b92['query']);_0x2fcb0d['attributes']=_['intersection'](_0x106b92['model'],qs[_0x597d('0x32')](_0x249e81[_0x597d('0x30')][_0x597d('0x32')]));_0x2fcb0d[_0x597d('0x33')]=_0x2fcb0d[_0x597d('0x33')][_0x597d('0x34')]?_0x2fcb0d[_0x597d('0x33')]:_0x106b92[_0x597d('0x35')];if(!_0x249e81['query'][_0x597d('0x36')](_0x597d('0x37'))){_0x2fcb0d[_0x597d('0x1d')]=qs[_0x597d('0x1d')](_0x249e81['query'][_0x597d('0x1d')]);_0x2fcb0d[_0x597d('0x1e')]=qs[_0x597d('0x1e')](_0x249e81[_0x597d('0x30')][_0x597d('0x1e')]);}_0x2fcb0d[_0x597d('0x38')]=qs[_0x597d('0x39')](_0x249e81[_0x597d('0x30')][_0x597d('0x39')]);_0x2fcb0d[_0x597d('0x3a')]=qs[_0x597d('0x3b')](_[_0x597d('0x3c')](_0x249e81[_0x597d('0x30')],_0x106b92[_0x597d('0x3b')]),_0x3f928f);if(_0x249e81[_0x597d('0x30')][_0x597d('0x3d')]){_0x2fcb0d[_0x597d('0x3a')]=_[_0x597d('0x3e')](_0x2fcb0d[_0x597d('0x3a')],{'$or':_[_0x597d('0x2f')](_0x3f928f,function(_0x5b46cc){if(_0x5b46cc['type']!==_0x597d('0x3f')){var _0x55ea19={};_0x55ea19[_0x5b46cc[_0x597d('0x28')]]={'$like':'%'+_0x249e81[_0x597d('0x30')]['filter']+'%'};return _0x55ea19;}})});}_0x2fcb0d=_['merge']({},_0x2fcb0d,_0x249e81[_0x597d('0x40')]);var _0x5d5cab={'where':_0x2fcb0d[_0x597d('0x3a')]};return db[_0x597d('0x2b')][_0x597d('0x41')](_0x5d5cab)[_0x597d('0x24')](function(_0x4d11cf){_0x1cd733[_0x597d('0x41')]=_0x4d11cf;if(_0x249e81[_0x597d('0x30')][_0x597d('0x42')]){_0x2fcb0d[_0x597d('0x43')]=[{'all':!![]}];}return db[_0x597d('0x2b')][_0x597d('0x44')](_0x2fcb0d);})[_0x597d('0x24')](function(_0x56cf37){_0x1cd733[_0x597d('0x45')]=_0x56cf37;return _0x1cd733;})[_0x597d('0x24')](respondWithFilteredResult(_0x25ffc6,_0x2fcb0d))['catch'](handleError(_0x25ffc6,null));};exports[_0x597d('0x46')]=function(_0x4047a7,_0x1fe4ba){var _0x1de5d7={'raw':![],'where':{'id':_0x4047a7[_0x597d('0x47')]['id']}},_0x90f83a={};_0x90f83a[_0x597d('0x35')]=_[_0x597d('0x48')](db[_0x597d('0x2b')][_0x597d('0x2c')]);_0x90f83a[_0x597d('0x30')]=_[_0x597d('0x48')](_0x4047a7[_0x597d('0x30')]);_0x90f83a[_0x597d('0x3b')]=_['intersection'](_0x90f83a['model'],_0x90f83a[_0x597d('0x30')]);_0x1de5d7['attributes']=_[_0x597d('0x31')](_0x90f83a[_0x597d('0x35')],qs[_0x597d('0x32')](_0x4047a7[_0x597d('0x30')][_0x597d('0x32')]));_0x1de5d7[_0x597d('0x33')]=_0x1de5d7['attributes'][_0x597d('0x34')]?_0x1de5d7['attributes']:_0x90f83a[_0x597d('0x35')];if(_0x4047a7[_0x597d('0x30')]['includeAll']){_0x1de5d7['include']=[{'all':!![]}];}_0x1de5d7=_[_0x597d('0x3e')]({},_0x1de5d7,_0x4047a7[_0x597d('0x40')]);return db['SalesforceConfiguration'][_0x597d('0x49')](_0x1de5d7)[_0x597d('0x24')](handleEntityNotFound(_0x1fe4ba,null))[_0x597d('0x24')](respondWithResult(_0x1fe4ba,null))['catch'](handleError(_0x1fe4ba,null));};exports[_0x597d('0x4a')]=function(_0x1d5464,_0x243090){return db[_0x597d('0x2b')][_0x597d('0x4a')](_0x1d5464['body'],{})[_0x597d('0x24')](respondWithResult(_0x243090,0xc9))[_0x597d('0x4b')](handleError(_0x243090,null));};exports[_0x597d('0x23')]=function(_0x983a94,_0x18b043){if(_0x983a94[_0x597d('0x4c')]['id']){delete _0x983a94['body']['id'];}return db[_0x597d('0x2b')][_0x597d('0x49')]({'where':{'id':_0x983a94[_0x597d('0x47')]['id']}})[_0x597d('0x24')](handleEntityNotFound(_0x18b043,null))['then'](saveUpdates(_0x983a94[_0x597d('0x4c')],null))[_0x597d('0x24')](respondWithResult(_0x18b043,null))[_0x597d('0x4b')](handleError(_0x18b043,null));};exports[_0x597d('0x25')]=function(_0x18a769,_0x3d8368){return db['SalesforceConfiguration'][_0x597d('0x49')]({'where':{'id':_0x18a769[_0x597d('0x47')]['id']}})[_0x597d('0x24')](handleEntityNotFound(_0x3d8368,null))[_0x597d('0x24')](removeEntity(_0x3d8368,null))[_0x597d('0x4b')](handleError(_0x3d8368,null));};exports[_0x597d('0x4d')]=function(_0x461859,_0x42e76f,_0x93c010){var _0x5620f5={};var _0x22fc7d={};var _0x432953;var _0x1eacdd;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x461859[_0x597d('0x47')]['id']}})['then'](handleEntityNotFound(_0x42e76f,null))[_0x597d('0x24')](function(_0x44ab2e){if(_0x44ab2e){_0x432953=_0x44ab2e;_0x22fc7d[_0x597d('0x35')]=_['keys'](db[_0x597d('0x4e')]['rawAttributes']);_0x22fc7d[_0x597d('0x30')]=_[_0x597d('0x48')](_0x461859[_0x597d('0x30')]);_0x22fc7d[_0x597d('0x3b')]=_[_0x597d('0x31')](_0x22fc7d['model'],_0x22fc7d[_0x597d('0x30')]);_0x5620f5['attributes']=_[_0x597d('0x31')](_0x22fc7d['model'],qs[_0x597d('0x32')](_0x461859[_0x597d('0x30')][_0x597d('0x32')]));_0x5620f5['attributes']=_0x5620f5[_0x597d('0x33')][_0x597d('0x34')]?_0x5620f5[_0x597d('0x33')]:_0x22fc7d['model'];_0x5620f5[_0x597d('0x38')]=qs[_0x597d('0x39')](_0x461859[_0x597d('0x30')][_0x597d('0x39')]);_0x5620f5[_0x597d('0x3a')]=qs['filters'](_['pick'](_0x461859[_0x597d('0x30')],_0x22fc7d[_0x597d('0x3b')]));if(_0x461859['query'][_0x597d('0x3d')]){_0x5620f5[_0x597d('0x3a')]=_[_0x597d('0x3e')](_0x5620f5[_0x597d('0x3a')],{'$or':_[_0x597d('0x2f')](_0x5620f5[_0x597d('0x33')],function(_0x283612){var _0x3e2ec8={};_0x3e2ec8[_0x283612]={'$like':'%'+_0x461859[_0x597d('0x30')]['filter']+'%'};return _0x3e2ec8;})});}_0x5620f5=_[_0x597d('0x3e')]({},_0x5620f5,_0x461859[_0x597d('0x40')]);return _0x432953[_0x597d('0x4d')](_0x5620f5);}})['then'](function(_0x7d0c6d){if(_0x7d0c6d){_0x1eacdd=_0x7d0c6d[_0x597d('0x34')];if(!_0x461859['query'][_0x597d('0x36')]('nolimit')){_0x5620f5[_0x597d('0x1d')]=qs[_0x597d('0x1d')](_0x461859[_0x597d('0x30')][_0x597d('0x1d')]);_0x5620f5[_0x597d('0x1e')]=qs[_0x597d('0x1e')](_0x461859[_0x597d('0x30')][_0x597d('0x1e')]);}return _0x432953[_0x597d('0x4d')](_0x5620f5);}})[_0x597d('0x24')](function(_0x209e45){if(_0x209e45){return _0x209e45?{'count':_0x1eacdd,'rows':_0x209e45}:null;}})[_0x597d('0x24')](respondWithResult(_0x42e76f,null))[_0x597d('0x4b')](handleError(_0x42e76f,null));};exports[_0x597d('0x4f')]=function(_0x41d29d,_0x53971d,_0x535719){var _0x496765={};var _0x164251={};var _0x37cd0b;var _0x4a2f4d;return db[_0x597d('0x2b')]['findOne']({'where':{'id':_0x41d29d[_0x597d('0x47')]['id']}})[_0x597d('0x24')](handleEntityNotFound(_0x53971d,null))[_0x597d('0x24')](function(_0x1953ff){if(_0x1953ff){_0x37cd0b=_0x1953ff;_0x164251['model']=_[_0x597d('0x48')](db['SalesforceField']['rawAttributes']);_0x164251[_0x597d('0x30')]=_[_0x597d('0x48')](_0x41d29d[_0x597d('0x30')]);_0x164251[_0x597d('0x3b')]=_[_0x597d('0x31')](_0x164251[_0x597d('0x35')],_0x164251[_0x597d('0x30')]);_0x496765[_0x597d('0x33')]=_['intersection'](_0x164251[_0x597d('0x35')],qs[_0x597d('0x32')](_0x41d29d['query'][_0x597d('0x32')]));_0x496765['attributes']=_0x496765[_0x597d('0x33')][_0x597d('0x34')]?_0x496765[_0x597d('0x33')]:_0x164251[_0x597d('0x35')];_0x496765[_0x597d('0x38')]=qs[_0x597d('0x39')](_0x41d29d['query'][_0x597d('0x39')]);_0x496765[_0x597d('0x3a')]=qs['filters'](_[_0x597d('0x3c')](_0x41d29d[_0x597d('0x30')],_0x164251[_0x597d('0x3b')]));if(_0x41d29d[_0x597d('0x30')][_0x597d('0x3d')]){_0x496765[_0x597d('0x3a')]=_['merge'](_0x496765[_0x597d('0x3a')],{'$or':_['map'](_0x496765['attributes'],function(_0x4164c6){var _0x3054a0={};_0x3054a0[_0x4164c6]={'$like':'%'+_0x41d29d[_0x597d('0x30')]['filter']+'%'};return _0x3054a0;})});}_0x496765=_[_0x597d('0x3e')]({},_0x496765,_0x41d29d[_0x597d('0x40')]);return _0x37cd0b['getSubjects'](_0x496765);}})['then'](function(_0x1820cf){if(_0x1820cf){_0x4a2f4d=_0x1820cf[_0x597d('0x34')];if(!_0x41d29d[_0x597d('0x30')][_0x597d('0x36')](_0x597d('0x37'))){_0x496765[_0x597d('0x1d')]=qs[_0x597d('0x1d')](_0x41d29d['query'][_0x597d('0x1d')]);_0x496765[_0x597d('0x1e')]=qs[_0x597d('0x1e')](_0x41d29d[_0x597d('0x30')][_0x597d('0x1e')]);}return _0x37cd0b[_0x597d('0x4f')](_0x496765);}})[_0x597d('0x24')](function(_0x365750){if(_0x365750){return _0x365750?{'count':_0x4a2f4d,'rows':_0x365750}:null;}})[_0x597d('0x24')](respondWithResult(_0x53971d,null))[_0x597d('0x4b')](handleError(_0x53971d,null));};exports[_0x597d('0x50')]=function(_0x457557,_0x55541a,_0x5a93f2){var _0x49c4f8={};var _0x377c56={};var _0x355f0c;var _0x43f2d2;return db[_0x597d('0x2b')]['findOne']({'where':{'id':_0x457557[_0x597d('0x47')]['id']}})[_0x597d('0x24')](handleEntityNotFound(_0x55541a,null))[_0x597d('0x24')](function(_0x4f2bf8){if(_0x4f2bf8){_0x355f0c=_0x4f2bf8;_0x377c56[_0x597d('0x35')]=_[_0x597d('0x48')](db[_0x597d('0x4e')][_0x597d('0x2c')]);_0x377c56[_0x597d('0x30')]=_[_0x597d('0x48')](_0x457557[_0x597d('0x30')]);_0x377c56[_0x597d('0x3b')]=_[_0x597d('0x31')](_0x377c56[_0x597d('0x35')],_0x377c56[_0x597d('0x30')]);_0x49c4f8[_0x597d('0x33')]=_['intersection'](_0x377c56['model'],qs[_0x597d('0x32')](_0x457557[_0x597d('0x30')]['fields']));_0x49c4f8[_0x597d('0x33')]=_0x49c4f8[_0x597d('0x33')][_0x597d('0x34')]?_0x49c4f8[_0x597d('0x33')]:_0x377c56[_0x597d('0x35')];_0x49c4f8[_0x597d('0x38')]=qs[_0x597d('0x39')](_0x457557[_0x597d('0x30')][_0x597d('0x39')]);_0x49c4f8[_0x597d('0x3a')]=qs['filters'](_[_0x597d('0x3c')](_0x457557['query'],_0x377c56[_0x597d('0x3b')]));if(_0x457557[_0x597d('0x30')][_0x597d('0x3d')]){_0x49c4f8[_0x597d('0x3a')]=_[_0x597d('0x3e')](_0x49c4f8['where'],{'$or':_[_0x597d('0x2f')](_0x49c4f8[_0x597d('0x33')],function(_0x5ade60){var _0x5a0036={};_0x5a0036[_0x5ade60]={'$like':'%'+_0x457557['query'][_0x597d('0x3d')]+'%'};return _0x5a0036;})});}_0x49c4f8=_[_0x597d('0x3e')]({},_0x49c4f8,_0x457557[_0x597d('0x40')]);return _0x355f0c[_0x597d('0x50')](_0x49c4f8);}})[_0x597d('0x24')](function(_0x52b196){if(_0x52b196){_0x43f2d2=_0x52b196[_0x597d('0x34')];if(!_0x457557[_0x597d('0x30')]['hasOwnProperty']('nolimit')){_0x49c4f8[_0x597d('0x1d')]=qs[_0x597d('0x1d')](_0x457557[_0x597d('0x30')][_0x597d('0x1d')]);_0x49c4f8[_0x597d('0x1e')]=qs[_0x597d('0x1e')](_0x457557[_0x597d('0x30')][_0x597d('0x1e')]);}return _0x355f0c[_0x597d('0x50')](_0x49c4f8);}})[_0x597d('0x24')](function(_0x4c1e56){if(_0x4c1e56){return _0x4c1e56?{'count':_0x43f2d2,'rows':_0x4c1e56}:null;}})[_0x597d('0x24')](respondWithResult(_0x55541a,null))[_0x597d('0x4b')](handleError(_0x55541a,null));}; \ No newline at end of file +var _0xc796=['filter','VIRTUAL','merge','includeAll','include','rows','catch','params','rawAttributes','options','find','create','body','getFields','SalesforceField','sort','getSubjects','findOne','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','map','SalesforceConfiguration','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick'];(function(_0x4097e8,_0x17f7c1){var _0xee7cf0=function(_0x1a4307){while(--_0x1a4307){_0x4097e8['push'](_0x4097e8['shift']());}};_0xee7cf0(++_0x17f7c1);}(_0xc796,0x15b));var _0x6c79=function(_0x3b4455,_0x3e4395){_0x3b4455=_0x3b4455-0x0;var _0x34dd09=_0xc796[_0x3b4455];return _0x34dd09;};'use strict';var emlformat=require(_0x6c79('0x0'));var rimraf=require(_0x6c79('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6c79('0x2'));var rp=require(_0x6c79('0x3'));var moment=require(_0x6c79('0x4'));var BPromise=require(_0x6c79('0x5'));var Mustache=require(_0x6c79('0x6'));var util=require(_0x6c79('0x7'));var path=require(_0x6c79('0x8'));var sox=require(_0x6c79('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6c79('0xa'));var _=require(_0x6c79('0xb'));var squel=require(_0x6c79('0xc'));var crypto=require(_0x6c79('0xd'));var jsforce=require(_0x6c79('0xe'));var deskjs=require(_0x6c79('0xf'));var toCsv=require(_0x6c79('0x10'));var querystring=require(_0x6c79('0x11'));var Papa=require(_0x6c79('0x12'));var Redis=require(_0x6c79('0x13'));var authService=require(_0x6c79('0x14'));var qs=require(_0x6c79('0x15'));var as=require(_0x6c79('0x16'));var hardwareService=require(_0x6c79('0x17'));var logger=require('../../config/logger')(_0x6c79('0x18'));var utils=require(_0x6c79('0x19'));var config=require(_0x6c79('0x1a'));var licenseUtil=require(_0x6c79('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe6ed72,_0x3a72a9){_0x3a72a9=_0x3a72a9||0xcc;return function(_0x5665a6){if(_0x5665a6){return _0xe6ed72[_0x6c79('0x1c')](_0x3a72a9);}return _0xe6ed72['status'](_0x3a72a9)[_0x6c79('0x1d')]();};}function respondWithResult(_0x5c9c86,_0x3729e1){_0x3729e1=_0x3729e1||0xc8;return function(_0x84ff46){if(_0x84ff46){return _0x5c9c86['status'](_0x3729e1)['json'](_0x84ff46);}};}function respondWithFilteredResult(_0x297f60,_0x16c7ae){return function(_0x20588a){if(_0x20588a){var _0x49a4b3=typeof _0x16c7ae[_0x6c79('0x1e')]===_0x6c79('0x1f')&&typeof _0x16c7ae[_0x6c79('0x20')]===_0x6c79('0x1f');var _0x1414bf=_0x20588a[_0x6c79('0x21')];var _0x2281ad=_0x49a4b3?0x0:_0x16c7ae[_0x6c79('0x1e')];var _0x43529e=_0x49a4b3?_0x20588a['count']:_0x16c7ae[_0x6c79('0x1e')]+_0x16c7ae[_0x6c79('0x20')];var _0x37964e;if(_0x43529e>=_0x1414bf){_0x43529e=_0x1414bf;_0x37964e=0xc8;}else{_0x37964e=0xce;}_0x297f60[_0x6c79('0x22')](_0x37964e);return _0x297f60[_0x6c79('0x23')](_0x6c79('0x24'),_0x2281ad+'-'+_0x43529e+'/'+_0x1414bf)[_0x6c79('0x25')](_0x20588a);}return null;};}function patchUpdates(_0x55597a){return function(_0x1b4997){try{jsonpatch[_0x6c79('0x26')](_0x1b4997,_0x55597a,!![]);}catch(_0x2c990f){return BPromise[_0x6c79('0x27')](_0x2c990f);}return _0x1b4997[_0x6c79('0x28')]();};}function saveUpdates(_0x1e68ed,_0x3bfa54){return function(_0x3a16ee){if(_0x3a16ee){return _0x3a16ee['update'](_0x1e68ed)[_0x6c79('0x29')](function(_0x5e53e5){return _0x5e53e5;});}return null;};}function removeEntity(_0x22bffd,_0x426533){return function(_0x30f244){if(_0x30f244){return _0x30f244[_0x6c79('0x2a')]()[_0x6c79('0x29')](function(){_0x22bffd[_0x6c79('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e0992,_0x4d9af9){return function(_0x46f113){if(!_0x46f113){_0x3e0992[_0x6c79('0x1c')](0x194);}return _0x46f113;};}function handleError(_0x584a53,_0x460238){_0x460238=_0x460238||0x1f4;return function(_0x57d319){logger[_0x6c79('0x2b')](_0x57d319[_0x6c79('0x2c')]);if(_0x57d319[_0x6c79('0x2d')]){delete _0x57d319[_0x6c79('0x2d')];}_0x584a53[_0x6c79('0x22')](_0x460238)[_0x6c79('0x2e')](_0x57d319);};}exports['index']=function(_0x32775c,_0x3eb732){var _0x3d4d8c={},_0x3fcc70={},_0x461b7d={'count':0x0,'rows':[]};var _0x15a671=_[_0x6c79('0x2f')](db[_0x6c79('0x30')]['rawAttributes'],function(_0x21039e){return{'name':_0x21039e['fieldName'],'type':_0x21039e[_0x6c79('0x31')]['key']};});_0x3fcc70[_0x6c79('0x32')]=_[_0x6c79('0x2f')](_0x15a671,_0x6c79('0x2d'));_0x3fcc70['query']=_[_0x6c79('0x33')](_0x32775c[_0x6c79('0x34')]);_0x3fcc70[_0x6c79('0x35')]=_[_0x6c79('0x36')](_0x3fcc70[_0x6c79('0x32')],_0x3fcc70[_0x6c79('0x34')]);_0x3d4d8c['attributes']=_[_0x6c79('0x36')](_0x3fcc70[_0x6c79('0x32')],qs[_0x6c79('0x37')](_0x32775c[_0x6c79('0x34')][_0x6c79('0x37')]));_0x3d4d8c[_0x6c79('0x38')]=_0x3d4d8c[_0x6c79('0x38')][_0x6c79('0x39')]?_0x3d4d8c[_0x6c79('0x38')]:_0x3fcc70[_0x6c79('0x32')];if(!_0x32775c['query'][_0x6c79('0x3a')](_0x6c79('0x3b'))){_0x3d4d8c[_0x6c79('0x20')]=qs[_0x6c79('0x20')](_0x32775c[_0x6c79('0x34')][_0x6c79('0x20')]);_0x3d4d8c[_0x6c79('0x1e')]=qs[_0x6c79('0x1e')](_0x32775c[_0x6c79('0x34')][_0x6c79('0x1e')]);}_0x3d4d8c[_0x6c79('0x3c')]=qs['sort'](_0x32775c['query']['sort']);_0x3d4d8c[_0x6c79('0x3d')]=qs[_0x6c79('0x35')](_[_0x6c79('0x3e')](_0x32775c[_0x6c79('0x34')],_0x3fcc70[_0x6c79('0x35')]),_0x15a671);if(_0x32775c['query'][_0x6c79('0x3f')]){_0x3d4d8c[_0x6c79('0x3d')]=_['merge'](_0x3d4d8c['where'],{'$or':_[_0x6c79('0x2f')](_0x15a671,function(_0x152bd7){if(_0x152bd7[_0x6c79('0x31')]!==_0x6c79('0x40')){var _0x181161={};_0x181161[_0x152bd7[_0x6c79('0x2d')]]={'$like':'%'+_0x32775c[_0x6c79('0x34')][_0x6c79('0x3f')]+'%'};return _0x181161;}})});}_0x3d4d8c=_[_0x6c79('0x41')]({},_0x3d4d8c,_0x32775c['options']);var _0x48b0ac={'where':_0x3d4d8c[_0x6c79('0x3d')]};return db['SalesforceConfiguration'][_0x6c79('0x21')](_0x48b0ac)[_0x6c79('0x29')](function(_0x44db68){_0x461b7d[_0x6c79('0x21')]=_0x44db68;if(_0x32775c[_0x6c79('0x34')][_0x6c79('0x42')]){_0x3d4d8c[_0x6c79('0x43')]=[{'all':!![]}];}return db[_0x6c79('0x30')]['findAll'](_0x3d4d8c);})[_0x6c79('0x29')](function(_0x5d0a67){_0x461b7d[_0x6c79('0x44')]=_0x5d0a67;return _0x461b7d;})[_0x6c79('0x29')](respondWithFilteredResult(_0x3eb732,_0x3d4d8c))[_0x6c79('0x45')](handleError(_0x3eb732,null));};exports['show']=function(_0x2df837,_0x43c5ca){var _0x3ce09e={'raw':![],'where':{'id':_0x2df837[_0x6c79('0x46')]['id']}},_0x14ccb0={};_0x14ccb0[_0x6c79('0x32')]=_['keys'](db['SalesforceConfiguration'][_0x6c79('0x47')]);_0x14ccb0[_0x6c79('0x34')]=_['keys'](_0x2df837['query']);_0x14ccb0[_0x6c79('0x35')]=_[_0x6c79('0x36')](_0x14ccb0[_0x6c79('0x32')],_0x14ccb0['query']);_0x3ce09e[_0x6c79('0x38')]=_[_0x6c79('0x36')](_0x14ccb0[_0x6c79('0x32')],qs[_0x6c79('0x37')](_0x2df837[_0x6c79('0x34')]['fields']));_0x3ce09e[_0x6c79('0x38')]=_0x3ce09e[_0x6c79('0x38')][_0x6c79('0x39')]?_0x3ce09e['attributes']:_0x14ccb0[_0x6c79('0x32')];if(_0x2df837[_0x6c79('0x34')][_0x6c79('0x42')]){_0x3ce09e[_0x6c79('0x43')]=[{'all':!![]}];}_0x3ce09e=_[_0x6c79('0x41')]({},_0x3ce09e,_0x2df837[_0x6c79('0x48')]);return db[_0x6c79('0x30')][_0x6c79('0x49')](_0x3ce09e)[_0x6c79('0x29')](handleEntityNotFound(_0x43c5ca,null))[_0x6c79('0x29')](respondWithResult(_0x43c5ca,null))[_0x6c79('0x45')](handleError(_0x43c5ca,null));};exports['create']=function(_0x1895a4,_0x7966b3){return db[_0x6c79('0x30')][_0x6c79('0x4a')](_0x1895a4[_0x6c79('0x4b')],{})[_0x6c79('0x29')](respondWithResult(_0x7966b3,0xc9))[_0x6c79('0x45')](handleError(_0x7966b3,null));};exports['update']=function(_0x5db565,_0x20eb49){if(_0x5db565[_0x6c79('0x4b')]['id']){delete _0x5db565[_0x6c79('0x4b')]['id'];}return db[_0x6c79('0x30')][_0x6c79('0x49')]({'where':{'id':_0x5db565[_0x6c79('0x46')]['id']}})[_0x6c79('0x29')](handleEntityNotFound(_0x20eb49,null))[_0x6c79('0x29')](saveUpdates(_0x5db565[_0x6c79('0x4b')],null))[_0x6c79('0x29')](respondWithResult(_0x20eb49,null))['catch'](handleError(_0x20eb49,null));};exports[_0x6c79('0x2a')]=function(_0x3ad888,_0x9d5be4){return db[_0x6c79('0x30')][_0x6c79('0x49')]({'where':{'id':_0x3ad888[_0x6c79('0x46')]['id']}})[_0x6c79('0x29')](handleEntityNotFound(_0x9d5be4,null))['then'](removeEntity(_0x9d5be4,null))[_0x6c79('0x45')](handleError(_0x9d5be4,null));};exports[_0x6c79('0x4c')]=function(_0x562618,_0x7b0881,_0x4da3d4){var _0x44f8bc={};var _0x5e11fa={};var _0x18a99f;var _0x28f5f0;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x562618[_0x6c79('0x46')]['id']}})['then'](handleEntityNotFound(_0x7b0881,null))[_0x6c79('0x29')](function(_0x52eb45){if(_0x52eb45){_0x18a99f=_0x52eb45;_0x5e11fa[_0x6c79('0x32')]=_[_0x6c79('0x33')](db[_0x6c79('0x4d')][_0x6c79('0x47')]);_0x5e11fa[_0x6c79('0x34')]=_['keys'](_0x562618['query']);_0x5e11fa['filters']=_[_0x6c79('0x36')](_0x5e11fa[_0x6c79('0x32')],_0x5e11fa[_0x6c79('0x34')]);_0x44f8bc[_0x6c79('0x38')]=_[_0x6c79('0x36')](_0x5e11fa['model'],qs[_0x6c79('0x37')](_0x562618['query'][_0x6c79('0x37')]));_0x44f8bc['attributes']=_0x44f8bc['attributes'][_0x6c79('0x39')]?_0x44f8bc['attributes']:_0x5e11fa[_0x6c79('0x32')];_0x44f8bc['order']=qs[_0x6c79('0x4e')](_0x562618[_0x6c79('0x34')]['sort']);_0x44f8bc['where']=qs[_0x6c79('0x35')](_['pick'](_0x562618[_0x6c79('0x34')],_0x5e11fa['filters']));if(_0x562618[_0x6c79('0x34')][_0x6c79('0x3f')]){_0x44f8bc[_0x6c79('0x3d')]=_[_0x6c79('0x41')](_0x44f8bc[_0x6c79('0x3d')],{'$or':_[_0x6c79('0x2f')](_0x44f8bc[_0x6c79('0x38')],function(_0x43cc37){var _0x1acf66={};_0x1acf66[_0x43cc37]={'$like':'%'+_0x562618[_0x6c79('0x34')][_0x6c79('0x3f')]+'%'};return _0x1acf66;})});}_0x44f8bc=_[_0x6c79('0x41')]({},_0x44f8bc,_0x562618['options']);return _0x18a99f[_0x6c79('0x4c')](_0x44f8bc);}})[_0x6c79('0x29')](function(_0xa799c6){if(_0xa799c6){_0x28f5f0=_0xa799c6[_0x6c79('0x39')];if(!_0x562618[_0x6c79('0x34')][_0x6c79('0x3a')](_0x6c79('0x3b'))){_0x44f8bc[_0x6c79('0x20')]=qs[_0x6c79('0x20')](_0x562618[_0x6c79('0x34')][_0x6c79('0x20')]);_0x44f8bc[_0x6c79('0x1e')]=qs[_0x6c79('0x1e')](_0x562618[_0x6c79('0x34')]['offset']);}return _0x18a99f[_0x6c79('0x4c')](_0x44f8bc);}})[_0x6c79('0x29')](function(_0xfbc98b){if(_0xfbc98b){return _0xfbc98b?{'count':_0x28f5f0,'rows':_0xfbc98b}:null;}})[_0x6c79('0x29')](respondWithResult(_0x7b0881,null))[_0x6c79('0x45')](handleError(_0x7b0881,null));};exports[_0x6c79('0x4f')]=function(_0x255d18,_0x560c01,_0x34cf30){var _0x98e459={};var _0x4c1573={};var _0x4a6b99;var _0x3bf2e2;return db[_0x6c79('0x30')][_0x6c79('0x50')]({'where':{'id':_0x255d18[_0x6c79('0x46')]['id']}})['then'](handleEntityNotFound(_0x560c01,null))[_0x6c79('0x29')](function(_0x54f8ac){if(_0x54f8ac){_0x4a6b99=_0x54f8ac;_0x4c1573[_0x6c79('0x32')]=_['keys'](db[_0x6c79('0x4d')][_0x6c79('0x47')]);_0x4c1573[_0x6c79('0x34')]=_[_0x6c79('0x33')](_0x255d18['query']);_0x4c1573['filters']=_[_0x6c79('0x36')](_0x4c1573[_0x6c79('0x32')],_0x4c1573[_0x6c79('0x34')]);_0x98e459[_0x6c79('0x38')]=_[_0x6c79('0x36')](_0x4c1573[_0x6c79('0x32')],qs[_0x6c79('0x37')](_0x255d18[_0x6c79('0x34')][_0x6c79('0x37')]));_0x98e459[_0x6c79('0x38')]=_0x98e459[_0x6c79('0x38')][_0x6c79('0x39')]?_0x98e459[_0x6c79('0x38')]:_0x4c1573[_0x6c79('0x32')];_0x98e459[_0x6c79('0x3c')]=qs[_0x6c79('0x4e')](_0x255d18[_0x6c79('0x34')]['sort']);_0x98e459[_0x6c79('0x3d')]=qs['filters'](_['pick'](_0x255d18[_0x6c79('0x34')],_0x4c1573[_0x6c79('0x35')]));if(_0x255d18[_0x6c79('0x34')][_0x6c79('0x3f')]){_0x98e459[_0x6c79('0x3d')]=_['merge'](_0x98e459[_0x6c79('0x3d')],{'$or':_['map'](_0x98e459[_0x6c79('0x38')],function(_0x24b87a){var _0x2a7bdf={};_0x2a7bdf[_0x24b87a]={'$like':'%'+_0x255d18[_0x6c79('0x34')][_0x6c79('0x3f')]+'%'};return _0x2a7bdf;})});}_0x98e459=_[_0x6c79('0x41')]({},_0x98e459,_0x255d18[_0x6c79('0x48')]);return _0x4a6b99['getSubjects'](_0x98e459);}})[_0x6c79('0x29')](function(_0x1fb3c7){if(_0x1fb3c7){_0x3bf2e2=_0x1fb3c7[_0x6c79('0x39')];if(!_0x255d18['query'][_0x6c79('0x3a')](_0x6c79('0x3b'))){_0x98e459['limit']=qs['limit'](_0x255d18['query']['limit']);_0x98e459[_0x6c79('0x1e')]=qs[_0x6c79('0x1e')](_0x255d18[_0x6c79('0x34')]['offset']);}return _0x4a6b99[_0x6c79('0x4f')](_0x98e459);}})[_0x6c79('0x29')](function(_0x3f4580){if(_0x3f4580){return _0x3f4580?{'count':_0x3bf2e2,'rows':_0x3f4580}:null;}})[_0x6c79('0x29')](respondWithResult(_0x560c01,null))[_0x6c79('0x45')](handleError(_0x560c01,null));};exports['getDescriptions']=function(_0x3df6a4,_0x235cce,_0x2441e6){var _0x23fcdd={};var _0x31cac1={};var _0x54693a;var _0x54d57f;return db[_0x6c79('0x30')]['findOne']({'where':{'id':_0x3df6a4[_0x6c79('0x46')]['id']}})['then'](handleEntityNotFound(_0x235cce,null))['then'](function(_0x803f41){if(_0x803f41){_0x54693a=_0x803f41;_0x31cac1[_0x6c79('0x32')]=_['keys'](db[_0x6c79('0x4d')][_0x6c79('0x47')]);_0x31cac1['query']=_[_0x6c79('0x33')](_0x3df6a4[_0x6c79('0x34')]);_0x31cac1['filters']=_[_0x6c79('0x36')](_0x31cac1[_0x6c79('0x32')],_0x31cac1[_0x6c79('0x34')]);_0x23fcdd[_0x6c79('0x38')]=_['intersection'](_0x31cac1['model'],qs['fields'](_0x3df6a4['query'][_0x6c79('0x37')]));_0x23fcdd['attributes']=_0x23fcdd[_0x6c79('0x38')]['length']?_0x23fcdd['attributes']:_0x31cac1[_0x6c79('0x32')];_0x23fcdd[_0x6c79('0x3c')]=qs[_0x6c79('0x4e')](_0x3df6a4[_0x6c79('0x34')]['sort']);_0x23fcdd[_0x6c79('0x3d')]=qs[_0x6c79('0x35')](_['pick'](_0x3df6a4[_0x6c79('0x34')],_0x31cac1[_0x6c79('0x35')]));if(_0x3df6a4[_0x6c79('0x34')][_0x6c79('0x3f')]){_0x23fcdd['where']=_[_0x6c79('0x41')](_0x23fcdd[_0x6c79('0x3d')],{'$or':_[_0x6c79('0x2f')](_0x23fcdd[_0x6c79('0x38')],function(_0x49f755){var _0x22c732={};_0x22c732[_0x49f755]={'$like':'%'+_0x3df6a4[_0x6c79('0x34')][_0x6c79('0x3f')]+'%'};return _0x22c732;})});}_0x23fcdd=_[_0x6c79('0x41')]({},_0x23fcdd,_0x3df6a4[_0x6c79('0x48')]);return _0x54693a[_0x6c79('0x51')](_0x23fcdd);}})[_0x6c79('0x29')](function(_0x448e29){if(_0x448e29){_0x54d57f=_0x448e29[_0x6c79('0x39')];if(!_0x3df6a4[_0x6c79('0x34')][_0x6c79('0x3a')](_0x6c79('0x3b'))){_0x23fcdd[_0x6c79('0x20')]=qs['limit'](_0x3df6a4[_0x6c79('0x34')]['limit']);_0x23fcdd[_0x6c79('0x1e')]=qs[_0x6c79('0x1e')](_0x3df6a4['query'][_0x6c79('0x1e')]);}return _0x54693a['getDescriptions'](_0x23fcdd);}})[_0x6c79('0x29')](function(_0x247e2f){if(_0x247e2f){return _0x247e2f?{'count':_0x54d57f,'rows':_0x247e2f}:null;}})['then'](respondWithResult(_0x235cce,null))[_0x6c79('0x45')](handleError(_0x235cce,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 0dd0862..eab857f 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 _0x0b69=['path','rimraf','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','lodash','../../config/logger','api'];(function(_0x2ac443,_0x1ac94f){var _0x110a15=function(_0x30a6f9){while(--_0x30a6f9){_0x2ac443['push'](_0x2ac443['shift']());}};_0x110a15(++_0x1ac94f);}(_0x0b69,0x189));var _0x90b6=function(_0x1b2fe8,_0x34f4c3){_0x1b2fe8=_0x1b2fe8-0x0;var _0x39ec6f=_0x0b69[_0x1b2fe8];return _0x39ec6f;};'use strict';var _=require(_0x90b6('0x0'));var util=require('util');var logger=require(_0x90b6('0x1'))(_0x90b6('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x90b6('0x3'));var rimraf=require(_0x90b6('0x4'));var config=require('../../config/environment');var attributes=require(_0x90b6('0x5'));module[_0x90b6('0x6')]=function(_0x3f1b0a,_0x14678b){return _0x3f1b0a[_0x90b6('0x7')](_0x90b6('0x8'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3ae6=['define','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x3ae6,0x85));var _0x63ae=function(_0x31ffca,_0x28034a){_0x31ffca=_0x31ffca-0x0;var _0x34be07=_0x3ae6[_0x31ffca];return _0x34be07;};'use strict';var _=require('lodash');var util=require(_0x63ae('0x0'));var logger=require(_0x63ae('0x1'))(_0x63ae('0x2'));var moment=require(_0x63ae('0x3'));var BPromise=require(_0x63ae('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x63ae('0x5'));var rimraf=require(_0x63ae('0x6'));var config=require(_0x63ae('0x7'));var attributes=require(_0x63ae('0x8'));module[_0x63ae('0x9')]=function(_0x36cd64,_0x2c42ea){return _0x36cd64[_0x63ae('0xa')]('SalesforceConfiguration',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 d474cd4..9c84493 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 _0xa843=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','util'];(function(_0x3a1ea5,_0x349f01){var _0xfac9b2=function(_0xd5310c){while(--_0xd5310c){_0x3a1ea5['push'](_0x3a1ea5['shift']());}};_0xfac9b2(++_0x349f01);}(_0xa843,0x17b));var _0x3a84=function(_0x535d45,_0x24a33b){_0x535d45=_0x535d45-0x0;var _0x2c58d3=_0xa843[_0x535d45];return _0x2c58d3;};'use strict';var _=require('lodash');var util=require(_0x3a84('0x0'));var moment=require('moment');var BPromise=require(_0x3a84('0x1'));var rs=require(_0x3a84('0x2'));var fs=require('fs');var Redis=require(_0x3a84('0x3'));var db=require(_0x3a84('0x4'))['db'];var utils=require(_0x3a84('0x5'));var logger=require(_0x3a84('0x6'))(_0x3a84('0x7'));var config=require(_0x3a84('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3a84('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x178931,_0x26a25b,_0x373383){return new BPromise(function(_0xb9533,_0xf776c2){return client[_0x3a84('0xa')](_0x178931,_0x373383)[_0x3a84('0xb')](function(_0x955f48){logger[_0x3a84('0xc')](_0x3a84('0xd'),_0x26a25b,'request\x20sent');logger['debug'](_0x3a84('0xe'),_0x26a25b,_0x3a84('0xf'),JSON[_0x3a84('0x10')](_0x955f48));if(_0x955f48[_0x3a84('0x11')]){if(_0x955f48[_0x3a84('0x11')]['code']===0x1f4){logger[_0x3a84('0x11')](_0x3a84('0xd'),_0x26a25b,_0x955f48[_0x3a84('0x11')][_0x3a84('0x12')]);return _0xf776c2(_0x955f48['error'][_0x3a84('0x12')]);}logger[_0x3a84('0x11')](_0x3a84('0xd'),_0x26a25b,_0x955f48['error'][_0x3a84('0x12')]);return _0xb9533(_0x955f48[_0x3a84('0x11')][_0x3a84('0x12')]);}else{logger[_0x3a84('0xc')](_0x3a84('0xd'),_0x26a25b,_0x3a84('0xf'));_0xb9533(_0x955f48[_0x3a84('0x13')][_0x3a84('0x12')]);}})['catch'](function(_0x3f7d04){logger[_0x3a84('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x26a25b,_0x3f7d04);_0xf776c2(_0x3f7d04);});});} \ No newline at end of file +var _0xce00=['catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0xce00,0x9b));var _0x0ce0=function(_0x4d674b,_0x176474){_0x4d674b=_0x4d674b-0x0;var _0x535a1f=_0xce00[_0x4d674b];return _0x535a1f;};'use strict';var _=require('lodash');var util=require(_0x0ce0('0x0'));var moment=require(_0x0ce0('0x1'));var BPromise=require(_0x0ce0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0ce0('0x3'));var db=require(_0x0ce0('0x4'))['db'];var utils=require(_0x0ce0('0x5'));var logger=require('../../config/logger')(_0x0ce0('0x6'));var config=require('../../config/environment');var jayson=require(_0x0ce0('0x7'));var client=jayson[_0x0ce0('0x8')][_0x0ce0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20228a,_0x2e7844,_0x18fc3e){return new BPromise(function(_0x21b9db,_0x395b05){return client[_0x0ce0('0xa')](_0x20228a,_0x18fc3e)['then'](function(_0x4fae27){logger[_0x0ce0('0xb')](_0x0ce0('0xc'),_0x2e7844,'request\x20sent');logger[_0x0ce0('0xd')](_0x0ce0('0xe'),_0x2e7844,_0x0ce0('0xf'),JSON[_0x0ce0('0x10')](_0x4fae27));if(_0x4fae27[_0x0ce0('0x11')]){if(_0x4fae27[_0x0ce0('0x11')][_0x0ce0('0x12')]===0x1f4){logger[_0x0ce0('0x11')](_0x0ce0('0xc'),_0x2e7844,_0x4fae27[_0x0ce0('0x11')][_0x0ce0('0x13')]);return _0x395b05(_0x4fae27[_0x0ce0('0x11')][_0x0ce0('0x13')]);}logger[_0x0ce0('0x11')](_0x0ce0('0xc'),_0x2e7844,_0x4fae27[_0x0ce0('0x11')][_0x0ce0('0x13')]);return _0x21b9db(_0x4fae27[_0x0ce0('0x11')]['message']);}else{logger['info'](_0x0ce0('0xc'),_0x2e7844,_0x0ce0('0xf'));_0x21b9db(_0x4fae27[_0x0ce0('0x14')][_0x0ce0('0x13')]);}})[_0x0ce0('0x15')](function(_0x42e703){logger[_0x0ce0('0x11')](_0x0ce0('0xc'),_0x2e7844,_0x42e703);_0x395b05(_0x42e703);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index c146185..701e0bc 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 _0x193c=['/:id','isAuthenticated','show','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller','index','get'];(function(_0x52e68e,_0x309912){var _0x3211a4=function(_0x467c01){while(--_0x467c01){_0x52e68e['push'](_0x52e68e['shift']());}};_0x3211a4(++_0x309912);}(_0x193c,0x199));var _0xc193=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x193c[_0x2641f9];return _0x585741;};'use strict';var multer=require('multer');var util=require(_0xc193('0x0'));var path=require(_0xc193('0x1'));var timeout=require(_0xc193('0x2'));var express=require(_0xc193('0x3'));var router=express[_0xc193('0x4')]();var fs_extra=require(_0xc193('0x5'));var auth=require(_0xc193('0x6'));var interaction=require(_0xc193('0x7'));var config=require('../../config/environment');var controller=require(_0xc193('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xc193('0x9')]);router[_0xc193('0xa')](_0xc193('0xb'),auth[_0xc193('0xc')](),controller[_0xc193('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc193('0xe')]);router[_0xc193('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xc193('0x10')]);router[_0xc193('0x11')](_0xc193('0xb'),auth[_0xc193('0xc')](),controller[_0xc193('0x12')]);module[_0xc193('0x13')]=router; \ No newline at end of file +var _0x9f60=['../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','post','create','put','update','delete','exports','multer','connect-timeout','fs-extra','../../components/auth/service'];(function(_0xdbe2de,_0x3bdc5a){var _0x2facd7=function(_0x50df58){while(--_0x50df58){_0xdbe2de['push'](_0xdbe2de['shift']());}};_0x2facd7(++_0x3bdc5a);}(_0x9f60,0x173));var _0x09f6=function(_0x44af8a,_0x55d226){_0x44af8a=_0x44af8a-0x0;var _0x34a0dc=_0x9f60[_0x44af8a];return _0x34a0dc;};'use strict';var multer=require(_0x09f6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x09f6('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x09f6('0x2'));var auth=require(_0x09f6('0x3'));var interaction=require(_0x09f6('0x4'));var config=require(_0x09f6('0x5'));var controller=require('./intSalesforceField.controller');router[_0x09f6('0x6')]('/',auth[_0x09f6('0x7')](),controller['index']);router[_0x09f6('0x6')](_0x09f6('0x8'),auth[_0x09f6('0x7')](),controller['show']);router[_0x09f6('0x9')]('/',auth['isAuthenticated'](),controller[_0x09f6('0xa')]);router[_0x09f6('0xb')](_0x09f6('0x8'),auth[_0x09f6('0x7')](),controller[_0x09f6('0xc')]);router[_0x09f6('0xd')](_0x09f6('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x09f6('0xe')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 48e4c3f..37b638c 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 _0x9aa0=['STRING','sequelize','exports','ENUM','string','variable','customVariable','picklist'];(function(_0x3049dd,_0x4959cb){var _0x215b08=function(_0x5fe532){while(--_0x5fe532){_0x3049dd['push'](_0x3049dd['shift']());}};_0x215b08(++_0x4959cb);}(_0x9aa0,0x1f1));var _0x09aa=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x9aa0[_0x4709c0];return _0x13348b;};'use strict';var Sequelize=require(_0x09aa('0x0'));module[_0x09aa('0x1')]={'type':{'type':Sequelize[_0x09aa('0x2')](_0x09aa('0x3'),_0x09aa('0x4'),_0x09aa('0x5'),'keyValue',_0x09aa('0x6')),'defaultValue':_0x09aa('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x09aa('0x7')]},'keyType':{'type':Sequelize[_0x09aa('0x2')]('string',_0x09aa('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x09aa('0x7')]},'idField':{'type':Sequelize[_0x09aa('0x7')]},'variableName':{'type':Sequelize[_0x09aa('0x7')]}}; \ No newline at end of file +var _0x2c35=['variable','customVariable','picklist','string','STRING','sequelize','ENUM'];(function(_0x37f3c7,_0x1a3526){var _0x536b38=function(_0x366601){while(--_0x366601){_0x37f3c7['push'](_0x37f3c7['shift']());}};_0x536b38(++_0x1a3526);}(_0x2c35,0x15c));var _0x52c3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c35[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x52c3('0x0'));module['exports']={'type':{'type':Sequelize[_0x52c3('0x1')]('string',_0x52c3('0x2'),_0x52c3('0x3'),'keyValue',_0x52c3('0x4')),'defaultValue':_0x52c3('0x5')},'content':{'type':Sequelize[_0x52c3('0x6')]},'key':{'type':Sequelize[_0x52c3('0x6')]},'keyType':{'type':Sequelize['ENUM']('string','variable',_0x52c3('0x3'))},'keyContent':{'type':Sequelize[_0x52c3('0x6')]},'idField':{'type':Sequelize[_0x52c3('0x6')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 8122de8..f79b409 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 _0x6362=['../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','destroy','then','error','name','send','index','map','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','where','merge','filter','SalesforceField','includeAll','include','findAll','show','params','options','find','catch','create','body','eml-format','rimraf','fast-json-patch','moment','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x215b02,_0x2b8a13){var _0xa787de=function(_0x5391ea){while(--_0x5391ea){_0x215b02['push'](_0x215b02['shift']());}};_0xa787de(++_0x2b8a13);}(_0x6362,0xfb));var _0x2636=function(_0x1049ed,_0xb6ebb0){_0x1049ed=_0x1049ed-0x0;var _0x124f20=_0x6362[_0x1049ed];return _0x124f20;};'use strict';var emlformat=require(_0x2636('0x0'));var rimraf=require(_0x2636('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2636('0x2'));var rp=require('request-promise');var moment=require(_0x2636('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x2636('0x4'));var sox=require(_0x2636('0x5'));var csv=require(_0x2636('0x6'));var ejs=require(_0x2636('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2636('0x8'));var squel=require(_0x2636('0x9'));var crypto=require(_0x2636('0xa'));var jsforce=require(_0x2636('0xb'));var deskjs=require(_0x2636('0xc'));var toCsv=require(_0x2636('0x6'));var querystring=require(_0x2636('0xd'));var Papa=require('papaparse');var Redis=require(_0x2636('0xe'));var authService=require(_0x2636('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x2636('0x10'));var hardwareService=require(_0x2636('0x11'));var logger=require(_0x2636('0x12'))(_0x2636('0x13'));var utils=require(_0x2636('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2636('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5dec91,_0x4b9fd3){_0x4b9fd3=_0x4b9fd3||0xcc;return function(_0x24c9e3){if(_0x24c9e3){return _0x5dec91[_0x2636('0x16')](_0x4b9fd3);}return _0x5dec91[_0x2636('0x17')](_0x4b9fd3)[_0x2636('0x18')]();};}function respondWithResult(_0x17486e,_0x333ff8){_0x333ff8=_0x333ff8||0xc8;return function(_0xefd2e0){if(_0xefd2e0){return _0x17486e[_0x2636('0x17')](_0x333ff8)[_0x2636('0x19')](_0xefd2e0);}};}function respondWithFilteredResult(_0x1753ca,_0x548ae5){return function(_0x1448df){if(_0x1448df){var _0x1b0ab4=typeof _0x548ae5[_0x2636('0x1a')]===_0x2636('0x1b')&&typeof _0x548ae5[_0x2636('0x1c')]==='undefined';var _0x3f8037=_0x1448df[_0x2636('0x1d')];var _0x12d606=_0x1b0ab4?0x0:_0x548ae5[_0x2636('0x1a')];var _0x3a9db0=_0x1b0ab4?_0x1448df[_0x2636('0x1d')]:_0x548ae5[_0x2636('0x1a')]+_0x548ae5[_0x2636('0x1c')];var _0x54afc4;if(_0x3a9db0>=_0x3f8037){_0x3a9db0=_0x3f8037;_0x54afc4=0xc8;}else{_0x54afc4=0xce;}_0x1753ca['status'](_0x54afc4);return _0x1753ca[_0x2636('0x1e')](_0x2636('0x1f'),_0x12d606+'-'+_0x3a9db0+'/'+_0x3f8037)[_0x2636('0x19')](_0x1448df);}return null;};}function patchUpdates(_0x5980bf){return function(_0x196b3f){try{jsonpatch['apply'](_0x196b3f,_0x5980bf,!![]);}catch(_0x3bd442){return BPromise['reject'](_0x3bd442);}return _0x196b3f[_0x2636('0x20')]();};}function saveUpdates(_0x390721,_0x39d436){return function(_0x4fdfd0){if(_0x4fdfd0){return _0x4fdfd0[_0x2636('0x21')](_0x390721)['then'](function(_0x58d02e){return _0x58d02e;});}return null;};}function removeEntity(_0x2a3435,_0x491c02){return function(_0x5ac1cf){if(_0x5ac1cf){return _0x5ac1cf[_0x2636('0x22')]()[_0x2636('0x23')](function(){_0x2a3435[_0x2636('0x17')](0xcc)[_0x2636('0x18')]();});}};}function handleEntityNotFound(_0x45365a,_0x815eec){return function(_0x5c8de3){if(!_0x5c8de3){_0x45365a[_0x2636('0x16')](0x194);}return _0x5c8de3;};}function handleError(_0xd57ee9,_0x39a2eb){_0x39a2eb=_0x39a2eb||0x1f4;return function(_0x4c7e0e){logger[_0x2636('0x24')](_0x4c7e0e['stack']);if(_0x4c7e0e[_0x2636('0x25')]){delete _0x4c7e0e['name'];}_0xd57ee9[_0x2636('0x17')](_0x39a2eb)[_0x2636('0x26')](_0x4c7e0e);};}exports[_0x2636('0x27')]=function(_0x4821fc,_0xce6a4){var _0x5dd49f={},_0x38bc6c={},_0x1a9458={'count':0x0,'rows':[]};var _0x551122=_[_0x2636('0x28')](db['SalesforceField'][_0x2636('0x29')],function(_0x57fa21){return{'name':_0x57fa21['fieldName'],'type':_0x57fa21[_0x2636('0x2a')][_0x2636('0x2b')]};});_0x38bc6c['model']=_[_0x2636('0x28')](_0x551122,_0x2636('0x25'));_0x38bc6c[_0x2636('0x2c')]=_[_0x2636('0x2d')](_0x4821fc[_0x2636('0x2c')]);_0x38bc6c[_0x2636('0x2e')]=_[_0x2636('0x2f')](_0x38bc6c[_0x2636('0x30')],_0x38bc6c[_0x2636('0x2c')]);_0x5dd49f['attributes']=_[_0x2636('0x2f')](_0x38bc6c[_0x2636('0x30')],qs[_0x2636('0x31')](_0x4821fc[_0x2636('0x2c')][_0x2636('0x31')]));_0x5dd49f[_0x2636('0x32')]=_0x5dd49f[_0x2636('0x32')][_0x2636('0x33')]?_0x5dd49f[_0x2636('0x32')]:_0x38bc6c[_0x2636('0x30')];if(!_0x4821fc[_0x2636('0x2c')]['hasOwnProperty'](_0x2636('0x34'))){_0x5dd49f[_0x2636('0x1c')]=qs[_0x2636('0x1c')](_0x4821fc[_0x2636('0x2c')][_0x2636('0x1c')]);_0x5dd49f[_0x2636('0x1a')]=qs['offset'](_0x4821fc[_0x2636('0x2c')][_0x2636('0x1a')]);}_0x5dd49f[_0x2636('0x35')]=qs['sort'](_0x4821fc[_0x2636('0x2c')]['sort']);_0x5dd49f['where']=qs['filters'](_['pick'](_0x4821fc[_0x2636('0x2c')],_0x38bc6c[_0x2636('0x2e')]),_0x551122);if(_0x4821fc['query']['filter']){_0x5dd49f[_0x2636('0x36')]=_[_0x2636('0x37')](_0x5dd49f['where'],{'$or':_['map'](_0x551122,function(_0x7b926c){if(_0x7b926c[_0x2636('0x2a')]!=='VIRTUAL'){var _0x5866e9={};_0x5866e9[_0x7b926c['name']]={'$like':'%'+_0x4821fc[_0x2636('0x2c')][_0x2636('0x38')]+'%'};return _0x5866e9;}})});}_0x5dd49f=_['merge']({},_0x5dd49f,_0x4821fc['options']);var _0x104c26={'where':_0x5dd49f[_0x2636('0x36')]};return db[_0x2636('0x39')][_0x2636('0x1d')](_0x104c26)[_0x2636('0x23')](function(_0x2643f6){_0x1a9458[_0x2636('0x1d')]=_0x2643f6;if(_0x4821fc[_0x2636('0x2c')][_0x2636('0x3a')]){_0x5dd49f[_0x2636('0x3b')]=[{'all':!![]}];}return db[_0x2636('0x39')][_0x2636('0x3c')](_0x5dd49f);})['then'](function(_0xf815f){_0x1a9458['rows']=_0xf815f;return _0x1a9458;})[_0x2636('0x23')](respondWithFilteredResult(_0xce6a4,_0x5dd49f))['catch'](handleError(_0xce6a4,null));};exports[_0x2636('0x3d')]=function(_0x5eca2d,_0x5668c1){var _0x365abb={'raw':!![],'where':{'id':_0x5eca2d[_0x2636('0x3e')]['id']}},_0x3e348b={};_0x3e348b[_0x2636('0x30')]=_[_0x2636('0x2d')](db['SalesforceField']['rawAttributes']);_0x3e348b['query']=_['keys'](_0x5eca2d[_0x2636('0x2c')]);_0x3e348b[_0x2636('0x2e')]=_[_0x2636('0x2f')](_0x3e348b[_0x2636('0x30')],_0x3e348b[_0x2636('0x2c')]);_0x365abb[_0x2636('0x32')]=_[_0x2636('0x2f')](_0x3e348b[_0x2636('0x30')],qs[_0x2636('0x31')](_0x5eca2d[_0x2636('0x2c')][_0x2636('0x31')]));_0x365abb[_0x2636('0x32')]=_0x365abb[_0x2636('0x32')][_0x2636('0x33')]?_0x365abb[_0x2636('0x32')]:_0x3e348b[_0x2636('0x30')];if(_0x5eca2d['query']['includeAll']){_0x365abb[_0x2636('0x3b')]=[{'all':!![]}];}_0x365abb=_[_0x2636('0x37')]({},_0x365abb,_0x5eca2d[_0x2636('0x3f')]);return db['SalesforceField'][_0x2636('0x40')](_0x365abb)[_0x2636('0x23')](handleEntityNotFound(_0x5668c1,null))[_0x2636('0x23')](respondWithResult(_0x5668c1,null))[_0x2636('0x41')](handleError(_0x5668c1,null));};exports[_0x2636('0x42')]=function(_0x154e3f,_0x4f01ae){return db[_0x2636('0x39')][_0x2636('0x42')](_0x154e3f[_0x2636('0x43')],{})['then'](respondWithResult(_0x4f01ae,0xc9))['catch'](handleError(_0x4f01ae,null));};exports['update']=function(_0x30ecd5,_0x583a83){if(_0x30ecd5['body']['id']){delete _0x30ecd5[_0x2636('0x43')]['id'];}return db['SalesforceField'][_0x2636('0x40')]({'where':{'id':_0x30ecd5['params']['id']}})[_0x2636('0x23')](handleEntityNotFound(_0x583a83,null))[_0x2636('0x23')](saveUpdates(_0x30ecd5[_0x2636('0x43')],null))[_0x2636('0x23')](respondWithResult(_0x583a83,null))[_0x2636('0x41')](handleError(_0x583a83,null));};exports[_0x2636('0x22')]=function(_0x29e5c7,_0x45896f){return db['SalesforceField'][_0x2636('0x40')]({'where':{'id':_0x29e5c7[_0x2636('0x3e')]['id']}})[_0x2636('0x23')](handleEntityNotFound(_0x45896f,null))[_0x2636('0x23')](removeEntity(_0x45896f,null))['catch'](handleError(_0x45896f,null));}; \ No newline at end of file +var _0xa2c9=['set','reject','save','update','destroy','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','SalesforceField','includeAll','include','params','keys','find','create','body','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','count'];(function(_0x22cdd6,_0x4b50dc){var _0x3cbd6f=function(_0x11443f){while(--_0x11443f){_0x22cdd6['push'](_0x22cdd6['shift']());}};_0x3cbd6f(++_0x4b50dc);}(_0xa2c9,0x13b));var _0x9a2c=function(_0x2bae83,_0x31dba5){_0x2bae83=_0x2bae83-0x0;var _0x386528=_0xa2c9[_0x2bae83];return _0x386528;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9a2c('0x0'));var zipdir=require(_0x9a2c('0x1'));var jsonpatch=require(_0x9a2c('0x2'));var rp=require(_0x9a2c('0x3'));var moment=require(_0x9a2c('0x4'));var BPromise=require(_0x9a2c('0x5'));var Mustache=require(_0x9a2c('0x6'));var util=require('util');var path=require('path');var sox=require(_0x9a2c('0x7'));var csv=require(_0x9a2c('0x8'));var ejs=require(_0x9a2c('0x9'));var fs=require('fs');var fs_extra=require(_0x9a2c('0xa'));var _=require(_0x9a2c('0xb'));var squel=require(_0x9a2c('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9a2c('0xd'));var toCsv=require(_0x9a2c('0x8'));var querystring=require(_0x9a2c('0xe'));var Papa=require(_0x9a2c('0xf'));var Redis=require(_0x9a2c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9a2c('0x11'));var as=require(_0x9a2c('0x12'));var hardwareService=require(_0x9a2c('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x9a2c('0x14'));var licenseUtil=require(_0x9a2c('0x15'));var db=require(_0x9a2c('0x16'))['db'];function respondWithStatusCode(_0x1f72f7,_0x7a7041){_0x7a7041=_0x7a7041||0xcc;return function(_0x3f6bc8){if(_0x3f6bc8){return _0x1f72f7[_0x9a2c('0x17')](_0x7a7041);}return _0x1f72f7['status'](_0x7a7041)[_0x9a2c('0x18')]();};}function respondWithResult(_0x25749e,_0x4354cf){_0x4354cf=_0x4354cf||0xc8;return function(_0x3ee335){if(_0x3ee335){return _0x25749e[_0x9a2c('0x19')](_0x4354cf)[_0x9a2c('0x1a')](_0x3ee335);}};}function respondWithFilteredResult(_0x141463,_0x27eb3e){return function(_0x1ebe23){if(_0x1ebe23){var _0xd9c9be=typeof _0x27eb3e[_0x9a2c('0x1b')]==='undefined'&&typeof _0x27eb3e[_0x9a2c('0x1c')]==='undefined';var _0x4895b0=_0x1ebe23[_0x9a2c('0x1d')];var _0x58490a=_0xd9c9be?0x0:_0x27eb3e['offset'];var _0x3ff428=_0xd9c9be?_0x1ebe23[_0x9a2c('0x1d')]:_0x27eb3e[_0x9a2c('0x1b')]+_0x27eb3e['limit'];var _0x58f5f5;if(_0x3ff428>=_0x4895b0){_0x3ff428=_0x4895b0;_0x58f5f5=0xc8;}else{_0x58f5f5=0xce;}_0x141463[_0x9a2c('0x19')](_0x58f5f5);return _0x141463[_0x9a2c('0x1e')]('Content-Range',_0x58490a+'-'+_0x3ff428+'/'+_0x4895b0)['json'](_0x1ebe23);}return null;};}function patchUpdates(_0x5bc57f){return function(_0x267f1b){try{jsonpatch['apply'](_0x267f1b,_0x5bc57f,!![]);}catch(_0x1a9a24){return BPromise[_0x9a2c('0x1f')](_0x1a9a24);}return _0x267f1b[_0x9a2c('0x20')]();};}function saveUpdates(_0x23f5d9,_0x2f24ab){return function(_0x3f91b3){if(_0x3f91b3){return _0x3f91b3[_0x9a2c('0x21')](_0x23f5d9)['then'](function(_0x4feb66){return _0x4feb66;});}return null;};}function removeEntity(_0x3dd323,_0x2516ec){return function(_0x2fe5a2){if(_0x2fe5a2){return _0x2fe5a2[_0x9a2c('0x22')]()[_0x9a2c('0x23')](function(){_0x3dd323[_0x9a2c('0x19')](0xcc)[_0x9a2c('0x18')]();});}};}function handleEntityNotFound(_0x3ce680,_0x49976c){return function(_0x33cc91){if(!_0x33cc91){_0x3ce680[_0x9a2c('0x17')](0x194);}return _0x33cc91;};}function handleError(_0x41efc8,_0xa34adb){_0xa34adb=_0xa34adb||0x1f4;return function(_0x518bd2){logger[_0x9a2c('0x24')](_0x518bd2[_0x9a2c('0x25')]);if(_0x518bd2[_0x9a2c('0x26')]){delete _0x518bd2[_0x9a2c('0x26')];}_0x41efc8[_0x9a2c('0x19')](_0xa34adb)['send'](_0x518bd2);};}exports[_0x9a2c('0x27')]=function(_0x3c762f,_0x27a2a6){var _0x80b6c7={},_0x4e8b6a={},_0x548a36={'count':0x0,'rows':[]};var _0x2fc664=_[_0x9a2c('0x28')](db['SalesforceField'][_0x9a2c('0x29')],function(_0x1f5871){return{'name':_0x1f5871[_0x9a2c('0x2a')],'type':_0x1f5871[_0x9a2c('0x2b')][_0x9a2c('0x2c')]};});_0x4e8b6a[_0x9a2c('0x2d')]=_[_0x9a2c('0x28')](_0x2fc664,_0x9a2c('0x26'));_0x4e8b6a['query']=_['keys'](_0x3c762f['query']);_0x4e8b6a[_0x9a2c('0x2e')]=_[_0x9a2c('0x2f')](_0x4e8b6a['model'],_0x4e8b6a[_0x9a2c('0x30')]);_0x80b6c7[_0x9a2c('0x31')]=_[_0x9a2c('0x2f')](_0x4e8b6a[_0x9a2c('0x2d')],qs['fields'](_0x3c762f[_0x9a2c('0x30')][_0x9a2c('0x32')]));_0x80b6c7[_0x9a2c('0x31')]=_0x80b6c7['attributes'][_0x9a2c('0x33')]?_0x80b6c7[_0x9a2c('0x31')]:_0x4e8b6a['model'];if(!_0x3c762f[_0x9a2c('0x30')][_0x9a2c('0x34')](_0x9a2c('0x35'))){_0x80b6c7[_0x9a2c('0x1c')]=qs[_0x9a2c('0x1c')](_0x3c762f['query'][_0x9a2c('0x1c')]);_0x80b6c7[_0x9a2c('0x1b')]=qs[_0x9a2c('0x1b')](_0x3c762f['query']['offset']);}_0x80b6c7['order']=qs[_0x9a2c('0x36')](_0x3c762f[_0x9a2c('0x30')][_0x9a2c('0x36')]);_0x80b6c7[_0x9a2c('0x37')]=qs[_0x9a2c('0x2e')](_['pick'](_0x3c762f[_0x9a2c('0x30')],_0x4e8b6a[_0x9a2c('0x2e')]),_0x2fc664);if(_0x3c762f['query'][_0x9a2c('0x38')]){_0x80b6c7['where']=_[_0x9a2c('0x39')](_0x80b6c7['where'],{'$or':_['map'](_0x2fc664,function(_0x319d9c){if(_0x319d9c[_0x9a2c('0x2b')]!==_0x9a2c('0x3a')){var _0x50c244={};_0x50c244[_0x319d9c[_0x9a2c('0x26')]]={'$like':'%'+_0x3c762f[_0x9a2c('0x30')]['filter']+'%'};return _0x50c244;}})});}_0x80b6c7=_[_0x9a2c('0x39')]({},_0x80b6c7,_0x3c762f[_0x9a2c('0x3b')]);var _0x4e131e={'where':_0x80b6c7['where']};return db[_0x9a2c('0x3c')][_0x9a2c('0x1d')](_0x4e131e)[_0x9a2c('0x23')](function(_0x344d54){_0x548a36[_0x9a2c('0x1d')]=_0x344d54;if(_0x3c762f[_0x9a2c('0x30')][_0x9a2c('0x3d')]){_0x80b6c7[_0x9a2c('0x3e')]=[{'all':!![]}];}return db[_0x9a2c('0x3c')]['findAll'](_0x80b6c7);})[_0x9a2c('0x23')](function(_0x4ce65e){_0x548a36['rows']=_0x4ce65e;return _0x548a36;})['then'](respondWithFilteredResult(_0x27a2a6,_0x80b6c7))['catch'](handleError(_0x27a2a6,null));};exports['show']=function(_0x1a54c3,_0x61f353){var _0xc2f16e={'raw':!![],'where':{'id':_0x1a54c3[_0x9a2c('0x3f')]['id']}},_0x5b9604={};_0x5b9604['model']=_[_0x9a2c('0x40')](db[_0x9a2c('0x3c')][_0x9a2c('0x29')]);_0x5b9604[_0x9a2c('0x30')]=_['keys'](_0x1a54c3[_0x9a2c('0x30')]);_0x5b9604[_0x9a2c('0x2e')]=_[_0x9a2c('0x2f')](_0x5b9604[_0x9a2c('0x2d')],_0x5b9604[_0x9a2c('0x30')]);_0xc2f16e[_0x9a2c('0x31')]=_['intersection'](_0x5b9604[_0x9a2c('0x2d')],qs[_0x9a2c('0x32')](_0x1a54c3[_0x9a2c('0x30')][_0x9a2c('0x32')]));_0xc2f16e[_0x9a2c('0x31')]=_0xc2f16e[_0x9a2c('0x31')]['length']?_0xc2f16e[_0x9a2c('0x31')]:_0x5b9604[_0x9a2c('0x2d')];if(_0x1a54c3[_0x9a2c('0x30')][_0x9a2c('0x3d')]){_0xc2f16e['include']=[{'all':!![]}];}_0xc2f16e=_[_0x9a2c('0x39')]({},_0xc2f16e,_0x1a54c3[_0x9a2c('0x3b')]);return db['SalesforceField'][_0x9a2c('0x41')](_0xc2f16e)[_0x9a2c('0x23')](handleEntityNotFound(_0x61f353,null))['then'](respondWithResult(_0x61f353,null))['catch'](handleError(_0x61f353,null));};exports[_0x9a2c('0x42')]=function(_0x194d8e,_0xc4cb65){return db['SalesforceField'][_0x9a2c('0x42')](_0x194d8e[_0x9a2c('0x43')],{})[_0x9a2c('0x23')](respondWithResult(_0xc4cb65,0xc9))[_0x9a2c('0x44')](handleError(_0xc4cb65,null));};exports[_0x9a2c('0x21')]=function(_0x492367,_0x21ba9c){if(_0x492367[_0x9a2c('0x43')]['id']){delete _0x492367[_0x9a2c('0x43')]['id'];}return db[_0x9a2c('0x3c')]['find']({'where':{'id':_0x492367[_0x9a2c('0x3f')]['id']}})['then'](handleEntityNotFound(_0x21ba9c,null))[_0x9a2c('0x23')](saveUpdates(_0x492367[_0x9a2c('0x43')],null))['then'](respondWithResult(_0x21ba9c,null))[_0x9a2c('0x44')](handleError(_0x21ba9c,null));};exports[_0x9a2c('0x22')]=function(_0x43ee16,_0x578da0){return db[_0x9a2c('0x3c')][_0x9a2c('0x41')]({'where':{'id':_0x43ee16[_0x9a2c('0x3f')]['id']}})['then'](handleEntityNotFound(_0x578da0,null))['then'](removeEntity(_0x578da0,null))[_0x9a2c('0x44')](handleError(_0x578da0,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 3d80d37..b4cefad 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 _0x4467=['request-promise','path','rimraf','../../config/environment','idField','FieldId','lodash','api','moment'];(function(_0x893960,_0x3a30a7){var _0x464851=function(_0x44e547){while(--_0x44e547){_0x893960['push'](_0x893960['shift']());}};_0x464851(++_0x3a30a7);}(_0x4467,0x10b));var _0x7446=function(_0x4460aa,_0x3210d0){_0x4460aa=_0x4460aa-0x0;var _0x1d7e31=_0x4467[_0x4460aa];return _0x1d7e31;};'use strict';var _=require(_0x7446('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7446('0x1'));var moment=require(_0x7446('0x2'));var BPromise=require('bluebird');var rp=require(_0x7446('0x3'));var fs=require('fs');var path=require(_0x7446('0x4'));var rimraf=require(_0x7446('0x5'));var config=require(_0x7446('0x6'));var attributes=require('./intSalesforceField.attributes');module['exports']=function(_0x5e80ed,_0x13084c){return _0x5e80ed['define']('SalesforceField',attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0x7446('0x7'),_0x7446('0x8')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7934=['request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5c50a9,_0x323daf){var _0x4d6e4e=function(_0x5dcfdc){while(--_0x5dcfdc){_0x5c50a9['push'](_0x5c50a9['shift']());}};_0x4d6e4e(++_0x323daf);}(_0x7934,0x16a));var _0x4793=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7934[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4793('0x0'));var util=require(_0x4793('0x1'));var logger=require(_0x4793('0x2'))(_0x4793('0x3'));var moment=require(_0x4793('0x4'));var BPromise=require(_0x4793('0x5'));var rp=require(_0x4793('0x6'));var fs=require('fs');var path=require(_0x4793('0x7'));var rimraf=require(_0x4793('0x8'));var config=require(_0x4793('0x9'));var attributes=require(_0x4793('0xa'));module[_0x4793('0xb')]=function(_0x1ccbd1,_0x5045fd){return _0x1ccbd1['define']('SalesforceField',attributes,{'tableName':_0x4793('0xc'),'paranoid':![],'indexes':[{'name':_0x4793('0xd'),'fields':[_0x4793('0xe'),_0x4793('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 5ab45ad..5649052 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 _0xd3f8=['info','debug','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','SalesforceField,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x4d36af,_0x7e437a){var _0x5cf205=function(_0x2d8781){while(--_0x2d8781){_0x4d36af['push'](_0x4d36af['shift']());}};_0x5cf205(++_0x7e437a);}(_0xd3f8,0x1d7));var _0x8d3f=function(_0xe89b42,_0x2ccbd6){_0xe89b42=_0xe89b42-0x0;var _0x5e605b=_0xd3f8[_0xe89b42];return _0x5e605b;};'use strict';var _=require(_0x8d3f('0x0'));var util=require(_0x8d3f('0x1'));var moment=require(_0x8d3f('0x2'));var BPromise=require(_0x8d3f('0x3'));var rs=require(_0x8d3f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8d3f('0x5'));var logger=require('../../config/logger')(_0x8d3f('0x6'));var config=require(_0x8d3f('0x7'));var jayson=require(_0x8d3f('0x8'));var client=jayson[_0x8d3f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x58bc3d,_0x468c10,_0x2f5c8a){return new BPromise(function(_0xb62df5,_0x481911){return client[_0x8d3f('0xa')](_0x58bc3d,_0x2f5c8a)[_0x8d3f('0xb')](function(_0xe09a51){logger[_0x8d3f('0xc')]('SalesforceField,\x20%s,\x20%s',_0x468c10,'request\x20sent');logger[_0x8d3f('0xd')](_0x8d3f('0xe'),_0x468c10,_0x8d3f('0xf'),JSON[_0x8d3f('0x10')](_0xe09a51));if(_0xe09a51['error']){if(_0xe09a51['error'][_0x8d3f('0x11')]===0x1f4){logger['error']('SalesforceField,\x20%s,\x20%s',_0x468c10,_0xe09a51[_0x8d3f('0x12')][_0x8d3f('0x13')]);return _0x481911(_0xe09a51[_0x8d3f('0x12')]['message']);}logger[_0x8d3f('0x12')](_0x8d3f('0x14'),_0x468c10,_0xe09a51[_0x8d3f('0x12')][_0x8d3f('0x13')]);return _0xb62df5(_0xe09a51[_0x8d3f('0x12')]['message']);}else{logger[_0x8d3f('0xc')](_0x8d3f('0x14'),_0x468c10,_0x8d3f('0xf'));_0xb62df5(_0xe09a51[_0x8d3f('0x15')][_0x8d3f('0x13')]);}})[_0x8d3f('0x16')](function(_0x586da6){logger[_0x8d3f('0x12')](_0x8d3f('0x14'),_0x468c10,_0x586da6);_0x481911(_0x586da6);});});} \ No newline at end of file +var _0x8323=['../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x8323,0x8d));var _0x3832=function(_0x8b3e2d,_0x58935a){_0x8b3e2d=_0x8b3e2d-0x0;var _0x58ab87=_0x8323[_0x8b3e2d];return _0x58ab87;};'use strict';var _=require(_0x3832('0x0'));var util=require(_0x3832('0x1'));var moment=require(_0x3832('0x2'));var BPromise=require(_0x3832('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3832('0x4'));var db=require(_0x3832('0x5'))['db'];var utils=require(_0x3832('0x6'));var logger=require(_0x3832('0x7'))(_0x3832('0x8'));var config=require(_0x3832('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3832('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a1a42,_0x21b975,_0x35da2a){return new BPromise(function(_0xa51d5c,_0x588347){return client['request'](_0x1a1a42,_0x35da2a)[_0x3832('0xb')](function(_0x2ae769){logger[_0x3832('0xc')](_0x3832('0xd'),_0x21b975,_0x3832('0xe'));logger[_0x3832('0xf')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x21b975,_0x3832('0xe'),JSON[_0x3832('0x10')](_0x2ae769));if(_0x2ae769[_0x3832('0x11')]){if(_0x2ae769[_0x3832('0x11')][_0x3832('0x12')]===0x1f4){logger[_0x3832('0x11')](_0x3832('0xd'),_0x21b975,_0x2ae769[_0x3832('0x11')][_0x3832('0x13')]);return _0x588347(_0x2ae769[_0x3832('0x11')][_0x3832('0x13')]);}logger[_0x3832('0x11')](_0x3832('0xd'),_0x21b975,_0x2ae769['error']['message']);return _0xa51d5c(_0x2ae769[_0x3832('0x11')][_0x3832('0x13')]);}else{logger['info'](_0x3832('0xd'),_0x21b975,_0x3832('0xe'));_0xa51d5c(_0x2ae769['result'][_0x3832('0x13')]);}})[_0x3832('0x14')](function(_0x37d825){logger[_0x3832('0x11')](_0x3832('0xd'),_0x21b975,_0x37d825);_0x588347(_0x37d825);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 8da422c..6527eae 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 _0x8bd2=['util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','index','show','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','destroy','exports','multer'];(function(_0x31e0b9,_0x2fd13b){var _0x48e976=function(_0x3025d8){while(--_0x3025d8){_0x31e0b9['push'](_0x31e0b9['shift']());}};_0x48e976(++_0x2fd13b);}(_0x8bd2,0x17f));var _0x28bd=function(_0x2a0350,_0x249319){_0x2a0350=_0x2a0350-0x0;var _0x425220=_0x8bd2[_0x2a0350];return _0x425220;};'use strict';var multer=require(_0x28bd('0x0'));var util=require(_0x28bd('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x28bd('0x2')]();var fs_extra=require(_0x28bd('0x3'));var auth=require(_0x28bd('0x4'));var interaction=require(_0x28bd('0x5'));var config=require(_0x28bd('0x6'));var controller=require(_0x28bd('0x7'));router[_0x28bd('0x8')]('/',auth['isAuthenticated'](),controller[_0x28bd('0x9')]);router[_0x28bd('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x28bd('0xa')]);router['get'](_0x28bd('0xb'),auth[_0x28bd('0xc')](),controller[_0x28bd('0xd')]);router[_0x28bd('0x8')](_0x28bd('0xe'),auth[_0x28bd('0xc')](),controller[_0x28bd('0xf')]);router[_0x28bd('0x10')]('/',auth['isAuthenticated'](),controller[_0x28bd('0x11')]);router[_0x28bd('0x10')](_0x28bd('0xb'),auth[_0x28bd('0xc')](),controller[_0x28bd('0x12')]);router[_0x28bd('0x13')](_0x28bd('0x14'),auth['isAuthenticated'](),controller[_0x28bd('0x15')]);router['delete'](_0x28bd('0x14'),auth[_0x28bd('0xc')](),controller[_0x28bd('0x16')]);module[_0x28bd('0x17')]=router; \ No newline at end of file +var _0xff91=['delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','show','/:id/configurations','getConfigurations','getFields','post','addConfiguration','/:id','update'];(function(_0x1e9ba8,_0x32464c){var _0x264915=function(_0x1283a8){while(--_0x1283a8){_0x1e9ba8['push'](_0x1e9ba8['shift']());}};_0x264915(++_0x32464c);}(_0xff91,0x1d1));var _0x1ff9=function(_0x31a2f3,_0x3944f8){_0x31a2f3=_0x31a2f3-0x0;var _0x35a051=_0xff91[_0x31a2f3];return _0x35a051;};'use strict';var multer=require('multer');var util=require(_0x1ff9('0x0'));var path=require(_0x1ff9('0x1'));var timeout=require(_0x1ff9('0x2'));var express=require(_0x1ff9('0x3'));var router=express[_0x1ff9('0x4')]();var fs_extra=require(_0x1ff9('0x5'));var auth=require(_0x1ff9('0x6'));var interaction=require(_0x1ff9('0x7'));var config=require('../../config/environment');var controller=require('./intServicenowAccount.controller');router['get']('/',auth[_0x1ff9('0x8')](),controller[_0x1ff9('0x9')]);router[_0x1ff9('0xa')]('/:id',auth[_0x1ff9('0x8')](),controller[_0x1ff9('0xb')]);router[_0x1ff9('0xa')](_0x1ff9('0xc'),auth[_0x1ff9('0x8')](),controller[_0x1ff9('0xd')]);router[_0x1ff9('0xa')]('/:id/fields',auth[_0x1ff9('0x8')](),controller[_0x1ff9('0xe')]);router[_0x1ff9('0xf')]('/',auth[_0x1ff9('0x8')](),controller['create']);router[_0x1ff9('0xf')]('/:id/configurations',auth[_0x1ff9('0x8')](),controller[_0x1ff9('0x10')]);router['put'](_0x1ff9('0x11'),auth['isAuthenticated'](),controller[_0x1ff9('0x12')]);router[_0x1ff9('0x13')](_0x1ff9('0x11'),auth[_0x1ff9('0x8')](),controller[_0x1ff9('0x14')]);module[_0x1ff9('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 5512bc0..c16f3ef 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 _0xb14d=['remoteUri','exports','STRING'];(function(_0x23c3c3,_0x1b954f){var _0x42b0e1=function(_0x273b6f){while(--_0x273b6f){_0x23c3c3['push'](_0x23c3c3['shift']());}};_0x42b0e1(++_0x1b954f);}(_0xb14d,0x13c));var _0xdb14=function(_0x4242df,_0x553c85){_0x4242df=_0x4242df-0x0;var _0x158504=_0xb14d[_0x4242df];return _0x158504;};'use strict';var Sequelize=require('sequelize');module[_0xdb14('0x0')]={'name':{'type':Sequelize[_0xdb14('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xdb14('0x1')],'unique':'username'},'password':{'type':Sequelize[_0xdb14('0x1')]},'email':{'type':Sequelize[_0xdb14('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xdb14('0x2')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xe860=['STRING','exports'];(function(_0x21f23a,_0x44510d){var _0x1d10f4=function(_0x431572){while(--_0x431572){_0x21f23a['push'](_0x21f23a['shift']());}};_0x1d10f4(++_0x44510d);}(_0xe860,0xd3));var _0x0e86=function(_0x1d7b67,_0x302f22){_0x1d7b67=_0x1d7b67-0x0;var _0x5247c6=_0xe860[_0x1d7b67];return _0x5247c6;};'use strict';var Sequelize=require('sequelize');module[_0x0e86('0x0')]={'name':{'type':Sequelize[_0x0e86('0x1')]},'description':{'type':Sequelize[_0x0e86('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize[_0x0e86('0x1')]},'email':{'type':Sequelize[_0x0e86('0x1')]},'remoteUri':{'type':Sequelize[_0x0e86('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x0e86('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 299a04e..ea7b2b5 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 _0x6315=['rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','order','sort','filter','where','merge','type','VIRTUAL','options','include','findAll','rows','catch','params','length','includeAll','find','create','body','update','destroy','getConfigurations','findOne','ServicenowConfiguration','hasOwnProperty','AccountId','Subjects','channel','Descriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','severity','caused_by','upon_reject','sys_updated_on','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','active','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','work_start','business_stc','additional_assignee_list','description','calendar_duration','close_notes','closed_by','parent_incident','sys_id','contact_type','reopened_by','incident_state','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','comments','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','escalation','upon_approval','location','category','username','password','email','remoteUri','serverUrl','slice','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','log','incident\x20table\x20objects','assign','remove','includes','forEach','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','ServiceNow\x20error:\x20','test','statusCode','send','Wrong\x20credentials','True','False','false','result','inactive','label','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','then','stack','name','index','map','ServicenowAccount'];(function(_0x28a0a3,_0x1b3795){var _0x4710fb=function(_0x204538){while(--_0x204538){_0x28a0a3['push'](_0x28a0a3['shift']());}};_0x4710fb(++_0x1b3795);}(_0x6315,0x14a));var _0x5631=function(_0x9b198e,_0x52fa3f){_0x9b198e=_0x9b198e-0x0;var _0x16b8f4=_0x6315[_0x9b198e];return _0x16b8f4;};'use strict';var emlformat=require(_0x5631('0x0'));var rimraf=require(_0x5631('0x1'));var zipdir=require(_0x5631('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5631('0x3'));var moment=require(_0x5631('0x4'));var BPromise=require(_0x5631('0x5'));var Mustache=require(_0x5631('0x6'));var util=require(_0x5631('0x7'));var path=require(_0x5631('0x8'));var sox=require(_0x5631('0x9'));var csv=require('to-csv');var ejs=require(_0x5631('0xa'));var fs=require('fs');var fs_extra=require(_0x5631('0xb'));var _=require(_0x5631('0xc'));var squel=require(_0x5631('0xd'));var crypto=require(_0x5631('0xe'));var jsforce=require(_0x5631('0xf'));var deskjs=require(_0x5631('0x10'));var toCsv=require(_0x5631('0x11'));var querystring=require(_0x5631('0x12'));var Papa=require(_0x5631('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5631('0x14'));var as=require(_0x5631('0x15'));var hardwareService=require(_0x5631('0x16'));var logger=require(_0x5631('0x17'))(_0x5631('0x18'));var utils=require(_0x5631('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x5631('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require(_0x5631('0x1b'));function respondWithStatusCode(_0x5e34dc,_0x5af0e9){_0x5af0e9=_0x5af0e9||0xcc;return function(_0x444546){if(_0x444546){return _0x5e34dc[_0x5631('0x1c')](_0x5af0e9);}return _0x5e34dc[_0x5631('0x1d')](_0x5af0e9)[_0x5631('0x1e')]();};}function respondWithResult(_0x451bff,_0x1eb2a5){_0x1eb2a5=_0x1eb2a5||0xc8;return function(_0x17ffff){if(_0x17ffff){return _0x451bff[_0x5631('0x1d')](_0x1eb2a5)[_0x5631('0x1f')](_0x17ffff);}};}function respondWithFilteredResult(_0x5c38d3,_0x495642){return function(_0x248917){if(_0x248917){var _0x333818=typeof _0x495642[_0x5631('0x20')]===_0x5631('0x21')&&typeof _0x495642['limit']===_0x5631('0x21');var _0x28343c=_0x248917[_0x5631('0x22')];var _0xcf269c=_0x333818?0x0:_0x495642[_0x5631('0x20')];var _0x3f09ab=_0x333818?_0x248917[_0x5631('0x22')]:_0x495642[_0x5631('0x20')]+_0x495642[_0x5631('0x23')];var _0x3c1eb2;if(_0x3f09ab>=_0x28343c){_0x3f09ab=_0x28343c;_0x3c1eb2=0xc8;}else{_0x3c1eb2=0xce;}_0x5c38d3[_0x5631('0x1d')](_0x3c1eb2);return _0x5c38d3[_0x5631('0x24')](_0x5631('0x25'),_0xcf269c+'-'+_0x3f09ab+'/'+_0x28343c)['json'](_0x248917);}return null;};}function patchUpdates(_0x2bbedb){return function(_0x8e0fbe){try{jsonpatch[_0x5631('0x26')](_0x8e0fbe,_0x2bbedb,!![]);}catch(_0x5b06c9){return BPromise[_0x5631('0x27')](_0x5b06c9);}return _0x8e0fbe['save']();};}function saveUpdates(_0x19f4e0,_0x1786fd){return function(_0x4d8b52){if(_0x4d8b52){return _0x4d8b52['update'](_0x19f4e0)[_0x5631('0x28')](function(_0x11b53a){return _0x11b53a;});}return null;};}function removeEntity(_0x426613,_0x50aa9b){return function(_0x44a522){if(_0x44a522){return _0x44a522['destroy']()['then'](function(){_0x426613[_0x5631('0x1d')](0xcc)[_0x5631('0x1e')]();});}};}function handleEntityNotFound(_0x4cbde7,_0x2d76d6){return function(_0x3c9a85){if(!_0x3c9a85){_0x4cbde7[_0x5631('0x1c')](0x194);}return _0x3c9a85;};}function handleError(_0x42fc3e,_0xb4dd80){_0xb4dd80=_0xb4dd80||0x1f4;return function(_0x58ed25){logger['error'](_0x58ed25[_0x5631('0x29')]);if(_0x58ed25[_0x5631('0x2a')]){delete _0x58ed25[_0x5631('0x2a')];}_0x42fc3e[_0x5631('0x1d')](_0xb4dd80)['send'](_0x58ed25);};}exports[_0x5631('0x2b')]=function(_0xc34598,_0x2c611e){var _0x51f9e6={},_0x2ad823={},_0x54af0a={'count':0x0,'rows':[]};var _0x2e0216=_[_0x5631('0x2c')](db[_0x5631('0x2d')][_0x5631('0x2e')],function(_0x34abe7){return{'name':_0x34abe7[_0x5631('0x2f')],'type':_0x34abe7['type'][_0x5631('0x30')]};});_0x2ad823['model']=_[_0x5631('0x2c')](_0x2e0216,_0x5631('0x2a'));_0x2ad823[_0x5631('0x31')]=_[_0x5631('0x32')](_0xc34598[_0x5631('0x31')]);_0x2ad823[_0x5631('0x33')]=_[_0x5631('0x34')](_0x2ad823[_0x5631('0x35')],_0x2ad823[_0x5631('0x31')]);_0x51f9e6[_0x5631('0x36')]=_[_0x5631('0x34')](_0x2ad823[_0x5631('0x35')],qs[_0x5631('0x37')](_0xc34598[_0x5631('0x31')][_0x5631('0x37')]));_0x51f9e6[_0x5631('0x36')]=_0x51f9e6[_0x5631('0x36')]['length']?_0x51f9e6[_0x5631('0x36')]:_0x2ad823['model'];if(!_0xc34598['query']['hasOwnProperty']('nolimit')){_0x51f9e6[_0x5631('0x23')]=qs[_0x5631('0x23')](_0xc34598[_0x5631('0x31')][_0x5631('0x23')]);_0x51f9e6[_0x5631('0x20')]=qs[_0x5631('0x20')](_0xc34598[_0x5631('0x31')][_0x5631('0x20')]);}_0x51f9e6[_0x5631('0x38')]=qs[_0x5631('0x39')](_0xc34598[_0x5631('0x31')][_0x5631('0x39')]);_0x51f9e6['where']=qs[_0x5631('0x33')](_['pick'](_0xc34598[_0x5631('0x31')],_0x2ad823['filters']),_0x2e0216);if(_0xc34598[_0x5631('0x31')][_0x5631('0x3a')]){_0x51f9e6[_0x5631('0x3b')]=_[_0x5631('0x3c')](_0x51f9e6[_0x5631('0x3b')],{'$or':_[_0x5631('0x2c')](_0x2e0216,function(_0x551059){if(_0x551059[_0x5631('0x3d')]!==_0x5631('0x3e')){var _0x46e6e1={};_0x46e6e1[_0x551059[_0x5631('0x2a')]]={'$like':'%'+_0xc34598[_0x5631('0x31')][_0x5631('0x3a')]+'%'};return _0x46e6e1;}})});}_0x51f9e6=_['merge']({},_0x51f9e6,_0xc34598[_0x5631('0x3f')]);var _0x153219={'where':_0x51f9e6['where']};return db['ServicenowAccount'][_0x5631('0x22')](_0x153219)[_0x5631('0x28')](function(_0x2a1392){_0x54af0a[_0x5631('0x22')]=_0x2a1392;if(_0xc34598[_0x5631('0x31')]['includeAll']){_0x51f9e6[_0x5631('0x40')]=[{'all':!![]}];}return db[_0x5631('0x2d')][_0x5631('0x41')](_0x51f9e6);})[_0x5631('0x28')](function(_0x1c678b){_0x54af0a[_0x5631('0x42')]=_0x1c678b;return _0x54af0a;})[_0x5631('0x28')](respondWithFilteredResult(_0x2c611e,_0x51f9e6))[_0x5631('0x43')](handleError(_0x2c611e,null));};exports['show']=function(_0x55f331,_0x438954){var _0x45fa3f={'raw':![],'where':{'id':_0x55f331[_0x5631('0x44')]['id']}},_0x4194b8={};_0x4194b8[_0x5631('0x35')]=_['keys'](db[_0x5631('0x2d')][_0x5631('0x2e')]);_0x4194b8[_0x5631('0x31')]=_[_0x5631('0x32')](_0x55f331[_0x5631('0x31')]);_0x4194b8[_0x5631('0x33')]=_[_0x5631('0x34')](_0x4194b8['model'],_0x4194b8[_0x5631('0x31')]);_0x45fa3f[_0x5631('0x36')]=_[_0x5631('0x34')](_0x4194b8['model'],qs['fields'](_0x55f331['query'][_0x5631('0x37')]));_0x45fa3f[_0x5631('0x36')]=_0x45fa3f[_0x5631('0x36')][_0x5631('0x45')]?_0x45fa3f[_0x5631('0x36')]:_0x4194b8[_0x5631('0x35')];if(_0x55f331[_0x5631('0x31')][_0x5631('0x46')]){_0x45fa3f[_0x5631('0x40')]=[{'all':!![]}];}_0x45fa3f=_[_0x5631('0x3c')]({},_0x45fa3f,_0x55f331[_0x5631('0x3f')]);return db[_0x5631('0x2d')][_0x5631('0x47')](_0x45fa3f)[_0x5631('0x28')](handleEntityNotFound(_0x438954,null))[_0x5631('0x28')](respondWithResult(_0x438954,null))[_0x5631('0x43')](handleError(_0x438954,null));};exports[_0x5631('0x48')]=function(_0x5a0d90,_0x5cc072){return db[_0x5631('0x2d')][_0x5631('0x48')](_0x5a0d90[_0x5631('0x49')],{})['then'](respondWithResult(_0x5cc072,0xc9))[_0x5631('0x43')](handleError(_0x5cc072,null));};exports[_0x5631('0x4a')]=function(_0x52994f,_0x42a299){if(_0x52994f[_0x5631('0x49')]['id']){delete _0x52994f[_0x5631('0x49')]['id'];}return db['ServicenowAccount'][_0x5631('0x47')]({'where':{'id':_0x52994f[_0x5631('0x44')]['id']}})[_0x5631('0x28')](handleEntityNotFound(_0x42a299,null))[_0x5631('0x28')](saveUpdates(_0x52994f[_0x5631('0x49')],null))[_0x5631('0x28')](respondWithResult(_0x42a299,null))['catch'](handleError(_0x42a299,null));};exports[_0x5631('0x4b')]=function(_0x224a89,_0x563a29){return db['ServicenowAccount'][_0x5631('0x47')]({'where':{'id':_0x224a89[_0x5631('0x44')]['id']}})['then'](handleEntityNotFound(_0x563a29,null))['then'](removeEntity(_0x563a29,null))['catch'](handleError(_0x563a29,null));};exports[_0x5631('0x4c')]=function(_0x49584c,_0x3d4a9a,_0x3aeedf){var _0x3d8455={};var _0xa66f99={};var _0x44a797;var _0x321c04;return db['ServicenowAccount'][_0x5631('0x4d')]({'where':{'id':_0x49584c[_0x5631('0x44')]['id']}})['then'](handleEntityNotFound(_0x3d4a9a,null))[_0x5631('0x28')](function(_0x88ca22){if(_0x88ca22){_0x44a797=_0x88ca22;_0xa66f99[_0x5631('0x35')]=_[_0x5631('0x32')](db[_0x5631('0x4e')][_0x5631('0x2e')]);_0xa66f99['query']=_[_0x5631('0x32')](_0x49584c[_0x5631('0x31')]);_0xa66f99[_0x5631('0x33')]=_[_0x5631('0x34')](_0xa66f99[_0x5631('0x35')],_0xa66f99[_0x5631('0x31')]);_0x3d8455[_0x5631('0x36')]=_[_0x5631('0x34')](_0xa66f99[_0x5631('0x35')],qs[_0x5631('0x37')](_0x49584c[_0x5631('0x31')][_0x5631('0x37')]));_0x3d8455[_0x5631('0x36')]=_0x3d8455['attributes'][_0x5631('0x45')]?_0x3d8455[_0x5631('0x36')]:_0xa66f99['model'];_0x3d8455[_0x5631('0x38')]=qs['sort'](_0x49584c[_0x5631('0x31')][_0x5631('0x39')]);_0x3d8455[_0x5631('0x3b')]=qs['filters'](_['pick'](_0x49584c[_0x5631('0x31')],_0xa66f99['filters']));if(_0x49584c[_0x5631('0x31')][_0x5631('0x3a')]){_0x3d8455[_0x5631('0x3b')]=_['merge'](_0x3d8455[_0x5631('0x3b')],{'$or':_[_0x5631('0x2c')](_0x3d8455['attributes'],function(_0x3ac33e){var _0x266b1c={};_0x266b1c[_0x3ac33e]={'$like':'%'+_0x49584c[_0x5631('0x31')][_0x5631('0x3a')]+'%'};return _0x266b1c;})});}_0x3d8455=_['merge']({},_0x3d8455,_0x49584c[_0x5631('0x3f')]);return _0x44a797[_0x5631('0x4c')](_0x3d8455);}})[_0x5631('0x28')](function(_0x4f66d6){if(_0x4f66d6){_0x321c04=_0x4f66d6[_0x5631('0x45')];if(!_0x49584c[_0x5631('0x31')][_0x5631('0x4f')]('nolimit')){_0x3d8455['limit']=qs[_0x5631('0x23')](_0x49584c[_0x5631('0x31')][_0x5631('0x23')]);_0x3d8455['offset']=qs[_0x5631('0x20')](_0x49584c['query']['offset']);}return _0x44a797[_0x5631('0x4c')](_0x3d8455);}})['then'](function(_0x2b20b1){if(_0x2b20b1){return _0x2b20b1?{'count':_0x321c04,'rows':_0x2b20b1}:null;}})[_0x5631('0x28')](respondWithResult(_0x3d4a9a,null))[_0x5631('0x43')](handleError(_0x3d4a9a,null));};exports['addConfiguration']=function(_0x1322ef,_0x46275e,_0xa4e6d3){if(_0x1322ef[_0x5631('0x49')]['id']){delete _0x1322ef[_0x5631('0x49')]['id'];}return db['ServicenowAccount'][_0x5631('0x4d')]({'where':{'id':_0x1322ef['params']['id']}})[_0x5631('0x28')](handleEntityNotFound(_0x46275e,null))[_0x5631('0x28')](function(_0x3bb30e){if(_0x3bb30e){_0x1322ef[_0x5631('0x49')][_0x5631('0x50')]=_0x3bb30e['id'];_0x1322ef['body'][_0x5631('0x51')]=integrations['getSubjects'](_0x1322ef[_0x5631('0x49')][_0x5631('0x52')],_0x1322ef[_0x5631('0x49')][_0x5631('0x3d')]);_0x1322ef['body'][_0x5631('0x53')]=integrations['getDescriptions'](_0x1322ef[_0x5631('0x49')][_0x5631('0x52')],_0x1322ef[_0x5631('0x49')][_0x5631('0x3d')]);return db[_0x5631('0x4e')][_0x5631('0x48')](_0x1322ef['body'],{'include':[{'model':db[_0x5631('0x54')],'as':'Subjects'},{'model':db[_0x5631('0x54')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x46275e,null))[_0x5631('0x43')](handleError(_0x46275e,null));};exports[_0x5631('0x55')]=function(_0x52fbeb,_0x105b3c,_0x19f9aa){var _0x2c4b0a=[_0x5631('0x56'),_0x5631('0x57'),_0x5631('0x58'),_0x5631('0x59'),_0x5631('0x5a'),_0x5631('0x5b'),'incident_state',_0x5631('0x5c'),'category'];var _0x5a5a55=['parent',_0x5631('0x56'),_0x5631('0x5d'),'watch_list',_0x5631('0x5e'),_0x5631('0x5f'),'child_incidents',_0x5631('0x57'),'approval_history',_0x5631('0x60'),_0x5631('0x61'),_0x5631('0x62'),_0x5631('0x63'),_0x5631('0x64'),_0x5631('0x65'),'sys_domain',_0x5631('0x66'),_0x5631('0x67'),_0x5631('0x58'),'order',_0x5631('0x68'),_0x5631('0x69'),_0x5631('0x6a'),_0x5631('0x6b'),'impact',_0x5631('0x6c'),'work_notes_list',_0x5631('0x6d'),_0x5631('0x6e'),_0x5631('0x6f'),_0x5631('0x70'),_0x5631('0x71'),_0x5631('0x72'),_0x5631('0x73'),_0x5631('0x74'),_0x5631('0x75'),_0x5631('0x76'),_0x5631('0x77'),_0x5631('0x78'),_0x5631('0x79'),_0x5631('0x7a'),_0x5631('0x59'),_0x5631('0x7b'),_0x5631('0x7c'),_0x5631('0x5a'),_0x5631('0x7d'),'delivery_task',_0x5631('0x7e'),'assignment_group',_0x5631('0x7f'),_0x5631('0x80'),_0x5631('0x81'),_0x5631('0x82'),_0x5631('0x5b'),'sys_class_name',_0x5631('0x83'),_0x5631('0x84'),'follow_up',_0x5631('0x85'),_0x5631('0x86'),_0x5631('0x87'),_0x5631('0x88'),_0x5631('0x89'),_0x5631('0x8a'),_0x5631('0x8b'),_0x5631('0x8c'),_0x5631('0x8d'),_0x5631('0x8e'),_0x5631('0x8f'),_0x5631('0x5c'),_0x5631('0x90'),'sla_due',_0x5631('0x91'),_0x5631('0x92'),_0x5631('0x93'),_0x5631('0x94'),_0x5631('0x95'),'sys_tags',_0x5631('0x96'),_0x5631('0x97'),'correlation_id',_0x5631('0x98'),_0x5631('0x99')];var _0x128d4a='';var _0x15f2e7='';var _0x1f1972=[];var _0x7ed02a='';var _0x9d0f3f='';var _0x33d547=[];var _0x111253='';var _0x19d3f7='';var _0x395bcc={};var _0x57aa26='';return db[_0x5631('0x2d')][_0x5631('0x4d')]({'where':{'id':_0x52fbeb[_0x5631('0x44')]['id']},'attributes':['id',_0x5631('0x9a'),_0x5631('0x9b'),_0x5631('0x9c'),_0x5631('0x9d'),_0x5631('0x9e')]})[_0x5631('0x28')](handleEntityNotFound(_0x105b3c,null))[_0x5631('0x28')](function(_0x260bfa){if(_0x260bfa){_0x57aa26=_0x260bfa[_0x5631('0x9d')];var _0x3bbf11=_0x57aa26[_0x5631('0x9f')](-0x1);if(_0x3bbf11==='/'){_0x57aa26=_0x57aa26['substring'](0x0,_0x57aa26[_0x5631('0xa0')](_0x3bbf11));}_0x19d3f7=util[_0x5631('0xa1')](_0x5631('0xa2'),_0x57aa26);_0x111253=util[_0x5631('0xa1')](_0x5631('0xa3'),_0x57aa26);_0x395bcc={'user':_0x260bfa[_0x5631('0x9a')],'pass':_0x260bfa[_0x5631('0x9b')]};var _0x456b31={'method':_0x5631('0xa4'),'uri':_0x19d3f7+_0x5631('0xa5'),'auth':_0x395bcc,'json':!![]};return rp(_0x456b31);}})['then'](function(_0x1ce13e){if(_0x1ce13e['result'][_0x5631('0x45')]>0x0){_0x128d4a=_0x1ce13e['result'];}console[_0x5631('0xa6')](_0x5631('0xa7'),_0x128d4a);_0x33d547=[];_0x15f2e7=Object[_0x5631('0xa8')]([],_0x128d4a);_[_0x5631('0xa9')](_0x15f2e7,function(_0x31a941){return!_0x2c4b0a[_0x5631('0xaa')](_0x31a941[_0x5631('0x2a')]);});_0x15f2e7[_0x5631('0xab')](function(_0x42874b){var _0x2ccf76=createFieldObject(_0x111253,_0x395bcc,_0x42874b['internalType'],_0x42874b[_0x5631('0x2a')],_0x42874b['label'],![]);_0x33d547[_0x5631('0xac')](_0x2ccf76);});return Promise[_0x5631('0xad')](_0x33d547);})['then'](function(_0x279958){_0x1f1972=_0x279958;_0x7ed02a=Object['assign']([],_0x128d4a);console['log'](_0x5631('0xae'),_0x128d4a);_[_0x5631('0xa9')](_0x7ed02a,function(_0x2ac769){return _0x5a5a55[_0x5631('0xaa')](_0x2ac769[_0x5631('0x2a')]);});console['log'](_0x5631('0xaf'),_0x7ed02a);_0x33d547=[];_0x7ed02a[_0x5631('0xab')](function(_0x3960e3){var _0x5d9ca5=createFieldObject(_0x111253,_0x395bcc,_0x3960e3[_0x5631('0xb0')],_0x3960e3[_0x5631('0x2a')],_0x3960e3['label'],!![]);_0x33d547[_0x5631('0xac')](_0x5d9ca5);});return Promise[_0x5631('0xad')](_0x33d547);})[_0x5631('0x28')](function(_0x431832){_0x9d0f3f=_0x431832;var _0x1220ca=_0x1f1972['concat'](_0x9d0f3f);return{'count':_0x1220ca[_0x5631('0x45')],'rows':_0x1220ca};})[_0x5631('0x28')](respondWithResult(_0x105b3c,null))[_0x5631('0x43')](function(_0x293c22){console[_0x5631('0xa6')](_0x5631('0xb1')+_0x293c22);var _0x4abf47=_0x52fbeb[_0x5631('0x31')][_0x5631('0xb2')]?0x1f4:_0x293c22[_0x5631('0xb3')]||0x1f4;logger['error'](_0x293c22[_0x5631('0x29')]);delete _0x293c22[_0x5631('0x2a')];if(_0x4abf47===0x191){_0x4abf47=0x190;}_0x105b3c[_0x5631('0x1d')](_0x4abf47)[_0x5631('0xb4')](_0x52fbeb[_0x5631('0x31')][_0x5631('0xb2')]?{'message':_0x5631('0xb5'),'statusCode':_0x293c22[_0x5631('0xb3')]}:_0x293c22);});};function createFieldObject(_0x2b0476,_0x1ae595,_0x154a00,_0x597359,_0x61b87c,_0x298ef3){return new Promise(function(_0x12fea8,_0x1ad9be){var _0x5efdf8={'id':_0x597359,'name':_0x61b87c,'custom':_0x298ef3};if(_0x154a00==='boolean'){_0x5efdf8[_0x5631('0x3f')]=[{'name':_0x5631('0xb6'),'value':'true'},{'name':_0x5631('0xb7'),'value':_0x5631('0xb8')}];_0x12fea8(_0x5efdf8);}else{var _0x5bc09f={'method':_0x5631('0xa4'),'uri':_0x2b0476+'sys_choice?sysparm_query=name=incident^element='+_0x597359,'auth':_0x1ae595,'json':!![]};return rp(_0x5bc09f)[_0x5631('0x28')](function(_0x32b41f){var _0x48a3b0=[];if(_0x32b41f['result'][_0x5631('0x45')]>0x0){_0x32b41f[_0x5631('0xb9')][_0x5631('0xab')](function(_0x49739d){if(_0x49739d[_0x5631('0xba')]===_0x5631('0xb8')){var _0xdb1ee8={'name':_0x49739d[_0x5631('0xbb')],'value':_0x49739d['value']};_0x48a3b0[_0x5631('0xac')](_0xdb1ee8);}});}_0x5efdf8[_0x5631('0x3f')]=_0x48a3b0;if(_0x5efdf8[_0x5631('0x3f')][_0x5631('0x45')]>0x0){_0x12fea8(_0x5efdf8);}else{if(_0x298ef3==![]){_0x12fea8();}else{_0x12fea8(_0x5efdf8);}}});}});} \ No newline at end of file +var _0x5faa=['attributes','fields','length','order','sort','where','merge','VIRTUAL','include','rows','catch','show','rawAttributes','keys','options','find','create','body','params','findOne','ServicenowConfiguration','pick','filter','getConfigurations','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','ServicenowField','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','child_incidents','approval_history','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','active','work_notes_list','business_service','sys_domain_path','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','correlation_display','delivery_task','work_start','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','follow_up','parent_incident','sys_id','reopened_by','urgency','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','sys_mod_count','sys_tags','escalation','correlation_id','password','email','remoteUri','serverUrl','slice','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','push','all','TCL:\x20_object','concat','test','Wrong\x20credentials','boolean','True','true','False','sys_choice?sysparm_query=name=incident^element=','inactive','false','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','ServicenowAccount','type','key','model','query','filters','intersection'];(function(_0x311862,_0x87e9ea){var _0x27d147=function(_0x58fac1){while(--_0x58fac1){_0x311862['push'](_0x311862['shift']());}};_0x27d147(++_0x87e9ea);}(_0x5faa,0x1f3));var _0xa5fa=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0x5faa[_0x3c8e9a];return _0x2d4c57;};'use strict';var emlformat=require(_0xa5fa('0x0'));var rimraf=require(_0xa5fa('0x1'));var zipdir=require(_0xa5fa('0x2'));var jsonpatch=require(_0xa5fa('0x3'));var rp=require(_0xa5fa('0x4'));var moment=require(_0xa5fa('0x5'));var BPromise=require(_0xa5fa('0x6'));var Mustache=require(_0xa5fa('0x7'));var util=require(_0xa5fa('0x8'));var path=require('path');var sox=require(_0xa5fa('0x9'));var csv=require('to-csv');var ejs=require(_0xa5fa('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa5fa('0xb'));var squel=require(_0xa5fa('0xc'));var crypto=require(_0xa5fa('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa5fa('0xe'));var querystring=require(_0xa5fa('0xf'));var Papa=require(_0xa5fa('0x10'));var Redis=require(_0xa5fa('0x11'));var authService=require(_0xa5fa('0x12'));var qs=require(_0xa5fa('0x13'));var as=require(_0xa5fa('0x14'));var hardwareService=require(_0xa5fa('0x15'));var logger=require(_0xa5fa('0x16'))('api');var utils=require(_0xa5fa('0x17'));var config=require(_0xa5fa('0x18'));var licenseUtil=require(_0xa5fa('0x19'));var db=require(_0xa5fa('0x1a'))['db'];var integrations=require(_0xa5fa('0x1b'));function respondWithStatusCode(_0x43d1c0,_0x4a55f6){_0x4a55f6=_0x4a55f6||0xcc;return function(_0x9ac677){if(_0x9ac677){return _0x43d1c0[_0xa5fa('0x1c')](_0x4a55f6);}return _0x43d1c0[_0xa5fa('0x1d')](_0x4a55f6)['end']();};}function respondWithResult(_0x37c290,_0x1bf784){_0x1bf784=_0x1bf784||0xc8;return function(_0x29b87b){if(_0x29b87b){return _0x37c290[_0xa5fa('0x1d')](_0x1bf784)[_0xa5fa('0x1e')](_0x29b87b);}};}function respondWithFilteredResult(_0x528a48,_0x388e4b){return function(_0x1c35c5){if(_0x1c35c5){var _0x375baa=typeof _0x388e4b[_0xa5fa('0x1f')]==='undefined'&&typeof _0x388e4b[_0xa5fa('0x20')]===_0xa5fa('0x21');var _0x5623a5=_0x1c35c5[_0xa5fa('0x22')];var _0x6316f3=_0x375baa?0x0:_0x388e4b[_0xa5fa('0x1f')];var _0x44dd44=_0x375baa?_0x1c35c5[_0xa5fa('0x22')]:_0x388e4b[_0xa5fa('0x1f')]+_0x388e4b['limit'];var _0x12347b;if(_0x44dd44>=_0x5623a5){_0x44dd44=_0x5623a5;_0x12347b=0xc8;}else{_0x12347b=0xce;}_0x528a48['status'](_0x12347b);return _0x528a48[_0xa5fa('0x23')](_0xa5fa('0x24'),_0x6316f3+'-'+_0x44dd44+'/'+_0x5623a5)[_0xa5fa('0x1e')](_0x1c35c5);}return null;};}function patchUpdates(_0x41d024){return function(_0x155241){try{jsonpatch[_0xa5fa('0x25')](_0x155241,_0x41d024,!![]);}catch(_0x3773b7){return BPromise[_0xa5fa('0x26')](_0x3773b7);}return _0x155241[_0xa5fa('0x27')]();};}function saveUpdates(_0x2da424,_0x51ddc7){return function(_0x3600f6){if(_0x3600f6){return _0x3600f6[_0xa5fa('0x28')](_0x2da424)[_0xa5fa('0x29')](function(_0xe1a505){return _0xe1a505;});}return null;};}function removeEntity(_0x346d5b,_0x55063c){return function(_0x51b234){if(_0x51b234){return _0x51b234[_0xa5fa('0x2a')]()[_0xa5fa('0x29')](function(){_0x346d5b[_0xa5fa('0x1d')](0xcc)[_0xa5fa('0x2b')]();});}};}function handleEntityNotFound(_0x21ea2f,_0x360cb7){return function(_0x545719){if(!_0x545719){_0x21ea2f['sendStatus'](0x194);}return _0x545719;};}function handleError(_0x52992b,_0x4ad264){_0x4ad264=_0x4ad264||0x1f4;return function(_0x3b4687){logger[_0xa5fa('0x2c')](_0x3b4687[_0xa5fa('0x2d')]);if(_0x3b4687[_0xa5fa('0x2e')]){delete _0x3b4687[_0xa5fa('0x2e')];}_0x52992b['status'](_0x4ad264)[_0xa5fa('0x2f')](_0x3b4687);};}exports['index']=function(_0x5b8f6a,_0x46c697){var _0x1efaf5={},_0x26c4c9={},_0xd9f22={'count':0x0,'rows':[]};var _0x32d003=_[_0xa5fa('0x30')](db[_0xa5fa('0x31')]['rawAttributes'],function(_0x282b27){return{'name':_0x282b27['fieldName'],'type':_0x282b27[_0xa5fa('0x32')][_0xa5fa('0x33')]};});_0x26c4c9[_0xa5fa('0x34')]=_[_0xa5fa('0x30')](_0x32d003,_0xa5fa('0x2e'));_0x26c4c9[_0xa5fa('0x35')]=_['keys'](_0x5b8f6a[_0xa5fa('0x35')]);_0x26c4c9[_0xa5fa('0x36')]=_[_0xa5fa('0x37')](_0x26c4c9['model'],_0x26c4c9[_0xa5fa('0x35')]);_0x1efaf5[_0xa5fa('0x38')]=_[_0xa5fa('0x37')](_0x26c4c9[_0xa5fa('0x34')],qs[_0xa5fa('0x39')](_0x5b8f6a[_0xa5fa('0x35')][_0xa5fa('0x39')]));_0x1efaf5[_0xa5fa('0x38')]=_0x1efaf5['attributes'][_0xa5fa('0x3a')]?_0x1efaf5[_0xa5fa('0x38')]:_0x26c4c9['model'];if(!_0x5b8f6a[_0xa5fa('0x35')]['hasOwnProperty']('nolimit')){_0x1efaf5[_0xa5fa('0x20')]=qs[_0xa5fa('0x20')](_0x5b8f6a['query'][_0xa5fa('0x20')]);_0x1efaf5[_0xa5fa('0x1f')]=qs[_0xa5fa('0x1f')](_0x5b8f6a['query'][_0xa5fa('0x1f')]);}_0x1efaf5[_0xa5fa('0x3b')]=qs['sort'](_0x5b8f6a['query'][_0xa5fa('0x3c')]);_0x1efaf5[_0xa5fa('0x3d')]=qs['filters'](_['pick'](_0x5b8f6a[_0xa5fa('0x35')],_0x26c4c9[_0xa5fa('0x36')]),_0x32d003);if(_0x5b8f6a[_0xa5fa('0x35')]['filter']){_0x1efaf5[_0xa5fa('0x3d')]=_[_0xa5fa('0x3e')](_0x1efaf5[_0xa5fa('0x3d')],{'$or':_[_0xa5fa('0x30')](_0x32d003,function(_0x25cd7d){if(_0x25cd7d['type']!==_0xa5fa('0x3f')){var _0x305d2e={};_0x305d2e[_0x25cd7d[_0xa5fa('0x2e')]]={'$like':'%'+_0x5b8f6a[_0xa5fa('0x35')]['filter']+'%'};return _0x305d2e;}})});}_0x1efaf5=_[_0xa5fa('0x3e')]({},_0x1efaf5,_0x5b8f6a['options']);var _0x270ca9={'where':_0x1efaf5[_0xa5fa('0x3d')]};return db[_0xa5fa('0x31')]['count'](_0x270ca9)[_0xa5fa('0x29')](function(_0x3d676f){_0xd9f22[_0xa5fa('0x22')]=_0x3d676f;if(_0x5b8f6a[_0xa5fa('0x35')]['includeAll']){_0x1efaf5[_0xa5fa('0x40')]=[{'all':!![]}];}return db[_0xa5fa('0x31')]['findAll'](_0x1efaf5);})[_0xa5fa('0x29')](function(_0x132be8){_0xd9f22[_0xa5fa('0x41')]=_0x132be8;return _0xd9f22;})[_0xa5fa('0x29')](respondWithFilteredResult(_0x46c697,_0x1efaf5))[_0xa5fa('0x42')](handleError(_0x46c697,null));};exports[_0xa5fa('0x43')]=function(_0x12bf72,_0x1dfb8f){var _0x54a2fb={'raw':![],'where':{'id':_0x12bf72['params']['id']}},_0x4537ab={};_0x4537ab[_0xa5fa('0x34')]=_['keys'](db['ServicenowAccount'][_0xa5fa('0x44')]);_0x4537ab['query']=_[_0xa5fa('0x45')](_0x12bf72[_0xa5fa('0x35')]);_0x4537ab[_0xa5fa('0x36')]=_['intersection'](_0x4537ab[_0xa5fa('0x34')],_0x4537ab[_0xa5fa('0x35')]);_0x54a2fb[_0xa5fa('0x38')]=_[_0xa5fa('0x37')](_0x4537ab[_0xa5fa('0x34')],qs[_0xa5fa('0x39')](_0x12bf72[_0xa5fa('0x35')][_0xa5fa('0x39')]));_0x54a2fb[_0xa5fa('0x38')]=_0x54a2fb[_0xa5fa('0x38')][_0xa5fa('0x3a')]?_0x54a2fb[_0xa5fa('0x38')]:_0x4537ab[_0xa5fa('0x34')];if(_0x12bf72[_0xa5fa('0x35')]['includeAll']){_0x54a2fb[_0xa5fa('0x40')]=[{'all':!![]}];}_0x54a2fb=_[_0xa5fa('0x3e')]({},_0x54a2fb,_0x12bf72[_0xa5fa('0x46')]);return db[_0xa5fa('0x31')][_0xa5fa('0x47')](_0x54a2fb)[_0xa5fa('0x29')](handleEntityNotFound(_0x1dfb8f,null))[_0xa5fa('0x29')](respondWithResult(_0x1dfb8f,null))['catch'](handleError(_0x1dfb8f,null));};exports[_0xa5fa('0x48')]=function(_0x5a8e35,_0x5c272e){return db[_0xa5fa('0x31')][_0xa5fa('0x48')](_0x5a8e35['body'],{})['then'](respondWithResult(_0x5c272e,0xc9))[_0xa5fa('0x42')](handleError(_0x5c272e,null));};exports[_0xa5fa('0x28')]=function(_0x47ead4,_0x4990d8){if(_0x47ead4['body']['id']){delete _0x47ead4['body']['id'];}return db['ServicenowAccount']['find']({'where':{'id':_0x47ead4['params']['id']}})[_0xa5fa('0x29')](handleEntityNotFound(_0x4990d8,null))[_0xa5fa('0x29')](saveUpdates(_0x47ead4[_0xa5fa('0x49')],null))[_0xa5fa('0x29')](respondWithResult(_0x4990d8,null))['catch'](handleError(_0x4990d8,null));};exports[_0xa5fa('0x2a')]=function(_0x566194,_0x4347ac){return db['ServicenowAccount'][_0xa5fa('0x47')]({'where':{'id':_0x566194[_0xa5fa('0x4a')]['id']}})[_0xa5fa('0x29')](handleEntityNotFound(_0x4347ac,null))[_0xa5fa('0x29')](removeEntity(_0x4347ac,null))['catch'](handleError(_0x4347ac,null));};exports['getConfigurations']=function(_0x13616b,_0x357693,_0x4cd113){var _0x16b6dd={};var _0x26c104={};var _0x695bd6;var _0x1c6fe7;return db[_0xa5fa('0x31')][_0xa5fa('0x4b')]({'where':{'id':_0x13616b[_0xa5fa('0x4a')]['id']}})[_0xa5fa('0x29')](handleEntityNotFound(_0x357693,null))[_0xa5fa('0x29')](function(_0x18f235){if(_0x18f235){_0x695bd6=_0x18f235;_0x26c104[_0xa5fa('0x34')]=_[_0xa5fa('0x45')](db[_0xa5fa('0x4c')]['rawAttributes']);_0x26c104[_0xa5fa('0x35')]=_[_0xa5fa('0x45')](_0x13616b[_0xa5fa('0x35')]);_0x26c104[_0xa5fa('0x36')]=_[_0xa5fa('0x37')](_0x26c104[_0xa5fa('0x34')],_0x26c104[_0xa5fa('0x35')]);_0x16b6dd[_0xa5fa('0x38')]=_[_0xa5fa('0x37')](_0x26c104[_0xa5fa('0x34')],qs['fields'](_0x13616b[_0xa5fa('0x35')][_0xa5fa('0x39')]));_0x16b6dd['attributes']=_0x16b6dd[_0xa5fa('0x38')][_0xa5fa('0x3a')]?_0x16b6dd[_0xa5fa('0x38')]:_0x26c104[_0xa5fa('0x34')];_0x16b6dd[_0xa5fa('0x3b')]=qs[_0xa5fa('0x3c')](_0x13616b[_0xa5fa('0x35')][_0xa5fa('0x3c')]);_0x16b6dd[_0xa5fa('0x3d')]=qs[_0xa5fa('0x36')](_[_0xa5fa('0x4d')](_0x13616b[_0xa5fa('0x35')],_0x26c104[_0xa5fa('0x36')]));if(_0x13616b[_0xa5fa('0x35')][_0xa5fa('0x4e')]){_0x16b6dd['where']=_[_0xa5fa('0x3e')](_0x16b6dd['where'],{'$or':_['map'](_0x16b6dd[_0xa5fa('0x38')],function(_0x3b6cbb){var _0x174546={};_0x174546[_0x3b6cbb]={'$like':'%'+_0x13616b[_0xa5fa('0x35')][_0xa5fa('0x4e')]+'%'};return _0x174546;})});}_0x16b6dd=_[_0xa5fa('0x3e')]({},_0x16b6dd,_0x13616b[_0xa5fa('0x46')]);return _0x695bd6[_0xa5fa('0x4f')](_0x16b6dd);}})['then'](function(_0x46f046){if(_0x46f046){_0x1c6fe7=_0x46f046['length'];if(!_0x13616b[_0xa5fa('0x35')][_0xa5fa('0x50')](_0xa5fa('0x51'))){_0x16b6dd[_0xa5fa('0x20')]=qs[_0xa5fa('0x20')](_0x13616b[_0xa5fa('0x35')][_0xa5fa('0x20')]);_0x16b6dd[_0xa5fa('0x1f')]=qs[_0xa5fa('0x1f')](_0x13616b[_0xa5fa('0x35')]['offset']);}return _0x695bd6[_0xa5fa('0x4f')](_0x16b6dd);}})[_0xa5fa('0x29')](function(_0x39c603){if(_0x39c603){return _0x39c603?{'count':_0x1c6fe7,'rows':_0x39c603}:null;}})['then'](respondWithResult(_0x357693,null))[_0xa5fa('0x42')](handleError(_0x357693,null));};exports[_0xa5fa('0x52')]=function(_0x2e20fe,_0x5f54db,_0xdfebd4){if(_0x2e20fe[_0xa5fa('0x49')]['id']){delete _0x2e20fe[_0xa5fa('0x49')]['id'];}return db[_0xa5fa('0x31')][_0xa5fa('0x4b')]({'where':{'id':_0x2e20fe['params']['id']}})['then'](handleEntityNotFound(_0x5f54db,null))[_0xa5fa('0x29')](function(_0x1f0ea8){if(_0x1f0ea8){_0x2e20fe[_0xa5fa('0x49')][_0xa5fa('0x53')]=_0x1f0ea8['id'];_0x2e20fe['body'][_0xa5fa('0x54')]=integrations['getSubjects'](_0x2e20fe[_0xa5fa('0x49')][_0xa5fa('0x55')],_0x2e20fe[_0xa5fa('0x49')][_0xa5fa('0x32')]);_0x2e20fe['body'][_0xa5fa('0x56')]=integrations[_0xa5fa('0x57')](_0x2e20fe['body']['channel'],_0x2e20fe['body'][_0xa5fa('0x32')]);return db[_0xa5fa('0x4c')][_0xa5fa('0x48')](_0x2e20fe[_0xa5fa('0x49')],{'include':[{'model':db[_0xa5fa('0x58')],'as':_0xa5fa('0x54')},{'model':db[_0xa5fa('0x58')],'as':_0xa5fa('0x56')}]});}return null;})['then'](respondWithResult(_0x5f54db,null))[_0xa5fa('0x42')](handleError(_0x5f54db,null));};exports['getFields']=function(_0x51785b,_0x4808b4,_0x3f1600){var _0x269119=[_0xa5fa('0x59'),_0xa5fa('0x5a'),_0xa5fa('0x5b'),_0xa5fa('0x5c'),_0xa5fa('0x5d'),_0xa5fa('0x5e'),_0xa5fa('0x5f'),_0xa5fa('0x60'),_0xa5fa('0x61')];var _0x543b22=[_0xa5fa('0x62'),'made_sla',_0xa5fa('0x63'),_0xa5fa('0x64'),_0xa5fa('0x65'),'sys_updated_on',_0xa5fa('0x66'),_0xa5fa('0x5a'),_0xa5fa('0x67'),'number',_0xa5fa('0x68'),_0xa5fa('0x69'),_0xa5fa('0x6a'),_0xa5fa('0x6b'),_0xa5fa('0x6c'),_0xa5fa('0x6d'),_0xa5fa('0x6e'),_0xa5fa('0x6f'),_0xa5fa('0x5b'),_0xa5fa('0x3b'),_0xa5fa('0x70'),_0xa5fa('0x71'),_0xa5fa('0x72'),'delivery_plan','impact',_0xa5fa('0x73'),_0xa5fa('0x74'),_0xa5fa('0x75'),'priority',_0xa5fa('0x76'),'rfc','time_worked',_0xa5fa('0x77'),_0xa5fa('0x78'),_0xa5fa('0x79'),_0xa5fa('0x7a'),_0xa5fa('0x7b'),_0xa5fa('0x7c'),_0xa5fa('0x7d'),_0xa5fa('0x7e'),_0xa5fa('0x7f'),'subcategory',_0xa5fa('0x80'),'short_description',_0xa5fa('0x5d'),_0xa5fa('0x81'),_0xa5fa('0x82'),_0xa5fa('0x83'),'assignment_group',_0xa5fa('0x84'),_0xa5fa('0x85'),_0xa5fa('0x86'),_0xa5fa('0x87'),'notify',_0xa5fa('0x88'),'close_notes','closed_by',_0xa5fa('0x89'),_0xa5fa('0x8a'),_0xa5fa('0x8b'),'contact_type',_0xa5fa('0x8c'),_0xa5fa('0x5f'),_0xa5fa('0x8d'),'problem_id','company','reassignment_count',_0xa5fa('0x8e'),_0xa5fa('0x8f'),'severity',_0xa5fa('0x90'),_0xa5fa('0x91'),_0xa5fa('0x92'),_0xa5fa('0x93'),'due_date',_0xa5fa('0x94'),'reopen_count',_0xa5fa('0x95'),_0xa5fa('0x96'),'upon_approval',_0xa5fa('0x97'),'location',_0xa5fa('0x61')];var _0x4df82a='';var _0x464681='';var _0x4b87e0=[];var _0xef6431='';var _0x5c04ec='';var _0x29993e=[];var _0x2ea86b='';var _0x235487='';var _0x8028ac={};var _0xb5d9e5='';return db['ServicenowAccount'][_0xa5fa('0x4b')]({'where':{'id':_0x51785b[_0xa5fa('0x4a')]['id']},'attributes':['id','username',_0xa5fa('0x98'),_0xa5fa('0x99'),_0xa5fa('0x9a'),_0xa5fa('0x9b')]})[_0xa5fa('0x29')](handleEntityNotFound(_0x4808b4,null))[_0xa5fa('0x29')](function(_0x1855ea){if(_0x1855ea){_0xb5d9e5=_0x1855ea[_0xa5fa('0x9a')];var _0xfbc501=_0xb5d9e5[_0xa5fa('0x9c')](-0x1);if(_0xfbc501==='/'){_0xb5d9e5=_0xb5d9e5['substring'](0x0,_0xb5d9e5['lastIndexOf'](_0xfbc501));}_0x235487=util[_0xa5fa('0x9d')](_0xa5fa('0x9e'),_0xb5d9e5);_0x2ea86b=util[_0xa5fa('0x9d')](_0xa5fa('0x9f'),_0xb5d9e5);_0x8028ac={'user':_0x1855ea['username'],'pass':_0x1855ea[_0xa5fa('0x98')]};var _0x4c06a1={'method':_0xa5fa('0xa0'),'uri':_0x235487+_0xa5fa('0xa1'),'auth':_0x8028ac,'json':!![]};return rp(_0x4c06a1);}})[_0xa5fa('0x29')](function(_0xea7f20){if(_0xea7f20[_0xa5fa('0xa2')][_0xa5fa('0x3a')]>0x0){_0x4df82a=_0xea7f20[_0xa5fa('0xa2')];}console[_0xa5fa('0xa3')](_0xa5fa('0xa4'),_0x4df82a);_0x29993e=[];_0x464681=Object[_0xa5fa('0xa5')]([],_0x4df82a);_[_0xa5fa('0xa6')](_0x464681,function(_0x3c16ef){return!_0x269119[_0xa5fa('0xa7')](_0x3c16ef[_0xa5fa('0x2e')]);});_0x464681[_0xa5fa('0xa8')](function(_0x599f45){var _0x375c7c=createFieldObject(_0x2ea86b,_0x8028ac,_0x599f45[_0xa5fa('0xa9')],_0x599f45[_0xa5fa('0x2e')],_0x599f45[_0xa5fa('0xaa')],![]);_0x29993e[_0xa5fa('0xab')](_0x375c7c);});return Promise[_0xa5fa('0xac')](_0x29993e);})['then'](function(_0x4d42e0){_0x4b87e0=_0x4d42e0;_0xef6431=Object[_0xa5fa('0xa5')]([],_0x4df82a);console['log'](_0xa5fa('0xad'),_0x4df82a);_[_0xa5fa('0xa6')](_0xef6431,function(_0x3d62af){return _0x543b22[_0xa5fa('0xa7')](_0x3d62af[_0xa5fa('0x2e')]);});console[_0xa5fa('0xa3')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0xef6431);_0x29993e=[];_0xef6431[_0xa5fa('0xa8')](function(_0x498a1c){var _0x4b0977=createFieldObject(_0x2ea86b,_0x8028ac,_0x498a1c['internalType'],_0x498a1c[_0xa5fa('0x2e')],_0x498a1c[_0xa5fa('0xaa')],!![]);_0x29993e[_0xa5fa('0xab')](_0x4b0977);});return Promise[_0xa5fa('0xac')](_0x29993e);})[_0xa5fa('0x29')](function(_0x1da48a){_0x5c04ec=_0x1da48a;var _0x1ab261=_0x4b87e0[_0xa5fa('0xae')](_0x5c04ec);return{'count':_0x1ab261[_0xa5fa('0x3a')],'rows':_0x1ab261};})['then'](respondWithResult(_0x4808b4,null))[_0xa5fa('0x42')](function(_0x40f82f){console['log']('ServiceNow\x20error:\x20'+_0x40f82f);var _0x1507d1=_0x51785b['query'][_0xa5fa('0xaf')]?0x1f4:_0x40f82f['statusCode']||0x1f4;logger[_0xa5fa('0x2c')](_0x40f82f[_0xa5fa('0x2d')]);delete _0x40f82f[_0xa5fa('0x2e')];if(_0x1507d1===0x191){_0x1507d1=0x190;}_0x4808b4[_0xa5fa('0x1d')](_0x1507d1)[_0xa5fa('0x2f')](_0x51785b['query'][_0xa5fa('0xaf')]?{'message':_0xa5fa('0xb0'),'statusCode':_0x40f82f['statusCode']}:_0x40f82f);});};function createFieldObject(_0x5099ba,_0x49ed77,_0x5b59da,_0x2205ce,_0x24744f,_0x1fcf69){return new Promise(function(_0x6b1507,_0x3c6945){var _0x23f828={'id':_0x2205ce,'name':_0x24744f,'custom':_0x1fcf69};if(_0x5b59da===_0xa5fa('0xb1')){_0x23f828[_0xa5fa('0x46')]=[{'name':_0xa5fa('0xb2'),'value':_0xa5fa('0xb3')},{'name':_0xa5fa('0xb4'),'value':'false'}];_0x6b1507(_0x23f828);}else{var _0x562b06={'method':_0xa5fa('0xa0'),'uri':_0x5099ba+_0xa5fa('0xb5')+_0x2205ce,'auth':_0x49ed77,'json':!![]};return rp(_0x562b06)['then'](function(_0x18feae){var _0x2c852f=[];if(_0x18feae[_0xa5fa('0xa2')][_0xa5fa('0x3a')]>0x0){_0x18feae[_0xa5fa('0xa2')]['forEach'](function(_0x9bba64){if(_0x9bba64[_0xa5fa('0xb6')]===_0xa5fa('0xb7')){var _0x4c997d={'name':_0x9bba64[_0xa5fa('0xaa')],'value':_0x9bba64[_0xa5fa('0xb8')]};_0x2c852f[_0xa5fa('0xab')](_0x4c997d);}});}_0x23f828[_0xa5fa('0x46')]=_0x2c852f;if(_0x23f828[_0xa5fa('0x46')][_0xa5fa('0x3a')]>0x0){_0x6b1507(_0x23f828);}else{if(_0x1fcf69==![]){_0x6b1507();}else{_0x6b1507(_0x23f828);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index d2bee40..760a025 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 _0x46ed=['bluebird','path','rimraf','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','lodash','util','api','moment'];(function(_0x4c064a,_0x49b9f8){var _0x47ebe3=function(_0x4d359e){while(--_0x4d359e){_0x4c064a['push'](_0x4c064a['shift']());}};_0x47ebe3(++_0x49b9f8);}(_0x46ed,0x168));var _0xd46e=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x46ed[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var logger=require('../../config/logger')(_0xd46e('0x2'));var moment=require(_0xd46e('0x3'));var BPromise=require(_0xd46e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd46e('0x5'));var rimraf=require(_0xd46e('0x6'));var config=require('../../config/environment');var attributes=require(_0xd46e('0x7'));var integrations=require(_0xd46e('0x8'));module[_0xd46e('0x9')]=function(_0x25cf78,_0x45e680){return _0x25cf78[_0xd46e('0xa')](_0xd46e('0xb'),attributes,{'tableName':_0xd46e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf494=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','int_servicenow_accounts','lodash'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0xf494,0x1c6));var _0x4f49=function(_0x3dc5f8,_0x4ebfed){_0x3dc5f8=_0x3dc5f8-0x0;var _0x286461=_0xf494[_0x3dc5f8];return _0x286461;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));var integrations=require(_0x4f49('0xa'));module[_0x4f49('0xb')]=function(_0x413530,_0x42b0e8){return _0x413530['define']('ServicenowAccount',attributes,{'tableName':_0x4f49('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 72df8fa..94c88ab 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 _0x1377=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetServicenowAccount','findAll','options','raw','limit','include','model','attributes','map','debug','ShowServicenowAccount','ServicenowAccount','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x15d8e2,_0x42f089){var _0x52763d=function(_0x2ebe39){while(--_0x2ebe39){_0x15d8e2['push'](_0x15d8e2['shift']());}};_0x52763d(++_0x42f089);}(_0x1377,0x1a5));var _0x7137=function(_0x3e797e,_0x572dea){_0x3e797e=_0x3e797e-0x0;var _0x397cba=_0x1377[_0x3e797e];return _0x397cba;};'use strict';var _=require(_0x7137('0x0'));var util=require(_0x7137('0x1'));var moment=require(_0x7137('0x2'));var BPromise=require(_0x7137('0x3'));var rs=require(_0x7137('0x4'));var fs=require('fs');var Redis=require(_0x7137('0x5'));var db=require(_0x7137('0x6'))['db'];var utils=require(_0x7137('0x7'));var logger=require(_0x7137('0x8'))(_0x7137('0x9'));var config=require(_0x7137('0xa'));var jayson=require(_0x7137('0xb'));var client=jayson[_0x7137('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x451240,_0x33ed64,_0x5aebc5){return new BPromise(function(_0x1f59cc,_0x28b28f){return client[_0x7137('0xd')](_0x451240,_0x5aebc5)[_0x7137('0xe')](function(_0x584ee2){logger[_0x7137('0xf')](_0x7137('0x10'),_0x33ed64,_0x7137('0x11'));logger['debug'](_0x7137('0x12'),_0x33ed64,_0x7137('0x11'),JSON[_0x7137('0x13')](_0x584ee2));if(_0x584ee2[_0x7137('0x14')]){if(_0x584ee2[_0x7137('0x14')][_0x7137('0x15')]===0x1f4){logger[_0x7137('0x14')]('ServicenowAccount,\x20%s,\x20%s',_0x33ed64,_0x584ee2[_0x7137('0x14')][_0x7137('0x16')]);return _0x28b28f(_0x584ee2['error'][_0x7137('0x16')]);}logger[_0x7137('0x14')](_0x7137('0x10'),_0x33ed64,_0x584ee2['error'][_0x7137('0x16')]);return _0x1f59cc(_0x584ee2[_0x7137('0x14')][_0x7137('0x16')]);}else{logger[_0x7137('0xf')](_0x7137('0x10'),_0x33ed64,'request\x20sent');_0x1f59cc(_0x584ee2[_0x7137('0x17')][_0x7137('0x16')]);}})[_0x7137('0x18')](function(_0x5ed991){logger['error'](_0x7137('0x10'),_0x33ed64,_0x5ed991);_0x28b28f(_0x5ed991);});});}exports[_0x7137('0x19')]=function(_0x4f1aac){var _0x3e9af4=this;return new Promise(function(_0x4d65fd,_0x2322b1){return db['ServicenowAccount'][_0x7137('0x1a')]({'raw':_0x4f1aac[_0x7137('0x1b')]?_0x4f1aac[_0x7137('0x1b')][_0x7137('0x1c')]===undefined?!![]:![]:!![],'where':_0x4f1aac[_0x7137('0x1b')]?_0x4f1aac[_0x7137('0x1b')]['where']||null:null,'attributes':_0x4f1aac['options']?_0x4f1aac[_0x7137('0x1b')]['attributes']||null:null,'limit':_0x4f1aac[_0x7137('0x1b')]?_0x4f1aac[_0x7137('0x1b')][_0x7137('0x1d')]||null:null,'include':_0x4f1aac[_0x7137('0x1b')]?_0x4f1aac[_0x7137('0x1b')][_0x7137('0x1e')]?_['map'](_0x4f1aac[_0x7137('0x1b')][_0x7137('0x1e')],function(_0x476b10){return{'model':db[_0x476b10[_0x7137('0x1f')]],'as':_0x476b10['as'],'attributes':_0x476b10[_0x7137('0x20')],'include':_0x476b10['include']?_['map'](_0x476b10['include'],function(_0x430f23){return{'model':db[_0x430f23[_0x7137('0x1f')]],'as':_0x430f23['as'],'attributes':_0x430f23['attributes'],'include':_0x430f23[_0x7137('0x1e')]?_[_0x7137('0x21')](_0x430f23[_0x7137('0x1e')],function(_0x1000fd){return{'model':db[_0x1000fd[_0x7137('0x1f')]],'as':_0x1000fd['as'],'attributes':_0x1000fd[_0x7137('0x20')]};}):[]};}):[]};}):[]:[]})[_0x7137('0xe')](function(_0x19f8bd){logger[_0x7137('0xf')]('GetServicenowAccount',_0x4f1aac);logger[_0x7137('0x22')](_0x7137('0x19'),_0x4f1aac,JSON['stringify'](_0x19f8bd));_0x4d65fd(_0x19f8bd);})[_0x7137('0x18')](function(_0x5753d5){logger[_0x7137('0x14')]('GetServicenowAccount',_0x5753d5[_0x7137('0x16')],_0x4f1aac);_0x2322b1(_0x3e9af4[_0x7137('0x14')](0x1f4,_0x5753d5[_0x7137('0x16')]));});});};exports[_0x7137('0x23')]=function(_0x3e6665){var _0x3bc20b=this;return new Promise(function(_0xf76a98,_0x21c5a7){return db[_0x7137('0x24')][_0x7137('0x25')]({'raw':_0x3e6665[_0x7137('0x1b')]?_0x3e6665['options'][_0x7137('0x1c')]===undefined?!![]:![]:!![],'where':_0x3e6665[_0x7137('0x1b')]?_0x3e6665['options'][_0x7137('0x26')]||null:null,'attributes':_0x3e6665[_0x7137('0x1b')]?_0x3e6665[_0x7137('0x1b')][_0x7137('0x20')]||null:null,'include':_0x3e6665['options']?_0x3e6665[_0x7137('0x1b')]['include']?_[_0x7137('0x21')](_0x3e6665['options']['include'],function(_0x1030d9){return{'model':db[_0x1030d9[_0x7137('0x1f')]],'as':_0x1030d9['as'],'attributes':_0x1030d9[_0x7137('0x20')],'include':_0x1030d9[_0x7137('0x1e')]?_[_0x7137('0x21')](_0x1030d9[_0x7137('0x1e')],function(_0x173ef1){return{'model':db[_0x173ef1[_0x7137('0x1f')]],'as':_0x173ef1['as'],'attributes':_0x173ef1[_0x7137('0x20')],'include':_0x173ef1['include']?_[_0x7137('0x21')](_0x173ef1[_0x7137('0x1e')],function(_0x5c708f){return{'model':db[_0x5c708f[_0x7137('0x1f')]],'as':_0x5c708f['as'],'attributes':_0x5c708f['attributes']};}):[]};}):[]};}):[]:[]})[_0x7137('0xe')](function(_0x4b2a41){logger[_0x7137('0xf')](_0x7137('0x23'),_0x3e6665);logger['debug'](_0x7137('0x23'),_0x3e6665,JSON[_0x7137('0x13')](_0x4b2a41));_0xf76a98(_0x4b2a41);})[_0x7137('0x18')](function(_0xa44de3){logger[_0x7137('0x14')]('ShowServicenowAccount',_0xa44de3[_0x7137('0x16')],_0x3e6665);_0x21c5a7(_0x3bc20b[_0x7137('0x14')](0x1f4,_0xa44de3[_0x7137('0x16')]));});});}; \ No newline at end of file +var _0x9a18=['map','model','catch','ShowServicenowAccount','ServicenowAccount','find','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetServicenowAccount','findAll','options','where','attributes','limit','include'];(function(_0x17e46a,_0x5044cc){var _0x838e9e=function(_0x27e9fd){while(--_0x27e9fd){_0x17e46a['push'](_0x17e46a['shift']());}};_0x838e9e(++_0x5044cc);}(_0x9a18,0x1e2));var _0x89a1=function(_0x2d5c52,_0x1858f3){_0x2d5c52=_0x2d5c52-0x0;var _0x4f38b1=_0x9a18[_0x2d5c52];return _0x4f38b1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x89a1('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x89a1('0x1'));var db=require(_0x89a1('0x2'))['db'];var utils=require(_0x89a1('0x3'));var logger=require(_0x89a1('0x4'))(_0x89a1('0x5'));var config=require(_0x89a1('0x6'));var jayson=require(_0x89a1('0x7'));var client=jayson[_0x89a1('0x8')][_0x89a1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52dc41,_0xbd55f4,_0x23017d){return new BPromise(function(_0x3d515a,_0x3d863a){return client[_0x89a1('0xa')](_0x52dc41,_0x23017d)[_0x89a1('0xb')](function(_0x5e0e75){logger[_0x89a1('0xc')](_0x89a1('0xd'),_0xbd55f4,_0x89a1('0xe'));logger[_0x89a1('0xf')](_0x89a1('0x10'),_0xbd55f4,_0x89a1('0xe'),JSON[_0x89a1('0x11')](_0x5e0e75));if(_0x5e0e75[_0x89a1('0x12')]){if(_0x5e0e75[_0x89a1('0x12')]['code']===0x1f4){logger[_0x89a1('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0xbd55f4,_0x5e0e75[_0x89a1('0x12')][_0x89a1('0x13')]);return _0x3d863a(_0x5e0e75[_0x89a1('0x12')][_0x89a1('0x13')]);}logger[_0x89a1('0x12')](_0x89a1('0xd'),_0xbd55f4,_0x5e0e75['error']['message']);return _0x3d515a(_0x5e0e75[_0x89a1('0x12')]['message']);}else{logger['info'](_0x89a1('0xd'),_0xbd55f4,_0x89a1('0xe'));_0x3d515a(_0x5e0e75[_0x89a1('0x14')][_0x89a1('0x13')]);}})['catch'](function(_0x265d2a){logger[_0x89a1('0x12')](_0x89a1('0xd'),_0xbd55f4,_0x265d2a);_0x3d863a(_0x265d2a);});});}exports[_0x89a1('0x15')]=function(_0x87a2b0){var _0xb462cf=this;return new Promise(function(_0x4dccbe,_0xf8746){return db['ServicenowAccount'][_0x89a1('0x16')]({'raw':_0x87a2b0[_0x89a1('0x17')]?_0x87a2b0[_0x89a1('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x87a2b0[_0x89a1('0x17')]?_0x87a2b0[_0x89a1('0x17')][_0x89a1('0x18')]||null:null,'attributes':_0x87a2b0[_0x89a1('0x17')]?_0x87a2b0[_0x89a1('0x17')][_0x89a1('0x19')]||null:null,'limit':_0x87a2b0['options']?_0x87a2b0['options'][_0x89a1('0x1a')]||null:null,'include':_0x87a2b0['options']?_0x87a2b0[_0x89a1('0x17')][_0x89a1('0x1b')]?_[_0x89a1('0x1c')](_0x87a2b0['options'][_0x89a1('0x1b')],function(_0x1e14c0){return{'model':db[_0x1e14c0[_0x89a1('0x1d')]],'as':_0x1e14c0['as'],'attributes':_0x1e14c0[_0x89a1('0x19')],'include':_0x1e14c0['include']?_[_0x89a1('0x1c')](_0x1e14c0[_0x89a1('0x1b')],function(_0x169db9){return{'model':db[_0x169db9[_0x89a1('0x1d')]],'as':_0x169db9['as'],'attributes':_0x169db9['attributes'],'include':_0x169db9[_0x89a1('0x1b')]?_[_0x89a1('0x1c')](_0x169db9[_0x89a1('0x1b')],function(_0x236032){return{'model':db[_0x236032[_0x89a1('0x1d')]],'as':_0x236032['as'],'attributes':_0x236032[_0x89a1('0x19')]};}):[]};}):[]};}):[]:[]})[_0x89a1('0xb')](function(_0x55c45d){logger['info'](_0x89a1('0x15'),_0x87a2b0);logger[_0x89a1('0xf')](_0x89a1('0x15'),_0x87a2b0,JSON[_0x89a1('0x11')](_0x55c45d));_0x4dccbe(_0x55c45d);})[_0x89a1('0x1e')](function(_0x13bc5f){logger[_0x89a1('0x12')]('GetServicenowAccount',_0x13bc5f[_0x89a1('0x13')],_0x87a2b0);_0xf8746(_0xb462cf[_0x89a1('0x12')](0x1f4,_0x13bc5f[_0x89a1('0x13')]));});});};exports[_0x89a1('0x1f')]=function(_0x224b9d){var _0xe358d9=this;return new Promise(function(_0x56dc44,_0x552293){return db[_0x89a1('0x20')][_0x89a1('0x21')]({'raw':_0x224b9d['options']?_0x224b9d[_0x89a1('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x224b9d[_0x89a1('0x17')]?_0x224b9d[_0x89a1('0x17')][_0x89a1('0x18')]||null:null,'attributes':_0x224b9d[_0x89a1('0x17')]?_0x224b9d[_0x89a1('0x17')]['attributes']||null:null,'include':_0x224b9d[_0x89a1('0x17')]?_0x224b9d[_0x89a1('0x17')][_0x89a1('0x1b')]?_['map'](_0x224b9d[_0x89a1('0x17')][_0x89a1('0x1b')],function(_0x4e1653){return{'model':db[_0x4e1653[_0x89a1('0x1d')]],'as':_0x4e1653['as'],'attributes':_0x4e1653['attributes'],'include':_0x4e1653[_0x89a1('0x1b')]?_[_0x89a1('0x1c')](_0x4e1653[_0x89a1('0x1b')],function(_0x5824f6){return{'model':db[_0x5824f6[_0x89a1('0x1d')]],'as':_0x5824f6['as'],'attributes':_0x5824f6[_0x89a1('0x19')],'include':_0x5824f6[_0x89a1('0x1b')]?_[_0x89a1('0x1c')](_0x5824f6[_0x89a1('0x1b')],function(_0x133b66){return{'model':db[_0x133b66[_0x89a1('0x1d')]],'as':_0x133b66['as'],'attributes':_0x133b66['attributes']};}):[]};}):[]};}):[]:[]})[_0x89a1('0xb')](function(_0x3e5d1e){logger[_0x89a1('0xc')](_0x89a1('0x1f'),_0x224b9d);logger[_0x89a1('0xf')](_0x89a1('0x1f'),_0x224b9d,JSON[_0x89a1('0x11')](_0x3e5d1e));_0x56dc44(_0x3e5d1e);})[_0x89a1('0x1e')](function(_0x2bc330){logger[_0x89a1('0x12')]('ShowServicenowAccount',_0x2bc330[_0x89a1('0x13')],_0x224b9d);_0x552293(_0xe358d9[_0x89a1('0x12')](0x1f4,_0x2bc330[_0x89a1('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 7b7fb8c..f37c71a 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 _0x21ee=['../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','isAuthenticated','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','fs-extra','../../components/auth/service'];(function(_0x4c184d,_0x4278ab){var _0x23d997=function(_0x22d068){while(--_0x22d068){_0x4c184d['push'](_0x4c184d['shift']());}};_0x23d997(++_0x4278ab);}(_0x21ee,0xa6));var _0xe21e=function(_0x40d198,_0x767ba9){_0x40d198=_0x40d198-0x0;var _0x5bb0de=_0x21ee[_0x40d198];return _0x5bb0de;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xe21e('0x0'));var auth=require(_0xe21e('0x1'));var interaction=require(_0xe21e('0x2'));var config=require(_0xe21e('0x3'));var controller=require(_0xe21e('0x4'));router['get']('/',auth[_0xe21e('0x5')](),controller['index']);router[_0xe21e('0x6')](_0xe21e('0x7'),auth['isAuthenticated'](),controller[_0xe21e('0x8')]);router[_0xe21e('0x6')](_0xe21e('0x9'),auth[_0xe21e('0x5')](),controller[_0xe21e('0xa')]);router[_0xe21e('0x6')](_0xe21e('0xb'),auth[_0xe21e('0x5')](),controller[_0xe21e('0xc')]);router[_0xe21e('0x6')]('/:id/descriptions',auth[_0xe21e('0x5')](),controller[_0xe21e('0xd')]);router[_0xe21e('0xe')]('/',auth['isAuthenticated'](),controller[_0xe21e('0xf')]);router[_0xe21e('0x10')](_0xe21e('0x7'),auth['isAuthenticated'](),controller[_0xe21e('0x11')]);router[_0xe21e('0x12')](_0xe21e('0x7'),auth['isAuthenticated'](),controller[_0xe21e('0x13')]);module[_0xe21e('0x14')]=router; \ No newline at end of file +var _0x0049=['create','delete','destroy','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post'];(function(_0x296fa8,_0x2e1b95){var _0x38e684=function(_0x500687){while(--_0x500687){_0x296fa8['push'](_0x296fa8['shift']());}};_0x38e684(++_0x2e1b95);}(_0x0049,0x15c));var _0x9004=function(_0x594e78,_0xe883ef){_0x594e78=_0x594e78-0x0;var _0x39263e=_0x0049[_0x594e78];return _0x39263e;};'use strict';var multer=require(_0x9004('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9004('0x1'));var express=require(_0x9004('0x2'));var router=express['Router']();var fs_extra=require(_0x9004('0x3'));var auth=require(_0x9004('0x4'));var interaction=require(_0x9004('0x5'));var config=require(_0x9004('0x6'));var controller=require(_0x9004('0x7'));router['get']('/',auth[_0x9004('0x8')](),controller[_0x9004('0x9')]);router[_0x9004('0xa')](_0x9004('0xb'),auth['isAuthenticated'](),controller[_0x9004('0xc')]);router[_0x9004('0xa')](_0x9004('0xd'),auth[_0x9004('0x8')](),controller[_0x9004('0xe')]);router['get'](_0x9004('0xf'),auth[_0x9004('0x8')](),controller[_0x9004('0x10')]);router[_0x9004('0xa')](_0x9004('0x11'),auth[_0x9004('0x8')](),controller[_0x9004('0x12')]);router[_0x9004('0x13')]('/',auth[_0x9004('0x8')](),controller[_0x9004('0x14')]);router['put'](_0x9004('0xb'),auth[_0x9004('0x8')](),controller['update']);router[_0x9004('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x9004('0x16')]);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 f53b9d0..b6caf43 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 _0x6402=['exports','STRING'];(function(_0x3b8f2e,_0x5a99a8){var _0x1433d5=function(_0x5e0353){while(--_0x5e0353){_0x3b8f2e['push'](_0x3b8f2e['shift']());}};_0x1433d5(++_0x5a99a8);}(_0x6402,0x11e));var _0x2640=function(_0x40f451,_0x4bbff8){_0x40f451=_0x40f451-0x0;var _0x4c09b3=_0x6402[_0x40f451];return _0x4c09b3;};'use strict';var Sequelize=require('sequelize');module[_0x2640('0x0')]={'name':{'type':Sequelize[_0x2640('0x1')]},'description':{'type':Sequelize[_0x2640('0x1')]}}; \ No newline at end of file +var _0x025b=['sequelize','exports','STRING'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0x025b,0x1e0));var _0xb025=function(_0x3001a,_0x44c1e6){_0x3001a=_0x3001a-0x0;var _0x1ec645=_0x025b[_0x3001a];return _0x1ec645;};'use strict';var Sequelize=require(_0xb025('0x0'));module[_0xb025('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb025('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 2829ad6..3efc18b 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 _0xbce3=['create','body','find','destroy','findOne','rawAttributes','pick','hasOwnProperty','getFields','getSubjects','ServicenowField','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','save','update','then','stack','send','map','ServicenowConfiguration','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','name','options','includeAll','include','rows','catch','params'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbce3,0xf3));var _0x3bce=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xbce3[_0x110c3d];return _0x226d67;};'use strict';var emlformat=require(_0x3bce('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3bce('0x1'));var jsonpatch=require(_0x3bce('0x2'));var rp=require(_0x3bce('0x3'));var moment=require(_0x3bce('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3bce('0x5'));var util=require(_0x3bce('0x6'));var path=require(_0x3bce('0x7'));var sox=require(_0x3bce('0x8'));var csv=require(_0x3bce('0x9'));var ejs=require(_0x3bce('0xa'));var fs=require('fs');var fs_extra=require(_0x3bce('0xb'));var _=require(_0x3bce('0xc'));var squel=require(_0x3bce('0xd'));var crypto=require('crypto');var jsforce=require(_0x3bce('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3bce('0x9'));var querystring=require(_0x3bce('0xf'));var Papa=require('papaparse');var Redis=require(_0x3bce('0x10'));var authService=require(_0x3bce('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3bce('0x12'));var hardwareService=require(_0x3bce('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x3bce('0x14'));var config=require(_0x3bce('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x3bce('0x16'))['db'];function respondWithStatusCode(_0x1b7351,_0x2945d5){_0x2945d5=_0x2945d5||0xcc;return function(_0x550f76){if(_0x550f76){return _0x1b7351[_0x3bce('0x17')](_0x2945d5);}return _0x1b7351[_0x3bce('0x18')](_0x2945d5)[_0x3bce('0x19')]();};}function respondWithResult(_0x3f2d68,_0x1b594a){_0x1b594a=_0x1b594a||0xc8;return function(_0x170163){if(_0x170163){return _0x3f2d68[_0x3bce('0x18')](_0x1b594a)[_0x3bce('0x1a')](_0x170163);}};}function respondWithFilteredResult(_0x44e6e8,_0x13ef33){return function(_0x5889c0){if(_0x5889c0){var _0x3d0eee=typeof _0x13ef33['offset']===_0x3bce('0x1b')&&typeof _0x13ef33['limit']===_0x3bce('0x1b');var _0x2007d3=_0x5889c0[_0x3bce('0x1c')];var _0x4e4fbd=_0x3d0eee?0x0:_0x13ef33[_0x3bce('0x1d')];var _0x22df56=_0x3d0eee?_0x5889c0[_0x3bce('0x1c')]:_0x13ef33[_0x3bce('0x1d')]+_0x13ef33[_0x3bce('0x1e')];var _0x18234b;if(_0x22df56>=_0x2007d3){_0x22df56=_0x2007d3;_0x18234b=0xc8;}else{_0x18234b=0xce;}_0x44e6e8['status'](_0x18234b);return _0x44e6e8[_0x3bce('0x1f')](_0x3bce('0x20'),_0x4e4fbd+'-'+_0x22df56+'/'+_0x2007d3)[_0x3bce('0x1a')](_0x5889c0);}return null;};}function patchUpdates(_0x9cdc23){return function(_0x55d321){try{jsonpatch['apply'](_0x55d321,_0x9cdc23,!![]);}catch(_0x5794e7){return BPromise[_0x3bce('0x21')](_0x5794e7);}return _0x55d321[_0x3bce('0x22')]();};}function saveUpdates(_0x19017f,_0xd8cf06){return function(_0x2cdef2){if(_0x2cdef2){return _0x2cdef2[_0x3bce('0x23')](_0x19017f)[_0x3bce('0x24')](function(_0x454733){return _0x454733;});}return null;};}function removeEntity(_0x590cdb,_0x3a23fd){return function(_0x2b0ce3){if(_0x2b0ce3){return _0x2b0ce3['destroy']()[_0x3bce('0x24')](function(){_0x590cdb[_0x3bce('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4dcf4a,_0x35ceea){return function(_0x302530){if(!_0x302530){_0x4dcf4a[_0x3bce('0x17')](0x194);}return _0x302530;};}function handleError(_0x10b8b2,_0x3136e1){_0x3136e1=_0x3136e1||0x1f4;return function(_0x1f0665){logger['error'](_0x1f0665[_0x3bce('0x25')]);if(_0x1f0665['name']){delete _0x1f0665['name'];}_0x10b8b2[_0x3bce('0x18')](_0x3136e1)[_0x3bce('0x26')](_0x1f0665);};}exports['index']=function(_0x48185d,_0x296977){var _0x30d851={},_0x3ff76c={},_0x25361d={'count':0x0,'rows':[]};var _0x486ce5=_[_0x3bce('0x27')](db[_0x3bce('0x28')]['rawAttributes'],function(_0x5e09a5){return{'name':_0x5e09a5['fieldName'],'type':_0x5e09a5[_0x3bce('0x29')][_0x3bce('0x2a')]};});_0x3ff76c[_0x3bce('0x2b')]=_[_0x3bce('0x27')](_0x486ce5,'name');_0x3ff76c[_0x3bce('0x2c')]=_[_0x3bce('0x2d')](_0x48185d['query']);_0x3ff76c[_0x3bce('0x2e')]=_[_0x3bce('0x2f')](_0x3ff76c[_0x3bce('0x2b')],_0x3ff76c[_0x3bce('0x2c')]);_0x30d851[_0x3bce('0x30')]=_[_0x3bce('0x2f')](_0x3ff76c[_0x3bce('0x2b')],qs['fields'](_0x48185d[_0x3bce('0x2c')][_0x3bce('0x31')]));_0x30d851[_0x3bce('0x30')]=_0x30d851[_0x3bce('0x30')][_0x3bce('0x32')]?_0x30d851[_0x3bce('0x30')]:_0x3ff76c[_0x3bce('0x2b')];if(!_0x48185d[_0x3bce('0x2c')]['hasOwnProperty'](_0x3bce('0x33'))){_0x30d851[_0x3bce('0x1e')]=qs[_0x3bce('0x1e')](_0x48185d['query'][_0x3bce('0x1e')]);_0x30d851[_0x3bce('0x1d')]=qs[_0x3bce('0x1d')](_0x48185d[_0x3bce('0x2c')][_0x3bce('0x1d')]);}_0x30d851[_0x3bce('0x34')]=qs[_0x3bce('0x35')](_0x48185d[_0x3bce('0x2c')][_0x3bce('0x35')]);_0x30d851[_0x3bce('0x36')]=qs[_0x3bce('0x2e')](_['pick'](_0x48185d[_0x3bce('0x2c')],_0x3ff76c[_0x3bce('0x2e')]),_0x486ce5);if(_0x48185d['query'][_0x3bce('0x37')]){_0x30d851[_0x3bce('0x36')]=_[_0x3bce('0x38')](_0x30d851['where'],{'$or':_[_0x3bce('0x27')](_0x486ce5,function(_0xc834ec){if(_0xc834ec['type']!==_0x3bce('0x39')){var _0x133c1c={};_0x133c1c[_0xc834ec[_0x3bce('0x3a')]]={'$like':'%'+_0x48185d[_0x3bce('0x2c')][_0x3bce('0x37')]+'%'};return _0x133c1c;}})});}_0x30d851=_[_0x3bce('0x38')]({},_0x30d851,_0x48185d[_0x3bce('0x3b')]);var _0x2d179f={'where':_0x30d851['where']};return db[_0x3bce('0x28')][_0x3bce('0x1c')](_0x2d179f)[_0x3bce('0x24')](function(_0x479e4d){_0x25361d['count']=_0x479e4d;if(_0x48185d['query'][_0x3bce('0x3c')]){_0x30d851[_0x3bce('0x3d')]=[{'all':!![]}];}return db[_0x3bce('0x28')]['findAll'](_0x30d851);})[_0x3bce('0x24')](function(_0x4a9291){_0x25361d[_0x3bce('0x3e')]=_0x4a9291;return _0x25361d;})[_0x3bce('0x24')](respondWithFilteredResult(_0x296977,_0x30d851))[_0x3bce('0x3f')](handleError(_0x296977,null));};exports['show']=function(_0x4e5a10,_0x153157){var _0x1fc71c={'raw':![],'where':{'id':_0x4e5a10[_0x3bce('0x40')]['id']}},_0x472774={};_0x472774['model']=_['keys'](db[_0x3bce('0x28')]['rawAttributes']);_0x472774[_0x3bce('0x2c')]=_[_0x3bce('0x2d')](_0x4e5a10[_0x3bce('0x2c')]);_0x472774[_0x3bce('0x2e')]=_[_0x3bce('0x2f')](_0x472774['model'],_0x472774[_0x3bce('0x2c')]);_0x1fc71c['attributes']=_[_0x3bce('0x2f')](_0x472774[_0x3bce('0x2b')],qs[_0x3bce('0x31')](_0x4e5a10[_0x3bce('0x2c')][_0x3bce('0x31')]));_0x1fc71c['attributes']=_0x1fc71c[_0x3bce('0x30')][_0x3bce('0x32')]?_0x1fc71c['attributes']:_0x472774['model'];if(_0x4e5a10[_0x3bce('0x2c')][_0x3bce('0x3c')]){_0x1fc71c['include']=[{'all':!![]}];}_0x1fc71c=_[_0x3bce('0x38')]({},_0x1fc71c,_0x4e5a10[_0x3bce('0x3b')]);return db['ServicenowConfiguration']['find'](_0x1fc71c)[_0x3bce('0x24')](handleEntityNotFound(_0x153157,null))[_0x3bce('0x24')](respondWithResult(_0x153157,null))[_0x3bce('0x3f')](handleError(_0x153157,null));};exports['create']=function(_0x55f958,_0x329021){return db[_0x3bce('0x28')][_0x3bce('0x41')](_0x55f958[_0x3bce('0x42')],{})[_0x3bce('0x24')](respondWithResult(_0x329021,0xc9))[_0x3bce('0x3f')](handleError(_0x329021,null));};exports[_0x3bce('0x23')]=function(_0x432dd1,_0x37d228){if(_0x432dd1['body']['id']){delete _0x432dd1[_0x3bce('0x42')]['id'];}return db[_0x3bce('0x28')][_0x3bce('0x43')]({'where':{'id':_0x432dd1['params']['id']}})['then'](handleEntityNotFound(_0x37d228,null))[_0x3bce('0x24')](saveUpdates(_0x432dd1[_0x3bce('0x42')],null))['then'](respondWithResult(_0x37d228,null))['catch'](handleError(_0x37d228,null));};exports[_0x3bce('0x44')]=function(_0xc40162,_0x52fac3){return db[_0x3bce('0x28')][_0x3bce('0x43')]({'where':{'id':_0xc40162[_0x3bce('0x40')]['id']}})['then'](handleEntityNotFound(_0x52fac3,null))['then'](removeEntity(_0x52fac3,null))[_0x3bce('0x3f')](handleError(_0x52fac3,null));};exports['getFields']=function(_0x1c4887,_0x183c4e,_0x4a5b95){var _0x82cb3a={};var _0x2ce9b2={};var _0x21576c;var _0x92fde3;return db['ServicenowConfiguration'][_0x3bce('0x45')]({'where':{'id':_0x1c4887['params']['id']}})[_0x3bce('0x24')](handleEntityNotFound(_0x183c4e,null))['then'](function(_0x3b6ece){if(_0x3b6ece){_0x21576c=_0x3b6ece;_0x2ce9b2[_0x3bce('0x2b')]=_[_0x3bce('0x2d')](db['ServicenowField'][_0x3bce('0x46')]);_0x2ce9b2[_0x3bce('0x2c')]=_['keys'](_0x1c4887[_0x3bce('0x2c')]);_0x2ce9b2[_0x3bce('0x2e')]=_[_0x3bce('0x2f')](_0x2ce9b2[_0x3bce('0x2b')],_0x2ce9b2[_0x3bce('0x2c')]);_0x82cb3a[_0x3bce('0x30')]=_[_0x3bce('0x2f')](_0x2ce9b2['model'],qs[_0x3bce('0x31')](_0x1c4887[_0x3bce('0x2c')]['fields']));_0x82cb3a[_0x3bce('0x30')]=_0x82cb3a[_0x3bce('0x30')][_0x3bce('0x32')]?_0x82cb3a[_0x3bce('0x30')]:_0x2ce9b2[_0x3bce('0x2b')];_0x82cb3a[_0x3bce('0x34')]=qs[_0x3bce('0x35')](_0x1c4887[_0x3bce('0x2c')]['sort']);_0x82cb3a[_0x3bce('0x36')]=qs['filters'](_[_0x3bce('0x47')](_0x1c4887[_0x3bce('0x2c')],_0x2ce9b2[_0x3bce('0x2e')]));if(_0x1c4887['query'][_0x3bce('0x37')]){_0x82cb3a[_0x3bce('0x36')]=_[_0x3bce('0x38')](_0x82cb3a[_0x3bce('0x36')],{'$or':_[_0x3bce('0x27')](_0x82cb3a[_0x3bce('0x30')],function(_0x1f2b4e){var _0x1ebb5b={};_0x1ebb5b[_0x1f2b4e]={'$like':'%'+_0x1c4887['query'][_0x3bce('0x37')]+'%'};return _0x1ebb5b;})});}_0x82cb3a=_[_0x3bce('0x38')]({},_0x82cb3a,_0x1c4887['options']);return _0x21576c['getFields'](_0x82cb3a);}})[_0x3bce('0x24')](function(_0x4e9823){if(_0x4e9823){_0x92fde3=_0x4e9823['length'];if(!_0x1c4887[_0x3bce('0x2c')][_0x3bce('0x48')](_0x3bce('0x33'))){_0x82cb3a[_0x3bce('0x1e')]=qs[_0x3bce('0x1e')](_0x1c4887['query'][_0x3bce('0x1e')]);_0x82cb3a[_0x3bce('0x1d')]=qs[_0x3bce('0x1d')](_0x1c4887[_0x3bce('0x2c')][_0x3bce('0x1d')]);}return _0x21576c[_0x3bce('0x49')](_0x82cb3a);}})['then'](function(_0x197f32){if(_0x197f32){return _0x197f32?{'count':_0x92fde3,'rows':_0x197f32}:null;}})[_0x3bce('0x24')](respondWithResult(_0x183c4e,null))[_0x3bce('0x3f')](handleError(_0x183c4e,null));};exports[_0x3bce('0x4a')]=function(_0x3d1858,_0x3bd2d9,_0x28759a){var _0x3defce={};var _0x157e82={};var _0x264e91;var _0x152931;return db[_0x3bce('0x28')][_0x3bce('0x45')]({'where':{'id':_0x3d1858[_0x3bce('0x40')]['id']}})['then'](handleEntityNotFound(_0x3bd2d9,null))[_0x3bce('0x24')](function(_0xc34ca3){if(_0xc34ca3){_0x264e91=_0xc34ca3;_0x157e82['model']=_['keys'](db[_0x3bce('0x4b')][_0x3bce('0x46')]);_0x157e82[_0x3bce('0x2c')]=_[_0x3bce('0x2d')](_0x3d1858[_0x3bce('0x2c')]);_0x157e82[_0x3bce('0x2e')]=_[_0x3bce('0x2f')](_0x157e82[_0x3bce('0x2b')],_0x157e82[_0x3bce('0x2c')]);_0x3defce[_0x3bce('0x30')]=_[_0x3bce('0x2f')](_0x157e82['model'],qs[_0x3bce('0x31')](_0x3d1858[_0x3bce('0x2c')]['fields']));_0x3defce[_0x3bce('0x30')]=_0x3defce[_0x3bce('0x30')][_0x3bce('0x32')]?_0x3defce['attributes']:_0x157e82[_0x3bce('0x2b')];_0x3defce[_0x3bce('0x34')]=qs[_0x3bce('0x35')](_0x3d1858['query'][_0x3bce('0x35')]);_0x3defce[_0x3bce('0x36')]=qs[_0x3bce('0x2e')](_['pick'](_0x3d1858['query'],_0x157e82['filters']));if(_0x3d1858['query'][_0x3bce('0x37')]){_0x3defce[_0x3bce('0x36')]=_[_0x3bce('0x38')](_0x3defce[_0x3bce('0x36')],{'$or':_[_0x3bce('0x27')](_0x3defce[_0x3bce('0x30')],function(_0x4fd4fa){var _0x5e5e79={};_0x5e5e79[_0x4fd4fa]={'$like':'%'+_0x3d1858['query']['filter']+'%'};return _0x5e5e79;})});}_0x3defce=_[_0x3bce('0x38')]({},_0x3defce,_0x3d1858['options']);return _0x264e91[_0x3bce('0x4a')](_0x3defce);}})['then'](function(_0x11f46d){if(_0x11f46d){_0x152931=_0x11f46d['length'];if(!_0x3d1858[_0x3bce('0x2c')][_0x3bce('0x48')]('nolimit')){_0x3defce[_0x3bce('0x1e')]=qs[_0x3bce('0x1e')](_0x3d1858[_0x3bce('0x2c')][_0x3bce('0x1e')]);_0x3defce['offset']=qs[_0x3bce('0x1d')](_0x3d1858['query'][_0x3bce('0x1d')]);}return _0x264e91['getSubjects'](_0x3defce);}})['then'](function(_0x3eddaf){if(_0x3eddaf){return _0x3eddaf?{'count':_0x152931,'rows':_0x3eddaf}:null;}})[_0x3bce('0x24')](respondWithResult(_0x3bd2d9,null))[_0x3bce('0x3f')](handleError(_0x3bd2d9,null));};exports[_0x3bce('0x4c')]=function(_0x339e72,_0x4b441f,_0x40b0dc){var _0x415d0e={};var _0x2d6903={};var _0x221800;var _0x87ae02;return db[_0x3bce('0x28')][_0x3bce('0x45')]({'where':{'id':_0x339e72[_0x3bce('0x40')]['id']}})[_0x3bce('0x24')](handleEntityNotFound(_0x4b441f,null))['then'](function(_0xdccb1b){if(_0xdccb1b){_0x221800=_0xdccb1b;_0x2d6903[_0x3bce('0x2b')]=_[_0x3bce('0x2d')](db['ServicenowField'][_0x3bce('0x46')]);_0x2d6903[_0x3bce('0x2c')]=_[_0x3bce('0x2d')](_0x339e72[_0x3bce('0x2c')]);_0x2d6903[_0x3bce('0x2e')]=_[_0x3bce('0x2f')](_0x2d6903[_0x3bce('0x2b')],_0x2d6903[_0x3bce('0x2c')]);_0x415d0e[_0x3bce('0x30')]=_[_0x3bce('0x2f')](_0x2d6903[_0x3bce('0x2b')],qs[_0x3bce('0x31')](_0x339e72[_0x3bce('0x2c')][_0x3bce('0x31')]));_0x415d0e[_0x3bce('0x30')]=_0x415d0e[_0x3bce('0x30')][_0x3bce('0x32')]?_0x415d0e[_0x3bce('0x30')]:_0x2d6903[_0x3bce('0x2b')];_0x415d0e[_0x3bce('0x34')]=qs['sort'](_0x339e72[_0x3bce('0x2c')][_0x3bce('0x35')]);_0x415d0e[_0x3bce('0x36')]=qs[_0x3bce('0x2e')](_[_0x3bce('0x47')](_0x339e72['query'],_0x2d6903['filters']));if(_0x339e72['query'][_0x3bce('0x37')]){_0x415d0e[_0x3bce('0x36')]=_[_0x3bce('0x38')](_0x415d0e[_0x3bce('0x36')],{'$or':_['map'](_0x415d0e[_0x3bce('0x30')],function(_0x279e16){var _0x4f9c0c={};_0x4f9c0c[_0x279e16]={'$like':'%'+_0x339e72[_0x3bce('0x2c')][_0x3bce('0x37')]+'%'};return _0x4f9c0c;})});}_0x415d0e=_[_0x3bce('0x38')]({},_0x415d0e,_0x339e72[_0x3bce('0x3b')]);return _0x221800['getDescriptions'](_0x415d0e);}})[_0x3bce('0x24')](function(_0x3559c4){if(_0x3559c4){_0x87ae02=_0x3559c4[_0x3bce('0x32')];if(!_0x339e72[_0x3bce('0x2c')]['hasOwnProperty'](_0x3bce('0x33'))){_0x415d0e[_0x3bce('0x1e')]=qs[_0x3bce('0x1e')](_0x339e72[_0x3bce('0x2c')][_0x3bce('0x1e')]);_0x415d0e[_0x3bce('0x1d')]=qs[_0x3bce('0x1d')](_0x339e72['query']['offset']);}return _0x221800[_0x3bce('0x4c')](_0x415d0e);}})[_0x3bce('0x24')](function(_0x4e2008){if(_0x4e2008){return _0x4e2008?{'count':_0x87ae02,'rows':_0x4e2008}:null;}})[_0x3bce('0x24')](respondWithResult(_0x4b441f,null))[_0x3bce('0x3f')](handleError(_0x4b441f,null));}; \ No newline at end of file +var _0x6ed6=['rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','find','create','body','params','getFields','findOne','ServicenowField','getSubjects','getDescriptions','rimraf','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','save','update','destroy','then','error','stack','name','index','map','ServicenowConfiguration'];(function(_0x50d2db,_0x47481f){var _0x1c7e27=function(_0x1f669d){while(--_0x1f669d){_0x50d2db['push'](_0x50d2db['shift']());}};_0x1c7e27(++_0x47481f);}(_0x6ed6,0x10c));var _0x66ed=function(_0x51d5be,_0x5737de){_0x51d5be=_0x51d5be-0x0;var _0x48d9f9=_0x6ed6[_0x51d5be];return _0x48d9f9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x66ed('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x66ed('0x1'));var rp=require('request-promise');var moment=require(_0x66ed('0x2'));var BPromise=require(_0x66ed('0x3'));var Mustache=require('mustache');var util=require(_0x66ed('0x4'));var path=require(_0x66ed('0x5'));var sox=require(_0x66ed('0x6'));var csv=require('to-csv');var ejs=require(_0x66ed('0x7'));var fs=require('fs');var fs_extra=require(_0x66ed('0x8'));var _=require(_0x66ed('0x9'));var squel=require(_0x66ed('0xa'));var crypto=require(_0x66ed('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x66ed('0xc'));var toCsv=require(_0x66ed('0xd'));var querystring=require(_0x66ed('0xe'));var Papa=require(_0x66ed('0xf'));var Redis=require(_0x66ed('0x10'));var authService=require(_0x66ed('0x11'));var qs=require(_0x66ed('0x12'));var as=require(_0x66ed('0x13'));var hardwareService=require(_0x66ed('0x14'));var logger=require(_0x66ed('0x15'))(_0x66ed('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x66ed('0x17'))['db'];function respondWithStatusCode(_0x57f577,_0x5ec338){_0x5ec338=_0x5ec338||0xcc;return function(_0x3c441d){if(_0x3c441d){return _0x57f577[_0x66ed('0x18')](_0x5ec338);}return _0x57f577[_0x66ed('0x19')](_0x5ec338)[_0x66ed('0x1a')]();};}function respondWithResult(_0x5b62d6,_0x1b488a){_0x1b488a=_0x1b488a||0xc8;return function(_0x796b1f){if(_0x796b1f){return _0x5b62d6[_0x66ed('0x19')](_0x1b488a)['json'](_0x796b1f);}};}function respondWithFilteredResult(_0xe98eb7,_0x3393d7){return function(_0x46239f){if(_0x46239f){var _0x42671c=typeof _0x3393d7[_0x66ed('0x1b')]===_0x66ed('0x1c')&&typeof _0x3393d7['limit']==='undefined';var _0x32c06b=_0x46239f[_0x66ed('0x1d')];var _0x24580c=_0x42671c?0x0:_0x3393d7[_0x66ed('0x1b')];var _0x5f4b27=_0x42671c?_0x46239f[_0x66ed('0x1d')]:_0x3393d7['offset']+_0x3393d7[_0x66ed('0x1e')];var _0xa1cc43;if(_0x5f4b27>=_0x32c06b){_0x5f4b27=_0x32c06b;_0xa1cc43=0xc8;}else{_0xa1cc43=0xce;}_0xe98eb7['status'](_0xa1cc43);return _0xe98eb7[_0x66ed('0x1f')](_0x66ed('0x20'),_0x24580c+'-'+_0x5f4b27+'/'+_0x32c06b)[_0x66ed('0x21')](_0x46239f);}return null;};}function patchUpdates(_0x395761){return function(_0x374534){try{jsonpatch['apply'](_0x374534,_0x395761,!![]);}catch(_0x5cb42a){return BPromise['reject'](_0x5cb42a);}return _0x374534[_0x66ed('0x22')]();};}function saveUpdates(_0x49b48f,_0x38f4fa){return function(_0x1b1261){if(_0x1b1261){return _0x1b1261[_0x66ed('0x23')](_0x49b48f)['then'](function(_0x2a63b6){return _0x2a63b6;});}return null;};}function removeEntity(_0xa75800,_0x522c18){return function(_0x4758ef){if(_0x4758ef){return _0x4758ef[_0x66ed('0x24')]()[_0x66ed('0x25')](function(){_0xa75800[_0x66ed('0x19')](0xcc)[_0x66ed('0x1a')]();});}};}function handleEntityNotFound(_0x5ad5b1,_0x2f3158){return function(_0x29c554){if(!_0x29c554){_0x5ad5b1[_0x66ed('0x18')](0x194);}return _0x29c554;};}function handleError(_0x4028e1,_0x1186b3){_0x1186b3=_0x1186b3||0x1f4;return function(_0x3773c8){logger[_0x66ed('0x26')](_0x3773c8[_0x66ed('0x27')]);if(_0x3773c8[_0x66ed('0x28')]){delete _0x3773c8[_0x66ed('0x28')];}_0x4028e1[_0x66ed('0x19')](_0x1186b3)['send'](_0x3773c8);};}exports[_0x66ed('0x29')]=function(_0x421dc8,_0xbef047){var _0x4a348f={},_0x5c154e={},_0x335515={'count':0x0,'rows':[]};var _0x4c3b7a=_[_0x66ed('0x2a')](db[_0x66ed('0x2b')][_0x66ed('0x2c')],function(_0xa6ad7a){return{'name':_0xa6ad7a[_0x66ed('0x2d')],'type':_0xa6ad7a[_0x66ed('0x2e')]['key']};});_0x5c154e[_0x66ed('0x2f')]=_[_0x66ed('0x2a')](_0x4c3b7a,_0x66ed('0x28'));_0x5c154e[_0x66ed('0x30')]=_[_0x66ed('0x31')](_0x421dc8['query']);_0x5c154e[_0x66ed('0x32')]=_[_0x66ed('0x33')](_0x5c154e[_0x66ed('0x2f')],_0x5c154e[_0x66ed('0x30')]);_0x4a348f[_0x66ed('0x34')]=_['intersection'](_0x5c154e['model'],qs[_0x66ed('0x35')](_0x421dc8[_0x66ed('0x30')][_0x66ed('0x35')]));_0x4a348f[_0x66ed('0x34')]=_0x4a348f[_0x66ed('0x34')][_0x66ed('0x36')]?_0x4a348f['attributes']:_0x5c154e[_0x66ed('0x2f')];if(!_0x421dc8['query'][_0x66ed('0x37')](_0x66ed('0x38'))){_0x4a348f['limit']=qs[_0x66ed('0x1e')](_0x421dc8[_0x66ed('0x30')][_0x66ed('0x1e')]);_0x4a348f[_0x66ed('0x1b')]=qs['offset'](_0x421dc8[_0x66ed('0x30')][_0x66ed('0x1b')]);}_0x4a348f[_0x66ed('0x39')]=qs[_0x66ed('0x3a')](_0x421dc8[_0x66ed('0x30')][_0x66ed('0x3a')]);_0x4a348f[_0x66ed('0x3b')]=qs[_0x66ed('0x32')](_[_0x66ed('0x3c')](_0x421dc8[_0x66ed('0x30')],_0x5c154e[_0x66ed('0x32')]),_0x4c3b7a);if(_0x421dc8[_0x66ed('0x30')][_0x66ed('0x3d')]){_0x4a348f[_0x66ed('0x3b')]=_[_0x66ed('0x3e')](_0x4a348f[_0x66ed('0x3b')],{'$or':_['map'](_0x4c3b7a,function(_0x1510b9){if(_0x1510b9[_0x66ed('0x2e')]!==_0x66ed('0x3f')){var _0x30888d={};_0x30888d[_0x1510b9['name']]={'$like':'%'+_0x421dc8[_0x66ed('0x30')][_0x66ed('0x3d')]+'%'};return _0x30888d;}})});}_0x4a348f=_['merge']({},_0x4a348f,_0x421dc8[_0x66ed('0x40')]);var _0x154377={'where':_0x4a348f[_0x66ed('0x3b')]};return db[_0x66ed('0x2b')][_0x66ed('0x1d')](_0x154377)[_0x66ed('0x25')](function(_0x520420){_0x335515[_0x66ed('0x1d')]=_0x520420;if(_0x421dc8[_0x66ed('0x30')]['includeAll']){_0x4a348f[_0x66ed('0x41')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x66ed('0x42')](_0x4a348f);})[_0x66ed('0x25')](function(_0x27d6c2){_0x335515[_0x66ed('0x43')]=_0x27d6c2;return _0x335515;})[_0x66ed('0x25')](respondWithFilteredResult(_0xbef047,_0x4a348f))[_0x66ed('0x44')](handleError(_0xbef047,null));};exports['show']=function(_0x372a21,_0x1867e0){var _0x1852fb={'raw':![],'where':{'id':_0x372a21['params']['id']}},_0x11ad8e={};_0x11ad8e[_0x66ed('0x2f')]=_[_0x66ed('0x31')](db[_0x66ed('0x2b')][_0x66ed('0x2c')]);_0x11ad8e[_0x66ed('0x30')]=_['keys'](_0x372a21[_0x66ed('0x30')]);_0x11ad8e[_0x66ed('0x32')]=_[_0x66ed('0x33')](_0x11ad8e[_0x66ed('0x2f')],_0x11ad8e['query']);_0x1852fb[_0x66ed('0x34')]=_[_0x66ed('0x33')](_0x11ad8e[_0x66ed('0x2f')],qs[_0x66ed('0x35')](_0x372a21[_0x66ed('0x30')][_0x66ed('0x35')]));_0x1852fb[_0x66ed('0x34')]=_0x1852fb[_0x66ed('0x34')][_0x66ed('0x36')]?_0x1852fb[_0x66ed('0x34')]:_0x11ad8e[_0x66ed('0x2f')];if(_0x372a21[_0x66ed('0x30')]['includeAll']){_0x1852fb[_0x66ed('0x41')]=[{'all':!![]}];}_0x1852fb=_[_0x66ed('0x3e')]({},_0x1852fb,_0x372a21[_0x66ed('0x40')]);return db[_0x66ed('0x2b')][_0x66ed('0x45')](_0x1852fb)[_0x66ed('0x25')](handleEntityNotFound(_0x1867e0,null))['then'](respondWithResult(_0x1867e0,null))['catch'](handleError(_0x1867e0,null));};exports[_0x66ed('0x46')]=function(_0x3790b9,_0x410017){return db[_0x66ed('0x2b')][_0x66ed('0x46')](_0x3790b9[_0x66ed('0x47')],{})[_0x66ed('0x25')](respondWithResult(_0x410017,0xc9))['catch'](handleError(_0x410017,null));};exports[_0x66ed('0x23')]=function(_0xeb64a8,_0x5a2540){if(_0xeb64a8[_0x66ed('0x47')]['id']){delete _0xeb64a8[_0x66ed('0x47')]['id'];}return db['ServicenowConfiguration'][_0x66ed('0x45')]({'where':{'id':_0xeb64a8[_0x66ed('0x48')]['id']}})[_0x66ed('0x25')](handleEntityNotFound(_0x5a2540,null))[_0x66ed('0x25')](saveUpdates(_0xeb64a8[_0x66ed('0x47')],null))[_0x66ed('0x25')](respondWithResult(_0x5a2540,null))[_0x66ed('0x44')](handleError(_0x5a2540,null));};exports['destroy']=function(_0x35fa92,_0x3dedb6){return db['ServicenowConfiguration'][_0x66ed('0x45')]({'where':{'id':_0x35fa92[_0x66ed('0x48')]['id']}})[_0x66ed('0x25')](handleEntityNotFound(_0x3dedb6,null))[_0x66ed('0x25')](removeEntity(_0x3dedb6,null))[_0x66ed('0x44')](handleError(_0x3dedb6,null));};exports[_0x66ed('0x49')]=function(_0xe172c6,_0x3d31e9,_0x17e657){var _0x3500fe={};var _0x4da8ed={};var _0xed47b6;var _0xf075cb;return db[_0x66ed('0x2b')][_0x66ed('0x4a')]({'where':{'id':_0xe172c6[_0x66ed('0x48')]['id']}})[_0x66ed('0x25')](handleEntityNotFound(_0x3d31e9,null))[_0x66ed('0x25')](function(_0x291cba){if(_0x291cba){_0xed47b6=_0x291cba;_0x4da8ed[_0x66ed('0x2f')]=_[_0x66ed('0x31')](db['ServicenowField']['rawAttributes']);_0x4da8ed[_0x66ed('0x30')]=_['keys'](_0xe172c6['query']);_0x4da8ed[_0x66ed('0x32')]=_['intersection'](_0x4da8ed[_0x66ed('0x2f')],_0x4da8ed['query']);_0x3500fe[_0x66ed('0x34')]=_['intersection'](_0x4da8ed['model'],qs[_0x66ed('0x35')](_0xe172c6[_0x66ed('0x30')][_0x66ed('0x35')]));_0x3500fe[_0x66ed('0x34')]=_0x3500fe[_0x66ed('0x34')][_0x66ed('0x36')]?_0x3500fe[_0x66ed('0x34')]:_0x4da8ed[_0x66ed('0x2f')];_0x3500fe[_0x66ed('0x39')]=qs['sort'](_0xe172c6['query'][_0x66ed('0x3a')]);_0x3500fe['where']=qs[_0x66ed('0x32')](_[_0x66ed('0x3c')](_0xe172c6[_0x66ed('0x30')],_0x4da8ed['filters']));if(_0xe172c6['query'][_0x66ed('0x3d')]){_0x3500fe[_0x66ed('0x3b')]=_[_0x66ed('0x3e')](_0x3500fe[_0x66ed('0x3b')],{'$or':_[_0x66ed('0x2a')](_0x3500fe[_0x66ed('0x34')],function(_0x35363d){var _0x2226c7={};_0x2226c7[_0x35363d]={'$like':'%'+_0xe172c6[_0x66ed('0x30')]['filter']+'%'};return _0x2226c7;})});}_0x3500fe=_[_0x66ed('0x3e')]({},_0x3500fe,_0xe172c6['options']);return _0xed47b6[_0x66ed('0x49')](_0x3500fe);}})['then'](function(_0x3e5898){if(_0x3e5898){_0xf075cb=_0x3e5898[_0x66ed('0x36')];if(!_0xe172c6[_0x66ed('0x30')]['hasOwnProperty'](_0x66ed('0x38'))){_0x3500fe[_0x66ed('0x1e')]=qs[_0x66ed('0x1e')](_0xe172c6[_0x66ed('0x30')][_0x66ed('0x1e')]);_0x3500fe[_0x66ed('0x1b')]=qs[_0x66ed('0x1b')](_0xe172c6[_0x66ed('0x30')][_0x66ed('0x1b')]);}return _0xed47b6[_0x66ed('0x49')](_0x3500fe);}})['then'](function(_0x293ea7){if(_0x293ea7){return _0x293ea7?{'count':_0xf075cb,'rows':_0x293ea7}:null;}})['then'](respondWithResult(_0x3d31e9,null))['catch'](handleError(_0x3d31e9,null));};exports['getSubjects']=function(_0x22ecc1,_0x57b7ce,_0x3995c4){var _0x8d1ac7={};var _0x288894={};var _0x1fcecf;var _0x407184;return db[_0x66ed('0x2b')][_0x66ed('0x4a')]({'where':{'id':_0x22ecc1[_0x66ed('0x48')]['id']}})[_0x66ed('0x25')](handleEntityNotFound(_0x57b7ce,null))[_0x66ed('0x25')](function(_0x349201){if(_0x349201){_0x1fcecf=_0x349201;_0x288894[_0x66ed('0x2f')]=_[_0x66ed('0x31')](db[_0x66ed('0x4b')][_0x66ed('0x2c')]);_0x288894[_0x66ed('0x30')]=_['keys'](_0x22ecc1[_0x66ed('0x30')]);_0x288894[_0x66ed('0x32')]=_[_0x66ed('0x33')](_0x288894[_0x66ed('0x2f')],_0x288894[_0x66ed('0x30')]);_0x8d1ac7[_0x66ed('0x34')]=_[_0x66ed('0x33')](_0x288894[_0x66ed('0x2f')],qs['fields'](_0x22ecc1[_0x66ed('0x30')]['fields']));_0x8d1ac7[_0x66ed('0x34')]=_0x8d1ac7[_0x66ed('0x34')][_0x66ed('0x36')]?_0x8d1ac7[_0x66ed('0x34')]:_0x288894[_0x66ed('0x2f')];_0x8d1ac7[_0x66ed('0x39')]=qs['sort'](_0x22ecc1['query']['sort']);_0x8d1ac7[_0x66ed('0x3b')]=qs[_0x66ed('0x32')](_['pick'](_0x22ecc1[_0x66ed('0x30')],_0x288894[_0x66ed('0x32')]));if(_0x22ecc1[_0x66ed('0x30')][_0x66ed('0x3d')]){_0x8d1ac7[_0x66ed('0x3b')]=_[_0x66ed('0x3e')](_0x8d1ac7[_0x66ed('0x3b')],{'$or':_['map'](_0x8d1ac7['attributes'],function(_0x3ddbd8){var _0x522fa4={};_0x522fa4[_0x3ddbd8]={'$like':'%'+_0x22ecc1['query'][_0x66ed('0x3d')]+'%'};return _0x522fa4;})});}_0x8d1ac7=_[_0x66ed('0x3e')]({},_0x8d1ac7,_0x22ecc1[_0x66ed('0x40')]);return _0x1fcecf[_0x66ed('0x4c')](_0x8d1ac7);}})[_0x66ed('0x25')](function(_0x360096){if(_0x360096){_0x407184=_0x360096['length'];if(!_0x22ecc1[_0x66ed('0x30')][_0x66ed('0x37')](_0x66ed('0x38'))){_0x8d1ac7[_0x66ed('0x1e')]=qs[_0x66ed('0x1e')](_0x22ecc1[_0x66ed('0x30')]['limit']);_0x8d1ac7[_0x66ed('0x1b')]=qs['offset'](_0x22ecc1[_0x66ed('0x30')][_0x66ed('0x1b')]);}return _0x1fcecf[_0x66ed('0x4c')](_0x8d1ac7);}})['then'](function(_0x1a1390){if(_0x1a1390){return _0x1a1390?{'count':_0x407184,'rows':_0x1a1390}:null;}})[_0x66ed('0x25')](respondWithResult(_0x57b7ce,null))['catch'](handleError(_0x57b7ce,null));};exports[_0x66ed('0x4d')]=function(_0xfa26a8,_0x5f5c1f,_0x591afc){var _0x574323={};var _0x1ab16d={};var _0xe451a6;var _0x5e2cbf;return db[_0x66ed('0x2b')][_0x66ed('0x4a')]({'where':{'id':_0xfa26a8[_0x66ed('0x48')]['id']}})[_0x66ed('0x25')](handleEntityNotFound(_0x5f5c1f,null))[_0x66ed('0x25')](function(_0x281e2c){if(_0x281e2c){_0xe451a6=_0x281e2c;_0x1ab16d['model']=_[_0x66ed('0x31')](db[_0x66ed('0x4b')][_0x66ed('0x2c')]);_0x1ab16d[_0x66ed('0x30')]=_[_0x66ed('0x31')](_0xfa26a8['query']);_0x1ab16d[_0x66ed('0x32')]=_['intersection'](_0x1ab16d[_0x66ed('0x2f')],_0x1ab16d[_0x66ed('0x30')]);_0x574323['attributes']=_['intersection'](_0x1ab16d[_0x66ed('0x2f')],qs[_0x66ed('0x35')](_0xfa26a8['query'][_0x66ed('0x35')]));_0x574323[_0x66ed('0x34')]=_0x574323[_0x66ed('0x34')][_0x66ed('0x36')]?_0x574323['attributes']:_0x1ab16d['model'];_0x574323['order']=qs[_0x66ed('0x3a')](_0xfa26a8[_0x66ed('0x30')][_0x66ed('0x3a')]);_0x574323[_0x66ed('0x3b')]=qs[_0x66ed('0x32')](_[_0x66ed('0x3c')](_0xfa26a8[_0x66ed('0x30')],_0x1ab16d[_0x66ed('0x32')]));if(_0xfa26a8[_0x66ed('0x30')][_0x66ed('0x3d')]){_0x574323[_0x66ed('0x3b')]=_[_0x66ed('0x3e')](_0x574323[_0x66ed('0x3b')],{'$or':_[_0x66ed('0x2a')](_0x574323[_0x66ed('0x34')],function(_0x5267f8){var _0x3b9e9d={};_0x3b9e9d[_0x5267f8]={'$like':'%'+_0xfa26a8[_0x66ed('0x30')][_0x66ed('0x3d')]+'%'};return _0x3b9e9d;})});}_0x574323=_[_0x66ed('0x3e')]({},_0x574323,_0xfa26a8[_0x66ed('0x40')]);return _0xe451a6[_0x66ed('0x4d')](_0x574323);}})[_0x66ed('0x25')](function(_0x693132){if(_0x693132){_0x5e2cbf=_0x693132[_0x66ed('0x36')];if(!_0xfa26a8[_0x66ed('0x30')][_0x66ed('0x37')](_0x66ed('0x38'))){_0x574323['limit']=qs['limit'](_0xfa26a8[_0x66ed('0x30')]['limit']);_0x574323[_0x66ed('0x1b')]=qs[_0x66ed('0x1b')](_0xfa26a8[_0x66ed('0x30')]['offset']);}return _0xe451a6['getDescriptions'](_0x574323);}})['then'](function(_0x40c775){if(_0x40c775){return _0x40c775?{'count':_0x5e2cbf,'rows':_0x40c775}:null;}})[_0x66ed('0x25')](respondWithResult(_0x5f5c1f,null))['catch'](handleError(_0x5f5c1f,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 0d4a5df..46a0f63 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 _0x3149=['path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','../../config/logger','api','moment','bluebird'];(function(_0x450889,_0x2ea77e){var _0x1402cb=function(_0x1f126e){while(--_0x1f126e){_0x450889['push'](_0x450889['shift']());}};_0x1402cb(++_0x2ea77e);}(_0x3149,0x181));var _0x9314=function(_0x3ca352,_0x2cca2b){_0x3ca352=_0x3ca352-0x0;var _0x1b7589=_0x3149[_0x3ca352];return _0x1b7589;};'use strict';var _=require(_0x9314('0x0'));var util=require('util');var logger=require(_0x9314('0x1'))(_0x9314('0x2'));var moment=require(_0x9314('0x3'));var BPromise=require(_0x9314('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9314('0x5'));var rimraf=require(_0x9314('0x6'));var config=require(_0x9314('0x7'));var attributes=require(_0x9314('0x8'));module[_0x9314('0x9')]=function(_0x5768d7,_0xec1151){return _0x5768d7[_0x9314('0xa')](_0x9314('0xb'),attributes,{'tableName':_0x9314('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4639=['bluebird','request-promise','path','rimraf','../../config/environment','exports','ServicenowConfiguration','lodash','api','moment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4639,0x115));var _0x9463=function(_0x475eac,_0x2fa495){_0x475eac=_0x475eac-0x0;var _0x4ad158=_0x4639[_0x475eac];return _0x4ad158;};'use strict';var _=require(_0x9463('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9463('0x1'));var moment=require(_0x9463('0x2'));var BPromise=require(_0x9463('0x3'));var rp=require(_0x9463('0x4'));var fs=require('fs');var path=require(_0x9463('0x5'));var rimraf=require(_0x9463('0x6'));var config=require(_0x9463('0x7'));var attributes=require('./intServicenowConfiguration.attributes');module[_0x9463('0x8')]=function(_0x10d647,_0x493fdc){return _0x10d647['define'](_0x9463('0x9'),attributes,{'tableName':'int_servicenow_configurations','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 148c8a9..a1f2604 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 _0x9d55=['lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','code','error','message','info','result','catch'];(function(_0x5d7215,_0x13da87){var _0x1017b7=function(_0x54dafc){while(--_0x54dafc){_0x5d7215['push'](_0x5d7215['shift']());}};_0x1017b7(++_0x13da87);}(_0x9d55,0x1b9));var _0x59d5=function(_0x2aaa15,_0x5db9a5){_0x2aaa15=_0x2aaa15-0x0;var _0x473ced=_0x9d55[_0x2aaa15];return _0x473ced;};'use strict';var _=require(_0x59d5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x59d5('0x1'));var rs=require(_0x59d5('0x2'));var fs=require('fs');var Redis=require(_0x59d5('0x3'));var db=require(_0x59d5('0x4'))['db'];var utils=require(_0x59d5('0x5'));var logger=require(_0x59d5('0x6'))('rpc');var config=require(_0x59d5('0x7'));var jayson=require(_0x59d5('0x8'));var client=jayson['client'][_0x59d5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e507,_0x4e6eca,_0x49fe41){return new BPromise(function(_0x416c50,_0x461340){return client[_0x59d5('0xa')](_0x4e507,_0x49fe41)[_0x59d5('0xb')](function(_0x3a33a6){logger['info'](_0x59d5('0xc'),_0x4e6eca,_0x59d5('0xd'));logger['debug'](_0x59d5('0xe'),_0x4e6eca,'request\x20sent',JSON['stringify'](_0x3a33a6));if(_0x3a33a6['error']){if(_0x3a33a6['error'][_0x59d5('0xf')]===0x1f4){logger['error'](_0x59d5('0xc'),_0x4e6eca,_0x3a33a6[_0x59d5('0x10')][_0x59d5('0x11')]);return _0x461340(_0x3a33a6[_0x59d5('0x10')][_0x59d5('0x11')]);}logger['error'](_0x59d5('0xc'),_0x4e6eca,_0x3a33a6['error'][_0x59d5('0x11')]);return _0x416c50(_0x3a33a6[_0x59d5('0x10')]['message']);}else{logger[_0x59d5('0x12')](_0x59d5('0xc'),_0x4e6eca,'request\x20sent');_0x416c50(_0x3a33a6[_0x59d5('0x13')][_0x59d5('0x11')]);}})[_0x59d5('0x14')](function(_0x5d6c39){logger[_0x59d5('0x10')]('ServicenowConfiguration,\x20%s,\x20%s',_0x4e6eca,_0x5d6c39);_0x461340(_0x5d6c39);});});} \ No newline at end of file +var _0x858e=['request\x20sent','debug','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info'];(function(_0x466309,_0x38ff4c){var _0x2bf3a4=function(_0x6640b2){while(--_0x6640b2){_0x466309['push'](_0x466309['shift']());}};_0x2bf3a4(++_0x38ff4c);}(_0x858e,0x16e));var _0xe858=function(_0xf767d4,_0x3cd6b9){_0xf767d4=_0xf767d4-0x0;var _0x9a2ade=_0x858e[_0xf767d4];return _0x9a2ade;};'use strict';var _=require(_0xe858('0x0'));var util=require(_0xe858('0x1'));var moment=require(_0xe858('0x2'));var BPromise=require(_0xe858('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe858('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe858('0x5'));var logger=require('../../config/logger')(_0xe858('0x6'));var config=require(_0xe858('0x7'));var jayson=require(_0xe858('0x8'));var client=jayson[_0xe858('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x225636,_0xe9aa45,_0x29c2cc){return new BPromise(function(_0x2b34ad,_0xc44073){return client[_0xe858('0xa')](_0x225636,_0x29c2cc)['then'](function(_0x3f534a){logger[_0xe858('0xb')]('ServicenowConfiguration,\x20%s,\x20%s',_0xe9aa45,_0xe858('0xc'));logger[_0xe858('0xd')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0xe9aa45,_0xe858('0xc'),JSON[_0xe858('0xe')](_0x3f534a));if(_0x3f534a[_0xe858('0xf')]){if(_0x3f534a[_0xe858('0xf')][_0xe858('0x10')]===0x1f4){logger['error'](_0xe858('0x11'),_0xe9aa45,_0x3f534a[_0xe858('0xf')][_0xe858('0x12')]);return _0xc44073(_0x3f534a['error'][_0xe858('0x12')]);}logger[_0xe858('0xf')]('ServicenowConfiguration,\x20%s,\x20%s',_0xe9aa45,_0x3f534a[_0xe858('0xf')]['message']);return _0x2b34ad(_0x3f534a['error'][_0xe858('0x12')]);}else{logger[_0xe858('0xb')]('ServicenowConfiguration,\x20%s,\x20%s',_0xe9aa45,'request\x20sent');_0x2b34ad(_0x3f534a[_0xe858('0x13')][_0xe858('0x12')]);}})[_0xe858('0x14')](function(_0x385cd6){logger[_0xe858('0xf')]('ServicenowConfiguration,\x20%s,\x20%s',_0xe9aa45,_0x385cd6);_0xc44073(_0x385cd6);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 496c67a..de01f80 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 _0xffd9=['express','Router','../../components/auth/service','../../config/environment','./intServicenowField.controller','isAuthenticated','index','get','show','post','create','put','/:id','update','delete','exports','path','connect-timeout'];(function(_0x1709e7,_0x2ced21){var _0x402819=function(_0x3637a0){while(--_0x3637a0){_0x1709e7['push'](_0x1709e7['shift']());}};_0x402819(++_0x2ced21);}(_0xffd9,0x8e));var _0x9ffd=function(_0xe96d5b,_0x1a09c5){_0xe96d5b=_0xe96d5b-0x0;var _0x1717dc=_0xffd9[_0xe96d5b];return _0x1717dc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9ffd('0x0'));var timeout=require(_0x9ffd('0x1'));var express=require(_0x9ffd('0x2'));var router=express[_0x9ffd('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9ffd('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9ffd('0x5'));var controller=require(_0x9ffd('0x6'));router['get']('/',auth[_0x9ffd('0x7')](),controller[_0x9ffd('0x8')]);router[_0x9ffd('0x9')]('/:id',auth[_0x9ffd('0x7')](),controller[_0x9ffd('0xa')]);router[_0x9ffd('0xb')]('/',auth[_0x9ffd('0x7')](),controller[_0x9ffd('0xc')]);router[_0x9ffd('0xd')](_0x9ffd('0xe'),auth['isAuthenticated'](),controller[_0x9ffd('0xf')]);router[_0x9ffd('0x10')](_0x9ffd('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x9ffd('0x11')]=router; \ No newline at end of file +var _0x1083=['../../components/interaction/service','../../config/environment','./intServicenowField.controller','/:id','isAuthenticated','show','post','create','put','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x90448c,_0x3443bb){var _0xda4813=function(_0x3e95a4){while(--_0x3e95a4){_0x90448c['push'](_0x90448c['shift']());}};_0xda4813(++_0x3443bb);}(_0x1083,0x173));var _0x3108=function(_0x10c047,_0x5e580c){_0x10c047=_0x10c047-0x0;var _0x2de4e7=_0x1083[_0x10c047];return _0x2de4e7;};'use strict';var multer=require(_0x3108('0x0'));var util=require(_0x3108('0x1'));var path=require('path');var timeout=require(_0x3108('0x2'));var express=require(_0x3108('0x3'));var router=express[_0x3108('0x4')]();var fs_extra=require(_0x3108('0x5'));var auth=require(_0x3108('0x6'));var interaction=require(_0x3108('0x7'));var config=require(_0x3108('0x8'));var controller=require(_0x3108('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x3108('0xa'),auth[_0x3108('0xb')](),controller[_0x3108('0xc')]);router[_0x3108('0xd')]('/',auth[_0x3108('0xb')](),controller[_0x3108('0xe')]);router[_0x3108('0xf')](_0x3108('0xa'),auth[_0x3108('0xb')](),controller['update']);router[_0x3108('0x10')](_0x3108('0xa'),auth[_0x3108('0xb')](),controller[_0x3108('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 2461d58..d44307d 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 _0x3970=['string','STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue','picklist'];(function(_0x15ba05,_0x59135d){var _0x5c470e=function(_0x4d928e){while(--_0x4d928e){_0x15ba05['push'](_0x15ba05['shift']());}};_0x5c470e(++_0x59135d);}(_0x3970,0xe9));var _0x0397=function(_0x5400b,_0x55943a){_0x5400b=_0x5400b-0x0;var _0x36a39b=_0x3970[_0x5400b];return _0x36a39b;};'use strict';var Sequelize=require(_0x0397('0x0'));module[_0x0397('0x1')]={'type':{'type':Sequelize[_0x0397('0x2')]('string',_0x0397('0x3'),_0x0397('0x4'),_0x0397('0x5'),_0x0397('0x6')),'defaultValue':_0x0397('0x7')},'content':{'type':Sequelize[_0x0397('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x0397('0x2')](_0x0397('0x7'),_0x0397('0x3'),_0x0397('0x4'))},'keyContent':{'type':Sequelize[_0x0397('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x0397('0x8')]},'customField':{'type':Sequelize[_0x0397('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa197=['variable','BOOLEAN','sequelize','exports','ENUM','customVariable','keyValue','string','STRING'];(function(_0x15ece6,_0x51a965){var _0x3dc05c=function(_0x43e0c1){while(--_0x43e0c1){_0x15ece6['push'](_0x15ece6['shift']());}};_0x3dc05c(++_0x51a965);}(_0xa197,0x1a9));var _0x7a19=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xa197[_0x1d1779];return _0x2377e9;};'use strict';var Sequelize=require(_0x7a19('0x0'));module[_0x7a19('0x1')]={'type':{'type':Sequelize[_0x7a19('0x2')]('string','variable',_0x7a19('0x3'),_0x7a19('0x4'),'picklist'),'defaultValue':_0x7a19('0x5')},'content':{'type':Sequelize[_0x7a19('0x6')]},'key':{'type':Sequelize[_0x7a19('0x6')]},'keyType':{'type':Sequelize[_0x7a19('0x2')](_0x7a19('0x5'),_0x7a19('0x7'),_0x7a19('0x3'))},'keyContent':{'type':Sequelize[_0x7a19('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x7a19('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7a19('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 12c7a78..15de68d 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 _0x5780=['to-csv','ejs','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','destroy','then','sendStatus','stack','name','status','send','index','ServicenowField','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','merge','options','include','findAll','rows','show','params','length','includeAll','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','util','path','sox'];(function(_0x25ac43,_0x5341fb){var _0x3eb505=function(_0x364eba){while(--_0x364eba){_0x25ac43['push'](_0x25ac43['shift']());}};_0x3eb505(++_0x5341fb);}(_0x5780,0x157));var _0x0578=function(_0x302e04,_0x476769){_0x302e04=_0x302e04-0x0;var _0x53e36f=_0x5780[_0x302e04];return _0x53e36f;};'use strict';var emlformat=require(_0x0578('0x0'));var rimraf=require(_0x0578('0x1'));var zipdir=require(_0x0578('0x2'));var jsonpatch=require(_0x0578('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0578('0x4'));var path=require(_0x0578('0x5'));var sox=require(_0x0578('0x6'));var csv=require(_0x0578('0x7'));var ejs=require(_0x0578('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0578('0x9'));var crypto=require(_0x0578('0xa'));var jsforce=require(_0x0578('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0578('0x7'));var querystring=require(_0x0578('0xc'));var Papa=require('papaparse');var Redis=require(_0x0578('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x0578('0xe'));var as=require(_0x0578('0xf'));var hardwareService=require(_0x0578('0x10'));var logger=require('../../config/logger')(_0x0578('0x11'));var utils=require(_0x0578('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0578('0x13'))['db'];function respondWithStatusCode(_0x4304a3,_0x28b5c2){_0x28b5c2=_0x28b5c2||0xcc;return function(_0x407dfc){if(_0x407dfc){return _0x4304a3['sendStatus'](_0x28b5c2);}return _0x4304a3['status'](_0x28b5c2)[_0x0578('0x14')]();};}function respondWithResult(_0x30b3d5,_0x2c57d8){_0x2c57d8=_0x2c57d8||0xc8;return function(_0x18feb6){if(_0x18feb6){return _0x30b3d5['status'](_0x2c57d8)[_0x0578('0x15')](_0x18feb6);}};}function respondWithFilteredResult(_0x10c1bb,_0x462a07){return function(_0x15d459){if(_0x15d459){var _0x2b773d=typeof _0x462a07['offset']===_0x0578('0x16')&&typeof _0x462a07[_0x0578('0x17')]==='undefined';var _0xaca392=_0x15d459[_0x0578('0x18')];var _0x20f9ba=_0x2b773d?0x0:_0x462a07['offset'];var _0x2521aa=_0x2b773d?_0x15d459[_0x0578('0x18')]:_0x462a07[_0x0578('0x19')]+_0x462a07['limit'];var _0x39258f;if(_0x2521aa>=_0xaca392){_0x2521aa=_0xaca392;_0x39258f=0xc8;}else{_0x39258f=0xce;}_0x10c1bb['status'](_0x39258f);return _0x10c1bb[_0x0578('0x1a')](_0x0578('0x1b'),_0x20f9ba+'-'+_0x2521aa+'/'+_0xaca392)['json'](_0x15d459);}return null;};}function patchUpdates(_0x49138d){return function(_0x72e241){try{jsonpatch[_0x0578('0x1c')](_0x72e241,_0x49138d,!![]);}catch(_0x21ab52){return BPromise[_0x0578('0x1d')](_0x21ab52);}return _0x72e241['save']();};}function saveUpdates(_0x492e17,_0x1d62f7){return function(_0x91affe){if(_0x91affe){return _0x91affe[_0x0578('0x1e')](_0x492e17)['then'](function(_0x26a1f9){return _0x26a1f9;});}return null;};}function removeEntity(_0x3545de,_0x1f0d8b){return function(_0x4bdf85){if(_0x4bdf85){return _0x4bdf85[_0x0578('0x1f')]()[_0x0578('0x20')](function(){_0x3545de['status'](0xcc)[_0x0578('0x14')]();});}};}function handleEntityNotFound(_0x14be03,_0x49d3a6){return function(_0x4e7419){if(!_0x4e7419){_0x14be03[_0x0578('0x21')](0x194);}return _0x4e7419;};}function handleError(_0x9e4969,_0x385e11){_0x385e11=_0x385e11||0x1f4;return function(_0x5b9ca6){logger['error'](_0x5b9ca6[_0x0578('0x22')]);if(_0x5b9ca6['name']){delete _0x5b9ca6[_0x0578('0x23')];}_0x9e4969[_0x0578('0x24')](_0x385e11)[_0x0578('0x25')](_0x5b9ca6);};}exports[_0x0578('0x26')]=function(_0x26bf64,_0x3113b1){var _0x334b76={},_0x1e5a2d={},_0x2d35c0={'count':0x0,'rows':[]};var _0x422a74=_['map'](db[_0x0578('0x27')][_0x0578('0x28')],function(_0x529ef2){return{'name':_0x529ef2[_0x0578('0x29')],'type':_0x529ef2[_0x0578('0x2a')][_0x0578('0x2b')]};});_0x1e5a2d[_0x0578('0x2c')]=_[_0x0578('0x2d')](_0x422a74,_0x0578('0x23'));_0x1e5a2d['query']=_[_0x0578('0x2e')](_0x26bf64[_0x0578('0x2f')]);_0x1e5a2d[_0x0578('0x30')]=_[_0x0578('0x31')](_0x1e5a2d[_0x0578('0x2c')],_0x1e5a2d[_0x0578('0x2f')]);_0x334b76[_0x0578('0x32')]=_[_0x0578('0x31')](_0x1e5a2d['model'],qs[_0x0578('0x33')](_0x26bf64[_0x0578('0x2f')]['fields']));_0x334b76[_0x0578('0x32')]=_0x334b76['attributes']['length']?_0x334b76['attributes']:_0x1e5a2d[_0x0578('0x2c')];if(!_0x26bf64[_0x0578('0x2f')]['hasOwnProperty'](_0x0578('0x34'))){_0x334b76[_0x0578('0x17')]=qs[_0x0578('0x17')](_0x26bf64[_0x0578('0x2f')]['limit']);_0x334b76[_0x0578('0x19')]=qs[_0x0578('0x19')](_0x26bf64[_0x0578('0x2f')][_0x0578('0x19')]);}_0x334b76['order']=qs[_0x0578('0x35')](_0x26bf64[_0x0578('0x2f')][_0x0578('0x35')]);_0x334b76[_0x0578('0x36')]=qs[_0x0578('0x30')](_[_0x0578('0x37')](_0x26bf64['query'],_0x1e5a2d[_0x0578('0x30')]),_0x422a74);if(_0x26bf64['query'][_0x0578('0x38')]){_0x334b76[_0x0578('0x36')]=_[_0x0578('0x39')](_0x334b76[_0x0578('0x36')],{'$or':_[_0x0578('0x2d')](_0x422a74,function(_0x700971){if(_0x700971[_0x0578('0x2a')]!=='VIRTUAL'){var _0x38bce7={};_0x38bce7[_0x700971[_0x0578('0x23')]]={'$like':'%'+_0x26bf64['query'][_0x0578('0x38')]+'%'};return _0x38bce7;}})});}_0x334b76=_['merge']({},_0x334b76,_0x26bf64[_0x0578('0x3a')]);var _0x4e0e44={'where':_0x334b76[_0x0578('0x36')]};return db[_0x0578('0x27')][_0x0578('0x18')](_0x4e0e44)['then'](function(_0x138ae1){_0x2d35c0[_0x0578('0x18')]=_0x138ae1;if(_0x26bf64['query']['includeAll']){_0x334b76[_0x0578('0x3b')]=[{'all':!![]}];}return db[_0x0578('0x27')][_0x0578('0x3c')](_0x334b76);})[_0x0578('0x20')](function(_0x458912){_0x2d35c0[_0x0578('0x3d')]=_0x458912;return _0x2d35c0;})[_0x0578('0x20')](respondWithFilteredResult(_0x3113b1,_0x334b76))['catch'](handleError(_0x3113b1,null));};exports[_0x0578('0x3e')]=function(_0x57fb39,_0x5ea363){var _0xa8f9b8={'raw':!![],'where':{'id':_0x57fb39[_0x0578('0x3f')]['id']}},_0x46beca={};_0x46beca[_0x0578('0x2c')]=_[_0x0578('0x2e')](db['ServicenowField'][_0x0578('0x28')]);_0x46beca[_0x0578('0x2f')]=_['keys'](_0x57fb39[_0x0578('0x2f')]);_0x46beca[_0x0578('0x30')]=_[_0x0578('0x31')](_0x46beca[_0x0578('0x2c')],_0x46beca['query']);_0xa8f9b8[_0x0578('0x32')]=_[_0x0578('0x31')](_0x46beca[_0x0578('0x2c')],qs[_0x0578('0x33')](_0x57fb39[_0x0578('0x2f')][_0x0578('0x33')]));_0xa8f9b8[_0x0578('0x32')]=_0xa8f9b8[_0x0578('0x32')][_0x0578('0x40')]?_0xa8f9b8[_0x0578('0x32')]:_0x46beca[_0x0578('0x2c')];if(_0x57fb39[_0x0578('0x2f')][_0x0578('0x41')]){_0xa8f9b8[_0x0578('0x3b')]=[{'all':!![]}];}_0xa8f9b8=_[_0x0578('0x39')]({},_0xa8f9b8,_0x57fb39[_0x0578('0x3a')]);return db[_0x0578('0x27')][_0x0578('0x42')](_0xa8f9b8)[_0x0578('0x20')](handleEntityNotFound(_0x5ea363,null))[_0x0578('0x20')](respondWithResult(_0x5ea363,null))[_0x0578('0x43')](handleError(_0x5ea363,null));};exports['create']=function(_0x12c5e6,_0x59e72d){return db[_0x0578('0x27')][_0x0578('0x44')](_0x12c5e6[_0x0578('0x45')],{})[_0x0578('0x20')](respondWithResult(_0x59e72d,0xc9))[_0x0578('0x43')](handleError(_0x59e72d,null));};exports[_0x0578('0x1e')]=function(_0x4e001f,_0xc63db3){if(_0x4e001f[_0x0578('0x45')]['id']){delete _0x4e001f['body']['id'];}return db[_0x0578('0x27')][_0x0578('0x42')]({'where':{'id':_0x4e001f[_0x0578('0x3f')]['id']}})[_0x0578('0x20')](handleEntityNotFound(_0xc63db3,null))[_0x0578('0x20')](saveUpdates(_0x4e001f[_0x0578('0x45')],null))[_0x0578('0x20')](respondWithResult(_0xc63db3,null))[_0x0578('0x43')](handleError(_0xc63db3,null));};exports[_0x0578('0x1f')]=function(_0x12ca35,_0x2f0c85){return db[_0x0578('0x27')][_0x0578('0x42')]({'where':{'id':_0x12ca35['params']['id']}})[_0x0578('0x20')](handleEntityNotFound(_0x2f0c85,null))[_0x0578('0x20')](removeEntity(_0x2f0c85,null))[_0x0578('0x43')](handleError(_0x2f0c85,null));}; \ No newline at end of file +var _0x6f40=['set','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','ServicenowField','rawAttributes','fieldName','type','model','filters','intersection','attributes','fields','query','length','hasOwnProperty','order','sort','where','filter','merge','options','include','findAll','rows','catch','keys','includeAll','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','json','offset','undefined','limit','count'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6f40,0xfb));var _0x06f4=function(_0x211397,_0x52b103){_0x211397=_0x211397-0x0;var _0x3df56c=_0x6f40[_0x211397];return _0x3df56c;};'use strict';var emlformat=require(_0x06f4('0x0'));var rimraf=require(_0x06f4('0x1'));var zipdir=require(_0x06f4('0x2'));var jsonpatch=require(_0x06f4('0x3'));var rp=require(_0x06f4('0x4'));var moment=require('moment');var BPromise=require(_0x06f4('0x5'));var Mustache=require(_0x06f4('0x6'));var util=require(_0x06f4('0x7'));var path=require(_0x06f4('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x06f4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x06f4('0xa'));var jsforce=require(_0x06f4('0xb'));var deskjs=require(_0x06f4('0xc'));var toCsv=require(_0x06f4('0xd'));var querystring=require(_0x06f4('0xe'));var Papa=require(_0x06f4('0xf'));var Redis=require('ioredis');var authService=require(_0x06f4('0x10'));var qs=require(_0x06f4('0x11'));var as=require(_0x06f4('0x12'));var hardwareService=require(_0x06f4('0x13'));var logger=require(_0x06f4('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x06f4('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d75d3,_0x4908ee){_0x4908ee=_0x4908ee||0xcc;return function(_0xa06d70){if(_0xa06d70){return _0x5d75d3[_0x06f4('0x16')](_0x4908ee);}return _0x5d75d3['status'](_0x4908ee)['end']();};}function respondWithResult(_0x3118e2,_0x3b66c8){_0x3b66c8=_0x3b66c8||0xc8;return function(_0x3d49e1){if(_0x3d49e1){return _0x3118e2[_0x06f4('0x17')](_0x3b66c8)[_0x06f4('0x18')](_0x3d49e1);}};}function respondWithFilteredResult(_0xcde315,_0x3564de){return function(_0x13518b){if(_0x13518b){var _0x13c818=typeof _0x3564de[_0x06f4('0x19')]===_0x06f4('0x1a')&&typeof _0x3564de[_0x06f4('0x1b')]===_0x06f4('0x1a');var _0x44a641=_0x13518b[_0x06f4('0x1c')];var _0x1539a5=_0x13c818?0x0:_0x3564de[_0x06f4('0x19')];var _0x3360c2=_0x13c818?_0x13518b[_0x06f4('0x1c')]:_0x3564de[_0x06f4('0x19')]+_0x3564de[_0x06f4('0x1b')];var _0x1fd129;if(_0x3360c2>=_0x44a641){_0x3360c2=_0x44a641;_0x1fd129=0xc8;}else{_0x1fd129=0xce;}_0xcde315[_0x06f4('0x17')](_0x1fd129);return _0xcde315[_0x06f4('0x1d')]('Content-Range',_0x1539a5+'-'+_0x3360c2+'/'+_0x44a641)[_0x06f4('0x18')](_0x13518b);}return null;};}function patchUpdates(_0x277387){return function(_0x52c341){try{jsonpatch[_0x06f4('0x1e')](_0x52c341,_0x277387,!![]);}catch(_0x65e664){return BPromise[_0x06f4('0x1f')](_0x65e664);}return _0x52c341[_0x06f4('0x20')]();};}function saveUpdates(_0x1488e2,_0x493716){return function(_0x38d927){if(_0x38d927){return _0x38d927[_0x06f4('0x21')](_0x1488e2)[_0x06f4('0x22')](function(_0x2990ed){return _0x2990ed;});}return null;};}function removeEntity(_0x3ba0af,_0x1d16f9){return function(_0x4bc379){if(_0x4bc379){return _0x4bc379[_0x06f4('0x23')]()[_0x06f4('0x22')](function(){_0x3ba0af[_0x06f4('0x17')](0xcc)[_0x06f4('0x24')]();});}};}function handleEntityNotFound(_0x2ac3b4,_0x18d131){return function(_0x2b11b1){if(!_0x2b11b1){_0x2ac3b4[_0x06f4('0x16')](0x194);}return _0x2b11b1;};}function handleError(_0x38c1b0,_0x25b1ab){_0x25b1ab=_0x25b1ab||0x1f4;return function(_0x293097){logger[_0x06f4('0x25')](_0x293097[_0x06f4('0x26')]);if(_0x293097[_0x06f4('0x27')]){delete _0x293097['name'];}_0x38c1b0[_0x06f4('0x17')](_0x25b1ab)[_0x06f4('0x28')](_0x293097);};}exports['index']=function(_0x7ccf30,_0x34bf98){var _0x3bdc7e={},_0x26c832={},_0x294544={'count':0x0,'rows':[]};var _0x547508=_[_0x06f4('0x29')](db[_0x06f4('0x2a')][_0x06f4('0x2b')],function(_0x48442a){return{'name':_0x48442a[_0x06f4('0x2c')],'type':_0x48442a[_0x06f4('0x2d')]['key']};});_0x26c832[_0x06f4('0x2e')]=_['map'](_0x547508,_0x06f4('0x27'));_0x26c832['query']=_['keys'](_0x7ccf30['query']);_0x26c832[_0x06f4('0x2f')]=_[_0x06f4('0x30')](_0x26c832[_0x06f4('0x2e')],_0x26c832['query']);_0x3bdc7e[_0x06f4('0x31')]=_[_0x06f4('0x30')](_0x26c832['model'],qs[_0x06f4('0x32')](_0x7ccf30[_0x06f4('0x33')][_0x06f4('0x32')]));_0x3bdc7e[_0x06f4('0x31')]=_0x3bdc7e['attributes'][_0x06f4('0x34')]?_0x3bdc7e['attributes']:_0x26c832[_0x06f4('0x2e')];if(!_0x7ccf30[_0x06f4('0x33')][_0x06f4('0x35')]('nolimit')){_0x3bdc7e[_0x06f4('0x1b')]=qs[_0x06f4('0x1b')](_0x7ccf30['query'][_0x06f4('0x1b')]);_0x3bdc7e[_0x06f4('0x19')]=qs[_0x06f4('0x19')](_0x7ccf30[_0x06f4('0x33')][_0x06f4('0x19')]);}_0x3bdc7e[_0x06f4('0x36')]=qs[_0x06f4('0x37')](_0x7ccf30['query']['sort']);_0x3bdc7e[_0x06f4('0x38')]=qs[_0x06f4('0x2f')](_['pick'](_0x7ccf30[_0x06f4('0x33')],_0x26c832['filters']),_0x547508);if(_0x7ccf30[_0x06f4('0x33')][_0x06f4('0x39')]){_0x3bdc7e[_0x06f4('0x38')]=_[_0x06f4('0x3a')](_0x3bdc7e[_0x06f4('0x38')],{'$or':_[_0x06f4('0x29')](_0x547508,function(_0x536a66){if(_0x536a66['type']!=='VIRTUAL'){var _0x7fc4c4={};_0x7fc4c4[_0x536a66['name']]={'$like':'%'+_0x7ccf30['query'][_0x06f4('0x39')]+'%'};return _0x7fc4c4;}})});}_0x3bdc7e=_[_0x06f4('0x3a')]({},_0x3bdc7e,_0x7ccf30[_0x06f4('0x3b')]);var _0x9cc8c3={'where':_0x3bdc7e[_0x06f4('0x38')]};return db['ServicenowField'][_0x06f4('0x1c')](_0x9cc8c3)[_0x06f4('0x22')](function(_0x3655df){_0x294544[_0x06f4('0x1c')]=_0x3655df;if(_0x7ccf30[_0x06f4('0x33')]['includeAll']){_0x3bdc7e[_0x06f4('0x3c')]=[{'all':!![]}];}return db[_0x06f4('0x2a')][_0x06f4('0x3d')](_0x3bdc7e);})['then'](function(_0x7fbe7c){_0x294544[_0x06f4('0x3e')]=_0x7fbe7c;return _0x294544;})[_0x06f4('0x22')](respondWithFilteredResult(_0x34bf98,_0x3bdc7e))[_0x06f4('0x3f')](handleError(_0x34bf98,null));};exports['show']=function(_0x4068fd,_0x583895){var _0x19ee52={'raw':!![],'where':{'id':_0x4068fd['params']['id']}},_0x59ee76={};_0x59ee76[_0x06f4('0x2e')]=_['keys'](db[_0x06f4('0x2a')][_0x06f4('0x2b')]);_0x59ee76[_0x06f4('0x33')]=_[_0x06f4('0x40')](_0x4068fd['query']);_0x59ee76[_0x06f4('0x2f')]=_[_0x06f4('0x30')](_0x59ee76[_0x06f4('0x2e')],_0x59ee76[_0x06f4('0x33')]);_0x19ee52[_0x06f4('0x31')]=_[_0x06f4('0x30')](_0x59ee76[_0x06f4('0x2e')],qs[_0x06f4('0x32')](_0x4068fd[_0x06f4('0x33')][_0x06f4('0x32')]));_0x19ee52['attributes']=_0x19ee52[_0x06f4('0x31')][_0x06f4('0x34')]?_0x19ee52['attributes']:_0x59ee76[_0x06f4('0x2e')];if(_0x4068fd[_0x06f4('0x33')][_0x06f4('0x41')]){_0x19ee52[_0x06f4('0x3c')]=[{'all':!![]}];}_0x19ee52=_['merge']({},_0x19ee52,_0x4068fd[_0x06f4('0x3b')]);return db['ServicenowField'][_0x06f4('0x42')](_0x19ee52)[_0x06f4('0x22')](handleEntityNotFound(_0x583895,null))[_0x06f4('0x22')](respondWithResult(_0x583895,null))[_0x06f4('0x3f')](handleError(_0x583895,null));};exports['create']=function(_0x30b49d,_0x3e1183){return db[_0x06f4('0x2a')][_0x06f4('0x43')](_0x30b49d['body'],{})[_0x06f4('0x22')](respondWithResult(_0x3e1183,0xc9))[_0x06f4('0x3f')](handleError(_0x3e1183,null));};exports[_0x06f4('0x21')]=function(_0x12b5ca,_0xad8cb1){if(_0x12b5ca['body']['id']){delete _0x12b5ca[_0x06f4('0x44')]['id'];}return db[_0x06f4('0x2a')]['find']({'where':{'id':_0x12b5ca[_0x06f4('0x45')]['id']}})[_0x06f4('0x22')](handleEntityNotFound(_0xad8cb1,null))[_0x06f4('0x22')](saveUpdates(_0x12b5ca['body'],null))[_0x06f4('0x22')](respondWithResult(_0xad8cb1,null))[_0x06f4('0x3f')](handleError(_0xad8cb1,null));};exports['destroy']=function(_0x5268dd,_0x6770d7){return db[_0x06f4('0x2a')][_0x06f4('0x42')]({'where':{'id':_0x5268dd[_0x06f4('0x45')]['id']}})['then'](handleEntityNotFound(_0x6770d7,null))[_0x06f4('0x22')](removeEntity(_0x6770d7,null))[_0x06f4('0x3f')](handleError(_0x6770d7,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index e747e65..52a9a9d 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 _0x6ee7=['define','ServicenowField','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./intServicenowField.attributes','exports'];(function(_0x192526,_0x4a8c10){var _0x533d5b=function(_0x2774e3){while(--_0x2774e3){_0x192526['push'](_0x192526['shift']());}};_0x533d5b(++_0x4a8c10);}(_0x6ee7,0x1e1));var _0x76ee=function(_0x11bf1d,_0x366556){_0x11bf1d=_0x11bf1d-0x0;var _0x5c3bfd=_0x6ee7[_0x11bf1d];return _0x5c3bfd;};'use strict';var _=require(_0x76ee('0x0'));var util=require(_0x76ee('0x1'));var logger=require(_0x76ee('0x2'))(_0x76ee('0x3'));var moment=require('moment');var BPromise=require(_0x76ee('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x76ee('0x5'));var config=require(_0x76ee('0x6'));var attributes=require(_0x76ee('0x7'));module[_0x76ee('0x8')]=function(_0x353991,_0x2cacf7){return _0x353991[_0x76ee('0x9')](_0x76ee('0xa'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x76ee('0xb'),'fields':[_0x76ee('0xc'),_0x76ee('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x83d6=['ServicenowField','int_servicenow_fields','idField','FieldId','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes'];(function(_0x43103c,_0x2c29f5){var _0x387470=function(_0x48465e){while(--_0x48465e){_0x43103c['push'](_0x43103c['shift']());}};_0x387470(++_0x2c29f5);}(_0x83d6,0xc7));var _0x683d=function(_0x505f4b,_0x5f44ec){_0x505f4b=_0x505f4b-0x0;var _0x15e3a8=_0x83d6[_0x505f4b];return _0x15e3a8;};'use strict';var _=require(_0x683d('0x0'));var util=require('util');var logger=require(_0x683d('0x1'))('api');var moment=require(_0x683d('0x2'));var BPromise=require(_0x683d('0x3'));var rp=require(_0x683d('0x4'));var fs=require('fs');var path=require(_0x683d('0x5'));var rimraf=require(_0x683d('0x6'));var config=require(_0x683d('0x7'));var attributes=require(_0x683d('0x8'));module['exports']=function(_0x139688,_0x5df338){return _0x139688['define'](_0x683d('0x9'),attributes,{'tableName':_0x683d('0xa'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x683d('0xb'),_0x683d('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index cf44c27..40d2dcf 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 _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x4d389d,_0xec145d){var _0x22bd25=function(_0x22cd63){while(--_0x22cd63){_0x4d389d['push'](_0x4d389d['shift']());}};_0x22bd25(++_0xec145d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});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);});});} \ No newline at end of file +var _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ServicenowField,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x3a0fed,_0x4c589e){var _0x1e6314=function(_0x147ec9){while(--_0x147ec9){_0x3a0fed['push'](_0x3a0fed['shift']());}};_0x1e6314(++_0x4c589e);}(_0xb43b,0x1b2));var _0xbb43=function(_0x1590ff,_0x20cd90){_0x1590ff=_0x1590ff-0x0;var _0x11d942=_0xb43b[_0x1590ff];return _0x11d942;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb43('0x5'));var logger=require(_0xbb43('0x6'))(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553520,_0x80fe61,_0x1ccd49){return new BPromise(function(_0x2a2f11,_0x29ae1a){return client[_0xbb43('0xa')](_0x553520,_0x1ccd49)['then'](function(_0x208c2b){logger[_0xbb43('0xb')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0xbb43('0xc'));logger[_0xbb43('0xd')](_0xbb43('0xe'),_0x80fe61,_0xbb43('0xc'),JSON[_0xbb43('0xf')](_0x208c2b));if(_0x208c2b[_0xbb43('0x10')]){if(_0x208c2b['error'][_0xbb43('0x11')]===0x1f4){logger[_0xbb43('0x10')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index bfb4fed..5b6e690 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x2e4554,_0x13a8f0){var _0x27a81c=function(_0x107391){while(--_0x107391){_0x2e4554['push'](_0x2e4554['shift']());}};_0x27a81c(++_0x13a8f0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x5f0be5,_0x5e9ee8){var _0x24f10a=function(_0x12cee2){while(--_0x12cee2){_0x5f0be5['push'](_0x5f0be5['shift']());}};_0x24f10a(++_0x5e9ee8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 91361c0..90d5dd2 100644 --- a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js +++ b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['remoteUri','sequelize','exports','STRING','username'];(function(_0x1eec24,_0x3db10f){var _0x3280b5=function(_0x38c018){while(--_0x38c018){_0x1eec24['push'](_0x1eec24['shift']());}};_0x3280b5(++_0x3db10f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['remoteUri','sequelize','exports','STRING','username'];(function(_0x1d82e0,_0x13b223){var _0x45c6e3=function(_0x39ccbb){while(--_0x39ccbb){_0x1d82e0['push'](_0x1d82e0['shift']());}};_0x45c6e3(++_0x13b223);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 8ede681..1c68b5a 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 _0xda67=['module_fields','remove','includes','label','endsWith','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','stack','name','map','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','order','sort','where','filter','VIRTUAL','merge','SugarcrmAccount','includeAll','include','catch','show','params','rawAttributes','options','find','create','body','destroy','findOne','length','pick','hasOwnProperty','nolimit','getConfigurations','Subjects','channel','Descriptions','SugarcrmConfiguration','SugarcrmField','getFields','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','/service/v4_1/rest.php','login','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','%s%s','get_module_fields','stringify','Calls','values'];(function(_0x17112e,_0x499e90){var _0x103fd8=function(_0x4e2006){while(--_0x4e2006){_0x17112e['push'](_0x17112e['shift']());}};_0x103fd8(++_0x499e90);}(_0xda67,0x1cf));var _0x7da6=function(_0x4498a2,_0x143689){_0x4498a2=_0x4498a2-0x0;var _0x411aa8=_0xda67[_0x4498a2];return _0x411aa8;};'use strict';var emlformat=require(_0x7da6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7da6('0x1'));var jsonpatch=require(_0x7da6('0x2'));var rp=require(_0x7da6('0x3'));var moment=require(_0x7da6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7da6('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7da6('0x6'));var fs=require('fs');var fs_extra=require(_0x7da6('0x7'));var _=require(_0x7da6('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7da6('0x9'));var deskjs=require(_0x7da6('0xa'));var toCsv=require('to-csv');var querystring=require(_0x7da6('0xb'));var Papa=require('papaparse');var Redis=require(_0x7da6('0xc'));var authService=require(_0x7da6('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7da6('0xe'));var logger=require('../../config/logger')(_0x7da6('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7da6('0x10'));var db=require(_0x7da6('0x11'))['db'];var integrations=require(_0x7da6('0x12'));function respondWithStatusCode(_0x3b9b68,_0x400dfe){_0x400dfe=_0x400dfe||0xcc;return function(_0x56ac95){if(_0x56ac95){return _0x3b9b68[_0x7da6('0x13')](_0x400dfe);}return _0x3b9b68[_0x7da6('0x14')](_0x400dfe)[_0x7da6('0x15')]();};}function respondWithResult(_0x4a8288,_0x1d2ea9){_0x1d2ea9=_0x1d2ea9||0xc8;return function(_0x12bb7f){if(_0x12bb7f){return _0x4a8288[_0x7da6('0x14')](_0x1d2ea9)[_0x7da6('0x16')](_0x12bb7f);}};}function respondWithFilteredResult(_0x36b940,_0x208e97){return function(_0x545373){if(_0x545373){var _0x5e00f1=typeof _0x208e97[_0x7da6('0x17')]===_0x7da6('0x18')&&typeof _0x208e97[_0x7da6('0x19')]===_0x7da6('0x18');var _0x4781f2=_0x545373['count'];var _0x52cb4c=_0x5e00f1?0x0:_0x208e97['offset'];var _0x3866bb=_0x5e00f1?_0x545373[_0x7da6('0x1a')]:_0x208e97[_0x7da6('0x17')]+_0x208e97[_0x7da6('0x19')];var _0x34def6;if(_0x3866bb>=_0x4781f2){_0x3866bb=_0x4781f2;_0x34def6=0xc8;}else{_0x34def6=0xce;}_0x36b940['status'](_0x34def6);return _0x36b940[_0x7da6('0x1b')](_0x7da6('0x1c'),_0x52cb4c+'-'+_0x3866bb+'/'+_0x4781f2)[_0x7da6('0x16')](_0x545373);}return null;};}function patchUpdates(_0x24502c){return function(_0x4085cb){try{jsonpatch['apply'](_0x4085cb,_0x24502c,!![]);}catch(_0x2c06b4){return BPromise['reject'](_0x2c06b4);}return _0x4085cb[_0x7da6('0x1d')]();};}function saveUpdates(_0x5c3d6e,_0x55d179){return function(_0x323a8c){if(_0x323a8c){return _0x323a8c[_0x7da6('0x1e')](_0x5c3d6e)['then'](function(_0x58a9bc){return _0x58a9bc;});}return null;};}function removeEntity(_0x492287,_0x3383f2){return function(_0x318fba){if(_0x318fba){return _0x318fba['destroy']()[_0x7da6('0x1f')](function(){_0x492287[_0x7da6('0x14')](0xcc)[_0x7da6('0x15')]();});}};}function handleEntityNotFound(_0x234345,_0x56a3f1){return function(_0x46e564){if(!_0x46e564){_0x234345[_0x7da6('0x13')](0x194);}return _0x46e564;};}function handleError(_0x51bfbf,_0x11f09c){_0x11f09c=_0x11f09c||0x1f4;return function(_0xb5bcd7){logger['error'](_0xb5bcd7[_0x7da6('0x20')]);if(_0xb5bcd7[_0x7da6('0x21')]){delete _0xb5bcd7[_0x7da6('0x21')];}_0x51bfbf[_0x7da6('0x14')](_0x11f09c)['send'](_0xb5bcd7);};}exports['index']=function(_0x5c7f1c,_0xb4c993){var _0x26c1cb={},_0x3ea492={},_0x1da1c7={'count':0x0,'rows':[]};var _0x574d60=_[_0x7da6('0x22')](db['SugarcrmAccount']['rawAttributes'],function(_0xa3733){return{'name':_0xa3733[_0x7da6('0x23')],'type':_0xa3733[_0x7da6('0x24')][_0x7da6('0x25')]};});_0x3ea492[_0x7da6('0x26')]=_[_0x7da6('0x22')](_0x574d60,'name');_0x3ea492['query']=_[_0x7da6('0x27')](_0x5c7f1c['query']);_0x3ea492[_0x7da6('0x28')]=_[_0x7da6('0x29')](_0x3ea492['model'],_0x3ea492[_0x7da6('0x2a')]);_0x26c1cb['attributes']=_['intersection'](_0x3ea492[_0x7da6('0x26')],qs[_0x7da6('0x2b')](_0x5c7f1c[_0x7da6('0x2a')][_0x7da6('0x2b')]));_0x26c1cb['attributes']=_0x26c1cb[_0x7da6('0x2c')]['length']?_0x26c1cb[_0x7da6('0x2c')]:_0x3ea492[_0x7da6('0x26')];if(!_0x5c7f1c['query']['hasOwnProperty']('nolimit')){_0x26c1cb['limit']=qs[_0x7da6('0x19')](_0x5c7f1c['query'][_0x7da6('0x19')]);_0x26c1cb[_0x7da6('0x17')]=qs['offset'](_0x5c7f1c[_0x7da6('0x2a')]['offset']);}_0x26c1cb[_0x7da6('0x2d')]=qs[_0x7da6('0x2e')](_0x5c7f1c['query'][_0x7da6('0x2e')]);_0x26c1cb[_0x7da6('0x2f')]=qs['filters'](_['pick'](_0x5c7f1c[_0x7da6('0x2a')],_0x3ea492['filters']),_0x574d60);if(_0x5c7f1c['query'][_0x7da6('0x30')]){_0x26c1cb[_0x7da6('0x2f')]=_['merge'](_0x26c1cb[_0x7da6('0x2f')],{'$or':_[_0x7da6('0x22')](_0x574d60,function(_0x46a8c0){if(_0x46a8c0['type']!==_0x7da6('0x31')){var _0x288555={};_0x288555[_0x46a8c0[_0x7da6('0x21')]]={'$like':'%'+_0x5c7f1c[_0x7da6('0x2a')][_0x7da6('0x30')]+'%'};return _0x288555;}})});}_0x26c1cb=_[_0x7da6('0x32')]({},_0x26c1cb,_0x5c7f1c['options']);var _0x146673={'where':_0x26c1cb[_0x7da6('0x2f')]};return db[_0x7da6('0x33')][_0x7da6('0x1a')](_0x146673)[_0x7da6('0x1f')](function(_0x38c98c){_0x1da1c7[_0x7da6('0x1a')]=_0x38c98c;if(_0x5c7f1c['query'][_0x7da6('0x34')]){_0x26c1cb[_0x7da6('0x35')]=[{'all':!![]}];}return db[_0x7da6('0x33')]['findAll'](_0x26c1cb);})['then'](function(_0x1ca605){_0x1da1c7['rows']=_0x1ca605;return _0x1da1c7;})[_0x7da6('0x1f')](respondWithFilteredResult(_0xb4c993,_0x26c1cb))[_0x7da6('0x36')](handleError(_0xb4c993,null));};exports[_0x7da6('0x37')]=function(_0x4f6a91,_0xfeac74){var _0x1b5746={'raw':![],'where':{'id':_0x4f6a91[_0x7da6('0x38')]['id']}},_0x3335bb={};_0x3335bb['model']=_[_0x7da6('0x27')](db['SugarcrmAccount'][_0x7da6('0x39')]);_0x3335bb[_0x7da6('0x2a')]=_[_0x7da6('0x27')](_0x4f6a91['query']);_0x3335bb[_0x7da6('0x28')]=_[_0x7da6('0x29')](_0x3335bb[_0x7da6('0x26')],_0x3335bb[_0x7da6('0x2a')]);_0x1b5746[_0x7da6('0x2c')]=_['intersection'](_0x3335bb[_0x7da6('0x26')],qs[_0x7da6('0x2b')](_0x4f6a91[_0x7da6('0x2a')]['fields']));_0x1b5746[_0x7da6('0x2c')]=_0x1b5746[_0x7da6('0x2c')]['length']?_0x1b5746['attributes']:_0x3335bb[_0x7da6('0x26')];if(_0x4f6a91[_0x7da6('0x2a')]['includeAll']){_0x1b5746['include']=[{'all':!![]}];}_0x1b5746=_['merge']({},_0x1b5746,_0x4f6a91[_0x7da6('0x3a')]);return db[_0x7da6('0x33')][_0x7da6('0x3b')](_0x1b5746)[_0x7da6('0x1f')](handleEntityNotFound(_0xfeac74,null))[_0x7da6('0x1f')](respondWithResult(_0xfeac74,null))[_0x7da6('0x36')](handleError(_0xfeac74,null));};exports['create']=function(_0x585db4,_0x264abb){return db[_0x7da6('0x33')][_0x7da6('0x3c')](_0x585db4['body'],{})[_0x7da6('0x1f')](respondWithResult(_0x264abb,0xc9))[_0x7da6('0x36')](handleError(_0x264abb,null));};exports[_0x7da6('0x1e')]=function(_0x2dc47a,_0x445ba0){if(_0x2dc47a[_0x7da6('0x3d')]['id']){delete _0x2dc47a[_0x7da6('0x3d')]['id'];}return db[_0x7da6('0x33')][_0x7da6('0x3b')]({'where':{'id':_0x2dc47a[_0x7da6('0x38')]['id']}})[_0x7da6('0x1f')](handleEntityNotFound(_0x445ba0,null))[_0x7da6('0x1f')](saveUpdates(_0x2dc47a[_0x7da6('0x3d')],null))[_0x7da6('0x1f')](respondWithResult(_0x445ba0,null))[_0x7da6('0x36')](handleError(_0x445ba0,null));};exports[_0x7da6('0x3e')]=function(_0x566ed7,_0x2c01a7){return db[_0x7da6('0x33')][_0x7da6('0x3b')]({'where':{'id':_0x566ed7[_0x7da6('0x38')]['id']}})[_0x7da6('0x1f')](handleEntityNotFound(_0x2c01a7,null))[_0x7da6('0x1f')](removeEntity(_0x2c01a7,null))[_0x7da6('0x36')](handleError(_0x2c01a7,null));};exports['getConfigurations']=function(_0x174333,_0x3d4d43,_0x4d170c){var _0x1a532d={};var _0x51bf31={};var _0x31c196;var _0x47eb34;return db[_0x7da6('0x33')][_0x7da6('0x3f')]({'where':{'id':_0x174333[_0x7da6('0x38')]['id']}})[_0x7da6('0x1f')](handleEntityNotFound(_0x3d4d43,null))[_0x7da6('0x1f')](function(_0x2e3828){if(_0x2e3828){_0x31c196=_0x2e3828;_0x51bf31[_0x7da6('0x26')]=_['keys'](db['SugarcrmConfiguration'][_0x7da6('0x39')]);_0x51bf31['query']=_[_0x7da6('0x27')](_0x174333['query']);_0x51bf31[_0x7da6('0x28')]=_['intersection'](_0x51bf31[_0x7da6('0x26')],_0x51bf31[_0x7da6('0x2a')]);_0x1a532d[_0x7da6('0x2c')]=_['intersection'](_0x51bf31['model'],qs['fields'](_0x174333[_0x7da6('0x2a')][_0x7da6('0x2b')]));_0x1a532d[_0x7da6('0x2c')]=_0x1a532d[_0x7da6('0x2c')][_0x7da6('0x40')]?_0x1a532d['attributes']:_0x51bf31[_0x7da6('0x26')];_0x1a532d[_0x7da6('0x2d')]=qs[_0x7da6('0x2e')](_0x174333[_0x7da6('0x2a')][_0x7da6('0x2e')]);_0x1a532d['where']=qs[_0x7da6('0x28')](_[_0x7da6('0x41')](_0x174333[_0x7da6('0x2a')],_0x51bf31[_0x7da6('0x28')]));if(_0x174333[_0x7da6('0x2a')][_0x7da6('0x30')]){_0x1a532d['where']=_['merge'](_0x1a532d['where'],{'$or':_[_0x7da6('0x22')](_0x1a532d[_0x7da6('0x2c')],function(_0x5049df){var _0x36028b={};_0x36028b[_0x5049df]={'$like':'%'+_0x174333[_0x7da6('0x2a')][_0x7da6('0x30')]+'%'};return _0x36028b;})});}_0x1a532d=_[_0x7da6('0x32')]({},_0x1a532d,_0x174333[_0x7da6('0x3a')]);return _0x31c196['getConfigurations'](_0x1a532d);}})['then'](function(_0x255025){if(_0x255025){_0x47eb34=_0x255025[_0x7da6('0x40')];if(!_0x174333[_0x7da6('0x2a')][_0x7da6('0x42')](_0x7da6('0x43'))){_0x1a532d[_0x7da6('0x19')]=qs[_0x7da6('0x19')](_0x174333[_0x7da6('0x2a')][_0x7da6('0x19')]);_0x1a532d[_0x7da6('0x17')]=qs['offset'](_0x174333[_0x7da6('0x2a')][_0x7da6('0x17')]);}return _0x31c196[_0x7da6('0x44')](_0x1a532d);}})[_0x7da6('0x1f')](function(_0x294809){if(_0x294809){return _0x294809?{'count':_0x47eb34,'rows':_0x294809}:null;}})[_0x7da6('0x1f')](respondWithResult(_0x3d4d43,null))[_0x7da6('0x36')](handleError(_0x3d4d43,null));};exports['addConfiguration']=function(_0x2ee012,_0x4eb185,_0x30cdc5){if(_0x2ee012[_0x7da6('0x3d')]['id']){delete _0x2ee012[_0x7da6('0x3d')]['id'];}return db[_0x7da6('0x33')][_0x7da6('0x3f')]({'where':{'id':_0x2ee012['params']['id']}})[_0x7da6('0x1f')](handleEntityNotFound(_0x4eb185,null))[_0x7da6('0x1f')](function(_0x2f223f){if(_0x2f223f){_0x2ee012['body']['AccountId']=_0x2f223f['id'];_0x2ee012[_0x7da6('0x3d')][_0x7da6('0x45')]=integrations['getSubjects'](_0x2ee012[_0x7da6('0x3d')][_0x7da6('0x46')],_0x2ee012['body'][_0x7da6('0x24')]);_0x2ee012[_0x7da6('0x3d')][_0x7da6('0x47')]=integrations['getDescriptions'](_0x2ee012[_0x7da6('0x3d')][_0x7da6('0x46')],_0x2ee012[_0x7da6('0x3d')][_0x7da6('0x24')]);return db[_0x7da6('0x48')][_0x7da6('0x3c')](_0x2ee012[_0x7da6('0x3d')],{'include':[{'model':db[_0x7da6('0x49')],'as':_0x7da6('0x45')},{'model':db[_0x7da6('0x49')],'as':'Descriptions'}]});}return null;})[_0x7da6('0x1f')](respondWithResult(_0x4eb185,null))[_0x7da6('0x36')](handleError(_0x4eb185,null));};exports[_0x7da6('0x4a')]=function(_0x3d099d,_0x775d32,_0x30bfff){var _0x3186cc='';var _0x227203=['id',_0x7da6('0x21'),'assigned_user_id',_0x7da6('0x4b'),_0x7da6('0x4c'),_0x7da6('0x4d'),_0x7da6('0x4e'),_0x7da6('0x4f'),_0x7da6('0x50'),_0x7da6('0x51'),_0x7da6('0x52'),'direction'];return db[_0x7da6('0x33')][_0x7da6('0x3f')]({'where':{'id':_0x3d099d[_0x7da6('0x38')]['id']},'attributes':['id',_0x7da6('0x53'),_0x7da6('0x54'),_0x7da6('0x55')]})['then'](handleEntityNotFound(_0x775d32,null))[_0x7da6('0x1f')](function(_0xd34285){if(_0xd34285){_0x3186cc=_0xd34285[_0x7da6('0x55')];var _0x57e7d2=_0x3186cc[_0x7da6('0x56')](-0x1);if(_0x57e7d2==='/'){_0x3186cc=_0x3186cc[_0x7da6('0x57')](0x0,_0x3186cc[_0x7da6('0x58')](_0x57e7d2));}return rp({'method':_0x7da6('0x59'),'uri':util[_0x7da6('0x5a')]('%s%s',_0x3186cc,_0x7da6('0x5b')),'json':!![],'form':{'method':_0x7da6('0x5c'),'input_type':'JSON','response_type':_0x7da6('0x5d'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0xd34285['username'],'password':_0xd34285['password'],'encryption':_0x7da6('0x5e')},'application':_0x7da6('0x5f')})}});}})[_0x7da6('0x1f')](function(_0x4df721){if(_0x4df721&&_0x4df721[_0x7da6('0x21')]!==_0x7da6('0x60')&&_0x4df721['name']!=='Password\x20Expired'){return rp({'method':_0x7da6('0x59'),'uri':util['format'](_0x7da6('0x61'),_0x3186cc,_0x7da6('0x5b')),'json':!![],'form':{'method':_0x7da6('0x62'),'input_type':_0x7da6('0x5d'),'response_type':_0x7da6('0x5d'),'rest_data':JSON[_0x7da6('0x63')]({'session':_0x4df721['id'],'module_name':_0x7da6('0x64')})}})[_0x7da6('0x1f')](function(_0xb5a064){if(_0xb5a064){var _0x2f0be4=_[_0x7da6('0x65')](_0xb5a064[_0x7da6('0x66')]);_[_0x7da6('0x67')](_0x2f0be4,function(_0x3b2df2){return _0x227203[_0x7da6('0x68')](_0x3b2df2[_0x7da6('0x21')]);});return{'count':_0x2f0be4['length'],'rows':_[_0x7da6('0x22')](_0x2f0be4,function(_0x405dd2){return{'id':_0x405dd2[_0x7da6('0x21')],'name':_0x405dd2[_0x7da6('0x69')],'custom':_[_0x7da6('0x6a')](_0x405dd2['name'],'_c')?!![]:![],'options':_0x405dd2[_0x7da6('0x3a')]?_[_0x7da6('0x22')](_[_0x7da6('0x65')](_0x405dd2['options']),function(_0x618975){return{'name':_0x618975['value'],'value':_0x618975[_0x7da6('0x21')]};}):[]};})};}})['then'](respondWithResult(_0x775d32,null))[_0x7da6('0x36')](function(_0x43bc86){var _0x56e002=_0x3d099d[_0x7da6('0x2a')][_0x7da6('0x6b')]?0x1f4:_0x43bc86[_0x7da6('0x6c')]||0x1f4;logger[_0x7da6('0x6d')](_0x7da6('0x6e'),'getFields',_0x56e002,JSON[_0x7da6('0x63')](_0x43bc86));delete _0x43bc86[_0x7da6('0x21')];if(_0x56e002===0x191){_0x56e002=0x190;}_0x775d32['status'](_0x56e002)[_0x7da6('0x6f')](_0x3d099d['query'][_0x7da6('0x6b')]?{'message':_0x7da6('0x70'),'statusCode':_0x43bc86['statusCode']}:_0x43bc86);});}else{var _0x49ddc5=0x1f4;_0x775d32[_0x7da6('0x14')](_0x49ddc5)[_0x7da6('0x6f')]({'message':_0x7da6('0x70'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xa6df=['values','module_fields','includes','label','endsWith','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','name','send','map','SugarcrmAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','channel','SugarcrmField','getFields','assigned_user_id','created_by','description','duration_hours','duration_minutes','parent_id','parent_type','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','/service/v4_1/rest.php','get_module_fields'];(function(_0x213dd1,_0x1496d8){var _0x2f439b=function(_0x63b68f){while(--_0x63b68f){_0x213dd1['push'](_0x213dd1['shift']());}};_0x2f439b(++_0x1496d8);}(_0xa6df,0x84));var _0xfa6d=function(_0x36ad55,_0x4b4846){_0x36ad55=_0x36ad55-0x0;var _0x13360a=_0xa6df[_0x36ad55];return _0x13360a;};'use strict';var emlformat=require(_0xfa6d('0x0'));var rimraf=require(_0xfa6d('0x1'));var zipdir=require(_0xfa6d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfa6d('0x3'));var BPromise=require(_0xfa6d('0x4'));var Mustache=require(_0xfa6d('0x5'));var util=require('util');var path=require(_0xfa6d('0x6'));var sox=require(_0xfa6d('0x7'));var csv=require(_0xfa6d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfa6d('0x9'));var squel=require(_0xfa6d('0xa'));var crypto=require(_0xfa6d('0xb'));var jsforce=require(_0xfa6d('0xc'));var deskjs=require(_0xfa6d('0xd'));var toCsv=require(_0xfa6d('0x8'));var querystring=require(_0xfa6d('0xe'));var Papa=require(_0xfa6d('0xf'));var Redis=require('ioredis');var authService=require(_0xfa6d('0x10'));var qs=require(_0xfa6d('0x11'));var as=require(_0xfa6d('0x12'));var hardwareService=require(_0xfa6d('0x13'));var logger=require(_0xfa6d('0x14'))(_0xfa6d('0x15'));var utils=require(_0xfa6d('0x16'));var config=require(_0xfa6d('0x17'));var licenseUtil=require(_0xfa6d('0x18'));var db=require(_0xfa6d('0x19'))['db'];var integrations=require(_0xfa6d('0x1a'));function respondWithStatusCode(_0x57bf1b,_0x5cfee9){_0x5cfee9=_0x5cfee9||0xcc;return function(_0x5d8102){if(_0x5d8102){return _0x57bf1b[_0xfa6d('0x1b')](_0x5cfee9);}return _0x57bf1b[_0xfa6d('0x1c')](_0x5cfee9)[_0xfa6d('0x1d')]();};}function respondWithResult(_0x3ab769,_0x40223a){_0x40223a=_0x40223a||0xc8;return function(_0x32582c){if(_0x32582c){return _0x3ab769[_0xfa6d('0x1c')](_0x40223a)[_0xfa6d('0x1e')](_0x32582c);}};}function respondWithFilteredResult(_0x3b33a3,_0x2c3089){return function(_0x15acf1){if(_0x15acf1){var _0x1bd15f=typeof _0x2c3089[_0xfa6d('0x1f')]===_0xfa6d('0x20')&&typeof _0x2c3089[_0xfa6d('0x21')]===_0xfa6d('0x20');var _0x531018=_0x15acf1[_0xfa6d('0x22')];var _0x3497fc=_0x1bd15f?0x0:_0x2c3089[_0xfa6d('0x1f')];var _0x4c0756=_0x1bd15f?_0x15acf1['count']:_0x2c3089[_0xfa6d('0x1f')]+_0x2c3089['limit'];var _0x2c6b62;if(_0x4c0756>=_0x531018){_0x4c0756=_0x531018;_0x2c6b62=0xc8;}else{_0x2c6b62=0xce;}_0x3b33a3[_0xfa6d('0x1c')](_0x2c6b62);return _0x3b33a3[_0xfa6d('0x23')](_0xfa6d('0x24'),_0x3497fc+'-'+_0x4c0756+'/'+_0x531018)['json'](_0x15acf1);}return null;};}function patchUpdates(_0x5c0953){return function(_0x79fd46){try{jsonpatch['apply'](_0x79fd46,_0x5c0953,!![]);}catch(_0x80b865){return BPromise[_0xfa6d('0x25')](_0x80b865);}return _0x79fd46[_0xfa6d('0x26')]();};}function saveUpdates(_0x4b7646,_0x976be8){return function(_0x386448){if(_0x386448){return _0x386448[_0xfa6d('0x27')](_0x4b7646)[_0xfa6d('0x28')](function(_0x48ca84){return _0x48ca84;});}return null;};}function removeEntity(_0x245f34,_0x265a4a){return function(_0x3918d1){if(_0x3918d1){return _0x3918d1[_0xfa6d('0x29')]()[_0xfa6d('0x28')](function(){_0x245f34[_0xfa6d('0x1c')](0xcc)[_0xfa6d('0x1d')]();});}};}function handleEntityNotFound(_0x2a9fd5,_0x38734b){return function(_0x409fb4){if(!_0x409fb4){_0x2a9fd5[_0xfa6d('0x1b')](0x194);}return _0x409fb4;};}function handleError(_0x41b6e5,_0x361024){_0x361024=_0x361024||0x1f4;return function(_0x4590d4){logger[_0xfa6d('0x2a')](_0x4590d4['stack']);if(_0x4590d4[_0xfa6d('0x2b')]){delete _0x4590d4[_0xfa6d('0x2b')];}_0x41b6e5[_0xfa6d('0x1c')](_0x361024)[_0xfa6d('0x2c')](_0x4590d4);};}exports['index']=function(_0xe26e67,_0x588b18){var _0x468dff={},_0x3ef130={},_0x36057b={'count':0x0,'rows':[]};var _0x439c49=_[_0xfa6d('0x2d')](db[_0xfa6d('0x2e')][_0xfa6d('0x2f')],function(_0x6c4704){return{'name':_0x6c4704['fieldName'],'type':_0x6c4704[_0xfa6d('0x30')][_0xfa6d('0x31')]};});_0x3ef130[_0xfa6d('0x32')]=_[_0xfa6d('0x2d')](_0x439c49,'name');_0x3ef130[_0xfa6d('0x33')]=_[_0xfa6d('0x34')](_0xe26e67[_0xfa6d('0x33')]);_0x3ef130[_0xfa6d('0x35')]=_[_0xfa6d('0x36')](_0x3ef130['model'],_0x3ef130[_0xfa6d('0x33')]);_0x468dff[_0xfa6d('0x37')]=_[_0xfa6d('0x36')](_0x3ef130[_0xfa6d('0x32')],qs[_0xfa6d('0x38')](_0xe26e67[_0xfa6d('0x33')]['fields']));_0x468dff['attributes']=_0x468dff[_0xfa6d('0x37')][_0xfa6d('0x39')]?_0x468dff[_0xfa6d('0x37')]:_0x3ef130[_0xfa6d('0x32')];if(!_0xe26e67[_0xfa6d('0x33')][_0xfa6d('0x3a')](_0xfa6d('0x3b'))){_0x468dff[_0xfa6d('0x21')]=qs[_0xfa6d('0x21')](_0xe26e67[_0xfa6d('0x33')][_0xfa6d('0x21')]);_0x468dff[_0xfa6d('0x1f')]=qs[_0xfa6d('0x1f')](_0xe26e67['query'][_0xfa6d('0x1f')]);}_0x468dff[_0xfa6d('0x3c')]=qs['sort'](_0xe26e67[_0xfa6d('0x33')][_0xfa6d('0x3d')]);_0x468dff[_0xfa6d('0x3e')]=qs[_0xfa6d('0x35')](_[_0xfa6d('0x3f')](_0xe26e67[_0xfa6d('0x33')],_0x3ef130[_0xfa6d('0x35')]),_0x439c49);if(_0xe26e67['query'][_0xfa6d('0x40')]){_0x468dff['where']=_['merge'](_0x468dff[_0xfa6d('0x3e')],{'$or':_[_0xfa6d('0x2d')](_0x439c49,function(_0x474763){if(_0x474763['type']!==_0xfa6d('0x41')){var _0x3bfc38={};_0x3bfc38[_0x474763[_0xfa6d('0x2b')]]={'$like':'%'+_0xe26e67[_0xfa6d('0x33')][_0xfa6d('0x40')]+'%'};return _0x3bfc38;}})});}_0x468dff=_[_0xfa6d('0x42')]({},_0x468dff,_0xe26e67[_0xfa6d('0x43')]);var _0x285f64={'where':_0x468dff['where']};return db[_0xfa6d('0x2e')]['count'](_0x285f64)[_0xfa6d('0x28')](function(_0x448bf4){_0x36057b['count']=_0x448bf4;if(_0xe26e67['query'][_0xfa6d('0x44')]){_0x468dff[_0xfa6d('0x45')]=[{'all':!![]}];}return db[_0xfa6d('0x2e')][_0xfa6d('0x46')](_0x468dff);})[_0xfa6d('0x28')](function(_0x17af51){_0x36057b[_0xfa6d('0x47')]=_0x17af51;return _0x36057b;})['then'](respondWithFilteredResult(_0x588b18,_0x468dff))[_0xfa6d('0x48')](handleError(_0x588b18,null));};exports[_0xfa6d('0x49')]=function(_0x56b57c,_0x2687b0){var _0x3df1a7={'raw':![],'where':{'id':_0x56b57c[_0xfa6d('0x4a')]['id']}},_0x154ef0={};_0x154ef0['model']=_[_0xfa6d('0x34')](db[_0xfa6d('0x2e')][_0xfa6d('0x2f')]);_0x154ef0[_0xfa6d('0x33')]=_[_0xfa6d('0x34')](_0x56b57c[_0xfa6d('0x33')]);_0x154ef0[_0xfa6d('0x35')]=_['intersection'](_0x154ef0[_0xfa6d('0x32')],_0x154ef0[_0xfa6d('0x33')]);_0x3df1a7[_0xfa6d('0x37')]=_[_0xfa6d('0x36')](_0x154ef0[_0xfa6d('0x32')],qs[_0xfa6d('0x38')](_0x56b57c[_0xfa6d('0x33')][_0xfa6d('0x38')]));_0x3df1a7[_0xfa6d('0x37')]=_0x3df1a7['attributes'][_0xfa6d('0x39')]?_0x3df1a7[_0xfa6d('0x37')]:_0x154ef0[_0xfa6d('0x32')];if(_0x56b57c[_0xfa6d('0x33')][_0xfa6d('0x44')]){_0x3df1a7[_0xfa6d('0x45')]=[{'all':!![]}];}_0x3df1a7=_[_0xfa6d('0x42')]({},_0x3df1a7,_0x56b57c['options']);return db[_0xfa6d('0x2e')][_0xfa6d('0x4b')](_0x3df1a7)[_0xfa6d('0x28')](handleEntityNotFound(_0x2687b0,null))[_0xfa6d('0x28')](respondWithResult(_0x2687b0,null))[_0xfa6d('0x48')](handleError(_0x2687b0,null));};exports[_0xfa6d('0x4c')]=function(_0x1a0324,_0x2bb299){return db[_0xfa6d('0x2e')][_0xfa6d('0x4c')](_0x1a0324[_0xfa6d('0x4d')],{})[_0xfa6d('0x28')](respondWithResult(_0x2bb299,0xc9))[_0xfa6d('0x48')](handleError(_0x2bb299,null));};exports[_0xfa6d('0x27')]=function(_0x541b65,_0x5a71cc){if(_0x541b65[_0xfa6d('0x4d')]['id']){delete _0x541b65[_0xfa6d('0x4d')]['id'];}return db[_0xfa6d('0x2e')][_0xfa6d('0x4b')]({'where':{'id':_0x541b65[_0xfa6d('0x4a')]['id']}})[_0xfa6d('0x28')](handleEntityNotFound(_0x5a71cc,null))[_0xfa6d('0x28')](saveUpdates(_0x541b65[_0xfa6d('0x4d')],null))[_0xfa6d('0x28')](respondWithResult(_0x5a71cc,null))[_0xfa6d('0x48')](handleError(_0x5a71cc,null));};exports[_0xfa6d('0x29')]=function(_0x2f5e60,_0x482fe4){return db['SugarcrmAccount']['find']({'where':{'id':_0x2f5e60[_0xfa6d('0x4a')]['id']}})[_0xfa6d('0x28')](handleEntityNotFound(_0x482fe4,null))[_0xfa6d('0x28')](removeEntity(_0x482fe4,null))[_0xfa6d('0x48')](handleError(_0x482fe4,null));};exports[_0xfa6d('0x4e')]=function(_0x38d1fb,_0x37772e,_0x1bf66b){var _0xa3e5c8={};var _0x1f74fd={};var _0x1de30c;var _0x227784;return db['SugarcrmAccount'][_0xfa6d('0x4f')]({'where':{'id':_0x38d1fb['params']['id']}})[_0xfa6d('0x28')](handleEntityNotFound(_0x37772e,null))[_0xfa6d('0x28')](function(_0x1936e2){if(_0x1936e2){_0x1de30c=_0x1936e2;_0x1f74fd[_0xfa6d('0x32')]=_['keys'](db[_0xfa6d('0x50')][_0xfa6d('0x2f')]);_0x1f74fd['query']=_[_0xfa6d('0x34')](_0x38d1fb[_0xfa6d('0x33')]);_0x1f74fd['filters']=_[_0xfa6d('0x36')](_0x1f74fd[_0xfa6d('0x32')],_0x1f74fd[_0xfa6d('0x33')]);_0xa3e5c8[_0xfa6d('0x37')]=_['intersection'](_0x1f74fd[_0xfa6d('0x32')],qs[_0xfa6d('0x38')](_0x38d1fb[_0xfa6d('0x33')]['fields']));_0xa3e5c8['attributes']=_0xa3e5c8['attributes'][_0xfa6d('0x39')]?_0xa3e5c8[_0xfa6d('0x37')]:_0x1f74fd['model'];_0xa3e5c8[_0xfa6d('0x3c')]=qs['sort'](_0x38d1fb['query'][_0xfa6d('0x3d')]);_0xa3e5c8['where']=qs[_0xfa6d('0x35')](_['pick'](_0x38d1fb['query'],_0x1f74fd['filters']));if(_0x38d1fb[_0xfa6d('0x33')][_0xfa6d('0x40')]){_0xa3e5c8['where']=_[_0xfa6d('0x42')](_0xa3e5c8[_0xfa6d('0x3e')],{'$or':_['map'](_0xa3e5c8[_0xfa6d('0x37')],function(_0x423122){var _0x3d706e={};_0x3d706e[_0x423122]={'$like':'%'+_0x38d1fb[_0xfa6d('0x33')]['filter']+'%'};return _0x3d706e;})});}_0xa3e5c8=_[_0xfa6d('0x42')]({},_0xa3e5c8,_0x38d1fb[_0xfa6d('0x43')]);return _0x1de30c[_0xfa6d('0x4e')](_0xa3e5c8);}})['then'](function(_0x117b02){if(_0x117b02){_0x227784=_0x117b02[_0xfa6d('0x39')];if(!_0x38d1fb[_0xfa6d('0x33')][_0xfa6d('0x3a')]('nolimit')){_0xa3e5c8[_0xfa6d('0x21')]=qs[_0xfa6d('0x21')](_0x38d1fb[_0xfa6d('0x33')][_0xfa6d('0x21')]);_0xa3e5c8[_0xfa6d('0x1f')]=qs[_0xfa6d('0x1f')](_0x38d1fb[_0xfa6d('0x33')][_0xfa6d('0x1f')]);}return _0x1de30c[_0xfa6d('0x4e')](_0xa3e5c8);}})[_0xfa6d('0x28')](function(_0x138490){if(_0x138490){return _0x138490?{'count':_0x227784,'rows':_0x138490}:null;}})['then'](respondWithResult(_0x37772e,null))[_0xfa6d('0x48')](handleError(_0x37772e,null));};exports[_0xfa6d('0x51')]=function(_0x17c61e,_0x53260f,_0x57a644){if(_0x17c61e[_0xfa6d('0x4d')]['id']){delete _0x17c61e[_0xfa6d('0x4d')]['id'];}return db[_0xfa6d('0x2e')]['findOne']({'where':{'id':_0x17c61e[_0xfa6d('0x4a')]['id']}})[_0xfa6d('0x28')](handleEntityNotFound(_0x53260f,null))[_0xfa6d('0x28')](function(_0x66b019){if(_0x66b019){_0x17c61e[_0xfa6d('0x4d')][_0xfa6d('0x52')]=_0x66b019['id'];_0x17c61e[_0xfa6d('0x4d')][_0xfa6d('0x53')]=integrations[_0xfa6d('0x54')](_0x17c61e[_0xfa6d('0x4d')]['channel'],_0x17c61e[_0xfa6d('0x4d')][_0xfa6d('0x30')]);_0x17c61e[_0xfa6d('0x4d')][_0xfa6d('0x55')]=integrations['getDescriptions'](_0x17c61e['body'][_0xfa6d('0x56')],_0x17c61e[_0xfa6d('0x4d')][_0xfa6d('0x30')]);return db[_0xfa6d('0x50')][_0xfa6d('0x4c')](_0x17c61e[_0xfa6d('0x4d')],{'include':[{'model':db[_0xfa6d('0x57')],'as':_0xfa6d('0x53')},{'model':db[_0xfa6d('0x57')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x53260f,null))[_0xfa6d('0x48')](handleError(_0x53260f,null));};exports[_0xfa6d('0x58')]=function(_0x20a908,_0x40a3f3,_0x1067d1){var _0x2fa9f3='';var _0xf5911c=['id',_0xfa6d('0x2b'),_0xfa6d('0x59'),_0xfa6d('0x5a'),_0xfa6d('0x5b'),'date_start',_0xfa6d('0x5c'),_0xfa6d('0x5d'),_0xfa6d('0x5e'),_0xfa6d('0x5f'),'parent_name','direction'];return db[_0xfa6d('0x2e')]['findOne']({'where':{'id':_0x20a908['params']['id']},'attributes':['id',_0xfa6d('0x60'),_0xfa6d('0x61'),'remoteUri']})[_0xfa6d('0x28')](handleEntityNotFound(_0x40a3f3,null))[_0xfa6d('0x28')](function(_0x42311a){if(_0x42311a){_0x2fa9f3=_0x42311a[_0xfa6d('0x62')];var _0x59256f=_0x2fa9f3[_0xfa6d('0x63')](-0x1);if(_0x59256f==='/'){_0x2fa9f3=_0x2fa9f3[_0xfa6d('0x64')](0x0,_0x2fa9f3[_0xfa6d('0x65')](_0x59256f));}return rp({'method':_0xfa6d('0x66'),'uri':util[_0xfa6d('0x67')](_0xfa6d('0x68'),_0x2fa9f3,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xfa6d('0x69'),'input_type':_0xfa6d('0x6a'),'response_type':'JSON','rest_data':JSON[_0xfa6d('0x6b')]({'user_auth':{'user_name':_0x42311a['username'],'password':_0x42311a[_0xfa6d('0x61')],'encryption':_0xfa6d('0x6c')},'application':_0xfa6d('0x6d')})}});}})[_0xfa6d('0x28')](function(_0x474b9e){if(_0x474b9e&&_0x474b9e['name']!==_0xfa6d('0x6e')&&_0x474b9e[_0xfa6d('0x2b')]!==_0xfa6d('0x6f')){return rp({'method':_0xfa6d('0x66'),'uri':util[_0xfa6d('0x67')](_0xfa6d('0x68'),_0x2fa9f3,_0xfa6d('0x70')),'json':!![],'form':{'method':_0xfa6d('0x71'),'input_type':_0xfa6d('0x6a'),'response_type':_0xfa6d('0x6a'),'rest_data':JSON['stringify']({'session':_0x474b9e['id'],'module_name':'Calls'})}})[_0xfa6d('0x28')](function(_0xebe6a9){if(_0xebe6a9){var _0x3e7edb=_[_0xfa6d('0x72')](_0xebe6a9[_0xfa6d('0x73')]);_['remove'](_0x3e7edb,function(_0x5db87d){return _0xf5911c[_0xfa6d('0x74')](_0x5db87d[_0xfa6d('0x2b')]);});return{'count':_0x3e7edb[_0xfa6d('0x39')],'rows':_[_0xfa6d('0x2d')](_0x3e7edb,function(_0x7d4c28){return{'id':_0x7d4c28[_0xfa6d('0x2b')],'name':_0x7d4c28[_0xfa6d('0x75')],'custom':_[_0xfa6d('0x76')](_0x7d4c28[_0xfa6d('0x2b')],'_c')?!![]:![],'options':_0x7d4c28[_0xfa6d('0x43')]?_[_0xfa6d('0x2d')](_['values'](_0x7d4c28[_0xfa6d('0x43')]),function(_0x5759e7){return{'name':_0x5759e7['value'],'value':_0x5759e7['name']};}):[]};})};}})['then'](respondWithResult(_0x40a3f3,null))['catch'](function(_0xca4f76){var _0x2791eb=_0x20a908[_0xfa6d('0x33')][_0xfa6d('0x77')]?0x1f4:_0xca4f76[_0xfa6d('0x78')]||0x1f4;logger[_0xfa6d('0x2a')](_0xfa6d('0x79'),'getFields',_0x2791eb,JSON[_0xfa6d('0x6b')](_0xca4f76));delete _0xca4f76[_0xfa6d('0x2b')];if(_0x2791eb===0x191){_0x2791eb=0x190;}_0x40a3f3[_0xfa6d('0x1c')](_0x2791eb)['send'](_0x20a908[_0xfa6d('0x33')][_0xfa6d('0x77')]?{'message':'Wrong\x20credentials','statusCode':_0xca4f76[_0xfa6d('0x78')]}:_0xca4f76);});}else{var _0x23b7ba=0x1f4;_0x40a3f3[_0xfa6d('0x1c')](_0x23b7ba)[_0xfa6d('0x2c')]({'message':_0xfa6d('0x7a'),'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 1d99fff..657ffe9 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 _0x5a3c=['bluebird','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','moment'];(function(_0x2ca4da,_0x58caa2){var _0x274be1=function(_0x327c1f){while(--_0x327c1f){_0x2ca4da['push'](_0x2ca4da['shift']());}};_0x274be1(++_0x58caa2);}(_0x5a3c,0x176));var _0xc5a3=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0x5a3c[_0x710815];return _0x5b3b89;};'use strict';var _=require(_0xc5a3('0x0'));var util=require(_0xc5a3('0x1'));var logger=require(_0xc5a3('0x2'))('api');var moment=require(_0xc5a3('0x3'));var BPromise=require(_0xc5a3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc5a3('0x5'));var rimraf=require(_0xc5a3('0x6'));var config=require(_0xc5a3('0x7'));var attributes=require(_0xc5a3('0x8'));var integrations=require(_0xc5a3('0x9'));module[_0xc5a3('0xa')]=function(_0xb0f633,_0x18657f){return _0xb0f633[_0xc5a3('0xb')](_0xc5a3('0xc'),attributes,{'tableName':_0xc5a3('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdeb3=['path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','exports','SugarcrmAccount','int_sugarcrm_accounts','util','../../config/logger','api','request-promise'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xdeb3,0xb7));var _0x3deb=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xdeb3[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x3deb('0x0'));var logger=require(_0x3deb('0x1'))(_0x3deb('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3deb('0x3'));var fs=require('fs');var path=require(_0x3deb('0x4'));var rimraf=require(_0x3deb('0x5'));var config=require(_0x3deb('0x6'));var attributes=require(_0x3deb('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x3deb('0x8')]=function(_0x47d2d4,_0x469e98){return _0x47d2d4['define'](_0x3deb('0x9'),attributes,{'tableName':_0x3deb('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 811cb6d..1bbcafd 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 _0x19ec=['options','raw','where','attributes','limit','map','include','model','GetSugarcrmAccount','stringify','find','ShowSugarcrmAccount','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','message','info','SugarcrmAccount,\x20%s,\x20%s','result','catch','SugarcrmAccount'];(function(_0x2f6db8,_0x405d8d){var _0x2f9a83=function(_0x4b20fa){while(--_0x4b20fa){_0x2f6db8['push'](_0x2f6db8['shift']());}};_0x2f9a83(++_0x405d8d);}(_0x19ec,0x72));var _0xc19e=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x19ec[_0x6cf19c];return _0xce14f3;};'use strict';var _=require('lodash');var util=require(_0xc19e('0x0'));var moment=require(_0xc19e('0x1'));var BPromise=require(_0xc19e('0x2'));var rs=require(_0xc19e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc19e('0x4'))['db'];var utils=require(_0xc19e('0x5'));var logger=require(_0xc19e('0x6'))(_0xc19e('0x7'));var config=require('../../config/environment');var jayson=require(_0xc19e('0x8'));var client=jayson[_0xc19e('0x9')][_0xc19e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5f3888,_0xffd539,_0x4887c4){return new BPromise(function(_0xdeb1b,_0x297605){return client['request'](_0x5f3888,_0x4887c4)[_0xc19e('0xb')](function(_0xea7c74){logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0xffd539,_0xc19e('0xc'));logger[_0xc19e('0xd')](_0xc19e('0xe'),_0xffd539,_0xc19e('0xc'),JSON['stringify'](_0xea7c74));if(_0xea7c74[_0xc19e('0xf')]){if(_0xea7c74[_0xc19e('0xf')]['code']===0x1f4){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0xffd539,_0xea7c74[_0xc19e('0xf')]['message']);return _0x297605(_0xea7c74['error'][_0xc19e('0x10')]);}logger[_0xc19e('0xf')]('SugarcrmAccount,\x20%s,\x20%s',_0xffd539,_0xea7c74[_0xc19e('0xf')][_0xc19e('0x10')]);return _0xdeb1b(_0xea7c74[_0xc19e('0xf')][_0xc19e('0x10')]);}else{logger[_0xc19e('0x11')](_0xc19e('0x12'),_0xffd539,_0xc19e('0xc'));_0xdeb1b(_0xea7c74[_0xc19e('0x13')]['message']);}})[_0xc19e('0x14')](function(_0x324ae1){logger[_0xc19e('0xf')](_0xc19e('0x12'),_0xffd539,_0x324ae1);_0x297605(_0x324ae1);});});}exports['GetSugarcrmAccount']=function(_0x531772){var _0x554f5d=this;return new Promise(function(_0x3260cb,_0x7f211f){return db[_0xc19e('0x15')]['findAll']({'raw':_0x531772['options']?_0x531772[_0xc19e('0x16')][_0xc19e('0x17')]===undefined?!![]:![]:!![],'where':_0x531772[_0xc19e('0x16')]?_0x531772[_0xc19e('0x16')][_0xc19e('0x18')]||null:null,'attributes':_0x531772[_0xc19e('0x16')]?_0x531772['options'][_0xc19e('0x19')]||null:null,'limit':_0x531772[_0xc19e('0x16')]?_0x531772[_0xc19e('0x16')][_0xc19e('0x1a')]||null:null,'include':_0x531772['options']?_0x531772['options']['include']?_[_0xc19e('0x1b')](_0x531772['options'][_0xc19e('0x1c')],function(_0x209427){return{'model':db[_0x209427['model']],'as':_0x209427['as'],'attributes':_0x209427[_0xc19e('0x19')],'include':_0x209427[_0xc19e('0x1c')]?_[_0xc19e('0x1b')](_0x209427[_0xc19e('0x1c')],function(_0x1ab31b){return{'model':db[_0x1ab31b[_0xc19e('0x1d')]],'as':_0x1ab31b['as'],'attributes':_0x1ab31b[_0xc19e('0x19')],'include':_0x1ab31b[_0xc19e('0x1c')]?_[_0xc19e('0x1b')](_0x1ab31b['include'],function(_0x49406e){return{'model':db[_0x49406e[_0xc19e('0x1d')]],'as':_0x49406e['as'],'attributes':_0x49406e[_0xc19e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x57f72c){logger[_0xc19e('0x11')](_0xc19e('0x1e'),_0x531772);logger['debug'](_0xc19e('0x1e'),_0x531772,JSON[_0xc19e('0x1f')](_0x57f72c));_0x3260cb(_0x57f72c);})[_0xc19e('0x14')](function(_0x34200a){logger['error'](_0xc19e('0x1e'),_0x34200a[_0xc19e('0x10')],_0x531772);_0x7f211f(_0x554f5d[_0xc19e('0xf')](0x1f4,_0x34200a['message']));});});};exports['ShowSugarcrmAccount']=function(_0x2b5f8b){var _0x34d3e0=this;return new Promise(function(_0x4085d8,_0x3eceba){return db[_0xc19e('0x15')][_0xc19e('0x20')]({'raw':_0x2b5f8b[_0xc19e('0x16')]?_0x2b5f8b[_0xc19e('0x16')][_0xc19e('0x17')]===undefined?!![]:![]:!![],'where':_0x2b5f8b['options']?_0x2b5f8b['options'][_0xc19e('0x18')]||null:null,'attributes':_0x2b5f8b[_0xc19e('0x16')]?_0x2b5f8b[_0xc19e('0x16')]['attributes']||null:null,'include':_0x2b5f8b[_0xc19e('0x16')]?_0x2b5f8b['options']['include']?_[_0xc19e('0x1b')](_0x2b5f8b[_0xc19e('0x16')][_0xc19e('0x1c')],function(_0x140fcb){return{'model':db[_0x140fcb[_0xc19e('0x1d')]],'as':_0x140fcb['as'],'attributes':_0x140fcb[_0xc19e('0x19')],'include':_0x140fcb[_0xc19e('0x1c')]?_[_0xc19e('0x1b')](_0x140fcb['include'],function(_0xa2015){return{'model':db[_0xa2015[_0xc19e('0x1d')]],'as':_0xa2015['as'],'attributes':_0xa2015[_0xc19e('0x19')],'include':_0xa2015[_0xc19e('0x1c')]?_['map'](_0xa2015[_0xc19e('0x1c')],function(_0x325172){return{'model':db[_0x325172[_0xc19e('0x1d')]],'as':_0x325172['as'],'attributes':_0x325172[_0xc19e('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc19e('0xb')](function(_0x3cdec9){logger[_0xc19e('0x11')](_0xc19e('0x21'),_0x2b5f8b);logger['debug'](_0xc19e('0x21'),_0x2b5f8b,JSON[_0xc19e('0x1f')](_0x3cdec9));_0x4085d8(_0x3cdec9);})[_0xc19e('0x14')](function(_0x38c4e6){logger[_0xc19e('0xf')]('ShowSugarcrmAccount',_0x38c4e6[_0xc19e('0x10')],_0x2b5f8b);_0x3eceba(_0x34d3e0[_0xc19e('0xf')](0x1f4,_0x38c4e6[_0xc19e('0x10')]));});});}; \ No newline at end of file +var _0xdd50=['message','info','result','catch','findAll','options','raw','where','attributes','include','map','model','GetSugarcrmAccount','ShowSugarcrmAccount','SugarcrmAccount','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x2998db,_0x3424f1){var _0x115fea=function(_0x3b493c){while(--_0x3b493c){_0x2998db['push'](_0x2998db['shift']());}};_0x115fea(++_0x3424f1);}(_0xdd50,0x1b4));var _0x0dd5=function(_0xcdf809,_0x2881f0){_0xcdf809=_0xcdf809-0x0;var _0x4d4d70=_0xdd50[_0xcdf809];return _0x4d4d70;};'use strict';var _=require(_0x0dd5('0x0'));var util=require(_0x0dd5('0x1'));var moment=require(_0x0dd5('0x2'));var BPromise=require(_0x0dd5('0x3'));var rs=require(_0x0dd5('0x4'));var fs=require('fs');var Redis=require(_0x0dd5('0x5'));var db=require(_0x0dd5('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0dd5('0x7'))(_0x0dd5('0x8'));var config=require(_0x0dd5('0x9'));var jayson=require(_0x0dd5('0xa'));var client=jayson['client'][_0x0dd5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x6e7933,_0x16a61a,_0x500ef0){return new BPromise(function(_0x1c863a,_0x4be139){return client[_0x0dd5('0xc')](_0x6e7933,_0x500ef0)['then'](function(_0x2015b7){logger['info'](_0x0dd5('0xd'),_0x16a61a,_0x0dd5('0xe'));logger[_0x0dd5('0xf')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x16a61a,_0x0dd5('0xe'),JSON[_0x0dd5('0x10')](_0x2015b7));if(_0x2015b7[_0x0dd5('0x11')]){if(_0x2015b7[_0x0dd5('0x11')][_0x0dd5('0x12')]===0x1f4){logger[_0x0dd5('0x11')](_0x0dd5('0xd'),_0x16a61a,_0x2015b7[_0x0dd5('0x11')][_0x0dd5('0x13')]);return _0x4be139(_0x2015b7[_0x0dd5('0x11')][_0x0dd5('0x13')]);}logger[_0x0dd5('0x11')](_0x0dd5('0xd'),_0x16a61a,_0x2015b7[_0x0dd5('0x11')][_0x0dd5('0x13')]);return _0x1c863a(_0x2015b7['error']['message']);}else{logger[_0x0dd5('0x14')](_0x0dd5('0xd'),_0x16a61a,_0x0dd5('0xe'));_0x1c863a(_0x2015b7[_0x0dd5('0x15')][_0x0dd5('0x13')]);}})[_0x0dd5('0x16')](function(_0x5e5988){logger[_0x0dd5('0x11')](_0x0dd5('0xd'),_0x16a61a,_0x5e5988);_0x4be139(_0x5e5988);});});}exports['GetSugarcrmAccount']=function(_0x3745d3){var _0x426fbc=this;return new Promise(function(_0x185fe4,_0x54d739){return db['SugarcrmAccount'][_0x0dd5('0x17')]({'raw':_0x3745d3[_0x0dd5('0x18')]?_0x3745d3[_0x0dd5('0x18')][_0x0dd5('0x19')]===undefined?!![]:![]:!![],'where':_0x3745d3[_0x0dd5('0x18')]?_0x3745d3[_0x0dd5('0x18')][_0x0dd5('0x1a')]||null:null,'attributes':_0x3745d3['options']?_0x3745d3[_0x0dd5('0x18')][_0x0dd5('0x1b')]||null:null,'limit':_0x3745d3[_0x0dd5('0x18')]?_0x3745d3[_0x0dd5('0x18')]['limit']||null:null,'include':_0x3745d3[_0x0dd5('0x18')]?_0x3745d3[_0x0dd5('0x18')][_0x0dd5('0x1c')]?_[_0x0dd5('0x1d')](_0x3745d3[_0x0dd5('0x18')][_0x0dd5('0x1c')],function(_0x31b436){return{'model':db[_0x31b436[_0x0dd5('0x1e')]],'as':_0x31b436['as'],'attributes':_0x31b436['attributes'],'include':_0x31b436[_0x0dd5('0x1c')]?_['map'](_0x31b436[_0x0dd5('0x1c')],function(_0x12261a){return{'model':db[_0x12261a[_0x0dd5('0x1e')]],'as':_0x12261a['as'],'attributes':_0x12261a[_0x0dd5('0x1b')],'include':_0x12261a[_0x0dd5('0x1c')]?_[_0x0dd5('0x1d')](_0x12261a[_0x0dd5('0x1c')],function(_0x4bb0d8){return{'model':db[_0x4bb0d8['model']],'as':_0x4bb0d8['as'],'attributes':_0x4bb0d8[_0x0dd5('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a1646){logger[_0x0dd5('0x14')](_0x0dd5('0x1f'),_0x3745d3);logger[_0x0dd5('0xf')](_0x0dd5('0x1f'),_0x3745d3,JSON[_0x0dd5('0x10')](_0x2a1646));_0x185fe4(_0x2a1646);})[_0x0dd5('0x16')](function(_0x1455e6){logger['error'](_0x0dd5('0x1f'),_0x1455e6[_0x0dd5('0x13')],_0x3745d3);_0x54d739(_0x426fbc[_0x0dd5('0x11')](0x1f4,_0x1455e6[_0x0dd5('0x13')]));});});};exports[_0x0dd5('0x20')]=function(_0xba2b04){var _0x500286=this;return new Promise(function(_0x125bd7,_0x149d09){return db[_0x0dd5('0x21')]['find']({'raw':_0xba2b04[_0x0dd5('0x18')]?_0xba2b04[_0x0dd5('0x18')][_0x0dd5('0x19')]===undefined?!![]:![]:!![],'where':_0xba2b04['options']?_0xba2b04[_0x0dd5('0x18')][_0x0dd5('0x1a')]||null:null,'attributes':_0xba2b04[_0x0dd5('0x18')]?_0xba2b04[_0x0dd5('0x18')][_0x0dd5('0x1b')]||null:null,'include':_0xba2b04[_0x0dd5('0x18')]?_0xba2b04['options'][_0x0dd5('0x1c')]?_['map'](_0xba2b04[_0x0dd5('0x18')][_0x0dd5('0x1c')],function(_0x1f84cb){return{'model':db[_0x1f84cb['model']],'as':_0x1f84cb['as'],'attributes':_0x1f84cb[_0x0dd5('0x1b')],'include':_0x1f84cb[_0x0dd5('0x1c')]?_[_0x0dd5('0x1d')](_0x1f84cb[_0x0dd5('0x1c')],function(_0x1e1766){return{'model':db[_0x1e1766['model']],'as':_0x1e1766['as'],'attributes':_0x1e1766[_0x0dd5('0x1b')],'include':_0x1e1766[_0x0dd5('0x1c')]?_['map'](_0x1e1766[_0x0dd5('0x1c')],function(_0x5ccdf9){return{'model':db[_0x5ccdf9[_0x0dd5('0x1e')]],'as':_0x5ccdf9['as'],'attributes':_0x5ccdf9['attributes']};}):[]};}):[]};}):[]:[]})[_0x0dd5('0x22')](function(_0x514114){logger[_0x0dd5('0x14')](_0x0dd5('0x20'),_0xba2b04);logger[_0x0dd5('0xf')](_0x0dd5('0x20'),_0xba2b04,JSON[_0x0dd5('0x10')](_0x514114));_0x125bd7(_0x514114);})[_0x0dd5('0x16')](function(_0x1ef2ce){logger[_0x0dd5('0x11')](_0x0dd5('0x20'),_0x1ef2ce[_0x0dd5('0x13')],_0xba2b04);_0x149d09(_0x500286[_0x0dd5('0x11')](0x1f4,_0x1ef2ce[_0x0dd5('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 3d3e157..732eafd 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 _0xe1fa=['/:id/subjects','getSubjects','post','create','put','/:id','update','delete','exports','util','path','connect-timeout','express','Router','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','getFields'];(function(_0x4caa0f,_0x234380){var _0x1f1611=function(_0x324ce7){while(--_0x324ce7){_0x4caa0f['push'](_0x4caa0f['shift']());}};_0x1f1611(++_0x234380);}(_0xe1fa,0x172));var _0xae1f=function(_0x1d2101,_0x5407ce){_0x1d2101=_0x1d2101-0x0;var _0x4c0d11=_0xe1fa[_0x1d2101];return _0x4c0d11;};'use strict';var multer=require('multer');var util=require(_0xae1f('0x0'));var path=require(_0xae1f('0x1'));var timeout=require(_0xae1f('0x2'));var express=require(_0xae1f('0x3'));var router=express[_0xae1f('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xae1f('0x5'));var controller=require(_0xae1f('0x6'));router[_0xae1f('0x7')]('/',auth[_0xae1f('0x8')](),controller['index']);router[_0xae1f('0x7')]('/:id',auth[_0xae1f('0x8')](),controller['show']);router[_0xae1f('0x7')]('/:id/fields',auth[_0xae1f('0x8')](),controller[_0xae1f('0x9')]);router[_0xae1f('0x7')](_0xae1f('0xa'),auth[_0xae1f('0x8')](),controller[_0xae1f('0xb')]);router['get']('/:id/descriptions',auth[_0xae1f('0x8')](),controller['getDescriptions']);router[_0xae1f('0xc')]('/',auth[_0xae1f('0x8')](),controller[_0xae1f('0xd')]);router[_0xae1f('0xe')](_0xae1f('0xf'),auth[_0xae1f('0x8')](),controller[_0xae1f('0x10')]);router[_0xae1f('0x11')]('/:id',auth[_0xae1f('0x8')](),controller['destroy']);module[_0xae1f('0x12')]=router; \ No newline at end of file +var _0xea08=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','update','destroy','exports','multer'];(function(_0x15ce21,_0x303f0b){var _0x43c6e8=function(_0x4377a1){while(--_0x4377a1){_0x15ce21['push'](_0x15ce21['shift']());}};_0x43c6e8(++_0x303f0b);}(_0xea08,0x144));var _0x8ea0=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xea08[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x8ea0('0x0'));var util=require(_0x8ea0('0x1'));var path=require(_0x8ea0('0x2'));var timeout=require(_0x8ea0('0x3'));var express=require(_0x8ea0('0x4'));var router=express[_0x8ea0('0x5')]();var fs_extra=require(_0x8ea0('0x6'));var auth=require(_0x8ea0('0x7'));var interaction=require(_0x8ea0('0x8'));var config=require(_0x8ea0('0x9'));var controller=require(_0x8ea0('0xa'));router[_0x8ea0('0xb')]('/',auth[_0x8ea0('0xc')](),controller[_0x8ea0('0xd')]);router[_0x8ea0('0xb')](_0x8ea0('0xe'),auth['isAuthenticated'](),controller[_0x8ea0('0xf')]);router[_0x8ea0('0xb')](_0x8ea0('0x10'),auth['isAuthenticated'](),controller['getFields']);router[_0x8ea0('0xb')](_0x8ea0('0x11'),auth[_0x8ea0('0xc')](),controller[_0x8ea0('0x12')]);router[_0x8ea0('0xb')](_0x8ea0('0x13'),auth[_0x8ea0('0xc')](),controller[_0x8ea0('0x14')]);router['post']('/',auth[_0x8ea0('0xc')](),controller[_0x8ea0('0x15')]);router['put']('/:id',auth[_0x8ea0('0xc')](),controller[_0x8ea0('0x16')]);router['delete'](_0x8ea0('0xe'),auth['isAuthenticated'](),controller[_0x8ea0('0x17')]);module[_0x8ea0('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index eb8fd9b..3a23171 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 _0xdd6b=['exports','STRING','sequelize'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xdd6b,0x1b5));var _0xbdd6=function(_0x222391,_0x48c523){_0x222391=_0x222391-0x0;var _0x18816b=_0xdd6b[_0x222391];return _0x18816b;};'use strict';var Sequelize=require(_0xbdd6('0x0'));module[_0xbdd6('0x1')]={'name':{'type':Sequelize[_0xbdd6('0x2')]},'description':{'type':Sequelize[_0xbdd6('0x2')]}}; \ No newline at end of file +var _0xf7d7=['sequelize','exports','STRING'];(function(_0x3d2fc5,_0x50339c){var _0x18d515=function(_0x5b48da){while(--_0x5b48da){_0x3d2fc5['push'](_0x3d2fc5['shift']());}};_0x18d515(++_0x50339c);}(_0xf7d7,0xcc));var _0x7f7d=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xf7d7[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0x7f7d('0x0'));module[_0x7f7d('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7f7d('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index ac36982..c406606 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 _0x0aed=['findAll','rows','catch','params','options','find','create','body','getFields','findOne','SugarcrmField','hasOwnProperty','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','destroy','then','error','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include'];(function(_0x1ea82f,_0x484b10){var _0xc58431=function(_0x18a463){while(--_0x18a463){_0x1ea82f['push'](_0x1ea82f['shift']());}};_0xc58431(++_0x484b10);}(_0x0aed,0x1f4));var _0xd0ae=function(_0x2db025,_0x1cf6de){_0x2db025=_0x2db025-0x0;var _0x47afbe=_0x0aed[_0x2db025];return _0x47afbe;};'use strict';var emlformat=require(_0xd0ae('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd0ae('0x1'));var jsonpatch=require(_0xd0ae('0x2'));var rp=require(_0xd0ae('0x3'));var moment=require(_0xd0ae('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd0ae('0x5'));var util=require(_0xd0ae('0x6'));var path=require(_0xd0ae('0x7'));var sox=require(_0xd0ae('0x8'));var csv=require(_0xd0ae('0x9'));var ejs=require(_0xd0ae('0xa'));var fs=require('fs');var fs_extra=require(_0xd0ae('0xb'));var _=require(_0xd0ae('0xc'));var squel=require(_0xd0ae('0xd'));var crypto=require(_0xd0ae('0xe'));var jsforce=require(_0xd0ae('0xf'));var deskjs=require(_0xd0ae('0x10'));var toCsv=require('to-csv');var querystring=require(_0xd0ae('0x11'));var Papa=require(_0xd0ae('0x12'));var Redis=require(_0xd0ae('0x13'));var authService=require(_0xd0ae('0x14'));var qs=require(_0xd0ae('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd0ae('0x16'));var logger=require('../../config/logger')(_0xd0ae('0x17'));var utils=require('../../config/utils');var config=require(_0xd0ae('0x18'));var licenseUtil=require(_0xd0ae('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f7d99,_0x373492){_0x373492=_0x373492||0xcc;return function(_0x29f540){if(_0x29f540){return _0x1f7d99['sendStatus'](_0x373492);}return _0x1f7d99[_0xd0ae('0x1a')](_0x373492)[_0xd0ae('0x1b')]();};}function respondWithResult(_0x37ce78,_0x50422c){_0x50422c=_0x50422c||0xc8;return function(_0x17d935){if(_0x17d935){return _0x37ce78[_0xd0ae('0x1a')](_0x50422c)['json'](_0x17d935);}};}function respondWithFilteredResult(_0x455eda,_0x2c0565){return function(_0x282033){if(_0x282033){var _0x4624bf=typeof _0x2c0565['offset']===_0xd0ae('0x1c')&&typeof _0x2c0565[_0xd0ae('0x1d')]===_0xd0ae('0x1c');var _0x1d2b0e=_0x282033[_0xd0ae('0x1e')];var _0x73b252=_0x4624bf?0x0:_0x2c0565[_0xd0ae('0x1f')];var _0x3282ff=_0x4624bf?_0x282033[_0xd0ae('0x1e')]:_0x2c0565[_0xd0ae('0x1f')]+_0x2c0565['limit'];var _0x380f7b;if(_0x3282ff>=_0x1d2b0e){_0x3282ff=_0x1d2b0e;_0x380f7b=0xc8;}else{_0x380f7b=0xce;}_0x455eda[_0xd0ae('0x1a')](_0x380f7b);return _0x455eda[_0xd0ae('0x20')](_0xd0ae('0x21'),_0x73b252+'-'+_0x3282ff+'/'+_0x1d2b0e)[_0xd0ae('0x22')](_0x282033);}return null;};}function patchUpdates(_0xb40a3e){return function(_0xc34bb){try{jsonpatch[_0xd0ae('0x23')](_0xc34bb,_0xb40a3e,!![]);}catch(_0xbb9c4d){return BPromise['reject'](_0xbb9c4d);}return _0xc34bb[_0xd0ae('0x24')]();};}function saveUpdates(_0x4ee4ff,_0x25912e){return function(_0x29471d){if(_0x29471d){return _0x29471d[_0xd0ae('0x25')](_0x4ee4ff)['then'](function(_0x568d77){return _0x568d77;});}return null;};}function removeEntity(_0x5824bb,_0x1c36a6){return function(_0x4bb31f){if(_0x4bb31f){return _0x4bb31f[_0xd0ae('0x26')]()[_0xd0ae('0x27')](function(){_0x5824bb[_0xd0ae('0x1a')](0xcc)[_0xd0ae('0x1b')]();});}};}function handleEntityNotFound(_0x2c51c4,_0x476216){return function(_0xaaaed4){if(!_0xaaaed4){_0x2c51c4['sendStatus'](0x194);}return _0xaaaed4;};}function handleError(_0x360fcc,_0x107114){_0x107114=_0x107114||0x1f4;return function(_0x2c98dd){logger[_0xd0ae('0x28')](_0x2c98dd['stack']);if(_0x2c98dd[_0xd0ae('0x29')]){delete _0x2c98dd['name'];}_0x360fcc[_0xd0ae('0x1a')](_0x107114)[_0xd0ae('0x2a')](_0x2c98dd);};}exports[_0xd0ae('0x2b')]=function(_0x1d1d2d,_0x441701){var _0x5afdbd={},_0x148491={},_0x2adccb={'count':0x0,'rows':[]};var _0x50e2bc=_[_0xd0ae('0x2c')](db[_0xd0ae('0x2d')][_0xd0ae('0x2e')],function(_0x3b5e88){return{'name':_0x3b5e88[_0xd0ae('0x2f')],'type':_0x3b5e88[_0xd0ae('0x30')][_0xd0ae('0x31')]};});_0x148491[_0xd0ae('0x32')]=_[_0xd0ae('0x2c')](_0x50e2bc,'name');_0x148491[_0xd0ae('0x33')]=_[_0xd0ae('0x34')](_0x1d1d2d[_0xd0ae('0x33')]);_0x148491[_0xd0ae('0x35')]=_[_0xd0ae('0x36')](_0x148491[_0xd0ae('0x32')],_0x148491[_0xd0ae('0x33')]);_0x5afdbd[_0xd0ae('0x37')]=_[_0xd0ae('0x36')](_0x148491[_0xd0ae('0x32')],qs[_0xd0ae('0x38')](_0x1d1d2d[_0xd0ae('0x33')][_0xd0ae('0x38')]));_0x5afdbd[_0xd0ae('0x37')]=_0x5afdbd['attributes'][_0xd0ae('0x39')]?_0x5afdbd['attributes']:_0x148491[_0xd0ae('0x32')];if(!_0x1d1d2d[_0xd0ae('0x33')]['hasOwnProperty'](_0xd0ae('0x3a'))){_0x5afdbd[_0xd0ae('0x1d')]=qs['limit'](_0x1d1d2d[_0xd0ae('0x33')]['limit']);_0x5afdbd[_0xd0ae('0x1f')]=qs['offset'](_0x1d1d2d[_0xd0ae('0x33')][_0xd0ae('0x1f')]);}_0x5afdbd[_0xd0ae('0x3b')]=qs[_0xd0ae('0x3c')](_0x1d1d2d[_0xd0ae('0x33')]['sort']);_0x5afdbd[_0xd0ae('0x3d')]=qs[_0xd0ae('0x35')](_[_0xd0ae('0x3e')](_0x1d1d2d[_0xd0ae('0x33')],_0x148491[_0xd0ae('0x35')]),_0x50e2bc);if(_0x1d1d2d[_0xd0ae('0x33')][_0xd0ae('0x3f')]){_0x5afdbd['where']=_[_0xd0ae('0x40')](_0x5afdbd[_0xd0ae('0x3d')],{'$or':_['map'](_0x50e2bc,function(_0x25f96a){if(_0x25f96a['type']!==_0xd0ae('0x41')){var _0x4b5b48={};_0x4b5b48[_0x25f96a[_0xd0ae('0x29')]]={'$like':'%'+_0x1d1d2d[_0xd0ae('0x33')][_0xd0ae('0x3f')]+'%'};return _0x4b5b48;}})});}_0x5afdbd=_['merge']({},_0x5afdbd,_0x1d1d2d['options']);var _0x3b44c6={'where':_0x5afdbd[_0xd0ae('0x3d')]};return db[_0xd0ae('0x2d')][_0xd0ae('0x1e')](_0x3b44c6)[_0xd0ae('0x27')](function(_0x51d079){_0x2adccb[_0xd0ae('0x1e')]=_0x51d079;if(_0x1d1d2d['query']['includeAll']){_0x5afdbd[_0xd0ae('0x42')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0xd0ae('0x43')](_0x5afdbd);})['then'](function(_0x2e8e10){_0x2adccb[_0xd0ae('0x44')]=_0x2e8e10;return _0x2adccb;})[_0xd0ae('0x27')](respondWithFilteredResult(_0x441701,_0x5afdbd))[_0xd0ae('0x45')](handleError(_0x441701,null));};exports['show']=function(_0x9e7560,_0x1dce1a){var _0x544b4a={'raw':![],'where':{'id':_0x9e7560[_0xd0ae('0x46')]['id']}},_0x416ce0={};_0x416ce0['model']=_[_0xd0ae('0x34')](db[_0xd0ae('0x2d')][_0xd0ae('0x2e')]);_0x416ce0[_0xd0ae('0x33')]=_['keys'](_0x9e7560['query']);_0x416ce0[_0xd0ae('0x35')]=_['intersection'](_0x416ce0[_0xd0ae('0x32')],_0x416ce0[_0xd0ae('0x33')]);_0x544b4a['attributes']=_[_0xd0ae('0x36')](_0x416ce0[_0xd0ae('0x32')],qs[_0xd0ae('0x38')](_0x9e7560[_0xd0ae('0x33')][_0xd0ae('0x38')]));_0x544b4a[_0xd0ae('0x37')]=_0x544b4a[_0xd0ae('0x37')][_0xd0ae('0x39')]?_0x544b4a[_0xd0ae('0x37')]:_0x416ce0[_0xd0ae('0x32')];if(_0x9e7560[_0xd0ae('0x33')]['includeAll']){_0x544b4a['include']=[{'all':!![]}];}_0x544b4a=_['merge']({},_0x544b4a,_0x9e7560[_0xd0ae('0x47')]);return db[_0xd0ae('0x2d')][_0xd0ae('0x48')](_0x544b4a)['then'](handleEntityNotFound(_0x1dce1a,null))['then'](respondWithResult(_0x1dce1a,null))[_0xd0ae('0x45')](handleError(_0x1dce1a,null));};exports['create']=function(_0x4a6bcd,_0x4d54b1){return db[_0xd0ae('0x2d')][_0xd0ae('0x49')](_0x4a6bcd[_0xd0ae('0x4a')],{})['then'](respondWithResult(_0x4d54b1,0xc9))[_0xd0ae('0x45')](handleError(_0x4d54b1,null));};exports[_0xd0ae('0x25')]=function(_0x3995d8,_0x52224d){if(_0x3995d8['body']['id']){delete _0x3995d8[_0xd0ae('0x4a')]['id'];}return db[_0xd0ae('0x2d')][_0xd0ae('0x48')]({'where':{'id':_0x3995d8[_0xd0ae('0x46')]['id']}})['then'](handleEntityNotFound(_0x52224d,null))['then'](saveUpdates(_0x3995d8[_0xd0ae('0x4a')],null))[_0xd0ae('0x27')](respondWithResult(_0x52224d,null))[_0xd0ae('0x45')](handleError(_0x52224d,null));};exports['destroy']=function(_0x42638,_0x37b73e){return db[_0xd0ae('0x2d')][_0xd0ae('0x48')]({'where':{'id':_0x42638['params']['id']}})[_0xd0ae('0x27')](handleEntityNotFound(_0x37b73e,null))[_0xd0ae('0x27')](removeEntity(_0x37b73e,null))[_0xd0ae('0x45')](handleError(_0x37b73e,null));};exports[_0xd0ae('0x4b')]=function(_0x4eb038,_0x6e024e,_0x2589a3){var _0x46bc7e={};var _0x3d6b38={};var _0x4fd0a7;var _0x338184;return db[_0xd0ae('0x2d')][_0xd0ae('0x4c')]({'where':{'id':_0x4eb038[_0xd0ae('0x46')]['id']}})['then'](handleEntityNotFound(_0x6e024e,null))[_0xd0ae('0x27')](function(_0x49ce71){if(_0x49ce71){_0x4fd0a7=_0x49ce71;_0x3d6b38[_0xd0ae('0x32')]=_[_0xd0ae('0x34')](db[_0xd0ae('0x4d')][_0xd0ae('0x2e')]);_0x3d6b38[_0xd0ae('0x33')]=_[_0xd0ae('0x34')](_0x4eb038[_0xd0ae('0x33')]);_0x3d6b38['filters']=_[_0xd0ae('0x36')](_0x3d6b38[_0xd0ae('0x32')],_0x3d6b38['query']);_0x46bc7e[_0xd0ae('0x37')]=_[_0xd0ae('0x36')](_0x3d6b38[_0xd0ae('0x32')],qs[_0xd0ae('0x38')](_0x4eb038[_0xd0ae('0x33')]['fields']));_0x46bc7e[_0xd0ae('0x37')]=_0x46bc7e['attributes'][_0xd0ae('0x39')]?_0x46bc7e[_0xd0ae('0x37')]:_0x3d6b38[_0xd0ae('0x32')];_0x46bc7e[_0xd0ae('0x3b')]=qs[_0xd0ae('0x3c')](_0x4eb038[_0xd0ae('0x33')][_0xd0ae('0x3c')]);_0x46bc7e[_0xd0ae('0x3d')]=qs[_0xd0ae('0x35')](_[_0xd0ae('0x3e')](_0x4eb038['query'],_0x3d6b38[_0xd0ae('0x35')]));if(_0x4eb038[_0xd0ae('0x33')][_0xd0ae('0x3f')]){_0x46bc7e['where']=_['merge'](_0x46bc7e[_0xd0ae('0x3d')],{'$or':_['map'](_0x46bc7e[_0xd0ae('0x37')],function(_0x358083){var _0x425753={};_0x425753[_0x358083]={'$like':'%'+_0x4eb038[_0xd0ae('0x33')][_0xd0ae('0x3f')]+'%'};return _0x425753;})});}_0x46bc7e=_[_0xd0ae('0x40')]({},_0x46bc7e,_0x4eb038['options']);return _0x4fd0a7[_0xd0ae('0x4b')](_0x46bc7e);}})['then'](function(_0x2f9450){if(_0x2f9450){_0x338184=_0x2f9450[_0xd0ae('0x39')];if(!_0x4eb038['query'][_0xd0ae('0x4e')](_0xd0ae('0x3a'))){_0x46bc7e[_0xd0ae('0x1d')]=qs['limit'](_0x4eb038[_0xd0ae('0x33')][_0xd0ae('0x1d')]);_0x46bc7e[_0xd0ae('0x1f')]=qs[_0xd0ae('0x1f')](_0x4eb038[_0xd0ae('0x33')][_0xd0ae('0x1f')]);}return _0x4fd0a7[_0xd0ae('0x4b')](_0x46bc7e);}})['then'](function(_0x525a00){if(_0x525a00){return _0x525a00?{'count':_0x338184,'rows':_0x525a00}:null;}})[_0xd0ae('0x27')](respondWithResult(_0x6e024e,null))['catch'](handleError(_0x6e024e,null));};exports[_0xd0ae('0x4f')]=function(_0x3b8b82,_0x238746,_0x4c40b8){var _0x5830c2={};var _0x3b148d={};var _0x11595d;var _0x561862;return db['SugarcrmConfiguration'][_0xd0ae('0x4c')]({'where':{'id':_0x3b8b82[_0xd0ae('0x46')]['id']}})['then'](handleEntityNotFound(_0x238746,null))[_0xd0ae('0x27')](function(_0x48110e){if(_0x48110e){_0x11595d=_0x48110e;_0x3b148d[_0xd0ae('0x32')]=_[_0xd0ae('0x34')](db[_0xd0ae('0x4d')][_0xd0ae('0x2e')]);_0x3b148d[_0xd0ae('0x33')]=_[_0xd0ae('0x34')](_0x3b8b82[_0xd0ae('0x33')]);_0x3b148d['filters']=_[_0xd0ae('0x36')](_0x3b148d[_0xd0ae('0x32')],_0x3b148d['query']);_0x5830c2[_0xd0ae('0x37')]=_['intersection'](_0x3b148d['model'],qs[_0xd0ae('0x38')](_0x3b8b82[_0xd0ae('0x33')][_0xd0ae('0x38')]));_0x5830c2['attributes']=_0x5830c2['attributes'][_0xd0ae('0x39')]?_0x5830c2[_0xd0ae('0x37')]:_0x3b148d[_0xd0ae('0x32')];_0x5830c2[_0xd0ae('0x3b')]=qs[_0xd0ae('0x3c')](_0x3b8b82[_0xd0ae('0x33')][_0xd0ae('0x3c')]);_0x5830c2[_0xd0ae('0x3d')]=qs[_0xd0ae('0x35')](_['pick'](_0x3b8b82[_0xd0ae('0x33')],_0x3b148d['filters']));if(_0x3b8b82['query'][_0xd0ae('0x3f')]){_0x5830c2[_0xd0ae('0x3d')]=_[_0xd0ae('0x40')](_0x5830c2[_0xd0ae('0x3d')],{'$or':_[_0xd0ae('0x2c')](_0x5830c2[_0xd0ae('0x37')],function(_0x521585){var _0x2895fe={};_0x2895fe[_0x521585]={'$like':'%'+_0x3b8b82[_0xd0ae('0x33')][_0xd0ae('0x3f')]+'%'};return _0x2895fe;})});}_0x5830c2=_[_0xd0ae('0x40')]({},_0x5830c2,_0x3b8b82[_0xd0ae('0x47')]);return _0x11595d[_0xd0ae('0x4f')](_0x5830c2);}})['then'](function(_0x5981e7){if(_0x5981e7){_0x561862=_0x5981e7[_0xd0ae('0x39')];if(!_0x3b8b82['query'][_0xd0ae('0x4e')](_0xd0ae('0x3a'))){_0x5830c2[_0xd0ae('0x1d')]=qs[_0xd0ae('0x1d')](_0x3b8b82[_0xd0ae('0x33')]['limit']);_0x5830c2[_0xd0ae('0x1f')]=qs['offset'](_0x3b8b82[_0xd0ae('0x33')][_0xd0ae('0x1f')]);}return _0x11595d[_0xd0ae('0x4f')](_0x5830c2);}})[_0xd0ae('0x27')](function(_0x3a96d1){if(_0x3a96d1){return _0x3a96d1?{'count':_0x561862,'rows':_0x3a96d1}:null;}})['then'](respondWithResult(_0x238746,null))[_0xd0ae('0x45')](handleError(_0x238746,null));};exports[_0xd0ae('0x50')]=function(_0x1fca38,_0x3fc9f5,_0x455ca7){var _0x10da80={};var _0x13147d={};var _0x3c8bb2;var _0x1a94e4;return db['SugarcrmConfiguration'][_0xd0ae('0x4c')]({'where':{'id':_0x1fca38[_0xd0ae('0x46')]['id']}})[_0xd0ae('0x27')](handleEntityNotFound(_0x3fc9f5,null))[_0xd0ae('0x27')](function(_0x148732){if(_0x148732){_0x3c8bb2=_0x148732;_0x13147d[_0xd0ae('0x32')]=_[_0xd0ae('0x34')](db[_0xd0ae('0x4d')]['rawAttributes']);_0x13147d[_0xd0ae('0x33')]=_[_0xd0ae('0x34')](_0x1fca38[_0xd0ae('0x33')]);_0x13147d[_0xd0ae('0x35')]=_[_0xd0ae('0x36')](_0x13147d['model'],_0x13147d[_0xd0ae('0x33')]);_0x10da80['attributes']=_[_0xd0ae('0x36')](_0x13147d[_0xd0ae('0x32')],qs[_0xd0ae('0x38')](_0x1fca38[_0xd0ae('0x33')]['fields']));_0x10da80['attributes']=_0x10da80[_0xd0ae('0x37')][_0xd0ae('0x39')]?_0x10da80['attributes']:_0x13147d[_0xd0ae('0x32')];_0x10da80[_0xd0ae('0x3b')]=qs[_0xd0ae('0x3c')](_0x1fca38[_0xd0ae('0x33')][_0xd0ae('0x3c')]);_0x10da80[_0xd0ae('0x3d')]=qs['filters'](_['pick'](_0x1fca38[_0xd0ae('0x33')],_0x13147d['filters']));if(_0x1fca38[_0xd0ae('0x33')][_0xd0ae('0x3f')]){_0x10da80[_0xd0ae('0x3d')]=_[_0xd0ae('0x40')](_0x10da80[_0xd0ae('0x3d')],{'$or':_[_0xd0ae('0x2c')](_0x10da80[_0xd0ae('0x37')],function(_0x427c0c){var _0x96749d={};_0x96749d[_0x427c0c]={'$like':'%'+_0x1fca38['query'][_0xd0ae('0x3f')]+'%'};return _0x96749d;})});}_0x10da80=_[_0xd0ae('0x40')]({},_0x10da80,_0x1fca38['options']);return _0x3c8bb2['getDescriptions'](_0x10da80);}})[_0xd0ae('0x27')](function(_0x4cd100){if(_0x4cd100){_0x1a94e4=_0x4cd100['length'];if(!_0x1fca38['query'][_0xd0ae('0x4e')](_0xd0ae('0x3a'))){_0x10da80['limit']=qs['limit'](_0x1fca38[_0xd0ae('0x33')]['limit']);_0x10da80[_0xd0ae('0x1f')]=qs[_0xd0ae('0x1f')](_0x1fca38[_0xd0ae('0x33')][_0xd0ae('0x1f')]);}return _0x3c8bb2[_0xd0ae('0x50')](_0x10da80);}})[_0xd0ae('0x27')](function(_0x157b8b){if(_0x157b8b){return _0x157b8b?{'count':_0x1a94e4,'rows':_0x157b8b}:null;}})[_0xd0ae('0x27')](respondWithResult(_0x3fc9f5,null))[_0xd0ae('0x45')](handleError(_0x3fc9f5,null));}; \ No newline at end of file +var _0x8193=['undefined','limit','count','Content-Range','apply','save','update','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','VIRTUAL','SugarcrmConfiguration','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','destroy','getFields','findOne','SugarcrmField','pick','hasOwnProperty','getSubjects','getDescriptions','options','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x1ba7e1,_0x595187){var _0x2e4067=function(_0x4abc3d){while(--_0x4abc3d){_0x1ba7e1['push'](_0x1ba7e1['shift']());}};_0x2e4067(++_0x595187);}(_0x8193,0xd6));var _0x3819=function(_0x5112d0,_0x484cd8){_0x5112d0=_0x5112d0-0x0;var _0x2614f7=_0x8193[_0x5112d0];return _0x2614f7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3819('0x0'));var zipdir=require(_0x3819('0x1'));var jsonpatch=require(_0x3819('0x2'));var rp=require(_0x3819('0x3'));var moment=require('moment');var BPromise=require(_0x3819('0x4'));var Mustache=require(_0x3819('0x5'));var util=require(_0x3819('0x6'));var path=require(_0x3819('0x7'));var sox=require('sox');var csv=require(_0x3819('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3819('0x9'));var _=require(_0x3819('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3819('0xb'));var deskjs=require(_0x3819('0xc'));var toCsv=require(_0x3819('0x8'));var querystring=require(_0x3819('0xd'));var Papa=require('papaparse');var Redis=require(_0x3819('0xe'));var authService=require(_0x3819('0xf'));var qs=require(_0x3819('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3819('0x11'));var logger=require(_0x3819('0x12'))(_0x3819('0x13'));var utils=require(_0x3819('0x14'));var config=require(_0x3819('0x15'));var licenseUtil=require(_0x3819('0x16'));var db=require(_0x3819('0x17'))['db'];function respondWithStatusCode(_0x8c8518,_0x831950){_0x831950=_0x831950||0xcc;return function(_0x2aad94){if(_0x2aad94){return _0x8c8518[_0x3819('0x18')](_0x831950);}return _0x8c8518[_0x3819('0x19')](_0x831950)[_0x3819('0x1a')]();};}function respondWithResult(_0x552dbe,_0x52ce1c){_0x52ce1c=_0x52ce1c||0xc8;return function(_0x75f52e){if(_0x75f52e){return _0x552dbe[_0x3819('0x19')](_0x52ce1c)[_0x3819('0x1b')](_0x75f52e);}};}function respondWithFilteredResult(_0x20b722,_0x18d61b){return function(_0x162244){if(_0x162244){var _0x101334=typeof _0x18d61b[_0x3819('0x1c')]===_0x3819('0x1d')&&typeof _0x18d61b[_0x3819('0x1e')]===_0x3819('0x1d');var _0x3b25ef=_0x162244[_0x3819('0x1f')];var _0x3e2130=_0x101334?0x0:_0x18d61b['offset'];var _0x1254a0=_0x101334?_0x162244[_0x3819('0x1f')]:_0x18d61b['offset']+_0x18d61b[_0x3819('0x1e')];var _0x3d312b;if(_0x1254a0>=_0x3b25ef){_0x1254a0=_0x3b25ef;_0x3d312b=0xc8;}else{_0x3d312b=0xce;}_0x20b722[_0x3819('0x19')](_0x3d312b);return _0x20b722['set'](_0x3819('0x20'),_0x3e2130+'-'+_0x1254a0+'/'+_0x3b25ef)[_0x3819('0x1b')](_0x162244);}return null;};}function patchUpdates(_0xf536e6){return function(_0x2612c0){try{jsonpatch[_0x3819('0x21')](_0x2612c0,_0xf536e6,!![]);}catch(_0x3d207e){return BPromise['reject'](_0x3d207e);}return _0x2612c0[_0x3819('0x22')]();};}function saveUpdates(_0x6ea594,_0x3e1add){return function(_0x7dc7d5){if(_0x7dc7d5){return _0x7dc7d5[_0x3819('0x23')](_0x6ea594)[_0x3819('0x24')](function(_0x47c526){return _0x47c526;});}return null;};}function removeEntity(_0x105e72,_0x2c6ec1){return function(_0x5115e1){if(_0x5115e1){return _0x5115e1['destroy']()[_0x3819('0x24')](function(){_0x105e72['status'](0xcc)[_0x3819('0x1a')]();});}};}function handleEntityNotFound(_0x3ae59f,_0x4d3cc5){return function(_0x4069d5){if(!_0x4069d5){_0x3ae59f[_0x3819('0x18')](0x194);}return _0x4069d5;};}function handleError(_0x3a50d0,_0x369b10){_0x369b10=_0x369b10||0x1f4;return function(_0x5f53a2){logger['error'](_0x5f53a2[_0x3819('0x25')]);if(_0x5f53a2[_0x3819('0x26')]){delete _0x5f53a2[_0x3819('0x26')];}_0x3a50d0['status'](_0x369b10)[_0x3819('0x27')](_0x5f53a2);};}exports[_0x3819('0x28')]=function(_0x390c69,_0x304b67){var _0x95675e={},_0x12e6c7={},_0x26bfe0={'count':0x0,'rows':[]};var _0x100fb0=_[_0x3819('0x29')](db['SugarcrmConfiguration'][_0x3819('0x2a')],function(_0x4bed15){return{'name':_0x4bed15[_0x3819('0x2b')],'type':_0x4bed15[_0x3819('0x2c')][_0x3819('0x2d')]};});_0x12e6c7[_0x3819('0x2e')]=_[_0x3819('0x29')](_0x100fb0,_0x3819('0x26'));_0x12e6c7[_0x3819('0x2f')]=_[_0x3819('0x30')](_0x390c69['query']);_0x12e6c7[_0x3819('0x31')]=_[_0x3819('0x32')](_0x12e6c7['model'],_0x12e6c7[_0x3819('0x2f')]);_0x95675e[_0x3819('0x33')]=_[_0x3819('0x32')](_0x12e6c7[_0x3819('0x2e')],qs[_0x3819('0x34')](_0x390c69[_0x3819('0x2f')][_0x3819('0x34')]));_0x95675e[_0x3819('0x33')]=_0x95675e[_0x3819('0x33')]['length']?_0x95675e[_0x3819('0x33')]:_0x12e6c7[_0x3819('0x2e')];if(!_0x390c69['query']['hasOwnProperty'](_0x3819('0x35'))){_0x95675e[_0x3819('0x1e')]=qs[_0x3819('0x1e')](_0x390c69[_0x3819('0x2f')]['limit']);_0x95675e[_0x3819('0x1c')]=qs[_0x3819('0x1c')](_0x390c69[_0x3819('0x2f')]['offset']);}_0x95675e[_0x3819('0x36')]=qs[_0x3819('0x37')](_0x390c69[_0x3819('0x2f')]['sort']);_0x95675e[_0x3819('0x38')]=qs[_0x3819('0x31')](_['pick'](_0x390c69[_0x3819('0x2f')],_0x12e6c7['filters']),_0x100fb0);if(_0x390c69[_0x3819('0x2f')][_0x3819('0x39')]){_0x95675e[_0x3819('0x38')]=_[_0x3819('0x3a')](_0x95675e[_0x3819('0x38')],{'$or':_[_0x3819('0x29')](_0x100fb0,function(_0x589e56){if(_0x589e56[_0x3819('0x2c')]!==_0x3819('0x3b')){var _0x3ed68a={};_0x3ed68a[_0x589e56['name']]={'$like':'%'+_0x390c69[_0x3819('0x2f')]['filter']+'%'};return _0x3ed68a;}})});}_0x95675e=_[_0x3819('0x3a')]({},_0x95675e,_0x390c69['options']);var _0x4e119e={'where':_0x95675e[_0x3819('0x38')]};return db[_0x3819('0x3c')]['count'](_0x4e119e)[_0x3819('0x24')](function(_0x132cf6){_0x26bfe0[_0x3819('0x1f')]=_0x132cf6;if(_0x390c69[_0x3819('0x2f')][_0x3819('0x3d')]){_0x95675e[_0x3819('0x3e')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x3819('0x3f')](_0x95675e);})[_0x3819('0x24')](function(_0x3e22cd){_0x26bfe0[_0x3819('0x40')]=_0x3e22cd;return _0x26bfe0;})[_0x3819('0x24')](respondWithFilteredResult(_0x304b67,_0x95675e))[_0x3819('0x41')](handleError(_0x304b67,null));};exports[_0x3819('0x42')]=function(_0x3ef7b9,_0x1ad8e8){var _0x16872a={'raw':![],'where':{'id':_0x3ef7b9[_0x3819('0x43')]['id']}},_0xed2082={};_0xed2082[_0x3819('0x2e')]=_['keys'](db[_0x3819('0x3c')][_0x3819('0x2a')]);_0xed2082[_0x3819('0x2f')]=_['keys'](_0x3ef7b9[_0x3819('0x2f')]);_0xed2082['filters']=_['intersection'](_0xed2082[_0x3819('0x2e')],_0xed2082[_0x3819('0x2f')]);_0x16872a[_0x3819('0x33')]=_['intersection'](_0xed2082[_0x3819('0x2e')],qs[_0x3819('0x34')](_0x3ef7b9[_0x3819('0x2f')][_0x3819('0x34')]));_0x16872a[_0x3819('0x33')]=_0x16872a[_0x3819('0x33')][_0x3819('0x44')]?_0x16872a['attributes']:_0xed2082[_0x3819('0x2e')];if(_0x3ef7b9[_0x3819('0x2f')][_0x3819('0x3d')]){_0x16872a[_0x3819('0x3e')]=[{'all':!![]}];}_0x16872a=_[_0x3819('0x3a')]({},_0x16872a,_0x3ef7b9['options']);return db[_0x3819('0x3c')][_0x3819('0x45')](_0x16872a)['then'](handleEntityNotFound(_0x1ad8e8,null))[_0x3819('0x24')](respondWithResult(_0x1ad8e8,null))[_0x3819('0x41')](handleError(_0x1ad8e8,null));};exports[_0x3819('0x46')]=function(_0x3b2acf,_0x4528f2){return db[_0x3819('0x3c')][_0x3819('0x46')](_0x3b2acf['body'],{})['then'](respondWithResult(_0x4528f2,0xc9))['catch'](handleError(_0x4528f2,null));};exports[_0x3819('0x23')]=function(_0x4a2a66,_0x206600){if(_0x4a2a66[_0x3819('0x47')]['id']){delete _0x4a2a66[_0x3819('0x47')]['id'];}return db[_0x3819('0x3c')]['find']({'where':{'id':_0x4a2a66['params']['id']}})[_0x3819('0x24')](handleEntityNotFound(_0x206600,null))[_0x3819('0x24')](saveUpdates(_0x4a2a66[_0x3819('0x47')],null))[_0x3819('0x24')](respondWithResult(_0x206600,null))[_0x3819('0x41')](handleError(_0x206600,null));};exports[_0x3819('0x48')]=function(_0xdb9dbc,_0x44d5a6){return db['SugarcrmConfiguration']['find']({'where':{'id':_0xdb9dbc[_0x3819('0x43')]['id']}})[_0x3819('0x24')](handleEntityNotFound(_0x44d5a6,null))[_0x3819('0x24')](removeEntity(_0x44d5a6,null))['catch'](handleError(_0x44d5a6,null));};exports[_0x3819('0x49')]=function(_0x2dedfe,_0x2cf857,_0x38526e){var _0x4bec84={};var _0x2ac294={};var _0x42ee50;var _0xdb1189;return db['SugarcrmConfiguration'][_0x3819('0x4a')]({'where':{'id':_0x2dedfe['params']['id']}})[_0x3819('0x24')](handleEntityNotFound(_0x2cf857,null))['then'](function(_0x1eb718){if(_0x1eb718){_0x42ee50=_0x1eb718;_0x2ac294[_0x3819('0x2e')]=_[_0x3819('0x30')](db[_0x3819('0x4b')][_0x3819('0x2a')]);_0x2ac294['query']=_[_0x3819('0x30')](_0x2dedfe[_0x3819('0x2f')]);_0x2ac294[_0x3819('0x31')]=_[_0x3819('0x32')](_0x2ac294[_0x3819('0x2e')],_0x2ac294['query']);_0x4bec84[_0x3819('0x33')]=_[_0x3819('0x32')](_0x2ac294[_0x3819('0x2e')],qs[_0x3819('0x34')](_0x2dedfe[_0x3819('0x2f')][_0x3819('0x34')]));_0x4bec84[_0x3819('0x33')]=_0x4bec84['attributes'][_0x3819('0x44')]?_0x4bec84['attributes']:_0x2ac294['model'];_0x4bec84[_0x3819('0x36')]=qs[_0x3819('0x37')](_0x2dedfe[_0x3819('0x2f')][_0x3819('0x37')]);_0x4bec84[_0x3819('0x38')]=qs[_0x3819('0x31')](_[_0x3819('0x4c')](_0x2dedfe['query'],_0x2ac294[_0x3819('0x31')]));if(_0x2dedfe[_0x3819('0x2f')][_0x3819('0x39')]){_0x4bec84[_0x3819('0x38')]=_[_0x3819('0x3a')](_0x4bec84['where'],{'$or':_[_0x3819('0x29')](_0x4bec84[_0x3819('0x33')],function(_0x4ce51b){var _0x242fed={};_0x242fed[_0x4ce51b]={'$like':'%'+_0x2dedfe[_0x3819('0x2f')][_0x3819('0x39')]+'%'};return _0x242fed;})});}_0x4bec84=_[_0x3819('0x3a')]({},_0x4bec84,_0x2dedfe['options']);return _0x42ee50[_0x3819('0x49')](_0x4bec84);}})[_0x3819('0x24')](function(_0x552f2d){if(_0x552f2d){_0xdb1189=_0x552f2d[_0x3819('0x44')];if(!_0x2dedfe[_0x3819('0x2f')][_0x3819('0x4d')](_0x3819('0x35'))){_0x4bec84[_0x3819('0x1e')]=qs[_0x3819('0x1e')](_0x2dedfe['query'][_0x3819('0x1e')]);_0x4bec84[_0x3819('0x1c')]=qs[_0x3819('0x1c')](_0x2dedfe[_0x3819('0x2f')][_0x3819('0x1c')]);}return _0x42ee50[_0x3819('0x49')](_0x4bec84);}})[_0x3819('0x24')](function(_0x5005e9){if(_0x5005e9){return _0x5005e9?{'count':_0xdb1189,'rows':_0x5005e9}:null;}})[_0x3819('0x24')](respondWithResult(_0x2cf857,null))['catch'](handleError(_0x2cf857,null));};exports[_0x3819('0x4e')]=function(_0x580462,_0x54ddd6,_0x375ab4){var _0x2626d9={};var _0x4a9189={};var _0x4401e5;var _0x10cc9a;return db[_0x3819('0x3c')][_0x3819('0x4a')]({'where':{'id':_0x580462[_0x3819('0x43')]['id']}})['then'](handleEntityNotFound(_0x54ddd6,null))[_0x3819('0x24')](function(_0x40d1d0){if(_0x40d1d0){_0x4401e5=_0x40d1d0;_0x4a9189[_0x3819('0x2e')]=_['keys'](db[_0x3819('0x4b')][_0x3819('0x2a')]);_0x4a9189[_0x3819('0x2f')]=_[_0x3819('0x30')](_0x580462[_0x3819('0x2f')]);_0x4a9189[_0x3819('0x31')]=_[_0x3819('0x32')](_0x4a9189[_0x3819('0x2e')],_0x4a9189[_0x3819('0x2f')]);_0x2626d9['attributes']=_[_0x3819('0x32')](_0x4a9189['model'],qs[_0x3819('0x34')](_0x580462['query'][_0x3819('0x34')]));_0x2626d9[_0x3819('0x33')]=_0x2626d9[_0x3819('0x33')]['length']?_0x2626d9['attributes']:_0x4a9189['model'];_0x2626d9[_0x3819('0x36')]=qs[_0x3819('0x37')](_0x580462[_0x3819('0x2f')][_0x3819('0x37')]);_0x2626d9['where']=qs[_0x3819('0x31')](_[_0x3819('0x4c')](_0x580462[_0x3819('0x2f')],_0x4a9189[_0x3819('0x31')]));if(_0x580462[_0x3819('0x2f')][_0x3819('0x39')]){_0x2626d9['where']=_[_0x3819('0x3a')](_0x2626d9[_0x3819('0x38')],{'$or':_[_0x3819('0x29')](_0x2626d9[_0x3819('0x33')],function(_0x5a0571){var _0x1fdb5d={};_0x1fdb5d[_0x5a0571]={'$like':'%'+_0x580462['query'][_0x3819('0x39')]+'%'};return _0x1fdb5d;})});}_0x2626d9=_['merge']({},_0x2626d9,_0x580462['options']);return _0x4401e5[_0x3819('0x4e')](_0x2626d9);}})[_0x3819('0x24')](function(_0xb38a7a){if(_0xb38a7a){_0x10cc9a=_0xb38a7a['length'];if(!_0x580462[_0x3819('0x2f')][_0x3819('0x4d')](_0x3819('0x35'))){_0x2626d9[_0x3819('0x1e')]=qs['limit'](_0x580462[_0x3819('0x2f')][_0x3819('0x1e')]);_0x2626d9[_0x3819('0x1c')]=qs[_0x3819('0x1c')](_0x580462[_0x3819('0x2f')][_0x3819('0x1c')]);}return _0x4401e5[_0x3819('0x4e')](_0x2626d9);}})[_0x3819('0x24')](function(_0x40e3b7){if(_0x40e3b7){return _0x40e3b7?{'count':_0x10cc9a,'rows':_0x40e3b7}:null;}})[_0x3819('0x24')](respondWithResult(_0x54ddd6,null))[_0x3819('0x41')](handleError(_0x54ddd6,null));};exports[_0x3819('0x4f')]=function(_0x2ffff9,_0x24e1d9,_0x42ee66){var _0x51695a={};var _0xd736cc={};var _0x393c54;var _0x24a9ee;return db['SugarcrmConfiguration'][_0x3819('0x4a')]({'where':{'id':_0x2ffff9[_0x3819('0x43')]['id']}})[_0x3819('0x24')](handleEntityNotFound(_0x24e1d9,null))['then'](function(_0x1bc705){if(_0x1bc705){_0x393c54=_0x1bc705;_0xd736cc[_0x3819('0x2e')]=_[_0x3819('0x30')](db[_0x3819('0x4b')][_0x3819('0x2a')]);_0xd736cc[_0x3819('0x2f')]=_[_0x3819('0x30')](_0x2ffff9[_0x3819('0x2f')]);_0xd736cc[_0x3819('0x31')]=_['intersection'](_0xd736cc['model'],_0xd736cc[_0x3819('0x2f')]);_0x51695a[_0x3819('0x33')]=_[_0x3819('0x32')](_0xd736cc[_0x3819('0x2e')],qs[_0x3819('0x34')](_0x2ffff9[_0x3819('0x2f')]['fields']));_0x51695a[_0x3819('0x33')]=_0x51695a[_0x3819('0x33')][_0x3819('0x44')]?_0x51695a[_0x3819('0x33')]:_0xd736cc[_0x3819('0x2e')];_0x51695a[_0x3819('0x36')]=qs[_0x3819('0x37')](_0x2ffff9[_0x3819('0x2f')][_0x3819('0x37')]);_0x51695a[_0x3819('0x38')]=qs[_0x3819('0x31')](_[_0x3819('0x4c')](_0x2ffff9[_0x3819('0x2f')],_0xd736cc[_0x3819('0x31')]));if(_0x2ffff9[_0x3819('0x2f')]['filter']){_0x51695a[_0x3819('0x38')]=_[_0x3819('0x3a')](_0x51695a[_0x3819('0x38')],{'$or':_[_0x3819('0x29')](_0x51695a['attributes'],function(_0x51f139){var _0x1c1567={};_0x1c1567[_0x51f139]={'$like':'%'+_0x2ffff9[_0x3819('0x2f')][_0x3819('0x39')]+'%'};return _0x1c1567;})});}_0x51695a=_[_0x3819('0x3a')]({},_0x51695a,_0x2ffff9[_0x3819('0x50')]);return _0x393c54[_0x3819('0x4f')](_0x51695a);}})[_0x3819('0x24')](function(_0x56d294){if(_0x56d294){_0x24a9ee=_0x56d294['length'];if(!_0x2ffff9[_0x3819('0x2f')][_0x3819('0x4d')](_0x3819('0x35'))){_0x51695a[_0x3819('0x1e')]=qs[_0x3819('0x1e')](_0x2ffff9['query']['limit']);_0x51695a['offset']=qs[_0x3819('0x1c')](_0x2ffff9[_0x3819('0x2f')]['offset']);}return _0x393c54[_0x3819('0x4f')](_0x51695a);}})[_0x3819('0x24')](function(_0x3ea2b2){if(_0x3ea2b2){return _0x3ea2b2?{'count':_0x24a9ee,'rows':_0x3ea2b2}:null;}})['then'](respondWithResult(_0x24e1d9,null))[_0x3819('0x41')](handleError(_0x24e1d9,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index eedcf7f..15873f5 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 _0xfb47=['moment','request-promise','path','rimraf','../../config/environment','define','SugarcrmConfiguration','lodash','util','../../config/logger','api'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0xfb47,0x8b));var _0x7fb4=function(_0x40e963,_0x2023b4){_0x40e963=_0x40e963-0x0;var _0x392b10=_0xfb47[_0x40e963];return _0x392b10;};'use strict';var _=require(_0x7fb4('0x0'));var util=require(_0x7fb4('0x1'));var logger=require(_0x7fb4('0x2'))(_0x7fb4('0x3'));var moment=require(_0x7fb4('0x4'));var BPromise=require('bluebird');var rp=require(_0x7fb4('0x5'));var fs=require('fs');var path=require(_0x7fb4('0x6'));var rimraf=require(_0x7fb4('0x7'));var config=require(_0x7fb4('0x8'));var attributes=require('./intSugarcrmConfiguration.attributes');module['exports']=function(_0xc1c6f9,_0x52bad4){return _0xc1c6f9[_0x7fb4('0x9')](_0x7fb4('0xa'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7886=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intSugarcrmConfiguration.attributes','SugarcrmConfiguration'];(function(_0x2a6e94,_0x44b5be){var _0x5aa931=function(_0x3cc8bb){while(--_0x3cc8bb){_0x2a6e94['push'](_0x2a6e94['shift']());}};_0x5aa931(++_0x44b5be);}(_0x7886,0x6e));var _0x6788=function(_0x261d9e,_0x4f0942){_0x261d9e=_0x261d9e-0x0;var _0x3f8a2c=_0x7886[_0x261d9e];return _0x3f8a2c;};'use strict';var _=require('lodash');var util=require(_0x6788('0x0'));var logger=require(_0x6788('0x1'))(_0x6788('0x2'));var moment=require(_0x6788('0x3'));var BPromise=require(_0x6788('0x4'));var rp=require(_0x6788('0x5'));var fs=require('fs');var path=require(_0x6788('0x6'));var rimraf=require(_0x6788('0x7'));var config=require('../../config/environment');var attributes=require(_0x6788('0x8'));module['exports']=function(_0x1dacd2,_0x4ef2c7){return _0x1dacd2['define'](_0x6788('0x9'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 42e9d3e..644c7f6 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 _0xf85c=['../../config/logger','rpc','../../config/environment','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x45505f,_0x36c2cb){var _0x57b860=function(_0x23286c){while(--_0x23286c){_0x45505f['push'](_0x45505f['shift']());}};_0x57b860(++_0x36c2cb);}(_0xf85c,0xab));var _0xcf85=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0xf85c[_0x4a7631];return _0x1a5a6f;};'use strict';var _=require('lodash');var util=require(_0xcf85('0x0'));var moment=require(_0xcf85('0x1'));var BPromise=require(_0xcf85('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcf85('0x3'));var db=require(_0xcf85('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcf85('0x5'))(_0xcf85('0x6'));var config=require(_0xcf85('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xcf85('0x8')][_0xcf85('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x252600,_0x5083d6,_0x53abaa){return new BPromise(function(_0x113515,_0x3cbe09){return client[_0xcf85('0xa')](_0x252600,_0x53abaa)[_0xcf85('0xb')](function(_0x44540c){logger[_0xcf85('0xc')](_0xcf85('0xd'),_0x5083d6,_0xcf85('0xe'));logger[_0xcf85('0xf')](_0xcf85('0x10'),_0x5083d6,_0xcf85('0xe'),JSON[_0xcf85('0x11')](_0x44540c));if(_0x44540c['error']){if(_0x44540c[_0xcf85('0x12')][_0xcf85('0x13')]===0x1f4){logger[_0xcf85('0x12')](_0xcf85('0xd'),_0x5083d6,_0x44540c[_0xcf85('0x12')][_0xcf85('0x14')]);return _0x3cbe09(_0x44540c[_0xcf85('0x12')][_0xcf85('0x14')]);}logger[_0xcf85('0x12')](_0xcf85('0xd'),_0x5083d6,_0x44540c[_0xcf85('0x12')][_0xcf85('0x14')]);return _0x113515(_0x44540c[_0xcf85('0x12')]['message']);}else{logger[_0xcf85('0xc')](_0xcf85('0xd'),_0x5083d6,'request\x20sent');_0x113515(_0x44540c[_0xcf85('0x15')][_0xcf85('0x14')]);}})['catch'](function(_0xc556dd){logger['error'](_0xcf85('0xd'),_0x5083d6,_0xc556dd);_0x3cbe09(_0xc556dd);});});} \ No newline at end of file +var _0xb706=['rpc','../../config/environment','jayson/promise','client','http','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3b924e,_0x4042f6){var _0x25fc6a=function(_0x1dd623){while(--_0x1dd623){_0x3b924e['push'](_0x3b924e['shift']());}};_0x25fc6a(++_0x4042f6);}(_0xb706,0x115));var _0x6b70=function(_0x43eacf,_0x46c05f){_0x43eacf=_0x43eacf-0x0;var _0x1e1c1b=_0xb706[_0x43eacf];return _0x1e1c1b;};'use strict';var _=require(_0x6b70('0x0'));var util=require(_0x6b70('0x1'));var moment=require(_0x6b70('0x2'));var BPromise=require(_0x6b70('0x3'));var rs=require(_0x6b70('0x4'));var fs=require('fs');var Redis=require(_0x6b70('0x5'));var db=require(_0x6b70('0x6'))['db'];var utils=require(_0x6b70('0x7'));var logger=require(_0x6b70('0x8'))(_0x6b70('0x9'));var config=require(_0x6b70('0xa'));var jayson=require(_0x6b70('0xb'));var client=jayson[_0x6b70('0xc')][_0x6b70('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3a3a77,_0x30e880,_0xbba85a){return new BPromise(function(_0x5c0922,_0x1f6e69){return client['request'](_0x3a3a77,_0xbba85a)[_0x6b70('0xe')](function(_0x531990){logger[_0x6b70('0xf')](_0x6b70('0x10'),_0x30e880,_0x6b70('0x11'));logger[_0x6b70('0x12')](_0x6b70('0x13'),_0x30e880,_0x6b70('0x11'),JSON[_0x6b70('0x14')](_0x531990));if(_0x531990[_0x6b70('0x15')]){if(_0x531990[_0x6b70('0x15')][_0x6b70('0x16')]===0x1f4){logger[_0x6b70('0x15')](_0x6b70('0x10'),_0x30e880,_0x531990[_0x6b70('0x15')][_0x6b70('0x17')]);return _0x1f6e69(_0x531990['error'][_0x6b70('0x17')]);}logger[_0x6b70('0x15')](_0x6b70('0x10'),_0x30e880,_0x531990[_0x6b70('0x15')][_0x6b70('0x17')]);return _0x5c0922(_0x531990[_0x6b70('0x15')][_0x6b70('0x17')]);}else{logger[_0x6b70('0xf')](_0x6b70('0x10'),_0x30e880,'request\x20sent');_0x5c0922(_0x531990[_0x6b70('0x18')][_0x6b70('0x17')]);}})[_0x6b70('0x19')](function(_0x3cebc6){logger[_0x6b70('0x15')](_0x6b70('0x10'),_0x30e880,_0x3cebc6);_0x1f6e69(_0x3cebc6);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 01ebed1..ffd8ed0 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 _0x7c83=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','index','/:id','isAuthenticated','show','post','put','update','destroy','exports','multer','util'];(function(_0x401676,_0x3f1436){var _0x4f13fe=function(_0xd2f197){while(--_0xd2f197){_0x401676['push'](_0x401676['shift']());}};_0x4f13fe(++_0x3f1436);}(_0x7c83,0x70));var _0x37c8=function(_0x50b856,_0x330fa5){_0x50b856=_0x50b856-0x0;var _0x14dd15=_0x7c83[_0x50b856];return _0x14dd15;};'use strict';var multer=require(_0x37c8('0x0'));var util=require(_0x37c8('0x1'));var path=require(_0x37c8('0x2'));var timeout=require(_0x37c8('0x3'));var express=require('express');var router=express[_0x37c8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x37c8('0x5'));var interaction=require(_0x37c8('0x6'));var config=require(_0x37c8('0x7'));var controller=require(_0x37c8('0x8'));router[_0x37c8('0x9')]('/',auth['isAuthenticated'](),controller[_0x37c8('0xa')]);router[_0x37c8('0x9')](_0x37c8('0xb'),auth[_0x37c8('0xc')](),controller[_0x37c8('0xd')]);router[_0x37c8('0xe')]('/',auth[_0x37c8('0xc')](),controller['create']);router[_0x37c8('0xf')](_0x37c8('0xb'),auth[_0x37c8('0xc')](),controller[_0x37c8('0x10')]);router['delete'](_0x37c8('0xb'),auth[_0x37c8('0xc')](),controller[_0x37c8('0x11')]);module[_0x37c8('0x12')]=router; \ No newline at end of file +var _0x5f11=['index','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','get','isAuthenticated'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0x5f11,0x108));var _0x15f1=function(_0x223c6d,_0x1ab03c){_0x223c6d=_0x223c6d-0x0;var _0x421646=_0x5f11[_0x223c6d];return _0x421646;};'use strict';var multer=require(_0x15f1('0x0'));var util=require(_0x15f1('0x1'));var path=require(_0x15f1('0x2'));var timeout=require(_0x15f1('0x3'));var express=require(_0x15f1('0x4'));var router=express['Router']();var fs_extra=require(_0x15f1('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intSugarcrmField.controller');router[_0x15f1('0x6')]('/',auth[_0x15f1('0x7')](),controller[_0x15f1('0x8')]);router[_0x15f1('0x6')](_0x15f1('0x9'),auth[_0x15f1('0x7')](),controller[_0x15f1('0xa')]);router[_0x15f1('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x15f1('0xc')](_0x15f1('0x9'),auth[_0x15f1('0x7')](),controller[_0x15f1('0xd')]);router[_0x15f1('0xe')](_0x15f1('0x9'),auth[_0x15f1('0x7')](),controller[_0x15f1('0xf')]);module[_0x15f1('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index ac3ff49..a5f4732 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 _0x4e85=['variable','picklist','STRING','sequelize','exports','ENUM','string'];(function(_0x419dde,_0x2633e5){var _0x42223b=function(_0x4806df){while(--_0x4806df){_0x419dde['push'](_0x419dde['shift']());}};_0x42223b(++_0x2633e5);}(_0x4e85,0xff));var _0x54e8=function(_0x3ed8a7,_0x2f571f){_0x3ed8a7=_0x3ed8a7-0x0;var _0x1f6e9b=_0x4e85[_0x3ed8a7];return _0x1f6e9b;};'use strict';var Sequelize=require(_0x54e8('0x0'));module[_0x54e8('0x1')]={'type':{'type':Sequelize[_0x54e8('0x2')](_0x54e8('0x3'),_0x54e8('0x4'),'customVariable','keyValue',_0x54e8('0x5')),'defaultValue':_0x54e8('0x3')},'content':{'type':Sequelize[_0x54e8('0x6')]},'key':{'type':Sequelize[_0x54e8('0x6')]},'keyType':{'type':Sequelize[_0x54e8('0x2')](_0x54e8('0x3'),_0x54e8('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x54e8('0x6')]},'idField':{'type':Sequelize[_0x54e8('0x6')]},'nameField':{'type':Sequelize[_0x54e8('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0402=['keyValue','picklist','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','variable'];(function(_0x12bcf7,_0xc11103){var _0x2825a=function(_0x4452ba){while(--_0x4452ba){_0x12bcf7['push'](_0x12bcf7['shift']());}};_0x2825a(++_0xc11103);}(_0x0402,0x11c));var _0x2040=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x0402[_0x4b2436];return _0x4f5ab2;};'use strict';var Sequelize=require(_0x2040('0x0'));module[_0x2040('0x1')]={'type':{'type':Sequelize[_0x2040('0x2')]('string',_0x2040('0x3'),'customVariable',_0x2040('0x4'),_0x2040('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x2040('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x2040('0x2')]('string',_0x2040('0x3'),_0x2040('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x2040('0x6')]},'customField':{'type':Sequelize[_0x2040('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 1972c37..f4b3581 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 _0x87ff=['rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','options','include','rows','catch','show','includeAll','merge','find','create','body','destroy','params','eml-format'];(function(_0x90e3d5,_0x3eea2b){var _0x5c2252=function(_0x3c7a2e){while(--_0x3c7a2e){_0x90e3d5['push'](_0x90e3d5['shift']());}};_0x5c2252(++_0x3eea2b);}(_0x87ff,0x180));var _0xf87f=function(_0x3b69aa,_0xe50a1d){_0x3b69aa=_0x3b69aa-0x0;var _0x5ede0f=_0x87ff[_0x3b69aa];return _0x5ede0f;};'use strict';var emlformat=require(_0xf87f('0x0'));var rimraf=require(_0xf87f('0x1'));var zipdir=require(_0xf87f('0x2'));var jsonpatch=require(_0xf87f('0x3'));var rp=require(_0xf87f('0x4'));var moment=require('moment');var BPromise=require(_0xf87f('0x5'));var Mustache=require(_0xf87f('0x6'));var util=require(_0xf87f('0x7'));var path=require(_0xf87f('0x8'));var sox=require(_0xf87f('0x9'));var csv=require(_0xf87f('0xa'));var ejs=require(_0xf87f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf87f('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf87f('0xd'));var deskjs=require(_0xf87f('0xe'));var toCsv=require(_0xf87f('0xa'));var querystring=require('querystring');var Papa=require(_0xf87f('0xf'));var Redis=require(_0xf87f('0x10'));var authService=require(_0xf87f('0x11'));var qs=require(_0xf87f('0x12'));var as=require(_0xf87f('0x13'));var hardwareService=require(_0xf87f('0x14'));var logger=require(_0xf87f('0x15'))(_0xf87f('0x16'));var utils=require('../../config/utils');var config=require(_0xf87f('0x17'));var licenseUtil=require(_0xf87f('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f7e81,_0x57e9f7){_0x57e9f7=_0x57e9f7||0xcc;return function(_0x1a5ca3){if(_0x1a5ca3){return _0x4f7e81[_0xf87f('0x19')](_0x57e9f7);}return _0x4f7e81[_0xf87f('0x1a')](_0x57e9f7)[_0xf87f('0x1b')]();};}function respondWithResult(_0xfbb0b5,_0x5a6ecc){_0x5a6ecc=_0x5a6ecc||0xc8;return function(_0x27d404){if(_0x27d404){return _0xfbb0b5[_0xf87f('0x1a')](_0x5a6ecc)[_0xf87f('0x1c')](_0x27d404);}};}function respondWithFilteredResult(_0x495534,_0x5e91a4){return function(_0x1e4d5b){if(_0x1e4d5b){var _0x3c962a=typeof _0x5e91a4[_0xf87f('0x1d')]==='undefined'&&typeof _0x5e91a4[_0xf87f('0x1e')]==='undefined';var _0x21118b=_0x1e4d5b[_0xf87f('0x1f')];var _0x4a626e=_0x3c962a?0x0:_0x5e91a4['offset'];var _0x283852=_0x3c962a?_0x1e4d5b['count']:_0x5e91a4['offset']+_0x5e91a4['limit'];var _0x511825;if(_0x283852>=_0x21118b){_0x283852=_0x21118b;_0x511825=0xc8;}else{_0x511825=0xce;}_0x495534['status'](_0x511825);return _0x495534[_0xf87f('0x20')](_0xf87f('0x21'),_0x4a626e+'-'+_0x283852+'/'+_0x21118b)[_0xf87f('0x1c')](_0x1e4d5b);}return null;};}function patchUpdates(_0x562aef){return function(_0x4cdfd2){try{jsonpatch[_0xf87f('0x22')](_0x4cdfd2,_0x562aef,!![]);}catch(_0x1c5d1a){return BPromise['reject'](_0x1c5d1a);}return _0x4cdfd2[_0xf87f('0x23')]();};}function saveUpdates(_0x4bdcf7,_0x2f3fc0){return function(_0x1b2f59){if(_0x1b2f59){return _0x1b2f59[_0xf87f('0x24')](_0x4bdcf7)[_0xf87f('0x25')](function(_0x4b0ecc){return _0x4b0ecc;});}return null;};}function removeEntity(_0x551952,_0xa7dde9){return function(_0x320a2b){if(_0x320a2b){return _0x320a2b['destroy']()[_0xf87f('0x25')](function(){_0x551952['status'](0xcc)[_0xf87f('0x1b')]();});}};}function handleEntityNotFound(_0x24af24,_0x3ceb15){return function(_0x52bb32){if(!_0x52bb32){_0x24af24[_0xf87f('0x19')](0x194);}return _0x52bb32;};}function handleError(_0x58967d,_0x9bc870){_0x9bc870=_0x9bc870||0x1f4;return function(_0x3d0c69){logger[_0xf87f('0x26')](_0x3d0c69[_0xf87f('0x27')]);if(_0x3d0c69[_0xf87f('0x28')]){delete _0x3d0c69[_0xf87f('0x28')];}_0x58967d['status'](_0x9bc870)[_0xf87f('0x29')](_0x3d0c69);};}exports[_0xf87f('0x2a')]=function(_0x518563,_0x47f171){var _0x3afcf2={},_0x5febd8={},_0x2046e4={'count':0x0,'rows':[]};var _0x33a97f=_[_0xf87f('0x2b')](db[_0xf87f('0x2c')][_0xf87f('0x2d')],function(_0x20f9d1){return{'name':_0x20f9d1[_0xf87f('0x2e')],'type':_0x20f9d1['type'][_0xf87f('0x2f')]};});_0x5febd8['model']=_[_0xf87f('0x2b')](_0x33a97f,'name');_0x5febd8[_0xf87f('0x30')]=_[_0xf87f('0x31')](_0x518563[_0xf87f('0x30')]);_0x5febd8['filters']=_['intersection'](_0x5febd8[_0xf87f('0x32')],_0x5febd8[_0xf87f('0x30')]);_0x3afcf2[_0xf87f('0x33')]=_[_0xf87f('0x34')](_0x5febd8[_0xf87f('0x32')],qs[_0xf87f('0x35')](_0x518563['query']['fields']));_0x3afcf2[_0xf87f('0x33')]=_0x3afcf2[_0xf87f('0x33')][_0xf87f('0x36')]?_0x3afcf2['attributes']:_0x5febd8[_0xf87f('0x32')];if(!_0x518563[_0xf87f('0x30')][_0xf87f('0x37')](_0xf87f('0x38'))){_0x3afcf2['limit']=qs[_0xf87f('0x1e')](_0x518563[_0xf87f('0x30')][_0xf87f('0x1e')]);_0x3afcf2[_0xf87f('0x1d')]=qs[_0xf87f('0x1d')](_0x518563['query']['offset']);}_0x3afcf2[_0xf87f('0x39')]=qs[_0xf87f('0x3a')](_0x518563[_0xf87f('0x30')]['sort']);_0x3afcf2[_0xf87f('0x3b')]=qs[_0xf87f('0x3c')](_[_0xf87f('0x3d')](_0x518563[_0xf87f('0x30')],_0x5febd8[_0xf87f('0x3c')]),_0x33a97f);if(_0x518563[_0xf87f('0x30')][_0xf87f('0x3e')]){_0x3afcf2['where']=_['merge'](_0x3afcf2[_0xf87f('0x3b')],{'$or':_[_0xf87f('0x2b')](_0x33a97f,function(_0x53427e){if(_0x53427e[_0xf87f('0x3f')]!==_0xf87f('0x40')){var _0x18edbf={};_0x18edbf[_0x53427e[_0xf87f('0x28')]]={'$like':'%'+_0x518563[_0xf87f('0x30')][_0xf87f('0x3e')]+'%'};return _0x18edbf;}})});}_0x3afcf2=_['merge']({},_0x3afcf2,_0x518563[_0xf87f('0x41')]);var _0x5ca912={'where':_0x3afcf2['where']};return db[_0xf87f('0x2c')][_0xf87f('0x1f')](_0x5ca912)[_0xf87f('0x25')](function(_0x3d0769){_0x2046e4['count']=_0x3d0769;if(_0x518563['query']['includeAll']){_0x3afcf2[_0xf87f('0x42')]=[{'all':!![]}];}return db['SugarcrmField']['findAll'](_0x3afcf2);})[_0xf87f('0x25')](function(_0x571470){_0x2046e4[_0xf87f('0x43')]=_0x571470;return _0x2046e4;})['then'](respondWithFilteredResult(_0x47f171,_0x3afcf2))[_0xf87f('0x44')](handleError(_0x47f171,null));};exports[_0xf87f('0x45')]=function(_0x107486,_0x368e56){var _0x52726f={'raw':!![],'where':{'id':_0x107486['params']['id']}},_0x288466={};_0x288466[_0xf87f('0x32')]=_[_0xf87f('0x31')](db[_0xf87f('0x2c')][_0xf87f('0x2d')]);_0x288466[_0xf87f('0x30')]=_[_0xf87f('0x31')](_0x107486[_0xf87f('0x30')]);_0x288466[_0xf87f('0x3c')]=_[_0xf87f('0x34')](_0x288466[_0xf87f('0x32')],_0x288466[_0xf87f('0x30')]);_0x52726f[_0xf87f('0x33')]=_['intersection'](_0x288466['model'],qs[_0xf87f('0x35')](_0x107486[_0xf87f('0x30')][_0xf87f('0x35')]));_0x52726f['attributes']=_0x52726f[_0xf87f('0x33')]['length']?_0x52726f[_0xf87f('0x33')]:_0x288466['model'];if(_0x107486[_0xf87f('0x30')][_0xf87f('0x46')]){_0x52726f['include']=[{'all':!![]}];}_0x52726f=_[_0xf87f('0x47')]({},_0x52726f,_0x107486['options']);return db['SugarcrmField'][_0xf87f('0x48')](_0x52726f)[_0xf87f('0x25')](handleEntityNotFound(_0x368e56,null))['then'](respondWithResult(_0x368e56,null))['catch'](handleError(_0x368e56,null));};exports[_0xf87f('0x49')]=function(_0x547586,_0x54bac8){return db[_0xf87f('0x2c')][_0xf87f('0x49')](_0x547586['body'],{})['then'](respondWithResult(_0x54bac8,0xc9))[_0xf87f('0x44')](handleError(_0x54bac8,null));};exports[_0xf87f('0x24')]=function(_0x52f711,_0x42b236){if(_0x52f711[_0xf87f('0x4a')]['id']){delete _0x52f711[_0xf87f('0x4a')]['id'];}return db[_0xf87f('0x2c')][_0xf87f('0x48')]({'where':{'id':_0x52f711['params']['id']}})[_0xf87f('0x25')](handleEntityNotFound(_0x42b236,null))[_0xf87f('0x25')](saveUpdates(_0x52f711['body'],null))[_0xf87f('0x25')](respondWithResult(_0x42b236,null))['catch'](handleError(_0x42b236,null));};exports[_0xf87f('0x4b')]=function(_0x28ab0f,_0x1b9295){return db[_0xf87f('0x2c')][_0xf87f('0x48')]({'where':{'id':_0x28ab0f[_0xf87f('0x4c')]['id']}})[_0xf87f('0x25')](handleEntityNotFound(_0x1b9295,null))[_0xf87f('0x25')](removeEntity(_0x1b9295,null))[_0xf87f('0x44')](handleError(_0x1b9295,null));}; \ No newline at end of file +var _0x5a9c=['nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','end','error','stack','name','send','index','SugarcrmField','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty'];(function(_0x1aec31,_0x32b0bf){var _0x5c8ec9=function(_0x560657){while(--_0x560657){_0x1aec31['push'](_0x1aec31['shift']());}};_0x5c8ec9(++_0x32b0bf);}(_0x5a9c,0xaa));var _0xc5a9=function(_0x3516ed,_0x9cb96a){_0x3516ed=_0x3516ed-0x0;var _0x6b18f2=_0x5a9c[_0x3516ed];return _0x6b18f2;};'use strict';var emlformat=require(_0xc5a9('0x0'));var rimraf=require(_0xc5a9('0x1'));var zipdir=require(_0xc5a9('0x2'));var jsonpatch=require(_0xc5a9('0x3'));var rp=require('request-promise');var moment=require(_0xc5a9('0x4'));var BPromise=require(_0xc5a9('0x5'));var Mustache=require(_0xc5a9('0x6'));var util=require(_0xc5a9('0x7'));var path=require(_0xc5a9('0x8'));var sox=require(_0xc5a9('0x9'));var csv=require(_0xc5a9('0xa'));var ejs=require(_0xc5a9('0xb'));var fs=require('fs');var fs_extra=require(_0xc5a9('0xc'));var _=require(_0xc5a9('0xd'));var squel=require(_0xc5a9('0xe'));var crypto=require(_0xc5a9('0xf'));var jsforce=require(_0xc5a9('0x10'));var deskjs=require(_0xc5a9('0x11'));var toCsv=require(_0xc5a9('0xa'));var querystring=require(_0xc5a9('0x12'));var Papa=require(_0xc5a9('0x13'));var Redis=require(_0xc5a9('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xc5a9('0x15'));var as=require(_0xc5a9('0x16'));var hardwareService=require(_0xc5a9('0x17'));var logger=require(_0xc5a9('0x18'))(_0xc5a9('0x19'));var utils=require(_0xc5a9('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc5a9('0x1b'))['db'];function respondWithStatusCode(_0x43aa10,_0x26a47c){_0x26a47c=_0x26a47c||0xcc;return function(_0x20f52e){if(_0x20f52e){return _0x43aa10[_0xc5a9('0x1c')](_0x26a47c);}return _0x43aa10[_0xc5a9('0x1d')](_0x26a47c)['end']();};}function respondWithResult(_0x2f1a4b,_0x2cfce4){_0x2cfce4=_0x2cfce4||0xc8;return function(_0x474e5b){if(_0x474e5b){return _0x2f1a4b[_0xc5a9('0x1d')](_0x2cfce4)[_0xc5a9('0x1e')](_0x474e5b);}};}function respondWithFilteredResult(_0x3179ae,_0x3fc00e){return function(_0x1f741b){if(_0x1f741b){var _0x29e316=typeof _0x3fc00e[_0xc5a9('0x1f')]===_0xc5a9('0x20')&&typeof _0x3fc00e[_0xc5a9('0x21')]==='undefined';var _0x4820fe=_0x1f741b[_0xc5a9('0x22')];var _0x31d69f=_0x29e316?0x0:_0x3fc00e[_0xc5a9('0x1f')];var _0x2668af=_0x29e316?_0x1f741b[_0xc5a9('0x22')]:_0x3fc00e[_0xc5a9('0x1f')]+_0x3fc00e[_0xc5a9('0x21')];var _0x5a21be;if(_0x2668af>=_0x4820fe){_0x2668af=_0x4820fe;_0x5a21be=0xc8;}else{_0x5a21be=0xce;}_0x3179ae[_0xc5a9('0x1d')](_0x5a21be);return _0x3179ae[_0xc5a9('0x23')](_0xc5a9('0x24'),_0x31d69f+'-'+_0x2668af+'/'+_0x4820fe)[_0xc5a9('0x1e')](_0x1f741b);}return null;};}function patchUpdates(_0x58da9a){return function(_0x16ee65){try{jsonpatch['apply'](_0x16ee65,_0x58da9a,!![]);}catch(_0x421cef){return BPromise['reject'](_0x421cef);}return _0x16ee65[_0xc5a9('0x25')]();};}function saveUpdates(_0x16b347,_0x391538){return function(_0x53ff82){if(_0x53ff82){return _0x53ff82[_0xc5a9('0x26')](_0x16b347)[_0xc5a9('0x27')](function(_0x1a191a){return _0x1a191a;});}return null;};}function removeEntity(_0x1f3f85,_0x253693){return function(_0x16c921){if(_0x16c921){return _0x16c921['destroy']()['then'](function(){_0x1f3f85['status'](0xcc)[_0xc5a9('0x28')]();});}};}function handleEntityNotFound(_0x4c9dcd,_0xa871f1){return function(_0x580680){if(!_0x580680){_0x4c9dcd['sendStatus'](0x194);}return _0x580680;};}function handleError(_0x19ddc6,_0x7c20a0){_0x7c20a0=_0x7c20a0||0x1f4;return function(_0x5618e3){logger[_0xc5a9('0x29')](_0x5618e3[_0xc5a9('0x2a')]);if(_0x5618e3[_0xc5a9('0x2b')]){delete _0x5618e3[_0xc5a9('0x2b')];}_0x19ddc6['status'](_0x7c20a0)[_0xc5a9('0x2c')](_0x5618e3);};}exports[_0xc5a9('0x2d')]=function(_0x26fddc,_0x5cf8bf){var _0x249fe2={},_0x4c77d5={},_0x45e0b0={'count':0x0,'rows':[]};var _0x4a5741=_['map'](db[_0xc5a9('0x2e')][_0xc5a9('0x2f')],function(_0x34553d){return{'name':_0x34553d[_0xc5a9('0x30')],'type':_0x34553d[_0xc5a9('0x31')]['key']};});_0x4c77d5[_0xc5a9('0x32')]=_['map'](_0x4a5741,'name');_0x4c77d5[_0xc5a9('0x33')]=_[_0xc5a9('0x34')](_0x26fddc['query']);_0x4c77d5[_0xc5a9('0x35')]=_[_0xc5a9('0x36')](_0x4c77d5[_0xc5a9('0x32')],_0x4c77d5['query']);_0x249fe2[_0xc5a9('0x37')]=_[_0xc5a9('0x36')](_0x4c77d5[_0xc5a9('0x32')],qs['fields'](_0x26fddc[_0xc5a9('0x33')][_0xc5a9('0x38')]));_0x249fe2[_0xc5a9('0x37')]=_0x249fe2[_0xc5a9('0x37')]['length']?_0x249fe2[_0xc5a9('0x37')]:_0x4c77d5[_0xc5a9('0x32')];if(!_0x26fddc[_0xc5a9('0x33')][_0xc5a9('0x39')](_0xc5a9('0x3a'))){_0x249fe2[_0xc5a9('0x21')]=qs[_0xc5a9('0x21')](_0x26fddc[_0xc5a9('0x33')][_0xc5a9('0x21')]);_0x249fe2['offset']=qs[_0xc5a9('0x1f')](_0x26fddc[_0xc5a9('0x33')][_0xc5a9('0x1f')]);}_0x249fe2['order']=qs[_0xc5a9('0x3b')](_0x26fddc[_0xc5a9('0x33')][_0xc5a9('0x3b')]);_0x249fe2[_0xc5a9('0x3c')]=qs[_0xc5a9('0x35')](_[_0xc5a9('0x3d')](_0x26fddc[_0xc5a9('0x33')],_0x4c77d5[_0xc5a9('0x35')]),_0x4a5741);if(_0x26fddc[_0xc5a9('0x33')][_0xc5a9('0x3e')]){_0x249fe2[_0xc5a9('0x3c')]=_[_0xc5a9('0x3f')](_0x249fe2[_0xc5a9('0x3c')],{'$or':_['map'](_0x4a5741,function(_0x3a2f6f){if(_0x3a2f6f[_0xc5a9('0x31')]!==_0xc5a9('0x40')){var _0x259abd={};_0x259abd[_0x3a2f6f['name']]={'$like':'%'+_0x26fddc[_0xc5a9('0x33')][_0xc5a9('0x3e')]+'%'};return _0x259abd;}})});}_0x249fe2=_[_0xc5a9('0x3f')]({},_0x249fe2,_0x26fddc[_0xc5a9('0x41')]);var _0x1e9d34={'where':_0x249fe2[_0xc5a9('0x3c')]};return db[_0xc5a9('0x2e')][_0xc5a9('0x22')](_0x1e9d34)[_0xc5a9('0x27')](function(_0x26e9ff){_0x45e0b0[_0xc5a9('0x22')]=_0x26e9ff;if(_0x26fddc[_0xc5a9('0x33')]['includeAll']){_0x249fe2[_0xc5a9('0x42')]=[{'all':!![]}];}return db[_0xc5a9('0x2e')][_0xc5a9('0x43')](_0x249fe2);})[_0xc5a9('0x27')](function(_0x22a68b){_0x45e0b0[_0xc5a9('0x44')]=_0x22a68b;return _0x45e0b0;})['then'](respondWithFilteredResult(_0x5cf8bf,_0x249fe2))[_0xc5a9('0x45')](handleError(_0x5cf8bf,null));};exports[_0xc5a9('0x46')]=function(_0x48215f,_0x30e237){var _0x34802c={'raw':!![],'where':{'id':_0x48215f[_0xc5a9('0x47')]['id']}},_0x5ad968={};_0x5ad968[_0xc5a9('0x32')]=_[_0xc5a9('0x34')](db['SugarcrmField'][_0xc5a9('0x2f')]);_0x5ad968[_0xc5a9('0x33')]=_[_0xc5a9('0x34')](_0x48215f[_0xc5a9('0x33')]);_0x5ad968[_0xc5a9('0x35')]=_[_0xc5a9('0x36')](_0x5ad968[_0xc5a9('0x32')],_0x5ad968[_0xc5a9('0x33')]);_0x34802c[_0xc5a9('0x37')]=_[_0xc5a9('0x36')](_0x5ad968[_0xc5a9('0x32')],qs[_0xc5a9('0x38')](_0x48215f[_0xc5a9('0x33')][_0xc5a9('0x38')]));_0x34802c[_0xc5a9('0x37')]=_0x34802c[_0xc5a9('0x37')]['length']?_0x34802c[_0xc5a9('0x37')]:_0x5ad968[_0xc5a9('0x32')];if(_0x48215f[_0xc5a9('0x33')][_0xc5a9('0x48')]){_0x34802c['include']=[{'all':!![]}];}_0x34802c=_['merge']({},_0x34802c,_0x48215f[_0xc5a9('0x41')]);return db[_0xc5a9('0x2e')]['find'](_0x34802c)['then'](handleEntityNotFound(_0x30e237,null))['then'](respondWithResult(_0x30e237,null))['catch'](handleError(_0x30e237,null));};exports[_0xc5a9('0x49')]=function(_0x1112ca,_0x4c0c55){return db['SugarcrmField'][_0xc5a9('0x49')](_0x1112ca[_0xc5a9('0x4a')],{})[_0xc5a9('0x27')](respondWithResult(_0x4c0c55,0xc9))['catch'](handleError(_0x4c0c55,null));};exports[_0xc5a9('0x26')]=function(_0x459e68,_0x2e0042){if(_0x459e68[_0xc5a9('0x4a')]['id']){delete _0x459e68[_0xc5a9('0x4a')]['id'];}return db[_0xc5a9('0x2e')][_0xc5a9('0x4b')]({'where':{'id':_0x459e68[_0xc5a9('0x47')]['id']}})[_0xc5a9('0x27')](handleEntityNotFound(_0x2e0042,null))[_0xc5a9('0x27')](saveUpdates(_0x459e68[_0xc5a9('0x4a')],null))[_0xc5a9('0x27')](respondWithResult(_0x2e0042,null))['catch'](handleError(_0x2e0042,null));};exports['destroy']=function(_0x248294,_0x59d9ce){return db[_0xc5a9('0x2e')]['find']({'where':{'id':_0x248294[_0xc5a9('0x47')]['id']}})[_0xc5a9('0x27')](handleEntityNotFound(_0x59d9ce,null))['then'](removeEntity(_0x59d9ce,null))[_0xc5a9('0x45')](handleError(_0x59d9ce,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 4c727a5..6151c27 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 _0x5be2=['moment','path','rimraf','define','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','util'];(function(_0x21ad83,_0x3a3775){var _0x3122be=function(_0x555bea){while(--_0x555bea){_0x21ad83['push'](_0x21ad83['shift']());}};_0x3122be(++_0x3a3775);}(_0x5be2,0x15e));var _0x25be=function(_0x23107f,_0x182469){_0x23107f=_0x23107f-0x0;var _0x5e6ea6=_0x5be2[_0x23107f];return _0x5e6ea6;};'use strict';var _=require('lodash');var util=require(_0x25be('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x25be('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x25be('0x2'));var rimraf=require(_0x25be('0x3'));var config=require('../../config/environment');var attributes=require('./intSugarcrmField.attributes');module['exports']=function(_0x59de85,_0x49b1a2){return _0x59de85[_0x25be('0x4')]('SugarcrmField',attributes,{'tableName':_0x25be('0x5'),'paranoid':![],'indexes':[{'name':_0x25be('0x6'),'fields':[_0x25be('0x7'),_0x25be('0x8')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x18aa=['sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmField.attributes'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x18aa,0xcf));var _0xa18a=function(_0x55b560,_0x582bd0){_0x55b560=_0x55b560-0x0;var _0x552bf4=_0x18aa[_0x55b560];return _0x552bf4;};'use strict';var _=require(_0xa18a('0x0'));var util=require(_0xa18a('0x1'));var logger=require(_0xa18a('0x2'))('api');var moment=require(_0xa18a('0x3'));var BPromise=require(_0xa18a('0x4'));var rp=require(_0xa18a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa18a('0x6'));var config=require(_0xa18a('0x7'));var attributes=require(_0xa18a('0x8'));module['exports']=function(_0x503320,_0xfb372c){return _0x503320['define']('SugarcrmField',attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0xa18a('0x9'),'fields':[_0xa18a('0xa'),_0xa18a('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index ac22a91..6a4a391 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 _0x6890=['../../config/utils','../../config/logger','jayson/promise','http','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis'];(function(_0x5a26f5,_0x196300){var _0x2e9ef7=function(_0x593736){while(--_0x593736){_0x5a26f5['push'](_0x5a26f5['shift']());}};_0x2e9ef7(++_0x196300);}(_0x6890,0x152));var _0x0689=function(_0x440dab,_0x1125c8){_0x440dab=_0x440dab-0x0;var _0x55a9ee=_0x6890[_0x440dab];return _0x55a9ee;};'use strict';var _=require(_0x0689('0x0'));var util=require('util');var moment=require(_0x0689('0x1'));var BPromise=require('bluebird');var rs=require(_0x0689('0x2'));var fs=require('fs');var Redis=require(_0x0689('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0689('0x4'));var logger=require(_0x0689('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0689('0x6'));var client=jayson['client'][_0x0689('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3bcd21,_0x784732,_0x45fc13){return new BPromise(function(_0x3987e2,_0x37cf57){return client['request'](_0x3bcd21,_0x45fc13)[_0x0689('0x8')](function(_0xc0bdac){logger[_0x0689('0x9')](_0x0689('0xa'),_0x784732,_0x0689('0xb'));logger['debug'](_0x0689('0xc'),_0x784732,'request\x20sent',JSON[_0x0689('0xd')](_0xc0bdac));if(_0xc0bdac[_0x0689('0xe')]){if(_0xc0bdac[_0x0689('0xe')][_0x0689('0xf')]===0x1f4){logger[_0x0689('0xe')](_0x0689('0xa'),_0x784732,_0xc0bdac['error']['message']);return _0x37cf57(_0xc0bdac[_0x0689('0xe')][_0x0689('0x10')]);}logger[_0x0689('0xe')](_0x0689('0xa'),_0x784732,_0xc0bdac[_0x0689('0xe')][_0x0689('0x10')]);return _0x3987e2(_0xc0bdac[_0x0689('0xe')][_0x0689('0x10')]);}else{logger[_0x0689('0x9')](_0x0689('0xa'),_0x784732,_0x0689('0xb'));_0x3987e2(_0xc0bdac[_0x0689('0x11')][_0x0689('0x10')]);}})[_0x0689('0x12')](function(_0x38dcaf){logger[_0x0689('0xe')](_0x0689('0xa'),_0x784732,_0x38dcaf);_0x37cf57(_0x38dcaf);});});} \ No newline at end of file +var _0x67a6=['request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s'];(function(_0x43bc20,_0x24c20c){var _0xe8545=function(_0x428ff4){while(--_0x428ff4){_0x43bc20['push'](_0x43bc20['shift']());}};_0xe8545(++_0x24c20c);}(_0x67a6,0x105));var _0x667a=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x67a6[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x667a('0x0'));var util=require('util');var moment=require(_0x667a('0x1'));var BPromise=require(_0x667a('0x2'));var rs=require(_0x667a('0x3'));var fs=require('fs');var Redis=require(_0x667a('0x4'));var db=require(_0x667a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x667a('0x6'))(_0x667a('0x7'));var config=require(_0x667a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x667a('0x9')][_0x667a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x55b932,_0x3e9d21,_0x265ec4){return new BPromise(function(_0x202f5f,_0x5cc056){return client[_0x667a('0xb')](_0x55b932,_0x265ec4)[_0x667a('0xc')](function(_0x5dca4b){logger[_0x667a('0xd')](_0x667a('0xe'),_0x3e9d21,_0x667a('0xf'));logger[_0x667a('0x10')](_0x667a('0x11'),_0x3e9d21,_0x667a('0xf'),JSON[_0x667a('0x12')](_0x5dca4b));if(_0x5dca4b[_0x667a('0x13')]){if(_0x5dca4b[_0x667a('0x13')][_0x667a('0x14')]===0x1f4){logger[_0x667a('0x13')](_0x667a('0xe'),_0x3e9d21,_0x5dca4b['error'][_0x667a('0x15')]);return _0x5cc056(_0x5dca4b[_0x667a('0x13')][_0x667a('0x15')]);}logger[_0x667a('0x13')](_0x667a('0xe'),_0x3e9d21,_0x5dca4b[_0x667a('0x13')]['message']);return _0x202f5f(_0x5dca4b[_0x667a('0x13')]['message']);}else{logger[_0x667a('0xd')]('SugarcrmField,\x20%s,\x20%s',_0x3e9d21,'request\x20sent');_0x202f5f(_0x5dca4b['result'][_0x667a('0x15')]);}})[_0x667a('0x16')](function(_0x249b33){logger[_0x667a('0x13')](_0x667a('0xe'),_0x3e9d21,_0x249b33);_0x5cc056(_0x249b33);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index b9cb4b6..0512b8e 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 _0x1fdc=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','multer','util','connect-timeout','express','Router'];(function(_0x481ff7,_0x2b6ebb){var _0x1c1573=function(_0x4933fe){while(--_0x4933fe){_0x481ff7['push'](_0x481ff7['shift']());}};_0x1c1573(++_0x2b6ebb);}(_0x1fdc,0x8b));var _0xc1fd=function(_0x1b6c6d,_0x2983b0){_0x1b6c6d=_0x1b6c6d-0x0;var _0x290d9d=_0x1fdc[_0x1b6c6d];return _0x290d9d;};'use strict';var multer=require(_0xc1fd('0x0'));var util=require(_0xc1fd('0x1'));var path=require('path');var timeout=require(_0xc1fd('0x2'));var express=require(_0xc1fd('0x3'));var router=express[_0xc1fd('0x4')]();var fs_extra=require(_0xc1fd('0x5'));var auth=require(_0xc1fd('0x6'));var interaction=require(_0xc1fd('0x7'));var config=require(_0xc1fd('0x8'));var controller=require('./intVtigerAccount.controller');router[_0xc1fd('0x9')]('/',auth[_0xc1fd('0xa')](),controller[_0xc1fd('0xb')]);router[_0xc1fd('0x9')](_0xc1fd('0xc'),auth[_0xc1fd('0xa')](),controller[_0xc1fd('0xd')]);router[_0xc1fd('0x9')](_0xc1fd('0xe'),auth[_0xc1fd('0xa')](),controller[_0xc1fd('0xf')]);router[_0xc1fd('0x9')](_0xc1fd('0x10'),auth['isAuthenticated'](),controller[_0xc1fd('0x11')]);router[_0xc1fd('0x12')]('/',auth['isAuthenticated'](),controller[_0xc1fd('0x13')]);router['post'](_0xc1fd('0xe'),auth['isAuthenticated'](),controller[_0xc1fd('0x14')]);router[_0xc1fd('0x15')](_0xc1fd('0xc'),auth['isAuthenticated'](),controller[_0xc1fd('0x16')]);router[_0xc1fd('0x17')](_0xc1fd('0xc'),auth[_0xc1fd('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xbc17=['post','create','addConfiguration','put','update','delete','destroy','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./intVtigerAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','/:id/fields'];(function(_0x585f5c,_0xa7a3ae){var _0xdf7b92=function(_0x5dc401){while(--_0x5dc401){_0x585f5c['push'](_0x585f5c['shift']());}};_0xdf7b92(++_0xa7a3ae);}(_0xbc17,0x1ab));var _0x7bc1=function(_0x17bfa4,_0x3eb5f7){_0x17bfa4=_0x17bfa4-0x0;var _0x3d9ca8=_0xbc17[_0x17bfa4];return _0x3d9ca8;};'use strict';var multer=require(_0x7bc1('0x0'));var util=require(_0x7bc1('0x1'));var path=require('path');var timeout=require(_0x7bc1('0x2'));var express=require(_0x7bc1('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7bc1('0x4'));var interaction=require(_0x7bc1('0x5'));var config=require('../../config/environment');var controller=require(_0x7bc1('0x6'));router['get']('/',auth[_0x7bc1('0x7')](),controller[_0x7bc1('0x8')]);router[_0x7bc1('0x9')](_0x7bc1('0xa'),auth[_0x7bc1('0x7')](),controller[_0x7bc1('0xb')]);router[_0x7bc1('0x9')](_0x7bc1('0xc'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x7bc1('0x9')](_0x7bc1('0xd'),auth[_0x7bc1('0x7')](),controller['getFields']);router[_0x7bc1('0xe')]('/',auth[_0x7bc1('0x7')](),controller[_0x7bc1('0xf')]);router[_0x7bc1('0xe')](_0x7bc1('0xc'),auth[_0x7bc1('0x7')](),controller[_0x7bc1('0x10')]);router[_0x7bc1('0x11')](_0x7bc1('0xa'),auth['isAuthenticated'](),controller[_0x7bc1('0x12')]);router[_0x7bc1('0x13')]('/:id',auth[_0x7bc1('0x7')](),controller[_0x7bc1('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 2d7517b..64a278e 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 _0xcc0f=['STRING','HelpDesk','exports'];(function(_0xddb2b6,_0x32d4d2){var _0x208f17=function(_0x5730b5){while(--_0x5730b5){_0xddb2b6['push'](_0xddb2b6['shift']());}};_0x208f17(++_0x32d4d2);}(_0xcc0f,0x1ac));var _0xfcc0=function(_0xd2d4f6,_0x45a72d){_0xd2d4f6=_0xd2d4f6-0x0;var _0x3fc210=_0xcc0f[_0xd2d4f6];return _0x3fc210;};'use strict';var Sequelize=require('sequelize');module[_0xfcc0('0x0')]={'name':{'type':Sequelize[_0xfcc0('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xfcc0('0x1')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xfcc0('0x2')},'remoteUri':{'type':Sequelize[_0xfcc0('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0xfcc0('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x1728=['HelpDesk','sequelize','exports','STRING'];(function(_0x1064bc,_0x206f12){var _0x5edc45=function(_0x5087bd){while(--_0x5087bd){_0x1064bc['push'](_0x1064bc['shift']());}};_0x5edc45(++_0x206f12);}(_0x1728,0x1bd));var _0x8172=function(_0x29f9a4,_0x3eb823){_0x29f9a4=_0x29f9a4-0x0;var _0x1e292b=_0x1728[_0x29f9a4];return _0x1e292b;};'use strict';var Sequelize=require(_0x8172('0x0'));module[_0x8172('0x1')]={'name':{'type':Sequelize[_0x8172('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8172('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x8172('0x2')],'allowNull':![],'defaultValue':_0x8172('0x3')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x8172('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x8172('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 40078f0..0593047 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 _0x2996=['substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','POST','login','result','describe','reference','owner','remove','editable','label','startsWith','picklist','picklistValues','log','vTiger\x20error:\x20','error','getFields,\x20%s,\x20%s,\x20%s','statusCode','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','options','VtigerAccount','includeAll','include','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne','VtigerConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getFields','username','description','moduleName','accessKey','remoteUri','slice'];(function(_0x3f6bcf,_0x531e79){var _0x1c5350=function(_0x282fc5){while(--_0x282fc5){_0x3f6bcf['push'](_0x3f6bcf['shift']());}};_0x1c5350(++_0x531e79);}(_0x2996,0x1f4));var _0x6299=function(_0x12991f,_0x5e37ac){_0x12991f=_0x12991f-0x0;var _0x2ac69f=_0x2996[_0x12991f];return _0x2ac69f;};'use strict';var emlformat=require(_0x6299('0x0'));var rimraf=require(_0x6299('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6299('0x2'));var rp=require(_0x6299('0x3'));var moment=require(_0x6299('0x4'));var BPromise=require(_0x6299('0x5'));var Mustache=require(_0x6299('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x6299('0x7'));var ejs=require(_0x6299('0x8'));var fs=require('fs');var fs_extra=require(_0x6299('0x9'));var _=require(_0x6299('0xa'));var squel=require(_0x6299('0xb'));var crypto=require(_0x6299('0xc'));var jsforce=require(_0x6299('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6299('0x7'));var querystring=require(_0x6299('0xe'));var Papa=require(_0x6299('0xf'));var Redis=require(_0x6299('0x10'));var authService=require(_0x6299('0x11'));var qs=require(_0x6299('0x12'));var as=require(_0x6299('0x13'));var hardwareService=require(_0x6299('0x14'));var logger=require(_0x6299('0x15'))(_0x6299('0x16'));var utils=require(_0x6299('0x17'));var config=require(_0x6299('0x18'));var licenseUtil=require(_0x6299('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0x6299('0x1a'));function respondWithStatusCode(_0x59522b,_0x2bb8b4){_0x2bb8b4=_0x2bb8b4||0xcc;return function(_0x420d8e){if(_0x420d8e){return _0x59522b['sendStatus'](_0x2bb8b4);}return _0x59522b[_0x6299('0x1b')](_0x2bb8b4)[_0x6299('0x1c')]();};}function respondWithResult(_0x770e19,_0xdc035e){_0xdc035e=_0xdc035e||0xc8;return function(_0x355ae5){if(_0x355ae5){return _0x770e19[_0x6299('0x1b')](_0xdc035e)['json'](_0x355ae5);}};}function respondWithFilteredResult(_0x50d3ce,_0x548b60){return function(_0x487e4e){if(_0x487e4e){var _0x1a8181=typeof _0x548b60[_0x6299('0x1d')]===_0x6299('0x1e')&&typeof _0x548b60[_0x6299('0x1f')]===_0x6299('0x1e');var _0x3771ef=_0x487e4e[_0x6299('0x20')];var _0x2300fc=_0x1a8181?0x0:_0x548b60[_0x6299('0x1d')];var _0x1c546c=_0x1a8181?_0x487e4e['count']:_0x548b60[_0x6299('0x1d')]+_0x548b60[_0x6299('0x1f')];var _0xae40c1;if(_0x1c546c>=_0x3771ef){_0x1c546c=_0x3771ef;_0xae40c1=0xc8;}else{_0xae40c1=0xce;}_0x50d3ce[_0x6299('0x1b')](_0xae40c1);return _0x50d3ce[_0x6299('0x21')](_0x6299('0x22'),_0x2300fc+'-'+_0x1c546c+'/'+_0x3771ef)[_0x6299('0x23')](_0x487e4e);}return null;};}function patchUpdates(_0x3f381c){return function(_0x5023e1){try{jsonpatch[_0x6299('0x24')](_0x5023e1,_0x3f381c,!![]);}catch(_0x55f5bd){return BPromise[_0x6299('0x25')](_0x55f5bd);}return _0x5023e1[_0x6299('0x26')]();};}function saveUpdates(_0x28300f,_0x2de66c){return function(_0x142a29){if(_0x142a29){return _0x142a29[_0x6299('0x27')](_0x28300f)[_0x6299('0x28')](function(_0x342574){return _0x342574;});}return null;};}function removeEntity(_0x1b99d2,_0x114055){return function(_0x31d42f){if(_0x31d42f){return _0x31d42f[_0x6299('0x29')]()[_0x6299('0x28')](function(){_0x1b99d2['status'](0xcc)[_0x6299('0x1c')]();});}};}function handleEntityNotFound(_0x2b1be1,_0x21b2d1){return function(_0x231de5){if(!_0x231de5){_0x2b1be1[_0x6299('0x2a')](0x194);}return _0x231de5;};}function handleError(_0x20c950,_0x5fea87){_0x5fea87=_0x5fea87||0x1f4;return function(_0x432c3b){logger['error'](_0x432c3b[_0x6299('0x2b')]);if(_0x432c3b[_0x6299('0x2c')]){delete _0x432c3b[_0x6299('0x2c')];}_0x20c950[_0x6299('0x1b')](_0x5fea87)[_0x6299('0x2d')](_0x432c3b);};}exports['index']=function(_0x362a8b,_0xc7c9d2){var _0x42a98b={},_0x25c7cc={},_0x2b367c={'count':0x0,'rows':[]};var _0x8900a4=_[_0x6299('0x2e')](db['VtigerAccount'][_0x6299('0x2f')],function(_0x5e7576){return{'name':_0x5e7576[_0x6299('0x30')],'type':_0x5e7576[_0x6299('0x31')][_0x6299('0x32')]};});_0x25c7cc[_0x6299('0x33')]=_[_0x6299('0x2e')](_0x8900a4,_0x6299('0x2c'));_0x25c7cc[_0x6299('0x34')]=_[_0x6299('0x35')](_0x362a8b[_0x6299('0x34')]);_0x25c7cc['filters']=_[_0x6299('0x36')](_0x25c7cc[_0x6299('0x33')],_0x25c7cc[_0x6299('0x34')]);_0x42a98b[_0x6299('0x37')]=_['intersection'](_0x25c7cc[_0x6299('0x33')],qs[_0x6299('0x38')](_0x362a8b[_0x6299('0x34')][_0x6299('0x38')]));_0x42a98b[_0x6299('0x37')]=_0x42a98b[_0x6299('0x37')][_0x6299('0x39')]?_0x42a98b[_0x6299('0x37')]:_0x25c7cc[_0x6299('0x33')];if(!_0x362a8b[_0x6299('0x34')][_0x6299('0x3a')](_0x6299('0x3b'))){_0x42a98b['limit']=qs[_0x6299('0x1f')](_0x362a8b[_0x6299('0x34')][_0x6299('0x1f')]);_0x42a98b[_0x6299('0x1d')]=qs[_0x6299('0x1d')](_0x362a8b[_0x6299('0x34')]['offset']);}_0x42a98b[_0x6299('0x3c')]=qs[_0x6299('0x3d')](_0x362a8b[_0x6299('0x34')][_0x6299('0x3d')]);_0x42a98b[_0x6299('0x3e')]=qs['filters'](_[_0x6299('0x3f')](_0x362a8b['query'],_0x25c7cc[_0x6299('0x40')]),_0x8900a4);if(_0x362a8b[_0x6299('0x34')]['filter']){_0x42a98b[_0x6299('0x3e')]=_['merge'](_0x42a98b[_0x6299('0x3e')],{'$or':_['map'](_0x8900a4,function(_0x2db91d){if(_0x2db91d[_0x6299('0x31')]!=='VIRTUAL'){var _0x4a21cd={};_0x4a21cd[_0x2db91d[_0x6299('0x2c')]]={'$like':'%'+_0x362a8b[_0x6299('0x34')][_0x6299('0x41')]+'%'};return _0x4a21cd;}})});}_0x42a98b=_[_0x6299('0x42')]({},_0x42a98b,_0x362a8b[_0x6299('0x43')]);var _0x155b18={'where':_0x42a98b[_0x6299('0x3e')]};return db[_0x6299('0x44')][_0x6299('0x20')](_0x155b18)['then'](function(_0x129e8c){_0x2b367c[_0x6299('0x20')]=_0x129e8c;if(_0x362a8b['query'][_0x6299('0x45')]){_0x42a98b[_0x6299('0x46')]=[{'all':!![]}];}return db['VtigerAccount'][_0x6299('0x47')](_0x42a98b);})[_0x6299('0x28')](function(_0x4a0796){_0x2b367c[_0x6299('0x48')]=_0x4a0796;return _0x2b367c;})[_0x6299('0x28')](respondWithFilteredResult(_0xc7c9d2,_0x42a98b))[_0x6299('0x49')](handleError(_0xc7c9d2,null));};exports[_0x6299('0x4a')]=function(_0x4acd22,_0x3faa98){var _0x5edead={'raw':![],'where':{'id':_0x4acd22[_0x6299('0x4b')]['id']}},_0x341921={};_0x341921[_0x6299('0x33')]=_[_0x6299('0x35')](db[_0x6299('0x44')]['rawAttributes']);_0x341921[_0x6299('0x34')]=_[_0x6299('0x35')](_0x4acd22[_0x6299('0x34')]);_0x341921[_0x6299('0x40')]=_[_0x6299('0x36')](_0x341921[_0x6299('0x33')],_0x341921['query']);_0x5edead[_0x6299('0x37')]=_[_0x6299('0x36')](_0x341921[_0x6299('0x33')],qs[_0x6299('0x38')](_0x4acd22[_0x6299('0x34')][_0x6299('0x38')]));_0x5edead[_0x6299('0x37')]=_0x5edead[_0x6299('0x37')][_0x6299('0x39')]?_0x5edead['attributes']:_0x341921[_0x6299('0x33')];if(_0x4acd22[_0x6299('0x34')][_0x6299('0x45')]){_0x5edead[_0x6299('0x46')]=[{'all':!![]}];}_0x5edead=_[_0x6299('0x42')]({},_0x5edead,_0x4acd22[_0x6299('0x43')]);return db[_0x6299('0x44')][_0x6299('0x4c')](_0x5edead)['then'](handleEntityNotFound(_0x3faa98,null))[_0x6299('0x28')](respondWithResult(_0x3faa98,null))['catch'](handleError(_0x3faa98,null));};exports[_0x6299('0x4d')]=function(_0x2a5de1,_0x97c575){return db[_0x6299('0x44')][_0x6299('0x4d')](_0x2a5de1[_0x6299('0x4e')],{})['then'](respondWithResult(_0x97c575,0xc9))[_0x6299('0x49')](handleError(_0x97c575,null));};exports[_0x6299('0x27')]=function(_0x2df6d9,_0xeac3cf){if(_0x2df6d9['body']['id']){delete _0x2df6d9[_0x6299('0x4e')]['id'];}return db[_0x6299('0x44')]['find']({'where':{'id':_0x2df6d9[_0x6299('0x4b')]['id']}})[_0x6299('0x28')](handleEntityNotFound(_0xeac3cf,null))[_0x6299('0x28')](saveUpdates(_0x2df6d9[_0x6299('0x4e')],null))[_0x6299('0x28')](respondWithResult(_0xeac3cf,null))[_0x6299('0x49')](handleError(_0xeac3cf,null));};exports[_0x6299('0x29')]=function(_0x294003,_0xcbe837){return db[_0x6299('0x44')]['find']({'where':{'id':_0x294003[_0x6299('0x4b')]['id']}})[_0x6299('0x28')](handleEntityNotFound(_0xcbe837,null))[_0x6299('0x28')](removeEntity(_0xcbe837,null))[_0x6299('0x49')](handleError(_0xcbe837,null));};exports[_0x6299('0x4f')]=function(_0x1a5cde,_0x4d7cf9,_0x1a6d9a){var _0x5694e0={};var _0x2265c9={};var _0x3334be;var _0x1956cf;return db[_0x6299('0x44')][_0x6299('0x50')]({'where':{'id':_0x1a5cde[_0x6299('0x4b')]['id']}})[_0x6299('0x28')](handleEntityNotFound(_0x4d7cf9,null))[_0x6299('0x28')](function(_0x394a11){if(_0x394a11){_0x3334be=_0x394a11;_0x2265c9[_0x6299('0x33')]=_['keys'](db[_0x6299('0x51')][_0x6299('0x2f')]);_0x2265c9['query']=_[_0x6299('0x35')](_0x1a5cde[_0x6299('0x34')]);_0x2265c9['filters']=_[_0x6299('0x36')](_0x2265c9[_0x6299('0x33')],_0x2265c9[_0x6299('0x34')]);_0x5694e0[_0x6299('0x37')]=_[_0x6299('0x36')](_0x2265c9[_0x6299('0x33')],qs[_0x6299('0x38')](_0x1a5cde[_0x6299('0x34')]['fields']));_0x5694e0[_0x6299('0x37')]=_0x5694e0[_0x6299('0x37')][_0x6299('0x39')]?_0x5694e0[_0x6299('0x37')]:_0x2265c9['model'];_0x5694e0[_0x6299('0x3c')]=qs[_0x6299('0x3d')](_0x1a5cde[_0x6299('0x34')][_0x6299('0x3d')]);_0x5694e0[_0x6299('0x3e')]=qs[_0x6299('0x40')](_[_0x6299('0x3f')](_0x1a5cde[_0x6299('0x34')],_0x2265c9[_0x6299('0x40')]));if(_0x1a5cde[_0x6299('0x34')][_0x6299('0x41')]){_0x5694e0[_0x6299('0x3e')]=_[_0x6299('0x42')](_0x5694e0['where'],{'$or':_[_0x6299('0x2e')](_0x5694e0[_0x6299('0x37')],function(_0x32320a){var _0x182fc5={};_0x182fc5[_0x32320a]={'$like':'%'+_0x1a5cde[_0x6299('0x34')][_0x6299('0x41')]+'%'};return _0x182fc5;})});}_0x5694e0=_[_0x6299('0x42')]({},_0x5694e0,_0x1a5cde['options']);return _0x3334be[_0x6299('0x4f')](_0x5694e0);}})[_0x6299('0x28')](function(_0x7767b){if(_0x7767b){_0x1956cf=_0x7767b[_0x6299('0x39')];if(!_0x1a5cde[_0x6299('0x34')][_0x6299('0x3a')](_0x6299('0x3b'))){_0x5694e0[_0x6299('0x1f')]=qs[_0x6299('0x1f')](_0x1a5cde['query']['limit']);_0x5694e0['offset']=qs[_0x6299('0x1d')](_0x1a5cde[_0x6299('0x34')][_0x6299('0x1d')]);}return _0x3334be[_0x6299('0x4f')](_0x5694e0);}})['then'](function(_0x3c53a5){if(_0x3c53a5){return _0x3c53a5?{'count':_0x1956cf,'rows':_0x3c53a5}:null;}})[_0x6299('0x28')](respondWithResult(_0x4d7cf9,null))['catch'](handleError(_0x4d7cf9,null));};exports[_0x6299('0x52')]=function(_0x213587,_0x535e2b,_0x360009){if(_0x213587[_0x6299('0x4e')]['id']){delete _0x213587[_0x6299('0x4e')]['id'];}return db[_0x6299('0x44')][_0x6299('0x50')]({'where':{'id':_0x213587[_0x6299('0x4b')]['id']}})[_0x6299('0x28')](handleEntityNotFound(_0x535e2b,null))[_0x6299('0x28')](function(_0x52a8b9){if(_0x52a8b9){_0x213587[_0x6299('0x4e')][_0x6299('0x53')]=_0x52a8b9['id'];_0x213587[_0x6299('0x4e')][_0x6299('0x54')]=integrations[_0x6299('0x55')](_0x213587[_0x6299('0x4e')][_0x6299('0x56')],_0x213587[_0x6299('0x4e')][_0x6299('0x31')]);_0x213587[_0x6299('0x4e')]['Descriptions']=integrations['getDescriptions'](_0x213587[_0x6299('0x4e')][_0x6299('0x56')],_0x213587['body'][_0x6299('0x31')]);return db['VtigerConfiguration'][_0x6299('0x4d')](_0x213587[_0x6299('0x4e')],{'include':[{'model':db['VtigerField'],'as':_0x6299('0x54')},{'model':db['VtigerField'],'as':_0x6299('0x57')}]});}return null;})[_0x6299('0x28')](respondWithResult(_0x535e2b,null))['catch'](handleError(_0x535e2b,null));};var md5=require('md5');exports[_0x6299('0x58')]=function(_0x9277f1,_0x1d83cc,_0x31b0d1){var _0x1fe68e=null;var _0xcaf4f7=null;var _0x19190a=null;var _0x578437=null;var _0xba3b96='';return db[_0x6299('0x44')][_0x6299('0x50')]({'where':{'id':_0x9277f1[_0x6299('0x4b')]['id']},'attributes':['id','name',_0x6299('0x59'),_0x6299('0x5a'),_0x6299('0x5b'),'remoteUri','serverUrl',_0x6299('0x5c')]})[_0x6299('0x28')](handleEntityNotFound(_0x1d83cc,null))['then'](function(_0x4a7118){if(_0x4a7118){_0x1fe68e=_0x4a7118[_0x6299('0x59')];_0xcaf4f7=_0x4a7118[_0x6299('0x5c')];_0x19190a=_0x4a7118[_0x6299('0x5b')];_0xba3b96=_0x4a7118[_0x6299('0x5d')];var _0x2e8eb2=_0xba3b96[_0x6299('0x5e')](-0x1);if(_0x2e8eb2==='/'){_0xba3b96=_0xba3b96[_0x6299('0x5f')](0x0,_0xba3b96[_0x6299('0x60')](_0x2e8eb2));}_0x578437=util[_0x6299('0x61')](_0x6299('0x62'),_0xba3b96);var _0x4a0e8d={'method':_0x6299('0x63'),'uri':_0x578437,'qs':{'operation':_0x6299('0x64'),'username':_0x4a7118[_0x6299('0x59')]},'json':!![]};return rp(_0x4a0e8d);}})[_0x6299('0x28')](function(_0x27ae1b){if(_0x27ae1b[_0x6299('0x65')]){var _0x224d33={'method':_0x6299('0x66'),'uri':_0x578437,'form':{'operation':_0x6299('0x67'),'username':_0x1fe68e,'accessKey':md5(_0x27ae1b[_0x6299('0x68')]['token']+_0xcaf4f7)},'json':!![]};return rp(_0x224d33);}})[_0x6299('0x28')](function(_0x2137b5){if(_0x2137b5['success']){var _0x14e8a4={'method':_0x6299('0x63'),'uri':_0x578437,'qs':{'operation':_0x6299('0x69'),'username':_0x1fe68e,'sessionName':_0x2137b5[_0x6299('0x68')]['sessionName'],'elementType':_0x19190a},'json':!![]};return rp(_0x14e8a4);}})[_0x6299('0x28')](function(_0x3e17de){if(_0x3e17de[_0x6299('0x65')]){var _0x32da29=['autogenerated',_0x6299('0x6a'),_0x6299('0x6b')];_[_0x6299('0x6c')](_0x3e17de['result']['fields'],function(_0x16e7d4){return _0x32da29['includes'](_0x16e7d4[_0x6299('0x31')][_0x6299('0x2c')]);});_[_0x6299('0x6c')](_0x3e17de[_0x6299('0x68')][_0x6299('0x38')],function(_0x17d3f1){return _0x17d3f1[_0x6299('0x6d')]==='false';});return{'count':_0x3e17de[_0x6299('0x68')][_0x6299('0x38')]['length'],'rows':_[_0x6299('0x2e')](_0x3e17de['result']['fields'],function(_0xbaf03){return{'id':_0xbaf03['name'],'name':_0xbaf03[_0x6299('0x6e')],'custom':_[_0x6299('0x6f')](_0xbaf03[_0x6299('0x2c')],'cf_')?!![]:![],'options':_0xbaf03['type']['name']===_0x6299('0x70')&&_0xbaf03['type'][_0x6299('0x71')]['length']>0x0?_[_0x6299('0x2e')](_0xbaf03[_0x6299('0x31')][_0x6299('0x71')],function(_0x1d26e3){return{'name':_0x1d26e3[_0x6299('0x6e')],'value':_0x1d26e3['value']};}):[]};})};}})[_0x6299('0x28')](respondWithResult(_0x1d83cc,null))['catch'](function(_0x11620f){console[_0x6299('0x72')](_0x6299('0x73')+_0x11620f);var _0x30671f=_0x9277f1[_0x6299('0x34')]['test']?0x1f4:_0x11620f['statusCode']||0x1f4;logger[_0x6299('0x74')](_0x6299('0x75'),'getFields',_0x30671f,JSON['stringify'](_0x11620f));delete _0x11620f['name'];if(_0x30671f===0x191){_0x30671f=0x190;}_0x1d83cc['status'](_0x30671f)[_0x6299('0x2d')](_0x9277f1[_0x6299('0x34')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x11620f[_0x6299('0x76')]}:_0x11620f);});}; \ No newline at end of file +var _0x2dd7=['error','stack','name','send','index','VtigerAccount','rawAttributes','fieldName','type','key','map','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','options','includeAll','rows','show','params','include','find','catch','create','body','destroy','getConfigurations','findOne','VtigerConfiguration','Subjects','channel','Descriptions','getDescriptions','VtigerField','getFields','username','moduleName','serverUrl','accessKey','remoteUri','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','POST','login','result','success','sessionName','reference','owner','remove','includes','editable','false','cf_','picklist','picklistValues','label','value','log','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','count','set','apply','save','update','then'];(function(_0x399d76,_0xdc4493){var _0x3b19a1=function(_0x262225){while(--_0x262225){_0x399d76['push'](_0x399d76['shift']());}};_0x3b19a1(++_0xdc4493);}(_0x2dd7,0xc4));var _0x72dd=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x2dd7[_0x4792c8];return _0x35edb1;};'use strict';var emlformat=require(_0x72dd('0x0'));var rimraf=require(_0x72dd('0x1'));var zipdir=require(_0x72dd('0x2'));var jsonpatch=require(_0x72dd('0x3'));var rp=require(_0x72dd('0x4'));var moment=require('moment');var BPromise=require(_0x72dd('0x5'));var Mustache=require('mustache');var util=require(_0x72dd('0x6'));var path=require(_0x72dd('0x7'));var sox=require(_0x72dd('0x8'));var csv=require(_0x72dd('0x9'));var ejs=require(_0x72dd('0xa'));var fs=require('fs');var fs_extra=require(_0x72dd('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x72dd('0xc'));var jsforce=require(_0x72dd('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x72dd('0x9'));var querystring=require(_0x72dd('0xe'));var Papa=require(_0x72dd('0xf'));var Redis=require(_0x72dd('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x72dd('0x11'));var hardwareService=require(_0x72dd('0x12'));var logger=require(_0x72dd('0x13'))('api');var utils=require(_0x72dd('0x14'));var config=require(_0x72dd('0x15'));var licenseUtil=require(_0x72dd('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x72dd('0x17'));function respondWithStatusCode(_0x1af16b,_0x2b6cc2){_0x2b6cc2=_0x2b6cc2||0xcc;return function(_0x3be201){if(_0x3be201){return _0x1af16b[_0x72dd('0x18')](_0x2b6cc2);}return _0x1af16b[_0x72dd('0x19')](_0x2b6cc2)[_0x72dd('0x1a')]();};}function respondWithResult(_0x44e1cc,_0x3426ab){_0x3426ab=_0x3426ab||0xc8;return function(_0x1753ea){if(_0x1753ea){return _0x44e1cc[_0x72dd('0x19')](_0x3426ab)[_0x72dd('0x1b')](_0x1753ea);}};}function respondWithFilteredResult(_0x33f167,_0x14e029){return function(_0x7db2d7){if(_0x7db2d7){var _0x508b39=typeof _0x14e029[_0x72dd('0x1c')]==='undefined'&&typeof _0x14e029[_0x72dd('0x1d')]==='undefined';var _0x2a44fc=_0x7db2d7[_0x72dd('0x1e')];var _0x1be68b=_0x508b39?0x0:_0x14e029['offset'];var _0x3a458f=_0x508b39?_0x7db2d7[_0x72dd('0x1e')]:_0x14e029[_0x72dd('0x1c')]+_0x14e029[_0x72dd('0x1d')];var _0x55b35c;if(_0x3a458f>=_0x2a44fc){_0x3a458f=_0x2a44fc;_0x55b35c=0xc8;}else{_0x55b35c=0xce;}_0x33f167[_0x72dd('0x19')](_0x55b35c);return _0x33f167[_0x72dd('0x1f')]('Content-Range',_0x1be68b+'-'+_0x3a458f+'/'+_0x2a44fc)[_0x72dd('0x1b')](_0x7db2d7);}return null;};}function patchUpdates(_0x8c2ecc){return function(_0xbfff5f){try{jsonpatch[_0x72dd('0x20')](_0xbfff5f,_0x8c2ecc,!![]);}catch(_0x1f53eb){return BPromise['reject'](_0x1f53eb);}return _0xbfff5f[_0x72dd('0x21')]();};}function saveUpdates(_0x3e81fc,_0x30ceee){return function(_0x418bbc){if(_0x418bbc){return _0x418bbc[_0x72dd('0x22')](_0x3e81fc)[_0x72dd('0x23')](function(_0xfeb0e2){return _0xfeb0e2;});}return null;};}function removeEntity(_0x3bd13e,_0xa4b97){return function(_0x2dd9c0){if(_0x2dd9c0){return _0x2dd9c0['destroy']()[_0x72dd('0x23')](function(){_0x3bd13e[_0x72dd('0x19')](0xcc)[_0x72dd('0x1a')]();});}};}function handleEntityNotFound(_0x1b2eda,_0x35ff82){return function(_0x5ef832){if(!_0x5ef832){_0x1b2eda[_0x72dd('0x18')](0x194);}return _0x5ef832;};}function handleError(_0x203c53,_0x4e7589){_0x4e7589=_0x4e7589||0x1f4;return function(_0x1ac840){logger[_0x72dd('0x24')](_0x1ac840[_0x72dd('0x25')]);if(_0x1ac840[_0x72dd('0x26')]){delete _0x1ac840[_0x72dd('0x26')];}_0x203c53[_0x72dd('0x19')](_0x4e7589)[_0x72dd('0x27')](_0x1ac840);};}exports[_0x72dd('0x28')]=function(_0x1e5249,_0x183e52){var _0x445e31={},_0x5dc555={},_0x53228d={'count':0x0,'rows':[]};var _0xf712bf=_['map'](db[_0x72dd('0x29')][_0x72dd('0x2a')],function(_0x74f66b){return{'name':_0x74f66b[_0x72dd('0x2b')],'type':_0x74f66b[_0x72dd('0x2c')][_0x72dd('0x2d')]};});_0x5dc555['model']=_[_0x72dd('0x2e')](_0xf712bf,_0x72dd('0x26'));_0x5dc555['query']=_[_0x72dd('0x2f')](_0x1e5249[_0x72dd('0x30')]);_0x5dc555['filters']=_[_0x72dd('0x31')](_0x5dc555[_0x72dd('0x32')],_0x5dc555[_0x72dd('0x30')]);_0x445e31['attributes']=_[_0x72dd('0x31')](_0x5dc555['model'],qs[_0x72dd('0x33')](_0x1e5249[_0x72dd('0x30')]['fields']));_0x445e31[_0x72dd('0x34')]=_0x445e31['attributes'][_0x72dd('0x35')]?_0x445e31[_0x72dd('0x34')]:_0x5dc555['model'];if(!_0x1e5249[_0x72dd('0x30')][_0x72dd('0x36')](_0x72dd('0x37'))){_0x445e31[_0x72dd('0x1d')]=qs['limit'](_0x1e5249[_0x72dd('0x30')][_0x72dd('0x1d')]);_0x445e31[_0x72dd('0x1c')]=qs['offset'](_0x1e5249['query'][_0x72dd('0x1c')]);}_0x445e31[_0x72dd('0x38')]=qs[_0x72dd('0x39')](_0x1e5249[_0x72dd('0x30')][_0x72dd('0x39')]);_0x445e31[_0x72dd('0x3a')]=qs['filters'](_[_0x72dd('0x3b')](_0x1e5249['query'],_0x5dc555[_0x72dd('0x3c')]),_0xf712bf);if(_0x1e5249['query'][_0x72dd('0x3d')]){_0x445e31[_0x72dd('0x3a')]=_['merge'](_0x445e31['where'],{'$or':_[_0x72dd('0x2e')](_0xf712bf,function(_0x591d99){if(_0x591d99['type']!=='VIRTUAL'){var _0xc192c6={};_0xc192c6[_0x591d99[_0x72dd('0x26')]]={'$like':'%'+_0x1e5249['query'][_0x72dd('0x3d')]+'%'};return _0xc192c6;}})});}_0x445e31=_[_0x72dd('0x3e')]({},_0x445e31,_0x1e5249[_0x72dd('0x3f')]);var _0x861116={'where':_0x445e31[_0x72dd('0x3a')]};return db[_0x72dd('0x29')][_0x72dd('0x1e')](_0x861116)[_0x72dd('0x23')](function(_0x13d34b){_0x53228d[_0x72dd('0x1e')]=_0x13d34b;if(_0x1e5249[_0x72dd('0x30')][_0x72dd('0x40')]){_0x445e31['include']=[{'all':!![]}];}return db[_0x72dd('0x29')]['findAll'](_0x445e31);})['then'](function(_0x12669b){_0x53228d[_0x72dd('0x41')]=_0x12669b;return _0x53228d;})[_0x72dd('0x23')](respondWithFilteredResult(_0x183e52,_0x445e31))['catch'](handleError(_0x183e52,null));};exports[_0x72dd('0x42')]=function(_0x571b72,_0x1ddc76){var _0x2215bf={'raw':![],'where':{'id':_0x571b72[_0x72dd('0x43')]['id']}},_0x52409b={};_0x52409b[_0x72dd('0x32')]=_['keys'](db['VtigerAccount']['rawAttributes']);_0x52409b['query']=_[_0x72dd('0x2f')](_0x571b72[_0x72dd('0x30')]);_0x52409b[_0x72dd('0x3c')]=_[_0x72dd('0x31')](_0x52409b[_0x72dd('0x32')],_0x52409b[_0x72dd('0x30')]);_0x2215bf[_0x72dd('0x34')]=_[_0x72dd('0x31')](_0x52409b['model'],qs[_0x72dd('0x33')](_0x571b72[_0x72dd('0x30')]['fields']));_0x2215bf[_0x72dd('0x34')]=_0x2215bf[_0x72dd('0x34')]['length']?_0x2215bf[_0x72dd('0x34')]:_0x52409b['model'];if(_0x571b72[_0x72dd('0x30')][_0x72dd('0x40')]){_0x2215bf[_0x72dd('0x44')]=[{'all':!![]}];}_0x2215bf=_[_0x72dd('0x3e')]({},_0x2215bf,_0x571b72[_0x72dd('0x3f')]);return db[_0x72dd('0x29')][_0x72dd('0x45')](_0x2215bf)[_0x72dd('0x23')](handleEntityNotFound(_0x1ddc76,null))['then'](respondWithResult(_0x1ddc76,null))[_0x72dd('0x46')](handleError(_0x1ddc76,null));};exports[_0x72dd('0x47')]=function(_0x9ade95,_0x36dd5f){return db[_0x72dd('0x29')]['create'](_0x9ade95[_0x72dd('0x48')],{})[_0x72dd('0x23')](respondWithResult(_0x36dd5f,0xc9))[_0x72dd('0x46')](handleError(_0x36dd5f,null));};exports[_0x72dd('0x22')]=function(_0x3da275,_0xd0d4dc){if(_0x3da275[_0x72dd('0x48')]['id']){delete _0x3da275[_0x72dd('0x48')]['id'];}return db['VtigerAccount'][_0x72dd('0x45')]({'where':{'id':_0x3da275[_0x72dd('0x43')]['id']}})[_0x72dd('0x23')](handleEntityNotFound(_0xd0d4dc,null))[_0x72dd('0x23')](saveUpdates(_0x3da275[_0x72dd('0x48')],null))[_0x72dd('0x23')](respondWithResult(_0xd0d4dc,null))['catch'](handleError(_0xd0d4dc,null));};exports[_0x72dd('0x49')]=function(_0x57fc9d,_0x17a7dd){return db['VtigerAccount']['find']({'where':{'id':_0x57fc9d[_0x72dd('0x43')]['id']}})[_0x72dd('0x23')](handleEntityNotFound(_0x17a7dd,null))[_0x72dd('0x23')](removeEntity(_0x17a7dd,null))['catch'](handleError(_0x17a7dd,null));};exports[_0x72dd('0x4a')]=function(_0x5eb131,_0x2eb6ce,_0x1f818a){var _0x21b575={};var _0x393d18={};var _0x1295df;var _0x536151;return db['VtigerAccount'][_0x72dd('0x4b')]({'where':{'id':_0x5eb131[_0x72dd('0x43')]['id']}})[_0x72dd('0x23')](handleEntityNotFound(_0x2eb6ce,null))[_0x72dd('0x23')](function(_0x6f8b33){if(_0x6f8b33){_0x1295df=_0x6f8b33;_0x393d18['model']=_['keys'](db[_0x72dd('0x4c')]['rawAttributes']);_0x393d18['query']=_['keys'](_0x5eb131['query']);_0x393d18['filters']=_[_0x72dd('0x31')](_0x393d18['model'],_0x393d18[_0x72dd('0x30')]);_0x21b575[_0x72dd('0x34')]=_[_0x72dd('0x31')](_0x393d18[_0x72dd('0x32')],qs[_0x72dd('0x33')](_0x5eb131[_0x72dd('0x30')]['fields']));_0x21b575[_0x72dd('0x34')]=_0x21b575['attributes'][_0x72dd('0x35')]?_0x21b575[_0x72dd('0x34')]:_0x393d18[_0x72dd('0x32')];_0x21b575[_0x72dd('0x38')]=qs[_0x72dd('0x39')](_0x5eb131[_0x72dd('0x30')][_0x72dd('0x39')]);_0x21b575[_0x72dd('0x3a')]=qs[_0x72dd('0x3c')](_[_0x72dd('0x3b')](_0x5eb131[_0x72dd('0x30')],_0x393d18['filters']));if(_0x5eb131['query'][_0x72dd('0x3d')]){_0x21b575[_0x72dd('0x3a')]=_[_0x72dd('0x3e')](_0x21b575['where'],{'$or':_[_0x72dd('0x2e')](_0x21b575[_0x72dd('0x34')],function(_0x38391e){var _0xf800b8={};_0xf800b8[_0x38391e]={'$like':'%'+_0x5eb131['query']['filter']+'%'};return _0xf800b8;})});}_0x21b575=_[_0x72dd('0x3e')]({},_0x21b575,_0x5eb131[_0x72dd('0x3f')]);return _0x1295df[_0x72dd('0x4a')](_0x21b575);}})[_0x72dd('0x23')](function(_0x19d036){if(_0x19d036){_0x536151=_0x19d036[_0x72dd('0x35')];if(!_0x5eb131[_0x72dd('0x30')][_0x72dd('0x36')]('nolimit')){_0x21b575[_0x72dd('0x1d')]=qs[_0x72dd('0x1d')](_0x5eb131[_0x72dd('0x30')][_0x72dd('0x1d')]);_0x21b575[_0x72dd('0x1c')]=qs[_0x72dd('0x1c')](_0x5eb131[_0x72dd('0x30')][_0x72dd('0x1c')]);}return _0x1295df[_0x72dd('0x4a')](_0x21b575);}})[_0x72dd('0x23')](function(_0x4cf149){if(_0x4cf149){return _0x4cf149?{'count':_0x536151,'rows':_0x4cf149}:null;}})[_0x72dd('0x23')](respondWithResult(_0x2eb6ce,null))[_0x72dd('0x46')](handleError(_0x2eb6ce,null));};exports['addConfiguration']=function(_0x2772f2,_0x33636e,_0x7bfe4b){if(_0x2772f2[_0x72dd('0x48')]['id']){delete _0x2772f2[_0x72dd('0x48')]['id'];}return db[_0x72dd('0x29')][_0x72dd('0x4b')]({'where':{'id':_0x2772f2[_0x72dd('0x43')]['id']}})[_0x72dd('0x23')](handleEntityNotFound(_0x33636e,null))[_0x72dd('0x23')](function(_0xe5a541){if(_0xe5a541){_0x2772f2[_0x72dd('0x48')]['AccountId']=_0xe5a541['id'];_0x2772f2[_0x72dd('0x48')][_0x72dd('0x4d')]=integrations['getSubjects'](_0x2772f2['body'][_0x72dd('0x4e')],_0x2772f2[_0x72dd('0x48')]['type']);_0x2772f2[_0x72dd('0x48')][_0x72dd('0x4f')]=integrations[_0x72dd('0x50')](_0x2772f2[_0x72dd('0x48')][_0x72dd('0x4e')],_0x2772f2[_0x72dd('0x48')][_0x72dd('0x2c')]);return db['VtigerConfiguration'][_0x72dd('0x47')](_0x2772f2[_0x72dd('0x48')],{'include':[{'model':db[_0x72dd('0x51')],'as':'Subjects'},{'model':db[_0x72dd('0x51')],'as':_0x72dd('0x4f')}]});}return null;})[_0x72dd('0x23')](respondWithResult(_0x33636e,null))[_0x72dd('0x46')](handleError(_0x33636e,null));};var md5=require('md5');exports[_0x72dd('0x52')]=function(_0x3dabbf,_0x417f4b,_0x190438){var _0xe02f9f=null;var _0x2bb68d=null;var _0x494df9=null;var _0x77c5c7=null;var _0x29b5d7='';return db[_0x72dd('0x29')][_0x72dd('0x4b')]({'where':{'id':_0x3dabbf[_0x72dd('0x43')]['id']},'attributes':['id',_0x72dd('0x26'),_0x72dd('0x53'),'description',_0x72dd('0x54'),'remoteUri',_0x72dd('0x55'),_0x72dd('0x56')]})[_0x72dd('0x23')](handleEntityNotFound(_0x417f4b,null))['then'](function(_0x424b6e){if(_0x424b6e){_0xe02f9f=_0x424b6e[_0x72dd('0x53')];_0x2bb68d=_0x424b6e[_0x72dd('0x56')];_0x494df9=_0x424b6e[_0x72dd('0x54')];_0x29b5d7=_0x424b6e[_0x72dd('0x57')];var _0x3c22b6=_0x29b5d7[_0x72dd('0x58')](-0x1);if(_0x3c22b6==='/'){_0x29b5d7=_0x29b5d7[_0x72dd('0x59')](0x0,_0x29b5d7[_0x72dd('0x5a')](_0x3c22b6));}_0x77c5c7=util[_0x72dd('0x5b')](_0x72dd('0x5c'),_0x29b5d7);var _0x1ff9bc={'method':_0x72dd('0x5d'),'uri':_0x77c5c7,'qs':{'operation':_0x72dd('0x5e'),'username':_0x424b6e['username']},'json':!![]};return rp(_0x1ff9bc);}})['then'](function(_0x33f37b){if(_0x33f37b['success']){var _0x14df32={'method':_0x72dd('0x5f'),'uri':_0x77c5c7,'form':{'operation':_0x72dd('0x60'),'username':_0xe02f9f,'accessKey':md5(_0x33f37b[_0x72dd('0x61')]['token']+_0x2bb68d)},'json':!![]};return rp(_0x14df32);}})[_0x72dd('0x23')](function(_0x5dda33){if(_0x5dda33[_0x72dd('0x62')]){var _0x263caa={'method':'GET','uri':_0x77c5c7,'qs':{'operation':'describe','username':_0xe02f9f,'sessionName':_0x5dda33['result'][_0x72dd('0x63')],'elementType':_0x494df9},'json':!![]};return rp(_0x263caa);}})[_0x72dd('0x23')](function(_0x39145d){if(_0x39145d[_0x72dd('0x62')]){var _0x55ca45=['autogenerated',_0x72dd('0x64'),_0x72dd('0x65')];_[_0x72dd('0x66')](_0x39145d[_0x72dd('0x61')][_0x72dd('0x33')],function(_0x1dea2b){return _0x55ca45[_0x72dd('0x67')](_0x1dea2b[_0x72dd('0x2c')][_0x72dd('0x26')]);});_[_0x72dd('0x66')](_0x39145d[_0x72dd('0x61')][_0x72dd('0x33')],function(_0x474009){return _0x474009[_0x72dd('0x68')]===_0x72dd('0x69');});return{'count':_0x39145d[_0x72dd('0x61')][_0x72dd('0x33')]['length'],'rows':_[_0x72dd('0x2e')](_0x39145d[_0x72dd('0x61')][_0x72dd('0x33')],function(_0x28ff90){return{'id':_0x28ff90[_0x72dd('0x26')],'name':_0x28ff90['label'],'custom':_['startsWith'](_0x28ff90[_0x72dd('0x26')],_0x72dd('0x6a'))?!![]:![],'options':_0x28ff90[_0x72dd('0x2c')][_0x72dd('0x26')]===_0x72dd('0x6b')&&_0x28ff90[_0x72dd('0x2c')]['picklistValues'][_0x72dd('0x35')]>0x0?_[_0x72dd('0x2e')](_0x28ff90[_0x72dd('0x2c')][_0x72dd('0x6c')],function(_0x1a10fb){return{'name':_0x1a10fb[_0x72dd('0x6d')],'value':_0x1a10fb[_0x72dd('0x6e')]};}):[]};})};}})[_0x72dd('0x23')](respondWithResult(_0x417f4b,null))[_0x72dd('0x46')](function(_0x3c16fa){console[_0x72dd('0x6f')]('vTiger\x20error:\x20'+_0x3c16fa);var _0x587d28=_0x3dabbf[_0x72dd('0x30')]['test']?0x1f4:_0x3c16fa[_0x72dd('0x70')]||0x1f4;logger[_0x72dd('0x24')](_0x72dd('0x71'),_0x72dd('0x52'),_0x587d28,JSON[_0x72dd('0x72')](_0x3c16fa));delete _0x3c16fa[_0x72dd('0x26')];if(_0x587d28===0x191){_0x587d28=0x190;}_0x417f4b[_0x72dd('0x19')](_0x587d28)[_0x72dd('0x27')](_0x3dabbf[_0x72dd('0x30')]['test']?{'message':_0x72dd('0x73'),'statusCode':_0x3c16fa[_0x72dd('0x70')]}:_0x3c16fa);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 7ddc9d9..dbf9489 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 _0xd063=['request-promise','path','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','../../config/logger','api','moment'];(function(_0x3451fa,_0x41ae9f){var _0x15f8d1=function(_0x28cd93){while(--_0x28cd93){_0x3451fa['push'](_0x3451fa['shift']());}};_0x15f8d1(++_0x41ae9f);}(_0xd063,0xf8));var _0x3d06=function(_0x2bebfc,_0x45744a){_0x2bebfc=_0x2bebfc-0x0;var _0x4adc63=_0xd063[_0x2bebfc];return _0x4adc63;};'use strict';var _=require(_0x3d06('0x0'));var util=require('util');var logger=require(_0x3d06('0x1'))(_0x3d06('0x2'));var moment=require(_0x3d06('0x3'));var BPromise=require('bluebird');var rp=require(_0x3d06('0x4'));var fs=require('fs');var path=require(_0x3d06('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3d06('0x6'));var integrations=require(_0x3d06('0x7'));module[_0x3d06('0x8')]=function(_0x3e04ec,_0x395e4b){return _0x3e04ec[_0x3d06('0x9')](_0x3d06('0xa'),attributes,{'tableName':_0x3d06('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55d9=['int_vtiger_accounts','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount'];(function(_0x4498ac,_0x30e301){var _0x4bf1b6=function(_0x117f33){while(--_0x117f33){_0x4498ac['push'](_0x4498ac['shift']());}};_0x4bf1b6(++_0x30e301);}(_0x55d9,0x1c8));var _0x955d=function(_0x5ac4b6,_0x4d9360){_0x5ac4b6=_0x5ac4b6-0x0;var _0x29ced8=_0x55d9[_0x5ac4b6];return _0x29ced8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x955d('0x0'))(_0x955d('0x1'));var moment=require(_0x955d('0x2'));var BPromise=require(_0x955d('0x3'));var rp=require(_0x955d('0x4'));var fs=require('fs');var path=require(_0x955d('0x5'));var rimraf=require('rimraf');var config=require(_0x955d('0x6'));var attributes=require(_0x955d('0x7'));var integrations=require(_0x955d('0x8'));module[_0x955d('0x9')]=function(_0x48fdfe,_0x519445){return _0x48fdfe[_0x955d('0xa')](_0x955d('0xb'),attributes,{'tableName':_0x955d('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 9eb4477..613a92e 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 _0xf4eb=['VtigerAccount','findAll','options','where','attributes','limit','map','model','include','find','raw','ShowVtigerAccount','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetVtigerAccount'];(function(_0x26c718,_0x4469a5){var _0x3665be=function(_0x3088e1){while(--_0x3088e1){_0x26c718['push'](_0x26c718['shift']());}};_0x3665be(++_0x4469a5);}(_0xf4eb,0xec));var _0xbf4e=function(_0x2d9777,_0x3be050){_0x2d9777=_0x2d9777-0x0;var _0x1b6ea9=_0xf4eb[_0x2d9777];return _0x1b6ea9;};'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')]('VtigerAccount,\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')]('VtigerAccount,\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')]({'raw':_0x577c27[_0xbf4e('0x16')]?_0x577c27['options']['raw']===undefined?!![]:![]:!![],'where':_0x577c27[_0xbf4e('0x16')]?_0x577c27[_0xbf4e('0x16')][_0xbf4e('0x17')]||null:null,'attributes':_0x577c27[_0xbf4e('0x16')]?_0x577c27[_0xbf4e('0x16')][_0xbf4e('0x18')]||null:null,'limit':_0x577c27[_0xbf4e('0x16')]?_0x577c27[_0xbf4e('0x16')][_0xbf4e('0x19')]||null:null,'include':_0x577c27[_0xbf4e('0x16')]?_0x577c27[_0xbf4e('0x16')]['include']?_[_0xbf4e('0x1a')](_0x577c27[_0xbf4e('0x16')]['include'],function(_0x31e3f5){return{'model':db[_0x31e3f5[_0xbf4e('0x1b')]],'as':_0x31e3f5['as'],'attributes':_0x31e3f5[_0xbf4e('0x18')],'include':_0x31e3f5[_0xbf4e('0x1c')]?_[_0xbf4e('0x1a')](_0x31e3f5['include'],function(_0x90635e){return{'model':db[_0x90635e[_0xbf4e('0x1b')]],'as':_0x90635e['as'],'attributes':_0x90635e[_0xbf4e('0x18')],'include':_0x90635e['include']?_[_0xbf4e('0x1a')](_0x90635e['include'],function(_0x5bcf71){return{'model':db[_0x5bcf71[_0xbf4e('0x1b')]],'as':_0x5bcf71['as'],'attributes':_0x5bcf71['attributes']};}):[]};}):[]};}):[]:[]})[_0xbf4e('0x9')](function(_0x315df3){logger[_0xbf4e('0xa')](_0xbf4e('0x13'),_0x577c27);logger['debug'](_0xbf4e('0x13'),_0x577c27,JSON[_0xbf4e('0xe')](_0x315df3));_0x566ec3(_0x315df3);})[_0xbf4e('0x12')](function(_0x4cd4a1){logger[_0xbf4e('0xf')]('GetVtigerAccount',_0x4cd4a1[_0xbf4e('0x11')],_0x577c27);_0x4f8762(_0x5db03f[_0xbf4e('0xf')](0x1f4,_0x4cd4a1[_0xbf4e('0x11')]));});});};exports['ShowVtigerAccount']=function(_0x1d12e2){var _0x362716=this;return new Promise(function(_0x2f3cf8,_0xc7ca87){return db[_0xbf4e('0x14')][_0xbf4e('0x1d')]({'raw':_0x1d12e2['options']?_0x1d12e2[_0xbf4e('0x16')][_0xbf4e('0x1e')]===undefined?!![]:![]:!![],'where':_0x1d12e2['options']?_0x1d12e2[_0xbf4e('0x16')][_0xbf4e('0x17')]||null:null,'attributes':_0x1d12e2['options']?_0x1d12e2[_0xbf4e('0x16')]['attributes']||null:null,'include':_0x1d12e2[_0xbf4e('0x16')]?_0x1d12e2['options'][_0xbf4e('0x1c')]?_[_0xbf4e('0x1a')](_0x1d12e2[_0xbf4e('0x16')]['include'],function(_0x2716b7){return{'model':db[_0x2716b7[_0xbf4e('0x1b')]],'as':_0x2716b7['as'],'attributes':_0x2716b7[_0xbf4e('0x18')],'include':_0x2716b7[_0xbf4e('0x1c')]?_[_0xbf4e('0x1a')](_0x2716b7[_0xbf4e('0x1c')],function(_0x5b8440){return{'model':db[_0x5b8440[_0xbf4e('0x1b')]],'as':_0x5b8440['as'],'attributes':_0x5b8440[_0xbf4e('0x18')],'include':_0x5b8440[_0xbf4e('0x1c')]?_[_0xbf4e('0x1a')](_0x5b8440[_0xbf4e('0x1c')],function(_0x5b7ea1){return{'model':db[_0x5b7ea1['model']],'as':_0x5b7ea1['as'],'attributes':_0x5b7ea1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x429c07){logger[_0xbf4e('0xa')](_0xbf4e('0x1f'),_0x1d12e2);logger[_0xbf4e('0xd')](_0xbf4e('0x1f'),_0x1d12e2,JSON[_0xbf4e('0xe')](_0x429c07));_0x2f3cf8(_0x429c07);})[_0xbf4e('0x12')](function(_0x467b74){logger[_0xbf4e('0xf')]('ShowVtigerAccount',_0x467b74['message'],_0x1d12e2);_0xc7ca87(_0x362716[_0xbf4e('0xf')](0x1f4,_0x467b74[_0xbf4e('0x11')]));});});}; \ No newline at end of file +var _0x0972=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetVtigerAccount','VtigerAccount','findAll','options','raw','attributes','limit','include','map','model','catch','find','where','ShowVtigerAccount','util','bluebird','ioredis','../../mysqldb','../../config/logger'];(function(_0x37a1eb,_0x67f883){var _0x495031=function(_0x2ec970){while(--_0x2ec970){_0x37a1eb['push'](_0x37a1eb['shift']());}};_0x495031(++_0x67f883);}(_0x0972,0x64));var _0x2097=function(_0x46f389,_0xcebccb){_0x46f389=_0x46f389-0x0;var _0x5e4075=_0x0972[_0x46f389];return _0x5e4075;};'use strict';var _=require('lodash');var util=require(_0x2097('0x0'));var moment=require('moment');var BPromise=require(_0x2097('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2097('0x2'));var db=require(_0x2097('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2097('0x4'))(_0x2097('0x5'));var config=require(_0x2097('0x6'));var jayson=require(_0x2097('0x7'));var client=jayson[_0x2097('0x8')][_0x2097('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b4f21,_0x59739f,_0x332aac){return new BPromise(function(_0x1e661a,_0x11d263){return client[_0x2097('0xa')](_0x2b4f21,_0x332aac)[_0x2097('0xb')](function(_0x59d947){logger[_0x2097('0xc')](_0x2097('0xd'),_0x59739f,_0x2097('0xe'));logger[_0x2097('0xf')](_0x2097('0x10'),_0x59739f,_0x2097('0xe'),JSON[_0x2097('0x11')](_0x59d947));if(_0x59d947[_0x2097('0x12')]){if(_0x59d947[_0x2097('0x12')][_0x2097('0x13')]===0x1f4){logger[_0x2097('0x12')](_0x2097('0xd'),_0x59739f,_0x59d947[_0x2097('0x12')][_0x2097('0x14')]);return _0x11d263(_0x59d947[_0x2097('0x12')][_0x2097('0x14')]);}logger[_0x2097('0x12')](_0x2097('0xd'),_0x59739f,_0x59d947[_0x2097('0x12')][_0x2097('0x14')]);return _0x1e661a(_0x59d947['error'][_0x2097('0x14')]);}else{logger[_0x2097('0xc')]('VtigerAccount,\x20%s,\x20%s',_0x59739f,'request\x20sent');_0x1e661a(_0x59d947['result'][_0x2097('0x14')]);}})['catch'](function(_0x28c35c){logger[_0x2097('0x12')](_0x2097('0xd'),_0x59739f,_0x28c35c);_0x11d263(_0x28c35c);});});}exports[_0x2097('0x15')]=function(_0x44c584){var _0x53e2b4=this;return new Promise(function(_0x324652,_0x140094){return db[_0x2097('0x16')][_0x2097('0x17')]({'raw':_0x44c584[_0x2097('0x18')]?_0x44c584[_0x2097('0x18')][_0x2097('0x19')]===undefined?!![]:![]:!![],'where':_0x44c584[_0x2097('0x18')]?_0x44c584['options']['where']||null:null,'attributes':_0x44c584[_0x2097('0x18')]?_0x44c584['options'][_0x2097('0x1a')]||null:null,'limit':_0x44c584[_0x2097('0x18')]?_0x44c584['options'][_0x2097('0x1b')]||null:null,'include':_0x44c584['options']?_0x44c584[_0x2097('0x18')][_0x2097('0x1c')]?_[_0x2097('0x1d')](_0x44c584[_0x2097('0x18')][_0x2097('0x1c')],function(_0x35047b){return{'model':db[_0x35047b['model']],'as':_0x35047b['as'],'attributes':_0x35047b[_0x2097('0x1a')],'include':_0x35047b['include']?_[_0x2097('0x1d')](_0x35047b[_0x2097('0x1c')],function(_0x345875){return{'model':db[_0x345875[_0x2097('0x1e')]],'as':_0x345875['as'],'attributes':_0x345875['attributes'],'include':_0x345875[_0x2097('0x1c')]?_[_0x2097('0x1d')](_0x345875['include'],function(_0x1229fc){return{'model':db[_0x1229fc['model']],'as':_0x1229fc['as'],'attributes':_0x1229fc[_0x2097('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xbc0339){logger[_0x2097('0xc')](_0x2097('0x15'),_0x44c584);logger[_0x2097('0xf')](_0x2097('0x15'),_0x44c584,JSON[_0x2097('0x11')](_0xbc0339));_0x324652(_0xbc0339);})[_0x2097('0x1f')](function(_0x4b443d){logger[_0x2097('0x12')](_0x2097('0x15'),_0x4b443d['message'],_0x44c584);_0x140094(_0x53e2b4[_0x2097('0x12')](0x1f4,_0x4b443d[_0x2097('0x14')]));});});};exports['ShowVtigerAccount']=function(_0x4d0916){var _0x312c77=this;return new Promise(function(_0x11b051,_0x1649c8){return db[_0x2097('0x16')][_0x2097('0x20')]({'raw':_0x4d0916[_0x2097('0x18')]?_0x4d0916['options'][_0x2097('0x19')]===undefined?!![]:![]:!![],'where':_0x4d0916['options']?_0x4d0916[_0x2097('0x18')][_0x2097('0x21')]||null:null,'attributes':_0x4d0916[_0x2097('0x18')]?_0x4d0916[_0x2097('0x18')][_0x2097('0x1a')]||null:null,'include':_0x4d0916[_0x2097('0x18')]?_0x4d0916[_0x2097('0x18')][_0x2097('0x1c')]?_[_0x2097('0x1d')](_0x4d0916['options'][_0x2097('0x1c')],function(_0x40baed){return{'model':db[_0x40baed[_0x2097('0x1e')]],'as':_0x40baed['as'],'attributes':_0x40baed['attributes'],'include':_0x40baed[_0x2097('0x1c')]?_[_0x2097('0x1d')](_0x40baed[_0x2097('0x1c')],function(_0x396162){return{'model':db[_0x396162['model']],'as':_0x396162['as'],'attributes':_0x396162['attributes'],'include':_0x396162['include']?_[_0x2097('0x1d')](_0x396162[_0x2097('0x1c')],function(_0x4123b7){return{'model':db[_0x4123b7[_0x2097('0x1e')]],'as':_0x4123b7['as'],'attributes':_0x4123b7[_0x2097('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2097('0xb')](function(_0x49b724){logger[_0x2097('0xc')](_0x2097('0x22'),_0x4d0916);logger[_0x2097('0xf')](_0x2097('0x22'),_0x4d0916,JSON[_0x2097('0x11')](_0x49b724));_0x11b051(_0x49b724);})[_0x2097('0x1f')](function(_0x52b937){logger[_0x2097('0x12')](_0x2097('0x22'),_0x52b937[_0x2097('0x14')],_0x4d0916);_0x1649c8(_0x312c77['error'](0x1f4,_0x52b937['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 9bfb339..bb8fb2d 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 _0x08df=['/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','create','put','/:id','destroy','exports','multer','util','path','express','fs-extra','./intVtigerConfiguration.controller','get','isAuthenticated','index','show'];(function(_0x2c3ee3,_0x460c1f){var _0x39e501=function(_0x9fbca1){while(--_0x9fbca1){_0x2c3ee3['push'](_0x2c3ee3['shift']());}};_0x39e501(++_0x460c1f);}(_0x08df,0x126));var _0xf08d=function(_0x3f59b1,_0x25cdbe){_0x3f59b1=_0x3f59b1-0x0;var _0x11d2e8=_0x08df[_0x3f59b1];return _0x11d2e8;};'use strict';var multer=require(_0xf08d('0x0'));var util=require(_0xf08d('0x1'));var path=require(_0xf08d('0x2'));var timeout=require('connect-timeout');var express=require(_0xf08d('0x3'));var router=express['Router']();var fs_extra=require(_0xf08d('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf08d('0x5'));router[_0xf08d('0x6')]('/',auth[_0xf08d('0x7')](),controller[_0xf08d('0x8')]);router[_0xf08d('0x6')]('/:id',auth[_0xf08d('0x7')](),controller[_0xf08d('0x9')]);router['get'](_0xf08d('0xa'),auth[_0xf08d('0x7')](),controller['getFields']);router[_0xf08d('0x6')](_0xf08d('0xb'),auth[_0xf08d('0x7')](),controller[_0xf08d('0xc')]);router[_0xf08d('0x6')](_0xf08d('0xd'),auth['isAuthenticated'](),controller['getDescriptions']);router['post']('/',auth[_0xf08d('0x7')](),controller[_0xf08d('0xe')]);router[_0xf08d('0xf')](_0xf08d('0x10'),auth[_0xf08d('0x7')](),controller['update']);router['delete'](_0xf08d('0x10'),auth[_0xf08d('0x7')](),controller[_0xf08d('0x11')]);module[_0xf08d('0x12')]=router; \ No newline at end of file +var _0x75da=['../../config/environment','./intVtigerConfiguration.controller','get','index','/:id','isAuthenticated','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0xc8ad48,_0x13d923){var _0x10da77=function(_0x709cca){while(--_0x709cca){_0xc8ad48['push'](_0xc8ad48['shift']());}};_0x10da77(++_0x13d923);}(_0x75da,0x130));var _0xa75d=function(_0x2e4cac,_0x304a8c){_0x2e4cac=_0x2e4cac-0x0;var _0x3bf712=_0x75da[_0x2e4cac];return _0x3bf712;};'use strict';var multer=require(_0xa75d('0x0'));var util=require(_0xa75d('0x1'));var path=require(_0xa75d('0x2'));var timeout=require(_0xa75d('0x3'));var express=require(_0xa75d('0x4'));var router=express[_0xa75d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xa75d('0x6'));var interaction=require(_0xa75d('0x7'));var config=require(_0xa75d('0x8'));var controller=require(_0xa75d('0x9'));router[_0xa75d('0xa')]('/',auth['isAuthenticated'](),controller[_0xa75d('0xb')]);router[_0xa75d('0xa')](_0xa75d('0xc'),auth[_0xa75d('0xd')](),controller['show']);router['get'](_0xa75d('0xe'),auth[_0xa75d('0xd')](),controller[_0xa75d('0xf')]);router[_0xa75d('0xa')](_0xa75d('0x10'),auth[_0xa75d('0xd')](),controller[_0xa75d('0x11')]);router['get'](_0xa75d('0x12'),auth[_0xa75d('0xd')](),controller[_0xa75d('0x13')]);router[_0xa75d('0x14')]('/',auth[_0xa75d('0xd')](),controller['create']);router[_0xa75d('0x15')](_0xa75d('0xc'),auth[_0xa75d('0xd')](),controller[_0xa75d('0x16')]);router[_0xa75d('0x17')](_0xa75d('0xc'),auth[_0xa75d('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 6ced157..a058460 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 _0x73a9=['STRING'];(function(_0x12c3d3,_0x408ef0){var _0x5b86fc=function(_0xd305df){while(--_0xd305df){_0x12c3d3['push'](_0x12c3d3['shift']());}};_0x5b86fc(++_0x408ef0);}(_0x73a9,0xdf));var _0x973a=function(_0x3dd4da,_0x4f438c){_0x3dd4da=_0x3dd4da-0x0;var _0x4bf19e=_0x73a9[_0x3dd4da];return _0x4bf19e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x973a('0x0')]}}; \ No newline at end of file +var _0xc86f=['STRING','sequelize'];(function(_0x58a782,_0x240494){var _0x5edea9=function(_0x3519d6){while(--_0x3519d6){_0x58a782['push'](_0x58a782['shift']());}};_0x5edea9(++_0x240494);}(_0xc86f,0x185));var _0xfc86=function(_0x26ac6b,_0x3e0e21){_0x26ac6b=_0x26ac6b-0x0;var _0x1972ec=_0xc86f[_0x26ac6b];return _0x1972ec;};'use strict';var Sequelize=require(_0xfc86('0x0'));module['exports']={'name':{'type':Sequelize[_0xfc86('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 df46701..ce47d81 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 _0x2cc9=['rawAttributes','include','find','create','body','update','findOne','pick','options','getFields','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','apply','then','destroy','sendStatus','error','name','send','index','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','map','VIRTUAL','VtigerConfiguration','includeAll','rows','catch','show','params'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x2cc9,0x1f2));var _0x92cc=function(_0x3d8919,_0x3c9de9){_0x3d8919=_0x3d8919-0x0;var _0x46368a=_0x2cc9[_0x3d8919];return _0x46368a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x92cc('0x0'));var zipdir=require(_0x92cc('0x1'));var jsonpatch=require(_0x92cc('0x2'));var rp=require(_0x92cc('0x3'));var moment=require(_0x92cc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x92cc('0x5'));var util=require(_0x92cc('0x6'));var path=require(_0x92cc('0x7'));var sox=require('sox');var csv=require(_0x92cc('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x92cc('0x9'));var _=require(_0x92cc('0xa'));var squel=require(_0x92cc('0xb'));var crypto=require('crypto');var jsforce=require(_0x92cc('0xc'));var deskjs=require(_0x92cc('0xd'));var toCsv=require(_0x92cc('0x8'));var querystring=require(_0x92cc('0xe'));var Papa=require(_0x92cc('0xf'));var Redis=require(_0x92cc('0x10'));var authService=require(_0x92cc('0x11'));var qs=require(_0x92cc('0x12'));var as=require(_0x92cc('0x13'));var hardwareService=require(_0x92cc('0x14'));var logger=require(_0x92cc('0x15'))(_0x92cc('0x16'));var utils=require(_0x92cc('0x17'));var config=require(_0x92cc('0x18'));var licenseUtil=require(_0x92cc('0x19'));var db=require(_0x92cc('0x1a'))['db'];function respondWithStatusCode(_0x1aff7b,_0x52d6ec){_0x52d6ec=_0x52d6ec||0xcc;return function(_0x290329){if(_0x290329){return _0x1aff7b['sendStatus'](_0x52d6ec);}return _0x1aff7b[_0x92cc('0x1b')](_0x52d6ec)[_0x92cc('0x1c')]();};}function respondWithResult(_0x428507,_0x35d21d){_0x35d21d=_0x35d21d||0xc8;return function(_0xa88698){if(_0xa88698){return _0x428507[_0x92cc('0x1b')](_0x35d21d)[_0x92cc('0x1d')](_0xa88698);}};}function respondWithFilteredResult(_0x1d778d,_0x326ce5){return function(_0x17ba6){if(_0x17ba6){var _0x37c9f8=typeof _0x326ce5[_0x92cc('0x1e')]==='undefined'&&typeof _0x326ce5[_0x92cc('0x1f')]===_0x92cc('0x20');var _0x471a1c=_0x17ba6['count'];var _0x14d374=_0x37c9f8?0x0:_0x326ce5[_0x92cc('0x1e')];var _0x225d11=_0x37c9f8?_0x17ba6[_0x92cc('0x21')]:_0x326ce5[_0x92cc('0x1e')]+_0x326ce5[_0x92cc('0x1f')];var _0x1d553e;if(_0x225d11>=_0x471a1c){_0x225d11=_0x471a1c;_0x1d553e=0xc8;}else{_0x1d553e=0xce;}_0x1d778d[_0x92cc('0x1b')](_0x1d553e);return _0x1d778d[_0x92cc('0x22')]('Content-Range',_0x14d374+'-'+_0x225d11+'/'+_0x471a1c)[_0x92cc('0x1d')](_0x17ba6);}return null;};}function patchUpdates(_0x3f1351){return function(_0x543902){try{jsonpatch[_0x92cc('0x23')](_0x543902,_0x3f1351,!![]);}catch(_0x4ce574){return BPromise['reject'](_0x4ce574);}return _0x543902['save']();};}function saveUpdates(_0x17630b,_0x1e8434){return function(_0x240f38){if(_0x240f38){return _0x240f38['update'](_0x17630b)[_0x92cc('0x24')](function(_0x53d3ca){return _0x53d3ca;});}return null;};}function removeEntity(_0x3e4e75,_0x26c389){return function(_0x36d792){if(_0x36d792){return _0x36d792[_0x92cc('0x25')]()[_0x92cc('0x24')](function(){_0x3e4e75['status'](0xcc)[_0x92cc('0x1c')]();});}};}function handleEntityNotFound(_0x5381de,_0x3e7e7a){return function(_0x2d5f27){if(!_0x2d5f27){_0x5381de[_0x92cc('0x26')](0x194);}return _0x2d5f27;};}function handleError(_0x36c10f,_0xa289dc){_0xa289dc=_0xa289dc||0x1f4;return function(_0x405c77){logger[_0x92cc('0x27')](_0x405c77['stack']);if(_0x405c77[_0x92cc('0x28')]){delete _0x405c77[_0x92cc('0x28')];}_0x36c10f[_0x92cc('0x1b')](_0xa289dc)[_0x92cc('0x29')](_0x405c77);};}exports[_0x92cc('0x2a')]=function(_0x465f35,_0x2d8893){var _0x251d7e={},_0x3cfcdb={},_0x23e30f={'count':0x0,'rows':[]};var _0x3f087b=_['map'](db['VtigerConfiguration']['rawAttributes'],function(_0x4590d3){return{'name':_0x4590d3[_0x92cc('0x2b')],'type':_0x4590d3[_0x92cc('0x2c')][_0x92cc('0x2d')]};});_0x3cfcdb[_0x92cc('0x2e')]=_['map'](_0x3f087b,'name');_0x3cfcdb['query']=_[_0x92cc('0x2f')](_0x465f35[_0x92cc('0x30')]);_0x3cfcdb['filters']=_[_0x92cc('0x31')](_0x3cfcdb[_0x92cc('0x2e')],_0x3cfcdb[_0x92cc('0x30')]);_0x251d7e[_0x92cc('0x32')]=_['intersection'](_0x3cfcdb['model'],qs[_0x92cc('0x33')](_0x465f35[_0x92cc('0x30')]['fields']));_0x251d7e[_0x92cc('0x32')]=_0x251d7e[_0x92cc('0x32')][_0x92cc('0x34')]?_0x251d7e['attributes']:_0x3cfcdb[_0x92cc('0x2e')];if(!_0x465f35['query'][_0x92cc('0x35')](_0x92cc('0x36'))){_0x251d7e['limit']=qs['limit'](_0x465f35[_0x92cc('0x30')][_0x92cc('0x1f')]);_0x251d7e['offset']=qs[_0x92cc('0x1e')](_0x465f35[_0x92cc('0x30')]['offset']);}_0x251d7e[_0x92cc('0x37')]=qs[_0x92cc('0x38')](_0x465f35[_0x92cc('0x30')][_0x92cc('0x38')]);_0x251d7e[_0x92cc('0x39')]=qs[_0x92cc('0x3a')](_['pick'](_0x465f35[_0x92cc('0x30')],_0x3cfcdb['filters']),_0x3f087b);if(_0x465f35[_0x92cc('0x30')][_0x92cc('0x3b')]){_0x251d7e[_0x92cc('0x39')]=_[_0x92cc('0x3c')](_0x251d7e[_0x92cc('0x39')],{'$or':_[_0x92cc('0x3d')](_0x3f087b,function(_0x16b528){if(_0x16b528[_0x92cc('0x2c')]!==_0x92cc('0x3e')){var _0x5503db={};_0x5503db[_0x16b528['name']]={'$like':'%'+_0x465f35[_0x92cc('0x30')][_0x92cc('0x3b')]+'%'};return _0x5503db;}})});}_0x251d7e=_['merge']({},_0x251d7e,_0x465f35['options']);var _0x4be2b3={'where':_0x251d7e[_0x92cc('0x39')]};return db[_0x92cc('0x3f')][_0x92cc('0x21')](_0x4be2b3)[_0x92cc('0x24')](function(_0x5d10b3){_0x23e30f['count']=_0x5d10b3;if(_0x465f35[_0x92cc('0x30')][_0x92cc('0x40')]){_0x251d7e['include']=[{'all':!![]}];}return db['VtigerConfiguration']['findAll'](_0x251d7e);})[_0x92cc('0x24')](function(_0x10e310){_0x23e30f[_0x92cc('0x41')]=_0x10e310;return _0x23e30f;})['then'](respondWithFilteredResult(_0x2d8893,_0x251d7e))[_0x92cc('0x42')](handleError(_0x2d8893,null));};exports[_0x92cc('0x43')]=function(_0x136da7,_0x47b856){var _0x45b590={'raw':![],'where':{'id':_0x136da7[_0x92cc('0x44')]['id']}},_0x21dd38={};_0x21dd38['model']=_[_0x92cc('0x2f')](db[_0x92cc('0x3f')][_0x92cc('0x45')]);_0x21dd38['query']=_[_0x92cc('0x2f')](_0x136da7[_0x92cc('0x30')]);_0x21dd38[_0x92cc('0x3a')]=_[_0x92cc('0x31')](_0x21dd38['model'],_0x21dd38[_0x92cc('0x30')]);_0x45b590[_0x92cc('0x32')]=_[_0x92cc('0x31')](_0x21dd38['model'],qs[_0x92cc('0x33')](_0x136da7[_0x92cc('0x30')][_0x92cc('0x33')]));_0x45b590[_0x92cc('0x32')]=_0x45b590[_0x92cc('0x32')][_0x92cc('0x34')]?_0x45b590['attributes']:_0x21dd38[_0x92cc('0x2e')];if(_0x136da7['query']['includeAll']){_0x45b590[_0x92cc('0x46')]=[{'all':!![]}];}_0x45b590=_[_0x92cc('0x3c')]({},_0x45b590,_0x136da7['options']);return db[_0x92cc('0x3f')][_0x92cc('0x47')](_0x45b590)[_0x92cc('0x24')](handleEntityNotFound(_0x47b856,null))['then'](respondWithResult(_0x47b856,null))[_0x92cc('0x42')](handleError(_0x47b856,null));};exports[_0x92cc('0x48')]=function(_0x4d4fd1,_0x221eeb){return db[_0x92cc('0x3f')]['create'](_0x4d4fd1[_0x92cc('0x49')],{})[_0x92cc('0x24')](respondWithResult(_0x221eeb,0xc9))[_0x92cc('0x42')](handleError(_0x221eeb,null));};exports[_0x92cc('0x4a')]=function(_0xfe86fe,_0x43a151){if(_0xfe86fe[_0x92cc('0x49')]['id']){delete _0xfe86fe[_0x92cc('0x49')]['id'];}return db[_0x92cc('0x3f')]['find']({'where':{'id':_0xfe86fe['params']['id']}})[_0x92cc('0x24')](handleEntityNotFound(_0x43a151,null))[_0x92cc('0x24')](saveUpdates(_0xfe86fe['body'],null))[_0x92cc('0x24')](respondWithResult(_0x43a151,null))[_0x92cc('0x42')](handleError(_0x43a151,null));};exports['destroy']=function(_0x55841c,_0x4d7f8d){return db['VtigerConfiguration'][_0x92cc('0x47')]({'where':{'id':_0x55841c[_0x92cc('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d7f8d,null))[_0x92cc('0x24')](removeEntity(_0x4d7f8d,null))[_0x92cc('0x42')](handleError(_0x4d7f8d,null));};exports['getFields']=function(_0x54b861,_0x23d6d0,_0x5e66da){var _0x2d1f59={};var _0x5f57b3={};var _0x4ac80c;var _0x1ada96;return db[_0x92cc('0x3f')][_0x92cc('0x4b')]({'where':{'id':_0x54b861['params']['id']}})[_0x92cc('0x24')](handleEntityNotFound(_0x23d6d0,null))[_0x92cc('0x24')](function(_0x3c18e9){if(_0x3c18e9){_0x4ac80c=_0x3c18e9;_0x5f57b3['model']=_[_0x92cc('0x2f')](db['VtigerField'][_0x92cc('0x45')]);_0x5f57b3[_0x92cc('0x30')]=_[_0x92cc('0x2f')](_0x54b861[_0x92cc('0x30')]);_0x5f57b3[_0x92cc('0x3a')]=_[_0x92cc('0x31')](_0x5f57b3[_0x92cc('0x2e')],_0x5f57b3[_0x92cc('0x30')]);_0x2d1f59[_0x92cc('0x32')]=_['intersection'](_0x5f57b3[_0x92cc('0x2e')],qs[_0x92cc('0x33')](_0x54b861[_0x92cc('0x30')][_0x92cc('0x33')]));_0x2d1f59['attributes']=_0x2d1f59[_0x92cc('0x32')][_0x92cc('0x34')]?_0x2d1f59[_0x92cc('0x32')]:_0x5f57b3[_0x92cc('0x2e')];_0x2d1f59[_0x92cc('0x37')]=qs[_0x92cc('0x38')](_0x54b861[_0x92cc('0x30')][_0x92cc('0x38')]);_0x2d1f59[_0x92cc('0x39')]=qs['filters'](_[_0x92cc('0x4c')](_0x54b861[_0x92cc('0x30')],_0x5f57b3[_0x92cc('0x3a')]));if(_0x54b861[_0x92cc('0x30')]['filter']){_0x2d1f59[_0x92cc('0x39')]=_['merge'](_0x2d1f59[_0x92cc('0x39')],{'$or':_[_0x92cc('0x3d')](_0x2d1f59[_0x92cc('0x32')],function(_0x351f95){var _0x490c3f={};_0x490c3f[_0x351f95]={'$like':'%'+_0x54b861[_0x92cc('0x30')][_0x92cc('0x3b')]+'%'};return _0x490c3f;})});}_0x2d1f59=_['merge']({},_0x2d1f59,_0x54b861[_0x92cc('0x4d')]);return _0x4ac80c[_0x92cc('0x4e')](_0x2d1f59);}})['then'](function(_0x4f052a){if(_0x4f052a){_0x1ada96=_0x4f052a[_0x92cc('0x34')];if(!_0x54b861[_0x92cc('0x30')][_0x92cc('0x35')](_0x92cc('0x36'))){_0x2d1f59['limit']=qs[_0x92cc('0x1f')](_0x54b861[_0x92cc('0x30')][_0x92cc('0x1f')]);_0x2d1f59[_0x92cc('0x1e')]=qs[_0x92cc('0x1e')](_0x54b861[_0x92cc('0x30')]['offset']);}return _0x4ac80c[_0x92cc('0x4e')](_0x2d1f59);}})[_0x92cc('0x24')](function(_0x60d59b){if(_0x60d59b){return _0x60d59b?{'count':_0x1ada96,'rows':_0x60d59b}:null;}})[_0x92cc('0x24')](respondWithResult(_0x23d6d0,null))[_0x92cc('0x42')](handleError(_0x23d6d0,null));};exports['getSubjects']=function(_0x480112,_0x5e64c3,_0x3ae444){var _0x40b381={};var _0x5bb4f6={};var _0x52401f;var _0xdefbed;return db['VtigerConfiguration'][_0x92cc('0x4b')]({'where':{'id':_0x480112[_0x92cc('0x44')]['id']}})[_0x92cc('0x24')](handleEntityNotFound(_0x5e64c3,null))[_0x92cc('0x24')](function(_0x4e828f){if(_0x4e828f){_0x52401f=_0x4e828f;_0x5bb4f6[_0x92cc('0x2e')]=_[_0x92cc('0x2f')](db['VtigerField'][_0x92cc('0x45')]);_0x5bb4f6[_0x92cc('0x30')]=_[_0x92cc('0x2f')](_0x480112[_0x92cc('0x30')]);_0x5bb4f6['filters']=_[_0x92cc('0x31')](_0x5bb4f6[_0x92cc('0x2e')],_0x5bb4f6[_0x92cc('0x30')]);_0x40b381[_0x92cc('0x32')]=_[_0x92cc('0x31')](_0x5bb4f6[_0x92cc('0x2e')],qs[_0x92cc('0x33')](_0x480112[_0x92cc('0x30')][_0x92cc('0x33')]));_0x40b381[_0x92cc('0x32')]=_0x40b381['attributes']['length']?_0x40b381['attributes']:_0x5bb4f6[_0x92cc('0x2e')];_0x40b381[_0x92cc('0x37')]=qs[_0x92cc('0x38')](_0x480112['query'][_0x92cc('0x38')]);_0x40b381[_0x92cc('0x39')]=qs[_0x92cc('0x3a')](_[_0x92cc('0x4c')](_0x480112[_0x92cc('0x30')],_0x5bb4f6['filters']));if(_0x480112[_0x92cc('0x30')][_0x92cc('0x3b')]){_0x40b381['where']=_['merge'](_0x40b381['where'],{'$or':_[_0x92cc('0x3d')](_0x40b381[_0x92cc('0x32')],function(_0x280f8a){var _0x5d6c59={};_0x5d6c59[_0x280f8a]={'$like':'%'+_0x480112[_0x92cc('0x30')]['filter']+'%'};return _0x5d6c59;})});}_0x40b381=_[_0x92cc('0x3c')]({},_0x40b381,_0x480112['options']);return _0x52401f[_0x92cc('0x4f')](_0x40b381);}})[_0x92cc('0x24')](function(_0x34d918){if(_0x34d918){_0xdefbed=_0x34d918[_0x92cc('0x34')];if(!_0x480112[_0x92cc('0x30')][_0x92cc('0x35')](_0x92cc('0x36'))){_0x40b381[_0x92cc('0x1f')]=qs['limit'](_0x480112['query'][_0x92cc('0x1f')]);_0x40b381['offset']=qs['offset'](_0x480112['query'][_0x92cc('0x1e')]);}return _0x52401f[_0x92cc('0x4f')](_0x40b381);}})[_0x92cc('0x24')](function(_0x637f5){if(_0x637f5){return _0x637f5?{'count':_0xdefbed,'rows':_0x637f5}:null;}})[_0x92cc('0x24')](respondWithResult(_0x5e64c3,null))[_0x92cc('0x42')](handleError(_0x5e64c3,null));};exports['getDescriptions']=function(_0x152dff,_0x362cfb,_0x58b525){var _0x2a72e7={};var _0x21bb87={};var _0x1a738c;var _0x3ee863;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x152dff['params']['id']}})[_0x92cc('0x24')](handleEntityNotFound(_0x362cfb,null))[_0x92cc('0x24')](function(_0x12b88e){if(_0x12b88e){_0x1a738c=_0x12b88e;_0x21bb87[_0x92cc('0x2e')]=_['keys'](db['VtigerField'][_0x92cc('0x45')]);_0x21bb87[_0x92cc('0x30')]=_[_0x92cc('0x2f')](_0x152dff['query']);_0x21bb87[_0x92cc('0x3a')]=_[_0x92cc('0x31')](_0x21bb87['model'],_0x21bb87[_0x92cc('0x30')]);_0x2a72e7[_0x92cc('0x32')]=_[_0x92cc('0x31')](_0x21bb87[_0x92cc('0x2e')],qs[_0x92cc('0x33')](_0x152dff['query'][_0x92cc('0x33')]));_0x2a72e7[_0x92cc('0x32')]=_0x2a72e7[_0x92cc('0x32')][_0x92cc('0x34')]?_0x2a72e7[_0x92cc('0x32')]:_0x21bb87[_0x92cc('0x2e')];_0x2a72e7[_0x92cc('0x37')]=qs[_0x92cc('0x38')](_0x152dff[_0x92cc('0x30')][_0x92cc('0x38')]);_0x2a72e7[_0x92cc('0x39')]=qs[_0x92cc('0x3a')](_[_0x92cc('0x4c')](_0x152dff['query'],_0x21bb87[_0x92cc('0x3a')]));if(_0x152dff[_0x92cc('0x30')]['filter']){_0x2a72e7[_0x92cc('0x39')]=_[_0x92cc('0x3c')](_0x2a72e7[_0x92cc('0x39')],{'$or':_[_0x92cc('0x3d')](_0x2a72e7[_0x92cc('0x32')],function(_0x10b8c7){var _0x2f1228={};_0x2f1228[_0x10b8c7]={'$like':'%'+_0x152dff['query'][_0x92cc('0x3b')]+'%'};return _0x2f1228;})});}_0x2a72e7=_[_0x92cc('0x3c')]({},_0x2a72e7,_0x152dff[_0x92cc('0x4d')]);return _0x1a738c[_0x92cc('0x50')](_0x2a72e7);}})[_0x92cc('0x24')](function(_0x30e825){if(_0x30e825){_0x3ee863=_0x30e825[_0x92cc('0x34')];if(!_0x152dff[_0x92cc('0x30')]['hasOwnProperty'](_0x92cc('0x36'))){_0x2a72e7[_0x92cc('0x1f')]=qs[_0x92cc('0x1f')](_0x152dff['query'][_0x92cc('0x1f')]);_0x2a72e7[_0x92cc('0x1e')]=qs['offset'](_0x152dff[_0x92cc('0x30')][_0x92cc('0x1e')]);}return _0x1a738c[_0x92cc('0x50')](_0x2a72e7);}})['then'](function(_0x1fa278){if(_0x1fa278){return _0x1fa278?{'count':_0x3ee863,'rows':_0x1fa278}:null;}})['then'](respondWithResult(_0x362cfb,null))['catch'](handleError(_0x362cfb,null));}; \ No newline at end of file +var _0x780c=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VtigerConfiguration','include','findAll','show','params','includeAll','find','create','body','catch','findOne','VtigerField','options','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','count','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key'];(function(_0x16122d,_0x34741b){var _0x9aaaf1=function(_0x221b5a){while(--_0x221b5a){_0x16122d['push'](_0x16122d['shift']());}};_0x9aaaf1(++_0x34741b);}(_0x780c,0x72));var _0xc780=function(_0x1e6db3,_0x5643ac){_0x1e6db3=_0x1e6db3-0x0;var _0x1de886=_0x780c[_0x1e6db3];return _0x1de886;};'use strict';var emlformat=require(_0xc780('0x0'));var rimraf=require(_0xc780('0x1'));var zipdir=require(_0xc780('0x2'));var jsonpatch=require(_0xc780('0x3'));var rp=require(_0xc780('0x4'));var moment=require('moment');var BPromise=require(_0xc780('0x5'));var Mustache=require(_0xc780('0x6'));var util=require(_0xc780('0x7'));var path=require(_0xc780('0x8'));var sox=require(_0xc780('0x9'));var csv=require(_0xc780('0xa'));var ejs=require(_0xc780('0xb'));var fs=require('fs');var fs_extra=require(_0xc780('0xc'));var _=require(_0xc780('0xd'));var squel=require(_0xc780('0xe'));var crypto=require('crypto');var jsforce=require(_0xc780('0xf'));var deskjs=require(_0xc780('0x10'));var toCsv=require(_0xc780('0xa'));var querystring=require(_0xc780('0x11'));var Papa=require(_0xc780('0x12'));var Redis=require(_0xc780('0x13'));var authService=require(_0xc780('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc780('0x15'));var logger=require(_0xc780('0x16'))(_0xc780('0x17'));var utils=require('../../config/utils');var config=require(_0xc780('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xc780('0x19'))['db'];function respondWithStatusCode(_0x3fd7e6,_0x46222e){_0x46222e=_0x46222e||0xcc;return function(_0x123fbd){if(_0x123fbd){return _0x3fd7e6[_0xc780('0x1a')](_0x46222e);}return _0x3fd7e6['status'](_0x46222e)[_0xc780('0x1b')]();};}function respondWithResult(_0x429ae4,_0xfbe616){_0xfbe616=_0xfbe616||0xc8;return function(_0x340d4c){if(_0x340d4c){return _0x429ae4[_0xc780('0x1c')](_0xfbe616)[_0xc780('0x1d')](_0x340d4c);}};}function respondWithFilteredResult(_0x228738,_0x181e38){return function(_0x4c75ba){if(_0x4c75ba){var _0x5211f4=typeof _0x181e38[_0xc780('0x1e')]==='undefined'&&typeof _0x181e38[_0xc780('0x1f')]==='undefined';var _0x3f7885=_0x4c75ba[_0xc780('0x20')];var _0x48bc11=_0x5211f4?0x0:_0x181e38[_0xc780('0x1e')];var _0x57277f=_0x5211f4?_0x4c75ba['count']:_0x181e38['offset']+_0x181e38[_0xc780('0x1f')];var _0xf2fad9;if(_0x57277f>=_0x3f7885){_0x57277f=_0x3f7885;_0xf2fad9=0xc8;}else{_0xf2fad9=0xce;}_0x228738['status'](_0xf2fad9);return _0x228738[_0xc780('0x21')](_0xc780('0x22'),_0x48bc11+'-'+_0x57277f+'/'+_0x3f7885)[_0xc780('0x1d')](_0x4c75ba);}return null;};}function patchUpdates(_0x2650fd){return function(_0x5260a3){try{jsonpatch[_0xc780('0x23')](_0x5260a3,_0x2650fd,!![]);}catch(_0x207de9){return BPromise[_0xc780('0x24')](_0x207de9);}return _0x5260a3['save']();};}function saveUpdates(_0x3c105d,_0x909032){return function(_0x5bd5b2){if(_0x5bd5b2){return _0x5bd5b2[_0xc780('0x25')](_0x3c105d)['then'](function(_0xdf793f){return _0xdf793f;});}return null;};}function removeEntity(_0x4ba992,_0x5b1541){return function(_0x3a78ed){if(_0x3a78ed){return _0x3a78ed[_0xc780('0x26')]()[_0xc780('0x27')](function(){_0x4ba992[_0xc780('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xee9d73,_0x1c41ca){return function(_0x836413){if(!_0x836413){_0xee9d73[_0xc780('0x1a')](0x194);}return _0x836413;};}function handleError(_0x3ab33b,_0x1ad72f){_0x1ad72f=_0x1ad72f||0x1f4;return function(_0x5e6afa){logger[_0xc780('0x28')](_0x5e6afa[_0xc780('0x29')]);if(_0x5e6afa[_0xc780('0x2a')]){delete _0x5e6afa[_0xc780('0x2a')];}_0x3ab33b['status'](_0x1ad72f)[_0xc780('0x2b')](_0x5e6afa);};}exports[_0xc780('0x2c')]=function(_0x150e1e,_0x493e3e){var _0x4d93c0={},_0x59549b={},_0x10d61f={'count':0x0,'rows':[]};var _0x1398e1=_[_0xc780('0x2d')](db['VtigerConfiguration'][_0xc780('0x2e')],function(_0x2ecce9){return{'name':_0x2ecce9[_0xc780('0x2f')],'type':_0x2ecce9[_0xc780('0x30')][_0xc780('0x31')]};});_0x59549b[_0xc780('0x32')]=_[_0xc780('0x2d')](_0x1398e1,_0xc780('0x2a'));_0x59549b[_0xc780('0x33')]=_[_0xc780('0x34')](_0x150e1e[_0xc780('0x33')]);_0x59549b[_0xc780('0x35')]=_[_0xc780('0x36')](_0x59549b['model'],_0x59549b[_0xc780('0x33')]);_0x4d93c0[_0xc780('0x37')]=_[_0xc780('0x36')](_0x59549b[_0xc780('0x32')],qs[_0xc780('0x38')](_0x150e1e[_0xc780('0x33')]['fields']));_0x4d93c0[_0xc780('0x37')]=_0x4d93c0[_0xc780('0x37')][_0xc780('0x39')]?_0x4d93c0[_0xc780('0x37')]:_0x59549b[_0xc780('0x32')];if(!_0x150e1e[_0xc780('0x33')][_0xc780('0x3a')](_0xc780('0x3b'))){_0x4d93c0[_0xc780('0x1f')]=qs[_0xc780('0x1f')](_0x150e1e[_0xc780('0x33')][_0xc780('0x1f')]);_0x4d93c0[_0xc780('0x1e')]=qs[_0xc780('0x1e')](_0x150e1e[_0xc780('0x33')][_0xc780('0x1e')]);}_0x4d93c0[_0xc780('0x3c')]=qs['sort'](_0x150e1e['query'][_0xc780('0x3d')]);_0x4d93c0['where']=qs[_0xc780('0x35')](_[_0xc780('0x3e')](_0x150e1e[_0xc780('0x33')],_0x59549b[_0xc780('0x35')]),_0x1398e1);if(_0x150e1e['query'][_0xc780('0x3f')]){_0x4d93c0[_0xc780('0x40')]=_[_0xc780('0x41')](_0x4d93c0[_0xc780('0x40')],{'$or':_[_0xc780('0x2d')](_0x1398e1,function(_0x5ffc17){if(_0x5ffc17[_0xc780('0x30')]!=='VIRTUAL'){var _0x4cbd37={};_0x4cbd37[_0x5ffc17['name']]={'$like':'%'+_0x150e1e[_0xc780('0x33')][_0xc780('0x3f')]+'%'};return _0x4cbd37;}})});}_0x4d93c0=_[_0xc780('0x41')]({},_0x4d93c0,_0x150e1e['options']);var _0x2eb637={'where':_0x4d93c0[_0xc780('0x40')]};return db[_0xc780('0x42')][_0xc780('0x20')](_0x2eb637)['then'](function(_0x40c1cc){_0x10d61f[_0xc780('0x20')]=_0x40c1cc;if(_0x150e1e[_0xc780('0x33')]['includeAll']){_0x4d93c0[_0xc780('0x43')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0xc780('0x44')](_0x4d93c0);})['then'](function(_0x1b592){_0x10d61f['rows']=_0x1b592;return _0x10d61f;})[_0xc780('0x27')](respondWithFilteredResult(_0x493e3e,_0x4d93c0))['catch'](handleError(_0x493e3e,null));};exports[_0xc780('0x45')]=function(_0x4815a0,_0x2154ed){var _0x276a54={'raw':![],'where':{'id':_0x4815a0[_0xc780('0x46')]['id']}},_0x5a623b={};_0x5a623b['model']=_[_0xc780('0x34')](db[_0xc780('0x42')][_0xc780('0x2e')]);_0x5a623b[_0xc780('0x33')]=_['keys'](_0x4815a0[_0xc780('0x33')]);_0x5a623b[_0xc780('0x35')]=_[_0xc780('0x36')](_0x5a623b[_0xc780('0x32')],_0x5a623b['query']);_0x276a54[_0xc780('0x37')]=_[_0xc780('0x36')](_0x5a623b[_0xc780('0x32')],qs[_0xc780('0x38')](_0x4815a0[_0xc780('0x33')][_0xc780('0x38')]));_0x276a54['attributes']=_0x276a54['attributes'][_0xc780('0x39')]?_0x276a54['attributes']:_0x5a623b[_0xc780('0x32')];if(_0x4815a0[_0xc780('0x33')][_0xc780('0x47')]){_0x276a54[_0xc780('0x43')]=[{'all':!![]}];}_0x276a54=_[_0xc780('0x41')]({},_0x276a54,_0x4815a0['options']);return db[_0xc780('0x42')][_0xc780('0x48')](_0x276a54)[_0xc780('0x27')](handleEntityNotFound(_0x2154ed,null))[_0xc780('0x27')](respondWithResult(_0x2154ed,null))['catch'](handleError(_0x2154ed,null));};exports[_0xc780('0x49')]=function(_0xedaaa2,_0x51059d){return db['VtigerConfiguration'][_0xc780('0x49')](_0xedaaa2[_0xc780('0x4a')],{})[_0xc780('0x27')](respondWithResult(_0x51059d,0xc9))[_0xc780('0x4b')](handleError(_0x51059d,null));};exports[_0xc780('0x25')]=function(_0x13358a,_0x36c135){if(_0x13358a[_0xc780('0x4a')]['id']){delete _0x13358a[_0xc780('0x4a')]['id'];}return db[_0xc780('0x42')][_0xc780('0x48')]({'where':{'id':_0x13358a[_0xc780('0x46')]['id']}})[_0xc780('0x27')](handleEntityNotFound(_0x36c135,null))['then'](saveUpdates(_0x13358a[_0xc780('0x4a')],null))['then'](respondWithResult(_0x36c135,null))[_0xc780('0x4b')](handleError(_0x36c135,null));};exports[_0xc780('0x26')]=function(_0x39ce06,_0x315f68){return db['VtigerConfiguration'][_0xc780('0x48')]({'where':{'id':_0x39ce06['params']['id']}})[_0xc780('0x27')](handleEntityNotFound(_0x315f68,null))[_0xc780('0x27')](removeEntity(_0x315f68,null))[_0xc780('0x4b')](handleError(_0x315f68,null));};exports['getFields']=function(_0xc6a2e0,_0xff2d57,_0x33b6ec){var _0x113ef8={};var _0xfce35a={};var _0x2e8f99;var _0x79c90e;return db[_0xc780('0x42')][_0xc780('0x4c')]({'where':{'id':_0xc6a2e0[_0xc780('0x46')]['id']}})[_0xc780('0x27')](handleEntityNotFound(_0xff2d57,null))[_0xc780('0x27')](function(_0x323db8){if(_0x323db8){_0x2e8f99=_0x323db8;_0xfce35a[_0xc780('0x32')]=_[_0xc780('0x34')](db[_0xc780('0x4d')][_0xc780('0x2e')]);_0xfce35a[_0xc780('0x33')]=_[_0xc780('0x34')](_0xc6a2e0['query']);_0xfce35a[_0xc780('0x35')]=_[_0xc780('0x36')](_0xfce35a[_0xc780('0x32')],_0xfce35a[_0xc780('0x33')]);_0x113ef8[_0xc780('0x37')]=_[_0xc780('0x36')](_0xfce35a[_0xc780('0x32')],qs[_0xc780('0x38')](_0xc6a2e0[_0xc780('0x33')][_0xc780('0x38')]));_0x113ef8['attributes']=_0x113ef8[_0xc780('0x37')]['length']?_0x113ef8['attributes']:_0xfce35a[_0xc780('0x32')];_0x113ef8['order']=qs[_0xc780('0x3d')](_0xc6a2e0[_0xc780('0x33')][_0xc780('0x3d')]);_0x113ef8[_0xc780('0x40')]=qs['filters'](_['pick'](_0xc6a2e0['query'],_0xfce35a[_0xc780('0x35')]));if(_0xc6a2e0[_0xc780('0x33')]['filter']){_0x113ef8[_0xc780('0x40')]=_[_0xc780('0x41')](_0x113ef8[_0xc780('0x40')],{'$or':_[_0xc780('0x2d')](_0x113ef8[_0xc780('0x37')],function(_0x277f4b){var _0x3c2b61={};_0x3c2b61[_0x277f4b]={'$like':'%'+_0xc6a2e0[_0xc780('0x33')][_0xc780('0x3f')]+'%'};return _0x3c2b61;})});}_0x113ef8=_['merge']({},_0x113ef8,_0xc6a2e0[_0xc780('0x4e')]);return _0x2e8f99[_0xc780('0x4f')](_0x113ef8);}})['then'](function(_0x21c545){if(_0x21c545){_0x79c90e=_0x21c545['length'];if(!_0xc6a2e0['query'][_0xc780('0x3a')](_0xc780('0x3b'))){_0x113ef8[_0xc780('0x1f')]=qs['limit'](_0xc6a2e0[_0xc780('0x33')][_0xc780('0x1f')]);_0x113ef8['offset']=qs['offset'](_0xc6a2e0[_0xc780('0x33')][_0xc780('0x1e')]);}return _0x2e8f99[_0xc780('0x4f')](_0x113ef8);}})[_0xc780('0x27')](function(_0x4bde06){if(_0x4bde06){return _0x4bde06?{'count':_0x79c90e,'rows':_0x4bde06}:null;}})[_0xc780('0x27')](respondWithResult(_0xff2d57,null))[_0xc780('0x4b')](handleError(_0xff2d57,null));};exports[_0xc780('0x50')]=function(_0x528c94,_0x46f036,_0x40826a){var _0x3b3305={};var _0x2af0e3={};var _0x1cfd91;var _0x19d93d;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x528c94['params']['id']}})[_0xc780('0x27')](handleEntityNotFound(_0x46f036,null))[_0xc780('0x27')](function(_0x34eeac){if(_0x34eeac){_0x1cfd91=_0x34eeac;_0x2af0e3[_0xc780('0x32')]=_[_0xc780('0x34')](db[_0xc780('0x4d')][_0xc780('0x2e')]);_0x2af0e3[_0xc780('0x33')]=_[_0xc780('0x34')](_0x528c94[_0xc780('0x33')]);_0x2af0e3['filters']=_[_0xc780('0x36')](_0x2af0e3[_0xc780('0x32')],_0x2af0e3['query']);_0x3b3305[_0xc780('0x37')]=_['intersection'](_0x2af0e3[_0xc780('0x32')],qs['fields'](_0x528c94['query']['fields']));_0x3b3305[_0xc780('0x37')]=_0x3b3305[_0xc780('0x37')]['length']?_0x3b3305[_0xc780('0x37')]:_0x2af0e3[_0xc780('0x32')];_0x3b3305[_0xc780('0x3c')]=qs['sort'](_0x528c94[_0xc780('0x33')][_0xc780('0x3d')]);_0x3b3305[_0xc780('0x40')]=qs['filters'](_[_0xc780('0x3e')](_0x528c94[_0xc780('0x33')],_0x2af0e3[_0xc780('0x35')]));if(_0x528c94[_0xc780('0x33')][_0xc780('0x3f')]){_0x3b3305['where']=_[_0xc780('0x41')](_0x3b3305[_0xc780('0x40')],{'$or':_['map'](_0x3b3305['attributes'],function(_0x4e2950){var _0xad45aa={};_0xad45aa[_0x4e2950]={'$like':'%'+_0x528c94['query'][_0xc780('0x3f')]+'%'};return _0xad45aa;})});}_0x3b3305=_[_0xc780('0x41')]({},_0x3b3305,_0x528c94[_0xc780('0x4e')]);return _0x1cfd91[_0xc780('0x50')](_0x3b3305);}})['then'](function(_0x588ef8){if(_0x588ef8){_0x19d93d=_0x588ef8['length'];if(!_0x528c94[_0xc780('0x33')][_0xc780('0x3a')](_0xc780('0x3b'))){_0x3b3305['limit']=qs[_0xc780('0x1f')](_0x528c94[_0xc780('0x33')][_0xc780('0x1f')]);_0x3b3305[_0xc780('0x1e')]=qs[_0xc780('0x1e')](_0x528c94[_0xc780('0x33')]['offset']);}return _0x1cfd91['getSubjects'](_0x3b3305);}})[_0xc780('0x27')](function(_0x247aa1){if(_0x247aa1){return _0x247aa1?{'count':_0x19d93d,'rows':_0x247aa1}:null;}})[_0xc780('0x27')](respondWithResult(_0x46f036,null))[_0xc780('0x4b')](handleError(_0x46f036,null));};exports['getDescriptions']=function(_0x1143c9,_0x3de771,_0x2ae7a5){var _0x40421b={};var _0x3f8ab8={};var _0x5867bf;var _0x5244a3;return db[_0xc780('0x42')][_0xc780('0x4c')]({'where':{'id':_0x1143c9['params']['id']}})[_0xc780('0x27')](handleEntityNotFound(_0x3de771,null))['then'](function(_0x473dca){if(_0x473dca){_0x5867bf=_0x473dca;_0x3f8ab8[_0xc780('0x32')]=_[_0xc780('0x34')](db[_0xc780('0x4d')][_0xc780('0x2e')]);_0x3f8ab8[_0xc780('0x33')]=_['keys'](_0x1143c9[_0xc780('0x33')]);_0x3f8ab8[_0xc780('0x35')]=_[_0xc780('0x36')](_0x3f8ab8[_0xc780('0x32')],_0x3f8ab8[_0xc780('0x33')]);_0x40421b['attributes']=_['intersection'](_0x3f8ab8[_0xc780('0x32')],qs[_0xc780('0x38')](_0x1143c9[_0xc780('0x33')][_0xc780('0x38')]));_0x40421b[_0xc780('0x37')]=_0x40421b['attributes']['length']?_0x40421b[_0xc780('0x37')]:_0x3f8ab8[_0xc780('0x32')];_0x40421b['order']=qs['sort'](_0x1143c9['query'][_0xc780('0x3d')]);_0x40421b['where']=qs['filters'](_[_0xc780('0x3e')](_0x1143c9['query'],_0x3f8ab8[_0xc780('0x35')]));if(_0x1143c9['query'][_0xc780('0x3f')]){_0x40421b[_0xc780('0x40')]=_[_0xc780('0x41')](_0x40421b[_0xc780('0x40')],{'$or':_[_0xc780('0x2d')](_0x40421b['attributes'],function(_0xfcc9e0){var _0x29969d={};_0x29969d[_0xfcc9e0]={'$like':'%'+_0x1143c9[_0xc780('0x33')][_0xc780('0x3f')]+'%'};return _0x29969d;})});}_0x40421b=_[_0xc780('0x41')]({},_0x40421b,_0x1143c9[_0xc780('0x4e')]);return _0x5867bf[_0xc780('0x51')](_0x40421b);}})[_0xc780('0x27')](function(_0x3e4afd){if(_0x3e4afd){_0x5244a3=_0x3e4afd[_0xc780('0x39')];if(!_0x1143c9[_0xc780('0x33')][_0xc780('0x3a')]('nolimit')){_0x40421b[_0xc780('0x1f')]=qs[_0xc780('0x1f')](_0x1143c9[_0xc780('0x33')][_0xc780('0x1f')]);_0x40421b[_0xc780('0x1e')]=qs['offset'](_0x1143c9[_0xc780('0x33')][_0xc780('0x1e')]);}return _0x5867bf['getDescriptions'](_0x40421b);}})[_0xc780('0x27')](function(_0x4617a9){if(_0x4617a9){return _0x4617a9?{'count':_0x5244a3,'rows':_0x4617a9}:null;}})['then'](respondWithResult(_0x3de771,null))[_0xc780('0x4b')](handleError(_0x3de771,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 8269ce5..a570572 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 _0x1cbd=['path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','define','int_vtiger_configurations','lodash','../../config/logger','api','moment','bluebird'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x1cbd,0xb6));var _0xd1cb=function(_0x2a5099,_0x329e92){_0x2a5099=_0x2a5099-0x0;var _0x2802f1=_0x1cbd[_0x2a5099];return _0x2802f1;};'use strict';var _=require(_0xd1cb('0x0'));var util=require('util');var logger=require(_0xd1cb('0x1'))(_0xd1cb('0x2'));var moment=require(_0xd1cb('0x3'));var BPromise=require(_0xd1cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd1cb('0x5'));var rimraf=require(_0xd1cb('0x6'));var config=require(_0xd1cb('0x7'));var attributes=require(_0xd1cb('0x8'));module['exports']=function(_0x5841f1,_0x4ade99){return _0x5841f1[_0xd1cb('0x9')]('VtigerConfiguration',attributes,{'tableName':_0xd1cb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7cbf=['path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','define','VtigerConfiguration','int_vtiger_configurations','util','../../config/logger','api','moment','request-promise'];(function(_0x17d76b,_0x54345b){var _0x16f3ac=function(_0x315442){while(--_0x315442){_0x17d76b['push'](_0x17d76b['shift']());}};_0x16f3ac(++_0x54345b);}(_0x7cbf,0x11b));var _0xf7cb=function(_0x1e6664,_0x1acf76){_0x1e6664=_0x1e6664-0x0;var _0x91fcbc=_0x7cbf[_0x1e6664];return _0x91fcbc;};'use strict';var _=require('lodash');var util=require(_0xf7cb('0x0'));var logger=require(_0xf7cb('0x1'))(_0xf7cb('0x2'));var moment=require(_0xf7cb('0x3'));var BPromise=require('bluebird');var rp=require(_0xf7cb('0x4'));var fs=require('fs');var path=require(_0xf7cb('0x5'));var rimraf=require(_0xf7cb('0x6'));var config=require(_0xf7cb('0x7'));var attributes=require(_0xf7cb('0x8'));module['exports']=function(_0x19bb2e,_0x366aff){return _0x19bb2e[_0xf7cb('0x9')](_0xf7cb('0xa'),attributes,{'tableName':_0xf7cb('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 2e8558a..ba7f06f 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 _0xd32f=['rpc','../../config/environment','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x39dc87,_0x4359d3){var _0x2128f7=function(_0x34a64d){while(--_0x34a64d){_0x39dc87['push'](_0x39dc87['shift']());}};_0x2128f7(++_0x4359d3);}(_0xd32f,0x10b));var _0xfd32=function(_0x358826,_0x2f9616){_0x358826=_0x358826-0x0;var _0x5c918c=_0xd32f[_0x358826];return _0x5c918c;};'use strict';var _=require(_0xfd32('0x0'));var util=require('util');var moment=require(_0xfd32('0x1'));var BPromise=require(_0xfd32('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfd32('0x3'));var db=require(_0xfd32('0x4'))['db'];var utils=require(_0xfd32('0x5'));var logger=require('../../config/logger')(_0xfd32('0x6'));var config=require(_0xfd32('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfd32('0x8')][_0xfd32('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4ea8e0,_0x4c3445,_0x51aaa5){return new BPromise(function(_0xdae272,_0x171726){return client[_0xfd32('0xa')](_0x4ea8e0,_0x51aaa5)[_0xfd32('0xb')](function(_0x303086){logger[_0xfd32('0xc')](_0xfd32('0xd'),_0x4c3445,_0xfd32('0xe'));logger[_0xfd32('0xf')](_0xfd32('0x10'),_0x4c3445,_0xfd32('0xe'),JSON['stringify'](_0x303086));if(_0x303086[_0xfd32('0x11')]){if(_0x303086[_0xfd32('0x11')][_0xfd32('0x12')]===0x1f4){logger[_0xfd32('0x11')](_0xfd32('0xd'),_0x4c3445,_0x303086[_0xfd32('0x11')][_0xfd32('0x13')]);return _0x171726(_0x303086[_0xfd32('0x11')][_0xfd32('0x13')]);}logger[_0xfd32('0x11')](_0xfd32('0xd'),_0x4c3445,_0x303086[_0xfd32('0x11')][_0xfd32('0x13')]);return _0xdae272(_0x303086[_0xfd32('0x11')][_0xfd32('0x13')]);}else{logger[_0xfd32('0xc')](_0xfd32('0xd'),_0x4c3445,_0xfd32('0xe'));_0xdae272(_0x303086[_0xfd32('0x14')]['message']);}})['catch'](function(_0x569cf0){logger['error'](_0xfd32('0xd'),_0x4c3445,_0x569cf0);_0x171726(_0x569cf0);});});} \ No newline at end of file +var _0x6787=['then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request'];(function(_0x31520d,_0x50046a){var _0x4d0d26=function(_0x187fe0){while(--_0x187fe0){_0x31520d['push'](_0x31520d['shift']());}};_0x4d0d26(++_0x50046a);}(_0x6787,0xfc));var _0x7678=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x6787[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x7678('0x0'));var util=require(_0x7678('0x1'));var moment=require('moment');var BPromise=require(_0x7678('0x2'));var rs=require(_0x7678('0x3'));var fs=require('fs');var Redis=require(_0x7678('0x4'));var db=require(_0x7678('0x5'))['db'];var utils=require(_0x7678('0x6'));var logger=require(_0x7678('0x7'))('rpc');var config=require(_0x7678('0x8'));var jayson=require(_0x7678('0x9'));var client=jayson[_0x7678('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22cb6e,_0x2aa8ef,_0x436dca){return new BPromise(function(_0x260296,_0x13db6c){return client[_0x7678('0xb')](_0x22cb6e,_0x436dca)[_0x7678('0xc')](function(_0x55ecfa){logger[_0x7678('0xd')](_0x7678('0xe'),_0x2aa8ef,_0x7678('0xf'));logger[_0x7678('0x10')](_0x7678('0x11'),_0x2aa8ef,_0x7678('0xf'),JSON[_0x7678('0x12')](_0x55ecfa));if(_0x55ecfa['error']){if(_0x55ecfa[_0x7678('0x13')][_0x7678('0x14')]===0x1f4){logger[_0x7678('0x13')](_0x7678('0xe'),_0x2aa8ef,_0x55ecfa['error']['message']);return _0x13db6c(_0x55ecfa[_0x7678('0x13')][_0x7678('0x15')]);}logger[_0x7678('0x13')]('VtigerConfiguration,\x20%s,\x20%s',_0x2aa8ef,_0x55ecfa[_0x7678('0x13')][_0x7678('0x15')]);return _0x260296(_0x55ecfa[_0x7678('0x13')][_0x7678('0x15')]);}else{logger[_0x7678('0xd')](_0x7678('0xe'),_0x2aa8ef,_0x7678('0xf'));_0x260296(_0x55ecfa[_0x7678('0x16')]['message']);}})[_0x7678('0x17')](function(_0x5a2f9d){logger[_0x7678('0x13')](_0x7678('0xe'),_0x2aa8ef,_0x5a2f9d);_0x13db6c(_0x5a2f9d);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 7c8db50..903d53f 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 _0x5745=['./intVtigerField.controller','get','index','isAuthenticated','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x2cf0eb,_0x3ccc19){var _0x115d08=function(_0x410765){while(--_0x410765){_0x2cf0eb['push'](_0x2cf0eb['shift']());}};_0x115d08(++_0x3ccc19);}(_0x5745,0x1ea));var _0x5574=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x5745[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x5574('0x0'));var util=require(_0x5574('0x1'));var path=require(_0x5574('0x2'));var timeout=require(_0x5574('0x3'));var express=require(_0x5574('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5574('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5574('0x6'));router[_0x5574('0x7')]('/',auth['isAuthenticated'](),controller[_0x5574('0x8')]);router[_0x5574('0x7')]('/:id',auth[_0x5574('0x9')](),controller['show']);router['post']('/',auth[_0x5574('0x9')](),controller['create']);router[_0x5574('0xa')](_0x5574('0xb'),auth[_0x5574('0x9')](),controller[_0x5574('0xc')]);router[_0x5574('0xd')](_0x5574('0xb'),auth[_0x5574('0x9')](),controller[_0x5574('0xe')]);module[_0x5574('0xf')]=router; \ No newline at end of file +var _0x520b=['exports','multer','util','path','express','Router','../../config/environment','./intVtigerField.controller','isAuthenticated','index','get','/:id','show','post','put','delete','destroy'];(function(_0xf54b2e,_0x4246a0){var _0x131926=function(_0x34330b){while(--_0x34330b){_0xf54b2e['push'](_0xf54b2e['shift']());}};_0x131926(++_0x4246a0);}(_0x520b,0x9a));var _0xb520=function(_0x59342a,_0x16827b){_0x59342a=_0x59342a-0x0;var _0x17abc9=_0x520b[_0x59342a];return _0x17abc9;};'use strict';var multer=require(_0xb520('0x0'));var util=require(_0xb520('0x1'));var path=require(_0xb520('0x2'));var timeout=require('connect-timeout');var express=require(_0xb520('0x3'));var router=express[_0xb520('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb520('0x5'));var controller=require(_0xb520('0x6'));router['get']('/',auth[_0xb520('0x7')](),controller[_0xb520('0x8')]);router[_0xb520('0x9')](_0xb520('0xa'),auth[_0xb520('0x7')](),controller[_0xb520('0xb')]);router[_0xb520('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb520('0xd')](_0xb520('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xb520('0xe')](_0xb520('0xa'),auth[_0xb520('0x7')](),controller[_0xb520('0xf')]);module[_0xb520('0x10')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 03e15af..a0d4c4d 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 _0x16f1=['customVariable','picklist','STRING','sequelize','exports','ENUM','string','variable'];(function(_0x3bb480,_0x1b6dd7){var _0x2cccd4=function(_0x42a643){while(--_0x42a643){_0x3bb480['push'](_0x3bb480['shift']());}};_0x2cccd4(++_0x1b6dd7);}(_0x16f1,0x163));var _0x116f=function(_0x14bba1,_0x20141d){_0x14bba1=_0x14bba1-0x0;var _0x1ffb0f=_0x16f1[_0x14bba1];return _0x1ffb0f;};'use strict';var Sequelize=require(_0x116f('0x0'));module[_0x116f('0x1')]={'type':{'type':Sequelize[_0x116f('0x2')](_0x116f('0x3'),_0x116f('0x4'),_0x116f('0x5'),'keyValue',_0x116f('0x6')),'defaultValue':_0x116f('0x3')},'content':{'type':Sequelize[_0x116f('0x7')]},'key':{'type':Sequelize[_0x116f('0x7')]},'keyType':{'type':Sequelize[_0x116f('0x2')]('string',_0x116f('0x4'),_0x116f('0x5'))},'keyContent':{'type':Sequelize[_0x116f('0x7')]},'idField':{'type':Sequelize[_0x116f('0x7')]},'nameField':{'type':Sequelize[_0x116f('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb3e1=['ENUM','string','keyValue','picklist','STRING','variable','customVariable','BOOLEAN','sequelize','exports'];(function(_0x4b8509,_0x27b7b0){var _0x1d1edb=function(_0x52a498){while(--_0x52a498){_0x4b8509['push'](_0x4b8509['shift']());}};_0x1d1edb(++_0x27b7b0);}(_0xb3e1,0x116));var _0x1b3e=function(_0x46f1a6,_0xc7a582){_0x46f1a6=_0x46f1a6-0x0;var _0x38429a=_0xb3e1[_0x46f1a6];return _0x38429a;};'use strict';var Sequelize=require(_0x1b3e('0x0'));module[_0x1b3e('0x1')]={'type':{'type':Sequelize[_0x1b3e('0x2')](_0x1b3e('0x3'),'variable','customVariable',_0x1b3e('0x4'),_0x1b3e('0x5')),'defaultValue':_0x1b3e('0x3')},'content':{'type':Sequelize[_0x1b3e('0x6')]},'key':{'type':Sequelize[_0x1b3e('0x6')]},'keyType':{'type':Sequelize[_0x1b3e('0x2')]('string',_0x1b3e('0x7'),_0x1b3e('0x8'))},'keyContent':{'type':Sequelize[_0x1b3e('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x1b3e('0x6')]},'customField':{'type':Sequelize[_0x1b3e('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index ac6b806..4154d5d 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 _0x140a=['stack','name','send','index','map','VtigerField','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','sendStatus'];(function(_0x3de427,_0x51b32f){var _0x12e772=function(_0x5939a3){while(--_0x5939a3){_0x3de427['push'](_0x3de427['shift']());}};_0x12e772(++_0x51b32f);}(_0x140a,0x1b5));var _0xa140=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x140a[_0x42245d];return _0x4b211a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa140('0x0'));var zipdir=require(_0xa140('0x1'));var jsonpatch=require(_0xa140('0x2'));var rp=require(_0xa140('0x3'));var moment=require(_0xa140('0x4'));var BPromise=require(_0xa140('0x5'));var Mustache=require(_0xa140('0x6'));var util=require(_0xa140('0x7'));var path=require(_0xa140('0x8'));var sox=require(_0xa140('0x9'));var csv=require(_0xa140('0xa'));var ejs=require(_0xa140('0xb'));var fs=require('fs');var fs_extra=require(_0xa140('0xc'));var _=require(_0xa140('0xd'));var squel=require(_0xa140('0xe'));var crypto=require('crypto');var jsforce=require(_0xa140('0xf'));var deskjs=require(_0xa140('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa140('0x11'));var Papa=require('papaparse');var Redis=require(_0xa140('0x12'));var authService=require(_0xa140('0x13'));var qs=require(_0xa140('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa140('0x15'));var logger=require(_0xa140('0x16'))(_0xa140('0x17'));var utils=require(_0xa140('0x18'));var config=require(_0xa140('0x19'));var licenseUtil=require(_0xa140('0x1a'));var db=require(_0xa140('0x1b'))['db'];function respondWithStatusCode(_0x365af1,_0x2435ca){_0x2435ca=_0x2435ca||0xcc;return function(_0x2ef54d){if(_0x2ef54d){return _0x365af1['sendStatus'](_0x2435ca);}return _0x365af1['status'](_0x2435ca)[_0xa140('0x1c')]();};}function respondWithResult(_0xca4616,_0x3c41df){_0x3c41df=_0x3c41df||0xc8;return function(_0x319f44){if(_0x319f44){return _0xca4616[_0xa140('0x1d')](_0x3c41df)[_0xa140('0x1e')](_0x319f44);}};}function respondWithFilteredResult(_0x52668e,_0x4a006f){return function(_0x3b41e9){if(_0x3b41e9){var _0xad0d1=typeof _0x4a006f[_0xa140('0x1f')]===_0xa140('0x20')&&typeof _0x4a006f[_0xa140('0x21')]===_0xa140('0x20');var _0x40af43=_0x3b41e9[_0xa140('0x22')];var _0x4cf343=_0xad0d1?0x0:_0x4a006f['offset'];var _0x369cf3=_0xad0d1?_0x3b41e9[_0xa140('0x22')]:_0x4a006f[_0xa140('0x1f')]+_0x4a006f[_0xa140('0x21')];var _0x5e9f4e;if(_0x369cf3>=_0x40af43){_0x369cf3=_0x40af43;_0x5e9f4e=0xc8;}else{_0x5e9f4e=0xce;}_0x52668e[_0xa140('0x1d')](_0x5e9f4e);return _0x52668e[_0xa140('0x23')](_0xa140('0x24'),_0x4cf343+'-'+_0x369cf3+'/'+_0x40af43)[_0xa140('0x1e')](_0x3b41e9);}return null;};}function patchUpdates(_0x4f4642){return function(_0x579a23){try{jsonpatch[_0xa140('0x25')](_0x579a23,_0x4f4642,!![]);}catch(_0xee81e4){return BPromise['reject'](_0xee81e4);}return _0x579a23[_0xa140('0x26')]();};}function saveUpdates(_0x38d41e,_0x19fafb){return function(_0x1c65fb){if(_0x1c65fb){return _0x1c65fb[_0xa140('0x27')](_0x38d41e)[_0xa140('0x28')](function(_0x124465){return _0x124465;});}return null;};}function removeEntity(_0x19cfdb,_0x27f59d){return function(_0x32eb64){if(_0x32eb64){return _0x32eb64[_0xa140('0x29')]()[_0xa140('0x28')](function(){_0x19cfdb[_0xa140('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x343562,_0x5e49c5){return function(_0xa1cfd6){if(!_0xa1cfd6){_0x343562[_0xa140('0x2a')](0x194);}return _0xa1cfd6;};}function handleError(_0x4eaa9c,_0x340f9a){_0x340f9a=_0x340f9a||0x1f4;return function(_0x245380){logger['error'](_0x245380[_0xa140('0x2b')]);if(_0x245380[_0xa140('0x2c')]){delete _0x245380[_0xa140('0x2c')];}_0x4eaa9c[_0xa140('0x1d')](_0x340f9a)[_0xa140('0x2d')](_0x245380);};}exports[_0xa140('0x2e')]=function(_0x14abd2,_0x21bda6){var _0x508bde={},_0x45164c={},_0x313298={'count':0x0,'rows':[]};var _0x4c4974=_[_0xa140('0x2f')](db[_0xa140('0x30')][_0xa140('0x31')],function(_0x22efff){return{'name':_0x22efff[_0xa140('0x32')],'type':_0x22efff[_0xa140('0x33')][_0xa140('0x34')]};});_0x45164c['model']=_[_0xa140('0x2f')](_0x4c4974,_0xa140('0x2c'));_0x45164c[_0xa140('0x35')]=_[_0xa140('0x36')](_0x14abd2[_0xa140('0x35')]);_0x45164c['filters']=_[_0xa140('0x37')](_0x45164c[_0xa140('0x38')],_0x45164c['query']);_0x508bde['attributes']=_[_0xa140('0x37')](_0x45164c['model'],qs[_0xa140('0x39')](_0x14abd2[_0xa140('0x35')][_0xa140('0x39')]));_0x508bde['attributes']=_0x508bde[_0xa140('0x3a')][_0xa140('0x3b')]?_0x508bde[_0xa140('0x3a')]:_0x45164c['model'];if(!_0x14abd2['query'][_0xa140('0x3c')](_0xa140('0x3d'))){_0x508bde[_0xa140('0x21')]=qs[_0xa140('0x21')](_0x14abd2[_0xa140('0x35')]['limit']);_0x508bde[_0xa140('0x1f')]=qs[_0xa140('0x1f')](_0x14abd2['query'][_0xa140('0x1f')]);}_0x508bde['order']=qs[_0xa140('0x3e')](_0x14abd2['query']['sort']);_0x508bde[_0xa140('0x3f')]=qs[_0xa140('0x40')](_[_0xa140('0x41')](_0x14abd2[_0xa140('0x35')],_0x45164c[_0xa140('0x40')]),_0x4c4974);if(_0x14abd2['query'][_0xa140('0x42')]){_0x508bde[_0xa140('0x3f')]=_[_0xa140('0x43')](_0x508bde[_0xa140('0x3f')],{'$or':_[_0xa140('0x2f')](_0x4c4974,function(_0x2237c9){if(_0x2237c9['type']!==_0xa140('0x44')){var _0x16aef6={};_0x16aef6[_0x2237c9[_0xa140('0x2c')]]={'$like':'%'+_0x14abd2[_0xa140('0x35')][_0xa140('0x42')]+'%'};return _0x16aef6;}})});}_0x508bde=_[_0xa140('0x43')]({},_0x508bde,_0x14abd2[_0xa140('0x45')]);var _0x315089={'where':_0x508bde['where']};return db['VtigerField'][_0xa140('0x22')](_0x315089)[_0xa140('0x28')](function(_0x3315bd){_0x313298[_0xa140('0x22')]=_0x3315bd;if(_0x14abd2['query'][_0xa140('0x46')]){_0x508bde[_0xa140('0x47')]=[{'all':!![]}];}return db['VtigerField'][_0xa140('0x48')](_0x508bde);})['then'](function(_0x600649){_0x313298[_0xa140('0x49')]=_0x600649;return _0x313298;})[_0xa140('0x28')](respondWithFilteredResult(_0x21bda6,_0x508bde))[_0xa140('0x4a')](handleError(_0x21bda6,null));};exports[_0xa140('0x4b')]=function(_0x4d1f45,_0x4ad964){var _0x2dea96={'raw':!![],'where':{'id':_0x4d1f45[_0xa140('0x4c')]['id']}},_0x367834={};_0x367834['model']=_[_0xa140('0x36')](db[_0xa140('0x30')]['rawAttributes']);_0x367834[_0xa140('0x35')]=_[_0xa140('0x36')](_0x4d1f45[_0xa140('0x35')]);_0x367834[_0xa140('0x40')]=_['intersection'](_0x367834['model'],_0x367834[_0xa140('0x35')]);_0x2dea96[_0xa140('0x3a')]=_[_0xa140('0x37')](_0x367834[_0xa140('0x38')],qs[_0xa140('0x39')](_0x4d1f45[_0xa140('0x35')][_0xa140('0x39')]));_0x2dea96['attributes']=_0x2dea96[_0xa140('0x3a')][_0xa140('0x3b')]?_0x2dea96[_0xa140('0x3a')]:_0x367834['model'];if(_0x4d1f45[_0xa140('0x35')][_0xa140('0x46')]){_0x2dea96['include']=[{'all':!![]}];}_0x2dea96=_['merge']({},_0x2dea96,_0x4d1f45[_0xa140('0x45')]);return db[_0xa140('0x30')][_0xa140('0x4d')](_0x2dea96)[_0xa140('0x28')](handleEntityNotFound(_0x4ad964,null))[_0xa140('0x28')](respondWithResult(_0x4ad964,null))[_0xa140('0x4a')](handleError(_0x4ad964,null));};exports['create']=function(_0x280e2e,_0x40ea8a){return db[_0xa140('0x30')][_0xa140('0x4e')](_0x280e2e['body'],{})['then'](respondWithResult(_0x40ea8a,0xc9))[_0xa140('0x4a')](handleError(_0x40ea8a,null));};exports[_0xa140('0x27')]=function(_0x3765fc,_0xacfca8){if(_0x3765fc[_0xa140('0x4f')]['id']){delete _0x3765fc[_0xa140('0x4f')]['id'];}return db[_0xa140('0x30')]['find']({'where':{'id':_0x3765fc['params']['id']}})[_0xa140('0x28')](handleEntityNotFound(_0xacfca8,null))['then'](saveUpdates(_0x3765fc[_0xa140('0x4f')],null))[_0xa140('0x28')](respondWithResult(_0xacfca8,null))[_0xa140('0x4a')](handleError(_0xacfca8,null));};exports['destroy']=function(_0x46f80f,_0x32de20){return db[_0xa140('0x30')][_0xa140('0x4d')]({'where':{'id':_0x46f80f['params']['id']}})[_0xa140('0x28')](handleEntityNotFound(_0x32de20,null))[_0xa140('0x28')](removeEntity(_0x32de20,null))[_0xa140('0x4a')](handleError(_0x32de20,null));}; \ No newline at end of file +var _0x7016=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','destroy','error','name','send','index','VtigerField','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','then','catch','show','params','fields','find','create','body','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis'];(function(_0x238f74,_0x15d77f){var _0x31322f=function(_0x1e0860){while(--_0x1e0860){_0x238f74['push'](_0x238f74['shift']());}};_0x31322f(++_0x15d77f);}(_0x7016,0x8f));var _0x6701=function(_0x391a42,_0x34f07f){_0x391a42=_0x391a42-0x0;var _0x268d09=_0x7016[_0x391a42];return _0x268d09;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6701('0x0'));var zipdir=require(_0x6701('0x1'));var jsonpatch=require(_0x6701('0x2'));var rp=require(_0x6701('0x3'));var moment=require(_0x6701('0x4'));var BPromise=require(_0x6701('0x5'));var Mustache=require('mustache');var util=require(_0x6701('0x6'));var path=require(_0x6701('0x7'));var sox=require(_0x6701('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6701('0x9'));var _=require(_0x6701('0xa'));var squel=require(_0x6701('0xb'));var crypto=require(_0x6701('0xc'));var jsforce=require(_0x6701('0xd'));var deskjs=require(_0x6701('0xe'));var toCsv=require(_0x6701('0xf'));var querystring=require(_0x6701('0x10'));var Papa=require(_0x6701('0x11'));var Redis=require(_0x6701('0x12'));var authService=require(_0x6701('0x13'));var qs=require(_0x6701('0x14'));var as=require(_0x6701('0x15'));var hardwareService=require(_0x6701('0x16'));var logger=require(_0x6701('0x17'))(_0x6701('0x18'));var utils=require(_0x6701('0x19'));var config=require(_0x6701('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x6701('0x1b'))['db'];function respondWithStatusCode(_0x15d657,_0x4afac7){_0x4afac7=_0x4afac7||0xcc;return function(_0x4975e5){if(_0x4975e5){return _0x15d657[_0x6701('0x1c')](_0x4afac7);}return _0x15d657[_0x6701('0x1d')](_0x4afac7)[_0x6701('0x1e')]();};}function respondWithResult(_0x3378c2,_0x351af8){_0x351af8=_0x351af8||0xc8;return function(_0x2f3414){if(_0x2f3414){return _0x3378c2['status'](_0x351af8)[_0x6701('0x1f')](_0x2f3414);}};}function respondWithFilteredResult(_0x41c1a1,_0x54288f){return function(_0x3bf8a9){if(_0x3bf8a9){var _0x59874e=typeof _0x54288f['offset']==='undefined'&&typeof _0x54288f[_0x6701('0x20')]===_0x6701('0x21');var _0x414810=_0x3bf8a9[_0x6701('0x22')];var _0x550d3d=_0x59874e?0x0:_0x54288f[_0x6701('0x23')];var _0x199055=_0x59874e?_0x3bf8a9[_0x6701('0x22')]:_0x54288f[_0x6701('0x23')]+_0x54288f[_0x6701('0x20')];var _0x1a07a2;if(_0x199055>=_0x414810){_0x199055=_0x414810;_0x1a07a2=0xc8;}else{_0x1a07a2=0xce;}_0x41c1a1[_0x6701('0x1d')](_0x1a07a2);return _0x41c1a1[_0x6701('0x24')](_0x6701('0x25'),_0x550d3d+'-'+_0x199055+'/'+_0x414810)[_0x6701('0x1f')](_0x3bf8a9);}return null;};}function patchUpdates(_0x3ee67b){return function(_0x513b9e){try{jsonpatch[_0x6701('0x26')](_0x513b9e,_0x3ee67b,!![]);}catch(_0x41f508){return BPromise[_0x6701('0x27')](_0x41f508);}return _0x513b9e[_0x6701('0x28')]();};}function saveUpdates(_0x3f9bb3,_0x565e90){return function(_0x4cf91e){if(_0x4cf91e){return _0x4cf91e['update'](_0x3f9bb3)['then'](function(_0x496a16){return _0x496a16;});}return null;};}function removeEntity(_0x4a629a,_0x54d151){return function(_0x524eb8){if(_0x524eb8){return _0x524eb8[_0x6701('0x29')]()['then'](function(){_0x4a629a[_0x6701('0x1d')](0xcc)[_0x6701('0x1e')]();});}};}function handleEntityNotFound(_0x43ed5c,_0x2f4901){return function(_0x13a3f1){if(!_0x13a3f1){_0x43ed5c[_0x6701('0x1c')](0x194);}return _0x13a3f1;};}function handleError(_0x55a379,_0x41e67c){_0x41e67c=_0x41e67c||0x1f4;return function(_0x5fba2a){logger[_0x6701('0x2a')](_0x5fba2a['stack']);if(_0x5fba2a[_0x6701('0x2b')]){delete _0x5fba2a['name'];}_0x55a379['status'](_0x41e67c)[_0x6701('0x2c')](_0x5fba2a);};}exports[_0x6701('0x2d')]=function(_0x8bd7e4,_0x4b6389){var _0x482b5f={},_0x30ed55={},_0xda43a7={'count':0x0,'rows':[]};var _0x28c574=_['map'](db[_0x6701('0x2e')][_0x6701('0x2f')],function(_0x4d4b6f){return{'name':_0x4d4b6f[_0x6701('0x30')],'type':_0x4d4b6f[_0x6701('0x31')]['key']};});_0x30ed55[_0x6701('0x32')]=_['map'](_0x28c574,_0x6701('0x2b'));_0x30ed55[_0x6701('0x33')]=_[_0x6701('0x34')](_0x8bd7e4['query']);_0x30ed55[_0x6701('0x35')]=_[_0x6701('0x36')](_0x30ed55[_0x6701('0x32')],_0x30ed55[_0x6701('0x33')]);_0x482b5f[_0x6701('0x37')]=_['intersection'](_0x30ed55[_0x6701('0x32')],qs['fields'](_0x8bd7e4[_0x6701('0x33')]['fields']));_0x482b5f['attributes']=_0x482b5f[_0x6701('0x37')][_0x6701('0x38')]?_0x482b5f[_0x6701('0x37')]:_0x30ed55['model'];if(!_0x8bd7e4[_0x6701('0x33')][_0x6701('0x39')](_0x6701('0x3a'))){_0x482b5f[_0x6701('0x20')]=qs['limit'](_0x8bd7e4[_0x6701('0x33')]['limit']);_0x482b5f[_0x6701('0x23')]=qs[_0x6701('0x23')](_0x8bd7e4[_0x6701('0x33')][_0x6701('0x23')]);}_0x482b5f[_0x6701('0x3b')]=qs[_0x6701('0x3c')](_0x8bd7e4[_0x6701('0x33')][_0x6701('0x3c')]);_0x482b5f['where']=qs[_0x6701('0x35')](_[_0x6701('0x3d')](_0x8bd7e4[_0x6701('0x33')],_0x30ed55[_0x6701('0x35')]),_0x28c574);if(_0x8bd7e4['query'][_0x6701('0x3e')]){_0x482b5f[_0x6701('0x3f')]=_[_0x6701('0x40')](_0x482b5f[_0x6701('0x3f')],{'$or':_[_0x6701('0x41')](_0x28c574,function(_0x29b090){if(_0x29b090[_0x6701('0x31')]!==_0x6701('0x42')){var _0x354072={};_0x354072[_0x29b090['name']]={'$like':'%'+_0x8bd7e4[_0x6701('0x33')][_0x6701('0x3e')]+'%'};return _0x354072;}})});}_0x482b5f=_[_0x6701('0x40')]({},_0x482b5f,_0x8bd7e4[_0x6701('0x43')]);var _0x28b383={'where':_0x482b5f[_0x6701('0x3f')]};return db[_0x6701('0x2e')][_0x6701('0x22')](_0x28b383)['then'](function(_0x27811f){_0xda43a7[_0x6701('0x22')]=_0x27811f;if(_0x8bd7e4[_0x6701('0x33')][_0x6701('0x44')]){_0x482b5f[_0x6701('0x45')]=[{'all':!![]}];}return db['VtigerField'][_0x6701('0x46')](_0x482b5f);})['then'](function(_0x52e968){_0xda43a7[_0x6701('0x47')]=_0x52e968;return _0xda43a7;})[_0x6701('0x48')](respondWithFilteredResult(_0x4b6389,_0x482b5f))[_0x6701('0x49')](handleError(_0x4b6389,null));};exports[_0x6701('0x4a')]=function(_0x361a8d,_0x250bce){var _0x30ef2b={'raw':!![],'where':{'id':_0x361a8d[_0x6701('0x4b')]['id']}},_0x23611f={};_0x23611f[_0x6701('0x32')]=_[_0x6701('0x34')](db[_0x6701('0x2e')][_0x6701('0x2f')]);_0x23611f[_0x6701('0x33')]=_[_0x6701('0x34')](_0x361a8d['query']);_0x23611f['filters']=_[_0x6701('0x36')](_0x23611f[_0x6701('0x32')],_0x23611f['query']);_0x30ef2b['attributes']=_['intersection'](_0x23611f[_0x6701('0x32')],qs[_0x6701('0x4c')](_0x361a8d['query'][_0x6701('0x4c')]));_0x30ef2b[_0x6701('0x37')]=_0x30ef2b['attributes'][_0x6701('0x38')]?_0x30ef2b[_0x6701('0x37')]:_0x23611f[_0x6701('0x32')];if(_0x361a8d[_0x6701('0x33')][_0x6701('0x44')]){_0x30ef2b[_0x6701('0x45')]=[{'all':!![]}];}_0x30ef2b=_[_0x6701('0x40')]({},_0x30ef2b,_0x361a8d[_0x6701('0x43')]);return db[_0x6701('0x2e')][_0x6701('0x4d')](_0x30ef2b)[_0x6701('0x48')](handleEntityNotFound(_0x250bce,null))[_0x6701('0x48')](respondWithResult(_0x250bce,null))['catch'](handleError(_0x250bce,null));};exports[_0x6701('0x4e')]=function(_0x52c344,_0x23bb33){return db['VtigerField'][_0x6701('0x4e')](_0x52c344[_0x6701('0x4f')],{})['then'](respondWithResult(_0x23bb33,0xc9))[_0x6701('0x49')](handleError(_0x23bb33,null));};exports[_0x6701('0x50')]=function(_0x13712a,_0x14ea4a){if(_0x13712a[_0x6701('0x4f')]['id']){delete _0x13712a['body']['id'];}return db['VtigerField'][_0x6701('0x4d')]({'where':{'id':_0x13712a['params']['id']}})['then'](handleEntityNotFound(_0x14ea4a,null))[_0x6701('0x48')](saveUpdates(_0x13712a[_0x6701('0x4f')],null))[_0x6701('0x48')](respondWithResult(_0x14ea4a,null))[_0x6701('0x49')](handleError(_0x14ea4a,null));};exports['destroy']=function(_0x51efa5,_0x2abd82){return db['VtigerField'][_0x6701('0x4d')]({'where':{'id':_0x51efa5['params']['id']}})[_0x6701('0x48')](handleEntityNotFound(_0x2abd82,null))['then'](removeEntity(_0x2abd82,null))['catch'](handleError(_0x2abd82,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 80110d0..2c07471 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 _0x1584=['api','bluebird','request-promise','path','./intVtigerField.attributes','exports','define','int_vtiger_fields','idField','FieldId','../../config/logger'];(function(_0x168d44,_0x3de8ff){var _0x1cbb64=function(_0x3b85dd){while(--_0x3b85dd){_0x168d44['push'](_0x168d44['shift']());}};_0x1cbb64(++_0x3de8ff);}(_0x1584,0x107));var _0x4158=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1584[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4158('0x0'))(_0x4158('0x1'));var moment=require('moment');var BPromise=require(_0x4158('0x2'));var rp=require(_0x4158('0x3'));var fs=require('fs');var path=require(_0x4158('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4158('0x5'));module[_0x4158('0x6')]=function(_0x311478,_0x5588f9){return _0x311478[_0x4158('0x7')]('VtigerField',attributes,{'tableName':_0x4158('0x8'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x4158('0x9'),_0x4158('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe804=['./intVtigerField.attributes','exports','VtigerField','int_vtiger_fields','idField','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x589ecc,_0x3fd115){var _0x9ca265=function(_0x50fb2d){while(--_0x50fb2d){_0x589ecc['push'](_0x589ecc['shift']());}};_0x9ca265(++_0x3fd115);}(_0xe804,0xbb));var _0x4e80=function(_0x3aa1a6,_0xf2742c){_0x3aa1a6=_0x3aa1a6-0x0;var _0x27476b=_0xe804[_0x3aa1a6];return _0x27476b;};'use strict';var _=require(_0x4e80('0x0'));var util=require(_0x4e80('0x1'));var logger=require(_0x4e80('0x2'))(_0x4e80('0x3'));var moment=require('moment');var BPromise=require(_0x4e80('0x4'));var rp=require(_0x4e80('0x5'));var fs=require('fs');var path=require(_0x4e80('0x6'));var rimraf=require(_0x4e80('0x7'));var config=require(_0x4e80('0x8'));var attributes=require(_0x4e80('0x9'));module[_0x4e80('0xa')]=function(_0x5a59dc,_0x353d1f){return _0x5a59dc['define'](_0x4e80('0xb'),attributes,{'tableName':_0x4e80('0xc'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x4e80('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 60cca05..1333339 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 _0x79c6=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VtigerField,\x20%s,\x20%s','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x402dbb,_0x22a80f){var _0x69b4b=function(_0x21ab1b){while(--_0x21ab1b){_0x402dbb['push'](_0x402dbb['shift']());}};_0x69b4b(++_0x22a80f);}(_0x79c6,0x158));var _0x679c=function(_0x525af9,_0x4edd23){_0x525af9=_0x525af9-0x0;var _0x129fbf=_0x79c6[_0x525af9];return _0x129fbf;};'use strict';var _=require(_0x679c('0x0'));var util=require(_0x679c('0x1'));var moment=require(_0x679c('0x2'));var BPromise=require('bluebird');var rs=require(_0x679c('0x3'));var fs=require('fs');var Redis=require(_0x679c('0x4'));var db=require(_0x679c('0x5'))['db'];var utils=require(_0x679c('0x6'));var logger=require(_0x679c('0x7'))(_0x679c('0x8'));var config=require(_0x679c('0x9'));var jayson=require(_0x679c('0xa'));var client=jayson[_0x679c('0xb')][_0x679c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1ec7ef,_0x439845,_0x160788){return new BPromise(function(_0xc42b66,_0x3ae23e){return client[_0x679c('0xd')](_0x1ec7ef,_0x160788)[_0x679c('0xe')](function(_0x5df653){logger[_0x679c('0xf')]('VtigerField,\x20%s,\x20%s',_0x439845,_0x679c('0x10'));logger[_0x679c('0x11')](_0x679c('0x12'),_0x439845,_0x679c('0x10'),JSON[_0x679c('0x13')](_0x5df653));if(_0x5df653[_0x679c('0x14')]){if(_0x5df653[_0x679c('0x14')][_0x679c('0x15')]===0x1f4){logger[_0x679c('0x14')]('VtigerField,\x20%s,\x20%s',_0x439845,_0x5df653['error'][_0x679c('0x16')]);return _0x3ae23e(_0x5df653['error']['message']);}logger['error'](_0x679c('0x17'),_0x439845,_0x5df653[_0x679c('0x14')][_0x679c('0x16')]);return _0xc42b66(_0x5df653[_0x679c('0x14')][_0x679c('0x16')]);}else{logger[_0x679c('0xf')](_0x679c('0x17'),_0x439845,'request\x20sent');_0xc42b66(_0x5df653['result'][_0x679c('0x16')]);}})[_0x679c('0x18')](function(_0x579779){logger['error'](_0x679c('0x17'),_0x439845,_0x579779);_0x3ae23e(_0x579779);});});} \ No newline at end of file +var _0x2288=['then','info','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerField,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','../../config/utils','../../config/logger','rpc','client','http','request'];(function(_0x113b03,_0x2d7356){var _0x34162f=function(_0x13e295){while(--_0x13e295){_0x113b03['push'](_0x113b03['shift']());}};_0x34162f(++_0x2d7356);}(_0x2288,0x1ef));var _0x8228=function(_0x1805e6,_0x21bac6){_0x1805e6=_0x1805e6-0x0;var _0x5c6fef=_0x2288[_0x1805e6];return _0x5c6fef;};'use strict';var _=require(_0x8228('0x0'));var util=require(_0x8228('0x1'));var moment=require('moment');var BPromise=require(_0x8228('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8228('0x3'));var logger=require(_0x8228('0x4'))(_0x8228('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8228('0x6')][_0x8228('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2dd315,_0x2d602f,_0x40230f){return new BPromise(function(_0x48fb53,_0x353b7e){return client[_0x8228('0x8')](_0x2dd315,_0x40230f)[_0x8228('0x9')](function(_0x3ee330){logger[_0x8228('0xa')]('VtigerField,\x20%s,\x20%s',_0x2d602f,_0x8228('0xb'));logger[_0x8228('0xc')](_0x8228('0xd'),_0x2d602f,'request\x20sent',JSON[_0x8228('0xe')](_0x3ee330));if(_0x3ee330[_0x8228('0xf')]){if(_0x3ee330['error'][_0x8228('0x10')]===0x1f4){logger['error'](_0x8228('0x11'),_0x2d602f,_0x3ee330[_0x8228('0xf')][_0x8228('0x12')]);return _0x353b7e(_0x3ee330['error'][_0x8228('0x12')]);}logger['error']('VtigerField,\x20%s,\x20%s',_0x2d602f,_0x3ee330[_0x8228('0xf')]['message']);return _0x48fb53(_0x3ee330[_0x8228('0xf')]['message']);}else{logger['info']('VtigerField,\x20%s,\x20%s',_0x2d602f,_0x8228('0xb'));_0x48fb53(_0x3ee330[_0x8228('0x13')][_0x8228('0x12')]);}})[_0x8228('0x14')](function(_0x4f093d){logger[_0x8228('0xf')]('VtigerField,\x20%s,\x20%s',_0x2d602f,_0x4f093d);_0x353b7e(_0x4f093d);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 4cf4c43..36a8754 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 _0xf1e9=['post','create','/:id/configurations','put','update','delete','destroy','multer','util','path','Router','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields'];(function(_0x1f4e09,_0x1fc591){var _0x10deec=function(_0x5c1fb9){while(--_0x5c1fb9){_0x1f4e09['push'](_0x1f4e09['shift']());}};_0x10deec(++_0x1fc591);}(_0xf1e9,0x1ea));var _0x9f1e=function(_0x589243,_0x19cceb){_0x589243=_0x589243-0x0;var _0x2d3df0=_0xf1e9[_0x589243];return _0x2d3df0;};'use strict';var multer=require(_0x9f1e('0x0'));var util=require(_0x9f1e('0x1'));var path=require(_0x9f1e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9f1e('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9f1e('0x4'));var config=require(_0x9f1e('0x5'));var controller=require(_0x9f1e('0x6'));router[_0x9f1e('0x7')]('/',auth[_0x9f1e('0x8')](),controller[_0x9f1e('0x9')]);router[_0x9f1e('0x7')](_0x9f1e('0xa'),auth['isAuthenticated'](),controller[_0x9f1e('0xb')]);router['get']('/:id/configurations',auth[_0x9f1e('0x8')](),controller[_0x9f1e('0xc')]);router[_0x9f1e('0x7')](_0x9f1e('0xd'),auth[_0x9f1e('0x8')](),controller['getFields']);router[_0x9f1e('0xe')]('/',auth[_0x9f1e('0x8')](),controller[_0x9f1e('0xf')]);router[_0x9f1e('0xe')](_0x9f1e('0x10'),auth[_0x9f1e('0x8')](),controller['addConfiguration']);router[_0x9f1e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x9f1e('0x12')]);router[_0x9f1e('0x13')](_0x9f1e('0xa'),auth[_0x9f1e('0x8')](),controller[_0x9f1e('0x14')]);module['exports']=router; \ No newline at end of file +var _0x6be2=['connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','addConfiguration','put','update','delete','destroy','exports','util','path'];(function(_0x4eff5e,_0x3d83d1){var _0xd3ed57=function(_0x521c4d){while(--_0x521c4d){_0x4eff5e['push'](_0x4eff5e['shift']());}};_0xd3ed57(++_0x3d83d1);}(_0x6be2,0x1cc));var _0x26be=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6be2[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x26be('0x0'));var path=require(_0x26be('0x1'));var timeout=require(_0x26be('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x26be('0x3'));var auth=require(_0x26be('0x4'));var interaction=require(_0x26be('0x5'));var config=require('../../config/environment');var controller=require(_0x26be('0x6'));router[_0x26be('0x7')]('/',auth[_0x26be('0x8')](),controller['index']);router[_0x26be('0x7')](_0x26be('0x9'),auth['isAuthenticated'](),controller[_0x26be('0xa')]);router['get'](_0x26be('0xb'),auth['isAuthenticated'](),controller[_0x26be('0xc')]);router[_0x26be('0x7')](_0x26be('0xd'),auth[_0x26be('0x8')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x26be('0xe')]('/:id/configurations',auth[_0x26be('0x8')](),controller[_0x26be('0xf')]);router[_0x26be('0x10')](_0x26be('0x9'),auth[_0x26be('0x8')](),controller[_0x26be('0x11')]);router[_0x26be('0x12')](_0x26be('0x9'),auth['isAuthenticated'](),controller[_0x26be('0x13')]);module[_0x26be('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 8924c94..e60c7df 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 _0x8374=['newTab','integrationTab','sequelize','exports','STRING','username','remoteUri','ENUM','password','token'];(function(_0x49141d,_0x1f04ad){var _0x118783=function(_0x49875f){while(--_0x49875f){_0x49141d['push'](_0x49141d['shift']());}};_0x118783(++_0x1f04ad);}(_0x8374,0x174));var _0x4837=function(_0x4630a7,_0x238c4c){_0x4630a7=_0x4630a7-0x0;var _0x1bfc56=_0x8374[_0x4630a7];return _0x1bfc56;};'use strict';var Sequelize=require(_0x4837('0x0'));module[_0x4837('0x1')]={'name':{'type':Sequelize[_0x4837('0x2')]},'description':{'type':Sequelize[_0x4837('0x2')]},'username':{'type':Sequelize[_0x4837('0x2')],'unique':_0x4837('0x3')},'password':{'type':Sequelize[_0x4837('0x2')]},'token':{'type':Sequelize[_0x4837('0x2')]},'remoteUri':{'type':Sequelize[_0x4837('0x2')],'unique':_0x4837('0x4')},'authType':{'type':Sequelize[_0x4837('0x5')](_0x4837('0x6'),_0x4837('0x7')),'defaultValue':_0x4837('0x6')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x4837('0x5')]('integrationTab',_0x4837('0x8')),'defaultValue':_0x4837('0x9')}}; \ No newline at end of file +var _0x126e=['token','integrationTab','newTab','exports','STRING','username','remoteUri','ENUM','password'];(function(_0x474853,_0x273b3a){var _0x5104f2=function(_0x187a7a){while(--_0x187a7a){_0x474853['push'](_0x474853['shift']());}};_0x5104f2(++_0x273b3a);}(_0x126e,0x108));var _0xe126=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x126e[_0xb0f7c3];return _0x28ea68;};'use strict';var Sequelize=require('sequelize');module[_0xe126('0x0')]={'name':{'type':Sequelize[_0xe126('0x1')]},'description':{'type':Sequelize[_0xe126('0x1')]},'username':{'type':Sequelize[_0xe126('0x1')],'unique':_0xe126('0x2')},'password':{'type':Sequelize[_0xe126('0x1')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xe126('0x1')],'unique':_0xe126('0x3')},'authType':{'type':Sequelize[_0xe126('0x4')](_0xe126('0x5'),_0xe126('0x6')),'defaultValue':_0xe126('0x5')},'serverUrl':{'type':Sequelize[_0xe126('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe126('0x7'),_0xe126('0x8')),'defaultValue':_0xe126('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 068d24a..c59aed9 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 _0xc788=['query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','catch','create','body','getConfigurations','findOne','ZendeskConfiguration','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','password','token','remoteUri','slice','substring','lastIndexOf','GET','format','authType','headers','Basic\x20%s','%s:%s','toString','base64','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','ticket_fields','includes','title','position','system_field_options','custom_field_options','error','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','stack','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','model','keys'];(function(_0x283d9d,_0x25be24){var _0x549fe1=function(_0xc5ceb6){while(--_0xc5ceb6){_0x283d9d['push'](_0x283d9d['shift']());}};_0x549fe1(++_0x25be24);}(_0xc788,0xc4));var _0x8c78=function(_0xd8face,_0x4ef518){_0xd8face=_0xd8face-0x0;var _0x38d98d=_0xc788[_0xd8face];return _0x38d98d;};'use strict';var emlformat=require(_0x8c78('0x0'));var rimraf=require(_0x8c78('0x1'));var zipdir=require(_0x8c78('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8c78('0x3'));var BPromise=require(_0x8c78('0x4'));var Mustache=require(_0x8c78('0x5'));var util=require(_0x8c78('0x6'));var path=require(_0x8c78('0x7'));var sox=require('sox');var csv=require(_0x8c78('0x8'));var ejs=require(_0x8c78('0x9'));var fs=require('fs');var fs_extra=require(_0x8c78('0xa'));var _=require(_0x8c78('0xb'));var squel=require(_0x8c78('0xc'));var crypto=require('crypto');var jsforce=require(_0x8c78('0xd'));var deskjs=require(_0x8c78('0xe'));var toCsv=require(_0x8c78('0x8'));var querystring=require(_0x8c78('0xf'));var Papa=require(_0x8c78('0x10'));var Redis=require(_0x8c78('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8c78('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8c78('0x13'));var logger=require(_0x8c78('0x14'))('api');var utils=require(_0x8c78('0x15'));var config=require(_0x8c78('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8c78('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x56a802,_0x349dfa){_0x349dfa=_0x349dfa||0xcc;return function(_0x1b1d0e){if(_0x1b1d0e){return _0x56a802[_0x8c78('0x18')](_0x349dfa);}return _0x56a802[_0x8c78('0x19')](_0x349dfa)[_0x8c78('0x1a')]();};}function respondWithResult(_0x3d1306,_0xe5f8ae){_0xe5f8ae=_0xe5f8ae||0xc8;return function(_0x930233){if(_0x930233){return _0x3d1306[_0x8c78('0x19')](_0xe5f8ae)[_0x8c78('0x1b')](_0x930233);}};}function respondWithFilteredResult(_0x4ff4b0,_0x1fa78e){return function(_0x293cfe){if(_0x293cfe){var _0x57ad11=typeof _0x1fa78e[_0x8c78('0x1c')]===_0x8c78('0x1d')&&typeof _0x1fa78e[_0x8c78('0x1e')]===_0x8c78('0x1d');var _0x2a982c=_0x293cfe[_0x8c78('0x1f')];var _0x54eafa=_0x57ad11?0x0:_0x1fa78e['offset'];var _0x339d04=_0x57ad11?_0x293cfe['count']:_0x1fa78e['offset']+_0x1fa78e[_0x8c78('0x1e')];var _0x56c191;if(_0x339d04>=_0x2a982c){_0x339d04=_0x2a982c;_0x56c191=0xc8;}else{_0x56c191=0xce;}_0x4ff4b0[_0x8c78('0x19')](_0x56c191);return _0x4ff4b0[_0x8c78('0x20')]('Content-Range',_0x54eafa+'-'+_0x339d04+'/'+_0x2a982c)[_0x8c78('0x1b')](_0x293cfe);}return null;};}function patchUpdates(_0x5b111b){return function(_0x2dba52){try{jsonpatch[_0x8c78('0x21')](_0x2dba52,_0x5b111b,!![]);}catch(_0x5a254d){return BPromise[_0x8c78('0x22')](_0x5a254d);}return _0x2dba52[_0x8c78('0x23')]();};}function saveUpdates(_0x499603,_0x2bc595){return function(_0x28ed3a){if(_0x28ed3a){return _0x28ed3a[_0x8c78('0x24')](_0x499603)[_0x8c78('0x25')](function(_0x215940){return _0x215940;});}return null;};}function removeEntity(_0x20f483,_0xbfdf6f){return function(_0x1958f1){if(_0x1958f1){return _0x1958f1[_0x8c78('0x26')]()['then'](function(){_0x20f483[_0x8c78('0x19')](0xcc)[_0x8c78('0x1a')]();});}};}function handleEntityNotFound(_0x1d1cef,_0x49cccb){return function(_0x331bfe){if(!_0x331bfe){_0x1d1cef['sendStatus'](0x194);}return _0x331bfe;};}function handleError(_0xe85d05,_0x24f9a7){_0x24f9a7=_0x24f9a7||0x1f4;return function(_0x8d9ff9){logger['error'](_0x8d9ff9[_0x8c78('0x27')]);if(_0x8d9ff9[_0x8c78('0x28')]){delete _0x8d9ff9['name'];}_0xe85d05[_0x8c78('0x19')](_0x24f9a7)[_0x8c78('0x29')](_0x8d9ff9);};}exports[_0x8c78('0x2a')]=function(_0x36e8e5,_0x253776){var _0x2ab5cc={},_0x5ba7d4={},_0x1c3039={'count':0x0,'rows':[]};var _0x51add6=_[_0x8c78('0x2b')](db[_0x8c78('0x2c')][_0x8c78('0x2d')],function(_0x4e764f){return{'name':_0x4e764f[_0x8c78('0x2e')],'type':_0x4e764f[_0x8c78('0x2f')]['key']};});_0x5ba7d4[_0x8c78('0x30')]=_[_0x8c78('0x2b')](_0x51add6,_0x8c78('0x28'));_0x5ba7d4['query']=_[_0x8c78('0x31')](_0x36e8e5[_0x8c78('0x32')]);_0x5ba7d4[_0x8c78('0x33')]=_['intersection'](_0x5ba7d4[_0x8c78('0x30')],_0x5ba7d4[_0x8c78('0x32')]);_0x2ab5cc['attributes']=_[_0x8c78('0x34')](_0x5ba7d4[_0x8c78('0x30')],qs[_0x8c78('0x35')](_0x36e8e5[_0x8c78('0x32')][_0x8c78('0x35')]));_0x2ab5cc[_0x8c78('0x36')]=_0x2ab5cc[_0x8c78('0x36')][_0x8c78('0x37')]?_0x2ab5cc[_0x8c78('0x36')]:_0x5ba7d4[_0x8c78('0x30')];if(!_0x36e8e5['query'][_0x8c78('0x38')](_0x8c78('0x39'))){_0x2ab5cc[_0x8c78('0x1e')]=qs[_0x8c78('0x1e')](_0x36e8e5[_0x8c78('0x32')]['limit']);_0x2ab5cc[_0x8c78('0x1c')]=qs[_0x8c78('0x1c')](_0x36e8e5[_0x8c78('0x32')]['offset']);}_0x2ab5cc[_0x8c78('0x3a')]=qs[_0x8c78('0x3b')](_0x36e8e5['query'][_0x8c78('0x3b')]);_0x2ab5cc['where']=qs[_0x8c78('0x33')](_[_0x8c78('0x3c')](_0x36e8e5[_0x8c78('0x32')],_0x5ba7d4[_0x8c78('0x33')]),_0x51add6);if(_0x36e8e5['query'][_0x8c78('0x3d')]){_0x2ab5cc['where']=_[_0x8c78('0x3e')](_0x2ab5cc[_0x8c78('0x3f')],{'$or':_[_0x8c78('0x2b')](_0x51add6,function(_0x5ae2aa){if(_0x5ae2aa['type']!==_0x8c78('0x40')){var _0x25d143={};_0x25d143[_0x5ae2aa[_0x8c78('0x28')]]={'$like':'%'+_0x36e8e5[_0x8c78('0x32')][_0x8c78('0x3d')]+'%'};return _0x25d143;}})});}_0x2ab5cc=_[_0x8c78('0x3e')]({},_0x2ab5cc,_0x36e8e5[_0x8c78('0x41')]);var _0x314679={'where':_0x2ab5cc[_0x8c78('0x3f')]};return db[_0x8c78('0x2c')][_0x8c78('0x1f')](_0x314679)[_0x8c78('0x25')](function(_0x234d0e){_0x1c3039['count']=_0x234d0e;if(_0x36e8e5[_0x8c78('0x32')][_0x8c78('0x42')]){_0x2ab5cc['include']=[{'all':!![]}];}return db['ZendeskAccount'][_0x8c78('0x43')](_0x2ab5cc);})[_0x8c78('0x25')](function(_0x5c9af3){_0x1c3039[_0x8c78('0x44')]=_0x5c9af3;return _0x1c3039;})[_0x8c78('0x25')](respondWithFilteredResult(_0x253776,_0x2ab5cc))['catch'](handleError(_0x253776,null));};exports[_0x8c78('0x45')]=function(_0x27603f,_0x57e2c7){var _0x10d521={'raw':![],'where':{'id':_0x27603f[_0x8c78('0x46')]['id']}},_0x24a8ea={};_0x24a8ea[_0x8c78('0x30')]=_[_0x8c78('0x31')](db['ZendeskAccount']['rawAttributes']);_0x24a8ea[_0x8c78('0x32')]=_[_0x8c78('0x31')](_0x27603f[_0x8c78('0x32')]);_0x24a8ea[_0x8c78('0x33')]=_[_0x8c78('0x34')](_0x24a8ea[_0x8c78('0x30')],_0x24a8ea[_0x8c78('0x32')]);_0x10d521[_0x8c78('0x36')]=_[_0x8c78('0x34')](_0x24a8ea[_0x8c78('0x30')],qs[_0x8c78('0x35')](_0x27603f['query'][_0x8c78('0x35')]));_0x10d521[_0x8c78('0x36')]=_0x10d521[_0x8c78('0x36')][_0x8c78('0x37')]?_0x10d521[_0x8c78('0x36')]:_0x24a8ea['model'];if(_0x27603f[_0x8c78('0x32')][_0x8c78('0x42')]){_0x10d521[_0x8c78('0x47')]=[{'all':!![]}];}_0x10d521=_[_0x8c78('0x3e')]({},_0x10d521,_0x27603f[_0x8c78('0x41')]);return db['ZendeskAccount'][_0x8c78('0x48')](_0x10d521)['then'](handleEntityNotFound(_0x57e2c7,null))['then'](respondWithResult(_0x57e2c7,null))[_0x8c78('0x49')](handleError(_0x57e2c7,null));};exports[_0x8c78('0x4a')]=function(_0x61e20,_0x5a5f3b){return db[_0x8c78('0x2c')][_0x8c78('0x4a')](_0x61e20[_0x8c78('0x4b')],{})[_0x8c78('0x25')](respondWithResult(_0x5a5f3b,0xc9))[_0x8c78('0x49')](handleError(_0x5a5f3b,null));};exports[_0x8c78('0x24')]=function(_0x26103c,_0x1f5cdb){if(_0x26103c[_0x8c78('0x4b')]['id']){delete _0x26103c['body']['id'];}return db[_0x8c78('0x2c')][_0x8c78('0x48')]({'where':{'id':_0x26103c[_0x8c78('0x46')]['id']}})[_0x8c78('0x25')](handleEntityNotFound(_0x1f5cdb,null))['then'](saveUpdates(_0x26103c[_0x8c78('0x4b')],null))[_0x8c78('0x25')](respondWithResult(_0x1f5cdb,null))[_0x8c78('0x49')](handleError(_0x1f5cdb,null));};exports[_0x8c78('0x26')]=function(_0x53e75c,_0x336b95){return db[_0x8c78('0x2c')][_0x8c78('0x48')]({'where':{'id':_0x53e75c['params']['id']}})[_0x8c78('0x25')](handleEntityNotFound(_0x336b95,null))['then'](removeEntity(_0x336b95,null))[_0x8c78('0x49')](handleError(_0x336b95,null));};exports[_0x8c78('0x4c')]=function(_0x402faa,_0xa87aba,_0x349b87){var _0x462b89={};var _0xf68e0={};var _0x38fec1;var _0x19d807;return db[_0x8c78('0x2c')][_0x8c78('0x4d')]({'where':{'id':_0x402faa[_0x8c78('0x46')]['id']}})[_0x8c78('0x25')](handleEntityNotFound(_0xa87aba,null))[_0x8c78('0x25')](function(_0x54b40d){if(_0x54b40d){_0x38fec1=_0x54b40d;_0xf68e0[_0x8c78('0x30')]=_[_0x8c78('0x31')](db[_0x8c78('0x4e')][_0x8c78('0x2d')]);_0xf68e0['query']=_[_0x8c78('0x31')](_0x402faa[_0x8c78('0x32')]);_0xf68e0[_0x8c78('0x33')]=_[_0x8c78('0x34')](_0xf68e0[_0x8c78('0x30')],_0xf68e0[_0x8c78('0x32')]);_0x462b89['attributes']=_[_0x8c78('0x34')](_0xf68e0[_0x8c78('0x30')],qs['fields'](_0x402faa[_0x8c78('0x32')]['fields']));_0x462b89[_0x8c78('0x36')]=_0x462b89[_0x8c78('0x36')][_0x8c78('0x37')]?_0x462b89[_0x8c78('0x36')]:_0xf68e0[_0x8c78('0x30')];_0x462b89[_0x8c78('0x3a')]=qs[_0x8c78('0x3b')](_0x402faa['query'][_0x8c78('0x3b')]);_0x462b89[_0x8c78('0x3f')]=qs['filters'](_[_0x8c78('0x3c')](_0x402faa[_0x8c78('0x32')],_0xf68e0['filters']));if(_0x402faa[_0x8c78('0x32')][_0x8c78('0x3d')]){_0x462b89[_0x8c78('0x3f')]=_[_0x8c78('0x3e')](_0x462b89[_0x8c78('0x3f')],{'$or':_[_0x8c78('0x2b')](_0x462b89[_0x8c78('0x36')],function(_0x445630){var _0x20a0d9={};_0x20a0d9[_0x445630]={'$like':'%'+_0x402faa[_0x8c78('0x32')][_0x8c78('0x3d')]+'%'};return _0x20a0d9;})});}_0x462b89=_[_0x8c78('0x3e')]({},_0x462b89,_0x402faa[_0x8c78('0x41')]);return _0x38fec1[_0x8c78('0x4c')](_0x462b89);}})['then'](function(_0x3897ea){if(_0x3897ea){_0x19d807=_0x3897ea['length'];if(!_0x402faa[_0x8c78('0x32')]['hasOwnProperty']('nolimit')){_0x462b89['limit']=qs[_0x8c78('0x1e')](_0x402faa['query']['limit']);_0x462b89['offset']=qs[_0x8c78('0x1c')](_0x402faa[_0x8c78('0x32')][_0x8c78('0x1c')]);}return _0x38fec1[_0x8c78('0x4c')](_0x462b89);}})['then'](function(_0x333272){if(_0x333272){return _0x333272?{'count':_0x19d807,'rows':_0x333272}:null;}})[_0x8c78('0x25')](respondWithResult(_0xa87aba,null))[_0x8c78('0x49')](handleError(_0xa87aba,null));};exports[_0x8c78('0x4f')]=function(_0x334d0a,_0x3c3332,_0x3990c2){if(_0x334d0a[_0x8c78('0x4b')]['id']){delete _0x334d0a[_0x8c78('0x4b')]['id'];}return db[_0x8c78('0x2c')][_0x8c78('0x4d')]({'where':{'id':_0x334d0a[_0x8c78('0x46')]['id']}})[_0x8c78('0x25')](handleEntityNotFound(_0x3c3332,null))[_0x8c78('0x25')](function(_0x4bdb7e){if(_0x4bdb7e){_0x334d0a[_0x8c78('0x4b')]['AccountId']=_0x4bdb7e['id'];_0x334d0a[_0x8c78('0x4b')][_0x8c78('0x50')]=integrations[_0x8c78('0x51')](_0x334d0a['body'][_0x8c78('0x52')],_0x334d0a[_0x8c78('0x4b')][_0x8c78('0x2f')]);_0x334d0a['body'][_0x8c78('0x53')]=integrations[_0x8c78('0x54')](_0x334d0a['body'][_0x8c78('0x52')],_0x334d0a[_0x8c78('0x4b')][_0x8c78('0x2f')]);return db['ZendeskConfiguration'][_0x8c78('0x4a')](_0x334d0a[_0x8c78('0x4b')],{'include':[{'model':db[_0x8c78('0x55')],'as':_0x8c78('0x50')},{'model':db[_0x8c78('0x55')],'as':_0x8c78('0x53')}]});}return null;})[_0x8c78('0x25')](respondWithResult(_0x3c3332,null))[_0x8c78('0x49')](handleError(_0x3c3332,null));};exports[_0x8c78('0x56')]=function(_0x5646ff,_0x1f2b8f,_0x21b400){var _0x3c6886='';return db[_0x8c78('0x2c')][_0x8c78('0x4d')]({'where':{'id':_0x5646ff[_0x8c78('0x46')]['id']},'attributes':['id',_0x8c78('0x57'),_0x8c78('0x58'),_0x8c78('0x59'),'authType',_0x8c78('0x5a')]})[_0x8c78('0x25')](handleEntityNotFound(_0x1f2b8f,null))['then'](function(_0x5e6a23){if(_0x5e6a23){_0x3c6886=_0x5e6a23[_0x8c78('0x5a')];var _0x4dbb47=_0x3c6886[_0x8c78('0x5b')](-0x1);if(_0x4dbb47==='/'){_0x3c6886=_0x3c6886[_0x8c78('0x5c')](0x0,_0x3c6886[_0x8c78('0x5d')](_0x4dbb47));}var _0x476835={'method':_0x8c78('0x5e'),'uri':util[_0x8c78('0x5f')]('%s/%s',_0x3c6886,'ticket_fields'),'json':!![]};switch(_0x5e6a23[_0x8c78('0x60')]){case _0x8c78('0x58'):_0x476835[_0x8c78('0x61')]={'Authorization':util[_0x8c78('0x5f')](_0x8c78('0x62'),new Buffer(util['format'](_0x8c78('0x63'),_0x5e6a23[_0x8c78('0x57')],_0x5e6a23[_0x8c78('0x58')]))[_0x8c78('0x64')](_0x8c78('0x65')))};break;case _0x8c78('0x59'):_0x476835['headers']={'Authorization':util[_0x8c78('0x5f')](_0x8c78('0x62'),new Buffer(util['format'](_0x8c78('0x66'),_0x5e6a23[_0x8c78('0x57')],_0x5e6a23[_0x8c78('0x59')]))[_0x8c78('0x64')](_0x8c78('0x65')))};break;default:throw new db[(_0x8c78('0x67'))][(_0x8c78('0x68'))](_0x8c78('0x69'));}return rp(_0x476835);}})[_0x8c78('0x25')](function(_0x402cff){if(_0x402cff){var _0x280a8b=[_0x8c78('0x6a'),_0x8c78('0x6b'),_0x8c78('0x6c'),_0x8c78('0x6d')];_[_0x8c78('0x6e')](_0x402cff[_0x8c78('0x6f')],function(_0x4c6cc5){return _0x280a8b[_0x8c78('0x70')](_0x4c6cc5['type']);});return{'count':_0x402cff['ticket_fields'][_0x8c78('0x37')],'rows':_[_0x8c78('0x2b')](_0x402cff[_0x8c78('0x6f')],function(_0x3b3c51){return{'id':_0x3b3c51['id'],'name':_0x3b3c51['position']>0x7?_0x3b3c51[_0x8c78('0x71')]:_0x3b3c51[_0x8c78('0x2f')],'custom':_0x3b3c51[_0x8c78('0x72')]>0x7?!![]:![],'options':_0x3b3c51['system_field_options']?_0x3b3c51[_0x8c78('0x73')]:_0x3b3c51[_0x8c78('0x74')]?_0x3b3c51[_0x8c78('0x74')]:[]};})};}})[_0x8c78('0x25')](respondWithResult(_0x1f2b8f,null))['catch'](function(_0xfff9a5){var _0x837c68=_0x5646ff['query']['test']?0x1f4:_0xfff9a5['statusCode']||0x1f4;logger[_0x8c78('0x75')](_0x8c78('0x76'),_0x8c78('0x56'),_0x837c68,JSON[_0x8c78('0x77')](_0xfff9a5));delete _0xfff9a5['name'];if(_0x837c68===0x191){_0x837c68=0x190;}_0x1f2b8f[_0x8c78('0x19')](_0x837c68)['send'](_0x5646ff[_0x8c78('0x32')][_0x8c78('0x78')]?{'message':_0x8c78('0x79'),'statusCode':_0xfff9a5[_0x8c78('0x7a')]}:_0xfff9a5);});}; \ No newline at end of file +var _0xa571=['lastIndexOf','GET','format','%s/%s','ticket_fields','headers','%s:%s','password','toString','base64','Basic\x20%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','options','ZendeskAccount','includeAll','include','findAll','rows','catch','show','params','find','create','body','findOne','ZendeskConfiguration','order','merge','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','getDescriptions','channel','ZendeskField','Descriptions','getFields','username','token','authType','remoteUri','slice','substring'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0xa571,0x107));var _0x1a57=function(_0xb15182,_0x48d8fb){_0xb15182=_0xb15182-0x0;var _0x4a8749=_0xa571[_0xb15182];return _0x4a8749;};'use strict';var emlformat=require(_0x1a57('0x0'));var rimraf=require(_0x1a57('0x1'));var zipdir=require(_0x1a57('0x2'));var jsonpatch=require(_0x1a57('0x3'));var rp=require('request-promise');var moment=require(_0x1a57('0x4'));var BPromise=require(_0x1a57('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1a57('0x6'));var sox=require('sox');var csv=require(_0x1a57('0x7'));var ejs=require(_0x1a57('0x8'));var fs=require('fs');var fs_extra=require(_0x1a57('0x9'));var _=require(_0x1a57('0xa'));var squel=require(_0x1a57('0xb'));var crypto=require(_0x1a57('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1a57('0xd'));var toCsv=require(_0x1a57('0x7'));var querystring=require(_0x1a57('0xe'));var Papa=require('papaparse');var Redis=require(_0x1a57('0xf'));var authService=require(_0x1a57('0x10'));var qs=require(_0x1a57('0x11'));var as=require(_0x1a57('0x12'));var hardwareService=require(_0x1a57('0x13'));var logger=require(_0x1a57('0x14'))(_0x1a57('0x15'));var utils=require(_0x1a57('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1a57('0x17'))['db'];var integrations=require(_0x1a57('0x18'));function respondWithStatusCode(_0x202d9a,_0x5ae643){_0x5ae643=_0x5ae643||0xcc;return function(_0x3de36a){if(_0x3de36a){return _0x202d9a[_0x1a57('0x19')](_0x5ae643);}return _0x202d9a['status'](_0x5ae643)[_0x1a57('0x1a')]();};}function respondWithResult(_0x587422,_0xd08107){_0xd08107=_0xd08107||0xc8;return function(_0x17434c){if(_0x17434c){return _0x587422[_0x1a57('0x1b')](_0xd08107)[_0x1a57('0x1c')](_0x17434c);}};}function respondWithFilteredResult(_0x5802d6,_0x20f7ad){return function(_0x53c61f){if(_0x53c61f){var _0x49ee05=typeof _0x20f7ad[_0x1a57('0x1d')]===_0x1a57('0x1e')&&typeof _0x20f7ad[_0x1a57('0x1f')]==='undefined';var _0x10793e=_0x53c61f[_0x1a57('0x20')];var _0x80f8c1=_0x49ee05?0x0:_0x20f7ad['offset'];var _0x3daa66=_0x49ee05?_0x53c61f[_0x1a57('0x20')]:_0x20f7ad[_0x1a57('0x1d')]+_0x20f7ad[_0x1a57('0x1f')];var _0xe936dd;if(_0x3daa66>=_0x10793e){_0x3daa66=_0x10793e;_0xe936dd=0xc8;}else{_0xe936dd=0xce;}_0x5802d6['status'](_0xe936dd);return _0x5802d6['set'](_0x1a57('0x21'),_0x80f8c1+'-'+_0x3daa66+'/'+_0x10793e)[_0x1a57('0x1c')](_0x53c61f);}return null;};}function patchUpdates(_0x211c63){return function(_0x4d3e05){try{jsonpatch['apply'](_0x4d3e05,_0x211c63,!![]);}catch(_0x51e271){return BPromise[_0x1a57('0x22')](_0x51e271);}return _0x4d3e05[_0x1a57('0x23')]();};}function saveUpdates(_0x3f52b9,_0xee133b){return function(_0x277d06){if(_0x277d06){return _0x277d06[_0x1a57('0x24')](_0x3f52b9)[_0x1a57('0x25')](function(_0x2f8b00){return _0x2f8b00;});}return null;};}function removeEntity(_0x183ca3,_0x35d5dc){return function(_0x29e7cd){if(_0x29e7cd){return _0x29e7cd[_0x1a57('0x26')]()[_0x1a57('0x25')](function(){_0x183ca3[_0x1a57('0x1b')](0xcc)[_0x1a57('0x1a')]();});}};}function handleEntityNotFound(_0x182649,_0x25c1e9){return function(_0x267302){if(!_0x267302){_0x182649[_0x1a57('0x19')](0x194);}return _0x267302;};}function handleError(_0xf6ffef,_0x26584b){_0x26584b=_0x26584b||0x1f4;return function(_0x1dd939){logger['error'](_0x1dd939['stack']);if(_0x1dd939[_0x1a57('0x27')]){delete _0x1dd939[_0x1a57('0x27')];}_0xf6ffef['status'](_0x26584b)[_0x1a57('0x28')](_0x1dd939);};}exports['index']=function(_0x2d8738,_0x4a2901){var _0x53bf6e={},_0x8179a4={},_0x274fe6={'count':0x0,'rows':[]};var _0x30527c=_[_0x1a57('0x29')](db['ZendeskAccount'][_0x1a57('0x2a')],function(_0x396832){return{'name':_0x396832[_0x1a57('0x2b')],'type':_0x396832[_0x1a57('0x2c')]['key']};});_0x8179a4[_0x1a57('0x2d')]=_[_0x1a57('0x29')](_0x30527c,_0x1a57('0x27'));_0x8179a4[_0x1a57('0x2e')]=_[_0x1a57('0x2f')](_0x2d8738[_0x1a57('0x2e')]);_0x8179a4[_0x1a57('0x30')]=_[_0x1a57('0x31')](_0x8179a4[_0x1a57('0x2d')],_0x8179a4['query']);_0x53bf6e[_0x1a57('0x32')]=_[_0x1a57('0x31')](_0x8179a4['model'],qs['fields'](_0x2d8738[_0x1a57('0x2e')][_0x1a57('0x33')]));_0x53bf6e[_0x1a57('0x32')]=_0x53bf6e[_0x1a57('0x32')][_0x1a57('0x34')]?_0x53bf6e[_0x1a57('0x32')]:_0x8179a4[_0x1a57('0x2d')];if(!_0x2d8738[_0x1a57('0x2e')][_0x1a57('0x35')](_0x1a57('0x36'))){_0x53bf6e[_0x1a57('0x1f')]=qs[_0x1a57('0x1f')](_0x2d8738[_0x1a57('0x2e')][_0x1a57('0x1f')]);_0x53bf6e[_0x1a57('0x1d')]=qs[_0x1a57('0x1d')](_0x2d8738[_0x1a57('0x2e')][_0x1a57('0x1d')]);}_0x53bf6e['order']=qs[_0x1a57('0x37')](_0x2d8738[_0x1a57('0x2e')][_0x1a57('0x37')]);_0x53bf6e[_0x1a57('0x38')]=qs[_0x1a57('0x30')](_[_0x1a57('0x39')](_0x2d8738[_0x1a57('0x2e')],_0x8179a4[_0x1a57('0x30')]),_0x30527c);if(_0x2d8738[_0x1a57('0x2e')]['filter']){_0x53bf6e['where']=_['merge'](_0x53bf6e['where'],{'$or':_[_0x1a57('0x29')](_0x30527c,function(_0x14d619){if(_0x14d619[_0x1a57('0x2c')]!=='VIRTUAL'){var _0x364797={};_0x364797[_0x14d619[_0x1a57('0x27')]]={'$like':'%'+_0x2d8738[_0x1a57('0x2e')][_0x1a57('0x3a')]+'%'};return _0x364797;}})});}_0x53bf6e=_['merge']({},_0x53bf6e,_0x2d8738[_0x1a57('0x3b')]);var _0x5e79f0={'where':_0x53bf6e[_0x1a57('0x38')]};return db[_0x1a57('0x3c')][_0x1a57('0x20')](_0x5e79f0)['then'](function(_0x1848cc){_0x274fe6[_0x1a57('0x20')]=_0x1848cc;if(_0x2d8738[_0x1a57('0x2e')][_0x1a57('0x3d')]){_0x53bf6e[_0x1a57('0x3e')]=[{'all':!![]}];}return db['ZendeskAccount'][_0x1a57('0x3f')](_0x53bf6e);})['then'](function(_0x4ba6b3){_0x274fe6[_0x1a57('0x40')]=_0x4ba6b3;return _0x274fe6;})['then'](respondWithFilteredResult(_0x4a2901,_0x53bf6e))[_0x1a57('0x41')](handleError(_0x4a2901,null));};exports[_0x1a57('0x42')]=function(_0x3fbae1,_0x59abb1){var _0x188a50={'raw':![],'where':{'id':_0x3fbae1[_0x1a57('0x43')]['id']}},_0x3c7ea8={};_0x3c7ea8[_0x1a57('0x2d')]=_['keys'](db[_0x1a57('0x3c')][_0x1a57('0x2a')]);_0x3c7ea8['query']=_[_0x1a57('0x2f')](_0x3fbae1['query']);_0x3c7ea8['filters']=_[_0x1a57('0x31')](_0x3c7ea8[_0x1a57('0x2d')],_0x3c7ea8[_0x1a57('0x2e')]);_0x188a50[_0x1a57('0x32')]=_['intersection'](_0x3c7ea8[_0x1a57('0x2d')],qs[_0x1a57('0x33')](_0x3fbae1[_0x1a57('0x2e')][_0x1a57('0x33')]));_0x188a50[_0x1a57('0x32')]=_0x188a50['attributes'][_0x1a57('0x34')]?_0x188a50[_0x1a57('0x32')]:_0x3c7ea8[_0x1a57('0x2d')];if(_0x3fbae1[_0x1a57('0x2e')]['includeAll']){_0x188a50[_0x1a57('0x3e')]=[{'all':!![]}];}_0x188a50=_['merge']({},_0x188a50,_0x3fbae1[_0x1a57('0x3b')]);return db[_0x1a57('0x3c')][_0x1a57('0x44')](_0x188a50)[_0x1a57('0x25')](handleEntityNotFound(_0x59abb1,null))[_0x1a57('0x25')](respondWithResult(_0x59abb1,null))[_0x1a57('0x41')](handleError(_0x59abb1,null));};exports[_0x1a57('0x45')]=function(_0x401285,_0x29fe1f){return db[_0x1a57('0x3c')][_0x1a57('0x45')](_0x401285[_0x1a57('0x46')],{})[_0x1a57('0x25')](respondWithResult(_0x29fe1f,0xc9))['catch'](handleError(_0x29fe1f,null));};exports[_0x1a57('0x24')]=function(_0x480aff,_0x3bf103){if(_0x480aff[_0x1a57('0x46')]['id']){delete _0x480aff[_0x1a57('0x46')]['id'];}return db[_0x1a57('0x3c')][_0x1a57('0x44')]({'where':{'id':_0x480aff[_0x1a57('0x43')]['id']}})[_0x1a57('0x25')](handleEntityNotFound(_0x3bf103,null))[_0x1a57('0x25')](saveUpdates(_0x480aff[_0x1a57('0x46')],null))['then'](respondWithResult(_0x3bf103,null))[_0x1a57('0x41')](handleError(_0x3bf103,null));};exports[_0x1a57('0x26')]=function(_0x51651d,_0x15f1f5){return db[_0x1a57('0x3c')]['find']({'where':{'id':_0x51651d[_0x1a57('0x43')]['id']}})[_0x1a57('0x25')](handleEntityNotFound(_0x15f1f5,null))['then'](removeEntity(_0x15f1f5,null))['catch'](handleError(_0x15f1f5,null));};exports['getConfigurations']=function(_0x2c1bac,_0x41465b,_0x509c4f){var _0x1ec79c={};var _0x18267c={};var _0x572202;var _0x5e510e;return db['ZendeskAccount'][_0x1a57('0x47')]({'where':{'id':_0x2c1bac[_0x1a57('0x43')]['id']}})[_0x1a57('0x25')](handleEntityNotFound(_0x41465b,null))[_0x1a57('0x25')](function(_0x28738e){if(_0x28738e){_0x572202=_0x28738e;_0x18267c[_0x1a57('0x2d')]=_[_0x1a57('0x2f')](db[_0x1a57('0x48')]['rawAttributes']);_0x18267c['query']=_['keys'](_0x2c1bac['query']);_0x18267c['filters']=_[_0x1a57('0x31')](_0x18267c[_0x1a57('0x2d')],_0x18267c[_0x1a57('0x2e')]);_0x1ec79c[_0x1a57('0x32')]=_[_0x1a57('0x31')](_0x18267c[_0x1a57('0x2d')],qs[_0x1a57('0x33')](_0x2c1bac[_0x1a57('0x2e')]['fields']));_0x1ec79c['attributes']=_0x1ec79c['attributes'][_0x1a57('0x34')]?_0x1ec79c['attributes']:_0x18267c[_0x1a57('0x2d')];_0x1ec79c[_0x1a57('0x49')]=qs[_0x1a57('0x37')](_0x2c1bac[_0x1a57('0x2e')][_0x1a57('0x37')]);_0x1ec79c[_0x1a57('0x38')]=qs[_0x1a57('0x30')](_['pick'](_0x2c1bac['query'],_0x18267c['filters']));if(_0x2c1bac[_0x1a57('0x2e')][_0x1a57('0x3a')]){_0x1ec79c[_0x1a57('0x38')]=_[_0x1a57('0x4a')](_0x1ec79c[_0x1a57('0x38')],{'$or':_[_0x1a57('0x29')](_0x1ec79c[_0x1a57('0x32')],function(_0x4ab246){var _0x5b691c={};_0x5b691c[_0x4ab246]={'$like':'%'+_0x2c1bac[_0x1a57('0x2e')][_0x1a57('0x3a')]+'%'};return _0x5b691c;})});}_0x1ec79c=_[_0x1a57('0x4a')]({},_0x1ec79c,_0x2c1bac[_0x1a57('0x3b')]);return _0x572202[_0x1a57('0x4b')](_0x1ec79c);}})[_0x1a57('0x25')](function(_0x59a731){if(_0x59a731){_0x5e510e=_0x59a731['length'];if(!_0x2c1bac[_0x1a57('0x2e')][_0x1a57('0x35')]('nolimit')){_0x1ec79c['limit']=qs[_0x1a57('0x1f')](_0x2c1bac[_0x1a57('0x2e')][_0x1a57('0x1f')]);_0x1ec79c[_0x1a57('0x1d')]=qs[_0x1a57('0x1d')](_0x2c1bac[_0x1a57('0x2e')][_0x1a57('0x1d')]);}return _0x572202['getConfigurations'](_0x1ec79c);}})['then'](function(_0x2fbf49){if(_0x2fbf49){return _0x2fbf49?{'count':_0x5e510e,'rows':_0x2fbf49}:null;}})[_0x1a57('0x25')](respondWithResult(_0x41465b,null))[_0x1a57('0x41')](handleError(_0x41465b,null));};exports[_0x1a57('0x4c')]=function(_0x5d92dc,_0x33092d,_0x28354c){if(_0x5d92dc[_0x1a57('0x46')]['id']){delete _0x5d92dc[_0x1a57('0x46')]['id'];}return db[_0x1a57('0x3c')]['findOne']({'where':{'id':_0x5d92dc['params']['id']}})['then'](handleEntityNotFound(_0x33092d,null))[_0x1a57('0x25')](function(_0x223ba5){if(_0x223ba5){_0x5d92dc[_0x1a57('0x46')][_0x1a57('0x4d')]=_0x223ba5['id'];_0x5d92dc[_0x1a57('0x46')][_0x1a57('0x4e')]=integrations[_0x1a57('0x4f')](_0x5d92dc[_0x1a57('0x46')]['channel'],_0x5d92dc[_0x1a57('0x46')][_0x1a57('0x2c')]);_0x5d92dc['body']['Descriptions']=integrations[_0x1a57('0x50')](_0x5d92dc['body'][_0x1a57('0x51')],_0x5d92dc[_0x1a57('0x46')][_0x1a57('0x2c')]);return db[_0x1a57('0x48')][_0x1a57('0x45')](_0x5d92dc[_0x1a57('0x46')],{'include':[{'model':db[_0x1a57('0x52')],'as':_0x1a57('0x4e')},{'model':db['ZendeskField'],'as':_0x1a57('0x53')}]});}return null;})[_0x1a57('0x25')](respondWithResult(_0x33092d,null))['catch'](handleError(_0x33092d,null));};exports[_0x1a57('0x54')]=function(_0x392f49,_0x20b0d5,_0x570674){var _0x5c3eb8='';return db[_0x1a57('0x3c')][_0x1a57('0x47')]({'where':{'id':_0x392f49[_0x1a57('0x43')]['id']},'attributes':['id',_0x1a57('0x55'),'password',_0x1a57('0x56'),_0x1a57('0x57'),_0x1a57('0x58')]})[_0x1a57('0x25')](handleEntityNotFound(_0x20b0d5,null))[_0x1a57('0x25')](function(_0x58d8cc){if(_0x58d8cc){_0x5c3eb8=_0x58d8cc[_0x1a57('0x58')];var _0x393187=_0x5c3eb8[_0x1a57('0x59')](-0x1);if(_0x393187==='/'){_0x5c3eb8=_0x5c3eb8[_0x1a57('0x5a')](0x0,_0x5c3eb8[_0x1a57('0x5b')](_0x393187));}var _0x69f3fb={'method':_0x1a57('0x5c'),'uri':util[_0x1a57('0x5d')](_0x1a57('0x5e'),_0x5c3eb8,_0x1a57('0x5f')),'json':!![]};switch(_0x58d8cc[_0x1a57('0x57')]){case'password':_0x69f3fb[_0x1a57('0x60')]={'Authorization':util[_0x1a57('0x5d')]('Basic\x20%s',new Buffer(util[_0x1a57('0x5d')](_0x1a57('0x61'),_0x58d8cc['username'],_0x58d8cc[_0x1a57('0x62')]))[_0x1a57('0x63')](_0x1a57('0x64')))};break;case _0x1a57('0x56'):_0x69f3fb[_0x1a57('0x60')]={'Authorization':util[_0x1a57('0x5d')](_0x1a57('0x65'),new Buffer(util[_0x1a57('0x5d')]('%s/token:%s',_0x58d8cc[_0x1a57('0x55')],_0x58d8cc[_0x1a57('0x56')]))['toString'](_0x1a57('0x64')))};break;default:throw new db[(_0x1a57('0x66'))][(_0x1a57('0x67'))](_0x1a57('0x68'));}return rp(_0x69f3fb);}})[_0x1a57('0x25')](function(_0xf2b1c5){if(_0xf2b1c5){var _0x220725=[_0x1a57('0x69'),_0x1a57('0x6a'),'group',_0x1a57('0x6b')];_[_0x1a57('0x6c')](_0xf2b1c5[_0x1a57('0x5f')],function(_0x1e4d4e){return _0x220725[_0x1a57('0x6d')](_0x1e4d4e['type']);});return{'count':_0xf2b1c5[_0x1a57('0x5f')][_0x1a57('0x34')],'rows':_[_0x1a57('0x29')](_0xf2b1c5[_0x1a57('0x5f')],function(_0x33f8da){return{'id':_0x33f8da['id'],'name':_0x33f8da[_0x1a57('0x6e')]>0x7?_0x33f8da[_0x1a57('0x6f')]:_0x33f8da[_0x1a57('0x2c')],'custom':_0x33f8da['position']>0x7?!![]:![],'options':_0x33f8da[_0x1a57('0x70')]?_0x33f8da[_0x1a57('0x70')]:_0x33f8da[_0x1a57('0x71')]?_0x33f8da[_0x1a57('0x71')]:[]};})};}})['then'](respondWithResult(_0x20b0d5,null))['catch'](function(_0x49f809){var _0x57cd92=_0x392f49['query'][_0x1a57('0x72')]?0x1f4:_0x49f809[_0x1a57('0x73')]||0x1f4;logger['error'](_0x1a57('0x74'),_0x1a57('0x54'),_0x57cd92,JSON['stringify'](_0x49f809));delete _0x49f809[_0x1a57('0x27')];if(_0x57cd92===0x191){_0x57cd92=0x190;}_0x20b0d5[_0x1a57('0x1b')](_0x57cd92)[_0x1a57('0x28')](_0x392f49[_0x1a57('0x2e')]['test']?{'message':_0x1a57('0x75'),'statusCode':_0x49f809[_0x1a57('0x73')]}:_0x49f809);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 7d7c8c1..8dcbed3 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 _0x65b9=['../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','define','ZendeskAccount','int_zendesk_accounts','moment','request-promise','path','rimraf'];(function(_0x3e1d94,_0xc6da34){var _0x5eb84d=function(_0x5759de){while(--_0x5759de){_0x3e1d94['push'](_0x3e1d94['shift']());}};_0x5eb84d(++_0xc6da34);}(_0x65b9,0xce));var _0x965b=function(_0x2fae7b,_0x557e53){_0x2fae7b=_0x2fae7b-0x0;var _0x5b06ef=_0x65b9[_0x2fae7b];return _0x5b06ef;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x965b('0x0'));var BPromise=require('bluebird');var rp=require(_0x965b('0x1'));var fs=require('fs');var path=require(_0x965b('0x2'));var rimraf=require(_0x965b('0x3'));var config=require(_0x965b('0x4'));var attributes=require(_0x965b('0x5'));var integrations=require(_0x965b('0x6'));module['exports']=function(_0x2f0b8b,_0x34f099){return _0x2f0b8b[_0x965b('0x7')](_0x965b('0x8'),attributes,{'tableName':_0x965b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0749=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','exports','define','ZendeskAccount','int_zendesk_accounts'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x0749,0x9a));var _0x9074=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x0749[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x9074('0x0'));var logger=require(_0x9074('0x1'))(_0x9074('0x2'));var moment=require(_0x9074('0x3'));var BPromise=require(_0x9074('0x4'));var rp=require(_0x9074('0x5'));var fs=require('fs');var path=require(_0x9074('0x6'));var rimraf=require(_0x9074('0x7'));var config=require(_0x9074('0x8'));var attributes=require(_0x9074('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x9074('0xa')]=function(_0x5941b4,_0x3554ee){return _0x5941b4[_0x9074('0xb')](_0x9074('0xc'),attributes,{'tableName':_0x9074('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 7c9e8ec..fe596df 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 _0x08dc=['raw','where','limit','map','include','model','attributes','then','ShowZendeskAccount','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options'];(function(_0x1bbb3b,_0x559d02){var _0x1d6487=function(_0x1425b1){while(--_0x1425b1){_0x1bbb3b['push'](_0x1bbb3b['shift']());}};_0x1d6487(++_0x559d02);}(_0x08dc,0x15d));var _0xc08d=function(_0x37f503,_0x3ee9b7){_0x37f503=_0x37f503-0x0;var _0xa8e53d=_0x08dc[_0x37f503];return _0xa8e53d;};'use strict';var _=require('lodash');var util=require(_0xc08d('0x0'));var moment=require(_0xc08d('0x1'));var BPromise=require(_0xc08d('0x2'));var rs=require(_0xc08d('0x3'));var fs=require('fs');var Redis=require(_0xc08d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc08d('0x5'));var logger=require('../../config/logger')(_0xc08d('0x6'));var config=require(_0xc08d('0x7'));var jayson=require(_0xc08d('0x8'));var client=jayson['client'][_0xc08d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ce4f4,_0x192c75,_0x38c956){return new BPromise(function(_0x549cdc,_0x29b3ef){return client['request'](_0x3ce4f4,_0x38c956)['then'](function(_0x4f6276){logger[_0xc08d('0xa')](_0xc08d('0xb'),_0x192c75,_0xc08d('0xc'));logger[_0xc08d('0xd')](_0xc08d('0xe'),_0x192c75,'request\x20sent',JSON[_0xc08d('0xf')](_0x4f6276));if(_0x4f6276['error']){if(_0x4f6276[_0xc08d('0x10')][_0xc08d('0x11')]===0x1f4){logger[_0xc08d('0x10')](_0xc08d('0xb'),_0x192c75,_0x4f6276['error'][_0xc08d('0x12')]);return _0x29b3ef(_0x4f6276[_0xc08d('0x10')]['message']);}logger[_0xc08d('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x192c75,_0x4f6276[_0xc08d('0x10')][_0xc08d('0x12')]);return _0x549cdc(_0x4f6276[_0xc08d('0x10')][_0xc08d('0x12')]);}else{logger['info'](_0xc08d('0xb'),_0x192c75,_0xc08d('0xc'));_0x549cdc(_0x4f6276[_0xc08d('0x13')][_0xc08d('0x12')]);}})[_0xc08d('0x14')](function(_0x3dc1e7){logger[_0xc08d('0x10')](_0xc08d('0xb'),_0x192c75,_0x3dc1e7);_0x29b3ef(_0x3dc1e7);});});}exports[_0xc08d('0x15')]=function(_0x4636e2){var _0x5e8d5b=this;return new Promise(function(_0x17a7e2,_0x3733c4){return db[_0xc08d('0x16')][_0xc08d('0x17')]({'raw':_0x4636e2[_0xc08d('0x18')]?_0x4636e2[_0xc08d('0x18')][_0xc08d('0x19')]===undefined?!![]:![]:!![],'where':_0x4636e2[_0xc08d('0x18')]?_0x4636e2[_0xc08d('0x18')][_0xc08d('0x1a')]||null:null,'attributes':_0x4636e2[_0xc08d('0x18')]?_0x4636e2[_0xc08d('0x18')]['attributes']||null:null,'limit':_0x4636e2[_0xc08d('0x18')]?_0x4636e2[_0xc08d('0x18')][_0xc08d('0x1b')]||null:null,'include':_0x4636e2['options']?_0x4636e2[_0xc08d('0x18')]['include']?_[_0xc08d('0x1c')](_0x4636e2['options'][_0xc08d('0x1d')],function(_0x56596f){return{'model':db[_0x56596f[_0xc08d('0x1e')]],'as':_0x56596f['as'],'attributes':_0x56596f[_0xc08d('0x1f')],'include':_0x56596f[_0xc08d('0x1d')]?_['map'](_0x56596f['include'],function(_0x384a93){return{'model':db[_0x384a93['model']],'as':_0x384a93['as'],'attributes':_0x384a93[_0xc08d('0x1f')],'include':_0x384a93['include']?_[_0xc08d('0x1c')](_0x384a93[_0xc08d('0x1d')],function(_0x339940){return{'model':db[_0x339940[_0xc08d('0x1e')]],'as':_0x339940['as'],'attributes':_0x339940[_0xc08d('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc08d('0x20')](function(_0x2fa64d){logger[_0xc08d('0xa')](_0xc08d('0x15'),_0x4636e2);logger['debug']('GetZendeskAccount',_0x4636e2,JSON[_0xc08d('0xf')](_0x2fa64d));_0x17a7e2(_0x2fa64d);})[_0xc08d('0x14')](function(_0x4af0dd){logger[_0xc08d('0x10')](_0xc08d('0x15'),_0x4af0dd[_0xc08d('0x12')],_0x4636e2);_0x3733c4(_0x5e8d5b[_0xc08d('0x10')](0x1f4,_0x4af0dd['message']));});});};exports[_0xc08d('0x21')]=function(_0x4360ed){var _0x7093c5=this;return new Promise(function(_0x1c5a56,_0x497c11){return db['ZendeskAccount']['find']({'raw':_0x4360ed[_0xc08d('0x18')]?_0x4360ed[_0xc08d('0x18')][_0xc08d('0x19')]===undefined?!![]:![]:!![],'where':_0x4360ed[_0xc08d('0x18')]?_0x4360ed['options'][_0xc08d('0x1a')]||null:null,'attributes':_0x4360ed['options']?_0x4360ed[_0xc08d('0x18')]['attributes']||null:null,'include':_0x4360ed[_0xc08d('0x18')]?_0x4360ed[_0xc08d('0x18')]['include']?_[_0xc08d('0x1c')](_0x4360ed['options'][_0xc08d('0x1d')],function(_0x32b540){return{'model':db[_0x32b540[_0xc08d('0x1e')]],'as':_0x32b540['as'],'attributes':_0x32b540[_0xc08d('0x1f')],'include':_0x32b540[_0xc08d('0x1d')]?_['map'](_0x32b540['include'],function(_0x4bf878){return{'model':db[_0x4bf878[_0xc08d('0x1e')]],'as':_0x4bf878['as'],'attributes':_0x4bf878[_0xc08d('0x1f')],'include':_0x4bf878[_0xc08d('0x1d')]?_['map'](_0x4bf878['include'],function(_0x378337){return{'model':db[_0x378337[_0xc08d('0x1e')]],'as':_0x378337['as'],'attributes':_0x378337[_0xc08d('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x349d73){logger[_0xc08d('0xa')](_0xc08d('0x21'),_0x4360ed);logger[_0xc08d('0xd')](_0xc08d('0x21'),_0x4360ed,JSON['stringify'](_0x349d73));_0x1c5a56(_0x349d73);})[_0xc08d('0x14')](function(_0x10ed7c){logger[_0xc08d('0x10')]('ShowZendeskAccount',_0x10ed7c[_0xc08d('0x12')],_0x4360ed);_0x497c11(_0x7093c5[_0xc08d('0x10')](0x1f4,_0x10ed7c['message']));});});}; \ No newline at end of file +var _0x0de3=['catch','GetZendeskAccount','findAll','options','raw','where','attributes','limit','map','include','model','then','debug','ShowZendeskAccount','ZendeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x55b940,_0x25e354){var _0x13ce9c=function(_0x4b1605){while(--_0x4b1605){_0x55b940['push'](_0x55b940['shift']());}};_0x13ce9c(++_0x25e354);}(_0x0de3,0x15d));var _0x30de=function(_0xb8e84c,_0x1205ea){_0xb8e84c=_0xb8e84c-0x0;var _0x503afc=_0x0de3[_0xb8e84c];return _0x503afc;};'use strict';var _=require(_0x30de('0x0'));var util=require(_0x30de('0x1'));var moment=require(_0x30de('0x2'));var BPromise=require(_0x30de('0x3'));var rs=require(_0x30de('0x4'));var fs=require('fs');var Redis=require(_0x30de('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x30de('0x6'));var logger=require(_0x30de('0x7'))('rpc');var config=require(_0x30de('0x8'));var jayson=require(_0x30de('0x9'));var client=jayson[_0x30de('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f69fb,_0x19562f,_0x1b822e){return new BPromise(function(_0x33852a,_0x2cf875){return client[_0x30de('0xb')](_0x4f69fb,_0x1b822e)['then'](function(_0x1609d5){logger[_0x30de('0xc')](_0x30de('0xd'),_0x19562f,_0x30de('0xe'));logger['debug'](_0x30de('0xf'),_0x19562f,_0x30de('0xe'),JSON[_0x30de('0x10')](_0x1609d5));if(_0x1609d5[_0x30de('0x11')]){if(_0x1609d5[_0x30de('0x11')][_0x30de('0x12')]===0x1f4){logger[_0x30de('0x11')](_0x30de('0xd'),_0x19562f,_0x1609d5[_0x30de('0x11')][_0x30de('0x13')]);return _0x2cf875(_0x1609d5[_0x30de('0x11')][_0x30de('0x13')]);}logger[_0x30de('0x11')](_0x30de('0xd'),_0x19562f,_0x1609d5[_0x30de('0x11')]['message']);return _0x33852a(_0x1609d5[_0x30de('0x11')][_0x30de('0x13')]);}else{logger[_0x30de('0xc')](_0x30de('0xd'),_0x19562f,_0x30de('0xe'));_0x33852a(_0x1609d5[_0x30de('0x14')][_0x30de('0x13')]);}})[_0x30de('0x15')](function(_0x5a5591){logger[_0x30de('0x11')](_0x30de('0xd'),_0x19562f,_0x5a5591);_0x2cf875(_0x5a5591);});});}exports[_0x30de('0x16')]=function(_0x442b21){var _0x10ee78=this;return new Promise(function(_0x2029fe,_0x38fa40){return db['ZendeskAccount'][_0x30de('0x17')]({'raw':_0x442b21['options']?_0x442b21[_0x30de('0x18')][_0x30de('0x19')]===undefined?!![]:![]:!![],'where':_0x442b21['options']?_0x442b21[_0x30de('0x18')][_0x30de('0x1a')]||null:null,'attributes':_0x442b21[_0x30de('0x18')]?_0x442b21['options'][_0x30de('0x1b')]||null:null,'limit':_0x442b21[_0x30de('0x18')]?_0x442b21[_0x30de('0x18')][_0x30de('0x1c')]||null:null,'include':_0x442b21[_0x30de('0x18')]?_0x442b21[_0x30de('0x18')]['include']?_[_0x30de('0x1d')](_0x442b21['options'][_0x30de('0x1e')],function(_0x45f408){return{'model':db[_0x45f408[_0x30de('0x1f')]],'as':_0x45f408['as'],'attributes':_0x45f408[_0x30de('0x1b')],'include':_0x45f408['include']?_[_0x30de('0x1d')](_0x45f408[_0x30de('0x1e')],function(_0x28977d){return{'model':db[_0x28977d['model']],'as':_0x28977d['as'],'attributes':_0x28977d['attributes'],'include':_0x28977d[_0x30de('0x1e')]?_['map'](_0x28977d['include'],function(_0x27f473){return{'model':db[_0x27f473[_0x30de('0x1f')]],'as':_0x27f473['as'],'attributes':_0x27f473[_0x30de('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x30de('0x20')](function(_0x1e172a){logger[_0x30de('0xc')](_0x30de('0x16'),_0x442b21);logger[_0x30de('0x21')](_0x30de('0x16'),_0x442b21,JSON[_0x30de('0x10')](_0x1e172a));_0x2029fe(_0x1e172a);})['catch'](function(_0x3f33b0){logger['error']('GetZendeskAccount',_0x3f33b0[_0x30de('0x13')],_0x442b21);_0x38fa40(_0x10ee78[_0x30de('0x11')](0x1f4,_0x3f33b0[_0x30de('0x13')]));});});};exports[_0x30de('0x22')]=function(_0x1d0119){var _0x2e5882=this;return new Promise(function(_0x429fa0,_0x14f2c3){return db[_0x30de('0x23')][_0x30de('0x24')]({'raw':_0x1d0119[_0x30de('0x18')]?_0x1d0119[_0x30de('0x18')][_0x30de('0x19')]===undefined?!![]:![]:!![],'where':_0x1d0119[_0x30de('0x18')]?_0x1d0119['options'][_0x30de('0x1a')]||null:null,'attributes':_0x1d0119[_0x30de('0x18')]?_0x1d0119[_0x30de('0x18')][_0x30de('0x1b')]||null:null,'include':_0x1d0119[_0x30de('0x18')]?_0x1d0119[_0x30de('0x18')]['include']?_['map'](_0x1d0119[_0x30de('0x18')][_0x30de('0x1e')],function(_0x5ee2bc){return{'model':db[_0x5ee2bc[_0x30de('0x1f')]],'as':_0x5ee2bc['as'],'attributes':_0x5ee2bc[_0x30de('0x1b')],'include':_0x5ee2bc['include']?_['map'](_0x5ee2bc[_0x30de('0x1e')],function(_0x2c841c){return{'model':db[_0x2c841c[_0x30de('0x1f')]],'as':_0x2c841c['as'],'attributes':_0x2c841c[_0x30de('0x1b')],'include':_0x2c841c['include']?_[_0x30de('0x1d')](_0x2c841c['include'],function(_0x48d2b8){return{'model':db[_0x48d2b8['model']],'as':_0x48d2b8['as'],'attributes':_0x48d2b8[_0x30de('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x30de('0x20')](function(_0x368857){logger[_0x30de('0xc')](_0x30de('0x22'),_0x1d0119);logger['debug'](_0x30de('0x22'),_0x1d0119,JSON['stringify'](_0x368857));_0x429fa0(_0x368857);})['catch'](function(_0x31b446){logger[_0x30de('0x11')](_0x30de('0x22'),_0x31b446[_0x30de('0x13')],_0x1d0119);_0x14f2c3(_0x2e5882[_0x30de('0x11')](0x1f4,_0x31b446[_0x30de('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index e8fb167..ba4b205 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 _0x9ffd=['update','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','create','post','put'];(function(_0x2730da,_0x1098bd){var _0xfe9991=function(_0x2ea521){while(--_0x2ea521){_0x2730da['push'](_0x2730da['shift']());}};_0xfe9991(++_0x1098bd);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x589019,_0x522c81){_0x589019=_0x589019-0x0;var _0x2a6c3b=_0x9ffd[_0x589019];return _0x2a6c3b;};'use strict';var multer=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var path=require(_0xd9ff('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ff('0x3'));var router=express[_0xd9ff('0x4')]();var fs_extra=require(_0xd9ff('0x5'));var auth=require(_0xd9ff('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd9ff('0x7'));var controller=require(_0xd9ff('0x8'));router['get']('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xa')]);router[_0xd9ff('0xb')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xd')]);router[_0xd9ff('0xb')](_0xd9ff('0xe'),auth[_0xd9ff('0x9')](),controller['getFields']);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0xd9ff('0xf')]);router[_0xd9ff('0xb')](_0xd9ff('0x10'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x11')]);router[_0xd9ff('0xb')](_0xd9ff('0x12'),auth[_0xd9ff('0x9')](),controller['getTags']);router['post']('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x13')]);router[_0xd9ff('0x14')](_0xd9ff('0x12'),auth[_0xd9ff('0x9')](),controller['setTags']);router[_0xd9ff('0x15')](_0xd9ff('0xc'),auth['isAuthenticated'](),controller[_0xd9ff('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xd9ff('0x17')]=router; \ No newline at end of file +var _0x4024=['util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id/fields','getDescriptions','/:id/tags','getTags','create','post','setTags','put','/:id','update','delete','destroy','exports','multer'];(function(_0x383356,_0x33d2f5){var _0x32ee5a=function(_0x2741db){while(--_0x2741db){_0x383356['push'](_0x383356['shift']());}};_0x32ee5a(++_0x33d2f5);}(_0x4024,0x89));var _0x4402=function(_0x589e18,_0x4e472a){_0x589e18=_0x589e18-0x0;var _0x415f2b=_0x4024[_0x589e18];return _0x415f2b;};'use strict';var multer=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var path=require('path');var timeout=require(_0x4402('0x2'));var express=require(_0x4402('0x3'));var router=express['Router']();var fs_extra=require(_0x4402('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4402('0x5'));var config=require(_0x4402('0x6'));var controller=require('./intZendeskConfiguration.controller');router['get']('/',auth[_0x4402('0x7')](),controller[_0x4402('0x8')]);router[_0x4402('0x9')]('/:id',auth[_0x4402('0x7')](),controller['show']);router['get'](_0x4402('0xa'),auth['isAuthenticated'](),controller['getFields']);router[_0x4402('0x9')]('/:id/subjects',auth[_0x4402('0x7')](),controller['getSubjects']);router[_0x4402('0x9')]('/:id/descriptions',auth[_0x4402('0x7')](),controller[_0x4402('0xb')]);router['get'](_0x4402('0xc'),auth[_0x4402('0x7')](),controller[_0x4402('0xd')]);router['post']('/',auth[_0x4402('0x7')](),controller[_0x4402('0xe')]);router[_0x4402('0xf')](_0x4402('0xc'),auth[_0x4402('0x7')](),controller[_0x4402('0x10')]);router[_0x4402('0x11')](_0x4402('0x12'),auth[_0x4402('0x7')](),controller[_0x4402('0x13')]);router[_0x4402('0x14')](_0x4402('0x12'),auth[_0x4402('0x7')](),controller[_0x4402('0x15')]);module[_0x4402('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 3930375..3778207 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 _0xc7bc=['sequelize','STRING'];(function(_0x336318,_0x329caf){var _0x2218f1=function(_0x31905d){while(--_0x31905d){_0x336318['push'](_0x336318['shift']());}};_0x2218f1(++_0x329caf);}(_0xc7bc,0x140));var _0xcc7b=function(_0x2e9d2c,_0x2e97ad){_0x2e9d2c=_0x2e9d2c-0x0;var _0x233caa=_0xc7bc[_0x2e9d2c];return _0x233caa;};'use strict';var Sequelize=require(_0xcc7b('0x0'));module['exports']={'name':{'type':Sequelize[_0xcc7b('0x1')]},'description':{'type':Sequelize[_0xcc7b('0x1')]}}; \ No newline at end of file +var _0xc3b0=['STRING','exports'];(function(_0x320f19,_0xe817c0){var _0xd87d3d=function(_0xa8a44e){while(--_0xa8a44e){_0x320f19['push'](_0x320f19['shift']());}};_0xd87d3d(++_0xe817c0);}(_0xc3b0,0x1cb));var _0x0c3b=function(_0x3c438c,_0x107c03){_0x3c438c=_0x3c438c-0x0;var _0x3c43c7=_0xc3b0[_0x3c438c];return _0x3c43c7;};'use strict';var Sequelize=require('sequelize');module[_0x0c3b('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0c3b('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 227139a..3f7cb93 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 _0x29e7=['json','offset','undefined','count','limit','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','filter','options','ZendeskConfiguration','includeAll','include','rows','catch','show','length','find','create','body','params','getFields','ZendeskField','sort','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end'];(function(_0xb3e3d8,_0x2ac6a7){var _0x44105d=function(_0x3460bd){while(--_0x3460bd){_0xb3e3d8['push'](_0xb3e3d8['shift']());}};_0x44105d(++_0x2ac6a7);}(_0x29e7,0x185));var _0x729e=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x29e7[_0x1694f5];return _0x5b4321;};'use strict';var emlformat=require(_0x729e('0x0'));var rimraf=require(_0x729e('0x1'));var zipdir=require(_0x729e('0x2'));var jsonpatch=require(_0x729e('0x3'));var rp=require(_0x729e('0x4'));var moment=require(_0x729e('0x5'));var BPromise=require(_0x729e('0x6'));var Mustache=require(_0x729e('0x7'));var util=require(_0x729e('0x8'));var path=require('path');var sox=require(_0x729e('0x9'));var csv=require(_0x729e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x729e('0xb'));var _=require(_0x729e('0xc'));var squel=require(_0x729e('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x729e('0xe'));var toCsv=require(_0x729e('0xa'));var querystring=require(_0x729e('0xf'));var Papa=require('papaparse');var Redis=require(_0x729e('0x10'));var authService=require(_0x729e('0x11'));var qs=require(_0x729e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x729e('0x13'));var logger=require('../../config/logger')(_0x729e('0x14'));var utils=require('../../config/utils');var config=require(_0x729e('0x15'));var licenseUtil=require(_0x729e('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d1ac3,_0x10cedf){_0x10cedf=_0x10cedf||0xcc;return function(_0x38f0a3){if(_0x38f0a3){return _0x1d1ac3[_0x729e('0x17')](_0x10cedf);}return _0x1d1ac3[_0x729e('0x18')](_0x10cedf)[_0x729e('0x19')]();};}function respondWithResult(_0x2dc195,_0x144d7d){_0x144d7d=_0x144d7d||0xc8;return function(_0x3cdd51){if(_0x3cdd51){return _0x2dc195['status'](_0x144d7d)[_0x729e('0x1a')](_0x3cdd51);}};}function respondWithFilteredResult(_0x1daa29,_0x619e49){return function(_0x1b426d){if(_0x1b426d){var _0x56d00c=typeof _0x619e49[_0x729e('0x1b')]===_0x729e('0x1c')&&typeof _0x619e49['limit']===_0x729e('0x1c');var _0x42b517=_0x1b426d[_0x729e('0x1d')];var _0x4ff22b=_0x56d00c?0x0:_0x619e49[_0x729e('0x1b')];var _0x3d6cbb=_0x56d00c?_0x1b426d[_0x729e('0x1d')]:_0x619e49[_0x729e('0x1b')]+_0x619e49[_0x729e('0x1e')];var _0x378e47;if(_0x3d6cbb>=_0x42b517){_0x3d6cbb=_0x42b517;_0x378e47=0xc8;}else{_0x378e47=0xce;}_0x1daa29[_0x729e('0x18')](_0x378e47);return _0x1daa29['set'](_0x729e('0x1f'),_0x4ff22b+'-'+_0x3d6cbb+'/'+_0x42b517)[_0x729e('0x1a')](_0x1b426d);}return null;};}function patchUpdates(_0x2da29c){return function(_0xe721a7){try{jsonpatch['apply'](_0xe721a7,_0x2da29c,!![]);}catch(_0x386a09){return BPromise[_0x729e('0x20')](_0x386a09);}return _0xe721a7[_0x729e('0x21')]();};}function saveUpdates(_0x70e68d,_0x2a1e88){return function(_0x16bdc1){if(_0x16bdc1){return _0x16bdc1[_0x729e('0x22')](_0x70e68d)[_0x729e('0x23')](function(_0x1539cd){return _0x1539cd;});}return null;};}function removeEntity(_0x5ecf6c,_0x2c2496){return function(_0x201cd1){if(_0x201cd1){return _0x201cd1[_0x729e('0x24')]()[_0x729e('0x23')](function(){_0x5ecf6c[_0x729e('0x18')](0xcc)[_0x729e('0x19')]();});}};}function handleEntityNotFound(_0x21fe04,_0x3a563a){return function(_0x26ea6c){if(!_0x26ea6c){_0x21fe04['sendStatus'](0x194);}return _0x26ea6c;};}function handleError(_0x2cd898,_0x1a383d){_0x1a383d=_0x1a383d||0x1f4;return function(_0x1f7f98){logger[_0x729e('0x25')](_0x1f7f98[_0x729e('0x26')]);if(_0x1f7f98[_0x729e('0x27')]){delete _0x1f7f98[_0x729e('0x27')];}_0x2cd898[_0x729e('0x18')](_0x1a383d)[_0x729e('0x28')](_0x1f7f98);};}exports['index']=function(_0x1d40cb,_0x2d5f82){var _0x27f0cb={},_0x36bba5={},_0x43569b={'count':0x0,'rows':[]};var _0x2699a7=_[_0x729e('0x29')](db['ZendeskConfiguration'][_0x729e('0x2a')],function(_0x5bcf75){return{'name':_0x5bcf75[_0x729e('0x2b')],'type':_0x5bcf75[_0x729e('0x2c')][_0x729e('0x2d')]};});_0x36bba5[_0x729e('0x2e')]=_[_0x729e('0x29')](_0x2699a7,_0x729e('0x27'));_0x36bba5[_0x729e('0x2f')]=_[_0x729e('0x30')](_0x1d40cb[_0x729e('0x2f')]);_0x36bba5[_0x729e('0x31')]=_[_0x729e('0x32')](_0x36bba5[_0x729e('0x2e')],_0x36bba5[_0x729e('0x2f')]);_0x27f0cb[_0x729e('0x33')]=_['intersection'](_0x36bba5[_0x729e('0x2e')],qs[_0x729e('0x34')](_0x1d40cb[_0x729e('0x2f')][_0x729e('0x34')]));_0x27f0cb[_0x729e('0x33')]=_0x27f0cb[_0x729e('0x33')]['length']?_0x27f0cb[_0x729e('0x33')]:_0x36bba5['model'];if(!_0x1d40cb[_0x729e('0x2f')][_0x729e('0x35')](_0x729e('0x36'))){_0x27f0cb[_0x729e('0x1e')]=qs[_0x729e('0x1e')](_0x1d40cb[_0x729e('0x2f')][_0x729e('0x1e')]);_0x27f0cb[_0x729e('0x1b')]=qs[_0x729e('0x1b')](_0x1d40cb[_0x729e('0x2f')][_0x729e('0x1b')]);}_0x27f0cb[_0x729e('0x37')]=qs['sort'](_0x1d40cb[_0x729e('0x2f')]['sort']);_0x27f0cb[_0x729e('0x38')]=qs[_0x729e('0x31')](_[_0x729e('0x39')](_0x1d40cb[_0x729e('0x2f')],_0x36bba5[_0x729e('0x31')]),_0x2699a7);if(_0x1d40cb[_0x729e('0x2f')]['filter']){_0x27f0cb['where']=_[_0x729e('0x3a')](_0x27f0cb[_0x729e('0x38')],{'$or':_[_0x729e('0x29')](_0x2699a7,function(_0x140b32){if(_0x140b32[_0x729e('0x2c')]!==_0x729e('0x3b')){var _0x3b4780={};_0x3b4780[_0x140b32[_0x729e('0x27')]]={'$like':'%'+_0x1d40cb[_0x729e('0x2f')][_0x729e('0x3c')]+'%'};return _0x3b4780;}})});}_0x27f0cb=_['merge']({},_0x27f0cb,_0x1d40cb[_0x729e('0x3d')]);var _0x54dee0={'where':_0x27f0cb[_0x729e('0x38')]};return db[_0x729e('0x3e')][_0x729e('0x1d')](_0x54dee0)['then'](function(_0x30a7ff){_0x43569b['count']=_0x30a7ff;if(_0x1d40cb['query'][_0x729e('0x3f')]){_0x27f0cb[_0x729e('0x40')]=[{'all':!![]}];}return db[_0x729e('0x3e')]['findAll'](_0x27f0cb);})[_0x729e('0x23')](function(_0x159333){_0x43569b[_0x729e('0x41')]=_0x159333;return _0x43569b;})[_0x729e('0x23')](respondWithFilteredResult(_0x2d5f82,_0x27f0cb))[_0x729e('0x42')](handleError(_0x2d5f82,null));};exports[_0x729e('0x43')]=function(_0x5747b9,_0x1bd5a0){var _0x5e0283={'raw':![],'where':{'id':_0x5747b9['params']['id']}},_0x365213={};_0x365213['model']=_[_0x729e('0x30')](db[_0x729e('0x3e')]['rawAttributes']);_0x365213[_0x729e('0x2f')]=_[_0x729e('0x30')](_0x5747b9[_0x729e('0x2f')]);_0x365213['filters']=_[_0x729e('0x32')](_0x365213[_0x729e('0x2e')],_0x365213['query']);_0x5e0283['attributes']=_[_0x729e('0x32')](_0x365213['model'],qs['fields'](_0x5747b9[_0x729e('0x2f')]['fields']));_0x5e0283[_0x729e('0x33')]=_0x5e0283[_0x729e('0x33')][_0x729e('0x44')]?_0x5e0283[_0x729e('0x33')]:_0x365213['model'];if(_0x5747b9[_0x729e('0x2f')][_0x729e('0x3f')]){_0x5e0283[_0x729e('0x40')]=[{'all':!![]}];}_0x5e0283=_[_0x729e('0x3a')]({},_0x5e0283,_0x5747b9[_0x729e('0x3d')]);return db[_0x729e('0x3e')][_0x729e('0x45')](_0x5e0283)[_0x729e('0x23')](handleEntityNotFound(_0x1bd5a0,null))[_0x729e('0x23')](respondWithResult(_0x1bd5a0,null))[_0x729e('0x42')](handleError(_0x1bd5a0,null));};exports['create']=function(_0x3bed3f,_0x476d8a){return db[_0x729e('0x3e')][_0x729e('0x46')](_0x3bed3f[_0x729e('0x47')],{})[_0x729e('0x23')](respondWithResult(_0x476d8a,0xc9))[_0x729e('0x42')](handleError(_0x476d8a,null));};exports['update']=function(_0x4436da,_0x14ca05){if(_0x4436da[_0x729e('0x47')]['id']){delete _0x4436da['body']['id'];}return db[_0x729e('0x3e')][_0x729e('0x45')]({'where':{'id':_0x4436da['params']['id']}})[_0x729e('0x23')](handleEntityNotFound(_0x14ca05,null))[_0x729e('0x23')](saveUpdates(_0x4436da['body'],null))[_0x729e('0x23')](respondWithResult(_0x14ca05,null))[_0x729e('0x42')](handleError(_0x14ca05,null));};exports[_0x729e('0x24')]=function(_0x532125,_0xbe232e){return db[_0x729e('0x3e')]['find']({'where':{'id':_0x532125[_0x729e('0x48')]['id']}})[_0x729e('0x23')](handleEntityNotFound(_0xbe232e,null))[_0x729e('0x23')](removeEntity(_0xbe232e,null))[_0x729e('0x42')](handleError(_0xbe232e,null));};exports[_0x729e('0x49')]=function(_0x5caadd,_0x1eeb81,_0x5bfa70){var _0x1ca136={};var _0x147e7c={};var _0x80b5fc;var _0xbadc1b;return db[_0x729e('0x3e')]['findOne']({'where':{'id':_0x5caadd[_0x729e('0x48')]['id']}})[_0x729e('0x23')](handleEntityNotFound(_0x1eeb81,null))[_0x729e('0x23')](function(_0xad2916){if(_0xad2916){_0x80b5fc=_0xad2916;_0x147e7c['model']=_[_0x729e('0x30')](db[_0x729e('0x4a')][_0x729e('0x2a')]);_0x147e7c[_0x729e('0x2f')]=_[_0x729e('0x30')](_0x5caadd[_0x729e('0x2f')]);_0x147e7c[_0x729e('0x31')]=_['intersection'](_0x147e7c[_0x729e('0x2e')],_0x147e7c[_0x729e('0x2f')]);_0x1ca136[_0x729e('0x33')]=_[_0x729e('0x32')](_0x147e7c[_0x729e('0x2e')],qs[_0x729e('0x34')](_0x5caadd['query'][_0x729e('0x34')]));_0x1ca136[_0x729e('0x33')]=_0x1ca136[_0x729e('0x33')]['length']?_0x1ca136['attributes']:_0x147e7c[_0x729e('0x2e')];_0x1ca136[_0x729e('0x37')]=qs['sort'](_0x5caadd[_0x729e('0x2f')][_0x729e('0x4b')]);_0x1ca136[_0x729e('0x38')]=qs['filters'](_['pick'](_0x5caadd[_0x729e('0x2f')],_0x147e7c[_0x729e('0x31')]));if(_0x5caadd[_0x729e('0x2f')][_0x729e('0x3c')]){_0x1ca136[_0x729e('0x38')]=_[_0x729e('0x3a')](_0x1ca136[_0x729e('0x38')],{'$or':_[_0x729e('0x29')](_0x1ca136['attributes'],function(_0x33680b){var _0xe2ecd6={};_0xe2ecd6[_0x33680b]={'$like':'%'+_0x5caadd[_0x729e('0x2f')][_0x729e('0x3c')]+'%'};return _0xe2ecd6;})});}_0x1ca136=_[_0x729e('0x3a')]({},_0x1ca136,_0x5caadd[_0x729e('0x3d')]);return _0x80b5fc['getFields'](_0x1ca136);}})[_0x729e('0x23')](function(_0x179d9d){if(_0x179d9d){_0xbadc1b=_0x179d9d[_0x729e('0x44')];if(!_0x5caadd[_0x729e('0x2f')][_0x729e('0x35')]('nolimit')){_0x1ca136[_0x729e('0x1e')]=qs[_0x729e('0x1e')](_0x5caadd['query'][_0x729e('0x1e')]);_0x1ca136[_0x729e('0x1b')]=qs[_0x729e('0x1b')](_0x5caadd[_0x729e('0x2f')][_0x729e('0x1b')]);}return _0x80b5fc[_0x729e('0x49')](_0x1ca136);}})[_0x729e('0x23')](function(_0x35acc5){if(_0x35acc5){return _0x35acc5?{'count':_0xbadc1b,'rows':_0x35acc5}:null;}})['then'](respondWithResult(_0x1eeb81,null))[_0x729e('0x42')](handleError(_0x1eeb81,null));};exports[_0x729e('0x4c')]=function(_0x3eb65d,_0x4e906d,_0x55a425){var _0x36bb7c={};var _0x2891f2={};var _0xf3ea1c;var _0x130ba7;return db[_0x729e('0x3e')]['findOne']({'where':{'id':_0x3eb65d['params']['id']}})['then'](handleEntityNotFound(_0x4e906d,null))[_0x729e('0x23')](function(_0x111156){if(_0x111156){_0xf3ea1c=_0x111156;_0x2891f2[_0x729e('0x2e')]=_[_0x729e('0x30')](db[_0x729e('0x4a')][_0x729e('0x2a')]);_0x2891f2[_0x729e('0x2f')]=_[_0x729e('0x30')](_0x3eb65d[_0x729e('0x2f')]);_0x2891f2[_0x729e('0x31')]=_['intersection'](_0x2891f2[_0x729e('0x2e')],_0x2891f2[_0x729e('0x2f')]);_0x36bb7c[_0x729e('0x33')]=_[_0x729e('0x32')](_0x2891f2['model'],qs['fields'](_0x3eb65d[_0x729e('0x2f')]['fields']));_0x36bb7c[_0x729e('0x33')]=_0x36bb7c['attributes'][_0x729e('0x44')]?_0x36bb7c[_0x729e('0x33')]:_0x2891f2[_0x729e('0x2e')];_0x36bb7c['order']=qs[_0x729e('0x4b')](_0x3eb65d[_0x729e('0x2f')]['sort']);_0x36bb7c[_0x729e('0x38')]=qs['filters'](_['pick'](_0x3eb65d[_0x729e('0x2f')],_0x2891f2[_0x729e('0x31')]));if(_0x3eb65d[_0x729e('0x2f')][_0x729e('0x3c')]){_0x36bb7c[_0x729e('0x38')]=_[_0x729e('0x3a')](_0x36bb7c[_0x729e('0x38')],{'$or':_['map'](_0x36bb7c[_0x729e('0x33')],function(_0x267545){var _0x59d6af={};_0x59d6af[_0x267545]={'$like':'%'+_0x3eb65d[_0x729e('0x2f')]['filter']+'%'};return _0x59d6af;})});}_0x36bb7c=_[_0x729e('0x3a')]({},_0x36bb7c,_0x3eb65d[_0x729e('0x3d')]);return _0xf3ea1c[_0x729e('0x4c')](_0x36bb7c);}})['then'](function(_0x3cf14f){if(_0x3cf14f){_0x130ba7=_0x3cf14f[_0x729e('0x44')];if(!_0x3eb65d[_0x729e('0x2f')][_0x729e('0x35')]('nolimit')){_0x36bb7c[_0x729e('0x1e')]=qs[_0x729e('0x1e')](_0x3eb65d[_0x729e('0x2f')][_0x729e('0x1e')]);_0x36bb7c[_0x729e('0x1b')]=qs['offset'](_0x3eb65d['query']['offset']);}return _0xf3ea1c[_0x729e('0x4c')](_0x36bb7c);}})[_0x729e('0x23')](function(_0x528a26){if(_0x528a26){return _0x528a26?{'count':_0x130ba7,'rows':_0x528a26}:null;}})[_0x729e('0x23')](respondWithResult(_0x4e906d,null))[_0x729e('0x42')](handleError(_0x4e906d,null));};exports['getDescriptions']=function(_0x2e988b,_0x588071,_0x136092){var _0x1fe59e={};var _0x3de83e={};var _0x3432ec;var _0x27d2c2;return db[_0x729e('0x3e')][_0x729e('0x4d')]({'where':{'id':_0x2e988b[_0x729e('0x48')]['id']}})[_0x729e('0x23')](handleEntityNotFound(_0x588071,null))[_0x729e('0x23')](function(_0x55e4f8){if(_0x55e4f8){_0x3432ec=_0x55e4f8;_0x3de83e[_0x729e('0x2e')]=_[_0x729e('0x30')](db[_0x729e('0x4a')][_0x729e('0x2a')]);_0x3de83e[_0x729e('0x2f')]=_[_0x729e('0x30')](_0x2e988b[_0x729e('0x2f')]);_0x3de83e[_0x729e('0x31')]=_[_0x729e('0x32')](_0x3de83e[_0x729e('0x2e')],_0x3de83e[_0x729e('0x2f')]);_0x1fe59e['attributes']=_[_0x729e('0x32')](_0x3de83e[_0x729e('0x2e')],qs['fields'](_0x2e988b[_0x729e('0x2f')][_0x729e('0x34')]));_0x1fe59e['attributes']=_0x1fe59e[_0x729e('0x33')][_0x729e('0x44')]?_0x1fe59e[_0x729e('0x33')]:_0x3de83e[_0x729e('0x2e')];_0x1fe59e[_0x729e('0x37')]=qs[_0x729e('0x4b')](_0x2e988b[_0x729e('0x2f')][_0x729e('0x4b')]);_0x1fe59e[_0x729e('0x38')]=qs['filters'](_[_0x729e('0x39')](_0x2e988b[_0x729e('0x2f')],_0x3de83e[_0x729e('0x31')]));if(_0x2e988b['query'][_0x729e('0x3c')]){_0x1fe59e[_0x729e('0x38')]=_[_0x729e('0x3a')](_0x1fe59e[_0x729e('0x38')],{'$or':_[_0x729e('0x29')](_0x1fe59e[_0x729e('0x33')],function(_0x1e5944){var _0x312ac8={};_0x312ac8[_0x1e5944]={'$like':'%'+_0x2e988b[_0x729e('0x2f')][_0x729e('0x3c')]+'%'};return _0x312ac8;})});}_0x1fe59e=_[_0x729e('0x3a')]({},_0x1fe59e,_0x2e988b[_0x729e('0x3d')]);return _0x3432ec[_0x729e('0x4e')](_0x1fe59e);}})[_0x729e('0x23')](function(_0x1035d0){if(_0x1035d0){_0x27d2c2=_0x1035d0[_0x729e('0x44')];if(!_0x2e988b[_0x729e('0x2f')]['hasOwnProperty'](_0x729e('0x36'))){_0x1fe59e[_0x729e('0x1e')]=qs[_0x729e('0x1e')](_0x2e988b['query'][_0x729e('0x1e')]);_0x1fe59e[_0x729e('0x1b')]=qs[_0x729e('0x1b')](_0x2e988b[_0x729e('0x2f')]['offset']);}return _0x3432ec[_0x729e('0x4e')](_0x1fe59e);}})[_0x729e('0x23')](function(_0x428df2){if(_0x428df2){return _0x428df2?{'count':_0x27d2c2,'rows':_0x428df2}:null;}})['then'](respondWithResult(_0x588071,null))['catch'](handleError(_0x588071,null));};exports[_0x729e('0x4f')]=function(_0x26b1ed,_0x5eeade,_0x58ee54){var _0x458e78={};var _0x2ed749={};var _0x3bec20;var _0x2f7eef;return db[_0x729e('0x3e')][_0x729e('0x4d')]({'where':{'id':_0x26b1ed[_0x729e('0x48')]['id']}})[_0x729e('0x23')](handleEntityNotFound(_0x5eeade,null))[_0x729e('0x23')](function(_0x205577){if(_0x205577){_0x3bec20=_0x205577;_0x2ed749[_0x729e('0x2e')]=_[_0x729e('0x30')](db[_0x729e('0x50')][_0x729e('0x2a')]);_0x2ed749[_0x729e('0x2f')]=_[_0x729e('0x30')](_0x26b1ed['query']);_0x2ed749[_0x729e('0x31')]=_[_0x729e('0x32')](_0x2ed749[_0x729e('0x2e')],_0x2ed749[_0x729e('0x2f')]);_0x458e78[_0x729e('0x33')]=_[_0x729e('0x32')](_0x2ed749[_0x729e('0x2e')],qs[_0x729e('0x34')](_0x26b1ed[_0x729e('0x2f')][_0x729e('0x34')]));_0x458e78[_0x729e('0x33')]=_0x458e78['attributes'][_0x729e('0x44')]?_0x458e78[_0x729e('0x33')]:_0x2ed749[_0x729e('0x2e')];_0x458e78['order']=qs[_0x729e('0x4b')](_0x26b1ed[_0x729e('0x2f')]['sort']);_0x458e78[_0x729e('0x38')]=qs[_0x729e('0x31')](_[_0x729e('0x39')](_0x26b1ed[_0x729e('0x2f')],_0x2ed749[_0x729e('0x31')]));if(_0x26b1ed[_0x729e('0x2f')]['filter']){_0x458e78['where']=_[_0x729e('0x3a')](_0x458e78[_0x729e('0x38')],{'$or':_[_0x729e('0x29')](_0x458e78[_0x729e('0x33')],function(_0xce6948){var _0x1340ab={};_0x1340ab[_0xce6948]={'$like':'%'+_0x26b1ed[_0x729e('0x2f')][_0x729e('0x3c')]+'%'};return _0x1340ab;})});}_0x458e78=_[_0x729e('0x3a')]({},_0x458e78,_0x26b1ed[_0x729e('0x3d')]);return _0x3bec20[_0x729e('0x4f')](_0x458e78);}})[_0x729e('0x23')](function(_0x42f000){if(_0x42f000){_0x2f7eef=_0x42f000[_0x729e('0x44')];if(!_0x26b1ed[_0x729e('0x2f')][_0x729e('0x35')](_0x729e('0x36'))){_0x458e78[_0x729e('0x1e')]=qs[_0x729e('0x1e')](_0x26b1ed[_0x729e('0x2f')]['limit']);_0x458e78['offset']=qs['offset'](_0x26b1ed['query'][_0x729e('0x1b')]);}return _0x3bec20[_0x729e('0x4f')](_0x458e78);}})[_0x729e('0x23')](function(_0x2fa1cd){if(_0x2fa1cd){return _0x2fa1cd?{'count':_0x2f7eef,'rows':_0x2fa1cd}:null;}})[_0x729e('0x23')](respondWithResult(_0x5eeade,null))[_0x729e('0x42')](handleError(_0x5eeade,null));};exports[_0x729e('0x51')]=function(_0x5375be,_0x28de35,_0x1b2ec9){if(_0x5375be[_0x729e('0x47')]['id']){delete _0x5375be[_0x729e('0x47')]['id'];}return db[_0x729e('0x3e')][_0x729e('0x4d')]({'where':{'id':_0x5375be['params']['id']}})[_0x729e('0x23')](handleEntityNotFound(_0x28de35,null))[_0x729e('0x23')](function(_0x1712a6){if(_0x1712a6){return _0x1712a6[_0x729e('0x51')](_0x5375be[_0x729e('0x47')][_0x729e('0x52')]||[]);}return null;})[_0x729e('0x23')](respondWithResult(_0x28de35,null))['catch'](handleError(_0x28de35,null));}; \ No newline at end of file +var _0xa7d9=['setTags','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','apply','save','update','then','destroy','stack','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ZendeskConfiguration','count','include','findAll','rows','catch','show','find','create','body','params','findOne','ZendeskField','getFields','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xa7d9,0x1db));var _0x9a7d=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xa7d9[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0x9a7d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9a7d('0x1'));var rp=require(_0x9a7d('0x2'));var moment=require('moment');var BPromise=require(_0x9a7d('0x3'));var Mustache=require(_0x9a7d('0x4'));var util=require(_0x9a7d('0x5'));var path=require(_0x9a7d('0x6'));var sox=require(_0x9a7d('0x7'));var csv=require('to-csv');var ejs=require(_0x9a7d('0x8'));var fs=require('fs');var fs_extra=require(_0x9a7d('0x9'));var _=require(_0x9a7d('0xa'));var squel=require(_0x9a7d('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9a7d('0xc'));var toCsv=require(_0x9a7d('0xd'));var querystring=require('querystring');var Papa=require(_0x9a7d('0xe'));var Redis=require(_0x9a7d('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9a7d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9a7d('0x11'))(_0x9a7d('0x12'));var utils=require(_0x9a7d('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9a7d('0x14'))['db'];function respondWithStatusCode(_0x246532,_0x17f23a){_0x17f23a=_0x17f23a||0xcc;return function(_0x4e5447){if(_0x4e5447){return _0x246532[_0x9a7d('0x15')](_0x17f23a);}return _0x246532[_0x9a7d('0x16')](_0x17f23a)[_0x9a7d('0x17')]();};}function respondWithResult(_0x1bb9f0,_0x4b76cd){_0x4b76cd=_0x4b76cd||0xc8;return function(_0x42554f){if(_0x42554f){return _0x1bb9f0[_0x9a7d('0x16')](_0x4b76cd)['json'](_0x42554f);}};}function respondWithFilteredResult(_0x2059de,_0x1fec00){return function(_0x1d97e6){if(_0x1d97e6){var _0x35e4b3=typeof _0x1fec00[_0x9a7d('0x18')]===_0x9a7d('0x19')&&typeof _0x1fec00[_0x9a7d('0x1a')]===_0x9a7d('0x19');var _0x402a95=_0x1d97e6['count'];var _0xe80a81=_0x35e4b3?0x0:_0x1fec00[_0x9a7d('0x18')];var _0x15c267=_0x35e4b3?_0x1d97e6['count']:_0x1fec00[_0x9a7d('0x18')]+_0x1fec00[_0x9a7d('0x1a')];var _0x5438a8;if(_0x15c267>=_0x402a95){_0x15c267=_0x402a95;_0x5438a8=0xc8;}else{_0x5438a8=0xce;}_0x2059de[_0x9a7d('0x16')](_0x5438a8);return _0x2059de[_0x9a7d('0x1b')](_0x9a7d('0x1c'),_0xe80a81+'-'+_0x15c267+'/'+_0x402a95)[_0x9a7d('0x1d')](_0x1d97e6);}return null;};}function patchUpdates(_0x2bb93f){return function(_0x5d84c2){try{jsonpatch[_0x9a7d('0x1e')](_0x5d84c2,_0x2bb93f,!![]);}catch(_0x1e8cdd){return BPromise['reject'](_0x1e8cdd);}return _0x5d84c2[_0x9a7d('0x1f')]();};}function saveUpdates(_0x456e21,_0x3d94c5){return function(_0x1538ef){if(_0x1538ef){return _0x1538ef[_0x9a7d('0x20')](_0x456e21)[_0x9a7d('0x21')](function(_0x427803){return _0x427803;});}return null;};}function removeEntity(_0x217530,_0x3ffb99){return function(_0x23e193){if(_0x23e193){return _0x23e193[_0x9a7d('0x22')]()[_0x9a7d('0x21')](function(){_0x217530['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2caa5e,_0x56ebfb){return function(_0x552584){if(!_0x552584){_0x2caa5e[_0x9a7d('0x15')](0x194);}return _0x552584;};}function handleError(_0x5aefc8,_0x105073){_0x105073=_0x105073||0x1f4;return function(_0x13a879){logger['error'](_0x13a879[_0x9a7d('0x23')]);if(_0x13a879[_0x9a7d('0x24')]){delete _0x13a879[_0x9a7d('0x24')];}_0x5aefc8[_0x9a7d('0x16')](_0x105073)[_0x9a7d('0x25')](_0x13a879);};}exports[_0x9a7d('0x26')]=function(_0x49362f,_0x119500){var _0x1581c6={},_0x46bfd1={},_0x3a2e9f={'count':0x0,'rows':[]};var _0xfe41d2=_[_0x9a7d('0x27')](db['ZendeskConfiguration'][_0x9a7d('0x28')],function(_0x38298c){return{'name':_0x38298c['fieldName'],'type':_0x38298c[_0x9a7d('0x29')]['key']};});_0x46bfd1[_0x9a7d('0x2a')]=_[_0x9a7d('0x27')](_0xfe41d2,_0x9a7d('0x24'));_0x46bfd1[_0x9a7d('0x2b')]=_[_0x9a7d('0x2c')](_0x49362f[_0x9a7d('0x2b')]);_0x46bfd1[_0x9a7d('0x2d')]=_[_0x9a7d('0x2e')](_0x46bfd1[_0x9a7d('0x2a')],_0x46bfd1[_0x9a7d('0x2b')]);_0x1581c6[_0x9a7d('0x2f')]=_[_0x9a7d('0x2e')](_0x46bfd1[_0x9a7d('0x2a')],qs[_0x9a7d('0x30')](_0x49362f[_0x9a7d('0x2b')][_0x9a7d('0x30')]));_0x1581c6[_0x9a7d('0x2f')]=_0x1581c6['attributes'][_0x9a7d('0x31')]?_0x1581c6[_0x9a7d('0x2f')]:_0x46bfd1[_0x9a7d('0x2a')];if(!_0x49362f[_0x9a7d('0x2b')]['hasOwnProperty'](_0x9a7d('0x32'))){_0x1581c6[_0x9a7d('0x1a')]=qs[_0x9a7d('0x1a')](_0x49362f[_0x9a7d('0x2b')][_0x9a7d('0x1a')]);_0x1581c6['offset']=qs['offset'](_0x49362f[_0x9a7d('0x2b')]['offset']);}_0x1581c6[_0x9a7d('0x33')]=qs[_0x9a7d('0x34')](_0x49362f[_0x9a7d('0x2b')][_0x9a7d('0x34')]);_0x1581c6[_0x9a7d('0x35')]=qs[_0x9a7d('0x2d')](_[_0x9a7d('0x36')](_0x49362f[_0x9a7d('0x2b')],_0x46bfd1[_0x9a7d('0x2d')]),_0xfe41d2);if(_0x49362f['query'][_0x9a7d('0x37')]){_0x1581c6[_0x9a7d('0x35')]=_[_0x9a7d('0x38')](_0x1581c6['where'],{'$or':_['map'](_0xfe41d2,function(_0x20ac80){if(_0x20ac80[_0x9a7d('0x29')]!==_0x9a7d('0x39')){var _0x57fa76={};_0x57fa76[_0x20ac80[_0x9a7d('0x24')]]={'$like':'%'+_0x49362f['query'][_0x9a7d('0x37')]+'%'};return _0x57fa76;}})});}_0x1581c6=_['merge']({},_0x1581c6,_0x49362f[_0x9a7d('0x3a')]);var _0x4eb6a9={'where':_0x1581c6[_0x9a7d('0x35')]};return db[_0x9a7d('0x3b')][_0x9a7d('0x3c')](_0x4eb6a9)[_0x9a7d('0x21')](function(_0x44dc7b){_0x3a2e9f['count']=_0x44dc7b;if(_0x49362f[_0x9a7d('0x2b')]['includeAll']){_0x1581c6[_0x9a7d('0x3d')]=[{'all':!![]}];}return db[_0x9a7d('0x3b')][_0x9a7d('0x3e')](_0x1581c6);})['then'](function(_0x21528e){_0x3a2e9f[_0x9a7d('0x3f')]=_0x21528e;return _0x3a2e9f;})[_0x9a7d('0x21')](respondWithFilteredResult(_0x119500,_0x1581c6))[_0x9a7d('0x40')](handleError(_0x119500,null));};exports[_0x9a7d('0x41')]=function(_0x30bc32,_0x2c9654){var _0x166af2={'raw':![],'where':{'id':_0x30bc32['params']['id']}},_0x52452b={};_0x52452b[_0x9a7d('0x2a')]=_[_0x9a7d('0x2c')](db[_0x9a7d('0x3b')]['rawAttributes']);_0x52452b[_0x9a7d('0x2b')]=_[_0x9a7d('0x2c')](_0x30bc32[_0x9a7d('0x2b')]);_0x52452b[_0x9a7d('0x2d')]=_[_0x9a7d('0x2e')](_0x52452b[_0x9a7d('0x2a')],_0x52452b[_0x9a7d('0x2b')]);_0x166af2['attributes']=_[_0x9a7d('0x2e')](_0x52452b['model'],qs[_0x9a7d('0x30')](_0x30bc32['query'][_0x9a7d('0x30')]));_0x166af2[_0x9a7d('0x2f')]=_0x166af2[_0x9a7d('0x2f')][_0x9a7d('0x31')]?_0x166af2['attributes']:_0x52452b[_0x9a7d('0x2a')];if(_0x30bc32[_0x9a7d('0x2b')]['includeAll']){_0x166af2[_0x9a7d('0x3d')]=[{'all':!![]}];}_0x166af2=_[_0x9a7d('0x38')]({},_0x166af2,_0x30bc32['options']);return db['ZendeskConfiguration'][_0x9a7d('0x42')](_0x166af2)['then'](handleEntityNotFound(_0x2c9654,null))[_0x9a7d('0x21')](respondWithResult(_0x2c9654,null))[_0x9a7d('0x40')](handleError(_0x2c9654,null));};exports[_0x9a7d('0x43')]=function(_0x235ac7,_0x476952){return db[_0x9a7d('0x3b')][_0x9a7d('0x43')](_0x235ac7[_0x9a7d('0x44')],{})[_0x9a7d('0x21')](respondWithResult(_0x476952,0xc9))[_0x9a7d('0x40')](handleError(_0x476952,null));};exports[_0x9a7d('0x20')]=function(_0x1421a2,_0x4dd109){if(_0x1421a2['body']['id']){delete _0x1421a2[_0x9a7d('0x44')]['id'];}return db[_0x9a7d('0x3b')][_0x9a7d('0x42')]({'where':{'id':_0x1421a2[_0x9a7d('0x45')]['id']}})[_0x9a7d('0x21')](handleEntityNotFound(_0x4dd109,null))['then'](saveUpdates(_0x1421a2[_0x9a7d('0x44')],null))[_0x9a7d('0x21')](respondWithResult(_0x4dd109,null))[_0x9a7d('0x40')](handleError(_0x4dd109,null));};exports[_0x9a7d('0x22')]=function(_0x2fbb86,_0x4e1cf9){return db['ZendeskConfiguration'][_0x9a7d('0x42')]({'where':{'id':_0x2fbb86[_0x9a7d('0x45')]['id']}})[_0x9a7d('0x21')](handleEntityNotFound(_0x4e1cf9,null))[_0x9a7d('0x21')](removeEntity(_0x4e1cf9,null))['catch'](handleError(_0x4e1cf9,null));};exports['getFields']=function(_0x1a7683,_0x2601e8,_0x343949){var _0x44bb38={};var _0x1ecde4={};var _0xc6f9d0;var _0x5d9376;return db[_0x9a7d('0x3b')][_0x9a7d('0x46')]({'where':{'id':_0x1a7683[_0x9a7d('0x45')]['id']}})[_0x9a7d('0x21')](handleEntityNotFound(_0x2601e8,null))[_0x9a7d('0x21')](function(_0x38a53a){if(_0x38a53a){_0xc6f9d0=_0x38a53a;_0x1ecde4['model']=_[_0x9a7d('0x2c')](db[_0x9a7d('0x47')]['rawAttributes']);_0x1ecde4['query']=_[_0x9a7d('0x2c')](_0x1a7683[_0x9a7d('0x2b')]);_0x1ecde4[_0x9a7d('0x2d')]=_[_0x9a7d('0x2e')](_0x1ecde4['model'],_0x1ecde4[_0x9a7d('0x2b')]);_0x44bb38[_0x9a7d('0x2f')]=_[_0x9a7d('0x2e')](_0x1ecde4[_0x9a7d('0x2a')],qs[_0x9a7d('0x30')](_0x1a7683[_0x9a7d('0x2b')][_0x9a7d('0x30')]));_0x44bb38[_0x9a7d('0x2f')]=_0x44bb38[_0x9a7d('0x2f')][_0x9a7d('0x31')]?_0x44bb38[_0x9a7d('0x2f')]:_0x1ecde4[_0x9a7d('0x2a')];_0x44bb38[_0x9a7d('0x33')]=qs[_0x9a7d('0x34')](_0x1a7683['query'][_0x9a7d('0x34')]);_0x44bb38['where']=qs['filters'](_[_0x9a7d('0x36')](_0x1a7683[_0x9a7d('0x2b')],_0x1ecde4[_0x9a7d('0x2d')]));if(_0x1a7683['query'][_0x9a7d('0x37')]){_0x44bb38[_0x9a7d('0x35')]=_['merge'](_0x44bb38[_0x9a7d('0x35')],{'$or':_[_0x9a7d('0x27')](_0x44bb38[_0x9a7d('0x2f')],function(_0x285038){var _0x2e830e={};_0x2e830e[_0x285038]={'$like':'%'+_0x1a7683[_0x9a7d('0x2b')][_0x9a7d('0x37')]+'%'};return _0x2e830e;})});}_0x44bb38=_['merge']({},_0x44bb38,_0x1a7683['options']);return _0xc6f9d0[_0x9a7d('0x48')](_0x44bb38);}})[_0x9a7d('0x21')](function(_0x22f8e4){if(_0x22f8e4){_0x5d9376=_0x22f8e4[_0x9a7d('0x31')];if(!_0x1a7683[_0x9a7d('0x2b')][_0x9a7d('0x49')](_0x9a7d('0x32'))){_0x44bb38['limit']=qs[_0x9a7d('0x1a')](_0x1a7683[_0x9a7d('0x2b')]['limit']);_0x44bb38[_0x9a7d('0x18')]=qs[_0x9a7d('0x18')](_0x1a7683[_0x9a7d('0x2b')][_0x9a7d('0x18')]);}return _0xc6f9d0['getFields'](_0x44bb38);}})[_0x9a7d('0x21')](function(_0x2cd929){if(_0x2cd929){return _0x2cd929?{'count':_0x5d9376,'rows':_0x2cd929}:null;}})[_0x9a7d('0x21')](respondWithResult(_0x2601e8,null))['catch'](handleError(_0x2601e8,null));};exports[_0x9a7d('0x4a')]=function(_0x1a8085,_0x125153,_0x277b94){var _0x2c14f1={};var _0x4b70bf={};var _0x558f96;var _0x1d1260;return db[_0x9a7d('0x3b')][_0x9a7d('0x46')]({'where':{'id':_0x1a8085[_0x9a7d('0x45')]['id']}})[_0x9a7d('0x21')](handleEntityNotFound(_0x125153,null))['then'](function(_0x4bd637){if(_0x4bd637){_0x558f96=_0x4bd637;_0x4b70bf[_0x9a7d('0x2a')]=_['keys'](db[_0x9a7d('0x47')][_0x9a7d('0x28')]);_0x4b70bf[_0x9a7d('0x2b')]=_[_0x9a7d('0x2c')](_0x1a8085['query']);_0x4b70bf[_0x9a7d('0x2d')]=_[_0x9a7d('0x2e')](_0x4b70bf[_0x9a7d('0x2a')],_0x4b70bf[_0x9a7d('0x2b')]);_0x2c14f1[_0x9a7d('0x2f')]=_[_0x9a7d('0x2e')](_0x4b70bf[_0x9a7d('0x2a')],qs[_0x9a7d('0x30')](_0x1a8085[_0x9a7d('0x2b')]['fields']));_0x2c14f1[_0x9a7d('0x2f')]=_0x2c14f1[_0x9a7d('0x2f')][_0x9a7d('0x31')]?_0x2c14f1[_0x9a7d('0x2f')]:_0x4b70bf[_0x9a7d('0x2a')];_0x2c14f1['order']=qs[_0x9a7d('0x34')](_0x1a8085[_0x9a7d('0x2b')]['sort']);_0x2c14f1[_0x9a7d('0x35')]=qs[_0x9a7d('0x2d')](_[_0x9a7d('0x36')](_0x1a8085[_0x9a7d('0x2b')],_0x4b70bf[_0x9a7d('0x2d')]));if(_0x1a8085[_0x9a7d('0x2b')]['filter']){_0x2c14f1[_0x9a7d('0x35')]=_[_0x9a7d('0x38')](_0x2c14f1[_0x9a7d('0x35')],{'$or':_[_0x9a7d('0x27')](_0x2c14f1['attributes'],function(_0x5affad){var _0x538630={};_0x538630[_0x5affad]={'$like':'%'+_0x1a8085['query'][_0x9a7d('0x37')]+'%'};return _0x538630;})});}_0x2c14f1=_[_0x9a7d('0x38')]({},_0x2c14f1,_0x1a8085[_0x9a7d('0x3a')]);return _0x558f96[_0x9a7d('0x4a')](_0x2c14f1);}})['then'](function(_0x32afe1){if(_0x32afe1){_0x1d1260=_0x32afe1[_0x9a7d('0x31')];if(!_0x1a8085['query'][_0x9a7d('0x49')](_0x9a7d('0x32'))){_0x2c14f1[_0x9a7d('0x1a')]=qs[_0x9a7d('0x1a')](_0x1a8085[_0x9a7d('0x2b')][_0x9a7d('0x1a')]);_0x2c14f1[_0x9a7d('0x18')]=qs['offset'](_0x1a8085[_0x9a7d('0x2b')]['offset']);}return _0x558f96['getSubjects'](_0x2c14f1);}})[_0x9a7d('0x21')](function(_0x26106f){if(_0x26106f){return _0x26106f?{'count':_0x1d1260,'rows':_0x26106f}:null;}})['then'](respondWithResult(_0x125153,null))[_0x9a7d('0x40')](handleError(_0x125153,null));};exports[_0x9a7d('0x4b')]=function(_0x54d555,_0x5e1549,_0x1e8809){var _0x47fcce={};var _0x52aae9={};var _0x2b476e;var _0x19bcb1;return db[_0x9a7d('0x3b')][_0x9a7d('0x46')]({'where':{'id':_0x54d555[_0x9a7d('0x45')]['id']}})[_0x9a7d('0x21')](handleEntityNotFound(_0x5e1549,null))[_0x9a7d('0x21')](function(_0x4325e1){if(_0x4325e1){_0x2b476e=_0x4325e1;_0x52aae9[_0x9a7d('0x2a')]=_['keys'](db['ZendeskField'][_0x9a7d('0x28')]);_0x52aae9['query']=_['keys'](_0x54d555['query']);_0x52aae9[_0x9a7d('0x2d')]=_['intersection'](_0x52aae9['model'],_0x52aae9['query']);_0x47fcce[_0x9a7d('0x2f')]=_[_0x9a7d('0x2e')](_0x52aae9[_0x9a7d('0x2a')],qs['fields'](_0x54d555['query'][_0x9a7d('0x30')]));_0x47fcce[_0x9a7d('0x2f')]=_0x47fcce[_0x9a7d('0x2f')][_0x9a7d('0x31')]?_0x47fcce[_0x9a7d('0x2f')]:_0x52aae9[_0x9a7d('0x2a')];_0x47fcce['order']=qs[_0x9a7d('0x34')](_0x54d555['query']['sort']);_0x47fcce[_0x9a7d('0x35')]=qs[_0x9a7d('0x2d')](_['pick'](_0x54d555[_0x9a7d('0x2b')],_0x52aae9[_0x9a7d('0x2d')]));if(_0x54d555[_0x9a7d('0x2b')][_0x9a7d('0x37')]){_0x47fcce[_0x9a7d('0x35')]=_[_0x9a7d('0x38')](_0x47fcce['where'],{'$or':_['map'](_0x47fcce['attributes'],function(_0x5a5a87){var _0x3062a2={};_0x3062a2[_0x5a5a87]={'$like':'%'+_0x54d555[_0x9a7d('0x2b')][_0x9a7d('0x37')]+'%'};return _0x3062a2;})});}_0x47fcce=_[_0x9a7d('0x38')]({},_0x47fcce,_0x54d555[_0x9a7d('0x3a')]);return _0x2b476e[_0x9a7d('0x4b')](_0x47fcce);}})[_0x9a7d('0x21')](function(_0x1fac5d){if(_0x1fac5d){_0x19bcb1=_0x1fac5d[_0x9a7d('0x31')];if(!_0x54d555[_0x9a7d('0x2b')]['hasOwnProperty']('nolimit')){_0x47fcce[_0x9a7d('0x1a')]=qs['limit'](_0x54d555[_0x9a7d('0x2b')][_0x9a7d('0x1a')]);_0x47fcce[_0x9a7d('0x18')]=qs[_0x9a7d('0x18')](_0x54d555['query']['offset']);}return _0x2b476e[_0x9a7d('0x4b')](_0x47fcce);}})[_0x9a7d('0x21')](function(_0x24bc9b){if(_0x24bc9b){return _0x24bc9b?{'count':_0x19bcb1,'rows':_0x24bc9b}:null;}})[_0x9a7d('0x21')](respondWithResult(_0x5e1549,null))[_0x9a7d('0x40')](handleError(_0x5e1549,null));};exports[_0x9a7d('0x4c')]=function(_0x28e737,_0x1451c5,_0x5617a8){var _0x5dc95f={};var _0x8ebfa9={};var _0x2fd470;var _0x4b88ca;return db['ZendeskConfiguration'][_0x9a7d('0x46')]({'where':{'id':_0x28e737[_0x9a7d('0x45')]['id']}})[_0x9a7d('0x21')](handleEntityNotFound(_0x1451c5,null))[_0x9a7d('0x21')](function(_0x39de1a){if(_0x39de1a){_0x2fd470=_0x39de1a;_0x8ebfa9[_0x9a7d('0x2a')]=_['keys'](db[_0x9a7d('0x4d')]['rawAttributes']);_0x8ebfa9[_0x9a7d('0x2b')]=_[_0x9a7d('0x2c')](_0x28e737[_0x9a7d('0x2b')]);_0x8ebfa9['filters']=_[_0x9a7d('0x2e')](_0x8ebfa9[_0x9a7d('0x2a')],_0x8ebfa9[_0x9a7d('0x2b')]);_0x5dc95f['attributes']=_['intersection'](_0x8ebfa9[_0x9a7d('0x2a')],qs['fields'](_0x28e737[_0x9a7d('0x2b')][_0x9a7d('0x30')]));_0x5dc95f[_0x9a7d('0x2f')]=_0x5dc95f[_0x9a7d('0x2f')][_0x9a7d('0x31')]?_0x5dc95f[_0x9a7d('0x2f')]:_0x8ebfa9[_0x9a7d('0x2a')];_0x5dc95f[_0x9a7d('0x33')]=qs[_0x9a7d('0x34')](_0x28e737[_0x9a7d('0x2b')][_0x9a7d('0x34')]);_0x5dc95f[_0x9a7d('0x35')]=qs[_0x9a7d('0x2d')](_[_0x9a7d('0x36')](_0x28e737[_0x9a7d('0x2b')],_0x8ebfa9[_0x9a7d('0x2d')]));if(_0x28e737[_0x9a7d('0x2b')][_0x9a7d('0x37')]){_0x5dc95f[_0x9a7d('0x35')]=_['merge'](_0x5dc95f[_0x9a7d('0x35')],{'$or':_[_0x9a7d('0x27')](_0x5dc95f[_0x9a7d('0x2f')],function(_0x260dc4){var _0x3c7b70={};_0x3c7b70[_0x260dc4]={'$like':'%'+_0x28e737['query'][_0x9a7d('0x37')]+'%'};return _0x3c7b70;})});}_0x5dc95f=_[_0x9a7d('0x38')]({},_0x5dc95f,_0x28e737['options']);return _0x2fd470[_0x9a7d('0x4c')](_0x5dc95f);}})[_0x9a7d('0x21')](function(_0xad675){if(_0xad675){_0x4b88ca=_0xad675[_0x9a7d('0x31')];if(!_0x28e737[_0x9a7d('0x2b')][_0x9a7d('0x49')](_0x9a7d('0x32'))){_0x5dc95f[_0x9a7d('0x1a')]=qs[_0x9a7d('0x1a')](_0x28e737[_0x9a7d('0x2b')][_0x9a7d('0x1a')]);_0x5dc95f[_0x9a7d('0x18')]=qs['offset'](_0x28e737[_0x9a7d('0x2b')][_0x9a7d('0x18')]);}return _0x2fd470[_0x9a7d('0x4c')](_0x5dc95f);}})[_0x9a7d('0x21')](function(_0x2070fb){if(_0x2070fb){return _0x2070fb?{'count':_0x4b88ca,'rows':_0x2070fb}:null;}})[_0x9a7d('0x21')](respondWithResult(_0x1451c5,null))[_0x9a7d('0x40')](handleError(_0x1451c5,null));};exports['setTags']=function(_0x3e11e7,_0x1fc8b3,_0x5c795e){if(_0x3e11e7[_0x9a7d('0x44')]['id']){delete _0x3e11e7[_0x9a7d('0x44')]['id'];}return db[_0x9a7d('0x3b')][_0x9a7d('0x46')]({'where':{'id':_0x3e11e7[_0x9a7d('0x45')]['id']}})[_0x9a7d('0x21')](handleEntityNotFound(_0x1fc8b3,null))[_0x9a7d('0x21')](function(_0x4d2ea1){if(_0x4d2ea1){return _0x4d2ea1[_0x9a7d('0x4e')](_0x3e11e7[_0x9a7d('0x44')]['ids']||[]);}return null;})['then'](respondWithResult(_0x1fc8b3,null))[_0x9a7d('0x40')](handleError(_0x1fc8b3,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 0ff62b7..2705039 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 _0xd4f4=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','define','ZendeskConfiguration','int_zendesk_configurations','lodash'];(function(_0x4bb145,_0x3e7d33){var _0x4db596=function(_0x144489){while(--_0x144489){_0x4bb145['push'](_0x4bb145['shift']());}};_0x4db596(++_0x3e7d33);}(_0xd4f4,0x8b));var _0x4d4f=function(_0xb6aab9,_0x5d6163){_0xb6aab9=_0xb6aab9-0x0;var _0x1e4917=_0xd4f4[_0xb6aab9];return _0x1e4917;};'use strict';var _=require(_0x4d4f('0x0'));var util=require(_0x4d4f('0x1'));var logger=require(_0x4d4f('0x2'))(_0x4d4f('0x3'));var moment=require(_0x4d4f('0x4'));var BPromise=require(_0x4d4f('0x5'));var rp=require(_0x4d4f('0x6'));var fs=require('fs');var path=require(_0x4d4f('0x7'));var rimraf=require(_0x4d4f('0x8'));var config=require(_0x4d4f('0x9'));var attributes=require(_0x4d4f('0xa'));module['exports']=function(_0x5f451b,_0x5e38d2){return _0x5f451b[_0x4d4f('0xb')](_0x4d4f('0xc'),attributes,{'tableName':_0x4d4f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x351d=['../../config/environment','exports','ZendeskConfiguration','int_zendesk_configurations','lodash','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x97ad06,_0x3899e7){var _0xe58ac=function(_0x1a20d8){while(--_0x1a20d8){_0x97ad06['push'](_0x97ad06['shift']());}};_0xe58ac(++_0x3899e7);}(_0x351d,0x90));var _0xd351=function(_0x2da500,_0x1e4b1b){_0x2da500=_0x2da500-0x0;var _0x3725cd=_0x351d[_0x2da500];return _0x3725cd;};'use strict';var _=require(_0xd351('0x0'));var util=require('util');var logger=require(_0xd351('0x1'))(_0xd351('0x2'));var moment=require(_0xd351('0x3'));var BPromise=require('bluebird');var rp=require(_0xd351('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd351('0x5'));var config=require(_0xd351('0x6'));var attributes=require('./intZendeskConfiguration.attributes');module[_0xd351('0x7')]=function(_0x45e9e5,_0x88bd2b){return _0x45e9e5['define'](_0xd351('0x8'),attributes,{'tableName':_0xd351('0x9'),'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 fe3a175..a073a34 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 _0x01b1=['debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x01b1,0x132));var _0x101b=function(_0x36519a,_0x264ce2){_0x36519a=_0x36519a-0x0;var _0x43a91e=_0x01b1[_0x36519a];return _0x43a91e;};'use strict';var _=require(_0x101b('0x0'));var util=require(_0x101b('0x1'));var moment=require('moment');var BPromise=require(_0x101b('0x2'));var rs=require(_0x101b('0x3'));var fs=require('fs');var Redis=require(_0x101b('0x4'));var db=require(_0x101b('0x5'))['db'];var utils=require(_0x101b('0x6'));var logger=require(_0x101b('0x7'))(_0x101b('0x8'));var config=require(_0x101b('0x9'));var jayson=require(_0x101b('0xa'));var client=jayson[_0x101b('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14da8b,_0x53c2a5,_0x41d59a){return new BPromise(function(_0x52cc84,_0x495856){return client['request'](_0x14da8b,_0x41d59a)[_0x101b('0xc')](function(_0x3266d7){logger[_0x101b('0xd')](_0x101b('0xe'),_0x53c2a5,_0x101b('0xf'));logger[_0x101b('0x10')](_0x101b('0x11'),_0x53c2a5,_0x101b('0xf'),JSON[_0x101b('0x12')](_0x3266d7));if(_0x3266d7['error']){if(_0x3266d7[_0x101b('0x13')]['code']===0x1f4){logger['error'](_0x101b('0xe'),_0x53c2a5,_0x3266d7[_0x101b('0x13')][_0x101b('0x14')]);return _0x495856(_0x3266d7[_0x101b('0x13')][_0x101b('0x14')]);}logger[_0x101b('0x13')](_0x101b('0xe'),_0x53c2a5,_0x3266d7[_0x101b('0x13')][_0x101b('0x14')]);return _0x52cc84(_0x3266d7[_0x101b('0x13')][_0x101b('0x14')]);}else{logger[_0x101b('0xd')](_0x101b('0xe'),_0x53c2a5,_0x101b('0xf'));_0x52cc84(_0x3266d7[_0x101b('0x15')][_0x101b('0x14')]);}})[_0x101b('0x16')](function(_0x164c7f){logger[_0x101b('0x13')](_0x101b('0xe'),_0x53c2a5,_0x164c7f);_0x495856(_0x164c7f);});});} \ No newline at end of file +var _0x16ad=['lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x16ad,0x1e6));var _0xd16a=function(_0x364fb5,_0x543103){_0x364fb5=_0x364fb5-0x0;var _0x3e36c4=_0x16ad[_0x364fb5];return _0x3e36c4;};'use strict';var _=require(_0xd16a('0x0'));var util=require(_0xd16a('0x1'));var moment=require('moment');var BPromise=require(_0xd16a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd16a('0x3'));var db=require(_0xd16a('0x4'))['db'];var utils=require(_0xd16a('0x5'));var logger=require('../../config/logger')(_0xd16a('0x6'));var config=require('../../config/environment');var jayson=require(_0xd16a('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3ed750,_0x24d203,_0x13fd5a){return new BPromise(function(_0x18c2b0,_0xf0b12){return client['request'](_0x3ed750,_0x13fd5a)[_0xd16a('0x8')](function(_0x438c2e){logger[_0xd16a('0x9')](_0xd16a('0xa'),_0x24d203,_0xd16a('0xb'));logger[_0xd16a('0xc')](_0xd16a('0xd'),_0x24d203,'request\x20sent',JSON[_0xd16a('0xe')](_0x438c2e));if(_0x438c2e['error']){if(_0x438c2e['error']['code']===0x1f4){logger['error'](_0xd16a('0xa'),_0x24d203,_0x438c2e[_0xd16a('0xf')][_0xd16a('0x10')]);return _0xf0b12(_0x438c2e[_0xd16a('0xf')][_0xd16a('0x10')]);}logger['error'](_0xd16a('0xa'),_0x24d203,_0x438c2e[_0xd16a('0xf')][_0xd16a('0x10')]);return _0x18c2b0(_0x438c2e[_0xd16a('0xf')][_0xd16a('0x10')]);}else{logger[_0xd16a('0x9')](_0xd16a('0xa'),_0x24d203,'request\x20sent');_0x18c2b0(_0x438c2e[_0xd16a('0x11')]['message']);}})['catch'](function(_0x2ab860){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x24d203,_0x2ab860);_0xf0b12(_0x2ab860);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index eb4fff0..413b5b1 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 _0x851c=['index','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x2703c7,_0x297648){var _0x51c80a=function(_0x44e776){while(--_0x44e776){_0x2703c7['push'](_0x2703c7['shift']());}};_0x51c80a(++_0x297648);}(_0x851c,0x128));var _0xc851=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x851c[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0xc851('0x0'));var util=require(_0xc851('0x1'));var path=require(_0xc851('0x2'));var timeout=require('connect-timeout');var express=require(_0xc851('0x3'));var router=express[_0xc851('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc851('0x5'));var interaction=require(_0xc851('0x6'));var config=require(_0xc851('0x7'));var controller=require('./intZendeskField.controller');router[_0xc851('0x8')]('/',auth[_0xc851('0x9')](),controller[_0xc851('0xa')]);router[_0xc851('0x8')](_0xc851('0xb'),auth[_0xc851('0x9')](),controller[_0xc851('0xc')]);router[_0xc851('0xd')]('/',auth[_0xc851('0x9')](),controller[_0xc851('0xe')]);router[_0xc851('0xf')](_0xc851('0xb'),auth[_0xc851('0x9')](),controller['update']);router['delete'](_0xc851('0xb'),auth['isAuthenticated'](),controller[_0xc851('0x10')]);module[_0xc851('0x11')]=router; \ No newline at end of file +var _0xce2c=['./intZendeskField.controller','get','/:id','isAuthenticated','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x415260,_0x135fcb){var _0x490f21=function(_0x28d91c){while(--_0x28d91c){_0x415260['push'](_0x415260['shift']());}};_0x490f21(++_0x135fcb);}(_0xce2c,0x71));var _0xcce2=function(_0x3769d7,_0x16661b){_0x3769d7=_0x3769d7-0x0;var _0x12583=_0xce2c[_0x3769d7];return _0x12583;};'use strict';var multer=require('multer');var util=require(_0xcce2('0x0'));var path=require(_0xcce2('0x1'));var timeout=require(_0xcce2('0x2'));var express=require(_0xcce2('0x3'));var router=express['Router']();var fs_extra=require(_0xcce2('0x4'));var auth=require(_0xcce2('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xcce2('0x6'));router[_0xcce2('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xcce2('0x7')](_0xcce2('0x8'),auth[_0xcce2('0x9')](),controller['show']);router[_0xcce2('0xa')]('/',auth[_0xcce2('0x9')](),controller[_0xcce2('0xb')]);router[_0xcce2('0xc')](_0xcce2('0x8'),auth[_0xcce2('0x9')](),controller[_0xcce2('0xd')]);router[_0xcce2('0xe')](_0xcce2('0x8'),auth[_0xcce2('0x9')](),controller[_0xcce2('0xf')]);module[_0xcce2('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 6b84f91..c1343ed 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 _0xe801=['keyValue','picklist','STRING','ENUM','exports','string','variable','customVariable'];(function(_0x20e551,_0x37b0fd){var _0x38ff86=function(_0x1c4464){while(--_0x1c4464){_0x20e551['push'](_0x20e551['shift']());}};_0x38ff86(++_0x37b0fd);}(_0xe801,0xbc));var _0x1e80=function(_0x157067,_0x50f1b7){_0x157067=_0x157067-0x0;var _0x19d049=_0xe801[_0x157067];return _0x19d049;};'use strict';var Sequelize=require('sequelize');module[_0x1e80('0x0')]={'type':{'type':Sequelize['ENUM'](_0x1e80('0x1'),_0x1e80('0x2'),_0x1e80('0x3'),_0x1e80('0x4'),_0x1e80('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x1e80('0x6')]},'keyType':{'type':Sequelize[_0x1e80('0x7')]('string','variable',_0x1e80('0x3'))},'keyContent':{'type':Sequelize[_0x1e80('0x6')]},'idField':{'type':Sequelize[_0x1e80('0x6')]},'nameField':{'type':Sequelize[_0x1e80('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1e80('0x6')]}}; \ No newline at end of file +var _0x3ec1=['STRING','customVariable','exports','ENUM','string','variable','keyValue','picklist'];(function(_0x288f5e,_0x205edd){var _0x476cc9=function(_0x796f53){while(--_0x796f53){_0x288f5e['push'](_0x288f5e['shift']());}};_0x476cc9(++_0x205edd);}(_0x3ec1,0x1e2));var _0x13ec=function(_0x1f30c5,_0x327099){_0x1f30c5=_0x1f30c5-0x0;var _0x5c18ff=_0x3ec1[_0x1f30c5];return _0x5c18ff;};'use strict';var Sequelize=require('sequelize');module[_0x13ec('0x0')]={'type':{'type':Sequelize[_0x13ec('0x1')](_0x13ec('0x2'),_0x13ec('0x3'),'customVariable',_0x13ec('0x4'),_0x13ec('0x5')),'defaultValue':_0x13ec('0x2')},'content':{'type':Sequelize[_0x13ec('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x13ec('0x1')]('string',_0x13ec('0x3'),_0x13ec('0x7'))},'keyContent':{'type':Sequelize[_0x13ec('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x13ec('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 0b4f49a..952c588 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 _0xbc27=['fs-extra','lodash','squel','crypto','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','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','destroy','then','error','name','send','index','ZendeskField','rawAttributes','fieldName','type','key','model','map','keys','intersection','attributes','fields','nolimit','query','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','include','rows','catch','show','params','length','includeAll','find','create','body','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','ejs'];(function(_0x4d45c1,_0x2beda1){var _0x244478=function(_0x11304c){while(--_0x11304c){_0x4d45c1['push'](_0x4d45c1['shift']());}};_0x244478(++_0x2beda1);}(_0xbc27,0xdb));var _0x7bc2=function(_0x1aaa41,_0x70125e){_0x1aaa41=_0x1aaa41-0x0;var _0x4e368a=_0xbc27[_0x1aaa41];return _0x4e368a;};'use strict';var emlformat=require(_0x7bc2('0x0'));var rimraf=require(_0x7bc2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7bc2('0x2'));var rp=require('request-promise');var moment=require(_0x7bc2('0x3'));var BPromise=require(_0x7bc2('0x4'));var Mustache=require('mustache');var util=require(_0x7bc2('0x5'));var path=require(_0x7bc2('0x6'));var sox=require(_0x7bc2('0x7'));var csv=require('to-csv');var ejs=require(_0x7bc2('0x8'));var fs=require('fs');var fs_extra=require(_0x7bc2('0x9'));var _=require(_0x7bc2('0xa'));var squel=require(_0x7bc2('0xb'));var crypto=require(_0x7bc2('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7bc2('0xd'));var querystring=require(_0x7bc2('0xe'));var Papa=require(_0x7bc2('0xf'));var Redis=require(_0x7bc2('0x10'));var authService=require(_0x7bc2('0x11'));var qs=require(_0x7bc2('0x12'));var as=require(_0x7bc2('0x13'));var hardwareService=require(_0x7bc2('0x14'));var logger=require(_0x7bc2('0x15'))(_0x7bc2('0x16'));var utils=require(_0x7bc2('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7bc2('0x18'))['db'];function respondWithStatusCode(_0x29f6ec,_0x54918c){_0x54918c=_0x54918c||0xcc;return function(_0x3c3d5d){if(_0x3c3d5d){return _0x29f6ec[_0x7bc2('0x19')](_0x54918c);}return _0x29f6ec[_0x7bc2('0x1a')](_0x54918c)[_0x7bc2('0x1b')]();};}function respondWithResult(_0x3e2cff,_0x1d6ff4){_0x1d6ff4=_0x1d6ff4||0xc8;return function(_0x5ac7dc){if(_0x5ac7dc){return _0x3e2cff[_0x7bc2('0x1a')](_0x1d6ff4)['json'](_0x5ac7dc);}};}function respondWithFilteredResult(_0x15f3cc,_0x338250){return function(_0x55e3c7){if(_0x55e3c7){var _0x552a00=typeof _0x338250['offset']===_0x7bc2('0x1c')&&typeof _0x338250[_0x7bc2('0x1d')]===_0x7bc2('0x1c');var _0x2ebb13=_0x55e3c7[_0x7bc2('0x1e')];var _0x3da22b=_0x552a00?0x0:_0x338250['offset'];var _0x48b6d1=_0x552a00?_0x55e3c7[_0x7bc2('0x1e')]:_0x338250[_0x7bc2('0x1f')]+_0x338250['limit'];var _0x4edbe0;if(_0x48b6d1>=_0x2ebb13){_0x48b6d1=_0x2ebb13;_0x4edbe0=0xc8;}else{_0x4edbe0=0xce;}_0x15f3cc[_0x7bc2('0x1a')](_0x4edbe0);return _0x15f3cc[_0x7bc2('0x20')](_0x7bc2('0x21'),_0x3da22b+'-'+_0x48b6d1+'/'+_0x2ebb13)[_0x7bc2('0x22')](_0x55e3c7);}return null;};}function patchUpdates(_0x529b82){return function(_0x32c0a5){try{jsonpatch[_0x7bc2('0x23')](_0x32c0a5,_0x529b82,!![]);}catch(_0x19067e){return BPromise['reject'](_0x19067e);}return _0x32c0a5[_0x7bc2('0x24')]();};}function saveUpdates(_0x17731f,_0x4c1217){return function(_0x12b858){if(_0x12b858){return _0x12b858[_0x7bc2('0x25')](_0x17731f)['then'](function(_0x88c63f){return _0x88c63f;});}return null;};}function removeEntity(_0x5cd0c9,_0x103785){return function(_0x4da885){if(_0x4da885){return _0x4da885[_0x7bc2('0x26')]()[_0x7bc2('0x27')](function(){_0x5cd0c9[_0x7bc2('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5329a4,_0x3b1c9d){return function(_0x2828c6){if(!_0x2828c6){_0x5329a4[_0x7bc2('0x19')](0x194);}return _0x2828c6;};}function handleError(_0x3a3e5f,_0x1aef33){_0x1aef33=_0x1aef33||0x1f4;return function(_0x5003f6){logger[_0x7bc2('0x28')](_0x5003f6['stack']);if(_0x5003f6[_0x7bc2('0x29')]){delete _0x5003f6[_0x7bc2('0x29')];}_0x3a3e5f[_0x7bc2('0x1a')](_0x1aef33)[_0x7bc2('0x2a')](_0x5003f6);};}exports[_0x7bc2('0x2b')]=function(_0x3ef8be,_0x954742){var _0x30553e={},_0x55c9c8={},_0x22d0be={'count':0x0,'rows':[]};var _0x223831=_['map'](db[_0x7bc2('0x2c')][_0x7bc2('0x2d')],function(_0x286bc6){return{'name':_0x286bc6[_0x7bc2('0x2e')],'type':_0x286bc6[_0x7bc2('0x2f')][_0x7bc2('0x30')]};});_0x55c9c8[_0x7bc2('0x31')]=_[_0x7bc2('0x32')](_0x223831,_0x7bc2('0x29'));_0x55c9c8['query']=_[_0x7bc2('0x33')](_0x3ef8be['query']);_0x55c9c8['filters']=_[_0x7bc2('0x34')](_0x55c9c8[_0x7bc2('0x31')],_0x55c9c8['query']);_0x30553e[_0x7bc2('0x35')]=_['intersection'](_0x55c9c8[_0x7bc2('0x31')],qs[_0x7bc2('0x36')](_0x3ef8be['query'][_0x7bc2('0x36')]));_0x30553e['attributes']=_0x30553e[_0x7bc2('0x35')]['length']?_0x30553e['attributes']:_0x55c9c8[_0x7bc2('0x31')];if(!_0x3ef8be['query']['hasOwnProperty'](_0x7bc2('0x37'))){_0x30553e[_0x7bc2('0x1d')]=qs[_0x7bc2('0x1d')](_0x3ef8be[_0x7bc2('0x38')][_0x7bc2('0x1d')]);_0x30553e[_0x7bc2('0x1f')]=qs[_0x7bc2('0x1f')](_0x3ef8be['query'][_0x7bc2('0x1f')]);}_0x30553e[_0x7bc2('0x39')]=qs[_0x7bc2('0x3a')](_0x3ef8be[_0x7bc2('0x38')]['sort']);_0x30553e['where']=qs[_0x7bc2('0x3b')](_[_0x7bc2('0x3c')](_0x3ef8be[_0x7bc2('0x38')],_0x55c9c8[_0x7bc2('0x3b')]),_0x223831);if(_0x3ef8be[_0x7bc2('0x38')][_0x7bc2('0x3d')]){_0x30553e[_0x7bc2('0x3e')]=_[_0x7bc2('0x3f')](_0x30553e[_0x7bc2('0x3e')],{'$or':_[_0x7bc2('0x32')](_0x223831,function(_0x2cde5d){if(_0x2cde5d[_0x7bc2('0x2f')]!==_0x7bc2('0x40')){var _0x1c1201={};_0x1c1201[_0x2cde5d['name']]={'$like':'%'+_0x3ef8be[_0x7bc2('0x38')]['filter']+'%'};return _0x1c1201;}})});}_0x30553e=_['merge']({},_0x30553e,_0x3ef8be[_0x7bc2('0x41')]);var _0x4b1e28={'where':_0x30553e['where']};return db['ZendeskField'][_0x7bc2('0x1e')](_0x4b1e28)[_0x7bc2('0x27')](function(_0x96468){_0x22d0be[_0x7bc2('0x1e')]=_0x96468;if(_0x3ef8be[_0x7bc2('0x38')]['includeAll']){_0x30553e[_0x7bc2('0x42')]=[{'all':!![]}];}return db[_0x7bc2('0x2c')]['findAll'](_0x30553e);})[_0x7bc2('0x27')](function(_0x192217){_0x22d0be[_0x7bc2('0x43')]=_0x192217;return _0x22d0be;})[_0x7bc2('0x27')](respondWithFilteredResult(_0x954742,_0x30553e))[_0x7bc2('0x44')](handleError(_0x954742,null));};exports[_0x7bc2('0x45')]=function(_0x3be312,_0x459ffa){var _0x1173c5={'raw':!![],'where':{'id':_0x3be312[_0x7bc2('0x46')]['id']}},_0x4e5f53={};_0x4e5f53['model']=_[_0x7bc2('0x33')](db[_0x7bc2('0x2c')][_0x7bc2('0x2d')]);_0x4e5f53[_0x7bc2('0x38')]=_[_0x7bc2('0x33')](_0x3be312[_0x7bc2('0x38')]);_0x4e5f53[_0x7bc2('0x3b')]=_[_0x7bc2('0x34')](_0x4e5f53[_0x7bc2('0x31')],_0x4e5f53[_0x7bc2('0x38')]);_0x1173c5[_0x7bc2('0x35')]=_[_0x7bc2('0x34')](_0x4e5f53['model'],qs['fields'](_0x3be312[_0x7bc2('0x38')][_0x7bc2('0x36')]));_0x1173c5[_0x7bc2('0x35')]=_0x1173c5['attributes'][_0x7bc2('0x47')]?_0x1173c5['attributes']:_0x4e5f53['model'];if(_0x3be312[_0x7bc2('0x38')][_0x7bc2('0x48')]){_0x1173c5[_0x7bc2('0x42')]=[{'all':!![]}];}_0x1173c5=_['merge']({},_0x1173c5,_0x3be312[_0x7bc2('0x41')]);return db[_0x7bc2('0x2c')][_0x7bc2('0x49')](_0x1173c5)['then'](handleEntityNotFound(_0x459ffa,null))['then'](respondWithResult(_0x459ffa,null))[_0x7bc2('0x44')](handleError(_0x459ffa,null));};exports[_0x7bc2('0x4a')]=function(_0xf41b4,_0x18a545){return db[_0x7bc2('0x2c')][_0x7bc2('0x4a')](_0xf41b4[_0x7bc2('0x4b')],{})[_0x7bc2('0x27')](respondWithResult(_0x18a545,0xc9))[_0x7bc2('0x44')](handleError(_0x18a545,null));};exports[_0x7bc2('0x25')]=function(_0x1240c9,_0x1e9a06){if(_0x1240c9['body']['id']){delete _0x1240c9['body']['id'];}return db[_0x7bc2('0x2c')][_0x7bc2('0x49')]({'where':{'id':_0x1240c9[_0x7bc2('0x46')]['id']}})[_0x7bc2('0x27')](handleEntityNotFound(_0x1e9a06,null))[_0x7bc2('0x27')](saveUpdates(_0x1240c9['body'],null))[_0x7bc2('0x27')](respondWithResult(_0x1e9a06,null))[_0x7bc2('0x44')](handleError(_0x1e9a06,null));};exports['destroy']=function(_0x43a8a3,_0x5e8c4e){return db[_0x7bc2('0x2c')][_0x7bc2('0x49')]({'where':{'id':_0x43a8a3[_0x7bc2('0x46')]['id']}})['then'](handleEntityNotFound(_0x5e8c4e,null))[_0x7bc2('0x27')](removeEntity(_0x5e8c4e,null))[_0x7bc2('0x44')](handleError(_0x5e8c4e,null));}; \ No newline at end of file +var _0xe688=['type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','catch','create','body','find','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','count','set','apply','save','update','then','destroy','error','name','index','ZendeskField','rawAttributes','fieldName'];(function(_0x4d79bc,_0x32c905){var _0x4b4760=function(_0x212302){while(--_0x212302){_0x4d79bc['push'](_0x4d79bc['shift']());}};_0x4b4760(++_0x32c905);}(_0xe688,0xac));var _0x8e68=function(_0x31b6c1,_0x4f1400){_0x31b6c1=_0x31b6c1-0x0;var _0x6ea59f=_0xe688[_0x31b6c1];return _0x6ea59f;};'use strict';var emlformat=require(_0x8e68('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8e68('0x1'));var jsonpatch=require(_0x8e68('0x2'));var rp=require('request-promise');var moment=require(_0x8e68('0x3'));var BPromise=require(_0x8e68('0x4'));var Mustache=require(_0x8e68('0x5'));var util=require('util');var path=require(_0x8e68('0x6'));var sox=require(_0x8e68('0x7'));var csv=require(_0x8e68('0x8'));var ejs=require(_0x8e68('0x9'));var fs=require('fs');var fs_extra=require(_0x8e68('0xa'));var _=require(_0x8e68('0xb'));var squel=require(_0x8e68('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8e68('0xd'));var toCsv=require(_0x8e68('0x8'));var querystring=require(_0x8e68('0xe'));var Papa=require('papaparse');var Redis=require(_0x8e68('0xf'));var authService=require(_0x8e68('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8e68('0x11'));var logger=require(_0x8e68('0x12'))(_0x8e68('0x13'));var utils=require(_0x8e68('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x8e68('0x15'));var db=require(_0x8e68('0x16'))['db'];function respondWithStatusCode(_0x32af96,_0x20ce35){_0x20ce35=_0x20ce35||0xcc;return function(_0x52e32f){if(_0x52e32f){return _0x32af96[_0x8e68('0x17')](_0x20ce35);}return _0x32af96[_0x8e68('0x18')](_0x20ce35)[_0x8e68('0x19')]();};}function respondWithResult(_0x16c2b1,_0x31aaa1){_0x31aaa1=_0x31aaa1||0xc8;return function(_0x10ab36){if(_0x10ab36){return _0x16c2b1[_0x8e68('0x18')](_0x31aaa1)['json'](_0x10ab36);}};}function respondWithFilteredResult(_0xc03048,_0x23298a){return function(_0x4ef24e){if(_0x4ef24e){var _0x5c9435=typeof _0x23298a[_0x8e68('0x1a')]==='undefined'&&typeof _0x23298a[_0x8e68('0x1b')]==='undefined';var _0x275eb4=_0x4ef24e['count'];var _0x35fc31=_0x5c9435?0x0:_0x23298a[_0x8e68('0x1a')];var _0x100f1e=_0x5c9435?_0x4ef24e[_0x8e68('0x1c')]:_0x23298a[_0x8e68('0x1a')]+_0x23298a['limit'];var _0x1880bc;if(_0x100f1e>=_0x275eb4){_0x100f1e=_0x275eb4;_0x1880bc=0xc8;}else{_0x1880bc=0xce;}_0xc03048['status'](_0x1880bc);return _0xc03048[_0x8e68('0x1d')]('Content-Range',_0x35fc31+'-'+_0x100f1e+'/'+_0x275eb4)['json'](_0x4ef24e);}return null;};}function patchUpdates(_0x551772){return function(_0x43c4e8){try{jsonpatch[_0x8e68('0x1e')](_0x43c4e8,_0x551772,!![]);}catch(_0x4b22ce){return BPromise['reject'](_0x4b22ce);}return _0x43c4e8[_0x8e68('0x1f')]();};}function saveUpdates(_0x14a4de,_0x4672d7){return function(_0x3c30dd){if(_0x3c30dd){return _0x3c30dd[_0x8e68('0x20')](_0x14a4de)[_0x8e68('0x21')](function(_0x6a4f25){return _0x6a4f25;});}return null;};}function removeEntity(_0xd7476a,_0x2769ca){return function(_0x4942f8){if(_0x4942f8){return _0x4942f8[_0x8e68('0x22')]()[_0x8e68('0x21')](function(){_0xd7476a[_0x8e68('0x18')](0xcc)[_0x8e68('0x19')]();});}};}function handleEntityNotFound(_0x199134,_0x176c2d){return function(_0x263099){if(!_0x263099){_0x199134[_0x8e68('0x17')](0x194);}return _0x263099;};}function handleError(_0x4ba2d7,_0x28fe4b){_0x28fe4b=_0x28fe4b||0x1f4;return function(_0x1e556d){logger[_0x8e68('0x23')](_0x1e556d['stack']);if(_0x1e556d['name']){delete _0x1e556d[_0x8e68('0x24')];}_0x4ba2d7['status'](_0x28fe4b)['send'](_0x1e556d);};}exports[_0x8e68('0x25')]=function(_0x333301,_0x34c1e5){var _0xdf29c6={},_0x28cbb5={},_0x328178={'count':0x0,'rows':[]};var _0xe9038=_['map'](db[_0x8e68('0x26')][_0x8e68('0x27')],function(_0x1e7afa){return{'name':_0x1e7afa[_0x8e68('0x28')],'type':_0x1e7afa[_0x8e68('0x29')][_0x8e68('0x2a')]};});_0x28cbb5[_0x8e68('0x2b')]=_[_0x8e68('0x2c')](_0xe9038,_0x8e68('0x24'));_0x28cbb5[_0x8e68('0x2d')]=_[_0x8e68('0x2e')](_0x333301['query']);_0x28cbb5[_0x8e68('0x2f')]=_[_0x8e68('0x30')](_0x28cbb5[_0x8e68('0x2b')],_0x28cbb5[_0x8e68('0x2d')]);_0xdf29c6[_0x8e68('0x31')]=_['intersection'](_0x28cbb5['model'],qs[_0x8e68('0x32')](_0x333301[_0x8e68('0x2d')][_0x8e68('0x32')]));_0xdf29c6[_0x8e68('0x31')]=_0xdf29c6['attributes'][_0x8e68('0x33')]?_0xdf29c6[_0x8e68('0x31')]:_0x28cbb5[_0x8e68('0x2b')];if(!_0x333301[_0x8e68('0x2d')]['hasOwnProperty'](_0x8e68('0x34'))){_0xdf29c6[_0x8e68('0x1b')]=qs[_0x8e68('0x1b')](_0x333301[_0x8e68('0x2d')][_0x8e68('0x1b')]);_0xdf29c6[_0x8e68('0x1a')]=qs['offset'](_0x333301[_0x8e68('0x2d')][_0x8e68('0x1a')]);}_0xdf29c6[_0x8e68('0x35')]=qs[_0x8e68('0x36')](_0x333301[_0x8e68('0x2d')][_0x8e68('0x36')]);_0xdf29c6[_0x8e68('0x37')]=qs[_0x8e68('0x2f')](_[_0x8e68('0x38')](_0x333301['query'],_0x28cbb5['filters']),_0xe9038);if(_0x333301[_0x8e68('0x2d')][_0x8e68('0x39')]){_0xdf29c6['where']=_[_0x8e68('0x3a')](_0xdf29c6[_0x8e68('0x37')],{'$or':_[_0x8e68('0x2c')](_0xe9038,function(_0xba5529){if(_0xba5529['type']!==_0x8e68('0x3b')){var _0x32741e={};_0x32741e[_0xba5529[_0x8e68('0x24')]]={'$like':'%'+_0x333301['query']['filter']+'%'};return _0x32741e;}})});}_0xdf29c6=_[_0x8e68('0x3a')]({},_0xdf29c6,_0x333301[_0x8e68('0x3c')]);var _0x29fe5d={'where':_0xdf29c6[_0x8e68('0x37')]};return db[_0x8e68('0x26')][_0x8e68('0x1c')](_0x29fe5d)[_0x8e68('0x21')](function(_0x613b9f){_0x328178['count']=_0x613b9f;if(_0x333301[_0x8e68('0x2d')][_0x8e68('0x3d')]){_0xdf29c6[_0x8e68('0x3e')]=[{'all':!![]}];}return db[_0x8e68('0x26')][_0x8e68('0x3f')](_0xdf29c6);})[_0x8e68('0x21')](function(_0x45c0c7){_0x328178[_0x8e68('0x40')]=_0x45c0c7;return _0x328178;})['then'](respondWithFilteredResult(_0x34c1e5,_0xdf29c6))['catch'](handleError(_0x34c1e5,null));};exports[_0x8e68('0x41')]=function(_0xdc9978,_0x14603f){var _0x2748e0={'raw':!![],'where':{'id':_0xdc9978[_0x8e68('0x42')]['id']}},_0x33c86d={};_0x33c86d[_0x8e68('0x2b')]=_[_0x8e68('0x2e')](db[_0x8e68('0x26')][_0x8e68('0x27')]);_0x33c86d[_0x8e68('0x2d')]=_[_0x8e68('0x2e')](_0xdc9978[_0x8e68('0x2d')]);_0x33c86d[_0x8e68('0x2f')]=_[_0x8e68('0x30')](_0x33c86d[_0x8e68('0x2b')],_0x33c86d[_0x8e68('0x2d')]);_0x2748e0[_0x8e68('0x31')]=_['intersection'](_0x33c86d[_0x8e68('0x2b')],qs[_0x8e68('0x32')](_0xdc9978[_0x8e68('0x2d')][_0x8e68('0x32')]));_0x2748e0[_0x8e68('0x31')]=_0x2748e0[_0x8e68('0x31')]['length']?_0x2748e0[_0x8e68('0x31')]:_0x33c86d[_0x8e68('0x2b')];if(_0xdc9978['query'][_0x8e68('0x3d')]){_0x2748e0['include']=[{'all':!![]}];}_0x2748e0=_[_0x8e68('0x3a')]({},_0x2748e0,_0xdc9978[_0x8e68('0x3c')]);return db[_0x8e68('0x26')]['find'](_0x2748e0)[_0x8e68('0x21')](handleEntityNotFound(_0x14603f,null))[_0x8e68('0x21')](respondWithResult(_0x14603f,null))[_0x8e68('0x43')](handleError(_0x14603f,null));};exports[_0x8e68('0x44')]=function(_0x1fec08,_0x133025){return db[_0x8e68('0x26')][_0x8e68('0x44')](_0x1fec08[_0x8e68('0x45')],{})['then'](respondWithResult(_0x133025,0xc9))['catch'](handleError(_0x133025,null));};exports[_0x8e68('0x20')]=function(_0x27ac20,_0x1849e0){if(_0x27ac20[_0x8e68('0x45')]['id']){delete _0x27ac20[_0x8e68('0x45')]['id'];}return db['ZendeskField'][_0x8e68('0x46')]({'where':{'id':_0x27ac20[_0x8e68('0x42')]['id']}})[_0x8e68('0x21')](handleEntityNotFound(_0x1849e0,null))[_0x8e68('0x21')](saveUpdates(_0x27ac20[_0x8e68('0x45')],null))['then'](respondWithResult(_0x1849e0,null))['catch'](handleError(_0x1849e0,null));};exports[_0x8e68('0x22')]=function(_0x233e1b,_0x48fedc){return db[_0x8e68('0x26')][_0x8e68('0x46')]({'where':{'id':_0x233e1b[_0x8e68('0x42')]['id']}})[_0x8e68('0x21')](handleEntityNotFound(_0x48fedc,null))[_0x8e68('0x21')](removeEntity(_0x48fedc,null))[_0x8e68('0x43')](handleError(_0x48fedc,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 07694f2..696f3aa 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 _0x492b=['moment','rimraf','../../config/environment','./intZendeskField.attributes','exports','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','../../config/logger'];(function(_0x49a57c,_0x2eb02c){var _0x4e0316=function(_0x37e2e5){while(--_0x37e2e5){_0x49a57c['push'](_0x49a57c['shift']());}};_0x4e0316(++_0x2eb02c);}(_0x492b,0x1ea));var _0xb492=function(_0x39057f,_0x3739bc){_0x39057f=_0x39057f-0x0;var _0x220352=_0x492b[_0x39057f];return _0x220352;};'use strict';var _=require(_0xb492('0x0'));var util=require('util');var logger=require(_0xb492('0x1'))('api');var moment=require(_0xb492('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb492('0x3'));var config=require(_0xb492('0x4'));var attributes=require(_0xb492('0x5'));module[_0xb492('0x6')]=function(_0x1e0742,_0x56eda0){return _0x1e0742['define'](_0xb492('0x7'),attributes,{'tableName':_0xb492('0x8'),'paranoid':![],'indexes':[{'name':_0xb492('0x9'),'fields':[_0xb492('0xa'),_0xb492('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8e03=['../../config/environment','ZendeskField','int_zendesk_fields','zendesk_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x255f36,_0x794123){var _0x27f10e=function(_0x57538c){while(--_0x57538c){_0x255f36['push'](_0x255f36['shift']());}};_0x27f10e(++_0x794123);}(_0x8e03,0x1c1));var _0x38e0=function(_0x4f2ceb,_0x29d722){_0x4f2ceb=_0x4f2ceb-0x0;var _0x20a1d2=_0x8e03[_0x4f2ceb];return _0x20a1d2;};'use strict';var _=require(_0x38e0('0x0'));var util=require(_0x38e0('0x1'));var logger=require(_0x38e0('0x2'))(_0x38e0('0x3'));var moment=require(_0x38e0('0x4'));var BPromise=require(_0x38e0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x38e0('0x6'));var rimraf=require('rimraf');var config=require(_0x38e0('0x7'));var attributes=require('./intZendeskField.attributes');module['exports']=function(_0x3c2034,_0x580c1e){return _0x3c2034['define'](_0x38e0('0x8'),attributes,{'tableName':_0x38e0('0x9'),'paranoid':![],'indexes':[{'name':_0x38e0('0xa'),'fields':['idField',_0x38e0('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index f1aa260..94f3a9c 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 _0x76c8=['ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','info','ZendeskField,\x20%s,\x20%s','request\x20sent'];(function(_0x5c18ef,_0xa2e81d){var _0x33789d=function(_0x5761a9){while(--_0x5761a9){_0x5c18ef['push'](_0x5c18ef['shift']());}};_0x33789d(++_0xa2e81d);}(_0x76c8,0xbb));var _0x876c=function(_0x1a6e20,_0x5d37cd){_0x1a6e20=_0x1a6e20-0x0;var _0x4f5f28=_0x76c8[_0x1a6e20];return _0x4f5f28;};'use strict';var _=require(_0x876c('0x0'));var util=require(_0x876c('0x1'));var moment=require(_0x876c('0x2'));var BPromise=require('bluebird');var rs=require(_0x876c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x876c('0x4'))['db'];var utils=require(_0x876c('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x876c('0x6'));var jayson=require(_0x876c('0x7'));var client=jayson[_0x876c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3239d0,_0x49f75c,_0x203296){return new BPromise(function(_0x5806e8,_0xa2f938){return client[_0x876c('0x9')](_0x3239d0,_0x203296)['then'](function(_0x2b4a0e){logger[_0x876c('0xa')](_0x876c('0xb'),_0x49f75c,_0x876c('0xc'));logger['debug'](_0x876c('0xd'),_0x49f75c,'request\x20sent',JSON[_0x876c('0xe')](_0x2b4a0e));if(_0x2b4a0e[_0x876c('0xf')]){if(_0x2b4a0e[_0x876c('0xf')][_0x876c('0x10')]===0x1f4){logger[_0x876c('0xf')](_0x876c('0xb'),_0x49f75c,_0x2b4a0e['error'][_0x876c('0x11')]);return _0xa2f938(_0x2b4a0e[_0x876c('0xf')][_0x876c('0x11')]);}logger[_0x876c('0xf')]('ZendeskField,\x20%s,\x20%s',_0x49f75c,_0x2b4a0e[_0x876c('0xf')]['message']);return _0x5806e8(_0x2b4a0e[_0x876c('0xf')][_0x876c('0x11')]);}else{logger[_0x876c('0xa')]('ZendeskField,\x20%s,\x20%s',_0x49f75c,_0x876c('0xc'));_0x5806e8(_0x2b4a0e[_0x876c('0x12')]['message']);}})[_0x876c('0x13')](function(_0x5cd13a){logger[_0x876c('0xf')]('ZendeskField,\x20%s,\x20%s',_0x49f75c,_0x5cd13a);_0xa2f938(_0x5cd13a);});});} \ No newline at end of file +var _0xdf1d=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','then','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','bluebird','randomstring','ioredis'];(function(_0x3132e8,_0x499a0e){var _0x43eb8c=function(_0x2321e1){while(--_0x2321e1){_0x3132e8['push'](_0x3132e8['shift']());}};_0x43eb8c(++_0x499a0e);}(_0xdf1d,0x18b));var _0xddf1=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0xdf1d[_0x2dea24];return _0x309d58;};'use strict';var _=require(_0xddf1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xddf1('0x1'));var rs=require(_0xddf1('0x2'));var fs=require('fs');var Redis=require(_0xddf1('0x3'));var db=require(_0xddf1('0x4'))['db'];var utils=require(_0xddf1('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xddf1('0x6'));var jayson=require(_0xddf1('0x7'));var client=jayson['client'][_0xddf1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5e47bd,_0x40f940,_0x160b97){return new BPromise(function(_0x498285,_0x113076){return client['request'](_0x5e47bd,_0x160b97)[_0xddf1('0x9')](function(_0x342f63){logger['info'](_0xddf1('0xa'),_0x40f940,'request\x20sent');logger[_0xddf1('0xb')](_0xddf1('0xc'),_0x40f940,_0xddf1('0xd'),JSON[_0xddf1('0xe')](_0x342f63));if(_0x342f63[_0xddf1('0xf')]){if(_0x342f63['error'][_0xddf1('0x10')]===0x1f4){logger[_0xddf1('0xf')](_0xddf1('0xa'),_0x40f940,_0x342f63[_0xddf1('0xf')][_0xddf1('0x11')]);return _0x113076(_0x342f63[_0xddf1('0xf')][_0xddf1('0x11')]);}logger[_0xddf1('0xf')](_0xddf1('0xa'),_0x40f940,_0x342f63['error']['message']);return _0x498285(_0x342f63[_0xddf1('0xf')][_0xddf1('0x11')]);}else{logger[_0xddf1('0x12')](_0xddf1('0xa'),_0x40f940,_0xddf1('0xd'));_0x498285(_0x342f63[_0xddf1('0x13')][_0xddf1('0x11')]);}})[_0xddf1('0x14')](function(_0x69c1c5){logger[_0xddf1('0xf')](_0xddf1('0xa'),_0x40f940,_0x69c1c5);_0x113076(_0x69c1c5);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index fb38f26..ebabe58 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 _0x5c17=['destroy','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','put','update'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x5c17,0x1ba));var _0x75c1=function(_0x2ce97f,_0x2452a2){_0x2ce97f=_0x2ce97f-0x0;var _0x4d984e=_0x5c17[_0x2ce97f];return _0x4d984e;};'use strict';var multer=require(_0x75c1('0x0'));var util=require(_0x75c1('0x1'));var path=require('path');var timeout=require(_0x75c1('0x2'));var express=require(_0x75c1('0x3'));var router=express['Router']();var fs_extra=require(_0x75c1('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x75c1('0x5'));var config=require(_0x75c1('0x6'));var controller=require(_0x75c1('0x7'));router[_0x75c1('0x8')]('/',auth[_0x75c1('0x9')](),controller[_0x75c1('0xa')]);router[_0x75c1('0x8')](_0x75c1('0xb'),auth[_0x75c1('0x9')](),controller['show']);router[_0x75c1('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x75c1('0xc')]);router[_0x75c1('0x8')](_0x75c1('0xd'),auth['isAuthenticated'](),controller[_0x75c1('0xe')]);router[_0x75c1('0xf')]('/',auth[_0x75c1('0x9')](),controller[_0x75c1('0x10')]);router['post'](_0x75c1('0x11'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x75c1('0x12')](_0x75c1('0xb'),auth[_0x75c1('0x9')](),controller[_0x75c1('0x13')]);router['delete'](_0x75c1('0xb'),auth['isAuthenticated'](),controller[_0x75c1('0x14')]);module['exports']=router; \ No newline at end of file +var _0x3e68=['Router','../../components/interaction/service','./intZohoAccount.controller','get','isAuthenticated','/:id','getConfigurations','/:id/fields','getFields','post','/:id/configurations','put','update','delete','destroy','exports','path'];(function(_0x33a4c2,_0x4e6423){var _0x1ef61b=function(_0x3ed71e){while(--_0x3ed71e){_0x33a4c2['push'](_0x33a4c2['shift']());}};_0x1ef61b(++_0x4e6423);}(_0x3e68,0x142));var _0x83e6=function(_0x50f3b6,_0x408e6a){_0x50f3b6=_0x50f3b6-0x0;var _0x3b1245=_0x3e68[_0x50f3b6];return _0x3b1245;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x83e6('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x83e6('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x83e6('0x2'));var config=require('../../config/environment');var controller=require(_0x83e6('0x3'));router[_0x83e6('0x4')]('/',auth[_0x83e6('0x5')](),controller['index']);router['get'](_0x83e6('0x6'),auth[_0x83e6('0x5')](),controller['show']);router[_0x83e6('0x4')]('/:id/configurations',auth[_0x83e6('0x5')](),controller[_0x83e6('0x7')]);router[_0x83e6('0x4')](_0x83e6('0x8'),auth[_0x83e6('0x5')](),controller[_0x83e6('0x9')]);router[_0x83e6('0xa')]('/',auth[_0x83e6('0x5')](),controller['create']);router[_0x83e6('0xa')](_0x83e6('0xb'),auth[_0x83e6('0x5')](),controller['addConfiguration']);router[_0x83e6('0xc')]('/:id',auth[_0x83e6('0x5')](),controller[_0x83e6('0xd')]);router[_0x83e6('0xe')](_0x83e6('0x6'),auth[_0x83e6('0x5')](),controller[_0x83e6('0xf')]);module[_0x83e6('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 6e9e04c..0ee95b7 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 _0xa9e0=['sequelize','exports','STRING'];(function(_0x33e93d,_0x1a8423){var _0x19e99d=function(_0x194faa){while(--_0x194faa){_0x33e93d['push'](_0x33e93d['shift']());}};_0x19e99d(++_0x1a8423);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x0a9e('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x0a9e('0x2')]},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x0a9e('0x2')]},'refreshToken':{'type':Sequelize[_0x0a9e('0x2')]}}; \ No newline at end of file +var _0x4b84=['STRING','sequelize','exports'];(function(_0x41c720,_0x10c2ce){var _0x19ff2e=function(_0x38d1ee){while(--_0x38d1ee){_0x41c720['push'](_0x41c720['shift']());}};_0x19ff2e(++_0x10c2ce);}(_0x4b84,0x1cc));var _0x44b8=function(_0x1e2321,_0x3ae1c5){_0x1e2321=_0x1e2321-0x0;var _0x1d346d=_0x4b84[_0x1e2321];return _0x1d346d;};'use strict';var Sequelize=require(_0x44b8('0x0'));module[_0x44b8('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x44b8('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x44b8('0x2')]},'serverUrl':{'type':Sequelize[_0x44b8('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x44b8('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 44d8f05..7c69664 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 _0xfac7=['serverUrl','host','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','Owner','Subject','Description','Call_Duration','Call_Start_Time','Call_Type','system_mandatory','push','custom_field','data_type','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','keys','filters','attributes','intersection','fields','query','hasOwnProperty','nolimit','limit','order','sort','where','VIRTUAL','filter','merge','options','ZohoAccount','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','findOne','ZohoConfiguration','pick','getConfigurations','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','/oauth/v2/token','refreshToken','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields'];(function(_0x2a6bac,_0x893ebb){var _0x30fac6=function(_0x4fb495){while(--_0x4fb495){_0x2a6bac['push'](_0x2a6bac['shift']());}};_0x30fac6(++_0x893ebb);}(_0xfac7,0x190));var _0x7fac=function(_0x234318,_0xf22f31){_0x234318=_0x234318-0x0;var _0x1ab719=_0xfac7[_0x234318];return _0x1ab719;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7fac('0x0'));var zipdir=require(_0x7fac('0x1'));var jsonpatch=require(_0x7fac('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7fac('0x3'));var path=require(_0x7fac('0x4'));var sox=require(_0x7fac('0x5'));var csv=require('to-csv');var ejs=require(_0x7fac('0x6'));var fs=require('fs');var fs_extra=require(_0x7fac('0x7'));var _=require('lodash');var squel=require(_0x7fac('0x8'));var crypto=require(_0x7fac('0x9'));var jsforce=require(_0x7fac('0xa'));var deskjs=require(_0x7fac('0xb'));var toCsv=require(_0x7fac('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7fac('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x7fac('0xe'));var hardwareService=require(_0x7fac('0xf'));var logger=require(_0x7fac('0x10'))(_0x7fac('0x11'));var utils=require(_0x7fac('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x7fac('0x13'));var db=require(_0x7fac('0x14'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x13d745,_0x5bd473){_0x5bd473=_0x5bd473||0xcc;return function(_0x41b8bd){if(_0x41b8bd){return _0x13d745[_0x7fac('0x15')](_0x5bd473);}return _0x13d745[_0x7fac('0x16')](_0x5bd473)[_0x7fac('0x17')]();};}function respondWithResult(_0x458bf2,_0x40d4d1){_0x40d4d1=_0x40d4d1||0xc8;return function(_0x496fbb){if(_0x496fbb){return _0x458bf2['status'](_0x40d4d1)[_0x7fac('0x18')](_0x496fbb);}};}function respondWithFilteredResult(_0x2d91e7,_0x565df2){return function(_0x212b67){if(_0x212b67){var _0x2b90ec=typeof _0x565df2[_0x7fac('0x19')]===_0x7fac('0x1a')&&typeof _0x565df2['limit']===_0x7fac('0x1a');var _0x1116a4=_0x212b67[_0x7fac('0x1b')];var _0x41622e=_0x2b90ec?0x0:_0x565df2[_0x7fac('0x19')];var _0x27396c=_0x2b90ec?_0x212b67[_0x7fac('0x1b')]:_0x565df2[_0x7fac('0x19')]+_0x565df2['limit'];var _0x4e5ed3;if(_0x27396c>=_0x1116a4){_0x27396c=_0x1116a4;_0x4e5ed3=0xc8;}else{_0x4e5ed3=0xce;}_0x2d91e7[_0x7fac('0x16')](_0x4e5ed3);return _0x2d91e7[_0x7fac('0x1c')](_0x7fac('0x1d'),_0x41622e+'-'+_0x27396c+'/'+_0x1116a4)[_0x7fac('0x18')](_0x212b67);}return null;};}function patchUpdates(_0x115555){return function(_0x351d68){try{jsonpatch[_0x7fac('0x1e')](_0x351d68,_0x115555,!![]);}catch(_0x2fcc93){return BPromise[_0x7fac('0x1f')](_0x2fcc93);}return _0x351d68[_0x7fac('0x20')]();};}function saveUpdates(_0x27a7bd,_0x4c17e4){return function(_0x22d700){if(_0x22d700){return _0x22d700[_0x7fac('0x21')](_0x27a7bd)[_0x7fac('0x22')](function(_0x470e0c){return _0x470e0c;});}return null;};}function removeEntity(_0x33a8e6,_0xe2f9a1){return function(_0x112aa8){if(_0x112aa8){return _0x112aa8[_0x7fac('0x23')]()[_0x7fac('0x22')](function(){_0x33a8e6['status'](0xcc)[_0x7fac('0x17')]();});}};}function handleEntityNotFound(_0x1ba9b1,_0x566491){return function(_0x411dd7){if(!_0x411dd7){_0x1ba9b1[_0x7fac('0x15')](0x194);}return _0x411dd7;};}function handleError(_0x310b2d,_0x18f331){_0x18f331=_0x18f331||0x1f4;return function(_0x318a24){logger[_0x7fac('0x24')](_0x318a24[_0x7fac('0x25')]);if(_0x318a24['name']){delete _0x318a24[_0x7fac('0x26')];}_0x310b2d[_0x7fac('0x16')](_0x18f331)[_0x7fac('0x27')](_0x318a24);};}exports['index']=function(_0x4384e1,_0xcd4751){var _0x1bad57={},_0x57665b={},_0x42c377={'count':0x0,'rows':[]};var _0x29fb77=_[_0x7fac('0x28')](db['ZohoAccount'][_0x7fac('0x29')],function(_0x3f7e95){return{'name':_0x3f7e95[_0x7fac('0x2a')],'type':_0x3f7e95[_0x7fac('0x2b')][_0x7fac('0x2c')]};});_0x57665b[_0x7fac('0x2d')]=_[_0x7fac('0x28')](_0x29fb77,_0x7fac('0x26'));_0x57665b['query']=_[_0x7fac('0x2e')](_0x4384e1['query']);_0x57665b[_0x7fac('0x2f')]=_['intersection'](_0x57665b[_0x7fac('0x2d')],_0x57665b['query']);_0x1bad57[_0x7fac('0x30')]=_[_0x7fac('0x31')](_0x57665b['model'],qs[_0x7fac('0x32')](_0x4384e1[_0x7fac('0x33')][_0x7fac('0x32')]));_0x1bad57[_0x7fac('0x30')]=_0x1bad57[_0x7fac('0x30')]['length']?_0x1bad57[_0x7fac('0x30')]:_0x57665b[_0x7fac('0x2d')];if(!_0x4384e1[_0x7fac('0x33')][_0x7fac('0x34')](_0x7fac('0x35'))){_0x1bad57['limit']=qs[_0x7fac('0x36')](_0x4384e1[_0x7fac('0x33')][_0x7fac('0x36')]);_0x1bad57[_0x7fac('0x19')]=qs[_0x7fac('0x19')](_0x4384e1[_0x7fac('0x33')][_0x7fac('0x19')]);}_0x1bad57[_0x7fac('0x37')]=qs[_0x7fac('0x38')](_0x4384e1[_0x7fac('0x33')]['sort']);_0x1bad57[_0x7fac('0x39')]=qs['filters'](_['pick'](_0x4384e1[_0x7fac('0x33')],_0x57665b['filters']),_0x29fb77);if(_0x4384e1[_0x7fac('0x33')]['filter']){_0x1bad57[_0x7fac('0x39')]=_['merge'](_0x1bad57[_0x7fac('0x39')],{'$or':_[_0x7fac('0x28')](_0x29fb77,function(_0x1a763b){if(_0x1a763b[_0x7fac('0x2b')]!==_0x7fac('0x3a')){var _0x5e1c8c={};_0x5e1c8c[_0x1a763b[_0x7fac('0x26')]]={'$like':'%'+_0x4384e1[_0x7fac('0x33')][_0x7fac('0x3b')]+'%'};return _0x5e1c8c;}})});}_0x1bad57=_[_0x7fac('0x3c')]({},_0x1bad57,_0x4384e1[_0x7fac('0x3d')]);var _0x3df0cc={'where':_0x1bad57[_0x7fac('0x39')]};return db[_0x7fac('0x3e')][_0x7fac('0x1b')](_0x3df0cc)[_0x7fac('0x22')](function(_0x24cd3c){_0x42c377[_0x7fac('0x1b')]=_0x24cd3c;if(_0x4384e1[_0x7fac('0x33')][_0x7fac('0x3f')]){_0x1bad57[_0x7fac('0x40')]=[{'all':!![]}];}return db[_0x7fac('0x3e')][_0x7fac('0x41')](_0x1bad57);})[_0x7fac('0x22')](function(_0x3af997){_0x42c377[_0x7fac('0x42')]=_0x3af997;return _0x42c377;})[_0x7fac('0x22')](respondWithFilteredResult(_0xcd4751,_0x1bad57))[_0x7fac('0x43')](handleError(_0xcd4751,null));};exports[_0x7fac('0x44')]=function(_0x3bfafd,_0x9b5fb9){var _0x33bf71={'raw':![],'where':{'id':_0x3bfafd['params']['id']}},_0x297265={};_0x297265[_0x7fac('0x2d')]=_[_0x7fac('0x2e')](db[_0x7fac('0x3e')][_0x7fac('0x29')]);_0x297265['query']=_[_0x7fac('0x2e')](_0x3bfafd[_0x7fac('0x33')]);_0x297265[_0x7fac('0x2f')]=_[_0x7fac('0x31')](_0x297265[_0x7fac('0x2d')],_0x297265[_0x7fac('0x33')]);_0x33bf71[_0x7fac('0x30')]=_[_0x7fac('0x31')](_0x297265[_0x7fac('0x2d')],qs[_0x7fac('0x32')](_0x3bfafd[_0x7fac('0x33')][_0x7fac('0x32')]));_0x33bf71[_0x7fac('0x30')]=_0x33bf71[_0x7fac('0x30')][_0x7fac('0x45')]?_0x33bf71[_0x7fac('0x30')]:_0x297265[_0x7fac('0x2d')];if(_0x3bfafd['query'][_0x7fac('0x3f')]){_0x33bf71[_0x7fac('0x40')]=[{'all':!![]}];}_0x33bf71=_[_0x7fac('0x3c')]({},_0x33bf71,_0x3bfafd[_0x7fac('0x3d')]);return db[_0x7fac('0x3e')][_0x7fac('0x46')](_0x33bf71)[_0x7fac('0x22')](handleEntityNotFound(_0x9b5fb9,null))[_0x7fac('0x22')](respondWithResult(_0x9b5fb9,null))[_0x7fac('0x43')](handleError(_0x9b5fb9,null));};exports[_0x7fac('0x47')]=function(_0x55a95a,_0x45f4cc){return db[_0x7fac('0x3e')][_0x7fac('0x47')](_0x55a95a['body'],{})[_0x7fac('0x22')](respondWithResult(_0x45f4cc,0xc9))[_0x7fac('0x43')](handleError(_0x45f4cc,null));};exports['update']=function(_0x1c35fd,_0x142273){if(_0x1c35fd[_0x7fac('0x48')]['id']){delete _0x1c35fd['body']['id'];}return db[_0x7fac('0x3e')][_0x7fac('0x46')]({'where':{'id':_0x1c35fd['params']['id']}})[_0x7fac('0x22')](handleEntityNotFound(_0x142273,null))[_0x7fac('0x22')](saveUpdates(_0x1c35fd[_0x7fac('0x48')],null))[_0x7fac('0x22')](respondWithResult(_0x142273,null))[_0x7fac('0x43')](handleError(_0x142273,null));};exports[_0x7fac('0x23')]=function(_0x3bd51a,_0x2ed986){return db[_0x7fac('0x3e')][_0x7fac('0x46')]({'where':{'id':_0x3bd51a[_0x7fac('0x49')]['id']}})[_0x7fac('0x22')](handleEntityNotFound(_0x2ed986,null))[_0x7fac('0x22')](removeEntity(_0x2ed986,null))[_0x7fac('0x43')](handleError(_0x2ed986,null));};exports['getConfigurations']=function(_0x5658a2,_0x4d7029,_0x15c47e){var _0x4d636c={};var _0x29ffc9={};var _0x16d691;var _0x521a72;return db['ZohoAccount'][_0x7fac('0x4a')]({'where':{'id':_0x5658a2[_0x7fac('0x49')]['id']}})['then'](handleEntityNotFound(_0x4d7029,null))[_0x7fac('0x22')](function(_0x35c391){if(_0x35c391){_0x16d691=_0x35c391;_0x29ffc9[_0x7fac('0x2d')]=_[_0x7fac('0x2e')](db[_0x7fac('0x4b')][_0x7fac('0x29')]);_0x29ffc9[_0x7fac('0x33')]=_[_0x7fac('0x2e')](_0x5658a2[_0x7fac('0x33')]);_0x29ffc9['filters']=_[_0x7fac('0x31')](_0x29ffc9[_0x7fac('0x2d')],_0x29ffc9['query']);_0x4d636c[_0x7fac('0x30')]=_[_0x7fac('0x31')](_0x29ffc9['model'],qs[_0x7fac('0x32')](_0x5658a2[_0x7fac('0x33')][_0x7fac('0x32')]));_0x4d636c['attributes']=_0x4d636c['attributes'][_0x7fac('0x45')]?_0x4d636c[_0x7fac('0x30')]:_0x29ffc9[_0x7fac('0x2d')];_0x4d636c[_0x7fac('0x37')]=qs['sort'](_0x5658a2[_0x7fac('0x33')][_0x7fac('0x38')]);_0x4d636c['where']=qs[_0x7fac('0x2f')](_[_0x7fac('0x4c')](_0x5658a2['query'],_0x29ffc9[_0x7fac('0x2f')]));if(_0x5658a2[_0x7fac('0x33')][_0x7fac('0x3b')]){_0x4d636c[_0x7fac('0x39')]=_[_0x7fac('0x3c')](_0x4d636c[_0x7fac('0x39')],{'$or':_[_0x7fac('0x28')](_0x4d636c['attributes'],function(_0x3f327b){var _0x4926c0={};_0x4926c0[_0x3f327b]={'$like':'%'+_0x5658a2[_0x7fac('0x33')][_0x7fac('0x3b')]+'%'};return _0x4926c0;})});}_0x4d636c=_[_0x7fac('0x3c')]({},_0x4d636c,_0x5658a2[_0x7fac('0x3d')]);return _0x16d691['getConfigurations'](_0x4d636c);}})['then'](function(_0x4ec762){if(_0x4ec762){_0x521a72=_0x4ec762['length'];if(!_0x5658a2[_0x7fac('0x33')][_0x7fac('0x34')](_0x7fac('0x35'))){_0x4d636c[_0x7fac('0x36')]=qs[_0x7fac('0x36')](_0x5658a2[_0x7fac('0x33')][_0x7fac('0x36')]);_0x4d636c[_0x7fac('0x19')]=qs[_0x7fac('0x19')](_0x5658a2['query']['offset']);}return _0x16d691[_0x7fac('0x4d')](_0x4d636c);}})['then'](function(_0x336595){if(_0x336595){return _0x336595?{'count':_0x521a72,'rows':_0x336595}:null;}})[_0x7fac('0x22')](respondWithResult(_0x4d7029,null))[_0x7fac('0x43')](handleError(_0x4d7029,null));};exports[_0x7fac('0x4e')]=function(_0x52757b,_0x17545d,_0x1332b6){if(_0x52757b['body']['id']){delete _0x52757b['body']['id'];}return db['ZohoAccount'][_0x7fac('0x4a')]({'where':{'id':_0x52757b[_0x7fac('0x49')]['id']}})['then'](handleEntityNotFound(_0x17545d,null))['then'](function(_0x1dcfac){if(_0x1dcfac){_0x52757b[_0x7fac('0x48')]['AccountId']=_0x1dcfac['id'];_0x52757b[_0x7fac('0x48')][_0x7fac('0x4f')]=integrations[_0x7fac('0x50')](_0x52757b[_0x7fac('0x48')][_0x7fac('0x51')],_0x52757b['body'][_0x7fac('0x2b')]);_0x52757b['body'][_0x7fac('0x52')]=integrations[_0x7fac('0x53')](_0x52757b[_0x7fac('0x48')]['channel'],_0x52757b[_0x7fac('0x48')][_0x7fac('0x2b')]);return db[_0x7fac('0x4b')]['create'](_0x52757b[_0x7fac('0x48')],{'include':[{'model':db[_0x7fac('0x54')],'as':_0x7fac('0x4f')},{'model':db['ZohoField'],'as':_0x7fac('0x52')}]});}return null;})[_0x7fac('0x22')](respondWithResult(_0x17545d,null))[_0x7fac('0x43')](handleError(_0x17545d,null));};function getAccessToken(_0x44f6c5){return new Promise(function(_0x322fc7,_0x278b3f){var _0x3a2886;switch(_0x44f6c5[_0x7fac('0x55')]){case'US':_0x3a2886='https://accounts.zoho.com';break;case'AU':_0x3a2886=_0x7fac('0x56');break;case'EU':_0x3a2886=_0x7fac('0x57');break;case'IN':_0x3a2886=_0x7fac('0x58');break;case'CN':_0x3a2886='https://accounts.zoho.com.cn';break;default:_0x3a2886=_0x7fac('0x57');break;}var _0x4db78d={'method':'POST','uri':_0x3a2886+_0x7fac('0x59'),'qs':{'refresh_token':_0x44f6c5[_0x7fac('0x5a')],'client_id':_0x44f6c5['clientId'],'client_secret':_0x44f6c5[_0x7fac('0x5b')],'grant_type':_0x7fac('0x5c')},'json':!![]};return rp(_0x4db78d)['then'](function(_0x1aad47){if(_0x1aad47[_0x7fac('0x5d')]){_0x322fc7(_0x1aad47['access_token']);}else{_0x278b3f(_0x7fac('0x5e'));}})[_0x7fac('0x43')](function(_0x5585da){_0x278b3f(_0x5585da);});});}exports[_0x7fac('0x5f')]=function(_0x56ac2a,_0x4d55b4,_0xbd1a31){var _0x2c0a7a,_0x501036,_0x2a6f58,_0x187eb3,_0x304261;return db[_0x7fac('0x3e')][_0x7fac('0x4a')]({'where':{'id':_0x56ac2a['params']['id']},'attributes':['id','host','zone','clientId',_0x7fac('0x5b'),_0x7fac('0x60'),'code','refreshToken']})['then'](handleEntityNotFound(_0x4d55b4,null))[_0x7fac('0x22')](function(_0x37ef04){_0x304261=_0x37ef04;_0x2c0a7a=_0x304261[_0x7fac('0x61')];_0x501036=_0x2c0a7a===_0x7fac('0x62')?'eu':_0x7fac('0x63');_0x2a6f58=_0x304261[_0x7fac('0x60')];var _0x4026c5=_0x2a6f58[_0x7fac('0x64')](-0x1);if(_0x4026c5==='/'||_0x4026c5==='\x5c'||_0x4026c5===':'){_0x2a6f58=_0x2a6f58[_0x7fac('0x65')](0x0,_0x2a6f58[_0x7fac('0x66')](_0x4026c5));}if(!_0x304261[_0x7fac('0x5a')]){throw new Error(_0x7fac('0x67'));}return getAccessToken(_0x304261);})[_0x7fac('0x22')](function(_0x31449a){if(_0x31449a){return rp({'method':'GET','uri':util[_0x7fac('0x68')](_0x7fac('0x69'),_0x501036),'qs':{'module':'Calls'},'headers':{'Authorization':_0x7fac('0x6a')+_0x31449a},'json':!![]});}})['then'](function(_0x1c66d6){if(_0x1c66d6){if(_0x1c66d6[_0x7fac('0x6b')]&&_0x1c66d6['response'][_0x7fac('0x24')]){throw new Error(_0x1c66d6[_0x7fac('0x6b')][_0x7fac('0x24')]['message']);}var _0x46d590=[];var _0x10a5a0=[];var _0x266c91=[_0x7fac('0x6c'),_0x7fac('0x6d'),_0x7fac('0x6e'),'WhoId',_0x7fac('0x6f'),'Call_Result',_0x7fac('0x70'),_0x7fac('0x71')];_0x10a5a0=_['remove'](_0x1c66d6[_0x7fac('0x32')],function(_0xfafbb4){return _0x266c91['includes'](_0xfafbb4['api_name']);});for(var _0x45adf0=0x0;_0x45adf0<_0x10a5a0[_0x7fac('0x45')];_0x45adf0++){if(_0x10a5a0[_0x45adf0][_0x7fac('0x72')]===![]){_0x46d590[_0x7fac('0x73')]({'id':_0x10a5a0[_0x45adf0]['id'],'name':_0x10a5a0[_0x45adf0]['display_label'],'custom':_0x10a5a0[_0x45adf0][_0x7fac('0x74')],'options':_0x10a5a0[_0x45adf0][_0x7fac('0x75')]===_0x7fac('0x76')&&_0x10a5a0[_0x45adf0][_0x7fac('0x77')][_0x7fac('0x45')]>-0x1?_['map'](_0x10a5a0[_0x45adf0][_0x7fac('0x77')],function(_0x4bad35){return{'name':_0x4bad35,'value':_0x4bad35};}):[]});}}return{'count':_0x46d590[_0x7fac('0x45')],'rows':_0x46d590};}else{return{'count':0x0,'rows':[]};}})[_0x7fac('0x22')](respondWithResult(_0x4d55b4,null))['catch'](function(_0x203ce9){var _0x3324a2=_0x56ac2a[_0x7fac('0x33')]['test']?0x1f4:_0x203ce9[_0x7fac('0x78')]||0x1f4;logger[_0x7fac('0x24')](_0x7fac('0x79'),_0x7fac('0x5f'),_0x3324a2,JSON['stringify'](_0x203ce9));delete _0x203ce9['name'];if(_0x3324a2===0x191){_0x3324a2=0x190;}_0x4d55b4[_0x7fac('0x16')](_0x3324a2)[_0x7fac('0x27')](_0x56ac2a[_0x7fac('0x33')][_0x7fac('0x7a')]?{'message':_0x7fac('0x7b'),'statusCode':_0x203ce9['statusCode']}:_0x203ce9);});}; \ No newline at end of file +var _0xee0a=['zip-dir','fast-json-patch','request-promise','bluebird','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','offset','limit','undefined','count','set','apply','save','update','then','name','send','map','ZohoAccount','rawAttributes','fieldName','query','keys','intersection','model','attributes','fields','hasOwnProperty','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','destroy','findOne','ZohoConfiguration','nolimit','addConfiguration','AccountId','Subjects','getSubjects','type','Descriptions','getDescriptions','channel','ZohoField','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','refreshToken','clientId','clientSecret','refresh_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','zone','serverUrl','code','host','zoho.eu','com','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','Calls','Zoho-oauthtoken\x20','response','error','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xee0a,0x17b));var _0xaee0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xee0a[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xaee0('0x0'));var rimraf=require(_0xaee0('0x1'));var zipdir=require(_0xaee0('0x2'));var jsonpatch=require(_0xaee0('0x3'));var rp=require(_0xaee0('0x4'));var moment=require('moment');var BPromise=require(_0xaee0('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xaee0('0x6'));var sox=require(_0xaee0('0x7'));var csv=require('to-csv');var ejs=require(_0xaee0('0x8'));var fs=require('fs');var fs_extra=require(_0xaee0('0x9'));var _=require(_0xaee0('0xa'));var squel=require('squel');var crypto=require(_0xaee0('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xaee0('0xc'));var toCsv=require(_0xaee0('0xd'));var querystring=require('querystring');var Papa=require(_0xaee0('0xe'));var Redis=require('ioredis');var authService=require(_0xaee0('0xf'));var qs=require(_0xaee0('0x10'));var as=require(_0xaee0('0x11'));var hardwareService=require(_0xaee0('0x12'));var logger=require(_0xaee0('0x13'))(_0xaee0('0x14'));var utils=require(_0xaee0('0x15'));var config=require(_0xaee0('0x16'));var licenseUtil=require(_0xaee0('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xaee0('0x18'));function respondWithStatusCode(_0x44ef3b,_0x460b28){_0x460b28=_0x460b28||0xcc;return function(_0x56b40f){if(_0x56b40f){return _0x44ef3b[_0xaee0('0x19')](_0x460b28);}return _0x44ef3b['status'](_0x460b28)['end']();};}function respondWithResult(_0x4a69e7,_0x148aa1){_0x148aa1=_0x148aa1||0xc8;return function(_0x89119c){if(_0x89119c){return _0x4a69e7[_0xaee0('0x1a')](_0x148aa1)[_0xaee0('0x1b')](_0x89119c);}};}function respondWithFilteredResult(_0x55b37b,_0x4835d2){return function(_0xb317b7){if(_0xb317b7){var _0x50019a=typeof _0x4835d2[_0xaee0('0x1c')]==='undefined'&&typeof _0x4835d2[_0xaee0('0x1d')]===_0xaee0('0x1e');var _0x53f36b=_0xb317b7[_0xaee0('0x1f')];var _0x24e684=_0x50019a?0x0:_0x4835d2[_0xaee0('0x1c')];var _0x2eb868=_0x50019a?_0xb317b7[_0xaee0('0x1f')]:_0x4835d2['offset']+_0x4835d2[_0xaee0('0x1d')];var _0x2e9ad2;if(_0x2eb868>=_0x53f36b){_0x2eb868=_0x53f36b;_0x2e9ad2=0xc8;}else{_0x2e9ad2=0xce;}_0x55b37b[_0xaee0('0x1a')](_0x2e9ad2);return _0x55b37b[_0xaee0('0x20')]('Content-Range',_0x24e684+'-'+_0x2eb868+'/'+_0x53f36b)[_0xaee0('0x1b')](_0xb317b7);}return null;};}function patchUpdates(_0x868a49){return function(_0x3df0bb){try{jsonpatch[_0xaee0('0x21')](_0x3df0bb,_0x868a49,!![]);}catch(_0xda0f7){return BPromise['reject'](_0xda0f7);}return _0x3df0bb[_0xaee0('0x22')]();};}function saveUpdates(_0x2d87c8,_0x417f54){return function(_0x180966){if(_0x180966){return _0x180966[_0xaee0('0x23')](_0x2d87c8)[_0xaee0('0x24')](function(_0x335c37){return _0x335c37;});}return null;};}function removeEntity(_0x4a6ab1,_0x2d2b5a){return function(_0x1d646a){if(_0x1d646a){return _0x1d646a['destroy']()[_0xaee0('0x24')](function(){_0x4a6ab1[_0xaee0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3191a1,_0x5b49a5){return function(_0x15efcd){if(!_0x15efcd){_0x3191a1['sendStatus'](0x194);}return _0x15efcd;};}function handleError(_0x1f8277,_0x15fa16){_0x15fa16=_0x15fa16||0x1f4;return function(_0x29e448){logger['error'](_0x29e448['stack']);if(_0x29e448[_0xaee0('0x25')]){delete _0x29e448[_0xaee0('0x25')];}_0x1f8277[_0xaee0('0x1a')](_0x15fa16)[_0xaee0('0x26')](_0x29e448);};}exports['index']=function(_0x2b7264,_0x1e6e05){var _0x186a47={},_0x1a9fce={},_0x17e6eb={'count':0x0,'rows':[]};var _0x5bf7fa=_[_0xaee0('0x27')](db[_0xaee0('0x28')][_0xaee0('0x29')],function(_0x4f84bc){return{'name':_0x4f84bc[_0xaee0('0x2a')],'type':_0x4f84bc['type']['key']};});_0x1a9fce['model']=_[_0xaee0('0x27')](_0x5bf7fa,_0xaee0('0x25'));_0x1a9fce[_0xaee0('0x2b')]=_[_0xaee0('0x2c')](_0x2b7264[_0xaee0('0x2b')]);_0x1a9fce['filters']=_[_0xaee0('0x2d')](_0x1a9fce[_0xaee0('0x2e')],_0x1a9fce['query']);_0x186a47[_0xaee0('0x2f')]=_[_0xaee0('0x2d')](_0x1a9fce[_0xaee0('0x2e')],qs['fields'](_0x2b7264[_0xaee0('0x2b')][_0xaee0('0x30')]));_0x186a47[_0xaee0('0x2f')]=_0x186a47[_0xaee0('0x2f')]['length']?_0x186a47[_0xaee0('0x2f')]:_0x1a9fce['model'];if(!_0x2b7264[_0xaee0('0x2b')][_0xaee0('0x31')]('nolimit')){_0x186a47[_0xaee0('0x1d')]=qs[_0xaee0('0x1d')](_0x2b7264[_0xaee0('0x2b')][_0xaee0('0x1d')]);_0x186a47[_0xaee0('0x1c')]=qs['offset'](_0x2b7264[_0xaee0('0x2b')][_0xaee0('0x1c')]);}_0x186a47['order']=qs[_0xaee0('0x32')](_0x2b7264[_0xaee0('0x2b')][_0xaee0('0x32')]);_0x186a47['where']=qs[_0xaee0('0x33')](_[_0xaee0('0x34')](_0x2b7264[_0xaee0('0x2b')],_0x1a9fce[_0xaee0('0x33')]),_0x5bf7fa);if(_0x2b7264[_0xaee0('0x2b')][_0xaee0('0x35')]){_0x186a47[_0xaee0('0x36')]=_[_0xaee0('0x37')](_0x186a47['where'],{'$or':_[_0xaee0('0x27')](_0x5bf7fa,function(_0x3e6078){if(_0x3e6078['type']!==_0xaee0('0x38')){var _0x255524={};_0x255524[_0x3e6078[_0xaee0('0x25')]]={'$like':'%'+_0x2b7264[_0xaee0('0x2b')][_0xaee0('0x35')]+'%'};return _0x255524;}})});}_0x186a47=_[_0xaee0('0x37')]({},_0x186a47,_0x2b7264[_0xaee0('0x39')]);var _0x3bda05={'where':_0x186a47[_0xaee0('0x36')]};return db[_0xaee0('0x28')][_0xaee0('0x1f')](_0x3bda05)['then'](function(_0x3686ca){_0x17e6eb['count']=_0x3686ca;if(_0x2b7264['query'][_0xaee0('0x3a')]){_0x186a47['include']=[{'all':!![]}];}return db['ZohoAccount'][_0xaee0('0x3b')](_0x186a47);})[_0xaee0('0x24')](function(_0x4214a0){_0x17e6eb[_0xaee0('0x3c')]=_0x4214a0;return _0x17e6eb;})['then'](respondWithFilteredResult(_0x1e6e05,_0x186a47))[_0xaee0('0x3d')](handleError(_0x1e6e05,null));};exports[_0xaee0('0x3e')]=function(_0x1c8f7d,_0x4a73aa){var _0x5d146b={'raw':![],'where':{'id':_0x1c8f7d[_0xaee0('0x3f')]['id']}},_0x1eb7aa={};_0x1eb7aa[_0xaee0('0x2e')]=_[_0xaee0('0x2c')](db[_0xaee0('0x28')][_0xaee0('0x29')]);_0x1eb7aa[_0xaee0('0x2b')]=_[_0xaee0('0x2c')](_0x1c8f7d['query']);_0x1eb7aa['filters']=_['intersection'](_0x1eb7aa[_0xaee0('0x2e')],_0x1eb7aa[_0xaee0('0x2b')]);_0x5d146b[_0xaee0('0x2f')]=_[_0xaee0('0x2d')](_0x1eb7aa[_0xaee0('0x2e')],qs['fields'](_0x1c8f7d[_0xaee0('0x2b')][_0xaee0('0x30')]));_0x5d146b['attributes']=_0x5d146b[_0xaee0('0x2f')][_0xaee0('0x40')]?_0x5d146b['attributes']:_0x1eb7aa[_0xaee0('0x2e')];if(_0x1c8f7d[_0xaee0('0x2b')][_0xaee0('0x3a')]){_0x5d146b[_0xaee0('0x41')]=[{'all':!![]}];}_0x5d146b=_[_0xaee0('0x37')]({},_0x5d146b,_0x1c8f7d[_0xaee0('0x39')]);return db['ZohoAccount'][_0xaee0('0x42')](_0x5d146b)['then'](handleEntityNotFound(_0x4a73aa,null))['then'](respondWithResult(_0x4a73aa,null))[_0xaee0('0x3d')](handleError(_0x4a73aa,null));};exports[_0xaee0('0x43')]=function(_0x1c5e36,_0x156c14){return db[_0xaee0('0x28')]['create'](_0x1c5e36[_0xaee0('0x44')],{})['then'](respondWithResult(_0x156c14,0xc9))[_0xaee0('0x3d')](handleError(_0x156c14,null));};exports[_0xaee0('0x23')]=function(_0x28b91b,_0x7ea4fd){if(_0x28b91b['body']['id']){delete _0x28b91b[_0xaee0('0x44')]['id'];}return db[_0xaee0('0x28')][_0xaee0('0x42')]({'where':{'id':_0x28b91b[_0xaee0('0x3f')]['id']}})[_0xaee0('0x24')](handleEntityNotFound(_0x7ea4fd,null))['then'](saveUpdates(_0x28b91b[_0xaee0('0x44')],null))[_0xaee0('0x24')](respondWithResult(_0x7ea4fd,null))[_0xaee0('0x3d')](handleError(_0x7ea4fd,null));};exports[_0xaee0('0x45')]=function(_0x49747a,_0x644fc6){return db['ZohoAccount'][_0xaee0('0x42')]({'where':{'id':_0x49747a[_0xaee0('0x3f')]['id']}})[_0xaee0('0x24')](handleEntityNotFound(_0x644fc6,null))['then'](removeEntity(_0x644fc6,null))[_0xaee0('0x3d')](handleError(_0x644fc6,null));};exports['getConfigurations']=function(_0x35fa13,_0x22587e,_0x761041){var _0x5fc73b={};var _0xb6f8a1={};var _0x321dd6;var _0x4dc701;return db[_0xaee0('0x28')][_0xaee0('0x46')]({'where':{'id':_0x35fa13[_0xaee0('0x3f')]['id']}})[_0xaee0('0x24')](handleEntityNotFound(_0x22587e,null))[_0xaee0('0x24')](function(_0x1c1e35){if(_0x1c1e35){_0x321dd6=_0x1c1e35;_0xb6f8a1[_0xaee0('0x2e')]=_['keys'](db[_0xaee0('0x47')][_0xaee0('0x29')]);_0xb6f8a1[_0xaee0('0x2b')]=_['keys'](_0x35fa13[_0xaee0('0x2b')]);_0xb6f8a1[_0xaee0('0x33')]=_['intersection'](_0xb6f8a1[_0xaee0('0x2e')],_0xb6f8a1[_0xaee0('0x2b')]);_0x5fc73b[_0xaee0('0x2f')]=_['intersection'](_0xb6f8a1['model'],qs['fields'](_0x35fa13['query'][_0xaee0('0x30')]));_0x5fc73b['attributes']=_0x5fc73b[_0xaee0('0x2f')][_0xaee0('0x40')]?_0x5fc73b[_0xaee0('0x2f')]:_0xb6f8a1['model'];_0x5fc73b['order']=qs[_0xaee0('0x32')](_0x35fa13[_0xaee0('0x2b')][_0xaee0('0x32')]);_0x5fc73b[_0xaee0('0x36')]=qs['filters'](_[_0xaee0('0x34')](_0x35fa13['query'],_0xb6f8a1[_0xaee0('0x33')]));if(_0x35fa13[_0xaee0('0x2b')][_0xaee0('0x35')]){_0x5fc73b[_0xaee0('0x36')]=_['merge'](_0x5fc73b[_0xaee0('0x36')],{'$or':_[_0xaee0('0x27')](_0x5fc73b[_0xaee0('0x2f')],function(_0x5874d9){var _0x2771c9={};_0x2771c9[_0x5874d9]={'$like':'%'+_0x35fa13[_0xaee0('0x2b')][_0xaee0('0x35')]+'%'};return _0x2771c9;})});}_0x5fc73b=_[_0xaee0('0x37')]({},_0x5fc73b,_0x35fa13[_0xaee0('0x39')]);return _0x321dd6['getConfigurations'](_0x5fc73b);}})['then'](function(_0x32f692){if(_0x32f692){_0x4dc701=_0x32f692[_0xaee0('0x40')];if(!_0x35fa13['query'][_0xaee0('0x31')](_0xaee0('0x48'))){_0x5fc73b[_0xaee0('0x1d')]=qs[_0xaee0('0x1d')](_0x35fa13[_0xaee0('0x2b')][_0xaee0('0x1d')]);_0x5fc73b[_0xaee0('0x1c')]=qs[_0xaee0('0x1c')](_0x35fa13['query'][_0xaee0('0x1c')]);}return _0x321dd6['getConfigurations'](_0x5fc73b);}})[_0xaee0('0x24')](function(_0x4af5ff){if(_0x4af5ff){return _0x4af5ff?{'count':_0x4dc701,'rows':_0x4af5ff}:null;}})[_0xaee0('0x24')](respondWithResult(_0x22587e,null))[_0xaee0('0x3d')](handleError(_0x22587e,null));};exports[_0xaee0('0x49')]=function(_0x18870b,_0xd8f962,_0x4a0a97){if(_0x18870b['body']['id']){delete _0x18870b[_0xaee0('0x44')]['id'];}return db[_0xaee0('0x28')][_0xaee0('0x46')]({'where':{'id':_0x18870b[_0xaee0('0x3f')]['id']}})['then'](handleEntityNotFound(_0xd8f962,null))[_0xaee0('0x24')](function(_0x1abde0){if(_0x1abde0){_0x18870b[_0xaee0('0x44')][_0xaee0('0x4a')]=_0x1abde0['id'];_0x18870b['body'][_0xaee0('0x4b')]=integrations[_0xaee0('0x4c')](_0x18870b[_0xaee0('0x44')]['channel'],_0x18870b[_0xaee0('0x44')][_0xaee0('0x4d')]);_0x18870b['body'][_0xaee0('0x4e')]=integrations[_0xaee0('0x4f')](_0x18870b[_0xaee0('0x44')][_0xaee0('0x50')],_0x18870b[_0xaee0('0x44')][_0xaee0('0x4d')]);return db[_0xaee0('0x47')][_0xaee0('0x43')](_0x18870b[_0xaee0('0x44')],{'include':[{'model':db[_0xaee0('0x51')],'as':_0xaee0('0x4b')},{'model':db[_0xaee0('0x51')],'as':_0xaee0('0x4e')}]});}return null;})[_0xaee0('0x24')](respondWithResult(_0xd8f962,null))[_0xaee0('0x3d')](handleError(_0xd8f962,null));};function getAccessToken(_0x2cb40e){return new Promise(function(_0xe06759,_0x2a12a8){var _0x407869;switch(_0x2cb40e['zone']){case'US':_0x407869=_0xaee0('0x52');break;case'AU':_0x407869='https://accounts.zoho.com.au';break;case'EU':_0x407869=_0xaee0('0x53');break;case'IN':_0x407869=_0xaee0('0x54');break;case'CN':_0x407869='https://accounts.zoho.com.cn';break;default:_0x407869=_0xaee0('0x53');break;}var _0x5eda87={'method':'POST','uri':_0x407869+'/oauth/v2/token','qs':{'refresh_token':_0x2cb40e[_0xaee0('0x55')],'client_id':_0x2cb40e[_0xaee0('0x56')],'client_secret':_0x2cb40e[_0xaee0('0x57')],'grant_type':_0xaee0('0x58')},'json':!![]};return rp(_0x5eda87)['then'](function(_0x58e626){if(_0x58e626['access_token']){_0xe06759(_0x58e626['access_token']);}else{_0x2a12a8(_0xaee0('0x59'));}})[_0xaee0('0x3d')](function(_0xe96c13){_0x2a12a8(_0xe96c13);});});}exports[_0xaee0('0x5a')]=function(_0x509c6b,_0x30e385,_0x4cd183){var _0x4de87e,_0x129a62,_0x34c04e,_0x5b5e6a,_0x31ef3b;return db[_0xaee0('0x28')][_0xaee0('0x46')]({'where':{'id':_0x509c6b[_0xaee0('0x3f')]['id']},'attributes':['id','host',_0xaee0('0x5b'),_0xaee0('0x56'),_0xaee0('0x57'),_0xaee0('0x5c'),_0xaee0('0x5d'),'refreshToken']})[_0xaee0('0x24')](handleEntityNotFound(_0x30e385,null))[_0xaee0('0x24')](function(_0x5af930){_0x31ef3b=_0x5af930;_0x4de87e=_0x31ef3b[_0xaee0('0x5e')];_0x129a62=_0x4de87e===_0xaee0('0x5f')?'eu':_0xaee0('0x60');_0x34c04e=_0x31ef3b[_0xaee0('0x5c')];var _0xf4e4e4=_0x34c04e[_0xaee0('0x61')](-0x1);if(_0xf4e4e4==='/'||_0xf4e4e4==='\x5c'||_0xf4e4e4===':'){_0x34c04e=_0x34c04e['substring'](0x0,_0x34c04e[_0xaee0('0x62')](_0xf4e4e4));}if(!_0x31ef3b[_0xaee0('0x55')]){throw new Error(_0xaee0('0x63'));}return getAccessToken(_0x31ef3b);})['then'](function(_0x424e32){if(_0x424e32){return rp({'method':'GET','uri':util[_0xaee0('0x64')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x129a62),'qs':{'module':_0xaee0('0x65')},'headers':{'Authorization':_0xaee0('0x66')+_0x424e32},'json':!![]});}})['then'](function(_0x2b9a76){if(_0x2b9a76){if(_0x2b9a76[_0xaee0('0x67')]&&_0x2b9a76[_0xaee0('0x67')][_0xaee0('0x68')]){throw new Error(_0x2b9a76[_0xaee0('0x67')][_0xaee0('0x68')][_0xaee0('0x69')]);}var _0x11890f=[];var _0x1cf600=[];var _0x393a1a=[_0xaee0('0x6a'),_0xaee0('0x6b'),_0xaee0('0x6c'),_0xaee0('0x6d'),_0xaee0('0x6e'),_0xaee0('0x6f'),'Call_Start_Time',_0xaee0('0x70')];_0x1cf600=_[_0xaee0('0x71')](_0x2b9a76[_0xaee0('0x30')],function(_0xcb5886){return _0x393a1a[_0xaee0('0x72')](_0xcb5886[_0xaee0('0x73')]);});for(var _0x463327=0x0;_0x463327<_0x1cf600[_0xaee0('0x40')];_0x463327++){if(_0x1cf600[_0x463327][_0xaee0('0x74')]===![]){_0x11890f[_0xaee0('0x75')]({'id':_0x1cf600[_0x463327]['id'],'name':_0x1cf600[_0x463327][_0xaee0('0x76')],'custom':_0x1cf600[_0x463327][_0xaee0('0x77')],'options':_0x1cf600[_0x463327][_0xaee0('0x78')]===_0xaee0('0x79')&&_0x1cf600[_0x463327]['pick_list_values'][_0xaee0('0x40')]>-0x1?_['map'](_0x1cf600[_0x463327][_0xaee0('0x7a')],function(_0x1580a4){return{'name':_0x1580a4,'value':_0x1580a4};}):[]});}}return{'count':_0x11890f['length'],'rows':_0x11890f};}else{return{'count':0x0,'rows':[]};}})[_0xaee0('0x24')](respondWithResult(_0x30e385,null))[_0xaee0('0x3d')](function(_0x5d0bc3){var _0x34088f=_0x509c6b[_0xaee0('0x2b')][_0xaee0('0x7b')]?0x1f4:_0x5d0bc3[_0xaee0('0x7c')]||0x1f4;logger['error'](_0xaee0('0x7d'),_0xaee0('0x5a'),_0x34088f,JSON[_0xaee0('0x7e')](_0x5d0bc3));delete _0x5d0bc3[_0xaee0('0x25')];if(_0x34088f===0x191){_0x34088f=0x190;}_0x30e385['status'](_0x34088f)[_0xaee0('0x26')](_0x509c6b['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x5d0bc3[_0xaee0('0x7c')]}:_0x5d0bc3);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index dc86209..6c841e6 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 _0xad6f=['error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','slice','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','exports','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','authorization_code','application/x-www-form-urlencoded','then','parse','refreshToken','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name'];(function(_0x417864,_0x4c8af1){var _0x3adbda=function(_0x4dd783){while(--_0x4dd783){_0x417864['push'](_0x417864['shift']());}};_0x3adbda(++_0x4c8af1);}(_0xad6f,0x17f));var _0xfad6=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xad6f[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0xfad6('0x0'));var logger=require(_0xfad6('0x1'))(_0xfad6('0x2'));var moment=require(_0xfad6('0x3'));var BPromise=require(_0xfad6('0x4'));var rp=require(_0xfad6('0x5'));var fs=require('fs');var path=require(_0xfad6('0x6'));var rimraf=require(_0xfad6('0x7'));var config=require(_0xfad6('0x8'));var attributes=require(_0xfad6('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xfad6('0xa')]=function(_0x274319,_0xee0b09){return _0x274319['define']('ZohoAccount',attributes,{'tableName':_0xfad6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x453e75,_0x204dcf,_0xc827e3){if(_0x453e75[_0xfad6('0xc')](_0xfad6('0xd'))||_0x453e75['changed'](_0xfad6('0xe'))||_0x453e75[_0xfad6('0xc')](_0xfad6('0xf'))||_0x453e75[_0xfad6('0xc')](_0xfad6('0x10'))||_0x453e75[_0xfad6('0xc')](_0xfad6('0x11'))||_0x453e75[_0xfad6('0xc')](_0xfad6('0x12'))){var _0x399635,_0x42f220;_0x399635=_0x453e75[_0xfad6('0xe')];var _0x23d6d3=_0x399635['slice'](-0x1);if(_0x23d6d3==='/'||_0x23d6d3==='\x5c'||_0x23d6d3===':'){_0x399635=_0x399635[_0xfad6('0x13')](0x0,_0x399635[_0xfad6('0x14')](_0x23d6d3));}switch(_0x453e75[_0xfad6('0xd')]){case'US':_0x42f220=_0xfad6('0x15');break;case'AU':_0x42f220=_0xfad6('0x16');break;case'IN':_0x42f220=_0xfad6('0x17');break;case'CN':_0x42f220=_0xfad6('0x18');break;default:_0x42f220=_0xfad6('0x19');break;}var _0x5301c3={'method':_0xfad6('0x1a'),'uri':_0x42f220+'/oauth/v2/token','form':{'grant_type':_0xfad6('0x1b'),'client_id':_0x453e75['clientId'],'client_secret':_0x453e75[_0xfad6('0x10')],'redirect_uri':_0x453e75[_0xfad6('0xe')],'code':_0x453e75['code']},'headers':{'Content-Type':_0xfad6('0x1c')}};return rp(_0x5301c3)[_0xfad6('0x1d')](function(_0x32e3cc){var _0x2178f4=JSON[_0xfad6('0x1e')](_0x32e3cc);if(_0x2178f4['refresh_token']){_0x453e75[_0xfad6('0x1f')]=_0x2178f4[_0xfad6('0x20')];logger[_0xfad6('0x21')](util[_0xfad6('0x22')](_0xfad6('0x23'),_0x453e75[_0xfad6('0x24')],_0x453e75['id']));}else{logger[_0xfad6('0x25')](util[_0xfad6('0x22')](_0xfad6('0x26'),_0x453e75[_0xfad6('0x24')],_0x453e75['id']),util[_0xfad6('0x27')](_0x2178f4,{'showHidden':![],'depth':null}));}return _0xc827e3(null,_0x204dcf);})[_0xfad6('0x28')](function(_0x53747c){logger[_0xfad6('0x25')](util[_0xfad6('0x22')](_0xfad6('0x26'),_0x453e75['name'],_0x453e75['id']),util[_0xfad6('0x27')](parsedResult,{'showHidden':![],'depth':null}));return _0xc827e3(_0x53747c);});}else{return _0xc827e3(null,_0x204dcf);}},'beforeUpdate':function(_0x223b8d,_0x3f3b79,_0x112e6e){if(_0x223b8d[_0xfad6('0xc')](_0xfad6('0xd'))||_0x223b8d[_0xfad6('0xc')]('serverUrl')||_0x223b8d[_0xfad6('0xc')](_0xfad6('0xf'))||_0x223b8d[_0xfad6('0xc')](_0xfad6('0x10'))||_0x223b8d['changed']('code')||_0x223b8d[_0xfad6('0xc')]('host')){var _0x3570b7,_0x435a82;_0x3570b7=_0x223b8d[_0xfad6('0xe')];var _0x49e5bb=_0x3570b7[_0xfad6('0x29')](-0x1);if(_0x49e5bb==='/'||_0x49e5bb==='\x5c'||_0x49e5bb===':'){_0x3570b7=_0x3570b7[_0xfad6('0x13')](0x0,_0x3570b7[_0xfad6('0x14')](_0x49e5bb));}switch(_0x223b8d[_0xfad6('0xd')]){case'US':_0x435a82=_0xfad6('0x15');break;case'AU':_0x435a82=_0xfad6('0x16');break;case'IN':_0x435a82=_0xfad6('0x17');break;case'CN':_0x435a82='https://accounts.zoho.com.cn';break;default:_0x435a82=_0xfad6('0x19');break;}var _0x46b77c={'method':_0xfad6('0x1a'),'uri':_0x435a82+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x223b8d[_0xfad6('0xf')],'client_secret':_0x223b8d[_0xfad6('0x10')],'redirect_uri':_0x223b8d[_0xfad6('0xe')],'code':_0x223b8d[_0xfad6('0x11')]},'headers':{'Content-Type':_0xfad6('0x1c')}};return rp(_0x46b77c)['then'](function(_0x1e4113){var _0x4fb3e4=JSON[_0xfad6('0x1e')](_0x1e4113);if(_0x4fb3e4[_0xfad6('0x20')]){_0x223b8d[_0xfad6('0x1f')]=_0x4fb3e4[_0xfad6('0x20')];logger[_0xfad6('0x21')](util[_0xfad6('0x22')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x223b8d[_0xfad6('0x24')],_0x223b8d['id']));}else{logger[_0xfad6('0x25')](util[_0xfad6('0x22')](_0xfad6('0x26'),_0x223b8d[_0xfad6('0x24')],_0x223b8d['id']),util[_0xfad6('0x27')](_0x4fb3e4,{'showHidden':![],'depth':null}));}return _0x112e6e(null,_0x3f3b79);})[_0xfad6('0x28')](function(_0x3aaefa){logger['error'](util[_0xfad6('0x22')](_0xfad6('0x26'),_0x223b8d[_0xfad6('0x24')],_0x223b8d['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x112e6e(_0x3aaefa);});}else{return _0x112e6e(null,_0x3f3b79);}}}});}; \ No newline at end of file +var _0xa18d=['serverUrl','clientId','clientSecret','code','slice','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST','then','parse','refresh_token','refreshToken','info','name','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','https://accounts.zoho.com','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports','define','ZohoAccount','int_zoho_accounts','changed','zone'];(function(_0x503055,_0x304102){var _0x30fb63=function(_0x400662){while(--_0x400662){_0x503055['push'](_0x503055['shift']());}};_0x30fb63(++_0x304102);}(_0xa18d,0xb6));var _0xda18=function(_0x374ff2,_0x1a2f51){_0x374ff2=_0x374ff2-0x0;var _0x2bdd44=_0xa18d[_0x374ff2];return _0x2bdd44;};'use strict';var _=require(_0xda18('0x0'));var util=require('util');var logger=require(_0xda18('0x1'))('api');var moment=require(_0xda18('0x2'));var BPromise=require(_0xda18('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xda18('0x4'));var rimraf=require(_0xda18('0x5'));var config=require(_0xda18('0x6'));var attributes=require('./intZohoAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xda18('0x7')]=function(_0x30a01c,_0x19d8b9){return _0x30a01c[_0xda18('0x8')](_0xda18('0x9'),attributes,{'tableName':_0xda18('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3479ec,_0x1de4de,_0x523dac){if(_0x3479ec[_0xda18('0xb')](_0xda18('0xc'))||_0x3479ec[_0xda18('0xb')](_0xda18('0xd'))||_0x3479ec[_0xda18('0xb')](_0xda18('0xe'))||_0x3479ec[_0xda18('0xb')](_0xda18('0xf'))||_0x3479ec[_0xda18('0xb')](_0xda18('0x10'))||_0x3479ec[_0xda18('0xb')]('host')){var _0x5e8b9e,_0x25773b;_0x5e8b9e=_0x3479ec[_0xda18('0xd')];var _0x5b9c1b=_0x5e8b9e[_0xda18('0x11')](-0x1);if(_0x5b9c1b==='/'||_0x5b9c1b==='\x5c'||_0x5b9c1b===':'){_0x5e8b9e=_0x5e8b9e['substring'](0x0,_0x5e8b9e[_0xda18('0x12')](_0x5b9c1b));}switch(_0x3479ec[_0xda18('0xc')]){case'US':_0x25773b='https://accounts.zoho.com';break;case'AU':_0x25773b=_0xda18('0x13');break;case'IN':_0x25773b=_0xda18('0x14');break;case'CN':_0x25773b='https://accounts.zoho.com.cn';break;default:_0x25773b=_0xda18('0x15');break;}var _0x199718={'method':_0xda18('0x16'),'uri':_0x25773b+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x3479ec[_0xda18('0xe')],'client_secret':_0x3479ec[_0xda18('0xf')],'redirect_uri':_0x3479ec[_0xda18('0xd')],'code':_0x3479ec[_0xda18('0x10')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x199718)[_0xda18('0x17')](function(_0x4df618){var _0x380db6=JSON[_0xda18('0x18')](_0x4df618);if(_0x380db6[_0xda18('0x19')]){_0x3479ec[_0xda18('0x1a')]=_0x380db6[_0xda18('0x19')];logger[_0xda18('0x1b')](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x3479ec[_0xda18('0x1c')],_0x3479ec['id']));}else{logger[_0xda18('0x1d')](util[_0xda18('0x1e')](_0xda18('0x1f'),_0x3479ec[_0xda18('0x1c')],_0x3479ec['id']),util[_0xda18('0x20')](_0x380db6,{'showHidden':![],'depth':null}));}return _0x523dac(null,_0x1de4de);})[_0xda18('0x21')](function(_0x20227a){logger[_0xda18('0x1d')](util[_0xda18('0x1e')](_0xda18('0x1f'),_0x3479ec['name'],_0x3479ec['id']),util[_0xda18('0x20')](parsedResult,{'showHidden':![],'depth':null}));return _0x523dac(_0x20227a);});}else{return _0x523dac(null,_0x1de4de);}},'beforeUpdate':function(_0x46b6f6,_0x3e847a,_0x241b02){if(_0x46b6f6[_0xda18('0xb')]('zone')||_0x46b6f6[_0xda18('0xb')](_0xda18('0xd'))||_0x46b6f6[_0xda18('0xb')](_0xda18('0xe'))||_0x46b6f6[_0xda18('0xb')](_0xda18('0xf'))||_0x46b6f6[_0xda18('0xb')]('code')||_0x46b6f6[_0xda18('0xb')]('host')){var _0x1f6980,_0x2234bd;_0x1f6980=_0x46b6f6[_0xda18('0xd')];var _0x1488b5=_0x1f6980['slice'](-0x1);if(_0x1488b5==='/'||_0x1488b5==='\x5c'||_0x1488b5===':'){_0x1f6980=_0x1f6980['substring'](0x0,_0x1f6980[_0xda18('0x12')](_0x1488b5));}switch(_0x46b6f6['zone']){case'US':_0x2234bd=_0xda18('0x22');break;case'AU':_0x2234bd=_0xda18('0x13');break;case'IN':_0x2234bd='https://accounts.zoho.in';break;case'CN':_0x2234bd='https://accounts.zoho.com.cn';break;default:_0x2234bd=_0xda18('0x15');break;}var _0x4ee3e7={'method':_0xda18('0x16'),'uri':_0x2234bd+_0xda18('0x23'),'form':{'grant_type':_0xda18('0x24'),'client_id':_0x46b6f6[_0xda18('0xe')],'client_secret':_0x46b6f6[_0xda18('0xf')],'redirect_uri':_0x46b6f6[_0xda18('0xd')],'code':_0x46b6f6['code']},'headers':{'Content-Type':_0xda18('0x25')}};return rp(_0x4ee3e7)[_0xda18('0x17')](function(_0x578d50){var _0x35b7f2=JSON[_0xda18('0x18')](_0x578d50);if(_0x35b7f2[_0xda18('0x19')]){_0x46b6f6[_0xda18('0x1a')]=_0x35b7f2[_0xda18('0x19')];logger[_0xda18('0x1b')](util['format'](_0xda18('0x26'),_0x46b6f6[_0xda18('0x1c')],_0x46b6f6['id']));}else{logger[_0xda18('0x1d')](util[_0xda18('0x1e')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x46b6f6[_0xda18('0x1c')],_0x46b6f6['id']),util[_0xda18('0x20')](_0x35b7f2,{'showHidden':![],'depth':null}));}return _0x241b02(null,_0x3e847a);})[_0xda18('0x21')](function(_0x449003){logger['error'](util[_0xda18('0x1e')](_0xda18('0x1f'),_0x46b6f6[_0xda18('0x1c')],_0x46b6f6['id']),util[_0xda18('0x20')](parsedResult,{'showHidden':![],'depth':null}));return _0x241b02(_0x449003);});}else{return _0x241b02(null,_0x3e847a);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index f0657ec..fff3c02 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 _0xa467=['where','attributes','limit','map','include','model','debug','ShowZohoAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetZohoAccount','ZohoAccount','findAll','options','raw'];(function(_0x514816,_0x57c091){var _0x5c3a43=function(_0xd4a413){while(--_0xd4a413){_0x514816['push'](_0x514816['shift']());}};_0x5c3a43(++_0x57c091);}(_0xa467,0x143));var _0x7a46=function(_0x2d6112,_0x229b41){_0x2d6112=_0x2d6112-0x0;var _0x48b620=_0xa467[_0x2d6112];return _0x48b620;};'use strict';var _=require(_0x7a46('0x0'));var util=require(_0x7a46('0x1'));var moment=require(_0x7a46('0x2'));var BPromise=require(_0x7a46('0x3'));var rs=require(_0x7a46('0x4'));var fs=require('fs');var Redis=require(_0x7a46('0x5'));var db=require(_0x7a46('0x6'))['db'];var utils=require(_0x7a46('0x7'));var logger=require(_0x7a46('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7a46('0x9'));var client=jayson[_0x7a46('0xa')][_0x7a46('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x463cdf,_0x6d8fce,_0x550c38){return new BPromise(function(_0x341d9e,_0x1f8b07){return client[_0x7a46('0xc')](_0x463cdf,_0x550c38)[_0x7a46('0xd')](function(_0x382b56){logger[_0x7a46('0xe')]('ZohoAccount,\x20%s,\x20%s',_0x6d8fce,_0x7a46('0xf'));logger['debug'](_0x7a46('0x10'),_0x6d8fce,'request\x20sent',JSON[_0x7a46('0x11')](_0x382b56));if(_0x382b56[_0x7a46('0x12')]){if(_0x382b56[_0x7a46('0x12')][_0x7a46('0x13')]===0x1f4){logger[_0x7a46('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x6d8fce,_0x382b56[_0x7a46('0x12')][_0x7a46('0x14')]);return _0x1f8b07(_0x382b56[_0x7a46('0x12')][_0x7a46('0x14')]);}logger[_0x7a46('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x6d8fce,_0x382b56[_0x7a46('0x12')]['message']);return _0x341d9e(_0x382b56['error'][_0x7a46('0x14')]);}else{logger[_0x7a46('0xe')]('ZohoAccount,\x20%s,\x20%s',_0x6d8fce,_0x7a46('0xf'));_0x341d9e(_0x382b56['result'][_0x7a46('0x14')]);}})[_0x7a46('0x15')](function(_0x50e40e){logger[_0x7a46('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x6d8fce,_0x50e40e);_0x1f8b07(_0x50e40e);});});}exports[_0x7a46('0x16')]=function(_0x3aa0ad){var _0x3cdc54=this;return new Promise(function(_0x279fc8,_0x5eace2){return db[_0x7a46('0x17')][_0x7a46('0x18')]({'raw':_0x3aa0ad['options']?_0x3aa0ad[_0x7a46('0x19')][_0x7a46('0x1a')]===undefined?!![]:![]:!![],'where':_0x3aa0ad['options']?_0x3aa0ad['options'][_0x7a46('0x1b')]||null:null,'attributes':_0x3aa0ad[_0x7a46('0x19')]?_0x3aa0ad[_0x7a46('0x19')][_0x7a46('0x1c')]||null:null,'limit':_0x3aa0ad['options']?_0x3aa0ad[_0x7a46('0x19')][_0x7a46('0x1d')]||null:null,'include':_0x3aa0ad['options']?_0x3aa0ad['options']['include']?_[_0x7a46('0x1e')](_0x3aa0ad[_0x7a46('0x19')]['include'],function(_0x46512d){return{'model':db[_0x46512d['model']],'as':_0x46512d['as'],'attributes':_0x46512d[_0x7a46('0x1c')],'include':_0x46512d[_0x7a46('0x1f')]?_['map'](_0x46512d[_0x7a46('0x1f')],function(_0x1222ae){return{'model':db[_0x1222ae[_0x7a46('0x20')]],'as':_0x1222ae['as'],'attributes':_0x1222ae[_0x7a46('0x1c')],'include':_0x1222ae[_0x7a46('0x1f')]?_[_0x7a46('0x1e')](_0x1222ae[_0x7a46('0x1f')],function(_0x595c66){return{'model':db[_0x595c66[_0x7a46('0x20')]],'as':_0x595c66['as'],'attributes':_0x595c66[_0x7a46('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7a46('0xd')](function(_0xa81c32){logger[_0x7a46('0xe')](_0x7a46('0x16'),_0x3aa0ad);logger[_0x7a46('0x21')]('GetZohoAccount',_0x3aa0ad,JSON[_0x7a46('0x11')](_0xa81c32));_0x279fc8(_0xa81c32);})[_0x7a46('0x15')](function(_0x3b35dd){logger[_0x7a46('0x12')](_0x7a46('0x16'),_0x3b35dd['message'],_0x3aa0ad);_0x5eace2(_0x3cdc54[_0x7a46('0x12')](0x1f4,_0x3b35dd['message']));});});};exports['ShowZohoAccount']=function(_0x29ac6a){var _0x477aa1=this;return new Promise(function(_0x273cec,_0x3c7016){return db[_0x7a46('0x17')]['find']({'raw':_0x29ac6a['options']?_0x29ac6a[_0x7a46('0x19')][_0x7a46('0x1a')]===undefined?!![]:![]:!![],'where':_0x29ac6a[_0x7a46('0x19')]?_0x29ac6a['options'][_0x7a46('0x1b')]||null:null,'attributes':_0x29ac6a[_0x7a46('0x19')]?_0x29ac6a[_0x7a46('0x19')][_0x7a46('0x1c')]||null:null,'include':_0x29ac6a[_0x7a46('0x19')]?_0x29ac6a[_0x7a46('0x19')][_0x7a46('0x1f')]?_[_0x7a46('0x1e')](_0x29ac6a[_0x7a46('0x19')][_0x7a46('0x1f')],function(_0x10a1f4){return{'model':db[_0x10a1f4[_0x7a46('0x20')]],'as':_0x10a1f4['as'],'attributes':_0x10a1f4[_0x7a46('0x1c')],'include':_0x10a1f4[_0x7a46('0x1f')]?_[_0x7a46('0x1e')](_0x10a1f4[_0x7a46('0x1f')],function(_0x4d86f7){return{'model':db[_0x4d86f7['model']],'as':_0x4d86f7['as'],'attributes':_0x4d86f7[_0x7a46('0x1c')],'include':_0x4d86f7[_0x7a46('0x1f')]?_[_0x7a46('0x1e')](_0x4d86f7[_0x7a46('0x1f')],function(_0x4a6ffd){return{'model':db[_0x4a6ffd[_0x7a46('0x20')]],'as':_0x4a6ffd['as'],'attributes':_0x4a6ffd[_0x7a46('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x15ca0f){logger[_0x7a46('0xe')](_0x7a46('0x22'),_0x29ac6a);logger['debug']('ShowZohoAccount',_0x29ac6a,JSON[_0x7a46('0x11')](_0x15ca0f));_0x273cec(_0x15ca0f);})[_0x7a46('0x15')](function(_0x115cb3){logger[_0x7a46('0x12')](_0x7a46('0x22'),_0x115cb3[_0x7a46('0x14')],_0x29ac6a);_0x3c7016(_0x477aa1[_0x7a46('0x12')](0x1f4,_0x115cb3['message']));});});}; \ No newline at end of file +var _0xe953=['../../config/logger','rpc','../../config/environment','http','ZohoAccount,\x20%s,\x20%s','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','GetZohoAccount','options','raw','attributes','map','include','model','then','debug','ShowZohoAccount','find','where','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x216906,_0x2c3589){var _0x4d12c8=function(_0x338974){while(--_0x338974){_0x216906['push'](_0x216906['shift']());}};_0x4d12c8(++_0x2c3589);}(_0xe953,0xf9));var _0x3e95=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xe953[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0x3e95('0x0'));var util=require(_0x3e95('0x1'));var moment=require(_0x3e95('0x2'));var BPromise=require('bluebird');var rs=require(_0x3e95('0x3'));var fs=require('fs');var Redis=require(_0x3e95('0x4'));var db=require(_0x3e95('0x5'))['db'];var utils=require(_0x3e95('0x6'));var logger=require(_0x3e95('0x7'))(_0x3e95('0x8'));var config=require(_0x3e95('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3e95('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5704fb,_0x457ca6,_0x5f0bc9){return new BPromise(function(_0x342a5d,_0x251f13){return client['request'](_0x5704fb,_0x5f0bc9)['then'](function(_0x1848ad){logger['info'](_0x3e95('0xb'),_0x457ca6,'request\x20sent');logger['debug'](_0x3e95('0xc'),_0x457ca6,_0x3e95('0xd'),JSON[_0x3e95('0xe')](_0x1848ad));if(_0x1848ad['error']){if(_0x1848ad[_0x3e95('0xf')][_0x3e95('0x10')]===0x1f4){logger[_0x3e95('0xf')](_0x3e95('0xb'),_0x457ca6,_0x1848ad[_0x3e95('0xf')]['message']);return _0x251f13(_0x1848ad[_0x3e95('0xf')][_0x3e95('0x11')]);}logger[_0x3e95('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x457ca6,_0x1848ad[_0x3e95('0xf')][_0x3e95('0x11')]);return _0x342a5d(_0x1848ad[_0x3e95('0xf')][_0x3e95('0x11')]);}else{logger[_0x3e95('0x12')](_0x3e95('0xb'),_0x457ca6,_0x3e95('0xd'));_0x342a5d(_0x1848ad['result'][_0x3e95('0x11')]);}})[_0x3e95('0x13')](function(_0x3595f9){logger['error'](_0x3e95('0xb'),_0x457ca6,_0x3595f9);_0x251f13(_0x3595f9);});});}exports[_0x3e95('0x14')]=function(_0x13c486){var _0x4a5402=this;return new Promise(function(_0x557d0a,_0x4e1aa5){return db['ZohoAccount']['findAll']({'raw':_0x13c486[_0x3e95('0x15')]?_0x13c486['options'][_0x3e95('0x16')]===undefined?!![]:![]:!![],'where':_0x13c486[_0x3e95('0x15')]?_0x13c486[_0x3e95('0x15')]['where']||null:null,'attributes':_0x13c486[_0x3e95('0x15')]?_0x13c486['options'][_0x3e95('0x17')]||null:null,'limit':_0x13c486[_0x3e95('0x15')]?_0x13c486[_0x3e95('0x15')]['limit']||null:null,'include':_0x13c486['options']?_0x13c486[_0x3e95('0x15')]['include']?_[_0x3e95('0x18')](_0x13c486[_0x3e95('0x15')]['include'],function(_0xb4c720){return{'model':db[_0xb4c720['model']],'as':_0xb4c720['as'],'attributes':_0xb4c720[_0x3e95('0x17')],'include':_0xb4c720[_0x3e95('0x19')]?_[_0x3e95('0x18')](_0xb4c720[_0x3e95('0x19')],function(_0x421498){return{'model':db[_0x421498[_0x3e95('0x1a')]],'as':_0x421498['as'],'attributes':_0x421498[_0x3e95('0x17')],'include':_0x421498[_0x3e95('0x19')]?_['map'](_0x421498['include'],function(_0x384298){return{'model':db[_0x384298[_0x3e95('0x1a')]],'as':_0x384298['as'],'attributes':_0x384298['attributes']};}):[]};}):[]};}):[]:[]})[_0x3e95('0x1b')](function(_0x2207ef){logger[_0x3e95('0x12')](_0x3e95('0x14'),_0x13c486);logger[_0x3e95('0x1c')](_0x3e95('0x14'),_0x13c486,JSON[_0x3e95('0xe')](_0x2207ef));_0x557d0a(_0x2207ef);})[_0x3e95('0x13')](function(_0x2eb95f){logger[_0x3e95('0xf')](_0x3e95('0x14'),_0x2eb95f[_0x3e95('0x11')],_0x13c486);_0x4e1aa5(_0x4a5402[_0x3e95('0xf')](0x1f4,_0x2eb95f[_0x3e95('0x11')]));});});};exports[_0x3e95('0x1d')]=function(_0x3b8b94){var _0xeb20=this;return new Promise(function(_0x53b12b,_0xe9bab2){return db['ZohoAccount'][_0x3e95('0x1e')]({'raw':_0x3b8b94[_0x3e95('0x15')]?_0x3b8b94[_0x3e95('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x3b8b94['options']?_0x3b8b94[_0x3e95('0x15')][_0x3e95('0x1f')]||null:null,'attributes':_0x3b8b94[_0x3e95('0x15')]?_0x3b8b94['options']['attributes']||null:null,'include':_0x3b8b94[_0x3e95('0x15')]?_0x3b8b94[_0x3e95('0x15')]['include']?_[_0x3e95('0x18')](_0x3b8b94['options'][_0x3e95('0x19')],function(_0x32a0eb){return{'model':db[_0x32a0eb['model']],'as':_0x32a0eb['as'],'attributes':_0x32a0eb[_0x3e95('0x17')],'include':_0x32a0eb[_0x3e95('0x19')]?_[_0x3e95('0x18')](_0x32a0eb[_0x3e95('0x19')],function(_0x1feaa9){return{'model':db[_0x1feaa9[_0x3e95('0x1a')]],'as':_0x1feaa9['as'],'attributes':_0x1feaa9[_0x3e95('0x17')],'include':_0x1feaa9[_0x3e95('0x19')]?_[_0x3e95('0x18')](_0x1feaa9[_0x3e95('0x19')],function(_0xd515a1){return{'model':db[_0xd515a1[_0x3e95('0x1a')]],'as':_0xd515a1['as'],'attributes':_0xd515a1[_0x3e95('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xc238f5){logger[_0x3e95('0x12')](_0x3e95('0x1d'),_0x3b8b94);logger['debug'](_0x3e95('0x1d'),_0x3b8b94,JSON[_0x3e95('0xe')](_0xc238f5));_0x53b12b(_0xc238f5);})[_0x3e95('0x13')](function(_0x5a3395){logger[_0x3e95('0xf')](_0x3e95('0x1d'),_0x5a3395['message'],_0x3b8b94);_0xe9bab2(_0xeb20[_0x3e95('0xf')](0x1f4,_0x5a3395[_0x3e95('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index c9e5365..008bb6a 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 _0x72ea=['../../config/environment','./intZohoConfiguration.controller','/:id','isAuthenticated','show','get','getFields','getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x486435,_0x4e2fd2){var _0x403dff=function(_0x459e60){while(--_0x459e60){_0x486435['push'](_0x486435['shift']());}};_0x403dff(++_0x4e2fd2);}(_0x72ea,0x6c));var _0xa72e=function(_0x10b727,_0x11255e){_0x10b727=_0x10b727-0x0;var _0x3da247=_0x72ea[_0x10b727];return _0x3da247;};'use strict';var multer=require(_0xa72e('0x0'));var util=require(_0xa72e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa72e('0x2'));var router=express[_0xa72e('0x3')]();var fs_extra=require(_0xa72e('0x4'));var auth=require(_0xa72e('0x5'));var interaction=require(_0xa72e('0x6'));var config=require(_0xa72e('0x7'));var controller=require(_0xa72e('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xa72e('0x9'),auth[_0xa72e('0xa')](),controller[_0xa72e('0xb')]);router[_0xa72e('0xc')]('/:id/fields',auth[_0xa72e('0xa')](),controller[_0xa72e('0xd')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0xa72e('0xe')]);router[_0xa72e('0xc')]('/:id/descriptions',auth[_0xa72e('0xa')](),controller[_0xa72e('0xf')]);router[_0xa72e('0x10')]('/',auth['isAuthenticated'](),controller[_0xa72e('0x11')]);router[_0xa72e('0x12')](_0xa72e('0x9'),auth[_0xa72e('0xa')](),controller[_0xa72e('0x13')]);router[_0xa72e('0x14')](_0xa72e('0x9'),auth[_0xa72e('0xa')](),controller[_0xa72e('0x15')]);module[_0xa72e('0x16')]=router; \ No newline at end of file +var _0x9d8a=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','delete','destroy'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x9d8a,0x69));var _0xa9d8=function(_0x46d20f,_0x326507){_0x46d20f=_0x46d20f-0x0;var _0x5da3bd=_0x9d8a[_0x46d20f];return _0x5da3bd;};'use strict';var multer=require(_0xa9d8('0x0'));var util=require(_0xa9d8('0x1'));var path=require('path');var timeout=require(_0xa9d8('0x2'));var express=require(_0xa9d8('0x3'));var router=express[_0xa9d8('0x4')]();var fs_extra=require(_0xa9d8('0x5'));var auth=require(_0xa9d8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa9d8('0x7'));var controller=require(_0xa9d8('0x8'));router[_0xa9d8('0x9')]('/',auth[_0xa9d8('0xa')](),controller['index']);router[_0xa9d8('0x9')]('/:id',auth[_0xa9d8('0xa')](),controller['show']);router['get'](_0xa9d8('0xb'),auth[_0xa9d8('0xa')](),controller[_0xa9d8('0xc')]);router[_0xa9d8('0x9')](_0xa9d8('0xd'),auth[_0xa9d8('0xa')](),controller[_0xa9d8('0xe')]);router[_0xa9d8('0x9')]('/:id/descriptions',auth[_0xa9d8('0xa')](),controller[_0xa9d8('0xf')]);router[_0xa9d8('0x10')]('/',auth['isAuthenticated'](),controller[_0xa9d8('0x11')]);router[_0xa9d8('0x12')]('/:id',auth[_0xa9d8('0xa')](),controller['update']);router[_0xa9d8('0x13')]('/:id',auth[_0xa9d8('0xa')](),controller[_0xa9d8('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index dcb65bb..a6414fb 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 _0xf783=['sequelize','exports','ENUM','lead','contact','nothing','contact_lead','STRING'];(function(_0x4a8c66,_0xaa36a3){var _0x55eeea=function(_0xdcdc41){while(--_0xdcdc41){_0x4a8c66['push'](_0x4a8c66['shift']());}};_0x55eeea(++_0xaa36a3);}(_0xf783,0x110));var _0x3f78=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf783[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x3f78('0x0'));module[_0x3f78('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x3f78('0x2')](_0x3f78('0x3'),_0x3f78('0x4'),_0x3f78('0x5')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0x3f78('0x2')](_0x3f78('0x6'),_0x3f78('0x4'),_0x3f78('0x3')),'defaultValue':_0x3f78('0x6')},'description':{'type':Sequelize[_0x3f78('0x7')]}}; \ No newline at end of file +var _0x88c6=['lead','contact','contact_lead','sequelize','exports','STRING','ENUM','nothing'];(function(_0xd2f4ac,_0x5aa8e5){var _0x9757b2=function(_0x442ced){while(--_0x442ced){_0xd2f4ac['push'](_0xd2f4ac['shift']());}};_0x9757b2(++_0x5aa8e5);}(_0x88c6,0x163));var _0x688c=function(_0x1124d3,_0x59d506){_0x1124d3=_0x1124d3-0x0;var _0x8a1853=_0x88c6[_0x1124d3];return _0x8a1853;};'use strict';var Sequelize=require(_0x688c('0x0'));module[_0x688c('0x1')]={'name':{'type':Sequelize[_0x688c('0x2')]},'moduleCreate':{'type':Sequelize[_0x688c('0x3')]('lead','contact',_0x688c('0x4')),'defaultValue':_0x688c('0x5')},'moduleSearch':{'type':Sequelize[_0x688c('0x3')]('contact_lead',_0x688c('0x6'),_0x688c('0x5')),'defaultValue':_0x688c('0x7')},'description':{'type':Sequelize[_0x688c('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 3329415..4009735 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 _0xce3c=['status','end','json','offset','undefined','limit','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ZohoConfiguration','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','filters','pick','filter','where','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','create','body','find','getFields','findOne','ZohoField','order','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x41ad1d,_0x5a7fbc){var _0x26d7a6=function(_0x3127f2){while(--_0x3127f2){_0x41ad1d['push'](_0x41ad1d['shift']());}};_0x26d7a6(++_0x5a7fbc);}(_0xce3c,0x17a));var _0xcce3=function(_0x5bd103,_0x3b8037){_0x5bd103=_0x5bd103-0x0;var _0xc33b64=_0xce3c[_0x5bd103];return _0xc33b64;};'use strict';var emlformat=require(_0xcce3('0x0'));var rimraf=require(_0xcce3('0x1'));var zipdir=require(_0xcce3('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(_0xcce3('0x3'));var path=require(_0xcce3('0x4'));var sox=require(_0xcce3('0x5'));var csv=require(_0xcce3('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcce3('0x7'));var squel=require(_0xcce3('0x8'));var crypto=require(_0xcce3('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xcce3('0xa'));var toCsv=require(_0xcce3('0x6'));var querystring=require(_0xcce3('0xb'));var Papa=require(_0xcce3('0xc'));var Redis=require(_0xcce3('0xd'));var authService=require(_0xcce3('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xcce3('0xf'));var hardwareService=require(_0xcce3('0x10'));var logger=require(_0xcce3('0x11'))('api');var utils=require(_0xcce3('0x12'));var config=require(_0xcce3('0x13'));var licenseUtil=require(_0xcce3('0x14'));var db=require(_0xcce3('0x15'))['db'];function respondWithStatusCode(_0x5b0e67,_0x4f9eb0){_0x4f9eb0=_0x4f9eb0||0xcc;return function(_0x1c3430){if(_0x1c3430){return _0x5b0e67['sendStatus'](_0x4f9eb0);}return _0x5b0e67[_0xcce3('0x16')](_0x4f9eb0)[_0xcce3('0x17')]();};}function respondWithResult(_0x214654,_0x17e7e9){_0x17e7e9=_0x17e7e9||0xc8;return function(_0x423323){if(_0x423323){return _0x214654[_0xcce3('0x16')](_0x17e7e9)[_0xcce3('0x18')](_0x423323);}};}function respondWithFilteredResult(_0x8770a5,_0x43f939){return function(_0x520c14){if(_0x520c14){var _0x53af81=typeof _0x43f939[_0xcce3('0x19')]===_0xcce3('0x1a')&&typeof _0x43f939[_0xcce3('0x1b')]===_0xcce3('0x1a');var _0x2fa771=_0x520c14['count'];var _0x1c0112=_0x53af81?0x0:_0x43f939[_0xcce3('0x19')];var _0x27cc1f=_0x53af81?_0x520c14['count']:_0x43f939['offset']+_0x43f939[_0xcce3('0x1b')];var _0x5f5bfb;if(_0x27cc1f>=_0x2fa771){_0x27cc1f=_0x2fa771;_0x5f5bfb=0xc8;}else{_0x5f5bfb=0xce;}_0x8770a5[_0xcce3('0x16')](_0x5f5bfb);return _0x8770a5[_0xcce3('0x1c')](_0xcce3('0x1d'),_0x1c0112+'-'+_0x27cc1f+'/'+_0x2fa771)[_0xcce3('0x18')](_0x520c14);}return null;};}function patchUpdates(_0x111020){return function(_0x53bb95){try{jsonpatch['apply'](_0x53bb95,_0x111020,!![]);}catch(_0x260b88){return BPromise[_0xcce3('0x1e')](_0x260b88);}return _0x53bb95[_0xcce3('0x1f')]();};}function saveUpdates(_0xc36092,_0x1c8d62){return function(_0x142195){if(_0x142195){return _0x142195[_0xcce3('0x20')](_0xc36092)[_0xcce3('0x21')](function(_0xff0e7b){return _0xff0e7b;});}return null;};}function removeEntity(_0xa907a6,_0x1ff072){return function(_0x3c38c1){if(_0x3c38c1){return _0x3c38c1[_0xcce3('0x22')]()[_0xcce3('0x21')](function(){_0xa907a6[_0xcce3('0x16')](0xcc)[_0xcce3('0x17')]();});}};}function handleEntityNotFound(_0x3f7b60,_0x5ba54f){return function(_0x2e3457){if(!_0x2e3457){_0x3f7b60[_0xcce3('0x23')](0x194);}return _0x2e3457;};}function handleError(_0x21e1dc,_0x365a5a){_0x365a5a=_0x365a5a||0x1f4;return function(_0x199a09){logger[_0xcce3('0x24')](_0x199a09[_0xcce3('0x25')]);if(_0x199a09[_0xcce3('0x26')]){delete _0x199a09[_0xcce3('0x26')];}_0x21e1dc[_0xcce3('0x16')](_0x365a5a)[_0xcce3('0x27')](_0x199a09);};}exports[_0xcce3('0x28')]=function(_0x32da29,_0x291f22){var _0x4425a3={},_0x404b93={},_0x935b45={'count':0x0,'rows':[]};var _0x3b336e=_[_0xcce3('0x29')](db[_0xcce3('0x2a')]['rawAttributes'],function(_0x2579fb){return{'name':_0x2579fb['fieldName'],'type':_0x2579fb[_0xcce3('0x2b')][_0xcce3('0x2c')]};});_0x404b93[_0xcce3('0x2d')]=_[_0xcce3('0x29')](_0x3b336e,_0xcce3('0x26'));_0x404b93[_0xcce3('0x2e')]=_[_0xcce3('0x2f')](_0x32da29[_0xcce3('0x2e')]);_0x404b93['filters']=_[_0xcce3('0x30')](_0x404b93[_0xcce3('0x2d')],_0x404b93[_0xcce3('0x2e')]);_0x4425a3[_0xcce3('0x31')]=_['intersection'](_0x404b93[_0xcce3('0x2d')],qs[_0xcce3('0x32')](_0x32da29[_0xcce3('0x2e')][_0xcce3('0x32')]));_0x4425a3[_0xcce3('0x31')]=_0x4425a3[_0xcce3('0x31')]['length']?_0x4425a3['attributes']:_0x404b93[_0xcce3('0x2d')];if(!_0x32da29[_0xcce3('0x2e')][_0xcce3('0x33')](_0xcce3('0x34'))){_0x4425a3[_0xcce3('0x1b')]=qs[_0xcce3('0x1b')](_0x32da29[_0xcce3('0x2e')][_0xcce3('0x1b')]);_0x4425a3[_0xcce3('0x19')]=qs[_0xcce3('0x19')](_0x32da29[_0xcce3('0x2e')]['offset']);}_0x4425a3['order']=qs['sort'](_0x32da29[_0xcce3('0x2e')][_0xcce3('0x35')]);_0x4425a3['where']=qs[_0xcce3('0x36')](_[_0xcce3('0x37')](_0x32da29[_0xcce3('0x2e')],_0x404b93[_0xcce3('0x36')]),_0x3b336e);if(_0x32da29['query'][_0xcce3('0x38')]){_0x4425a3[_0xcce3('0x39')]=_['merge'](_0x4425a3[_0xcce3('0x39')],{'$or':_[_0xcce3('0x29')](_0x3b336e,function(_0x5e142c){if(_0x5e142c['type']!==_0xcce3('0x3a')){var _0x4856ae={};_0x4856ae[_0x5e142c['name']]={'$like':'%'+_0x32da29[_0xcce3('0x2e')][_0xcce3('0x38')]+'%'};return _0x4856ae;}})});}_0x4425a3=_[_0xcce3('0x3b')]({},_0x4425a3,_0x32da29[_0xcce3('0x3c')]);var _0x29e4a1={'where':_0x4425a3[_0xcce3('0x39')]};return db[_0xcce3('0x2a')][_0xcce3('0x3d')](_0x29e4a1)[_0xcce3('0x21')](function(_0x2276d3){_0x935b45[_0xcce3('0x3d')]=_0x2276d3;if(_0x32da29['query'][_0xcce3('0x3e')]){_0x4425a3[_0xcce3('0x3f')]=[{'all':!![]}];}return db[_0xcce3('0x2a')][_0xcce3('0x40')](_0x4425a3);})['then'](function(_0x247360){_0x935b45[_0xcce3('0x41')]=_0x247360;return _0x935b45;})[_0xcce3('0x21')](respondWithFilteredResult(_0x291f22,_0x4425a3))[_0xcce3('0x42')](handleError(_0x291f22,null));};exports[_0xcce3('0x43')]=function(_0x90a16c,_0x595a4f){var _0x46c11a={'raw':![],'where':{'id':_0x90a16c[_0xcce3('0x44')]['id']}},_0x30bac6={};_0x30bac6[_0xcce3('0x2d')]=_[_0xcce3('0x2f')](db[_0xcce3('0x2a')][_0xcce3('0x45')]);_0x30bac6[_0xcce3('0x2e')]=_[_0xcce3('0x2f')](_0x90a16c['query']);_0x30bac6['filters']=_['intersection'](_0x30bac6['model'],_0x30bac6[_0xcce3('0x2e')]);_0x46c11a[_0xcce3('0x31')]=_[_0xcce3('0x30')](_0x30bac6['model'],qs[_0xcce3('0x32')](_0x90a16c['query'][_0xcce3('0x32')]));_0x46c11a[_0xcce3('0x31')]=_0x46c11a[_0xcce3('0x31')][_0xcce3('0x46')]?_0x46c11a[_0xcce3('0x31')]:_0x30bac6[_0xcce3('0x2d')];if(_0x90a16c[_0xcce3('0x2e')][_0xcce3('0x3e')]){_0x46c11a[_0xcce3('0x3f')]=[{'all':!![]}];}_0x46c11a=_[_0xcce3('0x3b')]({},_0x46c11a,_0x90a16c['options']);return db[_0xcce3('0x2a')]['find'](_0x46c11a)[_0xcce3('0x21')](handleEntityNotFound(_0x595a4f,null))[_0xcce3('0x21')](respondWithResult(_0x595a4f,null))['catch'](handleError(_0x595a4f,null));};exports['create']=function(_0x3eaad8,_0x4706c3){return db['ZohoConfiguration'][_0xcce3('0x47')](_0x3eaad8[_0xcce3('0x48')],{})['then'](respondWithResult(_0x4706c3,0xc9))[_0xcce3('0x42')](handleError(_0x4706c3,null));};exports['update']=function(_0x4452f1,_0x58b2dd){if(_0x4452f1[_0xcce3('0x48')]['id']){delete _0x4452f1[_0xcce3('0x48')]['id'];}return db['ZohoConfiguration']['find']({'where':{'id':_0x4452f1[_0xcce3('0x44')]['id']}})[_0xcce3('0x21')](handleEntityNotFound(_0x58b2dd,null))[_0xcce3('0x21')](saveUpdates(_0x4452f1[_0xcce3('0x48')],null))['then'](respondWithResult(_0x58b2dd,null))[_0xcce3('0x42')](handleError(_0x58b2dd,null));};exports['destroy']=function(_0x4bcd46,_0x41ad52){return db[_0xcce3('0x2a')][_0xcce3('0x49')]({'where':{'id':_0x4bcd46[_0xcce3('0x44')]['id']}})['then'](handleEntityNotFound(_0x41ad52,null))[_0xcce3('0x21')](removeEntity(_0x41ad52,null))[_0xcce3('0x42')](handleError(_0x41ad52,null));};exports[_0xcce3('0x4a')]=function(_0x5e9ea3,_0xe663a2,_0x604d30){var _0x2dc54d={};var _0x477ed8={};var _0x38bd84;var _0x4bce8f;return db[_0xcce3('0x2a')][_0xcce3('0x4b')]({'where':{'id':_0x5e9ea3[_0xcce3('0x44')]['id']}})['then'](handleEntityNotFound(_0xe663a2,null))[_0xcce3('0x21')](function(_0x3bab04){if(_0x3bab04){_0x38bd84=_0x3bab04;_0x477ed8[_0xcce3('0x2d')]=_[_0xcce3('0x2f')](db[_0xcce3('0x4c')]['rawAttributes']);_0x477ed8[_0xcce3('0x2e')]=_[_0xcce3('0x2f')](_0x5e9ea3[_0xcce3('0x2e')]);_0x477ed8[_0xcce3('0x36')]=_[_0xcce3('0x30')](_0x477ed8[_0xcce3('0x2d')],_0x477ed8[_0xcce3('0x2e')]);_0x2dc54d[_0xcce3('0x31')]=_['intersection'](_0x477ed8[_0xcce3('0x2d')],qs['fields'](_0x5e9ea3[_0xcce3('0x2e')][_0xcce3('0x32')]));_0x2dc54d[_0xcce3('0x31')]=_0x2dc54d['attributes'][_0xcce3('0x46')]?_0x2dc54d[_0xcce3('0x31')]:_0x477ed8[_0xcce3('0x2d')];_0x2dc54d[_0xcce3('0x4d')]=qs[_0xcce3('0x35')](_0x5e9ea3['query'][_0xcce3('0x35')]);_0x2dc54d[_0xcce3('0x39')]=qs['filters'](_[_0xcce3('0x37')](_0x5e9ea3[_0xcce3('0x2e')],_0x477ed8[_0xcce3('0x36')]));if(_0x5e9ea3[_0xcce3('0x2e')][_0xcce3('0x38')]){_0x2dc54d['where']=_[_0xcce3('0x3b')](_0x2dc54d[_0xcce3('0x39')],{'$or':_[_0xcce3('0x29')](_0x2dc54d[_0xcce3('0x31')],function(_0x46ec7e){var _0x5b1c83={};_0x5b1c83[_0x46ec7e]={'$like':'%'+_0x5e9ea3[_0xcce3('0x2e')][_0xcce3('0x38')]+'%'};return _0x5b1c83;})});}_0x2dc54d=_['merge']({},_0x2dc54d,_0x5e9ea3[_0xcce3('0x3c')]);return _0x38bd84[_0xcce3('0x4a')](_0x2dc54d);}})['then'](function(_0x3c901b){if(_0x3c901b){_0x4bce8f=_0x3c901b['length'];if(!_0x5e9ea3[_0xcce3('0x2e')][_0xcce3('0x33')]('nolimit')){_0x2dc54d['limit']=qs[_0xcce3('0x1b')](_0x5e9ea3[_0xcce3('0x2e')][_0xcce3('0x1b')]);_0x2dc54d[_0xcce3('0x19')]=qs[_0xcce3('0x19')](_0x5e9ea3[_0xcce3('0x2e')][_0xcce3('0x19')]);}return _0x38bd84[_0xcce3('0x4a')](_0x2dc54d);}})['then'](function(_0x383a3b){if(_0x383a3b){return _0x383a3b?{'count':_0x4bce8f,'rows':_0x383a3b}:null;}})['then'](respondWithResult(_0xe663a2,null))[_0xcce3('0x42')](handleError(_0xe663a2,null));};exports[_0xcce3('0x4e')]=function(_0x152245,_0x394bc2,_0x39399f){var _0x19c7dc={};var _0x394000={};var _0x4878fd;var _0x2c4647;return db[_0xcce3('0x2a')][_0xcce3('0x4b')]({'where':{'id':_0x152245['params']['id']}})['then'](handleEntityNotFound(_0x394bc2,null))[_0xcce3('0x21')](function(_0x11ecf0){if(_0x11ecf0){_0x4878fd=_0x11ecf0;_0x394000[_0xcce3('0x2d')]=_[_0xcce3('0x2f')](db['ZohoField'][_0xcce3('0x45')]);_0x394000[_0xcce3('0x2e')]=_[_0xcce3('0x2f')](_0x152245['query']);_0x394000[_0xcce3('0x36')]=_[_0xcce3('0x30')](_0x394000[_0xcce3('0x2d')],_0x394000['query']);_0x19c7dc[_0xcce3('0x31')]=_[_0xcce3('0x30')](_0x394000['model'],qs[_0xcce3('0x32')](_0x152245[_0xcce3('0x2e')][_0xcce3('0x32')]));_0x19c7dc['attributes']=_0x19c7dc[_0xcce3('0x31')][_0xcce3('0x46')]?_0x19c7dc[_0xcce3('0x31')]:_0x394000['model'];_0x19c7dc['order']=qs[_0xcce3('0x35')](_0x152245[_0xcce3('0x2e')][_0xcce3('0x35')]);_0x19c7dc[_0xcce3('0x39')]=qs[_0xcce3('0x36')](_[_0xcce3('0x37')](_0x152245[_0xcce3('0x2e')],_0x394000[_0xcce3('0x36')]));if(_0x152245['query'][_0xcce3('0x38')]){_0x19c7dc[_0xcce3('0x39')]=_[_0xcce3('0x3b')](_0x19c7dc[_0xcce3('0x39')],{'$or':_[_0xcce3('0x29')](_0x19c7dc[_0xcce3('0x31')],function(_0x110bd9){var _0xd24423={};_0xd24423[_0x110bd9]={'$like':'%'+_0x152245[_0xcce3('0x2e')][_0xcce3('0x38')]+'%'};return _0xd24423;})});}_0x19c7dc=_[_0xcce3('0x3b')]({},_0x19c7dc,_0x152245[_0xcce3('0x3c')]);return _0x4878fd[_0xcce3('0x4e')](_0x19c7dc);}})[_0xcce3('0x21')](function(_0xbb5696){if(_0xbb5696){_0x2c4647=_0xbb5696[_0xcce3('0x46')];if(!_0x152245[_0xcce3('0x2e')][_0xcce3('0x33')]('nolimit')){_0x19c7dc[_0xcce3('0x1b')]=qs[_0xcce3('0x1b')](_0x152245[_0xcce3('0x2e')]['limit']);_0x19c7dc[_0xcce3('0x19')]=qs[_0xcce3('0x19')](_0x152245[_0xcce3('0x2e')]['offset']);}return _0x4878fd[_0xcce3('0x4e')](_0x19c7dc);}})[_0xcce3('0x21')](function(_0x228060){if(_0x228060){return _0x228060?{'count':_0x2c4647,'rows':_0x228060}:null;}})[_0xcce3('0x21')](respondWithResult(_0x394bc2,null))[_0xcce3('0x42')](handleError(_0x394bc2,null));};exports[_0xcce3('0x4f')]=function(_0x4e7c6e,_0x448044,_0x227ff0){var _0x8e96f3={};var _0x2fcebf={};var _0x129470;var _0xc9ae4a;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x4e7c6e[_0xcce3('0x44')]['id']}})[_0xcce3('0x21')](handleEntityNotFound(_0x448044,null))[_0xcce3('0x21')](function(_0x5d9034){if(_0x5d9034){_0x129470=_0x5d9034;_0x2fcebf[_0xcce3('0x2d')]=_[_0xcce3('0x2f')](db[_0xcce3('0x4c')][_0xcce3('0x45')]);_0x2fcebf[_0xcce3('0x2e')]=_[_0xcce3('0x2f')](_0x4e7c6e[_0xcce3('0x2e')]);_0x2fcebf[_0xcce3('0x36')]=_[_0xcce3('0x30')](_0x2fcebf[_0xcce3('0x2d')],_0x2fcebf[_0xcce3('0x2e')]);_0x8e96f3[_0xcce3('0x31')]=_[_0xcce3('0x30')](_0x2fcebf[_0xcce3('0x2d')],qs['fields'](_0x4e7c6e[_0xcce3('0x2e')][_0xcce3('0x32')]));_0x8e96f3[_0xcce3('0x31')]=_0x8e96f3[_0xcce3('0x31')][_0xcce3('0x46')]?_0x8e96f3[_0xcce3('0x31')]:_0x2fcebf[_0xcce3('0x2d')];_0x8e96f3[_0xcce3('0x4d')]=qs[_0xcce3('0x35')](_0x4e7c6e['query'][_0xcce3('0x35')]);_0x8e96f3[_0xcce3('0x39')]=qs[_0xcce3('0x36')](_['pick'](_0x4e7c6e['query'],_0x2fcebf[_0xcce3('0x36')]));if(_0x4e7c6e[_0xcce3('0x2e')]['filter']){_0x8e96f3[_0xcce3('0x39')]=_[_0xcce3('0x3b')](_0x8e96f3[_0xcce3('0x39')],{'$or':_[_0xcce3('0x29')](_0x8e96f3['attributes'],function(_0x14df65){var _0x143784={};_0x143784[_0x14df65]={'$like':'%'+_0x4e7c6e[_0xcce3('0x2e')][_0xcce3('0x38')]+'%'};return _0x143784;})});}_0x8e96f3=_[_0xcce3('0x3b')]({},_0x8e96f3,_0x4e7c6e[_0xcce3('0x3c')]);return _0x129470[_0xcce3('0x4f')](_0x8e96f3);}})[_0xcce3('0x21')](function(_0x34515e){if(_0x34515e){_0xc9ae4a=_0x34515e[_0xcce3('0x46')];if(!_0x4e7c6e[_0xcce3('0x2e')][_0xcce3('0x33')](_0xcce3('0x34'))){_0x8e96f3[_0xcce3('0x1b')]=qs['limit'](_0x4e7c6e[_0xcce3('0x2e')][_0xcce3('0x1b')]);_0x8e96f3[_0xcce3('0x19')]=qs[_0xcce3('0x19')](_0x4e7c6e[_0xcce3('0x2e')]['offset']);}return _0x129470[_0xcce3('0x4f')](_0x8e96f3);}})[_0xcce3('0x21')](function(_0x22b0f7){if(_0x22b0f7){return _0x22b0f7?{'count':_0xc9ae4a,'rows':_0x22b0f7}:null;}})['then'](respondWithResult(_0x448044,null))['catch'](handleError(_0x448044,null));}; \ No newline at end of file +var _0x0bd8=['catch','keys','options','find','create','body','params','getFields','findOne','ZohoField','filter','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','includeAll','include','findAll','rows'];(function(_0x3c0399,_0x514665){var _0x2a17a7=function(_0x3b6352){while(--_0x3b6352){_0x3c0399['push'](_0x3c0399['shift']());}};_0x2a17a7(++_0x514665);}(_0x0bd8,0x1ac));var _0x80bd=function(_0x3cafb8,_0x32860e){_0x3cafb8=_0x3cafb8-0x0;var _0x4b7f85=_0x0bd8[_0x3cafb8];return _0x4b7f85;};'use strict';var emlformat=require(_0x80bd('0x0'));var rimraf=require(_0x80bd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x80bd('0x2'));var rp=require('request-promise');var moment=require(_0x80bd('0x3'));var BPromise=require(_0x80bd('0x4'));var Mustache=require(_0x80bd('0x5'));var util=require(_0x80bd('0x6'));var path=require(_0x80bd('0x7'));var sox=require(_0x80bd('0x8'));var csv=require(_0x80bd('0x9'));var ejs=require(_0x80bd('0xa'));var fs=require('fs');var fs_extra=require(_0x80bd('0xb'));var _=require(_0x80bd('0xc'));var squel=require('squel');var crypto=require(_0x80bd('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x80bd('0xe'));var toCsv=require(_0x80bd('0x9'));var querystring=require(_0x80bd('0xf'));var Papa=require(_0x80bd('0x10'));var Redis=require(_0x80bd('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x80bd('0x12'));var as=require(_0x80bd('0x13'));var hardwareService=require(_0x80bd('0x14'));var logger=require(_0x80bd('0x15'))(_0x80bd('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x80bd('0x17'));var db=require(_0x80bd('0x18'))['db'];function respondWithStatusCode(_0x216635,_0x232b6d){_0x232b6d=_0x232b6d||0xcc;return function(_0x78dc64){if(_0x78dc64){return _0x216635[_0x80bd('0x19')](_0x232b6d);}return _0x216635[_0x80bd('0x1a')](_0x232b6d)[_0x80bd('0x1b')]();};}function respondWithResult(_0x4f6115,_0x47e152){_0x47e152=_0x47e152||0xc8;return function(_0xd0f7e){if(_0xd0f7e){return _0x4f6115[_0x80bd('0x1a')](_0x47e152)[_0x80bd('0x1c')](_0xd0f7e);}};}function respondWithFilteredResult(_0xa9b1a3,_0x5ed732){return function(_0x13b4a8){if(_0x13b4a8){var _0xb02fd2=typeof _0x5ed732[_0x80bd('0x1d')]===_0x80bd('0x1e')&&typeof _0x5ed732[_0x80bd('0x1f')]===_0x80bd('0x1e');var _0x50910f=_0x13b4a8[_0x80bd('0x20')];var _0x38da4a=_0xb02fd2?0x0:_0x5ed732[_0x80bd('0x1d')];var _0x12a0c5=_0xb02fd2?_0x13b4a8[_0x80bd('0x20')]:_0x5ed732[_0x80bd('0x1d')]+_0x5ed732[_0x80bd('0x1f')];var _0x33f122;if(_0x12a0c5>=_0x50910f){_0x12a0c5=_0x50910f;_0x33f122=0xc8;}else{_0x33f122=0xce;}_0xa9b1a3[_0x80bd('0x1a')](_0x33f122);return _0xa9b1a3[_0x80bd('0x21')](_0x80bd('0x22'),_0x38da4a+'-'+_0x12a0c5+'/'+_0x50910f)['json'](_0x13b4a8);}return null;};}function patchUpdates(_0x17d465){return function(_0xf3294){try{jsonpatch[_0x80bd('0x23')](_0xf3294,_0x17d465,!![]);}catch(_0x406c0c){return BPromise[_0x80bd('0x24')](_0x406c0c);}return _0xf3294[_0x80bd('0x25')]();};}function saveUpdates(_0x4b543d,_0x35b8c2){return function(_0x926971){if(_0x926971){return _0x926971[_0x80bd('0x26')](_0x4b543d)[_0x80bd('0x27')](function(_0x52fba8){return _0x52fba8;});}return null;};}function removeEntity(_0x3d5ebb,_0x2d0f53){return function(_0x5e180c){if(_0x5e180c){return _0x5e180c['destroy']()[_0x80bd('0x27')](function(){_0x3d5ebb[_0x80bd('0x1a')](0xcc)[_0x80bd('0x1b')]();});}};}function handleEntityNotFound(_0x4084d6,_0x1f865a){return function(_0x59083f){if(!_0x59083f){_0x4084d6[_0x80bd('0x19')](0x194);}return _0x59083f;};}function handleError(_0x132f56,_0x5862ed){_0x5862ed=_0x5862ed||0x1f4;return function(_0x519f31){logger[_0x80bd('0x28')](_0x519f31[_0x80bd('0x29')]);if(_0x519f31[_0x80bd('0x2a')]){delete _0x519f31['name'];}_0x132f56['status'](_0x5862ed)[_0x80bd('0x2b')](_0x519f31);};}exports[_0x80bd('0x2c')]=function(_0x15abf0,_0x22d834){var _0x1ffc67={},_0x3e0ebd={},_0x3e689f={'count':0x0,'rows':[]};var _0x208ec4=_[_0x80bd('0x2d')](db[_0x80bd('0x2e')][_0x80bd('0x2f')],function(_0x442763){return{'name':_0x442763[_0x80bd('0x30')],'type':_0x442763[_0x80bd('0x31')][_0x80bd('0x32')]};});_0x3e0ebd[_0x80bd('0x33')]=_[_0x80bd('0x2d')](_0x208ec4,_0x80bd('0x2a'));_0x3e0ebd[_0x80bd('0x34')]=_['keys'](_0x15abf0['query']);_0x3e0ebd['filters']=_[_0x80bd('0x35')](_0x3e0ebd[_0x80bd('0x33')],_0x3e0ebd[_0x80bd('0x34')]);_0x1ffc67[_0x80bd('0x36')]=_[_0x80bd('0x35')](_0x3e0ebd[_0x80bd('0x33')],qs[_0x80bd('0x37')](_0x15abf0[_0x80bd('0x34')][_0x80bd('0x37')]));_0x1ffc67[_0x80bd('0x36')]=_0x1ffc67[_0x80bd('0x36')][_0x80bd('0x38')]?_0x1ffc67[_0x80bd('0x36')]:_0x3e0ebd['model'];if(!_0x15abf0[_0x80bd('0x34')][_0x80bd('0x39')](_0x80bd('0x3a'))){_0x1ffc67[_0x80bd('0x1f')]=qs[_0x80bd('0x1f')](_0x15abf0[_0x80bd('0x34')][_0x80bd('0x1f')]);_0x1ffc67[_0x80bd('0x1d')]=qs[_0x80bd('0x1d')](_0x15abf0[_0x80bd('0x34')][_0x80bd('0x1d')]);}_0x1ffc67[_0x80bd('0x3b')]=qs['sort'](_0x15abf0['query'][_0x80bd('0x3c')]);_0x1ffc67[_0x80bd('0x3d')]=qs[_0x80bd('0x3e')](_[_0x80bd('0x3f')](_0x15abf0['query'],_0x3e0ebd[_0x80bd('0x3e')]),_0x208ec4);if(_0x15abf0[_0x80bd('0x34')]['filter']){_0x1ffc67[_0x80bd('0x3d')]=_[_0x80bd('0x40')](_0x1ffc67[_0x80bd('0x3d')],{'$or':_[_0x80bd('0x2d')](_0x208ec4,function(_0x139021){if(_0x139021['type']!==_0x80bd('0x41')){var _0xda7efc={};_0xda7efc[_0x139021['name']]={'$like':'%'+_0x15abf0[_0x80bd('0x34')]['filter']+'%'};return _0xda7efc;}})});}_0x1ffc67=_['merge']({},_0x1ffc67,_0x15abf0['options']);var _0x31b29c={'where':_0x1ffc67[_0x80bd('0x3d')]};return db[_0x80bd('0x2e')][_0x80bd('0x20')](_0x31b29c)['then'](function(_0x6a0ddb){_0x3e689f[_0x80bd('0x20')]=_0x6a0ddb;if(_0x15abf0[_0x80bd('0x34')][_0x80bd('0x42')]){_0x1ffc67[_0x80bd('0x43')]=[{'all':!![]}];}return db[_0x80bd('0x2e')][_0x80bd('0x44')](_0x1ffc67);})[_0x80bd('0x27')](function(_0x25f424){_0x3e689f[_0x80bd('0x45')]=_0x25f424;return _0x3e689f;})[_0x80bd('0x27')](respondWithFilteredResult(_0x22d834,_0x1ffc67))[_0x80bd('0x46')](handleError(_0x22d834,null));};exports['show']=function(_0x1b28d3,_0x40f5d6){var _0x958fed={'raw':![],'where':{'id':_0x1b28d3['params']['id']}},_0x351c17={};_0x351c17['model']=_[_0x80bd('0x47')](db[_0x80bd('0x2e')][_0x80bd('0x2f')]);_0x351c17[_0x80bd('0x34')]=_['keys'](_0x1b28d3[_0x80bd('0x34')]);_0x351c17[_0x80bd('0x3e')]=_[_0x80bd('0x35')](_0x351c17[_0x80bd('0x33')],_0x351c17[_0x80bd('0x34')]);_0x958fed[_0x80bd('0x36')]=_[_0x80bd('0x35')](_0x351c17[_0x80bd('0x33')],qs['fields'](_0x1b28d3[_0x80bd('0x34')][_0x80bd('0x37')]));_0x958fed[_0x80bd('0x36')]=_0x958fed[_0x80bd('0x36')][_0x80bd('0x38')]?_0x958fed['attributes']:_0x351c17['model'];if(_0x1b28d3[_0x80bd('0x34')][_0x80bd('0x42')]){_0x958fed[_0x80bd('0x43')]=[{'all':!![]}];}_0x958fed=_[_0x80bd('0x40')]({},_0x958fed,_0x1b28d3[_0x80bd('0x48')]);return db[_0x80bd('0x2e')][_0x80bd('0x49')](_0x958fed)[_0x80bd('0x27')](handleEntityNotFound(_0x40f5d6,null))['then'](respondWithResult(_0x40f5d6,null))[_0x80bd('0x46')](handleError(_0x40f5d6,null));};exports[_0x80bd('0x4a')]=function(_0x2604e8,_0x4c6068){return db[_0x80bd('0x2e')][_0x80bd('0x4a')](_0x2604e8[_0x80bd('0x4b')],{})[_0x80bd('0x27')](respondWithResult(_0x4c6068,0xc9))[_0x80bd('0x46')](handleError(_0x4c6068,null));};exports[_0x80bd('0x26')]=function(_0x1cb8c4,_0x28630c){if(_0x1cb8c4['body']['id']){delete _0x1cb8c4['body']['id'];}return db['ZohoConfiguration']['find']({'where':{'id':_0x1cb8c4[_0x80bd('0x4c')]['id']}})['then'](handleEntityNotFound(_0x28630c,null))['then'](saveUpdates(_0x1cb8c4['body'],null))[_0x80bd('0x27')](respondWithResult(_0x28630c,null))[_0x80bd('0x46')](handleError(_0x28630c,null));};exports['destroy']=function(_0x1d5165,_0x998a86){return db[_0x80bd('0x2e')][_0x80bd('0x49')]({'where':{'id':_0x1d5165['params']['id']}})[_0x80bd('0x27')](handleEntityNotFound(_0x998a86,null))[_0x80bd('0x27')](removeEntity(_0x998a86,null))['catch'](handleError(_0x998a86,null));};exports[_0x80bd('0x4d')]=function(_0x53eeec,_0x2a1f9e,_0xf22587){var _0x32e629={};var _0x1eef3a={};var _0x2280f9;var _0x5e9f27;return db['ZohoConfiguration'][_0x80bd('0x4e')]({'where':{'id':_0x53eeec[_0x80bd('0x4c')]['id']}})[_0x80bd('0x27')](handleEntityNotFound(_0x2a1f9e,null))[_0x80bd('0x27')](function(_0x5baa0d){if(_0x5baa0d){_0x2280f9=_0x5baa0d;_0x1eef3a[_0x80bd('0x33')]=_[_0x80bd('0x47')](db[_0x80bd('0x4f')][_0x80bd('0x2f')]);_0x1eef3a['query']=_[_0x80bd('0x47')](_0x53eeec[_0x80bd('0x34')]);_0x1eef3a['filters']=_[_0x80bd('0x35')](_0x1eef3a['model'],_0x1eef3a[_0x80bd('0x34')]);_0x32e629['attributes']=_['intersection'](_0x1eef3a['model'],qs[_0x80bd('0x37')](_0x53eeec[_0x80bd('0x34')][_0x80bd('0x37')]));_0x32e629['attributes']=_0x32e629[_0x80bd('0x36')]['length']?_0x32e629[_0x80bd('0x36')]:_0x1eef3a[_0x80bd('0x33')];_0x32e629[_0x80bd('0x3b')]=qs['sort'](_0x53eeec[_0x80bd('0x34')][_0x80bd('0x3c')]);_0x32e629[_0x80bd('0x3d')]=qs[_0x80bd('0x3e')](_[_0x80bd('0x3f')](_0x53eeec[_0x80bd('0x34')],_0x1eef3a[_0x80bd('0x3e')]));if(_0x53eeec[_0x80bd('0x34')][_0x80bd('0x50')]){_0x32e629[_0x80bd('0x3d')]=_[_0x80bd('0x40')](_0x32e629[_0x80bd('0x3d')],{'$or':_[_0x80bd('0x2d')](_0x32e629[_0x80bd('0x36')],function(_0x58651d){var _0x536436={};_0x536436[_0x58651d]={'$like':'%'+_0x53eeec[_0x80bd('0x34')][_0x80bd('0x50')]+'%'};return _0x536436;})});}_0x32e629=_[_0x80bd('0x40')]({},_0x32e629,_0x53eeec[_0x80bd('0x48')]);return _0x2280f9['getFields'](_0x32e629);}})[_0x80bd('0x27')](function(_0x5c3bc1){if(_0x5c3bc1){_0x5e9f27=_0x5c3bc1[_0x80bd('0x38')];if(!_0x53eeec[_0x80bd('0x34')][_0x80bd('0x39')](_0x80bd('0x3a'))){_0x32e629[_0x80bd('0x1f')]=qs['limit'](_0x53eeec[_0x80bd('0x34')]['limit']);_0x32e629['offset']=qs[_0x80bd('0x1d')](_0x53eeec[_0x80bd('0x34')]['offset']);}return _0x2280f9[_0x80bd('0x4d')](_0x32e629);}})[_0x80bd('0x27')](function(_0x4f05ec){if(_0x4f05ec){return _0x4f05ec?{'count':_0x5e9f27,'rows':_0x4f05ec}:null;}})[_0x80bd('0x27')](respondWithResult(_0x2a1f9e,null))[_0x80bd('0x46')](handleError(_0x2a1f9e,null));};exports[_0x80bd('0x51')]=function(_0x4b9618,_0xb00049,_0x12a6bf){var _0x331a32={};var _0x237a9e={};var _0x2b42bc;var _0x13fde7;return db[_0x80bd('0x2e')][_0x80bd('0x4e')]({'where':{'id':_0x4b9618[_0x80bd('0x4c')]['id']}})[_0x80bd('0x27')](handleEntityNotFound(_0xb00049,null))[_0x80bd('0x27')](function(_0x2206ff){if(_0x2206ff){_0x2b42bc=_0x2206ff;_0x237a9e[_0x80bd('0x33')]=_[_0x80bd('0x47')](db[_0x80bd('0x4f')]['rawAttributes']);_0x237a9e['query']=_[_0x80bd('0x47')](_0x4b9618[_0x80bd('0x34')]);_0x237a9e[_0x80bd('0x3e')]=_['intersection'](_0x237a9e[_0x80bd('0x33')],_0x237a9e[_0x80bd('0x34')]);_0x331a32[_0x80bd('0x36')]=_[_0x80bd('0x35')](_0x237a9e['model'],qs['fields'](_0x4b9618[_0x80bd('0x34')][_0x80bd('0x37')]));_0x331a32[_0x80bd('0x36')]=_0x331a32[_0x80bd('0x36')][_0x80bd('0x38')]?_0x331a32[_0x80bd('0x36')]:_0x237a9e['model'];_0x331a32[_0x80bd('0x3b')]=qs[_0x80bd('0x3c')](_0x4b9618[_0x80bd('0x34')][_0x80bd('0x3c')]);_0x331a32[_0x80bd('0x3d')]=qs['filters'](_['pick'](_0x4b9618[_0x80bd('0x34')],_0x237a9e[_0x80bd('0x3e')]));if(_0x4b9618['query'][_0x80bd('0x50')]){_0x331a32[_0x80bd('0x3d')]=_[_0x80bd('0x40')](_0x331a32[_0x80bd('0x3d')],{'$or':_[_0x80bd('0x2d')](_0x331a32['attributes'],function(_0x5a7b29){var _0x22a64f={};_0x22a64f[_0x5a7b29]={'$like':'%'+_0x4b9618['query'][_0x80bd('0x50')]+'%'};return _0x22a64f;})});}_0x331a32=_[_0x80bd('0x40')]({},_0x331a32,_0x4b9618['options']);return _0x2b42bc[_0x80bd('0x51')](_0x331a32);}})[_0x80bd('0x27')](function(_0x38148e){if(_0x38148e){_0x13fde7=_0x38148e[_0x80bd('0x38')];if(!_0x4b9618['query'][_0x80bd('0x39')]('nolimit')){_0x331a32['limit']=qs[_0x80bd('0x1f')](_0x4b9618[_0x80bd('0x34')][_0x80bd('0x1f')]);_0x331a32[_0x80bd('0x1d')]=qs[_0x80bd('0x1d')](_0x4b9618['query'][_0x80bd('0x1d')]);}return _0x2b42bc['getSubjects'](_0x331a32);}})['then'](function(_0x1e05fe){if(_0x1e05fe){return _0x1e05fe?{'count':_0x13fde7,'rows':_0x1e05fe}:null;}})[_0x80bd('0x27')](respondWithResult(_0xb00049,null))[_0x80bd('0x46')](handleError(_0xb00049,null));};exports[_0x80bd('0x52')]=function(_0x5e48cd,_0x2e08dd,_0x423f83){var _0x44c5d2={};var _0x2b9971={};var _0x2a62b1;var _0x3a001b;return db[_0x80bd('0x2e')][_0x80bd('0x4e')]({'where':{'id':_0x5e48cd[_0x80bd('0x4c')]['id']}})[_0x80bd('0x27')](handleEntityNotFound(_0x2e08dd,null))[_0x80bd('0x27')](function(_0x5e540c){if(_0x5e540c){_0x2a62b1=_0x5e540c;_0x2b9971[_0x80bd('0x33')]=_[_0x80bd('0x47')](db[_0x80bd('0x4f')][_0x80bd('0x2f')]);_0x2b9971['query']=_['keys'](_0x5e48cd[_0x80bd('0x34')]);_0x2b9971[_0x80bd('0x3e')]=_['intersection'](_0x2b9971[_0x80bd('0x33')],_0x2b9971['query']);_0x44c5d2[_0x80bd('0x36')]=_[_0x80bd('0x35')](_0x2b9971[_0x80bd('0x33')],qs['fields'](_0x5e48cd['query'][_0x80bd('0x37')]));_0x44c5d2['attributes']=_0x44c5d2[_0x80bd('0x36')]['length']?_0x44c5d2[_0x80bd('0x36')]:_0x2b9971[_0x80bd('0x33')];_0x44c5d2[_0x80bd('0x3b')]=qs[_0x80bd('0x3c')](_0x5e48cd['query'][_0x80bd('0x3c')]);_0x44c5d2['where']=qs[_0x80bd('0x3e')](_[_0x80bd('0x3f')](_0x5e48cd['query'],_0x2b9971[_0x80bd('0x3e')]));if(_0x5e48cd['query'][_0x80bd('0x50')]){_0x44c5d2[_0x80bd('0x3d')]=_['merge'](_0x44c5d2[_0x80bd('0x3d')],{'$or':_[_0x80bd('0x2d')](_0x44c5d2['attributes'],function(_0x3d0238){var _0x523adf={};_0x523adf[_0x3d0238]={'$like':'%'+_0x5e48cd[_0x80bd('0x34')]['filter']+'%'};return _0x523adf;})});}_0x44c5d2=_[_0x80bd('0x40')]({},_0x44c5d2,_0x5e48cd[_0x80bd('0x48')]);return _0x2a62b1['getDescriptions'](_0x44c5d2);}})['then'](function(_0x44c2a9){if(_0x44c2a9){_0x3a001b=_0x44c2a9[_0x80bd('0x38')];if(!_0x5e48cd[_0x80bd('0x34')][_0x80bd('0x39')]('nolimit')){_0x44c5d2[_0x80bd('0x1f')]=qs['limit'](_0x5e48cd[_0x80bd('0x34')][_0x80bd('0x1f')]);_0x44c5d2['offset']=qs[_0x80bd('0x1d')](_0x5e48cd['query'][_0x80bd('0x1d')]);}return _0x2a62b1[_0x80bd('0x52')](_0x44c5d2);}})['then'](function(_0x11c0d3){if(_0x11c0d3){return _0x11c0d3?{'count':_0x3a001b,'rows':_0x11c0d3}:null;}})[_0x80bd('0x27')](respondWithResult(_0x2e08dd,null))[_0x80bd('0x46')](handleError(_0x2e08dd,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index d3822a7..7d99e36 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 _0x5773=['bluebird','request-promise','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','util','moment'];(function(_0x1ec57b,_0x539209){var _0x3c57b8=function(_0xefbb9f){while(--_0xefbb9f){_0x1ec57b['push'](_0x1ec57b['shift']());}};_0x3c57b8(++_0x539209);}(_0x5773,0x153));var _0x3577=function(_0x119de7,_0x3d1fbb){_0x119de7=_0x119de7-0x0;var _0x4a3ea3=_0x5773[_0x119de7];return _0x4a3ea3;};'use strict';var _=require('lodash');var util=require(_0x3577('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x3577('0x1'));var BPromise=require(_0x3577('0x2'));var rp=require(_0x3577('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3577('0x4'));var config=require(_0x3577('0x5'));var attributes=require(_0x3577('0x6'));module[_0x3577('0x7')]=function(_0x2d4368,_0x10e343){return _0x2d4368[_0x3577('0x8')](_0x3577('0x9'),attributes,{'tableName':_0x3577('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2468=['request-promise','path','rimraf','./intZohoConfiguration.attributes','exports','define','int_zoho_configurations','api','moment'];(function(_0x24f127,_0x5072d7){var _0x4c41ac=function(_0x5853dc){while(--_0x5853dc){_0x24f127['push'](_0x24f127['shift']());}};_0x4c41ac(++_0x5072d7);}(_0x2468,0x97));var _0x8246=function(_0x12bcf7,_0xc11103){_0x12bcf7=_0x12bcf7-0x0;var _0x2825a=_0x2468[_0x12bcf7];return _0x2825a;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x8246('0x0'));var moment=require(_0x8246('0x1'));var BPromise=require('bluebird');var rp=require(_0x8246('0x2'));var fs=require('fs');var path=require(_0x8246('0x3'));var rimraf=require(_0x8246('0x4'));var config=require('../../config/environment');var attributes=require(_0x8246('0x5'));module[_0x8246('0x6')]=function(_0x2ce2fb,_0x35ec0d){return _0x2ce2fb[_0x8246('0x7')]('ZohoConfiguration',attributes,{'tableName':_0x8246('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index 03a36c9..322b90d 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 _0x74a4=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util','moment','randomstring','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x74a4,0xd8));var _0x474a=function(_0x7aa234,_0x522dac){_0x7aa234=_0x7aa234-0x0;var _0x1b1ca9=_0x74a4[_0x7aa234];return _0x1b1ca9;};'use strict';var _=require('lodash');var util=require(_0x474a('0x0'));var moment=require(_0x474a('0x1'));var BPromise=require('bluebird');var rs=require(_0x474a('0x2'));var fs=require('fs');var Redis=require(_0x474a('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x474a('0x4'))(_0x474a('0x5'));var config=require(_0x474a('0x6'));var jayson=require(_0x474a('0x7'));var client=jayson[_0x474a('0x8')][_0x474a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x597c6a,_0x184ae3,_0x538eb4){return new BPromise(function(_0x4f6775,_0x1203ff){return client['request'](_0x597c6a,_0x538eb4)['then'](function(_0x29e2ab){logger['info'](_0x474a('0xa'),_0x184ae3,_0x474a('0xb'));logger[_0x474a('0xc')](_0x474a('0xd'),_0x184ae3,_0x474a('0xb'),JSON[_0x474a('0xe')](_0x29e2ab));if(_0x29e2ab['error']){if(_0x29e2ab[_0x474a('0xf')][_0x474a('0x10')]===0x1f4){logger[_0x474a('0xf')](_0x474a('0xa'),_0x184ae3,_0x29e2ab[_0x474a('0xf')][_0x474a('0x11')]);return _0x1203ff(_0x29e2ab[_0x474a('0xf')][_0x474a('0x11')]);}logger[_0x474a('0xf')](_0x474a('0xa'),_0x184ae3,_0x29e2ab[_0x474a('0xf')]['message']);return _0x4f6775(_0x29e2ab['error'][_0x474a('0x11')]);}else{logger[_0x474a('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0x184ae3,_0x474a('0xb'));_0x4f6775(_0x29e2ab['result'][_0x474a('0x11')]);}})[_0x474a('0x13')](function(_0x4df4da){logger[_0x474a('0xf')](_0x474a('0xa'),_0x184ae3,_0x4df4da);_0x1203ff(_0x4df4da);});});} \ No newline at end of file +var _0xdb2b=['then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x11b8b3,_0x30f7fd){var _0x20c810=function(_0x85666b){while(--_0x85666b){_0x11b8b3['push'](_0x11b8b3['shift']());}};_0x20c810(++_0x30f7fd);}(_0xdb2b,0xe7));var _0xbdb2=function(_0x53bf11,_0x3acb5e){_0x53bf11=_0x53bf11-0x0;var _0x3a4f47=_0xdb2b[_0x53bf11];return _0x3a4f47;};'use strict';var _=require(_0xbdb2('0x0'));var util=require('util');var moment=require(_0xbdb2('0x1'));var BPromise=require(_0xbdb2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbdb2('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbdb2('0x4'));var logger=require(_0xbdb2('0x5'))('rpc');var config=require(_0xbdb2('0x6'));var jayson=require(_0xbdb2('0x7'));var client=jayson[_0xbdb2('0x8')][_0xbdb2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xcc54ba,_0x4ccc46,_0x56c626){return new BPromise(function(_0x20724c,_0x5d626d){return client[_0xbdb2('0xa')](_0xcc54ba,_0x56c626)[_0xbdb2('0xb')](function(_0x3b5de7){logger[_0xbdb2('0xc')](_0xbdb2('0xd'),_0x4ccc46,_0xbdb2('0xe'));logger['debug'](_0xbdb2('0xf'),_0x4ccc46,_0xbdb2('0xe'),JSON[_0xbdb2('0x10')](_0x3b5de7));if(_0x3b5de7['error']){if(_0x3b5de7[_0xbdb2('0x11')][_0xbdb2('0x12')]===0x1f4){logger[_0xbdb2('0x11')](_0xbdb2('0xd'),_0x4ccc46,_0x3b5de7[_0xbdb2('0x11')]['message']);return _0x5d626d(_0x3b5de7[_0xbdb2('0x11')][_0xbdb2('0x13')]);}logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x4ccc46,_0x3b5de7[_0xbdb2('0x11')][_0xbdb2('0x13')]);return _0x20724c(_0x3b5de7[_0xbdb2('0x11')]['message']);}else{logger[_0xbdb2('0xc')](_0xbdb2('0xd'),_0x4ccc46,_0xbdb2('0xe'));_0x20724c(_0x3b5de7[_0xbdb2('0x14')][_0xbdb2('0x13')]);}})[_0xbdb2('0x15')](function(_0x525f11){logger[_0xbdb2('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x4ccc46,_0x525f11);_0x5d626d(_0x525f11);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index af13cd9..c9807ee 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 _0xf07a=['isAuthenticated','show','post','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','get','index','/:id'];(function(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0xf07a,0x86));var _0xaf07=function(_0x12a62c,_0xc9c41a){_0x12a62c=_0x12a62c-0x0;var _0x268a58=_0xf07a[_0x12a62c];return _0x268a58;};'use strict';var multer=require(_0xaf07('0x0'));var util=require(_0xaf07('0x1'));var path=require('path');var timeout=require(_0xaf07('0x2'));var express=require(_0xaf07('0x3'));var router=express[_0xaf07('0x4')]();var fs_extra=require(_0xaf07('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xaf07('0x6'));var controller=require('./intZohoField.controller');router[_0xaf07('0x7')]('/',auth['isAuthenticated'](),controller[_0xaf07('0x8')]);router['get'](_0xaf07('0x9'),auth[_0xaf07('0xa')](),controller[_0xaf07('0xb')]);router[_0xaf07('0xc')]('/',auth[_0xaf07('0xa')](),controller[_0xaf07('0xd')]);router['put'](_0xaf07('0x9'),auth[_0xaf07('0xa')](),controller[_0xaf07('0xe')]);router[_0xaf07('0xf')](_0xaf07('0x9'),auth['isAuthenticated'](),controller[_0xaf07('0x10')]);module[_0xaf07('0x11')]=router; \ No newline at end of file +var _0x3cfa=['./intZohoField.controller','index','get','isAuthenticated','post','/:id','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment'];(function(_0x3b632f,_0x453380){var _0x10e788=function(_0x2228a4){while(--_0x2228a4){_0x3b632f['push'](_0x3b632f['shift']());}};_0x10e788(++_0x453380);}(_0x3cfa,0x129));var _0xa3cf=function(_0x726eba,_0x23d3be){_0x726eba=_0x726eba-0x0;var _0x29a451=_0x3cfa[_0x726eba];return _0x29a451;};'use strict';var multer=require(_0xa3cf('0x0'));var util=require(_0xa3cf('0x1'));var path=require('path');var timeout=require(_0xa3cf('0x2'));var express=require(_0xa3cf('0x3'));var router=express[_0xa3cf('0x4')]();var fs_extra=require(_0xa3cf('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa3cf('0x6'));var controller=require(_0xa3cf('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xa3cf('0x8')]);router[_0xa3cf('0x9')]('/:id',auth[_0xa3cf('0xa')](),controller['show']);router[_0xa3cf('0xb')]('/',auth[_0xa3cf('0xa')](),controller['create']);router['put'](_0xa3cf('0xc'),auth[_0xa3cf('0xa')](),controller[_0xa3cf('0xd')]);router['delete'](_0xa3cf('0xc'),auth['isAuthenticated'](),controller[_0xa3cf('0xe')]);module[_0xa3cf('0xf')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index efcc7a4..4e58622 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 _0xf1f8=['BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue','picklist','STRING','customVariable'];(function(_0x3711ac,_0x5cd75f){var _0x4a9a82=function(_0x314da){while(--_0x314da){_0x3711ac['push'](_0x3711ac['shift']());}};_0x4a9a82(++_0x5cd75f);}(_0xf1f8,0x17d));var _0x8f1f=function(_0x44a98a,_0x47cd88){_0x44a98a=_0x44a98a-0x0;var _0x27c00e=_0xf1f8[_0x44a98a];return _0x27c00e;};'use strict';var Sequelize=require(_0x8f1f('0x0'));module[_0x8f1f('0x1')]={'type':{'type':Sequelize[_0x8f1f('0x2')](_0x8f1f('0x3'),_0x8f1f('0x4'),'customVariable',_0x8f1f('0x5'),_0x8f1f('0x6')),'defaultValue':_0x8f1f('0x3')},'content':{'type':Sequelize[_0x8f1f('0x7')]},'key':{'type':Sequelize[_0x8f1f('0x7')]},'keyType':{'type':Sequelize[_0x8f1f('0x2')](_0x8f1f('0x3'),_0x8f1f('0x4'),_0x8f1f('0x8'))},'keyContent':{'type':Sequelize[_0x8f1f('0x7')]},'idField':{'type':Sequelize[_0x8f1f('0x7')]},'nameField':{'type':Sequelize[_0x8f1f('0x7')]},'customField':{'type':Sequelize[_0x8f1f('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8f1f('0x7')]}}; \ No newline at end of file +var _0xa31c=['variable','keyValue','picklist','STRING','customVariable','BOOLEAN','sequelize','ENUM','string'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xa31c,0xf9));var _0xca31=function(_0x340fc7,_0x12a901){_0x340fc7=_0x340fc7-0x0;var _0x586c93=_0xa31c[_0x340fc7];return _0x586c93;};'use strict';var Sequelize=require(_0xca31('0x0'));module['exports']={'type':{'type':Sequelize[_0xca31('0x1')](_0xca31('0x2'),_0xca31('0x3'),'customVariable',_0xca31('0x4'),_0xca31('0x5')),'defaultValue':_0xca31('0x2')},'content':{'type':Sequelize[_0xca31('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xca31('0x1')](_0xca31('0x2'),'variable',_0xca31('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xca31('0x6')]},'nameField':{'type':Sequelize[_0xca31('0x6')]},'customField':{'type':Sequelize[_0xca31('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 5e2079f..22b305c 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 _0x26b5=['keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','catch','create','body','find','destroy','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','querystring','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','set','Content-Range','json','apply','save','update','then','end','error','stack','name','send','index','ZohoField','rawAttributes','type','model','query'];(function(_0x1b1ed8,_0x2b0f38){var _0x33e1d6=function(_0x545491){while(--_0x545491){_0x1b1ed8['push'](_0x1b1ed8['shift']());}};_0x33e1d6(++_0x2b0f38);}(_0x26b5,0xed));var _0x526b=function(_0x492138,_0xd6fa89){_0x492138=_0x492138-0x0;var _0x243809=_0x26b5[_0x492138];return _0x243809;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x526b('0x0'));var zipdir=require(_0x526b('0x1'));var jsonpatch=require(_0x526b('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x526b('0x3'));var Mustache=require(_0x526b('0x4'));var util=require(_0x526b('0x5'));var path=require('path');var sox=require(_0x526b('0x6'));var csv=require(_0x526b('0x7'));var ejs=require(_0x526b('0x8'));var fs=require('fs');var fs_extra=require(_0x526b('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x526b('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x526b('0x7'));var querystring=require(_0x526b('0xb'));var Papa=require('papaparse');var Redis=require(_0x526b('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x526b('0xd'));var logger=require(_0x526b('0xe'))(_0x526b('0xf'));var utils=require(_0x526b('0x10'));var config=require(_0x526b('0x11'));var licenseUtil=require(_0x526b('0x12'));var db=require(_0x526b('0x13'))['db'];function respondWithStatusCode(_0x3248f5,_0x38620a){_0x38620a=_0x38620a||0xcc;return function(_0x4bb976){if(_0x4bb976){return _0x3248f5[_0x526b('0x14')](_0x38620a);}return _0x3248f5[_0x526b('0x15')](_0x38620a)['end']();};}function respondWithResult(_0xd29894,_0x2f87b1){_0x2f87b1=_0x2f87b1||0xc8;return function(_0x3ae6e3){if(_0x3ae6e3){return _0xd29894[_0x526b('0x15')](_0x2f87b1)['json'](_0x3ae6e3);}};}function respondWithFilteredResult(_0x1abd4d,_0x2fd6dc){return function(_0x209186){if(_0x209186){var _0x7b294c=typeof _0x2fd6dc[_0x526b('0x16')]==='undefined'&&typeof _0x2fd6dc['limit']===_0x526b('0x17');var _0x44e3dd=_0x209186[_0x526b('0x18')];var _0x5e0291=_0x7b294c?0x0:_0x2fd6dc[_0x526b('0x16')];var _0x3f642b=_0x7b294c?_0x209186[_0x526b('0x18')]:_0x2fd6dc['offset']+_0x2fd6dc['limit'];var _0x5983f9;if(_0x3f642b>=_0x44e3dd){_0x3f642b=_0x44e3dd;_0x5983f9=0xc8;}else{_0x5983f9=0xce;}_0x1abd4d[_0x526b('0x15')](_0x5983f9);return _0x1abd4d[_0x526b('0x19')](_0x526b('0x1a'),_0x5e0291+'-'+_0x3f642b+'/'+_0x44e3dd)[_0x526b('0x1b')](_0x209186);}return null;};}function patchUpdates(_0x4e57c3){return function(_0x2dfdf1){try{jsonpatch[_0x526b('0x1c')](_0x2dfdf1,_0x4e57c3,!![]);}catch(_0xb54534){return BPromise['reject'](_0xb54534);}return _0x2dfdf1[_0x526b('0x1d')]();};}function saveUpdates(_0x2f0494,_0x40f6e3){return function(_0x8758e9){if(_0x8758e9){return _0x8758e9[_0x526b('0x1e')](_0x2f0494)[_0x526b('0x1f')](function(_0x301528){return _0x301528;});}return null;};}function removeEntity(_0x5f57fc,_0xe3ae7e){return function(_0x338483){if(_0x338483){return _0x338483['destroy']()[_0x526b('0x1f')](function(){_0x5f57fc[_0x526b('0x15')](0xcc)[_0x526b('0x20')]();});}};}function handleEntityNotFound(_0x404513,_0x28891f){return function(_0x5dffb7){if(!_0x5dffb7){_0x404513[_0x526b('0x14')](0x194);}return _0x5dffb7;};}function handleError(_0x18c3d2,_0x1ba032){_0x1ba032=_0x1ba032||0x1f4;return function(_0x41505c){logger[_0x526b('0x21')](_0x41505c[_0x526b('0x22')]);if(_0x41505c[_0x526b('0x23')]){delete _0x41505c[_0x526b('0x23')];}_0x18c3d2[_0x526b('0x15')](_0x1ba032)[_0x526b('0x24')](_0x41505c);};}exports[_0x526b('0x25')]=function(_0x21cb15,_0x5a29f9){var _0x3c50e4={},_0x502912={},_0x84ea5c={'count':0x0,'rows':[]};var _0x28c80c=_['map'](db[_0x526b('0x26')][_0x526b('0x27')],function(_0x221c13){return{'name':_0x221c13['fieldName'],'type':_0x221c13[_0x526b('0x28')]['key']};});_0x502912[_0x526b('0x29')]=_['map'](_0x28c80c,_0x526b('0x23'));_0x502912[_0x526b('0x2a')]=_[_0x526b('0x2b')](_0x21cb15[_0x526b('0x2a')]);_0x502912[_0x526b('0x2c')]=_[_0x526b('0x2d')](_0x502912[_0x526b('0x29')],_0x502912[_0x526b('0x2a')]);_0x3c50e4['attributes']=_[_0x526b('0x2d')](_0x502912[_0x526b('0x29')],qs[_0x526b('0x2e')](_0x21cb15[_0x526b('0x2a')][_0x526b('0x2e')]));_0x3c50e4[_0x526b('0x2f')]=_0x3c50e4[_0x526b('0x2f')][_0x526b('0x30')]?_0x3c50e4[_0x526b('0x2f')]:_0x502912[_0x526b('0x29')];if(!_0x21cb15[_0x526b('0x2a')][_0x526b('0x31')]('nolimit')){_0x3c50e4[_0x526b('0x32')]=qs[_0x526b('0x32')](_0x21cb15[_0x526b('0x2a')]['limit']);_0x3c50e4['offset']=qs[_0x526b('0x16')](_0x21cb15[_0x526b('0x2a')][_0x526b('0x16')]);}_0x3c50e4[_0x526b('0x33')]=qs[_0x526b('0x34')](_0x21cb15[_0x526b('0x2a')][_0x526b('0x34')]);_0x3c50e4[_0x526b('0x35')]=qs[_0x526b('0x2c')](_[_0x526b('0x36')](_0x21cb15['query'],_0x502912[_0x526b('0x2c')]),_0x28c80c);if(_0x21cb15[_0x526b('0x2a')][_0x526b('0x37')]){_0x3c50e4[_0x526b('0x35')]=_[_0x526b('0x38')](_0x3c50e4[_0x526b('0x35')],{'$or':_['map'](_0x28c80c,function(_0x55eac1){if(_0x55eac1[_0x526b('0x28')]!==_0x526b('0x39')){var _0x3db811={};_0x3db811[_0x55eac1[_0x526b('0x23')]]={'$like':'%'+_0x21cb15[_0x526b('0x2a')][_0x526b('0x37')]+'%'};return _0x3db811;}})});}_0x3c50e4=_['merge']({},_0x3c50e4,_0x21cb15[_0x526b('0x3a')]);var _0x55c420={'where':_0x3c50e4[_0x526b('0x35')]};return db['ZohoField']['count'](_0x55c420)[_0x526b('0x1f')](function(_0x403297){_0x84ea5c[_0x526b('0x18')]=_0x403297;if(_0x21cb15['query'][_0x526b('0x3b')]){_0x3c50e4[_0x526b('0x3c')]=[{'all':!![]}];}return db[_0x526b('0x26')][_0x526b('0x3d')](_0x3c50e4);})[_0x526b('0x1f')](function(_0x379cd8){_0x84ea5c[_0x526b('0x3e')]=_0x379cd8;return _0x84ea5c;})[_0x526b('0x1f')](respondWithFilteredResult(_0x5a29f9,_0x3c50e4))['catch'](handleError(_0x5a29f9,null));};exports[_0x526b('0x3f')]=function(_0x42172b,_0x3534e1){var _0x14ecce={'raw':!![],'where':{'id':_0x42172b[_0x526b('0x40')]['id']}},_0x60fd26={};_0x60fd26[_0x526b('0x29')]=_[_0x526b('0x2b')](db[_0x526b('0x26')]['rawAttributes']);_0x60fd26[_0x526b('0x2a')]=_[_0x526b('0x2b')](_0x42172b[_0x526b('0x2a')]);_0x60fd26[_0x526b('0x2c')]=_[_0x526b('0x2d')](_0x60fd26[_0x526b('0x29')],_0x60fd26[_0x526b('0x2a')]);_0x14ecce['attributes']=_[_0x526b('0x2d')](_0x60fd26['model'],qs[_0x526b('0x2e')](_0x42172b[_0x526b('0x2a')]['fields']));_0x14ecce[_0x526b('0x2f')]=_0x14ecce['attributes'][_0x526b('0x30')]?_0x14ecce[_0x526b('0x2f')]:_0x60fd26[_0x526b('0x29')];if(_0x42172b[_0x526b('0x2a')][_0x526b('0x3b')]){_0x14ecce[_0x526b('0x3c')]=[{'all':!![]}];}_0x14ecce=_[_0x526b('0x38')]({},_0x14ecce,_0x42172b[_0x526b('0x3a')]);return db[_0x526b('0x26')]['find'](_0x14ecce)['then'](handleEntityNotFound(_0x3534e1,null))[_0x526b('0x1f')](respondWithResult(_0x3534e1,null))[_0x526b('0x41')](handleError(_0x3534e1,null));};exports[_0x526b('0x42')]=function(_0x5c6f57,_0xe43d95){return db['ZohoField'][_0x526b('0x42')](_0x5c6f57[_0x526b('0x43')],{})[_0x526b('0x1f')](respondWithResult(_0xe43d95,0xc9))['catch'](handleError(_0xe43d95,null));};exports['update']=function(_0x2155c9,_0x526929){if(_0x2155c9[_0x526b('0x43')]['id']){delete _0x2155c9['body']['id'];}return db['ZohoField'][_0x526b('0x44')]({'where':{'id':_0x2155c9[_0x526b('0x40')]['id']}})[_0x526b('0x1f')](handleEntityNotFound(_0x526929,null))['then'](saveUpdates(_0x2155c9[_0x526b('0x43')],null))[_0x526b('0x1f')](respondWithResult(_0x526929,null))[_0x526b('0x41')](handleError(_0x526929,null));};exports[_0x526b('0x45')]=function(_0x2e7ff0,_0xcfb600){return db[_0x526b('0x26')][_0x526b('0x44')]({'where':{'id':_0x2e7ff0[_0x526b('0x40')]['id']}})[_0x526b('0x1f')](handleEntityNotFound(_0xcfb600,null))[_0x526b('0x1f')](removeEntity(_0xcfb600,null))[_0x526b('0x41')](handleError(_0xcfb600,null));}; \ No newline at end of file +var _0x6994=['offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','error','stack','name','index','map','ZohoField','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','length','create','update','body','destroy','find','eml-format','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x453095,_0x2217f3){var _0xd5afe7=function(_0x56f1a7){while(--_0x56f1a7){_0x453095['push'](_0x453095['shift']());}};_0xd5afe7(++_0x2217f3);}(_0x6994,0xc1));var _0x4699=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x6994[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0x4699('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4699('0x1'));var moment=require(_0x4699('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x4699('0x3'));var util=require(_0x4699('0x4'));var path=require(_0x4699('0x5'));var sox=require(_0x4699('0x6'));var csv=require(_0x4699('0x7'));var ejs=require(_0x4699('0x8'));var fs=require('fs');var fs_extra=require(_0x4699('0x9'));var _=require(_0x4699('0xa'));var squel=require(_0x4699('0xb'));var crypto=require(_0x4699('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4699('0xd'));var toCsv=require(_0x4699('0x7'));var querystring=require(_0x4699('0xe'));var Papa=require('papaparse');var Redis=require(_0x4699('0xf'));var authService=require(_0x4699('0x10'));var qs=require(_0x4699('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4699('0x12'))(_0x4699('0x13'));var utils=require(_0x4699('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x4699('0x15'));var db=require(_0x4699('0x16'))['db'];function respondWithStatusCode(_0x2638a0,_0x3780c9){_0x3780c9=_0x3780c9||0xcc;return function(_0xe9af76){if(_0xe9af76){return _0x2638a0[_0x4699('0x17')](_0x3780c9);}return _0x2638a0[_0x4699('0x18')](_0x3780c9)[_0x4699('0x19')]();};}function respondWithResult(_0x29c3bd,_0x1e00e0){_0x1e00e0=_0x1e00e0||0xc8;return function(_0x51552f){if(_0x51552f){return _0x29c3bd[_0x4699('0x18')](_0x1e00e0)['json'](_0x51552f);}};}function respondWithFilteredResult(_0x1790e4,_0x272be4){return function(_0x202576){if(_0x202576){var _0x2be47b=typeof _0x272be4[_0x4699('0x1a')]==='undefined'&&typeof _0x272be4[_0x4699('0x1b')]===_0x4699('0x1c');var _0x5d90cf=_0x202576[_0x4699('0x1d')];var _0x58b61f=_0x2be47b?0x0:_0x272be4[_0x4699('0x1a')];var _0x52ffd3=_0x2be47b?_0x202576[_0x4699('0x1d')]:_0x272be4[_0x4699('0x1a')]+_0x272be4['limit'];var _0x5f4857;if(_0x52ffd3>=_0x5d90cf){_0x52ffd3=_0x5d90cf;_0x5f4857=0xc8;}else{_0x5f4857=0xce;}_0x1790e4[_0x4699('0x18')](_0x5f4857);return _0x1790e4[_0x4699('0x1e')](_0x4699('0x1f'),_0x58b61f+'-'+_0x52ffd3+'/'+_0x5d90cf)['json'](_0x202576);}return null;};}function patchUpdates(_0x129c11){return function(_0x3a1dc0){try{jsonpatch[_0x4699('0x20')](_0x3a1dc0,_0x129c11,!![]);}catch(_0x3e23bf){return BPromise[_0x4699('0x21')](_0x3e23bf);}return _0x3a1dc0[_0x4699('0x22')]();};}function saveUpdates(_0x2f311f,_0xcb0c7c){return function(_0x58de7f){if(_0x58de7f){return _0x58de7f['update'](_0x2f311f)[_0x4699('0x23')](function(_0xdd2502){return _0xdd2502;});}return null;};}function removeEntity(_0x15ae98,_0xa8db4){return function(_0x2217ff){if(_0x2217ff){return _0x2217ff['destroy']()[_0x4699('0x23')](function(){_0x15ae98['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2771f8,_0x1aa1e0){return function(_0x53888b){if(!_0x53888b){_0x2771f8[_0x4699('0x17')](0x194);}return _0x53888b;};}function handleError(_0x37ed08,_0x2a81d9){_0x2a81d9=_0x2a81d9||0x1f4;return function(_0x4ec2c0){logger[_0x4699('0x24')](_0x4ec2c0[_0x4699('0x25')]);if(_0x4ec2c0[_0x4699('0x26')]){delete _0x4ec2c0['name'];}_0x37ed08[_0x4699('0x18')](_0x2a81d9)['send'](_0x4ec2c0);};}exports[_0x4699('0x27')]=function(_0x519681,_0x3b1b95){var _0x44f5af={},_0x4499aa={},_0xcee712={'count':0x0,'rows':[]};var _0xf01728=_[_0x4699('0x28')](db[_0x4699('0x29')][_0x4699('0x2a')],function(_0x57a6cc){return{'name':_0x57a6cc['fieldName'],'type':_0x57a6cc[_0x4699('0x2b')][_0x4699('0x2c')]};});_0x4499aa[_0x4699('0x2d')]=_[_0x4699('0x28')](_0xf01728,_0x4699('0x26'));_0x4499aa[_0x4699('0x2e')]=_['keys'](_0x519681['query']);_0x4499aa[_0x4699('0x2f')]=_['intersection'](_0x4499aa[_0x4699('0x2d')],_0x4499aa[_0x4699('0x2e')]);_0x44f5af[_0x4699('0x30')]=_[_0x4699('0x31')](_0x4499aa[_0x4699('0x2d')],qs['fields'](_0x519681[_0x4699('0x2e')][_0x4699('0x32')]));_0x44f5af['attributes']=_0x44f5af[_0x4699('0x30')]['length']?_0x44f5af[_0x4699('0x30')]:_0x4499aa['model'];if(!_0x519681[_0x4699('0x2e')][_0x4699('0x33')](_0x4699('0x34'))){_0x44f5af['limit']=qs[_0x4699('0x1b')](_0x519681[_0x4699('0x2e')]['limit']);_0x44f5af[_0x4699('0x1a')]=qs[_0x4699('0x1a')](_0x519681[_0x4699('0x2e')][_0x4699('0x1a')]);}_0x44f5af['order']=qs['sort'](_0x519681[_0x4699('0x2e')][_0x4699('0x35')]);_0x44f5af[_0x4699('0x36')]=qs[_0x4699('0x2f')](_[_0x4699('0x37')](_0x519681[_0x4699('0x2e')],_0x4499aa[_0x4699('0x2f')]),_0xf01728);if(_0x519681['query'][_0x4699('0x38')]){_0x44f5af[_0x4699('0x36')]=_[_0x4699('0x39')](_0x44f5af[_0x4699('0x36')],{'$or':_[_0x4699('0x28')](_0xf01728,function(_0x244ee3){if(_0x244ee3[_0x4699('0x2b')]!==_0x4699('0x3a')){var _0x58282e={};_0x58282e[_0x244ee3[_0x4699('0x26')]]={'$like':'%'+_0x519681[_0x4699('0x2e')][_0x4699('0x38')]+'%'};return _0x58282e;}})});}_0x44f5af=_[_0x4699('0x39')]({},_0x44f5af,_0x519681[_0x4699('0x3b')]);var _0x337678={'where':_0x44f5af[_0x4699('0x36')]};return db['ZohoField'][_0x4699('0x1d')](_0x337678)[_0x4699('0x23')](function(_0x2e148a){_0xcee712[_0x4699('0x1d')]=_0x2e148a;if(_0x519681[_0x4699('0x2e')][_0x4699('0x3c')]){_0x44f5af[_0x4699('0x3d')]=[{'all':!![]}];}return db[_0x4699('0x29')]['findAll'](_0x44f5af);})[_0x4699('0x23')](function(_0x126490){_0xcee712[_0x4699('0x3e')]=_0x126490;return _0xcee712;})[_0x4699('0x23')](respondWithFilteredResult(_0x3b1b95,_0x44f5af))[_0x4699('0x3f')](handleError(_0x3b1b95,null));};exports[_0x4699('0x40')]=function(_0x470779,_0x1d6899){var _0x1d5401={'raw':!![],'where':{'id':_0x470779[_0x4699('0x41')]['id']}},_0x2a09d1={};_0x2a09d1['model']=_[_0x4699('0x42')](db['ZohoField'][_0x4699('0x2a')]);_0x2a09d1[_0x4699('0x2e')]=_[_0x4699('0x42')](_0x470779[_0x4699('0x2e')]);_0x2a09d1[_0x4699('0x2f')]=_['intersection'](_0x2a09d1[_0x4699('0x2d')],_0x2a09d1[_0x4699('0x2e')]);_0x1d5401[_0x4699('0x30')]=_[_0x4699('0x31')](_0x2a09d1[_0x4699('0x2d')],qs[_0x4699('0x32')](_0x470779[_0x4699('0x2e')]['fields']));_0x1d5401['attributes']=_0x1d5401[_0x4699('0x30')][_0x4699('0x43')]?_0x1d5401['attributes']:_0x2a09d1[_0x4699('0x2d')];if(_0x470779[_0x4699('0x2e')][_0x4699('0x3c')]){_0x1d5401[_0x4699('0x3d')]=[{'all':!![]}];}_0x1d5401=_[_0x4699('0x39')]({},_0x1d5401,_0x470779[_0x4699('0x3b')]);return db[_0x4699('0x29')]['find'](_0x1d5401)[_0x4699('0x23')](handleEntityNotFound(_0x1d6899,null))[_0x4699('0x23')](respondWithResult(_0x1d6899,null))['catch'](handleError(_0x1d6899,null));};exports[_0x4699('0x44')]=function(_0x2d91e9,_0x4140b9){return db[_0x4699('0x29')][_0x4699('0x44')](_0x2d91e9['body'],{})[_0x4699('0x23')](respondWithResult(_0x4140b9,0xc9))[_0x4699('0x3f')](handleError(_0x4140b9,null));};exports[_0x4699('0x45')]=function(_0x277967,_0x3a930f){if(_0x277967['body']['id']){delete _0x277967[_0x4699('0x46')]['id'];}return db['ZohoField']['find']({'where':{'id':_0x277967[_0x4699('0x41')]['id']}})[_0x4699('0x23')](handleEntityNotFound(_0x3a930f,null))['then'](saveUpdates(_0x277967['body'],null))[_0x4699('0x23')](respondWithResult(_0x3a930f,null))[_0x4699('0x3f')](handleError(_0x3a930f,null));};exports[_0x4699('0x47')]=function(_0x306ff3,_0x530560){return db[_0x4699('0x29')][_0x4699('0x48')]({'where':{'id':_0x306ff3[_0x4699('0x41')]['id']}})[_0x4699('0x23')](handleEntityNotFound(_0x530560,null))[_0x4699('0x23')](removeEntity(_0x530560,null))[_0x4699('0x3f')](handleError(_0x530560,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 12151cc..43339c5 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 _0x0295=['rimraf','../../config/environment','./intZohoField.attributes','exports','define','idField','lodash','api','request-promise','path'];(function(_0xda4829,_0x4df74c){var _0xf4bc0=function(_0x380b41){while(--_0x380b41){_0xda4829['push'](_0xda4829['shift']());}};_0xf4bc0(++_0x4df74c);}(_0x0295,0x1f0));var _0x5029=function(_0x1cc060,_0x1afbdc){_0x1cc060=_0x1cc060-0x0;var _0x5c7e10=_0x0295[_0x1cc060];return _0x5c7e10;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5029('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5029('0x2'));var fs=require('fs');var path=require(_0x5029('0x3'));var rimraf=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var attributes=require(_0x5029('0x6'));module[_0x5029('0x7')]=function(_0x200217,_0x215955){return _0x200217[_0x5029('0x8')]('ZohoField',attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x5029('0x9'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1893=['rimraf','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','FieldId','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4887ef,_0xf947c1){var _0x44dd61=function(_0x22e6e9){while(--_0x22e6e9){_0x4887ef['push'](_0x4887ef['shift']());}};_0x44dd61(++_0xf947c1);}(_0x1893,0xa2));var _0x3189=function(_0x1655bb,_0x5a82ae){_0x1655bb=_0x1655bb-0x0;var _0x5e2020=_0x1893[_0x1655bb];return _0x5e2020;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3189('0x0'))(_0x3189('0x1'));var moment=require(_0x3189('0x2'));var BPromise=require(_0x3189('0x3'));var rp=require(_0x3189('0x4'));var fs=require('fs');var path=require(_0x3189('0x5'));var rimraf=require(_0x3189('0x6'));var config=require('../../config/environment');var attributes=require(_0x3189('0x7'));module[_0x3189('0x8')]=function(_0x2333e6,_0x4080a9){return _0x2333e6[_0x3189('0x9')](_0x3189('0xa'),attributes,{'tableName':_0x3189('0xb'),'paranoid':![],'indexes':[{'name':_0x3189('0xc'),'fields':['idField',_0x3189('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 99c9be9..7902307 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 _0xfcab=['moment','bluebird','randomstring','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util'];(function(_0x297c55,_0x34fa75){var _0x120389=function(_0x595108){while(--_0x595108){_0x297c55['push'](_0x297c55['shift']());}};_0x120389(++_0x34fa75);}(_0xfcab,0x1e1));var _0xbfca=function(_0x2b55b5,_0x78505e){_0x2b55b5=_0x2b55b5-0x0;var _0x103d28=_0xfcab[_0x2b55b5];return _0x103d28;};'use strict';var _=require(_0xbfca('0x0'));var util=require(_0xbfca('0x1'));var moment=require(_0xbfca('0x2'));var BPromise=require(_0xbfca('0x3'));var rs=require(_0xbfca('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbfca('0x5'))(_0xbfca('0x6'));var config=require('../../config/environment');var jayson=require(_0xbfca('0x7'));var client=jayson[_0xbfca('0x8')][_0xbfca('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19a353,_0x1684cf,_0x39c9d4){return new BPromise(function(_0x1f110c,_0x1c3ad5){return client[_0xbfca('0xa')](_0x19a353,_0x39c9d4)[_0xbfca('0xb')](function(_0x576565){logger[_0xbfca('0xc')](_0xbfca('0xd'),_0x1684cf,_0xbfca('0xe'));logger[_0xbfca('0xf')](_0xbfca('0x10'),_0x1684cf,_0xbfca('0xe'),JSON[_0xbfca('0x11')](_0x576565));if(_0x576565['error']){if(_0x576565['error'][_0xbfca('0x12')]===0x1f4){logger[_0xbfca('0x13')](_0xbfca('0xd'),_0x1684cf,_0x576565[_0xbfca('0x13')][_0xbfca('0x14')]);return _0x1c3ad5(_0x576565[_0xbfca('0x13')]['message']);}logger[_0xbfca('0x13')]('ZohoField,\x20%s,\x20%s',_0x1684cf,_0x576565[_0xbfca('0x13')][_0xbfca('0x14')]);return _0x1f110c(_0x576565[_0xbfca('0x13')][_0xbfca('0x14')]);}else{logger['info'](_0xbfca('0xd'),_0x1684cf,'request\x20sent');_0x1f110c(_0x576565[_0xbfca('0x15')]['message']);}})[_0xbfca('0x16')](function(_0x5f3e94){logger['error']('ZohoField,\x20%s,\x20%s',_0x1684cf,_0x5f3e94);_0x1c3ad5(_0x5f3e94);});});} \ No newline at end of file +var _0xf1e7=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x23508f,_0x335e21){var _0x50c4a5=function(_0x394918){while(--_0x394918){_0x23508f['push'](_0x23508f['shift']());}};_0x50c4a5(++_0x335e21);}(_0xf1e7,0x1be));var _0x7f1e=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xf1e7[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x7f1e('0x0'));var util=require(_0x7f1e('0x1'));var moment=require(_0x7f1e('0x2'));var BPromise=require(_0x7f1e('0x3'));var rs=require(_0x7f1e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7f1e('0x5'))['db'];var utils=require(_0x7f1e('0x6'));var logger=require(_0x7f1e('0x7'))(_0x7f1e('0x8'));var config=require(_0x7f1e('0x9'));var jayson=require(_0x7f1e('0xa'));var client=jayson['client'][_0x7f1e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x138a37,_0x2e4f27,_0x179f52){return new BPromise(function(_0x352a84,_0xf989f8){return client[_0x7f1e('0xc')](_0x138a37,_0x179f52)[_0x7f1e('0xd')](function(_0x3801ca){logger[_0x7f1e('0xe')](_0x7f1e('0xf'),_0x2e4f27,_0x7f1e('0x10'));logger[_0x7f1e('0x11')](_0x7f1e('0x12'),_0x2e4f27,'request\x20sent',JSON[_0x7f1e('0x13')](_0x3801ca));if(_0x3801ca[_0x7f1e('0x14')]){if(_0x3801ca[_0x7f1e('0x14')][_0x7f1e('0x15')]===0x1f4){logger[_0x7f1e('0x14')](_0x7f1e('0xf'),_0x2e4f27,_0x3801ca[_0x7f1e('0x14')][_0x7f1e('0x16')]);return _0xf989f8(_0x3801ca[_0x7f1e('0x14')]['message']);}logger['error'](_0x7f1e('0xf'),_0x2e4f27,_0x3801ca[_0x7f1e('0x14')][_0x7f1e('0x16')]);return _0x352a84(_0x3801ca['error'][_0x7f1e('0x16')]);}else{logger[_0x7f1e('0xe')]('ZohoField,\x20%s,\x20%s',_0x2e4f27,_0x7f1e('0x10'));_0x352a84(_0x3801ca[_0x7f1e('0x17')][_0x7f1e('0x16')]);}})[_0x7f1e('0x18')](function(_0x83543e){logger[_0x7f1e('0x14')]('ZohoField,\x20%s,\x20%s',_0x2e4f27,_0x83543e);_0xf989f8(_0x83543e);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 3fc04fc..842bbea 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x46f0c8,_0x5e052e){var _0x4851e4=function(_0x5238c4){while(--_0x5238c4){_0x46f0c8['push'](_0x46f0c8['shift']());}};_0x4851e4(++_0x5e052e);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x58da1e,_0x481cf5){var _0x19d84b=function(_0x596051){while(--_0x596051){_0x58da1e['push'](_0x58da1e['shift']());}};_0x19d84b(++_0x481cf5);}(_0x70e0,0x17b));var _0x070e=function(_0x477231,_0x268e55){_0x477231=_0x477231-0x0;var _0x559ae8=_0x70e0[_0x477231];return _0x559ae8;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 4f19559..dc9917c 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 _0xc97e=['STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN','state','sequelize'];(function(_0x38690b,_0x158905){var _0x1478e7=function(_0x58884d){while(--_0x58884d){_0x38690b['push'](_0x38690b['shift']());}};_0x1478e7(++_0x158905);}(_0xc97e,0x148));var _0xec97=function(_0xdec2d9,_0x260863){_0xdec2d9=_0xdec2d9-0x0;var _0x237f82=_0xc97e[_0xdec2d9];return _0x237f82;};'use strict';var Sequelize=require(_0xec97('0x0'));module['exports']={'name':{'type':Sequelize[_0xec97('0x1')],'allowNull':![],'unique':_0xec97('0x2')},'version':{'type':Sequelize[_0xec97('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0xec97('0x1')],'defaultValue':_0xec97('0x3')},'filename':{'type':Sequelize[_0xec97('0x1')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xec97('0x1')]},'size':{'type':Sequelize[_0xec97('0x4')]},'active':{'type':Sequelize[_0xec97('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0xec97('0x1')]},'logo':{'type':Sequelize[_0xec97('0x1')]},'state':{'type':Sequelize['STRING'],'unique':_0xec97('0x6')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0xec97('0x1')]},'remoteUri':{'type':Sequelize[_0xec97('0x1')]},'link':{'type':Sequelize[_0xec97('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0x2a77=['unique_name_and_version','STRING','app.js','INTEGER','BOOLEAN','state','sequelize','exports'];(function(_0x526ef0,_0x21d3d3){var _0x423b00=function(_0x4fd95c){while(--_0x4fd95c){_0x526ef0['push'](_0x526ef0['shift']());}};_0x423b00(++_0x21d3d3);}(_0x2a77,0x1c6));var _0x72a7=function(_0x137815,_0x78dd4b){_0x137815=_0x137815-0x0;var _0x29ded1=_0x2a77[_0x137815];return _0x29ded1;};'use strict';var Sequelize=require(_0x72a7('0x0'));module[_0x72a7('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x72a7('0x2')},'version':{'type':Sequelize[_0x72a7('0x3')],'allowNull':![],'unique':_0x72a7('0x2')},'main':{'type':Sequelize[_0x72a7('0x3')],'defaultValue':_0x72a7('0x4')},'filename':{'type':Sequelize[_0x72a7('0x3')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x72a7('0x3')]},'size':{'type':Sequelize[_0x72a7('0x5')]},'active':{'type':Sequelize[_0x72a7('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0x72a7('0x3')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x72a7('0x3')],'unique':_0x72a7('0x7')},'description':{'type':Sequelize[_0x72a7('0x3')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x72a7('0x3')]},'link':{'type':Sequelize[_0x72a7('0x3')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index a79bb41..4bad02b 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 _0x5f2f=['end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','stack','name','send','index','Integration','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','findAll','rows','catch','keys','find','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x5f2f,0x73));var _0xf5f2=function(_0xdbfe11,_0x5cfa1e){_0xdbfe11=_0xdbfe11-0x0;var _0x28438d=_0x5f2f[_0xdbfe11];return _0x28438d;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=typeof _0x286197[_0xf5f2('0x1b')]===_0xf5f2('0x1c')&&typeof _0x286197[_0xf5f2('0x1d')]===_0xf5f2('0x1c');var _0x11f702=_0x17d656[_0xf5f2('0x1e')];var _0x20fccd=_0x1b6dd2?0x0:_0x286197[_0xf5f2('0x1b')];var _0x4ff59b=_0x1b6dd2?_0x17d656[_0xf5f2('0x1e')]:_0x286197[_0xf5f2('0x1b')]+_0x286197[_0xf5f2('0x1d')];var _0x1bf655;if(_0x4ff59b>=_0x11f702){_0x4ff59b=_0x11f702;_0x1bf655=0xc8;}else{_0x1bf655=0xce;}_0xafe430['status'](_0x1bf655);return _0xafe430[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x20fccd+'-'+_0x4ff59b+'/'+_0x11f702)['json'](_0x17d656);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x21')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x22')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x23')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x24')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){_0x4e8bda[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x19')]();});}};}function handleEntityNotFound(_0x13da6f,_0x1a5bb3){return function(_0xf6c58d){if(!_0xf6c58d){_0x13da6f[_0xf5f2('0x18')](0x194);}return _0xf6c58d;};}function handleError(_0x13a3be,_0x281ec8){_0x281ec8=_0x281ec8||0x1f4;return function(_0x294414){logger['error'](_0x294414[_0xf5f2('0x25')]);if(_0x294414[_0xf5f2('0x26')]){delete _0x294414[_0xf5f2('0x26')];}_0x13a3be[_0xf5f2('0x1a')](_0x281ec8)[_0xf5f2('0x27')](_0x294414);};}exports[_0xf5f2('0x28')]=function(_0x5b6672,_0x53cb96){var _0x22c826={},_0x14c829={},_0x11c771={'count':0x0,'rows':[]};var _0x5027ab=_['map'](db[_0xf5f2('0x29')][_0xf5f2('0x2a')],function(_0x17394a){return{'name':_0x17394a[_0xf5f2('0x2b')],'type':_0x17394a[_0xf5f2('0x2c')]['key']};});_0x14c829['model']=_[_0xf5f2('0x2d')](_0x5027ab,'name');_0x14c829[_0xf5f2('0x2e')]=_['keys'](_0x5b6672[_0xf5f2('0x2e')]);_0x14c829[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],_0x14c829[_0xf5f2('0x2e')]);_0x22c826[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],qs['fields'](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x22c826[_0xf5f2('0x32')]=_0x22c826[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x22c826[_0xf5f2('0x32')]:_0x14c829[_0xf5f2('0x31')];if(!_0x5b6672['query'][_0xf5f2('0x35')](_0xf5f2('0x36'))){_0x22c826['limit']=qs[_0xf5f2('0x1d')](_0x5b6672['query'][_0xf5f2('0x1d')]);_0x22c826[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x5b6672[_0xf5f2('0x2e')]['offset']);}_0x22c826['order']=qs[_0xf5f2('0x37')](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x37')]);_0x22c826['where']=qs[_0xf5f2('0x2f')](_['pick'](_0x5b6672[_0xf5f2('0x2e')],_0x14c829['filters']),_0x5027ab);if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]){_0x22c826['where']=_[_0xf5f2('0x39')](_0x22c826[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2d')](_0x5027ab,function(_0x35f738){if(_0x35f738['type']!=='VIRTUAL'){var _0x3d328f={};_0x3d328f[_0x35f738[_0xf5f2('0x26')]]={'$like':'%'+_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]+'%'};return _0x3d328f;}})});}_0x22c826=_[_0xf5f2('0x39')]({},_0x22c826,_0x5b6672[_0xf5f2('0x3b')]);var _0x2bc20e={'where':_0x22c826['where']};return db[_0xf5f2('0x29')][_0xf5f2('0x1e')](_0x2bc20e)['then'](function(_0xc6a1ae){_0x11c771[_0xf5f2('0x1e')]=_0xc6a1ae;if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x22c826[_0xf5f2('0x3d')]=[{'all':!![]}];}return db[_0xf5f2('0x29')][_0xf5f2('0x3e')](_0x22c826);})[_0xf5f2('0x24')](function(_0x574f24){_0x11c771[_0xf5f2('0x3f')]=_0x574f24;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x40')](handleError(_0x53cb96,null));};exports['show']=function(_0x509dbc,_0x59eb00){var _0x76d21b={'raw':![],'where':{'id':_0x509dbc['params']['id']}},_0x2ad13c={};_0x2ad13c[_0xf5f2('0x31')]=_[_0xf5f2('0x41')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x2ad13c[_0xf5f2('0x2e')]=_[_0xf5f2('0x41')](_0x509dbc[_0xf5f2('0x2e')]);_0x2ad13c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],_0x2ad13c[_0xf5f2('0x2e')]);_0x76d21b[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],qs['fields'](_0x509dbc[_0xf5f2('0x2e')]['fields']));_0x76d21b[_0xf5f2('0x32')]=_0x76d21b[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x76d21b[_0xf5f2('0x32')]:_0x2ad13c[_0xf5f2('0x31')];if(_0x509dbc[_0xf5f2('0x2e')]['includeAll']){_0x76d21b[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x76d21b=_[_0xf5f2('0x39')]({},_0x76d21b,_0x509dbc[_0xf5f2('0x3b')]);return db[_0xf5f2('0x29')][_0xf5f2('0x42')](_0x76d21b)[_0xf5f2('0x24')](handleEntityNotFound(_0x59eb00,null))[_0xf5f2('0x24')](respondWithResult(_0x59eb00,null))[_0xf5f2('0x40')](handleError(_0x59eb00,null));};exports['create']=function(_0x35dece,_0x33ec29){return db[_0xf5f2('0x29')]['create'](_0x35dece[_0xf5f2('0x43')],{})[_0xf5f2('0x24')](respondWithResult(_0x33ec29,0xc9))[_0xf5f2('0x40')](handleError(_0x33ec29,null));};exports['update']=function(_0x57a7cb,_0x7bb942){if(_0x57a7cb[_0xf5f2('0x43')]['id']){delete _0x57a7cb['body']['id'];}return db[_0xf5f2('0x29')]['find']({'where':{'id':_0x57a7cb[_0xf5f2('0x44')]['id']}})['then'](handleEntityNotFound(_0x7bb942,null))[_0xf5f2('0x24')](saveUpdates(_0x57a7cb['body'],null))[_0xf5f2('0x24')](respondWithResult(_0x7bb942,null))[_0xf5f2('0x40')](handleError(_0x7bb942,null));};exports[_0xf5f2('0x45')]=function(_0x11a083,_0x4fa738){return db[_0xf5f2('0x29')][_0xf5f2('0x42')]({'where':{'id':_0x11a083['params']['id']}})['then'](handleEntityNotFound(_0x4fa738,null))[_0xf5f2('0x24')](removeEntity(_0x4fa738,null))[_0xf5f2('0x40')](handleError(_0x4fa738,null));}; \ No newline at end of file +var _0x7880=['set','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','Integration','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','keys','options','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit'];(function(_0x15af56,_0x21e7c5){var _0x29862e=function(_0xd9d3e8){while(--_0xd9d3e8){_0x15af56['push'](_0x15af56['shift']());}};_0x29862e(++_0x21e7c5);}(_0x7880,0x1f4));var _0x0788=function(_0x14a513,_0x3239f){_0x14a513=_0x14a513-0x0;var _0x47236c=_0x7880[_0x14a513];return _0x47236c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0788('0x0'));var zipdir=require(_0x0788('0x1'));var jsonpatch=require(_0x0788('0x2'));var rp=require(_0x0788('0x3'));var moment=require(_0x0788('0x4'));var BPromise=require(_0x0788('0x5'));var Mustache=require('mustache');var util=require(_0x0788('0x6'));var path=require(_0x0788('0x7'));var sox=require(_0x0788('0x8'));var csv=require(_0x0788('0x9'));var ejs=require(_0x0788('0xa'));var fs=require('fs');var fs_extra=require(_0x0788('0xb'));var _=require(_0x0788('0xc'));var squel=require(_0x0788('0xd'));var crypto=require(_0x0788('0xe'));var jsforce=require(_0x0788('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0788('0x9'));var querystring=require('querystring');var Papa=require(_0x0788('0x10'));var Redis=require('ioredis');var authService=require(_0x0788('0x11'));var qs=require(_0x0788('0x12'));var as=require(_0x0788('0x13'));var hardwareService=require(_0x0788('0x14'));var logger=require(_0x0788('0x15'))('api');var utils=require(_0x0788('0x16'));var config=require(_0x0788('0x17'));var licenseUtil=require(_0x0788('0x18'));var db=require(_0x0788('0x19'))['db'];function respondWithStatusCode(_0x311729,_0xce4342){_0xce4342=_0xce4342||0xcc;return function(_0x261ebc){if(_0x261ebc){return _0x311729['sendStatus'](_0xce4342);}return _0x311729[_0x0788('0x1a')](_0xce4342)[_0x0788('0x1b')]();};}function respondWithResult(_0x3bdcdf,_0x13cf07){_0x13cf07=_0x13cf07||0xc8;return function(_0x51e5d3){if(_0x51e5d3){return _0x3bdcdf[_0x0788('0x1a')](_0x13cf07)['json'](_0x51e5d3);}};}function respondWithFilteredResult(_0x195f14,_0x170d56){return function(_0x3fd1e4){if(_0x3fd1e4){var _0xb406fb=typeof _0x170d56[_0x0788('0x1c')]===_0x0788('0x1d')&&typeof _0x170d56['limit']==='undefined';var _0x17d805=_0x3fd1e4[_0x0788('0x1e')];var _0x5b2bdc=_0xb406fb?0x0:_0x170d56[_0x0788('0x1c')];var _0x415f19=_0xb406fb?_0x3fd1e4[_0x0788('0x1e')]:_0x170d56['offset']+_0x170d56[_0x0788('0x1f')];var _0x3fb723;if(_0x415f19>=_0x17d805){_0x415f19=_0x17d805;_0x3fb723=0xc8;}else{_0x3fb723=0xce;}_0x195f14['status'](_0x3fb723);return _0x195f14[_0x0788('0x20')]('Content-Range',_0x5b2bdc+'-'+_0x415f19+'/'+_0x17d805)[_0x0788('0x21')](_0x3fd1e4);}return null;};}function patchUpdates(_0x48bc5f){return function(_0x17cca3){try{jsonpatch[_0x0788('0x22')](_0x17cca3,_0x48bc5f,!![]);}catch(_0x18ff22){return BPromise[_0x0788('0x23')](_0x18ff22);}return _0x17cca3[_0x0788('0x24')]();};}function saveUpdates(_0x4f0005,_0x48ec43){return function(_0x2270d4){if(_0x2270d4){return _0x2270d4[_0x0788('0x25')](_0x4f0005)[_0x0788('0x26')](function(_0x7a99a1){return _0x7a99a1;});}return null;};}function removeEntity(_0x5ba1da,_0x4d5c93){return function(_0x79204e){if(_0x79204e){return _0x79204e[_0x0788('0x27')]()[_0x0788('0x26')](function(){_0x5ba1da['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x240459,_0xa1f7dc){return function(_0x5f2dda){if(!_0x5f2dda){_0x240459['sendStatus'](0x194);}return _0x5f2dda;};}function handleError(_0x5a54a5,_0x44798c){_0x44798c=_0x44798c||0x1f4;return function(_0x57fda1){logger[_0x0788('0x28')](_0x57fda1[_0x0788('0x29')]);if(_0x57fda1[_0x0788('0x2a')]){delete _0x57fda1[_0x0788('0x2a')];}_0x5a54a5[_0x0788('0x1a')](_0x44798c)[_0x0788('0x2b')](_0x57fda1);};}exports[_0x0788('0x2c')]=function(_0x3ffe4f,_0x5b7594){var _0x5a5178={},_0x3c5246={},_0x40d345={'count':0x0,'rows':[]};var _0x54979a=_['map'](db[_0x0788('0x2d')][_0x0788('0x2e')],function(_0x20fcd8){return{'name':_0x20fcd8[_0x0788('0x2f')],'type':_0x20fcd8[_0x0788('0x30')][_0x0788('0x31')]};});_0x3c5246[_0x0788('0x32')]=_[_0x0788('0x33')](_0x54979a,_0x0788('0x2a'));_0x3c5246[_0x0788('0x34')]=_['keys'](_0x3ffe4f[_0x0788('0x34')]);_0x3c5246[_0x0788('0x35')]=_[_0x0788('0x36')](_0x3c5246[_0x0788('0x32')],_0x3c5246[_0x0788('0x34')]);_0x5a5178[_0x0788('0x37')]=_[_0x0788('0x36')](_0x3c5246[_0x0788('0x32')],qs[_0x0788('0x38')](_0x3ffe4f[_0x0788('0x34')]['fields']));_0x5a5178['attributes']=_0x5a5178['attributes']['length']?_0x5a5178['attributes']:_0x3c5246['model'];if(!_0x3ffe4f[_0x0788('0x34')][_0x0788('0x39')](_0x0788('0x3a'))){_0x5a5178['limit']=qs[_0x0788('0x1f')](_0x3ffe4f[_0x0788('0x34')][_0x0788('0x1f')]);_0x5a5178[_0x0788('0x1c')]=qs['offset'](_0x3ffe4f[_0x0788('0x34')]['offset']);}_0x5a5178[_0x0788('0x3b')]=qs['sort'](_0x3ffe4f[_0x0788('0x34')][_0x0788('0x3c')]);_0x5a5178['where']=qs[_0x0788('0x35')](_[_0x0788('0x3d')](_0x3ffe4f['query'],_0x3c5246[_0x0788('0x35')]),_0x54979a);if(_0x3ffe4f['query'][_0x0788('0x3e')]){_0x5a5178['where']=_[_0x0788('0x3f')](_0x5a5178['where'],{'$or':_[_0x0788('0x33')](_0x54979a,function(_0x57fec9){if(_0x57fec9['type']!==_0x0788('0x40')){var _0x68d9d4={};_0x68d9d4[_0x57fec9[_0x0788('0x2a')]]={'$like':'%'+_0x3ffe4f[_0x0788('0x34')][_0x0788('0x3e')]+'%'};return _0x68d9d4;}})});}_0x5a5178=_['merge']({},_0x5a5178,_0x3ffe4f['options']);var _0x530d83={'where':_0x5a5178['where']};return db[_0x0788('0x2d')][_0x0788('0x1e')](_0x530d83)[_0x0788('0x26')](function(_0x358a22){_0x40d345[_0x0788('0x1e')]=_0x358a22;if(_0x3ffe4f['query']['includeAll']){_0x5a5178[_0x0788('0x41')]=[{'all':!![]}];}return db[_0x0788('0x2d')][_0x0788('0x42')](_0x5a5178);})[_0x0788('0x26')](function(_0x236b63){_0x40d345[_0x0788('0x43')]=_0x236b63;return _0x40d345;})[_0x0788('0x26')](respondWithFilteredResult(_0x5b7594,_0x5a5178))[_0x0788('0x44')](handleError(_0x5b7594,null));};exports[_0x0788('0x45')]=function(_0x50e8f5,_0x5581e6){var _0x441aec={'raw':![],'where':{'id':_0x50e8f5[_0x0788('0x46')]['id']}},_0x1d579d={};_0x1d579d['model']=_['keys'](db['Integration'][_0x0788('0x2e')]);_0x1d579d[_0x0788('0x34')]=_[_0x0788('0x47')](_0x50e8f5[_0x0788('0x34')]);_0x1d579d[_0x0788('0x35')]=_[_0x0788('0x36')](_0x1d579d[_0x0788('0x32')],_0x1d579d[_0x0788('0x34')]);_0x441aec['attributes']=_[_0x0788('0x36')](_0x1d579d[_0x0788('0x32')],qs[_0x0788('0x38')](_0x50e8f5[_0x0788('0x34')]['fields']));_0x441aec[_0x0788('0x37')]=_0x441aec[_0x0788('0x37')]['length']?_0x441aec['attributes']:_0x1d579d['model'];if(_0x50e8f5[_0x0788('0x34')]['includeAll']){_0x441aec[_0x0788('0x41')]=[{'all':!![]}];}_0x441aec=_[_0x0788('0x3f')]({},_0x441aec,_0x50e8f5[_0x0788('0x48')]);return db[_0x0788('0x2d')][_0x0788('0x49')](_0x441aec)[_0x0788('0x26')](handleEntityNotFound(_0x5581e6,null))[_0x0788('0x26')](respondWithResult(_0x5581e6,null))[_0x0788('0x44')](handleError(_0x5581e6,null));};exports['create']=function(_0x4c6366,_0x39c3cc){return db[_0x0788('0x2d')][_0x0788('0x4a')](_0x4c6366['body'],{})[_0x0788('0x26')](respondWithResult(_0x39c3cc,0xc9))[_0x0788('0x44')](handleError(_0x39c3cc,null));};exports[_0x0788('0x25')]=function(_0x4563cd,_0x2395ad){if(_0x4563cd['body']['id']){delete _0x4563cd['body']['id'];}return db[_0x0788('0x2d')][_0x0788('0x49')]({'where':{'id':_0x4563cd['params']['id']}})[_0x0788('0x26')](handleEntityNotFound(_0x2395ad,null))['then'](saveUpdates(_0x4563cd[_0x0788('0x4b')],null))[_0x0788('0x26')](respondWithResult(_0x2395ad,null))[_0x0788('0x44')](handleError(_0x2395ad,null));};exports[_0x0788('0x27')]=function(_0x3c757a,_0x379928){return db[_0x0788('0x2d')][_0x0788('0x49')]({'where':{'id':_0x3c757a['params']['id']}})[_0x0788('0x26')](handleEntityNotFound(_0x379928,null))[_0x0788('0x26')](removeEntity(_0x379928,null))[_0x0788('0x44')](handleError(_0x379928,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index bd779e5..8b83bb8 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 _0xce0f=['../../config/environment','./integration.attributes','define','Integration','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xce0f,0x164));var _0xfce0=function(_0x18217e,_0x42a1cf){_0x18217e=_0x18217e-0x0;var _0x10c3b7=_0xce0f[_0x18217e];return _0x10c3b7;};'use strict';var _=require('lodash');var util=require(_0xfce0('0x0'));var logger=require(_0xfce0('0x1'))(_0xfce0('0x2'));var moment=require(_0xfce0('0x3'));var BPromise=require(_0xfce0('0x4'));var rp=require(_0xfce0('0x5'));var fs=require('fs');var path=require(_0xfce0('0x6'));var rimraf=require('rimraf');var config=require(_0xfce0('0x7'));var attributes=require(_0xfce0('0x8'));module['exports']=function(_0x1200b5,_0x1b83d5){return _0x1200b5[_0xfce0('0x9')](_0xfce0('0xa'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e66=['bluebird','path','rimraf','../../config/environment','./integration.attributes','exports','define','Integration','integrations','util','../../config/logger','moment'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x7e66,0xe1));var _0x67e6=function(_0x33dda9,_0xa14115){_0x33dda9=_0x33dda9-0x0;var _0x3757d7=_0x7e66[_0x33dda9];return _0x3757d7;};'use strict';var _=require('lodash');var util=require(_0x67e6('0x0'));var logger=require(_0x67e6('0x1'))('api');var moment=require(_0x67e6('0x2'));var BPromise=require(_0x67e6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x67e6('0x4'));var rimraf=require(_0x67e6('0x5'));var config=require(_0x67e6('0x6'));var attributes=require(_0x67e6('0x7'));module[_0x67e6('0x8')]=function(_0x380b3f,_0x3596f7){return _0x380b3f[_0x67e6('0x9')](_0x67e6('0xa'),attributes,{'tableName':_0x67e6('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 2674146..609544c 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 _0x14a0=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','Integration,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x5ebc2a,_0x188637){var _0x256a03=function(_0x223b50){while(--_0x223b50){_0x5ebc2a['push'](_0x5ebc2a['shift']());}};_0x256a03(++_0x188637);}(_0x14a0,0x8e));var _0x014a=function(_0x5d12c7,_0xcb2d99){_0x5d12c7=_0x5d12c7-0x0;var _0x1d16a8=_0x14a0[_0x5d12c7];return _0x1d16a8;};'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']('Integration,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('Integration,\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')]('Integration,\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 +var _0x9f0e=['../../config/environment','jayson/promise','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x38fad2,_0x21815e){var _0x4aed88=function(_0x47c5cf){while(--_0x47c5cf){_0x38fad2['push'](_0x38fad2['shift']());}};_0x4aed88(++_0x21815e);}(_0x9f0e,0x116));var _0xe9f0=function(_0x3b997b,_0xd53e14){_0x3b997b=_0x3b997b-0x0;var _0x378b40=_0x9f0e[_0x3b997b];return _0x378b40;};'use strict';var _=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var moment=require(_0xe9f0('0x2'));var BPromise=require(_0xe9f0('0x3'));var rs=require(_0xe9f0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe9f0('0x5'));var logger=require(_0xe9f0('0x6'))(_0xe9f0('0x7'));var config=require(_0xe9f0('0x8'));var jayson=require(_0xe9f0('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3a17b3,_0x167198,_0xe64a79){return new BPromise(function(_0x4be6a6,_0xf4a256){return client[_0xe9f0('0xa')](_0x3a17b3,_0xe64a79)[_0xe9f0('0xb')](function(_0x3386a8){logger[_0xe9f0('0xc')](_0xe9f0('0xd'),_0x167198,_0xe9f0('0xe'));logger[_0xe9f0('0xf')](_0xe9f0('0x10'),_0x167198,'request\x20sent',JSON[_0xe9f0('0x11')](_0x3386a8));if(_0x3386a8[_0xe9f0('0x12')]){if(_0x3386a8[_0xe9f0('0x12')]['code']===0x1f4){logger[_0xe9f0('0x12')]('Integration,\x20%s,\x20%s',_0x167198,_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);return _0xf4a256(_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);}logger['error'](_0xe9f0('0xd'),_0x167198,_0x3386a8['error'][_0xe9f0('0x13')]);return _0x4be6a6(_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);}else{logger['info'](_0xe9f0('0xd'),_0x167198,_0xe9f0('0xe'));_0x4be6a6(_0x3386a8[_0xe9f0('0x14')]['message']);}})[_0xe9f0('0x15')](function(_0x1e16e0){logger[_0xe9f0('0x12')](_0xe9f0('0xd'),_0x167198,_0x1e16e0);_0xf4a256(_0x1e16e0);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 34a4ae3..c7ce644 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 _0xd943=['show','post','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','describe'];(function(_0x1f7996,_0x299a14){var _0x584609=function(_0x14c34a){while(--_0x14c34a){_0x1f7996['push'](_0x1f7996['shift']());}};_0x584609(++_0x299a14);}(_0xd943,0x15d));var _0x3d94=function(_0x19477b,_0x319691){_0x19477b=_0x19477b-0x0;var _0x384ca0=_0xd943[_0x19477b];return _0x384ca0;};'use strict';var multer=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var path=require(_0x3d94('0x2'));var timeout=require(_0x3d94('0x3'));var express=require('express');var router=express[_0x3d94('0x4')]();var fs_extra=require(_0x3d94('0x5'));var auth=require(_0x3d94('0x6'));var interaction=require(_0x3d94('0x7'));var config=require(_0x3d94('0x8'));var controller=require('./integrationReport.controller');router['get']('/',auth[_0x3d94('0x9')](),controller['index']);router['get']('/describe',auth[_0x3d94('0x9')](),controller[_0x3d94('0xa')]);router['get']('/:id',auth[_0x3d94('0x9')](),controller[_0x3d94('0xb')]);router[_0x3d94('0xc')]('/',auth['isAuthenticated'](),controller[_0x3d94('0xd')]);router['put'](_0x3d94('0xe'),auth[_0x3d94('0x9')](),controller['update']);router[_0x3d94('0xf')](_0x3d94('0xe'),auth[_0x3d94('0x9')](),controller[_0x3d94('0x10')]);module[_0x3d94('0x11')]=router; \ No newline at end of file +var _0x1967=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0x1967,0x173));var _0x7196=function(_0x1c9c1e,_0x43c05a){_0x1c9c1e=_0x1c9c1e-0x0;var _0x4ca070=_0x1967[_0x1c9c1e];return _0x4ca070;};'use strict';var multer=require('multer');var util=require(_0x7196('0x0'));var path=require(_0x7196('0x1'));var timeout=require(_0x7196('0x2'));var express=require(_0x7196('0x3'));var router=express[_0x7196('0x4')]();var fs_extra=require(_0x7196('0x5'));var auth=require(_0x7196('0x6'));var interaction=require(_0x7196('0x7'));var config=require(_0x7196('0x8'));var controller=require(_0x7196('0x9'));router['get']('/',auth[_0x7196('0xa')](),controller[_0x7196('0xb')]);router[_0x7196('0xc')](_0x7196('0xd'),auth[_0x7196('0xa')](),controller[_0x7196('0xe')]);router['get'](_0x7196('0xf'),auth[_0x7196('0xa')](),controller[_0x7196('0x10')]);router[_0x7196('0x11')]('/',auth[_0x7196('0xa')](),controller['create']);router['put'](_0x7196('0xf'),auth[_0x7196('0xa')](),controller[_0x7196('0x12')]);router[_0x7196('0x13')](_0x7196('0xf'),auth[_0x7196('0xa')](),controller[_0x7196('0x14')]);module[_0x7196('0x15')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index c1d7c4e..8e8036e 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 _0x5b6e=['STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','FAILED','sequelize','exports'];(function(_0x1897f3,_0x444b8e){var _0x48055c=function(_0x59a60b){while(--_0x59a60b){_0x1897f3['push'](_0x1897f3['shift']());}};_0x48055c(++_0x444b8e);}(_0x5b6e,0x82));var _0xe5b6=function(_0x3ebffe,_0x144cbb){_0x3ebffe=_0x3ebffe-0x0;var _0x2ce964=_0x5b6e[_0x3ebffe];return _0x2ce964;};'use strict';var Sequelize=require(_0xe5b6('0x0'));module[_0xe5b6('0x1')]={'integration':{'type':Sequelize[_0xe5b6('0x2')]},'eventChannel':{'type':Sequelize[_0xe5b6('0x2')]},'exitStatus':{'type':Sequelize[_0xe5b6('0x2')]},'ticketId':{'type':Sequelize[_0xe5b6('0x2')]},'integrationId':{'type':Sequelize[_0xe5b6('0x3')]},'contacts':{'type':Sequelize[_0xe5b6('0x2')]},'uniqueid':{'type':Sequelize[_0xe5b6('0x2')]},'calleridnum':{'type':Sequelize[_0xe5b6('0x2')]},'calleridname':{'type':Sequelize[_0xe5b6('0x2')]},'queue':{'type':Sequelize[_0xe5b6('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xe5b6('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xe5b6('0x4')]},'holdtime':{'type':Sequelize[_0xe5b6('0x3')]},'agentcomplete':{'type':Sequelize[_0xe5b6('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0xe5b6('0x3')]},'agentacw':{'type':Sequelize[_0xe5b6('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xe5b6('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xe5b6('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xe5b6('0x4')]},'agentdump':{'type':Sequelize[_0xe5b6('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xe5b6('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xe5b6('0x2')]},'context':{'type':Sequelize[_0xe5b6('0x2')]},'exten':{'type':Sequelize[_0xe5b6('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xe5b6('0x2')]},'destcalleridnum':{'type':Sequelize[_0xe5b6('0x2')]},'destcalleridname':{'type':Sequelize[_0xe5b6('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xe5b6('0x2')]},'destaccountcode':{'type':Sequelize[_0xe5b6('0x2')]},'destcontext':{'type':Sequelize[_0xe5b6('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xe5b6('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xe5b6('0x2')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0xe5b6('0x2')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xe5b6('0x2')]},'attachment':{'type':Sequelize[_0xe5b6('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0xe5b6('0x7')](_0xe5b6('0x8'),_0xe5b6('0x9'),_0xe5b6('0xa'),_0xe5b6('0xb'))},'url':{'type':Sequelize[_0xe5b6('0x2')]},'app':{'type':Sequelize[_0xe5b6('0x2')]},'appdata':{'type':Sequelize[_0xe5b6('0x2')]},'projectId':{'type':Sequelize[_0xe5b6('0x3')]}}; \ No newline at end of file +var _0x472e=['ENUM','SENT','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','DATE','INTEGER','BOOLEAN','TEXT'];(function(_0x128cac,_0x5bed99){var _0x4bc54a=function(_0x32914f){while(--_0x32914f){_0x128cac['push'](_0x128cac['shift']());}};_0x4bc54a(++_0x5bed99);}(_0x472e,0x1e5));var _0xe472=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x472e[_0x13ea00];return _0x1f7347;};'use strict';var Sequelize=require(_0xe472('0x0'));module[_0xe472('0x1')]={'integration':{'type':Sequelize[_0xe472('0x2')]},'eventChannel':{'type':Sequelize[_0xe472('0x2')]},'exitStatus':{'type':Sequelize[_0xe472('0x2')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0xe472('0x2')]},'uniqueid':{'type':Sequelize[_0xe472('0x2')]},'calleridnum':{'type':Sequelize[_0xe472('0x2')]},'calleridname':{'type':Sequelize[_0xe472('0x2')]},'queue':{'type':Sequelize[_0xe472('0x2')]},'interface':{'type':Sequelize[_0xe472('0x2')]},'membername':{'type':Sequelize[_0xe472('0x2')]},'agentcalledAt':{'type':Sequelize[_0xe472('0x3')]},'agentconnectAt':{'type':Sequelize[_0xe472('0x3')]},'holdtime':{'type':Sequelize[_0xe472('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0xe472('0x4')]},'agentacw':{'type':Sequelize[_0xe472('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xe472('0x4')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0xe472('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xe472('0x3')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xe472('0x2')]},'language':{'type':Sequelize[_0xe472('0x2')]},'accountcode':{'type':Sequelize[_0xe472('0x2')]},'context':{'type':Sequelize[_0xe472('0x2')]},'exten':{'type':Sequelize[_0xe472('0x2')]},'priority':{'type':Sequelize[_0xe472('0x2')]},'destchannel':{'type':Sequelize[_0xe472('0x2')]},'destchannelstate':{'type':Sequelize[_0xe472('0x4')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xe472('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xe472('0x2')]},'destlanguage':{'type':Sequelize[_0xe472('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xe472('0x2')]},'destexten':{'type':Sequelize[_0xe472('0x2')]},'destpriority':{'type':Sequelize[_0xe472('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0xe472('0x2')]},'inReplyTo':{'type':Sequelize[_0xe472('0x2')]},'subject':{'type':Sequelize[_0xe472('0x2')]},'from':{'type':Sequelize[_0xe472('0x2')]},'to':{'type':Sequelize[_0xe472('0x2')]},'cc':{'type':Sequelize[_0xe472('0x2')]},'attachment':{'type':Sequelize[_0xe472('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0xe472('0x7')](_0xe472('0x8'),_0xe472('0x9'),_0xe472('0xa'),_0xe472('0xb'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0xe472('0x2')]},'appdata':{'type':Sequelize[_0xe472('0x2')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 6eea689..e51d74c 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 _0xa34c=['papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','destroy','then','error','stack','name','send','map','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','params','IntegrationReport','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xa34c,0xd2));var _0xca34=function(_0x5b40fa,_0x84ff19){_0x5b40fa=_0x5b40fa-0x0;var _0x499eb7=_0xa34c[_0x5b40fa];return _0x499eb7;};'use strict';var emlformat=require(_0xca34('0x0'));var rimraf=require(_0xca34('0x1'));var zipdir=require(_0xca34('0x2'));var jsonpatch=require(_0xca34('0x3'));var rp=require(_0xca34('0x4'));var moment=require(_0xca34('0x5'));var BPromise=require(_0xca34('0x6'));var Mustache=require(_0xca34('0x7'));var util=require(_0xca34('0x8'));var path=require(_0xca34('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xca34('0xa'));var fs=require('fs');var fs_extra=require(_0xca34('0xb'));var _=require(_0xca34('0xc'));var squel=require(_0xca34('0xd'));var crypto=require(_0xca34('0xe'));var jsforce=require(_0xca34('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xca34('0x10'));var querystring=require(_0xca34('0x11'));var Papa=require(_0xca34('0x12'));var Redis=require(_0xca34('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xca34('0x14'));var hardwareService=require(_0xca34('0x15'));var logger=require(_0xca34('0x16'))(_0xca34('0x17'));var utils=require(_0xca34('0x18'));var config=require(_0xca34('0x19'));var licenseUtil=require(_0xca34('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x22da3a,_0xd0834b){_0xd0834b=_0xd0834b||0xcc;return function(_0x1731a7){if(_0x1731a7){return _0x22da3a[_0xca34('0x1b')](_0xd0834b);}return _0x22da3a[_0xca34('0x1c')](_0xd0834b)[_0xca34('0x1d')]();};}function respondWithResult(_0x57ca03,_0x3da648){_0x3da648=_0x3da648||0xc8;return function(_0x51931c){if(_0x51931c){return _0x57ca03[_0xca34('0x1c')](_0x3da648)['json'](_0x51931c);}};}function respondWithFilteredResult(_0x1782e5,_0x547439){return function(_0x2d5362){if(_0x2d5362){var _0x1fb95a=typeof _0x547439['offset']===_0xca34('0x1e')&&typeof _0x547439[_0xca34('0x1f')]===_0xca34('0x1e');var _0x445ef2=_0x2d5362[_0xca34('0x20')];var _0x4dccfc=_0x1fb95a?0x0:_0x547439[_0xca34('0x21')];var _0x1b2bf8=_0x1fb95a?_0x2d5362[_0xca34('0x20')]:_0x547439[_0xca34('0x21')]+_0x547439[_0xca34('0x1f')];var _0x5e5422;if(_0x1b2bf8>=_0x445ef2){_0x1b2bf8=_0x445ef2;_0x5e5422=0xc8;}else{_0x5e5422=0xce;}_0x1782e5['status'](_0x5e5422);return _0x1782e5[_0xca34('0x22')](_0xca34('0x23'),_0x4dccfc+'-'+_0x1b2bf8+'/'+_0x445ef2)[_0xca34('0x24')](_0x2d5362);}return null;};}function patchUpdates(_0x174e24){return function(_0x2f07a1){try{jsonpatch[_0xca34('0x25')](_0x2f07a1,_0x174e24,!![]);}catch(_0x3882ac){return BPromise['reject'](_0x3882ac);}return _0x2f07a1[_0xca34('0x26')]();};}function saveUpdates(_0x265706,_0x3e15f8){return function(_0x263777){if(_0x263777){return _0x263777[_0xca34('0x27')](_0x265706)['then'](function(_0x490734){return _0x490734;});}return null;};}function removeEntity(_0x3c39c1,_0x5f54f3){return function(_0x36d1b3){if(_0x36d1b3){return _0x36d1b3[_0xca34('0x28')]()[_0xca34('0x29')](function(){_0x3c39c1[_0xca34('0x1c')](0xcc)[_0xca34('0x1d')]();});}};}function handleEntityNotFound(_0x261e23,_0x14e02d){return function(_0x57a386){if(!_0x57a386){_0x261e23['sendStatus'](0x194);}return _0x57a386;};}function handleError(_0x40a9e8,_0x2cd731){_0x2cd731=_0x2cd731||0x1f4;return function(_0x4a04c2){logger[_0xca34('0x2a')](_0x4a04c2[_0xca34('0x2b')]);if(_0x4a04c2['name']){delete _0x4a04c2[_0xca34('0x2c')];}_0x40a9e8[_0xca34('0x1c')](_0x2cd731)[_0xca34('0x2d')](_0x4a04c2);};}exports['index']=function(_0x58b835,_0x5ef0f0){var _0x7e101={},_0x2985c0={},_0x1abc0e={'count':0x0,'rows':[]};var _0x208dae=_[_0xca34('0x2e')](db['IntegrationReport']['rawAttributes'],function(_0xb5b67c){return{'name':_0xb5b67c[_0xca34('0x2f')],'type':_0xb5b67c[_0xca34('0x30')]['key']};});_0x2985c0[_0xca34('0x31')]=_['map'](_0x208dae,_0xca34('0x2c'));_0x2985c0[_0xca34('0x32')]=_[_0xca34('0x33')](_0x58b835[_0xca34('0x32')]);_0x2985c0['filters']=_[_0xca34('0x34')](_0x2985c0[_0xca34('0x31')],_0x2985c0[_0xca34('0x32')]);_0x7e101[_0xca34('0x35')]=_[_0xca34('0x34')](_0x2985c0[_0xca34('0x31')],qs[_0xca34('0x36')](_0x58b835[_0xca34('0x32')][_0xca34('0x36')]));_0x7e101[_0xca34('0x35')]=_0x7e101[_0xca34('0x35')]['length']?_0x7e101[_0xca34('0x35')]:_0x2985c0[_0xca34('0x31')];if(!_0x58b835[_0xca34('0x32')][_0xca34('0x37')](_0xca34('0x38'))){_0x7e101[_0xca34('0x1f')]=qs[_0xca34('0x1f')](_0x58b835['query'][_0xca34('0x1f')]);_0x7e101['offset']=qs[_0xca34('0x21')](_0x58b835[_0xca34('0x32')][_0xca34('0x21')]);}_0x7e101[_0xca34('0x39')]=qs['sort'](_0x58b835[_0xca34('0x32')]['sort']);_0x7e101[_0xca34('0x3a')]=qs[_0xca34('0x3b')](_[_0xca34('0x3c')](_0x58b835['query'],_0x2985c0[_0xca34('0x3b')]),_0x208dae);if(_0x58b835[_0xca34('0x32')]['filter']){_0x7e101[_0xca34('0x3a')]=_['merge'](_0x7e101['where'],{'$or':_[_0xca34('0x2e')](_0x208dae,function(_0x594b9e){if(_0x594b9e['type']!==_0xca34('0x3d')){var _0x4c89cf={};_0x4c89cf[_0x594b9e[_0xca34('0x2c')]]={'$like':'%'+_0x58b835[_0xca34('0x32')][_0xca34('0x3e')]+'%'};return _0x4c89cf;}})});}_0x7e101=_[_0xca34('0x3f')]({},_0x7e101,_0x58b835[_0xca34('0x40')]);var _0x47d9a9={'where':_0x7e101[_0xca34('0x3a')]};return db['IntegrationReport'][_0xca34('0x20')](_0x47d9a9)[_0xca34('0x29')](function(_0x4fdf97){_0x1abc0e[_0xca34('0x20')]=_0x4fdf97;if(_0x58b835['query'][_0xca34('0x41')]){_0x7e101[_0xca34('0x42')]=[{'all':!![]}];}return db['IntegrationReport'][_0xca34('0x43')](_0x7e101);})[_0xca34('0x29')](function(_0x5c13cb){_0x1abc0e[_0xca34('0x44')]=_0x5c13cb;return _0x1abc0e;})[_0xca34('0x29')](respondWithFilteredResult(_0x5ef0f0,_0x7e101))[_0xca34('0x45')](handleError(_0x5ef0f0,null));};exports['show']=function(_0x2bb4da,_0x2a30a3){var _0x4175ba={'raw':![],'where':{'id':_0x2bb4da[_0xca34('0x46')]['id']}},_0x1f1d3a={};_0x1f1d3a[_0xca34('0x31')]=_[_0xca34('0x33')](db[_0xca34('0x47')]['rawAttributes']);_0x1f1d3a[_0xca34('0x32')]=_[_0xca34('0x33')](_0x2bb4da['query']);_0x1f1d3a[_0xca34('0x3b')]=_[_0xca34('0x34')](_0x1f1d3a[_0xca34('0x31')],_0x1f1d3a[_0xca34('0x32')]);_0x4175ba[_0xca34('0x35')]=_[_0xca34('0x34')](_0x1f1d3a[_0xca34('0x31')],qs[_0xca34('0x36')](_0x2bb4da[_0xca34('0x32')][_0xca34('0x36')]));_0x4175ba[_0xca34('0x35')]=_0x4175ba[_0xca34('0x35')]['length']?_0x4175ba[_0xca34('0x35')]:_0x1f1d3a[_0xca34('0x31')];if(_0x2bb4da[_0xca34('0x32')][_0xca34('0x41')]){_0x4175ba[_0xca34('0x42')]=[{'all':!![]}];}_0x4175ba=_[_0xca34('0x3f')]({},_0x4175ba,_0x2bb4da[_0xca34('0x40')]);return db[_0xca34('0x47')][_0xca34('0x48')](_0x4175ba)[_0xca34('0x29')](handleEntityNotFound(_0x2a30a3,null))[_0xca34('0x29')](respondWithResult(_0x2a30a3,null))[_0xca34('0x45')](handleError(_0x2a30a3,null));};exports[_0xca34('0x49')]=function(_0x21806b,_0x4af3ec){return db[_0xca34('0x47')][_0xca34('0x49')](_0x21806b[_0xca34('0x4a')],{})[_0xca34('0x29')](respondWithResult(_0x4af3ec,0xc9))['catch'](handleError(_0x4af3ec,null));};exports['update']=function(_0x1dabc3,_0x231dc9){if(_0x1dabc3[_0xca34('0x4a')]['id']){delete _0x1dabc3[_0xca34('0x4a')]['id'];}return db[_0xca34('0x47')][_0xca34('0x48')]({'where':{'id':_0x1dabc3['params']['id']}})[_0xca34('0x29')](handleEntityNotFound(_0x231dc9,null))['then'](saveUpdates(_0x1dabc3[_0xca34('0x4a')],null))[_0xca34('0x29')](respondWithResult(_0x231dc9,null))['catch'](handleError(_0x231dc9,null));};exports[_0xca34('0x28')]=function(_0x4715cc,_0x279ce3){return db[_0xca34('0x47')]['find']({'where':{'id':_0x4715cc['params']['id']}})[_0xca34('0x29')](handleEntityNotFound(_0x279ce3,null))[_0xca34('0x29')](removeEntity(_0x279ce3,null))[_0xca34('0x45')](handleError(_0x279ce3,null));};exports[_0xca34('0x4b')]=function(_0x44efd1,_0x5da3d1){return db['IntegrationReport'][_0xca34('0x4b')]()['then'](respondWithResult(_0x5da3d1,null))[_0xca34('0x45')](handleError(_0x5da3d1,null));}; \ No newline at end of file +var _0x44a3=['sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','IntegrationReport','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','length','sort','where','filter','merge','VIRTUAL','include','findAll','show','options','catch','create','body','update','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x44a3,0x155));var _0x344a=function(_0x594821,_0x153b6c){_0x594821=_0x594821-0x0;var _0x139112=_0x44a3[_0x594821];return _0x139112;};'use strict';var emlformat=require(_0x344a('0x0'));var rimraf=require(_0x344a('0x1'));var zipdir=require(_0x344a('0x2'));var jsonpatch=require(_0x344a('0x3'));var rp=require(_0x344a('0x4'));var moment=require(_0x344a('0x5'));var BPromise=require(_0x344a('0x6'));var Mustache=require(_0x344a('0x7'));var util=require('util');var path=require(_0x344a('0x8'));var sox=require(_0x344a('0x9'));var csv=require(_0x344a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x344a('0xb'));var squel=require('squel');var crypto=require(_0x344a('0xc'));var jsforce=require(_0x344a('0xd'));var deskjs=require(_0x344a('0xe'));var toCsv=require(_0x344a('0xa'));var querystring=require(_0x344a('0xf'));var Papa=require(_0x344a('0x10'));var Redis=require(_0x344a('0x11'));var authService=require(_0x344a('0x12'));var qs=require(_0x344a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x344a('0x14'));var utils=require(_0x344a('0x15'));var config=require(_0x344a('0x16'));var licenseUtil=require(_0x344a('0x17'));var db=require(_0x344a('0x18'))['db'];function respondWithStatusCode(_0x54bd3d,_0x306b26){_0x306b26=_0x306b26||0xcc;return function(_0x543f04){if(_0x543f04){return _0x54bd3d[_0x344a('0x19')](_0x306b26);}return _0x54bd3d[_0x344a('0x1a')](_0x306b26)[_0x344a('0x1b')]();};}function respondWithResult(_0x4418de,_0x13e9bf){_0x13e9bf=_0x13e9bf||0xc8;return function(_0x301337){if(_0x301337){return _0x4418de[_0x344a('0x1a')](_0x13e9bf)[_0x344a('0x1c')](_0x301337);}};}function respondWithFilteredResult(_0x37370d,_0x5b65f2){return function(_0x151159){if(_0x151159){var _0x476aea=typeof _0x5b65f2[_0x344a('0x1d')]===_0x344a('0x1e')&&typeof _0x5b65f2[_0x344a('0x1f')]===_0x344a('0x1e');var _0x8f6e6f=_0x151159['count'];var _0x5612cb=_0x476aea?0x0:_0x5b65f2[_0x344a('0x1d')];var _0x1e1658=_0x476aea?_0x151159[_0x344a('0x20')]:_0x5b65f2[_0x344a('0x1d')]+_0x5b65f2[_0x344a('0x1f')];var _0x24a65a;if(_0x1e1658>=_0x8f6e6f){_0x1e1658=_0x8f6e6f;_0x24a65a=0xc8;}else{_0x24a65a=0xce;}_0x37370d['status'](_0x24a65a);return _0x37370d[_0x344a('0x21')](_0x344a('0x22'),_0x5612cb+'-'+_0x1e1658+'/'+_0x8f6e6f)['json'](_0x151159);}return null;};}function patchUpdates(_0x15212d){return function(_0xf6a63a){try{jsonpatch[_0x344a('0x23')](_0xf6a63a,_0x15212d,!![]);}catch(_0x16bc4d){return BPromise['reject'](_0x16bc4d);}return _0xf6a63a[_0x344a('0x24')]();};}function saveUpdates(_0x6d3007,_0x17a78d){return function(_0x577ecb){if(_0x577ecb){return _0x577ecb['update'](_0x6d3007)[_0x344a('0x25')](function(_0x3ccc17){return _0x3ccc17;});}return null;};}function removeEntity(_0x43f9b9,_0x27b5ba){return function(_0x327c6e){if(_0x327c6e){return _0x327c6e[_0x344a('0x26')]()[_0x344a('0x25')](function(){_0x43f9b9[_0x344a('0x1a')](0xcc)[_0x344a('0x1b')]();});}};}function handleEntityNotFound(_0x4c65c1,_0x19fa99){return function(_0x132b8f){if(!_0x132b8f){_0x4c65c1[_0x344a('0x19')](0x194);}return _0x132b8f;};}function handleError(_0x34ddad,_0x127938){_0x127938=_0x127938||0x1f4;return function(_0x37b642){logger[_0x344a('0x27')](_0x37b642[_0x344a('0x28')]);if(_0x37b642[_0x344a('0x29')]){delete _0x37b642[_0x344a('0x29')];}_0x34ddad[_0x344a('0x1a')](_0x127938)[_0x344a('0x2a')](_0x37b642);};}exports[_0x344a('0x2b')]=function(_0x3bfdd7,_0x417688){var _0x5c4f62={},_0x221022={},_0x3d4447={'count':0x0,'rows':[]};var _0x5b82f3=_[_0x344a('0x2c')](db[_0x344a('0x2d')][_0x344a('0x2e')],function(_0x236c7f){return{'name':_0x236c7f['fieldName'],'type':_0x236c7f[_0x344a('0x2f')]['key']};});_0x221022['model']=_['map'](_0x5b82f3,_0x344a('0x29'));_0x221022[_0x344a('0x30')]=_[_0x344a('0x31')](_0x3bfdd7['query']);_0x221022[_0x344a('0x32')]=_[_0x344a('0x33')](_0x221022[_0x344a('0x34')],_0x221022['query']);_0x5c4f62[_0x344a('0x35')]=_[_0x344a('0x33')](_0x221022[_0x344a('0x34')],qs[_0x344a('0x36')](_0x3bfdd7[_0x344a('0x30')][_0x344a('0x36')]));_0x5c4f62[_0x344a('0x35')]=_0x5c4f62[_0x344a('0x35')][_0x344a('0x37')]?_0x5c4f62['attributes']:_0x221022[_0x344a('0x34')];if(!_0x3bfdd7[_0x344a('0x30')]['hasOwnProperty']('nolimit')){_0x5c4f62[_0x344a('0x1f')]=qs[_0x344a('0x1f')](_0x3bfdd7[_0x344a('0x30')]['limit']);_0x5c4f62[_0x344a('0x1d')]=qs[_0x344a('0x1d')](_0x3bfdd7[_0x344a('0x30')][_0x344a('0x1d')]);}_0x5c4f62['order']=qs[_0x344a('0x38')](_0x3bfdd7[_0x344a('0x30')][_0x344a('0x38')]);_0x5c4f62[_0x344a('0x39')]=qs[_0x344a('0x32')](_['pick'](_0x3bfdd7['query'],_0x221022[_0x344a('0x32')]),_0x5b82f3);if(_0x3bfdd7[_0x344a('0x30')][_0x344a('0x3a')]){_0x5c4f62[_0x344a('0x39')]=_[_0x344a('0x3b')](_0x5c4f62['where'],{'$or':_[_0x344a('0x2c')](_0x5b82f3,function(_0x4f3830){if(_0x4f3830[_0x344a('0x2f')]!==_0x344a('0x3c')){var _0x4bb397={};_0x4bb397[_0x4f3830[_0x344a('0x29')]]={'$like':'%'+_0x3bfdd7[_0x344a('0x30')]['filter']+'%'};return _0x4bb397;}})});}_0x5c4f62=_[_0x344a('0x3b')]({},_0x5c4f62,_0x3bfdd7['options']);var _0x4e8c60={'where':_0x5c4f62[_0x344a('0x39')]};return db[_0x344a('0x2d')][_0x344a('0x20')](_0x4e8c60)[_0x344a('0x25')](function(_0x374fa6){_0x3d4447[_0x344a('0x20')]=_0x374fa6;if(_0x3bfdd7['query']['includeAll']){_0x5c4f62[_0x344a('0x3d')]=[{'all':!![]}];}return db[_0x344a('0x2d')][_0x344a('0x3e')](_0x5c4f62);})[_0x344a('0x25')](function(_0x21b44d){_0x3d4447['rows']=_0x21b44d;return _0x3d4447;})['then'](respondWithFilteredResult(_0x417688,_0x5c4f62))['catch'](handleError(_0x417688,null));};exports[_0x344a('0x3f')]=function(_0x39ffb5,_0x49be0b){var _0x5a286c={'raw':![],'where':{'id':_0x39ffb5['params']['id']}},_0x38cfb4={};_0x38cfb4[_0x344a('0x34')]=_[_0x344a('0x31')](db[_0x344a('0x2d')][_0x344a('0x2e')]);_0x38cfb4[_0x344a('0x30')]=_[_0x344a('0x31')](_0x39ffb5[_0x344a('0x30')]);_0x38cfb4[_0x344a('0x32')]=_['intersection'](_0x38cfb4[_0x344a('0x34')],_0x38cfb4['query']);_0x5a286c['attributes']=_[_0x344a('0x33')](_0x38cfb4[_0x344a('0x34')],qs[_0x344a('0x36')](_0x39ffb5[_0x344a('0x30')][_0x344a('0x36')]));_0x5a286c[_0x344a('0x35')]=_0x5a286c[_0x344a('0x35')][_0x344a('0x37')]?_0x5a286c[_0x344a('0x35')]:_0x38cfb4['model'];if(_0x39ffb5[_0x344a('0x30')]['includeAll']){_0x5a286c[_0x344a('0x3d')]=[{'all':!![]}];}_0x5a286c=_['merge']({},_0x5a286c,_0x39ffb5[_0x344a('0x40')]);return db[_0x344a('0x2d')]['find'](_0x5a286c)[_0x344a('0x25')](handleEntityNotFound(_0x49be0b,null))[_0x344a('0x25')](respondWithResult(_0x49be0b,null))[_0x344a('0x41')](handleError(_0x49be0b,null));};exports[_0x344a('0x42')]=function(_0x302b5d,_0x5ed65c){return db[_0x344a('0x2d')][_0x344a('0x42')](_0x302b5d[_0x344a('0x43')],{})['then'](respondWithResult(_0x5ed65c,0xc9))[_0x344a('0x41')](handleError(_0x5ed65c,null));};exports[_0x344a('0x44')]=function(_0xf749dc,_0x27d18f){if(_0xf749dc['body']['id']){delete _0xf749dc[_0x344a('0x43')]['id'];}return db['IntegrationReport']['find']({'where':{'id':_0xf749dc['params']['id']}})['then'](handleEntityNotFound(_0x27d18f,null))[_0x344a('0x25')](saveUpdates(_0xf749dc[_0x344a('0x43')],null))[_0x344a('0x25')](respondWithResult(_0x27d18f,null))['catch'](handleError(_0x27d18f,null));};exports['destroy']=function(_0x49da91,_0x2247b9){return db[_0x344a('0x2d')]['find']({'where':{'id':_0x49da91[_0x344a('0x45')]['id']}})[_0x344a('0x25')](handleEntityNotFound(_0x2247b9,null))['then'](removeEntity(_0x2247b9,null))[_0x344a('0x41')](handleError(_0x2247b9,null));};exports['describe']=function(_0x159107,_0x3d603f){return db['IntegrationReport']['describe']()[_0x344a('0x25')](respondWithResult(_0x3d603f,null))[_0x344a('0x41')](handleError(_0x3d603f,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 1007581..a354324 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 _0xbc77=['bluebird','request-promise','rimraf','../../config/environment','exports','report_integration','lodash','util','../../config/logger','api','moment'];(function(_0x387022,_0x30888c){var _0x414c5c=function(_0xbd6f1d){while(--_0xbd6f1d){_0x387022['push'](_0x387022['shift']());}};_0x414c5c(++_0x30888c);}(_0xbc77,0x19d));var _0x7bc7=function(_0x46efd7,_0x43f84d){_0x46efd7=_0x46efd7-0x0;var _0x5637e4=_0xbc77[_0x46efd7];return _0x5637e4;};'use strict';var _=require(_0x7bc7('0x0'));var util=require(_0x7bc7('0x1'));var logger=require(_0x7bc7('0x2'))(_0x7bc7('0x3'));var moment=require(_0x7bc7('0x4'));var BPromise=require(_0x7bc7('0x5'));var rp=require(_0x7bc7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7bc7('0x7'));var config=require(_0x7bc7('0x8'));var attributes=require('./integrationReport.attributes');module[_0x7bc7('0x9')]=function(_0x19a5e2,_0x5e2e3e){return _0x19a5e2['define']('IntegrationReport',attributes,{'tableName':_0x7bc7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf218=['api','moment','request-promise','path','../../config/environment','exports','define','report_integration','util'];(function(_0x42e669,_0x3c921a){var _0x544f50=function(_0x59a1b0){while(--_0x59a1b0){_0x42e669['push'](_0x42e669['shift']());}};_0x544f50(++_0x3c921a);}(_0xf218,0x1c1));var _0x8f21=function(_0x1669d0,_0x599eb7){_0x1669d0=_0x1669d0-0x0;var _0x20c1af=_0xf218[_0x1669d0];return _0x20c1af;};'use strict';var _=require('lodash');var util=require(_0x8f21('0x0'));var logger=require('../../config/logger')(_0x8f21('0x1'));var moment=require(_0x8f21('0x2'));var BPromise=require('bluebird');var rp=require(_0x8f21('0x3'));var fs=require('fs');var path=require(_0x8f21('0x4'));var rimraf=require('rimraf');var config=require(_0x8f21('0x5'));var attributes=require('./integrationReport.attributes');module[_0x8f21('0x6')]=function(_0x33fc7a,_0x2e360){return _0x33fc7a[_0x8f21('0x7')]('IntegrationReport',attributes,{'tableName':_0x8f21('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 6f1aaaa..82ace88 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 _0x5fab=['../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','IntegrationReport,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3800d3,_0x428dfd){var _0x491c71=function(_0x55a174){while(--_0x55a174){_0x3800d3['push'](_0x3800d3['shift']());}};_0x491c71(++_0x428dfd);}(_0x5fab,0x177));var _0xb5fa=function(_0xdb357c,_0x3786b6){_0xdb357c=_0xdb357c-0x0;var _0x5c8735=_0x5fab[_0xdb357c];return _0x5c8735;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var moment=require('moment');var BPromise=require(_0xb5fa('0x2'));var rs=require(_0xb5fa('0x3'));var fs=require('fs');var Redis=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var utils=require(_0xb5fa('0x6'));var logger=require(_0xb5fa('0x7'))(_0xb5fa('0x8'));var config=require(_0xb5fa('0x9'));var jayson=require(_0xb5fa('0xa'));var client=jayson[_0xb5fa('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d70f6,_0x2e3804,_0x1aec3e){return new BPromise(function(_0x9c7bce,_0x56d018){return client[_0xb5fa('0xc')](_0x5d70f6,_0x1aec3e)[_0xb5fa('0xd')](function(_0x2cf4a5){logger['info']('IntegrationReport,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));logger[_0xb5fa('0xf')](_0xb5fa('0x10'),_0x2e3804,_0xb5fa('0xe'),JSON[_0xb5fa('0x11')](_0x2cf4a5));if(_0x2cf4a5[_0xb5fa('0x12')]){if(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x13')]===0x1f4){logger[_0xb5fa('0x12')]('IntegrationReport,\x20%s,\x20%s',_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x56d018(_0x2cf4a5['error'][_0xb5fa('0x14')]);}logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x9c7bce(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);}else{logger['info']('IntegrationReport,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));_0x9c7bce(_0x2cf4a5[_0xb5fa('0x16')][_0xb5fa('0x14')]);}})[_0xb5fa('0x17')](function(_0x56fe10){logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x56fe10);_0x56d018(_0x56fe10);});});} \ No newline at end of file +var _0x4975=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x4975,0x86));var _0x5497=function(_0x3f5a9c,_0x54165c){_0x3f5a9c=_0x3f5a9c-0x0;var _0x389bad=_0x4975[_0x3f5a9c];return _0x389bad;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var moment=require(_0x5497('0x1'));var BPromise=require(_0x5497('0x2'));var rs=require(_0x5497('0x3'));var fs=require('fs');var Redis=require(_0x5497('0x4'));var db=require(_0x5497('0x5'))['db'];var utils=require(_0x5497('0x6'));var logger=require(_0x5497('0x7'))(_0x5497('0x8'));var config=require(_0x5497('0x9'));var jayson=require(_0x5497('0xa'));var client=jayson['client'][_0x5497('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f563d,_0x1d0019,_0x674a2a){return new BPromise(function(_0x368e8b,_0x57f930){return client[_0x5497('0xc')](_0x4f563d,_0x674a2a)['then'](function(_0x1f63d8){logger[_0x5497('0xd')](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));logger[_0x5497('0x10')](_0x5497('0x11'),_0x1d0019,_0x5497('0xf'),JSON[_0x5497('0x12')](_0x1f63d8));if(_0x1f63d8['error']){if(_0x1f63d8['error']['code']===0x1f4){logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x57f930(_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);}logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x368e8b(_0x1f63d8['error'][_0x5497('0x14')]);}else{logger['info'](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));_0x368e8b(_0x1f63d8[_0x5497('0x15')][_0x5497('0x14')]);}})[_0x5497('0x16')](function(_0x4073e6){logger[_0x5497('0x13')]('IntegrationReport,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index b4e1bd9..8dce850 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 _0x8f6b=['Router','../../components/auth/service','../../components/interaction/service','./interval.controller','isAuthenticated','get','show','getIntervals','post','create','/:id/sub_intervals','addInterval','/:id/sub_intervals/create_many','put','/:id','update','delete','destroy','multer','util','path','express'];(function(_0x5f6a8a,_0x45f474){var _0x2cce4d=function(_0x590b80){while(--_0x590b80){_0x5f6a8a['push'](_0x5f6a8a['shift']());}};_0x2cce4d(++_0x45f474);}(_0x8f6b,0x146));var _0xb8f6=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0x8f6b[_0x5317b5];return _0x3b7ce2;};'use strict';var multer=require(_0xb8f6('0x0'));var util=require(_0xb8f6('0x1'));var path=require(_0xb8f6('0x2'));var timeout=require('connect-timeout');var express=require(_0xb8f6('0x3'));var router=express[_0xb8f6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb8f6('0x5'));var interaction=require(_0xb8f6('0x6'));var config=require('../../config/environment');var controller=require(_0xb8f6('0x7'));router['get']('/',auth[_0xb8f6('0x8')](),controller['index']);router[_0xb8f6('0x9')]('/:id',auth[_0xb8f6('0x8')](),controller[_0xb8f6('0xa')]);router['get']('/:id/sub_intervals',auth[_0xb8f6('0x8')](),controller[_0xb8f6('0xb')]);router[_0xb8f6('0xc')]('/',auth[_0xb8f6('0x8')](),controller[_0xb8f6('0xd')]);router[_0xb8f6('0xc')](_0xb8f6('0xe'),auth[_0xb8f6('0x8')](),controller[_0xb8f6('0xf')]);router[_0xb8f6('0xc')](_0xb8f6('0x10'),auth[_0xb8f6('0x8')](),controller['addIntervals']);router[_0xb8f6('0x11')](_0xb8f6('0x12'),auth['isAuthenticated'](),controller[_0xb8f6('0x13')]);router[_0xb8f6('0x14')](_0xb8f6('0x12'),auth['isAuthenticated'](),controller[_0xb8f6('0x15')]);module['exports']=router; \ No newline at end of file +var _0xef27=['/:id/sub_intervals','getIntervals','post','create','addInterval','addIntervals','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show'];(function(_0x173e52,_0x5fd77){var _0x41bd33=function(_0x10c718){while(--_0x10c718){_0x173e52['push'](_0x173e52['shift']());}};_0x41bd33(++_0x5fd77);}(_0xef27,0x1c2));var _0x7ef2=function(_0x48e4fc,_0x2128f5){_0x48e4fc=_0x48e4fc-0x0;var _0x4906f1=_0xef27[_0x48e4fc];return _0x4906f1;};'use strict';var multer=require(_0x7ef2('0x0'));var util=require(_0x7ef2('0x1'));var path=require(_0x7ef2('0x2'));var timeout=require(_0x7ef2('0x3'));var express=require('express');var router=express[_0x7ef2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7ef2('0x5'));var controller=require(_0x7ef2('0x6'));router[_0x7ef2('0x7')]('/',auth[_0x7ef2('0x8')](),controller[_0x7ef2('0x9')]);router[_0x7ef2('0x7')](_0x7ef2('0xa'),auth[_0x7ef2('0x8')](),controller[_0x7ef2('0xb')]);router[_0x7ef2('0x7')](_0x7ef2('0xc'),auth[_0x7ef2('0x8')](),controller[_0x7ef2('0xd')]);router[_0x7ef2('0xe')]('/',auth[_0x7ef2('0x8')](),controller[_0x7ef2('0xf')]);router['post'](_0x7ef2('0xc'),auth['isAuthenticated'](),controller[_0x7ef2('0x10')]);router['post']('/:id/sub_intervals/create_many',auth[_0x7ef2('0x8')](),controller[_0x7ef2('0x11')]);router['put'](_0x7ef2('0xa'),auth[_0x7ef2('0x8')](),controller[_0x7ef2('0x12')]);router[_0x7ef2('0x13')]('/:id',auth[_0x7ef2('0x8')](),controller[_0x7ef2('0x14')]);module[_0x7ef2('0x15')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 6d6859a..0679000 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 _0x4be7=['sequelize','exports','STRING'];(function(_0x278dea,_0xf7c32e){var _0x382acd=function(_0x5564cf){while(--_0x5564cf){_0x278dea['push'](_0x278dea['shift']());}};_0x382acd(++_0xf7c32e);}(_0x4be7,0x129));var _0x74be=function(_0x2f81ef,_0x33953a){_0x2f81ef=_0x2f81ef-0x0;var _0x1ca14d=_0x4be7[_0x2f81ef];return _0x1ca14d;};'use strict';var Sequelize=require(_0x74be('0x0'));module[_0x74be('0x1')]={'name':{'type':Sequelize[_0x74be('0x2')]},'description':{'type':Sequelize[_0x74be('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xdf17=['sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdf17,0x110));var _0x7df1=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xdf17[_0x102e37];return _0x35a07c;};'use strict';var Sequelize=require(_0x7df1('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x7df1('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index c32c949..0c4c159 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 _0xa654=['UserProfileResource','end','name','send','index','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','Interval','findAll','rows','catch','show','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','addInterval','IntervalId','getIntervals','addIntervals','sequelize','transaction','bulkCreate','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Intervals'];(function(_0x481844,_0x259b1f){var _0x2afc17=function(_0x3404d4){while(--_0x3404d4){_0x481844['push'](_0x481844['shift']());}};_0x2afc17(++_0x259b1f);}(_0xa654,0x148));var _0x4a65=function(_0x5d385d,_0x37b4f1){_0x5d385d=_0x5d385d-0x0;var _0x29e4f0=_0xa654[_0x5d385d];return _0x29e4f0;};'use strict';var emlformat=require(_0x4a65('0x0'));var rimraf=require(_0x4a65('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4a65('0x2'));var rp=require('request-promise');var moment=require(_0x4a65('0x3'));var BPromise=require(_0x4a65('0x4'));var Mustache=require('mustache');var util=require(_0x4a65('0x5'));var path=require(_0x4a65('0x6'));var sox=require(_0x4a65('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4a65('0x8'));var _=require('lodash');var squel=require(_0x4a65('0x9'));var crypto=require(_0x4a65('0xa'));var jsforce=require(_0x4a65('0xb'));var deskjs=require(_0x4a65('0xc'));var toCsv=require(_0x4a65('0xd'));var querystring=require(_0x4a65('0xe'));var Papa=require(_0x4a65('0xf'));var Redis=require(_0x4a65('0x10'));var authService=require(_0x4a65('0x11'));var qs=require(_0x4a65('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4a65('0x13'));var logger=require(_0x4a65('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4a65('0x15'));var db=require(_0x4a65('0x16'))['db'];var extensions=require(_0x4a65('0x17'));function respondWithStatusCode(_0x4ed9ea,_0x463a39){_0x463a39=_0x463a39||0xcc;return function(_0xab2b9c){if(_0xab2b9c){return _0x4ed9ea['sendStatus'](_0x463a39);}return _0x4ed9ea['status'](_0x463a39)['end']();};}function respondWithResult(_0x3cde4c,_0x1dddc9){_0x1dddc9=_0x1dddc9||0xc8;return function(_0x65168d){if(_0x65168d){return _0x3cde4c[_0x4a65('0x18')](_0x1dddc9)[_0x4a65('0x19')](_0x65168d);}};}function respondWithFilteredResult(_0x3d0f9d,_0x1f1291){return function(_0x48ad49){if(_0x48ad49){var _0x3d7537=typeof _0x1f1291[_0x4a65('0x1a')]==='undefined'&&typeof _0x1f1291[_0x4a65('0x1b')]===_0x4a65('0x1c');var _0x5d0fc2=_0x48ad49[_0x4a65('0x1d')];var _0x122d96=_0x3d7537?0x0:_0x1f1291['offset'];var _0x1b0fbc=_0x3d7537?_0x48ad49[_0x4a65('0x1d')]:_0x1f1291[_0x4a65('0x1a')]+_0x1f1291['limit'];var _0x2a8fb9;if(_0x1b0fbc>=_0x5d0fc2){_0x1b0fbc=_0x5d0fc2;_0x2a8fb9=0xc8;}else{_0x2a8fb9=0xce;}_0x3d0f9d['status'](_0x2a8fb9);return _0x3d0f9d[_0x4a65('0x1e')](_0x4a65('0x1f'),_0x122d96+'-'+_0x1b0fbc+'/'+_0x5d0fc2)[_0x4a65('0x19')](_0x48ad49);}return null;};}function patchUpdates(_0x2e8a9d){return function(_0x21ec1b){try{jsonpatch[_0x4a65('0x20')](_0x21ec1b,_0x2e8a9d,!![]);}catch(_0x1fe610){return BPromise[_0x4a65('0x21')](_0x1fe610);}return _0x21ec1b[_0x4a65('0x22')]();};}function saveUpdates(_0x17290d,_0x57b255){return function(_0x59ffe4){if(_0x59ffe4){return _0x59ffe4[_0x4a65('0x23')](_0x17290d)[_0x4a65('0x24')](function(_0x135ac8){return _0x135ac8;});}return null;};}function removeEntity(_0x4809b5,_0x11351d){return function(_0x3564da){if(_0x3564da){return _0x3564da[_0x4a65('0x25')]()['then'](function(){var _0x4baaea=_0x3564da[_0x4a65('0x26')]({'plain':!![]});var _0x18f766=_0x4a65('0x27');return db[_0x4a65('0x28')]['destroy']({'where':{'type':_0x18f766,'resourceId':_0x4baaea['id']}})['then'](function(){return _0x3564da;});})['then'](function(){_0x4809b5[_0x4a65('0x18')](0xcc)[_0x4a65('0x29')]();});}};}function handleEntityNotFound(_0x5973ba,_0x33cb85){return function(_0x4e4aaa){if(!_0x4e4aaa){_0x5973ba['sendStatus'](0x194);}return _0x4e4aaa;};}function handleError(_0x54bb18,_0x1dbbb2){_0x1dbbb2=_0x1dbbb2||0x1f4;return function(_0x4dddbf){logger['error'](_0x4dddbf['stack']);if(_0x4dddbf[_0x4a65('0x2a')]){delete _0x4dddbf[_0x4a65('0x2a')];}_0x54bb18[_0x4a65('0x18')](_0x1dbbb2)[_0x4a65('0x2b')](_0x4dddbf);};}exports[_0x4a65('0x2c')]=function(_0x5eefd8,_0x5199b7){var _0x4de2fd={},_0x55894a={},_0x3cb4bc={'count':0x0,'rows':[]};var _0x5791b3=_['map'](db['Interval'][_0x4a65('0x2d')],function(_0x4e2b32){return{'name':_0x4e2b32['fieldName'],'type':_0x4e2b32[_0x4a65('0x2e')][_0x4a65('0x2f')]};});_0x55894a[_0x4a65('0x30')]=_[_0x4a65('0x31')](_0x5791b3,_0x4a65('0x2a'));_0x55894a[_0x4a65('0x32')]=_[_0x4a65('0x33')](_0x5eefd8[_0x4a65('0x32')]);_0x55894a[_0x4a65('0x34')]=_[_0x4a65('0x35')](_0x55894a[_0x4a65('0x30')],_0x55894a[_0x4a65('0x32')]);_0x4de2fd[_0x4a65('0x36')]=_[_0x4a65('0x35')](_0x55894a[_0x4a65('0x30')],qs[_0x4a65('0x37')](_0x5eefd8[_0x4a65('0x32')][_0x4a65('0x37')]));_0x4de2fd['attributes']=_0x4de2fd['attributes'][_0x4a65('0x38')]?_0x4de2fd['attributes']:_0x55894a[_0x4a65('0x30')];if(!_0x5eefd8[_0x4a65('0x32')][_0x4a65('0x39')](_0x4a65('0x3a'))){_0x4de2fd['limit']=qs[_0x4a65('0x1b')](_0x5eefd8[_0x4a65('0x32')][_0x4a65('0x1b')]);_0x4de2fd[_0x4a65('0x1a')]=qs[_0x4a65('0x1a')](_0x5eefd8[_0x4a65('0x32')]['offset']);}_0x4de2fd[_0x4a65('0x3b')]=qs[_0x4a65('0x3c')](_0x5eefd8[_0x4a65('0x32')][_0x4a65('0x3c')]);_0x4de2fd['where']=qs[_0x4a65('0x34')](_[_0x4a65('0x3d')](_0x5eefd8[_0x4a65('0x32')],_0x55894a['filters']),_0x5791b3);if(_0x5eefd8[_0x4a65('0x32')]['filter']){_0x4de2fd[_0x4a65('0x3e')]=_[_0x4a65('0x3f')](_0x4de2fd[_0x4a65('0x3e')],{'$or':_[_0x4a65('0x31')](_0x5791b3,function(_0x4c5842){if(_0x4c5842[_0x4a65('0x2e')]!==_0x4a65('0x40')){var _0x376e81={};_0x376e81[_0x4c5842[_0x4a65('0x2a')]]={'$like':'%'+_0x5eefd8[_0x4a65('0x32')][_0x4a65('0x41')]+'%'};return _0x376e81;}})});}_0x4de2fd=_[_0x4a65('0x3f')]({},_0x4de2fd,_0x5eefd8[_0x4a65('0x42')]);var _0xa771f0={'where':_0x4de2fd[_0x4a65('0x3e')]};return db['Interval']['count'](_0xa771f0)['then'](function(_0x4669cb){_0x3cb4bc['count']=_0x4669cb;if(_0x5eefd8['query'][_0x4a65('0x43')]){_0x4de2fd[_0x4a65('0x44')]=[{'all':!![]}];}return db[_0x4a65('0x45')][_0x4a65('0x46')](_0x4de2fd);})[_0x4a65('0x24')](function(_0x23148b){_0x3cb4bc[_0x4a65('0x47')]=_0x23148b;return _0x3cb4bc;})[_0x4a65('0x24')](respondWithFilteredResult(_0x5199b7,_0x4de2fd))[_0x4a65('0x48')](handleError(_0x5199b7,null));};exports[_0x4a65('0x49')]=function(_0x4fba5a,_0x3cf106){var _0x4f402e={'raw':!![],'where':{'id':_0x4fba5a['params']['id']}},_0xfa627b={};_0xfa627b['model']=_[_0x4a65('0x33')](db['Interval'][_0x4a65('0x2d')]);_0xfa627b[_0x4a65('0x32')]=_[_0x4a65('0x33')](_0x4fba5a[_0x4a65('0x32')]);_0xfa627b['filters']=_[_0x4a65('0x35')](_0xfa627b['model'],_0xfa627b[_0x4a65('0x32')]);_0x4f402e[_0x4a65('0x36')]=_[_0x4a65('0x35')](_0xfa627b[_0x4a65('0x30')],qs[_0x4a65('0x37')](_0x4fba5a[_0x4a65('0x32')]['fields']));_0x4f402e['attributes']=_0x4f402e[_0x4a65('0x36')][_0x4a65('0x38')]?_0x4f402e[_0x4a65('0x36')]:_0xfa627b[_0x4a65('0x30')];if(_0x4fba5a['query']['includeAll']){_0x4f402e[_0x4a65('0x44')]=[{'all':!![]}];}_0x4f402e=_['merge']({},_0x4f402e,_0x4fba5a[_0x4a65('0x42')]);return db[_0x4a65('0x45')][_0x4a65('0x4a')](_0x4f402e)[_0x4a65('0x24')](handleEntityNotFound(_0x3cf106,null))[_0x4a65('0x24')](respondWithResult(_0x3cf106,null))['catch'](handleError(_0x3cf106,null));};exports[_0x4a65('0x4b')]=function(_0xa8b264,_0x1e42fa){return db[_0x4a65('0x45')]['create'](_0xa8b264['body'],{})[_0x4a65('0x24')](function(_0x1fcad4){var _0x57fa26=_0xa8b264['user'][_0x4a65('0x26')]({'plain':!![]});if(!_0x57fa26)throw new Error(_0x4a65('0x4c'));if(_0x57fa26[_0x4a65('0x4d')]===_0x4a65('0x4e')){var _0xd186d7=_0x1fcad4['get']({'plain':!![]});var _0x2c2a50=_0x4a65('0x27');return db['UserProfileSection'][_0x4a65('0x4a')]({'where':{'name':_0x2c2a50,'userProfileId':_0x57fa26[_0x4a65('0x4f')]},'raw':!![]})[_0x4a65('0x24')](function(_0x58d98f){if(_0x58d98f&&_0x58d98f[_0x4a65('0x50')]===0x0){return db[_0x4a65('0x28')][_0x4a65('0x4b')]({'name':_0xd186d7[_0x4a65('0x2a')],'resourceId':_0xd186d7['id'],'type':_0x58d98f[_0x4a65('0x2a')],'sectionId':_0x58d98f['id']},{})['then'](function(){return _0x1fcad4;});}else{return _0x1fcad4;}})[_0x4a65('0x48')](function(_0x42bcd1){logger[_0x4a65('0x51')](_0x4a65('0x52'),_0x42bcd1);throw _0x42bcd1;});}return _0x1fcad4;})['then'](respondWithResult(_0x1e42fa,0xc9))[_0x4a65('0x48')](handleError(_0x1e42fa,null));};exports['update']=function(_0x2818a5,_0x2bfdb3){if(_0x2818a5[_0x4a65('0x53')]['id']){delete _0x2818a5[_0x4a65('0x53')]['id'];}return db[_0x4a65('0x45')][_0x4a65('0x4a')]({'where':{'id':_0x2818a5[_0x4a65('0x54')]['id']}})[_0x4a65('0x24')](handleEntityNotFound(_0x2bfdb3,null))['then'](saveUpdates(_0x2818a5[_0x4a65('0x53')],null))[_0x4a65('0x24')](respondWithResult(_0x2bfdb3,null))['catch'](handleError(_0x2bfdb3,null));};exports[_0x4a65('0x25')]=function(_0x2da35f,_0x3ea753){return db['Interval']['find']({'where':{'id':_0x2da35f[_0x4a65('0x54')]['id']}})[_0x4a65('0x24')](handleEntityNotFound(_0x3ea753,null))[_0x4a65('0x24')](removeEntity(_0x3ea753,null))['catch'](handleError(_0x3ea753,null));};exports[_0x4a65('0x55')]=function(_0xf829b,_0x38a5d5,_0x472d3c){if(_0xf829b[_0x4a65('0x53')]['id']){delete _0xf829b[_0x4a65('0x53')]['id'];}return db[_0x4a65('0x45')][_0x4a65('0x4a')]({'where':{'id':_0xf829b[_0x4a65('0x54')]['id']}})['then'](handleEntityNotFound(_0x38a5d5,null))[_0x4a65('0x24')](function(_0x498bda){if(_0x498bda){_0xf829b[_0x4a65('0x53')][_0x4a65('0x56')]=_0x498bda['id'];return db['Interval'][_0x4a65('0x4b')](_0xf829b[_0x4a65('0x53')]);}})[_0x4a65('0x24')](respondWithResult(_0x38a5d5,null))[_0x4a65('0x48')](handleError(_0x38a5d5,null));};exports[_0x4a65('0x57')]=function(_0x1e7de5,_0x1e535d,_0x55fa72){var _0x534e50={};var _0xdfda1f={};var _0x282a45;var _0x50bad1;return db[_0x4a65('0x45')]['findOne']({'where':{'id':_0x1e7de5['params']['id']}})[_0x4a65('0x24')](handleEntityNotFound(_0x1e535d,null))[_0x4a65('0x24')](function(_0x2da8b8){if(_0x2da8b8){_0x282a45=_0x2da8b8;_0xdfda1f[_0x4a65('0x30')]=_[_0x4a65('0x33')](db[_0x4a65('0x45')][_0x4a65('0x2d')]);_0xdfda1f[_0x4a65('0x32')]=_['keys'](_0x1e7de5['query']);_0xdfda1f[_0x4a65('0x34')]=_[_0x4a65('0x35')](_0xdfda1f[_0x4a65('0x30')],_0xdfda1f['query']);_0x534e50[_0x4a65('0x36')]=_[_0x4a65('0x35')](_0xdfda1f[_0x4a65('0x30')],qs[_0x4a65('0x37')](_0x1e7de5['query'][_0x4a65('0x37')]));_0x534e50['attributes']=_0x534e50['attributes'][_0x4a65('0x38')]?_0x534e50[_0x4a65('0x36')]:_0xdfda1f['model'];_0x534e50['order']=qs[_0x4a65('0x3c')](_0x1e7de5[_0x4a65('0x32')]['sort']);_0x534e50[_0x4a65('0x3e')]=qs[_0x4a65('0x34')](_['pick'](_0x1e7de5[_0x4a65('0x32')],_0xdfda1f[_0x4a65('0x34')]));if(_0x1e7de5[_0x4a65('0x32')][_0x4a65('0x41')]){_0x534e50['where']=_[_0x4a65('0x3f')](_0x534e50[_0x4a65('0x3e')],{'$or':_[_0x4a65('0x31')](_0x534e50['attributes'],function(_0x24629d){var _0x32869b={};_0x32869b[_0x24629d]={'$like':'%'+_0x1e7de5['query'][_0x4a65('0x41')]+'%'};return _0x32869b;})});}_0x534e50=_[_0x4a65('0x3f')]({},_0x534e50,_0x1e7de5['options']);return _0x282a45['getIntervals'](_0x534e50);}})[_0x4a65('0x24')](function(_0x137751){if(_0x137751){_0x50bad1=_0x137751[_0x4a65('0x38')];if(!_0x1e7de5[_0x4a65('0x32')]['hasOwnProperty'](_0x4a65('0x3a'))){_0x534e50[_0x4a65('0x1b')]=qs[_0x4a65('0x1b')](_0x1e7de5[_0x4a65('0x32')]['limit']);_0x534e50[_0x4a65('0x1a')]=qs[_0x4a65('0x1a')](_0x1e7de5[_0x4a65('0x32')][_0x4a65('0x1a')]);}return _0x282a45[_0x4a65('0x57')](_0x534e50);}})[_0x4a65('0x24')](function(_0x44f789){if(_0x44f789){return _0x44f789?{'count':_0x50bad1,'rows':_0x44f789}:null;}})['then'](respondWithResult(_0x1e535d,null))[_0x4a65('0x48')](handleError(_0x1e535d,null));};exports[_0x4a65('0x58')]=function(_0xaa98ab,_0x4aa394,_0x1a8001){return db[_0x4a65('0x45')]['findOne']({'where':{'id':_0xaa98ab[_0x4a65('0x54')]['id']}})[_0x4a65('0x24')](handleEntityNotFound(_0x4aa394,null))['then'](function(_0x37e928){if(_0x37e928){return db[_0x4a65('0x59')][_0x4a65('0x5a')](function(_0x5682d8){return db[_0x4a65('0x45')][_0x4a65('0x25')]({'where':{'IntervalId':_0xaa98ab[_0x4a65('0x54')]['id']},'transaction':_0x5682d8})[_0x4a65('0x24')](function(_0x1d4f6b){var _0x58b488=_['map'](_0xaa98ab[_0x4a65('0x53')],function(_0x4f5c11){delete _0x4f5c11['id'];_0x4f5c11['IntervalId']=_0xaa98ab[_0x4a65('0x54')]['id'];return _0x4f5c11;});return db[_0x4a65('0x45')][_0x4a65('0x5b')](_0x58b488,{'transaction':_0x5682d8});});})['then'](function(){return db['Interval'][_0x4a65('0x46')]({'where':{'IntervalId':_0xaa98ab[_0x4a65('0x54')]['id']}});});}})['then'](respondWithResult(_0x4aa394,null))[_0x4a65('0x48')](handleError(_0x4aa394,null));}; \ No newline at end of file +var _0x2603=['body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','userProfileId','create','params','addInterval','getIntervals','findOne','addIntervals','sequelize','transaction','IntervalId','bulkCreate','findAll','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','then','destroy','Intervals','UserProfileResource','error','stack','name','send','index','rawAttributes','type','key','map','query','keys','intersection','model','attributes','length','hasOwnProperty','nolimit','sort','where','filters','filter','VIRTUAL','merge','options','Interval','includeAll','rows','catch','show','fields','include','find'];(function(_0x398376,_0x35931b){var _0x35e2fb=function(_0x241437){while(--_0x241437){_0x398376['push'](_0x398376['shift']());}};_0x35e2fb(++_0x35931b);}(_0x2603,0xcb));var _0x3260=function(_0x300860,_0x509371){_0x300860=_0x300860-0x0;var _0x2094ad=_0x2603[_0x300860];return _0x2094ad;};'use strict';var emlformat=require(_0x3260('0x0'));var rimraf=require(_0x3260('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3260('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3260('0x3'));var Mustache=require(_0x3260('0x4'));var util=require(_0x3260('0x5'));var path=require(_0x3260('0x6'));var sox=require(_0x3260('0x7'));var csv=require(_0x3260('0x8'));var ejs=require(_0x3260('0x9'));var fs=require('fs');var fs_extra=require(_0x3260('0xa'));var _=require('lodash');var squel=require(_0x3260('0xb'));var crypto=require(_0x3260('0xc'));var jsforce=require(_0x3260('0xd'));var deskjs=require(_0x3260('0xe'));var toCsv=require(_0x3260('0x8'));var querystring=require(_0x3260('0xf'));var Papa=require(_0x3260('0x10'));var Redis=require(_0x3260('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3260('0x12'));var hardwareService=require(_0x3260('0x13'));var logger=require(_0x3260('0x14'))(_0x3260('0x15'));var utils=require(_0x3260('0x16'));var config=require(_0x3260('0x17'));var licenseUtil=require(_0x3260('0x18'));var db=require(_0x3260('0x19'))['db'];var extensions=require(_0x3260('0x1a'));function respondWithStatusCode(_0x24965b,_0x15ffb2){_0x15ffb2=_0x15ffb2||0xcc;return function(_0x1cfc40){if(_0x1cfc40){return _0x24965b[_0x3260('0x1b')](_0x15ffb2);}return _0x24965b[_0x3260('0x1c')](_0x15ffb2)[_0x3260('0x1d')]();};}function respondWithResult(_0x13a77e,_0x980ed4){_0x980ed4=_0x980ed4||0xc8;return function(_0x4dfeef){if(_0x4dfeef){return _0x13a77e[_0x3260('0x1c')](_0x980ed4)['json'](_0x4dfeef);}};}function respondWithFilteredResult(_0x515b5e,_0x2508d2){return function(_0x16cf1c){if(_0x16cf1c){var _0x3c8fcc=typeof _0x2508d2[_0x3260('0x1e')]===_0x3260('0x1f')&&typeof _0x2508d2['limit']===_0x3260('0x1f');var _0x5ae2f4=_0x16cf1c[_0x3260('0x20')];var _0x59ca1f=_0x3c8fcc?0x0:_0x2508d2[_0x3260('0x1e')];var _0x19dcb2=_0x3c8fcc?_0x16cf1c[_0x3260('0x20')]:_0x2508d2[_0x3260('0x1e')]+_0x2508d2[_0x3260('0x21')];var _0x3fcc74;if(_0x19dcb2>=_0x5ae2f4){_0x19dcb2=_0x5ae2f4;_0x3fcc74=0xc8;}else{_0x3fcc74=0xce;}_0x515b5e['status'](_0x3fcc74);return _0x515b5e[_0x3260('0x22')](_0x3260('0x23'),_0x59ca1f+'-'+_0x19dcb2+'/'+_0x5ae2f4)[_0x3260('0x24')](_0x16cf1c);}return null;};}function patchUpdates(_0x13b0b6){return function(_0x3924d7){try{jsonpatch[_0x3260('0x25')](_0x3924d7,_0x13b0b6,!![]);}catch(_0x52e613){return BPromise['reject'](_0x52e613);}return _0x3924d7[_0x3260('0x26')]();};}function saveUpdates(_0x4dc285,_0x2dea23){return function(_0x424c28){if(_0x424c28){return _0x424c28[_0x3260('0x27')](_0x4dc285)[_0x3260('0x28')](function(_0xbb8074){return _0xbb8074;});}return null;};}function removeEntity(_0x30272b,_0x3c21b2){return function(_0x3eb2f6){if(_0x3eb2f6){return _0x3eb2f6[_0x3260('0x29')]()[_0x3260('0x28')](function(){var _0x238133=_0x3eb2f6['get']({'plain':!![]});var _0x53fee8=_0x3260('0x2a');return db[_0x3260('0x2b')]['destroy']({'where':{'type':_0x53fee8,'resourceId':_0x238133['id']}})[_0x3260('0x28')](function(){return _0x3eb2f6;});})[_0x3260('0x28')](function(){_0x30272b['status'](0xcc)[_0x3260('0x1d')]();});}};}function handleEntityNotFound(_0x412b21,_0x28470f){return function(_0x40cdb2){if(!_0x40cdb2){_0x412b21[_0x3260('0x1b')](0x194);}return _0x40cdb2;};}function handleError(_0x2cbf85,_0x480c50){_0x480c50=_0x480c50||0x1f4;return function(_0x4b9f2e){logger[_0x3260('0x2c')](_0x4b9f2e[_0x3260('0x2d')]);if(_0x4b9f2e[_0x3260('0x2e')]){delete _0x4b9f2e[_0x3260('0x2e')];}_0x2cbf85['status'](_0x480c50)[_0x3260('0x2f')](_0x4b9f2e);};}exports[_0x3260('0x30')]=function(_0x328fb9,_0x159170){var _0x40bd7c={},_0x1ee65b={},_0x1e2582={'count':0x0,'rows':[]};var _0xf9314=_['map'](db['Interval'][_0x3260('0x31')],function(_0x5337f0){return{'name':_0x5337f0['fieldName'],'type':_0x5337f0[_0x3260('0x32')][_0x3260('0x33')]};});_0x1ee65b['model']=_[_0x3260('0x34')](_0xf9314,_0x3260('0x2e'));_0x1ee65b[_0x3260('0x35')]=_[_0x3260('0x36')](_0x328fb9[_0x3260('0x35')]);_0x1ee65b['filters']=_[_0x3260('0x37')](_0x1ee65b[_0x3260('0x38')],_0x1ee65b[_0x3260('0x35')]);_0x40bd7c[_0x3260('0x39')]=_[_0x3260('0x37')](_0x1ee65b[_0x3260('0x38')],qs['fields'](_0x328fb9[_0x3260('0x35')]['fields']));_0x40bd7c[_0x3260('0x39')]=_0x40bd7c['attributes'][_0x3260('0x3a')]?_0x40bd7c[_0x3260('0x39')]:_0x1ee65b[_0x3260('0x38')];if(!_0x328fb9[_0x3260('0x35')][_0x3260('0x3b')](_0x3260('0x3c'))){_0x40bd7c['limit']=qs['limit'](_0x328fb9[_0x3260('0x35')]['limit']);_0x40bd7c[_0x3260('0x1e')]=qs[_0x3260('0x1e')](_0x328fb9[_0x3260('0x35')]['offset']);}_0x40bd7c['order']=qs[_0x3260('0x3d')](_0x328fb9[_0x3260('0x35')][_0x3260('0x3d')]);_0x40bd7c[_0x3260('0x3e')]=qs[_0x3260('0x3f')](_['pick'](_0x328fb9[_0x3260('0x35')],_0x1ee65b[_0x3260('0x3f')]),_0xf9314);if(_0x328fb9[_0x3260('0x35')][_0x3260('0x40')]){_0x40bd7c[_0x3260('0x3e')]=_['merge'](_0x40bd7c['where'],{'$or':_[_0x3260('0x34')](_0xf9314,function(_0x4d96e3){if(_0x4d96e3[_0x3260('0x32')]!==_0x3260('0x41')){var _0x1b2d8e={};_0x1b2d8e[_0x4d96e3[_0x3260('0x2e')]]={'$like':'%'+_0x328fb9['query'][_0x3260('0x40')]+'%'};return _0x1b2d8e;}})});}_0x40bd7c=_[_0x3260('0x42')]({},_0x40bd7c,_0x328fb9[_0x3260('0x43')]);var _0x6d630f={'where':_0x40bd7c[_0x3260('0x3e')]};return db[_0x3260('0x44')][_0x3260('0x20')](_0x6d630f)[_0x3260('0x28')](function(_0x5dd37b){_0x1e2582[_0x3260('0x20')]=_0x5dd37b;if(_0x328fb9[_0x3260('0x35')][_0x3260('0x45')]){_0x40bd7c['include']=[{'all':!![]}];}return db['Interval']['findAll'](_0x40bd7c);})[_0x3260('0x28')](function(_0x182507){_0x1e2582[_0x3260('0x46')]=_0x182507;return _0x1e2582;})[_0x3260('0x28')](respondWithFilteredResult(_0x159170,_0x40bd7c))[_0x3260('0x47')](handleError(_0x159170,null));};exports[_0x3260('0x48')]=function(_0x346f0c,_0x3b7f20){var _0x50e491={'raw':!![],'where':{'id':_0x346f0c['params']['id']}},_0x36869c={};_0x36869c[_0x3260('0x38')]=_[_0x3260('0x36')](db[_0x3260('0x44')]['rawAttributes']);_0x36869c[_0x3260('0x35')]=_[_0x3260('0x36')](_0x346f0c['query']);_0x36869c[_0x3260('0x3f')]=_[_0x3260('0x37')](_0x36869c[_0x3260('0x38')],_0x36869c[_0x3260('0x35')]);_0x50e491[_0x3260('0x39')]=_[_0x3260('0x37')](_0x36869c[_0x3260('0x38')],qs[_0x3260('0x49')](_0x346f0c['query']['fields']));_0x50e491[_0x3260('0x39')]=_0x50e491[_0x3260('0x39')][_0x3260('0x3a')]?_0x50e491[_0x3260('0x39')]:_0x36869c[_0x3260('0x38')];if(_0x346f0c['query'][_0x3260('0x45')]){_0x50e491[_0x3260('0x4a')]=[{'all':!![]}];}_0x50e491=_[_0x3260('0x42')]({},_0x50e491,_0x346f0c['options']);return db[_0x3260('0x44')][_0x3260('0x4b')](_0x50e491)['then'](handleEntityNotFound(_0x3b7f20,null))[_0x3260('0x28')](respondWithResult(_0x3b7f20,null))[_0x3260('0x47')](handleError(_0x3b7f20,null));};exports['create']=function(_0x2608ae,_0x31e891){return db[_0x3260('0x44')]['create'](_0x2608ae[_0x3260('0x4c')],{})[_0x3260('0x28')](function(_0x45f3c0){var _0x521f7c=_0x2608ae['user']['get']({'plain':!![]});if(!_0x521f7c)throw new Error(_0x3260('0x4d'));if(_0x521f7c[_0x3260('0x4e')]===_0x3260('0x4f')){var _0x10e82b=_0x45f3c0[_0x3260('0x50')]({'plain':!![]});var _0x2bb1b5=_0x3260('0x2a');return db['UserProfileSection'][_0x3260('0x4b')]({'where':{'name':_0x2bb1b5,'userProfileId':_0x521f7c[_0x3260('0x51')]},'raw':!![]})[_0x3260('0x28')](function(_0x2e8c08){if(_0x2e8c08&&_0x2e8c08['autoAssociation']===0x0){return db['UserProfileResource'][_0x3260('0x52')]({'name':_0x10e82b[_0x3260('0x2e')],'resourceId':_0x10e82b['id'],'type':_0x2e8c08[_0x3260('0x2e')],'sectionId':_0x2e8c08['id']},{})[_0x3260('0x28')](function(){return _0x45f3c0;});}else{return _0x45f3c0;}})[_0x3260('0x47')](function(_0x191605){logger[_0x3260('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x191605);throw _0x191605;});}return _0x45f3c0;})['then'](respondWithResult(_0x31e891,0xc9))[_0x3260('0x47')](handleError(_0x31e891,null));};exports[_0x3260('0x27')]=function(_0x41b77c,_0x303f4a){if(_0x41b77c[_0x3260('0x4c')]['id']){delete _0x41b77c[_0x3260('0x4c')]['id'];}return db[_0x3260('0x44')][_0x3260('0x4b')]({'where':{'id':_0x41b77c[_0x3260('0x53')]['id']}})[_0x3260('0x28')](handleEntityNotFound(_0x303f4a,null))[_0x3260('0x28')](saveUpdates(_0x41b77c[_0x3260('0x4c')],null))[_0x3260('0x28')](respondWithResult(_0x303f4a,null))[_0x3260('0x47')](handleError(_0x303f4a,null));};exports['destroy']=function(_0x4a524d,_0x2ab82b){return db[_0x3260('0x44')]['find']({'where':{'id':_0x4a524d['params']['id']}})['then'](handleEntityNotFound(_0x2ab82b,null))['then'](removeEntity(_0x2ab82b,null))[_0x3260('0x47')](handleError(_0x2ab82b,null));};exports[_0x3260('0x54')]=function(_0x4cf3a4,_0x3242de,_0x388fb9){if(_0x4cf3a4[_0x3260('0x4c')]['id']){delete _0x4cf3a4[_0x3260('0x4c')]['id'];}return db['Interval'][_0x3260('0x4b')]({'where':{'id':_0x4cf3a4[_0x3260('0x53')]['id']}})['then'](handleEntityNotFound(_0x3242de,null))[_0x3260('0x28')](function(_0x380e55){if(_0x380e55){_0x4cf3a4['body']['IntervalId']=_0x380e55['id'];return db['Interval'][_0x3260('0x52')](_0x4cf3a4[_0x3260('0x4c')]);}})[_0x3260('0x28')](respondWithResult(_0x3242de,null))[_0x3260('0x47')](handleError(_0x3242de,null));};exports[_0x3260('0x55')]=function(_0x24f377,_0x3af34e,_0x12cb96){var _0x306407={};var _0x57cbe2={};var _0x16ec48;var _0x12f7af;return db['Interval'][_0x3260('0x56')]({'where':{'id':_0x24f377[_0x3260('0x53')]['id']}})['then'](handleEntityNotFound(_0x3af34e,null))[_0x3260('0x28')](function(_0x1f1d78){if(_0x1f1d78){_0x16ec48=_0x1f1d78;_0x57cbe2['model']=_['keys'](db['Interval'][_0x3260('0x31')]);_0x57cbe2[_0x3260('0x35')]=_[_0x3260('0x36')](_0x24f377[_0x3260('0x35')]);_0x57cbe2[_0x3260('0x3f')]=_[_0x3260('0x37')](_0x57cbe2[_0x3260('0x38')],_0x57cbe2[_0x3260('0x35')]);_0x306407[_0x3260('0x39')]=_[_0x3260('0x37')](_0x57cbe2[_0x3260('0x38')],qs[_0x3260('0x49')](_0x24f377[_0x3260('0x35')][_0x3260('0x49')]));_0x306407['attributes']=_0x306407[_0x3260('0x39')][_0x3260('0x3a')]?_0x306407[_0x3260('0x39')]:_0x57cbe2[_0x3260('0x38')];_0x306407['order']=qs['sort'](_0x24f377[_0x3260('0x35')][_0x3260('0x3d')]);_0x306407[_0x3260('0x3e')]=qs[_0x3260('0x3f')](_['pick'](_0x24f377[_0x3260('0x35')],_0x57cbe2[_0x3260('0x3f')]));if(_0x24f377[_0x3260('0x35')][_0x3260('0x40')]){_0x306407['where']=_['merge'](_0x306407[_0x3260('0x3e')],{'$or':_[_0x3260('0x34')](_0x306407[_0x3260('0x39')],function(_0x268323){var _0x44fd4f={};_0x44fd4f[_0x268323]={'$like':'%'+_0x24f377[_0x3260('0x35')]['filter']+'%'};return _0x44fd4f;})});}_0x306407=_[_0x3260('0x42')]({},_0x306407,_0x24f377['options']);return _0x16ec48[_0x3260('0x55')](_0x306407);}})[_0x3260('0x28')](function(_0x93ee46){if(_0x93ee46){_0x12f7af=_0x93ee46['length'];if(!_0x24f377[_0x3260('0x35')][_0x3260('0x3b')](_0x3260('0x3c'))){_0x306407['limit']=qs['limit'](_0x24f377[_0x3260('0x35')][_0x3260('0x21')]);_0x306407['offset']=qs[_0x3260('0x1e')](_0x24f377['query']['offset']);}return _0x16ec48[_0x3260('0x55')](_0x306407);}})[_0x3260('0x28')](function(_0x3f8a16){if(_0x3f8a16){return _0x3f8a16?{'count':_0x12f7af,'rows':_0x3f8a16}:null;}})[_0x3260('0x28')](respondWithResult(_0x3af34e,null))[_0x3260('0x47')](handleError(_0x3af34e,null));};exports[_0x3260('0x57')]=function(_0x134f29,_0x357ded,_0xdf785a){return db[_0x3260('0x44')][_0x3260('0x56')]({'where':{'id':_0x134f29[_0x3260('0x53')]['id']}})[_0x3260('0x28')](handleEntityNotFound(_0x357ded,null))[_0x3260('0x28')](function(_0x54b8cb){if(_0x54b8cb){return db[_0x3260('0x58')][_0x3260('0x59')](function(_0x1fc578){return db[_0x3260('0x44')]['destroy']({'where':{'IntervalId':_0x134f29[_0x3260('0x53')]['id']},'transaction':_0x1fc578})[_0x3260('0x28')](function(_0x31a001){var _0xb3bde9=_['map'](_0x134f29['body'],function(_0x233087){delete _0x233087['id'];_0x233087[_0x3260('0x5a')]=_0x134f29[_0x3260('0x53')]['id'];return _0x233087;});return db[_0x3260('0x44')][_0x3260('0x5b')](_0xb3bde9,{'transaction':_0x1fc578});});})[_0x3260('0x28')](function(){return db['Interval'][_0x3260('0x5c')]({'where':{'IntervalId':_0x134f29[_0x3260('0x53')]['id']}});});}})['then'](respondWithResult(_0x357ded,null))[_0x3260('0x47')](handleError(_0x357ded,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 55879c0..a9da626 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 _0xd11f=['../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define','Interval','tools_intervals','rewrite','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x22f0de,_0x1ea327){var _0x318bf3=function(_0x17ec99){while(--_0x17ec99){_0x22f0de['push'](_0x22f0de['shift']());}};_0x318bf3(++_0x1ea327);}(_0xd11f,0x6a));var _0xfd11=function(_0x261e29,_0x10fffd){_0x261e29=_0x261e29-0x0;var _0x25ef43=_0xd11f[_0x261e29];return _0x25ef43;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfd11('0x0'))(_0xfd11('0x1'));var moment=require(_0xfd11('0x2'));var BPromise=require('bluebird');var rp=require(_0xfd11('0x3'));var fs=require('fs');var path=require(_0xfd11('0x4'));var rimraf=require(_0xfd11('0x5'));var config=require(_0xfd11('0x6'));var attributes=require(_0xfd11('0x7'));var extensions=require(_0xfd11('0x8'));module[_0xfd11('0x9')]=function(_0x26ec32,_0x4a7e52){return _0x26ec32[_0xfd11('0xa')](_0xfd11('0xb'),attributes,{'tableName':_0xfd11('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x74725b,_0x167d2c){extensions[_0xfd11('0xd')](_0x26ec32,_0x74725b);},'afterBulkCreate':function(_0x4c89e1,_0x203899,_0x4ec2e7){_0x4ec2e7();extensions['rewrite'](_0x26ec32,_0x4c89e1[0x0]);},'afterUpdate':function(_0x2a8077,_0x4d37e0){extensions[_0xfd11('0xd')](_0x26ec32,_0x2a8077);},'afterDestroy':function(_0x34d998,_0x445e43){extensions[_0xfd11('0xd')](_0x26ec32,_0x34d998);}}});}; \ No newline at end of file +var _0xa2ef=['request-promise','rimraf','../../config/environment','./interval.attributes','exports','define','Interval','rewrite','lodash','util','../../config/logger','api','moment'];(function(_0x490a99,_0x385d34){var _0x5b6a4e=function(_0x1c68da){while(--_0x1c68da){_0x490a99['push'](_0x490a99['shift']());}};_0x5b6a4e(++_0x385d34);}(_0xa2ef,0x119));var _0xfa2e=function(_0x159989,_0x19aab7){_0x159989=_0x159989-0x0;var _0x3be26d=_0xa2ef[_0x159989];return _0x3be26d;};'use strict';var _=require(_0xfa2e('0x0'));var util=require(_0xfa2e('0x1'));var logger=require(_0xfa2e('0x2'))(_0xfa2e('0x3'));var moment=require(_0xfa2e('0x4'));var BPromise=require('bluebird');var rp=require(_0xfa2e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfa2e('0x6'));var config=require(_0xfa2e('0x7'));var attributes=require(_0xfa2e('0x8'));var extensions=require('../../components/extensions/rewrite');module[_0xfa2e('0x9')]=function(_0x3390e3,_0x4ddde8){return _0x3390e3[_0xfa2e('0xa')](_0xfa2e('0xb'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xae2907,_0x17994b){extensions['rewrite'](_0x3390e3,_0xae2907);},'afterBulkCreate':function(_0x433232,_0x449e82,_0xe4778){_0xe4778();extensions[_0xfa2e('0xc')](_0x3390e3,_0x433232[0x0]);},'afterUpdate':function(_0x41ef73,_0x4bb7dd){extensions[_0xfa2e('0xc')](_0x3390e3,_0x41ef73);},'afterDestroy':function(_0xc051b4,_0x4d4e28){extensions[_0xfa2e('0xc')](_0x3390e3,_0xc051b4);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index ce9ce3e..06f0d2c 100644 --- a/server/api/interval/interval.rpc.js +++ b/server/api/interval/interval.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x213518,_0x51e022){var _0x1baf75=function(_0x5c8444){while(--_0x5c8444){_0x213518['push'](_0x213518['shift']());}};_0x1baf75(++_0x51e022);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0xad57ee,_0x2823a6){var _0x3eaea9=function(_0x185650){while(--_0x185650){_0xad57ee['push'](_0xad57ee['shift']());}};_0x3eaea9(++_0x2823a6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 53b2a8c..664246a 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 _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0x55caeb,_0x28a134){var _0x18b040=function(_0x2b1e3e){while(--_0x2b1e3e){_0x55caeb['push'](_0x55caeb['shift']());}};_0x18b040(++_0x28a134);}(_0x2ef3,0xba));var _0x32ef=function(_0x4f2354,_0x143a5a){_0x4f2354=_0x4f2354-0x0;var _0x72da6=_0x2ef3[_0x4f2354];return _0x72da6;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['send']);module[_0x32ef('0x6')]=router; \ No newline at end of file +var _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x41dab5,_0x3d5fc1){var _0x313412=function(_0x37d242){while(--_0x37d242){_0x41dab5['push'](_0x41dab5['shift']());}};_0x313412(++_0x3d5fc1);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2cfcc3,_0x9291bd){_0x2cfcc3=_0x2cfcc3-0x0;var _0xbf9249=_0x5f2f[_0x2cfcc3];return _0xbf9249;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);module[_0xf5f2('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 a6d194a..9eecce8 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 _0x90c4=['newToken','customfield_11503','name','reason','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','request','end','json','error','status','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','description','stringify','issuetype','Bug','fields','email','customfield_11501'];(function(_0x5e6e21,_0x472d40){var _0x1071ea=function(_0x3193e4){while(--_0x3193e4){_0x5e6e21['push'](_0x5e6e21['shift']());}};_0x1071ea(++_0x472d40);}(_0x90c4,0xf1));var _0x490c=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x90c4[_0x2641f9];return _0x585741;};'use strict';var BPromise=require(_0x490c('0x0'));var https=require(_0x490c('0x1'));var logger=require(_0x490c('0x2'))(_0x490c('0x3'));var USERNAME=_0x490c('0x4');var PASSWORD=_0x490c('0x5');function openIssue(_0x579860,_0x61ee8d){var _0x3cff47={'fields':{'project':{'key':_0x579860[_0x490c('0x6')]||_0x490c('0x7')},'summary':(_0x579860[_0x490c('0x8')]||_0x490c('0x9'))+'\x20from\x20'+_0x579860['ip'],'description':_0x579860[_0x490c('0xa')]||JSON[_0x490c('0xb')](_0x579860),'issuetype':{'name':_0x579860[_0x490c('0xc')]||_0x490c('0xd')}}};_0x3cff47[_0x490c('0xe')]['customfield_11500']=_0x579860[_0x490c('0xf')];_0x3cff47['fields'][_0x490c('0x10')]=_0x579860['oldToken'];_0x3cff47[_0x490c('0xe')]['customfield_11502']=_0x579860[_0x490c('0x11')];_0x3cff47[_0x490c('0xe')][_0x490c('0x12')]=_0x579860[_0x490c('0x13')];_0x3cff47['fields']['customfield_11504']=_0x579860[_0x490c('0x14')];_0x3cff47['fields']['customfield_10102']=_0x579860['ip'];var _0x301f68={'host':_0x490c('0x15'),'port':0x1bb,'path':_0x490c('0x16'),'method':_0x490c('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0x490c('0x18'),'Authorization':_0x490c('0x19')+new Buffer(USERNAME+':'+PASSWORD)[_0x490c('0x1a')](_0x490c('0x1b'))}};var _0x448d08=JSON[_0x490c('0xb')](_0x3cff47);var _0x112ef6=https[_0x490c('0x1c')](_0x301f68,function(_0x35c74a){_0x35c74a['setEncoding']('utf8');var _0x4d81f6='';_0x35c74a['on']('data',function(_0x1b174d){_0x4d81f6+=_0x1b174d;});_0x35c74a['on'](_0x490c('0x1d'),function(){if(_0x61ee8d){return _0x61ee8d['status'](_0x35c74a['statusCode'])[_0x490c('0x1e')](JSON['parse'](_0x4d81f6));}});});_0x112ef6['on'](_0x490c('0x1f'),function(_0x39961f){if(_0x61ee8d){return _0x61ee8d[_0x490c('0x20')](0x1f4)[_0x490c('0x1e')]({'errors':[{'message':_0x490c('0x21'),'type':'api.jira'}]});}});_0x112ef6[_0x490c('0x22')](_0x448d08);_0x112ef6[_0x490c('0x1d')]();}exports[_0x490c('0x23')]=openIssue;exports[_0x490c('0x24')]=function(_0x4451e5,_0x59ca1d){_0x4451e5[_0x490c('0x25')]['ip']=_0x4451e5[_0x490c('0x26')][_0x490c('0x27')]||_0x4451e5[_0x490c('0x28')][_0x490c('0x29')]||_0x4451e5[_0x490c('0x2a')]['remoteAddress']||_0x4451e5[_0x490c('0x28')][_0x490c('0x2a')][_0x490c('0x29')];return openIssue(_0x4451e5[_0x490c('0x25')],_0x59ca1d);}; \ No newline at end of file +var _0x1fbf=['openIssue','send','body','headers','connection','remoteAddress','socket','bluebird','../../config/logger','api','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','request','setEncoding','utf8','data','status','error','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','end'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1fbf,0x15e));var _0xf1fb=function(_0x1f1369,_0x49d449){_0x1f1369=_0x1f1369-0x0;var _0x364682=_0x1fbf[_0x1f1369];return _0x364682;};'use strict';var BPromise=require(_0xf1fb('0x0'));var https=require('https');var logger=require(_0xf1fb('0x1'))(_0xf1fb('0x2'));var USERNAME='support';var PASSWORD=_0xf1fb('0x3');function openIssue(_0x4f237c,_0x2aeee7){var _0xc369f2={'fields':{'project':{'key':_0x4f237c[_0xf1fb('0x4')]||_0xf1fb('0x5')},'summary':(_0x4f237c[_0xf1fb('0x6')]||_0xf1fb('0x7'))+_0xf1fb('0x8')+_0x4f237c['ip'],'description':_0x4f237c[_0xf1fb('0x9')]||JSON[_0xf1fb('0xa')](_0x4f237c),'issuetype':{'name':_0x4f237c[_0xf1fb('0xb')]||_0xf1fb('0xc')}}};_0xc369f2[_0xf1fb('0xd')][_0xf1fb('0xe')]=_0x4f237c[_0xf1fb('0xf')];_0xc369f2[_0xf1fb('0xd')][_0xf1fb('0x10')]=_0x4f237c['oldToken'];_0xc369f2[_0xf1fb('0xd')][_0xf1fb('0x11')]=_0x4f237c[_0xf1fb('0x12')];_0xc369f2[_0xf1fb('0xd')][_0xf1fb('0x13')]=_0x4f237c[_0xf1fb('0x14')];_0xc369f2['fields'][_0xf1fb('0x15')]=_0x4f237c[_0xf1fb('0x16')];_0xc369f2['fields'][_0xf1fb('0x17')]=_0x4f237c['ip'];var _0x5b7053={'host':_0xf1fb('0x18'),'port':0x1bb,'path':_0xf1fb('0x19'),'method':_0xf1fb('0x1a'),'timeout':0x4e20,'headers':{'Content-Type':_0xf1fb('0x1b'),'Authorization':_0xf1fb('0x1c')+new Buffer(USERNAME+':'+PASSWORD)[_0xf1fb('0x1d')](_0xf1fb('0x1e'))}};var _0x411c14=JSON[_0xf1fb('0xa')](_0xc369f2);var _0x54e816=https[_0xf1fb('0x1f')](_0x5b7053,function(_0x110239){_0x110239[_0xf1fb('0x20')](_0xf1fb('0x21'));var _0x1d144f='';_0x110239['on'](_0xf1fb('0x22'),function(_0xc2bdbe){_0x1d144f+=_0xc2bdbe;});_0x110239['on']('end',function(){if(_0x2aeee7){return _0x2aeee7[_0xf1fb('0x23')](_0x110239['statusCode'])['json'](JSON['parse'](_0x1d144f));}});});_0x54e816['on'](_0xf1fb('0x24'),function(_0x1a0086){if(_0x2aeee7){return _0x2aeee7[_0xf1fb('0x23')](0x1f4)[_0xf1fb('0x25')]({'errors':[{'message':_0xf1fb('0x26'),'type':_0xf1fb('0x27')}]});}});_0x54e816[_0xf1fb('0x28')](_0x411c14);_0x54e816[_0xf1fb('0x29')]();}exports[_0xf1fb('0x2a')]=openIssue;exports[_0xf1fb('0x2b')]=function(_0x1b27aa,_0x31aeaf){_0x1b27aa[_0xf1fb('0x2c')]['ip']=_0x1b27aa[_0xf1fb('0x2d')]['x-forwarded-for']||_0x1b27aa[_0xf1fb('0x2e')][_0xf1fb('0x2f')]||_0x1b27aa['socket'][_0xf1fb('0x2f')]||_0x1b27aa[_0xf1fb('0x2e')][_0xf1fb('0x30')][_0xf1fb('0x2f')];return openIssue(_0x1b27aa[_0xf1fb('0x2c')],_0x31aeaf);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index a29c6fb..ecf4007 100644 --- a/server/api/jscriptyAnswerReport/index.js +++ b/server/api/jscriptyAnswerReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4483=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','delete'];(function(_0x57014b,_0x360c0f){var _0x2b258a=function(_0x52c4a3){while(--_0x52c4a3){_0x57014b['push'](_0x57014b['shift']());}};_0x2b258a(++_0x360c0f);}(_0x4483,0x1a3));var _0x3448=function(_0x3fa5e5,_0x419741){_0x3fa5e5=_0x3fa5e5-0x0;var _0x4b16a0=_0x4483[_0x3fa5e5];return _0x4b16a0;};'use strict';var multer=require(_0x3448('0x0'));var util=require(_0x3448('0x1'));var path=require(_0x3448('0x2'));var timeout=require('connect-timeout');var express=require(_0x3448('0x3'));var router=express[_0x3448('0x4')]();var fs_extra=require(_0x3448('0x5'));var auth=require(_0x3448('0x6'));var interaction=require(_0x3448('0x7'));var config=require('../../config/environment');var controller=require(_0x3448('0x8'));router[_0x3448('0x9')]('/',auth[_0x3448('0xa')](),controller[_0x3448('0xb')]);router[_0x3448('0x9')](_0x3448('0xc'),auth[_0x3448('0xa')](),controller[_0x3448('0xd')]);router['get']('/:id',auth[_0x3448('0xa')](),controller[_0x3448('0xe')]);router[_0x3448('0xf')]('/',auth[_0x3448('0xa')](),controller[_0x3448('0x10')]);router[_0x3448('0x11')](_0x3448('0x12'),auth[_0x3448('0xa')](),controller[_0x3448('0x13')]);router[_0x3448('0x14')](_0x3448('0x12'),auth['isAuthenticated'](),controller['destroy']);module[_0x3448('0x15')]=router; \ No newline at end of file +var _0x99e9=['update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put'];(function(_0x9d5d54,_0x32fe1d){var _0x769a6f=function(_0x2edf26){while(--_0x2edf26){_0x9d5d54['push'](_0x9d5d54['shift']());}};_0x769a6f(++_0x32fe1d);}(_0x99e9,0xb4));var _0x999e=function(_0x1f16de,_0x548eb9){_0x1f16de=_0x1f16de-0x0;var _0x36cd80=_0x99e9[_0x1f16de];return _0x36cd80;};'use strict';var multer=require('multer');var util=require(_0x999e('0x0'));var path=require(_0x999e('0x1'));var timeout=require(_0x999e('0x2'));var express=require(_0x999e('0x3'));var router=express['Router']();var fs_extra=require(_0x999e('0x4'));var auth=require(_0x999e('0x5'));var interaction=require(_0x999e('0x6'));var config=require('../../config/environment');var controller=require(_0x999e('0x7'));router['get']('/',auth[_0x999e('0x8')](),controller[_0x999e('0x9')]);router[_0x999e('0xa')](_0x999e('0xb'),auth['isAuthenticated'](),controller[_0x999e('0xc')]);router[_0x999e('0xa')](_0x999e('0xd'),auth[_0x999e('0x8')](),controller[_0x999e('0xe')]);router[_0x999e('0xf')]('/',auth[_0x999e('0x8')](),controller[_0x999e('0x10')]);router[_0x999e('0x11')](_0x999e('0xd'),auth[_0x999e('0x8')](),controller[_0x999e('0x12')]);router[_0x999e('0x13')](_0x999e('0xd'),auth[_0x999e('0x8')](),controller[_0x999e('0x14')]);module[_0x999e('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index bad0a95..b26f0e8 100644 --- a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js +++ b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x7a54,0x106));var _0x47a5=function(_0x2f3a42,_0x59db80){_0x2f3a42=_0x2f3a42-0x0;var _0x489b94=_0x7a54[_0x2f3a42];return _0x489b94;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x7a54,0x106));var _0x47a5=function(_0x4f08cf,_0x2a9c34){_0x4f08cf=_0x4f08cf-0x0;var _0x22c228=_0x7a54[_0x4f08cf];return _0x22c228;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 96e9b2e..a33ec71 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 _0x398a=['../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','apply','reject','save','then','sendStatus','error','stack','name','send','index','JscriptyAnswerReport','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x1ff84a,_0x595a52){var _0x2f5d36=function(_0x98777b){while(--_0x98777b){_0x1ff84a['push'](_0x1ff84a['shift']());}};_0x2f5d36(++_0x595a52);}(_0x398a,0x11a));var _0xa398=function(_0x675b56,_0x3961a2){_0x675b56=_0x675b56-0x0;var _0x5267d8=_0x398a[_0x675b56];return _0x5267d8;};'use strict';var emlformat=require(_0xa398('0x0'));var rimraf=require(_0xa398('0x1'));var zipdir=require(_0xa398('0x2'));var jsonpatch=require(_0xa398('0x3'));var rp=require(_0xa398('0x4'));var moment=require(_0xa398('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xa398('0x6'));var sox=require(_0xa398('0x7'));var csv=require(_0xa398('0x8'));var ejs=require(_0xa398('0x9'));var fs=require('fs');var fs_extra=require(_0xa398('0xa'));var _=require(_0xa398('0xb'));var squel=require(_0xa398('0xc'));var crypto=require(_0xa398('0xd'));var jsforce=require(_0xa398('0xe'));var deskjs=require(_0xa398('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa398('0x10'));var Papa=require(_0xa398('0x11'));var Redis=require(_0xa398('0x12'));var authService=require(_0xa398('0x13'));var qs=require(_0xa398('0x14'));var as=require(_0xa398('0x15'));var hardwareService=require(_0xa398('0x16'));var logger=require('../../config/logger')(_0xa398('0x17'));var utils=require(_0xa398('0x18'));var config=require(_0xa398('0x19'));var licenseUtil=require(_0xa398('0x1a'));var db=require(_0xa398('0x1b'))['db'];function respondWithStatusCode(_0x109865,_0x362ef4){_0x362ef4=_0x362ef4||0xcc;return function(_0x1d39d6){if(_0x1d39d6){return _0x109865['sendStatus'](_0x362ef4);}return _0x109865[_0xa398('0x1c')](_0x362ef4)[_0xa398('0x1d')]();};}function respondWithResult(_0x316587,_0x20b340){_0x20b340=_0x20b340||0xc8;return function(_0xb2345f){if(_0xb2345f){return _0x316587[_0xa398('0x1c')](_0x20b340)[_0xa398('0x1e')](_0xb2345f);}};}function respondWithFilteredResult(_0x10bc43,_0x483dbf){return function(_0x264419){if(_0x264419){var _0x1788e5=typeof _0x483dbf['offset']===_0xa398('0x1f')&&typeof _0x483dbf[_0xa398('0x20')]===_0xa398('0x1f');var _0x41edbd=_0x264419[_0xa398('0x21')];var _0x144c1f=_0x1788e5?0x0:_0x483dbf[_0xa398('0x22')];var _0x10fa7f=_0x1788e5?_0x264419[_0xa398('0x21')]:_0x483dbf[_0xa398('0x22')]+_0x483dbf['limit'];var _0x1941c3;if(_0x10fa7f>=_0x41edbd){_0x10fa7f=_0x41edbd;_0x1941c3=0xc8;}else{_0x1941c3=0xce;}_0x10bc43[_0xa398('0x1c')](_0x1941c3);return _0x10bc43['set']('Content-Range',_0x144c1f+'-'+_0x10fa7f+'/'+_0x41edbd)[_0xa398('0x1e')](_0x264419);}return null;};}function patchUpdates(_0x4e21bc){return function(_0x1a3f34){try{jsonpatch[_0xa398('0x23')](_0x1a3f34,_0x4e21bc,!![]);}catch(_0x3ddae2){return BPromise[_0xa398('0x24')](_0x3ddae2);}return _0x1a3f34[_0xa398('0x25')]();};}function saveUpdates(_0x54e08c,_0x46ab19){return function(_0x550e75){if(_0x550e75){return _0x550e75['update'](_0x54e08c)['then'](function(_0x4c92a0){return _0x4c92a0;});}return null;};}function removeEntity(_0x3f6601,_0x11ebc7){return function(_0x1a2b9e){if(_0x1a2b9e){return _0x1a2b9e['destroy']()[_0xa398('0x26')](function(){_0x3f6601[_0xa398('0x1c')](0xcc)[_0xa398('0x1d')]();});}};}function handleEntityNotFound(_0x44692d,_0x47df2a){return function(_0x311a77){if(!_0x311a77){_0x44692d[_0xa398('0x27')](0x194);}return _0x311a77;};}function handleError(_0x4626c1,_0x8db81b){_0x8db81b=_0x8db81b||0x1f4;return function(_0x7d1e04){logger[_0xa398('0x28')](_0x7d1e04[_0xa398('0x29')]);if(_0x7d1e04[_0xa398('0x2a')]){delete _0x7d1e04[_0xa398('0x2a')];}_0x4626c1['status'](_0x8db81b)[_0xa398('0x2b')](_0x7d1e04);};}exports[_0xa398('0x2c')]=function(_0x215ca6,_0x1fd70d){var _0x1cbe2f={},_0x4641e8={},_0x598851={'count':0x0,'rows':[]};var _0x2ad539=_['map'](db[_0xa398('0x2d')]['rawAttributes'],function(_0x3244d5){return{'name':_0x3244d5[_0xa398('0x2e')],'type':_0x3244d5[_0xa398('0x2f')][_0xa398('0x30')]};});_0x4641e8[_0xa398('0x31')]=_[_0xa398('0x32')](_0x2ad539,'name');_0x4641e8[_0xa398('0x33')]=_[_0xa398('0x34')](_0x215ca6[_0xa398('0x33')]);_0x4641e8[_0xa398('0x35')]=_[_0xa398('0x36')](_0x4641e8[_0xa398('0x31')],_0x4641e8[_0xa398('0x33')]);_0x1cbe2f['attributes']=_[_0xa398('0x36')](_0x4641e8[_0xa398('0x31')],qs[_0xa398('0x37')](_0x215ca6[_0xa398('0x33')]['fields']));_0x1cbe2f[_0xa398('0x38')]=_0x1cbe2f[_0xa398('0x38')][_0xa398('0x39')]?_0x1cbe2f['attributes']:_0x4641e8[_0xa398('0x31')];if(!_0x215ca6[_0xa398('0x33')][_0xa398('0x3a')](_0xa398('0x3b'))){_0x1cbe2f[_0xa398('0x20')]=qs[_0xa398('0x20')](_0x215ca6[_0xa398('0x33')]['limit']);_0x1cbe2f[_0xa398('0x22')]=qs['offset'](_0x215ca6[_0xa398('0x33')]['offset']);}_0x1cbe2f['order']=qs['sort'](_0x215ca6['query'][_0xa398('0x3c')]);_0x1cbe2f[_0xa398('0x3d')]=qs[_0xa398('0x35')](_[_0xa398('0x3e')](_0x215ca6[_0xa398('0x33')],_0x4641e8[_0xa398('0x35')]),_0x2ad539);if(_0x215ca6[_0xa398('0x33')][_0xa398('0x3f')]){_0x1cbe2f['where']=_[_0xa398('0x40')](_0x1cbe2f[_0xa398('0x3d')],{'$or':_[_0xa398('0x32')](_0x2ad539,function(_0x8859a8){if(_0x8859a8['type']!==_0xa398('0x41')){var _0x45e84e={};_0x45e84e[_0x8859a8['name']]={'$like':'%'+_0x215ca6[_0xa398('0x33')][_0xa398('0x3f')]+'%'};return _0x45e84e;}})});}_0x1cbe2f=_[_0xa398('0x40')]({},_0x1cbe2f,_0x215ca6[_0xa398('0x42')]);var _0x4bab3a={'where':_0x1cbe2f[_0xa398('0x3d')]};return db[_0xa398('0x2d')][_0xa398('0x21')](_0x4bab3a)['then'](function(_0x2eb748){_0x598851[_0xa398('0x21')]=_0x2eb748;if(_0x215ca6['query'][_0xa398('0x43')]){_0x1cbe2f[_0xa398('0x44')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xa398('0x45')](_0x1cbe2f);})[_0xa398('0x26')](function(_0x31e4bb){_0x598851[_0xa398('0x46')]=_0x31e4bb;return _0x598851;})[_0xa398('0x26')](respondWithFilteredResult(_0x1fd70d,_0x1cbe2f))[_0xa398('0x47')](handleError(_0x1fd70d,null));};exports['show']=function(_0x30e2b1,_0x184feb){var _0x2eb0c6={'raw':!![],'where':{'id':_0x30e2b1[_0xa398('0x48')]['id']}},_0x3f9e95={};_0x3f9e95[_0xa398('0x31')]=_[_0xa398('0x34')](db['JscriptyAnswerReport']['rawAttributes']);_0x3f9e95[_0xa398('0x33')]=_[_0xa398('0x34')](_0x30e2b1[_0xa398('0x33')]);_0x3f9e95[_0xa398('0x35')]=_[_0xa398('0x36')](_0x3f9e95[_0xa398('0x31')],_0x3f9e95['query']);_0x2eb0c6['attributes']=_[_0xa398('0x36')](_0x3f9e95['model'],qs[_0xa398('0x37')](_0x30e2b1['query'][_0xa398('0x37')]));_0x2eb0c6[_0xa398('0x38')]=_0x2eb0c6['attributes'][_0xa398('0x39')]?_0x2eb0c6[_0xa398('0x38')]:_0x3f9e95[_0xa398('0x31')];if(_0x30e2b1[_0xa398('0x33')][_0xa398('0x43')]){_0x2eb0c6[_0xa398('0x44')]=[{'all':!![]}];}_0x2eb0c6=_['merge']({},_0x2eb0c6,_0x30e2b1['options']);return db['JscriptyAnswerReport'][_0xa398('0x49')](_0x2eb0c6)[_0xa398('0x26')](handleEntityNotFound(_0x184feb,null))['then'](respondWithResult(_0x184feb,null))[_0xa398('0x47')](handleError(_0x184feb,null));};exports[_0xa398('0x4a')]=function(_0x28f371,_0x4bda1c){return db[_0xa398('0x2d')][_0xa398('0x4a')](_0x28f371[_0xa398('0x4b')],{})['then'](respondWithResult(_0x4bda1c,0xc9))['catch'](handleError(_0x4bda1c,null));};exports['update']=function(_0x3e7109,_0x530e9e){if(_0x3e7109[_0xa398('0x4b')]['id']){delete _0x3e7109[_0xa398('0x4b')]['id'];}return db[_0xa398('0x2d')][_0xa398('0x49')]({'where':{'id':_0x3e7109['params']['id']}})[_0xa398('0x26')](handleEntityNotFound(_0x530e9e,null))[_0xa398('0x26')](saveUpdates(_0x3e7109[_0xa398('0x4b')],null))['then'](respondWithResult(_0x530e9e,null))['catch'](handleError(_0x530e9e,null));};exports['destroy']=function(_0x414762,_0xb01b2e){return db['JscriptyAnswerReport'][_0xa398('0x49')]({'where':{'id':_0x414762['params']['id']}})[_0xa398('0x26')](handleEntityNotFound(_0xb01b2e,null))[_0xa398('0x26')](removeEntity(_0xb01b2e,null))[_0xa398('0x47')](handleError(_0xb01b2e,null));};exports['describe']=function(_0x1bc740,_0x4da9bb){return db[_0xa398('0x2d')][_0xa398('0x4c')]()[_0xa398('0x26')](respondWithResult(_0x4da9bb,null))[_0xa398('0x47')](handleError(_0x4da9bb,null));}; \ No newline at end of file +var _0x34aa=['apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','JscriptyAnswerReport','fieldName','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','findAll','show','params','rawAttributes','length','include','find','create','body','catch','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','count','offset','limit','set','Content-Range'];(function(_0x772156,_0x5b5faa){var _0x79234b=function(_0x54773f){while(--_0x54773f){_0x772156['push'](_0x772156['shift']());}};_0x79234b(++_0x5b5faa);}(_0x34aa,0x171));var _0xa34a=function(_0xf84870,_0x4dc38f){_0xf84870=_0xf84870-0x0;var _0x4541a4=_0x34aa[_0xf84870];return _0x4541a4;};'use strict';var emlformat=require(_0xa34a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa34a('0x1'));var jsonpatch=require(_0xa34a('0x2'));var rp=require(_0xa34a('0x3'));var moment=require(_0xa34a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa34a('0x5'));var util=require(_0xa34a('0x6'));var path=require(_0xa34a('0x7'));var sox=require(_0xa34a('0x8'));var csv=require(_0xa34a('0x9'));var ejs=require(_0xa34a('0xa'));var fs=require('fs');var fs_extra=require(_0xa34a('0xb'));var _=require(_0xa34a('0xc'));var squel=require(_0xa34a('0xd'));var crypto=require(_0xa34a('0xe'));var jsforce=require(_0xa34a('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa34a('0x9'));var querystring=require(_0xa34a('0x10'));var Papa=require(_0xa34a('0x11'));var Redis=require(_0xa34a('0x12'));var authService=require(_0xa34a('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xa34a('0x14'));var hardwareService=require(_0xa34a('0x15'));var logger=require(_0xa34a('0x16'))(_0xa34a('0x17'));var utils=require(_0xa34a('0x18'));var config=require(_0xa34a('0x19'));var licenseUtil=require(_0xa34a('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3145e9,_0x33e150){_0x33e150=_0x33e150||0xcc;return function(_0x1c2972){if(_0x1c2972){return _0x3145e9['sendStatus'](_0x33e150);}return _0x3145e9[_0xa34a('0x1b')](_0x33e150)[_0xa34a('0x1c')]();};}function respondWithResult(_0x525eff,_0x2f5ded){_0x2f5ded=_0x2f5ded||0xc8;return function(_0x3d5926){if(_0x3d5926){return _0x525eff['status'](_0x2f5ded)[_0xa34a('0x1d')](_0x3d5926);}};}function respondWithFilteredResult(_0x7ac9a2,_0x19580a){return function(_0xfd0d79){if(_0xfd0d79){var _0x41b9bb=typeof _0x19580a['offset']===_0xa34a('0x1e')&&typeof _0x19580a['limit']===_0xa34a('0x1e');var _0x14837d=_0xfd0d79[_0xa34a('0x1f')];var _0x181dcc=_0x41b9bb?0x0:_0x19580a['offset'];var _0x27ad19=_0x41b9bb?_0xfd0d79[_0xa34a('0x1f')]:_0x19580a[_0xa34a('0x20')]+_0x19580a[_0xa34a('0x21')];var _0xaa360e;if(_0x27ad19>=_0x14837d){_0x27ad19=_0x14837d;_0xaa360e=0xc8;}else{_0xaa360e=0xce;}_0x7ac9a2['status'](_0xaa360e);return _0x7ac9a2[_0xa34a('0x22')](_0xa34a('0x23'),_0x181dcc+'-'+_0x27ad19+'/'+_0x14837d)[_0xa34a('0x1d')](_0xfd0d79);}return null;};}function patchUpdates(_0x5a641c){return function(_0x14a18b){try{jsonpatch[_0xa34a('0x24')](_0x14a18b,_0x5a641c,!![]);}catch(_0x36749d){return BPromise[_0xa34a('0x25')](_0x36749d);}return _0x14a18b[_0xa34a('0x26')]();};}function saveUpdates(_0x14e24c,_0x4f9342){return function(_0x28249a){if(_0x28249a){return _0x28249a[_0xa34a('0x27')](_0x14e24c)['then'](function(_0x13135a){return _0x13135a;});}return null;};}function removeEntity(_0x377c4a,_0x746078){return function(_0x254b75){if(_0x254b75){return _0x254b75[_0xa34a('0x28')]()[_0xa34a('0x29')](function(){_0x377c4a[_0xa34a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x351b9e,_0xb314d2){return function(_0x473c15){if(!_0x473c15){_0x351b9e[_0xa34a('0x2a')](0x194);}return _0x473c15;};}function handleError(_0x502b4d,_0x1ab30a){_0x1ab30a=_0x1ab30a||0x1f4;return function(_0x7ecf44){logger[_0xa34a('0x2b')](_0x7ecf44[_0xa34a('0x2c')]);if(_0x7ecf44['name']){delete _0x7ecf44[_0xa34a('0x2d')];}_0x502b4d[_0xa34a('0x1b')](_0x1ab30a)[_0xa34a('0x2e')](_0x7ecf44);};}exports[_0xa34a('0x2f')]=function(_0x48e428,_0x2b03a7){var _0x82350e={},_0x196681={},_0x3d351a={'count':0x0,'rows':[]};var _0x4e08e6=_[_0xa34a('0x30')](db[_0xa34a('0x31')]['rawAttributes'],function(_0x163190){return{'name':_0x163190[_0xa34a('0x32')],'type':_0x163190['type']['key']};});_0x196681[_0xa34a('0x33')]=_[_0xa34a('0x30')](_0x4e08e6,_0xa34a('0x2d'));_0x196681[_0xa34a('0x34')]=_[_0xa34a('0x35')](_0x48e428[_0xa34a('0x34')]);_0x196681['filters']=_[_0xa34a('0x36')](_0x196681[_0xa34a('0x33')],_0x196681['query']);_0x82350e[_0xa34a('0x37')]=_[_0xa34a('0x36')](_0x196681[_0xa34a('0x33')],qs[_0xa34a('0x38')](_0x48e428['query'][_0xa34a('0x38')]));_0x82350e[_0xa34a('0x37')]=_0x82350e[_0xa34a('0x37')]['length']?_0x82350e[_0xa34a('0x37')]:_0x196681[_0xa34a('0x33')];if(!_0x48e428[_0xa34a('0x34')][_0xa34a('0x39')](_0xa34a('0x3a'))){_0x82350e[_0xa34a('0x21')]=qs['limit'](_0x48e428['query']['limit']);_0x82350e[_0xa34a('0x20')]=qs[_0xa34a('0x20')](_0x48e428[_0xa34a('0x34')][_0xa34a('0x20')]);}_0x82350e[_0xa34a('0x3b')]=qs[_0xa34a('0x3c')](_0x48e428['query'][_0xa34a('0x3c')]);_0x82350e[_0xa34a('0x3d')]=qs[_0xa34a('0x3e')](_[_0xa34a('0x3f')](_0x48e428[_0xa34a('0x34')],_0x196681[_0xa34a('0x3e')]),_0x4e08e6);if(_0x48e428['query'][_0xa34a('0x40')]){_0x82350e[_0xa34a('0x3d')]=_['merge'](_0x82350e[_0xa34a('0x3d')],{'$or':_['map'](_0x4e08e6,function(_0x41a4d5){if(_0x41a4d5[_0xa34a('0x41')]!==_0xa34a('0x42')){var _0x3cc290={};_0x3cc290[_0x41a4d5[_0xa34a('0x2d')]]={'$like':'%'+_0x48e428[_0xa34a('0x34')][_0xa34a('0x40')]+'%'};return _0x3cc290;}})});}_0x82350e=_[_0xa34a('0x43')]({},_0x82350e,_0x48e428[_0xa34a('0x44')]);var _0x4a055e={'where':_0x82350e['where']};return db[_0xa34a('0x31')][_0xa34a('0x1f')](_0x4a055e)['then'](function(_0x47766b){_0x3d351a[_0xa34a('0x1f')]=_0x47766b;if(_0x48e428[_0xa34a('0x34')][_0xa34a('0x45')]){_0x82350e['include']=[{'all':!![]}];}return db[_0xa34a('0x31')][_0xa34a('0x46')](_0x82350e);})[_0xa34a('0x29')](function(_0x10960b){_0x3d351a['rows']=_0x10960b;return _0x3d351a;})['then'](respondWithFilteredResult(_0x2b03a7,_0x82350e))['catch'](handleError(_0x2b03a7,null));};exports[_0xa34a('0x47')]=function(_0x54b5ec,_0x6722d5){var _0xa17285={'raw':!![],'where':{'id':_0x54b5ec[_0xa34a('0x48')]['id']}},_0x1be7e4={};_0x1be7e4[_0xa34a('0x33')]=_['keys'](db[_0xa34a('0x31')][_0xa34a('0x49')]);_0x1be7e4[_0xa34a('0x34')]=_[_0xa34a('0x35')](_0x54b5ec[_0xa34a('0x34')]);_0x1be7e4[_0xa34a('0x3e')]=_['intersection'](_0x1be7e4[_0xa34a('0x33')],_0x1be7e4[_0xa34a('0x34')]);_0xa17285[_0xa34a('0x37')]=_[_0xa34a('0x36')](_0x1be7e4[_0xa34a('0x33')],qs[_0xa34a('0x38')](_0x54b5ec['query'][_0xa34a('0x38')]));_0xa17285['attributes']=_0xa17285[_0xa34a('0x37')][_0xa34a('0x4a')]?_0xa17285[_0xa34a('0x37')]:_0x1be7e4['model'];if(_0x54b5ec[_0xa34a('0x34')]['includeAll']){_0xa17285[_0xa34a('0x4b')]=[{'all':!![]}];}_0xa17285=_['merge']({},_0xa17285,_0x54b5ec[_0xa34a('0x44')]);return db[_0xa34a('0x31')][_0xa34a('0x4c')](_0xa17285)[_0xa34a('0x29')](handleEntityNotFound(_0x6722d5,null))[_0xa34a('0x29')](respondWithResult(_0x6722d5,null))['catch'](handleError(_0x6722d5,null));};exports[_0xa34a('0x4d')]=function(_0x50b05a,_0x87b76d){return db[_0xa34a('0x31')][_0xa34a('0x4d')](_0x50b05a[_0xa34a('0x4e')],{})[_0xa34a('0x29')](respondWithResult(_0x87b76d,0xc9))[_0xa34a('0x4f')](handleError(_0x87b76d,null));};exports[_0xa34a('0x27')]=function(_0xde8a7,_0x4be0d0){if(_0xde8a7[_0xa34a('0x4e')]['id']){delete _0xde8a7['body']['id'];}return db['JscriptyAnswerReport']['find']({'where':{'id':_0xde8a7[_0xa34a('0x48')]['id']}})['then'](handleEntityNotFound(_0x4be0d0,null))[_0xa34a('0x29')](saveUpdates(_0xde8a7[_0xa34a('0x4e')],null))['then'](respondWithResult(_0x4be0d0,null))[_0xa34a('0x4f')](handleError(_0x4be0d0,null));};exports['destroy']=function(_0x262803,_0xa7cbc4){return db[_0xa34a('0x31')][_0xa34a('0x4c')]({'where':{'id':_0x262803['params']['id']}})['then'](handleEntityNotFound(_0xa7cbc4,null))[_0xa34a('0x29')](removeEntity(_0xa7cbc4,null))[_0xa34a('0x4f')](handleError(_0xa7cbc4,null));};exports[_0xa34a('0x50')]=function(_0x1a9468,_0x44ab8){return db[_0xa34a('0x31')][_0xa34a('0x50')]()[_0xa34a('0x29')](respondWithResult(_0x44ab8,null))[_0xa34a('0x4f')](handleError(_0x44ab8,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index e30117f..89b548a 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 _0x5881=['rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','lodash','util','moment','bluebird','path'];(function(_0x25d4b1,_0x4e896d){var _0x2d51a5=function(_0x9c766){while(--_0x9c766){_0x25d4b1['push'](_0x25d4b1['shift']());}};_0x2d51a5(++_0x4e896d);}(_0x5881,0xc1));var _0x1588=function(_0x162690,_0x243d92){_0x162690=_0x162690-0x0;var _0x53b86e=_0x5881[_0x162690];return _0x53b86e;};'use strict';var _=require(_0x1588('0x0'));var util=require(_0x1588('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1588('0x2'));var BPromise=require(_0x1588('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1588('0x4'));var rimraf=require(_0x1588('0x5'));var config=require(_0x1588('0x6'));var attributes=require(_0x1588('0x7'));module[_0x1588('0x8')]=function(_0x1367b0,_0x561a5e){return _0x1367b0[_0x1588('0x9')](_0x1588('0xa'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b8e=['moment','bluebird','request-promise','rimraf','exports','define','JscriptyAnswerReport','api'];(function(_0x53cf89,_0x437980){var _0x4928de=function(_0x24c7b9){while(--_0x24c7b9){_0x53cf89['push'](_0x53cf89['shift']());}};_0x4928de(++_0x437980);}(_0x4b8e,0x11f));var _0xe4b8=function(_0x2f66fe,_0x46be8b){_0x2f66fe=_0x2f66fe-0x0;var _0x1a1d22=_0x4b8e[_0x2f66fe];return _0x1a1d22;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xe4b8('0x0'));var moment=require(_0xe4b8('0x1'));var BPromise=require(_0xe4b8('0x2'));var rp=require(_0xe4b8('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe4b8('0x4'));var config=require('../../config/environment');var attributes=require('./jscriptyAnswerReport.attributes');module[_0xe4b8('0x5')]=function(_0x7990ef,_0x16a5cf){return _0x7990ef[_0xe4b8('0x6')](_0xe4b8('0x7'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index c1c2f12..4a4e658 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 _0xe233=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','JscriptyAnswerReport,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xab92b5,_0x184d79){var _0x3a758c=function(_0x3eae35){while(--_0x3eae35){_0xab92b5['push'](_0xab92b5['shift']());}};_0x3a758c(++_0x184d79);}(_0xe233,0x13b));var _0x3e23=function(_0x2c41b9,_0x3e8305){_0x2c41b9=_0x2c41b9-0x0;var _0x52e0a5=_0xe233[_0x2c41b9];return _0x52e0a5;};'use strict';var _=require(_0x3e23('0x0'));var util=require(_0x3e23('0x1'));var moment=require(_0x3e23('0x2'));var BPromise=require(_0x3e23('0x3'));var rs=require(_0x3e23('0x4'));var fs=require('fs');var Redis=require(_0x3e23('0x5'));var db=require(_0x3e23('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3e23('0x7'));var config=require(_0x3e23('0x8'));var jayson=require(_0x3e23('0x9'));var client=jayson[_0x3e23('0xa')][_0x3e23('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x290a3c,_0x2f4a58,_0x4d0da9){return new BPromise(function(_0x339ea2,_0x21c802){return client[_0x3e23('0xc')](_0x290a3c,_0x4d0da9)[_0x3e23('0xd')](function(_0x39bca9){logger[_0x3e23('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x2f4a58,_0x3e23('0xf'));logger[_0x3e23('0x10')](_0x3e23('0x11'),_0x2f4a58,_0x3e23('0xf'),JSON[_0x3e23('0x12')](_0x39bca9));if(_0x39bca9[_0x3e23('0x13')]){if(_0x39bca9['error']['code']===0x1f4){logger['error'](_0x3e23('0x14'),_0x2f4a58,_0x39bca9[_0x3e23('0x13')][_0x3e23('0x15')]);return _0x21c802(_0x39bca9[_0x3e23('0x13')]['message']);}logger['error'](_0x3e23('0x14'),_0x2f4a58,_0x39bca9[_0x3e23('0x13')]['message']);return _0x339ea2(_0x39bca9[_0x3e23('0x13')][_0x3e23('0x15')]);}else{logger[_0x3e23('0xe')](_0x3e23('0x14'),_0x2f4a58,_0x3e23('0xf'));_0x339ea2(_0x39bca9[_0x3e23('0x16')][_0x3e23('0x15')]);}})['catch'](function(_0x334202){logger[_0x3e23('0x13')](_0x3e23('0x14'),_0x2f4a58,_0x334202);_0x21c802(_0x334202);});});} \ No newline at end of file +var _0xd43a=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment'];(function(_0x413aac,_0x5e2430){var _0x569b11=function(_0x52e060){while(--_0x52e060){_0x413aac['push'](_0x413aac['shift']());}};_0x569b11(++_0x5e2430);}(_0xd43a,0x18d));var _0xad43=function(_0xcd19e,_0x4d4fc8){_0xcd19e=_0xcd19e-0x0;var _0x54faa2=_0xd43a[_0xcd19e];return _0x54faa2;};'use strict';var _=require(_0xad43('0x0'));var util=require('util');var moment=require(_0xad43('0x1'));var BPromise=require(_0xad43('0x2'));var rs=require(_0xad43('0x3'));var fs=require('fs');var Redis=require(_0xad43('0x4'));var db=require(_0xad43('0x5'))['db'];var utils=require(_0xad43('0x6'));var logger=require('../../config/logger')(_0xad43('0x7'));var config=require(_0xad43('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xad43('0x9')][_0xad43('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x315aa6,_0x6332da,_0x33c69c){return new BPromise(function(_0x52235e,_0x366d0e){return client['request'](_0x315aa6,_0x33c69c)['then'](function(_0x2b29db){logger[_0xad43('0xb')](_0xad43('0xc'),_0x6332da,_0xad43('0xd'));logger[_0xad43('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x6332da,'request\x20sent',JSON[_0xad43('0xf')](_0x2b29db));if(_0x2b29db[_0xad43('0x10')]){if(_0x2b29db[_0xad43('0x10')][_0xad43('0x11')]===0x1f4){logger['error'](_0xad43('0xc'),_0x6332da,_0x2b29db[_0xad43('0x10')][_0xad43('0x12')]);return _0x366d0e(_0x2b29db['error']['message']);}logger[_0xad43('0x10')](_0xad43('0xc'),_0x6332da,_0x2b29db[_0xad43('0x10')][_0xad43('0x12')]);return _0x52235e(_0x2b29db[_0xad43('0x10')][_0xad43('0x12')]);}else{logger[_0xad43('0xb')](_0xad43('0xc'),_0x6332da,_0xad43('0xd'));_0x52235e(_0x2b29db[_0xad43('0x13')][_0xad43('0x12')]);}})[_0xad43('0x14')](function(_0x3e820d){logger[_0xad43('0x10')](_0xad43('0xc'),_0x6332da,_0x3e820d);_0x366d0e(_0x3e820d);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index e29f70b..294b63c 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 _0x9bda=['getAnswers','30s','getSummary','post','/:id/clone','clone','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','isAuthenticated','index','get','/:id','show','/:id/sessions','getSessions','/:id/answers'];(function(_0x5050db,_0x24f1e2){var _0x1cc9aa=function(_0x52c405){while(--_0x52c405){_0x5050db['push'](_0x5050db['shift']());}};_0x1cc9aa(++_0x24f1e2);}(_0x9bda,0xc8));var _0xa9bd=function(_0x3d9557,_0x5d09d2){_0x3d9557=_0x3d9557-0x0;var _0x359ff8=_0x9bda[_0x3d9557];return _0x359ff8;};'use strict';var multer=require(_0xa9bd('0x0'));var util=require('util');var path=require(_0xa9bd('0x1'));var timeout=require('connect-timeout');var express=require(_0xa9bd('0x2'));var router=express[_0xa9bd('0x3')]();var fs_extra=require(_0xa9bd('0x4'));var auth=require(_0xa9bd('0x5'));var interaction=require(_0xa9bd('0x6'));var config=require('../../config/environment');var controller=require(_0xa9bd('0x7'));router['get']('/',auth[_0xa9bd('0x8')](),controller[_0xa9bd('0x9')]);router[_0xa9bd('0xa')](_0xa9bd('0xb'),auth[_0xa9bd('0x8')](),controller[_0xa9bd('0xc')]);router[_0xa9bd('0xa')](_0xa9bd('0xd'),auth['isAuthenticated'](),controller[_0xa9bd('0xe')]);router['get'](_0xa9bd('0xf'),auth['isAuthenticated'](),controller[_0xa9bd('0x10')]);router[_0xa9bd('0xa')]('/:id/summary',auth[_0xa9bd('0x8')](),timeout(_0xa9bd('0x11')),controller[_0xa9bd('0x12')]);router[_0xa9bd('0x13')]('/',auth[_0xa9bd('0x8')](),controller['create']);router['post'](_0xa9bd('0x14'),auth[_0xa9bd('0x8')](),controller[_0xa9bd('0x15')]);router['put'](_0xa9bd('0xb'),auth[_0xa9bd('0x8')](),controller['update']);router[_0xa9bd('0x16')](_0xa9bd('0xb'),auth['isAuthenticated'](),controller[_0xa9bd('0x17')]);module['exports']=router; \ No newline at end of file +var _0x045d=['/:id','show','/:id/sessions','getAnswers','/:id/summary','30s','getSummary','post','create','clone','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./jscriptyProject.controller','get','isAuthenticated','index'];(function(_0x386c3e,_0x44a375){var _0x4b8e13=function(_0x583c8f){while(--_0x583c8f){_0x386c3e['push'](_0x386c3e['shift']());}};_0x4b8e13(++_0x44a375);}(_0x045d,0xe6));var _0xd045=function(_0x207ab,_0x4def14){_0x207ab=_0x207ab-0x0;var _0x4da977=_0x045d[_0x207ab];return _0x4da977;};'use strict';var multer=require('multer');var util=require(_0xd045('0x0'));var path=require(_0xd045('0x1'));var timeout=require(_0xd045('0x2'));var express=require('express');var router=express[_0xd045('0x3')]();var fs_extra=require(_0xd045('0x4'));var auth=require(_0xd045('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd045('0x6'));router[_0xd045('0x7')]('/',auth[_0xd045('0x8')](),controller[_0xd045('0x9')]);router[_0xd045('0x7')](_0xd045('0xa'),auth[_0xd045('0x8')](),controller[_0xd045('0xb')]);router[_0xd045('0x7')](_0xd045('0xc'),auth[_0xd045('0x8')](),controller['getSessions']);router[_0xd045('0x7')]('/:id/answers',auth['isAuthenticated'](),controller[_0xd045('0xd')]);router[_0xd045('0x7')](_0xd045('0xe'),auth[_0xd045('0x8')](),timeout(_0xd045('0xf')),controller[_0xd045('0x10')]);router[_0xd045('0x11')]('/',auth[_0xd045('0x8')](),controller[_0xd045('0x12')]);router['post']('/:id/clone',auth[_0xd045('0x8')](),controller[_0xd045('0x13')]);router['put']('/:id',auth[_0xd045('0x8')](),controller[_0xd045('0x14')]);router[_0xd045('0x15')](_0xd045('0xa'),auth[_0xd045('0x8')](),controller[_0xd045('0x16')]);module[_0xd045('0x17')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 9cafb4e..1538eda 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 _0xddfe=['sequelize','lodash','util','name','STRING','TEXT','isObjectLike','setDataValue','formData','stringify','isString','format','getDataValue','description','BOOLEAN'];(function(_0xee209,_0x4858f4){var _0x48cd8c=function(_0x5e3eda){while(--_0x5e3eda){_0xee209['push'](_0xee209['shift']());}};_0x48cd8c(++_0x4858f4);}(_0xddfe,0x168));var _0xeddf=function(_0x27aa67,_0x1c3da9){_0x27aa67=_0x27aa67-0x0;var _0x54e851=_0xddfe[_0x27aa67];return _0x54e851;};'use strict';var Sequelize=require(_0xeddf('0x0'));var _=require(_0xeddf('0x1'));var util=require(_0xeddf('0x2'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xeddf('0x3')},'description':{'type':Sequelize[_0xeddf('0x4')]},'formData':{'type':Sequelize[_0xeddf('0x5')]('long'),'set':function(_0x4c53f9){if(_[_0xeddf('0x6')](_0x4c53f9)){this[_0xeddf('0x7')](_0xeddf('0x8'),JSON[_0xeddf('0x9')](_0x4c53f9));}else if(_[_0xeddf('0xa')](_0x4c53f9)){this[_0xeddf('0x7')](_0xeddf('0x8'),_0x4c53f9);}else{this[_0xeddf('0x7')]('formData',util[_0xeddf('0xb')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0xeddf('0xc')](_0xeddf('0x3'))||'',this[_0xeddf('0xc')](_0xeddf('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xeddf('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xeddf('0xe')],'defaultValue':![]}}; \ No newline at end of file +var _0xb892=['STRING','name','TEXT','long','isObjectLike','setDataValue','formData','isString','format','getDataValue','description','BOOLEAN','sequelize','util','exports'];(function(_0x2a96b2,_0x2002f5){var _0xd96b1f=function(_0x280a19){while(--_0x280a19){_0x2a96b2['push'](_0x2a96b2['shift']());}};_0xd96b1f(++_0x2002f5);}(_0xb892,0x192));var _0x2b89=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xb892[_0x199572];return _0x13cfa3;};'use strict';var Sequelize=require(_0x2b89('0x0'));var _=require('lodash');var util=require(_0x2b89('0x1'));module[_0x2b89('0x2')]={'name':{'type':Sequelize[_0x2b89('0x3')],'unique':_0x2b89('0x4')},'description':{'type':Sequelize[_0x2b89('0x3')]},'formData':{'type':Sequelize[_0x2b89('0x5')](_0x2b89('0x6')),'set':function(_0x5bad12){if(_[_0x2b89('0x7')](_0x5bad12)){this[_0x2b89('0x8')](_0x2b89('0x9'),JSON['stringify'](_0x5bad12));}else if(_[_0x2b89('0xa')](_0x5bad12)){this['setDataValue'](_0x2b89('0x9'),_0x5bad12);}else{this['setDataValue'](_0x2b89('0x9'),util[_0x2b89('0xb')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this['getDataValue'](_0x2b89('0x4'))||'',this[_0x2b89('0xc')](_0x2b89('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x2b89('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x2b89('0xe')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 1d3ff7b..0722e44 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 _0x87a2=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','destroy','then','get','Projects','UserProfileResource','sendStatus','error','stack','name','send','index','JscriptyProject','rawAttributes','fieldName','type','model','map','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','options','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','create','clone','omit','createdAt','updatedAt','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getSessions','findOne','JscriptySessionReport','pick','ProjectId','getAnswers','JscriptyAnswerReport','toString','indexOf','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','push','isEmpty','now','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','querystring','papaparse'];(function(_0x484ee5,_0x4add36){var _0x44686b=function(_0x4f127a){while(--_0x4f127a){_0x484ee5['push'](_0x484ee5['shift']());}};_0x44686b(++_0x4add36);}(_0x87a2,0x14a));var _0x287a=function(_0xea343d,_0x311197){_0xea343d=_0xea343d-0x0;var _0x2c6e9c=_0x87a2[_0xea343d];return _0x2c6e9c;};'use strict';var emlformat=require(_0x287a('0x0'));var rimraf=require(_0x287a('0x1'));var zipdir=require(_0x287a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x287a('0x3'));var moment=require(_0x287a('0x4'));var BPromise=require(_0x287a('0x5'));var Mustache=require(_0x287a('0x6'));var util=require(_0x287a('0x7'));var path=require(_0x287a('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x287a('0x9'));var _=require(_0x287a('0xa'));var squel=require(_0x287a('0xb'));var crypto=require(_0x287a('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x287a('0xd'));var Papa=require(_0x287a('0xe'));var Redis=require(_0x287a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x287a('0x10'));var as=require(_0x287a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x287a('0x12'))(_0x287a('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x287a('0x14'));var db=require(_0x287a('0x15'))['db'];function respondWithStatusCode(_0x25a993,_0x49ffd5){_0x49ffd5=_0x49ffd5||0xcc;return function(_0x4e3106){if(_0x4e3106){return _0x25a993['sendStatus'](_0x49ffd5);}return _0x25a993[_0x287a('0x16')](_0x49ffd5)[_0x287a('0x17')]();};}function respondWithResult(_0x14b8ad,_0x2bcdbc){_0x2bcdbc=_0x2bcdbc||0xc8;return function(_0x5dd341){if(_0x5dd341){return _0x14b8ad[_0x287a('0x16')](_0x2bcdbc)[_0x287a('0x18')](_0x5dd341);}};}function respondWithFilteredResult(_0x17cc58,_0x357bf8){return function(_0x190ae8){if(_0x190ae8){var _0x2938ba=typeof _0x357bf8['offset']===_0x287a('0x19')&&typeof _0x357bf8[_0x287a('0x1a')]===_0x287a('0x19');var _0x413e55=_0x190ae8[_0x287a('0x1b')];var _0x5b28b7=_0x2938ba?0x0:_0x357bf8[_0x287a('0x1c')];var _0x302dd0=_0x2938ba?_0x190ae8[_0x287a('0x1b')]:_0x357bf8['offset']+_0x357bf8['limit'];var _0x56c8f;if(_0x302dd0>=_0x413e55){_0x302dd0=_0x413e55;_0x56c8f=0xc8;}else{_0x56c8f=0xce;}_0x17cc58[_0x287a('0x16')](_0x56c8f);return _0x17cc58['set'](_0x287a('0x1d'),_0x5b28b7+'-'+_0x302dd0+'/'+_0x413e55)[_0x287a('0x18')](_0x190ae8);}return null;};}function patchUpdates(_0x25c7ec){return function(_0x524b65){try{jsonpatch[_0x287a('0x1e')](_0x524b65,_0x25c7ec,!![]);}catch(_0x44399f){return BPromise[_0x287a('0x1f')](_0x44399f);}return _0x524b65[_0x287a('0x20')]();};}function saveUpdates(_0x38f3c2,_0x119a7a){return function(_0x1d1012){if(_0x1d1012){return _0x1d1012[_0x287a('0x21')](_0x38f3c2)['then'](function(_0x51b279){return _0x51b279;});}return null;};}function removeEntity(_0x504661,_0x4fb336){return function(_0x422774){if(_0x422774){return _0x422774[_0x287a('0x22')]()[_0x287a('0x23')](function(){var _0x257039=_0x422774[_0x287a('0x24')]({'plain':!![]});var _0x31a0aa=_0x287a('0x25');return db[_0x287a('0x26')][_0x287a('0x22')]({'where':{'type':_0x31a0aa,'resourceId':_0x257039['id']}})[_0x287a('0x23')](function(){return _0x422774;});})[_0x287a('0x23')](function(){_0x504661[_0x287a('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa55472,_0x41f35b){return function(_0x1658e6){if(!_0x1658e6){_0xa55472[_0x287a('0x27')](0x194);}return _0x1658e6;};}function handleError(_0x28f767,_0x2c1bc5){_0x2c1bc5=_0x2c1bc5||0x1f4;return function(_0x5bddb2){logger[_0x287a('0x28')](_0x5bddb2[_0x287a('0x29')]);if(_0x5bddb2[_0x287a('0x2a')]){delete _0x5bddb2[_0x287a('0x2a')];}_0x28f767[_0x287a('0x16')](_0x2c1bc5)[_0x287a('0x2b')](_0x5bddb2);};}exports[_0x287a('0x2c')]=function(_0x244ca9,_0x524c72){var _0x3653f4={},_0x5e4474={},_0x36c72c={'count':0x0,'rows':[]};var _0x37b945=_['map'](db[_0x287a('0x2d')][_0x287a('0x2e')],function(_0x4f4e98){return{'name':_0x4f4e98[_0x287a('0x2f')],'type':_0x4f4e98[_0x287a('0x30')]['key']};});_0x5e4474[_0x287a('0x31')]=_[_0x287a('0x32')](_0x37b945,_0x287a('0x2a'));_0x5e4474['query']=_[_0x287a('0x33')](_0x244ca9['query']);_0x5e4474['filters']=_[_0x287a('0x34')](_0x5e4474[_0x287a('0x31')],_0x5e4474[_0x287a('0x35')]);_0x3653f4[_0x287a('0x36')]=_['intersection'](_0x5e4474[_0x287a('0x31')],qs[_0x287a('0x37')](_0x244ca9[_0x287a('0x35')][_0x287a('0x37')]));_0x3653f4[_0x287a('0x36')]=_0x3653f4[_0x287a('0x36')][_0x287a('0x38')]?_0x3653f4[_0x287a('0x36')]:_0x5e4474[_0x287a('0x31')];if(!_0x244ca9['query'][_0x287a('0x39')](_0x287a('0x3a'))){_0x3653f4[_0x287a('0x1a')]=qs[_0x287a('0x1a')](_0x244ca9['query'][_0x287a('0x1a')]);_0x3653f4[_0x287a('0x1c')]=qs['offset'](_0x244ca9['query'][_0x287a('0x1c')]);}_0x3653f4[_0x287a('0x3b')]=qs['sort'](_0x244ca9[_0x287a('0x35')][_0x287a('0x3c')]);_0x3653f4['where']=qs['filters'](_['pick'](_0x244ca9['query'],_0x5e4474[_0x287a('0x3d')]),_0x37b945);if(_0x244ca9['query']['filter']){_0x3653f4[_0x287a('0x3e')]=_[_0x287a('0x3f')](_0x3653f4[_0x287a('0x3e')],{'$or':_['map'](_0x37b945,function(_0x4e41b2){if(_0x4e41b2[_0x287a('0x30')]!==_0x287a('0x40')){var _0x428fd6={};_0x428fd6[_0x4e41b2['name']]={'$like':'%'+_0x244ca9['query'][_0x287a('0x41')]+'%'};return _0x428fd6;}})});}_0x3653f4=_[_0x287a('0x3f')]({},_0x3653f4,_0x244ca9['options']);var _0xe4f08b={'where':_0x3653f4[_0x287a('0x3e')]};return db[_0x287a('0x2d')]['count'](_0xe4f08b)['then'](function(_0x140535){_0x36c72c[_0x287a('0x1b')]=_0x140535;if(_0x244ca9[_0x287a('0x35')][_0x287a('0x42')]){_0x3653f4[_0x287a('0x43')]=[{'all':!![]}];}return db[_0x287a('0x2d')][_0x287a('0x44')](_0x3653f4);})[_0x287a('0x23')](function(_0x2858d3){_0x36c72c[_0x287a('0x45')]=_0x2858d3;return _0x36c72c;})[_0x287a('0x23')](respondWithFilteredResult(_0x524c72,_0x3653f4))[_0x287a('0x46')](handleError(_0x524c72,null));};exports[_0x287a('0x47')]=function(_0x488512,_0x5c182f){var _0x1cd8a0={'raw':![],'where':{'id':_0x488512[_0x287a('0x48')]['id']}},_0x967c9e={};_0x967c9e[_0x287a('0x31')]=_[_0x287a('0x33')](db['JscriptyProject'][_0x287a('0x2e')]);_0x967c9e[_0x287a('0x35')]=_[_0x287a('0x33')](_0x488512[_0x287a('0x35')]);_0x967c9e[_0x287a('0x3d')]=_[_0x287a('0x34')](_0x967c9e[_0x287a('0x31')],_0x967c9e['query']);_0x1cd8a0['attributes']=_['intersection'](_0x967c9e[_0x287a('0x31')],qs[_0x287a('0x37')](_0x488512[_0x287a('0x35')][_0x287a('0x37')]));_0x1cd8a0[_0x287a('0x36')]=_0x1cd8a0['attributes']['length']?_0x1cd8a0['attributes']:_0x967c9e[_0x287a('0x31')];if(_0x488512[_0x287a('0x35')][_0x287a('0x42')]){_0x1cd8a0['include']=[{'all':!![]}];}_0x1cd8a0=_[_0x287a('0x3f')]({},_0x1cd8a0,_0x488512[_0x287a('0x49')]);return db[_0x287a('0x2d')]['find'](_0x1cd8a0)[_0x287a('0x23')](handleEntityNotFound(_0x5c182f,null))[_0x287a('0x23')](respondWithResult(_0x5c182f,null))[_0x287a('0x46')](handleError(_0x5c182f,null));};exports['create']=function(_0x3378ab,_0x1bb029){return db[_0x287a('0x2d')]['create'](_0x3378ab[_0x287a('0x4a')],{})[_0x287a('0x23')](function(_0x587720){var _0x4c9b06=_0x3378ab['user']['get']({'plain':!![]});if(!_0x4c9b06)throw new Error(_0x287a('0x4b'));if(_0x4c9b06['role']==='user'){var _0x5e9022=_0x587720[_0x287a('0x24')]({'plain':!![]});var _0x5dc5ad=_0x287a('0x25');return db[_0x287a('0x4c')][_0x287a('0x4d')]({'where':{'name':_0x5dc5ad,'userProfileId':_0x4c9b06['userProfileId']},'raw':!![]})[_0x287a('0x23')](function(_0x43e134){if(_0x43e134&&_0x43e134[_0x287a('0x4e')]===0x0){return db[_0x287a('0x26')][_0x287a('0x4f')]({'name':_0x5e9022[_0x287a('0x2a')],'resourceId':_0x5e9022['id'],'type':_0x43e134[_0x287a('0x2a')],'sectionId':_0x43e134['id']},{})[_0x287a('0x23')](function(){return _0x587720;});}else{return _0x587720;}})[_0x287a('0x46')](function(_0x22faa6){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x22faa6);throw _0x22faa6;});}return _0x587720;})[_0x287a('0x23')](respondWithResult(_0x1bb029,0xc9))[_0x287a('0x46')](handleError(_0x1bb029,null));};exports[_0x287a('0x50')]=function(_0x1ac92e,_0x5094a7){var _0x4356f8={'where':{'id':_0x1ac92e[_0x287a('0x48')]['id']}},_0x382e56={};_0x382e56[_0x287a('0x31')]=_['keys'](db[_0x287a('0x2d')][_0x287a('0x2e')]);_0x4356f8[_0x287a('0x36')]=_[_0x287a('0x34')](_0x382e56['model'],qs[_0x287a('0x37')](_0x1ac92e['query'][_0x287a('0x37')]));_0x4356f8[_0x287a('0x36')]=_0x4356f8[_0x287a('0x36')]['length']?_0x4356f8[_0x287a('0x36')]:_0x382e56['model'];if(_0x1ac92e[_0x287a('0x35')]['includeAll']){_0x4356f8[_0x287a('0x43')]=[{'all':!![]}];}_0x4356f8=_[_0x287a('0x3f')]({},_0x4356f8,_0x1ac92e[_0x287a('0x49')]);return db[_0x287a('0x2d')][_0x287a('0x4d')](_0x4356f8)[_0x287a('0x23')](handleEntityNotFound(_0x5094a7,null))[_0x287a('0x23')](function(_0x2480b1){if(_0x2480b1){var _0x186ffd=_0x2480b1[_0x287a('0x24')]({'plain':!![]});_0x186ffd=qs[_0x287a('0x51')](_0x186ffd,['id',_0x287a('0x52'),_0x287a('0x53')]);_0x1ac92e['body']=_[_0x287a('0x51')](_0x1ac92e[_0x287a('0x4a')],['id',_0x287a('0x52'),_0x287a('0x53')]);return db[_0x287a('0x2d')][_0x287a('0x4f')](_[_0x287a('0x3f')](_0x186ffd,_0x1ac92e[_0x287a('0x4a')]),{'include':_0x1ac92e[_0x287a('0x35')][_0x287a('0x42')]?[{'all':!![]}]:undefined})[_0x287a('0x23')](function(_0x414799){var _0x4b94f1=_0x1ac92e[_0x287a('0x54')]['get']({'plain':!![]});if(!_0x4b94f1)throw new Error(_0x287a('0x4b'));if(_0x4b94f1['role']===_0x287a('0x54')){var _0x41a9e5=_0x414799[_0x287a('0x24')]({'plain':!![]});var _0x46a5b5=_0x287a('0x25');return db[_0x287a('0x4c')][_0x287a('0x4d')]({'where':{'name':_0x46a5b5,'userProfileId':_0x4b94f1[_0x287a('0x55')]},'raw':!![]})[_0x287a('0x23')](function(_0x6825be){if(_0x6825be&&_0x6825be[_0x287a('0x4e')]===0x0){return db['UserProfileResource'][_0x287a('0x4f')]({'name':_0x41a9e5['name'],'resourceId':_0x41a9e5['id'],'type':_0x6825be[_0x287a('0x2a')],'sectionId':_0x6825be['id']},{})[_0x287a('0x23')](function(){return _0x414799;});}else{return _0x414799;}})[_0x287a('0x46')](function(_0x14701f){logger[_0x287a('0x28')](_0x287a('0x56'),_0x14701f);throw _0x14701f;});}return _0x414799;});}})[_0x287a('0x23')](respondWithResult(_0x5094a7,0xc9))[_0x287a('0x46')](handleError(_0x5094a7,null));};exports[_0x287a('0x21')]=function(_0x2a8a65,_0x4bc251){if(_0x2a8a65[_0x287a('0x4a')]['id']){delete _0x2a8a65[_0x287a('0x4a')]['id'];}return db[_0x287a('0x2d')][_0x287a('0x4d')]({'where':{'id':_0x2a8a65[_0x287a('0x48')]['id']}})[_0x287a('0x23')](handleEntityNotFound(_0x4bc251,null))[_0x287a('0x23')](saveUpdates(_0x2a8a65['body'],null))[_0x287a('0x23')](respondWithResult(_0x4bc251,null))[_0x287a('0x46')](handleError(_0x4bc251,null));};exports[_0x287a('0x22')]=function(_0x186938,_0x401367){return db[_0x287a('0x2d')][_0x287a('0x4d')]({'where':{'id':_0x186938[_0x287a('0x48')]['id']}})[_0x287a('0x23')](handleEntityNotFound(_0x401367,null))['then'](removeEntity(_0x401367,null))['catch'](handleError(_0x401367,null));};exports[_0x287a('0x57')]=function(_0x3e4836,_0x130917,_0x477ac2){var _0x4da886={'raw':!![],'where':{}};var _0x3f0059={};var _0x580148={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x287a('0x58')]({'where':{'id':_0x3e4836[_0x287a('0x48')]['id']}})[_0x287a('0x23')](handleEntityNotFound(_0x130917,null))[_0x287a('0x23')](function(_0xfdbb80){if(_0xfdbb80){_0x3f0059[_0x287a('0x31')]=_[_0x287a('0x33')](db[_0x287a('0x59')]['rawAttributes']);_0x3f0059[_0x287a('0x35')]=_[_0x287a('0x33')](_0x3e4836[_0x287a('0x35')]);_0x3f0059[_0x287a('0x3d')]=_[_0x287a('0x34')](_0x3f0059[_0x287a('0x31')],_0x3f0059[_0x287a('0x35')]);_0x4da886['attributes']=_[_0x287a('0x34')](_0x3f0059[_0x287a('0x31')],qs[_0x287a('0x37')](_0x3e4836['query']['fields']));_0x4da886['attributes']=_0x4da886[_0x287a('0x36')][_0x287a('0x38')]?_0x4da886['attributes']:_0x3f0059[_0x287a('0x31')];if(!_0x3e4836[_0x287a('0x35')][_0x287a('0x39')](_0x287a('0x3a'))){_0x4da886['limit']=qs[_0x287a('0x1a')](_0x3e4836['query'][_0x287a('0x1a')]);_0x4da886[_0x287a('0x1c')]=qs[_0x287a('0x1c')](_0x3e4836[_0x287a('0x35')]['offset']);}_0x4da886[_0x287a('0x3b')]=qs[_0x287a('0x3c')](_0x3e4836[_0x287a('0x35')][_0x287a('0x3c')]);_0x4da886['where']=qs[_0x287a('0x3d')](_[_0x287a('0x5a')](_0x3e4836['query'],_0x3f0059['filters']));_0x4da886[_0x287a('0x3e')][_0x287a('0x5b')]=_0xfdbb80['id'];if(_0x3e4836[_0x287a('0x35')]['filter']){_0x4da886[_0x287a('0x3e')]=_['merge'](_0x4da886[_0x287a('0x3e')],{'$or':_[_0x287a('0x32')](_0x4da886[_0x287a('0x36')],function(_0x6a533f){var _0xea89b6={};_0xea89b6[_0x6a533f]={'$like':'%'+_0x3e4836['query']['filter']+'%'};return _0xea89b6;})});}_0x4da886=_[_0x287a('0x3f')]({},_0x4da886,_0x3e4836[_0x287a('0x49')]);return db[_0x287a('0x59')]['count']({'where':_0x4da886[_0x287a('0x3e')]})[_0x287a('0x23')](function(_0x4f1b76){_0x580148[_0x287a('0x1b')]=_0x4f1b76;if(_0x3e4836['query'][_0x287a('0x42')]){_0x4da886[_0x287a('0x43')]=[{'all':!![]}];}return db[_0x287a('0x59')][_0x287a('0x44')](_0x4da886);})[_0x287a('0x23')](function(_0x3cddb2){_0x580148['rows']=_0x3cddb2;return _0x580148;});}})['then'](respondWithFilteredResult(_0x130917,_0x4da886))['catch'](handleError(_0x130917,null));};exports[_0x287a('0x5c')]=function(_0x4c2c20,_0x506093,_0x5c66af){var _0x160f08={'raw':!![],'where':{}};var _0xa62008={};var _0x4d38f9={'count':0x0,'rows':[]};return db[_0x287a('0x2d')][_0x287a('0x58')]({'where':{'id':_0x4c2c20[_0x287a('0x48')]['id']}})[_0x287a('0x23')](handleEntityNotFound(_0x506093,null))[_0x287a('0x23')](function(_0x408f1b){if(_0x408f1b){_0xa62008[_0x287a('0x31')]=_[_0x287a('0x33')](db[_0x287a('0x5d')]['rawAttributes']);_0xa62008[_0x287a('0x35')]=_[_0x287a('0x33')](_0x4c2c20['query']);_0xa62008[_0x287a('0x3d')]=_[_0x287a('0x34')](_0xa62008[_0x287a('0x31')],_0xa62008[_0x287a('0x35')]);_0x160f08[_0x287a('0x36')]=_[_0x287a('0x34')](_0xa62008[_0x287a('0x31')],qs[_0x287a('0x37')](_0x4c2c20[_0x287a('0x35')][_0x287a('0x37')]));_0x160f08[_0x287a('0x36')]=_0x160f08[_0x287a('0x36')][_0x287a('0x38')]?_0x160f08[_0x287a('0x36')]:_0xa62008[_0x287a('0x31')];if(!_0x4c2c20['query'][_0x287a('0x39')](_0x287a('0x3a'))){_0x160f08['limit']=qs[_0x287a('0x1a')](_0x4c2c20[_0x287a('0x35')][_0x287a('0x1a')]);_0x160f08['offset']=qs[_0x287a('0x1c')](_0x4c2c20[_0x287a('0x35')][_0x287a('0x1c')]);}_0x160f08[_0x287a('0x3b')]=qs['sort'](_0x4c2c20[_0x287a('0x35')]['sort']);_0x160f08[_0x287a('0x3e')]=qs[_0x287a('0x3d')](_['pick'](_0x4c2c20[_0x287a('0x35')],_0xa62008[_0x287a('0x3d')]));_0x160f08[_0x287a('0x3e')][_0x287a('0x5b')]=_0x408f1b['id'];if(_0x4c2c20[_0x287a('0x35')]['filter']){_0x160f08['where']=_['merge'](_0x160f08[_0x287a('0x3e')],{'$or':_['map'](_0x160f08[_0x287a('0x36')],function(_0x485c62){var _0x456402={};_0x456402[_0x485c62]={'$like':'%'+_0x4c2c20[_0x287a('0x35')][_0x287a('0x41')]+'%'};return _0x456402;})});}_0x160f08=_[_0x287a('0x3f')]({},_0x160f08,_0x4c2c20[_0x287a('0x49')]);return db[_0x287a('0x5d')][_0x287a('0x1b')]({'where':_0x160f08[_0x287a('0x3e')]})[_0x287a('0x23')](function(_0x1b8493){_0x4d38f9[_0x287a('0x1b')]=_0x1b8493;if(_0x4c2c20[_0x287a('0x35')][_0x287a('0x42')]){_0x160f08[_0x287a('0x43')]=[{'all':!![]}];}return db[_0x287a('0x5d')][_0x287a('0x44')](_0x160f08);})[_0x287a('0x23')](function(_0x1fc5a1){_0x4d38f9['rows']=_0x1fc5a1;return _0x4d38f9;});}})[_0x287a('0x23')](respondWithFilteredResult(_0x506093,_0x160f08))[_0x287a('0x46')](handleError(_0x506093,null));};function char(_0x8aa444){return'number'===typeof _0x8aa444?String['fromCharCode'][_0x287a('0x1e')](null,arguments):_0x8aa444;}function needsEncapsulation(_0x171461){return!!_0x171461&&(_0x171461[_0x287a('0x5e')]()[_0x287a('0x5f')](char(0xd))>=0x0||_0x171461[_0x287a('0x5e')]()[_0x287a('0x5f')](char(0xa))>=0x0||_0x171461[_0x287a('0x5e')]()[_0x287a('0x5f')](char(0x2c))>=0x0||_0x171461['toString']()[_0x287a('0x5f')](char(0x22))>=0x0);}function encapsulate(_0x388dfb){var _0x4b6127=char(0x22),_0x33e222='\x5c'+char(0x22),_0x349dc1=_0x388dfb[_0x287a('0x5e')]()['replace'](new RegExp(_0x4b6127,'g'),_0x33e222);return _0x4b6127+_0x349dc1+_0x4b6127;}exports[_0x287a('0x60')]=function(_0x2525dd,_0xae86b4,_0x209f49){var _0x2ff422,_0x12fff9;var _0x135a36={'where':{'ProjectId':_0x2525dd[_0x287a('0x48')]['id']}};if(_0x2525dd[_0x287a('0x35')][_0x287a('0x61')]){_0x135a36[_0x287a('0x3e')][_0x287a('0x62')]=JSON[_0x287a('0x63')](_0x2525dd[_0x287a('0x35')][_0x287a('0x61')]);}return db[_0x287a('0x59')][_0x287a('0x44')](_0x135a36)[_0x287a('0x23')](handleEntityNotFound(_0xae86b4,null))['then'](function(_0x34b495){if(_0x34b495){_0x2ff422=_0x34b495;return db[_0x287a('0x64')][_0x287a('0x44')]({'where':{'SessionId':{'$in':_[_0x287a('0x32')](_0x2ff422,'id')},'ProjectId':_0x2525dd[_0x287a('0x48')]['id']},'order':_0x287a('0x65')});}})[_0x287a('0x23')](handleEntityNotFound(_0xae86b4,null))[_0x287a('0x23')](function(_0x41a8bf){if(_0x41a8bf){_0x12fff9=_0x41a8bf;var _0x225b5d={};for(var _0x5d9db3=0x0,_0x1c7259=_0x12fff9[_0x287a('0x38')];_0x5d9db3<_0x1c7259;_0x5d9db3++){if(!_0x225b5d['hasOwnProperty'](_0x12fff9[_0x5d9db3][_0x287a('0x66')])){_0x225b5d[_0x12fff9[_0x5d9db3][_0x287a('0x66')]]=needsEncapsulation(_0x12fff9[_0x5d9db3][_0x287a('0x67')])?encapsulate(_0x12fff9[_0x5d9db3][_0x287a('0x67')]):_0x12fff9[_0x5d9db3][_0x287a('0x67')];}}var _0x17400f=[],_0x5e4c56={};for(var _0x1d459d=0x0,_0x2f7b81=_0x2ff422[_0x287a('0x38')];_0x1d459d<_0x2f7b81;_0x1d459d++){_0x5e4c56={'ProjectId':_0x2525dd[_0x287a('0x48')]['id'],'SessionId':_0x2ff422[_0x1d459d]['id'],'StartTime':moment(_0x2ff422[_0x1d459d][_0x287a('0x62')])[_0x287a('0x68')](_0x287a('0x69'))};for(var _0x11fe12=0x0,_0x268e3b=_0x12fff9[_0x287a('0x38')];_0x11fe12<_0x268e3b;_0x11fe12++){if(_0x12fff9[_0x11fe12]['SessionId']==_0x2ff422[_0x1d459d]['id']&&_0x225b5d['hasOwnProperty'](_0x12fff9[_0x11fe12][_0x287a('0x66')])){_0x5e4c56[_0x225b5d[_0x12fff9[_0x11fe12][_0x287a('0x66')]]]=_0x12fff9[_0x11fe12]['answer'];}}for(var _0xcac5f2 in _0x225b5d){if(!_0x5e4c56[_0x287a('0x39')](_0x225b5d[_0xcac5f2])){_0x5e4c56[_0x225b5d[_0xcac5f2]]=null;}}_0x17400f[_0x287a('0x6a')](_0x5e4c56);}return _0x17400f;}})['then'](function(_0x5c99f7){if(!_[_0x287a('0x6b')](_0x5c99f7)){var _0x4a8038=toCsv(_0x5c99f7);var _0x5d595e=Date[_0x287a('0x6c')]();fs['writeFileSync'](util[_0x287a('0x68')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x2525dd[_0x287a('0x48')]['id'],_0x5d595e),_0x4a8038);_0xae86b4[_0x287a('0x6d')](_0x287a('0x6e'),_0x287a('0x6f')+util[_0x287a('0x68')](_0x287a('0x70'),_0x2525dd['params']['id'],_0x5d595e));_0xae86b4[_0x287a('0x6d')](_0x287a('0x71'),'text/csv');return _0xae86b4['download'](util[_0x287a('0x68')](_0x287a('0x72'),_0x2525dd[_0x287a('0x48')]['id'],_0x5d595e));}else{return _0xae86b4['sendStatus'](0xcc);}})[_0x287a('0x46')](handleError(_0xae86b4,null));}; \ No newline at end of file +var _0x4eb8=['name','send','index','map','JscriptyProject','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','options','include','findAll','rows','show','params','includeAll','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Projects','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rawAttributes','omit','createdAt','updatedAt','getSessions','JscriptySessionReport','nolimit','ProjectId','getAnswers','findOne','JscriptyAnswerReport','fromCharCode','toString','indexOf','getSummary','startTime','parse','JscriptyQuestionReport','-createdAt','questionId','question','starttime','format','SessionId','push','isEmpty','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','setHeader','Content-type','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error'];(function(_0x4bddcb,_0xe6be3b){var _0x4a6d0b=function(_0x29cb57){while(--_0x29cb57){_0x4bddcb['push'](_0x4bddcb['shift']());}};_0x4a6d0b(++_0xe6be3b);}(_0x4eb8,0x1b5));var _0x84eb=function(_0x371241,_0x1006c8){_0x371241=_0x371241-0x0;var _0x1eb44d=_0x4eb8[_0x371241];return _0x1eb44d;};'use strict';var emlformat=require(_0x84eb('0x0'));var rimraf=require(_0x84eb('0x1'));var zipdir=require(_0x84eb('0x2'));var jsonpatch=require(_0x84eb('0x3'));var rp=require('request-promise');var moment=require(_0x84eb('0x4'));var BPromise=require(_0x84eb('0x5'));var Mustache=require(_0x84eb('0x6'));var util=require(_0x84eb('0x7'));var path=require(_0x84eb('0x8'));var sox=require(_0x84eb('0x9'));var csv=require(_0x84eb('0xa'));var ejs=require(_0x84eb('0xb'));var fs=require('fs');var fs_extra=require(_0x84eb('0xc'));var _=require('lodash');var squel=require(_0x84eb('0xd'));var crypto=require(_0x84eb('0xe'));var jsforce=require(_0x84eb('0xf'));var deskjs=require(_0x84eb('0x10'));var toCsv=require(_0x84eb('0xa'));var querystring=require(_0x84eb('0x11'));var Papa=require(_0x84eb('0x12'));var Redis=require(_0x84eb('0x13'));var authService=require(_0x84eb('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x84eb('0x15'));var hardwareService=require(_0x84eb('0x16'));var logger=require(_0x84eb('0x17'))(_0x84eb('0x18'));var utils=require('../../config/utils');var config=require(_0x84eb('0x19'));var licenseUtil=require(_0x84eb('0x1a'));var db=require(_0x84eb('0x1b'))['db'];function respondWithStatusCode(_0xf15f82,_0x24b04a){_0x24b04a=_0x24b04a||0xcc;return function(_0x57c8f7){if(_0x57c8f7){return _0xf15f82[_0x84eb('0x1c')](_0x24b04a);}return _0xf15f82[_0x84eb('0x1d')](_0x24b04a)[_0x84eb('0x1e')]();};}function respondWithResult(_0x10f4e1,_0x216068){_0x216068=_0x216068||0xc8;return function(_0x44783b){if(_0x44783b){return _0x10f4e1[_0x84eb('0x1d')](_0x216068)[_0x84eb('0x1f')](_0x44783b);}};}function respondWithFilteredResult(_0x2670ae,_0xb19d09){return function(_0x264565){if(_0x264565){var _0x2f2785=typeof _0xb19d09['offset']===_0x84eb('0x20')&&typeof _0xb19d09[_0x84eb('0x21')]===_0x84eb('0x20');var _0x522e7e=_0x264565['count'];var _0x5718a4=_0x2f2785?0x0:_0xb19d09['offset'];var _0x529357=_0x2f2785?_0x264565[_0x84eb('0x22')]:_0xb19d09[_0x84eb('0x23')]+_0xb19d09[_0x84eb('0x21')];var _0x5bac61;if(_0x529357>=_0x522e7e){_0x529357=_0x522e7e;_0x5bac61=0xc8;}else{_0x5bac61=0xce;}_0x2670ae[_0x84eb('0x1d')](_0x5bac61);return _0x2670ae[_0x84eb('0x24')](_0x84eb('0x25'),_0x5718a4+'-'+_0x529357+'/'+_0x522e7e)[_0x84eb('0x1f')](_0x264565);}return null;};}function patchUpdates(_0x26dcfd){return function(_0x37994b){try{jsonpatch[_0x84eb('0x26')](_0x37994b,_0x26dcfd,!![]);}catch(_0x5730fd){return BPromise[_0x84eb('0x27')](_0x5730fd);}return _0x37994b[_0x84eb('0x28')]();};}function saveUpdates(_0x4c62d7,_0x1e2e76){return function(_0x5d64cb){if(_0x5d64cb){return _0x5d64cb[_0x84eb('0x29')](_0x4c62d7)[_0x84eb('0x2a')](function(_0x5a8e60){return _0x5a8e60;});}return null;};}function removeEntity(_0x352989,_0x1fb507){return function(_0x466746){if(_0x466746){return _0x466746[_0x84eb('0x2b')]()[_0x84eb('0x2a')](function(){var _0x1653bc=_0x466746[_0x84eb('0x2c')]({'plain':!![]});var _0x3ecf72='Projects';return db[_0x84eb('0x2d')][_0x84eb('0x2b')]({'where':{'type':_0x3ecf72,'resourceId':_0x1653bc['id']}})[_0x84eb('0x2a')](function(){return _0x466746;});})[_0x84eb('0x2a')](function(){_0x352989[_0x84eb('0x1d')](0xcc)[_0x84eb('0x1e')]();});}};}function handleEntityNotFound(_0xd51ee6,_0x2736d5){return function(_0x43bd1b){if(!_0x43bd1b){_0xd51ee6[_0x84eb('0x1c')](0x194);}return _0x43bd1b;};}function handleError(_0x29e60d,_0x1bfdec){_0x1bfdec=_0x1bfdec||0x1f4;return function(_0x22e11c){logger[_0x84eb('0x2e')](_0x22e11c['stack']);if(_0x22e11c[_0x84eb('0x2f')]){delete _0x22e11c[_0x84eb('0x2f')];}_0x29e60d[_0x84eb('0x1d')](_0x1bfdec)[_0x84eb('0x30')](_0x22e11c);};}exports[_0x84eb('0x31')]=function(_0x543d89,_0x430920){var _0x163517={},_0x2cc885={},_0x57ef39={'count':0x0,'rows':[]};var _0x23cb8f=_[_0x84eb('0x32')](db[_0x84eb('0x33')]['rawAttributes'],function(_0x31fbc6){return{'name':_0x31fbc6['fieldName'],'type':_0x31fbc6[_0x84eb('0x34')][_0x84eb('0x35')]};});_0x2cc885[_0x84eb('0x36')]=_[_0x84eb('0x32')](_0x23cb8f,_0x84eb('0x2f'));_0x2cc885[_0x84eb('0x37')]=_[_0x84eb('0x38')](_0x543d89[_0x84eb('0x37')]);_0x2cc885['filters']=_[_0x84eb('0x39')](_0x2cc885[_0x84eb('0x36')],_0x2cc885['query']);_0x163517[_0x84eb('0x3a')]=_[_0x84eb('0x39')](_0x2cc885[_0x84eb('0x36')],qs[_0x84eb('0x3b')](_0x543d89[_0x84eb('0x37')]['fields']));_0x163517[_0x84eb('0x3a')]=_0x163517[_0x84eb('0x3a')][_0x84eb('0x3c')]?_0x163517[_0x84eb('0x3a')]:_0x2cc885[_0x84eb('0x36')];if(!_0x543d89[_0x84eb('0x37')][_0x84eb('0x3d')]('nolimit')){_0x163517['limit']=qs[_0x84eb('0x21')](_0x543d89['query'][_0x84eb('0x21')]);_0x163517[_0x84eb('0x23')]=qs[_0x84eb('0x23')](_0x543d89['query'][_0x84eb('0x23')]);}_0x163517[_0x84eb('0x3e')]=qs['sort'](_0x543d89[_0x84eb('0x37')][_0x84eb('0x3f')]);_0x163517['where']=qs[_0x84eb('0x40')](_[_0x84eb('0x41')](_0x543d89[_0x84eb('0x37')],_0x2cc885[_0x84eb('0x40')]),_0x23cb8f);if(_0x543d89[_0x84eb('0x37')][_0x84eb('0x42')]){_0x163517[_0x84eb('0x43')]=_[_0x84eb('0x44')](_0x163517['where'],{'$or':_[_0x84eb('0x32')](_0x23cb8f,function(_0x35e6e9){if(_0x35e6e9['type']!=='VIRTUAL'){var _0x5879b6={};_0x5879b6[_0x35e6e9[_0x84eb('0x2f')]]={'$like':'%'+_0x543d89[_0x84eb('0x37')][_0x84eb('0x42')]+'%'};return _0x5879b6;}})});}_0x163517=_['merge']({},_0x163517,_0x543d89[_0x84eb('0x45')]);var _0x446500={'where':_0x163517[_0x84eb('0x43')]};return db[_0x84eb('0x33')]['count'](_0x446500)[_0x84eb('0x2a')](function(_0x200454){_0x57ef39['count']=_0x200454;if(_0x543d89[_0x84eb('0x37')]['includeAll']){_0x163517[_0x84eb('0x46')]=[{'all':!![]}];}return db[_0x84eb('0x33')][_0x84eb('0x47')](_0x163517);})['then'](function(_0x57427e){_0x57ef39[_0x84eb('0x48')]=_0x57427e;return _0x57ef39;})[_0x84eb('0x2a')](respondWithFilteredResult(_0x430920,_0x163517))['catch'](handleError(_0x430920,null));};exports[_0x84eb('0x49')]=function(_0x1a3f5d,_0x22074f){var _0x522764={'raw':![],'where':{'id':_0x1a3f5d[_0x84eb('0x4a')]['id']}},_0x3a92ca={};_0x3a92ca[_0x84eb('0x36')]=_['keys'](db[_0x84eb('0x33')]['rawAttributes']);_0x3a92ca[_0x84eb('0x37')]=_['keys'](_0x1a3f5d[_0x84eb('0x37')]);_0x3a92ca[_0x84eb('0x40')]=_[_0x84eb('0x39')](_0x3a92ca[_0x84eb('0x36')],_0x3a92ca['query']);_0x522764[_0x84eb('0x3a')]=_['intersection'](_0x3a92ca[_0x84eb('0x36')],qs[_0x84eb('0x3b')](_0x1a3f5d[_0x84eb('0x37')][_0x84eb('0x3b')]));_0x522764[_0x84eb('0x3a')]=_0x522764[_0x84eb('0x3a')][_0x84eb('0x3c')]?_0x522764[_0x84eb('0x3a')]:_0x3a92ca['model'];if(_0x1a3f5d['query'][_0x84eb('0x4b')]){_0x522764[_0x84eb('0x46')]=[{'all':!![]}];}_0x522764=_[_0x84eb('0x44')]({},_0x522764,_0x1a3f5d['options']);return db['JscriptyProject']['find'](_0x522764)[_0x84eb('0x2a')](handleEntityNotFound(_0x22074f,null))[_0x84eb('0x2a')](respondWithResult(_0x22074f,null))[_0x84eb('0x4c')](handleError(_0x22074f,null));};exports[_0x84eb('0x4d')]=function(_0x2600f2,_0x55763a){return db['JscriptyProject']['create'](_0x2600f2[_0x84eb('0x4e')],{})[_0x84eb('0x2a')](function(_0x2397f5){var _0x30e33a=_0x2600f2[_0x84eb('0x4f')][_0x84eb('0x2c')]({'plain':!![]});if(!_0x30e33a)throw new Error(_0x84eb('0x50'));if(_0x30e33a[_0x84eb('0x51')]===_0x84eb('0x4f')){var _0x1f0417=_0x2397f5[_0x84eb('0x2c')]({'plain':!![]});var _0x155003=_0x84eb('0x52');return db[_0x84eb('0x53')][_0x84eb('0x54')]({'where':{'name':_0x155003,'userProfileId':_0x30e33a[_0x84eb('0x55')]},'raw':!![]})[_0x84eb('0x2a')](function(_0x87f03d){if(_0x87f03d&&_0x87f03d[_0x84eb('0x56')]===0x0){return db[_0x84eb('0x2d')][_0x84eb('0x4d')]({'name':_0x1f0417['name'],'resourceId':_0x1f0417['id'],'type':_0x87f03d['name'],'sectionId':_0x87f03d['id']},{})[_0x84eb('0x2a')](function(){return _0x2397f5;});}else{return _0x2397f5;}})[_0x84eb('0x4c')](function(_0x2857a1){logger[_0x84eb('0x2e')](_0x84eb('0x57'),_0x2857a1);throw _0x2857a1;});}return _0x2397f5;})['then'](respondWithResult(_0x55763a,0xc9))[_0x84eb('0x4c')](handleError(_0x55763a,null));};exports['clone']=function(_0x36e5ae,_0x2cbab2){var _0x4b93a2={'where':{'id':_0x36e5ae[_0x84eb('0x4a')]['id']}},_0x2e2106={};_0x2e2106[_0x84eb('0x36')]=_[_0x84eb('0x38')](db[_0x84eb('0x33')][_0x84eb('0x58')]);_0x4b93a2[_0x84eb('0x3a')]=_[_0x84eb('0x39')](_0x2e2106[_0x84eb('0x36')],qs[_0x84eb('0x3b')](_0x36e5ae[_0x84eb('0x37')]['fields']));_0x4b93a2[_0x84eb('0x3a')]=_0x4b93a2['attributes'][_0x84eb('0x3c')]?_0x4b93a2[_0x84eb('0x3a')]:_0x2e2106[_0x84eb('0x36')];if(_0x36e5ae[_0x84eb('0x37')][_0x84eb('0x4b')]){_0x4b93a2[_0x84eb('0x46')]=[{'all':!![]}];}_0x4b93a2=_[_0x84eb('0x44')]({},_0x4b93a2,_0x36e5ae[_0x84eb('0x45')]);return db[_0x84eb('0x33')]['find'](_0x4b93a2)[_0x84eb('0x2a')](handleEntityNotFound(_0x2cbab2,null))[_0x84eb('0x2a')](function(_0x408818){if(_0x408818){var _0x394abc=_0x408818[_0x84eb('0x2c')]({'plain':!![]});_0x394abc=qs[_0x84eb('0x59')](_0x394abc,['id','createdAt','updatedAt']);_0x36e5ae['body']=_[_0x84eb('0x59')](_0x36e5ae[_0x84eb('0x4e')],['id',_0x84eb('0x5a'),_0x84eb('0x5b')]);return db[_0x84eb('0x33')][_0x84eb('0x4d')](_[_0x84eb('0x44')](_0x394abc,_0x36e5ae['body']),{'include':_0x36e5ae[_0x84eb('0x37')][_0x84eb('0x4b')]?[{'all':!![]}]:undefined})[_0x84eb('0x2a')](function(_0xf90029){var _0x53da2c=_0x36e5ae['user'][_0x84eb('0x2c')]({'plain':!![]});if(!_0x53da2c)throw new Error(_0x84eb('0x50'));if(_0x53da2c[_0x84eb('0x51')]===_0x84eb('0x4f')){var _0x56a75c=_0xf90029['get']({'plain':!![]});var _0x26f899=_0x84eb('0x52');return db[_0x84eb('0x53')][_0x84eb('0x54')]({'where':{'name':_0x26f899,'userProfileId':_0x53da2c[_0x84eb('0x55')]},'raw':!![]})[_0x84eb('0x2a')](function(_0x2bcda1){if(_0x2bcda1&&_0x2bcda1[_0x84eb('0x56')]===0x0){return db[_0x84eb('0x2d')][_0x84eb('0x4d')]({'name':_0x56a75c[_0x84eb('0x2f')],'resourceId':_0x56a75c['id'],'type':_0x2bcda1[_0x84eb('0x2f')],'sectionId':_0x2bcda1['id']},{})[_0x84eb('0x2a')](function(){return _0xf90029;});}else{return _0xf90029;}})['catch'](function(_0x2e5d0a){logger[_0x84eb('0x2e')](_0x84eb('0x57'),_0x2e5d0a);throw _0x2e5d0a;});}return _0xf90029;});}})[_0x84eb('0x2a')](respondWithResult(_0x2cbab2,0xc9))[_0x84eb('0x4c')](handleError(_0x2cbab2,null));};exports[_0x84eb('0x29')]=function(_0x2c69cc,_0x3199df){if(_0x2c69cc[_0x84eb('0x4e')]['id']){delete _0x2c69cc[_0x84eb('0x4e')]['id'];}return db[_0x84eb('0x33')]['find']({'where':{'id':_0x2c69cc['params']['id']}})[_0x84eb('0x2a')](handleEntityNotFound(_0x3199df,null))[_0x84eb('0x2a')](saveUpdates(_0x2c69cc[_0x84eb('0x4e')],null))[_0x84eb('0x2a')](respondWithResult(_0x3199df,null))[_0x84eb('0x4c')](handleError(_0x3199df,null));};exports[_0x84eb('0x2b')]=function(_0x47289a,_0x8dfc66){return db[_0x84eb('0x33')][_0x84eb('0x54')]({'where':{'id':_0x47289a[_0x84eb('0x4a')]['id']}})[_0x84eb('0x2a')](handleEntityNotFound(_0x8dfc66,null))[_0x84eb('0x2a')](removeEntity(_0x8dfc66,null))[_0x84eb('0x4c')](handleError(_0x8dfc66,null));};exports[_0x84eb('0x5c')]=function(_0x54559c,_0x3b87be,_0xbe902a){var _0x1a37dd={'raw':!![],'where':{}};var _0x4bc570={};var _0x21523d={'count':0x0,'rows':[]};return db[_0x84eb('0x33')]['findOne']({'where':{'id':_0x54559c['params']['id']}})[_0x84eb('0x2a')](handleEntityNotFound(_0x3b87be,null))[_0x84eb('0x2a')](function(_0x2a2be8){if(_0x2a2be8){_0x4bc570[_0x84eb('0x36')]=_['keys'](db[_0x84eb('0x5d')]['rawAttributes']);_0x4bc570['query']=_[_0x84eb('0x38')](_0x54559c[_0x84eb('0x37')]);_0x4bc570['filters']=_['intersection'](_0x4bc570[_0x84eb('0x36')],_0x4bc570[_0x84eb('0x37')]);_0x1a37dd['attributes']=_['intersection'](_0x4bc570[_0x84eb('0x36')],qs[_0x84eb('0x3b')](_0x54559c[_0x84eb('0x37')][_0x84eb('0x3b')]));_0x1a37dd['attributes']=_0x1a37dd[_0x84eb('0x3a')][_0x84eb('0x3c')]?_0x1a37dd[_0x84eb('0x3a')]:_0x4bc570['model'];if(!_0x54559c[_0x84eb('0x37')]['hasOwnProperty'](_0x84eb('0x5e'))){_0x1a37dd[_0x84eb('0x21')]=qs[_0x84eb('0x21')](_0x54559c[_0x84eb('0x37')][_0x84eb('0x21')]);_0x1a37dd[_0x84eb('0x23')]=qs[_0x84eb('0x23')](_0x54559c[_0x84eb('0x37')][_0x84eb('0x23')]);}_0x1a37dd[_0x84eb('0x3e')]=qs[_0x84eb('0x3f')](_0x54559c['query'][_0x84eb('0x3f')]);_0x1a37dd[_0x84eb('0x43')]=qs[_0x84eb('0x40')](_[_0x84eb('0x41')](_0x54559c['query'],_0x4bc570[_0x84eb('0x40')]));_0x1a37dd[_0x84eb('0x43')][_0x84eb('0x5f')]=_0x2a2be8['id'];if(_0x54559c[_0x84eb('0x37')]['filter']){_0x1a37dd[_0x84eb('0x43')]=_[_0x84eb('0x44')](_0x1a37dd[_0x84eb('0x43')],{'$or':_[_0x84eb('0x32')](_0x1a37dd[_0x84eb('0x3a')],function(_0x231017){var _0x13bcb2={};_0x13bcb2[_0x231017]={'$like':'%'+_0x54559c[_0x84eb('0x37')][_0x84eb('0x42')]+'%'};return _0x13bcb2;})});}_0x1a37dd=_[_0x84eb('0x44')]({},_0x1a37dd,_0x54559c[_0x84eb('0x45')]);return db[_0x84eb('0x5d')][_0x84eb('0x22')]({'where':_0x1a37dd[_0x84eb('0x43')]})[_0x84eb('0x2a')](function(_0x228ce1){_0x21523d[_0x84eb('0x22')]=_0x228ce1;if(_0x54559c[_0x84eb('0x37')][_0x84eb('0x4b')]){_0x1a37dd[_0x84eb('0x46')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x1a37dd);})[_0x84eb('0x2a')](function(_0x34863d){_0x21523d[_0x84eb('0x48')]=_0x34863d;return _0x21523d;});}})[_0x84eb('0x2a')](respondWithFilteredResult(_0x3b87be,_0x1a37dd))[_0x84eb('0x4c')](handleError(_0x3b87be,null));};exports[_0x84eb('0x60')]=function(_0x1ef33b,_0x145b68,_0x4f8a83){var _0x190345={'raw':!![],'where':{}};var _0x313262={};var _0x1e006c={'count':0x0,'rows':[]};return db[_0x84eb('0x33')][_0x84eb('0x61')]({'where':{'id':_0x1ef33b[_0x84eb('0x4a')]['id']}})[_0x84eb('0x2a')](handleEntityNotFound(_0x145b68,null))[_0x84eb('0x2a')](function(_0x4b1217){if(_0x4b1217){_0x313262[_0x84eb('0x36')]=_[_0x84eb('0x38')](db[_0x84eb('0x62')][_0x84eb('0x58')]);_0x313262[_0x84eb('0x37')]=_[_0x84eb('0x38')](_0x1ef33b['query']);_0x313262[_0x84eb('0x40')]=_['intersection'](_0x313262['model'],_0x313262[_0x84eb('0x37')]);_0x190345[_0x84eb('0x3a')]=_['intersection'](_0x313262['model'],qs['fields'](_0x1ef33b[_0x84eb('0x37')][_0x84eb('0x3b')]));_0x190345[_0x84eb('0x3a')]=_0x190345[_0x84eb('0x3a')]['length']?_0x190345[_0x84eb('0x3a')]:_0x313262[_0x84eb('0x36')];if(!_0x1ef33b[_0x84eb('0x37')]['hasOwnProperty'](_0x84eb('0x5e'))){_0x190345[_0x84eb('0x21')]=qs[_0x84eb('0x21')](_0x1ef33b[_0x84eb('0x37')][_0x84eb('0x21')]);_0x190345[_0x84eb('0x23')]=qs[_0x84eb('0x23')](_0x1ef33b[_0x84eb('0x37')][_0x84eb('0x23')]);}_0x190345[_0x84eb('0x3e')]=qs[_0x84eb('0x3f')](_0x1ef33b[_0x84eb('0x37')][_0x84eb('0x3f')]);_0x190345[_0x84eb('0x43')]=qs[_0x84eb('0x40')](_[_0x84eb('0x41')](_0x1ef33b[_0x84eb('0x37')],_0x313262[_0x84eb('0x40')]));_0x190345[_0x84eb('0x43')]['ProjectId']=_0x4b1217['id'];if(_0x1ef33b[_0x84eb('0x37')][_0x84eb('0x42')]){_0x190345[_0x84eb('0x43')]=_[_0x84eb('0x44')](_0x190345[_0x84eb('0x43')],{'$or':_[_0x84eb('0x32')](_0x190345['attributes'],function(_0x10756e){var _0x27f99a={};_0x27f99a[_0x10756e]={'$like':'%'+_0x1ef33b[_0x84eb('0x37')][_0x84eb('0x42')]+'%'};return _0x27f99a;})});}_0x190345=_[_0x84eb('0x44')]({},_0x190345,_0x1ef33b[_0x84eb('0x45')]);return db[_0x84eb('0x62')][_0x84eb('0x22')]({'where':_0x190345[_0x84eb('0x43')]})[_0x84eb('0x2a')](function(_0x3584f1){_0x1e006c[_0x84eb('0x22')]=_0x3584f1;if(_0x1ef33b[_0x84eb('0x37')][_0x84eb('0x4b')]){_0x190345[_0x84eb('0x46')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x84eb('0x47')](_0x190345);})[_0x84eb('0x2a')](function(_0x1eeb46){_0x1e006c[_0x84eb('0x48')]=_0x1eeb46;return _0x1e006c;});}})[_0x84eb('0x2a')](respondWithFilteredResult(_0x145b68,_0x190345))[_0x84eb('0x4c')](handleError(_0x145b68,null));};function char(_0x29a70f){return'number'===typeof _0x29a70f?String[_0x84eb('0x63')][_0x84eb('0x26')](null,arguments):_0x29a70f;}function needsEncapsulation(_0x19d227){return!!_0x19d227&&(_0x19d227[_0x84eb('0x64')]()[_0x84eb('0x65')](char(0xd))>=0x0||_0x19d227['toString']()[_0x84eb('0x65')](char(0xa))>=0x0||_0x19d227[_0x84eb('0x64')]()[_0x84eb('0x65')](char(0x2c))>=0x0||_0x19d227[_0x84eb('0x64')]()[_0x84eb('0x65')](char(0x22))>=0x0);}function encapsulate(_0x4cd4c3){var _0xe937f7=char(0x22),_0x47851a='\x5c'+char(0x22),_0x222df2=_0x4cd4c3['toString']()['replace'](new RegExp(_0xe937f7,'g'),_0x47851a);return _0xe937f7+_0x222df2+_0xe937f7;}exports[_0x84eb('0x66')]=function(_0x271548,_0x1f98bf,_0x3c63dc){var _0x528a03,_0x34230f;var _0x56b87d={'where':{'ProjectId':_0x271548[_0x84eb('0x4a')]['id']}};if(_0x271548[_0x84eb('0x37')][_0x84eb('0x67')]){_0x56b87d[_0x84eb('0x43')]['starttime']=JSON[_0x84eb('0x68')](_0x271548['query'][_0x84eb('0x67')]);}return db[_0x84eb('0x5d')]['findAll'](_0x56b87d)[_0x84eb('0x2a')](handleEntityNotFound(_0x1f98bf,null))['then'](function(_0x2dec0b){if(_0x2dec0b){_0x528a03=_0x2dec0b;return db[_0x84eb('0x69')][_0x84eb('0x47')]({'where':{'SessionId':{'$in':_[_0x84eb('0x32')](_0x528a03,'id')},'ProjectId':_0x271548[_0x84eb('0x4a')]['id']},'order':_0x84eb('0x6a')});}})[_0x84eb('0x2a')](handleEntityNotFound(_0x1f98bf,null))[_0x84eb('0x2a')](function(_0x5dff29){if(_0x5dff29){_0x34230f=_0x5dff29;var _0x669a2d={};for(var _0x299aa5=0x0,_0x442a30=_0x34230f['length'];_0x299aa5<_0x442a30;_0x299aa5++){if(!_0x669a2d[_0x84eb('0x3d')](_0x34230f[_0x299aa5][_0x84eb('0x6b')])){_0x669a2d[_0x34230f[_0x299aa5][_0x84eb('0x6b')]]=needsEncapsulation(_0x34230f[_0x299aa5]['question'])?encapsulate(_0x34230f[_0x299aa5][_0x84eb('0x6c')]):_0x34230f[_0x299aa5]['question'];}}var _0x4c2525=[],_0x3c2e54={};for(var _0x311e2e=0x0,_0x32e9e7=_0x528a03['length'];_0x311e2e<_0x32e9e7;_0x311e2e++){_0x3c2e54={'ProjectId':_0x271548[_0x84eb('0x4a')]['id'],'SessionId':_0x528a03[_0x311e2e]['id'],'StartTime':moment(_0x528a03[_0x311e2e][_0x84eb('0x6d')])[_0x84eb('0x6e')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x31e486=0x0,_0x4754d6=_0x34230f[_0x84eb('0x3c')];_0x31e486<_0x4754d6;_0x31e486++){if(_0x34230f[_0x31e486][_0x84eb('0x6f')]==_0x528a03[_0x311e2e]['id']&&_0x669a2d[_0x84eb('0x3d')](_0x34230f[_0x31e486]['questionId'])){_0x3c2e54[_0x669a2d[_0x34230f[_0x31e486]['questionId']]]=_0x34230f[_0x31e486]['answer'];}}for(var _0x3e06b2 in _0x669a2d){if(!_0x3c2e54[_0x84eb('0x3d')](_0x669a2d[_0x3e06b2])){_0x3c2e54[_0x669a2d[_0x3e06b2]]=null;}}_0x4c2525[_0x84eb('0x70')](_0x3c2e54);}return _0x4c2525;}})[_0x84eb('0x2a')](function(_0x13c3fb){if(!_[_0x84eb('0x71')](_0x13c3fb)){var _0x309e33=toCsv(_0x13c3fb);var _0x2251a4=Date[_0x84eb('0x72')]();fs['writeFileSync'](util[_0x84eb('0x6e')](_0x84eb('0x73'),_0x271548['params']['id'],_0x2251a4),_0x309e33);_0x1f98bf['setHeader'](_0x84eb('0x74'),'attachment;\x20filename='+util[_0x84eb('0x6e')]('Jscripty_Project_%d_Summary_%s.csv',_0x271548['params']['id'],_0x2251a4));_0x1f98bf[_0x84eb('0x75')](_0x84eb('0x76'),_0x84eb('0x77'));return _0x1f98bf[_0x84eb('0x78')](util[_0x84eb('0x6e')](_0x84eb('0x73'),_0x271548[_0x84eb('0x4a')]['id'],_0x2251a4));}else{return _0x1f98bf['sendStatus'](0xcc);}})[_0x84eb('0x4c')](handleError(_0x1f98bf,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index d35ab01..867acd5 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 _0x1af5=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','lodash','../../config/logger','api'];(function(_0x29a716,_0x314e14){var _0x6c29b1=function(_0x4124a0){while(--_0x4124a0){_0x29a716['push'](_0x29a716['shift']());}};_0x6c29b1(++_0x314e14);}(_0x1af5,0x17d));var _0x51af=function(_0x50f89d,_0x3736bd){_0x50f89d=_0x50f89d-0x0;var _0x491175=_0x1af5[_0x50f89d];return _0x491175;};'use strict';var _=require(_0x51af('0x0'));var util=require('util');var logger=require(_0x51af('0x1'))(_0x51af('0x2'));var moment=require(_0x51af('0x3'));var BPromise=require(_0x51af('0x4'));var rp=require(_0x51af('0x5'));var fs=require('fs');var path=require(_0x51af('0x6'));var rimraf=require(_0x51af('0x7'));var config=require(_0x51af('0x8'));var attributes=require(_0x51af('0x9'));module[_0x51af('0xa')]=function(_0x348f39,_0x3ebdd0){return _0x348f39[_0x51af('0xb')]('JscriptyProject',attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x861c=['request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3ac812,_0x327e72){var _0x2773c6=function(_0x5ca7a8){while(--_0x5ca7a8){_0x3ac812['push'](_0x3ac812['shift']());}};_0x2773c6(++_0x327e72);}(_0x861c,0xdb));var _0xc861=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x861c[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xc861('0x0'));var util=require(_0xc861('0x1'));var logger=require(_0xc861('0x2'))(_0xc861('0x3'));var moment=require(_0xc861('0x4'));var BPromise=require(_0xc861('0x5'));var rp=require(_0xc861('0x6'));var fs=require('fs');var path=require(_0xc861('0x7'));var rimraf=require(_0xc861('0x8'));var config=require(_0xc861('0x9'));var attributes=require(_0xc861('0xa'));module[_0xc861('0xb')]=function(_0x562f12,_0xc3b5fd){return _0x562f12[_0xc861('0xc')](_0xc861('0xd'),attributes,{'tableName':_0xc861('0xe'),'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 711cf61..51e4717 100644 --- a/server/api/jscriptyProject/jscriptyProject.rpc.js +++ b/server/api/jscriptyProject/jscriptyProject.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s'];(function(_0x4d49af,_0x122463){var _0xaf6a58=function(_0x1011b4){while(--_0x1011b4){_0x4d49af['push'](_0x4d49af['shift']());}};_0xaf6a58(++_0x122463);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1daaa9,_0x220393){_0x1daaa9=_0x1daaa9-0x0;var _0x1dd221=_0xcb91[_0x1daaa9];return _0x1dd221;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file +var _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','JscriptyProject,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x720aaa,_0x47d5a9){var _0x44f5de=function(_0x15dc92){while(--_0x15dc92){_0x720aaa['push'](_0x720aaa['shift']());}};_0x44f5de(++_0x47d5a9);}(_0x9c44,0x178));var _0x49c4=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x9c44[_0x3b0731];return _0x4204d7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 9216275..9f43597 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 _0x6705=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x2b0ba8,_0x1556e8){var _0x40b126=function(_0x2a8176){while(--_0x2a8176){_0x2b0ba8['push'](_0x2b0ba8['shift']());}};_0x40b126(++_0x1556e8);}(_0x6705,0xab));var _0x5670=function(_0x4250c9,_0x36a2d1){_0x4250c9=_0x4250c9-0x0;var _0x1b986c=_0x6705[_0x4250c9];return _0x1b986c;};'use strict';var multer=require(_0x5670('0x0'));var util=require(_0x5670('0x1'));var path=require('path');var timeout=require(_0x5670('0x2'));var express=require(_0x5670('0x3'));var router=express[_0x5670('0x4')]();var fs_extra=require(_0x5670('0x5'));var auth=require(_0x5670('0x6'));var interaction=require(_0x5670('0x7'));var config=require(_0x5670('0x8'));var controller=require('./jscriptyQuestionReport.controller');router[_0x5670('0x9')]('/',auth[_0x5670('0xa')](),controller[_0x5670('0xb')]);router[_0x5670('0x9')](_0x5670('0xc'),auth[_0x5670('0xa')](),controller[_0x5670('0xd')]);router[_0x5670('0x9')](_0x5670('0xe'),auth[_0x5670('0xa')](),controller[_0x5670('0xf')]);router[_0x5670('0x10')]('/',auth[_0x5670('0xa')](),controller[_0x5670('0x11')]);router[_0x5670('0x12')](_0x5670('0xe'),auth[_0x5670('0xa')](),controller[_0x5670('0x13')]);router['delete'](_0x5670('0xe'),auth[_0x5670('0xa')](),controller[_0x5670('0x14')]);module[_0x5670('0x15')]=router; \ No newline at end of file +var _0x3aa1=['isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','./jscriptyQuestionReport.controller','get'];(function(_0x359bbe,_0x5b7fcc){var _0x1b3353=function(_0x34b41c){while(--_0x34b41c){_0x359bbe['push'](_0x359bbe['shift']());}};_0x1b3353(++_0x5b7fcc);}(_0x3aa1,0x110));var _0x13aa=function(_0x4beb6d,_0x5dc36e){_0x4beb6d=_0x4beb6d-0x0;var _0x328685=_0x3aa1[_0x4beb6d];return _0x328685;};'use strict';var multer=require(_0x13aa('0x0'));var util=require('util');var path=require(_0x13aa('0x1'));var timeout=require(_0x13aa('0x2'));var express=require(_0x13aa('0x3'));var router=express['Router']();var fs_extra=require(_0x13aa('0x4'));var auth=require(_0x13aa('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x13aa('0x6'));router[_0x13aa('0x7')]('/',auth[_0x13aa('0x8')](),controller[_0x13aa('0x9')]);router[_0x13aa('0x7')](_0x13aa('0xa'),auth[_0x13aa('0x8')](),controller['describe']);router['get'](_0x13aa('0xb'),auth[_0x13aa('0x8')](),controller[_0x13aa('0xc')]);router[_0x13aa('0xd')]('/',auth['isAuthenticated'](),controller[_0x13aa('0xe')]);router[_0x13aa('0xf')](_0x13aa('0xb'),auth[_0x13aa('0x8')](),controller[_0x13aa('0x10')]);router[_0x13aa('0x11')](_0x13aa('0xb'),auth[_0x13aa('0x8')](),controller[_0x13aa('0x12')]);module[_0x13aa('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 9f9f266..6a9feb6 100644 --- a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js +++ b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x7a54,0x106));var _0x47a5=function(_0x2067c0,_0x3a6220){_0x2067c0=_0x2067c0-0x0;var _0x4b1082=_0x7a54[_0x2067c0];return _0x4b1082;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x7a54,0x106));var _0x47a5=function(_0x7d0a99,_0x3ab487){_0x7d0a99=_0x7d0a99-0x0;var _0xdf944d=_0x7a54[_0x7d0a99];return _0xdf944d;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index fe6e42c..b7c96eb 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 _0x801b=['rows','catch','show','params','keys','intersection','includeAll','find','create','body','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','status','set','reject','save','update','then','destroy','error','name','send','index','map','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','JscriptyQuestionReport','include','findAll'];(function(_0x1f754a,_0x38709f){var _0x4b1c93=function(_0x4e90e0){while(--_0x4e90e0){_0x1f754a['push'](_0x1f754a['shift']());}};_0x4b1c93(++_0x38709f);}(_0x801b,0xf2));var _0xb801=function(_0x1d42f2,_0x5923b2){_0x1d42f2=_0x1d42f2-0x0;var _0x5aafbf=_0x801b[_0x1d42f2];return _0x5aafbf;};'use strict';var emlformat=require(_0xb801('0x0'));var rimraf=require(_0xb801('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb801('0x2'));var rp=require('request-promise');var moment=require(_0xb801('0x3'));var BPromise=require(_0xb801('0x4'));var Mustache=require(_0xb801('0x5'));var util=require(_0xb801('0x6'));var path=require(_0xb801('0x7'));var sox=require(_0xb801('0x8'));var csv=require(_0xb801('0x9'));var ejs=require(_0xb801('0xa'));var fs=require('fs');var fs_extra=require(_0xb801('0xb'));var _=require(_0xb801('0xc'));var squel=require(_0xb801('0xd'));var crypto=require(_0xb801('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb801('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb801('0x10'));var Papa=require('papaparse');var Redis=require(_0xb801('0x11'));var authService=require(_0xb801('0x12'));var qs=require(_0xb801('0x13'));var as=require(_0xb801('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb801('0x15'))(_0xb801('0x16'));var utils=require(_0xb801('0x17'));var config=require(_0xb801('0x18'));var licenseUtil=require(_0xb801('0x19'));var db=require(_0xb801('0x1a'))['db'];function respondWithStatusCode(_0x2be116,_0xc9d6bb){_0xc9d6bb=_0xc9d6bb||0xcc;return function(_0x35690f){if(_0x35690f){return _0x2be116[_0xb801('0x1b')](_0xc9d6bb);}return _0x2be116['status'](_0xc9d6bb)[_0xb801('0x1c')]();};}function respondWithResult(_0x265cf8,_0x5b9500){_0x5b9500=_0x5b9500||0xc8;return function(_0x27d83e){if(_0x27d83e){return _0x265cf8['status'](_0x5b9500)[_0xb801('0x1d')](_0x27d83e);}};}function respondWithFilteredResult(_0x9c0f08,_0x214873){return function(_0x9932ad){if(_0x9932ad){var _0x47e22b=typeof _0x214873[_0xb801('0x1e')]==='undefined'&&typeof _0x214873[_0xb801('0x1f')]===_0xb801('0x20');var _0x3c67f8=_0x9932ad[_0xb801('0x21')];var _0xeef9b2=_0x47e22b?0x0:_0x214873[_0xb801('0x1e')];var _0x250f76=_0x47e22b?_0x9932ad[_0xb801('0x21')]:_0x214873[_0xb801('0x1e')]+_0x214873[_0xb801('0x1f')];var _0xa10ee6;if(_0x250f76>=_0x3c67f8){_0x250f76=_0x3c67f8;_0xa10ee6=0xc8;}else{_0xa10ee6=0xce;}_0x9c0f08[_0xb801('0x22')](_0xa10ee6);return _0x9c0f08[_0xb801('0x23')]('Content-Range',_0xeef9b2+'-'+_0x250f76+'/'+_0x3c67f8)[_0xb801('0x1d')](_0x9932ad);}return null;};}function patchUpdates(_0x38afd5){return function(_0x3683d3){try{jsonpatch['apply'](_0x3683d3,_0x38afd5,!![]);}catch(_0x176a99){return BPromise[_0xb801('0x24')](_0x176a99);}return _0x3683d3[_0xb801('0x25')]();};}function saveUpdates(_0xe58801,_0x49471a){return function(_0x7b1ea5){if(_0x7b1ea5){return _0x7b1ea5[_0xb801('0x26')](_0xe58801)[_0xb801('0x27')](function(_0x262450){return _0x262450;});}return null;};}function removeEntity(_0x4fa881,_0x1b1c6d){return function(_0x3d54ef){if(_0x3d54ef){return _0x3d54ef[_0xb801('0x28')]()[_0xb801('0x27')](function(){_0x4fa881[_0xb801('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25b116,_0x4e8f05){return function(_0x1d9ec1){if(!_0x1d9ec1){_0x25b116[_0xb801('0x1b')](0x194);}return _0x1d9ec1;};}function handleError(_0x35064d,_0x51b825){_0x51b825=_0x51b825||0x1f4;return function(_0x3205c1){logger[_0xb801('0x29')](_0x3205c1['stack']);if(_0x3205c1['name']){delete _0x3205c1[_0xb801('0x2a')];}_0x35064d[_0xb801('0x22')](_0x51b825)[_0xb801('0x2b')](_0x3205c1);};}exports[_0xb801('0x2c')]=function(_0x159e91,_0x3faab0){var _0x5abc46={},_0x3b11ab={},_0x29d41b={'count':0x0,'rows':[]};var _0x3221a6=_[_0xb801('0x2d')](db['JscriptyQuestionReport']['rawAttributes'],function(_0x65fab4){return{'name':_0x65fab4[_0xb801('0x2e')],'type':_0x65fab4[_0xb801('0x2f')][_0xb801('0x30')]};});_0x3b11ab[_0xb801('0x31')]=_[_0xb801('0x2d')](_0x3221a6,_0xb801('0x2a'));_0x3b11ab['query']=_['keys'](_0x159e91[_0xb801('0x32')]);_0x3b11ab[_0xb801('0x33')]=_['intersection'](_0x3b11ab[_0xb801('0x31')],_0x3b11ab[_0xb801('0x32')]);_0x5abc46[_0xb801('0x34')]=_['intersection'](_0x3b11ab[_0xb801('0x31')],qs[_0xb801('0x35')](_0x159e91[_0xb801('0x32')][_0xb801('0x35')]));_0x5abc46[_0xb801('0x34')]=_0x5abc46[_0xb801('0x34')][_0xb801('0x36')]?_0x5abc46[_0xb801('0x34')]:_0x3b11ab[_0xb801('0x31')];if(!_0x159e91[_0xb801('0x32')][_0xb801('0x37')]('nolimit')){_0x5abc46[_0xb801('0x1f')]=qs['limit'](_0x159e91[_0xb801('0x32')]['limit']);_0x5abc46['offset']=qs[_0xb801('0x1e')](_0x159e91[_0xb801('0x32')][_0xb801('0x1e')]);}_0x5abc46[_0xb801('0x38')]=qs[_0xb801('0x39')](_0x159e91[_0xb801('0x32')][_0xb801('0x39')]);_0x5abc46[_0xb801('0x3a')]=qs[_0xb801('0x33')](_[_0xb801('0x3b')](_0x159e91['query'],_0x3b11ab[_0xb801('0x33')]),_0x3221a6);if(_0x159e91['query']['filter']){_0x5abc46[_0xb801('0x3a')]=_['merge'](_0x5abc46[_0xb801('0x3a')],{'$or':_['map'](_0x3221a6,function(_0x4c4f31){if(_0x4c4f31[_0xb801('0x2f')]!=='VIRTUAL'){var _0x4f7696={};_0x4f7696[_0x4c4f31[_0xb801('0x2a')]]={'$like':'%'+_0x159e91[_0xb801('0x32')][_0xb801('0x3c')]+'%'};return _0x4f7696;}})});}_0x5abc46=_[_0xb801('0x3d')]({},_0x5abc46,_0x159e91[_0xb801('0x3e')]);var _0x3e8f69={'where':_0x5abc46['where']};return db[_0xb801('0x3f')][_0xb801('0x21')](_0x3e8f69)[_0xb801('0x27')](function(_0x277554){_0x29d41b[_0xb801('0x21')]=_0x277554;if(_0x159e91[_0xb801('0x32')]['includeAll']){_0x5abc46[_0xb801('0x40')]=[{'all':!![]}];}return db[_0xb801('0x3f')][_0xb801('0x41')](_0x5abc46);})[_0xb801('0x27')](function(_0x361ea0){_0x29d41b[_0xb801('0x42')]=_0x361ea0;return _0x29d41b;})['then'](respondWithFilteredResult(_0x3faab0,_0x5abc46))[_0xb801('0x43')](handleError(_0x3faab0,null));};exports[_0xb801('0x44')]=function(_0x141982,_0x3001db){var _0x511837={'raw':!![],'where':{'id':_0x141982[_0xb801('0x45')]['id']}},_0x196f5a={};_0x196f5a[_0xb801('0x31')]=_[_0xb801('0x46')](db['JscriptyQuestionReport']['rawAttributes']);_0x196f5a[_0xb801('0x32')]=_['keys'](_0x141982[_0xb801('0x32')]);_0x196f5a[_0xb801('0x33')]=_[_0xb801('0x47')](_0x196f5a[_0xb801('0x31')],_0x196f5a[_0xb801('0x32')]);_0x511837[_0xb801('0x34')]=_[_0xb801('0x47')](_0x196f5a[_0xb801('0x31')],qs[_0xb801('0x35')](_0x141982[_0xb801('0x32')]['fields']));_0x511837[_0xb801('0x34')]=_0x511837[_0xb801('0x34')][_0xb801('0x36')]?_0x511837['attributes']:_0x196f5a[_0xb801('0x31')];if(_0x141982[_0xb801('0x32')][_0xb801('0x48')]){_0x511837[_0xb801('0x40')]=[{'all':!![]}];}_0x511837=_['merge']({},_0x511837,_0x141982[_0xb801('0x3e')]);return db[_0xb801('0x3f')][_0xb801('0x49')](_0x511837)[_0xb801('0x27')](handleEntityNotFound(_0x3001db,null))[_0xb801('0x27')](respondWithResult(_0x3001db,null))[_0xb801('0x43')](handleError(_0x3001db,null));};exports[_0xb801('0x4a')]=function(_0x1b7139,_0x455b97){return db[_0xb801('0x3f')][_0xb801('0x4a')](_0x1b7139[_0xb801('0x4b')],{})['then'](respondWithResult(_0x455b97,0xc9))[_0xb801('0x43')](handleError(_0x455b97,null));};exports['update']=function(_0x5cf63d,_0x1ccfb2){if(_0x5cf63d[_0xb801('0x4b')]['id']){delete _0x5cf63d[_0xb801('0x4b')]['id'];}return db[_0xb801('0x3f')]['find']({'where':{'id':_0x5cf63d[_0xb801('0x45')]['id']}})[_0xb801('0x27')](handleEntityNotFound(_0x1ccfb2,null))[_0xb801('0x27')](saveUpdates(_0x5cf63d[_0xb801('0x4b')],null))['then'](respondWithResult(_0x1ccfb2,null))[_0xb801('0x43')](handleError(_0x1ccfb2,null));};exports[_0xb801('0x28')]=function(_0x10f34c,_0x1c304b){return db[_0xb801('0x3f')]['find']({'where':{'id':_0x10f34c['params']['id']}})[_0xb801('0x27')](handleEntityNotFound(_0x1c304b,null))['then'](removeEntity(_0x1c304b,null))[_0xb801('0x43')](handleError(_0x1c304b,null));};exports['describe']=function(_0x2521e6,_0x5133ad){return db[_0xb801('0x3f')][_0xb801('0x4c')]()[_0xb801('0x27')](respondWithResult(_0x5133ad,null))[_0xb801('0x43')](handleError(_0x5133ad,null));}; \ No newline at end of file +var _0x328f=['fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','then','end','name','send','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir'];(function(_0x4826fa,_0x377745){var _0x4fb132=function(_0x90bea0){while(--_0x90bea0){_0x4826fa['push'](_0x4826fa['shift']());}};_0x4fb132(++_0x377745);}(_0x328f,0x1e7));var _0xf328=function(_0x4c4037,_0x15054b){_0x4c4037=_0x4c4037-0x0;var _0x357862=_0x328f[_0x4c4037];return _0x357862;};'use strict';var emlformat=require(_0xf328('0x0'));var rimraf=require(_0xf328('0x1'));var zipdir=require(_0xf328('0x2'));var jsonpatch=require(_0xf328('0x3'));var rp=require(_0xf328('0x4'));var moment=require(_0xf328('0x5'));var BPromise=require(_0xf328('0x6'));var Mustache=require(_0xf328('0x7'));var util=require('util');var path=require(_0xf328('0x8'));var sox=require('sox');var csv=require(_0xf328('0x9'));var ejs=require(_0xf328('0xa'));var fs=require('fs');var fs_extra=require(_0xf328('0xb'));var _=require(_0xf328('0xc'));var squel=require('squel');var crypto=require(_0xf328('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf328('0xe'));var toCsv=require(_0xf328('0x9'));var querystring=require(_0xf328('0xf'));var Papa=require(_0xf328('0x10'));var Redis=require(_0xf328('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf328('0x12'));var as=require(_0xf328('0x13'));var hardwareService=require(_0xf328('0x14'));var logger=require(_0xf328('0x15'))(_0xf328('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf328('0x17'));var db=require(_0xf328('0x18'))['db'];function respondWithStatusCode(_0x21109a,_0x504de0){_0x504de0=_0x504de0||0xcc;return function(_0xe7cdfd){if(_0xe7cdfd){return _0x21109a[_0xf328('0x19')](_0x504de0);}return _0x21109a[_0xf328('0x1a')](_0x504de0)['end']();};}function respondWithResult(_0xb2c35d,_0x4a899d){_0x4a899d=_0x4a899d||0xc8;return function(_0x35d2dd){if(_0x35d2dd){return _0xb2c35d[_0xf328('0x1a')](_0x4a899d)[_0xf328('0x1b')](_0x35d2dd);}};}function respondWithFilteredResult(_0x5bd3a1,_0x4770cb){return function(_0x5d8137){if(_0x5d8137){var _0x5edc3c=typeof _0x4770cb[_0xf328('0x1c')]===_0xf328('0x1d')&&typeof _0x4770cb['limit']===_0xf328('0x1d');var _0x1c1262=_0x5d8137[_0xf328('0x1e')];var _0x435d40=_0x5edc3c?0x0:_0x4770cb[_0xf328('0x1c')];var _0x4ad2eb=_0x5edc3c?_0x5d8137[_0xf328('0x1e')]:_0x4770cb[_0xf328('0x1c')]+_0x4770cb[_0xf328('0x1f')];var _0x854dd7;if(_0x4ad2eb>=_0x1c1262){_0x4ad2eb=_0x1c1262;_0x854dd7=0xc8;}else{_0x854dd7=0xce;}_0x5bd3a1[_0xf328('0x1a')](_0x854dd7);return _0x5bd3a1['set']('Content-Range',_0x435d40+'-'+_0x4ad2eb+'/'+_0x1c1262)[_0xf328('0x1b')](_0x5d8137);}return null;};}function patchUpdates(_0x75a45d){return function(_0x39d8fc){try{jsonpatch['apply'](_0x39d8fc,_0x75a45d,!![]);}catch(_0x1902f1){return BPromise['reject'](_0x1902f1);}return _0x39d8fc['save']();};}function saveUpdates(_0x4070e1,_0x16ff69){return function(_0x7f28fc){if(_0x7f28fc){return _0x7f28fc['update'](_0x4070e1)[_0xf328('0x20')](function(_0x2ea30c){return _0x2ea30c;});}return null;};}function removeEntity(_0xa9494c,_0x42149b){return function(_0x1391a5){if(_0x1391a5){return _0x1391a5['destroy']()['then'](function(){_0xa9494c[_0xf328('0x1a')](0xcc)[_0xf328('0x21')]();});}};}function handleEntityNotFound(_0x34d1b2,_0x248b29){return function(_0x2e9ff8){if(!_0x2e9ff8){_0x34d1b2[_0xf328('0x19')](0x194);}return _0x2e9ff8;};}function handleError(_0x4fa1ed,_0x488ba2){_0x488ba2=_0x488ba2||0x1f4;return function(_0x359604){logger['error'](_0x359604['stack']);if(_0x359604[_0xf328('0x22')]){delete _0x359604['name'];}_0x4fa1ed[_0xf328('0x1a')](_0x488ba2)[_0xf328('0x23')](_0x359604);};}exports['index']=function(_0x51eecb,_0x18ef5b){var _0x274683={},_0x5d4a7b={},_0x1d5784={'count':0x0,'rows':[]};var _0x2441cf=_['map'](db[_0xf328('0x24')][_0xf328('0x25')],function(_0x4ae98e){return{'name':_0x4ae98e[_0xf328('0x26')],'type':_0x4ae98e[_0xf328('0x27')][_0xf328('0x28')]};});_0x5d4a7b[_0xf328('0x29')]=_[_0xf328('0x2a')](_0x2441cf,_0xf328('0x22'));_0x5d4a7b['query']=_['keys'](_0x51eecb[_0xf328('0x2b')]);_0x5d4a7b[_0xf328('0x2c')]=_[_0xf328('0x2d')](_0x5d4a7b[_0xf328('0x29')],_0x5d4a7b[_0xf328('0x2b')]);_0x274683['attributes']=_[_0xf328('0x2d')](_0x5d4a7b[_0xf328('0x29')],qs['fields'](_0x51eecb[_0xf328('0x2b')][_0xf328('0x2e')]));_0x274683[_0xf328('0x2f')]=_0x274683[_0xf328('0x2f')][_0xf328('0x30')]?_0x274683[_0xf328('0x2f')]:_0x5d4a7b[_0xf328('0x29')];if(!_0x51eecb[_0xf328('0x2b')][_0xf328('0x31')](_0xf328('0x32'))){_0x274683[_0xf328('0x1f')]=qs[_0xf328('0x1f')](_0x51eecb[_0xf328('0x2b')][_0xf328('0x1f')]);_0x274683[_0xf328('0x1c')]=qs[_0xf328('0x1c')](_0x51eecb['query'][_0xf328('0x1c')]);}_0x274683[_0xf328('0x33')]=qs[_0xf328('0x34')](_0x51eecb[_0xf328('0x2b')][_0xf328('0x34')]);_0x274683[_0xf328('0x35')]=qs[_0xf328('0x2c')](_[_0xf328('0x36')](_0x51eecb['query'],_0x5d4a7b[_0xf328('0x2c')]),_0x2441cf);if(_0x51eecb[_0xf328('0x2b')][_0xf328('0x37')]){_0x274683[_0xf328('0x35')]=_[_0xf328('0x38')](_0x274683[_0xf328('0x35')],{'$or':_[_0xf328('0x2a')](_0x2441cf,function(_0x54e4a4){if(_0x54e4a4[_0xf328('0x27')]!==_0xf328('0x39')){var _0x4cd0c2={};_0x4cd0c2[_0x54e4a4[_0xf328('0x22')]]={'$like':'%'+_0x51eecb[_0xf328('0x2b')][_0xf328('0x37')]+'%'};return _0x4cd0c2;}})});}_0x274683=_['merge']({},_0x274683,_0x51eecb[_0xf328('0x3a')]);var _0x1bb788={'where':_0x274683[_0xf328('0x35')]};return db['JscriptyQuestionReport'][_0xf328('0x1e')](_0x1bb788)[_0xf328('0x20')](function(_0x14c49f){_0x1d5784[_0xf328('0x1e')]=_0x14c49f;if(_0x51eecb['query']['includeAll']){_0x274683[_0xf328('0x3b')]=[{'all':!![]}];}return db[_0xf328('0x24')][_0xf328('0x3c')](_0x274683);})[_0xf328('0x20')](function(_0x385ca2){_0x1d5784[_0xf328('0x3d')]=_0x385ca2;return _0x1d5784;})['then'](respondWithFilteredResult(_0x18ef5b,_0x274683))[_0xf328('0x3e')](handleError(_0x18ef5b,null));};exports[_0xf328('0x3f')]=function(_0x50ea7f,_0x19ebe6){var _0x25f4d2={'raw':!![],'where':{'id':_0x50ea7f[_0xf328('0x40')]['id']}},_0x32de28={};_0x32de28[_0xf328('0x29')]=_[_0xf328('0x41')](db['JscriptyQuestionReport']['rawAttributes']);_0x32de28[_0xf328('0x2b')]=_[_0xf328('0x41')](_0x50ea7f[_0xf328('0x2b')]);_0x32de28[_0xf328('0x2c')]=_[_0xf328('0x2d')](_0x32de28[_0xf328('0x29')],_0x32de28['query']);_0x25f4d2['attributes']=_['intersection'](_0x32de28['model'],qs[_0xf328('0x2e')](_0x50ea7f['query'][_0xf328('0x2e')]));_0x25f4d2['attributes']=_0x25f4d2[_0xf328('0x2f')][_0xf328('0x30')]?_0x25f4d2['attributes']:_0x32de28[_0xf328('0x29')];if(_0x50ea7f[_0xf328('0x2b')]['includeAll']){_0x25f4d2[_0xf328('0x3b')]=[{'all':!![]}];}_0x25f4d2=_['merge']({},_0x25f4d2,_0x50ea7f[_0xf328('0x3a')]);return db[_0xf328('0x24')][_0xf328('0x42')](_0x25f4d2)[_0xf328('0x20')](handleEntityNotFound(_0x19ebe6,null))[_0xf328('0x20')](respondWithResult(_0x19ebe6,null))[_0xf328('0x3e')](handleError(_0x19ebe6,null));};exports[_0xf328('0x43')]=function(_0x5c667f,_0x3dbde1){return db[_0xf328('0x24')][_0xf328('0x43')](_0x5c667f['body'],{})[_0xf328('0x20')](respondWithResult(_0x3dbde1,0xc9))[_0xf328('0x3e')](handleError(_0x3dbde1,null));};exports['update']=function(_0xd0e009,_0x360704){if(_0xd0e009[_0xf328('0x44')]['id']){delete _0xd0e009[_0xf328('0x44')]['id'];}return db[_0xf328('0x24')][_0xf328('0x42')]({'where':{'id':_0xd0e009[_0xf328('0x40')]['id']}})[_0xf328('0x20')](handleEntityNotFound(_0x360704,null))[_0xf328('0x20')](saveUpdates(_0xd0e009[_0xf328('0x44')],null))[_0xf328('0x20')](respondWithResult(_0x360704,null))[_0xf328('0x3e')](handleError(_0x360704,null));};exports['destroy']=function(_0x13b606,_0x1d5566){return db[_0xf328('0x24')][_0xf328('0x42')]({'where':{'id':_0x13b606[_0xf328('0x40')]['id']}})[_0xf328('0x20')](handleEntityNotFound(_0x1d5566,null))[_0xf328('0x20')](removeEntity(_0x1d5566,null))['catch'](handleError(_0x1d5566,null));};exports['describe']=function(_0x134ac1,_0x572437){return db[_0xf328('0x24')][_0xf328('0x45')]()[_0xf328('0x20')](respondWithResult(_0x572437,null))[_0xf328('0x3e')](handleError(_0x572437,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 4f59e88..b8ca092 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 _0xa235=['JscriptyQuestionReport','report_jscripty_questions','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define'];(function(_0x44ae78,_0x30a80e){var _0x52906b=function(_0x26d2ab){while(--_0x26d2ab){_0x44ae78['push'](_0x44ae78['shift']());}};_0x52906b(++_0x30a80e);}(_0xa235,0x154));var _0x5a23=function(_0x52930a,_0x419035){_0x52930a=_0x52930a-0x0;var _0x26b0c0=_0xa235[_0x52930a];return _0x26b0c0;};'use strict';var _=require(_0x5a23('0x0'));var util=require(_0x5a23('0x1'));var logger=require('../../config/logger')(_0x5a23('0x2'));var moment=require('moment');var BPromise=require(_0x5a23('0x3'));var rp=require(_0x5a23('0x4'));var fs=require('fs');var path=require(_0x5a23('0x5'));var rimraf=require(_0x5a23('0x6'));var config=require(_0x5a23('0x7'));var attributes=require(_0x5a23('0x8'));module[_0x5a23('0x9')]=function(_0x1ddbac,_0x3e28b0){return _0x1ddbac[_0x5a23('0xa')](_0x5a23('0xb'),attributes,{'tableName':_0x5a23('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa55f=['bluebird','request-promise','path','rimraf','define','JscriptyQuestionReport','lodash','util','api','moment'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xa55f,0x100));var _0xfa55=function(_0xdaa335,_0x553984){_0xdaa335=_0xdaa335-0x0;var _0x24acc4=_0xa55f[_0xdaa335];return _0x24acc4;};'use strict';var _=require(_0xfa55('0x0'));var util=require(_0xfa55('0x1'));var logger=require('../../config/logger')(_0xfa55('0x2'));var moment=require(_0xfa55('0x3'));var BPromise=require(_0xfa55('0x4'));var rp=require(_0xfa55('0x5'));var fs=require('fs');var path=require(_0xfa55('0x6'));var rimraf=require(_0xfa55('0x7'));var config=require('../../config/environment');var attributes=require('./jscriptyQuestionReport.attributes');module['exports']=function(_0x2512df,_0x44d3ae){return _0x2512df[_0xfa55('0x8')](_0xfa55('0x9'),attributes,{'tableName':'report_jscripty_questions','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 53ca606..0539b5b 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 _0x5909=['../../config/environment','jayson/promise','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x5c034a,_0x131fd6){var _0x176d53=function(_0x1d6a20){while(--_0x1d6a20){_0x5c034a['push'](_0x5c034a['shift']());}};_0x176d53(++_0x131fd6);}(_0x5909,0xd7));var _0x9590=function(_0x45313f,_0x46caf4){_0x45313f=_0x45313f-0x0;var _0x402910=_0x5909[_0x45313f];return _0x402910;};'use strict';var _=require(_0x9590('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9590('0x1'));var rs=require(_0x9590('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9590('0x3'))['db'];var utils=require(_0x9590('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x9590('0x5'));var jayson=require(_0x9590('0x6'));var client=jayson[_0x9590('0x7')][_0x9590('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3ad1fd,_0x58b246,_0x3a8d36){return new BPromise(function(_0x1bde07,_0x19e713){return client[_0x9590('0x9')](_0x3ad1fd,_0x3a8d36)[_0x9590('0xa')](function(_0x75d7ac){logger[_0x9590('0xb')](_0x9590('0xc'),_0x58b246,_0x9590('0xd'));logger[_0x9590('0xe')](_0x9590('0xf'),_0x58b246,_0x9590('0xd'),JSON['stringify'](_0x75d7ac));if(_0x75d7ac['error']){if(_0x75d7ac[_0x9590('0x10')][_0x9590('0x11')]===0x1f4){logger[_0x9590('0x10')](_0x9590('0xc'),_0x58b246,_0x75d7ac[_0x9590('0x10')]['message']);return _0x19e713(_0x75d7ac[_0x9590('0x10')][_0x9590('0x12')]);}logger[_0x9590('0x10')](_0x9590('0xc'),_0x58b246,_0x75d7ac[_0x9590('0x10')][_0x9590('0x12')]);return _0x1bde07(_0x75d7ac[_0x9590('0x10')][_0x9590('0x12')]);}else{logger['info'](_0x9590('0xc'),_0x58b246,_0x9590('0xd'));_0x1bde07(_0x75d7ac[_0x9590('0x13')][_0x9590('0x12')]);}})['catch'](function(_0x49017e){logger[_0x9590('0x10')](_0x9590('0xc'),_0x58b246,_0x49017e);_0x19e713(_0x49017e);});});} \ No newline at end of file +var _0x1d6f=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','bluebird'];(function(_0x296068,_0x1cd54f){var _0x17a047=function(_0x4cf9be){while(--_0x4cf9be){_0x296068['push'](_0x296068['shift']());}};_0x17a047(++_0x1cd54f);}(_0x1d6f,0x1de));var _0xf1d6=function(_0x638409,_0x51ae6f){_0x638409=_0x638409-0x0;var _0x140d10=_0x1d6f[_0x638409];return _0x140d10;};'use strict';var _=require(_0xf1d6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf1d6('0x1'));var rs=require(_0xf1d6('0x2'));var fs=require('fs');var Redis=require(_0xf1d6('0x3'));var db=require(_0xf1d6('0x4'))['db'];var utils=require(_0xf1d6('0x5'));var logger=require(_0xf1d6('0x6'))('rpc');var config=require(_0xf1d6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf1d6('0x8')][_0xf1d6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e579a,_0x104cc0,_0x2d0fe9){return new BPromise(function(_0x332276,_0x149e6c){return client[_0xf1d6('0xa')](_0x5e579a,_0x2d0fe9)[_0xf1d6('0xb')](function(_0x1042a0){logger[_0xf1d6('0xc')](_0xf1d6('0xd'),_0x104cc0,_0xf1d6('0xe'));logger[_0xf1d6('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x104cc0,_0xf1d6('0xe'),JSON['stringify'](_0x1042a0));if(_0x1042a0[_0xf1d6('0x10')]){if(_0x1042a0[_0xf1d6('0x10')]['code']===0x1f4){logger[_0xf1d6('0x10')](_0xf1d6('0xd'),_0x104cc0,_0x1042a0[_0xf1d6('0x10')][_0xf1d6('0x11')]);return _0x149e6c(_0x1042a0[_0xf1d6('0x10')]['message']);}logger['error'](_0xf1d6('0xd'),_0x104cc0,_0x1042a0['error'][_0xf1d6('0x11')]);return _0x332276(_0x1042a0['error'][_0xf1d6('0x11')]);}else{logger[_0xf1d6('0xc')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x104cc0,_0xf1d6('0xe'));_0x332276(_0x1042a0[_0xf1d6('0x12')][_0xf1d6('0x11')]);}})[_0xf1d6('0x13')](function(_0xcdf973){logger[_0xf1d6('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x104cc0,_0xcdf973);_0x149e6c(_0xcdf973);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 0239b72..1afcdf2 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 _0x7497=['connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','/:id','show','getQuestions','post','create','put','update','delete','destroy','exports','util'];(function(_0x136619,_0x31c9b2){var _0x38c4a5=function(_0x10b74d){while(--_0x10b74d){_0x136619['push'](_0x136619['shift']());}};_0x38c4a5(++_0x31c9b2);}(_0x7497,0x68));var _0x7749=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7497[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x7749('0x0'));var path=require('path');var timeout=require(_0x7749('0x1'));var express=require('express');var router=express[_0x7749('0x2')]();var fs_extra=require(_0x7749('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7749('0x4'));var config=require(_0x7749('0x5'));var controller=require(_0x7749('0x6'));router[_0x7749('0x7')]('/',auth[_0x7749('0x8')](),controller[_0x7749('0x9')]);router['get'](_0x7749('0xa'),auth[_0x7749('0x8')](),controller['describe']);router[_0x7749('0x7')](_0x7749('0xb'),auth[_0x7749('0x8')](),controller[_0x7749('0xc')]);router['get']('/:id/questions',auth[_0x7749('0x8')](),controller[_0x7749('0xd')]);router[_0x7749('0xe')]('/',auth[_0x7749('0x8')](),controller[_0x7749('0xf')]);router[_0x7749('0x10')](_0x7749('0xb'),auth[_0x7749('0x8')](),controller[_0x7749('0x11')]);router[_0x7749('0x12')]('/:id',auth[_0x7749('0x8')](),controller[_0x7749('0x13')]);module[_0x7749('0x14')]=router; \ No newline at end of file +var _0x7788=['/:id/questions','getQuestions','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show'];(function(_0x48c435,_0x4a4fb4){var _0x120a4c=function(_0x391cdc){while(--_0x391cdc){_0x48c435['push'](_0x48c435['shift']());}};_0x120a4c(++_0x4a4fb4);}(_0x7788,0x1d8));var _0x8778=function(_0x571a17,_0x63fb3d){_0x571a17=_0x571a17-0x0;var _0x3ef337=_0x7788[_0x571a17];return _0x3ef337;};'use strict';var multer=require(_0x8778('0x0'));var util=require(_0x8778('0x1'));var path=require(_0x8778('0x2'));var timeout=require(_0x8778('0x3'));var express=require('express');var router=express[_0x8778('0x4')]();var fs_extra=require(_0x8778('0x5'));var auth=require(_0x8778('0x6'));var interaction=require(_0x8778('0x7'));var config=require(_0x8778('0x8'));var controller=require('./jscriptySessionReport.controller');router[_0x8778('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8778('0x9')]('/describe',auth[_0x8778('0xa')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x8778('0xb')]);router[_0x8778('0x9')](_0x8778('0xc'),auth[_0x8778('0xa')](),controller[_0x8778('0xd')]);router[_0x8778('0xe')]('/',auth['isAuthenticated'](),controller[_0x8778('0xf')]);router[_0x8778('0x10')](_0x8778('0x11'),auth[_0x8778('0xa')](),controller[_0x8778('0x12')]);router[_0x8778('0x13')](_0x8778('0x11'),auth[_0x8778('0xa')](),controller[_0x8778('0x14')]);module[_0x8778('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index ac4c398..c89082c 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 _0x956b=['endtime','format','YYYY-MM-DD\x20HH:mm:ss','DATE','STRING','BOOLEAN','moment','sequelize','setDataValue'];(function(_0x27e0ea,_0x1bad77){var _0x3ad654=function(_0x5b3301){while(--_0x5b3301){_0x27e0ea['push'](_0x27e0ea['shift']());}};_0x3ad654(++_0x1bad77);}(_0x956b,0x16e));var _0xb956=function(_0x19d1c2,_0x18096c){_0x19d1c2=_0x19d1c2-0x0;var _0x4a5128=_0x956b[_0x19d1c2];return _0x4a5128;};'use strict';var moment=require(_0xb956('0x0'));var Sequelize=require(_0xb956('0x1'));module['exports']={'starttime':{'type':Sequelize['DATE'],'set':function(_0x156ccf){this[_0xb956('0x2')]('starttime',_0x156ccf);this[_0xb956('0x2')](_0xb956('0x3'),moment()[_0xb956('0x4')](_0xb956('0x5')));}},'endtime':{'type':Sequelize[_0xb956('0x6')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0xb956('0x7')]},'queue':{'type':Sequelize[_0xb956('0x7')]},'uniqueid':{'type':Sequelize[_0xb956('0x7')]},'calleridname':{'type':Sequelize[_0xb956('0x7')]},'calleridnum':{'type':Sequelize[_0xb956('0x7')]},'completed':{'type':Sequelize[_0xb956('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x1d76=['STRING','BOOLEAN','moment','sequelize','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','DATE'];(function(_0x3bd51d,_0x3089df){var _0x468260=function(_0x506a33){while(--_0x506a33){_0x3bd51d['push'](_0x3bd51d['shift']());}};_0x468260(++_0x3089df);}(_0x1d76,0x1c4));var _0x61d7=function(_0x42bb10,_0x18c03d){_0x42bb10=_0x42bb10-0x0;var _0x2cb895=_0x1d76[_0x42bb10];return _0x2cb895;};'use strict';var moment=require(_0x61d7('0x0'));var Sequelize=require(_0x61d7('0x1'));module['exports']={'starttime':{'type':Sequelize['DATE'],'set':function(_0xf83e40){this[_0x61d7('0x2')](_0x61d7('0x3'),_0xf83e40);this[_0x61d7('0x2')](_0x61d7('0x4'),moment()[_0x61d7('0x5')](_0x61d7('0x6')));}},'endtime':{'type':Sequelize[_0x61d7('0x7')]},'membername':{'type':Sequelize[_0x61d7('0x8')]},'projectname':{'type':Sequelize[_0x61d7('0x8')]},'queue':{'type':Sequelize[_0x61d7('0x8')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x61d7('0x8')]},'completed':{'type':Sequelize[_0x61d7('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 065c980..b670826 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 _0x7635=['map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','options','includeAll','findAll','then','rows','show','include','find','catch','create','body','params','describe','getQuestions','findOne','JscriptyQuestionReport','nolimit','pick','SessionId','filter','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','count','limit','set','Content-Range','json','apply','reject','save','update','destroy','end','error','stack','name','send','index','JscriptySessionReport','rawAttributes','fieldName','key','model'];(function(_0x51ed62,_0x574379){var _0x34aee3=function(_0x2958bc){while(--_0x2958bc){_0x51ed62['push'](_0x51ed62['shift']());}};_0x34aee3(++_0x574379);}(_0x7635,0xbf));var _0x5763=function(_0x41f0df,_0x4f4c31){_0x41f0df=_0x41f0df-0x0;var _0x457d7b=_0x7635[_0x41f0df];return _0x457d7b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5763('0x0'));var jsonpatch=require(_0x5763('0x1'));var rp=require(_0x5763('0x2'));var moment=require(_0x5763('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5763('0x4'));var util=require('util');var path=require(_0x5763('0x5'));var sox=require('sox');var csv=require(_0x5763('0x6'));var ejs=require(_0x5763('0x7'));var fs=require('fs');var fs_extra=require(_0x5763('0x8'));var _=require(_0x5763('0x9'));var squel=require('squel');var crypto=require(_0x5763('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5763('0xb'));var Redis=require(_0x5763('0xc'));var authService=require(_0x5763('0xd'));var qs=require(_0x5763('0xe'));var as=require(_0x5763('0xf'));var hardwareService=require(_0x5763('0x10'));var logger=require('../../config/logger')(_0x5763('0x11'));var utils=require(_0x5763('0x12'));var config=require(_0x5763('0x13'));var licenseUtil=require(_0x5763('0x14'));var db=require(_0x5763('0x15'))['db'];function respondWithStatusCode(_0x3a0733,_0x131541){_0x131541=_0x131541||0xcc;return function(_0x58992d){if(_0x58992d){return _0x3a0733[_0x5763('0x16')](_0x131541);}return _0x3a0733[_0x5763('0x17')](_0x131541)['end']();};}function respondWithResult(_0xc011f1,_0x1a493e){_0x1a493e=_0x1a493e||0xc8;return function(_0x176e7e){if(_0x176e7e){return _0xc011f1[_0x5763('0x17')](_0x1a493e)['json'](_0x176e7e);}};}function respondWithFilteredResult(_0x306b81,_0x3039fc){return function(_0x81ebc6){if(_0x81ebc6){var _0x39ab8e=typeof _0x3039fc[_0x5763('0x18')]==='undefined'&&typeof _0x3039fc['limit']==='undefined';var _0xb1e75a=_0x81ebc6[_0x5763('0x19')];var _0x288b89=_0x39ab8e?0x0:_0x3039fc[_0x5763('0x18')];var _0x1b6edd=_0x39ab8e?_0x81ebc6['count']:_0x3039fc['offset']+_0x3039fc[_0x5763('0x1a')];var _0x501e5b;if(_0x1b6edd>=_0xb1e75a){_0x1b6edd=_0xb1e75a;_0x501e5b=0xc8;}else{_0x501e5b=0xce;}_0x306b81[_0x5763('0x17')](_0x501e5b);return _0x306b81[_0x5763('0x1b')](_0x5763('0x1c'),_0x288b89+'-'+_0x1b6edd+'/'+_0xb1e75a)[_0x5763('0x1d')](_0x81ebc6);}return null;};}function patchUpdates(_0x6e7ffd){return function(_0x3b70cb){try{jsonpatch[_0x5763('0x1e')](_0x3b70cb,_0x6e7ffd,!![]);}catch(_0x1c031f){return BPromise[_0x5763('0x1f')](_0x1c031f);}return _0x3b70cb[_0x5763('0x20')]();};}function saveUpdates(_0x4ed553,_0x525389){return function(_0x5071b9){if(_0x5071b9){return _0x5071b9[_0x5763('0x21')](_0x4ed553)['then'](function(_0x19fc5f){return _0x19fc5f;});}return null;};}function removeEntity(_0x49d3dd,_0x4c160a){return function(_0x13cb18){if(_0x13cb18){return _0x13cb18[_0x5763('0x22')]()['then'](function(){_0x49d3dd[_0x5763('0x17')](0xcc)[_0x5763('0x23')]();});}};}function handleEntityNotFound(_0x756847,_0x2245f5){return function(_0xad04e9){if(!_0xad04e9){_0x756847[_0x5763('0x16')](0x194);}return _0xad04e9;};}function handleError(_0x440331,_0x5bb9de){_0x5bb9de=_0x5bb9de||0x1f4;return function(_0x549152){logger[_0x5763('0x24')](_0x549152[_0x5763('0x25')]);if(_0x549152[_0x5763('0x26')]){delete _0x549152[_0x5763('0x26')];}_0x440331[_0x5763('0x17')](_0x5bb9de)[_0x5763('0x27')](_0x549152);};}exports[_0x5763('0x28')]=function(_0xd864ac,_0x3a237f){var _0x2c6bb1={},_0x2ae1b7={},_0x383a69={'count':0x0,'rows':[]};var _0x262bf9=_['map'](db[_0x5763('0x29')][_0x5763('0x2a')],function(_0x193b7f){return{'name':_0x193b7f[_0x5763('0x2b')],'type':_0x193b7f['type'][_0x5763('0x2c')]};});_0x2ae1b7[_0x5763('0x2d')]=_[_0x5763('0x2e')](_0x262bf9,_0x5763('0x26'));_0x2ae1b7[_0x5763('0x2f')]=_[_0x5763('0x30')](_0xd864ac[_0x5763('0x2f')]);_0x2ae1b7[_0x5763('0x31')]=_[_0x5763('0x32')](_0x2ae1b7[_0x5763('0x2d')],_0x2ae1b7[_0x5763('0x2f')]);_0x2c6bb1[_0x5763('0x33')]=_['intersection'](_0x2ae1b7[_0x5763('0x2d')],qs['fields'](_0xd864ac[_0x5763('0x2f')][_0x5763('0x34')]));_0x2c6bb1[_0x5763('0x33')]=_0x2c6bb1[_0x5763('0x33')][_0x5763('0x35')]?_0x2c6bb1['attributes']:_0x2ae1b7[_0x5763('0x2d')];if(!_0xd864ac[_0x5763('0x2f')][_0x5763('0x36')]('nolimit')){_0x2c6bb1[_0x5763('0x1a')]=qs['limit'](_0xd864ac['query']['limit']);_0x2c6bb1[_0x5763('0x18')]=qs[_0x5763('0x18')](_0xd864ac[_0x5763('0x2f')][_0x5763('0x18')]);}_0x2c6bb1[_0x5763('0x37')]=qs[_0x5763('0x38')](_0xd864ac[_0x5763('0x2f')][_0x5763('0x38')]);_0x2c6bb1[_0x5763('0x39')]=qs['filters'](_['pick'](_0xd864ac[_0x5763('0x2f')],_0x2ae1b7[_0x5763('0x31')]),_0x262bf9);if(_0xd864ac[_0x5763('0x2f')]['filter']){_0x2c6bb1[_0x5763('0x39')]=_['merge'](_0x2c6bb1[_0x5763('0x39')],{'$or':_['map'](_0x262bf9,function(_0x31b61e){if(_0x31b61e['type']!=='VIRTUAL'){var _0x4631ca={};_0x4631ca[_0x31b61e[_0x5763('0x26')]]={'$like':'%'+_0xd864ac[_0x5763('0x2f')]['filter']+'%'};return _0x4631ca;}})});}_0x2c6bb1=_[_0x5763('0x3a')]({},_0x2c6bb1,_0xd864ac[_0x5763('0x3b')]);var _0x387a4e={'where':_0x2c6bb1['where']};return db[_0x5763('0x29')][_0x5763('0x19')](_0x387a4e)['then'](function(_0x9da608){_0x383a69[_0x5763('0x19')]=_0x9da608;if(_0xd864ac[_0x5763('0x2f')][_0x5763('0x3c')]){_0x2c6bb1['include']=[{'all':!![]}];}return db[_0x5763('0x29')][_0x5763('0x3d')](_0x2c6bb1);})[_0x5763('0x3e')](function(_0x5152d9){_0x383a69[_0x5763('0x3f')]=_0x5152d9;return _0x383a69;})[_0x5763('0x3e')](respondWithFilteredResult(_0x3a237f,_0x2c6bb1))['catch'](handleError(_0x3a237f,null));};exports[_0x5763('0x40')]=function(_0x50435e,_0x2430b){var _0x3067dc={'raw':!![],'where':{'id':_0x50435e['params']['id']}},_0x4e368c={};_0x4e368c[_0x5763('0x2d')]=_[_0x5763('0x30')](db[_0x5763('0x29')][_0x5763('0x2a')]);_0x4e368c[_0x5763('0x2f')]=_['keys'](_0x50435e[_0x5763('0x2f')]);_0x4e368c[_0x5763('0x31')]=_[_0x5763('0x32')](_0x4e368c[_0x5763('0x2d')],_0x4e368c[_0x5763('0x2f')]);_0x3067dc[_0x5763('0x33')]=_[_0x5763('0x32')](_0x4e368c[_0x5763('0x2d')],qs['fields'](_0x50435e[_0x5763('0x2f')][_0x5763('0x34')]));_0x3067dc[_0x5763('0x33')]=_0x3067dc[_0x5763('0x33')][_0x5763('0x35')]?_0x3067dc['attributes']:_0x4e368c[_0x5763('0x2d')];if(_0x50435e[_0x5763('0x2f')][_0x5763('0x3c')]){_0x3067dc[_0x5763('0x41')]=[{'all':!![]}];}_0x3067dc=_[_0x5763('0x3a')]({},_0x3067dc,_0x50435e[_0x5763('0x3b')]);return db[_0x5763('0x29')][_0x5763('0x42')](_0x3067dc)[_0x5763('0x3e')](handleEntityNotFound(_0x2430b,null))[_0x5763('0x3e')](respondWithResult(_0x2430b,null))[_0x5763('0x43')](handleError(_0x2430b,null));};exports['create']=function(_0x357f7d,_0x4631f3){return db[_0x5763('0x29')][_0x5763('0x44')](_0x357f7d[_0x5763('0x45')],{})[_0x5763('0x3e')](respondWithResult(_0x4631f3,0xc9))[_0x5763('0x43')](handleError(_0x4631f3,null));};exports['update']=function(_0x338ad3,_0x373b4b){if(_0x338ad3[_0x5763('0x45')]['id']){delete _0x338ad3[_0x5763('0x45')]['id'];}return db[_0x5763('0x29')][_0x5763('0x42')]({'where':{'id':_0x338ad3[_0x5763('0x46')]['id']}})[_0x5763('0x3e')](handleEntityNotFound(_0x373b4b,null))['then'](saveUpdates(_0x338ad3[_0x5763('0x45')],null))['then'](respondWithResult(_0x373b4b,null))['catch'](handleError(_0x373b4b,null));};exports[_0x5763('0x22')]=function(_0x140e79,_0x12264c){return db[_0x5763('0x29')][_0x5763('0x42')]({'where':{'id':_0x140e79[_0x5763('0x46')]['id']}})['then'](handleEntityNotFound(_0x12264c,null))[_0x5763('0x3e')](removeEntity(_0x12264c,null))[_0x5763('0x43')](handleError(_0x12264c,null));};exports[_0x5763('0x47')]=function(_0x2f0383,_0x230999){return db['JscriptySessionReport'][_0x5763('0x47')]()[_0x5763('0x3e')](respondWithResult(_0x230999,null))[_0x5763('0x43')](handleError(_0x230999,null));};exports[_0x5763('0x48')]=function(_0x251061,_0x566874,_0x4346cb){var _0x1c6e82={'raw':!![],'where':{}};var _0x42b6b3={};var _0x157598={'count':0x0,'rows':[]};return db[_0x5763('0x29')][_0x5763('0x49')]({'where':{'id':_0x251061[_0x5763('0x46')]['id']}})[_0x5763('0x3e')](handleEntityNotFound(_0x566874,null))[_0x5763('0x3e')](function(_0x42d9d5){if(_0x42d9d5){_0x42b6b3[_0x5763('0x2d')]=_[_0x5763('0x30')](db[_0x5763('0x4a')]['rawAttributes']);_0x42b6b3['query']=_[_0x5763('0x30')](_0x251061[_0x5763('0x2f')]);_0x42b6b3['filters']=_[_0x5763('0x32')](_0x42b6b3[_0x5763('0x2d')],_0x42b6b3[_0x5763('0x2f')]);_0x1c6e82[_0x5763('0x33')]=_[_0x5763('0x32')](_0x42b6b3[_0x5763('0x2d')],qs[_0x5763('0x34')](_0x251061[_0x5763('0x2f')]['fields']));_0x1c6e82[_0x5763('0x33')]=_0x1c6e82[_0x5763('0x33')][_0x5763('0x35')]?_0x1c6e82[_0x5763('0x33')]:_0x42b6b3[_0x5763('0x2d')];if(!_0x251061[_0x5763('0x2f')]['hasOwnProperty'](_0x5763('0x4b'))){_0x1c6e82[_0x5763('0x1a')]=qs['limit'](_0x251061[_0x5763('0x2f')][_0x5763('0x1a')]);_0x1c6e82[_0x5763('0x18')]=qs[_0x5763('0x18')](_0x251061[_0x5763('0x2f')]['offset']);}_0x1c6e82[_0x5763('0x37')]=qs[_0x5763('0x38')](_0x251061[_0x5763('0x2f')][_0x5763('0x38')]);_0x1c6e82[_0x5763('0x39')]=qs[_0x5763('0x31')](_[_0x5763('0x4c')](_0x251061[_0x5763('0x2f')],_0x42b6b3['filters']));_0x1c6e82['where'][_0x5763('0x4d')]=_0x42d9d5['id'];if(_0x251061[_0x5763('0x2f')][_0x5763('0x4e')]){_0x1c6e82[_0x5763('0x39')]=_[_0x5763('0x3a')](_0x1c6e82[_0x5763('0x39')],{'$or':_[_0x5763('0x2e')](_0x1c6e82[_0x5763('0x33')],function(_0x48e39d){var _0x5c2869={};_0x5c2869[_0x48e39d]={'$like':'%'+_0x251061[_0x5763('0x2f')]['filter']+'%'};return _0x5c2869;})});}_0x1c6e82=_[_0x5763('0x3a')]({},_0x1c6e82,_0x251061[_0x5763('0x3b')]);return db[_0x5763('0x4a')][_0x5763('0x19')]({'where':_0x1c6e82['where']})['then'](function(_0xb30e52){_0x157598[_0x5763('0x19')]=_0xb30e52;if(_0x251061['query'][_0x5763('0x3c')]){_0x1c6e82[_0x5763('0x41')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x5763('0x3d')](_0x1c6e82);})['then'](function(_0x14f63f){_0x157598[_0x5763('0x3f')]=_0x14f63f;return _0x157598;});}})[_0x5763('0x3e')](respondWithFilteredResult(_0x566874,_0x1c6e82))[_0x5763('0x43')](handleError(_0x566874,null));}; \ No newline at end of file +var _0xa1ac=['json','limit','undefined','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','type','filter','merge','options','count','includeAll','include','findAll','catch','show','params','keys','find','create','body','describe','findOne','JscriptyQuestionReport','length','SessionId','rows','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end'];(function(_0x34dad8,_0x504fe2){var _0x5526f1=function(_0x25518c){while(--_0x25518c){_0x34dad8['push'](_0x34dad8['shift']());}};_0x5526f1(++_0x504fe2);}(_0xa1ac,0x88));var _0xca1a=function(_0x4a05eb,_0x4d1630){_0x4a05eb=_0x4a05eb-0x0;var _0xce9673=_0xa1ac[_0x4a05eb];return _0xce9673;};'use strict';var emlformat=require(_0xca1a('0x0'));var rimraf=require(_0xca1a('0x1'));var zipdir=require(_0xca1a('0x2'));var jsonpatch=require(_0xca1a('0x3'));var rp=require('request-promise');var moment=require(_0xca1a('0x4'));var BPromise=require(_0xca1a('0x5'));var Mustache=require(_0xca1a('0x6'));var util=require(_0xca1a('0x7'));var path=require(_0xca1a('0x8'));var sox=require('sox');var csv=require(_0xca1a('0x9'));var ejs=require(_0xca1a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xca1a('0xb'));var squel=require(_0xca1a('0xc'));var crypto=require(_0xca1a('0xd'));var jsforce=require(_0xca1a('0xe'));var deskjs=require(_0xca1a('0xf'));var toCsv=require('to-csv');var querystring=require(_0xca1a('0x10'));var Papa=require(_0xca1a('0x11'));var Redis=require(_0xca1a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xca1a('0x13'));var as=require(_0xca1a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xca1a('0x15'))('api');var utils=require(_0xca1a('0x16'));var config=require(_0xca1a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xca1a('0x18'))['db'];function respondWithStatusCode(_0x41d81,_0x5594b6){_0x5594b6=_0x5594b6||0xcc;return function(_0x681a80){if(_0x681a80){return _0x41d81[_0xca1a('0x19')](_0x5594b6);}return _0x41d81[_0xca1a('0x1a')](_0x5594b6)[_0xca1a('0x1b')]();};}function respondWithResult(_0x3845f5,_0x320c38){_0x320c38=_0x320c38||0xc8;return function(_0x58c8a8){if(_0x58c8a8){return _0x3845f5[_0xca1a('0x1a')](_0x320c38)[_0xca1a('0x1c')](_0x58c8a8);}};}function respondWithFilteredResult(_0x30df6a,_0x3951a5){return function(_0x1cd4e1){if(_0x1cd4e1){var _0x4eab9e=typeof _0x3951a5['offset']==='undefined'&&typeof _0x3951a5[_0xca1a('0x1d')]===_0xca1a('0x1e');var _0x598db3=_0x1cd4e1['count'];var _0x2298bc=_0x4eab9e?0x0:_0x3951a5[_0xca1a('0x1f')];var _0x14be44=_0x4eab9e?_0x1cd4e1['count']:_0x3951a5[_0xca1a('0x1f')]+_0x3951a5['limit'];var _0x3977c3;if(_0x14be44>=_0x598db3){_0x14be44=_0x598db3;_0x3977c3=0xc8;}else{_0x3977c3=0xce;}_0x30df6a[_0xca1a('0x1a')](_0x3977c3);return _0x30df6a[_0xca1a('0x20')](_0xca1a('0x21'),_0x2298bc+'-'+_0x14be44+'/'+_0x598db3)[_0xca1a('0x1c')](_0x1cd4e1);}return null;};}function patchUpdates(_0x5045c4){return function(_0x314010){try{jsonpatch[_0xca1a('0x22')](_0x314010,_0x5045c4,!![]);}catch(_0x40cbd8){return BPromise[_0xca1a('0x23')](_0x40cbd8);}return _0x314010[_0xca1a('0x24')]();};}function saveUpdates(_0x8094ff,_0x22d6d9){return function(_0x2e061c){if(_0x2e061c){return _0x2e061c[_0xca1a('0x25')](_0x8094ff)['then'](function(_0x18be85){return _0x18be85;});}return null;};}function removeEntity(_0x4c663e,_0xe898a0){return function(_0x3bbae2){if(_0x3bbae2){return _0x3bbae2[_0xca1a('0x26')]()[_0xca1a('0x27')](function(){_0x4c663e['status'](0xcc)[_0xca1a('0x1b')]();});}};}function handleEntityNotFound(_0x46054f,_0x9d4ce){return function(_0x4e0533){if(!_0x4e0533){_0x46054f['sendStatus'](0x194);}return _0x4e0533;};}function handleError(_0x5621b8,_0x47990f){_0x47990f=_0x47990f||0x1f4;return function(_0x1054f6){logger[_0xca1a('0x28')](_0x1054f6[_0xca1a('0x29')]);if(_0x1054f6[_0xca1a('0x2a')]){delete _0x1054f6['name'];}_0x5621b8['status'](_0x47990f)[_0xca1a('0x2b')](_0x1054f6);};}exports[_0xca1a('0x2c')]=function(_0x2497c7,_0x2d76ce){var _0x3a217e={},_0x26f737={},_0x3380b4={'count':0x0,'rows':[]};var _0x328203=_[_0xca1a('0x2d')](db[_0xca1a('0x2e')][_0xca1a('0x2f')],function(_0xda0193){return{'name':_0xda0193['fieldName'],'type':_0xda0193['type'][_0xca1a('0x30')]};});_0x26f737[_0xca1a('0x31')]=_[_0xca1a('0x2d')](_0x328203,'name');_0x26f737[_0xca1a('0x32')]=_['keys'](_0x2497c7[_0xca1a('0x32')]);_0x26f737[_0xca1a('0x33')]=_[_0xca1a('0x34')](_0x26f737[_0xca1a('0x31')],_0x26f737[_0xca1a('0x32')]);_0x3a217e[_0xca1a('0x35')]=_[_0xca1a('0x34')](_0x26f737[_0xca1a('0x31')],qs[_0xca1a('0x36')](_0x2497c7[_0xca1a('0x32')]['fields']));_0x3a217e[_0xca1a('0x35')]=_0x3a217e[_0xca1a('0x35')]['length']?_0x3a217e[_0xca1a('0x35')]:_0x26f737[_0xca1a('0x31')];if(!_0x2497c7['query'][_0xca1a('0x37')](_0xca1a('0x38'))){_0x3a217e[_0xca1a('0x1d')]=qs['limit'](_0x2497c7[_0xca1a('0x32')]['limit']);_0x3a217e[_0xca1a('0x1f')]=qs[_0xca1a('0x1f')](_0x2497c7[_0xca1a('0x32')][_0xca1a('0x1f')]);}_0x3a217e[_0xca1a('0x39')]=qs[_0xca1a('0x3a')](_0x2497c7[_0xca1a('0x32')][_0xca1a('0x3a')]);_0x3a217e[_0xca1a('0x3b')]=qs[_0xca1a('0x33')](_[_0xca1a('0x3c')](_0x2497c7[_0xca1a('0x32')],_0x26f737[_0xca1a('0x33')]),_0x328203);if(_0x2497c7[_0xca1a('0x32')]['filter']){_0x3a217e[_0xca1a('0x3b')]=_['merge'](_0x3a217e[_0xca1a('0x3b')],{'$or':_[_0xca1a('0x2d')](_0x328203,function(_0x1e0c3f){if(_0x1e0c3f[_0xca1a('0x3d')]!=='VIRTUAL'){var _0x2ea581={};_0x2ea581[_0x1e0c3f[_0xca1a('0x2a')]]={'$like':'%'+_0x2497c7[_0xca1a('0x32')][_0xca1a('0x3e')]+'%'};return _0x2ea581;}})});}_0x3a217e=_[_0xca1a('0x3f')]({},_0x3a217e,_0x2497c7[_0xca1a('0x40')]);var _0xb8f34d={'where':_0x3a217e[_0xca1a('0x3b')]};return db['JscriptySessionReport'][_0xca1a('0x41')](_0xb8f34d)[_0xca1a('0x27')](function(_0x53fbcd){_0x3380b4[_0xca1a('0x41')]=_0x53fbcd;if(_0x2497c7[_0xca1a('0x32')][_0xca1a('0x42')]){_0x3a217e[_0xca1a('0x43')]=[{'all':!![]}];}return db[_0xca1a('0x2e')][_0xca1a('0x44')](_0x3a217e);})[_0xca1a('0x27')](function(_0x5d2efc){_0x3380b4['rows']=_0x5d2efc;return _0x3380b4;})['then'](respondWithFilteredResult(_0x2d76ce,_0x3a217e))[_0xca1a('0x45')](handleError(_0x2d76ce,null));};exports[_0xca1a('0x46')]=function(_0x5642f6,_0x4ce204){var _0x1bbe5e={'raw':!![],'where':{'id':_0x5642f6[_0xca1a('0x47')]['id']}},_0x209d43={};_0x209d43[_0xca1a('0x31')]=_[_0xca1a('0x48')](db[_0xca1a('0x2e')][_0xca1a('0x2f')]);_0x209d43[_0xca1a('0x32')]=_[_0xca1a('0x48')](_0x5642f6[_0xca1a('0x32')]);_0x209d43[_0xca1a('0x33')]=_['intersection'](_0x209d43[_0xca1a('0x31')],_0x209d43[_0xca1a('0x32')]);_0x1bbe5e[_0xca1a('0x35')]=_[_0xca1a('0x34')](_0x209d43['model'],qs['fields'](_0x5642f6[_0xca1a('0x32')]['fields']));_0x1bbe5e[_0xca1a('0x35')]=_0x1bbe5e[_0xca1a('0x35')]['length']?_0x1bbe5e[_0xca1a('0x35')]:_0x209d43[_0xca1a('0x31')];if(_0x5642f6[_0xca1a('0x32')][_0xca1a('0x42')]){_0x1bbe5e[_0xca1a('0x43')]=[{'all':!![]}];}_0x1bbe5e=_[_0xca1a('0x3f')]({},_0x1bbe5e,_0x5642f6[_0xca1a('0x40')]);return db[_0xca1a('0x2e')][_0xca1a('0x49')](_0x1bbe5e)[_0xca1a('0x27')](handleEntityNotFound(_0x4ce204,null))[_0xca1a('0x27')](respondWithResult(_0x4ce204,null))[_0xca1a('0x45')](handleError(_0x4ce204,null));};exports[_0xca1a('0x4a')]=function(_0x54731f,_0x3af910){return db[_0xca1a('0x2e')][_0xca1a('0x4a')](_0x54731f[_0xca1a('0x4b')],{})['then'](respondWithResult(_0x3af910,0xc9))[_0xca1a('0x45')](handleError(_0x3af910,null));};exports[_0xca1a('0x25')]=function(_0x5646b9,_0x18cb25){if(_0x5646b9['body']['id']){delete _0x5646b9[_0xca1a('0x4b')]['id'];}return db[_0xca1a('0x2e')][_0xca1a('0x49')]({'where':{'id':_0x5646b9[_0xca1a('0x47')]['id']}})[_0xca1a('0x27')](handleEntityNotFound(_0x18cb25,null))[_0xca1a('0x27')](saveUpdates(_0x5646b9['body'],null))[_0xca1a('0x27')](respondWithResult(_0x18cb25,null))[_0xca1a('0x45')](handleError(_0x18cb25,null));};exports[_0xca1a('0x26')]=function(_0x141ea4,_0x1f476e){return db[_0xca1a('0x2e')]['find']({'where':{'id':_0x141ea4['params']['id']}})[_0xca1a('0x27')](handleEntityNotFound(_0x1f476e,null))[_0xca1a('0x27')](removeEntity(_0x1f476e,null))[_0xca1a('0x45')](handleError(_0x1f476e,null));};exports[_0xca1a('0x4c')]=function(_0x3924bf,_0x388eac){return db[_0xca1a('0x2e')][_0xca1a('0x4c')]()['then'](respondWithResult(_0x388eac,null))[_0xca1a('0x45')](handleError(_0x388eac,null));};exports['getQuestions']=function(_0x2aef77,_0x11c4a9,_0x2a5597){var _0x5e7a4d={'raw':!![],'where':{}};var _0x26d186={};var _0x269ec3={'count':0x0,'rows':[]};return db[_0xca1a('0x2e')][_0xca1a('0x4d')]({'where':{'id':_0x2aef77[_0xca1a('0x47')]['id']}})[_0xca1a('0x27')](handleEntityNotFound(_0x11c4a9,null))[_0xca1a('0x27')](function(_0x32d859){if(_0x32d859){_0x26d186[_0xca1a('0x31')]=_[_0xca1a('0x48')](db[_0xca1a('0x4e')]['rawAttributes']);_0x26d186[_0xca1a('0x32')]=_['keys'](_0x2aef77[_0xca1a('0x32')]);_0x26d186[_0xca1a('0x33')]=_[_0xca1a('0x34')](_0x26d186[_0xca1a('0x31')],_0x26d186[_0xca1a('0x32')]);_0x5e7a4d[_0xca1a('0x35')]=_['intersection'](_0x26d186[_0xca1a('0x31')],qs[_0xca1a('0x36')](_0x2aef77[_0xca1a('0x32')][_0xca1a('0x36')]));_0x5e7a4d[_0xca1a('0x35')]=_0x5e7a4d[_0xca1a('0x35')][_0xca1a('0x4f')]?_0x5e7a4d['attributes']:_0x26d186[_0xca1a('0x31')];if(!_0x2aef77['query']['hasOwnProperty'](_0xca1a('0x38'))){_0x5e7a4d['limit']=qs[_0xca1a('0x1d')](_0x2aef77[_0xca1a('0x32')][_0xca1a('0x1d')]);_0x5e7a4d[_0xca1a('0x1f')]=qs[_0xca1a('0x1f')](_0x2aef77['query'][_0xca1a('0x1f')]);}_0x5e7a4d[_0xca1a('0x39')]=qs['sort'](_0x2aef77[_0xca1a('0x32')][_0xca1a('0x3a')]);_0x5e7a4d[_0xca1a('0x3b')]=qs[_0xca1a('0x33')](_[_0xca1a('0x3c')](_0x2aef77[_0xca1a('0x32')],_0x26d186[_0xca1a('0x33')]));_0x5e7a4d[_0xca1a('0x3b')][_0xca1a('0x50')]=_0x32d859['id'];if(_0x2aef77['query']['filter']){_0x5e7a4d[_0xca1a('0x3b')]=_[_0xca1a('0x3f')](_0x5e7a4d[_0xca1a('0x3b')],{'$or':_[_0xca1a('0x2d')](_0x5e7a4d['attributes'],function(_0x44bee7){var _0x4c124e={};_0x4c124e[_0x44bee7]={'$like':'%'+_0x2aef77[_0xca1a('0x32')][_0xca1a('0x3e')]+'%'};return _0x4c124e;})});}_0x5e7a4d=_[_0xca1a('0x3f')]({},_0x5e7a4d,_0x2aef77[_0xca1a('0x40')]);return db[_0xca1a('0x4e')][_0xca1a('0x41')]({'where':_0x5e7a4d[_0xca1a('0x3b')]})[_0xca1a('0x27')](function(_0x463ef2){_0x269ec3[_0xca1a('0x41')]=_0x463ef2;if(_0x2aef77['query'][_0xca1a('0x42')]){_0x5e7a4d[_0xca1a('0x43')]=[{'all':!![]}];}return db[_0xca1a('0x4e')]['findAll'](_0x5e7a4d);})['then'](function(_0x1ae543){_0x269ec3[_0xca1a('0x51')]=_0x1ae543;return _0x269ec3;});}})[_0xca1a('0x27')](respondWithFilteredResult(_0x11c4a9,_0x5e7a4d))[_0xca1a('0x45')](handleError(_0x11c4a9,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 4ae41fa..30bdbc5 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 _0x6050=['../../config/environment','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x21185f,_0x2259c9){var _0xaaf1eb=function(_0xb5440d){while(--_0xb5440d){_0x21185f['push'](_0x21185f['shift']());}};_0xaaf1eb(++_0x2259c9);}(_0x6050,0x196));var _0x0605=function(_0x385cf7,_0x39755f){_0x385cf7=_0x385cf7-0x0;var _0x2c67b3=_0x6050[_0x385cf7];return _0x2c67b3;};'use strict';var _=require(_0x0605('0x0'));var util=require(_0x0605('0x1'));var logger=require(_0x0605('0x2'))(_0x0605('0x3'));var moment=require(_0x0605('0x4'));var BPromise=require(_0x0605('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0605('0x6'));var rimraf=require(_0x0605('0x7'));var config=require(_0x0605('0x8'));var attributes=require('./jscriptySessionReport.attributes');module['exports']=function(_0x4aca21,_0xd78d96){return _0x4aca21['define']('JscriptySessionReport',attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x187d=['define','JscriptySessionReport','report_jscripty_sessions','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./jscriptySessionReport.attributes'];(function(_0x5cb2ae,_0x25c9ad){var _0x1edf42=function(_0x2838e9){while(--_0x2838e9){_0x5cb2ae['push'](_0x5cb2ae['shift']());}};_0x1edf42(++_0x25c9ad);}(_0x187d,0x93));var _0xd187=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x187d[_0x4709c0];return _0x13348b;};'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 diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index b04f58b..fe6a46c 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 _0x187d=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x97e568,_0x3e9f1c){var _0x3505ac=function(_0x103faa){while(--_0x103faa){_0x97e568['push'](_0x97e568['shift']());}};_0x3505ac(++_0x3e9f1c);}(_0x187d,0x93));var _0xd187=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x187d[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var moment=require(_0xd187('0x1'));var BPromise=require(_0xd187('0x2'));var rs=require(_0xd187('0x3'));var fs=require('fs');var Redis=require(_0xd187('0x4'));var db=require(_0xd187('0x5'))['db'];var utils=require(_0xd187('0x6'));var logger=require('../../config/logger')(_0xd187('0x7'));var config=require(_0xd187('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd187('0x9')][_0xd187('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x444a60,_0x1d3fe4,_0x28ce2f){return new BPromise(function(_0x2d6992,_0x358c45){return client[_0xd187('0xb')](_0x444a60,_0x28ce2f)['then'](function(_0x342539){logger[_0xd187('0xc')](_0xd187('0xd'),_0x1d3fe4,_0xd187('0xe'));logger[_0xd187('0xf')](_0xd187('0x10'),_0x1d3fe4,'request\x20sent',JSON[_0xd187('0x11')](_0x342539));if(_0x342539[_0xd187('0x12')]){if(_0x342539[_0xd187('0x12')]['code']===0x1f4){logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539[_0xd187('0x12')]['message']);return _0x358c45(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539['error'][_0xd187('0x13')]);return _0x2d6992(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}else{logger[_0xd187('0xc')]('JscriptySessionReport,\x20%s,\x20%s',_0x1d3fe4,_0xd187('0xe'));_0x2d6992(_0x342539['result']['message']);}})[_0xd187('0x14')](function(_0x5a4986){logger['error'](_0xd187('0xd'),_0x1d3fe4,_0x5a4986);_0x358c45(_0x5a4986);});});} \ No newline at end of file +var _0x7046=['result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x155572,_0x156aed){var _0x3c51b6=function(_0x35de13){while(--_0x35de13){_0x155572['push'](_0x155572['shift']());}};_0x3c51b6(++_0x156aed);}(_0x7046,0x144));var _0x6704=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x7046[_0x46698a];return _0x356db0;};'use strict';var _=require(_0x6704('0x0'));var util=require(_0x6704('0x1'));var moment=require(_0x6704('0x2'));var BPromise=require(_0x6704('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6704('0x4'));var db=require(_0x6704('0x5'))['db'];var utils=require(_0x6704('0x6'));var logger=require('../../config/logger')(_0x6704('0x7'));var config=require(_0x6704('0x8'));var jayson=require(_0x6704('0x9'));var client=jayson[_0x6704('0xa')][_0x6704('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4badf8,_0x5ced8,_0x49b8b6){return new BPromise(function(_0x56b1ff,_0x390ace){return client['request'](_0x4badf8,_0x49b8b6)['then'](function(_0x3ca599){logger[_0x6704('0xc')](_0x6704('0xd'),_0x5ced8,_0x6704('0xe'));logger[_0x6704('0xf')](_0x6704('0x10'),_0x5ced8,_0x6704('0xe'),JSON[_0x6704('0x11')](_0x3ca599));if(_0x3ca599['error']){if(_0x3ca599[_0x6704('0x12')][_0x6704('0x13')]===0x1f4){logger['error'](_0x6704('0xd'),_0x5ced8,_0x3ca599[_0x6704('0x12')][_0x6704('0x14')]);return _0x390ace(_0x3ca599[_0x6704('0x12')][_0x6704('0x14')]);}logger[_0x6704('0x12')](_0x6704('0xd'),_0x5ced8,_0x3ca599[_0x6704('0x12')][_0x6704('0x14')]);return _0x56b1ff(_0x3ca599['error'][_0x6704('0x14')]);}else{logger[_0x6704('0xc')](_0x6704('0xd'),_0x5ced8,'request\x20sent');_0x56b1ff(_0x3ca599[_0x6704('0x15')][_0x6704('0x14')]);}})[_0x6704('0x16')](function(_0x29fa46){logger[_0x6704('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x5ced8,_0x29fa46);_0x390ace(_0x29fa46);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 5bb3140..2a18ecd 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 _0x3074=['fs-extra','../../components/interaction/service','../../config/environment','get','index','put','isAuthenticated','update','exports','multer','path','connect-timeout','express'];(function(_0x211632,_0x378e2e){var _0x5a1da1=function(_0x44aff2){while(--_0x44aff2){_0x211632['push'](_0x211632['shift']());}};_0x5a1da1(++_0x378e2e);}(_0x3074,0x1dd));var _0x4307=function(_0x22d876,_0x1b2c90){_0x22d876=_0x22d876-0x0;var _0xf74576=_0x3074[_0x22d876];return _0xf74576;};'use strict';var multer=require(_0x4307('0x0'));var util=require('util');var path=require(_0x4307('0x1'));var timeout=require(_0x4307('0x2'));var express=require(_0x4307('0x3'));var router=express['Router']();var fs_extra=require(_0x4307('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4307('0x5'));var config=require(_0x4307('0x6'));var controller=require('./license.controller');router[_0x4307('0x7')]('/',controller[_0x4307('0x8')]);router[_0x4307('0x9')]('/:id',auth[_0x4307('0xa')](),controller[_0x4307('0xb')]);module[_0x4307('0xc')]=router; \ No newline at end of file +var _0xb42d=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./license.controller','index','put','/:id','update','multer'];(function(_0x343dc3,_0x46b7c9){var _0x1b0907=function(_0x409358){while(--_0x409358){_0x343dc3['push'](_0x343dc3['shift']());}};_0x1b0907(++_0x46b7c9);}(_0xb42d,0x1ed));var _0xdb42=function(_0x462669,_0x32da49){_0x462669=_0x462669-0x0;var _0x423c63=_0xb42d[_0x462669];return _0x423c63;};'use strict';var multer=require(_0xdb42('0x0'));var util=require(_0xdb42('0x1'));var path=require(_0xdb42('0x2'));var timeout=require(_0xdb42('0x3'));var express=require(_0xdb42('0x4'));var router=express[_0xdb42('0x5')]();var fs_extra=require(_0xdb42('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xdb42('0x7'));var config=require('../../config/environment');var controller=require(_0xdb42('0x8'));router['get']('/',controller[_0xdb42('0x9')]);router[_0xdb42('0xa')](_0xdb42('0xb'),auth['isAuthenticated'](),controller[_0xdb42('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 a33979a..df9db16 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 _0x2d09=['sequelize','exports','STRING','INTEGER'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x2d09,0x134));var _0x92d0=function(_0x45efd5,_0x107501){_0x45efd5=_0x45efd5-0x0;var _0x4f04ff=_0x2d09[_0x45efd5];return _0x4f04ff;};'use strict';var Sequelize=require(_0x92d0('0x0'));module[_0x92d0('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0x92d0('0x2')]},'data2':{'type':Sequelize[_0x92d0('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x92d0('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9b8f=['INTEGER','exports'];(function(_0x53d816,_0x1d1594){var _0x17c9ed=function(_0x5ad6b4){while(--_0x5ad6b4){_0x53d816['push'](_0x53d816['shift']());}};_0x17c9ed(++_0x1d1594);}(_0x9b8f,0x1f1));var _0xf9b8=function(_0x65f58f,_0x1a55f7){_0x65f58f=_0x65f58f-0x0;var _0x206bf3=_0x9b8f[_0x65f58f];return _0x206bf3;};'use strict';var Sequelize=require('sequelize');module[_0xf9b8('0x0')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0xf9b8('0x1')],'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 6781dfe..bf40036 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 _0x0295=['demo','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','stack','name','send','../../config/license/util','model','keys','rawAttributes','query','filters','intersection','attributes','fields','merge','options','catch','body','License','find','checkLicense','key'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0x0295,0x1f0));var _0x5029=function(_0x1b4057,_0x58212a){_0x1b4057=_0x1b4057-0x0;var _0x1d749a=_0x0295[_0x1b4057];return _0x1d749a;};'use strict';var emlformat=require(_0x5029('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5029('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5029('0x2'));var Mustache=require(_0x5029('0x3'));var util=require(_0x5029('0x4'));var path=require(_0x5029('0x5'));var sox=require(_0x5029('0x6'));var csv=require(_0x5029('0x7'));var ejs=require(_0x5029('0x8'));var fs=require('fs');var fs_extra=require(_0x5029('0x9'));var _=require(_0x5029('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5029('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5029('0xc'));var Papa=require('papaparse');var Redis=require(_0x5029('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5029('0xe'));var as=require(_0x5029('0xf'));var hardwareService=require(_0x5029('0x10'));var logger=require('../../config/logger')(_0x5029('0x11'));var utils=require(_0x5029('0x12'));var config=require(_0x5029('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5029('0x14'))['db'];function respondWithStatusCode(_0x2442b2,_0x4cced9){_0x4cced9=_0x4cced9||0xcc;return function(_0x4fa22d){if(_0x4fa22d){return _0x2442b2['sendStatus'](_0x4cced9);}return _0x2442b2['status'](_0x4cced9)[_0x5029('0x15')]();};}function respondWithResult(_0x2e0369,_0x12c237){_0x12c237=_0x12c237||0xc8;return function(_0x434630){if(_0x434630){return _0x2e0369[_0x5029('0x16')](_0x12c237)[_0x5029('0x17')](_0x434630);}};}function respondWithFilteredResult(_0xe278b7,_0x317c20){return function(_0x10bf55){if(_0x10bf55){var _0x326923=typeof _0x317c20[_0x5029('0x18')]===_0x5029('0x19')&&typeof _0x317c20[_0x5029('0x1a')]===_0x5029('0x19');var _0x343918=_0x10bf55['count'];var _0x1ed567=_0x326923?0x0:_0x317c20[_0x5029('0x18')];var _0x35de81=_0x326923?_0x10bf55[_0x5029('0x1b')]:_0x317c20[_0x5029('0x18')]+_0x317c20[_0x5029('0x1a')];var _0xaba461;if(_0x35de81>=_0x343918){_0x35de81=_0x343918;_0xaba461=0xc8;}else{_0xaba461=0xce;}_0xe278b7['status'](_0xaba461);return _0xe278b7[_0x5029('0x1c')]('Content-Range',_0x1ed567+'-'+_0x35de81+'/'+_0x343918)[_0x5029('0x17')](_0x10bf55);}return null;};}function patchUpdates(_0x8a414c){return function(_0x2710aa){try{jsonpatch[_0x5029('0x1d')](_0x2710aa,_0x8a414c,!![]);}catch(_0x4b5854){return BPromise['reject'](_0x4b5854);}return _0x2710aa[_0x5029('0x1e')]();};}function saveUpdates(_0x4a49b6,_0x3f657d){return function(_0x853a34){if(_0x853a34){return _0x853a34[_0x5029('0x1f')](_0x4a49b6)[_0x5029('0x20')](function(_0x16bd22){return _0x16bd22;});}return null;};}function removeEntity(_0x3a3e52,_0x125c26){return function(_0x356dac){if(_0x356dac){return _0x356dac[_0x5029('0x21')]()['then'](function(){_0x3a3e52['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x588d90,_0x45666c){return function(_0x51093c){if(!_0x51093c){_0x588d90['sendStatus'](0x194);}return _0x51093c;};}function handleError(_0x181da0,_0x1e7e61){_0x1e7e61=_0x1e7e61||0x1f4;return function(_0x36d810){logger['error'](_0x36d810[_0x5029('0x22')]);if(_0x36d810[_0x5029('0x23')]){delete _0x36d810['name'];}_0x181da0[_0x5029('0x16')](_0x1e7e61)[_0x5029('0x24')](_0x36d810);};}var utilLicense=require(_0x5029('0x25'));exports['index']=function(_0x32da06,_0x251f99){var _0xe5313e={'raw':!![],'where':{'id':0x1}},_0x4b6f92={};_0x4b6f92[_0x5029('0x26')]=_[_0x5029('0x27')](db['License'][_0x5029('0x28')]);_0x4b6f92[_0x5029('0x29')]=_[_0x5029('0x27')](_0x32da06[_0x5029('0x29')]);_0x4b6f92[_0x5029('0x2a')]=_[_0x5029('0x2b')](_0x4b6f92[_0x5029('0x26')],_0x4b6f92[_0x5029('0x29')]);_0xe5313e[_0x5029('0x2c')]=_[_0x5029('0x2b')](_0x4b6f92[_0x5029('0x26')],qs[_0x5029('0x2d')](_0x32da06['query'][_0x5029('0x2d')]));_0xe5313e['attributes']=_0xe5313e[_0x5029('0x2c')]['length']?_0xe5313e['attributes']:_0x4b6f92[_0x5029('0x26')];_0xe5313e=_[_0x5029('0x2e')]({},_0xe5313e,_0x32da06[_0x5029('0x2f')]);return utilLicense['getLicense'](_0xe5313e)[_0x5029('0x20')](respondWithResult(_0x251f99,null))[_0x5029('0x30')](handleError(_0x251f99,null));};exports[_0x5029('0x1f')]=function(_0x29c59a,_0x1bb896){if(_0x29c59a[_0x5029('0x31')]['id']){delete _0x29c59a[_0x5029('0x31')]['id'];}return db[_0x5029('0x32')][_0x5029('0x33')]({'where':{'id':_0x29c59a['params']['id']}})[_0x5029('0x20')](handleEntityNotFound(_0x1bb896,null))[_0x5029('0x20')](function(_0xc110e8){var _0x1b3817=_0xc110e8['get']({'plain':!![]});return utilLicense[_0x5029('0x34')](_0x1b3817,_0x29c59a[_0x5029('0x31')][_0x5029('0x35')]);})['then'](function(_0x4904cc){if(!_0x4904cc[_0x5029('0x36')]){return saveUpdates(_0x29c59a[_0x5029('0x31')],null);}return _0x4904cc;})['then'](respondWithResult(_0x1bb896,null))['catch'](handleError(_0x1bb896,null));}; \ No newline at end of file +var _0x814b=['json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','model','keys','rawAttributes','intersection','query','attributes','fields','length','merge','options','getLicense','catch','body','License','params','get','key','demo','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x38eeb9,_0xd99664){var _0x1818e0=function(_0x58e957){while(--_0x58e957){_0x38eeb9['push'](_0x38eeb9['shift']());}};_0x1818e0(++_0xd99664);}(_0x814b,0x1a2));var _0xb814=function(_0x161ac3,_0x142e49){_0x161ac3=_0x161ac3-0x0;var _0x3bb837=_0x814b[_0x161ac3];return _0x3bb837;};'use strict';var emlformat=require(_0xb814('0x0'));var rimraf=require(_0xb814('0x1'));var zipdir=require(_0xb814('0x2'));var jsonpatch=require(_0xb814('0x3'));var rp=require(_0xb814('0x4'));var moment=require(_0xb814('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb814('0x6'));var util=require(_0xb814('0x7'));var path=require(_0xb814('0x8'));var sox=require(_0xb814('0x9'));var csv=require(_0xb814('0xa'));var ejs=require(_0xb814('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xa'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb814('0x19'));var db=require(_0xb814('0x1a'))['db'];function respondWithStatusCode(_0x35b10d,_0x2cc46b){_0x2cc46b=_0x2cc46b||0xcc;return function(_0x2ce718){if(_0x2ce718){return _0x35b10d[_0xb814('0x1b')](_0x2cc46b);}return _0x35b10d[_0xb814('0x1c')](_0x2cc46b)[_0xb814('0x1d')]();};}function respondWithResult(_0xa0a2e5,_0x2ab627){_0x2ab627=_0x2ab627||0xc8;return function(_0x3f4881){if(_0x3f4881){return _0xa0a2e5[_0xb814('0x1c')](_0x2ab627)[_0xb814('0x1e')](_0x3f4881);}};}function respondWithFilteredResult(_0x39bfcf,_0x303aca){return function(_0x3a71d6){if(_0x3a71d6){var _0x45e0d0=typeof _0x303aca[_0xb814('0x1f')]===_0xb814('0x20')&&typeof _0x303aca[_0xb814('0x21')]===_0xb814('0x20');var _0x48c9df=_0x3a71d6[_0xb814('0x22')];var _0x55ba16=_0x45e0d0?0x0:_0x303aca[_0xb814('0x1f')];var _0xfac75b=_0x45e0d0?_0x3a71d6['count']:_0x303aca['offset']+_0x303aca['limit'];var _0x399b43;if(_0xfac75b>=_0x48c9df){_0xfac75b=_0x48c9df;_0x399b43=0xc8;}else{_0x399b43=0xce;}_0x39bfcf['status'](_0x399b43);return _0x39bfcf['set'](_0xb814('0x23'),_0x55ba16+'-'+_0xfac75b+'/'+_0x48c9df)[_0xb814('0x1e')](_0x3a71d6);}return null;};}function patchUpdates(_0x25b6b6){return function(_0x4e139e){try{jsonpatch[_0xb814('0x24')](_0x4e139e,_0x25b6b6,!![]);}catch(_0x531032){return BPromise[_0xb814('0x25')](_0x531032);}return _0x4e139e[_0xb814('0x26')]();};}function saveUpdates(_0x3b267e,_0x470e81){return function(_0x27352e){if(_0x27352e){return _0x27352e[_0xb814('0x27')](_0x3b267e)[_0xb814('0x28')](function(_0x594470){return _0x594470;});}return null;};}function removeEntity(_0x2ead86,_0x52b7a3){return function(_0x3f81d0){if(_0x3f81d0){return _0x3f81d0[_0xb814('0x29')]()[_0xb814('0x28')](function(){_0x2ead86[_0xb814('0x1c')](0xcc)[_0xb814('0x1d')]();});}};}function handleEntityNotFound(_0xb9e57d,_0x3d836c){return function(_0x5755ea){if(!_0x5755ea){_0xb9e57d[_0xb814('0x1b')](0x194);}return _0x5755ea;};}function handleError(_0xc0ef66,_0x1c2625){_0x1c2625=_0x1c2625||0x1f4;return function(_0x349394){logger[_0xb814('0x2a')](_0x349394[_0xb814('0x2b')]);if(_0x349394[_0xb814('0x2c')]){delete _0x349394[_0xb814('0x2c')];}_0xc0ef66['status'](_0x1c2625)[_0xb814('0x2d')](_0x349394);};}var utilLicense=require(_0xb814('0x19'));exports['index']=function(_0x9008b2,_0x37d24d){var _0x530744={'raw':!![],'where':{'id':0x1}},_0x499f22={};_0x499f22[_0xb814('0x2e')]=_[_0xb814('0x2f')](db['License'][_0xb814('0x30')]);_0x499f22['query']=_[_0xb814('0x2f')](_0x9008b2['query']);_0x499f22['filters']=_[_0xb814('0x31')](_0x499f22['model'],_0x499f22[_0xb814('0x32')]);_0x530744[_0xb814('0x33')]=_[_0xb814('0x31')](_0x499f22['model'],qs['fields'](_0x9008b2[_0xb814('0x32')][_0xb814('0x34')]));_0x530744['attributes']=_0x530744[_0xb814('0x33')][_0xb814('0x35')]?_0x530744[_0xb814('0x33')]:_0x499f22[_0xb814('0x2e')];_0x530744=_[_0xb814('0x36')]({},_0x530744,_0x9008b2[_0xb814('0x37')]);return utilLicense[_0xb814('0x38')](_0x530744)['then'](respondWithResult(_0x37d24d,null))[_0xb814('0x39')](handleError(_0x37d24d,null));};exports[_0xb814('0x27')]=function(_0x30de5a,_0x424e2b){if(_0x30de5a[_0xb814('0x3a')]['id']){delete _0x30de5a['body']['id'];}return db[_0xb814('0x3b')]['find']({'where':{'id':_0x30de5a[_0xb814('0x3c')]['id']}})[_0xb814('0x28')](handleEntityNotFound(_0x424e2b,null))[_0xb814('0x28')](function(_0x492d5e){var _0x40b885=_0x492d5e[_0xb814('0x3d')]({'plain':!![]});return utilLicense['checkLicense'](_0x40b885,_0x30de5a[_0xb814('0x3a')][_0xb814('0x3e')]);})[_0xb814('0x28')](function(_0x1f7cd8){if(!_0x1f7cd8[_0xb814('0x3f')]){return saveUpdates(_0x30de5a[_0xb814('0x3a')],null);}return _0x1f7cd8;})['then'](respondWithResult(_0x424e2b,null))[_0xb814('0x39')](handleError(_0x424e2b,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 761b194..c647546 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 _0xe481=['api','bluebird','request-promise','path','../../config/environment','./license.attributes','define','License','license','lodash','util','../../config/logger'];(function(_0xeceaf1,_0x40c947){var _0x4cfec6=function(_0x56993d){while(--_0x56993d){_0xeceaf1['push'](_0xeceaf1['shift']());}};_0x4cfec6(++_0x40c947);}(_0xe481,0x189));var _0x1e48=function(_0x2fda50,_0x42ae90){_0x2fda50=_0x2fda50-0x0;var _0x4169f6=_0xe481[_0x2fda50];return _0x4169f6;};'use strict';var _=require(_0x1e48('0x0'));var util=require(_0x1e48('0x1'));var logger=require(_0x1e48('0x2'))(_0x1e48('0x3'));var moment=require('moment');var BPromise=require(_0x1e48('0x4'));var rp=require(_0x1e48('0x5'));var fs=require('fs');var path=require(_0x1e48('0x6'));var rimraf=require('rimraf');var config=require(_0x1e48('0x7'));var attributes=require(_0x1e48('0x8'));module['exports']=function(_0x671ea3,_0x3eb11b){return _0x671ea3[_0x1e48('0x9')](_0x1e48('0xa'),attributes,{'tableName':_0x1e48('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x370c=['License','license','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./license.attributes','exports','define'];(function(_0x1c2f29,_0x5a2668){var _0x258465=function(_0x30332f){while(--_0x30332f){_0x1c2f29['push'](_0x1c2f29['shift']());}};_0x258465(++_0x5a2668);}(_0x370c,0x106));var _0xc370=function(_0x3c7e5b,_0xefbb3d){_0x3c7e5b=_0x3c7e5b-0x0;var _0x1cf83a=_0x370c[_0x3c7e5b];return _0x1cf83a;};'use strict';var _=require(_0xc370('0x0'));var util=require('util');var logger=require(_0xc370('0x1'))(_0xc370('0x2'));var moment=require(_0xc370('0x3'));var BPromise=require('bluebird');var rp=require(_0xc370('0x4'));var fs=require('fs');var path=require(_0xc370('0x5'));var rimraf=require(_0xc370('0x6'));var config=require(_0xc370('0x7'));var attributes=require(_0xc370('0x8'));module[_0xc370('0x9')]=function(_0x4d9cbe,_0x2abd59){return _0x4d9cbe[_0xc370('0xa')](_0xc370('0xb'),attributes,{'tableName':_0xc370('0xc'),'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 6dca032..257b40b 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 _0x67e1=['../../config/utils','../../config/logger','client','http','then','info','request\x20sent','debug','stringify','error','code','License,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird'];(function(_0xfc53fc,_0x4204d6){var _0x423828=function(_0x44e877){while(--_0x44e877){_0xfc53fc['push'](_0xfc53fc['shift']());}};_0x423828(++_0x4204d6);}(_0x67e1,0xe6));var _0x167e=function(_0x4a26a8,_0x4c0a7f){_0x4a26a8=_0x4a26a8-0x0;var _0x23c444=_0x67e1[_0x4a26a8];return _0x23c444;};'use strict';var _=require(_0x167e('0x0'));var util=require(_0x167e('0x1'));var moment=require(_0x167e('0x2'));var BPromise=require(_0x167e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x167e('0x4'));var logger=require(_0x167e('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x167e('0x6')][_0x167e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3e0b71,_0x53a7fb,_0x3f1a02){return new BPromise(function(_0x5999b0,_0x4a318c){return client['request'](_0x3e0b71,_0x3f1a02)[_0x167e('0x8')](function(_0x207432){logger[_0x167e('0x9')]('License,\x20%s,\x20%s',_0x53a7fb,_0x167e('0xa'));logger[_0x167e('0xb')]('License,\x20%s,\x20%s,\x20%s',_0x53a7fb,'request\x20sent',JSON[_0x167e('0xc')](_0x207432));if(_0x207432[_0x167e('0xd')]){if(_0x207432[_0x167e('0xd')][_0x167e('0xe')]===0x1f4){logger[_0x167e('0xd')](_0x167e('0xf'),_0x53a7fb,_0x207432[_0x167e('0xd')][_0x167e('0x10')]);return _0x4a318c(_0x207432[_0x167e('0xd')][_0x167e('0x10')]);}logger['error'](_0x167e('0xf'),_0x53a7fb,_0x207432[_0x167e('0xd')]['message']);return _0x5999b0(_0x207432[_0x167e('0xd')][_0x167e('0x10')]);}else{logger[_0x167e('0x9')](_0x167e('0xf'),_0x53a7fb,'request\x20sent');_0x5999b0(_0x207432[_0x167e('0x11')]['message']);}})['catch'](function(_0x1036a7){logger['error'](_0x167e('0xf'),_0x53a7fb,_0x1036a7);_0x4a318c(_0x1036a7);});});} \ No newline at end of file +var _0x8014=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','randomstring','ioredis'];(function(_0x4fb5d9,_0x55e1b5){var _0x20c599=function(_0x54bc59){while(--_0x54bc59){_0x4fb5d9['push'](_0x4fb5d9['shift']());}};_0x20c599(++_0x55e1b5);}(_0x8014,0xcb));var _0x4801=function(_0x2534cf,_0x545be6){_0x2534cf=_0x2534cf-0x0;var _0x221461=_0x8014[_0x2534cf];return _0x221461;};'use strict';var _=require(_0x4801('0x0'));var util=require(_0x4801('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4801('0x2'));var fs=require('fs');var Redis=require(_0x4801('0x3'));var db=require(_0x4801('0x4'))['db'];var utils=require(_0x4801('0x5'));var logger=require(_0x4801('0x6'))(_0x4801('0x7'));var config=require('../../config/environment');var jayson=require(_0x4801('0x8'));var client=jayson['client'][_0x4801('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x406801,_0xf1fb19,_0x1dbb7b){return new BPromise(function(_0x301f46,_0x4c8070){return client[_0x4801('0xa')](_0x406801,_0x1dbb7b)[_0x4801('0xb')](function(_0x55c488){logger['info'](_0x4801('0xc'),_0xf1fb19,_0x4801('0xd'));logger[_0x4801('0xe')](_0x4801('0xf'),_0xf1fb19,_0x4801('0xd'),JSON[_0x4801('0x10')](_0x55c488));if(_0x55c488['error']){if(_0x55c488[_0x4801('0x11')][_0x4801('0x12')]===0x1f4){logger[_0x4801('0x11')](_0x4801('0xc'),_0xf1fb19,_0x55c488['error'][_0x4801('0x13')]);return _0x4c8070(_0x55c488[_0x4801('0x11')][_0x4801('0x13')]);}logger[_0x4801('0x11')](_0x4801('0xc'),_0xf1fb19,_0x55c488['error'][_0x4801('0x13')]);return _0x301f46(_0x55c488[_0x4801('0x11')]['message']);}else{logger[_0x4801('0x14')](_0x4801('0xc'),_0xf1fb19,_0x4801('0xd'));_0x301f46(_0x55c488[_0x4801('0x15')][_0x4801('0x13')]);}})[_0x4801('0x16')](function(_0x12458d){logger[_0x4801('0x11')](_0x4801('0xc'),_0xf1fb19,_0x12458d);_0x4c8070(_0x12458d);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 8269078..e321de0 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 _0x9740=['getImap','/:id/out_servers','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','create','addImap','addSmtp','addApplications','/:id/send','send','put','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','isAuthenticated','index','/describe','describe','get','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/in_servers'];(function(_0x1f17d1,_0x3c601d){var _0x1e7323=function(_0x34acfe){while(--_0x34acfe){_0x1f17d1['push'](_0x1f17d1['shift']());}};_0x1e7323(++_0x3c601d);}(_0x9740,0x107));var _0x0974=function(_0x453056,_0x547fc7){_0x453056=_0x453056-0x0;var _0x19fa8a=_0x9740[_0x453056];return _0x19fa8a;};'use strict';var multer=require('multer');var util=require(_0x0974('0x0'));var path=require(_0x0974('0x1'));var timeout=require(_0x0974('0x2'));var express=require('express');var router=express[_0x0974('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0974('0x4'));var interaction=require(_0x0974('0x5'));var config=require(_0x0974('0x6'));var controller=require(_0x0974('0x7'));router['get']('/',auth[_0x0974('0x8')](),controller[_0x0974('0x9')]);router['get'](_0x0974('0xa'),auth[_0x0974('0x8')](),controller[_0x0974('0xb')]);router[_0x0974('0xc')](_0x0974('0xd'),auth['isAuthenticated'](),controller[_0x0974('0xe')]);router[_0x0974('0xc')](_0x0974('0xf'),auth[_0x0974('0x8')](),controller[_0x0974('0x10')]);router['get']('/:id/canned_answers',auth[_0x0974('0x8')](),controller[_0x0974('0x11')]);router[_0x0974('0xc')](_0x0974('0x12'),auth[_0x0974('0x8')](),controller[_0x0974('0x13')]);router[_0x0974('0xc')](_0x0974('0x14'),auth[_0x0974('0x8')](),controller['getSmtp']);router[_0x0974('0xc')](_0x0974('0x15'),auth[_0x0974('0x8')](),controller[_0x0974('0x16')]);router[_0x0974('0xc')](_0x0974('0x17'),auth[_0x0974('0x8')](),controller['getApplications']);router['get'](_0x0974('0x18'),auth[_0x0974('0x8')](),controller[_0x0974('0x19')]);router[_0x0974('0xc')]('/:id/verify',auth['isAuthenticated'](),controller['verifySmtp']);router['get'](_0x0974('0x1a'),auth[_0x0974('0x8')](),controller[_0x0974('0x1b')]);router[_0x0974('0x1c')](_0x0974('0xf'),auth[_0x0974('0x8')](),controller[_0x0974('0x1d')]);router[_0x0974('0x1c')](_0x0974('0x1e'),auth[_0x0974('0x8')](),controller[_0x0974('0x1f')]);router[_0x0974('0x1c')]('/',auth[_0x0974('0x8')](),controller[_0x0974('0x20')]);router[_0x0974('0x1c')](_0x0974('0x12'),auth['isAuthenticated'](),controller[_0x0974('0x21')]);router[_0x0974('0x1c')](_0x0974('0x14'),auth[_0x0974('0x8')](),controller[_0x0974('0x22')]);router[_0x0974('0x1c')](_0x0974('0x15'),auth['isAuthenticated'](),controller['addInteraction']);router[_0x0974('0x1c')](_0x0974('0x17'),auth[_0x0974('0x8')](),controller[_0x0974('0x23')]);router[_0x0974('0x1c')](_0x0974('0x24'),auth['isAuthenticated'](),controller[_0x0974('0x25')]);router[_0x0974('0x1c')](_0x0974('0x1a'),auth[_0x0974('0x8')](),controller['addAgents']);router[_0x0974('0x26')](_0x0974('0xd'),auth[_0x0974('0x8')](),controller[_0x0974('0x27')]);router[_0x0974('0x28')](_0x0974('0xf'),auth[_0x0974('0x8')](),controller[_0x0974('0x29')]);router['delete'](_0x0974('0x1e'),auth[_0x0974('0x8')](),controller[_0x0974('0x2a')]);router['delete'](_0x0974('0x12'),auth['isAuthenticated'](),controller[_0x0974('0x2b')]);router['delete']('/:id/out_servers',auth[_0x0974('0x8')](),controller[_0x0974('0x2c')]);router[_0x0974('0x28')](_0x0974('0xd'),auth['isAuthenticated'](),controller[_0x0974('0x2d')]);router[_0x0974('0x28')](_0x0974('0x1a'),auth[_0x0974('0x8')](),controller['removeAgents']);module[_0x0974('0x2e')]=router; \ No newline at end of file +var _0xf072=['util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','getDispositions','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/applications','getApplications','getMessages','/:id/users','getAgents','post','/:id/dispositions','addDisposition','/:id/canned_answers','addAnswer','addImap','addSmtp','/:id/interactions','addInteraction','addApplications','send','addAgents','put','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','multer'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xf072,0x1b7));var _0x2f07=function(_0x4db46b,_0x24938a){_0x4db46b=_0x4db46b-0x0;var _0x43a421=_0xf072[_0x4db46b];return _0x43a421;};'use strict';var multer=require(_0x2f07('0x0'));var util=require(_0x2f07('0x1'));var path=require('path');var timeout=require(_0x2f07('0x2'));var express=require('express');var router=express[_0x2f07('0x3')]();var fs_extra=require(_0x2f07('0x4'));var auth=require(_0x2f07('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2f07('0x6'));var controller=require('./mailAccount.controller');router[_0x2f07('0x7')]('/',auth[_0x2f07('0x8')](),controller['index']);router[_0x2f07('0x7')](_0x2f07('0x9'),auth[_0x2f07('0x8')](),controller[_0x2f07('0xa')]);router['get'](_0x2f07('0xb'),auth[_0x2f07('0x8')](),controller['show']);router[_0x2f07('0x7')]('/:id/dispositions',auth[_0x2f07('0x8')](),controller[_0x2f07('0xc')]);router[_0x2f07('0x7')]('/:id/canned_answers',auth[_0x2f07('0x8')](),controller[_0x2f07('0xd')]);router['get'](_0x2f07('0xe'),auth[_0x2f07('0x8')](),controller[_0x2f07('0xf')]);router[_0x2f07('0x7')](_0x2f07('0x10'),auth[_0x2f07('0x8')](),controller[_0x2f07('0x11')]);router[_0x2f07('0x7')]('/:id/interactions',auth[_0x2f07('0x8')](),controller['getInteractions']);router[_0x2f07('0x7')](_0x2f07('0x12'),auth[_0x2f07('0x8')](),controller[_0x2f07('0x13')]);router['get']('/:id/messages',auth[_0x2f07('0x8')](),controller[_0x2f07('0x14')]);router[_0x2f07('0x7')]('/:id/verify',auth['isAuthenticated'](),controller['verifySmtp']);router[_0x2f07('0x7')](_0x2f07('0x15'),auth['isAuthenticated'](),controller[_0x2f07('0x16')]);router[_0x2f07('0x17')](_0x2f07('0x18'),auth['isAuthenticated'](),controller[_0x2f07('0x19')]);router['post'](_0x2f07('0x1a'),auth[_0x2f07('0x8')](),controller[_0x2f07('0x1b')]);router[_0x2f07('0x17')]('/',auth[_0x2f07('0x8')](),controller['create']);router['post'](_0x2f07('0xe'),auth['isAuthenticated'](),controller[_0x2f07('0x1c')]);router[_0x2f07('0x17')](_0x2f07('0x10'),auth[_0x2f07('0x8')](),controller[_0x2f07('0x1d')]);router[_0x2f07('0x17')](_0x2f07('0x1e'),auth[_0x2f07('0x8')](),controller[_0x2f07('0x1f')]);router[_0x2f07('0x17')]('/:id/applications',auth['isAuthenticated'](),controller[_0x2f07('0x20')]);router[_0x2f07('0x17')]('/:id/send',auth[_0x2f07('0x8')](),controller[_0x2f07('0x21')]);router[_0x2f07('0x17')]('/:id/users',auth[_0x2f07('0x8')](),controller[_0x2f07('0x22')]);router[_0x2f07('0x23')](_0x2f07('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x2f07('0x24')]('/:id/dispositions',auth[_0x2f07('0x8')](),controller[_0x2f07('0x25')]);router[_0x2f07('0x24')]('/:id/canned_answers',auth[_0x2f07('0x8')](),controller[_0x2f07('0x26')]);router[_0x2f07('0x24')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0x2f07('0x27')]);router[_0x2f07('0x24')]('/:id/out_servers',auth[_0x2f07('0x8')](),controller[_0x2f07('0x28')]);router[_0x2f07('0x24')](_0x2f07('0xb'),auth[_0x2f07('0x8')](),controller[_0x2f07('0x29')]);router['delete'](_0x2f07('0x15'),auth[_0x2f07('0x8')](),controller[_0x2f07('0x2a')]);module[_0x2f07('0x2b')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 3c326d7..c52d8ed 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 _0x29d4=['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','STRING','BOOLEAN'];(function(_0x3cb2be,_0x57fff1){var _0x315aab=function(_0x2e6914){while(--_0x2e6914){_0x3cb2be['push'](_0x3cb2be['shift']());}};_0x315aab(++_0x57fff1);}(_0x29d4,0x1a1));var _0x429d=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0x29d4[_0x521929];return _0x632436;};'use strict';var Sequelize=require(_0x429d('0x0'));module['exports']={'description':{'type':Sequelize[_0x429d('0x1')]},'name':{'type':Sequelize[_0x429d('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x429d('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x429d('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x429d('0x2')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x429d('0x3')]},'markAsUnread':{'type':Sequelize[_0x429d('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x429d('0x1')],'allowNull':![],'defaultValue':_0x429d('0x4')},'fontSize':{'type':Sequelize[_0x429d('0x5')](0x2)[_0x429d('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x429d('0x3')],'defaultValue':function(){return _0x429d('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x429d('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x429d('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x429d('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x429d('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x429d('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x429d('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x429d('0x9'),'set':function(_0x2fd1ca){if(!_0x2fd1ca)this[_0x429d('0xa')]('mandatoryDispositionPauseId',null);this[_0x429d('0xa')](_0x429d('0xb'),_0x2fd1ca);}}}; \ No newline at end of file +var _0x7d55=['setDataValue','mandatoryDisposition','sequelize','exports','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'];(function(_0x14b4b2,_0x42aed0){var _0x2710fd=function(_0x2bb074){while(--_0x2bb074){_0x14b4b2['push'](_0x14b4b2['shift']());}};_0x2710fd(++_0x42aed0);}(_0x7d55,0x1bc));var _0x57d5=function(_0x3ca324,_0x342664){_0x3ca324=_0x3ca324-0x0;var _0x2ebd9a=_0x7d55[_0x3ca324];return _0x2ebd9a;};'use strict';var Sequelize=require(_0x57d5('0x0'));module[_0x57d5('0x1')]={'description':{'type':Sequelize[_0x57d5('0x2')]},'name':{'type':Sequelize[_0x57d5('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x57d5('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x57d5('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x57d5('0x4')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x57d5('0x2')],'allowNull':![],'defaultValue':_0x57d5('0x5')},'fontSize':{'type':Sequelize[_0x57d5('0x6')](0x2)[_0x57d5('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x57d5('0x4')],'defaultValue':function(){return _0x57d5('0x8');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x57d5('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x57d5('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x57d5('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x57d5('0xa'),'set':function(_0xb23d20){if(!_0xb23d20)this[_0x57d5('0xb')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0x57d5('0xc'),_0xb23d20);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 0147ab8..bcd959d 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 _0x4c2d=['%s\x20<%s>','attachments','root','basename','auth','secure','SendMail','sendMail','List\x20not\x20found','defaults','messageId','subject','attach','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','omit','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','save','update','destroy','then','get','MailAccounts','UserProfileResource','stack','name','send','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','filter','merge','where','options','includeAll','include','rows','show','Imap','Smtp','fields','length','find','body','describe','params','MailAccountId','Disposition','create','getDispositions','findOne','pick','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','email','ListId','isNil','active','description','cauthentication','user','password','pass','cpassword','authentication','host','port','service','cservice','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','getInteractions','MailInteraction','rawAttributes','CmContact','User','Tag','Tags','color','tag','addApplications','sequelize','transaction','MailApplication','findAndCountAll','getApplications','MailMessage','$gte','split','format','inlineCss','true','CmList','List','Contacts','updatedAt','DESC','from'];(function(_0x14248f,_0xcbbb85){var _0x4cf380=function(_0x2ac37c){while(--_0x2ac37c){_0x14248f['push'](_0x14248f['shift']());}};_0x4cf380(++_0xcbbb85);}(_0x4c2d,0x1b2));var _0xd4c2=function(_0x189ae9,_0x3150c2){_0x189ae9=_0x189ae9-0x0;var _0x486fa4=_0x4c2d[_0x189ae9];return _0x486fa4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd4c2('0x0'));var zipdir=require(_0xd4c2('0x1'));var jsonpatch=require(_0xd4c2('0x2'));var rp=require('request-promise');var moment=require(_0xd4c2('0x3'));var BPromise=require(_0xd4c2('0x4'));var Mustache=require(_0xd4c2('0x5'));var util=require(_0xd4c2('0x6'));var path=require('path');var sox=require(_0xd4c2('0x7'));var csv=require(_0xd4c2('0x8'));var ejs=require(_0xd4c2('0x9'));var fs=require('fs');var fs_extra=require(_0xd4c2('0xa'));var _=require(_0xd4c2('0xb'));var squel=require(_0xd4c2('0xc'));var crypto=require(_0xd4c2('0xd'));var jsforce=require(_0xd4c2('0xe'));var deskjs=require(_0xd4c2('0xf'));var toCsv=require(_0xd4c2('0x8'));var querystring=require(_0xd4c2('0x10'));var Papa=require(_0xd4c2('0x11'));var htmlToText=require('html-to-text');var juice=require(_0xd4c2('0x12'));var Redis=require(_0xd4c2('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xd4c2('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd4c2('0x15'))(_0xd4c2('0x16'));var utils=require(_0xd4c2('0x17'));var config=require(_0xd4c2('0x18'));var licenseUtil=require(_0xd4c2('0x19'));var db=require(_0xd4c2('0x1a'))['db'];config[_0xd4c2('0x1b')]=_['defaults'](config[_0xd4c2('0x1b')],{'host':_0xd4c2('0x1c'),'port':0x18eb});var socket=require(_0xd4c2('0x1d'))(new Redis(config[_0xd4c2('0x1b')]));require(_0xd4c2('0x1e'))[_0xd4c2('0x1f')](socket);var jayson=require(_0xd4c2('0x20'));var client=jayson[_0xd4c2('0x21')][_0xd4c2('0x22')]({'port':0x232b});function respondWithRpcPromise(_0x487066,_0x264412,_0x288f8e,_0x282fd9){return new BPromise(function(_0x4143fa,_0x203203){var _0x6bbf8d=_0x282fd9||client;return _0x6bbf8d[_0xd4c2('0x23')](_0x487066,_0x288f8e)['then'](function(_0x3e9c){logger['info'](_0xd4c2('0x24'),_0x264412,_0xd4c2('0x25'));logger[_0xd4c2('0x26')](_0xd4c2('0x27'),_0x264412,_0xd4c2('0x25'),JSON[_0xd4c2('0x28')](_0x3e9c));if(_0x3e9c[_0xd4c2('0x29')]){if(_0x3e9c[_0xd4c2('0x29')][_0xd4c2('0x2a')]===0x1f4){logger['error'](_0xd4c2('0x24'),_0x264412,_0x3e9c[_0xd4c2('0x29')]['message']);return _0x203203(_0x3e9c['error'][_0xd4c2('0x2b')]);}logger[_0xd4c2('0x29')]('MailAccount,\x20%s,\x20%s',_0x264412,_0x3e9c[_0xd4c2('0x29')][_0xd4c2('0x2b')]);return _0x4143fa(_0x3e9c[_0xd4c2('0x29')][_0xd4c2('0x2b')]);}else{logger[_0xd4c2('0x2c')](_0xd4c2('0x24'),_0x264412,'request\x20sent');_0x4143fa(_0x3e9c[_0xd4c2('0x2d')][_0xd4c2('0x2b')]);}})[_0xd4c2('0x2e')](function(_0x34af7e){logger[_0xd4c2('0x29')]('MailAccount,\x20%s,\x20%s',_0x264412,_0x34af7e);_0x203203(_0x34af7e);});});}function respondWithStatusCode(_0x143a17,_0x2b50e0){_0x2b50e0=_0x2b50e0||0xcc;return function(_0x468b0c){if(_0x468b0c){return _0x143a17[_0xd4c2('0x2f')](_0x2b50e0);}return _0x143a17[_0xd4c2('0x30')](_0x2b50e0)[_0xd4c2('0x31')]();};}function respondWithResult(_0x145d2b,_0x4b8ea9){_0x4b8ea9=_0x4b8ea9||0xc8;return function(_0x34c8e1){if(_0x34c8e1){return _0x145d2b[_0xd4c2('0x30')](_0x4b8ea9)[_0xd4c2('0x32')](_0x34c8e1);}};}function respondWithFilteredResult(_0x16cae4,_0x489c77){return function(_0x2323f2){if(_0x2323f2){var _0x4ed4f9=typeof _0x489c77['offset']===_0xd4c2('0x33')&&typeof _0x489c77['limit']===_0xd4c2('0x33');var _0x3c6628=_0x2323f2[_0xd4c2('0x34')];var _0x40bdad=_0x4ed4f9?0x0:_0x489c77[_0xd4c2('0x35')];var _0x2ce1b1=_0x4ed4f9?_0x2323f2[_0xd4c2('0x34')]:_0x489c77['offset']+_0x489c77[_0xd4c2('0x36')];var _0xbcfe85;if(_0x2ce1b1>=_0x3c6628){_0x2ce1b1=_0x3c6628;_0xbcfe85=0xc8;}else{_0xbcfe85=0xce;}_0x16cae4[_0xd4c2('0x30')](_0xbcfe85);return _0x16cae4['set'](_0xd4c2('0x37'),_0x40bdad+'-'+_0x2ce1b1+'/'+_0x3c6628)[_0xd4c2('0x32')](_0x2323f2);}return null;};}function patchUpdates(_0x1e2259){return function(_0x2ba043){try{jsonpatch[_0xd4c2('0x38')](_0x2ba043,_0x1e2259,!![]);}catch(_0xa05286){return BPromise['reject'](_0xa05286);}return _0x2ba043[_0xd4c2('0x39')]();};}function saveUpdates(_0x16ed68,_0x50b8fd){return function(_0x2be554){if(_0x2be554){return _0x2be554[_0xd4c2('0x3a')](_0x16ed68)['then'](function(_0x17ca5d){return _0x17ca5d;});}return null;};}function removeEntity(_0x504452,_0x5b083b){return function(_0x43c466){if(_0x43c466){return _0x43c466[_0xd4c2('0x3b')]()[_0xd4c2('0x3c')](function(){var _0x418635=_0x43c466[_0xd4c2('0x3d')]({'plain':!![]});var _0x5379ae=_0xd4c2('0x3e');return db[_0xd4c2('0x3f')][_0xd4c2('0x3b')]({'where':{'type':_0x5379ae,'resourceId':_0x418635['id']}})[_0xd4c2('0x3c')](function(){return _0x43c466;});})[_0xd4c2('0x3c')](function(){_0x504452[_0xd4c2('0x30')](0xcc)[_0xd4c2('0x31')]();});}};}function handleEntityNotFound(_0x3fddea,_0x462dba){return function(_0x2fa186){if(!_0x2fa186){_0x3fddea[_0xd4c2('0x2f')](0x194);}return _0x2fa186;};}function handleError(_0x3b74b0,_0x4f313a){_0x4f313a=_0x4f313a||0x1f4;return function(_0x51df12){logger[_0xd4c2('0x29')](_0x51df12[_0xd4c2('0x40')]);if(_0x51df12[_0xd4c2('0x41')]){delete _0x51df12[_0xd4c2('0x41')];}_0x3b74b0[_0xd4c2('0x30')](_0x4f313a)[_0xd4c2('0x42')](_0x51df12);};}exports[_0xd4c2('0x43')]=function(_0x46b575,_0x263c88){var _0xd3ed50={'include':[{'model':db[_0xd4c2('0x44')],'as':'Imap'},{'model':db[_0xd4c2('0x45')],'as':'Smtp'},{'model':db[_0xd4c2('0x46')],'as':_0xd4c2('0x47')}]},_0x5390b1={},_0x2493f9={'count':0x0,'rows':[]};var _0x1eec44=_[_0xd4c2('0x48')](db[_0xd4c2('0x49')]['rawAttributes'],function(_0x1c445d){return{'name':_0x1c445d[_0xd4c2('0x4a')],'type':_0x1c445d[_0xd4c2('0x4b')][_0xd4c2('0x4c')]};});_0x5390b1[_0xd4c2('0x4d')]=_['map'](_0x1eec44,_0xd4c2('0x41'));_0x5390b1[_0xd4c2('0x4e')]=_[_0xd4c2('0x4f')](_0x46b575[_0xd4c2('0x4e')]);_0x5390b1[_0xd4c2('0x50')]=_[_0xd4c2('0x51')](_0x5390b1[_0xd4c2('0x4d')],_0x5390b1[_0xd4c2('0x4e')]);_0xd3ed50[_0xd4c2('0x52')]=_[_0xd4c2('0x51')](_0x5390b1['model'],qs['fields'](_0x46b575[_0xd4c2('0x4e')]['fields']));_0xd3ed50[_0xd4c2('0x52')]=_0xd3ed50[_0xd4c2('0x52')]['length']?_0xd3ed50['attributes']:_0x5390b1['model'];if(!_0x46b575[_0xd4c2('0x4e')][_0xd4c2('0x53')](_0xd4c2('0x54'))){_0xd3ed50[_0xd4c2('0x36')]=qs[_0xd4c2('0x36')](_0x46b575[_0xd4c2('0x4e')][_0xd4c2('0x36')]);_0xd3ed50[_0xd4c2('0x35')]=qs[_0xd4c2('0x35')](_0x46b575['query'][_0xd4c2('0x35')]);}_0xd3ed50[_0xd4c2('0x55')]=qs[_0xd4c2('0x56')](_0x46b575[_0xd4c2('0x4e')][_0xd4c2('0x56')]);_0xd3ed50['where']=qs[_0xd4c2('0x50')](_['pick'](_0x46b575['query'],_0x5390b1[_0xd4c2('0x50')]),_0x1eec44);if(_0x46b575[_0xd4c2('0x4e')][_0xd4c2('0x57')]){_0xd3ed50['where']=_[_0xd4c2('0x58')](_0xd3ed50[_0xd4c2('0x59')],{'$or':_[_0xd4c2('0x48')](_0x1eec44,function(_0x25af67){if(_0x25af67[_0xd4c2('0x4b')]!=='VIRTUAL'){var _0xde36d2={};_0xde36d2[_0x25af67[_0xd4c2('0x41')]]={'$like':'%'+_0x46b575[_0xd4c2('0x4e')]['filter']+'%'};return _0xde36d2;}})});}_0xd3ed50=_['merge']({},_0xd3ed50,_0x46b575[_0xd4c2('0x5a')]);var _0x504363={'where':_0xd3ed50[_0xd4c2('0x59')]};return db['MailAccount']['count'](_0x504363)[_0xd4c2('0x3c')](function(_0x434c4f){_0x2493f9[_0xd4c2('0x34')]=_0x434c4f;if(_0x46b575['query'][_0xd4c2('0x5b')]){_0xd3ed50[_0xd4c2('0x5c')]=[{'all':!![]}];}return db[_0xd4c2('0x49')]['findAll'](_0xd3ed50);})['then'](function(_0x3ec697){_0x2493f9[_0xd4c2('0x5d')]=_0x3ec697;return _0x2493f9;})[_0xd4c2('0x3c')](respondWithFilteredResult(_0x263c88,_0xd3ed50))[_0xd4c2('0x2e')](handleError(_0x263c88,null));};exports[_0xd4c2('0x5e')]=function(_0x436ecb,_0x1efd75){var _0x115653={'raw':![],'where':{'id':_0x436ecb['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0xd4c2('0x5f')},{'model':db[_0xd4c2('0x45')],'as':_0xd4c2('0x60')},{'model':db[_0xd4c2('0x46')],'as':'mandatoryDispositionPause'}]},_0x46a10b={};_0x46a10b[_0xd4c2('0x4d')]=_['keys'](db[_0xd4c2('0x49')]['rawAttributes']);_0x46a10b[_0xd4c2('0x4e')]=_[_0xd4c2('0x4f')](_0x436ecb[_0xd4c2('0x4e')]);_0x46a10b[_0xd4c2('0x50')]=_[_0xd4c2('0x51')](_0x46a10b[_0xd4c2('0x4d')],_0x46a10b[_0xd4c2('0x4e')]);_0x115653[_0xd4c2('0x52')]=_[_0xd4c2('0x51')](_0x46a10b['model'],qs[_0xd4c2('0x61')](_0x436ecb[_0xd4c2('0x4e')][_0xd4c2('0x61')]));_0x115653[_0xd4c2('0x52')]=_0x115653[_0xd4c2('0x52')][_0xd4c2('0x62')]?_0x115653[_0xd4c2('0x52')]:_0x46a10b['model'];if(_0x436ecb[_0xd4c2('0x4e')][_0xd4c2('0x5b')]){_0x115653[_0xd4c2('0x5c')]=[{'all':!![]}];}_0x115653=_['merge']({},_0x115653,_0x436ecb[_0xd4c2('0x5a')]);return db[_0xd4c2('0x49')][_0xd4c2('0x63')](_0x115653)[_0xd4c2('0x3c')](handleEntityNotFound(_0x1efd75,null))[_0xd4c2('0x3c')](respondWithResult(_0x1efd75,null))[_0xd4c2('0x2e')](handleError(_0x1efd75,null));};exports[_0xd4c2('0x3a')]=function(_0x2f07aa,_0x37bca6){if(_0x2f07aa[_0xd4c2('0x64')]['id']){delete _0x2f07aa[_0xd4c2('0x64')]['id'];}return db[_0xd4c2('0x49')][_0xd4c2('0x63')]({'where':{'id':_0x2f07aa['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0xd4c2('0x5f')},{'model':db[_0xd4c2('0x45')],'as':_0xd4c2('0x60')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xd4c2('0x3c')](handleEntityNotFound(_0x37bca6,null))[_0xd4c2('0x3c')](saveUpdates(_0x2f07aa[_0xd4c2('0x64')],null))[_0xd4c2('0x3c')](function(_0x4148bd){if(_0x4148bd&&_0x2f07aa['body'][_0xd4c2('0x5f')]){return db[_0xd4c2('0x44')][_0xd4c2('0x3a')](_0x2f07aa[_0xd4c2('0x64')][_0xd4c2('0x5f')],{'where':{'MailAccountId':_0x4148bd['id']}})[_0xd4c2('0x3c')](function(){return _0x4148bd;});}return _0x4148bd;})[_0xd4c2('0x3c')](function(_0x1fc4d6){if(_0x1fc4d6&&_0x2f07aa[_0xd4c2('0x64')][_0xd4c2('0x60')]){return db[_0xd4c2('0x45')][_0xd4c2('0x3a')](_0x2f07aa[_0xd4c2('0x64')][_0xd4c2('0x60')],{'where':{'MailAccountId':_0x1fc4d6['id']}})[_0xd4c2('0x3c')](function(){return _0x1fc4d6;});}return _0x1fc4d6;})[_0xd4c2('0x3c')](respondWithResult(_0x37bca6,null))[_0xd4c2('0x2e')](handleError(_0x37bca6,null));};exports[_0xd4c2('0x65')]=function(_0x6a2d9e,_0x186386){return db[_0xd4c2('0x49')][_0xd4c2('0x65')]()['then'](respondWithResult(_0x186386,null))[_0xd4c2('0x2e')](handleError(_0x186386,null));};exports['addDisposition']=function(_0x54517a,_0x493ba9,_0x175756){if(_0x54517a[_0xd4c2('0x64')]['id']){delete _0x54517a[_0xd4c2('0x64')]['id'];}return db[_0xd4c2('0x49')][_0xd4c2('0x63')]({'where':{'id':_0x54517a[_0xd4c2('0x66')]['id']}})[_0xd4c2('0x3c')](handleEntityNotFound(_0x493ba9,null))[_0xd4c2('0x3c')](function(_0x12e579){if(_0x12e579){_0x54517a[_0xd4c2('0x64')][_0xd4c2('0x67')]=_0x12e579['id'];return db[_0xd4c2('0x68')][_0xd4c2('0x69')](_0x54517a[_0xd4c2('0x64')]);}})[_0xd4c2('0x3c')](respondWithResult(_0x493ba9,null))[_0xd4c2('0x2e')](handleError(_0x493ba9,null));};exports[_0xd4c2('0x6a')]=function(_0xaa0d23,_0x42994b,_0x1c86dc){var _0x51efb2={'raw':![],'where':{}};var _0x10bf60={};var _0x15f3a4={'count':0x0,'rows':[]};return db[_0xd4c2('0x49')][_0xd4c2('0x6b')]({'where':{'id':_0xaa0d23[_0xd4c2('0x66')]['id']}})[_0xd4c2('0x3c')](handleEntityNotFound(_0x42994b,null))[_0xd4c2('0x3c')](function(_0x6e332d){if(_0x6e332d){_0x10bf60[_0xd4c2('0x4d')]=_[_0xd4c2('0x4f')](db['Disposition']['rawAttributes']);_0x10bf60['query']=_['keys'](_0xaa0d23['query']);_0x10bf60[_0xd4c2('0x50')]=_[_0xd4c2('0x51')](_0x10bf60[_0xd4c2('0x4d')],_0x10bf60[_0xd4c2('0x4e')]);_0x51efb2['attributes']=_[_0xd4c2('0x51')](_0x10bf60[_0xd4c2('0x4d')],qs[_0xd4c2('0x61')](_0xaa0d23[_0xd4c2('0x4e')]['fields']));_0x51efb2[_0xd4c2('0x52')]=_0x51efb2[_0xd4c2('0x52')][_0xd4c2('0x62')]?_0x51efb2['attributes']:_0x10bf60[_0xd4c2('0x4d')];if(!_0xaa0d23['query']['hasOwnProperty'](_0xd4c2('0x54'))){_0x51efb2[_0xd4c2('0x36')]=qs['limit'](_0xaa0d23[_0xd4c2('0x4e')][_0xd4c2('0x36')]);_0x51efb2[_0xd4c2('0x35')]=qs[_0xd4c2('0x35')](_0xaa0d23[_0xd4c2('0x4e')][_0xd4c2('0x35')]);}_0x51efb2['order']=qs[_0xd4c2('0x56')](_0xaa0d23['query'][_0xd4c2('0x56')]);_0x51efb2['where']=qs['filters'](_[_0xd4c2('0x6c')](_0xaa0d23['query'],_0x10bf60[_0xd4c2('0x50')]));_0x51efb2[_0xd4c2('0x59')][_0xd4c2('0x67')]=_0x6e332d['id'];if(_0xaa0d23['query']['filter']){_0x51efb2[_0xd4c2('0x59')]=_[_0xd4c2('0x58')](_0x51efb2['where'],{'$or':_['map'](_0x51efb2[_0xd4c2('0x52')],function(_0x55d874){var _0x40ffdd={};_0x40ffdd[_0x55d874]={'$like':'%'+_0xaa0d23[_0xd4c2('0x4e')]['filter']+'%'};return _0x40ffdd;})});}_0x51efb2=_[_0xd4c2('0x58')]({},_0x51efb2,_0xaa0d23[_0xd4c2('0x5a')]);return db[_0xd4c2('0x68')][_0xd4c2('0x34')]({'where':_0x51efb2[_0xd4c2('0x59')]})['then'](function(_0x5337c6){_0x15f3a4[_0xd4c2('0x34')]=_0x5337c6;if(_0xaa0d23[_0xd4c2('0x4e')][_0xd4c2('0x5b')]){_0x51efb2[_0xd4c2('0x5c')]=[{'all':!![]}];}return db[_0xd4c2('0x68')][_0xd4c2('0x6d')](_0x51efb2);})[_0xd4c2('0x3c')](function(_0x40cc15){_0x15f3a4[_0xd4c2('0x5d')]=_0x40cc15;return _0x15f3a4;});}})[_0xd4c2('0x3c')](respondWithFilteredResult(_0x42994b,_0x51efb2))[_0xd4c2('0x2e')](handleError(_0x42994b,null));};exports[_0xd4c2('0x6e')]=function(_0x4e9b69,_0x168fa1,_0x1030f3){return db['MailAccount'][_0xd4c2('0x63')]({'where':{'id':_0x4e9b69[_0xd4c2('0x66')]['id']}})[_0xd4c2('0x3c')](handleEntityNotFound(_0x168fa1,null))[_0xd4c2('0x3c')](function(_0xa0ae89){if(_0xa0ae89){return _0xa0ae89[_0xd4c2('0x6e')](_0x4e9b69[_0xd4c2('0x4e')][_0xd4c2('0x6f')]);}})[_0xd4c2('0x3c')](respondWithStatusCode(_0x168fa1,null))[_0xd4c2('0x2e')](handleError(_0x168fa1,null));};exports[_0xd4c2('0x70')]=function(_0x54a98a,_0x25d636,_0x240409){if(_0x54a98a[_0xd4c2('0x64')]['id']){delete _0x54a98a[_0xd4c2('0x64')]['id'];}return db[_0xd4c2('0x49')][_0xd4c2('0x63')]({'where':{'id':_0x54a98a['params']['id']}})[_0xd4c2('0x3c')](handleEntityNotFound(_0x25d636,null))[_0xd4c2('0x3c')](function(_0x24ad36){if(_0x24ad36){_0x54a98a[_0xd4c2('0x64')]['MailAccountId']=_0x24ad36['id'];return db[_0xd4c2('0x71')]['create'](_0x54a98a[_0xd4c2('0x64')]);}})[_0xd4c2('0x3c')](respondWithResult(_0x25d636,null))[_0xd4c2('0x2e')](handleError(_0x25d636,null));};exports[_0xd4c2('0x72')]=function(_0x3aecf9,_0x13db57,_0x402cbe){var _0x5642f9={'raw':![],'where':{}};var _0x35983a={};var _0x535180={'count':0x0,'rows':[]};return db[_0xd4c2('0x49')][_0xd4c2('0x6b')]({'where':{'id':_0x3aecf9[_0xd4c2('0x66')]['id']}})[_0xd4c2('0x3c')](handleEntityNotFound(_0x13db57,null))[_0xd4c2('0x3c')](function(_0x3bfc25){if(_0x3bfc25){_0x35983a[_0xd4c2('0x4d')]=_['keys'](db[_0xd4c2('0x71')]['rawAttributes']);_0x35983a[_0xd4c2('0x4e')]=_[_0xd4c2('0x4f')](_0x3aecf9[_0xd4c2('0x4e')]);_0x35983a[_0xd4c2('0x50')]=_[_0xd4c2('0x51')](_0x35983a[_0xd4c2('0x4d')],_0x35983a[_0xd4c2('0x4e')]);_0x5642f9[_0xd4c2('0x52')]=_[_0xd4c2('0x51')](_0x35983a['model'],qs[_0xd4c2('0x61')](_0x3aecf9[_0xd4c2('0x4e')][_0xd4c2('0x61')]));_0x5642f9[_0xd4c2('0x52')]=_0x5642f9[_0xd4c2('0x52')][_0xd4c2('0x62')]?_0x5642f9['attributes']:_0x35983a[_0xd4c2('0x4d')];if(!_0x3aecf9[_0xd4c2('0x4e')]['hasOwnProperty'](_0xd4c2('0x54'))){_0x5642f9[_0xd4c2('0x36')]=qs[_0xd4c2('0x36')](_0x3aecf9['query'][_0xd4c2('0x36')]);_0x5642f9['offset']=qs['offset'](_0x3aecf9[_0xd4c2('0x4e')]['offset']);}_0x5642f9[_0xd4c2('0x55')]=qs['sort'](_0x3aecf9[_0xd4c2('0x4e')][_0xd4c2('0x56')]);_0x5642f9['where']=qs[_0xd4c2('0x50')](_[_0xd4c2('0x6c')](_0x3aecf9[_0xd4c2('0x4e')],_0x35983a['filters']));_0x5642f9[_0xd4c2('0x59')][_0xd4c2('0x67')]=_0x3bfc25['id'];if(_0x3aecf9['query'][_0xd4c2('0x57')]){_0x5642f9['where']=_['merge'](_0x5642f9['where'],{'$or':_[_0xd4c2('0x48')](_0x5642f9[_0xd4c2('0x52')],function(_0x21dc7d){var _0x1940c7={};_0x1940c7[_0x21dc7d]={'$like':'%'+_0x3aecf9[_0xd4c2('0x4e')]['filter']+'%'};return _0x1940c7;})});}_0x5642f9=_['merge']({},_0x5642f9,_0x3aecf9['options']);return db[_0xd4c2('0x71')]['count']({'where':_0x5642f9[_0xd4c2('0x59')]})[_0xd4c2('0x3c')](function(_0x2250b4){_0x535180[_0xd4c2('0x34')]=_0x2250b4;if(_0x3aecf9[_0xd4c2('0x4e')][_0xd4c2('0x5b')]){_0x5642f9[_0xd4c2('0x5c')]=[{'all':!![]}];}return db[_0xd4c2('0x71')][_0xd4c2('0x6d')](_0x5642f9);})['then'](function(_0x5007bc){_0x535180[_0xd4c2('0x5d')]=_0x5007bc;return _0x535180;});}})['then'](respondWithFilteredResult(_0x13db57,_0x5642f9))[_0xd4c2('0x2e')](handleError(_0x13db57,null));};exports['removeAnswers']=function(_0x220044,_0x2f97d3,_0x3f1af1){return db[_0xd4c2('0x49')][_0xd4c2('0x63')]({'where':{'id':_0x220044['params']['id']}})[_0xd4c2('0x3c')](handleEntityNotFound(_0x2f97d3,null))[_0xd4c2('0x3c')](function(_0x216181){if(_0x216181){return _0x216181[_0xd4c2('0x73')](_0x220044[_0xd4c2('0x4e')][_0xd4c2('0x6f')]);}})[_0xd4c2('0x3c')](respondWithStatusCode(_0x2f97d3,null))[_0xd4c2('0x2e')](handleError(_0x2f97d3,null));};exports['create']=function(_0x4a5235,_0x55910f){var _0x93204f={'name':_0x4a5235['body'][_0xd4c2('0x41')],'key':_0x4a5235[_0xd4c2('0x64')][_0xd4c2('0x4c')],'email':_0x4a5235[_0xd4c2('0x64')][_0xd4c2('0x74')],'ListId':_0x4a5235[_0xd4c2('0x64')][_0xd4c2('0x75')],'active':!_[_0xd4c2('0x76')](_0x4a5235[_0xd4c2('0x64')][_0xd4c2('0x77')])?_0x4a5235[_0xd4c2('0x64')][_0xd4c2('0x77')]:!![],'description':_0x4a5235[_0xd4c2('0x64')][_0xd4c2('0x78')]||null,'Imap':{},'Smtp':{}};if(_['isNil'](_0x4a5235[_0xd4c2('0x64')]['cservice'])){if(_0x4a5235[_0xd4c2('0x64')][_0xd4c2('0x79')]){_0x93204f['Imap'][_0xd4c2('0x7a')]=_0x93204f[_0xd4c2('0x60')][_0xd4c2('0x7a')]=_0x4a5235[_0xd4c2('0x64')]['cuser'];_0x93204f[_0xd4c2('0x5f')][_0xd4c2('0x7b')]=_0x93204f[_0xd4c2('0x60')][_0xd4c2('0x7c')]=_0x4a5235['body'][_0xd4c2('0x7d')];}else{_0x93204f[_0xd4c2('0x5f')][_0xd4c2('0x7e')]=_0x93204f['Smtp'][_0xd4c2('0x7e')]=![];}_0x93204f[_0xd4c2('0x5f')][_0xd4c2('0x7f')]=_0x4a5235[_0xd4c2('0x64')][_0xd4c2('0x5f')][_0xd4c2('0x7f')];_0x93204f[_0xd4c2('0x5f')]['port']=_0x4a5235[_0xd4c2('0x64')][_0xd4c2('0x5f')][_0xd4c2('0x80')];_0x93204f[_0xd4c2('0x60')][_0xd4c2('0x7f')]=_0x4a5235[_0xd4c2('0x64')][_0xd4c2('0x60')][_0xd4c2('0x7f')];_0x93204f[_0xd4c2('0x60')][_0xd4c2('0x80')]=_0x4a5235[_0xd4c2('0x64')][_0xd4c2('0x60')][_0xd4c2('0x80')];}else{_0x93204f[_0xd4c2('0x5f')][_0xd4c2('0x81')]=_0x93204f[_0xd4c2('0x60')][_0xd4c2('0x81')]=_0x4a5235[_0xd4c2('0x64')][_0xd4c2('0x82')];_0x93204f[_0xd4c2('0x5f')][_0xd4c2('0x7a')]=_0x93204f[_0xd4c2('0x60')][_0xd4c2('0x7a')]=_0x4a5235['body']['cuser'];_0x93204f[_0xd4c2('0x5f')][_0xd4c2('0x7b')]=_0x93204f[_0xd4c2('0x60')][_0xd4c2('0x7c')]=_0x4a5235[_0xd4c2('0x64')][_0xd4c2('0x7d')];}return db[_0xd4c2('0x49')][_0xd4c2('0x69')](_0x93204f,{'include':[{'model':db[_0xd4c2('0x45')],'as':_0xd4c2('0x60')},{'model':db[_0xd4c2('0x44')],'as':_0xd4c2('0x5f')}]})[_0xd4c2('0x3c')](function(_0xd45ba8){var _0x277624=_0x4a5235[_0xd4c2('0x7a')][_0xd4c2('0x3d')]({'plain':!![]});if(!_0x277624)throw new Error(_0xd4c2('0x83'));if(_0x277624[_0xd4c2('0x84')]==='user'){var _0x179377=_0xd45ba8['get']({'plain':!![]});return db[_0xd4c2('0x85')]['find']({'where':{'name':_0xd4c2('0x3e'),'userProfileId':_0x277624[_0xd4c2('0x86')]},'raw':!![]})[_0xd4c2('0x3c')](function(_0x9f9c9f){if(_0x9f9c9f&&_0x9f9c9f[_0xd4c2('0x87')]===0x0){return db[_0xd4c2('0x3f')]['create']({'name':_0x179377[_0xd4c2('0x41')],'resourceId':_0x179377['id'],'type':_0x9f9c9f[_0xd4c2('0x41')],'sectionId':_0x9f9c9f['id']},{})[_0xd4c2('0x3c')](function(){return _0xd45ba8;});}else{return _0xd45ba8;}})[_0xd4c2('0x2e')](function(_0x381bb6){logger[_0xd4c2('0x29')](_0xd4c2('0x88'),_0x381bb6);throw _0x381bb6;});}return _0xd45ba8;})[_0xd4c2('0x3c')](respondWithResult(_0x55910f,0xc9))[_0xd4c2('0x2e')](handleError(_0x55910f,null));};exports[_0xd4c2('0x89')]=function(_0x1227dc,_0x476113,_0x21e6b6){return db[_0xd4c2('0x49')][_0xd4c2('0x6b')]({'where':{'id':_0x1227dc[_0xd4c2('0x66')]['id']}})[_0xd4c2('0x3c')](handleEntityNotFound(_0x476113,null))[_0xd4c2('0x3c')](function(_0x5815e0){if(_0x5815e0){return _0x5815e0[_0xd4c2('0x89')]();}return null;})[_0xd4c2('0x3c')](respondWithResult(_0x476113,null))[_0xd4c2('0x2e')](handleError(_0x476113,null));};exports[_0xd4c2('0x8a')]=function(_0x27d602,_0x4048f4,_0x13389a){if(_0x27d602[_0xd4c2('0x64')]['id']){delete _0x27d602[_0xd4c2('0x64')]['id'];}return db[_0xd4c2('0x49')][_0xd4c2('0x63')]({'where':{'id':_0x27d602[_0xd4c2('0x66')]['id']}})[_0xd4c2('0x3c')](handleEntityNotFound(_0x4048f4,null))[_0xd4c2('0x3c')](function(_0x599562){if(_0x599562){_0x27d602[_0xd4c2('0x64')]['MailAccountId']=_0x599562['id'];return db[_0xd4c2('0x44')][_0xd4c2('0x69')](_0x27d602[_0xd4c2('0x64')]);}})[_0xd4c2('0x3c')](respondWithResult(_0x4048f4,null))[_0xd4c2('0x2e')](handleError(_0x4048f4,null));};exports['removeImap']=function(_0x3eee0a,_0x421006,_0x7362a6){return db[_0xd4c2('0x49')][_0xd4c2('0x6b')]({'where':{'id':_0x3eee0a[_0xd4c2('0x66')]['id']}})[_0xd4c2('0x3c')](handleEntityNotFound(_0x421006,null))[_0xd4c2('0x3c')](function(_0x5649f2){if(_0x5649f2){return _0x5649f2[_0xd4c2('0x8b')](null);}return null;})['then'](respondWithStatusCode(_0x421006,null))[_0xd4c2('0x2e')](handleError(_0x421006,null));};exports[_0xd4c2('0x8c')]=function(_0x1f1eee,_0x558b56,_0x8dc949){return db[_0xd4c2('0x49')][_0xd4c2('0x6b')]({'where':{'id':_0x1f1eee[_0xd4c2('0x66')]['id']}})['then'](handleEntityNotFound(_0x558b56,null))[_0xd4c2('0x3c')](function(_0x118113){if(_0x118113){return _0x118113[_0xd4c2('0x8c')]();}return null;})[_0xd4c2('0x3c')](respondWithResult(_0x558b56,null))[_0xd4c2('0x2e')](handleError(_0x558b56,null));};exports[_0xd4c2('0x8d')]=function(_0x41ca8f,_0x1ab06c,_0x58be2c){if(_0x41ca8f[_0xd4c2('0x64')]['id']){delete _0x41ca8f[_0xd4c2('0x64')]['id'];}return db[_0xd4c2('0x49')][_0xd4c2('0x63')]({'where':{'id':_0x41ca8f[_0xd4c2('0x66')]['id']}})[_0xd4c2('0x3c')](handleEntityNotFound(_0x1ab06c,null))[_0xd4c2('0x3c')](function(_0x4979e8){if(_0x4979e8){_0x41ca8f['body']['MailAccountId']=_0x4979e8['id'];return db[_0xd4c2('0x45')][_0xd4c2('0x69')](_0x41ca8f[_0xd4c2('0x64')]);}})['then'](respondWithResult(_0x1ab06c,null))[_0xd4c2('0x2e')](handleError(_0x1ab06c,null));};exports[_0xd4c2('0x8e')]=function(_0x3ead23,_0x59b420,_0x4199e3){return db[_0xd4c2('0x49')][_0xd4c2('0x6b')]({'where':{'id':_0x3ead23[_0xd4c2('0x66')]['id']}})['then'](handleEntityNotFound(_0x59b420,null))['then'](function(_0x1459c6){if(_0x1459c6){return _0x1459c6[_0xd4c2('0x8f')](null);}return null;})[_0xd4c2('0x3c')](respondWithStatusCode(_0x59b420,null))[_0xd4c2('0x2e')](handleError(_0x59b420,null));};exports[_0xd4c2('0x90')]=function(_0x1d79dc,_0x46b6d9,_0x4775af){return db['MailInteraction']['find']({'where':{'id':_0x1d79dc['params']['id']}})[_0xd4c2('0x3c')](handleEntityNotFound(_0x46b6d9,null))[_0xd4c2('0x3c')](function(_0xe4bbc2){if(_0xe4bbc2){return _0xe4bbc2[_0xd4c2('0x90')](_0x1d79dc[_0xd4c2('0x64')]['ids'],_['omit'](_0x1d79dc[_0xd4c2('0x64')],[_0xd4c2('0x6f'),'id'])||{});}})[_0xd4c2('0x3c')](respondWithResult(_0x46b6d9,null))[_0xd4c2('0x2e')](handleError(_0x46b6d9,null));};exports[_0xd4c2('0x91')]=function(_0xce5443,_0x4381b1,_0x10ea71){var _0x3fc987={'raw':![],'where':{}};var _0x5bad8a={};var _0x4d943f={'count':0x0,'rows':[]};return db[_0xd4c2('0x49')][_0xd4c2('0x6b')]({'where':{'id':_0xce5443[_0xd4c2('0x66')]['id']}})[_0xd4c2('0x3c')](handleEntityNotFound(_0x4381b1,null))[_0xd4c2('0x3c')](function(_0x1d1f58){if(_0x1d1f58){_0x5bad8a[_0xd4c2('0x4d')]=_['keys'](db[_0xd4c2('0x92')][_0xd4c2('0x93')]);_0x5bad8a[_0xd4c2('0x4e')]=_[_0xd4c2('0x4f')](_0xce5443['query']);_0x5bad8a[_0xd4c2('0x50')]=_[_0xd4c2('0x51')](_0x5bad8a[_0xd4c2('0x4d')],_0x5bad8a[_0xd4c2('0x4e')]);_0x3fc987[_0xd4c2('0x52')]=_[_0xd4c2('0x51')](_0x5bad8a[_0xd4c2('0x4d')],qs[_0xd4c2('0x61')](_0xce5443[_0xd4c2('0x4e')]['fields']));_0x3fc987[_0xd4c2('0x52')]=_0x3fc987[_0xd4c2('0x52')][_0xd4c2('0x62')]?_0x3fc987[_0xd4c2('0x52')]:_0x5bad8a[_0xd4c2('0x4d')];if(!_0xce5443['query']['hasOwnProperty'](_0xd4c2('0x54'))){_0x3fc987[_0xd4c2('0x36')]=qs['limit'](_0xce5443[_0xd4c2('0x4e')]['limit']);_0x3fc987[_0xd4c2('0x35')]=qs['offset'](_0xce5443[_0xd4c2('0x4e')][_0xd4c2('0x35')]);}_0x3fc987['order']=qs[_0xd4c2('0x56')](_0xce5443['query'][_0xd4c2('0x56')]);_0x3fc987[_0xd4c2('0x59')]=qs[_0xd4c2('0x50')](_['pick'](_0xce5443['query'],_0x5bad8a['filters']));_0x3fc987[_0xd4c2('0x59')]['MailAccountId']=_0x1d1f58['id'];if(_0xce5443[_0xd4c2('0x4e')][_0xd4c2('0x57')]){_0x3fc987[_0xd4c2('0x59')]=_[_0xd4c2('0x58')](_0x3fc987['where'],{'$or':_[_0xd4c2('0x48')](_0x3fc987[_0xd4c2('0x52')],function(_0x45e852){var _0x1023d2={};_0x1023d2[_0x45e852]={'$like':'%'+_0xce5443[_0xd4c2('0x4e')][_0xd4c2('0x57')]+'%'};return _0x1023d2;})});}_0x3fc987=_[_0xd4c2('0x58')]({},_0x3fc987,_0xce5443[_0xd4c2('0x5a')]);return db[_0xd4c2('0x92')][_0xd4c2('0x34')]({'where':_0x3fc987[_0xd4c2('0x59')]})[_0xd4c2('0x3c')](function(_0x5899ba){_0x4d943f[_0xd4c2('0x34')]=_0x5899ba;if(_0xce5443[_0xd4c2('0x4e')]['includeAll']){_0x3fc987['include']=[{'model':db[_0xd4c2('0x94')],'as':'Contact','required':![]},{'model':db[_0xd4c2('0x95')],'as':'Owner','attributes':[_0xd4c2('0x41'),'fullname','internal'],'required':![]},{'model':db[_0xd4c2('0x96')],'as':_0xd4c2('0x97'),'attributes':['id','name',_0xd4c2('0x98')],'where':_0xce5443[_0xd4c2('0x4e')][_0xd4c2('0x99')]?{'id':_0xce5443['query'][_0xd4c2('0x99')]}:undefined,'required':_0xce5443['query'][_0xd4c2('0x99')]?!![]:![]}];}return db[_0xd4c2('0x92')][_0xd4c2('0x6d')](_0x3fc987);})[_0xd4c2('0x3c')](function(_0x2ff009){_0x4d943f['rows']=_0x2ff009;return _0x4d943f;});}})[_0xd4c2('0x3c')](respondWithFilteredResult(_0x4381b1,_0x3fc987))[_0xd4c2('0x2e')](handleError(_0x4381b1,null));};exports[_0xd4c2('0x9a')]=function(_0x3fe055,_0x39982c,_0x3486b8){return db['MailAccount']['findOne']({'where':{'id':_0x3fe055[_0xd4c2('0x66')]['id']}})[_0xd4c2('0x3c')](handleEntityNotFound(_0x39982c,null))[_0xd4c2('0x3c')](function(_0x4e4be0){if(_0x4e4be0){return db[_0xd4c2('0x9b')][_0xd4c2('0x9c')](function(_0x172144){return db['MailApplication'][_0xd4c2('0x3b')]({'where':{'MailAccountId':_0x3fe055[_0xd4c2('0x66')]['id']},'transaction':_0x172144})[_0xd4c2('0x3c')](function(_0x354230){var _0x56b87d=_[_0xd4c2('0x48')](_0x3fe055[_0xd4c2('0x64')],function(_0x3c84d7){_0x3c84d7[_0xd4c2('0x67')]=_0x3fe055[_0xd4c2('0x66')]['id'];return _0x3c84d7;});return db[_0xd4c2('0x9d')]['bulkCreate'](_0x56b87d,{'transaction':_0x172144});});})[_0xd4c2('0x3c')](function(){return db[_0xd4c2('0x9d')][_0xd4c2('0x9e')]({'where':{'MailAccountId':_0x3fe055[_0xd4c2('0x66')]['id']},'order':'priority'});});}})[_0xd4c2('0x3c')](respondWithResult(_0x39982c,null))['catch'](handleError(_0x39982c,null));};exports[_0xd4c2('0x9f')]=function(_0x4406e7,_0x17bad2,_0x152daf){var _0x41e660={};var _0x12827f={};var _0x517db9;var _0x2acd01;return db[_0xd4c2('0x49')][_0xd4c2('0x6b')]({'where':{'id':_0x4406e7[_0xd4c2('0x66')]['id']}})[_0xd4c2('0x3c')](handleEntityNotFound(_0x17bad2,null))[_0xd4c2('0x3c')](function(_0x47fdb4){if(_0x47fdb4){_0x517db9=_0x47fdb4;_0x12827f['model']=_[_0xd4c2('0x4f')](db['MailApplication'][_0xd4c2('0x93')]);_0x12827f[_0xd4c2('0x4e')]=_[_0xd4c2('0x4f')](_0x4406e7['query']);_0x12827f[_0xd4c2('0x50')]=_['intersection'](_0x12827f[_0xd4c2('0x4d')],_0x12827f['query']);_0x41e660[_0xd4c2('0x52')]=_['intersection'](_0x12827f[_0xd4c2('0x4d')],qs[_0xd4c2('0x61')](_0x4406e7[_0xd4c2('0x4e')][_0xd4c2('0x61')]));_0x41e660[_0xd4c2('0x52')]=_0x41e660[_0xd4c2('0x52')]['length']?_0x41e660[_0xd4c2('0x52')]:_0x12827f[_0xd4c2('0x4d')];_0x41e660[_0xd4c2('0x55')]=qs[_0xd4c2('0x56')](_0x4406e7['query'][_0xd4c2('0x56')]);_0x41e660[_0xd4c2('0x59')]=qs[_0xd4c2('0x50')](_[_0xd4c2('0x6c')](_0x4406e7['query'],_0x12827f[_0xd4c2('0x50')]));if(_0x4406e7[_0xd4c2('0x4e')][_0xd4c2('0x57')]){_0x41e660['where']=_[_0xd4c2('0x58')](_0x41e660[_0xd4c2('0x59')],{'$or':_[_0xd4c2('0x48')](_0x41e660['attributes'],function(_0x32f292){var _0x59a800={};_0x59a800[_0x32f292]={'$like':'%'+_0x4406e7[_0xd4c2('0x4e')][_0xd4c2('0x57')]+'%'};return _0x59a800;})});}_0x41e660=_[_0xd4c2('0x58')]({},_0x41e660,_0x4406e7[_0xd4c2('0x5a')]);return _0x517db9['getApplications'](_0x41e660);}})['then'](function(_0x40c3ff){if(_0x40c3ff){_0x2acd01=_0x40c3ff[_0xd4c2('0x62')];if(!_0x4406e7[_0xd4c2('0x4e')][_0xd4c2('0x53')](_0xd4c2('0x54'))){_0x41e660[_0xd4c2('0x36')]=qs[_0xd4c2('0x36')](_0x4406e7['query'][_0xd4c2('0x36')]);_0x41e660['offset']=qs[_0xd4c2('0x35')](_0x4406e7['query']['offset']);}return _0x517db9[_0xd4c2('0x9f')](_0x41e660);}})[_0xd4c2('0x3c')](function(_0xa599de){if(_0xa599de){return _0xa599de?{'count':_0x2acd01,'rows':_0xa599de}:null;}})[_0xd4c2('0x3c')](respondWithResult(_0x17bad2,null))[_0xd4c2('0x2e')](handleError(_0x17bad2,null));};exports['getMessages']=function(_0xd99a83,_0x497558,_0x14d14d){var _0x5de6a7={'raw':!![],'where':{}};var _0x4d6dca={};var _0x4063b5={'count':0x0,'rows':[]};return db[_0xd4c2('0x49')][_0xd4c2('0x6b')]({'where':{'id':_0xd99a83[_0xd4c2('0x66')]['id']}})[_0xd4c2('0x3c')](handleEntityNotFound(_0x497558,null))[_0xd4c2('0x3c')](function(_0x15b4f7){if(_0x15b4f7){_0x4d6dca[_0xd4c2('0x4d')]=_[_0xd4c2('0x4f')](db[_0xd4c2('0xa0')]['rawAttributes']);_0x4d6dca[_0xd4c2('0x4e')]=_[_0xd4c2('0x4f')](_0xd99a83[_0xd4c2('0x4e')]);_0x4d6dca[_0xd4c2('0x50')]=_[_0xd4c2('0x51')](_0x4d6dca[_0xd4c2('0x4d')],_0x4d6dca['query']);_0x5de6a7['attributes']=_[_0xd4c2('0x51')](_0x4d6dca[_0xd4c2('0x4d')],qs[_0xd4c2('0x61')](_0xd99a83[_0xd4c2('0x4e')][_0xd4c2('0x61')]));_0x5de6a7['attributes']=_0x5de6a7[_0xd4c2('0x52')][_0xd4c2('0x62')]?_0x5de6a7[_0xd4c2('0x52')]:_0x4d6dca['model'];if(!_0xd99a83['query'][_0xd4c2('0x53')](_0xd4c2('0x54'))){_0x5de6a7['limit']=qs[_0xd4c2('0x36')](_0xd99a83[_0xd4c2('0x4e')][_0xd4c2('0x36')]);_0x5de6a7['offset']=qs[_0xd4c2('0x35')](_0xd99a83[_0xd4c2('0x4e')][_0xd4c2('0x35')]);}_0x5de6a7['order']=qs[_0xd4c2('0x56')](_0xd99a83[_0xd4c2('0x4e')][_0xd4c2('0x56')]);_0x5de6a7[_0xd4c2('0x59')]=qs['filters'](_['pick'](_0xd99a83[_0xd4c2('0x4e')],_0x4d6dca[_0xd4c2('0x50')]));_0x5de6a7[_0xd4c2('0x59')][_0xd4c2('0x67')]=_0x15b4f7['id'];if(_0xd99a83[_0xd4c2('0x4e')]['filter']){_0x5de6a7[_0xd4c2('0x59')]=_[_0xd4c2('0x58')](_0x5de6a7['where'],{'$or':_[_0xd4c2('0x48')](_0x5de6a7[_0xd4c2('0x52')],function(_0x2ffc2e){var _0x46832c={};_0x46832c[_0x2ffc2e]={'$like':'%'+_0xd99a83[_0xd4c2('0x4e')][_0xd4c2('0x57')]+'%'};return _0x46832c;})});}if(_0xd99a83[_0xd4c2('0x4e')]['$gte']){var _0x5562c4=_0xd99a83[_0xd4c2('0x4e')][_0xd4c2('0xa1')][_0xd4c2('0xa2')](',');var _0x121d22={};_0x121d22[_0x5562c4[0x0]]={'$gte':moment(_0x5562c4[0x1])[_0xd4c2('0xa3')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5de6a7[_0xd4c2('0x59')]=_[_0xd4c2('0x58')](_0x5de6a7[_0xd4c2('0x59')],_0x121d22);}_0x5de6a7=_[_0xd4c2('0x58')]({},_0x5de6a7,_0xd99a83[_0xd4c2('0x5a')]);return db[_0xd4c2('0xa0')]['count']({'where':_0x5de6a7[_0xd4c2('0x59')]})['then'](function(_0xffbb22){_0x4063b5[_0xd4c2('0x34')]=_0xffbb22;if(_0xd99a83[_0xd4c2('0x4e')][_0xd4c2('0x5b')]){_0x5de6a7[_0xd4c2('0x5c')]=[{'all':!![]}];}return db[_0xd4c2('0xa0')][_0xd4c2('0x6d')](_0x5de6a7);})[_0xd4c2('0x3c')](function(_0x57d31a){if(_0xd99a83[_0xd4c2('0x4e')][_0xd4c2('0xa4')]===_0xd4c2('0xa5')){for(var _0x466435=0x0;_0x466435<_0x57d31a[_0xd4c2('0x62')];_0x466435++){_0x57d31a[_0x466435][_0xd4c2('0x64')]=juice(_0x57d31a[_0x466435][_0xd4c2('0x64')]);}}_0x4063b5[_0xd4c2('0x5d')]=_0x57d31a;return _0x4063b5;});}})['then'](respondWithFilteredResult(_0x497558,_0x5de6a7))[_0xd4c2('0x2e')](handleError(_0x497558,null));};exports[_0xd4c2('0x42')]=function(_0x143e7d,_0x339a82,_0x358803){var _0x5ab8bb,_0x1a8e68={},_0x5f544d;if(_0x143e7d[_0xd4c2('0x64')]['to']){_0x5f544d=_0x143e7d[_0xd4c2('0x64')]['to'][_0xd4c2('0xa2')](',')[0x0];}return db[_0xd4c2('0x49')]['find']({'where':{'id':_0x143e7d[_0xd4c2('0x66')]['id']},'include':[{'model':db[_0xd4c2('0xa6')],'as':_0xd4c2('0xa7'),'include':[{'model':db[_0xd4c2('0x94')],'as':_0xd4c2('0xa8'),'where':{'email':_0x5f544d},'limit':0x1,'order':[[_0xd4c2('0xa9'),_0xd4c2('0xaa')]]}]},{'model':db['MailServerOut'],'as':_0xd4c2('0x60'),'raw':!![]}]})[_0xd4c2('0x3c')](handleEntityNotFound(_0x339a82,null))[_0xd4c2('0x3c')](function(_0x3813b1){if(_0x3813b1){_0x5ab8bb=_0x3813b1;if(_0x3813b1[_0xd4c2('0x60')]){if(_['isNil'](_0x143e7d[_0xd4c2('0x64')]['from'])){_0x143e7d['body'][_0xd4c2('0xab')]=util[_0xd4c2('0xa3')](_0xd4c2('0xac'),_0x3813b1['name'],_0x3813b1['email']||_0x3813b1[_0xd4c2('0x60')][_0xd4c2('0x7a')]);}if(_0x143e7d[_0xd4c2('0x64')][_0xd4c2('0xad')]&&_0x143e7d[_0xd4c2('0x64')][_0xd4c2('0xad')]['length']){for(var _0x190a49=0x0;_0x190a49<_0x143e7d[_0xd4c2('0x64')][_0xd4c2('0xad')][_0xd4c2('0x62')];_0x190a49+=0x1){_0x143e7d[_0xd4c2('0x64')][_0xd4c2('0xad')][_0x190a49]={'filename':_0x143e7d['body'][_0xd4c2('0xad')][_0x190a49][_0xd4c2('0x41')],'path':path['join'](config[_0xd4c2('0xae')],'server/files/attachments',_0x143e7d['body'][_0xd4c2('0xad')][_0x190a49][_0xd4c2('0xaf')])};}}var _0x35b585={'tls':{'rejectUnauthorized':![]}};if(_[_0xd4c2('0x76')](_0x3813b1[_0xd4c2('0x60')][_0xd4c2('0x81')])){if(_0x3813b1['Smtp'][_0xd4c2('0x7e')]){_0x35b585[_0xd4c2('0xb0')]={'user':_0x3813b1[_0xd4c2('0x60')][_0xd4c2('0x7a')],'pass':_0x3813b1[_0xd4c2('0x60')]['pass']};}_0x35b585[_0xd4c2('0x7f')]=_0x3813b1[_0xd4c2('0x60')][_0xd4c2('0x7f')];_0x35b585['port']=_0x3813b1[_0xd4c2('0x60')][_0xd4c2('0x80')];_0x35b585[_0xd4c2('0xb1')]=_0x3813b1['Smtp'][_0xd4c2('0xb1')];}else{_0x35b585[_0xd4c2('0x81')]=_0x3813b1[_0xd4c2('0x60')]['service'];_0x35b585[_0xd4c2('0xb0')]={'user':_0x3813b1[_0xd4c2('0x60')][_0xd4c2('0x7a')],'pass':_0x3813b1[_0xd4c2('0x60')][_0xd4c2('0x7c')]};}return respondWithRpcPromise(_0xd4c2('0xb2'),_0xd4c2('0xb3'),{'account':_0x35b585,'message':_0x143e7d[_0xd4c2('0x64')]});}else{throw new Error(_0xd4c2('0xb4'));}}})[_0xd4c2('0x3c')](function(_0x516ce8){if(_0x516ce8){_0x1a8e68=_0x516ce8;if(_0x5ab8bb['List']){if(_0x5ab8bb[_0xd4c2('0xa7')][_0xd4c2('0xa8')]['length']){return _0x5ab8bb[_0xd4c2('0xa7')][_0xd4c2('0xa8')][0x0];}else{return db[_0xd4c2('0x94')]['create'](_[_0xd4c2('0xb5')](_0x143e7d[_0xd4c2('0x64')],{'firstName':_0x143e7d[_0xd4c2('0x64')]['to'],'email':_0x143e7d[_0xd4c2('0x64')]['to'],'phone':_0x143e7d['body']['to'],'ListId':_0x5ab8bb[_0xd4c2('0x75')]}));}}else{throw new Error(_0xd4c2('0xb4'));}}})[_0xd4c2('0x3c')](function(_0x44e79f){if(_0x44e79f){var _0x246d91={'UserId':_0x143e7d[_0xd4c2('0x7a')]['id'],'ContactId':_0x44e79f['id'],'MailAccountId':_0x5ab8bb['id'],'inReplyTo':_0x1a8e68[_0xd4c2('0xb6')],'to':_0x143e7d[_0xd4c2('0x64')][_0xd4c2('0xab')],'cc':_0x143e7d[_0xd4c2('0x64')]['cc'],'subject':_0x143e7d[_0xd4c2('0x64')][_0xd4c2('0xb7')],'attach':_0x143e7d[_0xd4c2('0x64')][_0xd4c2('0xb8')],'firstMsgDirection':_0xd4c2('0xb9'),'lastMsgAt':moment()[_0xd4c2('0xa3')](_0xd4c2('0xba')),'lastMsgDirection':_0xd4c2('0xb9'),'Messages':[_[_0xd4c2('0x58')](_0x143e7d[_0xd4c2('0x64')],{'messageId':_0x1a8e68[_0xd4c2('0xb6')],'sentAt':moment()[_0xd4c2('0xa3')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x5ab8bb['id'],'UserId':_0x143e7d['user']['id'],'ContactId':_0x44e79f['id']})]};if(_0x143e7d[_0xd4c2('0x64')]['Interaction']){_0x246d91=_[_0xd4c2('0x58')](_0x246d91,_0x143e7d['body'][_0xd4c2('0xbb')]);}return db[_0xd4c2('0x92')][_0xd4c2('0x69')](_0x246d91,{'include':[{'model':db[_0xd4c2('0xa0')],'as':_0xd4c2('0xbc')}]});}})[_0xd4c2('0x3c')](respondWithResult(_0x339a82,null))[_0xd4c2('0x2e')](handleError(_0x339a82,null));};exports[_0xd4c2('0xbd')]=function(_0x5b67ac,_0x4fe99b,_0x28e375){return db[_0xd4c2('0x49')][_0xd4c2('0x63')]({'where':{'id':_0x5b67ac['params']['id']},'include':[{'model':db['MailServerOut'],'as':_0xd4c2('0x60'),'raw':!![]}]})[_0xd4c2('0x3c')](handleEntityNotFound(_0x4fe99b,null))[_0xd4c2('0x3c')](function(_0x121d0e){if(_0x121d0e&&_0x121d0e['Smtp']){var _0x47ecff={'id':_0x121d0e['id'],'tls':{'rejectUnauthorized':![]}};if(_0x121d0e[_0xd4c2('0x60')]['service']){_0x47ecff[_0xd4c2('0x81')]=_0x121d0e[_0xd4c2('0x60')][_0xd4c2('0x81')];}else{_0x47ecff['host']=_0x121d0e[_0xd4c2('0x60')][_0xd4c2('0x7f')];_0x47ecff['port']=_0x121d0e[_0xd4c2('0x60')][_0xd4c2('0x80')];_0x47ecff[_0xd4c2('0xb1')]=_0x121d0e['Smtp'][_0xd4c2('0xb1')];}if(_0x121d0e[_0xd4c2('0x60')][_0xd4c2('0x7e')]){_0x47ecff[_0xd4c2('0xb0')]={'user':_0x121d0e[_0xd4c2('0x60')][_0xd4c2('0x7a')],'pass':_0x121d0e[_0xd4c2('0x60')][_0xd4c2('0x7c')]};}return respondWithRpcPromise(_0xd4c2('0xbe'),'verifySmtp',{'account':_0x47ecff});}})[_0xd4c2('0x3c')](respondWithResult(_0x4fe99b,null))[_0xd4c2('0x2e')](handleError(_0x4fe99b,null));};exports[_0xd4c2('0x3b')]=function(_0x14b136,_0x44c99e){return db[_0xd4c2('0x49')][_0xd4c2('0x63')]({'where':{'id':_0x14b136[_0xd4c2('0x66')]['id']}})['then'](handleEntityNotFound(_0x44c99e,null))[_0xd4c2('0x3c')](function(_0x2d8a46){if(_0x2d8a46&&_0x2d8a46[_0xd4c2('0x81')]){throw new db[(_0xd4c2('0xbf'))][(_0xd4c2('0xc0'))](_0xd4c2('0xc1'));}return _0x2d8a46;})[_0xd4c2('0x3c')](removeEntity(_0x44c99e,null))[_0xd4c2('0x2e')](handleError(_0x44c99e,null));};exports['addAgents']=function(_0x289669,_0x5e314f,_0x5c0b9a){return db[_0xd4c2('0x49')]['find']({'where':{'id':_0x289669[_0xd4c2('0x66')]['id']}})['then'](handleEntityNotFound(_0x5e314f,null))[_0xd4c2('0x3c')](function(_0x23633f){if(_0x23633f){return _0x23633f['addAgents'](_0x289669[_0xd4c2('0x64')][_0xd4c2('0x6f')],_[_0xd4c2('0xc2')](_0x289669['body'],[_0xd4c2('0x6f'),'id'])||{})[_0xd4c2('0xc3')](function(_0x272a71){for(var _0x19552a=0x0;_0x19552a<_0x289669[_0xd4c2('0x64')][_0xd4c2('0x6f')][_0xd4c2('0x62')];_0x19552a+=0x1){socket[_0xd4c2('0xc4')](_0xd4c2('0xc5'),{'UserId':Number(_0x289669['body'][_0xd4c2('0x6f')][_0x19552a]),'MailAccountId':Number(_0x289669[_0xd4c2('0x66')]['id'])});}return _0x272a71;});}})[_0xd4c2('0x3c')](respondWithResult(_0x5e314f,null))['catch'](handleError(_0x5e314f,null));};exports[_0xd4c2('0xc6')]=function(_0x2bd074,_0x2f4280,_0x7f2431){return db[_0xd4c2('0x49')][_0xd4c2('0x63')]({'where':{'id':_0x2bd074[_0xd4c2('0x66')]['id']}})[_0xd4c2('0x3c')](handleEntityNotFound(_0x2f4280,null))[_0xd4c2('0x3c')](function(_0x48188e){if(_0x48188e){return _0x48188e[_0xd4c2('0xc6')](_0x2bd074[_0xd4c2('0x4e')][_0xd4c2('0x6f')])[_0xd4c2('0x3c')](function(){if(_[_0xd4c2('0xc7')](_0x2bd074[_0xd4c2('0x4e')]['ids'])){for(var _0x1a1edf=0x0;_0x1a1edf<_0x2bd074[_0xd4c2('0x4e')][_0xd4c2('0x6f')][_0xd4c2('0x62')];_0x1a1edf+=0x1){socket[_0xd4c2('0xc4')]('userMailAccount:remove',{'UserId':Number(_0x2bd074[_0xd4c2('0x4e')][_0xd4c2('0x6f')][_0x1a1edf]),'MailAccountId':Number(_0x2bd074[_0xd4c2('0x66')]['id'])});}}else{socket[_0xd4c2('0xc4')](_0xd4c2('0xc8'),{'UserId':Number(_0x2bd074['query'][_0xd4c2('0x6f')]),'MailAccountId':Number(_0x2bd074[_0xd4c2('0x66')]['id'])});}});}})[_0xd4c2('0x3c')](respondWithStatusCode(_0x2f4280,null))[_0xd4c2('0x2e')](handleError(_0x2f4280,null));};exports[_0xd4c2('0xc9')]=function(_0x40613e,_0x521dcb,_0x4afc6f){var _0xe2b9a7={};var _0x2326ac={};var _0x305292;var _0x5e0520;return db[_0xd4c2('0x49')][_0xd4c2('0x6b')]({'where':{'id':_0x40613e[_0xd4c2('0x66')]['id']}})[_0xd4c2('0x3c')](handleEntityNotFound(_0x521dcb,null))[_0xd4c2('0x3c')](function(_0x71944d){if(_0x71944d){_0x305292=_0x71944d;_0x2326ac[_0xd4c2('0x4d')]=_[_0xd4c2('0x4f')](db[_0xd4c2('0x95')]['rawAttributes']);_0x2326ac['query']=_['keys'](_0x40613e['query']);_0x2326ac[_0xd4c2('0x50')]=_[_0xd4c2('0x51')](_0x2326ac[_0xd4c2('0x4d')],_0x2326ac['query']);_0xe2b9a7[_0xd4c2('0x52')]=_[_0xd4c2('0x51')](_0x2326ac['model'],qs[_0xd4c2('0x61')](_0x40613e[_0xd4c2('0x4e')]['fields']));_0xe2b9a7[_0xd4c2('0x52')]=_0xe2b9a7[_0xd4c2('0x52')][_0xd4c2('0x62')]?_0xe2b9a7[_0xd4c2('0x52')]:_0x2326ac[_0xd4c2('0x4d')];_0xe2b9a7[_0xd4c2('0x55')]=qs['sort'](_0x40613e[_0xd4c2('0x4e')]['sort']);_0xe2b9a7[_0xd4c2('0x59')]=qs['filters'](_['pick'](_0x40613e[_0xd4c2('0x4e')],_0x2326ac[_0xd4c2('0x50')]));if(_0x40613e[_0xd4c2('0x4e')][_0xd4c2('0x57')]){_0xe2b9a7[_0xd4c2('0x59')]=_['merge'](_0xe2b9a7[_0xd4c2('0x59')],{'$or':_['map'](_0xe2b9a7['attributes'],function(_0x589d0d){var _0x3d7f1c={};_0x3d7f1c[_0x589d0d]={'$like':'%'+_0x40613e[_0xd4c2('0x4e')][_0xd4c2('0x57')]+'%'};return _0x3d7f1c;})});}_0xe2b9a7=_[_0xd4c2('0x58')]({},_0xe2b9a7,_0x40613e[_0xd4c2('0x5a')]);return _0x305292['getAgents'](_0xe2b9a7);}})[_0xd4c2('0x3c')](function(_0x512d96){if(_0x512d96){_0x5e0520=_0x512d96['length'];if(!_0x40613e['query'][_0xd4c2('0x53')]('nolimit')){_0xe2b9a7['limit']=qs[_0xd4c2('0x36')](_0x40613e[_0xd4c2('0x4e')][_0xd4c2('0x36')]);_0xe2b9a7[_0xd4c2('0x35')]=qs[_0xd4c2('0x35')](_0x40613e[_0xd4c2('0x4e')][_0xd4c2('0x35')]);}return _0x305292[_0xd4c2('0xc9')](_0xe2b9a7);}})[_0xd4c2('0x3c')](function(_0x380fc7){if(_0x380fc7){return _0x380fc7?{'count':_0x5e0520,'rows':_0x380fc7}:null;}})[_0xd4c2('0x3c')](respondWithResult(_0x521dcb,null))[_0xd4c2('0x2e')](handleError(_0x521dcb,null));}; \ No newline at end of file +var _0x6ef0=['http','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','get','UserProfileResource','stack','name','send','index','MailServerIn','Imap','MailServerOut','Smtp','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','options','include','rows','show','params','keys','length','merge','find','update','body','describe','addDisposition','MailAccountId','Disposition','getDispositions','findOne','order','includeAll','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','findAll','removeAnswers','create','email','ListId','isNil','description','cservice','user','cuser','password','pass','cpassword','authentication','host','port','service','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MailAccounts','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','format','inlineCss','split','CmList','List','Contacts','updatedAt','DESC','from','%s\x20<%s>','attachments','join','root','auth','secure','SendMail','sendMail','List\x20not\x20found','messageId','subject','attach','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','removeAgents','isArray','userMailAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','html-to-text','juice','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x6ef0,0x17a));var _0x06ef=function(_0x3b231a,_0x53a00d){_0x3b231a=_0x3b231a-0x0;var _0x18d67a=_0x6ef0[_0x3b231a];return _0x18d67a;};'use strict';var emlformat=require(_0x06ef('0x0'));var rimraf=require(_0x06ef('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x06ef('0x2'));var rp=require(_0x06ef('0x3'));var moment=require(_0x06ef('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x06ef('0x5'));var util=require(_0x06ef('0x6'));var path=require(_0x06ef('0x7'));var sox=require(_0x06ef('0x8'));var csv=require(_0x06ef('0x9'));var ejs=require(_0x06ef('0xa'));var fs=require('fs');var fs_extra=require(_0x06ef('0xb'));var _=require(_0x06ef('0xc'));var squel=require(_0x06ef('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x06ef('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var htmlToText=require(_0x06ef('0xf'));var juice=require(_0x06ef('0x10'));var Redis=require(_0x06ef('0x11'));var authService=require(_0x06ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x06ef('0x13'));var logger=require(_0x06ef('0x14'))(_0x06ef('0x15'));var utils=require(_0x06ef('0x16'));var config=require(_0x06ef('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x06ef('0x18'))['db'];config[_0x06ef('0x19')]=_[_0x06ef('0x1a')](config[_0x06ef('0x19')],{'host':_0x06ef('0x1b'),'port':0x18eb});var socket=require(_0x06ef('0x1c'))(new Redis(config['redis']));require('./mailAccount.socket')[_0x06ef('0x1d')](socket);var jayson=require(_0x06ef('0x1e'));var client=jayson[_0x06ef('0x1f')][_0x06ef('0x20')]({'port':0x232b});function respondWithRpcPromise(_0xc86bf1,_0x153c17,_0x4970bb,_0x461658){return new BPromise(function(_0x3a2313,_0x2e45c0){var _0x5ab828=_0x461658||client;return _0x5ab828[_0x06ef('0x21')](_0xc86bf1,_0x4970bb)[_0x06ef('0x22')](function(_0x456edf){logger['info'](_0x06ef('0x23'),_0x153c17,_0x06ef('0x24'));logger[_0x06ef('0x25')](_0x06ef('0x26'),_0x153c17,_0x06ef('0x24'),JSON[_0x06ef('0x27')](_0x456edf));if(_0x456edf[_0x06ef('0x28')]){if(_0x456edf[_0x06ef('0x28')][_0x06ef('0x29')]===0x1f4){logger[_0x06ef('0x28')]('MailAccount,\x20%s,\x20%s',_0x153c17,_0x456edf[_0x06ef('0x28')][_0x06ef('0x2a')]);return _0x2e45c0(_0x456edf[_0x06ef('0x28')][_0x06ef('0x2a')]);}logger[_0x06ef('0x28')]('MailAccount,\x20%s,\x20%s',_0x153c17,_0x456edf[_0x06ef('0x28')][_0x06ef('0x2a')]);return _0x3a2313(_0x456edf[_0x06ef('0x28')][_0x06ef('0x2a')]);}else{logger[_0x06ef('0x2b')](_0x06ef('0x23'),_0x153c17,_0x06ef('0x24'));_0x3a2313(_0x456edf[_0x06ef('0x2c')][_0x06ef('0x2a')]);}})[_0x06ef('0x2d')](function(_0x1a7f59){logger[_0x06ef('0x28')](_0x06ef('0x23'),_0x153c17,_0x1a7f59);_0x2e45c0(_0x1a7f59);});});}function respondWithStatusCode(_0x90dd5f,_0x3b841b){_0x3b841b=_0x3b841b||0xcc;return function(_0x498aed){if(_0x498aed){return _0x90dd5f[_0x06ef('0x2e')](_0x3b841b);}return _0x90dd5f[_0x06ef('0x2f')](_0x3b841b)[_0x06ef('0x30')]();};}function respondWithResult(_0x38e5d6,_0x53eb03){_0x53eb03=_0x53eb03||0xc8;return function(_0x19dfd1){if(_0x19dfd1){return _0x38e5d6[_0x06ef('0x2f')](_0x53eb03)[_0x06ef('0x31')](_0x19dfd1);}};}function respondWithFilteredResult(_0x39dbb5,_0xc682ea){return function(_0x4ae94b){if(_0x4ae94b){var _0x259539=typeof _0xc682ea[_0x06ef('0x32')]===_0x06ef('0x33')&&typeof _0xc682ea[_0x06ef('0x34')]===_0x06ef('0x33');var _0x199ae5=_0x4ae94b[_0x06ef('0x35')];var _0x93e82c=_0x259539?0x0:_0xc682ea[_0x06ef('0x32')];var _0x3eb4fe=_0x259539?_0x4ae94b[_0x06ef('0x35')]:_0xc682ea[_0x06ef('0x32')]+_0xc682ea[_0x06ef('0x34')];var _0xd03edc;if(_0x3eb4fe>=_0x199ae5){_0x3eb4fe=_0x199ae5;_0xd03edc=0xc8;}else{_0xd03edc=0xce;}_0x39dbb5[_0x06ef('0x2f')](_0xd03edc);return _0x39dbb5[_0x06ef('0x36')](_0x06ef('0x37'),_0x93e82c+'-'+_0x3eb4fe+'/'+_0x199ae5)[_0x06ef('0x31')](_0x4ae94b);}return null;};}function patchUpdates(_0x1fa74f){return function(_0x257c8f){try{jsonpatch[_0x06ef('0x38')](_0x257c8f,_0x1fa74f,!![]);}catch(_0x5cd533){return BPromise[_0x06ef('0x39')](_0x5cd533);}return _0x257c8f[_0x06ef('0x3a')]();};}function saveUpdates(_0x36a186,_0x44e148){return function(_0x22d1a7){if(_0x22d1a7){return _0x22d1a7['update'](_0x36a186)[_0x06ef('0x22')](function(_0x4359f8){return _0x4359f8;});}return null;};}function removeEntity(_0x48cee5,_0x13e910){return function(_0x4670e8){if(_0x4670e8){return _0x4670e8[_0x06ef('0x3b')]()[_0x06ef('0x22')](function(){var _0x129256=_0x4670e8[_0x06ef('0x3c')]({'plain':!![]});var _0x5b3a72='MailAccounts';return db[_0x06ef('0x3d')]['destroy']({'where':{'type':_0x5b3a72,'resourceId':_0x129256['id']}})[_0x06ef('0x22')](function(){return _0x4670e8;});})[_0x06ef('0x22')](function(){_0x48cee5[_0x06ef('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a977d,_0x432994){return function(_0x590e10){if(!_0x590e10){_0x4a977d[_0x06ef('0x2e')](0x194);}return _0x590e10;};}function handleError(_0x485096,_0x51b2b6){_0x51b2b6=_0x51b2b6||0x1f4;return function(_0x4ea6cb){logger[_0x06ef('0x28')](_0x4ea6cb[_0x06ef('0x3e')]);if(_0x4ea6cb[_0x06ef('0x3f')]){delete _0x4ea6cb['name'];}_0x485096[_0x06ef('0x2f')](_0x51b2b6)[_0x06ef('0x40')](_0x4ea6cb);};}exports[_0x06ef('0x41')]=function(_0x5249d1,_0x272b89){var _0x3ccd65={'include':[{'model':db[_0x06ef('0x42')],'as':_0x06ef('0x43')},{'model':db[_0x06ef('0x44')],'as':_0x06ef('0x45')},{'model':db[_0x06ef('0x46')],'as':_0x06ef('0x47')}]},_0x49b1ad={},_0x41ed20={'count':0x0,'rows':[]};var _0x3149ac=_[_0x06ef('0x48')](db[_0x06ef('0x49')][_0x06ef('0x4a')],function(_0x562b2f){return{'name':_0x562b2f[_0x06ef('0x4b')],'type':_0x562b2f[_0x06ef('0x4c')]['key']};});_0x49b1ad['model']=_[_0x06ef('0x48')](_0x3149ac,_0x06ef('0x3f'));_0x49b1ad['query']=_['keys'](_0x5249d1[_0x06ef('0x4d')]);_0x49b1ad[_0x06ef('0x4e')]=_['intersection'](_0x49b1ad[_0x06ef('0x4f')],_0x49b1ad['query']);_0x3ccd65[_0x06ef('0x50')]=_[_0x06ef('0x51')](_0x49b1ad[_0x06ef('0x4f')],qs[_0x06ef('0x52')](_0x5249d1[_0x06ef('0x4d')][_0x06ef('0x52')]));_0x3ccd65[_0x06ef('0x50')]=_0x3ccd65[_0x06ef('0x50')]['length']?_0x3ccd65['attributes']:_0x49b1ad[_0x06ef('0x4f')];if(!_0x5249d1['query'][_0x06ef('0x53')](_0x06ef('0x54'))){_0x3ccd65[_0x06ef('0x34')]=qs[_0x06ef('0x34')](_0x5249d1[_0x06ef('0x4d')][_0x06ef('0x34')]);_0x3ccd65[_0x06ef('0x32')]=qs[_0x06ef('0x32')](_0x5249d1[_0x06ef('0x4d')][_0x06ef('0x32')]);}_0x3ccd65['order']=qs[_0x06ef('0x55')](_0x5249d1[_0x06ef('0x4d')][_0x06ef('0x55')]);_0x3ccd65[_0x06ef('0x56')]=qs['filters'](_[_0x06ef('0x57')](_0x5249d1[_0x06ef('0x4d')],_0x49b1ad[_0x06ef('0x4e')]),_0x3149ac);if(_0x5249d1[_0x06ef('0x4d')]['filter']){_0x3ccd65[_0x06ef('0x56')]=_['merge'](_0x3ccd65[_0x06ef('0x56')],{'$or':_[_0x06ef('0x48')](_0x3149ac,function(_0x425541){if(_0x425541['type']!==_0x06ef('0x58')){var _0x55e706={};_0x55e706[_0x425541['name']]={'$like':'%'+_0x5249d1['query'][_0x06ef('0x59')]+'%'};return _0x55e706;}})});}_0x3ccd65=_['merge']({},_0x3ccd65,_0x5249d1[_0x06ef('0x5a')]);var _0x3c426e={'where':_0x3ccd65['where']};return db[_0x06ef('0x49')][_0x06ef('0x35')](_0x3c426e)[_0x06ef('0x22')](function(_0x157f10){_0x41ed20[_0x06ef('0x35')]=_0x157f10;if(_0x5249d1['query']['includeAll']){_0x3ccd65[_0x06ef('0x5b')]=[{'all':!![]}];}return db['MailAccount']['findAll'](_0x3ccd65);})[_0x06ef('0x22')](function(_0x4cc91f){_0x41ed20[_0x06ef('0x5c')]=_0x4cc91f;return _0x41ed20;})['then'](respondWithFilteredResult(_0x272b89,_0x3ccd65))['catch'](handleError(_0x272b89,null));};exports[_0x06ef('0x5d')]=function(_0x9921ec,_0xf70c74){var _0x305530={'raw':![],'where':{'id':_0x9921ec[_0x06ef('0x5e')]['id']},'include':[{'model':db[_0x06ef('0x42')],'as':_0x06ef('0x43')},{'model':db['MailServerOut'],'as':_0x06ef('0x45')},{'model':db[_0x06ef('0x46')],'as':_0x06ef('0x47')}]},_0x6275e0={};_0x6275e0[_0x06ef('0x4f')]=_[_0x06ef('0x5f')](db[_0x06ef('0x49')][_0x06ef('0x4a')]);_0x6275e0[_0x06ef('0x4d')]=_[_0x06ef('0x5f')](_0x9921ec['query']);_0x6275e0['filters']=_['intersection'](_0x6275e0[_0x06ef('0x4f')],_0x6275e0[_0x06ef('0x4d')]);_0x305530[_0x06ef('0x50')]=_['intersection'](_0x6275e0[_0x06ef('0x4f')],qs[_0x06ef('0x52')](_0x9921ec['query']['fields']));_0x305530['attributes']=_0x305530[_0x06ef('0x50')][_0x06ef('0x60')]?_0x305530[_0x06ef('0x50')]:_0x6275e0[_0x06ef('0x4f')];if(_0x9921ec['query']['includeAll']){_0x305530['include']=[{'all':!![]}];}_0x305530=_[_0x06ef('0x61')]({},_0x305530,_0x9921ec[_0x06ef('0x5a')]);return db[_0x06ef('0x49')][_0x06ef('0x62')](_0x305530)[_0x06ef('0x22')](handleEntityNotFound(_0xf70c74,null))[_0x06ef('0x22')](respondWithResult(_0xf70c74,null))['catch'](handleError(_0xf70c74,null));};exports[_0x06ef('0x63')]=function(_0x3d3160,_0x2625cd){if(_0x3d3160[_0x06ef('0x64')]['id']){delete _0x3d3160[_0x06ef('0x64')]['id'];}return db['MailAccount'][_0x06ef('0x62')]({'where':{'id':_0x3d3160[_0x06ef('0x5e')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x06ef('0x43')},{'model':db[_0x06ef('0x44')],'as':_0x06ef('0x45')},{'model':db['Pause'],'as':_0x06ef('0x47')}]})[_0x06ef('0x22')](handleEntityNotFound(_0x2625cd,null))[_0x06ef('0x22')](saveUpdates(_0x3d3160[_0x06ef('0x64')],null))[_0x06ef('0x22')](function(_0x209aec){if(_0x209aec&&_0x3d3160[_0x06ef('0x64')][_0x06ef('0x43')]){return db[_0x06ef('0x42')][_0x06ef('0x63')](_0x3d3160[_0x06ef('0x64')][_0x06ef('0x43')],{'where':{'MailAccountId':_0x209aec['id']}})[_0x06ef('0x22')](function(){return _0x209aec;});}return _0x209aec;})['then'](function(_0x45ba23){if(_0x45ba23&&_0x3d3160['body']['Smtp']){return db[_0x06ef('0x44')][_0x06ef('0x63')](_0x3d3160[_0x06ef('0x64')]['Smtp'],{'where':{'MailAccountId':_0x45ba23['id']}})[_0x06ef('0x22')](function(){return _0x45ba23;});}return _0x45ba23;})['then'](respondWithResult(_0x2625cd,null))[_0x06ef('0x2d')](handleError(_0x2625cd,null));};exports[_0x06ef('0x65')]=function(_0x147c8c,_0x3e977f){return db[_0x06ef('0x49')][_0x06ef('0x65')]()['then'](respondWithResult(_0x3e977f,null))[_0x06ef('0x2d')](handleError(_0x3e977f,null));};exports[_0x06ef('0x66')]=function(_0x5463b9,_0x351d04,_0x190ea7){if(_0x5463b9[_0x06ef('0x64')]['id']){delete _0x5463b9[_0x06ef('0x64')]['id'];}return db[_0x06ef('0x49')]['find']({'where':{'id':_0x5463b9[_0x06ef('0x5e')]['id']}})[_0x06ef('0x22')](handleEntityNotFound(_0x351d04,null))[_0x06ef('0x22')](function(_0x55557d){if(_0x55557d){_0x5463b9[_0x06ef('0x64')][_0x06ef('0x67')]=_0x55557d['id'];return db[_0x06ef('0x68')]['create'](_0x5463b9[_0x06ef('0x64')]);}})[_0x06ef('0x22')](respondWithResult(_0x351d04,null))['catch'](handleError(_0x351d04,null));};exports[_0x06ef('0x69')]=function(_0xd7e627,_0x322747,_0x16343f){var _0x327d76={'raw':![],'where':{}};var _0x14036c={};var _0xf14192={'count':0x0,'rows':[]};return db[_0x06ef('0x49')][_0x06ef('0x6a')]({'where':{'id':_0xd7e627[_0x06ef('0x5e')]['id']}})[_0x06ef('0x22')](handleEntityNotFound(_0x322747,null))[_0x06ef('0x22')](function(_0x245d7b){if(_0x245d7b){_0x14036c[_0x06ef('0x4f')]=_[_0x06ef('0x5f')](db[_0x06ef('0x68')][_0x06ef('0x4a')]);_0x14036c['query']=_['keys'](_0xd7e627[_0x06ef('0x4d')]);_0x14036c[_0x06ef('0x4e')]=_[_0x06ef('0x51')](_0x14036c[_0x06ef('0x4f')],_0x14036c[_0x06ef('0x4d')]);_0x327d76['attributes']=_['intersection'](_0x14036c['model'],qs[_0x06ef('0x52')](_0xd7e627['query'][_0x06ef('0x52')]));_0x327d76[_0x06ef('0x50')]=_0x327d76[_0x06ef('0x50')][_0x06ef('0x60')]?_0x327d76[_0x06ef('0x50')]:_0x14036c[_0x06ef('0x4f')];if(!_0xd7e627['query']['hasOwnProperty'](_0x06ef('0x54'))){_0x327d76[_0x06ef('0x34')]=qs[_0x06ef('0x34')](_0xd7e627[_0x06ef('0x4d')]['limit']);_0x327d76[_0x06ef('0x32')]=qs[_0x06ef('0x32')](_0xd7e627[_0x06ef('0x4d')]['offset']);}_0x327d76[_0x06ef('0x6b')]=qs[_0x06ef('0x55')](_0xd7e627[_0x06ef('0x4d')]['sort']);_0x327d76[_0x06ef('0x56')]=qs['filters'](_[_0x06ef('0x57')](_0xd7e627['query'],_0x14036c[_0x06ef('0x4e')]));_0x327d76[_0x06ef('0x56')][_0x06ef('0x67')]=_0x245d7b['id'];if(_0xd7e627['query']['filter']){_0x327d76['where']=_[_0x06ef('0x61')](_0x327d76[_0x06ef('0x56')],{'$or':_[_0x06ef('0x48')](_0x327d76[_0x06ef('0x50')],function(_0x16fac6){var _0x5f4d5d={};_0x5f4d5d[_0x16fac6]={'$like':'%'+_0xd7e627['query'][_0x06ef('0x59')]+'%'};return _0x5f4d5d;})});}_0x327d76=_['merge']({},_0x327d76,_0xd7e627[_0x06ef('0x5a')]);return db[_0x06ef('0x68')][_0x06ef('0x35')]({'where':_0x327d76['where']})[_0x06ef('0x22')](function(_0x4eb19f){_0xf14192[_0x06ef('0x35')]=_0x4eb19f;if(_0xd7e627[_0x06ef('0x4d')][_0x06ef('0x6c')]){_0x327d76['include']=[{'all':!![]}];}return db[_0x06ef('0x68')]['findAll'](_0x327d76);})['then'](function(_0x36a48b){_0xf14192['rows']=_0x36a48b;return _0xf14192;});}})['then'](respondWithFilteredResult(_0x322747,_0x327d76))[_0x06ef('0x2d')](handleError(_0x322747,null));};exports[_0x06ef('0x6d')]=function(_0x119d7c,_0x1b57e8,_0x581348){return db[_0x06ef('0x49')][_0x06ef('0x62')]({'where':{'id':_0x119d7c['params']['id']}})[_0x06ef('0x22')](handleEntityNotFound(_0x1b57e8,null))[_0x06ef('0x22')](function(_0x404184){if(_0x404184){return _0x404184['removeDispositions'](_0x119d7c['query'][_0x06ef('0x6e')]);}})[_0x06ef('0x22')](respondWithStatusCode(_0x1b57e8,null))[_0x06ef('0x2d')](handleError(_0x1b57e8,null));};exports[_0x06ef('0x6f')]=function(_0x211fa5,_0x5f39f1,_0x4326f3){if(_0x211fa5['body']['id']){delete _0x211fa5[_0x06ef('0x64')]['id'];}return db['MailAccount'][_0x06ef('0x62')]({'where':{'id':_0x211fa5[_0x06ef('0x5e')]['id']}})[_0x06ef('0x22')](handleEntityNotFound(_0x5f39f1,null))[_0x06ef('0x22')](function(_0x237046){if(_0x237046){_0x211fa5[_0x06ef('0x64')][_0x06ef('0x67')]=_0x237046['id'];return db['CannedAnswer']['create'](_0x211fa5[_0x06ef('0x64')]);}})['then'](respondWithResult(_0x5f39f1,null))[_0x06ef('0x2d')](handleError(_0x5f39f1,null));};exports[_0x06ef('0x70')]=function(_0x271bae,_0x44f33d,_0x44ab6b){var _0x509a16={'raw':![],'where':{}};var _0x3cd1be={};var _0x3f48={'count':0x0,'rows':[]};return db[_0x06ef('0x49')][_0x06ef('0x6a')]({'where':{'id':_0x271bae[_0x06ef('0x5e')]['id']}})[_0x06ef('0x22')](handleEntityNotFound(_0x44f33d,null))[_0x06ef('0x22')](function(_0x29040e){if(_0x29040e){_0x3cd1be[_0x06ef('0x4f')]=_[_0x06ef('0x5f')](db[_0x06ef('0x71')][_0x06ef('0x4a')]);_0x3cd1be[_0x06ef('0x4d')]=_[_0x06ef('0x5f')](_0x271bae[_0x06ef('0x4d')]);_0x3cd1be[_0x06ef('0x4e')]=_[_0x06ef('0x51')](_0x3cd1be[_0x06ef('0x4f')],_0x3cd1be[_0x06ef('0x4d')]);_0x509a16[_0x06ef('0x50')]=_['intersection'](_0x3cd1be[_0x06ef('0x4f')],qs[_0x06ef('0x52')](_0x271bae[_0x06ef('0x4d')][_0x06ef('0x52')]));_0x509a16[_0x06ef('0x50')]=_0x509a16['attributes'][_0x06ef('0x60')]?_0x509a16[_0x06ef('0x50')]:_0x3cd1be[_0x06ef('0x4f')];if(!_0x271bae[_0x06ef('0x4d')][_0x06ef('0x53')](_0x06ef('0x54'))){_0x509a16[_0x06ef('0x34')]=qs['limit'](_0x271bae[_0x06ef('0x4d')][_0x06ef('0x34')]);_0x509a16[_0x06ef('0x32')]=qs[_0x06ef('0x32')](_0x271bae[_0x06ef('0x4d')][_0x06ef('0x32')]);}_0x509a16[_0x06ef('0x6b')]=qs[_0x06ef('0x55')](_0x271bae[_0x06ef('0x4d')][_0x06ef('0x55')]);_0x509a16[_0x06ef('0x56')]=qs[_0x06ef('0x4e')](_[_0x06ef('0x57')](_0x271bae[_0x06ef('0x4d')],_0x3cd1be[_0x06ef('0x4e')]));_0x509a16[_0x06ef('0x56')][_0x06ef('0x67')]=_0x29040e['id'];if(_0x271bae[_0x06ef('0x4d')][_0x06ef('0x59')]){_0x509a16[_0x06ef('0x56')]=_[_0x06ef('0x61')](_0x509a16[_0x06ef('0x56')],{'$or':_[_0x06ef('0x48')](_0x509a16[_0x06ef('0x50')],function(_0x7dc197){var _0x548933={};_0x548933[_0x7dc197]={'$like':'%'+_0x271bae[_0x06ef('0x4d')][_0x06ef('0x59')]+'%'};return _0x548933;})});}_0x509a16=_[_0x06ef('0x61')]({},_0x509a16,_0x271bae[_0x06ef('0x5a')]);return db[_0x06ef('0x71')][_0x06ef('0x35')]({'where':_0x509a16['where']})[_0x06ef('0x22')](function(_0xdd076b){_0x3f48[_0x06ef('0x35')]=_0xdd076b;if(_0x271bae[_0x06ef('0x4d')]['includeAll']){_0x509a16[_0x06ef('0x5b')]=[{'all':!![]}];}return db[_0x06ef('0x71')][_0x06ef('0x72')](_0x509a16);})['then'](function(_0x593661){_0x3f48[_0x06ef('0x5c')]=_0x593661;return _0x3f48;});}})['then'](respondWithFilteredResult(_0x44f33d,_0x509a16))[_0x06ef('0x2d')](handleError(_0x44f33d,null));};exports[_0x06ef('0x73')]=function(_0x202dc7,_0x52248c,_0x3ca870){return db[_0x06ef('0x49')]['find']({'where':{'id':_0x202dc7[_0x06ef('0x5e')]['id']}})[_0x06ef('0x22')](handleEntityNotFound(_0x52248c,null))[_0x06ef('0x22')](function(_0x514e84){if(_0x514e84){return _0x514e84['removeAnswers'](_0x202dc7[_0x06ef('0x4d')][_0x06ef('0x6e')]);}})['then'](respondWithStatusCode(_0x52248c,null))['catch'](handleError(_0x52248c,null));};exports[_0x06ef('0x74')]=function(_0x5df75d,_0x51c346){var _0x196e47={'name':_0x5df75d['body'][_0x06ef('0x3f')],'key':_0x5df75d[_0x06ef('0x64')]['key'],'email':_0x5df75d[_0x06ef('0x64')][_0x06ef('0x75')],'ListId':_0x5df75d[_0x06ef('0x64')][_0x06ef('0x76')],'active':!_[_0x06ef('0x77')](_0x5df75d[_0x06ef('0x64')]['active'])?_0x5df75d[_0x06ef('0x64')]['active']:!![],'description':_0x5df75d['body'][_0x06ef('0x78')]||null,'Imap':{},'Smtp':{}};if(_[_0x06ef('0x77')](_0x5df75d[_0x06ef('0x64')][_0x06ef('0x79')])){if(_0x5df75d['body']['cauthentication']){_0x196e47['Imap'][_0x06ef('0x7a')]=_0x196e47['Smtp'][_0x06ef('0x7a')]=_0x5df75d[_0x06ef('0x64')][_0x06ef('0x7b')];_0x196e47[_0x06ef('0x43')][_0x06ef('0x7c')]=_0x196e47['Smtp'][_0x06ef('0x7d')]=_0x5df75d[_0x06ef('0x64')][_0x06ef('0x7e')];}else{_0x196e47['Imap'][_0x06ef('0x7f')]=_0x196e47['Smtp'][_0x06ef('0x7f')]=![];}_0x196e47[_0x06ef('0x43')][_0x06ef('0x80')]=_0x5df75d[_0x06ef('0x64')][_0x06ef('0x43')][_0x06ef('0x80')];_0x196e47[_0x06ef('0x43')][_0x06ef('0x81')]=_0x5df75d[_0x06ef('0x64')][_0x06ef('0x43')][_0x06ef('0x81')];_0x196e47[_0x06ef('0x45')][_0x06ef('0x80')]=_0x5df75d['body'][_0x06ef('0x45')][_0x06ef('0x80')];_0x196e47[_0x06ef('0x45')][_0x06ef('0x81')]=_0x5df75d[_0x06ef('0x64')][_0x06ef('0x45')][_0x06ef('0x81')];}else{_0x196e47['Imap'][_0x06ef('0x82')]=_0x196e47[_0x06ef('0x45')][_0x06ef('0x82')]=_0x5df75d['body'][_0x06ef('0x79')];_0x196e47[_0x06ef('0x43')][_0x06ef('0x7a')]=_0x196e47[_0x06ef('0x45')][_0x06ef('0x7a')]=_0x5df75d['body']['cuser'];_0x196e47['Imap'][_0x06ef('0x7c')]=_0x196e47[_0x06ef('0x45')]['pass']=_0x5df75d[_0x06ef('0x64')][_0x06ef('0x7e')];}return db[_0x06ef('0x49')]['create'](_0x196e47,{'include':[{'model':db[_0x06ef('0x44')],'as':'Smtp'},{'model':db[_0x06ef('0x42')],'as':_0x06ef('0x43')}]})[_0x06ef('0x22')](function(_0x1ed1a9){var _0x8caf22=_0x5df75d['user'][_0x06ef('0x3c')]({'plain':!![]});if(!_0x8caf22)throw new Error(_0x06ef('0x83'));if(_0x8caf22[_0x06ef('0x84')]===_0x06ef('0x7a')){var _0x58dd6d=_0x1ed1a9[_0x06ef('0x3c')]({'plain':!![]});return db[_0x06ef('0x85')]['find']({'where':{'name':_0x06ef('0x86'),'userProfileId':_0x8caf22[_0x06ef('0x87')]},'raw':!![]})[_0x06ef('0x22')](function(_0x860a23){if(_0x860a23&&_0x860a23['autoAssociation']===0x0){return db[_0x06ef('0x3d')][_0x06ef('0x74')]({'name':_0x58dd6d[_0x06ef('0x3f')],'resourceId':_0x58dd6d['id'],'type':_0x860a23['name'],'sectionId':_0x860a23['id']},{})[_0x06ef('0x22')](function(){return _0x1ed1a9;});}else{return _0x1ed1a9;}})['catch'](function(_0x428f9d){logger[_0x06ef('0x28')](_0x06ef('0x88'),_0x428f9d);throw _0x428f9d;});}return _0x1ed1a9;})[_0x06ef('0x22')](respondWithResult(_0x51c346,0xc9))[_0x06ef('0x2d')](handleError(_0x51c346,null));};exports[_0x06ef('0x89')]=function(_0x174a2a,_0x576fb6,_0x3ec946){return db[_0x06ef('0x49')][_0x06ef('0x6a')]({'where':{'id':_0x174a2a[_0x06ef('0x5e')]['id']}})[_0x06ef('0x22')](handleEntityNotFound(_0x576fb6,null))[_0x06ef('0x22')](function(_0x38b163){if(_0x38b163){return _0x38b163['getImap']();}return null;})[_0x06ef('0x22')](respondWithResult(_0x576fb6,null))[_0x06ef('0x2d')](handleError(_0x576fb6,null));};exports[_0x06ef('0x8a')]=function(_0x1e1e7c,_0x1c3bdb,_0x59ee16){if(_0x1e1e7c['body']['id']){delete _0x1e1e7c[_0x06ef('0x64')]['id'];}return db[_0x06ef('0x49')][_0x06ef('0x62')]({'where':{'id':_0x1e1e7c[_0x06ef('0x5e')]['id']}})[_0x06ef('0x22')](handleEntityNotFound(_0x1c3bdb,null))[_0x06ef('0x22')](function(_0x1ca10e){if(_0x1ca10e){_0x1e1e7c[_0x06ef('0x64')][_0x06ef('0x67')]=_0x1ca10e['id'];return db['MailServerIn'][_0x06ef('0x74')](_0x1e1e7c[_0x06ef('0x64')]);}})[_0x06ef('0x22')](respondWithResult(_0x1c3bdb,null))[_0x06ef('0x2d')](handleError(_0x1c3bdb,null));};exports[_0x06ef('0x8b')]=function(_0x38559e,_0x3babde,_0x2cc589){return db[_0x06ef('0x49')][_0x06ef('0x6a')]({'where':{'id':_0x38559e[_0x06ef('0x5e')]['id']}})[_0x06ef('0x22')](handleEntityNotFound(_0x3babde,null))[_0x06ef('0x22')](function(_0x1ade75){if(_0x1ade75){return _0x1ade75['setImap'](null);}return null;})['then'](respondWithStatusCode(_0x3babde,null))[_0x06ef('0x2d')](handleError(_0x3babde,null));};exports[_0x06ef('0x8c')]=function(_0x466eb8,_0x4590be,_0x2a921a){return db['MailAccount'][_0x06ef('0x6a')]({'where':{'id':_0x466eb8[_0x06ef('0x5e')]['id']}})[_0x06ef('0x22')](handleEntityNotFound(_0x4590be,null))['then'](function(_0x166539){if(_0x166539){return _0x166539[_0x06ef('0x8c')]();}return null;})[_0x06ef('0x22')](respondWithResult(_0x4590be,null))['catch'](handleError(_0x4590be,null));};exports[_0x06ef('0x8d')]=function(_0x63799b,_0x4dad66,_0x5aca4e){if(_0x63799b[_0x06ef('0x64')]['id']){delete _0x63799b[_0x06ef('0x64')]['id'];}return db[_0x06ef('0x49')][_0x06ef('0x62')]({'where':{'id':_0x63799b[_0x06ef('0x5e')]['id']}})[_0x06ef('0x22')](handleEntityNotFound(_0x4dad66,null))[_0x06ef('0x22')](function(_0x4b9e9c){if(_0x4b9e9c){_0x63799b[_0x06ef('0x64')][_0x06ef('0x67')]=_0x4b9e9c['id'];return db[_0x06ef('0x44')][_0x06ef('0x74')](_0x63799b['body']);}})[_0x06ef('0x22')](respondWithResult(_0x4dad66,null))['catch'](handleError(_0x4dad66,null));};exports[_0x06ef('0x8e')]=function(_0x197103,_0x33b969,_0x15658a){return db['MailAccount']['findOne']({'where':{'id':_0x197103['params']['id']}})[_0x06ef('0x22')](handleEntityNotFound(_0x33b969,null))[_0x06ef('0x22')](function(_0x13e31e){if(_0x13e31e){return _0x13e31e[_0x06ef('0x8f')](null);}return null;})[_0x06ef('0x22')](respondWithStatusCode(_0x33b969,null))[_0x06ef('0x2d')](handleError(_0x33b969,null));};exports[_0x06ef('0x90')]=function(_0x1e4c0b,_0x4f93c1,_0x2d8b42){return db[_0x06ef('0x91')][_0x06ef('0x62')]({'where':{'id':_0x1e4c0b[_0x06ef('0x5e')]['id']}})['then'](handleEntityNotFound(_0x4f93c1,null))[_0x06ef('0x22')](function(_0x271f26){if(_0x271f26){return _0x271f26[_0x06ef('0x90')](_0x1e4c0b[_0x06ef('0x64')][_0x06ef('0x6e')],_[_0x06ef('0x92')](_0x1e4c0b[_0x06ef('0x64')],[_0x06ef('0x6e'),'id'])||{});}})[_0x06ef('0x22')](respondWithResult(_0x4f93c1,null))['catch'](handleError(_0x4f93c1,null));};exports[_0x06ef('0x93')]=function(_0x476c78,_0x3a4b82,_0x2be48e){var _0x5cd52d={'raw':![],'where':{}};var _0x4ddf78={};var _0x33010f={'count':0x0,'rows':[]};return db[_0x06ef('0x49')][_0x06ef('0x6a')]({'where':{'id':_0x476c78[_0x06ef('0x5e')]['id']}})['then'](handleEntityNotFound(_0x3a4b82,null))[_0x06ef('0x22')](function(_0x4c6f31){if(_0x4c6f31){_0x4ddf78['model']=_['keys'](db['MailInteraction'][_0x06ef('0x4a')]);_0x4ddf78[_0x06ef('0x4d')]=_[_0x06ef('0x5f')](_0x476c78[_0x06ef('0x4d')]);_0x4ddf78['filters']=_['intersection'](_0x4ddf78['model'],_0x4ddf78[_0x06ef('0x4d')]);_0x5cd52d[_0x06ef('0x50')]=_['intersection'](_0x4ddf78['model'],qs[_0x06ef('0x52')](_0x476c78[_0x06ef('0x4d')][_0x06ef('0x52')]));_0x5cd52d[_0x06ef('0x50')]=_0x5cd52d[_0x06ef('0x50')][_0x06ef('0x60')]?_0x5cd52d[_0x06ef('0x50')]:_0x4ddf78[_0x06ef('0x4f')];if(!_0x476c78[_0x06ef('0x4d')][_0x06ef('0x53')](_0x06ef('0x54'))){_0x5cd52d[_0x06ef('0x34')]=qs[_0x06ef('0x34')](_0x476c78[_0x06ef('0x4d')][_0x06ef('0x34')]);_0x5cd52d[_0x06ef('0x32')]=qs[_0x06ef('0x32')](_0x476c78[_0x06ef('0x4d')][_0x06ef('0x32')]);}_0x5cd52d[_0x06ef('0x6b')]=qs[_0x06ef('0x55')](_0x476c78['query'][_0x06ef('0x55')]);_0x5cd52d[_0x06ef('0x56')]=qs[_0x06ef('0x4e')](_['pick'](_0x476c78[_0x06ef('0x4d')],_0x4ddf78[_0x06ef('0x4e')]));_0x5cd52d[_0x06ef('0x56')][_0x06ef('0x67')]=_0x4c6f31['id'];if(_0x476c78[_0x06ef('0x4d')]['filter']){_0x5cd52d[_0x06ef('0x56')]=_[_0x06ef('0x61')](_0x5cd52d[_0x06ef('0x56')],{'$or':_[_0x06ef('0x48')](_0x5cd52d[_0x06ef('0x50')],function(_0x42d748){var _0x118a27={};_0x118a27[_0x42d748]={'$like':'%'+_0x476c78[_0x06ef('0x4d')][_0x06ef('0x59')]+'%'};return _0x118a27;})});}_0x5cd52d=_[_0x06ef('0x61')]({},_0x5cd52d,_0x476c78[_0x06ef('0x5a')]);return db[_0x06ef('0x91')][_0x06ef('0x35')]({'where':_0x5cd52d[_0x06ef('0x56')]})['then'](function(_0x45a89f){_0x33010f['count']=_0x45a89f;if(_0x476c78['query'][_0x06ef('0x6c')]){_0x5cd52d[_0x06ef('0x5b')]=[{'model':db[_0x06ef('0x94')],'as':_0x06ef('0x95'),'required':![]},{'model':db[_0x06ef('0x96')],'as':_0x06ef('0x97'),'attributes':[_0x06ef('0x3f'),_0x06ef('0x98'),_0x06ef('0x99')],'required':![]},{'model':db[_0x06ef('0x9a')],'as':_0x06ef('0x9b'),'attributes':['id','name',_0x06ef('0x9c')],'where':_0x476c78[_0x06ef('0x4d')][_0x06ef('0x9d')]?{'id':_0x476c78[_0x06ef('0x4d')][_0x06ef('0x9d')]}:undefined,'required':_0x476c78[_0x06ef('0x4d')]['tag']?!![]:![]}];}return db[_0x06ef('0x91')][_0x06ef('0x72')](_0x5cd52d);})['then'](function(_0x41e5ab){_0x33010f[_0x06ef('0x5c')]=_0x41e5ab;return _0x33010f;});}})['then'](respondWithFilteredResult(_0x3a4b82,_0x5cd52d))[_0x06ef('0x2d')](handleError(_0x3a4b82,null));};exports[_0x06ef('0x9e')]=function(_0x245792,_0x5dbcd4,_0x5d26dd){return db[_0x06ef('0x49')][_0x06ef('0x6a')]({'where':{'id':_0x245792['params']['id']}})['then'](handleEntityNotFound(_0x5dbcd4,null))[_0x06ef('0x22')](function(_0x468c6c){if(_0x468c6c){return db[_0x06ef('0x9f')][_0x06ef('0xa0')](function(_0x1020cf){return db[_0x06ef('0xa1')]['destroy']({'where':{'MailAccountId':_0x245792[_0x06ef('0x5e')]['id']},'transaction':_0x1020cf})[_0x06ef('0x22')](function(_0x351480){var _0x4bddc4=_[_0x06ef('0x48')](_0x245792['body'],function(_0x1c456e){_0x1c456e['MailAccountId']=_0x245792[_0x06ef('0x5e')]['id'];return _0x1c456e;});return db[_0x06ef('0xa1')][_0x06ef('0xa2')](_0x4bddc4,{'transaction':_0x1020cf});});})[_0x06ef('0x22')](function(){return db[_0x06ef('0xa1')][_0x06ef('0xa3')]({'where':{'MailAccountId':_0x245792[_0x06ef('0x5e')]['id']},'order':_0x06ef('0xa4')});});}})[_0x06ef('0x22')](respondWithResult(_0x5dbcd4,null))[_0x06ef('0x2d')](handleError(_0x5dbcd4,null));};exports[_0x06ef('0xa5')]=function(_0x38fb44,_0x346dd8,_0x1566ff){var _0x1d750e={};var _0x3d983e={};var _0x1116f4;var _0x39b7a4;return db[_0x06ef('0x49')][_0x06ef('0x6a')]({'where':{'id':_0x38fb44[_0x06ef('0x5e')]['id']}})[_0x06ef('0x22')](handleEntityNotFound(_0x346dd8,null))[_0x06ef('0x22')](function(_0xceea68){if(_0xceea68){_0x1116f4=_0xceea68;_0x3d983e[_0x06ef('0x4f')]=_[_0x06ef('0x5f')](db['MailApplication']['rawAttributes']);_0x3d983e['query']=_[_0x06ef('0x5f')](_0x38fb44[_0x06ef('0x4d')]);_0x3d983e[_0x06ef('0x4e')]=_[_0x06ef('0x51')](_0x3d983e['model'],_0x3d983e[_0x06ef('0x4d')]);_0x1d750e[_0x06ef('0x50')]=_[_0x06ef('0x51')](_0x3d983e[_0x06ef('0x4f')],qs[_0x06ef('0x52')](_0x38fb44[_0x06ef('0x4d')][_0x06ef('0x52')]));_0x1d750e['attributes']=_0x1d750e[_0x06ef('0x50')][_0x06ef('0x60')]?_0x1d750e[_0x06ef('0x50')]:_0x3d983e['model'];_0x1d750e['order']=qs[_0x06ef('0x55')](_0x38fb44[_0x06ef('0x4d')][_0x06ef('0x55')]);_0x1d750e[_0x06ef('0x56')]=qs[_0x06ef('0x4e')](_[_0x06ef('0x57')](_0x38fb44[_0x06ef('0x4d')],_0x3d983e[_0x06ef('0x4e')]));if(_0x38fb44['query']['filter']){_0x1d750e[_0x06ef('0x56')]=_[_0x06ef('0x61')](_0x1d750e[_0x06ef('0x56')],{'$or':_[_0x06ef('0x48')](_0x1d750e[_0x06ef('0x50')],function(_0x13ccfe){var _0x40f47b={};_0x40f47b[_0x13ccfe]={'$like':'%'+_0x38fb44[_0x06ef('0x4d')][_0x06ef('0x59')]+'%'};return _0x40f47b;})});}_0x1d750e=_['merge']({},_0x1d750e,_0x38fb44[_0x06ef('0x5a')]);return _0x1116f4['getApplications'](_0x1d750e);}})[_0x06ef('0x22')](function(_0x2eb6c0){if(_0x2eb6c0){_0x39b7a4=_0x2eb6c0[_0x06ef('0x60')];if(!_0x38fb44[_0x06ef('0x4d')][_0x06ef('0x53')](_0x06ef('0x54'))){_0x1d750e[_0x06ef('0x34')]=qs['limit'](_0x38fb44[_0x06ef('0x4d')]['limit']);_0x1d750e[_0x06ef('0x32')]=qs[_0x06ef('0x32')](_0x38fb44[_0x06ef('0x4d')][_0x06ef('0x32')]);}return _0x1116f4[_0x06ef('0xa5')](_0x1d750e);}})[_0x06ef('0x22')](function(_0x1c15bb){if(_0x1c15bb){return _0x1c15bb?{'count':_0x39b7a4,'rows':_0x1c15bb}:null;}})[_0x06ef('0x22')](respondWithResult(_0x346dd8,null))[_0x06ef('0x2d')](handleError(_0x346dd8,null));};exports[_0x06ef('0xa6')]=function(_0x2cdca2,_0x5926a4,_0x3616db){var _0x5e42c6={'raw':!![],'where':{}};var _0x1544f0={};var _0x4924cb={'count':0x0,'rows':[]};return db[_0x06ef('0x49')][_0x06ef('0x6a')]({'where':{'id':_0x2cdca2[_0x06ef('0x5e')]['id']}})[_0x06ef('0x22')](handleEntityNotFound(_0x5926a4,null))[_0x06ef('0x22')](function(_0xe863c){if(_0xe863c){_0x1544f0[_0x06ef('0x4f')]=_[_0x06ef('0x5f')](db[_0x06ef('0xa7')][_0x06ef('0x4a')]);_0x1544f0[_0x06ef('0x4d')]=_[_0x06ef('0x5f')](_0x2cdca2[_0x06ef('0x4d')]);_0x1544f0['filters']=_['intersection'](_0x1544f0['model'],_0x1544f0['query']);_0x5e42c6['attributes']=_[_0x06ef('0x51')](_0x1544f0[_0x06ef('0x4f')],qs[_0x06ef('0x52')](_0x2cdca2['query'][_0x06ef('0x52')]));_0x5e42c6['attributes']=_0x5e42c6[_0x06ef('0x50')][_0x06ef('0x60')]?_0x5e42c6[_0x06ef('0x50')]:_0x1544f0[_0x06ef('0x4f')];if(!_0x2cdca2[_0x06ef('0x4d')]['hasOwnProperty']('nolimit')){_0x5e42c6[_0x06ef('0x34')]=qs[_0x06ef('0x34')](_0x2cdca2[_0x06ef('0x4d')][_0x06ef('0x34')]);_0x5e42c6[_0x06ef('0x32')]=qs[_0x06ef('0x32')](_0x2cdca2[_0x06ef('0x4d')]['offset']);}_0x5e42c6[_0x06ef('0x6b')]=qs[_0x06ef('0x55')](_0x2cdca2[_0x06ef('0x4d')]['sort']);_0x5e42c6[_0x06ef('0x56')]=qs[_0x06ef('0x4e')](_[_0x06ef('0x57')](_0x2cdca2[_0x06ef('0x4d')],_0x1544f0[_0x06ef('0x4e')]));_0x5e42c6[_0x06ef('0x56')][_0x06ef('0x67')]=_0xe863c['id'];if(_0x2cdca2['query'][_0x06ef('0x59')]){_0x5e42c6['where']=_[_0x06ef('0x61')](_0x5e42c6[_0x06ef('0x56')],{'$or':_[_0x06ef('0x48')](_0x5e42c6[_0x06ef('0x50')],function(_0x33cf98){var _0x282e20={};_0x282e20[_0x33cf98]={'$like':'%'+_0x2cdca2[_0x06ef('0x4d')][_0x06ef('0x59')]+'%'};return _0x282e20;})});}if(_0x2cdca2['query'][_0x06ef('0xa8')]){var _0x1016e1=_0x2cdca2[_0x06ef('0x4d')][_0x06ef('0xa8')]['split'](',');var _0x5a2180={};_0x5a2180[_0x1016e1[0x0]]={'$gte':moment(_0x1016e1[0x1])[_0x06ef('0xa9')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5e42c6[_0x06ef('0x56')]=_['merge'](_0x5e42c6[_0x06ef('0x56')],_0x5a2180);}_0x5e42c6=_[_0x06ef('0x61')]({},_0x5e42c6,_0x2cdca2[_0x06ef('0x5a')]);return db[_0x06ef('0xa7')][_0x06ef('0x35')]({'where':_0x5e42c6[_0x06ef('0x56')]})[_0x06ef('0x22')](function(_0x4271dd){_0x4924cb[_0x06ef('0x35')]=_0x4271dd;if(_0x2cdca2['query'][_0x06ef('0x6c')]){_0x5e42c6[_0x06ef('0x5b')]=[{'all':!![]}];}return db['MailMessage'][_0x06ef('0x72')](_0x5e42c6);})[_0x06ef('0x22')](function(_0x304200){if(_0x2cdca2[_0x06ef('0x4d')][_0x06ef('0xaa')]==='true'){for(var _0x22d35e=0x0;_0x22d35e<_0x304200[_0x06ef('0x60')];_0x22d35e++){_0x304200[_0x22d35e][_0x06ef('0x64')]=juice(_0x304200[_0x22d35e][_0x06ef('0x64')]);}}_0x4924cb['rows']=_0x304200;return _0x4924cb;});}})['then'](respondWithFilteredResult(_0x5926a4,_0x5e42c6))['catch'](handleError(_0x5926a4,null));};exports['send']=function(_0x58fcee,_0x2cb5be,_0x2a39e2){var _0x3a1876,_0x849a30={},_0x7b16bf;if(_0x58fcee[_0x06ef('0x64')]['to']){_0x7b16bf=_0x58fcee[_0x06ef('0x64')]['to'][_0x06ef('0xab')](',')[0x0];}return db['MailAccount'][_0x06ef('0x62')]({'where':{'id':_0x58fcee[_0x06ef('0x5e')]['id']},'include':[{'model':db[_0x06ef('0xac')],'as':_0x06ef('0xad'),'include':[{'model':db['CmContact'],'as':_0x06ef('0xae'),'where':{'email':_0x7b16bf},'limit':0x1,'order':[[_0x06ef('0xaf'),_0x06ef('0xb0')]]}]},{'model':db[_0x06ef('0x44')],'as':'Smtp','raw':!![]}]})[_0x06ef('0x22')](handleEntityNotFound(_0x2cb5be,null))[_0x06ef('0x22')](function(_0x1b67e4){if(_0x1b67e4){_0x3a1876=_0x1b67e4;if(_0x1b67e4[_0x06ef('0x45')]){if(_[_0x06ef('0x77')](_0x58fcee[_0x06ef('0x64')]['from'])){_0x58fcee[_0x06ef('0x64')][_0x06ef('0xb1')]=util['format'](_0x06ef('0xb2'),_0x1b67e4[_0x06ef('0x3f')],_0x1b67e4[_0x06ef('0x75')]||_0x1b67e4[_0x06ef('0x45')][_0x06ef('0x7a')]);}if(_0x58fcee[_0x06ef('0x64')]['attachments']&&_0x58fcee[_0x06ef('0x64')]['attachments'][_0x06ef('0x60')]){for(var _0x477689=0x0;_0x477689<_0x58fcee['body'][_0x06ef('0xb3')][_0x06ef('0x60')];_0x477689+=0x1){_0x58fcee['body'][_0x06ef('0xb3')][_0x477689]={'filename':_0x58fcee[_0x06ef('0x64')]['attachments'][_0x477689]['name'],'path':path[_0x06ef('0xb4')](config[_0x06ef('0xb5')],'server/files/attachments',_0x58fcee['body'][_0x06ef('0xb3')][_0x477689]['basename'])};}}var _0x5fb72f={'tls':{'rejectUnauthorized':![]}};if(_[_0x06ef('0x77')](_0x1b67e4[_0x06ef('0x45')][_0x06ef('0x82')])){if(_0x1b67e4[_0x06ef('0x45')]['authentication']){_0x5fb72f[_0x06ef('0xb6')]={'user':_0x1b67e4[_0x06ef('0x45')][_0x06ef('0x7a')],'pass':_0x1b67e4[_0x06ef('0x45')]['pass']};}_0x5fb72f[_0x06ef('0x80')]=_0x1b67e4[_0x06ef('0x45')][_0x06ef('0x80')];_0x5fb72f[_0x06ef('0x81')]=_0x1b67e4[_0x06ef('0x45')]['port'];_0x5fb72f[_0x06ef('0xb7')]=_0x1b67e4[_0x06ef('0x45')][_0x06ef('0xb7')];}else{_0x5fb72f[_0x06ef('0x82')]=_0x1b67e4['Smtp'][_0x06ef('0x82')];_0x5fb72f[_0x06ef('0xb6')]={'user':_0x1b67e4[_0x06ef('0x45')][_0x06ef('0x7a')],'pass':_0x1b67e4['Smtp'][_0x06ef('0x7d')]};}return respondWithRpcPromise(_0x06ef('0xb8'),_0x06ef('0xb9'),{'account':_0x5fb72f,'message':_0x58fcee[_0x06ef('0x64')]});}else{throw new Error(_0x06ef('0xba'));}}})[_0x06ef('0x22')](function(_0x59fa5b){if(_0x59fa5b){_0x849a30=_0x59fa5b;if(_0x3a1876[_0x06ef('0xad')]){if(_0x3a1876[_0x06ef('0xad')][_0x06ef('0xae')][_0x06ef('0x60')]){return _0x3a1876['List'][_0x06ef('0xae')][0x0];}else{return db['CmContact'][_0x06ef('0x74')](_[_0x06ef('0x1a')](_0x58fcee[_0x06ef('0x64')],{'firstName':_0x58fcee[_0x06ef('0x64')]['to'],'email':_0x58fcee['body']['to'],'phone':_0x58fcee[_0x06ef('0x64')]['to'],'ListId':_0x3a1876[_0x06ef('0x76')]}));}}else{throw new Error(_0x06ef('0xba'));}}})[_0x06ef('0x22')](function(_0x1a18b2){if(_0x1a18b2){var _0x318d76={'UserId':_0x58fcee['user']['id'],'ContactId':_0x1a18b2['id'],'MailAccountId':_0x3a1876['id'],'inReplyTo':_0x849a30[_0x06ef('0xbb')],'to':_0x58fcee[_0x06ef('0x64')]['from'],'cc':_0x58fcee[_0x06ef('0x64')]['cc'],'subject':_0x58fcee[_0x06ef('0x64')][_0x06ef('0xbc')],'attach':_0x58fcee['body'][_0x06ef('0xbd')],'firstMsgDirection':_0x06ef('0xbe'),'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'out','Messages':[_[_0x06ef('0x61')](_0x58fcee['body'],{'messageId':_0x849a30[_0x06ef('0xbb')],'sentAt':moment()[_0x06ef('0xa9')](_0x06ef('0xbf')),'read':!![],'MailAccountId':_0x3a1876['id'],'UserId':_0x58fcee[_0x06ef('0x7a')]['id'],'ContactId':_0x1a18b2['id']})]};if(_0x58fcee[_0x06ef('0x64')]['Interaction']){_0x318d76=_[_0x06ef('0x61')](_0x318d76,_0x58fcee[_0x06ef('0x64')][_0x06ef('0xc0')]);}return db[_0x06ef('0x91')][_0x06ef('0x74')](_0x318d76,{'include':[{'model':db[_0x06ef('0xa7')],'as':_0x06ef('0xc1')}]});}})[_0x06ef('0x22')](respondWithResult(_0x2cb5be,null))['catch'](handleError(_0x2cb5be,null));};exports[_0x06ef('0xc2')]=function(_0xe3d4c1,_0x423c2e,_0x3b60bf){return db[_0x06ef('0x49')][_0x06ef('0x62')]({'where':{'id':_0xe3d4c1[_0x06ef('0x5e')]['id']},'include':[{'model':db[_0x06ef('0x44')],'as':_0x06ef('0x45'),'raw':!![]}]})['then'](handleEntityNotFound(_0x423c2e,null))['then'](function(_0x406f4e){if(_0x406f4e&&_0x406f4e['Smtp']){var _0x5ce416={'id':_0x406f4e['id'],'tls':{'rejectUnauthorized':![]}};if(_0x406f4e[_0x06ef('0x45')][_0x06ef('0x82')]){_0x5ce416[_0x06ef('0x82')]=_0x406f4e[_0x06ef('0x45')]['service'];}else{_0x5ce416['host']=_0x406f4e['Smtp'][_0x06ef('0x80')];_0x5ce416['port']=_0x406f4e[_0x06ef('0x45')][_0x06ef('0x81')];_0x5ce416[_0x06ef('0xb7')]=_0x406f4e['Smtp'][_0x06ef('0xb7')];}if(_0x406f4e[_0x06ef('0x45')][_0x06ef('0x7f')]){_0x5ce416[_0x06ef('0xb6')]={'user':_0x406f4e[_0x06ef('0x45')][_0x06ef('0x7a')],'pass':_0x406f4e[_0x06ef('0x45')][_0x06ef('0x7d')]};}return respondWithRpcPromise(_0x06ef('0xc3'),_0x06ef('0xc2'),{'account':_0x5ce416});}})[_0x06ef('0x22')](respondWithResult(_0x423c2e,null))['catch'](handleError(_0x423c2e,null));};exports[_0x06ef('0x3b')]=function(_0x2ef46d,_0x129973){return db[_0x06ef('0x49')][_0x06ef('0x62')]({'where':{'id':_0x2ef46d[_0x06ef('0x5e')]['id']}})[_0x06ef('0x22')](handleEntityNotFound(_0x129973,null))[_0x06ef('0x22')](function(_0x1d729e){if(_0x1d729e&&_0x1d729e['service']){throw new db[(_0x06ef('0xc4'))][(_0x06ef('0xc5'))](_0x06ef('0xc6'));}return _0x1d729e;})['then'](removeEntity(_0x129973,null))[_0x06ef('0x2d')](handleError(_0x129973,null));};exports[_0x06ef('0xc7')]=function(_0x1c81fc,_0x3e3db8,_0x4f5329){return db[_0x06ef('0x49')]['find']({'where':{'id':_0x1c81fc[_0x06ef('0x5e')]['id']}})['then'](handleEntityNotFound(_0x3e3db8,null))[_0x06ef('0x22')](function(_0x4d5caf){if(_0x4d5caf){return _0x4d5caf[_0x06ef('0xc7')](_0x1c81fc[_0x06ef('0x64')][_0x06ef('0x6e')],_[_0x06ef('0x92')](_0x1c81fc['body'],[_0x06ef('0x6e'),'id'])||{})['spread'](function(_0x2c4805){for(var _0x75e138=0x0;_0x75e138<_0x1c81fc['body'][_0x06ef('0x6e')]['length'];_0x75e138+=0x1){socket[_0x06ef('0xc8')]('userMailAccount:save',{'UserId':Number(_0x1c81fc['body'][_0x06ef('0x6e')][_0x75e138]),'MailAccountId':Number(_0x1c81fc[_0x06ef('0x5e')]['id'])});}return _0x2c4805;});}})[_0x06ef('0x22')](respondWithResult(_0x3e3db8,null))[_0x06ef('0x2d')](handleError(_0x3e3db8,null));};exports['removeAgents']=function(_0x203d4f,_0x30f03c,_0x1647bb){return db[_0x06ef('0x49')][_0x06ef('0x62')]({'where':{'id':_0x203d4f[_0x06ef('0x5e')]['id']}})[_0x06ef('0x22')](handleEntityNotFound(_0x30f03c,null))[_0x06ef('0x22')](function(_0x2a05eb){if(_0x2a05eb){return _0x2a05eb[_0x06ef('0xc9')](_0x203d4f['query']['ids'])['then'](function(){if(_[_0x06ef('0xca')](_0x203d4f['query'][_0x06ef('0x6e')])){for(var _0x589826=0x0;_0x589826<_0x203d4f['query'][_0x06ef('0x6e')][_0x06ef('0x60')];_0x589826+=0x1){socket[_0x06ef('0xc8')](_0x06ef('0xcb'),{'UserId':Number(_0x203d4f[_0x06ef('0x4d')][_0x06ef('0x6e')][_0x589826]),'MailAccountId':Number(_0x203d4f[_0x06ef('0x5e')]['id'])});}}else{socket[_0x06ef('0xc8')](_0x06ef('0xcb'),{'UserId':Number(_0x203d4f['query']['ids']),'MailAccountId':Number(_0x203d4f[_0x06ef('0x5e')]['id'])});}});}})[_0x06ef('0x22')](respondWithStatusCode(_0x30f03c,null))['catch'](handleError(_0x30f03c,null));};exports[_0x06ef('0xcc')]=function(_0x4b3a30,_0x381b17,_0xd58ad3){var _0x501ad6={};var _0x3888a7={};var _0x466d19;var _0x4c6643;return db[_0x06ef('0x49')][_0x06ef('0x6a')]({'where':{'id':_0x4b3a30['params']['id']}})['then'](handleEntityNotFound(_0x381b17,null))['then'](function(_0x27a7c5){if(_0x27a7c5){_0x466d19=_0x27a7c5;_0x3888a7[_0x06ef('0x4f')]=_[_0x06ef('0x5f')](db['User'][_0x06ef('0x4a')]);_0x3888a7[_0x06ef('0x4d')]=_[_0x06ef('0x5f')](_0x4b3a30[_0x06ef('0x4d')]);_0x3888a7[_0x06ef('0x4e')]=_[_0x06ef('0x51')](_0x3888a7['model'],_0x3888a7[_0x06ef('0x4d')]);_0x501ad6[_0x06ef('0x50')]=_[_0x06ef('0x51')](_0x3888a7['model'],qs['fields'](_0x4b3a30[_0x06ef('0x4d')][_0x06ef('0x52')]));_0x501ad6[_0x06ef('0x50')]=_0x501ad6['attributes']['length']?_0x501ad6[_0x06ef('0x50')]:_0x3888a7[_0x06ef('0x4f')];_0x501ad6[_0x06ef('0x6b')]=qs[_0x06ef('0x55')](_0x4b3a30[_0x06ef('0x4d')][_0x06ef('0x55')]);_0x501ad6[_0x06ef('0x56')]=qs['filters'](_['pick'](_0x4b3a30[_0x06ef('0x4d')],_0x3888a7[_0x06ef('0x4e')]));if(_0x4b3a30[_0x06ef('0x4d')][_0x06ef('0x59')]){_0x501ad6['where']=_['merge'](_0x501ad6[_0x06ef('0x56')],{'$or':_['map'](_0x501ad6[_0x06ef('0x50')],function(_0x1cbf86){var _0x23564e={};_0x23564e[_0x1cbf86]={'$like':'%'+_0x4b3a30[_0x06ef('0x4d')][_0x06ef('0x59')]+'%'};return _0x23564e;})});}_0x501ad6=_['merge']({},_0x501ad6,_0x4b3a30[_0x06ef('0x5a')]);return _0x466d19['getAgents'](_0x501ad6);}})['then'](function(_0x5dbbaa){if(_0x5dbbaa){_0x4c6643=_0x5dbbaa[_0x06ef('0x60')];if(!_0x4b3a30['query'][_0x06ef('0x53')]('nolimit')){_0x501ad6[_0x06ef('0x34')]=qs[_0x06ef('0x34')](_0x4b3a30['query']['limit']);_0x501ad6['offset']=qs['offset'](_0x4b3a30[_0x06ef('0x4d')][_0x06ef('0x32')]);}return _0x466d19[_0x06ef('0xcc')](_0x501ad6);}})['then'](function(_0x523270){if(_0x523270){return _0x523270?{'count':_0x4c6643,'rows':_0x523270}:null;}})['then'](respondWithResult(_0x381b17,null))['catch'](handleError(_0x381b17,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 19ce06c..918f6ab 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 _0x2297=['hasOwnProperty','hook','exports','../../mysqldb','MailAccount','setMaxListeners','update','remove','emit'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x2297,0x186));var _0x7229=function(_0x4c2035,_0x309fdb){_0x4c2035=_0x4c2035-0x0;var _0x2c90ff=_0x2297[_0x4c2035];return _0x2c90ff;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0x7229('0x0'))['db'][_0x7229('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x7229('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7229('0x3'),'afterDestroy':_0x7229('0x4')};function emitEvent(_0x187313){return function(_0x5211b0,_0x36caa5,_0x4b7667){MailAccountEvents[_0x7229('0x5')](_0x187313+':'+_0x5211b0['id'],_0x5211b0);MailAccountEvents['emit'](_0x187313,_0x5211b0);_0x4b7667(null);};}for(var e in events){if(events[_0x7229('0x6')](e)){var event=events[e];MailAccount[_0x7229('0x7')](e,emitEvent(event));}}module[_0x7229('0x8')]=MailAccountEvents; \ No newline at end of file +var _0x19c9=['MailAccount','setMaxListeners','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x4122c9,_0x13edef){var _0x138ceb=function(_0x3bbc8c){while(--_0x3bbc8c){_0x4122c9['push'](_0x4122c9['shift']());}};_0x138ceb(++_0x13edef);}(_0x19c9,0x1bf));var _0x919c=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x19c9[_0x5ddb1c];return _0x354adc;};'use strict';var EventEmitter=require(_0x919c('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x919c('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x919c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x919c('0x3'),'afterDestroy':_0x919c('0x4')};function emitEvent(_0x531acd){return function(_0x30f4fe,_0x43e440,_0xe44b42){MailAccountEvents['emit'](_0x531acd+':'+_0x30f4fe['id'],_0x30f4fe);MailAccountEvents[_0x919c('0x5')](_0x531acd,_0x30f4fe);_0xe44b42(null);};}for(var e in events){if(events[_0x919c('0x6')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0x919c('0x7')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index d32529b..2b8c1f2 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 _0x1807=['lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','./mailAccount.attributes','exports','define','MailAccount','mail_accounts'];(function(_0x38e44a,_0x4e812d){var _0xbfaf2f=function(_0x4b2bcc){while(--_0x4b2bcc){_0x38e44a['push'](_0x38e44a['shift']());}};_0xbfaf2f(++_0x4e812d);}(_0x1807,0x1b0));var _0x7180=function(_0x199bdd,_0x5f09e2){_0x199bdd=_0x199bdd-0x0;var _0x5c4f2f=_0x1807[_0x199bdd];return _0x5c4f2f;};'use strict';var _=require(_0x7180('0x0'));var util=require(_0x7180('0x1'));var logger=require(_0x7180('0x2'))(_0x7180('0x3'));var moment=require(_0x7180('0x4'));var BPromise=require(_0x7180('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7180('0x6'));var attributes=require(_0x7180('0x7'));module[_0x7180('0x8')]=function(_0xc3ea4a,_0x51efe2){return _0xc3ea4a[_0x7180('0x9')](_0x7180('0xa'),attributes,{'tableName':_0x7180('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xad32=['request-promise','../../config/environment','./mailAccount.attributes','exports','MailAccount','mail_accounts','lodash','util','../../config/logger','api'];(function(_0x25c65a,_0x4f831d){var _0x36b3cd=function(_0xd63ab6){while(--_0xd63ab6){_0x25c65a['push'](_0x25c65a['shift']());}};_0x36b3cd(++_0x4f831d);}(_0xad32,0x1be));var _0x2ad3=function(_0x15781b,_0x4db9bb){_0x15781b=_0x15781b-0x0;var _0x20f955=_0xad32[_0x15781b];return _0x20f955;};'use strict';var _=require(_0x2ad3('0x0'));var util=require(_0x2ad3('0x1'));var logger=require(_0x2ad3('0x2'))(_0x2ad3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2ad3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2ad3('0x5'));var attributes=require(_0x2ad3('0x6'));module[_0x2ad3('0x7')]=function(_0x4ceac6,_0x1d1e2d){return _0x4ceac6['define'](_0x2ad3('0x8'),attributes,{'tableName':_0x2ad3('0x9'),'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 2c7c46e..93e040c 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 _0x3ed3=['attach','format','MailMessage','Messages','MailInteraction','Contact\x20not\x20found','spread','update','YYYY-MM-DD\x20HH:mm:ss','interaction','created','create','contact','attachments','originTo','originCc','bcc','ChatWebsiteId','Email','UserId','User','name','waitForTheAssignedAgent','startRouting','Start','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','request','info','MailAccount,\x20%s,\x20%s','debug','request\x20sent','error','message','MailAccount','findAll','options','raw','attributes','limit','include','map','model','GetMailAccount','stringify','catch','find','then','ShowMailAccount','NotifyMailAccount','difference','keys','rawAttributes','createdAt','updatedAt','CompanyId','ListId','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','List','CmContact','DESC','MailApplication','Applications','MailServerOut','Smtp','get','omit','applications','orderBy','priority','autoclose','push','length','close','*,*,*,*','Contacts','List\x20not\x20found','messageId','generate','subject'];(function(_0x480956,_0x19733b){var _0x205b77=function(_0x43ae75){while(--_0x43ae75){_0x480956['push'](_0x480956['shift']());}};_0x205b77(++_0x19733b);}(_0x3ed3,0xe7));var _0x33ed=function(_0x646390,_0x25c362){_0x646390=_0x646390-0x0;var _0x2391e6=_0x3ed3[_0x646390];return _0x2391e6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x33ed('0x0'));var BPromise=require('bluebird');var rs=require(_0x33ed('0x1'));var fs=require('fs');var Redis=require(_0x33ed('0x2'));var db=require(_0x33ed('0x3'))['db'];var utils=require(_0x33ed('0x4'));var logger=require('../../config/logger')(_0x33ed('0x5'));var config=require(_0x33ed('0x6'));var jayson=require(_0x33ed('0x7'));var client=jayson[_0x33ed('0x8')][_0x33ed('0x9')]({'port':0x232c});config[_0x33ed('0xa')]=_[_0x33ed('0xb')](config[_0x33ed('0xa')],{'host':_0x33ed('0xc'),'port':0x18eb});var socket=require(_0x33ed('0xd'))(new Redis(config['redis']));require(_0x33ed('0xe'))[_0x33ed('0xf')](socket);function respondWithRpcPromise(_0x16e6df,_0x4b1836,_0xd03721){return new BPromise(function(_0x5b3022,_0x337759){return client[_0x33ed('0x10')](_0x16e6df,_0xd03721)['then'](function(_0x592527){logger[_0x33ed('0x11')](_0x33ed('0x12'),_0x4b1836,'request\x20sent');logger[_0x33ed('0x13')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x4b1836,_0x33ed('0x14'),JSON['stringify'](_0x592527));if(_0x592527[_0x33ed('0x15')]){if(_0x592527[_0x33ed('0x15')]['code']===0x1f4){logger[_0x33ed('0x15')]('MailAccount,\x20%s,\x20%s',_0x4b1836,_0x592527[_0x33ed('0x15')][_0x33ed('0x16')]);return _0x337759(_0x592527[_0x33ed('0x15')][_0x33ed('0x16')]);}logger['error'](_0x33ed('0x12'),_0x4b1836,_0x592527[_0x33ed('0x15')][_0x33ed('0x16')]);return _0x5b3022(_0x592527[_0x33ed('0x15')][_0x33ed('0x16')]);}else{logger[_0x33ed('0x11')]('MailAccount,\x20%s,\x20%s',_0x4b1836,'request\x20sent');_0x5b3022(_0x592527['result'][_0x33ed('0x16')]);}})['catch'](function(_0x301d17){logger['error']('MailAccount,\x20%s,\x20%s',_0x4b1836,_0x301d17);_0x337759(_0x301d17);});});}exports['GetMailAccount']=function(_0x459b78){var _0x39dca5=this;return new Promise(function(_0x11cbcc,_0x20adcb){return db[_0x33ed('0x17')][_0x33ed('0x18')]({'raw':_0x459b78[_0x33ed('0x19')]?_0x459b78[_0x33ed('0x19')][_0x33ed('0x1a')]===undefined?!![]:![]:!![],'where':_0x459b78['options']?_0x459b78['options']['where']||null:null,'attributes':_0x459b78[_0x33ed('0x19')]?_0x459b78[_0x33ed('0x19')][_0x33ed('0x1b')]||null:null,'limit':_0x459b78[_0x33ed('0x19')]?_0x459b78[_0x33ed('0x19')][_0x33ed('0x1c')]||null:null,'include':_0x459b78[_0x33ed('0x19')]?_0x459b78[_0x33ed('0x19')][_0x33ed('0x1d')]?_[_0x33ed('0x1e')](_0x459b78[_0x33ed('0x19')][_0x33ed('0x1d')],function(_0x1afab0){return{'model':db[_0x1afab0[_0x33ed('0x1f')]],'as':_0x1afab0['as'],'attributes':_0x1afab0['attributes'],'include':_0x1afab0[_0x33ed('0x1d')]?_[_0x33ed('0x1e')](_0x1afab0['include'],function(_0x44db5f){return{'model':db[_0x44db5f['model']],'as':_0x44db5f['as'],'attributes':_0x44db5f[_0x33ed('0x1b')],'include':_0x44db5f[_0x33ed('0x1d')]?_[_0x33ed('0x1e')](_0x44db5f[_0x33ed('0x1d')],function(_0x4a15b9){return{'model':db[_0x4a15b9[_0x33ed('0x1f')]],'as':_0x4a15b9['as'],'attributes':_0x4a15b9[_0x33ed('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xf915aa){logger['info'](_0x33ed('0x20'),_0x459b78);logger[_0x33ed('0x13')](_0x33ed('0x20'),_0x459b78,JSON[_0x33ed('0x21')](_0xf915aa));_0x11cbcc(_0xf915aa);})[_0x33ed('0x22')](function(_0x28e6d3){logger[_0x33ed('0x15')](_0x33ed('0x20'),_0x28e6d3[_0x33ed('0x16')],_0x459b78);_0x20adcb(_0x39dca5[_0x33ed('0x15')](0x1f4,_0x28e6d3[_0x33ed('0x16')]));});});};exports['ShowMailAccount']=function(_0x343936){var _0x7e33d1=this;return new Promise(function(_0x3b47de,_0x240f23){return db['MailAccount'][_0x33ed('0x23')]({'raw':_0x343936['options']?_0x343936['options']['raw']===undefined?!![]:![]:!![],'where':_0x343936[_0x33ed('0x19')]?_0x343936[_0x33ed('0x19')]['where']||null:null,'attributes':_0x343936[_0x33ed('0x19')]?_0x343936[_0x33ed('0x19')][_0x33ed('0x1b')]||null:null,'include':_0x343936[_0x33ed('0x19')]?_0x343936[_0x33ed('0x19')][_0x33ed('0x1d')]?_[_0x33ed('0x1e')](_0x343936[_0x33ed('0x19')][_0x33ed('0x1d')],function(_0x54fa21){return{'model':db[_0x54fa21[_0x33ed('0x1f')]],'as':_0x54fa21['as'],'attributes':_0x54fa21[_0x33ed('0x1b')],'include':_0x54fa21[_0x33ed('0x1d')]?_['map'](_0x54fa21[_0x33ed('0x1d')],function(_0x12ada0){return{'model':db[_0x12ada0[_0x33ed('0x1f')]],'as':_0x12ada0['as'],'attributes':_0x12ada0['attributes'],'include':_0x12ada0[_0x33ed('0x1d')]?_[_0x33ed('0x1e')](_0x12ada0[_0x33ed('0x1d')],function(_0x178c2b){return{'model':db[_0x178c2b[_0x33ed('0x1f')]],'as':_0x178c2b['as'],'attributes':_0x178c2b[_0x33ed('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x33ed('0x24')](function(_0x5e5875){logger[_0x33ed('0x11')](_0x33ed('0x25'),_0x343936);logger['debug'](_0x33ed('0x25'),_0x343936,JSON['stringify'](_0x5e5875));_0x3b47de(_0x5e5875);})[_0x33ed('0x22')](function(_0x3339b5){logger[_0x33ed('0x15')]('ShowMailAccount',_0x3339b5[_0x33ed('0x16')],_0x343936);_0x240f23(_0x7e33d1['error'](0x1f4,_0x3339b5[_0x33ed('0x16')]));});});};exports[_0x33ed('0x26')]=function(_0x22dfad){var _0x5ef76d=this;return new Promise(function(_0x540f54,_0xd13fb4){var _0x7cdf06={'body':_0x22dfad['body'],'channel':'mail'};var _0x495535=_[_0x33ed('0x27')](_[_0x33ed('0x28')](db['CmContact'][_0x33ed('0x29')]),[_0x33ed('0x2a'),_0x33ed('0x2b'),_0x33ed('0x2c'),_0x33ed('0x2d')]);var _0x1c4384=![];if(_0x22dfad['body']['id']){delete _0x22dfad[_0x33ed('0x2e')]['id'];}if(_[_0x33ed('0x2f')](_0x22dfad[_0x33ed('0x2e')][_0x33ed('0x30')])){return _0xd13fb4(_0x5ef76d[_0x33ed('0x15')](0x1f4,_0x33ed('0x31')));}if(_[_0x33ed('0x2f')](_0x22dfad[_0x33ed('0x2e')][_0x33ed('0x2e')])||_0x22dfad['body'][_0x33ed('0x2e')]===''){return _0xd13fb4(_0x5ef76d[_0x33ed('0x15')](0x1f4,_0x33ed('0x32')));}if(_['isNil'](_0x22dfad[_0x33ed('0x2e')][_0x33ed('0x33')])){return _0xd13fb4(_0x5ef76d[_0x33ed('0x15')](0x1f4,_0x33ed('0x34')+_0x495535));}if(!_[_0x33ed('0x35')](_0x495535,_0x22dfad[_0x33ed('0x2e')][_0x33ed('0x33')])){return _0xd13fb4(_0x5ef76d['error'](0x1f4,_0x33ed('0x36')+_0x495535));}var _0x26cd48={};_0x26cd48[_0x22dfad[_0x33ed('0x2e')][_0x33ed('0x33')]]=_0x22dfad['body'][_0x33ed('0x30')];return db[_0x33ed('0x17')][_0x33ed('0x23')]({'where':{'id':_0x22dfad[_0x33ed('0x37')]['id']},'include':[{'model':db['CmList'],'as':_0x33ed('0x38'),'include':[{'model':db[_0x33ed('0x39')],'as':'Contacts','where':_0x26cd48,'limit':0x1,'order':[[_0x33ed('0x2b'),_0x33ed('0x3a')]]}]},{'model':db[_0x33ed('0x3b')],'as':_0x33ed('0x3c')},{'model':db[_0x33ed('0x3d')],'as':_0x33ed('0x3e')}]})[_0x33ed('0x24')](function(_0x573be4){if(_0x573be4&&_0x573be4[_0x33ed('0x38')]){var _0x12e707=_0x573be4[_0x33ed('0x3f')]({'plain':!![]});_0x7cdf06[_0x33ed('0x37')]=_[_0x33ed('0x40')](_0x12e707,[_0x33ed('0x3c'),_0x33ed('0x38')]);_0x7cdf06[_0x33ed('0x41')]=_0x12e707[_0x33ed('0x3c')];_0x7cdf06['list']=_0x12e707[_0x33ed('0x38')];_0x7cdf06[_0x33ed('0x41')]=_[_0x33ed('0x42')](_0x7cdf06[_0x33ed('0x41')],[_0x33ed('0x43')],['asc']);if(_0x7cdf06[_0x33ed('0x37')]&&_0x7cdf06[_0x33ed('0x37')][_0x33ed('0x44')]){_0x7cdf06[_0x33ed('0x41')][_0x33ed('0x45')]({'id':0x0,'priority':_0x7cdf06['applications'][_0x33ed('0x46')]+0x1,'app':_0x33ed('0x47'),'appdata':'autoclose','interval':_0x33ed('0x48')});}if(_0x7cdf06['account'][_0x33ed('0x3c')]){delete _0x7cdf06[_0x33ed('0x37')][_0x33ed('0x3c')];}if(_0x7cdf06['account'][_0x33ed('0x38')]){delete _0x7cdf06[_0x33ed('0x37')]['List'];}if(_0x12e707[_0x33ed('0x38')][_0x33ed('0x49')]['length']){return _0x12e707[_0x33ed('0x38')][_0x33ed('0x49')][0x0];}var _0x22ebfe=_[_0x33ed('0xb')](_0x22dfad['body'],{'firstName':_0x22dfad[_0x33ed('0x2e')][_0x33ed('0x30')],'ListId':_0x12e707[_0x33ed('0x2d')]});_0x22ebfe[_0x22dfad[_0x33ed('0x2e')][_0x33ed('0x33')]]=_0x22dfad[_0x33ed('0x2e')][_0x33ed('0x30')];return db['CmContact']['create'](_0x22ebfe);}else{throw new Error(_0x33ed('0x4a'));}})[_0x33ed('0x24')](function(_0x23a912){_0x7cdf06['contact']=_0x23a912;if(_0x23a912){if(!_0x22dfad[_0x33ed('0x2e')][_0x33ed('0x16')][_0x33ed('0x4b')]){_0x22dfad[_0x33ed('0x2e')][_0x33ed('0x16')][_0x33ed('0x4b')]=rs[_0x33ed('0x4c')]()+'\x20'+_0x22dfad[_0x33ed('0x2e')][_0x33ed('0x16')][_0x33ed('0x30')];}var _0x1a16c6={'ContactId':_0x23a912['id'],'MailAccountId':_0x22dfad[_0x33ed('0x37')]['id'],'inReplyTo':_0x22dfad[_0x33ed('0x2e')]['message'][_0x33ed('0x4b')],'to':_0x22dfad[_0x33ed('0x2e')][_0x33ed('0x16')][_0x33ed('0x30')],'cc':_0x22dfad[_0x33ed('0x2e')][_0x33ed('0x16')]['cc'],'subject':_0x22dfad['body'][_0x33ed('0x16')][_0x33ed('0x4d')],'attach':_0x22dfad['body'][_0x33ed('0x16')][_0x33ed('0x4e')],'lastMsgAt':moment()[_0x33ed('0x4f')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db['MailInteraction'][_0x33ed('0x23')]({'where':{'closed':![],'MailAccountId':_0x22dfad['account']['id']},'include':[{'model':db[_0x33ed('0x50')],'as':_0x33ed('0x51'),'attributes':[_0x33ed('0x4b')],'where':{'messageId':_0x22dfad[_0x33ed('0x2e')][_0x33ed('0x16')]['inReplyTo']}}]})[_0x33ed('0x24')](function(_0x1b4924){if(_0x1b4924){return[_0x1b4924,![]];}return db[_0x33ed('0x52')]['create'](_0x1a16c6)[_0x33ed('0x24')](function(_0x476369){return[_0x476369,!![]];});});}else{throw new Error(_0x33ed('0x53'));}})[_0x33ed('0x54')](function(_0x4abbae,_0x1bf407){if(_0x4abbae){_0x1c4384=_0x1bf407;if(!_0x1bf407){return _0x4abbae[_0x33ed('0x55')]({'inReplyTo':_0x22dfad['body'][_0x33ed('0x16')][_0x33ed('0x4b')],'to':_0x22dfad[_0x33ed('0x2e')][_0x33ed('0x16')][_0x33ed('0x30')],'cc':_0x22dfad[_0x33ed('0x2e')][_0x33ed('0x16')]['cc'],'subject':_0x22dfad[_0x33ed('0x2e')]['message'][_0x33ed('0x4d')],'attach':_0x4abbae[_0x33ed('0x4e')]?_0x4abbae[_0x33ed('0x4e')]:_0x22dfad['body']['message'][_0x33ed('0x4e')],'substatus':null,'substatusAt':moment()[_0x33ed('0x4f')](_0x33ed('0x56')),'lastMsgAt':moment()[_0x33ed('0x4f')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x4abbae;}}})[_0x33ed('0x24')](function(_0x3f7c16){_0x7cdf06[_0x33ed('0x57')]=_0x3f7c16[_0x33ed('0x3f')]({'plain':!![]});_0x7cdf06[_0x33ed('0x57')][_0x33ed('0x58')]=_0x1c4384;return db[_0x33ed('0x50')][_0x33ed('0x59')]({'body':_0x22dfad[_0x33ed('0x2e')][_0x33ed('0x2e')],'MailAccountId':_0x22dfad[_0x33ed('0x37')]['id'],'MailInteractionId':_0x3f7c16['id'],'direction':'in','ContactId':_0x7cdf06[_0x33ed('0x5a')]['id'],'messageId':_0x22dfad['body'][_0x33ed('0x16')][_0x33ed('0x4b')],'from':_0x22dfad[_0x33ed('0x2e')][_0x33ed('0x16')][_0x33ed('0x30')],'to':_0x22dfad['body']['message']['to'],'cc':_0x22dfad['body'][_0x33ed('0x16')]['cc'],'subject':_0x22dfad[_0x33ed('0x2e')][_0x33ed('0x16')]['subject'],'attach':_0x22dfad['body'][_0x33ed('0x16')][_0x33ed('0x4e')],'Attachments':_0x22dfad[_0x33ed('0x2e')][_0x33ed('0x16')][_0x33ed('0x5b')],'originTo':_0x22dfad[_0x33ed('0x2e')]['message'][_0x33ed('0x5c')],'originCc':_0x22dfad['body']['message'][_0x33ed('0x5d')],'bcc':_0x22dfad[_0x33ed('0x2e')]['message'][_0x33ed('0x5e')],'ChatWebsiteId':_0x22dfad[_0x33ed('0x2e')][_0x33ed('0x16')][_0x33ed('0x5f')]||null,'originChannel':_0x22dfad[_0x33ed('0x2e')]['message']['originChannel']||_0x33ed('0x60'),'ChatOfflineMessageId':_0x22dfad[_0x33ed('0x2e')][_0x33ed('0x16')]['ChatOfflineMessageId']||null},{'include':[{'model':db['Attachment'],'as':'Attachments'}]});})[_0x33ed('0x24')](function(_0x2afe17){_0x7cdf06[_0x33ed('0x16')]=_0x2afe17;if(_0x7cdf06[_0x33ed('0x57')][_0x33ed('0x61')]){return db[_0x33ed('0x62')][_0x33ed('0x23')]({'attributes':['id','name'],'where':{'id':_0x7cdf06[_0x33ed('0x57')][_0x33ed('0x61')]}})[_0x33ed('0x24')](function(_0x25d11f){if(_0x25d11f){_0x7cdf06[_0x33ed('0x41')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x25d11f[_0x33ed('0x63')]+','+(_0x7cdf06[_0x33ed('0x37')][_0x33ed('0x64')]||0xa),'interval':_0x33ed('0x48')});}return respondWithRpcPromise('Start',_0x33ed('0x65'),_0x7cdf06);});}return respondWithRpcPromise(_0x33ed('0x66'),_0x33ed('0x65'),_0x7cdf06);})[_0x33ed('0x24')](function(_0x1bb4ae){_0x540f54(_0x1bb4ae);})[_0x33ed('0x22')](function(_0x45091a){_0xd13fb4(_0x5ef76d[_0x33ed('0x15')](0x1f4,_0x45091a[_0x33ed('0x16')]));});});}; \ No newline at end of file +var _0x35d9=['unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailAccount','findAll','options','raw','where','attributes','include','map','model','ShowMailAccount','MailAccount','find','body','keys','CmContact','updatedAt','CompanyId','ListId','isNil','from','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','account','CmList','List','Contacts','MailApplication','MailServerOut','Smtp','get','applications','Applications','list','orderBy','priority','asc','autoclose','push','length','close','create','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','interaction','created','attachments','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name'];(function(_0x1cc4e1,_0x1629d4){var _0x192d47=function(_0x40dbe2){while(--_0x40dbe2){_0x1cc4e1['push'](_0x1cc4e1['shift']());}};_0x192d47(++_0x1629d4);}(_0x35d9,0x6f));var _0x935d=function(_0x22acae,_0x30bf58){_0x22acae=_0x22acae-0x0;var _0x15336f=_0x35d9[_0x22acae];return _0x15336f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x935d('0x0'));var BPromise=require(_0x935d('0x1'));var rs=require(_0x935d('0x2'));var fs=require('fs');var Redis=require(_0x935d('0x3'));var db=require(_0x935d('0x4'))['db'];var utils=require(_0x935d('0x5'));var logger=require(_0x935d('0x6'))(_0x935d('0x7'));var config=require('../../config/environment');var jayson=require(_0x935d('0x8'));var client=jayson[_0x935d('0x9')][_0x935d('0xa')]({'port':0x232c});config[_0x935d('0xb')]=_[_0x935d('0xc')](config[_0x935d('0xb')],{'host':_0x935d('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x935d('0xe'))[_0x935d('0xf')](socket);function respondWithRpcPromise(_0x5a1bf0,_0x3ce126,_0xc60794){return new BPromise(function(_0x2c43b1,_0x3f71bf){return client[_0x935d('0x10')](_0x5a1bf0,_0xc60794)[_0x935d('0x11')](function(_0x334aa7){logger[_0x935d('0x12')](_0x935d('0x13'),_0x3ce126,_0x935d('0x14'));logger[_0x935d('0x15')](_0x935d('0x16'),_0x3ce126,'request\x20sent',JSON[_0x935d('0x17')](_0x334aa7));if(_0x334aa7['error']){if(_0x334aa7[_0x935d('0x18')][_0x935d('0x19')]===0x1f4){logger[_0x935d('0x18')]('MailAccount,\x20%s,\x20%s',_0x3ce126,_0x334aa7[_0x935d('0x18')][_0x935d('0x1a')]);return _0x3f71bf(_0x334aa7[_0x935d('0x18')][_0x935d('0x1a')]);}logger[_0x935d('0x18')](_0x935d('0x13'),_0x3ce126,_0x334aa7[_0x935d('0x18')][_0x935d('0x1a')]);return _0x2c43b1(_0x334aa7[_0x935d('0x18')][_0x935d('0x1a')]);}else{logger['info'](_0x935d('0x13'),_0x3ce126,'request\x20sent');_0x2c43b1(_0x334aa7[_0x935d('0x1b')][_0x935d('0x1a')]);}})[_0x935d('0x1c')](function(_0x5af43a){logger['error'](_0x935d('0x13'),_0x3ce126,_0x5af43a);_0x3f71bf(_0x5af43a);});});}exports[_0x935d('0x1d')]=function(_0x1e965b){var _0x2f5eab=this;return new Promise(function(_0x3eac39,_0x961575){return db['MailAccount'][_0x935d('0x1e')]({'raw':_0x1e965b[_0x935d('0x1f')]?_0x1e965b[_0x935d('0x1f')][_0x935d('0x20')]===undefined?!![]:![]:!![],'where':_0x1e965b[_0x935d('0x1f')]?_0x1e965b[_0x935d('0x1f')][_0x935d('0x21')]||null:null,'attributes':_0x1e965b[_0x935d('0x1f')]?_0x1e965b[_0x935d('0x1f')][_0x935d('0x22')]||null:null,'limit':_0x1e965b[_0x935d('0x1f')]?_0x1e965b[_0x935d('0x1f')]['limit']||null:null,'include':_0x1e965b[_0x935d('0x1f')]?_0x1e965b[_0x935d('0x1f')][_0x935d('0x23')]?_[_0x935d('0x24')](_0x1e965b[_0x935d('0x1f')]['include'],function(_0x151070){return{'model':db[_0x151070[_0x935d('0x25')]],'as':_0x151070['as'],'attributes':_0x151070[_0x935d('0x22')],'include':_0x151070[_0x935d('0x23')]?_['map'](_0x151070['include'],function(_0x47bed5){return{'model':db[_0x47bed5[_0x935d('0x25')]],'as':_0x47bed5['as'],'attributes':_0x47bed5['attributes'],'include':_0x47bed5[_0x935d('0x23')]?_[_0x935d('0x24')](_0x47bed5[_0x935d('0x23')],function(_0x548659){return{'model':db[_0x548659['model']],'as':_0x548659['as'],'attributes':_0x548659['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5d8a7f){logger[_0x935d('0x12')]('GetMailAccount',_0x1e965b);logger[_0x935d('0x15')]('GetMailAccount',_0x1e965b,JSON['stringify'](_0x5d8a7f));_0x3eac39(_0x5d8a7f);})['catch'](function(_0x918fcb){logger['error'](_0x935d('0x1d'),_0x918fcb[_0x935d('0x1a')],_0x1e965b);_0x961575(_0x2f5eab[_0x935d('0x18')](0x1f4,_0x918fcb['message']));});});};exports[_0x935d('0x26')]=function(_0x3a3c18){var _0x2a610b=this;return new Promise(function(_0x2f74a9,_0x506769){return db[_0x935d('0x27')][_0x935d('0x28')]({'raw':_0x3a3c18[_0x935d('0x1f')]?_0x3a3c18['options'][_0x935d('0x20')]===undefined?!![]:![]:!![],'where':_0x3a3c18[_0x935d('0x1f')]?_0x3a3c18[_0x935d('0x1f')][_0x935d('0x21')]||null:null,'attributes':_0x3a3c18[_0x935d('0x1f')]?_0x3a3c18[_0x935d('0x1f')]['attributes']||null:null,'include':_0x3a3c18[_0x935d('0x1f')]?_0x3a3c18['options']['include']?_['map'](_0x3a3c18[_0x935d('0x1f')][_0x935d('0x23')],function(_0x71359c){return{'model':db[_0x71359c[_0x935d('0x25')]],'as':_0x71359c['as'],'attributes':_0x71359c[_0x935d('0x22')],'include':_0x71359c[_0x935d('0x23')]?_['map'](_0x71359c[_0x935d('0x23')],function(_0x3c8990){return{'model':db[_0x3c8990[_0x935d('0x25')]],'as':_0x3c8990['as'],'attributes':_0x3c8990['attributes'],'include':_0x3c8990[_0x935d('0x23')]?_[_0x935d('0x24')](_0x3c8990[_0x935d('0x23')],function(_0x17629d){return{'model':db[_0x17629d['model']],'as':_0x17629d['as'],'attributes':_0x17629d[_0x935d('0x22')]};}):[]};}):[]};}):[]:[]})[_0x935d('0x11')](function(_0x4595bd){logger['info'](_0x935d('0x26'),_0x3a3c18);logger['debug']('ShowMailAccount',_0x3a3c18,JSON[_0x935d('0x17')](_0x4595bd));_0x2f74a9(_0x4595bd);})[_0x935d('0x1c')](function(_0xe7d3ff){logger['error'](_0x935d('0x26'),_0xe7d3ff['message'],_0x3a3c18);_0x506769(_0x2a610b[_0x935d('0x18')](0x1f4,_0xe7d3ff[_0x935d('0x1a')]));});});};exports['NotifyMailAccount']=function(_0x10806b){var _0x4ecec6=this;return new Promise(function(_0x37f454,_0x39f454){var _0x4fead5={'body':_0x10806b[_0x935d('0x29')],'channel':'mail'};var _0x5b5194=_['difference'](_[_0x935d('0x2a')](db[_0x935d('0x2b')]['rawAttributes']),['createdAt',_0x935d('0x2c'),_0x935d('0x2d'),_0x935d('0x2e')]);var _0x4a4490=![];if(_0x10806b[_0x935d('0x29')]['id']){delete _0x10806b[_0x935d('0x29')]['id'];}if(_[_0x935d('0x2f')](_0x10806b[_0x935d('0x29')][_0x935d('0x30')])){return _0x39f454(_0x4ecec6['error'](0x1f4,_0x935d('0x31')));}if(_[_0x935d('0x2f')](_0x10806b[_0x935d('0x29')][_0x935d('0x29')])||_0x10806b[_0x935d('0x29')][_0x935d('0x29')]===''){return _0x39f454(_0x4ecec6[_0x935d('0x18')](0x1f4,_0x935d('0x32')));}if(_[_0x935d('0x2f')](_0x10806b['body']['mapKey'])){return _0x39f454(_0x4ecec6['error'](0x1f4,_0x935d('0x33')+_0x5b5194));}if(!_['includes'](_0x5b5194,_0x10806b['body'][_0x935d('0x34')])){return _0x39f454(_0x4ecec6[_0x935d('0x18')](0x1f4,_0x935d('0x35')+_0x5b5194));}var _0x4e9b26={};_0x4e9b26[_0x10806b['body'][_0x935d('0x34')]]=_0x10806b[_0x935d('0x29')]['from'];return db[_0x935d('0x27')][_0x935d('0x28')]({'where':{'id':_0x10806b[_0x935d('0x36')]['id']},'include':[{'model':db[_0x935d('0x37')],'as':_0x935d('0x38'),'include':[{'model':db[_0x935d('0x2b')],'as':_0x935d('0x39'),'where':_0x4e9b26,'limit':0x1,'order':[[_0x935d('0x2c'),'DESC']]}]},{'model':db[_0x935d('0x3a')],'as':'Applications'},{'model':db[_0x935d('0x3b')],'as':_0x935d('0x3c')}]})['then'](function(_0x4b77bb){if(_0x4b77bb&&_0x4b77bb['List']){var _0x4633b7=_0x4b77bb[_0x935d('0x3d')]({'plain':!![]});_0x4fead5[_0x935d('0x36')]=_['omit'](_0x4633b7,['Applications',_0x935d('0x38')]);_0x4fead5[_0x935d('0x3e')]=_0x4633b7[_0x935d('0x3f')];_0x4fead5[_0x935d('0x40')]=_0x4633b7[_0x935d('0x38')];_0x4fead5[_0x935d('0x3e')]=_[_0x935d('0x41')](_0x4fead5[_0x935d('0x3e')],[_0x935d('0x42')],[_0x935d('0x43')]);if(_0x4fead5[_0x935d('0x36')]&&_0x4fead5['account'][_0x935d('0x44')]){_0x4fead5['applications'][_0x935d('0x45')]({'id':0x0,'priority':_0x4fead5['applications'][_0x935d('0x46')]+0x1,'app':_0x935d('0x47'),'appdata':_0x935d('0x44'),'interval':'*,*,*,*'});}if(_0x4fead5['account']['Applications']){delete _0x4fead5[_0x935d('0x36')]['Applications'];}if(_0x4fead5[_0x935d('0x36')]['List']){delete _0x4fead5[_0x935d('0x36')][_0x935d('0x38')];}if(_0x4633b7[_0x935d('0x38')][_0x935d('0x39')][_0x935d('0x46')]){return _0x4633b7[_0x935d('0x38')]['Contacts'][0x0];}var _0x2b4110=_['defaults'](_0x10806b['body'],{'firstName':_0x10806b[_0x935d('0x29')][_0x935d('0x30')],'ListId':_0x4633b7[_0x935d('0x2e')]});_0x2b4110[_0x10806b[_0x935d('0x29')][_0x935d('0x34')]]=_0x10806b[_0x935d('0x29')][_0x935d('0x30')];return db[_0x935d('0x2b')][_0x935d('0x48')](_0x2b4110);}else{throw new Error('List\x20not\x20found');}})[_0x935d('0x11')](function(_0x333803){_0x4fead5['contact']=_0x333803;if(_0x333803){if(!_0x10806b[_0x935d('0x29')][_0x935d('0x1a')]['messageId']){_0x10806b[_0x935d('0x29')][_0x935d('0x1a')][_0x935d('0x49')]=rs[_0x935d('0x4a')]()+'\x20'+_0x10806b['body'][_0x935d('0x1a')]['from'];}var _0x15b3f8={'ContactId':_0x333803['id'],'MailAccountId':_0x10806b['account']['id'],'inReplyTo':_0x10806b['body'][_0x935d('0x1a')][_0x935d('0x49')],'to':_0x10806b['body'][_0x935d('0x1a')]['from'],'cc':_0x10806b[_0x935d('0x29')][_0x935d('0x1a')]['cc'],'subject':_0x10806b[_0x935d('0x29')][_0x935d('0x1a')][_0x935d('0x4b')],'attach':_0x10806b[_0x935d('0x29')]['message'][_0x935d('0x4c')],'lastMsgAt':moment()[_0x935d('0x4d')](_0x935d('0x4e')),'lastMsgDirection':'in'};return db[_0x935d('0x4f')][_0x935d('0x28')]({'where':{'closed':![],'MailAccountId':_0x10806b[_0x935d('0x36')]['id']},'include':[{'model':db[_0x935d('0x50')],'as':_0x935d('0x51'),'attributes':['messageId'],'where':{'messageId':_0x10806b['body'][_0x935d('0x1a')][_0x935d('0x52')]}}]})[_0x935d('0x11')](function(_0xd82630){if(_0xd82630){return[_0xd82630,![]];}return db[_0x935d('0x4f')][_0x935d('0x48')](_0x15b3f8)['then'](function(_0x15d054){return[_0x15d054,!![]];});});}else{throw new Error(_0x935d('0x53'));}})[_0x935d('0x54')](function(_0x484ef6,_0x15f93e){if(_0x484ef6){_0x4a4490=_0x15f93e;if(!_0x15f93e){return _0x484ef6[_0x935d('0x55')]({'inReplyTo':_0x10806b[_0x935d('0x29')][_0x935d('0x1a')][_0x935d('0x49')],'to':_0x10806b[_0x935d('0x29')][_0x935d('0x1a')][_0x935d('0x30')],'cc':_0x10806b[_0x935d('0x29')][_0x935d('0x1a')]['cc'],'subject':_0x10806b['body'][_0x935d('0x1a')][_0x935d('0x4b')],'attach':_0x484ef6['attach']?_0x484ef6[_0x935d('0x4c')]:_0x10806b[_0x935d('0x29')]['message'][_0x935d('0x4c')],'substatus':null,'substatusAt':moment()[_0x935d('0x4d')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0x935d('0x4d')](_0x935d('0x4e')),'lastMsgDirection':'in'});}else{return _0x484ef6;}}})[_0x935d('0x11')](function(_0x3a1d6f){_0x4fead5[_0x935d('0x56')]=_0x3a1d6f[_0x935d('0x3d')]({'plain':!![]});_0x4fead5[_0x935d('0x56')][_0x935d('0x57')]=_0x4a4490;return db['MailMessage'][_0x935d('0x48')]({'body':_0x10806b[_0x935d('0x29')][_0x935d('0x29')],'MailAccountId':_0x10806b[_0x935d('0x36')]['id'],'MailInteractionId':_0x3a1d6f['id'],'direction':'in','ContactId':_0x4fead5['contact']['id'],'messageId':_0x10806b[_0x935d('0x29')]['message'][_0x935d('0x49')],'from':_0x10806b[_0x935d('0x29')][_0x935d('0x1a')]['from'],'to':_0x10806b[_0x935d('0x29')]['message']['to'],'cc':_0x10806b[_0x935d('0x29')][_0x935d('0x1a')]['cc'],'subject':_0x10806b[_0x935d('0x29')][_0x935d('0x1a')][_0x935d('0x4b')],'attach':_0x10806b['body'][_0x935d('0x1a')][_0x935d('0x4c')],'Attachments':_0x10806b[_0x935d('0x29')][_0x935d('0x1a')][_0x935d('0x58')],'originTo':_0x10806b['body'][_0x935d('0x1a')]['originTo'],'originCc':_0x10806b[_0x935d('0x29')]['message']['originCc'],'bcc':_0x10806b[_0x935d('0x29')][_0x935d('0x1a')][_0x935d('0x59')],'ChatWebsiteId':_0x10806b['body'][_0x935d('0x1a')][_0x935d('0x5a')]||null,'originChannel':_0x10806b[_0x935d('0x29')]['message'][_0x935d('0x5b')]||_0x935d('0x5c'),'ChatOfflineMessageId':_0x10806b['body'][_0x935d('0x1a')][_0x935d('0x5d')]||null},{'include':[{'model':db[_0x935d('0x5e')],'as':_0x935d('0x5f')}]});})[_0x935d('0x11')](function(_0x41d9bc){_0x4fead5[_0x935d('0x1a')]=_0x41d9bc;if(_0x4fead5[_0x935d('0x56')][_0x935d('0x60')]){return db[_0x935d('0x61')]['find']({'attributes':['id',_0x935d('0x62')],'where':{'id':_0x4fead5['interaction'][_0x935d('0x60')]}})[_0x935d('0x11')](function(_0x45fc95){if(_0x45fc95){_0x4fead5['applications'][_0x935d('0x63')]({'id':0x0,'priority':0x0,'app':_0x935d('0x64'),'appdata':_0x45fc95[_0x935d('0x62')]+','+(_0x4fead5[_0x935d('0x36')][_0x935d('0x65')]||0xa),'interval':_0x935d('0x66')});}return respondWithRpcPromise(_0x935d('0x67'),_0x935d('0x68'),_0x4fead5);});}return respondWithRpcPromise(_0x935d('0x67'),_0x935d('0x68'),_0x4fead5);})[_0x935d('0x11')](function(_0xfd1d5a){_0x37f454(_0xfd1d5a);})[_0x935d('0x1c')](function(_0x33d12a){_0x39f454(_0x4ecec6[_0x935d('0x18')](0x1f4,_0x33d12a[_0x935d('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 14ba82e..fd4a204 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 _0x45e2=['length','mailAccount:','save','remove','emit','register'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0x45e2,0x1a0));var _0x245e=function(_0x13162f,_0xadeef){_0x13162f=_0x13162f-0x0;var _0x1f17db=_0x45e2[_0x13162f];return _0x1f17db;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0x245e('0x0'),_0x245e('0x1'),'update'];function createListener(_0x121cde,_0x21958e){return function(_0x3a2058){_0x21958e[_0x245e('0x2')](_0x121cde,_0x3a2058);};}function removeListener(_0x533338,_0x764a48){return function(){MailAccountEvents['removeListener'](_0x533338,_0x764a48);};}exports[_0x245e('0x3')]=function(_0x4f0359){for(var _0x1d1602=0x0,_0x2a45de=events[_0x245e('0x4')];_0x1d1602<_0x2a45de;_0x1d1602++){var _0x2b9b9f=events[_0x1d1602];var _0x6a0a8f=createListener(_0x245e('0x5')+_0x2b9b9f,_0x4f0359);MailAccountEvents['on'](_0x2b9b9f,_0x6a0a8f);}}; \ No newline at end of file +var _0xc7ec=['length','mailAccount:','./mailAccount.events','save','emit','removeListener'];(function(_0x302be5,_0x4b9329){var _0x16c88b=function(_0x57a107){while(--_0x57a107){_0x302be5['push'](_0x302be5['shift']());}};_0x16c88b(++_0x4b9329);}(_0xc7ec,0x164));var _0xcc7e=function(_0x16dbcd,_0x274516){_0x16dbcd=_0x16dbcd-0x0;var _0x34706e=_0xc7ec[_0x16dbcd];return _0x34706e;};'use strict';var MailAccountEvents=require(_0xcc7e('0x0'));var events=[_0xcc7e('0x1'),'remove','update'];function createListener(_0x46db9d,_0x1be831){return function(_0x237356){_0x1be831[_0xcc7e('0x2')](_0x46db9d,_0x237356);};}function removeListener(_0x2a7005,_0x2420b0){return function(){MailAccountEvents[_0xcc7e('0x3')](_0x2a7005,_0x2420b0);};}exports['register']=function(_0x5e6cfb){for(var _0x322688=0x0,_0x4b6d8d=events[_0xcc7e('0x4')];_0x322688<_0x4b6d8d;_0x322688++){var _0x298ad2=events[_0x322688];var _0x6650fb=createListener(_0xcc7e('0x5')+_0x298ad2,_0x5e6cfb);MailAccountEvents['on'](_0x298ad2,_0x6650fb);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index ee11f0a..c744e9f 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 _0x569f=['./mailApplication.controller','get','/:id','isAuthenticated','show','delete','destroy','path','express','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x3a6537,_0x159a18){var _0x3e6878=function(_0x29b708){while(--_0x29b708){_0x3a6537['push'](_0x3a6537['shift']());}};_0x3e6878(++_0x159a18);}(_0x569f,0xdf));var _0xf569=function(_0x305486,_0x24acd4){_0x305486=_0x305486-0x0;var _0xa04940=_0x569f[_0x305486];return _0xa04940;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf569('0x0'));var timeout=require('connect-timeout');var express=require(_0xf569('0x1'));var router=express['Router']();var fs_extra=require(_0xf569('0x2'));var auth=require(_0xf569('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xf569('0x4'));var controller=require(_0xf569('0x5'));router[_0xf569('0x6')](_0xf569('0x7'),auth[_0xf569('0x8')](),controller[_0xf569('0x9')]);router['put']('/:id',auth[_0xf569('0x8')](),controller['update']);router[_0xf569('0xa')](_0xf569('0x7'),auth[_0xf569('0x8')](),controller[_0xf569('0xb')]);module['exports']=router; \ No newline at end of file +var _0xe4ba=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','show','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x54a59e,_0x3c19e5){var _0x51c61f=function(_0x126826){while(--_0x126826){_0x54a59e['push'](_0x54a59e['shift']());}};_0x51c61f(++_0x3c19e5);}(_0xe4ba,0x1f4));var _0xae4b=function(_0x37ba77,_0xa4eb84){_0x37ba77=_0x37ba77-0x0;var _0x3ba664=_0xe4ba[_0x37ba77];return _0x3ba664;};'use strict';var multer=require(_0xae4b('0x0'));var util=require(_0xae4b('0x1'));var path=require(_0xae4b('0x2'));var timeout=require(_0xae4b('0x3'));var express=require('express');var router=express[_0xae4b('0x4')]();var fs_extra=require(_0xae4b('0x5'));var auth=require(_0xae4b('0x6'));var interaction=require(_0xae4b('0x7'));var config=require(_0xae4b('0x8'));var controller=require(_0xae4b('0x9'));router[_0xae4b('0xa')](_0xae4b('0xb'),auth['isAuthenticated'](),controller[_0xae4b('0xc')]);router['put'](_0xae4b('0xb'),auth[_0xae4b('0xd')](),controller[_0xae4b('0xe')]);router[_0xae4b('0xf')](_0xae4b('0xb'),auth[_0xae4b('0xd')](),controller[_0xae4b('0x10')]);module[_0xae4b('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index be0820d..1b33afe 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 _0x136f=['sequelize','exports','INTEGER','STRING','TEXT','*,*,*,*'];(function(_0x23e20b,_0xce166d){var _0x2c58ed=function(_0x260838){while(--_0x260838){_0x23e20b['push'](_0x23e20b['shift']());}};_0x2c58ed(++_0xce166d);}(_0x136f,0x12c));var _0xf136=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x136f[_0x1deb03];return _0x189fe7;};'use strict';var Sequelize=require(_0xf136('0x0'));module[_0xf136('0x1')]={'priority':{'type':Sequelize[_0xf136('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xf136('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xf136('0x4')]()},'description':{'type':Sequelize[_0xf136('0x3')]},'interval':{'type':Sequelize[_0xf136('0x3')],'defaultValue':_0xf136('0x5')}}; \ No newline at end of file +var _0x0f6f=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x257196,_0x3a380c){var _0x5121ae=function(_0x52ffac){while(--_0x52ffac){_0x257196['push'](_0x257196['shift']());}};_0x5121ae(++_0x3a380c);}(_0x0f6f,0x1dc));var _0xf0f6=function(_0x3dd0b9,_0x1d6c92){_0x3dd0b9=_0x3dd0b9-0x0;var _0x4c0351=_0x0f6f[_0x3dd0b9];return _0x4c0351;};'use strict';var Sequelize=require(_0xf0f6('0x0'));module[_0xf0f6('0x1')]={'priority':{'type':Sequelize[_0xf0f6('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xf0f6('0x3')],'allowNull':![],'defaultValue':_0xf0f6('0x4')},'appdata':{'type':Sequelize[_0xf0f6('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xf0f6('0x3')],'defaultValue':_0xf0f6('0x6')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 4ab2fc4..6a8a8fd 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 _0x0713=['catch','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','show','params','MailApplication','rawAttributes','query','keys','filters','intersection','model','fields','attributes','length','includeAll','include','merge','options','find','body'];(function(_0x4e4e1a,_0x34735d){var _0x59bc77=function(_0x5c6fb4){while(--_0x5c6fb4){_0x4e4e1a['push'](_0x4e4e1a['shift']());}};_0x59bc77(++_0x34735d);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3071('0x0'));var jsonpatch=require(_0x3071('0x1'));var rp=require(_0x3071('0x2'));var moment=require(_0x3071('0x3'));var BPromise=require(_0x3071('0x4'));var Mustache=require('mustache');var util=require(_0x3071('0x5'));var path=require(_0x3071('0x6'));var sox=require(_0x3071('0x7'));var csv=require(_0x3071('0x8'));var ejs=require(_0x3071('0x9'));var fs=require('fs');var fs_extra=require(_0x3071('0xa'));var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x8'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var licenseUtil=require(_0x3071('0x19'));var db=require(_0x3071('0x1a'))['db'];function respondWithStatusCode(_0x4a8cc7,_0x5330a8){_0x5330a8=_0x5330a8||0xcc;return function(_0x1826ca){if(_0x1826ca){return _0x4a8cc7['sendStatus'](_0x5330a8);}return _0x4a8cc7[_0x3071('0x1b')](_0x5330a8)[_0x3071('0x1c')]();};}function respondWithResult(_0x5d4883,_0x104e73){_0x104e73=_0x104e73||0xc8;return function(_0x4e1219){if(_0x4e1219){return _0x5d4883[_0x3071('0x1b')](_0x104e73)[_0x3071('0x1d')](_0x4e1219);}};}function respondWithFilteredResult(_0x1271d0,_0x1f14e1){return function(_0x1caa5d){if(_0x1caa5d){var _0x2a6a4b=typeof _0x1f14e1[_0x3071('0x1e')]===_0x3071('0x1f')&&typeof _0x1f14e1[_0x3071('0x20')]===_0x3071('0x1f');var _0x5f3c22=_0x1caa5d[_0x3071('0x21')];var _0x17dbda=_0x2a6a4b?0x0:_0x1f14e1[_0x3071('0x1e')];var _0x108a83=_0x2a6a4b?_0x1caa5d[_0x3071('0x21')]:_0x1f14e1[_0x3071('0x1e')]+_0x1f14e1[_0x3071('0x20')];var _0x26f113;if(_0x108a83>=_0x5f3c22){_0x108a83=_0x5f3c22;_0x26f113=0xc8;}else{_0x26f113=0xce;}_0x1271d0['status'](_0x26f113);return _0x1271d0[_0x3071('0x22')](_0x3071('0x23'),_0x17dbda+'-'+_0x108a83+'/'+_0x5f3c22)[_0x3071('0x1d')](_0x1caa5d);}return null;};}function patchUpdates(_0x56c267){return function(_0xb8f4e3){try{jsonpatch['apply'](_0xb8f4e3,_0x56c267,!![]);}catch(_0x833074){return BPromise[_0x3071('0x24')](_0x833074);}return _0xb8f4e3[_0x3071('0x25')]();};}function saveUpdates(_0x457b57,_0x33090c){return function(_0x34c50e){if(_0x34c50e){return _0x34c50e[_0x3071('0x26')](_0x457b57)[_0x3071('0x27')](function(_0x542646){return _0x542646;});}return null;};}function removeEntity(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(_0xb05b1d){return _0xb05b1d[_0x3071('0x28')]()[_0x3071('0x27')](function(){_0x481a51[_0x3071('0x1b')](0xcc)[_0x3071('0x1c')]();});}};}function handleEntityNotFound(_0x7a4cb4,_0x1fe727){return function(_0x1de5fb){if(!_0x1de5fb){_0x7a4cb4['sendStatus'](0x194);}return _0x1de5fb;};}function handleError(_0x2e5f93,_0x3f1e6e){_0x3f1e6e=_0x3f1e6e||0x1f4;return function(_0x177138){logger['error'](_0x177138[_0x3071('0x29')]);if(_0x177138[_0x3071('0x2a')]){delete _0x177138[_0x3071('0x2a')];}_0x2e5f93[_0x3071('0x1b')](_0x3f1e6e)[_0x3071('0x2b')](_0x177138);};}exports[_0x3071('0x2c')]=function(_0x177b5f,_0x3921a1){var _0x32f1b4={'raw':!![],'where':{'id':_0x177b5f[_0x3071('0x2d')]['id']}},_0x292205={};_0x292205['model']=_['keys'](db[_0x3071('0x2e')][_0x3071('0x2f')]);_0x292205[_0x3071('0x30')]=_[_0x3071('0x31')](_0x177b5f[_0x3071('0x30')]);_0x292205[_0x3071('0x32')]=_[_0x3071('0x33')](_0x292205[_0x3071('0x34')],_0x292205['query']);_0x32f1b4['attributes']=_['intersection'](_0x292205[_0x3071('0x34')],qs[_0x3071('0x35')](_0x177b5f['query'][_0x3071('0x35')]));_0x32f1b4[_0x3071('0x36')]=_0x32f1b4[_0x3071('0x36')][_0x3071('0x37')]?_0x32f1b4['attributes']:_0x292205[_0x3071('0x34')];if(_0x177b5f[_0x3071('0x30')][_0x3071('0x38')]){_0x32f1b4[_0x3071('0x39')]=[{'all':!![]}];}_0x32f1b4=_[_0x3071('0x3a')]({},_0x32f1b4,_0x177b5f[_0x3071('0x3b')]);return db[_0x3071('0x2e')][_0x3071('0x3c')](_0x32f1b4)['then'](handleEntityNotFound(_0x3921a1,null))[_0x3071('0x27')](respondWithResult(_0x3921a1,null))['catch'](handleError(_0x3921a1,null));};exports['update']=function(_0x1a1a64,_0xa3a7ae){if(_0x1a1a64['body']['id']){delete _0x1a1a64[_0x3071('0x3d')]['id'];}return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x1a1a64[_0x3071('0x2d')]['id']}})[_0x3071('0x27')](handleEntityNotFound(_0xa3a7ae,null))[_0x3071('0x27')](saveUpdates(_0x1a1a64['body'],null))[_0x3071('0x27')](respondWithResult(_0xa3a7ae,null))[_0x3071('0x3e')](handleError(_0xa3a7ae,null));};exports['destroy']=function(_0x44ad05,_0x5b1392){return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x44ad05['params']['id']}})['then'](handleEntityNotFound(_0x5b1392,null))[_0x3071('0x27')](removeEntity(_0x5b1392,null))[_0x3071('0x3e')](handleError(_0x5b1392,null));}; \ No newline at end of file +var _0xf4eb=['limit','count','Content-Range','json','apply','reject','save','then','destroy','error','name','send','params','keys','MailApplication','rawAttributes','query','filters','intersection','model','fields','attributes','includeAll','include','options','find','catch','body','eml-format','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined'];(function(_0x53acc9,_0x468a45){var _0x10cd02=function(_0x536b3f){while(--_0x536b3f){_0x53acc9['push'](_0x53acc9['shift']());}};_0x10cd02(++_0x468a45);}(_0xf4eb,0xec));var _0xbf4e=function(_0x228c72,_0x33dcf3){_0x228c72=_0x228c72-0x0;var _0xb6a4b3=_0xf4eb[_0x228c72];return _0xb6a4b3;};'use strict';var emlformat=require(_0xbf4e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbf4e('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbf4e('0x2'));var path=require(_0xbf4e('0x3'));var sox=require(_0xbf4e('0x4'));var csv=require(_0xbf4e('0x5'));var ejs=require(_0xbf4e('0x6'));var fs=require('fs');var fs_extra=require(_0xbf4e('0x7'));var _=require(_0xbf4e('0x8'));var squel=require('squel');var crypto=require(_0xbf4e('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf4e('0x5'));var querystring=require(_0xbf4e('0xa'));var Papa=require(_0xbf4e('0xb'));var Redis=require(_0xbf4e('0xc'));var authService=require(_0xbf4e('0xd'));var qs=require(_0xbf4e('0xe'));var as=require(_0xbf4e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf4e('0x10'));var utils=require('../../config/utils');var config=require(_0xbf4e('0x11'));var licenseUtil=require(_0xbf4e('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17fd01,_0x5a3035){_0x5a3035=_0x5a3035||0xcc;return function(_0x56d185){if(_0x56d185){return _0x17fd01[_0xbf4e('0x13')](_0x5a3035);}return _0x17fd01[_0xbf4e('0x14')](_0x5a3035)[_0xbf4e('0x15')]();};}function respondWithResult(_0x302841,_0x3b74bd){_0x3b74bd=_0x3b74bd||0xc8;return function(_0x61bd54){if(_0x61bd54){return _0x302841['status'](_0x3b74bd)['json'](_0x61bd54);}};}function respondWithFilteredResult(_0x180432,_0x1735ae){return function(_0x28fc6b){if(_0x28fc6b){var _0x542909=typeof _0x1735ae[_0xbf4e('0x16')]===_0xbf4e('0x17')&&typeof _0x1735ae[_0xbf4e('0x18')]===_0xbf4e('0x17');var _0x5a631e=_0x28fc6b[_0xbf4e('0x19')];var _0x577c27=_0x542909?0x0:_0x1735ae['offset'];var _0x566ec3=_0x542909?_0x28fc6b['count']:_0x1735ae[_0xbf4e('0x16')]+_0x1735ae[_0xbf4e('0x18')];var _0x1fc800;if(_0x566ec3>=_0x5a631e){_0x566ec3=_0x5a631e;_0x1fc800=0xc8;}else{_0x1fc800=0xce;}_0x180432['status'](_0x1fc800);return _0x180432['set'](_0xbf4e('0x1a'),_0x577c27+'-'+_0x566ec3+'/'+_0x5a631e)[_0xbf4e('0x1b')](_0x28fc6b);}return null;};}function patchUpdates(_0x3be138){return function(_0x3a875b){try{jsonpatch[_0xbf4e('0x1c')](_0x3a875b,_0x3be138,!![]);}catch(_0x1e2a68){return BPromise[_0xbf4e('0x1d')](_0x1e2a68);}return _0x3a875b[_0xbf4e('0x1e')]();};}function saveUpdates(_0xd09e12,_0x376832){return function(_0x30539b){if(_0x30539b){return _0x30539b['update'](_0xd09e12)[_0xbf4e('0x1f')](function(_0x2e7673){return _0x2e7673;});}return null;};}function removeEntity(_0x51648c,_0x31e3f5){return function(_0x30994d){if(_0x30994d){return _0x30994d[_0xbf4e('0x20')]()[_0xbf4e('0x1f')](function(){_0x51648c[_0xbf4e('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x90635e,_0x36688a){return function(_0x3d6863){if(!_0x3d6863){_0x90635e['sendStatus'](0x194);}return _0x3d6863;};}function handleError(_0x2fb490,_0x5e08b1){_0x5e08b1=_0x5e08b1||0x1f4;return function(_0x5bcf71){logger[_0xbf4e('0x21')](_0x5bcf71['stack']);if(_0x5bcf71[_0xbf4e('0x22')]){delete _0x5bcf71[_0xbf4e('0x22')];}_0x2fb490[_0xbf4e('0x14')](_0x5e08b1)[_0xbf4e('0x23')](_0x5bcf71);};}exports['show']=function(_0x2d4686,_0x8e0ab5){var _0x43879d={'raw':!![],'where':{'id':_0x2d4686[_0xbf4e('0x24')]['id']}},_0x4cd4a1={};_0x4cd4a1['model']=_[_0xbf4e('0x25')](db[_0xbf4e('0x26')][_0xbf4e('0x27')]);_0x4cd4a1['query']=_[_0xbf4e('0x25')](_0x2d4686[_0xbf4e('0x28')]);_0x4cd4a1[_0xbf4e('0x29')]=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],_0x4cd4a1[_0xbf4e('0x28')]);_0x43879d['attributes']=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],qs['fields'](_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2c')]));_0x43879d['attributes']=_0x43879d[_0xbf4e('0x2d')]['length']?_0x43879d[_0xbf4e('0x2d')]:_0x4cd4a1['model'];if(_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2e')]){_0x43879d[_0xbf4e('0x2f')]=[{'all':!![]}];}_0x43879d=_['merge']({},_0x43879d,_0x2d4686[_0xbf4e('0x30')]);return db[_0xbf4e('0x26')][_0xbf4e('0x31')](_0x43879d)[_0xbf4e('0x1f')](handleEntityNotFound(_0x8e0ab5,null))[_0xbf4e('0x1f')](respondWithResult(_0x8e0ab5,null))[_0xbf4e('0x32')](handleError(_0x8e0ab5,null));};exports['update']=function(_0x99b320,_0x3dbb2b){if(_0x99b320[_0xbf4e('0x33')]['id']){delete _0x99b320[_0xbf4e('0x33')]['id'];}return db[_0xbf4e('0x26')]['find']({'where':{'id':_0x99b320['params']['id']}})['then'](handleEntityNotFound(_0x3dbb2b,null))['then'](saveUpdates(_0x99b320[_0xbf4e('0x33')],null))[_0xbf4e('0x1f')](respondWithResult(_0x3dbb2b,null))[_0xbf4e('0x32')](handleError(_0x3dbb2b,null));};exports[_0xbf4e('0x20')]=function(_0x22ddde,_0x257b74){return db[_0xbf4e('0x26')][_0xbf4e('0x31')]({'where':{'id':_0x22ddde[_0xbf4e('0x24')]['id']}})['then'](handleEntityNotFound(_0x257b74,null))['then'](removeEntity(_0x257b74,null))[_0xbf4e('0x32')](handleError(_0x257b74,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 220b1aa..775fd01 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 _0x92f3=['rimraf','./mailApplication.attributes','mail_applications','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x92f3,0x19b));var _0x392f=function(_0x23cfd6,_0x2bd876){_0x23cfd6=_0x23cfd6-0x0;var _0x4a39ef=_0x92f3[_0x23cfd6];return _0x4a39ef;};'use strict';var _=require(_0x392f('0x0'));var util=require(_0x392f('0x1'));var logger=require(_0x392f('0x2'))(_0x392f('0x3'));var moment=require(_0x392f('0x4'));var BPromise=require(_0x392f('0x5'));var rp=require(_0x392f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x392f('0x7'));var config=require('../../config/environment');var attributes=require(_0x392f('0x8'));module['exports']=function(_0x48faa1,_0x419fb2){return _0x48faa1['define']('MailApplication',attributes,{'tableName':_0x392f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x392f('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xedee=['exports','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./mailApplication.attributes'];(function(_0x57cc22,_0x2d351f){var _0x6f7bdc=function(_0x4935b5){while(--_0x4935b5){_0x57cc22['push'](_0x57cc22['shift']());}};_0x6f7bdc(++_0x2d351f);}(_0xedee,0xe6));var _0xeede=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xedee[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xeede('0x0'));var util=require(_0xeede('0x1'));var logger=require(_0xeede('0x2'))(_0xeede('0x3'));var moment=require(_0xeede('0x4'));var BPromise=require(_0xeede('0x5'));var rp=require(_0xeede('0x6'));var fs=require('fs');var path=require(_0xeede('0x7'));var rimraf=require('rimraf');var config=require(_0xeede('0x8'));var attributes=require(_0xeede('0x9'));module[_0xeede('0xa')]=function(_0x2169cf,_0x21bb58){return _0x2169cf[_0xeede('0xb')](_0xeede('0xc'),attributes,{'tableName':_0xeede('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xeede('0xe'),'collate':_0xeede('0xf')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index b8a0f3b..1323197 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 _0x3369=['MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateMailApplication','MailApplication','update','options','where','attributes','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3cb9d8,_0x1654c2){var _0x3f1643=function(_0x51e974){while(--_0x51e974){_0x3cb9d8['push'](_0x3cb9d8['shift']());}};_0x3f1643(++_0x1654c2);}(_0x3369,0x1b0));var _0x9336=function(_0x2eda48,_0x1d2076){_0x2eda48=_0x2eda48-0x0;var _0x4dd763=_0x3369[_0x2eda48];return _0x4dd763;};'use strict';var _=require(_0x9336('0x0'));var util=require(_0x9336('0x1'));var moment=require(_0x9336('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9336('0x3'));var db=require(_0x9336('0x4'))['db'];var utils=require(_0x9336('0x5'));var logger=require(_0x9336('0x6'))(_0x9336('0x7'));var config=require(_0x9336('0x8'));var jayson=require(_0x9336('0x9'));var client=jayson[_0x9336('0xa')][_0x9336('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d5d1b,_0x466d01,_0x240206){return new BPromise(function(_0x5e0090,_0xe36d40){return client[_0x9336('0xc')](_0x2d5d1b,_0x240206)[_0x9336('0xd')](function(_0xa123ba){logger[_0x9336('0xe')](_0x9336('0xf'),_0x466d01,_0x9336('0x10'));logger[_0x9336('0x11')](_0x9336('0x12'),_0x466d01,_0x9336('0x10'),JSON[_0x9336('0x13')](_0xa123ba));if(_0xa123ba[_0x9336('0x14')]){if(_0xa123ba['error'][_0x9336('0x15')]===0x1f4){logger[_0x9336('0x14')](_0x9336('0xf'),_0x466d01,_0xa123ba[_0x9336('0x14')][_0x9336('0x16')]);return _0xe36d40(_0xa123ba['error'][_0x9336('0x16')]);}logger[_0x9336('0x14')]('MailApplication,\x20%s,\x20%s',_0x466d01,_0xa123ba[_0x9336('0x14')][_0x9336('0x16')]);return _0x5e0090(_0xa123ba[_0x9336('0x14')]['message']);}else{logger[_0x9336('0xe')](_0x9336('0xf'),_0x466d01,_0x9336('0x10'));_0x5e0090(_0xa123ba['result'][_0x9336('0x16')]);}})[_0x9336('0x17')](function(_0x27577f){logger[_0x9336('0x14')]('MailApplication,\x20%s,\x20%s',_0x466d01,_0x27577f);_0xe36d40(_0x27577f);});});}exports[_0x9336('0x18')]=function(_0x532fd9){var _0x4e862a=this;return new Promise(function(_0x55d949,_0x58439f){return db[_0x9336('0x19')][_0x9336('0x1a')](_0x532fd9['body'],{'raw':_0x532fd9[_0x9336('0x1b')]?_0x532fd9[_0x9336('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x532fd9[_0x9336('0x1b')]?_0x532fd9['options'][_0x9336('0x1c')]||null:null,'attributes':_0x532fd9[_0x9336('0x1b')]?_0x532fd9[_0x9336('0x1b')][_0x9336('0x1d')]||null:null,'limit':_0x532fd9['options']?_0x532fd9[_0x9336('0x1b')]['limit']||null:null})[_0x9336('0xd')](function(_0x3cd42c){logger['info'](_0x9336('0x18'),_0x532fd9);logger[_0x9336('0x11')](_0x9336('0x18'),_0x532fd9,JSON[_0x9336('0x13')](_0x3cd42c));_0x55d949(_0x3cd42c);})[_0x9336('0x17')](function(_0x21b08b){logger[_0x9336('0x14')](_0x9336('0x18'),_0x21b08b['message'],_0x532fd9);_0x58439f(_0x4e862a[_0x9336('0x14')](0x1f4,_0x21b08b['message']));});});}; \ No newline at end of file +var _0x66d8=['../../config/logger','../../config/environment','jayson/promise','request','then','info','MailApplication,\x20%s,\x20%s','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','UpdateMailApplication','update','body','options','raw','where','attributes','limit','debug','stringify','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x55199d,_0x523eba){var _0x2fab38=function(_0x50096e){while(--_0x50096e){_0x55199d['push'](_0x55199d['shift']());}};_0x2fab38(++_0x523eba);}(_0x66d8,0x143));var _0x866d=function(_0x1f504c,_0x319b4f){_0x1f504c=_0x1f504c-0x0;var _0x50d2e6=_0x66d8[_0x1f504c];return _0x50d2e6;};'use strict';var _=require(_0x866d('0x0'));var util=require(_0x866d('0x1'));var moment=require(_0x866d('0x2'));var BPromise=require(_0x866d('0x3'));var rs=require(_0x866d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x866d('0x5'))['db'];var utils=require(_0x866d('0x6'));var logger=require(_0x866d('0x7'))('rpc');var config=require(_0x866d('0x8'));var jayson=require(_0x866d('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xdff860,_0x1e638f,_0x4fb988){return new BPromise(function(_0x49e198,_0x19d742){return client[_0x866d('0xa')](_0xdff860,_0x4fb988)[_0x866d('0xb')](function(_0x10ff87){logger[_0x866d('0xc')](_0x866d('0xd'),_0x1e638f,'request\x20sent');logger['debug'](_0x866d('0xe'),_0x1e638f,_0x866d('0xf'),JSON['stringify'](_0x10ff87));if(_0x10ff87['error']){if(_0x10ff87[_0x866d('0x10')]['code']===0x1f4){logger[_0x866d('0x10')](_0x866d('0xd'),_0x1e638f,_0x10ff87[_0x866d('0x10')][_0x866d('0x11')]);return _0x19d742(_0x10ff87['error'][_0x866d('0x11')]);}logger[_0x866d('0x10')](_0x866d('0xd'),_0x1e638f,_0x10ff87[_0x866d('0x10')][_0x866d('0x11')]);return _0x49e198(_0x10ff87[_0x866d('0x10')][_0x866d('0x11')]);}else{logger[_0x866d('0xc')](_0x866d('0xd'),_0x1e638f,'request\x20sent');_0x49e198(_0x10ff87[_0x866d('0x12')]['message']);}})['catch'](function(_0xa16291){logger[_0x866d('0x10')](_0x866d('0xd'),_0x1e638f,_0xa16291);_0x19d742(_0xa16291);});});}exports[_0x866d('0x13')]=function(_0x5e4a99){var _0x4d9b98=this;return new Promise(function(_0x53dcf0,_0x22b297){return db['MailApplication'][_0x866d('0x14')](_0x5e4a99[_0x866d('0x15')],{'raw':_0x5e4a99[_0x866d('0x16')]?_0x5e4a99[_0x866d('0x16')][_0x866d('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e4a99[_0x866d('0x16')]?_0x5e4a99[_0x866d('0x16')][_0x866d('0x18')]||null:null,'attributes':_0x5e4a99[_0x866d('0x16')]?_0x5e4a99[_0x866d('0x16')][_0x866d('0x19')]||null:null,'limit':_0x5e4a99[_0x866d('0x16')]?_0x5e4a99[_0x866d('0x16')][_0x866d('0x1a')]||null:null})[_0x866d('0xb')](function(_0x288870){logger[_0x866d('0xc')]('UpdateMailApplication',_0x5e4a99);logger[_0x866d('0x1b')](_0x866d('0x13'),_0x5e4a99,JSON[_0x866d('0x1c')](_0x288870));_0x53dcf0(_0x288870);})[_0x866d('0x1d')](function(_0x458f1a){logger['error'](_0x866d('0x13'),_0x458f1a[_0x866d('0x11')],_0x5e4a99);_0x22b297(_0x4d9b98[_0x866d('0x10')](0x1f4,_0x458f1a['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 454f163..a6ab35d 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 _0x6a4a=['mail','update','delete','mailinteraction:destroy','destroy','express','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','addTags','put'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6a4a,0xe6));var _0xa6a4=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0x6a4a[_0x1cfa0d];return _0xe33279;};'use strict';var express=require(_0xa6a4('0x0'));var router=express['Router']();var auth=require(_0xa6a4('0x1'));var interaction=require(_0xa6a4('0x2'));var controller=require(_0xa6a4('0x3'));router[_0xa6a4('0x4')]('/',auth[_0xa6a4('0x5')](),controller['index']);router['get']('/describe',auth[_0xa6a4('0x5')](),controller[_0xa6a4('0x6')]);router['get'](_0xa6a4('0x7'),auth['isAuthenticated'](),controller[_0xa6a4('0x8')]);router[_0xa6a4('0x4')](_0xa6a4('0x9'),auth['isAuthenticated'](),controller[_0xa6a4('0xa')]);router['get'](_0xa6a4('0xb'),auth[_0xa6a4('0x5')](),controller[_0xa6a4('0xc')]);router['post']('/',auth[_0xa6a4('0x5')](),controller[_0xa6a4('0xd')]);router[_0xa6a4('0xe')](_0xa6a4('0x9'),auth['isAuthenticated'](),controller[_0xa6a4('0xf')]);router[_0xa6a4('0xe')](_0xa6a4('0x10'),auth[_0xa6a4('0x5')](),interaction[_0xa6a4('0x11')]('mail','mailinteraction:addtags'),controller[_0xa6a4('0x12')]);router[_0xa6a4('0x13')](_0xa6a4('0x7'),auth[_0xa6a4('0x5')](),interaction[_0xa6a4('0x11')](_0xa6a4('0x14'),'mailinteraction:update'),controller[_0xa6a4('0x15')]);router[_0xa6a4('0x16')]('/:id',auth[_0xa6a4('0x5')](),interaction[_0xa6a4('0x11')](_0xa6a4('0x14'),_0xa6a4('0x17')),controller[_0xa6a4('0x18')]);router[_0xa6a4('0x16')]('/:id/tags',auth[_0xa6a4('0x5')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0x563d=['removeTags','express','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','isAuthenticated','index','/describe','describe','get','/:id','show','getMessages','download','post','/:id/messages','addMessage','mail','mailinteraction:addtags','addTags','put','update','delete','destroy'];(function(_0x1e5209,_0x141671){var _0x19e089=function(_0x5281e9){while(--_0x5281e9){_0x1e5209['push'](_0x1e5209['shift']());}};_0x19e089(++_0x141671);}(_0x563d,0x1b1));var _0xd563=function(_0x531cb8,_0x8ef36f){_0x531cb8=_0x531cb8-0x0;var _0x5cf297=_0x563d[_0x531cb8];return _0x5cf297;};'use strict';var express=require(_0xd563('0x0'));var router=express['Router']();var auth=require(_0xd563('0x1'));var interaction=require(_0xd563('0x2'));var controller=require(_0xd563('0x3'));router['get']('/',auth[_0xd563('0x4')](),controller[_0xd563('0x5')]);router['get'](_0xd563('0x6'),auth[_0xd563('0x4')](),controller[_0xd563('0x7')]);router[_0xd563('0x8')](_0xd563('0x9'),auth['isAuthenticated'](),controller[_0xd563('0xa')]);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0xd563('0xb')]);router[_0xd563('0x8')]('/:id/download',auth[_0xd563('0x4')](),controller[_0xd563('0xc')]);router[_0xd563('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd563('0xd')](_0xd563('0xe'),auth[_0xd563('0x4')](),controller[_0xd563('0xf')]);router[_0xd563('0xd')]('/:id/tags',auth[_0xd563('0x4')](),interaction['tracked'](_0xd563('0x10'),_0xd563('0x11')),controller[_0xd563('0x12')]);router[_0xd563('0x13')](_0xd563('0x9'),auth[_0xd563('0x4')](),interaction['tracked'](_0xd563('0x10'),'mailinteraction:update'),controller[_0xd563('0x14')]);router[_0xd563('0x15')]('/:id',auth[_0xd563('0x4')](),interaction['tracked'](_0xd563('0x10'),'mailinteraction:destroy'),controller[_0xd563('0x16')]);router[_0xd563('0x15')]('/:id/tags',auth['isAuthenticated'](),controller[_0xd563('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 0bf8bea..2191a06 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 _0x5e44=['STRING','TEXT','long','ENUM','out','BOOLEAN','sequelize','iconv','DATE'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5e44,0x192));var _0x45e4=function(_0x6e8daf,_0x48005e){_0x6e8daf=_0x6e8daf-0x0;var _0x417e01=_0x5e44[_0x6e8daf];return _0x417e01;};'use strict';var Sequelize=require(_0x45e4('0x0'));var iconv=require(_0x45e4('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x45e4('0x2')]},'disposition':{'type':Sequelize[_0x45e4('0x3')]},'secondDisposition':{'type':Sequelize[_0x45e4('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x45e4('0x3')]},'inReplyTo':{'type':Sequelize[_0x45e4('0x3')](0x1fe)},'to':{'type':Sequelize[_0x45e4('0x3')]},'cc':{'type':Sequelize[_0x45e4('0x4')](_0x45e4('0x5'))},'subject':{'type':Sequelize[_0x45e4('0x4')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x45e4('0x2')]},'substatus':{'type':Sequelize[_0x45e4('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0x45e4('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x45e4('0x6')]('in',_0x45e4('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x45e4('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x45e4('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x45e4('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x1235=['out','sequelize','BOOLEAN','DATE','STRING','TEXT','long','ENUM'];(function(_0x17723c,_0x1ea81d){var _0x1ffbf3=function(_0x5276cd){while(--_0x5276cd){_0x17723c['push'](_0x17723c['shift']());}};_0x1ffbf3(++_0x1ea81d);}(_0x1235,0x71));var _0x5123=function(_0x4931da,_0xab00f5){_0x4931da=_0x4931da-0x0;var _0x243bb8=_0x1235[_0x4931da];return _0x243bb8;};'use strict';var Sequelize=require(_0x5123('0x0'));var iconv=require('iconv');module['exports']={'closed':{'type':Sequelize[_0x5123('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5123('0x2')]},'disposition':{'type':Sequelize[_0x5123('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x5123('0x3')]},'cc':{'type':Sequelize[_0x5123('0x4')](_0x5123('0x5'))},'subject':{'type':Sequelize[_0x5123('0x4')]()},'attach':{'type':Sequelize[_0x5123('0x1')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x5123('0x2')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x5123('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x5123('0x6')]('in',_0x5123('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x5123('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x5123('0x6')]('in',_0x5123('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x5123('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 4764ae2..a9fa4cc 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 _0xb10b=['Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','findOne','enableEmailPreview','show','params','rawAttributes','includeAll','include','merge','options','create','body','describe','addMessage','ids','omit','getMessages','nolimit','pick','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','rows','spread','emit','mailInteractionTags:save','removeTags','download','unix','join','server','tmp','root','files','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','subject','get','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','existsSync','build','message%d.eml','unlinkSync','eml-format','zip-dir','moment','bluebird','path','lodash','squel','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','error','stack','name','send','fullname','TagIds','Tags','split','forEach','push','MailMessage','out','-id','trimStart','plainBody','catch','index','map','MailInteraction','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','field','color','tools_tags','u.id','ui.MailInteractionId','from','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','select','mail_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','expr','search','parseSearch','conditions','length','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','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','start','some','compact','isEmpty','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','isEmail','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','role','getMailAccounts','i.MailAccountId\x20IS\x20NULL','agent','toString','sequelize','keyBy','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.createdAt','i.updatedAt','i.closed','i.attach','i.lastMsgAt','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.ContactId','i.MailAccountId','Contact.firstName','c.email'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xb10b,0x12a));var _0xbb10=function(_0x193461,_0x42ce71){_0x193461=_0x193461-0x0;var _0x4c237c=_0xb10b[_0x193461];return _0x4c237c;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var BPromise=require(_0xbb10('0x3'));var util=require('util');var path=require(_0xbb10('0x4'));var fs=require('fs');var _=require(_0xbb10('0x5'));var squel=require(_0xbb10('0x6'));var juice=require(_0xbb10('0x7'));var Redis=require(_0xbb10('0x8'));var qs=require(_0xbb10('0x9'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0xbb10('0xa'))(_0xbb10('0xb'));var config=require('../../config/environment');var db=require(_0xbb10('0xc'))['db'];config[_0xbb10('0xd')]=_[_0xbb10('0xe')](config[_0xbb10('0xd')],{'host':_0xbb10('0xf'),'port':0x18eb});var socket=require(_0xbb10('0x10'))(new Redis(config[_0xbb10('0xd')]));require(_0xbb10('0x11'))['register'](socket);function respondWithStatusCode(_0x4e47f8,_0x20bd61){_0x20bd61=_0x20bd61||0xcc;return function(_0x118a74){if(_0x118a74){return _0x4e47f8[_0xbb10('0x12')](_0x20bd61);}return _0x4e47f8['status'](_0x20bd61)[_0xbb10('0x13')]();};}function respondWithResult(_0x5be7e0,_0x44fb19){_0x44fb19=_0x44fb19||0xc8;return function(_0x916a32){if(_0x916a32){return _0x5be7e0[_0xbb10('0x14')](_0x44fb19)[_0xbb10('0x15')](_0x916a32);}};}function respondWithFilteredResult(_0x442548,_0x147230){return function(_0x58a612){if(_0x58a612){var _0x26e021=typeof _0x147230[_0xbb10('0x16')]===_0xbb10('0x17')&&typeof _0x147230[_0xbb10('0x18')]===_0xbb10('0x17');var _0x2f2ebf=_0x58a612[_0xbb10('0x19')];var _0x36b5e8=_0x26e021?0x0:_0x147230[_0xbb10('0x16')];var _0x2b184e=_0x26e021?_0x58a612['count']:_0x147230[_0xbb10('0x16')]+_0x147230[_0xbb10('0x18')];var _0x133ac2;if(_0x2b184e>=_0x2f2ebf){_0x2b184e=_0x2f2ebf;_0x133ac2=0xc8;}else{_0x133ac2=0xce;}_0x442548[_0xbb10('0x14')](_0x133ac2);return _0x442548[_0xbb10('0x1a')](_0xbb10('0x1b'),_0x36b5e8+'-'+_0x2b184e+'/'+_0x2f2ebf)[_0xbb10('0x15')](_0x58a612);}return null;};}function saveUpdates(_0x30efc6){return function(_0xbf2906){if(_0xbf2906){return _0xbf2906[_0xbb10('0x1c')](_0x30efc6)['then'](function(_0x5ff0cf){return _0x5ff0cf;});}return null;};}function removeEntity(_0x19f48d){return function(_0x388fab){if(_0x388fab){return _0x388fab[_0xbb10('0x1d')]()[_0xbb10('0x1e')](function(){_0x19f48d[_0xbb10('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12f888){return function(_0x12ef77){if(!_0x12ef77){_0x12f888['sendStatus'](0x194);}return _0x12ef77;};}function handleError(_0x4c4b0d,_0x8e2b97){_0x8e2b97=_0x8e2b97||0x1f4;return function(_0x311abe){logger[_0xbb10('0x1f')](_0x311abe[_0xbb10('0x20')]);if(_0x311abe[_0xbb10('0x21')]){delete _0x311abe[_0xbb10('0x21')];}_0x4c4b0d[_0xbb10('0x14')](_0x8e2b97)[_0xbb10('0x22')](_0x311abe);};}function getInteractionUsers(_0x7f2377,_0x395404){return new BPromise(function(_0x3ba6cd,_0x26ad93){try{if(_0x395404[_0x7f2377['id']]){_0x7f2377['Users']=_['map'](_0x395404[_0x7f2377['id']],function(_0x4fb5e0){return{'id':_0x4fb5e0['id'],'fullname':_0x4fb5e0[_0xbb10('0x23')]};});}}catch(_0x3c5ae7){_0x26ad93(_0x3c5ae7);}_0x3ba6cd(_0x7f2377);});}function getInteractionTags(_0x2c89b9,_0x4e25ff){return new BPromise(function(_0x2fdde9,_0x24d586){try{if(_0x2c89b9[_0xbb10('0x24')]){_0x2c89b9[_0xbb10('0x25')]=[];_0x2c89b9[_0xbb10('0x24')][_0xbb10('0x26')](',')[_0xbb10('0x27')](function(_0x4aabb9){_0x2c89b9[_0xbb10('0x25')][_0xbb10('0x28')](_0x4e25ff[_0x4aabb9]);});}delete _0x2c89b9[_0xbb10('0x24')];}catch(_0x2e0249){_0x24d586(_0x2e0249);}_0x2fdde9(_0x2c89b9);});}function getLastMessageText(_0x1d30aa){return new BPromise(function(_0x2ff4c1,_0x5d5c80){return db[_0xbb10('0x29')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x1d30aa['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xbb10('0x2a')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0xbb10('0x2b'),'raw':!![]})[_0xbb10('0x1e')](function(_0x1b59f9){if(_0x1b59f9&&_0x1b59f9['plainBody']){_0x1d30aa['lastMsgText']=_[_0xbb10('0x2c')](_0x1b59f9[_0xbb10('0x2d')]);}_0x2ff4c1(_0x1d30aa);})['catch'](function(_0x359ad4){_0x5d5c80(_0x359ad4);});});}function updateMailInteraction(_0x37dde7,_0x2f653f,_0x1c0b57,_0x37a83f){return new BPromise(function(_0x138bc6,_0xf85197){return getInteractionUsers(_0x37dde7,_0x1c0b57)['then'](function(_0x25acb3){return getInteractionTags(_0x25acb3,_0x2f653f);})[_0xbb10('0x1e')](function(_0x441d15){if(_0x37a83f){_0x138bc6(getLastMessageText(_0x441d15));}else{_0x138bc6(_0x441d15);}})[_0xbb10('0x2e')](function(_0xfb2c5e){_0xf85197(_0xfb2c5e);});});}exports[_0xbb10('0x2f')]=function(_0x188cbd,_0x10202c){var _0x3c8d7d={},_0x56943c={},_0x2b5352={'count':0x0,'rows':[]};var _0x150107=_[_0xbb10('0x30')](db[_0xbb10('0x31')]['rawAttributes'],function(_0x111762){return{'name':_0x111762['fieldName'],'type':_0x111762['type'][_0xbb10('0x32')]};});_0x56943c[_0xbb10('0x33')]=_[_0xbb10('0x30')](_0x150107,_0xbb10('0x21'));_0x56943c[_0xbb10('0x34')]=_[_0xbb10('0x35')](_0x188cbd['query']);_0x56943c[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x56943c['model'],_0x56943c['query']);_0x3c8d7d['attributes']=_[_0xbb10('0x37')](_0x56943c[_0xbb10('0x33')],qs[_0xbb10('0x38')](_0x188cbd['query'][_0xbb10('0x38')]));_0x3c8d7d[_0xbb10('0x39')]=_0x3c8d7d[_0xbb10('0x39')]['length']?_0x3c8d7d[_0xbb10('0x39')]:_0x56943c[_0xbb10('0x33')];if(!_0x188cbd[_0xbb10('0x34')][_0xbb10('0x3a')]('nolimit')){_0x3c8d7d[_0xbb10('0x18')]=qs[_0xbb10('0x18')](_0x188cbd['query'][_0xbb10('0x18')]);_0x3c8d7d[_0xbb10('0x16')]=qs[_0xbb10('0x16')](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x16')]);}_0x3c8d7d[_0xbb10('0x3b')]=qs['sort'](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x3c')]);_0x3c8d7d[_0xbb10('0x3d')]=qs[_0xbb10('0x36')](_['pick'](_0x188cbd[_0xbb10('0x34')],_0x56943c[_0xbb10('0x36')]),_0x150107);var _0x23dc18=[];var _0x403beb=squel['select']()[_0xbb10('0x3e')]('id')[_0xbb10('0x3e')]('name')['field'](_0xbb10('0x3f'))['from'](_0xbb10('0x40'));var _0x180933=squel['select']()[_0xbb10('0x3e')](_0xbb10('0x41'))[_0xbb10('0x3e')]('u.fullname')[_0xbb10('0x3e')](_0xbb10('0x42'))[_0xbb10('0x43')](_0xbb10('0x44'),'ui')[_0xbb10('0x45')](_0xbb10('0x46'),'u',_0xbb10('0x47'));var _0x3efa96=squel[_0xbb10('0x48')]()[_0xbb10('0x43')](_0xbb10('0x49'),'i')[_0xbb10('0x45')]('cm_contacts','c',_0xbb10('0x4a'))[_0xbb10('0x45')]('users','o',_0xbb10('0x4b'))[_0xbb10('0x45')](_0xbb10('0x4c'),'a',_0xbb10('0x4d'))[_0xbb10('0x45')](_0xbb10('0x4e'),'me',_0xbb10('0x4f'))['left_join']('mail_interaction_has_tags','it',_0xbb10('0x50'))[_0xbb10('0x45')](_0xbb10('0x40'),'t','t.id\x20=\x20it.TagId');var _0x5f0c12=squel[_0xbb10('0x51')]();var _0x34cf4e=[];var _0x1bd054=squel[_0xbb10('0x51')]();var _0x10159b;if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x52')]){_0x10159b=as[_0xbb10('0x53')](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x52')]);var _0x550111=_0x10159b['sqlOperator'];for(var _0x412e13=0x0;_0x412e13<_0x10159b[_0xbb10('0x54')][_0xbb10('0x55')];_0x412e13++){var _0xb014b0=_0x10159b[_0xbb10('0x54')][_0x412e13];var _0x440f9e='i';var _0x358e7e=_[_0xbb10('0x56')](_0x150107,[_0xbb10('0x21'),_0xb014b0[_0xbb10('0x3e')]]);if(!_0x358e7e){switch(_0xb014b0[_0xbb10('0x3e')]){case _0xbb10('0x57'):if(_0xb014b0[_0xbb10('0x58')]==0x1){_0x3efa96[_0xbb10('0x59')]('`'+_0xb014b0[_0xbb10('0x3e')]+'`\x20=\x200');}else{_0x3efa96[_0xbb10('0x59')]('`'+_0xb014b0['field']+_0xbb10('0x5a'));}break;case _0xbb10('0x5b'):if(_0xb014b0[_0xbb10('0x5c')]===_0xbb10('0x5d')){if(_0xb014b0[_0xbb10('0x58')][_0xbb10('0x26')]('\x20')[_0xbb10('0x55')]>0x1){_0x5f0c12[_0x550111](_0xbb10('0x5e'),qs[_0xbb10('0x5f')](_0xb014b0[_0xbb10('0x58')]),null);}else{var _0x44a056='%'+_0xb014b0[_0xbb10('0x58')]+'%';_0x5f0c12[_0x550111](_0xbb10('0x60'),_0x44a056,_0x44a056,_0x44a056);}}else{_0x358e7e=_[_0xbb10('0x56')](_0x150107,[_0xbb10('0x21'),'ContactId']);_0xb014b0[_0xbb10('0x3e')]=_0xbb10('0x61');_0x155dc5=as[_0xbb10('0x62')](_0x440f9e,_0x358e7e[_0xbb10('0x63')],_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5[_0xbb10('0x64')],_0x155dc5[_0xbb10('0x58')]['start'],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x13')]);}break;case _0xbb10('0x65'):var _0x14fed3=_0xb014b0[_0xbb10('0x58')][_0xbb10('0x26')](',')[_0xbb10('0x30')](function(_0x12ec18){return Number(_0x12ec18);});_0x14fed3[_0xbb10('0x27')](function(_0x40c4fb){_0x1bd054['or'](_0xbb10('0x66'),'%,'+_0x40c4fb+',%');});_0x34cf4e=_[_0xbb10('0x67')](_0x34cf4e,_0x14fed3);break;case _0xbb10('0x68'):if(_0xb014b0['operator']==='$substring'){_0x5f0c12[_0x550111](_0xbb10('0x69'),'%'+_0xb014b0[_0xbb10('0x58')]+'%',null);}else{_0x358e7e=_[_0xbb10('0x56')](_0x150107,[_0xbb10('0x21'),'UserId']);_0xb014b0['field']=_0xbb10('0x6a');_0x155dc5=as[_0xbb10('0x62')](_0x440f9e,_0x358e7e[_0xbb10('0x63')],_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5[_0xbb10('0x64')],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x6b')],_0x155dc5[_0xbb10('0x58')]['end']);}break;case _0xbb10('0x2d'):_0x155dc5=as[_0xbb10('0x62')]('me',null,_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5['text'],_0x155dc5['value']['start'],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x13')]);break;}}else{var _0x155dc5=as['buildExpression'](_0x440f9e,_0x358e7e['type'],_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5['text'],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x6b')],_0x155dc5[_0xbb10('0x58')]['end']);}}}else{var _0xa1bbd9=_(_0x188cbd[_0xbb10('0x34')])['keys']()['map'](function(_0x27d7b9){return _[_0xbb10('0x6c')](_0x150107,[_0xbb10('0x21'),_0x27d7b9])?_0x27d7b9:undefined;})[_0xbb10('0x6d')]()['value']();if(!_[_0xbb10('0x6e')](_0xa1bbd9)){_0xa1bbd9[_0xbb10('0x27')](function(_0xa7179d){if(_0xa7179d==='MailAccountId'){_0x3efa96[_0xbb10('0x3d')](_0xbb10('0x6f'),[][_0xbb10('0x70')](_0x188cbd['query'][_0xa7179d]));}else if(_0xa7179d===_0xbb10('0x71')){var _0x31e85e=JSON[_0xbb10('0x72')](_0x188cbd[_0xbb10('0x34')][_0xa7179d])['$gte'];var _0x251417=JSON[_0xbb10('0x72')](_0x188cbd[_0xbb10('0x34')][_0xa7179d])[_0xbb10('0x73')];_0x3efa96['where'](_0xbb10('0x74'),_0x31e85e,_0x251417);}else{if(_0x188cbd[_0xbb10('0x34')][_0xa7179d]===_0xbb10('0x75')){_0x3efa96[_0xbb10('0x3d')]('i.'+_0xa7179d+_0xbb10('0x76'));}else{_0x3efa96[_0xbb10('0x3d')]('i.'+_0xa7179d+_0xbb10('0x77'),_0x188cbd['query'][_0xa7179d]);}}});}if(_0x188cbd['query']['read']){if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x78')]==0x1){_0x3efa96[_0xbb10('0x59')]('`unreadMessages`\x20=\x200');}else{_0x3efa96['having'](_0xbb10('0x79'));}}if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7a')]){_0x34cf4e=_[_0xbb10('0x7b')](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7a')])?_0x188cbd['query'][_0xbb10('0x7a')]:new Array(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7a')]);_0x34cf4e[_0xbb10('0x27')](function(_0x2aaaa6){_0x1bd054['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2aaaa6+',%');});}if(_0x188cbd['query']['filter']){var _0x329da7=_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7c')][_0xbb10('0x7d')]('\x5c','\x5c\x5c')[_0xbb10('0x7d')](/'/g,'\x27\x27');if(qs[_0xbb10('0x7e')](_0x329da7)){_0x5f0c12['or']('i.id\x20LIKE\x20?',_0x329da7+'%');}else if(qs[_0xbb10('0x7f')](_0x329da7)){_0x5f0c12['or']('c.email\x20LIKE\x20?',_0x329da7+'%');}else{_0x5f0c12['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x329da7))['or'](_0xbb10('0x80'),qs[_0xbb10('0x5f')](_0x329da7));}}}_0x3efa96[_0xbb10('0x3d')](_0x5f0c12);_0x3efa96[_0xbb10('0x81')]('i.id');var _0x122d38={'type':db['Sequelize']['QueryTypes'][_0xbb10('0x82')],'raw':!![]};var _0xfe3db0=_0x3efa96[_0xbb10('0x83')]();_0xfe3db0[_0xbb10('0x3e')](_0xbb10('0x84'));_0xfe3db0['field'](_0xbb10('0x85'),_0xbb10('0x57'));if(_0x3c8d7d[_0xbb10('0x3b')]){_0x3c8d7d[_0xbb10('0x3b')][_0xbb10('0x27')](function(_0x27f42f){var _0x174395=_0x27f42f[0x0]==='contactName'?_0x27f42f[0x0]:'i.'+_0x27f42f[0x0];_0x3efa96[_0xbb10('0x3b')](_0x174395,_0x27f42f[0x1]===_0xbb10('0x86')?![]:!![]);});}if(!_[_0xbb10('0x6e')](_0x34cf4e)){_0x3efa96[_0xbb10('0x59')](_0x1bd054);_0xfe3db0[_0xbb10('0x3d')](_0xbb10('0x87'),_0x34cf4e);}BPromise[_0xbb10('0x88')]()[_0xbb10('0x1e')](function(){if(!_0x10159b){if(_0x188cbd['query'][_0xbb10('0x89')])return;_0xfe3db0[_0xbb10('0x3d')](_0xbb10('0x8a'));_0x3efa96['where']('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x188cbd['user'][_0xbb10('0x8b')]!=='agent')return;return _0x188cbd['user'][_0xbb10('0x8c')]({'attributes':['id'],'raw':!![]})[_0xbb10('0x1e')](function(_0x33ff06){if(_[_0xbb10('0x6e')](_0x33ff06)){_0xfe3db0[_0xbb10('0x3d')](_0xbb10('0x8d'));_0x3efa96[_0xbb10('0x3d')](_0xbb10('0x8d'));}else{_0xfe3db0[_0xbb10('0x3d')]('i.MailAccountId\x20IN\x20?',_[_0xbb10('0x30')](_0x33ff06,'id'));_0x3efa96[_0xbb10('0x3d')](_0xbb10('0x6f'),_[_0xbb10('0x30')](_0x33ff06,'id'));}});})['then'](function(){if(_0x188cbd['user'][_0xbb10('0x8b')]===_0xbb10('0x8e')&&!_0x10159b&&!_0x188cbd[_0xbb10('0x34')][_0xbb10('0x89')])return[];return db['sequelize'][_0xbb10('0x34')](_0xfe3db0[_0xbb10('0x8f')](),_0x122d38);})[_0xbb10('0x1e')](function(_0xf7b3e1){_0x2b5352[_0xbb10('0x19')]=_0xf7b3e1['length'];if(_0x2b5352['count']===0x0)return[];return db[_0xbb10('0x90')][_0xbb10('0x34')](_0x403beb[_0xbb10('0x8f')](),_0x122d38)['then'](function(_0x256b35){_0x23dc18=_[_0xbb10('0x91')](_0x256b35,'id');_0x122d38=_['merge'](_0x122d38,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x38')]){_0x3c8d7d[_0xbb10('0x39')]['forEach'](function(_0x32d5a5){_0x3efa96[_0xbb10('0x3e')]('i.'+_0x32d5a5);});}else{_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x85'),_0xbb10('0x57'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x92'),_0xbb10('0x93'));_0x3efa96[_0xbb10('0x3e')]('a.mandatoryDisposition',_0xbb10('0x94'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x95'),_0xbb10('0x96'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x84'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x97'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x98'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x99'));_0x3efa96['field']('i.closedAt');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9a'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9b'));_0x3efa96[_0xbb10('0x3e')]('i.lastMsgDirection');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9c'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9d'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9e'));_0x3efa96['field'](_0xbb10('0x9f'));_0x3efa96[_0xbb10('0x3e')]('i.substatus');_0x3efa96[_0xbb10('0x3e')]('i.to');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa0'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa1'));_0x3efa96[_0xbb10('0x3e')]('i.UserId');_0x3efa96[_0xbb10('0x3e')]('c.firstName',_0xbb10('0xa2'));_0x3efa96[_0xbb10('0x3e')]('c.lastName','Contact.lastName');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa3'),_0xbb10('0xa4'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa5'),_0xbb10('0xa6'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa7'),_0xbb10('0xa8'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa9'),'Contact.fax');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xaa'),_0xbb10('0xab'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xac'),_0xbb10('0xad'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xae'),_0xbb10('0x24'));}if(_0x3c8d7d[_0xbb10('0x18')])_0x3efa96[_0xbb10('0x18')](_0x3c8d7d[_0xbb10('0x18')]);if(_0x3c8d7d['offset'])_0x3efa96[_0xbb10('0x16')](_0x3c8d7d['offset']);return db[_0xbb10('0x90')][_0xbb10('0x34')](_0x3efa96[_0xbb10('0x8f')](),_0x122d38);})[_0xbb10('0x1e')](function(_0x38d369){if(_0x38d369['length']>0x0)_0x180933[_0xbb10('0x3d')](_0xbb10('0xaf'),_[_0xbb10('0x30')](_0x38d369,'id'));return db[_0xbb10('0x90')][_0xbb10('0x34')](_0x180933[_0xbb10('0x8f')](),_0x122d38)['then'](function(_0x4bd470){var _0x5cc9d7=_[_0xbb10('0xb0')](_0x4bd470,_0xbb10('0xb1'));var _0x57d5a1=[];return db[_0xbb10('0xb2')][_0xbb10('0xb3')]({'attributes':['enableEmailPreview'],'raw':!![]})[_0xbb10('0x1e')](function(_0xaede56){var _0x5642c3=_0xaede56[_0xbb10('0xb4')];_0x38d369['forEach'](function(_0x34cec7){_0x57d5a1[_0xbb10('0x28')](updateMailInteraction(_0x34cec7,_0x23dc18,_0x5cc9d7,_0x5642c3));});return BPromise['all'](_0x57d5a1);});});});})[_0xbb10('0x1e')](function(_0x28cc74){_0x2b5352['rows']=_0x28cc74;return _0x2b5352;})['then'](respondWithFilteredResult(_0x10202c,_0x3c8d7d))[_0xbb10('0x2e')](handleError(_0x10202c,null));};exports[_0xbb10('0xb5')]=function(_0x3e0e34,_0x3299bc){var _0x3ceb77={'raw':![],'where':{'id':_0x3e0e34[_0xbb10('0xb6')]['id']}},_0x4c3bdc={};_0x4c3bdc[_0xbb10('0x33')]=_[_0xbb10('0x35')](db['MailInteraction'][_0xbb10('0xb7')]);_0x4c3bdc[_0xbb10('0x34')]=_[_0xbb10('0x35')](_0x3e0e34[_0xbb10('0x34')]);_0x4c3bdc[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x4c3bdc[_0xbb10('0x33')],_0x4c3bdc[_0xbb10('0x34')]);_0x3ceb77[_0xbb10('0x39')]=_['intersection'](_0x4c3bdc['model'],qs[_0xbb10('0x38')](_0x3e0e34[_0xbb10('0x34')][_0xbb10('0x38')]));_0x3ceb77[_0xbb10('0x39')]=_0x3ceb77[_0xbb10('0x39')][_0xbb10('0x55')]?_0x3ceb77[_0xbb10('0x39')]:_0x4c3bdc[_0xbb10('0x33')];if(_0x3e0e34[_0xbb10('0x34')][_0xbb10('0xb8')]){_0x3ceb77[_0xbb10('0xb9')]=[{'all':!![]}];}_0x3ceb77=_[_0xbb10('0xba')]({},_0x3ceb77,_0x3e0e34[_0xbb10('0xbb')]);return db['MailInteraction'][_0xbb10('0x56')](_0x3ceb77)[_0xbb10('0x1e')](handleEntityNotFound(_0x3299bc,null))[_0xbb10('0x1e')](respondWithResult(_0x3299bc,null))[_0xbb10('0x2e')](handleError(_0x3299bc,null));};exports[_0xbb10('0xbc')]=function(_0xd9284e,_0x4258fc){return db[_0xbb10('0x31')][_0xbb10('0xbc')](_0xd9284e[_0xbb10('0xbd')],{})[_0xbb10('0x1e')](respondWithResult(_0x4258fc,0xc9))['catch'](handleError(_0x4258fc,null));};exports[_0xbb10('0x1c')]=function(_0x5e1ac5,_0x3faaca){if(_0x5e1ac5[_0xbb10('0xbd')]['id']){delete _0x5e1ac5[_0xbb10('0xbd')]['id'];}return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x5e1ac5[_0xbb10('0xb6')]['id']}})['then'](handleEntityNotFound(_0x3faaca,null))[_0xbb10('0x1e')](saveUpdates(_0x5e1ac5['body'],null))[_0xbb10('0x1e')](respondWithResult(_0x3faaca,null))[_0xbb10('0x2e')](handleError(_0x3faaca,null));};exports[_0xbb10('0x1d')]=function(_0x576bb6,_0x2b652c){return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x576bb6[_0xbb10('0xb6')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x2b652c,null))[_0xbb10('0x1e')](removeEntity(_0x2b652c,null))[_0xbb10('0x2e')](handleError(_0x2b652c,null));};exports[_0xbb10('0xbe')]=function(_0x589565,_0x3696b3){return db['MailInteraction'][_0xbb10('0xbe')]()[_0xbb10('0x1e')](respondWithResult(_0x3696b3,null))[_0xbb10('0x2e')](handleError(_0x3696b3,null));};exports[_0xbb10('0xbf')]=function(_0x44c229,_0x40271f){return db[_0xbb10('0x29')]['find']({'where':{'id':_0x44c229[_0xbb10('0xb6')]['id']}})['then'](handleEntityNotFound(_0x40271f,null))['then'](function(_0x1513e0){if(_0x1513e0){return _0x1513e0[_0xbb10('0xbf')](_0x44c229[_0xbb10('0xbd')][_0xbb10('0xc0')],_[_0xbb10('0xc1')](_0x44c229[_0xbb10('0xbd')],['ids','id'])||{});}})[_0xbb10('0x1e')](respondWithResult(_0x40271f,null))[_0xbb10('0x2e')](handleError(_0x40271f,null));};exports[_0xbb10('0xc2')]=function(_0xb1b7c8,_0x136520){var _0x28127c={'raw':![],'where':{}};var _0x528aff={};var _0xdfdc42={'count':0x0,'rows':[]};return db[_0xbb10('0x31')][_0xbb10('0xb3')]({'where':{'id':_0xb1b7c8[_0xbb10('0xb6')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x136520,null))[_0xbb10('0x1e')](function(_0x2764e1){if(_0x2764e1){_0x528aff['model']=_[_0xbb10('0x35')](db['MailMessage'][_0xbb10('0xb7')]);_0x528aff['query']=_['keys'](_0xb1b7c8[_0xbb10('0x34')]);_0x528aff[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x528aff[_0xbb10('0x33')],_0x528aff[_0xbb10('0x34')]);_0x28127c['attributes']=_[_0xbb10('0x37')](_0x528aff['model'],qs['fields'](_0xb1b7c8['query'][_0xbb10('0x38')]));_0x28127c[_0xbb10('0x39')]=_0x28127c[_0xbb10('0x39')][_0xbb10('0x55')]?_0x28127c[_0xbb10('0x39')]:_0x528aff['model'];if(!_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x3a')](_0xbb10('0xc3'))){_0x28127c[_0xbb10('0x18')]=qs[_0xbb10('0x18')](_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x18')]);_0x28127c['offset']=qs['offset'](_0xb1b7c8['query'][_0xbb10('0x16')]);}_0x28127c[_0xbb10('0x3b')]=qs[_0xbb10('0x3c')](_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x3c')]);_0x28127c[_0xbb10('0x3d')]=qs[_0xbb10('0x36')](_[_0xbb10('0xc4')](_0xb1b7c8[_0xbb10('0x34')],_0x528aff[_0xbb10('0x36')]));_0x28127c['where']['MailInteractionId']=_0x2764e1['id'];if(_0xb1b7c8['query'][_0xbb10('0x7c')]){_0x28127c[_0xbb10('0x3d')]=_[_0xbb10('0xba')](_0x28127c['where'],{'$or':_[_0xbb10('0x30')](_0x28127c[_0xbb10('0x39')],function(_0x2c638d){var _0x290280={};_0x290280[_0x2c638d]={'$like':'%'+_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x7c')]+'%'};return _0x290280;})});}if(_0xb1b7c8['query']['$gte']){var _0x356660=_0xb1b7c8['query'][_0xbb10('0xc5')][_0xbb10('0x26')](',');var _0x152ca9={};_0x152ca9[_0x356660[0x0]]={'$gte':moment(_0x356660[0x1])[_0xbb10('0xc6')](_0xbb10('0xc7'))};_0x28127c[_0xbb10('0x3d')]=_[_0xbb10('0xba')](_0x28127c[_0xbb10('0x3d')],_0x152ca9);}_0x28127c=_[_0xbb10('0xba')]({},_0x28127c,_0xb1b7c8[_0xbb10('0xbb')]);return db['MailMessage'][_0xbb10('0x19')]({'where':_0x28127c['where']})[_0xbb10('0x1e')](function(_0x5547fa){_0xdfdc42[_0xbb10('0x19')]=_0x5547fa;if(_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0xb8')]){_0x28127c[_0xbb10('0xb9')]=[{'all':!![]}];}return db['MailMessage'][_0xbb10('0xc8')](_0x28127c);})['then'](function(_0xfe1154){if(_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0xc9')]==='true'){for(var _0x298167=0x0;_0x298167<_0xfe1154[_0xbb10('0x55')];_0x298167++){_0xfe1154[_0x298167][_0xbb10('0xbd')]=juice(_0xfe1154[_0x298167][_0xbb10('0xbd')]);}}_0xdfdc42[_0xbb10('0xca')]=_0xfe1154;return _0xdfdc42;});}})[_0xbb10('0x1e')](respondWithFilteredResult(_0x136520,_0x28127c))['catch'](handleError(_0x136520,null));};exports['addTags']=function(_0x522a88,_0x26a752){return db['MailInteraction'][_0xbb10('0x56')]({'where':{'id':_0x522a88['params']['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x26a752,null))[_0xbb10('0x1e')](function(_0x385ad3){if(_0x385ad3){return _0x385ad3['setTags'](_0x522a88['body'][_0xbb10('0xc0')],_[_0xbb10('0xc1')](_0x522a88[_0xbb10('0xbd')],['ids','id'])||{})[_0xbb10('0xcb')](function(){return db[_0xbb10('0x65')][_0xbb10('0xc8')]({'attributes':['id','name','color'],'where':{'id':_0x522a88['body'][_0xbb10('0xc0')]}});})['then'](function(_0x3dfbcd){socket[_0xbb10('0xcc')](_0xbb10('0xcd'),{'id':Number(_0x522a88[_0xbb10('0xb6')]['id']),'tags':_0x3dfbcd||[]});return{'id':Number(_0x522a88[_0xbb10('0xb6')]['id']),'tags':_0x3dfbcd||[]};});}})[_0xbb10('0x1e')](respondWithResult(_0x26a752,null))[_0xbb10('0x2e')](handleError(_0x26a752,null));};exports[_0xbb10('0xce')]=function(_0x2746eb,_0x431792){return db[_0xbb10('0x31')]['find']({'where':{'id':_0x2746eb[_0xbb10('0xb6')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x431792,null))['then'](function(_0x14ef50){if(_0x14ef50){return _0x14ef50['removeTags'](_0x2746eb['query'][_0xbb10('0xc0')]);}})[_0xbb10('0x1e')](respondWithStatusCode(_0x431792,null))[_0xbb10('0x2e')](handleError(_0x431792,null));};exports[_0xbb10('0xcf')]=function(_0x99c4,_0x4ca4ce){var _0x161171=moment()[_0xbb10('0xd0')]()['toString']();var _0xa45726=path[_0xbb10('0xd1')](config['root'],_0xbb10('0xd2'),'files',_0xbb10('0xd3'));var _0x8e8049=path[_0xbb10('0xd1')](config[_0xbb10('0xd4')],_0xbb10('0xd2'),_0xbb10('0xd5'),_0xbb10('0xd6'));var _0x56f902=path[_0xbb10('0xd1')](_0xa45726,_0x161171);var _0x4720a1=util[_0xbb10('0xc6')](_0xbb10('0xd7'),_0x99c4[_0xbb10('0xb6')]['id'],_0x161171);var _0x1301e3=path['join'](_0xa45726,_0x4720a1);var _0x550301=[];if(_0x99c4['query'][_0xbb10('0xd6')]){_0x550301[_0xbb10('0x28')]({'model':db[_0xbb10('0xd8')],'as':_0xbb10('0xd9'),'raw':!![]});}var _0x57700b=[{'model':db[_0xbb10('0x29')],'as':_0xbb10('0xda'),'attributes':['id',_0xbb10('0xbd'),'from','to','cc','bcc',_0xbb10('0xdb'),'createdAt'],'where':{'secret':![]},'order':qs[_0xbb10('0x3c')]('id'),'include':_0x550301}];return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x99c4[_0xbb10('0xb6')]['id']},'include':_0x57700b})[_0xbb10('0x1e')](handleEntityNotFound(_0x4ca4ce,null))[_0xbb10('0x1e')](function(_0x1fe250){if(_0x1fe250&&_0x1fe250['Messages']){var _0x424371=_0x1fe250[_0xbb10('0xdc')]({'plain':!![]});fs['mkdirSync'](_0x56f902);return BPromise[_0xbb10('0xdd')](_0x424371[_0xbb10('0xda')],function(_0x32f261,_0x5b11a2){var _0x4b490a={'from':_0x32f261['from'],'to':_0x32f261['to'],'subject':_0x32f261[_0xbb10('0xdb')],'html':_0x32f261[_0xbb10('0xbd')],'headers':{'Date':moment(_0x32f261['createdAt'])[_0xbb10('0xc6')](_0xbb10('0xde'))},'attachments':[]};if(_0x32f261['cc']){_0x4b490a[_0xbb10('0xdf')]['Cc']=_0x32f261['cc'];}if(_0x32f261[_0xbb10('0xe0')]){_0x4b490a[_0xbb10('0xdf')][_0xbb10('0xe1')]=_0x32f261[_0xbb10('0xe0')];}return new BPromise(function(_0x48f0eb,_0x304603){if(_0x32f261['Attachments']){for(var _0x5a7c4e=0x0;_0x5a7c4e<_0x32f261['Attachments'][_0xbb10('0x55')];_0x5a7c4e++){var _0x572d73=_0x32f261['Attachments'][_0x5a7c4e];var _0x1f09f1=path['join'](_0x8e8049,_0x572d73[_0xbb10('0xe2')]);if(fs[_0xbb10('0xe3')](_0x1f09f1)){_0x4b490a[_0xbb10('0xd6')]['push']({'name':_0x572d73['name'],'contentType':_0x572d73[_0xbb10('0x63')],'data':fs['readFileSync'](_0x1f09f1)});}}}emlformat[_0xbb10('0xe4')](_0x4b490a,function(_0x211172,_0x589ecb){if(_0x211172)return _0x304603(_0x211172);fs['writeFileSync'](path[_0xbb10('0xd1')](_0x56f902,util[_0xbb10('0xc6')](_0xbb10('0xe5'),_0x5b11a2)),_0x589ecb);return _0x48f0eb(_0x589ecb);});});})['then'](function(){return new BPromise(function(_0x4f4aa8,_0x426a4f){zipdir(_0x56f902,{'saveTo':_0x1301e3},function(_0x22f153,_0x4d47cc){if(_0x22f153)return _0x426a4f(_0x22f153);return _0x4f4aa8(_0x4d47cc);});})[_0xbb10('0x1e')](function(){return new BPromise(function(_0x203e5a,_0xe88e90){rimraf(_0x56f902,function(_0x4845b5){if(_0x4845b5)_0xe88e90(_0x4845b5);return _0x203e5a();});});})[_0xbb10('0x1e')](function(){return _0x4ca4ce[_0xbb10('0xcf')](_0x1301e3,_0x4720a1,function(_0x166f4f){if(!_0x166f4f)fs[_0xbb10('0xe6')](_0x1301e3);});});});}else{return _0x4ca4ce[_0xbb10('0x12')](0xc8);}})[_0xbb10('0x2e')](handleError(_0x4ca4ce,null));}; \ No newline at end of file +var _0xb10b=['Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','findOne','enableEmailPreview','show','params','rawAttributes','includeAll','include','merge','options','create','body','describe','addMessage','ids','omit','getMessages','nolimit','pick','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','rows','spread','emit','mailInteractionTags:save','removeTags','download','unix','join','server','tmp','root','files','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','subject','get','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','existsSync','build','message%d.eml','unlinkSync','eml-format','zip-dir','moment','bluebird','path','lodash','squel','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','error','stack','name','send','fullname','TagIds','Tags','split','forEach','push','MailMessage','out','-id','trimStart','plainBody','catch','index','map','MailInteraction','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','field','color','tools_tags','u.id','ui.MailInteractionId','from','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','select','mail_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','expr','search','parseSearch','conditions','length','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','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','start','some','compact','isEmpty','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','isEmail','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','role','getMailAccounts','i.MailAccountId\x20IS\x20NULL','agent','toString','sequelize','keyBy','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.createdAt','i.updatedAt','i.closed','i.attach','i.lastMsgAt','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.ContactId','i.MailAccountId','Contact.firstName','c.email'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0xb10b,0x12a));var _0xbb10=function(_0x271a95,_0x4d2a07){_0x271a95=_0x271a95-0x0;var _0x3fa489=_0xb10b[_0x271a95];return _0x3fa489;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var BPromise=require(_0xbb10('0x3'));var util=require('util');var path=require(_0xbb10('0x4'));var fs=require('fs');var _=require(_0xbb10('0x5'));var squel=require(_0xbb10('0x6'));var juice=require(_0xbb10('0x7'));var Redis=require(_0xbb10('0x8'));var qs=require(_0xbb10('0x9'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0xbb10('0xa'))(_0xbb10('0xb'));var config=require('../../config/environment');var db=require(_0xbb10('0xc'))['db'];config[_0xbb10('0xd')]=_[_0xbb10('0xe')](config[_0xbb10('0xd')],{'host':_0xbb10('0xf'),'port':0x18eb});var socket=require(_0xbb10('0x10'))(new Redis(config[_0xbb10('0xd')]));require(_0xbb10('0x11'))['register'](socket);function respondWithStatusCode(_0x4e47f8,_0x20bd61){_0x20bd61=_0x20bd61||0xcc;return function(_0x118a74){if(_0x118a74){return _0x4e47f8[_0xbb10('0x12')](_0x20bd61);}return _0x4e47f8['status'](_0x20bd61)[_0xbb10('0x13')]();};}function respondWithResult(_0x5be7e0,_0x44fb19){_0x44fb19=_0x44fb19||0xc8;return function(_0x916a32){if(_0x916a32){return _0x5be7e0[_0xbb10('0x14')](_0x44fb19)[_0xbb10('0x15')](_0x916a32);}};}function respondWithFilteredResult(_0x442548,_0x147230){return function(_0x58a612){if(_0x58a612){var _0x26e021=typeof _0x147230[_0xbb10('0x16')]===_0xbb10('0x17')&&typeof _0x147230[_0xbb10('0x18')]===_0xbb10('0x17');var _0x2f2ebf=_0x58a612[_0xbb10('0x19')];var _0x36b5e8=_0x26e021?0x0:_0x147230[_0xbb10('0x16')];var _0x2b184e=_0x26e021?_0x58a612['count']:_0x147230[_0xbb10('0x16')]+_0x147230[_0xbb10('0x18')];var _0x133ac2;if(_0x2b184e>=_0x2f2ebf){_0x2b184e=_0x2f2ebf;_0x133ac2=0xc8;}else{_0x133ac2=0xce;}_0x442548[_0xbb10('0x14')](_0x133ac2);return _0x442548[_0xbb10('0x1a')](_0xbb10('0x1b'),_0x36b5e8+'-'+_0x2b184e+'/'+_0x2f2ebf)[_0xbb10('0x15')](_0x58a612);}return null;};}function saveUpdates(_0x30efc6){return function(_0xbf2906){if(_0xbf2906){return _0xbf2906[_0xbb10('0x1c')](_0x30efc6)['then'](function(_0x5ff0cf){return _0x5ff0cf;});}return null;};}function removeEntity(_0x19f48d){return function(_0x388fab){if(_0x388fab){return _0x388fab[_0xbb10('0x1d')]()[_0xbb10('0x1e')](function(){_0x19f48d[_0xbb10('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12f888){return function(_0x12ef77){if(!_0x12ef77){_0x12f888['sendStatus'](0x194);}return _0x12ef77;};}function handleError(_0x4c4b0d,_0x8e2b97){_0x8e2b97=_0x8e2b97||0x1f4;return function(_0x311abe){logger[_0xbb10('0x1f')](_0x311abe[_0xbb10('0x20')]);if(_0x311abe[_0xbb10('0x21')]){delete _0x311abe[_0xbb10('0x21')];}_0x4c4b0d[_0xbb10('0x14')](_0x8e2b97)[_0xbb10('0x22')](_0x311abe);};}function getInteractionUsers(_0x7f2377,_0x395404){return new BPromise(function(_0x3ba6cd,_0x26ad93){try{if(_0x395404[_0x7f2377['id']]){_0x7f2377['Users']=_['map'](_0x395404[_0x7f2377['id']],function(_0x4fb5e0){return{'id':_0x4fb5e0['id'],'fullname':_0x4fb5e0[_0xbb10('0x23')]};});}}catch(_0x3c5ae7){_0x26ad93(_0x3c5ae7);}_0x3ba6cd(_0x7f2377);});}function getInteractionTags(_0x2c89b9,_0x4e25ff){return new BPromise(function(_0x2fdde9,_0x24d586){try{if(_0x2c89b9[_0xbb10('0x24')]){_0x2c89b9[_0xbb10('0x25')]=[];_0x2c89b9[_0xbb10('0x24')][_0xbb10('0x26')](',')[_0xbb10('0x27')](function(_0x4aabb9){_0x2c89b9[_0xbb10('0x25')][_0xbb10('0x28')](_0x4e25ff[_0x4aabb9]);});}delete _0x2c89b9[_0xbb10('0x24')];}catch(_0x2e0249){_0x24d586(_0x2e0249);}_0x2fdde9(_0x2c89b9);});}function getLastMessageText(_0x1d30aa){return new BPromise(function(_0x2ff4c1,_0x5d5c80){return db[_0xbb10('0x29')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x1d30aa['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xbb10('0x2a')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0xbb10('0x2b'),'raw':!![]})[_0xbb10('0x1e')](function(_0x1b59f9){if(_0x1b59f9&&_0x1b59f9['plainBody']){_0x1d30aa['lastMsgText']=_[_0xbb10('0x2c')](_0x1b59f9[_0xbb10('0x2d')]);}_0x2ff4c1(_0x1d30aa);})['catch'](function(_0x359ad4){_0x5d5c80(_0x359ad4);});});}function updateMailInteraction(_0x37dde7,_0x2f653f,_0x1c0b57,_0x37a83f){return new BPromise(function(_0x138bc6,_0xf85197){return getInteractionUsers(_0x37dde7,_0x1c0b57)['then'](function(_0x25acb3){return getInteractionTags(_0x25acb3,_0x2f653f);})[_0xbb10('0x1e')](function(_0x441d15){if(_0x37a83f){_0x138bc6(getLastMessageText(_0x441d15));}else{_0x138bc6(_0x441d15);}})[_0xbb10('0x2e')](function(_0xfb2c5e){_0xf85197(_0xfb2c5e);});});}exports[_0xbb10('0x2f')]=function(_0x188cbd,_0x10202c){var _0x3c8d7d={},_0x56943c={},_0x2b5352={'count':0x0,'rows':[]};var _0x150107=_[_0xbb10('0x30')](db[_0xbb10('0x31')]['rawAttributes'],function(_0x111762){return{'name':_0x111762['fieldName'],'type':_0x111762['type'][_0xbb10('0x32')]};});_0x56943c[_0xbb10('0x33')]=_[_0xbb10('0x30')](_0x150107,_0xbb10('0x21'));_0x56943c[_0xbb10('0x34')]=_[_0xbb10('0x35')](_0x188cbd['query']);_0x56943c[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x56943c['model'],_0x56943c['query']);_0x3c8d7d['attributes']=_[_0xbb10('0x37')](_0x56943c[_0xbb10('0x33')],qs[_0xbb10('0x38')](_0x188cbd['query'][_0xbb10('0x38')]));_0x3c8d7d[_0xbb10('0x39')]=_0x3c8d7d[_0xbb10('0x39')]['length']?_0x3c8d7d[_0xbb10('0x39')]:_0x56943c[_0xbb10('0x33')];if(!_0x188cbd[_0xbb10('0x34')][_0xbb10('0x3a')]('nolimit')){_0x3c8d7d[_0xbb10('0x18')]=qs[_0xbb10('0x18')](_0x188cbd['query'][_0xbb10('0x18')]);_0x3c8d7d[_0xbb10('0x16')]=qs[_0xbb10('0x16')](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x16')]);}_0x3c8d7d[_0xbb10('0x3b')]=qs['sort'](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x3c')]);_0x3c8d7d[_0xbb10('0x3d')]=qs[_0xbb10('0x36')](_['pick'](_0x188cbd[_0xbb10('0x34')],_0x56943c[_0xbb10('0x36')]),_0x150107);var _0x23dc18=[];var _0x403beb=squel['select']()[_0xbb10('0x3e')]('id')[_0xbb10('0x3e')]('name')['field'](_0xbb10('0x3f'))['from'](_0xbb10('0x40'));var _0x180933=squel['select']()[_0xbb10('0x3e')](_0xbb10('0x41'))[_0xbb10('0x3e')]('u.fullname')[_0xbb10('0x3e')](_0xbb10('0x42'))[_0xbb10('0x43')](_0xbb10('0x44'),'ui')[_0xbb10('0x45')](_0xbb10('0x46'),'u',_0xbb10('0x47'));var _0x3efa96=squel[_0xbb10('0x48')]()[_0xbb10('0x43')](_0xbb10('0x49'),'i')[_0xbb10('0x45')]('cm_contacts','c',_0xbb10('0x4a'))[_0xbb10('0x45')]('users','o',_0xbb10('0x4b'))[_0xbb10('0x45')](_0xbb10('0x4c'),'a',_0xbb10('0x4d'))[_0xbb10('0x45')](_0xbb10('0x4e'),'me',_0xbb10('0x4f'))['left_join']('mail_interaction_has_tags','it',_0xbb10('0x50'))[_0xbb10('0x45')](_0xbb10('0x40'),'t','t.id\x20=\x20it.TagId');var _0x5f0c12=squel[_0xbb10('0x51')]();var _0x34cf4e=[];var _0x1bd054=squel[_0xbb10('0x51')]();var _0x10159b;if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x52')]){_0x10159b=as[_0xbb10('0x53')](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x52')]);var _0x550111=_0x10159b['sqlOperator'];for(var _0x412e13=0x0;_0x412e13<_0x10159b[_0xbb10('0x54')][_0xbb10('0x55')];_0x412e13++){var _0xb014b0=_0x10159b[_0xbb10('0x54')][_0x412e13];var _0x440f9e='i';var _0x358e7e=_[_0xbb10('0x56')](_0x150107,[_0xbb10('0x21'),_0xb014b0[_0xbb10('0x3e')]]);if(!_0x358e7e){switch(_0xb014b0[_0xbb10('0x3e')]){case _0xbb10('0x57'):if(_0xb014b0[_0xbb10('0x58')]==0x1){_0x3efa96[_0xbb10('0x59')]('`'+_0xb014b0[_0xbb10('0x3e')]+'`\x20=\x200');}else{_0x3efa96[_0xbb10('0x59')]('`'+_0xb014b0['field']+_0xbb10('0x5a'));}break;case _0xbb10('0x5b'):if(_0xb014b0[_0xbb10('0x5c')]===_0xbb10('0x5d')){if(_0xb014b0[_0xbb10('0x58')][_0xbb10('0x26')]('\x20')[_0xbb10('0x55')]>0x1){_0x5f0c12[_0x550111](_0xbb10('0x5e'),qs[_0xbb10('0x5f')](_0xb014b0[_0xbb10('0x58')]),null);}else{var _0x44a056='%'+_0xb014b0[_0xbb10('0x58')]+'%';_0x5f0c12[_0x550111](_0xbb10('0x60'),_0x44a056,_0x44a056,_0x44a056);}}else{_0x358e7e=_[_0xbb10('0x56')](_0x150107,[_0xbb10('0x21'),'ContactId']);_0xb014b0[_0xbb10('0x3e')]=_0xbb10('0x61');_0x155dc5=as[_0xbb10('0x62')](_0x440f9e,_0x358e7e[_0xbb10('0x63')],_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5[_0xbb10('0x64')],_0x155dc5[_0xbb10('0x58')]['start'],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x13')]);}break;case _0xbb10('0x65'):var _0x14fed3=_0xb014b0[_0xbb10('0x58')][_0xbb10('0x26')](',')[_0xbb10('0x30')](function(_0x12ec18){return Number(_0x12ec18);});_0x14fed3[_0xbb10('0x27')](function(_0x40c4fb){_0x1bd054['or'](_0xbb10('0x66'),'%,'+_0x40c4fb+',%');});_0x34cf4e=_[_0xbb10('0x67')](_0x34cf4e,_0x14fed3);break;case _0xbb10('0x68'):if(_0xb014b0['operator']==='$substring'){_0x5f0c12[_0x550111](_0xbb10('0x69'),'%'+_0xb014b0[_0xbb10('0x58')]+'%',null);}else{_0x358e7e=_[_0xbb10('0x56')](_0x150107,[_0xbb10('0x21'),'UserId']);_0xb014b0['field']=_0xbb10('0x6a');_0x155dc5=as[_0xbb10('0x62')](_0x440f9e,_0x358e7e[_0xbb10('0x63')],_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5[_0xbb10('0x64')],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x6b')],_0x155dc5[_0xbb10('0x58')]['end']);}break;case _0xbb10('0x2d'):_0x155dc5=as[_0xbb10('0x62')]('me',null,_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5['text'],_0x155dc5['value']['start'],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x13')]);break;}}else{var _0x155dc5=as['buildExpression'](_0x440f9e,_0x358e7e['type'],_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5['text'],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x6b')],_0x155dc5[_0xbb10('0x58')]['end']);}}}else{var _0xa1bbd9=_(_0x188cbd[_0xbb10('0x34')])['keys']()['map'](function(_0x27d7b9){return _[_0xbb10('0x6c')](_0x150107,[_0xbb10('0x21'),_0x27d7b9])?_0x27d7b9:undefined;})[_0xbb10('0x6d')]()['value']();if(!_[_0xbb10('0x6e')](_0xa1bbd9)){_0xa1bbd9[_0xbb10('0x27')](function(_0xa7179d){if(_0xa7179d==='MailAccountId'){_0x3efa96[_0xbb10('0x3d')](_0xbb10('0x6f'),[][_0xbb10('0x70')](_0x188cbd['query'][_0xa7179d]));}else if(_0xa7179d===_0xbb10('0x71')){var _0x31e85e=JSON[_0xbb10('0x72')](_0x188cbd[_0xbb10('0x34')][_0xa7179d])['$gte'];var _0x251417=JSON[_0xbb10('0x72')](_0x188cbd[_0xbb10('0x34')][_0xa7179d])[_0xbb10('0x73')];_0x3efa96['where'](_0xbb10('0x74'),_0x31e85e,_0x251417);}else{if(_0x188cbd[_0xbb10('0x34')][_0xa7179d]===_0xbb10('0x75')){_0x3efa96[_0xbb10('0x3d')]('i.'+_0xa7179d+_0xbb10('0x76'));}else{_0x3efa96[_0xbb10('0x3d')]('i.'+_0xa7179d+_0xbb10('0x77'),_0x188cbd['query'][_0xa7179d]);}}});}if(_0x188cbd['query']['read']){if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x78')]==0x1){_0x3efa96[_0xbb10('0x59')]('`unreadMessages`\x20=\x200');}else{_0x3efa96['having'](_0xbb10('0x79'));}}if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7a')]){_0x34cf4e=_[_0xbb10('0x7b')](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7a')])?_0x188cbd['query'][_0xbb10('0x7a')]:new Array(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7a')]);_0x34cf4e[_0xbb10('0x27')](function(_0x2aaaa6){_0x1bd054['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2aaaa6+',%');});}if(_0x188cbd['query']['filter']){var _0x329da7=_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7c')][_0xbb10('0x7d')]('\x5c','\x5c\x5c')[_0xbb10('0x7d')](/'/g,'\x27\x27');if(qs[_0xbb10('0x7e')](_0x329da7)){_0x5f0c12['or']('i.id\x20LIKE\x20?',_0x329da7+'%');}else if(qs[_0xbb10('0x7f')](_0x329da7)){_0x5f0c12['or']('c.email\x20LIKE\x20?',_0x329da7+'%');}else{_0x5f0c12['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x329da7))['or'](_0xbb10('0x80'),qs[_0xbb10('0x5f')](_0x329da7));}}}_0x3efa96[_0xbb10('0x3d')](_0x5f0c12);_0x3efa96[_0xbb10('0x81')]('i.id');var _0x122d38={'type':db['Sequelize']['QueryTypes'][_0xbb10('0x82')],'raw':!![]};var _0xfe3db0=_0x3efa96[_0xbb10('0x83')]();_0xfe3db0[_0xbb10('0x3e')](_0xbb10('0x84'));_0xfe3db0['field'](_0xbb10('0x85'),_0xbb10('0x57'));if(_0x3c8d7d[_0xbb10('0x3b')]){_0x3c8d7d[_0xbb10('0x3b')][_0xbb10('0x27')](function(_0x27f42f){var _0x174395=_0x27f42f[0x0]==='contactName'?_0x27f42f[0x0]:'i.'+_0x27f42f[0x0];_0x3efa96[_0xbb10('0x3b')](_0x174395,_0x27f42f[0x1]===_0xbb10('0x86')?![]:!![]);});}if(!_[_0xbb10('0x6e')](_0x34cf4e)){_0x3efa96[_0xbb10('0x59')](_0x1bd054);_0xfe3db0[_0xbb10('0x3d')](_0xbb10('0x87'),_0x34cf4e);}BPromise[_0xbb10('0x88')]()[_0xbb10('0x1e')](function(){if(!_0x10159b){if(_0x188cbd['query'][_0xbb10('0x89')])return;_0xfe3db0[_0xbb10('0x3d')](_0xbb10('0x8a'));_0x3efa96['where']('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x188cbd['user'][_0xbb10('0x8b')]!=='agent')return;return _0x188cbd['user'][_0xbb10('0x8c')]({'attributes':['id'],'raw':!![]})[_0xbb10('0x1e')](function(_0x33ff06){if(_[_0xbb10('0x6e')](_0x33ff06)){_0xfe3db0[_0xbb10('0x3d')](_0xbb10('0x8d'));_0x3efa96[_0xbb10('0x3d')](_0xbb10('0x8d'));}else{_0xfe3db0[_0xbb10('0x3d')]('i.MailAccountId\x20IN\x20?',_[_0xbb10('0x30')](_0x33ff06,'id'));_0x3efa96[_0xbb10('0x3d')](_0xbb10('0x6f'),_[_0xbb10('0x30')](_0x33ff06,'id'));}});})['then'](function(){if(_0x188cbd['user'][_0xbb10('0x8b')]===_0xbb10('0x8e')&&!_0x10159b&&!_0x188cbd[_0xbb10('0x34')][_0xbb10('0x89')])return[];return db['sequelize'][_0xbb10('0x34')](_0xfe3db0[_0xbb10('0x8f')](),_0x122d38);})[_0xbb10('0x1e')](function(_0xf7b3e1){_0x2b5352[_0xbb10('0x19')]=_0xf7b3e1['length'];if(_0x2b5352['count']===0x0)return[];return db[_0xbb10('0x90')][_0xbb10('0x34')](_0x403beb[_0xbb10('0x8f')](),_0x122d38)['then'](function(_0x256b35){_0x23dc18=_[_0xbb10('0x91')](_0x256b35,'id');_0x122d38=_['merge'](_0x122d38,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x38')]){_0x3c8d7d[_0xbb10('0x39')]['forEach'](function(_0x32d5a5){_0x3efa96[_0xbb10('0x3e')]('i.'+_0x32d5a5);});}else{_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x85'),_0xbb10('0x57'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x92'),_0xbb10('0x93'));_0x3efa96[_0xbb10('0x3e')]('a.mandatoryDisposition',_0xbb10('0x94'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x95'),_0xbb10('0x96'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x84'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x97'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x98'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x99'));_0x3efa96['field']('i.closedAt');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9a'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9b'));_0x3efa96[_0xbb10('0x3e')]('i.lastMsgDirection');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9c'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9d'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9e'));_0x3efa96['field'](_0xbb10('0x9f'));_0x3efa96[_0xbb10('0x3e')]('i.substatus');_0x3efa96[_0xbb10('0x3e')]('i.to');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa0'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa1'));_0x3efa96[_0xbb10('0x3e')]('i.UserId');_0x3efa96[_0xbb10('0x3e')]('c.firstName',_0xbb10('0xa2'));_0x3efa96[_0xbb10('0x3e')]('c.lastName','Contact.lastName');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa3'),_0xbb10('0xa4'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa5'),_0xbb10('0xa6'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa7'),_0xbb10('0xa8'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa9'),'Contact.fax');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xaa'),_0xbb10('0xab'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xac'),_0xbb10('0xad'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xae'),_0xbb10('0x24'));}if(_0x3c8d7d[_0xbb10('0x18')])_0x3efa96[_0xbb10('0x18')](_0x3c8d7d[_0xbb10('0x18')]);if(_0x3c8d7d['offset'])_0x3efa96[_0xbb10('0x16')](_0x3c8d7d['offset']);return db[_0xbb10('0x90')][_0xbb10('0x34')](_0x3efa96[_0xbb10('0x8f')](),_0x122d38);})[_0xbb10('0x1e')](function(_0x38d369){if(_0x38d369['length']>0x0)_0x180933[_0xbb10('0x3d')](_0xbb10('0xaf'),_[_0xbb10('0x30')](_0x38d369,'id'));return db[_0xbb10('0x90')][_0xbb10('0x34')](_0x180933[_0xbb10('0x8f')](),_0x122d38)['then'](function(_0x4bd470){var _0x5cc9d7=_[_0xbb10('0xb0')](_0x4bd470,_0xbb10('0xb1'));var _0x57d5a1=[];return db[_0xbb10('0xb2')][_0xbb10('0xb3')]({'attributes':['enableEmailPreview'],'raw':!![]})[_0xbb10('0x1e')](function(_0xaede56){var _0x5642c3=_0xaede56[_0xbb10('0xb4')];_0x38d369['forEach'](function(_0x34cec7){_0x57d5a1[_0xbb10('0x28')](updateMailInteraction(_0x34cec7,_0x23dc18,_0x5cc9d7,_0x5642c3));});return BPromise['all'](_0x57d5a1);});});});})[_0xbb10('0x1e')](function(_0x28cc74){_0x2b5352['rows']=_0x28cc74;return _0x2b5352;})['then'](respondWithFilteredResult(_0x10202c,_0x3c8d7d))[_0xbb10('0x2e')](handleError(_0x10202c,null));};exports[_0xbb10('0xb5')]=function(_0x3e0e34,_0x3299bc){var _0x3ceb77={'raw':![],'where':{'id':_0x3e0e34[_0xbb10('0xb6')]['id']}},_0x4c3bdc={};_0x4c3bdc[_0xbb10('0x33')]=_[_0xbb10('0x35')](db['MailInteraction'][_0xbb10('0xb7')]);_0x4c3bdc[_0xbb10('0x34')]=_[_0xbb10('0x35')](_0x3e0e34[_0xbb10('0x34')]);_0x4c3bdc[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x4c3bdc[_0xbb10('0x33')],_0x4c3bdc[_0xbb10('0x34')]);_0x3ceb77[_0xbb10('0x39')]=_['intersection'](_0x4c3bdc['model'],qs[_0xbb10('0x38')](_0x3e0e34[_0xbb10('0x34')][_0xbb10('0x38')]));_0x3ceb77[_0xbb10('0x39')]=_0x3ceb77[_0xbb10('0x39')][_0xbb10('0x55')]?_0x3ceb77[_0xbb10('0x39')]:_0x4c3bdc[_0xbb10('0x33')];if(_0x3e0e34[_0xbb10('0x34')][_0xbb10('0xb8')]){_0x3ceb77[_0xbb10('0xb9')]=[{'all':!![]}];}_0x3ceb77=_[_0xbb10('0xba')]({},_0x3ceb77,_0x3e0e34[_0xbb10('0xbb')]);return db['MailInteraction'][_0xbb10('0x56')](_0x3ceb77)[_0xbb10('0x1e')](handleEntityNotFound(_0x3299bc,null))[_0xbb10('0x1e')](respondWithResult(_0x3299bc,null))[_0xbb10('0x2e')](handleError(_0x3299bc,null));};exports[_0xbb10('0xbc')]=function(_0xd9284e,_0x4258fc){return db[_0xbb10('0x31')][_0xbb10('0xbc')](_0xd9284e[_0xbb10('0xbd')],{})[_0xbb10('0x1e')](respondWithResult(_0x4258fc,0xc9))['catch'](handleError(_0x4258fc,null));};exports[_0xbb10('0x1c')]=function(_0x5e1ac5,_0x3faaca){if(_0x5e1ac5[_0xbb10('0xbd')]['id']){delete _0x5e1ac5[_0xbb10('0xbd')]['id'];}return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x5e1ac5[_0xbb10('0xb6')]['id']}})['then'](handleEntityNotFound(_0x3faaca,null))[_0xbb10('0x1e')](saveUpdates(_0x5e1ac5['body'],null))[_0xbb10('0x1e')](respondWithResult(_0x3faaca,null))[_0xbb10('0x2e')](handleError(_0x3faaca,null));};exports[_0xbb10('0x1d')]=function(_0x576bb6,_0x2b652c){return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x576bb6[_0xbb10('0xb6')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x2b652c,null))[_0xbb10('0x1e')](removeEntity(_0x2b652c,null))[_0xbb10('0x2e')](handleError(_0x2b652c,null));};exports[_0xbb10('0xbe')]=function(_0x589565,_0x3696b3){return db['MailInteraction'][_0xbb10('0xbe')]()[_0xbb10('0x1e')](respondWithResult(_0x3696b3,null))[_0xbb10('0x2e')](handleError(_0x3696b3,null));};exports[_0xbb10('0xbf')]=function(_0x44c229,_0x40271f){return db[_0xbb10('0x29')]['find']({'where':{'id':_0x44c229[_0xbb10('0xb6')]['id']}})['then'](handleEntityNotFound(_0x40271f,null))['then'](function(_0x1513e0){if(_0x1513e0){return _0x1513e0[_0xbb10('0xbf')](_0x44c229[_0xbb10('0xbd')][_0xbb10('0xc0')],_[_0xbb10('0xc1')](_0x44c229[_0xbb10('0xbd')],['ids','id'])||{});}})[_0xbb10('0x1e')](respondWithResult(_0x40271f,null))[_0xbb10('0x2e')](handleError(_0x40271f,null));};exports[_0xbb10('0xc2')]=function(_0xb1b7c8,_0x136520){var _0x28127c={'raw':![],'where':{}};var _0x528aff={};var _0xdfdc42={'count':0x0,'rows':[]};return db[_0xbb10('0x31')][_0xbb10('0xb3')]({'where':{'id':_0xb1b7c8[_0xbb10('0xb6')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x136520,null))[_0xbb10('0x1e')](function(_0x2764e1){if(_0x2764e1){_0x528aff['model']=_[_0xbb10('0x35')](db['MailMessage'][_0xbb10('0xb7')]);_0x528aff['query']=_['keys'](_0xb1b7c8[_0xbb10('0x34')]);_0x528aff[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x528aff[_0xbb10('0x33')],_0x528aff[_0xbb10('0x34')]);_0x28127c['attributes']=_[_0xbb10('0x37')](_0x528aff['model'],qs['fields'](_0xb1b7c8['query'][_0xbb10('0x38')]));_0x28127c[_0xbb10('0x39')]=_0x28127c[_0xbb10('0x39')][_0xbb10('0x55')]?_0x28127c[_0xbb10('0x39')]:_0x528aff['model'];if(!_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x3a')](_0xbb10('0xc3'))){_0x28127c[_0xbb10('0x18')]=qs[_0xbb10('0x18')](_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x18')]);_0x28127c['offset']=qs['offset'](_0xb1b7c8['query'][_0xbb10('0x16')]);}_0x28127c[_0xbb10('0x3b')]=qs[_0xbb10('0x3c')](_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x3c')]);_0x28127c[_0xbb10('0x3d')]=qs[_0xbb10('0x36')](_[_0xbb10('0xc4')](_0xb1b7c8[_0xbb10('0x34')],_0x528aff[_0xbb10('0x36')]));_0x28127c['where']['MailInteractionId']=_0x2764e1['id'];if(_0xb1b7c8['query'][_0xbb10('0x7c')]){_0x28127c[_0xbb10('0x3d')]=_[_0xbb10('0xba')](_0x28127c['where'],{'$or':_[_0xbb10('0x30')](_0x28127c[_0xbb10('0x39')],function(_0x2c638d){var _0x290280={};_0x290280[_0x2c638d]={'$like':'%'+_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x7c')]+'%'};return _0x290280;})});}if(_0xb1b7c8['query']['$gte']){var _0x356660=_0xb1b7c8['query'][_0xbb10('0xc5')][_0xbb10('0x26')](',');var _0x152ca9={};_0x152ca9[_0x356660[0x0]]={'$gte':moment(_0x356660[0x1])[_0xbb10('0xc6')](_0xbb10('0xc7'))};_0x28127c[_0xbb10('0x3d')]=_[_0xbb10('0xba')](_0x28127c[_0xbb10('0x3d')],_0x152ca9);}_0x28127c=_[_0xbb10('0xba')]({},_0x28127c,_0xb1b7c8[_0xbb10('0xbb')]);return db['MailMessage'][_0xbb10('0x19')]({'where':_0x28127c['where']})[_0xbb10('0x1e')](function(_0x5547fa){_0xdfdc42[_0xbb10('0x19')]=_0x5547fa;if(_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0xb8')]){_0x28127c[_0xbb10('0xb9')]=[{'all':!![]}];}return db['MailMessage'][_0xbb10('0xc8')](_0x28127c);})['then'](function(_0xfe1154){if(_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0xc9')]==='true'){for(var _0x298167=0x0;_0x298167<_0xfe1154[_0xbb10('0x55')];_0x298167++){_0xfe1154[_0x298167][_0xbb10('0xbd')]=juice(_0xfe1154[_0x298167][_0xbb10('0xbd')]);}}_0xdfdc42[_0xbb10('0xca')]=_0xfe1154;return _0xdfdc42;});}})[_0xbb10('0x1e')](respondWithFilteredResult(_0x136520,_0x28127c))['catch'](handleError(_0x136520,null));};exports['addTags']=function(_0x522a88,_0x26a752){return db['MailInteraction'][_0xbb10('0x56')]({'where':{'id':_0x522a88['params']['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x26a752,null))[_0xbb10('0x1e')](function(_0x385ad3){if(_0x385ad3){return _0x385ad3['setTags'](_0x522a88['body'][_0xbb10('0xc0')],_[_0xbb10('0xc1')](_0x522a88[_0xbb10('0xbd')],['ids','id'])||{})[_0xbb10('0xcb')](function(){return db[_0xbb10('0x65')][_0xbb10('0xc8')]({'attributes':['id','name','color'],'where':{'id':_0x522a88['body'][_0xbb10('0xc0')]}});})['then'](function(_0x3dfbcd){socket[_0xbb10('0xcc')](_0xbb10('0xcd'),{'id':Number(_0x522a88[_0xbb10('0xb6')]['id']),'tags':_0x3dfbcd||[]});return{'id':Number(_0x522a88[_0xbb10('0xb6')]['id']),'tags':_0x3dfbcd||[]};});}})[_0xbb10('0x1e')](respondWithResult(_0x26a752,null))[_0xbb10('0x2e')](handleError(_0x26a752,null));};exports[_0xbb10('0xce')]=function(_0x2746eb,_0x431792){return db[_0xbb10('0x31')]['find']({'where':{'id':_0x2746eb[_0xbb10('0xb6')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x431792,null))['then'](function(_0x14ef50){if(_0x14ef50){return _0x14ef50['removeTags'](_0x2746eb['query'][_0xbb10('0xc0')]);}})[_0xbb10('0x1e')](respondWithStatusCode(_0x431792,null))[_0xbb10('0x2e')](handleError(_0x431792,null));};exports[_0xbb10('0xcf')]=function(_0x99c4,_0x4ca4ce){var _0x161171=moment()[_0xbb10('0xd0')]()['toString']();var _0xa45726=path[_0xbb10('0xd1')](config['root'],_0xbb10('0xd2'),'files',_0xbb10('0xd3'));var _0x8e8049=path[_0xbb10('0xd1')](config[_0xbb10('0xd4')],_0xbb10('0xd2'),_0xbb10('0xd5'),_0xbb10('0xd6'));var _0x56f902=path[_0xbb10('0xd1')](_0xa45726,_0x161171);var _0x4720a1=util[_0xbb10('0xc6')](_0xbb10('0xd7'),_0x99c4[_0xbb10('0xb6')]['id'],_0x161171);var _0x1301e3=path['join'](_0xa45726,_0x4720a1);var _0x550301=[];if(_0x99c4['query'][_0xbb10('0xd6')]){_0x550301[_0xbb10('0x28')]({'model':db[_0xbb10('0xd8')],'as':_0xbb10('0xd9'),'raw':!![]});}var _0x57700b=[{'model':db[_0xbb10('0x29')],'as':_0xbb10('0xda'),'attributes':['id',_0xbb10('0xbd'),'from','to','cc','bcc',_0xbb10('0xdb'),'createdAt'],'where':{'secret':![]},'order':qs[_0xbb10('0x3c')]('id'),'include':_0x550301}];return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x99c4[_0xbb10('0xb6')]['id']},'include':_0x57700b})[_0xbb10('0x1e')](handleEntityNotFound(_0x4ca4ce,null))[_0xbb10('0x1e')](function(_0x1fe250){if(_0x1fe250&&_0x1fe250['Messages']){var _0x424371=_0x1fe250[_0xbb10('0xdc')]({'plain':!![]});fs['mkdirSync'](_0x56f902);return BPromise[_0xbb10('0xdd')](_0x424371[_0xbb10('0xda')],function(_0x32f261,_0x5b11a2){var _0x4b490a={'from':_0x32f261['from'],'to':_0x32f261['to'],'subject':_0x32f261[_0xbb10('0xdb')],'html':_0x32f261[_0xbb10('0xbd')],'headers':{'Date':moment(_0x32f261['createdAt'])[_0xbb10('0xc6')](_0xbb10('0xde'))},'attachments':[]};if(_0x32f261['cc']){_0x4b490a[_0xbb10('0xdf')]['Cc']=_0x32f261['cc'];}if(_0x32f261[_0xbb10('0xe0')]){_0x4b490a[_0xbb10('0xdf')][_0xbb10('0xe1')]=_0x32f261[_0xbb10('0xe0')];}return new BPromise(function(_0x48f0eb,_0x304603){if(_0x32f261['Attachments']){for(var _0x5a7c4e=0x0;_0x5a7c4e<_0x32f261['Attachments'][_0xbb10('0x55')];_0x5a7c4e++){var _0x572d73=_0x32f261['Attachments'][_0x5a7c4e];var _0x1f09f1=path['join'](_0x8e8049,_0x572d73[_0xbb10('0xe2')]);if(fs[_0xbb10('0xe3')](_0x1f09f1)){_0x4b490a[_0xbb10('0xd6')]['push']({'name':_0x572d73['name'],'contentType':_0x572d73[_0xbb10('0x63')],'data':fs['readFileSync'](_0x1f09f1)});}}}emlformat[_0xbb10('0xe4')](_0x4b490a,function(_0x211172,_0x589ecb){if(_0x211172)return _0x304603(_0x211172);fs['writeFileSync'](path[_0xbb10('0xd1')](_0x56f902,util[_0xbb10('0xc6')](_0xbb10('0xe5'),_0x5b11a2)),_0x589ecb);return _0x48f0eb(_0x589ecb);});});})['then'](function(){return new BPromise(function(_0x4f4aa8,_0x426a4f){zipdir(_0x56f902,{'saveTo':_0x1301e3},function(_0x22f153,_0x4d47cc){if(_0x22f153)return _0x426a4f(_0x22f153);return _0x4f4aa8(_0x4d47cc);});})[_0xbb10('0x1e')](function(){return new BPromise(function(_0x203e5a,_0xe88e90){rimraf(_0x56f902,function(_0x4845b5){if(_0x4845b5)_0xe88e90(_0x4845b5);return _0x203e5a();});});})[_0xbb10('0x1e')](function(){return _0x4ca4ce[_0xbb10('0xcf')](_0x1301e3,_0x4720a1,function(_0x166f4f){if(!_0x166f4f)fs[_0xbb10('0xe6')](_0x1301e3);});});});}else{return _0x4ca4ce[_0xbb10('0x12')](0xc8);}})[_0xbb10('0x2e')](handleError(_0x4ca4ce,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index a52c633..89c6dab 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 _0x5f5a=['hook','events','../../mysqldb','MailInteraction','setMaxListeners','save','update','then','setDataValue','Users','findAll','unreadMessages','length','catch','hasOwnProperty'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5f5a,0x97));var _0xa5f5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5f5a[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xa5f5('0x0'));var MailInteraction=require(_0xa5f5('0x1'))['db'][_0xa5f5('0x2')];var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xa5f5('0x3')](0x0);var events={'afterCreate':_0xa5f5('0x4'),'afterUpdate':_0xa5f5('0x5'),'afterDestroy':'remove'};function emitEvent(_0x28b15e){return function(_0x1a7079,_0x50611e,_0x51fbac){_0x1a7079['getUsers']({'attributes':['id'],'raw':!![]})[_0xa5f5('0x6')](function(_0x42591c){_0x1a7079[_0xa5f5('0x7')](_0xa5f5('0x8'),_0x42591c['map'](function(_0x544e78){return{'id':_0x544e78['id']};}));return MailMessage[_0xa5f5('0x9')]({'where':{'MailInteractionId':_0x1a7079['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa5f5('0x6')](function(_0x173326){_0x1a7079[_0xa5f5('0x7')](_0xa5f5('0xa'),_0x173326[_0xa5f5('0xb')]);MailInteractionEvents['emit'](_0x28b15e+':'+_0x1a7079['id'],_0x1a7079);MailInteractionEvents['emit'](_0x28b15e,_0x1a7079);_0x51fbac(null);})[_0xa5f5('0xc')](_0x51fbac(null));};}for(var e in events){if(events[_0xa5f5('0xd')](e)){var event=events[e];MailInteraction[_0xa5f5('0xe')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0x2186=['hook','exports','MailInteraction','../../mysqldb','setMaxListeners','getUsers','then','setDataValue','Users','findAll','length','emit','hasOwnProperty'];(function(_0x3cdf96,_0x5b40fc){var _0xd92531=function(_0x5e6e5b){while(--_0x5e6e5b){_0x3cdf96['push'](_0x3cdf96['shift']());}};_0xd92531(++_0x5b40fc);}(_0x2186,0xec));var _0x6218=function(_0x33b091,_0x36ec7d){_0x33b091=_0x33b091-0x0;var _0x205f62=_0x2186[_0x33b091];return _0x205f62;};'use strict';var EventEmitter=require('events');var MailInteraction=require('../../mysqldb')['db'][_0x6218('0x0')];var MailMessage=require(_0x6218('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x6218('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x189ce5){return function(_0x39588f,_0x186b87,_0x3be7b9){_0x39588f[_0x6218('0x3')]({'attributes':['id'],'raw':!![]})[_0x6218('0x4')](function(_0x30b472){_0x39588f[_0x6218('0x5')](_0x6218('0x6'),_0x30b472['map'](function(_0x1b8369){return{'id':_0x1b8369['id']};}));return MailMessage[_0x6218('0x7')]({'where':{'MailInteractionId':_0x39588f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6218('0x4')](function(_0x1ab4c7){_0x39588f[_0x6218('0x5')]('unreadMessages',_0x1ab4c7[_0x6218('0x8')]);MailInteractionEvents['emit'](_0x189ce5+':'+_0x39588f['id'],_0x39588f);MailInteractionEvents[_0x6218('0x9')](_0x189ce5,_0x39588f);_0x3be7b9(null);})['catch'](_0x3be7b9(null));};}for(var e in events){if(events[_0x6218('0xa')](e)){var event=events[e];MailInteraction[_0x6218('0xb')](e,emitEvent(event));}}module[_0x6218('0xc')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index fc23698..1cb4bab 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 _0x883c=['substatus','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closedAt','format','changed','closed','models','get','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailInteraction.attributes','exports','define','mail_interactions','fti_mail_interactions','subject','FULLTEXT'];(function(_0xf938d5,_0x56f7ca){var _0x65dfc7=function(_0x5e3d4e){while(--_0x5e3d4e){_0xf938d5['push'](_0xf938d5['shift']());}};_0x65dfc7(++_0x56f7ca);}(_0x883c,0x188));var _0xc883=function(_0x3e23da,_0x198a0c){_0x3e23da=_0x3e23da-0x0;var _0x140d98=_0x883c[_0x3e23da];return _0x140d98;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc883('0x0'))(_0xc883('0x1'));var moment=require(_0xc883('0x2'));var BPromise=require(_0xc883('0x3'));var rp=require(_0xc883('0x4'));var fs=require('fs');var path=require(_0xc883('0x5'));var rimraf=require(_0xc883('0x6'));var config=require('../../config/environment');var attributes=require(_0xc883('0x7'));module[_0xc883('0x8')]=function(_0xfe1be9,_0x357e86){return _0xfe1be9[_0xc883('0x9')]('MailInteraction',attributes,{'tableName':_0xc883('0xa'),'paranoid':![],'indexes':[{'name':_0xc883('0xb'),'fields':[_0xc883('0xc'),'to'],'type':_0xc883('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x59333a,_0xb011b1,_0x46cecc){if(_0x59333a[_0xc883('0xe')]){_0x59333a[_0xc883('0xf')]=moment()['format'](_0xc883('0x10'));}if(_0x59333a['closed']){_0x59333a[_0xc883('0x11')]=moment()[_0xc883('0x12')](_0xc883('0x10'));}_0x46cecc(null,_0xb011b1);},'beforeUpdate':function(_0x5827cf,_0x310f5b,_0x540fcc){if(_0x5827cf[_0xc883('0x13')](_0xc883('0xe'))){_0x5827cf['substatusAt']=_0x5827cf[_0xc883('0xe')]?moment()['format'](_0xc883('0x10')):null;}if(_0x5827cf[_0xc883('0x13')](_0xc883('0x14'))){_0x5827cf[_0xc883('0x11')]=moment()[_0xc883('0x12')](_0xc883('0x10'));_0x5827cf[_0xc883('0xe')]=null;_0x5827cf[_0xc883('0xf')]=null;}_0x540fcc(null,_0x5827cf);},'afterUpdate':function(_0x598a9b,_0x15019b,_0x328f44){var _0x17450d=_0xfe1be9[_0xc883('0x15')];var _0x508ec4=_0x598a9b[_0xc883('0x16')]({'plain':!![]});if(_0x508ec4[_0xc883('0x14')]){return _0x17450d[_0xc883('0x17')][_0xc883('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x508ec4['id']}})[_0xc883('0x19')](function(){_0x328f44();})[_0xc883('0x1a')](function(_0x59c040){_0x328f44(_0x59c040);});}else{_0x328f44();}}},'charset':_0xc883('0x1b'),'collate':_0xc883('0x1c')});}; \ No newline at end of file +var _0xe478=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','MailInteraction','mail_interactions','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','MailMessage','update','then','catch'];(function(_0x54d812,_0x2c2aaf){var _0x5099e4=function(_0x605ead){while(--_0x605ead){_0x54d812['push'](_0x54d812['shift']());}};_0x5099e4(++_0x2c2aaf);}(_0xe478,0x72));var _0x8e47=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xe478[_0x422905];return _0x33dc6c;};'use strict';var _=require(_0x8e47('0x0'));var util=require(_0x8e47('0x1'));var logger=require(_0x8e47('0x2'))(_0x8e47('0x3'));var moment=require(_0x8e47('0x4'));var BPromise=require('bluebird');var rp=require(_0x8e47('0x5'));var fs=require('fs');var path=require(_0x8e47('0x6'));var rimraf=require(_0x8e47('0x7'));var config=require(_0x8e47('0x8'));var attributes=require('./mailInteraction.attributes');module[_0x8e47('0x9')]=function(_0x5af3be,_0xa189ab){return _0x5af3be[_0x8e47('0xa')](_0x8e47('0xb'),attributes,{'tableName':_0x8e47('0xc'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':['subject','to'],'type':_0x8e47('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x31090a,_0x284f09,_0x38edb6){if(_0x31090a[_0x8e47('0xe')]){_0x31090a[_0x8e47('0xf')]=moment()[_0x8e47('0x10')](_0x8e47('0x11'));}if(_0x31090a[_0x8e47('0x12')]){_0x31090a[_0x8e47('0x13')]=moment()[_0x8e47('0x10')](_0x8e47('0x11'));}_0x38edb6(null,_0x284f09);},'beforeUpdate':function(_0x7a0b29,_0x29175a,_0x56fa89){if(_0x7a0b29['changed']('substatus')){_0x7a0b29[_0x8e47('0xf')]=_0x7a0b29[_0x8e47('0xe')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x7a0b29[_0x8e47('0x14')]('closed')){_0x7a0b29[_0x8e47('0x13')]=moment()[_0x8e47('0x10')](_0x8e47('0x11'));_0x7a0b29[_0x8e47('0xe')]=null;_0x7a0b29[_0x8e47('0xf')]=null;}_0x56fa89(null,_0x7a0b29);},'afterUpdate':function(_0x2116ff,_0xafb777,_0x518ea1){var _0x48dae4=_0x5af3be[_0x8e47('0x15')];var _0x5a710a=_0x2116ff['get']({'plain':!![]});if(_0x5a710a[_0x8e47('0x12')]){return _0x48dae4[_0x8e47('0x16')][_0x8e47('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x5a710a['id']}})[_0x8e47('0x18')](function(){_0x518ea1();})[_0x8e47('0x19')](function(_0x1db823){_0x518ea1(_0x1db823);});}else{_0x518ea1();}}},'charset':_0x8e47('0x1a'),'collate':_0x8e47('0x1b')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index a2705c2..33c0d73 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 _0x8b02=['./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','limit','AddTagsToMailInteraction','find','ids','omit','AddTags','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x46a191,_0x2351d8){var _0x56a93c=function(_0x1e4112){while(--_0x1e4112){_0x46a191['push'](_0x46a191['shift']());}};_0x56a93c(++_0x2351d8);}(_0x8b02,0x94));var _0x28b0=function(_0x5413de,_0x24355d){_0x5413de=_0x5413de-0x0;var _0x33796f=_0x8b02[_0x5413de];return _0x33796f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x28b0('0x0'));var BPromise=require('bluebird');var rs=require(_0x28b0('0x1'));var fs=require('fs');var Redis=require(_0x28b0('0x2'));var db=require(_0x28b0('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x28b0('0x4'));var config=require(_0x28b0('0x5'));var jayson=require(_0x28b0('0x6'));var client=jayson['client'][_0x28b0('0x7')]({'port':0x232a});config[_0x28b0('0x8')]=_[_0x28b0('0x9')](config[_0x28b0('0x8')],{'host':_0x28b0('0xa'),'port':0x18eb});var socket=require(_0x28b0('0xb'))(new Redis(config['redis']));require(_0x28b0('0xc'))[_0x28b0('0xd')](socket);function respondWithRpcPromise(_0x4839a1,_0xb081d4,_0x5229d5){return new BPromise(function(_0x52010b,_0x1eb3b6){return client[_0x28b0('0xe')](_0x4839a1,_0x5229d5)[_0x28b0('0xf')](function(_0x4335b4){logger[_0x28b0('0x10')](_0x28b0('0x11'),_0xb081d4,_0x28b0('0x12'));logger[_0x28b0('0x13')](_0x28b0('0x14'),_0xb081d4,_0x28b0('0x12'),JSON[_0x28b0('0x15')](_0x4335b4));if(_0x4335b4[_0x28b0('0x16')]){if(_0x4335b4[_0x28b0('0x16')]['code']===0x1f4){logger[_0x28b0('0x16')](_0x28b0('0x11'),_0xb081d4,_0x4335b4[_0x28b0('0x16')][_0x28b0('0x17')]);return _0x1eb3b6(_0x4335b4[_0x28b0('0x16')][_0x28b0('0x17')]);}logger[_0x28b0('0x16')]('MailInteraction,\x20%s,\x20%s',_0xb081d4,_0x4335b4[_0x28b0('0x16')][_0x28b0('0x17')]);return _0x52010b(_0x4335b4[_0x28b0('0x16')][_0x28b0('0x17')]);}else{logger[_0x28b0('0x10')](_0x28b0('0x11'),_0xb081d4,_0x28b0('0x12'));_0x52010b(_0x4335b4[_0x28b0('0x18')][_0x28b0('0x17')]);}})[_0x28b0('0x19')](function(_0x1e899e){logger[_0x28b0('0x16')]('MailInteraction,\x20%s,\x20%s',_0xb081d4,_0x1e899e);_0x1eb3b6(_0x1e899e);});});}exports[_0x28b0('0x1a')]=function(_0x58766b){var _0xbff585=this;return new Promise(function(_0x5294ba,_0x4842a5){return db[_0x28b0('0x1b')][_0x28b0('0x1c')](_0x58766b[_0x28b0('0x1d')],{'raw':_0x58766b[_0x28b0('0x1e')]?_0x58766b[_0x28b0('0x1e')][_0x28b0('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58766b[_0x28b0('0x1e')]?_0x58766b['options'][_0x28b0('0x20')]||null:null,'attributes':_0x58766b['options']?_0x58766b[_0x28b0('0x1e')][_0x28b0('0x21')]||null:null,'limit':_0x58766b['options']?_0x58766b[_0x28b0('0x1e')][_0x28b0('0x22')]||null:null})[_0x28b0('0xf')](function(_0x5ee141){logger[_0x28b0('0x10')](_0x28b0('0x1a'),_0x58766b);logger[_0x28b0('0x13')]('UpdateMailInteraction',_0x58766b,JSON[_0x28b0('0x15')](_0x5ee141));_0x5294ba(_0x5ee141);})[_0x28b0('0x19')](function(_0x473fd4){logger[_0x28b0('0x16')]('UpdateMailInteraction',_0x473fd4[_0x28b0('0x17')],_0x58766b);_0x4842a5(_0xbff585[_0x28b0('0x16')](0x1f4,_0x473fd4[_0x28b0('0x17')]));});});};exports[_0x28b0('0x23')]=function(_0x48bcba){return new Promise(function(_0xaf53f4,_0x38c1e3){return db[_0x28b0('0x1b')][_0x28b0('0x24')]({'where':_0x48bcba[_0x28b0('0x1e')]?_0x48bcba[_0x28b0('0x1e')]['where']||null:null})[_0x28b0('0xf')](function(_0x7333c6){if(_0x7333c6){return _0x7333c6['addTags'](_0x48bcba[_0x28b0('0x1d')][_0x28b0('0x25')],_[_0x28b0('0x26')](_0x48bcba['body'],['ids','id'])||{});}})['spread'](function(_0x1cb412){logger[_0x28b0('0x10')]('AddTags',_0x48bcba);logger[_0x28b0('0x13')](_0x28b0('0x27'),_0x48bcba,JSON[_0x28b0('0x15')](_0x1cb412));_0xaf53f4(_0x1cb412);})[_0x28b0('0x19')](function(_0x41865c){logger[_0x28b0('0x16')]('AddTags',_0x41865c[_0x28b0('0x17')],_0x48bcba);_0x38c1e3(_this[_0x28b0('0x16')](0x1f4,_0x41865c['message']));});});}; \ No newline at end of file +var _0x1bce=['redis','defaults','localhost','socket.io-emitter','register','request','then','info','MailInteraction,\x20%s,\x20%s','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','MailInteraction','body','raw','options','attributes','limit','UpdateMailInteraction','debug','where','addTags','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4a366e,_0x5f172a){var _0x17b84c=function(_0x469bab){while(--_0x469bab){_0x4a366e['push'](_0x4a366e['shift']());}};_0x17b84c(++_0x5f172a);}(_0x1bce,0x73));var _0xe1bc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1bce[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xe1bc('0x0'));var util=require(_0xe1bc('0x1'));var moment=require('moment');var BPromise=require(_0xe1bc('0x2'));var rs=require(_0xe1bc('0x3'));var fs=require('fs');var Redis=require(_0xe1bc('0x4'));var db=require(_0xe1bc('0x5'))['db'];var utils=require(_0xe1bc('0x6'));var logger=require(_0xe1bc('0x7'))(_0xe1bc('0x8'));var config=require(_0xe1bc('0x9'));var jayson=require(_0xe1bc('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0xe1bc('0xb')]=_[_0xe1bc('0xc')](config[_0xe1bc('0xb')],{'host':_0xe1bc('0xd'),'port':0x18eb});var socket=require(_0xe1bc('0xe'))(new Redis(config[_0xe1bc('0xb')]));require('./mailInteraction.socket')[_0xe1bc('0xf')](socket);function respondWithRpcPromise(_0x5718a3,_0x191147,_0x355757){return new BPromise(function(_0x43e2b8,_0x55f429){return client[_0xe1bc('0x10')](_0x5718a3,_0x355757)[_0xe1bc('0x11')](function(_0x5239e0){logger[_0xe1bc('0x12')](_0xe1bc('0x13'),_0x191147,'request\x20sent');logger['debug'](_0xe1bc('0x14'),_0x191147,_0xe1bc('0x15'),JSON[_0xe1bc('0x16')](_0x5239e0));if(_0x5239e0['error']){if(_0x5239e0['error'][_0xe1bc('0x17')]===0x1f4){logger[_0xe1bc('0x18')](_0xe1bc('0x13'),_0x191147,_0x5239e0['error'][_0xe1bc('0x19')]);return _0x55f429(_0x5239e0[_0xe1bc('0x18')][_0xe1bc('0x19')]);}logger[_0xe1bc('0x18')]('MailInteraction,\x20%s,\x20%s',_0x191147,_0x5239e0[_0xe1bc('0x18')]['message']);return _0x43e2b8(_0x5239e0[_0xe1bc('0x18')][_0xe1bc('0x19')]);}else{logger['info'](_0xe1bc('0x13'),_0x191147,_0xe1bc('0x15'));_0x43e2b8(_0x5239e0[_0xe1bc('0x1a')][_0xe1bc('0x19')]);}})[_0xe1bc('0x1b')](function(_0x47620e){logger['error'](_0xe1bc('0x13'),_0x191147,_0x47620e);_0x55f429(_0x47620e);});});}exports['UpdateMailInteraction']=function(_0x6fbd46){var _0x25c548=this;return new Promise(function(_0x417a37,_0x1d222c){return db[_0xe1bc('0x1c')]['update'](_0x6fbd46[_0xe1bc('0x1d')],{'raw':_0x6fbd46['options']?_0x6fbd46['options'][_0xe1bc('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6fbd46[_0xe1bc('0x1f')]?_0x6fbd46['options']['where']||null:null,'attributes':_0x6fbd46[_0xe1bc('0x1f')]?_0x6fbd46[_0xe1bc('0x1f')][_0xe1bc('0x20')]||null:null,'limit':_0x6fbd46[_0xe1bc('0x1f')]?_0x6fbd46[_0xe1bc('0x1f')][_0xe1bc('0x21')]||null:null})[_0xe1bc('0x11')](function(_0x374bb9){logger[_0xe1bc('0x12')](_0xe1bc('0x22'),_0x6fbd46);logger[_0xe1bc('0x23')](_0xe1bc('0x22'),_0x6fbd46,JSON[_0xe1bc('0x16')](_0x374bb9));_0x417a37(_0x374bb9);})['catch'](function(_0x4dd024){logger[_0xe1bc('0x18')]('UpdateMailInteraction',_0x4dd024[_0xe1bc('0x19')],_0x6fbd46);_0x1d222c(_0x25c548['error'](0x1f4,_0x4dd024[_0xe1bc('0x19')]));});});};exports['AddTagsToMailInteraction']=function(_0x552101){return new Promise(function(_0x2fdb27,_0x3958a4){return db['MailInteraction']['find']({'where':_0x552101[_0xe1bc('0x1f')]?_0x552101[_0xe1bc('0x1f')][_0xe1bc('0x24')]||null:null})[_0xe1bc('0x11')](function(_0x45451d){if(_0x45451d){return _0x45451d[_0xe1bc('0x25')](_0x552101[_0xe1bc('0x1d')][_0xe1bc('0x26')],_[_0xe1bc('0x27')](_0x552101['body'],[_0xe1bc('0x26'),'id'])||{});}})[_0xe1bc('0x28')](function(_0x2033b7){logger['info'](_0xe1bc('0x29'),_0x552101);logger[_0xe1bc('0x23')](_0xe1bc('0x29'),_0x552101,JSON[_0xe1bc('0x16')](_0x2033b7));_0x2fdb27(_0x2033b7);})[_0xe1bc('0x1b')](function(_0x52287d){logger[_0xe1bc('0x18')]('AddTags',_0x52287d['message'],_0x552101);_0x3958a4(_this[_0xe1bc('0x18')](0x1f4,_0x52287d[_0xe1bc('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 831973b..fdbb134 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 _0xa5ff=['save','remove','removeListener','register','mailInteraction:','./mailInteraction.events'];(function(_0x4adda2,_0x16ace6){var _0x55aadb=function(_0x20c309){while(--_0x20c309){_0x4adda2['push'](_0x4adda2['shift']());}};_0x55aadb(++_0x16ace6);}(_0xa5ff,0x11f));var _0xfa5f=function(_0x4be9a2,_0x53c91f){_0x4be9a2=_0x4be9a2-0x0;var _0x5292f3=_0xa5ff[_0x4be9a2];return _0x5292f3;};'use strict';var MailInteractionEvents=require(_0xfa5f('0x0'));var events=[_0xfa5f('0x1'),_0xfa5f('0x2'),'update'];function createListener(_0x36e8be,_0x2498ee){return function(_0x2c2786){_0x2498ee['emit'](_0x36e8be,_0x2c2786);};}function removeListener(_0x2b7aff,_0xea2ba2){return function(){MailInteractionEvents[_0xfa5f('0x3')](_0x2b7aff,_0xea2ba2);};}exports[_0xfa5f('0x4')]=function(_0x2d73c0){for(var _0x28c693=0x0,_0xadd16f=events['length'];_0x28c693<_0xadd16f;_0x28c693++){var _0x2154e4=events[_0x28c693];var _0xbfcf9f=createListener(_0xfa5f('0x5')+_0x2154e4,_0x2d73c0);MailInteractionEvents['on'](_0x2154e4,_0xbfcf9f);}}; \ No newline at end of file +var _0x3531=['removeListener','length','save'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x3531,0x1b5));var _0x1353=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0x3531[_0x2160a9];return _0xa88cf7;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x1353('0x0'),'remove','update'];function createListener(_0x332754,_0x22b911){return function(_0xf548bb){_0x22b911['emit'](_0x332754,_0xf548bb);};}function removeListener(_0x6d0009,_0x888556){return function(){MailInteractionEvents[_0x1353('0x1')](_0x6d0009,_0x888556);};}exports['register']=function(_0x5e5cfa){for(var _0x28919e=0x0,_0x3980c0=events[_0x1353('0x2')];_0x28919e<_0x3980c0;_0x28919e++){var _0x42ca1c=events[_0x28919e];var _0x3ce919=createListener('mailInteraction:'+_0x42ca1c,_0x5e5cfa);MailInteractionEvents['on'](_0x42ca1c,_0x3ce919);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index c6a3efe..070a60d 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 _0x35ff=['/:id/reject','reject','delete','destroy','util','path','express','Router','../../components/auth/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','describe','/:id','show','/:id/download','download','post','mail','mailmessage:create','create','put','update'];(function(_0x58244c,_0x48fce7){var _0x4c179d=function(_0x58741f){while(--_0x58741f){_0x58244c['push'](_0x58244c['shift']());}};_0x4c179d(++_0x48fce7);}(_0x35ff,0xb3));var _0xf35f=function(_0x243ef5,_0x4008c5){_0x243ef5=_0x243ef5-0x0;var _0x1ef6c9=_0x35ff[_0x243ef5];return _0x1ef6c9;};'use strict';var multer=require('multer');var util=require(_0xf35f('0x0'));var path=require(_0xf35f('0x1'));var timeout=require('connect-timeout');var express=require(_0xf35f('0x2'));var router=express[_0xf35f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf35f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf35f('0x5'));var controller=require(_0xf35f('0x6'));router[_0xf35f('0x7')]('/',auth[_0xf35f('0x8')](),controller[_0xf35f('0x9')]);router[_0xf35f('0x7')]('/describe',auth[_0xf35f('0x8')](),controller[_0xf35f('0xa')]);router[_0xf35f('0x7')](_0xf35f('0xb'),auth['isAuthenticated'](),controller[_0xf35f('0xc')]);router[_0xf35f('0x7')](_0xf35f('0xd'),auth[_0xf35f('0x8')](),controller[_0xf35f('0xe')]);router[_0xf35f('0xf')]('/',auth[_0xf35f('0x8')](),interaction['tracked'](_0xf35f('0x10'),_0xf35f('0x11')),controller[_0xf35f('0x12')]);router[_0xf35f('0x13')](_0xf35f('0xb'),auth[_0xf35f('0x8')](),controller[_0xf35f('0x14')]);router[_0xf35f('0x13')]('/:id/accept',auth[_0xf35f('0x8')](),controller['accept']);router[_0xf35f('0x13')](_0xf35f('0x15'),auth['isAuthenticated'](),controller[_0xf35f('0x16')]);router[_0xf35f('0x17')](_0xf35f('0xb'),auth[_0xf35f('0x8')](),controller[_0xf35f('0x18')]);module['exports']=router; \ No newline at end of file +var _0x06a0=['download','post','tracked','mail','mailmessage:create','create','put','update','/:id/accept','accept','/:id/reject','destroy','exports','multer','path','Router','fs-extra','../../components/auth/service','./mailMessage.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/download'];(function(_0xf9240c,_0x15371e){var _0x476d17=function(_0x2be27a){while(--_0x2be27a){_0xf9240c['push'](_0xf9240c['shift']());}};_0x476d17(++_0x15371e);}(_0x06a0,0x1e1));var _0x006a=function(_0x395b58,_0x23518d){_0x395b58=_0x395b58-0x0;var _0x43c80a=_0x06a0[_0x395b58];return _0x43c80a;};'use strict';var multer=require(_0x006a('0x0'));var util=require('util');var path=require(_0x006a('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x006a('0x2')]();var fs_extra=require(_0x006a('0x3'));var auth=require(_0x006a('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x006a('0x5'));router[_0x006a('0x6')]('/',auth[_0x006a('0x7')](),controller[_0x006a('0x8')]);router[_0x006a('0x6')](_0x006a('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x006a('0x6')](_0x006a('0xa'),auth[_0x006a('0x7')](),controller[_0x006a('0xb')]);router[_0x006a('0x6')](_0x006a('0xc'),auth[_0x006a('0x7')](),controller[_0x006a('0xd')]);router[_0x006a('0xe')]('/',auth[_0x006a('0x7')](),interaction[_0x006a('0xf')](_0x006a('0x10'),_0x006a('0x11')),controller[_0x006a('0x12')]);router[_0x006a('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x006a('0x14')]);router[_0x006a('0x13')](_0x006a('0x15'),auth[_0x006a('0x7')](),controller[_0x006a('0x16')]);router[_0x006a('0x13')](_0x006a('0x17'),auth['isAuthenticated'](),controller['reject']);router['delete']('/:id',auth[_0x006a('0x7')](),controller[_0x006a('0x18')]);module[_0x006a('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index d685e9e..544f286 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 _0x020f=['INTEGER','Email','sequelize','lodash','exports','TEXT','long','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x2ddf87,_0x3abd99){var _0x3f5262=function(_0x5d8a4c){while(--_0x5d8a4c){_0x2ddf87['push'](_0x2ddf87['shift']());}};_0x3f5262(++_0x3abd99);}(_0x020f,0x92));var _0xf020=function(_0x20ca39,_0x3b523d){_0x20ca39=_0x20ca39-0x0;var _0x3594d0=_0x020f[_0x20ca39];return _0x3594d0;};'use strict';var Sequelize=require(_0xf020('0x0'));var _=require(_0xf020('0x1'));module[_0xf020('0x2')]={'body':{'type':Sequelize[_0xf020('0x3')](_0xf020('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xf020('0x3')]('medium')},'read':{'type':Sequelize[_0xf020('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf020('0x6')]('in',_0xf020('0x7')),'defaultValue':_0xf020('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0xf020('0x8')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xf020('0x3')](_0xf020('0x4'))},'cc':{'type':Sequelize[_0xf020('0x3')]('long')},'bcc':{'type':Sequelize['TEXT'](_0xf020('0x4'))},'subject':{'type':Sequelize[_0xf020('0x3')]},'sentAt':{'type':Sequelize[_0xf020('0x9')]},'attach':{'type':Sequelize[_0xf020('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0xf020('0x3')](_0xf020('0x4'))},'originCc':{'type':Sequelize['TEXT'](_0xf020('0x4'))},'originChannel':{'type':Sequelize[_0xf020('0x6')](_0xf020('0xb'),'Chat'),'defaultValue':_0xf020('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0xdd92=['lodash','exports','TEXT','long','BOOLEAN','ENUM','out','STRING','DATE','INTEGER','Email'];(function(_0x1fe9d4,_0x4b7768){var _0x26b4bc=function(_0x43f22a){while(--_0x43f22a){_0x1fe9d4['push'](_0x1fe9d4['shift']());}};_0x26b4bc(++_0x4b7768);}(_0xdd92,0x16b));var _0x2dd9=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xdd92[_0x255d5b];return _0x3e141a;};'use strict';var Sequelize=require('sequelize');var _=require(_0x2dd9('0x0'));module[_0x2dd9('0x1')]={'body':{'type':Sequelize[_0x2dd9('0x2')](_0x2dd9('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x2dd9('0x2')]('medium')},'read':{'type':Sequelize[_0x2dd9('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2dd9('0x5')]('in',_0x2dd9('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x2dd9('0x7')](0x1fe)},'from':{'type':Sequelize[_0x2dd9('0x7')]},'to':{'type':Sequelize[_0x2dd9('0x2')](_0x2dd9('0x3'))},'cc':{'type':Sequelize[_0x2dd9('0x2')]('long')},'bcc':{'type':Sequelize[_0x2dd9('0x2')](_0x2dd9('0x3'))},'subject':{'type':Sequelize[_0x2dd9('0x2')]},'sentAt':{'type':Sequelize[_0x2dd9('0x8')]},'attach':{'type':Sequelize[_0x2dd9('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x2dd9('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x2dd9('0x8')]},'originTo':{'type':Sequelize[_0x2dd9('0x2')](_0x2dd9('0x3'))},'originCc':{'type':Sequelize[_0x2dd9('0x2')](_0x2dd9('0x3'))},'originChannel':{'type':Sequelize[_0x2dd9('0x5')](_0x2dd9('0xa'),'Chat'),'defaultValue':_0x2dd9('0xa'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 695f1b3..71957f6 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 _0x34e8=['message','info','catch','status','json','offset','undefined','limit','count','set','Content-Range','destroy','end','sendStatus','name','send','index','map','MailMessage','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','findAll','rows','show','params','length','include','find','body','create','direction','out','secret','MailAccount','findOne','CmList','List','CmContact','Contacts','DESC','MailServerOut','Smtp','isNil','service','host','port','secure','authentication','auth','user','pass','attachments','join','root','server/files/attachments','basename','ListId','sendMail','update','messageId','YYYY-MM-DD\x20HH:mm:ss','accept','readAt','UserId','agent','get','MailInteraction','MailInteractionId','format','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal','SIP/%s','channel','fromString','EventManager','acceptmessage','reject','mail','RejectMessage','rejectMessage','email','interface','event','rejectmessage','download','unix','toString','files','tmp','server','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','build','writeFileSync','unlinkSync','eml-format','moment','bluebird','util','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','jayson/promise','client','http','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x323d87,_0x4ef3f9){var _0x5e8f74=function(_0x185735){while(--_0x185735){_0x323d87['push'](_0x323d87['shift']());}};_0x5e8f74(++_0x4ef3f9);}(_0x34e8,0x12c));var _0x834e=function(_0x2f714c,_0x23a175){_0x2f714c=_0x2f714c-0x0;var _0x321ba0=_0x34e8[_0x2f714c];return _0x321ba0;};'use strict';var emlformat=require(_0x834e('0x0'));var moment=require(_0x834e('0x1'));var BPromise=require(_0x834e('0x2'));var util=require(_0x834e('0x3'));var path=require('path');var fs=require('fs');var _=require(_0x834e('0x4'));var Redis=require(_0x834e('0x5'));var htmlToText=require(_0x834e('0x6'));var qs=require(_0x834e('0x7'));var logger=require(_0x834e('0x8'))(_0x834e('0x9'));var interaction_log=require(_0x834e('0x8'))('mail-interactions');var config=require(_0x834e('0xa'));var db=require('../../mysqldb')['db'];config[_0x834e('0xb')]=_[_0x834e('0xc')](config[_0x834e('0xb')],{'host':_0x834e('0xd'),'port':0x18eb});var socket=require(_0x834e('0xe'))(new Redis(config[_0x834e('0xb')]));require(_0x834e('0xf'))[_0x834e('0x10')](socket);var jayson=require(_0x834e('0x11'));var client=jayson[_0x834e('0x12')][_0x834e('0x13')]({'port':0x232c});var client9003=jayson[_0x834e('0x12')][_0x834e('0x13')]({'port':0x232b});var client9002=jayson[_0x834e('0x12')][_0x834e('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x1e00de,_0x2fd95c,_0x538bb3,_0x5e5b6d){return new BPromise(function(_0x6cd9b9,_0x58a27e){var _0x23848e=_0x5e5b6d||client;return _0x23848e[_0x834e('0x14')](_0x1e00de,_0x538bb3)[_0x834e('0x15')](function(_0x21cc0a){logger['info'](_0x834e('0x16'),_0x2fd95c,_0x834e('0x17'));logger['debug'](_0x834e('0x18'),_0x2fd95c,'request\x20sent',JSON[_0x834e('0x19')](_0x21cc0a));if(_0x21cc0a[_0x834e('0x1a')]){if(_0x21cc0a['error'][_0x834e('0x1b')]===0x1f4){logger[_0x834e('0x1a')](_0x834e('0x16'),_0x2fd95c,_0x21cc0a['error'][_0x834e('0x1c')]);return _0x58a27e(_0x21cc0a[_0x834e('0x1a')][_0x834e('0x1c')]);}logger[_0x834e('0x1a')](_0x834e('0x16'),_0x2fd95c,_0x21cc0a[_0x834e('0x1a')][_0x834e('0x1c')]);return _0x6cd9b9(_0x21cc0a['error'][_0x834e('0x1c')]);}else{logger[_0x834e('0x1d')](_0x834e('0x16'),_0x2fd95c,_0x834e('0x17'));_0x6cd9b9(_0x21cc0a['result'][_0x834e('0x1c')]);}})[_0x834e('0x1e')](function(_0x5a05c0){logger[_0x834e('0x1a')](_0x834e('0x16'),_0x2fd95c,_0x5a05c0);_0x58a27e(_0x5a05c0);});});}function respondWithResult(_0x8d406e,_0x5c55ca){_0x5c55ca=_0x5c55ca||0xc8;return function(_0x4e3f48){if(_0x4e3f48){return _0x8d406e[_0x834e('0x1f')](_0x5c55ca)[_0x834e('0x20')](_0x4e3f48);}};}function respondWithFilteredResult(_0x589dde,_0x25ee1d){return function(_0x1dc1e0){if(_0x1dc1e0){var _0x58f4fd=typeof _0x25ee1d[_0x834e('0x21')]===_0x834e('0x22')&&typeof _0x25ee1d[_0x834e('0x23')]==='undefined';var _0x24fcf7=_0x1dc1e0[_0x834e('0x24')];var _0x5e1cc5=_0x58f4fd?0x0:_0x25ee1d['offset'];var _0x1e713a=_0x58f4fd?_0x1dc1e0['count']:_0x25ee1d[_0x834e('0x21')]+_0x25ee1d[_0x834e('0x23')];var _0x3db026;if(_0x1e713a>=_0x24fcf7){_0x1e713a=_0x24fcf7;_0x3db026=0xc8;}else{_0x3db026=0xce;}_0x589dde[_0x834e('0x1f')](_0x3db026);return _0x589dde[_0x834e('0x25')](_0x834e('0x26'),_0x5e1cc5+'-'+_0x1e713a+'/'+_0x24fcf7)['json'](_0x1dc1e0);}return null;};}function saveUpdates(_0x510780){return function(_0x4dc64a){if(_0x4dc64a){return _0x4dc64a['update'](_0x510780)[_0x834e('0x15')](function(_0x567cea){return _0x567cea;});}return null;};}function removeEntity(_0x106d6a){return function(_0x5dacc1){if(_0x5dacc1){return _0x5dacc1[_0x834e('0x27')]()[_0x834e('0x15')](function(){_0x106d6a[_0x834e('0x1f')](0xcc)[_0x834e('0x28')]();});}};}function handleEntityNotFound(_0x4551f5){return function(_0x390119){if(!_0x390119){_0x4551f5[_0x834e('0x29')](0x194);}return _0x390119;};}function handleError(_0xfaf716,_0x278db3){_0x278db3=_0x278db3||0x1f4;return function(_0x493289){logger[_0x834e('0x1a')](_0x493289['stack']);if(_0x493289[_0x834e('0x2a')]){delete _0x493289[_0x834e('0x2a')];}_0xfaf716[_0x834e('0x1f')](_0x278db3)[_0x834e('0x2b')](_0x493289);};}exports[_0x834e('0x2c')]=function(_0x4689c2,_0x4696a1){var _0x38cd29={},_0x358c31={},_0x12b2bc={'count':0x0,'rows':[]};var _0x5bd232=_[_0x834e('0x2d')](db[_0x834e('0x2e')][_0x834e('0x2f')],function(_0xaf01f4){return{'name':_0xaf01f4['fieldName'],'type':_0xaf01f4[_0x834e('0x30')][_0x834e('0x31')]};});_0x358c31['model']=_['map'](_0x5bd232,'name');_0x358c31[_0x834e('0x32')]=_[_0x834e('0x33')](_0x4689c2[_0x834e('0x32')]);_0x358c31[_0x834e('0x34')]=_[_0x834e('0x35')](_0x358c31[_0x834e('0x36')],_0x358c31['query']);_0x38cd29[_0x834e('0x37')]=_['intersection'](_0x358c31[_0x834e('0x36')],qs[_0x834e('0x38')](_0x4689c2['query'][_0x834e('0x38')]));_0x38cd29[_0x834e('0x37')]=_0x38cd29['attributes']['length']?_0x38cd29[_0x834e('0x37')]:_0x358c31[_0x834e('0x36')];if(!_0x4689c2[_0x834e('0x32')][_0x834e('0x39')](_0x834e('0x3a'))){_0x38cd29['limit']=qs[_0x834e('0x23')](_0x4689c2['query']['limit']);_0x38cd29[_0x834e('0x21')]=qs['offset'](_0x4689c2[_0x834e('0x32')][_0x834e('0x21')]);}_0x38cd29[_0x834e('0x3b')]=qs[_0x834e('0x3c')](_0x4689c2[_0x834e('0x32')]['sort']);_0x38cd29[_0x834e('0x3d')]=qs[_0x834e('0x34')](_[_0x834e('0x3e')](_0x4689c2['query'],_0x358c31[_0x834e('0x34')]),_0x5bd232);if(_0x4689c2[_0x834e('0x32')]['filter']){_0x38cd29[_0x834e('0x3d')]=_['merge'](_0x38cd29[_0x834e('0x3d')],{'$or':_[_0x834e('0x2d')](_0x5bd232,function(_0x4a18bb){if(_0x4a18bb['type']!==_0x834e('0x3f')){var _0x16969b={};_0x16969b[_0x4a18bb[_0x834e('0x2a')]]={'$like':'%'+_0x4689c2[_0x834e('0x32')][_0x834e('0x40')]+'%'};return _0x16969b;}})});}_0x38cd29=_[_0x834e('0x41')]({},_0x38cd29,_0x4689c2[_0x834e('0x42')]);var _0x4a3381={'where':_0x38cd29[_0x834e('0x3d')]};return db['MailMessage'][_0x834e('0x24')](_0x4a3381)['then'](function(_0x1df5b0){_0x12b2bc['count']=_0x1df5b0;if(_0x4689c2[_0x834e('0x32')][_0x834e('0x43')]){_0x38cd29['include']=[{'all':!![]}];}return db[_0x834e('0x2e')][_0x834e('0x44')](_0x38cd29);})[_0x834e('0x15')](function(_0xd55cc3){_0x12b2bc[_0x834e('0x45')]=_0xd55cc3;return _0x12b2bc;})[_0x834e('0x15')](respondWithFilteredResult(_0x4696a1,_0x38cd29))[_0x834e('0x1e')](handleError(_0x4696a1,null));};exports[_0x834e('0x46')]=function(_0x5dc63b,_0x279ea1){var _0x5f3943={'raw':!![],'where':{'id':_0x5dc63b[_0x834e('0x47')]['id']}},_0x3124be={};_0x3124be['model']=_[_0x834e('0x33')](db[_0x834e('0x2e')][_0x834e('0x2f')]);_0x3124be[_0x834e('0x32')]=_[_0x834e('0x33')](_0x5dc63b[_0x834e('0x32')]);_0x3124be['filters']=_['intersection'](_0x3124be[_0x834e('0x36')],_0x3124be[_0x834e('0x32')]);_0x5f3943[_0x834e('0x37')]=_[_0x834e('0x35')](_0x3124be[_0x834e('0x36')],qs[_0x834e('0x38')](_0x5dc63b[_0x834e('0x32')][_0x834e('0x38')]));_0x5f3943[_0x834e('0x37')]=_0x5f3943[_0x834e('0x37')][_0x834e('0x48')]?_0x5f3943[_0x834e('0x37')]:_0x3124be[_0x834e('0x36')];if(_0x5dc63b[_0x834e('0x32')][_0x834e('0x43')]){_0x5f3943[_0x834e('0x49')]=[{'all':!![]}];}_0x5f3943=_[_0x834e('0x41')]({},_0x5f3943,_0x5dc63b[_0x834e('0x42')]);return db[_0x834e('0x2e')][_0x834e('0x4a')](_0x5f3943)['then'](handleEntityNotFound(_0x279ea1,null))[_0x834e('0x15')](respondWithResult(_0x279ea1,null))[_0x834e('0x1e')](handleError(_0x279ea1,null));};exports['update']=function(_0x3c00a3,_0x3b0988){if(_0x3c00a3['body']['id']){delete _0x3c00a3[_0x834e('0x4b')]['id'];}return db[_0x834e('0x2e')][_0x834e('0x4a')]({'where':{'id':_0x3c00a3[_0x834e('0x47')]['id']}})[_0x834e('0x15')](handleEntityNotFound(_0x3b0988,null))[_0x834e('0x15')](saveUpdates(_0x3c00a3[_0x834e('0x4b')],null))['then'](respondWithResult(_0x3b0988,null))[_0x834e('0x1e')](handleError(_0x3b0988,null));};exports[_0x834e('0x27')]=function(_0x3e0550,_0x363675){return db[_0x834e('0x2e')][_0x834e('0x4a')]({'where':{'id':_0x3e0550[_0x834e('0x47')]['id']}})[_0x834e('0x15')](handleEntityNotFound(_0x363675,null))['then'](removeEntity(_0x363675,null))[_0x834e('0x1e')](handleError(_0x363675,null));};exports['describe']=function(_0x2f4bde,_0x53a9ee){return db[_0x834e('0x2e')]['describe']()['then'](respondWithResult(_0x53a9ee,null))[_0x834e('0x1e')](handleError(_0x53a9ee,null));};exports[_0x834e('0x4c')]=function(_0x5291ae,_0x5be43d){return db[_0x834e('0x2e')][_0x834e('0x4c')](_0x5291ae[_0x834e('0x4b')])[_0x834e('0x15')](function(_0x21c417){if(_0x21c417){if(_0x21c417[_0x834e('0x4d')]===_0x834e('0x4e')&&!_0x21c417[_0x834e('0x4f')]){var _0x528e66,_0x142334,_0x3c70bf;if(_0x5291ae['body']['to']){_0x142334=_0x5291ae[_0x834e('0x4b')]['to']['split'](',')[0x0];}return db[_0x834e('0x50')][_0x834e('0x51')]({'where':{'id':_0x21c417['MailAccountId']},'include':[{'model':db[_0x834e('0x52')],'as':_0x834e('0x53'),'include':[{'model':db[_0x834e('0x54')],'as':_0x834e('0x55'),'where':{'email':_0x142334},'limit':0x1,'order':[['updatedAt',_0x834e('0x56')]]}]},{'model':db[_0x834e('0x57')],'as':_0x834e('0x58'),'raw':!![]}]})['then'](function(_0x246b8e){_0x528e66=_0x246b8e;if(_0x528e66&&_0x528e66[_0x834e('0x58')]){var _0x3a7683={'tls':{'rejectUnauthorized':![]}};if(_[_0x834e('0x59')](_0x528e66[_0x834e('0x58')][_0x834e('0x5a')])){_0x3a7683[_0x834e('0x5b')]=_0x528e66[_0x834e('0x58')][_0x834e('0x5b')];_0x3a7683[_0x834e('0x5c')]=_0x528e66[_0x834e('0x58')][_0x834e('0x5c')];_0x3a7683[_0x834e('0x5d')]=_0x528e66[_0x834e('0x58')][_0x834e('0x5d')];if(_0x528e66[_0x834e('0x58')][_0x834e('0x5e')]){_0x3a7683[_0x834e('0x5f')]={'user':_0x528e66[_0x834e('0x58')][_0x834e('0x60')],'pass':_0x528e66[_0x834e('0x58')][_0x834e('0x61')]};}}else{_0x3a7683['service']=_0x528e66[_0x834e('0x58')][_0x834e('0x5a')];_0x3a7683[_0x834e('0x5f')]={'user':_0x528e66[_0x834e('0x58')]['user'],'pass':_0x528e66[_0x834e('0x58')]['pass']};_0x3a7683['secure']=_0x528e66[_0x834e('0x58')][_0x834e('0x5d')];}if(_0x5291ae[_0x834e('0x4b')][_0x834e('0x62')]&&_0x5291ae[_0x834e('0x4b')][_0x834e('0x62')][_0x834e('0x48')]){for(var _0xe5c8f6=0x0;_0xe5c8f6<_0x5291ae['body'][_0x834e('0x62')]['length'];_0xe5c8f6+=0x1){_0x5291ae[_0x834e('0x4b')][_0x834e('0x62')][_0xe5c8f6]={'filename':_0x5291ae['body']['attachments'][_0xe5c8f6][_0x834e('0x2a')],'path':path[_0x834e('0x63')](config[_0x834e('0x64')],_0x834e('0x65'),_0x5291ae[_0x834e('0x4b')]['attachments'][_0xe5c8f6][_0x834e('0x66')])};}}_0x3c70bf={'account':_0x3a7683,'message':_0x5291ae[_0x834e('0x4b')]};return;}})[_0x834e('0x15')](function(){if(_0x528e66[_0x834e('0x53')]){if(_0x528e66[_0x834e('0x53')][_0x834e('0x55')][_0x834e('0x48')]){return _0x528e66[_0x834e('0x53')][_0x834e('0x55')][0x0];}else{return db[_0x834e('0x54')]['create'](_[_0x834e('0xc')](_0x5291ae[_0x834e('0x4b')],{'firstName':_0x5291ae[_0x834e('0x4b')]['to'],'email':_0x5291ae[_0x834e('0x4b')]['to'],'phone':_0x5291ae['body']['to'],'ListId':_0x528e66[_0x834e('0x67')]}));}}else{throw new Error('List\x20not\x20found');}})['then'](function(){if(_0x3c70bf){return respondWithRpcPromise('SendMail',_0x834e('0x68'),_0x3c70bf,client9003)[_0x834e('0x15')](function(_0x514aac){return _0x21c417[_0x834e('0x69')]({'read':!![],'messageId':_0x514aac[_0x834e('0x6a')],'sentAt':moment()['format'](_0x834e('0x6b'))});})[_0x834e('0x1e')](function(_0x4b88e7){logger['error']('%s',JSON[_0x834e('0x19')](_0x4b88e7));return _0x21c417;});}return _0x21c417;});}return _0x21c417;}})[_0x834e('0x15')](respondWithResult(_0x5be43d,0xc9))[_0x834e('0x1e')](handleError(_0x5be43d,null));};exports[_0x834e('0x6c')]=function(_0x1d8e7,_0x493239){var _0x264a6f={'agent':{},'channel':'mail'};if(_0x1d8e7[_0x834e('0x4b')]['id']){delete _0x1d8e7[_0x834e('0x4b')]['id'];}_0x1d8e7[_0x834e('0x4b')]['read']=!![];_0x1d8e7[_0x834e('0x4b')][_0x834e('0x6d')]=moment()['format'](_0x834e('0x6b'));_0x1d8e7[_0x834e('0x4b')][_0x834e('0x6e')]=_0x1d8e7['body'][_0x834e('0x6e')]||_0x1d8e7[_0x834e('0x60')]['id'];_0x264a6f[_0x834e('0x6f')]['id']=_0x1d8e7[_0x834e('0x4b')][_0x834e('0x6e')];return db[_0x834e('0x2e')][_0x834e('0x4a')]({'where':{'id':_0x1d8e7[_0x834e('0x47')]['id'],'UserId':null}})[_0x834e('0x15')](handleEntityNotFound(_0x493239,null))[_0x834e('0x15')](saveUpdates(_0x1d8e7['body'],null))['then'](function(_0x4e466e){if(_0x4e466e){_0x264a6f[_0x834e('0x1c')]=_0x4e466e[_0x834e('0x70')]({'plain':!![]});return db[_0x834e('0x71')][_0x834e('0x4a')]({'where':{'id':_0x4e466e[_0x834e('0x72')]}});}return null;})['then'](handleEntityNotFound(_0x493239,null))['then'](function(_0x4520fc){if(_0x4520fc){return _0x4520fc[_0x834e('0x69')]({'UserId':_0x1d8e7[_0x834e('0x4b')][_0x834e('0x6e')],'read1stAt':_[_0x834e('0x59')](_0x4520fc['read1stAt'])?moment()[_0x834e('0x73')](_0x834e('0x6b')):undefined});}return null;})[_0x834e('0x15')](function(_0x4e1735){if(_0x4e1735){_0x264a6f[_0x834e('0x74')]=_0x4e1735[_0x834e('0x70')]({'plain':!![]});interaction_log[_0x834e('0x1d')](_0x834e('0x75'),_0x1d8e7[_0x834e('0x60')]['id'],_0x1d8e7['user']['name'],_0x1d8e7[_0x834e('0x60')][_0x834e('0x76')],_0x264a6f['interaction']['id'],_0x1d8e7[_0x834e('0x4b')]?JSON['stringify'](_0x1d8e7[_0x834e('0x4b')]):_0x834e('0x77'));return respondWithRpcPromise(_0x834e('0x78'),'acceptMessage',_0x264a6f);}return null;})[_0x834e('0x15')](function(_0x49e721){var _0x5b2621='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x49e721[_0x834e('0x1c')][_0x834e('0x79')];return db[_0x834e('0x7a')][_0x834e('0x32')](_0x5b2621,{'type':db[_0x834e('0x7b')][_0x834e('0x7c')][_0x834e('0x7d')],'raw':!![]})[_0x834e('0x15')](function(_0x17e61a){return _0x17e61a;});})['then'](function(_0x2f775a){if(_0x2f775a){_0x264a6f['message'][_0x834e('0x7e')]=_0x2f775a[0x0];if(!_0x1d8e7[_0x834e('0x4b')][_0x834e('0x6e')])return;return db[_0x834e('0x7f')][_0x834e('0x4a')]({'where':{'id':_0x1d8e7[_0x834e('0x4b')]['UserId'],'role':'agent'},'attributes':['id',_0x834e('0x2a'),_0x834e('0x80'),'email',_0x834e('0x81')],'raw':!![]});}return null;})[_0x834e('0x15')](function(_0x1bc5d1){if(!_0x1bc5d1)return null;_0x264a6f[_0x834e('0x1c')][_0x834e('0x6f')]=_0x1bc5d1;return _0x264a6f;})['then'](function(_0x29839d){if(_0x29839d){if(_0x1d8e7[_0x834e('0x4b')]['manual']){_0x264a6f['message']['interface']=util[_0x834e('0x73')](_0x834e('0x82'),_0x1d8e7['user'][_0x834e('0x2a')]);_0x264a6f[_0x834e('0x1c')]['channel']=_0x264a6f[_0x834e('0x83')];_0x264a6f['message']['event']=_0x834e('0x6c');_0x264a6f[_0x834e('0x1c')][_0x834e('0x4b')]=htmlToText[_0x834e('0x84')](_0x264a6f['message'][_0x834e('0x4b')]);return respondWithRpcPromise(_0x834e('0x85'),_0x834e('0x85'),{'event':_0x834e('0x86'),'message':_0x264a6f[_0x834e('0x1c')]},client9002)[_0x834e('0x15')](function(){return _0x264a6f;});}return _0x264a6f;}return null;})[_0x834e('0x15')](respondWithResult(_0x493239,null))[_0x834e('0x1e')](handleError(_0x493239,null));};exports[_0x834e('0x87')]=function(_0x2821fe,_0x2fa64c){var _0x261e3d={'agent':{},'channel':_0x834e('0x88')};if(_0x2821fe[_0x834e('0x4b')]['id']){delete _0x2821fe[_0x834e('0x4b')]['id'];}_0x2821fe[_0x834e('0x4b')][_0x834e('0x6e')]=_0x2821fe[_0x834e('0x4b')][_0x834e('0x6e')]||_0x2821fe[_0x834e('0x60')]['id'];_0x261e3d[_0x834e('0x6f')]['id']=_0x2821fe[_0x834e('0x4b')]['UserId'];return db[_0x834e('0x2e')][_0x834e('0x4a')]({'where':{'id':_0x2821fe[_0x834e('0x47')]['id'],'UserId':null}})[_0x834e('0x15')](handleEntityNotFound(_0x2fa64c,null))[_0x834e('0x15')](function(_0x3bcdcd){if(_0x3bcdcd){_0x261e3d[_0x834e('0x1c')]=_0x3bcdcd[_0x834e('0x70')]({'plain':!![]});return db[_0x834e('0x71')]['find']({'where':{'id':_0x3bcdcd['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x2fa64c,null))[_0x834e('0x15')](function(_0x493e1f){if(_0x493e1f){_0x261e3d[_0x834e('0x74')]=_0x493e1f[_0x834e('0x70')]({'plain':!![]});interaction_log[_0x834e('0x1d')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2821fe[_0x834e('0x60')]['id'],_0x2821fe[_0x834e('0x60')][_0x834e('0x2a')],_0x2821fe[_0x834e('0x60')][_0x834e('0x76')],_0x261e3d[_0x834e('0x74')]['id'],_0x2821fe['body']?JSON[_0x834e('0x19')](_0x2821fe[_0x834e('0x4b')]):_0x834e('0x77'));return respondWithRpcPromise(_0x834e('0x89'),_0x834e('0x8a'),_0x261e3d);}return null;})['then'](function(_0x4ebeba){var _0x508b3e='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4ebeba[_0x834e('0x1c')][_0x834e('0x79')];return db['sequelize'][_0x834e('0x32')](_0x508b3e,{'type':db[_0x834e('0x7b')]['QueryTypes'][_0x834e('0x7d')],'raw':!![]})[_0x834e('0x15')](function(_0xbf7693){return _0xbf7693;});})[_0x834e('0x15')](function(_0x1d1075){if(_0x1d1075){_0x261e3d[_0x834e('0x1c')]['contact']=_0x1d1075[0x0];if(!_0x2821fe['body'][_0x834e('0x6e')])return;return db[_0x834e('0x7f')][_0x834e('0x4a')]({'where':{'id':_0x2821fe['body'][_0x834e('0x6e')],'role':_0x834e('0x6f')},'attributes':['id','name',_0x834e('0x80'),_0x834e('0x8b'),_0x834e('0x81')],'raw':!![]});}return null;})[_0x834e('0x15')](function(_0x4cb802){if(!_0x4cb802)return null;_0x261e3d[_0x834e('0x1c')]['agent']=_0x4cb802;return _0x261e3d;})['then'](function(_0xc64958){if(_0xc64958){_0xc64958[_0x834e('0x1c')][_0x834e('0x8c')]=util[_0x834e('0x73')](_0x834e('0x82'),_0x2821fe[_0x834e('0x60')]['name']);_0xc64958['message'][_0x834e('0x83')]=_0x261e3d[_0x834e('0x83')];_0xc64958[_0x834e('0x1c')][_0x834e('0x8d')]=_0x834e('0x87');_0xc64958[_0x834e('0x1c')][_0x834e('0x4b')]=htmlToText['fromString'](_0x261e3d[_0x834e('0x1c')][_0x834e('0x4b')]);respondWithRpcPromise('EventManager',_0x834e('0x85'),{'event':_0x834e('0x8e'),'message':_0xc64958[_0x834e('0x1c')]},client9002);return _0x261e3d;}return null;})[_0x834e('0x15')](respondWithResult(_0x2fa64c,null))[_0x834e('0x1e')](handleError(_0x2fa64c,null));};exports[_0x834e('0x8f')]=function(_0x231f0b,_0x3b44f3){var _0x14e794=moment()[_0x834e('0x90')]()[_0x834e('0x91')]();var _0x152372=path[_0x834e('0x63')](config[_0x834e('0x64')],'server',_0x834e('0x92'),_0x834e('0x93'));var _0x522eab=path[_0x834e('0x63')](config['root'],_0x834e('0x94'),'files',_0x834e('0x62'));var _0x560d10=util[_0x834e('0x73')](_0x834e('0x95'),_0x14e794);return db[_0x834e('0x2e')][_0x834e('0x4a')]({'where':{'id':_0x231f0b['params']['id']},'attributes':['id',_0x834e('0x4b'),_0x834e('0x96'),'to','cc',_0x834e('0x97'),_0x834e('0x98'),_0x834e('0x99')],'include':_0x231f0b[_0x834e('0x32')][_0x834e('0x62')]?[{'model':db[_0x834e('0x9a')],'as':_0x834e('0x9b')}]:undefined})[_0x834e('0x15')](handleEntityNotFound(_0x3b44f3,null))[_0x834e('0x15')](function(_0x1cb4d0){if(_0x1cb4d0){var _0x3a6546=_0x1cb4d0;var _0x246f01={'from':_0x3a6546[_0x834e('0x96')],'to':_0x3a6546['to'],'subject':_0x3a6546[_0x834e('0x98')],'html':_0x3a6546[_0x834e('0x4b')],'headers':{'Date':moment(_0x3a6546['createdAt'])['format'](_0x834e('0x9c'))},'attachments':[]};if(_0x1cb4d0['cc']){_0x246f01[_0x834e('0x9d')]['Cc']=_0x1cb4d0['cc'];}if(_0x1cb4d0[_0x834e('0x97')]){_0x246f01[_0x834e('0x9d')][_0x834e('0x9e')]=_0x1cb4d0[_0x834e('0x97')];}return new BPromise(function(_0x22f90d,_0x40fd40){if(_0x1cb4d0[_0x834e('0x9b')]){for(var _0x58cd3b=0x0;_0x58cd3b<_0x1cb4d0[_0x834e('0x9b')][_0x834e('0x48')];_0x58cd3b++){var _0x513d9e=_0x1cb4d0[_0x834e('0x9b')][_0x58cd3b];var _0x54c129=path[_0x834e('0x63')](_0x522eab,_0x513d9e[_0x834e('0x66')]);if(fs[_0x834e('0x9f')](_0x54c129)){_0x246f01['attachments'][_0x834e('0xa0')]({'name':_0x513d9e[_0x834e('0x2a')],'contentType':_0x513d9e['type'],'data':fs['readFileSync'](_0x54c129)});}}}emlformat[_0x834e('0xa1')](_0x246f01,function(_0x3b7b1a,_0x4e0f4d){if(_0x3b7b1a)return _0x40fd40(_0x3b7b1a);fs[_0x834e('0xa2')](path[_0x834e('0x63')](_0x152372,_0x560d10),_0x4e0f4d);return _0x22f90d(_0x4e0f4d);});});}})[_0x834e('0x15')](function(_0x135219){if(_0x135219){return _0x3b44f3[_0x834e('0x8f')](path['join'](_0x152372,_0x560d10),_0x560d10,function(_0x4e7545){if(!_0x4e7545)fs[_0x834e('0xa3')](path['join'](_0x152372,_0x560d10));});}})['catch'](handleError(_0x3b44f3,null));}; \ No newline at end of file +var _0x9957=['../../config/logger','mail-interactions','../../config/environment','../../mysqldb','redis','localhost','./mailMessage.socket','register','jayson/promise','client','http','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','json','offset','undefined','limit','count','status','set','Content-Range','update','end','sendStatus','stack','name','send','index','MailMessage','rawAttributes','fieldName','key','model','map','keys','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','then','includeAll','include','findAll','rows','catch','options','find','params','body','destroy','describe','create','direction','out','secret','split','MailAccount','findOne','List','CmContact','Contacts','updatedAt','MailServerOut','Smtp','isNil','service','host','port','secure','authentication','user','auth','attachments','join','basename','defaults','List\x20not\x20found','SendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','mail','readAt','UserId','get','MailInteraction','MailInteractionId','read1stAt','interaction','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','User','email','internal','interface','SIP/%s','channel','event','accept','fromString','EventManager','reject','agent','rejectMessage','rejectmessage','download','toString','root','server','files','tmp','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','push','build','eml-format','moment','bluebird','util','lodash','ioredis','html-to-text','../../components/parsers/qs','api'];(function(_0x27087e,_0x3bf9a2){var _0x929c77=function(_0x16adaf){while(--_0x16adaf){_0x27087e['push'](_0x27087e['shift']());}};_0x929c77(++_0x3bf9a2);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require(_0x7995('0x0'));var moment=require(_0x7995('0x1'));var BPromise=require(_0x7995('0x2'));var util=require(_0x7995('0x3'));var path=require('path');var fs=require('fs');var _=require(_0x7995('0x4'));var Redis=require(_0x7995('0x5'));var htmlToText=require(_0x7995('0x6'));var qs=require(_0x7995('0x7'));var logger=require('../../config/logger')(_0x7995('0x8'));var interaction_log=require(_0x7995('0x9'))(_0x7995('0xa'));var config=require(_0x7995('0xb'));var db=require(_0x7995('0xc'))['db'];config[_0x7995('0xd')]=_['defaults'](config[_0x7995('0xd')],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7995('0xd')]));require(_0x7995('0xf'))[_0x7995('0x10')](socket);var jayson=require(_0x7995('0x11'));var client=jayson[_0x7995('0x12')][_0x7995('0x13')]({'port':0x232c});var client9003=jayson[_0x7995('0x12')]['http']({'port':0x232b});var client9002=jayson[_0x7995('0x12')][_0x7995('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x581f22,_0xb0c872,_0x2cb37a,_0x19a27e){return new BPromise(function(_0x385f00,_0x281576){var _0x23999f=_0x19a27e||client;return _0x23999f[_0x7995('0x14')](_0x581f22,_0x2cb37a)['then'](function(_0x58f5ad){logger[_0x7995('0x15')](_0x7995('0x16'),_0xb0c872,_0x7995('0x17'));logger[_0x7995('0x18')](_0x7995('0x19'),_0xb0c872,_0x7995('0x17'),JSON[_0x7995('0x1a')](_0x58f5ad));if(_0x58f5ad[_0x7995('0x1b')]){if(_0x58f5ad['error'][_0x7995('0x1c')]===0x1f4){logger['error'](_0x7995('0x16'),_0xb0c872,_0x58f5ad[_0x7995('0x1b')][_0x7995('0x1d')]);return _0x281576(_0x58f5ad[_0x7995('0x1b')][_0x7995('0x1d')]);}logger[_0x7995('0x1b')]('MailMessage,\x20%s,\x20%s',_0xb0c872,_0x58f5ad['error'][_0x7995('0x1d')]);return _0x385f00(_0x58f5ad['error']['message']);}else{logger[_0x7995('0x15')](_0x7995('0x16'),_0xb0c872,'request\x20sent');_0x385f00(_0x58f5ad[_0x7995('0x1e')]['message']);}})['catch'](function(_0x3e4c54){logger[_0x7995('0x1b')](_0x7995('0x16'),_0xb0c872,_0x3e4c54);_0x281576(_0x3e4c54);});});}function respondWithResult(_0x1a8568,_0x460924){_0x460924=_0x460924||0xc8;return function(_0x1c278a){if(_0x1c278a){return _0x1a8568['status'](_0x460924)[_0x7995('0x1f')](_0x1c278a);}};}function respondWithFilteredResult(_0x46ee4b,_0x204507){return function(_0x285437){if(_0x285437){var _0x563799=typeof _0x204507[_0x7995('0x20')]===_0x7995('0x21')&&typeof _0x204507[_0x7995('0x22')]==='undefined';var _0x39df42=_0x285437[_0x7995('0x23')];var _0x401dc3=_0x563799?0x0:_0x204507[_0x7995('0x20')];var _0x3a3fcf=_0x563799?_0x285437[_0x7995('0x23')]:_0x204507['offset']+_0x204507[_0x7995('0x22')];var _0x5911c3;if(_0x3a3fcf>=_0x39df42){_0x3a3fcf=_0x39df42;_0x5911c3=0xc8;}else{_0x5911c3=0xce;}_0x46ee4b[_0x7995('0x24')](_0x5911c3);return _0x46ee4b[_0x7995('0x25')](_0x7995('0x26'),_0x401dc3+'-'+_0x3a3fcf+'/'+_0x39df42)[_0x7995('0x1f')](_0x285437);}return null;};}function saveUpdates(_0x11c1eb){return function(_0x4b6f99){if(_0x4b6f99){return _0x4b6f99[_0x7995('0x27')](_0x11c1eb)['then'](function(_0x456a28){return _0x456a28;});}return null;};}function removeEntity(_0x3250e0){return function(_0x4253e5){if(_0x4253e5){return _0x4253e5['destroy']()['then'](function(){_0x3250e0['status'](0xcc)[_0x7995('0x28')]();});}};}function handleEntityNotFound(_0xe6b0b3){return function(_0x327a81){if(!_0x327a81){_0xe6b0b3[_0x7995('0x29')](0x194);}return _0x327a81;};}function handleError(_0x2e3493,_0x1ca460){_0x1ca460=_0x1ca460||0x1f4;return function(_0x538841){logger['error'](_0x538841[_0x7995('0x2a')]);if(_0x538841['name']){delete _0x538841[_0x7995('0x2b')];}_0x2e3493[_0x7995('0x24')](_0x1ca460)[_0x7995('0x2c')](_0x538841);};}exports[_0x7995('0x2d')]=function(_0x1f7d27,_0x510841){var _0x44309d={},_0x33e24e={},_0x5dd802={'count':0x0,'rows':[]};var _0x48db25=_['map'](db[_0x7995('0x2e')][_0x7995('0x2f')],function(_0x4a176f){return{'name':_0x4a176f[_0x7995('0x30')],'type':_0x4a176f['type'][_0x7995('0x31')]};});_0x33e24e[_0x7995('0x32')]=_[_0x7995('0x33')](_0x48db25,'name');_0x33e24e['query']=_[_0x7995('0x34')](_0x1f7d27['query']);_0x33e24e['filters']=_[_0x7995('0x35')](_0x33e24e[_0x7995('0x32')],_0x33e24e['query']);_0x44309d[_0x7995('0x36')]=_[_0x7995('0x35')](_0x33e24e[_0x7995('0x32')],qs[_0x7995('0x37')](_0x1f7d27[_0x7995('0x38')]['fields']));_0x44309d[_0x7995('0x36')]=_0x44309d[_0x7995('0x36')][_0x7995('0x39')]?_0x44309d[_0x7995('0x36')]:_0x33e24e['model'];if(!_0x1f7d27[_0x7995('0x38')][_0x7995('0x3a')](_0x7995('0x3b'))){_0x44309d[_0x7995('0x22')]=qs[_0x7995('0x22')](_0x1f7d27[_0x7995('0x38')]['limit']);_0x44309d[_0x7995('0x20')]=qs[_0x7995('0x20')](_0x1f7d27[_0x7995('0x38')][_0x7995('0x20')]);}_0x44309d[_0x7995('0x3c')]=qs[_0x7995('0x3d')](_0x1f7d27[_0x7995('0x38')][_0x7995('0x3d')]);_0x44309d[_0x7995('0x3e')]=qs[_0x7995('0x3f')](_[_0x7995('0x40')](_0x1f7d27[_0x7995('0x38')],_0x33e24e[_0x7995('0x3f')]),_0x48db25);if(_0x1f7d27['query']['filter']){_0x44309d[_0x7995('0x3e')]=_[_0x7995('0x41')](_0x44309d['where'],{'$or':_['map'](_0x48db25,function(_0x3f8522){if(_0x3f8522['type']!=='VIRTUAL'){var _0x23da6b={};_0x23da6b[_0x3f8522[_0x7995('0x2b')]]={'$like':'%'+_0x1f7d27[_0x7995('0x38')]['filter']+'%'};return _0x23da6b;}})});}_0x44309d=_[_0x7995('0x41')]({},_0x44309d,_0x1f7d27['options']);var _0x3993b5={'where':_0x44309d['where']};return db['MailMessage'][_0x7995('0x23')](_0x3993b5)[_0x7995('0x42')](function(_0xc04e5){_0x5dd802[_0x7995('0x23')]=_0xc04e5;if(_0x1f7d27['query'][_0x7995('0x43')]){_0x44309d[_0x7995('0x44')]=[{'all':!![]}];}return db[_0x7995('0x2e')][_0x7995('0x45')](_0x44309d);})['then'](function(_0x5f28e7){_0x5dd802[_0x7995('0x46')]=_0x5f28e7;return _0x5dd802;})['then'](respondWithFilteredResult(_0x510841,_0x44309d))[_0x7995('0x47')](handleError(_0x510841,null));};exports['show']=function(_0x2f435e,_0x4c1127){var _0x1e795e={'raw':!![],'where':{'id':_0x2f435e['params']['id']}},_0x1b0373={};_0x1b0373[_0x7995('0x32')]=_[_0x7995('0x34')](db[_0x7995('0x2e')][_0x7995('0x2f')]);_0x1b0373['query']=_[_0x7995('0x34')](_0x2f435e[_0x7995('0x38')]);_0x1b0373[_0x7995('0x3f')]=_['intersection'](_0x1b0373[_0x7995('0x32')],_0x1b0373[_0x7995('0x38')]);_0x1e795e[_0x7995('0x36')]=_[_0x7995('0x35')](_0x1b0373[_0x7995('0x32')],qs['fields'](_0x2f435e[_0x7995('0x38')][_0x7995('0x37')]));_0x1e795e['attributes']=_0x1e795e[_0x7995('0x36')]['length']?_0x1e795e[_0x7995('0x36')]:_0x1b0373[_0x7995('0x32')];if(_0x2f435e[_0x7995('0x38')][_0x7995('0x43')]){_0x1e795e[_0x7995('0x44')]=[{'all':!![]}];}_0x1e795e=_[_0x7995('0x41')]({},_0x1e795e,_0x2f435e[_0x7995('0x48')]);return db['MailMessage'][_0x7995('0x49')](_0x1e795e)[_0x7995('0x42')](handleEntityNotFound(_0x4c1127,null))[_0x7995('0x42')](respondWithResult(_0x4c1127,null))['catch'](handleError(_0x4c1127,null));};exports[_0x7995('0x27')]=function(_0x1fe77e,_0x12d4b8){if(_0x1fe77e['body']['id']){delete _0x1fe77e['body']['id'];}return db['MailMessage'][_0x7995('0x49')]({'where':{'id':_0x1fe77e[_0x7995('0x4a')]['id']}})['then'](handleEntityNotFound(_0x12d4b8,null))[_0x7995('0x42')](saveUpdates(_0x1fe77e[_0x7995('0x4b')],null))[_0x7995('0x42')](respondWithResult(_0x12d4b8,null))[_0x7995('0x47')](handleError(_0x12d4b8,null));};exports[_0x7995('0x4c')]=function(_0x528c8e,_0x29ee32){return db['MailMessage'][_0x7995('0x49')]({'where':{'id':_0x528c8e[_0x7995('0x4a')]['id']}})[_0x7995('0x42')](handleEntityNotFound(_0x29ee32,null))['then'](removeEntity(_0x29ee32,null))['catch'](handleError(_0x29ee32,null));};exports['describe']=function(_0x563f8e,_0x2e13b0){return db[_0x7995('0x2e')][_0x7995('0x4d')]()[_0x7995('0x42')](respondWithResult(_0x2e13b0,null))[_0x7995('0x47')](handleError(_0x2e13b0,null));};exports[_0x7995('0x4e')]=function(_0x1f4270,_0xda6ce8){return db[_0x7995('0x2e')][_0x7995('0x4e')](_0x1f4270[_0x7995('0x4b')])[_0x7995('0x42')](function(_0x3da72b){if(_0x3da72b){if(_0x3da72b[_0x7995('0x4f')]===_0x7995('0x50')&&!_0x3da72b[_0x7995('0x51')]){var _0x447a2b,_0x223e08,_0x45e86e;if(_0x1f4270['body']['to']){_0x223e08=_0x1f4270[_0x7995('0x4b')]['to'][_0x7995('0x52')](',')[0x0];}return db[_0x7995('0x53')][_0x7995('0x54')]({'where':{'id':_0x3da72b['MailAccountId']},'include':[{'model':db['CmList'],'as':_0x7995('0x55'),'include':[{'model':db[_0x7995('0x56')],'as':_0x7995('0x57'),'where':{'email':_0x223e08},'limit':0x1,'order':[[_0x7995('0x58'),'DESC']]}]},{'model':db[_0x7995('0x59')],'as':_0x7995('0x5a'),'raw':!![]}]})[_0x7995('0x42')](function(_0x33c49c){_0x447a2b=_0x33c49c;if(_0x447a2b&&_0x447a2b['Smtp']){var _0x5e2d97={'tls':{'rejectUnauthorized':![]}};if(_[_0x7995('0x5b')](_0x447a2b[_0x7995('0x5a')][_0x7995('0x5c')])){_0x5e2d97[_0x7995('0x5d')]=_0x447a2b[_0x7995('0x5a')][_0x7995('0x5d')];_0x5e2d97[_0x7995('0x5e')]=_0x447a2b[_0x7995('0x5a')][_0x7995('0x5e')];_0x5e2d97['secure']=_0x447a2b[_0x7995('0x5a')][_0x7995('0x5f')];if(_0x447a2b[_0x7995('0x5a')][_0x7995('0x60')]){_0x5e2d97['auth']={'user':_0x447a2b['Smtp'][_0x7995('0x61')],'pass':_0x447a2b[_0x7995('0x5a')]['pass']};}}else{_0x5e2d97[_0x7995('0x5c')]=_0x447a2b[_0x7995('0x5a')][_0x7995('0x5c')];_0x5e2d97[_0x7995('0x62')]={'user':_0x447a2b[_0x7995('0x5a')]['user'],'pass':_0x447a2b[_0x7995('0x5a')]['pass']};_0x5e2d97[_0x7995('0x5f')]=_0x447a2b[_0x7995('0x5a')][_0x7995('0x5f')];}if(_0x1f4270[_0x7995('0x4b')][_0x7995('0x63')]&&_0x1f4270[_0x7995('0x4b')][_0x7995('0x63')][_0x7995('0x39')]){for(var _0x10f012=0x0;_0x10f012<_0x1f4270[_0x7995('0x4b')][_0x7995('0x63')][_0x7995('0x39')];_0x10f012+=0x1){_0x1f4270['body'][_0x7995('0x63')][_0x10f012]={'filename':_0x1f4270[_0x7995('0x4b')][_0x7995('0x63')][_0x10f012][_0x7995('0x2b')],'path':path[_0x7995('0x64')](config['root'],'server/files/attachments',_0x1f4270[_0x7995('0x4b')][_0x7995('0x63')][_0x10f012][_0x7995('0x65')])};}}_0x45e86e={'account':_0x5e2d97,'message':_0x1f4270[_0x7995('0x4b')]};return;}})['then'](function(){if(_0x447a2b[_0x7995('0x55')]){if(_0x447a2b['List']['Contacts'][_0x7995('0x39')]){return _0x447a2b[_0x7995('0x55')][_0x7995('0x57')][0x0];}else{return db[_0x7995('0x56')][_0x7995('0x4e')](_[_0x7995('0x66')](_0x1f4270[_0x7995('0x4b')],{'firstName':_0x1f4270[_0x7995('0x4b')]['to'],'email':_0x1f4270[_0x7995('0x4b')]['to'],'phone':_0x1f4270[_0x7995('0x4b')]['to'],'ListId':_0x447a2b['ListId']}));}}else{throw new Error(_0x7995('0x67'));}})[_0x7995('0x42')](function(){if(_0x45e86e){return respondWithRpcPromise(_0x7995('0x68'),'sendMail',_0x45e86e,client9003)[_0x7995('0x42')](function(_0x1d2f9d){return _0x3da72b[_0x7995('0x27')]({'read':!![],'messageId':_0x1d2f9d[_0x7995('0x69')],'sentAt':moment()[_0x7995('0x6a')](_0x7995('0x6b'))});})[_0x7995('0x47')](function(_0x3adfd2){logger[_0x7995('0x1b')]('%s',JSON[_0x7995('0x1a')](_0x3adfd2));return _0x3da72b;});}return _0x3da72b;});}return _0x3da72b;}})[_0x7995('0x42')](respondWithResult(_0xda6ce8,0xc9))['catch'](handleError(_0xda6ce8,null));};exports['accept']=function(_0xd07c1c,_0xfe1105){var _0x39ebb6={'agent':{},'channel':_0x7995('0x6c')};if(_0xd07c1c['body']['id']){delete _0xd07c1c[_0x7995('0x4b')]['id'];}_0xd07c1c[_0x7995('0x4b')]['read']=!![];_0xd07c1c['body'][_0x7995('0x6d')]=moment()[_0x7995('0x6a')]('YYYY-MM-DD\x20HH:mm:ss');_0xd07c1c[_0x7995('0x4b')]['UserId']=_0xd07c1c[_0x7995('0x4b')][_0x7995('0x6e')]||_0xd07c1c['user']['id'];_0x39ebb6['agent']['id']=_0xd07c1c[_0x7995('0x4b')]['UserId'];return db[_0x7995('0x2e')][_0x7995('0x49')]({'where':{'id':_0xd07c1c[_0x7995('0x4a')]['id'],'UserId':null}})[_0x7995('0x42')](handleEntityNotFound(_0xfe1105,null))[_0x7995('0x42')](saveUpdates(_0xd07c1c[_0x7995('0x4b')],null))[_0x7995('0x42')](function(_0x14cb17){if(_0x14cb17){_0x39ebb6[_0x7995('0x1d')]=_0x14cb17[_0x7995('0x6f')]({'plain':!![]});return db[_0x7995('0x70')][_0x7995('0x49')]({'where':{'id':_0x14cb17[_0x7995('0x71')]}});}return null;})[_0x7995('0x42')](handleEntityNotFound(_0xfe1105,null))[_0x7995('0x42')](function(_0x3773de){if(_0x3773de){return _0x3773de[_0x7995('0x27')]({'UserId':_0xd07c1c[_0x7995('0x4b')][_0x7995('0x6e')],'read1stAt':_[_0x7995('0x5b')](_0x3773de[_0x7995('0x72')])?moment()[_0x7995('0x6a')](_0x7995('0x6b')):undefined});}return null;})[_0x7995('0x42')](function(_0x260ef1){if(_0x260ef1){_0x39ebb6[_0x7995('0x73')]=_0x260ef1[_0x7995('0x6f')]({'plain':!![]});interaction_log[_0x7995('0x15')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xd07c1c[_0x7995('0x61')]['id'],_0xd07c1c[_0x7995('0x61')]['name'],_0xd07c1c['user'][_0x7995('0x74')],_0x39ebb6[_0x7995('0x73')]['id'],_0xd07c1c[_0x7995('0x4b')]?JSON[_0x7995('0x1a')](_0xd07c1c[_0x7995('0x4b')]):_0x7995('0x75'));return respondWithRpcPromise('AcceptMessage',_0x7995('0x76'),_0x39ebb6);}return null;})[_0x7995('0x42')](function(_0x3fea6a){var _0x77b03f=_0x7995('0x77')+_0x3fea6a[_0x7995('0x1d')][_0x7995('0x78')];return db[_0x7995('0x79')]['query'](_0x77b03f,{'type':db[_0x7995('0x7a')][_0x7995('0x7b')]['SELECT'],'raw':!![]})['then'](function(_0xd24c64){return _0xd24c64;});})[_0x7995('0x42')](function(_0x18e1a2){if(_0x18e1a2){_0x39ebb6[_0x7995('0x1d')][_0x7995('0x7c')]=_0x18e1a2[0x0];if(!_0xd07c1c['body'][_0x7995('0x6e')])return;return db[_0x7995('0x7d')]['find']({'where':{'id':_0xd07c1c[_0x7995('0x4b')][_0x7995('0x6e')],'role':'agent'},'attributes':['id',_0x7995('0x2b'),'fullname',_0x7995('0x7e'),_0x7995('0x7f')],'raw':!![]});}return null;})[_0x7995('0x42')](function(_0x428a1b){if(!_0x428a1b)return null;_0x39ebb6[_0x7995('0x1d')]['agent']=_0x428a1b;return _0x39ebb6;})[_0x7995('0x42')](function(_0x345080){if(_0x345080){if(_0xd07c1c[_0x7995('0x4b')]['manual']){_0x39ebb6[_0x7995('0x1d')][_0x7995('0x80')]=util[_0x7995('0x6a')](_0x7995('0x81'),_0xd07c1c['user'][_0x7995('0x2b')]);_0x39ebb6[_0x7995('0x1d')][_0x7995('0x82')]=_0x39ebb6['channel'];_0x39ebb6['message'][_0x7995('0x83')]=_0x7995('0x84');_0x39ebb6['message']['body']=htmlToText[_0x7995('0x85')](_0x39ebb6[_0x7995('0x1d')][_0x7995('0x4b')]);return respondWithRpcPromise(_0x7995('0x86'),_0x7995('0x86'),{'event':'acceptmessage','message':_0x39ebb6['message']},client9002)[_0x7995('0x42')](function(){return _0x39ebb6;});}return _0x39ebb6;}return null;})['then'](respondWithResult(_0xfe1105,null))['catch'](handleError(_0xfe1105,null));};exports[_0x7995('0x87')]=function(_0x3b731e,_0x3192b8){var _0x5eb360={'agent':{},'channel':_0x7995('0x6c')};if(_0x3b731e[_0x7995('0x4b')]['id']){delete _0x3b731e[_0x7995('0x4b')]['id'];}_0x3b731e[_0x7995('0x4b')][_0x7995('0x6e')]=_0x3b731e['body'][_0x7995('0x6e')]||_0x3b731e[_0x7995('0x61')]['id'];_0x5eb360[_0x7995('0x88')]['id']=_0x3b731e[_0x7995('0x4b')]['UserId'];return db[_0x7995('0x2e')][_0x7995('0x49')]({'where':{'id':_0x3b731e['params']['id'],'UserId':null}})[_0x7995('0x42')](handleEntityNotFound(_0x3192b8,null))[_0x7995('0x42')](function(_0x5b1528){if(_0x5b1528){_0x5eb360[_0x7995('0x1d')]=_0x5b1528['get']({'plain':!![]});return db[_0x7995('0x70')]['find']({'where':{'id':_0x5b1528[_0x7995('0x71')]}});}return null;})['then'](handleEntityNotFound(_0x3192b8,null))[_0x7995('0x42')](function(_0x20f48c){if(_0x20f48c){_0x5eb360['interaction']=_0x20f48c[_0x7995('0x6f')]({'plain':!![]});interaction_log['info']('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3b731e[_0x7995('0x61')]['id'],_0x3b731e[_0x7995('0x61')][_0x7995('0x2b')],_0x3b731e[_0x7995('0x61')]['role'],_0x5eb360[_0x7995('0x73')]['id'],_0x3b731e[_0x7995('0x4b')]?JSON['stringify'](_0x3b731e['body']):_0x7995('0x75'));return respondWithRpcPromise('RejectMessage',_0x7995('0x89'),_0x5eb360);}return null;})[_0x7995('0x42')](function(_0xfb4479){var _0x5b42be='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xfb4479[_0x7995('0x1d')]['ContactId'];return db[_0x7995('0x79')][_0x7995('0x38')](_0x5b42be,{'type':db[_0x7995('0x7a')][_0x7995('0x7b')]['SELECT'],'raw':!![]})['then'](function(_0x50f880){return _0x50f880;});})[_0x7995('0x42')](function(_0x340a57){if(_0x340a57){_0x5eb360[_0x7995('0x1d')][_0x7995('0x7c')]=_0x340a57[0x0];if(!_0x3b731e[_0x7995('0x4b')][_0x7995('0x6e')])return;return db['User']['find']({'where':{'id':_0x3b731e[_0x7995('0x4b')]['UserId'],'role':'agent'},'attributes':['id',_0x7995('0x2b'),'fullname','email',_0x7995('0x7f')],'raw':!![]});}return null;})[_0x7995('0x42')](function(_0x3873f3){if(!_0x3873f3)return null;_0x5eb360['message'][_0x7995('0x88')]=_0x3873f3;return _0x5eb360;})[_0x7995('0x42')](function(_0x1c4d23){if(_0x1c4d23){_0x1c4d23[_0x7995('0x1d')][_0x7995('0x80')]=util[_0x7995('0x6a')](_0x7995('0x81'),_0x3b731e[_0x7995('0x61')][_0x7995('0x2b')]);_0x1c4d23['message'][_0x7995('0x82')]=_0x5eb360[_0x7995('0x82')];_0x1c4d23[_0x7995('0x1d')][_0x7995('0x83')]=_0x7995('0x87');_0x1c4d23['message'][_0x7995('0x4b')]=htmlToText[_0x7995('0x85')](_0x5eb360[_0x7995('0x1d')]['body']);respondWithRpcPromise('EventManager','EventManager',{'event':_0x7995('0x8a'),'message':_0x1c4d23[_0x7995('0x1d')]},client9002);return _0x5eb360;}return null;})[_0x7995('0x42')](respondWithResult(_0x3192b8,null))[_0x7995('0x47')](handleError(_0x3192b8,null));};exports[_0x7995('0x8b')]=function(_0x3ad47c,_0x4dd64a){var _0x46d263=moment()['unix']()[_0x7995('0x8c')]();var _0xa2baa9=path[_0x7995('0x64')](config[_0x7995('0x8d')],_0x7995('0x8e'),_0x7995('0x8f'),_0x7995('0x90'));var _0x24a0e6=path[_0x7995('0x64')](config[_0x7995('0x8d')],_0x7995('0x8e'),'files',_0x7995('0x63'));var _0x57f875=util[_0x7995('0x6a')](_0x7995('0x91'),_0x46d263);return db['MailMessage']['find']({'where':{'id':_0x3ad47c[_0x7995('0x4a')]['id']},'attributes':['id',_0x7995('0x4b'),_0x7995('0x92'),'to','cc',_0x7995('0x93'),_0x7995('0x94'),_0x7995('0x95')],'include':_0x3ad47c[_0x7995('0x38')][_0x7995('0x63')]?[{'model':db[_0x7995('0x96')],'as':_0x7995('0x97')}]:undefined})[_0x7995('0x42')](handleEntityNotFound(_0x4dd64a,null))[_0x7995('0x42')](function(_0x5eb2d9){if(_0x5eb2d9){var _0x5380e6=_0x5eb2d9;var _0x41b0d5={'from':_0x5380e6[_0x7995('0x92')],'to':_0x5380e6['to'],'subject':_0x5380e6[_0x7995('0x94')],'html':_0x5380e6[_0x7995('0x4b')],'headers':{'Date':moment(_0x5380e6[_0x7995('0x95')])['format'](_0x7995('0x98'))},'attachments':[]};if(_0x5eb2d9['cc']){_0x41b0d5[_0x7995('0x99')]['Cc']=_0x5eb2d9['cc'];}if(_0x5eb2d9['bcc']){_0x41b0d5[_0x7995('0x99')]['Bcc']=_0x5eb2d9[_0x7995('0x93')];}return new BPromise(function(_0x30cda5,_0x234a40){if(_0x5eb2d9['Attachments']){for(var _0x3501ac=0x0;_0x3501ac<_0x5eb2d9[_0x7995('0x97')][_0x7995('0x39')];_0x3501ac++){var _0x15ca94=_0x5eb2d9[_0x7995('0x97')][_0x3501ac];var _0x8a5aa8=path[_0x7995('0x64')](_0x24a0e6,_0x15ca94['basename']);if(fs['existsSync'](_0x8a5aa8)){_0x41b0d5['attachments'][_0x7995('0x9a')]({'name':_0x15ca94[_0x7995('0x2b')],'contentType':_0x15ca94['type'],'data':fs['readFileSync'](_0x8a5aa8)});}}}emlformat[_0x7995('0x9b')](_0x41b0d5,function(_0xe4389c,_0x48d4a7){if(_0xe4389c)return _0x234a40(_0xe4389c);fs['writeFileSync'](path['join'](_0xa2baa9,_0x57f875),_0x48d4a7);return _0x30cda5(_0x48d4a7);});});}})['then'](function(_0x1c4af5){if(_0x1c4af5){return _0x4dd64a[_0x7995('0x8b')](path[_0x7995('0x64')](_0xa2baa9,_0x57f875),_0x57f875,function(_0x421e44){if(!_0x421e44)fs['unlinkSync'](path[_0x7995('0x64')](_0xa2baa9,_0x57f875));});}})[_0x7995('0x47')](handleError(_0x4dd64a,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 5a7ad90..cfeea88 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 _0xc6b0=['exports','../../mysqldb','setMaxListeners','update','emit','hasOwnProperty','hook'];(function(_0xf3cc49,_0x44e324){var _0x3aca1c=function(_0x32d9ca){while(--_0x32d9ca){_0xf3cc49['push'](_0xf3cc49['shift']());}};_0x3aca1c(++_0x44e324);}(_0xc6b0,0x120));var _0x0c6b=function(_0x3cb5f1,_0x48c50e){_0x3cb5f1=_0x3cb5f1-0x0;var _0x31d0c9=_0xc6b0[_0x3cb5f1];return _0x31d0c9;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x0c6b('0x0'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x0c6b('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0c6b('0x2'),'afterDestroy':'remove'};function emitEvent(_0x13cfd6){return function(_0x1ad61a,_0x2ba221,_0x3f1165){MailMessageEvents['emit'](_0x13cfd6+':'+_0x1ad61a['id'],_0x1ad61a);MailMessageEvents[_0x0c6b('0x3')](_0x13cfd6,_0x1ad61a);_0x3f1165(null);};}for(var e in events){if(events[_0x0c6b('0x4')](e)){var event=events[e];MailMessage[_0x0c6b('0x5')](e,emitEvent(event));}}module[_0x0c6b('0x6')]=MailMessageEvents; \ No newline at end of file +var _0xb529=['remove','emit','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb529,0xa6));var _0x9b52=function(_0x1765a8,_0x17b200){_0x1765a8=_0x1765a8-0x0;var _0x10b151=_0xb529[_0x1765a8];return _0x10b151;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x9b52('0x0'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x9b52('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x9b52('0x2')};function emitEvent(_0x56ba74){return function(_0x4d14a2,_0x3eed21,_0x77bd8b){MailMessageEvents[_0x9b52('0x3')](_0x56ba74+':'+_0x4d14a2['id'],_0x4d14a2);MailMessageEvents[_0x9b52('0x3')](_0x56ba74,_0x4d14a2);_0x77bd8b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x9b52('0x4')](e,emitEvent(event));}}module[_0x9b52('0x5')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index be819dd..d2f3636 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 _0x3a95=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','exports','define','mail_messages','messageId','fti_mail_messages','subject','FULLTEXT','plainBody','models','get','toLowerCase','direction','isNil','UserId','then','update','createdAt','error','utf8mb4'];(function(_0x1da61a,_0x13a481){var _0x180b7d=function(_0x2c0220){while(--_0x2c0220){_0x1da61a['push'](_0x1da61a['shift']());}};_0x180b7d(++_0x13a481);}(_0x3a95,0xf9));var _0x53a9=function(_0x2ee48d,_0x23d6da){_0x2ee48d=_0x2ee48d-0x0;var _0x417217=_0x3a95[_0x2ee48d];return _0x417217;};'use strict';var _=require(_0x53a9('0x0'));var util=require(_0x53a9('0x1'));var logger=require(_0x53a9('0x2'))(_0x53a9('0x3'));var moment=require(_0x53a9('0x4'));var BPromise=require(_0x53a9('0x5'));var rp=require(_0x53a9('0x6'));var htmlToText=require(_0x53a9('0x7'));var fs=require('fs');var path=require(_0x53a9('0x8'));var rimraf=require(_0x53a9('0x9'));var config=require(_0x53a9('0xa'));var attributes=require('./mailMessage.attributes');module[_0x53a9('0xb')]=function(_0x3c336d,_0x36b977){return _0x3c336d[_0x53a9('0xc')]('MailMessage',attributes,{'tableName':_0x53a9('0xd'),'paranoid':![],'indexes':[{'name':_0x53a9('0xe'),'fields':['messageId']},{'name':_0x53a9('0xf'),'fields':['plainBody',_0x53a9('0x10')],'type':_0x53a9('0x11')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x422271,_0x1c99a2,_0x471e0f){if(_0x422271['body']){_0x422271[_0x53a9('0x12')]=htmlToText['fromString'](_0x422271['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x471e0f(null,_0x1c99a2);},'afterCreate':function(_0x3d0f59,_0x40501b,_0x159d9c){var _0x1958a3=_0x3c336d[_0x53a9('0x13')];var _0x228471=_0x3d0f59[_0x53a9('0x14')]({'plain':!![]});if(_0x228471['direction'][_0x53a9('0x15')]()==='in'||_0x228471[_0x53a9('0x16')][_0x53a9('0x15')]()==='out'&&!_0x228471['secret']&&!_[_0x53a9('0x17')](_0x228471[_0x53a9('0x18')])){_0x1958a3['MailInteraction']['findOne']({'where':{'id':_0x228471['MailInteractionId']}})[_0x53a9('0x19')](function(_0x5846f1){if(_0x5846f1){_0x5846f1[_0x53a9('0x1a')]({'lastMsgAt':_0x228471[_0x53a9('0x1b')],'lastMsgDirection':_0x228471[_0x53a9('0x16')][_0x53a9('0x15')]()});}})['catch'](function(_0xfcaa5f){console[_0x53a9('0x1c')](_0xfcaa5f);});}_0x159d9c();}},'charset':_0x53a9('0x1d'),'collate':_0x53a9('0x1e')});}; \ No newline at end of file +var _0x97d2=['request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','get','direction','toLowerCase','secret','isNil','MailInteraction','findOne','then','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment'];(function(_0x1fd087,_0x5ef851){var _0x5af75d=function(_0x48f6f9){while(--_0x48f6f9){_0x1fd087['push'](_0x1fd087['shift']());}};_0x5af75d(++_0x5ef851);}(_0x97d2,0xc3));var _0x297d=function(_0x57217c,_0x4a7f95){_0x57217c=_0x57217c-0x0;var _0x3c199f=_0x97d2[_0x57217c];return _0x3c199f;};'use strict';var _=require('lodash');var util=require(_0x297d('0x0'));var logger=require(_0x297d('0x1'))('api');var moment=require(_0x297d('0x2'));var BPromise=require('bluebird');var rp=require(_0x297d('0x3'));var htmlToText=require(_0x297d('0x4'));var fs=require('fs');var path=require(_0x297d('0x5'));var rimraf=require(_0x297d('0x6'));var config=require(_0x297d('0x7'));var attributes=require(_0x297d('0x8'));module[_0x297d('0x9')]=function(_0x113552,_0x66d207){return _0x113552[_0x297d('0xa')]('MailMessage',attributes,{'tableName':_0x297d('0xb'),'paranoid':![],'indexes':[{'name':_0x297d('0xc'),'fields':['messageId']},{'name':_0x297d('0xd'),'fields':[_0x297d('0xe'),_0x297d('0xf')],'type':_0x297d('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x48cf89,_0x29ea6e,_0x2a39b3){if(_0x48cf89[_0x297d('0x11')]){_0x48cf89[_0x297d('0xe')]=htmlToText[_0x297d('0x12')](_0x48cf89[_0x297d('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x2a39b3(null,_0x29ea6e);},'afterCreate':function(_0x235939,_0x370355,_0x21aee1){var _0x9501ba=_0x113552[_0x297d('0x13')];var _0x5c1e1b=_0x235939[_0x297d('0x14')]({'plain':!![]});if(_0x5c1e1b[_0x297d('0x15')][_0x297d('0x16')]()==='in'||_0x5c1e1b[_0x297d('0x15')][_0x297d('0x16')]()==='out'&&!_0x5c1e1b[_0x297d('0x17')]&&!_[_0x297d('0x18')](_0x5c1e1b['UserId'])){_0x9501ba[_0x297d('0x19')][_0x297d('0x1a')]({'where':{'id':_0x5c1e1b['MailInteractionId']}})[_0x297d('0x1b')](function(_0x2f5f3a){if(_0x2f5f3a){_0x2f5f3a[_0x297d('0x1c')]({'lastMsgAt':_0x5c1e1b[_0x297d('0x1d')],'lastMsgDirection':_0x5c1e1b[_0x297d('0x15')][_0x297d('0x16')]()});}})[_0x297d('0x1e')](function(_0x3edfe3){console['error'](_0x3edfe3);});}_0x21aee1();}},'charset':_0x297d('0x1f'),'collate':_0x297d('0x20')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index fd6203c..0c0964a 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 _0x77e6=['catch','CreateMailMessage','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','redis','localhost','socket.io-emitter','./mailMessage.socket','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x1773f7,_0x54318f){var _0x1983fb=function(_0x50b543){while(--_0x50b543){_0x1773f7['push'](_0x1773f7['shift']());}};_0x1983fb(++_0x54318f);}(_0x77e6,0x1a6));var _0x677e=function(_0x53a7f4,_0x21fb1f){_0x53a7f4=_0x53a7f4-0x0;var _0x1a4403=_0x77e6[_0x53a7f4];return _0x1a4403;};'use strict';var _=require(_0x677e('0x0'));var util=require(_0x677e('0x1'));var moment=require(_0x677e('0x2'));var BPromise=require(_0x677e('0x3'));var rs=require(_0x677e('0x4'));var fs=require('fs');var Redis=require(_0x677e('0x5'));var db=require(_0x677e('0x6'))['db'];var utils=require(_0x677e('0x7'));var logger=require('../../config/logger')(_0x677e('0x8'));var config=require(_0x677e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x677e('0xa')]['http']({'port':0x232a});config[_0x677e('0xb')]=_['defaults'](config['redis'],{'host':_0x677e('0xc'),'port':0x18eb});var socket=require(_0x677e('0xd'))(new Redis(config[_0x677e('0xb')]));require(_0x677e('0xe'))['register'](socket);function respondWithRpcPromise(_0x206305,_0x5bf52d,_0x3cdbe3){return new BPromise(function(_0x227084,_0x1e4fd9){return client[_0x677e('0xf')](_0x206305,_0x3cdbe3)[_0x677e('0x10')](function(_0x49ca35){logger[_0x677e('0x11')](_0x677e('0x12'),_0x5bf52d,_0x677e('0x13'));logger[_0x677e('0x14')](_0x677e('0x15'),_0x5bf52d,_0x677e('0x13'),JSON[_0x677e('0x16')](_0x49ca35));if(_0x49ca35[_0x677e('0x17')]){if(_0x49ca35['error']['code']===0x1f4){logger['error'](_0x677e('0x12'),_0x5bf52d,_0x49ca35[_0x677e('0x17')][_0x677e('0x18')]);return _0x1e4fd9(_0x49ca35[_0x677e('0x17')][_0x677e('0x18')]);}logger[_0x677e('0x17')](_0x677e('0x12'),_0x5bf52d,_0x49ca35[_0x677e('0x17')][_0x677e('0x18')]);return _0x227084(_0x49ca35[_0x677e('0x17')][_0x677e('0x18')]);}else{logger[_0x677e('0x11')]('MailMessage,\x20%s,\x20%s',_0x5bf52d,_0x677e('0x13'));_0x227084(_0x49ca35[_0x677e('0x19')][_0x677e('0x18')]);}})[_0x677e('0x1a')](function(_0xba1c26){logger[_0x677e('0x17')]('MailMessage,\x20%s,\x20%s',_0x5bf52d,_0xba1c26);_0x1e4fd9(_0xba1c26);});});}exports[_0x677e('0x1b')]=function(_0x4bfbb6){var _0x18424e=this;return new Promise(function(_0x267aac,_0x26e9c5){return db['MailMessage'][_0x677e('0x1c')](_0x4bfbb6[_0x677e('0x1d')],{'raw':_0x4bfbb6[_0x677e('0x1e')]?_0x4bfbb6[_0x677e('0x1e')][_0x677e('0x1f')]===undefined?!![]:![]:!![]})[_0x677e('0x10')](function(_0x3a7895){logger['info']('CreateMailMessage',_0x4bfbb6);logger['debug'](_0x677e('0x1b'),_0x4bfbb6,JSON[_0x677e('0x16')](_0x3a7895));_0x267aac(_0x3a7895);})[_0x677e('0x1a')](function(_0x540d0e){logger[_0x677e('0x17')](_0x677e('0x1b'),_0x540d0e[_0x677e('0x18')],_0x4bfbb6);_0x26e9c5(_0x18424e[_0x677e('0x17')](0x1f4,_0x540d0e[_0x677e('0x18')]));});});}; \ No newline at end of file +var _0x5fdc=['catch','CreateMailMessage','MailMessage','create','body','options','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./mailMessage.socket','register','request','then','MailMessage,\x20%s,\x20%s','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result'];(function(_0x526fb1,_0x1d0359){var _0x33582f=function(_0x2df327){while(--_0x2df327){_0x526fb1['push'](_0x526fb1['shift']());}};_0x33582f(++_0x1d0359);}(_0x5fdc,0x127));var _0xc5fd=function(_0x56b9a3,_0x433e01){_0x56b9a3=_0x56b9a3-0x0;var _0x58a880=_0x5fdc[_0x56b9a3];return _0x58a880;};'use strict';var _=require(_0xc5fd('0x0'));var util=require(_0xc5fd('0x1'));var moment=require(_0xc5fd('0x2'));var BPromise=require(_0xc5fd('0x3'));var rs=require(_0xc5fd('0x4'));var fs=require('fs');var Redis=require(_0xc5fd('0x5'));var db=require(_0xc5fd('0x6'))['db'];var utils=require(_0xc5fd('0x7'));var logger=require(_0xc5fd('0x8'))(_0xc5fd('0x9'));var config=require(_0xc5fd('0xa'));var jayson=require(_0xc5fd('0xb'));var client=jayson[_0xc5fd('0xc')][_0xc5fd('0xd')]({'port':0x232a});config[_0xc5fd('0xe')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc5fd('0xf'))(new Redis(config[_0xc5fd('0xe')]));require(_0xc5fd('0x10'))[_0xc5fd('0x11')](socket);function respondWithRpcPromise(_0x4e6d35,_0x4e1e94,_0x3442dd){return new BPromise(function(_0x1edeec,_0x39a95a){return client[_0xc5fd('0x12')](_0x4e6d35,_0x3442dd)[_0xc5fd('0x13')](function(_0x368c80){logger['info'](_0xc5fd('0x14'),_0x4e1e94,'request\x20sent');logger['debug'](_0xc5fd('0x15'),_0x4e1e94,_0xc5fd('0x16'),JSON[_0xc5fd('0x17')](_0x368c80));if(_0x368c80[_0xc5fd('0x18')]){if(_0x368c80[_0xc5fd('0x18')][_0xc5fd('0x19')]===0x1f4){logger[_0xc5fd('0x18')](_0xc5fd('0x14'),_0x4e1e94,_0x368c80['error'][_0xc5fd('0x1a')]);return _0x39a95a(_0x368c80[_0xc5fd('0x18')][_0xc5fd('0x1a')]);}logger[_0xc5fd('0x18')]('MailMessage,\x20%s,\x20%s',_0x4e1e94,_0x368c80['error']['message']);return _0x1edeec(_0x368c80['error']['message']);}else{logger[_0xc5fd('0x1b')](_0xc5fd('0x14'),_0x4e1e94,_0xc5fd('0x16'));_0x1edeec(_0x368c80[_0xc5fd('0x1c')][_0xc5fd('0x1a')]);}})[_0xc5fd('0x1d')](function(_0xfd14c7){logger['error'](_0xc5fd('0x14'),_0x4e1e94,_0xfd14c7);_0x39a95a(_0xfd14c7);});});}exports[_0xc5fd('0x1e')]=function(_0x32eac2){var _0x9c12e4=this;return new Promise(function(_0x3b3093,_0x48024e){return db[_0xc5fd('0x1f')][_0xc5fd('0x20')](_0x32eac2[_0xc5fd('0x21')],{'raw':_0x32eac2[_0xc5fd('0x22')]?_0x32eac2['options']['raw']===undefined?!![]:![]:!![]})[_0xc5fd('0x13')](function(_0x2ab935){logger[_0xc5fd('0x1b')](_0xc5fd('0x1e'),_0x32eac2);logger[_0xc5fd('0x23')](_0xc5fd('0x1e'),_0x32eac2,JSON['stringify'](_0x2ab935));_0x3b3093(_0x2ab935);})[_0xc5fd('0x1d')](function(_0x2701f7){logger[_0xc5fd('0x18')](_0xc5fd('0x1e'),_0x2701f7[_0xc5fd('0x1a')],_0x32eac2);_0x48024e(_0x9c12e4[_0xc5fd('0x18')](0x1f4,_0x2701f7[_0xc5fd('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index ea9fc57..be0843b 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 _0x0e85=['update','removeListener','register','length','mailMessage:','./mailMessage.events','save'];(function(_0x5ab4d0,_0x53e4e1){var _0x246645=function(_0x33acac){while(--_0x33acac){_0x5ab4d0['push'](_0x5ab4d0['shift']());}};_0x246645(++_0x53e4e1);}(_0x0e85,0x7c));var _0x50e8=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0x0e85[_0x19b3f9];return _0x18c3f6;};'use strict';var MailMessageEvents=require(_0x50e8('0x0'));var events=[_0x50e8('0x1'),'remove',_0x50e8('0x2')];function createListener(_0x682d10,_0x55e515){return function(_0x55cba3){_0x55e515['emit'](_0x682d10,_0x55cba3);};}function removeListener(_0x236cf3,_0x4e90e7){return function(){MailMessageEvents[_0x50e8('0x3')](_0x236cf3,_0x4e90e7);};}exports[_0x50e8('0x4')]=function(_0xe3151e){for(var _0xfde42=0x0,_0x5e8b01=events[_0x50e8('0x5')];_0xfde42<_0x5e8b01;_0xfde42++){var _0x108edc=events[_0xfde42];var _0x42665e=createListener(_0x50e8('0x6')+_0x108edc,_0xe3151e);MailMessageEvents['on'](_0x108edc,_0x42665e);}}; \ No newline at end of file +var _0xd698=['length','mailMessage:','./mailMessage.events','save','remove','update','emit'];(function(_0x3578ee,_0x1c853b){var _0x11785c=function(_0x139486){while(--_0x139486){_0x3578ee['push'](_0x3578ee['shift']());}};_0x11785c(++_0x1c853b);}(_0xd698,0xe2));var _0x8d69=function(_0x410291,_0x2b1a15){_0x410291=_0x410291-0x0;var _0x29726b=_0xd698[_0x410291];return _0x29726b;};'use strict';var MailMessageEvents=require(_0x8d69('0x0'));var events=[_0x8d69('0x1'),_0x8d69('0x2'),_0x8d69('0x3')];function createListener(_0x2d68e4,_0x49cd23){return function(_0xc18ae6){_0x49cd23[_0x8d69('0x4')](_0x2d68e4,_0xc18ae6);};}function removeListener(_0x477553,_0x4f98e8){return function(){MailMessageEvents['removeListener'](_0x477553,_0x4f98e8);};}exports['register']=function(_0x13ad5f){for(var _0x940c93=0x0,_0xa8b481=events[_0x8d69('0x5')];_0x940c93<_0xa8b481;_0x940c93++){var _0x2110bb=events[_0x940c93];var _0x19caaa=createListener(_0x8d69('0x6')+_0x2110bb,_0x13ad5f);MailMessageEvents['on'](_0x2110bb,_0x19caaa);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 0440dd4..0d24cad 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 _0xdf90=['../../components/interaction/service','./mailQueue.controller','isAuthenticated','get','describe','/:id','show','/:id/members','getTeams','post','create','/:id/teams','addAgents','delete','destroy','removeTeams','exports','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xdf90,0x171));var _0x0df9=function(_0x2718c7,_0x5a1636){_0x2718c7=_0x2718c7-0x0;var _0x59d89c=_0xdf90[_0x2718c7];return _0x59d89c;};'use strict';var multer=require('multer');var util=require(_0x0df9('0x0'));var path=require(_0x0df9('0x1'));var timeout=require(_0x0df9('0x2'));var express=require('express');var router=express[_0x0df9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0df9('0x4'));var interaction=require(_0x0df9('0x5'));var config=require('../../config/environment');var controller=require(_0x0df9('0x6'));router['get']('/',auth[_0x0df9('0x7')](),controller['index']);router[_0x0df9('0x8')]('/describe',auth[_0x0df9('0x7')](),controller[_0x0df9('0x9')]);router[_0x0df9('0x8')](_0x0df9('0xa'),auth[_0x0df9('0x7')](),controller[_0x0df9('0xb')]);router[_0x0df9('0x8')](_0x0df9('0xc'),auth['isAuthenticated'](),controller['getMembers']);router[_0x0df9('0x8')]('/:id/teams',auth[_0x0df9('0x7')](),controller[_0x0df9('0xd')]);router[_0x0df9('0x8')]('/:id/users',auth[_0x0df9('0x7')](),controller['getAgents']);router[_0x0df9('0xe')]('/',auth[_0x0df9('0x7')](),controller[_0x0df9('0xf')]);router['post'](_0x0df9('0x10'),auth[_0x0df9('0x7')](),controller['addTeams']);router[_0x0df9('0xe')]('/:id/users',auth[_0x0df9('0x7')](),controller[_0x0df9('0x11')]);router['put']('/:id',auth[_0x0df9('0x7')](),controller['update']);router[_0x0df9('0x12')](_0x0df9('0xa'),auth[_0x0df9('0x7')](),controller[_0x0df9('0x13')]);router[_0x0df9('0x12')](_0x0df9('0x10'),auth[_0x0df9('0x7')](),controller[_0x0df9('0x14')]);router[_0x0df9('0x12')]('/:id/users',auth[_0x0df9('0x7')](),controller['removeAgents']);module[_0x0df9('0x15')]=router; \ No newline at end of file +var _0x905a=['removeAgents','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addAgents','put','update','delete','destroy','removeTeams'];(function(_0x48e503,_0x55dd28){var _0x2b3eeb=function(_0x1dc639){while(--_0x1dc639){_0x48e503['push'](_0x48e503['shift']());}};_0x2b3eeb(++_0x55dd28);}(_0x905a,0x98));var _0xa905=function(_0x310cc1,_0x2d5e9f){_0x310cc1=_0x310cc1-0x0;var _0x5919e0=_0x905a[_0x310cc1];return _0x5919e0;};'use strict';var multer=require(_0xa905('0x0'));var util=require('util');var path=require(_0xa905('0x1'));var timeout=require('connect-timeout');var express=require(_0xa905('0x2'));var router=express[_0xa905('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa905('0x4'));var interaction=require(_0xa905('0x5'));var config=require(_0xa905('0x6'));var controller=require(_0xa905('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xa905('0x8')](_0xa905('0x9'),auth[_0xa905('0xa')](),controller[_0xa905('0xb')]);router['get'](_0xa905('0xc'),auth[_0xa905('0xa')](),controller[_0xa905('0xd')]);router[_0xa905('0x8')](_0xa905('0xe'),auth[_0xa905('0xa')](),controller[_0xa905('0xf')]);router['get'](_0xa905('0x10'),auth[_0xa905('0xa')](),controller[_0xa905('0x11')]);router[_0xa905('0x8')](_0xa905('0x12'),auth[_0xa905('0xa')](),controller[_0xa905('0x13')]);router['post']('/',auth[_0xa905('0xa')](),controller[_0xa905('0x14')]);router[_0xa905('0x15')]('/:id/teams',auth[_0xa905('0xa')](),controller['addTeams']);router[_0xa905('0x15')](_0xa905('0x12'),auth[_0xa905('0xa')](),controller[_0xa905('0x16')]);router[_0xa905('0x17')](_0xa905('0xc'),auth[_0xa905('0xa')](),controller[_0xa905('0x18')]);router[_0xa905('0x19')](_0xa905('0xc'),auth[_0xa905('0xa')](),controller[_0xa905('0x1a')]);router[_0xa905('0x19')](_0xa905('0x10'),auth['isAuthenticated'](),controller[_0xa905('0x1b')]);router['delete'](_0xa905('0x12'),auth[_0xa905('0xa')](),controller[_0xa905('0x1c')]);module[_0xa905('0x1d')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 9aa9f4c..09815f8 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 _0xcc34=['ENUM','rrmemory','exports','STRING'];(function(_0x1ad8df,_0x2e1a1f){var _0x42d8b2=function(_0x106f2a){while(--_0x106f2a){_0x1ad8df['push'](_0x1ad8df['shift']());}};_0x42d8b2(++_0x2e1a1f);}(_0xcc34,0xc6));var _0x4cc3=function(_0x54209d,_0xfdc2ae){_0x54209d=_0x54209d-0x0;var _0x51cba5=_0xcc34[_0x54209d];return _0x51cba5;};'use strict';var Sequelize=require('sequelize');module[_0x4cc3('0x0')]={'name':{'type':Sequelize[_0x4cc3('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4cc3('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4cc3('0x2')](_0x4cc3('0x3'),'beepall','roundrobin')}}; \ No newline at end of file +var _0x6c13=['ENUM','rrmemory','sequelize','exports','name','STRING'];(function(_0x11afb0,_0x295c4a){var _0x315d35=function(_0x323c2d){while(--_0x323c2d){_0x11afb0['push'](_0x11afb0['shift']());}};_0x315d35(++_0x295c4a);}(_0x6c13,0xbc));var _0x36c1=function(_0x248e85,_0x313681){_0x248e85=_0x248e85-0x0;var _0x1923b4=_0x6c13[_0x248e85];return _0x1923b4;};'use strict';var Sequelize=require(_0x36c1('0x0'));module[_0x36c1('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x36c1('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x36c1('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x36c1('0x4')](_0x36c1('0x5'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 33cb910..fcaae14 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 _0xcdcc=['mailPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','Team','addTeams','ids','flatMap','transaction','each','forEach','emit','userMailQueue:save','removeTeams','Agents','select','field','tq.TeamId','from','team_has_mail_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','push','sequelize','toString','every','TeamId','includes','all','union','value','removeAgents','addAgents','spread','isArray','userMailQueue:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','update','then','MailQueues','UserProfileResource','destroy','error','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','type','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','intersection','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','getMembers','UserMailQueue','order','MailQueueId','User','UserId','agent'];(function(_0xe57328,_0x2b94c3){var _0x528ed5=function(_0x4f0c12){while(--_0x4f0c12){_0xe57328['push'](_0xe57328['shift']());}};_0x528ed5(++_0x2b94c3);}(_0xcdcc,0x1d2));var _0xccdc=function(_0x3bc696,_0x5ebe3e){_0x3bc696=_0x3bc696-0x0;var _0x6126c8=_0xcdcc[_0x3bc696];return _0x6126c8;};'use strict';var emlformat=require(_0xccdc('0x0'));var rimraf=require(_0xccdc('0x1'));var zipdir=require(_0xccdc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xccdc('0x3'));var moment=require(_0xccdc('0x4'));var BPromise=require(_0xccdc('0x5'));var Mustache=require(_0xccdc('0x6'));var util=require('util');var path=require('path');var sox=require(_0xccdc('0x7'));var csv=require(_0xccdc('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xccdc('0x9'));var _=require('lodash');var squel=require(_0xccdc('0xa'));var crypto=require(_0xccdc('0xb'));var jsforce=require(_0xccdc('0xc'));var deskjs=require(_0xccdc('0xd'));var toCsv=require(_0xccdc('0x8'));var querystring=require('querystring');var Papa=require(_0xccdc('0xe'));var Redis=require(_0xccdc('0xf'));var authService=require(_0xccdc('0x10'));var qs=require(_0xccdc('0x11'));var as=require(_0xccdc('0x12'));var hardwareService=require(_0xccdc('0x13'));var logger=require(_0xccdc('0x14'))('api');var utils=require(_0xccdc('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xccdc('0x16'));var db=require('../../mysqldb')['db'];config[_0xccdc('0x17')]=_[_0xccdc('0x18')](config[_0xccdc('0x17')],{'host':_0xccdc('0x19'),'port':0x18eb});var socket=require(_0xccdc('0x1a'))(new Redis(config[_0xccdc('0x17')]));require(_0xccdc('0x1b'))[_0xccdc('0x1c')](socket);function respondWithStatusCode(_0x41945a,_0x3f53f0){_0x3f53f0=_0x3f53f0||0xcc;return function(_0x40d4ef){if(_0x40d4ef){return _0x41945a[_0xccdc('0x1d')](_0x3f53f0);}return _0x41945a[_0xccdc('0x1e')](_0x3f53f0)['end']();};}function respondWithResult(_0x76cee4,_0x57dbe1){_0x57dbe1=_0x57dbe1||0xc8;return function(_0x375b86){if(_0x375b86){return _0x76cee4['status'](_0x57dbe1)['json'](_0x375b86);}};}function respondWithFilteredResult(_0x3ea0fb,_0x521fa1){return function(_0x7927e3){if(_0x7927e3){var _0x4c768d=typeof _0x521fa1['offset']===_0xccdc('0x1f')&&typeof _0x521fa1[_0xccdc('0x20')]==='undefined';var _0x36fe66=_0x7927e3[_0xccdc('0x21')];var _0x1c29ff=_0x4c768d?0x0:_0x521fa1[_0xccdc('0x22')];var _0x271d0d=_0x4c768d?_0x7927e3[_0xccdc('0x21')]:_0x521fa1[_0xccdc('0x22')]+_0x521fa1[_0xccdc('0x20')];var _0x384345;if(_0x271d0d>=_0x36fe66){_0x271d0d=_0x36fe66;_0x384345=0xc8;}else{_0x384345=0xce;}_0x3ea0fb[_0xccdc('0x1e')](_0x384345);return _0x3ea0fb[_0xccdc('0x23')](_0xccdc('0x24'),_0x1c29ff+'-'+_0x271d0d+'/'+_0x36fe66)[_0xccdc('0x25')](_0x7927e3);}return null;};}function patchUpdates(_0x22c0e8){return function(_0x203838){try{jsonpatch[_0xccdc('0x26')](_0x203838,_0x22c0e8,!![]);}catch(_0xa15c01){return BPromise[_0xccdc('0x27')](_0xa15c01);}return _0x203838['save']();};}function saveUpdates(_0x3e2648,_0xc2ccd0){return function(_0x58c57){if(_0x58c57){return _0x58c57[_0xccdc('0x28')](_0x3e2648)[_0xccdc('0x29')](function(_0x57d7ff){return _0x57d7ff;});}return null;};}function removeEntity(_0x3b624f,_0x40d871){return function(_0x31d4f0){if(_0x31d4f0){return _0x31d4f0['destroy']()[_0xccdc('0x29')](function(){var _0x28d0b2=_0x31d4f0['get']({'plain':!![]});var _0x6c7ba4=_0xccdc('0x2a');return db[_0xccdc('0x2b')][_0xccdc('0x2c')]({'where':{'type':_0x6c7ba4,'resourceId':_0x28d0b2['id']}})['then'](function(){return _0x31d4f0;});})[_0xccdc('0x29')](function(){_0x3b624f[_0xccdc('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x504844,_0x347d98){return function(_0x4f5288){if(!_0x4f5288){_0x504844['sendStatus'](0x194);}return _0x4f5288;};}function handleError(_0x5c783c,_0x4d957c){_0x4d957c=_0x4d957c||0x1f4;return function(_0x28e6b4){logger[_0xccdc('0x2d')](_0x28e6b4[_0xccdc('0x2e')]);if(_0x28e6b4['name']){delete _0x28e6b4[_0xccdc('0x2f')];}_0x5c783c[_0xccdc('0x1e')](_0x4d957c)[_0xccdc('0x30')](_0x28e6b4);};}exports[_0xccdc('0x31')]=function(_0x31265d,_0x3b76af){var _0x37ff48={},_0x5f513b={},_0x14028c={'count':0x0,'rows':[]};var _0x59710d=_[_0xccdc('0x32')](db[_0xccdc('0x33')][_0xccdc('0x34')],function(_0x14f4f0){return{'name':_0x14f4f0[_0xccdc('0x35')],'type':_0x14f4f0[_0xccdc('0x36')]['key']};});_0x5f513b[_0xccdc('0x37')]=_['map'](_0x59710d,'name');_0x5f513b[_0xccdc('0x38')]=_[_0xccdc('0x39')](_0x31265d['query']);_0x5f513b[_0xccdc('0x3a')]=_['intersection'](_0x5f513b[_0xccdc('0x37')],_0x5f513b[_0xccdc('0x38')]);_0x37ff48['attributes']=_['intersection'](_0x5f513b[_0xccdc('0x37')],qs[_0xccdc('0x3b')](_0x31265d[_0xccdc('0x38')]['fields']));_0x37ff48[_0xccdc('0x3c')]=_0x37ff48[_0xccdc('0x3c')][_0xccdc('0x3d')]?_0x37ff48[_0xccdc('0x3c')]:_0x5f513b['model'];if(!_0x31265d[_0xccdc('0x38')][_0xccdc('0x3e')](_0xccdc('0x3f'))){_0x37ff48[_0xccdc('0x20')]=qs[_0xccdc('0x20')](_0x31265d[_0xccdc('0x38')][_0xccdc('0x20')]);_0x37ff48[_0xccdc('0x22')]=qs[_0xccdc('0x22')](_0x31265d[_0xccdc('0x38')][_0xccdc('0x22')]);}_0x37ff48['order']=qs[_0xccdc('0x40')](_0x31265d[_0xccdc('0x38')][_0xccdc('0x40')]);_0x37ff48[_0xccdc('0x41')]=qs[_0xccdc('0x3a')](_[_0xccdc('0x42')](_0x31265d[_0xccdc('0x38')],_0x5f513b[_0xccdc('0x3a')]),_0x59710d);if(_0x31265d[_0xccdc('0x38')]['filter']){_0x37ff48['where']=_[_0xccdc('0x43')](_0x37ff48['where'],{'$or':_[_0xccdc('0x32')](_0x59710d,function(_0x3c41e1){if(_0x3c41e1['type']!==_0xccdc('0x44')){var _0x245d70={};_0x245d70[_0x3c41e1[_0xccdc('0x2f')]]={'$like':'%'+_0x31265d[_0xccdc('0x38')][_0xccdc('0x45')]+'%'};return _0x245d70;}})});}_0x37ff48=_[_0xccdc('0x43')]({},_0x37ff48,_0x31265d[_0xccdc('0x46')]);var _0x2bcc21={'where':_0x37ff48['where']};return db[_0xccdc('0x33')]['count'](_0x2bcc21)[_0xccdc('0x29')](function(_0x1f1f6d){_0x14028c['count']=_0x1f1f6d;if(_0x31265d[_0xccdc('0x38')][_0xccdc('0x47')]){_0x37ff48[_0xccdc('0x48')]=[{'all':!![]}];}return db[_0xccdc('0x33')][_0xccdc('0x49')](_0x37ff48);})[_0xccdc('0x29')](function(_0x5c8920){_0x14028c[_0xccdc('0x4a')]=_0x5c8920;return _0x14028c;})[_0xccdc('0x29')](respondWithFilteredResult(_0x3b76af,_0x37ff48))[_0xccdc('0x4b')](handleError(_0x3b76af,null));};exports[_0xccdc('0x4c')]=function(_0x1e2924,_0x461da5){var _0x4f90ae={'raw':!![],'where':{'id':_0x1e2924[_0xccdc('0x4d')]['id']}},_0x5dbcd9={};_0x5dbcd9[_0xccdc('0x37')]=_[_0xccdc('0x39')](db[_0xccdc('0x33')][_0xccdc('0x34')]);_0x5dbcd9[_0xccdc('0x38')]=_['keys'](_0x1e2924['query']);_0x5dbcd9['filters']=_[_0xccdc('0x4e')](_0x5dbcd9['model'],_0x5dbcd9[_0xccdc('0x38')]);_0x4f90ae[_0xccdc('0x3c')]=_['intersection'](_0x5dbcd9['model'],qs['fields'](_0x1e2924['query'][_0xccdc('0x3b')]));_0x4f90ae[_0xccdc('0x3c')]=_0x4f90ae[_0xccdc('0x3c')][_0xccdc('0x3d')]?_0x4f90ae[_0xccdc('0x3c')]:_0x5dbcd9[_0xccdc('0x37')];if(_0x1e2924['query'][_0xccdc('0x47')]){_0x4f90ae[_0xccdc('0x48')]=[{'all':!![]}];}_0x4f90ae=_[_0xccdc('0x43')]({},_0x4f90ae,_0x1e2924[_0xccdc('0x46')]);return db[_0xccdc('0x33')]['find'](_0x4f90ae)[_0xccdc('0x29')](handleEntityNotFound(_0x461da5,null))[_0xccdc('0x29')](respondWithResult(_0x461da5,null))[_0xccdc('0x4b')](handleError(_0x461da5,null));};exports[_0xccdc('0x4f')]=function(_0x364d58,_0x553cba){return db['MailQueue'][_0xccdc('0x4f')](_0x364d58[_0xccdc('0x50')],{})['then'](function(_0x587b27){var _0x3f1223=_0x364d58[_0xccdc('0x51')]['get']({'plain':!![]});if(!_0x3f1223)throw new Error(_0xccdc('0x52'));if(_0x3f1223[_0xccdc('0x53')]===_0xccdc('0x51')){var _0x5bd7d6=_0x587b27[_0xccdc('0x54')]({'plain':!![]});var _0xb6021c=_0xccdc('0x2a');return db[_0xccdc('0x55')]['find']({'where':{'name':_0xb6021c,'userProfileId':_0x3f1223[_0xccdc('0x56')]},'raw':!![]})['then'](function(_0x201f3b){if(_0x201f3b&&_0x201f3b[_0xccdc('0x57')]===0x0){return db[_0xccdc('0x2b')][_0xccdc('0x4f')]({'name':_0x5bd7d6[_0xccdc('0x2f')],'resourceId':_0x5bd7d6['id'],'type':_0x201f3b[_0xccdc('0x2f')],'sectionId':_0x201f3b['id']},{})['then'](function(){return _0x587b27;});}else{return _0x587b27;}})[_0xccdc('0x4b')](function(_0x535604){logger[_0xccdc('0x2d')](_0xccdc('0x58'),_0x535604);throw _0x535604;});}return _0x587b27;})[_0xccdc('0x29')](respondWithResult(_0x553cba,0xc9))[_0xccdc('0x4b')](handleError(_0x553cba,null));};exports[_0xccdc('0x28')]=function(_0x58e618,_0x1dc8d2){if(_0x58e618[_0xccdc('0x50')]['id']){delete _0x58e618[_0xccdc('0x50')]['id'];}return db[_0xccdc('0x33')][_0xccdc('0x59')]({'where':{'id':_0x58e618['params']['id']}})[_0xccdc('0x29')](handleEntityNotFound(_0x1dc8d2,null))[_0xccdc('0x29')](saveUpdates(_0x58e618[_0xccdc('0x50')],null))['then'](respondWithResult(_0x1dc8d2,null))[_0xccdc('0x4b')](handleError(_0x1dc8d2,null));};exports[_0xccdc('0x2c')]=function(_0x50614f,_0x22468e){return db[_0xccdc('0x33')][_0xccdc('0x59')]({'where':{'id':_0x50614f['params']['id']}})[_0xccdc('0x29')](handleEntityNotFound(_0x22468e,null))['then'](removeEntity(_0x22468e,null))[_0xccdc('0x4b')](handleError(_0x22468e,null));};exports[_0xccdc('0x5a')]=function(_0x381bf2,_0x942cce){return db[_0xccdc('0x33')][_0xccdc('0x5a')]()[_0xccdc('0x29')](respondWithResult(_0x942cce,null))['catch'](handleError(_0x942cce,null));};exports[_0xccdc('0x5b')]=function(_0x3fea6b,_0x434267,_0x381dcc){var _0x4c2fed={'raw':!![],'where':{}},_0x3dbc79={},_0x50eda0;return db[_0xccdc('0x33')]['findOne']({'where':{'id':_0x3fea6b[_0xccdc('0x4d')]['id']}})['then'](handleEntityNotFound(_0x434267,null))['then'](function(_0x4c9741){if(_0x4c9741){_0x50eda0=_0x4c9741['get']({'plain':!![]});_0x3dbc79[_0xccdc('0x37')]=_[_0xccdc('0x39')](db[_0xccdc('0x5c')][_0xccdc('0x34')]);_0x3dbc79['query']=_['keys'](_0x3fea6b[_0xccdc('0x38')]);_0x3dbc79[_0xccdc('0x3a')]=_[_0xccdc('0x4e')](_0x3dbc79[_0xccdc('0x37')],_0x3dbc79[_0xccdc('0x38')]);_0x4c2fed['attributes']=_[_0xccdc('0x4e')](_0x3dbc79[_0xccdc('0x37')],qs['fields'](_0x3fea6b['query'][_0xccdc('0x3b')]));_0x4c2fed[_0xccdc('0x3c')]=_0x4c2fed[_0xccdc('0x3c')]['length']?_0x4c2fed[_0xccdc('0x3c')]:_0x3dbc79['model'];if(!_0x3fea6b[_0xccdc('0x38')][_0xccdc('0x3e')](_0xccdc('0x3f'))){_0x4c2fed[_0xccdc('0x20')]=qs[_0xccdc('0x20')](_0x3fea6b[_0xccdc('0x38')][_0xccdc('0x20')]);_0x4c2fed[_0xccdc('0x22')]=qs['offset'](_0x3fea6b['query'][_0xccdc('0x22')]);}_0x4c2fed[_0xccdc('0x5d')]=qs[_0xccdc('0x40')](_0x3fea6b[_0xccdc('0x38')][_0xccdc('0x40')]);_0x4c2fed[_0xccdc('0x41')]=qs[_0xccdc('0x3a')](_[_0xccdc('0x42')](_0x3fea6b['query'],_0x3dbc79['filters']));_0x4c2fed[_0xccdc('0x41')][_0xccdc('0x5e')]=_0x4c9741['id'];if(_0x3fea6b['query'][_0xccdc('0x45')]){_0x4c2fed['where']=_['merge'](_0x4c2fed[_0xccdc('0x41')],{'$or':_['map'](_0x4c2fed['attributes'],function(_0x32d2b2){var _0x3961a7={};_0x3961a7[_0x32d2b2]={'$like':'%'+_0x3fea6b[_0xccdc('0x38')]['filter']+'%'};return _0x3961a7;})});}_0x4c2fed=_[_0xccdc('0x43')]({},_0x4c2fed,_0x3fea6b[_0xccdc('0x46')]);return db['UserMailQueue'][_0xccdc('0x49')](_0x4c2fed);}})[_0xccdc('0x29')](function(_0x3ffb1f){if(_0x3ffb1f){return db[_0xccdc('0x5f')]['findAndCountAll']({'where':{'id':_[_0xccdc('0x32')](_0x3ffb1f,_0xccdc('0x60')),'role':_0xccdc('0x61')},'attributes':['id','name',_0xccdc('0x62'),_0xccdc('0x63'),_0xccdc('0x64')]});}})['then'](function(_0x24beda){if(_0x24beda){return{'count':_0x24beda[_0xccdc('0x21')],'rows':_['map'](_0x24beda[_0xccdc('0x4a')],function(_0x46e44e){return{'membername':_0x46e44e[_0xccdc('0x2f')],'UserId':_0x46e44e['id'],'queue_name':_0x50eda0[_0xccdc('0x2f')],'MailQueueId':_0x50eda0['id'],'interface':util[_0xccdc('0x65')](_0xccdc('0x66'),_0xccdc('0x67'),_0x46e44e[_0xccdc('0x2f')]),'penalty':0x0,'paused':_0x46e44e['mailPause'],'createdAt':_0x46e44e[_0xccdc('0x64')],'updatedAt':_0x46e44e[_0xccdc('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xccdc('0x29')](respondWithFilteredResult(_0x434267,_0x4c2fed))[_0xccdc('0x4b')](handleError(_0x434267,null));};exports[_0xccdc('0x68')]=function(_0x44632d,_0x2d9946,_0x19b5f8){var _0x3910af={};var _0xb22cc0={};var _0x6529fb;var _0x39f5fa;return db[_0xccdc('0x33')][_0xccdc('0x69')]({'where':{'id':_0x44632d[_0xccdc('0x4d')]['id']}})[_0xccdc('0x29')](handleEntityNotFound(_0x2d9946,null))[_0xccdc('0x29')](function(_0xbd7106){if(_0xbd7106){_0x6529fb=_0xbd7106;_0xb22cc0[_0xccdc('0x37')]=_[_0xccdc('0x39')](db[_0xccdc('0x6a')][_0xccdc('0x34')]);_0xb22cc0[_0xccdc('0x38')]=_[_0xccdc('0x39')](_0x44632d[_0xccdc('0x38')]);_0xb22cc0[_0xccdc('0x3a')]=_['intersection'](_0xb22cc0[_0xccdc('0x37')],_0xb22cc0[_0xccdc('0x38')]);_0x3910af[_0xccdc('0x3c')]=_[_0xccdc('0x4e')](_0xb22cc0[_0xccdc('0x37')],qs[_0xccdc('0x3b')](_0x44632d['query'][_0xccdc('0x3b')]));_0x3910af[_0xccdc('0x3c')]=_0x3910af[_0xccdc('0x3c')]['length']?_0x3910af[_0xccdc('0x3c')]:_0xb22cc0[_0xccdc('0x37')];_0x3910af[_0xccdc('0x5d')]=qs['sort'](_0x44632d[_0xccdc('0x38')]['sort']);_0x3910af[_0xccdc('0x41')]=qs['filters'](_[_0xccdc('0x42')](_0x44632d[_0xccdc('0x38')],_0xb22cc0[_0xccdc('0x3a')]));if(_0x44632d[_0xccdc('0x38')]['filter']){_0x3910af[_0xccdc('0x41')]=_[_0xccdc('0x43')](_0x3910af['where'],{'$or':_[_0xccdc('0x32')](_0x3910af[_0xccdc('0x3c')],function(_0x139e06){var _0x52a6d0={};_0x52a6d0[_0x139e06]={'$like':'%'+_0x44632d[_0xccdc('0x38')][_0xccdc('0x45')]+'%'};return _0x52a6d0;})});}_0x3910af=_[_0xccdc('0x43')]({},_0x3910af,_0x44632d[_0xccdc('0x46')]);return _0x6529fb[_0xccdc('0x68')](_0x3910af);}})['then'](function(_0x46a588){if(_0x46a588){_0x39f5fa=_0x46a588[_0xccdc('0x3d')];if(!_0x44632d[_0xccdc('0x38')]['hasOwnProperty']('nolimit')){_0x3910af[_0xccdc('0x20')]=qs[_0xccdc('0x20')](_0x44632d[_0xccdc('0x38')][_0xccdc('0x20')]);_0x3910af[_0xccdc('0x22')]=qs[_0xccdc('0x22')](_0x44632d[_0xccdc('0x38')][_0xccdc('0x22')]);}return _0x6529fb[_0xccdc('0x68')](_0x3910af);}})[_0xccdc('0x29')](function(_0xe2c7e9){if(_0xe2c7e9){return _0xe2c7e9?{'count':_0x39f5fa,'rows':_0xe2c7e9}:null;}})['then'](respondWithResult(_0x2d9946,null))[_0xccdc('0x4b')](handleError(_0x2d9946,null));};exports[_0xccdc('0x6b')]=function(_0xdfc763,_0x3b8005,_0x4f9d96){var _0x196911=_0xdfc763[_0xccdc('0x50')][_0xccdc('0x6c')];return db[_0xccdc('0x6a')][_0xccdc('0x49')]({'where':{'id':_0x196911},'attributes':['id'],'include':[{'model':db[_0xccdc('0x5f')],'as':'Agents','attributes':['id',_0xccdc('0x2f'),'online','voicePause','interface'],'raw':!![]}]})[_0xccdc('0x29')](function(_0x39739e){if(_0x39739e){var _0x446963=_[_0xccdc('0x6d')](_0x39739e,function(_0x3bbf1a){var _0x519169=_0x3bbf1a['get']({'plain':!![]});return _0x519169['Agents'];});return db['MailQueue'][_0xccdc('0x59')]({'where':{'id':_0xdfc763[_0xccdc('0x4d')]['id']}})[_0xccdc('0x29')](function(_0x2f3e04){return db['sequelize'][_0xccdc('0x6e')](function(_0x2d2a5a){return _0x2f3e04['addTeams'](_0x196911,{'transaction':_0x2d2a5a})['then'](function(){return BPromise[_0xccdc('0x6f')](_0x446963,function(_0x462314){return db[_0xccdc('0x5c')]['findOrCreate']({'where':{'UserId':_0x462314['id'],'MailQueueId':_0xdfc763[_0xccdc('0x4d')]['id']},'transaction':_0x2d2a5a});});})['then'](function(){_0x446963[_0xccdc('0x70')](function(_0x53d30a){socket[_0xccdc('0x71')](_0xccdc('0x72'),{'UserId':_0x53d30a['id'],'MailQueueId':_0x2f3e04['id']});});});});});}})[_0xccdc('0x29')](respondWithStatusCode(_0x3b8005,null))[_0xccdc('0x4b')](handleError(_0x3b8005,null));};exports[_0xccdc('0x73')]=function(_0x1cda59,_0x4c8036,_0x702540){return db[_0xccdc('0x6a')][_0xccdc('0x49')]({'where':{'id':_0x1cda59[_0xccdc('0x38')]['ids']},'attributes':['id'],'include':[{'model':db[_0xccdc('0x5f')],'as':_0xccdc('0x74'),'attributes':['id'],'raw':!![]}]})[_0xccdc('0x29')](handleEntityNotFound(_0x4c8036,null))[_0xccdc('0x29')](function(_0x50733b){var _0x9ae8cc=_[_0xccdc('0x32')](_0x50733b,'id');var _0x3146bd=[];var _0x1bc65d=[];var _0x3675f8=squel[_0xccdc('0x75')]();_0x3675f8[_0xccdc('0x76')](_0xccdc('0x77'))[_0xccdc('0x78')](_0xccdc('0x79'),'tq')['join'](_0xccdc('0x7a'),'ut',_0xccdc('0x7b'))['where'](_0xccdc('0x7c'),_0x1cda59[_0xccdc('0x4d')]['id']);for(var _0x33cd92=0x0;_0x33cd92<_0x50733b[_0xccdc('0x3d')];_0x33cd92+=0x1){let _0x895fe7=_0x50733b[_0x33cd92];for(var _0x114eda=0x0;_0x114eda<_0x895fe7[_0xccdc('0x74')][_0xccdc('0x3d')];_0x114eda+=0x1){let _0x2d0cfe=_0x895fe7[_0xccdc('0x74')][_0x114eda];var _0x51485c=_0x3675f8[_0xccdc('0x7d')]();_0x51485c[_0xccdc('0x41')]('ut.UserId\x20=\x20?',_0x2d0cfe['id']);_0x1bc65d[_0xccdc('0x7e')](db[_0xccdc('0x7f')][_0xccdc('0x38')](_0x51485c[_0xccdc('0x80')](),{'type':db[_0xccdc('0x7f')]['QueryTypes']['SELECT']})[_0xccdc('0x29')](function(_0x3e85f3){if(_0x3e85f3[_0xccdc('0x3d')]===0x1){return _0x2d0cfe['id'];}else{var _0x5c04c7=_[_0xccdc('0x81')](_[_0xccdc('0x32')](_0x3e85f3,_0xccdc('0x82')),function(_0x5181fe){return _[_0xccdc('0x83')](_0x9ae8cc,_0x5181fe);});if(_0x5c04c7){return _0x2d0cfe['id'];}}}));}}return BPromise[_0xccdc('0x84')](_0x1bc65d)['then'](function(_0x2eb311){_0x3146bd=_(_0x3146bd)[_0xccdc('0x85')](_0x2eb311)['compact']()[_0xccdc('0x86')]();return db['MailQueue'][_0xccdc('0x59')]({'where':{'id':_0x1cda59[_0xccdc('0x4d')]['id']}})[_0xccdc('0x29')](function(_0x7f5adc){return db[_0xccdc('0x7f')]['transaction'](function(_0x425019){return _0x7f5adc[_0xccdc('0x73')](_0x1cda59['query'][_0xccdc('0x6c')],{'transaction':_0x425019})['then'](function(){if(!_['isEmpty'](_0x3146bd)){return _0x7f5adc[_0xccdc('0x87')](_0x3146bd,{'transaction':_0x425019});}})[_0xccdc('0x29')](function(){_0x3146bd[_0xccdc('0x70')](function(_0x992687){socket[_0xccdc('0x71')]('userMailQueue:remove',{'UserId':_0x992687,'MailQueueId':_0x7f5adc['id']});});});});});});})[_0xccdc('0x29')](respondWithStatusCode(_0x4c8036,null))[_0xccdc('0x4b')](handleError(_0x4c8036,null));};exports[_0xccdc('0x88')]=function(_0x4a9a88,_0x48493e,_0x46d7d7){return db['MailQueue'][_0xccdc('0x59')]({'where':{'id':_0x4a9a88[_0xccdc('0x4d')]['id']}})[_0xccdc('0x29')](handleEntityNotFound(_0x48493e,null))[_0xccdc('0x29')](function(_0x1d5f68){if(_0x1d5f68){return _0x1d5f68['addAgents'](_0x4a9a88[_0xccdc('0x50')][_0xccdc('0x6c')],_['omit'](_0x4a9a88[_0xccdc('0x50')],[_0xccdc('0x6c'),'id'])||{})[_0xccdc('0x89')](function(_0x5e2c8b){for(var _0x4fe4c0=0x0;_0x4fe4c0<_0x4a9a88[_0xccdc('0x50')][_0xccdc('0x6c')][_0xccdc('0x3d')];_0x4fe4c0+=0x1){socket[_0xccdc('0x71')]('userMailQueue:save',{'UserId':Number(_0x4a9a88['body'][_0xccdc('0x6c')][_0x4fe4c0]),'MailQueueId':Number(_0x4a9a88['params']['id'])});}return _0x5e2c8b;});}})[_0xccdc('0x29')](respondWithResult(_0x48493e,null))[_0xccdc('0x4b')](handleError(_0x48493e,null));};exports['removeAgents']=function(_0x1742b0,_0x5643da,_0xfce787){return db[_0xccdc('0x33')][_0xccdc('0x59')]({'where':{'id':_0x1742b0[_0xccdc('0x4d')]['id']}})[_0xccdc('0x29')](handleEntityNotFound(_0x5643da,null))['then'](function(_0x27692d){if(_0x27692d){return _0x27692d[_0xccdc('0x87')](_0x1742b0['query']['ids'])[_0xccdc('0x29')](function(){if(_[_0xccdc('0x8a')](_0x1742b0[_0xccdc('0x38')][_0xccdc('0x6c')])){for(var _0x1a6c08=0x0;_0x1a6c08<_0x1742b0[_0xccdc('0x38')][_0xccdc('0x6c')][_0xccdc('0x3d')];_0x1a6c08+=0x1){socket['emit'](_0xccdc('0x8b'),{'UserId':Number(_0x1742b0[_0xccdc('0x38')][_0xccdc('0x6c')][_0x1a6c08]),'MailQueueId':Number(_0x1742b0[_0xccdc('0x4d')]['id'])});}}else{socket[_0xccdc('0x71')](_0xccdc('0x8b'),{'UserId':Number(_0x1742b0[_0xccdc('0x38')]['ids']),'MailQueueId':Number(_0x1742b0['params']['id'])});}});}})[_0xccdc('0x29')](respondWithStatusCode(_0x5643da,null))[_0xccdc('0x4b')](handleError(_0x5643da,null));};exports['getAgents']=function(_0xa2b595,_0x22c11f,_0x51def6){var _0x41e06e={};var _0x2155b9={};var _0x6889fb;var _0x3f928f;return db[_0xccdc('0x33')][_0xccdc('0x69')]({'where':{'id':_0xa2b595[_0xccdc('0x4d')]['id']}})['then'](handleEntityNotFound(_0x22c11f,null))[_0xccdc('0x29')](function(_0x1997f2){if(_0x1997f2){_0x6889fb=_0x1997f2;_0x2155b9['model']=_[_0xccdc('0x39')](db['User'][_0xccdc('0x34')]);_0x2155b9[_0xccdc('0x38')]=_[_0xccdc('0x39')](_0xa2b595[_0xccdc('0x38')]);_0x2155b9[_0xccdc('0x3a')]=_['intersection'](_0x2155b9[_0xccdc('0x37')],_0x2155b9[_0xccdc('0x38')]);_0x41e06e['attributes']=_[_0xccdc('0x4e')](_0x2155b9['model'],qs[_0xccdc('0x3b')](_0xa2b595[_0xccdc('0x38')][_0xccdc('0x3b')]));_0x41e06e[_0xccdc('0x3c')]=_0x41e06e[_0xccdc('0x3c')]['length']?_0x41e06e['attributes']:_0x2155b9[_0xccdc('0x37')];_0x41e06e['order']=qs[_0xccdc('0x40')](_0xa2b595[_0xccdc('0x38')][_0xccdc('0x40')]);_0x41e06e[_0xccdc('0x41')]=qs[_0xccdc('0x3a')](_[_0xccdc('0x42')](_0xa2b595[_0xccdc('0x38')],_0x2155b9[_0xccdc('0x3a')]));if(_0xa2b595[_0xccdc('0x38')][_0xccdc('0x45')]){_0x41e06e[_0xccdc('0x41')]=_[_0xccdc('0x43')](_0x41e06e[_0xccdc('0x41')],{'$or':_[_0xccdc('0x32')](_0x41e06e[_0xccdc('0x3c')],function(_0x9f1ef5){var _0x101e98={};_0x101e98[_0x9f1ef5]={'$like':'%'+_0xa2b595[_0xccdc('0x38')][_0xccdc('0x45')]+'%'};return _0x101e98;})});}_0x41e06e=_['merge']({},_0x41e06e,_0xa2b595[_0xccdc('0x46')]);return _0x6889fb[_0xccdc('0x8c')](_0x41e06e);}})[_0xccdc('0x29')](function(_0x8b32d){if(_0x8b32d){_0x3f928f=_0x8b32d[_0xccdc('0x3d')];if(!_0xa2b595[_0xccdc('0x38')][_0xccdc('0x3e')](_0xccdc('0x3f'))){_0x41e06e[_0xccdc('0x20')]=qs[_0xccdc('0x20')](_0xa2b595[_0xccdc('0x38')][_0xccdc('0x20')]);_0x41e06e['offset']=qs['offset'](_0xa2b595['query'][_0xccdc('0x22')]);}return _0x6889fb[_0xccdc('0x8c')](_0x41e06e);}})['then'](function(_0x500be7){if(_0x500be7){return _0x500be7?{'count':_0x3f928f,'rows':_0x500be7}:null;}})[_0xccdc('0x29')](respondWithResult(_0x22c11f,null))[_0xccdc('0x4b')](handleError(_0x22c11f,null));}; \ No newline at end of file +var _0xcfee=['length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailQueues','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','UserMailQueue','MailQueueId','User','findAndCountAll','UserId','mailPause','updatedAt','createdAt','format','SIP','Team','getTeams','addTeams','Agents','online','voicePause','interface','flatMap','sequelize','findOrCreate','emit','userMailQueue:save','ids','select','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','compact','value','transaction','removeTeams','isEmpty','removeAgents','forEach','userMailQueue:remove','addAgents','omit','order','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./mailQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','MailQueue','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0xcfee,0x175));var _0xecfe=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xcfee[_0x12fc8d];return _0x3f9d04;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xecfe('0x0'));var zipdir=require(_0xecfe('0x1'));var jsonpatch=require(_0xecfe('0x2'));var rp=require(_0xecfe('0x3'));var moment=require('moment');var BPromise=require(_0xecfe('0x4'));var Mustache=require(_0xecfe('0x5'));var util=require(_0xecfe('0x6'));var path=require(_0xecfe('0x7'));var sox=require(_0xecfe('0x8'));var csv=require('to-csv');var ejs=require(_0xecfe('0x9'));var fs=require('fs');var fs_extra=require(_0xecfe('0xa'));var _=require('lodash');var squel=require(_0xecfe('0xb'));var crypto=require(_0xecfe('0xc'));var jsforce=require(_0xecfe('0xd'));var deskjs=require(_0xecfe('0xe'));var toCsv=require(_0xecfe('0xf'));var querystring=require(_0xecfe('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xecfe('0x11'));var qs=require(_0xecfe('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xecfe('0x13'));var logger=require(_0xecfe('0x14'))(_0xecfe('0x15'));var utils=require('../../config/utils');var config=require(_0xecfe('0x16'));var licenseUtil=require(_0xecfe('0x17'));var db=require(_0xecfe('0x18'))['db'];config[_0xecfe('0x19')]=_[_0xecfe('0x1a')](config['redis'],{'host':_0xecfe('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xecfe('0x1c'))[_0xecfe('0x1d')](socket);function respondWithStatusCode(_0x38ffbf,_0x3b84ec){_0x3b84ec=_0x3b84ec||0xcc;return function(_0x5c897c){if(_0x5c897c){return _0x38ffbf[_0xecfe('0x1e')](_0x3b84ec);}return _0x38ffbf[_0xecfe('0x1f')](_0x3b84ec)[_0xecfe('0x20')]();};}function respondWithResult(_0x196e5a,_0x48de37){_0x48de37=_0x48de37||0xc8;return function(_0x3b973c){if(_0x3b973c){return _0x196e5a[_0xecfe('0x1f')](_0x48de37)[_0xecfe('0x21')](_0x3b973c);}};}function respondWithFilteredResult(_0xedf697,_0x3414ba){return function(_0x3d6ca4){if(_0x3d6ca4){var _0x2a6657=typeof _0x3414ba[_0xecfe('0x22')]===_0xecfe('0x23')&&typeof _0x3414ba[_0xecfe('0x24')]===_0xecfe('0x23');var _0x7b74c0=_0x3d6ca4[_0xecfe('0x25')];var _0xc0c6d7=_0x2a6657?0x0:_0x3414ba[_0xecfe('0x22')];var _0x338e1e=_0x2a6657?_0x3d6ca4[_0xecfe('0x25')]:_0x3414ba[_0xecfe('0x22')]+_0x3414ba[_0xecfe('0x24')];var _0x4ab6ca;if(_0x338e1e>=_0x7b74c0){_0x338e1e=_0x7b74c0;_0x4ab6ca=0xc8;}else{_0x4ab6ca=0xce;}_0xedf697[_0xecfe('0x1f')](_0x4ab6ca);return _0xedf697[_0xecfe('0x26')](_0xecfe('0x27'),_0xc0c6d7+'-'+_0x338e1e+'/'+_0x7b74c0)[_0xecfe('0x21')](_0x3d6ca4);}return null;};}function patchUpdates(_0x2ed048){return function(_0x169500){try{jsonpatch[_0xecfe('0x28')](_0x169500,_0x2ed048,!![]);}catch(_0x479570){return BPromise[_0xecfe('0x29')](_0x479570);}return _0x169500[_0xecfe('0x2a')]();};}function saveUpdates(_0x105320,_0x38aeb1){return function(_0x2d9feb){if(_0x2d9feb){return _0x2d9feb[_0xecfe('0x2b')](_0x105320)[_0xecfe('0x2c')](function(_0x5cc2f4){return _0x5cc2f4;});}return null;};}function removeEntity(_0x422c47,_0x5b35a2){return function(_0x2438f7){if(_0x2438f7){return _0x2438f7[_0xecfe('0x2d')]()[_0xecfe('0x2c')](function(){var _0x370c9b=_0x2438f7[_0xecfe('0x2e')]({'plain':!![]});var _0x18c335='MailQueues';return db[_0xecfe('0x2f')]['destroy']({'where':{'type':_0x18c335,'resourceId':_0x370c9b['id']}})[_0xecfe('0x2c')](function(){return _0x2438f7;});})['then'](function(){_0x422c47['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d60fb,_0x5b44bc){return function(_0x372105){if(!_0x372105){_0x3d60fb['sendStatus'](0x194);}return _0x372105;};}function handleError(_0x259643,_0x207441){_0x207441=_0x207441||0x1f4;return function(_0x2565c9){logger[_0xecfe('0x30')](_0x2565c9[_0xecfe('0x31')]);if(_0x2565c9[_0xecfe('0x32')]){delete _0x2565c9[_0xecfe('0x32')];}_0x259643['status'](_0x207441)[_0xecfe('0x33')](_0x2565c9);};}exports[_0xecfe('0x34')]=function(_0x271f20,_0x5da67d){var _0x409249={},_0x148b14={},_0x44232c={'count':0x0,'rows':[]};var _0x41abd9=_[_0xecfe('0x35')](db[_0xecfe('0x36')]['rawAttributes'],function(_0x1e573b){return{'name':_0x1e573b[_0xecfe('0x37')],'type':_0x1e573b[_0xecfe('0x38')][_0xecfe('0x39')]};});_0x148b14[_0xecfe('0x3a')]=_[_0xecfe('0x35')](_0x41abd9,_0xecfe('0x32'));_0x148b14[_0xecfe('0x3b')]=_[_0xecfe('0x3c')](_0x271f20[_0xecfe('0x3b')]);_0x148b14[_0xecfe('0x3d')]=_[_0xecfe('0x3e')](_0x148b14[_0xecfe('0x3a')],_0x148b14['query']);_0x409249[_0xecfe('0x3f')]=_[_0xecfe('0x3e')](_0x148b14[_0xecfe('0x3a')],qs[_0xecfe('0x40')](_0x271f20[_0xecfe('0x3b')][_0xecfe('0x40')]));_0x409249[_0xecfe('0x3f')]=_0x409249[_0xecfe('0x3f')][_0xecfe('0x41')]?_0x409249[_0xecfe('0x3f')]:_0x148b14['model'];if(!_0x271f20[_0xecfe('0x3b')][_0xecfe('0x42')](_0xecfe('0x43'))){_0x409249[_0xecfe('0x24')]=qs['limit'](_0x271f20[_0xecfe('0x3b')]['limit']);_0x409249[_0xecfe('0x22')]=qs['offset'](_0x271f20[_0xecfe('0x3b')]['offset']);}_0x409249['order']=qs['sort'](_0x271f20[_0xecfe('0x3b')][_0xecfe('0x44')]);_0x409249[_0xecfe('0x45')]=qs[_0xecfe('0x3d')](_[_0xecfe('0x46')](_0x271f20[_0xecfe('0x3b')],_0x148b14[_0xecfe('0x3d')]),_0x41abd9);if(_0x271f20['query']['filter']){_0x409249[_0xecfe('0x45')]=_[_0xecfe('0x47')](_0x409249[_0xecfe('0x45')],{'$or':_[_0xecfe('0x35')](_0x41abd9,function(_0x4981e9){if(_0x4981e9[_0xecfe('0x38')]!==_0xecfe('0x48')){var _0x361cf8={};_0x361cf8[_0x4981e9[_0xecfe('0x32')]]={'$like':'%'+_0x271f20['query'][_0xecfe('0x49')]+'%'};return _0x361cf8;}})});}_0x409249=_[_0xecfe('0x47')]({},_0x409249,_0x271f20[_0xecfe('0x4a')]);var _0x377019={'where':_0x409249[_0xecfe('0x45')]};return db[_0xecfe('0x36')]['count'](_0x377019)['then'](function(_0x3bb3a6){_0x44232c[_0xecfe('0x25')]=_0x3bb3a6;if(_0x271f20[_0xecfe('0x3b')]['includeAll']){_0x409249[_0xecfe('0x4b')]=[{'all':!![]}];}return db[_0xecfe('0x36')][_0xecfe('0x4c')](_0x409249);})[_0xecfe('0x2c')](function(_0x58179c){_0x44232c[_0xecfe('0x4d')]=_0x58179c;return _0x44232c;})[_0xecfe('0x2c')](respondWithFilteredResult(_0x5da67d,_0x409249))[_0xecfe('0x4e')](handleError(_0x5da67d,null));};exports[_0xecfe('0x4f')]=function(_0x5e3481,_0x38348d){var _0xe1735b={'raw':!![],'where':{'id':_0x5e3481[_0xecfe('0x50')]['id']}},_0x5733c4={};_0x5733c4[_0xecfe('0x3a')]=_[_0xecfe('0x3c')](db['MailQueue'][_0xecfe('0x51')]);_0x5733c4[_0xecfe('0x3b')]=_[_0xecfe('0x3c')](_0x5e3481[_0xecfe('0x3b')]);_0x5733c4[_0xecfe('0x3d')]=_[_0xecfe('0x3e')](_0x5733c4[_0xecfe('0x3a')],_0x5733c4[_0xecfe('0x3b')]);_0xe1735b[_0xecfe('0x3f')]=_[_0xecfe('0x3e')](_0x5733c4[_0xecfe('0x3a')],qs[_0xecfe('0x40')](_0x5e3481[_0xecfe('0x3b')][_0xecfe('0x40')]));_0xe1735b[_0xecfe('0x3f')]=_0xe1735b[_0xecfe('0x3f')][_0xecfe('0x41')]?_0xe1735b[_0xecfe('0x3f')]:_0x5733c4[_0xecfe('0x3a')];if(_0x5e3481['query'][_0xecfe('0x52')]){_0xe1735b[_0xecfe('0x4b')]=[{'all':!![]}];}_0xe1735b=_[_0xecfe('0x47')]({},_0xe1735b,_0x5e3481[_0xecfe('0x4a')]);return db['MailQueue']['find'](_0xe1735b)[_0xecfe('0x2c')](handleEntityNotFound(_0x38348d,null))['then'](respondWithResult(_0x38348d,null))[_0xecfe('0x4e')](handleError(_0x38348d,null));};exports[_0xecfe('0x53')]=function(_0x3a547d,_0x5e93e4){return db[_0xecfe('0x36')]['create'](_0x3a547d['body'],{})[_0xecfe('0x2c')](function(_0x501bf5){var _0x425b5f=_0x3a547d[_0xecfe('0x54')][_0xecfe('0x2e')]({'plain':!![]});if(!_0x425b5f)throw new Error(_0xecfe('0x55'));if(_0x425b5f[_0xecfe('0x56')]===_0xecfe('0x54')){var _0x14e8c3=_0x501bf5[_0xecfe('0x2e')]({'plain':!![]});var _0x34ce1f=_0xecfe('0x57');return db[_0xecfe('0x58')][_0xecfe('0x59')]({'where':{'name':_0x34ce1f,'userProfileId':_0x425b5f[_0xecfe('0x5a')]},'raw':!![]})['then'](function(_0x5418f5){if(_0x5418f5&&_0x5418f5['autoAssociation']===0x0){return db[_0xecfe('0x2f')][_0xecfe('0x53')]({'name':_0x14e8c3[_0xecfe('0x32')],'resourceId':_0x14e8c3['id'],'type':_0x5418f5[_0xecfe('0x32')],'sectionId':_0x5418f5['id']},{})[_0xecfe('0x2c')](function(){return _0x501bf5;});}else{return _0x501bf5;}})[_0xecfe('0x4e')](function(_0xe27301){logger[_0xecfe('0x30')](_0xecfe('0x5b'),_0xe27301);throw _0xe27301;});}return _0x501bf5;})[_0xecfe('0x2c')](respondWithResult(_0x5e93e4,0xc9))[_0xecfe('0x4e')](handleError(_0x5e93e4,null));};exports['update']=function(_0x59a64b,_0x43ae5f){if(_0x59a64b[_0xecfe('0x5c')]['id']){delete _0x59a64b[_0xecfe('0x5c')]['id'];}return db[_0xecfe('0x36')]['find']({'where':{'id':_0x59a64b[_0xecfe('0x50')]['id']}})[_0xecfe('0x2c')](handleEntityNotFound(_0x43ae5f,null))[_0xecfe('0x2c')](saveUpdates(_0x59a64b['body'],null))[_0xecfe('0x2c')](respondWithResult(_0x43ae5f,null))[_0xecfe('0x4e')](handleError(_0x43ae5f,null));};exports[_0xecfe('0x2d')]=function(_0x18e0da,_0x1e3550){return db[_0xecfe('0x36')][_0xecfe('0x59')]({'where':{'id':_0x18e0da[_0xecfe('0x50')]['id']}})[_0xecfe('0x2c')](handleEntityNotFound(_0x1e3550,null))['then'](removeEntity(_0x1e3550,null))[_0xecfe('0x4e')](handleError(_0x1e3550,null));};exports[_0xecfe('0x5d')]=function(_0x14a02e,_0x508b1a){return db[_0xecfe('0x36')][_0xecfe('0x5d')]()[_0xecfe('0x2c')](respondWithResult(_0x508b1a,null))[_0xecfe('0x4e')](handleError(_0x508b1a,null));};exports[_0xecfe('0x5e')]=function(_0x2ab0b3,_0x413a33,_0x1cd7db){var _0x11a488={'raw':!![],'where':{}},_0x93328a={},_0x404c98;return db[_0xecfe('0x36')]['findOne']({'where':{'id':_0x2ab0b3[_0xecfe('0x50')]['id']}})['then'](handleEntityNotFound(_0x413a33,null))[_0xecfe('0x2c')](function(_0x443002){if(_0x443002){_0x404c98=_0x443002['get']({'plain':!![]});_0x93328a[_0xecfe('0x3a')]=_[_0xecfe('0x3c')](db[_0xecfe('0x5f')][_0xecfe('0x51')]);_0x93328a[_0xecfe('0x3b')]=_[_0xecfe('0x3c')](_0x2ab0b3[_0xecfe('0x3b')]);_0x93328a['filters']=_[_0xecfe('0x3e')](_0x93328a['model'],_0x93328a[_0xecfe('0x3b')]);_0x11a488['attributes']=_[_0xecfe('0x3e')](_0x93328a[_0xecfe('0x3a')],qs[_0xecfe('0x40')](_0x2ab0b3['query']['fields']));_0x11a488[_0xecfe('0x3f')]=_0x11a488[_0xecfe('0x3f')][_0xecfe('0x41')]?_0x11a488[_0xecfe('0x3f')]:_0x93328a[_0xecfe('0x3a')];if(!_0x2ab0b3['query'][_0xecfe('0x42')](_0xecfe('0x43'))){_0x11a488['limit']=qs[_0xecfe('0x24')](_0x2ab0b3[_0xecfe('0x3b')][_0xecfe('0x24')]);_0x11a488[_0xecfe('0x22')]=qs[_0xecfe('0x22')](_0x2ab0b3[_0xecfe('0x3b')][_0xecfe('0x22')]);}_0x11a488['order']=qs[_0xecfe('0x44')](_0x2ab0b3[_0xecfe('0x3b')][_0xecfe('0x44')]);_0x11a488[_0xecfe('0x45')]=qs[_0xecfe('0x3d')](_[_0xecfe('0x46')](_0x2ab0b3[_0xecfe('0x3b')],_0x93328a[_0xecfe('0x3d')]));_0x11a488[_0xecfe('0x45')][_0xecfe('0x60')]=_0x443002['id'];if(_0x2ab0b3[_0xecfe('0x3b')][_0xecfe('0x49')]){_0x11a488[_0xecfe('0x45')]=_['merge'](_0x11a488[_0xecfe('0x45')],{'$or':_[_0xecfe('0x35')](_0x11a488['attributes'],function(_0xbe14fc){var _0xf68613={};_0xf68613[_0xbe14fc]={'$like':'%'+_0x2ab0b3[_0xecfe('0x3b')][_0xecfe('0x49')]+'%'};return _0xf68613;})});}_0x11a488=_[_0xecfe('0x47')]({},_0x11a488,_0x2ab0b3[_0xecfe('0x4a')]);return db[_0xecfe('0x5f')][_0xecfe('0x4c')](_0x11a488);}})[_0xecfe('0x2c')](function(_0x5d6ba4){if(_0x5d6ba4){return db[_0xecfe('0x61')][_0xecfe('0x62')]({'where':{'id':_[_0xecfe('0x35')](_0x5d6ba4,_0xecfe('0x63')),'role':'agent'},'attributes':['id',_0xecfe('0x32'),_0xecfe('0x64'),_0xecfe('0x65'),_0xecfe('0x66')]});}})[_0xecfe('0x2c')](function(_0x5301f0){if(_0x5301f0){return{'count':_0x5301f0[_0xecfe('0x25')],'rows':_[_0xecfe('0x35')](_0x5301f0[_0xecfe('0x4d')],function(_0x129691){return{'membername':_0x129691['name'],'UserId':_0x129691['id'],'queue_name':_0x404c98['name'],'MailQueueId':_0x404c98['id'],'interface':util[_0xecfe('0x67')]('%s/%s',_0xecfe('0x68'),_0x129691[_0xecfe('0x32')]),'penalty':0x0,'paused':_0x129691[_0xecfe('0x64')],'createdAt':_0x129691['createdAt'],'updatedAt':_0x129691['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x413a33,_0x11a488))[_0xecfe('0x4e')](handleError(_0x413a33,null));};exports['getTeams']=function(_0x7984f1,_0x38d488,_0x4ed854){var _0x3468d1={};var _0x48d39a={};var _0x434ae3;var _0x2906ba;return db[_0xecfe('0x36')]['findOne']({'where':{'id':_0x7984f1[_0xecfe('0x50')]['id']}})[_0xecfe('0x2c')](handleEntityNotFound(_0x38d488,null))['then'](function(_0x37455b){if(_0x37455b){_0x434ae3=_0x37455b;_0x48d39a[_0xecfe('0x3a')]=_[_0xecfe('0x3c')](db[_0xecfe('0x69')]['rawAttributes']);_0x48d39a['query']=_[_0xecfe('0x3c')](_0x7984f1['query']);_0x48d39a[_0xecfe('0x3d')]=_[_0xecfe('0x3e')](_0x48d39a[_0xecfe('0x3a')],_0x48d39a['query']);_0x3468d1[_0xecfe('0x3f')]=_['intersection'](_0x48d39a[_0xecfe('0x3a')],qs[_0xecfe('0x40')](_0x7984f1[_0xecfe('0x3b')]['fields']));_0x3468d1['attributes']=_0x3468d1[_0xecfe('0x3f')][_0xecfe('0x41')]?_0x3468d1[_0xecfe('0x3f')]:_0x48d39a[_0xecfe('0x3a')];_0x3468d1['order']=qs[_0xecfe('0x44')](_0x7984f1['query'][_0xecfe('0x44')]);_0x3468d1[_0xecfe('0x45')]=qs[_0xecfe('0x3d')](_[_0xecfe('0x46')](_0x7984f1[_0xecfe('0x3b')],_0x48d39a['filters']));if(_0x7984f1['query'][_0xecfe('0x49')]){_0x3468d1[_0xecfe('0x45')]=_[_0xecfe('0x47')](_0x3468d1[_0xecfe('0x45')],{'$or':_[_0xecfe('0x35')](_0x3468d1[_0xecfe('0x3f')],function(_0x262381){var _0x51da1e={};_0x51da1e[_0x262381]={'$like':'%'+_0x7984f1['query'][_0xecfe('0x49')]+'%'};return _0x51da1e;})});}_0x3468d1=_[_0xecfe('0x47')]({},_0x3468d1,_0x7984f1[_0xecfe('0x4a')]);return _0x434ae3[_0xecfe('0x6a')](_0x3468d1);}})[_0xecfe('0x2c')](function(_0xb6371f){if(_0xb6371f){_0x2906ba=_0xb6371f[_0xecfe('0x41')];if(!_0x7984f1['query']['hasOwnProperty'](_0xecfe('0x43'))){_0x3468d1['limit']=qs[_0xecfe('0x24')](_0x7984f1[_0xecfe('0x3b')][_0xecfe('0x24')]);_0x3468d1[_0xecfe('0x22')]=qs[_0xecfe('0x22')](_0x7984f1[_0xecfe('0x3b')][_0xecfe('0x22')]);}return _0x434ae3[_0xecfe('0x6a')](_0x3468d1);}})[_0xecfe('0x2c')](function(_0x46350e){if(_0x46350e){return _0x46350e?{'count':_0x2906ba,'rows':_0x46350e}:null;}})['then'](respondWithResult(_0x38d488,null))[_0xecfe('0x4e')](handleError(_0x38d488,null));};exports[_0xecfe('0x6b')]=function(_0xbf5072,_0x34f728,_0x50d34f){var _0xc45368=_0xbf5072[_0xecfe('0x5c')]['ids'];return db[_0xecfe('0x69')][_0xecfe('0x4c')]({'where':{'id':_0xc45368},'attributes':['id'],'include':[{'model':db[_0xecfe('0x61')],'as':_0xecfe('0x6c'),'attributes':['id',_0xecfe('0x32'),_0xecfe('0x6d'),_0xecfe('0x6e'),_0xecfe('0x6f')],'raw':!![]}]})['then'](function(_0x37183a){if(_0x37183a){var _0x42d9f2=_[_0xecfe('0x70')](_0x37183a,function(_0x5ea4f0){var _0x2a3df7=_0x5ea4f0[_0xecfe('0x2e')]({'plain':!![]});return _0x2a3df7[_0xecfe('0x6c')];});return db[_0xecfe('0x36')]['find']({'where':{'id':_0xbf5072[_0xecfe('0x50')]['id']}})[_0xecfe('0x2c')](function(_0xf045f7){return db[_0xecfe('0x71')]['transaction'](function(_0x4ace42){return _0xf045f7[_0xecfe('0x6b')](_0xc45368,{'transaction':_0x4ace42})[_0xecfe('0x2c')](function(){return BPromise['each'](_0x42d9f2,function(_0x5e4cd5){return db[_0xecfe('0x5f')][_0xecfe('0x72')]({'where':{'UserId':_0x5e4cd5['id'],'MailQueueId':_0xbf5072[_0xecfe('0x50')]['id']},'transaction':_0x4ace42});});})[_0xecfe('0x2c')](function(){_0x42d9f2['forEach'](function(_0x573f68){socket[_0xecfe('0x73')](_0xecfe('0x74'),{'UserId':_0x573f68['id'],'MailQueueId':_0xf045f7['id']});});});});});}})[_0xecfe('0x2c')](respondWithStatusCode(_0x34f728,null))['catch'](handleError(_0x34f728,null));};exports['removeTeams']=function(_0x816e50,_0xfcee47,_0x31d791){return db[_0xecfe('0x69')]['findAll']({'where':{'id':_0x816e50[_0xecfe('0x3b')][_0xecfe('0x75')]},'attributes':['id'],'include':[{'model':db[_0xecfe('0x61')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xecfe('0x2c')](handleEntityNotFound(_0xfcee47,null))[_0xecfe('0x2c')](function(_0x3399ed){var _0x340d68=_[_0xecfe('0x35')](_0x3399ed,'id');var _0x111227=[];var _0x438622=[];var _0xb11d86=squel[_0xecfe('0x76')]();_0xb11d86[_0xecfe('0x77')](_0xecfe('0x78'))[_0xecfe('0x79')](_0xecfe('0x7a'),'tq')[_0xecfe('0x7b')](_0xecfe('0x7c'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xecfe('0x45')](_0xecfe('0x7d'),_0x816e50[_0xecfe('0x50')]['id']);for(var _0x1d8238=0x0;_0x1d8238<_0x3399ed['length'];_0x1d8238+=0x1){let _0x3f61da=_0x3399ed[_0x1d8238];for(var _0x509ad1=0x0;_0x509ad1<_0x3f61da[_0xecfe('0x6c')][_0xecfe('0x41')];_0x509ad1+=0x1){let _0x46f306=_0x3f61da[_0xecfe('0x6c')][_0x509ad1];var _0x19e109=_0xb11d86['clone']();_0x19e109[_0xecfe('0x45')](_0xecfe('0x7e'),_0x46f306['id']);_0x438622[_0xecfe('0x7f')](db['sequelize'][_0xecfe('0x3b')](_0x19e109[_0xecfe('0x80')](),{'type':db[_0xecfe('0x71')][_0xecfe('0x81')][_0xecfe('0x82')]})[_0xecfe('0x2c')](function(_0x3458b4){if(_0x3458b4['length']===0x1){return _0x46f306['id'];}else{var _0x3633f8=_[_0xecfe('0x83')](_['map'](_0x3458b4,_0xecfe('0x84')),function(_0x2ce009){return _['includes'](_0x340d68,_0x2ce009);});if(_0x3633f8){return _0x46f306['id'];}}}));}}return BPromise[_0xecfe('0x85')](_0x438622)['then'](function(_0x5c580c){_0x111227=_(_0x111227)['union'](_0x5c580c)[_0xecfe('0x86')]()[_0xecfe('0x87')]();return db[_0xecfe('0x36')]['find']({'where':{'id':_0x816e50['params']['id']}})[_0xecfe('0x2c')](function(_0x312abc){return db[_0xecfe('0x71')][_0xecfe('0x88')](function(_0x3a9eb8){return _0x312abc[_0xecfe('0x89')](_0x816e50[_0xecfe('0x3b')]['ids'],{'transaction':_0x3a9eb8})[_0xecfe('0x2c')](function(){if(!_[_0xecfe('0x8a')](_0x111227)){return _0x312abc[_0xecfe('0x8b')](_0x111227,{'transaction':_0x3a9eb8});}})['then'](function(){_0x111227[_0xecfe('0x8c')](function(_0x221f7c){socket[_0xecfe('0x73')](_0xecfe('0x8d'),{'UserId':_0x221f7c,'MailQueueId':_0x312abc['id']});});});});});});})[_0xecfe('0x2c')](respondWithStatusCode(_0xfcee47,null))[_0xecfe('0x4e')](handleError(_0xfcee47,null));};exports[_0xecfe('0x8e')]=function(_0x28b970,_0x5936e2,_0x1c84ed){return db['MailQueue']['find']({'where':{'id':_0x28b970[_0xecfe('0x50')]['id']}})[_0xecfe('0x2c')](handleEntityNotFound(_0x5936e2,null))[_0xecfe('0x2c')](function(_0x4f93fa){if(_0x4f93fa){return _0x4f93fa[_0xecfe('0x8e')](_0x28b970[_0xecfe('0x5c')][_0xecfe('0x75')],_[_0xecfe('0x8f')](_0x28b970[_0xecfe('0x5c')],[_0xecfe('0x75'),'id'])||{})['spread'](function(_0x4cda6e){for(var _0x372d9b=0x0;_0x372d9b<_0x28b970[_0xecfe('0x5c')][_0xecfe('0x75')]['length'];_0x372d9b+=0x1){socket['emit']('userMailQueue:save',{'UserId':Number(_0x28b970[_0xecfe('0x5c')][_0xecfe('0x75')][_0x372d9b]),'MailQueueId':Number(_0x28b970[_0xecfe('0x50')]['id'])});}return _0x4cda6e;});}})[_0xecfe('0x2c')](respondWithResult(_0x5936e2,null))[_0xecfe('0x4e')](handleError(_0x5936e2,null));};exports[_0xecfe('0x8b')]=function(_0x28e834,_0x52802a,_0x1a1a82){return db[_0xecfe('0x36')][_0xecfe('0x59')]({'where':{'id':_0x28e834[_0xecfe('0x50')]['id']}})[_0xecfe('0x2c')](handleEntityNotFound(_0x52802a,null))[_0xecfe('0x2c')](function(_0x1a6d43){if(_0x1a6d43){return _0x1a6d43['removeAgents'](_0x28e834[_0xecfe('0x3b')][_0xecfe('0x75')])[_0xecfe('0x2c')](function(){if(_['isArray'](_0x28e834['query'][_0xecfe('0x75')])){for(var _0x409dc0=0x0;_0x409dc0<_0x28e834[_0xecfe('0x3b')][_0xecfe('0x75')]['length'];_0x409dc0+=0x1){socket[_0xecfe('0x73')](_0xecfe('0x8d'),{'UserId':Number(_0x28e834['query'][_0xecfe('0x75')][_0x409dc0]),'MailQueueId':Number(_0x28e834[_0xecfe('0x50')]['id'])});}}else{socket[_0xecfe('0x73')]('userMailQueue:remove',{'UserId':Number(_0x28e834[_0xecfe('0x3b')][_0xecfe('0x75')]),'MailQueueId':Number(_0x28e834[_0xecfe('0x50')]['id'])});}});}})[_0xecfe('0x2c')](respondWithStatusCode(_0x52802a,null))[_0xecfe('0x4e')](handleError(_0x52802a,null));};exports['getAgents']=function(_0x2d5361,_0xd4dcfc,_0x373b59){var _0x2bd268={};var _0x358a75={};var _0x24e530;var _0x23a8dd;return db[_0xecfe('0x36')]['findOne']({'where':{'id':_0x2d5361[_0xecfe('0x50')]['id']}})['then'](handleEntityNotFound(_0xd4dcfc,null))['then'](function(_0x488396){if(_0x488396){_0x24e530=_0x488396;_0x358a75['model']=_[_0xecfe('0x3c')](db[_0xecfe('0x61')]['rawAttributes']);_0x358a75[_0xecfe('0x3b')]=_[_0xecfe('0x3c')](_0x2d5361[_0xecfe('0x3b')]);_0x358a75['filters']=_['intersection'](_0x358a75['model'],_0x358a75[_0xecfe('0x3b')]);_0x2bd268[_0xecfe('0x3f')]=_[_0xecfe('0x3e')](_0x358a75['model'],qs['fields'](_0x2d5361[_0xecfe('0x3b')][_0xecfe('0x40')]));_0x2bd268['attributes']=_0x2bd268[_0xecfe('0x3f')]['length']?_0x2bd268[_0xecfe('0x3f')]:_0x358a75[_0xecfe('0x3a')];_0x2bd268[_0xecfe('0x90')]=qs[_0xecfe('0x44')](_0x2d5361[_0xecfe('0x3b')][_0xecfe('0x44')]);_0x2bd268[_0xecfe('0x45')]=qs['filters'](_[_0xecfe('0x46')](_0x2d5361[_0xecfe('0x3b')],_0x358a75['filters']));if(_0x2d5361[_0xecfe('0x3b')][_0xecfe('0x49')]){_0x2bd268[_0xecfe('0x45')]=_[_0xecfe('0x47')](_0x2bd268['where'],{'$or':_[_0xecfe('0x35')](_0x2bd268[_0xecfe('0x3f')],function(_0x3b46e4){var _0xb69d39={};_0xb69d39[_0x3b46e4]={'$like':'%'+_0x2d5361[_0xecfe('0x3b')][_0xecfe('0x49')]+'%'};return _0xb69d39;})});}_0x2bd268=_[_0xecfe('0x47')]({},_0x2bd268,_0x2d5361[_0xecfe('0x4a')]);return _0x24e530[_0xecfe('0x91')](_0x2bd268);}})[_0xecfe('0x2c')](function(_0x41ae32){if(_0x41ae32){_0x23a8dd=_0x41ae32['length'];if(!_0x2d5361[_0xecfe('0x3b')][_0xecfe('0x42')]('nolimit')){_0x2bd268[_0xecfe('0x24')]=qs['limit'](_0x2d5361[_0xecfe('0x3b')]['limit']);_0x2bd268['offset']=qs[_0xecfe('0x22')](_0x2d5361[_0xecfe('0x3b')]['offset']);}return _0x24e530[_0xecfe('0x91')](_0x2bd268);}})[_0xecfe('0x2c')](function(_0x40b7a0){if(_0x40b7a0){return _0x40b7a0?{'count':_0x23a8dd,'rows':_0x40b7a0}:null;}})['then'](respondWithResult(_0xd4dcfc,null))[_0xecfe('0x4e')](handleError(_0xd4dcfc,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 1f4b1af..6b65662 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 _0x3800=['hook','events','../../mysqldb','MailQueue','setMaxListeners','update','remove','emit'];(function(_0xac6fbf,_0x3d5785){var _0x5a18b8=function(_0x40f216){while(--_0x40f216){_0xac6fbf['push'](_0xac6fbf['shift']());}};_0x5a18b8(++_0x3d5785);}(_0x3800,0x109));var _0x0380=function(_0x4d1d1b,_0x122e02){_0x4d1d1b=_0x4d1d1b-0x0;var _0x2d1ed0=_0x3800[_0x4d1d1b];return _0x2d1ed0;};'use strict';var EventEmitter=require(_0x0380('0x0'));var MailQueue=require(_0x0380('0x1'))['db'][_0x0380('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x0380('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0380('0x4'),'afterDestroy':_0x0380('0x5')};function emitEvent(_0x282097){return function(_0x30a92b,_0x2e102a,_0x590d7a){MailQueueEvents[_0x0380('0x6')](_0x282097+':'+_0x30a92b['id'],_0x30a92b);MailQueueEvents[_0x0380('0x6')](_0x282097,_0x30a92b);_0x590d7a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x0380('0x7')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0x092c=['hook','exports','events','MailQueue','remove','emit','hasOwnProperty'];(function(_0x450eae,_0x2ad04d){var _0x2379d3=function(_0x4d7f9a){while(--_0x4d7f9a){_0x450eae['push'](_0x450eae['shift']());}};_0x2379d3(++_0x2ad04d);}(_0x092c,0xf0));var _0xc092=function(_0x2d56ef,_0x5782bc){_0x2d56ef=_0x2d56ef-0x0;var _0x3ff348=_0x092c[_0x2d56ef];return _0x3ff348;};'use strict';var EventEmitter=require(_0xc092('0x0'));var MailQueue=require('../../mysqldb')['db'][_0xc092('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xc092('0x2')};function emitEvent(_0x24208d){return function(_0x140865,_0x5179b7,_0x164f57){MailQueueEvents[_0xc092('0x3')](_0x24208d+':'+_0x140865['id'],_0x140865);MailQueueEvents['emit'](_0x24208d,_0x140865);_0x164f57(null);};}for(var e in events){if(events[_0xc092('0x4')](e)){var event=events[e];MailQueue[_0xc092('0x5')](e,emitEvent(event));}}module[_0xc092('0x6')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index c2defb3..0996d0a 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 _0x5e13=['exports','define','MailQueue','mail_queues','util','api','moment','bluebird','request-promise','path','../../config/environment','./mailQueue.attributes'];(function(_0x5a42f5,_0x23b9b1){var _0x371e4e=function(_0x30305f){while(--_0x30305f){_0x5a42f5['push'](_0x5a42f5['shift']());}};_0x371e4e(++_0x23b9b1);}(_0x5e13,0x184));var _0x35e1=function(_0x42babc,_0x1287c0){_0x42babc=_0x42babc-0x0;var _0x3b240a=_0x5e13[_0x42babc];return _0x3b240a;};'use strict';var _=require('lodash');var util=require(_0x35e1('0x0'));var logger=require('../../config/logger')(_0x35e1('0x1'));var moment=require(_0x35e1('0x2'));var BPromise=require(_0x35e1('0x3'));var rp=require(_0x35e1('0x4'));var fs=require('fs');var path=require(_0x35e1('0x5'));var rimraf=require('rimraf');var config=require(_0x35e1('0x6'));var attributes=require(_0x35e1('0x7'));module[_0x35e1('0x8')]=function(_0x46f737,_0x281f66){return _0x46f737[_0x35e1('0x9')](_0x35e1('0xa'),attributes,{'tableName':_0x35e1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe5b2=['mail_queues','lodash','util','moment','request-promise','path','rimraf','./mailQueue.attributes','exports','define','MailQueue'];(function(_0x3e4e94,_0x1a82e1){var _0xcb3ed3=function(_0x18f3d0){while(--_0x18f3d0){_0x3e4e94['push'](_0x3e4e94['shift']());}};_0xcb3ed3(++_0x1a82e1);}(_0xe5b2,0x9b));var _0x2e5b=function(_0x1a2347,_0x53830b){_0x1a2347=_0x1a2347-0x0;var _0xf7f6bd=_0xe5b2[_0x1a2347];return _0xf7f6bd;};'use strict';var _=require(_0x2e5b('0x0'));var util=require(_0x2e5b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2e5b('0x2'));var BPromise=require('bluebird');var rp=require(_0x2e5b('0x3'));var fs=require('fs');var path=require(_0x2e5b('0x4'));var rimraf=require(_0x2e5b('0x5'));var config=require('../../config/environment');var attributes=require(_0x2e5b('0x6'));module[_0x2e5b('0x7')]=function(_0x46a476,_0x3f6324){return _0x46a476[_0x2e5b('0x8')](_0x2e5b('0x9'),attributes,{'tableName':_0x2e5b('0xa'),'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 622856a..f7898c2 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 _0xd96d=['request','info','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','error','code','message','MailQueue,\x20%s,\x20%s','catch','GetMailQueue','MailQueue','options','raw','where','attributes','limit','map','include','model','then','ShowMailQueue','find','stringify','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','register'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xd96d,0x180));var _0xdd96=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0xd96d[_0x1e7b16];return _0x37fadc;};'use strict';var _=require('lodash');var util=require(_0xdd96('0x0'));var moment=require('moment');var BPromise=require(_0xdd96('0x1'));var rs=require(_0xdd96('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdd96('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xdd96('0x4'))(_0xdd96('0x5'));var config=require(_0xdd96('0x6'));var jayson=require(_0xdd96('0x7'));var client=jayson['client'][_0xdd96('0x8')]({'port':0x232a});config[_0xdd96('0x9')]=_['defaults'](config[_0xdd96('0x9')],{'host':_0xdd96('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdd96('0x9')]));require('./mailQueue.socket')[_0xdd96('0xb')](socket);function respondWithRpcPromise(_0x166ed7,_0x183d89,_0x2d7a62){return new BPromise(function(_0x32594b,_0x39a6d3){return client[_0xdd96('0xc')](_0x166ed7,_0x2d7a62)['then'](function(_0x204893){logger[_0xdd96('0xd')]('MailQueue,\x20%s,\x20%s',_0x183d89,_0xdd96('0xe'));logger[_0xdd96('0xf')](_0xdd96('0x10'),_0x183d89,_0xdd96('0xe'),JSON['stringify'](_0x204893));if(_0x204893[_0xdd96('0x11')]){if(_0x204893[_0xdd96('0x11')][_0xdd96('0x12')]===0x1f4){logger[_0xdd96('0x11')]('MailQueue,\x20%s,\x20%s',_0x183d89,_0x204893['error']['message']);return _0x39a6d3(_0x204893[_0xdd96('0x11')][_0xdd96('0x13')]);}logger[_0xdd96('0x11')](_0xdd96('0x14'),_0x183d89,_0x204893[_0xdd96('0x11')][_0xdd96('0x13')]);return _0x32594b(_0x204893[_0xdd96('0x11')][_0xdd96('0x13')]);}else{logger[_0xdd96('0xd')](_0xdd96('0x14'),_0x183d89,_0xdd96('0xe'));_0x32594b(_0x204893['result'][_0xdd96('0x13')]);}})[_0xdd96('0x15')](function(_0x4ba033){logger['error'](_0xdd96('0x14'),_0x183d89,_0x4ba033);_0x39a6d3(_0x4ba033);});});}exports[_0xdd96('0x16')]=function(_0x18b4a0){var _0x56db7c=this;return new Promise(function(_0x3814ff,_0x18fb5f){return db[_0xdd96('0x17')]['findAll']({'raw':_0x18b4a0[_0xdd96('0x18')]?_0x18b4a0[_0xdd96('0x18')][_0xdd96('0x19')]===undefined?!![]:![]:!![],'where':_0x18b4a0[_0xdd96('0x18')]?_0x18b4a0[_0xdd96('0x18')][_0xdd96('0x1a')]||null:null,'attributes':_0x18b4a0[_0xdd96('0x18')]?_0x18b4a0[_0xdd96('0x18')][_0xdd96('0x1b')]||null:null,'limit':_0x18b4a0[_0xdd96('0x18')]?_0x18b4a0['options'][_0xdd96('0x1c')]||null:null,'include':_0x18b4a0[_0xdd96('0x18')]?_0x18b4a0[_0xdd96('0x18')]['include']?_[_0xdd96('0x1d')](_0x18b4a0['options'][_0xdd96('0x1e')],function(_0x4ca661){return{'model':db[_0x4ca661[_0xdd96('0x1f')]],'as':_0x4ca661['as'],'attributes':_0x4ca661['attributes'],'include':_0x4ca661['include']?_[_0xdd96('0x1d')](_0x4ca661['include'],function(_0x4993a3){return{'model':db[_0x4993a3[_0xdd96('0x1f')]],'as':_0x4993a3['as'],'attributes':_0x4993a3['attributes'],'include':_0x4993a3[_0xdd96('0x1e')]?_['map'](_0x4993a3[_0xdd96('0x1e')],function(_0x36c8c5){return{'model':db[_0x36c8c5[_0xdd96('0x1f')]],'as':_0x36c8c5['as'],'attributes':_0x36c8c5[_0xdd96('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xdd96('0x20')](function(_0x85deb1){logger[_0xdd96('0xd')](_0xdd96('0x16'),_0x18b4a0);logger[_0xdd96('0xf')]('GetMailQueue',_0x18b4a0,JSON['stringify'](_0x85deb1));_0x3814ff(_0x85deb1);})['catch'](function(_0x790ee4){logger['error']('GetMailQueue',_0x790ee4[_0xdd96('0x13')],_0x18b4a0);_0x18fb5f(_0x56db7c['error'](0x1f4,_0x790ee4[_0xdd96('0x13')]));});});};exports[_0xdd96('0x21')]=function(_0x54c289){var _0x58793d=this;return new Promise(function(_0x1648a4,_0x4ec5c6){return db[_0xdd96('0x17')][_0xdd96('0x22')]({'raw':_0x54c289[_0xdd96('0x18')]?_0x54c289[_0xdd96('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x54c289[_0xdd96('0x18')]?_0x54c289[_0xdd96('0x18')]['where']||null:null,'attributes':_0x54c289[_0xdd96('0x18')]?_0x54c289[_0xdd96('0x18')]['attributes']||null:null,'include':_0x54c289[_0xdd96('0x18')]?_0x54c289['options']['include']?_[_0xdd96('0x1d')](_0x54c289['options']['include'],function(_0x16e152){return{'model':db[_0x16e152[_0xdd96('0x1f')]],'as':_0x16e152['as'],'attributes':_0x16e152[_0xdd96('0x1b')],'include':_0x16e152[_0xdd96('0x1e')]?_[_0xdd96('0x1d')](_0x16e152[_0xdd96('0x1e')],function(_0x3b1c2a){return{'model':db[_0x3b1c2a[_0xdd96('0x1f')]],'as':_0x3b1c2a['as'],'attributes':_0x3b1c2a['attributes'],'include':_0x3b1c2a[_0xdd96('0x1e')]?_[_0xdd96('0x1d')](_0x3b1c2a[_0xdd96('0x1e')],function(_0x217710){return{'model':db[_0x217710[_0xdd96('0x1f')]],'as':_0x217710['as'],'attributes':_0x217710['attributes']};}):[]};}):[]};}):[]:[]})[_0xdd96('0x20')](function(_0x1a8519){logger[_0xdd96('0xd')](_0xdd96('0x21'),_0x54c289);logger[_0xdd96('0xf')](_0xdd96('0x21'),_0x54c289,JSON[_0xdd96('0x23')](_0x1a8519));_0x1648a4(_0x1a8519);})[_0xdd96('0x15')](function(_0x58c7e9){logger[_0xdd96('0x11')](_0xdd96('0x21'),_0x58c7e9[_0xdd96('0x13')],_0x54c289);_0x4ec5c6(_0x58793d[_0xdd96('0x11')](0x1f4,_0x58c7e9[_0xdd96('0x13')]));});});}; \ No newline at end of file +var _0x587e=['findAll','options','raw','attributes','include','map','model','GetMailQueue','find','then','ShowMailQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','./mailQueue.socket','request','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x34b1b8,_0x54c9bf){var _0x542dd8=function(_0xff3f89){while(--_0xff3f89){_0x34b1b8['push'](_0x34b1b8['shift']());}};_0x542dd8(++_0x54c9bf);}(_0x587e,0xa3));var _0xe587=function(_0x41aa02,_0x1865a9){_0x41aa02=_0x41aa02-0x0;var _0x350643=_0x587e[_0x41aa02];return _0x350643;};'use strict';var _=require(_0xe587('0x0'));var util=require(_0xe587('0x1'));var moment=require(_0xe587('0x2'));var BPromise=require(_0xe587('0x3'));var rs=require(_0xe587('0x4'));var fs=require('fs');var Redis=require(_0xe587('0x5'));var db=require(_0xe587('0x6'))['db'];var utils=require(_0xe587('0x7'));var logger=require('../../config/logger')(_0xe587('0x8'));var config=require(_0xe587('0x9'));var jayson=require(_0xe587('0xa'));var client=jayson[_0xe587('0xb')]['http']({'port':0x232a});config[_0xe587('0xc')]=_[_0xe587('0xd')](config[_0xe587('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe587('0xe'))['register'](socket);function respondWithRpcPromise(_0x143b2a,_0xc715e8,_0xfbd185){return new BPromise(function(_0x161051,_0x2d3523){return client[_0xe587('0xf')](_0x143b2a,_0xfbd185)['then'](function(_0x4d0861){logger[_0xe587('0x10')](_0xe587('0x11'),_0xc715e8,_0xe587('0x12'));logger[_0xe587('0x13')](_0xe587('0x14'),_0xc715e8,'request\x20sent',JSON[_0xe587('0x15')](_0x4d0861));if(_0x4d0861[_0xe587('0x16')]){if(_0x4d0861[_0xe587('0x16')][_0xe587('0x17')]===0x1f4){logger[_0xe587('0x16')](_0xe587('0x11'),_0xc715e8,_0x4d0861[_0xe587('0x16')][_0xe587('0x18')]);return _0x2d3523(_0x4d0861[_0xe587('0x16')][_0xe587('0x18')]);}logger[_0xe587('0x16')](_0xe587('0x11'),_0xc715e8,_0x4d0861[_0xe587('0x16')][_0xe587('0x18')]);return _0x161051(_0x4d0861[_0xe587('0x16')][_0xe587('0x18')]);}else{logger[_0xe587('0x10')]('MailQueue,\x20%s,\x20%s',_0xc715e8,_0xe587('0x12'));_0x161051(_0x4d0861[_0xe587('0x19')][_0xe587('0x18')]);}})[_0xe587('0x1a')](function(_0x4d311a){logger[_0xe587('0x16')](_0xe587('0x11'),_0xc715e8,_0x4d311a);_0x2d3523(_0x4d311a);});});}exports['GetMailQueue']=function(_0x502f0a){var _0x202092=this;return new Promise(function(_0x287440,_0x55b696){return db['MailQueue'][_0xe587('0x1b')]({'raw':_0x502f0a['options']?_0x502f0a[_0xe587('0x1c')][_0xe587('0x1d')]===undefined?!![]:![]:!![],'where':_0x502f0a[_0xe587('0x1c')]?_0x502f0a[_0xe587('0x1c')]['where']||null:null,'attributes':_0x502f0a[_0xe587('0x1c')]?_0x502f0a['options'][_0xe587('0x1e')]||null:null,'limit':_0x502f0a['options']?_0x502f0a[_0xe587('0x1c')]['limit']||null:null,'include':_0x502f0a[_0xe587('0x1c')]?_0x502f0a['options'][_0xe587('0x1f')]?_[_0xe587('0x20')](_0x502f0a[_0xe587('0x1c')][_0xe587('0x1f')],function(_0x2fbddf){return{'model':db[_0x2fbddf[_0xe587('0x21')]],'as':_0x2fbddf['as'],'attributes':_0x2fbddf['attributes'],'include':_0x2fbddf[_0xe587('0x1f')]?_['map'](_0x2fbddf[_0xe587('0x1f')],function(_0x3034f5){return{'model':db[_0x3034f5[_0xe587('0x21')]],'as':_0x3034f5['as'],'attributes':_0x3034f5[_0xe587('0x1e')],'include':_0x3034f5[_0xe587('0x1f')]?_[_0xe587('0x20')](_0x3034f5[_0xe587('0x1f')],function(_0x3f3cd2){return{'model':db[_0x3f3cd2[_0xe587('0x21')]],'as':_0x3f3cd2['as'],'attributes':_0x3f3cd2[_0xe587('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x44cf21){logger[_0xe587('0x10')](_0xe587('0x22'),_0x502f0a);logger[_0xe587('0x13')](_0xe587('0x22'),_0x502f0a,JSON[_0xe587('0x15')](_0x44cf21));_0x287440(_0x44cf21);})['catch'](function(_0x47930a){logger[_0xe587('0x16')](_0xe587('0x22'),_0x47930a[_0xe587('0x18')],_0x502f0a);_0x55b696(_0x202092['error'](0x1f4,_0x47930a[_0xe587('0x18')]));});});};exports['ShowMailQueue']=function(_0x4e3565){var _0x158761=this;return new Promise(function(_0x580d95,_0x75de5d){return db['MailQueue'][_0xe587('0x23')]({'raw':_0x4e3565[_0xe587('0x1c')]?_0x4e3565[_0xe587('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x4e3565[_0xe587('0x1c')]?_0x4e3565['options']['where']||null:null,'attributes':_0x4e3565[_0xe587('0x1c')]?_0x4e3565[_0xe587('0x1c')][_0xe587('0x1e')]||null:null,'include':_0x4e3565[_0xe587('0x1c')]?_0x4e3565[_0xe587('0x1c')]['include']?_[_0xe587('0x20')](_0x4e3565[_0xe587('0x1c')][_0xe587('0x1f')],function(_0x31065f){return{'model':db[_0x31065f[_0xe587('0x21')]],'as':_0x31065f['as'],'attributes':_0x31065f['attributes'],'include':_0x31065f[_0xe587('0x1f')]?_[_0xe587('0x20')](_0x31065f['include'],function(_0x12fb01){return{'model':db[_0x12fb01[_0xe587('0x21')]],'as':_0x12fb01['as'],'attributes':_0x12fb01[_0xe587('0x1e')],'include':_0x12fb01[_0xe587('0x1f')]?_[_0xe587('0x20')](_0x12fb01[_0xe587('0x1f')],function(_0x960898){return{'model':db[_0x960898[_0xe587('0x21')]],'as':_0x960898['as'],'attributes':_0x960898['attributes']};}):[]};}):[]};}):[]:[]})[_0xe587('0x24')](function(_0x2fc049){logger[_0xe587('0x10')](_0xe587('0x25'),_0x4e3565);logger[_0xe587('0x13')]('ShowMailQueue',_0x4e3565,JSON[_0xe587('0x15')](_0x2fc049));_0x580d95(_0x2fc049);})[_0xe587('0x1a')](function(_0xde115f){logger[_0xe587('0x16')](_0xe587('0x25'),_0xde115f[_0xe587('0x18')],_0x4e3565);_0x75de5d(_0x158761[_0xe587('0x16')](0x1f4,_0xde115f[_0xe587('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index fefa72b..b35f0d9 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 _0x7868=['save','remove','update','emit','register','length','mailQueue:','./mailQueue.events'];(function(_0x1d8d9b,_0x44c334){var _0x5ad306=function(_0x209e40){while(--_0x209e40){_0x1d8d9b['push'](_0x1d8d9b['shift']());}};_0x5ad306(++_0x44c334);}(_0x7868,0x67));var _0x8786=function(_0x4bf0d4,_0x4d0532){_0x4bf0d4=_0x4bf0d4-0x0;var _0x2c8b82=_0x7868[_0x4bf0d4];return _0x2c8b82;};'use strict';var MailQueueEvents=require(_0x8786('0x0'));var events=[_0x8786('0x1'),_0x8786('0x2'),_0x8786('0x3')];function createListener(_0x17ef63,_0x6ef4ee){return function(_0x1dccbb){_0x6ef4ee[_0x8786('0x4')](_0x17ef63,_0x1dccbb);};}function removeListener(_0x368afb,_0x18c81b){return function(){MailQueueEvents['removeListener'](_0x368afb,_0x18c81b);};}exports[_0x8786('0x5')]=function(_0x3ca58e){for(var _0xf84a27=0x0,_0x58444b=events[_0x8786('0x6')];_0xf84a27<_0x58444b;_0xf84a27++){var _0x5a9090=events[_0xf84a27];var _0x12143f=createListener(_0x8786('0x7')+_0x5a9090,_0x3ca58e);MailQueueEvents['on'](_0x5a9090,_0x12143f);}}; \ No newline at end of file +var _0xcd92=['register','length','mailQueue:','./mailQueue.events','save','remove','update','emit'];(function(_0x3b90ab,_0x174a22){var _0x206e92=function(_0x21fbd3){while(--_0x21fbd3){_0x3b90ab['push'](_0x3b90ab['shift']());}};_0x206e92(++_0x174a22);}(_0xcd92,0xb3));var _0x2cd9=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xcd92[_0x5c2e3e];return _0x53f64a;};'use strict';var MailQueueEvents=require(_0x2cd9('0x0'));var events=[_0x2cd9('0x1'),_0x2cd9('0x2'),_0x2cd9('0x3')];function createListener(_0x4b6eb3,_0x56ac4d){return function(_0xbbfbea){_0x56ac4d[_0x2cd9('0x4')](_0x4b6eb3,_0xbbfbea);};}function removeListener(_0x13e419,_0x5967ba){return function(){MailQueueEvents['removeListener'](_0x13e419,_0x5967ba);};}exports[_0x2cd9('0x5')]=function(_0x5da439){for(var _0x144ef4=0x0,_0x1a5775=events[_0x2cd9('0x6')];_0x144ef4<_0x1a5775;_0x144ef4++){var _0x3c8853=events[_0x144ef4];var _0x5ec84b=createListener(_0x2cd9('0x7')+_0x3c8853,_0x5da439);MailQueueEvents['on'](_0x3c8853,_0x5ec84b);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 13cecbb..a119eef 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 _0x8bde=['util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x2d0ffc,_0x105143){var _0x55ca40=function(_0xc5853c){while(--_0xc5853c){_0x2d0ffc['push'](_0x2d0ffc['shift']());}};_0x55ca40(++_0x105143);}(_0x8bde,0xaf));var _0xe8bd=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x8bde[_0x5d2803];return _0xdcad2c;};'use strict';var multer=require(_0xe8bd('0x0'));var util=require(_0xe8bd('0x1'));var path=require(_0xe8bd('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe8bd('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe8bd('0x4'));var interaction=require(_0xe8bd('0x5'));var config=require(_0xe8bd('0x6'));var controller=require(_0xe8bd('0x7'));router[_0xe8bd('0x8')]('/',auth[_0xe8bd('0x9')](),controller[_0xe8bd('0xa')]);router[_0xe8bd('0x8')](_0xe8bd('0xb'),auth[_0xe8bd('0x9')](),controller[_0xe8bd('0xc')]);router[_0xe8bd('0x8')](_0xe8bd('0xd'),auth['isAuthenticated'](),controller[_0xe8bd('0xe')]);router[_0xe8bd('0xf')]('/',auth['isAuthenticated'](),controller[_0xe8bd('0x10')]);router[_0xe8bd('0x11')](_0xe8bd('0xd'),auth['isAuthenticated'](),controller[_0xe8bd('0x12')]);router[_0xe8bd('0x13')](_0xe8bd('0xd'),auth[_0xe8bd('0x9')](),controller[_0xe8bd('0x14')]);module[_0xe8bd('0x15')]=router; \ No newline at end of file +var _0x716b=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5ca353,_0x21eb37){var _0x4f2fe5=function(_0x14cd1b){while(--_0x14cd1b){_0x5ca353['push'](_0x5ca353['shift']());}};_0x4f2fe5(++_0x21eb37);}(_0x716b,0x137));var _0xb716=function(_0x528575,_0x2e067d){_0x528575=_0x528575-0x0;var _0x3063b7=_0x716b[_0x528575];return _0x3063b7;};'use strict';var multer=require(_0xb716('0x0'));var util=require(_0xb716('0x1'));var path=require(_0xb716('0x2'));var timeout=require(_0xb716('0x3'));var express=require('express');var router=express[_0xb716('0x4')]();var fs_extra=require(_0xb716('0x5'));var auth=require(_0xb716('0x6'));var interaction=require(_0xb716('0x7'));var config=require(_0xb716('0x8'));var controller=require('./mailQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xb716('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xb716('0xa')](_0xb716('0xb'),auth[_0xb716('0xc')](),controller[_0xb716('0xd')]);router[_0xb716('0xe')]('/',auth[_0xb716('0xc')](),controller[_0xb716('0xf')]);router[_0xb716('0x10')](_0xb716('0xb'),auth[_0xb716('0xc')](),controller[_0xb716('0x11')]);router[_0xb716('0x12')]('/:id',auth[_0xb716('0xc')](),controller[_0xb716('0x13')]);module[_0xb716('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index c422ce4..e62f05e 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 _0x81a8=['DATE','moment','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x81a8,0x151));var _0x881a=function(_0x5fd04,_0x5d6fff){_0x5fd04=_0x5fd04-0x0;var _0x48c27b=_0x81a8[_0x5fd04];return _0x48c27b;};'use strict';var moment=require(_0x881a('0x0'));var Sequelize=require('sequelize');module[_0x881a('0x1')]={'uniqueid':{'type':Sequelize[_0x881a('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x881a('0x2')]},'joinAt':{'type':Sequelize[_0x881a('0x3')]},'leaveAt':{'type':Sequelize[_0x881a('0x3')]},'acceptAt':{'type':Sequelize[_0x881a('0x3')]},'exitAt':{'type':Sequelize[_0x881a('0x3')]},'reason':{'type':Sequelize[_0x881a('0x2')]}}; \ No newline at end of file +var _0x7501=['DATE','exports','STRING'];(function(_0x26f8de,_0xea5e13){var _0x192c08=function(_0x13467d){while(--_0x13467d){_0x26f8de['push'](_0x26f8de['shift']());}};_0x192c08(++_0xea5e13);}(_0x7501,0x67));var _0x1750=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x7501[_0x4a747d];return _0x3a5b5c;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1750('0x0')]={'uniqueid':{'type':Sequelize[_0x1750('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x1750('0x1')]},'joinAt':{'type':Sequelize[_0x1750('0x2')]},'leaveAt':{'type':Sequelize[_0x1750('0x2')]},'acceptAt':{'type':Sequelize[_0x1750('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x1750('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 4dc66f7..e3d0fb0 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 _0xf61e=['where','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','find','create','update','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','set','Content-Range','apply','destroy','then','status','error','stack','name','send','index','map','MailQueueReport','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order'];(function(_0x4cc52a,_0x3640e7){var _0x30fabc=function(_0x18688b){while(--_0x18688b){_0x4cc52a['push'](_0x4cc52a['shift']());}};_0x30fabc(++_0x3640e7);}(_0xf61e,0x191));var _0xef61=function(_0x23a9c4,_0x10cb6d){_0x23a9c4=_0x23a9c4-0x0;var _0x5ac755=_0xf61e[_0x23a9c4];return _0x5ac755;};'use strict';var emlformat=require(_0xef61('0x0'));var rimraf=require(_0xef61('0x1'));var zipdir=require(_0xef61('0x2'));var jsonpatch=require(_0xef61('0x3'));var rp=require(_0xef61('0x4'));var moment=require(_0xef61('0x5'));var BPromise=require(_0xef61('0x6'));var Mustache=require(_0xef61('0x7'));var util=require(_0xef61('0x8'));var path=require(_0xef61('0x9'));var sox=require(_0xef61('0xa'));var csv=require(_0xef61('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xef61('0xc'));var _=require(_0xef61('0xd'));var squel=require('squel');var crypto=require(_0xef61('0xe'));var jsforce=require(_0xef61('0xf'));var deskjs=require(_0xef61('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xef61('0x11'));var Redis=require(_0xef61('0x12'));var authService=require(_0xef61('0x13'));var qs=require(_0xef61('0x14'));var as=require(_0xef61('0x15'));var hardwareService=require(_0xef61('0x16'));var logger=require(_0xef61('0x17'))(_0xef61('0x18'));var utils=require(_0xef61('0x19'));var config=require(_0xef61('0x1a'));var licenseUtil=require(_0xef61('0x1b'));var db=require(_0xef61('0x1c'))['db'];function respondWithStatusCode(_0x114e1f,_0x318f1c){_0x318f1c=_0x318f1c||0xcc;return function(_0x5de159){if(_0x5de159){return _0x114e1f[_0xef61('0x1d')](_0x318f1c);}return _0x114e1f['status'](_0x318f1c)[_0xef61('0x1e')]();};}function respondWithResult(_0x1db2a9,_0x370ee0){_0x370ee0=_0x370ee0||0xc8;return function(_0x76ef9b){if(_0x76ef9b){return _0x1db2a9['status'](_0x370ee0)[_0xef61('0x1f')](_0x76ef9b);}};}function respondWithFilteredResult(_0x435beb,_0x1224c2){return function(_0x78ff22){if(_0x78ff22){var _0x588a61=typeof _0x1224c2[_0xef61('0x20')]===_0xef61('0x21')&&typeof _0x1224c2['limit']===_0xef61('0x21');var _0x408541=_0x78ff22[_0xef61('0x22')];var _0x22dc1b=_0x588a61?0x0:_0x1224c2[_0xef61('0x20')];var _0x28315a=_0x588a61?_0x78ff22[_0xef61('0x22')]:_0x1224c2['offset']+_0x1224c2[_0xef61('0x23')];var _0x2c8dad;if(_0x28315a>=_0x408541){_0x28315a=_0x408541;_0x2c8dad=0xc8;}else{_0x2c8dad=0xce;}_0x435beb['status'](_0x2c8dad);return _0x435beb[_0xef61('0x24')](_0xef61('0x25'),_0x22dc1b+'-'+_0x28315a+'/'+_0x408541)[_0xef61('0x1f')](_0x78ff22);}return null;};}function patchUpdates(_0x26cf42){return function(_0xb0d7a4){try{jsonpatch[_0xef61('0x26')](_0xb0d7a4,_0x26cf42,!![]);}catch(_0x92ea33){return BPromise['reject'](_0x92ea33);}return _0xb0d7a4['save']();};}function saveUpdates(_0x3d31c1,_0x58bd7d){return function(_0x389d6d){if(_0x389d6d){return _0x389d6d['update'](_0x3d31c1)['then'](function(_0x2f0569){return _0x2f0569;});}return null;};}function removeEntity(_0x5ce99d,_0x53181b){return function(_0xfbee94){if(_0xfbee94){return _0xfbee94[_0xef61('0x27')]()[_0xef61('0x28')](function(){_0x5ce99d[_0xef61('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16b144,_0x4e738f){return function(_0x2a6832){if(!_0x2a6832){_0x16b144[_0xef61('0x1d')](0x194);}return _0x2a6832;};}function handleError(_0x2419a9,_0xf4c7c9){_0xf4c7c9=_0xf4c7c9||0x1f4;return function(_0x2155f1){logger[_0xef61('0x2a')](_0x2155f1[_0xef61('0x2b')]);if(_0x2155f1[_0xef61('0x2c')]){delete _0x2155f1[_0xef61('0x2c')];}_0x2419a9[_0xef61('0x29')](_0xf4c7c9)[_0xef61('0x2d')](_0x2155f1);};}exports[_0xef61('0x2e')]=function(_0xeb9a62,_0x63edd4){var _0x1f3572={},_0x85978={},_0x39c15e={'count':0x0,'rows':[]};var _0x393ea9=_[_0xef61('0x2f')](db[_0xef61('0x30')][_0xef61('0x31')],function(_0x53fa3b){return{'name':_0x53fa3b['fieldName'],'type':_0x53fa3b['type'][_0xef61('0x32')]};});_0x85978[_0xef61('0x33')]=_[_0xef61('0x2f')](_0x393ea9,'name');_0x85978[_0xef61('0x34')]=_[_0xef61('0x35')](_0xeb9a62['query']);_0x85978[_0xef61('0x36')]=_['intersection'](_0x85978['model'],_0x85978[_0xef61('0x34')]);_0x1f3572['attributes']=_[_0xef61('0x37')](_0x85978['model'],qs[_0xef61('0x38')](_0xeb9a62[_0xef61('0x34')][_0xef61('0x38')]));_0x1f3572[_0xef61('0x39')]=_0x1f3572[_0xef61('0x39')][_0xef61('0x3a')]?_0x1f3572[_0xef61('0x39')]:_0x85978[_0xef61('0x33')];if(!_0xeb9a62[_0xef61('0x34')][_0xef61('0x3b')]('nolimit')){_0x1f3572[_0xef61('0x23')]=qs[_0xef61('0x23')](_0xeb9a62[_0xef61('0x34')][_0xef61('0x23')]);_0x1f3572[_0xef61('0x20')]=qs['offset'](_0xeb9a62[_0xef61('0x34')][_0xef61('0x20')]);}_0x1f3572[_0xef61('0x3c')]=qs['sort'](_0xeb9a62['query']['sort']);_0x1f3572[_0xef61('0x3d')]=qs['filters'](_['pick'](_0xeb9a62['query'],_0x85978[_0xef61('0x36')]),_0x393ea9);if(_0xeb9a62[_0xef61('0x34')][_0xef61('0x3e')]){_0x1f3572['where']=_['merge'](_0x1f3572['where'],{'$or':_[_0xef61('0x2f')](_0x393ea9,function(_0x32ad44){if(_0x32ad44['type']!==_0xef61('0x3f')){var _0x12f442={};_0x12f442[_0x32ad44[_0xef61('0x2c')]]={'$like':'%'+_0xeb9a62[_0xef61('0x34')]['filter']+'%'};return _0x12f442;}})});}_0x1f3572=_[_0xef61('0x40')]({},_0x1f3572,_0xeb9a62[_0xef61('0x41')]);var _0x3103d4={'where':_0x1f3572[_0xef61('0x3d')]};return db['MailQueueReport']['count'](_0x3103d4)[_0xef61('0x28')](function(_0x462972){_0x39c15e[_0xef61('0x22')]=_0x462972;if(_0xeb9a62['query'][_0xef61('0x42')]){_0x1f3572[_0xef61('0x43')]=[{'all':!![]}];}return db[_0xef61('0x30')][_0xef61('0x44')](_0x1f3572);})['then'](function(_0x545597){_0x39c15e['rows']=_0x545597;return _0x39c15e;})[_0xef61('0x28')](respondWithFilteredResult(_0x63edd4,_0x1f3572))[_0xef61('0x45')](handleError(_0x63edd4,null));};exports[_0xef61('0x46')]=function(_0xe40d,_0x3f81a1){var _0x272143={'raw':!![],'where':{'id':_0xe40d['params']['id']}},_0xc9b467={};_0xc9b467[_0xef61('0x33')]=_[_0xef61('0x35')](db[_0xef61('0x30')][_0xef61('0x31')]);_0xc9b467['query']=_[_0xef61('0x35')](_0xe40d[_0xef61('0x34')]);_0xc9b467[_0xef61('0x36')]=_[_0xef61('0x37')](_0xc9b467[_0xef61('0x33')],_0xc9b467[_0xef61('0x34')]);_0x272143['attributes']=_[_0xef61('0x37')](_0xc9b467[_0xef61('0x33')],qs[_0xef61('0x38')](_0xe40d['query'][_0xef61('0x38')]));_0x272143[_0xef61('0x39')]=_0x272143[_0xef61('0x39')][_0xef61('0x3a')]?_0x272143[_0xef61('0x39')]:_0xc9b467[_0xef61('0x33')];if(_0xe40d['query'][_0xef61('0x42')]){_0x272143[_0xef61('0x43')]=[{'all':!![]}];}_0x272143=_['merge']({},_0x272143,_0xe40d[_0xef61('0x41')]);return db[_0xef61('0x30')][_0xef61('0x47')](_0x272143)[_0xef61('0x28')](handleEntityNotFound(_0x3f81a1,null))['then'](respondWithResult(_0x3f81a1,null))[_0xef61('0x45')](handleError(_0x3f81a1,null));};exports[_0xef61('0x48')]=function(_0x5e614b,_0x47b09d){return db[_0xef61('0x30')][_0xef61('0x48')](_0x5e614b['body'],{})[_0xef61('0x28')](respondWithResult(_0x47b09d,0xc9))[_0xef61('0x45')](handleError(_0x47b09d,null));};exports[_0xef61('0x49')]=function(_0x2904e0,_0x13bb20){if(_0x2904e0[_0xef61('0x4a')]['id']){delete _0x2904e0[_0xef61('0x4a')]['id'];}return db['MailQueueReport'][_0xef61('0x47')]({'where':{'id':_0x2904e0['params']['id']}})[_0xef61('0x28')](handleEntityNotFound(_0x13bb20,null))[_0xef61('0x28')](saveUpdates(_0x2904e0[_0xef61('0x4a')],null))[_0xef61('0x28')](respondWithResult(_0x13bb20,null))[_0xef61('0x45')](handleError(_0x13bb20,null));};exports[_0xef61('0x27')]=function(_0x3e23eb,_0x1565c7){return db[_0xef61('0x30')]['find']({'where':{'id':_0x3e23eb[_0xef61('0x4b')]['id']}})[_0xef61('0x28')](handleEntityNotFound(_0x1565c7,null))['then'](removeEntity(_0x1565c7,null))['catch'](handleError(_0x1565c7,null));};exports[_0xef61('0x4c')]=function(_0x1ce127,_0x504389){return db[_0xef61('0x30')]['describe']()[_0xef61('0x28')](respondWithResult(_0x504389,null))[_0xef61('0x45')](handleError(_0x504389,null));}; \ No newline at end of file +var _0x81c6=['includeAll','include','findAll','rows','catch','show','keys','fields','length','create','body','find','params','describe','rimraf','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','update','then','destroy','end','name','send','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','MailQueueReport'];(function(_0x1a18dc,_0x225d80){var _0x3c7ace=function(_0xea84a4){while(--_0xea84a4){_0x1a18dc['push'](_0x1a18dc['shift']());}};_0x3c7ace(++_0x225d80);}(_0x81c6,0x1d5));var _0x681c=function(_0x2ca454,_0x285eb5){_0x2ca454=_0x2ca454-0x0;var _0xaa0037=_0x81c6[_0x2ca454];return _0xaa0037;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x681c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x681c('0x1'));var BPromise=require(_0x681c('0x2'));var Mustache=require(_0x681c('0x3'));var util=require('util');var path=require(_0x681c('0x4'));var sox=require(_0x681c('0x5'));var csv=require(_0x681c('0x6'));var ejs=require(_0x681c('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x681c('0x8'));var squel=require(_0x681c('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x681c('0xa'));var toCsv=require(_0x681c('0x6'));var querystring=require(_0x681c('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x681c('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x681c('0xd'));var hardwareService=require(_0x681c('0xe'));var logger=require(_0x681c('0xf'))(_0x681c('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x681c('0x11'));var db=require(_0x681c('0x12'))['db'];function respondWithStatusCode(_0x2d379b,_0x50cae8){_0x50cae8=_0x50cae8||0xcc;return function(_0x2e4651){if(_0x2e4651){return _0x2d379b['sendStatus'](_0x50cae8);}return _0x2d379b[_0x681c('0x13')](_0x50cae8)['end']();};}function respondWithResult(_0x2c059e,_0x27c3a2){_0x27c3a2=_0x27c3a2||0xc8;return function(_0xe8bb4d){if(_0xe8bb4d){return _0x2c059e[_0x681c('0x13')](_0x27c3a2)[_0x681c('0x14')](_0xe8bb4d);}};}function respondWithFilteredResult(_0x2bc3fb,_0x50a4ec){return function(_0x2b0939){if(_0x2b0939){var _0x1135c9=typeof _0x50a4ec[_0x681c('0x15')]===_0x681c('0x16')&&typeof _0x50a4ec[_0x681c('0x17')]===_0x681c('0x16');var _0x4e7df2=_0x2b0939[_0x681c('0x18')];var _0x42f506=_0x1135c9?0x0:_0x50a4ec[_0x681c('0x15')];var _0x42304f=_0x1135c9?_0x2b0939['count']:_0x50a4ec[_0x681c('0x15')]+_0x50a4ec[_0x681c('0x17')];var _0x54d27f;if(_0x42304f>=_0x4e7df2){_0x42304f=_0x4e7df2;_0x54d27f=0xc8;}else{_0x54d27f=0xce;}_0x2bc3fb[_0x681c('0x13')](_0x54d27f);return _0x2bc3fb['set'](_0x681c('0x19'),_0x42f506+'-'+_0x42304f+'/'+_0x4e7df2)[_0x681c('0x14')](_0x2b0939);}return null;};}function patchUpdates(_0x11d68d){return function(_0x33c495){try{jsonpatch[_0x681c('0x1a')](_0x33c495,_0x11d68d,!![]);}catch(_0x51d626){return BPromise['reject'](_0x51d626);}return _0x33c495['save']();};}function saveUpdates(_0x2e5331,_0x39c8b7){return function(_0x3adfe3){if(_0x3adfe3){return _0x3adfe3[_0x681c('0x1b')](_0x2e5331)[_0x681c('0x1c')](function(_0x29f3fa){return _0x29f3fa;});}return null;};}function removeEntity(_0x415a0a,_0x3d0297){return function(_0x1b3d2b){if(_0x1b3d2b){return _0x1b3d2b[_0x681c('0x1d')]()[_0x681c('0x1c')](function(){_0x415a0a[_0x681c('0x13')](0xcc)[_0x681c('0x1e')]();});}};}function handleEntityNotFound(_0x218410,_0x3237ed){return function(_0x228f59){if(!_0x228f59){_0x218410['sendStatus'](0x194);}return _0x228f59;};}function handleError(_0x11063b,_0x5705a7){_0x5705a7=_0x5705a7||0x1f4;return function(_0x5f8d64){logger['error'](_0x5f8d64['stack']);if(_0x5f8d64[_0x681c('0x1f')]){delete _0x5f8d64[_0x681c('0x1f')];}_0x11063b[_0x681c('0x13')](_0x5705a7)[_0x681c('0x20')](_0x5f8d64);};}exports['index']=function(_0x3b1031,_0x39fca3){var _0x2fde4b={},_0x936fce={},_0x147cda={'count':0x0,'rows':[]};var _0x204006=_[_0x681c('0x21')](db['MailQueueReport'][_0x681c('0x22')],function(_0x390be5){return{'name':_0x390be5[_0x681c('0x23')],'type':_0x390be5['type'][_0x681c('0x24')]};});_0x936fce[_0x681c('0x25')]=_[_0x681c('0x21')](_0x204006,'name');_0x936fce[_0x681c('0x26')]=_['keys'](_0x3b1031['query']);_0x936fce[_0x681c('0x27')]=_[_0x681c('0x28')](_0x936fce[_0x681c('0x25')],_0x936fce['query']);_0x2fde4b[_0x681c('0x29')]=_['intersection'](_0x936fce[_0x681c('0x25')],qs['fields'](_0x3b1031['query']['fields']));_0x2fde4b[_0x681c('0x29')]=_0x2fde4b[_0x681c('0x29')]['length']?_0x2fde4b[_0x681c('0x29')]:_0x936fce['model'];if(!_0x3b1031['query'][_0x681c('0x2a')]('nolimit')){_0x2fde4b[_0x681c('0x17')]=qs[_0x681c('0x17')](_0x3b1031[_0x681c('0x26')]['limit']);_0x2fde4b['offset']=qs[_0x681c('0x15')](_0x3b1031[_0x681c('0x26')]['offset']);}_0x2fde4b[_0x681c('0x2b')]=qs[_0x681c('0x2c')](_0x3b1031[_0x681c('0x26')]['sort']);_0x2fde4b[_0x681c('0x2d')]=qs[_0x681c('0x27')](_['pick'](_0x3b1031[_0x681c('0x26')],_0x936fce[_0x681c('0x27')]),_0x204006);if(_0x3b1031[_0x681c('0x26')][_0x681c('0x2e')]){_0x2fde4b[_0x681c('0x2d')]=_['merge'](_0x2fde4b['where'],{'$or':_[_0x681c('0x21')](_0x204006,function(_0x373f33){if(_0x373f33['type']!==_0x681c('0x2f')){var _0x183f13={};_0x183f13[_0x373f33['name']]={'$like':'%'+_0x3b1031[_0x681c('0x26')][_0x681c('0x2e')]+'%'};return _0x183f13;}})});}_0x2fde4b=_[_0x681c('0x30')]({},_0x2fde4b,_0x3b1031[_0x681c('0x31')]);var _0x3b258b={'where':_0x2fde4b[_0x681c('0x2d')]};return db[_0x681c('0x32')][_0x681c('0x18')](_0x3b258b)[_0x681c('0x1c')](function(_0x1ece6f){_0x147cda['count']=_0x1ece6f;if(_0x3b1031[_0x681c('0x26')][_0x681c('0x33')]){_0x2fde4b[_0x681c('0x34')]=[{'all':!![]}];}return db[_0x681c('0x32')][_0x681c('0x35')](_0x2fde4b);})[_0x681c('0x1c')](function(_0x542c02){_0x147cda[_0x681c('0x36')]=_0x542c02;return _0x147cda;})[_0x681c('0x1c')](respondWithFilteredResult(_0x39fca3,_0x2fde4b))[_0x681c('0x37')](handleError(_0x39fca3,null));};exports[_0x681c('0x38')]=function(_0x30abe8,_0x5dd2f4){var _0x2143a9={'raw':!![],'where':{'id':_0x30abe8['params']['id']}},_0x5d7031={};_0x5d7031[_0x681c('0x25')]=_[_0x681c('0x39')](db[_0x681c('0x32')][_0x681c('0x22')]);_0x5d7031['query']=_[_0x681c('0x39')](_0x30abe8['query']);_0x5d7031['filters']=_[_0x681c('0x28')](_0x5d7031[_0x681c('0x25')],_0x5d7031[_0x681c('0x26')]);_0x2143a9[_0x681c('0x29')]=_[_0x681c('0x28')](_0x5d7031[_0x681c('0x25')],qs['fields'](_0x30abe8[_0x681c('0x26')][_0x681c('0x3a')]));_0x2143a9['attributes']=_0x2143a9['attributes'][_0x681c('0x3b')]?_0x2143a9['attributes']:_0x5d7031[_0x681c('0x25')];if(_0x30abe8['query']['includeAll']){_0x2143a9['include']=[{'all':!![]}];}_0x2143a9=_[_0x681c('0x30')]({},_0x2143a9,_0x30abe8[_0x681c('0x31')]);return db[_0x681c('0x32')]['find'](_0x2143a9)[_0x681c('0x1c')](handleEntityNotFound(_0x5dd2f4,null))[_0x681c('0x1c')](respondWithResult(_0x5dd2f4,null))['catch'](handleError(_0x5dd2f4,null));};exports[_0x681c('0x3c')]=function(_0x17bb48,_0x15d1c0){return db[_0x681c('0x32')]['create'](_0x17bb48[_0x681c('0x3d')],{})['then'](respondWithResult(_0x15d1c0,0xc9))[_0x681c('0x37')](handleError(_0x15d1c0,null));};exports[_0x681c('0x1b')]=function(_0xa56f20,_0x5731f0){if(_0xa56f20[_0x681c('0x3d')]['id']){delete _0xa56f20[_0x681c('0x3d')]['id'];}return db[_0x681c('0x32')][_0x681c('0x3e')]({'where':{'id':_0xa56f20[_0x681c('0x3f')]['id']}})[_0x681c('0x1c')](handleEntityNotFound(_0x5731f0,null))[_0x681c('0x1c')](saveUpdates(_0xa56f20[_0x681c('0x3d')],null))[_0x681c('0x1c')](respondWithResult(_0x5731f0,null))[_0x681c('0x37')](handleError(_0x5731f0,null));};exports[_0x681c('0x1d')]=function(_0x37bdf6,_0x4cae41){return db[_0x681c('0x32')][_0x681c('0x3e')]({'where':{'id':_0x37bdf6['params']['id']}})[_0x681c('0x1c')](handleEntityNotFound(_0x4cae41,null))[_0x681c('0x1c')](removeEntity(_0x4cae41,null))['catch'](handleError(_0x4cae41,null));};exports[_0x681c('0x40')]=function(_0x5e58bf,_0x38daf8){return db[_0x681c('0x32')][_0x681c('0x40')]()['then'](respondWithResult(_0x38daf8,null))[_0x681c('0x37')](handleError(_0x38daf8,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 2523be5..c0cc13c 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 _0xcfcd=['path','../../config/environment','./mailQueueReport.attributes','define','MailQueueReport','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcfcd,0xf6));var _0xdcfc=function(_0x156464,_0x5122ed){_0x156464=_0x156464-0x0;var _0x4f6687=_0xcfcd[_0x156464];return _0x4f6687;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xdcfc('0x0'))(_0xdcfc('0x1'));var moment=require(_0xdcfc('0x2'));var BPromise=require(_0xdcfc('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdcfc('0x4'));var rimraf=require('rimraf');var config=require(_0xdcfc('0x5'));var attributes=require(_0xdcfc('0x6'));module['exports']=function(_0x5888d1,_0x33b5c7){return _0x5888d1[_0xdcfc('0x7')](_0xdcfc('0x8'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xdcfc('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6a9f=['lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','./mailQueueReport.attributes','exports','define','MailQueueReport','uniqueid'];(function(_0x15277f,_0x55d0ca){var _0x2290a1=function(_0x59d2cb){while(--_0x59d2cb){_0x15277f['push'](_0x15277f['shift']());}};_0x2290a1(++_0x55d0ca);}(_0x6a9f,0x1e0));var _0xf6a9=function(_0x470d0a,_0x15b6d9){_0x470d0a=_0x470d0a-0x0;var _0xd37d52=_0x6a9f[_0x470d0a];return _0xd37d52;};'use strict';var _=require(_0xf6a9('0x0'));var util=require(_0xf6a9('0x1'));var logger=require(_0xf6a9('0x2'))(_0xf6a9('0x3'));var moment=require('moment');var BPromise=require(_0xf6a9('0x4'));var rp=require(_0xf6a9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf6a9('0x6'));var config=require('../../config/environment');var attributes=require(_0xf6a9('0x7'));module[_0xf6a9('0x8')]=function(_0x1e3c7c,_0x56d0f6){return _0x1e3c7c[_0xf6a9('0x9')](_0xf6a9('0xa'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xf6a9('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 8e6a803..04de19f 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['UpdateMailQueueReport','MailQueueReport','update','raw','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateMailQueueReport','create','body','options'];(function(_0x972692,_0x2a1c56){var _0x542e84=function(_0xe63f21){while(--_0xe63f21){_0x972692['push'](_0x972692['shift']());}};_0x542e84(++_0x2a1c56);}(_0xdb28,0x106));var _0x8db2=function(_0x3bee55,_0x376417){_0x3bee55=_0x3bee55-0x0;var _0x3ef2e9=_0xdb28[_0x3bee55];return _0x3ef2e9;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});}exports[_0x8db2('0x16')]=function(_0x3fddc2){var _0x2efd06=this;return new Promise(function(_0x46ce14,_0x51d60d){return db['MailQueueReport'][_0x8db2('0x17')](_0x3fddc2[_0x8db2('0x18')],{'raw':_0x3fddc2[_0x8db2('0x19')]?_0x3fddc2[_0x8db2('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x8db2('0xc')](function(_0x36a9ff){logger[_0x8db2('0x14')](_0x8db2('0x16'),_0x3fddc2);logger[_0x8db2('0xf')]('CreateMailQueueReport',_0x3fddc2,JSON[_0x8db2('0x10')](_0x36a9ff));_0x46ce14(_0x36a9ff);})[_0x8db2('0x15')](function(_0x18f69c){logger[_0x8db2('0x11')](_0x8db2('0x16'),_0x18f69c[_0x8db2('0x13')],_0x3fddc2);_0x51d60d(_0x2efd06[_0x8db2('0x11')](0x1f4,_0x18f69c['message']));});});};exports[_0x8db2('0x1a')]=function(_0x4f6516){var _0x5725f0=this;return new Promise(function(_0x52a9ca,_0x4d923c){return db[_0x8db2('0x1b')][_0x8db2('0x1c')](_0x4f6516[_0x8db2('0x18')],{'raw':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f6516['options']?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1e')]||null:null,'attributes':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')]['attributes']||null:null,'limit':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1f')]||null:null})[_0x8db2('0xc')](function(_0xbe5ece){logger[_0x8db2('0x14')](_0x8db2('0x1a'),_0x4f6516);logger[_0x8db2('0xf')](_0x8db2('0x1a'),_0x4f6516,JSON['stringify'](_0xbe5ece));_0x52a9ca(_0xbe5ece);})[_0x8db2('0x15')](function(_0x50b28d){logger['error'](_0x8db2('0x1a'),_0x50b28d[_0x8db2('0x13')],_0x4f6516);_0x4d923c(_0x5725f0[_0x8db2('0x11')](0x1f4,_0x50b28d['message']));});});}; \ No newline at end of file +var _0x7a54=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','MailQueueReport','create','body','options','raw','CreateMailQueueReport','UpdateMailQueueReport','update','where','attributes','limit','then','lodash','util'];(function(_0x36537f,_0x34c2b0){var _0x15ee54=function(_0x51a9bb){while(--_0x51a9bb){_0x36537f['push'](_0x36537f['shift']());}};_0x15ee54(++_0x34c2b0);}(_0x7a54,0x106));var _0x47a5=function(_0x4ef993,_0xaf7432){_0x4ef993=_0x4ef993-0x0;var _0xe11364=_0x7a54[_0x4ef993];return _0xe11364;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateMailQueueReport']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateMailQueueReport',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});};exports[_0x47a5('0x1b')]=function(_0x513981){var _0x28747d=this;return new Promise(function(_0xc4cd63,_0x4437f1){return db[_0x47a5('0x15')][_0x47a5('0x1c')](_0x513981['body'],{'raw':_0x513981['options']?_0x513981[_0x47a5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x513981[_0x47a5('0x18')]?_0x513981['options'][_0x47a5('0x1d')]||null:null,'attributes':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1e')]||null:null,'limit':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1f')]||null:null})[_0x47a5('0x20')](function(_0x16631f){logger[_0x47a5('0xb')](_0x47a5('0x1b'),_0x513981);logger[_0x47a5('0xd')](_0x47a5('0x1b'),_0x513981,JSON['stringify'](_0x16631f));_0xc4cd63(_0x16631f);})[_0x47a5('0x14')](function(_0x51833b){logger[_0x47a5('0xf')](_0x47a5('0x1b'),_0x51833b[_0x47a5('0x11')],_0x513981);_0x4437f1(_0x28747d['error'](0x1f4,_0x51833b[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index ddcbbbf..747f290 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x5cbc7c,_0x633425){var _0x3140dd=function(_0x2cfbbf){while(--_0x2cfbbf){_0x5cbc7c['push'](_0x5cbc7c['shift']());}};_0x3140dd(++_0x633425);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5099b4,_0x490eb9){var _0x4e3927=function(_0x14ed51){while(--_0x14ed51){_0x5099b4['push'](_0x5099b4['shift']());}};_0x4e3927(++_0x490eb9);}(_0xe706,0xa3));var _0x6e70=function(_0x313df3,_0x4fca45){_0x313df3=_0x313df3-0x0;var _0x241d59=_0xe706[_0x313df3];return _0x241d59;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 277e97e..81ecddb 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 _0xa25c=['STRING','BOOLEAN','INTEGER','INBOX','exports'];(function(_0x4c1bbe,_0xbb1868){var _0x1f847c=function(_0x2bd750){while(--_0x2bd750){_0x4c1bbe['push'](_0x4c1bbe['shift']());}};_0x1f847c(++_0xbb1868);}(_0xa25c,0x13f));var _0xca25=function(_0x38cb7c,_0xf33f42){_0x38cb7c=_0x38cb7c-0x0;var _0x2a5f5e=_0xa25c[_0x38cb7c];return _0x2a5f5e;};'use strict';var Sequelize=require('sequelize');module[_0xca25('0x0')]={'description':{'type':Sequelize[_0xca25('0x1')]},'host':{'type':Sequelize[_0xca25('0x1')]},'authentication':{'type':Sequelize[_0xca25('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0xca25('0x1')]},'password':{'type':Sequelize[_0xca25('0x1')]},'port':{'type':Sequelize[_0xca25('0x3')]},'tls':{'type':Sequelize[_0xca25('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0xca25('0x4')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0xca25('0x1')]}}; \ No newline at end of file +var _0xbfcc=['INTEGER','sequelize','STRING','BOOLEAN'];(function(_0x5275ac,_0x9083a4){var _0x43502e=function(_0x23483f){while(--_0x23483f){_0x5275ac['push'](_0x5275ac['shift']());}};_0x43502e(++_0x9083a4);}(_0xbfcc,0x1dd));var _0xcbfc=function(_0x1bb58c,_0x2c8a4d){_0x1bb58c=_0x1bb58c-0x0;var _0x277586=_0xbfcc[_0x1bb58c];return _0x277586;};'use strict';var Sequelize=require(_0xcbfc('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xcbfc('0x1')]},'authentication':{'type':Sequelize[_0xcbfc('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0xcbfc('0x1')]},'password':{'type':Sequelize[_0xcbfc('0x1')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0xcbfc('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xcbfc('0x3')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 77cc90b..fc9730a 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 _0x6071=['../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','util','api','moment','bluebird','path'];(function(_0x1e4f2f,_0x35edfa){var _0xccea89=function(_0x164386){while(--_0x164386){_0x1e4f2f['push'](_0x1e4f2f['shift']());}};_0xccea89(++_0x35edfa);}(_0x6071,0xba));var _0x1607=function(_0x181a04,_0x4a0c2e){_0x181a04=_0x181a04-0x0;var _0x163a16=_0x6071[_0x181a04];return _0x163a16;};'use strict';var _=require(_0x1607('0x0'));var util=require(_0x1607('0x1'));var logger=require('../../config/logger')(_0x1607('0x2'));var moment=require(_0x1607('0x3'));var BPromise=require(_0x1607('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1607('0x5'));var rimraf=require('rimraf');var config=require(_0x1607('0x6'));var attributes=require(_0x1607('0x7'));module[_0x1607('0x8')]=function(_0x21567f,_0x2c3423){return _0x21567f[_0x1607('0x9')](_0x1607('0xa'),attributes,{'tableName':_0x1607('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb6ff=['./mailServerIn.attributes','exports','MailServerIn','mail_servers_in','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x239dba,_0x309e95){var _0x1ceb11=function(_0x14efe6){while(--_0x14efe6){_0x239dba['push'](_0x239dba['shift']());}};_0x1ceb11(++_0x309e95);}(_0xb6ff,0x1c4));var _0xfb6f=function(_0x5e6bec,_0x1eb54d){_0x5e6bec=_0x5e6bec-0x0;var _0x5dc5cf=_0xb6ff[_0x5e6bec];return _0x5dc5cf;};'use strict';var _=require(_0xfb6f('0x0'));var util=require(_0xfb6f('0x1'));var logger=require(_0xfb6f('0x2'))(_0xfb6f('0x3'));var moment=require(_0xfb6f('0x4'));var BPromise=require(_0xfb6f('0x5'));var rp=require(_0xfb6f('0x6'));var fs=require('fs');var path=require(_0xfb6f('0x7'));var rimraf=require(_0xfb6f('0x8'));var config=require(_0xfb6f('0x9'));var attributes=require(_0xfb6f('0xa'));module[_0xfb6f('0xb')]=function(_0x1bb289,_0x3cc3e0){return _0x1bb289['define'](_0xfb6f('0xc'),attributes,{'tableName':_0xfb6f('0xd'),'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 bdd0534..0b3013f 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 _0x0e4f=['MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetMailServerIn','MailServerIn','options','raw','where','attributes','limit','map','model','include','then','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x0e4f,0x1f4));var _0xf0e4=function(_0x3b44c3,_0x578938){_0x3b44c3=_0x3b44c3-0x0;var _0x24274b=_0x0e4f[_0x3b44c3];return _0x24274b;};'use strict';var _=require(_0xf0e4('0x0'));var util=require(_0xf0e4('0x1'));var moment=require(_0xf0e4('0x2'));var BPromise=require(_0xf0e4('0x3'));var rs=require(_0xf0e4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf0e4('0x5'));var logger=require(_0xf0e4('0x6'))('rpc');var config=require(_0xf0e4('0x7'));var jayson=require(_0xf0e4('0x8'));var client=jayson[_0xf0e4('0x9')][_0xf0e4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x242b29,_0x59f3f0,_0x50eaca){return new BPromise(function(_0x2495cd,_0x303d69){return client['request'](_0x242b29,_0x50eaca)['then'](function(_0x42c28c){logger[_0xf0e4('0xb')](_0xf0e4('0xc'),_0x59f3f0,_0xf0e4('0xd'));logger[_0xf0e4('0xe')](_0xf0e4('0xf'),_0x59f3f0,_0xf0e4('0xd'),JSON[_0xf0e4('0x10')](_0x42c28c));if(_0x42c28c[_0xf0e4('0x11')]){if(_0x42c28c[_0xf0e4('0x11')]['code']===0x1f4){logger[_0xf0e4('0x11')](_0xf0e4('0xc'),_0x59f3f0,_0x42c28c['error'][_0xf0e4('0x12')]);return _0x303d69(_0x42c28c['error'][_0xf0e4('0x12')]);}logger[_0xf0e4('0x11')](_0xf0e4('0xc'),_0x59f3f0,_0x42c28c[_0xf0e4('0x11')][_0xf0e4('0x12')]);return _0x2495cd(_0x42c28c['error'][_0xf0e4('0x12')]);}else{logger[_0xf0e4('0xb')]('MailServerIn,\x20%s,\x20%s',_0x59f3f0,_0xf0e4('0xd'));_0x2495cd(_0x42c28c[_0xf0e4('0x13')][_0xf0e4('0x12')]);}})[_0xf0e4('0x14')](function(_0x36bf6d){logger['error'](_0xf0e4('0xc'),_0x59f3f0,_0x36bf6d);_0x303d69(_0x36bf6d);});});}exports[_0xf0e4('0x15')]=function(_0x4568d2){var _0x3e3924=this;return new Promise(function(_0x226fa7,_0x11f02c){return db[_0xf0e4('0x16')]['findAll']({'raw':_0x4568d2['options']?_0x4568d2[_0xf0e4('0x17')][_0xf0e4('0x18')]===undefined?!![]:![]:!![],'where':_0x4568d2[_0xf0e4('0x17')]?_0x4568d2['options'][_0xf0e4('0x19')]||null:null,'attributes':_0x4568d2[_0xf0e4('0x17')]?_0x4568d2[_0xf0e4('0x17')][_0xf0e4('0x1a')]||null:null,'limit':_0x4568d2[_0xf0e4('0x17')]?_0x4568d2[_0xf0e4('0x17')][_0xf0e4('0x1b')]||null:null,'include':_0x4568d2[_0xf0e4('0x17')]?_0x4568d2[_0xf0e4('0x17')]['include']?_[_0xf0e4('0x1c')](_0x4568d2['options']['include'],function(_0x3c87d9){return{'model':db[_0x3c87d9[_0xf0e4('0x1d')]],'as':_0x3c87d9['as'],'attributes':_0x3c87d9[_0xf0e4('0x1a')],'include':_0x3c87d9['include']?_[_0xf0e4('0x1c')](_0x3c87d9[_0xf0e4('0x1e')],function(_0x323af6){return{'model':db[_0x323af6[_0xf0e4('0x1d')]],'as':_0x323af6['as'],'attributes':_0x323af6[_0xf0e4('0x1a')],'include':_0x323af6[_0xf0e4('0x1e')]?_[_0xf0e4('0x1c')](_0x323af6[_0xf0e4('0x1e')],function(_0x31b72d){return{'model':db[_0x31b72d[_0xf0e4('0x1d')]],'as':_0x31b72d['as'],'attributes':_0x31b72d['attributes']};}):[]};}):[]};}):[]:[]})[_0xf0e4('0x1f')](function(_0x314e5c){logger[_0xf0e4('0xb')](_0xf0e4('0x15'),_0x4568d2);logger[_0xf0e4('0xe')]('GetMailServerIn',_0x4568d2,JSON[_0xf0e4('0x10')](_0x314e5c));_0x226fa7(_0x314e5c);})['catch'](function(_0x4c9f84){logger['error'](_0xf0e4('0x15'),_0x4c9f84[_0xf0e4('0x12')],_0x4568d2);_0x11f02c(_0x3e3924[_0xf0e4('0x11')](0x1f4,_0x4c9f84[_0xf0e4('0x12')]));});});}; \ No newline at end of file +var _0x7d72=['GetMailServerIn','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','MailServerIn','findAll','options','raw','limit','include','map','attributes','model'];(function(_0x442606,_0x3f8cf9){var _0x333bbd=function(_0x36e641){while(--_0x36e641){_0x442606['push'](_0x442606['shift']());}};_0x333bbd(++_0x3f8cf9);}(_0x7d72,0x1e1));var _0x27d7=function(_0x216ed9,_0x54fb7b){_0x216ed9=_0x216ed9-0x0;var _0x380b79=_0x7d72[_0x216ed9];return _0x380b79;};'use strict';var _=require('lodash');var util=require(_0x27d7('0x0'));var moment=require(_0x27d7('0x1'));var BPromise=require(_0x27d7('0x2'));var rs=require(_0x27d7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x27d7('0x4'));var logger=require('../../config/logger')(_0x27d7('0x5'));var config=require(_0x27d7('0x6'));var jayson=require(_0x27d7('0x7'));var client=jayson['client'][_0x27d7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4dcb59,_0x13146c,_0x633f40){return new BPromise(function(_0x148be8,_0x4e33b8){return client[_0x27d7('0x9')](_0x4dcb59,_0x633f40)[_0x27d7('0xa')](function(_0x41485c){logger[_0x27d7('0xb')](_0x27d7('0xc'),_0x13146c,'request\x20sent');logger[_0x27d7('0xd')](_0x27d7('0xe'),_0x13146c,_0x27d7('0xf'),JSON[_0x27d7('0x10')](_0x41485c));if(_0x41485c[_0x27d7('0x11')]){if(_0x41485c[_0x27d7('0x11')][_0x27d7('0x12')]===0x1f4){logger[_0x27d7('0x11')](_0x27d7('0xc'),_0x13146c,_0x41485c[_0x27d7('0x11')][_0x27d7('0x13')]);return _0x4e33b8(_0x41485c[_0x27d7('0x11')][_0x27d7('0x13')]);}logger[_0x27d7('0x11')](_0x27d7('0xc'),_0x13146c,_0x41485c[_0x27d7('0x11')][_0x27d7('0x13')]);return _0x148be8(_0x41485c[_0x27d7('0x11')]['message']);}else{logger[_0x27d7('0xb')](_0x27d7('0xc'),_0x13146c,_0x27d7('0xf'));_0x148be8(_0x41485c[_0x27d7('0x14')][_0x27d7('0x13')]);}})[_0x27d7('0x15')](function(_0x5dc9e9){logger['error'](_0x27d7('0xc'),_0x13146c,_0x5dc9e9);_0x4e33b8(_0x5dc9e9);});});}exports['GetMailServerIn']=function(_0x2cbc18){var _0xb7120=this;return new Promise(function(_0x102055,_0x1b4606){return db[_0x27d7('0x16')][_0x27d7('0x17')]({'raw':_0x2cbc18[_0x27d7('0x18')]?_0x2cbc18[_0x27d7('0x18')][_0x27d7('0x19')]===undefined?!![]:![]:!![],'where':_0x2cbc18[_0x27d7('0x18')]?_0x2cbc18[_0x27d7('0x18')]['where']||null:null,'attributes':_0x2cbc18[_0x27d7('0x18')]?_0x2cbc18['options']['attributes']||null:null,'limit':_0x2cbc18['options']?_0x2cbc18[_0x27d7('0x18')][_0x27d7('0x1a')]||null:null,'include':_0x2cbc18[_0x27d7('0x18')]?_0x2cbc18['options'][_0x27d7('0x1b')]?_[_0x27d7('0x1c')](_0x2cbc18['options'][_0x27d7('0x1b')],function(_0x42e1a6){return{'model':db[_0x42e1a6['model']],'as':_0x42e1a6['as'],'attributes':_0x42e1a6[_0x27d7('0x1d')],'include':_0x42e1a6[_0x27d7('0x1b')]?_[_0x27d7('0x1c')](_0x42e1a6[_0x27d7('0x1b')],function(_0x52c755){return{'model':db[_0x52c755['model']],'as':_0x52c755['as'],'attributes':_0x52c755[_0x27d7('0x1d')],'include':_0x52c755[_0x27d7('0x1b')]?_[_0x27d7('0x1c')](_0x52c755[_0x27d7('0x1b')],function(_0x209bc6){return{'model':db[_0x209bc6[_0x27d7('0x1e')]],'as':_0x209bc6['as'],'attributes':_0x209bc6['attributes']};}):[]};}):[]};}):[]:[]})[_0x27d7('0xa')](function(_0x43353a){logger[_0x27d7('0xb')](_0x27d7('0x1f'),_0x2cbc18);logger[_0x27d7('0xd')](_0x27d7('0x1f'),_0x2cbc18,JSON[_0x27d7('0x10')](_0x43353a));_0x102055(_0x43353a);})[_0x27d7('0x15')](function(_0xb6b889){logger[_0x27d7('0x11')]('GetMailServerIn',_0xb6b889[_0x27d7('0x13')],_0x2cbc18);_0x1b4606(_0xb7120[_0x27d7('0x11')](0x1f4,_0xb6b889[_0x27d7('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 4ccd0ca..a8781a3 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_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 fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0x41b741,_0xd0c808){_0x41b741=_0x41b741-0x0;var _0x4631a4=_0x7a54[_0x41b741];return _0x4631a4;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index f6cc8f3..694e2d3 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 _0x9da2=['STRING','INTEGER','exports'];(function(_0x17e4ca,_0x346e13){var _0x466336=function(_0x26239f){while(--_0x26239f){_0x17e4ca['push'](_0x17e4ca['shift']());}};_0x466336(++_0x346e13);}(_0x9da2,0x1af));var _0x29da=function(_0x14d8b2,_0x2f71b6){_0x14d8b2=_0x14d8b2-0x0;var _0x26d944=_0x9da2[_0x14d8b2];return _0x26d944;};'use strict';var Sequelize=require('sequelize');module[_0x29da('0x0')]={'description':{'type':Sequelize[_0x29da('0x1')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x29da('0x1')]},'pass':{'type':Sequelize[_0x29da('0x1')]},'port':{'type':Sequelize[_0x29da('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x29da('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x3939=['INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x591cfd,_0x501204){var _0x4d0100=function(_0xb9ff0c){while(--_0xb9ff0c){_0x591cfd['push'](_0x591cfd['shift']());}};_0x4d0100(++_0x501204);}(_0x3939,0xe8));var _0x9393=function(_0x51cb62,_0x3f57c6){_0x51cb62=_0x51cb62-0x0;var _0x4ab154=_0x3939[_0x51cb62];return _0x4ab154;};'use strict';var Sequelize=require(_0x9393('0x0'));module[_0x9393('0x1')]={'description':{'type':Sequelize[_0x9393('0x2')]},'host':{'type':Sequelize[_0x9393('0x2')]},'user':{'type':Sequelize[_0x9393('0x2')]},'pass':{'type':Sequelize[_0x9393('0x2')]},'port':{'type':Sequelize[_0x9393('0x3')]},'secure':{'type':Sequelize[_0x9393('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x9393('0x2')]},'authentication':{'type':Sequelize[_0x9393('0x4')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 8177e52..f19ffda 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 _0xc231=['destroy','stack','name','index','MailServerOut','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','findAll','rows','catch','show','rawAttributes','find','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','offset','count','set','Content-Range','apply','reject','save','update','then'];(function(_0x3e5e50,_0x361419){var _0x142135=function(_0x39fb62){while(--_0x39fb62){_0x3e5e50['push'](_0x3e5e50['shift']());}};_0x142135(++_0x361419);}(_0xc231,0x72));var _0x1c23=function(_0x52cba8,_0x4d14b3){_0x52cba8=_0x52cba8-0x0;var _0x46a669=_0xc231[_0x52cba8];return _0x46a669;};'use strict';var emlformat=require(_0x1c23('0x0'));var rimraf=require(_0x1c23('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1c23('0x2'));var rp=require(_0x1c23('0x3'));var moment=require(_0x1c23('0x4'));var BPromise=require(_0x1c23('0x5'));var Mustache=require(_0x1c23('0x6'));var util=require(_0x1c23('0x7'));var path=require(_0x1c23('0x8'));var sox=require(_0x1c23('0x9'));var csv=require('to-csv');var ejs=require(_0x1c23('0xa'));var fs=require('fs');var fs_extra=require(_0x1c23('0xb'));var _=require(_0x1c23('0xc'));var squel=require('squel');var crypto=require(_0x1c23('0xd'));var jsforce=require(_0x1c23('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1c23('0xf'));var querystring=require(_0x1c23('0x10'));var Papa=require('papaparse');var Redis=require(_0x1c23('0x11'));var authService=require(_0x1c23('0x12'));var qs=require(_0x1c23('0x13'));var as=require(_0x1c23('0x14'));var hardwareService=require(_0x1c23('0x15'));var logger=require(_0x1c23('0x16'))('api');var utils=require(_0x1c23('0x17'));var config=require(_0x1c23('0x18'));var licenseUtil=require(_0x1c23('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x100410,_0x3059d8){_0x3059d8=_0x3059d8||0xcc;return function(_0x31e458){if(_0x31e458){return _0x100410[_0x1c23('0x1a')](_0x3059d8);}return _0x100410[_0x1c23('0x1b')](_0x3059d8)[_0x1c23('0x1c')]();};}function respondWithResult(_0x4433ab,_0x2e63cc){_0x2e63cc=_0x2e63cc||0xc8;return function(_0x3fe801){if(_0x3fe801){return _0x4433ab[_0x1c23('0x1b')](_0x2e63cc)[_0x1c23('0x1d')](_0x3fe801);}};}function respondWithFilteredResult(_0x39fdb2,_0x2f2375){return function(_0x2a0077){if(_0x2a0077){var _0x4cdaa4=typeof _0x2f2375['offset']===_0x1c23('0x1e')&&typeof _0x2f2375['limit']===_0x1c23('0x1e');var _0x29abd2=_0x2a0077['count'];var _0x434459=_0x4cdaa4?0x0:_0x2f2375[_0x1c23('0x1f')];var _0x5adae8=_0x4cdaa4?_0x2a0077[_0x1c23('0x20')]:_0x2f2375[_0x1c23('0x1f')]+_0x2f2375['limit'];var _0x8373f6;if(_0x5adae8>=_0x29abd2){_0x5adae8=_0x29abd2;_0x8373f6=0xc8;}else{_0x8373f6=0xce;}_0x39fdb2[_0x1c23('0x1b')](_0x8373f6);return _0x39fdb2[_0x1c23('0x21')](_0x1c23('0x22'),_0x434459+'-'+_0x5adae8+'/'+_0x29abd2)['json'](_0x2a0077);}return null;};}function patchUpdates(_0x8e9841){return function(_0x4e9427){try{jsonpatch[_0x1c23('0x23')](_0x4e9427,_0x8e9841,!![]);}catch(_0x34f630){return BPromise[_0x1c23('0x24')](_0x34f630);}return _0x4e9427[_0x1c23('0x25')]();};}function saveUpdates(_0x21ee3f,_0xa3796){return function(_0xbb35cf){if(_0xbb35cf){return _0xbb35cf[_0x1c23('0x26')](_0x21ee3f)[_0x1c23('0x27')](function(_0xd0efc9){return _0xd0efc9;});}return null;};}function removeEntity(_0x4d7947,_0x26981a){return function(_0x1e886a){if(_0x1e886a){return _0x1e886a[_0x1c23('0x28')]()['then'](function(){_0x4d7947[_0x1c23('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14b330,_0x521667){return function(_0xa3fd38){if(!_0xa3fd38){_0x14b330[_0x1c23('0x1a')](0x194);}return _0xa3fd38;};}function handleError(_0x21a27d,_0xd2531b){_0xd2531b=_0xd2531b||0x1f4;return function(_0x3399aa){logger['error'](_0x3399aa[_0x1c23('0x29')]);if(_0x3399aa[_0x1c23('0x2a')]){delete _0x3399aa[_0x1c23('0x2a')];}_0x21a27d[_0x1c23('0x1b')](_0xd2531b)['send'](_0x3399aa);};}exports[_0x1c23('0x2b')]=function(_0x3e77a6,_0x1ea499){var _0x4e305b={},_0x8f8adb={},_0x1cea49={'count':0x0,'rows':[]};var _0x7cb501=_['map'](db[_0x1c23('0x2c')]['rawAttributes'],function(_0x2965c5){return{'name':_0x2965c5[_0x1c23('0x2d')],'type':_0x2965c5[_0x1c23('0x2e')][_0x1c23('0x2f')]};});_0x8f8adb[_0x1c23('0x30')]=_['map'](_0x7cb501,'name');_0x8f8adb['query']=_[_0x1c23('0x31')](_0x3e77a6['query']);_0x8f8adb[_0x1c23('0x32')]=_[_0x1c23('0x33')](_0x8f8adb['model'],_0x8f8adb[_0x1c23('0x34')]);_0x4e305b[_0x1c23('0x35')]=_[_0x1c23('0x33')](_0x8f8adb[_0x1c23('0x30')],qs[_0x1c23('0x36')](_0x3e77a6[_0x1c23('0x34')][_0x1c23('0x36')]));_0x4e305b[_0x1c23('0x35')]=_0x4e305b[_0x1c23('0x35')][_0x1c23('0x37')]?_0x4e305b[_0x1c23('0x35')]:_0x8f8adb[_0x1c23('0x30')];if(!_0x3e77a6[_0x1c23('0x34')][_0x1c23('0x38')](_0x1c23('0x39'))){_0x4e305b[_0x1c23('0x3a')]=qs['limit'](_0x3e77a6[_0x1c23('0x34')][_0x1c23('0x3a')]);_0x4e305b[_0x1c23('0x1f')]=qs[_0x1c23('0x1f')](_0x3e77a6[_0x1c23('0x34')]['offset']);}_0x4e305b['order']=qs[_0x1c23('0x3b')](_0x3e77a6[_0x1c23('0x34')][_0x1c23('0x3b')]);_0x4e305b[_0x1c23('0x3c')]=qs['filters'](_[_0x1c23('0x3d')](_0x3e77a6[_0x1c23('0x34')],_0x8f8adb['filters']),_0x7cb501);if(_0x3e77a6[_0x1c23('0x34')][_0x1c23('0x3e')]){_0x4e305b[_0x1c23('0x3c')]=_[_0x1c23('0x3f')](_0x4e305b[_0x1c23('0x3c')],{'$or':_[_0x1c23('0x40')](_0x7cb501,function(_0x5a3e32){if(_0x5a3e32['type']!==_0x1c23('0x41')){var _0x103e99={};_0x103e99[_0x5a3e32[_0x1c23('0x2a')]]={'$like':'%'+_0x3e77a6[_0x1c23('0x34')][_0x1c23('0x3e')]+'%'};return _0x103e99;}})});}_0x4e305b=_[_0x1c23('0x3f')]({},_0x4e305b,_0x3e77a6[_0x1c23('0x42')]);var _0x5a564d={'where':_0x4e305b[_0x1c23('0x3c')]};return db['MailServerOut']['count'](_0x5a564d)[_0x1c23('0x27')](function(_0x487762){_0x1cea49['count']=_0x487762;if(_0x3e77a6[_0x1c23('0x34')][_0x1c23('0x43')]){_0x4e305b['include']=[{'all':!![]}];}return db[_0x1c23('0x2c')][_0x1c23('0x44')](_0x4e305b);})['then'](function(_0x3e8fdb){_0x1cea49[_0x1c23('0x45')]=_0x3e8fdb;return _0x1cea49;})['then'](respondWithFilteredResult(_0x1ea499,_0x4e305b))[_0x1c23('0x46')](handleError(_0x1ea499,null));};exports[_0x1c23('0x47')]=function(_0x3657b7,_0xc0319e){var _0x1df157={'raw':!![],'where':{'id':_0x3657b7['params']['id']}},_0x6c0b64={};_0x6c0b64[_0x1c23('0x30')]=_['keys'](db['MailServerOut'][_0x1c23('0x48')]);_0x6c0b64[_0x1c23('0x34')]=_['keys'](_0x3657b7[_0x1c23('0x34')]);_0x6c0b64[_0x1c23('0x32')]=_['intersection'](_0x6c0b64[_0x1c23('0x30')],_0x6c0b64[_0x1c23('0x34')]);_0x1df157[_0x1c23('0x35')]=_[_0x1c23('0x33')](_0x6c0b64[_0x1c23('0x30')],qs[_0x1c23('0x36')](_0x3657b7[_0x1c23('0x34')]['fields']));_0x1df157[_0x1c23('0x35')]=_0x1df157['attributes'][_0x1c23('0x37')]?_0x1df157[_0x1c23('0x35')]:_0x6c0b64['model'];if(_0x3657b7['query'][_0x1c23('0x43')]){_0x1df157['include']=[{'all':!![]}];}_0x1df157=_['merge']({},_0x1df157,_0x3657b7[_0x1c23('0x42')]);return db[_0x1c23('0x2c')][_0x1c23('0x49')](_0x1df157)['then'](handleEntityNotFound(_0xc0319e,null))['then'](respondWithResult(_0xc0319e,null))[_0x1c23('0x46')](handleError(_0xc0319e,null));};exports['create']=function(_0x275a6b,_0x13c0b7){return db[_0x1c23('0x2c')][_0x1c23('0x4a')](_0x275a6b['body'],{})[_0x1c23('0x27')](respondWithResult(_0x13c0b7,0xc9))[_0x1c23('0x46')](handleError(_0x13c0b7,null));};exports['update']=function(_0x13f571,_0x1a1b97){if(_0x13f571['body']['id']){delete _0x13f571[_0x1c23('0x4b')]['id'];}return db[_0x1c23('0x2c')]['find']({'where':{'id':_0x13f571[_0x1c23('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1a1b97,null))['then'](saveUpdates(_0x13f571['body'],null))[_0x1c23('0x27')](respondWithResult(_0x1a1b97,null))[_0x1c23('0x46')](handleError(_0x1a1b97,null));};exports[_0x1c23('0x28')]=function(_0x530b97,_0x543b8b){return db['MailServerOut']['find']({'where':{'id':_0x530b97[_0x1c23('0x4c')]['id']}})[_0x1c23('0x27')](handleEntityNotFound(_0x543b8b,null))[_0x1c23('0x27')](removeEntity(_0x543b8b,null))[_0x1c23('0x46')](handleError(_0x543b8b,null));}; \ No newline at end of file +var _0x1224=['create','body','update','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','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','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','reject','save','destroy','then','error','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','type','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','where','filters','pick','merge','filter','options','includeAll','include','findAll','rows','show','params','keys','find','catch'];(function(_0xb5f7fe,_0x24f5a1){var _0x428c24=function(_0x5c6172){while(--_0x5c6172){_0xb5f7fe['push'](_0xb5f7fe['shift']());}};_0x428c24(++_0x24f5a1);}(_0x1224,0x1c5));var _0x4122=function(_0xfe9e3d,_0x587758){_0xfe9e3d=_0xfe9e3d-0x0;var _0x33c751=_0x1224[_0xfe9e3d];return _0x33c751;};'use strict';var emlformat=require(_0x4122('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4122('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4122('0x2'));var moment=require(_0x4122('0x3'));var BPromise=require(_0x4122('0x4'));var Mustache=require(_0x4122('0x5'));var util=require(_0x4122('0x6'));var path=require('path');var sox=require(_0x4122('0x7'));var csv=require(_0x4122('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4122('0x9'));var squel=require(_0x4122('0xa'));var crypto=require(_0x4122('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4122('0xc'));var toCsv=require(_0x4122('0x8'));var querystring=require(_0x4122('0xd'));var Papa=require(_0x4122('0xe'));var Redis=require(_0x4122('0xf'));var authService=require(_0x4122('0x10'));var qs=require(_0x4122('0x11'));var as=require(_0x4122('0x12'));var hardwareService=require(_0x4122('0x13'));var logger=require(_0x4122('0x14'))(_0x4122('0x15'));var utils=require(_0x4122('0x16'));var config=require(_0x4122('0x17'));var licenseUtil=require(_0x4122('0x18'));var db=require(_0x4122('0x19'))['db'];function respondWithStatusCode(_0x2cfbd4,_0x259ccc){_0x259ccc=_0x259ccc||0xcc;return function(_0x387315){if(_0x387315){return _0x2cfbd4[_0x4122('0x1a')](_0x259ccc);}return _0x2cfbd4[_0x4122('0x1b')](_0x259ccc)['end']();};}function respondWithResult(_0x5b1cfd,_0x582063){_0x582063=_0x582063||0xc8;return function(_0x276aeb){if(_0x276aeb){return _0x5b1cfd['status'](_0x582063)['json'](_0x276aeb);}};}function respondWithFilteredResult(_0x5bf713,_0x19e78b){return function(_0x36be85){if(_0x36be85){var _0x5043e7=typeof _0x19e78b[_0x4122('0x1c')]==='undefined'&&typeof _0x19e78b[_0x4122('0x1d')]===_0x4122('0x1e');var _0x7501c8=_0x36be85[_0x4122('0x1f')];var _0x253a69=_0x5043e7?0x0:_0x19e78b['offset'];var _0x360449=_0x5043e7?_0x36be85[_0x4122('0x1f')]:_0x19e78b[_0x4122('0x1c')]+_0x19e78b[_0x4122('0x1d')];var _0x39f706;if(_0x360449>=_0x7501c8){_0x360449=_0x7501c8;_0x39f706=0xc8;}else{_0x39f706=0xce;}_0x5bf713['status'](_0x39f706);return _0x5bf713[_0x4122('0x20')](_0x4122('0x21'),_0x253a69+'-'+_0x360449+'/'+_0x7501c8)[_0x4122('0x22')](_0x36be85);}return null;};}function patchUpdates(_0x159d2c){return function(_0x496d03){try{jsonpatch['apply'](_0x496d03,_0x159d2c,!![]);}catch(_0x4755ed){return BPromise[_0x4122('0x23')](_0x4755ed);}return _0x496d03[_0x4122('0x24')]();};}function saveUpdates(_0x3ff2ec,_0x3167a1){return function(_0x37ff9c){if(_0x37ff9c){return _0x37ff9c['update'](_0x3ff2ec)['then'](function(_0x3adfc4){return _0x3adfc4;});}return null;};}function removeEntity(_0x1c1fc7,_0x3d91e6){return function(_0x319567){if(_0x319567){return _0x319567[_0x4122('0x25')]()[_0x4122('0x26')](function(){_0x1c1fc7[_0x4122('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x100654,_0xcb5710){return function(_0x40fe5a){if(!_0x40fe5a){_0x100654[_0x4122('0x1a')](0x194);}return _0x40fe5a;};}function handleError(_0x4ef70d,_0x3c79e5){_0x3c79e5=_0x3c79e5||0x1f4;return function(_0x19b379){logger[_0x4122('0x27')](_0x19b379[_0x4122('0x28')]);if(_0x19b379[_0x4122('0x29')]){delete _0x19b379[_0x4122('0x29')];}_0x4ef70d['status'](_0x3c79e5)[_0x4122('0x2a')](_0x19b379);};}exports[_0x4122('0x2b')]=function(_0x27f30a,_0x457ffe){var _0x151023={},_0x282fe2={},_0x40567c={'count':0x0,'rows':[]};var _0x4b25d7=_[_0x4122('0x2c')](db[_0x4122('0x2d')][_0x4122('0x2e')],function(_0x5bc6b1){return{'name':_0x5bc6b1[_0x4122('0x2f')],'type':_0x5bc6b1[_0x4122('0x30')]['key']};});_0x282fe2['model']=_[_0x4122('0x2c')](_0x4b25d7,'name');_0x282fe2[_0x4122('0x31')]=_['keys'](_0x27f30a[_0x4122('0x31')]);_0x282fe2['filters']=_[_0x4122('0x32')](_0x282fe2[_0x4122('0x33')],_0x282fe2[_0x4122('0x31')]);_0x151023[_0x4122('0x34')]=_[_0x4122('0x32')](_0x282fe2[_0x4122('0x33')],qs[_0x4122('0x35')](_0x27f30a[_0x4122('0x31')]['fields']));_0x151023['attributes']=_0x151023[_0x4122('0x34')][_0x4122('0x36')]?_0x151023[_0x4122('0x34')]:_0x282fe2[_0x4122('0x33')];if(!_0x27f30a[_0x4122('0x31')][_0x4122('0x37')](_0x4122('0x38'))){_0x151023[_0x4122('0x1d')]=qs['limit'](_0x27f30a[_0x4122('0x31')][_0x4122('0x1d')]);_0x151023[_0x4122('0x1c')]=qs[_0x4122('0x1c')](_0x27f30a[_0x4122('0x31')][_0x4122('0x1c')]);}_0x151023['order']=qs['sort'](_0x27f30a[_0x4122('0x31')]['sort']);_0x151023[_0x4122('0x39')]=qs[_0x4122('0x3a')](_[_0x4122('0x3b')](_0x27f30a[_0x4122('0x31')],_0x282fe2[_0x4122('0x3a')]),_0x4b25d7);if(_0x27f30a['query']['filter']){_0x151023[_0x4122('0x39')]=_[_0x4122('0x3c')](_0x151023[_0x4122('0x39')],{'$or':_[_0x4122('0x2c')](_0x4b25d7,function(_0x4259ef){if(_0x4259ef[_0x4122('0x30')]!=='VIRTUAL'){var _0x456816={};_0x456816[_0x4259ef[_0x4122('0x29')]]={'$like':'%'+_0x27f30a['query'][_0x4122('0x3d')]+'%'};return _0x456816;}})});}_0x151023=_['merge']({},_0x151023,_0x27f30a[_0x4122('0x3e')]);var _0x473a26={'where':_0x151023[_0x4122('0x39')]};return db[_0x4122('0x2d')][_0x4122('0x1f')](_0x473a26)[_0x4122('0x26')](function(_0x1bc857){_0x40567c[_0x4122('0x1f')]=_0x1bc857;if(_0x27f30a[_0x4122('0x31')][_0x4122('0x3f')]){_0x151023[_0x4122('0x40')]=[{'all':!![]}];}return db[_0x4122('0x2d')][_0x4122('0x41')](_0x151023);})[_0x4122('0x26')](function(_0x1193c6){_0x40567c[_0x4122('0x42')]=_0x1193c6;return _0x40567c;})[_0x4122('0x26')](respondWithFilteredResult(_0x457ffe,_0x151023))['catch'](handleError(_0x457ffe,null));};exports[_0x4122('0x43')]=function(_0x3e4e2c,_0x4ef32a){var _0xc4a95c={'raw':!![],'where':{'id':_0x3e4e2c[_0x4122('0x44')]['id']}},_0x40aa46={};_0x40aa46[_0x4122('0x33')]=_['keys'](db[_0x4122('0x2d')][_0x4122('0x2e')]);_0x40aa46[_0x4122('0x31')]=_[_0x4122('0x45')](_0x3e4e2c['query']);_0x40aa46['filters']=_[_0x4122('0x32')](_0x40aa46[_0x4122('0x33')],_0x40aa46[_0x4122('0x31')]);_0xc4a95c[_0x4122('0x34')]=_[_0x4122('0x32')](_0x40aa46[_0x4122('0x33')],qs[_0x4122('0x35')](_0x3e4e2c[_0x4122('0x31')][_0x4122('0x35')]));_0xc4a95c[_0x4122('0x34')]=_0xc4a95c[_0x4122('0x34')]['length']?_0xc4a95c[_0x4122('0x34')]:_0x40aa46[_0x4122('0x33')];if(_0x3e4e2c['query']['includeAll']){_0xc4a95c[_0x4122('0x40')]=[{'all':!![]}];}_0xc4a95c=_['merge']({},_0xc4a95c,_0x3e4e2c[_0x4122('0x3e')]);return db[_0x4122('0x2d')][_0x4122('0x46')](_0xc4a95c)['then'](handleEntityNotFound(_0x4ef32a,null))['then'](respondWithResult(_0x4ef32a,null))[_0x4122('0x47')](handleError(_0x4ef32a,null));};exports[_0x4122('0x48')]=function(_0x516629,_0x4089e3){return db['MailServerOut']['create'](_0x516629[_0x4122('0x49')],{})['then'](respondWithResult(_0x4089e3,0xc9))[_0x4122('0x47')](handleError(_0x4089e3,null));};exports[_0x4122('0x4a')]=function(_0x36af09,_0x1a6fdb){if(_0x36af09[_0x4122('0x49')]['id']){delete _0x36af09[_0x4122('0x49')]['id'];}return db[_0x4122('0x2d')][_0x4122('0x46')]({'where':{'id':_0x36af09[_0x4122('0x44')]['id']}})[_0x4122('0x26')](handleEntityNotFound(_0x1a6fdb,null))['then'](saveUpdates(_0x36af09['body'],null))[_0x4122('0x26')](respondWithResult(_0x1a6fdb,null))[_0x4122('0x47')](handleError(_0x1a6fdb,null));};exports[_0x4122('0x25')]=function(_0x32cfc2,_0x30658d){return db[_0x4122('0x2d')][_0x4122('0x46')]({'where':{'id':_0x32cfc2[_0x4122('0x44')]['id']}})[_0x4122('0x26')](handleEntityNotFound(_0x30658d,null))[_0x4122('0x26')](removeEntity(_0x30658d,null))['catch'](handleError(_0x30658d,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index a9e4e71..5eefcbd 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 _0xf3b3=['../../config/environment','exports','define','MailServerOut','mail_servers_out','lodash','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x480df5,_0x51e134){var _0x3a0a4e=function(_0x20312d){while(--_0x20312d){_0x480df5['push'](_0x480df5['shift']());}};_0x3a0a4e(++_0x51e134);}(_0xf3b3,0x102));var _0x3f3b=function(_0x2a55f8,_0x540ac4){_0x2a55f8=_0x2a55f8-0x0;var _0x245efd=_0xf3b3[_0x2a55f8];return _0x245efd;};'use strict';var _=require(_0x3f3b('0x0'));var util=require('util');var logger=require(_0x3f3b('0x1'))(_0x3f3b('0x2'));var moment=require('moment');var BPromise=require(_0x3f3b('0x3'));var rp=require(_0x3f3b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3f3b('0x5'));var config=require(_0x3f3b('0x6'));var attributes=require('./mailServerOut.attributes');module[_0x3f3b('0x7')]=function(_0x325e1c,_0x189922){return _0x325e1c[_0x3f3b('0x8')](_0x3f3b('0x9'),attributes,{'tableName':_0x3f3b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5725=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','MailServerOut','mail_servers_out'];(function(_0x157b0e,_0x3fe568){var _0x6d52ef=function(_0xa78a56){while(--_0xa78a56){_0x157b0e['push'](_0x157b0e['shift']());}};_0x6d52ef(++_0x3fe568);}(_0x5725,0xe4));var _0x5572=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x5725[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x5572('0x0'));var util=require(_0x5572('0x1'));var logger=require(_0x5572('0x2'))(_0x5572('0x3'));var moment=require(_0x5572('0x4'));var BPromise=require(_0x5572('0x5'));var rp=require(_0x5572('0x6'));var fs=require('fs');var path=require(_0x5572('0x7'));var rimraf=require('rimraf');var config=require(_0x5572('0x8'));var attributes=require('./mailServerOut.attributes');module[_0x5572('0x9')]=function(_0x57ac77,_0x4e3820){return _0x57ac77['define'](_0x5572('0xa'),attributes,{'tableName':_0x5572('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 f1b7506..8290a76 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 _0x1261=['then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','MailServerOut,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x7daf17,_0x549f0c){var _0xb81de7=function(_0xfbaa9b){while(--_0xfbaa9b){_0x7daf17['push'](_0x7daf17['shift']());}};_0xb81de7(++_0x549f0c);}(_0x1261,0x144));var _0x1126=function(_0x53efa4,_0x1e673b){_0x53efa4=_0x53efa4-0x0;var _0x276274=_0x1261[_0x53efa4];return _0x276274;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('MailServerOut,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file +var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailServerOut,\x20%s,\x20%s','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x2e15eb,_0x5d92a2){var _0x5dc550=function(_0x1c5d90){while(--_0x1c5d90){_0x2e15eb['push'](_0x2e15eb['shift']());}};_0x5dc550(++_0x5d92a2);}(_0x2ef3,0xba));var _0x32ef=function(_0x31bafd,_0x2d2172){_0x31bafd=_0x31bafd-0x0;var _0x2df5b9=_0x2ef3[_0x31bafd];return _0x2df5b9;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 535667b..e0e62da 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 _0xd027=['../../components/auth/service','../../config/environment','./mailSubstatus.controller','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','exports','connect-timeout','Router','fs-extra'];(function(_0x3211f6,_0x47eb23){var _0x273e60=function(_0x56c994){while(--_0x56c994){_0x3211f6['push'](_0x3211f6['shift']());}};_0x273e60(++_0x47eb23);}(_0xd027,0xf9));var _0x7d02=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd027[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x7d02('0x0'));var express=require('express');var router=express[_0x7d02('0x1')]();var fs_extra=require(_0x7d02('0x2'));var auth=require(_0x7d02('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7d02('0x4'));var controller=require(_0x7d02('0x5'));router[_0x7d02('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x7d02('0x7'),auth[_0x7d02('0x8')](),controller[_0x7d02('0x9')]);router[_0x7d02('0x6')](_0x7d02('0xa'),auth[_0x7d02('0x8')](),controller[_0x7d02('0xb')]);router[_0x7d02('0xc')]('/',auth[_0x7d02('0x8')](),controller[_0x7d02('0xd')]);router[_0x7d02('0xe')](_0x7d02('0xa'),auth[_0x7d02('0x8')](),controller[_0x7d02('0xf')]);router[_0x7d02('0x10')](_0x7d02('0xa'),auth[_0x7d02('0x8')](),controller['destroy']);module[_0x7d02('0x11')]=router; \ No newline at end of file +var _0xa149=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','/describe','describe','isAuthenticated','create','put','/:id','delete','destroy','util'];(function(_0x49738a,_0x38fc9a){var _0xd155a3=function(_0x59ba6d){while(--_0x59ba6d){_0x49738a['push'](_0x49738a['shift']());}};_0xd155a3(++_0x38fc9a);}(_0xa149,0x164));var _0x9a14=function(_0x44b50b,_0x57166d){_0x44b50b=_0x44b50b-0x0;var _0x407912=_0xa149[_0x44b50b];return _0x407912;};'use strict';var multer=require('multer');var util=require(_0x9a14('0x0'));var path=require(_0x9a14('0x1'));var timeout=require('connect-timeout');var express=require(_0x9a14('0x2'));var router=express[_0x9a14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9a14('0x4'));var interaction=require(_0x9a14('0x5'));var config=require(_0x9a14('0x6'));var controller=require(_0x9a14('0x7'));router[_0x9a14('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9a14('0x8')](_0x9a14('0x9'),auth['isAuthenticated'](),controller[_0x9a14('0xa')]);router['get']('/:id',auth[_0x9a14('0xb')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x9a14('0xc')]);router[_0x9a14('0xd')](_0x9a14('0xe'),auth[_0x9a14('0xb')](),controller['update']);router[_0x9a14('0xf')](_0x9a14('0xe'),auth[_0x9a14('0xb')](),controller[_0x9a14('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 7383dda..5b57e1c 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 _0x1670=['name','sequelize','exports'];(function(_0x1bf8f5,_0x28f62c){var _0x36a54e=function(_0x43ba61){while(--_0x43ba61){_0x1bf8f5['push'](_0x1bf8f5['shift']());}};_0x36a54e(++_0x28f62c);}(_0x1670,0x9a));var _0x0167=function(_0x5a120c,_0x2265bc){_0x5a120c=_0x5a120c-0x0;var _0x59e6f0=_0x1670[_0x5a120c];return _0x59e6f0;};'use strict';var Sequelize=require(_0x0167('0x0'));module[_0x0167('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x0167('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe714=['name','sequelize','STRING'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xe714,0xe2));var _0x4e71=function(_0x3feec3,_0x25d4cb){_0x3feec3=_0x3feec3-0x0;var _0x5d0741=_0xe714[_0x3feec3];return _0x5d0741;};'use strict';var Sequelize=require(_0x4e71('0x0'));module['exports']={'name':{'type':Sequelize[_0x4e71('0x1')],'unique':_0x4e71('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4e71('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 41a7e6c..0748adf 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 _0xdc12=['attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','show','keys','rawAttributes','catch','create','body','update','find','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','then','destroy','name','send','index','map','MailSubstatus','fieldName','type','key','model','query','filters','intersection','fields'];(function(_0x1e175d,_0x41ff45){var _0x3a3ce5=function(_0x186001){while(--_0x186001){_0x1e175d['push'](_0x1e175d['shift']());}};_0x3a3ce5(++_0x41ff45);}(_0xdc12,0x1ae));var _0x2dc1=function(_0x5c1e91,_0x44e911){_0x5c1e91=_0x5c1e91-0x0;var _0x37ae9e=_0xdc12[_0x5c1e91];return _0x37ae9e;};'use strict';var emlformat=require(_0x2dc1('0x0'));var rimraf=require(_0x2dc1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2dc1('0x2'));var rp=require(_0x2dc1('0x3'));var moment=require(_0x2dc1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2dc1('0x5'));var util=require('util');var path=require(_0x2dc1('0x6'));var sox=require('sox');var csv=require(_0x2dc1('0x7'));var ejs=require(_0x2dc1('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2dc1('0x9'));var crypto=require('crypto');var jsforce=require(_0x2dc1('0xa'));var deskjs=require(_0x2dc1('0xb'));var toCsv=require(_0x2dc1('0x7'));var querystring=require(_0x2dc1('0xc'));var Papa=require(_0x2dc1('0xd'));var Redis=require('ioredis');var authService=require(_0x2dc1('0xe'));var qs=require(_0x2dc1('0xf'));var as=require(_0x2dc1('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x2dc1('0x11'));var config=require(_0x2dc1('0x12'));var licenseUtil=require(_0x2dc1('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c5709,_0x3b73c9){_0x3b73c9=_0x3b73c9||0xcc;return function(_0xdf9129){if(_0xdf9129){return _0x3c5709[_0x2dc1('0x14')](_0x3b73c9);}return _0x3c5709['status'](_0x3b73c9)[_0x2dc1('0x15')]();};}function respondWithResult(_0xa8cea8,_0xdb3229){_0xdb3229=_0xdb3229||0xc8;return function(_0x123e9b){if(_0x123e9b){return _0xa8cea8[_0x2dc1('0x16')](_0xdb3229)[_0x2dc1('0x17')](_0x123e9b);}};}function respondWithFilteredResult(_0x2c208d,_0x4b874c){return function(_0xccca90){if(_0xccca90){var _0x502a99=typeof _0x4b874c[_0x2dc1('0x18')]===_0x2dc1('0x19')&&typeof _0x4b874c[_0x2dc1('0x1a')]===_0x2dc1('0x19');var _0x5eebb0=_0xccca90[_0x2dc1('0x1b')];var _0x367e3a=_0x502a99?0x0:_0x4b874c[_0x2dc1('0x18')];var _0x5c8aea=_0x502a99?_0xccca90['count']:_0x4b874c[_0x2dc1('0x18')]+_0x4b874c[_0x2dc1('0x1a')];var _0x56afd5;if(_0x5c8aea>=_0x5eebb0){_0x5c8aea=_0x5eebb0;_0x56afd5=0xc8;}else{_0x56afd5=0xce;}_0x2c208d[_0x2dc1('0x16')](_0x56afd5);return _0x2c208d[_0x2dc1('0x1c')](_0x2dc1('0x1d'),_0x367e3a+'-'+_0x5c8aea+'/'+_0x5eebb0)[_0x2dc1('0x17')](_0xccca90);}return null;};}function patchUpdates(_0x520521){return function(_0x869178){try{jsonpatch[_0x2dc1('0x1e')](_0x869178,_0x520521,!![]);}catch(_0x7ae7c0){return BPromise['reject'](_0x7ae7c0);}return _0x869178['save']();};}function saveUpdates(_0xc4c9a4,_0x9dcde0){return function(_0x219961){if(_0x219961){return _0x219961['update'](_0xc4c9a4)[_0x2dc1('0x1f')](function(_0x779da1){return _0x779da1;});}return null;};}function removeEntity(_0x1a16a5,_0x2ec836){return function(_0x1b1cb1){if(_0x1b1cb1){return _0x1b1cb1[_0x2dc1('0x20')]()[_0x2dc1('0x1f')](function(){_0x1a16a5[_0x2dc1('0x16')](0xcc)[_0x2dc1('0x15')]();});}};}function handleEntityNotFound(_0x505d3d,_0x21d39b){return function(_0x3c6b9e){if(!_0x3c6b9e){_0x505d3d[_0x2dc1('0x14')](0x194);}return _0x3c6b9e;};}function handleError(_0xbb361c,_0x3131ea){_0x3131ea=_0x3131ea||0x1f4;return function(_0x40c98c){logger['error'](_0x40c98c['stack']);if(_0x40c98c['name']){delete _0x40c98c[_0x2dc1('0x21')];}_0xbb361c[_0x2dc1('0x16')](_0x3131ea)[_0x2dc1('0x22')](_0x40c98c);};}exports[_0x2dc1('0x23')]=function(_0x13439e,_0x1869c4){var _0x36abbc={},_0x1f9b79={},_0x4fe877={'count':0x0,'rows':[]};var _0x121a7e=_[_0x2dc1('0x24')](db[_0x2dc1('0x25')]['rawAttributes'],function(_0xd298ac){return{'name':_0xd298ac[_0x2dc1('0x26')],'type':_0xd298ac[_0x2dc1('0x27')][_0x2dc1('0x28')]};});_0x1f9b79[_0x2dc1('0x29')]=_[_0x2dc1('0x24')](_0x121a7e,'name');_0x1f9b79[_0x2dc1('0x2a')]=_['keys'](_0x13439e[_0x2dc1('0x2a')]);_0x1f9b79[_0x2dc1('0x2b')]=_[_0x2dc1('0x2c')](_0x1f9b79[_0x2dc1('0x29')],_0x1f9b79[_0x2dc1('0x2a')]);_0x36abbc['attributes']=_[_0x2dc1('0x2c')](_0x1f9b79[_0x2dc1('0x29')],qs[_0x2dc1('0x2d')](_0x13439e[_0x2dc1('0x2a')][_0x2dc1('0x2d')]));_0x36abbc['attributes']=_0x36abbc[_0x2dc1('0x2e')]['length']?_0x36abbc[_0x2dc1('0x2e')]:_0x1f9b79['model'];if(!_0x13439e['query'][_0x2dc1('0x2f')]('nolimit')){_0x36abbc[_0x2dc1('0x1a')]=qs[_0x2dc1('0x1a')](_0x13439e['query'][_0x2dc1('0x1a')]);_0x36abbc[_0x2dc1('0x18')]=qs[_0x2dc1('0x18')](_0x13439e['query']['offset']);}_0x36abbc[_0x2dc1('0x30')]=qs['sort'](_0x13439e[_0x2dc1('0x2a')][_0x2dc1('0x31')]);_0x36abbc[_0x2dc1('0x32')]=qs['filters'](_[_0x2dc1('0x33')](_0x13439e[_0x2dc1('0x2a')],_0x1f9b79[_0x2dc1('0x2b')]),_0x121a7e);if(_0x13439e[_0x2dc1('0x2a')][_0x2dc1('0x34')]){_0x36abbc[_0x2dc1('0x32')]=_[_0x2dc1('0x35')](_0x36abbc[_0x2dc1('0x32')],{'$or':_[_0x2dc1('0x24')](_0x121a7e,function(_0x4625ee){if(_0x4625ee['type']!==_0x2dc1('0x36')){var _0x120dd6={};_0x120dd6[_0x4625ee[_0x2dc1('0x21')]]={'$like':'%'+_0x13439e[_0x2dc1('0x2a')][_0x2dc1('0x34')]+'%'};return _0x120dd6;}})});}_0x36abbc=_[_0x2dc1('0x35')]({},_0x36abbc,_0x13439e[_0x2dc1('0x37')]);var _0x290579={'where':_0x36abbc['where']};return db[_0x2dc1('0x25')]['count'](_0x290579)[_0x2dc1('0x1f')](function(_0x5f12d0){_0x4fe877[_0x2dc1('0x1b')]=_0x5f12d0;if(_0x13439e[_0x2dc1('0x2a')][_0x2dc1('0x38')]){_0x36abbc[_0x2dc1('0x39')]=[{'all':!![]}];}return db[_0x2dc1('0x25')]['findAll'](_0x36abbc);})[_0x2dc1('0x1f')](function(_0xf3fe5d){_0x4fe877['rows']=_0xf3fe5d;return _0x4fe877;})[_0x2dc1('0x1f')](respondWithFilteredResult(_0x1869c4,_0x36abbc))['catch'](handleError(_0x1869c4,null));};exports[_0x2dc1('0x3a')]=function(_0x5dd863,_0xac2555){var _0xefbbc4={'raw':!![],'where':{'id':_0x5dd863['params']['id']}},_0x38432b={};_0x38432b[_0x2dc1('0x29')]=_[_0x2dc1('0x3b')](db[_0x2dc1('0x25')][_0x2dc1('0x3c')]);_0x38432b[_0x2dc1('0x2a')]=_[_0x2dc1('0x3b')](_0x5dd863[_0x2dc1('0x2a')]);_0x38432b[_0x2dc1('0x2b')]=_[_0x2dc1('0x2c')](_0x38432b['model'],_0x38432b[_0x2dc1('0x2a')]);_0xefbbc4[_0x2dc1('0x2e')]=_['intersection'](_0x38432b[_0x2dc1('0x29')],qs[_0x2dc1('0x2d')](_0x5dd863[_0x2dc1('0x2a')][_0x2dc1('0x2d')]));_0xefbbc4[_0x2dc1('0x2e')]=_0xefbbc4['attributes']['length']?_0xefbbc4[_0x2dc1('0x2e')]:_0x38432b[_0x2dc1('0x29')];if(_0x5dd863[_0x2dc1('0x2a')][_0x2dc1('0x38')]){_0xefbbc4[_0x2dc1('0x39')]=[{'all':!![]}];}_0xefbbc4=_['merge']({},_0xefbbc4,_0x5dd863[_0x2dc1('0x37')]);return db[_0x2dc1('0x25')]['find'](_0xefbbc4)[_0x2dc1('0x1f')](handleEntityNotFound(_0xac2555,null))[_0x2dc1('0x1f')](respondWithResult(_0xac2555,null))[_0x2dc1('0x3d')](handleError(_0xac2555,null));};exports[_0x2dc1('0x3e')]=function(_0x5e15b8,_0x337b0f){return db[_0x2dc1('0x25')][_0x2dc1('0x3e')](_0x5e15b8[_0x2dc1('0x3f')],{})[_0x2dc1('0x1f')](respondWithResult(_0x337b0f,0xc9))[_0x2dc1('0x3d')](handleError(_0x337b0f,null));};exports[_0x2dc1('0x40')]=function(_0x18ae71,_0x59d720){if(_0x18ae71['body']['id']){delete _0x18ae71[_0x2dc1('0x3f')]['id'];}return db[_0x2dc1('0x25')][_0x2dc1('0x41')]({'where':{'id':_0x18ae71[_0x2dc1('0x42')]['id']}})[_0x2dc1('0x1f')](handleEntityNotFound(_0x59d720,null))[_0x2dc1('0x1f')](saveUpdates(_0x18ae71[_0x2dc1('0x3f')],null))[_0x2dc1('0x1f')](respondWithResult(_0x59d720,null))[_0x2dc1('0x3d')](handleError(_0x59d720,null));};exports[_0x2dc1('0x20')]=function(_0x343d38,_0x32b3b1){return db['MailSubstatus'][_0x2dc1('0x41')]({'where':{'id':_0x343d38['params']['id']}})[_0x2dc1('0x1f')](handleEntityNotFound(_0x32b3b1,null))[_0x2dc1('0x1f')](removeEntity(_0x32b3b1,null))['catch'](handleError(_0x32b3b1,null));};exports[_0x2dc1('0x43')]=function(_0x319fe1,_0x4d86f7){return db[_0x2dc1('0x25')][_0x2dc1('0x43')]()[_0x2dc1('0x1f')](respondWithResult(_0x4d86f7,null))['catch'](handleError(_0x4d86f7,null));}; \ No newline at end of file +var _0xec1e=['intersection','model','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','MailSubstatus','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','save','update','then','destroy','end','error','stack','name','index','map','type','query','keys','filters'];(function(_0x3e798a,_0x1c3f1f){var _0x34538f=function(_0x40e35d){while(--_0x40e35d){_0x3e798a['push'](_0x3e798a['shift']());}};_0x34538f(++_0x1c3f1f);}(_0xec1e,0x185));var _0xeec1=function(_0x4b7648,_0x2afe34){_0x4b7648=_0x4b7648-0x0;var _0x37938c=_0xec1e[_0x4b7648];return _0x37938c;};'use strict';var emlformat=require(_0xeec1('0x0'));var rimraf=require(_0xeec1('0x1'));var zipdir=require(_0xeec1('0x2'));var jsonpatch=require(_0xeec1('0x3'));var rp=require(_0xeec1('0x4'));var moment=require(_0xeec1('0x5'));var BPromise=require(_0xeec1('0x6'));var Mustache=require(_0xeec1('0x7'));var util=require(_0xeec1('0x8'));var path=require(_0xeec1('0x9'));var sox=require(_0xeec1('0xa'));var csv=require(_0xeec1('0xb'));var ejs=require(_0xeec1('0xc'));var fs=require('fs');var fs_extra=require(_0xeec1('0xd'));var _=require(_0xeec1('0xe'));var squel=require('squel');var crypto=require(_0xeec1('0xf'));var jsforce=require(_0xeec1('0x10'));var deskjs=require(_0xeec1('0x11'));var toCsv=require('to-csv');var querystring=require(_0xeec1('0x12'));var Papa=require('papaparse');var Redis=require(_0xeec1('0x13'));var authService=require(_0xeec1('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xeec1('0x15'));var hardwareService=require(_0xeec1('0x16'));var logger=require(_0xeec1('0x17'))(_0xeec1('0x18'));var utils=require(_0xeec1('0x19'));var config=require(_0xeec1('0x1a'));var licenseUtil=require(_0xeec1('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1fc441,_0x27238c){_0x27238c=_0x27238c||0xcc;return function(_0x53dc7b){if(_0x53dc7b){return _0x1fc441[_0xeec1('0x1c')](_0x27238c);}return _0x1fc441[_0xeec1('0x1d')](_0x27238c)['end']();};}function respondWithResult(_0x1c1070,_0x228e6e){_0x228e6e=_0x228e6e||0xc8;return function(_0x52d149){if(_0x52d149){return _0x1c1070[_0xeec1('0x1d')](_0x228e6e)['json'](_0x52d149);}};}function respondWithFilteredResult(_0x267032,_0x5aded4){return function(_0x1d6242){if(_0x1d6242){var _0x438f6f=typeof _0x5aded4[_0xeec1('0x1e')]===_0xeec1('0x1f')&&typeof _0x5aded4[_0xeec1('0x20')]===_0xeec1('0x1f');var _0x587092=_0x1d6242[_0xeec1('0x21')];var _0x190089=_0x438f6f?0x0:_0x5aded4[_0xeec1('0x1e')];var _0x4e3e39=_0x438f6f?_0x1d6242['count']:_0x5aded4[_0xeec1('0x1e')]+_0x5aded4[_0xeec1('0x20')];var _0x3e52b3;if(_0x4e3e39>=_0x587092){_0x4e3e39=_0x587092;_0x3e52b3=0xc8;}else{_0x3e52b3=0xce;}_0x267032['status'](_0x3e52b3);return _0x267032[_0xeec1('0x22')]('Content-Range',_0x190089+'-'+_0x4e3e39+'/'+_0x587092)['json'](_0x1d6242);}return null;};}function patchUpdates(_0x4d5dd9){return function(_0x2fb3a1){try{jsonpatch['apply'](_0x2fb3a1,_0x4d5dd9,!![]);}catch(_0x12e7c0){return BPromise['reject'](_0x12e7c0);}return _0x2fb3a1[_0xeec1('0x23')]();};}function saveUpdates(_0x297906,_0xffd1f5){return function(_0x348125){if(_0x348125){return _0x348125[_0xeec1('0x24')](_0x297906)[_0xeec1('0x25')](function(_0x677240){return _0x677240;});}return null;};}function removeEntity(_0x3a6905,_0x3adda7){return function(_0xc7aee8){if(_0xc7aee8){return _0xc7aee8[_0xeec1('0x26')]()[_0xeec1('0x25')](function(){_0x3a6905[_0xeec1('0x1d')](0xcc)[_0xeec1('0x27')]();});}};}function handleEntityNotFound(_0x106bbe,_0x520208){return function(_0x4c2a43){if(!_0x4c2a43){_0x106bbe[_0xeec1('0x1c')](0x194);}return _0x4c2a43;};}function handleError(_0x95b024,_0x13274b){_0x13274b=_0x13274b||0x1f4;return function(_0x10e55e){logger[_0xeec1('0x28')](_0x10e55e[_0xeec1('0x29')]);if(_0x10e55e[_0xeec1('0x2a')]){delete _0x10e55e['name'];}_0x95b024[_0xeec1('0x1d')](_0x13274b)['send'](_0x10e55e);};}exports[_0xeec1('0x2b')]=function(_0x338bb8,_0x2be8e6){var _0x192db7={},_0x2d4e97={},_0x3dadf1={'count':0x0,'rows':[]};var _0x8350db=_[_0xeec1('0x2c')](db['MailSubstatus']['rawAttributes'],function(_0x385c9f){return{'name':_0x385c9f['fieldName'],'type':_0x385c9f[_0xeec1('0x2d')]['key']};});_0x2d4e97['model']=_[_0xeec1('0x2c')](_0x8350db,_0xeec1('0x2a'));_0x2d4e97[_0xeec1('0x2e')]=_[_0xeec1('0x2f')](_0x338bb8['query']);_0x2d4e97[_0xeec1('0x30')]=_[_0xeec1('0x31')](_0x2d4e97[_0xeec1('0x32')],_0x2d4e97['query']);_0x192db7['attributes']=_[_0xeec1('0x31')](_0x2d4e97['model'],qs[_0xeec1('0x33')](_0x338bb8[_0xeec1('0x2e')][_0xeec1('0x33')]));_0x192db7[_0xeec1('0x34')]=_0x192db7[_0xeec1('0x34')][_0xeec1('0x35')]?_0x192db7[_0xeec1('0x34')]:_0x2d4e97['model'];if(!_0x338bb8[_0xeec1('0x2e')][_0xeec1('0x36')]('nolimit')){_0x192db7['limit']=qs['limit'](_0x338bb8[_0xeec1('0x2e')][_0xeec1('0x20')]);_0x192db7['offset']=qs[_0xeec1('0x1e')](_0x338bb8[_0xeec1('0x2e')]['offset']);}_0x192db7['order']=qs[_0xeec1('0x37')](_0x338bb8['query'][_0xeec1('0x37')]);_0x192db7[_0xeec1('0x38')]=qs[_0xeec1('0x30')](_[_0xeec1('0x39')](_0x338bb8[_0xeec1('0x2e')],_0x2d4e97[_0xeec1('0x30')]),_0x8350db);if(_0x338bb8[_0xeec1('0x2e')][_0xeec1('0x3a')]){_0x192db7['where']=_[_0xeec1('0x3b')](_0x192db7['where'],{'$or':_['map'](_0x8350db,function(_0x45df6b){if(_0x45df6b[_0xeec1('0x2d')]!=='VIRTUAL'){var _0x10f8a3={};_0x10f8a3[_0x45df6b[_0xeec1('0x2a')]]={'$like':'%'+_0x338bb8['query'][_0xeec1('0x3a')]+'%'};return _0x10f8a3;}})});}_0x192db7=_[_0xeec1('0x3b')]({},_0x192db7,_0x338bb8['options']);var _0x4af416={'where':_0x192db7['where']};return db[_0xeec1('0x3c')][_0xeec1('0x21')](_0x4af416)[_0xeec1('0x25')](function(_0x11728e){_0x3dadf1[_0xeec1('0x21')]=_0x11728e;if(_0x338bb8['query'][_0xeec1('0x3d')]){_0x192db7[_0xeec1('0x3e')]=[{'all':!![]}];}return db[_0xeec1('0x3c')][_0xeec1('0x3f')](_0x192db7);})[_0xeec1('0x25')](function(_0x596cbe){_0x3dadf1[_0xeec1('0x40')]=_0x596cbe;return _0x3dadf1;})['then'](respondWithFilteredResult(_0x2be8e6,_0x192db7))['catch'](handleError(_0x2be8e6,null));};exports[_0xeec1('0x41')]=function(_0x5de599,_0x4f3fb4){var _0xf6fccf={'raw':!![],'where':{'id':_0x5de599[_0xeec1('0x42')]['id']}},_0x359c0b={};_0x359c0b[_0xeec1('0x32')]=_[_0xeec1('0x2f')](db[_0xeec1('0x3c')]['rawAttributes']);_0x359c0b[_0xeec1('0x2e')]=_[_0xeec1('0x2f')](_0x5de599['query']);_0x359c0b[_0xeec1('0x30')]=_['intersection'](_0x359c0b['model'],_0x359c0b[_0xeec1('0x2e')]);_0xf6fccf[_0xeec1('0x34')]=_[_0xeec1('0x31')](_0x359c0b['model'],qs[_0xeec1('0x33')](_0x5de599['query']['fields']));_0xf6fccf['attributes']=_0xf6fccf[_0xeec1('0x34')][_0xeec1('0x35')]?_0xf6fccf[_0xeec1('0x34')]:_0x359c0b['model'];if(_0x5de599[_0xeec1('0x2e')][_0xeec1('0x3d')]){_0xf6fccf['include']=[{'all':!![]}];}_0xf6fccf=_[_0xeec1('0x3b')]({},_0xf6fccf,_0x5de599[_0xeec1('0x43')]);return db[_0xeec1('0x3c')][_0xeec1('0x44')](_0xf6fccf)['then'](handleEntityNotFound(_0x4f3fb4,null))['then'](respondWithResult(_0x4f3fb4,null))[_0xeec1('0x45')](handleError(_0x4f3fb4,null));};exports[_0xeec1('0x46')]=function(_0x9dac62,_0x36ab65){return db[_0xeec1('0x3c')][_0xeec1('0x46')](_0x9dac62[_0xeec1('0x47')],{})[_0xeec1('0x25')](respondWithResult(_0x36ab65,0xc9))['catch'](handleError(_0x36ab65,null));};exports[_0xeec1('0x24')]=function(_0x1a8ec0,_0x39ae28){if(_0x1a8ec0[_0xeec1('0x47')]['id']){delete _0x1a8ec0[_0xeec1('0x47')]['id'];}return db[_0xeec1('0x3c')][_0xeec1('0x44')]({'where':{'id':_0x1a8ec0[_0xeec1('0x42')]['id']}})['then'](handleEntityNotFound(_0x39ae28,null))[_0xeec1('0x25')](saveUpdates(_0x1a8ec0['body'],null))[_0xeec1('0x25')](respondWithResult(_0x39ae28,null))['catch'](handleError(_0x39ae28,null));};exports[_0xeec1('0x26')]=function(_0x3d2c6c,_0x473c1f){return db['MailSubstatus']['find']({'where':{'id':_0x3d2c6c[_0xeec1('0x42')]['id']}})[_0xeec1('0x25')](handleEntityNotFound(_0x473c1f,null))[_0xeec1('0x25')](removeEntity(_0x473c1f,null))[_0xeec1('0x45')](handleError(_0x473c1f,null));};exports[_0xeec1('0x48')]=function(_0x8b47a9,_0xaa06e6){return db['MailSubstatus'][_0xeec1('0x48')]()[_0xeec1('0x25')](respondWithResult(_0xaa06e6,null))[_0xeec1('0x45')](handleError(_0xaa06e6,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 35fbfbc..b669585 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 _0x4254=['mail_substatuses','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./mailSubstatus.attributes','define','MailSubstatus'];(function(_0x59c2c8,_0x4c77e2){var _0x24f258=function(_0x2527bf){while(--_0x2527bf){_0x59c2c8['push'](_0x59c2c8['shift']());}};_0x24f258(++_0x4c77e2);}(_0x4254,0x156));var _0x4425=function(_0x46b0cc,_0x4f08e2){_0x46b0cc=_0x46b0cc-0x0;var _0x3f69ac=_0x4254[_0x46b0cc];return _0x3f69ac;};'use strict';var _=require(_0x4425('0x0'));var util=require('util');var logger=require(_0x4425('0x1'))('api');var moment=require(_0x4425('0x2'));var BPromise=require(_0x4425('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4425('0x4'));var rimraf=require(_0x4425('0x5'));var config=require(_0x4425('0x6'));var attributes=require(_0x4425('0x7'));module['exports']=function(_0x1a41d2,_0x511750){return _0x1a41d2[_0x4425('0x8')](_0x4425('0x9'),attributes,{'tableName':_0x4425('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3052=['./mailSubstatus.attributes','exports','MailSubstatus','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3052,0x183));var _0x2305=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3052[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x2305('0x0'));var util=require(_0x2305('0x1'));var logger=require(_0x2305('0x2'))(_0x2305('0x3'));var moment=require('moment');var BPromise=require(_0x2305('0x4'));var rp=require(_0x2305('0x5'));var fs=require('fs');var path=require(_0x2305('0x6'));var rimraf=require(_0x2305('0x7'));var config=require(_0x2305('0x8'));var attributes=require(_0x2305('0x9'));module[_0x2305('0xa')]=function(_0x2495a0,_0x170851){return _0x2495a0['define'](_0x2305('0xb'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 04c511e..0b1d554 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 _0x0541=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x2d03eb,_0x1f35fe){var _0x4e26ec=function(_0xeb6828){while(--_0xeb6828){_0x2d03eb['push'](_0x2d03eb['shift']());}};_0x4e26ec(++_0x1f35fe);}(_0x0541,0x19e));var _0x1054=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0x0541[_0x2aa0e7];return _0x1472c0;};'use strict';var _=require('lodash');var util=require(_0x1054('0x0'));var moment=require(_0x1054('0x1'));var BPromise=require(_0x1054('0x2'));var rs=require(_0x1054('0x3'));var fs=require('fs');var Redis=require(_0x1054('0x4'));var db=require(_0x1054('0x5'))['db'];var utils=require(_0x1054('0x6'));var logger=require(_0x1054('0x7'))(_0x1054('0x8'));var config=require(_0x1054('0x9'));var jayson=require(_0x1054('0xa'));var client=jayson[_0x1054('0xb')][_0x1054('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x401329,_0xe1e85d,_0x3c7727){return new BPromise(function(_0x25544a,_0x992801){return client[_0x1054('0xd')](_0x401329,_0x3c7727)['then'](function(_0x5c40a1){logger[_0x1054('0xe')](_0x1054('0xf'),_0xe1e85d,_0x1054('0x10'));logger['debug'](_0x1054('0x11'),_0xe1e85d,_0x1054('0x10'),JSON['stringify'](_0x5c40a1));if(_0x5c40a1[_0x1054('0x12')]){if(_0x5c40a1[_0x1054('0x12')][_0x1054('0x13')]===0x1f4){logger[_0x1054('0x12')](_0x1054('0xf'),_0xe1e85d,_0x5c40a1[_0x1054('0x12')][_0x1054('0x14')]);return _0x992801(_0x5c40a1[_0x1054('0x12')][_0x1054('0x14')]);}logger['error'](_0x1054('0xf'),_0xe1e85d,_0x5c40a1['error'][_0x1054('0x14')]);return _0x25544a(_0x5c40a1[_0x1054('0x12')][_0x1054('0x14')]);}else{logger['info']('MailSubstatus,\x20%s,\x20%s',_0xe1e85d,'request\x20sent');_0x25544a(_0x5c40a1[_0x1054('0x15')][_0x1054('0x14')]);}})[_0x1054('0x16')](function(_0x529f02){logger['error'](_0x1054('0xf'),_0xe1e85d,_0x529f02);_0x992801(_0x529f02);});});} \ No newline at end of file +var _0xe385=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','message','util','moment','randomstring','ioredis'];(function(_0x37ae16,_0x359a0b){var _0x488921=function(_0x17c8cf){while(--_0x17c8cf){_0x37ae16['push'](_0x37ae16['shift']());}};_0x488921(++_0x359a0b);}(_0xe385,0x11c));var _0x5e38=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xe385[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0x5e38('0x0'));var moment=require(_0x5e38('0x1'));var BPromise=require('bluebird');var rs=require(_0x5e38('0x2'));var fs=require('fs');var Redis=require(_0x5e38('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5e38('0x4'));var logger=require(_0x5e38('0x5'))('rpc');var config=require(_0x5e38('0x6'));var jayson=require(_0x5e38('0x7'));var client=jayson[_0x5e38('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x840548,_0x2a03e4,_0x245896){return new BPromise(function(_0x5be98f,_0x3c9426){return client[_0x5e38('0x9')](_0x840548,_0x245896)['then'](function(_0x563fb2){logger[_0x5e38('0xa')](_0x5e38('0xb'),_0x2a03e4,_0x5e38('0xc'));logger[_0x5e38('0xd')](_0x5e38('0xe'),_0x2a03e4,_0x5e38('0xc'),JSON[_0x5e38('0xf')](_0x563fb2));if(_0x563fb2[_0x5e38('0x10')]){if(_0x563fb2[_0x5e38('0x10')]['code']===0x1f4){logger[_0x5e38('0x10')](_0x5e38('0xb'),_0x2a03e4,_0x563fb2[_0x5e38('0x10')][_0x5e38('0x11')]);return _0x3c9426(_0x563fb2[_0x5e38('0x10')][_0x5e38('0x11')]);}logger[_0x5e38('0x10')](_0x5e38('0xb'),_0x2a03e4,_0x563fb2[_0x5e38('0x10')]['message']);return _0x5be98f(_0x563fb2[_0x5e38('0x10')][_0x5e38('0x11')]);}else{logger[_0x5e38('0xa')]('MailSubstatus,\x20%s,\x20%s',_0x2a03e4,_0x5e38('0xc'));_0x5be98f(_0x563fb2['result'][_0x5e38('0x11')]);}})['catch'](function(_0x2b014e){logger[_0x5e38('0x10')](_0x5e38('0xb'),_0x2a03e4,_0x2b014e);_0x3c9426(_0x2b014e);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 01c601e..ccbfda3 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 _0x29ec=['../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x15cf93,_0x5b1029){var _0x2afb0a=function(_0x5413ed){while(--_0x5413ed){_0x15cf93['push'](_0x15cf93['shift']());}};_0x2afb0a(++_0x5b1029);}(_0x29ec,0x85));var _0xc29e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x29ec[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc29e('0x0'));var util=require('util');var path=require(_0xc29e('0x1'));var timeout=require(_0xc29e('0x2'));var express=require(_0xc29e('0x3'));var router=express[_0xc29e('0x4')]();var fs_extra=require(_0xc29e('0x5'));var auth=require(_0xc29e('0x6'));var interaction=require(_0xc29e('0x7'));var config=require(_0xc29e('0x8'));var controller=require(_0xc29e('0x9'));router[_0xc29e('0xa')]('/',auth[_0xc29e('0xb')](),controller[_0xc29e('0xc')]);router[_0xc29e('0xa')](_0xc29e('0xd'),auth[_0xc29e('0xb')](),controller[_0xc29e('0xe')]);router['get'](_0xc29e('0xf'),auth[_0xc29e('0xb')](),controller[_0xc29e('0x10')]);router[_0xc29e('0x11')]('/',auth[_0xc29e('0xb')](),controller[_0xc29e('0x12')]);router['put']('/:id',auth[_0xc29e('0xb')](),controller[_0xc29e('0x13')]);router['delete'](_0xc29e('0xf'),auth[_0xc29e('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7b50=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create'];(function(_0x27cb61,_0x35e2ea){var _0x2ed4b1=function(_0x301e07){while(--_0x301e07){_0x27cb61['push'](_0x27cb61['shift']());}};_0x2ed4b1(++_0x35e2ea);}(_0x7b50,0xb8));var _0x07b5=function(_0x2bae66,_0x598a33){_0x2bae66=_0x2bae66-0x0;var _0x37704a=_0x7b50[_0x2bae66];return _0x37704a;};'use strict';var multer=require(_0x07b5('0x0'));var util=require(_0x07b5('0x1'));var path=require(_0x07b5('0x2'));var timeout=require(_0x07b5('0x3'));var express=require(_0x07b5('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x07b5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x07b5('0x6'));var controller=require('./mailTransferReport.controller');router[_0x07b5('0x7')]('/',auth[_0x07b5('0x8')](),controller[_0x07b5('0x9')]);router[_0x07b5('0x7')](_0x07b5('0xa'),auth['isAuthenticated'](),controller[_0x07b5('0xb')]);router[_0x07b5('0x7')](_0x07b5('0xc'),auth[_0x07b5('0x8')](),controller[_0x07b5('0xd')]);router[_0x07b5('0xe')]('/',auth[_0x07b5('0x8')](),controller[_0x07b5('0xf')]);router['put'](_0x07b5('0xc'),auth[_0x07b5('0x8')](),controller[_0x07b5('0x10')]);router[_0x07b5('0x11')](_0x07b5('0xc'),auth[_0x07b5('0x8')](),controller[_0x07b5('0x12')]);module[_0x07b5('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index bcce867..3ee6243 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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x318f46,_0x3ed5a9){var _0x125f88=function(_0x388844){while(--_0x388844){_0x318f46['push'](_0x318f46['shift']());}};_0x125f88(++_0x3ed5a9);}(_0x34e8,0x12c));var _0x834e=function(_0x575382,_0x12020f){_0x575382=_0x575382-0x0;var _0x224e6a=_0x34e8[_0x575382];return _0x224e6a;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file +var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x23e5ce,_0x57584d){var _0x2ce19b=function(_0x318e1f){while(--_0x318e1f){_0x23e5ce['push'](_0x23e5ce['shift']());}};_0x2ce19b(++_0x57584d);}(_0x008c,0x188));var _0xc008=function(_0x557a30,_0x433df5){_0x557a30=_0x557a30-0x0;var _0x2bf5f6=_0x008c[_0x557a30];return _0x2bf5f6;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index ddbeaff..ada65de 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 _0xed01=['key','model','map','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','filter','merge','VIRTUAL','options','MailTransferReport','includeAll','include','catch','show','params','rawAttributes','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','update','then','destroy','error','stack','name','send','index','type'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xed01,0xaf));var _0x1ed0=function(_0x1a7edf,_0x5c4e04){_0x1a7edf=_0x1a7edf-0x0;var _0x56c1d9=_0xed01[_0x1a7edf];return _0x56c1d9;};'use strict';var emlformat=require(_0x1ed0('0x0'));var rimraf=require(_0x1ed0('0x1'));var zipdir=require(_0x1ed0('0x2'));var jsonpatch=require(_0x1ed0('0x3'));var rp=require(_0x1ed0('0x4'));var moment=require(_0x1ed0('0x5'));var BPromise=require(_0x1ed0('0x6'));var Mustache=require(_0x1ed0('0x7'));var util=require(_0x1ed0('0x8'));var path=require(_0x1ed0('0x9'));var sox=require(_0x1ed0('0xa'));var csv=require('to-csv');var ejs=require(_0x1ed0('0xb'));var fs=require('fs');var fs_extra=require(_0x1ed0('0xc'));var _=require('lodash');var squel=require(_0x1ed0('0xd'));var crypto=require(_0x1ed0('0xe'));var jsforce=require(_0x1ed0('0xf'));var deskjs=require(_0x1ed0('0x10'));var toCsv=require('to-csv');var querystring=require(_0x1ed0('0x11'));var Papa=require('papaparse');var Redis=require(_0x1ed0('0x12'));var authService=require(_0x1ed0('0x13'));var qs=require(_0x1ed0('0x14'));var as=require(_0x1ed0('0x15'));var hardwareService=require(_0x1ed0('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x1ed0('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1ed0('0x18'))['db'];function respondWithStatusCode(_0x9472e4,_0x38dfc1){_0x38dfc1=_0x38dfc1||0xcc;return function(_0x69879d){if(_0x69879d){return _0x9472e4[_0x1ed0('0x19')](_0x38dfc1);}return _0x9472e4[_0x1ed0('0x1a')](_0x38dfc1)[_0x1ed0('0x1b')]();};}function respondWithResult(_0x3763c6,_0x3653a1){_0x3653a1=_0x3653a1||0xc8;return function(_0x1128e2){if(_0x1128e2){return _0x3763c6['status'](_0x3653a1)[_0x1ed0('0x1c')](_0x1128e2);}};}function respondWithFilteredResult(_0x172d25,_0x47ecca){return function(_0x4aae14){if(_0x4aae14){var _0x16936e=typeof _0x47ecca[_0x1ed0('0x1d')]===_0x1ed0('0x1e')&&typeof _0x47ecca['limit']===_0x1ed0('0x1e');var _0x14c1c2=_0x4aae14[_0x1ed0('0x1f')];var _0x355eb6=_0x16936e?0x0:_0x47ecca[_0x1ed0('0x1d')];var _0x307f97=_0x16936e?_0x4aae14[_0x1ed0('0x1f')]:_0x47ecca['offset']+_0x47ecca[_0x1ed0('0x20')];var _0x5a7931;if(_0x307f97>=_0x14c1c2){_0x307f97=_0x14c1c2;_0x5a7931=0xc8;}else{_0x5a7931=0xce;}_0x172d25['status'](_0x5a7931);return _0x172d25['set'](_0x1ed0('0x21'),_0x355eb6+'-'+_0x307f97+'/'+_0x14c1c2)[_0x1ed0('0x1c')](_0x4aae14);}return null;};}function patchUpdates(_0x22dbad){return function(_0x28c146){try{jsonpatch[_0x1ed0('0x22')](_0x28c146,_0x22dbad,!![]);}catch(_0x48e3b8){return BPromise['reject'](_0x48e3b8);}return _0x28c146['save']();};}function saveUpdates(_0x14b55d,_0x193fa3){return function(_0x8e2ca6){if(_0x8e2ca6){return _0x8e2ca6[_0x1ed0('0x23')](_0x14b55d)[_0x1ed0('0x24')](function(_0x561f43){return _0x561f43;});}return null;};}function removeEntity(_0x442992,_0x58171d){return function(_0x4c39de){if(_0x4c39de){return _0x4c39de[_0x1ed0('0x25')]()[_0x1ed0('0x24')](function(){_0x442992[_0x1ed0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12f0a8,_0x3d4f96){return function(_0x1977cf){if(!_0x1977cf){_0x12f0a8[_0x1ed0('0x19')](0x194);}return _0x1977cf;};}function handleError(_0x1424d9,_0x5af045){_0x5af045=_0x5af045||0x1f4;return function(_0x4f9e46){logger[_0x1ed0('0x26')](_0x4f9e46[_0x1ed0('0x27')]);if(_0x4f9e46[_0x1ed0('0x28')]){delete _0x4f9e46[_0x1ed0('0x28')];}_0x1424d9[_0x1ed0('0x1a')](_0x5af045)[_0x1ed0('0x29')](_0x4f9e46);};}exports[_0x1ed0('0x2a')]=function(_0x3d4eb1,_0x585aa9){var _0x2f2527={},_0x34cb75={},_0x1846f8={'count':0x0,'rows':[]};var _0x53c951=_['map'](db['MailTransferReport']['rawAttributes'],function(_0x3a75c7){return{'name':_0x3a75c7['fieldName'],'type':_0x3a75c7[_0x1ed0('0x2b')][_0x1ed0('0x2c')]};});_0x34cb75[_0x1ed0('0x2d')]=_[_0x1ed0('0x2e')](_0x53c951,_0x1ed0('0x28'));_0x34cb75[_0x1ed0('0x2f')]=_[_0x1ed0('0x30')](_0x3d4eb1[_0x1ed0('0x2f')]);_0x34cb75[_0x1ed0('0x31')]=_[_0x1ed0('0x32')](_0x34cb75[_0x1ed0('0x2d')],_0x34cb75[_0x1ed0('0x2f')]);_0x2f2527[_0x1ed0('0x33')]=_[_0x1ed0('0x32')](_0x34cb75[_0x1ed0('0x2d')],qs['fields'](_0x3d4eb1[_0x1ed0('0x2f')][_0x1ed0('0x34')]));_0x2f2527['attributes']=_0x2f2527[_0x1ed0('0x33')]['length']?_0x2f2527[_0x1ed0('0x33')]:_0x34cb75[_0x1ed0('0x2d')];if(!_0x3d4eb1[_0x1ed0('0x2f')]['hasOwnProperty']('nolimit')){_0x2f2527[_0x1ed0('0x20')]=qs[_0x1ed0('0x20')](_0x3d4eb1[_0x1ed0('0x2f')][_0x1ed0('0x20')]);_0x2f2527['offset']=qs[_0x1ed0('0x1d')](_0x3d4eb1[_0x1ed0('0x2f')][_0x1ed0('0x1d')]);}_0x2f2527[_0x1ed0('0x35')]=qs[_0x1ed0('0x36')](_0x3d4eb1[_0x1ed0('0x2f')][_0x1ed0('0x36')]);_0x2f2527[_0x1ed0('0x37')]=qs[_0x1ed0('0x31')](_[_0x1ed0('0x38')](_0x3d4eb1[_0x1ed0('0x2f')],_0x34cb75[_0x1ed0('0x31')]),_0x53c951);if(_0x3d4eb1['query'][_0x1ed0('0x39')]){_0x2f2527['where']=_[_0x1ed0('0x3a')](_0x2f2527['where'],{'$or':_[_0x1ed0('0x2e')](_0x53c951,function(_0x26d468){if(_0x26d468[_0x1ed0('0x2b')]!==_0x1ed0('0x3b')){var _0x43abf2={};_0x43abf2[_0x26d468['name']]={'$like':'%'+_0x3d4eb1[_0x1ed0('0x2f')][_0x1ed0('0x39')]+'%'};return _0x43abf2;}})});}_0x2f2527=_[_0x1ed0('0x3a')]({},_0x2f2527,_0x3d4eb1[_0x1ed0('0x3c')]);var _0x4e38f8={'where':_0x2f2527['where']};return db[_0x1ed0('0x3d')][_0x1ed0('0x1f')](_0x4e38f8)['then'](function(_0x4ad9c2){_0x1846f8[_0x1ed0('0x1f')]=_0x4ad9c2;if(_0x3d4eb1[_0x1ed0('0x2f')][_0x1ed0('0x3e')]){_0x2f2527[_0x1ed0('0x3f')]=[{'all':!![]}];}return db[_0x1ed0('0x3d')]['findAll'](_0x2f2527);})[_0x1ed0('0x24')](function(_0x2ebaef){_0x1846f8['rows']=_0x2ebaef;return _0x1846f8;})[_0x1ed0('0x24')](respondWithFilteredResult(_0x585aa9,_0x2f2527))[_0x1ed0('0x40')](handleError(_0x585aa9,null));};exports[_0x1ed0('0x41')]=function(_0x2c799b,_0x547108){var _0x200561={'raw':!![],'where':{'id':_0x2c799b[_0x1ed0('0x42')]['id']}},_0x3eb5c3={};_0x3eb5c3[_0x1ed0('0x2d')]=_[_0x1ed0('0x30')](db[_0x1ed0('0x3d')][_0x1ed0('0x43')]);_0x3eb5c3['query']=_[_0x1ed0('0x30')](_0x2c799b[_0x1ed0('0x2f')]);_0x3eb5c3['filters']=_[_0x1ed0('0x32')](_0x3eb5c3[_0x1ed0('0x2d')],_0x3eb5c3[_0x1ed0('0x2f')]);_0x200561[_0x1ed0('0x33')]=_[_0x1ed0('0x32')](_0x3eb5c3['model'],qs[_0x1ed0('0x34')](_0x2c799b[_0x1ed0('0x2f')]['fields']));_0x200561[_0x1ed0('0x33')]=_0x200561[_0x1ed0('0x33')][_0x1ed0('0x44')]?_0x200561[_0x1ed0('0x33')]:_0x3eb5c3[_0x1ed0('0x2d')];if(_0x2c799b[_0x1ed0('0x2f')]['includeAll']){_0x200561[_0x1ed0('0x3f')]=[{'all':!![]}];}_0x200561=_[_0x1ed0('0x3a')]({},_0x200561,_0x2c799b[_0x1ed0('0x3c')]);return db[_0x1ed0('0x3d')][_0x1ed0('0x45')](_0x200561)[_0x1ed0('0x24')](handleEntityNotFound(_0x547108,null))[_0x1ed0('0x24')](respondWithResult(_0x547108,null))[_0x1ed0('0x40')](handleError(_0x547108,null));};exports[_0x1ed0('0x46')]=function(_0x55deac,_0x5da999){return db[_0x1ed0('0x3d')]['create'](_0x55deac[_0x1ed0('0x47')],{})[_0x1ed0('0x24')](respondWithResult(_0x5da999,0xc9))[_0x1ed0('0x40')](handleError(_0x5da999,null));};exports['update']=function(_0x184070,_0x551e5f){if(_0x184070['body']['id']){delete _0x184070[_0x1ed0('0x47')]['id'];}return db[_0x1ed0('0x3d')][_0x1ed0('0x45')]({'where':{'id':_0x184070[_0x1ed0('0x42')]['id']}})['then'](handleEntityNotFound(_0x551e5f,null))[_0x1ed0('0x24')](saveUpdates(_0x184070[_0x1ed0('0x47')],null))[_0x1ed0('0x24')](respondWithResult(_0x551e5f,null))[_0x1ed0('0x40')](handleError(_0x551e5f,null));};exports['destroy']=function(_0x15cfbd,_0x3c3b51){return db[_0x1ed0('0x3d')][_0x1ed0('0x45')]({'where':{'id':_0x15cfbd[_0x1ed0('0x42')]['id']}})[_0x1ed0('0x24')](handleEntityNotFound(_0x3c3b51,null))[_0x1ed0('0x24')](removeEntity(_0x3c3b51,null))[_0x1ed0('0x40')](handleError(_0x3c3b51,null));};exports[_0x1ed0('0x48')]=function(_0x25ab58,_0x155b3b){return db['MailTransferReport'][_0x1ed0('0x48')]()[_0x1ed0('0x24')](respondWithResult(_0x155b3b,null))[_0x1ed0('0x40')](handleError(_0x155b3b,null));}; \ No newline at end of file +var _0x6e53=['offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','MailTransferReport','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','nolimit','order','sort','filters','filter','where','merge','includeAll','include','findAll','catch','show','params','options','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json'];(function(_0x2d93d5,_0x3fcd4e){var _0x310143=function(_0x406f85){while(--_0x406f85){_0x2d93d5['push'](_0x2d93d5['shift']());}};_0x310143(++_0x3fcd4e);}(_0x6e53,0x110));var _0x36e5=function(_0x242c29,_0x168f0a){_0x242c29=_0x242c29-0x0;var _0x3f4d1c=_0x6e53[_0x242c29];return _0x3f4d1c;};'use strict';var emlformat=require(_0x36e5('0x0'));var rimraf=require(_0x36e5('0x1'));var zipdir=require(_0x36e5('0x2'));var jsonpatch=require(_0x36e5('0x3'));var rp=require('request-promise');var moment=require(_0x36e5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x36e5('0x5'));var util=require(_0x36e5('0x6'));var path=require(_0x36e5('0x7'));var sox=require(_0x36e5('0x8'));var csv=require(_0x36e5('0x9'));var ejs=require(_0x36e5('0xa'));var fs=require('fs');var fs_extra=require(_0x36e5('0xb'));var _=require(_0x36e5('0xc'));var squel=require(_0x36e5('0xd'));var crypto=require('crypto');var jsforce=require(_0x36e5('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x36e5('0x9'));var querystring=require(_0x36e5('0xf'));var Papa=require(_0x36e5('0x10'));var Redis=require('ioredis');var authService=require(_0x36e5('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x36e5('0x12'));var hardwareService=require(_0x36e5('0x13'));var logger=require(_0x36e5('0x14'))(_0x36e5('0x15'));var utils=require(_0x36e5('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x36e5('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d97a9,_0x2219fe){_0x2219fe=_0x2219fe||0xcc;return function(_0x1c5d43){if(_0x1c5d43){return _0x5d97a9[_0x36e5('0x18')](_0x2219fe);}return _0x5d97a9[_0x36e5('0x19')](_0x2219fe)[_0x36e5('0x1a')]();};}function respondWithResult(_0x4b7063,_0xd3fcf0){_0xd3fcf0=_0xd3fcf0||0xc8;return function(_0x3fa013){if(_0x3fa013){return _0x4b7063[_0x36e5('0x19')](_0xd3fcf0)[_0x36e5('0x1b')](_0x3fa013);}};}function respondWithFilteredResult(_0x44e22b,_0x58e8fc){return function(_0x256667){if(_0x256667){var _0x2e8a25=typeof _0x58e8fc[_0x36e5('0x1c')]===_0x36e5('0x1d')&&typeof _0x58e8fc[_0x36e5('0x1e')]===_0x36e5('0x1d');var _0x45bca5=_0x256667[_0x36e5('0x1f')];var _0x586798=_0x2e8a25?0x0:_0x58e8fc[_0x36e5('0x1c')];var _0x55c002=_0x2e8a25?_0x256667[_0x36e5('0x1f')]:_0x58e8fc[_0x36e5('0x1c')]+_0x58e8fc[_0x36e5('0x1e')];var _0x460c60;if(_0x55c002>=_0x45bca5){_0x55c002=_0x45bca5;_0x460c60=0xc8;}else{_0x460c60=0xce;}_0x44e22b['status'](_0x460c60);return _0x44e22b[_0x36e5('0x20')](_0x36e5('0x21'),_0x586798+'-'+_0x55c002+'/'+_0x45bca5)[_0x36e5('0x1b')](_0x256667);}return null;};}function patchUpdates(_0x2a5c49){return function(_0xe19823){try{jsonpatch[_0x36e5('0x22')](_0xe19823,_0x2a5c49,!![]);}catch(_0xd7ccf8){return BPromise[_0x36e5('0x23')](_0xd7ccf8);}return _0xe19823[_0x36e5('0x24')]();};}function saveUpdates(_0x2348ab,_0x1c363d){return function(_0x192f30){if(_0x192f30){return _0x192f30[_0x36e5('0x25')](_0x2348ab)[_0x36e5('0x26')](function(_0x2f2c74){return _0x2f2c74;});}return null;};}function removeEntity(_0x2c6763,_0x47be67){return function(_0x224f94){if(_0x224f94){return _0x224f94['destroy']()[_0x36e5('0x26')](function(){_0x2c6763[_0x36e5('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9ca9d5,_0x2de51b){return function(_0x5c5996){if(!_0x5c5996){_0x9ca9d5[_0x36e5('0x18')](0x194);}return _0x5c5996;};}function handleError(_0x4c0a96,_0x4df2cc){_0x4df2cc=_0x4df2cc||0x1f4;return function(_0x452d55){logger['error'](_0x452d55[_0x36e5('0x27')]);if(_0x452d55[_0x36e5('0x28')]){delete _0x452d55[_0x36e5('0x28')];}_0x4c0a96[_0x36e5('0x19')](_0x4df2cc)[_0x36e5('0x29')](_0x452d55);};}exports[_0x36e5('0x2a')]=function(_0x30bb00,_0x3b6387){var _0x4d829a={},_0x3a5ea2={},_0x58ea62={'count':0x0,'rows':[]};var _0x11809d=_['map'](db[_0x36e5('0x2b')][_0x36e5('0x2c')],function(_0x3c78e3){return{'name':_0x3c78e3[_0x36e5('0x2d')],'type':_0x3c78e3[_0x36e5('0x2e')][_0x36e5('0x2f')]};});_0x3a5ea2[_0x36e5('0x30')]=_[_0x36e5('0x31')](_0x11809d,_0x36e5('0x28'));_0x3a5ea2[_0x36e5('0x32')]=_[_0x36e5('0x33')](_0x30bb00[_0x36e5('0x32')]);_0x3a5ea2['filters']=_['intersection'](_0x3a5ea2[_0x36e5('0x30')],_0x3a5ea2['query']);_0x4d829a['attributes']=_[_0x36e5('0x34')](_0x3a5ea2[_0x36e5('0x30')],qs[_0x36e5('0x35')](_0x30bb00['query'][_0x36e5('0x35')]));_0x4d829a['attributes']=_0x4d829a[_0x36e5('0x36')][_0x36e5('0x37')]?_0x4d829a[_0x36e5('0x36')]:_0x3a5ea2[_0x36e5('0x30')];if(!_0x30bb00[_0x36e5('0x32')]['hasOwnProperty'](_0x36e5('0x38'))){_0x4d829a[_0x36e5('0x1e')]=qs[_0x36e5('0x1e')](_0x30bb00['query'][_0x36e5('0x1e')]);_0x4d829a[_0x36e5('0x1c')]=qs[_0x36e5('0x1c')](_0x30bb00[_0x36e5('0x32')]['offset']);}_0x4d829a[_0x36e5('0x39')]=qs[_0x36e5('0x3a')](_0x30bb00[_0x36e5('0x32')][_0x36e5('0x3a')]);_0x4d829a['where']=qs[_0x36e5('0x3b')](_['pick'](_0x30bb00[_0x36e5('0x32')],_0x3a5ea2[_0x36e5('0x3b')]),_0x11809d);if(_0x30bb00['query'][_0x36e5('0x3c')]){_0x4d829a[_0x36e5('0x3d')]=_[_0x36e5('0x3e')](_0x4d829a[_0x36e5('0x3d')],{'$or':_[_0x36e5('0x31')](_0x11809d,function(_0x2543f1){if(_0x2543f1['type']!=='VIRTUAL'){var _0x3751e4={};_0x3751e4[_0x2543f1['name']]={'$like':'%'+_0x30bb00[_0x36e5('0x32')]['filter']+'%'};return _0x3751e4;}})});}_0x4d829a=_['merge']({},_0x4d829a,_0x30bb00['options']);var _0x4a790b={'where':_0x4d829a[_0x36e5('0x3d')]};return db[_0x36e5('0x2b')][_0x36e5('0x1f')](_0x4a790b)['then'](function(_0x52e494){_0x58ea62[_0x36e5('0x1f')]=_0x52e494;if(_0x30bb00[_0x36e5('0x32')][_0x36e5('0x3f')]){_0x4d829a[_0x36e5('0x40')]=[{'all':!![]}];}return db[_0x36e5('0x2b')][_0x36e5('0x41')](_0x4d829a);})[_0x36e5('0x26')](function(_0x5ef8b7){_0x58ea62['rows']=_0x5ef8b7;return _0x58ea62;})[_0x36e5('0x26')](respondWithFilteredResult(_0x3b6387,_0x4d829a))[_0x36e5('0x42')](handleError(_0x3b6387,null));};exports[_0x36e5('0x43')]=function(_0x46caa4,_0x220077){var _0x4b3e47={'raw':!![],'where':{'id':_0x46caa4[_0x36e5('0x44')]['id']}},_0x114378={};_0x114378[_0x36e5('0x30')]=_[_0x36e5('0x33')](db['MailTransferReport'][_0x36e5('0x2c')]);_0x114378[_0x36e5('0x32')]=_[_0x36e5('0x33')](_0x46caa4[_0x36e5('0x32')]);_0x114378[_0x36e5('0x3b')]=_[_0x36e5('0x34')](_0x114378[_0x36e5('0x30')],_0x114378['query']);_0x4b3e47[_0x36e5('0x36')]=_[_0x36e5('0x34')](_0x114378['model'],qs['fields'](_0x46caa4[_0x36e5('0x32')][_0x36e5('0x35')]));_0x4b3e47[_0x36e5('0x36')]=_0x4b3e47[_0x36e5('0x36')][_0x36e5('0x37')]?_0x4b3e47['attributes']:_0x114378[_0x36e5('0x30')];if(_0x46caa4[_0x36e5('0x32')][_0x36e5('0x3f')]){_0x4b3e47['include']=[{'all':!![]}];}_0x4b3e47=_[_0x36e5('0x3e')]({},_0x4b3e47,_0x46caa4[_0x36e5('0x45')]);return db[_0x36e5('0x2b')][_0x36e5('0x46')](_0x4b3e47)[_0x36e5('0x26')](handleEntityNotFound(_0x220077,null))[_0x36e5('0x26')](respondWithResult(_0x220077,null))[_0x36e5('0x42')](handleError(_0x220077,null));};exports[_0x36e5('0x47')]=function(_0x148102,_0x1a4f02){return db[_0x36e5('0x2b')][_0x36e5('0x47')](_0x148102['body'],{})['then'](respondWithResult(_0x1a4f02,0xc9))[_0x36e5('0x42')](handleError(_0x1a4f02,null));};exports['update']=function(_0x4950f0,_0x5954c5){if(_0x4950f0[_0x36e5('0x48')]['id']){delete _0x4950f0[_0x36e5('0x48')]['id'];}return db[_0x36e5('0x2b')][_0x36e5('0x46')]({'where':{'id':_0x4950f0[_0x36e5('0x44')]['id']}})[_0x36e5('0x26')](handleEntityNotFound(_0x5954c5,null))[_0x36e5('0x26')](saveUpdates(_0x4950f0[_0x36e5('0x48')],null))[_0x36e5('0x26')](respondWithResult(_0x5954c5,null))[_0x36e5('0x42')](handleError(_0x5954c5,null));};exports[_0x36e5('0x49')]=function(_0x3de579,_0x1742b6){return db[_0x36e5('0x2b')][_0x36e5('0x46')]({'where':{'id':_0x3de579[_0x36e5('0x44')]['id']}})[_0x36e5('0x26')](handleEntityNotFound(_0x1742b6,null))[_0x36e5('0x26')](removeEntity(_0x1742b6,null))[_0x36e5('0x42')](handleError(_0x1742b6,null));};exports[_0x36e5('0x4a')]=function(_0x2126a0,_0x519964){return db['MailTransferReport'][_0x36e5('0x4a')]()[_0x36e5('0x26')](respondWithResult(_0x519964,null))[_0x36e5('0x42')](handleError(_0x519964,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index a14edcc..58fc6d3 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 _0xd0bb=['request-promise','path','../../config/environment','exports','define','MailTransferReport','uniqueid','lodash','util','../../config/logger','moment'];(function(_0x15ea62,_0x7b8ede){var _0x2e3518=function(_0x35e71b){while(--_0x35e71b){_0x15ea62['push'](_0x15ea62['shift']());}};_0x2e3518(++_0x7b8ede);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x812b4,_0x5c732f){_0x812b4=_0x812b4-0x0;var _0x1b1950=_0xd0bb[_0x812b4];return _0x1b1950;};'use strict';var _=require(_0xbd0b('0x0'));var util=require(_0xbd0b('0x1'));var logger=require(_0xbd0b('0x2'))('api');var moment=require(_0xbd0b('0x3'));var BPromise=require('bluebird');var rp=require(_0xbd0b('0x4'));var fs=require('fs');var path=require(_0xbd0b('0x5'));var rimraf=require('rimraf');var config=require(_0xbd0b('0x6'));var attributes=require('./mailTransferReport.attributes');module[_0xbd0b('0x7')]=function(_0x1b2499,_0x158b5c){return _0x1b2499[_0xbd0b('0x8')](_0xbd0b('0x9'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0xbd0b('0xa'),'fields':[_0xbd0b('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaeaf=['define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailTransferReport.attributes','exports'];(function(_0x3c36c1,_0x21e0d0){var _0x4b2a3a=function(_0x325cab){while(--_0x325cab){_0x3c36c1['push'](_0x3c36c1['shift']());}};_0x4b2a3a(++_0x21e0d0);}(_0xaeaf,0x14e));var _0xfaea=function(_0x4ba380,_0x259bee){_0x4ba380=_0x4ba380-0x0;var _0x4b111b=_0xaeaf[_0x4ba380];return _0x4b111b;};'use strict';var _=require(_0xfaea('0x0'));var util=require(_0xfaea('0x1'));var logger=require(_0xfaea('0x2'))(_0xfaea('0x3'));var moment=require(_0xfaea('0x4'));var BPromise=require(_0xfaea('0x5'));var rp=require(_0xfaea('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfaea('0x7'));var config=require(_0xfaea('0x8'));var attributes=require(_0xfaea('0x9'));module[_0xfaea('0xa')]=function(_0x4b2303,_0x30cfb6){return _0x4b2303[_0xfaea('0xb')](_0xfaea('0xc'),attributes,{'tableName':_0xfaea('0xd'),'paranoid':![],'indexes':[{'name':_0xfaea('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index f4933b3..90f5c08 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 _0x53e6=['request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','MailTransferReport,\x20%s,\x20%s'];(function(_0x58e302,_0x1bb64a){var _0x17306b=function(_0x1ccc63){while(--_0x1ccc63){_0x58e302['push'](_0x58e302['shift']());}};_0x17306b(++_0x1bb64a);}(_0x53e6,0x149));var _0x653e=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x53e6[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x653e('0x0'));var util=require(_0x653e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x653e('0x2'))['db'];var utils=require(_0x653e('0x3'));var logger=require('../../config/logger')(_0x653e('0x4'));var config=require('../../config/environment');var jayson=require(_0x653e('0x5'));var client=jayson[_0x653e('0x6')][_0x653e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x34b2ef,_0x5587ca,_0x4b576c){return new BPromise(function(_0xe80840,_0x2ea672){return client[_0x653e('0x8')](_0x34b2ef,_0x4b576c)[_0x653e('0x9')](function(_0x26a42e){logger['info'](_0x653e('0xa'),_0x5587ca,_0x653e('0xb'));logger[_0x653e('0xc')](_0x653e('0xd'),_0x5587ca,_0x653e('0xb'),JSON[_0x653e('0xe')](_0x26a42e));if(_0x26a42e[_0x653e('0xf')]){if(_0x26a42e[_0x653e('0xf')][_0x653e('0x10')]===0x1f4){logger[_0x653e('0xf')](_0x653e('0xa'),_0x5587ca,_0x26a42e[_0x653e('0xf')][_0x653e('0x11')]);return _0x2ea672(_0x26a42e['error'][_0x653e('0x11')]);}logger[_0x653e('0xf')](_0x653e('0xa'),_0x5587ca,_0x26a42e[_0x653e('0xf')]['message']);return _0xe80840(_0x26a42e[_0x653e('0xf')][_0x653e('0x11')]);}else{logger[_0x653e('0x12')](_0x653e('0xa'),_0x5587ca,_0x653e('0xb'));_0xe80840(_0x26a42e[_0x653e('0x13')][_0x653e('0x11')]);}})['catch'](function(_0x3bb6cb){logger[_0x653e('0xf')](_0x653e('0xa'),_0x5587ca,_0x3bb6cb);_0x2ea672(_0x3bb6cb);});});} \ No newline at end of file +var _0xb96d=['../../config/logger','../../config/environment','jayson/promise','client','http','request','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x5d6e30,_0xc21d51){var _0x3d3f3b=function(_0x33597b){while(--_0x33597b){_0x5d6e30['push'](_0x5d6e30['shift']());}};_0x3d3f3b(++_0xc21d51);}(_0xb96d,0x94));var _0xdb96=function(_0x5a7e3c,_0xdc9219){_0x5a7e3c=_0x5a7e3c-0x0;var _0x59252b=_0xb96d[_0x5a7e3c];return _0x59252b;};'use strict';var _=require(_0xdb96('0x0'));var util=require(_0xdb96('0x1'));var moment=require('moment');var BPromise=require(_0xdb96('0x2'));var rs=require(_0xdb96('0x3'));var fs=require('fs');var Redis=require(_0xdb96('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdb96('0x5'));var logger=require(_0xdb96('0x6'))('rpc');var config=require(_0xdb96('0x7'));var jayson=require(_0xdb96('0x8'));var client=jayson[_0xdb96('0x9')][_0xdb96('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6d19f5,_0x37f988,_0x4adcd7){return new BPromise(function(_0x19d896,_0x321409){return client[_0xdb96('0xb')](_0x6d19f5,_0x4adcd7)['then'](function(_0x21dce4){logger['info'](_0xdb96('0xc'),_0x37f988,_0xdb96('0xd'));logger[_0xdb96('0xe')](_0xdb96('0xf'),_0x37f988,_0xdb96('0xd'),JSON[_0xdb96('0x10')](_0x21dce4));if(_0x21dce4[_0xdb96('0x11')]){if(_0x21dce4[_0xdb96('0x11')]['code']===0x1f4){logger[_0xdb96('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x37f988,_0x21dce4['error']['message']);return _0x321409(_0x21dce4[_0xdb96('0x11')][_0xdb96('0x12')]);}logger[_0xdb96('0x11')](_0xdb96('0xc'),_0x37f988,_0x21dce4[_0xdb96('0x11')][_0xdb96('0x12')]);return _0x19d896(_0x21dce4[_0xdb96('0x11')][_0xdb96('0x12')]);}else{logger[_0xdb96('0x13')](_0xdb96('0xc'),_0x37f988,_0xdb96('0xd'));_0x19d896(_0x21dce4[_0xdb96('0x14')]['message']);}})[_0xdb96('0x15')](function(_0x558747){logger['error'](_0xdb96('0xc'),_0x37f988,_0x558747);_0x321409(_0x558747);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 757c1c8..73cb0ee 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 _0xd45b=['describe','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe'];(function(_0x27d9cb,_0x1cf70b){var _0x665952=function(_0x26c5b8){while(--_0x26c5b8){_0x27d9cb['push'](_0x27d9cb['shift']());}};_0x665952(++_0x1cf70b);}(_0xd45b,0x196));var _0xbd45=function(_0x2d8fb6,_0x27f115){_0x2d8fb6=_0x2d8fb6-0x0;var _0x16640b=_0xd45b[_0x2d8fb6];return _0x16640b;};'use strict';var multer=require(_0xbd45('0x0'));var util=require(_0xbd45('0x1'));var path=require(_0xbd45('0x2'));var timeout=require(_0xbd45('0x3'));var express=require(_0xbd45('0x4'));var router=express[_0xbd45('0x5')]();var fs_extra=require(_0xbd45('0x6'));var auth=require(_0xbd45('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./memberReport.controller');router[_0xbd45('0x8')]('/',auth[_0xbd45('0x9')](),controller[_0xbd45('0xa')]);router[_0xbd45('0x8')](_0xbd45('0xb'),auth[_0xbd45('0x9')](),controller[_0xbd45('0xc')]);router[_0xbd45('0x8')]('/:id',auth[_0xbd45('0x9')](),controller['show']);router['post']('/',auth[_0xbd45('0x9')](),controller[_0xbd45('0xd')]);router[_0xbd45('0xe')](_0xbd45('0xf'),auth[_0xbd45('0x9')](),controller[_0xbd45('0x10')]);router[_0xbd45('0x11')]('/:id',auth[_0xbd45('0x9')](),controller['destroy']);module[_0xbd45('0x12')]=router; \ No newline at end of file +var _0xebd6=['put','update','delete','destroy','multer','util','Router','../../components/auth/service','./memberReport.controller','isAuthenticated','index','get','/describe','/:id','show','post'];(function(_0x4fb9f2,_0x1c3e06){var _0x534f20=function(_0x569fda){while(--_0x569fda){_0x4fb9f2['push'](_0x4fb9f2['shift']());}};_0x534f20(++_0x1c3e06);}(_0xebd6,0xf4));var _0x6ebd=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0xebd6[_0x20ef64];return _0x3707d8;};'use strict';var multer=require(_0x6ebd('0x0'));var util=require(_0x6ebd('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6ebd('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x6ebd('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6ebd('0x4'));router['get']('/',auth[_0x6ebd('0x5')](),controller[_0x6ebd('0x6')]);router[_0x6ebd('0x7')](_0x6ebd('0x8'),auth[_0x6ebd('0x5')](),controller['describe']);router[_0x6ebd('0x7')](_0x6ebd('0x9'),auth[_0x6ebd('0x5')](),controller[_0x6ebd('0xa')]);router[_0x6ebd('0xb')]('/',auth[_0x6ebd('0x5')](),controller['create']);router[_0x6ebd('0xc')]('/:id',auth[_0x6ebd('0x5')](),controller[_0x6ebd('0xd')]);router[_0x6ebd('0xe')]('/:id',auth[_0x6ebd('0x5')](),controller[_0x6ebd('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 298b418..413db9e 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 _0x536b=['STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue','exitAt','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports'];(function(_0x448c38,_0x1ac4dc){var _0x427f58=function(_0x16ed28){while(--_0x16ed28){_0x448c38['push'](_0x448c38['shift']());}};_0x427f58(++_0x1ac4dc);}(_0x536b,0xc3));var _0xb536=function(_0x201895,_0x2ddf9c){_0x201895=_0x201895-0x0;var _0x42218e=_0x536b[_0x201895];return _0x42218e;};'use strict';var Sequelize=require(_0xb536('0x0'));var moment=require(_0xb536('0x1'));module[_0xb536('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xb536('0x3')]},'interface':{'type':Sequelize[_0xb536('0x3')]},'type':{'type':Sequelize[_0xb536('0x3')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0xb536('0x4')},'duration':{'type':Sequelize[_0xb536('0x5')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xb536('0x6')],'set':function(_0x1ae3ea){var _0x3aa64f=moment(_0x1ae3ea);var _0x22b152=moment(this[_0xb536('0x7')](_0xb536('0x8')));var _0x3d4219=_0x3aa64f[_0xb536('0x9')](_0x22b152,_0xb536('0xa'));this[_0xb536('0xb')](_0xb536('0xc'),_0x1ae3ea);this['setDataValue']('duration',_0x3d4219>=0x0?_0x3d4219:null);}},'data1':{'type':Sequelize[_0xb536('0x3')],'comment':_0xb536('0xd')},'data2':{'type':Sequelize[_0xb536('0x3')],'comment':_0xb536('0xe')},'data3':{'type':Sequelize['STRING'],'comment':_0xb536('0xf')},'data4':{'type':Sequelize[_0xb536('0x3')],'comment':_0xb536('0x10')},'data5':{'type':Sequelize['STRING'],'comment':_0xb536('0x11')},'role':{'type':Sequelize[_0xb536('0x3')]},'internal':{'type':Sequelize[_0xb536('0x5')]},'uniqueid':{'type':Sequelize[_0xb536('0x3')]}}; \ No newline at end of file +var _0xf122=['enterAt','diff','seconds','setDataValue','exitAt','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[queue]','INTEGER','sequelize','moment','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue'];(function(_0x17dc84,_0xef2d92){var _0x4cf7c4=function(_0x2da0c2){while(--_0x2da0c2){_0x17dc84['push'](_0x17dc84['shift']());}};_0x4cf7c4(++_0xef2d92);}(_0xf122,0xa3));var _0x2f12=function(_0x9f9ed5,_0x56f438){_0x9f9ed5=_0x9f9ed5-0x0;var _0xbc71e3=_0xf122[_0x9f9ed5];return _0xbc71e3;};'use strict';var Sequelize=require(_0x2f12('0x0'));var moment=require(_0x2f12('0x1'));module['exports']={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x2f12('0x2')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x2f12('0x2')],'defaultValue':_0x2f12('0x3'),'comment':_0x2f12('0x4')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x2f12('0x5')]},'exitAt':{'type':Sequelize[_0x2f12('0x5')],'set':function(_0x304293){var _0xf311e2=moment(_0x304293);var _0x5db79a=moment(this[_0x2f12('0x6')](_0x2f12('0x7')));var _0x4d50b1=_0xf311e2[_0x2f12('0x8')](_0x5db79a,_0x2f12('0x9'));this[_0x2f12('0xa')](_0x2f12('0xb'),_0x304293);this['setDataValue']('duration',_0x4d50b1>=0x0?_0x4d50b1:null);}},'data1':{'type':Sequelize[_0x2f12('0x2')],'comment':_0x2f12('0xc')},'data2':{'type':Sequelize[_0x2f12('0x2')],'comment':_0x2f12('0xd')},'data3':{'type':Sequelize[_0x2f12('0x2')],'comment':_0x2f12('0xe')},'data4':{'type':Sequelize[_0x2f12('0x2')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x2f12('0x2')],'comment':_0x2f12('0xf')},'role':{'type':Sequelize[_0x2f12('0x2')]},'internal':{'type':Sequelize[_0x2f12('0x10')]},'uniqueid':{'type':Sequelize[_0x2f12('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index ded8e43..5778cd0 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 _0x9957=['util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','MemberReport','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['MemberReport']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['MemberReport'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['MemberReport'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x4ffc8a['params']['id']}})['then'](handleEntityNotFound(_0x19da63,null))['then'](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x4c')]=function(_0x4cf5db,_0x1cd85){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x26')](respondWithResult(_0x1cd85,null))[_0x7995('0x49')](handleError(_0x1cd85,null));}; \ No newline at end of file +var _0x7217=['query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','filter','includeAll','include','rows','catch','show','params','rawAttributes','length','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','send','index','map','MemberReport','fieldName','type','model','name','keys'];(function(_0x170b20,_0x13bbc0){var _0x4f55f9=function(_0x3363db){while(--_0x3363db){_0x170b20['push'](_0x170b20['shift']());}};_0x4f55f9(++_0x13bbc0);}(_0x7217,0x19e));var _0x7721=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0x7217[_0x18a79d];return _0x4f8848;};'use strict';var emlformat=require(_0x7721('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7721('0x1'));var jsonpatch=require(_0x7721('0x2'));var rp=require(_0x7721('0x3'));var moment=require(_0x7721('0x4'));var BPromise=require(_0x7721('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7721('0x6'));var sox=require(_0x7721('0x7'));var csv=require(_0x7721('0x8'));var ejs=require(_0x7721('0x9'));var fs=require('fs');var fs_extra=require(_0x7721('0xa'));var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x8'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var licenseUtil=require(_0x7721('0x1a'));var db=require(_0x7721('0x1b'))['db'];function respondWithStatusCode(_0x55b4ca,_0x2911ec){_0x2911ec=_0x2911ec||0xcc;return function(_0x199930){if(_0x199930){return _0x55b4ca['sendStatus'](_0x2911ec);}return _0x55b4ca[_0x7721('0x1c')](_0x2911ec)[_0x7721('0x1d')]();};}function respondWithResult(_0x3f01c5,_0x2e9752){_0x2e9752=_0x2e9752||0xc8;return function(_0x5069da){if(_0x5069da){return _0x3f01c5[_0x7721('0x1c')](_0x2e9752)[_0x7721('0x1e')](_0x5069da);}};}function respondWithFilteredResult(_0x534f1b,_0x4e199a){return function(_0x4b183e){if(_0x4b183e){var _0x5ed54=typeof _0x4e199a[_0x7721('0x1f')]===_0x7721('0x20')&&typeof _0x4e199a[_0x7721('0x21')]==='undefined';var _0x20f669=_0x4b183e['count'];var _0x3fc09e=_0x5ed54?0x0:_0x4e199a['offset'];var _0xfec626=_0x5ed54?_0x4b183e[_0x7721('0x22')]:_0x4e199a[_0x7721('0x1f')]+_0x4e199a[_0x7721('0x21')];var _0x2286e5;if(_0xfec626>=_0x20f669){_0xfec626=_0x20f669;_0x2286e5=0xc8;}else{_0x2286e5=0xce;}_0x534f1b[_0x7721('0x1c')](_0x2286e5);return _0x534f1b[_0x7721('0x23')](_0x7721('0x24'),_0x3fc09e+'-'+_0xfec626+'/'+_0x20f669)[_0x7721('0x1e')](_0x4b183e);}return null;};}function patchUpdates(_0xaeccc4){return function(_0x4ce1db){try{jsonpatch[_0x7721('0x25')](_0x4ce1db,_0xaeccc4,!![]);}catch(_0x2c1583){return BPromise[_0x7721('0x26')](_0x2c1583);}return _0x4ce1db[_0x7721('0x27')]();};}function saveUpdates(_0x57140c,_0x28f5a6){return function(_0x512f31){if(_0x512f31){return _0x512f31[_0x7721('0x28')](_0x57140c)[_0x7721('0x29')](function(_0x3e8a4e){return _0x3e8a4e;});}return null;};}function removeEntity(_0x1caad8,_0x121cc4){return function(_0x395b15){if(_0x395b15){return _0x395b15[_0x7721('0x2a')]()['then'](function(){_0x1caad8[_0x7721('0x1c')](0xcc)[_0x7721('0x1d')]();});}};}function handleEntityNotFound(_0x125564,_0x1f67c7){return function(_0x40d550){if(!_0x40d550){_0x125564[_0x7721('0x2b')](0x194);}return _0x40d550;};}function handleError(_0x424e05,_0xf753f1){_0xf753f1=_0xf753f1||0x1f4;return function(_0x40f367){logger['error'](_0x40f367[_0x7721('0x2c')]);if(_0x40f367['name']){delete _0x40f367['name'];}_0x424e05[_0x7721('0x1c')](_0xf753f1)[_0x7721('0x2d')](_0x40f367);};}exports[_0x7721('0x2e')]=function(_0x158d98,_0x1ea4d){var _0x37b9f0={},_0xd7d703={},_0x1da2d8={'count':0x0,'rows':[]};var _0x5c54f0=_[_0x7721('0x2f')](db[_0x7721('0x30')]['rawAttributes'],function(_0x4a25c9){return{'name':_0x4a25c9[_0x7721('0x31')],'type':_0x4a25c9[_0x7721('0x32')]['key']};});_0xd7d703[_0x7721('0x33')]=_[_0x7721('0x2f')](_0x5c54f0,_0x7721('0x34'));_0xd7d703['query']=_[_0x7721('0x35')](_0x158d98[_0x7721('0x36')]);_0xd7d703[_0x7721('0x37')]=_[_0x7721('0x38')](_0xd7d703[_0x7721('0x33')],_0xd7d703['query']);_0x37b9f0[_0x7721('0x39')]=_[_0x7721('0x38')](_0xd7d703[_0x7721('0x33')],qs['fields'](_0x158d98[_0x7721('0x36')][_0x7721('0x3a')]));_0x37b9f0['attributes']=_0x37b9f0[_0x7721('0x39')]['length']?_0x37b9f0[_0x7721('0x39')]:_0xd7d703[_0x7721('0x33')];if(!_0x158d98[_0x7721('0x36')][_0x7721('0x3b')](_0x7721('0x3c'))){_0x37b9f0[_0x7721('0x21')]=qs[_0x7721('0x21')](_0x158d98[_0x7721('0x36')][_0x7721('0x21')]);_0x37b9f0[_0x7721('0x1f')]=qs[_0x7721('0x1f')](_0x158d98['query'][_0x7721('0x1f')]);}_0x37b9f0['order']=qs[_0x7721('0x3d')](_0x158d98[_0x7721('0x36')][_0x7721('0x3d')]);_0x37b9f0[_0x7721('0x3e')]=qs[_0x7721('0x37')](_[_0x7721('0x3f')](_0x158d98['query'],_0xd7d703['filters']),_0x5c54f0);if(_0x158d98['query']['filter']){_0x37b9f0[_0x7721('0x3e')]=_[_0x7721('0x40')](_0x37b9f0[_0x7721('0x3e')],{'$or':_[_0x7721('0x2f')](_0x5c54f0,function(_0x4a90ce){if(_0x4a90ce[_0x7721('0x32')]!=='VIRTUAL'){var _0xfab37b={};_0xfab37b[_0x4a90ce[_0x7721('0x34')]]={'$like':'%'+_0x158d98['query'][_0x7721('0x41')]+'%'};return _0xfab37b;}})});}_0x37b9f0=_[_0x7721('0x40')]({},_0x37b9f0,_0x158d98['options']);var _0x4d0111={'where':_0x37b9f0[_0x7721('0x3e')]};return db[_0x7721('0x30')][_0x7721('0x22')](_0x4d0111)[_0x7721('0x29')](function(_0x577af9){_0x1da2d8[_0x7721('0x22')]=_0x577af9;if(_0x158d98[_0x7721('0x36')][_0x7721('0x42')]){_0x37b9f0[_0x7721('0x43')]=[{'all':!![]}];}return db[_0x7721('0x30')]['findAll'](_0x37b9f0);})[_0x7721('0x29')](function(_0x4a2c28){_0x1da2d8[_0x7721('0x44')]=_0x4a2c28;return _0x1da2d8;})['then'](respondWithFilteredResult(_0x1ea4d,_0x37b9f0))[_0x7721('0x45')](handleError(_0x1ea4d,null));};exports[_0x7721('0x46')]=function(_0x231dad,_0x49e0c5){var _0x1453d4={'raw':!![],'where':{'id':_0x231dad[_0x7721('0x47')]['id']}},_0x11d853={};_0x11d853['model']=_[_0x7721('0x35')](db[_0x7721('0x30')][_0x7721('0x48')]);_0x11d853[_0x7721('0x36')]=_[_0x7721('0x35')](_0x231dad[_0x7721('0x36')]);_0x11d853[_0x7721('0x37')]=_['intersection'](_0x11d853['model'],_0x11d853[_0x7721('0x36')]);_0x1453d4[_0x7721('0x39')]=_[_0x7721('0x38')](_0x11d853[_0x7721('0x33')],qs[_0x7721('0x3a')](_0x231dad[_0x7721('0x36')][_0x7721('0x3a')]));_0x1453d4[_0x7721('0x39')]=_0x1453d4[_0x7721('0x39')][_0x7721('0x49')]?_0x1453d4['attributes']:_0x11d853['model'];if(_0x231dad[_0x7721('0x36')][_0x7721('0x42')]){_0x1453d4[_0x7721('0x43')]=[{'all':!![]}];}_0x1453d4=_[_0x7721('0x40')]({},_0x1453d4,_0x231dad['options']);return db[_0x7721('0x30')][_0x7721('0x4a')](_0x1453d4)['then'](handleEntityNotFound(_0x49e0c5,null))[_0x7721('0x29')](respondWithResult(_0x49e0c5,null))['catch'](handleError(_0x49e0c5,null));};exports[_0x7721('0x4b')]=function(_0x5c6922,_0x334f23){return db[_0x7721('0x30')][_0x7721('0x4b')](_0x5c6922['body'],{})[_0x7721('0x29')](respondWithResult(_0x334f23,0xc9))[_0x7721('0x45')](handleError(_0x334f23,null));};exports['update']=function(_0x223d93,_0x1196c2){if(_0x223d93[_0x7721('0x4c')]['id']){delete _0x223d93['body']['id'];}return db[_0x7721('0x30')]['find']({'where':{'id':_0x223d93[_0x7721('0x47')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x1196c2,null))[_0x7721('0x29')](saveUpdates(_0x223d93[_0x7721('0x4c')],null))[_0x7721('0x29')](respondWithResult(_0x1196c2,null))[_0x7721('0x45')](handleError(_0x1196c2,null));};exports[_0x7721('0x2a')]=function(_0x7fbb73,_0x694d2f){return db[_0x7721('0x30')][_0x7721('0x4a')]({'where':{'id':_0x7fbb73[_0x7721('0x47')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x694d2f,null))[_0x7721('0x29')](removeEntity(_0x694d2f,null))[_0x7721('0x45')](handleError(_0x694d2f,null));};exports['describe']=function(_0x474f32,_0x2f6f30){return db[_0x7721('0x30')][_0x7721('0x4d')]()[_0x7721('0x29')](respondWithResult(_0x2f6f30,null))[_0x7721('0x45')](handleError(_0x2f6f30,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 8530057..abfb861 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 _0x732b=['define','MemberReport','report_member','membername_interface','membername','interface','lodash','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x1b1e0a,_0x427763){var _0x3ca288=function(_0x57d036){while(--_0x57d036){_0x1b1e0a['push'](_0x1b1e0a['shift']());}};_0x3ca288(++_0x427763);}(_0x732b,0xf6));var _0xb732=function(_0x4a850a,_0xb95ef4){_0x4a850a=_0x4a850a-0x0;var _0x19132a=_0x732b[_0x4a850a];return _0x19132a;};'use strict';var _=require(_0xb732('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xb732('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb732('0x2'));var rimraf=require(_0xb732('0x3'));var config=require(_0xb732('0x4'));var attributes=require('./memberReport.attributes');module[_0xb732('0x5')]=function(_0x1be636,_0x1c3668){return _0x1be636[_0xb732('0x6')](_0xb732('0x7'),attributes,{'tableName':_0xb732('0x8'),'paranoid':![],'indexes':[{'name':_0xb732('0x9'),'fields':[_0xb732('0xa'),_0xb732('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3c9f=['api','moment','bluebird','request-promise','path','../../config/environment','./memberReport.attributes','exports','define','report_member','membername_interface','membername','interface','util','../../config/logger'];(function(_0x1e2080,_0x53283b){var _0x260111=function(_0x15da5e){while(--_0x15da5e){_0x1e2080['push'](_0x1e2080['shift']());}};_0x260111(++_0x53283b);}(_0x3c9f,0x148));var _0xf3c9=function(_0x16c45f,_0x21262a){_0x16c45f=_0x16c45f-0x0;var _0x2c1b31=_0x3c9f[_0x16c45f];return _0x2c1b31;};'use strict';var _=require('lodash');var util=require(_0xf3c9('0x0'));var logger=require(_0xf3c9('0x1'))(_0xf3c9('0x2'));var moment=require(_0xf3c9('0x3'));var BPromise=require(_0xf3c9('0x4'));var rp=require(_0xf3c9('0x5'));var fs=require('fs');var path=require(_0xf3c9('0x6'));var rimraf=require('rimraf');var config=require(_0xf3c9('0x7'));var attributes=require(_0xf3c9('0x8'));module[_0xf3c9('0x9')]=function(_0x3e5410,_0x574941){return _0x3e5410[_0xf3c9('0xa')]('MemberReport',attributes,{'tableName':_0xf3c9('0xb'),'paranoid':![],'indexes':[{'name':_0xf3c9('0xc'),'fields':[_0xf3c9('0xd'),_0xf3c9('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index e3b5017..4cdc980 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 _0x13fe=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','MemberReport,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','result','MemberReport','findAll','options','raw','attributes','limit','include','map','model','catch','GetMemberReport','CreateMemberReport','create','debug','update','body','UpdateMemberReport'];(function(_0x2837e0,_0x4b7ca7){var _0x11604c=function(_0x146432){while(--_0x146432){_0x2837e0['push'](_0x2837e0['shift']());}};_0x11604c(++_0x4b7ca7);}(_0x13fe,0x138));var _0xe13f=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x13fe[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0xe13f('0x0'));var util=require(_0xe13f('0x1'));var moment=require(_0xe13f('0x2'));var BPromise=require(_0xe13f('0x3'));var rs=require(_0xe13f('0x4'));var fs=require('fs');var Redis=require(_0xe13f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe13f('0x6'));var logger=require(_0xe13f('0x7'))(_0xe13f('0x8'));var config=require(_0xe13f('0x9'));var jayson=require(_0xe13f('0xa'));var client=jayson[_0xe13f('0xb')][_0xe13f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x594e3b,_0x5c9bee,_0x1b237d){return new BPromise(function(_0x39a413,_0x4e209c){return client['request'](_0x594e3b,_0x1b237d)[_0xe13f('0xd')](function(_0x470c1e){logger['info'](_0xe13f('0xe'),_0x5c9bee,_0xe13f('0xf'));logger['debug']('MemberReport,\x20%s,\x20%s,\x20%s',_0x5c9bee,_0xe13f('0xf'),JSON[_0xe13f('0x10')](_0x470c1e));if(_0x470c1e['error']){if(_0x470c1e['error'][_0xe13f('0x11')]===0x1f4){logger[_0xe13f('0x12')](_0xe13f('0xe'),_0x5c9bee,_0x470c1e[_0xe13f('0x12')][_0xe13f('0x13')]);return _0x4e209c(_0x470c1e['error'][_0xe13f('0x13')]);}logger[_0xe13f('0x12')]('MemberReport,\x20%s,\x20%s',_0x5c9bee,_0x470c1e[_0xe13f('0x12')][_0xe13f('0x13')]);return _0x39a413(_0x470c1e['error'][_0xe13f('0x13')]);}else{logger[_0xe13f('0x14')](_0xe13f('0xe'),_0x5c9bee,_0xe13f('0xf'));_0x39a413(_0x470c1e[_0xe13f('0x15')][_0xe13f('0x13')]);}})['catch'](function(_0x1ae44a){logger['error'](_0xe13f('0xe'),_0x5c9bee,_0x1ae44a);_0x4e209c(_0x1ae44a);});});}exports['GetMemberReport']=function(_0x28770d){var _0x5b01d7=this;return new Promise(function(_0x39852b,_0x3f4c0b){return db[_0xe13f('0x16')][_0xe13f('0x17')]({'raw':_0x28770d[_0xe13f('0x18')]?_0x28770d[_0xe13f('0x18')][_0xe13f('0x19')]===undefined?!![]:![]:!![],'where':_0x28770d[_0xe13f('0x18')]?_0x28770d['options']['where']||null:null,'attributes':_0x28770d[_0xe13f('0x18')]?_0x28770d[_0xe13f('0x18')][_0xe13f('0x1a')]||null:null,'limit':_0x28770d[_0xe13f('0x18')]?_0x28770d[_0xe13f('0x18')][_0xe13f('0x1b')]||null:null,'include':_0x28770d[_0xe13f('0x18')]?_0x28770d['options'][_0xe13f('0x1c')]?_[_0xe13f('0x1d')](_0x28770d[_0xe13f('0x18')][_0xe13f('0x1c')],function(_0x415adf){return{'model':db[_0x415adf[_0xe13f('0x1e')]],'as':_0x415adf['as'],'attributes':_0x415adf['attributes'],'include':_0x415adf[_0xe13f('0x1c')]?_[_0xe13f('0x1d')](_0x415adf[_0xe13f('0x1c')],function(_0x37eff0){return{'model':db[_0x37eff0['model']],'as':_0x37eff0['as'],'attributes':_0x37eff0[_0xe13f('0x1a')],'include':_0x37eff0[_0xe13f('0x1c')]?_['map'](_0x37eff0['include'],function(_0x35d1f0){return{'model':db[_0x35d1f0[_0xe13f('0x1e')]],'as':_0x35d1f0['as'],'attributes':_0x35d1f0[_0xe13f('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe13f('0xd')](function(_0x213480){logger[_0xe13f('0x14')]('GetMemberReport',_0x28770d);logger['debug']('GetMemberReport',_0x28770d,JSON[_0xe13f('0x10')](_0x213480));_0x39852b(_0x213480);})[_0xe13f('0x1f')](function(_0x1bf59c){logger[_0xe13f('0x12')](_0xe13f('0x20'),_0x1bf59c[_0xe13f('0x13')],_0x28770d);_0x3f4c0b(_0x5b01d7[_0xe13f('0x12')](0x1f4,_0x1bf59c[_0xe13f('0x13')]));});});};exports[_0xe13f('0x21')]=function(_0x156cbd){var _0x33a373=this;return new Promise(function(_0x58abe7,_0x3f9cf9){return db[_0xe13f('0x16')][_0xe13f('0x22')](_0x156cbd['body'],{'raw':_0x156cbd['options']?_0x156cbd[_0xe13f('0x18')][_0xe13f('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x4bb32a){logger[_0xe13f('0x14')](_0xe13f('0x21'),_0x156cbd);logger[_0xe13f('0x23')]('CreateMemberReport',_0x156cbd,JSON[_0xe13f('0x10')](_0x4bb32a));_0x58abe7(_0x4bb32a);})[_0xe13f('0x1f')](function(_0x430557){logger[_0xe13f('0x12')](_0xe13f('0x21'),_0x430557[_0xe13f('0x13')],_0x156cbd);_0x3f9cf9(_0x33a373[_0xe13f('0x12')](0x1f4,_0x430557[_0xe13f('0x13')]));});});};exports['UpdateMemberReport']=function(_0x58b1d0){var _0x234b36=this;return new Promise(function(_0x1d696c,_0x525c42){return db[_0xe13f('0x16')][_0xe13f('0x24')](_0x58b1d0[_0xe13f('0x25')],{'raw':_0x58b1d0[_0xe13f('0x18')]?_0x58b1d0[_0xe13f('0x18')][_0xe13f('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58b1d0[_0xe13f('0x18')]?_0x58b1d0['options']['where']||null:null,'attributes':_0x58b1d0[_0xe13f('0x18')]?_0x58b1d0[_0xe13f('0x18')]['attributes']||null:null,'limit':_0x58b1d0['options']?_0x58b1d0['options'][_0xe13f('0x1b')]||null:null})[_0xe13f('0xd')](function(_0x183e2c){logger[_0xe13f('0x14')](_0xe13f('0x26'),_0x58b1d0);logger['debug'](_0xe13f('0x26'),_0x58b1d0,JSON[_0xe13f('0x10')](_0x183e2c));_0x1d696c(_0x183e2c);})[_0xe13f('0x1f')](function(_0x2bda46){logger[_0xe13f('0x12')]('UpdateMemberReport',_0x2bda46[_0xe13f('0x13')],_0x58b1d0);_0x525c42(_0x234b36[_0xe13f('0x12')](0x1f4,_0x2bda46[_0xe13f('0x13')]));});});}; \ No newline at end of file +var _0x187d=['model','create','body','then','CreateMemberReport','UpdateMemberReport','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetMemberReport','MemberReport','findAll','options','raw','attributes','include'];(function(_0x4c03e9,_0x332e76){var _0x1666ed=function(_0x2d8ec5){while(--_0x2d8ec5){_0x4c03e9['push'](_0x4c03e9['shift']());}};_0x1666ed(++_0x332e76);}(_0x187d,0x93));var _0xd187=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x187d[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var moment=require(_0xd187('0x1'));var BPromise=require(_0xd187('0x2'));var rs=require(_0xd187('0x3'));var fs=require('fs');var Redis=require(_0xd187('0x4'));var db=require(_0xd187('0x5'))['db'];var utils=require(_0xd187('0x6'));var logger=require('../../config/logger')(_0xd187('0x7'));var config=require(_0xd187('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd187('0x9')][_0xd187('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x444a60,_0x1d3fe4,_0x28ce2f){return new BPromise(function(_0x2d6992,_0x358c45){return client[_0xd187('0xb')](_0x444a60,_0x28ce2f)['then'](function(_0x342539){logger[_0xd187('0xc')](_0xd187('0xd'),_0x1d3fe4,_0xd187('0xe'));logger[_0xd187('0xf')](_0xd187('0x10'),_0x1d3fe4,'request\x20sent',JSON[_0xd187('0x11')](_0x342539));if(_0x342539[_0xd187('0x12')]){if(_0x342539[_0xd187('0x12')]['code']===0x1f4){logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539[_0xd187('0x12')]['message']);return _0x358c45(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539['error'][_0xd187('0x13')]);return _0x2d6992(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}else{logger[_0xd187('0xc')]('MemberReport,\x20%s,\x20%s',_0x1d3fe4,_0xd187('0xe'));_0x2d6992(_0x342539['result']['message']);}})[_0xd187('0x14')](function(_0x5a4986){logger['error'](_0xd187('0xd'),_0x1d3fe4,_0x5a4986);_0x358c45(_0x5a4986);});});}exports[_0xd187('0x15')]=function(_0x374fe0){var _0x10d9fd=this;return new Promise(function(_0x21df74,_0x253a7e){return db[_0xd187('0x16')][_0xd187('0x17')]({'raw':_0x374fe0[_0xd187('0x18')]?_0x374fe0[_0xd187('0x18')][_0xd187('0x19')]===undefined?!![]:![]:!![],'where':_0x374fe0[_0xd187('0x18')]?_0x374fe0[_0xd187('0x18')]['where']||null:null,'attributes':_0x374fe0[_0xd187('0x18')]?_0x374fe0[_0xd187('0x18')][_0xd187('0x1a')]||null:null,'limit':_0x374fe0['options']?_0x374fe0['options']['limit']||null:null,'include':_0x374fe0[_0xd187('0x18')]?_0x374fe0[_0xd187('0x18')][_0xd187('0x1b')]?_['map'](_0x374fe0[_0xd187('0x18')]['include'],function(_0x145771){return{'model':db[_0x145771['model']],'as':_0x145771['as'],'attributes':_0x145771[_0xd187('0x1a')],'include':_0x145771['include']?_['map'](_0x145771[_0xd187('0x1b')],function(_0x4d992b){return{'model':db[_0x4d992b[_0xd187('0x1c')]],'as':_0x4d992b['as'],'attributes':_0x4d992b[_0xd187('0x1a')],'include':_0x4d992b['include']?_['map'](_0x4d992b[_0xd187('0x1b')],function(_0xeff822){return{'model':db[_0xeff822[_0xd187('0x1c')]],'as':_0xeff822['as'],'attributes':_0xeff822[_0xd187('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a20ed){logger[_0xd187('0xc')]('GetMemberReport',_0x374fe0);logger[_0xd187('0xf')](_0xd187('0x15'),_0x374fe0,JSON[_0xd187('0x11')](_0x2a20ed));_0x21df74(_0x2a20ed);})['catch'](function(_0x15e2e8){logger['error'](_0xd187('0x15'),_0x15e2e8[_0xd187('0x13')],_0x374fe0);_0x253a7e(_0x10d9fd[_0xd187('0x12')](0x1f4,_0x15e2e8[_0xd187('0x13')]));});});};exports['CreateMemberReport']=function(_0x140e54){var _0xb38778=this;return new Promise(function(_0x5bba10,_0x4cc587){return db[_0xd187('0x16')][_0xd187('0x1d')](_0x140e54[_0xd187('0x1e')],{'raw':_0x140e54[_0xd187('0x18')]?_0x140e54[_0xd187('0x18')][_0xd187('0x19')]===undefined?!![]:![]:!![]})[_0xd187('0x1f')](function(_0x4713df){logger['info'](_0xd187('0x20'),_0x140e54);logger[_0xd187('0xf')](_0xd187('0x20'),_0x140e54,JSON['stringify'](_0x4713df));_0x5bba10(_0x4713df);})[_0xd187('0x14')](function(_0x5393c5){logger[_0xd187('0x12')](_0xd187('0x20'),_0x5393c5[_0xd187('0x13')],_0x140e54);_0x4cc587(_0xb38778['error'](0x1f4,_0x5393c5['message']));});});};exports[_0xd187('0x21')]=function(_0x260549){var _0x549c6a=this;return new Promise(function(_0x4591e0,_0xa54b9e){return db[_0xd187('0x16')]['update'](_0x260549['body'],{'raw':_0x260549[_0xd187('0x18')]?_0x260549[_0xd187('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x260549['options']?_0x260549['options'][_0xd187('0x22')]||null:null,'attributes':_0x260549['options']?_0x260549[_0xd187('0x18')][_0xd187('0x1a')]||null:null,'limit':_0x260549['options']?_0x260549[_0xd187('0x18')]['limit']||null:null})[_0xd187('0x1f')](function(_0x2db36e){logger['info'](_0xd187('0x21'),_0x260549);logger[_0xd187('0xf')]('UpdateMemberReport',_0x260549,JSON[_0xd187('0x11')](_0x2db36e));_0x4591e0(_0x2db36e);})['catch'](function(_0x5f01b7){logger[_0xd187('0x12')](_0xd187('0x21'),_0x5f01b7[_0xd187('0x13')],_0x260549);_0xa54b9e(_0x549c6a[_0xd187('0x12')](0x1f4,_0x5f01b7[_0xd187('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 1b8b1f8..2ef246b 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 _0x446a=['get','index','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./migration.controller'];(function(_0x2fcb41,_0x4372cf){var _0x2db71e=function(_0x18d976){while(--_0x18d976){_0x2fcb41['push'](_0x2fcb41['shift']());}};_0x2db71e(++_0x4372cf);}(_0x446a,0x1a4));var _0xa446=function(_0x44a63b,_0xfda60c){_0x44a63b=_0x44a63b-0x0;var _0x3f63d3=_0x446a[_0x44a63b];return _0x3f63d3;};'use strict';var multer=require(_0xa446('0x0'));var util=require(_0xa446('0x1'));var path=require(_0xa446('0x2'));var timeout=require(_0xa446('0x3'));var express=require(_0xa446('0x4'));var router=express[_0xa446('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa446('0x6'));var config=require(_0xa446('0x7'));var controller=require(_0xa446('0x8'));router[_0xa446('0x9')]('/',controller[_0xa446('0xa')]);module['exports']=router; \ No newline at end of file +var _0x56e7=['index','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x56e7,0x7b));var _0x756e=function(_0x2c6f7c,_0x5de691){_0x2c6f7c=_0x2c6f7c-0x0;var _0x5efaa0=_0x56e7[_0x2c6f7c];return _0x5efaa0;};'use strict';var multer=require('multer');var util=require(_0x756e('0x0'));var path=require(_0x756e('0x1'));var timeout=require('connect-timeout');var express=require(_0x756e('0x2'));var router=express[_0x756e('0x3')]();var fs_extra=require(_0x756e('0x4'));var auth=require(_0x756e('0x5'));var interaction=require(_0x756e('0x6'));var config=require(_0x756e('0x7'));var controller=require(_0x756e('0x8'));router['get']('/',controller[_0x756e('0x9')]);module[_0x756e('0xa')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 13006bd..9490dd8 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 _0x9cc6=['STRING','version','exports'];(function(_0x5eaee8,_0x2d40fa){var _0x50382f=function(_0x3828bb){while(--_0x3828bb){_0x5eaee8['push'](_0x5eaee8['shift']());}};_0x50382f(++_0x2d40fa);}(_0x9cc6,0xbc));var _0x69cc=function(_0x441db3,_0x10f359){_0x441db3=_0x441db3-0x0;var _0x16c05d=_0x9cc6[_0x441db3];return _0x16c05d;};'use strict';var Sequelize=require('sequelize');module[_0x69cc('0x0')]={'version':{'type':Sequelize[_0x69cc('0x1')],'unique':_0x69cc('0x2')}}; \ No newline at end of file +var _0xd0e3=['sequelize','exports','version'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0xd0e3,0x108));var _0x3d0e=function(_0x4d3170,_0x5aac01){_0x4d3170=_0x4d3170-0x0;var _0x30f1e9=_0xd0e3[_0x4d3170];return _0x30f1e9;};'use strict';var Sequelize=require(_0x3d0e('0x0'));module[_0x3d0e('0x1')]={'version':{'type':Sequelize['STRING'],'unique':_0x3d0e('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 969ff55..40bb06b 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 _0x4435=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','reject','save','update','destroy','end','error','stack','name','send','index','Migration','rawAttributes','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','where','merge','type','VIRTUAL','filter','options','includeAll','include','rows','then','catch','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis'];(function(_0xabd4d9,_0x674ad3){var _0x13cc28=function(_0x4f2be6){while(--_0x4f2be6){_0xabd4d9['push'](_0xabd4d9['shift']());}};_0x13cc28(++_0x674ad3);}(_0x4435,0x79));var _0x5443=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x4435[_0x18ab2a];return _0x16dcee;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5443('0x0'));var zipdir=require(_0x5443('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5443('0x2'));var BPromise=require(_0x5443('0x3'));var Mustache=require(_0x5443('0x4'));var util=require(_0x5443('0x5'));var path=require(_0x5443('0x6'));var sox=require('sox');var csv=require(_0x5443('0x7'));var ejs=require(_0x5443('0x8'));var fs=require('fs');var fs_extra=require(_0x5443('0x9'));var _=require(_0x5443('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5443('0xb'));var deskjs=require(_0x5443('0xc'));var toCsv=require(_0x5443('0x7'));var querystring=require(_0x5443('0xd'));var Papa=require('papaparse');var Redis=require(_0x5443('0xe'));var authService=require(_0x5443('0xf'));var qs=require(_0x5443('0x10'));var as=require(_0x5443('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5443('0x12'));var utils=require(_0x5443('0x13'));var config=require(_0x5443('0x14'));var licenseUtil=require(_0x5443('0x15'));var db=require(_0x5443('0x16'))['db'];function respondWithStatusCode(_0x5acb9e,_0x184322){_0x184322=_0x184322||0xcc;return function(_0x27bb10){if(_0x27bb10){return _0x5acb9e[_0x5443('0x17')](_0x184322);}return _0x5acb9e[_0x5443('0x18')](_0x184322)['end']();};}function respondWithResult(_0x202216,_0x3e5df5){_0x3e5df5=_0x3e5df5||0xc8;return function(_0x159ecc){if(_0x159ecc){return _0x202216[_0x5443('0x18')](_0x3e5df5)['json'](_0x159ecc);}};}function respondWithFilteredResult(_0x1d99d9,_0x92dd9c){return function(_0x566d4b){if(_0x566d4b){var _0x457edb=typeof _0x92dd9c[_0x5443('0x19')]===_0x5443('0x1a')&&typeof _0x92dd9c[_0x5443('0x1b')]===_0x5443('0x1a');var _0x4986c9=_0x566d4b[_0x5443('0x1c')];var _0x516fc7=_0x457edb?0x0:_0x92dd9c['offset'];var _0x2d319d=_0x457edb?_0x566d4b[_0x5443('0x1c')]:_0x92dd9c[_0x5443('0x19')]+_0x92dd9c['limit'];var _0x38da09;if(_0x2d319d>=_0x4986c9){_0x2d319d=_0x4986c9;_0x38da09=0xc8;}else{_0x38da09=0xce;}_0x1d99d9[_0x5443('0x18')](_0x38da09);return _0x1d99d9[_0x5443('0x1d')]('Content-Range',_0x516fc7+'-'+_0x2d319d+'/'+_0x4986c9)[_0x5443('0x1e')](_0x566d4b);}return null;};}function patchUpdates(_0x345213){return function(_0x111c38){try{jsonpatch['apply'](_0x111c38,_0x345213,!![]);}catch(_0x5b333f){return BPromise[_0x5443('0x1f')](_0x5b333f);}return _0x111c38[_0x5443('0x20')]();};}function saveUpdates(_0x9be4cb,_0x97d0b0){return function(_0x28cae5){if(_0x28cae5){return _0x28cae5[_0x5443('0x21')](_0x9be4cb)['then'](function(_0x224e9c){return _0x224e9c;});}return null;};}function removeEntity(_0x3b8bef,_0x352de9){return function(_0x119184){if(_0x119184){return _0x119184[_0x5443('0x22')]()['then'](function(){_0x3b8bef[_0x5443('0x18')](0xcc)[_0x5443('0x23')]();});}};}function handleEntityNotFound(_0x39e687,_0x318af7){return function(_0x113fc7){if(!_0x113fc7){_0x39e687[_0x5443('0x17')](0x194);}return _0x113fc7;};}function handleError(_0x96bd3c,_0xfddb87){_0xfddb87=_0xfddb87||0x1f4;return function(_0xf485a){logger[_0x5443('0x24')](_0xf485a[_0x5443('0x25')]);if(_0xf485a[_0x5443('0x26')]){delete _0xf485a['name'];}_0x96bd3c[_0x5443('0x18')](_0xfddb87)[_0x5443('0x27')](_0xf485a);};}exports[_0x5443('0x28')]=function(_0x226e6f,_0x1d60d6){var _0x5c35fe={},_0x4922fd={},_0x347d3e={'count':0x0,'rows':[]};var _0x4188a5=_['map'](db[_0x5443('0x29')][_0x5443('0x2a')],function(_0x347b8f){return{'name':_0x347b8f['fieldName'],'type':_0x347b8f['type'][_0x5443('0x2b')]};});_0x4922fd['model']=_[_0x5443('0x2c')](_0x4188a5,_0x5443('0x26'));_0x4922fd[_0x5443('0x2d')]=_[_0x5443('0x2e')](_0x226e6f[_0x5443('0x2d')]);_0x4922fd['filters']=_[_0x5443('0x2f')](_0x4922fd[_0x5443('0x30')],_0x4922fd[_0x5443('0x2d')]);_0x5c35fe[_0x5443('0x31')]=_[_0x5443('0x2f')](_0x4922fd[_0x5443('0x30')],qs[_0x5443('0x32')](_0x226e6f[_0x5443('0x2d')]['fields']));_0x5c35fe[_0x5443('0x31')]=_0x5c35fe[_0x5443('0x31')][_0x5443('0x33')]?_0x5c35fe[_0x5443('0x31')]:_0x4922fd[_0x5443('0x30')];if(!_0x226e6f[_0x5443('0x2d')][_0x5443('0x34')](_0x5443('0x35'))){_0x5c35fe[_0x5443('0x1b')]=qs['limit'](_0x226e6f[_0x5443('0x2d')]['limit']);_0x5c35fe[_0x5443('0x19')]=qs[_0x5443('0x19')](_0x226e6f[_0x5443('0x2d')]['offset']);}_0x5c35fe[_0x5443('0x36')]=qs[_0x5443('0x37')](_0x226e6f[_0x5443('0x2d')][_0x5443('0x37')]);_0x5c35fe['where']=qs[_0x5443('0x38')](_['pick'](_0x226e6f[_0x5443('0x2d')],_0x4922fd[_0x5443('0x38')]),_0x4188a5);if(_0x226e6f[_0x5443('0x2d')]['filter']){_0x5c35fe[_0x5443('0x39')]=_[_0x5443('0x3a')](_0x5c35fe[_0x5443('0x39')],{'$or':_[_0x5443('0x2c')](_0x4188a5,function(_0x4f871f){if(_0x4f871f[_0x5443('0x3b')]!==_0x5443('0x3c')){var _0x17a2d7={};_0x17a2d7[_0x4f871f['name']]={'$like':'%'+_0x226e6f[_0x5443('0x2d')][_0x5443('0x3d')]+'%'};return _0x17a2d7;}})});}_0x5c35fe=_[_0x5443('0x3a')]({},_0x5c35fe,_0x226e6f[_0x5443('0x3e')]);var _0x2bc1b6={'where':_0x5c35fe[_0x5443('0x39')]};return db[_0x5443('0x29')][_0x5443('0x1c')](_0x2bc1b6)['then'](function(_0x30f60f){_0x347d3e[_0x5443('0x1c')]=_0x30f60f;if(_0x226e6f['query'][_0x5443('0x3f')]){_0x5c35fe[_0x5443('0x40')]=[{'all':!![]}];}return db['Migration']['findAll'](_0x5c35fe);})['then'](function(_0x46246d){_0x347d3e[_0x5443('0x41')]=_0x46246d;return _0x347d3e;})[_0x5443('0x42')](respondWithFilteredResult(_0x1d60d6,_0x5c35fe))[_0x5443('0x43')](handleError(_0x1d60d6,null));}; \ No newline at end of file +var _0xd0f4=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','json','apply','save','update','then','destroy','error','stack','name','send','map','Migration','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','eml-format'];(function(_0x2b0c4a,_0x55329e){var _0x59028d=function(_0x16d31b){while(--_0x16d31b){_0x2b0c4a['push'](_0x2b0c4a['shift']());}};_0x59028d(++_0x55329e);}(_0xd0f4,0x15d));var _0x4d0f=function(_0x400ed9,_0x438edb){_0x400ed9=_0x400ed9-0x0;var _0x998a39=_0xd0f4[_0x400ed9];return _0x998a39;};'use strict';var emlformat=require(_0x4d0f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4d0f('0x1'));var jsonpatch=require(_0x4d0f('0x2'));var rp=require(_0x4d0f('0x3'));var moment=require(_0x4d0f('0x4'));var BPromise=require(_0x4d0f('0x5'));var Mustache=require(_0x4d0f('0x6'));var util=require(_0x4d0f('0x7'));var path=require(_0x4d0f('0x8'));var sox=require(_0x4d0f('0x9'));var csv=require(_0x4d0f('0xa'));var ejs=require(_0x4d0f('0xb'));var fs=require('fs');var fs_extra=require(_0x4d0f('0xc'));var _=require(_0x4d0f('0xd'));var squel=require(_0x4d0f('0xe'));var crypto=require(_0x4d0f('0xf'));var jsforce=require(_0x4d0f('0x10'));var deskjs=require(_0x4d0f('0x11'));var toCsv=require(_0x4d0f('0xa'));var querystring=require(_0x4d0f('0x12'));var Papa=require(_0x4d0f('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4d0f('0x14'));var as=require(_0x4d0f('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4d0f('0x16'))(_0x4d0f('0x17'));var utils=require(_0x4d0f('0x18'));var config=require(_0x4d0f('0x19'));var licenseUtil=require(_0x4d0f('0x1a'));var db=require(_0x4d0f('0x1b'))['db'];function respondWithStatusCode(_0x52f986,_0x418208){_0x418208=_0x418208||0xcc;return function(_0x26dfb4){if(_0x26dfb4){return _0x52f986[_0x4d0f('0x1c')](_0x418208);}return _0x52f986['status'](_0x418208)[_0x4d0f('0x1d')]();};}function respondWithResult(_0xce708d,_0xde9a9d){_0xde9a9d=_0xde9a9d||0xc8;return function(_0x3a5bf2){if(_0x3a5bf2){return _0xce708d[_0x4d0f('0x1e')](_0xde9a9d)['json'](_0x3a5bf2);}};}function respondWithFilteredResult(_0x3d5a3e,_0x4d51b8){return function(_0x1e82b1){if(_0x1e82b1){var _0x4f1652=typeof _0x4d51b8[_0x4d0f('0x1f')]===_0x4d0f('0x20')&&typeof _0x4d51b8[_0x4d0f('0x21')]==='undefined';var _0x56256d=_0x1e82b1[_0x4d0f('0x22')];var _0x5792f4=_0x4f1652?0x0:_0x4d51b8[_0x4d0f('0x1f')];var _0x48ab03=_0x4f1652?_0x1e82b1[_0x4d0f('0x22')]:_0x4d51b8[_0x4d0f('0x1f')]+_0x4d51b8['limit'];var _0x95ea97;if(_0x48ab03>=_0x56256d){_0x48ab03=_0x56256d;_0x95ea97=0xc8;}else{_0x95ea97=0xce;}_0x3d5a3e[_0x4d0f('0x1e')](_0x95ea97);return _0x3d5a3e['set']('Content-Range',_0x5792f4+'-'+_0x48ab03+'/'+_0x56256d)[_0x4d0f('0x23')](_0x1e82b1);}return null;};}function patchUpdates(_0x552883){return function(_0x1e1b64){try{jsonpatch[_0x4d0f('0x24')](_0x1e1b64,_0x552883,!![]);}catch(_0x2412d5){return BPromise['reject'](_0x2412d5);}return _0x1e1b64[_0x4d0f('0x25')]();};}function saveUpdates(_0x2d1c54,_0x29f2fb){return function(_0x3922b1){if(_0x3922b1){return _0x3922b1[_0x4d0f('0x26')](_0x2d1c54)[_0x4d0f('0x27')](function(_0x1a53b2){return _0x1a53b2;});}return null;};}function removeEntity(_0x514969,_0x481134){return function(_0x565cd3){if(_0x565cd3){return _0x565cd3[_0x4d0f('0x28')]()[_0x4d0f('0x27')](function(){_0x514969[_0x4d0f('0x1e')](0xcc)[_0x4d0f('0x1d')]();});}};}function handleEntityNotFound(_0x459e20,_0x1897f0){return function(_0x3e8db2){if(!_0x3e8db2){_0x459e20[_0x4d0f('0x1c')](0x194);}return _0x3e8db2;};}function handleError(_0x360555,_0x5e7813){_0x5e7813=_0x5e7813||0x1f4;return function(_0x206743){logger[_0x4d0f('0x29')](_0x206743[_0x4d0f('0x2a')]);if(_0x206743[_0x4d0f('0x2b')]){delete _0x206743['name'];}_0x360555['status'](_0x5e7813)[_0x4d0f('0x2c')](_0x206743);};}exports['index']=function(_0x5bd26b,_0x22350d){var _0x35f10b={},_0x1a76ab={},_0x32ee97={'count':0x0,'rows':[]};var _0x5092d8=_[_0x4d0f('0x2d')](db[_0x4d0f('0x2e')]['rawAttributes'],function(_0x4d62d1){return{'name':_0x4d62d1[_0x4d0f('0x2f')],'type':_0x4d62d1[_0x4d0f('0x30')][_0x4d0f('0x31')]};});_0x1a76ab[_0x4d0f('0x32')]=_[_0x4d0f('0x2d')](_0x5092d8,_0x4d0f('0x2b'));_0x1a76ab['query']=_[_0x4d0f('0x33')](_0x5bd26b[_0x4d0f('0x34')]);_0x1a76ab[_0x4d0f('0x35')]=_[_0x4d0f('0x36')](_0x1a76ab[_0x4d0f('0x32')],_0x1a76ab[_0x4d0f('0x34')]);_0x35f10b[_0x4d0f('0x37')]=_[_0x4d0f('0x36')](_0x1a76ab[_0x4d0f('0x32')],qs[_0x4d0f('0x38')](_0x5bd26b[_0x4d0f('0x34')][_0x4d0f('0x38')]));_0x35f10b[_0x4d0f('0x37')]=_0x35f10b[_0x4d0f('0x37')][_0x4d0f('0x39')]?_0x35f10b[_0x4d0f('0x37')]:_0x1a76ab['model'];if(!_0x5bd26b['query'][_0x4d0f('0x3a')](_0x4d0f('0x3b'))){_0x35f10b['limit']=qs[_0x4d0f('0x21')](_0x5bd26b[_0x4d0f('0x34')][_0x4d0f('0x21')]);_0x35f10b['offset']=qs[_0x4d0f('0x1f')](_0x5bd26b['query'][_0x4d0f('0x1f')]);}_0x35f10b['order']=qs['sort'](_0x5bd26b[_0x4d0f('0x34')][_0x4d0f('0x3c')]);_0x35f10b[_0x4d0f('0x3d')]=qs['filters'](_[_0x4d0f('0x3e')](_0x5bd26b['query'],_0x1a76ab[_0x4d0f('0x35')]),_0x5092d8);if(_0x5bd26b[_0x4d0f('0x34')][_0x4d0f('0x3f')]){_0x35f10b[_0x4d0f('0x3d')]=_['merge'](_0x35f10b[_0x4d0f('0x3d')],{'$or':_[_0x4d0f('0x2d')](_0x5092d8,function(_0x518b45){if(_0x518b45['type']!==_0x4d0f('0x40')){var _0x197cb6={};_0x197cb6[_0x518b45['name']]={'$like':'%'+_0x5bd26b[_0x4d0f('0x34')][_0x4d0f('0x3f')]+'%'};return _0x197cb6;}})});}_0x35f10b=_[_0x4d0f('0x41')]({},_0x35f10b,_0x5bd26b[_0x4d0f('0x42')]);var _0xbd1559={'where':_0x35f10b[_0x4d0f('0x3d')]};return db[_0x4d0f('0x2e')][_0x4d0f('0x22')](_0xbd1559)[_0x4d0f('0x27')](function(_0x429ec1){_0x32ee97[_0x4d0f('0x22')]=_0x429ec1;if(_0x5bd26b[_0x4d0f('0x34')][_0x4d0f('0x43')]){_0x35f10b[_0x4d0f('0x44')]=[{'all':!![]}];}return db[_0x4d0f('0x2e')][_0x4d0f('0x45')](_0x35f10b);})[_0x4d0f('0x27')](function(_0x537209){_0x32ee97['rows']=_0x537209;return _0x32ee97;})[_0x4d0f('0x27')](respondWithFilteredResult(_0x22350d,_0x35f10b))['catch'](handleError(_0x22350d,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 9a5de41..8391067 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 _0x8edd=['./migration.attributes','exports','define','Migration','migrations','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x579df3,_0x1483d2){var _0x56bf6f=function(_0x212501){while(--_0x212501){_0x579df3['push'](_0x579df3['shift']());}};_0x56bf6f(++_0x1483d2);}(_0x8edd,0x139));var _0xd8ed=function(_0x2c1e96,_0x2f8685){_0x2c1e96=_0x2c1e96-0x0;var _0x2c488d=_0x8edd[_0x2c1e96];return _0x2c488d;};'use strict';var _=require('lodash');var util=require(_0xd8ed('0x0'));var logger=require(_0xd8ed('0x1'))(_0xd8ed('0x2'));var moment=require(_0xd8ed('0x3'));var BPromise=require(_0xd8ed('0x4'));var rp=require(_0xd8ed('0x5'));var fs=require('fs');var path=require(_0xd8ed('0x6'));var rimraf=require(_0xd8ed('0x7'));var config=require(_0xd8ed('0x8'));var attributes=require(_0xd8ed('0x9'));module[_0xd8ed('0xa')]=function(_0x133df3,_0x5a2490){return _0x133df3[_0xd8ed('0xb')](_0xd8ed('0xc'),attributes,{'tableName':_0xd8ed('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x003a=['util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./migration.attributes','exports','define','Migration','migrations','lodash'];(function(_0x36bad3,_0x3cc324){var _0x3d6f23=function(_0x5d0190){while(--_0x5d0190){_0x36bad3['push'](_0x36bad3['shift']());}};_0x3d6f23(++_0x3cc324);}(_0x003a,0xe9));var _0xa003=function(_0x464f12,_0xd87248){_0x464f12=_0x464f12-0x0;var _0x16330b=_0x003a[_0x464f12];return _0x16330b;};'use strict';var _=require(_0xa003('0x0'));var util=require(_0xa003('0x1'));var logger=require(_0xa003('0x2'))(_0xa003('0x3'));var moment=require('moment');var BPromise=require(_0xa003('0x4'));var rp=require(_0xa003('0x5'));var fs=require('fs');var path=require(_0xa003('0x6'));var rimraf=require('rimraf');var config=require(_0xa003('0x7'));var attributes=require(_0xa003('0x8'));module[_0xa003('0x9')]=function(_0x3bb2c3,_0x52c4eb){return _0x3bb2c3[_0xa003('0xa')](_0xa003('0xb'),attributes,{'tableName':_0xa003('0xc'),'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 06c940b..96cfb6b 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 _0xae60=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','Migration,\x20%s,\x20%s','debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x2aa698,_0x4915d3){var _0x52b199=function(_0x2b49dd){while(--_0x2b49dd){_0x2aa698['push'](_0x2aa698['shift']());}};_0x52b199(++_0x4915d3);}(_0xae60,0x1c7));var _0x0ae6=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0xae60[_0x525c7b];return _0x27b33e;};'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')]('Migration,\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 _0xf72b=['../../config/environment','jayson/promise','client','request','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x31d7c7,_0x2fb0ef){var _0x3920ae=function(_0x19e00c){while(--_0x19e00c){_0x31d7c7['push'](_0x31d7c7['shift']());}};_0x3920ae(++_0x2fb0ef);}(_0xf72b,0x1d9));var _0xbf72=function(_0x552257,_0xc86b66){_0x552257=_0x552257-0x0;var _0x36d4a1=_0xf72b[_0x552257];return _0x36d4a1;};'use strict';var _=require(_0xbf72('0x0'));var util=require('util');var moment=require(_0xbf72('0x1'));var BPromise=require('bluebird');var rs=require(_0xbf72('0x2'));var fs=require('fs');var Redis=require(_0xbf72('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbf72('0x4'));var logger=require(_0xbf72('0x5'))(_0xbf72('0x6'));var config=require(_0xbf72('0x7'));var jayson=require(_0xbf72('0x8'));var client=jayson[_0xbf72('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41c11d,_0xc0842b,_0x119807){return new BPromise(function(_0xd0402c,_0xdd6177){return client[_0xbf72('0xa')](_0x41c11d,_0x119807)['then'](function(_0x455891){logger['info'](_0xbf72('0xb'),_0xc0842b,_0xbf72('0xc'));logger['debug'](_0xbf72('0xd'),_0xc0842b,_0xbf72('0xc'),JSON[_0xbf72('0xe')](_0x455891));if(_0x455891[_0xbf72('0xf')]){if(_0x455891[_0xbf72('0xf')][_0xbf72('0x10')]===0x1f4){logger[_0xbf72('0xf')](_0xbf72('0xb'),_0xc0842b,_0x455891['error'][_0xbf72('0x11')]);return _0xdd6177(_0x455891[_0xbf72('0xf')][_0xbf72('0x11')]);}logger['error'](_0xbf72('0xb'),_0xc0842b,_0x455891['error']['message']);return _0xd0402c(_0x455891['error'][_0xbf72('0x11')]);}else{logger[_0xbf72('0x12')](_0xbf72('0xb'),_0xc0842b,_0xbf72('0xc'));_0xd0402c(_0x455891[_0xbf72('0x13')][_0xbf72('0x11')]);}})['catch'](function(_0x266ce2){logger[_0xbf72('0xf')](_0xbf72('0xb'),_0xc0842b,_0x266ce2);_0xdd6177(_0x266ce2);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 16fcc5f..5dd69ad 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 _0x82e3=['exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./network.controller','index','/:id','isAuthenticated','post','create','put','update','destroy'];(function(_0x373858,_0xd24b55){var _0x375ccb=function(_0x45c49f){while(--_0x45c49f){_0x373858['push'](_0x373858['shift']());}};_0x375ccb(++_0xd24b55);}(_0x82e3,0x1aa));var _0x382e=function(_0x462abc,_0x2e680f){_0x462abc=_0x462abc-0x0;var _0x3ecd2e=_0x82e3[_0x462abc];return _0x3ecd2e;};'use strict';var multer=require(_0x382e('0x0'));var util=require(_0x382e('0x1'));var path=require('path');var timeout=require(_0x382e('0x2'));var express=require(_0x382e('0x3'));var router=express[_0x382e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x382e('0x5'));var interaction=require(_0x382e('0x6'));var config=require('../../config/environment');var controller=require(_0x382e('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x382e('0x8')]);router['get'](_0x382e('0x9'),auth[_0x382e('0xa')](),controller['show']);router[_0x382e('0xb')]('/',auth['isAuthenticated'](),controller[_0x382e('0xc')]);router[_0x382e('0xd')]('/:id',auth[_0x382e('0xa')](),controller[_0x382e('0xe')]);router['delete'](_0x382e('0x9'),auth[_0x382e('0xa')](),controller[_0x382e('0xf')]);module[_0x382e('0x10')]=router; \ No newline at end of file +var _0xc165=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','exports','multer','util','path','connect-timeout','express'];(function(_0x40fbb3,_0x305fe0){var _0x11f8e0=function(_0x558019){while(--_0x558019){_0x40fbb3['push'](_0x40fbb3['shift']());}};_0x11f8e0(++_0x305fe0);}(_0xc165,0x199));var _0x5c16=function(_0x576c1e,_0x49c1d6){_0x576c1e=_0x576c1e-0x0;var _0x33a3c3=_0xc165[_0x576c1e];return _0x33a3c3;};'use strict';var multer=require(_0x5c16('0x0'));var util=require(_0x5c16('0x1'));var path=require(_0x5c16('0x2'));var timeout=require(_0x5c16('0x3'));var express=require(_0x5c16('0x4'));var router=express[_0x5c16('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5c16('0x6'));var interaction=require(_0x5c16('0x7'));var config=require(_0x5c16('0x8'));var controller=require('./network.controller');router[_0x5c16('0x9')]('/',auth[_0x5c16('0xa')](),controller['index']);router[_0x5c16('0x9')](_0x5c16('0xb'),auth[_0x5c16('0xa')](),controller[_0x5c16('0xc')]);router[_0x5c16('0xd')]('/',auth['isAuthenticated'](),controller[_0x5c16('0xe')]);router[_0x5c16('0xf')](_0x5c16('0xb'),auth[_0x5c16('0xa')](),controller[_0x5c16('0x10')]);router['delete'](_0x5c16('0xb'),auth[_0x5c16('0xa')](),controller['destroy']);module[_0x5c16('0x11')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 9072e7a..ab665fb 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 _0x3945=['ENUM','localnet','externip','turn','STRING','sequelize','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3945,0x18d));var _0x5394=function(_0x7f2f1a,_0x2fc8b6){_0x7f2f1a=_0x7f2f1a-0x0;var _0x20641c=_0x3945[_0x7f2f1a];return _0x20641c;};'use strict';var Sequelize=require(_0x5394('0x0'));module[_0x5394('0x1')]={'type':{'type':Sequelize[_0x5394('0x2')](_0x5394('0x3'),_0x5394('0x4'),'stun',_0x5394('0x5'))},'value':{'type':Sequelize[_0x5394('0x6')]},'username':{'type':Sequelize[_0x5394('0x6')]},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x28d5=['ENUM','localnet','stun','STRING','sequelize','exports'];(function(_0x246148,_0x1358ee){var _0x453d94=function(_0x59920e){while(--_0x59920e){_0x246148['push'](_0x246148['shift']());}};_0x453d94(++_0x1358ee);}(_0x28d5,0x1f0));var _0x528d=function(_0x4347ec,_0x41c4b8){_0x4347ec=_0x4347ec-0x0;var _0x4c8314=_0x28d5[_0x4347ec];return _0x4c8314;};'use strict';var Sequelize=require(_0x528d('0x0'));module[_0x528d('0x1')]={'type':{'type':Sequelize[_0x528d('0x2')](_0x528d('0x3'),'externip',_0x528d('0x4'),'turn')},'value':{'type':Sequelize[_0x528d('0x5')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x528d('0x5')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 6c2af4d..b8c698b 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 _0xa947=['error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','destroy','stack','name','send','map','Network','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','includeAll','include','findAll','show','find','create','sequelize','transaction','body','type','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','/etc/asterisk/stun_xcally.conf','Reload','toUpperCase','TURN','server/files/templates/turn_multiple.ejs','writeFileSync','res_stun_monitor.so','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','params','STUN','update','chan_sip.so','/etc/asterisk/turn_xcally.conf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x4fd109,_0x33c503){var _0x30f0a6=function(_0xc11c0d){while(--_0xc11c0d){_0x4fd109['push'](_0x4fd109['shift']());}};_0x30f0a6(++_0x33c503);}(_0xa947,0x11d));var _0x7a94=function(_0xe673c1,_0x273b24){_0xe673c1=_0xe673c1-0x0;var _0xaac380=_0xa947[_0xe673c1];return _0xaac380;};'use strict';var emlformat=require(_0x7a94('0x0'));var rimraf=require(_0x7a94('0x1'));var zipdir=require(_0x7a94('0x2'));var jsonpatch=require(_0x7a94('0x3'));var rp=require(_0x7a94('0x4'));var moment=require(_0x7a94('0x5'));var BPromise=require(_0x7a94('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x7a94('0x7'));var csv=require('to-csv');var ejs=require(_0x7a94('0x8'));var fs=require('fs');var fs_extra=require(_0x7a94('0x9'));var _=require(_0x7a94('0xa'));var squel=require(_0x7a94('0xb'));var crypto=require(_0x7a94('0xc'));var jsforce=require(_0x7a94('0xd'));var deskjs=require(_0x7a94('0xe'));var toCsv=require(_0x7a94('0xf'));var querystring=require(_0x7a94('0x10'));var Papa=require(_0x7a94('0x11'));var Redis=require(_0x7a94('0x12'));var authService=require(_0x7a94('0x13'));var qs=require(_0x7a94('0x14'));var as=require(_0x7a94('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7a94('0x16'))('api');var utils=require(_0x7a94('0x17'));var config=require(_0x7a94('0x18'));var licenseUtil=require(_0x7a94('0x19'));var db=require(_0x7a94('0x1a'))['db'];var jayson=require(_0x7a94('0x1b'));var client=jayson[_0x7a94('0x1c')][_0x7a94('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x370ff0,_0x33b383,_0x8c7646,_0x40110f){return new BPromise(function(_0x4b5d0d,_0x13fbc6){var _0x359cdc=_0x40110f||client;return _0x359cdc['request'](_0x370ff0,_0x8c7646)[_0x7a94('0x1e')](function(_0x77fa94){logger[_0x7a94('0x1f')](_0x7a94('0x20'),_0x33b383,_0x7a94('0x21'));logger[_0x7a94('0x22')]('Network,\x20%s,\x20%s,\x20%s',_0x33b383,_0x7a94('0x21'),JSON[_0x7a94('0x23')](_0x77fa94));if(_0x77fa94[_0x7a94('0x24')]){if(_0x77fa94['error'][_0x7a94('0x25')]===0x1f4){logger['error'](_0x7a94('0x20'),_0x33b383,_0x77fa94[_0x7a94('0x24')][_0x7a94('0x26')]);return _0x13fbc6(_0x77fa94['error'][_0x7a94('0x26')]);}logger['error'](_0x7a94('0x20'),_0x33b383,_0x77fa94['error'][_0x7a94('0x26')]);return _0x4b5d0d(_0x77fa94['error'][_0x7a94('0x26')]);}else{logger['info'](_0x7a94('0x20'),_0x33b383,_0x7a94('0x21'));_0x4b5d0d(_0x77fa94[_0x7a94('0x27')]['message']);}})[_0x7a94('0x28')](function(_0x1ff3e2){logger['error']('Network,\x20%s,\x20%s',_0x33b383,_0x1ff3e2);_0x13fbc6(_0x1ff3e2);});});}function respondWithStatusCode(_0x5b9185,_0x1856d7){_0x1856d7=_0x1856d7||0xcc;return function(_0x49ebe8){if(_0x49ebe8){return _0x5b9185[_0x7a94('0x29')](_0x1856d7);}return _0x5b9185[_0x7a94('0x2a')](_0x1856d7)[_0x7a94('0x2b')]();};}function respondWithResult(_0x51a0cf,_0x2a3982){_0x2a3982=_0x2a3982||0xc8;return function(_0x1b0a74){if(_0x1b0a74){return _0x51a0cf[_0x7a94('0x2a')](_0x2a3982)['json'](_0x1b0a74);}};}function respondWithFilteredResult(_0x4ba9fa,_0x53799c){return function(_0x185e87){if(_0x185e87){var _0xbba672=typeof _0x53799c[_0x7a94('0x2c')]===_0x7a94('0x2d')&&typeof _0x53799c[_0x7a94('0x2e')]===_0x7a94('0x2d');var _0x578603=_0x185e87[_0x7a94('0x2f')];var _0xd2cf6c=_0xbba672?0x0:_0x53799c['offset'];var _0x1b6c47=_0xbba672?_0x185e87[_0x7a94('0x2f')]:_0x53799c['offset']+_0x53799c['limit'];var _0x3c40d6;if(_0x1b6c47>=_0x578603){_0x1b6c47=_0x578603;_0x3c40d6=0xc8;}else{_0x3c40d6=0xce;}_0x4ba9fa['status'](_0x3c40d6);return _0x4ba9fa[_0x7a94('0x30')](_0x7a94('0x31'),_0xd2cf6c+'-'+_0x1b6c47+'/'+_0x578603)['json'](_0x185e87);}return null;};}function patchUpdates(_0x35cd39){return function(_0x2705df){try{jsonpatch[_0x7a94('0x32')](_0x2705df,_0x35cd39,!![]);}catch(_0xe3e1be){return BPromise['reject'](_0xe3e1be);}return _0x2705df['save']();};}function saveUpdates(_0x5e80e6,_0x2ab443){return function(_0x3d79cd){if(_0x3d79cd){return _0x3d79cd['update'](_0x5e80e6)[_0x7a94('0x1e')](function(_0x4dc0c1){return _0x4dc0c1;});}return null;};}function removeEntity(_0x5370c0,_0x3427c7){return function(_0x383028){if(_0x383028){return _0x383028[_0x7a94('0x33')]()[_0x7a94('0x1e')](function(){_0x5370c0['status'](0xcc)[_0x7a94('0x2b')]();});}};}function handleEntityNotFound(_0xd824c,_0xf49959){return function(_0x33ab8b){if(!_0x33ab8b){_0xd824c[_0x7a94('0x29')](0x194);}return _0x33ab8b;};}function handleError(_0x2c3458,_0xe68e18){_0xe68e18=_0xe68e18||0x1f4;return function(_0x279389){logger[_0x7a94('0x24')](_0x279389[_0x7a94('0x34')]);if(_0x279389[_0x7a94('0x35')]){delete _0x279389['name'];}_0x2c3458[_0x7a94('0x2a')](_0xe68e18)[_0x7a94('0x36')](_0x279389);};}exports['index']=function(_0x2a8cbb,_0x460bd4){var _0x346ac5={},_0x2822ae={},_0x5d9c1f={'count':0x0,'rows':[]};var _0x2d2a85=_[_0x7a94('0x37')](db[_0x7a94('0x38')][_0x7a94('0x39')],function(_0x9bac31){return{'name':_0x9bac31[_0x7a94('0x3a')],'type':_0x9bac31['type'][_0x7a94('0x3b')]};});_0x2822ae[_0x7a94('0x3c')]=_[_0x7a94('0x37')](_0x2d2a85,_0x7a94('0x35'));_0x2822ae[_0x7a94('0x3d')]=_[_0x7a94('0x3e')](_0x2a8cbb[_0x7a94('0x3d')]);_0x2822ae['filters']=_[_0x7a94('0x3f')](_0x2822ae[_0x7a94('0x3c')],_0x2822ae[_0x7a94('0x3d')]);_0x346ac5[_0x7a94('0x40')]=_['intersection'](_0x2822ae[_0x7a94('0x3c')],qs[_0x7a94('0x41')](_0x2a8cbb['query'][_0x7a94('0x41')]));_0x346ac5['attributes']=_0x346ac5['attributes'][_0x7a94('0x42')]?_0x346ac5[_0x7a94('0x40')]:_0x2822ae[_0x7a94('0x3c')];if(!_0x2a8cbb[_0x7a94('0x3d')][_0x7a94('0x43')](_0x7a94('0x44'))){_0x346ac5[_0x7a94('0x2e')]=qs['limit'](_0x2a8cbb[_0x7a94('0x3d')]['limit']);_0x346ac5[_0x7a94('0x2c')]=qs[_0x7a94('0x2c')](_0x2a8cbb['query'][_0x7a94('0x2c')]);}_0x346ac5[_0x7a94('0x45')]=qs[_0x7a94('0x46')](_0x2a8cbb[_0x7a94('0x3d')][_0x7a94('0x46')]);_0x346ac5[_0x7a94('0x47')]=qs[_0x7a94('0x48')](_['pick'](_0x2a8cbb[_0x7a94('0x3d')],_0x2822ae[_0x7a94('0x48')]),_0x2d2a85);if(_0x2a8cbb[_0x7a94('0x3d')][_0x7a94('0x49')]){_0x346ac5[_0x7a94('0x47')]=_[_0x7a94('0x4a')](_0x346ac5[_0x7a94('0x47')],{'$or':_['map'](_0x2d2a85,function(_0xd401b1){if(_0xd401b1['type']!=='VIRTUAL'){var _0x188ce4={};_0x188ce4[_0xd401b1['name']]={'$like':'%'+_0x2a8cbb['query'][_0x7a94('0x49')]+'%'};return _0x188ce4;}})});}_0x346ac5=_['merge']({},_0x346ac5,_0x2a8cbb['options']);var _0x3ad69d={'where':_0x346ac5[_0x7a94('0x47')]};return db[_0x7a94('0x38')][_0x7a94('0x2f')](_0x3ad69d)[_0x7a94('0x1e')](function(_0x991711){_0x5d9c1f[_0x7a94('0x2f')]=_0x991711;if(_0x2a8cbb[_0x7a94('0x3d')][_0x7a94('0x4b')]){_0x346ac5[_0x7a94('0x4c')]=[{'all':!![]}];}return db[_0x7a94('0x38')][_0x7a94('0x4d')](_0x346ac5);})[_0x7a94('0x1e')](function(_0x4b414b){_0x5d9c1f['rows']=_0x4b414b;return _0x5d9c1f;})[_0x7a94('0x1e')](respondWithFilteredResult(_0x460bd4,_0x346ac5))['catch'](handleError(_0x460bd4,null));};exports[_0x7a94('0x4e')]=function(_0x1a27c7,_0x18b70b){var _0x20fd9c={'raw':!![],'where':{'id':_0x1a27c7['params']['id']}},_0x360c95={};_0x360c95[_0x7a94('0x3c')]=_[_0x7a94('0x3e')](db[_0x7a94('0x38')]['rawAttributes']);_0x360c95[_0x7a94('0x3d')]=_[_0x7a94('0x3e')](_0x1a27c7[_0x7a94('0x3d')]);_0x360c95[_0x7a94('0x48')]=_['intersection'](_0x360c95['model'],_0x360c95[_0x7a94('0x3d')]);_0x20fd9c[_0x7a94('0x40')]=_[_0x7a94('0x3f')](_0x360c95['model'],qs[_0x7a94('0x41')](_0x1a27c7[_0x7a94('0x3d')][_0x7a94('0x41')]));_0x20fd9c[_0x7a94('0x40')]=_0x20fd9c['attributes'][_0x7a94('0x42')]?_0x20fd9c[_0x7a94('0x40')]:_0x360c95['model'];if(_0x1a27c7[_0x7a94('0x3d')][_0x7a94('0x4b')]){_0x20fd9c[_0x7a94('0x4c')]=[{'all':!![]}];}_0x20fd9c=_[_0x7a94('0x4a')]({},_0x20fd9c,_0x1a27c7['options']);return db[_0x7a94('0x38')][_0x7a94('0x4f')](_0x20fd9c)[_0x7a94('0x1e')](handleEntityNotFound(_0x18b70b,null))[_0x7a94('0x1e')](respondWithResult(_0x18b70b,null))[_0x7a94('0x28')](handleError(_0x18b70b,null));};exports[_0x7a94('0x50')]=function(_0x22c47d,_0x327f3a,_0x539ebc){var _0x4f6e42;return db[_0x7a94('0x51')][_0x7a94('0x52')](function(_0x1657f3){return db['Network'][_0x7a94('0x50')](_0x22c47d['body'],{'raw':!![]})[_0x7a94('0x1e')](function(_0x59dc94){_0x4f6e42=_0x59dc94;return db[_0x7a94('0x38')]['findAll']({'where':{'type':_0x22c47d[_0x7a94('0x53')]['type']},'raw':!![]});})['then'](function(_0x2b4791){if(_0x4f6e42[_0x7a94('0x54')]['toUpperCase']()=='STUN'){var _0x220468=fs[_0x7a94('0x55')](path[_0x7a94('0x56')](config[_0x7a94('0x57')],_0x7a94('0x58')),_0x7a94('0x59'));var _0x547be3=ejs[_0x7a94('0x5a')](_0x220468,{'networks':_0x2b4791||[]});fs['writeFileSync'](_0x7a94('0x5b'),_0x547be3);return respondWithRpcPromise(_0x7a94('0x5c'),_0x7a94('0x50'),{'module':'res_stun_monitor.so'});}else if(_0x4f6e42[_0x7a94('0x54')][_0x7a94('0x5d')]()==_0x7a94('0x5e')){var _0x456a9a=fs['readFileSync'](path[_0x7a94('0x56')](config['root'],_0x7a94('0x5f')),'utf8');var _0x14ffd7=ejs[_0x7a94('0x5a')](_0x456a9a,{'networks':_0x2b4791||[]});fs[_0x7a94('0x60')]('/etc/asterisk/turn_xcally.conf',_0x14ffd7);return respondWithRpcPromise(_0x7a94('0x5c'),_0x7a94('0x50'),{'module':_0x7a94('0x61')});}else{var _0x1e4058=fs[_0x7a94('0x55')](path[_0x7a94('0x56')](config[_0x7a94('0x57')],_0x7a94('0x62')),_0x7a94('0x59'));var _0x1c325f=ejs[_0x7a94('0x5a')](_0x1e4058,{'networks':_0x2b4791||[]});fs[_0x7a94('0x60')](util[_0x7a94('0x63')](_0x7a94('0x64'),_0x22c47d[_0x7a94('0x53')][_0x7a94('0x54')][_0x7a94('0x65')]()),_0x1c325f);return respondWithRpcPromise(_0x7a94('0x5c'),_0x7a94('0x50'),{'module':'chan_sip.so'});}return null;})[_0x7a94('0x1e')](function(){return _0x4f6e42;});})[_0x7a94('0x1e')](respondWithResult(_0x327f3a,0xc9))[_0x7a94('0x28')](handleError(_0x327f3a,null));};exports['update']=function(_0x27e673,_0x26e724,_0x1368db){var _0x279687;return db[_0x7a94('0x51')][_0x7a94('0x52')](function(_0x3b337f){return db[_0x7a94('0x38')][_0x7a94('0x4f')]({'where':{'id':_0x27e673[_0x7a94('0x66')]['id']}})[_0x7a94('0x1e')](handleEntityNotFound(_0x26e724,null))[_0x7a94('0x1e')](saveUpdates(_0x27e673['body'],null))[_0x7a94('0x1e')](function(_0xc5ce14){if(_0xc5ce14){_0x279687=_0xc5ce14;return db[_0x7a94('0x38')][_0x7a94('0x4d')]({'where':{'type':_0x279687[_0x7a94('0x54')]},'raw':!![]});}return null;})[_0x7a94('0x1e')](function(_0x482c5b){if(_0x279687['type']['toUpperCase']()==_0x7a94('0x67')){var _0x1df70e=fs[_0x7a94('0x55')](path[_0x7a94('0x56')](config[_0x7a94('0x57')],_0x7a94('0x58')),'utf8');var _0xe68739=ejs[_0x7a94('0x5a')](_0x1df70e,{'networks':_0x482c5b||[]});fs[_0x7a94('0x60')](_0x7a94('0x5b'),_0xe68739);return respondWithRpcPromise('Reload',_0x7a94('0x68'),{'module':_0x7a94('0x61')});}else if(_0x279687[_0x7a94('0x54')][_0x7a94('0x5d')]()==_0x7a94('0x5e')){var _0x39eff8=fs['readFileSync'](path[_0x7a94('0x56')](config[_0x7a94('0x57')],_0x7a94('0x5f')),_0x7a94('0x59'));var _0x1d94cc=ejs[_0x7a94('0x5a')](_0x39eff8,{'networks':_0x482c5b||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x1d94cc);return respondWithRpcPromise(_0x7a94('0x5c'),_0x7a94('0x68'),{'module':'res_stun_monitor.so'});}else{var _0xa6513f=fs[_0x7a94('0x55')](path['join'](config[_0x7a94('0x57')],_0x7a94('0x62')),'utf8');var _0x275824=ejs[_0x7a94('0x5a')](_0xa6513f,{'networks':_0x482c5b||[]});fs[_0x7a94('0x60')](util[_0x7a94('0x63')](_0x7a94('0x64'),_0x27e673[_0x7a94('0x53')][_0x7a94('0x54')][_0x7a94('0x65')]()),_0x275824);return respondWithRpcPromise(_0x7a94('0x5c'),_0x7a94('0x68'),{'module':_0x7a94('0x69')});}return null;})[_0x7a94('0x1e')](function(_0x98838d){if(_0x98838d){return _0x279687;}return null;});})[_0x7a94('0x1e')](respondWithResult(_0x26e724,null))[_0x7a94('0x28')](handleError(_0x26e724,null));};exports[_0x7a94('0x33')]=function(_0x137306,_0x2882ce,_0x284f51){var _0x40bbcb;return db[_0x7a94('0x38')][_0x7a94('0x4f')]({'where':{'id':_0x137306['params']['id']}})[_0x7a94('0x1e')](function(_0x373be8){_0x40bbcb=_0x373be8;return _0x373be8;})['then'](handleEntityNotFound(_0x2882ce,null))[_0x7a94('0x1e')](removeEntity(_0x2882ce,null))['then'](function(){if(_0x40bbcb){return db[_0x7a94('0x38')][_0x7a94('0x4d')]({'where':{'type':_0x40bbcb[_0x7a94('0x54')]},'raw':!![]});}})['then'](function(_0x4a7094){if(_0x40bbcb[_0x7a94('0x54')][_0x7a94('0x5d')]()==_0x7a94('0x67')){var _0x24e4d4=fs[_0x7a94('0x55')](path[_0x7a94('0x56')](config['root'],_0x7a94('0x58')),_0x7a94('0x59'));var _0x5785ae=ejs['render'](_0x24e4d4,{'networks':_0x4a7094||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x5785ae);return respondWithRpcPromise(_0x7a94('0x5c'),_0x7a94('0x33'),{'module':_0x7a94('0x61')});}else if(_0x40bbcb[_0x7a94('0x54')][_0x7a94('0x5d')]()==_0x7a94('0x5e')){var _0x5bf93c=fs[_0x7a94('0x55')](path[_0x7a94('0x56')](config['root'],_0x7a94('0x5f')),'utf8');var _0x4f2fcc=ejs[_0x7a94('0x5a')](_0x5bf93c,{'networks':_0x4a7094||[]});fs[_0x7a94('0x60')](_0x7a94('0x6a'),_0x4f2fcc);return respondWithRpcPromise(_0x7a94('0x5c'),_0x7a94('0x33'),{'module':'res_stun_monitor.so'});}else{var _0xb0f869=fs[_0x7a94('0x55')](path[_0x7a94('0x56')](config[_0x7a94('0x57')],_0x7a94('0x62')),_0x7a94('0x59'));var _0x1c8840=ejs['render'](_0xb0f869,{'networks':_0x4a7094||[]});fs[_0x7a94('0x60')](util[_0x7a94('0x63')](_0x7a94('0x64'),_0x137306[_0x7a94('0x53')]['type'][_0x7a94('0x65')]()),_0x1c8840);return respondWithRpcPromise(_0x7a94('0x5c'),_0x7a94('0x33'),{'module':_0x7a94('0x69')});}return null;})[_0x7a94('0x28')](handleError(_0x2882ce,null));}; \ No newline at end of file +var _0xe640=['sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','name','send','index','Network','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','options','include','findAll','rows','catch','show','params','keys','create','transaction','body','toUpperCase','readFileSync','root','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','Reload','res_stun_monitor.so','TURN','join','server/files/templates/turn_multiple.ejs','render','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','sequelize','find','STUN','chan_sip.so','/etc/asterisk/stun_xcally.conf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3cdd83,_0x4c9216){var _0x139a73=function(_0x26b975){while(--_0x26b975){_0x3cdd83['push'](_0x3cdd83['shift']());}};_0x139a73(++_0x4c9216);}(_0xe640,0x118));var _0x0e64=function(_0x3b3e27,_0x40e7b0){_0x3b3e27=_0x3b3e27-0x0;var _0x478bbb=_0xe640[_0x3b3e27];return _0x478bbb;};'use strict';var emlformat=require(_0x0e64('0x0'));var rimraf=require(_0x0e64('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0e64('0x2'));var rp=require(_0x0e64('0x3'));var moment=require(_0x0e64('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0e64('0x5'));var util=require('util');var path=require(_0x0e64('0x6'));var sox=require(_0x0e64('0x7'));var csv=require(_0x0e64('0x8'));var ejs=require(_0x0e64('0x9'));var fs=require('fs');var fs_extra=require(_0x0e64('0xa'));var _=require(_0x0e64('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0e64('0xc'));var deskjs=require(_0x0e64('0xd'));var toCsv=require(_0x0e64('0x8'));var querystring=require(_0x0e64('0xe'));var Papa=require(_0x0e64('0xf'));var Redis=require(_0x0e64('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0e64('0x11'));var as=require(_0x0e64('0x12'));var hardwareService=require(_0x0e64('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0e64('0x14'));var db=require(_0x0e64('0x15'))['db'];var jayson=require(_0x0e64('0x16'));var client=jayson[_0x0e64('0x17')][_0x0e64('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x3118e4,_0x463582,_0x44cffe,_0x447962){return new BPromise(function(_0x3aed5a,_0xf15b40){var _0xed1423=_0x447962||client;return _0xed1423[_0x0e64('0x19')](_0x3118e4,_0x44cffe)[_0x0e64('0x1a')](function(_0x46248d){logger[_0x0e64('0x1b')](_0x0e64('0x1c'),_0x463582,_0x0e64('0x1d'));logger['debug'](_0x0e64('0x1e'),_0x463582,_0x0e64('0x1d'),JSON[_0x0e64('0x1f')](_0x46248d));if(_0x46248d[_0x0e64('0x20')]){if(_0x46248d['error'][_0x0e64('0x21')]===0x1f4){logger['error'](_0x0e64('0x1c'),_0x463582,_0x46248d[_0x0e64('0x20')]['message']);return _0xf15b40(_0x46248d[_0x0e64('0x20')]['message']);}logger[_0x0e64('0x20')](_0x0e64('0x1c'),_0x463582,_0x46248d[_0x0e64('0x20')]['message']);return _0x3aed5a(_0x46248d[_0x0e64('0x20')]['message']);}else{logger[_0x0e64('0x1b')](_0x0e64('0x1c'),_0x463582,'request\x20sent');_0x3aed5a(_0x46248d['result'][_0x0e64('0x22')]);}})['catch'](function(_0x87f378){logger[_0x0e64('0x20')](_0x0e64('0x1c'),_0x463582,_0x87f378);_0xf15b40(_0x87f378);});});}function respondWithStatusCode(_0x1c282f,_0x162040){_0x162040=_0x162040||0xcc;return function(_0xfd1b32){if(_0xfd1b32){return _0x1c282f[_0x0e64('0x23')](_0x162040);}return _0x1c282f[_0x0e64('0x24')](_0x162040)[_0x0e64('0x25')]();};}function respondWithResult(_0x37cf2e,_0xef04cb){_0xef04cb=_0xef04cb||0xc8;return function(_0x4a8d51){if(_0x4a8d51){return _0x37cf2e[_0x0e64('0x24')](_0xef04cb)[_0x0e64('0x26')](_0x4a8d51);}};}function respondWithFilteredResult(_0x17e919,_0x5a4cdd){return function(_0x248d63){if(_0x248d63){var _0x1eb11f=typeof _0x5a4cdd[_0x0e64('0x27')]===_0x0e64('0x28')&&typeof _0x5a4cdd[_0x0e64('0x29')]===_0x0e64('0x28');var _0x45e6d8=_0x248d63['count'];var _0x20ed9d=_0x1eb11f?0x0:_0x5a4cdd['offset'];var _0x2fd5e0=_0x1eb11f?_0x248d63[_0x0e64('0x2a')]:_0x5a4cdd['offset']+_0x5a4cdd['limit'];var _0x1eccb6;if(_0x2fd5e0>=_0x45e6d8){_0x2fd5e0=_0x45e6d8;_0x1eccb6=0xc8;}else{_0x1eccb6=0xce;}_0x17e919[_0x0e64('0x24')](_0x1eccb6);return _0x17e919[_0x0e64('0x2b')](_0x0e64('0x2c'),_0x20ed9d+'-'+_0x2fd5e0+'/'+_0x45e6d8)['json'](_0x248d63);}return null;};}function patchUpdates(_0x28c57c){return function(_0x4ef049){try{jsonpatch[_0x0e64('0x2d')](_0x4ef049,_0x28c57c,!![]);}catch(_0x330a48){return BPromise['reject'](_0x330a48);}return _0x4ef049[_0x0e64('0x2e')]();};}function saveUpdates(_0x326f62,_0x2098f4){return function(_0x206313){if(_0x206313){return _0x206313[_0x0e64('0x2f')](_0x326f62)[_0x0e64('0x1a')](function(_0x30a6e0){return _0x30a6e0;});}return null;};}function removeEntity(_0x3157aa,_0x486899){return function(_0x5936e6){if(_0x5936e6){return _0x5936e6[_0x0e64('0x30')]()['then'](function(){_0x3157aa[_0x0e64('0x24')](0xcc)[_0x0e64('0x25')]();});}};}function handleEntityNotFound(_0x1a3d1b,_0x184d2d){return function(_0xe5f7e8){if(!_0xe5f7e8){_0x1a3d1b['sendStatus'](0x194);}return _0xe5f7e8;};}function handleError(_0x294be4,_0x35b30b){_0x35b30b=_0x35b30b||0x1f4;return function(_0x3e0e77){logger[_0x0e64('0x20')](_0x3e0e77['stack']);if(_0x3e0e77[_0x0e64('0x31')]){delete _0x3e0e77[_0x0e64('0x31')];}_0x294be4[_0x0e64('0x24')](_0x35b30b)[_0x0e64('0x32')](_0x3e0e77);};}exports[_0x0e64('0x33')]=function(_0x13394a,_0x51f243){var _0x20c3ef={},_0x50a194={},_0x207642={'count':0x0,'rows':[]};var _0x2a529f=_['map'](db[_0x0e64('0x34')][_0x0e64('0x35')],function(_0x47aa6b){return{'name':_0x47aa6b['fieldName'],'type':_0x47aa6b[_0x0e64('0x36')][_0x0e64('0x37')]};});_0x50a194[_0x0e64('0x38')]=_['map'](_0x2a529f,'name');_0x50a194[_0x0e64('0x39')]=_['keys'](_0x13394a[_0x0e64('0x39')]);_0x50a194[_0x0e64('0x3a')]=_[_0x0e64('0x3b')](_0x50a194[_0x0e64('0x38')],_0x50a194[_0x0e64('0x39')]);_0x20c3ef[_0x0e64('0x3c')]=_['intersection'](_0x50a194[_0x0e64('0x38')],qs[_0x0e64('0x3d')](_0x13394a[_0x0e64('0x39')][_0x0e64('0x3d')]));_0x20c3ef[_0x0e64('0x3c')]=_0x20c3ef[_0x0e64('0x3c')][_0x0e64('0x3e')]?_0x20c3ef[_0x0e64('0x3c')]:_0x50a194['model'];if(!_0x13394a[_0x0e64('0x39')][_0x0e64('0x3f')](_0x0e64('0x40'))){_0x20c3ef[_0x0e64('0x29')]=qs[_0x0e64('0x29')](_0x13394a['query'][_0x0e64('0x29')]);_0x20c3ef[_0x0e64('0x27')]=qs[_0x0e64('0x27')](_0x13394a[_0x0e64('0x39')]['offset']);}_0x20c3ef[_0x0e64('0x41')]=qs[_0x0e64('0x42')](_0x13394a[_0x0e64('0x39')]['sort']);_0x20c3ef['where']=qs['filters'](_[_0x0e64('0x43')](_0x13394a[_0x0e64('0x39')],_0x50a194['filters']),_0x2a529f);if(_0x13394a['query'][_0x0e64('0x44')]){_0x20c3ef[_0x0e64('0x45')]=_[_0x0e64('0x46')](_0x20c3ef[_0x0e64('0x45')],{'$or':_[_0x0e64('0x47')](_0x2a529f,function(_0x4f88af){if(_0x4f88af['type']!=='VIRTUAL'){var _0x16b944={};_0x16b944[_0x4f88af[_0x0e64('0x31')]]={'$like':'%'+_0x13394a[_0x0e64('0x39')][_0x0e64('0x44')]+'%'};return _0x16b944;}})});}_0x20c3ef=_[_0x0e64('0x46')]({},_0x20c3ef,_0x13394a[_0x0e64('0x48')]);var _0x1a30e7={'where':_0x20c3ef['where']};return db[_0x0e64('0x34')][_0x0e64('0x2a')](_0x1a30e7)[_0x0e64('0x1a')](function(_0x3a1bfc){_0x207642['count']=_0x3a1bfc;if(_0x13394a[_0x0e64('0x39')]['includeAll']){_0x20c3ef[_0x0e64('0x49')]=[{'all':!![]}];}return db[_0x0e64('0x34')][_0x0e64('0x4a')](_0x20c3ef);})[_0x0e64('0x1a')](function(_0x48e02f){_0x207642[_0x0e64('0x4b')]=_0x48e02f;return _0x207642;})[_0x0e64('0x1a')](respondWithFilteredResult(_0x51f243,_0x20c3ef))[_0x0e64('0x4c')](handleError(_0x51f243,null));};exports[_0x0e64('0x4d')]=function(_0x391618,_0x46bb89){var _0x5dce08={'raw':!![],'where':{'id':_0x391618[_0x0e64('0x4e')]['id']}},_0x31c077={};_0x31c077[_0x0e64('0x38')]=_[_0x0e64('0x4f')](db[_0x0e64('0x34')][_0x0e64('0x35')]);_0x31c077[_0x0e64('0x39')]=_[_0x0e64('0x4f')](_0x391618[_0x0e64('0x39')]);_0x31c077[_0x0e64('0x3a')]=_['intersection'](_0x31c077[_0x0e64('0x38')],_0x31c077['query']);_0x5dce08[_0x0e64('0x3c')]=_[_0x0e64('0x3b')](_0x31c077['model'],qs['fields'](_0x391618[_0x0e64('0x39')]['fields']));_0x5dce08[_0x0e64('0x3c')]=_0x5dce08[_0x0e64('0x3c')][_0x0e64('0x3e')]?_0x5dce08[_0x0e64('0x3c')]:_0x31c077[_0x0e64('0x38')];if(_0x391618['query']['includeAll']){_0x5dce08[_0x0e64('0x49')]=[{'all':!![]}];}_0x5dce08=_[_0x0e64('0x46')]({},_0x5dce08,_0x391618[_0x0e64('0x48')]);return db['Network']['find'](_0x5dce08)[_0x0e64('0x1a')](handleEntityNotFound(_0x46bb89,null))[_0x0e64('0x1a')](respondWithResult(_0x46bb89,null))[_0x0e64('0x4c')](handleError(_0x46bb89,null));};exports[_0x0e64('0x50')]=function(_0x524c7f,_0x1c4cca,_0x1d5d1b){var _0x546019;return db['sequelize'][_0x0e64('0x51')](function(_0x5bbc8e){return db[_0x0e64('0x34')][_0x0e64('0x50')](_0x524c7f[_0x0e64('0x52')],{'raw':!![]})['then'](function(_0x57fb59){_0x546019=_0x57fb59;return db[_0x0e64('0x34')][_0x0e64('0x4a')]({'where':{'type':_0x524c7f[_0x0e64('0x52')][_0x0e64('0x36')]},'raw':!![]});})[_0x0e64('0x1a')](function(_0x2424b0){if(_0x546019[_0x0e64('0x36')][_0x0e64('0x53')]()=='STUN'){var _0x3d4d41=fs[_0x0e64('0x54')](path['join'](config[_0x0e64('0x55')],_0x0e64('0x56')),_0x0e64('0x57'));var _0x1339df=ejs['render'](_0x3d4d41,{'networks':_0x2424b0||[]});fs[_0x0e64('0x58')]('/etc/asterisk/stun_xcally.conf',_0x1339df);return respondWithRpcPromise(_0x0e64('0x59'),_0x0e64('0x50'),{'module':_0x0e64('0x5a')});}else if(_0x546019[_0x0e64('0x36')][_0x0e64('0x53')]()==_0x0e64('0x5b')){var _0x5a1f82=fs[_0x0e64('0x54')](path[_0x0e64('0x5c')](config[_0x0e64('0x55')],_0x0e64('0x5d')),_0x0e64('0x57'));var _0x56caa2=ejs[_0x0e64('0x5e')](_0x5a1f82,{'networks':_0x2424b0||[]});fs[_0x0e64('0x58')](_0x0e64('0x5f'),_0x56caa2);return respondWithRpcPromise(_0x0e64('0x59'),_0x0e64('0x50'),{'module':_0x0e64('0x5a')});}else{var _0x1dfc26=fs[_0x0e64('0x54')](path[_0x0e64('0x5c')](config['root'],_0x0e64('0x60')),_0x0e64('0x57'));var _0x4d451f=ejs[_0x0e64('0x5e')](_0x1dfc26,{'networks':_0x2424b0||[]});fs[_0x0e64('0x58')](util[_0x0e64('0x61')](_0x0e64('0x62'),_0x524c7f['body']['type'][_0x0e64('0x63')]()),_0x4d451f);return respondWithRpcPromise('Reload',_0x0e64('0x50'),{'module':'chan_sip.so'});}return null;})[_0x0e64('0x1a')](function(){return _0x546019;});})[_0x0e64('0x1a')](respondWithResult(_0x1c4cca,0xc9))['catch'](handleError(_0x1c4cca,null));};exports[_0x0e64('0x2f')]=function(_0x52e0aa,_0xb7f15c,_0x4ca779){var _0x26d10c;return db[_0x0e64('0x64')]['transaction'](function(_0x498471){return db['Network'][_0x0e64('0x65')]({'where':{'id':_0x52e0aa[_0x0e64('0x4e')]['id']}})[_0x0e64('0x1a')](handleEntityNotFound(_0xb7f15c,null))[_0x0e64('0x1a')](saveUpdates(_0x52e0aa[_0x0e64('0x52')],null))[_0x0e64('0x1a')](function(_0x288f37){if(_0x288f37){_0x26d10c=_0x288f37;return db['Network']['findAll']({'where':{'type':_0x26d10c[_0x0e64('0x36')]},'raw':!![]});}return null;})['then'](function(_0x3b1dd5){if(_0x26d10c[_0x0e64('0x36')][_0x0e64('0x53')]()==_0x0e64('0x66')){var _0xb06f37=fs[_0x0e64('0x54')](path[_0x0e64('0x5c')](config[_0x0e64('0x55')],_0x0e64('0x56')),_0x0e64('0x57'));var _0x5d92e8=ejs[_0x0e64('0x5e')](_0xb06f37,{'networks':_0x3b1dd5||[]});fs[_0x0e64('0x58')]('/etc/asterisk/stun_xcally.conf',_0x5d92e8);return respondWithRpcPromise(_0x0e64('0x59'),'update',{'module':_0x0e64('0x5a')});}else if(_0x26d10c[_0x0e64('0x36')][_0x0e64('0x53')]()=='TURN'){var _0x5329ae=fs['readFileSync'](path[_0x0e64('0x5c')](config[_0x0e64('0x55')],_0x0e64('0x5d')),_0x0e64('0x57'));var _0x46a8dc=ejs['render'](_0x5329ae,{'networks':_0x3b1dd5||[]});fs[_0x0e64('0x58')](_0x0e64('0x5f'),_0x46a8dc);return respondWithRpcPromise(_0x0e64('0x59'),_0x0e64('0x2f'),{'module':_0x0e64('0x5a')});}else{var _0x43dd34=fs[_0x0e64('0x54')](path['join'](config[_0x0e64('0x55')],_0x0e64('0x60')),_0x0e64('0x57'));var _0x2f95f2=ejs[_0x0e64('0x5e')](_0x43dd34,{'networks':_0x3b1dd5||[]});fs[_0x0e64('0x58')](util[_0x0e64('0x61')](_0x0e64('0x62'),_0x52e0aa[_0x0e64('0x52')][_0x0e64('0x36')][_0x0e64('0x63')]()),_0x2f95f2);return respondWithRpcPromise('Reload','update',{'module':_0x0e64('0x67')});}return null;})[_0x0e64('0x1a')](function(_0x44e03c){if(_0x44e03c){return _0x26d10c;}return null;});})[_0x0e64('0x1a')](respondWithResult(_0xb7f15c,null))[_0x0e64('0x4c')](handleError(_0xb7f15c,null));};exports[_0x0e64('0x30')]=function(_0x10f3d4,_0x28fed4,_0x2c7e9b){var _0x262345;return db[_0x0e64('0x34')][_0x0e64('0x65')]({'where':{'id':_0x10f3d4['params']['id']}})[_0x0e64('0x1a')](function(_0xfce0b9){_0x262345=_0xfce0b9;return _0xfce0b9;})[_0x0e64('0x1a')](handleEntityNotFound(_0x28fed4,null))[_0x0e64('0x1a')](removeEntity(_0x28fed4,null))[_0x0e64('0x1a')](function(){if(_0x262345){return db[_0x0e64('0x34')][_0x0e64('0x4a')]({'where':{'type':_0x262345[_0x0e64('0x36')]},'raw':!![]});}})['then'](function(_0x3379e1){if(_0x262345['type'][_0x0e64('0x53')]()==_0x0e64('0x66')){var _0x51e825=fs['readFileSync'](path[_0x0e64('0x5c')](config[_0x0e64('0x55')],_0x0e64('0x56')),'utf8');var _0x74585a=ejs[_0x0e64('0x5e')](_0x51e825,{'networks':_0x3379e1||[]});fs[_0x0e64('0x58')](_0x0e64('0x68'),_0x74585a);return respondWithRpcPromise('Reload',_0x0e64('0x30'),{'module':_0x0e64('0x5a')});}else if(_0x262345[_0x0e64('0x36')][_0x0e64('0x53')]()=='TURN'){var _0x37fec0=fs[_0x0e64('0x54')](path[_0x0e64('0x5c')](config[_0x0e64('0x55')],_0x0e64('0x5d')),_0x0e64('0x57'));var _0x3d7531=ejs[_0x0e64('0x5e')](_0x37fec0,{'networks':_0x3379e1||[]});fs[_0x0e64('0x58')](_0x0e64('0x5f'),_0x3d7531);return respondWithRpcPromise(_0x0e64('0x59'),'destroy',{'module':_0x0e64('0x5a')});}else{var _0x5967a2=fs[_0x0e64('0x54')](path[_0x0e64('0x5c')](config[_0x0e64('0x55')],_0x0e64('0x60')),_0x0e64('0x57'));var _0x10811a=ejs['render'](_0x5967a2,{'networks':_0x3379e1||[]});fs[_0x0e64('0x58')](util[_0x0e64('0x61')](_0x0e64('0x62'),_0x10f3d4['body'][_0x0e64('0x36')][_0x0e64('0x63')]()),_0x10811a);return respondWithRpcPromise('Reload',_0x0e64('0x30'),{'module':_0x0e64('0x67')});}return null;})[_0x0e64('0x4c')](handleError(_0x28fed4,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 45a9384..6103aca 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 _0x6308=['bluebird','request-promise','path','rimraf','../../config/environment','define','Network','network','lodash','../../config/logger'];(function(_0x31cb33,_0x597aad){var _0xd3ec79=function(_0x2a2d74){while(--_0x2a2d74){_0x31cb33['push'](_0x31cb33['shift']());}};_0xd3ec79(++_0x597aad);}(_0x6308,0x1f2));var _0x8630=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0x6308[_0x2aa0e7];return _0x1472c0;};'use strict';var _=require(_0x8630('0x0'));var util=require('util');var logger=require(_0x8630('0x1'))('api');var moment=require('moment');var BPromise=require(_0x8630('0x2'));var rp=require(_0x8630('0x3'));var fs=require('fs');var path=require(_0x8630('0x4'));var rimraf=require(_0x8630('0x5'));var config=require(_0x8630('0x6'));var attributes=require('./network.attributes');module['exports']=function(_0x1d62c8,_0x571543){return _0x1d62c8[_0x8630('0x7')](_0x8630('0x8'),attributes,{'tableName':_0x8630('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x54f3=['api','moment','bluebird','rimraf','../../config/environment','./network.attributes','Network','network','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x54f3,0x120));var _0x354f=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x54f3[_0x199572];return _0x13cfa3;};'use strict';var _=require('lodash');var util=require(_0x354f('0x0'));var logger=require(_0x354f('0x1'))(_0x354f('0x2'));var moment=require(_0x354f('0x3'));var BPromise=require(_0x354f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x354f('0x5'));var config=require(_0x354f('0x6'));var attributes=require(_0x354f('0x7'));module['exports']=function(_0x5618ac,_0x234ac6){return _0x5618ac['define'](_0x354f('0x8'),attributes,{'tableName':_0x354f('0x9'),'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 8a32b0b..aa9981d 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7a54,0x106));var _0x47a5=function(_0xf92311,_0x5366c6){_0xf92311=_0xf92311-0x0;var _0x1897fd=_0x7a54[_0xf92311];return _0x1897fd;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x298790,_0x57b368){var _0x2073de=function(_0x3696bc){while(--_0x3696bc){_0x298790['push'](_0x298790['shift']());}};_0x2073de(++_0x57b368);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index eb301a7..2dcd0fe 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 _0x4410=['delete','/:id/canned_answers','removeAnswers','exports','multer','util','path','connect-timeout','express','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','describe','show','/:id/dispositions','getDispositions','/:id/applications','/:id/interactions','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/send','/:id','update'];(function(_0x5c7ec7,_0x41119c){var _0x2d4fbd=function(_0x5ceaae){while(--_0x5ceaae){_0x5c7ec7['push'](_0x5c7ec7['shift']());}};_0x2d4fbd(++_0x41119c);}(_0x4410,0x124));var _0x0441=function(_0x2e0443,_0x7e5974){_0x2e0443=_0x2e0443-0x0;var _0x52d450=_0x4410[_0x2e0443];return _0x52d450;};'use strict';var multer=require(_0x0441('0x0'));var util=require(_0x0441('0x1'));var path=require(_0x0441('0x2'));var timeout=require(_0x0441('0x3'));var express=require(_0x0441('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0441('0x5'));var controller=require(_0x0441('0x6'));router[_0x0441('0x7')]('/',auth[_0x0441('0x8')](),controller[_0x0441('0x9')]);router[_0x0441('0x7')]('/describe',auth[_0x0441('0x8')](),controller[_0x0441('0xa')]);router['get']('/:id',auth[_0x0441('0x8')](),controller[_0x0441('0xb')]);router[_0x0441('0x7')](_0x0441('0xc'),auth[_0x0441('0x8')](),controller[_0x0441('0xd')]);router['get']('/:id/canned_answers',auth[_0x0441('0x8')](),controller['getAnswers']);router[_0x0441('0x7')](_0x0441('0xe'),auth[_0x0441('0x8')](),controller['getApplications']);router[_0x0441('0x7')](_0x0441('0xf'),auth[_0x0441('0x8')](),controller['getInteractions']);router['get'](_0x0441('0x10'),auth[_0x0441('0x8')](),controller[_0x0441('0x11')]);router[_0x0441('0x12')]('/',auth['isAuthenticated'](),controller[_0x0441('0x13')]);router[_0x0441('0x12')]('/:id/dispositions',auth[_0x0441('0x8')](),controller[_0x0441('0x14')]);router[_0x0441('0x12')]('/:id/canned_answers',auth[_0x0441('0x8')](),controller[_0x0441('0x15')]);router[_0x0441('0x12')](_0x0441('0x16'),controller[_0x0441('0x17')]);router[_0x0441('0x12')](_0x0441('0xe'),auth[_0x0441('0x8')](),controller[_0x0441('0x18')]);router[_0x0441('0x12')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x0441('0x12')](_0x0441('0x19'),auth[_0x0441('0x8')](),controller['send']);router['put'](_0x0441('0x1a'),auth[_0x0441('0x8')](),controller[_0x0441('0x1b')]);router['delete'](_0x0441('0x1a'),auth['isAuthenticated'](),controller['destroy']);router[_0x0441('0x1c')]('/:id/dispositions',auth[_0x0441('0x8')](),controller['removeDispositions']);router[_0x0441('0x1c')](_0x0441('0x1d'),auth['isAuthenticated'](),controller[_0x0441('0x1e')]);router[_0x0441('0x1c')](_0x0441('0x10'),auth[_0x0441('0x8')](),controller['removeAgents']);module[_0x0441('0x1f')]=router; \ No newline at end of file +var _0xa9c2=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','describe','get','/:id','show','/:id/canned_answers','getAnswers','/:id/applications','getApplications','getInteractions','/:id/users','getAgents','post','create','addDisposition','/:id/notify','notify','addAgents','/:id/send','update','destroy','/:id/dispositions','removeDispositions','delete'];(function(_0x4709c8,_0x3384ca){var _0x478cdd=function(_0x5193ce){while(--_0x5193ce){_0x4709c8['push'](_0x4709c8['shift']());}};_0x478cdd(++_0x3384ca);}(_0xa9c2,0x1eb));var _0x2a9c=function(_0x169e6e,_0x2ad423){_0x169e6e=_0x169e6e-0x0;var _0x287439=_0xa9c2[_0x169e6e];return _0x287439;};'use strict';var multer=require(_0x2a9c('0x0'));var util=require(_0x2a9c('0x1'));var path=require(_0x2a9c('0x2'));var timeout=require(_0x2a9c('0x3'));var express=require(_0x2a9c('0x4'));var router=express[_0x2a9c('0x5')]();var fs_extra=require(_0x2a9c('0x6'));var auth=require(_0x2a9c('0x7'));var interaction=require(_0x2a9c('0x8'));var config=require(_0x2a9c('0x9'));var controller=require('./openchannelAccount.controller');router['get']('/',auth[_0x2a9c('0xa')](),controller['index']);router['get']('/describe',auth[_0x2a9c('0xa')](),controller[_0x2a9c('0xb')]);router[_0x2a9c('0xc')](_0x2a9c('0xd'),auth['isAuthenticated'](),controller[_0x2a9c('0xe')]);router[_0x2a9c('0xc')]('/:id/dispositions',auth[_0x2a9c('0xa')](),controller['getDispositions']);router['get'](_0x2a9c('0xf'),auth[_0x2a9c('0xa')](),controller[_0x2a9c('0x10')]);router[_0x2a9c('0xc')](_0x2a9c('0x11'),auth[_0x2a9c('0xa')](),controller[_0x2a9c('0x12')]);router[_0x2a9c('0xc')]('/:id/interactions',auth[_0x2a9c('0xa')](),controller[_0x2a9c('0x13')]);router[_0x2a9c('0xc')](_0x2a9c('0x14'),auth[_0x2a9c('0xa')](),controller[_0x2a9c('0x15')]);router[_0x2a9c('0x16')]('/',auth[_0x2a9c('0xa')](),controller[_0x2a9c('0x17')]);router[_0x2a9c('0x16')]('/:id/dispositions',auth[_0x2a9c('0xa')](),controller[_0x2a9c('0x18')]);router[_0x2a9c('0x16')](_0x2a9c('0xf'),auth[_0x2a9c('0xa')](),controller['addAnswer']);router[_0x2a9c('0x16')](_0x2a9c('0x19'),controller[_0x2a9c('0x1a')]);router['post'](_0x2a9c('0x11'),auth[_0x2a9c('0xa')](),controller['addApplications']);router[_0x2a9c('0x16')](_0x2a9c('0x14'),auth['isAuthenticated'](),controller[_0x2a9c('0x1b')]);router[_0x2a9c('0x16')](_0x2a9c('0x1c'),auth[_0x2a9c('0xa')](),controller['send']);router['put'](_0x2a9c('0xd'),auth[_0x2a9c('0xa')](),controller[_0x2a9c('0x1d')]);router['delete'](_0x2a9c('0xd'),auth['isAuthenticated'](),controller[_0x2a9c('0x1e')]);router['delete'](_0x2a9c('0x1f'),auth[_0x2a9c('0xa')](),controller[_0x2a9c('0x20')]);router[_0x2a9c('0x21')]('/:id/canned_answers',auth[_0x2a9c('0xa')](),controller['removeAnswers']);router[_0x2a9c('0x21')](_0x2a9c('0x14'),auth[_0x2a9c('0xa')](),controller['removeAgents']);module[_0x2a9c('0x22')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 4f4dc6c..2fef203 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 _0x0293=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','exports','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x32eba3,_0xc4f4fe){var _0x2e331b=function(_0x3142ca){while(--_0x3142ca){_0x32eba3['push'](_0x32eba3['shift']());}};_0x2e331b(++_0xc4f4fe);}(_0x0293,0x1e3));var _0x3029=function(_0xe45fe1,_0x46f7d9){_0xe45fe1=_0xe45fe1-0x0;var _0x2065ea=_0x0293[_0xe45fe1];return _0x2065ea;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x3029('0x0')]={'name':{'type':Sequelize[_0x3029('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x3029('0x1')]},'token':{'type':Sequelize[_0x3029('0x1')],'defaultValue':function(){return rs[_0x3029('0x2')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x3029('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x3029('0x3')],'defaultValue':function(){return _0x3029('0x4');}},'notificationSound':{'type':Sequelize[_0x3029('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x3029('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3029('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x3029('0x1')]},'queueTransfer':{'type':Sequelize[_0x3029('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3029('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3029('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3029('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3029('0x6')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x3029('0x5')],'defaultValue':![],'comment':_0x3029('0x7'),'set':function(_0x3ec38f){if(!_0x3ec38f)this[_0x3029('0x8')](_0x3029('0x9'),null);this[_0x3029('0x8')]('mandatoryDisposition',_0x3ec38f);}}}; \ No newline at end of file +var _0xe835=['exports','STRING','name','generate','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring'];(function(_0x491637,_0x54024e){var _0x236904=function(_0x420190){while(--_0x420190){_0x491637['push'](_0x491637['shift']());}};_0x236904(++_0x54024e);}(_0xe835,0x1ec));var _0x5e83=function(_0x4bd950,_0x184ed5){_0x4bd950=_0x4bd950-0x0;var _0x5dc59a=_0xe835[_0x4bd950];return _0x5dc59a;};'use strict';var Sequelize=require(_0x5e83('0x0'));var rs=require(_0x5e83('0x1'));module[_0x5e83('0x2')]={'name':{'type':Sequelize[_0x5e83('0x3')],'unique':_0x5e83('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x5e83('0x3')]},'token':{'type':Sequelize[_0x5e83('0x3')],'defaultValue':function(){return rs[_0x5e83('0x5')]();}},'replyUri':{'type':Sequelize[_0x5e83('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x5e83('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x5e83('0x6');}},'notificationSound':{'type':Sequelize[_0x5e83('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5e83('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5e83('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x5e83('0x3')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5e83('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5e83('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5e83('0x8')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x5e83('0x9'),'set':function(_0x27ac63){if(!_0x27ac63)this[_0x5e83('0xa')](_0x5e83('0xb'),null);this[_0x5e83('0xa')](_0x5e83('0xc'),_0x27ac63);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 7e30910..ad0b1a7 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 _0x75fb=['save','update','destroy','get','OpenchannelAccounts','stack','name','index','Pause','mandatoryDispositionPause','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','OpenchannelAccount','findAll','rows','show','rawAttributes','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','Disposition','findOne','order','OpenchannelAccountId','count','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','notify','openchannel','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','from','isNil','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','CmList','List','CmContact','Contacts','DESC','OpenchannelApplication','Applications','account','list','applications','orderBy','priority','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','contact','messageId','interaction','created','autoclose','push','close','unmanaged','OpenchannelMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','send','user','out','Messages','dataValues','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','jayson/promise','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','sendStatus','status','json','offset','undefined','limit','Content-Range','apply'];(function(_0x3f2978,_0x3ef7f2){var _0x13299a=function(_0x235122){while(--_0x235122){_0x3f2978['push'](_0x3f2978['shift']());}};_0x13299a(++_0x3ef7f2);}(_0x75fb,0x142));var _0xb75f=function(_0x598355,_0x34c51){_0x598355=_0x598355-0x0;var _0x1d992f=_0x75fb[_0x598355];return _0x1d992f;};'use strict';var emlformat=require(_0xb75f('0x0'));var rimraf=require(_0xb75f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb75f('0x2'));var BPromise=require(_0xb75f('0x3'));var Mustache=require(_0xb75f('0x4'));var util=require(_0xb75f('0x5'));var path=require(_0xb75f('0x6'));var sox=require(_0xb75f('0x7'));var csv=require(_0xb75f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb75f('0x9'));var _=require(_0xb75f('0xa'));var squel=require(_0xb75f('0xb'));var crypto=require(_0xb75f('0xc'));var jsforce=require(_0xb75f('0xd'));var deskjs=require(_0xb75f('0xe'));var toCsv=require(_0xb75f('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb75f('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb75f('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xb75f('0x11'));var config=require(_0xb75f('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xb75f('0x13'))['db'];config[_0xb75f('0x14')]=_[_0xb75f('0x15')](config['redis'],{'host':_0xb75f('0x16'),'port':0x18eb});var socket=require(_0xb75f('0x17'))(new Redis(config[_0xb75f('0x14')]));require(_0xb75f('0x18'))['register'](socket);var jayson=require(_0xb75f('0x19'));var client=jayson['client'][_0xb75f('0x1a')]({'port':0x232c});var client9002=jayson['client'][_0xb75f('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x5aa14e,_0x5e57f7,_0x2c3cce,_0xebd50c){return new BPromise(function(_0x25e7f4,_0x3dac98){var _0x3ca3d8=_0xebd50c||client;return _0x3ca3d8[_0xb75f('0x1b')](_0x5aa14e,_0x2c3cce)[_0xb75f('0x1c')](function(_0x6f916c){logger[_0xb75f('0x1d')](_0xb75f('0x1e'),_0x5e57f7,_0xb75f('0x1f'));logger['debug'](_0xb75f('0x20'),_0x5e57f7,'request\x20sent',JSON['stringify'](_0x6f916c));if(_0x6f916c['error']){if(_0x6f916c['error'][_0xb75f('0x21')]===0x1f4){logger[_0xb75f('0x22')](_0xb75f('0x1e'),_0x5e57f7,_0x6f916c['error']['message']);return _0x3dac98(_0x6f916c['error'][_0xb75f('0x23')]);}logger[_0xb75f('0x22')](_0xb75f('0x1e'),_0x5e57f7,_0x6f916c[_0xb75f('0x22')][_0xb75f('0x23')]);return _0x25e7f4(_0x6f916c[_0xb75f('0x22')][_0xb75f('0x23')]);}else{logger[_0xb75f('0x1d')]('OpenchannelAccount,\x20%s,\x20%s',_0x5e57f7,_0xb75f('0x1f'));_0x25e7f4(_0x6f916c[_0xb75f('0x24')][_0xb75f('0x23')]);}})[_0xb75f('0x25')](function(_0x2e62fb){logger[_0xb75f('0x22')](_0xb75f('0x1e'),_0x5e57f7,_0x2e62fb);_0x3dac98(_0x2e62fb);});});}function respondWithStatusCode(_0x13e2fb,_0x5f1c63){_0x5f1c63=_0x5f1c63||0xcc;return function(_0x4729c5){if(_0x4729c5){return _0x13e2fb[_0xb75f('0x26')](_0x5f1c63);}return _0x13e2fb[_0xb75f('0x27')](_0x5f1c63)['end']();};}function respondWithResult(_0x262b4b,_0x1e459a){_0x1e459a=_0x1e459a||0xc8;return function(_0x781b1){if(_0x781b1){return _0x262b4b[_0xb75f('0x27')](_0x1e459a)[_0xb75f('0x28')](_0x781b1);}};}function respondWithFilteredResult(_0x37e579,_0x3da0d6){return function(_0x212c62){if(_0x212c62){var _0x4e89ee=typeof _0x3da0d6[_0xb75f('0x29')]===_0xb75f('0x2a')&&typeof _0x3da0d6[_0xb75f('0x2b')]===_0xb75f('0x2a');var _0x4de6e=_0x212c62['count'];var _0x2f6e4e=_0x4e89ee?0x0:_0x3da0d6['offset'];var _0x1cf796=_0x4e89ee?_0x212c62['count']:_0x3da0d6[_0xb75f('0x29')]+_0x3da0d6[_0xb75f('0x2b')];var _0x59c771;if(_0x1cf796>=_0x4de6e){_0x1cf796=_0x4de6e;_0x59c771=0xc8;}else{_0x59c771=0xce;}_0x37e579[_0xb75f('0x27')](_0x59c771);return _0x37e579['set'](_0xb75f('0x2c'),_0x2f6e4e+'-'+_0x1cf796+'/'+_0x4de6e)['json'](_0x212c62);}return null;};}function patchUpdates(_0x158dc7){return function(_0x39d9a1){try{jsonpatch[_0xb75f('0x2d')](_0x39d9a1,_0x158dc7,!![]);}catch(_0x14f455){return BPromise['reject'](_0x14f455);}return _0x39d9a1[_0xb75f('0x2e')]();};}function saveUpdates(_0x597b5d,_0x5321b7){return function(_0x6a2d6f){if(_0x6a2d6f){return _0x6a2d6f[_0xb75f('0x2f')](_0x597b5d)['then'](function(_0x4f0c5c){return _0x4f0c5c;});}return null;};}function removeEntity(_0x27a0b9,_0xfb48cc){return function(_0x3fc7bd){if(_0x3fc7bd){return _0x3fc7bd[_0xb75f('0x30')]()[_0xb75f('0x1c')](function(){var _0x4e6502=_0x3fc7bd[_0xb75f('0x31')]({'plain':!![]});var _0x397c6e=_0xb75f('0x32');return db['UserProfileResource'][_0xb75f('0x30')]({'where':{'type':_0x397c6e,'resourceId':_0x4e6502['id']}})[_0xb75f('0x1c')](function(){return _0x3fc7bd;});})[_0xb75f('0x1c')](function(){_0x27a0b9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x56bb9d,_0x3dbdf4){return function(_0x587a7c){if(!_0x587a7c){_0x56bb9d[_0xb75f('0x26')](0x194);}return _0x587a7c;};}function handleError(_0x3d62f5,_0x832240){_0x832240=_0x832240||0x1f4;return function(_0x1fc092){logger['error'](_0x1fc092[_0xb75f('0x33')]);if(_0x1fc092[_0xb75f('0x34')]){delete _0x1fc092[_0xb75f('0x34')];}_0x3d62f5[_0xb75f('0x27')](_0x832240)['send'](_0x1fc092);};}exports[_0xb75f('0x35')]=function(_0x516546,_0xfd628d){var _0x807136={'include':[{'model':db[_0xb75f('0x36')],'as':_0xb75f('0x37')}]},_0x3c3a37={},_0x43215c={'count':0x0,'rows':[]};var _0x46d1e5=_[_0xb75f('0x38')](db['OpenchannelAccount']['rawAttributes'],function(_0x3bef18){return{'name':_0x3bef18[_0xb75f('0x39')],'type':_0x3bef18[_0xb75f('0x3a')][_0xb75f('0x3b')]};});_0x3c3a37[_0xb75f('0x3c')]=_[_0xb75f('0x38')](_0x46d1e5,_0xb75f('0x34'));_0x3c3a37[_0xb75f('0x3d')]=_[_0xb75f('0x3e')](_0x516546[_0xb75f('0x3d')]);_0x3c3a37[_0xb75f('0x3f')]=_[_0xb75f('0x40')](_0x3c3a37[_0xb75f('0x3c')],_0x3c3a37[_0xb75f('0x3d')]);_0x807136[_0xb75f('0x41')]=_[_0xb75f('0x40')](_0x3c3a37[_0xb75f('0x3c')],qs[_0xb75f('0x42')](_0x516546['query'][_0xb75f('0x42')]));_0x807136[_0xb75f('0x41')]=_0x807136['attributes'][_0xb75f('0x43')]?_0x807136[_0xb75f('0x41')]:_0x3c3a37[_0xb75f('0x3c')];if(!_0x516546[_0xb75f('0x3d')][_0xb75f('0x44')](_0xb75f('0x45'))){_0x807136[_0xb75f('0x2b')]=qs[_0xb75f('0x2b')](_0x516546['query'][_0xb75f('0x2b')]);_0x807136[_0xb75f('0x29')]=qs[_0xb75f('0x29')](_0x516546[_0xb75f('0x3d')][_0xb75f('0x29')]);}_0x807136['order']=qs[_0xb75f('0x46')](_0x516546['query'][_0xb75f('0x46')]);_0x807136['where']=qs[_0xb75f('0x3f')](_[_0xb75f('0x47')](_0x516546['query'],_0x3c3a37[_0xb75f('0x3f')]),_0x46d1e5);if(_0x516546[_0xb75f('0x3d')][_0xb75f('0x48')]){_0x807136[_0xb75f('0x49')]=_[_0xb75f('0x4a')](_0x807136[_0xb75f('0x49')],{'$or':_[_0xb75f('0x38')](_0x46d1e5,function(_0x56592a){if(_0x56592a['type']!==_0xb75f('0x4b')){var _0x484b4e={};_0x484b4e[_0x56592a[_0xb75f('0x34')]]={'$like':'%'+_0x516546[_0xb75f('0x3d')]['filter']+'%'};return _0x484b4e;}})});}_0x807136=_[_0xb75f('0x4a')]({},_0x807136,_0x516546['options']);var _0x1d290f={'where':_0x807136[_0xb75f('0x49')]};return db['OpenchannelAccount']['count'](_0x1d290f)[_0xb75f('0x1c')](function(_0x2b2920){_0x43215c['count']=_0x2b2920;if(_0x516546[_0xb75f('0x3d')][_0xb75f('0x4c')]){_0x807136[_0xb75f('0x4d')]=[{'all':!![]}];}return db[_0xb75f('0x4e')][_0xb75f('0x4f')](_0x807136);})['then'](function(_0x542134){_0x43215c[_0xb75f('0x50')]=_0x542134;return _0x43215c;})[_0xb75f('0x1c')](respondWithFilteredResult(_0xfd628d,_0x807136))[_0xb75f('0x25')](handleError(_0xfd628d,null));};exports[_0xb75f('0x51')]=function(_0x1fbd2c,_0xbb5a83){var _0x5029b5={'raw':![],'where':{'id':_0x1fbd2c['params']['id']},'include':[{'model':db['Pause'],'as':_0xb75f('0x37')}]},_0x443feb={};_0x443feb[_0xb75f('0x3c')]=_['keys'](db['OpenchannelAccount'][_0xb75f('0x52')]);_0x443feb[_0xb75f('0x3d')]=_[_0xb75f('0x3e')](_0x1fbd2c[_0xb75f('0x3d')]);_0x443feb[_0xb75f('0x3f')]=_[_0xb75f('0x40')](_0x443feb[_0xb75f('0x3c')],_0x443feb[_0xb75f('0x3d')]);_0x5029b5[_0xb75f('0x41')]=_[_0xb75f('0x40')](_0x443feb['model'],qs[_0xb75f('0x42')](_0x1fbd2c[_0xb75f('0x3d')][_0xb75f('0x42')]));_0x5029b5[_0xb75f('0x41')]=_0x5029b5[_0xb75f('0x41')]['length']?_0x5029b5[_0xb75f('0x41')]:_0x443feb[_0xb75f('0x3c')];if(_0x1fbd2c['query']['includeAll']){_0x5029b5['include']=[{'all':!![]}];}_0x5029b5=_[_0xb75f('0x4a')]({},_0x5029b5,_0x1fbd2c[_0xb75f('0x53')]);return db[_0xb75f('0x4e')][_0xb75f('0x54')](_0x5029b5)[_0xb75f('0x1c')](handleEntityNotFound(_0xbb5a83,null))[_0xb75f('0x1c')](respondWithResult(_0xbb5a83,null))[_0xb75f('0x25')](handleError(_0xbb5a83,null));};exports[_0xb75f('0x55')]=function(_0x210cb6,_0x52df20){return db['OpenchannelAccount']['create'](_0x210cb6[_0xb75f('0x56')],{})['then'](function(_0x132843){var _0x14be9a=_0x210cb6['user'][_0xb75f('0x31')]({'plain':!![]});if(!_0x14be9a)throw new Error(_0xb75f('0x57'));if(_0x14be9a['role']==='user'){var _0xa69e0c=_0x132843[_0xb75f('0x31')]({'plain':!![]});var _0x323b89=_0xb75f('0x32');return db[_0xb75f('0x58')][_0xb75f('0x54')]({'where':{'name':_0x323b89,'userProfileId':_0x14be9a[_0xb75f('0x59')]},'raw':!![]})['then'](function(_0x571008){if(_0x571008&&_0x571008[_0xb75f('0x5a')]===0x0){return db[_0xb75f('0x5b')][_0xb75f('0x55')]({'name':_0xa69e0c[_0xb75f('0x34')],'resourceId':_0xa69e0c['id'],'type':_0x571008[_0xb75f('0x34')],'sectionId':_0x571008['id']},{})['then'](function(){return _0x132843;});}else{return _0x132843;}})[_0xb75f('0x25')](function(_0x2dbf84){logger[_0xb75f('0x22')](_0xb75f('0x5c'),_0x2dbf84);throw _0x2dbf84;});}return _0x132843;})[_0xb75f('0x1c')](respondWithResult(_0x52df20,0xc9))[_0xb75f('0x25')](handleError(_0x52df20,null));};exports['update']=function(_0x2a975e,_0x3b8c2e){if(_0x2a975e[_0xb75f('0x56')]['id']){delete _0x2a975e[_0xb75f('0x56')]['id'];}return db[_0xb75f('0x4e')][_0xb75f('0x54')]({'where':{'id':_0x2a975e[_0xb75f('0x5d')]['id']},'include':[{'model':db['Pause'],'as':_0xb75f('0x37')}]})[_0xb75f('0x1c')](handleEntityNotFound(_0x3b8c2e,null))[_0xb75f('0x1c')](saveUpdates(_0x2a975e[_0xb75f('0x56')],null))['then'](respondWithResult(_0x3b8c2e,null))['catch'](handleError(_0x3b8c2e,null));};exports[_0xb75f('0x30')]=function(_0x1cfd10,_0x4a6e73){return db[_0xb75f('0x4e')][_0xb75f('0x54')]({'where':{'id':_0x1cfd10[_0xb75f('0x5d')]['id']}})[_0xb75f('0x1c')](handleEntityNotFound(_0x4a6e73,null))['then'](removeEntity(_0x4a6e73,null))[_0xb75f('0x25')](handleError(_0x4a6e73,null));};exports[_0xb75f('0x5e')]=function(_0x151169,_0x12ac82){return db['OpenchannelAccount'][_0xb75f('0x5e')]()[_0xb75f('0x1c')](respondWithResult(_0x12ac82,null))[_0xb75f('0x25')](handleError(_0x12ac82,null));};exports[_0xb75f('0x5f')]=function(_0x3be12d,_0x2cdc5c,_0x13dcbe){if(_0x3be12d[_0xb75f('0x56')]['id']){delete _0x3be12d[_0xb75f('0x56')]['id'];}return db[_0xb75f('0x4e')][_0xb75f('0x54')]({'where':{'id':_0x3be12d[_0xb75f('0x5d')]['id']}})[_0xb75f('0x1c')](handleEntityNotFound(_0x2cdc5c,null))[_0xb75f('0x1c')](function(_0x2c3d3b){if(_0x2c3d3b){_0x3be12d[_0xb75f('0x56')]['OpenchannelAccountId']=_0x2c3d3b['id'];return db[_0xb75f('0x60')][_0xb75f('0x55')](_0x3be12d[_0xb75f('0x56')]);}})[_0xb75f('0x1c')](respondWithResult(_0x2cdc5c,null))['catch'](handleError(_0x2cdc5c,null));};exports['getDispositions']=function(_0x41e6e3,_0x4444de,_0x519b28){var _0x29ab9e={'raw':![],'where':{}};var _0x289138={};var _0x39c150={'count':0x0,'rows':[]};return db[_0xb75f('0x4e')][_0xb75f('0x61')]({'where':{'id':_0x41e6e3['params']['id']}})[_0xb75f('0x1c')](handleEntityNotFound(_0x4444de,null))['then'](function(_0x264622){if(_0x264622){_0x289138[_0xb75f('0x3c')]=_[_0xb75f('0x3e')](db[_0xb75f('0x60')][_0xb75f('0x52')]);_0x289138[_0xb75f('0x3d')]=_['keys'](_0x41e6e3[_0xb75f('0x3d')]);_0x289138[_0xb75f('0x3f')]=_['intersection'](_0x289138[_0xb75f('0x3c')],_0x289138[_0xb75f('0x3d')]);_0x29ab9e[_0xb75f('0x41')]=_[_0xb75f('0x40')](_0x289138['model'],qs[_0xb75f('0x42')](_0x41e6e3[_0xb75f('0x3d')][_0xb75f('0x42')]));_0x29ab9e[_0xb75f('0x41')]=_0x29ab9e['attributes']['length']?_0x29ab9e[_0xb75f('0x41')]:_0x289138['model'];if(!_0x41e6e3['query'][_0xb75f('0x44')]('nolimit')){_0x29ab9e['limit']=qs[_0xb75f('0x2b')](_0x41e6e3[_0xb75f('0x3d')][_0xb75f('0x2b')]);_0x29ab9e[_0xb75f('0x29')]=qs[_0xb75f('0x29')](_0x41e6e3['query'][_0xb75f('0x29')]);}_0x29ab9e[_0xb75f('0x62')]=qs['sort'](_0x41e6e3[_0xb75f('0x3d')][_0xb75f('0x46')]);_0x29ab9e['where']=qs[_0xb75f('0x3f')](_[_0xb75f('0x47')](_0x41e6e3[_0xb75f('0x3d')],_0x289138[_0xb75f('0x3f')]));_0x29ab9e['where'][_0xb75f('0x63')]=_0x264622['id'];if(_0x41e6e3[_0xb75f('0x3d')]['filter']){_0x29ab9e[_0xb75f('0x49')]=_['merge'](_0x29ab9e[_0xb75f('0x49')],{'$or':_['map'](_0x29ab9e[_0xb75f('0x41')],function(_0x4e929a){var _0x30b2f0={};_0x30b2f0[_0x4e929a]={'$like':'%'+_0x41e6e3[_0xb75f('0x3d')][_0xb75f('0x48')]+'%'};return _0x30b2f0;})});}_0x29ab9e=_[_0xb75f('0x4a')]({},_0x29ab9e,_0x41e6e3[_0xb75f('0x53')]);return db[_0xb75f('0x60')][_0xb75f('0x64')]({'where':_0x29ab9e[_0xb75f('0x49')]})[_0xb75f('0x1c')](function(_0x29222a){_0x39c150[_0xb75f('0x64')]=_0x29222a;if(_0x41e6e3['query']['includeAll']){_0x29ab9e[_0xb75f('0x4d')]=[{'all':!![]}];}return db[_0xb75f('0x60')][_0xb75f('0x4f')](_0x29ab9e);})[_0xb75f('0x1c')](function(_0x8e2d7a){_0x39c150[_0xb75f('0x50')]=_0x8e2d7a;return _0x39c150;});}})['then'](respondWithFilteredResult(_0x4444de,_0x29ab9e))[_0xb75f('0x25')](handleError(_0x4444de,null));};exports[_0xb75f('0x65')]=function(_0x498bed,_0x4ac636,_0xb2c47b){return db[_0xb75f('0x4e')][_0xb75f('0x54')]({'where':{'id':_0x498bed[_0xb75f('0x5d')]['id']}})[_0xb75f('0x1c')](handleEntityNotFound(_0x4ac636,null))['then'](function(_0x281363){if(_0x281363){return _0x281363[_0xb75f('0x65')](_0x498bed[_0xb75f('0x3d')][_0xb75f('0x66')]);}})[_0xb75f('0x1c')](respondWithStatusCode(_0x4ac636,null))[_0xb75f('0x25')](handleError(_0x4ac636,null));};exports[_0xb75f('0x67')]=function(_0x586f66,_0x137f7e,_0x1f21f4){if(_0x586f66['body']['id']){delete _0x586f66[_0xb75f('0x56')]['id'];}return db['OpenchannelAccount'][_0xb75f('0x54')]({'where':{'id':_0x586f66[_0xb75f('0x5d')]['id']}})[_0xb75f('0x1c')](handleEntityNotFound(_0x137f7e,null))[_0xb75f('0x1c')](function(_0x22b29f){if(_0x22b29f){_0x586f66[_0xb75f('0x56')]['OpenchannelAccountId']=_0x22b29f['id'];return db[_0xb75f('0x68')][_0xb75f('0x55')](_0x586f66[_0xb75f('0x56')]);}})[_0xb75f('0x1c')](respondWithResult(_0x137f7e,null))[_0xb75f('0x25')](handleError(_0x137f7e,null));};exports[_0xb75f('0x69')]=function(_0x10c2ac,_0x2ab7e4,_0x33254d){var _0x4ab458={'raw':![],'where':{}};var _0x1e659c={};var _0x312a03={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xb75f('0x61')]({'where':{'id':_0x10c2ac['params']['id']}})[_0xb75f('0x1c')](handleEntityNotFound(_0x2ab7e4,null))['then'](function(_0x10948b){if(_0x10948b){_0x1e659c['model']=_[_0xb75f('0x3e')](db[_0xb75f('0x68')][_0xb75f('0x52')]);_0x1e659c['query']=_[_0xb75f('0x3e')](_0x10c2ac[_0xb75f('0x3d')]);_0x1e659c['filters']=_[_0xb75f('0x40')](_0x1e659c[_0xb75f('0x3c')],_0x1e659c[_0xb75f('0x3d')]);_0x4ab458['attributes']=_[_0xb75f('0x40')](_0x1e659c[_0xb75f('0x3c')],qs['fields'](_0x10c2ac[_0xb75f('0x3d')]['fields']));_0x4ab458[_0xb75f('0x41')]=_0x4ab458['attributes']['length']?_0x4ab458[_0xb75f('0x41')]:_0x1e659c[_0xb75f('0x3c')];if(!_0x10c2ac[_0xb75f('0x3d')][_0xb75f('0x44')](_0xb75f('0x45'))){_0x4ab458[_0xb75f('0x2b')]=qs[_0xb75f('0x2b')](_0x10c2ac[_0xb75f('0x3d')]['limit']);_0x4ab458[_0xb75f('0x29')]=qs[_0xb75f('0x29')](_0x10c2ac[_0xb75f('0x3d')][_0xb75f('0x29')]);}_0x4ab458[_0xb75f('0x62')]=qs[_0xb75f('0x46')](_0x10c2ac['query']['sort']);_0x4ab458[_0xb75f('0x49')]=qs[_0xb75f('0x3f')](_[_0xb75f('0x47')](_0x10c2ac[_0xb75f('0x3d')],_0x1e659c['filters']));_0x4ab458[_0xb75f('0x49')][_0xb75f('0x63')]=_0x10948b['id'];if(_0x10c2ac['query'][_0xb75f('0x48')]){_0x4ab458[_0xb75f('0x49')]=_['merge'](_0x4ab458[_0xb75f('0x49')],{'$or':_[_0xb75f('0x38')](_0x4ab458[_0xb75f('0x41')],function(_0xa022ea){var _0x53b88d={};_0x53b88d[_0xa022ea]={'$like':'%'+_0x10c2ac[_0xb75f('0x3d')][_0xb75f('0x48')]+'%'};return _0x53b88d;})});}_0x4ab458=_['merge']({},_0x4ab458,_0x10c2ac[_0xb75f('0x53')]);return db[_0xb75f('0x68')]['count']({'where':_0x4ab458[_0xb75f('0x49')]})['then'](function(_0x3fea26){_0x312a03[_0xb75f('0x64')]=_0x3fea26;if(_0x10c2ac['query'][_0xb75f('0x4c')]){_0x4ab458[_0xb75f('0x4d')]=[{'all':!![]}];}return db[_0xb75f('0x68')][_0xb75f('0x4f')](_0x4ab458);})['then'](function(_0x149aaf){_0x312a03[_0xb75f('0x50')]=_0x149aaf;return _0x312a03;});}})[_0xb75f('0x1c')](respondWithFilteredResult(_0x2ab7e4,_0x4ab458))['catch'](handleError(_0x2ab7e4,null));};exports['removeAnswers']=function(_0x2a007a,_0x9642c9,_0x4c6368){return db['OpenchannelAccount'][_0xb75f('0x54')]({'where':{'id':_0x2a007a[_0xb75f('0x5d')]['id']}})[_0xb75f('0x1c')](handleEntityNotFound(_0x9642c9,null))[_0xb75f('0x1c')](function(_0x4e8bd0){if(_0x4e8bd0){return _0x4e8bd0['removeAnswers'](_0x2a007a['query'][_0xb75f('0x66')]);}})[_0xb75f('0x1c')](respondWithStatusCode(_0x9642c9,null))['catch'](handleError(_0x9642c9,null));};exports[_0xb75f('0x6a')]=function(_0x4df2f1,_0x369b0f,_0x3de9ea){var _0x2043d8={'body':_0x4df2f1['body'],'channel':_0xb75f('0x6b')};var _0x434952=[];var _0x2a372e=[];var _0x15ded6={};var _0x5db639=![];return db['CmContact'][_0xb75f('0x5e')]()['then'](function(_0xc57c7a){if(!_0xc57c7a){throw new db[(_0xb75f('0x6c'))][(_0xb75f('0x6d'))]('no\x20available\x20attributes');}_0x434952=_[_0xb75f('0x6e')](_[_0xb75f('0x3e')](_0xc57c7a),[_0xb75f('0x6f'),_0xb75f('0x70')]);_0x2a372e=_[_0xb75f('0x6e')](_[_0xb75f('0x3e')](_0xc57c7a),['createdAt',_0xb75f('0x70'),_0xb75f('0x71'),_0xb75f('0x72')]);if(_0x4df2f1[_0xb75f('0x56')]['id']){delete _0x4df2f1[_0xb75f('0x56')]['id'];}if(_['isNil'](_0x4df2f1['body'][_0xb75f('0x73')])){throw new db[(_0xb75f('0x6c'))][(_0xb75f('0x6d'))]('from\x20is\x20mandatory');}if(_[_0xb75f('0x74')](_0x4df2f1[_0xb75f('0x56')][_0xb75f('0x56')])||_0x4df2f1[_0xb75f('0x56')][_0xb75f('0x56')]===''){throw new db[(_0xb75f('0x6c'))][(_0xb75f('0x6d'))](_0xb75f('0x75'));}if(_[_0xb75f('0x74')](_0x4df2f1[_0xb75f('0x56')]['mapKey'])){throw new db[(_0xb75f('0x6c'))][(_0xb75f('0x6d'))](_0xb75f('0x76')+_0x2a372e);}if(!_[_0xb75f('0x77')](_0x2a372e,_0x4df2f1[_0xb75f('0x56')][_0xb75f('0x78')])){throw new db[(_0xb75f('0x6c'))]['ValidationError'](_0xb75f('0x79')+_0x2a372e);}_0x15ded6[_0x4df2f1['body'][_0xb75f('0x78')]]=_0x4df2f1[_0xb75f('0x56')][_0xb75f('0x73')];})['then'](function(){return db[_0xb75f('0x4e')]['find']({'where':{'id':_0x4df2f1[_0xb75f('0x5d')]['id']},'include':[{'model':db[_0xb75f('0x7a')],'as':_0xb75f('0x7b'),'include':[{'model':db[_0xb75f('0x7c')],'as':_0xb75f('0x7d'),'where':_0x15ded6,'limit':0x1,'order':[['updatedAt',_0xb75f('0x7e')]]}]},{'model':db[_0xb75f('0x7f')],'as':_0xb75f('0x80')}]});})['then'](handleEntityNotFound(_0x369b0f,null))['then'](function(_0x7efe8a){if(_0x7efe8a&&_0x7efe8a[_0xb75f('0x7b')]){_0x2043d8[_0xb75f('0x81')]=_0x7efe8a;_0x2043d8['applications']=_0x7efe8a[_0xb75f('0x80')];_0x2043d8[_0xb75f('0x82')]=_0x7efe8a[_0xb75f('0x7b')];_0x2043d8[_0xb75f('0x83')]=_[_0xb75f('0x84')](_0x2043d8['applications'],[_0xb75f('0x85')],['asc']);if(_0x2043d8['account']['Applications']){delete _0x2043d8['account']['Applications'];}if(_0x2043d8[_0xb75f('0x81')]['List']&&_0x2043d8[_0xb75f('0x81')]['List'][_0xb75f('0x7d')][_0xb75f('0x43')]){return _0x2043d8[_0xb75f('0x81')][_0xb75f('0x7b')][_0xb75f('0x7d')][0x0];}var _0x2f30b8=_['defaults'](_0x4df2f1['body'],{'firstName':_0x4df2f1['body'][_0xb75f('0x73')],'ListId':_0x7efe8a[_0xb75f('0x72')]});_0x2f30b8[_0x4df2f1[_0xb75f('0x56')][_0xb75f('0x78')]]=_0x4df2f1['body']['from'];return db['CmContact'][_0xb75f('0x55')](_0x2f30b8,{'fields':_0x434952,'raw':!![]});}})[_0xb75f('0x1c')](handleEntityNotFound(_0x369b0f,null))[_0xb75f('0x1c')](function(_0x4a7953){_0x2043d8['contact']=_0x4a7953;if(_0x4a7953){var _0x2cfcda={'ContactId':_0x4a7953['id'],'OpenchannelAccountId':_0x4df2f1[_0xb75f('0x5d')]['id'],'from':(_0x4a7953[_0xb75f('0x86')]||'')+'\x20'+(_0x4a7953[_0xb75f('0x87')]||'')};var _0x336d9e={'OpenchannelAccountId':_0x4df2f1[_0xb75f('0x5d')]['id'],'closed':![]};if(_0x4df2f1[_0xb75f('0x56')][_0xb75f('0x88')]){_0x336d9e['threadId']=_0x4df2f1[_0xb75f('0x56')][_0xb75f('0x88')];return db[_0xb75f('0x89')]['find']({'where':_0x336d9e})[_0xb75f('0x1c')](function(_0x2056a4){if(_0x2056a4){return[_0x2056a4,![]];}_0x2cfcda[_0xb75f('0x88')]=_0x4df2f1[_0xb75f('0x56')][_0xb75f('0x88')];_0x2cfcda[_0xb75f('0x8a')]=_0x4df2f1[_0xb75f('0x56')][_0xb75f('0x8a')];return db[_0xb75f('0x89')][_0xb75f('0x55')](_0x2cfcda)[_0xb75f('0x1c')](function(_0x1ee1c5){return[_0x1ee1c5,!![]];});});}else{_0x336d9e['threadId']=null;}_0x336d9e[_0xb75f('0x8b')]=_0x4a7953['id'];return db[_0xb75f('0x89')][_0xb75f('0x54')]({'where':_0x336d9e})[_0xb75f('0x1c')](function(_0xae846c){if(_0xae846c){return[_0xae846c,![]];}return db[_0xb75f('0x89')][_0xb75f('0x55')](_0x2cfcda)[_0xb75f('0x1c')](function(_0x55d2d2){return[_0x55d2d2,!![]];});});}})[_0xb75f('0x8c')](function(_0xf8bc68,_0x564c6c){if(_0xf8bc68){_0x5db639=_0x564c6c;if(!_0x564c6c){var _0x1c4d43={'from':(_0x2043d8[_0xb75f('0x8d')][_0xb75f('0x86')]||'')+'\x20'+(_0x2043d8[_0xb75f('0x8d')][_0xb75f('0x87')]||'')};if(_0x4df2f1[_0xb75f('0x56')][_0xb75f('0x88')]&&_0x4df2f1[_0xb75f('0x56')][_0xb75f('0x8e')]&&_0x4df2f1[_0xb75f('0x56')]['threadId']!=_0x4df2f1['body']['messageId']){_0x1c4d43[_0xb75f('0x88')]=_0x4df2f1[_0xb75f('0x56')][_0xb75f('0x8e')];}return _0xf8bc68[_0xb75f('0x2f')](_0x1c4d43);}else{return _0xf8bc68;}}})[_0xb75f('0x1c')](function(_0x24b1dc){_0x2043d8[_0xb75f('0x8f')]=_0x24b1dc['get']({'plain':!![]});_0x2043d8[_0xb75f('0x8f')]['created']=_0x5db639;if(_0x2043d8[_0xb75f('0x8f')][_0xb75f('0x90')]){if(_0x2043d8['account'][_0xb75f('0x91')]){_0x2043d8[_0xb75f('0x83')][_0xb75f('0x92')]({'id':0x0,'priority':_0x2043d8[_0xb75f('0x83')][_0xb75f('0x43')]+0x1,'app':_0xb75f('0x93'),'appdata':_0xb75f('0x94'),'interval':'*,*,*,*'});}}return db[_0xb75f('0x95')][_0xb75f('0x55')]({'body':_0x4df2f1[_0xb75f('0x56')][_0xb75f('0x56')],'OpenchannelAccountId':_0x4df2f1[_0xb75f('0x5d')]['id'],'OpenchannelInteractionId':_0x24b1dc['id'],'direction':'in','ContactId':_0x2043d8[_0xb75f('0x8d')]['id'],'AttachmentId':_0x4df2f1[_0xb75f('0x56')][_0xb75f('0x96')]});})['then'](function(_0x1caff3){_0x2043d8['message']=_0x1caff3;if(_0x2043d8[_0xb75f('0x8f')][_0xb75f('0x97')]){return db[_0xb75f('0x98')]['find']({'attributes':['id',_0xb75f('0x34')],'where':{'id':_0x2043d8[_0xb75f('0x8f')][_0xb75f('0x97')]}})[_0xb75f('0x1c')](function(_0x13a412){if(_0x13a412){_0x2043d8['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xb75f('0x99'),'appdata':_0x13a412['name']+','+(_0x2043d8[_0xb75f('0x81')][_0xb75f('0x9a')]||0xa),'interval':'*,*,*,*'});_0x2043d8[_0xb75f('0x9b')]=![];}return respondWithRpcPromise(_0xb75f('0x9c'),_0xb75f('0x9d'),_0x2043d8);});}return respondWithRpcPromise('Start','startRouting',_0x2043d8);})[_0xb75f('0x1c')](function(_0x5abe0a){respondWithRpcPromise(_0xb75f('0x9e'),_0xb75f('0x9e'),{'event':_0xb75f('0x6a'),'message':_0x5abe0a},client9002);return _0x5abe0a;})[_0xb75f('0x1c')](respondWithResult(_0x369b0f,null))[_0xb75f('0x25')](handleError(_0x369b0f,null));};exports[_0xb75f('0x9f')]=function(_0x24f8cd,_0x116fdd,_0x2ad203){return db[_0xb75f('0x4e')][_0xb75f('0x61')]({'where':{'id':_0x24f8cd['params']['id']}})[_0xb75f('0x1c')](handleEntityNotFound(_0x116fdd,null))['then'](function(_0x3c4de8){if(_0x3c4de8){return db['sequelize']['transaction'](function(_0x3db0d4){return db[_0xb75f('0x7f')]['destroy']({'where':{'OpenchannelAccountId':_0x24f8cd[_0xb75f('0x5d')]['id']},'transaction':_0x3db0d4})[_0xb75f('0x1c')](function(_0x4e285a){var _0x20ddca=_[_0xb75f('0x38')](_0x24f8cd[_0xb75f('0x56')],function(_0x31b65a){_0x31b65a['OpenchannelAccountId']=_0x24f8cd['params']['id'];return _0x31b65a;});return db[_0xb75f('0x7f')][_0xb75f('0xa0')](_0x20ddca,{'transaction':_0x3db0d4});});})[_0xb75f('0x1c')](function(){return db[_0xb75f('0x7f')][_0xb75f('0xa1')]({'where':{'OpenchannelAccountId':_0x24f8cd['params']['id']},'order':'priority'});});}})[_0xb75f('0x1c')](respondWithResult(_0x116fdd,null))[_0xb75f('0x25')](handleError(_0x116fdd,null));};exports['getApplications']=function(_0x5bbb37,_0x23e7c8,_0x33436c){var _0x2c08d6={};var _0x587311={};var _0x7a54af;var _0x4e2eeb;return db[_0xb75f('0x4e')][_0xb75f('0x61')]({'where':{'id':_0x5bbb37[_0xb75f('0x5d')]['id']}})[_0xb75f('0x1c')](handleEntityNotFound(_0x23e7c8,null))[_0xb75f('0x1c')](function(_0x3a4253){if(_0x3a4253){_0x7a54af=_0x3a4253;_0x587311[_0xb75f('0x3c')]=_[_0xb75f('0x3e')](db[_0xb75f('0x7f')][_0xb75f('0x52')]);_0x587311[_0xb75f('0x3d')]=_[_0xb75f('0x3e')](_0x5bbb37[_0xb75f('0x3d')]);_0x587311[_0xb75f('0x3f')]=_[_0xb75f('0x40')](_0x587311[_0xb75f('0x3c')],_0x587311[_0xb75f('0x3d')]);_0x2c08d6[_0xb75f('0x41')]=_['intersection'](_0x587311[_0xb75f('0x3c')],qs[_0xb75f('0x42')](_0x5bbb37[_0xb75f('0x3d')]['fields']));_0x2c08d6[_0xb75f('0x41')]=_0x2c08d6['attributes'][_0xb75f('0x43')]?_0x2c08d6[_0xb75f('0x41')]:_0x587311['model'];_0x2c08d6['order']=qs[_0xb75f('0x46')](_0x5bbb37[_0xb75f('0x3d')][_0xb75f('0x46')]);_0x2c08d6[_0xb75f('0x49')]=qs[_0xb75f('0x3f')](_[_0xb75f('0x47')](_0x5bbb37[_0xb75f('0x3d')],_0x587311[_0xb75f('0x3f')]));if(_0x5bbb37[_0xb75f('0x3d')][_0xb75f('0x48')]){_0x2c08d6[_0xb75f('0x49')]=_[_0xb75f('0x4a')](_0x2c08d6[_0xb75f('0x49')],{'$or':_[_0xb75f('0x38')](_0x2c08d6['attributes'],function(_0x375372){var _0x58a5a8={};_0x58a5a8[_0x375372]={'$like':'%'+_0x5bbb37['query']['filter']+'%'};return _0x58a5a8;})});}_0x2c08d6=_[_0xb75f('0x4a')]({},_0x2c08d6,_0x5bbb37['options']);return _0x7a54af[_0xb75f('0xa2')](_0x2c08d6);}})['then'](function(_0x295173){if(_0x295173){_0x4e2eeb=_0x295173[_0xb75f('0x43')];if(!_0x5bbb37[_0xb75f('0x3d')][_0xb75f('0x44')](_0xb75f('0x45'))){_0x2c08d6[_0xb75f('0x2b')]=qs[_0xb75f('0x2b')](_0x5bbb37[_0xb75f('0x3d')][_0xb75f('0x2b')]);_0x2c08d6['offset']=qs[_0xb75f('0x29')](_0x5bbb37['query'][_0xb75f('0x29')]);}return _0x7a54af[_0xb75f('0xa2')](_0x2c08d6);}})[_0xb75f('0x1c')](function(_0x4a1bdb){if(_0x4a1bdb){return _0x4a1bdb?{'count':_0x4e2eeb,'rows':_0x4a1bdb}:null;}})[_0xb75f('0x1c')](respondWithResult(_0x23e7c8,null))[_0xb75f('0x25')](handleError(_0x23e7c8,null));};exports[_0xb75f('0xa3')]=function(_0x35894c,_0x167667,_0x292f70){var _0xdc5d78={'raw':![],'where':{}};var _0xf67381={};var _0x32b27d={'count':0x0,'rows':[]};return db[_0xb75f('0x4e')]['findOne']({'where':{'id':_0x35894c['params']['id']}})['then'](handleEntityNotFound(_0x167667,null))['then'](function(_0x3125b7){if(_0x3125b7){_0xf67381[_0xb75f('0x3c')]=_['keys'](db[_0xb75f('0x89')][_0xb75f('0x52')]);_0xf67381[_0xb75f('0x3d')]=_['keys'](_0x35894c[_0xb75f('0x3d')]);_0xf67381[_0xb75f('0x3f')]=_[_0xb75f('0x40')](_0xf67381['model'],_0xf67381[_0xb75f('0x3d')]);_0xdc5d78[_0xb75f('0x41')]=_[_0xb75f('0x40')](_0xf67381[_0xb75f('0x3c')],qs[_0xb75f('0x42')](_0x35894c[_0xb75f('0x3d')][_0xb75f('0x42')]));_0xdc5d78[_0xb75f('0x41')]=_0xdc5d78[_0xb75f('0x41')]['length']?_0xdc5d78[_0xb75f('0x41')]:_0xf67381[_0xb75f('0x3c')];if(!_0x35894c[_0xb75f('0x3d')][_0xb75f('0x44')]('nolimit')){_0xdc5d78[_0xb75f('0x2b')]=qs[_0xb75f('0x2b')](_0x35894c[_0xb75f('0x3d')][_0xb75f('0x2b')]);_0xdc5d78[_0xb75f('0x29')]=qs[_0xb75f('0x29')](_0x35894c[_0xb75f('0x3d')][_0xb75f('0x29')]);}_0xdc5d78['order']=qs['sort'](_0x35894c[_0xb75f('0x3d')][_0xb75f('0x46')]);_0xdc5d78[_0xb75f('0x49')]=qs[_0xb75f('0x3f')](_[_0xb75f('0x47')](_0x35894c[_0xb75f('0x3d')],_0xf67381[_0xb75f('0x3f')]));_0xdc5d78[_0xb75f('0x49')]['OpenchannelAccountId']=_0x3125b7['id'];if(_0x35894c[_0xb75f('0x3d')][_0xb75f('0x48')]){_0xdc5d78[_0xb75f('0x49')]=_['merge'](_0xdc5d78[_0xb75f('0x49')],{'$or':_[_0xb75f('0x38')](_0xdc5d78[_0xb75f('0x41')],function(_0x3cdab3){var _0x44b309={};_0x44b309[_0x3cdab3]={'$like':'%'+_0x35894c[_0xb75f('0x3d')]['filter']+'%'};return _0x44b309;})});}_0xdc5d78=_[_0xb75f('0x4a')]({},_0xdc5d78,_0x35894c[_0xb75f('0x53')]);return db[_0xb75f('0x89')][_0xb75f('0x64')]({'where':_0xdc5d78[_0xb75f('0x49')]})[_0xb75f('0x1c')](function(_0x1af549){_0x32b27d[_0xb75f('0x64')]=_0x1af549;if(_0x35894c[_0xb75f('0x3d')]['includeAll']){_0xdc5d78[_0xb75f('0x4d')]=[{'model':db[_0xb75f('0x7c')],'as':_0xb75f('0xa4'),'required':![]},{'model':db[_0xb75f('0x98')],'as':_0xb75f('0xa5'),'attributes':['name',_0xb75f('0xa6'),_0xb75f('0xa7')],'required':![]},{'model':db[_0xb75f('0xa8')],'as':_0xb75f('0xa9'),'attributes':['id',_0xb75f('0x34'),_0xb75f('0xaa')],'where':_0x35894c[_0xb75f('0x3d')][_0xb75f('0xab')]?{'id':_0x35894c[_0xb75f('0x3d')][_0xb75f('0xab')]}:undefined,'required':_0x35894c[_0xb75f('0x3d')][_0xb75f('0xab')]?!![]:![]}];}return db['OpenchannelInteraction'][_0xb75f('0x4f')](_0xdc5d78);})['then'](function(_0x5f01f4){_0x32b27d['rows']=_0x5f01f4;return _0x32b27d;});}})[_0xb75f('0x1c')](respondWithFilteredResult(_0x167667,_0xdc5d78))[_0xb75f('0x25')](handleError(_0x167667,null));};exports['addAgents']=function(_0x33f8fd,_0xa73c4c,_0x5753eb){return db[_0xb75f('0x4e')][_0xb75f('0x54')]({'where':{'id':_0x33f8fd[_0xb75f('0x5d')]['id']}})[_0xb75f('0x1c')](handleEntityNotFound(_0xa73c4c,null))[_0xb75f('0x1c')](function(_0x2c98f9){if(_0x2c98f9){return _0x2c98f9[_0xb75f('0xac')](_0x33f8fd['body'][_0xb75f('0x66')],_[_0xb75f('0xad')](_0x33f8fd['body'],[_0xb75f('0x66'),'id'])||{})['spread'](function(_0x33c980){for(var _0x383b92=0x0;_0x383b92<_0x33f8fd[_0xb75f('0x56')][_0xb75f('0x66')][_0xb75f('0x43')];_0x383b92+=0x1){socket[_0xb75f('0xae')]('userOpenchannelAccount:save',{'UserId':Number(_0x33f8fd['body'][_0xb75f('0x66')][_0x383b92]),'OpenchannelAccountId':Number(_0x33f8fd['params']['id'])});}return _0x33c980;});}})[_0xb75f('0x1c')](respondWithResult(_0xa73c4c,null))[_0xb75f('0x25')](handleError(_0xa73c4c,null));};exports['removeAgents']=function(_0x4e11a3,_0x419452,_0x5c8d97){return db[_0xb75f('0x4e')][_0xb75f('0x54')]({'where':{'id':_0x4e11a3[_0xb75f('0x5d')]['id']}})[_0xb75f('0x1c')](handleEntityNotFound(_0x419452,null))['then'](function(_0x4cdd1e){if(_0x4cdd1e){return _0x4cdd1e[_0xb75f('0xaf')](_0x4e11a3[_0xb75f('0x3d')][_0xb75f('0x66')])[_0xb75f('0x1c')](function(){if(_[_0xb75f('0xb0')](_0x4e11a3['query'][_0xb75f('0x66')])){for(var _0x35b9fb=0x0;_0x35b9fb<_0x4e11a3[_0xb75f('0x3d')][_0xb75f('0x66')][_0xb75f('0x43')];_0x35b9fb+=0x1){socket[_0xb75f('0xae')](_0xb75f('0xb1'),{'UserId':Number(_0x4e11a3[_0xb75f('0x3d')][_0xb75f('0x66')][_0x35b9fb]),'OpenchannelAccountId':Number(_0x4e11a3['params']['id'])});}}else{socket[_0xb75f('0xae')](_0xb75f('0xb1'),{'UserId':Number(_0x4e11a3[_0xb75f('0x3d')][_0xb75f('0x66')]),'OpenchannelAccountId':Number(_0x4e11a3[_0xb75f('0x5d')]['id'])});}});}})[_0xb75f('0x1c')](respondWithStatusCode(_0x419452,null))['catch'](handleError(_0x419452,null));};exports['getAgents']=function(_0x49d8d9,_0x1f7aa,_0x35ee81){var _0x21221a={};var _0x1f8614={};var _0x502db3;var _0x56a741;return db[_0xb75f('0x4e')]['findOne']({'where':{'id':_0x49d8d9[_0xb75f('0x5d')]['id']}})[_0xb75f('0x1c')](handleEntityNotFound(_0x1f7aa,null))['then'](function(_0x4bfa86){if(_0x4bfa86){_0x502db3=_0x4bfa86;_0x1f8614[_0xb75f('0x3c')]=_[_0xb75f('0x3e')](db['User']['rawAttributes']);_0x1f8614[_0xb75f('0x3d')]=_['keys'](_0x49d8d9[_0xb75f('0x3d')]);_0x1f8614[_0xb75f('0x3f')]=_['intersection'](_0x1f8614[_0xb75f('0x3c')],_0x1f8614[_0xb75f('0x3d')]);_0x21221a[_0xb75f('0x41')]=_[_0xb75f('0x40')](_0x1f8614[_0xb75f('0x3c')],qs[_0xb75f('0x42')](_0x49d8d9[_0xb75f('0x3d')][_0xb75f('0x42')]));_0x21221a[_0xb75f('0x41')]=_0x21221a[_0xb75f('0x41')][_0xb75f('0x43')]?_0x21221a[_0xb75f('0x41')]:_0x1f8614[_0xb75f('0x3c')];_0x21221a[_0xb75f('0x62')]=qs[_0xb75f('0x46')](_0x49d8d9['query'][_0xb75f('0x46')]);_0x21221a['where']=qs[_0xb75f('0x3f')](_[_0xb75f('0x47')](_0x49d8d9['query'],_0x1f8614[_0xb75f('0x3f')]));if(_0x49d8d9[_0xb75f('0x3d')]['filter']){_0x21221a['where']=_[_0xb75f('0x4a')](_0x21221a[_0xb75f('0x49')],{'$or':_[_0xb75f('0x38')](_0x21221a[_0xb75f('0x41')],function(_0x2afe01){var _0x1da39c={};_0x1da39c[_0x2afe01]={'$like':'%'+_0x49d8d9[_0xb75f('0x3d')][_0xb75f('0x48')]+'%'};return _0x1da39c;})});}_0x21221a=_[_0xb75f('0x4a')]({},_0x21221a,_0x49d8d9[_0xb75f('0x53')]);return _0x502db3['getAgents'](_0x21221a);}})[_0xb75f('0x1c')](function(_0x45378a){if(_0x45378a){_0x56a741=_0x45378a[_0xb75f('0x43')];if(!_0x49d8d9['query'][_0xb75f('0x44')]('nolimit')){_0x21221a[_0xb75f('0x2b')]=qs['limit'](_0x49d8d9[_0xb75f('0x3d')]['limit']);_0x21221a[_0xb75f('0x29')]=qs['offset'](_0x49d8d9['query'][_0xb75f('0x29')]);}return _0x502db3[_0xb75f('0xb2')](_0x21221a);}})['then'](function(_0x39ccf4){if(_0x39ccf4){return _0x39ccf4?{'count':_0x56a741,'rows':_0x39ccf4}:null;}})[_0xb75f('0x1c')](respondWithResult(_0x1f7aa,null))[_0xb75f('0x25')](handleError(_0x1f7aa,null));};exports[_0xb75f('0xb3')]=function(_0x23acf7,_0xa2b00e,_0x2beb7e){var _0x568078,_0x203aaf,_0x46aee1;if(_[_0xb75f('0x74')](_0x23acf7[_0xb75f('0x56')]['body'])||_0x23acf7[_0xb75f('0x56')]['body']===''){throw new db[(_0xb75f('0x6c'))][(_0xb75f('0x6d'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xb75f('0x74')](_0x23acf7[_0xb75f('0x56')]['to'])){}_0x568078=_0x23acf7[_0xb75f('0x56')]['to'];return db['OpenchannelAccount']['findOne']({'where':{'id':_0x23acf7[_0xb75f('0x5d')]['id']}})[_0xb75f('0x1c')](handleEntityNotFound(_0xa2b00e,null))[_0xb75f('0x1c')](function(_0x3006fa){if(_0x3006fa){return db[_0xb75f('0x4e')]['find']({'where':{'id':_0x3006fa['id']},'include':[{'model':db[_0xb75f('0x7a')],'as':'List','include':[{'model':db['CmContact'],'as':_0xb75f('0x7d'),'where':{[_0x3006fa['mapKey']]:_0x568078},'limit':0x1,'order':[['updatedAt',_0xb75f('0x7e')]]}]}]})['then'](handleEntityNotFound(_0xa2b00e,null))[_0xb75f('0x1c')](function(_0x4ed1ba){if(_0x4ed1ba&&_0x4ed1ba[_0xb75f('0x7b')]){_0x203aaf=_0x4ed1ba['get']({'plain':!![]});if(_0x203aaf[_0xb75f('0x7b')]&&_0x203aaf[_0xb75f('0x7b')][_0xb75f('0x7d')][_0xb75f('0x43')]){return _0x203aaf[_0xb75f('0x7b')][_0xb75f('0x7d')][0x0];}return db[_0xb75f('0x7c')][_0xb75f('0x55')](_[_0xb75f('0x15')](_0x23acf7[_0xb75f('0x56')],{'firstName':_0x568078,[_0x4ed1ba[_0xb75f('0x78')]]:_0x568078,'phone':_0x568078,'ListId':_0x203aaf[_0xb75f('0x72')]}));}})[_0xb75f('0x1c')](handleEntityNotFound(_0xa2b00e,null))[_0xb75f('0x1c')](function(_0x52ff09){if(_0x52ff09){_0x46aee1=_0x52ff09;return db['OpenchannelInteraction'][_0xb75f('0x54')]({'where':{'ContactId':_0x46aee1['id'],'closed':![],'OpenchannelAccountId':_0x203aaf['id']}})['then'](function(_0xdbc4e3){if(_0xdbc4e3){return[_0xdbc4e3,![]];}return db['OpenchannelInteraction'][_0xb75f('0x55')]({'UserId':_0x23acf7[_0xb75f('0xb4')]['id'],'ContactId':_0x46aee1['id'],'OpenchannelAccountId':_0x203aaf['id'],'lastMsgDirection':_0xb75f('0xb5'),'Messages':[_['merge'](_0x23acf7[_0xb75f('0x56')],{'read':![],'body':_0x23acf7[_0xb75f('0x56')][_0xb75f('0x56')],'OpenchannelAccountId':_0x203aaf['id'],'UserId':_0x23acf7[_0xb75f('0xb4')]['id'],'ContactId':_0x46aee1['id']})]},{'include':[{'model':db[_0xb75f('0x95')],'as':_0xb75f('0xb6')}]})[_0xb75f('0x1c')](function(_0x463147){return[_0x463147,!![]];});});}})[_0xb75f('0x8c')](function(_0xee688a,_0x17fd10){if(_0x17fd10){return _0xee688a;}return db[_0xb75f('0x95')]['create'](_[_0xb75f('0x4a')](_0x23acf7[_0xb75f('0x56')],{'read':![],'body':_0x23acf7[_0xb75f('0x56')][_0xb75f('0x56')],'OpenchannelAccountId':_0x203aaf['id'],'OpenchannelInteractionId':_0xee688a['id'],'UserId':_0x23acf7['user']['id'],'ContactId':_0x46aee1['id']}))['then'](function(_0x53ef54){_0xee688a[_0xb75f('0xb7')][_0xb75f('0xb6')]=[];_0xee688a[_0xb75f('0xb7')]['Messages'][_0xb75f('0x92')](_0x53ef54[_0xb75f('0xb7')]);return _0xee688a;});});}})['then'](respondWithResult(_0xa2b00e,null))[_0xb75f('0x25')](handleError(_0xa2b00e,null));}; \ No newline at end of file +var _0x3271=['filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','include','findAll','rows','catch','Pause','keys','OpenchannelAccount','rawAttributes','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','describe','addDisposition','getDispositions','OpenchannelAccountId','Disposition','includeAll','removeDispositions','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','ids','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','OpenchannelApplication','Applications','account','applications','list','orderBy','asc','contact','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','ContactId','spread','messageId','interaction','created','push','close','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','unshift','agent','startRouting','Start','notify','addApplications','bulkCreate','getApplications','getInteractions','Contact','fullname','internal','Tag','color','tag','emit','removeAgents','isArray','getAgents','User','send','CmList','DESC','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','defaults','localhost','socket.io-emitter','redis','./openchannelAccount.socket','register','jayson/promise','client','http','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','destroy','get','UserProfileResource','name','mandatoryDispositionPause','map','type','key','model','query'];(function(_0x3cea78,_0x4a6751){var _0x33b66b=function(_0x1f45cd){while(--_0x1f45cd){_0x3cea78['push'](_0x3cea78['shift']());}};_0x33b66b(++_0x4a6751);}(_0x3271,0x12f));var _0x1327=function(_0x414078,_0x5b1750){_0x414078=_0x414078-0x0;var _0x5d78d6=_0x3271[_0x414078];return _0x5d78d6;};'use strict';var emlformat=require(_0x1327('0x0'));var rimraf=require(_0x1327('0x1'));var zipdir=require(_0x1327('0x2'));var jsonpatch=require(_0x1327('0x3'));var rp=require(_0x1327('0x4'));var moment=require(_0x1327('0x5'));var BPromise=require(_0x1327('0x6'));var Mustache=require(_0x1327('0x7'));var util=require('util');var path=require(_0x1327('0x8'));var sox=require(_0x1327('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1327('0xa'));var _=require(_0x1327('0xb'));var squel=require(_0x1327('0xc'));var crypto=require(_0x1327('0xd'));var jsforce=require(_0x1327('0xe'));var deskjs=require(_0x1327('0xf'));var toCsv=require(_0x1327('0x10'));var querystring=require(_0x1327('0x11'));var Papa=require('papaparse');var Redis=require(_0x1327('0x12'));var authService=require(_0x1327('0x13'));var qs=require(_0x1327('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1327('0x15'));var utils=require('../../config/utils');var config=require(_0x1327('0x16'));var licenseUtil=require(_0x1327('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x1327('0x18')](config['redis'],{'host':_0x1327('0x19'),'port':0x18eb});var socket=require(_0x1327('0x1a'))(new Redis(config[_0x1327('0x1b')]));require(_0x1327('0x1c'))[_0x1327('0x1d')](socket);var jayson=require(_0x1327('0x1e'));var client=jayson[_0x1327('0x1f')][_0x1327('0x20')]({'port':0x232c});var client9002=jayson[_0x1327('0x1f')][_0x1327('0x20')]({'port':0x232a});function respondWithRpcPromise(_0xbb2981,_0x558049,_0x75f7e3,_0x5a7f9a){return new BPromise(function(_0x2feb82,_0x4ff92c){var _0x47a5fe=_0x5a7f9a||client;return _0x47a5fe['request'](_0xbb2981,_0x75f7e3)[_0x1327('0x21')](function(_0x3c4d70){logger[_0x1327('0x22')](_0x1327('0x23'),_0x558049,'request\x20sent');logger[_0x1327('0x24')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x558049,_0x1327('0x25'),JSON[_0x1327('0x26')](_0x3c4d70));if(_0x3c4d70['error']){if(_0x3c4d70['error'][_0x1327('0x27')]===0x1f4){logger[_0x1327('0x28')](_0x1327('0x23'),_0x558049,_0x3c4d70[_0x1327('0x28')][_0x1327('0x29')]);return _0x4ff92c(_0x3c4d70[_0x1327('0x28')][_0x1327('0x29')]);}logger[_0x1327('0x28')]('OpenchannelAccount,\x20%s,\x20%s',_0x558049,_0x3c4d70[_0x1327('0x28')]['message']);return _0x2feb82(_0x3c4d70[_0x1327('0x28')][_0x1327('0x29')]);}else{logger[_0x1327('0x22')](_0x1327('0x23'),_0x558049,_0x1327('0x25'));_0x2feb82(_0x3c4d70['result'][_0x1327('0x29')]);}})['catch'](function(_0x2f8743){logger['error'](_0x1327('0x23'),_0x558049,_0x2f8743);_0x4ff92c(_0x2f8743);});});}function respondWithStatusCode(_0x49f29d,_0x395444){_0x395444=_0x395444||0xcc;return function(_0xa8f464){if(_0xa8f464){return _0x49f29d[_0x1327('0x2a')](_0x395444);}return _0x49f29d['status'](_0x395444)[_0x1327('0x2b')]();};}function respondWithResult(_0x5f1688,_0x2bfb95){_0x2bfb95=_0x2bfb95||0xc8;return function(_0x3fd383){if(_0x3fd383){return _0x5f1688[_0x1327('0x2c')](_0x2bfb95)[_0x1327('0x2d')](_0x3fd383);}};}function respondWithFilteredResult(_0x4e9d64,_0x4c5065){return function(_0x1ea6a3){if(_0x1ea6a3){var _0x815c3=typeof _0x4c5065['offset']===_0x1327('0x2e')&&typeof _0x4c5065[_0x1327('0x2f')]===_0x1327('0x2e');var _0x591f0b=_0x1ea6a3[_0x1327('0x30')];var _0x1c0c12=_0x815c3?0x0:_0x4c5065[_0x1327('0x31')];var _0x308def=_0x815c3?_0x1ea6a3[_0x1327('0x30')]:_0x4c5065[_0x1327('0x31')]+_0x4c5065['limit'];var _0x219fbc;if(_0x308def>=_0x591f0b){_0x308def=_0x591f0b;_0x219fbc=0xc8;}else{_0x219fbc=0xce;}_0x4e9d64['status'](_0x219fbc);return _0x4e9d64[_0x1327('0x32')](_0x1327('0x33'),_0x1c0c12+'-'+_0x308def+'/'+_0x591f0b)[_0x1327('0x2d')](_0x1ea6a3);}return null;};}function patchUpdates(_0x3458da){return function(_0x4d3f35){try{jsonpatch[_0x1327('0x34')](_0x4d3f35,_0x3458da,!![]);}catch(_0x1768bd){return BPromise[_0x1327('0x35')](_0x1768bd);}return _0x4d3f35[_0x1327('0x36')]();};}function saveUpdates(_0xe03280,_0x2e2261){return function(_0x424c12){if(_0x424c12){return _0x424c12['update'](_0xe03280)[_0x1327('0x21')](function(_0x1cff2c){return _0x1cff2c;});}return null;};}function removeEntity(_0x53b8c5,_0x3ae26b){return function(_0x389574){if(_0x389574){return _0x389574[_0x1327('0x37')]()['then'](function(){var _0x44c338=_0x389574[_0x1327('0x38')]({'plain':!![]});var _0x465833='OpenchannelAccounts';return db[_0x1327('0x39')][_0x1327('0x37')]({'where':{'type':_0x465833,'resourceId':_0x44c338['id']}})[_0x1327('0x21')](function(){return _0x389574;});})[_0x1327('0x21')](function(){_0x53b8c5[_0x1327('0x2c')](0xcc)[_0x1327('0x2b')]();});}};}function handleEntityNotFound(_0x99d0ee,_0x3de123){return function(_0x2f4012){if(!_0x2f4012){_0x99d0ee[_0x1327('0x2a')](0x194);}return _0x2f4012;};}function handleError(_0xfea15f,_0x2b1c5e){_0x2b1c5e=_0x2b1c5e||0x1f4;return function(_0x4c2123){logger[_0x1327('0x28')](_0x4c2123['stack']);if(_0x4c2123['name']){delete _0x4c2123[_0x1327('0x3a')];}_0xfea15f[_0x1327('0x2c')](_0x2b1c5e)['send'](_0x4c2123);};}exports['index']=function(_0x18fd26,_0xa30733){var _0x1a4b69={'include':[{'model':db['Pause'],'as':_0x1327('0x3b')}]},_0x91c4d5={},_0x34b79a={'count':0x0,'rows':[]};var _0x380819=_[_0x1327('0x3c')](db['OpenchannelAccount']['rawAttributes'],function(_0x10f7d2){return{'name':_0x10f7d2['fieldName'],'type':_0x10f7d2[_0x1327('0x3d')][_0x1327('0x3e')]};});_0x91c4d5[_0x1327('0x3f')]=_[_0x1327('0x3c')](_0x380819,_0x1327('0x3a'));_0x91c4d5[_0x1327('0x40')]=_['keys'](_0x18fd26[_0x1327('0x40')]);_0x91c4d5[_0x1327('0x41')]=_[_0x1327('0x42')](_0x91c4d5[_0x1327('0x3f')],_0x91c4d5[_0x1327('0x40')]);_0x1a4b69['attributes']=_[_0x1327('0x42')](_0x91c4d5[_0x1327('0x3f')],qs[_0x1327('0x43')](_0x18fd26[_0x1327('0x40')][_0x1327('0x43')]));_0x1a4b69[_0x1327('0x44')]=_0x1a4b69['attributes'][_0x1327('0x45')]?_0x1a4b69['attributes']:_0x91c4d5[_0x1327('0x3f')];if(!_0x18fd26[_0x1327('0x40')][_0x1327('0x46')](_0x1327('0x47'))){_0x1a4b69['limit']=qs[_0x1327('0x2f')](_0x18fd26[_0x1327('0x40')][_0x1327('0x2f')]);_0x1a4b69[_0x1327('0x31')]=qs[_0x1327('0x31')](_0x18fd26[_0x1327('0x40')][_0x1327('0x31')]);}_0x1a4b69[_0x1327('0x48')]=qs['sort'](_0x18fd26['query'][_0x1327('0x49')]);_0x1a4b69[_0x1327('0x4a')]=qs[_0x1327('0x41')](_[_0x1327('0x4b')](_0x18fd26[_0x1327('0x40')],_0x91c4d5['filters']),_0x380819);if(_0x18fd26['query'][_0x1327('0x4c')]){_0x1a4b69[_0x1327('0x4a')]=_['merge'](_0x1a4b69[_0x1327('0x4a')],{'$or':_[_0x1327('0x3c')](_0x380819,function(_0x325bb3){if(_0x325bb3[_0x1327('0x3d')]!==_0x1327('0x4d')){var _0x45f3f7={};_0x45f3f7[_0x325bb3[_0x1327('0x3a')]]={'$like':'%'+_0x18fd26[_0x1327('0x40')]['filter']+'%'};return _0x45f3f7;}})});}_0x1a4b69=_['merge']({},_0x1a4b69,_0x18fd26['options']);var _0xe373f={'where':_0x1a4b69[_0x1327('0x4a')]};return db['OpenchannelAccount'][_0x1327('0x30')](_0xe373f)[_0x1327('0x21')](function(_0x3a0e37){_0x34b79a['count']=_0x3a0e37;if(_0x18fd26[_0x1327('0x40')]['includeAll']){_0x1a4b69[_0x1327('0x4e')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x1327('0x4f')](_0x1a4b69);})['then'](function(_0x2a0951){_0x34b79a[_0x1327('0x50')]=_0x2a0951;return _0x34b79a;})['then'](respondWithFilteredResult(_0xa30733,_0x1a4b69))[_0x1327('0x51')](handleError(_0xa30733,null));};exports['show']=function(_0x50d078,_0x109592){var _0x3e83f7={'raw':![],'where':{'id':_0x50d078['params']['id']},'include':[{'model':db[_0x1327('0x52')],'as':_0x1327('0x3b')}]},_0x2866d8={};_0x2866d8[_0x1327('0x3f')]=_[_0x1327('0x53')](db[_0x1327('0x54')][_0x1327('0x55')]);_0x2866d8[_0x1327('0x40')]=_[_0x1327('0x53')](_0x50d078['query']);_0x2866d8[_0x1327('0x41')]=_['intersection'](_0x2866d8[_0x1327('0x3f')],_0x2866d8[_0x1327('0x40')]);_0x3e83f7[_0x1327('0x44')]=_[_0x1327('0x42')](_0x2866d8[_0x1327('0x3f')],qs['fields'](_0x50d078[_0x1327('0x40')]['fields']));_0x3e83f7[_0x1327('0x44')]=_0x3e83f7[_0x1327('0x44')][_0x1327('0x45')]?_0x3e83f7[_0x1327('0x44')]:_0x2866d8['model'];if(_0x50d078['query']['includeAll']){_0x3e83f7[_0x1327('0x4e')]=[{'all':!![]}];}_0x3e83f7=_[_0x1327('0x56')]({},_0x3e83f7,_0x50d078[_0x1327('0x57')]);return db['OpenchannelAccount'][_0x1327('0x58')](_0x3e83f7)[_0x1327('0x21')](handleEntityNotFound(_0x109592,null))['then'](respondWithResult(_0x109592,null))['catch'](handleError(_0x109592,null));};exports[_0x1327('0x59')]=function(_0x188f82,_0x468677){return db[_0x1327('0x54')][_0x1327('0x59')](_0x188f82['body'],{})[_0x1327('0x21')](function(_0x4b9fbb){var _0x2bd76c=_0x188f82[_0x1327('0x5a')][_0x1327('0x38')]({'plain':!![]});if(!_0x2bd76c)throw new Error(_0x1327('0x5b'));if(_0x2bd76c[_0x1327('0x5c')]===_0x1327('0x5a')){var _0x2fc678=_0x4b9fbb[_0x1327('0x38')]({'plain':!![]});var _0x412678=_0x1327('0x5d');return db[_0x1327('0x5e')][_0x1327('0x58')]({'where':{'name':_0x412678,'userProfileId':_0x2bd76c[_0x1327('0x5f')]},'raw':!![]})[_0x1327('0x21')](function(_0x45624e){if(_0x45624e&&_0x45624e[_0x1327('0x60')]===0x0){return db[_0x1327('0x39')][_0x1327('0x59')]({'name':_0x2fc678[_0x1327('0x3a')],'resourceId':_0x2fc678['id'],'type':_0x45624e[_0x1327('0x3a')],'sectionId':_0x45624e['id']},{})['then'](function(){return _0x4b9fbb;});}else{return _0x4b9fbb;}})[_0x1327('0x51')](function(_0x2e8bf1){logger[_0x1327('0x28')](_0x1327('0x61'),_0x2e8bf1);throw _0x2e8bf1;});}return _0x4b9fbb;})[_0x1327('0x21')](respondWithResult(_0x468677,0xc9))[_0x1327('0x51')](handleError(_0x468677,null));};exports[_0x1327('0x62')]=function(_0x7a1366,_0x5058f6){if(_0x7a1366[_0x1327('0x63')]['id']){delete _0x7a1366[_0x1327('0x63')]['id'];}return db[_0x1327('0x54')][_0x1327('0x58')]({'where':{'id':_0x7a1366[_0x1327('0x64')]['id']},'include':[{'model':db[_0x1327('0x52')],'as':_0x1327('0x3b')}]})[_0x1327('0x21')](handleEntityNotFound(_0x5058f6,null))[_0x1327('0x21')](saveUpdates(_0x7a1366[_0x1327('0x63')],null))[_0x1327('0x21')](respondWithResult(_0x5058f6,null))[_0x1327('0x51')](handleError(_0x5058f6,null));};exports[_0x1327('0x37')]=function(_0x5dfaa9,_0xc8af08){return db['OpenchannelAccount'][_0x1327('0x58')]({'where':{'id':_0x5dfaa9[_0x1327('0x64')]['id']}})[_0x1327('0x21')](handleEntityNotFound(_0xc8af08,null))[_0x1327('0x21')](removeEntity(_0xc8af08,null))[_0x1327('0x51')](handleError(_0xc8af08,null));};exports['describe']=function(_0x45f646,_0x4901b7){return db['OpenchannelAccount'][_0x1327('0x65')]()[_0x1327('0x21')](respondWithResult(_0x4901b7,null))[_0x1327('0x51')](handleError(_0x4901b7,null));};exports[_0x1327('0x66')]=function(_0x38ecb3,_0x250f00,_0x35363c){if(_0x38ecb3[_0x1327('0x63')]['id']){delete _0x38ecb3['body']['id'];}return db[_0x1327('0x54')][_0x1327('0x58')]({'where':{'id':_0x38ecb3['params']['id']}})[_0x1327('0x21')](handleEntityNotFound(_0x250f00,null))['then'](function(_0x5d488e){if(_0x5d488e){_0x38ecb3[_0x1327('0x63')]['OpenchannelAccountId']=_0x5d488e['id'];return db['Disposition'][_0x1327('0x59')](_0x38ecb3[_0x1327('0x63')]);}})['then'](respondWithResult(_0x250f00,null))[_0x1327('0x51')](handleError(_0x250f00,null));};exports[_0x1327('0x67')]=function(_0x14565d,_0x2ab643,_0x43b11d){var _0x1d0c79={'raw':![],'where':{}};var _0x2b5838={};var _0x23576a={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x14565d[_0x1327('0x64')]['id']}})[_0x1327('0x21')](handleEntityNotFound(_0x2ab643,null))[_0x1327('0x21')](function(_0x497fef){if(_0x497fef){_0x2b5838[_0x1327('0x3f')]=_[_0x1327('0x53')](db['Disposition'][_0x1327('0x55')]);_0x2b5838[_0x1327('0x40')]=_[_0x1327('0x53')](_0x14565d[_0x1327('0x40')]);_0x2b5838['filters']=_[_0x1327('0x42')](_0x2b5838[_0x1327('0x3f')],_0x2b5838[_0x1327('0x40')]);_0x1d0c79[_0x1327('0x44')]=_[_0x1327('0x42')](_0x2b5838[_0x1327('0x3f')],qs[_0x1327('0x43')](_0x14565d[_0x1327('0x40')]['fields']));_0x1d0c79['attributes']=_0x1d0c79[_0x1327('0x44')][_0x1327('0x45')]?_0x1d0c79[_0x1327('0x44')]:_0x2b5838['model'];if(!_0x14565d[_0x1327('0x40')]['hasOwnProperty'](_0x1327('0x47'))){_0x1d0c79['limit']=qs[_0x1327('0x2f')](_0x14565d[_0x1327('0x40')][_0x1327('0x2f')]);_0x1d0c79[_0x1327('0x31')]=qs['offset'](_0x14565d[_0x1327('0x40')][_0x1327('0x31')]);}_0x1d0c79[_0x1327('0x48')]=qs['sort'](_0x14565d[_0x1327('0x40')][_0x1327('0x49')]);_0x1d0c79[_0x1327('0x4a')]=qs[_0x1327('0x41')](_[_0x1327('0x4b')](_0x14565d['query'],_0x2b5838[_0x1327('0x41')]));_0x1d0c79[_0x1327('0x4a')][_0x1327('0x68')]=_0x497fef['id'];if(_0x14565d[_0x1327('0x40')][_0x1327('0x4c')]){_0x1d0c79[_0x1327('0x4a')]=_['merge'](_0x1d0c79[_0x1327('0x4a')],{'$or':_[_0x1327('0x3c')](_0x1d0c79['attributes'],function(_0x411a24){var _0x5ad261={};_0x5ad261[_0x411a24]={'$like':'%'+_0x14565d[_0x1327('0x40')]['filter']+'%'};return _0x5ad261;})});}_0x1d0c79=_[_0x1327('0x56')]({},_0x1d0c79,_0x14565d[_0x1327('0x57')]);return db[_0x1327('0x69')][_0x1327('0x30')]({'where':_0x1d0c79[_0x1327('0x4a')]})[_0x1327('0x21')](function(_0x599cf6){_0x23576a[_0x1327('0x30')]=_0x599cf6;if(_0x14565d[_0x1327('0x40')][_0x1327('0x6a')]){_0x1d0c79[_0x1327('0x4e')]=[{'all':!![]}];}return db['Disposition'][_0x1327('0x4f')](_0x1d0c79);})[_0x1327('0x21')](function(_0x4b51f5){_0x23576a['rows']=_0x4b51f5;return _0x23576a;});}})['then'](respondWithFilteredResult(_0x2ab643,_0x1d0c79))[_0x1327('0x51')](handleError(_0x2ab643,null));};exports[_0x1327('0x6b')]=function(_0x40cc2,_0x1f8b18,_0x5737aa){return db[_0x1327('0x54')][_0x1327('0x58')]({'where':{'id':_0x40cc2[_0x1327('0x64')]['id']}})[_0x1327('0x21')](handleEntityNotFound(_0x1f8b18,null))[_0x1327('0x21')](function(_0x623c85){if(_0x623c85){return _0x623c85[_0x1327('0x6b')](_0x40cc2[_0x1327('0x40')]['ids']);}})[_0x1327('0x21')](respondWithStatusCode(_0x1f8b18,null))[_0x1327('0x51')](handleError(_0x1f8b18,null));};exports[_0x1327('0x6c')]=function(_0x27542e,_0x8fcbe5,_0x3850b3){if(_0x27542e['body']['id']){delete _0x27542e['body']['id'];}return db[_0x1327('0x54')][_0x1327('0x58')]({'where':{'id':_0x27542e[_0x1327('0x64')]['id']}})[_0x1327('0x21')](handleEntityNotFound(_0x8fcbe5,null))[_0x1327('0x21')](function(_0x1f1dc5){if(_0x1f1dc5){_0x27542e[_0x1327('0x63')]['OpenchannelAccountId']=_0x1f1dc5['id'];return db[_0x1327('0x6d')]['create'](_0x27542e[_0x1327('0x63')]);}})[_0x1327('0x21')](respondWithResult(_0x8fcbe5,null))['catch'](handleError(_0x8fcbe5,null));};exports[_0x1327('0x6e')]=function(_0x4f670e,_0x387762,_0x43f9d4){var _0x16a5b4={'raw':![],'where':{}};var _0x6f9dcf={};var _0x11f03d={'count':0x0,'rows':[]};return db[_0x1327('0x54')][_0x1327('0x6f')]({'where':{'id':_0x4f670e['params']['id']}})[_0x1327('0x21')](handleEntityNotFound(_0x387762,null))[_0x1327('0x21')](function(_0x1a1ffe){if(_0x1a1ffe){_0x6f9dcf['model']=_[_0x1327('0x53')](db[_0x1327('0x6d')][_0x1327('0x55')]);_0x6f9dcf[_0x1327('0x40')]=_[_0x1327('0x53')](_0x4f670e['query']);_0x6f9dcf[_0x1327('0x41')]=_[_0x1327('0x42')](_0x6f9dcf[_0x1327('0x3f')],_0x6f9dcf['query']);_0x16a5b4[_0x1327('0x44')]=_[_0x1327('0x42')](_0x6f9dcf[_0x1327('0x3f')],qs[_0x1327('0x43')](_0x4f670e[_0x1327('0x40')][_0x1327('0x43')]));_0x16a5b4[_0x1327('0x44')]=_0x16a5b4['attributes'][_0x1327('0x45')]?_0x16a5b4[_0x1327('0x44')]:_0x6f9dcf[_0x1327('0x3f')];if(!_0x4f670e[_0x1327('0x40')][_0x1327('0x46')](_0x1327('0x47'))){_0x16a5b4[_0x1327('0x2f')]=qs[_0x1327('0x2f')](_0x4f670e[_0x1327('0x40')][_0x1327('0x2f')]);_0x16a5b4[_0x1327('0x31')]=qs[_0x1327('0x31')](_0x4f670e[_0x1327('0x40')][_0x1327('0x31')]);}_0x16a5b4['order']=qs['sort'](_0x4f670e['query'][_0x1327('0x49')]);_0x16a5b4['where']=qs[_0x1327('0x41')](_[_0x1327('0x4b')](_0x4f670e[_0x1327('0x40')],_0x6f9dcf[_0x1327('0x41')]));_0x16a5b4[_0x1327('0x4a')][_0x1327('0x68')]=_0x1a1ffe['id'];if(_0x4f670e[_0x1327('0x40')]['filter']){_0x16a5b4[_0x1327('0x4a')]=_[_0x1327('0x56')](_0x16a5b4['where'],{'$or':_[_0x1327('0x3c')](_0x16a5b4[_0x1327('0x44')],function(_0x56eed8){var _0x3724ef={};_0x3724ef[_0x56eed8]={'$like':'%'+_0x4f670e[_0x1327('0x40')][_0x1327('0x4c')]+'%'};return _0x3724ef;})});}_0x16a5b4=_[_0x1327('0x56')]({},_0x16a5b4,_0x4f670e[_0x1327('0x57')]);return db[_0x1327('0x6d')][_0x1327('0x30')]({'where':_0x16a5b4[_0x1327('0x4a')]})['then'](function(_0x4b5752){_0x11f03d[_0x1327('0x30')]=_0x4b5752;if(_0x4f670e['query'][_0x1327('0x6a')]){_0x16a5b4['include']=[{'all':!![]}];}return db[_0x1327('0x6d')][_0x1327('0x4f')](_0x16a5b4);})['then'](function(_0x3781ea){_0x11f03d[_0x1327('0x50')]=_0x3781ea;return _0x11f03d;});}})[_0x1327('0x21')](respondWithFilteredResult(_0x387762,_0x16a5b4))[_0x1327('0x51')](handleError(_0x387762,null));};exports[_0x1327('0x70')]=function(_0x1e33a6,_0x5e936d,_0x397e71){return db['OpenchannelAccount'][_0x1327('0x58')]({'where':{'id':_0x1e33a6[_0x1327('0x64')]['id']}})[_0x1327('0x21')](handleEntityNotFound(_0x5e936d,null))[_0x1327('0x21')](function(_0x431fb8){if(_0x431fb8){return _0x431fb8[_0x1327('0x70')](_0x1e33a6[_0x1327('0x40')][_0x1327('0x71')]);}})[_0x1327('0x21')](respondWithStatusCode(_0x5e936d,null))[_0x1327('0x51')](handleError(_0x5e936d,null));};exports['notify']=function(_0x1f9789,_0x189d73,_0x28da46){var _0x3d7f3b={'body':_0x1f9789[_0x1327('0x63')],'channel':_0x1327('0x72')};var _0x252b90=[];var _0x434797=[];var _0x12e515={};var _0x7780d=![];return db[_0x1327('0x73')][_0x1327('0x65')]()[_0x1327('0x21')](function(_0x5585f3){if(!_0x5585f3){throw new db[(_0x1327('0x74'))][(_0x1327('0x75'))](_0x1327('0x76'));}_0x252b90=_[_0x1327('0x77')](_[_0x1327('0x53')](_0x5585f3),[_0x1327('0x78'),_0x1327('0x79')]);_0x434797=_['difference'](_['keys'](_0x5585f3),[_0x1327('0x78'),'updatedAt',_0x1327('0x7a'),_0x1327('0x7b')]);if(_0x1f9789[_0x1327('0x63')]['id']){delete _0x1f9789[_0x1327('0x63')]['id'];}if(_[_0x1327('0x7c')](_0x1f9789[_0x1327('0x63')][_0x1327('0x7d')])){throw new db[(_0x1327('0x74'))][(_0x1327('0x75'))](_0x1327('0x7e'));}if(_[_0x1327('0x7c')](_0x1f9789[_0x1327('0x63')][_0x1327('0x63')])||_0x1f9789[_0x1327('0x63')][_0x1327('0x63')]===''){throw new db['Sequelize'][(_0x1327('0x75'))](_0x1327('0x7f'));}if(_[_0x1327('0x7c')](_0x1f9789[_0x1327('0x63')][_0x1327('0x80')])){throw new db[(_0x1327('0x74'))][(_0x1327('0x75'))](_0x1327('0x81')+_0x434797);}if(!_[_0x1327('0x82')](_0x434797,_0x1f9789[_0x1327('0x63')]['mapKey'])){throw new db['Sequelize'][(_0x1327('0x75'))](_0x1327('0x83')+_0x434797);}_0x12e515[_0x1f9789[_0x1327('0x63')][_0x1327('0x80')]]=_0x1f9789[_0x1327('0x63')][_0x1327('0x7d')];})['then'](function(){return db[_0x1327('0x54')][_0x1327('0x58')]({'where':{'id':_0x1f9789[_0x1327('0x64')]['id']},'include':[{'model':db['CmList'],'as':_0x1327('0x84'),'include':[{'model':db['CmContact'],'as':_0x1327('0x85'),'where':_0x12e515,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x1327('0x86')],'as':_0x1327('0x87')}]});})['then'](handleEntityNotFound(_0x189d73,null))['then'](function(_0x1d98ca){if(_0x1d98ca&&_0x1d98ca[_0x1327('0x84')]){_0x3d7f3b[_0x1327('0x88')]=_0x1d98ca;_0x3d7f3b[_0x1327('0x89')]=_0x1d98ca[_0x1327('0x87')];_0x3d7f3b[_0x1327('0x8a')]=_0x1d98ca[_0x1327('0x84')];_0x3d7f3b[_0x1327('0x89')]=_[_0x1327('0x8b')](_0x3d7f3b[_0x1327('0x89')],['priority'],[_0x1327('0x8c')]);if(_0x3d7f3b[_0x1327('0x88')][_0x1327('0x87')]){delete _0x3d7f3b[_0x1327('0x88')]['Applications'];}if(_0x3d7f3b[_0x1327('0x88')]['List']&&_0x3d7f3b['account'][_0x1327('0x84')][_0x1327('0x85')][_0x1327('0x45')]){return _0x3d7f3b[_0x1327('0x88')][_0x1327('0x84')]['Contacts'][0x0];}var _0x5a5a8e=_['defaults'](_0x1f9789[_0x1327('0x63')],{'firstName':_0x1f9789[_0x1327('0x63')]['from'],'ListId':_0x1d98ca[_0x1327('0x7b')]});_0x5a5a8e[_0x1f9789['body'][_0x1327('0x80')]]=_0x1f9789[_0x1327('0x63')][_0x1327('0x7d')];return db[_0x1327('0x73')][_0x1327('0x59')](_0x5a5a8e,{'fields':_0x252b90,'raw':!![]});}})['then'](handleEntityNotFound(_0x189d73,null))[_0x1327('0x21')](function(_0x33d93a){_0x3d7f3b[_0x1327('0x8d')]=_0x33d93a;if(_0x33d93a){var _0x234eb0={'ContactId':_0x33d93a['id'],'OpenchannelAccountId':_0x1f9789[_0x1327('0x64')]['id'],'from':(_0x33d93a[_0x1327('0x8e')]||'')+'\x20'+(_0x33d93a[_0x1327('0x8f')]||'')};var _0x13c46c={'OpenchannelAccountId':_0x1f9789[_0x1327('0x64')]['id'],'closed':![]};if(_0x1f9789['body'][_0x1327('0x90')]){_0x13c46c[_0x1327('0x90')]=_0x1f9789[_0x1327('0x63')][_0x1327('0x90')];return db['OpenchannelInteraction'][_0x1327('0x58')]({'where':_0x13c46c})['then'](function(_0x1006fa){if(_0x1006fa){return[_0x1006fa,![]];}_0x234eb0['threadId']=_0x1f9789[_0x1327('0x63')][_0x1327('0x90')];_0x234eb0[_0x1327('0x91')]=_0x1f9789[_0x1327('0x63')][_0x1327('0x91')];return db[_0x1327('0x92')]['create'](_0x234eb0)[_0x1327('0x21')](function(_0x3e5eb3){return[_0x3e5eb3,!![]];});});}else{_0x13c46c[_0x1327('0x90')]=null;}_0x13c46c[_0x1327('0x93')]=_0x33d93a['id'];return db['OpenchannelInteraction'][_0x1327('0x58')]({'where':_0x13c46c})['then'](function(_0x1c5291){if(_0x1c5291){return[_0x1c5291,![]];}return db[_0x1327('0x92')][_0x1327('0x59')](_0x234eb0)[_0x1327('0x21')](function(_0x1b0dcd){return[_0x1b0dcd,!![]];});});}})[_0x1327('0x94')](function(_0x19e66e,_0x36c260){if(_0x19e66e){_0x7780d=_0x36c260;if(!_0x36c260){var _0x637927={'from':(_0x3d7f3b[_0x1327('0x8d')][_0x1327('0x8e')]||'')+'\x20'+(_0x3d7f3b[_0x1327('0x8d')]['lastName']||'')};if(_0x1f9789[_0x1327('0x63')][_0x1327('0x90')]&&_0x1f9789[_0x1327('0x63')]['messageId']&&_0x1f9789['body']['threadId']!=_0x1f9789[_0x1327('0x63')][_0x1327('0x95')]){_0x637927[_0x1327('0x90')]=_0x1f9789[_0x1327('0x63')]['messageId'];}return _0x19e66e[_0x1327('0x62')](_0x637927);}else{return _0x19e66e;}}})[_0x1327('0x21')](function(_0x2bf147){_0x3d7f3b[_0x1327('0x96')]=_0x2bf147[_0x1327('0x38')]({'plain':!![]});_0x3d7f3b[_0x1327('0x96')][_0x1327('0x97')]=_0x7780d;if(_0x3d7f3b[_0x1327('0x96')][_0x1327('0x97')]){if(_0x3d7f3b[_0x1327('0x88')]['autoclose']){_0x3d7f3b[_0x1327('0x89')][_0x1327('0x98')]({'id':0x0,'priority':_0x3d7f3b[_0x1327('0x89')][_0x1327('0x45')]+0x1,'app':_0x1327('0x99'),'appdata':'unmanaged','interval':_0x1327('0x9a')});}}return db[_0x1327('0x9b')][_0x1327('0x59')]({'body':_0x1f9789[_0x1327('0x63')][_0x1327('0x63')],'OpenchannelAccountId':_0x1f9789[_0x1327('0x64')]['id'],'OpenchannelInteractionId':_0x2bf147['id'],'direction':'in','ContactId':_0x3d7f3b['contact']['id'],'AttachmentId':_0x1f9789[_0x1327('0x63')][_0x1327('0x9c')]});})[_0x1327('0x21')](function(_0x418395){_0x3d7f3b[_0x1327('0x29')]=_0x418395;if(_0x3d7f3b[_0x1327('0x96')][_0x1327('0x9d')]){return db['User'][_0x1327('0x58')]({'attributes':['id','name'],'where':{'id':_0x3d7f3b[_0x1327('0x96')][_0x1327('0x9d')]}})[_0x1327('0x21')](function(_0x53c047){if(_0x53c047){_0x3d7f3b['applications'][_0x1327('0x9e')]({'id':0x0,'priority':0x0,'app':_0x1327('0x9f'),'appdata':_0x53c047[_0x1327('0x3a')]+','+(_0x3d7f3b['account']['waitForTheAssignedAgent']||0xa),'interval':_0x1327('0x9a')});_0x3d7f3b['forcedOwnership']=![];}return respondWithRpcPromise('Start',_0x1327('0xa0'),_0x3d7f3b);});}return respondWithRpcPromise(_0x1327('0xa1'),_0x1327('0xa0'),_0x3d7f3b);})[_0x1327('0x21')](function(_0x5b569a){respondWithRpcPromise('EventManager','EventManager',{'event':_0x1327('0xa2'),'message':_0x5b569a},client9002);return _0x5b569a;})['then'](respondWithResult(_0x189d73,null))[_0x1327('0x51')](handleError(_0x189d73,null));};exports[_0x1327('0xa3')]=function(_0x302dcb,_0x4c233e,_0x2e87f2){return db['OpenchannelAccount'][_0x1327('0x6f')]({'where':{'id':_0x302dcb[_0x1327('0x64')]['id']}})['then'](handleEntityNotFound(_0x4c233e,null))[_0x1327('0x21')](function(_0x4c5fc3){if(_0x4c5fc3){return db['sequelize']['transaction'](function(_0x47305b){return db[_0x1327('0x86')][_0x1327('0x37')]({'where':{'OpenchannelAccountId':_0x302dcb[_0x1327('0x64')]['id']},'transaction':_0x47305b})[_0x1327('0x21')](function(_0x4ec5cd){var _0x4aaa68=_[_0x1327('0x3c')](_0x302dcb[_0x1327('0x63')],function(_0x3812e4){_0x3812e4['OpenchannelAccountId']=_0x302dcb['params']['id'];return _0x3812e4;});return db[_0x1327('0x86')][_0x1327('0xa4')](_0x4aaa68,{'transaction':_0x47305b});});})[_0x1327('0x21')](function(){return db[_0x1327('0x86')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x302dcb[_0x1327('0x64')]['id']},'order':'priority'});});}})[_0x1327('0x21')](respondWithResult(_0x4c233e,null))[_0x1327('0x51')](handleError(_0x4c233e,null));};exports[_0x1327('0xa5')]=function(_0x554a34,_0x2b4fef,_0x102f79){var _0x576dc4={};var _0xb2c00f={};var _0x196d6d;var _0x3049b0;return db[_0x1327('0x54')][_0x1327('0x6f')]({'where':{'id':_0x554a34['params']['id']}})[_0x1327('0x21')](handleEntityNotFound(_0x2b4fef,null))[_0x1327('0x21')](function(_0x2953d0){if(_0x2953d0){_0x196d6d=_0x2953d0;_0xb2c00f[_0x1327('0x3f')]=_[_0x1327('0x53')](db[_0x1327('0x86')]['rawAttributes']);_0xb2c00f[_0x1327('0x40')]=_[_0x1327('0x53')](_0x554a34[_0x1327('0x40')]);_0xb2c00f['filters']=_[_0x1327('0x42')](_0xb2c00f[_0x1327('0x3f')],_0xb2c00f[_0x1327('0x40')]);_0x576dc4[_0x1327('0x44')]=_[_0x1327('0x42')](_0xb2c00f[_0x1327('0x3f')],qs[_0x1327('0x43')](_0x554a34[_0x1327('0x40')][_0x1327('0x43')]));_0x576dc4[_0x1327('0x44')]=_0x576dc4['attributes'][_0x1327('0x45')]?_0x576dc4[_0x1327('0x44')]:_0xb2c00f[_0x1327('0x3f')];_0x576dc4[_0x1327('0x48')]=qs[_0x1327('0x49')](_0x554a34[_0x1327('0x40')]['sort']);_0x576dc4[_0x1327('0x4a')]=qs['filters'](_[_0x1327('0x4b')](_0x554a34[_0x1327('0x40')],_0xb2c00f[_0x1327('0x41')]));if(_0x554a34[_0x1327('0x40')][_0x1327('0x4c')]){_0x576dc4['where']=_['merge'](_0x576dc4['where'],{'$or':_[_0x1327('0x3c')](_0x576dc4[_0x1327('0x44')],function(_0x11b695){var _0x21f925={};_0x21f925[_0x11b695]={'$like':'%'+_0x554a34[_0x1327('0x40')][_0x1327('0x4c')]+'%'};return _0x21f925;})});}_0x576dc4=_[_0x1327('0x56')]({},_0x576dc4,_0x554a34['options']);return _0x196d6d[_0x1327('0xa5')](_0x576dc4);}})[_0x1327('0x21')](function(_0x303fdd){if(_0x303fdd){_0x3049b0=_0x303fdd['length'];if(!_0x554a34[_0x1327('0x40')][_0x1327('0x46')]('nolimit')){_0x576dc4['limit']=qs[_0x1327('0x2f')](_0x554a34[_0x1327('0x40')][_0x1327('0x2f')]);_0x576dc4[_0x1327('0x31')]=qs[_0x1327('0x31')](_0x554a34[_0x1327('0x40')]['offset']);}return _0x196d6d[_0x1327('0xa5')](_0x576dc4);}})['then'](function(_0x47e658){if(_0x47e658){return _0x47e658?{'count':_0x3049b0,'rows':_0x47e658}:null;}})[_0x1327('0x21')](respondWithResult(_0x2b4fef,null))[_0x1327('0x51')](handleError(_0x2b4fef,null));};exports[_0x1327('0xa6')]=function(_0x3d6e5a,_0x34f150,_0x4816b6){var _0x14b3e6={'raw':![],'where':{}};var _0xdee606={};var _0x21373c={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x1327('0x6f')]({'where':{'id':_0x3d6e5a[_0x1327('0x64')]['id']}})[_0x1327('0x21')](handleEntityNotFound(_0x34f150,null))[_0x1327('0x21')](function(_0x2a58b8){if(_0x2a58b8){_0xdee606[_0x1327('0x3f')]=_['keys'](db[_0x1327('0x92')][_0x1327('0x55')]);_0xdee606[_0x1327('0x40')]=_['keys'](_0x3d6e5a['query']);_0xdee606[_0x1327('0x41')]=_[_0x1327('0x42')](_0xdee606['model'],_0xdee606[_0x1327('0x40')]);_0x14b3e6[_0x1327('0x44')]=_[_0x1327('0x42')](_0xdee606['model'],qs['fields'](_0x3d6e5a[_0x1327('0x40')][_0x1327('0x43')]));_0x14b3e6[_0x1327('0x44')]=_0x14b3e6[_0x1327('0x44')][_0x1327('0x45')]?_0x14b3e6[_0x1327('0x44')]:_0xdee606['model'];if(!_0x3d6e5a[_0x1327('0x40')][_0x1327('0x46')]('nolimit')){_0x14b3e6[_0x1327('0x2f')]=qs['limit'](_0x3d6e5a['query'][_0x1327('0x2f')]);_0x14b3e6[_0x1327('0x31')]=qs[_0x1327('0x31')](_0x3d6e5a['query'][_0x1327('0x31')]);}_0x14b3e6[_0x1327('0x48')]=qs[_0x1327('0x49')](_0x3d6e5a[_0x1327('0x40')][_0x1327('0x49')]);_0x14b3e6[_0x1327('0x4a')]=qs[_0x1327('0x41')](_[_0x1327('0x4b')](_0x3d6e5a[_0x1327('0x40')],_0xdee606[_0x1327('0x41')]));_0x14b3e6['where'][_0x1327('0x68')]=_0x2a58b8['id'];if(_0x3d6e5a['query'][_0x1327('0x4c')]){_0x14b3e6[_0x1327('0x4a')]=_[_0x1327('0x56')](_0x14b3e6[_0x1327('0x4a')],{'$or':_[_0x1327('0x3c')](_0x14b3e6[_0x1327('0x44')],function(_0x338294){var _0x78a994={};_0x78a994[_0x338294]={'$like':'%'+_0x3d6e5a[_0x1327('0x40')][_0x1327('0x4c')]+'%'};return _0x78a994;})});}_0x14b3e6=_[_0x1327('0x56')]({},_0x14b3e6,_0x3d6e5a['options']);return db[_0x1327('0x92')][_0x1327('0x30')]({'where':_0x14b3e6[_0x1327('0x4a')]})[_0x1327('0x21')](function(_0x508240){_0x21373c['count']=_0x508240;if(_0x3d6e5a[_0x1327('0x40')][_0x1327('0x6a')]){_0x14b3e6[_0x1327('0x4e')]=[{'model':db[_0x1327('0x73')],'as':_0x1327('0xa7'),'required':![]},{'model':db['User'],'as':'Owner','attributes':['name',_0x1327('0xa8'),_0x1327('0xa9')],'required':![]},{'model':db[_0x1327('0xaa')],'as':'Tags','attributes':['id',_0x1327('0x3a'),_0x1327('0xab')],'where':_0x3d6e5a[_0x1327('0x40')]['tag']?{'id':_0x3d6e5a['query'][_0x1327('0xac')]}:undefined,'required':_0x3d6e5a[_0x1327('0x40')]['tag']?!![]:![]}];}return db[_0x1327('0x92')][_0x1327('0x4f')](_0x14b3e6);})[_0x1327('0x21')](function(_0x2e8242){_0x21373c['rows']=_0x2e8242;return _0x21373c;});}})[_0x1327('0x21')](respondWithFilteredResult(_0x34f150,_0x14b3e6))['catch'](handleError(_0x34f150,null));};exports['addAgents']=function(_0x4842b6,_0xf40635,_0x33bc0c){return db[_0x1327('0x54')][_0x1327('0x58')]({'where':{'id':_0x4842b6[_0x1327('0x64')]['id']}})['then'](handleEntityNotFound(_0xf40635,null))['then'](function(_0x21ba83){if(_0x21ba83){return _0x21ba83['addAgents'](_0x4842b6[_0x1327('0x63')][_0x1327('0x71')],_['omit'](_0x4842b6['body'],[_0x1327('0x71'),'id'])||{})[_0x1327('0x94')](function(_0x3a57f8){for(var _0x184c96=0x0;_0x184c96<_0x4842b6[_0x1327('0x63')][_0x1327('0x71')]['length'];_0x184c96+=0x1){socket[_0x1327('0xad')]('userOpenchannelAccount:save',{'UserId':Number(_0x4842b6['body']['ids'][_0x184c96]),'OpenchannelAccountId':Number(_0x4842b6[_0x1327('0x64')]['id'])});}return _0x3a57f8;});}})['then'](respondWithResult(_0xf40635,null))[_0x1327('0x51')](handleError(_0xf40635,null));};exports[_0x1327('0xae')]=function(_0x1ef581,_0x493916,_0x28e9ed){return db[_0x1327('0x54')][_0x1327('0x58')]({'where':{'id':_0x1ef581[_0x1327('0x64')]['id']}})[_0x1327('0x21')](handleEntityNotFound(_0x493916,null))[_0x1327('0x21')](function(_0x537568){if(_0x537568){return _0x537568[_0x1327('0xae')](_0x1ef581[_0x1327('0x40')][_0x1327('0x71')])[_0x1327('0x21')](function(){if(_[_0x1327('0xaf')](_0x1ef581['query']['ids'])){for(var _0x3b8318=0x0;_0x3b8318<_0x1ef581[_0x1327('0x40')][_0x1327('0x71')][_0x1327('0x45')];_0x3b8318+=0x1){socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x1ef581['query'][_0x1327('0x71')][_0x3b8318]),'OpenchannelAccountId':Number(_0x1ef581['params']['id'])});}}else{socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x1ef581['query']['ids']),'OpenchannelAccountId':Number(_0x1ef581['params']['id'])});}});}})[_0x1327('0x21')](respondWithStatusCode(_0x493916,null))[_0x1327('0x51')](handleError(_0x493916,null));};exports[_0x1327('0xb0')]=function(_0x5b841f,_0x4c3d15,_0xcf92a6){var _0x3dda4b={};var _0x24f45f={};var _0x48b521;var _0xef0870;return db[_0x1327('0x54')][_0x1327('0x6f')]({'where':{'id':_0x5b841f[_0x1327('0x64')]['id']}})[_0x1327('0x21')](handleEntityNotFound(_0x4c3d15,null))[_0x1327('0x21')](function(_0x392b61){if(_0x392b61){_0x48b521=_0x392b61;_0x24f45f[_0x1327('0x3f')]=_[_0x1327('0x53')](db[_0x1327('0xb1')][_0x1327('0x55')]);_0x24f45f[_0x1327('0x40')]=_[_0x1327('0x53')](_0x5b841f['query']);_0x24f45f[_0x1327('0x41')]=_[_0x1327('0x42')](_0x24f45f[_0x1327('0x3f')],_0x24f45f[_0x1327('0x40')]);_0x3dda4b[_0x1327('0x44')]=_[_0x1327('0x42')](_0x24f45f[_0x1327('0x3f')],qs[_0x1327('0x43')](_0x5b841f[_0x1327('0x40')][_0x1327('0x43')]));_0x3dda4b['attributes']=_0x3dda4b['attributes'][_0x1327('0x45')]?_0x3dda4b[_0x1327('0x44')]:_0x24f45f['model'];_0x3dda4b[_0x1327('0x48')]=qs[_0x1327('0x49')](_0x5b841f['query']['sort']);_0x3dda4b[_0x1327('0x4a')]=qs[_0x1327('0x41')](_[_0x1327('0x4b')](_0x5b841f[_0x1327('0x40')],_0x24f45f[_0x1327('0x41')]));if(_0x5b841f['query']['filter']){_0x3dda4b['where']=_['merge'](_0x3dda4b[_0x1327('0x4a')],{'$or':_[_0x1327('0x3c')](_0x3dda4b[_0x1327('0x44')],function(_0x9c7f07){var _0x3d1f6c={};_0x3d1f6c[_0x9c7f07]={'$like':'%'+_0x5b841f[_0x1327('0x40')]['filter']+'%'};return _0x3d1f6c;})});}_0x3dda4b=_[_0x1327('0x56')]({},_0x3dda4b,_0x5b841f['options']);return _0x48b521[_0x1327('0xb0')](_0x3dda4b);}})[_0x1327('0x21')](function(_0x2bbc3e){if(_0x2bbc3e){_0xef0870=_0x2bbc3e[_0x1327('0x45')];if(!_0x5b841f[_0x1327('0x40')][_0x1327('0x46')](_0x1327('0x47'))){_0x3dda4b[_0x1327('0x2f')]=qs[_0x1327('0x2f')](_0x5b841f[_0x1327('0x40')][_0x1327('0x2f')]);_0x3dda4b[_0x1327('0x31')]=qs['offset'](_0x5b841f[_0x1327('0x40')][_0x1327('0x31')]);}return _0x48b521[_0x1327('0xb0')](_0x3dda4b);}})[_0x1327('0x21')](function(_0x5aaf85){if(_0x5aaf85){return _0x5aaf85?{'count':_0xef0870,'rows':_0x5aaf85}:null;}})[_0x1327('0x21')](respondWithResult(_0x4c3d15,null))['catch'](handleError(_0x4c3d15,null));};exports[_0x1327('0xb2')]=function(_0x8ba9e9,_0x4b28f8,_0x411202){var _0x451c9e,_0x51b020,_0x309bc9;if(_[_0x1327('0x7c')](_0x8ba9e9[_0x1327('0x63')]['body'])||_0x8ba9e9[_0x1327('0x63')][_0x1327('0x63')]===''){throw new db['Sequelize'][(_0x1327('0x75'))](_0x1327('0x7f'));}if(_[_0x1327('0x7c')](_0x8ba9e9[_0x1327('0x63')]['to'])){}_0x451c9e=_0x8ba9e9[_0x1327('0x63')]['to'];return db[_0x1327('0x54')][_0x1327('0x6f')]({'where':{'id':_0x8ba9e9[_0x1327('0x64')]['id']}})[_0x1327('0x21')](handleEntityNotFound(_0x4b28f8,null))[_0x1327('0x21')](function(_0x2fe82e){if(_0x2fe82e){return db[_0x1327('0x54')][_0x1327('0x58')]({'where':{'id':_0x2fe82e['id']},'include':[{'model':db[_0x1327('0xb3')],'as':'List','include':[{'model':db[_0x1327('0x73')],'as':_0x1327('0x85'),'where':{[_0x2fe82e[_0x1327('0x80')]]:_0x451c9e},'limit':0x1,'order':[[_0x1327('0x79'),_0x1327('0xb4')]]}]}]})[_0x1327('0x21')](handleEntityNotFound(_0x4b28f8,null))['then'](function(_0x241362){if(_0x241362&&_0x241362[_0x1327('0x84')]){_0x51b020=_0x241362['get']({'plain':!![]});if(_0x51b020[_0x1327('0x84')]&&_0x51b020[_0x1327('0x84')]['Contacts'][_0x1327('0x45')]){return _0x51b020[_0x1327('0x84')][_0x1327('0x85')][0x0];}return db[_0x1327('0x73')]['create'](_[_0x1327('0x18')](_0x8ba9e9[_0x1327('0x63')],{'firstName':_0x451c9e,[_0x241362[_0x1327('0x80')]]:_0x451c9e,'phone':_0x451c9e,'ListId':_0x51b020[_0x1327('0x7b')]}));}})['then'](handleEntityNotFound(_0x4b28f8,null))['then'](function(_0x5cf526){if(_0x5cf526){_0x309bc9=_0x5cf526;return db[_0x1327('0x92')][_0x1327('0x58')]({'where':{'ContactId':_0x309bc9['id'],'closed':![],'OpenchannelAccountId':_0x51b020['id']}})['then'](function(_0x653d5c){if(_0x653d5c){return[_0x653d5c,![]];}return db[_0x1327('0x92')][_0x1327('0x59')]({'UserId':_0x8ba9e9[_0x1327('0x5a')]['id'],'ContactId':_0x309bc9['id'],'OpenchannelAccountId':_0x51b020['id'],'lastMsgDirection':_0x1327('0xb5'),'Messages':[_[_0x1327('0x56')](_0x8ba9e9[_0x1327('0x63')],{'read':![],'body':_0x8ba9e9[_0x1327('0x63')][_0x1327('0x63')],'OpenchannelAccountId':_0x51b020['id'],'UserId':_0x8ba9e9[_0x1327('0x5a')]['id'],'ContactId':_0x309bc9['id']})]},{'include':[{'model':db[_0x1327('0x9b')],'as':_0x1327('0xb6')}]})['then'](function(_0x3c9725){return[_0x3c9725,!![]];});});}})[_0x1327('0x94')](function(_0x1d3464,_0x1c481c){if(_0x1c481c){return _0x1d3464;}return db[_0x1327('0x9b')][_0x1327('0x59')](_['merge'](_0x8ba9e9[_0x1327('0x63')],{'read':![],'body':_0x8ba9e9['body'][_0x1327('0x63')],'OpenchannelAccountId':_0x51b020['id'],'OpenchannelInteractionId':_0x1d3464['id'],'UserId':_0x8ba9e9[_0x1327('0x5a')]['id'],'ContactId':_0x309bc9['id']}))['then'](function(_0x39c1dd){_0x1d3464[_0x1327('0xb7')][_0x1327('0xb6')]=[];_0x1d3464[_0x1327('0xb7')][_0x1327('0xb6')]['push'](_0x39c1dd['dataValues']);return _0x1d3464;});});}})[_0x1327('0x21')](respondWithResult(_0x4b28f8,null))['catch'](handleError(_0x4b28f8,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index ca8e7cf..69ce255 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 _0xd8b0=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x144e42,_0x2ba520){var _0x881228=function(_0x9f31dd){while(--_0x9f31dd){_0x144e42['push'](_0x144e42['shift']());}};_0x881228(++_0x2ba520);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x0d8b('0x0'));var OpenchannelAccount=require(_0x0d8b('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0d8b('0x2'),'afterDestroy':_0x0d8b('0x3')};function emitEvent(_0x43bca1){return function(_0x364286,_0x8196ed,_0x577834){OpenchannelAccountEvents['emit'](_0x43bca1+':'+_0x364286['id'],_0x364286);OpenchannelAccountEvents[_0x0d8b('0x4')](_0x43bca1,_0x364286);_0x577834(null);};}for(var e in events){if(events[_0x0d8b('0x5')](e)){var event=events[e];OpenchannelAccount[_0x0d8b('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0xb4e6=['update','remove','emit','hook','events','OpenchannelAccount','setMaxListeners','save'];(function(_0x7ad478,_0x2e89ef){var _0x1c660c=function(_0x1191c2){while(--_0x1191c2){_0x7ad478['push'](_0x7ad478['shift']());}};_0x1c660c(++_0x2e89ef);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x3e531a,_0x28a82a){_0x3e531a=_0x3e531a-0x0;var _0x3c2574=_0xb4e6[_0x3e531a];return _0x3c2574;};'use strict';var EventEmitter=require(_0x6b4e('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0x6b4e('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x6b4e('0x2')](0x0);var events={'afterCreate':_0x6b4e('0x3'),'afterUpdate':_0x6b4e('0x4'),'afterDestroy':_0x6b4e('0x5')};function emitEvent(_0x31e8ad){return function(_0x1929b8,_0x52313b,_0x40da90){OpenchannelAccountEvents[_0x6b4e('0x6')](_0x31e8ad+':'+_0x1929b8['id'],_0x1929b8);OpenchannelAccountEvents[_0x6b4e('0x6')](_0x31e8ad,_0x1929b8);_0x40da90(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x6b4e('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 7d29fd6..f60f882 100644 --- a/server/api/openchannelAccount/openchannelAccount.model.js +++ b/server/api/openchannelAccount/openchannelAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x2af0af,_0x5d7b33){var _0x4fea38=function(_0x3ba949){while(--_0x3ba949){_0x2af0af['push'](_0x2af0af['shift']());}};_0x4fea38(++_0x5d7b33);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x592190,_0x2fb959){var _0x344561=function(_0x1e8422){while(--_0x1e8422){_0x592190['push'](_0x592190['shift']());}};_0x344561(++_0x2fb959);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.rpc.js b/server/api/openchannelAccount/openchannelAccount.rpc.js index 7ce566f..91872b7 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 _0xe1e3=['catch','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','request','then','info','stringify','code','error','OpenchannelAccount,\x20%s,\x20%s','message','request\x20sent','result'];(function(_0x488ed0,_0xfa9267){var _0x5aa3ae=function(_0x4ccd76){while(--_0x4ccd76){_0x488ed0['push'](_0x488ed0['shift']());}};_0x5aa3ae(++_0xfa9267);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x1d3792,_0x57ef91){_0x1d3792=_0x1d3792-0x0;var _0x55269e=_0xe1e3[_0x1d3792];return _0x55269e;};'use strict';var _=require(_0x3e1e('0x0'));var util=require(_0x3e1e('0x1'));var moment=require('moment');var BPromise=require(_0x3e1e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e1e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3e1e('0x4'))(_0x3e1e('0x5'));var config=require(_0x3e1e('0x6'));var jayson=require(_0x3e1e('0x7'));var client=jayson[_0x3e1e('0x8')][_0x3e1e('0x9')]({'port':0x232a});config['redis']=_[_0x3e1e('0xa')](config[_0x3e1e('0xb')],{'host':_0x3e1e('0xc'),'port':0x18eb});var socket=require(_0x3e1e('0xd'))(new Redis(config[_0x3e1e('0xb')]));require(_0x3e1e('0xe'))['register'](socket);function respondWithRpcPromise(_0x5c4c25,_0x5060e8,_0x31d205){return new BPromise(function(_0x5b0df8,_0x349460){return client[_0x3e1e('0xf')](_0x5c4c25,_0x31d205)[_0x3e1e('0x10')](function(_0x594c59){logger[_0x3e1e('0x11')]('OpenchannelAccount,\x20%s,\x20%s',_0x5060e8,'request\x20sent');logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x5060e8,'request\x20sent',JSON[_0x3e1e('0x12')](_0x594c59));if(_0x594c59['error']){if(_0x594c59['error'][_0x3e1e('0x13')]===0x1f4){logger[_0x3e1e('0x14')](_0x3e1e('0x15'),_0x5060e8,_0x594c59['error']['message']);return _0x349460(_0x594c59[_0x3e1e('0x14')][_0x3e1e('0x16')]);}logger['error'](_0x3e1e('0x15'),_0x5060e8,_0x594c59[_0x3e1e('0x14')]['message']);return _0x5b0df8(_0x594c59[_0x3e1e('0x14')]['message']);}else{logger[_0x3e1e('0x11')](_0x3e1e('0x15'),_0x5060e8,_0x3e1e('0x17'));_0x5b0df8(_0x594c59[_0x3e1e('0x18')][_0x3e1e('0x16')]);}})[_0x3e1e('0x19')](function(_0x569f49){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x5060e8,_0x569f49);_0x349460(_0x569f49);});});} \ No newline at end of file +var _0x0565=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','lodash'];(function(_0x4f06bf,_0x3d0930){var _0x172d26=function(_0x18d9a2){while(--_0x18d9a2){_0x4f06bf['push'](_0x4f06bf['shift']());}};_0x172d26(++_0x3d0930);}(_0x0565,0xf2));var _0x5056=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x0565[_0x24f31b];return _0x488401;};'use strict';var _=require(_0x5056('0x0'));var util=require(_0x5056('0x1'));var moment=require(_0x5056('0x2'));var BPromise=require(_0x5056('0x3'));var rs=require(_0x5056('0x4'));var fs=require('fs');var Redis=require(_0x5056('0x5'));var db=require(_0x5056('0x6'))['db'];var utils=require(_0x5056('0x7'));var logger=require(_0x5056('0x8'))(_0x5056('0x9'));var config=require('../../config/environment');var jayson=require(_0x5056('0xa'));var client=jayson[_0x5056('0xb')][_0x5056('0xc')]({'port':0x232a});config[_0x5056('0xd')]=_['defaults'](config['redis'],{'host':_0x5056('0xe'),'port':0x18eb});var socket=require(_0x5056('0xf'))(new Redis(config[_0x5056('0xd')]));require(_0x5056('0x10'))[_0x5056('0x11')](socket);function respondWithRpcPromise(_0x68efb2,_0x1fa531,_0x332cd7){return new BPromise(function(_0x5d2e60,_0x78f7e4){return client[_0x5056('0x12')](_0x68efb2,_0x332cd7)[_0x5056('0x13')](function(_0x5ab4b2){logger['info'](_0x5056('0x14'),_0x1fa531,'request\x20sent');logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x1fa531,_0x5056('0x15'),JSON['stringify'](_0x5ab4b2));if(_0x5ab4b2[_0x5056('0x16')]){if(_0x5ab4b2[_0x5056('0x16')][_0x5056('0x17')]===0x1f4){logger['error'](_0x5056('0x14'),_0x1fa531,_0x5ab4b2[_0x5056('0x16')][_0x5056('0x18')]);return _0x78f7e4(_0x5ab4b2[_0x5056('0x16')][_0x5056('0x18')]);}logger[_0x5056('0x16')]('OpenchannelAccount,\x20%s,\x20%s',_0x1fa531,_0x5ab4b2[_0x5056('0x16')]['message']);return _0x5d2e60(_0x5ab4b2[_0x5056('0x16')][_0x5056('0x18')]);}else{logger[_0x5056('0x19')](_0x5056('0x14'),_0x1fa531,_0x5056('0x15'));_0x5d2e60(_0x5ab4b2['result'][_0x5056('0x18')]);}})[_0x5056('0x1a')](function(_0x4f8fa7){logger['error'](_0x5056('0x14'),_0x1fa531,_0x4f8fa7);_0x78f7e4(_0x4f8fa7);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index fe42055..1a3ceeb 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 _0x34e5=['update','emit','removeListener','register','length','openchannelAccount:','save'];(function(_0x33f773,_0x1bf624){var _0xab6579=function(_0x3ba962){while(--_0x3ba962){_0x33f773['push'](_0x33f773['shift']());}};_0xab6579(++_0x1bf624);}(_0x34e5,0x172));var _0x534e=function(_0x528815,_0x3fba34){_0x528815=_0x528815-0x0;var _0x464777=_0x34e5[_0x528815];return _0x464777;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x534e('0x0'),'remove',_0x534e('0x1')];function createListener(_0x467e3e,_0x425ae8){return function(_0x246650){_0x425ae8[_0x534e('0x2')](_0x467e3e,_0x246650);};}function removeListener(_0x50b790,_0x11a158){return function(){OpenchannelAccountEvents[_0x534e('0x3')](_0x50b790,_0x11a158);};}exports[_0x534e('0x4')]=function(_0x117f0c){for(var _0x436a92=0x0,_0x2d0370=events[_0x534e('0x5')];_0x436a92<_0x2d0370;_0x436a92++){var _0x5620d4=events[_0x436a92];var _0x24d562=createListener(_0x534e('0x6')+_0x5620d4,_0x117f0c);OpenchannelAccountEvents['on'](_0x5620d4,_0x24d562);}}; \ No newline at end of file +var _0x8f37=['remove','emit','register','openchannelAccount:','./openchannelAccount.events','save'];(function(_0x16c656,_0x142f05){var _0x5b82de=function(_0x3c45f9){while(--_0x3c45f9){_0x16c656['push'](_0x16c656['shift']());}};_0x5b82de(++_0x142f05);}(_0x8f37,0x190));var _0x78f3=function(_0x5aeb91,_0x5b1e12){_0x5aeb91=_0x5aeb91-0x0;var _0x25b67c=_0x8f37[_0x5aeb91];return _0x25b67c;};'use strict';var OpenchannelAccountEvents=require(_0x78f3('0x0'));var events=[_0x78f3('0x1'),_0x78f3('0x2'),'update'];function createListener(_0x542bc0,_0x2a7d93){return function(_0x3c1fa6){_0x2a7d93[_0x78f3('0x3')](_0x542bc0,_0x3c1fa6);};}function removeListener(_0x539794,_0x1d59a5){return function(){OpenchannelAccountEvents['removeListener'](_0x539794,_0x1d59a5);};}exports[_0x78f3('0x4')]=function(_0x597b85){for(var _0x11c6ad=0x0,_0x3dc185=events['length'];_0x11c6ad<_0x3dc185;_0x11c6ad++){var _0x58bd73=events[_0x11c6ad];var _0x55e353=createListener(_0x78f3('0x5')+_0x58bd73,_0x597b85);OpenchannelAccountEvents['on'](_0x58bd73,_0x55e353);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 2353d18..6950450 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 _0xc39d=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','post','create','put','update','delete','/:id','destroy','exports','multer','path','connect-timeout'];(function(_0x149e7b,_0x1b9171){var _0x40803d=function(_0x5ee3a2){while(--_0x5ee3a2){_0x149e7b['push'](_0x149e7b['shift']());}};_0x40803d(++_0x1b9171);}(_0xc39d,0xf9));var _0xdc39=function(_0x13adc3,_0x167996){_0x13adc3=_0x13adc3-0x0;var _0x510b09=_0xc39d[_0x13adc3];return _0x510b09;};'use strict';var multer=require(_0xdc39('0x0'));var util=require('util');var path=require(_0xdc39('0x1'));var timeout=require(_0xdc39('0x2'));var express=require(_0xdc39('0x3'));var router=express[_0xdc39('0x4')]();var fs_extra=require(_0xdc39('0x5'));var auth=require(_0xdc39('0x6'));var interaction=require(_0xdc39('0x7'));var config=require(_0xdc39('0x8'));var controller=require(_0xdc39('0x9'));router[_0xdc39('0xa')]('/',auth[_0xdc39('0xb')](),controller[_0xdc39('0xc')]);router[_0xdc39('0xa')]('/:id',auth[_0xdc39('0xb')](),controller['show']);router[_0xdc39('0xd')]('/',auth[_0xdc39('0xb')](),controller[_0xdc39('0xe')]);router[_0xdc39('0xf')]('/:id',auth[_0xdc39('0xb')](),controller[_0xdc39('0x10')]);router[_0xdc39('0x11')](_0xdc39('0x12'),auth[_0xdc39('0xb')](),controller[_0xdc39('0x13')]);module[_0xdc39('0x14')]=router; \ No newline at end of file +var _0x12b5=['show','create','put','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x38a004,_0x2e7541){var _0x42c477=function(_0x370bb6){while(--_0x370bb6){_0x38a004['push'](_0x38a004['shift']());}};_0x42c477(++_0x2e7541);}(_0x12b5,0x136));var _0x512b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x12b5[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x512b('0x0'));var util=require(_0x512b('0x1'));var path=require(_0x512b('0x2'));var timeout=require(_0x512b('0x3'));var express=require(_0x512b('0x4'));var router=express[_0x512b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x512b('0x6'));var interaction=require(_0x512b('0x7'));var config=require(_0x512b('0x8'));var controller=require('./openchannelApplication.controller');router[_0x512b('0x9')]('/',auth[_0x512b('0xa')](),controller[_0x512b('0xb')]);router['get'](_0x512b('0xc'),auth[_0x512b('0xa')](),controller[_0x512b('0xd')]);router['post']('/',auth[_0x512b('0xa')](),controller[_0x512b('0xe')]);router[_0x512b('0xf')](_0x512b('0xc'),auth[_0x512b('0xa')](),controller['update']);router['delete']('/:id',auth[_0x512b('0xa')](),controller[_0x512b('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index bfaef55..e97a080 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 _0xeace=['INTEGER','noop','STRING','exports'];(function(_0x4a7273,_0x3ec3dc){var _0x4502c1=function(_0x3debce){while(--_0x3debce){_0x4a7273['push'](_0x4a7273['shift']());}};_0x4502c1(++_0x3ec3dc);}(_0xeace,0xd3));var _0xeeac=function(_0x4a7308,_0x4349c3){_0x4a7308=_0x4a7308-0x0;var _0x275f3f=_0xeace[_0x4a7308];return _0x275f3f;};'use strict';var Sequelize=require('sequelize');module[_0xeeac('0x0')]={'priority':{'type':Sequelize[_0xeeac('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xeeac('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xeeac('0x3')]},'interval':{'type':Sequelize[_0xeeac('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x125a=['TEXT','*,*,*,*','sequelize','exports','STRING','noop'];(function(_0x4dd566,_0xb70f5a){var _0x57a60f=function(_0x513669){while(--_0x513669){_0x4dd566['push'](_0x4dd566['shift']());}};_0x57a60f(++_0xb70f5a);}(_0x125a,0xce));var _0xa125=function(_0x31a576,_0x424419){_0x31a576=_0x31a576-0x0;var _0x30b1d3=_0x125a[_0x31a576];return _0x30b1d3;};'use strict';var Sequelize=require(_0xa125('0x0'));module[_0xa125('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xa125('0x2')],'allowNull':![],'defaultValue':_0xa125('0x3')},'appdata':{'type':Sequelize[_0xa125('0x4')]()},'description':{'type':Sequelize[_0xa125('0x2')]},'interval':{'type':Sequelize[_0xa125('0x2')],'defaultValue':_0xa125('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index fda7368..96d782e 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 _0x84fb=['stack','name','send','index','OpenchannelApplication','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','merge','map','type','VIRTUAL','options','includeAll','include','findAll','then','rows','fields','length','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','error'];(function(_0x3ca007,_0xa2d7d4){var _0xafbcc9=function(_0x17194d){while(--_0x17194d){_0x3ca007['push'](_0x3ca007['shift']());}};_0xafbcc9(++_0xa2d7d4);}(_0x84fb,0xc0));var _0xb84f=function(_0x38c7ef,_0x5f3ead){_0x38c7ef=_0x38c7ef-0x0;var _0x14bcb5=_0x84fb[_0x38c7ef];return _0x14bcb5;};'use strict';var emlformat=require(_0xb84f('0x0'));var rimraf=require(_0xb84f('0x1'));var zipdir=require(_0xb84f('0x2'));var jsonpatch=require(_0xb84f('0x3'));var rp=require(_0xb84f('0x4'));var moment=require(_0xb84f('0x5'));var BPromise=require(_0xb84f('0x6'));var Mustache=require(_0xb84f('0x7'));var util=require(_0xb84f('0x8'));var path=require(_0xb84f('0x9'));var sox=require(_0xb84f('0xa'));var csv=require('to-csv');var ejs=require(_0xb84f('0xb'));var fs=require('fs');var fs_extra=require(_0xb84f('0xc'));var _=require(_0xb84f('0xd'));var squel=require(_0xb84f('0xe'));var crypto=require('crypto');var jsforce=require(_0xb84f('0xf'));var deskjs=require(_0xb84f('0x10'));var toCsv=require('to-csv');var querystring=require(_0xb84f('0x11'));var Papa=require(_0xb84f('0x12'));var Redis=require(_0xb84f('0x13'));var authService=require(_0xb84f('0x14'));var qs=require(_0xb84f('0x15'));var as=require(_0xb84f('0x16'));var hardwareService=require(_0xb84f('0x17'));var logger=require(_0xb84f('0x18'))(_0xb84f('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x32b8f4,_0x141dcb){_0x141dcb=_0x141dcb||0xcc;return function(_0x27aba1){if(_0x27aba1){return _0x32b8f4[_0xb84f('0x1a')](_0x141dcb);}return _0x32b8f4[_0xb84f('0x1b')](_0x141dcb)[_0xb84f('0x1c')]();};}function respondWithResult(_0x356b62,_0x1d1ef7){_0x1d1ef7=_0x1d1ef7||0xc8;return function(_0x486c73){if(_0x486c73){return _0x356b62[_0xb84f('0x1b')](_0x1d1ef7)[_0xb84f('0x1d')](_0x486c73);}};}function respondWithFilteredResult(_0x28b7e2,_0x767003){return function(_0x17e32e){if(_0x17e32e){var _0x409b13=typeof _0x767003[_0xb84f('0x1e')]===_0xb84f('0x1f')&&typeof _0x767003[_0xb84f('0x20')]===_0xb84f('0x1f');var _0x5a9379=_0x17e32e[_0xb84f('0x21')];var _0x3bd49d=_0x409b13?0x0:_0x767003[_0xb84f('0x1e')];var _0x6c5a53=_0x409b13?_0x17e32e['count']:_0x767003[_0xb84f('0x1e')]+_0x767003[_0xb84f('0x20')];var _0x173f9c;if(_0x6c5a53>=_0x5a9379){_0x6c5a53=_0x5a9379;_0x173f9c=0xc8;}else{_0x173f9c=0xce;}_0x28b7e2[_0xb84f('0x1b')](_0x173f9c);return _0x28b7e2[_0xb84f('0x22')](_0xb84f('0x23'),_0x3bd49d+'-'+_0x6c5a53+'/'+_0x5a9379)['json'](_0x17e32e);}return null;};}function patchUpdates(_0x2a447a){return function(_0x11b9b4){try{jsonpatch[_0xb84f('0x24')](_0x11b9b4,_0x2a447a,!![]);}catch(_0x49846c){return BPromise[_0xb84f('0x25')](_0x49846c);}return _0x11b9b4[_0xb84f('0x26')]();};}function saveUpdates(_0x5a1cf8,_0x1b4301){return function(_0x5c8c61){if(_0x5c8c61){return _0x5c8c61[_0xb84f('0x27')](_0x5a1cf8)['then'](function(_0x43ef35){return _0x43ef35;});}return null;};}function removeEntity(_0x385a73,_0x57d30c){return function(_0x4759c1){if(_0x4759c1){return _0x4759c1[_0xb84f('0x28')]()['then'](function(){_0x385a73['status'](0xcc)[_0xb84f('0x1c')]();});}};}function handleEntityNotFound(_0x50505e,_0x1e53be){return function(_0x4fc45b){if(!_0x4fc45b){_0x50505e[_0xb84f('0x1a')](0x194);}return _0x4fc45b;};}function handleError(_0x5cfdac,_0x539f95){_0x539f95=_0x539f95||0x1f4;return function(_0x1494c7){logger[_0xb84f('0x29')](_0x1494c7[_0xb84f('0x2a')]);if(_0x1494c7[_0xb84f('0x2b')]){delete _0x1494c7[_0xb84f('0x2b')];}_0x5cfdac[_0xb84f('0x1b')](_0x539f95)[_0xb84f('0x2c')](_0x1494c7);};}exports[_0xb84f('0x2d')]=function(_0x345f54,_0xe60ac1){var _0x2a6eb4={},_0x3260f2={},_0x2d14be={'count':0x0,'rows':[]};var _0x535e62=_['map'](db[_0xb84f('0x2e')][_0xb84f('0x2f')],function(_0x2c23be){return{'name':_0x2c23be[_0xb84f('0x30')],'type':_0x2c23be['type'][_0xb84f('0x31')]};});_0x3260f2[_0xb84f('0x32')]=_['map'](_0x535e62,_0xb84f('0x2b'));_0x3260f2[_0xb84f('0x33')]=_[_0xb84f('0x34')](_0x345f54[_0xb84f('0x33')]);_0x3260f2[_0xb84f('0x35')]=_[_0xb84f('0x36')](_0x3260f2[_0xb84f('0x32')],_0x3260f2[_0xb84f('0x33')]);_0x2a6eb4['attributes']=_[_0xb84f('0x36')](_0x3260f2[_0xb84f('0x32')],qs['fields'](_0x345f54[_0xb84f('0x33')]['fields']));_0x2a6eb4[_0xb84f('0x37')]=_0x2a6eb4['attributes']['length']?_0x2a6eb4[_0xb84f('0x37')]:_0x3260f2['model'];if(!_0x345f54[_0xb84f('0x33')][_0xb84f('0x38')](_0xb84f('0x39'))){_0x2a6eb4[_0xb84f('0x20')]=qs[_0xb84f('0x20')](_0x345f54[_0xb84f('0x33')][_0xb84f('0x20')]);_0x2a6eb4[_0xb84f('0x1e')]=qs[_0xb84f('0x1e')](_0x345f54[_0xb84f('0x33')][_0xb84f('0x1e')]);}_0x2a6eb4['order']=qs[_0xb84f('0x3a')](_0x345f54[_0xb84f('0x33')][_0xb84f('0x3a')]);_0x2a6eb4['where']=qs[_0xb84f('0x35')](_[_0xb84f('0x3b')](_0x345f54[_0xb84f('0x33')],_0x3260f2['filters']),_0x535e62);if(_0x345f54[_0xb84f('0x33')][_0xb84f('0x3c')]){_0x2a6eb4[_0xb84f('0x3d')]=_[_0xb84f('0x3e')](_0x2a6eb4[_0xb84f('0x3d')],{'$or':_[_0xb84f('0x3f')](_0x535e62,function(_0x3d206e){if(_0x3d206e[_0xb84f('0x40')]!==_0xb84f('0x41')){var _0x45bbe0={};_0x45bbe0[_0x3d206e[_0xb84f('0x2b')]]={'$like':'%'+_0x345f54[_0xb84f('0x33')][_0xb84f('0x3c')]+'%'};return _0x45bbe0;}})});}_0x2a6eb4=_['merge']({},_0x2a6eb4,_0x345f54[_0xb84f('0x42')]);var _0x20772a={'where':_0x2a6eb4[_0xb84f('0x3d')]};return db['OpenchannelApplication'][_0xb84f('0x21')](_0x20772a)['then'](function(_0x487da1){_0x2d14be[_0xb84f('0x21')]=_0x487da1;if(_0x345f54[_0xb84f('0x33')][_0xb84f('0x43')]){_0x2a6eb4[_0xb84f('0x44')]=[{'all':!![]}];}return db[_0xb84f('0x2e')][_0xb84f('0x45')](_0x2a6eb4);})[_0xb84f('0x46')](function(_0x3effbd){_0x2d14be[_0xb84f('0x47')]=_0x3effbd;return _0x2d14be;})[_0xb84f('0x46')](respondWithFilteredResult(_0xe60ac1,_0x2a6eb4))['catch'](handleError(_0xe60ac1,null));};exports['show']=function(_0x980a,_0x40658b){var _0x152756={'raw':!![],'where':{'id':_0x980a['params']['id']}},_0x3e11e2={};_0x3e11e2[_0xb84f('0x32')]=_[_0xb84f('0x34')](db[_0xb84f('0x2e')][_0xb84f('0x2f')]);_0x3e11e2['query']=_['keys'](_0x980a['query']);_0x3e11e2[_0xb84f('0x35')]=_[_0xb84f('0x36')](_0x3e11e2[_0xb84f('0x32')],_0x3e11e2[_0xb84f('0x33')]);_0x152756['attributes']=_[_0xb84f('0x36')](_0x3e11e2[_0xb84f('0x32')],qs[_0xb84f('0x48')](_0x980a[_0xb84f('0x33')]['fields']));_0x152756[_0xb84f('0x37')]=_0x152756['attributes'][_0xb84f('0x49')]?_0x152756[_0xb84f('0x37')]:_0x3e11e2[_0xb84f('0x32')];if(_0x980a[_0xb84f('0x33')][_0xb84f('0x43')]){_0x152756[_0xb84f('0x44')]=[{'all':!![]}];}_0x152756=_[_0xb84f('0x3e')]({},_0x152756,_0x980a['options']);return db[_0xb84f('0x2e')][_0xb84f('0x4a')](_0x152756)['then'](handleEntityNotFound(_0x40658b,null))[_0xb84f('0x46')](respondWithResult(_0x40658b,null))['catch'](handleError(_0x40658b,null));};exports['create']=function(_0x54d9ee,_0x294657){return db[_0xb84f('0x2e')][_0xb84f('0x4b')](_0x54d9ee[_0xb84f('0x4c')],{})[_0xb84f('0x46')](respondWithResult(_0x294657,0xc9))['catch'](handleError(_0x294657,null));};exports[_0xb84f('0x27')]=function(_0x357d79,_0x1e6296){if(_0x357d79[_0xb84f('0x4c')]['id']){delete _0x357d79[_0xb84f('0x4c')]['id'];}return db[_0xb84f('0x2e')][_0xb84f('0x4a')]({'where':{'id':_0x357d79['params']['id']}})[_0xb84f('0x46')](handleEntityNotFound(_0x1e6296,null))['then'](saveUpdates(_0x357d79[_0xb84f('0x4c')],null))[_0xb84f('0x46')](respondWithResult(_0x1e6296,null))['catch'](handleError(_0x1e6296,null));};exports[_0xb84f('0x28')]=function(_0x472bbb,_0x41992e){return db[_0xb84f('0x2e')][_0xb84f('0x4a')]({'where':{'id':_0x472bbb[_0xb84f('0x4d')]['id']}})[_0xb84f('0x46')](handleEntityNotFound(_0x41992e,null))[_0xb84f('0x46')](removeEntity(_0x41992e,null))['catch'](handleError(_0x41992e,null));}; \ No newline at end of file +var _0x143a=['model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','OpenchannelApplication','findAll','rows','catch','params','keys','includeAll','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','rawAttributes','fieldName','key','map','query'];(function(_0x43c022,_0x361867){var _0x116505=function(_0x1ecd5c){while(--_0x1ecd5c){_0x43c022['push'](_0x43c022['shift']());}};_0x116505(++_0x361867);}(_0x143a,0x1ef));var _0xa143=function(_0xfd8ac9,_0x769265){_0xfd8ac9=_0xfd8ac9-0x0;var _0x86fb2a=_0x143a[_0xfd8ac9];return _0x86fb2a;};'use strict';var emlformat=require(_0xa143('0x0'));var rimraf=require(_0xa143('0x1'));var zipdir=require(_0xa143('0x2'));var jsonpatch=require(_0xa143('0x3'));var rp=require(_0xa143('0x4'));var moment=require('moment');var BPromise=require(_0xa143('0x5'));var Mustache=require(_0xa143('0x6'));var util=require('util');var path=require(_0xa143('0x7'));var sox=require('sox');var csv=require(_0xa143('0x8'));var ejs=require(_0xa143('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa143('0xa'));var squel=require(_0xa143('0xb'));var crypto=require(_0xa143('0xc'));var jsforce=require(_0xa143('0xd'));var deskjs=require(_0xa143('0xe'));var toCsv=require(_0xa143('0x8'));var querystring=require(_0xa143('0xf'));var Papa=require('papaparse');var Redis=require(_0xa143('0x10'));var authService=require(_0xa143('0x11'));var qs=require(_0xa143('0x12'));var as=require(_0xa143('0x13'));var hardwareService=require(_0xa143('0x14'));var logger=require(_0xa143('0x15'))('api');var utils=require(_0xa143('0x16'));var config=require(_0xa143('0x17'));var licenseUtil=require(_0xa143('0x18'));var db=require(_0xa143('0x19'))['db'];function respondWithStatusCode(_0x4b771f,_0x1b7470){_0x1b7470=_0x1b7470||0xcc;return function(_0x45cfbc){if(_0x45cfbc){return _0x4b771f[_0xa143('0x1a')](_0x1b7470);}return _0x4b771f[_0xa143('0x1b')](_0x1b7470)[_0xa143('0x1c')]();};}function respondWithResult(_0x12c64c,_0x19c097){_0x19c097=_0x19c097||0xc8;return function(_0x3064ec){if(_0x3064ec){return _0x12c64c[_0xa143('0x1b')](_0x19c097)[_0xa143('0x1d')](_0x3064ec);}};}function respondWithFilteredResult(_0x278414,_0x584d99){return function(_0x2c285c){if(_0x2c285c){var _0x8e35b=typeof _0x584d99['offset']===_0xa143('0x1e')&&typeof _0x584d99[_0xa143('0x1f')]===_0xa143('0x1e');var _0x18eca1=_0x2c285c[_0xa143('0x20')];var _0x30c3c4=_0x8e35b?0x0:_0x584d99[_0xa143('0x21')];var _0x27377e=_0x8e35b?_0x2c285c[_0xa143('0x20')]:_0x584d99['offset']+_0x584d99['limit'];var _0x390e86;if(_0x27377e>=_0x18eca1){_0x27377e=_0x18eca1;_0x390e86=0xc8;}else{_0x390e86=0xce;}_0x278414[_0xa143('0x1b')](_0x390e86);return _0x278414[_0xa143('0x22')](_0xa143('0x23'),_0x30c3c4+'-'+_0x27377e+'/'+_0x18eca1)[_0xa143('0x1d')](_0x2c285c);}return null;};}function patchUpdates(_0x29ed71){return function(_0x53dd21){try{jsonpatch[_0xa143('0x24')](_0x53dd21,_0x29ed71,!![]);}catch(_0x1689e2){return BPromise[_0xa143('0x25')](_0x1689e2);}return _0x53dd21[_0xa143('0x26')]();};}function saveUpdates(_0x3c905d,_0x29c7cb){return function(_0x227c87){if(_0x227c87){return _0x227c87[_0xa143('0x27')](_0x3c905d)[_0xa143('0x28')](function(_0x16d73c){return _0x16d73c;});}return null;};}function removeEntity(_0x475698,_0x4d99c8){return function(_0x1c705f){if(_0x1c705f){return _0x1c705f[_0xa143('0x29')]()['then'](function(){_0x475698[_0xa143('0x1b')](0xcc)[_0xa143('0x1c')]();});}};}function handleEntityNotFound(_0x5ff2e7,_0x42e4f6){return function(_0xb856fe){if(!_0xb856fe){_0x5ff2e7['sendStatus'](0x194);}return _0xb856fe;};}function handleError(_0xbc28bc,_0x13d6a1){_0x13d6a1=_0x13d6a1||0x1f4;return function(_0x4bf9b0){logger[_0xa143('0x2a')](_0x4bf9b0['stack']);if(_0x4bf9b0[_0xa143('0x2b')]){delete _0x4bf9b0['name'];}_0xbc28bc[_0xa143('0x1b')](_0x13d6a1)[_0xa143('0x2c')](_0x4bf9b0);};}exports[_0xa143('0x2d')]=function(_0x1fae34,_0x1315cc){var _0x432d27={},_0x5b65a4={},_0x49460a={'count':0x0,'rows':[]};var _0x416c4a=_['map'](db['OpenchannelApplication'][_0xa143('0x2e')],function(_0x54dea5){return{'name':_0x54dea5[_0xa143('0x2f')],'type':_0x54dea5['type'][_0xa143('0x30')]};});_0x5b65a4['model']=_[_0xa143('0x31')](_0x416c4a,'name');_0x5b65a4[_0xa143('0x32')]=_['keys'](_0x1fae34['query']);_0x5b65a4['filters']=_['intersection'](_0x5b65a4[_0xa143('0x33')],_0x5b65a4[_0xa143('0x32')]);_0x432d27[_0xa143('0x34')]=_[_0xa143('0x35')](_0x5b65a4[_0xa143('0x33')],qs[_0xa143('0x36')](_0x1fae34[_0xa143('0x32')]['fields']));_0x432d27[_0xa143('0x34')]=_0x432d27[_0xa143('0x34')][_0xa143('0x37')]?_0x432d27[_0xa143('0x34')]:_0x5b65a4[_0xa143('0x33')];if(!_0x1fae34[_0xa143('0x32')][_0xa143('0x38')](_0xa143('0x39'))){_0x432d27[_0xa143('0x1f')]=qs[_0xa143('0x1f')](_0x1fae34[_0xa143('0x32')]['limit']);_0x432d27['offset']=qs[_0xa143('0x21')](_0x1fae34[_0xa143('0x32')]['offset']);}_0x432d27['order']=qs['sort'](_0x1fae34[_0xa143('0x32')][_0xa143('0x3a')]);_0x432d27['where']=qs[_0xa143('0x3b')](_[_0xa143('0x3c')](_0x1fae34[_0xa143('0x32')],_0x5b65a4[_0xa143('0x3b')]),_0x416c4a);if(_0x1fae34[_0xa143('0x32')][_0xa143('0x3d')]){_0x432d27[_0xa143('0x3e')]=_[_0xa143('0x3f')](_0x432d27['where'],{'$or':_[_0xa143('0x31')](_0x416c4a,function(_0x115225){if(_0x115225[_0xa143('0x40')]!==_0xa143('0x41')){var _0x452524={};_0x452524[_0x115225[_0xa143('0x2b')]]={'$like':'%'+_0x1fae34['query'][_0xa143('0x3d')]+'%'};return _0x452524;}})});}_0x432d27=_[_0xa143('0x3f')]({},_0x432d27,_0x1fae34[_0xa143('0x42')]);var _0x6b123b={'where':_0x432d27[_0xa143('0x3e')]};return db['OpenchannelApplication'][_0xa143('0x20')](_0x6b123b)[_0xa143('0x28')](function(_0x53c510){_0x49460a[_0xa143('0x20')]=_0x53c510;if(_0x1fae34[_0xa143('0x32')]['includeAll']){_0x432d27['include']=[{'all':!![]}];}return db[_0xa143('0x43')][_0xa143('0x44')](_0x432d27);})[_0xa143('0x28')](function(_0x434fdf){_0x49460a[_0xa143('0x45')]=_0x434fdf;return _0x49460a;})[_0xa143('0x28')](respondWithFilteredResult(_0x1315cc,_0x432d27))[_0xa143('0x46')](handleError(_0x1315cc,null));};exports['show']=function(_0x49e9f7,_0x20a129){var _0x5166fc={'raw':!![],'where':{'id':_0x49e9f7[_0xa143('0x47')]['id']}},_0x12b4cb={};_0x12b4cb['model']=_[_0xa143('0x48')](db[_0xa143('0x43')][_0xa143('0x2e')]);_0x12b4cb['query']=_[_0xa143('0x48')](_0x49e9f7['query']);_0x12b4cb[_0xa143('0x3b')]=_[_0xa143('0x35')](_0x12b4cb[_0xa143('0x33')],_0x12b4cb[_0xa143('0x32')]);_0x5166fc[_0xa143('0x34')]=_[_0xa143('0x35')](_0x12b4cb[_0xa143('0x33')],qs['fields'](_0x49e9f7[_0xa143('0x32')][_0xa143('0x36')]));_0x5166fc['attributes']=_0x5166fc[_0xa143('0x34')]['length']?_0x5166fc[_0xa143('0x34')]:_0x12b4cb[_0xa143('0x33')];if(_0x49e9f7['query'][_0xa143('0x49')]){_0x5166fc[_0xa143('0x4a')]=[{'all':!![]}];}_0x5166fc=_['merge']({},_0x5166fc,_0x49e9f7[_0xa143('0x42')]);return db[_0xa143('0x43')][_0xa143('0x4b')](_0x5166fc)[_0xa143('0x28')](handleEntityNotFound(_0x20a129,null))[_0xa143('0x28')](respondWithResult(_0x20a129,null))[_0xa143('0x46')](handleError(_0x20a129,null));};exports[_0xa143('0x4c')]=function(_0x1df0bb,_0x4a174b){return db[_0xa143('0x43')][_0xa143('0x4c')](_0x1df0bb['body'],{})['then'](respondWithResult(_0x4a174b,0xc9))[_0xa143('0x46')](handleError(_0x4a174b,null));};exports[_0xa143('0x27')]=function(_0x38b9cf,_0x30beab){if(_0x38b9cf[_0xa143('0x4d')]['id']){delete _0x38b9cf[_0xa143('0x4d')]['id'];}return db[_0xa143('0x43')][_0xa143('0x4b')]({'where':{'id':_0x38b9cf['params']['id']}})[_0xa143('0x28')](handleEntityNotFound(_0x30beab,null))[_0xa143('0x28')](saveUpdates(_0x38b9cf['body'],null))[_0xa143('0x28')](respondWithResult(_0x30beab,null))['catch'](handleError(_0x30beab,null));};exports[_0xa143('0x29')]=function(_0x1c1c8c,_0x394d09){return db[_0xa143('0x43')][_0xa143('0x4b')]({'where':{'id':_0x1c1c8c[_0xa143('0x47')]['id']}})[_0xa143('0x28')](handleEntityNotFound(_0x394d09,null))[_0xa143('0x28')](removeEntity(_0x394d09,null))['catch'](handleError(_0x394d09,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 4ed9b98..2fea512 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 _0x1409=['path','../../config/environment','./openchannelApplication.attributes','exports','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x12aaec,_0x572990){var _0x1cabcc=function(_0x2d789e){while(--_0x2d789e){_0x12aaec['push'](_0x12aaec['shift']());}};_0x1cabcc(++_0x572990);}(_0x1409,0x13c));var _0x9140=function(_0x33516d,_0x37e14a){_0x33516d=_0x33516d-0x0;var _0x5ebb0a=_0x1409[_0x33516d];return _0x5ebb0a;};'use strict';var _=require(_0x9140('0x0'));var util=require(_0x9140('0x1'));var logger=require(_0x9140('0x2'))(_0x9140('0x3'));var moment=require(_0x9140('0x4'));var BPromise=require(_0x9140('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9140('0x6'));var rimraf=require('rimraf');var config=require(_0x9140('0x7'));var attributes=require(_0x9140('0x8'));module[_0x9140('0x9')]=function(_0x3a919a,_0x4781da){return _0x3a919a['define'](_0x9140('0xa'),attributes,{'tableName':_0x9140('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9140('0xc'),'collate':_0x9140('0xd')});}; \ No newline at end of file +var _0x1adc=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x2becba,_0x4ea656){var _0x90b5dd=function(_0x26ae2b){while(--_0x26ae2b){_0x2becba['push'](_0x2becba['shift']());}};_0x90b5dd(++_0x4ea656);}(_0x1adc,0x1b2));var _0xc1ad=function(_0x100570,_0x2678fd){_0x100570=_0x100570-0x0;var _0x174d34=_0x1adc[_0x100570];return _0x174d34;};'use strict';var _=require(_0xc1ad('0x0'));var util=require(_0xc1ad('0x1'));var logger=require(_0xc1ad('0x2'))(_0xc1ad('0x3'));var moment=require(_0xc1ad('0x4'));var BPromise=require(_0xc1ad('0x5'));var rp=require(_0xc1ad('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc1ad('0x7'));var config=require(_0xc1ad('0x8'));var attributes=require('./openchannelApplication.attributes');module[_0xc1ad('0x9')]=function(_0xd926b6,_0x21eb1d){return _0xd926b6['define'](_0xc1ad('0xa'),attributes,{'tableName':_0xc1ad('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc1ad('0xc'),'collate':_0xc1ad('0xd')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 56b37ff..06dc2fa 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 _0xa36b=['limit','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','UpdateOpenchannelApplication','OpenchannelApplication','body','options','raw','where','attributes'];(function(_0x4b1e73,_0x3d9c50){var _0x49b751=function(_0x696ef5){while(--_0x696ef5){_0x4b1e73['push'](_0x4b1e73['shift']());}};_0x49b751(++_0x3d9c50);}(_0xa36b,0x1f1));var _0xba36=function(_0x27432b,_0x163260){_0x27432b=_0x27432b-0x0;var _0x5c6f9d=_0xa36b[_0x27432b];return _0x5c6f9d;};'use strict';var _=require(_0xba36('0x0'));var util=require(_0xba36('0x1'));var moment=require(_0xba36('0x2'));var BPromise=require(_0xba36('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xba36('0x4'));var db=require(_0xba36('0x5'))['db'];var utils=require(_0xba36('0x6'));var logger=require(_0xba36('0x7'))(_0xba36('0x8'));var config=require(_0xba36('0x9'));var jayson=require(_0xba36('0xa'));var client=jayson['client'][_0xba36('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x182dd9,_0x29de74,_0x5c516c){return new BPromise(function(_0x4bec40,_0x2862d4){return client[_0xba36('0xc')](_0x182dd9,_0x5c516c)[_0xba36('0xd')](function(_0x30a52b){logger['info'](_0xba36('0xe'),_0x29de74,_0xba36('0xf'));logger[_0xba36('0x10')](_0xba36('0x11'),_0x29de74,_0xba36('0xf'),JSON[_0xba36('0x12')](_0x30a52b));if(_0x30a52b[_0xba36('0x13')]){if(_0x30a52b[_0xba36('0x13')][_0xba36('0x14')]===0x1f4){logger[_0xba36('0x13')]('OpenchannelApplication,\x20%s,\x20%s',_0x29de74,_0x30a52b['error'][_0xba36('0x15')]);return _0x2862d4(_0x30a52b[_0xba36('0x13')]['message']);}logger[_0xba36('0x13')](_0xba36('0xe'),_0x29de74,_0x30a52b[_0xba36('0x13')][_0xba36('0x15')]);return _0x4bec40(_0x30a52b[_0xba36('0x13')][_0xba36('0x15')]);}else{logger[_0xba36('0x16')]('OpenchannelApplication,\x20%s,\x20%s',_0x29de74,_0xba36('0xf'));_0x4bec40(_0x30a52b[_0xba36('0x17')][_0xba36('0x15')]);}})['catch'](function(_0x4db0d2){logger[_0xba36('0x13')]('OpenchannelApplication,\x20%s,\x20%s',_0x29de74,_0x4db0d2);_0x2862d4(_0x4db0d2);});});}exports[_0xba36('0x18')]=function(_0x5923fa){var _0x4ea078=this;return new Promise(function(_0x27d115,_0xf753f){return db[_0xba36('0x19')]['update'](_0x5923fa[_0xba36('0x1a')],{'raw':_0x5923fa[_0xba36('0x1b')]?_0x5923fa[_0xba36('0x1b')][_0xba36('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5923fa[_0xba36('0x1b')]?_0x5923fa[_0xba36('0x1b')][_0xba36('0x1d')]||null:null,'attributes':_0x5923fa[_0xba36('0x1b')]?_0x5923fa['options'][_0xba36('0x1e')]||null:null,'limit':_0x5923fa[_0xba36('0x1b')]?_0x5923fa[_0xba36('0x1b')][_0xba36('0x1f')]||null:null})['then'](function(_0x25f21b){logger[_0xba36('0x16')](_0xba36('0x18'),_0x5923fa);logger['debug'](_0xba36('0x18'),_0x5923fa,JSON['stringify'](_0x25f21b));_0x27d115(_0x25f21b);})[_0xba36('0x20')](function(_0x8de080){logger[_0xba36('0x13')]('UpdateOpenchannelApplication',_0x8de080[_0xba36('0x15')],_0x5923fa);_0xf753f(_0x4ea078['error'](0x1f4,_0x8de080[_0xba36('0x15')]));});});}; \ No newline at end of file +var _0x5f52=['where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5f52,0x177));var _0x25f5=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0x5f52[_0x481bf7];return _0x461787;};'use strict';var _=require(_0x25f5('0x0'));var util=require(_0x25f5('0x1'));var moment=require(_0x25f5('0x2'));var BPromise=require(_0x25f5('0x3'));var rs=require(_0x25f5('0x4'));var fs=require('fs');var Redis=require(_0x25f5('0x5'));var db=require(_0x25f5('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x25f5('0x7'))(_0x25f5('0x8'));var config=require('../../config/environment');var jayson=require(_0x25f5('0x9'));var client=jayson['client'][_0x25f5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a309f,_0x551c07,_0x1412f7){return new BPromise(function(_0x4d57d0,_0x157692){return client[_0x25f5('0xb')](_0x3a309f,_0x1412f7)[_0x25f5('0xc')](function(_0x45606b){logger[_0x25f5('0xd')](_0x25f5('0xe'),_0x551c07,_0x25f5('0xf'));logger[_0x25f5('0x10')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x551c07,_0x25f5('0xf'),JSON[_0x25f5('0x11')](_0x45606b));if(_0x45606b[_0x25f5('0x12')]){if(_0x45606b[_0x25f5('0x12')][_0x25f5('0x13')]===0x1f4){logger[_0x25f5('0x12')](_0x25f5('0xe'),_0x551c07,_0x45606b[_0x25f5('0x12')][_0x25f5('0x14')]);return _0x157692(_0x45606b['error'][_0x25f5('0x14')]);}logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x551c07,_0x45606b[_0x25f5('0x12')]['message']);return _0x4d57d0(_0x45606b['error'][_0x25f5('0x14')]);}else{logger[_0x25f5('0xd')](_0x25f5('0xe'),_0x551c07,'request\x20sent');_0x4d57d0(_0x45606b['result'][_0x25f5('0x14')]);}})[_0x25f5('0x15')](function(_0x5cb2d5){logger[_0x25f5('0x12')](_0x25f5('0xe'),_0x551c07,_0x5cb2d5);_0x157692(_0x5cb2d5);});});}exports[_0x25f5('0x16')]=function(_0x1b24d9){var _0x4f6116=this;return new Promise(function(_0x86da95,_0x2ace5c){return db[_0x25f5('0x17')][_0x25f5('0x18')](_0x1b24d9[_0x25f5('0x19')],{'raw':_0x1b24d9['options']?_0x1b24d9[_0x25f5('0x1a')][_0x25f5('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b24d9[_0x25f5('0x1a')]?_0x1b24d9['options'][_0x25f5('0x1c')]||null:null,'attributes':_0x1b24d9[_0x25f5('0x1a')]?_0x1b24d9['options'][_0x25f5('0x1d')]||null:null,'limit':_0x1b24d9[_0x25f5('0x1a')]?_0x1b24d9['options'][_0x25f5('0x1e')]||null:null})['then'](function(_0x5660a0){logger[_0x25f5('0xd')](_0x25f5('0x16'),_0x1b24d9);logger['debug'](_0x25f5('0x16'),_0x1b24d9,JSON[_0x25f5('0x11')](_0x5660a0));_0x86da95(_0x5660a0);})['catch'](function(_0x386286){logger['error'](_0x25f5('0x16'),_0x386286['message'],_0x1b24d9);_0x2ace5c(_0x4f6116[_0x25f5('0x12')](0x1f4,_0x386286[_0x25f5('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index ac02daa..4db4b34 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 _0x0008=['util','connect-timeout','express','../../components/auth/service','./openchannelInteraction.controller','get','isAuthenticated','index','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','delete','destroy','/:id/tags','removeTags','exports','multer'];(function(_0x4914e2,_0x48be8f){var _0x2dcd07=function(_0x1a2565){while(--_0x1a2565){_0x4914e2['push'](_0x4914e2['shift']());}};_0x2dcd07(++_0x48be8f);}(_0x0008,0xca));var _0x8000=function(_0xb03c1c,_0x2f98ed){_0xb03c1c=_0xb03c1c-0x0;var _0x507e93=_0x0008[_0xb03c1c];return _0x507e93;};'use strict';var multer=require(_0x8000('0x0'));var util=require(_0x8000('0x1'));var path=require('path');var timeout=require(_0x8000('0x2'));var express=require(_0x8000('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8000('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8000('0x5'));router[_0x8000('0x6')]('/',auth[_0x8000('0x7')](),controller[_0x8000('0x8')]);router[_0x8000('0x6')]('/describe',auth[_0x8000('0x7')](),controller[_0x8000('0x9')]);router[_0x8000('0x6')](_0x8000('0xa'),auth[_0x8000('0x7')](),controller[_0x8000('0xb')]);router[_0x8000('0x6')](_0x8000('0xc'),auth['isAuthenticated'](),controller[_0x8000('0xd')]);router[_0x8000('0x6')](_0x8000('0xe'),auth[_0x8000('0x7')](),controller['download']);router[_0x8000('0xf')]('/',auth['isAuthenticated'](),controller[_0x8000('0x10')]);router[_0x8000('0xf')](_0x8000('0xc'),auth[_0x8000('0x7')](),controller[_0x8000('0x11')]);router[_0x8000('0xf')]('/:id/tags',auth[_0x8000('0x7')](),interaction[_0x8000('0x12')](_0x8000('0x13'),_0x8000('0x14')),controller[_0x8000('0x15')]);router[_0x8000('0x16')](_0x8000('0xa'),auth[_0x8000('0x7')](),interaction[_0x8000('0x12')](_0x8000('0x13'),_0x8000('0x17')),controller['update']);router[_0x8000('0x18')](_0x8000('0xa'),auth[_0x8000('0x7')](),interaction[_0x8000('0x12')](_0x8000('0x13'),'openchannelinteraction:destroy'),controller[_0x8000('0x19')]);router['delete'](_0x8000('0x1a'),auth[_0x8000('0x7')](),controller[_0x8000('0x1b')]);module[_0x8000('0x1c')]=router; \ No newline at end of file +var _0x4d42=['delete','openchannelinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','tracked','openchannel','openchannelinteraction:addtags','put','openchannelinteraction:update','update'];(function(_0x16e492,_0x594b85){var _0x42fa00=function(_0x5a135c){while(--_0x5a135c){_0x16e492['push'](_0x16e492['shift']());}};_0x42fa00(++_0x594b85);}(_0x4d42,0xe6));var _0x24d4=function(_0x4ce08b,_0x19bd06){_0x4ce08b=_0x4ce08b-0x0;var _0x1cd386=_0x4d42[_0x4ce08b];return _0x1cd386;};'use strict';var multer=require(_0x24d4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x24d4('0x1'));var express=require('express');var router=express[_0x24d4('0x2')]();var fs_extra=require(_0x24d4('0x3'));var auth=require(_0x24d4('0x4'));var interaction=require(_0x24d4('0x5'));var config=require('../../config/environment');var controller=require(_0x24d4('0x6'));router[_0x24d4('0x7')]('/',auth[_0x24d4('0x8')](),controller[_0x24d4('0x9')]);router['get'](_0x24d4('0xa'),auth['isAuthenticated'](),controller[_0x24d4('0xb')]);router[_0x24d4('0x7')](_0x24d4('0xc'),auth[_0x24d4('0x8')](),controller['show']);router[_0x24d4('0x7')](_0x24d4('0xd'),auth[_0x24d4('0x8')](),controller[_0x24d4('0xe')]);router[_0x24d4('0x7')](_0x24d4('0xf'),auth[_0x24d4('0x8')](),controller[_0x24d4('0x10')]);router[_0x24d4('0x11')]('/',auth['isAuthenticated'](),controller[_0x24d4('0x12')]);router[_0x24d4('0x11')](_0x24d4('0xd'),auth[_0x24d4('0x8')](),controller[_0x24d4('0x13')]);router[_0x24d4('0x11')]('/:id/tags',auth[_0x24d4('0x8')](),interaction[_0x24d4('0x14')](_0x24d4('0x15'),_0x24d4('0x16')),controller['addTags']);router[_0x24d4('0x17')]('/:id',auth[_0x24d4('0x8')](),interaction[_0x24d4('0x14')](_0x24d4('0x15'),_0x24d4('0x18')),controller[_0x24d4('0x19')]);router[_0x24d4('0x1a')]('/:id',auth[_0x24d4('0x8')](),interaction['tracked'](_0x24d4('0x15'),_0x24d4('0x1b')),controller[_0x24d4('0x1c')]);router['delete'](_0x24d4('0x1d'),auth[_0x24d4('0x8')](),controller[_0x24d4('0x1e')]);module[_0x24d4('0x1f')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 4fa757c..cbd413d 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 _0x8569=['STRING','ENUM','out','BOOLEAN','DATE'];(function(_0x3bdeda,_0x199873){var _0x49c31b=function(_0x218f76){while(--_0x218f76){_0x3bdeda['push'](_0x3bdeda['shift']());}};_0x49c31b(++_0x199873);}(_0x8569,0x14d));var _0x9856=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x8569[_0x24f31b];return _0x488401;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0x9856('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9856('0x1')]},'disposition':{'type':Sequelize[_0x9856('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x9856('0x2')]},'note':{'type':Sequelize[_0x9856('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x9856('0x2')]},'externalUrl':{'type':Sequelize[_0x9856('0x2')]},'lastMsgAt':{'type':Sequelize[_0x9856('0x1')]},'lastMsgDirection':{'type':Sequelize[_0x9856('0x3')]('in',_0x9856('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x9856('0x2')]},'autoreplyExecuted':{'type':Sequelize[_0x9856('0x0')],'defaultValue':![]}}; \ No newline at end of file +var _0x1ef8=['DATE','out','BOOLEAN','sequelize','STRING'];(function(_0x4f4c2a,_0x5f5a28){var _0xd15be6=function(_0x1bc725){while(--_0x1bc725){_0x4f4c2a['push'](_0x4f4c2a['shift']());}};_0xd15be6(++_0x5f5a28);}(_0x1ef8,0xd5));var _0x81ef=function(_0x3663b2,_0x3c4873){_0x3663b2=_0x3663b2-0x0;var _0x22c8b4=_0x1ef8[_0x3663b2];return _0x22c8b4;};'use strict';var Sequelize=require(_0x81ef('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x81ef('0x1')]},'thirdDisposition':{'type':Sequelize[_0x81ef('0x1')]},'note':{'type':Sequelize[_0x81ef('0x1')]},'read1stAt':{'type':Sequelize[_0x81ef('0x2')]},'threadId':{'type':Sequelize[_0x81ef('0x1')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x81ef('0x3')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x81ef('0x1')]},'autoreplyExecuted':{'type':Sequelize[_0x81ef('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index ae6cd53..8af3741 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 _0x3246=['setTags','spread','findAll','emit','openchannelInteractionTags:save','removeTags','download','unix','join','server','files','tmp','root','attachments','transcript-%d-%s.zip','Contact','Attachment','Messages','direction','Account','Owner','Openchannel','closed','disposition','threadId','Public','Private','pipe','createWriteStream','System','firstName','lastName','basename','out','secret','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','err','unlinkSync','eml-format','fast-json-patch','request-promise','moment','mustache','path','ejs','fs-extra','squel','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','./openchannelInteraction.socket','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','Users','map','fullname','TagIds','split','Tags','push','catch','index','OpenchannelInteraction','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','select','field','color','from','u.id','u.fullname','user_has_openchannel_interactions','users','u.id\x20=\x20ui.UserId','openchannel_interactions','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.OpenchannelAccountId','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','conditions','find','value','having','`\x20=\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','body','some','compact','isEmpty','OpenchannelAccountId','where','concat','createdAt','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','tag','isArray','forEach','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','sequelize','toString','merge','unreadMessages','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','all','show','includeAll','include','options','create','params','describe','OpenchannelMessage','addMessage','ids','omit','getMessages','OpenchannelInteractionId','$gte','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3246,0x1ea));var _0x6324=function(_0xb9ad8,_0x2e12c1){_0xb9ad8=_0xb9ad8-0x0;var _0x26c75f=_0x3246[_0xb9ad8];return _0x26c75f;};'use strict';var emlformat=require(_0x6324('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6324('0x1'));var rp=require(_0x6324('0x2'));var moment=require(_0x6324('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6324('0x4'));var util=require('util');var path=require(_0x6324('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6324('0x6'));var fs=require('fs');var fs_extra=require(_0x6324('0x7'));var _=require('lodash');var squel=require(_0x6324('0x8'));var crypto=require('crypto');var jsforce=require(_0x6324('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x6324('0xa'));var querystring=require('querystring');var Papa=require(_0x6324('0xb'));var Redis=require('ioredis');var authService=require(_0x6324('0xc'));var qs=require(_0x6324('0xd'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x6324('0xe'));var hardwareService=require(_0x6324('0xf'));var logger=require('../../config/logger')(_0x6324('0x10'));var utils=require(_0x6324('0x11'));var config=require(_0x6324('0x12'));var licenseUtil=require(_0x6324('0x13'));var db=require(_0x6324('0x14'))['db'];config['redis']=_[_0x6324('0x15')](config['redis'],{'host':_0x6324('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6324('0x17'))['register'](socket);function respondWithStatusCode(_0x4b2294,_0x3c70d1){_0x3c70d1=_0x3c70d1||0xcc;return function(_0x46cca5){if(_0x46cca5){return _0x4b2294[_0x6324('0x18')](_0x3c70d1);}return _0x4b2294[_0x6324('0x19')](_0x3c70d1)[_0x6324('0x1a')]();};}function respondWithResult(_0x36ff05,_0xa9d59a){_0xa9d59a=_0xa9d59a||0xc8;return function(_0xce4dfd){if(_0xce4dfd){return _0x36ff05[_0x6324('0x19')](_0xa9d59a)['json'](_0xce4dfd);}};}function respondWithFilteredResult(_0x41ed83,_0x15b763){return function(_0xa28f6d){if(_0xa28f6d){var _0x4c9254=typeof _0x15b763[_0x6324('0x1b')]===_0x6324('0x1c')&&typeof _0x15b763[_0x6324('0x1d')]==='undefined';var _0x5693ff=_0xa28f6d[_0x6324('0x1e')];var _0x18f3e7=_0x4c9254?0x0:_0x15b763[_0x6324('0x1b')];var _0x16ed03=_0x4c9254?_0xa28f6d[_0x6324('0x1e')]:_0x15b763[_0x6324('0x1b')]+_0x15b763[_0x6324('0x1d')];var _0x1cb726;if(_0x16ed03>=_0x5693ff){_0x16ed03=_0x5693ff;_0x1cb726=0xc8;}else{_0x1cb726=0xce;}_0x41ed83[_0x6324('0x19')](_0x1cb726);return _0x41ed83[_0x6324('0x1f')](_0x6324('0x20'),_0x18f3e7+'-'+_0x16ed03+'/'+_0x5693ff)['json'](_0xa28f6d);}return null;};}function patchUpdates(_0x599c40){return function(_0x15fbca){try{jsonpatch[_0x6324('0x21')](_0x15fbca,_0x599c40,!![]);}catch(_0x137cfe){return BPromise[_0x6324('0x22')](_0x137cfe);}return _0x15fbca[_0x6324('0x23')]();};}function saveUpdates(_0x3bc891,_0x25d67d){return function(_0x2db490){if(_0x2db490){return _0x2db490[_0x6324('0x24')](_0x3bc891)[_0x6324('0x25')](function(_0x5416b8){return _0x5416b8;});}return null;};}function removeEntity(_0x1b5f8c,_0x392123){return function(_0x11bf38){if(_0x11bf38){return _0x11bf38[_0x6324('0x26')]()['then'](function(){_0x1b5f8c[_0x6324('0x19')](0xcc)[_0x6324('0x1a')]();});}};}function handleEntityNotFound(_0x756333,_0x31643d){return function(_0x563efe){if(!_0x563efe){_0x756333[_0x6324('0x18')](0x194);}return _0x563efe;};}function handleError(_0x20cc72,_0x2866da){_0x2866da=_0x2866da||0x1f4;return function(_0x5a1601){logger[_0x6324('0x27')](_0x5a1601[_0x6324('0x28')]);if(_0x5a1601[_0x6324('0x29')]){delete _0x5a1601['name'];}_0x20cc72['status'](_0x2866da)['send'](_0x5a1601);};}function getInteractionUsers(_0x2887cc,_0x38bc7a){return new BPromise(function(_0x5e0a35,_0x5950f7){try{if(_0x38bc7a[_0x2887cc['id']]){_0x2887cc[_0x6324('0x2a')]=_[_0x6324('0x2b')](_0x38bc7a[_0x2887cc['id']],function(_0x5752b4){return{'id':_0x5752b4['id'],'fullname':_0x5752b4[_0x6324('0x2c')]};});}}catch(_0x5d1234){_0x5950f7(_0x5d1234);}_0x5e0a35(_0x2887cc);});}function getInteractionTags(_0x4afcf3,_0x3a2a30){return new BPromise(function(_0x596d51,_0x4c77c8){try{if(_0x4afcf3[_0x6324('0x2d')]){_0x4afcf3['Tags']=[];_0x4afcf3['TagIds'][_0x6324('0x2e')](',')['forEach'](function(_0x4cda8b){_0x4afcf3[_0x6324('0x2f')][_0x6324('0x30')](_0x3a2a30[_0x4cda8b]);});}delete _0x4afcf3[_0x6324('0x2d')];}catch(_0x31fb03){_0x4c77c8(_0x31fb03);}_0x596d51(_0x4afcf3);});}function updateOpenchannelInteraction(_0x492374,_0x12731d,_0x488553){return new BPromise(function(_0x45aed4,_0x1eea39){return getInteractionUsers(_0x492374,_0x488553)[_0x6324('0x25')](function(_0x59715f){return getInteractionTags(_0x59715f,_0x12731d);})[_0x6324('0x25')](function(_0x34566d){_0x45aed4(_0x34566d);})[_0x6324('0x31')](function(_0x52853b){_0x1eea39(_0x52853b);});});}exports[_0x6324('0x32')]=function(_0x3e29cf,_0x2945d8){var _0x3aff72={},_0xa9996b={},_0x3ab27b={'count':0x0,'rows':[]};var _0x5c76bd=_['map'](db[_0x6324('0x33')]['rawAttributes'],function(_0x34cecb){return{'name':_0x34cecb[_0x6324('0x34')],'type':_0x34cecb[_0x6324('0x35')][_0x6324('0x36')]};});_0xa9996b[_0x6324('0x37')]=_['map'](_0x5c76bd,'name');_0xa9996b[_0x6324('0x38')]=_[_0x6324('0x39')](_0x3e29cf[_0x6324('0x38')]);_0xa9996b[_0x6324('0x3a')]=_[_0x6324('0x3b')](_0xa9996b['model'],_0xa9996b[_0x6324('0x38')]);_0x3aff72['attributes']=_[_0x6324('0x3b')](_0xa9996b[_0x6324('0x37')],qs['fields'](_0x3e29cf[_0x6324('0x38')][_0x6324('0x3c')]));_0x3aff72[_0x6324('0x3d')]=_0x3aff72[_0x6324('0x3d')][_0x6324('0x3e')]?_0x3aff72[_0x6324('0x3d')]:_0xa9996b[_0x6324('0x37')];if(!_0x3e29cf[_0x6324('0x38')]['hasOwnProperty'](_0x6324('0x3f'))){_0x3aff72[_0x6324('0x1d')]=qs[_0x6324('0x1d')](_0x3e29cf['query'][_0x6324('0x1d')]);_0x3aff72[_0x6324('0x1b')]=qs[_0x6324('0x1b')](_0x3e29cf[_0x6324('0x38')][_0x6324('0x1b')]);}_0x3aff72[_0x6324('0x40')]=qs[_0x6324('0x41')](_0x3e29cf[_0x6324('0x38')][_0x6324('0x41')]);_0x3aff72['where']=qs['filters'](_[_0x6324('0x42')](_0x3e29cf[_0x6324('0x38')],_0xa9996b[_0x6324('0x3a')]),_0x5c76bd);var _0x278115=[];var _0x131b0a=squel[_0x6324('0x43')]()[_0x6324('0x44')]('id')['field'](_0x6324('0x29'))[_0x6324('0x44')](_0x6324('0x45'))[_0x6324('0x46')]('tools_tags');var _0x589c2b=squel[_0x6324('0x43')]()['field'](_0x6324('0x47'))[_0x6324('0x44')](_0x6324('0x48'))[_0x6324('0x44')]('ui.OpenchannelInteractionId')[_0x6324('0x46')](_0x6324('0x49'),'ui')['left_join'](_0x6324('0x4a'),'u',_0x6324('0x4b'));var _0x20b31a=squel[_0x6324('0x43')]()[_0x6324('0x46')](_0x6324('0x4c'),'i')[_0x6324('0x4d')]('cm_contacts','c',_0x6324('0x4e'))[_0x6324('0x4d')](_0x6324('0x4a'),'o',_0x6324('0x4f'))['left_join']('openchannel_accounts','a',_0x6324('0x50'))[_0x6324('0x4d')]('openchannel_messages','me',_0x6324('0x51'))[_0x6324('0x4d')](_0x6324('0x52'),'it',_0x6324('0x53'))[_0x6324('0x4d')]('tools_tags','t',_0x6324('0x54'));var _0x161c76=squel[_0x6324('0x55')]();var _0x2811a4=[];var _0x2319aa=squel[_0x6324('0x55')]();var _0x94973a;if(_0x3e29cf['query']['search']){_0x94973a=as[_0x6324('0x56')](_0x3e29cf[_0x6324('0x38')]['search']);var _0x3ef1ff=_0x94973a['sqlOperator'];for(var _0x23a243=0x0;_0x23a243<_0x94973a[_0x6324('0x57')][_0x6324('0x3e')];_0x23a243++){var _0x3e76c7=_0x94973a['conditions'][_0x23a243];var _0x2d04f8='i';var _0x36f039=_[_0x6324('0x58')](_0x5c76bd,['name',_0x3e76c7['field']]);if(!_0x36f039){switch(_0x3e76c7['field']){case'unreadMessages':if(_0x3e76c7[_0x6324('0x59')]==0x1){_0x20b31a[_0x6324('0x5a')]('`'+_0x3e76c7[_0x6324('0x44')]+_0x6324('0x5b'));}else{_0x20b31a[_0x6324('0x5a')]('`'+_0x3e76c7[_0x6324('0x44')]+'`\x20>\x200');}break;case'Contact':if(_0x3e76c7[_0x6324('0x5c')]===_0x6324('0x5d')){if(_0x3e76c7['value']['split']('\x20')[_0x6324('0x3e')]>0x1){_0x161c76[_0x3ef1ff](_0x6324('0x5e'),qs[_0x6324('0x5f')](_0x3e76c7[_0x6324('0x59')]),null);}else{var _0x269aa2='%'+_0x3e76c7[_0x6324('0x59')]+'%';_0x161c76[_0x3ef1ff]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x269aa2,_0x269aa2,_0x269aa2);}}else{_0x36f039=_['find'](_0x5c76bd,[_0x6324('0x29'),_0x6324('0x60')]);_0x3e76c7[_0x6324('0x44')]=_0x6324('0x60');_0x256dd5=as[_0x6324('0x61')](_0x2d04f8,_0x36f039['type'],_0x3e76c7);_0x161c76[_0x3ef1ff](_0x256dd5['text'],_0x256dd5[_0x6324('0x59')][_0x6324('0x62')],_0x256dd5[_0x6324('0x59')][_0x6324('0x1a')]);}break;case _0x6324('0x63'):var _0x3df74a=_0x3e76c7[_0x6324('0x59')][_0x6324('0x2e')](',')['map'](function(_0x26fb0d){return Number(_0x26fb0d);});_0x3df74a['forEach'](function(_0x258376){_0x2319aa['or'](_0x6324('0x64'),'%,'+_0x258376+',%');});_0x2811a4=_[_0x6324('0x65')](_0x2811a4,_0x3df74a);break;case _0x6324('0x66'):if(_0x3e76c7[_0x6324('0x5c')]===_0x6324('0x5d')){_0x161c76[_0x3ef1ff](_0x6324('0x67'),'%'+_0x3e76c7[_0x6324('0x59')]+'%',null);}else{_0x36f039=_[_0x6324('0x58')](_0x5c76bd,[_0x6324('0x29'),'UserId']);_0x3e76c7[_0x6324('0x44')]=_0x6324('0x68');_0x256dd5=as['buildExpression'](_0x2d04f8,_0x36f039[_0x6324('0x35')],_0x3e76c7);_0x161c76[_0x3ef1ff](_0x256dd5[_0x6324('0x69')],_0x256dd5[_0x6324('0x59')][_0x6324('0x62')],_0x256dd5['value'][_0x6324('0x1a')]);}break;case _0x6324('0x6a'):_0x256dd5=as['buildExpression']('me',null,_0x3e76c7);_0x161c76[_0x3ef1ff](_0x256dd5['text'],_0x256dd5['value']['start'],_0x256dd5[_0x6324('0x59')][_0x6324('0x1a')]);break;}}else{var _0x256dd5=as[_0x6324('0x61')](_0x2d04f8,_0x36f039[_0x6324('0x35')],_0x3e76c7);_0x161c76[_0x3ef1ff](_0x256dd5[_0x6324('0x69')],_0x256dd5[_0x6324('0x59')]['start'],_0x256dd5[_0x6324('0x59')][_0x6324('0x1a')]);}}}else{var _0x592ee9=_(_0x3e29cf[_0x6324('0x38')])[_0x6324('0x39')]()[_0x6324('0x2b')](function(_0x515872){return _[_0x6324('0x6b')](_0x5c76bd,[_0x6324('0x29'),_0x515872])?_0x515872:undefined;})[_0x6324('0x6c')]()[_0x6324('0x59')]();if(!_[_0x6324('0x6d')](_0x592ee9)){_0x592ee9['forEach'](function(_0x329edf){if(_0x329edf===_0x6324('0x6e')){_0x20b31a[_0x6324('0x6f')]('i.OpenchannelAccountId\x20IN\x20?',[][_0x6324('0x70')](_0x3e29cf[_0x6324('0x38')][_0x329edf]));}else if(_0x329edf===_0x6324('0x71')){var _0x1f55ec=JSON['parse'](_0x3e29cf[_0x6324('0x38')][_0x329edf])['$gte'];var _0x3a98c1=JSON['parse'](_0x3e29cf[_0x6324('0x38')][_0x329edf])['$lte'];_0x20b31a[_0x6324('0x6f')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x1f55ec,_0x3a98c1);}else{if(_0x3e29cf[_0x6324('0x38')][_0x329edf]===_0x6324('0x72')){_0x20b31a['where']('i.'+_0x329edf+_0x6324('0x73'));}else{_0x20b31a[_0x6324('0x6f')]('i.'+_0x329edf+'\x20=\x20?',_0x3e29cf[_0x6324('0x38')][_0x329edf]);}}});}if(_0x3e29cf['query'][_0x6324('0x74')]){if(_0x3e29cf[_0x6324('0x38')][_0x6324('0x74')]==0x1){_0x20b31a[_0x6324('0x5a')](_0x6324('0x75'));}else{_0x20b31a[_0x6324('0x5a')]('`unreadMessages`\x20>\x200');}}if(_0x3e29cf[_0x6324('0x38')][_0x6324('0x76')]){_0x2811a4=_[_0x6324('0x77')](_0x3e29cf[_0x6324('0x38')]['tag'])?_0x3e29cf['query'][_0x6324('0x76')]:new Array(_0x3e29cf[_0x6324('0x38')][_0x6324('0x76')]);_0x2811a4[_0x6324('0x78')](function(_0x62a19){_0x2319aa['or'](_0x6324('0x64'),'%,'+_0x62a19+',%');});}if(_0x3e29cf[_0x6324('0x38')][_0x6324('0x79')]){var _0x58a336=_0x3e29cf[_0x6324('0x38')][_0x6324('0x79')][_0x6324('0x7a')]('\x5c','\x5c\x5c')[_0x6324('0x7a')](/'/g,'\x27\x27');if(qs[_0x6324('0x7b')](_0x58a336)){_0x161c76['or']('i.id\x20LIKE\x20?',_0x58a336+'%');}else{_0x161c76['or'](_0x6324('0x7c'),qs[_0x6324('0x5f')](_0x58a336))['or'](_0x6324('0x7d'),_0x58a336+'%')['or'](_0x6324('0x7e'),_0x58a336+'%');}}}_0x20b31a[_0x6324('0x6f')](_0x161c76);_0x20b31a[_0x6324('0x7f')](_0x6324('0x80'));var _0xbc90b2={'type':db[_0x6324('0x81')]['QueryTypes']['SELECT'],'raw':!![]};var _0x4a5532=_0x20b31a[_0x6324('0x82')]();_0x4a5532[_0x6324('0x44')](_0x6324('0x80'));_0x4a5532[_0x6324('0x44')](_0x6324('0x83'),'unreadMessages');if(_0x3aff72['order']){_0x3aff72[_0x6324('0x40')][_0x6324('0x78')](function(_0x1da5bf){var _0x25aa7f=_0x1da5bf[0x0]==='contactName'?_0x1da5bf[0x0]:'i.'+_0x1da5bf[0x0];_0x20b31a[_0x6324('0x40')](_0x25aa7f,_0x1da5bf[0x1]===_0x6324('0x84')?![]:!![]);});}if(!_['isEmpty'](_0x2811a4)){_0x20b31a['having'](_0x2319aa);_0x4a5532[_0x6324('0x6f')](_0x6324('0x85'),_0x2811a4);}BPromise[_0x6324('0x86')]()[_0x6324('0x25')](function(){if(!_0x94973a){if(_0x3e29cf['query'][_0x6324('0x6e')])return;_0x4a5532[_0x6324('0x6f')](_0x6324('0x87'));_0x20b31a[_0x6324('0x6f')](_0x6324('0x87'));return;}if(_0x3e29cf[_0x6324('0x88')][_0x6324('0x89')]!==_0x6324('0x8a'))return;return _0x3e29cf[_0x6324('0x88')][_0x6324('0x8b')]({'attributes':['id'],'raw':!![]})[_0x6324('0x25')](function(_0x4511b7){if(_[_0x6324('0x6d')](_0x4511b7)){_0x4a5532[_0x6324('0x6f')](_0x6324('0x8c'));_0x20b31a[_0x6324('0x6f')](_0x6324('0x8c'));}else{_0x4a5532[_0x6324('0x6f')](_0x6324('0x8d'),_[_0x6324('0x2b')](_0x4511b7,'id'));_0x20b31a['where']('i.OpenchannelAccountId\x20IN\x20?',_[_0x6324('0x2b')](_0x4511b7,'id'));}});})['then'](function(){if(_0x3e29cf[_0x6324('0x88')][_0x6324('0x89')]===_0x6324('0x8a')&&!_0x94973a&&!_0x3e29cf[_0x6324('0x38')][_0x6324('0x6e')])return[];return db[_0x6324('0x8e')][_0x6324('0x38')](_0x4a5532[_0x6324('0x8f')](),_0xbc90b2);})['then'](function(_0x4f7c91){_0x3ab27b[_0x6324('0x1e')]=_0x4f7c91[_0x6324('0x3e')];if(_0x3ab27b['count']===0x0)return[];return db[_0x6324('0x8e')]['query'](_0x131b0a[_0x6324('0x8f')](),_0xbc90b2)[_0x6324('0x25')](function(_0x3a2e80){_0x278115=_['keyBy'](_0x3a2e80,'id');_0xbc90b2=_[_0x6324('0x90')](_0xbc90b2,{'model':db[_0x6324('0x33')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3e29cf[_0x6324('0x38')][_0x6324('0x3c')]){_0x3aff72[_0x6324('0x3d')][_0x6324('0x78')](function(_0x4279d1){_0x20b31a[_0x6324('0x44')]('i.'+_0x4279d1);});}else{_0x20b31a[_0x6324('0x44')](_0x6324('0x83'),_0x6324('0x91'));_0x20b31a[_0x6324('0x44')]('a.key',_0x6324('0x92'));_0x20b31a[_0x6324('0x44')](_0x6324('0x93'),'Account.mandatoryDisposition');_0x20b31a[_0x6324('0x44')](_0x6324('0x94'),'contactName');_0x20b31a[_0x6324('0x44')](_0x6324('0x95'));_0x20b31a['field'](_0x6324('0x96'),'Contact.firstName');_0x20b31a[_0x6324('0x44')](_0x6324('0x97'),_0x6324('0x98'));_0x20b31a[_0x6324('0x44')](_0x6324('0x99'),_0x6324('0x9a'));_0x20b31a['field'](_0x6324('0x9b'),'Contact.phone');_0x20b31a['field'](_0x6324('0x9c'),_0x6324('0x9d'));_0x20b31a[_0x6324('0x44')](_0x6324('0x9e'),'Contact.fax');_0x20b31a[_0x6324('0x44')](_0x6324('0x9f'),_0x6324('0xa0'));_0x20b31a[_0x6324('0x44')]('o.internal','Owner.internal');_0x20b31a[_0x6324('0x44')](_0x6324('0xa1'),_0x6324('0x2d'));}if(_0x3aff72['limit'])_0x20b31a['limit'](_0x3aff72[_0x6324('0x1d')]);if(_0x3aff72['offset'])_0x20b31a[_0x6324('0x1b')](_0x3aff72[_0x6324('0x1b')]);return db['sequelize'][_0x6324('0x38')](_0x20b31a[_0x6324('0x8f')](),_0xbc90b2);})[_0x6324('0x25')](function(_0x384ebe){if(_0x384ebe[_0x6324('0x3e')]>0x0)_0x589c2b[_0x6324('0x6f')](_0x6324('0xa2'),_['map'](_0x384ebe,'id'));return db[_0x6324('0x8e')]['query'](_0x589c2b[_0x6324('0x8f')](),_0xbc90b2)[_0x6324('0x25')](function(_0x1871ca){var _0x2e96ea=_['groupBy'](_0x1871ca,'OpenchannelInteractionId');var _0x32c79b=[];_0x384ebe[_0x6324('0x78')](function(_0x41a3bc){_0x32c79b['push'](updateOpenchannelInteraction(_0x41a3bc,_0x278115,_0x2e96ea));});return BPromise[_0x6324('0xa3')](_0x32c79b);});});})[_0x6324('0x25')](function(_0x45346b){_0x3ab27b['rows']=_0x45346b;return _0x3ab27b;})['then'](respondWithFilteredResult(_0x2945d8,_0x3aff72))[_0x6324('0x31')](handleError(_0x2945d8,null));};exports[_0x6324('0xa4')]=function(_0x3b513c,_0x24897c){var _0x20d6a8={};if(_0x3b513c[_0x6324('0x38')][_0x6324('0x35')]&&_0x3b513c[_0x6324('0x38')][_0x6324('0x35')]===_0x6324('0x46')){_0x20d6a8['from']=_0x3b513c['params']['id'];}else{_0x20d6a8['id']=_0x3b513c['params']['id'];}var _0x55a95e={'raw':![],'where':_0x20d6a8},_0x210176={};_0x210176['model']=_[_0x6324('0x39')](db[_0x6324('0x33')]['rawAttributes']);_0x210176[_0x6324('0x38')]=_[_0x6324('0x39')](_0x3b513c[_0x6324('0x38')]);_0x210176[_0x6324('0x3a')]=_[_0x6324('0x3b')](_0x210176[_0x6324('0x37')],_0x210176[_0x6324('0x38')]);_0x55a95e[_0x6324('0x3d')]=_[_0x6324('0x3b')](_0x210176[_0x6324('0x37')],qs[_0x6324('0x3c')](_0x3b513c['query'][_0x6324('0x3c')]));_0x55a95e[_0x6324('0x3d')]=_0x55a95e[_0x6324('0x3d')][_0x6324('0x3e')]?_0x55a95e[_0x6324('0x3d')]:_0x210176['model'];if(_0x3b513c[_0x6324('0x38')][_0x6324('0xa5')]){_0x55a95e[_0x6324('0xa6')]=[{'all':!![]}];}_0x55a95e=_[_0x6324('0x90')]({},_0x55a95e,_0x3b513c[_0x6324('0xa7')]);return db[_0x6324('0x33')][_0x6324('0x58')](_0x55a95e)[_0x6324('0x25')](handleEntityNotFound(_0x24897c,null))['then'](respondWithResult(_0x24897c,null))[_0x6324('0x31')](handleError(_0x24897c,null));};exports[_0x6324('0xa8')]=function(_0xeb2172,_0x5e6ad1){return db[_0x6324('0x33')]['create'](_0xeb2172[_0x6324('0x6a')],{})['then'](respondWithResult(_0x5e6ad1,0xc9))['catch'](handleError(_0x5e6ad1,null));};exports[_0x6324('0x24')]=function(_0x4889c3,_0x3c1ba3){if(_0x4889c3[_0x6324('0x6a')]['id']){delete _0x4889c3[_0x6324('0x6a')]['id'];}return db[_0x6324('0x33')][_0x6324('0x58')]({'where':{'id':_0x4889c3[_0x6324('0xa9')]['id']}})[_0x6324('0x25')](handleEntityNotFound(_0x3c1ba3,null))[_0x6324('0x25')](saveUpdates(_0x4889c3['body'],null))[_0x6324('0x25')](respondWithResult(_0x3c1ba3,null))[_0x6324('0x31')](handleError(_0x3c1ba3,null));};exports[_0x6324('0x26')]=function(_0x1f389f,_0x419df0){return db[_0x6324('0x33')][_0x6324('0x58')]({'where':{'id':_0x1f389f['params']['id']}})[_0x6324('0x25')](handleEntityNotFound(_0x419df0,null))[_0x6324('0x25')](removeEntity(_0x419df0,null))[_0x6324('0x31')](handleError(_0x419df0,null));};exports[_0x6324('0xaa')]=function(_0x314820,_0x277842){return db[_0x6324('0x33')][_0x6324('0xaa')]()['then'](respondWithResult(_0x277842,null))[_0x6324('0x31')](handleError(_0x277842,null));};exports['addMessage']=function(_0x2058a8,_0x292295,_0x18a994){return db[_0x6324('0xab')]['find']({'where':{'id':_0x2058a8[_0x6324('0xa9')]['id']}})[_0x6324('0x25')](handleEntityNotFound(_0x292295,null))[_0x6324('0x25')](function(_0x5c7dc1){if(_0x5c7dc1){return _0x5c7dc1[_0x6324('0xac')](_0x2058a8[_0x6324('0x6a')][_0x6324('0xad')],_[_0x6324('0xae')](_0x2058a8[_0x6324('0x6a')],[_0x6324('0xad'),'id'])||{});}})[_0x6324('0x25')](respondWithResult(_0x292295,null))[_0x6324('0x31')](handleError(_0x292295,null));};exports[_0x6324('0xaf')]=function(_0x1151fa,_0x398bbf,_0x4bd43b){var _0x3fc153={'raw':![],'where':{}};var _0x114254={};var _0x54be42={'count':0x0,'rows':[]};return db[_0x6324('0x33')]['findOne']({'where':{'id':_0x1151fa['params']['id']}})[_0x6324('0x25')](handleEntityNotFound(_0x398bbf,null))[_0x6324('0x25')](function(_0xf9c26f){if(_0xf9c26f){_0x114254[_0x6324('0x37')]=_[_0x6324('0x39')](db['OpenchannelMessage']['rawAttributes']);_0x114254[_0x6324('0x38')]=_[_0x6324('0x39')](_0x1151fa['query']);_0x114254[_0x6324('0x3a')]=_[_0x6324('0x3b')](_0x114254[_0x6324('0x37')],_0x114254['query']);_0x3fc153[_0x6324('0x3d')]=_['intersection'](_0x114254[_0x6324('0x37')],qs[_0x6324('0x3c')](_0x1151fa[_0x6324('0x38')]['fields']));_0x3fc153[_0x6324('0x3d')]=_0x3fc153['attributes'][_0x6324('0x3e')]?_0x3fc153['attributes']:_0x114254['model'];if(!_0x1151fa[_0x6324('0x38')]['hasOwnProperty']('nolimit')){_0x3fc153[_0x6324('0x1d')]=qs[_0x6324('0x1d')](_0x1151fa['query'][_0x6324('0x1d')]);_0x3fc153[_0x6324('0x1b')]=qs['offset'](_0x1151fa['query'][_0x6324('0x1b')]);}_0x3fc153[_0x6324('0x40')]=qs[_0x6324('0x41')](_0x1151fa[_0x6324('0x38')]['sort']);_0x3fc153[_0x6324('0x6f')]=qs[_0x6324('0x3a')](_['pick'](_0x1151fa[_0x6324('0x38')],_0x114254[_0x6324('0x3a')]));_0x3fc153[_0x6324('0x6f')][_0x6324('0xb0')]=_0xf9c26f['id'];if(_0x1151fa[_0x6324('0x38')][_0x6324('0x79')]){_0x3fc153[_0x6324('0x6f')]=_[_0x6324('0x90')](_0x3fc153[_0x6324('0x6f')],{'$or':_[_0x6324('0x2b')](_0x3fc153[_0x6324('0x3d')],function(_0x258785){var _0x71c4bb={};_0x71c4bb[_0x258785]={'$like':'%'+_0x1151fa[_0x6324('0x38')][_0x6324('0x79')]+'%'};return _0x71c4bb;})});}if(_0x1151fa[_0x6324('0x38')][_0x6324('0xb1')]){var _0x5e2e76=_0x1151fa['query'][_0x6324('0xb1')][_0x6324('0x2e')](',');var _0xa2f79a={};_0xa2f79a[_0x5e2e76[0x0]]={'$gte':moment(_0x5e2e76[0x1])[_0x6324('0xb2')](_0x6324('0xb3'))};_0x3fc153[_0x6324('0x6f')]=_[_0x6324('0x90')](_0x3fc153['where'],_0xa2f79a);}_0x3fc153=_[_0x6324('0x90')]({},_0x3fc153,_0x1151fa[_0x6324('0xa7')]);return db[_0x6324('0xab')][_0x6324('0x1e')]({'where':_0x3fc153[_0x6324('0x6f')]})[_0x6324('0x25')](function(_0x2fdd55){_0x54be42['count']=_0x2fdd55;if(_0x1151fa[_0x6324('0x38')][_0x6324('0xa5')]){_0x3fc153[_0x6324('0xa6')]=[{'all':!![]}];}return db[_0x6324('0xab')]['findAll'](_0x3fc153);})[_0x6324('0x25')](function(_0x3fced8){_0x54be42[_0x6324('0xb4')]=_0x3fced8;return _0x54be42;});}})[_0x6324('0x25')](respondWithFilteredResult(_0x398bbf,_0x3fc153))['catch'](handleError(_0x398bbf,null));};exports[_0x6324('0xb5')]=function(_0x505891,_0xc6e015,_0x474b7e){return db[_0x6324('0x33')][_0x6324('0x58')]({'where':{'id':_0x505891[_0x6324('0xa9')]['id']}})[_0x6324('0x25')](handleEntityNotFound(_0xc6e015,null))[_0x6324('0x25')](function(_0x41fac8){if(_0x41fac8){return _0x41fac8[_0x6324('0xb6')](_0x505891[_0x6324('0x6a')][_0x6324('0xad')],_[_0x6324('0xae')](_0x505891[_0x6324('0x6a')],[_0x6324('0xad'),'id'])||{})[_0x6324('0xb7')](function(){return db[_0x6324('0x63')][_0x6324('0xb8')]({'attributes':['id',_0x6324('0x29'),'color'],'where':{'id':_0x505891[_0x6324('0x6a')]['ids']}});})['then'](function(_0x3835fa){socket[_0x6324('0xb9')](_0x6324('0xba'),{'id':Number(_0x505891[_0x6324('0xa9')]['id']),'tags':_0x3835fa||[]});return{'id':Number(_0x505891[_0x6324('0xa9')]['id']),'tags':_0x3835fa||[]};});}})[_0x6324('0x25')](respondWithResult(_0xc6e015,null))[_0x6324('0x31')](handleError(_0xc6e015,null));};exports[_0x6324('0xbb')]=function(_0x35c47c,_0x4e392e,_0x75c340){return db[_0x6324('0x33')][_0x6324('0x58')]({'where':{'id':_0x35c47c[_0x6324('0xa9')]['id']}})[_0x6324('0x25')](handleEntityNotFound(_0x4e392e,null))['then'](function(_0x3f6f1b){if(_0x3f6f1b){return _0x3f6f1b['removeTags'](_0x35c47c[_0x6324('0x38')][_0x6324('0xad')]);}})[_0x6324('0x25')](respondWithStatusCode(_0x4e392e,null))['catch'](handleError(_0x4e392e,null));};exports[_0x6324('0xbc')]=function(_0x375b0b,_0x2224ba){var _0x49a794=moment()[_0x6324('0xbd')]()[_0x6324('0x8f')]();var _0x43606d=path[_0x6324('0xbe')](config['root'],_0x6324('0xbf'),_0x6324('0xc0'),_0x6324('0xc1'));var _0x5bfbf1=path[_0x6324('0xbe')](config[_0x6324('0xc2')],'server','files',_0x6324('0xc3'));var _0xbca67a=path[_0x6324('0xbe')](_0x43606d,_0x49a794);var _0x231f9c=util[_0x6324('0xb2')](_0x6324('0xc4'),_0x375b0b[_0x6324('0xa9')]['id'],_0x49a794);var _0x384c01=path[_0x6324('0xbe')](_0x43606d,_0x231f9c);var _0x570a5a=[];_0x570a5a['push']({'model':db[_0x6324('0x66')],'as':_0x6324('0x66'),'attributes':['id',_0x6324('0x2c')],'raw':!![]});_0x570a5a[_0x6324('0x30')]({'model':db['CmContact'],'as':_0x6324('0xc5'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x375b0b[_0x6324('0x38')][_0x6324('0xc3')]){_0x570a5a[_0x6324('0x30')]({'model':db['Attachment'],'as':_0x6324('0xc6'),'raw':!![]});}var _0x2d3bb3=[{'model':db[_0x6324('0xab')],'as':_0x6324('0xc7'),'attributes':['id',_0x6324('0x6a'),_0x6324('0x71'),_0x6324('0xc8'),'secret',_0x6324('0x74')],'include':_0x570a5a}];_0x2d3bb3[_0x6324('0x30')]({'model':db['OpenchannelAccount'],'as':_0x6324('0xc9'),'attributes':['id','name']});_0x2d3bb3[_0x6324('0x30')]({'model':db[_0x6324('0x66')],'as':_0x6324('0xca'),'attributes':['id','fullname']});return db[_0x6324('0x33')][_0x6324('0x58')]({'where':{'id':_0x375b0b['params']['id']},'include':_0x2d3bb3})['then'](handleEntityNotFound(_0x2224ba,null))[_0x6324('0x25')](function(_0x4e679){if(_0x4e679){var _0xb8750e=_0x4e679['get']({'plain':!![]});fs['mkdirSync'](_0xbca67a);var _0x3d0cc7={'channel':_0x6324('0xcb'),'account':_0xb8750e[_0x6324('0xc9')]['name'],'agent':_0xb8750e['Owner']?_0xb8750e[_0x6324('0xca')][_0x6324('0x2c')]:'N.A.','createdAt':moment(_0xb8750e[_0x6324('0x71')])['format'](_0x6324('0xb3'))[_0x6324('0x8f')](),'closedAt':_0xb8750e[_0x6324('0xcc')]?moment(_0xb8750e['closedAt'])[_0x6324('0xb2')]('YYYY-MM-DD\x20HH:mm:ss')[_0x6324('0x8f')]():'','disposition':_0xb8750e[_0x6324('0xcd')],'visibility':_0xb8750e[_0x6324('0xce')]?_0x6324('0xcf'):_0x6324('0xd0'),'messages':_(_0xb8750e[_0x6324('0xc7')])[_0x6324('0x79')]({'secret':![]})[_0x6324('0x2b')](function(_0x3eec58){if(_0x3eec58[_0x6324('0xc6')]){var _0x1e2243=path[_0x6324('0xbe')](_0x5bfbf1,_0x3eec58['Attachment']['basename']);if(fs['existsSync'](_0x1e2243)){fs['createReadStream'](_0x1e2243)[_0x6324('0xd1')](fs[_0x6324('0xd2')](path[_0x6324('0xbe')](_0xbca67a,_0x3eec58['Attachment']['basename'])));}}return{'date':moment(_0x3eec58[_0x6324('0x71')])[_0x6324('0xb2')](_0x6324('0xb3'))[_0x6324('0x8f')](),'sender':_0x3eec58[_0x6324('0xc8')]==='out'?_0x3eec58[_0x6324('0x66')]?_0x3eec58[_0x6324('0x66')][_0x6324('0x2c')]:_0x6324('0xd3'):_0x3eec58[_0x6324('0xc5')][_0x6324('0xd4')]+(_0x3eec58[_0x6324('0xc5')][_0x6324('0xd5')]?'\x20'+_0x3eec58[_0x6324('0xc5')]['lastName']:''),'body':_0x3eec58[_0x6324('0xc6')]?_0x3eec58[_0x6324('0xc6')][_0x6324('0xd6')]:_0x3eec58[_0x6324('0x6a')],'direction':_0x3eec58[_0x6324('0xc8')]===_0x6324('0xd7')?'A':'C','secret':_0x3eec58[_0x6324('0xd8')],'read':_0x3eec58[_0x6324('0x74')],'attachment':_0x3eec58['Attachment']};})[_0x6324('0x59')]()};return ejs[_0x6324('0xd9')](path[_0x6324('0xbe')](config[_0x6324('0xc2')],_0x6324('0xbf'),_0x6324('0xda'),_0x6324('0xdb')),{'interaction':_0x3d0cc7})['then'](function(_0x52a54b){var _0x1bd513=path['join'](_0xbca67a,_0x6324('0xdc')+_0xb8750e['id']+'-'+_0x49a794+_0x6324('0xdd'));var _0x10cb30={'path':_0x1bd513,'channel':_0x6324('0xcb'),'interactionId':_0xb8750e['id']};return pdf['createPdfFromHTML'](_0x52a54b,_0x10cb30);})['then'](function(){return new BPromise(function(_0x5f43f7,_0x5f79db){zipdir(_0xbca67a,{'saveTo':_0x384c01},function(_0x22a6de,_0x49d945){if(_0x22a6de)return _0x5f79db(_0x22a6de);return _0x5f43f7(_0x49d945);});})[_0x6324('0x25')](function(){return new BPromise(function(_0x4d3a5e,_0x319999){rimraf(_0xbca67a,function(_0x4b78e0){if(_0x4b78e0)_0x319999(_0x4b78e0);return _0x4d3a5e();});});})[_0x6324('0x25')](function(){return _0x2224ba[_0x6324('0xbc')](_0x384c01,_0x231f9c,function(_0x4ca7a0){if(_0x4ca7a0){console['log'](_0x6324('0xde'),_0x4ca7a0);}else{fs[_0x6324('0xdf')](_0x384c01);}});});});}else{return _0x2224ba[_0x6324('0x18')](0xc8);}})['catch'](handleError(_0x2224ba,null));}; \ No newline at end of file +var _0x7a03=['direction','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','threadId','Public','Private','Messages','basename','existsSync','createReadStream','createWriteStream','out','firstName','renderFile','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','moment','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','redis','./openchannelInteraction.socket','status','json','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','end','sendStatus','error','name','send','Users','fullname','Tags','TagIds','split','catch','index','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','offset','order','sort','where','pick','field','color','from','tools_tags','select','u.id','u.fullname','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','openchannel_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','conditions','length','find','unreadMessages','value','`\x20>\x200','Contact','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','ContactId','type','text','start','Tag','forEach','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','having','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','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?','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','keyBy','OpenchannelInteraction','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.phone','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','push','all','rows','params','rawAttributes','includeAll','include','merge','options','body','describe','addMessage','OpenchannelMessage','ids','findOne','nolimit','filter','format','findAll','addTags','setTags','omit','spread','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','files','attachments','CmContact','Attachment'];(function(_0x3fcc96,_0x1c65d4){var _0x5caa7a=function(_0x39962c){while(--_0x39962c){_0x3fcc96['push'](_0x3fcc96['shift']());}};_0x5caa7a(++_0x1c65d4);}(_0x7a03,0x1ed));var _0x37a0=function(_0x149fd4,_0x38786b){_0x149fd4=_0x149fd4-0x0;var _0xfb4c6b=_0x7a03[_0x149fd4];return _0xfb4c6b;};'use strict';var emlformat=require(_0x37a0('0x0'));var rimraf=require(_0x37a0('0x1'));var zipdir=require(_0x37a0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x37a0('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x37a0('0x4'));var path=require(_0x37a0('0x5'));var sox=require(_0x37a0('0x6'));var csv=require(_0x37a0('0x7'));var ejs=require(_0x37a0('0x8'));var fs=require('fs');var fs_extra=require(_0x37a0('0x9'));var _=require('lodash');var squel=require(_0x37a0('0xa'));var crypto=require(_0x37a0('0xb'));var jsforce=require(_0x37a0('0xc'));var deskjs=require(_0x37a0('0xd'));var toCsv=require(_0x37a0('0x7'));var querystring=require(_0x37a0('0xe'));var Papa=require(_0x37a0('0xf'));var Redis=require('ioredis');var authService=require(_0x37a0('0x10'));var qs=require(_0x37a0('0x11'));var as=require(_0x37a0('0x12'));var pdf=require(_0x37a0('0x13'));var hardwareService=require(_0x37a0('0x14'));var logger=require('../../config/logger')(_0x37a0('0x15'));var utils=require('../../config/utils');var config=require(_0x37a0('0x16'));var licenseUtil=require(_0x37a0('0x17'));var db=require(_0x37a0('0x18'))['db'];config['redis']=_[_0x37a0('0x19')](config['redis'],{'host':_0x37a0('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x37a0('0x1b')]));require(_0x37a0('0x1c'))['register'](socket);function respondWithStatusCode(_0x3946d5,_0x42a580){_0x42a580=_0x42a580||0xcc;return function(_0x5c8d75){if(_0x5c8d75){return _0x3946d5['sendStatus'](_0x42a580);}return _0x3946d5[_0x37a0('0x1d')](_0x42a580)['end']();};}function respondWithResult(_0x155fe2,_0x5b7f9c){_0x5b7f9c=_0x5b7f9c||0xc8;return function(_0x19aa9e){if(_0x19aa9e){return _0x155fe2[_0x37a0('0x1d')](_0x5b7f9c)[_0x37a0('0x1e')](_0x19aa9e);}};}function respondWithFilteredResult(_0x5dd58d,_0xab6814){return function(_0x26e14d){if(_0x26e14d){var _0x50fd3d=typeof _0xab6814['offset']===_0x37a0('0x1f')&&typeof _0xab6814[_0x37a0('0x20')]===_0x37a0('0x1f');var _0x4b3c6f=_0x26e14d[_0x37a0('0x21')];var _0x67df7e=_0x50fd3d?0x0:_0xab6814['offset'];var _0x49148f=_0x50fd3d?_0x26e14d[_0x37a0('0x21')]:_0xab6814['offset']+_0xab6814[_0x37a0('0x20')];var _0x2fab3f;if(_0x49148f>=_0x4b3c6f){_0x49148f=_0x4b3c6f;_0x2fab3f=0xc8;}else{_0x2fab3f=0xce;}_0x5dd58d['status'](_0x2fab3f);return _0x5dd58d[_0x37a0('0x22')](_0x37a0('0x23'),_0x67df7e+'-'+_0x49148f+'/'+_0x4b3c6f)[_0x37a0('0x1e')](_0x26e14d);}return null;};}function patchUpdates(_0x188e65){return function(_0x883902){try{jsonpatch[_0x37a0('0x24')](_0x883902,_0x188e65,!![]);}catch(_0x1a0baf){return BPromise['reject'](_0x1a0baf);}return _0x883902[_0x37a0('0x25')]();};}function saveUpdates(_0x1e3a90,_0x334637){return function(_0x12e443){if(_0x12e443){return _0x12e443[_0x37a0('0x26')](_0x1e3a90)[_0x37a0('0x27')](function(_0x520cfa){return _0x520cfa;});}return null;};}function removeEntity(_0x4fcb4f,_0x3ae9f1){return function(_0x39329e){if(_0x39329e){return _0x39329e[_0x37a0('0x28')]()[_0x37a0('0x27')](function(){_0x4fcb4f['status'](0xcc)[_0x37a0('0x29')]();});}};}function handleEntityNotFound(_0x2678f0,_0x2c81ae){return function(_0x5851ed){if(!_0x5851ed){_0x2678f0[_0x37a0('0x2a')](0x194);}return _0x5851ed;};}function handleError(_0x360fdd,_0x109d31){_0x109d31=_0x109d31||0x1f4;return function(_0x1d6971){logger[_0x37a0('0x2b')](_0x1d6971['stack']);if(_0x1d6971[_0x37a0('0x2c')]){delete _0x1d6971['name'];}_0x360fdd['status'](_0x109d31)[_0x37a0('0x2d')](_0x1d6971);};}function getInteractionUsers(_0x3dc09f,_0x34af0c){return new BPromise(function(_0x40f631,_0x1a0df8){try{if(_0x34af0c[_0x3dc09f['id']]){_0x3dc09f[_0x37a0('0x2e')]=_['map'](_0x34af0c[_0x3dc09f['id']],function(_0x46a240){return{'id':_0x46a240['id'],'fullname':_0x46a240[_0x37a0('0x2f')]};});}}catch(_0x3396f1){_0x1a0df8(_0x3396f1);}_0x40f631(_0x3dc09f);});}function getInteractionTags(_0x33e9a5,_0x3fb20a){return new BPromise(function(_0x48726d,_0x5b1044){try{if(_0x33e9a5['TagIds']){_0x33e9a5[_0x37a0('0x30')]=[];_0x33e9a5[_0x37a0('0x31')][_0x37a0('0x32')](',')['forEach'](function(_0x833586){_0x33e9a5[_0x37a0('0x30')]['push'](_0x3fb20a[_0x833586]);});}delete _0x33e9a5[_0x37a0('0x31')];}catch(_0x3fa654){_0x5b1044(_0x3fa654);}_0x48726d(_0x33e9a5);});}function updateOpenchannelInteraction(_0x2bb51d,_0x18d173,_0x546754){return new BPromise(function(_0x32866c,_0x5b26ef){return getInteractionUsers(_0x2bb51d,_0x546754)[_0x37a0('0x27')](function(_0x4a3fc1){return getInteractionTags(_0x4a3fc1,_0x18d173);})['then'](function(_0x48508f){_0x32866c(_0x48508f);})[_0x37a0('0x33')](function(_0x40c2a9){_0x5b26ef(_0x40c2a9);});});}exports[_0x37a0('0x34')]=function(_0x2b05d6,_0x169b85){var _0x42e50f={},_0x5cc6c6={},_0x3753bf={'count':0x0,'rows':[]};var _0x1197a0=_[_0x37a0('0x35')](db['OpenchannelInteraction']['rawAttributes'],function(_0x52d28a){return{'name':_0x52d28a['fieldName'],'type':_0x52d28a['type']['key']};});_0x5cc6c6['model']=_[_0x37a0('0x35')](_0x1197a0,_0x37a0('0x2c'));_0x5cc6c6[_0x37a0('0x36')]=_[_0x37a0('0x37')](_0x2b05d6[_0x37a0('0x36')]);_0x5cc6c6[_0x37a0('0x38')]=_[_0x37a0('0x39')](_0x5cc6c6[_0x37a0('0x3a')],_0x5cc6c6[_0x37a0('0x36')]);_0x42e50f[_0x37a0('0x3b')]=_['intersection'](_0x5cc6c6['model'],qs['fields'](_0x2b05d6['query'][_0x37a0('0x3c')]));_0x42e50f[_0x37a0('0x3b')]=_0x42e50f[_0x37a0('0x3b')]['length']?_0x42e50f[_0x37a0('0x3b')]:_0x5cc6c6['model'];if(!_0x2b05d6[_0x37a0('0x36')][_0x37a0('0x3d')]('nolimit')){_0x42e50f[_0x37a0('0x20')]=qs[_0x37a0('0x20')](_0x2b05d6[_0x37a0('0x36')]['limit']);_0x42e50f[_0x37a0('0x3e')]=qs[_0x37a0('0x3e')](_0x2b05d6[_0x37a0('0x36')][_0x37a0('0x3e')]);}_0x42e50f[_0x37a0('0x3f')]=qs['sort'](_0x2b05d6[_0x37a0('0x36')][_0x37a0('0x40')]);_0x42e50f[_0x37a0('0x41')]=qs[_0x37a0('0x38')](_[_0x37a0('0x42')](_0x2b05d6['query'],_0x5cc6c6[_0x37a0('0x38')]),_0x1197a0);var _0x374090=[];var _0x8aff44=squel['select']()[_0x37a0('0x43')]('id')[_0x37a0('0x43')]('name')[_0x37a0('0x43')](_0x37a0('0x44'))[_0x37a0('0x45')](_0x37a0('0x46'));var _0x343d29=squel[_0x37a0('0x47')]()[_0x37a0('0x43')](_0x37a0('0x48'))[_0x37a0('0x43')](_0x37a0('0x49'))[_0x37a0('0x43')]('ui.OpenchannelInteractionId')[_0x37a0('0x45')](_0x37a0('0x4a'),'ui')[_0x37a0('0x4b')](_0x37a0('0x4c'),'u',_0x37a0('0x4d'));var _0x2f954c=squel[_0x37a0('0x47')]()['from'](_0x37a0('0x4e'),'i')[_0x37a0('0x4b')](_0x37a0('0x4f'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x37a0('0x4b')](_0x37a0('0x4c'),'o',_0x37a0('0x50'))[_0x37a0('0x4b')](_0x37a0('0x51'),'a',_0x37a0('0x52'))['left_join'](_0x37a0('0x53'),'me','me.OpenchannelInteractionId\x20=\x20i.id')[_0x37a0('0x4b')](_0x37a0('0x54'),'it','it.OpenchannelInteractionId\x20=\x20i.id')[_0x37a0('0x4b')](_0x37a0('0x46'),'t',_0x37a0('0x55'));var _0x56124b=squel[_0x37a0('0x56')]();var _0x2c1438=[];var _0x49ceb1=squel[_0x37a0('0x56')]();var _0x366864;if(_0x2b05d6[_0x37a0('0x36')][_0x37a0('0x57')]){_0x366864=as['parseSearch'](_0x2b05d6['query'][_0x37a0('0x57')]);var _0xf65cf8=_0x366864['sqlOperator'];for(var _0x2e0508=0x0;_0x2e0508<_0x366864[_0x37a0('0x58')][_0x37a0('0x59')];_0x2e0508++){var _0x43e245=_0x366864['conditions'][_0x2e0508];var _0x352011='i';var _0x1bcd24=_[_0x37a0('0x5a')](_0x1197a0,[_0x37a0('0x2c'),_0x43e245['field']]);if(!_0x1bcd24){switch(_0x43e245[_0x37a0('0x43')]){case _0x37a0('0x5b'):if(_0x43e245[_0x37a0('0x5c')]==0x1){_0x2f954c['having']('`'+_0x43e245[_0x37a0('0x43')]+'`\x20=\x200');}else{_0x2f954c['having']('`'+_0x43e245['field']+_0x37a0('0x5d'));}break;case _0x37a0('0x5e'):if(_0x43e245['operator']==='$substring'){if(_0x43e245['value'][_0x37a0('0x32')]('\x20')[_0x37a0('0x59')]>0x1){_0x56124b[_0xf65cf8](_0x37a0('0x5f'),qs['getFullTextValue'](_0x43e245[_0x37a0('0x5c')]),null);}else{var _0x28dcef='%'+_0x43e245[_0x37a0('0x5c')]+'%';_0x56124b[_0xf65cf8]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x28dcef,_0x28dcef,_0x28dcef);}}else{_0x1bcd24=_[_0x37a0('0x5a')](_0x1197a0,[_0x37a0('0x2c'),'ContactId']);_0x43e245[_0x37a0('0x43')]=_0x37a0('0x60');_0x515497=as['buildExpression'](_0x352011,_0x1bcd24[_0x37a0('0x61')],_0x43e245);_0x56124b[_0xf65cf8](_0x515497[_0x37a0('0x62')],_0x515497[_0x37a0('0x5c')][_0x37a0('0x63')],_0x515497['value'][_0x37a0('0x29')]);}break;case _0x37a0('0x64'):var _0x31f225=_0x43e245[_0x37a0('0x5c')]['split'](',')[_0x37a0('0x35')](function(_0x2c4c59){return Number(_0x2c4c59);});_0x31f225[_0x37a0('0x65')](function(_0x246d57){_0x49ceb1['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x246d57+',%');});_0x2c1438=_[_0x37a0('0x66')](_0x2c1438,_0x31f225);break;case _0x37a0('0x67'):if(_0x43e245['operator']===_0x37a0('0x68')){_0x56124b[_0xf65cf8](_0x37a0('0x69'),'%'+_0x43e245[_0x37a0('0x5c')]+'%',null);}else{_0x1bcd24=_['find'](_0x1197a0,['name',_0x37a0('0x6a')]);_0x43e245[_0x37a0('0x43')]=_0x37a0('0x6a');_0x515497=as[_0x37a0('0x6b')](_0x352011,_0x1bcd24[_0x37a0('0x61')],_0x43e245);_0x56124b[_0xf65cf8](_0x515497[_0x37a0('0x62')],_0x515497['value'][_0x37a0('0x63')],_0x515497['value'][_0x37a0('0x29')]);}break;case'body':_0x515497=as[_0x37a0('0x6b')]('me',null,_0x43e245);_0x56124b[_0xf65cf8](_0x515497[_0x37a0('0x62')],_0x515497[_0x37a0('0x5c')][_0x37a0('0x63')],_0x515497[_0x37a0('0x5c')][_0x37a0('0x29')]);break;}}else{var _0x515497=as[_0x37a0('0x6b')](_0x352011,_0x1bcd24[_0x37a0('0x61')],_0x43e245);_0x56124b[_0xf65cf8](_0x515497[_0x37a0('0x62')],_0x515497[_0x37a0('0x5c')]['start'],_0x515497['value']['end']);}}}else{var _0x34aaf1=_(_0x2b05d6[_0x37a0('0x36')])[_0x37a0('0x37')]()[_0x37a0('0x35')](function(_0x2fcefb){return _['some'](_0x1197a0,[_0x37a0('0x2c'),_0x2fcefb])?_0x2fcefb:undefined;})['compact']()['value']();if(!_[_0x37a0('0x6c')](_0x34aaf1)){_0x34aaf1['forEach'](function(_0x23a354){if(_0x23a354===_0x37a0('0x6d')){_0x2f954c[_0x37a0('0x41')](_0x37a0('0x6e'),[][_0x37a0('0x6f')](_0x2b05d6[_0x37a0('0x36')][_0x23a354]));}else if(_0x23a354===_0x37a0('0x70')){var _0x2ec477=JSON['parse'](_0x2b05d6[_0x37a0('0x36')][_0x23a354])[_0x37a0('0x71')];var _0x159b1d=JSON[_0x37a0('0x72')](_0x2b05d6['query'][_0x23a354])[_0x37a0('0x73')];_0x2f954c[_0x37a0('0x41')](_0x37a0('0x74'),_0x2ec477,_0x159b1d);}else{if(_0x2b05d6[_0x37a0('0x36')][_0x23a354]===_0x37a0('0x75')){_0x2f954c[_0x37a0('0x41')]('i.'+_0x23a354+_0x37a0('0x76'));}else{_0x2f954c['where']('i.'+_0x23a354+_0x37a0('0x77'),_0x2b05d6[_0x37a0('0x36')][_0x23a354]);}}});}if(_0x2b05d6['query'][_0x37a0('0x78')]){if(_0x2b05d6[_0x37a0('0x36')][_0x37a0('0x78')]==0x1){_0x2f954c[_0x37a0('0x79')](_0x37a0('0x7a'));}else{_0x2f954c[_0x37a0('0x79')](_0x37a0('0x7b'));}}if(_0x2b05d6[_0x37a0('0x36')]['tag']){_0x2c1438=_[_0x37a0('0x7c')](_0x2b05d6['query']['tag'])?_0x2b05d6[_0x37a0('0x36')][_0x37a0('0x7d')]:new Array(_0x2b05d6['query'][_0x37a0('0x7d')]);_0x2c1438[_0x37a0('0x65')](function(_0x35d2e5){_0x49ceb1['or'](_0x37a0('0x7e'),'%,'+_0x35d2e5+',%');});}if(_0x2b05d6['query']['filter']){var _0x2df78c=_0x2b05d6[_0x37a0('0x36')]['filter'][_0x37a0('0x7f')]('\x5c','\x5c\x5c')[_0x37a0('0x7f')](/'/g,'\x27\x27');if(qs[_0x37a0('0x80')](_0x2df78c)){_0x56124b['or'](_0x37a0('0x81'),_0x2df78c+'%');}else{_0x56124b['or'](_0x37a0('0x82'),qs[_0x37a0('0x83')](_0x2df78c))['or']('i.from\x20LIKE\x20?',_0x2df78c+'%')['or'](_0x37a0('0x84'),_0x2df78c+'%');}}}_0x2f954c[_0x37a0('0x41')](_0x56124b);_0x2f954c['group']('i.id');var _0x1b1d32={'type':db[_0x37a0('0x85')][_0x37a0('0x86')][_0x37a0('0x87')],'raw':!![]};var _0x441b7d=_0x2f954c[_0x37a0('0x88')]();_0x441b7d[_0x37a0('0x43')](_0x37a0('0x89'));_0x441b7d['field'](_0x37a0('0x8a'),'unreadMessages');if(_0x42e50f[_0x37a0('0x3f')]){_0x42e50f['order'][_0x37a0('0x65')](function(_0x38c024){var _0x517896=_0x38c024[0x0]===_0x37a0('0x8b')?_0x38c024[0x0]:'i.'+_0x38c024[0x0];_0x2f954c[_0x37a0('0x3f')](_0x517896,_0x38c024[0x1]==='DESC'?![]:!![]);});}if(!_[_0x37a0('0x6c')](_0x2c1438)){_0x2f954c[_0x37a0('0x79')](_0x49ceb1);_0x441b7d['where'](_0x37a0('0x8c'),_0x2c1438);}BPromise[_0x37a0('0x8d')]()[_0x37a0('0x27')](function(){if(!_0x366864){if(_0x2b05d6[_0x37a0('0x36')][_0x37a0('0x6d')])return;_0x441b7d[_0x37a0('0x41')](_0x37a0('0x8e'));_0x2f954c[_0x37a0('0x41')](_0x37a0('0x8e'));return;}if(_0x2b05d6[_0x37a0('0x8f')][_0x37a0('0x90')]!==_0x37a0('0x91'))return;return _0x2b05d6[_0x37a0('0x8f')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x34b5c0){if(_['isEmpty'](_0x34b5c0)){_0x441b7d[_0x37a0('0x41')](_0x37a0('0x92'));_0x2f954c[_0x37a0('0x41')](_0x37a0('0x92'));}else{_0x441b7d[_0x37a0('0x41')](_0x37a0('0x6e'),_['map'](_0x34b5c0,'id'));_0x2f954c['where'](_0x37a0('0x6e'),_[_0x37a0('0x35')](_0x34b5c0,'id'));}});})['then'](function(){if(_0x2b05d6[_0x37a0('0x8f')][_0x37a0('0x90')]===_0x37a0('0x91')&&!_0x366864&&!_0x2b05d6[_0x37a0('0x36')][_0x37a0('0x6d')])return[];return db[_0x37a0('0x93')]['query'](_0x441b7d[_0x37a0('0x94')](),_0x1b1d32);})[_0x37a0('0x27')](function(_0x26a1fd){_0x3753bf[_0x37a0('0x21')]=_0x26a1fd['length'];if(_0x3753bf[_0x37a0('0x21')]===0x0)return[];return db[_0x37a0('0x93')]['query'](_0x8aff44['toString'](),_0x1b1d32)[_0x37a0('0x27')](function(_0x285606){_0x374090=_[_0x37a0('0x95')](_0x285606,'id');_0x1b1d32=_['merge'](_0x1b1d32,{'model':db[_0x37a0('0x96')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2b05d6[_0x37a0('0x36')][_0x37a0('0x3c')]){_0x42e50f[_0x37a0('0x3b')][_0x37a0('0x65')](function(_0x129f6a){_0x2f954c[_0x37a0('0x43')]('i.'+_0x129f6a);});}else{_0x2f954c[_0x37a0('0x43')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x37a0('0x5b'));_0x2f954c[_0x37a0('0x43')](_0x37a0('0x97'),_0x37a0('0x98'));_0x2f954c[_0x37a0('0x43')](_0x37a0('0x99'),_0x37a0('0x9a'));_0x2f954c[_0x37a0('0x43')](_0x37a0('0x9b'),_0x37a0('0x8b'));_0x2f954c[_0x37a0('0x43')](_0x37a0('0x9c'));_0x2f954c['field'](_0x37a0('0x9d'),_0x37a0('0x9e'));_0x2f954c[_0x37a0('0x43')](_0x37a0('0x9f'),_0x37a0('0xa0'));_0x2f954c[_0x37a0('0x43')]('c.email','Contact.email');_0x2f954c[_0x37a0('0x43')]('c.phone',_0x37a0('0xa1'));_0x2f954c[_0x37a0('0x43')]('c.mobile','Contact.mobile');_0x2f954c[_0x37a0('0x43')](_0x37a0('0xa2'),_0x37a0('0xa3'));_0x2f954c[_0x37a0('0x43')](_0x37a0('0xa4'),_0x37a0('0xa5'));_0x2f954c[_0x37a0('0x43')](_0x37a0('0xa6'),'Owner.internal');_0x2f954c[_0x37a0('0x43')](_0x37a0('0xa7'),_0x37a0('0x31'));}if(_0x42e50f[_0x37a0('0x20')])_0x2f954c[_0x37a0('0x20')](_0x42e50f[_0x37a0('0x20')]);if(_0x42e50f['offset'])_0x2f954c[_0x37a0('0x3e')](_0x42e50f['offset']);return db[_0x37a0('0x93')][_0x37a0('0x36')](_0x2f954c[_0x37a0('0x94')](),_0x1b1d32);})[_0x37a0('0x27')](function(_0x35139a){if(_0x35139a['length']>0x0)_0x343d29['where'](_0x37a0('0xa8'),_[_0x37a0('0x35')](_0x35139a,'id'));return db['sequelize']['query'](_0x343d29[_0x37a0('0x94')](),_0x1b1d32)['then'](function(_0x3ebcfd){var _0xa7d75a=_[_0x37a0('0xa9')](_0x3ebcfd,_0x37a0('0xaa'));var _0x1d2dff=[];_0x35139a['forEach'](function(_0x2f0d79){_0x1d2dff[_0x37a0('0xab')](updateOpenchannelInteraction(_0x2f0d79,_0x374090,_0xa7d75a));});return BPromise[_0x37a0('0xac')](_0x1d2dff);});});})['then'](function(_0x576e48){_0x3753bf[_0x37a0('0xad')]=_0x576e48;return _0x3753bf;})['then'](respondWithFilteredResult(_0x169b85,_0x42e50f))['catch'](handleError(_0x169b85,null));};exports['show']=function(_0x473e56,_0x37a999){var _0x4ac53e={};if(_0x473e56[_0x37a0('0x36')][_0x37a0('0x61')]&&_0x473e56[_0x37a0('0x36')]['type']===_0x37a0('0x45')){_0x4ac53e[_0x37a0('0x45')]=_0x473e56[_0x37a0('0xae')]['id'];}else{_0x4ac53e['id']=_0x473e56[_0x37a0('0xae')]['id'];}var _0x37a622={'raw':![],'where':_0x4ac53e},_0x4505c0={};_0x4505c0[_0x37a0('0x3a')]=_[_0x37a0('0x37')](db[_0x37a0('0x96')][_0x37a0('0xaf')]);_0x4505c0['query']=_[_0x37a0('0x37')](_0x473e56[_0x37a0('0x36')]);_0x4505c0[_0x37a0('0x38')]=_[_0x37a0('0x39')](_0x4505c0[_0x37a0('0x3a')],_0x4505c0[_0x37a0('0x36')]);_0x37a622[_0x37a0('0x3b')]=_[_0x37a0('0x39')](_0x4505c0[_0x37a0('0x3a')],qs[_0x37a0('0x3c')](_0x473e56['query'][_0x37a0('0x3c')]));_0x37a622[_0x37a0('0x3b')]=_0x37a622[_0x37a0('0x3b')][_0x37a0('0x59')]?_0x37a622[_0x37a0('0x3b')]:_0x4505c0[_0x37a0('0x3a')];if(_0x473e56[_0x37a0('0x36')][_0x37a0('0xb0')]){_0x37a622[_0x37a0('0xb1')]=[{'all':!![]}];}_0x37a622=_[_0x37a0('0xb2')]({},_0x37a622,_0x473e56[_0x37a0('0xb3')]);return db['OpenchannelInteraction'][_0x37a0('0x5a')](_0x37a622)[_0x37a0('0x27')](handleEntityNotFound(_0x37a999,null))[_0x37a0('0x27')](respondWithResult(_0x37a999,null))[_0x37a0('0x33')](handleError(_0x37a999,null));};exports['create']=function(_0xa4baba,_0x111064){return db[_0x37a0('0x96')]['create'](_0xa4baba['body'],{})[_0x37a0('0x27')](respondWithResult(_0x111064,0xc9))['catch'](handleError(_0x111064,null));};exports[_0x37a0('0x26')]=function(_0x2f8ccf,_0x266703){if(_0x2f8ccf[_0x37a0('0xb4')]['id']){delete _0x2f8ccf[_0x37a0('0xb4')]['id'];}return db[_0x37a0('0x96')][_0x37a0('0x5a')]({'where':{'id':_0x2f8ccf[_0x37a0('0xae')]['id']}})[_0x37a0('0x27')](handleEntityNotFound(_0x266703,null))['then'](saveUpdates(_0x2f8ccf['body'],null))[_0x37a0('0x27')](respondWithResult(_0x266703,null))[_0x37a0('0x33')](handleError(_0x266703,null));};exports[_0x37a0('0x28')]=function(_0x4d7324,_0x412d0c){return db[_0x37a0('0x96')][_0x37a0('0x5a')]({'where':{'id':_0x4d7324[_0x37a0('0xae')]['id']}})[_0x37a0('0x27')](handleEntityNotFound(_0x412d0c,null))[_0x37a0('0x27')](removeEntity(_0x412d0c,null))[_0x37a0('0x33')](handleError(_0x412d0c,null));};exports[_0x37a0('0xb5')]=function(_0x24660c,_0x5987fe){return db[_0x37a0('0x96')][_0x37a0('0xb5')]()[_0x37a0('0x27')](respondWithResult(_0x5987fe,null))[_0x37a0('0x33')](handleError(_0x5987fe,null));};exports[_0x37a0('0xb6')]=function(_0x7349cc,_0x4e4616,_0x45bda6){return db[_0x37a0('0xb7')][_0x37a0('0x5a')]({'where':{'id':_0x7349cc[_0x37a0('0xae')]['id']}})[_0x37a0('0x27')](handleEntityNotFound(_0x4e4616,null))[_0x37a0('0x27')](function(_0xa29986){if(_0xa29986){return _0xa29986['addMessage'](_0x7349cc[_0x37a0('0xb4')][_0x37a0('0xb8')],_['omit'](_0x7349cc['body'],[_0x37a0('0xb8'),'id'])||{});}})['then'](respondWithResult(_0x4e4616,null))['catch'](handleError(_0x4e4616,null));};exports['getMessages']=function(_0xa0d11c,_0x5a169f,_0x29f977){var _0x1dae79={'raw':![],'where':{}};var _0x5aacff={};var _0x250c33={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x37a0('0xb9')]({'where':{'id':_0xa0d11c[_0x37a0('0xae')]['id']}})[_0x37a0('0x27')](handleEntityNotFound(_0x5a169f,null))[_0x37a0('0x27')](function(_0x6c2bba){if(_0x6c2bba){_0x5aacff[_0x37a0('0x3a')]=_[_0x37a0('0x37')](db[_0x37a0('0xb7')][_0x37a0('0xaf')]);_0x5aacff[_0x37a0('0x36')]=_[_0x37a0('0x37')](_0xa0d11c['query']);_0x5aacff[_0x37a0('0x38')]=_['intersection'](_0x5aacff[_0x37a0('0x3a')],_0x5aacff[_0x37a0('0x36')]);_0x1dae79[_0x37a0('0x3b')]=_[_0x37a0('0x39')](_0x5aacff[_0x37a0('0x3a')],qs[_0x37a0('0x3c')](_0xa0d11c['query'][_0x37a0('0x3c')]));_0x1dae79[_0x37a0('0x3b')]=_0x1dae79[_0x37a0('0x3b')][_0x37a0('0x59')]?_0x1dae79[_0x37a0('0x3b')]:_0x5aacff[_0x37a0('0x3a')];if(!_0xa0d11c[_0x37a0('0x36')][_0x37a0('0x3d')](_0x37a0('0xba'))){_0x1dae79[_0x37a0('0x20')]=qs[_0x37a0('0x20')](_0xa0d11c['query']['limit']);_0x1dae79['offset']=qs[_0x37a0('0x3e')](_0xa0d11c['query'][_0x37a0('0x3e')]);}_0x1dae79[_0x37a0('0x3f')]=qs[_0x37a0('0x40')](_0xa0d11c[_0x37a0('0x36')][_0x37a0('0x40')]);_0x1dae79[_0x37a0('0x41')]=qs[_0x37a0('0x38')](_[_0x37a0('0x42')](_0xa0d11c[_0x37a0('0x36')],_0x5aacff['filters']));_0x1dae79[_0x37a0('0x41')][_0x37a0('0xaa')]=_0x6c2bba['id'];if(_0xa0d11c['query'][_0x37a0('0xbb')]){_0x1dae79[_0x37a0('0x41')]=_[_0x37a0('0xb2')](_0x1dae79[_0x37a0('0x41')],{'$or':_[_0x37a0('0x35')](_0x1dae79['attributes'],function(_0x1f0ad4){var _0x364e1e={};_0x364e1e[_0x1f0ad4]={'$like':'%'+_0xa0d11c[_0x37a0('0x36')][_0x37a0('0xbb')]+'%'};return _0x364e1e;})});}if(_0xa0d11c[_0x37a0('0x36')][_0x37a0('0x71')]){var _0x3ff828=_0xa0d11c['query'][_0x37a0('0x71')]['split'](',');var _0x47368e={};_0x47368e[_0x3ff828[0x0]]={'$gte':moment(_0x3ff828[0x1])[_0x37a0('0xbc')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1dae79[_0x37a0('0x41')]=_['merge'](_0x1dae79['where'],_0x47368e);}_0x1dae79=_[_0x37a0('0xb2')]({},_0x1dae79,_0xa0d11c[_0x37a0('0xb3')]);return db['OpenchannelMessage']['count']({'where':_0x1dae79[_0x37a0('0x41')]})[_0x37a0('0x27')](function(_0x9902b1){_0x250c33[_0x37a0('0x21')]=_0x9902b1;if(_0xa0d11c[_0x37a0('0x36')]['includeAll']){_0x1dae79[_0x37a0('0xb1')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x37a0('0xbd')](_0x1dae79);})['then'](function(_0x2be6c3){_0x250c33['rows']=_0x2be6c3;return _0x250c33;});}})[_0x37a0('0x27')](respondWithFilteredResult(_0x5a169f,_0x1dae79))[_0x37a0('0x33')](handleError(_0x5a169f,null));};exports[_0x37a0('0xbe')]=function(_0x24347f,_0x2d5186,_0x3c333f){return db[_0x37a0('0x96')][_0x37a0('0x5a')]({'where':{'id':_0x24347f[_0x37a0('0xae')]['id']}})[_0x37a0('0x27')](handleEntityNotFound(_0x2d5186,null))[_0x37a0('0x27')](function(_0x3024f4){if(_0x3024f4){return _0x3024f4[_0x37a0('0xbf')](_0x24347f['body']['ids'],_[_0x37a0('0xc0')](_0x24347f['body'],[_0x37a0('0xb8'),'id'])||{})[_0x37a0('0xc1')](function(){return db[_0x37a0('0x64')][_0x37a0('0xbd')]({'attributes':['id','name',_0x37a0('0x44')],'where':{'id':_0x24347f[_0x37a0('0xb4')][_0x37a0('0xb8')]}});})[_0x37a0('0x27')](function(_0x58208b){socket[_0x37a0('0xc2')](_0x37a0('0xc3'),{'id':Number(_0x24347f['params']['id']),'tags':_0x58208b||[]});return{'id':Number(_0x24347f[_0x37a0('0xae')]['id']),'tags':_0x58208b||[]};});}})[_0x37a0('0x27')](respondWithResult(_0x2d5186,null))['catch'](handleError(_0x2d5186,null));};exports[_0x37a0('0xc4')]=function(_0x339d0f,_0x262c53,_0x5b909a){return db[_0x37a0('0x96')][_0x37a0('0x5a')]({'where':{'id':_0x339d0f['params']['id']}})[_0x37a0('0x27')](handleEntityNotFound(_0x262c53,null))['then'](function(_0x1fef7a){if(_0x1fef7a){return _0x1fef7a[_0x37a0('0xc4')](_0x339d0f[_0x37a0('0x36')]['ids']);}})['then'](respondWithStatusCode(_0x262c53,null))[_0x37a0('0x33')](handleError(_0x262c53,null));};exports[_0x37a0('0xc5')]=function(_0x4edbff,_0x2301ba){var _0x438f91=moment()[_0x37a0('0xc6')]()[_0x37a0('0x94')]();var _0x513288=path[_0x37a0('0xc7')](config[_0x37a0('0xc8')],_0x37a0('0xc9'),_0x37a0('0xca'),'tmp');var _0x5d8af1=path[_0x37a0('0xc7')](config['root'],'server','files',_0x37a0('0xcb'));var _0x41b000=path['join'](_0x513288,_0x438f91);var _0x34849d=util['format']('transcript-%d-%s.zip',_0x4edbff['params']['id'],_0x438f91);var _0x106298=path[_0x37a0('0xc7')](_0x513288,_0x34849d);var _0x125d36=[];_0x125d36[_0x37a0('0xab')]({'model':db[_0x37a0('0x67')],'as':_0x37a0('0x67'),'attributes':['id','fullname'],'raw':!![]});_0x125d36[_0x37a0('0xab')]({'model':db[_0x37a0('0xcc')],'as':_0x37a0('0x5e'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x4edbff[_0x37a0('0x36')][_0x37a0('0xcb')]){_0x125d36[_0x37a0('0xab')]({'model':db[_0x37a0('0xcd')],'as':_0x37a0('0xcd'),'raw':!![]});}var _0x427642=[{'model':db[_0x37a0('0xb7')],'as':'Messages','attributes':['id','body','createdAt',_0x37a0('0xce'),'secret','read'],'include':_0x125d36}];_0x427642['push']({'model':db[_0x37a0('0xcf')],'as':_0x37a0('0xd0'),'attributes':['id','name']});_0x427642[_0x37a0('0xab')]({'model':db['User'],'as':_0x37a0('0xd1'),'attributes':['id','fullname']});return db[_0x37a0('0x96')][_0x37a0('0x5a')]({'where':{'id':_0x4edbff[_0x37a0('0xae')]['id']},'include':_0x427642})[_0x37a0('0x27')](handleEntityNotFound(_0x2301ba,null))[_0x37a0('0x27')](function(_0x2fa713){if(_0x2fa713){var _0x367832=_0x2fa713[_0x37a0('0xd2')]({'plain':!![]});fs[_0x37a0('0xd3')](_0x41b000);var _0x53731d={'channel':_0x37a0('0xd4'),'account':_0x367832[_0x37a0('0xd0')]['name'],'agent':_0x367832[_0x37a0('0xd1')]?_0x367832[_0x37a0('0xd1')][_0x37a0('0x2f')]:_0x37a0('0xd5'),'createdAt':moment(_0x367832['createdAt'])[_0x37a0('0xbc')](_0x37a0('0xd6'))[_0x37a0('0x94')](),'closedAt':_0x367832['closed']?moment(_0x367832[_0x37a0('0xd7')])['format'](_0x37a0('0xd6'))['toString']():'','disposition':_0x367832[_0x37a0('0xd8')],'visibility':_0x367832[_0x37a0('0xd9')]?_0x37a0('0xda'):_0x37a0('0xdb'),'messages':_(_0x367832[_0x37a0('0xdc')])[_0x37a0('0xbb')]({'secret':![]})[_0x37a0('0x35')](function(_0x40782b){if(_0x40782b['Attachment']){var _0x289d81=path[_0x37a0('0xc7')](_0x5d8af1,_0x40782b[_0x37a0('0xcd')][_0x37a0('0xdd')]);if(fs[_0x37a0('0xde')](_0x289d81)){fs[_0x37a0('0xdf')](_0x289d81)['pipe'](fs[_0x37a0('0xe0')](path[_0x37a0('0xc7')](_0x41b000,_0x40782b['Attachment'][_0x37a0('0xdd')])));}}return{'date':moment(_0x40782b[_0x37a0('0x70')])[_0x37a0('0xbc')](_0x37a0('0xd6'))[_0x37a0('0x94')](),'sender':_0x40782b[_0x37a0('0xce')]===_0x37a0('0xe1')?_0x40782b[_0x37a0('0x67')]?_0x40782b[_0x37a0('0x67')][_0x37a0('0x2f')]:'System':_0x40782b[_0x37a0('0x5e')][_0x37a0('0xe2')]+(_0x40782b[_0x37a0('0x5e')]['lastName']?'\x20'+_0x40782b[_0x37a0('0x5e')]['lastName']:''),'body':_0x40782b[_0x37a0('0xcd')]?_0x40782b[_0x37a0('0xcd')][_0x37a0('0xdd')]:_0x40782b[_0x37a0('0xb4')],'direction':_0x40782b[_0x37a0('0xce')]===_0x37a0('0xe1')?'A':'C','secret':_0x40782b['secret'],'read':_0x40782b[_0x37a0('0x78')],'attachment':_0x40782b[_0x37a0('0xcd')]};})[_0x37a0('0x5c')]()};return ejs[_0x37a0('0xe3')](path['join'](config[_0x37a0('0xc8')],'server','views','downloadInteraction.ejs'),{'interaction':_0x53731d})['then'](function(_0x4a209e){var _0x418971=path[_0x37a0('0xc7')](_0x41b000,'transcript-'+_0x367832['id']+'-'+_0x438f91+_0x37a0('0xe4'));var _0xc8a0bd={'path':_0x418971,'channel':_0x37a0('0xd4'),'interactionId':_0x367832['id']};return pdf[_0x37a0('0xe5')](_0x4a209e,_0xc8a0bd);})[_0x37a0('0x27')](function(){return new BPromise(function(_0x4d00b7,_0x542e5f){zipdir(_0x41b000,{'saveTo':_0x106298},function(_0x59881b,_0x57e4a9){if(_0x59881b)return _0x542e5f(_0x59881b);return _0x4d00b7(_0x57e4a9);});})['then'](function(){return new BPromise(function(_0xbeca17,_0x59bf64){rimraf(_0x41b000,function(_0x1e08df){if(_0x1e08df)_0x59bf64(_0x1e08df);return _0xbeca17();});});})['then'](function(){return _0x2301ba[_0x37a0('0xc5')](_0x106298,_0x34849d,function(_0x333cdc){if(_0x333cdc){console[_0x37a0('0xe6')](_0x37a0('0xe7'),_0x333cdc);}else{fs[_0x37a0('0xe8')](_0x106298);}});});});}else{return _0x2301ba[_0x37a0('0x2a')](0xc8);}})[_0x37a0('0x33')](handleError(_0x2301ba,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 7e06398..b4b02cc 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 _0x16b5=['OpenchannelInteraction','../../mysqldb','OpenchannelMessage','setMaxListeners','save','remove','then','setDataValue','Users','findAll','length','emit','catch','hasOwnProperty','hook','exports','events'];(function(_0x1fb042,_0x150c60){var _0x4c646c=function(_0x1d7e52){while(--_0x1d7e52){_0x1fb042['push'](_0x1fb042['shift']());}};_0x4c646c(++_0x150c60);}(_0x16b5,0x131));var _0x516b=function(_0x32d606,_0x42c49e){_0x32d606=_0x32d606-0x0;var _0x549d17=_0x16b5[_0x32d606];return _0x549d17;};'use strict';var EventEmitter=require(_0x516b('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0x516b('0x1')];var OpenchannelMessage=require(_0x516b('0x2'))['db'][_0x516b('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x516b('0x4')](0x0);var events={'afterCreate':_0x516b('0x5'),'afterUpdate':'update','afterDestroy':_0x516b('0x6')};function emitEvent(_0x377b85){return function(_0x2639e4,_0x4a48ed,_0x3ad396){_0x2639e4['getUsers']({'attributes':['id'],'raw':!![]})[_0x516b('0x7')](function(_0x3061a8){_0x2639e4[_0x516b('0x8')](_0x516b('0x9'),_0x3061a8['map'](function(_0x101d5d){return{'id':_0x101d5d['id']};}));return OpenchannelMessage[_0x516b('0xa')]({'where':{'OpenchannelInteractionId':_0x2639e4['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4c26b1){_0x2639e4[_0x516b('0x8')]('unreadMessages',_0x4c26b1[_0x516b('0xb')]);OpenchannelInteractionEvents['emit'](_0x377b85+':'+_0x2639e4['id'],_0x2639e4);OpenchannelInteractionEvents[_0x516b('0xc')](_0x377b85,_0x2639e4);_0x3ad396(null);})[_0x516b('0xd')](_0x3ad396(null));};}for(var e in events){if(events[_0x516b('0xe')](e)){var event=events[e];OpenchannelInteraction[_0x516b('0xf')](e,emitEvent(event));}}module[_0x516b('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xc957=['length','emit','catch','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','getUsers','map','then','setDataValue','unreadMessages'];(function(_0x3518cb,_0x376bca){var _0x127238=function(_0x52e0ce){while(--_0x52e0ce){_0x3518cb['push'](_0x3518cb['shift']());}};_0x127238(++_0x376bca);}(_0xc957,0xd5));var _0x7c95=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0xc957[_0x455c6c];return _0x488242;};'use strict';var EventEmitter=require(_0x7c95('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x7c95('0x1'))['db'][_0x7c95('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x7c95('0x3')](0x0);var events={'afterCreate':_0x7c95('0x4'),'afterUpdate':_0x7c95('0x5'),'afterDestroy':_0x7c95('0x6')};function emitEvent(_0x10b63b){return function(_0x203e00,_0x3808fa,_0x4412c2){_0x203e00[_0x7c95('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3c2df0){_0x203e00['setDataValue']('Users',_0x3c2df0[_0x7c95('0x8')](function(_0x9194f5){return{'id':_0x9194f5['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x203e00['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7c95('0x9')](function(_0x1a7ecd){_0x203e00[_0x7c95('0xa')](_0x7c95('0xb'),_0x1a7ecd[_0x7c95('0xc')]);OpenchannelInteractionEvents[_0x7c95('0xd')](_0x10b63b+':'+_0x203e00['id'],_0x203e00);OpenchannelInteractionEvents[_0x7c95('0xd')](_0x10b63b,_0x203e00);_0x4412c2(null);})[_0x7c95('0xe')](_0x4412c2(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index ff23254..5cee269 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 _0x88a3=['utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','OpenchannelInteraction','openchannel_interactions'];(function(_0x393d9f,_0x4fe764){var _0x5e6f6d=function(_0x110ec5){while(--_0x110ec5){_0x393d9f['push'](_0x393d9f['shift']());}};_0x5e6f6d(++_0x4fe764);}(_0x88a3,0x1e1));var _0x388a=function(_0x598408,_0x5e6f74){_0x598408=_0x598408-0x0;var _0x560720=_0x88a3[_0x598408];return _0x560720;};'use strict';var _=require(_0x388a('0x0'));var util=require(_0x388a('0x1'));var logger=require(_0x388a('0x2'))(_0x388a('0x3'));var moment=require(_0x388a('0x4'));var BPromise=require(_0x388a('0x5'));var rp=require(_0x388a('0x6'));var fs=require('fs');var path=require(_0x388a('0x7'));var rimraf=require(_0x388a('0x8'));var config=require('../../config/environment');var attributes=require('./openchannelInteraction.attributes');module[_0x388a('0x9')]=function(_0x484778,_0x5c4532){return _0x484778[_0x388a('0xa')](_0x388a('0xb'),attributes,{'tableName':_0x388a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x388a('0xd'),'hooks':{'beforeUpdate':function(_0x1ddc91,_0x3fed05,_0x1b5d65){if(_0x1ddc91[_0x388a('0xe')](_0x388a('0xf'))){_0x1ddc91[_0x388a('0x10')]=moment()[_0x388a('0x11')](_0x388a('0x12'));}_0x1b5d65(null,_0x1ddc91);}}});}; \ No newline at end of file +var _0xa8b3=['openchannel_interactions','utf8mb4','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','moment','bluebird','request-promise','exports','define','OpenchannelInteraction'];(function(_0x334b5f,_0x1eed1f){var _0x58113b=function(_0x3719cf){while(--_0x3719cf){_0x334b5f['push'](_0x334b5f['shift']());}};_0x58113b(++_0x1eed1f);}(_0xa8b3,0xa1));var _0x3a8b=function(_0x28f5cb,_0x37fadc){_0x28f5cb=_0x28f5cb-0x0;var _0x27cd13=_0xa8b3[_0x28f5cb];return _0x27cd13;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3a8b('0x0'))('api');var moment=require(_0x3a8b('0x1'));var BPromise=require(_0x3a8b('0x2'));var rp=require(_0x3a8b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./openchannelInteraction.attributes');module[_0x3a8b('0x4')]=function(_0x1a6051,_0x61627a){return _0x1a6051[_0x3a8b('0x5')](_0x3a8b('0x6'),attributes,{'tableName':_0x3a8b('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3a8b('0x8'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x34293f,_0x55ec0f,_0x15ef20){if(_0x34293f[_0x3a8b('0x9')](_0x3a8b('0xa'))){_0x34293f[_0x3a8b('0xb')]=moment()[_0x3a8b('0xc')](_0x3a8b('0xd'));}_0x15ef20(null,_0x34293f);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 806bcc6..ee25212 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 _0xca15=['../../config/logger','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','update','body','options','raw','where','limit','then','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','omit','ids','spread','AddTags','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x25ad66,_0x46e4dc){var _0x141bc4=function(_0x3a7f8e){while(--_0x3a7f8e){_0x25ad66['push'](_0x25ad66['shift']());}};_0x141bc4(++_0x46e4dc);}(_0xca15,0x1bd));var _0x5ca1=function(_0x1ac0aa,_0x396873){_0x1ac0aa=_0x1ac0aa-0x0;var _0x3a9b06=_0xca15[_0x1ac0aa];return _0x3a9b06;};'use strict';var _=require(_0x5ca1('0x0'));var util=require('util');var moment=require(_0x5ca1('0x1'));var BPromise=require('bluebird');var rs=require(_0x5ca1('0x2'));var fs=require('fs');var Redis=require(_0x5ca1('0x3'));var db=require(_0x5ca1('0x4'))['db'];var utils=require(_0x5ca1('0x5'));var logger=require(_0x5ca1('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5ca1('0x7'));var client=jayson['client'][_0x5ca1('0x8')]({'port':0x232a});config[_0x5ca1('0x9')]=_[_0x5ca1('0xa')](config['redis'],{'host':_0x5ca1('0xb'),'port':0x18eb});var socket=require(_0x5ca1('0xc'))(new Redis(config[_0x5ca1('0x9')]));require(_0x5ca1('0xd'))[_0x5ca1('0xe')](socket);function respondWithRpcPromise(_0x27a02b,_0x3a8ca9,_0x4a898c){return new BPromise(function(_0x13f94d,_0x3834d2){return client[_0x5ca1('0xf')](_0x27a02b,_0x4a898c)['then'](function(_0x126f12){logger[_0x5ca1('0x10')](_0x5ca1('0x11'),_0x3a8ca9,_0x5ca1('0x12'));logger[_0x5ca1('0x13')](_0x5ca1('0x14'),_0x3a8ca9,_0x5ca1('0x12'),JSON[_0x5ca1('0x15')](_0x126f12));if(_0x126f12[_0x5ca1('0x16')]){if(_0x126f12[_0x5ca1('0x16')][_0x5ca1('0x17')]===0x1f4){logger['error'](_0x5ca1('0x11'),_0x3a8ca9,_0x126f12['error'][_0x5ca1('0x18')]);return _0x3834d2(_0x126f12[_0x5ca1('0x16')][_0x5ca1('0x18')]);}logger[_0x5ca1('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x3a8ca9,_0x126f12['error'][_0x5ca1('0x18')]);return _0x13f94d(_0x126f12['error'][_0x5ca1('0x18')]);}else{logger[_0x5ca1('0x10')](_0x5ca1('0x11'),_0x3a8ca9,_0x5ca1('0x12'));_0x13f94d(_0x126f12['result'][_0x5ca1('0x18')]);}})['catch'](function(_0x3cdefc){logger[_0x5ca1('0x16')](_0x5ca1('0x11'),_0x3a8ca9,_0x3cdefc);_0x3834d2(_0x3cdefc);});});}exports['UpdateOpenchannelInteraction']=function(_0x3856a7){var _0x3ae411=this;return new Promise(function(_0x46643f,_0xf9a5d1){return db['OpenchannelInteraction'][_0x5ca1('0x19')](_0x3856a7[_0x5ca1('0x1a')],{'raw':_0x3856a7['options']?_0x3856a7[_0x5ca1('0x1b')][_0x5ca1('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3856a7[_0x5ca1('0x1b')]?_0x3856a7[_0x5ca1('0x1b')][_0x5ca1('0x1d')]||null:null,'attributes':_0x3856a7[_0x5ca1('0x1b')]?_0x3856a7[_0x5ca1('0x1b')]['attributes']||null:null,'limit':_0x3856a7[_0x5ca1('0x1b')]?_0x3856a7[_0x5ca1('0x1b')][_0x5ca1('0x1e')]||null:null})[_0x5ca1('0x1f')](function(_0x13ca0e){logger[_0x5ca1('0x10')](_0x5ca1('0x20'),_0x3856a7);logger[_0x5ca1('0x13')](_0x5ca1('0x20'),_0x3856a7,JSON['stringify'](_0x13ca0e));_0x46643f(_0x13ca0e);})['catch'](function(_0x12990d){logger[_0x5ca1('0x16')](_0x5ca1('0x20'),_0x12990d['message'],_0x3856a7);_0xf9a5d1(_0x3ae411[_0x5ca1('0x16')](0x1f4,_0x12990d[_0x5ca1('0x18')]));});});};exports[_0x5ca1('0x21')]=function(_0x37a5c1){return new Promise(function(_0x20411c,_0x3e6e78){return db[_0x5ca1('0x22')][_0x5ca1('0x23')]({'where':_0x37a5c1['options']?_0x37a5c1[_0x5ca1('0x1b')][_0x5ca1('0x1d')]||null:null})[_0x5ca1('0x1f')](function(_0x4fab7b){if(_0x4fab7b){return _0x4fab7b['addTags'](_0x37a5c1[_0x5ca1('0x1a')]['ids'],_[_0x5ca1('0x24')](_0x37a5c1['body'],[_0x5ca1('0x25'),'id'])||{});}})[_0x5ca1('0x26')](function(_0x446041){logger[_0x5ca1('0x10')](_0x5ca1('0x27'),_0x37a5c1);logger[_0x5ca1('0x13')](_0x5ca1('0x27'),_0x37a5c1,JSON[_0x5ca1('0x15')](_0x446041));_0x20411c(_0x446041);})[_0x5ca1('0x28')](function(_0x1f9a4c){logger['error'](_0x5ca1('0x27'),_0x1f9a4c[_0x5ca1('0x18')],_0x37a5c1);_0x3e6e78(_this['error'](0x1f4,_0x1f9a4c[_0x5ca1('0x18')]));});});}; \ No newline at end of file +var _0xbed8=['rpc','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','body','options','raw','where','attributes','limit','AddTagsToOpenchannelInteraction','find','omit','ids','spread','AddTags','lodash','util','moment','randomstring','../../config/utils','../../config/logger'];(function(_0x28d391,_0x1357b3){var _0x3c8bf0=function(_0x55bac9){while(--_0x55bac9){_0x28d391['push'](_0x28d391['shift']());}};_0x3c8bf0(++_0x1357b3);}(_0xbed8,0x194));var _0x8bed=function(_0x34aec4,_0x3801da){_0x34aec4=_0x34aec4-0x0;var _0x51e1a7=_0xbed8[_0x34aec4];return _0x51e1a7;};'use strict';var _=require(_0x8bed('0x0'));var util=require(_0x8bed('0x1'));var moment=require(_0x8bed('0x2'));var BPromise=require('bluebird');var rs=require(_0x8bed('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8bed('0x4'));var logger=require(_0x8bed('0x5'))(_0x8bed('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x8bed('0x7')]({'port':0x232a});config[_0x8bed('0x8')]=_[_0x8bed('0x9')](config[_0x8bed('0x8')],{'host':_0x8bed('0xa'),'port':0x18eb});var socket=require(_0x8bed('0xb'))(new Redis(config[_0x8bed('0x8')]));require(_0x8bed('0xc'))[_0x8bed('0xd')](socket);function respondWithRpcPromise(_0x14c8f1,_0x68852,_0x353f90){return new BPromise(function(_0x4bc51f,_0x214708){return client[_0x8bed('0xe')](_0x14c8f1,_0x353f90)[_0x8bed('0xf')](function(_0x26f6e5){logger[_0x8bed('0x10')]('OpenchannelInteraction,\x20%s,\x20%s',_0x68852,_0x8bed('0x11'));logger[_0x8bed('0x12')](_0x8bed('0x13'),_0x68852,_0x8bed('0x11'),JSON[_0x8bed('0x14')](_0x26f6e5));if(_0x26f6e5[_0x8bed('0x15')]){if(_0x26f6e5[_0x8bed('0x15')][_0x8bed('0x16')]===0x1f4){logger[_0x8bed('0x15')](_0x8bed('0x17'),_0x68852,_0x26f6e5[_0x8bed('0x15')]['message']);return _0x214708(_0x26f6e5[_0x8bed('0x15')][_0x8bed('0x18')]);}logger[_0x8bed('0x15')](_0x8bed('0x17'),_0x68852,_0x26f6e5['error'][_0x8bed('0x18')]);return _0x4bc51f(_0x26f6e5['error'][_0x8bed('0x18')]);}else{logger[_0x8bed('0x10')]('OpenchannelInteraction,\x20%s,\x20%s',_0x68852,_0x8bed('0x11'));_0x4bc51f(_0x26f6e5[_0x8bed('0x19')][_0x8bed('0x18')]);}})[_0x8bed('0x1a')](function(_0x559d07){logger[_0x8bed('0x15')](_0x8bed('0x17'),_0x68852,_0x559d07);_0x214708(_0x559d07);});});}exports[_0x8bed('0x1b')]=function(_0x22e023){var _0x249941=this;return new Promise(function(_0x2a012b,_0x4be8fa){return db[_0x8bed('0x1c')]['update'](_0x22e023[_0x8bed('0x1d')],{'raw':_0x22e023[_0x8bed('0x1e')]?_0x22e023[_0x8bed('0x1e')][_0x8bed('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22e023['options']?_0x22e023['options'][_0x8bed('0x20')]||null:null,'attributes':_0x22e023[_0x8bed('0x1e')]?_0x22e023[_0x8bed('0x1e')][_0x8bed('0x21')]||null:null,'limit':_0x22e023[_0x8bed('0x1e')]?_0x22e023[_0x8bed('0x1e')][_0x8bed('0x22')]||null:null})[_0x8bed('0xf')](function(_0x2a2266){logger[_0x8bed('0x10')](_0x8bed('0x1b'),_0x22e023);logger[_0x8bed('0x12')]('UpdateOpenchannelInteraction',_0x22e023,JSON['stringify'](_0x2a2266));_0x2a012b(_0x2a2266);})[_0x8bed('0x1a')](function(_0x1793e9){logger[_0x8bed('0x15')](_0x8bed('0x1b'),_0x1793e9[_0x8bed('0x18')],_0x22e023);_0x4be8fa(_0x249941[_0x8bed('0x15')](0x1f4,_0x1793e9[_0x8bed('0x18')]));});});};exports[_0x8bed('0x23')]=function(_0x334d54){return new Promise(function(_0x24928b,_0x5093c3){return db[_0x8bed('0x1c')][_0x8bed('0x24')]({'where':_0x334d54[_0x8bed('0x1e')]?_0x334d54[_0x8bed('0x1e')][_0x8bed('0x20')]||null:null})['then'](function(_0x1abc3b){if(_0x1abc3b){return _0x1abc3b['addTags'](_0x334d54[_0x8bed('0x1d')]['ids'],_[_0x8bed('0x25')](_0x334d54['body'],[_0x8bed('0x26'),'id'])||{});}})[_0x8bed('0x27')](function(_0x2beb49){logger[_0x8bed('0x10')]('AddTags',_0x334d54);logger[_0x8bed('0x12')](_0x8bed('0x28'),_0x334d54,JSON[_0x8bed('0x14')](_0x2beb49));_0x24928b(_0x2beb49);})[_0x8bed('0x1a')](function(_0x4608ee){logger[_0x8bed('0x15')](_0x8bed('0x28'),_0x4608ee[_0x8bed('0x18')],_0x334d54);_0x5093c3(_this[_0x8bed('0x15')](0x1f4,_0x4608ee[_0x8bed('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index f892f08..0d8b163 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 _0xa213=['removeListener','length','openchannelInteraction:','./openchannelInteraction.events','save','remove','update','emit'];(function(_0x39d544,_0x35c14f){var _0x5a5ff2=function(_0x2271fb){while(--_0x2271fb){_0x39d544['push'](_0x39d544['shift']());}};_0x5a5ff2(++_0x35c14f);}(_0xa213,0x1e3));var _0x3a21=function(_0x423962,_0x51f067){_0x423962=_0x423962-0x0;var _0x562972=_0xa213[_0x423962];return _0x562972;};'use strict';var OpenchannelInteractionEvents=require(_0x3a21('0x0'));var events=[_0x3a21('0x1'),_0x3a21('0x2'),_0x3a21('0x3')];function createListener(_0x2b0838,_0x27a6e6){return function(_0x290a11){_0x27a6e6[_0x3a21('0x4')](_0x2b0838,_0x290a11);};}function removeListener(_0x1764fc,_0x3eab17){return function(){OpenchannelInteractionEvents[_0x3a21('0x5')](_0x1764fc,_0x3eab17);};}exports['register']=function(_0x47ef5f){for(var _0x4a60ad=0x0,_0x4f3a76=events[_0x3a21('0x6')];_0x4a60ad<_0x4f3a76;_0x4a60ad++){var _0x457dc5=events[_0x4a60ad];var _0x59e58d=createListener(_0x3a21('0x7')+_0x457dc5,_0x47ef5f);OpenchannelInteractionEvents['on'](_0x457dc5,_0x59e58d);}}; \ No newline at end of file +var _0x00d2=['save','remove','update','emit','removeListener','length','openchannelInteraction:','./openchannelInteraction.events'];(function(_0x535a42,_0x2d3281){var _0x33d37b=function(_0x5d0cf9){while(--_0x5d0cf9){_0x535a42['push'](_0x535a42['shift']());}};_0x33d37b(++_0x2d3281);}(_0x00d2,0x1bf));var _0x200d=function(_0x47cd7b,_0x5630af){_0x47cd7b=_0x47cd7b-0x0;var _0x3e6dbf=_0x00d2[_0x47cd7b];return _0x3e6dbf;};'use strict';var OpenchannelInteractionEvents=require(_0x200d('0x0'));var events=[_0x200d('0x1'),_0x200d('0x2'),_0x200d('0x3')];function createListener(_0x14e50a,_0x2c77dc){return function(_0x2781ac){_0x2c77dc[_0x200d('0x4')](_0x14e50a,_0x2781ac);};}function removeListener(_0x3cedf5,_0x3d7def){return function(){OpenchannelInteractionEvents[_0x200d('0x5')](_0x3cedf5,_0x3d7def);};}exports['register']=function(_0x2776cc){for(var _0x4f56c7=0x0,_0x18b1a0=events[_0x200d('0x6')];_0x4f56c7<_0x18b1a0;_0x4f56c7++){var _0x2aeefd=events[_0x4f56c7];var _0x3a1273=createListener(_0x200d('0x7')+_0x2aeefd,_0x2776cc);OpenchannelInteractionEvents['on'](_0x2aeefd,_0x3a1273);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 60f3c1b..d3fb293 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 _0xe706=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','create','update','put','/:id/accept','accept','/:id/reject','exports','multer','util','path','express','Router'];(function(_0xd910fe,_0x4478ac){var _0x1d03bd=function(_0x2c5896){while(--_0x2c5896){_0xd910fe['push'](_0xd910fe['shift']());}};_0x1d03bd(++_0x4478ac);}(_0xe706,0xa3));var _0x6e70=function(_0x575934,_0x4a6760){_0x575934=_0x575934-0x0;var _0x109a3d=_0xe706[_0x575934];return _0x109a3d;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),interaction[_0x6e70('0x12')](_0x6e70('0x13'),_0x6e70('0x14')),controller[_0x6e70('0x15')]);router['put']('/:id',auth[_0x6e70('0xb')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')](_0x6e70('0x18'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x19')]);router[_0x6e70('0x17')](_0x6e70('0x1a'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x6e70('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x6e70('0x1b')]=router; \ No newline at end of file +var _0x0713=['get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','openchannelmessage:create','put','update','accept','/:id/reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelMessage.controller'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['show']);router[_0x3071('0xe')]('/',auth[_0x3071('0x9')](),interaction[_0x3071('0xf')](_0x3071('0x10'),_0x3071('0x11')),controller['create']);router[_0x3071('0x12')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller[_0x3071('0x13')]);router[_0x3071('0x12')]('/:id/accept',auth['isAuthenticated'](),controller[_0x3071('0x14')]);router['put'](_0x3071('0x15'),auth[_0x3071('0x9')](),controller['reject']);router[_0x3071('0x16')]('/:id',auth[_0x3071('0x9')](),controller[_0x3071('0x17')]);module[_0x3071('0x18')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 11721d5..a221819 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 _0x215d=['TEXT','medium','BOOLEAN','ENUM','out','DATE','sequelize'];(function(_0xaf649a,_0x4620e2){var _0x23f165=function(_0x2a2296){while(--_0x2a2296){_0xaf649a['push'](_0xaf649a['shift']());}};_0x23f165(++_0x4620e2);}(_0x215d,0x187));var _0xd215=function(_0x8c4875,_0x214a5b){_0x8c4875=_0x8c4875-0x0;var _0x13c5fb=_0x215d[_0x8c4875];return _0x13c5fb;};'use strict';var Sequelize=require(_0xd215('0x0'));module['exports']={'body':{'type':Sequelize[_0xd215('0x1')](_0xd215('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xd215('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xd215('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd215('0x4')]('in',_0xd215('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xd215('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xd215('0x1')]}}; \ No newline at end of file +var _0x0833=['medium','BOOLEAN','out','STRING','sequelize','exports','TEXT'];(function(_0x3f1e31,_0x49768a){var _0x1bb81b=function(_0x37acbb){while(--_0x37acbb){_0x3f1e31['push'](_0x3f1e31['shift']());}};_0x1bb81b(++_0x49768a);}(_0x0833,0x1bd));var _0x3083=function(_0xf02701,_0x96f9bb){_0xf02701=_0xf02701-0x0;var _0xec4d11=_0x0833[_0xf02701];return _0xec4d11;};'use strict';var Sequelize=require(_0x3083('0x0'));module[_0x3083('0x1')]={'body':{'type':Sequelize[_0x3083('0x2')](_0x3083('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x3083('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x3083('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x3083('0x6')]},'providerResponse':{'type':Sequelize[_0x3083('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 7cdf0bd..4b3091c 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 _0x8838=['manual','interface','channel','event','EventManager','acceptmessage','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','sequelize','QueryTypes','email','SIP/%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','jayson/promise','client','http','request','then','info','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelMessage,\x20%s,\x20%s','message','request\x20sent','result','catch','status','undefined','count','offset','set','Content-Range','reject','destroy','end','sendStatus','stack','name','index','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','params','find','create','body','update','describe','openchannel-interactions','accept','openchannel','format','YYYY-MM-DD\x20HH:mm:ss','UserId','OpenchannelInteraction','isNil','read1stAt','interaction','get','user','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','User','agent','fullname','internal'];(function(_0x1c30bf,_0x247c31){var _0x255b5e=function(_0x70c22b){while(--_0x70c22b){_0x1c30bf['push'](_0x1c30bf['shift']());}};_0x255b5e(++_0x247c31);}(_0x8838,0x90));var _0x8883=function(_0x4c7f9a,_0x43ea37){_0x4c7f9a=_0x4c7f9a-0x0;var _0x19ebb0=_0x8838[_0x4c7f9a];return _0x19ebb0;};'use strict';var emlformat=require(_0x8883('0x0'));var rimraf=require(_0x8883('0x1'));var zipdir=require(_0x8883('0x2'));var jsonpatch=require(_0x8883('0x3'));var rp=require(_0x8883('0x4'));var moment=require(_0x8883('0x5'));var BPromise=require(_0x8883('0x6'));var Mustache=require(_0x8883('0x7'));var util=require(_0x8883('0x8'));var path=require(_0x8883('0x9'));var sox=require(_0x8883('0xa'));var csv=require(_0x8883('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8883('0xc'));var squel=require('squel');var crypto=require(_0x8883('0xd'));var jsforce=require(_0x8883('0xe'));var deskjs=require(_0x8883('0xf'));var toCsv=require(_0x8883('0xb'));var querystring=require(_0x8883('0x10'));var Papa=require(_0x8883('0x11'));var Redis=require(_0x8883('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8883('0x13'));var as=require(_0x8883('0x14'));var hardwareService=require(_0x8883('0x15'));var logger=require(_0x8883('0x16'))('api');var utils=require(_0x8883('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x8883('0x18'));var db=require(_0x8883('0x19'))['db'];config[_0x8883('0x1a')]=_[_0x8883('0x1b')](config[_0x8883('0x1a')],{'host':_0x8883('0x1c'),'port':0x18eb});var socket=require(_0x8883('0x1d'))(new Redis(config[_0x8883('0x1a')]));require(_0x8883('0x1e'))['register'](socket);var jayson=require(_0x8883('0x1f'));var client=jayson[_0x8883('0x20')][_0x8883('0x21')]({'port':0x232c});var client9002=jayson[_0x8883('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x126280,_0x55e8ab,_0x2e9e3c,_0x5828ac){return new BPromise(function(_0x14effb,_0x5d46a0){var _0x2ff211=_0x5828ac||client;return _0x2ff211[_0x8883('0x22')](_0x126280,_0x2e9e3c)[_0x8883('0x23')](function(_0x36e729){logger[_0x8883('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0x55e8ab,'request\x20sent');logger[_0x8883('0x25')](_0x8883('0x26'),_0x55e8ab,'request\x20sent',JSON[_0x8883('0x27')](_0x36e729));if(_0x36e729[_0x8883('0x28')]){if(_0x36e729[_0x8883('0x28')]['code']===0x1f4){logger[_0x8883('0x28')](_0x8883('0x29'),_0x55e8ab,_0x36e729[_0x8883('0x28')][_0x8883('0x2a')]);return _0x5d46a0(_0x36e729[_0x8883('0x28')]['message']);}logger[_0x8883('0x28')](_0x8883('0x29'),_0x55e8ab,_0x36e729['error'][_0x8883('0x2a')]);return _0x14effb(_0x36e729[_0x8883('0x28')][_0x8883('0x2a')]);}else{logger['info'](_0x8883('0x29'),_0x55e8ab,_0x8883('0x2b'));_0x14effb(_0x36e729[_0x8883('0x2c')][_0x8883('0x2a')]);}})[_0x8883('0x2d')](function(_0x223412){logger[_0x8883('0x28')]('OpenchannelMessage,\x20%s,\x20%s',_0x55e8ab,_0x223412);_0x5d46a0(_0x223412);});});}function respondWithStatusCode(_0x434eb9,_0x576019){_0x576019=_0x576019||0xcc;return function(_0x1b6c13){if(_0x1b6c13){return _0x434eb9['sendStatus'](_0x576019);}return _0x434eb9['status'](_0x576019)['end']();};}function respondWithResult(_0x4a313d,_0x77f21a){_0x77f21a=_0x77f21a||0xc8;return function(_0xd5d86e){if(_0xd5d86e){return _0x4a313d[_0x8883('0x2e')](_0x77f21a)['json'](_0xd5d86e);}};}function respondWithFilteredResult(_0x21529a,_0x1147ed){return function(_0x26df5b){if(_0x26df5b){var _0x2e772e=typeof _0x1147ed['offset']===_0x8883('0x2f')&&typeof _0x1147ed['limit']===_0x8883('0x2f');var _0x95d950=_0x26df5b[_0x8883('0x30')];var _0x1bb767=_0x2e772e?0x0:_0x1147ed[_0x8883('0x31')];var _0x649d01=_0x2e772e?_0x26df5b[_0x8883('0x30')]:_0x1147ed['offset']+_0x1147ed['limit'];var _0x4f4c72;if(_0x649d01>=_0x95d950){_0x649d01=_0x95d950;_0x4f4c72=0xc8;}else{_0x4f4c72=0xce;}_0x21529a[_0x8883('0x2e')](_0x4f4c72);return _0x21529a[_0x8883('0x32')](_0x8883('0x33'),_0x1bb767+'-'+_0x649d01+'/'+_0x95d950)['json'](_0x26df5b);}return null;};}function patchUpdates(_0x121638){return function(_0x347fee){try{jsonpatch['apply'](_0x347fee,_0x121638,!![]);}catch(_0x53685b){return BPromise[_0x8883('0x34')](_0x53685b);}return _0x347fee['save']();};}function saveUpdates(_0x5ed6da,_0xfb1e5c){return function(_0x4722d4){if(_0x4722d4){return _0x4722d4['update'](_0x5ed6da)[_0x8883('0x23')](function(_0x453aff){return _0x453aff;});}return null;};}function removeEntity(_0x18a58b,_0x52dc53){return function(_0x76af7){if(_0x76af7){return _0x76af7[_0x8883('0x35')]()[_0x8883('0x23')](function(){_0x18a58b[_0x8883('0x2e')](0xcc)[_0x8883('0x36')]();});}};}function handleEntityNotFound(_0x3b5add,_0x438c9d){return function(_0xf1fac0){if(!_0xf1fac0){_0x3b5add[_0x8883('0x37')](0x194);}return _0xf1fac0;};}function handleError(_0x4344e7,_0x2415d6){_0x2415d6=_0x2415d6||0x1f4;return function(_0x3c9e99){logger[_0x8883('0x28')](_0x3c9e99[_0x8883('0x38')]);if(_0x3c9e99[_0x8883('0x39')]){delete _0x3c9e99['name'];}_0x4344e7[_0x8883('0x2e')](_0x2415d6)['send'](_0x3c9e99);};}exports[_0x8883('0x3a')]=function(_0x5d29d2,_0x2caf53){var _0x574383={},_0x27d174={},_0x10fa31={'count':0x0,'rows':[]};var _0x593fd2=_[_0x8883('0x3b')](db[_0x8883('0x3c')][_0x8883('0x3d')],function(_0x480609){return{'name':_0x480609[_0x8883('0x3e')],'type':_0x480609[_0x8883('0x3f')][_0x8883('0x40')]};});_0x27d174[_0x8883('0x41')]=_[_0x8883('0x3b')](_0x593fd2,_0x8883('0x39'));_0x27d174[_0x8883('0x42')]=_[_0x8883('0x43')](_0x5d29d2[_0x8883('0x42')]);_0x27d174[_0x8883('0x44')]=_[_0x8883('0x45')](_0x27d174[_0x8883('0x41')],_0x27d174[_0x8883('0x42')]);_0x574383[_0x8883('0x46')]=_['intersection'](_0x27d174[_0x8883('0x41')],qs['fields'](_0x5d29d2[_0x8883('0x42')][_0x8883('0x47')]));_0x574383[_0x8883('0x46')]=_0x574383[_0x8883('0x46')][_0x8883('0x48')]?_0x574383[_0x8883('0x46')]:_0x27d174[_0x8883('0x41')];if(!_0x5d29d2[_0x8883('0x42')]['hasOwnProperty'](_0x8883('0x49'))){_0x574383[_0x8883('0x4a')]=qs[_0x8883('0x4a')](_0x5d29d2[_0x8883('0x42')][_0x8883('0x4a')]);_0x574383[_0x8883('0x31')]=qs[_0x8883('0x31')](_0x5d29d2['query'][_0x8883('0x31')]);}_0x574383[_0x8883('0x4b')]=qs[_0x8883('0x4c')](_0x5d29d2[_0x8883('0x42')]['sort']);_0x574383[_0x8883('0x4d')]=qs[_0x8883('0x44')](_[_0x8883('0x4e')](_0x5d29d2['query'],_0x27d174[_0x8883('0x44')]),_0x593fd2);if(_0x5d29d2['query'][_0x8883('0x4f')]){_0x574383['where']=_[_0x8883('0x50')](_0x574383[_0x8883('0x4d')],{'$or':_['map'](_0x593fd2,function(_0x586e84){if(_0x586e84['type']!==_0x8883('0x51')){var _0x2a34cd={};_0x2a34cd[_0x586e84[_0x8883('0x39')]]={'$like':'%'+_0x5d29d2['query'][_0x8883('0x4f')]+'%'};return _0x2a34cd;}})});}_0x574383=_[_0x8883('0x50')]({},_0x574383,_0x5d29d2[_0x8883('0x52')]);var _0x3f44be={'where':_0x574383[_0x8883('0x4d')]};return db['OpenchannelMessage'][_0x8883('0x30')](_0x3f44be)[_0x8883('0x23')](function(_0x210273){_0x10fa31[_0x8883('0x30')]=_0x210273;if(_0x5d29d2[_0x8883('0x42')][_0x8883('0x53')]){_0x574383[_0x8883('0x54')]=[{'all':!![]}];}return db[_0x8883('0x3c')]['findAll'](_0x574383);})['then'](function(_0x27849e){_0x10fa31[_0x8883('0x55')]=_0x27849e;return _0x10fa31;})['then'](respondWithFilteredResult(_0x2caf53,_0x574383))[_0x8883('0x2d')](handleError(_0x2caf53,null));};exports['show']=function(_0x5319dd,_0x2b2241){var _0x7349bf={'raw':!![],'where':{'id':_0x5319dd[_0x8883('0x56')]['id']}},_0x485358={};_0x485358[_0x8883('0x41')]=_[_0x8883('0x43')](db[_0x8883('0x3c')][_0x8883('0x3d')]);_0x485358[_0x8883('0x42')]=_[_0x8883('0x43')](_0x5319dd[_0x8883('0x42')]);_0x485358[_0x8883('0x44')]=_['intersection'](_0x485358[_0x8883('0x41')],_0x485358[_0x8883('0x42')]);_0x7349bf[_0x8883('0x46')]=_[_0x8883('0x45')](_0x485358[_0x8883('0x41')],qs[_0x8883('0x47')](_0x5319dd[_0x8883('0x42')][_0x8883('0x47')]));_0x7349bf['attributes']=_0x7349bf['attributes']['length']?_0x7349bf[_0x8883('0x46')]:_0x485358['model'];if(_0x5319dd[_0x8883('0x42')][_0x8883('0x53')]){_0x7349bf[_0x8883('0x54')]=[{'all':!![]}];}_0x7349bf=_[_0x8883('0x50')]({},_0x7349bf,_0x5319dd[_0x8883('0x52')]);return db[_0x8883('0x3c')][_0x8883('0x57')](_0x7349bf)[_0x8883('0x23')](handleEntityNotFound(_0x2b2241,null))[_0x8883('0x23')](respondWithResult(_0x2b2241,null))[_0x8883('0x2d')](handleError(_0x2b2241,null));};exports[_0x8883('0x58')]=function(_0x5ac891,_0x4d39dc){return db[_0x8883('0x3c')][_0x8883('0x58')](_0x5ac891[_0x8883('0x59')],{})[_0x8883('0x23')](respondWithResult(_0x4d39dc,0xc9))['catch'](handleError(_0x4d39dc,null));};exports[_0x8883('0x5a')]=function(_0x274456,_0x121e81){if(_0x274456[_0x8883('0x59')]['id']){delete _0x274456[_0x8883('0x59')]['id'];}return db['OpenchannelMessage'][_0x8883('0x57')]({'where':{'id':_0x274456['params']['id']}})['then'](handleEntityNotFound(_0x121e81,null))[_0x8883('0x23')](saveUpdates(_0x274456['body'],null))[_0x8883('0x23')](respondWithResult(_0x121e81,null))[_0x8883('0x2d')](handleError(_0x121e81,null));};exports[_0x8883('0x35')]=function(_0x30f2b4,_0x31f6ee){return db[_0x8883('0x3c')][_0x8883('0x57')]({'where':{'id':_0x30f2b4[_0x8883('0x56')]['id']}})[_0x8883('0x23')](handleEntityNotFound(_0x31f6ee,null))[_0x8883('0x23')](removeEntity(_0x31f6ee,null))[_0x8883('0x2d')](handleError(_0x31f6ee,null));};exports[_0x8883('0x5b')]=function(_0x57303f,_0x5e922d){return db[_0x8883('0x3c')][_0x8883('0x5b')]()[_0x8883('0x23')](respondWithResult(_0x5e922d,null))[_0x8883('0x2d')](handleError(_0x5e922d,null));};var interaction_log=require(_0x8883('0x16'))(_0x8883('0x5c'));exports[_0x8883('0x5d')]=function(_0x5b7a44,_0xf3d85c,_0x4c0af8){var _0x117bd0={'agent':{},'channel':_0x8883('0x5e')};if(_0x5b7a44[_0x8883('0x59')]['id']){delete _0x5b7a44[_0x8883('0x59')]['id'];}_0x5b7a44[_0x8883('0x59')]['read']=!![];_0x5b7a44[_0x8883('0x59')]['readAt']=moment()[_0x8883('0x5f')](_0x8883('0x60'));_0x5b7a44['body'][_0x8883('0x61')]=_0x5b7a44[_0x8883('0x59')][_0x8883('0x61')]||_0x5b7a44['user']['id'];_0x117bd0['agent']['id']=_0x5b7a44[_0x8883('0x59')][_0x8883('0x61')];return db[_0x8883('0x3c')][_0x8883('0x57')]({'where':{'id':_0x5b7a44[_0x8883('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xf3d85c,null))[_0x8883('0x23')](saveUpdates(_0x5b7a44[_0x8883('0x59')],null))[_0x8883('0x23')](function(_0x53d031){if(_0x53d031){_0x117bd0['message']=_0x53d031['get']({'plain':!![]});return db[_0x8883('0x62')][_0x8883('0x57')]({'where':{'id':_0x53d031['OpenchannelInteractionId']}});}return null;})[_0x8883('0x23')](handleEntityNotFound(_0xf3d85c,null))[_0x8883('0x23')](function(_0x369172){if(_0x369172){return _0x369172[_0x8883('0x5a')]({'UserId':_0x5b7a44[_0x8883('0x59')][_0x8883('0x61')],'read1stAt':_[_0x8883('0x63')](_0x369172[_0x8883('0x64')])?moment()[_0x8883('0x5f')](_0x8883('0x60')):undefined});}return null;})[_0x8883('0x23')](function(_0x19f748){if(_0x19f748){_0x117bd0[_0x8883('0x65')]=_0x19f748[_0x8883('0x66')]({'plain':!![]});interaction_log[_0x8883('0x24')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5b7a44[_0x8883('0x67')]['id'],_0x5b7a44[_0x8883('0x67')][_0x8883('0x39')],_0x5b7a44[_0x8883('0x67')][_0x8883('0x68')],_0x117bd0[_0x8883('0x65')]['id'],_0x5b7a44[_0x8883('0x59')]?JSON[_0x8883('0x27')](_0x5b7a44[_0x8883('0x59')]):'null');return respondWithRpcPromise(_0x8883('0x69'),_0x8883('0x6a'),_0x117bd0);}return null;})[_0x8883('0x23')](function(_0x1bcf4a){var _0x448174=_0x8883('0x6b')+_0x1bcf4a[_0x8883('0x2a')][_0x8883('0x6c')];return db['sequelize']['query'](_0x448174,{'type':db[_0x8883('0x6d')]['QueryTypes']['SELECT'],'raw':!![]})[_0x8883('0x23')](function(_0x50d31f){return _0x50d31f;});})[_0x8883('0x23')](function(_0x488fbc){if(_0x488fbc){_0x117bd0[_0x8883('0x2a')]['contact']=_0x488fbc[0x0];if(!_0x5b7a44[_0x8883('0x59')][_0x8883('0x61')])return;return db[_0x8883('0x6e')][_0x8883('0x57')]({'where':{'id':_0x5b7a44[_0x8883('0x59')]['UserId'],'role':_0x8883('0x6f')},'attributes':['id','name',_0x8883('0x70'),'email',_0x8883('0x71')],'raw':!![]});}return null;})['then'](function(_0x3435e4){if(!_0x3435e4)return null;_0x117bd0[_0x8883('0x2a')][_0x8883('0x6f')]=_0x3435e4;return _0x117bd0;})[_0x8883('0x23')](function(_0x50917b){if(_0x50917b){if(_0x5b7a44[_0x8883('0x59')][_0x8883('0x72')]){_0x117bd0[_0x8883('0x2a')][_0x8883('0x73')]=util[_0x8883('0x5f')]('SIP/%s',_0x5b7a44['user'][_0x8883('0x39')]);_0x117bd0['message']['channel']=_0x117bd0[_0x8883('0x74')];_0x117bd0[_0x8883('0x2a')][_0x8883('0x75')]=_0x8883('0x5d');return respondWithRpcPromise('EventManager',_0x8883('0x76'),{'event':_0x8883('0x77'),'message':_0x117bd0[_0x8883('0x2a')]},client9002)[_0x8883('0x23')](function(){return _0x117bd0;});}return _0x117bd0;}return null;})[_0x8883('0x23')](respondWithResult(_0xf3d85c,null))[_0x8883('0x2d')](handleError(_0xf3d85c,null));};var interaction_log=require(_0x8883('0x16'))(_0x8883('0x5c'));exports['reject']=function(_0x273e45,_0x444377,_0x5f5ae0){var _0x3623b1={'agent':{},'channel':'openchannel'};if(_0x273e45[_0x8883('0x59')]['id']){delete _0x273e45['body']['id'];}_0x273e45['body'][_0x8883('0x61')]=_0x273e45[_0x8883('0x59')][_0x8883('0x61')]||_0x273e45[_0x8883('0x67')]['id'];_0x3623b1[_0x8883('0x6f')]['id']=_0x273e45[_0x8883('0x59')][_0x8883('0x61')];return db['OpenchannelMessage'][_0x8883('0x57')]({'where':{'id':_0x273e45[_0x8883('0x56')]['id'],'UserId':null}})[_0x8883('0x23')](handleEntityNotFound(_0x444377,null))[_0x8883('0x23')](function(_0x4f8faf){if(_0x4f8faf){_0x3623b1[_0x8883('0x2a')]=_0x4f8faf['get']({'plain':!![]});return db[_0x8883('0x62')][_0x8883('0x57')]({'where':{'id':_0x4f8faf[_0x8883('0x78')]}});}return null;})[_0x8883('0x23')](handleEntityNotFound(_0x444377,null))['then'](function(_0x37ce66){if(_0x37ce66){_0x3623b1[_0x8883('0x65')]=_0x37ce66[_0x8883('0x66')]({'plain':!![]});interaction_log[_0x8883('0x24')](_0x8883('0x79'),_0x273e45[_0x8883('0x67')]['id'],_0x273e45['user']['name'],_0x273e45[_0x8883('0x67')][_0x8883('0x68')],_0x3623b1[_0x8883('0x65')]['id'],_0x273e45['body']?JSON[_0x8883('0x27')](_0x273e45[_0x8883('0x59')]):_0x8883('0x7a'));return respondWithRpcPromise(_0x8883('0x7b'),_0x8883('0x7c'),_0x3623b1);}return null;})[_0x8883('0x23')](function(_0x593682){var _0x4cf29b=_0x8883('0x6b')+_0x593682[_0x8883('0x2a')]['ContactId'];return db[_0x8883('0x7d')][_0x8883('0x42')](_0x4cf29b,{'type':db[_0x8883('0x6d')][_0x8883('0x7e')]['SELECT'],'raw':!![]})['then'](function(_0x4dc5d1){return _0x4dc5d1;});})['then'](function(_0x595a6f){if(_0x595a6f){_0x3623b1[_0x8883('0x2a')]['contact']=_0x595a6f[0x0];if(!_0x273e45[_0x8883('0x59')]['UserId'])return;return db[_0x8883('0x6e')][_0x8883('0x57')]({'where':{'id':_0x273e45[_0x8883('0x59')][_0x8883('0x61')],'role':_0x8883('0x6f')},'attributes':['id','name','fullname',_0x8883('0x7f'),_0x8883('0x71')],'raw':!![]});}return null;})[_0x8883('0x23')](function(_0x5c8b81){if(!_0x5c8b81)return null;_0x3623b1[_0x8883('0x2a')][_0x8883('0x6f')]=_0x5c8b81;return _0x3623b1;})['then'](function(_0x386a8a){if(_0x386a8a){_0x386a8a['message'][_0x8883('0x73')]=util[_0x8883('0x5f')](_0x8883('0x80'),_0x273e45[_0x8883('0x67')][_0x8883('0x39')]);_0x386a8a[_0x8883('0x2a')][_0x8883('0x74')]=_0x3623b1['channel'];_0x386a8a[_0x8883('0x2a')][_0x8883('0x75')]=_0x8883('0x34');respondWithRpcPromise('EventManager',_0x8883('0x76'),{'event':'rejectmessage','message':_0x386a8a[_0x8883('0x2a')]},client9002);return _0x3623b1;}return null;})[_0x8883('0x23')](respondWithResult(_0x444377,null))[_0x8883('0x2d')](handleError(_0x444377,null));}; \ No newline at end of file +var _0x7f6c=['order','sort','where','filter','merge','includeAll','include','findAll','rows','show','params','rawAttributes','options','find','body','describe','openchannel-interactions','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','isNil','read1stAt','format','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','stringify','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','SELECT','contact','User','fullname','internal','manual','SIP/%s','channel','event','EventManager','acceptmessage','openchannel','OpenchannelInteraction','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','QueryTypes','email','rejectmessage','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','request','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','OpenchannelMessage,\x20%s,\x20%s','result','catch','status','json','offset','undefined','limit','count','update','then','destroy','end','stack','name','send','index','OpenchannelMessage','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x2dce1c,_0x387b9d){var _0x22e42b=function(_0x5c5355){while(--_0x5c5355){_0x2dce1c['push'](_0x2dce1c['shift']());}};_0x22e42b(++_0x387b9d);}(_0x7f6c,0x1b8));var _0xc7f6=function(_0x264a1e,_0x14ff57){_0x264a1e=_0x264a1e-0x0;var _0x4dfaea=_0x7f6c[_0x264a1e];return _0x4dfaea;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc7f6('0x0'));var zipdir=require(_0xc7f6('0x1'));var jsonpatch=require(_0xc7f6('0x2'));var rp=require(_0xc7f6('0x3'));var moment=require(_0xc7f6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc7f6('0x5'));var util=require('util');var path=require(_0xc7f6('0x6'));var sox=require(_0xc7f6('0x7'));var csv=require('to-csv');var ejs=require(_0xc7f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc7f6('0x9'));var squel=require(_0xc7f6('0xa'));var crypto=require(_0xc7f6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xc7f6('0xc'));var toCsv=require(_0xc7f6('0xd'));var querystring=require(_0xc7f6('0xe'));var Papa=require(_0xc7f6('0xf'));var Redis=require(_0xc7f6('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc7f6('0x11'));var as=require(_0xc7f6('0x12'));var hardwareService=require(_0xc7f6('0x13'));var logger=require(_0xc7f6('0x14'))(_0xc7f6('0x15'));var utils=require(_0xc7f6('0x16'));var config=require(_0xc7f6('0x17'));var licenseUtil=require(_0xc7f6('0x18'));var db=require(_0xc7f6('0x19'))['db'];config[_0xc7f6('0x1a')]=_['defaults'](config[_0xc7f6('0x1a')],{'host':_0xc7f6('0x1b'),'port':0x18eb});var socket=require(_0xc7f6('0x1c'))(new Redis(config['redis']));require('./openchannelMessage.socket')[_0xc7f6('0x1d')](socket);var jayson=require(_0xc7f6('0x1e'));var client=jayson[_0xc7f6('0x1f')]['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x600d31,_0x52a1a7,_0x56438b,_0x38d7dc){return new BPromise(function(_0x521a51,_0xc3c929){var _0xa611c6=_0x38d7dc||client;return _0xa611c6[_0xc7f6('0x20')](_0x600d31,_0x56438b)['then'](function(_0x23f260){logger[_0xc7f6('0x21')]('OpenchannelMessage,\x20%s,\x20%s',_0x52a1a7,_0xc7f6('0x22'));logger[_0xc7f6('0x23')](_0xc7f6('0x24'),_0x52a1a7,_0xc7f6('0x22'),JSON['stringify'](_0x23f260));if(_0x23f260[_0xc7f6('0x25')]){if(_0x23f260[_0xc7f6('0x25')][_0xc7f6('0x26')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x52a1a7,_0x23f260[_0xc7f6('0x25')][_0xc7f6('0x27')]);return _0xc3c929(_0x23f260['error'][_0xc7f6('0x27')]);}logger[_0xc7f6('0x25')](_0xc7f6('0x28'),_0x52a1a7,_0x23f260[_0xc7f6('0x25')][_0xc7f6('0x27')]);return _0x521a51(_0x23f260[_0xc7f6('0x25')][_0xc7f6('0x27')]);}else{logger[_0xc7f6('0x21')](_0xc7f6('0x28'),_0x52a1a7,_0xc7f6('0x22'));_0x521a51(_0x23f260[_0xc7f6('0x29')][_0xc7f6('0x27')]);}})[_0xc7f6('0x2a')](function(_0x20ef67){logger['error'](_0xc7f6('0x28'),_0x52a1a7,_0x20ef67);_0xc3c929(_0x20ef67);});});}function respondWithStatusCode(_0x5aaf58,_0x31002a){_0x31002a=_0x31002a||0xcc;return function(_0x27b31f){if(_0x27b31f){return _0x5aaf58['sendStatus'](_0x31002a);}return _0x5aaf58['status'](_0x31002a)['end']();};}function respondWithResult(_0x143c5a,_0x5c385f){_0x5c385f=_0x5c385f||0xc8;return function(_0x3aa9f8){if(_0x3aa9f8){return _0x143c5a[_0xc7f6('0x2b')](_0x5c385f)[_0xc7f6('0x2c')](_0x3aa9f8);}};}function respondWithFilteredResult(_0x374ac8,_0x33e4e3){return function(_0x380f5c){if(_0x380f5c){var _0x3e648b=typeof _0x33e4e3[_0xc7f6('0x2d')]===_0xc7f6('0x2e')&&typeof _0x33e4e3[_0xc7f6('0x2f')]===_0xc7f6('0x2e');var _0x4954ae=_0x380f5c['count'];var _0x2607c6=_0x3e648b?0x0:_0x33e4e3['offset'];var _0x24dc4d=_0x3e648b?_0x380f5c[_0xc7f6('0x30')]:_0x33e4e3[_0xc7f6('0x2d')]+_0x33e4e3[_0xc7f6('0x2f')];var _0x73456a;if(_0x24dc4d>=_0x4954ae){_0x24dc4d=_0x4954ae;_0x73456a=0xc8;}else{_0x73456a=0xce;}_0x374ac8[_0xc7f6('0x2b')](_0x73456a);return _0x374ac8['set']('Content-Range',_0x2607c6+'-'+_0x24dc4d+'/'+_0x4954ae)[_0xc7f6('0x2c')](_0x380f5c);}return null;};}function patchUpdates(_0x16efa2){return function(_0x46344c){try{jsonpatch['apply'](_0x46344c,_0x16efa2,!![]);}catch(_0x565cf2){return BPromise['reject'](_0x565cf2);}return _0x46344c['save']();};}function saveUpdates(_0x2b0f96,_0x143239){return function(_0xeb385a){if(_0xeb385a){return _0xeb385a[_0xc7f6('0x31')](_0x2b0f96)[_0xc7f6('0x32')](function(_0x3d6e4a){return _0x3d6e4a;});}return null;};}function removeEntity(_0x3d90ea,_0x2dd772){return function(_0x1a722a){if(_0x1a722a){return _0x1a722a[_0xc7f6('0x33')]()[_0xc7f6('0x32')](function(){_0x3d90ea[_0xc7f6('0x2b')](0xcc)[_0xc7f6('0x34')]();});}};}function handleEntityNotFound(_0x10b98f,_0x4ad5a5){return function(_0x2be9c7){if(!_0x2be9c7){_0x10b98f['sendStatus'](0x194);}return _0x2be9c7;};}function handleError(_0x192136,_0x40835d){_0x40835d=_0x40835d||0x1f4;return function(_0x2be4ff){logger['error'](_0x2be4ff[_0xc7f6('0x35')]);if(_0x2be4ff[_0xc7f6('0x36')]){delete _0x2be4ff[_0xc7f6('0x36')];}_0x192136['status'](_0x40835d)[_0xc7f6('0x37')](_0x2be4ff);};}exports[_0xc7f6('0x38')]=function(_0x4bef2c,_0x2ef691){var _0x59bf58={},_0x476bc3={},_0x1b109e={'count':0x0,'rows':[]};var _0x386e9a=_['map'](db[_0xc7f6('0x39')]['rawAttributes'],function(_0xa17041){return{'name':_0xa17041[_0xc7f6('0x3a')],'type':_0xa17041[_0xc7f6('0x3b')][_0xc7f6('0x3c')]};});_0x476bc3[_0xc7f6('0x3d')]=_[_0xc7f6('0x3e')](_0x386e9a,'name');_0x476bc3[_0xc7f6('0x3f')]=_[_0xc7f6('0x40')](_0x4bef2c[_0xc7f6('0x3f')]);_0x476bc3[_0xc7f6('0x41')]=_[_0xc7f6('0x42')](_0x476bc3[_0xc7f6('0x3d')],_0x476bc3[_0xc7f6('0x3f')]);_0x59bf58[_0xc7f6('0x43')]=_['intersection'](_0x476bc3[_0xc7f6('0x3d')],qs[_0xc7f6('0x44')](_0x4bef2c['query'][_0xc7f6('0x44')]));_0x59bf58['attributes']=_0x59bf58['attributes'][_0xc7f6('0x45')]?_0x59bf58[_0xc7f6('0x43')]:_0x476bc3[_0xc7f6('0x3d')];if(!_0x4bef2c['query'][_0xc7f6('0x46')](_0xc7f6('0x47'))){_0x59bf58[_0xc7f6('0x2f')]=qs['limit'](_0x4bef2c[_0xc7f6('0x3f')][_0xc7f6('0x2f')]);_0x59bf58[_0xc7f6('0x2d')]=qs['offset'](_0x4bef2c[_0xc7f6('0x3f')][_0xc7f6('0x2d')]);}_0x59bf58[_0xc7f6('0x48')]=qs[_0xc7f6('0x49')](_0x4bef2c['query'][_0xc7f6('0x49')]);_0x59bf58[_0xc7f6('0x4a')]=qs[_0xc7f6('0x41')](_['pick'](_0x4bef2c[_0xc7f6('0x3f')],_0x476bc3['filters']),_0x386e9a);if(_0x4bef2c[_0xc7f6('0x3f')]['filter']){_0x59bf58[_0xc7f6('0x4a')]=_['merge'](_0x59bf58[_0xc7f6('0x4a')],{'$or':_['map'](_0x386e9a,function(_0x32ab62){if(_0x32ab62[_0xc7f6('0x3b')]!=='VIRTUAL'){var _0x2e6522={};_0x2e6522[_0x32ab62[_0xc7f6('0x36')]]={'$like':'%'+_0x4bef2c[_0xc7f6('0x3f')][_0xc7f6('0x4b')]+'%'};return _0x2e6522;}})});}_0x59bf58=_[_0xc7f6('0x4c')]({},_0x59bf58,_0x4bef2c['options']);var _0x11be41={'where':_0x59bf58[_0xc7f6('0x4a')]};return db['OpenchannelMessage'][_0xc7f6('0x30')](_0x11be41)[_0xc7f6('0x32')](function(_0x3e7acb){_0x1b109e[_0xc7f6('0x30')]=_0x3e7acb;if(_0x4bef2c['query'][_0xc7f6('0x4d')]){_0x59bf58[_0xc7f6('0x4e')]=[{'all':!![]}];}return db[_0xc7f6('0x39')][_0xc7f6('0x4f')](_0x59bf58);})['then'](function(_0xc74add){_0x1b109e[_0xc7f6('0x50')]=_0xc74add;return _0x1b109e;})['then'](respondWithFilteredResult(_0x2ef691,_0x59bf58))[_0xc7f6('0x2a')](handleError(_0x2ef691,null));};exports[_0xc7f6('0x51')]=function(_0x3aee32,_0xbb22ee){var _0x2ea333={'raw':!![],'where':{'id':_0x3aee32[_0xc7f6('0x52')]['id']}},_0xe861f4={};_0xe861f4['model']=_[_0xc7f6('0x40')](db[_0xc7f6('0x39')][_0xc7f6('0x53')]);_0xe861f4[_0xc7f6('0x3f')]=_[_0xc7f6('0x40')](_0x3aee32[_0xc7f6('0x3f')]);_0xe861f4[_0xc7f6('0x41')]=_[_0xc7f6('0x42')](_0xe861f4[_0xc7f6('0x3d')],_0xe861f4[_0xc7f6('0x3f')]);_0x2ea333['attributes']=_[_0xc7f6('0x42')](_0xe861f4[_0xc7f6('0x3d')],qs[_0xc7f6('0x44')](_0x3aee32['query'][_0xc7f6('0x44')]));_0x2ea333[_0xc7f6('0x43')]=_0x2ea333['attributes'][_0xc7f6('0x45')]?_0x2ea333['attributes']:_0xe861f4[_0xc7f6('0x3d')];if(_0x3aee32[_0xc7f6('0x3f')]['includeAll']){_0x2ea333['include']=[{'all':!![]}];}_0x2ea333=_[_0xc7f6('0x4c')]({},_0x2ea333,_0x3aee32[_0xc7f6('0x54')]);return db[_0xc7f6('0x39')][_0xc7f6('0x55')](_0x2ea333)[_0xc7f6('0x32')](handleEntityNotFound(_0xbb22ee,null))[_0xc7f6('0x32')](respondWithResult(_0xbb22ee,null))['catch'](handleError(_0xbb22ee,null));};exports['create']=function(_0x5aed94,_0x36c7c7){return db['OpenchannelMessage']['create'](_0x5aed94[_0xc7f6('0x56')],{})['then'](respondWithResult(_0x36c7c7,0xc9))['catch'](handleError(_0x36c7c7,null));};exports[_0xc7f6('0x31')]=function(_0x5a81c8,_0xe52055){if(_0x5a81c8[_0xc7f6('0x56')]['id']){delete _0x5a81c8[_0xc7f6('0x56')]['id'];}return db[_0xc7f6('0x39')][_0xc7f6('0x55')]({'where':{'id':_0x5a81c8['params']['id']}})[_0xc7f6('0x32')](handleEntityNotFound(_0xe52055,null))['then'](saveUpdates(_0x5a81c8[_0xc7f6('0x56')],null))[_0xc7f6('0x32')](respondWithResult(_0xe52055,null))[_0xc7f6('0x2a')](handleError(_0xe52055,null));};exports[_0xc7f6('0x33')]=function(_0x430b90,_0x37f618){return db['OpenchannelMessage']['find']({'where':{'id':_0x430b90[_0xc7f6('0x52')]['id']}})[_0xc7f6('0x32')](handleEntityNotFound(_0x37f618,null))[_0xc7f6('0x32')](removeEntity(_0x37f618,null))[_0xc7f6('0x2a')](handleError(_0x37f618,null));};exports[_0xc7f6('0x57')]=function(_0x40ff15,_0x42146a){return db[_0xc7f6('0x39')]['describe']()[_0xc7f6('0x32')](respondWithResult(_0x42146a,null))['catch'](handleError(_0x42146a,null));};var interaction_log=require(_0xc7f6('0x14'))(_0xc7f6('0x58'));exports[_0xc7f6('0x59')]=function(_0x4f55a7,_0x305b1b,_0x2ddbff){var _0x3f80c7={'agent':{},'channel':'openchannel'};if(_0x4f55a7[_0xc7f6('0x56')]['id']){delete _0x4f55a7[_0xc7f6('0x56')]['id'];}_0x4f55a7[_0xc7f6('0x56')][_0xc7f6('0x5a')]=!![];_0x4f55a7[_0xc7f6('0x56')][_0xc7f6('0x5b')]=moment()['format'](_0xc7f6('0x5c'));_0x4f55a7[_0xc7f6('0x56')]['UserId']=_0x4f55a7[_0xc7f6('0x56')][_0xc7f6('0x5d')]||_0x4f55a7['user']['id'];_0x3f80c7[_0xc7f6('0x5e')]['id']=_0x4f55a7[_0xc7f6('0x56')][_0xc7f6('0x5d')];return db[_0xc7f6('0x39')][_0xc7f6('0x55')]({'where':{'id':_0x4f55a7[_0xc7f6('0x52')]['id'],'UserId':null}})[_0xc7f6('0x32')](handleEntityNotFound(_0x305b1b,null))[_0xc7f6('0x32')](saveUpdates(_0x4f55a7[_0xc7f6('0x56')],null))[_0xc7f6('0x32')](function(_0x3d66db){if(_0x3d66db){_0x3f80c7[_0xc7f6('0x27')]=_0x3d66db[_0xc7f6('0x5f')]({'plain':!![]});return db['OpenchannelInteraction'][_0xc7f6('0x55')]({'where':{'id':_0x3d66db['OpenchannelInteractionId']}});}return null;})[_0xc7f6('0x32')](handleEntityNotFound(_0x305b1b,null))[_0xc7f6('0x32')](function(_0x249c51){if(_0x249c51){return _0x249c51[_0xc7f6('0x31')]({'UserId':_0x4f55a7[_0xc7f6('0x56')][_0xc7f6('0x5d')],'read1stAt':_[_0xc7f6('0x60')](_0x249c51[_0xc7f6('0x61')])?moment()[_0xc7f6('0x62')](_0xc7f6('0x5c')):undefined});}return null;})['then'](function(_0x5ac5dd){if(_0x5ac5dd){_0x3f80c7[_0xc7f6('0x63')]=_0x5ac5dd['get']({'plain':!![]});interaction_log[_0xc7f6('0x21')](_0xc7f6('0x64'),_0x4f55a7['user']['id'],_0x4f55a7[_0xc7f6('0x65')][_0xc7f6('0x36')],_0x4f55a7['user'][_0xc7f6('0x66')],_0x3f80c7[_0xc7f6('0x63')]['id'],_0x4f55a7['body']?JSON[_0xc7f6('0x67')](_0x4f55a7[_0xc7f6('0x56')]):_0xc7f6('0x68'));return respondWithRpcPromise('AcceptMessage',_0xc7f6('0x69'),_0x3f80c7);}return null;})[_0xc7f6('0x32')](function(_0x321b5c){var _0x3af24c=_0xc7f6('0x6a')+_0x321b5c[_0xc7f6('0x27')][_0xc7f6('0x6b')];return db[_0xc7f6('0x6c')]['query'](_0x3af24c,{'type':db['Sequelize']['QueryTypes'][_0xc7f6('0x6d')],'raw':!![]})[_0xc7f6('0x32')](function(_0x278baa){return _0x278baa;});})[_0xc7f6('0x32')](function(_0x8e41c3){if(_0x8e41c3){_0x3f80c7[_0xc7f6('0x27')][_0xc7f6('0x6e')]=_0x8e41c3[0x0];if(!_0x4f55a7[_0xc7f6('0x56')][_0xc7f6('0x5d')])return;return db[_0xc7f6('0x6f')][_0xc7f6('0x55')]({'where':{'id':_0x4f55a7[_0xc7f6('0x56')]['UserId'],'role':_0xc7f6('0x5e')},'attributes':['id',_0xc7f6('0x36'),_0xc7f6('0x70'),'email',_0xc7f6('0x71')],'raw':!![]});}return null;})[_0xc7f6('0x32')](function(_0x466353){if(!_0x466353)return null;_0x3f80c7[_0xc7f6('0x27')][_0xc7f6('0x5e')]=_0x466353;return _0x3f80c7;})[_0xc7f6('0x32')](function(_0x44a0bc){if(_0x44a0bc){if(_0x4f55a7[_0xc7f6('0x56')][_0xc7f6('0x72')]){_0x3f80c7[_0xc7f6('0x27')]['interface']=util['format'](_0xc7f6('0x73'),_0x4f55a7['user']['name']);_0x3f80c7[_0xc7f6('0x27')][_0xc7f6('0x74')]=_0x3f80c7[_0xc7f6('0x74')];_0x3f80c7[_0xc7f6('0x27')][_0xc7f6('0x75')]=_0xc7f6('0x59');return respondWithRpcPromise(_0xc7f6('0x76'),'EventManager',{'event':_0xc7f6('0x77'),'message':_0x3f80c7[_0xc7f6('0x27')]},client9002)['then'](function(){return _0x3f80c7;});}return _0x3f80c7;}return null;})[_0xc7f6('0x32')](respondWithResult(_0x305b1b,null))[_0xc7f6('0x2a')](handleError(_0x305b1b,null));};var interaction_log=require(_0xc7f6('0x14'))(_0xc7f6('0x58'));exports['reject']=function(_0xce0d24,_0x4f39d8,_0x2d7f31){var _0x3b434c={'agent':{},'channel':_0xc7f6('0x78')};if(_0xce0d24['body']['id']){delete _0xce0d24[_0xc7f6('0x56')]['id'];}_0xce0d24['body']['UserId']=_0xce0d24[_0xc7f6('0x56')][_0xc7f6('0x5d')]||_0xce0d24['user']['id'];_0x3b434c['agent']['id']=_0xce0d24[_0xc7f6('0x56')]['UserId'];return db[_0xc7f6('0x39')]['find']({'where':{'id':_0xce0d24[_0xc7f6('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4f39d8,null))[_0xc7f6('0x32')](function(_0x4953a4){if(_0x4953a4){_0x3b434c[_0xc7f6('0x27')]=_0x4953a4[_0xc7f6('0x5f')]({'plain':!![]});return db[_0xc7f6('0x79')][_0xc7f6('0x55')]({'where':{'id':_0x4953a4[_0xc7f6('0x7a')]}});}return null;})[_0xc7f6('0x32')](handleEntityNotFound(_0x4f39d8,null))['then'](function(_0x4b5fde){if(_0x4b5fde){_0x3b434c['interaction']=_0x4b5fde[_0xc7f6('0x5f')]({'plain':!![]});interaction_log['info'](_0xc7f6('0x7b'),_0xce0d24[_0xc7f6('0x65')]['id'],_0xce0d24[_0xc7f6('0x65')][_0xc7f6('0x36')],_0xce0d24[_0xc7f6('0x65')][_0xc7f6('0x66')],_0x3b434c[_0xc7f6('0x63')]['id'],_0xce0d24[_0xc7f6('0x56')]?JSON[_0xc7f6('0x67')](_0xce0d24[_0xc7f6('0x56')]):'null');return respondWithRpcPromise(_0xc7f6('0x7c'),'rejectMessage',_0x3b434c);}return null;})[_0xc7f6('0x32')](function(_0x2d5525){var _0x490aff=_0xc7f6('0x6a')+_0x2d5525[_0xc7f6('0x27')][_0xc7f6('0x6b')];return db[_0xc7f6('0x6c')][_0xc7f6('0x3f')](_0x490aff,{'type':db['Sequelize'][_0xc7f6('0x7d')][_0xc7f6('0x6d')],'raw':!![]})[_0xc7f6('0x32')](function(_0x3de59a){return _0x3de59a;});})[_0xc7f6('0x32')](function(_0x1a4d47){if(_0x1a4d47){_0x3b434c[_0xc7f6('0x27')]['contact']=_0x1a4d47[0x0];if(!_0xce0d24[_0xc7f6('0x56')][_0xc7f6('0x5d')])return;return db[_0xc7f6('0x6f')][_0xc7f6('0x55')]({'where':{'id':_0xce0d24[_0xc7f6('0x56')][_0xc7f6('0x5d')],'role':_0xc7f6('0x5e')},'attributes':['id',_0xc7f6('0x36'),_0xc7f6('0x70'),_0xc7f6('0x7e'),_0xc7f6('0x71')],'raw':!![]});}return null;})[_0xc7f6('0x32')](function(_0x7f8000){if(!_0x7f8000)return null;_0x3b434c[_0xc7f6('0x27')][_0xc7f6('0x5e')]=_0x7f8000;return _0x3b434c;})['then'](function(_0x466c07){if(_0x466c07){_0x466c07[_0xc7f6('0x27')]['interface']=util[_0xc7f6('0x62')](_0xc7f6('0x73'),_0xce0d24['user']['name']);_0x466c07[_0xc7f6('0x27')]['channel']=_0x3b434c['channel'];_0x466c07[_0xc7f6('0x27')][_0xc7f6('0x75')]='reject';respondWithRpcPromise(_0xc7f6('0x76'),'EventManager',{'event':_0xc7f6('0x7f'),'message':_0x466c07[_0xc7f6('0x27')]},client9002);return _0x3b434c;}return null;})[_0xc7f6('0x32')](respondWithResult(_0x4f39d8,null))['catch'](handleError(_0x4f39d8,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index abf4943..d869450 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 _0xce05=['exports','../../mysqldb','OpenchannelMessage','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x512ee6,_0x44f478){var _0x5d7d17=function(_0x2e74b2){while(--_0x2e74b2){_0x512ee6['push'](_0x512ee6['shift']());}};_0x5d7d17(++_0x44f478);}(_0xce05,0x118));var _0x5ce0=function(_0xe24ca1,_0x416454){_0xe24ca1=_0xe24ca1-0x0;var _0x832be7=_0xce05[_0xe24ca1];return _0x832be7;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x5ce0('0x0'))['db'][_0x5ce0('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x5ce0('0x2')](0x0);var events={'afterCreate':_0x5ce0('0x3'),'afterUpdate':'update','afterDestroy':_0x5ce0('0x4')};function emitEvent(_0x48dab1){return function(_0x36c455,_0x22b2d8,_0x33bebd){OpenchannelMessageEvents[_0x5ce0('0x5')](_0x48dab1+':'+_0x36c455['id'],_0x36c455);OpenchannelMessageEvents['emit'](_0x48dab1,_0x36c455);_0x33bebd(null);};}for(var e in events){if(events[_0x5ce0('0x6')](e)){var event=events[e];OpenchannelMessage[_0x5ce0('0x7')](e,emitEvent(event));}}module[_0x5ce0('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x85ec=['exports','OpenchannelMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x25ef63,_0x529038){var _0x124fc6=function(_0x52a41b){while(--_0x52a41b){_0x25ef63['push'](_0x25ef63['shift']());}};_0x124fc6(++_0x529038);}(_0x85ec,0x172));var _0xc85e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x85ec[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require('../../mysqldb')['db'][_0xc85e('0x0')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xc85e('0x1')](0x0);var events={'afterCreate':_0xc85e('0x2'),'afterUpdate':_0xc85e('0x3'),'afterDestroy':_0xc85e('0x4')};function emitEvent(_0x184741){return function(_0x2a95a9,_0x3e3b12,_0x5d7146){OpenchannelMessageEvents[_0xc85e('0x5')](_0x184741+':'+_0x2a95a9['id'],_0x2a95a9);OpenchannelMessageEvents[_0xc85e('0x5')](_0x184741,_0x2a95a9);_0x5d7146(null);};}for(var e in events){if(events[_0xc85e('0x6')](e)){var event=events[e];OpenchannelMessage[_0xc85e('0x7')](e,emitEvent(event));}}module[_0xc85e('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 e702d0f..9d63401 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 _0x087b=['threadId','OpenchannelInteraction','error','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','findOne','OpenchannelInteractionId','then','update','createdAt','catch','out','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','GET','POST','Message\x20%d\x20forwarded\x20to\x20%s'];(function(_0x351f1d,_0x646a6b){var _0x4e2810=function(_0x25d332){while(--_0x25d332){_0x351f1d['push'](_0x351f1d['shift']());}};_0x4e2810(++_0x646a6b);}(_0x087b,0x11a));var _0xb087=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x087b[_0x2dadb9];return _0x2f0097;};'use strict';var _=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb087('0x2'));var BPromise=require('bluebird');var rp=require(_0xb087('0x3'));var fs=require('fs');var path=require(_0xb087('0x4'));var rimraf=require(_0xb087('0x5'));var config=require(_0xb087('0x6'));var attributes=require(_0xb087('0x7'));module[_0xb087('0x8')]=function(_0x40156d,_0x17d6e8){return _0x40156d[_0xb087('0x9')](_0xb087('0xa'),attributes,{'tableName':_0xb087('0xb'),'paranoid':![],'indexes':[{'name':_0xb087('0xc'),'fields':[_0xb087('0xd')],'type':_0xb087('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2f14bc,_0x23cdd7,_0x379041){var _0x583d25=_0x40156d[_0xb087('0xf')];var _0x108451=_0x2f14bc[_0xb087('0x10')]({'plain':!![]});if(_0x108451[_0xb087('0x11')][_0xb087('0x12')]()==='in'||_0x108451[_0xb087('0x11')][_0xb087('0x12')]()==='out'&&!_0x108451[_0xb087('0x13')]&&!_[_0xb087('0x14')](_0x108451[_0xb087('0x15')])){_0x583d25['OpenchannelInteraction'][_0xb087('0x16')]({'where':{'id':_0x108451[_0xb087('0x17')]}})[_0xb087('0x18')](function(_0x46410b){if(_0x46410b){_0x46410b[_0xb087('0x19')]({'lastMsgAt':_0x108451[_0xb087('0x1a')],'lastMsgDirection':_0x108451[_0xb087('0x11')][_0xb087('0x12')]()});}})[_0xb087('0x1b')](function(_0x16d0b7){console['error'](_0x16d0b7);});}if(_0x108451[_0xb087('0x11')]===_0xb087('0x1c')&&!_0x108451['secret']){var _0xcc4426;_0x583d25[_0xb087('0x1d')][_0xb087('0x1e')]()['then'](function(_0x330005){return _0x583d25[_0xb087('0x1f')][_0xb087('0x20')]({'where':{'id':_0x108451[_0xb087('0x21')]},'include':[{'model':_0x583d25['OpenchannelInteraction'],'as':_0xb087('0x22'),'where':{'id':_0x108451[_0xb087('0x17')]},'limit':0x1,'include':[{'model':_0x583d25[_0xb087('0x1d')],'as':_0xb087('0x23'),'attributes':_['keys'](_0x330005)}]}]});})['then'](function(_0x5ea3dc){_0xcc4426=_0x5ea3dc['get']({'plain':!![]});if(_0xcc4426&&_0xcc4426[_0xb087('0x24')]){logger[_0xb087('0x25')](_0xb087('0x26'),_0xb087('0x27'),util[_0xb087('0x28')](_0xb087('0x29'),_0x108451['id'],_0xcc4426[_0xb087('0x24')]));if(_0xcc4426['Interactions']&&_0xcc4426[_0xb087('0x22')][_0xb087('0x2a')]){_0x108451[_0xb087('0x2b')]=_[_0xb087('0x2c')](_0xcc4426[_0xb087('0x22')][0x0],'Contact');_0x108451[_0xb087('0x23')]=_0xcc4426[_0xb087('0x22')][0x0]['Contact'];}var _0x23cdd7={'method':'POST','uri':encodeURI(_0xcc4426['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x23cdd7['method']){case _0xb087('0x2d'):_0x23cdd7['qs']=_0x108451;break;case _0xb087('0x2e'):_0x23cdd7[_0xb087('0xd')]=_0x108451;break;}return rp(_0x23cdd7)[_0xb087('0x18')](function(_0xd9ec66){logger[_0xb087('0x25')](_0xb087('0x26'),_0xb087('0x27'),util[_0xb087('0x28')](_0xb087('0x2f'),_0x108451['id'],_0xcc4426[_0xb087('0x24')]));if(_0xd9ec66[_0xb087('0xd')][_0xb087('0x30')]&&_0xd9ec66[_0xb087('0xd')]['threadId']!=_0x108451[_0xb087('0x2b')][_0xb087('0x30')]){return _0x583d25[_0xb087('0x31')][_0xb087('0x19')]({'threadId':_0xd9ec66[_0xb087('0xd')][_0xb087('0x30')]},{'logging':!![],'where':{'id':_0x108451[_0xb087('0x2b')]['id']}});}else{return;}})[_0xb087('0x18')](function(){return _0x2f14bc['update']({'read':!![]});})['catch'](function(_0x3f9311){logger[_0xb087('0x32')]('OpenchannelMessage,\x20%s,\x20%s',_0xb087('0x27'),util[_0xb087('0x33')](_0x3f9311,{'showHidden':![],'depth':null}));_0x379041();});}else{_0x379041();}})[_0xb087('0x34')](function(){_0x379041();});}else{_0x379041();}}},'charset':_0xb087('0x35'),'collate':_0xb087('0x36')});}; \ No newline at end of file +var _0x9354=['threadId','inspect','finally','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','FULLTEXT','models','get','direction','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','toLowerCase','catch','error','CmContact','describe','find','OpenchannelAccountId','Interactions','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','length','Interaction','Contact','POST','method','GET','body'];(function(_0x376dea,_0x1d02bb){var _0x1fcb0d=function(_0x4687e2){while(--_0x4687e2){_0x376dea['push'](_0x376dea['shift']());}};_0x1fcb0d(++_0x1d02bb);}(_0x9354,0x96));var _0x4935=function(_0x23a299,_0x30e49c){_0x23a299=_0x23a299-0x0;var _0x560bb3=_0x9354[_0x23a299];return _0x560bb3;};'use strict';var _=require('lodash');var util=require(_0x4935('0x0'));var logger=require(_0x4935('0x1'))('api');var moment=require(_0x4935('0x2'));var BPromise=require(_0x4935('0x3'));var rp=require(_0x4935('0x4'));var fs=require('fs');var path=require(_0x4935('0x5'));var rimraf=require('rimraf');var config=require(_0x4935('0x6'));var attributes=require(_0x4935('0x7'));module[_0x4935('0x8')]=function(_0x2d518a,_0x263864){return _0x2d518a[_0x4935('0x9')](_0x4935('0xa'),attributes,{'tableName':_0x4935('0xb'),'paranoid':![],'indexes':[{'name':_0x4935('0xc'),'fields':['body'],'type':_0x4935('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x47a44f,_0x2aac9a,_0x38de96){var _0xd5b117=_0x2d518a[_0x4935('0xe')];var _0x261462=_0x47a44f[_0x4935('0xf')]({'plain':!![]});if(_0x261462['direction']['toLowerCase']()==='in'||_0x261462[_0x4935('0x10')]['toLowerCase']()==='out'&&!_0x261462[_0x4935('0x11')]&&!_[_0x4935('0x12')](_0x261462[_0x4935('0x13')])){_0xd5b117[_0x4935('0x14')][_0x4935('0x15')]({'where':{'id':_0x261462[_0x4935('0x16')]}})[_0x4935('0x17')](function(_0x3a7c30){if(_0x3a7c30){_0x3a7c30[_0x4935('0x18')]({'lastMsgAt':_0x261462[_0x4935('0x19')],'lastMsgDirection':_0x261462[_0x4935('0x10')][_0x4935('0x1a')]()});}})[_0x4935('0x1b')](function(_0x3652c4){console[_0x4935('0x1c')](_0x3652c4);});}if(_0x261462[_0x4935('0x10')]==='out'&&!_0x261462[_0x4935('0x11')]){var _0x46526a;_0xd5b117[_0x4935('0x1d')][_0x4935('0x1e')]()[_0x4935('0x17')](function(_0x429ef3){return _0xd5b117['OpenchannelAccount'][_0x4935('0x1f')]({'where':{'id':_0x261462[_0x4935('0x20')]},'include':[{'model':_0xd5b117['OpenchannelInteraction'],'as':_0x4935('0x21'),'where':{'id':_0x261462[_0x4935('0x16')]},'limit':0x1,'include':[{'model':_0xd5b117[_0x4935('0x1d')],'as':'Contact','attributes':_['keys'](_0x429ef3)}]}]});})[_0x4935('0x17')](function(_0x6b849f){_0x46526a=_0x6b849f[_0x4935('0xf')]({'plain':!![]});if(_0x46526a&&_0x46526a[_0x4935('0x22')]){logger[_0x4935('0x23')](_0x4935('0x24'),_0x4935('0x25'),util[_0x4935('0x26')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x261462['id'],_0x46526a[_0x4935('0x22')]));if(_0x46526a[_0x4935('0x21')]&&_0x46526a[_0x4935('0x21')][_0x4935('0x27')]){_0x261462[_0x4935('0x28')]=_['omit'](_0x46526a['Interactions'][0x0],_0x4935('0x29'));_0x261462[_0x4935('0x29')]=_0x46526a[_0x4935('0x21')][0x0][_0x4935('0x29')];}var _0x2aac9a={'method':_0x4935('0x2a'),'uri':encodeURI(_0x46526a[_0x4935('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x2aac9a[_0x4935('0x2b')]){case _0x4935('0x2c'):_0x2aac9a['qs']=_0x261462;break;case _0x4935('0x2a'):_0x2aac9a[_0x4935('0x2d')]=_0x261462;break;}return rp(_0x2aac9a)[_0x4935('0x17')](function(_0x2c47ab){logger[_0x4935('0x23')](_0x4935('0x24'),'afterCreate',util['format']('Message\x20%d\x20forwarded\x20to\x20%s',_0x261462['id'],_0x46526a[_0x4935('0x22')]));if(_0x2c47ab[_0x4935('0x2d')]['threadId']&&_0x2c47ab[_0x4935('0x2d')][_0x4935('0x2e')]!=_0x261462[_0x4935('0x28')][_0x4935('0x2e')]){return _0xd5b117[_0x4935('0x14')][_0x4935('0x18')]({'threadId':_0x2c47ab[_0x4935('0x2d')][_0x4935('0x2e')]},{'logging':!![],'where':{'id':_0x261462['Interaction']['id']}});}else{return;}})[_0x4935('0x17')](function(){return _0x47a44f[_0x4935('0x18')]({'read':!![]});})['catch'](function(_0x48a289){logger[_0x4935('0x1c')]('OpenchannelMessage,\x20%s,\x20%s',_0x4935('0x25'),util[_0x4935('0x2f')](_0x48a289,{'showHidden':![],'depth':null}));_0x38de96();});}else{_0x38de96();}})[_0x4935('0x30')](function(){_0x38de96();});}else{_0x38de96();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index e83c7cc..6ba5d8f 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 _0x5f66=['stringify','error','code','message','info','result','OpenchannelMessage','create','body','options','raw','CreateOpenchannelMessage','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x225809,_0x2217c6){var _0x2f7128=function(_0x1e0268){while(--_0x1e0268){_0x225809['push'](_0x225809['shift']());}};_0x2f7128(++_0x2217c6);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x5f66[_0x3947c9];return _0x2e7871;};'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')]('OpenchannelMessage,\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')]('OpenchannelMessage,\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')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x4d79a1);_0x25c416(_0x4d79a1);});});}exports['CreateOpenchannelMessage']=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']('CreateOpenchannelMessage',_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 +var _0x2ef3=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','CreateOpenchannelMessage','create','options','info'];(function(_0x39efbf,_0x118364){var _0xcbd510=function(_0x4e152f){while(--_0x4e152f){_0x39efbf['push'](_0x39efbf['shift']());}};_0xcbd510(++_0x118364);}(_0x2ef3,0xba));var _0x32ef=function(_0x180725,_0x2e9027){_0x180725=_0x180725-0x0;var _0x4536f2=_0x2ef3[_0x180725];return _0x4536f2;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x32ef('0xa')]=_[_0x32ef('0xb')](config[_0x32ef('0xa')],{'host':_0x32ef('0xc'),'port':0x18eb});var socket=require(_0x32ef('0xd'))(new Redis(config[_0x32ef('0xa')]));require(_0x32ef('0xe'))[_0x32ef('0xf')](socket);function respondWithRpcPromise(_0x28275c,_0x77df79,_0x56eb42){return new BPromise(function(_0x5780e9,_0x401d0b){return client[_0x32ef('0x10')](_0x28275c,_0x56eb42)[_0x32ef('0x11')](function(_0x1499c2){logger['info'](_0x32ef('0x12'),_0x77df79,'request\x20sent');logger[_0x32ef('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x77df79,_0x32ef('0x14'),JSON[_0x32ef('0x15')](_0x1499c2));if(_0x1499c2['error']){if(_0x1499c2['error'][_0x32ef('0x16')]===0x1f4){logger['error'](_0x32ef('0x12'),_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x401d0b(_0x1499c2[_0x32ef('0x17')]['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x5780e9(_0x1499c2[_0x32ef('0x17')]['message']);}else{logger['info'](_0x32ef('0x12'),_0x77df79,_0x32ef('0x14'));_0x5780e9(_0x1499c2[_0x32ef('0x19')]['message']);}})[_0x32ef('0x1a')](function(_0x33e230){logger['error'](_0x32ef('0x12'),_0x77df79,_0x33e230);_0x401d0b(_0x33e230);});});}exports[_0x32ef('0x1b')]=function(_0x26aff3){var _0x251084=this;return new Promise(function(_0x445cda,_0x3aec05){return db['OpenchannelMessage'][_0x32ef('0x1c')](_0x26aff3['body'],{'raw':_0x26aff3[_0x32ef('0x1d')]?_0x26aff3[_0x32ef('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x32ef('0x11')](function(_0x97780){logger[_0x32ef('0x1e')]('CreateOpenchannelMessage',_0x26aff3);logger['debug'](_0x32ef('0x1b'),_0x26aff3,JSON[_0x32ef('0x15')](_0x97780));_0x445cda(_0x97780);})[_0x32ef('0x1a')](function(_0x478bef){logger['error'](_0x32ef('0x1b'),_0x478bef['message'],_0x26aff3);_0x3aec05(_0x251084['error'](0x1f4,_0x478bef[_0x32ef('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 3084705..b891b28 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 _0x596d=['removeListener','register','length','openchannelMessage:','./openchannelMessage.events','save','update','emit'];(function(_0x29fd23,_0x28389){var _0x483bc5=function(_0x5d78d0){while(--_0x5d78d0){_0x29fd23['push'](_0x29fd23['shift']());}};_0x483bc5(++_0x28389);}(_0x596d,0x19c));var _0xd596=function(_0x1128ab,_0xac835e){_0x1128ab=_0x1128ab-0x0;var _0x2db89f=_0x596d[_0x1128ab];return _0x2db89f;};'use strict';var OpenchannelMessageEvents=require(_0xd596('0x0'));var events=[_0xd596('0x1'),'remove',_0xd596('0x2')];function createListener(_0xe0a08e,_0x41b750){return function(_0x1a5533){_0x41b750[_0xd596('0x3')](_0xe0a08e,_0x1a5533);};}function removeListener(_0x168c1c,_0x5f0059){return function(){OpenchannelMessageEvents[_0xd596('0x4')](_0x168c1c,_0x5f0059);};}exports[_0xd596('0x5')]=function(_0x586bb8){for(var _0x24981f=0x0,_0x115758=events[_0xd596('0x6')];_0x24981f<_0x115758;_0x24981f++){var _0x54f881=events[_0x24981f];var _0x594b2a=createListener(_0xd596('0x7')+_0x54f881,_0x586bb8);OpenchannelMessageEvents['on'](_0x54f881,_0x594b2a);}}; \ No newline at end of file +var _0x1dbb=['save','remove','emit','removeListener','length','openchannelMessage:','./openchannelMessage.events'];(function(_0x4de2e3,_0x7c3e2a){var _0x5df1c7=function(_0x2d2d8d){while(--_0x2d2d8d){_0x4de2e3['push'](_0x4de2e3['shift']());}};_0x5df1c7(++_0x7c3e2a);}(_0x1dbb,0xed));var _0xb1db=function(_0x211fb3,_0x22b5b1){_0x211fb3=_0x211fb3-0x0;var _0x25369e=_0x1dbb[_0x211fb3];return _0x25369e;};'use strict';var OpenchannelMessageEvents=require(_0xb1db('0x0'));var events=[_0xb1db('0x1'),_0xb1db('0x2'),'update'];function createListener(_0x5f1baf,_0x112d24){return function(_0x4fc67e){_0x112d24[_0xb1db('0x3')](_0x5f1baf,_0x4fc67e);};}function removeListener(_0x47e709,_0x108b15){return function(){OpenchannelMessageEvents[_0xb1db('0x4')](_0x47e709,_0x108b15);};}exports['register']=function(_0x57d1ba){for(var _0x441e7c=0x0,_0x1d1a16=events[_0xb1db('0x5')];_0x441e7c<_0x1d1a16;_0x441e7c++){var _0x24470=events[_0x441e7c];var _0x4a5dd8=createListener(_0xb1db('0x6')+_0x24470,_0x57d1ba);OpenchannelMessageEvents['on'](_0x24470,_0x4a5dd8);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 89d4497..25d9647 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 _0xa17c=['post','addAgents','put','delete','destroy','/:id/teams','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueue.controller','get','isAuthenticated','/describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','create','addTeams'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xa17c,0x17d));var _0xca17=function(_0x10aebb,_0x2fd10a){_0x10aebb=_0x10aebb-0x0;var _0x1b1b8f=_0xa17c[_0x10aebb];return _0x1b1b8f;};'use strict';var multer=require(_0xca17('0x0'));var util=require(_0xca17('0x1'));var path=require(_0xca17('0x2'));var timeout=require(_0xca17('0x3'));var express=require(_0xca17('0x4'));var router=express[_0xca17('0x5')]();var fs_extra=require(_0xca17('0x6'));var auth=require(_0xca17('0x7'));var interaction=require(_0xca17('0x8'));var config=require('../../config/environment');var controller=require(_0xca17('0x9'));router[_0xca17('0xa')]('/',auth[_0xca17('0xb')](),controller['index']);router[_0xca17('0xa')](_0xca17('0xc'),auth[_0xca17('0xb')](),controller['describe']);router['get'](_0xca17('0xd'),auth[_0xca17('0xb')](),controller[_0xca17('0xe')]);router['get'](_0xca17('0xf'),auth[_0xca17('0xb')](),controller[_0xca17('0x10')]);router[_0xca17('0xa')]('/:id/teams',auth['isAuthenticated'](),controller[_0xca17('0x11')]);router[_0xca17('0xa')](_0xca17('0x12'),auth[_0xca17('0xb')](),controller[_0xca17('0x13')]);router['post']('/',auth[_0xca17('0xb')](),controller[_0xca17('0x14')]);router['post']('/:id/teams',auth['isAuthenticated'](),controller[_0xca17('0x15')]);router[_0xca17('0x16')](_0xca17('0x12'),auth[_0xca17('0xb')](),controller[_0xca17('0x17')]);router[_0xca17('0x18')](_0xca17('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xca17('0x19')](_0xca17('0xd'),auth[_0xca17('0xb')](),controller[_0xca17('0x1a')]);router[_0xca17('0x19')](_0xca17('0x1b'),auth[_0xca17('0xb')](),controller[_0xca17('0x1c')]);router[_0xca17('0x19')](_0xca17('0x12'),auth['isAuthenticated'](),controller[_0xca17('0x1d')]);module[_0xca17('0x1e')]=router; \ No newline at end of file +var _0xca89=['getAgents','post','addTeams','put','update','delete','destroy','removeAgents','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./openchannelQueue.controller','get','isAuthenticated','/:id','/:id/members','/:id/teams','getTeams','/:id/users'];(function(_0x568496,_0x565afd){var _0x26c5c1=function(_0x4d251e){while(--_0x4d251e){_0x568496['push'](_0x568496['shift']());}};_0x26c5c1(++_0x565afd);}(_0xca89,0x179));var _0x9ca8=function(_0x5bdf93,_0x538f25){_0x5bdf93=_0x5bdf93-0x0;var _0x33356d=_0xca89[_0x5bdf93];return _0x33356d;};'use strict';var multer=require('multer');var util=require(_0x9ca8('0x0'));var path=require('path');var timeout=require(_0x9ca8('0x1'));var express=require(_0x9ca8('0x2'));var router=express[_0x9ca8('0x3')]();var fs_extra=require(_0x9ca8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9ca8('0x5'));var config=require('../../config/environment');var controller=require(_0x9ca8('0x6'));router[_0x9ca8('0x7')]('/',auth[_0x9ca8('0x8')](),controller['index']);router[_0x9ca8('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x9ca8('0x9'),auth[_0x9ca8('0x8')](),controller['show']);router['get'](_0x9ca8('0xa'),auth[_0x9ca8('0x8')](),controller['getMembers']);router[_0x9ca8('0x7')](_0x9ca8('0xb'),auth['isAuthenticated'](),controller[_0x9ca8('0xc')]);router[_0x9ca8('0x7')](_0x9ca8('0xd'),auth[_0x9ca8('0x8')](),controller[_0x9ca8('0xe')]);router[_0x9ca8('0xf')]('/',auth[_0x9ca8('0x8')](),controller['create']);router[_0x9ca8('0xf')]('/:id/teams',auth[_0x9ca8('0x8')](),controller[_0x9ca8('0x10')]);router[_0x9ca8('0xf')](_0x9ca8('0xd'),auth['isAuthenticated'](),controller['addAgents']);router[_0x9ca8('0x11')](_0x9ca8('0x9'),auth[_0x9ca8('0x8')](),controller[_0x9ca8('0x12')]);router[_0x9ca8('0x13')](_0x9ca8('0x9'),auth[_0x9ca8('0x8')](),controller[_0x9ca8('0x14')]);router[_0x9ca8('0x13')](_0x9ca8('0xb'),auth[_0x9ca8('0x8')](),controller['removeTeams']);router['delete'](_0x9ca8('0xd'),auth[_0x9ca8('0x8')](),controller[_0x9ca8('0x15')]);module[_0x9ca8('0x16')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index cebda0e..c1ef1aa 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 _0xb458=['INTEGER','ENUM','rrmemory','exports','STRING'];(function(_0x5a9666,_0x30bc94){var _0x28601f=function(_0x52e447){while(--_0x52e447){_0x5a9666['push'](_0x5a9666['shift']());}};_0x28601f(++_0x30bc94);}(_0xb458,0x1de));var _0x8b45=function(_0x26a945,_0x39f54f){_0x26a945=_0x26a945-0x0;var _0x5a65f2=_0xb458[_0x26a945];return _0x5a65f2;};'use strict';var Sequelize=require('sequelize');module[_0x8b45('0x0')]={'name':{'type':Sequelize[_0x8b45('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8b45('0x1')]},'timeout':{'type':Sequelize[_0x8b45('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8b45('0x3')](_0x8b45('0x4'),'beepall','roundrobin')}}; \ No newline at end of file +var _0x18ed=['STRING','name','INTEGER','ENUM','beepall','roundrobin','sequelize'];(function(_0x1121b1,_0x4e40f2){var _0x5bf648=function(_0x1d3b12){while(--_0x1d3b12){_0x1121b1['push'](_0x1121b1['shift']());}};_0x5bf648(++_0x4e40f2);}(_0x18ed,0x99));var _0xd18e=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x18ed[_0x334841];return _0x5beb4b;};'use strict';var Sequelize=require(_0xd18e('0x0'));module['exports']={'name':{'type':Sequelize[_0xd18e('0x1')],'unique':_0xd18e('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd18e('0x1')]},'timeout':{'type':Sequelize[_0xd18e('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd18e('0x4')]('rrmemory',_0xd18e('0x5'),_0xd18e('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 28afb4d..688bdb7 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 _0xcf59=['spread','removeAgents','isArray','order','getAgents','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','save','then','get','OpenchannelQueues','UserProfileResource','destroy','error','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','OpenchannelQueue','includeAll','findAll','catch','params','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','update','describe','getMembers','UserOpenchannelQueue','OpenchannelQueueId','User','UserId','agent','openchannelPause','createdAt','rows','format','%s/%s','SIP','updatedAt','getTeams','findOne','Team','addTeams','ids','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','emit','userOpenchannelQueue:save','select','field','tq.TeamId','team_has_openchannel_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','Agents','clone','ut.UserId\x20=\x20?','push','SELECT','every','TeamId','all','union','compact','value','isEmpty','userOpenchannelQueue:remove','addAgents','omit'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xcf59,0x1b3));var _0x9cf5=function(_0x4c0abe,_0x4647a2){_0x4c0abe=_0x4c0abe-0x0;var _0x5dbe93=_0xcf59[_0x4c0abe];return _0x5dbe93;};'use strict';var emlformat=require(_0x9cf5('0x0'));var rimraf=require(_0x9cf5('0x1'));var zipdir=require(_0x9cf5('0x2'));var jsonpatch=require(_0x9cf5('0x3'));var rp=require(_0x9cf5('0x4'));var moment=require(_0x9cf5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9cf5('0x6'));var util=require('util');var path=require('path');var sox=require(_0x9cf5('0x7'));var csv=require(_0x9cf5('0x8'));var ejs=require(_0x9cf5('0x9'));var fs=require('fs');var fs_extra=require(_0x9cf5('0xa'));var _=require(_0x9cf5('0xb'));var squel=require('squel');var crypto=require(_0x9cf5('0xc'));var jsforce=require(_0x9cf5('0xd'));var deskjs=require(_0x9cf5('0xe'));var toCsv=require(_0x9cf5('0x8'));var querystring=require(_0x9cf5('0xf'));var Papa=require(_0x9cf5('0x10'));var Redis=require('ioredis');var authService=require(_0x9cf5('0x11'));var qs=require(_0x9cf5('0x12'));var as=require(_0x9cf5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9cf5('0x14'))('api');var utils=require(_0x9cf5('0x15'));var config=require(_0x9cf5('0x16'));var licenseUtil=require(_0x9cf5('0x17'));var db=require(_0x9cf5('0x18'))['db'];config[_0x9cf5('0x19')]=_[_0x9cf5('0x1a')](config['redis'],{'host':_0x9cf5('0x1b'),'port':0x18eb});var socket=require(_0x9cf5('0x1c'))(new Redis(config[_0x9cf5('0x19')]));require(_0x9cf5('0x1d'))[_0x9cf5('0x1e')](socket);function respondWithStatusCode(_0x4c72f5,_0x26ec36){_0x26ec36=_0x26ec36||0xcc;return function(_0x5b46fd){if(_0x5b46fd){return _0x4c72f5[_0x9cf5('0x1f')](_0x26ec36);}return _0x4c72f5[_0x9cf5('0x20')](_0x26ec36)[_0x9cf5('0x21')]();};}function respondWithResult(_0x404e1c,_0x442a99){_0x442a99=_0x442a99||0xc8;return function(_0x10fa95){if(_0x10fa95){return _0x404e1c[_0x9cf5('0x20')](_0x442a99)['json'](_0x10fa95);}};}function respondWithFilteredResult(_0xee1320,_0x1f404d){return function(_0x3daecc){if(_0x3daecc){var _0xe4e96b=typeof _0x1f404d[_0x9cf5('0x22')]===_0x9cf5('0x23')&&typeof _0x1f404d['limit']===_0x9cf5('0x23');var _0x4aa84f=_0x3daecc[_0x9cf5('0x24')];var _0x49addd=_0xe4e96b?0x0:_0x1f404d[_0x9cf5('0x22')];var _0x7962a8=_0xe4e96b?_0x3daecc[_0x9cf5('0x24')]:_0x1f404d[_0x9cf5('0x22')]+_0x1f404d[_0x9cf5('0x25')];var _0x386b6d;if(_0x7962a8>=_0x4aa84f){_0x7962a8=_0x4aa84f;_0x386b6d=0xc8;}else{_0x386b6d=0xce;}_0xee1320[_0x9cf5('0x20')](_0x386b6d);return _0xee1320[_0x9cf5('0x26')](_0x9cf5('0x27'),_0x49addd+'-'+_0x7962a8+'/'+_0x4aa84f)[_0x9cf5('0x28')](_0x3daecc);}return null;};}function patchUpdates(_0x317c55){return function(_0x664eae){try{jsonpatch['apply'](_0x664eae,_0x317c55,!![]);}catch(_0x753902){return BPromise[_0x9cf5('0x29')](_0x753902);}return _0x664eae[_0x9cf5('0x2a')]();};}function saveUpdates(_0x44b8fa,_0x4c34ee){return function(_0x185cf1){if(_0x185cf1){return _0x185cf1['update'](_0x44b8fa)[_0x9cf5('0x2b')](function(_0x553e6a){return _0x553e6a;});}return null;};}function removeEntity(_0x20f787,_0x5112f9){return function(_0x4e109c){if(_0x4e109c){return _0x4e109c['destroy']()['then'](function(){var _0x3f41e1=_0x4e109c[_0x9cf5('0x2c')]({'plain':!![]});var _0x3a996e=_0x9cf5('0x2d');return db[_0x9cf5('0x2e')][_0x9cf5('0x2f')]({'where':{'type':_0x3a996e,'resourceId':_0x3f41e1['id']}})[_0x9cf5('0x2b')](function(){return _0x4e109c;});})['then'](function(){_0x20f787[_0x9cf5('0x20')](0xcc)[_0x9cf5('0x21')]();});}};}function handleEntityNotFound(_0x5181c1,_0x319f7f){return function(_0x2b5a6d){if(!_0x2b5a6d){_0x5181c1[_0x9cf5('0x1f')](0x194);}return _0x2b5a6d;};}function handleError(_0x3389ee,_0x459f54){_0x459f54=_0x459f54||0x1f4;return function(_0xa42ff4){logger[_0x9cf5('0x30')](_0xa42ff4['stack']);if(_0xa42ff4[_0x9cf5('0x31')]){delete _0xa42ff4[_0x9cf5('0x31')];}_0x3389ee[_0x9cf5('0x20')](_0x459f54)['send'](_0xa42ff4);};}exports[_0x9cf5('0x32')]=function(_0x5e5b05,_0x4b5641){var _0x3486dd={},_0x6dc633={},_0x402640={'count':0x0,'rows':[]};var _0x1f7a4d=_[_0x9cf5('0x33')](db['OpenchannelQueue'][_0x9cf5('0x34')],function(_0x465112){return{'name':_0x465112[_0x9cf5('0x35')],'type':_0x465112[_0x9cf5('0x36')][_0x9cf5('0x37')]};});_0x6dc633[_0x9cf5('0x38')]=_[_0x9cf5('0x33')](_0x1f7a4d,_0x9cf5('0x31'));_0x6dc633[_0x9cf5('0x39')]=_[_0x9cf5('0x3a')](_0x5e5b05[_0x9cf5('0x39')]);_0x6dc633[_0x9cf5('0x3b')]=_[_0x9cf5('0x3c')](_0x6dc633[_0x9cf5('0x38')],_0x6dc633[_0x9cf5('0x39')]);_0x3486dd[_0x9cf5('0x3d')]=_[_0x9cf5('0x3c')](_0x6dc633[_0x9cf5('0x38')],qs[_0x9cf5('0x3e')](_0x5e5b05['query']['fields']));_0x3486dd[_0x9cf5('0x3d')]=_0x3486dd[_0x9cf5('0x3d')][_0x9cf5('0x3f')]?_0x3486dd[_0x9cf5('0x3d')]:_0x6dc633[_0x9cf5('0x38')];if(!_0x5e5b05['query'][_0x9cf5('0x40')]('nolimit')){_0x3486dd[_0x9cf5('0x25')]=qs['limit'](_0x5e5b05[_0x9cf5('0x39')][_0x9cf5('0x25')]);_0x3486dd[_0x9cf5('0x22')]=qs[_0x9cf5('0x22')](_0x5e5b05[_0x9cf5('0x39')][_0x9cf5('0x22')]);}_0x3486dd['order']=qs['sort'](_0x5e5b05['query'][_0x9cf5('0x41')]);_0x3486dd[_0x9cf5('0x42')]=qs[_0x9cf5('0x3b')](_[_0x9cf5('0x43')](_0x5e5b05['query'],_0x6dc633[_0x9cf5('0x3b')]),_0x1f7a4d);if(_0x5e5b05[_0x9cf5('0x39')][_0x9cf5('0x44')]){_0x3486dd['where']=_[_0x9cf5('0x45')](_0x3486dd[_0x9cf5('0x42')],{'$or':_[_0x9cf5('0x33')](_0x1f7a4d,function(_0x46b660){if(_0x46b660['type']!==_0x9cf5('0x46')){var _0x5f4934={};_0x5f4934[_0x46b660[_0x9cf5('0x31')]]={'$like':'%'+_0x5e5b05[_0x9cf5('0x39')][_0x9cf5('0x44')]+'%'};return _0x5f4934;}})});}_0x3486dd=_[_0x9cf5('0x45')]({},_0x3486dd,_0x5e5b05[_0x9cf5('0x47')]);var _0x310250={'where':_0x3486dd[_0x9cf5('0x42')]};return db[_0x9cf5('0x48')][_0x9cf5('0x24')](_0x310250)[_0x9cf5('0x2b')](function(_0x5542e3){_0x402640[_0x9cf5('0x24')]=_0x5542e3;if(_0x5e5b05['query'][_0x9cf5('0x49')]){_0x3486dd['include']=[{'all':!![]}];}return db[_0x9cf5('0x48')][_0x9cf5('0x4a')](_0x3486dd);})[_0x9cf5('0x2b')](function(_0x9b11e1){_0x402640['rows']=_0x9b11e1;return _0x402640;})[_0x9cf5('0x2b')](respondWithFilteredResult(_0x4b5641,_0x3486dd))[_0x9cf5('0x4b')](handleError(_0x4b5641,null));};exports['show']=function(_0x1c8680,_0x589689){var _0x4a4c9c={'raw':!![],'where':{'id':_0x1c8680[_0x9cf5('0x4c')]['id']}},_0xf231ea={};_0xf231ea[_0x9cf5('0x38')]=_[_0x9cf5('0x3a')](db['OpenchannelQueue'][_0x9cf5('0x34')]);_0xf231ea[_0x9cf5('0x39')]=_[_0x9cf5('0x3a')](_0x1c8680[_0x9cf5('0x39')]);_0xf231ea[_0x9cf5('0x3b')]=_[_0x9cf5('0x3c')](_0xf231ea['model'],_0xf231ea[_0x9cf5('0x39')]);_0x4a4c9c[_0x9cf5('0x3d')]=_[_0x9cf5('0x3c')](_0xf231ea[_0x9cf5('0x38')],qs['fields'](_0x1c8680[_0x9cf5('0x39')][_0x9cf5('0x3e')]));_0x4a4c9c[_0x9cf5('0x3d')]=_0x4a4c9c[_0x9cf5('0x3d')]['length']?_0x4a4c9c[_0x9cf5('0x3d')]:_0xf231ea[_0x9cf5('0x38')];if(_0x1c8680[_0x9cf5('0x39')][_0x9cf5('0x49')]){_0x4a4c9c[_0x9cf5('0x4d')]=[{'all':!![]}];}_0x4a4c9c=_[_0x9cf5('0x45')]({},_0x4a4c9c,_0x1c8680['options']);return db[_0x9cf5('0x48')]['find'](_0x4a4c9c)[_0x9cf5('0x2b')](handleEntityNotFound(_0x589689,null))[_0x9cf5('0x2b')](respondWithResult(_0x589689,null))[_0x9cf5('0x4b')](handleError(_0x589689,null));};exports[_0x9cf5('0x4e')]=function(_0x4f2ead,_0x4c0bd4){return db[_0x9cf5('0x48')][_0x9cf5('0x4e')](_0x4f2ead[_0x9cf5('0x4f')],{})[_0x9cf5('0x2b')](function(_0x1a86b5){var _0x28c59c=_0x4f2ead[_0x9cf5('0x50')][_0x9cf5('0x2c')]({'plain':!![]});if(!_0x28c59c)throw new Error(_0x9cf5('0x51'));if(_0x28c59c['role']===_0x9cf5('0x50')){var _0x3656e2=_0x1a86b5[_0x9cf5('0x2c')]({'plain':!![]});var _0xf72b32='OpenchannelQueues';return db[_0x9cf5('0x52')][_0x9cf5('0x53')]({'where':{'name':_0xf72b32,'userProfileId':_0x28c59c['userProfileId']},'raw':!![]})['then'](function(_0xdbc075){if(_0xdbc075&&_0xdbc075[_0x9cf5('0x54')]===0x0){return db[_0x9cf5('0x2e')]['create']({'name':_0x3656e2[_0x9cf5('0x31')],'resourceId':_0x3656e2['id'],'type':_0xdbc075[_0x9cf5('0x31')],'sectionId':_0xdbc075['id']},{})[_0x9cf5('0x2b')](function(){return _0x1a86b5;});}else{return _0x1a86b5;}})[_0x9cf5('0x4b')](function(_0x5a76c1){logger[_0x9cf5('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a76c1);throw _0x5a76c1;});}return _0x1a86b5;})['then'](respondWithResult(_0x4c0bd4,0xc9))[_0x9cf5('0x4b')](handleError(_0x4c0bd4,null));};exports[_0x9cf5('0x55')]=function(_0x37da6d,_0x38d263){if(_0x37da6d['body']['id']){delete _0x37da6d[_0x9cf5('0x4f')]['id'];}return db[_0x9cf5('0x48')][_0x9cf5('0x53')]({'where':{'id':_0x37da6d[_0x9cf5('0x4c')]['id']}})[_0x9cf5('0x2b')](handleEntityNotFound(_0x38d263,null))[_0x9cf5('0x2b')](saveUpdates(_0x37da6d['body'],null))[_0x9cf5('0x2b')](respondWithResult(_0x38d263,null))['catch'](handleError(_0x38d263,null));};exports[_0x9cf5('0x2f')]=function(_0x50d7f1,_0x418e4c){return db[_0x9cf5('0x48')][_0x9cf5('0x53')]({'where':{'id':_0x50d7f1['params']['id']}})[_0x9cf5('0x2b')](handleEntityNotFound(_0x418e4c,null))['then'](removeEntity(_0x418e4c,null))[_0x9cf5('0x4b')](handleError(_0x418e4c,null));};exports[_0x9cf5('0x56')]=function(_0x5fd191,_0x50b86a){return db[_0x9cf5('0x48')][_0x9cf5('0x56')]()[_0x9cf5('0x2b')](respondWithResult(_0x50b86a,null))['catch'](handleError(_0x50b86a,null));};exports[_0x9cf5('0x57')]=function(_0x20637e,_0x3e3b81,_0x30b91d){var _0x3e1e8d={'raw':!![],'where':{}},_0x15f200={},_0xa0d2be;return db[_0x9cf5('0x48')]['findOne']({'where':{'id':_0x20637e[_0x9cf5('0x4c')]['id']}})[_0x9cf5('0x2b')](handleEntityNotFound(_0x3e3b81,null))[_0x9cf5('0x2b')](function(_0x1dae8b){if(_0x1dae8b){_0xa0d2be=_0x1dae8b[_0x9cf5('0x2c')]({'plain':!![]});_0x15f200['model']=_[_0x9cf5('0x3a')](db[_0x9cf5('0x58')]['rawAttributes']);_0x15f200[_0x9cf5('0x39')]=_[_0x9cf5('0x3a')](_0x20637e[_0x9cf5('0x39')]);_0x15f200[_0x9cf5('0x3b')]=_['intersection'](_0x15f200[_0x9cf5('0x38')],_0x15f200['query']);_0x3e1e8d['attributes']=_[_0x9cf5('0x3c')](_0x15f200[_0x9cf5('0x38')],qs['fields'](_0x20637e[_0x9cf5('0x39')]['fields']));_0x3e1e8d[_0x9cf5('0x3d')]=_0x3e1e8d[_0x9cf5('0x3d')][_0x9cf5('0x3f')]?_0x3e1e8d[_0x9cf5('0x3d')]:_0x15f200['model'];if(!_0x20637e[_0x9cf5('0x39')][_0x9cf5('0x40')]('nolimit')){_0x3e1e8d[_0x9cf5('0x25')]=qs['limit'](_0x20637e['query'][_0x9cf5('0x25')]);_0x3e1e8d[_0x9cf5('0x22')]=qs[_0x9cf5('0x22')](_0x20637e['query'][_0x9cf5('0x22')]);}_0x3e1e8d['order']=qs[_0x9cf5('0x41')](_0x20637e['query'][_0x9cf5('0x41')]);_0x3e1e8d['where']=qs[_0x9cf5('0x3b')](_['pick'](_0x20637e[_0x9cf5('0x39')],_0x15f200[_0x9cf5('0x3b')]));_0x3e1e8d[_0x9cf5('0x42')][_0x9cf5('0x59')]=_0x1dae8b['id'];if(_0x20637e[_0x9cf5('0x39')][_0x9cf5('0x44')]){_0x3e1e8d[_0x9cf5('0x42')]=_[_0x9cf5('0x45')](_0x3e1e8d[_0x9cf5('0x42')],{'$or':_[_0x9cf5('0x33')](_0x3e1e8d['attributes'],function(_0x1383d1){var _0x514583={};_0x514583[_0x1383d1]={'$like':'%'+_0x20637e['query'][_0x9cf5('0x44')]+'%'};return _0x514583;})});}_0x3e1e8d=_[_0x9cf5('0x45')]({},_0x3e1e8d,_0x20637e['options']);return db[_0x9cf5('0x58')][_0x9cf5('0x4a')](_0x3e1e8d);}})[_0x9cf5('0x2b')](function(_0x34e167){if(_0x34e167){return db[_0x9cf5('0x5a')]['findAndCountAll']({'where':{'id':_[_0x9cf5('0x33')](_0x34e167,_0x9cf5('0x5b')),'role':_0x9cf5('0x5c')},'attributes':['id',_0x9cf5('0x31'),_0x9cf5('0x5d'),'updatedAt',_0x9cf5('0x5e')]});}})[_0x9cf5('0x2b')](function(_0x2e50e0){if(_0x2e50e0){return{'count':_0x2e50e0[_0x9cf5('0x24')],'rows':_[_0x9cf5('0x33')](_0x2e50e0[_0x9cf5('0x5f')],function(_0x35c2b9){return{'membername':_0x35c2b9[_0x9cf5('0x31')],'UserId':_0x35c2b9['id'],'queue_name':_0xa0d2be[_0x9cf5('0x31')],'OpenchannelQueueId':_0xa0d2be['id'],'interface':util[_0x9cf5('0x60')](_0x9cf5('0x61'),_0x9cf5('0x62'),_0x35c2b9['name']),'penalty':0x0,'paused':_0x35c2b9['openchannelPause'],'createdAt':_0x35c2b9['createdAt'],'updatedAt':_0x35c2b9[_0x9cf5('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9cf5('0x2b')](respondWithFilteredResult(_0x3e3b81,_0x3e1e8d))[_0x9cf5('0x4b')](handleError(_0x3e3b81,null));};exports[_0x9cf5('0x64')]=function(_0x61b51d,_0x1f8817,_0x912cf9){var _0x29da90={};var _0x1b1f79={};var _0x65181d;var _0x56113e;return db[_0x9cf5('0x48')][_0x9cf5('0x65')]({'where':{'id':_0x61b51d['params']['id']}})[_0x9cf5('0x2b')](handleEntityNotFound(_0x1f8817,null))['then'](function(_0x31fe07){if(_0x31fe07){_0x65181d=_0x31fe07;_0x1b1f79[_0x9cf5('0x38')]=_['keys'](db[_0x9cf5('0x66')][_0x9cf5('0x34')]);_0x1b1f79[_0x9cf5('0x39')]=_[_0x9cf5('0x3a')](_0x61b51d[_0x9cf5('0x39')]);_0x1b1f79[_0x9cf5('0x3b')]=_[_0x9cf5('0x3c')](_0x1b1f79['model'],_0x1b1f79[_0x9cf5('0x39')]);_0x29da90['attributes']=_[_0x9cf5('0x3c')](_0x1b1f79[_0x9cf5('0x38')],qs[_0x9cf5('0x3e')](_0x61b51d[_0x9cf5('0x39')][_0x9cf5('0x3e')]));_0x29da90['attributes']=_0x29da90[_0x9cf5('0x3d')][_0x9cf5('0x3f')]?_0x29da90[_0x9cf5('0x3d')]:_0x1b1f79[_0x9cf5('0x38')];_0x29da90['order']=qs[_0x9cf5('0x41')](_0x61b51d[_0x9cf5('0x39')][_0x9cf5('0x41')]);_0x29da90['where']=qs['filters'](_[_0x9cf5('0x43')](_0x61b51d[_0x9cf5('0x39')],_0x1b1f79[_0x9cf5('0x3b')]));if(_0x61b51d[_0x9cf5('0x39')][_0x9cf5('0x44')]){_0x29da90[_0x9cf5('0x42')]=_['merge'](_0x29da90[_0x9cf5('0x42')],{'$or':_['map'](_0x29da90[_0x9cf5('0x3d')],function(_0x3c0612){var _0x29e965={};_0x29e965[_0x3c0612]={'$like':'%'+_0x61b51d['query'][_0x9cf5('0x44')]+'%'};return _0x29e965;})});}_0x29da90=_[_0x9cf5('0x45')]({},_0x29da90,_0x61b51d[_0x9cf5('0x47')]);return _0x65181d[_0x9cf5('0x64')](_0x29da90);}})[_0x9cf5('0x2b')](function(_0x2c26bf){if(_0x2c26bf){_0x56113e=_0x2c26bf['length'];if(!_0x61b51d[_0x9cf5('0x39')]['hasOwnProperty']('nolimit')){_0x29da90[_0x9cf5('0x25')]=qs[_0x9cf5('0x25')](_0x61b51d[_0x9cf5('0x39')][_0x9cf5('0x25')]);_0x29da90['offset']=qs[_0x9cf5('0x22')](_0x61b51d[_0x9cf5('0x39')]['offset']);}return _0x65181d[_0x9cf5('0x64')](_0x29da90);}})[_0x9cf5('0x2b')](function(_0x3be407){if(_0x3be407){return _0x3be407?{'count':_0x56113e,'rows':_0x3be407}:null;}})[_0x9cf5('0x2b')](respondWithResult(_0x1f8817,null))['catch'](handleError(_0x1f8817,null));};exports[_0x9cf5('0x67')]=function(_0x4409b0,_0x31e526,_0x5c62ea){var _0x73489d=_0x4409b0['body'][_0x9cf5('0x68')];return db[_0x9cf5('0x66')][_0x9cf5('0x4a')]({'where':{'id':_0x73489d},'attributes':['id'],'include':[{'model':db[_0x9cf5('0x5a')],'as':'Agents','attributes':['id',_0x9cf5('0x31'),_0x9cf5('0x69'),_0x9cf5('0x6a'),_0x9cf5('0x6b')],'raw':!![]}]})[_0x9cf5('0x2b')](function(_0x3b00de){if(_0x3b00de){var _0xdeb027=_[_0x9cf5('0x6c')](_0x3b00de,function(_0x13b402){var _0x38a37a=_0x13b402[_0x9cf5('0x2c')]({'plain':!![]});return _0x38a37a['Agents'];});return db['OpenchannelQueue'][_0x9cf5('0x53')]({'where':{'id':_0x4409b0[_0x9cf5('0x4c')]['id']}})[_0x9cf5('0x2b')](function(_0x4ce2f8){return db[_0x9cf5('0x6d')][_0x9cf5('0x6e')](function(_0x2a90d0){return _0x4ce2f8['addTeams'](_0x73489d,{'transaction':_0x2a90d0})[_0x9cf5('0x2b')](function(){return BPromise[_0x9cf5('0x6f')](_0xdeb027,function(_0x1b55a2){return db['UserOpenchannelQueue'][_0x9cf5('0x70')]({'where':{'UserId':_0x1b55a2['id'],'OpenchannelQueueId':_0x4409b0['params']['id']},'transaction':_0x2a90d0});});})['then'](function(){_0xdeb027['forEach'](function(_0x2dc0c9){socket[_0x9cf5('0x71')](_0x9cf5('0x72'),{'UserId':_0x2dc0c9['id'],'OpenchannelQueueId':_0x4ce2f8['id']});});});});});}})[_0x9cf5('0x2b')](respondWithStatusCode(_0x31e526,null))['catch'](handleError(_0x31e526,null));};exports['removeTeams']=function(_0x1fb37f,_0x2c0287,_0x15f526){return db[_0x9cf5('0x66')][_0x9cf5('0x4a')]({'where':{'id':_0x1fb37f[_0x9cf5('0x39')][_0x9cf5('0x68')]},'attributes':['id'],'include':[{'model':db[_0x9cf5('0x5a')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x9cf5('0x2b')](handleEntityNotFound(_0x2c0287,null))[_0x9cf5('0x2b')](function(_0x28d696){var _0x293d31=_[_0x9cf5('0x33')](_0x28d696,'id');var _0x59cd0e=[];var _0x3d26cd=[];var _0x7e5e25=squel[_0x9cf5('0x73')]();_0x7e5e25[_0x9cf5('0x74')](_0x9cf5('0x75'))['from'](_0x9cf5('0x76'),'tq')['join'](_0x9cf5('0x77'),'ut',_0x9cf5('0x78'))[_0x9cf5('0x42')](_0x9cf5('0x79'),_0x1fb37f[_0x9cf5('0x4c')]['id']);for(var _0x162bf4=0x0;_0x162bf4<_0x28d696['length'];_0x162bf4+=0x1){let _0x3cd1f0=_0x28d696[_0x162bf4];for(var _0xc8af5e=0x0;_0xc8af5e<_0x3cd1f0['Agents']['length'];_0xc8af5e+=0x1){let _0x346ff8=_0x3cd1f0[_0x9cf5('0x7a')][_0xc8af5e];var _0x236582=_0x7e5e25[_0x9cf5('0x7b')]();_0x236582['where'](_0x9cf5('0x7c'),_0x346ff8['id']);_0x3d26cd[_0x9cf5('0x7d')](db['sequelize'][_0x9cf5('0x39')](_0x236582['toString'](),{'type':db[_0x9cf5('0x6d')]['QueryTypes'][_0x9cf5('0x7e')]})['then'](function(_0x357d23){if(_0x357d23[_0x9cf5('0x3f')]===0x1){return _0x346ff8['id'];}else{var _0x343835=_[_0x9cf5('0x7f')](_[_0x9cf5('0x33')](_0x357d23,_0x9cf5('0x80')),function(_0x122008){return _['includes'](_0x293d31,_0x122008);});if(_0x343835){return _0x346ff8['id'];}}}));}}return BPromise[_0x9cf5('0x81')](_0x3d26cd)['then'](function(_0x39cc6e){_0x59cd0e=_(_0x59cd0e)[_0x9cf5('0x82')](_0x39cc6e)[_0x9cf5('0x83')]()[_0x9cf5('0x84')]();return db[_0x9cf5('0x48')]['find']({'where':{'id':_0x1fb37f[_0x9cf5('0x4c')]['id']}})['then'](function(_0x2460c3){return db[_0x9cf5('0x6d')][_0x9cf5('0x6e')](function(_0x11ece4){return _0x2460c3['removeTeams'](_0x1fb37f[_0x9cf5('0x39')][_0x9cf5('0x68')],{'transaction':_0x11ece4})['then'](function(){if(!_[_0x9cf5('0x85')](_0x59cd0e)){return _0x2460c3['removeAgents'](_0x59cd0e,{'transaction':_0x11ece4});}})[_0x9cf5('0x2b')](function(){_0x59cd0e['forEach'](function(_0x3bcd8d){socket['emit'](_0x9cf5('0x86'),{'UserId':_0x3bcd8d,'OpenchannelQueueId':_0x2460c3['id']});});});});});});})[_0x9cf5('0x2b')](respondWithStatusCode(_0x2c0287,null))[_0x9cf5('0x4b')](handleError(_0x2c0287,null));};exports[_0x9cf5('0x87')]=function(_0x53cbaa,_0x2e787d,_0x230286){return db[_0x9cf5('0x48')]['find']({'where':{'id':_0x53cbaa['params']['id']}})[_0x9cf5('0x2b')](handleEntityNotFound(_0x2e787d,null))[_0x9cf5('0x2b')](function(_0x5882e4){if(_0x5882e4){return _0x5882e4[_0x9cf5('0x87')](_0x53cbaa['body'][_0x9cf5('0x68')],_[_0x9cf5('0x88')](_0x53cbaa[_0x9cf5('0x4f')],['ids','id'])||{})[_0x9cf5('0x89')](function(_0x53da78){for(var _0x104cfc=0x0;_0x104cfc<_0x53cbaa[_0x9cf5('0x4f')]['ids'][_0x9cf5('0x3f')];_0x104cfc+=0x1){socket[_0x9cf5('0x71')](_0x9cf5('0x72'),{'UserId':Number(_0x53cbaa[_0x9cf5('0x4f')][_0x9cf5('0x68')][_0x104cfc]),'OpenchannelQueueId':Number(_0x53cbaa[_0x9cf5('0x4c')]['id'])});}return _0x53da78;});}})['then'](respondWithResult(_0x2e787d,null))[_0x9cf5('0x4b')](handleError(_0x2e787d,null));};exports[_0x9cf5('0x8a')]=function(_0x847279,_0x5cf205,_0x2610e3){return db[_0x9cf5('0x48')]['find']({'where':{'id':_0x847279[_0x9cf5('0x4c')]['id']}})[_0x9cf5('0x2b')](handleEntityNotFound(_0x5cf205,null))['then'](function(_0x4af359){if(_0x4af359){return _0x4af359['removeAgents'](_0x847279[_0x9cf5('0x39')][_0x9cf5('0x68')])[_0x9cf5('0x2b')](function(){if(_[_0x9cf5('0x8b')](_0x847279[_0x9cf5('0x39')][_0x9cf5('0x68')])){for(var _0x4d75f4=0x0;_0x4d75f4<_0x847279['query'][_0x9cf5('0x68')]['length'];_0x4d75f4+=0x1){socket[_0x9cf5('0x71')]('userOpenchannelQueue:remove',{'UserId':Number(_0x847279['query']['ids'][_0x4d75f4]),'OpenchannelQueueId':Number(_0x847279[_0x9cf5('0x4c')]['id'])});}}else{socket[_0x9cf5('0x71')](_0x9cf5('0x86'),{'UserId':Number(_0x847279[_0x9cf5('0x39')]['ids']),'OpenchannelQueueId':Number(_0x847279[_0x9cf5('0x4c')]['id'])});}});}})[_0x9cf5('0x2b')](respondWithStatusCode(_0x5cf205,null))['catch'](handleError(_0x5cf205,null));};exports['getAgents']=function(_0xf972b6,_0x2cf0ef,_0x43174e){var _0x204285={};var _0x114044={};var _0x697db5;var _0x14a4da;return db['OpenchannelQueue'][_0x9cf5('0x65')]({'where':{'id':_0xf972b6[_0x9cf5('0x4c')]['id']}})[_0x9cf5('0x2b')](handleEntityNotFound(_0x2cf0ef,null))[_0x9cf5('0x2b')](function(_0x4a0367){if(_0x4a0367){_0x697db5=_0x4a0367;_0x114044['model']=_[_0x9cf5('0x3a')](db[_0x9cf5('0x5a')]['rawAttributes']);_0x114044[_0x9cf5('0x39')]=_[_0x9cf5('0x3a')](_0xf972b6[_0x9cf5('0x39')]);_0x114044[_0x9cf5('0x3b')]=_[_0x9cf5('0x3c')](_0x114044[_0x9cf5('0x38')],_0x114044[_0x9cf5('0x39')]);_0x204285[_0x9cf5('0x3d')]=_['intersection'](_0x114044['model'],qs['fields'](_0xf972b6['query'][_0x9cf5('0x3e')]));_0x204285['attributes']=_0x204285[_0x9cf5('0x3d')][_0x9cf5('0x3f')]?_0x204285[_0x9cf5('0x3d')]:_0x114044[_0x9cf5('0x38')];_0x204285[_0x9cf5('0x8c')]=qs['sort'](_0xf972b6[_0x9cf5('0x39')][_0x9cf5('0x41')]);_0x204285['where']=qs['filters'](_['pick'](_0xf972b6[_0x9cf5('0x39')],_0x114044[_0x9cf5('0x3b')]));if(_0xf972b6[_0x9cf5('0x39')][_0x9cf5('0x44')]){_0x204285[_0x9cf5('0x42')]=_['merge'](_0x204285[_0x9cf5('0x42')],{'$or':_[_0x9cf5('0x33')](_0x204285[_0x9cf5('0x3d')],function(_0x48249f){var _0x31a994={};_0x31a994[_0x48249f]={'$like':'%'+_0xf972b6[_0x9cf5('0x39')][_0x9cf5('0x44')]+'%'};return _0x31a994;})});}_0x204285=_[_0x9cf5('0x45')]({},_0x204285,_0xf972b6[_0x9cf5('0x47')]);return _0x697db5[_0x9cf5('0x8d')](_0x204285);}})[_0x9cf5('0x2b')](function(_0xdd3164){if(_0xdd3164){_0x14a4da=_0xdd3164[_0x9cf5('0x3f')];if(!_0xf972b6[_0x9cf5('0x39')][_0x9cf5('0x40')](_0x9cf5('0x8e'))){_0x204285[_0x9cf5('0x25')]=qs['limit'](_0xf972b6[_0x9cf5('0x39')][_0x9cf5('0x25')]);_0x204285[_0x9cf5('0x22')]=qs[_0x9cf5('0x22')](_0xf972b6['query'][_0x9cf5('0x22')]);}return _0x697db5[_0x9cf5('0x8d')](_0x204285);}})[_0x9cf5('0x2b')](function(_0x516d40){if(_0x516d40){return _0x516d40?{'count':_0x14a4da,'rows':_0x516d40}:null;}})[_0x9cf5('0x2b')](respondWithResult(_0x2cf0ef,null))[_0x9cf5('0x4b')](handleError(_0x2cf0ef,null));}; \ No newline at end of file +var _0xe62e=['apply','reject','then','get','OpenchannelQueues','UserProfileResource','destroy','end','name','send','map','OpenchannelQueue','rawAttributes','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','length','nolimit','order','OpenchannelQueueId','UserOpenchannelQueue','findAll','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','openchannelPause','getTeams','Team','addTeams','Agents','online','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','ids','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','QueryTypes','SELECT','every','TeamId','all','compact','value','isEmpty','userOpenchannelQueue:remove','spread','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','sendStatus','status','json','limit','undefined','count','offset','set'];(function(_0x252d74,_0x293166){var _0x488444=function(_0x137a8c){while(--_0x137a8c){_0x252d74['push'](_0x252d74['shift']());}};_0x488444(++_0x293166);}(_0xe62e,0xf5));var _0xee62=function(_0x922ec6,_0x3e0347){_0x922ec6=_0x922ec6-0x0;var _0xa629b3=_0xe62e[_0x922ec6];return _0xa629b3;};'use strict';var emlformat=require(_0xee62('0x0'));var rimraf=require(_0xee62('0x1'));var zipdir=require(_0xee62('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xee62('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xee62('0x4'));var util=require(_0xee62('0x5'));var path=require(_0xee62('0x6'));var sox=require(_0xee62('0x7'));var csv=require('to-csv');var ejs=require(_0xee62('0x8'));var fs=require('fs');var fs_extra=require(_0xee62('0x9'));var _=require('lodash');var squel=require(_0xee62('0xa'));var crypto=require(_0xee62('0xb'));var jsforce=require(_0xee62('0xc'));var deskjs=require(_0xee62('0xd'));var toCsv=require(_0xee62('0xe'));var querystring=require(_0xee62('0xf'));var Papa=require(_0xee62('0x10'));var Redis=require(_0xee62('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xee62('0x12'));var as=require(_0xee62('0x13'));var hardwareService=require(_0xee62('0x14'));var logger=require(_0xee62('0x15'))(_0xee62('0x16'));var utils=require(_0xee62('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xee62('0x18'));var db=require(_0xee62('0x19'))['db'];config[_0xee62('0x1a')]=_[_0xee62('0x1b')](config['redis'],{'host':_0xee62('0x1c'),'port':0x18eb});var socket=require(_0xee62('0x1d'))(new Redis(config['redis']));require(_0xee62('0x1e'))['register'](socket);function respondWithStatusCode(_0x3b7ad5,_0x28ba7d){_0x28ba7d=_0x28ba7d||0xcc;return function(_0x3dbece){if(_0x3dbece){return _0x3b7ad5[_0xee62('0x1f')](_0x28ba7d);}return _0x3b7ad5[_0xee62('0x20')](_0x28ba7d)['end']();};}function respondWithResult(_0xea3a32,_0x29be94){_0x29be94=_0x29be94||0xc8;return function(_0x10e47d){if(_0x10e47d){return _0xea3a32[_0xee62('0x20')](_0x29be94)[_0xee62('0x21')](_0x10e47d);}};}function respondWithFilteredResult(_0x352778,_0x1b161e){return function(_0x37f1e1){if(_0x37f1e1){var _0x4d7ab4=typeof _0x1b161e['offset']==='undefined'&&typeof _0x1b161e[_0xee62('0x22')]===_0xee62('0x23');var _0x173c36=_0x37f1e1[_0xee62('0x24')];var _0x5addfa=_0x4d7ab4?0x0:_0x1b161e[_0xee62('0x25')];var _0x290ab2=_0x4d7ab4?_0x37f1e1[_0xee62('0x24')]:_0x1b161e[_0xee62('0x25')]+_0x1b161e['limit'];var _0x2b082e;if(_0x290ab2>=_0x173c36){_0x290ab2=_0x173c36;_0x2b082e=0xc8;}else{_0x2b082e=0xce;}_0x352778[_0xee62('0x20')](_0x2b082e);return _0x352778[_0xee62('0x26')]('Content-Range',_0x5addfa+'-'+_0x290ab2+'/'+_0x173c36)[_0xee62('0x21')](_0x37f1e1);}return null;};}function patchUpdates(_0x2db3b3){return function(_0x8ca0b0){try{jsonpatch[_0xee62('0x27')](_0x8ca0b0,_0x2db3b3,!![]);}catch(_0x5930de){return BPromise[_0xee62('0x28')](_0x5930de);}return _0x8ca0b0['save']();};}function saveUpdates(_0x1a5c0a,_0x46527f){return function(_0x3ad7e4){if(_0x3ad7e4){return _0x3ad7e4['update'](_0x1a5c0a)[_0xee62('0x29')](function(_0x5bd928){return _0x5bd928;});}return null;};}function removeEntity(_0xdf5c2c,_0x35b9d0){return function(_0x4fe0d7){if(_0x4fe0d7){return _0x4fe0d7['destroy']()[_0xee62('0x29')](function(){var _0x1d8471=_0x4fe0d7[_0xee62('0x2a')]({'plain':!![]});var _0x512a7a=_0xee62('0x2b');return db[_0xee62('0x2c')][_0xee62('0x2d')]({'where':{'type':_0x512a7a,'resourceId':_0x1d8471['id']}})['then'](function(){return _0x4fe0d7;});})[_0xee62('0x29')](function(){_0xdf5c2c['status'](0xcc)[_0xee62('0x2e')]();});}};}function handleEntityNotFound(_0x2f44f6,_0x413b0f){return function(_0x4efd92){if(!_0x4efd92){_0x2f44f6[_0xee62('0x1f')](0x194);}return _0x4efd92;};}function handleError(_0x1452e7,_0x28534f){_0x28534f=_0x28534f||0x1f4;return function(_0x3e0b3a){logger['error'](_0x3e0b3a['stack']);if(_0x3e0b3a[_0xee62('0x2f')]){delete _0x3e0b3a[_0xee62('0x2f')];}_0x1452e7[_0xee62('0x20')](_0x28534f)[_0xee62('0x30')](_0x3e0b3a);};}exports['index']=function(_0x42ce4a,_0x25e344){var _0x1bbe66={},_0x31aca3={},_0x1217ad={'count':0x0,'rows':[]};var _0x15d8ac=_[_0xee62('0x31')](db[_0xee62('0x32')][_0xee62('0x33')],function(_0x11fac7){return{'name':_0x11fac7['fieldName'],'type':_0x11fac7['type'][_0xee62('0x34')]};});_0x31aca3['model']=_['map'](_0x15d8ac,_0xee62('0x2f'));_0x31aca3[_0xee62('0x35')]=_[_0xee62('0x36')](_0x42ce4a['query']);_0x31aca3[_0xee62('0x37')]=_[_0xee62('0x38')](_0x31aca3[_0xee62('0x39')],_0x31aca3['query']);_0x1bbe66['attributes']=_[_0xee62('0x38')](_0x31aca3['model'],qs[_0xee62('0x3a')](_0x42ce4a[_0xee62('0x35')][_0xee62('0x3a')]));_0x1bbe66[_0xee62('0x3b')]=_0x1bbe66[_0xee62('0x3b')]['length']?_0x1bbe66['attributes']:_0x31aca3['model'];if(!_0x42ce4a[_0xee62('0x35')][_0xee62('0x3c')]('nolimit')){_0x1bbe66[_0xee62('0x22')]=qs[_0xee62('0x22')](_0x42ce4a[_0xee62('0x35')][_0xee62('0x22')]);_0x1bbe66[_0xee62('0x25')]=qs[_0xee62('0x25')](_0x42ce4a[_0xee62('0x35')][_0xee62('0x25')]);}_0x1bbe66['order']=qs[_0xee62('0x3d')](_0x42ce4a[_0xee62('0x35')][_0xee62('0x3d')]);_0x1bbe66[_0xee62('0x3e')]=qs[_0xee62('0x37')](_[_0xee62('0x3f')](_0x42ce4a[_0xee62('0x35')],_0x31aca3[_0xee62('0x37')]),_0x15d8ac);if(_0x42ce4a[_0xee62('0x35')]['filter']){_0x1bbe66[_0xee62('0x3e')]=_[_0xee62('0x40')](_0x1bbe66[_0xee62('0x3e')],{'$or':_[_0xee62('0x31')](_0x15d8ac,function(_0x550181){if(_0x550181[_0xee62('0x41')]!==_0xee62('0x42')){var _0x5e3cce={};_0x5e3cce[_0x550181[_0xee62('0x2f')]]={'$like':'%'+_0x42ce4a[_0xee62('0x35')][_0xee62('0x43')]+'%'};return _0x5e3cce;}})});}_0x1bbe66=_[_0xee62('0x40')]({},_0x1bbe66,_0x42ce4a[_0xee62('0x44')]);var _0x566f57={'where':_0x1bbe66[_0xee62('0x3e')]};return db[_0xee62('0x32')]['count'](_0x566f57)['then'](function(_0x2c614e){_0x1217ad['count']=_0x2c614e;if(_0x42ce4a[_0xee62('0x35')][_0xee62('0x45')]){_0x1bbe66[_0xee62('0x46')]=[{'all':!![]}];}return db[_0xee62('0x32')]['findAll'](_0x1bbe66);})[_0xee62('0x29')](function(_0x1186c4){_0x1217ad[_0xee62('0x47')]=_0x1186c4;return _0x1217ad;})[_0xee62('0x29')](respondWithFilteredResult(_0x25e344,_0x1bbe66))[_0xee62('0x48')](handleError(_0x25e344,null));};exports[_0xee62('0x49')]=function(_0x59d07c,_0x28707a){var _0x338faa={'raw':!![],'where':{'id':_0x59d07c[_0xee62('0x4a')]['id']}},_0x1407eb={};_0x1407eb[_0xee62('0x39')]=_[_0xee62('0x36')](db[_0xee62('0x32')][_0xee62('0x33')]);_0x1407eb[_0xee62('0x35')]=_[_0xee62('0x36')](_0x59d07c['query']);_0x1407eb[_0xee62('0x37')]=_['intersection'](_0x1407eb['model'],_0x1407eb[_0xee62('0x35')]);_0x338faa[_0xee62('0x3b')]=_[_0xee62('0x38')](_0x1407eb['model'],qs[_0xee62('0x3a')](_0x59d07c[_0xee62('0x35')][_0xee62('0x3a')]));_0x338faa[_0xee62('0x3b')]=_0x338faa[_0xee62('0x3b')]['length']?_0x338faa[_0xee62('0x3b')]:_0x1407eb[_0xee62('0x39')];if(_0x59d07c[_0xee62('0x35')][_0xee62('0x45')]){_0x338faa[_0xee62('0x46')]=[{'all':!![]}];}_0x338faa=_[_0xee62('0x40')]({},_0x338faa,_0x59d07c[_0xee62('0x44')]);return db[_0xee62('0x32')][_0xee62('0x4b')](_0x338faa)[_0xee62('0x29')](handleEntityNotFound(_0x28707a,null))[_0xee62('0x29')](respondWithResult(_0x28707a,null))[_0xee62('0x48')](handleError(_0x28707a,null));};exports[_0xee62('0x4c')]=function(_0x19d4c2,_0xd4a21c){return db[_0xee62('0x32')][_0xee62('0x4c')](_0x19d4c2[_0xee62('0x4d')],{})[_0xee62('0x29')](function(_0x281f4c){var _0xe0766=_0x19d4c2['user']['get']({'plain':!![]});if(!_0xe0766)throw new Error(_0xee62('0x4e'));if(_0xe0766[_0xee62('0x4f')]===_0xee62('0x50')){var _0x3d8ded=_0x281f4c[_0xee62('0x2a')]({'plain':!![]});var _0x375d3d=_0xee62('0x2b');return db[_0xee62('0x51')][_0xee62('0x4b')]({'where':{'name':_0x375d3d,'userProfileId':_0xe0766[_0xee62('0x52')]},'raw':!![]})[_0xee62('0x29')](function(_0xc268a){if(_0xc268a&&_0xc268a[_0xee62('0x53')]===0x0){return db[_0xee62('0x2c')][_0xee62('0x4c')]({'name':_0x3d8ded[_0xee62('0x2f')],'resourceId':_0x3d8ded['id'],'type':_0xc268a[_0xee62('0x2f')],'sectionId':_0xc268a['id']},{})[_0xee62('0x29')](function(){return _0x281f4c;});}else{return _0x281f4c;}})['catch'](function(_0x5bb10c){logger[_0xee62('0x54')](_0xee62('0x55'),_0x5bb10c);throw _0x5bb10c;});}return _0x281f4c;})[_0xee62('0x29')](respondWithResult(_0xd4a21c,0xc9))[_0xee62('0x48')](handleError(_0xd4a21c,null));};exports['update']=function(_0x4bb9b9,_0x174bd3){if(_0x4bb9b9[_0xee62('0x4d')]['id']){delete _0x4bb9b9[_0xee62('0x4d')]['id'];}return db[_0xee62('0x32')][_0xee62('0x4b')]({'where':{'id':_0x4bb9b9[_0xee62('0x4a')]['id']}})[_0xee62('0x29')](handleEntityNotFound(_0x174bd3,null))[_0xee62('0x29')](saveUpdates(_0x4bb9b9['body'],null))[_0xee62('0x29')](respondWithResult(_0x174bd3,null))[_0xee62('0x48')](handleError(_0x174bd3,null));};exports[_0xee62('0x2d')]=function(_0x5c8ada,_0x342493){return db[_0xee62('0x32')]['find']({'where':{'id':_0x5c8ada[_0xee62('0x4a')]['id']}})['then'](handleEntityNotFound(_0x342493,null))[_0xee62('0x29')](removeEntity(_0x342493,null))[_0xee62('0x48')](handleError(_0x342493,null));};exports[_0xee62('0x56')]=function(_0x98d81a,_0x5a8c41){return db['OpenchannelQueue']['describe']()[_0xee62('0x29')](respondWithResult(_0x5a8c41,null))[_0xee62('0x48')](handleError(_0x5a8c41,null));};exports[_0xee62('0x57')]=function(_0xd0fabe,_0x63fb87,_0x40cb53){var _0x5a61bd={'raw':!![],'where':{}},_0x2e8944={},_0x3bc239;return db[_0xee62('0x32')][_0xee62('0x58')]({'where':{'id':_0xd0fabe[_0xee62('0x4a')]['id']}})['then'](handleEntityNotFound(_0x63fb87,null))[_0xee62('0x29')](function(_0xef65af){if(_0xef65af){_0x3bc239=_0xef65af['get']({'plain':!![]});_0x2e8944[_0xee62('0x39')]=_['keys'](db['UserOpenchannelQueue'][_0xee62('0x33')]);_0x2e8944[_0xee62('0x35')]=_['keys'](_0xd0fabe[_0xee62('0x35')]);_0x2e8944[_0xee62('0x37')]=_[_0xee62('0x38')](_0x2e8944[_0xee62('0x39')],_0x2e8944[_0xee62('0x35')]);_0x5a61bd['attributes']=_[_0xee62('0x38')](_0x2e8944[_0xee62('0x39')],qs[_0xee62('0x3a')](_0xd0fabe[_0xee62('0x35')][_0xee62('0x3a')]));_0x5a61bd[_0xee62('0x3b')]=_0x5a61bd[_0xee62('0x3b')][_0xee62('0x59')]?_0x5a61bd[_0xee62('0x3b')]:_0x2e8944[_0xee62('0x39')];if(!_0xd0fabe[_0xee62('0x35')][_0xee62('0x3c')](_0xee62('0x5a'))){_0x5a61bd[_0xee62('0x22')]=qs[_0xee62('0x22')](_0xd0fabe[_0xee62('0x35')][_0xee62('0x22')]);_0x5a61bd[_0xee62('0x25')]=qs['offset'](_0xd0fabe[_0xee62('0x35')][_0xee62('0x25')]);}_0x5a61bd[_0xee62('0x5b')]=qs[_0xee62('0x3d')](_0xd0fabe[_0xee62('0x35')][_0xee62('0x3d')]);_0x5a61bd[_0xee62('0x3e')]=qs[_0xee62('0x37')](_[_0xee62('0x3f')](_0xd0fabe[_0xee62('0x35')],_0x2e8944[_0xee62('0x37')]));_0x5a61bd[_0xee62('0x3e')][_0xee62('0x5c')]=_0xef65af['id'];if(_0xd0fabe[_0xee62('0x35')]['filter']){_0x5a61bd[_0xee62('0x3e')]=_[_0xee62('0x40')](_0x5a61bd[_0xee62('0x3e')],{'$or':_[_0xee62('0x31')](_0x5a61bd['attributes'],function(_0x272f8a){var _0x39f630={};_0x39f630[_0x272f8a]={'$like':'%'+_0xd0fabe[_0xee62('0x35')]['filter']+'%'};return _0x39f630;})});}_0x5a61bd=_[_0xee62('0x40')]({},_0x5a61bd,_0xd0fabe[_0xee62('0x44')]);return db[_0xee62('0x5d')][_0xee62('0x5e')](_0x5a61bd);}})['then'](function(_0x2f3bd4){if(_0x2f3bd4){return db[_0xee62('0x5f')][_0xee62('0x60')]({'where':{'id':_[_0xee62('0x31')](_0x2f3bd4,_0xee62('0x61')),'role':_0xee62('0x62')},'attributes':['id',_0xee62('0x2f'),'openchannelPause',_0xee62('0x63'),_0xee62('0x64')]});}})[_0xee62('0x29')](function(_0x342d91){if(_0x342d91){return{'count':_0x342d91[_0xee62('0x24')],'rows':_[_0xee62('0x31')](_0x342d91[_0xee62('0x47')],function(_0xd0b8de){return{'membername':_0xd0b8de['name'],'UserId':_0xd0b8de['id'],'queue_name':_0x3bc239[_0xee62('0x2f')],'OpenchannelQueueId':_0x3bc239['id'],'interface':util[_0xee62('0x65')](_0xee62('0x66'),_0xee62('0x67'),_0xd0b8de[_0xee62('0x2f')]),'penalty':0x0,'paused':_0xd0b8de[_0xee62('0x68')],'createdAt':_0xd0b8de[_0xee62('0x64')],'updatedAt':_0xd0b8de[_0xee62('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x63fb87,_0x5a61bd))[_0xee62('0x48')](handleError(_0x63fb87,null));};exports[_0xee62('0x69')]=function(_0x16d5cc,_0x2a9cc0,_0x3be147){var _0x4bdd4f={};var _0x18bbbc={};var _0x294e11;var _0x5cf3ef;return db[_0xee62('0x32')][_0xee62('0x58')]({'where':{'id':_0x16d5cc[_0xee62('0x4a')]['id']}})[_0xee62('0x29')](handleEntityNotFound(_0x2a9cc0,null))[_0xee62('0x29')](function(_0x154702){if(_0x154702){_0x294e11=_0x154702;_0x18bbbc[_0xee62('0x39')]=_['keys'](db[_0xee62('0x6a')][_0xee62('0x33')]);_0x18bbbc[_0xee62('0x35')]=_['keys'](_0x16d5cc['query']);_0x18bbbc[_0xee62('0x37')]=_[_0xee62('0x38')](_0x18bbbc['model'],_0x18bbbc[_0xee62('0x35')]);_0x4bdd4f[_0xee62('0x3b')]=_[_0xee62('0x38')](_0x18bbbc['model'],qs[_0xee62('0x3a')](_0x16d5cc[_0xee62('0x35')][_0xee62('0x3a')]));_0x4bdd4f['attributes']=_0x4bdd4f[_0xee62('0x3b')]['length']?_0x4bdd4f['attributes']:_0x18bbbc[_0xee62('0x39')];_0x4bdd4f['order']=qs['sort'](_0x16d5cc[_0xee62('0x35')][_0xee62('0x3d')]);_0x4bdd4f[_0xee62('0x3e')]=qs[_0xee62('0x37')](_['pick'](_0x16d5cc[_0xee62('0x35')],_0x18bbbc[_0xee62('0x37')]));if(_0x16d5cc[_0xee62('0x35')]['filter']){_0x4bdd4f['where']=_['merge'](_0x4bdd4f['where'],{'$or':_[_0xee62('0x31')](_0x4bdd4f['attributes'],function(_0x45f05c){var _0x33eb84={};_0x33eb84[_0x45f05c]={'$like':'%'+_0x16d5cc[_0xee62('0x35')][_0xee62('0x43')]+'%'};return _0x33eb84;})});}_0x4bdd4f=_[_0xee62('0x40')]({},_0x4bdd4f,_0x16d5cc[_0xee62('0x44')]);return _0x294e11[_0xee62('0x69')](_0x4bdd4f);}})[_0xee62('0x29')](function(_0x233afe){if(_0x233afe){_0x5cf3ef=_0x233afe[_0xee62('0x59')];if(!_0x16d5cc['query'][_0xee62('0x3c')](_0xee62('0x5a'))){_0x4bdd4f['limit']=qs[_0xee62('0x22')](_0x16d5cc['query'][_0xee62('0x22')]);_0x4bdd4f[_0xee62('0x25')]=qs[_0xee62('0x25')](_0x16d5cc[_0xee62('0x35')][_0xee62('0x25')]);}return _0x294e11[_0xee62('0x69')](_0x4bdd4f);}})['then'](function(_0x4fddac){if(_0x4fddac){return _0x4fddac?{'count':_0x5cf3ef,'rows':_0x4fddac}:null;}})[_0xee62('0x29')](respondWithResult(_0x2a9cc0,null))[_0xee62('0x48')](handleError(_0x2a9cc0,null));};exports[_0xee62('0x6b')]=function(_0x189b32,_0x1171d9,_0x42c23b){var _0x9f579f=_0x189b32[_0xee62('0x4d')]['ids'];return db[_0xee62('0x6a')][_0xee62('0x5e')]({'where':{'id':_0x9f579f},'attributes':['id'],'include':[{'model':db[_0xee62('0x5f')],'as':_0xee62('0x6c'),'attributes':['id',_0xee62('0x2f'),_0xee62('0x6d'),_0xee62('0x6e'),_0xee62('0x6f')],'raw':!![]}]})[_0xee62('0x29')](function(_0x471655){if(_0x471655){var _0x491c5d=_['flatMap'](_0x471655,function(_0x302d5c){var _0x1516a3=_0x302d5c[_0xee62('0x2a')]({'plain':!![]});return _0x1516a3[_0xee62('0x6c')];});return db[_0xee62('0x32')]['find']({'where':{'id':_0x189b32[_0xee62('0x4a')]['id']}})['then'](function(_0xea3d9d){return db[_0xee62('0x70')][_0xee62('0x71')](function(_0x13e8a8){return _0xea3d9d[_0xee62('0x6b')](_0x9f579f,{'transaction':_0x13e8a8})[_0xee62('0x29')](function(){return BPromise[_0xee62('0x72')](_0x491c5d,function(_0x10bc45){return db[_0xee62('0x5d')][_0xee62('0x73')]({'where':{'UserId':_0x10bc45['id'],'OpenchannelQueueId':_0x189b32[_0xee62('0x4a')]['id']},'transaction':_0x13e8a8});});})[_0xee62('0x29')](function(){_0x491c5d[_0xee62('0x74')](function(_0x208019){socket[_0xee62('0x75')](_0xee62('0x76'),{'UserId':_0x208019['id'],'OpenchannelQueueId':_0xea3d9d['id']});});});});});}})[_0xee62('0x29')](respondWithStatusCode(_0x1171d9,null))[_0xee62('0x48')](handleError(_0x1171d9,null));};exports[_0xee62('0x77')]=function(_0x4c1c6a,_0x431210,_0x1f2210){return db[_0xee62('0x6a')][_0xee62('0x5e')]({'where':{'id':_0x4c1c6a[_0xee62('0x35')][_0xee62('0x78')]},'attributes':['id'],'include':[{'model':db[_0xee62('0x5f')],'as':_0xee62('0x6c'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x431210,null))[_0xee62('0x29')](function(_0xc74776){var _0x1167d0=_[_0xee62('0x31')](_0xc74776,'id');var _0xbe40da=[];var _0x885273=[];var _0x4fe27e=squel[_0xee62('0x79')]();_0x4fe27e[_0xee62('0x7a')](_0xee62('0x7b'))[_0xee62('0x7c')]('team_has_openchannel_queues','tq')[_0xee62('0x7d')](_0xee62('0x7e'),'ut',_0xee62('0x7f'))[_0xee62('0x3e')](_0xee62('0x80'),_0x4c1c6a[_0xee62('0x4a')]['id']);for(var _0x3e35f4=0x0;_0x3e35f4<_0xc74776['length'];_0x3e35f4+=0x1){let _0x3b1618=_0xc74776[_0x3e35f4];for(var _0x12849d=0x0;_0x12849d<_0x3b1618['Agents'][_0xee62('0x59')];_0x12849d+=0x1){let _0x26ab05=_0x3b1618[_0xee62('0x6c')][_0x12849d];var _0x1cae7e=_0x4fe27e['clone']();_0x1cae7e['where']('ut.UserId\x20=\x20?',_0x26ab05['id']);_0x885273['push'](db[_0xee62('0x70')][_0xee62('0x35')](_0x1cae7e['toString'](),{'type':db[_0xee62('0x70')][_0xee62('0x81')][_0xee62('0x82')]})['then'](function(_0x5b77cb){if(_0x5b77cb[_0xee62('0x59')]===0x1){return _0x26ab05['id'];}else{var _0x14749a=_[_0xee62('0x83')](_[_0xee62('0x31')](_0x5b77cb,_0xee62('0x84')),function(_0x973802){return _['includes'](_0x1167d0,_0x973802);});if(_0x14749a){return _0x26ab05['id'];}}}));}}return BPromise[_0xee62('0x85')](_0x885273)[_0xee62('0x29')](function(_0x560909){_0xbe40da=_(_0xbe40da)['union'](_0x560909)[_0xee62('0x86')]()[_0xee62('0x87')]();return db[_0xee62('0x32')][_0xee62('0x4b')]({'where':{'id':_0x4c1c6a[_0xee62('0x4a')]['id']}})[_0xee62('0x29')](function(_0x5e152d){return db[_0xee62('0x70')][_0xee62('0x71')](function(_0x142f83){return _0x5e152d[_0xee62('0x77')](_0x4c1c6a[_0xee62('0x35')][_0xee62('0x78')],{'transaction':_0x142f83})[_0xee62('0x29')](function(){if(!_[_0xee62('0x88')](_0xbe40da)){return _0x5e152d['removeAgents'](_0xbe40da,{'transaction':_0x142f83});}})[_0xee62('0x29')](function(){_0xbe40da[_0xee62('0x74')](function(_0x222b8d){socket[_0xee62('0x75')](_0xee62('0x89'),{'UserId':_0x222b8d,'OpenchannelQueueId':_0x5e152d['id']});});});});});});})['then'](respondWithStatusCode(_0x431210,null))[_0xee62('0x48')](handleError(_0x431210,null));};exports['addAgents']=function(_0x32efa9,_0x5b7dd6,_0x3e32ce){return db[_0xee62('0x32')][_0xee62('0x4b')]({'where':{'id':_0x32efa9[_0xee62('0x4a')]['id']}})[_0xee62('0x29')](handleEntityNotFound(_0x5b7dd6,null))[_0xee62('0x29')](function(_0x472d9){if(_0x472d9){return _0x472d9['addAgents'](_0x32efa9[_0xee62('0x4d')][_0xee62('0x78')],_['omit'](_0x32efa9['body'],[_0xee62('0x78'),'id'])||{})[_0xee62('0x8a')](function(_0x1190da){for(var _0x224d0a=0x0;_0x224d0a<_0x32efa9[_0xee62('0x4d')]['ids'][_0xee62('0x59')];_0x224d0a+=0x1){socket[_0xee62('0x75')](_0xee62('0x76'),{'UserId':Number(_0x32efa9['body'][_0xee62('0x78')][_0x224d0a]),'OpenchannelQueueId':Number(_0x32efa9['params']['id'])});}return _0x1190da;});}})[_0xee62('0x29')](respondWithResult(_0x5b7dd6,null))[_0xee62('0x48')](handleError(_0x5b7dd6,null));};exports[_0xee62('0x8b')]=function(_0x45c074,_0x46e4b7,_0xa0dcf4){return db[_0xee62('0x32')][_0xee62('0x4b')]({'where':{'id':_0x45c074[_0xee62('0x4a')]['id']}})[_0xee62('0x29')](handleEntityNotFound(_0x46e4b7,null))['then'](function(_0x198c7b){if(_0x198c7b){return _0x198c7b['removeAgents'](_0x45c074[_0xee62('0x35')]['ids'])[_0xee62('0x29')](function(){if(_[_0xee62('0x8c')](_0x45c074[_0xee62('0x35')][_0xee62('0x78')])){for(var _0xb34ae9=0x0;_0xb34ae9<_0x45c074['query'][_0xee62('0x78')][_0xee62('0x59')];_0xb34ae9+=0x1){socket[_0xee62('0x75')](_0xee62('0x89'),{'UserId':Number(_0x45c074[_0xee62('0x35')][_0xee62('0x78')][_0xb34ae9]),'OpenchannelQueueId':Number(_0x45c074[_0xee62('0x4a')]['id'])});}}else{socket[_0xee62('0x75')](_0xee62('0x89'),{'UserId':Number(_0x45c074[_0xee62('0x35')][_0xee62('0x78')]),'OpenchannelQueueId':Number(_0x45c074[_0xee62('0x4a')]['id'])});}});}})['then'](respondWithStatusCode(_0x46e4b7,null))[_0xee62('0x48')](handleError(_0x46e4b7,null));};exports[_0xee62('0x8d')]=function(_0x121774,_0x1f7801,_0x56d977){var _0x5c6a46={};var _0x319f29={};var _0x308c72;var _0xa68ba7;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x121774[_0xee62('0x4a')]['id']}})[_0xee62('0x29')](handleEntityNotFound(_0x1f7801,null))[_0xee62('0x29')](function(_0x3c2db8){if(_0x3c2db8){_0x308c72=_0x3c2db8;_0x319f29[_0xee62('0x39')]=_[_0xee62('0x36')](db[_0xee62('0x5f')][_0xee62('0x33')]);_0x319f29['query']=_['keys'](_0x121774['query']);_0x319f29[_0xee62('0x37')]=_[_0xee62('0x38')](_0x319f29[_0xee62('0x39')],_0x319f29['query']);_0x5c6a46[_0xee62('0x3b')]=_[_0xee62('0x38')](_0x319f29[_0xee62('0x39')],qs['fields'](_0x121774['query'][_0xee62('0x3a')]));_0x5c6a46[_0xee62('0x3b')]=_0x5c6a46[_0xee62('0x3b')][_0xee62('0x59')]?_0x5c6a46[_0xee62('0x3b')]:_0x319f29[_0xee62('0x39')];_0x5c6a46[_0xee62('0x5b')]=qs[_0xee62('0x3d')](_0x121774[_0xee62('0x35')][_0xee62('0x3d')]);_0x5c6a46[_0xee62('0x3e')]=qs[_0xee62('0x37')](_[_0xee62('0x3f')](_0x121774[_0xee62('0x35')],_0x319f29[_0xee62('0x37')]));if(_0x121774[_0xee62('0x35')]['filter']){_0x5c6a46[_0xee62('0x3e')]=_[_0xee62('0x40')](_0x5c6a46[_0xee62('0x3e')],{'$or':_['map'](_0x5c6a46[_0xee62('0x3b')],function(_0xa361dc){var _0x47a47e={};_0x47a47e[_0xa361dc]={'$like':'%'+_0x121774[_0xee62('0x35')]['filter']+'%'};return _0x47a47e;})});}_0x5c6a46=_[_0xee62('0x40')]({},_0x5c6a46,_0x121774[_0xee62('0x44')]);return _0x308c72[_0xee62('0x8d')](_0x5c6a46);}})[_0xee62('0x29')](function(_0x41e2bf){if(_0x41e2bf){_0xa68ba7=_0x41e2bf[_0xee62('0x59')];if(!_0x121774[_0xee62('0x35')][_0xee62('0x3c')](_0xee62('0x5a'))){_0x5c6a46[_0xee62('0x22')]=qs['limit'](_0x121774['query'][_0xee62('0x22')]);_0x5c6a46[_0xee62('0x25')]=qs[_0xee62('0x25')](_0x121774[_0xee62('0x35')][_0xee62('0x25')]);}return _0x308c72[_0xee62('0x8d')](_0x5c6a46);}})[_0xee62('0x29')](function(_0x31454a){if(_0x31454a){return _0x31454a?{'count':_0xa68ba7,'rows':_0x31454a}:null;}})[_0xee62('0x29')](respondWithResult(_0x1f7801,null))[_0xee62('0x48')](handleError(_0x1f7801,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 49e5484..e81f7c4 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 _0x2623=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save'];(function(_0x361f02,_0x3f2561){var _0x22eb1b=function(_0x3eb860){while(--_0x3eb860){_0x361f02['push'](_0x361f02['shift']());}};_0x22eb1b(++_0x3f2561);}(_0x2623,0x73));var _0x3262=function(_0x20fdc1,_0xde1296){_0x20fdc1=_0x20fdc1-0x0;var _0x25397c=_0x2623[_0x20fdc1];return _0x25397c;};'use strict';var EventEmitter=require(_0x3262('0x0'));var OpenchannelQueue=require(_0x3262('0x1'))['db'][_0x3262('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x3262('0x3')](0x0);var events={'afterCreate':_0x3262('0x4'),'afterUpdate':_0x3262('0x5'),'afterDestroy':_0x3262('0x6')};function emitEvent(_0x302424){return function(_0x18586b,_0x43714e,_0x32d0e2){OpenchannelQueueEvents['emit'](_0x302424+':'+_0x18586b['id'],_0x18586b);OpenchannelQueueEvents[_0x3262('0x7')](_0x302424,_0x18586b);_0x32d0e2(null);};}for(var e in events){if(events[_0x3262('0x8')](e)){var event=events[e];OpenchannelQueue[_0x3262('0x9')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0xdd2b=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelQueue','update'];(function(_0x3df408,_0x508050){var _0x3f7af0=function(_0xe8ae57){while(--_0xe8ae57){_0x3df408['push'](_0x3df408['shift']());}};_0x3f7af0(++_0x508050);}(_0xdd2b,0x152));var _0xbdd2=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xdd2b[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0xbdd2('0x0'));var OpenchannelQueue=require(_0xbdd2('0x1'))['db'][_0xbdd2('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xbdd2('0x3'),'afterDestroy':_0xbdd2('0x4')};function emitEvent(_0x282060){return function(_0x12133e,_0x4ac713,_0x2cddd4){OpenchannelQueueEvents[_0xbdd2('0x5')](_0x282060+':'+_0x12133e['id'],_0x12133e);OpenchannelQueueEvents[_0xbdd2('0x5')](_0x282060,_0x12133e);_0x2cddd4(null);};}for(var e in events){if(events[_0xbdd2('0x6')](e)){var event=events[e];OpenchannelQueue[_0xbdd2('0x7')](e,emitEvent(event));}}module[_0xbdd2('0x8')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 1795771..4c6a8aa 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 _0xf468=['define','OpenchannelQueue','openchannel_queues','lodash','util','api','moment','bluebird','./openchannelQueue.attributes','exports'];(function(_0x24c62f,_0x78dfa6){var _0x4d84e8=function(_0x5cbd1c){while(--_0x5cbd1c){_0x24c62f['push'](_0x24c62f['shift']());}};_0x4d84e8(++_0x78dfa6);}(_0xf468,0xb7));var _0x8f46=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xf468[_0x47a7d0];return _0xb9bd08;};'use strict';var _=require(_0x8f46('0x0'));var util=require(_0x8f46('0x1'));var logger=require('../../config/logger')(_0x8f46('0x2'));var moment=require(_0x8f46('0x3'));var BPromise=require(_0x8f46('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8f46('0x5'));module[_0x8f46('0x6')]=function(_0x17fee2,_0x5217ff){return _0x17fee2[_0x8f46('0x7')](_0x8f46('0x8'),attributes,{'tableName':_0x8f46('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1b63=['../../config/environment','./openchannelQueue.attributes','exports','define','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2390bd,_0x212fbd){var _0x3a969d=function(_0x3dd049){while(--_0x3dd049){_0x2390bd['push'](_0x2390bd['shift']());}};_0x3a969d(++_0x212fbd);}(_0x1b63,0x19c));var _0x31b6=function(_0x2a276d,_0x482b0c){_0x2a276d=_0x2a276d-0x0;var _0x2914cd=_0x1b63[_0x2a276d];return _0x2914cd;};'use strict';var _=require('lodash');var util=require(_0x31b6('0x0'));var logger=require(_0x31b6('0x1'))(_0x31b6('0x2'));var moment=require(_0x31b6('0x3'));var BPromise=require(_0x31b6('0x4'));var rp=require(_0x31b6('0x5'));var fs=require('fs');var path=require(_0x31b6('0x6'));var rimraf=require(_0x31b6('0x7'));var config=require(_0x31b6('0x8'));var attributes=require(_0x31b6('0x9'));module[_0x31b6('0xa')]=function(_0x57b591,_0x535a3a){return _0x57b591[_0x31b6('0xb')]('OpenchannelQueue',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 d9cdcd8..7cfd935 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 _0x39a5=['include','model','map','then','find','ShowOpenchannelQueue','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueue,\x20%s,\x20%s','message','info','catch','GetOpenchannelQueue','OpenchannelQueue','options','raw','where','attributes','limit'];(function(_0x4c5a7a,_0x5c0fb7){var _0x344e75=function(_0x8d8b23){while(--_0x8d8b23){_0x4c5a7a['push'](_0x4c5a7a['shift']());}};_0x344e75(++_0x5c0fb7);}(_0x39a5,0x1da));var _0x539a=function(_0x3be4a0,_0x1777ee){_0x3be4a0=_0x3be4a0-0x0;var _0x3e966f=_0x39a5[_0x3be4a0];return _0x3e966f;};'use strict';var _=require(_0x539a('0x0'));var util=require(_0x539a('0x1'));var moment=require(_0x539a('0x2'));var BPromise=require(_0x539a('0x3'));var rs=require(_0x539a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x539a('0x5'))['db'];var utils=require(_0x539a('0x6'));var logger=require(_0x539a('0x7'))(_0x539a('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x539a('0x9')]['http']({'port':0x232a});config['redis']=_[_0x539a('0xa')](config['redis'],{'host':_0x539a('0xb'),'port':0x18eb});var socket=require(_0x539a('0xc'))(new Redis(config['redis']));require(_0x539a('0xd'))[_0x539a('0xe')](socket);function respondWithRpcPromise(_0x571ade,_0x12f4f9,_0x539705){return new BPromise(function(_0x377d69,_0x221828){return client[_0x539a('0xf')](_0x571ade,_0x539705)['then'](function(_0x19e0a4){logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x12f4f9,_0x539a('0x10'));logger[_0x539a('0x11')](_0x539a('0x12'),_0x12f4f9,'request\x20sent',JSON[_0x539a('0x13')](_0x19e0a4));if(_0x19e0a4['error']){if(_0x19e0a4[_0x539a('0x14')][_0x539a('0x15')]===0x1f4){logger[_0x539a('0x14')](_0x539a('0x16'),_0x12f4f9,_0x19e0a4[_0x539a('0x14')]['message']);return _0x221828(_0x19e0a4[_0x539a('0x14')]['message']);}logger[_0x539a('0x14')](_0x539a('0x16'),_0x12f4f9,_0x19e0a4[_0x539a('0x14')][_0x539a('0x17')]);return _0x377d69(_0x19e0a4[_0x539a('0x14')][_0x539a('0x17')]);}else{logger[_0x539a('0x18')]('OpenchannelQueue,\x20%s,\x20%s',_0x12f4f9,_0x539a('0x10'));_0x377d69(_0x19e0a4['result'][_0x539a('0x17')]);}})[_0x539a('0x19')](function(_0x4bccb1){logger[_0x539a('0x14')]('OpenchannelQueue,\x20%s,\x20%s',_0x12f4f9,_0x4bccb1);_0x221828(_0x4bccb1);});});}exports[_0x539a('0x1a')]=function(_0x10892e){var _0x43c7f8=this;return new Promise(function(_0xeb1c8c,_0x137a94){return db[_0x539a('0x1b')]['findAll']({'raw':_0x10892e[_0x539a('0x1c')]?_0x10892e['options'][_0x539a('0x1d')]===undefined?!![]:![]:!![],'where':_0x10892e[_0x539a('0x1c')]?_0x10892e[_0x539a('0x1c')][_0x539a('0x1e')]||null:null,'attributes':_0x10892e['options']?_0x10892e[_0x539a('0x1c')][_0x539a('0x1f')]||null:null,'limit':_0x10892e[_0x539a('0x1c')]?_0x10892e[_0x539a('0x1c')][_0x539a('0x20')]||null:null,'include':_0x10892e['options']?_0x10892e[_0x539a('0x1c')][_0x539a('0x21')]?_['map'](_0x10892e['options'][_0x539a('0x21')],function(_0x3ecb38){return{'model':db[_0x3ecb38[_0x539a('0x22')]],'as':_0x3ecb38['as'],'attributes':_0x3ecb38[_0x539a('0x1f')],'include':_0x3ecb38[_0x539a('0x21')]?_[_0x539a('0x23')](_0x3ecb38['include'],function(_0xe28da7){return{'model':db[_0xe28da7[_0x539a('0x22')]],'as':_0xe28da7['as'],'attributes':_0xe28da7['attributes'],'include':_0xe28da7[_0x539a('0x21')]?_['map'](_0xe28da7[_0x539a('0x21')],function(_0x9ef645){return{'model':db[_0x9ef645['model']],'as':_0x9ef645['as'],'attributes':_0x9ef645[_0x539a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x539a('0x24')](function(_0x2ce620){logger['info']('GetOpenchannelQueue',_0x10892e);logger[_0x539a('0x11')](_0x539a('0x1a'),_0x10892e,JSON[_0x539a('0x13')](_0x2ce620));_0xeb1c8c(_0x2ce620);})['catch'](function(_0x5056ea){logger['error'](_0x539a('0x1a'),_0x5056ea[_0x539a('0x17')],_0x10892e);_0x137a94(_0x43c7f8[_0x539a('0x14')](0x1f4,_0x5056ea['message']));});});};exports['ShowOpenchannelQueue']=function(_0x434972){var _0x2f2376=this;return new Promise(function(_0x31ac82,_0x5a0da8){return db['OpenchannelQueue'][_0x539a('0x25')]({'raw':_0x434972[_0x539a('0x1c')]?_0x434972['options'][_0x539a('0x1d')]===undefined?!![]:![]:!![],'where':_0x434972[_0x539a('0x1c')]?_0x434972[_0x539a('0x1c')][_0x539a('0x1e')]||null:null,'attributes':_0x434972[_0x539a('0x1c')]?_0x434972['options'][_0x539a('0x1f')]||null:null,'include':_0x434972[_0x539a('0x1c')]?_0x434972['options']['include']?_[_0x539a('0x23')](_0x434972[_0x539a('0x1c')]['include'],function(_0x509568){return{'model':db[_0x509568['model']],'as':_0x509568['as'],'attributes':_0x509568[_0x539a('0x1f')],'include':_0x509568[_0x539a('0x21')]?_['map'](_0x509568[_0x539a('0x21')],function(_0x44e3db){return{'model':db[_0x44e3db['model']],'as':_0x44e3db['as'],'attributes':_0x44e3db[_0x539a('0x1f')],'include':_0x44e3db['include']?_[_0x539a('0x23')](_0x44e3db[_0x539a('0x21')],function(_0x24b18c){return{'model':db[_0x24b18c[_0x539a('0x22')]],'as':_0x24b18c['as'],'attributes':_0x24b18c[_0x539a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x539a('0x24')](function(_0x44edd1){logger[_0x539a('0x18')](_0x539a('0x26'),_0x434972);logger['debug'](_0x539a('0x26'),_0x434972,JSON[_0x539a('0x13')](_0x44edd1));_0x31ac82(_0x44edd1);})[_0x539a('0x19')](function(_0x13df5a){logger['error'](_0x539a('0x26'),_0x13df5a[_0x539a('0x17')],_0x434972);_0x5a0da8(_0x2f2376['error'](0x1f4,_0x13df5a['message']));});});}; \ No newline at end of file +var _0x57db=['options','raw','where','include','attributes','model','map','catch','ShowOpenchannelQueue','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','register','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','GetOpenchannelQueue','OpenchannelQueue','findAll'];(function(_0x47d5e4,_0x5374fb){var _0x202190=function(_0x34a3a7){while(--_0x34a3a7){_0x47d5e4['push'](_0x47d5e4['shift']());}};_0x202190(++_0x5374fb);}(_0x57db,0x121));var _0xb57d=function(_0x46eca4,_0x4b166f){_0x46eca4=_0x46eca4-0x0;var _0x5c5e85=_0x57db[_0x46eca4];return _0x5c5e85;};'use strict';var _=require('lodash');var util=require(_0xb57d('0x0'));var moment=require('moment');var BPromise=require(_0xb57d('0x1'));var rs=require(_0xb57d('0x2'));var fs=require('fs');var Redis=require(_0xb57d('0x3'));var db=require(_0xb57d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb57d('0x5'))(_0xb57d('0x6'));var config=require(_0xb57d('0x7'));var jayson=require(_0xb57d('0x8'));var client=jayson[_0xb57d('0x9')][_0xb57d('0xa')]({'port':0x232a});config[_0xb57d('0xb')]=_['defaults'](config[_0xb57d('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xb57d('0xc'))(new Redis(config['redis']));require('./openchannelQueue.socket')[_0xb57d('0xd')](socket);function respondWithRpcPromise(_0x20d049,_0x5d2e85,_0xe4b4df){return new BPromise(function(_0x3d8e1a,_0x317902){return client['request'](_0x20d049,_0xe4b4df)[_0xb57d('0xe')](function(_0x8a00c5){logger[_0xb57d('0xf')](_0xb57d('0x10'),_0x5d2e85,_0xb57d('0x11'));logger[_0xb57d('0x12')](_0xb57d('0x13'),_0x5d2e85,_0xb57d('0x11'),JSON[_0xb57d('0x14')](_0x8a00c5));if(_0x8a00c5[_0xb57d('0x15')]){if(_0x8a00c5[_0xb57d('0x15')]['code']===0x1f4){logger[_0xb57d('0x15')](_0xb57d('0x10'),_0x5d2e85,_0x8a00c5[_0xb57d('0x15')]['message']);return _0x317902(_0x8a00c5['error'][_0xb57d('0x16')]);}logger['error'](_0xb57d('0x10'),_0x5d2e85,_0x8a00c5[_0xb57d('0x15')]['message']);return _0x3d8e1a(_0x8a00c5[_0xb57d('0x15')][_0xb57d('0x16')]);}else{logger[_0xb57d('0xf')](_0xb57d('0x10'),_0x5d2e85,_0xb57d('0x11'));_0x3d8e1a(_0x8a00c5['result']['message']);}})['catch'](function(_0x296840){logger['error'](_0xb57d('0x10'),_0x5d2e85,_0x296840);_0x317902(_0x296840);});});}exports[_0xb57d('0x17')]=function(_0x48b510){var _0x39d557=this;return new Promise(function(_0xb5c74b,_0x3b9097){return db[_0xb57d('0x18')][_0xb57d('0x19')]({'raw':_0x48b510[_0xb57d('0x1a')]?_0x48b510['options'][_0xb57d('0x1b')]===undefined?!![]:![]:!![],'where':_0x48b510[_0xb57d('0x1a')]?_0x48b510['options'][_0xb57d('0x1c')]||null:null,'attributes':_0x48b510['options']?_0x48b510[_0xb57d('0x1a')]['attributes']||null:null,'limit':_0x48b510[_0xb57d('0x1a')]?_0x48b510[_0xb57d('0x1a')]['limit']||null:null,'include':_0x48b510[_0xb57d('0x1a')]?_0x48b510[_0xb57d('0x1a')][_0xb57d('0x1d')]?_['map'](_0x48b510['options']['include'],function(_0x6ed1f8){return{'model':db[_0x6ed1f8['model']],'as':_0x6ed1f8['as'],'attributes':_0x6ed1f8[_0xb57d('0x1e')],'include':_0x6ed1f8[_0xb57d('0x1d')]?_['map'](_0x6ed1f8['include'],function(_0x405f6d){return{'model':db[_0x405f6d[_0xb57d('0x1f')]],'as':_0x405f6d['as'],'attributes':_0x405f6d['attributes'],'include':_0x405f6d['include']?_[_0xb57d('0x20')](_0x405f6d[_0xb57d('0x1d')],function(_0x4ddc06){return{'model':db[_0x4ddc06[_0xb57d('0x1f')]],'as':_0x4ddc06['as'],'attributes':_0x4ddc06[_0xb57d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb57d('0xe')](function(_0x129118){logger[_0xb57d('0xf')](_0xb57d('0x17'),_0x48b510);logger[_0xb57d('0x12')](_0xb57d('0x17'),_0x48b510,JSON[_0xb57d('0x14')](_0x129118));_0xb5c74b(_0x129118);})[_0xb57d('0x21')](function(_0x277a35){logger[_0xb57d('0x15')](_0xb57d('0x17'),_0x277a35[_0xb57d('0x16')],_0x48b510);_0x3b9097(_0x39d557['error'](0x1f4,_0x277a35[_0xb57d('0x16')]));});});};exports['ShowOpenchannelQueue']=function(_0x431c3f){var _0x55d9f2=this;return new Promise(function(_0x2b0230,_0x30e020){return db['OpenchannelQueue']['find']({'raw':_0x431c3f[_0xb57d('0x1a')]?_0x431c3f['options']['raw']===undefined?!![]:![]:!![],'where':_0x431c3f[_0xb57d('0x1a')]?_0x431c3f[_0xb57d('0x1a')]['where']||null:null,'attributes':_0x431c3f['options']?_0x431c3f[_0xb57d('0x1a')][_0xb57d('0x1e')]||null:null,'include':_0x431c3f[_0xb57d('0x1a')]?_0x431c3f[_0xb57d('0x1a')]['include']?_[_0xb57d('0x20')](_0x431c3f[_0xb57d('0x1a')][_0xb57d('0x1d')],function(_0x56053f){return{'model':db[_0x56053f['model']],'as':_0x56053f['as'],'attributes':_0x56053f[_0xb57d('0x1e')],'include':_0x56053f[_0xb57d('0x1d')]?_['map'](_0x56053f['include'],function(_0x49ba46){return{'model':db[_0x49ba46[_0xb57d('0x1f')]],'as':_0x49ba46['as'],'attributes':_0x49ba46[_0xb57d('0x1e')],'include':_0x49ba46['include']?_[_0xb57d('0x20')](_0x49ba46[_0xb57d('0x1d')],function(_0x2bb781){return{'model':db[_0x2bb781['model']],'as':_0x2bb781['as'],'attributes':_0x2bb781[_0xb57d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb57d('0xe')](function(_0x489fdb){logger[_0xb57d('0xf')](_0xb57d('0x22'),_0x431c3f);logger[_0xb57d('0x12')]('ShowOpenchannelQueue',_0x431c3f,JSON[_0xb57d('0x14')](_0x489fdb));_0x2b0230(_0x489fdb);})['catch'](function(_0x4de64e){logger[_0xb57d('0x15')]('ShowOpenchannelQueue',_0x4de64e[_0xb57d('0x16')],_0x431c3f);_0x30e020(_0x55d9f2[_0xb57d('0x15')](0x1f4,_0x4de64e['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 77fc38b..82ce12d 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 _0x301e=['remove','emit','removeListener','register','length','openchannelQueue:','./openchannelQueue.events','save'];(function(_0x30780e,_0x537b34){var _0x5b9129=function(_0xcf4cd1){while(--_0xcf4cd1){_0x30780e['push'](_0x30780e['shift']());}};_0x5b9129(++_0x537b34);}(_0x301e,0x6e));var _0xe301=function(_0x4b73c0,_0x26263c){_0x4b73c0=_0x4b73c0-0x0;var _0x44c387=_0x301e[_0x4b73c0];return _0x44c387;};'use strict';var OpenchannelQueueEvents=require(_0xe301('0x0'));var events=[_0xe301('0x1'),_0xe301('0x2'),'update'];function createListener(_0x15ef54,_0x26369a){return function(_0x5cf14a){_0x26369a[_0xe301('0x3')](_0x15ef54,_0x5cf14a);};}function removeListener(_0xfec67b,_0x2192c6){return function(){OpenchannelQueueEvents[_0xe301('0x4')](_0xfec67b,_0x2192c6);};}exports[_0xe301('0x5')]=function(_0x5985d1){for(var _0x33b2a6=0x0,_0x230946=events[_0xe301('0x6')];_0x33b2a6<_0x230946;_0x33b2a6++){var _0x36357d=events[_0x33b2a6];var _0x3cc54c=createListener(_0xe301('0x7')+_0x36357d,_0x5985d1);OpenchannelQueueEvents['on'](_0x36357d,_0x3cc54c);}}; \ No newline at end of file +var _0x28f8=['register','length','openchannelQueue:','./openchannelQueue.events','save','remove','removeListener'];(function(_0x4f2f88,_0x51c34c){var _0x58ca3d=function(_0x1f7df4){while(--_0x1f7df4){_0x4f2f88['push'](_0x4f2f88['shift']());}};_0x58ca3d(++_0x51c34c);}(_0x28f8,0x1d1));var _0x828f=function(_0x267c52,_0x3c0df3){_0x267c52=_0x267c52-0x0;var _0x46c47b=_0x28f8[_0x267c52];return _0x46c47b;};'use strict';var OpenchannelQueueEvents=require(_0x828f('0x0'));var events=[_0x828f('0x1'),_0x828f('0x2'),'update'];function createListener(_0x297db7,_0x399aaf){return function(_0x4be368){_0x399aaf['emit'](_0x297db7,_0x4be368);};}function removeListener(_0xe5eb5e,_0x5a2b6a){return function(){OpenchannelQueueEvents[_0x828f('0x3')](_0xe5eb5e,_0x5a2b6a);};}exports[_0x828f('0x4')]=function(_0x471a21){for(var _0x2a4057=0x0,_0xa784d1=events[_0x828f('0x5')];_0x2a4057<_0xa784d1;_0x2a4057++){var _0x3ecfd6=events[_0x2a4057];var _0x9ce0cb=createListener(_0x828f('0x6')+_0x3ecfd6,_0x471a21);OpenchannelQueueEvents['on'](_0x3ecfd6,_0x9ce0cb);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 2d29126..f8a4f24 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 _0x7edc=['describe','/:id','show','post','create','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe'];(function(_0x31c5e9,_0x30e373){var _0x517a8d=function(_0x7f9a48){while(--_0x7f9a48){_0x31c5e9['push'](_0x31c5e9['shift']());}};_0x517a8d(++_0x30e373);}(_0x7edc,0x86));var _0xc7ed=function(_0x9b7a64,_0x38d4a8){_0x9b7a64=_0x9b7a64-0x0;var _0x33fd98=_0x7edc[_0x9b7a64];return _0x33fd98;};'use strict';var multer=require(_0xc7ed('0x0'));var util=require('util');var path=require(_0xc7ed('0x1'));var timeout=require('connect-timeout');var express=require(_0xc7ed('0x2'));var router=express[_0xc7ed('0x3')]();var fs_extra=require(_0xc7ed('0x4'));var auth=require(_0xc7ed('0x5'));var interaction=require(_0xc7ed('0x6'));var config=require(_0xc7ed('0x7'));var controller=require(_0xc7ed('0x8'));router[_0xc7ed('0x9')]('/',auth[_0xc7ed('0xa')](),controller[_0xc7ed('0xb')]);router[_0xc7ed('0x9')](_0xc7ed('0xc'),auth['isAuthenticated'](),controller[_0xc7ed('0xd')]);router[_0xc7ed('0x9')](_0xc7ed('0xe'),auth['isAuthenticated'](),controller[_0xc7ed('0xf')]);router[_0xc7ed('0x10')]('/',auth[_0xc7ed('0xa')](),controller[_0xc7ed('0x11')]);router['put'](_0xc7ed('0xe'),auth['isAuthenticated'](),controller[_0xc7ed('0x12')]);router['delete']('/:id',auth[_0xc7ed('0xa')](),controller[_0xc7ed('0x13')]);module[_0xc7ed('0x14')]=router; \ No newline at end of file +var _0x7f33=['post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelQueueReport.controller','get','/describe','isAuthenticated','describe','/:id','show'];(function(_0x159278,_0x3a8671){var _0x53a263=function(_0x2ec44d){while(--_0x2ec44d){_0x159278['push'](_0x159278['shift']());}};_0x53a263(++_0x3a8671);}(_0x7f33,0x8a));var _0x37f3=function(_0x5963ec,_0x234653){_0x5963ec=_0x5963ec-0x0;var _0x4dec07=_0x7f33[_0x5963ec];return _0x4dec07;};'use strict';var multer=require(_0x37f3('0x0'));var util=require(_0x37f3('0x1'));var path=require(_0x37f3('0x2'));var timeout=require(_0x37f3('0x3'));var express=require(_0x37f3('0x4'));var router=express[_0x37f3('0x5')]();var fs_extra=require(_0x37f3('0x6'));var auth=require(_0x37f3('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x37f3('0x8'));var controller=require(_0x37f3('0x9'));router[_0x37f3('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x37f3('0xa')](_0x37f3('0xb'),auth[_0x37f3('0xc')](),controller[_0x37f3('0xd')]);router[_0x37f3('0xa')](_0x37f3('0xe'),auth[_0x37f3('0xc')](),controller[_0x37f3('0xf')]);router[_0x37f3('0x10')]('/',auth[_0x37f3('0xc')](),controller[_0x37f3('0x11')]);router[_0x37f3('0x12')](_0x37f3('0xe'),auth['isAuthenticated'](),controller[_0x37f3('0x13')]);router['delete'](_0x37f3('0xe'),auth[_0x37f3('0xc')](),controller[_0x37f3('0x14')]);module[_0x37f3('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 8633ec6..210f376 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 _0x0c22=['sequelize','STRING','DATE','moment'];(function(_0x4a93bb,_0x495404){var _0x208468=function(_0x1d82b7){while(--_0x1d82b7){_0x4a93bb['push'](_0x4a93bb['shift']());}};_0x208468(++_0x495404);}(_0x0c22,0x17b));var _0x20c2=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x0c22[_0x397e5f];return _0x5302b8;};'use strict';var moment=require(_0x20c2('0x0'));var Sequelize=require(_0x20c2('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x20c2('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x20c2('0x3')]},'leaveAt':{'type':Sequelize[_0x20c2('0x3')]},'acceptAt':{'type':Sequelize[_0x20c2('0x3')]},'exitAt':{'type':Sequelize[_0x20c2('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8be6=['moment','exports','STRING','DATE'];(function(_0x1b60ae,_0x18cb1f){var _0x3b96b6=function(_0x462092){while(--_0x462092){_0x1b60ae['push'](_0x1b60ae['shift']());}};_0x3b96b6(++_0x18cb1f);}(_0x8be6,0xa4));var _0x68be=function(_0x4f4185,_0x302dd8){_0x4f4185=_0x4f4185-0x0;var _0x57a9e6=_0x8be6[_0x4f4185];return _0x57a9e6;};'use strict';var moment=require(_0x68be('0x0'));var Sequelize=require('sequelize');module[_0x68be('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x68be('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x68be('0x3')]},'acceptAt':{'type':Sequelize[_0x68be('0x3')]},'exitAt':{'type':Sequelize[_0x68be('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 313d24b..cd2fecc 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 _0xe560=['catch','show','params','keys','length','include','create','body','find','describe','eml-format','zip-dir','fast-json-patch','bluebird','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','offset','limit','undefined','count','status','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll'];(function(_0x59faf6,_0x307322){var _0x45d426=function(_0x58688c){while(--_0x58688c){_0x59faf6['push'](_0x59faf6['shift']());}};_0x45d426(++_0x307322);}(_0xe560,0x9c));var _0x0e56=function(_0x15f6a0,_0x5b34fc){_0x15f6a0=_0x15f6a0-0x0;var _0x10f8c7=_0xe560[_0x15f6a0];return _0x10f8c7;};'use strict';var emlformat=require(_0x0e56('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0e56('0x1'));var jsonpatch=require(_0x0e56('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0e56('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0e56('0x4'));var sox=require(_0x0e56('0x5'));var csv=require(_0x0e56('0x6'));var ejs=require(_0x0e56('0x7'));var fs=require('fs');var fs_extra=require(_0x0e56('0x8'));var _=require('lodash');var squel=require(_0x0e56('0x9'));var crypto=require('crypto');var jsforce=require(_0x0e56('0xa'));var deskjs=require(_0x0e56('0xb'));var toCsv=require('to-csv');var querystring=require(_0x0e56('0xc'));var Papa=require(_0x0e56('0xd'));var Redis=require('ioredis');var authService=require(_0x0e56('0xe'));var qs=require(_0x0e56('0xf'));var as=require(_0x0e56('0x10'));var hardwareService=require(_0x0e56('0x11'));var logger=require(_0x0e56('0x12'))('api');var utils=require(_0x0e56('0x13'));var config=require(_0x0e56('0x14'));var licenseUtil=require(_0x0e56('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x255e42,_0x125ec3){_0x125ec3=_0x125ec3||0xcc;return function(_0xd288bd){if(_0xd288bd){return _0x255e42[_0x0e56('0x16')](_0x125ec3);}return _0x255e42['status'](_0x125ec3)[_0x0e56('0x17')]();};}function respondWithResult(_0x24e188,_0x3abe73){_0x3abe73=_0x3abe73||0xc8;return function(_0x9819e3){if(_0x9819e3){return _0x24e188['status'](_0x3abe73)['json'](_0x9819e3);}};}function respondWithFilteredResult(_0x3d5f2e,_0x54f988){return function(_0x377ec8){if(_0x377ec8){var _0x5124bd=typeof _0x54f988[_0x0e56('0x18')]==='undefined'&&typeof _0x54f988[_0x0e56('0x19')]===_0x0e56('0x1a');var _0x72c922=_0x377ec8['count'];var _0x34eca5=_0x5124bd?0x0:_0x54f988[_0x0e56('0x18')];var _0x472650=_0x5124bd?_0x377ec8[_0x0e56('0x1b')]:_0x54f988[_0x0e56('0x18')]+_0x54f988[_0x0e56('0x19')];var _0x19a8ab;if(_0x472650>=_0x72c922){_0x472650=_0x72c922;_0x19a8ab=0xc8;}else{_0x19a8ab=0xce;}_0x3d5f2e[_0x0e56('0x1c')](_0x19a8ab);return _0x3d5f2e[_0x0e56('0x1d')](_0x0e56('0x1e'),_0x34eca5+'-'+_0x472650+'/'+_0x72c922)[_0x0e56('0x1f')](_0x377ec8);}return null;};}function patchUpdates(_0x2a9050){return function(_0x481165){try{jsonpatch[_0x0e56('0x20')](_0x481165,_0x2a9050,!![]);}catch(_0x36cc98){return BPromise[_0x0e56('0x21')](_0x36cc98);}return _0x481165[_0x0e56('0x22')]();};}function saveUpdates(_0x1d195b,_0x57fcfa){return function(_0xe7fbde){if(_0xe7fbde){return _0xe7fbde[_0x0e56('0x23')](_0x1d195b)[_0x0e56('0x24')](function(_0x588f2a){return _0x588f2a;});}return null;};}function removeEntity(_0x36bd80,_0x403a44){return function(_0x16b32a){if(_0x16b32a){return _0x16b32a['destroy']()[_0x0e56('0x24')](function(){_0x36bd80[_0x0e56('0x1c')](0xcc)[_0x0e56('0x17')]();});}};}function handleEntityNotFound(_0x36e35e,_0x573e02){return function(_0x5aeeef){if(!_0x5aeeef){_0x36e35e[_0x0e56('0x16')](0x194);}return _0x5aeeef;};}function handleError(_0x11fc58,_0x397925){_0x397925=_0x397925||0x1f4;return function(_0x1e6d29){logger[_0x0e56('0x25')](_0x1e6d29[_0x0e56('0x26')]);if(_0x1e6d29[_0x0e56('0x27')]){delete _0x1e6d29[_0x0e56('0x27')];}_0x11fc58[_0x0e56('0x1c')](_0x397925)['send'](_0x1e6d29);};}exports[_0x0e56('0x28')]=function(_0x524cf4,_0x479a06){var _0x5995e7={},_0xfdbac4={},_0x32f607={'count':0x0,'rows':[]};var _0x36c20a=_[_0x0e56('0x29')](db[_0x0e56('0x2a')][_0x0e56('0x2b')],function(_0x4b435d){return{'name':_0x4b435d[_0x0e56('0x2c')],'type':_0x4b435d[_0x0e56('0x2d')][_0x0e56('0x2e')]};});_0xfdbac4[_0x0e56('0x2f')]=_[_0x0e56('0x29')](_0x36c20a,_0x0e56('0x27'));_0xfdbac4[_0x0e56('0x30')]=_['keys'](_0x524cf4[_0x0e56('0x30')]);_0xfdbac4[_0x0e56('0x31')]=_[_0x0e56('0x32')](_0xfdbac4['model'],_0xfdbac4['query']);_0x5995e7[_0x0e56('0x33')]=_[_0x0e56('0x32')](_0xfdbac4['model'],qs['fields'](_0x524cf4[_0x0e56('0x30')][_0x0e56('0x34')]));_0x5995e7['attributes']=_0x5995e7[_0x0e56('0x33')]['length']?_0x5995e7[_0x0e56('0x33')]:_0xfdbac4[_0x0e56('0x2f')];if(!_0x524cf4[_0x0e56('0x30')]['hasOwnProperty']('nolimit')){_0x5995e7[_0x0e56('0x19')]=qs[_0x0e56('0x19')](_0x524cf4[_0x0e56('0x30')][_0x0e56('0x19')]);_0x5995e7['offset']=qs[_0x0e56('0x18')](_0x524cf4['query'][_0x0e56('0x18')]);}_0x5995e7[_0x0e56('0x35')]=qs[_0x0e56('0x36')](_0x524cf4[_0x0e56('0x30')][_0x0e56('0x36')]);_0x5995e7[_0x0e56('0x37')]=qs[_0x0e56('0x31')](_[_0x0e56('0x38')](_0x524cf4['query'],_0xfdbac4[_0x0e56('0x31')]),_0x36c20a);if(_0x524cf4[_0x0e56('0x30')]['filter']){_0x5995e7[_0x0e56('0x37')]=_[_0x0e56('0x39')](_0x5995e7[_0x0e56('0x37')],{'$or':_[_0x0e56('0x29')](_0x36c20a,function(_0x2e7b7c){if(_0x2e7b7c[_0x0e56('0x2d')]!==_0x0e56('0x3a')){var _0x4806d2={};_0x4806d2[_0x2e7b7c[_0x0e56('0x27')]]={'$like':'%'+_0x524cf4[_0x0e56('0x30')][_0x0e56('0x3b')]+'%'};return _0x4806d2;}})});}_0x5995e7=_['merge']({},_0x5995e7,_0x524cf4[_0x0e56('0x3c')]);var _0x5d341e={'where':_0x5995e7[_0x0e56('0x37')]};return db['OpenchannelQueueReport']['count'](_0x5d341e)[_0x0e56('0x24')](function(_0x54ac7d){_0x32f607[_0x0e56('0x1b')]=_0x54ac7d;if(_0x524cf4[_0x0e56('0x30')][_0x0e56('0x3d')]){_0x5995e7['include']=[{'all':!![]}];}return db[_0x0e56('0x2a')][_0x0e56('0x3e')](_0x5995e7);})[_0x0e56('0x24')](function(_0x3844dd){_0x32f607['rows']=_0x3844dd;return _0x32f607;})[_0x0e56('0x24')](respondWithFilteredResult(_0x479a06,_0x5995e7))[_0x0e56('0x3f')](handleError(_0x479a06,null));};exports[_0x0e56('0x40')]=function(_0x439744,_0x2f1df6){var _0x52cd47={'raw':!![],'where':{'id':_0x439744[_0x0e56('0x41')]['id']}},_0x357a70={};_0x357a70[_0x0e56('0x2f')]=_[_0x0e56('0x42')](db['OpenchannelQueueReport'][_0x0e56('0x2b')]);_0x357a70[_0x0e56('0x30')]=_[_0x0e56('0x42')](_0x439744[_0x0e56('0x30')]);_0x357a70['filters']=_['intersection'](_0x357a70[_0x0e56('0x2f')],_0x357a70[_0x0e56('0x30')]);_0x52cd47[_0x0e56('0x33')]=_[_0x0e56('0x32')](_0x357a70[_0x0e56('0x2f')],qs[_0x0e56('0x34')](_0x439744['query'][_0x0e56('0x34')]));_0x52cd47[_0x0e56('0x33')]=_0x52cd47[_0x0e56('0x33')][_0x0e56('0x43')]?_0x52cd47[_0x0e56('0x33')]:_0x357a70[_0x0e56('0x2f')];if(_0x439744[_0x0e56('0x30')]['includeAll']){_0x52cd47[_0x0e56('0x44')]=[{'all':!![]}];}_0x52cd47=_[_0x0e56('0x39')]({},_0x52cd47,_0x439744[_0x0e56('0x3c')]);return db[_0x0e56('0x2a')]['find'](_0x52cd47)[_0x0e56('0x24')](handleEntityNotFound(_0x2f1df6,null))[_0x0e56('0x24')](respondWithResult(_0x2f1df6,null))[_0x0e56('0x3f')](handleError(_0x2f1df6,null));};exports[_0x0e56('0x45')]=function(_0x279a1,_0x3a23f1){return db[_0x0e56('0x2a')]['create'](_0x279a1['body'],{})['then'](respondWithResult(_0x3a23f1,0xc9))['catch'](handleError(_0x3a23f1,null));};exports[_0x0e56('0x23')]=function(_0x575d77,_0x521686){if(_0x575d77[_0x0e56('0x46')]['id']){delete _0x575d77['body']['id'];}return db['OpenchannelQueueReport']['find']({'where':{'id':_0x575d77[_0x0e56('0x41')]['id']}})[_0x0e56('0x24')](handleEntityNotFound(_0x521686,null))[_0x0e56('0x24')](saveUpdates(_0x575d77[_0x0e56('0x46')],null))[_0x0e56('0x24')](respondWithResult(_0x521686,null))[_0x0e56('0x3f')](handleError(_0x521686,null));};exports['destroy']=function(_0x11daaf,_0x5356b4){return db[_0x0e56('0x2a')][_0x0e56('0x47')]({'where':{'id':_0x11daaf[_0x0e56('0x41')]['id']}})[_0x0e56('0x24')](handleEntityNotFound(_0x5356b4,null))[_0x0e56('0x24')](removeEntity(_0x5356b4,null))['catch'](handleError(_0x5356b4,null));};exports[_0x0e56('0x48')]=function(_0x9a68e,_0x449470){return db['OpenchannelQueueReport'][_0x0e56('0x48')]()[_0x0e56('0x24')](respondWithResult(_0x449470,null))[_0x0e56('0x3f')](handleError(_0x449470,null));}; \ No newline at end of file +var _0xd40c=['query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','show','length','includeAll','find','catch','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','fs-extra','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','error','stack','name','send','index','OpenchannelQueueReport','rawAttributes','type','key','model','map'];(function(_0x229f78,_0x334ee1){var _0x5964d7=function(_0x436970){while(--_0x436970){_0x229f78['push'](_0x229f78['shift']());}};_0x5964d7(++_0x334ee1);}(_0xd40c,0x103));var _0xcd40=function(_0x3b6614,_0x45277c){_0x3b6614=_0x3b6614-0x0;var _0x5a63bf=_0xd40c[_0x3b6614];return _0x5a63bf;};'use strict';var emlformat=require(_0xcd40('0x0'));var rimraf=require(_0xcd40('0x1'));var zipdir=require(_0xcd40('0x2'));var jsonpatch=require(_0xcd40('0x3'));var rp=require('request-promise');var moment=require(_0xcd40('0x4'));var BPromise=require(_0xcd40('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xcd40('0x6'));var sox=require(_0xcd40('0x7'));var csv=require('to-csv');var ejs=require(_0xcd40('0x8'));var fs=require('fs');var fs_extra=require(_0xcd40('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xcd40('0xa'));var deskjs=require(_0xcd40('0xb'));var toCsv=require(_0xcd40('0xc'));var querystring=require(_0xcd40('0xd'));var Papa=require(_0xcd40('0xe'));var Redis=require(_0xcd40('0xf'));var authService=require(_0xcd40('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xcd40('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcd40('0x12'))(_0xcd40('0x13'));var utils=require(_0xcd40('0x14'));var config=require(_0xcd40('0x15'));var licenseUtil=require(_0xcd40('0x16'));var db=require(_0xcd40('0x17'))['db'];function respondWithStatusCode(_0x15b00f,_0x441aed){_0x441aed=_0x441aed||0xcc;return function(_0x460ee7){if(_0x460ee7){return _0x15b00f[_0xcd40('0x18')](_0x441aed);}return _0x15b00f[_0xcd40('0x19')](_0x441aed)[_0xcd40('0x1a')]();};}function respondWithResult(_0x9c74b1,_0x4bf162){_0x4bf162=_0x4bf162||0xc8;return function(_0x25b15f){if(_0x25b15f){return _0x9c74b1[_0xcd40('0x19')](_0x4bf162)[_0xcd40('0x1b')](_0x25b15f);}};}function respondWithFilteredResult(_0x55df76,_0x4c0f73){return function(_0x5b65b5){if(_0x5b65b5){var _0x51f1a9=typeof _0x4c0f73[_0xcd40('0x1c')]===_0xcd40('0x1d')&&typeof _0x4c0f73[_0xcd40('0x1e')]===_0xcd40('0x1d');var _0x53a00f=_0x5b65b5['count'];var _0x128360=_0x51f1a9?0x0:_0x4c0f73[_0xcd40('0x1c')];var _0x445465=_0x51f1a9?_0x5b65b5[_0xcd40('0x1f')]:_0x4c0f73[_0xcd40('0x1c')]+_0x4c0f73[_0xcd40('0x1e')];var _0x50edc4;if(_0x445465>=_0x53a00f){_0x445465=_0x53a00f;_0x50edc4=0xc8;}else{_0x50edc4=0xce;}_0x55df76[_0xcd40('0x19')](_0x50edc4);return _0x55df76[_0xcd40('0x20')]('Content-Range',_0x128360+'-'+_0x445465+'/'+_0x53a00f)['json'](_0x5b65b5);}return null;};}function patchUpdates(_0x65b1d0){return function(_0x5d03ea){try{jsonpatch[_0xcd40('0x21')](_0x5d03ea,_0x65b1d0,!![]);}catch(_0x83c29c){return BPromise[_0xcd40('0x22')](_0x83c29c);}return _0x5d03ea[_0xcd40('0x23')]();};}function saveUpdates(_0x526b9f,_0x244ec7){return function(_0x2d8ef9){if(_0x2d8ef9){return _0x2d8ef9['update'](_0x526b9f)[_0xcd40('0x24')](function(_0x46fe8b){return _0x46fe8b;});}return null;};}function removeEntity(_0x42146a,_0x2d9fe6){return function(_0x5e2292){if(_0x5e2292){return _0x5e2292[_0xcd40('0x25')]()[_0xcd40('0x24')](function(){_0x42146a['status'](0xcc)[_0xcd40('0x1a')]();});}};}function handleEntityNotFound(_0x597cf3,_0x378151){return function(_0x510bd0){if(!_0x510bd0){_0x597cf3['sendStatus'](0x194);}return _0x510bd0;};}function handleError(_0x4e841b,_0x4a4ff8){_0x4a4ff8=_0x4a4ff8||0x1f4;return function(_0x2969ba){logger[_0xcd40('0x26')](_0x2969ba[_0xcd40('0x27')]);if(_0x2969ba[_0xcd40('0x28')]){delete _0x2969ba['name'];}_0x4e841b[_0xcd40('0x19')](_0x4a4ff8)[_0xcd40('0x29')](_0x2969ba);};}exports[_0xcd40('0x2a')]=function(_0x17b7aa,_0x3567ca){var _0x59c98c={},_0x206ded={},_0x5e9624={'count':0x0,'rows':[]};var _0x19b437=_['map'](db[_0xcd40('0x2b')][_0xcd40('0x2c')],function(_0x5e7ce9){return{'name':_0x5e7ce9['fieldName'],'type':_0x5e7ce9[_0xcd40('0x2d')][_0xcd40('0x2e')]};});_0x206ded[_0xcd40('0x2f')]=_[_0xcd40('0x30')](_0x19b437,_0xcd40('0x28'));_0x206ded[_0xcd40('0x31')]=_[_0xcd40('0x32')](_0x17b7aa[_0xcd40('0x31')]);_0x206ded[_0xcd40('0x33')]=_['intersection'](_0x206ded[_0xcd40('0x2f')],_0x206ded[_0xcd40('0x31')]);_0x59c98c[_0xcd40('0x34')]=_[_0xcd40('0x35')](_0x206ded[_0xcd40('0x2f')],qs[_0xcd40('0x36')](_0x17b7aa[_0xcd40('0x31')]['fields']));_0x59c98c[_0xcd40('0x34')]=_0x59c98c[_0xcd40('0x34')]['length']?_0x59c98c[_0xcd40('0x34')]:_0x206ded[_0xcd40('0x2f')];if(!_0x17b7aa['query'][_0xcd40('0x37')](_0xcd40('0x38'))){_0x59c98c[_0xcd40('0x1e')]=qs[_0xcd40('0x1e')](_0x17b7aa[_0xcd40('0x31')]['limit']);_0x59c98c[_0xcd40('0x1c')]=qs[_0xcd40('0x1c')](_0x17b7aa[_0xcd40('0x31')][_0xcd40('0x1c')]);}_0x59c98c[_0xcd40('0x39')]=qs[_0xcd40('0x3a')](_0x17b7aa[_0xcd40('0x31')][_0xcd40('0x3a')]);_0x59c98c[_0xcd40('0x3b')]=qs[_0xcd40('0x33')](_[_0xcd40('0x3c')](_0x17b7aa[_0xcd40('0x31')],_0x206ded['filters']),_0x19b437);if(_0x17b7aa[_0xcd40('0x31')][_0xcd40('0x3d')]){_0x59c98c[_0xcd40('0x3b')]=_[_0xcd40('0x3e')](_0x59c98c[_0xcd40('0x3b')],{'$or':_['map'](_0x19b437,function(_0x181835){if(_0x181835[_0xcd40('0x2d')]!==_0xcd40('0x3f')){var _0x25c914={};_0x25c914[_0x181835[_0xcd40('0x28')]]={'$like':'%'+_0x17b7aa[_0xcd40('0x31')][_0xcd40('0x3d')]+'%'};return _0x25c914;}})});}_0x59c98c=_[_0xcd40('0x3e')]({},_0x59c98c,_0x17b7aa[_0xcd40('0x40')]);var _0x5dce80={'where':_0x59c98c[_0xcd40('0x3b')]};return db['OpenchannelQueueReport'][_0xcd40('0x1f')](_0x5dce80)[_0xcd40('0x24')](function(_0x4a2081){_0x5e9624[_0xcd40('0x1f')]=_0x4a2081;if(_0x17b7aa[_0xcd40('0x31')]['includeAll']){_0x59c98c[_0xcd40('0x41')]=[{'all':!![]}];}return db[_0xcd40('0x2b')][_0xcd40('0x42')](_0x59c98c);})[_0xcd40('0x24')](function(_0x374dd4){_0x5e9624['rows']=_0x374dd4;return _0x5e9624;})[_0xcd40('0x24')](respondWithFilteredResult(_0x3567ca,_0x59c98c))['catch'](handleError(_0x3567ca,null));};exports[_0xcd40('0x43')]=function(_0x24edd5,_0x4c591c){var _0x3b51fd={'raw':!![],'where':{'id':_0x24edd5['params']['id']}},_0x2eb406={};_0x2eb406[_0xcd40('0x2f')]=_[_0xcd40('0x32')](db[_0xcd40('0x2b')]['rawAttributes']);_0x2eb406[_0xcd40('0x31')]=_[_0xcd40('0x32')](_0x24edd5[_0xcd40('0x31')]);_0x2eb406[_0xcd40('0x33')]=_[_0xcd40('0x35')](_0x2eb406['model'],_0x2eb406[_0xcd40('0x31')]);_0x3b51fd['attributes']=_[_0xcd40('0x35')](_0x2eb406[_0xcd40('0x2f')],qs[_0xcd40('0x36')](_0x24edd5[_0xcd40('0x31')][_0xcd40('0x36')]));_0x3b51fd['attributes']=_0x3b51fd[_0xcd40('0x34')][_0xcd40('0x44')]?_0x3b51fd[_0xcd40('0x34')]:_0x2eb406[_0xcd40('0x2f')];if(_0x24edd5['query'][_0xcd40('0x45')]){_0x3b51fd[_0xcd40('0x41')]=[{'all':!![]}];}_0x3b51fd=_[_0xcd40('0x3e')]({},_0x3b51fd,_0x24edd5[_0xcd40('0x40')]);return db[_0xcd40('0x2b')][_0xcd40('0x46')](_0x3b51fd)['then'](handleEntityNotFound(_0x4c591c,null))['then'](respondWithResult(_0x4c591c,null))[_0xcd40('0x47')](handleError(_0x4c591c,null));};exports[_0xcd40('0x48')]=function(_0x86093b,_0x5cbcc6){return db['OpenchannelQueueReport'][_0xcd40('0x48')](_0x86093b[_0xcd40('0x49')],{})['then'](respondWithResult(_0x5cbcc6,0xc9))[_0xcd40('0x47')](handleError(_0x5cbcc6,null));};exports[_0xcd40('0x4a')]=function(_0x3922fa,_0x364a8b){if(_0x3922fa['body']['id']){delete _0x3922fa[_0xcd40('0x49')]['id'];}return db[_0xcd40('0x2b')][_0xcd40('0x46')]({'where':{'id':_0x3922fa[_0xcd40('0x4b')]['id']}})['then'](handleEntityNotFound(_0x364a8b,null))[_0xcd40('0x24')](saveUpdates(_0x3922fa['body'],null))[_0xcd40('0x24')](respondWithResult(_0x364a8b,null))[_0xcd40('0x47')](handleError(_0x364a8b,null));};exports[_0xcd40('0x25')]=function(_0x28b4ce,_0x519425){return db['OpenchannelQueueReport'][_0xcd40('0x46')]({'where':{'id':_0x28b4ce[_0xcd40('0x4b')]['id']}})[_0xcd40('0x24')](handleEntityNotFound(_0x519425,null))[_0xcd40('0x24')](removeEntity(_0x519425,null))[_0xcd40('0x47')](handleError(_0x519425,null));};exports['describe']=function(_0x372560,_0x331197){return db[_0xcd40('0x2b')][_0xcd40('0x4c')]()[_0xcd40('0x24')](respondWithResult(_0x331197,null))[_0xcd40('0x47')](handleError(_0x331197,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index a7cca20..969cebf 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 _0xe14b=['bluebird','path','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','moment'];(function(_0x872f6f,_0x5efe7b){var _0x59a5f4=function(_0x147463){while(--_0x147463){_0x872f6f['push'](_0x872f6f['shift']());}};_0x59a5f4(++_0x5efe7b);}(_0xe14b,0x93));var _0xbe14=function(_0x1eb8f1,_0x39ea9e){_0x1eb8f1=_0x1eb8f1-0x0;var _0x51d861=_0xe14b[_0x1eb8f1];return _0x51d861;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelQueueReport.attributes','exports','define','report_openchannel_queue','uniqueid','lodash'];(function(_0x1a8684,_0x357617){var _0x5abbfb=function(_0x43d6a0){while(--_0x43d6a0){_0x1a8684['push'](_0x1a8684['shift']());}};_0x5abbfb(++_0x357617);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x5fc3[_0x3d42d8];return _0x27fc41;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[{'name':_0x35fc('0xc'),'fields':[_0x35fc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index f5ab2b6..1b0d635 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 _0xbaf0=['UpdateOpenchannelQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','raw','update','options','where','attributes','limit'];(function(_0x196f40,_0x417e6e){var _0x544d7b=function(_0x46c19c){while(--_0x46c19c){_0x196f40['push'](_0x196f40['shift']());}};_0x544d7b(++_0x417e6e);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'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')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});}exports[_0x0baf('0x16')]=function(_0x53c338){var _0x63c820=this;return new Promise(function(_0xfbecec,_0x1ef0e5){return db[_0x0baf('0x17')][_0x0baf('0x18')](_0x53c338[_0x0baf('0x19')],{'raw':_0x53c338['options']?_0x53c338['options'][_0x0baf('0x1a')]===undefined?!![]:![]:!![]})[_0x0baf('0xc')](function(_0x32e839){logger[_0x0baf('0xd')](_0x0baf('0x16'),_0x53c338);logger[_0x0baf('0x10')](_0x0baf('0x16'),_0x53c338,JSON[_0x0baf('0x12')](_0x32e839));_0xfbecec(_0x32e839);})[_0x0baf('0x15')](function(_0x15a2c3){logger['error'](_0x0baf('0x16'),_0x15a2c3['message'],_0x53c338);_0x1ef0e5(_0x63c820[_0x0baf('0x13')](0x1f4,_0x15a2c3['message']));});});};exports['UpdateOpenchannelQueueReport']=function(_0x2ef0aa){var _0x48a0e9=this;return new Promise(function(_0x4be1b9,_0x47c4b){return db[_0x0baf('0x17')][_0x0baf('0x1b')](_0x2ef0aa[_0x0baf('0x19')],{'raw':_0x2ef0aa[_0x0baf('0x1c')]?_0x2ef0aa['options'][_0x0baf('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ef0aa[_0x0baf('0x1c')]?_0x2ef0aa[_0x0baf('0x1c')][_0x0baf('0x1d')]||null:null,'attributes':_0x2ef0aa[_0x0baf('0x1c')]?_0x2ef0aa[_0x0baf('0x1c')][_0x0baf('0x1e')]||null:null,'limit':_0x2ef0aa['options']?_0x2ef0aa[_0x0baf('0x1c')][_0x0baf('0x1f')]||null:null})[_0x0baf('0xc')](function(_0x265915){logger['info'](_0x0baf('0x20'),_0x2ef0aa);logger[_0x0baf('0x10')]('UpdateOpenchannelQueueReport',_0x2ef0aa,JSON[_0x0baf('0x12')](_0x265915));_0x4be1b9(_0x265915);})[_0x0baf('0x15')](function(_0x478ce8){logger[_0x0baf('0x13')](_0x0baf('0x20'),_0x478ce8[_0x0baf('0x14')],_0x2ef0aa);_0x47c4b(_0x48a0e9[_0x0baf('0x13')](0x1f4,_0x478ce8['message']));});});}; \ No newline at end of file +var _0x0490=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','catch','UpdateOpenchannelQueueReport','update','raw','attributes','limit','util','../../mysqldb','../../config/utils'];(function(_0x2cb55e,_0x5a3823){var _0x53898b=function(_0x3c3991){while(--_0x3c3991){_0x2cb55e['push'](_0x2cb55e['shift']());}};_0x53898b(++_0x5a3823);}(_0x0490,0x147));var _0x0049=function(_0x5ef55b,_0x5dc288){_0x5ef55b=_0x5ef55b-0x0;var _0xe32eb2=_0x0490[_0x5ef55b];return _0xe32eb2;};'use strict';var _=require('lodash');var util=require(_0x0049('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0049('0x1'))['db'];var utils=require(_0x0049('0x2'));var logger=require(_0x0049('0x3'))(_0x0049('0x4'));var config=require(_0x0049('0x5'));var jayson=require(_0x0049('0x6'));var client=jayson[_0x0049('0x7')][_0x0049('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x28c8d2,_0x57fca5,_0x18bff7){return new BPromise(function(_0xe091c4,_0x154219){return client['request'](_0x28c8d2,_0x18bff7)[_0x0049('0x9')](function(_0x3f2ca1){logger[_0x0049('0xa')](_0x0049('0xb'),_0x57fca5,_0x0049('0xc'));logger[_0x0049('0xd')](_0x0049('0xe'),_0x57fca5,_0x0049('0xc'),JSON[_0x0049('0xf')](_0x3f2ca1));if(_0x3f2ca1['error']){if(_0x3f2ca1[_0x0049('0x10')][_0x0049('0x11')]===0x1f4){logger[_0x0049('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x57fca5,_0x3f2ca1['error'][_0x0049('0x12')]);return _0x154219(_0x3f2ca1[_0x0049('0x10')][_0x0049('0x12')]);}logger[_0x0049('0x10')](_0x0049('0xb'),_0x57fca5,_0x3f2ca1['error'][_0x0049('0x12')]);return _0xe091c4(_0x3f2ca1[_0x0049('0x10')]['message']);}else{logger[_0x0049('0xa')](_0x0049('0xb'),_0x57fca5,_0x0049('0xc'));_0xe091c4(_0x3f2ca1[_0x0049('0x13')]['message']);}})['catch'](function(_0x4315b5){logger[_0x0049('0x10')](_0x0049('0xb'),_0x57fca5,_0x4315b5);_0x154219(_0x4315b5);});});}exports[_0x0049('0x14')]=function(_0x102b40){var _0x4592ad=this;return new Promise(function(_0x191a20,_0x21691){return db[_0x0049('0x15')][_0x0049('0x16')](_0x102b40['body'],{'raw':_0x102b40[_0x0049('0x17')]?_0x102b40[_0x0049('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x0049('0x9')](function(_0x4624ff){logger[_0x0049('0xa')](_0x0049('0x14'),_0x102b40);logger[_0x0049('0xd')]('CreateOpenchannelQueueReport',_0x102b40,JSON[_0x0049('0xf')](_0x4624ff));_0x191a20(_0x4624ff);})[_0x0049('0x18')](function(_0x49c00b){logger[_0x0049('0x10')](_0x0049('0x14'),_0x49c00b[_0x0049('0x12')],_0x102b40);_0x21691(_0x4592ad[_0x0049('0x10')](0x1f4,_0x49c00b[_0x0049('0x12')]));});});};exports[_0x0049('0x19')]=function(_0x223c9c){var _0x457bb3=this;return new Promise(function(_0x57e21f,_0x7a9715){return db[_0x0049('0x15')][_0x0049('0x1a')](_0x223c9c['body'],{'raw':_0x223c9c[_0x0049('0x17')]?_0x223c9c[_0x0049('0x17')][_0x0049('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x223c9c[_0x0049('0x17')]?_0x223c9c[_0x0049('0x17')]['where']||null:null,'attributes':_0x223c9c[_0x0049('0x17')]?_0x223c9c['options'][_0x0049('0x1c')]||null:null,'limit':_0x223c9c[_0x0049('0x17')]?_0x223c9c[_0x0049('0x17')][_0x0049('0x1d')]||null:null})['then'](function(_0x305623){logger[_0x0049('0xa')](_0x0049('0x19'),_0x223c9c);logger[_0x0049('0xd')](_0x0049('0x19'),_0x223c9c,JSON['stringify'](_0x305623));_0x57e21f(_0x305623);})[_0x0049('0x18')](function(_0x249240){logger[_0x0049('0x10')]('UpdateOpenchannelQueueReport',_0x249240[_0x0049('0x12')],_0x223c9c);_0x7a9715(_0x457bb3[_0x0049('0x10')](0x1f4,_0x249240[_0x0049('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 40b4a54..dbbad4d 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 _0x90f1=['get','isAuthenticated','index','/describe','show','create','put','/:id','delete','destroy','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x90f1,0xa3));var _0x190f=function(_0x2f8333,_0x39dce3){_0x2f8333=_0x2f8333-0x0;var _0x5ce4f0=_0x90f1[_0x2f8333];return _0x5ce4f0;};'use strict';var multer=require('multer');var util=require(_0x190f('0x0'));var path=require(_0x190f('0x1'));var timeout=require(_0x190f('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x190f('0x3'));var auth=require(_0x190f('0x4'));var interaction=require(_0x190f('0x5'));var config=require(_0x190f('0x6'));var controller=require(_0x190f('0x7'));router[_0x190f('0x8')]('/',auth[_0x190f('0x9')](),controller[_0x190f('0xa')]);router[_0x190f('0x8')](_0x190f('0xb'),auth[_0x190f('0x9')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x190f('0xc')]);router['post']('/',auth[_0x190f('0x9')](),controller[_0x190f('0xd')]);router[_0x190f('0xe')](_0x190f('0xf'),auth[_0x190f('0x9')](),controller['update']);router[_0x190f('0x10')]('/:id',auth[_0x190f('0x9')](),controller[_0x190f('0x11')]);module[_0x190f('0x12')]=router; \ No newline at end of file +var _0xefa2=['util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','/describe','/:id','post','put','delete','destroy','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xefa2,0xaf));var _0x2efa=function(_0x4abf2c,_0x98569f){_0x4abf2c=_0x4abf2c-0x0;var _0x3fd386=_0xefa2[_0x4abf2c];return _0x3fd386;};'use strict';var multer=require(_0x2efa('0x0'));var util=require(_0x2efa('0x1'));var path=require(_0x2efa('0x2'));var timeout=require(_0x2efa('0x3'));var express=require(_0x2efa('0x4'));var router=express[_0x2efa('0x5')]();var fs_extra=require(_0x2efa('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2efa('0x7'));var controller=require('./openchannelTransferReport.controller');router[_0x2efa('0x8')]('/',auth[_0x2efa('0x9')](),controller['index']);router['get'](_0x2efa('0xa'),auth[_0x2efa('0x9')](),controller['describe']);router[_0x2efa('0x8')](_0x2efa('0xb'),auth[_0x2efa('0x9')](),controller['show']);router[_0x2efa('0xc')]('/',auth[_0x2efa('0x9')](),controller['create']);router[_0x2efa('0xd')](_0x2efa('0xb'),auth[_0x2efa('0x9')](),controller['update']);router[_0x2efa('0xe')]('/:id',auth[_0x2efa('0x9')](),controller[_0x2efa('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 13fe400..f612a8e 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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x298374,_0x4d34c4){var _0x42ada1=function(_0x1ed25b){while(--_0x1ed25b){_0x298374['push'](_0x298374['shift']());}};_0x42ada1(++_0x4d34c4);}(_0x9c44,0x178));var _0x49c4=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x9c44[_0x1969a7];return _0x3d665f;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x388c4e,_0x3ccea9){var _0x428623=function(_0x2a1027){while(--_0x2a1027){_0x388c4e['push'](_0x388c4e['shift']());}};_0x428623(++_0x3ccea9);}(_0xaa88,0x137));var _0x8aa8=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xaa88[_0x3c2a69];return _0x596bc8;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index e0dab7b..a4b1272 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 _0x19b9=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','update','then','destroy','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','order','sort','pick','filters','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x19b9,0xea));var _0x919b=function(_0x535c9e,_0x1344b0){_0x535c9e=_0x535c9e-0x0;var _0x2f426e=_0x19b9[_0x535c9e];return _0x2f426e;};'use strict';var emlformat=require(_0x919b('0x0'));var rimraf=require(_0x919b('0x1'));var zipdir=require(_0x919b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x919b('0x3'));var moment=require(_0x919b('0x4'));var BPromise=require(_0x919b('0x5'));var Mustache=require('mustache');var util=require(_0x919b('0x6'));var path=require(_0x919b('0x7'));var sox=require(_0x919b('0x8'));var csv=require(_0x919b('0x9'));var ejs=require(_0x919b('0xa'));var fs=require('fs');var fs_extra=require(_0x919b('0xb'));var _=require(_0x919b('0xc'));var squel=require(_0x919b('0xd'));var crypto=require(_0x919b('0xe'));var jsforce=require(_0x919b('0xf'));var deskjs=require(_0x919b('0x10'));var toCsv=require(_0x919b('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x919b('0x11'));var authService=require(_0x919b('0x12'));var qs=require(_0x919b('0x13'));var as=require(_0x919b('0x14'));var hardwareService=require(_0x919b('0x15'));var logger=require('../../config/logger')(_0x919b('0x16'));var utils=require(_0x919b('0x17'));var config=require(_0x919b('0x18'));var licenseUtil=require(_0x919b('0x19'));var db=require(_0x919b('0x1a'))['db'];function respondWithStatusCode(_0x26674a,_0x316d96){_0x316d96=_0x316d96||0xcc;return function(_0x3a9546){if(_0x3a9546){return _0x26674a[_0x919b('0x1b')](_0x316d96);}return _0x26674a[_0x919b('0x1c')](_0x316d96)[_0x919b('0x1d')]();};}function respondWithResult(_0x12d1a1,_0x37cea9){_0x37cea9=_0x37cea9||0xc8;return function(_0xeb76b8){if(_0xeb76b8){return _0x12d1a1[_0x919b('0x1c')](_0x37cea9)[_0x919b('0x1e')](_0xeb76b8);}};}function respondWithFilteredResult(_0x43af46,_0x309c17){return function(_0x91d801){if(_0x91d801){var _0x48987c=typeof _0x309c17[_0x919b('0x1f')]===_0x919b('0x20')&&typeof _0x309c17['limit']==='undefined';var _0x2a13c3=_0x91d801[_0x919b('0x21')];var _0x20465e=_0x48987c?0x0:_0x309c17[_0x919b('0x1f')];var _0x159143=_0x48987c?_0x91d801[_0x919b('0x21')]:_0x309c17['offset']+_0x309c17[_0x919b('0x22')];var _0x39988d;if(_0x159143>=_0x2a13c3){_0x159143=_0x2a13c3;_0x39988d=0xc8;}else{_0x39988d=0xce;}_0x43af46[_0x919b('0x1c')](_0x39988d);return _0x43af46[_0x919b('0x23')]('Content-Range',_0x20465e+'-'+_0x159143+'/'+_0x2a13c3)[_0x919b('0x1e')](_0x91d801);}return null;};}function patchUpdates(_0x298b25){return function(_0x23df37){try{jsonpatch[_0x919b('0x24')](_0x23df37,_0x298b25,!![]);}catch(_0x10605c){return BPromise[_0x919b('0x25')](_0x10605c);}return _0x23df37['save']();};}function saveUpdates(_0x5c1a1a,_0x809e02){return function(_0x1833e3){if(_0x1833e3){return _0x1833e3[_0x919b('0x26')](_0x5c1a1a)[_0x919b('0x27')](function(_0x498ae8){return _0x498ae8;});}return null;};}function removeEntity(_0x3b31de,_0x4392ba){return function(_0x25c3e4){if(_0x25c3e4){return _0x25c3e4[_0x919b('0x28')]()[_0x919b('0x27')](function(){_0x3b31de['status'](0xcc)[_0x919b('0x1d')]();});}};}function handleEntityNotFound(_0x12c504,_0x59fb75){return function(_0xd9e09a){if(!_0xd9e09a){_0x12c504['sendStatus'](0x194);}return _0xd9e09a;};}function handleError(_0x2f08ec,_0x369055){_0x369055=_0x369055||0x1f4;return function(_0x25eb27){logger[_0x919b('0x29')](_0x25eb27[_0x919b('0x2a')]);if(_0x25eb27[_0x919b('0x2b')]){delete _0x25eb27[_0x919b('0x2b')];}_0x2f08ec['status'](_0x369055)[_0x919b('0x2c')](_0x25eb27);};}exports[_0x919b('0x2d')]=function(_0x264b68,_0xe71297){var _0x2d1fe8={},_0xa37550={},_0x3623c0={'count':0x0,'rows':[]};var _0x803710=_[_0x919b('0x2e')](db[_0x919b('0x2f')][_0x919b('0x30')],function(_0x4e329a){return{'name':_0x4e329a[_0x919b('0x31')],'type':_0x4e329a[_0x919b('0x32')][_0x919b('0x33')]};});_0xa37550[_0x919b('0x34')]=_[_0x919b('0x2e')](_0x803710,_0x919b('0x2b'));_0xa37550[_0x919b('0x35')]=_[_0x919b('0x36')](_0x264b68['query']);_0xa37550['filters']=_[_0x919b('0x37')](_0xa37550['model'],_0xa37550[_0x919b('0x35')]);_0x2d1fe8[_0x919b('0x38')]=_[_0x919b('0x37')](_0xa37550[_0x919b('0x34')],qs[_0x919b('0x39')](_0x264b68[_0x919b('0x35')][_0x919b('0x39')]));_0x2d1fe8[_0x919b('0x38')]=_0x2d1fe8[_0x919b('0x38')]['length']?_0x2d1fe8[_0x919b('0x38')]:_0xa37550['model'];if(!_0x264b68[_0x919b('0x35')]['hasOwnProperty'](_0x919b('0x3a'))){_0x2d1fe8[_0x919b('0x22')]=qs['limit'](_0x264b68[_0x919b('0x35')][_0x919b('0x22')]);_0x2d1fe8['offset']=qs[_0x919b('0x1f')](_0x264b68[_0x919b('0x35')][_0x919b('0x1f')]);}_0x2d1fe8[_0x919b('0x3b')]=qs[_0x919b('0x3c')](_0x264b68['query'][_0x919b('0x3c')]);_0x2d1fe8['where']=qs['filters'](_[_0x919b('0x3d')](_0x264b68[_0x919b('0x35')],_0xa37550[_0x919b('0x3e')]),_0x803710);if(_0x264b68['query']['filter']){_0x2d1fe8[_0x919b('0x3f')]=_[_0x919b('0x40')](_0x2d1fe8[_0x919b('0x3f')],{'$or':_[_0x919b('0x2e')](_0x803710,function(_0x22e7b1){if(_0x22e7b1[_0x919b('0x32')]!==_0x919b('0x41')){var _0x482508={};_0x482508[_0x22e7b1[_0x919b('0x2b')]]={'$like':'%'+_0x264b68['query'][_0x919b('0x42')]+'%'};return _0x482508;}})});}_0x2d1fe8=_[_0x919b('0x40')]({},_0x2d1fe8,_0x264b68[_0x919b('0x43')]);var _0x14a194={'where':_0x2d1fe8[_0x919b('0x3f')]};return db[_0x919b('0x2f')][_0x919b('0x21')](_0x14a194)['then'](function(_0x24eecc){_0x3623c0[_0x919b('0x21')]=_0x24eecc;if(_0x264b68[_0x919b('0x35')][_0x919b('0x44')]){_0x2d1fe8[_0x919b('0x45')]=[{'all':!![]}];}return db[_0x919b('0x2f')][_0x919b('0x46')](_0x2d1fe8);})[_0x919b('0x27')](function(_0x25e449){_0x3623c0[_0x919b('0x47')]=_0x25e449;return _0x3623c0;})[_0x919b('0x27')](respondWithFilteredResult(_0xe71297,_0x2d1fe8))['catch'](handleError(_0xe71297,null));};exports[_0x919b('0x48')]=function(_0x2f0cf4,_0x4658aa){var _0x1c5801={'raw':!![],'where':{'id':_0x2f0cf4[_0x919b('0x49')]['id']}},_0x28b0d5={};_0x28b0d5[_0x919b('0x34')]=_[_0x919b('0x36')](db[_0x919b('0x2f')][_0x919b('0x30')]);_0x28b0d5[_0x919b('0x35')]=_[_0x919b('0x36')](_0x2f0cf4[_0x919b('0x35')]);_0x28b0d5[_0x919b('0x3e')]=_[_0x919b('0x37')](_0x28b0d5[_0x919b('0x34')],_0x28b0d5['query']);_0x1c5801[_0x919b('0x38')]=_['intersection'](_0x28b0d5[_0x919b('0x34')],qs[_0x919b('0x39')](_0x2f0cf4[_0x919b('0x35')][_0x919b('0x39')]));_0x1c5801[_0x919b('0x38')]=_0x1c5801[_0x919b('0x38')][_0x919b('0x4a')]?_0x1c5801[_0x919b('0x38')]:_0x28b0d5[_0x919b('0x34')];if(_0x2f0cf4['query'][_0x919b('0x44')]){_0x1c5801[_0x919b('0x45')]=[{'all':!![]}];}_0x1c5801=_[_0x919b('0x40')]({},_0x1c5801,_0x2f0cf4['options']);return db[_0x919b('0x2f')][_0x919b('0x4b')](_0x1c5801)[_0x919b('0x27')](handleEntityNotFound(_0x4658aa,null))[_0x919b('0x27')](respondWithResult(_0x4658aa,null))[_0x919b('0x4c')](handleError(_0x4658aa,null));};exports[_0x919b('0x4d')]=function(_0x417d2a,_0x2fe300){return db['OpenchannelTransferReport'][_0x919b('0x4d')](_0x417d2a[_0x919b('0x4e')],{})['then'](respondWithResult(_0x2fe300,0xc9))['catch'](handleError(_0x2fe300,null));};exports['update']=function(_0x1a4377,_0x3b4e7d){if(_0x1a4377[_0x919b('0x4e')]['id']){delete _0x1a4377[_0x919b('0x4e')]['id'];}return db[_0x919b('0x2f')][_0x919b('0x4b')]({'where':{'id':_0x1a4377[_0x919b('0x49')]['id']}})[_0x919b('0x27')](handleEntityNotFound(_0x3b4e7d,null))[_0x919b('0x27')](saveUpdates(_0x1a4377['body'],null))[_0x919b('0x27')](respondWithResult(_0x3b4e7d,null))[_0x919b('0x4c')](handleError(_0x3b4e7d,null));};exports[_0x919b('0x28')]=function(_0x12cdad,_0x2c6b2e){return db[_0x919b('0x2f')][_0x919b('0x4b')]({'where':{'id':_0x12cdad[_0x919b('0x49')]['id']}})['then'](handleEntityNotFound(_0x2c6b2e,null))[_0x919b('0x27')](removeEntity(_0x2c6b2e,null))[_0x919b('0x4c')](handleError(_0x2c6b2e,null));};exports['describe']=function(_0x446f5c,_0x2d3eab){return db[_0x919b('0x2f')][_0x919b('0x4f')]()[_0x919b('0x27')](respondWithResult(_0x2d3eab,null))[_0x919b('0x4c')](handleError(_0x2d3eab,null));}; \ No newline at end of file +var _0xac08=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','catch','show','params','keys','rawAttributes','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','offset','limit','reject','save','update','then','destroy','end','error','stack','name','send','map','OpenchannelTransferReport','fieldName','type','key','model','query'];(function(_0x200ca4,_0x2d603b){var _0x44f10b=function(_0x22fb99){while(--_0x22fb99){_0x200ca4['push'](_0x200ca4['shift']());}};_0x44f10b(++_0x2d603b);}(_0xac08,0x1f4));var _0x8ac0=function(_0x52cb00,_0x46d867){_0x52cb00=_0x52cb00-0x0;var _0x28d20c=_0xac08[_0x52cb00];return _0x28d20c;};'use strict';var emlformat=require(_0x8ac0('0x0'));var rimraf=require(_0x8ac0('0x1'));var zipdir=require(_0x8ac0('0x2'));var jsonpatch=require(_0x8ac0('0x3'));var rp=require('request-promise');var moment=require(_0x8ac0('0x4'));var BPromise=require(_0x8ac0('0x5'));var Mustache=require(_0x8ac0('0x6'));var util=require(_0x8ac0('0x7'));var path=require(_0x8ac0('0x8'));var sox=require(_0x8ac0('0x9'));var csv=require(_0x8ac0('0xa'));var ejs=require(_0x8ac0('0xb'));var fs=require('fs');var fs_extra=require(_0x8ac0('0xc'));var _=require(_0x8ac0('0xd'));var squel=require(_0x8ac0('0xe'));var crypto=require(_0x8ac0('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x8ac0('0x10'));var toCsv=require(_0x8ac0('0xa'));var querystring=require(_0x8ac0('0x11'));var Papa=require(_0x8ac0('0x12'));var Redis=require(_0x8ac0('0x13'));var authService=require(_0x8ac0('0x14'));var qs=require(_0x8ac0('0x15'));var as=require(_0x8ac0('0x16'));var hardwareService=require(_0x8ac0('0x17'));var logger=require(_0x8ac0('0x18'))(_0x8ac0('0x19'));var utils=require(_0x8ac0('0x1a'));var config=require(_0x8ac0('0x1b'));var licenseUtil=require(_0x8ac0('0x1c'));var db=require(_0x8ac0('0x1d'))['db'];function respondWithStatusCode(_0x5dc191,_0xb38804){_0xb38804=_0xb38804||0xcc;return function(_0x537edb){if(_0x537edb){return _0x5dc191[_0x8ac0('0x1e')](_0xb38804);}return _0x5dc191[_0x8ac0('0x1f')](_0xb38804)['end']();};}function respondWithResult(_0x5ca455,_0x5a8ae8){_0x5a8ae8=_0x5a8ae8||0xc8;return function(_0x4d651f){if(_0x4d651f){return _0x5ca455[_0x8ac0('0x1f')](_0x5a8ae8)[_0x8ac0('0x20')](_0x4d651f);}};}function respondWithFilteredResult(_0x2e21a0,_0x590fdc){return function(_0x56abba){if(_0x56abba){var _0x364566=typeof _0x590fdc['offset']===_0x8ac0('0x21')&&typeof _0x590fdc['limit']===_0x8ac0('0x21');var _0x302307=_0x56abba['count'];var _0x557457=_0x364566?0x0:_0x590fdc[_0x8ac0('0x22')];var _0x424708=_0x364566?_0x56abba['count']:_0x590fdc[_0x8ac0('0x22')]+_0x590fdc[_0x8ac0('0x23')];var _0x1e28d4;if(_0x424708>=_0x302307){_0x424708=_0x302307;_0x1e28d4=0xc8;}else{_0x1e28d4=0xce;}_0x2e21a0[_0x8ac0('0x1f')](_0x1e28d4);return _0x2e21a0['set']('Content-Range',_0x557457+'-'+_0x424708+'/'+_0x302307)['json'](_0x56abba);}return null;};}function patchUpdates(_0x5641ee){return function(_0x27ac62){try{jsonpatch['apply'](_0x27ac62,_0x5641ee,!![]);}catch(_0x7872b1){return BPromise[_0x8ac0('0x24')](_0x7872b1);}return _0x27ac62[_0x8ac0('0x25')]();};}function saveUpdates(_0x3a9f6e,_0x3d1937){return function(_0x4c39f4){if(_0x4c39f4){return _0x4c39f4[_0x8ac0('0x26')](_0x3a9f6e)[_0x8ac0('0x27')](function(_0x1aff1e){return _0x1aff1e;});}return null;};}function removeEntity(_0x1089f8,_0x579e40){return function(_0xd54372){if(_0xd54372){return _0xd54372[_0x8ac0('0x28')]()[_0x8ac0('0x27')](function(){_0x1089f8[_0x8ac0('0x1f')](0xcc)[_0x8ac0('0x29')]();});}};}function handleEntityNotFound(_0x2d222b,_0x49bf30){return function(_0x2add44){if(!_0x2add44){_0x2d222b[_0x8ac0('0x1e')](0x194);}return _0x2add44;};}function handleError(_0x2da45c,_0xfa732c){_0xfa732c=_0xfa732c||0x1f4;return function(_0x4350df){logger[_0x8ac0('0x2a')](_0x4350df[_0x8ac0('0x2b')]);if(_0x4350df['name']){delete _0x4350df[_0x8ac0('0x2c')];}_0x2da45c[_0x8ac0('0x1f')](_0xfa732c)[_0x8ac0('0x2d')](_0x4350df);};}exports['index']=function(_0x1315c6,_0xf5bda4){var _0x6111d1={},_0xf509b9={},_0x326a25={'count':0x0,'rows':[]};var _0x11cb11=_[_0x8ac0('0x2e')](db[_0x8ac0('0x2f')]['rawAttributes'],function(_0x497811){return{'name':_0x497811[_0x8ac0('0x30')],'type':_0x497811[_0x8ac0('0x31')][_0x8ac0('0x32')]};});_0xf509b9[_0x8ac0('0x33')]=_[_0x8ac0('0x2e')](_0x11cb11,_0x8ac0('0x2c'));_0xf509b9[_0x8ac0('0x34')]=_['keys'](_0x1315c6[_0x8ac0('0x34')]);_0xf509b9[_0x8ac0('0x35')]=_[_0x8ac0('0x36')](_0xf509b9['model'],_0xf509b9['query']);_0x6111d1[_0x8ac0('0x37')]=_[_0x8ac0('0x36')](_0xf509b9[_0x8ac0('0x33')],qs[_0x8ac0('0x38')](_0x1315c6['query'][_0x8ac0('0x38')]));_0x6111d1['attributes']=_0x6111d1['attributes'][_0x8ac0('0x39')]?_0x6111d1[_0x8ac0('0x37')]:_0xf509b9['model'];if(!_0x1315c6[_0x8ac0('0x34')][_0x8ac0('0x3a')](_0x8ac0('0x3b'))){_0x6111d1['limit']=qs[_0x8ac0('0x23')](_0x1315c6[_0x8ac0('0x34')][_0x8ac0('0x23')]);_0x6111d1['offset']=qs[_0x8ac0('0x22')](_0x1315c6[_0x8ac0('0x34')]['offset']);}_0x6111d1[_0x8ac0('0x3c')]=qs[_0x8ac0('0x3d')](_0x1315c6['query'][_0x8ac0('0x3d')]);_0x6111d1[_0x8ac0('0x3e')]=qs[_0x8ac0('0x35')](_[_0x8ac0('0x3f')](_0x1315c6[_0x8ac0('0x34')],_0xf509b9[_0x8ac0('0x35')]),_0x11cb11);if(_0x1315c6[_0x8ac0('0x34')][_0x8ac0('0x40')]){_0x6111d1['where']=_['merge'](_0x6111d1[_0x8ac0('0x3e')],{'$or':_[_0x8ac0('0x2e')](_0x11cb11,function(_0x5e4bca){if(_0x5e4bca[_0x8ac0('0x31')]!==_0x8ac0('0x41')){var _0x140412={};_0x140412[_0x5e4bca[_0x8ac0('0x2c')]]={'$like':'%'+_0x1315c6[_0x8ac0('0x34')][_0x8ac0('0x40')]+'%'};return _0x140412;}})});}_0x6111d1=_[_0x8ac0('0x42')]({},_0x6111d1,_0x1315c6[_0x8ac0('0x43')]);var _0x524403={'where':_0x6111d1[_0x8ac0('0x3e')]};return db[_0x8ac0('0x2f')][_0x8ac0('0x44')](_0x524403)[_0x8ac0('0x27')](function(_0x3a7c1d){_0x326a25[_0x8ac0('0x44')]=_0x3a7c1d;if(_0x1315c6[_0x8ac0('0x34')][_0x8ac0('0x45')]){_0x6111d1[_0x8ac0('0x46')]=[{'all':!![]}];}return db['OpenchannelTransferReport']['findAll'](_0x6111d1);})['then'](function(_0x2a9405){_0x326a25['rows']=_0x2a9405;return _0x326a25;})[_0x8ac0('0x27')](respondWithFilteredResult(_0xf5bda4,_0x6111d1))[_0x8ac0('0x47')](handleError(_0xf5bda4,null));};exports[_0x8ac0('0x48')]=function(_0x30c5e0,_0x54b9f4){var _0x163bfc={'raw':!![],'where':{'id':_0x30c5e0[_0x8ac0('0x49')]['id']}},_0x5e7067={};_0x5e7067[_0x8ac0('0x33')]=_[_0x8ac0('0x4a')](db['OpenchannelTransferReport'][_0x8ac0('0x4b')]);_0x5e7067[_0x8ac0('0x34')]=_[_0x8ac0('0x4a')](_0x30c5e0[_0x8ac0('0x34')]);_0x5e7067['filters']=_[_0x8ac0('0x36')](_0x5e7067[_0x8ac0('0x33')],_0x5e7067['query']);_0x163bfc[_0x8ac0('0x37')]=_[_0x8ac0('0x36')](_0x5e7067[_0x8ac0('0x33')],qs[_0x8ac0('0x38')](_0x30c5e0['query']['fields']));_0x163bfc['attributes']=_0x163bfc[_0x8ac0('0x37')][_0x8ac0('0x39')]?_0x163bfc['attributes']:_0x5e7067[_0x8ac0('0x33')];if(_0x30c5e0[_0x8ac0('0x34')][_0x8ac0('0x45')]){_0x163bfc[_0x8ac0('0x46')]=[{'all':!![]}];}_0x163bfc=_[_0x8ac0('0x42')]({},_0x163bfc,_0x30c5e0[_0x8ac0('0x43')]);return db[_0x8ac0('0x2f')]['find'](_0x163bfc)[_0x8ac0('0x27')](handleEntityNotFound(_0x54b9f4,null))['then'](respondWithResult(_0x54b9f4,null))[_0x8ac0('0x47')](handleError(_0x54b9f4,null));};exports[_0x8ac0('0x4c')]=function(_0x51f64b,_0x185e9c){return db[_0x8ac0('0x2f')]['create'](_0x51f64b[_0x8ac0('0x4d')],{})['then'](respondWithResult(_0x185e9c,0xc9))[_0x8ac0('0x47')](handleError(_0x185e9c,null));};exports[_0x8ac0('0x26')]=function(_0x183619,_0x27606f){if(_0x183619['body']['id']){delete _0x183619['body']['id'];}return db[_0x8ac0('0x2f')]['find']({'where':{'id':_0x183619[_0x8ac0('0x49')]['id']}})['then'](handleEntityNotFound(_0x27606f,null))[_0x8ac0('0x27')](saveUpdates(_0x183619[_0x8ac0('0x4d')],null))['then'](respondWithResult(_0x27606f,null))[_0x8ac0('0x47')](handleError(_0x27606f,null));};exports[_0x8ac0('0x28')]=function(_0x18d07c,_0x240c04){return db[_0x8ac0('0x2f')]['find']({'where':{'id':_0x18d07c['params']['id']}})['then'](handleEntityNotFound(_0x240c04,null))['then'](removeEntity(_0x240c04,null))[_0x8ac0('0x47')](handleError(_0x240c04,null));};exports['describe']=function(_0x59640a,_0x28dcea){return db[_0x8ac0('0x2f')][_0x8ac0('0x4e')]()[_0x8ac0('0x27')](respondWithResult(_0x28dcea,null))[_0x8ac0('0x47')](handleError(_0x28dcea,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index f1e440a..7f9d905 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 _0xaf05=['api','moment','bluebird','request-promise','path','rimraf','./openchannelTransferReport.attributes','define','OpenchannelTransferReport','uniqueid','lodash','util'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xaf05,0x17e));var _0x5af0=function(_0x281fff,_0x287e7d){_0x281fff=_0x281fff-0x0;var _0x4fc79b=_0xaf05[_0x281fff];return _0x4fc79b;};'use strict';var _=require(_0x5af0('0x0'));var util=require(_0x5af0('0x1'));var logger=require('../../config/logger')(_0x5af0('0x2'));var moment=require(_0x5af0('0x3'));var BPromise=require(_0x5af0('0x4'));var rp=require(_0x5af0('0x5'));var fs=require('fs');var path=require(_0x5af0('0x6'));var rimraf=require(_0x5af0('0x7'));var config=require('../../config/environment');var attributes=require(_0x5af0('0x8'));module['exports']=function(_0x8a6b5,_0xaeccf3){return _0x8a6b5[_0x5af0('0x9')](_0x5af0('0xa'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x5af0('0xb'),'fields':[_0x5af0('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb822=['path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','uniqueid','lodash','../../config/logger','api','moment'];(function(_0x493cea,_0x144c6a){var _0x1c32ba=function(_0x47c0f9){while(--_0x47c0f9){_0x493cea['push'](_0x493cea['shift']());}};_0x1c32ba(++_0x144c6a);}(_0xb822,0x164));var _0x2b82=function(_0x45d422,_0x5ab69c){_0x45d422=_0x45d422-0x0;var _0x5bb89a=_0xb822[_0x45d422];return _0x5bb89a;};'use strict';var _=require(_0x2b82('0x0'));var util=require('util');var logger=require(_0x2b82('0x1'))(_0x2b82('0x2'));var moment=require(_0x2b82('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2b82('0x4'));var rimraf=require(_0x2b82('0x5'));var config=require(_0x2b82('0x6'));var attributes=require(_0x2b82('0x7'));module[_0x2b82('0x8')]=function(_0x1f1020,_0x42c1bb){return _0x1f1020['define']('OpenchannelTransferReport',attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x2b82('0x9'),'fields':[_0x2b82('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 7ffba6b..57d796c 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 _0x3248=['OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0x3248,0x1bc));var _0x8324=function(_0x2e0721,_0x10ee64){_0x2e0721=_0x2e0721-0x0;var _0x401ce1=_0x3248[_0x2e0721];return _0x401ce1;};'use strict';var _=require('lodash');var util=require(_0x8324('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8324('0x1'));var fs=require('fs');var Redis=require(_0x8324('0x2'));var db=require(_0x8324('0x3'))['db'];var utils=require(_0x8324('0x4'));var logger=require(_0x8324('0x5'))(_0x8324('0x6'));var config=require('../../config/environment');var jayson=require(_0x8324('0x7'));var client=jayson[_0x8324('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25ee7a,_0x459a62,_0x4302c5){return new BPromise(function(_0x1514c0,_0x5a482d){return client[_0x8324('0x9')](_0x25ee7a,_0x4302c5)[_0x8324('0xa')](function(_0x3f00e6){logger[_0x8324('0xb')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x459a62,_0x8324('0xc'));logger[_0x8324('0xd')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x459a62,_0x8324('0xc'),JSON[_0x8324('0xe')](_0x3f00e6));if(_0x3f00e6['error']){if(_0x3f00e6['error']['code']===0x1f4){logger[_0x8324('0xf')](_0x8324('0x10'),_0x459a62,_0x3f00e6[_0x8324('0xf')][_0x8324('0x11')]);return _0x5a482d(_0x3f00e6['error'][_0x8324('0x11')]);}logger[_0x8324('0xf')](_0x8324('0x10'),_0x459a62,_0x3f00e6[_0x8324('0xf')][_0x8324('0x11')]);return _0x1514c0(_0x3f00e6['error'][_0x8324('0x11')]);}else{logger[_0x8324('0xb')](_0x8324('0x10'),_0x459a62,_0x8324('0xc'));_0x1514c0(_0x3f00e6[_0x8324('0x12')]['message']);}})[_0x8324('0x13')](function(_0xaf20a5){logger[_0x8324('0xf')](_0x8324('0x10'),_0x459a62,_0xaf20a5);_0x5a482d(_0xaf20a5);});});} \ No newline at end of file +var _0x1a61=['error','code','OpenchannelTransferReport,\x20%s,\x20%s','message','request\x20sent','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xaac2fd,_0x5357a7){var _0x57c27a=function(_0x28293f){while(--_0x28293f){_0xaac2fd['push'](_0xaac2fd['shift']());}};_0x57c27a(++_0x5357a7);}(_0x1a61,0x1e6));var _0x11a6=function(_0x1d87e0,_0x803ba0){_0x1d87e0=_0x1d87e0-0x0;var _0x14fa69=_0x1a61[_0x1d87e0];return _0x14fa69;};'use strict';var _=require(_0x11a6('0x0'));var util=require('util');var moment=require(_0x11a6('0x1'));var BPromise=require('bluebird');var rs=require(_0x11a6('0x2'));var fs=require('fs');var Redis=require(_0x11a6('0x3'));var db=require(_0x11a6('0x4'))['db'];var utils=require(_0x11a6('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x11a6('0x6'));var jayson=require(_0x11a6('0x7'));var client=jayson['client'][_0x11a6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1c4b31,_0x124855,_0x333ec2){return new BPromise(function(_0x1c67ce,_0x33b9b4){return client[_0x11a6('0x9')](_0x1c4b31,_0x333ec2)[_0x11a6('0xa')](function(_0x1a7d57){logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x124855,'request\x20sent');logger[_0x11a6('0xb')](_0x11a6('0xc'),_0x124855,'request\x20sent',JSON[_0x11a6('0xd')](_0x1a7d57));if(_0x1a7d57[_0x11a6('0xe')]){if(_0x1a7d57[_0x11a6('0xe')][_0x11a6('0xf')]===0x1f4){logger[_0x11a6('0xe')](_0x11a6('0x10'),_0x124855,_0x1a7d57['error']['message']);return _0x33b9b4(_0x1a7d57[_0x11a6('0xe')][_0x11a6('0x11')]);}logger['error'](_0x11a6('0x10'),_0x124855,_0x1a7d57[_0x11a6('0xe')]['message']);return _0x1c67ce(_0x1a7d57[_0x11a6('0xe')][_0x11a6('0x11')]);}else{logger['info'](_0x11a6('0x10'),_0x124855,_0x11a6('0x12'));_0x1c67ce(_0x1a7d57[_0x11a6('0x13')][_0x11a6('0x11')]);}})['catch'](function(_0x3d6457){logger[_0x11a6('0xe')](_0x11a6('0x10'),_0x124855,_0x3d6457);_0x33b9b4(_0x3d6457);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 37843da..6ceefe7 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 _0xef2b=['../../config/environment','./pause.controller','index','/:id','isAuthenticated','show','post','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x306097,_0x1e1a54){var _0x4406c4=function(_0x217045){while(--_0x217045){_0x306097['push'](_0x306097['shift']());}};_0x4406c4(++_0x1e1a54);}(_0xef2b,0x1c4));var _0xbef2=function(_0x42f90b,_0xd741e0){_0x42f90b=_0x42f90b-0x0;var _0x8c3a47=_0xef2b[_0x42f90b];return _0x8c3a47;};'use strict';var multer=require('multer');var util=require(_0xbef2('0x0'));var path=require('path');var timeout=require(_0xbef2('0x1'));var express=require(_0xbef2('0x2'));var router=express[_0xbef2('0x3')]();var fs_extra=require(_0xbef2('0x4'));var auth=require(_0xbef2('0x5'));var interaction=require(_0xbef2('0x6'));var config=require(_0xbef2('0x7'));var controller=require(_0xbef2('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xbef2('0x9')]);router['get'](_0xbef2('0xa'),auth[_0xbef2('0xb')](),controller[_0xbef2('0xc')]);router[_0xbef2('0xd')]('/',auth[_0xbef2('0xb')](),controller['create']);router['put'](_0xbef2('0xa'),auth[_0xbef2('0xb')](),controller['update']);router[_0xbef2('0xe')](_0xbef2('0xa'),auth[_0xbef2('0xb')](),controller[_0xbef2('0xf')]);module[_0xbef2('0x10')]=router; \ No newline at end of file +var _0x52f2=['/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','show','post','create','put'];(function(_0x3b3f4f,_0x403216){var _0x174dbe=function(_0x30e333){while(--_0x30e333){_0x3b3f4f['push'](_0x3b3f4f['shift']());}};_0x174dbe(++_0x403216);}(_0x52f2,0x98));var _0x252f=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0x52f2[_0x38a7ac];return _0x53061a;};'use strict';var multer=require(_0x252f('0x0'));var util=require(_0x252f('0x1'));var path=require(_0x252f('0x2'));var timeout=require(_0x252f('0x3'));var express=require(_0x252f('0x4'));var router=express[_0x252f('0x5')]();var fs_extra=require(_0x252f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x252f('0x7'));var config=require(_0x252f('0x8'));var controller=require(_0x252f('0x9'));router[_0x252f('0xa')]('/',auth[_0x252f('0xb')](),controller['index']);router[_0x252f('0xa')]('/:id',auth[_0x252f('0xb')](),controller[_0x252f('0xc')]);router[_0x252f('0xd')]('/',auth[_0x252f('0xb')](),controller[_0x252f('0xe')]);router[_0x252f('0xf')](_0x252f('0x10'),auth[_0x252f('0xb')](),controller[_0x252f('0x11')]);router[_0x252f('0x12')]('/:id',auth[_0x252f('0xb')](),controller[_0x252f('0x13')]);module[_0x252f('0x14')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 541ee61..52079c2 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 _0x72d7=['exports','STRING','name','sequelize'];(function(_0x3faa37,_0x114d24){var _0x2a06c7=function(_0x1b153c){while(--_0x1b153c){_0x3faa37['push'](_0x3faa37['shift']());}};_0x2a06c7(++_0x114d24);}(_0x72d7,0xc7));var _0x772d=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0x72d7[_0x54d4fe];return _0x1ab5bb;};'use strict';var Sequelize=require(_0x772d('0x0'));module[_0x772d('0x1')]={'name':{'type':Sequelize[_0x772d('0x2')],'unique':_0x772d('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x772d('0x2')]}}; \ No newline at end of file +var _0xe087=['STRING','name','sequelize'];(function(_0x345224,_0x23c1fb){var _0x1ecd76=function(_0x2257fc){while(--_0x2257fc){_0x345224['push'](_0x345224['shift']());}};_0x1ecd76(++_0x23c1fb);}(_0xe087,0xec));var _0x7e08=function(_0xf5f742,_0x1cae18){_0xf5f742=_0xf5f742-0x0;var _0x45aebc=_0xe087[_0xf5f742];return _0x45aebc;};'use strict';var Sequelize=require(_0x7e08('0x0'));module['exports']={'name':{'type':Sequelize[_0x7e08('0x1')],'unique':_0x7e08('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x7e08('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 09eba90..aed6b13 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 _0x105e=['count','offset','set','Content-Range','apply','reject','save','update','then','get','Pauses','UserProfileResource','destroy','end','error','stack','name','index','map','Pause','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','undefined','limit'];(function(_0x13e31c,_0x1ff375){var _0x491381=function(_0x5205db){while(--_0x5205db){_0x13e31c['push'](_0x13e31c['shift']());}};_0x491381(++_0x1ff375);}(_0x105e,0x1cf));var _0xe105=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x105e[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xe105('0x0'));var rimraf=require(_0xe105('0x1'));var zipdir=require(_0xe105('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe105('0x3'));var moment=require(_0xe105('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe105('0x5'));var path=require(_0xe105('0x6'));var sox=require(_0xe105('0x7'));var csv=require(_0xe105('0x8'));var ejs=require(_0xe105('0x9'));var fs=require('fs');var fs_extra=require(_0xe105('0xa'));var _=require(_0xe105('0xb'));var squel=require(_0xe105('0xc'));var crypto=require(_0xe105('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe105('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe105('0xf'));var Papa=require(_0xe105('0x10'));var Redis=require(_0xe105('0x11'));var authService=require(_0xe105('0x12'));var qs=require(_0xe105('0x13'));var as=require(_0xe105('0x14'));var hardwareService=require(_0xe105('0x15'));var logger=require(_0xe105('0x16'))('api');var utils=require(_0xe105('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe105('0x18'))['db'];function respondWithStatusCode(_0x438414,_0x12bdab){_0x12bdab=_0x12bdab||0xcc;return function(_0x46c6b6){if(_0x46c6b6){return _0x438414[_0xe105('0x19')](_0x12bdab);}return _0x438414[_0xe105('0x1a')](_0x12bdab)['end']();};}function respondWithResult(_0x23131f,_0x1c036d){_0x1c036d=_0x1c036d||0xc8;return function(_0x4a431b){if(_0x4a431b){return _0x23131f[_0xe105('0x1a')](_0x1c036d)['json'](_0x4a431b);}};}function respondWithFilteredResult(_0x4abd16,_0x415685){return function(_0x4fb76d){if(_0x4fb76d){var _0x4a46e6=typeof _0x415685['offset']===_0xe105('0x1b')&&typeof _0x415685[_0xe105('0x1c')]==='undefined';var _0x476892=_0x4fb76d[_0xe105('0x1d')];var _0xd194b6=_0x4a46e6?0x0:_0x415685[_0xe105('0x1e')];var _0x564629=_0x4a46e6?_0x4fb76d['count']:_0x415685['offset']+_0x415685[_0xe105('0x1c')];var _0xcb9539;if(_0x564629>=_0x476892){_0x564629=_0x476892;_0xcb9539=0xc8;}else{_0xcb9539=0xce;}_0x4abd16[_0xe105('0x1a')](_0xcb9539);return _0x4abd16[_0xe105('0x1f')](_0xe105('0x20'),_0xd194b6+'-'+_0x564629+'/'+_0x476892)['json'](_0x4fb76d);}return null;};}function patchUpdates(_0x56a743){return function(_0x3906d3){try{jsonpatch[_0xe105('0x21')](_0x3906d3,_0x56a743,!![]);}catch(_0x43af06){return BPromise[_0xe105('0x22')](_0x43af06);}return _0x3906d3[_0xe105('0x23')]();};}function saveUpdates(_0x586bc1,_0x457d01){return function(_0x3f59de){if(_0x3f59de){return _0x3f59de[_0xe105('0x24')](_0x586bc1)[_0xe105('0x25')](function(_0x513368){return _0x513368;});}return null;};}function removeEntity(_0x1cb8fd,_0x3fe6fa){return function(_0x1d9b0d){if(_0x1d9b0d){return _0x1d9b0d['destroy']()[_0xe105('0x25')](function(){var _0x4db8d1=_0x1d9b0d[_0xe105('0x26')]({'plain':!![]});var _0x32fff9=_0xe105('0x27');return db[_0xe105('0x28')][_0xe105('0x29')]({'where':{'type':_0x32fff9,'resourceId':_0x4db8d1['id']}})[_0xe105('0x25')](function(){return _0x1d9b0d;});})[_0xe105('0x25')](function(){_0x1cb8fd[_0xe105('0x1a')](0xcc)[_0xe105('0x2a')]();});}};}function handleEntityNotFound(_0x179221,_0x2e04be){return function(_0x16f2cb){if(!_0x16f2cb){_0x179221[_0xe105('0x19')](0x194);}return _0x16f2cb;};}function handleError(_0x2e5fcc,_0x26de5a){_0x26de5a=_0x26de5a||0x1f4;return function(_0x2d79b0){logger[_0xe105('0x2b')](_0x2d79b0[_0xe105('0x2c')]);if(_0x2d79b0['name']){delete _0x2d79b0[_0xe105('0x2d')];}_0x2e5fcc['status'](_0x26de5a)['send'](_0x2d79b0);};}exports[_0xe105('0x2e')]=function(_0x3820a6,_0x1f02d){var _0x6d7ac1={},_0x5820e8={},_0x37c537={'count':0x0,'rows':[]};var _0x2bbab1=_[_0xe105('0x2f')](db[_0xe105('0x30')][_0xe105('0x31')],function(_0x28c915){return{'name':_0x28c915[_0xe105('0x32')],'type':_0x28c915['type'][_0xe105('0x33')]};});_0x5820e8[_0xe105('0x34')]=_['map'](_0x2bbab1,_0xe105('0x2d'));_0x5820e8[_0xe105('0x35')]=_['keys'](_0x3820a6['query']);_0x5820e8[_0xe105('0x36')]=_[_0xe105('0x37')](_0x5820e8[_0xe105('0x34')],_0x5820e8['query']);_0x6d7ac1[_0xe105('0x38')]=_[_0xe105('0x37')](_0x5820e8[_0xe105('0x34')],qs[_0xe105('0x39')](_0x3820a6[_0xe105('0x35')]['fields']));_0x6d7ac1['attributes']=_0x6d7ac1[_0xe105('0x38')][_0xe105('0x3a')]?_0x6d7ac1[_0xe105('0x38')]:_0x5820e8[_0xe105('0x34')];if(!_0x3820a6[_0xe105('0x35')][_0xe105('0x3b')](_0xe105('0x3c'))){_0x6d7ac1[_0xe105('0x1c')]=qs['limit'](_0x3820a6['query'][_0xe105('0x1c')]);_0x6d7ac1[_0xe105('0x1e')]=qs[_0xe105('0x1e')](_0x3820a6[_0xe105('0x35')][_0xe105('0x1e')]);}_0x6d7ac1['order']=qs[_0xe105('0x3d')](_0x3820a6[_0xe105('0x35')][_0xe105('0x3d')]);_0x6d7ac1['where']=qs['filters'](_[_0xe105('0x3e')](_0x3820a6[_0xe105('0x35')],_0x5820e8['filters']),_0x2bbab1);if(_0x3820a6[_0xe105('0x35')]['filter']){_0x6d7ac1[_0xe105('0x3f')]=_[_0xe105('0x40')](_0x6d7ac1[_0xe105('0x3f')],{'$or':_[_0xe105('0x2f')](_0x2bbab1,function(_0x17aeb1){if(_0x17aeb1['type']!==_0xe105('0x41')){var _0x2bd56d={};_0x2bd56d[_0x17aeb1[_0xe105('0x2d')]]={'$like':'%'+_0x3820a6[_0xe105('0x35')][_0xe105('0x42')]+'%'};return _0x2bd56d;}})});}_0x6d7ac1=_[_0xe105('0x40')]({},_0x6d7ac1,_0x3820a6[_0xe105('0x43')]);var _0x51ba49={'where':_0x6d7ac1[_0xe105('0x3f')]};return db[_0xe105('0x30')][_0xe105('0x1d')](_0x51ba49)['then'](function(_0x212d66){_0x37c537[_0xe105('0x1d')]=_0x212d66;if(_0x3820a6[_0xe105('0x35')][_0xe105('0x44')]){_0x6d7ac1[_0xe105('0x45')]=[{'all':!![]}];}return db[_0xe105('0x30')]['findAll'](_0x6d7ac1);})[_0xe105('0x25')](function(_0x26c387){_0x37c537[_0xe105('0x46')]=_0x26c387;return _0x37c537;})[_0xe105('0x25')](respondWithFilteredResult(_0x1f02d,_0x6d7ac1))[_0xe105('0x47')](handleError(_0x1f02d,null));};exports[_0xe105('0x48')]=function(_0x5ca59e,_0x232f3d){var _0x5d64c7={'raw':!![],'where':{'id':_0x5ca59e[_0xe105('0x49')]['id']}},_0x16efe8={};_0x16efe8['model']=_['keys'](db[_0xe105('0x30')][_0xe105('0x31')]);_0x16efe8['query']=_[_0xe105('0x4a')](_0x5ca59e[_0xe105('0x35')]);_0x16efe8['filters']=_[_0xe105('0x37')](_0x16efe8[_0xe105('0x34')],_0x16efe8['query']);_0x5d64c7[_0xe105('0x38')]=_[_0xe105('0x37')](_0x16efe8['model'],qs[_0xe105('0x39')](_0x5ca59e[_0xe105('0x35')][_0xe105('0x39')]));_0x5d64c7[_0xe105('0x38')]=_0x5d64c7['attributes'][_0xe105('0x3a')]?_0x5d64c7[_0xe105('0x38')]:_0x16efe8[_0xe105('0x34')];if(_0x5ca59e[_0xe105('0x35')][_0xe105('0x44')]){_0x5d64c7[_0xe105('0x45')]=[{'all':!![]}];}_0x5d64c7=_[_0xe105('0x40')]({},_0x5d64c7,_0x5ca59e[_0xe105('0x43')]);return db[_0xe105('0x30')][_0xe105('0x4b')](_0x5d64c7)['then'](handleEntityNotFound(_0x232f3d,null))[_0xe105('0x25')](respondWithResult(_0x232f3d,null))[_0xe105('0x47')](handleError(_0x232f3d,null));};exports[_0xe105('0x4c')]=function(_0x205299,_0x148bf3){return db['Pause'][_0xe105('0x4c')](_0x205299[_0xe105('0x4d')],{})[_0xe105('0x25')](function(_0x1810ad){var _0x3e0f1e=_0x205299[_0xe105('0x4e')][_0xe105('0x26')]({'plain':!![]});if(!_0x3e0f1e)throw new Error(_0xe105('0x4f'));if(_0x3e0f1e[_0xe105('0x50')]===_0xe105('0x4e')){var _0x20f35f=_0x1810ad[_0xe105('0x26')]({'plain':!![]});var _0x1f3ee2=_0xe105('0x27');return db[_0xe105('0x51')][_0xe105('0x4b')]({'where':{'name':_0x1f3ee2,'userProfileId':_0x3e0f1e['userProfileId']},'raw':!![]})[_0xe105('0x25')](function(_0x334cc1){if(_0x334cc1&&_0x334cc1['autoAssociation']===0x0){return db[_0xe105('0x28')][_0xe105('0x4c')]({'name':_0x20f35f[_0xe105('0x2d')],'resourceId':_0x20f35f['id'],'type':_0x334cc1[_0xe105('0x2d')],'sectionId':_0x334cc1['id']},{})['then'](function(){return _0x1810ad;});}else{return _0x1810ad;}})['catch'](function(_0x2f4750){logger[_0xe105('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2f4750);throw _0x2f4750;});}return _0x1810ad;})[_0xe105('0x25')](respondWithResult(_0x148bf3,0xc9))['catch'](handleError(_0x148bf3,null));};exports[_0xe105('0x24')]=function(_0x2833e4,_0xc141c4){if(_0x2833e4[_0xe105('0x4d')]['id']){delete _0x2833e4[_0xe105('0x4d')]['id'];}return db[_0xe105('0x30')][_0xe105('0x4b')]({'where':{'id':_0x2833e4[_0xe105('0x49')]['id']}})[_0xe105('0x25')](handleEntityNotFound(_0xc141c4,null))[_0xe105('0x25')](saveUpdates(_0x2833e4[_0xe105('0x4d')],null))[_0xe105('0x25')](respondWithResult(_0xc141c4,null))[_0xe105('0x47')](handleError(_0xc141c4,null));};exports[_0xe105('0x29')]=function(_0x4984c2,_0x26f696){return db['Pause'][_0xe105('0x4b')]({'where':{'id':_0x4984c2[_0xe105('0x49')]['id']}})[_0xe105('0x25')](handleEntityNotFound(_0x26f696,null))['then'](removeEntity(_0x26f696,null))[_0xe105('0x47')](handleError(_0x26f696,null));}; \ No newline at end of file +var _0x0c70=['catch','show','params','fields','includeAll','include','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','body','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','send','index','rawAttributes','type','map','keys','query','intersection','model','attributes','length','hasOwnProperty','sort','where','filters','VIRTUAL','filter','merge','options','Pause','findAll','rows'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x0c70,0xac));var _0x00c7=function(_0x465285,_0x346fb0){_0x465285=_0x465285-0x0;var _0x311846=_0x0c70[_0x465285];return _0x311846;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x00c7('0x0'));var jsonpatch=require(_0x00c7('0x1'));var rp=require('request-promise');var moment=require(_0x00c7('0x2'));var BPromise=require(_0x00c7('0x3'));var Mustache=require(_0x00c7('0x4'));var util=require(_0x00c7('0x5'));var path=require(_0x00c7('0x6'));var sox=require(_0x00c7('0x7'));var csv=require(_0x00c7('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x00c7('0x9'));var _=require(_0x00c7('0xa'));var squel=require('squel');var crypto=require(_0x00c7('0xb'));var jsforce=require(_0x00c7('0xc'));var deskjs=require(_0x00c7('0xd'));var toCsv=require(_0x00c7('0x8'));var querystring=require(_0x00c7('0xe'));var Papa=require(_0x00c7('0xf'));var Redis=require(_0x00c7('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x00c7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x00c7('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x00c7('0x13'));var config=require(_0x00c7('0x14'));var licenseUtil=require(_0x00c7('0x15'));var db=require(_0x00c7('0x16'))['db'];function respondWithStatusCode(_0x5ba7b4,_0x2cbaf6){_0x2cbaf6=_0x2cbaf6||0xcc;return function(_0x42f3dc){if(_0x42f3dc){return _0x5ba7b4[_0x00c7('0x17')](_0x2cbaf6);}return _0x5ba7b4[_0x00c7('0x18')](_0x2cbaf6)[_0x00c7('0x19')]();};}function respondWithResult(_0x321a4e,_0x3a7c55){_0x3a7c55=_0x3a7c55||0xc8;return function(_0x4e1d97){if(_0x4e1d97){return _0x321a4e[_0x00c7('0x18')](_0x3a7c55)[_0x00c7('0x1a')](_0x4e1d97);}};}function respondWithFilteredResult(_0x25fbf6,_0x24458e){return function(_0x1fe85f){if(_0x1fe85f){var _0x132352=typeof _0x24458e['offset']===_0x00c7('0x1b')&&typeof _0x24458e[_0x00c7('0x1c')]==='undefined';var _0x3cc18e=_0x1fe85f[_0x00c7('0x1d')];var _0xf9ebf2=_0x132352?0x0:_0x24458e['offset'];var _0x40203b=_0x132352?_0x1fe85f[_0x00c7('0x1d')]:_0x24458e[_0x00c7('0x1e')]+_0x24458e['limit'];var _0x45b633;if(_0x40203b>=_0x3cc18e){_0x40203b=_0x3cc18e;_0x45b633=0xc8;}else{_0x45b633=0xce;}_0x25fbf6[_0x00c7('0x18')](_0x45b633);return _0x25fbf6[_0x00c7('0x1f')](_0x00c7('0x20'),_0xf9ebf2+'-'+_0x40203b+'/'+_0x3cc18e)['json'](_0x1fe85f);}return null;};}function patchUpdates(_0x360451){return function(_0x4891c9){try{jsonpatch[_0x00c7('0x21')](_0x4891c9,_0x360451,!![]);}catch(_0x23b041){return BPromise[_0x00c7('0x22')](_0x23b041);}return _0x4891c9[_0x00c7('0x23')]();};}function saveUpdates(_0x1a12b8,_0x1c5f3c){return function(_0x30a4ee){if(_0x30a4ee){return _0x30a4ee['update'](_0x1a12b8)[_0x00c7('0x24')](function(_0x52248e){return _0x52248e;});}return null;};}function removeEntity(_0x3f47a4,_0x3ea3e9){return function(_0x32361c){if(_0x32361c){return _0x32361c[_0x00c7('0x25')]()[_0x00c7('0x24')](function(){var _0x3c86c7=_0x32361c[_0x00c7('0x26')]({'plain':!![]});var _0x2f15c2='Pauses';return db[_0x00c7('0x27')][_0x00c7('0x25')]({'where':{'type':_0x2f15c2,'resourceId':_0x3c86c7['id']}})[_0x00c7('0x24')](function(){return _0x32361c;});})[_0x00c7('0x24')](function(){_0x3f47a4[_0x00c7('0x18')](0xcc)[_0x00c7('0x19')]();});}};}function handleEntityNotFound(_0x5ae068,_0x428e6a){return function(_0x5b9157){if(!_0x5b9157){_0x5ae068[_0x00c7('0x17')](0x194);}return _0x5b9157;};}function handleError(_0x559421,_0x432b18){_0x432b18=_0x432b18||0x1f4;return function(_0x3ccc83){logger[_0x00c7('0x28')](_0x3ccc83[_0x00c7('0x29')]);if(_0x3ccc83[_0x00c7('0x2a')]){delete _0x3ccc83[_0x00c7('0x2a')];}_0x559421['status'](_0x432b18)[_0x00c7('0x2b')](_0x3ccc83);};}exports[_0x00c7('0x2c')]=function(_0xe51e06,_0x47860c){var _0x12aee9={},_0x36b6fc={},_0x20069f={'count':0x0,'rows':[]};var _0x3896ed=_['map'](db['Pause'][_0x00c7('0x2d')],function(_0x2284e4){return{'name':_0x2284e4['fieldName'],'type':_0x2284e4[_0x00c7('0x2e')]['key']};});_0x36b6fc['model']=_[_0x00c7('0x2f')](_0x3896ed,_0x00c7('0x2a'));_0x36b6fc['query']=_[_0x00c7('0x30')](_0xe51e06[_0x00c7('0x31')]);_0x36b6fc['filters']=_[_0x00c7('0x32')](_0x36b6fc[_0x00c7('0x33')],_0x36b6fc[_0x00c7('0x31')]);_0x12aee9[_0x00c7('0x34')]=_[_0x00c7('0x32')](_0x36b6fc[_0x00c7('0x33')],qs['fields'](_0xe51e06[_0x00c7('0x31')]['fields']));_0x12aee9[_0x00c7('0x34')]=_0x12aee9['attributes'][_0x00c7('0x35')]?_0x12aee9[_0x00c7('0x34')]:_0x36b6fc['model'];if(!_0xe51e06['query'][_0x00c7('0x36')]('nolimit')){_0x12aee9[_0x00c7('0x1c')]=qs['limit'](_0xe51e06[_0x00c7('0x31')][_0x00c7('0x1c')]);_0x12aee9[_0x00c7('0x1e')]=qs[_0x00c7('0x1e')](_0xe51e06['query'][_0x00c7('0x1e')]);}_0x12aee9['order']=qs[_0x00c7('0x37')](_0xe51e06[_0x00c7('0x31')][_0x00c7('0x37')]);_0x12aee9[_0x00c7('0x38')]=qs[_0x00c7('0x39')](_['pick'](_0xe51e06[_0x00c7('0x31')],_0x36b6fc[_0x00c7('0x39')]),_0x3896ed);if(_0xe51e06['query']['filter']){_0x12aee9['where']=_['merge'](_0x12aee9[_0x00c7('0x38')],{'$or':_[_0x00c7('0x2f')](_0x3896ed,function(_0x402e8f){if(_0x402e8f['type']!==_0x00c7('0x3a')){var _0x161d6d={};_0x161d6d[_0x402e8f[_0x00c7('0x2a')]]={'$like':'%'+_0xe51e06['query'][_0x00c7('0x3b')]+'%'};return _0x161d6d;}})});}_0x12aee9=_[_0x00c7('0x3c')]({},_0x12aee9,_0xe51e06[_0x00c7('0x3d')]);var _0x4d4442={'where':_0x12aee9[_0x00c7('0x38')]};return db['Pause']['count'](_0x4d4442)[_0x00c7('0x24')](function(_0x326c70){_0x20069f[_0x00c7('0x1d')]=_0x326c70;if(_0xe51e06[_0x00c7('0x31')]['includeAll']){_0x12aee9['include']=[{'all':!![]}];}return db[_0x00c7('0x3e')][_0x00c7('0x3f')](_0x12aee9);})[_0x00c7('0x24')](function(_0x589bfa){_0x20069f[_0x00c7('0x40')]=_0x589bfa;return _0x20069f;})[_0x00c7('0x24')](respondWithFilteredResult(_0x47860c,_0x12aee9))[_0x00c7('0x41')](handleError(_0x47860c,null));};exports[_0x00c7('0x42')]=function(_0xaf79d8,_0x1bcd6d){var _0x3a4a1c={'raw':!![],'where':{'id':_0xaf79d8[_0x00c7('0x43')]['id']}},_0x5017de={};_0x5017de[_0x00c7('0x33')]=_[_0x00c7('0x30')](db['Pause'][_0x00c7('0x2d')]);_0x5017de[_0x00c7('0x31')]=_[_0x00c7('0x30')](_0xaf79d8[_0x00c7('0x31')]);_0x5017de[_0x00c7('0x39')]=_[_0x00c7('0x32')](_0x5017de[_0x00c7('0x33')],_0x5017de[_0x00c7('0x31')]);_0x3a4a1c[_0x00c7('0x34')]=_['intersection'](_0x5017de[_0x00c7('0x33')],qs[_0x00c7('0x44')](_0xaf79d8['query']['fields']));_0x3a4a1c[_0x00c7('0x34')]=_0x3a4a1c[_0x00c7('0x34')][_0x00c7('0x35')]?_0x3a4a1c[_0x00c7('0x34')]:_0x5017de['model'];if(_0xaf79d8[_0x00c7('0x31')][_0x00c7('0x45')]){_0x3a4a1c[_0x00c7('0x46')]=[{'all':!![]}];}_0x3a4a1c=_[_0x00c7('0x3c')]({},_0x3a4a1c,_0xaf79d8[_0x00c7('0x3d')]);return db[_0x00c7('0x3e')][_0x00c7('0x47')](_0x3a4a1c)[_0x00c7('0x24')](handleEntityNotFound(_0x1bcd6d,null))[_0x00c7('0x24')](respondWithResult(_0x1bcd6d,null))['catch'](handleError(_0x1bcd6d,null));};exports[_0x00c7('0x48')]=function(_0x4a3884,_0x346db3){return db[_0x00c7('0x3e')][_0x00c7('0x48')](_0x4a3884['body'],{})[_0x00c7('0x24')](function(_0x2b9e32){var _0x1c3716=_0x4a3884[_0x00c7('0x49')]['get']({'plain':!![]});if(!_0x1c3716)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1c3716[_0x00c7('0x4a')]==='user'){var _0x4d8d43=_0x2b9e32[_0x00c7('0x26')]({'plain':!![]});var _0x29d9b5='Pauses';return db[_0x00c7('0x4b')][_0x00c7('0x47')]({'where':{'name':_0x29d9b5,'userProfileId':_0x1c3716[_0x00c7('0x4c')]},'raw':!![]})[_0x00c7('0x24')](function(_0x306d6a){if(_0x306d6a&&_0x306d6a[_0x00c7('0x4d')]===0x0){return db[_0x00c7('0x27')][_0x00c7('0x48')]({'name':_0x4d8d43[_0x00c7('0x2a')],'resourceId':_0x4d8d43['id'],'type':_0x306d6a[_0x00c7('0x2a')],'sectionId':_0x306d6a['id']},{})[_0x00c7('0x24')](function(){return _0x2b9e32;});}else{return _0x2b9e32;}})[_0x00c7('0x41')](function(_0x4bb8de){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4bb8de);throw _0x4bb8de;});}return _0x2b9e32;})[_0x00c7('0x24')](respondWithResult(_0x346db3,0xc9))[_0x00c7('0x41')](handleError(_0x346db3,null));};exports['update']=function(_0x1925a9,_0x411597){if(_0x1925a9[_0x00c7('0x4e')]['id']){delete _0x1925a9[_0x00c7('0x4e')]['id'];}return db['Pause'][_0x00c7('0x47')]({'where':{'id':_0x1925a9[_0x00c7('0x43')]['id']}})[_0x00c7('0x24')](handleEntityNotFound(_0x411597,null))[_0x00c7('0x24')](saveUpdates(_0x1925a9[_0x00c7('0x4e')],null))[_0x00c7('0x24')](respondWithResult(_0x411597,null))[_0x00c7('0x41')](handleError(_0x411597,null));};exports['destroy']=function(_0xb8a480,_0x1b5b57){return db[_0x00c7('0x3e')][_0x00c7('0x47')]({'where':{'id':_0xb8a480['params']['id']}})[_0x00c7('0x24')](handleEntityNotFound(_0x1b5b57,null))[_0x00c7('0x24')](removeEntity(_0x1b5b57,null))['catch'](handleError(_0x1b5b57,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 55e150c..5a02eef 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 _0x6aa7=['Pause','tools_pauses','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6aa7,0x178));var _0x76aa=function(_0x4bc0e8,_0x25aee1){_0x4bc0e8=_0x4bc0e8-0x0;var _0x3a1fcd=_0x6aa7[_0x4bc0e8];return _0x3a1fcd;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var logger=require(_0x76aa('0x1'))(_0x76aa('0x2'));var moment=require(_0x76aa('0x3'));var BPromise=require(_0x76aa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x76aa('0x5'));var rimraf=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var attributes=require('./pause.attributes');module['exports']=function(_0x1aceaa,_0x4d53f6){return _0x1aceaa[_0x76aa('0x8')](_0x76aa('0x9'),attributes,{'tableName':_0x76aa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fbe=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x1a0016,_0x3d80e1){_0x1a0016=_0x1a0016-0x0;var _0x2945df=_0x7fbe[_0x1a0016];return _0x2945df;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'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 d410434..403b46d 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x52f75b,_0x3a007d){var _0x1c4138=function(_0x1cf584){while(--_0x1cf584){_0x52f75b['push'](_0x52f75b['shift']());}};_0x1c4138(++_0x3a007d);}(_0xb10b,0x12a));var _0xbb10=function(_0x3b0295,_0x218b0b){_0x3b0295=_0x3b0295-0x0;var _0x2cdd32=_0xb10b[_0x3b0295];return _0x2cdd32;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x1fce57,_0x52bc1e){var _0xde7524=function(_0x10c64f){while(--_0x10c64f){_0x1fce57['push'](_0x1fce57['shift']());}};_0xde7524(++_0x52bc1e);}(_0x7a54,0x106));var _0x47a5=function(_0xc3c51e,_0x581a36){_0xc3c51e=_0xc3c51e-0x0;var _0x4eea57=_0x7a54[_0xc3c51e];return _0x4eea57;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 9dbb3be..480b9da 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 _0x7bae=['../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','show','/:id/download','download','diskStorage','join','root','originalname','replace','format','%s-%s%s','extname','now','upload','update','delete','exports','path','connect-timeout','Router','../../components/auth/service'];(function(_0x4c99d0,_0x1febe1){var _0x5e541f=function(_0x6a83e5){while(--_0x6a83e5){_0x4c99d0['push'](_0x4c99d0['shift']());}};_0x5e541f(++_0x1febe1);}(_0x7bae,0x13b));var _0xe7ba=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x7bae[_0x13e741];return _0x3f8bb3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7ba('0x0'));var timeout=require(_0xe7ba('0x1'));var express=require('express');var router=express[_0xe7ba('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xe7ba('0x3'));var interaction=require(_0xe7ba('0x4'));var config=require(_0xe7ba('0x5'));var controller=require(_0xe7ba('0x6'));router[_0xe7ba('0x7')]('/',auth[_0xe7ba('0x8')](),controller[_0xe7ba('0x9')]);router[_0xe7ba('0x7')](_0xe7ba('0xa'),controller[_0xe7ba('0xb')]);router[_0xe7ba('0x7')](_0xe7ba('0xc'),auth[_0xe7ba('0x8')](),controller[_0xe7ba('0xd')]);router['get'](_0xe7ba('0xe'),auth[_0xe7ba('0x8')](),controller[_0xe7ba('0xf')]);var upload=multer({'storage':multer[_0xe7ba('0x10')]({'destination':function(_0x15083a,_0x1672f0,_0x99a86f){_0x99a86f(null,path[_0xe7ba('0x11')](config[_0xe7ba('0x12')],'server/files/plugins'));},'filename':function(_0xf4fcb0,_0x588c8b,_0x602b1){_0x588c8b[_0xe7ba('0x13')]=_0x588c8b[_0xe7ba('0x13')][_0xe7ba('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x602b1(null,util[_0xe7ba('0x15')](_0xe7ba('0x16'),path['basename'](_0x588c8b['originalname'],path[_0xe7ba('0x17')](_0x588c8b[_0xe7ba('0x13')])),Date[_0xe7ba('0x18')](),path['extname'](_0x588c8b[_0xe7ba('0x13')])));}})});router['post']('/',upload['single']('file'),controller[_0xe7ba('0x19')]);router['post'](_0xe7ba('0xa'),controller['webhookPost']);router['put']('/:id',auth[_0xe7ba('0x8')](),controller[_0xe7ba('0x1a')]);router[_0xe7ba('0x1b')](_0xe7ba('0xc'),auth[_0xe7ba('0x8')](),controller['delete']);module[_0xe7ba('0x1c')]=router; \ No newline at end of file +var _0xf72b=['./plugin.controller','get','isAuthenticated','/webhook','webhookGet','/:id','download','join','root','server/files/plugins','originalname','replace','%s-%s%s','now','extname','post','single','upload','webhookPost','put','update','delete','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0xf72b,0x1d9));var _0xbf72=function(_0x61c976,_0x289eaf){_0x61c976=_0x61c976-0x0;var _0x324085=_0xf72b[_0x61c976];return _0x324085;};'use strict';var multer=require(_0xbf72('0x0'));var util=require('util');var path=require(_0xbf72('0x1'));var timeout=require('connect-timeout');var express=require(_0xbf72('0x2'));var router=express[_0xbf72('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbf72('0x4'));var interaction=require(_0xbf72('0x5'));var config=require(_0xbf72('0x6'));var controller=require(_0xbf72('0x7'));router[_0xbf72('0x8')]('/',auth[_0xbf72('0x9')](),controller['index']);router[_0xbf72('0x8')](_0xbf72('0xa'),controller[_0xbf72('0xb')]);router[_0xbf72('0x8')](_0xbf72('0xc'),auth[_0xbf72('0x9')](),controller['show']);router[_0xbf72('0x8')]('/:id/download',auth[_0xbf72('0x9')](),controller[_0xbf72('0xd')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xaec095,_0x1c3453,_0x1853eb){_0x1853eb(null,path[_0xbf72('0xe')](config[_0xbf72('0xf')],_0xbf72('0x10')));},'filename':function(_0x14f6e6,_0x5eb4cc,_0x5967f5){_0x5eb4cc[_0xbf72('0x11')]=_0x5eb4cc[_0xbf72('0x11')][_0xbf72('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5967f5(null,util['format'](_0xbf72('0x13'),path['basename'](_0x5eb4cc['originalname'],path['extname'](_0x5eb4cc[_0xbf72('0x11')])),Date[_0xbf72('0x14')](),path[_0xbf72('0x15')](_0x5eb4cc[_0xbf72('0x11')])));}})});router[_0xbf72('0x16')]('/',upload[_0xbf72('0x17')]('file'),controller[_0xbf72('0x18')]);router[_0xbf72('0x16')](_0xbf72('0xa'),controller[_0xbf72('0x19')]);router[_0xbf72('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0xbf72('0x1b')]);router[_0xbf72('0x1c')](_0xbf72('0xc'),auth[_0xbf72('0x9')](),controller[_0xbf72('0x1c')]);module[_0xbf72('0x1d')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index ba60588..330b0cc 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 _0x41c4=['adminOnly','agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports','STRING','ENUM','html','script','TEXT','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'];(function(_0x499b8c,_0x56c9e1){var _0x8b2497=function(_0x39ec34){while(--_0x39ec34){_0x499b8c['push'](_0x499b8c['shift']());}};_0x8b2497(++_0x56c9e1);}(_0x41c4,0x148));var _0x441c=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x41c4[_0x1f9f37];return _0x21c080;};'use strict';var Sequelize=require('sequelize');module[_0x441c('0x0')]={'name':{'type':Sequelize[_0x441c('0x1')]},'type':{'type':Sequelize[_0x441c('0x2')](_0x441c('0x3'),_0x441c('0x4'))},'description':{'type':Sequelize[_0x441c('0x5')]},'version':{'type':Sequelize[_0x441c('0x5')]},'path':{'type':Sequelize['STRING'],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x441c('0x6')],'defaultValue':0x0,'comment':_0x441c('0x7')},'sidebar':{'type':Sequelize[_0x441c('0x2')](_0x441c('0x8'),_0x441c('0x9'),_0x441c('0xa'),'never'),'defaultValue':_0x441c('0xa'),'comment':_0x441c('0xb')},'icon':{'type':Sequelize[_0x441c('0x1')]},'adminUrl':{'type':Sequelize[_0x441c('0x1')]},'agentUrl':{'type':Sequelize[_0x441c('0x1')]},'scriptName':{'type':Sequelize[_0x441c('0x1')]},'scriptPath':{'type':Sequelize[_0x441c('0x1')]}}; \ No newline at end of file +var _0xa00d=['STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','ENUM','adminOnly','agentOnly','always','never','sequelize','exports','script','TEXT'];(function(_0x122fae,_0x573ae5){var _0x3e7409=function(_0x3d5a6d){while(--_0x3d5a6d){_0x122fae['push'](_0x122fae['shift']());}};_0x3e7409(++_0x573ae5);}(_0xa00d,0x8b));var _0xda00=function(_0x40edb3,_0x5a80f5){_0x40edb3=_0x40edb3-0x0;var _0x50d198=_0xa00d[_0x40edb3];return _0x50d198;};'use strict';var Sequelize=require(_0xda00('0x0'));module[_0xda00('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM']('html',_0xda00('0x2'))},'description':{'type':Sequelize[_0xda00('0x3')]},'version':{'type':Sequelize[_0xda00('0x3')]},'path':{'type':Sequelize[_0xda00('0x4')],'comment':_0xda00('0x5')},'active':{'type':Sequelize[_0xda00('0x6')],'defaultValue':0x0,'comment':_0xda00('0x7')},'sidebar':{'type':Sequelize[_0xda00('0x8')](_0xda00('0x9'),_0xda00('0xa'),_0xda00('0xb'),_0xda00('0xc')),'defaultValue':'always','comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0xda00('0x4')]},'adminUrl':{'type':Sequelize[_0xda00('0x4')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0xda00('0x4')]},'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 0903a22..ef0dc9a 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 _0x859c=['hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','rawAttributes','find','catch','download','root','server/files/plugins','%s.zip','basename','createWriteStream','warning','code','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','join','node_modules/**/*','finalize','close','existsSync','Plugin\x20not\x20found','format','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','filename','extname','file','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','readdirSync','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','script','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','always','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','scriptName','scriptPath','create','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','delete','dirname','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','resolve','\x27PORT\x27\x20parameter\x20not\x20specified','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','Plugins','UserProfileResource','error','stack','name','send','map','Plugin','type','key','model','query','keys','intersection','attributes','fields','length'];(function(_0x285c85,_0x132c21){var _0x2f81cd=function(_0x9b9962){while(--_0x9b9962){_0x285c85['push'](_0x285c85['shift']());}};_0x2f81cd(++_0x132c21);}(_0x859c,0x11b));var _0xc859=function(_0x1eedf8,_0x7496d8){_0x1eedf8=_0x1eedf8-0x0;var _0x30de3a=_0x859c[_0x1eedf8];return _0x30de3a;};'use strict';var emlformat=require(_0xc859('0x0'));var rimraf=require(_0xc859('0x1'));var zipdir=require(_0xc859('0x2'));var jsonpatch=require(_0xc859('0x3'));var rp=require(_0xc859('0x4'));var moment=require(_0xc859('0x5'));var BPromise=require(_0xc859('0x6'));var Mustache=require(_0xc859('0x7'));var util=require('util');var path=require(_0xc859('0x8'));var sox=require(_0xc859('0x9'));var csv=require('to-csv');var ejs=require(_0xc859('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc859('0xb'));var squel=require(_0xc859('0xc'));var crypto=require(_0xc859('0xd'));var jsforce=require(_0xc859('0xe'));var deskjs=require(_0xc859('0xf'));var toCsv=require('to-csv');var querystring=require(_0xc859('0x10'));var Papa=require(_0xc859('0x11'));var extract=require(_0xc859('0x12'));var rimraf=require(_0xc859('0x1'));var archiver=require('archiver');var Redis=require(_0xc859('0x13'));var authService=require(_0xc859('0x14'));var qs=require(_0xc859('0x15'));var as=require(_0xc859('0x16'));var hardwareService=require(_0xc859('0x17'));var logger=require(_0xc859('0x18'))(_0xc859('0x19'));var utils=require(_0xc859('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0xc859('0x1b'));var db=require(_0xc859('0x1c'))['db'];config[_0xc859('0x1d')]=_[_0xc859('0x1e')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc859('0x1f'))(new Redis(config['redis']));require(_0xc859('0x20'))[_0xc859('0x21')](socket);function respondWithStatusCode(_0x581247,_0x284d28){_0x284d28=_0x284d28||0xcc;return function(_0x5de4a6){if(_0x5de4a6){return _0x581247[_0xc859('0x22')](_0x284d28);}return _0x581247[_0xc859('0x23')](_0x284d28)[_0xc859('0x24')]();};}function respondWithResult(_0x7863ec,_0x573c47){_0x573c47=_0x573c47||0xc8;return function(_0x154434){if(_0x154434){return _0x7863ec[_0xc859('0x23')](_0x573c47)[_0xc859('0x25')](_0x154434);}};}function respondWithFilteredResult(_0x18d1d3,_0x3960c8){return function(_0x369d65){if(_0x369d65){var _0x1f626c=typeof _0x3960c8[_0xc859('0x26')]===_0xc859('0x27')&&typeof _0x3960c8[_0xc859('0x28')]===_0xc859('0x27');var _0x5a4774=_0x369d65[_0xc859('0x29')];var _0x3d1998=_0x1f626c?0x0:_0x3960c8['offset'];var _0x171365=_0x1f626c?_0x369d65[_0xc859('0x29')]:_0x3960c8[_0xc859('0x26')]+_0x3960c8[_0xc859('0x28')];var _0x56f31f;if(_0x171365>=_0x5a4774){_0x171365=_0x5a4774;_0x56f31f=0xc8;}else{_0x56f31f=0xce;}_0x18d1d3['status'](_0x56f31f);return _0x18d1d3[_0xc859('0x2a')]('Content-Range',_0x3d1998+'-'+_0x171365+'/'+_0x5a4774)[_0xc859('0x25')](_0x369d65);}return null;};}function patchUpdates(_0x58cde2){return function(_0x8b39ef){try{jsonpatch[_0xc859('0x2b')](_0x8b39ef,_0x58cde2,!![]);}catch(_0x219cba){return BPromise['reject'](_0x219cba);}return _0x8b39ef[_0xc859('0x2c')]();};}function saveUpdates(_0x5d187b,_0x557296){return function(_0x2f9cce){if(_0x2f9cce){return _0x2f9cce[_0xc859('0x2d')](_0x5d187b)[_0xc859('0x2e')](function(_0x4b1c1e){return _0x4b1c1e;});}return null;};}function removeEntity(_0x2914ad,_0x16d68a){return function(_0x3c0f7f){if(_0x3c0f7f){return _0x3c0f7f[_0xc859('0x2f')]()[_0xc859('0x2e')](function(){var _0x100d44=_0x3c0f7f['get']({'plain':!![]});var _0x2c1080=_0xc859('0x30');return db[_0xc859('0x31')][_0xc859('0x2f')]({'where':{'type':_0x2c1080,'resourceId':_0x100d44['id']}})[_0xc859('0x2e')](function(){return _0x3c0f7f;});})[_0xc859('0x2e')](function(){_0x2914ad[_0xc859('0x23')](0xcc)[_0xc859('0x24')]();});}};}function handleEntityNotFound(_0x165f9b,_0x2e9200){return function(_0x44bbf0){if(!_0x44bbf0){_0x165f9b[_0xc859('0x22')](0x194);}return _0x44bbf0;};}function handleError(_0xb3dc68,_0x4eeab3){_0x4eeab3=_0x4eeab3||0x1f4;return function(_0x59d526){logger[_0xc859('0x32')](_0x59d526[_0xc859('0x33')]);if(_0x59d526[_0xc859('0x34')]){delete _0x59d526['name'];}_0xb3dc68[_0xc859('0x23')](_0x4eeab3)[_0xc859('0x35')](_0x59d526);};}exports['index']=function(_0x3a63b4,_0x2e1266){var _0x2f58f4={},_0x34da43={},_0x48dbde={'count':0x0,'rows':[]};var _0x27effa=_[_0xc859('0x36')](db[_0xc859('0x37')]['rawAttributes'],function(_0x3a94b7){return{'name':_0x3a94b7['fieldName'],'type':_0x3a94b7[_0xc859('0x38')][_0xc859('0x39')]};});_0x34da43[_0xc859('0x3a')]=_[_0xc859('0x36')](_0x27effa,_0xc859('0x34'));_0x34da43[_0xc859('0x3b')]=_[_0xc859('0x3c')](_0x3a63b4['query']);_0x34da43['filters']=_[_0xc859('0x3d')](_0x34da43['model'],_0x34da43[_0xc859('0x3b')]);_0x2f58f4[_0xc859('0x3e')]=_[_0xc859('0x3d')](_0x34da43[_0xc859('0x3a')],qs[_0xc859('0x3f')](_0x3a63b4['query'][_0xc859('0x3f')]));_0x2f58f4[_0xc859('0x3e')]=_0x2f58f4[_0xc859('0x3e')][_0xc859('0x40')]?_0x2f58f4[_0xc859('0x3e')]:_0x34da43['model'];if(!_0x3a63b4[_0xc859('0x3b')][_0xc859('0x41')](_0xc859('0x42'))){_0x2f58f4[_0xc859('0x28')]=qs[_0xc859('0x28')](_0x3a63b4['query'][_0xc859('0x28')]);_0x2f58f4[_0xc859('0x26')]=qs[_0xc859('0x26')](_0x3a63b4[_0xc859('0x3b')][_0xc859('0x26')]);}_0x2f58f4['order']=qs[_0xc859('0x43')](_0x3a63b4[_0xc859('0x3b')][_0xc859('0x43')]);_0x2f58f4[_0xc859('0x44')]=qs[_0xc859('0x45')](_[_0xc859('0x46')](_0x3a63b4[_0xc859('0x3b')],_0x34da43[_0xc859('0x45')]),_0x27effa);if(_0x3a63b4[_0xc859('0x3b')][_0xc859('0x47')]){_0x2f58f4[_0xc859('0x44')]=_[_0xc859('0x48')](_0x2f58f4[_0xc859('0x44')],{'$or':_[_0xc859('0x36')](_0x27effa,function(_0x500057){if(_0x500057['type']!==_0xc859('0x49')){var _0x2853e9={};_0x2853e9[_0x500057[_0xc859('0x34')]]={'$like':'%'+_0x3a63b4['query'][_0xc859('0x47')]+'%'};return _0x2853e9;}})});}_0x2f58f4=_[_0xc859('0x48')]({},_0x2f58f4,_0x3a63b4[_0xc859('0x4a')]);var _0x455478={'where':_0x2f58f4['where']};return db['Plugin'][_0xc859('0x29')](_0x455478)[_0xc859('0x2e')](function(_0x30d6b8){_0x48dbde[_0xc859('0x29')]=_0x30d6b8;if(_0x3a63b4['query'][_0xc859('0x4b')]){_0x2f58f4[_0xc859('0x4c')]=[{'all':!![]}];}return db[_0xc859('0x37')]['findAll'](_0x2f58f4);})['then'](function(_0x4b27ad){_0x48dbde[_0xc859('0x4d')]=_0x4b27ad;return _0x48dbde;})[_0xc859('0x2e')](respondWithFilteredResult(_0x2e1266,_0x2f58f4))['catch'](handleError(_0x2e1266,null));};exports[_0xc859('0x4e')]=function(_0x160f09,_0x1f6265){var _0x28548a={'raw':!![],'where':{'id':_0x160f09[_0xc859('0x4f')]['id']}},_0x4a04e9={};_0x4a04e9['model']=_[_0xc859('0x3c')](db['Plugin'][_0xc859('0x50')]);_0x4a04e9[_0xc859('0x3b')]=_[_0xc859('0x3c')](_0x160f09[_0xc859('0x3b')]);_0x4a04e9[_0xc859('0x45')]=_[_0xc859('0x3d')](_0x4a04e9[_0xc859('0x3a')],_0x4a04e9[_0xc859('0x3b')]);_0x28548a[_0xc859('0x3e')]=_[_0xc859('0x3d')](_0x4a04e9[_0xc859('0x3a')],qs[_0xc859('0x3f')](_0x160f09[_0xc859('0x3b')][_0xc859('0x3f')]));_0x28548a['attributes']=_0x28548a['attributes'][_0xc859('0x40')]?_0x28548a[_0xc859('0x3e')]:_0x4a04e9['model'];if(_0x160f09[_0xc859('0x3b')][_0xc859('0x4b')]){_0x28548a[_0xc859('0x4c')]=[{'all':!![]}];}_0x28548a=_['merge']({},_0x28548a,_0x160f09[_0xc859('0x4a')]);return db['Plugin'][_0xc859('0x51')](_0x28548a)[_0xc859('0x2e')](handleEntityNotFound(_0x1f6265,null))['then'](respondWithResult(_0x1f6265,null))[_0xc859('0x52')](handleError(_0x1f6265,null));};exports[_0xc859('0x53')]=function(_0x53abcf,_0x21752e,_0x4741aa){return db[_0xc859('0x37')][_0xc859('0x51')]({'where':{'id':_0x53abcf[_0xc859('0x4f')]['id']},'attributes':[_0xc859('0x34'),_0xc859('0x8')],'raw':!![]})[_0xc859('0x2e')](handleEntityNotFound(_0x21752e,null))[_0xc859('0x2e')](function(_0x2d77ae){if(_0x2d77ae){var _0x50c982=path['join'](config[_0xc859('0x54')],_0xc859('0x55'),util['format'](_0xc859('0x56'),path[_0xc859('0x57')](_0x2d77ae['path'])));var _0x303626=fs[_0xc859('0x58')](_0x50c982);var _0xfc188b=archiver('zip',{'zlib':{'level':0x9}});_0xfc188b['on'](_0xc859('0x59'),function(_0x5aa861){if(_0x5aa861[_0xc859('0x5a')]==='ENOENT'){logger[_0xc859('0x32')](_0x5aa861);}else{throw new db[(_0xc859('0x5b'))][(_0xc859('0x5c'))](_0xc859('0x5d'));}});_0xfc188b['on'](_0xc859('0x32'),function(_0x360923){throw new db[(_0xc859('0x5b'))][(_0xc859('0x5c'))](_0xc859('0x5d'));});_0xfc188b['pipe'](_0x303626);_0xfc188b[_0xc859('0x5e')]('**/*',{'cwd':path[_0xc859('0x5f')](config[_0xc859('0x54')],'server/files/plugins',path['dirname'](_0x2d77ae[_0xc859('0x8')])),'ignore':[path[_0xc859('0x5f')](path['basename'](_0x2d77ae[_0xc859('0x8')]),_0xc859('0x60')),path[_0xc859('0x5f')](path[_0xc859('0x57')](_0x2d77ae[_0xc859('0x8')]),'attachments/**/*')],'nodir':!![]})[_0xc859('0x61')]();_0x303626['on'](_0xc859('0x62'),function(){if(!fs[_0xc859('0x63')](_0x50c982)){throw new db[(_0xc859('0x5b'))][(_0xc859('0x5c'))](_0xc859('0x64'));}return _0x21752e[_0xc859('0x53')](_0x50c982,util[_0xc859('0x65')](_0xc859('0x56'),path[_0xc859('0x57')](_0x2d77ae['path'])),function(_0x4a6a60){if(_0x4a6a60){throw new db[(_0xc859('0x5b'))]['Error'](_0xc859('0x66'));}fs[_0xc859('0x67')](_0x50c982);logger[_0xc859('0x68')](_0xc859('0x69'));logger[_0xc859('0x68')](_0xc859('0x6a'));});});}return null;})[_0xc859('0x52')](handleError(_0x21752e,null));};exports[_0xc859('0x6b')]=function(_0x229ad9,_0x4927b2,_0x2c26ad){var _0x1ed03a=path[_0xc859('0x57')](_0x229ad9['file'][_0xc859('0x6c')],path[_0xc859('0x6d')](_0x229ad9[_0xc859('0x6e')][_0xc859('0x6c')]));var _0x5590a7=path[_0xc859('0x5f')](config[_0xc859('0x54')],_0xc859('0x55'),_0x229ad9[_0xc859('0x6e')][_0xc859('0x6c')]);var _0x3f0549=path['join'](config['root'],'server/files/plugins',_0x1ed03a);logger[_0xc859('0x68')](_0xc859('0x6f'),_0x5590a7);logger[_0xc859('0x68')](_0xc859('0x70'),_0x3f0549);try{fs[_0xc859('0x71')](_0x5590a7,parseInt(_0xc859('0x72'),0x8));extract(_0x5590a7,{'dir':_0x3f0549},function(_0x4f07ff){if(_0x4f07ff){logger[_0xc859('0x32')](_0x4f07ff);handleError(_0x4f07ff,!![]);};var _0x5b5eb3=fs['readdirSync'](_0x3f0549);if(_0x5b5eb3[_0xc859('0x40')]>0x1){removeReferences(_0x5590a7,_0x3f0549);logger[_0xc859('0x32')](_0xc859('0x73'));return _0x2c26ad(new Error(_0xc859('0x73')));}var _0x2a7063=fs[_0xc859('0x74')](path[_0xc859('0x5f')](_0x3f0549,_0x5b5eb3[0x0]));if(_0x2a7063[_0xc859('0x75')]()){removeReferences(_0x5590a7,_0x3f0549);logger[_0xc859('0x32')](_0xc859('0x73'));return _0x2c26ad(new Error('Invalid\x20plugin\x20structure'));}if(_0x2a7063[_0xc859('0x76')]()){var _0x475e3b=fs[_0xc859('0x77')](path[_0xc859('0x5f')](_0x3f0549,_0x5b5eb3[0x0]));if(_0x475e3b['length']===0x0){removeReferences(_0x5590a7,_0x3f0549);logger['error'](_0xc859('0x73'));return _0x2c26ad(new Error('Invalid\x20plugin\x20structure'));}var _0x2f086b=_0x475e3b['some'](function(_0x2a5342){return _0x2a5342===_0xc859('0x78');});if(!_0x2f086b){return _0x2c26ad(new Error(_0xc859('0x79')));}var _0x3854e4=fs[_0xc859('0x7a')](path[_0xc859('0x5f')](_0x3f0549,_0x5b5eb3[0x0],_0xc859('0x78')));var _0x4d3bbd=JSON[_0xc859('0x7b')](_0x3854e4);if('undefined'==typeof _0x4d3bbd[_0xc859('0x34')]){return _0x2c26ad(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0xc859('0x27')==typeof _0x4d3bbd[_0xc859('0x38')]){return _0x2c26ad(new Error('Invalid\x20manifest:\x20type\x20missing'));}if('undefined'==typeof _0x4d3bbd[_0xc859('0x7c')]){return _0x2c26ad(new Error(_0xc859('0x7d')));}if(_0xc859('0x27')==typeof _0x4d3bbd[_0xc859('0x7e')]){return _0x2c26ad(new Error(_0xc859('0x7f')));}if(_0x4d3bbd['type']===_0xc859('0x80')){if('undefined'==typeof _0x4d3bbd['parameters'][_0xc859('0x81')]){return _0x2c26ad(new Error(_0xc859('0x82')));}if(_0xc859('0x27')==typeof _0x4d3bbd[_0xc859('0x7e')][_0xc859('0x81')][_0xc859('0x83')]&&_0xc859('0x27')==typeof _0x4d3bbd[_0xc859('0x7e')][_0xc859('0x81')][_0xc859('0x84')]){return _0x2c26ad(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x4d3bbd['type']===_0xc859('0x85')){if('undefined'==typeof _0x4d3bbd[_0xc859('0x7e')]['scriptName']){return _0x2c26ad(new Error(_0xc859('0x86')));}if(_0xc859('0x27')==typeof _0x4d3bbd[_0xc859('0x7e')]['scriptPath']){return _0x2c26ad(new Error(_0xc859('0x87')));}}else{return _0x2c26ad(new Error(_0xc859('0x88')));}var _0x502aa3=_0x4d3bbd[_0xc859('0x34')];var _0x5b492f=_0x4d3bbd[_0xc859('0x89')];var _0xd64efa=_0x4d3bbd[_0xc859('0x38')];var _0x4ab72f=_0x4d3bbd['sidebar']?_0x4d3bbd['sidebar']:_0xc859('0x8a');var _0x3f69af=_0x4d3bbd[_0xc859('0x8b')]?_0x4d3bbd[_0xc859('0x8b')]:_0xc859('0x8c');var _0x4835e5='';var _0x260cfa='';var _0x1d7424='';var _0xf37078='';var _0x245fcb=_0x4d3bbd[_0xc859('0x7c')];if(_0xd64efa==='html'){if(_0xc859('0x27')!=typeof _0x4d3bbd[_0xc859('0x7e')]['views']['admin']){var _0x2f93ec=_0x4d3bbd['parameters'][_0xc859('0x81')][_0xc859('0x83')];if(!/^(f|ht)tps?:\/\//i[_0xc859('0x8d')](_0x2f93ec)){_0x4835e5=path[_0xc859('0x5f')](_0xc859('0x8e'),_0x1ed03a,_0x5b5eb3[0x0],_0x2f93ec);}else{_0x4835e5=_0x2f93ec;}}else{logger[_0xc859('0x68')](_0xc859('0x8f'));}if(_0xc859('0x27')!=typeof _0x4d3bbd[_0xc859('0x7e')]['views'][_0xc859('0x84')]){var _0x1a8c30=_0x4d3bbd[_0xc859('0x7e')][_0xc859('0x81')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0xc859('0x8d')](_0x1a8c30)){_0x260cfa=path[_0xc859('0x5f')](_0xc859('0x8e'),_0x1ed03a,_0x5b5eb3[0x0],_0x1a8c30);}else{_0x260cfa=_0x1a8c30;}}else{logger[_0xc859('0x68')](_0xc859('0x90'));}}else if(_0xd64efa===_0xc859('0x85')){_0x1d7424=_0x4d3bbd['parameters'][_0xc859('0x91')];_0xf37078=_0x4d3bbd[_0xc859('0x7e')][_0xc859('0x92')];if(_0xc859('0x27')!=typeof _0x4d3bbd[_0xc859('0x7e')]['views']){if(_0xc859('0x27')!=typeof _0x4d3bbd[_0xc859('0x7e')][_0xc859('0x81')][_0xc859('0x83')]){var _0x2f93ec=_0x4d3bbd[_0xc859('0x7e')][_0xc859('0x81')][_0xc859('0x83')];if(!/^(f|ht)tps?:\/\//i[_0xc859('0x8d')](_0x2f93ec)){_0x4835e5=path[_0xc859('0x5f')]('plugins',_0x1ed03a,_0x5b5eb3[0x0],_0x2f93ec);}else{_0x4835e5=_0x2f93ec;}}if(_0xc859('0x27')!=typeof _0x4d3bbd['parameters'][_0xc859('0x81')][_0xc859('0x84')]){var _0x1a8c30=_0x4d3bbd['parameters'][_0xc859('0x81')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0xc859('0x8d')](_0x1a8c30)){_0x260cfa=path['join'](_0xc859('0x8e'),_0x1ed03a,_0x5b5eb3[0x0],_0x1a8c30);}else{_0x260cfa=_0x1a8c30;}}}}var _0x2da435={'name':_0x502aa3,'description':_0x5b492f,'path':path['join'](_0x1ed03a,_0x5b5eb3[0x0]),'type':_0xd64efa,'sidebar':_0x4ab72f,'icon':_0x3f69af,'adminUrl':_0x4835e5,'agentUrl':_0x260cfa,'scriptName':_0x1d7424,'scriptPath':_0xf37078,'version':_0x245fcb};removeReferences(_0x5590a7,null);return db[_0xc859('0x37')][_0xc859('0x93')](_0x2da435)[_0xc859('0x2e')](function(_0x3a053f){var _0x26cde5={'role':_0x229ad9['body'][_0xc859('0x94')],'userProfileId':_0x229ad9[_0xc859('0x95')][_0xc859('0x96')]};if(!_0x26cde5)throw new Error(_0xc859('0x97'));if(_0x26cde5[_0xc859('0x94')]==='user'){var _0x1f3f44=_0x3a053f[_0xc859('0x98')]({'plain':!![]});return db['UserProfileSection'][_0xc859('0x51')]({'where':{'name':_0xc859('0x30'),'userProfileId':_0x26cde5['userProfileId']},'raw':!![]})[_0xc859('0x2e')](function(_0x785c99){if(_0x785c99&&_0x785c99[_0xc859('0x99')]===0x0){return db[_0xc859('0x31')][_0xc859('0x93')]({'name':_0x1f3f44[_0xc859('0x34')],'resourceId':_0x1f3f44['id'],'type':_0x785c99[_0xc859('0x34')],'sectionId':_0x785c99['id']},{})['then'](function(){return _0x3a053f;});}else{return _0x3a053f;}})[_0xc859('0x52')](function(_0x29c4cd){logger[_0xc859('0x32')](_0xc859('0x9a'),_0x29c4cd);throw _0x29c4cd;});}return _0x3a053f;})[_0xc859('0x2e')](respondWithResult(_0x4927b2,null))[_0xc859('0x52')](handleError(_0x4927b2,null));}});}catch(_0x1e915d){_0x4927b2[_0xc859('0x23')](0x1f4)[_0xc859('0x35')](_0x1e915d);}};function removeReferences(_0x16bd9b,_0x2d4693){try{if(_0x16bd9b){fs[_0xc859('0x67')](_0x16bd9b);logger[_0xc859('0x68')]('Zip\x20archive\x20removed');}if(_0x2d4693){rimraf(_0x2d4693,function(){});logger[_0xc859('0x68')](_0xc859('0x9b'));}}catch(_0x4f035a){logger[_0xc859('0x32')](_0x4f035a);}}exports[_0xc859('0x2d')]=function(_0x3fd9cc,_0x37149a,_0x3f58f3){return db[_0xc859('0x37')][_0xc859('0x51')]({'where':{'id':_0x3fd9cc[_0xc859('0x4f')]['id']}})[_0xc859('0x2e')](handleEntityNotFound(_0x37149a,null))[_0xc859('0x2e')](saveUpdates(_0x3fd9cc[_0xc859('0x95')],null))[_0xc859('0x2e')](respondWithResult(_0x37149a,null))[_0xc859('0x52')](handleError(_0x37149a,null));};exports[_0xc859('0x9c')]=function(_0x25216a,_0x4fb8cd,_0x5c2bca){return db[_0xc859('0x37')][_0xc859('0x51')]({'where':{'id':_0x25216a[_0xc859('0x4f')]['id']}})[_0xc859('0x2e')](function(_0x29180e){if(_0x29180e){return _0x29180e[_0xc859('0x2f')]();}})[_0xc859('0x2e')](function(_0x231824){rimraf(path[_0xc859('0x5f')](config[_0xc859('0x54')],'server/files/plugins',path[_0xc859('0x9d')](_0x231824[_0xc859('0x8')])),function(){});return _0x231824;})[_0xc859('0x2e')](handleEntityNotFound(_0x4fb8cd,null))[_0xc859('0x2e')](respondWithStatusCode(_0x4fb8cd,null))[_0xc859('0x52')](handleError(_0x4fb8cd,null));};exports[_0xc859('0x9e')]=function(_0xa2081e,_0x523b36,_0x3650df){return BPromise['resolve']()[_0xc859('0x2e')](function(){if(!_0xa2081e[_0xc859('0x3b')][_0xc859('0x8')]){throw new Error(_0xc859('0x9f'));}if(!_0xa2081e[_0xc859('0x3b')]['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x1604ec=_0xa2081e[_0xc859('0x3b')][_0xc859('0xa0')]?_0xa2081e[_0xc859('0x3b')][_0xc859('0xa0')]+':'+_0xa2081e[_0xc859('0x3b')][_0xc859('0xa1')]:_0xc859('0xa2')+_0xa2081e[_0xc859('0x3b')]['port'];var _0x14e71=_0xa2081e[_0xc859('0x3b')][_0xc859('0x25')]?_0xa2081e['query'][_0xc859('0x25')]:!![];var _0x4d0d88=_0xa2081e[_0xc859('0x3b')]['encoding']?_0xa2081e['query'][_0xc859('0xa3')]:null;var _0x167d0f={'method':_0xa2081e[_0xc859('0xa4')],'uri':util[_0xc859('0x65')](_0xc859('0xa5'),_0x1604ec,_0xa2081e[_0xc859('0x3b')]['path']),'json':_0x14e71,'resolveWithFullResponse':!![],'encoding':_0x4d0d88,'qs':_0xa2081e[_0xc859('0x3b')]};if(_0xa2081e[_0xc859('0xa6')]){_0x167d0f['headers']=_0xa2081e[_0xc859('0xa6')];if(_0x167d0f[_0xc859('0xa6')][_0xc859('0xa7')]){delete _0x167d0f[_0xc859('0xa6')][_0xc859('0xa7')];}}if(_0x167d0f[_0xc859('0xa6')][_0xc859('0xa8')]){delete _0x167d0f[_0xc859('0xa6')][_0xc859('0xa8')];}return rp(_0x167d0f);})[_0xc859('0x2e')](function(_0x3204c7){if(_0x3204c7){_0x523b36[_0xc859('0x2a')](_0x3204c7['headers']);logger[_0xc859('0x68')](_0x3204c7[_0xc859('0x95')]);if(_[_0xc859('0xa9')](_0xa2081e[_0xc859('0x3b')][_0xc859('0x8')],_0xc859('0x53'))&&_0x3204c7[_0xc859('0xaa')]==0x1f4){return _0x523b36[_0xc859('0x22')](_0x3204c7[_0xc859('0xaa')]);}else{return _0x523b36[_0xc859('0x23')](_0x3204c7['statusCode'])[_0xc859('0x35')](_0x3204c7[_0xc859('0x95')]);}}else{return _0x523b36[_0xc859('0x22')](0xc8);}})[_0xc859('0x52')](handleError(_0x523b36,null));};exports[_0xc859('0xab')]=function(_0x1c32a7,_0x1758ec,_0x384f1c){return BPromise[_0xc859('0xac')]()[_0xc859('0x2e')](function(){if(!_0x1c32a7[_0xc859('0x3b')]['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x1c32a7['query'][_0xc859('0xa1')]){throw new Error(_0xc859('0xad'));}var _0x358686=_0x1c32a7[_0xc859('0x3b')]['hostname']?_0x1c32a7[_0xc859('0x3b')][_0xc859('0xa0')]+':'+_0x1c32a7['query']['port']:'http://localhost:'+_0x1c32a7[_0xc859('0x3b')]['port'];var _0x126069=_0x1c32a7[_0xc859('0x3b')][_0xc859('0x25')]?_0x1c32a7[_0xc859('0x3b')]['json']:!![];var _0x29461c=_0x1c32a7['query'][_0xc859('0xa3')]?_0x1c32a7['query'][_0xc859('0xa3')]:null;var _0x1a08b3={'method':_0x1c32a7[_0xc859('0xa4')],'uri':util[_0xc859('0x65')](_0xc859('0xa5'),_0x358686,_0x1c32a7[_0xc859('0x3b')]['path']),'json':_0x126069,'resolveWithFullResponse':!![],'encoding':_0x29461c,'body':_0x1c32a7[_0xc859('0x95')]};if(_0x1c32a7[_0xc859('0xa6')]){_0x1a08b3[_0xc859('0xa6')]=_0x1c32a7[_0xc859('0xa6')];if(_0x1a08b3[_0xc859('0xa6')][_0xc859('0xa7')]){delete _0x1a08b3[_0xc859('0xa6')][_0xc859('0xa7')];}}if(_0x1a08b3[_0xc859('0xa6')][_0xc859('0xa8')]){delete _0x1a08b3[_0xc859('0xa6')][_0xc859('0xa8')];}return rp(_0x1a08b3);})[_0xc859('0x2e')](function(_0x368b91){if(_0x368b91){_0x1758ec['set'](_0x368b91[_0xc859('0xa6')]);logger[_0xc859('0x68')](_0x368b91[_0xc859('0x95')]);return _0x1758ec[_0xc859('0x23')](_0x368b91[_0xc859('0xaa')])[_0xc859('0x35')](_0x368b91[_0xc859('0x95')]);}else{return _0x1758ec[_0xc859('0x22')](0xc8);}})[_0xc859('0x52')](handleError(_0x1758ec,null));}; \ No newline at end of file +var _0xf738=['Plugin','rawAttributes','keys','find','catch','params','join','root','%s.zip','basename','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','server/files/plugins','dirname','node_modules/**/*','attachments/**/*','finalize','close','format','unlinkSync','Temporary\x20file\x20removed','upload','file','filename','info','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','isFile','some','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','admin','plugins','test','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','delete','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','%s%s','headers','content-length','endsWith','statusCode','webhookPost','\x27PATH\x27\x20parameter\x20not\x20specified','method','content-type','zip-dir','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','extract-zip','rimraf','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','get','Plugins','UserProfileResource','error','stack','name','send','index','map','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include'];(function(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_0xf738,0x1ab));var _0x8f73=function(_0x2ef44b,_0x553359){_0x2ef44b=_0x2ef44b-0x0;var _0x2405b9=_0xf738[_0x2ef44b];return _0x2405b9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8f73('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8f73('0x1'));var moment=require(_0x8f73('0x2'));var BPromise=require(_0x8f73('0x3'));var Mustache=require(_0x8f73('0x4'));var util=require(_0x8f73('0x5'));var path=require(_0x8f73('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8f73('0x7'));var _=require(_0x8f73('0x8'));var squel=require(_0x8f73('0x9'));var crypto=require(_0x8f73('0xa'));var jsforce=require(_0x8f73('0xb'));var deskjs=require(_0x8f73('0xc'));var toCsv=require(_0x8f73('0xd'));var querystring=require('querystring');var Papa=require(_0x8f73('0xe'));var extract=require(_0x8f73('0xf'));var rimraf=require(_0x8f73('0x10'));var archiver=require(_0x8f73('0x11'));var Redis=require(_0x8f73('0x12'));var authService=require(_0x8f73('0x13'));var qs=require(_0x8f73('0x14'));var as=require(_0x8f73('0x15'));var hardwareService=require(_0x8f73('0x16'));var logger=require(_0x8f73('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x8f73('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x8f73('0x19'))['db'];config[_0x8f73('0x1a')]=_[_0x8f73('0x1b')](config[_0x8f73('0x1a')],{'host':_0x8f73('0x1c'),'port':0x18eb});var socket=require(_0x8f73('0x1d'))(new Redis(config[_0x8f73('0x1a')]));require(_0x8f73('0x1e'))[_0x8f73('0x1f')](socket);function respondWithStatusCode(_0x5602a4,_0x5cd4c8){_0x5cd4c8=_0x5cd4c8||0xcc;return function(_0x5ae0bd){if(_0x5ae0bd){return _0x5602a4[_0x8f73('0x20')](_0x5cd4c8);}return _0x5602a4[_0x8f73('0x21')](_0x5cd4c8)[_0x8f73('0x22')]();};}function respondWithResult(_0x4d51f2,_0x3d899a){_0x3d899a=_0x3d899a||0xc8;return function(_0x4e327e){if(_0x4e327e){return _0x4d51f2[_0x8f73('0x21')](_0x3d899a)[_0x8f73('0x23')](_0x4e327e);}};}function respondWithFilteredResult(_0x451e1e,_0x483e56){return function(_0x55c77e){if(_0x55c77e){var _0x201c83=typeof _0x483e56[_0x8f73('0x24')]===_0x8f73('0x25')&&typeof _0x483e56['limit']==='undefined';var _0xeea2da=_0x55c77e['count'];var _0x4d013a=_0x201c83?0x0:_0x483e56[_0x8f73('0x24')];var _0x20d047=_0x201c83?_0x55c77e[_0x8f73('0x26')]:_0x483e56['offset']+_0x483e56[_0x8f73('0x27')];var _0x1e787d;if(_0x20d047>=_0xeea2da){_0x20d047=_0xeea2da;_0x1e787d=0xc8;}else{_0x1e787d=0xce;}_0x451e1e[_0x8f73('0x21')](_0x1e787d);return _0x451e1e[_0x8f73('0x28')](_0x8f73('0x29'),_0x4d013a+'-'+_0x20d047+'/'+_0xeea2da)['json'](_0x55c77e);}return null;};}function patchUpdates(_0x33d985){return function(_0x49946c){try{jsonpatch[_0x8f73('0x2a')](_0x49946c,_0x33d985,!![]);}catch(_0x5b816a){return BPromise['reject'](_0x5b816a);}return _0x49946c[_0x8f73('0x2b')]();};}function saveUpdates(_0x1381c9,_0x2f038b){return function(_0x456bc3){if(_0x456bc3){return _0x456bc3[_0x8f73('0x2c')](_0x1381c9)[_0x8f73('0x2d')](function(_0x458111){return _0x458111;});}return null;};}function removeEntity(_0x5d8bac,_0x4b2be2){return function(_0x1f67ac){if(_0x1f67ac){return _0x1f67ac[_0x8f73('0x2e')]()[_0x8f73('0x2d')](function(){var _0x2563e8=_0x1f67ac[_0x8f73('0x2f')]({'plain':!![]});var _0x44f944=_0x8f73('0x30');return db[_0x8f73('0x31')][_0x8f73('0x2e')]({'where':{'type':_0x44f944,'resourceId':_0x2563e8['id']}})[_0x8f73('0x2d')](function(){return _0x1f67ac;});})[_0x8f73('0x2d')](function(){_0x5d8bac[_0x8f73('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2819ef,_0x4ab505){return function(_0x1e6fe5){if(!_0x1e6fe5){_0x2819ef[_0x8f73('0x20')](0x194);}return _0x1e6fe5;};}function handleError(_0x4ced9a,_0xf3231b){_0xf3231b=_0xf3231b||0x1f4;return function(_0x23ab57){logger[_0x8f73('0x32')](_0x23ab57[_0x8f73('0x33')]);if(_0x23ab57['name']){delete _0x23ab57[_0x8f73('0x34')];}_0x4ced9a[_0x8f73('0x21')](_0xf3231b)[_0x8f73('0x35')](_0x23ab57);};}exports[_0x8f73('0x36')]=function(_0x4ee9ab,_0x33a49c){var _0xa3c8c={},_0x5c2ba5={},_0x3cbbb4={'count':0x0,'rows':[]};var _0x19666e=_[_0x8f73('0x37')](db['Plugin']['rawAttributes'],function(_0x55c8b9){return{'name':_0x55c8b9[_0x8f73('0x38')],'type':_0x55c8b9['type'][_0x8f73('0x39')]};});_0x5c2ba5[_0x8f73('0x3a')]=_[_0x8f73('0x37')](_0x19666e,_0x8f73('0x34'));_0x5c2ba5[_0x8f73('0x3b')]=_['keys'](_0x4ee9ab['query']);_0x5c2ba5[_0x8f73('0x3c')]=_[_0x8f73('0x3d')](_0x5c2ba5['model'],_0x5c2ba5[_0x8f73('0x3b')]);_0xa3c8c['attributes']=_[_0x8f73('0x3d')](_0x5c2ba5[_0x8f73('0x3a')],qs[_0x8f73('0x3e')](_0x4ee9ab['query'][_0x8f73('0x3e')]));_0xa3c8c['attributes']=_0xa3c8c[_0x8f73('0x3f')][_0x8f73('0x40')]?_0xa3c8c['attributes']:_0x5c2ba5[_0x8f73('0x3a')];if(!_0x4ee9ab[_0x8f73('0x3b')][_0x8f73('0x41')](_0x8f73('0x42'))){_0xa3c8c[_0x8f73('0x27')]=qs[_0x8f73('0x27')](_0x4ee9ab[_0x8f73('0x3b')][_0x8f73('0x27')]);_0xa3c8c['offset']=qs[_0x8f73('0x24')](_0x4ee9ab[_0x8f73('0x3b')][_0x8f73('0x24')]);}_0xa3c8c['order']=qs[_0x8f73('0x43')](_0x4ee9ab[_0x8f73('0x3b')][_0x8f73('0x43')]);_0xa3c8c['where']=qs[_0x8f73('0x3c')](_[_0x8f73('0x44')](_0x4ee9ab[_0x8f73('0x3b')],_0x5c2ba5[_0x8f73('0x3c')]),_0x19666e);if(_0x4ee9ab[_0x8f73('0x3b')][_0x8f73('0x45')]){_0xa3c8c[_0x8f73('0x46')]=_[_0x8f73('0x47')](_0xa3c8c[_0x8f73('0x46')],{'$or':_[_0x8f73('0x37')](_0x19666e,function(_0x2712c6){if(_0x2712c6[_0x8f73('0x48')]!==_0x8f73('0x49')){var _0x3122a6={};_0x3122a6[_0x2712c6[_0x8f73('0x34')]]={'$like':'%'+_0x4ee9ab[_0x8f73('0x3b')][_0x8f73('0x45')]+'%'};return _0x3122a6;}})});}_0xa3c8c=_[_0x8f73('0x47')]({},_0xa3c8c,_0x4ee9ab[_0x8f73('0x4a')]);var _0x3cb1d6={'where':_0xa3c8c['where']};return db['Plugin'][_0x8f73('0x26')](_0x3cb1d6)[_0x8f73('0x2d')](function(_0x24e7fa){_0x3cbbb4[_0x8f73('0x26')]=_0x24e7fa;if(_0x4ee9ab[_0x8f73('0x3b')][_0x8f73('0x4b')]){_0xa3c8c[_0x8f73('0x4c')]=[{'all':!![]}];}return db[_0x8f73('0x4d')]['findAll'](_0xa3c8c);})['then'](function(_0x3e444e){_0x3cbbb4['rows']=_0x3e444e;return _0x3cbbb4;})[_0x8f73('0x2d')](respondWithFilteredResult(_0x33a49c,_0xa3c8c))['catch'](handleError(_0x33a49c,null));};exports['show']=function(_0x5d33f3,_0x4d1683){var _0x21ea93={'raw':!![],'where':{'id':_0x5d33f3['params']['id']}},_0x50ff82={};_0x50ff82['model']=_['keys'](db[_0x8f73('0x4d')][_0x8f73('0x4e')]);_0x50ff82[_0x8f73('0x3b')]=_[_0x8f73('0x4f')](_0x5d33f3[_0x8f73('0x3b')]);_0x50ff82[_0x8f73('0x3c')]=_[_0x8f73('0x3d')](_0x50ff82[_0x8f73('0x3a')],_0x50ff82[_0x8f73('0x3b')]);_0x21ea93[_0x8f73('0x3f')]=_[_0x8f73('0x3d')](_0x50ff82['model'],qs[_0x8f73('0x3e')](_0x5d33f3[_0x8f73('0x3b')]['fields']));_0x21ea93[_0x8f73('0x3f')]=_0x21ea93[_0x8f73('0x3f')][_0x8f73('0x40')]?_0x21ea93[_0x8f73('0x3f')]:_0x50ff82[_0x8f73('0x3a')];if(_0x5d33f3[_0x8f73('0x3b')][_0x8f73('0x4b')]){_0x21ea93[_0x8f73('0x4c')]=[{'all':!![]}];}_0x21ea93=_[_0x8f73('0x47')]({},_0x21ea93,_0x5d33f3[_0x8f73('0x4a')]);return db['Plugin'][_0x8f73('0x50')](_0x21ea93)['then'](handleEntityNotFound(_0x4d1683,null))[_0x8f73('0x2d')](respondWithResult(_0x4d1683,null))[_0x8f73('0x51')](handleError(_0x4d1683,null));};exports['download']=function(_0x565dd7,_0xde5ac7,_0x542129){return db[_0x8f73('0x4d')][_0x8f73('0x50')]({'where':{'id':_0x565dd7[_0x8f73('0x52')]['id']},'attributes':[_0x8f73('0x34'),_0x8f73('0x6')],'raw':!![]})[_0x8f73('0x2d')](handleEntityNotFound(_0xde5ac7,null))[_0x8f73('0x2d')](function(_0x152364){if(_0x152364){var _0x9640c9=path[_0x8f73('0x53')](config[_0x8f73('0x54')],'server/files/plugins',util['format'](_0x8f73('0x55'),path[_0x8f73('0x56')](_0x152364[_0x8f73('0x6')])));var _0x421634=fs['createWriteStream'](_0x9640c9);var _0x3326c7=archiver(_0x8f73('0x57'),{'zlib':{'level':0x9}});_0x3326c7['on'](_0x8f73('0x58'),function(_0x187260){if(_0x187260[_0x8f73('0x59')]===_0x8f73('0x5a')){logger[_0x8f73('0x32')](_0x187260);}else{throw new db[(_0x8f73('0x5b'))][(_0x8f73('0x5c'))](_0x8f73('0x5d'));}});_0x3326c7['on'](_0x8f73('0x32'),function(_0x131f55){throw new db['Sequelize'][(_0x8f73('0x5c'))](_0x8f73('0x5d'));});_0x3326c7[_0x8f73('0x5e')](_0x421634);_0x3326c7[_0x8f73('0x5f')](_0x8f73('0x60'),{'cwd':path[_0x8f73('0x53')](config[_0x8f73('0x54')],_0x8f73('0x61'),path[_0x8f73('0x62')](_0x152364[_0x8f73('0x6')])),'ignore':[path[_0x8f73('0x53')](path[_0x8f73('0x56')](_0x152364[_0x8f73('0x6')]),_0x8f73('0x63')),path[_0x8f73('0x53')](path[_0x8f73('0x56')](_0x152364[_0x8f73('0x6')]),_0x8f73('0x64'))],'nodir':!![]})[_0x8f73('0x65')]();_0x421634['on'](_0x8f73('0x66'),function(){if(!fs['existsSync'](_0x9640c9)){throw new db['Sequelize'][(_0x8f73('0x5c'))]('Plugin\x20not\x20found');}return _0xde5ac7['download'](_0x9640c9,util[_0x8f73('0x67')]('%s.zip',path['basename'](_0x152364[_0x8f73('0x6')])),function(_0x4f204b){if(_0x4f204b){throw new db['Sequelize'][(_0x8f73('0x5c'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x8f73('0x68')](_0x9640c9);logger['info']('Download\x20completed');logger['info'](_0x8f73('0x69'));});});}return null;})[_0x8f73('0x51')](handleError(_0xde5ac7,null));};exports[_0x8f73('0x6a')]=function(_0x4a662c,_0x526dfd,_0x3f946d){var _0x534c14=path[_0x8f73('0x56')](_0x4a662c[_0x8f73('0x6b')][_0x8f73('0x6c')],path['extname'](_0x4a662c['file']['filename']));var _0x5769ae=path[_0x8f73('0x53')](config[_0x8f73('0x54')],_0x8f73('0x61'),_0x4a662c[_0x8f73('0x6b')][_0x8f73('0x6c')]);var _0x455871=path[_0x8f73('0x53')](config[_0x8f73('0x54')],'server/files/plugins',_0x534c14);logger[_0x8f73('0x6d')]('Plugin\x20upload\x20filepath:\x20%s',_0x5769ae);logger[_0x8f73('0x6d')](_0x8f73('0x6e'),_0x455871);try{fs[_0x8f73('0x6f')](_0x5769ae,parseInt(_0x8f73('0x70'),0x8));extract(_0x5769ae,{'dir':_0x455871},function(_0x4cc9f8){if(_0x4cc9f8){logger['error'](_0x4cc9f8);handleError(_0x4cc9f8,!![]);};var _0x3f09c4=fs[_0x8f73('0x71')](_0x455871);if(_0x3f09c4[_0x8f73('0x40')]>0x1){removeReferences(_0x5769ae,_0x455871);logger[_0x8f73('0x32')](_0x8f73('0x72'));return _0x3f946d(new Error('Invalid\x20plugin\x20structure'));}var _0x1eb06d=fs['lstatSync'](path[_0x8f73('0x53')](_0x455871,_0x3f09c4[0x0]));if(_0x1eb06d[_0x8f73('0x73')]()){removeReferences(_0x5769ae,_0x455871);logger[_0x8f73('0x32')](_0x8f73('0x72'));return _0x3f946d(new Error(_0x8f73('0x72')));}if(_0x1eb06d['isDirectory']()){var _0x2b4930=fs[_0x8f73('0x71')](path[_0x8f73('0x53')](_0x455871,_0x3f09c4[0x0]));if(_0x2b4930[_0x8f73('0x40')]===0x0){removeReferences(_0x5769ae,_0x455871);logger[_0x8f73('0x32')](_0x8f73('0x72'));return _0x3f946d(new Error('Invalid\x20plugin\x20structure'));}var _0x1e0916=_0x2b4930[_0x8f73('0x74')](function(_0x4069ea){return _0x4069ea===_0x8f73('0x75');});if(!_0x1e0916){return _0x3f946d(new Error('Plugin\x20manifest\x20missing'));}var _0x1c9fe2=fs['readFileSync'](path[_0x8f73('0x53')](_0x455871,_0x3f09c4[0x0],_0x8f73('0x75')));var _0x34ba57=JSON[_0x8f73('0x76')](_0x1c9fe2);if(_0x8f73('0x25')==typeof _0x34ba57[_0x8f73('0x34')]){return _0x3f946d(new Error(_0x8f73('0x77')));}if(_0x8f73('0x25')==typeof _0x34ba57[_0x8f73('0x48')]){return _0x3f946d(new Error(_0x8f73('0x78')));}if(_0x8f73('0x25')==typeof _0x34ba57['version']){return _0x3f946d(new Error(_0x8f73('0x79')));}if(_0x8f73('0x25')==typeof _0x34ba57[_0x8f73('0x7a')]){return _0x3f946d(new Error(_0x8f73('0x7b')));}if(_0x34ba57['type']===_0x8f73('0x7c')){if('undefined'==typeof _0x34ba57['parameters'][_0x8f73('0x7d')]){return _0x3f946d(new Error(_0x8f73('0x7e')));}if(_0x8f73('0x25')==typeof _0x34ba57[_0x8f73('0x7a')][_0x8f73('0x7d')]['admin']&&_0x8f73('0x25')==typeof _0x34ba57[_0x8f73('0x7a')]['views'][_0x8f73('0x7f')]){return _0x3f946d(new Error(_0x8f73('0x80')));}}else if(_0x34ba57[_0x8f73('0x48')]===_0x8f73('0x81')){if('undefined'==typeof _0x34ba57[_0x8f73('0x7a')][_0x8f73('0x82')]){return _0x3f946d(new Error(_0x8f73('0x83')));}if('undefined'==typeof _0x34ba57[_0x8f73('0x7a')]['scriptPath']){return _0x3f946d(new Error(_0x8f73('0x84')));}}else{return _0x3f946d(new Error(_0x8f73('0x85')));}var _0x40d898=_0x34ba57[_0x8f73('0x34')];var _0x43821a=_0x34ba57[_0x8f73('0x86')];var _0xa181fb=_0x34ba57['type'];var _0x1f261c=_0x34ba57[_0x8f73('0x87')]?_0x34ba57[_0x8f73('0x87')]:_0x8f73('0x88');var _0x15c6df=_0x34ba57[_0x8f73('0x89')]?_0x34ba57[_0x8f73('0x89')]:_0x8f73('0x8a');var _0x2d1e05='';var _0x292be4='';var _0x5a4f57='';var _0x525399='';var _0x1583be=_0x34ba57['version'];if(_0xa181fb===_0x8f73('0x7c')){if('undefined'!=typeof _0x34ba57[_0x8f73('0x7a')]['views']['admin']){var _0xbf31c7=_0x34ba57['parameters'][_0x8f73('0x7d')][_0x8f73('0x8b')];if(!/^(f|ht)tps?:\/\//i['test'](_0xbf31c7)){_0x2d1e05=path[_0x8f73('0x53')](_0x8f73('0x8c'),_0x534c14,_0x3f09c4[0x0],_0xbf31c7);}else{_0x2d1e05=_0xbf31c7;}}else{logger[_0x8f73('0x6d')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x8f73('0x25')!=typeof _0x34ba57[_0x8f73('0x7a')][_0x8f73('0x7d')]['agent']){var _0x2da788=_0x34ba57[_0x8f73('0x7a')][_0x8f73('0x7d')][_0x8f73('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0x8f73('0x8d')](_0x2da788)){_0x292be4=path['join'](_0x8f73('0x8c'),_0x534c14,_0x3f09c4[0x0],_0x2da788);}else{_0x292be4=_0x2da788;}}else{logger[_0x8f73('0x6d')](_0x8f73('0x8e'));}}else if(_0xa181fb===_0x8f73('0x81')){_0x5a4f57=_0x34ba57['parameters']['scriptName'];_0x525399=_0x34ba57[_0x8f73('0x7a')]['scriptPath'];if(_0x8f73('0x25')!=typeof _0x34ba57[_0x8f73('0x7a')][_0x8f73('0x7d')]){if(_0x8f73('0x25')!=typeof _0x34ba57['parameters'][_0x8f73('0x7d')]['admin']){var _0xbf31c7=_0x34ba57[_0x8f73('0x7a')]['views'][_0x8f73('0x8b')];if(!/^(f|ht)tps?:\/\//i[_0x8f73('0x8d')](_0xbf31c7)){_0x2d1e05=path[_0x8f73('0x53')](_0x8f73('0x8c'),_0x534c14,_0x3f09c4[0x0],_0xbf31c7);}else{_0x2d1e05=_0xbf31c7;}}if(_0x8f73('0x25')!=typeof _0x34ba57[_0x8f73('0x7a')][_0x8f73('0x7d')]['agent']){var _0x2da788=_0x34ba57[_0x8f73('0x7a')][_0x8f73('0x7d')][_0x8f73('0x7f')];if(!/^(f|ht)tps?:\/\//i['test'](_0x2da788)){_0x292be4=path[_0x8f73('0x53')]('plugins',_0x534c14,_0x3f09c4[0x0],_0x2da788);}else{_0x292be4=_0x2da788;}}}}var _0x2424d5={'name':_0x40d898,'description':_0x43821a,'path':path[_0x8f73('0x53')](_0x534c14,_0x3f09c4[0x0]),'type':_0xa181fb,'sidebar':_0x1f261c,'icon':_0x15c6df,'adminUrl':_0x2d1e05,'agentUrl':_0x292be4,'scriptName':_0x5a4f57,'scriptPath':_0x525399,'version':_0x1583be};removeReferences(_0x5769ae,null);return db['Plugin'][_0x8f73('0x8f')](_0x2424d5)[_0x8f73('0x2d')](function(_0x392b70){var _0x29ec4a={'role':_0x4a662c[_0x8f73('0x90')][_0x8f73('0x91')],'userProfileId':_0x4a662c['body']['userProfileId']};if(!_0x29ec4a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29ec4a[_0x8f73('0x91')]===_0x8f73('0x92')){var _0x202b64=_0x392b70[_0x8f73('0x2f')]({'plain':!![]});return db[_0x8f73('0x93')]['find']({'where':{'name':_0x8f73('0x30'),'userProfileId':_0x29ec4a[_0x8f73('0x94')]},'raw':!![]})[_0x8f73('0x2d')](function(_0x5b90fe){if(_0x5b90fe&&_0x5b90fe[_0x8f73('0x95')]===0x0){return db[_0x8f73('0x31')]['create']({'name':_0x202b64[_0x8f73('0x34')],'resourceId':_0x202b64['id'],'type':_0x5b90fe[_0x8f73('0x34')],'sectionId':_0x5b90fe['id']},{})[_0x8f73('0x2d')](function(){return _0x392b70;});}else{return _0x392b70;}})[_0x8f73('0x51')](function(_0x28b714){logger[_0x8f73('0x32')](_0x8f73('0x96'),_0x28b714);throw _0x28b714;});}return _0x392b70;})[_0x8f73('0x2d')](respondWithResult(_0x526dfd,null))['catch'](handleError(_0x526dfd,null));}});}catch(_0x3e785c){_0x526dfd[_0x8f73('0x21')](0x1f4)[_0x8f73('0x35')](_0x3e785c);}};function removeReferences(_0x255254,_0x36955d){try{if(_0x255254){fs['unlinkSync'](_0x255254);logger[_0x8f73('0x6d')](_0x8f73('0x97'));}if(_0x36955d){rimraf(_0x36955d,function(){});logger[_0x8f73('0x6d')]('Extracted\x20folder\x20removed');}}catch(_0x5c3ddc){logger[_0x8f73('0x32')](_0x5c3ddc);}}exports[_0x8f73('0x2c')]=function(_0x47e18f,_0x17b164,_0x34cd00){return db[_0x8f73('0x4d')][_0x8f73('0x50')]({'where':{'id':_0x47e18f[_0x8f73('0x52')]['id']}})[_0x8f73('0x2d')](handleEntityNotFound(_0x17b164,null))[_0x8f73('0x2d')](saveUpdates(_0x47e18f['body'],null))[_0x8f73('0x2d')](respondWithResult(_0x17b164,null))[_0x8f73('0x51')](handleError(_0x17b164,null));};exports[_0x8f73('0x98')]=function(_0x3606f6,_0x2894e0,_0x6e6efa){return db[_0x8f73('0x4d')][_0x8f73('0x50')]({'where':{'id':_0x3606f6[_0x8f73('0x52')]['id']}})['then'](function(_0x494d96){if(_0x494d96){return _0x494d96[_0x8f73('0x2e')]();}})[_0x8f73('0x2d')](function(_0x490ee5){rimraf(path['join'](config['root'],_0x8f73('0x61'),path['dirname'](_0x490ee5['path'])),function(){});return _0x490ee5;})[_0x8f73('0x2d')](handleEntityNotFound(_0x2894e0,null))[_0x8f73('0x2d')](respondWithStatusCode(_0x2894e0,null))['catch'](handleError(_0x2894e0,null));};exports['webhookGet']=function(_0x2ac89c,_0x477850,_0x45160e){return BPromise[_0x8f73('0x99')]()['then'](function(){if(!_0x2ac89c[_0x8f73('0x3b')][_0x8f73('0x6')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x2ac89c['query'][_0x8f73('0x9a')]){throw new Error(_0x8f73('0x9b'));}var _0x387d03=_0x2ac89c['query'][_0x8f73('0x9c')]?_0x2ac89c[_0x8f73('0x3b')][_0x8f73('0x9c')]+':'+_0x2ac89c[_0x8f73('0x3b')][_0x8f73('0x9a')]:_0x8f73('0x9d')+_0x2ac89c[_0x8f73('0x3b')][_0x8f73('0x9a')];var _0x222efb=_0x2ac89c[_0x8f73('0x3b')][_0x8f73('0x23')]?_0x2ac89c[_0x8f73('0x3b')]['json']:!![];var _0x269a46=_0x2ac89c[_0x8f73('0x3b')][_0x8f73('0x9e')]?_0x2ac89c[_0x8f73('0x3b')][_0x8f73('0x9e')]:null;var _0x5dbe49={'method':_0x2ac89c['method'],'uri':util[_0x8f73('0x67')](_0x8f73('0x9f'),_0x387d03,_0x2ac89c[_0x8f73('0x3b')]['path']),'json':_0x222efb,'resolveWithFullResponse':!![],'encoding':_0x269a46,'qs':_0x2ac89c['query']};if(_0x2ac89c['headers']){_0x5dbe49[_0x8f73('0xa0')]=_0x2ac89c[_0x8f73('0xa0')];if(_0x5dbe49[_0x8f73('0xa0')][_0x8f73('0xa1')]){delete _0x5dbe49[_0x8f73('0xa0')][_0x8f73('0xa1')];}}if(_0x5dbe49[_0x8f73('0xa0')]['content-type']){delete _0x5dbe49['headers']['content-type'];}return rp(_0x5dbe49);})[_0x8f73('0x2d')](function(_0x4d6bdd){if(_0x4d6bdd){_0x477850[_0x8f73('0x28')](_0x4d6bdd[_0x8f73('0xa0')]);logger[_0x8f73('0x6d')](_0x4d6bdd[_0x8f73('0x90')]);if(_[_0x8f73('0xa2')](_0x2ac89c[_0x8f73('0x3b')][_0x8f73('0x6')],'download')&&_0x4d6bdd[_0x8f73('0xa3')]==0x1f4){return _0x477850[_0x8f73('0x20')](_0x4d6bdd[_0x8f73('0xa3')]);}else{return _0x477850[_0x8f73('0x21')](_0x4d6bdd[_0x8f73('0xa3')])[_0x8f73('0x35')](_0x4d6bdd[_0x8f73('0x90')]);}}else{return _0x477850[_0x8f73('0x20')](0xc8);}})[_0x8f73('0x51')](handleError(_0x477850,null));};exports[_0x8f73('0xa4')]=function(_0x44c826,_0xb6bfef,_0x565756){return BPromise[_0x8f73('0x99')]()['then'](function(){if(!_0x44c826['query'][_0x8f73('0x6')]){throw new Error(_0x8f73('0xa5'));}if(!_0x44c826[_0x8f73('0x3b')][_0x8f73('0x9a')]){throw new Error(_0x8f73('0x9b'));}var _0x37c5fe=_0x44c826[_0x8f73('0x3b')][_0x8f73('0x9c')]?_0x44c826[_0x8f73('0x3b')][_0x8f73('0x9c')]+':'+_0x44c826['query'][_0x8f73('0x9a')]:_0x8f73('0x9d')+_0x44c826[_0x8f73('0x3b')][_0x8f73('0x9a')];var _0x2e66ce=_0x44c826['query']['json']?_0x44c826[_0x8f73('0x3b')][_0x8f73('0x23')]:!![];var _0x4035be=_0x44c826[_0x8f73('0x3b')][_0x8f73('0x9e')]?_0x44c826[_0x8f73('0x3b')]['encoding']:null;var _0x25a444={'method':_0x44c826[_0x8f73('0xa6')],'uri':util[_0x8f73('0x67')]('%s%s',_0x37c5fe,_0x44c826[_0x8f73('0x3b')][_0x8f73('0x6')]),'json':_0x2e66ce,'resolveWithFullResponse':!![],'encoding':_0x4035be,'body':_0x44c826['body']};if(_0x44c826[_0x8f73('0xa0')]){_0x25a444[_0x8f73('0xa0')]=_0x44c826[_0x8f73('0xa0')];if(_0x25a444[_0x8f73('0xa0')][_0x8f73('0xa1')]){delete _0x25a444[_0x8f73('0xa0')][_0x8f73('0xa1')];}}if(_0x25a444[_0x8f73('0xa0')][_0x8f73('0xa7')]){delete _0x25a444[_0x8f73('0xa0')][_0x8f73('0xa7')];}return rp(_0x25a444);})[_0x8f73('0x2d')](function(_0x129e2b){if(_0x129e2b){_0xb6bfef[_0x8f73('0x28')](_0x129e2b[_0x8f73('0xa0')]);logger['info'](_0x129e2b['body']);return _0xb6bfef['status'](_0x129e2b[_0x8f73('0xa3')])['send'](_0x129e2b[_0x8f73('0x90')]);}else{return _0xb6bfef[_0x8f73('0x20')](0xc8);}})[_0x8f73('0x51')](handleError(_0xb6bfef,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index d74fce3..afe9e11 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 _0x4ca4=['save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','Plugin','setMaxListeners'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x4ca4,0x100));var _0x44ca=function(_0x4264a2,_0x437b23){_0x4264a2=_0x4264a2-0x0;var _0xc48c85=_0x4ca4[_0x4264a2];return _0xc48c85;};'use strict';var EventEmitter=require(_0x44ca('0x0'));var Plugin=require(_0x44ca('0x1'))['db'][_0x44ca('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x44ca('0x3')](0x0);var events={'afterCreate':_0x44ca('0x4'),'afterUpdate':_0x44ca('0x5'),'afterDestroy':_0x44ca('0x6')};function emitEvent(_0x1b81d1){return function(_0x48981c,_0xe448af,_0x15e23d){PluginEvents[_0x44ca('0x7')](_0x1b81d1+':'+_0x48981c['id'],_0x48981c);PluginEvents[_0x44ca('0x7')](_0x1b81d1,_0x48981c);_0x15e23d(null);};}for(var e in events){if(events[_0x44ca('0x8')](e)){var event=events[e];Plugin[_0x44ca('0x9')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0xf611=['hasOwnProperty','hook','exports','../../mysqldb','Plugin','setMaxListeners'];(function(_0x1f61a2,_0x5be030){var _0x5557da=function(_0x13f17f){while(--_0x13f17f){_0x1f61a2['push'](_0x1f61a2['shift']());}};_0x5557da(++_0x5be030);}(_0xf611,0x7b));var _0x1f61=function(_0x83d48e,_0x507328){_0x83d48e=_0x83d48e-0x0;var _0x26f1d1=_0xf611[_0x83d48e];return _0x26f1d1;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x1f61('0x0'))['db'][_0x1f61('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x1f61('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x384593){return function(_0x4e0df1,_0xdc8d91,_0x20e477){PluginEvents['emit'](_0x384593+':'+_0x4e0df1['id'],_0x4e0df1);PluginEvents['emit'](_0x384593,_0x4e0df1);_0x20e477(null);};}for(var e in events){if(events[_0x1f61('0x3')](e)){var event=events[e];Plugin[_0x1f61('0x4')](e,emitEvent(event));}}module[_0x1f61('0x5')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index a8e2d9e..b2d82db 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 _0x6fc8=['../../config/environment','Plugin','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x6fc8,0x156));var _0x86fc=function(_0x214aed,_0x362692){_0x214aed=_0x214aed-0x0;var _0x401b18=_0x6fc8[_0x214aed];return _0x401b18;};'use strict';var _=require(_0x86fc('0x0'));var util=require(_0x86fc('0x1'));var logger=require(_0x86fc('0x2'))(_0x86fc('0x3'));var moment=require(_0x86fc('0x4'));var BPromise=require(_0x86fc('0x5'));var rp=require(_0x86fc('0x6'));var fs=require('fs');var path=require(_0x86fc('0x7'));var rimraf=require('rimraf');var config=require(_0x86fc('0x8'));var attributes=require('./plugin.attributes');module['exports']=function(_0x296553,_0x5ac2ef){return _0x296553['define'](_0x86fc('0x9'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0549=['../../config/logger','moment','request-promise','rimraf','exports','Plugin','plugins','lodash','util'];(function(_0x3b9ceb,_0x45523e){var _0x14446a=function(_0x113419){while(--_0x113419){_0x3b9ceb['push'](_0x3b9ceb['shift']());}};_0x14446a(++_0x45523e);}(_0x0549,0x1a5));var _0x9054=function(_0xd9f18f,_0x4c719d){_0xd9f18f=_0xd9f18f-0x0;var _0x1664f8=_0x0549[_0xd9f18f];return _0x1664f8;};'use strict';var _=require(_0x9054('0x0'));var util=require(_0x9054('0x1'));var logger=require(_0x9054('0x2'))('api');var moment=require(_0x9054('0x3'));var BPromise=require('bluebird');var rp=require(_0x9054('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9054('0x5'));var config=require('../../config/environment');var attributes=require('./plugin.attributes');module[_0x9054('0x6')]=function(_0x5b5f3d,_0x4d1cc2){return _0x5b5f3d['define'](_0x9054('0x7'),attributes,{'tableName':_0x9054('0x8'),'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 ea1c15b..3b790f5 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 _0x7028=['options','raw','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','./plugin.socket','register','request','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreatePlugin','Plugin','create','body'];(function(_0x399743,_0x381ec4){var _0x3dd253=function(_0x1f4eb1){while(--_0x1f4eb1){_0x399743['push'](_0x399743['shift']());}};_0x3dd253(++_0x381ec4);}(_0x7028,0x157));var _0x8702=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0x7028[_0x18a79d];return _0x4f8848;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8702('0x0'));var BPromise=require(_0x8702('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8702('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x8702('0x3'));var logger=require(_0x8702('0x4'))(_0x8702('0x5'));var config=require(_0x8702('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x8702('0x7')][_0x8702('0x8')]({'port':0x232a});config[_0x8702('0x9')]=_[_0x8702('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8702('0x9')]));require(_0x8702('0xb'))[_0x8702('0xc')](socket);function respondWithRpcPromise(_0x1b3ebc,_0x5d6284,_0x3dc4fd){return new BPromise(function(_0xeb159,_0x520cfe){return client[_0x8702('0xd')](_0x1b3ebc,_0x3dc4fd)['then'](function(_0x104a10){logger['info'](_0x8702('0xe'),_0x5d6284,_0x8702('0xf'));logger[_0x8702('0x10')](_0x8702('0x11'),_0x5d6284,'request\x20sent',JSON[_0x8702('0x12')](_0x104a10));if(_0x104a10[_0x8702('0x13')]){if(_0x104a10[_0x8702('0x13')][_0x8702('0x14')]===0x1f4){logger[_0x8702('0x13')](_0x8702('0xe'),_0x5d6284,_0x104a10[_0x8702('0x13')][_0x8702('0x15')]);return _0x520cfe(_0x104a10[_0x8702('0x13')]['message']);}logger['error'](_0x8702('0xe'),_0x5d6284,_0x104a10['error'][_0x8702('0x15')]);return _0xeb159(_0x104a10[_0x8702('0x13')][_0x8702('0x15')]);}else{logger[_0x8702('0x16')](_0x8702('0xe'),_0x5d6284,_0x8702('0xf'));_0xeb159(_0x104a10[_0x8702('0x17')]['message']);}})[_0x8702('0x18')](function(_0x4f0d01){logger[_0x8702('0x13')]('Plugin,\x20%s,\x20%s',_0x5d6284,_0x4f0d01);_0x520cfe(_0x4f0d01);});});}exports[_0x8702('0x19')]=function(_0x35a448){var _0x12483d=this;return new Promise(function(_0x2e4a19,_0x115e77){return db[_0x8702('0x1a')][_0x8702('0x1b')](_0x35a448[_0x8702('0x1c')],{'raw':_0x35a448['options']?_0x35a448[_0x8702('0x1d')][_0x8702('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x995928){logger[_0x8702('0x16')](_0x8702('0x19'),_0x35a448);logger[_0x8702('0x10')](_0x8702('0x19'),_0x35a448,JSON[_0x8702('0x12')](_0x995928));_0x2e4a19(_0x995928);})[_0x8702('0x18')](function(_0x38eb89){logger['error'](_0x8702('0x19'),_0x38eb89['message'],_0x35a448);_0x115e77(_0x12483d[_0x8702('0x13')](0x1f4,_0x38eb89[_0x8702('0x15')]));});});}; \ No newline at end of file +var _0xd023=['Plugin','body','raw','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./plugin.socket','request','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreatePlugin'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd023,0x94));var _0x3d02=function(_0x494986,_0x4debb8){_0x494986=_0x494986-0x0;var _0x1c805b=_0xd023[_0x494986];return _0x1c805b;};'use strict';var _=require(_0x3d02('0x0'));var util=require('util');var moment=require(_0x3d02('0x1'));var BPromise=require(_0x3d02('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d02('0x3'));var db=require(_0x3d02('0x4'))['db'];var utils=require(_0x3d02('0x5'));var logger=require('../../config/logger')(_0x3d02('0x6'));var config=require(_0x3d02('0x7'));var jayson=require(_0x3d02('0x8'));var client=jayson[_0x3d02('0x9')][_0x3d02('0xa')]({'port':0x232a});config[_0x3d02('0xb')]=_['defaults'](config[_0x3d02('0xb')],{'host':_0x3d02('0xc'),'port':0x18eb});var socket=require(_0x3d02('0xd'))(new Redis(config[_0x3d02('0xb')]));require(_0x3d02('0xe'))['register'](socket);function respondWithRpcPromise(_0x4b90f5,_0x1bdc77,_0x30d196){return new BPromise(function(_0x140a16,_0xc31951){return client[_0x3d02('0xf')](_0x4b90f5,_0x30d196)['then'](function(_0x4e87e5){logger[_0x3d02('0x10')](_0x3d02('0x11'),_0x1bdc77,_0x3d02('0x12'));logger[_0x3d02('0x13')](_0x3d02('0x14'),_0x1bdc77,_0x3d02('0x12'),JSON[_0x3d02('0x15')](_0x4e87e5));if(_0x4e87e5[_0x3d02('0x16')]){if(_0x4e87e5[_0x3d02('0x16')]['code']===0x1f4){logger[_0x3d02('0x16')](_0x3d02('0x11'),_0x1bdc77,_0x4e87e5[_0x3d02('0x16')][_0x3d02('0x17')]);return _0xc31951(_0x4e87e5[_0x3d02('0x16')][_0x3d02('0x17')]);}logger[_0x3d02('0x16')](_0x3d02('0x11'),_0x1bdc77,_0x4e87e5[_0x3d02('0x16')][_0x3d02('0x17')]);return _0x140a16(_0x4e87e5[_0x3d02('0x16')][_0x3d02('0x17')]);}else{logger[_0x3d02('0x10')](_0x3d02('0x11'),_0x1bdc77,_0x3d02('0x12'));_0x140a16(_0x4e87e5['result'][_0x3d02('0x17')]);}})[_0x3d02('0x18')](function(_0x4854b5){logger['error']('Plugin,\x20%s,\x20%s',_0x1bdc77,_0x4854b5);_0xc31951(_0x4854b5);});});}exports[_0x3d02('0x19')]=function(_0x2469bc){var _0x4f0504=this;return new Promise(function(_0x11bb43,_0xa2bdcf){return db[_0x3d02('0x1a')]['create'](_0x2469bc[_0x3d02('0x1b')],{'raw':_0x2469bc['options']?_0x2469bc['options'][_0x3d02('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x3ebe23){logger[_0x3d02('0x10')](_0x3d02('0x19'),_0x2469bc);logger['debug'](_0x3d02('0x19'),_0x2469bc,JSON[_0x3d02('0x15')](_0x3ebe23));_0x11bb43(_0x3ebe23);})[_0x3d02('0x18')](function(_0x1bdfcb){logger[_0x3d02('0x16')]('CreatePlugin',_0x1bdfcb[_0x3d02('0x17')],_0x2469bc);_0xa2bdcf(_0x4f0504[_0x3d02('0x16')](0x1f4,_0x1bdfcb['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 623ed24..5cca07e 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 _0xc0d7=['register','length','plugin:','./plugin.events','save','remove','update','removeListener'];(function(_0x4dea33,_0x58e04c){var _0x1ac35c=function(_0x3bfe12){while(--_0x3bfe12){_0x4dea33['push'](_0x4dea33['shift']());}};_0x1ac35c(++_0x58e04c);}(_0xc0d7,0x173));var _0x7c0d=function(_0x1346cb,_0x588d70){_0x1346cb=_0x1346cb-0x0;var _0xbb3c4e=_0xc0d7[_0x1346cb];return _0xbb3c4e;};'use strict';var PluginEvents=require(_0x7c0d('0x0'));var events=[_0x7c0d('0x1'),_0x7c0d('0x2'),_0x7c0d('0x3')];function createListener(_0x1aa290,_0x324c65){return function(_0x5d0a57){_0x324c65['emit'](_0x1aa290,_0x5d0a57);};}function removeListener(_0x16c792,_0x396497){return function(){PluginEvents[_0x7c0d('0x4')](_0x16c792,_0x396497);};}exports[_0x7c0d('0x5')]=function(_0x12cd51){for(var _0x52070c=0x0,_0x20f2c0=events[_0x7c0d('0x6')];_0x52070c<_0x20f2c0;_0x52070c++){var _0x4192d3=events[_0x52070c];var _0x528da9=createListener(_0x7c0d('0x7')+_0x4192d3,_0x12cd51);PluginEvents['on'](_0x4192d3,_0x528da9);}}; \ No newline at end of file +var _0x7463=['length','./plugin.events','save','register'];(function(_0x41033c,_0x3d23f7){var _0x499f86=function(_0x6a9782){while(--_0x6a9782){_0x41033c['push'](_0x41033c['shift']());}};_0x499f86(++_0x3d23f7);}(_0x7463,0xd5));var _0x3746=function(_0x2a0183,_0x3fc93c){_0x2a0183=_0x2a0183-0x0;var _0x158c3a=_0x7463[_0x2a0183];return _0x158c3a;};'use strict';var PluginEvents=require(_0x3746('0x0'));var events=[_0x3746('0x1'),'remove','update'];function createListener(_0x2fbfcd,_0x1380c1){return function(_0x4491d5){_0x1380c1['emit'](_0x2fbfcd,_0x4491d5);};}function removeListener(_0x5b158f,_0x3e2221){return function(){PluginEvents['removeListener'](_0x5b158f,_0x3e2221);};}exports[_0x3746('0x2')]=function(_0x142418){for(var _0x16d66e=0x0,_0x49ef8f=events[_0x3746('0x3')];_0x16d66e<_0x49ef8f;_0x16d66e++){var _0x1e613d=events[_0x16d66e];var _0x572bce=createListener('plugin:'+_0x1e613d,_0x142418);PluginEvents['on'](_0x1e613d,_0x572bce);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index e459955..b61663d 100644 --- a/server/api/pm2/index.js +++ b/server/api/pm2/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x48ce5c,_0xcebe86){var _0x28890a=function(_0x371c54){while(--_0x371c54){_0x48ce5c['push'](_0x48ce5c['shift']());}};_0x28890a(++_0xcebe86);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file +var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x2a49f0,_0x21c051){var _0x467f03=function(_0x3363cb){while(--_0x3363cb){_0x2a49f0['push'](_0x2a49f0['shift']());}};_0x467f03(++_0x21c051);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 1bfb758..ea6628a 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 _0x702d=['../../config/pm2','../../config/logger','api','path','exec','bluebird','sendStatus','status','error','stack','name','send','npm\x20install','info','index','list','then','reject','express','motion2','length','catch','show','params','create','body','join','../../files/plugins','script','cwd','chdir','start','dump','Missing\x20name\x20and/or\x20path','restart','stop','hasOwnProperty','destroy','delete','Unknown\x20id','lodash'];(function(_0x2bbb3d,_0x400061){var _0x5739f0=function(_0x5bbc70){while(--_0x5bbc70){_0x2bbb3d['push'](_0x2bbb3d['shift']());}};_0x5739f0(++_0x400061);}(_0x702d,0x147));var _0xd702=function(_0x4010f1,_0x3283cf){_0x4010f1=_0x4010f1-0x0;var _0x484629=_0x702d[_0x4010f1];return _0x484629;};'use strict';var _=require(_0xd702('0x0'));var pm2=require(_0xd702('0x1'));var logger=require(_0xd702('0x2'))(_0xd702('0x3'));var path=require(_0xd702('0x4'));var exec=require('child_process')[_0xd702('0x5')];var BPromise=require(_0xd702('0x6'));function handleEntityNotFound(_0x27b260,_0x1c5a32){return function(_0x481ee0){if(!_0x481ee0){_0x27b260[_0xd702('0x7')](0x194);;}return _0x481ee0;};}function respondWithResult(_0x544e94,_0x1aecfc){_0x1aecfc=_0x1aecfc||0xc8;return function(_0x3a2c03){if(_0x3a2c03){return _0x544e94[_0xd702('0x8')](_0x1aecfc)['json'](_0x3a2c03);}return null;};}function handleError(_0x12bb75,_0x53bd02){_0x53bd02=_0x53bd02||0x1f4;return function(_0x39c49e){logger[_0xd702('0x9')](_0x39c49e[_0xd702('0xa')]);if(_0x39c49e[_0xd702('0xb')]){delete _0x39c49e[_0xd702('0xb')];}_0x12bb75[_0xd702('0x8')](_0x53bd02)[_0xd702('0xc')](_0x39c49e);};}function execChildProcess(){return new BPromise(function(_0x1988eb,_0x5907cf){exec(_0xd702('0xd'),function(_0x58805a,_0x4a3439,_0x3e9439){logger[_0xd702('0xe')](_0x4a3439);logger[_0xd702('0xe')](_0x3e9439);if(_0x58805a){logger['error'](_0x58805a);return _0x5907cf(_0x58805a);}return _0x1988eb(_0x4a3439);});});}exports[_0xd702('0xf')]=function(_0x128add,_0x1ed8a3){return pm2[_0xd702('0x10')]()[_0xd702('0x11')](function(_0x181ff2){if(_0x181ff2){var _0x59dd33=_[_0xd702('0x12')](_0x181ff2,function(_0x3ea0ab){return _0x3ea0ab['name']===_0xd702('0x13')||_0x3ea0ab['name']===_0xd702('0x14');});return{'rows':_0x59dd33,'count':_0x59dd33[_0xd702('0x15')]};}return null;})['then'](respondWithResult(_0x1ed8a3,null))[_0xd702('0x16')](handleError(_0x1ed8a3,null));};exports[_0xd702('0x17')]=function(_0x2a87f2,_0x4fdbbd){return pm2['describe'](_0x2a87f2[_0xd702('0x18')]['id'])['then'](respondWithResult(_0x4fdbbd,null))[_0xd702('0x11')](handleEntityNotFound(_0x4fdbbd,null))[_0xd702('0x16')](handleError(_0x4fdbbd,null));};exports[_0xd702('0x19')]=function(_0x265b1b,_0x4cf326){if(_0x265b1b[_0xd702('0x1a')][_0xd702('0xb')]&&_0x265b1b['body']['script']){var _0x536ca8=path[_0xd702('0x1b')](__dirname,_0xd702('0x1c'),_0x265b1b['body'][_0xd702('0x1d')]);var _0x5d91fd=process[_0xd702('0x1e')]();process['chdir'](path['dirname'](_0x536ca8));return execChildProcess()['then'](function(_0x21c00e){process[_0xd702('0x1f')](_0x5d91fd);return pm2[_0xd702('0x20')]({'name':_0x265b1b['body'][_0xd702('0xb')],'script':_0x536ca8});})[_0xd702('0x11')](function(_0x10599a){pm2[_0xd702('0x21')]();return _0x10599a[0x0];})[_0xd702('0x11')](respondWithResult(_0x4cf326,0xc9))[_0xd702('0x16')](handleError(_0x4cf326,null));}else{return _0x4cf326[_0xd702('0x8')](0x1f4)[_0xd702('0xc')]({'message':_0xd702('0x22')});}};exports['update']=function(_0x116b2f,_0x322cb8){if(_0x116b2f[_0xd702('0x1a')]['id']){delete _0x116b2f[_0xd702('0x1a')]['id'];}var _0xbe4518={'online':_0xd702('0x23'),'stopped':_0xd702('0x24')};if(_0xbe4518[_0xd702('0x25')](_0x116b2f['body']['status'])){return pm2[_0xbe4518[_0x116b2f[_0xd702('0x1a')][_0xd702('0x8')]]](_0x116b2f['params']['id'])[_0xd702('0x11')](respondWithResult(_0x322cb8,0xc8))[_0xd702('0x16')](handleError(_0x322cb8,null));}else{return _0x322cb8[_0xd702('0x8')](0x1f4)[_0xd702('0xc')]({'message':'Unknown\x20status'});}};exports[_0xd702('0x26')]=function(_0x313281,_0x1630ed){if(_0x313281[_0xd702('0x1a')]['id']){delete _0x313281[_0xd702('0x1a')]['id'];}if(_0x313281['params']['id']){return pm2[_0xd702('0x27')](_0x313281[_0xd702('0x18')]['id'])[_0xd702('0x11')](function(_0x5abfea){pm2[_0xd702('0x21')]();return _0x5abfea[0x0];})['then'](respondWithResult(_0x1630ed,null))['catch'](handleError(_0x1630ed,null));}else{return _0x1630ed[_0xd702('0x8')](0x1f4)[_0xd702('0xc')]({'message':_0xd702('0x28')});}}; \ No newline at end of file +var _0x7a2c=['start','dump','catch','status','Missing\x20name\x20and/or\x20path','restart','stop','hasOwnProperty','destroy','Unknown\x20id','lodash','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','json','stack','name','send','npm\x20install','info','index','list','then','reject','express','motion2','length','show','describe','params','create','body','join','script','cwd','chdir','dirname'];(function(_0x534f31,_0x5bb3bd){var _0x34ca1e=function(_0xa02bd1){while(--_0xa02bd1){_0x534f31['push'](_0x534f31['shift']());}};_0x34ca1e(++_0x5bb3bd);}(_0x7a2c,0x17b));var _0xc7a2=function(_0x2dcfbb,_0x24581f){_0x2dcfbb=_0x2dcfbb-0x0;var _0xbbe51b=_0x7a2c[_0x2dcfbb];return _0xbbe51b;};'use strict';var _=require(_0xc7a2('0x0'));var pm2=require('../../config/pm2');var logger=require(_0xc7a2('0x1'))(_0xc7a2('0x2'));var path=require(_0xc7a2('0x3'));var exec=require(_0xc7a2('0x4'))[_0xc7a2('0x5')];var BPromise=require(_0xc7a2('0x6'));function handleEntityNotFound(_0x3f2b0d,_0x34cd60){return function(_0x489232){if(!_0x489232){_0x3f2b0d[_0xc7a2('0x7')](0x194);;}return _0x489232;};}function respondWithResult(_0x1ddbae,_0x5f334e){_0x5f334e=_0x5f334e||0xc8;return function(_0x481430){if(_0x481430){return _0x1ddbae['status'](_0x5f334e)[_0xc7a2('0x8')](_0x481430);}return null;};}function handleError(_0x3de428,_0x3f0573){_0x3f0573=_0x3f0573||0x1f4;return function(_0x426fea){logger['error'](_0x426fea[_0xc7a2('0x9')]);if(_0x426fea[_0xc7a2('0xa')]){delete _0x426fea[_0xc7a2('0xa')];}_0x3de428['status'](_0x3f0573)[_0xc7a2('0xb')](_0x426fea);};}function execChildProcess(){return new BPromise(function(_0x4a44c7,_0x3e216a){exec(_0xc7a2('0xc'),function(_0x1a9b38,_0x540267,_0x226982){logger[_0xc7a2('0xd')](_0x540267);logger[_0xc7a2('0xd')](_0x226982);if(_0x1a9b38){logger['error'](_0x1a9b38);return _0x3e216a(_0x1a9b38);}return _0x4a44c7(_0x540267);});});}exports[_0xc7a2('0xe')]=function(_0x1b7844,_0x181f0c){return pm2[_0xc7a2('0xf')]()[_0xc7a2('0x10')](function(_0x2af363){if(_0x2af363){var _0x15d4cf=_[_0xc7a2('0x11')](_0x2af363,function(_0x275be9){return _0x275be9[_0xc7a2('0xa')]===_0xc7a2('0x12')||_0x275be9[_0xc7a2('0xa')]===_0xc7a2('0x13');});return{'rows':_0x15d4cf,'count':_0x15d4cf[_0xc7a2('0x14')]};}return null;})[_0xc7a2('0x10')](respondWithResult(_0x181f0c,null))['catch'](handleError(_0x181f0c,null));};exports[_0xc7a2('0x15')]=function(_0x59e8ad,_0x2414f4){return pm2[_0xc7a2('0x16')](_0x59e8ad[_0xc7a2('0x17')]['id'])[_0xc7a2('0x10')](respondWithResult(_0x2414f4,null))['then'](handleEntityNotFound(_0x2414f4,null))['catch'](handleError(_0x2414f4,null));};exports[_0xc7a2('0x18')]=function(_0x22e80a,_0x51cbb3){if(_0x22e80a['body']['name']&&_0x22e80a[_0xc7a2('0x19')]['script']){var _0x155c42=path[_0xc7a2('0x1a')](__dirname,'../../files/plugins',_0x22e80a[_0xc7a2('0x19')][_0xc7a2('0x1b')]);var _0x1b51a1=process[_0xc7a2('0x1c')]();process[_0xc7a2('0x1d')](path[_0xc7a2('0x1e')](_0x155c42));return execChildProcess()[_0xc7a2('0x10')](function(_0x4a05e1){process['chdir'](_0x1b51a1);return pm2[_0xc7a2('0x1f')]({'name':_0x22e80a[_0xc7a2('0x19')]['name'],'script':_0x155c42});})[_0xc7a2('0x10')](function(_0x3cad61){pm2[_0xc7a2('0x20')]();return _0x3cad61[0x0];})[_0xc7a2('0x10')](respondWithResult(_0x51cbb3,0xc9))[_0xc7a2('0x21')](handleError(_0x51cbb3,null));}else{return _0x51cbb3[_0xc7a2('0x22')](0x1f4)[_0xc7a2('0xb')]({'message':_0xc7a2('0x23')});}};exports['update']=function(_0x35a6e0,_0x505fe8){if(_0x35a6e0[_0xc7a2('0x19')]['id']){delete _0x35a6e0['body']['id'];}var _0x20404b={'online':_0xc7a2('0x24'),'stopped':_0xc7a2('0x25')};if(_0x20404b[_0xc7a2('0x26')](_0x35a6e0['body']['status'])){return pm2[_0x20404b[_0x35a6e0[_0xc7a2('0x19')][_0xc7a2('0x22')]]](_0x35a6e0[_0xc7a2('0x17')]['id'])[_0xc7a2('0x10')](respondWithResult(_0x505fe8,0xc8))[_0xc7a2('0x21')](handleError(_0x505fe8,null));}else{return _0x505fe8[_0xc7a2('0x22')](0x1f4)[_0xc7a2('0xb')]({'message':'Unknown\x20status'});}};exports[_0xc7a2('0x27')]=function(_0x926b6c,_0x496386){if(_0x926b6c[_0xc7a2('0x19')]['id']){delete _0x926b6c[_0xc7a2('0x19')]['id'];}if(_0x926b6c[_0xc7a2('0x17')]['id']){return pm2['delete'](_0x926b6c[_0xc7a2('0x17')]['id'])['then'](function(_0x1f9bdc){pm2['dump']();return _0x1f9bdc[0x0];})['then'](respondWithResult(_0x496386,null))[_0xc7a2('0x21')](handleError(_0x496386,null));}else{return _0x496386['status'](0x1f4)['send']({'message':_0xc7a2('0x28')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index d59dabe..b62dc39 100644 --- a/server/api/realtime/index.js +++ b/server/api/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf02c=['getQueues','exports','express','Router','../../components/auth/service','./realtime.controller','get','/queues','isAuthenticated'];(function(_0x568c6a,_0x1ec87d){var _0x35dc86=function(_0x2a314e){while(--_0x2a314e){_0x568c6a['push'](_0x568c6a['shift']());}};_0x35dc86(++_0x1ec87d);}(_0xf02c,0x92));var _0xcf02=function(_0x14d7b1,_0xb81080){_0x14d7b1=_0x14d7b1-0x0;var _0x29b0cf=_0xf02c[_0x14d7b1];return _0x29b0cf;};'use strict';var express=require(_0xcf02('0x0'));var router=express[_0xcf02('0x1')]();var auth=require(_0xcf02('0x2'));var controller=require(_0xcf02('0x3'));router[_0xcf02('0x4')](_0xcf02('0x5'),auth[_0xcf02('0x6')](),controller[_0xcf02('0x7')]);module[_0xcf02('0x8')]=router; \ No newline at end of file +var _0xf11e=['./realtime.controller','get','getQueues','express','../../components/auth/service'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0xf11e,0x11b));var _0xef11=function(_0x26303d,_0x3f49fd){_0x26303d=_0x26303d-0x0;var _0x21ef9c=_0xf11e[_0x26303d];return _0x21ef9c;};'use strict';var express=require(_0xef11('0x0'));var router=express['Router']();var auth=require(_0xef11('0x1'));var controller=require(_0xef11('0x2'));router[_0xef11('0x3')]('/queues',auth['isAuthenticated'](),controller[_0xef11('0x4')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 044b907..e10c5b3 100644 --- a/server/api/realtime/realtime.controller.js +++ b/server/api/realtime/realtime.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa456=['toLowerCase','startCase','Queue','map','fieldName','type','key','getOptions','user','role','userProfileId','outbound','Queues','filter','UserProfile','getResources','findAndCountAll','request','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','loggedIn','waiting','paused','push','pTalking','originated','message','dialActive','dialMethod','Trunk','startPredictive','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','get','loggedInDb','available','talking','agents','find','rows','merge','pick','online','getMembers','UserId','User','findAll','QueueId','agent','all','catch','util','lodash','jayson/promise','../../components/parsers/qs','api','../../mysqldb','client','http','offset','undefined','limit','count','set','Content-Range','error','stack','name','getQueues','mail','chat','sms','voice','resolve','then','query','channel'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa456,0x142));var _0x6a45=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0xa456[_0x19b3f9];return _0x18c3f6;};'use strict';var util=require(_0x6a45('0x0'));var _=require(_0x6a45('0x1'));var jayson=require(_0x6a45('0x2'));var qs=require(_0x6a45('0x3'));var logger=require('../../config/logger')(_0x6a45('0x4'));var db=require(_0x6a45('0x5'))['db'];var client=jayson[_0x6a45('0x6')]['http']({'port':0x232a});var routingClient=jayson[_0x6a45('0x6')][_0x6a45('0x7')]({'port':0x232c});function respondWithFilteredResult(_0x1e5882,_0x14da6b){return function(_0x4dfbfa){if(_0x4dfbfa){var _0x25cf8d=typeof _0x14da6b[_0x6a45('0x8')]===_0x6a45('0x9')&&typeof _0x14da6b[_0x6a45('0xa')]===_0x6a45('0x9');var _0x4858df=_0x4dfbfa[_0x6a45('0xb')];var _0x517040=_0x25cf8d?0x0:_0x14da6b[_0x6a45('0x8')];var _0x3a9671=_0x25cf8d?_0x4dfbfa[_0x6a45('0xb')]:_0x14da6b[_0x6a45('0x8')]+_0x14da6b[_0x6a45('0xa')];var _0x4ff9ae;if(_0x3a9671>=_0x4858df){_0x3a9671=_0x4858df;_0x4ff9ae=0xc8;}else{_0x4ff9ae=0xce;}_0x1e5882['status'](_0x4ff9ae);return _0x1e5882[_0x6a45('0xc')](_0x6a45('0xd'),_0x517040+'-'+_0x3a9671+'/'+_0x4858df)['json'](_0x4dfbfa);}return null;};}function handleError(_0x5a39f6,_0x511b92){_0x511b92=_0x511b92||0x1f4;return function(_0x1aa4b4){logger[_0x6a45('0xe')](_0x1aa4b4[_0x6a45('0xf')]);if(_0x1aa4b4[_0x6a45('0x10')]){delete _0x1aa4b4[_0x6a45('0x10')];}_0x5a39f6['status'](_0x511b92)['send'](_0x1aa4b4);};}exports[_0x6a45('0x11')]=function(_0xd09baf,_0x48fe0c){var _0x2c20db=[_0x6a45('0x12'),_0x6a45('0x13'),_0x6a45('0x14'),'openchannel','fax','whatsapp',_0x6a45('0x15')];var _0x391f81={'count':0x0,'rows':[]},_0x360b7f={},_0x52a055;Promise[_0x6a45('0x16')]()[_0x6a45('0x17')](function(){if(_0xd09baf[_0x6a45('0x18')]['channel']){if(!_['includes'](_0x2c20db,_0xd09baf['query'][_0x6a45('0x19')][_0x6a45('0x1a')]()))throw new Error('Invalid\x20channel');_0x52a055=_0xd09baf[_0x6a45('0x18')][_0x6a45('0x19')]['toLowerCase']();}var _0x4f7110=_[_0x6a45('0x1b')](_0x52a055)+_0x6a45('0x1c');var _0x458b99=_[_0x6a45('0x1d')](db[_0x4f7110]['rawAttributes'],function(_0x5d990e){return{'name':_0x5d990e[_0x6a45('0x1e')],'type':_0x5d990e[_0x6a45('0x1f')][_0x6a45('0x20')]};});_0x360b7f=qs[_0x6a45('0x21')](_0x458b99,_0xd09baf);if(_0xd09baf[_0x6a45('0x22')][_0x6a45('0x23')]===_0x6a45('0x22')){var _0x4692f5={'params':{'id':_0xd09baf[_0x6a45('0x22')][_0x6a45('0x24')]},'query':{'section':_0x52a055===_0x6a45('0x15')&&_0xd09baf[_0x6a45('0x18')]['type']===_0x6a45('0x25')?'QueueCampaigns':_[_0x6a45('0x1b')](_0x52a055)+_0x6a45('0x26'),'type':_0xd09baf[_0x6a45('0x18')][_0x6a45('0x1f')],'nolimit':!![],'sort':_0x6a45('0x10'),'filter':_0xd09baf['query'][_0x6a45('0x27')]}};return db[_0x6a45('0x28')][_0x6a45('0x29')](_0x4692f5);}return db[_0x4f7110][_0x6a45('0x2a')](_0x360b7f);})[_0x6a45('0x17')](function(_0x227b6f){_0x391f81[_0x6a45('0xb')]=_0x227b6f[_0x6a45('0xb')];var _0x54286d=_0x52a055===_0x6a45('0x15')?client:routingClient;return _0x54286d[_0x6a45('0x2b')](_[_0x6a45('0x1b')](_0x52a055)+_0x6a45('0x26'),_0xd09baf)[_0x6a45('0x17')](function(_0x5dc288){if(_0x5dc288[_0x6a45('0xe')])throw new Error(util[_0x6a45('0x2c')](_0x6a45('0x2d'),_0x52a055));var _0x7c1be1=_0x5dc288['result'];var _0x48e52a=[_0x6a45('0x2e'),'available',_0x6a45('0x2f'),'talking',_0x6a45('0x30')];if(_0x52a055===_0x6a45('0x15')&&_0xd09baf[_0x6a45('0x18')][_0x6a45('0x1f')]===_0x6a45('0x25')){_0x48e52a[_0x6a45('0x31')](_0x6a45('0x32'),_0x6a45('0x33'),_0x6a45('0x34'),_0x6a45('0x35'),_0x6a45('0x36'),_0x6a45('0x37'),_0x6a45('0x38'),'startProgressive',_0x6a45('0x39'),'erlangCallToSecond',_0x6a45('0x3a'),_0x6a45('0x3b'),_0x6a45('0x3c'),_0x6a45('0x3d'),_0x6a45('0x3e'),_0x6a45('0x3f'),'predictiveIntervalTotalCalls',_0x6a45('0x40'),_0x6a45('0x41'),_0x6a45('0x42'),_0x6a45('0x43'),_0x6a45('0x44'));}var _0x1996c6=_0x227b6f['rows'][_0x6a45('0x1d')](function(_0xbd573b){var _0x5c76bd=_0xbd573b[_0x6a45('0x45')]({'plain':!![]});_0x5c76bd[_0x6a45('0x30')]=0x0;_0x5c76bd[_0x6a45('0x46')]=0x0;_0x5c76bd[_0x6a45('0x2e')]=0x0;_0x5c76bd[_0x6a45('0x47')]=0x0;_0x5c76bd['paused']=0x0;_0x5c76bd[_0x6a45('0x2f')]=0x0;if(_0x52a055===_0x6a45('0x15')){_0x5c76bd[_0x6a45('0x48')]=0x0;if(_0xd09baf[_0x6a45('0x18')][_0x6a45('0x1f')]===_0x6a45('0x25')){_0x5c76bd[_0x6a45('0x32')]=0x0;_0x5c76bd['originated']=0x0;}}_0x5c76bd[_0x6a45('0x49')]=[];var _0x51adbb=_[_0x6a45('0x4a')](_0x7c1be1[_0x6a45('0x4b')],['id',_0x5c76bd['id']]);if(_0x51adbb)_[_0x6a45('0x4c')](_0x5c76bd,_[_0x6a45('0x4d')](_0x51adbb,_0x48e52a));if(_0x52a055==='voice'){return _0xbd573b['getAgents']({'attributes':['id',_0x6a45('0x10'),_0x6a45('0x4e')],'joinTableAttributes':[],'raw':!![]})['then'](function(_0x39331b){return _0xbd573b[_0x6a45('0x4f')]({'raw':!![]})[_0x6a45('0x17')](function(_0x33347b){for(var _0x4baffb=0x0;_0x4baffb<_0x39331b['length'];_0x4baffb++){var _0x518018=_['find'](_0x33347b,[_0x6a45('0x50'),_0x39331b[_0x4baffb]['id']]);var _0xb5d191={'id':_0x39331b[_0x4baffb]['id'],'name':_0x39331b[_0x4baffb][_0x6a45('0x10')],'online':Boolean(_0x39331b[_0x4baffb][_0x6a45('0x4e')]),'paused':_0x518018?Boolean(_0x518018[_0x6a45('0x30')]):![]};if(_0xb5d191[_0x6a45('0x4e')])_0x5c76bd[_0x6a45('0x46')]++;if(_0xb5d191[_0x6a45('0x30')])_0x5c76bd['paused']++;_0x5c76bd[_0x6a45('0x49')]['push'](_0xb5d191);}return _0x5c76bd;});});}else{var _0x516d22=_0x6a45('0x51')+_[_0x6a45('0x1b')](_0x52a055)+'Queue';var _0x7edbe0=_0x52a055+'Pause';return db[_0x516d22][_0x6a45('0x52')]({'where':{[_[_0x6a45('0x1b')](_0x52a055)+_0x6a45('0x53')]:_0xbd573b['id']},'raw':!![]})[_0x6a45('0x17')](function(_0x48fb5c){return db[_0x6a45('0x51')][_0x6a45('0x52')]({'attributes':['id',_0x6a45('0x10'),_0x6a45('0x4e'),_0x7edbe0],'where':{'id':_[_0x6a45('0x1d')](_0x48fb5c,'UserId'),'role':_0x6a45('0x54')},'raw':!![]});})['then'](function(_0x39bf51){for(var _0x33da06=0x0;_0x33da06<_0x39bf51['length'];_0x33da06++){var _0x1cab6f={'id':_0x39bf51[_0x33da06]['id'],'name':_0x39bf51[_0x33da06][_0x6a45('0x10')],'online':Boolean(_0x39bf51[_0x33da06][_0x6a45('0x4e')]),'paused':Boolean(_0x39bf51[_0x33da06][_0x7edbe0])};if(_0x1cab6f[_0x6a45('0x4e')])_0x5c76bd['loggedInDb']++;if(_0x1cab6f[_0x6a45('0x30')])_0x5c76bd['paused']++;_0x5c76bd[_0x6a45('0x49')]['push'](_0x1cab6f);}return _0x5c76bd;});}});return Promise[_0x6a45('0x55')](_0x1996c6);});})[_0x6a45('0x17')](function(_0x1e98a5){_0x391f81[_0x6a45('0x4b')]=_0x1e98a5;return _0x391f81;})['then'](respondWithFilteredResult(_0x48fe0c,_0x360b7f))[_0x6a45('0x56')](handleError(_0x48fe0c,null));}; \ No newline at end of file +var _0x5d58=['Queues','filter','UserProfile','getResources','findAndCountAll','count','error','format','result','available','waiting','paused','push','pTalking','originated','message','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','rows','get','loggedIn','talking','outbound','find','merge','pick','online','getMembers','UserId','agents','User','Queue','Pause','findAll','QueueId','agent','loggedInDb','all','api','../../mysqldb','http','client','undefined','limit','offset','status','set','Content-Range','json','name','send','getQueues','mail','chat','sms','openchannel','fax','whatsapp','voice','resolve','then','query','channel','includes','toLowerCase','startCase','map','type','key','user','userProfileId','QueueCampaigns'];(function(_0x330932,_0x32acac){var _0x223a13=function(_0xcd4fa9){while(--_0xcd4fa9){_0x330932['push'](_0x330932['shift']());}};_0x223a13(++_0x32acac);}(_0x5d58,0x187));var _0x85d5=function(_0x1f7bc0,_0x101382){_0x1f7bc0=_0x1f7bc0-0x0;var _0x22e079=_0x5d58[_0x1f7bc0];return _0x22e079;};'use strict';var util=require('util');var _=require('lodash');var jayson=require('jayson/promise');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x85d5('0x0'));var db=require(_0x85d5('0x1'))['db'];var client=jayson['client'][_0x85d5('0x2')]({'port':0x232a});var routingClient=jayson[_0x85d5('0x3')]['http']({'port':0x232c});function respondWithFilteredResult(_0x1eb211,_0x2d457a){return function(_0x578fad){if(_0x578fad){var _0x46e7b4=typeof _0x2d457a['offset']===_0x85d5('0x4')&&typeof _0x2d457a[_0x85d5('0x5')]==='undefined';var _0x4326a8=_0x578fad['count'];var _0x1098be=_0x46e7b4?0x0:_0x2d457a[_0x85d5('0x6')];var _0x258f0c=_0x46e7b4?_0x578fad['count']:_0x2d457a['offset']+_0x2d457a['limit'];var _0x1a2b82;if(_0x258f0c>=_0x4326a8){_0x258f0c=_0x4326a8;_0x1a2b82=0xc8;}else{_0x1a2b82=0xce;}_0x1eb211[_0x85d5('0x7')](_0x1a2b82);return _0x1eb211[_0x85d5('0x8')](_0x85d5('0x9'),_0x1098be+'-'+_0x258f0c+'/'+_0x4326a8)[_0x85d5('0xa')](_0x578fad);}return null;};}function handleError(_0x18331f,_0x31409d){_0x31409d=_0x31409d||0x1f4;return function(_0x5897af){logger['error'](_0x5897af['stack']);if(_0x5897af[_0x85d5('0xb')]){delete _0x5897af[_0x85d5('0xb')];}_0x18331f[_0x85d5('0x7')](_0x31409d)[_0x85d5('0xc')](_0x5897af);};}exports[_0x85d5('0xd')]=function(_0x44f702,_0x1545b4){var _0x586382=[_0x85d5('0xe'),_0x85d5('0xf'),_0x85d5('0x10'),_0x85d5('0x11'),_0x85d5('0x12'),_0x85d5('0x13'),_0x85d5('0x14')];var _0x12bef9={'count':0x0,'rows':[]},_0x17652b={},_0x17acb0;Promise[_0x85d5('0x15')]()[_0x85d5('0x16')](function(){if(_0x44f702[_0x85d5('0x17')][_0x85d5('0x18')]){if(!_[_0x85d5('0x19')](_0x586382,_0x44f702[_0x85d5('0x17')][_0x85d5('0x18')][_0x85d5('0x1a')]()))throw new Error('Invalid\x20channel');_0x17acb0=_0x44f702[_0x85d5('0x17')][_0x85d5('0x18')]['toLowerCase']();}var _0x231b57=_[_0x85d5('0x1b')](_0x17acb0)+'Queue';var _0x58290b=_[_0x85d5('0x1c')](db[_0x231b57]['rawAttributes'],function(_0x2f2bae){return{'name':_0x2f2bae['fieldName'],'type':_0x2f2bae[_0x85d5('0x1d')][_0x85d5('0x1e')]};});_0x17652b=qs['getOptions'](_0x58290b,_0x44f702);if(_0x44f702['user']['role']==='user'){var _0xf03669={'params':{'id':_0x44f702[_0x85d5('0x1f')][_0x85d5('0x20')]},'query':{'section':_0x17acb0===_0x85d5('0x14')&&_0x44f702[_0x85d5('0x17')][_0x85d5('0x1d')]==='outbound'?_0x85d5('0x21'):_['startCase'](_0x17acb0)+_0x85d5('0x22'),'type':_0x44f702[_0x85d5('0x17')][_0x85d5('0x1d')],'nolimit':!![],'sort':'name','filter':_0x44f702[_0x85d5('0x17')][_0x85d5('0x23')]}};return db[_0x85d5('0x24')][_0x85d5('0x25')](_0xf03669);}return db[_0x231b57][_0x85d5('0x26')](_0x17652b);})['then'](function(_0x1cbef1){_0x12bef9[_0x85d5('0x27')]=_0x1cbef1[_0x85d5('0x27')];var _0x22a961=_0x17acb0===_0x85d5('0x14')?client:routingClient;return _0x22a961['request'](_['startCase'](_0x17acb0)+_0x85d5('0x22'),_0x44f702)[_0x85d5('0x16')](function(_0x2d1157){if(_0x2d1157[_0x85d5('0x28')])throw new Error(util[_0x85d5('0x29')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x17acb0));var _0x3553c0=_0x2d1157[_0x85d5('0x2a')];var _0x5561dd=['loggedIn',_0x85d5('0x2b'),_0x85d5('0x2c'),'talking',_0x85d5('0x2d')];if(_0x17acb0==='voice'&&_0x44f702[_0x85d5('0x17')][_0x85d5('0x1d')]==='outbound'){_0x5561dd[_0x85d5('0x2e')](_0x85d5('0x2f'),_0x85d5('0x30'),_0x85d5('0x31'),'dialActive','dialMethod',_0x85d5('0x32'),_0x85d5('0x33'),_0x85d5('0x34'),_0x85d5('0x35'),_0x85d5('0x36'),_0x85d5('0x37'),_0x85d5('0x38'),_0x85d5('0x39'),_0x85d5('0x3a'),'dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable',_0x85d5('0x3b'),_0x85d5('0x3c'),_0x85d5('0x3d'),_0x85d5('0x3e'),_0x85d5('0x3f'),_0x85d5('0x40'));}var _0x118a02=_0x1cbef1[_0x85d5('0x41')]['map'](function(_0x358555){var _0x42e8b4=_0x358555[_0x85d5('0x42')]({'plain':!![]});_0x42e8b4[_0x85d5('0x2d')]=0x0;_0x42e8b4['loggedInDb']=0x0;_0x42e8b4[_0x85d5('0x43')]=0x0;_0x42e8b4[_0x85d5('0x2b')]=0x0;_0x42e8b4[_0x85d5('0x2d')]=0x0;_0x42e8b4[_0x85d5('0x2c')]=0x0;if(_0x17acb0==='voice'){_0x42e8b4[_0x85d5('0x44')]=0x0;if(_0x44f702['query']['type']===_0x85d5('0x45')){_0x42e8b4['pTalking']=0x0;_0x42e8b4[_0x85d5('0x30')]=0x0;}}_0x42e8b4['agents']=[];var _0x56f3de=_[_0x85d5('0x46')](_0x3553c0[_0x85d5('0x41')],['id',_0x42e8b4['id']]);if(_0x56f3de)_[_0x85d5('0x47')](_0x42e8b4,_[_0x85d5('0x48')](_0x56f3de,_0x5561dd));if(_0x17acb0===_0x85d5('0x14')){return _0x358555['getAgents']({'attributes':['id','name',_0x85d5('0x49')],'joinTableAttributes':[],'raw':!![]})[_0x85d5('0x16')](function(_0x285465){return _0x358555[_0x85d5('0x4a')]({'raw':!![]})[_0x85d5('0x16')](function(_0x139872){for(var _0x544783=0x0;_0x544783<_0x285465['length'];_0x544783++){var _0x55cf7b=_['find'](_0x139872,[_0x85d5('0x4b'),_0x285465[_0x544783]['id']]);var _0x18e94d={'id':_0x285465[_0x544783]['id'],'name':_0x285465[_0x544783][_0x85d5('0xb')],'online':Boolean(_0x285465[_0x544783][_0x85d5('0x49')]),'paused':_0x55cf7b?Boolean(_0x55cf7b[_0x85d5('0x2d')]):![]};if(_0x18e94d['online'])_0x42e8b4['loggedInDb']++;if(_0x18e94d[_0x85d5('0x2d')])_0x42e8b4[_0x85d5('0x2d')]++;_0x42e8b4[_0x85d5('0x4c')][_0x85d5('0x2e')](_0x18e94d);}return _0x42e8b4;});});}else{var _0x2fe3e0=_0x85d5('0x4d')+_[_0x85d5('0x1b')](_0x17acb0)+_0x85d5('0x4e');var _0x43f4c4=_0x17acb0+_0x85d5('0x4f');return db[_0x2fe3e0][_0x85d5('0x50')]({'where':{[_[_0x85d5('0x1b')](_0x17acb0)+_0x85d5('0x51')]:_0x358555['id']},'raw':!![]})[_0x85d5('0x16')](function(_0x344927){return db[_0x85d5('0x4d')][_0x85d5('0x50')]({'attributes':['id','name','online',_0x43f4c4],'where':{'id':_[_0x85d5('0x1c')](_0x344927,_0x85d5('0x4b')),'role':_0x85d5('0x52')},'raw':!![]});})[_0x85d5('0x16')](function(_0x2e78f8){for(var _0xe34edd=0x0;_0xe34edd<_0x2e78f8['length'];_0xe34edd++){var _0x1188f2={'id':_0x2e78f8[_0xe34edd]['id'],'name':_0x2e78f8[_0xe34edd]['name'],'online':Boolean(_0x2e78f8[_0xe34edd]['online']),'paused':Boolean(_0x2e78f8[_0xe34edd][_0x43f4c4])};if(_0x1188f2[_0x85d5('0x49')])_0x42e8b4[_0x85d5('0x53')]++;if(_0x1188f2[_0x85d5('0x2d')])_0x42e8b4[_0x85d5('0x2d')]++;_0x42e8b4[_0x85d5('0x4c')]['push'](_0x1188f2);}return _0x42e8b4;});}});return Promise[_0x85d5('0x54')](_0x118a02);});})['then'](function(_0x1f2ef9){_0x12bef9[_0x85d5('0x41')]=_0x1f2ef9;return _0x12bef9;})[_0x85d5('0x16')](respondWithFilteredResult(_0x1545b4,_0x17652b))['catch'](handleError(_0x1545b4,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index db30ab6..a306035 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0xa8a1c4,_0x74c26){var _0x25a4e6=function(_0x37f32b){while(--_0x37f32b){_0xa8a1c4['push'](_0xa8a1c4['shift']());}};_0x25a4e6(++_0x74c26);}(_0xe706,0xa3));var _0x6e70=function(_0x1d1b15,_0x5ef518){_0x1d1b15=_0x1d1b15-0x0;var _0x1801d3=_0xe706[_0x1d1b15];return _0x1801d3;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x37ab65,_0x2e824d){var _0x5a7ea8=function(_0x10c08c){while(--_0x10c08c){_0x37ab65['push'](_0x37ab65['shift']());}};_0x5a7ea8(++_0x2e824d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index f91748a..f133a9a 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 _0xcde7=['STRING','DATE','INTEGER'];(function(_0x446301,_0x15b238){var _0x268e22=function(_0x29a525){while(--_0x29a525){_0x446301['push'](_0x446301['shift']());}};_0x268e22(++_0x15b238);}(_0xcde7,0x65));var _0x7cde=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xcde7[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0x7cde('0x0')](0x2)},'statedesc':{'type':Sequelize[_0x7cde('0x1')]},'scheduledat':{'type':Sequelize[_0x7cde('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x7cde('0x2')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x7cde('0x1')]},'campaigntype':{'type':Sequelize[_0x7cde('0x1')]},'membername':{'type':Sequelize[_0x7cde('0x1')]}}; \ No newline at end of file +var _0x7217=['STRING','DATE','sequelize','INTEGER'];(function(_0x25537f,_0x3fc5bf){var _0x21b986=function(_0x3cf725){while(--_0x3cf725){_0x25537f['push'](_0x25537f['shift']());}};_0x21b986(++_0x3fc5bf);}(_0x7217,0x19e));var _0x7721=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0x7217[_0x45e98e];return _0x374dba;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'state':{'type':Sequelize[_0x7721('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x7721('0x2')]},'scheduledat':{'type':Sequelize[_0x7721('0x3')]},'uniqueid':{'type':Sequelize[_0x7721('0x2')]},'starttime':{'type':Sequelize[_0x7721('0x3')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x7721('0x2')]},'campaigntype':{'type':Sequelize[_0x7721('0x2')]},'membername':{'type':Sequelize[_0x7721('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 4b8e671..ebfba1d 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 _0x30d5=['ReportAgentPreview','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes'];(function(_0x7360f9,_0x31af2c){var _0x56f93e=function(_0x58265e){while(--_0x58265e){_0x7360f9['push'](_0x7360f9['shift']());}};_0x56f93e(++_0x31af2c);}(_0x30d5,0x19b));var _0x530d=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x30d5[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x530d('0x0'));var util=require(_0x530d('0x1'));var logger=require(_0x530d('0x2'))(_0x530d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x530d('0x4'));var fs=require('fs');var path=require(_0x530d('0x5'));var rimraf=require(_0x530d('0x6'));var config=require(_0x530d('0x7'));var attributes=require(_0x530d('0x8'));module['exports']=function(_0x3086ad,_0x172b4a){return _0x3086ad['define'](_0x530d('0x9'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x136c=['../../config/environment','./reportAgentPreview.attributes','define','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x3616bb,_0x86fe00){var _0x1c0994=function(_0x46a1d4){while(--_0x46a1d4){_0x3616bb['push'](_0x3616bb['shift']());}};_0x1c0994(++_0x86fe00);}(_0x136c,0x89));var _0xc136=function(_0xff765f,_0xdc88a9){_0xff765f=_0xff765f-0x0;var _0x36ceea=_0x136c[_0xff765f];return _0x36ceea;};'use strict';var _=require(_0xc136('0x0'));var util=require(_0xc136('0x1'));var logger=require(_0xc136('0x2'))('api');var moment=require(_0xc136('0x3'));var BPromise=require(_0xc136('0x4'));var rp=require(_0xc136('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc136('0x6'));var config=require(_0xc136('0x7'));var attributes=require(_0xc136('0x8'));module['exports']=function(_0xf8e26,_0x3f2920){return _0xf8e26[_0xc136('0x9')](_0xc136('0xa'),attributes,{'tableName':_0xc136('0xb'),'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 e005ca4..105f421 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 _0x740f=['request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','ReportAgentPreview,\x20%s,\x20%s'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x740f,0x187));var _0xf740=function(_0x42fd32,_0x12d3ae){_0x42fd32=_0x42fd32-0x0;var _0x328b6f=_0x740f[_0x42fd32];return _0x328b6f;};'use strict';var _=require(_0xf740('0x0'));var util=require(_0xf740('0x1'));var moment=require(_0xf740('0x2'));var BPromise=require(_0xf740('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf740('0x4'));var db=require(_0xf740('0x5'))['db'];var utils=require(_0xf740('0x6'));var logger=require(_0xf740('0x7'))('rpc');var config=require(_0xf740('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf740('0x9')][_0xf740('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d068a,_0x18ef5e,_0x538fc2){return new BPromise(function(_0x36d15f,_0x12e013){return client['request'](_0x2d068a,_0x538fc2)[_0xf740('0xb')](function(_0x39fc08){logger[_0xf740('0xc')](_0xf740('0xd'),_0x18ef5e,_0xf740('0xe'));logger[_0xf740('0xf')](_0xf740('0x10'),_0x18ef5e,_0xf740('0xe'),JSON[_0xf740('0x11')](_0x39fc08));if(_0x39fc08[_0xf740('0x12')]){if(_0x39fc08[_0xf740('0x12')][_0xf740('0x13')]===0x1f4){logger[_0xf740('0x12')](_0xf740('0xd'),_0x18ef5e,_0x39fc08[_0xf740('0x12')][_0xf740('0x14')]);return _0x12e013(_0x39fc08['error'][_0xf740('0x14')]);}logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x18ef5e,_0x39fc08[_0xf740('0x12')][_0xf740('0x14')]);return _0x36d15f(_0x39fc08[_0xf740('0x12')][_0xf740('0x14')]);}else{logger[_0xf740('0xc')](_0xf740('0xd'),_0x18ef5e,'request\x20sent');_0x36d15f(_0x39fc08['result'][_0xf740('0x14')]);}})[_0xf740('0x15')](function(_0x6d04c3){logger[_0xf740('0x12')](_0xf740('0xd'),_0x18ef5e,_0x6d04c3);_0x12e013(_0x6d04c3);});});}exports[_0xf740('0x16')]=function(_0x469d02){var _0x2d7eff=this;return new Promise(function(_0x3c3512,_0x42f283){return db[_0xf740('0x17')][_0xf740('0x18')](_0x469d02[_0xf740('0x19')],{'raw':_0x469d02['options']?_0x469d02['options'][_0xf740('0x1a')]===undefined?!![]:![]:!![]})[_0xf740('0xb')](function(_0x33c7b4){logger[_0xf740('0xc')](_0xf740('0x16'),_0x469d02);logger['debug']('CreateReportAgentPreview',_0x469d02,JSON[_0xf740('0x11')](_0x33c7b4));_0x3c3512(_0x33c7b4);})[_0xf740('0x15')](function(_0x503c6b){logger[_0xf740('0x12')]('CreateReportAgentPreview',_0x503c6b['message'],_0x469d02);_0x42f283(_0x2d7eff[_0xf740('0x12')](0x1f4,_0x503c6b[_0xf740('0x14')]));});});}; \ No newline at end of file +var _0x653e=['create','body','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','CreateReportAgentPreview','ReportAgentPreview'];(function(_0x4793e0,_0x34bfc2){var _0x356d01=function(_0x1d56c5){while(--_0x1d56c5){_0x4793e0['push'](_0x4793e0['shift']());}};_0x356d01(++_0x34bfc2);}(_0x653e,0x12c));var _0xe653=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0x653e[_0x5e3b04];return _0x1fc44d;};'use strict';var _=require(_0xe653('0x0'));var util=require('util');var moment=require(_0xe653('0x1'));var BPromise=require(_0xe653('0x2'));var rs=require(_0xe653('0x3'));var fs=require('fs');var Redis=require(_0xe653('0x4'));var db=require(_0xe653('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe653('0x6'))('rpc');var config=require(_0xe653('0x7'));var jayson=require(_0xe653('0x8'));var client=jayson[_0xe653('0x9')][_0xe653('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3eb505,_0x23eb7e,_0x4aa3bc){return new BPromise(function(_0x527a65,_0x210ddd){return client[_0xe653('0xb')](_0x3eb505,_0x4aa3bc)[_0xe653('0xc')](function(_0x897e92){logger[_0xe653('0xd')](_0xe653('0xe'),_0x23eb7e,'request\x20sent');logger[_0xe653('0xf')](_0xe653('0x10'),_0x23eb7e,_0xe653('0x11'),JSON[_0xe653('0x12')](_0x897e92));if(_0x897e92['error']){if(_0x897e92[_0xe653('0x13')]['code']===0x1f4){logger[_0xe653('0x13')]('ReportAgentPreview,\x20%s,\x20%s',_0x23eb7e,_0x897e92[_0xe653('0x13')]['message']);return _0x210ddd(_0x897e92[_0xe653('0x13')]['message']);}logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x23eb7e,_0x897e92[_0xe653('0x13')]['message']);return _0x527a65(_0x897e92['error']['message']);}else{logger[_0xe653('0xd')](_0xe653('0xe'),_0x23eb7e,_0xe653('0x11'));_0x527a65(_0x897e92['result'][_0xe653('0x14')]);}})[_0xe653('0x15')](function(_0xd54655){logger[_0xe653('0x13')]('ReportAgentPreview,\x20%s,\x20%s',_0x23eb7e,_0xd54655);_0x210ddd(_0xd54655);});});}exports[_0xe653('0x16')]=function(_0x19a072){var _0x43c709=this;return new Promise(function(_0x5295ec,_0x34ea76){return db[_0xe653('0x17')][_0xe653('0x18')](_0x19a072[_0xe653('0x19')],{'raw':_0x19a072['options']?_0x19a072['options'][_0xe653('0x1a')]===undefined?!![]:![]:!![]})[_0xe653('0xc')](function(_0x3b7413){logger[_0xe653('0xd')]('CreateReportAgentPreview',_0x19a072);logger[_0xe653('0xf')](_0xe653('0x16'),_0x19a072,JSON[_0xe653('0x12')](_0x3b7413));_0x5295ec(_0x3b7413);})['catch'](function(_0x27ede9){logger[_0xe653('0x13')](_0xe653('0x16'),_0x27ede9[_0xe653('0x14')],_0x19a072);_0x34ea76(_0x43c709[_0xe653('0x13')](0x1f4,_0x27ede9[_0xe653('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 3758ab7..4f62647 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 _0x7b8a=['/voice/channels','isAuthenticated','voiceChannels','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','put','/outbound','outbound','/outbound/channels','outboundChannels','/agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','mail','/mail/queues/:id','/chat/queues/:id/notify','queueNotify','chat','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get'];(function(_0xc63235,_0x54f701){var _0x33d8f7=function(_0x53f480){while(--_0x53f480){_0xc63235['push'](_0xc63235['shift']());}};_0x33d8f7(++_0x54f701);}(_0x7b8a,0x197));var _0xa7b8=function(_0x29a894,_0x5f2d6f){_0x29a894=_0x29a894-0x0;var _0x588f68=_0x7b8a[_0x29a894];return _0x588f68;};'use strict';var multer=require(_0xa7b8('0x0'));var util=require(_0xa7b8('0x1'));var path=require(_0xa7b8('0x2'));var express=require(_0xa7b8('0x3'));var router=express[_0xa7b8('0x4')]();var auth=require(_0xa7b8('0x5'));var controller=require(_0xa7b8('0x6'));router[_0xa7b8('0x7')](_0xa7b8('0x8'),auth[_0xa7b8('0x9')](),controller[_0xa7b8('0xa')]);router['get']('/voice/channels/:uniqueid/mixmonitor',auth['isAuthenticated'](),controller[_0xa7b8('0xb')]);router[_0xa7b8('0x7')](_0xa7b8('0xc'),auth[_0xa7b8('0x9')](),controller[_0xa7b8('0xd')]);router['get']('/voice/queues',auth[_0xa7b8('0x9')](),controller[_0xa7b8('0xe')]);router[_0xa7b8('0x7')](_0xa7b8('0xf'),auth[_0xa7b8('0x9')](),controller[_0xa7b8('0x10')]);router[_0xa7b8('0x7')](_0xa7b8('0x11'),auth['isAuthenticated'](),controller[_0xa7b8('0x12')]);router[_0xa7b8('0x7')](_0xa7b8('0x13'),auth[_0xa7b8('0x9')](),controller['mailAccounts']);router[_0xa7b8('0x7')](_0xa7b8('0x14'),auth[_0xa7b8('0x9')](),controller[_0xa7b8('0x15')]);router[_0xa7b8('0x7')](_0xa7b8('0x16'),auth[_0xa7b8('0x9')](),controller[_0xa7b8('0x17')]);router['get'](_0xa7b8('0x18'),auth[_0xa7b8('0x9')](),controller['whatsappQueues']);router['get'](_0xa7b8('0x19'),auth[_0xa7b8('0x9')](),controller[_0xa7b8('0x1a')]);router[_0xa7b8('0x7')](_0xa7b8('0x1b'),auth[_0xa7b8('0x9')](),controller['voiceQueuesPreview']);router['get']('/voice/queues/channels',auth[_0xa7b8('0x9')](),controller[_0xa7b8('0x1c')]);router[_0xa7b8('0x7')](_0xa7b8('0x1d'),auth[_0xa7b8('0x9')](),controller[_0xa7b8('0x1e')]);router[_0xa7b8('0x7')](_0xa7b8('0x1f'),auth['isAuthenticated'](),controller[_0xa7b8('0x20')]);router[_0xa7b8('0x7')](_0xa7b8('0x21'),auth[_0xa7b8('0x9')](),controller[_0xa7b8('0x22')]);router[_0xa7b8('0x7')](_0xa7b8('0x23'),auth[_0xa7b8('0x9')](),controller['showVoiceQueues']);router[_0xa7b8('0x24')](_0xa7b8('0x23'),auth[_0xa7b8('0x9')](),controller['updateVoiceQueue']);router[_0xa7b8('0x7')](_0xa7b8('0x25'),auth[_0xa7b8('0x9')](),controller[_0xa7b8('0x26')]);router['get'](_0xa7b8('0x27'),auth[_0xa7b8('0x9')](),controller[_0xa7b8('0x28')]);router['get'](_0xa7b8('0x29'),auth[_0xa7b8('0x9')](),controller['agents']);router[_0xa7b8('0x24')](_0xa7b8('0x2a'),auth[_0xa7b8('0x9')](),controller[_0xa7b8('0x2b')]);router['get'](_0xa7b8('0x2c'),auth[_0xa7b8('0x9')](),controller[_0xa7b8('0x2d')]);router[_0xa7b8('0x7')](_0xa7b8('0x2e'),auth[_0xa7b8('0x9')](),controller['trunks']);router[_0xa7b8('0x7')](_0xa7b8('0x2f'),auth[_0xa7b8('0x9')](),controller[_0xa7b8('0x30')]);router[_0xa7b8('0x7')](_0xa7b8('0x31'),auth['isAuthenticated'](),controller[_0xa7b8('0x32')]);router[_0xa7b8('0x7')]('/chat/queues/waitinginteractions',auth[_0xa7b8('0x9')](),controller[_0xa7b8('0x33')]);router[_0xa7b8('0x7')](_0xa7b8('0x34'),auth['isAuthenticated'](),controller['mailQueuesWaitingInteractions']);router[_0xa7b8('0x7')](_0xa7b8('0x35'),auth[_0xa7b8('0x9')](),controller['openchannelQueuesWaitingInteractions']);router['get']('/openchannel/queues/:id/waitinginteractions',auth[_0xa7b8('0x9')](),controller[_0xa7b8('0x36')]);router[_0xa7b8('0x7')](_0xa7b8('0x37'),auth[_0xa7b8('0x9')](),controller['smsQueuesWaitingInteractions']);router[_0xa7b8('0x7')]('/whatsapp/queues/waitinginteractions',auth[_0xa7b8('0x9')](),controller[_0xa7b8('0x38')]);router[_0xa7b8('0x7')](_0xa7b8('0x39'),auth[_0xa7b8('0x9')](),controller[_0xa7b8('0x3a')]);router[_0xa7b8('0x3b')](_0xa7b8('0x3c'),auth[_0xa7b8('0x9')](),controller['queueNotify'](_0xa7b8('0x3d')));router['get'](_0xa7b8('0x3e'),auth[_0xa7b8('0x9')](),controller['showMailQueues']);router[_0xa7b8('0x3b')](_0xa7b8('0x3f'),auth[_0xa7b8('0x9')](),controller[_0xa7b8('0x40')](_0xa7b8('0x41')));router['get']('/chat/queues/:id',auth[_0xa7b8('0x9')](),controller[_0xa7b8('0x42')]);router[_0xa7b8('0x3b')](_0xa7b8('0x43'),auth[_0xa7b8('0x9')](),controller[_0xa7b8('0x40')](_0xa7b8('0x44')));router[_0xa7b8('0x7')](_0xa7b8('0x45'),auth['isAuthenticated'](),controller[_0xa7b8('0x46')]);router['post'](_0xa7b8('0x47'),auth[_0xa7b8('0x9')](),controller['queueNotify'](_0xa7b8('0x48')));router[_0xa7b8('0x7')](_0xa7b8('0x49'),auth[_0xa7b8('0x9')](),controller[_0xa7b8('0x4a')]);router[_0xa7b8('0x3b')]('/sms/queues/:id/notify',auth[_0xa7b8('0x9')](),controller[_0xa7b8('0x40')]('sms'));router[_0xa7b8('0x3b')](_0xa7b8('0x4b'),auth[_0xa7b8('0x9')](),controller[_0xa7b8('0x40')]('whatsapp'));router[_0xa7b8('0x7')](_0xa7b8('0x4c'),auth[_0xa7b8('0x9')](),controller[_0xa7b8('0x4d')]);router[_0xa7b8('0x7')](_0xa7b8('0x4e'),auth[_0xa7b8('0x9')](),controller[_0xa7b8('0x4f')]);router['post'](_0xa7b8('0x50'),auth[_0xa7b8('0x9')](),controller[_0xa7b8('0x51')]);module[_0xa7b8('0x52')]=router; \ No newline at end of file +var _0x0ed8=['whatsappQueues','/voice/queues/preview/:id','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','showVoiceQueues','put','updateVoiceQueue','outbound','/outbound/channels','/agents','/agents/:id/capacity','/telephones','telephones','/trunks','trunks','/campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','showChatQueues','post','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','util','path','express','../../components/auth/service','./rpc.controller','/voice/channels','isAuthenticated','voiceChannels','get','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceQueues','/mail/queues','mailQueues','mailAccounts','openchannelQueues','smsQueues'];(function(_0x17f1a1,_0x24e172){var _0x1ac81b=function(_0x2f9282){while(--_0x2f9282){_0x17f1a1['push'](_0x17f1a1['shift']());}};_0x1ac81b(++_0x24e172);}(_0x0ed8,0x11a));var _0x80ed=function(_0x1e04bf,_0x2bd1cb){_0x1e04bf=_0x1e04bf-0x0;var _0xa9a386=_0x0ed8[_0x1e04bf];return _0xa9a386;};'use strict';var multer=require('multer');var util=require(_0x80ed('0x0'));var path=require(_0x80ed('0x1'));var express=require(_0x80ed('0x2'));var router=express['Router']();var auth=require(_0x80ed('0x3'));var controller=require(_0x80ed('0x4'));router['get'](_0x80ed('0x5'),auth[_0x80ed('0x6')](),controller[_0x80ed('0x7')]);router[_0x80ed('0x8')](_0x80ed('0x9'),auth[_0x80ed('0x6')](),controller[_0x80ed('0xa')]);router[_0x80ed('0x8')](_0x80ed('0xb'),auth['isAuthenticated'](),controller['voiceChannelStopMixMonitor']);router['get']('/voice/queues',auth[_0x80ed('0x6')](),controller[_0x80ed('0xc')]);router['get']('/chat/queues',auth[_0x80ed('0x6')](),controller['chatQueues']);router[_0x80ed('0x8')](_0x80ed('0xd'),auth[_0x80ed('0x6')](),controller[_0x80ed('0xe')]);router['get']('/mail/accounts',auth[_0x80ed('0x6')](),controller[_0x80ed('0xf')]);router[_0x80ed('0x8')]('/openchannel/queues',auth[_0x80ed('0x6')](),controller[_0x80ed('0x10')]);router[_0x80ed('0x8')]('/sms/queues',auth['isAuthenticated'](),controller[_0x80ed('0x11')]);router['get']('/whatsapp/queues',auth[_0x80ed('0x6')](),controller[_0x80ed('0x12')]);router['get']('/fax/queues',auth['isAuthenticated'](),controller['faxQueues']);router[_0x80ed('0x8')](_0x80ed('0x13'),auth[_0x80ed('0x6')](),controller['voiceQueuesPreview']);router[_0x80ed('0x8')]('/voice/queues/channels',auth[_0x80ed('0x6')](),controller[_0x80ed('0x14')]);router[_0x80ed('0x8')](_0x80ed('0x15'),auth[_0x80ed('0x6')](),controller[_0x80ed('0x16')]);router[_0x80ed('0x8')]('/voice/queues/channels/:uniqueid/hangup',auth['isAuthenticated'](),controller[_0x80ed('0x17')]);router['get'](_0x80ed('0x18'),auth[_0x80ed('0x6')](),controller['voiceQueuesChannelRedirect']);router[_0x80ed('0x8')]('/voice/queues/:id',auth[_0x80ed('0x6')](),controller[_0x80ed('0x19')]);router[_0x80ed('0x1a')]('/voice/queues/:id',auth[_0x80ed('0x6')](),controller[_0x80ed('0x1b')]);router['get']('/outbound',auth[_0x80ed('0x6')](),controller[_0x80ed('0x1c')]);router['get'](_0x80ed('0x1d'),auth[_0x80ed('0x6')](),controller['outboundChannels']);router[_0x80ed('0x8')](_0x80ed('0x1e'),auth[_0x80ed('0x6')](),controller['agents']);router[_0x80ed('0x1a')](_0x80ed('0x1f'),auth['isAuthenticated'](),controller['agentCapacity']);router[_0x80ed('0x8')](_0x80ed('0x20'),auth[_0x80ed('0x6')](),controller[_0x80ed('0x21')]);router[_0x80ed('0x8')](_0x80ed('0x22'),auth[_0x80ed('0x6')](),controller[_0x80ed('0x23')]);router[_0x80ed('0x8')](_0x80ed('0x24'),auth[_0x80ed('0x6')](),controller['campaigns']);router[_0x80ed('0x8')](_0x80ed('0x25'),auth[_0x80ed('0x6')](),controller[_0x80ed('0x26')]);router['get'](_0x80ed('0x27'),auth[_0x80ed('0x6')](),controller[_0x80ed('0x28')]);router['get'](_0x80ed('0x29'),auth['isAuthenticated'](),controller[_0x80ed('0x2a')]);router[_0x80ed('0x8')]('/openchannel/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x80ed('0x2b')]);router[_0x80ed('0x8')](_0x80ed('0x2c'),auth[_0x80ed('0x6')](),controller[_0x80ed('0x2d')]);router['get'](_0x80ed('0x2e'),auth[_0x80ed('0x6')](),controller[_0x80ed('0x2f')]);router[_0x80ed('0x8')](_0x80ed('0x30'),auth['isAuthenticated'](),controller[_0x80ed('0x31')]);router[_0x80ed('0x8')](_0x80ed('0x32'),auth[_0x80ed('0x6')](),controller[_0x80ed('0x33')]);router['post'](_0x80ed('0x34'),auth[_0x80ed('0x6')](),controller[_0x80ed('0x35')](_0x80ed('0x36')));router[_0x80ed('0x8')](_0x80ed('0x37'),auth[_0x80ed('0x6')](),controller[_0x80ed('0x38')]);router['post'](_0x80ed('0x39'),auth['isAuthenticated'](),controller[_0x80ed('0x35')](_0x80ed('0x3a')));router[_0x80ed('0x8')]('/chat/queues/:id',auth['isAuthenticated'](),controller[_0x80ed('0x3b')]);router[_0x80ed('0x3c')](_0x80ed('0x3d'),auth['isAuthenticated'](),controller[_0x80ed('0x35')](_0x80ed('0x3e')));router[_0x80ed('0x8')](_0x80ed('0x3f'),auth[_0x80ed('0x6')](),controller[_0x80ed('0x40')]);router[_0x80ed('0x3c')](_0x80ed('0x41'),auth[_0x80ed('0x6')](),controller[_0x80ed('0x35')](_0x80ed('0x42')));router['get']('/openchannel/queues/:id',auth[_0x80ed('0x6')](),controller[_0x80ed('0x43')]);router['post'](_0x80ed('0x44'),auth['isAuthenticated'](),controller['queueNotify']('sms'));router['post']('/whatsapp/queues/:id/notify',auth[_0x80ed('0x6')](),controller['queueNotify'](_0x80ed('0x45')));router['get'](_0x80ed('0x46'),auth[_0x80ed('0x6')](),controller[_0x80ed('0x47')]);router[_0x80ed('0x8')](_0x80ed('0x48'),auth['isAuthenticated'](),controller[_0x80ed('0x49')]);router[_0x80ed('0x3c')]('/agents/:id/notify',auth[_0x80ed('0x6')](),controller[_0x80ed('0x4a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index d43a9db..7c66ec6 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 _0xb458=['InteractionId','TransferReport','agentTransferTimeout','bluebird','moment','lodash','../../config/logger','api','jayson/promise','client','http','request','then','error','code','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','query','VoiceChannelStopMixMonitor','params','showVoiceQueues','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','Agents','agentCapacity','interaction','user','hasOwnProperty','findAll','INTERACTION','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','MemberReport','interface','SIP/%s','agent','internal','AgentCapacity','capacity','Telephones','trunks','Trunks','Campaigns','ChatQueues','showChatQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','WhatsappQueues','showFaxQueues','FaxQueues','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','value','indexOf','smsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','Message','Interaction','update','queue','MessageId','From','QueueId','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','User','findOne','Agent\x20not\x20found','messageId','\x20Message\x20not\x20found'];(function(_0x3a054b,_0x480582){var _0x25cbe3=function(_0x104580){while(--_0x104580){_0x3a054b['push'](_0x3a054b['shift']());}};_0x25cbe3(++_0x480582);}(_0xb458,0x103));var _0x8b45=function(_0x1bf839,_0x3c51a1){_0x1bf839=_0x1bf839-0x0;var _0x2ceb01=_0xb458[_0x1bf839];return _0x2ceb01;};'use strict';var BPromise=require(_0x8b45('0x0'));var moment=require(_0x8b45('0x1'));var _=require(_0x8b45('0x2'));var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x8b45('0x3'))(_0x8b45('0x4'));var jayson=require(_0x8b45('0x5'));var amiClient=jayson[_0x8b45('0x6')]['http']({'port':0x232a});var mailClient=jayson[_0x8b45('0x6')]['http']({'port':0x232b});var routingClient=jayson['client'][_0x8b45('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x12bd05,_0x2daa9a,_0x3a8ccb){return new BPromise(function(_0x32342f,_0x4d1718){var _0xa54725=_0x3a8ccb?_0x3a8ccb:amiClient;return _0xa54725[_0x8b45('0x8')](_0x12bd05,_0x2daa9a)[_0x8b45('0x9')](function(_0x2bc809){if(_0x2bc809[_0x8b45('0xa')]){if(_0x2bc809['error'][_0x8b45('0xb')]===0x1f4){return _0x4d1718(_0x2bc809[_0x8b45('0xa')]['message']);}return _0x32342f(_0x2bc809['error']['message']);}else{_0x32342f(_0x2bc809['result']);}})[_0x8b45('0xc')](function(_0x285728){_0x4d1718(_0x285728);});});}function respondWithResult(_0x37c220,_0x52c4db){_0x52c4db=_0x52c4db||0xc8;return function(_0x30d38c){if(_0x30d38c){return _0x37c220[_0x8b45('0xd')](_0x52c4db)[_0x8b45('0xe')](_0x30d38c);}return _0x37c220[_0x8b45('0xf')](0x194);};}function handleError(_0x32babc,_0x2ad2ae){_0x2ad2ae=_0x2ad2ae||0x1f4;return function(_0x5f0b20){logger['error'](_0x5f0b20[_0x8b45('0x10')]);if(_0x5f0b20[_0x8b45('0x11')]){delete _0x5f0b20[_0x8b45('0x11')];}_0x32babc[_0x8b45('0xd')](_0x2ad2ae)[_0x8b45('0x12')](_0x5f0b20);};}function findById(_0x27ebb3){return function(_0x902c50){if(!_[_0x8b45('0x13')](_0x27ebb3)&&!_[_0x8b45('0x13')](_0x902c50)&&!_[_0x8b45('0x13')](_0x902c50[_0x8b45('0x14')])){return _[_0x8b45('0x15')](_0x902c50[_0x8b45('0x14')],function(_0x43ffb7){return _0x43ffb7['id']==_0x27ebb3;});}return null;};}exports[_0x8b45('0x16')]=function(_0x31c6b4,_0x23c520){return respondWithRpcPromise(_0x8b45('0x17'),_0x31c6b4['query'])[_0x8b45('0x9')](respondWithResult(_0x23c520,null))[_0x8b45('0xc')](handleError(_0x23c520,null));};exports[_0x8b45('0x18')]=function(_0x46e21a,_0x3e1438){return respondWithRpcPromise(_0x8b45('0x19'),_[_0x8b45('0x1a')](_0x46e21a[_0x8b45('0x1b')],_0x46e21a['params']))['then'](respondWithResult(_0x3e1438,null))[_0x8b45('0xc')](handleError(_0x3e1438,null));};exports['voiceChannelStopMixMonitor']=function(_0x1952fc,_0x3ddb50){return respondWithRpcPromise(_0x8b45('0x1c'),_[_0x8b45('0x1a')](_0x1952fc[_0x8b45('0x1b')],_0x1952fc[_0x8b45('0x1d')]))[_0x8b45('0x9')](respondWithResult(_0x3ddb50,null))['catch'](handleError(_0x3ddb50,null));};exports['voiceQueues']=function(_0x11ffcc,_0x2c2c06){return respondWithRpcPromise('VoiceQueues',_0x11ffcc['query'])[_0x8b45('0x9')](respondWithResult(_0x2c2c06,null))[_0x8b45('0xc')](handleError(_0x2c2c06,null));};exports[_0x8b45('0x1e')]=function(_0x2f37bc,_0x4e84cc){return respondWithRpcPromise(_0x8b45('0x1f'),_0x2f37bc[_0x8b45('0x1b')])[_0x8b45('0x9')](findById(_0x2f37bc[_0x8b45('0x1d')]['id']))[_0x8b45('0x9')](respondWithResult(_0x4e84cc,null))[_0x8b45('0xc')](handleError(_0x4e84cc,null));};exports[_0x8b45('0x20')]=function(_0x234f62,_0x1733a7){return respondWithRpcPromise(_0x8b45('0x21'),_[_0x8b45('0x1a')](_0x234f62[_0x8b45('0x22')],_0x234f62[_0x8b45('0x1d')]))['then'](respondWithResult(_0x1733a7,null))[_0x8b45('0xc')](handleError(_0x1733a7,null));};exports[_0x8b45('0x23')]=function(_0x34eb03,_0x15107a){return respondWithRpcPromise(_0x8b45('0x24'),_[_0x8b45('0x1a')](_0x34eb03[_0x8b45('0x1b')],_0x34eb03[_0x8b45('0x1d')]))['then'](respondWithResult(_0x15107a,null))[_0x8b45('0xc')](handleError(_0x15107a,null));};exports[_0x8b45('0x25')]=function(_0x50302,_0xc2ae94){return respondWithRpcPromise(_0x8b45('0x26'),_0x50302['query'])[_0x8b45('0x9')](respondWithResult(_0xc2ae94,null))['catch'](handleError(_0xc2ae94,null));};exports['voiceQueuesChannel']=function(_0x1f8a11,_0x94e3b6){return respondWithRpcPromise(_0x8b45('0x27'),_[_0x8b45('0x1a')](_0x1f8a11[_0x8b45('0x1b')],_0x1f8a11[_0x8b45('0x1d')]))['then'](respondWithResult(_0x94e3b6,null))[_0x8b45('0xc')](handleError(_0x94e3b6,null));};exports[_0x8b45('0x28')]=function(_0x264be7,_0x1f66a3){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x8b45('0x1a')](_0x264be7[_0x8b45('0x1b')],_0x264be7[_0x8b45('0x1d')]))['then'](respondWithResult(_0x1f66a3,null))[_0x8b45('0xc')](handleError(_0x1f66a3,null));};exports[_0x8b45('0x29')]=function(_0x1571b7,_0x58f32e){return respondWithRpcPromise(_0x8b45('0x2a'),_[_0x8b45('0x1a')](_0x1571b7[_0x8b45('0x1b')],_0x1571b7[_0x8b45('0x1d')]))['then'](respondWithResult(_0x58f32e,null))[_0x8b45('0xc')](handleError(_0x58f32e,null));};exports[_0x8b45('0x2b')]=function(_0x2de02d,_0x15df7c){return respondWithRpcPromise(_0x8b45('0x2c'),_0x2de02d[_0x8b45('0x1b')])['then'](respondWithResult(_0x15df7c,null))['catch'](handleError(_0x15df7c,null));};exports[_0x8b45('0x2d')]=function(_0x179f3b,_0x41d6b5){return respondWithRpcPromise(_0x8b45('0x2e'),_0x179f3b[_0x8b45('0x1b')])['then'](respondWithResult(_0x41d6b5,null))[_0x8b45('0xc')](handleError(_0x41d6b5,null));};exports['agents']=function(_0x67c59a,_0x17e9a8){var _0x5fae26;return respondWithRpcPromise(_0x8b45('0x2f'),_0x67c59a[_0x8b45('0x1b')])[_0x8b45('0x9')](function(_0x14d665){_0x5fae26=_0x14d665;return respondWithRpcPromise(_0x8b45('0x2f'),_0x67c59a[_0x8b45('0x1b')],routingClient);})[_0x8b45('0x9')](function(_0x3a97d5){return _['merge']({},_0x3a97d5,_0x5fae26);})[_0x8b45('0x9')](respondWithResult(_0x17e9a8,null))['catch'](handleError(_0x17e9a8,null));};exports[_0x8b45('0x30')]=function(_0x4eda71,_0x412c53){if(_0x4eda71[_0x8b45('0x22')]&&_0x4eda71[_0x8b45('0x22')][_0x8b45('0x31')]&&_0x4eda71[_0x8b45('0x32')]&&_0x4eda71[_0x8b45('0x32')]['name']){for(var _0x6fbca4 in _0x4eda71['body']['interaction']){if(_0x4eda71[_0x8b45('0x22')][_0x8b45('0x31')][_0x8b45('0x33')](_0x6fbca4)){db['MemberReport'][_0x8b45('0x34')]({'where':{'channel':_0x6fbca4,'membername':_0x4eda71['user'][_0x8b45('0x11')],'type':_0x8b45('0x35'),'exitAt':null,'uniqueid':_0x4eda71[_0x8b45('0x22')][_0x8b45('0x31')][_0x6fbca4]&&_0x4eda71[_0x8b45('0x22')][_0x8b45('0x31')][_0x6fbca4]['length']?{'$notIn':_0x4eda71[_0x8b45('0x22')][_0x8b45('0x31')][_0x6fbca4]}:{'$ne':null}}})[_0x8b45('0x9')](function(_0xee45ac){var _0x1a13dd=moment()[_0x8b45('0x36')](_0x8b45('0x37'));for(var _0x3de3c2=0x0,_0x37b94a=_0xee45ac[_0x8b45('0x38')];_0x3de3c2<_0x37b94a;_0x3de3c2+=0x1){_0xee45ac[_0x3de3c2][_0x8b45('0x39')]({'exitAt':_0x1a13dd});}});for(var _0x3385db=0x0;_0x3385db<_0x4eda71[_0x8b45('0x22')][_0x8b45('0x31')][_0x6fbca4][_0x8b45('0x38')];_0x3385db+=0x1){db[_0x8b45('0x3a')]['findOrCreate']({'where':{'channel':_0x6fbca4,'membername':_0x4eda71['user']['name'],'type':_0x8b45('0x35'),'uniqueid':_0x4eda71[_0x8b45('0x22')][_0x8b45('0x31')][_0x6fbca4][_0x3385db],'exitAt':null},'defaults':{'channel':_0x6fbca4,'membername':_0x4eda71[_0x8b45('0x32')][_0x8b45('0x11')],'interface':_[_0x8b45('0x13')](_0x4eda71[_0x8b45('0x32')][_0x8b45('0x3b')])?util['format'](_0x8b45('0x3c'),_0x4eda71['user'][_0x8b45('0x11')]):_0x4eda71[_0x8b45('0x32')][_0x8b45('0x3b')],'type':_0x8b45('0x35'),'enterAt':moment()['format'](_0x8b45('0x37')),'role':_0x8b45('0x3d'),'internal':_0x4eda71['user'][_0x8b45('0x3e')],'uniqueid':_0x4eda71[_0x8b45('0x22')]['interaction'][_0x6fbca4][_0x3385db]}});}}}}return respondWithRpcPromise(_0x8b45('0x3f'),{'id':_0x4eda71[_0x8b45('0x1d')]['id'],'capacity':_0x4eda71[_0x8b45('0x22')][_0x8b45('0x40')]},routingClient)[_0x8b45('0x9')](respondWithResult(_0x412c53,null))[_0x8b45('0xc')](handleError(_0x412c53,null));};exports['telephones']=function(_0x4b8826,_0x3f7a16){return respondWithRpcPromise(_0x8b45('0x41'),_0x4b8826[_0x8b45('0x1b')])['then'](respondWithResult(_0x3f7a16,null))[_0x8b45('0xc')](handleError(_0x3f7a16,null));};exports[_0x8b45('0x42')]=function(_0x20a68b,_0x3e8a7d){return respondWithRpcPromise(_0x8b45('0x43'),_0x20a68b['query'])[_0x8b45('0x9')](respondWithResult(_0x3e8a7d,null))[_0x8b45('0xc')](handleError(_0x3e8a7d,null));};exports['campaigns']=function(_0x422da0,_0x4c3f38){return respondWithRpcPromise(_0x8b45('0x44'),_0x422da0[_0x8b45('0x1b')])[_0x8b45('0x9')](respondWithResult(_0x4c3f38,null))[_0x8b45('0xc')](handleError(_0x4c3f38,null));};exports['chatQueues']=function(_0xb9f390,_0x423231){return respondWithRpcPromise(_0x8b45('0x45'),_0xb9f390[_0x8b45('0x1b')],routingClient)[_0x8b45('0x9')](respondWithResult(_0x423231,null))[_0x8b45('0xc')](handleError(_0x423231,null));};exports[_0x8b45('0x46')]=function(_0x2a35c1,_0x446fe5){return respondWithRpcPromise(_0x8b45('0x45'),_0x2a35c1[_0x8b45('0x1b')],routingClient)[_0x8b45('0x9')](findById(_0x2a35c1[_0x8b45('0x1d')]['id']))[_0x8b45('0x9')](respondWithResult(_0x446fe5,null))[_0x8b45('0xc')](handleError(_0x446fe5,null));};exports['mailQueues']=function(_0x1744f8,_0x1477bd){return respondWithRpcPromise(_0x8b45('0x47'),_0x1744f8['query'],routingClient)[_0x8b45('0x9')](respondWithResult(_0x1477bd,null))[_0x8b45('0xc')](handleError(_0x1477bd,null));};exports[_0x8b45('0x48')]=function(_0x9eacc1,_0x5795ca){return respondWithRpcPromise(_0x8b45('0x47'),_0x9eacc1[_0x8b45('0x1b')],routingClient)[_0x8b45('0x9')](findById(_0x9eacc1[_0x8b45('0x1d')]['id']))['then'](respondWithResult(_0x5795ca,null))[_0x8b45('0xc')](handleError(_0x5795ca,null));};exports[_0x8b45('0x49')]=function(_0x417778,_0x27503f){return respondWithRpcPromise(_0x8b45('0x4a'),_0x417778['query'],mailClient)[_0x8b45('0x9')](respondWithResult(_0x27503f,null))['catch'](handleError(_0x27503f,null));};exports[_0x8b45('0x4b')]=function(_0x2f7ab0,_0x19152b){return respondWithRpcPromise(_0x8b45('0x4c'),_0x2f7ab0[_0x8b45('0x1b')],routingClient)[_0x8b45('0x9')](respondWithResult(_0x19152b,null))['catch'](handleError(_0x19152b,null));};exports['showOpenchannelQueues']=function(_0x5ace1,_0x2224b7){return respondWithRpcPromise('OpenchannelQueues',_0x5ace1[_0x8b45('0x1b')],routingClient)[_0x8b45('0x9')](findById(_0x5ace1[_0x8b45('0x1d')]['id']))['then'](respondWithResult(_0x2224b7,null))['catch'](handleError(_0x2224b7,null));};exports[_0x8b45('0x4d')]=function(_0x8e5a41,_0x5abc79){return respondWithRpcPromise(_0x8b45('0x4e'),_0x8e5a41['query'],routingClient)[_0x8b45('0x9')](respondWithResult(_0x5abc79,null))['catch'](handleError(_0x5abc79,null));};exports['showSmsQueues']=function(_0x28e57a,_0x7f5a4e){return respondWithRpcPromise('SmsQueues',_0x28e57a[_0x8b45('0x1b')],routingClient)[_0x8b45('0x9')](findById(_0x28e57a[_0x8b45('0x1d')]['id']))[_0x8b45('0x9')](respondWithResult(_0x7f5a4e,null))[_0x8b45('0xc')](handleError(_0x7f5a4e,null));};exports['whatsappQueues']=function(_0x37f580,_0x3b3d21){return respondWithRpcPromise(_0x8b45('0x4f'),_0x37f580['query'],routingClient)['then'](respondWithResult(_0x3b3d21,null))[_0x8b45('0xc')](handleError(_0x3b3d21,null));};exports['showWhatsappQueues']=function(_0x43f031,_0x5a4834){return respondWithRpcPromise('WhatsappQueues',_0x43f031['query'],routingClient)[_0x8b45('0x9')](findById(_0x43f031['params']['id']))[_0x8b45('0x9')](respondWithResult(_0x5a4834,null))[_0x8b45('0xc')](handleError(_0x5a4834,null));};exports['faxQueues']=function(_0x3db84e,_0x1b3890){return respondWithRpcPromise('FaxQueues',_0x3db84e[_0x8b45('0x1b')],routingClient)[_0x8b45('0x9')](respondWithResult(_0x1b3890,null))[_0x8b45('0xc')](handleError(_0x1b3890,null));};exports[_0x8b45('0x50')]=function(_0x15cf9d,_0x877766){return respondWithRpcPromise(_0x8b45('0x51'),_0x15cf9d[_0x8b45('0x1b')],routingClient)[_0x8b45('0x9')](findById(_0x15cf9d[_0x8b45('0x1d')]['id']))[_0x8b45('0x9')](respondWithResult(_0x877766,null))[_0x8b45('0xc')](handleError(_0x877766,null));};exports['faxAccounts']=function(_0x225180,_0x403ee2){return respondWithRpcPromise(_0x8b45('0x52'),_0x225180[_0x8b45('0x1b')])[_0x8b45('0x9')](respondWithResult(_0x403ee2,null))[_0x8b45('0xc')](handleError(_0x403ee2,null));};exports[_0x8b45('0x53')]=function(_0x3d3216,_0x243632){return respondWithRpcPromise(_0x8b45('0x54'),_0x3d3216[_0x8b45('0x1b')],routingClient)[_0x8b45('0x9')](respondWithResult(_0x243632,null))[_0x8b45('0xc')](handleError(_0x243632,null));};exports[_0x8b45('0x55')]=function(_0x562c5f,_0x53143d){return respondWithRpcPromise(_0x8b45('0x56'),_0x562c5f[_0x8b45('0x1b')],routingClient)[_0x8b45('0x9')](respondWithResult(_0x53143d,null))[_0x8b45('0xc')](handleError(_0x53143d,null));};exports[_0x8b45('0x57')]=function(_0xd88538,_0x1ebbca){return respondWithRpcPromise(_0x8b45('0x58'),_0xd88538['query'],routingClient)[_0x8b45('0x9')](respondWithResult(_0x1ebbca,null))[_0x8b45('0xc')](handleError(_0x1ebbca,null));};exports[_0x8b45('0x59')]=function(_0xa22bd0,_0xa44ba5){return respondWithRpcPromise(_0x8b45('0x58'),_0xa22bd0[_0x8b45('0x1b')],routingClient)[_0x8b45('0x9')](function(_0x2a6fee){if(_0xa22bd0[_0x8b45('0x1b')][_0x8b45('0x5a')]!==undefined){var _0x5e54c6=_(_0x2a6fee['rows'])[_0x8b45('0x5b')]([_0xa22bd0[_0x8b45('0x1b')][_0x8b45('0x5a')],_0xa22bd0[_0x8b45('0x1d')]['id']])[_0x8b45('0x5c')](_0x8b45('0x5d'))[_0x8b45('0x5e')]()[_0x8b45('0x5f')]();return _0x2a6fee[_0x8b45('0x14')]['filter'](function(_0x55acf0){return _0x5e54c6[_0x8b45('0x60')](_0x55acf0[_0x8b45('0x5d')])>-0x1;});}else{return _0x2a6fee[_0x8b45('0x14')][_0x8b45('0x5b')](function(_0x55bafb){return _0x55bafb[_0x8b45('0x5d')]===parseInt(_0xa22bd0[_0x8b45('0x1d')]['id']);});}})[_0x8b45('0x9')](respondWithResult(_0xa44ba5,null))[_0x8b45('0xc')](handleError(_0xa44ba5,null));};exports[_0x8b45('0x61')]=function(_0x17588b,_0x4ed113){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x17588b[_0x8b45('0x1b')],routingClient)['then'](respondWithResult(_0x4ed113,null))['catch'](handleError(_0x4ed113,null));};exports['whatsappQueuesWaitingInteractions']=function(_0xf602c7,_0x170b95){return respondWithRpcPromise(_0x8b45('0x62'),_0xf602c7[_0x8b45('0x1b')],routingClient)[_0x8b45('0x9')](respondWithResult(_0x170b95,null))[_0x8b45('0xc')](handleError(_0x170b95,null));};exports[_0x8b45('0x63')]=function(_0xc9be77,_0xc89fc6){return respondWithRpcPromise(_0x8b45('0x64'),_0xc9be77[_0x8b45('0x1b')],routingClient)[_0x8b45('0x9')](respondWithResult(_0xc89fc6,null))[_0x8b45('0xc')](handleError(_0xc89fc6,null));};exports[_0x8b45('0x65')]=function(_0x42b192){return function(_0x4a42e1,_0x29bfcc){var _0x91270d,_0x217798;var _0x19a135=_[_0x8b45('0x66')](_0x42b192);var _0x1446b1=_0x42b192===_0x8b45('0x67')?_0x8b45('0x68'):_0x8b45('0x69');return db[_0x19a135+_0x8b45('0x6a')]['findOne']({'raw':!![],'where':{'id':_0x4a42e1[_0x8b45('0x1d')]['id']}})[_0x8b45('0x9')](function(_0x408fff){if(_[_0x8b45('0x13')](_0x408fff)){throw new Error(_0x19a135+'\x20Queue\x20not\x20found');}_0x91270d=_0x408fff;return db[_0x19a135+_0x8b45('0x6b')]['findOne']({'where':{'id':_0x4a42e1[_0x8b45('0x22')]['messageId']},'include':[{'model':db[_0x19a135+_0x8b45('0x6c')],'as':_0x8b45('0x6c')},{'model':db[_0x19a135+_0x1446b1],'as':_0x8b45('0x69')}]});})[_0x8b45('0x9')](function(_0x16bb83){if(_[_0x8b45('0x13')](_0x16bb83)){throw new Error(_0x19a135+'\x20Message\x20not\x20found');}_0x217798=_0x16bb83;return _0x16bb83[_0x8b45('0x6d')]({'read':0x0,'readAt':null,'UserId':null});})[_0x8b45('0x9')](function(){var _0x17364d={'uniqueid':_0x42b192+'.'+_0x217798['id']+'.'+_0x217798[_0x8b45('0x6c')]['id'],'FromUserId':_0x4a42e1['user']['id'],'type':_0x8b45('0x6e')};_0x17364d[_0x19a135+_0x8b45('0x6f')]=_0x217798['id'];_0x17364d[_0x19a135+'InteractionId']=_0x217798['Interaction']['id'];_0x17364d[_0x8b45('0x70')+_0x19a135+_0x1446b1+'Id']=_0x217798[_0x8b45('0x69')]['id'];_0x17364d['To'+_0x19a135+_0x8b45('0x71')]=_0x91270d['id'];return db[_0x19a135+'TransferReport'][_0x8b45('0x72')](_0x17364d);})['then'](function(){return respondWithRpcPromise(_0x8b45('0x73'),{'channel':_0x42b192,'interaction':_0x217798[_0x8b45('0x6c')],'message':_0x217798,'account':_0x217798['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x91270d[_0x8b45('0x11')]+','+(_0x217798[_0x8b45('0x69')][_0x8b45('0x74')]||0x12c),'interval':_0x8b45('0x75')}]},routingClient);})['then'](respondWithResult(_0x29bfcc,null))[_0x8b45('0xc')](handleError(_0x29bfcc,null));};};exports[_0x8b45('0x76')]=function(_0x376416,_0x1d475c){var _0x2680d5,_0x1abe69;if(_['isNil'](_0x376416[_0x8b45('0x22')][_0x8b45('0x77')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x10a91a=_0x376416[_0x8b45('0x22')]['channel'];var _0x4837af=_['capitalize'](_0x10a91a);var _0x186aa2=_0x10a91a===_0x8b45('0x67')?_0x8b45('0x68'):_0x8b45('0x69');return db[_0x8b45('0x78')][_0x8b45('0x79')]({'raw':!![],'where':{'id':_0x376416[_0x8b45('0x1d')]['id'],'role':'agent'}})[_0x8b45('0x9')](function(_0x3d321f){if(_[_0x8b45('0x13')](_0x3d321f)){throw new Error(_0x8b45('0x7a'));}_0x2680d5=_0x3d321f;return db[_0x4837af+_0x8b45('0x6b')][_0x8b45('0x79')]({'where':{'id':_0x376416['body'][_0x8b45('0x7b')]},'include':[{'model':db[_0x4837af+_0x8b45('0x6c')],'as':_0x8b45('0x6c')},{'model':db[_0x4837af+_0x186aa2],'as':_0x8b45('0x69')}]});})[_0x8b45('0x9')](function(_0x4c3bc9){if(_['isNil'](_0x4c3bc9)){throw new Error(_0x4837af+_0x8b45('0x7c'));}_0x1abe69=_0x4c3bc9;return _0x4c3bc9[_0x8b45('0x6d')]({'read':0x0,'readAt':null,'UserId':null});})[_0x8b45('0x9')](function(){var _0x9993ce={'uniqueid':_0x10a91a+'.'+_0x1abe69['id']+'.'+_0x1abe69[_0x8b45('0x6c')]['id'],'FromUserId':_0x376416['user']['id'],'type':_0x8b45('0x6e'),'ToUserId':_0x2680d5['id']};_0x9993ce[_0x4837af+'MessageId']=_0x1abe69['id'];_0x9993ce[_0x4837af+_0x8b45('0x7d')]=_0x1abe69['Interaction']['id'];_0x9993ce[_0x8b45('0x70')+_0x4837af+_0x186aa2+'Id']=_0x1abe69[_0x8b45('0x69')]['id'];return db[_0x4837af+_0x8b45('0x7e')][_0x8b45('0x72')](_0x9993ce);})[_0x8b45('0x9')](function(){return respondWithRpcPromise(_0x8b45('0x73'),{'channel':_0x10a91a,'interaction':_0x1abe69[_0x8b45('0x6c')],'message':_0x1abe69,'account':_0x1abe69[_0x8b45('0x69')],'applications':[{'id':0x0,'priority':0x1,'app':_0x8b45('0x3d'),'appdata':_0x2680d5[_0x8b45('0x11')]+','+(_0x1abe69[_0x8b45('0x69')][_0x8b45('0x7f')]||0x12c),'interval':_0x8b45('0x75')}]},routingClient);})[_0x8b45('0x9')](respondWithResult(_0x1d475c,null))['catch'](handleError(_0x1d475c,null));}; \ No newline at end of file +var _0x24ca=['telephones','Telephones','trunks','chatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','uniq','value','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','Interaction','update','queue','MessageId','InteractionId','From','QueueId','Start','agentNotify','channel','Channel\x20field\x20is\x20mandatory','User','Agent\x20not\x20found','messageId','\x20Message\x20not\x20found','TransferReport','create','agentTransferTimeout','bluebird','lodash','util','../../mysqldb','api','jayson/promise','client','http','request','error','code','message','result','json','sendStatus','stack','status','send','isNil','rows','voiceChannels','VoiceChannels','query','then','VoiceChannelMixMonitor','merge','params','catch','VoiceQueues','showVoiceQueues','updateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','user','name','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','capacity'];(function(_0x29a23c,_0x5e8f91){var _0x2b123d=function(_0x1757cc){while(--_0x1757cc){_0x29a23c['push'](_0x29a23c['shift']());}};_0x2b123d(++_0x5e8f91);}(_0x24ca,0x1bc));var _0xa24c=function(_0x5cc51f,_0x22c480){_0x5cc51f=_0x5cc51f-0x0;var _0x315a2f=_0x24ca[_0x5cc51f];return _0x315a2f;};'use strict';var BPromise=require(_0xa24c('0x0'));var moment=require('moment');var _=require(_0xa24c('0x1'));var util=require(_0xa24c('0x2'));var db=require(_0xa24c('0x3'))['db'];var logger=require('../../config/logger')(_0xa24c('0x4'));var jayson=require(_0xa24c('0x5'));var amiClient=jayson[_0xa24c('0x6')][_0xa24c('0x7')]({'port':0x232a});var mailClient=jayson[_0xa24c('0x6')][_0xa24c('0x7')]({'port':0x232b});var routingClient=jayson[_0xa24c('0x6')][_0xa24c('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x2dd348,_0x257264,_0x9a5013){return new BPromise(function(_0x481196,_0x42d89c){var _0x3a5727=_0x9a5013?_0x9a5013:amiClient;return _0x3a5727[_0xa24c('0x8')](_0x2dd348,_0x257264)['then'](function(_0x399f32){if(_0x399f32[_0xa24c('0x9')]){if(_0x399f32[_0xa24c('0x9')][_0xa24c('0xa')]===0x1f4){return _0x42d89c(_0x399f32[_0xa24c('0x9')][_0xa24c('0xb')]);}return _0x481196(_0x399f32[_0xa24c('0x9')][_0xa24c('0xb')]);}else{_0x481196(_0x399f32[_0xa24c('0xc')]);}})['catch'](function(_0x43bcd3){_0x42d89c(_0x43bcd3);});});}function respondWithResult(_0x11090c,_0xcee4fe){_0xcee4fe=_0xcee4fe||0xc8;return function(_0x2c2af8){if(_0x2c2af8){return _0x11090c['status'](_0xcee4fe)[_0xa24c('0xd')](_0x2c2af8);}return _0x11090c[_0xa24c('0xe')](0x194);};}function handleError(_0x26ff28,_0x2fcd8b){_0x2fcd8b=_0x2fcd8b||0x1f4;return function(_0x1cb08e){logger[_0xa24c('0x9')](_0x1cb08e[_0xa24c('0xf')]);if(_0x1cb08e['name']){delete _0x1cb08e['name'];}_0x26ff28[_0xa24c('0x10')](_0x2fcd8b)[_0xa24c('0x11')](_0x1cb08e);};}function findById(_0x49ce53){return function(_0x5babb5){if(!_[_0xa24c('0x12')](_0x49ce53)&&!_[_0xa24c('0x12')](_0x5babb5)&&!_['isNil'](_0x5babb5[_0xa24c('0x13')])){return _['find'](_0x5babb5[_0xa24c('0x13')],function(_0x2a610a){return _0x2a610a['id']==_0x49ce53;});}return null;};}exports[_0xa24c('0x14')]=function(_0xefdbd9,_0x4ff97c){return respondWithRpcPromise(_0xa24c('0x15'),_0xefdbd9[_0xa24c('0x16')])[_0xa24c('0x17')](respondWithResult(_0x4ff97c,null))['catch'](handleError(_0x4ff97c,null));};exports['voiceChannelMixMonitor']=function(_0x506424,_0x4cd77e){return respondWithRpcPromise(_0xa24c('0x18'),_[_0xa24c('0x19')](_0x506424[_0xa24c('0x16')],_0x506424[_0xa24c('0x1a')]))['then'](respondWithResult(_0x4cd77e,null))[_0xa24c('0x1b')](handleError(_0x4cd77e,null));};exports['voiceChannelStopMixMonitor']=function(_0x224bca,_0xb81d97){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0xa24c('0x19')](_0x224bca[_0xa24c('0x16')],_0x224bca[_0xa24c('0x1a')]))[_0xa24c('0x17')](respondWithResult(_0xb81d97,null))[_0xa24c('0x1b')](handleError(_0xb81d97,null));};exports['voiceQueues']=function(_0xec9167,_0x5cc9cb){return respondWithRpcPromise(_0xa24c('0x1c'),_0xec9167[_0xa24c('0x16')])[_0xa24c('0x17')](respondWithResult(_0x5cc9cb,null))['catch'](handleError(_0x5cc9cb,null));};exports[_0xa24c('0x1d')]=function(_0x31c4d9,_0x14fd5a){return respondWithRpcPromise(_0xa24c('0x1c'),_0x31c4d9[_0xa24c('0x16')])[_0xa24c('0x17')](findById(_0x31c4d9[_0xa24c('0x1a')]['id']))['then'](respondWithResult(_0x14fd5a,null))[_0xa24c('0x1b')](handleError(_0x14fd5a,null));};exports[_0xa24c('0x1e')]=function(_0x152120,_0x12dbdc){return respondWithRpcPromise('UpdateVoiceQueue',_[_0xa24c('0x19')](_0x152120[_0xa24c('0x1f')],_0x152120[_0xa24c('0x1a')]))['then'](respondWithResult(_0x12dbdc,null))[_0xa24c('0x1b')](handleError(_0x12dbdc,null));};exports[_0xa24c('0x20')]=function(_0x253d83,_0x4ae35c){return respondWithRpcPromise(_0xa24c('0x21'),_['merge'](_0x253d83[_0xa24c('0x16')],_0x253d83[_0xa24c('0x1a')]))[_0xa24c('0x17')](respondWithResult(_0x4ae35c,null))['catch'](handleError(_0x4ae35c,null));};exports[_0xa24c('0x22')]=function(_0x53f90,_0x1d0379){return respondWithRpcPromise('VoiceQueuesChannels',_0x53f90[_0xa24c('0x16')])['then'](respondWithResult(_0x1d0379,null))[_0xa24c('0x1b')](handleError(_0x1d0379,null));};exports[_0xa24c('0x23')]=function(_0x592198,_0x5680f5){return respondWithRpcPromise(_0xa24c('0x24'),_[_0xa24c('0x19')](_0x592198[_0xa24c('0x16')],_0x592198[_0xa24c('0x1a')]))[_0xa24c('0x17')](respondWithResult(_0x5680f5,null))[_0xa24c('0x1b')](handleError(_0x5680f5,null));};exports[_0xa24c('0x25')]=function(_0x4b4dc2,_0x39f146){return respondWithRpcPromise(_0xa24c('0x26'),_[_0xa24c('0x19')](_0x4b4dc2[_0xa24c('0x16')],_0x4b4dc2[_0xa24c('0x1a')]))[_0xa24c('0x17')](respondWithResult(_0x39f146,null))[_0xa24c('0x1b')](handleError(_0x39f146,null));};exports[_0xa24c('0x27')]=function(_0x1ea166,_0x129bb9){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0xa24c('0x19')](_0x1ea166[_0xa24c('0x16')],_0x1ea166[_0xa24c('0x1a')]))[_0xa24c('0x17')](respondWithResult(_0x129bb9,null))['catch'](handleError(_0x129bb9,null));};exports['outbound']=function(_0x19a65f,_0x56ef4d){return respondWithRpcPromise(_0xa24c('0x28'),_0x19a65f[_0xa24c('0x16')])[_0xa24c('0x17')](respondWithResult(_0x56ef4d,null))[_0xa24c('0x1b')](handleError(_0x56ef4d,null));};exports[_0xa24c('0x29')]=function(_0x4c0fb9,_0x532875){return respondWithRpcPromise(_0xa24c('0x2a'),_0x4c0fb9[_0xa24c('0x16')])[_0xa24c('0x17')](respondWithResult(_0x532875,null))[_0xa24c('0x1b')](handleError(_0x532875,null));};exports[_0xa24c('0x2b')]=function(_0x472912,_0x5080d0){var _0x56f392;return respondWithRpcPromise(_0xa24c('0x2c'),_0x472912[_0xa24c('0x16')])[_0xa24c('0x17')](function(_0x2101f8){_0x56f392=_0x2101f8;return respondWithRpcPromise(_0xa24c('0x2c'),_0x472912['query'],routingClient);})[_0xa24c('0x17')](function(_0x7895e){return _['merge']({},_0x7895e,_0x56f392);})['then'](respondWithResult(_0x5080d0,null))[_0xa24c('0x1b')](handleError(_0x5080d0,null));};exports[_0xa24c('0x2d')]=function(_0x231eea,_0x537849){if(_0x231eea['body']&&_0x231eea[_0xa24c('0x1f')][_0xa24c('0x2e')]&&_0x231eea[_0xa24c('0x2f')]&&_0x231eea[_0xa24c('0x2f')][_0xa24c('0x30')]){for(var _0x1b7faf in _0x231eea[_0xa24c('0x1f')][_0xa24c('0x2e')]){if(_0x231eea['body']['interaction'][_0xa24c('0x31')](_0x1b7faf)){db[_0xa24c('0x32')][_0xa24c('0x33')]({'where':{'channel':_0x1b7faf,'membername':_0x231eea['user'][_0xa24c('0x30')],'type':_0xa24c('0x34'),'exitAt':null,'uniqueid':_0x231eea[_0xa24c('0x1f')][_0xa24c('0x2e')][_0x1b7faf]&&_0x231eea[_0xa24c('0x1f')][_0xa24c('0x2e')][_0x1b7faf][_0xa24c('0x35')]?{'$notIn':_0x231eea[_0xa24c('0x1f')][_0xa24c('0x2e')][_0x1b7faf]}:{'$ne':null}}})[_0xa24c('0x17')](function(_0x4bbf93){var _0xb8c7a5=moment()[_0xa24c('0x36')](_0xa24c('0x37'));for(var _0x5aa2b2=0x0,_0x3a85cb=_0x4bbf93[_0xa24c('0x35')];_0x5aa2b2<_0x3a85cb;_0x5aa2b2+=0x1){_0x4bbf93[_0x5aa2b2][_0xa24c('0x38')]({'exitAt':_0xb8c7a5});}});for(var _0x31f05b=0x0;_0x31f05b<_0x231eea[_0xa24c('0x1f')][_0xa24c('0x2e')][_0x1b7faf][_0xa24c('0x35')];_0x31f05b+=0x1){db[_0xa24c('0x32')][_0xa24c('0x39')]({'where':{'channel':_0x1b7faf,'membername':_0x231eea[_0xa24c('0x2f')][_0xa24c('0x30')],'type':'INTERACTION','uniqueid':_0x231eea[_0xa24c('0x1f')][_0xa24c('0x2e')][_0x1b7faf][_0x31f05b],'exitAt':null},'defaults':{'channel':_0x1b7faf,'membername':_0x231eea[_0xa24c('0x2f')][_0xa24c('0x30')],'interface':_[_0xa24c('0x12')](_0x231eea[_0xa24c('0x2f')][_0xa24c('0x3a')])?util[_0xa24c('0x36')](_0xa24c('0x3b'),_0x231eea['user']['name']):_0x231eea[_0xa24c('0x2f')]['interface'],'type':_0xa24c('0x34'),'enterAt':moment()[_0xa24c('0x36')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0xa24c('0x3c'),'internal':_0x231eea[_0xa24c('0x2f')][_0xa24c('0x3d')],'uniqueid':_0x231eea['body']['interaction'][_0x1b7faf][_0x31f05b]}});}}}}return respondWithRpcPromise(_0xa24c('0x3e'),{'id':_0x231eea['params']['id'],'capacity':_0x231eea[_0xa24c('0x1f')][_0xa24c('0x3f')]},routingClient)[_0xa24c('0x17')](respondWithResult(_0x537849,null))[_0xa24c('0x1b')](handleError(_0x537849,null));};exports[_0xa24c('0x40')]=function(_0x1fa739,_0x3f3ce6){return respondWithRpcPromise(_0xa24c('0x41'),_0x1fa739[_0xa24c('0x16')])[_0xa24c('0x17')](respondWithResult(_0x3f3ce6,null))['catch'](handleError(_0x3f3ce6,null));};exports[_0xa24c('0x42')]=function(_0x2759c1,_0x233f8e){return respondWithRpcPromise('Trunks',_0x2759c1['query'])['then'](respondWithResult(_0x233f8e,null))[_0xa24c('0x1b')](handleError(_0x233f8e,null));};exports['campaigns']=function(_0x4757ff,_0x21d0fc){return respondWithRpcPromise('Campaigns',_0x4757ff[_0xa24c('0x16')])[_0xa24c('0x17')](respondWithResult(_0x21d0fc,null))[_0xa24c('0x1b')](handleError(_0x21d0fc,null));};exports[_0xa24c('0x43')]=function(_0x162a11,_0x3a72e3){return respondWithRpcPromise(_0xa24c('0x44'),_0x162a11[_0xa24c('0x16')],routingClient)['then'](respondWithResult(_0x3a72e3,null))[_0xa24c('0x1b')](handleError(_0x3a72e3,null));};exports['showChatQueues']=function(_0x5abd45,_0x565f0a){return respondWithRpcPromise('ChatQueues',_0x5abd45['query'],routingClient)[_0xa24c('0x17')](findById(_0x5abd45['params']['id']))[_0xa24c('0x17')](respondWithResult(_0x565f0a,null))[_0xa24c('0x1b')](handleError(_0x565f0a,null));};exports[_0xa24c('0x45')]=function(_0x1a5f17,_0xa371d2){return respondWithRpcPromise(_0xa24c('0x46'),_0x1a5f17[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](respondWithResult(_0xa371d2,null))[_0xa24c('0x1b')](handleError(_0xa371d2,null));};exports[_0xa24c('0x47')]=function(_0x303b7d,_0x37dbbd){return respondWithRpcPromise(_0xa24c('0x46'),_0x303b7d[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](findById(_0x303b7d['params']['id']))[_0xa24c('0x17')](respondWithResult(_0x37dbbd,null))[_0xa24c('0x1b')](handleError(_0x37dbbd,null));};exports['mailAccounts']=function(_0x1e08bb,_0x179ae1){return respondWithRpcPromise(_0xa24c('0x48'),_0x1e08bb[_0xa24c('0x16')],mailClient)['then'](respondWithResult(_0x179ae1,null))['catch'](handleError(_0x179ae1,null));};exports[_0xa24c('0x49')]=function(_0x5e9631,_0x486040){return respondWithRpcPromise(_0xa24c('0x4a'),_0x5e9631[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](respondWithResult(_0x486040,null))[_0xa24c('0x1b')](handleError(_0x486040,null));};exports['showOpenchannelQueues']=function(_0x48a7b2,_0x29b836){return respondWithRpcPromise('OpenchannelQueues',_0x48a7b2['query'],routingClient)[_0xa24c('0x17')](findById(_0x48a7b2[_0xa24c('0x1a')]['id']))[_0xa24c('0x17')](respondWithResult(_0x29b836,null))['catch'](handleError(_0x29b836,null));};exports[_0xa24c('0x4b')]=function(_0x128e5b,_0x5c3285){return respondWithRpcPromise(_0xa24c('0x4c'),_0x128e5b[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](respondWithResult(_0x5c3285,null))['catch'](handleError(_0x5c3285,null));};exports[_0xa24c('0x4d')]=function(_0x34e261,_0x21439a){return respondWithRpcPromise(_0xa24c('0x4c'),_0x34e261[_0xa24c('0x16')],routingClient)['then'](findById(_0x34e261[_0xa24c('0x1a')]['id']))[_0xa24c('0x17')](respondWithResult(_0x21439a,null))[_0xa24c('0x1b')](handleError(_0x21439a,null));};exports[_0xa24c('0x4e')]=function(_0xab5260,_0x2ca3fa){return respondWithRpcPromise(_0xa24c('0x4f'),_0xab5260['query'],routingClient)[_0xa24c('0x17')](respondWithResult(_0x2ca3fa,null))[_0xa24c('0x1b')](handleError(_0x2ca3fa,null));};exports['showWhatsappQueues']=function(_0xb1048a,_0x3e455b){return respondWithRpcPromise(_0xa24c('0x4f'),_0xb1048a[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](findById(_0xb1048a[_0xa24c('0x1a')]['id']))[_0xa24c('0x17')](respondWithResult(_0x3e455b,null))[_0xa24c('0x1b')](handleError(_0x3e455b,null));};exports[_0xa24c('0x50')]=function(_0x32ddc3,_0x50141e){return respondWithRpcPromise(_0xa24c('0x51'),_0x32ddc3[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](respondWithResult(_0x50141e,null))['catch'](handleError(_0x50141e,null));};exports[_0xa24c('0x52')]=function(_0xfd57fb,_0x2cc592){return respondWithRpcPromise('FaxQueues',_0xfd57fb[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](findById(_0xfd57fb[_0xa24c('0x1a')]['id']))[_0xa24c('0x17')](respondWithResult(_0x2cc592,null))[_0xa24c('0x1b')](handleError(_0x2cc592,null));};exports[_0xa24c('0x53')]=function(_0x4f9b56,_0x4c374d){return respondWithRpcPromise(_0xa24c('0x54'),_0x4f9b56['query'])[_0xa24c('0x17')](respondWithResult(_0x4c374d,null))[_0xa24c('0x1b')](handleError(_0x4c374d,null));};exports[_0xa24c('0x55')]=function(_0x4073c5,_0x12d715){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x4073c5[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](respondWithResult(_0x12d715,null))[_0xa24c('0x1b')](handleError(_0x12d715,null));};exports[_0xa24c('0x56')]=function(_0x987aca,_0x389c08){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x987aca[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](respondWithResult(_0x389c08,null))[_0xa24c('0x1b')](handleError(_0x389c08,null));};exports[_0xa24c('0x57')]=function(_0x5ebdd1,_0x403bf1){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x5ebdd1[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](respondWithResult(_0x403bf1,null))[_0xa24c('0x1b')](handleError(_0x403bf1,null));};exports[_0xa24c('0x58')]=function(_0x5726e1,_0x2e612d){return respondWithRpcPromise(_0xa24c('0x59'),_0x5726e1['query'],routingClient)[_0xa24c('0x17')](function(_0x168a8b){if(_0x5726e1[_0xa24c('0x16')][_0xa24c('0x5a')]!==undefined){var _0x8bd3fb=_(_0x168a8b[_0xa24c('0x13')])[_0xa24c('0x5b')]([_0x5726e1[_0xa24c('0x16')]['type'],_0x5726e1[_0xa24c('0x1a')]['id']])[_0xa24c('0x5c')](_0xa24c('0x5d'))[_0xa24c('0x5e')]()[_0xa24c('0x5f')]();return _0x168a8b[_0xa24c('0x13')][_0xa24c('0x5b')](function(_0x13dbef){return _0x8bd3fb[_0xa24c('0x60')](_0x13dbef[_0xa24c('0x5d')])>-0x1;});}else{return _0x168a8b[_0xa24c('0x13')]['filter'](function(_0x283c5b){return _0x283c5b[_0xa24c('0x5d')]===parseInt(_0x5726e1['params']['id']);});}})[_0xa24c('0x17')](respondWithResult(_0x2e612d,null))[_0xa24c('0x1b')](handleError(_0x2e612d,null));};exports[_0xa24c('0x61')]=function(_0x4f0f11,_0x5b4468){return respondWithRpcPromise(_0xa24c('0x62'),_0x4f0f11[_0xa24c('0x16')],routingClient)['then'](respondWithResult(_0x5b4468,null))[_0xa24c('0x1b')](handleError(_0x5b4468,null));};exports[_0xa24c('0x63')]=function(_0x106178,_0x27a666){return respondWithRpcPromise(_0xa24c('0x64'),_0x106178[_0xa24c('0x16')],routingClient)['then'](respondWithResult(_0x27a666,null))['catch'](handleError(_0x27a666,null));};exports['faxQueuesWaitingInteractions']=function(_0x263dab,_0x521894){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x263dab[_0xa24c('0x16')],routingClient)[_0xa24c('0x17')](respondWithResult(_0x521894,null))[_0xa24c('0x1b')](handleError(_0x521894,null));};exports[_0xa24c('0x65')]=function(_0x84ddcc){return function(_0x45b2fe,_0x16f93a){var _0x170b65,_0x2544fc;var _0x4ee10d=_[_0xa24c('0x66')](_0x84ddcc);var _0xa077c8=_0x84ddcc===_0xa24c('0x67')?_0xa24c('0x68'):_0xa24c('0x69');return db[_0x4ee10d+_0xa24c('0x6a')][_0xa24c('0x6b')]({'raw':!![],'where':{'id':_0x45b2fe[_0xa24c('0x1a')]['id']}})[_0xa24c('0x17')](function(_0x3c5495){if(_[_0xa24c('0x12')](_0x3c5495)){throw new Error(_0x4ee10d+_0xa24c('0x6c'));}_0x170b65=_0x3c5495;return db[_0x4ee10d+'Message'][_0xa24c('0x6b')]({'where':{'id':_0x45b2fe[_0xa24c('0x1f')]['messageId']},'include':[{'model':db[_0x4ee10d+_0xa24c('0x6d')],'as':_0xa24c('0x6d')},{'model':db[_0x4ee10d+_0xa077c8],'as':_0xa24c('0x69')}]});})['then'](function(_0x549e07){if(_[_0xa24c('0x12')](_0x549e07)){throw new Error(_0x4ee10d+'\x20Message\x20not\x20found');}_0x2544fc=_0x549e07;return _0x549e07[_0xa24c('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0xa24c('0x17')](function(){var _0x4c108f={'uniqueid':_0x84ddcc+'.'+_0x2544fc['id']+'.'+_0x2544fc['Interaction']['id'],'FromUserId':_0x45b2fe[_0xa24c('0x2f')]['id'],'type':_0xa24c('0x6f')};_0x4c108f[_0x4ee10d+_0xa24c('0x70')]=_0x2544fc['id'];_0x4c108f[_0x4ee10d+_0xa24c('0x71')]=_0x2544fc['Interaction']['id'];_0x4c108f[_0xa24c('0x72')+_0x4ee10d+_0xa077c8+'Id']=_0x2544fc[_0xa24c('0x69')]['id'];_0x4c108f['To'+_0x4ee10d+_0xa24c('0x73')]=_0x170b65['id'];return db[_0x4ee10d+'TransferReport']['create'](_0x4c108f);})[_0xa24c('0x17')](function(){return respondWithRpcPromise(_0xa24c('0x74'),{'channel':_0x84ddcc,'interaction':_0x2544fc[_0xa24c('0x6d')],'message':_0x2544fc,'account':_0x2544fc['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x170b65[_0xa24c('0x30')]+','+(_0x2544fc['Account']['queueTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xa24c('0x17')](respondWithResult(_0x16f93a,null))[_0xa24c('0x1b')](handleError(_0x16f93a,null));};};exports[_0xa24c('0x75')]=function(_0xd23eb3,_0x890e15){var _0x12836d,_0x280fa2;if(_[_0xa24c('0x12')](_0xd23eb3[_0xa24c('0x1f')][_0xa24c('0x76')])){throw new Error(_0xa24c('0x77'));}var _0x24b28c=_0xd23eb3['body'][_0xa24c('0x76')];var _0x292c22=_['capitalize'](_0x24b28c);var _0x2fd4a2=_0x24b28c==='chat'?'Website':'Account';return db[_0xa24c('0x78')]['findOne']({'raw':!![],'where':{'id':_0xd23eb3[_0xa24c('0x1a')]['id'],'role':'agent'}})[_0xa24c('0x17')](function(_0x144c3b){if(_['isNil'](_0x144c3b)){throw new Error(_0xa24c('0x79'));}_0x12836d=_0x144c3b;return db[_0x292c22+'Message'][_0xa24c('0x6b')]({'where':{'id':_0xd23eb3[_0xa24c('0x1f')][_0xa24c('0x7a')]},'include':[{'model':db[_0x292c22+_0xa24c('0x6d')],'as':_0xa24c('0x6d')},{'model':db[_0x292c22+_0x2fd4a2],'as':'Account'}]});})[_0xa24c('0x17')](function(_0x5774d2){if(_[_0xa24c('0x12')](_0x5774d2)){throw new Error(_0x292c22+_0xa24c('0x7b'));}_0x280fa2=_0x5774d2;return _0x5774d2[_0xa24c('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0xa24c('0x17')](function(){var _0x4b848d={'uniqueid':_0x24b28c+'.'+_0x280fa2['id']+'.'+_0x280fa2[_0xa24c('0x6d')]['id'],'FromUserId':_0xd23eb3[_0xa24c('0x2f')]['id'],'type':_0xa24c('0x6f'),'ToUserId':_0x12836d['id']};_0x4b848d[_0x292c22+_0xa24c('0x70')]=_0x280fa2['id'];_0x4b848d[_0x292c22+'InteractionId']=_0x280fa2[_0xa24c('0x6d')]['id'];_0x4b848d[_0xa24c('0x72')+_0x292c22+_0x2fd4a2+'Id']=_0x280fa2[_0xa24c('0x69')]['id'];return db[_0x292c22+_0xa24c('0x7c')][_0xa24c('0x7d')](_0x4b848d);})[_0xa24c('0x17')](function(){return respondWithRpcPromise(_0xa24c('0x74'),{'channel':_0x24b28c,'interaction':_0x280fa2[_0xa24c('0x6d')],'message':_0x280fa2,'account':_0x280fa2[_0xa24c('0x69')],'applications':[{'id':0x0,'priority':0x1,'app':_0xa24c('0x3c'),'appdata':_0x12836d[_0xa24c('0x30')]+','+(_0x280fa2[_0xa24c('0x69')][_0xa24c('0x7e')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xa24c('0x17')](respondWithResult(_0x890e15,null))[_0xa24c('0x1b')](handleError(_0x890e15,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 08c64d2..cd39625 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 _0x49e2=['put','/:id','update','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','show','/:id/run','run','post','create'];(function(_0x37de18,_0x27ac7f){var _0x3615da=function(_0x263266){while(--_0x263266){_0x37de18['push'](_0x37de18['shift']());}};_0x3615da(++_0x27ac7f);}(_0x49e2,0x1a8));var _0x249e=function(_0x18f9e3,_0x2f5185){_0x18f9e3=_0x18f9e3-0x0;var _0x1e5338=_0x49e2[_0x18f9e3];return _0x1e5338;};'use strict';var multer=require('multer');var util=require(_0x249e('0x0'));var path=require('path');var timeout=require(_0x249e('0x1'));var express=require('express');var router=express[_0x249e('0x2')]();var fs_extra=require(_0x249e('0x3'));var auth=require(_0x249e('0x4'));var interaction=require(_0x249e('0x5'));var config=require(_0x249e('0x6'));var controller=require(_0x249e('0x7'));router[_0x249e('0x8')]('/',auth[_0x249e('0x9')](),controller[_0x249e('0xa')]);router[_0x249e('0x8')]('/:id',auth[_0x249e('0x9')](),controller[_0x249e('0xb')]);router['get'](_0x249e('0xc'),auth[_0x249e('0x9')](),controller[_0x249e('0xd')]);router[_0x249e('0xe')]('/',auth[_0x249e('0x9')](),controller[_0x249e('0xf')]);router[_0x249e('0x10')](_0x249e('0x11'),auth[_0x249e('0x9')](),controller[_0x249e('0x12')]);router[_0x249e('0x13')]('/:id',auth[_0x249e('0x9')](),controller[_0x249e('0x14')]);module[_0x249e('0x15')]=router; \ No newline at end of file +var _0x7d74=['put','update','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./schedule.controller','get','isAuthenticated','/:id','run','create'];(function(_0x295834,_0x1aea92){var _0x5de648=function(_0x1a25be){while(--_0x1a25be){_0x295834['push'](_0x295834['shift']());}};_0x5de648(++_0x1aea92);}(_0x7d74,0xb2));var _0x47d7=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x7d74[_0x178e48];return _0x440d7e;};'use strict';var multer=require('multer');var util=require(_0x47d7('0x0'));var path=require(_0x47d7('0x1'));var timeout=require(_0x47d7('0x2'));var express=require(_0x47d7('0x3'));var router=express[_0x47d7('0x4')]();var fs_extra=require(_0x47d7('0x5'));var auth=require(_0x47d7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x47d7('0x7'));var controller=require(_0x47d7('0x8'));router[_0x47d7('0x9')]('/',auth[_0x47d7('0xa')](),controller['index']);router[_0x47d7('0x9')](_0x47d7('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x47d7('0x9')]('/:id/run',auth[_0x47d7('0xa')](),controller[_0x47d7('0xc')]);router['post']('/',auth[_0x47d7('0xa')](),controller[_0x47d7('0xd')]);router[_0x47d7('0xe')]('/:id',auth[_0x47d7('0xa')](),controller[_0x47d7('0xf')]);router['delete'](_0x47d7('0xb'),auth[_0x47d7('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index af3e52a..8942d05 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 _0xd360=['hours','pdf','xlsx','csv','custom','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','quarters','months','days'];(function(_0x376b80,_0x8f67fd){var _0x33306b=function(_0x2a3135){while(--_0x2a3135){_0x376b80['push'](_0x376b80['shift']());}};_0x33306b(++_0x8f67fd);}(_0xd360,0x1b8));var _0x0d36=function(_0x5a66d8,_0x1492f4){_0x5a66d8=_0x5a66d8-0x0;var _0x2e2b64=_0xd360[_0x5a66d8];return _0x2e2b64;};'use strict';var Sequelize=require(_0x0d36('0x0'));module[_0x0d36('0x1')]={'name':{'type':Sequelize[_0x0d36('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x0d36('0x2')]},'active':{'type':Sequelize[_0x0d36('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x0d36('0x2')],'allowNull':![],'defaultValue':_0x0d36('0x4')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM']('years',_0x0d36('0x5'),_0x0d36('0x6'),'weeks',_0x0d36('0x7'),_0x0d36('0x8'),'minutes'),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize['ENUM']('csv',_0x0d36('0x9'),_0x0d36('0xa')),'allowNull':![],'defaultValue':_0x0d36('0xb')},'type':{'type':Sequelize['ENUM'](_0x0d36('0xc'),'default'),'allowNull':![],'defaultValue':_0x0d36('0xc')},'sendMail':{'type':Sequelize[_0x0d36('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x0d36('0x2')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0x0d36('0xd')]},'sendIfEmpty':{'type':Sequelize[_0x0d36('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x71c3=['minutes','csv','pdf','xlsx','custom','default','BOOLEAN','TEXT','sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','days','hours'];(function(_0x48720f,_0x18cc2c){var _0x3af3fe=function(_0x4ee07f){while(--_0x4ee07f){_0x48720f['push'](_0x48720f['shift']());}};_0x3af3fe(++_0x18cc2c);}(_0x71c3,0x170));var _0x371c=function(_0x54bfcd,_0x562eab){_0x54bfcd=_0x54bfcd-0x0;var _0x2d0d9f=_0x71c3[_0x54bfcd];return _0x2d0d9f;};'use strict';var Sequelize=require(_0x371c('0x0'));module[_0x371c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x371c('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x371c('0x2')],'allowNull':![],'defaultValue':_0x371c('0x3')},'startAt':{'type':Sequelize[_0x371c('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x371c('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x371c('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x371c('0x6')](_0x371c('0x7'),_0x371c('0x8'),_0x371c('0x9'),'weeks',_0x371c('0xa'),_0x371c('0xb'),_0x371c('0xc')),'allowNull':![],'defaultValue':_0x371c('0xa')},'output':{'type':Sequelize[_0x371c('0x6')](_0x371c('0xd'),_0x371c('0xe'),_0x371c('0xf')),'allowNull':![],'defaultValue':_0x371c('0xd')},'type':{'type':Sequelize[_0x371c('0x6')](_0x371c('0x10'),_0x371c('0x11')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x371c('0x12')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x371c('0x13')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x371c('0x12')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 9e8c707..4d4e3cc 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 _0x8a5c=['intersection','attributes','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','include','catch','show','params','fields','length','options','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','destroy','run','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','count','limit','Content-Range','json','apply','reject','save','update','then','get','Scheduler','error','name','send','map','Schedule','rawAttributes','type','key','model','query','keys'];(function(_0x4faae1,_0x54114a){var _0x1d6ccd=function(_0x42f40c){while(--_0x42f40c){_0x4faae1['push'](_0x4faae1['shift']());}};_0x1d6ccd(++_0x54114a);}(_0x8a5c,0x68));var _0xc8a5=function(_0x4d0bd2,_0x3671e0){_0x4d0bd2=_0x4d0bd2-0x0;var _0x3201a6=_0x8a5c[_0x4d0bd2];return _0x3201a6;};'use strict';var emlformat=require(_0xc8a5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc8a5('0x1'));var jsonpatch=require(_0xc8a5('0x2'));var rp=require(_0xc8a5('0x3'));var moment=require(_0xc8a5('0x4'));var BPromise=require(_0xc8a5('0x5'));var Mustache=require(_0xc8a5('0x6'));var util=require('util');var path=require('path');var sox=require(_0xc8a5('0x7'));var csv=require(_0xc8a5('0x8'));var ejs=require(_0xc8a5('0x9'));var fs=require('fs');var fs_extra=require(_0xc8a5('0xa'));var _=require(_0xc8a5('0xb'));var squel=require(_0xc8a5('0xc'));var crypto=require(_0xc8a5('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc8a5('0x8'));var querystring=require(_0xc8a5('0xe'));var Papa=require(_0xc8a5('0xf'));var Redis=require('ioredis');var authService=require(_0xc8a5('0x10'));var qs=require(_0xc8a5('0x11'));var as=require(_0xc8a5('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc8a5('0x13'))(_0xc8a5('0x14'));var utils=require(_0xc8a5('0x15'));var config=require(_0xc8a5('0x16'));var licenseUtil=require(_0xc8a5('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x49f4d5,_0x39fcdf){_0x39fcdf=_0x39fcdf||0xcc;return function(_0x2d807d){if(_0x2d807d){return _0x49f4d5[_0xc8a5('0x18')](_0x39fcdf);}return _0x49f4d5[_0xc8a5('0x19')](_0x39fcdf)[_0xc8a5('0x1a')]();};}function respondWithResult(_0xf3ed51,_0x242544){_0x242544=_0x242544||0xc8;return function(_0x11b1ac){if(_0x11b1ac){return _0xf3ed51[_0xc8a5('0x19')](_0x242544)['json'](_0x11b1ac);}};}function respondWithFilteredResult(_0x2fb0b2,_0x5a756d){return function(_0x4e99da){if(_0x4e99da){var _0x29331b=typeof _0x5a756d[_0xc8a5('0x1b')]==='undefined'&&typeof _0x5a756d['limit']==='undefined';var _0x300135=_0x4e99da[_0xc8a5('0x1c')];var _0x534d02=_0x29331b?0x0:_0x5a756d[_0xc8a5('0x1b')];var _0x5e7a84=_0x29331b?_0x4e99da[_0xc8a5('0x1c')]:_0x5a756d[_0xc8a5('0x1b')]+_0x5a756d[_0xc8a5('0x1d')];var _0x2661db;if(_0x5e7a84>=_0x300135){_0x5e7a84=_0x300135;_0x2661db=0xc8;}else{_0x2661db=0xce;}_0x2fb0b2[_0xc8a5('0x19')](_0x2661db);return _0x2fb0b2['set'](_0xc8a5('0x1e'),_0x534d02+'-'+_0x5e7a84+'/'+_0x300135)[_0xc8a5('0x1f')](_0x4e99da);}return null;};}function patchUpdates(_0x44782e){return function(_0x28bcc3){try{jsonpatch[_0xc8a5('0x20')](_0x28bcc3,_0x44782e,!![]);}catch(_0x55be92){return BPromise[_0xc8a5('0x21')](_0x55be92);}return _0x28bcc3[_0xc8a5('0x22')]();};}function saveUpdates(_0x2ddeea,_0x4d51b2){return function(_0x318ba5){if(_0x318ba5){return _0x318ba5[_0xc8a5('0x23')](_0x2ddeea)[_0xc8a5('0x24')](function(_0x1b4907){return _0x1b4907;});}return null;};}function removeEntity(_0x1f1cc2,_0x3f4175){return function(_0x6fde3f){if(_0x6fde3f){return _0x6fde3f['destroy']()['then'](function(){var _0x2c2153=_0x6fde3f[_0xc8a5('0x25')]({'plain':!![]});var _0x456518=_0xc8a5('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x456518,'resourceId':_0x2c2153['id']}})[_0xc8a5('0x24')](function(){return _0x6fde3f;});})[_0xc8a5('0x24')](function(){_0x1f1cc2[_0xc8a5('0x19')](0xcc)[_0xc8a5('0x1a')]();});}};}function handleEntityNotFound(_0x5df1a5,_0x26692f){return function(_0x18d234){if(!_0x18d234){_0x5df1a5[_0xc8a5('0x18')](0x194);}return _0x18d234;};}function handleError(_0x6417b8,_0x3bed13){_0x3bed13=_0x3bed13||0x1f4;return function(_0x1d6d96){logger[_0xc8a5('0x27')](_0x1d6d96['stack']);if(_0x1d6d96[_0xc8a5('0x28')]){delete _0x1d6d96[_0xc8a5('0x28')];}_0x6417b8[_0xc8a5('0x19')](_0x3bed13)[_0xc8a5('0x29')](_0x1d6d96);};}exports['index']=function(_0x575946,_0x1f0958){var _0x100824={},_0x47ca90={},_0x8c242a={'count':0x0,'rows':[]};var _0x139c22=_[_0xc8a5('0x2a')](db[_0xc8a5('0x2b')][_0xc8a5('0x2c')],function(_0xd29b8c){return{'name':_0xd29b8c['fieldName'],'type':_0xd29b8c[_0xc8a5('0x2d')][_0xc8a5('0x2e')]};});_0x47ca90[_0xc8a5('0x2f')]=_[_0xc8a5('0x2a')](_0x139c22,'name');_0x47ca90[_0xc8a5('0x30')]=_[_0xc8a5('0x31')](_0x575946[_0xc8a5('0x30')]);_0x47ca90['filters']=_[_0xc8a5('0x32')](_0x47ca90[_0xc8a5('0x2f')],_0x47ca90[_0xc8a5('0x30')]);_0x100824['attributes']=_[_0xc8a5('0x32')](_0x47ca90['model'],qs['fields'](_0x575946[_0xc8a5('0x30')]['fields']));_0x100824[_0xc8a5('0x33')]=_0x100824[_0xc8a5('0x33')]['length']?_0x100824[_0xc8a5('0x33')]:_0x47ca90[_0xc8a5('0x2f')];if(!_0x575946[_0xc8a5('0x30')]['hasOwnProperty'](_0xc8a5('0x34'))){_0x100824['limit']=qs[_0xc8a5('0x1d')](_0x575946[_0xc8a5('0x30')][_0xc8a5('0x1d')]);_0x100824[_0xc8a5('0x1b')]=qs['offset'](_0x575946['query'][_0xc8a5('0x1b')]);}_0x100824[_0xc8a5('0x35')]=qs[_0xc8a5('0x36')](_0x575946[_0xc8a5('0x30')]['sort']);_0x100824[_0xc8a5('0x37')]=qs['filters'](_[_0xc8a5('0x38')](_0x575946[_0xc8a5('0x30')],_0x47ca90[_0xc8a5('0x39')]),_0x139c22);if(_0x575946[_0xc8a5('0x30')][_0xc8a5('0x3a')]){_0x100824['where']=_[_0xc8a5('0x3b')](_0x100824[_0xc8a5('0x37')],{'$or':_[_0xc8a5('0x2a')](_0x139c22,function(_0x1ea034){if(_0x1ea034[_0xc8a5('0x2d')]!==_0xc8a5('0x3c')){var _0x26f90d={};_0x26f90d[_0x1ea034[_0xc8a5('0x28')]]={'$like':'%'+_0x575946[_0xc8a5('0x30')][_0xc8a5('0x3a')]+'%'};return _0x26f90d;}})});}_0x100824=_['merge']({},_0x100824,_0x575946['options']);var _0x3b4965={'where':_0x100824[_0xc8a5('0x37')]};return db[_0xc8a5('0x2b')][_0xc8a5('0x1c')](_0x3b4965)[_0xc8a5('0x24')](function(_0x505562){_0x8c242a[_0xc8a5('0x1c')]=_0x505562;if(_0x575946[_0xc8a5('0x30')]['includeAll']){_0x100824[_0xc8a5('0x3d')]=[{'all':!![]}];}return db[_0xc8a5('0x2b')]['findAll'](_0x100824);})[_0xc8a5('0x24')](function(_0x3fcc3f){_0x8c242a['rows']=_0x3fcc3f;return _0x8c242a;})[_0xc8a5('0x24')](respondWithFilteredResult(_0x1f0958,_0x100824))[_0xc8a5('0x3e')](handleError(_0x1f0958,null));};exports[_0xc8a5('0x3f')]=function(_0x301c06,_0x34a7e0){var _0x50f6f2={'raw':![],'where':{'id':_0x301c06[_0xc8a5('0x40')]['id']}},_0x1e73d1={};_0x1e73d1[_0xc8a5('0x2f')]=_[_0xc8a5('0x31')](db['Schedule'][_0xc8a5('0x2c')]);_0x1e73d1[_0xc8a5('0x30')]=_[_0xc8a5('0x31')](_0x301c06['query']);_0x1e73d1[_0xc8a5('0x39')]=_[_0xc8a5('0x32')](_0x1e73d1[_0xc8a5('0x2f')],_0x1e73d1[_0xc8a5('0x30')]);_0x50f6f2[_0xc8a5('0x33')]=_[_0xc8a5('0x32')](_0x1e73d1['model'],qs[_0xc8a5('0x41')](_0x301c06['query'][_0xc8a5('0x41')]));_0x50f6f2[_0xc8a5('0x33')]=_0x50f6f2[_0xc8a5('0x33')][_0xc8a5('0x42')]?_0x50f6f2[_0xc8a5('0x33')]:_0x1e73d1['model'];if(_0x301c06[_0xc8a5('0x30')]['includeAll']){_0x50f6f2['include']=[{'all':!![]}];}_0x50f6f2=_[_0xc8a5('0x3b')]({},_0x50f6f2,_0x301c06[_0xc8a5('0x43')]);return db['Schedule']['find'](_0x50f6f2)[_0xc8a5('0x24')](handleEntityNotFound(_0x34a7e0,null))['then'](respondWithResult(_0x34a7e0,null))['catch'](handleError(_0x34a7e0,null));};exports['create']=function(_0x2fad2e,_0x3eea2c){return db[_0xc8a5('0x2b')]['create'](_0x2fad2e['body'],{})[_0xc8a5('0x24')](function(_0x2781f3){var _0xa337d=_0x2fad2e[_0xc8a5('0x44')][_0xc8a5('0x25')]({'plain':!![]});if(!_0xa337d)throw new Error(_0xc8a5('0x45'));if(_0xa337d['role']===_0xc8a5('0x44')){var _0x287fd5=_0x2781f3['get']({'plain':!![]});var _0x227f6b=_0xc8a5('0x26');return db[_0xc8a5('0x46')]['find']({'where':{'name':_0x227f6b,'userProfileId':_0xa337d['userProfileId']},'raw':!![]})[_0xc8a5('0x24')](function(_0x461b73){if(_0x461b73&&_0x461b73[_0xc8a5('0x47')]===0x0){return db['UserProfileResource']['create']({'name':_0x287fd5[_0xc8a5('0x28')],'resourceId':_0x287fd5['id'],'type':_0x461b73[_0xc8a5('0x28')],'sectionId':_0x461b73['id']},{})[_0xc8a5('0x24')](function(){return _0x2781f3;});}else{return _0x2781f3;}})[_0xc8a5('0x3e')](function(_0x535c28){logger['error'](_0xc8a5('0x48'),_0x535c28);throw _0x535c28;});}return _0x2781f3;})[_0xc8a5('0x24')](respondWithResult(_0x3eea2c,0xc9))[_0xc8a5('0x3e')](handleError(_0x3eea2c,null));};exports['update']=function(_0x8b11c4,_0x1d086e){if(_0x8b11c4['body']['id']){delete _0x8b11c4[_0xc8a5('0x49')]['id'];}return db[_0xc8a5('0x2b')][_0xc8a5('0x4a')]({'where':{'id':_0x8b11c4[_0xc8a5('0x40')]['id']}})['then'](handleEntityNotFound(_0x1d086e,null))['then'](saveUpdates(_0x8b11c4[_0xc8a5('0x49')],null))['then'](respondWithResult(_0x1d086e,null))['catch'](handleError(_0x1d086e,null));};exports[_0xc8a5('0x4b')]=function(_0x559d65,_0x16f169){return db[_0xc8a5('0x2b')][_0xc8a5('0x4a')]({'where':{'id':_0x559d65['params']['id']}})[_0xc8a5('0x24')](handleEntityNotFound(_0x16f169,null))[_0xc8a5('0x24')](removeEntity(_0x16f169,null))[_0xc8a5('0x3e')](handleError(_0x16f169,null));};exports[_0xc8a5('0x4c')]=function(_0x577f1a,_0x280c1d,_0x31490f){var _0x7b84e1=require('../../config/schedule');return db['Schedule'][_0xc8a5('0x4a')]({'where':{'id':_0x577f1a[_0xc8a5('0x40')]['id']},'raw':!![]})[_0xc8a5('0x24')](handleEntityNotFound(_0x280c1d,null))[_0xc8a5('0x24')](function(){_0x7b84e1[_0xc8a5('0x4c')](_0x577f1a['params']['id']);})[_0xc8a5('0x24')](respondWithStatusCode(_0x280c1d,null))[_0xc8a5('0x3e')](handleError(_0x280c1d,null));}; \ No newline at end of file +var _0x5f91=['error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','../../config/schedule','run','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','then','destroy','get','Scheduler','UserProfileResource','stack','name','send','map','Schedule','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5f91,0xa9));var _0x15f9=function(_0x43cb1a,_0x2b75b8){_0x43cb1a=_0x43cb1a-0x0;var _0x415f5e=_0x5f91[_0x43cb1a];return _0x415f5e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x15f9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x15f9('0x1'));var rp=require(_0x15f9('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x15f9('0x3'));var util=require(_0x15f9('0x4'));var path=require(_0x15f9('0x5'));var sox=require(_0x15f9('0x6'));var csv=require(_0x15f9('0x7'));var ejs=require(_0x15f9('0x8'));var fs=require('fs');var fs_extra=require(_0x15f9('0x9'));var _=require('lodash');var squel=require(_0x15f9('0xa'));var crypto=require(_0x15f9('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x15f9('0xc'));var toCsv=require(_0x15f9('0x7'));var querystring=require(_0x15f9('0xd'));var Papa=require(_0x15f9('0xe'));var Redis=require(_0x15f9('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x15f9('0x10'));var logger=require(_0x15f9('0x11'))(_0x15f9('0x12'));var utils=require(_0x15f9('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x15f9('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c2d66,_0x5639fe){_0x5639fe=_0x5639fe||0xcc;return function(_0x44a134){if(_0x44a134){return _0x4c2d66[_0x15f9('0x15')](_0x5639fe);}return _0x4c2d66['status'](_0x5639fe)[_0x15f9('0x16')]();};}function respondWithResult(_0x5cb229,_0x15954b){_0x15954b=_0x15954b||0xc8;return function(_0x5aace6){if(_0x5aace6){return _0x5cb229[_0x15f9('0x17')](_0x15954b)[_0x15f9('0x18')](_0x5aace6);}};}function respondWithFilteredResult(_0x2c2f8d,_0x2bf878){return function(_0x5cdffe){if(_0x5cdffe){var _0x1215a8=typeof _0x2bf878[_0x15f9('0x19')]===_0x15f9('0x1a')&&typeof _0x2bf878[_0x15f9('0x1b')]===_0x15f9('0x1a');var _0x1f27b5=_0x5cdffe['count'];var _0x886baf=_0x1215a8?0x0:_0x2bf878[_0x15f9('0x19')];var _0x2d6d57=_0x1215a8?_0x5cdffe[_0x15f9('0x1c')]:_0x2bf878[_0x15f9('0x19')]+_0x2bf878['limit'];var _0x30f394;if(_0x2d6d57>=_0x1f27b5){_0x2d6d57=_0x1f27b5;_0x30f394=0xc8;}else{_0x30f394=0xce;}_0x2c2f8d['status'](_0x30f394);return _0x2c2f8d[_0x15f9('0x1d')](_0x15f9('0x1e'),_0x886baf+'-'+_0x2d6d57+'/'+_0x1f27b5)[_0x15f9('0x18')](_0x5cdffe);}return null;};}function patchUpdates(_0x327f96){return function(_0x35b35b){try{jsonpatch[_0x15f9('0x1f')](_0x35b35b,_0x327f96,!![]);}catch(_0x294a9){return BPromise['reject'](_0x294a9);}return _0x35b35b['save']();};}function saveUpdates(_0x35617e,_0x2efa14){return function(_0x6cc9fd){if(_0x6cc9fd){return _0x6cc9fd['update'](_0x35617e)[_0x15f9('0x20')](function(_0x27b798){return _0x27b798;});}return null;};}function removeEntity(_0x1d66c6,_0x3cacdc){return function(_0x461d16){if(_0x461d16){return _0x461d16[_0x15f9('0x21')]()[_0x15f9('0x20')](function(){var _0x12243d=_0x461d16[_0x15f9('0x22')]({'plain':!![]});var _0x55f2d8=_0x15f9('0x23');return db[_0x15f9('0x24')]['destroy']({'where':{'type':_0x55f2d8,'resourceId':_0x12243d['id']}})[_0x15f9('0x20')](function(){return _0x461d16;});})['then'](function(){_0x1d66c6[_0x15f9('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x521aaa,_0x47e3c9){return function(_0x3a6a5c){if(!_0x3a6a5c){_0x521aaa[_0x15f9('0x15')](0x194);}return _0x3a6a5c;};}function handleError(_0xb55420,_0x456a81){_0x456a81=_0x456a81||0x1f4;return function(_0x457fc0){logger['error'](_0x457fc0[_0x15f9('0x25')]);if(_0x457fc0[_0x15f9('0x26')]){delete _0x457fc0['name'];}_0xb55420[_0x15f9('0x17')](_0x456a81)[_0x15f9('0x27')](_0x457fc0);};}exports['index']=function(_0x1cde73,_0x28c9e2){var _0x180023={},_0x9620be={},_0x459ddc={'count':0x0,'rows':[]};var _0x19063=_[_0x15f9('0x28')](db[_0x15f9('0x29')]['rawAttributes'],function(_0x1e23fc){return{'name':_0x1e23fc[_0x15f9('0x2a')],'type':_0x1e23fc[_0x15f9('0x2b')]['key']};});_0x9620be[_0x15f9('0x2c')]=_['map'](_0x19063,_0x15f9('0x26'));_0x9620be[_0x15f9('0x2d')]=_[_0x15f9('0x2e')](_0x1cde73['query']);_0x9620be[_0x15f9('0x2f')]=_[_0x15f9('0x30')](_0x9620be[_0x15f9('0x2c')],_0x9620be['query']);_0x180023[_0x15f9('0x31')]=_['intersection'](_0x9620be[_0x15f9('0x2c')],qs[_0x15f9('0x32')](_0x1cde73['query'][_0x15f9('0x32')]));_0x180023[_0x15f9('0x31')]=_0x180023[_0x15f9('0x31')][_0x15f9('0x33')]?_0x180023[_0x15f9('0x31')]:_0x9620be[_0x15f9('0x2c')];if(!_0x1cde73['query'][_0x15f9('0x34')](_0x15f9('0x35'))){_0x180023[_0x15f9('0x1b')]=qs['limit'](_0x1cde73[_0x15f9('0x2d')][_0x15f9('0x1b')]);_0x180023['offset']=qs[_0x15f9('0x19')](_0x1cde73[_0x15f9('0x2d')]['offset']);}_0x180023[_0x15f9('0x36')]=qs['sort'](_0x1cde73[_0x15f9('0x2d')][_0x15f9('0x37')]);_0x180023[_0x15f9('0x38')]=qs[_0x15f9('0x2f')](_[_0x15f9('0x39')](_0x1cde73[_0x15f9('0x2d')],_0x9620be[_0x15f9('0x2f')]),_0x19063);if(_0x1cde73[_0x15f9('0x2d')][_0x15f9('0x3a')]){_0x180023['where']=_[_0x15f9('0x3b')](_0x180023[_0x15f9('0x38')],{'$or':_[_0x15f9('0x28')](_0x19063,function(_0x2586c0){if(_0x2586c0['type']!==_0x15f9('0x3c')){var _0x4fec75={};_0x4fec75[_0x2586c0[_0x15f9('0x26')]]={'$like':'%'+_0x1cde73['query']['filter']+'%'};return _0x4fec75;}})});}_0x180023=_[_0x15f9('0x3b')]({},_0x180023,_0x1cde73[_0x15f9('0x3d')]);var _0x3bc020={'where':_0x180023[_0x15f9('0x38')]};return db[_0x15f9('0x29')]['count'](_0x3bc020)[_0x15f9('0x20')](function(_0x3f8a6e){_0x459ddc[_0x15f9('0x1c')]=_0x3f8a6e;if(_0x1cde73[_0x15f9('0x2d')]['includeAll']){_0x180023[_0x15f9('0x3e')]=[{'all':!![]}];}return db['Schedule'][_0x15f9('0x3f')](_0x180023);})[_0x15f9('0x20')](function(_0x5dbf0a){_0x459ddc[_0x15f9('0x40')]=_0x5dbf0a;return _0x459ddc;})[_0x15f9('0x20')](respondWithFilteredResult(_0x28c9e2,_0x180023))['catch'](handleError(_0x28c9e2,null));};exports[_0x15f9('0x41')]=function(_0x5f0ae8,_0x3e0c93){var _0x53111a={'raw':![],'where':{'id':_0x5f0ae8[_0x15f9('0x42')]['id']}},_0xd93c64={};_0xd93c64['model']=_['keys'](db[_0x15f9('0x29')]['rawAttributes']);_0xd93c64['query']=_[_0x15f9('0x2e')](_0x5f0ae8[_0x15f9('0x2d')]);_0xd93c64[_0x15f9('0x2f')]=_[_0x15f9('0x30')](_0xd93c64[_0x15f9('0x2c')],_0xd93c64[_0x15f9('0x2d')]);_0x53111a['attributes']=_[_0x15f9('0x30')](_0xd93c64['model'],qs[_0x15f9('0x32')](_0x5f0ae8[_0x15f9('0x2d')]['fields']));_0x53111a[_0x15f9('0x31')]=_0x53111a[_0x15f9('0x31')]['length']?_0x53111a[_0x15f9('0x31')]:_0xd93c64[_0x15f9('0x2c')];if(_0x5f0ae8[_0x15f9('0x2d')][_0x15f9('0x43')]){_0x53111a[_0x15f9('0x3e')]=[{'all':!![]}];}_0x53111a=_[_0x15f9('0x3b')]({},_0x53111a,_0x5f0ae8[_0x15f9('0x3d')]);return db[_0x15f9('0x29')][_0x15f9('0x44')](_0x53111a)[_0x15f9('0x20')](handleEntityNotFound(_0x3e0c93,null))[_0x15f9('0x20')](respondWithResult(_0x3e0c93,null))[_0x15f9('0x45')](handleError(_0x3e0c93,null));};exports['create']=function(_0xce3d91,_0x475200){return db[_0x15f9('0x29')][_0x15f9('0x46')](_0xce3d91[_0x15f9('0x47')],{})['then'](function(_0x264879){var _0x2afe55=_0xce3d91['user'][_0x15f9('0x22')]({'plain':!![]});if(!_0x2afe55)throw new Error(_0x15f9('0x48'));if(_0x2afe55[_0x15f9('0x49')]===_0x15f9('0x4a')){var _0x9111f4=_0x264879[_0x15f9('0x22')]({'plain':!![]});var _0x4c0675='Scheduler';return db[_0x15f9('0x4b')][_0x15f9('0x44')]({'where':{'name':_0x4c0675,'userProfileId':_0x2afe55['userProfileId']},'raw':!![]})['then'](function(_0x12e489){if(_0x12e489&&_0x12e489[_0x15f9('0x4c')]===0x0){return db[_0x15f9('0x24')][_0x15f9('0x46')]({'name':_0x9111f4['name'],'resourceId':_0x9111f4['id'],'type':_0x12e489['name'],'sectionId':_0x12e489['id']},{})[_0x15f9('0x20')](function(){return _0x264879;});}else{return _0x264879;}})[_0x15f9('0x45')](function(_0x4ca15f){logger[_0x15f9('0x4d')](_0x15f9('0x4e'),_0x4ca15f);throw _0x4ca15f;});}return _0x264879;})[_0x15f9('0x20')](respondWithResult(_0x475200,0xc9))['catch'](handleError(_0x475200,null));};exports[_0x15f9('0x4f')]=function(_0x20468b,_0x385fad){if(_0x20468b[_0x15f9('0x47')]['id']){delete _0x20468b[_0x15f9('0x47')]['id'];}return db[_0x15f9('0x29')][_0x15f9('0x44')]({'where':{'id':_0x20468b[_0x15f9('0x42')]['id']}})[_0x15f9('0x20')](handleEntityNotFound(_0x385fad,null))['then'](saveUpdates(_0x20468b[_0x15f9('0x47')],null))[_0x15f9('0x20')](respondWithResult(_0x385fad,null))[_0x15f9('0x45')](handleError(_0x385fad,null));};exports['destroy']=function(_0x1d5536,_0x10fb80){return db[_0x15f9('0x29')][_0x15f9('0x44')]({'where':{'id':_0x1d5536[_0x15f9('0x42')]['id']}})['then'](handleEntityNotFound(_0x10fb80,null))['then'](removeEntity(_0x10fb80,null))['catch'](handleError(_0x10fb80,null));};exports['run']=function(_0x50c935,_0x26ced3,_0x1d4c54){var _0x3d8b84=require(_0x15f9('0x50'));return db['Schedule'][_0x15f9('0x44')]({'where':{'id':_0x50c935['params']['id']},'raw':!![]})[_0x15f9('0x20')](handleEntityNotFound(_0x26ced3,null))[_0x15f9('0x20')](function(){_0x3d8b84[_0x15f9('0x51')](_0x50c935[_0x15f9('0x42')]['id']);})['then'](respondWithStatusCode(_0x26ced3,null))[_0x15f9('0x45')](handleError(_0x26ced3,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 77db75b..650621c 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 _0x3ff5=['util','bluebird','request-promise','path','../../config/environment','./schedule.attributes','exports','define','Schedule','lodash'];(function(_0x21c8e3,_0x1958b7){var _0x23918f=function(_0x1fdc2e){while(--_0x1fdc2e){_0x21c8e3['push'](_0x21c8e3['shift']());}};_0x23918f(++_0x1958b7);}(_0x3ff5,0x1ad));var _0x53ff=function(_0x469cf9,_0x548de2){_0x469cf9=_0x469cf9-0x0;var _0x343b1c=_0x3ff5[_0x469cf9];return _0x343b1c;};'use strict';var _=require(_0x53ff('0x0'));var util=require(_0x53ff('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x53ff('0x2'));var rp=require(_0x53ff('0x3'));var fs=require('fs');var path=require(_0x53ff('0x4'));var rimraf=require('rimraf');var config=require(_0x53ff('0x5'));var attributes=require(_0x53ff('0x6'));module[_0x53ff('0x7')]=function(_0x219abd,_0x196e09){return _0x219abd[_0x53ff('0x8')](_0x53ff('0x9'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xad84=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','util'];(function(_0x4e3c02,_0x734e35){var _0x5a1912=function(_0x49c24b){while(--_0x49c24b){_0x4e3c02['push'](_0x4e3c02['shift']());}};_0x5a1912(++_0x734e35);}(_0xad84,0x186));var _0x4ad8=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xad84[_0x40220a];return _0x3903cc;};'use strict';var _=require(_0x4ad8('0x0'));var util=require(_0x4ad8('0x1'));var logger=require('../../config/logger')(_0x4ad8('0x2'));var moment=require(_0x4ad8('0x3'));var BPromise=require(_0x4ad8('0x4'));var rp=require(_0x4ad8('0x5'));var fs=require('fs');var path=require(_0x4ad8('0x6'));var rimraf=require(_0x4ad8('0x7'));var config=require(_0x4ad8('0x8'));var attributes=require(_0x4ad8('0x9'));module[_0x4ad8('0xa')]=function(_0x36e5d0,_0x592383){return _0x36e5d0[_0x4ad8('0xb')](_0x4ad8('0xc'),attributes,{'tableName':_0x4ad8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index 3755347..cf4933b 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 _0x6663=['request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','Schedule,\x20%s,\x20%s'];(function(_0x3cba93,_0x5c2fd8){var _0x4a2991=function(_0x3cf95b){while(--_0x3cf95b){_0x3cba93['push'](_0x3cba93['shift']());}};_0x4a2991(++_0x5c2fd8);}(_0x6663,0x1d9));var _0x3666=function(_0x47408e,_0x481428){_0x47408e=_0x47408e-0x0;var _0x1636bc=_0x6663[_0x47408e];return _0x1636bc;};'use strict';var _=require('lodash');var util=require(_0x3666('0x0'));var moment=require(_0x3666('0x1'));var BPromise=require('bluebird');var rs=require(_0x3666('0x2'));var fs=require('fs');var Redis=require(_0x3666('0x3'));var db=require(_0x3666('0x4'))['db'];var utils=require(_0x3666('0x5'));var logger=require(_0x3666('0x6'))(_0x3666('0x7'));var config=require('../../config/environment');var jayson=require(_0x3666('0x8'));var client=jayson['client'][_0x3666('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a4236,_0x557665,_0x139590){return new BPromise(function(_0x4811a7,_0x35985e){return client[_0x3666('0xa')](_0x4a4236,_0x139590)['then'](function(_0xd072c7){logger[_0x3666('0xb')](_0x3666('0xc'),_0x557665,_0x3666('0xd'));logger['debug'](_0x3666('0xe'),_0x557665,_0x3666('0xd'),JSON[_0x3666('0xf')](_0xd072c7));if(_0xd072c7[_0x3666('0x10')]){if(_0xd072c7[_0x3666('0x10')]['code']===0x1f4){logger[_0x3666('0x10')](_0x3666('0xc'),_0x557665,_0xd072c7['error'][_0x3666('0x11')]);return _0x35985e(_0xd072c7[_0x3666('0x10')][_0x3666('0x11')]);}logger[_0x3666('0x10')]('Schedule,\x20%s,\x20%s',_0x557665,_0xd072c7['error'][_0x3666('0x11')]);return _0x4811a7(_0xd072c7[_0x3666('0x10')][_0x3666('0x11')]);}else{logger['info']('Schedule,\x20%s,\x20%s',_0x557665,'request\x20sent');_0x4811a7(_0xd072c7['result']['message']);}})['catch'](function(_0x854be){logger[_0x3666('0x10')](_0x3666('0xc'),_0x557665,_0x854be);_0x35985e(_0x854be);});});} \ No newline at end of file +var _0x09fd=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb'];(function(_0x3adba0,_0x5df3ab){var _0x1b5798=function(_0x1ec22e){while(--_0x1ec22e){_0x3adba0['push'](_0x3adba0['shift']());}};_0x1b5798(++_0x5df3ab);}(_0x09fd,0xe2));var _0xd09f=function(_0x3cb48e,_0x580d7a){_0x3cb48e=_0x3cb48e-0x0;var _0x27c35a=_0x09fd[_0x3cb48e];return _0x27c35a;};'use strict';var _=require(_0xd09f('0x0'));var util=require(_0xd09f('0x1'));var moment=require(_0xd09f('0x2'));var BPromise=require(_0xd09f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd09f('0x4'))['db'];var utils=require(_0xd09f('0x5'));var logger=require('../../config/logger')(_0xd09f('0x6'));var config=require(_0xd09f('0x7'));var jayson=require(_0xd09f('0x8'));var client=jayson[_0xd09f('0x9')][_0xd09f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x393e9b,_0x182587,_0x18129e){return new BPromise(function(_0xbfc718,_0x2d2583){return client[_0xd09f('0xb')](_0x393e9b,_0x18129e)[_0xd09f('0xc')](function(_0xb3da07){logger[_0xd09f('0xd')](_0xd09f('0xe'),_0x182587,_0xd09f('0xf'));logger['debug']('Schedule,\x20%s,\x20%s,\x20%s',_0x182587,_0xd09f('0xf'),JSON['stringify'](_0xb3da07));if(_0xb3da07['error']){if(_0xb3da07[_0xd09f('0x10')][_0xd09f('0x11')]===0x1f4){logger[_0xd09f('0x10')](_0xd09f('0xe'),_0x182587,_0xb3da07[_0xd09f('0x10')]['message']);return _0x2d2583(_0xb3da07[_0xd09f('0x10')]['message']);}logger[_0xd09f('0x10')]('Schedule,\x20%s,\x20%s',_0x182587,_0xb3da07[_0xd09f('0x10')]['message']);return _0xbfc718(_0xb3da07[_0xd09f('0x10')][_0xd09f('0x12')]);}else{logger[_0xd09f('0xd')](_0xd09f('0xe'),_0x182587,_0xd09f('0xf'));_0xbfc718(_0xb3da07[_0xd09f('0x13')][_0xd09f('0x12')]);}})[_0xd09f('0x14')](function(_0x4007c8){logger[_0xd09f('0x10')](_0xd09f('0xe'),_0x182587,_0x4007c8);_0x2d2583(_0x4007c8);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index e7c764c..17b9863 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 _0x31a0=['/:id','show','/:id/download','download','post','put','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x4aec6e,_0x2ba144){var _0x3aa607=function(_0x33b4c9){while(--_0x33b4c9){_0x4aec6e['push'](_0x4aec6e['shift']());}};_0x3aa607(++_0x2ba144);}(_0x31a0,0x68));var _0x031a=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0x31a0[_0x12f688];return _0x59c3de;};'use strict';var multer=require(_0x031a('0x0'));var util=require(_0x031a('0x1'));var path=require(_0x031a('0x2'));var timeout=require(_0x031a('0x3'));var express=require(_0x031a('0x4'));var router=express[_0x031a('0x5')]();var fs_extra=require(_0x031a('0x6'));var auth=require(_0x031a('0x7'));var interaction=require(_0x031a('0x8'));var config=require(_0x031a('0x9'));var controller=require(_0x031a('0xa'));router[_0x031a('0xb')]('/',auth[_0x031a('0xc')](),controller[_0x031a('0xd')]);router[_0x031a('0xb')](_0x031a('0xe'),auth[_0x031a('0xc')](),controller[_0x031a('0xf')]);router[_0x031a('0xb')](_0x031a('0x10'),auth[_0x031a('0xc')](),controller[_0x031a('0x11')]);router[_0x031a('0xb')](_0x031a('0x12'),auth[_0x031a('0xc')](),controller[_0x031a('0x13')]);router[_0x031a('0x14')]('/',auth[_0x031a('0xc')](),controller['create']);router[_0x031a('0x15')]('/:id',auth[_0x031a('0xc')](),controller['update']);router[_0x031a('0x16')](_0x031a('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0x031a('0x17')]=router; \ No newline at end of file +var _0xce7c=['post','create','/:id','update','delete','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','describe','show','/:id/download','download'];(function(_0x52980f,_0x47b3b0){var _0x1f52a1=function(_0x51dd63){while(--_0x51dd63){_0x52980f['push'](_0x52980f['shift']());}};_0x1f52a1(++_0x47b3b0);}(_0xce7c,0x8b));var _0xcce7=function(_0x363dee,_0x4d1a44){_0x363dee=_0x363dee-0x0;var _0x31ae44=_0xce7c[_0x363dee];return _0x31ae44;};'use strict';var multer=require(_0xcce7('0x0'));var util=require('util');var path=require(_0xcce7('0x1'));var timeout=require('connect-timeout');var express=require(_0xcce7('0x2'));var router=express[_0xcce7('0x3')]();var fs_extra=require(_0xcce7('0x4'));var auth=require(_0xcce7('0x5'));var interaction=require(_0xcce7('0x6'));var config=require('../../config/environment');var controller=require('./screenRecording.controller');router[_0xcce7('0x7')]('/',auth[_0xcce7('0x8')](),controller['index']);router[_0xcce7('0x7')]('/describe',auth[_0xcce7('0x8')](),controller[_0xcce7('0x9')]);router[_0xcce7('0x7')]('/:id',auth[_0xcce7('0x8')](),controller[_0xcce7('0xa')]);router[_0xcce7('0x7')](_0xcce7('0xb'),auth['isAuthenticated'](),controller[_0xcce7('0xc')]);router[_0xcce7('0xd')]('/',auth[_0xcce7('0x8')](),controller[_0xcce7('0xe')]);router['put'](_0xcce7('0xf'),auth[_0xcce7('0x8')](),controller[_0xcce7('0x10')]);router[_0xcce7('0x11')](_0xcce7('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0xcce7('0x12')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index f798cc3..3f8a76c 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 _0x4f7a=['value','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','format','toString','DATE','MM-DD-YYYY\x20HH:mm','createdAt','path','../../config/environment','exports','getDataValue','extname'];(function(_0x31ee5a,_0x3189b9){var _0x48792b=function(_0x52645d){while(--_0x52645d){_0x31ee5a['push'](_0x31ee5a['shift']());}};_0x48792b(++_0x3189b9);}(_0x4f7a,0x105));var _0xa4f7=function(_0x16dc4c,_0x1dd93f){_0x16dc4c=_0x16dc4c-0x0;var _0x4a6b5c=_0x4f7a[_0x16dc4c];return _0x4a6b5c;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var path=require(_0xa4f7('0x0'));var config=require(_0xa4f7('0x1'));module[_0xa4f7('0x2')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xa4f7('0x3')]('value')?path[_0xa4f7('0x4')](this[_0xa4f7('0x3')](_0xa4f7('0x5'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xa4f7('0x6')]},'value':{'type':Sequelize[_0xa4f7('0x6')],'set':function(_0x4c78bd){var _0x58e1c7=_0x4c78bd[_0xa4f7('0x7')](/\\/g,'/');this[_0xa4f7('0x8')](_0xa4f7('0x5'),_0x58e1c7);}},'rating':{'type':Sequelize[_0xa4f7('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xa4f7('0x9')],'set':function(_0x498186){this[_0xa4f7('0x8')](_0xa4f7('0xa'),moment()[_0xa4f7('0xb')](_0x498186,'ms'));this[_0xa4f7('0x8')](_0xa4f7('0xc'),moment());this[_0xa4f7('0x8')](_0xa4f7('0xd'),_0x498186);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0xa4f7('0xa')))[_0xa4f7('0xe')]('MM-DD-YYYY\x20HH:mm')[_0xa4f7('0xf')]();}},'closedAt':{'type':Sequelize[_0xa4f7('0x10')],'get':function(){return moment(this[_0xa4f7('0x3')]('closedAt'))[_0xa4f7('0xe')](_0xa4f7('0x11'))[_0xa4f7('0xf')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xa4f7('0x3')](_0xa4f7('0x12')))[_0xa4f7('0xe')](_0xa4f7('0x11'))['toString']();}},'updatedAt':{'type':Sequelize[_0xa4f7('0x10')],'get':function(){return moment(this[_0xa4f7('0x3')]('updatedAt'))['format'](_0xa4f7('0x11'))['toString']();}}}; \ No newline at end of file +var _0x186d=['../../config/environment','exports','VIRTUAL','getDataValue','extname','value','STRING','setDataValue','INTEGER','startedAt','subtract','closedAt','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','moment','path'];(function(_0x19dd7a,_0x51de21){var _0x3feb6a=function(_0x4a3c84){while(--_0x4a3c84){_0x19dd7a['push'](_0x19dd7a['shift']());}};_0x3feb6a(++_0x51de21);}(_0x186d,0x1ca));var _0xd186=function(_0x1591f7,_0x5aedd6){_0x1591f7=_0x1591f7-0x0;var _0x4e1517=_0x186d[_0x1591f7];return _0x4e1517;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xd186('0x0'));var path=require(_0xd186('0x1'));var config=require(_0xd186('0x2'));module[_0xd186('0x3')]={'format':{'type':Sequelize[_0xd186('0x4')],'get':function(){return this[_0xd186('0x5')]('value')?path[_0xd186('0x6')](this[_0xd186('0x5')](_0xd186('0x7'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0xd186('0x8')],'set':function(_0x60fc96){var _0x2ecccd=_0x60fc96['replace'](/\\/g,'/');this[_0xd186('0x9')](_0xd186('0x7'),_0x2ecccd);}},'rating':{'type':Sequelize[_0xd186('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x1ef64a){this[_0xd186('0x9')](_0xd186('0xb'),moment()[_0xd186('0xc')](_0x1ef64a,'ms'));this[_0xd186('0x9')](_0xd186('0xd'),moment());this['setDataValue']('duration',_0x1ef64a);}},'startedAt':{'type':Sequelize[_0xd186('0xe')],'get':function(){return moment(this['getDataValue'](_0xd186('0xb')))[_0xd186('0xf')](_0xd186('0x10'))['toString']();}},'closedAt':{'type':Sequelize[_0xd186('0xe')],'get':function(){return moment(this['getDataValue'](_0xd186('0xd')))[_0xd186('0xf')](_0xd186('0x10'))[_0xd186('0x11')]();}},'createdAt':{'type':Sequelize[_0xd186('0xe')],'get':function(){return moment(this[_0xd186('0x5')](_0xd186('0x12')))[_0xd186('0xf')](_0xd186('0x10'))[_0xd186('0x11')]();}},'updatedAt':{'type':Sequelize[_0xd186('0xe')],'get':function(){return moment(this['getDataValue'](_0xd186('0x13')))[_0xd186('0xf')](_0xd186('0x10'))[_0xd186('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 319dc26..cde4438 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 _0xabce=['sendStatus','error','name','send','index','map','ScreenRecording','rawAttributes','type','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','options','include','rows','includeAll','find','catch','create','body','createdAt','closedAt','value','params','describe','download','../../components/encryptor','uniqueid','%s.cypher','existsSync','decryptFile','recording','join','root','server/files/screen_recordings','Sequelize','ValidationError','ScreenRecording\x20not\x20found','unlink','Not\x20found','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','count','offset','Content-Range','apply','reject','save','update','then'];(function(_0x5235af,_0x428a33){var _0x3469c6=function(_0x2d7e93){while(--_0x2d7e93){_0x5235af['push'](_0x5235af['shift']());}};_0x3469c6(++_0x428a33);}(_0xabce,0x103));var _0xeabc=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xabce[_0x55e08b];return _0xd1a7ff;};'use strict';var emlformat=require(_0xeabc('0x0'));var rimraf=require(_0xeabc('0x1'));var zipdir=require(_0xeabc('0x2'));var jsonpatch=require(_0xeabc('0x3'));var rp=require(_0xeabc('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeabc('0x5'));var util=require(_0xeabc('0x6'));var path=require(_0xeabc('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xeabc('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeabc('0x9'));var squel=require('squel');var crypto=require(_0xeabc('0xa'));var jsforce=require(_0xeabc('0xb'));var deskjs=require(_0xeabc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xeabc('0xd'));var Papa=require(_0xeabc('0xe'));var Redis=require(_0xeabc('0xf'));var authService=require(_0xeabc('0x10'));var qs=require(_0xeabc('0x11'));var as=require(_0xeabc('0x12'));var hardwareService=require(_0xeabc('0x13'));var logger=require(_0xeabc('0x14'))(_0xeabc('0x15'));var utils=require(_0xeabc('0x16'));var config=require(_0xeabc('0x17'));var licenseUtil=require(_0xeabc('0x18'));var db=require(_0xeabc('0x19'))['db'];function respondWithStatusCode(_0x3fd0b5,_0x36a92e){_0x36a92e=_0x36a92e||0xcc;return function(_0xcfbf06){if(_0xcfbf06){return _0x3fd0b5['sendStatus'](_0x36a92e);}return _0x3fd0b5[_0xeabc('0x1a')](_0x36a92e)[_0xeabc('0x1b')]();};}function respondWithResult(_0x3251c6,_0x55f0de){_0x55f0de=_0x55f0de||0xc8;return function(_0x5f4ee8){if(_0x5f4ee8){return _0x3251c6[_0xeabc('0x1a')](_0x55f0de)[_0xeabc('0x1c')](_0x5f4ee8);}};}function respondWithFilteredResult(_0x326bac,_0x53d5cb){return function(_0xf913d7){if(_0xf913d7){var _0x638976=typeof _0x53d5cb['offset']==='undefined'&&typeof _0x53d5cb[_0xeabc('0x1d')]==='undefined';var _0x3d0e21=_0xf913d7[_0xeabc('0x1e')];var _0x58a3c0=_0x638976?0x0:_0x53d5cb[_0xeabc('0x1f')];var _0x31dd53=_0x638976?_0xf913d7[_0xeabc('0x1e')]:_0x53d5cb[_0xeabc('0x1f')]+_0x53d5cb[_0xeabc('0x1d')];var _0x5d92e5;if(_0x31dd53>=_0x3d0e21){_0x31dd53=_0x3d0e21;_0x5d92e5=0xc8;}else{_0x5d92e5=0xce;}_0x326bac[_0xeabc('0x1a')](_0x5d92e5);return _0x326bac['set'](_0xeabc('0x20'),_0x58a3c0+'-'+_0x31dd53+'/'+_0x3d0e21)[_0xeabc('0x1c')](_0xf913d7);}return null;};}function patchUpdates(_0x502947){return function(_0x28063a){try{jsonpatch[_0xeabc('0x21')](_0x28063a,_0x502947,!![]);}catch(_0x254590){return BPromise[_0xeabc('0x22')](_0x254590);}return _0x28063a[_0xeabc('0x23')]();};}function saveUpdates(_0x4e99a4,_0xecdbf){return function(_0x10c675){if(_0x10c675){return _0x10c675[_0xeabc('0x24')](_0x4e99a4)['then'](function(_0x457f27){return _0x457f27;});}return null;};}function removeEntity(_0x3854d2,_0x214953){return function(_0x319119){if(_0x319119){return _0x319119['destroy']()[_0xeabc('0x25')](function(){_0x3854d2['status'](0xcc)[_0xeabc('0x1b')]();});}};}function handleEntityNotFound(_0x4d4e29,_0x811f0d){return function(_0x12acbd){if(!_0x12acbd){_0x4d4e29[_0xeabc('0x26')](0x194);}return _0x12acbd;};}function handleError(_0x3f194e,_0x3a1a04){_0x3a1a04=_0x3a1a04||0x1f4;return function(_0x137293){logger[_0xeabc('0x27')](_0x137293['stack']);if(_0x137293['name']){delete _0x137293[_0xeabc('0x28')];}_0x3f194e['status'](_0x3a1a04)[_0xeabc('0x29')](_0x137293);};}exports[_0xeabc('0x2a')]=function(_0x48fb52,_0x2163e6){var _0x38572d={},_0x2b568f={},_0x2f8633={'count':0x0,'rows':[]};var _0x149170=_[_0xeabc('0x2b')](db[_0xeabc('0x2c')][_0xeabc('0x2d')],function(_0x2915c1){return{'name':_0x2915c1['fieldName'],'type':_0x2915c1[_0xeabc('0x2e')]['key']};});_0x2b568f[_0xeabc('0x2f')]=_[_0xeabc('0x30')](_[_0xeabc('0x2b')](_0x149170,_0xeabc('0x28')),[_0xeabc('0x31')]);_0x2b568f[_0xeabc('0x32')]=_[_0xeabc('0x33')](_0x48fb52['query']);_0x2b568f[_0xeabc('0x34')]=_[_0xeabc('0x35')](_0x2b568f[_0xeabc('0x2f')],_0x2b568f['query']);_0x38572d[_0xeabc('0x36')]=_[_0xeabc('0x35')](_0x2b568f[_0xeabc('0x2f')],qs['fields'](_0x48fb52[_0xeabc('0x32')][_0xeabc('0x37')]));_0x38572d[_0xeabc('0x36')]=_0x38572d['attributes'][_0xeabc('0x38')]?_0x38572d[_0xeabc('0x36')]:_0x2b568f['model'];if(!_0x48fb52['query'][_0xeabc('0x39')](_0xeabc('0x3a'))){_0x38572d['limit']=qs[_0xeabc('0x1d')](_0x48fb52[_0xeabc('0x32')][_0xeabc('0x1d')]);_0x38572d[_0xeabc('0x1f')]=qs[_0xeabc('0x1f')](_0x48fb52['query'][_0xeabc('0x1f')]);}_0x38572d['order']=qs[_0xeabc('0x3b')](_0x48fb52[_0xeabc('0x32')][_0xeabc('0x3b')]);_0x38572d['where']=qs['filters'](_[_0xeabc('0x3c')](_0x48fb52['query'],_0x2b568f[_0xeabc('0x34')]),_0x149170);if(_0x48fb52['query']['filter']){_0x38572d['where']=_['merge'](_0x38572d[_0xeabc('0x3d')],{'$or':_['map'](_0x149170,function(_0x257fe8){if(_0x257fe8[_0xeabc('0x2e')]!=='VIRTUAL'){var _0xe8fa6e={};_0xe8fa6e[_0x257fe8['name']]={'$like':'%'+_0x48fb52[_0xeabc('0x32')]['filter']+'%'};return _0xe8fa6e;}})});}_0x38572d=_[_0xeabc('0x3e')]({},_0x38572d,_0x48fb52[_0xeabc('0x3f')]);var _0xeeef02={'where':_0x38572d['where']};return db['ScreenRecording']['count'](_0xeeef02)[_0xeabc('0x25')](function(_0x23fb33){_0x2f8633[_0xeabc('0x1e')]=_0x23fb33;if(_0x48fb52['query']['includeAll']){_0x38572d[_0xeabc('0x40')]=[{'all':!![]}];}return db[_0xeabc('0x2c')]['findAll'](_0x38572d);})[_0xeabc('0x25')](function(_0x5e0b78){_0x2f8633[_0xeabc('0x41')]=_0x5e0b78;return _0x2f8633;})['then'](respondWithFilteredResult(_0x2163e6,_0x38572d))['catch'](handleError(_0x2163e6,null));};exports['show']=function(_0x25958b,_0x37c926){var _0xd03226={'raw':![],'where':{'id':_0x25958b['params']['id']}},_0x3eeeb5={};_0x3eeeb5[_0xeabc('0x2f')]=_['keys'](db[_0xeabc('0x2c')][_0xeabc('0x2d')]);_0x3eeeb5[_0xeabc('0x32')]=_[_0xeabc('0x33')](_0x25958b[_0xeabc('0x32')]);_0x3eeeb5['filters']=_['intersection'](_0x3eeeb5[_0xeabc('0x2f')],_0x3eeeb5['query']);_0xd03226[_0xeabc('0x36')]=_[_0xeabc('0x35')](_0x3eeeb5['model'],qs[_0xeabc('0x37')](_0x25958b[_0xeabc('0x32')][_0xeabc('0x37')]));_0xd03226[_0xeabc('0x36')]=_0xd03226[_0xeabc('0x36')][_0xeabc('0x38')]?_0xd03226[_0xeabc('0x36')]:_0x3eeeb5['model'];if(_0x25958b[_0xeabc('0x32')][_0xeabc('0x42')]){_0xd03226[_0xeabc('0x40')]=[{'all':!![]}];}_0xd03226=_[_0xeabc('0x3e')]({},_0xd03226,_0x25958b[_0xeabc('0x3f')]);return db[_0xeabc('0x2c')][_0xeabc('0x43')](_0xd03226)[_0xeabc('0x25')](handleEntityNotFound(_0x37c926,null))[_0xeabc('0x25')](respondWithResult(_0x37c926,null))[_0xeabc('0x44')](handleError(_0x37c926,null));};exports['create']=function(_0x38356c,_0x2e6efb){return db[_0xeabc('0x2c')][_0xeabc('0x45')](_0x38356c[_0xeabc('0x46')],{})[_0xeabc('0x25')](respondWithResult(_0x2e6efb,0xc9))[_0xeabc('0x44')](handleError(_0x2e6efb,null));};exports['update']=function(_0x766743,_0x32e09b){if(_0x766743[_0xeabc('0x46')]['id']){delete _0x766743[_0xeabc('0x46')]['id'];}delete _0x766743[_0xeabc('0x46')]['duration'];delete _0x766743[_0xeabc('0x46')][_0xeabc('0x47')];delete _0x766743[_0xeabc('0x46')][_0xeabc('0x48')];delete _0x766743['body'][_0xeabc('0x49')];return db[_0xeabc('0x2c')]['find']({'where':{'id':_0x766743[_0xeabc('0x4a')]['id']}})['then'](handleEntityNotFound(_0x32e09b,null))[_0xeabc('0x25')](saveUpdates(_0x766743['body'],null))[_0xeabc('0x25')](respondWithResult(_0x32e09b,null))[_0xeabc('0x44')](handleError(_0x32e09b,null));};exports[_0xeabc('0x4b')]=function(_0x1524c3,_0x1ee837){return db[_0xeabc('0x2c')][_0xeabc('0x4b')]()[_0xeabc('0x25')](respondWithResult(_0x1ee837,null))[_0xeabc('0x44')](handleError(_0x1ee837,null));};exports[_0xeabc('0x4c')]=function(_0x48a13f,_0x180a14,_0x2537ab){var _0x4072cb=require(_0xeabc('0x4d'));var _0x555d6b=![];var _0x1cef45={};if(_0x48a13f[_0xeabc('0x32')][_0xeabc('0x2e')]&&_0x48a13f[_0xeabc('0x32')]['type']===_0xeabc('0x4e')){_0x1cef45[_0xeabc('0x4e')]=_0x48a13f[_0xeabc('0x4a')]['id'];}else{_0x1cef45['id']=_0x48a13f[_0xeabc('0x4a')]['id'];}return db[_0xeabc('0x2c')][_0xeabc('0x43')]({'where':_0x1cef45,'attributes':['id',_0xeabc('0x49')],'raw':!![]})[_0xeabc('0x25')](handleEntityNotFound(_0x180a14,null))[_0xeabc('0x25')](function(_0x58ab08){if(_0x58ab08){var _0x4546c4=path['join'](config['root'],'server/files/screen_recordings',_0x58ab08[_0xeabc('0x49')]);var _0x8d4cca=util[_0xeabc('0x31')](_0xeabc('0x4f'),_0x4546c4);if(fs[_0xeabc('0x50')](_0x8d4cca)){_0x555d6b=!![];return _0x4072cb[_0xeabc('0x51')](_0x8d4cca,_0x4546c4,config['secrets'][_0xeabc('0x52')])[_0xeabc('0x25')](function(){return _0x58ab08;});}return _0x58ab08;}})[_0xeabc('0x25')](function(_0x104c1e){if(_0x104c1e){var _0x2ddc53=path[_0xeabc('0x53')](config[_0xeabc('0x54')],_0xeabc('0x55'),_0x104c1e['value']);if(!fs['existsSync'](_0x2ddc53)){throw new db[(_0xeabc('0x56'))][(_0xeabc('0x57'))](_0xeabc('0x58'));}if(_0x104c1e['filename']){return _0x180a14[_0xeabc('0x4c')](_0x2ddc53,_0x104c1e['filename']+path['extname'](_0x2ddc53),function(){if(_0x555d6b){fs[_0xeabc('0x59')](_0x2ddc53);}});}else{return _0x180a14[_0xeabc('0x4c')](_0x2ddc53,function(_0x13f04f){if(_0x555d6b){fs[_0xeabc('0x59')](_0x2ddc53);}});}}})[_0xeabc('0x44')](function(_0xc2ef0c){if(_0xc2ef0c['message']===_0xeabc('0x58')){_0x180a14[_0xeabc('0x1a')](0x194)[_0xeabc('0x29')](_0xeabc('0x5a'));}else{return handleError(_0x180a14,null);}});};exports[_0xeabc('0x5b')]=function(_0x514787,_0x5c61b4){return db[_0xeabc('0x2c')][_0xeabc('0x43')]({'where':{'id':_0x514787[_0xeabc('0x4a')]['id']}})[_0xeabc('0x25')](function(_0x1b61a8){if(_[_0xeabc('0x5c')](_0x1b61a8)){throw new ReferenceError(_0xeabc('0x5d'));}return _0x1b61a8;})[_0xeabc('0x25')](function(_0x3f829b){var _0x54d2b3=path[_0xeabc('0x53')](config['root'],_0xeabc('0x55'),_0x3f829b[_0xeabc('0x49')]);logger[_0xeabc('0x5e')](_0xeabc('0x5f'),_0x54d2b3);if(!_[_0xeabc('0x5c')](_0x3f829b[_0xeabc('0x49')])&&fs[_0xeabc('0x50')](_0x54d2b3)){logger[_0xeabc('0x5e')](_0xeabc('0x60')+_0x54d2b3+_0xeabc('0x61'));fs['unlinkSync'](_0x54d2b3);}_0x54d2b3=_0x54d2b3+_0xeabc('0x62');if(!_[_0xeabc('0x5c')](_0x3f829b[_0xeabc('0x49')])&&fs[_0xeabc('0x50')](_0x54d2b3)){logger['info'](_0xeabc('0x60')+_0x54d2b3+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x54d2b3);}return _0x3f829b;})[_0xeabc('0x25')](function(_0x11bc62){if(!_0x11bc62)throw new InternalError();return _0x11bc62[_0xeabc('0x5b')]();})[_0xeabc('0x25')](function(){_0x5c61b4['status'](0xcc)['end']();})[_0xeabc('0x44')](handleError(_0x5c61b4,null));}; \ No newline at end of file +var _0x00bb=['json','undefined','limit','offset','apply','reject','update','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','ScreenRecording','count','then','includeAll','include','rows','catch','show','params','length','options','find','body','createdAt','closedAt','value','describe','download','uniqueid','join','root','format','%s.cypher','existsSync','decryptFile','secrets','recording','server/files/screen_recordings','Sequelize','ScreenRecording\x20not\x20found','filename','unlink','message','Not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status'];(function(_0x15f5d1,_0x6ec76e){var _0x41e93a=function(_0x4aff49){while(--_0x4aff49){_0x15f5d1['push'](_0x15f5d1['shift']());}};_0x41e93a(++_0x6ec76e);}(_0x00bb,0x1d8));var _0xb00b=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x00bb[_0x24237f];return _0x48298e;};'use strict';var emlformat=require(_0xb00b('0x0'));var rimraf=require(_0xb00b('0x1'));var zipdir=require(_0xb00b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb00b('0x3'));var moment=require('moment');var BPromise=require(_0xb00b('0x4'));var Mustache=require(_0xb00b('0x5'));var util=require('util');var path=require(_0xb00b('0x6'));var sox=require(_0xb00b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb00b('0x8'));var squel=require(_0xb00b('0x9'));var crypto=require(_0xb00b('0xa'));var jsforce=require(_0xb00b('0xb'));var deskjs=require(_0xb00b('0xc'));var toCsv=require(_0xb00b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb00b('0xe'));var authService=require(_0xb00b('0xf'));var qs=require(_0xb00b('0x10'));var as=require(_0xb00b('0x11'));var hardwareService=require(_0xb00b('0x12'));var logger=require('../../config/logger')(_0xb00b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb00b('0x14'))['db'];function respondWithStatusCode(_0x2d8ddf,_0x1be8aa){_0x1be8aa=_0x1be8aa||0xcc;return function(_0x466b9b){if(_0x466b9b){return _0x2d8ddf[_0xb00b('0x15')](_0x1be8aa);}return _0x2d8ddf[_0xb00b('0x16')](_0x1be8aa)['end']();};}function respondWithResult(_0x218de2,_0xb0d42e){_0xb0d42e=_0xb0d42e||0xc8;return function(_0x482fe6){if(_0x482fe6){return _0x218de2[_0xb00b('0x16')](_0xb0d42e)[_0xb00b('0x17')](_0x482fe6);}};}function respondWithFilteredResult(_0x540b79,_0x5da36b){return function(_0x9b471e){if(_0x9b471e){var _0x4dcd45=typeof _0x5da36b['offset']===_0xb00b('0x18')&&typeof _0x5da36b[_0xb00b('0x19')]===_0xb00b('0x18');var _0xbb72fc=_0x9b471e['count'];var _0x2a7231=_0x4dcd45?0x0:_0x5da36b['offset'];var _0x415f91=_0x4dcd45?_0x9b471e['count']:_0x5da36b[_0xb00b('0x1a')]+_0x5da36b['limit'];var _0xb26ebb;if(_0x415f91>=_0xbb72fc){_0x415f91=_0xbb72fc;_0xb26ebb=0xc8;}else{_0xb26ebb=0xce;}_0x540b79[_0xb00b('0x16')](_0xb26ebb);return _0x540b79['set']('Content-Range',_0x2a7231+'-'+_0x415f91+'/'+_0xbb72fc)[_0xb00b('0x17')](_0x9b471e);}return null;};}function patchUpdates(_0x4a334b){return function(_0x1344c4){try{jsonpatch[_0xb00b('0x1b')](_0x1344c4,_0x4a334b,!![]);}catch(_0x2fe48d){return BPromise[_0xb00b('0x1c')](_0x2fe48d);}return _0x1344c4['save']();};}function saveUpdates(_0x362ee0,_0x4df284){return function(_0x25a973){if(_0x25a973){return _0x25a973[_0xb00b('0x1d')](_0x362ee0)['then'](function(_0x231293){return _0x231293;});}return null;};}function removeEntity(_0x2896d1,_0x520444){return function(_0x3ab3cc){if(_0x3ab3cc){return _0x3ab3cc[_0xb00b('0x1e')]()['then'](function(){_0x2896d1[_0xb00b('0x16')](0xcc)[_0xb00b('0x1f')]();});}};}function handleEntityNotFound(_0x3c9500,_0x8caadf){return function(_0x520e55){if(!_0x520e55){_0x3c9500['sendStatus'](0x194);}return _0x520e55;};}function handleError(_0x3785e9,_0x490380){_0x490380=_0x490380||0x1f4;return function(_0x550587){logger['error'](_0x550587[_0xb00b('0x20')]);if(_0x550587[_0xb00b('0x21')]){delete _0x550587[_0xb00b('0x21')];}_0x3785e9[_0xb00b('0x16')](_0x490380)[_0xb00b('0x22')](_0x550587);};}exports[_0xb00b('0x23')]=function(_0x15d3b9,_0x4a8d2b){var _0x22c22d={},_0x503c9c={},_0x450129={'count':0x0,'rows':[]};var _0x348165=_[_0xb00b('0x24')](db['ScreenRecording'][_0xb00b('0x25')],function(_0x280ed3){return{'name':_0x280ed3[_0xb00b('0x26')],'type':_0x280ed3[_0xb00b('0x27')][_0xb00b('0x28')]};});_0x503c9c[_0xb00b('0x29')]=_[_0xb00b('0x2a')](_[_0xb00b('0x24')](_0x348165,_0xb00b('0x21')),['format']);_0x503c9c[_0xb00b('0x2b')]=_[_0xb00b('0x2c')](_0x15d3b9['query']);_0x503c9c[_0xb00b('0x2d')]=_[_0xb00b('0x2e')](_0x503c9c['model'],_0x503c9c[_0xb00b('0x2b')]);_0x22c22d['attributes']=_[_0xb00b('0x2e')](_0x503c9c[_0xb00b('0x29')],qs[_0xb00b('0x2f')](_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x2f')]));_0x22c22d[_0xb00b('0x30')]=_0x22c22d[_0xb00b('0x30')]['length']?_0x22c22d['attributes']:_0x503c9c['model'];if(!_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x31')](_0xb00b('0x32'))){_0x22c22d[_0xb00b('0x19')]=qs['limit'](_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x19')]);_0x22c22d[_0xb00b('0x1a')]=qs[_0xb00b('0x1a')](_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x1a')]);}_0x22c22d[_0xb00b('0x33')]=qs[_0xb00b('0x34')](_0x15d3b9['query']['sort']);_0x22c22d[_0xb00b('0x35')]=qs['filters'](_[_0xb00b('0x36')](_0x15d3b9[_0xb00b('0x2b')],_0x503c9c[_0xb00b('0x2d')]),_0x348165);if(_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x37')]){_0x22c22d[_0xb00b('0x35')]=_[_0xb00b('0x38')](_0x22c22d['where'],{'$or':_[_0xb00b('0x24')](_0x348165,function(_0x25578e){if(_0x25578e[_0xb00b('0x27')]!==_0xb00b('0x39')){var _0x2496e2={};_0x2496e2[_0x25578e[_0xb00b('0x21')]]={'$like':'%'+_0x15d3b9['query'][_0xb00b('0x37')]+'%'};return _0x2496e2;}})});}_0x22c22d=_[_0xb00b('0x38')]({},_0x22c22d,_0x15d3b9['options']);var _0x17ff34={'where':_0x22c22d[_0xb00b('0x35')]};return db[_0xb00b('0x3a')][_0xb00b('0x3b')](_0x17ff34)[_0xb00b('0x3c')](function(_0x5636b1){_0x450129[_0xb00b('0x3b')]=_0x5636b1;if(_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x3d')]){_0x22c22d[_0xb00b('0x3e')]=[{'all':!![]}];}return db['ScreenRecording']['findAll'](_0x22c22d);})[_0xb00b('0x3c')](function(_0xf6ae0c){_0x450129[_0xb00b('0x3f')]=_0xf6ae0c;return _0x450129;})[_0xb00b('0x3c')](respondWithFilteredResult(_0x4a8d2b,_0x22c22d))[_0xb00b('0x40')](handleError(_0x4a8d2b,null));};exports[_0xb00b('0x41')]=function(_0x275664,_0x493841){var _0x36200d={'raw':![],'where':{'id':_0x275664[_0xb00b('0x42')]['id']}},_0x3b72c4={};_0x3b72c4[_0xb00b('0x29')]=_[_0xb00b('0x2c')](db[_0xb00b('0x3a')][_0xb00b('0x25')]);_0x3b72c4[_0xb00b('0x2b')]=_[_0xb00b('0x2c')](_0x275664[_0xb00b('0x2b')]);_0x3b72c4[_0xb00b('0x2d')]=_[_0xb00b('0x2e')](_0x3b72c4['model'],_0x3b72c4[_0xb00b('0x2b')]);_0x36200d[_0xb00b('0x30')]=_[_0xb00b('0x2e')](_0x3b72c4[_0xb00b('0x29')],qs[_0xb00b('0x2f')](_0x275664[_0xb00b('0x2b')][_0xb00b('0x2f')]));_0x36200d[_0xb00b('0x30')]=_0x36200d[_0xb00b('0x30')][_0xb00b('0x43')]?_0x36200d[_0xb00b('0x30')]:_0x3b72c4[_0xb00b('0x29')];if(_0x275664['query']['includeAll']){_0x36200d['include']=[{'all':!![]}];}_0x36200d=_[_0xb00b('0x38')]({},_0x36200d,_0x275664[_0xb00b('0x44')]);return db['ScreenRecording'][_0xb00b('0x45')](_0x36200d)[_0xb00b('0x3c')](handleEntityNotFound(_0x493841,null))[_0xb00b('0x3c')](respondWithResult(_0x493841,null))[_0xb00b('0x40')](handleError(_0x493841,null));};exports['create']=function(_0x58e9cb,_0x172729){return db[_0xb00b('0x3a')]['create'](_0x58e9cb['body'],{})[_0xb00b('0x3c')](respondWithResult(_0x172729,0xc9))[_0xb00b('0x40')](handleError(_0x172729,null));};exports['update']=function(_0x2228e9,_0x47a814){if(_0x2228e9['body']['id']){delete _0x2228e9['body']['id'];}delete _0x2228e9[_0xb00b('0x46')]['duration'];delete _0x2228e9[_0xb00b('0x46')][_0xb00b('0x47')];delete _0x2228e9[_0xb00b('0x46')][_0xb00b('0x48')];delete _0x2228e9[_0xb00b('0x46')][_0xb00b('0x49')];return db['ScreenRecording']['find']({'where':{'id':_0x2228e9[_0xb00b('0x42')]['id']}})[_0xb00b('0x3c')](handleEntityNotFound(_0x47a814,null))['then'](saveUpdates(_0x2228e9[_0xb00b('0x46')],null))[_0xb00b('0x3c')](respondWithResult(_0x47a814,null))['catch'](handleError(_0x47a814,null));};exports[_0xb00b('0x4a')]=function(_0x10e066,_0x3b5d82){return db['ScreenRecording']['describe']()[_0xb00b('0x3c')](respondWithResult(_0x3b5d82,null))[_0xb00b('0x40')](handleError(_0x3b5d82,null));};exports[_0xb00b('0x4b')]=function(_0xde3cc1,_0x489b49,_0x380acb){var _0x3f31e5=require('../../components/encryptor');var _0x4cd9fd=![];var _0x160965={};if(_0xde3cc1['query'][_0xb00b('0x27')]&&_0xde3cc1[_0xb00b('0x2b')][_0xb00b('0x27')]===_0xb00b('0x4c')){_0x160965[_0xb00b('0x4c')]=_0xde3cc1[_0xb00b('0x42')]['id'];}else{_0x160965['id']=_0xde3cc1['params']['id'];}return db[_0xb00b('0x3a')]['find']({'where':_0x160965,'attributes':['id',_0xb00b('0x49')],'raw':!![]})[_0xb00b('0x3c')](handleEntityNotFound(_0x489b49,null))[_0xb00b('0x3c')](function(_0x5ac79e){if(_0x5ac79e){var _0x248335=path[_0xb00b('0x4d')](config[_0xb00b('0x4e')],'server/files/screen_recordings',_0x5ac79e[_0xb00b('0x49')]);var _0x309ae6=util[_0xb00b('0x4f')](_0xb00b('0x50'),_0x248335);if(fs[_0xb00b('0x51')](_0x309ae6)){_0x4cd9fd=!![];return _0x3f31e5[_0xb00b('0x52')](_0x309ae6,_0x248335,config[_0xb00b('0x53')][_0xb00b('0x54')])['then'](function(){return _0x5ac79e;});}return _0x5ac79e;}})[_0xb00b('0x3c')](function(_0x2cbe80){if(_0x2cbe80){var _0x1b4860=path['join'](config[_0xb00b('0x4e')],_0xb00b('0x55'),_0x2cbe80[_0xb00b('0x49')]);if(!fs[_0xb00b('0x51')](_0x1b4860)){throw new db[(_0xb00b('0x56'))]['ValidationError'](_0xb00b('0x57'));}if(_0x2cbe80[_0xb00b('0x58')]){return _0x489b49[_0xb00b('0x4b')](_0x1b4860,_0x2cbe80[_0xb00b('0x58')]+path['extname'](_0x1b4860),function(){if(_0x4cd9fd){fs[_0xb00b('0x59')](_0x1b4860);}});}else{return _0x489b49[_0xb00b('0x4b')](_0x1b4860,function(_0x2c93db){if(_0x4cd9fd){fs[_0xb00b('0x59')](_0x1b4860);}});}}})[_0xb00b('0x40')](function(_0x1e5ed8){if(_0x1e5ed8[_0xb00b('0x5a')]==='ScreenRecording\x20not\x20found'){_0x489b49[_0xb00b('0x16')](0x194)['send'](_0xb00b('0x5b'));}else{return handleError(_0x489b49,null);}});};exports['destroy']=function(_0x3b3272,_0x530d4a){return db[_0xb00b('0x3a')]['find']({'where':{'id':_0x3b3272[_0xb00b('0x42')]['id']}})[_0xb00b('0x3c')](function(_0x3bae02){if(_['isNil'](_0x3bae02)){throw new ReferenceError('Entity\x20not\x20found');}return _0x3bae02;})['then'](function(_0x21a53d){var _0x3126be=path[_0xb00b('0x4d')](config['root'],_0xb00b('0x55'),_0x21a53d[_0xb00b('0x49')]);logger[_0xb00b('0x5c')](_0xb00b('0x5d'),_0x3126be);if(!_[_0xb00b('0x5e')](_0x21a53d['value'])&&fs[_0xb00b('0x51')](_0x3126be)){logger[_0xb00b('0x5c')]('File:\x20\x22'+_0x3126be+_0xb00b('0x5f'));fs[_0xb00b('0x60')](_0x3126be);}_0x3126be=_0x3126be+_0xb00b('0x61');if(!_['isNil'](_0x21a53d['value'])&&fs[_0xb00b('0x51')](_0x3126be)){logger[_0xb00b('0x5c')](_0xb00b('0x62')+_0x3126be+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x3126be);}return _0x21a53d;})['then'](function(_0x5e9677){if(!_0x5e9677)throw new InternalError();return _0x5e9677[_0xb00b('0x1e')]();})['then'](function(){_0x530d4a[_0xb00b('0x16')](0xcc)[_0xb00b('0x1f')]();})['catch'](handleError(_0x530d4a,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index df83d9e..1b9970e 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 _0x16f2=['../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','api','request-promise','path','rimraf'];(function(_0x79cd47,_0x16102d){var _0x3b9484=function(_0x23db95){while(--_0x23db95){_0x79cd47['push'](_0x79cd47['shift']());}};_0x3b9484(++_0x16102d);}(_0x16f2,0xcd));var _0x216f=function(_0x3eb620,_0x37511b){_0x3eb620=_0x3eb620-0x0;var _0x4b89ab=_0x16f2[_0x3eb620];return _0x4b89ab;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x216f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x216f('0x1'));var fs=require('fs');var path=require(_0x216f('0x2'));var rimraf=require(_0x216f('0x3'));var config=require(_0x216f('0x4'));var attributes=require(_0x216f('0x5'));module[_0x216f('0x6')]=function(_0x36a1c3,_0x3e3b98){return _0x36a1c3[_0x216f('0x7')](_0x216f('0x8'),attributes,{'tableName':_0x216f('0x9'),'paranoid':![],'indexes':[{'name':_0x216f('0xa'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x744f=['util','api','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid'];(function(_0x285969,_0x1587e0){var _0x2f3221=function(_0x412523){while(--_0x412523){_0x285969['push'](_0x285969['shift']());}};_0x2f3221(++_0x1587e0);}(_0x744f,0x1b0));var _0xf744=function(_0xb24739,_0xef4023){_0xb24739=_0xb24739-0x0;var _0x4202db=_0x744f[_0xb24739];return _0x4202db;};'use strict';var _=require('lodash');var util=require(_0xf744('0x0'));var logger=require('../../config/logger')(_0xf744('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf744('0x2'));var fs=require('fs');var path=require(_0xf744('0x3'));var rimraf=require(_0xf744('0x4'));var config=require(_0xf744('0x5'));var attributes=require(_0xf744('0x6'));module[_0xf744('0x7')]=function(_0x33a667,_0x19e19d){return _0x33a667[_0xf744('0x8')](_0xf744('0x9'),attributes,{'tableName':_0xf744('0xa'),'paranoid':![],'indexes':[{'name':_0xf744('0xb'),'fields':[_0xf744('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index a1cca0c..ed31c09 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 _0xd306=['error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3308c7,_0x28852e){var _0x5dcde9=function(_0x5f18a6){while(--_0x5f18a6){_0x3308c7['push'](_0x3308c7['shift']());}};_0x5dcde9(++_0x28852e);}(_0xd306,0xd4));var _0x6d30=function(_0x1c11a1,_0xc8f651){_0x1c11a1=_0x1c11a1-0x0;var _0xb0d216=_0xd306[_0x1c11a1];return _0xb0d216;};'use strict';var _=require(_0x6d30('0x0'));var util=require(_0x6d30('0x1'));var moment=require(_0x6d30('0x2'));var BPromise=require('bluebird');var rs=require(_0x6d30('0x3'));var fs=require('fs');var Redis=require(_0x6d30('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6d30('0x5'));var logger=require(_0x6d30('0x6'))(_0x6d30('0x7'));var config=require(_0x6d30('0x8'));var jayson=require(_0x6d30('0x9'));var client=jayson[_0x6d30('0xa')][_0x6d30('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x10c5d3,_0x2caff9,_0x213fec){return new BPromise(function(_0xd9507,_0x2d0e79){return client['request'](_0x10c5d3,_0x213fec)[_0x6d30('0xc')](function(_0x1cfe48){logger[_0x6d30('0xd')](_0x6d30('0xe'),_0x2caff9,_0x6d30('0xf'));logger['debug'](_0x6d30('0x10'),_0x2caff9,_0x6d30('0xf'),JSON[_0x6d30('0x11')](_0x1cfe48));if(_0x1cfe48[_0x6d30('0x12')]){if(_0x1cfe48[_0x6d30('0x12')][_0x6d30('0x13')]===0x1f4){logger['error'](_0x6d30('0xe'),_0x2caff9,_0x1cfe48[_0x6d30('0x12')][_0x6d30('0x14')]);return _0x2d0e79(_0x1cfe48[_0x6d30('0x12')][_0x6d30('0x14')]);}logger[_0x6d30('0x12')](_0x6d30('0xe'),_0x2caff9,_0x1cfe48[_0x6d30('0x12')]['message']);return _0xd9507(_0x1cfe48[_0x6d30('0x12')][_0x6d30('0x14')]);}else{logger[_0x6d30('0xd')](_0x6d30('0xe'),_0x2caff9,_0x6d30('0xf'));_0xd9507(_0x1cfe48[_0x6d30('0x15')][_0x6d30('0x14')]);}})[_0x6d30('0x16')](function(_0x327b47){logger[_0x6d30('0x12')]('ScreenRecording,\x20%s,\x20%s',_0x2caff9,_0x327b47);_0x2d0e79(_0x327b47);});});} \ No newline at end of file +var _0x84bc=['info','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x84bc,0x15c));var _0xc84b=function(_0x78e63b,_0x5161a4){_0x78e63b=_0x78e63b-0x0;var _0x3ca19a=_0x84bc[_0x78e63b];return _0x3ca19a;};'use strict';var _=require(_0xc84b('0x0'));var util=require('util');var moment=require(_0xc84b('0x1'));var BPromise=require(_0xc84b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc84b('0x3'));var db=require(_0xc84b('0x4'))['db'];var utils=require(_0xc84b('0x5'));var logger=require(_0xc84b('0x6'))(_0xc84b('0x7'));var config=require(_0xc84b('0x8'));var jayson=require(_0xc84b('0x9'));var client=jayson['client'][_0xc84b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x26b7d6,_0x1f98eb,_0x35227c){return new BPromise(function(_0x119ce6,_0x1366c1){return client[_0xc84b('0xb')](_0x26b7d6,_0x35227c)[_0xc84b('0xc')](function(_0x1aa8b2){logger['info'](_0xc84b('0xd'),_0x1f98eb,_0xc84b('0xe'));logger[_0xc84b('0xf')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x1f98eb,_0xc84b('0xe'),JSON[_0xc84b('0x10')](_0x1aa8b2));if(_0x1aa8b2['error']){if(_0x1aa8b2[_0xc84b('0x11')][_0xc84b('0x12')]===0x1f4){logger[_0xc84b('0x11')]('ScreenRecording,\x20%s,\x20%s',_0x1f98eb,_0x1aa8b2[_0xc84b('0x11')][_0xc84b('0x13')]);return _0x1366c1(_0x1aa8b2[_0xc84b('0x11')]['message']);}logger['error']('ScreenRecording,\x20%s,\x20%s',_0x1f98eb,_0x1aa8b2['error']['message']);return _0x119ce6(_0x1aa8b2[_0xc84b('0x11')][_0xc84b('0x13')]);}else{logger[_0xc84b('0x14')](_0xc84b('0xd'),_0x1f98eb,_0xc84b('0xe'));_0x119ce6(_0x1aa8b2[_0xc84b('0x15')][_0xc84b('0x13')]);}})[_0xc84b('0x16')](function(_0x472a50){logger[_0xc84b('0x11')](_0xc84b('0xd'),_0x1f98eb,_0x472a50);_0x1366c1(_0x472a50);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 148e7a7..3673f9d 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 _0x0294=['index','/now','getDate','/:id','show','/:id/logo','/:id/logo_login','getLogoLogin','gdpr','/:id/preferred','getPreferred','/:id/favicon','join','root','server/files/images/logos/','format','%s%s','extname','post','single','file','addLogo','diskStorage','originalname','addLogoLogin','addPreferred','favicon','addFavicon','put','update','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated'];(function(_0xa35870,_0x47f7b9){var _0xcddd0b=function(_0x2192e7){while(--_0x2192e7){_0xa35870['push'](_0xa35870['shift']());}};_0xcddd0b(++_0x47f7b9);}(_0x0294,0xf1));var _0x4029=function(_0x22df9f,_0x9ec477){_0x22df9f=_0x22df9f-0x0;var _0x4ed906=_0x0294[_0x22df9f];return _0x4ed906;};'use strict';var multer=require(_0x4029('0x0'));var util=require(_0x4029('0x1'));var path=require(_0x4029('0x2'));var timeout=require('connect-timeout');var express=require(_0x4029('0x3'));var router=express['Router']();var fs_extra=require(_0x4029('0x4'));var auth=require(_0x4029('0x5'));var interaction=require(_0x4029('0x6'));var config=require(_0x4029('0x7'));var controller=require(_0x4029('0x8'));router[_0x4029('0x9')]('/',auth[_0x4029('0xa')](),controller[_0x4029('0xb')]);router[_0x4029('0x9')](_0x4029('0xc'),controller[_0x4029('0xd')]);router['get'](_0x4029('0xe'),controller[_0x4029('0xf')]);router[_0x4029('0x9')](_0x4029('0x10'),controller['getLogo']);router[_0x4029('0x9')](_0x4029('0x11'),controller[_0x4029('0x12')]);router[_0x4029('0x9')]('/:id/gdpr',controller[_0x4029('0x13')]);router['get'](_0x4029('0x14'),controller[_0x4029('0x15')]);router[_0x4029('0x9')](_0x4029('0x16'),controller['getFavicon']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4db332,_0x56b750,_0x2cf870){_0x2cf870(null,path[_0x4029('0x17')](config[_0x4029('0x18')],_0x4029('0x19')));},'filename':function(_0x2471f2,_0x4cca2e,_0x556761){_0x556761(null,util[_0x4029('0x1a')](_0x4029('0x1b'),'logo',path[_0x4029('0x1c')](_0x4cca2e['originalname'])));}})});router[_0x4029('0x1d')](_0x4029('0x10'),upload[_0x4029('0x1e')](_0x4029('0x1f')),controller[_0x4029('0x20')]);var upload=multer({'storage':multer[_0x4029('0x21')]({'destination':function(_0x2a08fe,_0xeb6265,_0x26cccc){_0x26cccc(null,path[_0x4029('0x17')](config[_0x4029('0x18')],_0x4029('0x19')));},'filename':function(_0x5a0d49,_0x42f981,_0x5e140d){_0x5e140d(null,util[_0x4029('0x1a')](_0x4029('0x1b'),'logologin',path['extname'](_0x42f981[_0x4029('0x22')])));}})});router[_0x4029('0x1d')](_0x4029('0x11'),upload[_0x4029('0x1e')]('file'),controller[_0x4029('0x23')]);var upload=multer({'storage':multer[_0x4029('0x21')]({'destination':function(_0x49862c,_0x46af86,_0x55267c){_0x55267c(null,path[_0x4029('0x17')](config[_0x4029('0x18')],_0x4029('0x19')));},'filename':function(_0x2ce95a,_0x9e963e,_0x3154f8){_0x3154f8(null,util[_0x4029('0x1a')](_0x4029('0x1b'),'preferred',path['extname'](_0x9e963e[_0x4029('0x22')])));}})});router[_0x4029('0x1d')](_0x4029('0x14'),upload[_0x4029('0x1e')](_0x4029('0x1f')),controller[_0x4029('0x24')]);var upload=multer({'storage':multer[_0x4029('0x21')]({'destination':function(_0x74cd7d,_0x55ec3d,_0x3d3e12){_0x3d3e12(null,path[_0x4029('0x17')](config[_0x4029('0x18')],_0x4029('0x19')));},'filename':function(_0x2e7932,_0x11a1a4,_0x5aaa8d){_0x5aaa8d(null,util[_0x4029('0x1a')](_0x4029('0x1b'),_0x4029('0x25'),path[_0x4029('0x1c')](_0x11a1a4['originalname'])));}})});router[_0x4029('0x1d')](_0x4029('0x16'),upload['single'](_0x4029('0x1f')),controller[_0x4029('0x26')]);router[_0x4029('0x27')](_0x4029('0xe'),auth['isAuthenticated'](),controller[_0x4029('0x28')]);module[_0x4029('0x29')]=router; \ No newline at end of file +var _0x1671=['extname','post','single','file','addLogo','diskStorage','format','%s%s','logologin','originalname','addLogoLogin','join','preferred','/:id/preferred','addPreferred','favicon','addFavicon','put','update','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/now','getDate','/:id','show','getLogoLogin','/:id/gdpr','getPreferred','/:id/favicon','root','server/files/images/logos/'];(function(_0x157f9e,_0xebb98b){var _0x8331ce=function(_0x395b61){while(--_0x395b61){_0x157f9e['push'](_0x157f9e['shift']());}};_0x8331ce(++_0xebb98b);}(_0x1671,0x15b));var _0x1167=function(_0x2d7b5a,_0x2f7491){_0x2d7b5a=_0x2d7b5a-0x0;var _0x4fa9fc=_0x1671[_0x2d7b5a];return _0x4fa9fc;};'use strict';var multer=require(_0x1167('0x0'));var util=require(_0x1167('0x1'));var path=require(_0x1167('0x2'));var timeout=require('connect-timeout');var express=require(_0x1167('0x3'));var router=express[_0x1167('0x4')]();var fs_extra=require(_0x1167('0x5'));var auth=require(_0x1167('0x6'));var interaction=require(_0x1167('0x7'));var config=require(_0x1167('0x8'));var controller=require('./setting.controller');router[_0x1167('0x9')]('/',auth[_0x1167('0xa')](),controller[_0x1167('0xb')]);router['get'](_0x1167('0xc'),controller[_0x1167('0xd')]);router[_0x1167('0x9')](_0x1167('0xe'),controller[_0x1167('0xf')]);router[_0x1167('0x9')]('/:id/logo',controller['getLogo']);router[_0x1167('0x9')]('/:id/logo_login',controller[_0x1167('0x10')]);router['get'](_0x1167('0x11'),controller['gdpr']);router['get']('/:id/preferred',controller[_0x1167('0x12')]);router[_0x1167('0x9')](_0x1167('0x13'),controller['getFavicon']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x183c2d,_0x3a4984,_0x4a1f84){_0x4a1f84(null,path['join'](config[_0x1167('0x14')],_0x1167('0x15')));},'filename':function(_0x1b51ad,_0x5d0158,_0x946fea){_0x946fea(null,util['format']('%s%s','logo',path[_0x1167('0x16')](_0x5d0158['originalname'])));}})});router[_0x1167('0x17')]('/:id/logo',upload[_0x1167('0x18')](_0x1167('0x19')),controller[_0x1167('0x1a')]);var upload=multer({'storage':multer[_0x1167('0x1b')]({'destination':function(_0x49f2d9,_0x5f011e,_0x3bc24f){_0x3bc24f(null,path['join'](config[_0x1167('0x14')],_0x1167('0x15')));},'filename':function(_0x506664,_0x38970b,_0x3045a7){_0x3045a7(null,util[_0x1167('0x1c')](_0x1167('0x1d'),_0x1167('0x1e'),path['extname'](_0x38970b[_0x1167('0x1f')])));}})});router[_0x1167('0x17')]('/:id/logo_login',upload['single'](_0x1167('0x19')),controller[_0x1167('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x154252,_0x94d45f,_0xb44c0c){_0xb44c0c(null,path[_0x1167('0x21')](config[_0x1167('0x14')],_0x1167('0x15')));},'filename':function(_0x6de5c2,_0x538e9c,_0x5b6f53){_0x5b6f53(null,util[_0x1167('0x1c')](_0x1167('0x1d'),_0x1167('0x22'),path[_0x1167('0x16')](_0x538e9c[_0x1167('0x1f')])));}})});router[_0x1167('0x17')](_0x1167('0x23'),upload[_0x1167('0x18')](_0x1167('0x19')),controller[_0x1167('0x24')]);var upload=multer({'storage':multer[_0x1167('0x1b')]({'destination':function(_0x596a12,_0x108dab,_0x32f44c){_0x32f44c(null,path['join'](config['root'],_0x1167('0x15')));},'filename':function(_0x3c708b,_0x45922b,_0x2d5d92){_0x2d5d92(null,util[_0x1167('0x1c')](_0x1167('0x1d'),_0x1167('0x25'),path[_0x1167('0x16')](_0x45922b['originalname'])));}})});router[_0x1167('0x17')](_0x1167('0x13'),upload['single'](_0x1167('0x19')),controller[_0x1167('0x26')]);router[_0x1167('0x27')]('/:id',auth[_0x1167('0xa')](),controller[_0x1167('0x28')]);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 91c7597..cdffd67 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 _0xcce0=['UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','alternate'];(function(_0x3199d1,_0xbaf02b){var _0x4cb325=function(_0x278e05){while(--_0x278e05){_0x3199d1['push'](_0x3199d1['shift']());}};_0x4cb325(++_0xbaf02b);}(_0xcce0,0x10f));var _0x0cce=function(_0x329448,_0x263ee4){_0x329448=_0x329448-0x0;var _0x23d3fa=_0xcce0[_0x329448];return _0x23d3fa;};'use strict';var Sequelize=require(_0x0cce('0x0'));module[_0x0cce('0x1')]={'min_internal':{'type':Sequelize[_0x0cce('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x0cce('0x2')](0xb),'unique':_0x0cce('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x0cce('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0cce('0x4')],'defaultValue':_0x0cce('0x5')},'logo':{'type':Sequelize[_0x0cce('0x4')]},'defaultLogo':{'type':Sequelize[_0x0cce('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0x0cce('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0cce('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0cce('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0cce('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x0cce('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x0cce('0x4')]},'turnaddr':{'type':Sequelize[_0x0cce('0x4')]},'turnusername':{'type':Sequelize[_0x0cce('0x4')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0cce('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0cce('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0cce('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0cce('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0cce('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0cce('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x0cce('0x6')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x0cce('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0cce('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0cce('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x0cce('0x7')},'chatTimeout':{'type':Sequelize[_0x0cce('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0cce('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x0cce('0x4')]},'defaultPreferred':{'type':Sequelize[_0x0cce('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0cce('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0cce('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0cce('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0cce('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0cce('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x0cce('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0cce('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0cce('0x4')]},'sentiment':{'type':Sequelize[_0x0cce('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x0cce('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0cce('0x2')]},'sentimentRegion':{'type':Sequelize[_0x0cce('0x4')]},'language':{'type':Sequelize[_0x0cce('0x4')]},'bucket':{'type':Sequelize[_0x0cce('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0cce('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0cce('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x0cce('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0cce('0x2')](0x2)[_0x0cce('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0cce('0x2')](0x2)[_0x0cce('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0cce('0x2')](0x2)[_0x0cce('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0cce('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0cce('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x0cce('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x0cce('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x0cce('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0cce('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0cce('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0xe372=['INTEGER','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','alternate','UNSIGNED','sequelize','min_internal','min_mailbox'];(function(_0x4b0918,_0x5a1e91){var _0x4cd07a=function(_0x240844){while(--_0x240844){_0x4b0918['push'](_0x4b0918['shift']());}};_0x4cd07a(++_0x5a1e91);}(_0xe372,0x12f));var _0x2e37=function(_0x23215b,_0x29e0a8){_0x23215b=_0x23215b-0x0;var _0x197c85=_0xe372[_0x23215b];return _0x197c85;};'use strict';var Sequelize=require(_0x2e37('0x0'));module['exports']={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0x2e37('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x2e37('0x2'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x2e37('0x3')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x2e37('0x4')],'defaultValue':_0x2e37('0x5')},'logo':{'type':Sequelize[_0x2e37('0x4')]},'defaultLogo':{'type':Sequelize[_0x2e37('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x2e37('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x2e37('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x2e37('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x2e37('0x4')]},'turnaddr':{'type':Sequelize[_0x2e37('0x4')]},'turnusername':{'type':Sequelize[_0x2e37('0x4')]},'turnpassword':{'type':Sequelize[_0x2e37('0x4')]},'pageTitle':{'type':Sequelize[_0x2e37('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x2e37('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x2e37('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x2e37('0x3')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x2e37('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x2e37('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x2e37('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x2e37('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x2e37('0x3')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x2e37('0x3')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x2e37('0x3')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x2e37('0x7')},'chatTimeout':{'type':Sequelize[_0x2e37('0x3')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x2e37('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x2e37('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x2e37('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x2e37('0x3')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x2e37('0x3')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x2e37('0x4')]},'defaultFavicon':{'type':Sequelize[_0x2e37('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x2e37('0x3')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x2e37('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x2e37('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x2e37('0x3')]},'transcribeRegion':{'type':Sequelize[_0x2e37('0x4')]},'sentiment':{'type':Sequelize[_0x2e37('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x2e37('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x2e37('0x4')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x2e37('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x2e37('0x3')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)[_0x2e37('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x2e37('0x3')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)[_0x2e37('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x2e37('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x2e37('0x3')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x2e37('0x3')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x2e37('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 35ac81f..b54f5bb 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 _0x0214=['../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s','message','info','result','catch','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','destroy','sendStatus','stack','name','send','index','map','Setting','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','rows','show','params','length','includeAll','include','body','find','addLogo','filename','logo','file','loginLogo','server/files/images/logos','getLicense','preferred','defaultLogo','defaultLoginLogo','defaultPreferred','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','\x20not\x20found','download','getLogoLogin','favicon','defaultFavicon','default_loginLogo.svg','ValidationError','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','Sequelize','getFavicon','getDate','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x121c15,_0xdda36){var _0x4fbc0c=function(_0x5e5e51){while(--_0x5e5e51){_0x121c15['push'](_0x121c15['shift']());}};_0x4fbc0c(++_0xdda36);}(_0x0214,0x15f));var _0x4021=function(_0x11c4f2,_0x5dd7a1){_0x11c4f2=_0x11c4f2-0x0;var _0x3b2c0b=_0x0214[_0x11c4f2];return _0x3b2c0b;};'use strict';var emlformat=require(_0x4021('0x0'));var rimraf=require(_0x4021('0x1'));var zipdir=require(_0x4021('0x2'));var jsonpatch=require(_0x4021('0x3'));var rp=require(_0x4021('0x4'));var moment=require(_0x4021('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4021('0x6'));var util=require(_0x4021('0x7'));var path=require(_0x4021('0x8'));var sox=require(_0x4021('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4021('0xa'));var _=require('lodash');var squel=require(_0x4021('0xb'));var crypto=require('crypto');var jsforce=require(_0x4021('0xc'));var deskjs=require(_0x4021('0xd'));var toCsv=require(_0x4021('0xe'));var querystring=require(_0x4021('0xf'));var Papa=require(_0x4021('0x10'));var Redis=require(_0x4021('0x11'));var authService=require(_0x4021('0x12'));var qs=require(_0x4021('0x13'));var as=require(_0x4021('0x14'));var hardwareService=require(_0x4021('0x15'));var logger=require(_0x4021('0x16'))('api');var utils=require(_0x4021('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4021('0x18'));var db=require(_0x4021('0x19'))['db'];var jayson=require(_0x4021('0x1a'));var client=jayson[_0x4021('0x1b')][_0x4021('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x528da0,_0x23a8db,_0xb14c45,_0x2f64c8){return new BPromise(function(_0x270fde,_0x3d6c7a){var _0x53db2b=_0x2f64c8||client;return _0x53db2b[_0x4021('0x1d')](_0x528da0,_0xb14c45)[_0x4021('0x1e')](function(_0x40a7f0){logger['info']('Setting,\x20%s,\x20%s',_0x23a8db,_0x4021('0x1f'));logger[_0x4021('0x20')](_0x4021('0x21'),_0x23a8db,_0x4021('0x1f'),JSON[_0x4021('0x22')](_0x40a7f0));if(_0x40a7f0[_0x4021('0x23')]){if(_0x40a7f0['error'][_0x4021('0x24')]===0x1f4){logger[_0x4021('0x23')](_0x4021('0x25'),_0x23a8db,_0x40a7f0['error'][_0x4021('0x26')]);return _0x3d6c7a(_0x40a7f0[_0x4021('0x23')][_0x4021('0x26')]);}logger[_0x4021('0x23')](_0x4021('0x25'),_0x23a8db,_0x40a7f0[_0x4021('0x23')][_0x4021('0x26')]);return _0x270fde(_0x40a7f0['error']['message']);}else{logger[_0x4021('0x27')](_0x4021('0x25'),_0x23a8db,_0x4021('0x1f'));_0x270fde(_0x40a7f0[_0x4021('0x28')][_0x4021('0x26')]);}})[_0x4021('0x29')](function(_0x131153){logger['error'](_0x4021('0x25'),_0x23a8db,_0x131153);_0x3d6c7a(_0x131153);});});}function respondWithStatusCode(_0xf6a52b,_0x5ebb3d){_0x5ebb3d=_0x5ebb3d||0xcc;return function(_0x3e2821){if(_0x3e2821){return _0xf6a52b['sendStatus'](_0x5ebb3d);}return _0xf6a52b[_0x4021('0x2a')](_0x5ebb3d)[_0x4021('0x2b')]();};}function respondWithResult(_0x317387,_0x52eb02){_0x52eb02=_0x52eb02||0xc8;return function(_0x326daa){if(_0x326daa){return _0x317387[_0x4021('0x2a')](_0x52eb02)[_0x4021('0x2c')](_0x326daa);}};}function respondWithFilteredResult(_0x227f44,_0x5a6dfb){return function(_0x1887af){if(_0x1887af){var _0x48f5de=typeof _0x5a6dfb[_0x4021('0x2d')]===_0x4021('0x2e')&&typeof _0x5a6dfb['limit']===_0x4021('0x2e');var _0x40a558=_0x1887af[_0x4021('0x2f')];var _0x25cbd4=_0x48f5de?0x0:_0x5a6dfb['offset'];var _0x5b6976=_0x48f5de?_0x1887af[_0x4021('0x2f')]:_0x5a6dfb[_0x4021('0x2d')]+_0x5a6dfb[_0x4021('0x30')];var _0x48a72e;if(_0x5b6976>=_0x40a558){_0x5b6976=_0x40a558;_0x48a72e=0xc8;}else{_0x48a72e=0xce;}_0x227f44[_0x4021('0x2a')](_0x48a72e);return _0x227f44[_0x4021('0x31')](_0x4021('0x32'),_0x25cbd4+'-'+_0x5b6976+'/'+_0x40a558)[_0x4021('0x2c')](_0x1887af);}return null;};}function patchUpdates(_0x54930a){return function(_0x2beb90){try{jsonpatch[_0x4021('0x33')](_0x2beb90,_0x54930a,!![]);}catch(_0x36ba96){return BPromise[_0x4021('0x34')](_0x36ba96);}return _0x2beb90['save']();};}function saveUpdates(_0x2fe0cb,_0x224ad9){return function(_0x2110b0){if(_0x2110b0){return _0x2110b0[_0x4021('0x35')](_0x2fe0cb)['then'](function(_0x282e09){return _0x282e09;});}return null;};}function removeEntity(_0x506132,_0x3016f5){return function(_0x4f6e6d){if(_0x4f6e6d){return _0x4f6e6d[_0x4021('0x36')]()[_0x4021('0x1e')](function(){_0x506132[_0x4021('0x2a')](0xcc)[_0x4021('0x2b')]();});}};}function handleEntityNotFound(_0x147a00,_0x3f7d75){return function(_0x1ee6f4){if(!_0x1ee6f4){_0x147a00[_0x4021('0x37')](0x194);}return _0x1ee6f4;};}function handleError(_0x52cb3f,_0x5e08d0){_0x5e08d0=_0x5e08d0||0x1f4;return function(_0x4648fc){logger[_0x4021('0x23')](_0x4648fc[_0x4021('0x38')]);if(_0x4648fc[_0x4021('0x39')]){delete _0x4648fc['name'];}_0x52cb3f['status'](_0x5e08d0)[_0x4021('0x3a')](_0x4648fc);};}exports[_0x4021('0x3b')]=function(_0x116f79,_0xdd1f96){var _0x6fd82d={},_0xbc9cd={},_0x40cf7f={'count':0x0,'rows':[]};var _0x30ff43=_[_0x4021('0x3c')](db[_0x4021('0x3d')][_0x4021('0x3e')],function(_0x111ab0){return{'name':_0x111ab0[_0x4021('0x3f')],'type':_0x111ab0[_0x4021('0x40')]['key']};});_0xbc9cd[_0x4021('0x41')]=_[_0x4021('0x3c')](_0x30ff43,_0x4021('0x39'));_0xbc9cd[_0x4021('0x42')]=_[_0x4021('0x43')](_0x116f79['query']);_0xbc9cd['filters']=_[_0x4021('0x44')](_0xbc9cd[_0x4021('0x41')],_0xbc9cd[_0x4021('0x42')]);_0x6fd82d[_0x4021('0x45')]=_[_0x4021('0x44')](_0xbc9cd[_0x4021('0x41')],qs[_0x4021('0x46')](_0x116f79[_0x4021('0x42')][_0x4021('0x46')]));_0x6fd82d[_0x4021('0x45')]=_0x6fd82d['attributes']['length']?_0x6fd82d['attributes']:_0xbc9cd[_0x4021('0x41')];if(!_0x116f79[_0x4021('0x42')][_0x4021('0x47')](_0x4021('0x48'))){_0x6fd82d[_0x4021('0x30')]=qs[_0x4021('0x30')](_0x116f79[_0x4021('0x42')][_0x4021('0x30')]);_0x6fd82d[_0x4021('0x2d')]=qs[_0x4021('0x2d')](_0x116f79[_0x4021('0x42')][_0x4021('0x2d')]);}_0x6fd82d['order']=qs[_0x4021('0x49')](_0x116f79[_0x4021('0x42')][_0x4021('0x49')]);_0x6fd82d[_0x4021('0x4a')]=qs[_0x4021('0x4b')](_[_0x4021('0x4c')](_0x116f79[_0x4021('0x42')],_0xbc9cd[_0x4021('0x4b')]),_0x30ff43);if(_0x116f79[_0x4021('0x42')][_0x4021('0x4d')]){_0x6fd82d[_0x4021('0x4a')]=_[_0x4021('0x4e')](_0x6fd82d['where'],{'$or':_[_0x4021('0x3c')](_0x30ff43,function(_0x2ce29f){if(_0x2ce29f[_0x4021('0x40')]!==_0x4021('0x4f')){var _0x2b2af2={};_0x2b2af2[_0x2ce29f[_0x4021('0x39')]]={'$like':'%'+_0x116f79[_0x4021('0x42')][_0x4021('0x4d')]+'%'};return _0x2b2af2;}})});}_0x6fd82d=_[_0x4021('0x4e')]({},_0x6fd82d,_0x116f79['options']);var _0x331c0d={'where':_0x6fd82d['where']};return db[_0x4021('0x3d')]['count'](_0x331c0d)[_0x4021('0x1e')](function(_0x4abaa){_0x40cf7f[_0x4021('0x2f')]=_0x4abaa;if(_0x116f79[_0x4021('0x42')]['includeAll']){_0x6fd82d['include']=[{'all':!![]}];}return db[_0x4021('0x3d')]['findAll'](_0x6fd82d);})[_0x4021('0x1e')](function(_0x54fdca){_0x40cf7f[_0x4021('0x50')]=_0x54fdca;return _0x40cf7f;})['then'](respondWithFilteredResult(_0xdd1f96,_0x6fd82d))[_0x4021('0x29')](handleError(_0xdd1f96,null));};exports[_0x4021('0x51')]=function(_0x2c1dfd,_0x48ef8d){var _0x367682={'raw':![],'where':{'id':_0x2c1dfd[_0x4021('0x52')]['id']}},_0xd27f9={};_0xd27f9[_0x4021('0x41')]=_[_0x4021('0x43')](db[_0x4021('0x3d')][_0x4021('0x3e')]);_0xd27f9[_0x4021('0x42')]=_[_0x4021('0x43')](_0x2c1dfd['query']);_0xd27f9[_0x4021('0x4b')]=_['intersection'](_0xd27f9['model'],_0xd27f9[_0x4021('0x42')]);_0x367682[_0x4021('0x45')]=_[_0x4021('0x44')](_0xd27f9[_0x4021('0x41')],qs[_0x4021('0x46')](_0x2c1dfd['query'][_0x4021('0x46')]));_0x367682[_0x4021('0x45')]=_0x367682[_0x4021('0x45')][_0x4021('0x53')]?_0x367682[_0x4021('0x45')]:_0xd27f9[_0x4021('0x41')];if(_0x2c1dfd[_0x4021('0x42')][_0x4021('0x54')]){_0x367682[_0x4021('0x55')]=[{'all':!![]}];}_0x367682=_[_0x4021('0x4e')]({},_0x367682,_0x2c1dfd['options']);return db[_0x4021('0x3d')]['find'](_0x367682)[_0x4021('0x1e')](handleEntityNotFound(_0x48ef8d,null))[_0x4021('0x1e')](respondWithResult(_0x48ef8d,null))[_0x4021('0x29')](handleError(_0x48ef8d,null));};exports[_0x4021('0x35')]=function(_0x22a81e,_0x5bb324){if(_0x22a81e[_0x4021('0x56')]['id']){delete _0x22a81e[_0x4021('0x56')]['id'];}return db[_0x4021('0x3d')][_0x4021('0x57')]({'where':{'id':_0x22a81e[_0x4021('0x52')]['id']}})[_0x4021('0x1e')](handleEntityNotFound(_0x5bb324,null))[_0x4021('0x1e')](saveUpdates(_0x22a81e[_0x4021('0x56')],null))[_0x4021('0x1e')](respondWithResult(_0x5bb324,null))[_0x4021('0x29')](handleError(_0x5bb324,null));};exports[_0x4021('0x58')]=function(_0xf149be,_0x32e092,_0x304021){if(_0xf149be['file']&&_0xf149be['file'][_0x4021('0x59')]){_0xf149be[_0x4021('0x56')][_0x4021('0x5a')]=_0xf149be[_0x4021('0x5b')]['filename'];}return db['Setting']['find']({'where':{'id':_0xf149be[_0x4021('0x52')]['id']}})[_0x4021('0x1e')](handleEntityNotFound(_0x32e092,null))[_0x4021('0x1e')](saveUpdates(_0xf149be[_0x4021('0x56')],null))['then'](respondWithResult(_0x32e092,null))[_0x4021('0x29')](handleError(_0x32e092,null));};exports['addLogoLogin']=function(_0x4e243f,_0x1f5e7d,_0x54d095){if(_0x4e243f[_0x4021('0x5b')]&&_0x4e243f[_0x4021('0x5b')]['filename']){_0x4e243f['body'][_0x4021('0x5c')]=_0x4e243f[_0x4021('0x5b')][_0x4021('0x59')];}return db['Setting'][_0x4021('0x57')]({'where':{'id':_0x4e243f[_0x4021('0x52')]['id']}})[_0x4021('0x1e')](handleEntityNotFound(_0x1f5e7d,null))[_0x4021('0x1e')](saveUpdates(_0x4e243f[_0x4021('0x56')],null))[_0x4021('0x1e')](respondWithResult(_0x1f5e7d,null))[_0x4021('0x29')](handleError(_0x1f5e7d,null));};var utilLicense=require(_0x4021('0x18'));exports['getLogo']=function(_0x3783ba,_0x4c7f33,_0x4870a7){var _0x2d3b60=_0x4021('0x5d');var _0x1b9c7f={'custom':![]};return utilLicense[_0x4021('0x5e')]()[_0x4021('0x1e')](function(_0x30b727){if(_0x30b727){_0x1b9c7f=_0x30b727;}return db[_0x4021('0x3d')][_0x4021('0x57')]({'where':{'id':_0x3783ba[_0x4021('0x52')]['id']},'attributes':[_0x4021('0x5a'),'loginLogo',_0x4021('0x5f'),'favicon',_0x4021('0x60'),_0x4021('0x61'),_0x4021('0x62'),'defaultFavicon'],'raw':!![]});})[_0x4021('0x1e')](handleEntityNotFound(_0x4c7f33,null))[_0x4021('0x1e')](function(_0x1781f2){if(_0x1781f2){var _0x19898a=_0x1781f2['logo']&&fs[_0x4021('0x63')](path[_0x4021('0x64')](config[_0x4021('0x65')],_0x2d3b60,_[_0x4021('0x66')](_0x1781f2[_0x4021('0x5a')])))?path[_0x4021('0x64')](config[_0x4021('0x65')],_0x2d3b60,_[_0x4021('0x66')](_0x1781f2[_0x4021('0x5a')])):path[_0x4021('0x64')](config[_0x4021('0x65')],_0x2d3b60,_['toLower'](_0x4021('0x67')));var _0x1331ca=_0x4021('0x68')+_[_0x4021('0x69')](_0x4021('0x5a'));if(_0x1781f2[_0x1331ca]||!_0x1b9c7f[_0x4021('0x6a')]){_0x19898a=path[_0x4021('0x64')](config[_0x4021('0x65')],_0x2d3b60,_[_0x4021('0x66')]('default_logo.svg'));}if(!fs[_0x4021('0x63')](_0x19898a)){throw new db['Sequelize']['ValidationError'](_['upperFirst'](_0x4021('0x5a'))+_0x4021('0x6b'));}return _0x4c7f33[_0x4021('0x6c')](_0x19898a);}})[_0x4021('0x29')](handleError(_0x4c7f33,null));};var utilLicense=require('../../config/license/util');exports[_0x4021('0x6d')]=function(_0x5905c1,_0x24a44a,_0xff732d){var _0x1e43c0=_0x4021('0x5d');var _0x374048={'custom':![]};return utilLicense[_0x4021('0x5e')]()[_0x4021('0x1e')](function(_0x541342){if(_0x541342){_0x374048=_0x541342;}return db['Setting'][_0x4021('0x57')]({'where':{'id':_0x5905c1[_0x4021('0x52')]['id']},'attributes':[_0x4021('0x5a'),_0x4021('0x5c'),_0x4021('0x5f'),_0x4021('0x6e'),_0x4021('0x60'),'defaultLoginLogo',_0x4021('0x62'),_0x4021('0x6f')],'raw':!![]});})[_0x4021('0x1e')](handleEntityNotFound(_0x24a44a,null))[_0x4021('0x1e')](function(_0x1d3155){if(_0x1d3155){var _0x3d56f9=_0x1d3155['loginLogo']&&fs[_0x4021('0x63')](path[_0x4021('0x64')](config[_0x4021('0x65')],_0x1e43c0,_[_0x4021('0x66')](_0x1d3155['loginLogo'])))?path[_0x4021('0x64')](config[_0x4021('0x65')],_0x1e43c0,_[_0x4021('0x66')](_0x1d3155[_0x4021('0x5c')])):path[_0x4021('0x64')](config[_0x4021('0x65')],_0x1e43c0,_[_0x4021('0x66')](_0x4021('0x70')));var _0x201d61=_0x4021('0x68')+_[_0x4021('0x69')](_0x4021('0x5c'));if(_0x1d3155[_0x201d61]||!_0x374048[_0x4021('0x6a')]){_0x3d56f9=path[_0x4021('0x64')](config[_0x4021('0x65')],_0x1e43c0,_[_0x4021('0x66')]('default_loginLogo.svg'));}if(!fs[_0x4021('0x63')](_0x3d56f9)){throw new db['Sequelize'][(_0x4021('0x71'))](_[_0x4021('0x69')](_0x4021('0x5c'))+_0x4021('0x6b'));}return _0x24a44a['download'](_0x3d56f9);}})[_0x4021('0x29')](handleError(_0x24a44a,null));};exports[_0x4021('0x72')]=function(_0x2e9825,_0x3feeb8){return db['Setting'][_0x4021('0x57')]({'where':{'id':_0x2e9825[_0x4021('0x52')]['id']},'attributes':[_0x4021('0x73')]})['then'](respondWithResult(_0x3feeb8,null))['catch'](handleError(_0x3feeb8,null));};exports[_0x4021('0x74')]=function(_0x4cae13,_0xb1d4a3,_0xb826ce){if(_0x4cae13[_0x4021('0x5b')]&&_0x4cae13[_0x4021('0x5b')][_0x4021('0x59')]){_0x4cae13[_0x4021('0x56')][_0x4021('0x5f')]=_0x4cae13['file']['filename'];}return db['Setting'][_0x4021('0x57')]({'where':{'id':_0x4cae13[_0x4021('0x52')]['id']}})[_0x4021('0x1e')](handleEntityNotFound(_0xb1d4a3,null))[_0x4021('0x1e')](saveUpdates(_0x4cae13[_0x4021('0x56')],null))['then'](respondWithResult(_0xb1d4a3,null))[_0x4021('0x29')](handleError(_0xb1d4a3,null));};var utilLicense=require(_0x4021('0x18'));exports[_0x4021('0x75')]=function(_0x474a1f,_0x130f04,_0x5a881){var _0x3ed6b4=_0x4021('0x5d');var _0x900a7={'custom':![]};return utilLicense[_0x4021('0x5e')]()[_0x4021('0x1e')](function(_0x183019){if(_0x183019){_0x900a7=_0x183019;}return db['Setting'][_0x4021('0x57')]({'where':{'id':_0x474a1f[_0x4021('0x52')]['id']},'attributes':['logo',_0x4021('0x5c'),_0x4021('0x5f'),_0x4021('0x6e'),_0x4021('0x60'),'defaultLoginLogo',_0x4021('0x62'),_0x4021('0x6f')],'raw':!![]});})[_0x4021('0x1e')](handleEntityNotFound(_0x130f04,null))[_0x4021('0x1e')](function(_0x53bb22){if(_0x53bb22){var _0x16bb15=_0x53bb22[_0x4021('0x5f')]&&fs['existsSync'](path[_0x4021('0x64')](config[_0x4021('0x65')],_0x3ed6b4,_[_0x4021('0x66')](_0x53bb22[_0x4021('0x5f')])))?path['join'](config[_0x4021('0x65')],_0x3ed6b4,_[_0x4021('0x66')](_0x53bb22[_0x4021('0x5f')])):path[_0x4021('0x64')](config[_0x4021('0x65')],_0x3ed6b4,_['toLower'](_0x4021('0x76')));var _0x1c8257=_0x4021('0x68')+_[_0x4021('0x69')]('preferred');if(_0x53bb22[_0x1c8257]||!_0x900a7[_0x4021('0x6a')]||!_0x900a7[_0x4021('0x5f')]){_0x16bb15=path['join'](config[_0x4021('0x65')],_0x3ed6b4,_[_0x4021('0x66')](_0x4021('0x76')));}if(!fs['existsSync'](_0x16bb15)){throw new db[(_0x4021('0x77'))][(_0x4021('0x71'))](_[_0x4021('0x69')](_0x4021('0x5f'))+'\x20not\x20found');}return _0x130f04['download'](_0x16bb15);}})[_0x4021('0x29')](handleError(_0x130f04,null));};exports['addFavicon']=function(_0x2d1b6e,_0x2a74ef,_0x2ba8cc){if(_0x2d1b6e[_0x4021('0x5b')]&&_0x2d1b6e[_0x4021('0x5b')][_0x4021('0x59')]){_0x2d1b6e[_0x4021('0x56')][_0x4021('0x6e')]=_0x2d1b6e['file'][_0x4021('0x59')];}return db[_0x4021('0x3d')][_0x4021('0x57')]({'where':{'id':_0x2d1b6e['params']['id']}})['then'](handleEntityNotFound(_0x2a74ef,null))[_0x4021('0x1e')](saveUpdates(_0x2d1b6e[_0x4021('0x56')],null))[_0x4021('0x1e')](respondWithResult(_0x2a74ef,null))[_0x4021('0x29')](handleError(_0x2a74ef,null));};var utilLicense=require(_0x4021('0x18'));exports[_0x4021('0x78')]=function(_0x2e9f97,_0x4e5172,_0x306ee1){var _0x17d174=_0x4021('0x5d');var _0x17f247={'custom':![]};return utilLicense['getLicense']()[_0x4021('0x1e')](function(_0xc954e7){if(_0xc954e7){_0x17f247=_0xc954e7;}return db[_0x4021('0x3d')]['find']({'where':{'id':_0x2e9f97[_0x4021('0x52')]['id']},'attributes':['logo',_0x4021('0x5c'),_0x4021('0x5f'),_0x4021('0x6e'),_0x4021('0x60'),'defaultLoginLogo',_0x4021('0x62'),_0x4021('0x6f')],'raw':!![]});})[_0x4021('0x1e')](handleEntityNotFound(_0x4e5172,null))[_0x4021('0x1e')](function(_0x525757){if(_0x525757){var _0xea7bad=_0x525757[_0x4021('0x6e')]&&fs['existsSync'](path['join'](config[_0x4021('0x65')],_0x17d174,_[_0x4021('0x66')](_0x525757[_0x4021('0x6e')])))?path['join'](config[_0x4021('0x65')],_0x17d174,_[_0x4021('0x66')](_0x525757[_0x4021('0x6e')])):path['join'](config[_0x4021('0x65')],_0x17d174,_[_0x4021('0x66')]('default_favicon.ico'));var _0x212f77=_0x4021('0x68')+_['upperFirst']('favicon');if(_0x525757[_0x212f77]||!_0x17f247['custom']){_0xea7bad=path['join'](config[_0x4021('0x65')],_0x17d174,_[_0x4021('0x66')]('default_favicon.ico'));}if(!fs[_0x4021('0x63')](_0xea7bad)){throw new db[(_0x4021('0x77'))][(_0x4021('0x71'))](_['upperFirst'](_0x4021('0x6e'))+_0x4021('0x6b'));}return _0x4e5172[_0x4021('0x6c')](_0xea7bad);}})[_0x4021('0x29')](handleError(_0x4e5172,null));};exports[_0x4021('0x79')]=function(_0x1f5fba,_0x3db681){var _0x3c2817={'offset':moment()[_0x4021('0x7a')]()};_0x3c2817['now']=moment()['utcOffset'](_0x3c2817['offset'])[_0x4021('0x7b')](_0x4021('0x7c'));return _0x3db681['status'](0xc8)['send'](_0x3c2817);}; \ No newline at end of file +var _0x3a5e=['undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','end','name','send','index','map','Setting','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','type','VIRTUAL','options','findAll','rows','show','params','find','body','addLogo','filename','addLogoLogin','file','loginLogo','getLogo','server/files/images/logos','getLicense','logo','preferred','favicon','defaultLogo','defaultPreferred','existsSync','join','root','toLower','default','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','defaultFavicon','default_loginLogo.svg','securePassword','addPreferred','getPreferred','defaultLoginLogo','default_preferred.png','getFavicon','default_favicon.ico','getDate','now','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','offset','limit'];(function(_0x27d68c,_0x52e668){var _0xe355e=function(_0x2b7669){while(--_0x2b7669){_0x27d68c['push'](_0x27d68c['shift']());}};_0xe355e(++_0x52e668);}(_0x3a5e,0x14c));var _0xe3a5=function(_0x400f4d,_0x44b7e9){_0x400f4d=_0x400f4d-0x0;var _0x44e07d=_0x3a5e[_0x400f4d];return _0x44e07d;};'use strict';var emlformat=require(_0xe3a5('0x0'));var rimraf=require(_0xe3a5('0x1'));var zipdir=require(_0xe3a5('0x2'));var jsonpatch=require(_0xe3a5('0x3'));var rp=require(_0xe3a5('0x4'));var moment=require(_0xe3a5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe3a5('0x6'));var util=require(_0xe3a5('0x7'));var path=require(_0xe3a5('0x8'));var sox=require(_0xe3a5('0x9'));var csv=require(_0xe3a5('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe3a5('0xb'));var squel=require('squel');var crypto=require(_0xe3a5('0xc'));var jsforce=require(_0xe3a5('0xd'));var deskjs=require(_0xe3a5('0xe'));var toCsv=require(_0xe3a5('0xa'));var querystring=require(_0xe3a5('0xf'));var Papa=require(_0xe3a5('0x10'));var Redis=require(_0xe3a5('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe3a5('0x12'));var as=require(_0xe3a5('0x13'));var hardwareService=require(_0xe3a5('0x14'));var logger=require(_0xe3a5('0x15'))('api');var utils=require(_0xe3a5('0x16'));var config=require(_0xe3a5('0x17'));var licenseUtil=require(_0xe3a5('0x18'));var db=require(_0xe3a5('0x19'))['db'];var jayson=require(_0xe3a5('0x1a'));var client=jayson[_0xe3a5('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a9a3a,_0x45d98a,_0x35097b,_0x69a1c){return new BPromise(function(_0x33d5de,_0x1378c4){var _0x20c650=_0x69a1c||client;return _0x20c650[_0xe3a5('0x1c')](_0x3a9a3a,_0x35097b)[_0xe3a5('0x1d')](function(_0x539af2){logger['info'](_0xe3a5('0x1e'),_0x45d98a,_0xe3a5('0x1f'));logger['debug'](_0xe3a5('0x20'),_0x45d98a,_0xe3a5('0x1f'),JSON[_0xe3a5('0x21')](_0x539af2));if(_0x539af2[_0xe3a5('0x22')]){if(_0x539af2[_0xe3a5('0x22')][_0xe3a5('0x23')]===0x1f4){logger[_0xe3a5('0x22')](_0xe3a5('0x1e'),_0x45d98a,_0x539af2['error']['message']);return _0x1378c4(_0x539af2['error'][_0xe3a5('0x24')]);}logger[_0xe3a5('0x22')](_0xe3a5('0x1e'),_0x45d98a,_0x539af2[_0xe3a5('0x22')][_0xe3a5('0x24')]);return _0x33d5de(_0x539af2['error']['message']);}else{logger['info'](_0xe3a5('0x1e'),_0x45d98a,_0xe3a5('0x1f'));_0x33d5de(_0x539af2[_0xe3a5('0x25')][_0xe3a5('0x24')]);}})[_0xe3a5('0x26')](function(_0x3f2092){logger[_0xe3a5('0x22')](_0xe3a5('0x1e'),_0x45d98a,_0x3f2092);_0x1378c4(_0x3f2092);});});}function respondWithStatusCode(_0x10759c,_0xb8ab4f){_0xb8ab4f=_0xb8ab4f||0xcc;return function(_0x182622){if(_0x182622){return _0x10759c[_0xe3a5('0x27')](_0xb8ab4f);}return _0x10759c[_0xe3a5('0x28')](_0xb8ab4f)['end']();};}function respondWithResult(_0xe49210,_0x19558c){_0x19558c=_0x19558c||0xc8;return function(_0x30275b){if(_0x30275b){return _0xe49210[_0xe3a5('0x28')](_0x19558c)['json'](_0x30275b);}};}function respondWithFilteredResult(_0x33b5f5,_0xbbec5a){return function(_0x279e81){if(_0x279e81){var _0x4d709d=typeof _0xbbec5a[_0xe3a5('0x29')]==='undefined'&&typeof _0xbbec5a[_0xe3a5('0x2a')]===_0xe3a5('0x2b');var _0x5a6b20=_0x279e81[_0xe3a5('0x2c')];var _0xaea43f=_0x4d709d?0x0:_0xbbec5a[_0xe3a5('0x29')];var _0x1c1f79=_0x4d709d?_0x279e81[_0xe3a5('0x2c')]:_0xbbec5a[_0xe3a5('0x29')]+_0xbbec5a[_0xe3a5('0x2a')];var _0x22a9a4;if(_0x1c1f79>=_0x5a6b20){_0x1c1f79=_0x5a6b20;_0x22a9a4=0xc8;}else{_0x22a9a4=0xce;}_0x33b5f5[_0xe3a5('0x28')](_0x22a9a4);return _0x33b5f5[_0xe3a5('0x2d')](_0xe3a5('0x2e'),_0xaea43f+'-'+_0x1c1f79+'/'+_0x5a6b20)[_0xe3a5('0x2f')](_0x279e81);}return null;};}function patchUpdates(_0x264bb9){return function(_0x2e41c3){try{jsonpatch[_0xe3a5('0x30')](_0x2e41c3,_0x264bb9,!![]);}catch(_0x10ca2d){return BPromise[_0xe3a5('0x31')](_0x10ca2d);}return _0x2e41c3[_0xe3a5('0x32')]();};}function saveUpdates(_0x4b3b3c,_0x4f04be){return function(_0x55a664){if(_0x55a664){return _0x55a664[_0xe3a5('0x33')](_0x4b3b3c)['then'](function(_0x30202c){return _0x30202c;});}return null;};}function removeEntity(_0x261791,_0x2858dc){return function(_0x1b66a5){if(_0x1b66a5){return _0x1b66a5[_0xe3a5('0x34')]()[_0xe3a5('0x1d')](function(){_0x261791[_0xe3a5('0x28')](0xcc)[_0xe3a5('0x35')]();});}};}function handleEntityNotFound(_0x3f6567,_0x266b96){return function(_0x4789eb){if(!_0x4789eb){_0x3f6567[_0xe3a5('0x27')](0x194);}return _0x4789eb;};}function handleError(_0x35ca60,_0x395e03){_0x395e03=_0x395e03||0x1f4;return function(_0x14a437){logger[_0xe3a5('0x22')](_0x14a437['stack']);if(_0x14a437[_0xe3a5('0x36')]){delete _0x14a437[_0xe3a5('0x36')];}_0x35ca60['status'](_0x395e03)[_0xe3a5('0x37')](_0x14a437);};}exports[_0xe3a5('0x38')]=function(_0x192c7f,_0x2a1dbd){var _0x4dc85a={},_0x1531aa={},_0xe583f8={'count':0x0,'rows':[]};var _0x38bc26=_[_0xe3a5('0x39')](db[_0xe3a5('0x3a')][_0xe3a5('0x3b')],function(_0x32e6fa){return{'name':_0x32e6fa[_0xe3a5('0x3c')],'type':_0x32e6fa['type']['key']};});_0x1531aa[_0xe3a5('0x3d')]=_[_0xe3a5('0x39')](_0x38bc26,_0xe3a5('0x36'));_0x1531aa[_0xe3a5('0x3e')]=_[_0xe3a5('0x3f')](_0x192c7f['query']);_0x1531aa[_0xe3a5('0x40')]=_[_0xe3a5('0x41')](_0x1531aa[_0xe3a5('0x3d')],_0x1531aa[_0xe3a5('0x3e')]);_0x4dc85a[_0xe3a5('0x42')]=_[_0xe3a5('0x41')](_0x1531aa[_0xe3a5('0x3d')],qs[_0xe3a5('0x43')](_0x192c7f[_0xe3a5('0x3e')][_0xe3a5('0x43')]));_0x4dc85a[_0xe3a5('0x42')]=_0x4dc85a[_0xe3a5('0x42')][_0xe3a5('0x44')]?_0x4dc85a[_0xe3a5('0x42')]:_0x1531aa['model'];if(!_0x192c7f['query'][_0xe3a5('0x45')](_0xe3a5('0x46'))){_0x4dc85a[_0xe3a5('0x2a')]=qs[_0xe3a5('0x2a')](_0x192c7f[_0xe3a5('0x3e')]['limit']);_0x4dc85a[_0xe3a5('0x29')]=qs[_0xe3a5('0x29')](_0x192c7f[_0xe3a5('0x3e')][_0xe3a5('0x29')]);}_0x4dc85a[_0xe3a5('0x47')]=qs[_0xe3a5('0x48')](_0x192c7f[_0xe3a5('0x3e')][_0xe3a5('0x48')]);_0x4dc85a['where']=qs[_0xe3a5('0x40')](_[_0xe3a5('0x49')](_0x192c7f['query'],_0x1531aa[_0xe3a5('0x40')]),_0x38bc26);if(_0x192c7f[_0xe3a5('0x3e')][_0xe3a5('0x4a')]){_0x4dc85a['where']=_[_0xe3a5('0x4b')](_0x4dc85a[_0xe3a5('0x4c')],{'$or':_[_0xe3a5('0x39')](_0x38bc26,function(_0x57c848){if(_0x57c848[_0xe3a5('0x4d')]!==_0xe3a5('0x4e')){var _0x28ef74={};_0x28ef74[_0x57c848[_0xe3a5('0x36')]]={'$like':'%'+_0x192c7f['query'][_0xe3a5('0x4a')]+'%'};return _0x28ef74;}})});}_0x4dc85a=_[_0xe3a5('0x4b')]({},_0x4dc85a,_0x192c7f[_0xe3a5('0x4f')]);var _0x3ff453={'where':_0x4dc85a[_0xe3a5('0x4c')]};return db['Setting']['count'](_0x3ff453)[_0xe3a5('0x1d')](function(_0x33d361){_0xe583f8['count']=_0x33d361;if(_0x192c7f[_0xe3a5('0x3e')]['includeAll']){_0x4dc85a['include']=[{'all':!![]}];}return db[_0xe3a5('0x3a')][_0xe3a5('0x50')](_0x4dc85a);})[_0xe3a5('0x1d')](function(_0x1714f8){_0xe583f8[_0xe3a5('0x51')]=_0x1714f8;return _0xe583f8;})[_0xe3a5('0x1d')](respondWithFilteredResult(_0x2a1dbd,_0x4dc85a))[_0xe3a5('0x26')](handleError(_0x2a1dbd,null));};exports[_0xe3a5('0x52')]=function(_0x425fa6,_0x5da7c5){var _0x54d5b8={'raw':![],'where':{'id':_0x425fa6[_0xe3a5('0x53')]['id']}},_0x44d4fb={};_0x44d4fb[_0xe3a5('0x3d')]=_[_0xe3a5('0x3f')](db[_0xe3a5('0x3a')][_0xe3a5('0x3b')]);_0x44d4fb[_0xe3a5('0x3e')]=_[_0xe3a5('0x3f')](_0x425fa6[_0xe3a5('0x3e')]);_0x44d4fb['filters']=_[_0xe3a5('0x41')](_0x44d4fb[_0xe3a5('0x3d')],_0x44d4fb[_0xe3a5('0x3e')]);_0x54d5b8[_0xe3a5('0x42')]=_[_0xe3a5('0x41')](_0x44d4fb[_0xe3a5('0x3d')],qs[_0xe3a5('0x43')](_0x425fa6[_0xe3a5('0x3e')][_0xe3a5('0x43')]));_0x54d5b8[_0xe3a5('0x42')]=_0x54d5b8[_0xe3a5('0x42')][_0xe3a5('0x44')]?_0x54d5b8[_0xe3a5('0x42')]:_0x44d4fb[_0xe3a5('0x3d')];if(_0x425fa6['query']['includeAll']){_0x54d5b8['include']=[{'all':!![]}];}_0x54d5b8=_[_0xe3a5('0x4b')]({},_0x54d5b8,_0x425fa6[_0xe3a5('0x4f')]);return db[_0xe3a5('0x3a')][_0xe3a5('0x54')](_0x54d5b8)[_0xe3a5('0x1d')](handleEntityNotFound(_0x5da7c5,null))[_0xe3a5('0x1d')](respondWithResult(_0x5da7c5,null))[_0xe3a5('0x26')](handleError(_0x5da7c5,null));};exports['update']=function(_0x591094,_0x1b4b58){if(_0x591094[_0xe3a5('0x55')]['id']){delete _0x591094[_0xe3a5('0x55')]['id'];}return db[_0xe3a5('0x3a')]['find']({'where':{'id':_0x591094[_0xe3a5('0x53')]['id']}})[_0xe3a5('0x1d')](handleEntityNotFound(_0x1b4b58,null))[_0xe3a5('0x1d')](saveUpdates(_0x591094['body'],null))[_0xe3a5('0x1d')](respondWithResult(_0x1b4b58,null))[_0xe3a5('0x26')](handleError(_0x1b4b58,null));};exports[_0xe3a5('0x56')]=function(_0x250051,_0x4f84d9,_0x1ac332){if(_0x250051['file']&&_0x250051['file'][_0xe3a5('0x57')]){_0x250051[_0xe3a5('0x55')]['logo']=_0x250051['file'][_0xe3a5('0x57')];}return db['Setting'][_0xe3a5('0x54')]({'where':{'id':_0x250051[_0xe3a5('0x53')]['id']}})['then'](handleEntityNotFound(_0x4f84d9,null))[_0xe3a5('0x1d')](saveUpdates(_0x250051[_0xe3a5('0x55')],null))['then'](respondWithResult(_0x4f84d9,null))['catch'](handleError(_0x4f84d9,null));};exports[_0xe3a5('0x58')]=function(_0x24df11,_0x275650,_0x12f36f){if(_0x24df11[_0xe3a5('0x59')]&&_0x24df11[_0xe3a5('0x59')][_0xe3a5('0x57')]){_0x24df11[_0xe3a5('0x55')][_0xe3a5('0x5a')]=_0x24df11[_0xe3a5('0x59')]['filename'];}return db['Setting'][_0xe3a5('0x54')]({'where':{'id':_0x24df11['params']['id']}})[_0xe3a5('0x1d')](handleEntityNotFound(_0x275650,null))['then'](saveUpdates(_0x24df11[_0xe3a5('0x55')],null))[_0xe3a5('0x1d')](respondWithResult(_0x275650,null))[_0xe3a5('0x26')](handleError(_0x275650,null));};var utilLicense=require('../../config/license/util');exports[_0xe3a5('0x5b')]=function(_0x2d70c8,_0x449a21,_0x16b82c){var _0x57fe05=_0xe3a5('0x5c');var _0x34b1e7={'custom':![]};return utilLicense[_0xe3a5('0x5d')]()[_0xe3a5('0x1d')](function(_0x1b7bca){if(_0x1b7bca){_0x34b1e7=_0x1b7bca;}return db[_0xe3a5('0x3a')][_0xe3a5('0x54')]({'where':{'id':_0x2d70c8['params']['id']},'attributes':[_0xe3a5('0x5e'),_0xe3a5('0x5a'),_0xe3a5('0x5f'),_0xe3a5('0x60'),_0xe3a5('0x61'),'defaultLoginLogo',_0xe3a5('0x62'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x449a21,null))[_0xe3a5('0x1d')](function(_0x11f6fd){if(_0x11f6fd){var _0x4dd547=_0x11f6fd[_0xe3a5('0x5e')]&&fs[_0xe3a5('0x63')](path[_0xe3a5('0x64')](config[_0xe3a5('0x65')],_0x57fe05,_[_0xe3a5('0x66')](_0x11f6fd['logo'])))?path[_0xe3a5('0x64')](config[_0xe3a5('0x65')],_0x57fe05,_[_0xe3a5('0x66')](_0x11f6fd[_0xe3a5('0x5e')])):path[_0xe3a5('0x64')](config[_0xe3a5('0x65')],_0x57fe05,_[_0xe3a5('0x66')]('default_logo.svg'));var _0x33c6bd=_0xe3a5('0x67')+_[_0xe3a5('0x68')](_0xe3a5('0x5e'));if(_0x11f6fd[_0x33c6bd]||!_0x34b1e7[_0xe3a5('0x69')]){_0x4dd547=path[_0xe3a5('0x64')](config['root'],_0x57fe05,_['toLower']('default_logo.svg'));}if(!fs[_0xe3a5('0x63')](_0x4dd547)){throw new db[(_0xe3a5('0x6a'))][(_0xe3a5('0x6b'))](_[_0xe3a5('0x68')](_0xe3a5('0x5e'))+_0xe3a5('0x6c'));}return _0x449a21[_0xe3a5('0x6d')](_0x4dd547);}})[_0xe3a5('0x26')](handleError(_0x449a21,null));};var utilLicense=require(_0xe3a5('0x18'));exports[_0xe3a5('0x6e')]=function(_0x3b715e,_0x5bb7a4,_0x5af925){var _0x379cb1=_0xe3a5('0x5c');var _0x139573={'custom':![]};return utilLicense[_0xe3a5('0x5d')]()[_0xe3a5('0x1d')](function(_0x11cae0){if(_0x11cae0){_0x139573=_0x11cae0;}return db[_0xe3a5('0x3a')]['find']({'where':{'id':_0x3b715e[_0xe3a5('0x53')]['id']},'attributes':[_0xe3a5('0x5e'),_0xe3a5('0x5a'),_0xe3a5('0x5f'),_0xe3a5('0x60'),_0xe3a5('0x61'),'defaultLoginLogo',_0xe3a5('0x62'),_0xe3a5('0x6f')],'raw':!![]});})['then'](handleEntityNotFound(_0x5bb7a4,null))['then'](function(_0x355ee3){if(_0x355ee3){var _0x402cba=_0x355ee3[_0xe3a5('0x5a')]&&fs['existsSync'](path[_0xe3a5('0x64')](config[_0xe3a5('0x65')],_0x379cb1,_[_0xe3a5('0x66')](_0x355ee3['loginLogo'])))?path[_0xe3a5('0x64')](config[_0xe3a5('0x65')],_0x379cb1,_[_0xe3a5('0x66')](_0x355ee3[_0xe3a5('0x5a')])):path['join'](config[_0xe3a5('0x65')],_0x379cb1,_['toLower'](_0xe3a5('0x70')));var _0x4f90f7=_0xe3a5('0x67')+_[_0xe3a5('0x68')](_0xe3a5('0x5a'));if(_0x355ee3[_0x4f90f7]||!_0x139573[_0xe3a5('0x69')]){_0x402cba=path[_0xe3a5('0x64')](config[_0xe3a5('0x65')],_0x379cb1,_[_0xe3a5('0x66')](_0xe3a5('0x70')));}if(!fs[_0xe3a5('0x63')](_0x402cba)){throw new db[(_0xe3a5('0x6a'))][(_0xe3a5('0x6b'))](_[_0xe3a5('0x68')](_0xe3a5('0x5a'))+'\x20not\x20found');}return _0x5bb7a4['download'](_0x402cba);}})[_0xe3a5('0x26')](handleError(_0x5bb7a4,null));};exports['gdpr']=function(_0x395790,_0x3dfd34){return db[_0xe3a5('0x3a')][_0xe3a5('0x54')]({'where':{'id':_0x395790[_0xe3a5('0x53')]['id']},'attributes':[_0xe3a5('0x71')]})['then'](respondWithResult(_0x3dfd34,null))['catch'](handleError(_0x3dfd34,null));};exports[_0xe3a5('0x72')]=function(_0x4396ff,_0x41f6ba,_0x12a9e0){if(_0x4396ff[_0xe3a5('0x59')]&&_0x4396ff[_0xe3a5('0x59')][_0xe3a5('0x57')]){_0x4396ff[_0xe3a5('0x55')]['preferred']=_0x4396ff['file'][_0xe3a5('0x57')];}return db[_0xe3a5('0x3a')][_0xe3a5('0x54')]({'where':{'id':_0x4396ff[_0xe3a5('0x53')]['id']}})['then'](handleEntityNotFound(_0x41f6ba,null))[_0xe3a5('0x1d')](saveUpdates(_0x4396ff[_0xe3a5('0x55')],null))[_0xe3a5('0x1d')](respondWithResult(_0x41f6ba,null))[_0xe3a5('0x26')](handleError(_0x41f6ba,null));};var utilLicense=require(_0xe3a5('0x18'));exports[_0xe3a5('0x73')]=function(_0x43751f,_0x4976fd,_0x41101f){var _0x6477ce=_0xe3a5('0x5c');var _0x50f58d={'custom':![]};return utilLicense[_0xe3a5('0x5d')]()[_0xe3a5('0x1d')](function(_0x5a6404){if(_0x5a6404){_0x50f58d=_0x5a6404;}return db[_0xe3a5('0x3a')]['find']({'where':{'id':_0x43751f[_0xe3a5('0x53')]['id']},'attributes':[_0xe3a5('0x5e'),'loginLogo','preferred',_0xe3a5('0x60'),_0xe3a5('0x61'),_0xe3a5('0x74'),'defaultPreferred',_0xe3a5('0x6f')],'raw':!![]});})[_0xe3a5('0x1d')](handleEntityNotFound(_0x4976fd,null))['then'](function(_0x368b02){if(_0x368b02){var _0x176cdd=_0x368b02[_0xe3a5('0x5f')]&&fs[_0xe3a5('0x63')](path[_0xe3a5('0x64')](config['root'],_0x6477ce,_['toLower'](_0x368b02[_0xe3a5('0x5f')])))?path[_0xe3a5('0x64')](config['root'],_0x6477ce,_[_0xe3a5('0x66')](_0x368b02[_0xe3a5('0x5f')])):path[_0xe3a5('0x64')](config[_0xe3a5('0x65')],_0x6477ce,_[_0xe3a5('0x66')](_0xe3a5('0x75')));var _0x1311c9='default'+_[_0xe3a5('0x68')](_0xe3a5('0x5f'));if(_0x368b02[_0x1311c9]||!_0x50f58d[_0xe3a5('0x69')]||!_0x50f58d['preferred']){_0x176cdd=path[_0xe3a5('0x64')](config[_0xe3a5('0x65')],_0x6477ce,_[_0xe3a5('0x66')](_0xe3a5('0x75')));}if(!fs[_0xe3a5('0x63')](_0x176cdd)){throw new db[(_0xe3a5('0x6a'))]['ValidationError'](_[_0xe3a5('0x68')](_0xe3a5('0x5f'))+'\x20not\x20found');}return _0x4976fd['download'](_0x176cdd);}})[_0xe3a5('0x26')](handleError(_0x4976fd,null));};exports['addFavicon']=function(_0x9c1e73,_0x14dafe,_0x2515d8){if(_0x9c1e73[_0xe3a5('0x59')]&&_0x9c1e73['file'][_0xe3a5('0x57')]){_0x9c1e73[_0xe3a5('0x55')][_0xe3a5('0x60')]=_0x9c1e73['file'][_0xe3a5('0x57')];}return db[_0xe3a5('0x3a')][_0xe3a5('0x54')]({'where':{'id':_0x9c1e73[_0xe3a5('0x53')]['id']}})['then'](handleEntityNotFound(_0x14dafe,null))[_0xe3a5('0x1d')](saveUpdates(_0x9c1e73['body'],null))['then'](respondWithResult(_0x14dafe,null))['catch'](handleError(_0x14dafe,null));};var utilLicense=require('../../config/license/util');exports[_0xe3a5('0x76')]=function(_0xe9dd68,_0x492144,_0x3fb997){var _0x4f2fcc=_0xe3a5('0x5c');var _0x2d51cb={'custom':![]};return utilLicense['getLicense']()[_0xe3a5('0x1d')](function(_0x4d74cd){if(_0x4d74cd){_0x2d51cb=_0x4d74cd;}return db[_0xe3a5('0x3a')]['find']({'where':{'id':_0xe9dd68[_0xe3a5('0x53')]['id']},'attributes':[_0xe3a5('0x5e'),_0xe3a5('0x5a'),_0xe3a5('0x5f'),_0xe3a5('0x60'),_0xe3a5('0x61'),_0xe3a5('0x74'),_0xe3a5('0x62'),_0xe3a5('0x6f')],'raw':!![]});})[_0xe3a5('0x1d')](handleEntityNotFound(_0x492144,null))[_0xe3a5('0x1d')](function(_0x26245f){if(_0x26245f){var _0x3d543b=_0x26245f['favicon']&&fs[_0xe3a5('0x63')](path[_0xe3a5('0x64')](config['root'],_0x4f2fcc,_['toLower'](_0x26245f[_0xe3a5('0x60')])))?path[_0xe3a5('0x64')](config[_0xe3a5('0x65')],_0x4f2fcc,_['toLower'](_0x26245f['favicon'])):path['join'](config['root'],_0x4f2fcc,_[_0xe3a5('0x66')](_0xe3a5('0x77')));var _0x2a4dcf=_0xe3a5('0x67')+_[_0xe3a5('0x68')]('favicon');if(_0x26245f[_0x2a4dcf]||!_0x2d51cb[_0xe3a5('0x69')]){_0x3d543b=path['join'](config[_0xe3a5('0x65')],_0x4f2fcc,_[_0xe3a5('0x66')](_0xe3a5('0x77')));}if(!fs[_0xe3a5('0x63')](_0x3d543b)){throw new db['Sequelize'][(_0xe3a5('0x6b'))](_['upperFirst'](_0xe3a5('0x60'))+_0xe3a5('0x6c'));}return _0x492144['download'](_0x3d543b);}})[_0xe3a5('0x26')](handleError(_0x492144,null));};exports[_0xe3a5('0x78')]=function(_0x59741f,_0x24bb5e){var _0x2b5633={'offset':moment()['utcOffset']()};_0x2b5633[_0xe3a5('0x79')]=moment()[_0xe3a5('0x7a')](_0x2b5633[_0xe3a5('0x29')])[_0xe3a5('0x7b')](_0xe3a5('0x7c'));return _0x24bb5e[_0xe3a5('0x28')](0xc8)[_0xe3a5('0x37')](_0x2b5633);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 004af18..e67e589 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Setting','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./setting.attributes'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7217=['../../config/environment','./setting.attributes','exports','define','Setting','settings','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3825a8,_0x2ce1a2){var _0xabc9bc=function(_0x101073){while(--_0x101073){_0x3825a8['push'](_0x3825a8['shift']());}};_0xabc9bc(++_0x2ce1a2);}(_0x7217,0x19e));var _0x7721=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x7217[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'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 5956e7a..53def18 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 _0x3c16=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','ShowSetting','Setting','find','raw','options','where','include','map','model','attributes','lodash','util','moment'];(function(_0x421725,_0x318a04){var _0x51b322=function(_0xe58018){while(--_0xe58018){_0x421725['push'](_0x421725['shift']());}};_0x51b322(++_0x318a04);}(_0x3c16,0x9d));var _0x63c1=function(_0x4e89ac,_0x1b4e4e){_0x4e89ac=_0x4e89ac-0x0;var _0x5c456f=_0x3c16[_0x4e89ac];return _0x5c456f;};'use strict';var _=require(_0x63c1('0x0'));var util=require(_0x63c1('0x1'));var moment=require(_0x63c1('0x2'));var BPromise=require(_0x63c1('0x3'));var rs=require(_0x63c1('0x4'));var fs=require('fs');var Redis=require(_0x63c1('0x5'));var db=require(_0x63c1('0x6'))['db'];var utils=require(_0x63c1('0x7'));var logger=require(_0x63c1('0x8'))(_0x63c1('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x63c1('0xa')][_0x63c1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x582b51,_0x31eb6a,_0x6a5821){return new BPromise(function(_0x5db515,_0xd939b3){return client['request'](_0x582b51,_0x6a5821)[_0x63c1('0xc')](function(_0x418f5c){logger[_0x63c1('0xd')](_0x63c1('0xe'),_0x31eb6a,_0x63c1('0xf'));logger[_0x63c1('0x10')]('Setting,\x20%s,\x20%s,\x20%s',_0x31eb6a,'request\x20sent',JSON[_0x63c1('0x11')](_0x418f5c));if(_0x418f5c[_0x63c1('0x12')]){if(_0x418f5c['error']['code']===0x1f4){logger[_0x63c1('0x12')](_0x63c1('0xe'),_0x31eb6a,_0x418f5c['error'][_0x63c1('0x13')]);return _0xd939b3(_0x418f5c['error']['message']);}logger[_0x63c1('0x12')]('Setting,\x20%s,\x20%s',_0x31eb6a,_0x418f5c[_0x63c1('0x12')][_0x63c1('0x13')]);return _0x5db515(_0x418f5c['error'][_0x63c1('0x13')]);}else{logger[_0x63c1('0xd')](_0x63c1('0xe'),_0x31eb6a,'request\x20sent');_0x5db515(_0x418f5c[_0x63c1('0x14')][_0x63c1('0x13')]);}})[_0x63c1('0x15')](function(_0x4a6947){logger[_0x63c1('0x12')](_0x63c1('0xe'),_0x31eb6a,_0x4a6947);_0xd939b3(_0x4a6947);});});}exports[_0x63c1('0x16')]=function(_0x1a8c64){var _0xea4397=this;return new Promise(function(_0x30ba51,_0x480514){return db[_0x63c1('0x17')][_0x63c1('0x18')]({'raw':_0x1a8c64['options']?_0x1a8c64['options'][_0x63c1('0x19')]===undefined?!![]:![]:!![],'where':_0x1a8c64['options']?_0x1a8c64[_0x63c1('0x1a')][_0x63c1('0x1b')]||null:null,'attributes':_0x1a8c64[_0x63c1('0x1a')]?_0x1a8c64[_0x63c1('0x1a')]['attributes']||null:null,'include':_0x1a8c64[_0x63c1('0x1a')]?_0x1a8c64[_0x63c1('0x1a')][_0x63c1('0x1c')]?_[_0x63c1('0x1d')](_0x1a8c64[_0x63c1('0x1a')]['include'],function(_0x3a6a77){return{'model':db[_0x3a6a77['model']],'as':_0x3a6a77['as'],'attributes':_0x3a6a77['attributes'],'include':_0x3a6a77['include']?_[_0x63c1('0x1d')](_0x3a6a77[_0x63c1('0x1c')],function(_0x5c6f7e){return{'model':db[_0x5c6f7e[_0x63c1('0x1e')]],'as':_0x5c6f7e['as'],'attributes':_0x5c6f7e[_0x63c1('0x1f')],'include':_0x5c6f7e['include']?_[_0x63c1('0x1d')](_0x5c6f7e['include'],function(_0x17a9bf){return{'model':db[_0x17a9bf['model']],'as':_0x17a9bf['as'],'attributes':_0x17a9bf[_0x63c1('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x63c1('0xc')](function(_0x56e4f8){logger['info'](_0x63c1('0x16'),_0x1a8c64);logger[_0x63c1('0x10')]('ShowSetting',_0x1a8c64,JSON[_0x63c1('0x11')](_0x56e4f8));_0x30ba51(_0x56e4f8);})[_0x63c1('0x15')](function(_0x384f28){logger[_0x63c1('0x12')](_0x63c1('0x16'),_0x384f28[_0x63c1('0x13')],_0x1a8c64);_0x480514(_0xea4397['error'](0x1f4,_0x384f28[_0x63c1('0x13')]));});});}; \ No newline at end of file +var _0x665a=['then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowSetting','find','options','where','attributes','include','model','map','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x474a0c,_0x168748){var _0x1dd3d2=function(_0x55635a){while(--_0x55635a){_0x474a0c['push'](_0x474a0c['shift']());}};_0x1dd3d2(++_0x168748);}(_0x665a,0xed));var _0xa665=function(_0x5bd5fc,_0x57597){_0x5bd5fc=_0x5bd5fc-0x0;var _0x420110=_0x665a[_0x5bd5fc];return _0x420110;};'use strict';var _=require(_0xa665('0x0'));var util=require(_0xa665('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa665('0x2'));var fs=require('fs');var Redis=require(_0xa665('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa665('0x4'));var logger=require(_0xa665('0x5'))('rpc');var config=require(_0xa665('0x6'));var jayson=require(_0xa665('0x7'));var client=jayson[_0xa665('0x8')][_0xa665('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30e70f,_0x5a2f30,_0x4454b6){return new BPromise(function(_0x2109b9,_0x13acd5){return client[_0xa665('0xa')](_0x30e70f,_0x4454b6)[_0xa665('0xb')](function(_0x9d1612){logger[_0xa665('0xc')](_0xa665('0xd'),_0x5a2f30,_0xa665('0xe'));logger[_0xa665('0xf')](_0xa665('0x10'),_0x5a2f30,_0xa665('0xe'),JSON[_0xa665('0x11')](_0x9d1612));if(_0x9d1612[_0xa665('0x12')]){if(_0x9d1612[_0xa665('0x12')][_0xa665('0x13')]===0x1f4){logger[_0xa665('0x12')](_0xa665('0xd'),_0x5a2f30,_0x9d1612['error'][_0xa665('0x14')]);return _0x13acd5(_0x9d1612[_0xa665('0x12')][_0xa665('0x14')]);}logger[_0xa665('0x12')](_0xa665('0xd'),_0x5a2f30,_0x9d1612[_0xa665('0x12')][_0xa665('0x14')]);return _0x2109b9(_0x9d1612[_0xa665('0x12')][_0xa665('0x14')]);}else{logger[_0xa665('0xc')](_0xa665('0xd'),_0x5a2f30,'request\x20sent');_0x2109b9(_0x9d1612[_0xa665('0x15')][_0xa665('0x14')]);}})['catch'](function(_0x3e9c87){logger[_0xa665('0x12')](_0xa665('0xd'),_0x5a2f30,_0x3e9c87);_0x13acd5(_0x3e9c87);});});}exports[_0xa665('0x16')]=function(_0xe06578){var _0x29bb49=this;return new Promise(function(_0x10e0d4,_0x5d9cdf){return db['Setting'][_0xa665('0x17')]({'raw':_0xe06578[_0xa665('0x18')]?_0xe06578['options']['raw']===undefined?!![]:![]:!![],'where':_0xe06578[_0xa665('0x18')]?_0xe06578[_0xa665('0x18')][_0xa665('0x19')]||null:null,'attributes':_0xe06578[_0xa665('0x18')]?_0xe06578[_0xa665('0x18')][_0xa665('0x1a')]||null:null,'include':_0xe06578[_0xa665('0x18')]?_0xe06578[_0xa665('0x18')]['include']?_['map'](_0xe06578[_0xa665('0x18')][_0xa665('0x1b')],function(_0x5c95e1){return{'model':db[_0x5c95e1[_0xa665('0x1c')]],'as':_0x5c95e1['as'],'attributes':_0x5c95e1[_0xa665('0x1a')],'include':_0x5c95e1[_0xa665('0x1b')]?_[_0xa665('0x1d')](_0x5c95e1[_0xa665('0x1b')],function(_0x4140db){return{'model':db[_0x4140db[_0xa665('0x1c')]],'as':_0x4140db['as'],'attributes':_0x4140db[_0xa665('0x1a')],'include':_0x4140db['include']?_[_0xa665('0x1d')](_0x4140db['include'],function(_0x3bd7bf){return{'model':db[_0x3bd7bf[_0xa665('0x1c')]],'as':_0x3bd7bf['as'],'attributes':_0x3bd7bf['attributes']};}):[]};}):[]};}):[]:[]})[_0xa665('0xb')](function(_0x319efe){logger[_0xa665('0xc')](_0xa665('0x16'),_0xe06578);logger[_0xa665('0xf')](_0xa665('0x16'),_0xe06578,JSON[_0xa665('0x11')](_0x319efe));_0x10e0d4(_0x319efe);})[_0xa665('0x1e')](function(_0x15e8c8){logger[_0xa665('0x12')](_0xa665('0x16'),_0x15e8c8[_0xa665('0x14')],_0xe06578);_0x5d9cdf(_0x29bb49[_0xa665('0x12')](0x1f4,_0x15e8c8['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index b758a03..b64a19c 100644 --- a/server/api/smsAccount/index.js +++ b/server/api/smsAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/send','status','addAgents','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated'];(function(_0x3b3722,_0x31c569){var _0x2a679a=function(_0x338aaf){while(--_0x338aaf){_0x3b3722['push'](_0x3b3722['shift']());}};_0x2a679a(++_0x31c569);}(_0x814b,0x1a2));var _0xb814=function(_0xabbd2f,_0x44d05a){_0xabbd2f=_0xabbd2f-0x0;var _0x34a040=_0x814b[_0xabbd2f];return _0x34a040;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0xa')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0xa')](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router['get'](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x15')]);router[_0xb814('0xa')](_0xb814('0x16'),auth[_0xb814('0xb')](),controller[_0xb814('0x17')]);router[_0xb814('0xa')](_0xb814('0x18'),controller[_0xb814('0x19')]);router[_0xb814('0xa')](_0xb814('0x1a'),auth[_0xb814('0xb')](),controller[_0xb814('0x1b')]);router[_0xb814('0x1c')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x1d')]);router[_0xb814('0x1c')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x1e')]);router['post'](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x1f')]);router[_0xb814('0x1c')]('/:id/notify',controller['notify']);router['post'](_0xb814('0x14'),auth['isAuthenticated'](),controller['addApplications']);router[_0xb814('0x1c')](_0xb814('0x20'),auth[_0xb814('0xb')](),controller['send']);router[_0xb814('0x1c')]('/:id/status',controller[_0xb814('0x21')]);router[_0xb814('0x1c')](_0xb814('0x1a'),auth[_0xb814('0xb')](),controller[_0xb814('0x22')]);router[_0xb814('0x23')](_0xb814('0xe'),auth['isAuthenticated'](),controller[_0xb814('0x24')]);router['delete'](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0x25')]);router[_0xb814('0x26')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x27')]);router['delete'](_0xb814('0x12'),auth[_0xb814('0xb')](),controller[_0xb814('0x28')]);router[_0xb814('0x26')](_0xb814('0x1a'),auth[_0xb814('0xb')](),controller[_0xb814('0x29')]);module[_0xb814('0x2a')]=router; \ No newline at end of file +var _0xabce=['/:id/users','getAgents','create','post','addAnswer','/:id/notify','notify','/:id/send','send','status','addAgents','put','update','delete','/:id','destroy','removeDispositions','removeAnswers','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status'];(function(_0x377b24,_0x1f5383){var _0x371bae=function(_0x2ee852){while(--_0x2ee852){_0x377b24['push'](_0x377b24['shift']());}};_0x371bae(++_0x1f5383);}(_0xabce,0x103));var _0xeabc=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xabce[_0x24237f];return _0x48298e;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./smsAccount.controller');router['get']('/',auth[_0xeabc('0x8')](),controller['index']);router[_0xeabc('0x9')]('/describe',auth[_0xeabc('0x8')](),controller[_0xeabc('0xa')]);router[_0xeabc('0x9')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0xb')]);router[_0xeabc('0x9')](_0xeabc('0xc'),auth[_0xeabc('0x8')](),controller[_0xeabc('0xd')]);router[_0xeabc('0x9')](_0xeabc('0xe'),auth[_0xeabc('0x8')](),controller[_0xeabc('0xf')]);router[_0xeabc('0x9')](_0xeabc('0x10'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x11')]);router[_0xeabc('0x9')](_0xeabc('0x12'),auth['isAuthenticated'](),controller[_0xeabc('0x13')]);router[_0xeabc('0x9')](_0xeabc('0x14'),controller['statusGet']);router['get'](_0xeabc('0x15'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x16')]);router['post']('/',auth[_0xeabc('0x8')](),controller[_0xeabc('0x17')]);router['post']('/:id/dispositions',auth[_0xeabc('0x8')](),controller['addDisposition']);router[_0xeabc('0x18')](_0xeabc('0xe'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x19')]);router[_0xeabc('0x18')](_0xeabc('0x1a'),controller[_0xeabc('0x1b')]);router[_0xeabc('0x18')]('/:id/applications',auth[_0xeabc('0x8')](),controller['addApplications']);router[_0xeabc('0x18')](_0xeabc('0x1c'),auth['isAuthenticated'](),controller[_0xeabc('0x1d')]);router[_0xeabc('0x18')](_0xeabc('0x14'),controller[_0xeabc('0x1e')]);router[_0xeabc('0x18')]('/:id/users',auth[_0xeabc('0x8')](),controller[_0xeabc('0x1f')]);router[_0xeabc('0x20')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0x21')]);router[_0xeabc('0x22')](_0xeabc('0x23'),auth['isAuthenticated'](),controller[_0xeabc('0x24')]);router['delete'](_0xeabc('0xc'),auth['isAuthenticated'](),controller[_0xeabc('0x25')]);router[_0xeabc('0x22')](_0xeabc('0xe'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x26')]);router[_0xeabc('0x22')](_0xeabc('0x15'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xeabc('0x27')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 105eff9..31b109c 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 _0x475f=['ENUM','twilio','skebby','connectel','plivo','bandwidth','csc','infobip','intelepeer','BOOLEAN','TEXT','INTEGER','setDataValue','mandatoryDispositionPauseId','STRING','name'];(function(_0x4f2c6e,_0x610dbe){var _0x1ad0b7=function(_0x46421e){while(--_0x46421e){_0x4f2c6e['push'](_0x4f2c6e['shift']());}};_0x1ad0b7(++_0x610dbe);}(_0x475f,0x1ae));var _0xf475=function(_0x3abef0,_0x435f6b){_0x3abef0=_0x3abef0-0x0;var _0x58d5a3=_0x475f[_0x3abef0];return _0x58d5a3;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0xf475('0x0')],'unique':_0xf475('0x1'),'allowNull':![]},'key':{'type':Sequelize[_0xf475('0x0')],'allowNull':![]},'remote':{'type':Sequelize[_0xf475('0x0')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xf475('0x0')]},'type':{'type':Sequelize[_0xf475('0x2')](_0xf475('0x3'),_0xf475('0x4'),_0xf475('0x5'),'clicksend',_0xf475('0x6'),'clickatell',_0xf475('0x7'),_0xf475('0x8'),_0xf475('0x9'),_0xf475('0xa'))},'accountSid':{'type':Sequelize[_0xf475('0x0')]},'authId':{'type':Sequelize[_0xf475('0x0')]},'authToken':{'type':Sequelize[_0xf475('0x0')]},'smsMethod':{'type':Sequelize[_0xf475('0x2')]('SI','TI','GP')},'username':{'type':Sequelize[_0xf475('0x0')]},'password':{'type':Sequelize[_0xf475('0x0')]},'apiKey':{'type':Sequelize[_0xf475('0x0')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0xf475('0x0')]},'deliveryReport':{'type':Sequelize[_0xf475('0xb')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xf475('0xc')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xf475('0xb')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf475('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf475('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xf475('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf475('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xf475('0x0')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf475('0xd')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xf475('0xb')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1dbf13){if(!_0x1dbf13)this[_0xf475('0xe')](_0xf475('0xf'),null);this[_0xf475('0xe')]('mandatoryDisposition',_0x1dbf13);}}}; \ No newline at end of file +var _0xe709=['STRING','twilio','skebby','plivo','bandwidth','csc','infobip','intelepeer','ENUM','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','setDataValue','sequelize','exports','name'];(function(_0x2d97e4,_0x1ac3af){var _0x5eb7e1=function(_0x2bb817){while(--_0x2bb817){_0x2d97e4['push'](_0x2d97e4['shift']());}};_0x5eb7e1(++_0x1ac3af);}(_0xe709,0x6f));var _0x9e70=function(_0x5eb709,_0x2eb81d){_0x5eb709=_0x5eb709-0x0;var _0x29e851=_0xe709[_0x5eb709];return _0x29e851;};'use strict';var Sequelize=require(_0x9e70('0x0'));var rs=require('randomstring');module[_0x9e70('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x9e70('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x9e70('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x9e70('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x9e70('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x9e70('0x3')]},'type':{'type':Sequelize['ENUM'](_0x9e70('0x4'),_0x9e70('0x5'),'connectel','clicksend',_0x9e70('0x6'),'clickatell',_0x9e70('0x7'),_0x9e70('0x8'),_0x9e70('0x9'),_0x9e70('0xa'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x9e70('0x3')]},'authToken':{'type':Sequelize[_0x9e70('0x3')]},'smsMethod':{'type':Sequelize[_0x9e70('0xb')]('SI','TI','GP')},'username':{'type':Sequelize[_0x9e70('0x3')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0x9e70('0x3')]},'accountId':{'type':Sequelize[_0x9e70('0x3')]},'senderString':{'type':Sequelize[_0x9e70('0x3')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x9e70('0x3')]},'notificationTemplate':{'type':Sequelize[_0x9e70('0xc')],'defaultValue':function(){return _0x9e70('0xd');}},'notificationSound':{'type':Sequelize[_0x9e70('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9e70('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9e70('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x9e70('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9e70('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9e70('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9e70('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x9e70('0x10')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1dce60){if(!_0x1dce60)this['setDataValue'](_0x9e70('0x11'),null);this[_0x9e70('0x12')]('mandatoryDisposition',_0x1dce60);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 4f321aa..d2dcb30 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 _0x2bae=['destroy','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','notify','SmsApplication','Applications','account','applications','priority','asc','CmContact','Sequelize','createdAt','updatedAt','difference','ListId','mobile','twilio','from','From','Body','MessageSid','skebby','text','connectel','clicksend','messageId','Text','MessageUUID','results','csc','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','ValidationError','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','CmList','Contacts','DESC','list','omit','contact','SmsInteraction','spread','interaction','created','autoclose','push','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','Start','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','addApplications','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','color','tag','List','out','user','Messages','dataValues','received\x20delivery\x20report\x20from','skebby_dispatch_id','requestid','statusInt','status_code','message_id','infobip','groupName','DELIVERED','redif','inspect','error_code','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','ejs','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','json','offset','undefined','limit','count','set','apply','save','update','get','SmsAccounts','stack','name','send','Pause','map','SmsAccount','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','rawAttributes','find','create','body','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x4d3329,_0x53e55b){var _0x3abb35=function(_0x10e135){while(--_0x10e135){_0x4d3329['push'](_0x4d3329['shift']());}};_0x3abb35(++_0x53e55b);}(_0x2bae,0x7b));var _0xe2ba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2bae[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xe2ba('0x0'));var rimraf=require(_0xe2ba('0x1'));var zipdir=require(_0xe2ba('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe2ba('0x3'));var moment=require(_0xe2ba('0x4'));var BPromise=require(_0xe2ba('0x5'));var Mustache=require(_0xe2ba('0x6'));var util=require('util');var path=require(_0xe2ba('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe2ba('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe2ba('0x9'));var crypto=require(_0xe2ba('0xa'));var jsforce=require(_0xe2ba('0xb'));var deskjs=require(_0xe2ba('0xc'));var toCsv=require(_0xe2ba('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe2ba('0xe'));var authService=require(_0xe2ba('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe2ba('0x10'));var logger=require('../../config/logger')(_0xe2ba('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe2ba('0x12'));var db=require(_0xe2ba('0x13'))['db'];config[_0xe2ba('0x14')]=_[_0xe2ba('0x15')](config['redis'],{'host':_0xe2ba('0x16'),'port':0x18eb});var socket=require(_0xe2ba('0x17'))(new Redis(config['redis']));require(_0xe2ba('0x18'))[_0xe2ba('0x19')](socket);var jayson=require('jayson/promise');var client=jayson[_0xe2ba('0x1a')][_0xe2ba('0x1b')]({'port':0x232c});function respondWithRpcPromise(_0x4d9855,_0x189e17,_0x38f788,_0x8afbf2){return new BPromise(function(_0x6046fd,_0x114c8e){var _0x4f78fe=_0x8afbf2||client;return _0x4f78fe[_0xe2ba('0x1c')](_0x4d9855,_0x38f788)[_0xe2ba('0x1d')](function(_0x5cbfda){logger[_0xe2ba('0x1e')](_0xe2ba('0x1f'),_0x189e17,_0xe2ba('0x20'));logger[_0xe2ba('0x21')](_0xe2ba('0x22'),_0x189e17,_0xe2ba('0x20'),JSON[_0xe2ba('0x23')](_0x5cbfda));if(_0x5cbfda[_0xe2ba('0x24')]){if(_0x5cbfda['error'][_0xe2ba('0x25')]===0x1f4){logger[_0xe2ba('0x24')]('SmsAccount,\x20%s,\x20%s',_0x189e17,_0x5cbfda[_0xe2ba('0x24')][_0xe2ba('0x26')]);return _0x114c8e(_0x5cbfda[_0xe2ba('0x24')][_0xe2ba('0x26')]);}logger[_0xe2ba('0x24')](_0xe2ba('0x1f'),_0x189e17,_0x5cbfda[_0xe2ba('0x24')][_0xe2ba('0x26')]);return _0x6046fd(_0x5cbfda['error']['message']);}else{logger[_0xe2ba('0x1e')](_0xe2ba('0x1f'),_0x189e17,_0xe2ba('0x20'));_0x6046fd(_0x5cbfda['result'][_0xe2ba('0x26')]);}})[_0xe2ba('0x27')](function(_0x1484c2){logger['error'](_0xe2ba('0x1f'),_0x189e17,_0x1484c2);_0x114c8e(_0x1484c2);});});}function respondWithStatusCode(_0x2bf1f9,_0x55007d){_0x55007d=_0x55007d||0xcc;return function(_0xcc27b0){if(_0xcc27b0){return _0x2bf1f9['sendStatus'](_0x55007d);}return _0x2bf1f9[_0xe2ba('0x28')](_0x55007d)[_0xe2ba('0x29')]();};}function respondWithResult(_0x4eb12c,_0x4e1803){_0x4e1803=_0x4e1803||0xc8;return function(_0xff3067){if(_0xff3067){return _0x4eb12c[_0xe2ba('0x28')](_0x4e1803)[_0xe2ba('0x2a')](_0xff3067);}};}function respondWithFilteredResult(_0x38a415,_0x2ac294){return function(_0x283ebf){if(_0x283ebf){var _0x25d533=typeof _0x2ac294[_0xe2ba('0x2b')]===_0xe2ba('0x2c')&&typeof _0x2ac294[_0xe2ba('0x2d')]==='undefined';var _0x2e496b=_0x283ebf['count'];var _0x407b86=_0x25d533?0x0:_0x2ac294[_0xe2ba('0x2b')];var _0x353e26=_0x25d533?_0x283ebf[_0xe2ba('0x2e')]:_0x2ac294['offset']+_0x2ac294['limit'];var _0x3b4aa0;if(_0x353e26>=_0x2e496b){_0x353e26=_0x2e496b;_0x3b4aa0=0xc8;}else{_0x3b4aa0=0xce;}_0x38a415[_0xe2ba('0x28')](_0x3b4aa0);return _0x38a415[_0xe2ba('0x2f')]('Content-Range',_0x407b86+'-'+_0x353e26+'/'+_0x2e496b)[_0xe2ba('0x2a')](_0x283ebf);}return null;};}function patchUpdates(_0xa045b0){return function(_0x5c65d9){try{jsonpatch[_0xe2ba('0x30')](_0x5c65d9,_0xa045b0,!![]);}catch(_0x56c4cb){return BPromise['reject'](_0x56c4cb);}return _0x5c65d9[_0xe2ba('0x31')]();};}function saveUpdates(_0x1afe1d,_0x361fe3){return function(_0xb375c9){if(_0xb375c9){return _0xb375c9[_0xe2ba('0x32')](_0x1afe1d)[_0xe2ba('0x1d')](function(_0x58daf8){return _0x58daf8;});}return null;};}function removeEntity(_0x516001,_0x27d882){return function(_0x54a250){if(_0x54a250){return _0x54a250['destroy']()[_0xe2ba('0x1d')](function(){var _0x14d4be=_0x54a250[_0xe2ba('0x33')]({'plain':!![]});var _0x440af8=_0xe2ba('0x34');return db['UserProfileResource']['destroy']({'where':{'type':_0x440af8,'resourceId':_0x14d4be['id']}})['then'](function(){return _0x54a250;});})[_0xe2ba('0x1d')](function(){_0x516001[_0xe2ba('0x28')](0xcc)[_0xe2ba('0x29')]();});}};}function handleEntityNotFound(_0x504ca5,_0x2c1347){return function(_0x5a985e){if(!_0x5a985e){_0x504ca5['sendStatus'](0x194);}return _0x5a985e;};}function handleError(_0x355cb4,_0x11530e){_0x11530e=_0x11530e||0x1f4;return function(_0x303f46){logger[_0xe2ba('0x24')](_0x303f46[_0xe2ba('0x35')]);if(_0x303f46[_0xe2ba('0x36')]){delete _0x303f46[_0xe2ba('0x36')];}_0x355cb4[_0xe2ba('0x28')](_0x11530e)[_0xe2ba('0x37')](_0x303f46);};}exports['index']=function(_0x4db9bf,_0xc0b689){var _0x8f24fa={'include':[{'model':db[_0xe2ba('0x38')],'as':'mandatoryDispositionPause'}]},_0x2497d0={},_0x35163a={'count':0x0,'rows':[]};var _0x8e19cd=_[_0xe2ba('0x39')](db[_0xe2ba('0x3a')]['rawAttributes'],function(_0x39aa82){return{'name':_0x39aa82[_0xe2ba('0x3b')],'type':_0x39aa82[_0xe2ba('0x3c')][_0xe2ba('0x3d')]};});_0x2497d0['model']=_['map'](_0x8e19cd,_0xe2ba('0x36'));_0x2497d0[_0xe2ba('0x3e')]=_[_0xe2ba('0x3f')](_0x4db9bf[_0xe2ba('0x3e')]);_0x2497d0['filters']=_[_0xe2ba('0x40')](_0x2497d0[_0xe2ba('0x41')],_0x2497d0[_0xe2ba('0x3e')]);_0x8f24fa[_0xe2ba('0x42')]=_[_0xe2ba('0x40')](_0x2497d0[_0xe2ba('0x41')],qs[_0xe2ba('0x43')](_0x4db9bf[_0xe2ba('0x3e')]['fields']));_0x8f24fa['attributes']=_0x8f24fa[_0xe2ba('0x42')][_0xe2ba('0x44')]?_0x8f24fa[_0xe2ba('0x42')]:_0x2497d0['model'];if(!_0x4db9bf['query'][_0xe2ba('0x45')](_0xe2ba('0x46'))){_0x8f24fa[_0xe2ba('0x2d')]=qs[_0xe2ba('0x2d')](_0x4db9bf[_0xe2ba('0x3e')][_0xe2ba('0x2d')]);_0x8f24fa[_0xe2ba('0x2b')]=qs[_0xe2ba('0x2b')](_0x4db9bf[_0xe2ba('0x3e')][_0xe2ba('0x2b')]);}_0x8f24fa[_0xe2ba('0x47')]=qs[_0xe2ba('0x48')](_0x4db9bf[_0xe2ba('0x3e')][_0xe2ba('0x48')]);_0x8f24fa[_0xe2ba('0x49')]=qs['filters'](_[_0xe2ba('0x4a')](_0x4db9bf[_0xe2ba('0x3e')],_0x2497d0[_0xe2ba('0x4b')]),_0x8e19cd);if(_0x4db9bf['query']['filter']){_0x8f24fa[_0xe2ba('0x49')]=_['merge'](_0x8f24fa[_0xe2ba('0x49')],{'$or':_['map'](_0x8e19cd,function(_0xd26c94){if(_0xd26c94[_0xe2ba('0x3c')]!==_0xe2ba('0x4c')){var _0x1fc447={};_0x1fc447[_0xd26c94[_0xe2ba('0x36')]]={'$like':'%'+_0x4db9bf[_0xe2ba('0x3e')][_0xe2ba('0x4d')]+'%'};return _0x1fc447;}})});}_0x8f24fa=_[_0xe2ba('0x4e')]({},_0x8f24fa,_0x4db9bf[_0xe2ba('0x4f')]);var _0x1e125f={'where':_0x8f24fa['where']};return db[_0xe2ba('0x3a')][_0xe2ba('0x2e')](_0x1e125f)['then'](function(_0x5e573b){_0x35163a[_0xe2ba('0x2e')]=_0x5e573b;if(_0x4db9bf[_0xe2ba('0x3e')][_0xe2ba('0x50')]){_0x8f24fa[_0xe2ba('0x51')]=[{'all':!![]}];}return db['SmsAccount'][_0xe2ba('0x52')](_0x8f24fa);})[_0xe2ba('0x1d')](function(_0x30c1a1){_0x35163a[_0xe2ba('0x53')]=_0x30c1a1;return _0x35163a;})[_0xe2ba('0x1d')](respondWithFilteredResult(_0xc0b689,_0x8f24fa))[_0xe2ba('0x27')](handleError(_0xc0b689,null));};exports[_0xe2ba('0x54')]=function(_0x278c53,_0x18548a){var _0x61207a={'raw':![],'where':{'id':_0x278c53[_0xe2ba('0x55')]['id']},'include':[{'model':db[_0xe2ba('0x38')],'as':_0xe2ba('0x56')}]},_0x270aab={};_0x270aab['model']=_[_0xe2ba('0x3f')](db[_0xe2ba('0x3a')][_0xe2ba('0x57')]);_0x270aab['query']=_['keys'](_0x278c53[_0xe2ba('0x3e')]);_0x270aab[_0xe2ba('0x4b')]=_['intersection'](_0x270aab['model'],_0x270aab[_0xe2ba('0x3e')]);_0x61207a[_0xe2ba('0x42')]=_[_0xe2ba('0x40')](_0x270aab[_0xe2ba('0x41')],qs[_0xe2ba('0x43')](_0x278c53[_0xe2ba('0x3e')]['fields']));_0x61207a[_0xe2ba('0x42')]=_0x61207a[_0xe2ba('0x42')]['length']?_0x61207a[_0xe2ba('0x42')]:_0x270aab[_0xe2ba('0x41')];if(_0x278c53['query'][_0xe2ba('0x50')]){_0x61207a[_0xe2ba('0x51')]=[{'all':!![]}];}_0x61207a=_[_0xe2ba('0x4e')]({},_0x61207a,_0x278c53[_0xe2ba('0x4f')]);return db[_0xe2ba('0x3a')][_0xe2ba('0x58')](_0x61207a)[_0xe2ba('0x1d')](handleEntityNotFound(_0x18548a,null))[_0xe2ba('0x1d')](respondWithResult(_0x18548a,null))['catch'](handleError(_0x18548a,null));};exports['create']=function(_0x37fc2f,_0x1c18ab){return db[_0xe2ba('0x3a')][_0xe2ba('0x59')](_0x37fc2f[_0xe2ba('0x5a')],{})[_0xe2ba('0x1d')](function(_0x52cf1f){var _0x35768b=_0x37fc2f['user']['get']({'plain':!![]});if(!_0x35768b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x35768b[_0xe2ba('0x5b')]==='user'){var _0x51193d=_0x52cf1f[_0xe2ba('0x33')]({'plain':!![]});var _0x22e7da=_0xe2ba('0x34');return db[_0xe2ba('0x5c')]['find']({'where':{'name':_0x22e7da,'userProfileId':_0x35768b[_0xe2ba('0x5d')]},'raw':!![]})['then'](function(_0x2ffed2){if(_0x2ffed2&&_0x2ffed2[_0xe2ba('0x5e')]===0x0){return db['UserProfileResource'][_0xe2ba('0x59')]({'name':_0x51193d[_0xe2ba('0x36')],'resourceId':_0x51193d['id'],'type':_0x2ffed2[_0xe2ba('0x36')],'sectionId':_0x2ffed2['id']},{})[_0xe2ba('0x1d')](function(){return _0x52cf1f;});}else{return _0x52cf1f;}})[_0xe2ba('0x27')](function(_0x55761a){logger[_0xe2ba('0x24')](_0xe2ba('0x5f'),_0x55761a);throw _0x55761a;});}return _0x52cf1f;})[_0xe2ba('0x1d')](respondWithResult(_0x1c18ab,0xc9))['catch'](handleError(_0x1c18ab,null));};exports[_0xe2ba('0x32')]=function(_0x565828,_0x4f6b19){if(_0x565828['body']['id']){delete _0x565828['body']['id'];}return db['SmsAccount']['find']({'where':{'id':_0x565828[_0xe2ba('0x55')]['id']},'include':[{'model':db[_0xe2ba('0x38')],'as':_0xe2ba('0x56')}]})[_0xe2ba('0x1d')](handleEntityNotFound(_0x4f6b19,null))[_0xe2ba('0x1d')](saveUpdates(_0x565828[_0xe2ba('0x5a')],null))[_0xe2ba('0x1d')](respondWithResult(_0x4f6b19,null))['catch'](handleError(_0x4f6b19,null));};exports[_0xe2ba('0x60')]=function(_0x4eb814,_0x477861){return db[_0xe2ba('0x3a')][_0xe2ba('0x58')]({'where':{'id':_0x4eb814[_0xe2ba('0x55')]['id']}})['then'](handleEntityNotFound(_0x477861,null))[_0xe2ba('0x1d')](removeEntity(_0x477861,null))[_0xe2ba('0x27')](handleError(_0x477861,null));};exports['describe']=function(_0x7ead61,_0x43c6a2){return db[_0xe2ba('0x3a')][_0xe2ba('0x61')]()[_0xe2ba('0x1d')](respondWithResult(_0x43c6a2,null))[_0xe2ba('0x27')](handleError(_0x43c6a2,null));};exports[_0xe2ba('0x62')]=function(_0x33e3dd,_0x137b74,_0x5b1b6f){if(_0x33e3dd['body']['id']){delete _0x33e3dd[_0xe2ba('0x5a')]['id'];}return db[_0xe2ba('0x3a')][_0xe2ba('0x58')]({'where':{'id':_0x33e3dd[_0xe2ba('0x55')]['id']}})[_0xe2ba('0x1d')](handleEntityNotFound(_0x137b74,null))['then'](function(_0x523223){if(_0x523223){_0x33e3dd[_0xe2ba('0x5a')][_0xe2ba('0x63')]=_0x523223['id'];return db[_0xe2ba('0x64')][_0xe2ba('0x59')](_0x33e3dd['body']);}})[_0xe2ba('0x1d')](respondWithResult(_0x137b74,null))[_0xe2ba('0x27')](handleError(_0x137b74,null));};exports[_0xe2ba('0x65')]=function(_0x2e981d,_0x2f6704,_0x547af4){var _0x43ebf4={'raw':![],'where':{}};var _0x293291={};var _0x13c51c={'count':0x0,'rows':[]};return db[_0xe2ba('0x3a')][_0xe2ba('0x66')]({'where':{'id':_0x2e981d[_0xe2ba('0x55')]['id']}})[_0xe2ba('0x1d')](handleEntityNotFound(_0x2f6704,null))[_0xe2ba('0x1d')](function(_0x226312){if(_0x226312){_0x293291[_0xe2ba('0x41')]=_['keys'](db[_0xe2ba('0x64')]['rawAttributes']);_0x293291[_0xe2ba('0x3e')]=_[_0xe2ba('0x3f')](_0x2e981d[_0xe2ba('0x3e')]);_0x293291['filters']=_['intersection'](_0x293291['model'],_0x293291[_0xe2ba('0x3e')]);_0x43ebf4['attributes']=_['intersection'](_0x293291[_0xe2ba('0x41')],qs[_0xe2ba('0x43')](_0x2e981d[_0xe2ba('0x3e')][_0xe2ba('0x43')]));_0x43ebf4[_0xe2ba('0x42')]=_0x43ebf4[_0xe2ba('0x42')][_0xe2ba('0x44')]?_0x43ebf4[_0xe2ba('0x42')]:_0x293291[_0xe2ba('0x41')];if(!_0x2e981d[_0xe2ba('0x3e')][_0xe2ba('0x45')]('nolimit')){_0x43ebf4[_0xe2ba('0x2d')]=qs[_0xe2ba('0x2d')](_0x2e981d['query'][_0xe2ba('0x2d')]);_0x43ebf4['offset']=qs['offset'](_0x2e981d[_0xe2ba('0x3e')][_0xe2ba('0x2b')]);}_0x43ebf4[_0xe2ba('0x47')]=qs[_0xe2ba('0x48')](_0x2e981d[_0xe2ba('0x3e')][_0xe2ba('0x48')]);_0x43ebf4[_0xe2ba('0x49')]=qs[_0xe2ba('0x4b')](_[_0xe2ba('0x4a')](_0x2e981d['query'],_0x293291['filters']));_0x43ebf4[_0xe2ba('0x49')][_0xe2ba('0x63')]=_0x226312['id'];if(_0x2e981d['query'][_0xe2ba('0x4d')]){_0x43ebf4[_0xe2ba('0x49')]=_[_0xe2ba('0x4e')](_0x43ebf4[_0xe2ba('0x49')],{'$or':_[_0xe2ba('0x39')](_0x43ebf4[_0xe2ba('0x42')],function(_0x571723){var _0x1a7e65={};_0x1a7e65[_0x571723]={'$like':'%'+_0x2e981d[_0xe2ba('0x3e')]['filter']+'%'};return _0x1a7e65;})});}_0x43ebf4=_['merge']({},_0x43ebf4,_0x2e981d[_0xe2ba('0x4f')]);return db[_0xe2ba('0x64')][_0xe2ba('0x2e')]({'where':_0x43ebf4[_0xe2ba('0x49')]})['then'](function(_0x6a020f){_0x13c51c[_0xe2ba('0x2e')]=_0x6a020f;if(_0x2e981d['query'][_0xe2ba('0x50')]){_0x43ebf4[_0xe2ba('0x51')]=[{'all':!![]}];}return db[_0xe2ba('0x64')]['findAll'](_0x43ebf4);})[_0xe2ba('0x1d')](function(_0x5c5b0c){_0x13c51c[_0xe2ba('0x53')]=_0x5c5b0c;return _0x13c51c;});}})['then'](respondWithFilteredResult(_0x2f6704,_0x43ebf4))[_0xe2ba('0x27')](handleError(_0x2f6704,null));};exports[_0xe2ba('0x67')]=function(_0x5df806,_0x41c37e,_0x38e394){return db[_0xe2ba('0x3a')]['find']({'where':{'id':_0x5df806[_0xe2ba('0x55')]['id']}})[_0xe2ba('0x1d')](handleEntityNotFound(_0x41c37e,null))[_0xe2ba('0x1d')](function(_0x8e6e7a){if(_0x8e6e7a){return _0x8e6e7a[_0xe2ba('0x67')](_0x5df806[_0xe2ba('0x3e')][_0xe2ba('0x68')]);}})[_0xe2ba('0x1d')](respondWithStatusCode(_0x41c37e,null))['catch'](handleError(_0x41c37e,null));};exports['addAnswer']=function(_0x5cef03,_0x19bc83,_0x157944){if(_0x5cef03[_0xe2ba('0x5a')]['id']){delete _0x5cef03[_0xe2ba('0x5a')]['id'];}return db[_0xe2ba('0x3a')][_0xe2ba('0x58')]({'where':{'id':_0x5cef03[_0xe2ba('0x55')]['id']}})['then'](handleEntityNotFound(_0x19bc83,null))[_0xe2ba('0x1d')](function(_0x2e56f1){if(_0x2e56f1){_0x5cef03[_0xe2ba('0x5a')][_0xe2ba('0x63')]=_0x2e56f1['id'];return db[_0xe2ba('0x69')]['create'](_0x5cef03[_0xe2ba('0x5a')]);}})[_0xe2ba('0x1d')](respondWithResult(_0x19bc83,null))[_0xe2ba('0x27')](handleError(_0x19bc83,null));};exports[_0xe2ba('0x6a')]=function(_0x1e67c6,_0x10460e,_0x163ff0){var _0x46ba28={'raw':![],'where':{}};var _0x4840f0={};var _0x482c58={'count':0x0,'rows':[]};return db[_0xe2ba('0x3a')][_0xe2ba('0x66')]({'where':{'id':_0x1e67c6['params']['id']}})['then'](handleEntityNotFound(_0x10460e,null))[_0xe2ba('0x1d')](function(_0xbe77a8){if(_0xbe77a8){_0x4840f0['model']=_[_0xe2ba('0x3f')](db[_0xe2ba('0x69')][_0xe2ba('0x57')]);_0x4840f0[_0xe2ba('0x3e')]=_[_0xe2ba('0x3f')](_0x1e67c6['query']);_0x4840f0['filters']=_['intersection'](_0x4840f0[_0xe2ba('0x41')],_0x4840f0[_0xe2ba('0x3e')]);_0x46ba28[_0xe2ba('0x42')]=_[_0xe2ba('0x40')](_0x4840f0[_0xe2ba('0x41')],qs[_0xe2ba('0x43')](_0x1e67c6['query']['fields']));_0x46ba28[_0xe2ba('0x42')]=_0x46ba28[_0xe2ba('0x42')][_0xe2ba('0x44')]?_0x46ba28['attributes']:_0x4840f0['model'];if(!_0x1e67c6['query'][_0xe2ba('0x45')](_0xe2ba('0x46'))){_0x46ba28['limit']=qs[_0xe2ba('0x2d')](_0x1e67c6[_0xe2ba('0x3e')][_0xe2ba('0x2d')]);_0x46ba28[_0xe2ba('0x2b')]=qs[_0xe2ba('0x2b')](_0x1e67c6[_0xe2ba('0x3e')][_0xe2ba('0x2b')]);}_0x46ba28[_0xe2ba('0x47')]=qs[_0xe2ba('0x48')](_0x1e67c6[_0xe2ba('0x3e')][_0xe2ba('0x48')]);_0x46ba28[_0xe2ba('0x49')]=qs[_0xe2ba('0x4b')](_[_0xe2ba('0x4a')](_0x1e67c6[_0xe2ba('0x3e')],_0x4840f0['filters']));_0x46ba28['where'][_0xe2ba('0x63')]=_0xbe77a8['id'];if(_0x1e67c6[_0xe2ba('0x3e')][_0xe2ba('0x4d')]){_0x46ba28[_0xe2ba('0x49')]=_[_0xe2ba('0x4e')](_0x46ba28[_0xe2ba('0x49')],{'$or':_[_0xe2ba('0x39')](_0x46ba28[_0xe2ba('0x42')],function(_0x535c25){var _0x20c297={};_0x20c297[_0x535c25]={'$like':'%'+_0x1e67c6[_0xe2ba('0x3e')]['filter']+'%'};return _0x20c297;})});}_0x46ba28=_[_0xe2ba('0x4e')]({},_0x46ba28,_0x1e67c6[_0xe2ba('0x4f')]);return db['CannedAnswer'][_0xe2ba('0x2e')]({'where':_0x46ba28[_0xe2ba('0x49')]})[_0xe2ba('0x1d')](function(_0x53d0af){_0x482c58['count']=_0x53d0af;if(_0x1e67c6[_0xe2ba('0x3e')][_0xe2ba('0x50')]){_0x46ba28['include']=[{'all':!![]}];}return db[_0xe2ba('0x69')][_0xe2ba('0x52')](_0x46ba28);})['then'](function(_0x20fe6a){_0x482c58[_0xe2ba('0x53')]=_0x20fe6a;return _0x482c58;});}})[_0xe2ba('0x1d')](respondWithFilteredResult(_0x10460e,_0x46ba28))['catch'](handleError(_0x10460e,null));};exports[_0xe2ba('0x6b')]=function(_0x2dafcb,_0x447028,_0x55c8dd){return db[_0xe2ba('0x3a')][_0xe2ba('0x58')]({'where':{'id':_0x2dafcb[_0xe2ba('0x55')]['id']}})[_0xe2ba('0x1d')](handleEntityNotFound(_0x447028,null))[_0xe2ba('0x1d')](function(_0x28e0e5){if(_0x28e0e5){return _0x28e0e5[_0xe2ba('0x6b')](_0x2dafcb['query'][_0xe2ba('0x68')]);}})[_0xe2ba('0x1d')](respondWithStatusCode(_0x447028,null))[_0xe2ba('0x27')](handleError(_0x447028,null));};exports[_0xe2ba('0x6c')]=function(_0xe97090,_0x293f4b,_0x5bead4){var _0x189640={'channel':'sms'};var _0x498e76=[];var _0x27edfe=[];var _0x207285={};return db['SmsAccount'][_0xe2ba('0x58')]({'where':{'id':_0xe97090[_0xe2ba('0x55')]['id']},'include':[{'model':db[_0xe2ba('0x6d')],'as':_0xe2ba('0x6e')}]})[_0xe2ba('0x1d')](handleEntityNotFound(_0x293f4b,null))['then'](function(_0x403674){_0x189640[_0xe2ba('0x6f')]=_0x403674;_0x189640[_0xe2ba('0x70')]=_['orderBy'](_0x403674[_0xe2ba('0x6e')],[_0xe2ba('0x71')],[_0xe2ba('0x72')]);if(_0x189640['account'][_0xe2ba('0x6e')]){delete _0x189640[_0xe2ba('0x6f')][_0xe2ba('0x6e')];}return db[_0xe2ba('0x73')]['describe']();})['then'](function(_0xc57275){if(!_0xc57275){throw new db[(_0xe2ba('0x74'))]['ValidationError']('no\x20available\x20attributes');}_0x498e76=_['difference'](_[_0xe2ba('0x3f')](_0xc57275),[_0xe2ba('0x75'),_0xe2ba('0x76')]);_0x27edfe=_[_0xe2ba('0x77')](_['keys'](_0xc57275),['createdAt',_0xe2ba('0x76'),'CompanyId',_0xe2ba('0x78')]);_0x189640[_0xe2ba('0x5a')]={'mapKey':_0xe2ba('0x79')};if(_0x189640[_0xe2ba('0x6f')][_0xe2ba('0x3c')]){switch(_0x189640[_0xe2ba('0x6f')][_0xe2ba('0x3c')]){case _0xe2ba('0x7a'):_0x189640[_0xe2ba('0x5a')][_0xe2ba('0x7b')]=_0xe97090[_0xe2ba('0x5a')][_0xe2ba('0x7c')];_0x189640[_0xe2ba('0x5a')][_0xe2ba('0x5a')]=_0xe97090['body'][_0xe2ba('0x7d')];_0x189640['body']['messageId']=_0xe97090[_0xe2ba('0x5a')][_0xe2ba('0x7e')];break;case _0xe2ba('0x7f'):_0x189640[_0xe2ba('0x5a')][_0xe2ba('0x7b')]='+'+_0xe97090[_0xe2ba('0x5a')]['sender'];_0x189640[_0xe2ba('0x5a')]['body']=_0xe97090[_0xe2ba('0x5a')][_0xe2ba('0x80')];break;case _0xe2ba('0x81'):_0x189640[_0xe2ba('0x5a')]['from']=_0xe97090[_0xe2ba('0x5a')]['from'];_0x189640[_0xe2ba('0x5a')][_0xe2ba('0x5a')]=_0xe97090[_0xe2ba('0x5a')][_0xe2ba('0x26')];break;case _0xe2ba('0x82'):_0x189640[_0xe2ba('0x5a')][_0xe2ba('0x7b')]=_0xe97090[_0xe2ba('0x5a')]['from'];_0x189640[_0xe2ba('0x5a')][_0xe2ba('0x5a')]=_0xe97090[_0xe2ba('0x5a')][_0xe2ba('0x5a')];_0x189640[_0xe2ba('0x5a')][_0xe2ba('0x83')]=_0xe97090[_0xe2ba('0x5a')]['message_id'];break;case'plivo':_0x189640[_0xe2ba('0x5a')][_0xe2ba('0x7b')]=_0xe97090[_0xe2ba('0x5a')][_0xe2ba('0x7c')];_0x189640[_0xe2ba('0x5a')][_0xe2ba('0x5a')]=_0xe97090[_0xe2ba('0x5a')][_0xe2ba('0x84')];_0x189640[_0xe2ba('0x5a')][_0xe2ba('0x83')]=_0xe97090['body'][_0xe2ba('0x85')];break;case'infobip':_0x189640[_0xe2ba('0x5a')][_0xe2ba('0x7b')]='+'+_0xe97090['body'][_0xe2ba('0x86')][0x0][_0xe2ba('0x7b')];_0x189640['body'][_0xe2ba('0x5a')]=_0xe97090['body'][_0xe2ba('0x86')][0x0][_0xe2ba('0x80')];_0x189640[_0xe2ba('0x5a')][_0xe2ba('0x83')]=_0xe97090[_0xe2ba('0x5a')][_0xe2ba('0x86')][0x0][_0xe2ba('0x83')];break;case _0xe2ba('0x87'):_0x189640['body'][_0xe2ba('0x7b')]=_0xe97090[_0xe2ba('0x5a')]['originatingAddress'];_0x189640[_0xe2ba('0x5a')][_0xe2ba('0x5a')]=_0xe97090[_0xe2ba('0x5a')][_0xe2ba('0x88')]['message'];break;case _0xe2ba('0x89'):_0x189640[_0xe2ba('0x5a')][_0xe2ba('0x7b')]=_0xe97090['body'][_0xe2ba('0x8a')];_0x189640[_0xe2ba('0x5a')][_0xe2ba('0x5a')]=_0xe97090['body'][_0xe2ba('0x80')];_0x189640['body'][_0xe2ba('0x83')]=_0xe97090[_0xe2ba('0x5a')][_0xe2ba('0x8b')];break;case _0xe2ba('0x8c'):_0x189640[_0xe2ba('0x5a')][_0xe2ba('0x83')]=_0xe97090['body'][0x0][_0xe2ba('0x26')]['id'];_0x189640[_0xe2ba('0x5a')][_0xe2ba('0x7b')]=_0xe97090[_0xe2ba('0x5a')][0x0]['message'][_0xe2ba('0x7b')];_0x189640[_0xe2ba('0x5a')][_0xe2ba('0x5a')]=_0xe97090['body'][0x0][_0xe2ba('0x26')][_0xe2ba('0x80')];break;case _0xe2ba('0x8d'):_0x189640['body'][_0xe2ba('0x7b')]=_0xe97090[_0xe2ba('0x5a')]['from'];_0x189640['body'][_0xe2ba('0x5a')]=_0xe97090[_0xe2ba('0x5a')][_0xe2ba('0x26')];_0x189640[_0xe2ba('0x5a')]['messageId']=_0xe97090[_0xe2ba('0x5a')][_0xe2ba('0x8e')];break;}}if(_0x189640[_0xe2ba('0x5a')]['id']){delete _0x189640[_0xe2ba('0x5a')]['id'];}if(_[_0xe2ba('0x8f')](_0x189640[_0xe2ba('0x5a')][_0xe2ba('0x7b')])){throw new db[(_0xe2ba('0x74'))][(_0xe2ba('0x90'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x189640[_0xe2ba('0x5a')][_0xe2ba('0x5a')])||_0x189640[_0xe2ba('0x5a')][_0xe2ba('0x5a')]===''){throw new db[(_0xe2ba('0x74'))][(_0xe2ba('0x90'))](_0xe2ba('0x91'));}if(_[_0xe2ba('0x8f')](_0x189640[_0xe2ba('0x5a')]['mapKey'])){throw new db[(_0xe2ba('0x74'))][(_0xe2ba('0x90'))](_0xe2ba('0x92')+_0x27edfe);}if(!_[_0xe2ba('0x93')](_0x27edfe,_0x189640[_0xe2ba('0x5a')][_0xe2ba('0x94')])){throw new db['Sequelize']['ValidationError'](_0xe2ba('0x95')+_0x27edfe);}_0x207285[_0x189640[_0xe2ba('0x5a')]['mapKey']]=_0x189640['body'][_0xe2ba('0x7b')];return db[_0xe2ba('0x96')][_0xe2ba('0x58')]({'where':{'id':_0x189640[_0xe2ba('0x6f')][_0xe2ba('0x78')]},'include':[{'model':db[_0xe2ba('0x73')],'as':_0xe2ba('0x97'),'where':_0x207285,'limit':0x1,'order':[[_0xe2ba('0x76'),_0xe2ba('0x98')]]}]});})[_0xe2ba('0x1d')](handleEntityNotFound(_0x293f4b,null))['then'](function(_0x8822f1){if(_0x8822f1){_0x189640[_0xe2ba('0x99')]=_[_0xe2ba('0x9a')](_0x8822f1,[_0xe2ba('0x97')]);if(_0x8822f1[_0xe2ba('0x97')][_0xe2ba('0x44')]){return _0x8822f1['Contacts'][0x0];}var _0x2c49e4=_[_0xe2ba('0x15')](_0x189640[_0xe2ba('0x5a')],{'firstName':_0x189640[_0xe2ba('0x5a')]['from'],'ListId':_0x8822f1['id']});_0x2c49e4[_0x189640['body']['mapKey']]=_0x189640[_0xe2ba('0x5a')][_0xe2ba('0x7b')];return db[_0xe2ba('0x73')][_0xe2ba('0x59')](_0x2c49e4,{'fields':_0x498e76,'raw':!![]});}})[_0xe2ba('0x1d')](handleEntityNotFound(_0x293f4b,null))['then'](function(_0x4f67f4){if(_0x4f67f4){_0x189640[_0xe2ba('0x9b')]=_0x4f67f4;var _0x3b4867={'ContactId':_0x4f67f4['id'],'phone':_0x189640[_0xe2ba('0x5a')][_0xe2ba('0x7b')],'SmsAccountId':_0xe97090['params']['id']};var _0x1afab9={'ContactId':_0x4f67f4['id'],'SmsAccountId':_0xe97090['params']['id'],'closed':![]};return db[_0xe2ba('0x9c')][_0xe2ba('0x58')]({'where':_0x1afab9})['then'](function(_0x24b8d2){if(_0x24b8d2){return[_0x24b8d2,![]];}return db[_0xe2ba('0x9c')][_0xe2ba('0x59')](_0x3b4867)[_0xe2ba('0x1d')](function(_0x52bacc){return[_0x52bacc,!![]];});});}})[_0xe2ba('0x9d')](function(_0x555c48,_0x52ee73){_0x189640[_0xe2ba('0x9e')]=_0x555c48[_0xe2ba('0x33')]({'plain':!![]});_0x189640[_0xe2ba('0x9e')][_0xe2ba('0x9f')]=![];if(_0x52ee73){if(_0x189640['account'][_0xe2ba('0xa0')]){_0x189640['applications'][_0xe2ba('0xa1')]({'id':0x0,'priority':_0x189640[_0xe2ba('0x70')][_0xe2ba('0x44')]+0x1,'app':'close','appdata':_0xe2ba('0xa2'),'interval':_0xe2ba('0xa3')});}_0x189640[_0xe2ba('0x9e')][_0xe2ba('0x9f')]=!![];}return db[_0xe2ba('0xa4')][_0xe2ba('0x59')]({'phone':_0x189640['body'][_0xe2ba('0x7b')],'messageId':_0x189640[_0xe2ba('0x5a')]['messageId'],'body':_0x189640[_0xe2ba('0x5a')][_0xe2ba('0x5a')],'SmsAccountId':_0xe97090[_0xe2ba('0x55')]['id'],'SmsInteractionId':_0x555c48['id'],'direction':'in','ContactId':_0x555c48[_0xe2ba('0xa5')],'AttachmentId':_0x189640[_0xe2ba('0x5a')][_0xe2ba('0xa6')]});})[_0xe2ba('0x1d')](function(_0x40a7d5){_0x189640[_0xe2ba('0x26')]=_0x40a7d5;if(_0x189640['interaction'][_0xe2ba('0xa7')]){return db[_0xe2ba('0xa8')][_0xe2ba('0x58')]({'attributes':['id','name'],'where':{'id':_0x189640[_0xe2ba('0x9e')][_0xe2ba('0xa7')]}})[_0xe2ba('0x1d')](function(_0x5e3cf8){if(_0x5e3cf8){_0x189640[_0xe2ba('0x70')][_0xe2ba('0xa9')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5e3cf8['name']+','+(_0x189640[_0xe2ba('0x6f')]['waitForTheAssignedAgent']||0xa),'interval':_0xe2ba('0xa3')});}return respondWithRpcPromise(_0xe2ba('0xaa'),_0xe2ba('0xab'),_0x189640);});}return respondWithRpcPromise(_0xe2ba('0xaa'),_0xe2ba('0xab'),_0x189640);})['then'](function(_0x9b57ad){if(_0x9b57ad){var _0x214e85=0xc8;var _0x50472a=_0xe2ba('0xac');logger[_0xe2ba('0x1e')](_0xe2ba('0x22'),_0x50472a,_0x214e85,'entity\x20found');logger[_0xe2ba('0x21')](_0xe2ba('0xad'),_0x50472a,_0x214e85,'entity\x20found',JSON[_0xe2ba('0x23')](_0x9b57ad));if(_0x189640[_0xe2ba('0x6f')][_0xe2ba('0x3c')]===_0xe2ba('0x7a')){return _0x293f4b[_0xe2ba('0x28')](_0x214e85)[_0xe2ba('0x2f')](_0xe2ba('0xae'),_0xe2ba('0xaf'))['send'](_0xe2ba('0xb0'));}else{return _0x293f4b[_0xe2ba('0x28')](_0x214e85)[_0xe2ba('0x2a')](_0x9b57ad);}}})[_0xe2ba('0x27')](handleError(_0x293f4b,null));};exports[_0xe2ba('0xb1')]=function(_0x2090c5,_0x34ffef,_0x2b30a6){return db['SmsAccount']['findOne']({'where':{'id':_0x2090c5['params']['id']}})[_0xe2ba('0x1d')](handleEntityNotFound(_0x34ffef,null))[_0xe2ba('0x1d')](function(_0x4b3249){if(_0x4b3249){return db['sequelize'][_0xe2ba('0xb2')](function(_0xef4be6){return db[_0xe2ba('0x6d')]['destroy']({'where':{'SmsAccountId':_0x2090c5[_0xe2ba('0x55')]['id']},'transaction':_0xef4be6})[_0xe2ba('0x1d')](function(_0x506e93){var _0x44dfdf=_['map'](_0x2090c5[_0xe2ba('0x5a')],function(_0x5c4294){_0x5c4294[_0xe2ba('0x63')]=_0x2090c5[_0xe2ba('0x55')]['id'];return _0x5c4294;});return db[_0xe2ba('0x6d')][_0xe2ba('0xb3')](_0x44dfdf,{'transaction':_0xef4be6});});})['then'](function(){return db[_0xe2ba('0x6d')][_0xe2ba('0xb4')]({'where':{'SmsAccountId':_0x2090c5['params']['id']},'order':_0xe2ba('0x71')});});}})[_0xe2ba('0x1d')](respondWithResult(_0x34ffef,null))[_0xe2ba('0x27')](handleError(_0x34ffef,null));};exports[_0xe2ba('0xb5')]=function(_0x2d0afd,_0x369485,_0xd2778b){var _0x39505e={};var _0x1554e6={};var _0xe8adb9;var _0x2eca64;return db[_0xe2ba('0x3a')][_0xe2ba('0x66')]({'where':{'id':_0x2d0afd['params']['id']}})[_0xe2ba('0x1d')](handleEntityNotFound(_0x369485,null))['then'](function(_0x58c63c){if(_0x58c63c){_0xe8adb9=_0x58c63c;_0x1554e6[_0xe2ba('0x41')]=_['keys'](db[_0xe2ba('0x6d')]['rawAttributes']);_0x1554e6['query']=_[_0xe2ba('0x3f')](_0x2d0afd[_0xe2ba('0x3e')]);_0x1554e6[_0xe2ba('0x4b')]=_[_0xe2ba('0x40')](_0x1554e6[_0xe2ba('0x41')],_0x1554e6[_0xe2ba('0x3e')]);_0x39505e[_0xe2ba('0x42')]=_[_0xe2ba('0x40')](_0x1554e6[_0xe2ba('0x41')],qs[_0xe2ba('0x43')](_0x2d0afd[_0xe2ba('0x3e')]['fields']));_0x39505e[_0xe2ba('0x42')]=_0x39505e[_0xe2ba('0x42')][_0xe2ba('0x44')]?_0x39505e[_0xe2ba('0x42')]:_0x1554e6['model'];_0x39505e[_0xe2ba('0x47')]=qs[_0xe2ba('0x48')](_0x2d0afd[_0xe2ba('0x3e')][_0xe2ba('0x48')]);_0x39505e[_0xe2ba('0x49')]=qs[_0xe2ba('0x4b')](_['pick'](_0x2d0afd['query'],_0x1554e6['filters']));if(_0x2d0afd[_0xe2ba('0x3e')][_0xe2ba('0x4d')]){_0x39505e['where']=_[_0xe2ba('0x4e')](_0x39505e[_0xe2ba('0x49')],{'$or':_[_0xe2ba('0x39')](_0x39505e[_0xe2ba('0x42')],function(_0x5d42d5){var _0x44158e={};_0x44158e[_0x5d42d5]={'$like':'%'+_0x2d0afd[_0xe2ba('0x3e')]['filter']+'%'};return _0x44158e;})});}_0x39505e=_['merge']({},_0x39505e,_0x2d0afd[_0xe2ba('0x4f')]);return _0xe8adb9[_0xe2ba('0xb5')](_0x39505e);}})[_0xe2ba('0x1d')](function(_0x13da07){if(_0x13da07){_0x2eca64=_0x13da07[_0xe2ba('0x44')];if(!_0x2d0afd['query'][_0xe2ba('0x45')](_0xe2ba('0x46'))){_0x39505e[_0xe2ba('0x2d')]=qs[_0xe2ba('0x2d')](_0x2d0afd[_0xe2ba('0x3e')][_0xe2ba('0x2d')]);_0x39505e[_0xe2ba('0x2b')]=qs[_0xe2ba('0x2b')](_0x2d0afd[_0xe2ba('0x3e')]['offset']);}return _0xe8adb9['getApplications'](_0x39505e);}})[_0xe2ba('0x1d')](function(_0x16d436){if(_0x16d436){return _0x16d436?{'count':_0x2eca64,'rows':_0x16d436}:null;}})[_0xe2ba('0x1d')](respondWithResult(_0x369485,null))[_0xe2ba('0x27')](handleError(_0x369485,null));};exports[_0xe2ba('0xb6')]=function(_0x93b22e,_0x1fd8c9,_0x1321b9){var _0x592148={'raw':![],'where':{}};var _0x2d31e8={};var _0x347953={'count':0x0,'rows':[]};return db['SmsAccount'][_0xe2ba('0x66')]({'where':{'id':_0x93b22e[_0xe2ba('0x55')]['id']}})[_0xe2ba('0x1d')](handleEntityNotFound(_0x1fd8c9,null))['then'](function(_0x43a739){if(_0x43a739){_0x2d31e8[_0xe2ba('0x41')]=_[_0xe2ba('0x3f')](db['SmsInteraction'][_0xe2ba('0x57')]);_0x2d31e8[_0xe2ba('0x3e')]=_[_0xe2ba('0x3f')](_0x93b22e[_0xe2ba('0x3e')]);_0x2d31e8[_0xe2ba('0x4b')]=_[_0xe2ba('0x40')](_0x2d31e8[_0xe2ba('0x41')],_0x2d31e8[_0xe2ba('0x3e')]);_0x592148['attributes']=_[_0xe2ba('0x40')](_0x2d31e8[_0xe2ba('0x41')],qs[_0xe2ba('0x43')](_0x93b22e[_0xe2ba('0x3e')][_0xe2ba('0x43')]));_0x592148[_0xe2ba('0x42')]=_0x592148[_0xe2ba('0x42')]['length']?_0x592148[_0xe2ba('0x42')]:_0x2d31e8[_0xe2ba('0x41')];if(!_0x93b22e['query'][_0xe2ba('0x45')]('nolimit')){_0x592148['limit']=qs[_0xe2ba('0x2d')](_0x93b22e[_0xe2ba('0x3e')]['limit']);_0x592148[_0xe2ba('0x2b')]=qs[_0xe2ba('0x2b')](_0x93b22e[_0xe2ba('0x3e')][_0xe2ba('0x2b')]);}_0x592148[_0xe2ba('0x47')]=qs[_0xe2ba('0x48')](_0x93b22e['query'][_0xe2ba('0x48')]);_0x592148['where']=qs['filters'](_[_0xe2ba('0x4a')](_0x93b22e[_0xe2ba('0x3e')],_0x2d31e8[_0xe2ba('0x4b')]));_0x592148['where'][_0xe2ba('0x63')]=_0x43a739['id'];if(_0x93b22e['query'][_0xe2ba('0x4d')]){_0x592148[_0xe2ba('0x49')]=_[_0xe2ba('0x4e')](_0x592148[_0xe2ba('0x49')],{'$or':_[_0xe2ba('0x39')](_0x592148[_0xe2ba('0x42')],function(_0x10fe9d){var _0x5df116={};_0x5df116[_0x10fe9d]={'$like':'%'+_0x93b22e[_0xe2ba('0x3e')][_0xe2ba('0x4d')]+'%'};return _0x5df116;})});}_0x592148=_['merge']({},_0x592148,_0x93b22e[_0xe2ba('0x4f')]);return db[_0xe2ba('0x9c')][_0xe2ba('0x2e')]({'where':_0x592148['where']})[_0xe2ba('0x1d')](function(_0x4e2ed0){_0x347953['count']=_0x4e2ed0;if(_0x93b22e['query'][_0xe2ba('0x50')]){_0x592148['include']=[{'model':db[_0xe2ba('0x73')],'as':_0xe2ba('0xb7'),'required':![]},{'model':db[_0xe2ba('0xa8')],'as':_0xe2ba('0xb8'),'attributes':[_0xe2ba('0x36'),_0xe2ba('0xb9'),_0xe2ba('0xba')],'required':![]},{'model':db[_0xe2ba('0xbb')],'as':'Tags','attributes':['id','name',_0xe2ba('0xbc')],'where':_0x93b22e[_0xe2ba('0x3e')][_0xe2ba('0xbd')]?{'id':_0x93b22e[_0xe2ba('0x3e')]['tag']}:undefined,'required':_0x93b22e[_0xe2ba('0x3e')][_0xe2ba('0xbd')]?!![]:![]}];}return db['SmsInteraction'][_0xe2ba('0x52')](_0x592148);})[_0xe2ba('0x1d')](function(_0x5310da){_0x347953[_0xe2ba('0x53')]=_0x5310da;return _0x347953;});}})['then'](respondWithFilteredResult(_0x1fd8c9,_0x592148))[_0xe2ba('0x27')](handleError(_0x1fd8c9,null));};exports[_0xe2ba('0x37')]=function(_0x3c1e51,_0x542c93,_0x3d31b1){var _0x8a4672,_0x341c4f,_0x3167bd;if(_[_0xe2ba('0x8f')](_0x3c1e51['body'][_0xe2ba('0x5a')])||_0x3c1e51['body']['body']===''){throw new db[(_0xe2ba('0x74'))]['ValidationError'](_0xe2ba('0x91'));}if(_[_0xe2ba('0x8f')](_0x3c1e51['body']['to'])){throw new db[(_0xe2ba('0x74'))][(_0xe2ba('0x90'))]('to\x20is\x20mandatory');}_0x8a4672=_0x3c1e51[_0xe2ba('0x5a')]['to'];return db['SmsAccount'][_0xe2ba('0x58')]({'where':{'id':_0x3c1e51[_0xe2ba('0x55')]['id']},'include':[{'model':db['CmList'],'as':_0xe2ba('0xbe'),'include':[{'model':db['CmContact'],'as':_0xe2ba('0x97'),'where':{'mobile':_0x8a4672},'limit':0x1,'order':[[_0xe2ba('0x76'),'DESC']]}]}]})[_0xe2ba('0x1d')](handleEntityNotFound(_0x542c93,null))['then'](function(_0x5c2914){if(_0x5c2914&&_0x5c2914[_0xe2ba('0xbe')]){_0x341c4f=_0x5c2914[_0xe2ba('0x33')]({'plain':!![]});if(_0x341c4f['List']&&_0x341c4f['List'][_0xe2ba('0x97')][_0xe2ba('0x44')]){return _0x341c4f[_0xe2ba('0xbe')][_0xe2ba('0x97')][0x0];}return db[_0xe2ba('0x73')]['create'](_[_0xe2ba('0x15')](_0x3c1e51[_0xe2ba('0x5a')],{'firstName':_0x8a4672,'mobile':_0x8a4672,'phone':_0x8a4672,'ListId':_0x341c4f[_0xe2ba('0x78')]}));}})['then'](handleEntityNotFound(_0x542c93,null))[_0xe2ba('0x1d')](function(_0x14e863){if(_0x14e863){_0x3167bd=_0x14e863;return db[_0xe2ba('0x9c')]['find']({'where':{'ContactId':_0x3167bd['id'],'closed':![],'SmsAccountId':_0x341c4f['id']}})['then'](function(_0x2be3e1){if(_0x2be3e1){return[_0x2be3e1,![]];}return db['SmsInteraction'][_0xe2ba('0x59')]({'UserId':_0x3c1e51['user']['id'],'ContactId':_0x3167bd['id'],'SmsAccountId':_0x341c4f['id'],'phone':_0x8a4672,'firstMsgDirection':_0xe2ba('0xbf'),'Messages':[_[_0xe2ba('0x4e')](_0x3c1e51[_0xe2ba('0x5a')],{'read':![],'body':_0x3c1e51[_0xe2ba('0x5a')][_0xe2ba('0x5a')],'phone':_0x8a4672,'SmsAccountId':_0x341c4f['id'],'UserId':_0x3c1e51[_0xe2ba('0xc0')]['id'],'ContactId':_0x3167bd['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0xe2ba('0xc1')}]})[_0xe2ba('0x1d')](function(_0x347d8b){return[_0x347d8b,!![]];});});}})['spread'](function(_0x5616ba,_0x495932){if(_0x495932){return _0x5616ba;}return db[_0xe2ba('0xa4')][_0xe2ba('0x59')](_[_0xe2ba('0x4e')](_0x3c1e51['body'],{'read':![],'body':_0x3c1e51[_0xe2ba('0x5a')]['body'],'phone':_0x8a4672,'SmsAccountId':_0x341c4f['id'],'SmsInteractionId':_0x5616ba['id'],'UserId':_0x3c1e51[_0xe2ba('0xc0')]['id'],'ContactId':_0x3167bd['id']}))[_0xe2ba('0x1d')](function(_0x500f0b){_0x5616ba[_0xe2ba('0xc2')][_0xe2ba('0xc1')]=[];_0x5616ba[_0xe2ba('0xc2')]['Messages'][_0xe2ba('0xa1')](_0x500f0b[_0xe2ba('0xc2')]);return _0x5616ba;});})['then'](respondWithResult(_0x542c93,null))[_0xe2ba('0x27')](handleError(_0x542c93,null));};exports['status']=function(_0x52131b,_0x539765,_0x530dc4){if(_0x52131b[_0xe2ba('0x5a')]['id']){delete _0x52131b[_0xe2ba('0x5a')]['id'];}var _0x3e8f66,_0x5e9f3,_0x48ede5;return db['SmsAccount'][_0xe2ba('0x58')]({'where':{'id':_0x52131b['params']['id']}})[_0xe2ba('0x1d')](handleEntityNotFound(_0x539765,null))[_0xe2ba('0x1d')](function(_0x3aa03f){if(_0x3aa03f){_0x48ede5=_0x3aa03f;logger['debug'](_0xe2ba('0x22'),_0xe2ba('0x28'),_0xe2ba('0xc3'),_0x3aa03f[_0xe2ba('0x3c')],util['inspect'](_0x52131b[_0xe2ba('0x5a')],{'showHidden':![],'depth':null}));switch(_0x3aa03f[_0xe2ba('0x3c')]){case _0xe2ba('0x7f'):if(_0x52131b[_0xe2ba('0x5a')][_0xe2ba('0xc4')]&&_0x52131b[_0xe2ba('0x5a')]['status']){_0x5e9f3=_0x52131b[_0xe2ba('0x5a')][_0xe2ba('0x28')];return db['SmsMessage'][_0xe2ba('0x58')]({'where':{'messageId':_0x52131b[_0xe2ba('0x5a')]['skebby_dispatch_id']}});}break;case _0xe2ba('0x81'):if(_0x52131b[_0xe2ba('0x5a')][_0xe2ba('0xc5')]&&_0x52131b[_0xe2ba('0x5a')][_0xe2ba('0xc6')]){_0x5e9f3=_0x52131b['body'][_0xe2ba('0xc6')];return db[_0xe2ba('0xa4')][_0xe2ba('0x58')]({'where':{'messageId':_0x52131b['body'][_0xe2ba('0xc5')]}});}break;case _0xe2ba('0x82'):if(_0x52131b[_0xe2ba('0x5a')]['message_id']&&_0x52131b[_0xe2ba('0x5a')][_0xe2ba('0xc7')]){_0x5e9f3=_0x52131b['body']['status_code'];return db[_0xe2ba('0xa4')]['find']({'where':{'messageId':_0x52131b['body'][_0xe2ba('0xc8')]}});}break;case _0xe2ba('0xc9'):var _0x1072b9=_0x52131b[_0xe2ba('0x5a')][_0xe2ba('0x86')][0x0];if(_0x1072b9['messageId']&&_0x1072b9[_0xe2ba('0x28')][_0xe2ba('0xca')]===_0xe2ba('0xcb')){_0x5e9f3=_0x1072b9[_0xe2ba('0x28')][_0xe2ba('0xca')];return db[_0xe2ba('0xa4')][_0xe2ba('0x58')]({'where':{'messageId':_0x1072b9[_0xe2ba('0x83')]}});}break;case _0xe2ba('0x89'):if(_0x52131b['body'][_0xe2ba('0x83')]&&_0x52131b['body'][_0xe2ba('0x28')]){_0x5e9f3=_0x52131b[_0xe2ba('0x5a')][_0xe2ba('0x28')];return db[_0xe2ba('0xa4')][_0xe2ba('0x58')]({'where':{'messageId':_0x52131b[_0xe2ba('0x5a')][_0xe2ba('0x83')]}});}break;case'bandwidth':if(_0x52131b['body'][0x0]['message']['id']){_0x5e9f3=_0x52131b[_0xe2ba('0x5a')][0x0]['type'];return db[_0xe2ba('0xa4')]['find']({'where':{'messageId':_0x52131b['body'][0x0][_0xe2ba('0x26')]['id']}});}break;case'intelepeer':if(_0x52131b[_0xe2ba('0x5a')]['redif']&&_0x52131b[_0xe2ba('0x5a')]['status']){_0x5e9f3=_0x52131b[_0xe2ba('0x5a')][_0xe2ba('0x28')];return db['SmsMessage'][_0xe2ba('0x58')]({'where':{'messageId':_0x52131b[_0xe2ba('0x5a')][_0xe2ba('0xcc')]}});}break;}}})[_0xe2ba('0x1d')](handleEntityNotFound(_0x539765,null))[_0xe2ba('0x1d')](function(_0x2809a2){if(_0x2809a2){_0x3e8f66=_0x2809a2;switch(_0x48ede5[_0xe2ba('0x3c')]){case _0xe2ba('0x7f'):if(_0x5e9f3===_0xe2ba('0xcb')){return _0x3e8f66['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xe2ba('0x7f'),util[_0xe2ba('0xcd')](_0x52131b[_0xe2ba('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xe2ba('0x81'):if(_0x5e9f3==='1'){return _0x3e8f66[_0xe2ba('0x32')]({'read':!![]});}else{logger[_0xe2ba('0x24')](_0xe2ba('0x22'),_0xe2ba('0x28'),_0xe2ba('0x7f'),util['inspect'](_0x52131b['body'],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x52131b[_0xe2ba('0x5a')][_0xe2ba('0xce')]&&_0x5e9f3>=0xc8&&_0x5e9f3<=0xce){return _0x3e8f66[_0xe2ba('0x32')]({'read':!![]});}else{logger[_0xe2ba('0x24')](_0xe2ba('0x22'),_0xe2ba('0x28'),'clicksend',util[_0xe2ba('0xcd')](_0x52131b['body'],{'showHidden':![],'depth':null}));}break;case _0xe2ba('0xc9'):var _0x2a78fd=_0x52131b[_0xe2ba('0x5a')][_0xe2ba('0x86')][0x0];if(_0x2a78fd[_0xe2ba('0x28')][_0xe2ba('0xca')]===_0xe2ba('0xcb')){return _0x3e8f66[_0xe2ba('0x32')]({'read':!![]});}else{logger[_0xe2ba('0x24')](_0xe2ba('0x22'),_0xe2ba('0x28'),'infobip',util[_0xe2ba('0xcd')](_0x52131b[_0xe2ba('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xe2ba('0x89'):if(_0x5e9f3=='DELIVERED_TO_GATEWAY'||_0x5e9f3==_0xe2ba('0xcf')){return _0x3e8f66[_0xe2ba('0x32')]({'read':!![]});}else{logger[_0xe2ba('0x24')](_0xe2ba('0x22'),_0xe2ba('0x28'),_0xe2ba('0x89'),util[_0xe2ba('0xcd')](_0x52131b[_0xe2ba('0x5a')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x5e9f3==_0xe2ba('0xd0')){return _0x3e8f66['update']({'read':!![]});}else{logger['error'](_0xe2ba('0x22'),_0xe2ba('0x28'),_0xe2ba('0x8c'),util[_0xe2ba('0xcd')](_0x52131b[_0xe2ba('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xe2ba('0x8d'):if(_0x5e9f3===_0xe2ba('0xd1')||_0x5e9f3==='ACCEPTD'){return _0x3e8f66[_0xe2ba('0x32')]({'read':!![]});}else{logger[_0xe2ba('0x24')](_0xe2ba('0x22'),'status','intelepeer',util[_0xe2ba('0xcd')](_0x52131b['body'],{'showHidden':![],'depth':null}));}break;}return _0x3e8f66;}})[_0xe2ba('0x1d')](respondWithResult(_0x539765,null))['catch'](handleError(_0x539765,null));};exports[_0xe2ba('0xd2')]=function(_0x23f35a,_0x4feade,_0x47f265){var _0x2378c5,_0x4d3ed2,_0x29e8f5;return db[_0xe2ba('0x3a')][_0xe2ba('0x58')]({'where':{'id':_0x23f35a[_0xe2ba('0x55')]['id']}})['then'](handleEntityNotFound(_0x4feade,null))[_0xe2ba('0x1d')](function(_0x250adc){if(_0x250adc){_0x29e8f5=_0x250adc;logger[_0xe2ba('0x21')](_0xe2ba('0x22'),_0xe2ba('0x28'),_0xe2ba('0xc3'),_0x250adc[_0xe2ba('0x3c')],util[_0xe2ba('0xcd')](_0x23f35a[_0xe2ba('0x3e')],{'showHidden':![],'depth':null}));switch(_0x250adc['type']){case _0xe2ba('0x87'):if(_0x23f35a[_0xe2ba('0x3e')][_0xe2ba('0xd3')]&&_0x23f35a[_0xe2ba('0x3e')][_0xe2ba('0xd4')]){_0x4d3ed2=_0x23f35a[_0xe2ba('0x3e')][_0xe2ba('0xd4')];return db[_0xe2ba('0xa4')][_0xe2ba('0x58')]({'where':{'messageId':_0x23f35a['query'][_0xe2ba('0xd3')]}});}break;}}})[_0xe2ba('0x1d')](handleEntityNotFound(_0x4feade,null))[_0xe2ba('0x1d')](function(_0x388306){if(_0x388306){_0x2378c5=_0x388306;switch(_0x29e8f5['type']){case _0xe2ba('0x87'):if(_0x4d3ed2==='2'||_0x4d3ed2==='6'){return _0x2378c5[_0xe2ba('0x32')]({'read':!![]});}else{logger[_0xe2ba('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','csc',util['inspect'](_0x23f35a[_0xe2ba('0x3e')],{'showHidden':![],'depth':null}));};break;}return _0x2378c5;}})[_0xe2ba('0x1d')](respondWithResult(_0x4feade,null))[_0xe2ba('0x27')](handleError(_0x4feade,null));};exports[_0xe2ba('0xd5')]=function(_0x49b164,_0x2c4fa4,_0x567875){return db['SmsAccount'][_0xe2ba('0x58')]({'where':{'id':_0x49b164[_0xe2ba('0x55')]['id']}})[_0xe2ba('0x1d')](handleEntityNotFound(_0x2c4fa4,null))[_0xe2ba('0x1d')](function(_0x372af7){if(_0x372af7){return _0x372af7[_0xe2ba('0xd5')](_0x49b164[_0xe2ba('0x5a')][_0xe2ba('0x68')],_[_0xe2ba('0x9a')](_0x49b164[_0xe2ba('0x5a')],[_0xe2ba('0x68'),'id'])||{})[_0xe2ba('0x9d')](function(_0x4b9f8b){for(var _0x4f7eee=0x0;_0x4f7eee<_0x49b164[_0xe2ba('0x5a')][_0xe2ba('0x68')][_0xe2ba('0x44')];_0x4f7eee+=0x1){socket[_0xe2ba('0xd6')](_0xe2ba('0xd7'),{'UserId':Number(_0x49b164['body'][_0xe2ba('0x68')][_0x4f7eee]),'SmsAccountId':Number(_0x49b164[_0xe2ba('0x55')]['id'])});}return _0x4b9f8b;});}})['then'](respondWithResult(_0x2c4fa4,null))[_0xe2ba('0x27')](handleError(_0x2c4fa4,null));};exports['removeAgents']=function(_0x38c934,_0x152b4b,_0x1d29ea){return db['SmsAccount'][_0xe2ba('0x58')]({'where':{'id':_0x38c934[_0xe2ba('0x55')]['id']}})[_0xe2ba('0x1d')](handleEntityNotFound(_0x152b4b,null))[_0xe2ba('0x1d')](function(_0x3bc519){if(_0x3bc519){return _0x3bc519['removeAgents'](_0x38c934[_0xe2ba('0x3e')][_0xe2ba('0x68')])['then'](function(){if(_[_0xe2ba('0xd8')](_0x38c934[_0xe2ba('0x3e')][_0xe2ba('0x68')])){for(var _0x200ed9=0x0;_0x200ed9<_0x38c934[_0xe2ba('0x3e')][_0xe2ba('0x68')]['length'];_0x200ed9+=0x1){socket[_0xe2ba('0xd6')]('userSmsAccount:remove',{'UserId':Number(_0x38c934[_0xe2ba('0x3e')]['ids'][_0x200ed9]),'SmsAccountId':Number(_0x38c934[_0xe2ba('0x55')]['id'])});}}else{socket[_0xe2ba('0xd6')](_0xe2ba('0xd9'),{'UserId':Number(_0x38c934[_0xe2ba('0x3e')][_0xe2ba('0x68')]),'SmsAccountId':Number(_0x38c934[_0xe2ba('0x55')]['id'])});}});}})[_0xe2ba('0x1d')](respondWithStatusCode(_0x152b4b,null))[_0xe2ba('0x27')](handleError(_0x152b4b,null));};exports[_0xe2ba('0xda')]=function(_0x45c506,_0x99cec1,_0x493dce){var _0x22371e={};var _0x140a89={};var _0x379f71;var _0xa2d88b;return db['SmsAccount'][_0xe2ba('0x66')]({'where':{'id':_0x45c506[_0xe2ba('0x55')]['id']}})[_0xe2ba('0x1d')](handleEntityNotFound(_0x99cec1,null))['then'](function(_0x3a1204){if(_0x3a1204){_0x379f71=_0x3a1204;_0x140a89[_0xe2ba('0x41')]=_['keys'](db['User'][_0xe2ba('0x57')]);_0x140a89[_0xe2ba('0x3e')]=_[_0xe2ba('0x3f')](_0x45c506['query']);_0x140a89['filters']=_[_0xe2ba('0x40')](_0x140a89[_0xe2ba('0x41')],_0x140a89[_0xe2ba('0x3e')]);_0x22371e[_0xe2ba('0x42')]=_[_0xe2ba('0x40')](_0x140a89[_0xe2ba('0x41')],qs[_0xe2ba('0x43')](_0x45c506[_0xe2ba('0x3e')][_0xe2ba('0x43')]));_0x22371e[_0xe2ba('0x42')]=_0x22371e[_0xe2ba('0x42')]['length']?_0x22371e[_0xe2ba('0x42')]:_0x140a89['model'];_0x22371e[_0xe2ba('0x47')]=qs[_0xe2ba('0x48')](_0x45c506['query'][_0xe2ba('0x48')]);_0x22371e[_0xe2ba('0x49')]=qs[_0xe2ba('0x4b')](_[_0xe2ba('0x4a')](_0x45c506['query'],_0x140a89[_0xe2ba('0x4b')]));if(_0x45c506[_0xe2ba('0x3e')][_0xe2ba('0x4d')]){_0x22371e[_0xe2ba('0x49')]=_['merge'](_0x22371e[_0xe2ba('0x49')],{'$or':_['map'](_0x22371e['attributes'],function(_0x24a482){var _0x4fdff8={};_0x4fdff8[_0x24a482]={'$like':'%'+_0x45c506[_0xe2ba('0x3e')][_0xe2ba('0x4d')]+'%'};return _0x4fdff8;})});}_0x22371e=_[_0xe2ba('0x4e')]({},_0x22371e,_0x45c506[_0xe2ba('0x4f')]);return _0x379f71[_0xe2ba('0xda')](_0x22371e);}})['then'](function(_0xdc724c){if(_0xdc724c){_0xa2d88b=_0xdc724c[_0xe2ba('0x44')];if(!_0x45c506[_0xe2ba('0x3e')][_0xe2ba('0x45')]('nolimit')){_0x22371e[_0xe2ba('0x2d')]=qs[_0xe2ba('0x2d')](_0x45c506[_0xe2ba('0x3e')][_0xe2ba('0x2d')]);_0x22371e['offset']=qs[_0xe2ba('0x2b')](_0x45c506[_0xe2ba('0x3e')][_0xe2ba('0x2b')]);}return _0x379f71[_0xe2ba('0xda')](_0x22371e);}})[_0xe2ba('0x1d')](function(_0x2bb443){if(_0x2bb443){return _0x2bb443?{'count':_0xa2d88b,'rows':_0x2bb443}:null;}})['then'](respondWithResult(_0x99cec1,null))['catch'](handleError(_0x99cec1,null));}; \ No newline at end of file +var _0x0003=['getApplications','getInteractions','Owner','fullname','Tags','color','tag','findAll','body\x20is\x20mandatory\x20and\x20not\x20empty','List','out','Messages','SmsAccount,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','intelepeer','redif','clicksend','infobip','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','message-id','state','csc','addAgents','userSmsAccount:save','removeAgents','emit','eml-format','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsAccount.socket','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','SmsAccounts','stack','name','send','Pause','mandatoryDispositionPause','SmsAccount','rawAttributes','fieldName','map','keys','filters','intersection','query','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','params','find','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','describe','length','pick','SmsAccountId','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','notify','SmsApplication','account','applications','orderBy','Applications','asc','difference','createdAt','updatedAt','CompanyId','ListId','mobile','from','From','messageId','skebby','sender','text','connectel','message_id','plivo','Text','MessageUUID','results','originatingAddress','segmentedMessage','clickatell','fromNumber','bandwidth','refid','isNil','from\x20is\x20mandatory','mapKey','Sequelize','ValidationError','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','list','omit','Contacts','defaults','CmContact','SmsInteraction','spread','interaction','created','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','twilio','text/xml','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','priority'];(function(_0x2e24b7,_0x32d6b5){var _0x91888a=function(_0x46b602){while(--_0x46b602){_0x2e24b7['push'](_0x2e24b7['shift']());}};_0x91888a(++_0x32d6b5);}(_0x0003,0xfb));var _0x3000=function(_0x26094f,_0xa15309){_0x26094f=_0x26094f-0x0;var _0x33f4db=_0x0003[_0x26094f];return _0x33f4db;};'use strict';var emlformat=require(_0x3000('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3000('0x1'));var moment=require(_0x3000('0x2'));var BPromise=require(_0x3000('0x3'));var Mustache=require(_0x3000('0x4'));var util=require('util');var path=require('path');var sox=require(_0x3000('0x5'));var csv=require(_0x3000('0x6'));var ejs=require(_0x3000('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3000('0x8'));var squel=require('squel');var crypto=require(_0x3000('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3000('0x6'));var querystring=require(_0x3000('0xa'));var Papa=require(_0x3000('0xb'));var Redis=require(_0x3000('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x3000('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3000('0xe'))(_0x3000('0xf'));var utils=require(_0x3000('0x10'));var config=require(_0x3000('0x11'));var licenseUtil=require(_0x3000('0x12'));var db=require(_0x3000('0x13'))['db'];config['redis']=_['defaults'](config[_0x3000('0x14')],{'host':_0x3000('0x15'),'port':0x18eb});var socket=require(_0x3000('0x16'))(new Redis(config[_0x3000('0x14')]));require(_0x3000('0x17'))['register'](socket);var jayson=require(_0x3000('0x18'));var client=jayson[_0x3000('0x19')][_0x3000('0x1a')]({'port':0x232c});function respondWithRpcPromise(_0x28b240,_0x41e41a,_0x339b00,_0x3af694){return new BPromise(function(_0x460e20,_0x201a1f){var _0x50e33e=_0x3af694||client;return _0x50e33e[_0x3000('0x1b')](_0x28b240,_0x339b00)['then'](function(_0x37da00){logger[_0x3000('0x1c')]('SmsAccount,\x20%s,\x20%s',_0x41e41a,_0x3000('0x1d'));logger[_0x3000('0x1e')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x41e41a,'request\x20sent',JSON[_0x3000('0x1f')](_0x37da00));if(_0x37da00[_0x3000('0x20')]){if(_0x37da00[_0x3000('0x20')][_0x3000('0x21')]===0x1f4){logger[_0x3000('0x20')](_0x3000('0x22'),_0x41e41a,_0x37da00[_0x3000('0x20')][_0x3000('0x23')]);return _0x201a1f(_0x37da00[_0x3000('0x20')][_0x3000('0x23')]);}logger[_0x3000('0x20')](_0x3000('0x22'),_0x41e41a,_0x37da00[_0x3000('0x20')]['message']);return _0x460e20(_0x37da00['error'][_0x3000('0x23')]);}else{logger['info']('SmsAccount,\x20%s,\x20%s',_0x41e41a,_0x3000('0x1d'));_0x460e20(_0x37da00['result'][_0x3000('0x23')]);}})['catch'](function(_0x17083b){logger['error'](_0x3000('0x22'),_0x41e41a,_0x17083b);_0x201a1f(_0x17083b);});});}function respondWithStatusCode(_0x4d4bbe,_0x255436){_0x255436=_0x255436||0xcc;return function(_0x3fbe3c){if(_0x3fbe3c){return _0x4d4bbe[_0x3000('0x24')](_0x255436);}return _0x4d4bbe[_0x3000('0x25')](_0x255436)[_0x3000('0x26')]();};}function respondWithResult(_0x1ed688,_0x59584f){_0x59584f=_0x59584f||0xc8;return function(_0x244193){if(_0x244193){return _0x1ed688[_0x3000('0x25')](_0x59584f)[_0x3000('0x27')](_0x244193);}};}function respondWithFilteredResult(_0x16f72a,_0x4e7cc9){return function(_0x5e5439){if(_0x5e5439){var _0x49edb8=typeof _0x4e7cc9[_0x3000('0x28')]==='undefined'&&typeof _0x4e7cc9[_0x3000('0x29')]===_0x3000('0x2a');var _0x491cfd=_0x5e5439[_0x3000('0x2b')];var _0x4cae9c=_0x49edb8?0x0:_0x4e7cc9[_0x3000('0x28')];var _0x4b3930=_0x49edb8?_0x5e5439[_0x3000('0x2b')]:_0x4e7cc9[_0x3000('0x28')]+_0x4e7cc9['limit'];var _0x2a6ddf;if(_0x4b3930>=_0x491cfd){_0x4b3930=_0x491cfd;_0x2a6ddf=0xc8;}else{_0x2a6ddf=0xce;}_0x16f72a[_0x3000('0x25')](_0x2a6ddf);return _0x16f72a[_0x3000('0x2c')](_0x3000('0x2d'),_0x4cae9c+'-'+_0x4b3930+'/'+_0x491cfd)[_0x3000('0x27')](_0x5e5439);}return null;};}function patchUpdates(_0x28e833){return function(_0x499006){try{jsonpatch[_0x3000('0x2e')](_0x499006,_0x28e833,!![]);}catch(_0x29c1b3){return BPromise[_0x3000('0x2f')](_0x29c1b3);}return _0x499006[_0x3000('0x30')]();};}function saveUpdates(_0x563a78,_0x566d12){return function(_0x1b91a0){if(_0x1b91a0){return _0x1b91a0[_0x3000('0x31')](_0x563a78)[_0x3000('0x32')](function(_0x94dd6){return _0x94dd6;});}return null;};}function removeEntity(_0x5b977a,_0xb49971){return function(_0x4e0b10){if(_0x4e0b10){return _0x4e0b10[_0x3000('0x33')]()[_0x3000('0x32')](function(){var _0x4257c9=_0x4e0b10[_0x3000('0x34')]({'plain':!![]});var _0x5db1ee=_0x3000('0x35');return db['UserProfileResource'][_0x3000('0x33')]({'where':{'type':_0x5db1ee,'resourceId':_0x4257c9['id']}})[_0x3000('0x32')](function(){return _0x4e0b10;});})[_0x3000('0x32')](function(){_0x5b977a[_0x3000('0x25')](0xcc)[_0x3000('0x26')]();});}};}function handleEntityNotFound(_0x5d9ce3,_0x55fd75){return function(_0x5286e8){if(!_0x5286e8){_0x5d9ce3['sendStatus'](0x194);}return _0x5286e8;};}function handleError(_0x1606e5,_0x2a38e9){_0x2a38e9=_0x2a38e9||0x1f4;return function(_0x468e75){logger[_0x3000('0x20')](_0x468e75[_0x3000('0x36')]);if(_0x468e75[_0x3000('0x37')]){delete _0x468e75[_0x3000('0x37')];}_0x1606e5[_0x3000('0x25')](_0x2a38e9)[_0x3000('0x38')](_0x468e75);};}exports['index']=function(_0x1930c7,_0x4627b1){var _0x4cf8db={'include':[{'model':db[_0x3000('0x39')],'as':_0x3000('0x3a')}]},_0x1c05a8={},_0x3fbf88={'count':0x0,'rows':[]};var _0xabd34d=_['map'](db[_0x3000('0x3b')][_0x3000('0x3c')],function(_0x39ff4c){return{'name':_0x39ff4c[_0x3000('0x3d')],'type':_0x39ff4c['type']['key']};});_0x1c05a8['model']=_[_0x3000('0x3e')](_0xabd34d,_0x3000('0x37'));_0x1c05a8['query']=_[_0x3000('0x3f')](_0x1930c7['query']);_0x1c05a8[_0x3000('0x40')]=_[_0x3000('0x41')](_0x1c05a8['model'],_0x1c05a8[_0x3000('0x42')]);_0x4cf8db[_0x3000('0x43')]=_[_0x3000('0x41')](_0x1c05a8[_0x3000('0x44')],qs[_0x3000('0x45')](_0x1930c7[_0x3000('0x42')][_0x3000('0x45')]));_0x4cf8db[_0x3000('0x43')]=_0x4cf8db['attributes']['length']?_0x4cf8db[_0x3000('0x43')]:_0x1c05a8['model'];if(!_0x1930c7[_0x3000('0x42')][_0x3000('0x46')](_0x3000('0x47'))){_0x4cf8db[_0x3000('0x29')]=qs[_0x3000('0x29')](_0x1930c7['query']['limit']);_0x4cf8db[_0x3000('0x28')]=qs[_0x3000('0x28')](_0x1930c7[_0x3000('0x42')][_0x3000('0x28')]);}_0x4cf8db[_0x3000('0x48')]=qs[_0x3000('0x49')](_0x1930c7[_0x3000('0x42')][_0x3000('0x49')]);_0x4cf8db[_0x3000('0x4a')]=qs[_0x3000('0x40')](_['pick'](_0x1930c7['query'],_0x1c05a8[_0x3000('0x40')]),_0xabd34d);if(_0x1930c7[_0x3000('0x42')][_0x3000('0x4b')]){_0x4cf8db[_0x3000('0x4a')]=_[_0x3000('0x4c')](_0x4cf8db[_0x3000('0x4a')],{'$or':_[_0x3000('0x3e')](_0xabd34d,function(_0x271f23){if(_0x271f23[_0x3000('0x4d')]!==_0x3000('0x4e')){var _0x572fa0={};_0x572fa0[_0x271f23[_0x3000('0x37')]]={'$like':'%'+_0x1930c7[_0x3000('0x42')]['filter']+'%'};return _0x572fa0;}})});}_0x4cf8db=_['merge']({},_0x4cf8db,_0x1930c7[_0x3000('0x4f')]);var _0x500841={'where':_0x4cf8db[_0x3000('0x4a')]};return db[_0x3000('0x3b')]['count'](_0x500841)[_0x3000('0x32')](function(_0x43ec9e){_0x3fbf88[_0x3000('0x2b')]=_0x43ec9e;if(_0x1930c7[_0x3000('0x42')][_0x3000('0x50')]){_0x4cf8db[_0x3000('0x51')]=[{'all':!![]}];}return db[_0x3000('0x3b')]['findAll'](_0x4cf8db);})[_0x3000('0x32')](function(_0x25b5a7){_0x3fbf88[_0x3000('0x52')]=_0x25b5a7;return _0x3fbf88;})[_0x3000('0x32')](respondWithFilteredResult(_0x4627b1,_0x4cf8db))[_0x3000('0x53')](handleError(_0x4627b1,null));};exports['show']=function(_0x23ac14,_0x413bba){var _0x14a321={'raw':![],'where':{'id':_0x23ac14[_0x3000('0x54')]['id']},'include':[{'model':db[_0x3000('0x39')],'as':_0x3000('0x3a')}]},_0x8f5dbf={};_0x8f5dbf['model']=_[_0x3000('0x3f')](db[_0x3000('0x3b')][_0x3000('0x3c')]);_0x8f5dbf[_0x3000('0x42')]=_[_0x3000('0x3f')](_0x23ac14[_0x3000('0x42')]);_0x8f5dbf[_0x3000('0x40')]=_[_0x3000('0x41')](_0x8f5dbf[_0x3000('0x44')],_0x8f5dbf[_0x3000('0x42')]);_0x14a321['attributes']=_['intersection'](_0x8f5dbf[_0x3000('0x44')],qs[_0x3000('0x45')](_0x23ac14[_0x3000('0x42')]['fields']));_0x14a321[_0x3000('0x43')]=_0x14a321['attributes']['length']?_0x14a321[_0x3000('0x43')]:_0x8f5dbf['model'];if(_0x23ac14['query'][_0x3000('0x50')]){_0x14a321[_0x3000('0x51')]=[{'all':!![]}];}_0x14a321=_[_0x3000('0x4c')]({},_0x14a321,_0x23ac14[_0x3000('0x4f')]);return db['SmsAccount'][_0x3000('0x55')](_0x14a321)['then'](handleEntityNotFound(_0x413bba,null))[_0x3000('0x32')](respondWithResult(_0x413bba,null))[_0x3000('0x53')](handleError(_0x413bba,null));};exports['create']=function(_0x131ce1,_0x22f477){return db[_0x3000('0x3b')][_0x3000('0x56')](_0x131ce1[_0x3000('0x57')],{})[_0x3000('0x32')](function(_0x11e96d){var _0x9694ae=_0x131ce1[_0x3000('0x58')]['get']({'plain':!![]});if(!_0x9694ae)throw new Error(_0x3000('0x59'));if(_0x9694ae[_0x3000('0x5a')]==='user'){var _0x2f9afd=_0x11e96d[_0x3000('0x34')]({'plain':!![]});var _0x154ff7='SmsAccounts';return db[_0x3000('0x5b')][_0x3000('0x55')]({'where':{'name':_0x154ff7,'userProfileId':_0x9694ae[_0x3000('0x5c')]},'raw':!![]})[_0x3000('0x32')](function(_0x3b7c60){if(_0x3b7c60&&_0x3b7c60[_0x3000('0x5d')]===0x0){return db[_0x3000('0x5e')]['create']({'name':_0x2f9afd['name'],'resourceId':_0x2f9afd['id'],'type':_0x3b7c60[_0x3000('0x37')],'sectionId':_0x3b7c60['id']},{})[_0x3000('0x32')](function(){return _0x11e96d;});}else{return _0x11e96d;}})['catch'](function(_0x5706a4){logger['error'](_0x3000('0x5f'),_0x5706a4);throw _0x5706a4;});}return _0x11e96d;})['then'](respondWithResult(_0x22f477,0xc9))['catch'](handleError(_0x22f477,null));};exports[_0x3000('0x31')]=function(_0x5fe53e,_0x1c6d22){if(_0x5fe53e[_0x3000('0x57')]['id']){delete _0x5fe53e[_0x3000('0x57')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x5fe53e[_0x3000('0x54')]['id']},'include':[{'model':db[_0x3000('0x39')],'as':_0x3000('0x3a')}]})[_0x3000('0x32')](handleEntityNotFound(_0x1c6d22,null))[_0x3000('0x32')](saveUpdates(_0x5fe53e[_0x3000('0x57')],null))[_0x3000('0x32')](respondWithResult(_0x1c6d22,null))[_0x3000('0x53')](handleError(_0x1c6d22,null));};exports[_0x3000('0x33')]=function(_0xc41902,_0x3745cd){return db['SmsAccount']['find']({'where':{'id':_0xc41902[_0x3000('0x54')]['id']}})[_0x3000('0x32')](handleEntityNotFound(_0x3745cd,null))[_0x3000('0x32')](removeEntity(_0x3745cd,null))[_0x3000('0x53')](handleError(_0x3745cd,null));};exports[_0x3000('0x60')]=function(_0x11468d,_0xfb7c9b){return db['SmsAccount'][_0x3000('0x60')]()[_0x3000('0x32')](respondWithResult(_0xfb7c9b,null))[_0x3000('0x53')](handleError(_0xfb7c9b,null));};exports['addDisposition']=function(_0x3d0641,_0x5df27a,_0x46df0f){if(_0x3d0641[_0x3000('0x57')]['id']){delete _0x3d0641['body']['id'];}return db['SmsAccount'][_0x3000('0x55')]({'where':{'id':_0x3d0641['params']['id']}})[_0x3000('0x32')](handleEntityNotFound(_0x5df27a,null))[_0x3000('0x32')](function(_0x165224){if(_0x165224){_0x3d0641[_0x3000('0x57')]['SmsAccountId']=_0x165224['id'];return db['Disposition'][_0x3000('0x56')](_0x3d0641[_0x3000('0x57')]);}})[_0x3000('0x32')](respondWithResult(_0x5df27a,null))[_0x3000('0x53')](handleError(_0x5df27a,null));};exports['getDispositions']=function(_0x13fc34,_0x121950,_0x17aff8){var _0x4a43dd={'raw':![],'where':{}};var _0x3332aa={};var _0x2c7050={'count':0x0,'rows':[]};return db[_0x3000('0x3b')]['findOne']({'where':{'id':_0x13fc34[_0x3000('0x54')]['id']}})[_0x3000('0x32')](handleEntityNotFound(_0x121950,null))[_0x3000('0x32')](function(_0x537994){if(_0x537994){_0x3332aa[_0x3000('0x44')]=_['keys'](db['Disposition'][_0x3000('0x3c')]);_0x3332aa['query']=_[_0x3000('0x3f')](_0x13fc34[_0x3000('0x42')]);_0x3332aa[_0x3000('0x40')]=_[_0x3000('0x41')](_0x3332aa[_0x3000('0x44')],_0x3332aa[_0x3000('0x42')]);_0x4a43dd[_0x3000('0x43')]=_[_0x3000('0x41')](_0x3332aa[_0x3000('0x44')],qs[_0x3000('0x45')](_0x13fc34[_0x3000('0x42')][_0x3000('0x45')]));_0x4a43dd[_0x3000('0x43')]=_0x4a43dd[_0x3000('0x43')][_0x3000('0x61')]?_0x4a43dd['attributes']:_0x3332aa[_0x3000('0x44')];if(!_0x13fc34[_0x3000('0x42')]['hasOwnProperty'](_0x3000('0x47'))){_0x4a43dd[_0x3000('0x29')]=qs[_0x3000('0x29')](_0x13fc34['query'][_0x3000('0x29')]);_0x4a43dd[_0x3000('0x28')]=qs['offset'](_0x13fc34[_0x3000('0x42')][_0x3000('0x28')]);}_0x4a43dd[_0x3000('0x48')]=qs['sort'](_0x13fc34[_0x3000('0x42')]['sort']);_0x4a43dd[_0x3000('0x4a')]=qs[_0x3000('0x40')](_[_0x3000('0x62')](_0x13fc34[_0x3000('0x42')],_0x3332aa[_0x3000('0x40')]));_0x4a43dd[_0x3000('0x4a')][_0x3000('0x63')]=_0x537994['id'];if(_0x13fc34[_0x3000('0x42')][_0x3000('0x4b')]){_0x4a43dd['where']=_[_0x3000('0x4c')](_0x4a43dd[_0x3000('0x4a')],{'$or':_[_0x3000('0x3e')](_0x4a43dd[_0x3000('0x43')],function(_0x13acd9){var _0x70b0c5={};_0x70b0c5[_0x13acd9]={'$like':'%'+_0x13fc34['query'][_0x3000('0x4b')]+'%'};return _0x70b0c5;})});}_0x4a43dd=_[_0x3000('0x4c')]({},_0x4a43dd,_0x13fc34[_0x3000('0x4f')]);return db[_0x3000('0x64')][_0x3000('0x2b')]({'where':_0x4a43dd[_0x3000('0x4a')]})[_0x3000('0x32')](function(_0x2b6387){_0x2c7050[_0x3000('0x2b')]=_0x2b6387;if(_0x13fc34['query'][_0x3000('0x50')]){_0x4a43dd['include']=[{'all':!![]}];}return db[_0x3000('0x64')]['findAll'](_0x4a43dd);})[_0x3000('0x32')](function(_0x470786){_0x2c7050[_0x3000('0x52')]=_0x470786;return _0x2c7050;});}})[_0x3000('0x32')](respondWithFilteredResult(_0x121950,_0x4a43dd))[_0x3000('0x53')](handleError(_0x121950,null));};exports[_0x3000('0x65')]=function(_0x17dcf6,_0x574b00,_0x2021be){return db[_0x3000('0x3b')]['find']({'where':{'id':_0x17dcf6['params']['id']}})['then'](handleEntityNotFound(_0x574b00,null))[_0x3000('0x32')](function(_0xee2742){if(_0xee2742){return _0xee2742['removeDispositions'](_0x17dcf6['query'][_0x3000('0x66')]);}})[_0x3000('0x32')](respondWithStatusCode(_0x574b00,null))['catch'](handleError(_0x574b00,null));};exports[_0x3000('0x67')]=function(_0x58c1c5,_0x59f46f,_0x338b52){if(_0x58c1c5[_0x3000('0x57')]['id']){delete _0x58c1c5[_0x3000('0x57')]['id'];}return db['SmsAccount'][_0x3000('0x55')]({'where':{'id':_0x58c1c5[_0x3000('0x54')]['id']}})[_0x3000('0x32')](handleEntityNotFound(_0x59f46f,null))[_0x3000('0x32')](function(_0x20d962){if(_0x20d962){_0x58c1c5[_0x3000('0x57')][_0x3000('0x63')]=_0x20d962['id'];return db[_0x3000('0x68')][_0x3000('0x56')](_0x58c1c5['body']);}})[_0x3000('0x32')](respondWithResult(_0x59f46f,null))['catch'](handleError(_0x59f46f,null));};exports[_0x3000('0x69')]=function(_0x1ff2ff,_0x24f4d7,_0x572ced){var _0x4e806e={'raw':![],'where':{}};var _0xdf1a0={};var _0x379fa9={'count':0x0,'rows':[]};return db[_0x3000('0x3b')][_0x3000('0x6a')]({'where':{'id':_0x1ff2ff[_0x3000('0x54')]['id']}})[_0x3000('0x32')](handleEntityNotFound(_0x24f4d7,null))[_0x3000('0x32')](function(_0x2c1bde){if(_0x2c1bde){_0xdf1a0[_0x3000('0x44')]=_['keys'](db['CannedAnswer']['rawAttributes']);_0xdf1a0[_0x3000('0x42')]=_['keys'](_0x1ff2ff['query']);_0xdf1a0[_0x3000('0x40')]=_[_0x3000('0x41')](_0xdf1a0[_0x3000('0x44')],_0xdf1a0[_0x3000('0x42')]);_0x4e806e[_0x3000('0x43')]=_[_0x3000('0x41')](_0xdf1a0[_0x3000('0x44')],qs[_0x3000('0x45')](_0x1ff2ff[_0x3000('0x42')][_0x3000('0x45')]));_0x4e806e[_0x3000('0x43')]=_0x4e806e[_0x3000('0x43')]['length']?_0x4e806e[_0x3000('0x43')]:_0xdf1a0[_0x3000('0x44')];if(!_0x1ff2ff[_0x3000('0x42')][_0x3000('0x46')](_0x3000('0x47'))){_0x4e806e[_0x3000('0x29')]=qs[_0x3000('0x29')](_0x1ff2ff[_0x3000('0x42')]['limit']);_0x4e806e[_0x3000('0x28')]=qs['offset'](_0x1ff2ff[_0x3000('0x42')]['offset']);}_0x4e806e['order']=qs[_0x3000('0x49')](_0x1ff2ff['query'][_0x3000('0x49')]);_0x4e806e[_0x3000('0x4a')]=qs[_0x3000('0x40')](_[_0x3000('0x62')](_0x1ff2ff[_0x3000('0x42')],_0xdf1a0[_0x3000('0x40')]));_0x4e806e[_0x3000('0x4a')][_0x3000('0x63')]=_0x2c1bde['id'];if(_0x1ff2ff['query'][_0x3000('0x4b')]){_0x4e806e[_0x3000('0x4a')]=_['merge'](_0x4e806e[_0x3000('0x4a')],{'$or':_['map'](_0x4e806e[_0x3000('0x43')],function(_0x58bc4f){var _0x329692={};_0x329692[_0x58bc4f]={'$like':'%'+_0x1ff2ff[_0x3000('0x42')][_0x3000('0x4b')]+'%'};return _0x329692;})});}_0x4e806e=_['merge']({},_0x4e806e,_0x1ff2ff['options']);return db['CannedAnswer'][_0x3000('0x2b')]({'where':_0x4e806e[_0x3000('0x4a')]})['then'](function(_0x454132){_0x379fa9['count']=_0x454132;if(_0x1ff2ff['query']['includeAll']){_0x4e806e['include']=[{'all':!![]}];}return db[_0x3000('0x68')]['findAll'](_0x4e806e);})[_0x3000('0x32')](function(_0x3670a3){_0x379fa9[_0x3000('0x52')]=_0x3670a3;return _0x379fa9;});}})[_0x3000('0x32')](respondWithFilteredResult(_0x24f4d7,_0x4e806e))[_0x3000('0x53')](handleError(_0x24f4d7,null));};exports[_0x3000('0x6b')]=function(_0x3847da,_0x22b015,_0x125a78){return db['SmsAccount']['find']({'where':{'id':_0x3847da[_0x3000('0x54')]['id']}})[_0x3000('0x32')](handleEntityNotFound(_0x22b015,null))[_0x3000('0x32')](function(_0x25b393){if(_0x25b393){return _0x25b393['removeAnswers'](_0x3847da[_0x3000('0x42')]['ids']);}})[_0x3000('0x32')](respondWithStatusCode(_0x22b015,null))[_0x3000('0x53')](handleError(_0x22b015,null));};exports[_0x3000('0x6c')]=function(_0x569864,_0x37a6c1,_0x219f36){var _0x216667={'channel':'sms'};var _0x505395=[];var _0x5c1a8d=[];var _0x5e00c2={};return db['SmsAccount'][_0x3000('0x55')]({'where':{'id':_0x569864[_0x3000('0x54')]['id']},'include':[{'model':db[_0x3000('0x6d')],'as':'Applications'}]})[_0x3000('0x32')](handleEntityNotFound(_0x37a6c1,null))[_0x3000('0x32')](function(_0x402409){_0x216667[_0x3000('0x6e')]=_0x402409;_0x216667[_0x3000('0x6f')]=_[_0x3000('0x70')](_0x402409[_0x3000('0x71')],['priority'],[_0x3000('0x72')]);if(_0x216667[_0x3000('0x6e')][_0x3000('0x71')]){delete _0x216667[_0x3000('0x6e')]['Applications'];}return db['CmContact']['describe']();})[_0x3000('0x32')](function(_0x24585f){if(!_0x24585f){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0x505395=_[_0x3000('0x73')](_[_0x3000('0x3f')](_0x24585f),[_0x3000('0x74'),'updatedAt']);_0x5c1a8d=_['difference'](_['keys'](_0x24585f),[_0x3000('0x74'),_0x3000('0x75'),_0x3000('0x76'),_0x3000('0x77')]);_0x216667[_0x3000('0x57')]={'mapKey':_0x3000('0x78')};if(_0x216667[_0x3000('0x6e')][_0x3000('0x4d')]){switch(_0x216667[_0x3000('0x6e')][_0x3000('0x4d')]){case'twilio':_0x216667[_0x3000('0x57')][_0x3000('0x79')]=_0x569864[_0x3000('0x57')][_0x3000('0x7a')];_0x216667[_0x3000('0x57')]['body']=_0x569864['body']['Body'];_0x216667[_0x3000('0x57')][_0x3000('0x7b')]=_0x569864['body']['MessageSid'];break;case _0x3000('0x7c'):_0x216667[_0x3000('0x57')][_0x3000('0x79')]='+'+_0x569864[_0x3000('0x57')][_0x3000('0x7d')];_0x216667[_0x3000('0x57')][_0x3000('0x57')]=_0x569864[_0x3000('0x57')][_0x3000('0x7e')];break;case _0x3000('0x7f'):_0x216667[_0x3000('0x57')][_0x3000('0x79')]=_0x569864[_0x3000('0x57')][_0x3000('0x79')];_0x216667[_0x3000('0x57')][_0x3000('0x57')]=_0x569864['body']['message'];break;case'clicksend':_0x216667['body'][_0x3000('0x79')]=_0x569864[_0x3000('0x57')][_0x3000('0x79')];_0x216667['body'][_0x3000('0x57')]=_0x569864[_0x3000('0x57')][_0x3000('0x57')];_0x216667[_0x3000('0x57')][_0x3000('0x7b')]=_0x569864[_0x3000('0x57')][_0x3000('0x80')];break;case _0x3000('0x81'):_0x216667[_0x3000('0x57')]['from']=_0x569864[_0x3000('0x57')][_0x3000('0x7a')];_0x216667[_0x3000('0x57')][_0x3000('0x57')]=_0x569864[_0x3000('0x57')][_0x3000('0x82')];_0x216667['body'][_0x3000('0x7b')]=_0x569864[_0x3000('0x57')][_0x3000('0x83')];break;case'infobip':_0x216667[_0x3000('0x57')][_0x3000('0x79')]='+'+_0x569864['body'][_0x3000('0x84')][0x0][_0x3000('0x79')];_0x216667[_0x3000('0x57')]['body']=_0x569864[_0x3000('0x57')][_0x3000('0x84')][0x0][_0x3000('0x7e')];_0x216667['body'][_0x3000('0x7b')]=_0x569864[_0x3000('0x57')]['results'][0x0]['messageId'];break;case'csc':_0x216667['body'][_0x3000('0x79')]=_0x569864['body'][_0x3000('0x85')];_0x216667[_0x3000('0x57')][_0x3000('0x57')]=_0x569864['body'][_0x3000('0x86')][_0x3000('0x23')];break;case _0x3000('0x87'):_0x216667['body'][_0x3000('0x79')]=_0x569864[_0x3000('0x57')][_0x3000('0x88')];_0x216667['body'][_0x3000('0x57')]=_0x569864[_0x3000('0x57')]['text'];_0x216667[_0x3000('0x57')][_0x3000('0x7b')]=_0x569864[_0x3000('0x57')]['replyMessageId'];break;case _0x3000('0x89'):_0x216667[_0x3000('0x57')][_0x3000('0x7b')]=_0x569864[_0x3000('0x57')][0x0][_0x3000('0x23')]['id'];_0x216667[_0x3000('0x57')][_0x3000('0x79')]=_0x569864[_0x3000('0x57')][0x0][_0x3000('0x23')]['from'];_0x216667[_0x3000('0x57')][_0x3000('0x57')]=_0x569864['body'][0x0][_0x3000('0x23')][_0x3000('0x7e')];break;case'intelepeer':_0x216667['body']['from']=_0x569864[_0x3000('0x57')]['from'];_0x216667[_0x3000('0x57')]['body']=_0x569864['body'][_0x3000('0x23')];_0x216667[_0x3000('0x57')][_0x3000('0x7b')]=_0x569864[_0x3000('0x57')][_0x3000('0x8a')];break;}}if(_0x216667[_0x3000('0x57')]['id']){delete _0x216667[_0x3000('0x57')]['id'];}if(_[_0x3000('0x8b')](_0x216667[_0x3000('0x57')]['from'])){throw new db['Sequelize']['ValidationError'](_0x3000('0x8c'));}if(_[_0x3000('0x8b')](_0x216667[_0x3000('0x57')]['body'])||_0x216667['body'][_0x3000('0x57')]===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x3000('0x8b')](_0x216667[_0x3000('0x57')][_0x3000('0x8d')])){throw new db[(_0x3000('0x8e'))][(_0x3000('0x8f'))](_0x3000('0x90')+_0x5c1a8d);}if(!_['includes'](_0x5c1a8d,_0x216667['body']['mapKey'])){throw new db[(_0x3000('0x8e'))][(_0x3000('0x8f'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5c1a8d);}_0x5e00c2[_0x216667['body'][_0x3000('0x8d')]]=_0x216667[_0x3000('0x57')][_0x3000('0x79')];return db[_0x3000('0x91')][_0x3000('0x55')]({'where':{'id':_0x216667['account'][_0x3000('0x77')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x5e00c2,'limit':0x1,'order':[['updatedAt',_0x3000('0x92')]]}]});})[_0x3000('0x32')](handleEntityNotFound(_0x37a6c1,null))[_0x3000('0x32')](function(_0x290fb6){if(_0x290fb6){_0x216667[_0x3000('0x93')]=_[_0x3000('0x94')](_0x290fb6,[_0x3000('0x95')]);if(_0x290fb6[_0x3000('0x95')][_0x3000('0x61')]){return _0x290fb6[_0x3000('0x95')][0x0];}var _0x4f0665=_[_0x3000('0x96')](_0x216667['body'],{'firstName':_0x216667['body']['from'],'ListId':_0x290fb6['id']});_0x4f0665[_0x216667[_0x3000('0x57')][_0x3000('0x8d')]]=_0x216667[_0x3000('0x57')]['from'];return db[_0x3000('0x97')][_0x3000('0x56')](_0x4f0665,{'fields':_0x505395,'raw':!![]});}})['then'](handleEntityNotFound(_0x37a6c1,null))[_0x3000('0x32')](function(_0x4ca56d){if(_0x4ca56d){_0x216667['contact']=_0x4ca56d;var _0x1c8810={'ContactId':_0x4ca56d['id'],'phone':_0x216667[_0x3000('0x57')][_0x3000('0x79')],'SmsAccountId':_0x569864[_0x3000('0x54')]['id']};var _0x5ee605={'ContactId':_0x4ca56d['id'],'SmsAccountId':_0x569864['params']['id'],'closed':![]};return db['SmsInteraction'][_0x3000('0x55')]({'where':_0x5ee605})[_0x3000('0x32')](function(_0x3d0657){if(_0x3d0657){return[_0x3d0657,![]];}return db[_0x3000('0x98')][_0x3000('0x56')](_0x1c8810)[_0x3000('0x32')](function(_0x20bd7f){return[_0x20bd7f,!![]];});});}})[_0x3000('0x99')](function(_0x4489f1,_0x1c4e52){_0x216667[_0x3000('0x9a')]=_0x4489f1[_0x3000('0x34')]({'plain':!![]});_0x216667['interaction'][_0x3000('0x9b')]=![];if(_0x1c4e52){if(_0x216667['account']['autoclose']){_0x216667['applications'][_0x3000('0x9c')]({'id':0x0,'priority':_0x216667[_0x3000('0x6f')][_0x3000('0x61')]+0x1,'app':_0x3000('0x9d'),'appdata':_0x3000('0x9e'),'interval':_0x3000('0x9f')});}_0x216667[_0x3000('0x9a')][_0x3000('0x9b')]=!![];}return db[_0x3000('0xa0')][_0x3000('0x56')]({'phone':_0x216667['body'][_0x3000('0x79')],'messageId':_0x216667[_0x3000('0x57')]['messageId'],'body':_0x216667['body'][_0x3000('0x57')],'SmsAccountId':_0x569864[_0x3000('0x54')]['id'],'SmsInteractionId':_0x4489f1['id'],'direction':'in','ContactId':_0x4489f1[_0x3000('0xa1')],'AttachmentId':_0x216667[_0x3000('0x57')]['AttachmentId']});})[_0x3000('0x32')](function(_0x4ac0c8){_0x216667[_0x3000('0x23')]=_0x4ac0c8;if(_0x216667['interaction'][_0x3000('0xa2')]){return db[_0x3000('0xa3')]['find']({'attributes':['id',_0x3000('0x37')],'where':{'id':_0x216667['interaction'][_0x3000('0xa2')]}})[_0x3000('0x32')](function(_0x30ffe2){if(_0x30ffe2){_0x216667[_0x3000('0x6f')][_0x3000('0xa4')]({'id':0x0,'priority':0x0,'app':_0x3000('0xa5'),'appdata':_0x30ffe2[_0x3000('0x37')]+','+(_0x216667[_0x3000('0x6e')][_0x3000('0xa6')]||0xa),'interval':_0x3000('0x9f')});}return respondWithRpcPromise(_0x3000('0xa7'),_0x3000('0xa8'),_0x216667);});}return respondWithRpcPromise('Start',_0x3000('0xa8'),_0x216667);})[_0x3000('0x32')](function(_0x532a75){if(_0x532a75){var _0x132699=0xc8;var _0x4d25e6=_0x3000('0xa9');logger[_0x3000('0x1c')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4d25e6,_0x132699,_0x3000('0xaa'));logger[_0x3000('0x1e')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x4d25e6,_0x132699,'entity\x20found',JSON['stringify'](_0x532a75));if(_0x216667['account'][_0x3000('0x4d')]===_0x3000('0xab')){return _0x37a6c1[_0x3000('0x25')](_0x132699)[_0x3000('0x2c')]('Content-Type',_0x3000('0xac'))[_0x3000('0x38')]('\x0a');}else{return _0x37a6c1['status'](_0x132699)[_0x3000('0x27')](_0x532a75);}}})[_0x3000('0x53')](handleError(_0x37a6c1,null));};exports[_0x3000('0xad')]=function(_0x3ba630,_0x3ed3c4,_0xb6cd2d){return db['SmsAccount'][_0x3000('0x6a')]({'where':{'id':_0x3ba630[_0x3000('0x54')]['id']}})[_0x3000('0x32')](handleEntityNotFound(_0x3ed3c4,null))[_0x3000('0x32')](function(_0x98e833){if(_0x98e833){return db[_0x3000('0xae')][_0x3000('0xaf')](function(_0x5b8f9e){return db['SmsApplication'][_0x3000('0x33')]({'where':{'SmsAccountId':_0x3ba630['params']['id']},'transaction':_0x5b8f9e})['then'](function(_0x568b3f){var _0xa9de69=_[_0x3000('0x3e')](_0x3ba630[_0x3000('0x57')],function(_0x1de2c3){_0x1de2c3[_0x3000('0x63')]=_0x3ba630[_0x3000('0x54')]['id'];return _0x1de2c3;});return db[_0x3000('0x6d')][_0x3000('0xb0')](_0xa9de69,{'transaction':_0x5b8f9e});});})[_0x3000('0x32')](function(){return db[_0x3000('0x6d')][_0x3000('0xb1')]({'where':{'SmsAccountId':_0x3ba630[_0x3000('0x54')]['id']},'order':_0x3000('0xb2')});});}})[_0x3000('0x32')](respondWithResult(_0x3ed3c4,null))['catch'](handleError(_0x3ed3c4,null));};exports[_0x3000('0xb3')]=function(_0x5552fd,_0x4711bc,_0x344df8){var _0x24de90={};var _0x1259a8={};var _0x23feec;var _0x34b3a9;return db[_0x3000('0x3b')][_0x3000('0x6a')]({'where':{'id':_0x5552fd[_0x3000('0x54')]['id']}})[_0x3000('0x32')](handleEntityNotFound(_0x4711bc,null))[_0x3000('0x32')](function(_0x5b9372){if(_0x5b9372){_0x23feec=_0x5b9372;_0x1259a8[_0x3000('0x44')]=_[_0x3000('0x3f')](db[_0x3000('0x6d')][_0x3000('0x3c')]);_0x1259a8[_0x3000('0x42')]=_[_0x3000('0x3f')](_0x5552fd['query']);_0x1259a8[_0x3000('0x40')]=_['intersection'](_0x1259a8['model'],_0x1259a8[_0x3000('0x42')]);_0x24de90[_0x3000('0x43')]=_[_0x3000('0x41')](_0x1259a8['model'],qs['fields'](_0x5552fd[_0x3000('0x42')][_0x3000('0x45')]));_0x24de90[_0x3000('0x43')]=_0x24de90[_0x3000('0x43')][_0x3000('0x61')]?_0x24de90[_0x3000('0x43')]:_0x1259a8['model'];_0x24de90[_0x3000('0x48')]=qs[_0x3000('0x49')](_0x5552fd[_0x3000('0x42')]['sort']);_0x24de90[_0x3000('0x4a')]=qs[_0x3000('0x40')](_['pick'](_0x5552fd['query'],_0x1259a8[_0x3000('0x40')]));if(_0x5552fd[_0x3000('0x42')]['filter']){_0x24de90[_0x3000('0x4a')]=_[_0x3000('0x4c')](_0x24de90[_0x3000('0x4a')],{'$or':_['map'](_0x24de90[_0x3000('0x43')],function(_0x40bfde){var _0x6d82da={};_0x6d82da[_0x40bfde]={'$like':'%'+_0x5552fd['query'][_0x3000('0x4b')]+'%'};return _0x6d82da;})});}_0x24de90=_[_0x3000('0x4c')]({},_0x24de90,_0x5552fd[_0x3000('0x4f')]);return _0x23feec[_0x3000('0xb3')](_0x24de90);}})[_0x3000('0x32')](function(_0x2efb3c){if(_0x2efb3c){_0x34b3a9=_0x2efb3c[_0x3000('0x61')];if(!_0x5552fd[_0x3000('0x42')][_0x3000('0x46')]('nolimit')){_0x24de90['limit']=qs[_0x3000('0x29')](_0x5552fd[_0x3000('0x42')]['limit']);_0x24de90[_0x3000('0x28')]=qs['offset'](_0x5552fd[_0x3000('0x42')][_0x3000('0x28')]);}return _0x23feec[_0x3000('0xb3')](_0x24de90);}})[_0x3000('0x32')](function(_0x326076){if(_0x326076){return _0x326076?{'count':_0x34b3a9,'rows':_0x326076}:null;}})['then'](respondWithResult(_0x4711bc,null))[_0x3000('0x53')](handleError(_0x4711bc,null));};exports[_0x3000('0xb4')]=function(_0x5e443c,_0x2bc773,_0x5b207e){var _0x148107={'raw':![],'where':{}};var _0x2316cf={};var _0x19e6c1={'count':0x0,'rows':[]};return db[_0x3000('0x3b')][_0x3000('0x6a')]({'where':{'id':_0x5e443c[_0x3000('0x54')]['id']}})['then'](handleEntityNotFound(_0x2bc773,null))[_0x3000('0x32')](function(_0x62c201){if(_0x62c201){_0x2316cf[_0x3000('0x44')]=_[_0x3000('0x3f')](db[_0x3000('0x98')][_0x3000('0x3c')]);_0x2316cf[_0x3000('0x42')]=_['keys'](_0x5e443c[_0x3000('0x42')]);_0x2316cf[_0x3000('0x40')]=_[_0x3000('0x41')](_0x2316cf[_0x3000('0x44')],_0x2316cf[_0x3000('0x42')]);_0x148107['attributes']=_[_0x3000('0x41')](_0x2316cf[_0x3000('0x44')],qs[_0x3000('0x45')](_0x5e443c[_0x3000('0x42')]['fields']));_0x148107['attributes']=_0x148107[_0x3000('0x43')]['length']?_0x148107[_0x3000('0x43')]:_0x2316cf[_0x3000('0x44')];if(!_0x5e443c['query']['hasOwnProperty'](_0x3000('0x47'))){_0x148107[_0x3000('0x29')]=qs[_0x3000('0x29')](_0x5e443c[_0x3000('0x42')][_0x3000('0x29')]);_0x148107[_0x3000('0x28')]=qs[_0x3000('0x28')](_0x5e443c['query'][_0x3000('0x28')]);}_0x148107[_0x3000('0x48')]=qs[_0x3000('0x49')](_0x5e443c['query'][_0x3000('0x49')]);_0x148107[_0x3000('0x4a')]=qs[_0x3000('0x40')](_[_0x3000('0x62')](_0x5e443c[_0x3000('0x42')],_0x2316cf[_0x3000('0x40')]));_0x148107[_0x3000('0x4a')][_0x3000('0x63')]=_0x62c201['id'];if(_0x5e443c[_0x3000('0x42')][_0x3000('0x4b')]){_0x148107[_0x3000('0x4a')]=_[_0x3000('0x4c')](_0x148107[_0x3000('0x4a')],{'$or':_[_0x3000('0x3e')](_0x148107[_0x3000('0x43')],function(_0x459283){var _0x10bad4={};_0x10bad4[_0x459283]={'$like':'%'+_0x5e443c[_0x3000('0x42')][_0x3000('0x4b')]+'%'};return _0x10bad4;})});}_0x148107=_[_0x3000('0x4c')]({},_0x148107,_0x5e443c['options']);return db[_0x3000('0x98')][_0x3000('0x2b')]({'where':_0x148107[_0x3000('0x4a')]})[_0x3000('0x32')](function(_0x11e2ed){_0x19e6c1['count']=_0x11e2ed;if(_0x5e443c[_0x3000('0x42')][_0x3000('0x50')]){_0x148107[_0x3000('0x51')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x3000('0xa3')],'as':_0x3000('0xb5'),'attributes':[_0x3000('0x37'),_0x3000('0xb6'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x3000('0xb7'),'attributes':['id',_0x3000('0x37'),_0x3000('0xb8')],'where':_0x5e443c[_0x3000('0x42')][_0x3000('0xb9')]?{'id':_0x5e443c[_0x3000('0x42')]['tag']}:undefined,'required':_0x5e443c[_0x3000('0x42')][_0x3000('0xb9')]?!![]:![]}];}return db[_0x3000('0x98')][_0x3000('0xba')](_0x148107);})[_0x3000('0x32')](function(_0x18e520){_0x19e6c1['rows']=_0x18e520;return _0x19e6c1;});}})[_0x3000('0x32')](respondWithFilteredResult(_0x2bc773,_0x148107))[_0x3000('0x53')](handleError(_0x2bc773,null));};exports['send']=function(_0xbcb7bb,_0xe60ca0,_0x36d12a){var _0x1c4da1,_0x3e0e4b,_0x4160c7;if(_[_0x3000('0x8b')](_0xbcb7bb[_0x3000('0x57')][_0x3000('0x57')])||_0xbcb7bb[_0x3000('0x57')][_0x3000('0x57')]===''){throw new db[(_0x3000('0x8e'))][(_0x3000('0x8f'))](_0x3000('0xbb'));}if(_[_0x3000('0x8b')](_0xbcb7bb['body']['to'])){throw new db[(_0x3000('0x8e'))][(_0x3000('0x8f'))]('to\x20is\x20mandatory');}_0x1c4da1=_0xbcb7bb[_0x3000('0x57')]['to'];return db[_0x3000('0x3b')][_0x3000('0x55')]({'where':{'id':_0xbcb7bb['params']['id']},'include':[{'model':db[_0x3000('0x91')],'as':_0x3000('0xbc'),'include':[{'model':db[_0x3000('0x97')],'as':_0x3000('0x95'),'where':{'mobile':_0x1c4da1},'limit':0x1,'order':[[_0x3000('0x75'),_0x3000('0x92')]]}]}]})[_0x3000('0x32')](handleEntityNotFound(_0xe60ca0,null))[_0x3000('0x32')](function(_0x1b4f4b){if(_0x1b4f4b&&_0x1b4f4b['List']){_0x3e0e4b=_0x1b4f4b[_0x3000('0x34')]({'plain':!![]});if(_0x3e0e4b[_0x3000('0xbc')]&&_0x3e0e4b[_0x3000('0xbc')][_0x3000('0x95')][_0x3000('0x61')]){return _0x3e0e4b[_0x3000('0xbc')][_0x3000('0x95')][0x0];}return db[_0x3000('0x97')][_0x3000('0x56')](_[_0x3000('0x96')](_0xbcb7bb[_0x3000('0x57')],{'firstName':_0x1c4da1,'mobile':_0x1c4da1,'phone':_0x1c4da1,'ListId':_0x3e0e4b['ListId']}));}})[_0x3000('0x32')](handleEntityNotFound(_0xe60ca0,null))[_0x3000('0x32')](function(_0x22febc){if(_0x22febc){_0x4160c7=_0x22febc;return db['SmsInteraction'][_0x3000('0x55')]({'where':{'ContactId':_0x4160c7['id'],'closed':![],'SmsAccountId':_0x3e0e4b['id']}})[_0x3000('0x32')](function(_0x12185a){if(_0x12185a){return[_0x12185a,![]];}return db['SmsInteraction'][_0x3000('0x56')]({'UserId':_0xbcb7bb[_0x3000('0x58')]['id'],'ContactId':_0x4160c7['id'],'SmsAccountId':_0x3e0e4b['id'],'phone':_0x1c4da1,'firstMsgDirection':_0x3000('0xbd'),'Messages':[_[_0x3000('0x4c')](_0xbcb7bb[_0x3000('0x57')],{'read':![],'body':_0xbcb7bb[_0x3000('0x57')]['body'],'phone':_0x1c4da1,'SmsAccountId':_0x3e0e4b['id'],'UserId':_0xbcb7bb['user']['id'],'ContactId':_0x4160c7['id']})]},{'include':[{'model':db[_0x3000('0xa0')],'as':'Messages'}]})[_0x3000('0x32')](function(_0xbede8){return[_0xbede8,!![]];});});}})[_0x3000('0x99')](function(_0x12c92d,_0x5cde5e){if(_0x5cde5e){return _0x12c92d;}return db[_0x3000('0xa0')][_0x3000('0x56')](_[_0x3000('0x4c')](_0xbcb7bb['body'],{'read':![],'body':_0xbcb7bb[_0x3000('0x57')][_0x3000('0x57')],'phone':_0x1c4da1,'SmsAccountId':_0x3e0e4b['id'],'SmsInteractionId':_0x12c92d['id'],'UserId':_0xbcb7bb[_0x3000('0x58')]['id'],'ContactId':_0x4160c7['id']}))[_0x3000('0x32')](function(_0x366724){_0x12c92d['dataValues'][_0x3000('0xbe')]=[];_0x12c92d['dataValues']['Messages'][_0x3000('0x9c')](_0x366724['dataValues']);return _0x12c92d;});})[_0x3000('0x32')](respondWithResult(_0xe60ca0,null))['catch'](handleError(_0xe60ca0,null));};exports[_0x3000('0x25')]=function(_0x563c0b,_0x482840,_0x8e9fa0){if(_0x563c0b[_0x3000('0x57')]['id']){delete _0x563c0b[_0x3000('0x57')]['id'];}var _0x62563f,_0x41f1a9,_0x2261c5;return db[_0x3000('0x3b')][_0x3000('0x55')]({'where':{'id':_0x563c0b[_0x3000('0x54')]['id']}})[_0x3000('0x32')](handleEntityNotFound(_0x482840,null))[_0x3000('0x32')](function(_0x15af7d){if(_0x15af7d){_0x2261c5=_0x15af7d;logger['debug'](_0x3000('0xbf'),_0x3000('0x25'),_0x3000('0xc0'),_0x15af7d[_0x3000('0x4d')],util[_0x3000('0xc1')](_0x563c0b[_0x3000('0x57')],{'showHidden':![],'depth':null}));switch(_0x15af7d['type']){case _0x3000('0x7c'):if(_0x563c0b[_0x3000('0x57')][_0x3000('0xc2')]&&_0x563c0b[_0x3000('0x57')]['status']){_0x41f1a9=_0x563c0b[_0x3000('0x57')]['status'];return db[_0x3000('0xa0')]['find']({'where':{'messageId':_0x563c0b[_0x3000('0x57')]['skebby_dispatch_id']}});}break;case _0x3000('0x7f'):if(_0x563c0b['body'][_0x3000('0xc3')]&&_0x563c0b[_0x3000('0x57')][_0x3000('0xc4')]){_0x41f1a9=_0x563c0b['body'][_0x3000('0xc4')];return db['SmsMessage'][_0x3000('0x55')]({'where':{'messageId':_0x563c0b[_0x3000('0x57')][_0x3000('0xc3')]}});}break;case'clicksend':if(_0x563c0b[_0x3000('0x57')][_0x3000('0x80')]&&_0x563c0b[_0x3000('0x57')][_0x3000('0xc5')]){_0x41f1a9=_0x563c0b['body'][_0x3000('0xc5')];return db[_0x3000('0xa0')][_0x3000('0x55')]({'where':{'messageId':_0x563c0b[_0x3000('0x57')][_0x3000('0x80')]}});}break;case'infobip':var _0x10ce7d=_0x563c0b[_0x3000('0x57')][_0x3000('0x84')][0x0];if(_0x10ce7d[_0x3000('0x7b')]&&_0x10ce7d[_0x3000('0x25')][_0x3000('0xc6')]===_0x3000('0xc7')){_0x41f1a9=_0x10ce7d[_0x3000('0x25')][_0x3000('0xc6')];return db[_0x3000('0xa0')][_0x3000('0x55')]({'where':{'messageId':_0x10ce7d[_0x3000('0x7b')]}});}break;case'clickatell':if(_0x563c0b['body'][_0x3000('0x7b')]&&_0x563c0b[_0x3000('0x57')][_0x3000('0x25')]){_0x41f1a9=_0x563c0b[_0x3000('0x57')][_0x3000('0x25')];return db[_0x3000('0xa0')][_0x3000('0x55')]({'where':{'messageId':_0x563c0b[_0x3000('0x57')][_0x3000('0x7b')]}});}break;case _0x3000('0x89'):if(_0x563c0b[_0x3000('0x57')][0x0][_0x3000('0x23')]['id']){_0x41f1a9=_0x563c0b['body'][0x0][_0x3000('0x4d')];return db[_0x3000('0xa0')][_0x3000('0x55')]({'where':{'messageId':_0x563c0b['body'][0x0][_0x3000('0x23')]['id']}});}break;case _0x3000('0xc8'):if(_0x563c0b['body']['redif']&&_0x563c0b[_0x3000('0x57')][_0x3000('0x25')]){_0x41f1a9=_0x563c0b[_0x3000('0x57')][_0x3000('0x25')];return db['SmsMessage'][_0x3000('0x55')]({'where':{'messageId':_0x563c0b['body'][_0x3000('0xc9')]}});}break;}}})[_0x3000('0x32')](handleEntityNotFound(_0x482840,null))[_0x3000('0x32')](function(_0xe37521){if(_0xe37521){_0x62563f=_0xe37521;switch(_0x2261c5['type']){case _0x3000('0x7c'):if(_0x41f1a9===_0x3000('0xc7')){return _0x62563f['update']({'read':!![]});}else{logger[_0x3000('0x20')](_0x3000('0xbf'),'status','skebby',util[_0x3000('0xc1')](_0x563c0b[_0x3000('0x57')],{'showHidden':![],'depth':null}));}break;case _0x3000('0x7f'):if(_0x41f1a9==='1'){return _0x62563f[_0x3000('0x31')]({'read':!![]});}else{logger[_0x3000('0x20')](_0x3000('0xbf'),'status',_0x3000('0x7c'),util[_0x3000('0xc1')](_0x563c0b[_0x3000('0x57')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x563c0b[_0x3000('0x57')]['error_code']&&_0x41f1a9>=0xc8&&_0x41f1a9<=0xce){return _0x62563f[_0x3000('0x31')]({'read':!![]});}else{logger['error'](_0x3000('0xbf'),_0x3000('0x25'),_0x3000('0xca'),util[_0x3000('0xc1')](_0x563c0b['body'],{'showHidden':![],'depth':null}));}break;case _0x3000('0xcb'):var _0x2aca5e=_0x563c0b[_0x3000('0x57')][_0x3000('0x84')][0x0];if(_0x2aca5e[_0x3000('0x25')][_0x3000('0xc6')]===_0x3000('0xc7')){return _0x62563f[_0x3000('0x31')]({'read':!![]});}else{logger[_0x3000('0x20')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3000('0x25'),_0x3000('0xcb'),util[_0x3000('0xc1')](_0x563c0b[_0x3000('0x57')],{'showHidden':![],'depth':null}));}break;case _0x3000('0x87'):if(_0x41f1a9==_0x3000('0xcc')||_0x41f1a9==_0x3000('0xcd')){return _0x62563f['update']({'read':!![]});}else{logger[_0x3000('0x20')](_0x3000('0xbf'),_0x3000('0x25'),'clickatell',util['inspect'](_0x563c0b[_0x3000('0x57')],{'showHidden':![],'depth':null}));}break;case _0x3000('0x89'):if(_0x41f1a9==_0x3000('0xce')){return _0x62563f[_0x3000('0x31')]({'read':!![]});}else{logger['error'](_0x3000('0xbf'),_0x3000('0x25'),_0x3000('0x89'),util['inspect'](_0x563c0b[_0x3000('0x57')],{'showHidden':![],'depth':null}));}break;case _0x3000('0xc8'):if(_0x41f1a9===_0x3000('0xcf')||_0x41f1a9==='ACCEPTD'){return _0x62563f[_0x3000('0x31')]({'read':!![]});}else{logger['error'](_0x3000('0xbf'),_0x3000('0x25'),_0x3000('0xc8'),util[_0x3000('0xc1')](_0x563c0b[_0x3000('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x62563f;}})[_0x3000('0x32')](respondWithResult(_0x482840,null))[_0x3000('0x53')](handleError(_0x482840,null));};exports['statusGet']=function(_0x39dcb8,_0xfa41da,_0x927f5){var _0x56adf4,_0x186bb4,_0x19f4cb;return db[_0x3000('0x3b')][_0x3000('0x55')]({'where':{'id':_0x39dcb8[_0x3000('0x54')]['id']}})[_0x3000('0x32')](handleEntityNotFound(_0xfa41da,null))[_0x3000('0x32')](function(_0x504629){if(_0x504629){_0x19f4cb=_0x504629;logger[_0x3000('0x1e')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3000('0x25'),'received\x20delivery\x20report\x20from',_0x504629[_0x3000('0x4d')],util['inspect'](_0x39dcb8['query'],{'showHidden':![],'depth':null}));switch(_0x504629[_0x3000('0x4d')]){case'csc':if(_0x39dcb8[_0x3000('0x42')][_0x3000('0xd0')]&&_0x39dcb8[_0x3000('0x42')][_0x3000('0xd1')]){_0x186bb4=_0x39dcb8[_0x3000('0x42')][_0x3000('0xd1')];return db[_0x3000('0xa0')][_0x3000('0x55')]({'where':{'messageId':_0x39dcb8[_0x3000('0x42')][_0x3000('0xd0')]}});}break;}}})[_0x3000('0x32')](handleEntityNotFound(_0xfa41da,null))[_0x3000('0x32')](function(_0x184d09){if(_0x184d09){_0x56adf4=_0x184d09;switch(_0x19f4cb[_0x3000('0x4d')]){case _0x3000('0xd2'):if(_0x186bb4==='2'||_0x186bb4==='6'){return _0x56adf4[_0x3000('0x31')]({'read':!![]});}else{logger[_0x3000('0x20')](_0x3000('0xbf'),_0x3000('0x25'),_0x3000('0xd2'),util[_0x3000('0xc1')](_0x39dcb8[_0x3000('0x42')],{'showHidden':![],'depth':null}));};break;}return _0x56adf4;}})[_0x3000('0x32')](respondWithResult(_0xfa41da,null))[_0x3000('0x53')](handleError(_0xfa41da,null));};exports[_0x3000('0xd3')]=function(_0x4eb795,_0x2b9772,_0x385c07){return db[_0x3000('0x3b')][_0x3000('0x55')]({'where':{'id':_0x4eb795['params']['id']}})[_0x3000('0x32')](handleEntityNotFound(_0x2b9772,null))[_0x3000('0x32')](function(_0x4b0ada){if(_0x4b0ada){return _0x4b0ada[_0x3000('0xd3')](_0x4eb795['body'][_0x3000('0x66')],_[_0x3000('0x94')](_0x4eb795[_0x3000('0x57')],[_0x3000('0x66'),'id'])||{})['spread'](function(_0x21503e){for(var _0x352719=0x0;_0x352719<_0x4eb795['body'][_0x3000('0x66')][_0x3000('0x61')];_0x352719+=0x1){socket['emit'](_0x3000('0xd4'),{'UserId':Number(_0x4eb795[_0x3000('0x57')]['ids'][_0x352719]),'SmsAccountId':Number(_0x4eb795[_0x3000('0x54')]['id'])});}return _0x21503e;});}})[_0x3000('0x32')](respondWithResult(_0x2b9772,null))[_0x3000('0x53')](handleError(_0x2b9772,null));};exports['removeAgents']=function(_0x76bfbd,_0x12dfbc,_0x26c168){return db[_0x3000('0x3b')][_0x3000('0x55')]({'where':{'id':_0x76bfbd[_0x3000('0x54')]['id']}})['then'](handleEntityNotFound(_0x12dfbc,null))[_0x3000('0x32')](function(_0x2d3877){if(_0x2d3877){return _0x2d3877[_0x3000('0xd5')](_0x76bfbd[_0x3000('0x42')][_0x3000('0x66')])[_0x3000('0x32')](function(){if(_['isArray'](_0x76bfbd[_0x3000('0x42')][_0x3000('0x66')])){for(var _0x270a1a=0x0;_0x270a1a<_0x76bfbd[_0x3000('0x42')]['ids']['length'];_0x270a1a+=0x1){socket[_0x3000('0xd6')]('userSmsAccount:remove',{'UserId':Number(_0x76bfbd[_0x3000('0x42')][_0x3000('0x66')][_0x270a1a]),'SmsAccountId':Number(_0x76bfbd['params']['id'])});}}else{socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x76bfbd[_0x3000('0x42')]['ids']),'SmsAccountId':Number(_0x76bfbd['params']['id'])});}});}})[_0x3000('0x32')](respondWithStatusCode(_0x12dfbc,null))[_0x3000('0x53')](handleError(_0x12dfbc,null));};exports['getAgents']=function(_0x27f45e,_0x1f46e2,_0x37dfe1){var _0x26caf2={};var _0x2a5ff4={};var _0x417443;var _0x12f315;return db['SmsAccount'][_0x3000('0x6a')]({'where':{'id':_0x27f45e[_0x3000('0x54')]['id']}})[_0x3000('0x32')](handleEntityNotFound(_0x1f46e2,null))['then'](function(_0x2cad4a){if(_0x2cad4a){_0x417443=_0x2cad4a;_0x2a5ff4['model']=_['keys'](db[_0x3000('0xa3')][_0x3000('0x3c')]);_0x2a5ff4[_0x3000('0x42')]=_[_0x3000('0x3f')](_0x27f45e[_0x3000('0x42')]);_0x2a5ff4['filters']=_[_0x3000('0x41')](_0x2a5ff4['model'],_0x2a5ff4[_0x3000('0x42')]);_0x26caf2[_0x3000('0x43')]=_[_0x3000('0x41')](_0x2a5ff4['model'],qs[_0x3000('0x45')](_0x27f45e[_0x3000('0x42')]['fields']));_0x26caf2[_0x3000('0x43')]=_0x26caf2[_0x3000('0x43')][_0x3000('0x61')]?_0x26caf2['attributes']:_0x2a5ff4[_0x3000('0x44')];_0x26caf2['order']=qs[_0x3000('0x49')](_0x27f45e['query']['sort']);_0x26caf2[_0x3000('0x4a')]=qs['filters'](_['pick'](_0x27f45e[_0x3000('0x42')],_0x2a5ff4['filters']));if(_0x27f45e['query']['filter']){_0x26caf2[_0x3000('0x4a')]=_['merge'](_0x26caf2[_0x3000('0x4a')],{'$or':_[_0x3000('0x3e')](_0x26caf2[_0x3000('0x43')],function(_0x37de58){var _0x2983d4={};_0x2983d4[_0x37de58]={'$like':'%'+_0x27f45e[_0x3000('0x42')][_0x3000('0x4b')]+'%'};return _0x2983d4;})});}_0x26caf2=_[_0x3000('0x4c')]({},_0x26caf2,_0x27f45e['options']);return _0x417443['getAgents'](_0x26caf2);}})['then'](function(_0x29254b){if(_0x29254b){_0x12f315=_0x29254b[_0x3000('0x61')];if(!_0x27f45e[_0x3000('0x42')][_0x3000('0x46')](_0x3000('0x47'))){_0x26caf2[_0x3000('0x29')]=qs['limit'](_0x27f45e['query']['limit']);_0x26caf2['offset']=qs['offset'](_0x27f45e[_0x3000('0x42')][_0x3000('0x28')]);}return _0x417443['getAgents'](_0x26caf2);}})[_0x3000('0x32')](function(_0x17aed7){if(_0x17aed7){return _0x17aed7?{'count':_0x12f315,'rows':_0x17aed7}:null;}})[_0x3000('0x32')](respondWithResult(_0x1f46e2,null))[_0x3000('0x53')](handleError(_0x1f46e2,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 23ae2a4..34724ff 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 _0x7b3a=['exports','events','SmsAccount','setMaxListeners','save','remove','emit','hook'];(function(_0x311666,_0x17b07d){var _0x2bc692=function(_0x200073){while(--_0x200073){_0x311666['push'](_0x311666['shift']());}};_0x2bc692(++_0x17b07d);}(_0x7b3a,0x149));var _0xa7b3=function(_0x430497,_0x3965d0){_0x430497=_0x430497-0x0;var _0x3a5dc4=_0x7b3a[_0x430497];return _0x3a5dc4;};'use strict';var EventEmitter=require(_0xa7b3('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0xa7b3('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xa7b3('0x2')](0x0);var events={'afterCreate':_0xa7b3('0x3'),'afterUpdate':'update','afterDestroy':_0xa7b3('0x4')};function emitEvent(_0x34dfd6){return function(_0x124cd0,_0xe7d674,_0x302f24){SmsAccountEvents[_0xa7b3('0x5')](_0x34dfd6+':'+_0x124cd0['id'],_0x124cd0);SmsAccountEvents[_0xa7b3('0x5')](_0x34dfd6,_0x124cd0);_0x302f24(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0xa7b3('0x6')](e,emitEvent(event));}}module[_0xa7b3('0x7')]=SmsAccountEvents; \ No newline at end of file +var _0x57c3=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsAccount','setMaxListeners'];(function(_0x1cf8b4,_0x87e593){var _0x4c6ba9=function(_0x130149){while(--_0x130149){_0x1cf8b4['push'](_0x1cf8b4['shift']());}};_0x4c6ba9(++_0x87e593);}(_0x57c3,0x101));var _0x357c=function(_0x1acf1f,_0x4418c4){_0x1acf1f=_0x1acf1f-0x0;var _0x14e1f4=_0x57c3[_0x1acf1f];return _0x14e1f4;};'use strict';var EventEmitter=require(_0x357c('0x0'));var SmsAccount=require(_0x357c('0x1'))['db'][_0x357c('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x357c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x357c('0x4')};function emitEvent(_0x7ece1d){return function(_0x51ca90,_0x3b0012,_0x513065){SmsAccountEvents[_0x357c('0x5')](_0x7ece1d+':'+_0x51ca90['id'],_0x51ca90);SmsAccountEvents['emit'](_0x7ece1d,_0x51ca90);_0x513065(null);};}for(var e in events){if(events[_0x357c('0x6')](e)){var event=events[e];SmsAccount[_0x357c('0x7')](e,emitEvent(event));}}module[_0x357c('0x8')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index afe504e..06212f1 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 _0x7607=['rimraf','../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','util','../../config/logger','api','bluebird','request-promise'];(function(_0x43b2fc,_0x2c3adf){var _0x635038=function(_0x335f7e){while(--_0x335f7e){_0x43b2fc['push'](_0x43b2fc['shift']());}};_0x635038(++_0x2c3adf);}(_0x7607,0x19f));var _0x7760=function(_0x583a51,_0x5d8ea2){_0x583a51=_0x583a51-0x0;var _0x2cd2a0=_0x7607[_0x583a51];return _0x2cd2a0;};'use strict';var _=require('lodash');var util=require(_0x7760('0x0'));var logger=require(_0x7760('0x1'))(_0x7760('0x2'));var moment=require('moment');var BPromise=require(_0x7760('0x3'));var rp=require(_0x7760('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7760('0x5'));var config=require(_0x7760('0x6'));var attributes=require(_0x7760('0x7'));module[_0x7760('0x8')]=function(_0x53aff0,_0x525727){return _0x53aff0[_0x7760('0x9')](_0x7760('0xa'),attributes,{'tableName':_0x7760('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x40ad=['../../config/environment','./smsAccount.attributes','define','SmsAccount','sms_accounts','util','../../config/logger','moment','rimraf'];(function(_0x361971,_0x2039f9){var _0x1fbf41=function(_0xdd0404){while(--_0xdd0404){_0x361971['push'](_0x361971['shift']());}};_0x1fbf41(++_0x2039f9);}(_0x40ad,0x125));var _0xd40a=function(_0x900a62,_0x52889d){_0x900a62=_0x900a62-0x0;var _0x1f537a=_0x40ad[_0x900a62];return _0x1f537a;};'use strict';var _=require('lodash');var util=require(_0xd40a('0x0'));var logger=require(_0xd40a('0x1'))('api');var moment=require(_0xd40a('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd40a('0x3'));var config=require(_0xd40a('0x4'));var attributes=require(_0xd40a('0x5'));module['exports']=function(_0x39e3eb,_0x57308f){return _0x39e3eb[_0xd40a('0x6')](_0xd40a('0x7'),attributes,{'tableName':_0xd40a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 1d02e15..c9d315f 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 _0xd51c=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring'];(function(_0x41f1c3,_0x15c175){var _0x1ac76a=function(_0x8c5942){while(--_0x8c5942){_0x41f1c3['push'](_0x41f1c3['shift']());}};_0x1ac76a(++_0x15c175);}(_0xd51c,0x177));var _0xcd51=function(_0xcd2266,_0xb5ae46){_0xcd2266=_0xcd2266-0x0;var _0x299e37=_0xd51c[_0xcd2266];return _0x299e37;};'use strict';var _=require(_0xcd51('0x0'));var util=require(_0xcd51('0x1'));var moment=require(_0xcd51('0x2'));var BPromise=require(_0xcd51('0x3'));var rs=require(_0xcd51('0x4'));var fs=require('fs');var Redis=require(_0xcd51('0x5'));var db=require(_0xcd51('0x6'))['db'];var utils=require(_0xcd51('0x7'));var logger=require('../../config/logger')(_0xcd51('0x8'));var config=require(_0xcd51('0x9'));var jayson=require(_0xcd51('0xa'));var client=jayson[_0xcd51('0xb')]['http']({'port':0x232a});config[_0xcd51('0xc')]=_[_0xcd51('0xd')](config[_0xcd51('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcd51('0xc')]));require(_0xcd51('0xe'))[_0xcd51('0xf')](socket);function respondWithRpcPromise(_0x5658a1,_0x57bf33,_0xb1023c){return new BPromise(function(_0x5d6229,_0x50088a){return client[_0xcd51('0x10')](_0x5658a1,_0xb1023c)[_0xcd51('0x11')](function(_0x5474bc){logger[_0xcd51('0x12')](_0xcd51('0x13'),_0x57bf33,'request\x20sent');logger[_0xcd51('0x14')](_0xcd51('0x15'),_0x57bf33,'request\x20sent',JSON[_0xcd51('0x16')](_0x5474bc));if(_0x5474bc[_0xcd51('0x17')]){if(_0x5474bc[_0xcd51('0x17')][_0xcd51('0x18')]===0x1f4){logger[_0xcd51('0x17')](_0xcd51('0x13'),_0x57bf33,_0x5474bc[_0xcd51('0x17')]['message']);return _0x50088a(_0x5474bc[_0xcd51('0x17')]['message']);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x57bf33,_0x5474bc[_0xcd51('0x17')][_0xcd51('0x19')]);return _0x5d6229(_0x5474bc[_0xcd51('0x17')]['message']);}else{logger[_0xcd51('0x12')](_0xcd51('0x13'),_0x57bf33,'request\x20sent');_0x5d6229(_0x5474bc[_0xcd51('0x1a')][_0xcd51('0x19')]);}})[_0xcd51('0x1b')](function(_0x5f1e98){logger['error'](_0xcd51('0x13'),_0x57bf33,_0x5f1e98);_0x50088a(_0x5f1e98);});});}exports[_0xcd51('0x1c')]=function(_0x255b15){var _0xfd844d=this;return new Promise(function(_0x24d9e5,_0x4ee66c){return db[_0xcd51('0x1d')][_0xcd51('0x1e')]({'raw':_0x255b15[_0xcd51('0x1f')]?_0x255b15[_0xcd51('0x1f')][_0xcd51('0x20')]===undefined?!![]:![]:!![],'where':_0x255b15['options']?_0x255b15['options'][_0xcd51('0x21')]||null:null,'attributes':_0x255b15[_0xcd51('0x1f')]?_0x255b15['options'][_0xcd51('0x22')]||null:null,'include':_0x255b15[_0xcd51('0x1f')]?_0x255b15[_0xcd51('0x1f')][_0xcd51('0x23')]?_[_0xcd51('0x24')](_0x255b15[_0xcd51('0x1f')][_0xcd51('0x23')],function(_0x8990da){return{'model':db[_0x8990da[_0xcd51('0x25')]],'as':_0x8990da['as'],'attributes':_0x8990da[_0xcd51('0x22')],'include':_0x8990da['include']?_[_0xcd51('0x24')](_0x8990da[_0xcd51('0x23')],function(_0x16d1ee){return{'model':db[_0x16d1ee[_0xcd51('0x25')]],'as':_0x16d1ee['as'],'attributes':_0x16d1ee['attributes'],'include':_0x16d1ee['include']?_['map'](_0x16d1ee[_0xcd51('0x23')],function(_0x269830){return{'model':db[_0x269830[_0xcd51('0x25')]],'as':_0x269830['as'],'attributes':_0x269830['attributes']};}):[]};}):[]};}):[]:[]})[_0xcd51('0x11')](function(_0x3d8e76){logger['info']('ShowSmsAccount',_0x255b15);logger[_0xcd51('0x14')](_0xcd51('0x1c'),_0x255b15,JSON['stringify'](_0x3d8e76));_0x24d9e5(_0x3d8e76);})['catch'](function(_0x3cff7d){logger[_0xcd51('0x17')](_0xcd51('0x1c'),_0x3cff7d[_0xcd51('0x19')],_0x255b15);_0x4ee66c(_0xfd844d[_0xcd51('0x17')](0x1f4,_0x3cff7d['message']));});});}; \ No newline at end of file +var _0x2058=['redis','defaults','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','attributes','include','model','map','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5c2e34,_0x105b9c){var _0x33157a=function(_0x5018e2){while(--_0x5018e2){_0x5c2e34['push'](_0x5c2e34['shift']());}};_0x33157a(++_0x105b9c);}(_0x2058,0xae));var _0x8205=function(_0x92116d,_0xa6ee1b){_0x92116d=_0x92116d-0x0;var _0xfe4f60=_0x2058[_0x92116d];return _0xfe4f60;};'use strict';var _=require(_0x8205('0x0'));var util=require(_0x8205('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8205('0x2'));var fs=require('fs');var Redis=require(_0x8205('0x3'));var db=require(_0x8205('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8205('0x5'))(_0x8205('0x6'));var config=require(_0x8205('0x7'));var jayson=require(_0x8205('0x8'));var client=jayson[_0x8205('0x9')][_0x8205('0xa')]({'port':0x232a});config[_0x8205('0xb')]=_[_0x8205('0xc')](config[_0x8205('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x8205('0xd'))(new Redis(config[_0x8205('0xb')]));require(_0x8205('0xe'))[_0x8205('0xf')](socket);function respondWithRpcPromise(_0x29239f,_0x52d315,_0x3d1354){return new BPromise(function(_0x5293ec,_0x1bac3b){return client[_0x8205('0x10')](_0x29239f,_0x3d1354)[_0x8205('0x11')](function(_0x3cef36){logger[_0x8205('0x12')](_0x8205('0x13'),_0x52d315,_0x8205('0x14'));logger[_0x8205('0x15')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x52d315,_0x8205('0x14'),JSON[_0x8205('0x16')](_0x3cef36));if(_0x3cef36[_0x8205('0x17')]){if(_0x3cef36[_0x8205('0x17')][_0x8205('0x18')]===0x1f4){logger['error'](_0x8205('0x13'),_0x52d315,_0x3cef36[_0x8205('0x17')][_0x8205('0x19')]);return _0x1bac3b(_0x3cef36[_0x8205('0x17')]['message']);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x52d315,_0x3cef36['error'][_0x8205('0x19')]);return _0x5293ec(_0x3cef36[_0x8205('0x17')][_0x8205('0x19')]);}else{logger[_0x8205('0x12')](_0x8205('0x13'),_0x52d315,_0x8205('0x14'));_0x5293ec(_0x3cef36[_0x8205('0x1a')][_0x8205('0x19')]);}})[_0x8205('0x1b')](function(_0x2812de){logger[_0x8205('0x17')](_0x8205('0x13'),_0x52d315,_0x2812de);_0x1bac3b(_0x2812de);});});}exports[_0x8205('0x1c')]=function(_0x202afd){var _0x5088c3=this;return new Promise(function(_0x27d07b,_0x2207cf){return db[_0x8205('0x1d')][_0x8205('0x1e')]({'raw':_0x202afd[_0x8205('0x1f')]?_0x202afd[_0x8205('0x1f')][_0x8205('0x20')]===undefined?!![]:![]:!![],'where':_0x202afd['options']?_0x202afd['options']['where']||null:null,'attributes':_0x202afd[_0x8205('0x1f')]?_0x202afd[_0x8205('0x1f')][_0x8205('0x21')]||null:null,'include':_0x202afd['options']?_0x202afd['options']['include']?_['map'](_0x202afd[_0x8205('0x1f')][_0x8205('0x22')],function(_0x571aac){return{'model':db[_0x571aac[_0x8205('0x23')]],'as':_0x571aac['as'],'attributes':_0x571aac[_0x8205('0x21')],'include':_0x571aac[_0x8205('0x22')]?_[_0x8205('0x24')](_0x571aac['include'],function(_0x4b45d9){return{'model':db[_0x4b45d9['model']],'as':_0x4b45d9['as'],'attributes':_0x4b45d9[_0x8205('0x21')],'include':_0x4b45d9['include']?_[_0x8205('0x24')](_0x4b45d9['include'],function(_0x3bbb98){return{'model':db[_0x3bbb98[_0x8205('0x23')]],'as':_0x3bbb98['as'],'attributes':_0x3bbb98[_0x8205('0x21')]};}):[]};}):[]};}):[]:[]})[_0x8205('0x11')](function(_0x51475e){logger['info'](_0x8205('0x1c'),_0x202afd);logger[_0x8205('0x15')](_0x8205('0x1c'),_0x202afd,JSON['stringify'](_0x51475e));_0x27d07b(_0x51475e);})[_0x8205('0x1b')](function(_0x2ea1f8){logger['error']('ShowSmsAccount',_0x2ea1f8['message'],_0x202afd);_0x2207cf(_0x5088c3[_0x8205('0x17')](0x1f4,_0x2ea1f8['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 4f96788..0aee583 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index d9c4377..ae67de0 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 _0x7217=['Router','fs-extra','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x4aae85,_0x1a0e3e){var _0x2f8d92=function(_0x32c245){while(--_0x32c245){_0x4aae85['push'](_0x4aae85['shift']());}};_0x2f8d92(++_0x1a0e3e);}(_0x7217,0x19e));var _0x7721=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0x7217[_0x481bf7];return _0x461787;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0xd')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0xf')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router[_0x7721('0x10')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0x11')]);module[_0x7721('0x12')]=router; \ No newline at end of file +var _0x008c=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','post','put','/:id'];(function(_0x18d5f7,_0x11b476){var _0x2cc9ab=function(_0x5432a4){while(--_0x5432a4){_0x18d5f7['push'](_0x18d5f7['shift']());}};_0x2cc9ab(++_0x11b476);}(_0x008c,0x188));var _0xc008=function(_0x1acefc,_0x5da0bf){_0x1acefc=_0x1acefc-0x0;var _0x543527=_0x008c[_0x1acefc];return _0x543527;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc008('0xe')](_0xc008('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc008('0xf'),auth[_0xc008('0xb')](),controller['destroy']);module[_0xc008('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 260b3c2..46a2857 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 _0x334b=['INTEGER','STRING','noop','*,*,*,*','sequelize'];(function(_0x501fc4,_0x4de48c){var _0x2534e3=function(_0x586572){while(--_0x586572){_0x501fc4['push'](_0x501fc4['shift']());}};_0x2534e3(++_0x4de48c);}(_0x334b,0x17b));var _0xb334=function(_0x138df5,_0x188b50){_0x138df5=_0x138df5-0x0;var _0xaa38c7=_0x334b[_0x138df5];return _0xaa38c7;};'use strict';var Sequelize=require(_0xb334('0x0'));module['exports']={'priority':{'type':Sequelize[_0xb334('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xb334('0x2')],'allowNull':![],'defaultValue':_0xb334('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xb334('0x2')]},'interval':{'type':Sequelize[_0xb334('0x2')],'defaultValue':_0xb334('0x4')}}; \ No newline at end of file +var _0x7e12=['sequelize','exports','STRING','noop'];(function(_0x18be96,_0x15e628){var _0x4b9baa=function(_0x2791b9){while(--_0x2791b9){_0x18be96['push'](_0x18be96['shift']());}};_0x4b9baa(++_0x15e628);}(_0x7e12,0x17c));var _0x27e1=function(_0x35b18a,_0x6b2fbe){_0x35b18a=_0x35b18a-0x0;var _0x4db1bd=_0x7e12[_0x35b18a];return _0x4db1bd;};'use strict';var Sequelize=require(_0x27e1('0x0'));module[_0x27e1('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x27e1('0x2')],'allowNull':![],'defaultValue':_0x27e1('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x27e1('0x2')]},'interval':{'type':Sequelize[_0x27e1('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 7a953b5..306b2fc 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 _0x44d1=['papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring'];(function(_0x2ef252,_0x1993fe){var _0x1139ca=function(_0x31f949){while(--_0x31f949){_0x2ef252['push'](_0x2ef252['shift']());}};_0x1139ca(++_0x1993fe);}(_0x44d1,0x1a7));var _0x144d=function(_0x157b8c,_0x17a009){_0x157b8c=_0x157b8c-0x0;var _0x1d1ed4=_0x44d1[_0x157b8c];return _0x1d1ed4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x144d('0x0'));var zipdir=require(_0x144d('0x1'));var jsonpatch=require(_0x144d('0x2'));var rp=require(_0x144d('0x3'));var moment=require(_0x144d('0x4'));var BPromise=require(_0x144d('0x5'));var Mustache=require('mustache');var util=require(_0x144d('0x6'));var path=require(_0x144d('0x7'));var sox=require(_0x144d('0x8'));var csv=require(_0x144d('0x9'));var ejs=require(_0x144d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x144d('0xb'));var squel=require(_0x144d('0xc'));var crypto=require(_0x144d('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x144d('0x9'));var querystring=require(_0x144d('0xe'));var Papa=require(_0x144d('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x144d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x144d('0x11'));var logger=require(_0x144d('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x144d('0x13'));var licenseUtil=require(_0x144d('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24a64c,_0x5512bb){_0x5512bb=_0x5512bb||0xcc;return function(_0x7e874){if(_0x7e874){return _0x24a64c[_0x144d('0x15')](_0x5512bb);}return _0x24a64c['status'](_0x5512bb)[_0x144d('0x16')]();};}function respondWithResult(_0x509260,_0x539f46){_0x539f46=_0x539f46||0xc8;return function(_0x3b6069){if(_0x3b6069){return _0x509260[_0x144d('0x17')](_0x539f46)[_0x144d('0x18')](_0x3b6069);}};}function respondWithFilteredResult(_0x189b0c,_0x5556c4){return function(_0x7720b1){if(_0x7720b1){var _0x5cda48=typeof _0x5556c4[_0x144d('0x19')]===_0x144d('0x1a')&&typeof _0x5556c4[_0x144d('0x1b')]===_0x144d('0x1a');var _0x3aed0a=_0x7720b1['count'];var _0x5882f4=_0x5cda48?0x0:_0x5556c4['offset'];var _0xc13e97=_0x5cda48?_0x7720b1[_0x144d('0x1c')]:_0x5556c4['offset']+_0x5556c4[_0x144d('0x1b')];var _0x3a161b;if(_0xc13e97>=_0x3aed0a){_0xc13e97=_0x3aed0a;_0x3a161b=0xc8;}else{_0x3a161b=0xce;}_0x189b0c['status'](_0x3a161b);return _0x189b0c[_0x144d('0x1d')](_0x144d('0x1e'),_0x5882f4+'-'+_0xc13e97+'/'+_0x3aed0a)['json'](_0x7720b1);}return null;};}function patchUpdates(_0x2d18c5){return function(_0x618a0e){try{jsonpatch[_0x144d('0x1f')](_0x618a0e,_0x2d18c5,!![]);}catch(_0x4ced11){return BPromise[_0x144d('0x20')](_0x4ced11);}return _0x618a0e[_0x144d('0x21')]();};}function saveUpdates(_0x2cd110,_0x2c6dbb){return function(_0x38fda6){if(_0x38fda6){return _0x38fda6[_0x144d('0x22')](_0x2cd110)['then'](function(_0x39a742){return _0x39a742;});}return null;};}function removeEntity(_0x5a1d09,_0x5950a2){return function(_0x531c97){if(_0x531c97){return _0x531c97[_0x144d('0x23')]()[_0x144d('0x24')](function(){_0x5a1d09[_0x144d('0x17')](0xcc)[_0x144d('0x16')]();});}};}function handleEntityNotFound(_0x189df0,_0x11264e){return function(_0x5b5e32){if(!_0x5b5e32){_0x189df0['sendStatus'](0x194);}return _0x5b5e32;};}function handleError(_0x5eda80,_0x5e1616){_0x5e1616=_0x5e1616||0x1f4;return function(_0x54b437){logger[_0x144d('0x25')](_0x54b437['stack']);if(_0x54b437[_0x144d('0x26')]){delete _0x54b437[_0x144d('0x26')];}_0x5eda80['status'](_0x5e1616)[_0x144d('0x27')](_0x54b437);};}exports[_0x144d('0x28')]=function(_0x41db02,_0x42acd5){var _0x2bbe32={},_0x5e8315={},_0x1b4f94={'count':0x0,'rows':[]};var _0x3e5849=_[_0x144d('0x29')](db[_0x144d('0x2a')][_0x144d('0x2b')],function(_0x56e1d2){return{'name':_0x56e1d2[_0x144d('0x2c')],'type':_0x56e1d2[_0x144d('0x2d')]['key']};});_0x5e8315['model']=_[_0x144d('0x29')](_0x3e5849,_0x144d('0x26'));_0x5e8315[_0x144d('0x2e')]=_[_0x144d('0x2f')](_0x41db02[_0x144d('0x2e')]);_0x5e8315[_0x144d('0x30')]=_[_0x144d('0x31')](_0x5e8315[_0x144d('0x32')],_0x5e8315[_0x144d('0x2e')]);_0x2bbe32[_0x144d('0x33')]=_[_0x144d('0x31')](_0x5e8315['model'],qs['fields'](_0x41db02[_0x144d('0x2e')][_0x144d('0x34')]));_0x2bbe32['attributes']=_0x2bbe32[_0x144d('0x33')][_0x144d('0x35')]?_0x2bbe32[_0x144d('0x33')]:_0x5e8315[_0x144d('0x32')];if(!_0x41db02[_0x144d('0x2e')][_0x144d('0x36')](_0x144d('0x37'))){_0x2bbe32[_0x144d('0x1b')]=qs[_0x144d('0x1b')](_0x41db02[_0x144d('0x2e')][_0x144d('0x1b')]);_0x2bbe32[_0x144d('0x19')]=qs['offset'](_0x41db02[_0x144d('0x2e')]['offset']);}_0x2bbe32[_0x144d('0x38')]=qs[_0x144d('0x39')](_0x41db02[_0x144d('0x2e')][_0x144d('0x39')]);_0x2bbe32[_0x144d('0x3a')]=qs[_0x144d('0x30')](_[_0x144d('0x3b')](_0x41db02[_0x144d('0x2e')],_0x5e8315[_0x144d('0x30')]),_0x3e5849);if(_0x41db02[_0x144d('0x2e')][_0x144d('0x3c')]){_0x2bbe32['where']=_[_0x144d('0x3d')](_0x2bbe32[_0x144d('0x3a')],{'$or':_[_0x144d('0x29')](_0x3e5849,function(_0x376744){if(_0x376744[_0x144d('0x2d')]!=='VIRTUAL'){var _0x343b1f={};_0x343b1f[_0x376744[_0x144d('0x26')]]={'$like':'%'+_0x41db02['query'][_0x144d('0x3c')]+'%'};return _0x343b1f;}})});}_0x2bbe32=_[_0x144d('0x3d')]({},_0x2bbe32,_0x41db02[_0x144d('0x3e')]);var _0x480603={'where':_0x2bbe32[_0x144d('0x3a')]};return db[_0x144d('0x2a')][_0x144d('0x1c')](_0x480603)[_0x144d('0x24')](function(_0x1c05b8){_0x1b4f94[_0x144d('0x1c')]=_0x1c05b8;if(_0x41db02[_0x144d('0x2e')][_0x144d('0x3f')]){_0x2bbe32[_0x144d('0x40')]=[{'all':!![]}];}return db[_0x144d('0x2a')][_0x144d('0x41')](_0x2bbe32);})[_0x144d('0x24')](function(_0x4b8b99){_0x1b4f94[_0x144d('0x42')]=_0x4b8b99;return _0x1b4f94;})[_0x144d('0x24')](respondWithFilteredResult(_0x42acd5,_0x2bbe32))[_0x144d('0x43')](handleError(_0x42acd5,null));};exports[_0x144d('0x44')]=function(_0x359fa1,_0x109e33){var _0x415e2e={'raw':!![],'where':{'id':_0x359fa1[_0x144d('0x45')]['id']}},_0x3ddb1a={};_0x3ddb1a[_0x144d('0x32')]=_['keys'](db[_0x144d('0x2a')][_0x144d('0x2b')]);_0x3ddb1a[_0x144d('0x2e')]=_[_0x144d('0x2f')](_0x359fa1['query']);_0x3ddb1a[_0x144d('0x30')]=_['intersection'](_0x3ddb1a[_0x144d('0x32')],_0x3ddb1a[_0x144d('0x2e')]);_0x415e2e[_0x144d('0x33')]=_[_0x144d('0x31')](_0x3ddb1a[_0x144d('0x32')],qs[_0x144d('0x34')](_0x359fa1[_0x144d('0x2e')][_0x144d('0x34')]));_0x415e2e[_0x144d('0x33')]=_0x415e2e[_0x144d('0x33')]['length']?_0x415e2e['attributes']:_0x3ddb1a[_0x144d('0x32')];if(_0x359fa1[_0x144d('0x2e')][_0x144d('0x3f')]){_0x415e2e['include']=[{'all':!![]}];}_0x415e2e=_[_0x144d('0x3d')]({},_0x415e2e,_0x359fa1[_0x144d('0x3e')]);return db['SmsApplication'][_0x144d('0x46')](_0x415e2e)[_0x144d('0x24')](handleEntityNotFound(_0x109e33,null))[_0x144d('0x24')](respondWithResult(_0x109e33,null))[_0x144d('0x43')](handleError(_0x109e33,null));};exports['create']=function(_0x5408d6,_0x3eb249){return db[_0x144d('0x2a')][_0x144d('0x47')](_0x5408d6[_0x144d('0x48')],{})['then'](respondWithResult(_0x3eb249,0xc9))[_0x144d('0x43')](handleError(_0x3eb249,null));};exports[_0x144d('0x22')]=function(_0x1d212d,_0x97f131){if(_0x1d212d[_0x144d('0x48')]['id']){delete _0x1d212d['body']['id'];}return db['SmsApplication'][_0x144d('0x46')]({'where':{'id':_0x1d212d[_0x144d('0x45')]['id']}})[_0x144d('0x24')](handleEntityNotFound(_0x97f131,null))[_0x144d('0x24')](saveUpdates(_0x1d212d[_0x144d('0x48')],null))[_0x144d('0x24')](respondWithResult(_0x97f131,null))[_0x144d('0x43')](handleError(_0x97f131,null));};exports['destroy']=function(_0x55c583,_0x3f3ac4){return db[_0x144d('0x2a')][_0x144d('0x46')]({'where':{'id':_0x55c583[_0x144d('0x45')]['id']}})['then'](handleEntityNotFound(_0x3f3ac4,null))[_0x144d('0x24')](removeEntity(_0x3f3ac4,null))[_0x144d('0x43')](handleError(_0x3f3ac4,null));}; \ No newline at end of file +var _0x4805=['key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','type','VIRTUAL','options','then','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','destroy','error','name','map','SmsApplication','fieldName'];(function(_0x2ca887,_0x5e3c0f){var _0x41493f=function(_0x2f9346){while(--_0x2f9346){_0x2ca887['push'](_0x2ca887['shift']());}};_0x41493f(++_0x5e3c0f);}(_0x4805,0x1c3));var _0x5480=function(_0x36d7d7,_0x2686f2){_0x36d7d7=_0x36d7d7-0x0;var _0x58ee87=_0x4805[_0x36d7d7];return _0x58ee87;};'use strict';var emlformat=require(_0x5480('0x0'));var rimraf=require(_0x5480('0x1'));var zipdir=require(_0x5480('0x2'));var jsonpatch=require(_0x5480('0x3'));var rp=require(_0x5480('0x4'));var moment=require(_0x5480('0x5'));var BPromise=require(_0x5480('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5480('0x7'));var sox=require(_0x5480('0x8'));var csv=require(_0x5480('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5480('0xa'));var _=require(_0x5480('0xb'));var squel=require(_0x5480('0xc'));var crypto=require(_0x5480('0xd'));var jsforce=require(_0x5480('0xe'));var deskjs=require(_0x5480('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5480('0x10'));var Papa=require(_0x5480('0x11'));var Redis=require(_0x5480('0x12'));var authService=require(_0x5480('0x13'));var qs=require(_0x5480('0x14'));var as=require(_0x5480('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5480('0x16'))(_0x5480('0x17'));var utils=require(_0x5480('0x18'));var config=require(_0x5480('0x19'));var licenseUtil=require(_0x5480('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29c830,_0x432ad7){_0x432ad7=_0x432ad7||0xcc;return function(_0x442f59){if(_0x442f59){return _0x29c830[_0x5480('0x1b')](_0x432ad7);}return _0x29c830[_0x5480('0x1c')](_0x432ad7)[_0x5480('0x1d')]();};}function respondWithResult(_0x3229cf,_0xaec2da){_0xaec2da=_0xaec2da||0xc8;return function(_0x1ef581){if(_0x1ef581){return _0x3229cf['status'](_0xaec2da)['json'](_0x1ef581);}};}function respondWithFilteredResult(_0x1dbbe4,_0x4e0805){return function(_0x4bef7d){if(_0x4bef7d){var _0x519e9a=typeof _0x4e0805[_0x5480('0x1e')]==='undefined'&&typeof _0x4e0805[_0x5480('0x1f')]===_0x5480('0x20');var _0x335e4c=_0x4bef7d[_0x5480('0x21')];var _0x348095=_0x519e9a?0x0:_0x4e0805[_0x5480('0x1e')];var _0x2fd2c2=_0x519e9a?_0x4bef7d[_0x5480('0x21')]:_0x4e0805[_0x5480('0x1e')]+_0x4e0805[_0x5480('0x1f')];var _0x15767e;if(_0x2fd2c2>=_0x335e4c){_0x2fd2c2=_0x335e4c;_0x15767e=0xc8;}else{_0x15767e=0xce;}_0x1dbbe4[_0x5480('0x1c')](_0x15767e);return _0x1dbbe4[_0x5480('0x22')](_0x5480('0x23'),_0x348095+'-'+_0x2fd2c2+'/'+_0x335e4c)[_0x5480('0x24')](_0x4bef7d);}return null;};}function patchUpdates(_0x3ea7dc){return function(_0x3072f1){try{jsonpatch[_0x5480('0x25')](_0x3072f1,_0x3ea7dc,!![]);}catch(_0x5df193){return BPromise[_0x5480('0x26')](_0x5df193);}return _0x3072f1['save']();};}function saveUpdates(_0x2a35c6,_0x211bfd){return function(_0x7d6976){if(_0x7d6976){return _0x7d6976[_0x5480('0x27')](_0x2a35c6)['then'](function(_0x43e7cc){return _0x43e7cc;});}return null;};}function removeEntity(_0x2b0e29,_0x5be9ac){return function(_0x31eeee){if(_0x31eeee){return _0x31eeee[_0x5480('0x28')]()['then'](function(){_0x2b0e29[_0x5480('0x1c')](0xcc)[_0x5480('0x1d')]();});}};}function handleEntityNotFound(_0x3bde3b,_0x2a9dc4){return function(_0x2f44c9){if(!_0x2f44c9){_0x3bde3b[_0x5480('0x1b')](0x194);}return _0x2f44c9;};}function handleError(_0x247ed3,_0x19ccb8){_0x19ccb8=_0x19ccb8||0x1f4;return function(_0x2a4f09){logger[_0x5480('0x29')](_0x2a4f09['stack']);if(_0x2a4f09[_0x5480('0x2a')]){delete _0x2a4f09[_0x5480('0x2a')];}_0x247ed3[_0x5480('0x1c')](_0x19ccb8)['send'](_0x2a4f09);};}exports['index']=function(_0x13262a,_0x38cf81){var _0x4060ea={},_0x34ade5={},_0x373956={'count':0x0,'rows':[]};var _0x42992d=_[_0x5480('0x2b')](db[_0x5480('0x2c')]['rawAttributes'],function(_0x46b8b7){return{'name':_0x46b8b7[_0x5480('0x2d')],'type':_0x46b8b7['type'][_0x5480('0x2e')]};});_0x34ade5[_0x5480('0x2f')]=_[_0x5480('0x2b')](_0x42992d,'name');_0x34ade5[_0x5480('0x30')]=_[_0x5480('0x31')](_0x13262a[_0x5480('0x30')]);_0x34ade5[_0x5480('0x32')]=_[_0x5480('0x33')](_0x34ade5[_0x5480('0x2f')],_0x34ade5[_0x5480('0x30')]);_0x4060ea['attributes']=_[_0x5480('0x33')](_0x34ade5[_0x5480('0x2f')],qs[_0x5480('0x34')](_0x13262a[_0x5480('0x30')]['fields']));_0x4060ea[_0x5480('0x35')]=_0x4060ea[_0x5480('0x35')][_0x5480('0x36')]?_0x4060ea[_0x5480('0x35')]:_0x34ade5[_0x5480('0x2f')];if(!_0x13262a[_0x5480('0x30')]['hasOwnProperty'](_0x5480('0x37'))){_0x4060ea['limit']=qs[_0x5480('0x1f')](_0x13262a[_0x5480('0x30')][_0x5480('0x1f')]);_0x4060ea[_0x5480('0x1e')]=qs['offset'](_0x13262a['query'][_0x5480('0x1e')]);}_0x4060ea[_0x5480('0x38')]=qs[_0x5480('0x39')](_0x13262a[_0x5480('0x30')]['sort']);_0x4060ea[_0x5480('0x3a')]=qs[_0x5480('0x32')](_['pick'](_0x13262a[_0x5480('0x30')],_0x34ade5['filters']),_0x42992d);if(_0x13262a[_0x5480('0x30')][_0x5480('0x3b')]){_0x4060ea[_0x5480('0x3a')]=_['merge'](_0x4060ea[_0x5480('0x3a')],{'$or':_['map'](_0x42992d,function(_0x2e35de){if(_0x2e35de[_0x5480('0x3c')]!==_0x5480('0x3d')){var _0x1efab2={};_0x1efab2[_0x2e35de[_0x5480('0x2a')]]={'$like':'%'+_0x13262a[_0x5480('0x30')][_0x5480('0x3b')]+'%'};return _0x1efab2;}})});}_0x4060ea=_['merge']({},_0x4060ea,_0x13262a[_0x5480('0x3e')]);var _0x552eaf={'where':_0x4060ea['where']};return db[_0x5480('0x2c')][_0x5480('0x21')](_0x552eaf)[_0x5480('0x3f')](function(_0xbbe657){_0x373956['count']=_0xbbe657;if(_0x13262a[_0x5480('0x30')]['includeAll']){_0x4060ea['include']=[{'all':!![]}];}return db['SmsApplication']['findAll'](_0x4060ea);})[_0x5480('0x3f')](function(_0xa3d328){_0x373956[_0x5480('0x40')]=_0xa3d328;return _0x373956;})[_0x5480('0x3f')](respondWithFilteredResult(_0x38cf81,_0x4060ea))[_0x5480('0x41')](handleError(_0x38cf81,null));};exports[_0x5480('0x42')]=function(_0x2d8b87,_0x3db09a){var _0x7418c5={'raw':!![],'where':{'id':_0x2d8b87[_0x5480('0x43')]['id']}},_0x11ff8d={};_0x11ff8d[_0x5480('0x2f')]=_[_0x5480('0x31')](db[_0x5480('0x2c')]['rawAttributes']);_0x11ff8d[_0x5480('0x30')]=_[_0x5480('0x31')](_0x2d8b87[_0x5480('0x30')]);_0x11ff8d[_0x5480('0x32')]=_['intersection'](_0x11ff8d[_0x5480('0x2f')],_0x11ff8d[_0x5480('0x30')]);_0x7418c5[_0x5480('0x35')]=_[_0x5480('0x33')](_0x11ff8d[_0x5480('0x2f')],qs[_0x5480('0x34')](_0x2d8b87[_0x5480('0x30')][_0x5480('0x34')]));_0x7418c5['attributes']=_0x7418c5[_0x5480('0x35')][_0x5480('0x36')]?_0x7418c5[_0x5480('0x35')]:_0x11ff8d[_0x5480('0x2f')];if(_0x2d8b87[_0x5480('0x30')]['includeAll']){_0x7418c5['include']=[{'all':!![]}];}_0x7418c5=_['merge']({},_0x7418c5,_0x2d8b87[_0x5480('0x3e')]);return db[_0x5480('0x2c')][_0x5480('0x44')](_0x7418c5)[_0x5480('0x3f')](handleEntityNotFound(_0x3db09a,null))['then'](respondWithResult(_0x3db09a,null))['catch'](handleError(_0x3db09a,null));};exports[_0x5480('0x45')]=function(_0x163f25,_0x3dac88){return db[_0x5480('0x2c')][_0x5480('0x45')](_0x163f25['body'],{})['then'](respondWithResult(_0x3dac88,0xc9))[_0x5480('0x41')](handleError(_0x3dac88,null));};exports[_0x5480('0x27')]=function(_0x43a398,_0x2532f2){if(_0x43a398['body']['id']){delete _0x43a398[_0x5480('0x46')]['id'];}return db[_0x5480('0x2c')]['find']({'where':{'id':_0x43a398[_0x5480('0x43')]['id']}})['then'](handleEntityNotFound(_0x2532f2,null))[_0x5480('0x3f')](saveUpdates(_0x43a398['body'],null))[_0x5480('0x3f')](respondWithResult(_0x2532f2,null))[_0x5480('0x41')](handleError(_0x2532f2,null));};exports[_0x5480('0x28')]=function(_0x5e3ddd,_0x561748){return db[_0x5480('0x2c')]['find']({'where':{'id':_0x5e3ddd[_0x5480('0x43')]['id']}})[_0x5480('0x3f')](handleEntityNotFound(_0x561748,null))[_0x5480('0x3f')](removeEntity(_0x561748,null))[_0x5480('0x41')](handleError(_0x561748,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 7d954a5..d42670e 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 _0xef6c=['../../config/environment','exports','define','SmsApplication','sms_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','rimraf'];(function(_0x46cb69,_0x232097){var _0x3a9663=function(_0x277341){while(--_0x277341){_0x46cb69['push'](_0x46cb69['shift']());}};_0x3a9663(++_0x232097);}(_0xef6c,0x10e));var _0xcef6=function(_0x580971,_0x10984d){_0x580971=_0x580971-0x0;var _0x16d873=_0xef6c[_0x580971];return _0x16d873;};'use strict';var _=require(_0xcef6('0x0'));var util=require(_0xcef6('0x1'));var logger=require(_0xcef6('0x2'))('api');var moment=require('moment');var BPromise=require(_0xcef6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xcef6('0x4'));var config=require(_0xcef6('0x5'));var attributes=require('./smsApplication.attributes');module[_0xcef6('0x6')]=function(_0x2a7951,_0x52ab47){return _0x2a7951[_0xcef6('0x7')](_0xcef6('0x8'),attributes,{'tableName':_0xcef6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xcef6('0xa')});}; \ No newline at end of file +var _0x6658=['sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./smsApplication.attributes','define','SmsApplication'];(function(_0xb151c3,_0x28f0f2){var _0x2ca79b=function(_0x2dff40){while(--_0x2dff40){_0xb151c3['push'](_0xb151c3['shift']());}};_0x2ca79b(++_0x28f0f2);}(_0x6658,0x198));var _0x8665=function(_0x4f6e28,_0x40df83){_0x4f6e28=_0x4f6e28-0x0;var _0x2eea9f=_0x6658[_0x4f6e28];return _0x2eea9f;};'use strict';var _=require(_0x8665('0x0'));var util=require(_0x8665('0x1'));var logger=require(_0x8665('0x2'))(_0x8665('0x3'));var moment=require(_0x8665('0x4'));var BPromise=require(_0x8665('0x5'));var rp=require(_0x8665('0x6'));var fs=require('fs');var path=require(_0x8665('0x7'));var rimraf=require('rimraf');var config=require(_0x8665('0x8'));var attributes=require(_0x8665('0x9'));module['exports']=function(_0x562829,_0x203780){return _0x562829[_0x8665('0xa')](_0x8665('0xb'),attributes,{'tableName':_0x8665('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8665('0xd'),'collate':_0x8665('0xe')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index ee79f23..00aaab0 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 _0x39d0=['rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','error','code','SmsApplication,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x39d0,0x144));var _0x039d=function(_0x59cbca,_0x5869be){_0x59cbca=_0x59cbca-0x0;var _0x1bb1c0=_0x39d0[_0x59cbca];return _0x1bb1c0;};'use strict';var _=require(_0x039d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x039d('0x1'));var rs=require(_0x039d('0x2'));var fs=require('fs');var Redis=require(_0x039d('0x3'));var db=require(_0x039d('0x4'))['db'];var utils=require(_0x039d('0x5'));var logger=require('../../config/logger')(_0x039d('0x6'));var config=require(_0x039d('0x7'));var jayson=require(_0x039d('0x8'));var client=jayson[_0x039d('0x9')][_0x039d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7dcc60,_0x2f8c4b,_0x4705e8){return new BPromise(function(_0x425f6e,_0x210090){return client[_0x039d('0xb')](_0x7dcc60,_0x4705e8)['then'](function(_0x591f97){logger[_0x039d('0xc')]('SmsApplication,\x20%s,\x20%s',_0x2f8c4b,_0x039d('0xd'));logger[_0x039d('0xe')](_0x039d('0xf'),_0x2f8c4b,_0x039d('0xd'),JSON['stringify'](_0x591f97));if(_0x591f97[_0x039d('0x10')]){if(_0x591f97[_0x039d('0x10')][_0x039d('0x11')]===0x1f4){logger['error'](_0x039d('0x12'),_0x2f8c4b,_0x591f97[_0x039d('0x10')][_0x039d('0x13')]);return _0x210090(_0x591f97[_0x039d('0x10')][_0x039d('0x13')]);}logger[_0x039d('0x10')](_0x039d('0x12'),_0x2f8c4b,_0x591f97['error']['message']);return _0x425f6e(_0x591f97[_0x039d('0x10')][_0x039d('0x13')]);}else{logger[_0x039d('0xc')](_0x039d('0x12'),_0x2f8c4b,_0x039d('0xd'));_0x425f6e(_0x591f97[_0x039d('0x14')]['message']);}})[_0x039d('0x15')](function(_0x226853){logger[_0x039d('0x10')]('SmsApplication,\x20%s,\x20%s',_0x2f8c4b,_0x226853);_0x210090(_0x226853);});});} \ No newline at end of file +var _0x8a87=['http','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client'];(function(_0x34c98c,_0x5cfd45){var _0x41328f=function(_0x16cb29){while(--_0x16cb29){_0x34c98c['push'](_0x34c98c['shift']());}};_0x41328f(++_0x5cfd45);}(_0x8a87,0x6b));var _0x78a8=function(_0x1aeb39,_0x2e8404){_0x1aeb39=_0x1aeb39-0x0;var _0x439790=_0x8a87[_0x1aeb39];return _0x439790;};'use strict';var _=require(_0x78a8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x78a8('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x78a8('0x2'));var db=require(_0x78a8('0x3'))['db'];var utils=require(_0x78a8('0x4'));var logger=require('../../config/logger')(_0x78a8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x78a8('0x6')][_0x78a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x285f95,_0x1d8888,_0x2ba377){return new BPromise(function(_0x50fd6e,_0x46846f){return client['request'](_0x285f95,_0x2ba377)[_0x78a8('0x8')](function(_0x48c013){logger[_0x78a8('0x9')](_0x78a8('0xa'),_0x1d8888,_0x78a8('0xb'));logger[_0x78a8('0xc')](_0x78a8('0xd'),_0x1d8888,'request\x20sent',JSON['stringify'](_0x48c013));if(_0x48c013[_0x78a8('0xe')]){if(_0x48c013[_0x78a8('0xe')][_0x78a8('0xf')]===0x1f4){logger['error'](_0x78a8('0xa'),_0x1d8888,_0x48c013[_0x78a8('0xe')][_0x78a8('0x10')]);return _0x46846f(_0x48c013[_0x78a8('0xe')]['message']);}logger[_0x78a8('0xe')](_0x78a8('0xa'),_0x1d8888,_0x48c013[_0x78a8('0xe')][_0x78a8('0x10')]);return _0x50fd6e(_0x48c013[_0x78a8('0xe')][_0x78a8('0x10')]);}else{logger['info']('SmsApplication,\x20%s,\x20%s',_0x1d8888,'request\x20sent');_0x50fd6e(_0x48c013[_0x78a8('0x11')][_0x78a8('0x10')]);}})[_0x78a8('0x12')](function(_0x42ecfe){logger[_0x78a8('0xe')]('SmsApplication,\x20%s,\x20%s',_0x1d8888,_0x42ecfe);_0x46846f(_0x42ecfe);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 83b9635..2d6b22a 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 _0xe605=['./smsInteraction.controller','get','isAuthenticated','index','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','/:id','update','delete','smsinteraction:destroy','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x28c2b5,_0x7a7499){var _0xc3e148=function(_0x4095a){while(--_0x4095a){_0x28c2b5['push'](_0x28c2b5['shift']());}};_0xc3e148(++_0x7a7499);}(_0xe605,0x92));var _0x5e60=function(_0x4269ec,_0x1f3ab6){_0x4269ec=_0x4269ec-0x0;var _0x433b1c=_0xe605[_0x4269ec];return _0x433b1c;};'use strict';var multer=require(_0x5e60('0x0'));var util=require(_0x5e60('0x1'));var path=require('path');var timeout=require(_0x5e60('0x2'));var express=require(_0x5e60('0x3'));var router=express[_0x5e60('0x4')]();var fs_extra=require(_0x5e60('0x5'));var auth=require(_0x5e60('0x6'));var interaction=require(_0x5e60('0x7'));var config=require(_0x5e60('0x8'));var controller=require(_0x5e60('0x9'));router[_0x5e60('0xa')]('/',auth[_0x5e60('0xb')](),controller[_0x5e60('0xc')]);router[_0x5e60('0xa')]('/describe',auth[_0x5e60('0xb')](),controller['describe']);router['get']('/:id',auth[_0x5e60('0xb')](),controller[_0x5e60('0xd')]);router[_0x5e60('0xa')](_0x5e60('0xe'),auth[_0x5e60('0xb')](),controller[_0x5e60('0xf')]);router['get'](_0x5e60('0x10'),auth['isAuthenticated'](),controller[_0x5e60('0x11')]);router[_0x5e60('0x12')]('/',auth[_0x5e60('0xb')](),controller['create']);router[_0x5e60('0x12')](_0x5e60('0xe'),auth[_0x5e60('0xb')](),controller[_0x5e60('0x13')]);router[_0x5e60('0x12')](_0x5e60('0x14'),auth['isAuthenticated'](),interaction[_0x5e60('0x15')](_0x5e60('0x16'),_0x5e60('0x17')),controller[_0x5e60('0x18')]);router['put'](_0x5e60('0x19'),auth['isAuthenticated'](),interaction[_0x5e60('0x15')](_0x5e60('0x16'),'smsinteraction:update'),controller[_0x5e60('0x1a')]);router[_0x5e60('0x1b')](_0x5e60('0x19'),auth[_0x5e60('0xb')](),interaction['tracked'](_0x5e60('0x16'),_0x5e60('0x1c')),controller['destroy']);router[_0x5e60('0x1b')](_0x5e60('0x14'),auth[_0x5e60('0xb')](),controller[_0x5e60('0x1d')]);module[_0x5e60('0x1e')]=router; \ No newline at end of file +var _0xda3f=['/:id/tags','exports','util','path','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages','download','post','create','addMessage','sms','smsinteraction:addtags','tracked','smsinteraction:update','update','delete','destroy'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0xda3f,0xec));var _0xfda3=function(_0xd41f3d,_0x3135e8){_0xd41f3d=_0xd41f3d-0x0;var _0x5159d0=_0xda3f[_0xd41f3d];return _0x5159d0;};'use strict';var multer=require('multer');var util=require(_0xfda3('0x0'));var path=require(_0xfda3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xfda3('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xfda3('0x3'));var config=require(_0xfda3('0x4'));var controller=require('./smsInteraction.controller');router[_0xfda3('0x5')]('/',auth[_0xfda3('0x6')](),controller['index']);router['get'](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0x8')]);router[_0xfda3('0x5')](_0xfda3('0x9'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xa')]);router[_0xfda3('0x5')](_0xfda3('0xb'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xc')]);router[_0xfda3('0x5')]('/:id/download',auth[_0xfda3('0x6')](),controller[_0xfda3('0xd')]);router[_0xfda3('0xe')]('/',auth[_0xfda3('0x6')](),controller[_0xfda3('0xf')]);router['post'](_0xfda3('0xb'),auth['isAuthenticated'](),controller[_0xfda3('0x10')]);router[_0xfda3('0xe')]('/:id/tags',auth['isAuthenticated'](),interaction['tracked'](_0xfda3('0x11'),_0xfda3('0x12')),controller['addTags']);router['put']('/:id',auth[_0xfda3('0x6')](),interaction[_0xfda3('0x13')](_0xfda3('0x11'),_0xfda3('0x14')),controller[_0xfda3('0x15')]);router[_0xfda3('0x16')](_0xfda3('0x9'),auth[_0xfda3('0x6')](),interaction[_0xfda3('0x13')](_0xfda3('0x11'),'smsinteraction:destroy'),controller[_0xfda3('0x17')]);router[_0xfda3('0x16')](_0xfda3('0x18'),auth[_0xfda3('0x6')](),controller['removeTags']);module[_0xfda3('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 95e63cd..3e8e2f7 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 _0xce22=['ENUM','out','sequelize','moment','exports','BOOLEAN','DATE','STRING'];(function(_0x3d502d,_0xa3a52a){var _0x358085=function(_0x19ad4e){while(--_0x19ad4e){_0x3d502d['push'](_0x3d502d['shift']());}};_0x358085(++_0xa3a52a);}(_0xce22,0xea));var _0x2ce2=function(_0x464ab3,_0x4e6ffc){_0x464ab3=_0x464ab3-0x0;var _0x2ae037=_0xce22[_0x464ab3];return _0x2ae037;};'use strict';var Sequelize=require(_0x2ce2('0x0'));var moment=require(_0x2ce2('0x1'));module[_0x2ce2('0x2')]={'closed':{'type':Sequelize[_0x2ce2('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2ce2('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x2ce2('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x2ce2('0x5')]},'phone':{'type':Sequelize[_0x2ce2('0x5')]},'read1stAt':{'type':Sequelize[_0x2ce2('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x2ce2('0x6')]('in',_0x2ce2('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x2ce2('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x2ce2('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x2ce2('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x004c=['BOOLEAN','STRING','DATE','out','ENUM','sequelize','moment','exports'];(function(_0x55d7da,_0x14459d){var _0x7a431c=function(_0xf00e1a){while(--_0xf00e1a){_0x55d7da['push'](_0x55d7da['shift']());}};_0x7a431c(++_0x14459d);}(_0x004c,0x85));var _0xc004=function(_0x2db12b,_0x30ab1d){_0x2db12b=_0x2db12b-0x0;var _0x20990b=_0x004c[_0x2db12b];return _0x20990b;};'use strict';var Sequelize=require(_0xc004('0x0'));var moment=require(_0xc004('0x1'));module[_0xc004('0x2')]={'closed':{'type':Sequelize[_0xc004('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xc004('0x4')]},'secondDisposition':{'type':Sequelize[_0xc004('0x4')]},'thirdDisposition':{'type':Sequelize[_0xc004('0x4')]},'note':{'type':Sequelize[_0xc004('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xc004('0x5')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xc004('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc004('0x5')]},'lastMsgDirection':{'type':Sequelize[_0xc004('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xc004('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 82604ae..2f66cc6 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 _0x9dce=['name','send','Users','map','fullname','Tags','TagIds','split','forEach','push','then','catch','index','SmsInteraction','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','u.fullname','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','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)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','UserId','buildExpression','text','start','some','SmsAccountId','i.SmsAccountId\x20IN\x20?','createdAt','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','tag','filter','isNumeric','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','toString','sequelize','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','i.*','c.firstName','c.lastName','c.email','c.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','groupBy','all','rows','show','include','create','body','update','params','describe','addMessage','SmsMessage','ids','getMessages','findOne','SmsInteractionId','$gte','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','findAll','addTags','setTags','omit','spread','emit','smsInteractionTags:save','removeTags','download','unix','server','files','root','attachments','join','format','User','CmContact','firstName','Messages','direction','secret','SmsAccount','Owner','get','mkdirSync','Sms','Account','N.A.','closed','closedAt','System','lastName','out','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./smsInteraction.socket','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','error','stack'];(function(_0x26d9b6,_0x138d10){var _0x38b2ad=function(_0x1422cf){while(--_0x1422cf){_0x26d9b6['push'](_0x26d9b6['shift']());}};_0x38b2ad(++_0x138d10);}(_0x9dce,0xbe));var _0xe9dc=function(_0x4b8709,_0x2fa15a){_0x4b8709=_0x4b8709-0x0;var _0x57faae=_0x9dce[_0x4b8709];return _0x57faae;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9dc('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9dc('0x1'));var rp=require(_0xe9dc('0x2'));var moment=require(_0xe9dc('0x3'));var BPromise=require(_0xe9dc('0x4'));var Mustache=require(_0xe9dc('0x5'));var util=require('util');var path=require(_0xe9dc('0x6'));var sox=require(_0xe9dc('0x7'));var csv=require(_0xe9dc('0x8'));var ejs=require(_0xe9dc('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe9dc('0xa'));var squel=require(_0xe9dc('0xb'));var crypto=require(_0xe9dc('0xc'));var jsforce=require(_0xe9dc('0xd'));var deskjs=require(_0xe9dc('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe9dc('0xf'));var Papa=require(_0xe9dc('0x10'));var Redis=require(_0xe9dc('0x11'));var authService=require(_0xe9dc('0x12'));var qs=require(_0xe9dc('0x13'));var as=require(_0xe9dc('0x14'));var pdf=require('../../components/export/pdf');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe9dc('0x15'))('api');var utils=require(_0xe9dc('0x16'));var config=require(_0xe9dc('0x17'));var licenseUtil=require(_0xe9dc('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xe9dc('0x19')](config[_0xe9dc('0x1a')],{'host':_0xe9dc('0x1b'),'port':0x18eb});var socket=require(_0xe9dc('0x1c'))(new Redis(config[_0xe9dc('0x1a')]));require(_0xe9dc('0x1d'))['register'](socket);function respondWithStatusCode(_0x29a9be,_0x200332){_0x200332=_0x200332||0xcc;return function(_0x460b1b){if(_0x460b1b){return _0x29a9be[_0xe9dc('0x1e')](_0x200332);}return _0x29a9be[_0xe9dc('0x1f')](_0x200332)[_0xe9dc('0x20')]();};}function respondWithResult(_0x305fa6,_0x2375e5){_0x2375e5=_0x2375e5||0xc8;return function(_0x535413){if(_0x535413){return _0x305fa6[_0xe9dc('0x1f')](_0x2375e5)['json'](_0x535413);}};}function respondWithFilteredResult(_0xfac80d,_0x42b297){return function(_0x418651){if(_0x418651){var _0x430a23=typeof _0x42b297[_0xe9dc('0x21')]===_0xe9dc('0x22')&&typeof _0x42b297[_0xe9dc('0x23')]===_0xe9dc('0x22');var _0x6cc332=_0x418651[_0xe9dc('0x24')];var _0x22d676=_0x430a23?0x0:_0x42b297[_0xe9dc('0x21')];var _0x5f1e3f=_0x430a23?_0x418651[_0xe9dc('0x24')]:_0x42b297['offset']+_0x42b297[_0xe9dc('0x23')];var _0x2a88fa;if(_0x5f1e3f>=_0x6cc332){_0x5f1e3f=_0x6cc332;_0x2a88fa=0xc8;}else{_0x2a88fa=0xce;}_0xfac80d[_0xe9dc('0x1f')](_0x2a88fa);return _0xfac80d[_0xe9dc('0x25')](_0xe9dc('0x26'),_0x22d676+'-'+_0x5f1e3f+'/'+_0x6cc332)[_0xe9dc('0x27')](_0x418651);}return null;};}function patchUpdates(_0x106401){return function(_0x516d56){try{jsonpatch[_0xe9dc('0x28')](_0x516d56,_0x106401,!![]);}catch(_0x294962){return BPromise[_0xe9dc('0x29')](_0x294962);}return _0x516d56[_0xe9dc('0x2a')]();};}function saveUpdates(_0x154a69,_0x169a61){return function(_0x387f07){if(_0x387f07){return _0x387f07['update'](_0x154a69)['then'](function(_0x24c7cd){return _0x24c7cd;});}return null;};}function removeEntity(_0x76c25b,_0x154d66){return function(_0x196be5){if(_0x196be5){return _0x196be5['destroy']()['then'](function(){_0x76c25b[_0xe9dc('0x1f')](0xcc)[_0xe9dc('0x20')]();});}};}function handleEntityNotFound(_0x2144ae,_0x248f23){return function(_0x3e3694){if(!_0x3e3694){_0x2144ae[_0xe9dc('0x1e')](0x194);}return _0x3e3694;};}function handleError(_0x3fd4d4,_0x390b15){_0x390b15=_0x390b15||0x1f4;return function(_0x643b6d){logger[_0xe9dc('0x2b')](_0x643b6d[_0xe9dc('0x2c')]);if(_0x643b6d[_0xe9dc('0x2d')]){delete _0x643b6d[_0xe9dc('0x2d')];}_0x3fd4d4[_0xe9dc('0x1f')](_0x390b15)[_0xe9dc('0x2e')](_0x643b6d);};}function getInteractionUsers(_0x534934,_0x1722f8){return new BPromise(function(_0x16597e,_0x3a2eb6){try{if(_0x1722f8[_0x534934['id']]){_0x534934[_0xe9dc('0x2f')]=_[_0xe9dc('0x30')](_0x1722f8[_0x534934['id']],function(_0x169312){return{'id':_0x169312['id'],'fullname':_0x169312[_0xe9dc('0x31')]};});}}catch(_0x3f2999){_0x3a2eb6(_0x3f2999);}_0x16597e(_0x534934);});}function getInteractionTags(_0x4577ae,_0x33d62a){return new BPromise(function(_0x1953e2,_0x571a38){try{if(_0x4577ae['TagIds']){_0x4577ae[_0xe9dc('0x32')]=[];_0x4577ae[_0xe9dc('0x33')][_0xe9dc('0x34')](',')[_0xe9dc('0x35')](function(_0x2c61f8){_0x4577ae['Tags'][_0xe9dc('0x36')](_0x33d62a[_0x2c61f8]);});}delete _0x4577ae[_0xe9dc('0x33')];}catch(_0x5ed5c9){_0x571a38(_0x5ed5c9);}_0x1953e2(_0x4577ae);});}function updateSmsInteraction(_0xcefc9d,_0x28862b,_0x367bca){return new BPromise(function(_0x37a189,_0x3027df){return getInteractionUsers(_0xcefc9d,_0x367bca)[_0xe9dc('0x37')](function(_0x2b378a){return getInteractionTags(_0x2b378a,_0x28862b);})[_0xe9dc('0x37')](function(_0x2f54c6){_0x37a189(_0x2f54c6);})[_0xe9dc('0x38')](function(_0x2c74f2){_0x3027df(_0x2c74f2);});});}exports[_0xe9dc('0x39')]=function(_0x486f86,_0x2cea5a){var _0x136fd4={},_0x318f3d={},_0x48e5c6={'count':0x0,'rows':[]};var _0x124bdf=_[_0xe9dc('0x30')](db[_0xe9dc('0x3a')][_0xe9dc('0x3b')],function(_0x22899e){return{'name':_0x22899e[_0xe9dc('0x3c')],'type':_0x22899e[_0xe9dc('0x3d')]['key']};});_0x318f3d['model']=_[_0xe9dc('0x30')](_0x124bdf,_0xe9dc('0x2d'));_0x318f3d[_0xe9dc('0x3e')]=_[_0xe9dc('0x3f')](_0x486f86['query']);_0x318f3d[_0xe9dc('0x40')]=_[_0xe9dc('0x41')](_0x318f3d[_0xe9dc('0x42')],_0x318f3d[_0xe9dc('0x3e')]);_0x136fd4[_0xe9dc('0x43')]=_[_0xe9dc('0x41')](_0x318f3d[_0xe9dc('0x42')],qs['fields'](_0x486f86[_0xe9dc('0x3e')][_0xe9dc('0x44')]));_0x136fd4[_0xe9dc('0x43')]=_0x136fd4['attributes'][_0xe9dc('0x45')]?_0x136fd4[_0xe9dc('0x43')]:_0x318f3d[_0xe9dc('0x42')];if(!_0x486f86[_0xe9dc('0x3e')][_0xe9dc('0x46')](_0xe9dc('0x47'))){_0x136fd4[_0xe9dc('0x23')]=qs['limit'](_0x486f86[_0xe9dc('0x3e')]['limit']);_0x136fd4[_0xe9dc('0x21')]=qs['offset'](_0x486f86[_0xe9dc('0x3e')][_0xe9dc('0x21')]);}_0x136fd4['order']=qs[_0xe9dc('0x48')](_0x486f86[_0xe9dc('0x3e')][_0xe9dc('0x48')]);_0x136fd4[_0xe9dc('0x49')]=qs[_0xe9dc('0x40')](_[_0xe9dc('0x4a')](_0x486f86[_0xe9dc('0x3e')],_0x318f3d['filters']),_0x124bdf);var _0x1bca3=[];var _0x2ff796=squel[_0xe9dc('0x4b')]()[_0xe9dc('0x4c')]('id')['field'](_0xe9dc('0x2d'))[_0xe9dc('0x4c')](_0xe9dc('0x4d'))[_0xe9dc('0x4e')]('tools_tags');var _0x213b17=squel[_0xe9dc('0x4b')]()[_0xe9dc('0x4c')]('u.id')[_0xe9dc('0x4c')](_0xe9dc('0x4f'))[_0xe9dc('0x4c')]('ui.SmsInteractionId')[_0xe9dc('0x4e')](_0xe9dc('0x50'),'ui')[_0xe9dc('0x51')](_0xe9dc('0x52'),'u',_0xe9dc('0x53'));var _0x48bf88=squel[_0xe9dc('0x4b')]()[_0xe9dc('0x4e')](_0xe9dc('0x54'),'i')['left_join']('cm_contacts','c',_0xe9dc('0x55'))[_0xe9dc('0x51')](_0xe9dc('0x52'),'o',_0xe9dc('0x56'))[_0xe9dc('0x51')](_0xe9dc('0x57'),'a',_0xe9dc('0x58'))['left_join'](_0xe9dc('0x59'),'me',_0xe9dc('0x5a'))[_0xe9dc('0x51')](_0xe9dc('0x5b'),'it',_0xe9dc('0x5c'))['left_join'](_0xe9dc('0x5d'),'t',_0xe9dc('0x5e'));var _0x1c3c20=squel[_0xe9dc('0x5f')]();var _0x279b6c=[];var _0x47b1f1=squel['expr']();var _0x1f91b5;if(_0x486f86[_0xe9dc('0x3e')][_0xe9dc('0x60')]){_0x1f91b5=as[_0xe9dc('0x61')](_0x486f86['query'][_0xe9dc('0x60')]);var _0x1b0eb1=_0x1f91b5[_0xe9dc('0x62')];for(var _0x15d051=0x0;_0x15d051<_0x1f91b5[_0xe9dc('0x63')][_0xe9dc('0x45')];_0x15d051++){var _0x440b6a=_0x1f91b5['conditions'][_0x15d051];var _0x414f33='i';var _0x20c47f=_[_0xe9dc('0x64')](_0x124bdf,[_0xe9dc('0x2d'),_0x440b6a[_0xe9dc('0x4c')]]);if(!_0x20c47f){switch(_0x440b6a[_0xe9dc('0x4c')]){case _0xe9dc('0x65'):if(_0x440b6a[_0xe9dc('0x66')]==0x1){_0x48bf88[_0xe9dc('0x67')]('`'+_0x440b6a[_0xe9dc('0x4c')]+_0xe9dc('0x68'));}else{_0x48bf88[_0xe9dc('0x67')]('`'+_0x440b6a[_0xe9dc('0x4c')]+_0xe9dc('0x69'));}break;case _0xe9dc('0x6a'):if(_0x440b6a[_0xe9dc('0x6b')]===_0xe9dc('0x6c')){if(_0x440b6a[_0xe9dc('0x66')][_0xe9dc('0x34')]('\x20')[_0xe9dc('0x45')]>0x1){_0x1c3c20[_0x1b0eb1](_0xe9dc('0x6d'),qs['getFullTextValue'](_0x440b6a[_0xe9dc('0x66')]),null);}else{var _0x5ebf4a='%'+_0x440b6a[_0xe9dc('0x66')]+'%';_0x1c3c20[_0x1b0eb1](_0xe9dc('0x6e'),_0x5ebf4a,_0x5ebf4a,_0x5ebf4a);}}else{_0x20c47f=_[_0xe9dc('0x64')](_0x124bdf,[_0xe9dc('0x2d'),'ContactId']);_0x440b6a[_0xe9dc('0x4c')]=_0xe9dc('0x6f');_0x5f7002=as['buildExpression'](_0x414f33,_0x20c47f[_0xe9dc('0x3d')],_0x440b6a);_0x1c3c20[_0x1b0eb1](_0x5f7002['text'],_0x5f7002['value']['start'],_0x5f7002[_0xe9dc('0x66')][_0xe9dc('0x20')]);}break;case _0xe9dc('0x70'):var _0x5e3a2c=_0x440b6a[_0xe9dc('0x66')][_0xe9dc('0x34')](',')[_0xe9dc('0x30')](function(_0x3d6cc0){return Number(_0x3d6cc0);});_0x5e3a2c[_0xe9dc('0x35')](function(_0x4b8724){_0x47b1f1['or'](_0xe9dc('0x71'),'%,'+_0x4b8724+',%');});_0x279b6c=_[_0xe9dc('0x72')](_0x279b6c,_0x5e3a2c);break;case'User':if(_0x440b6a['operator']==='$substring'){_0x1c3c20[_0x1b0eb1]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x440b6a[_0xe9dc('0x66')]+'%',null);}else{_0x20c47f=_[_0xe9dc('0x64')](_0x124bdf,[_0xe9dc('0x2d'),_0xe9dc('0x73')]);_0x440b6a[_0xe9dc('0x4c')]=_0xe9dc('0x73');_0x5f7002=as[_0xe9dc('0x74')](_0x414f33,_0x20c47f[_0xe9dc('0x3d')],_0x440b6a);_0x1c3c20[_0x1b0eb1](_0x5f7002[_0xe9dc('0x75')],_0x5f7002[_0xe9dc('0x66')][_0xe9dc('0x76')],_0x5f7002['value']['end']);}break;case'body':_0x5f7002=as[_0xe9dc('0x74')]('me',null,_0x440b6a);_0x1c3c20[_0x1b0eb1](_0x5f7002[_0xe9dc('0x75')],_0x5f7002['value']['start'],_0x5f7002[_0xe9dc('0x66')][_0xe9dc('0x20')]);break;}}else{var _0x5f7002=as[_0xe9dc('0x74')](_0x414f33,_0x20c47f[_0xe9dc('0x3d')],_0x440b6a);_0x1c3c20[_0x1b0eb1](_0x5f7002[_0xe9dc('0x75')],_0x5f7002['value'][_0xe9dc('0x76')],_0x5f7002['value'][_0xe9dc('0x20')]);}}}else{var _0xf0e318=_(_0x486f86[_0xe9dc('0x3e')])[_0xe9dc('0x3f')]()[_0xe9dc('0x30')](function(_0x11c0a1){return _[_0xe9dc('0x77')](_0x124bdf,[_0xe9dc('0x2d'),_0x11c0a1])?_0x11c0a1:undefined;})['compact']()[_0xe9dc('0x66')]();if(!_['isEmpty'](_0xf0e318)){_0xf0e318[_0xe9dc('0x35')](function(_0x2e84ac){if(_0x2e84ac===_0xe9dc('0x78')){_0x48bf88[_0xe9dc('0x49')](_0xe9dc('0x79'),[]['concat'](_0x486f86[_0xe9dc('0x3e')][_0x2e84ac]));}else if(_0x2e84ac===_0xe9dc('0x7a')){var _0x5f1039=JSON['parse'](_0x486f86[_0xe9dc('0x3e')][_0x2e84ac])['$gte'];var _0x5c6480=JSON['parse'](_0x486f86[_0xe9dc('0x3e')][_0x2e84ac])[_0xe9dc('0x7b')];_0x48bf88[_0xe9dc('0x49')](_0xe9dc('0x7c'),_0x5f1039,_0x5c6480);}else{if(_0x486f86[_0xe9dc('0x3e')][_0x2e84ac]===_0xe9dc('0x7d')){_0x48bf88[_0xe9dc('0x49')]('i.'+_0x2e84ac+_0xe9dc('0x7e'));}else{_0x48bf88[_0xe9dc('0x49')]('i.'+_0x2e84ac+'\x20=\x20?',_0x486f86[_0xe9dc('0x3e')][_0x2e84ac]);}}});}if(_0x486f86[_0xe9dc('0x3e')]['read']){if(_0x486f86[_0xe9dc('0x3e')][_0xe9dc('0x7f')]==0x1){_0x48bf88[_0xe9dc('0x67')](_0xe9dc('0x80'));}else{_0x48bf88[_0xe9dc('0x67')]('`unreadMessages`\x20>\x200');}}if(_0x486f86[_0xe9dc('0x3e')][_0xe9dc('0x81')]){_0x279b6c=_['isArray'](_0x486f86['query'][_0xe9dc('0x81')])?_0x486f86[_0xe9dc('0x3e')]['tag']:new Array(_0x486f86[_0xe9dc('0x3e')][_0xe9dc('0x81')]);_0x279b6c[_0xe9dc('0x35')](function(_0x2027ca){_0x47b1f1['or'](_0xe9dc('0x71'),'%,'+_0x2027ca+',%');});}if(_0x486f86[_0xe9dc('0x3e')][_0xe9dc('0x82')]){var _0x52410e=_0x486f86[_0xe9dc('0x3e')]['filter']['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xe9dc('0x83')](_0x52410e)){_0x1c3c20['or']('i.id\x20LIKE\x20?',_0x52410e+'%')['or'](_0xe9dc('0x84'),_0x52410e+'%');}else{_0x1c3c20['or'](_0xe9dc('0x85'),qs['getFullTextValue'](_0x52410e))['or'](_0xe9dc('0x86'),_0x52410e+'%');}}}_0x48bf88[_0xe9dc('0x49')](_0x1c3c20);_0x48bf88[_0xe9dc('0x87')](_0xe9dc('0x88'));var _0x5565d3={'type':db[_0xe9dc('0x89')][_0xe9dc('0x8a')][_0xe9dc('0x8b')],'raw':!![]};var _0x4674cd=_0x48bf88[_0xe9dc('0x8c')]();_0x4674cd['field'](_0xe9dc('0x88'));_0x4674cd['field'](_0xe9dc('0x8d'),_0xe9dc('0x65'));if(_0x136fd4[_0xe9dc('0x8e')]){_0x136fd4[_0xe9dc('0x8e')][_0xe9dc('0x35')](function(_0x18fb26){var _0x3d9af4=_0x18fb26[0x0]===_0xe9dc('0x8f')?_0x18fb26[0x0]:'i.'+_0x18fb26[0x0];_0x48bf88[_0xe9dc('0x8e')](_0x3d9af4,_0x18fb26[0x1]===_0xe9dc('0x90')?![]:!![]);});}if(!_[_0xe9dc('0x91')](_0x279b6c)){_0x48bf88[_0xe9dc('0x67')](_0x47b1f1);_0x4674cd['where'](_0xe9dc('0x92'),_0x279b6c);}BPromise[_0xe9dc('0x93')]()[_0xe9dc('0x37')](function(){if(!_0x1f91b5){if(_0x486f86[_0xe9dc('0x3e')][_0xe9dc('0x78')])return;_0x4674cd[_0xe9dc('0x49')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x48bf88['where'](_0xe9dc('0x94'));return;}if(_0x486f86[_0xe9dc('0x95')][_0xe9dc('0x96')]!==_0xe9dc('0x97'))return;return _0x486f86[_0xe9dc('0x95')][_0xe9dc('0x98')]({'attributes':['id'],'raw':!![]})[_0xe9dc('0x37')](function(_0x2832ce){if(_[_0xe9dc('0x91')](_0x2832ce)){_0x4674cd['where'](_0xe9dc('0x99'));_0x48bf88[_0xe9dc('0x49')](_0xe9dc('0x99'));}else{_0x4674cd[_0xe9dc('0x49')](_0xe9dc('0x79'),_[_0xe9dc('0x30')](_0x2832ce,'id'));_0x48bf88[_0xe9dc('0x49')](_0xe9dc('0x79'),_[_0xe9dc('0x30')](_0x2832ce,'id'));}});})[_0xe9dc('0x37')](function(){if(_0x486f86[_0xe9dc('0x95')]['role']==='agent'&&!_0x1f91b5&&!_0x486f86[_0xe9dc('0x3e')]['SmsAccountId'])return[];return db['sequelize']['query'](_0x4674cd[_0xe9dc('0x9a')](),_0x5565d3);})[_0xe9dc('0x37')](function(_0x47e1d0){_0x48e5c6[_0xe9dc('0x24')]=_0x47e1d0[_0xe9dc('0x45')];if(_0x48e5c6[_0xe9dc('0x24')]===0x0)return[];return db[_0xe9dc('0x9b')][_0xe9dc('0x3e')](_0x2ff796[_0xe9dc('0x9a')](),_0x5565d3)[_0xe9dc('0x37')](function(_0x52a927){_0x1bca3=_[_0xe9dc('0x9c')](_0x52a927,'id');_0x5565d3=_[_0xe9dc('0x9d')](_0x5565d3,{'model':db[_0xe9dc('0x3a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x486f86['query'][_0xe9dc('0x44')]){_0x136fd4['attributes']['forEach'](function(_0x2d08c2){_0x48bf88[_0xe9dc('0x4c')]('i.'+_0x2d08c2);});}else{_0x48bf88[_0xe9dc('0x4c')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xe9dc('0x65'));_0x48bf88['field'](_0xe9dc('0x9e'),_0xe9dc('0x9f'));_0x48bf88[_0xe9dc('0x4c')](_0xe9dc('0xa0'),'Account.mandatoryDisposition');_0x48bf88['field']('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x48bf88[_0xe9dc('0x4c')](_0xe9dc('0xa1'));_0x48bf88[_0xe9dc('0x4c')](_0xe9dc('0xa2'),'Contact.firstName');_0x48bf88[_0xe9dc('0x4c')](_0xe9dc('0xa3'),'Contact.lastName');_0x48bf88[_0xe9dc('0x4c')](_0xe9dc('0xa4'),'Contact.email');_0x48bf88[_0xe9dc('0x4c')](_0xe9dc('0xa5'),'Contact.phone');_0x48bf88[_0xe9dc('0x4c')](_0xe9dc('0xa6'),_0xe9dc('0xa7'));_0x48bf88['field'](_0xe9dc('0xa8'),'Contact.fax');_0x48bf88[_0xe9dc('0x4c')](_0xe9dc('0xa9'),_0xe9dc('0xaa'));_0x48bf88[_0xe9dc('0x4c')](_0xe9dc('0xab'),_0xe9dc('0xac'));_0x48bf88[_0xe9dc('0x4c')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xe9dc('0x33'));}if(_0x136fd4[_0xe9dc('0x23')])_0x48bf88['limit'](_0x136fd4['limit']);if(_0x136fd4['offset'])_0x48bf88[_0xe9dc('0x21')](_0x136fd4[_0xe9dc('0x21')]);return db['sequelize'][_0xe9dc('0x3e')](_0x48bf88['toString'](),_0x5565d3);})[_0xe9dc('0x37')](function(_0x4182a5){if(_0x4182a5[_0xe9dc('0x45')]>0x0)_0x213b17[_0xe9dc('0x49')]('ui.SmsInteractionId\x20IN\x20?',_[_0xe9dc('0x30')](_0x4182a5,'id'));return db[_0xe9dc('0x9b')][_0xe9dc('0x3e')](_0x213b17[_0xe9dc('0x9a')](),_0x5565d3)['then'](function(_0x404474){var _0x30a28e=_[_0xe9dc('0xad')](_0x404474,'SmsInteractionId');var _0x4d874b=[];_0x4182a5['forEach'](function(_0x442d37){_0x4d874b[_0xe9dc('0x36')](updateSmsInteraction(_0x442d37,_0x1bca3,_0x30a28e));});return BPromise[_0xe9dc('0xae')](_0x4d874b);});});})[_0xe9dc('0x37')](function(_0xcfce66){_0x48e5c6[_0xe9dc('0xaf')]=_0xcfce66;return _0x48e5c6;})[_0xe9dc('0x37')](respondWithFilteredResult(_0x2cea5a,_0x136fd4))['catch'](handleError(_0x2cea5a,null));};exports[_0xe9dc('0xb0')]=function(_0x3f05ef,_0x3b9d37){var _0x35b300={'raw':![],'where':{'id':_0x3f05ef['params']['id']}},_0x196445={};_0x196445[_0xe9dc('0x42')]=_['keys'](db[_0xe9dc('0x3a')]['rawAttributes']);_0x196445[_0xe9dc('0x3e')]=_[_0xe9dc('0x3f')](_0x3f05ef['query']);_0x196445['filters']=_[_0xe9dc('0x41')](_0x196445['model'],_0x196445[_0xe9dc('0x3e')]);_0x35b300[_0xe9dc('0x43')]=_['intersection'](_0x196445[_0xe9dc('0x42')],qs['fields'](_0x3f05ef[_0xe9dc('0x3e')][_0xe9dc('0x44')]));_0x35b300[_0xe9dc('0x43')]=_0x35b300[_0xe9dc('0x43')][_0xe9dc('0x45')]?_0x35b300['attributes']:_0x196445[_0xe9dc('0x42')];if(_0x3f05ef['query']['includeAll']){_0x35b300[_0xe9dc('0xb1')]=[{'all':!![]}];}_0x35b300=_[_0xe9dc('0x9d')]({},_0x35b300,_0x3f05ef['options']);return db[_0xe9dc('0x3a')][_0xe9dc('0x64')](_0x35b300)[_0xe9dc('0x37')](handleEntityNotFound(_0x3b9d37,null))[_0xe9dc('0x37')](respondWithResult(_0x3b9d37,null))['catch'](handleError(_0x3b9d37,null));};exports['create']=function(_0x35af68,_0x50e3f0){return db['SmsInteraction'][_0xe9dc('0xb2')](_0x35af68[_0xe9dc('0xb3')],{})[_0xe9dc('0x37')](respondWithResult(_0x50e3f0,0xc9))[_0xe9dc('0x38')](handleError(_0x50e3f0,null));};exports[_0xe9dc('0xb4')]=function(_0x332f57,_0x4e1952){if(_0x332f57['body']['id']){delete _0x332f57['body']['id'];}return db[_0xe9dc('0x3a')]['find']({'where':{'id':_0x332f57[_0xe9dc('0xb5')]['id']}})['then'](handleEntityNotFound(_0x4e1952,null))[_0xe9dc('0x37')](saveUpdates(_0x332f57[_0xe9dc('0xb3')],null))[_0xe9dc('0x37')](respondWithResult(_0x4e1952,null))[_0xe9dc('0x38')](handleError(_0x4e1952,null));};exports['destroy']=function(_0x1ebe9f,_0x4259b6){return db[_0xe9dc('0x3a')][_0xe9dc('0x64')]({'where':{'id':_0x1ebe9f[_0xe9dc('0xb5')]['id']}})[_0xe9dc('0x37')](handleEntityNotFound(_0x4259b6,null))['then'](removeEntity(_0x4259b6,null))[_0xe9dc('0x38')](handleError(_0x4259b6,null));};exports[_0xe9dc('0xb6')]=function(_0x2fc70f,_0x57f65d){return db[_0xe9dc('0x3a')][_0xe9dc('0xb6')]()['then'](respondWithResult(_0x57f65d,null))[_0xe9dc('0x38')](handleError(_0x57f65d,null));};exports[_0xe9dc('0xb7')]=function(_0x348ec6,_0x288fda,_0x5d8991){return db[_0xe9dc('0xb8')]['find']({'where':{'id':_0x348ec6[_0xe9dc('0xb5')]['id']}})[_0xe9dc('0x37')](handleEntityNotFound(_0x288fda,null))[_0xe9dc('0x37')](function(_0x1ffacf){if(_0x1ffacf){return _0x1ffacf[_0xe9dc('0xb7')](_0x348ec6[_0xe9dc('0xb3')][_0xe9dc('0xb9')],_['omit'](_0x348ec6[_0xe9dc('0xb3')],[_0xe9dc('0xb9'),'id'])||{});}})[_0xe9dc('0x37')](respondWithResult(_0x288fda,null))[_0xe9dc('0x38')](handleError(_0x288fda,null));};exports[_0xe9dc('0xba')]=function(_0x116044,_0x46f7d3,_0x2025ae){var _0x572de3={'raw':![],'where':{}};var _0x322557={};var _0x8ead3={'count':0x0,'rows':[]};return db['SmsInteraction'][_0xe9dc('0xbb')]({'where':{'id':_0x116044['params']['id']}})[_0xe9dc('0x37')](handleEntityNotFound(_0x46f7d3,null))[_0xe9dc('0x37')](function(_0x5cc5b4){if(_0x5cc5b4){_0x322557[_0xe9dc('0x42')]=_[_0xe9dc('0x3f')](db[_0xe9dc('0xb8')]['rawAttributes']);_0x322557[_0xe9dc('0x3e')]=_[_0xe9dc('0x3f')](_0x116044[_0xe9dc('0x3e')]);_0x322557['filters']=_[_0xe9dc('0x41')](_0x322557['model'],_0x322557['query']);_0x572de3['attributes']=_[_0xe9dc('0x41')](_0x322557['model'],qs[_0xe9dc('0x44')](_0x116044[_0xe9dc('0x3e')][_0xe9dc('0x44')]));_0x572de3[_0xe9dc('0x43')]=_0x572de3[_0xe9dc('0x43')]['length']?_0x572de3['attributes']:_0x322557[_0xe9dc('0x42')];if(!_0x116044[_0xe9dc('0x3e')][_0xe9dc('0x46')](_0xe9dc('0x47'))){_0x572de3['limit']=qs[_0xe9dc('0x23')](_0x116044[_0xe9dc('0x3e')][_0xe9dc('0x23')]);_0x572de3['offset']=qs[_0xe9dc('0x21')](_0x116044[_0xe9dc('0x3e')][_0xe9dc('0x21')]);}_0x572de3[_0xe9dc('0x8e')]=qs['sort'](_0x116044[_0xe9dc('0x3e')][_0xe9dc('0x48')]);_0x572de3[_0xe9dc('0x49')]=qs['filters'](_[_0xe9dc('0x4a')](_0x116044[_0xe9dc('0x3e')],_0x322557[_0xe9dc('0x40')]));_0x572de3[_0xe9dc('0x49')][_0xe9dc('0xbc')]=_0x5cc5b4['id'];if(_0x116044[_0xe9dc('0x3e')][_0xe9dc('0x82')]){_0x572de3['where']=_[_0xe9dc('0x9d')](_0x572de3[_0xe9dc('0x49')],{'$or':_[_0xe9dc('0x30')](_0x572de3[_0xe9dc('0x43')],function(_0x3c997f){var _0x10178e={};_0x10178e[_0x3c997f]={'$like':'%'+_0x116044[_0xe9dc('0x3e')][_0xe9dc('0x82')]+'%'};return _0x10178e;})});}if(_0x116044[_0xe9dc('0x3e')][_0xe9dc('0xbd')]){var _0x47abf3=_0x116044[_0xe9dc('0x3e')][_0xe9dc('0xbd')][_0xe9dc('0x34')](',');var _0x1f816e={};_0x1f816e[_0x47abf3[0x0]]={'$gte':moment(_0x47abf3[0x1])['format'](_0xe9dc('0xbe'))};_0x572de3['where']=_['merge'](_0x572de3[_0xe9dc('0x49')],_0x1f816e);}_0x572de3=_['merge']({},_0x572de3,_0x116044[_0xe9dc('0xbf')]);return db[_0xe9dc('0xb8')][_0xe9dc('0x24')]({'where':_0x572de3[_0xe9dc('0x49')]})[_0xe9dc('0x37')](function(_0x48052a){_0x8ead3[_0xe9dc('0x24')]=_0x48052a;if(_0x116044[_0xe9dc('0x3e')][_0xe9dc('0xc0')]){_0x572de3[_0xe9dc('0xb1')]=[{'all':!![]}];}return db[_0xe9dc('0xb8')][_0xe9dc('0xc1')](_0x572de3);})[_0xe9dc('0x37')](function(_0x48a37f){_0x8ead3[_0xe9dc('0xaf')]=_0x48a37f;return _0x8ead3;});}})[_0xe9dc('0x37')](respondWithFilteredResult(_0x46f7d3,_0x572de3))[_0xe9dc('0x38')](handleError(_0x46f7d3,null));};exports[_0xe9dc('0xc2')]=function(_0x51fe95,_0x10a7b9,_0x46d049){return db['SmsInteraction'][_0xe9dc('0x64')]({'where':{'id':_0x51fe95['params']['id']}})[_0xe9dc('0x37')](handleEntityNotFound(_0x10a7b9,null))[_0xe9dc('0x37')](function(_0x2e1d5b){if(_0x2e1d5b){return _0x2e1d5b[_0xe9dc('0xc3')](_0x51fe95[_0xe9dc('0xb3')]['ids'],_[_0xe9dc('0xc4')](_0x51fe95[_0xe9dc('0xb3')],[_0xe9dc('0xb9'),'id'])||{})[_0xe9dc('0xc5')](function(){return db['Tag'][_0xe9dc('0xc1')]({'attributes':['id',_0xe9dc('0x2d'),_0xe9dc('0x4d')],'where':{'id':_0x51fe95[_0xe9dc('0xb3')][_0xe9dc('0xb9')]}});})[_0xe9dc('0x37')](function(_0x65aef2){socket[_0xe9dc('0xc6')](_0xe9dc('0xc7'),{'id':Number(_0x51fe95['params']['id']),'tags':_0x65aef2||[]});return{'id':Number(_0x51fe95[_0xe9dc('0xb5')]['id']),'tags':_0x65aef2||[]};});}})[_0xe9dc('0x37')](respondWithResult(_0x10a7b9,null))[_0xe9dc('0x38')](handleError(_0x10a7b9,null));};exports[_0xe9dc('0xc8')]=function(_0x3ae2a6,_0x1ed647,_0x29a6b1){return db[_0xe9dc('0x3a')][_0xe9dc('0x64')]({'where':{'id':_0x3ae2a6[_0xe9dc('0xb5')]['id']}})[_0xe9dc('0x37')](handleEntityNotFound(_0x1ed647,null))['then'](function(_0x3d2c84){if(_0x3d2c84){return _0x3d2c84[_0xe9dc('0xc8')](_0x3ae2a6[_0xe9dc('0x3e')][_0xe9dc('0xb9')]);}})[_0xe9dc('0x37')](respondWithStatusCode(_0x1ed647,null))[_0xe9dc('0x38')](handleError(_0x1ed647,null));};exports[_0xe9dc('0xc9')]=function(_0x202cdb,_0x388cb6){var _0x36f102=moment()[_0xe9dc('0xca')]()[_0xe9dc('0x9a')]();var _0x423dca=path['join'](config['root'],_0xe9dc('0xcb'),_0xe9dc('0xcc'),'tmp');var _0x237de2=path['join'](config[_0xe9dc('0xcd')],_0xe9dc('0xcb'),_0xe9dc('0xcc'),_0xe9dc('0xce'));var _0x465cfb=path[_0xe9dc('0xcf')](_0x423dca,_0x36f102);var _0xd75557=util[_0xe9dc('0xd0')]('transcript-%d-%s.zip',_0x202cdb[_0xe9dc('0xb5')]['id'],_0x36f102);var _0x34a831=path[_0xe9dc('0xcf')](_0x423dca,_0xd75557);var _0x2c0923=[];_0x2c0923[_0xe9dc('0x36')]({'model':db['User'],'as':_0xe9dc('0xd1'),'attributes':['id',_0xe9dc('0x31')],'raw':!![]});_0x2c0923[_0xe9dc('0x36')]({'model':db[_0xe9dc('0xd2')],'as':_0xe9dc('0x6a'),'attributes':['id',_0xe9dc('0xd3'),'lastName'],'raw':!![]});var _0x2ceb9d=[{'model':db['SmsMessage'],'as':_0xe9dc('0xd4'),'attributes':['id',_0xe9dc('0xb3'),_0xe9dc('0x7a'),_0xe9dc('0xd5'),_0xe9dc('0xd6'),'read'],'include':_0x2c0923}];_0x2ceb9d[_0xe9dc('0x36')]({'model':db[_0xe9dc('0xd7')],'as':'Account','attributes':['id',_0xe9dc('0x2d')]});_0x2ceb9d['push']({'model':db['User'],'as':_0xe9dc('0xd8'),'attributes':['id',_0xe9dc('0x31')]});return db[_0xe9dc('0x3a')]['find']({'where':{'id':_0x202cdb[_0xe9dc('0xb5')]['id']},'include':_0x2ceb9d})[_0xe9dc('0x37')](handleEntityNotFound(_0x388cb6,null))[_0xe9dc('0x37')](function(_0x3cfeb7){if(_0x3cfeb7){var _0x12907e=_0x3cfeb7[_0xe9dc('0xd9')]({'plain':!![]});fs[_0xe9dc('0xda')](_0x465cfb);var _0xb7b85f={'channel':_0xe9dc('0xdb'),'account':_0x12907e[_0xe9dc('0xdc')][_0xe9dc('0x2d')],'agent':_0x12907e[_0xe9dc('0xd8')]?_0x12907e[_0xe9dc('0xd8')][_0xe9dc('0x31')]:_0xe9dc('0xdd'),'createdAt':moment(_0x12907e[_0xe9dc('0x7a')])[_0xe9dc('0xd0')]('YYYY-MM-DD\x20HH:mm:ss')[_0xe9dc('0x9a')](),'closedAt':_0x12907e[_0xe9dc('0xde')]?moment(_0x12907e[_0xe9dc('0xdf')])['format'](_0xe9dc('0xbe'))[_0xe9dc('0x9a')]():'','disposition':_0x12907e['disposition'],'messages':_(_0x12907e['Messages'])[_0xe9dc('0x82')]({'secret':![]})[_0xe9dc('0x30')](function(_0x3f7f09){return{'date':moment(_0x3f7f09['createdAt'])[_0xe9dc('0xd0')](_0xe9dc('0xbe'))[_0xe9dc('0x9a')](),'sender':_0x3f7f09[_0xe9dc('0xd5')]==='out'?_0x3f7f09[_0xe9dc('0xd1')]?_0x3f7f09[_0xe9dc('0xd1')]['fullname']:_0xe9dc('0xe0'):_0x3f7f09['Contact'][_0xe9dc('0xd3')]+(_0x3f7f09['Contact'][_0xe9dc('0xe1')]?'\x20'+_0x3f7f09['Contact'][_0xe9dc('0xe1')]:''),'body':_0x3f7f09['body'],'direction':_0x3f7f09[_0xe9dc('0xd5')]===_0xe9dc('0xe2')?'A':'C','secret':_0x3f7f09[_0xe9dc('0xd6')],'read':_0x3f7f09[_0xe9dc('0x7f')]};})['value']()};return ejs[_0xe9dc('0xe3')](path['join'](config[_0xe9dc('0xcd')],_0xe9dc('0xcb'),_0xe9dc('0xe4'),_0xe9dc('0xe5')),{'interaction':_0xb7b85f})[_0xe9dc('0x37')](function(_0x19c68d){var _0x5bd19a=path[_0xe9dc('0xcf')](_0x465cfb,_0xe9dc('0xe6')+_0x12907e['id']+'-'+_0x36f102+_0xe9dc('0xe7'));var _0x378599={'path':_0x5bd19a,'channel':_0xe9dc('0xdb'),'interactionId':_0x12907e['id']};return pdf[_0xe9dc('0xe8')](_0x19c68d,_0x378599);})[_0xe9dc('0x37')](function(){return new BPromise(function(_0x4eea10,_0x2b7415){zipdir(_0x465cfb,{'saveTo':_0x34a831},function(_0x20a992,_0x41eac7){if(_0x20a992)return _0x2b7415(_0x20a992);return _0x4eea10(_0x41eac7);});})[_0xe9dc('0x37')](function(){return new BPromise(function(_0x37840f,_0x175e44){rimraf(_0x465cfb,function(_0xb41289){if(_0xb41289)_0x175e44(_0xb41289);return _0x37840f();});});})['then'](function(){return _0x388cb6[_0xe9dc('0xc9')](_0x34a831,_0xd75557,function(_0x5e133e){if(_0x5e133e){console['log'](_0xe9dc('0xe9'),_0x5e133e);}else{fs[_0xe9dc('0xea')](_0x34a831);}});});});}else{return _0x388cb6[_0xe9dc('0x1e')](0xc8);}})[_0xe9dc('0x38')](handleError(_0x388cb6,null));}; \ No newline at end of file +var _0xf3d9=['value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','text','some','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','isArray','tag','filter','replace','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','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.mobile','c.fax','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','SmsInteractionId','all','rows','catch','show','params','includeAll','include','options','create','body','describe','addMessage','ids','getMessages','findOne','SmsMessage','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','omit','Tag','emit','smsInteractionTags:save','removeTags','download','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','direction','Owner','mkdirSync','Sms','Account','closed','closedAt','disposition','out','System','secret','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','./smsInteraction.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','index','SmsInteraction','rawAttributes','fieldName','type','key','keys','filters','intersection','model','query','fields','attributes','hasOwnProperty','order','sort','where','pick','field','color','from','tools_tags','select','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','sms_interactions','left_join','cm_contacts','users','o.id\x20=\x20i.UserId','sms_accounts','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','length','find'];(function(_0x5a187b,_0x1f64fe){var _0x14d601=function(_0x45fd29){while(--_0x45fd29){_0x5a187b['push'](_0x5a187b['shift']());}};_0x14d601(++_0x1f64fe);}(_0xf3d9,0x162));var _0x9f3d=function(_0x133b5f,_0x487975){_0x133b5f=_0x133b5f-0x0;var _0x245459=_0xf3d9[_0x133b5f];return _0x245459;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9f3d('0x0'));var jsonpatch=require(_0x9f3d('0x1'));var rp=require(_0x9f3d('0x2'));var moment=require('moment');var BPromise=require(_0x9f3d('0x3'));var Mustache=require(_0x9f3d('0x4'));var util=require(_0x9f3d('0x5'));var path=require(_0x9f3d('0x6'));var sox=require(_0x9f3d('0x7'));var csv=require('to-csv');var ejs=require(_0x9f3d('0x8'));var fs=require('fs');var fs_extra=require(_0x9f3d('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9f3d('0xa'));var jsforce=require(_0x9f3d('0xb'));var deskjs=require(_0x9f3d('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9f3d('0xd'));var Redis=require(_0x9f3d('0xe'));var authService=require(_0x9f3d('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x9f3d('0x10'));var pdf=require('../../components/export/pdf');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9f3d('0x11'));var utils=require(_0x9f3d('0x12'));var config=require(_0x9f3d('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x9f3d('0x14'))['db'];config[_0x9f3d('0x15')]=_['defaults'](config[_0x9f3d('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9f3d('0x15')]));require(_0x9f3d('0x16'))['register'](socket);function respondWithStatusCode(_0x1acdf3,_0x46c65d){_0x46c65d=_0x46c65d||0xcc;return function(_0x3097f4){if(_0x3097f4){return _0x1acdf3[_0x9f3d('0x17')](_0x46c65d);}return _0x1acdf3['status'](_0x46c65d)[_0x9f3d('0x18')]();};}function respondWithResult(_0x21d7ad,_0x349c90){_0x349c90=_0x349c90||0xc8;return function(_0x5dcd87){if(_0x5dcd87){return _0x21d7ad[_0x9f3d('0x19')](_0x349c90)[_0x9f3d('0x1a')](_0x5dcd87);}};}function respondWithFilteredResult(_0x517d3d,_0x202af4){return function(_0x1b9674){if(_0x1b9674){var _0x5c05cb=typeof _0x202af4[_0x9f3d('0x1b')]===_0x9f3d('0x1c')&&typeof _0x202af4[_0x9f3d('0x1d')]==='undefined';var _0x25ba60=_0x1b9674[_0x9f3d('0x1e')];var _0xb2f48d=_0x5c05cb?0x0:_0x202af4['offset'];var _0x3f1ac1=_0x5c05cb?_0x1b9674[_0x9f3d('0x1e')]:_0x202af4[_0x9f3d('0x1b')]+_0x202af4['limit'];var _0x4a42db;if(_0x3f1ac1>=_0x25ba60){_0x3f1ac1=_0x25ba60;_0x4a42db=0xc8;}else{_0x4a42db=0xce;}_0x517d3d[_0x9f3d('0x19')](_0x4a42db);return _0x517d3d[_0x9f3d('0x1f')](_0x9f3d('0x20'),_0xb2f48d+'-'+_0x3f1ac1+'/'+_0x25ba60)[_0x9f3d('0x1a')](_0x1b9674);}return null;};}function patchUpdates(_0x15dacc){return function(_0x59d1e8){try{jsonpatch[_0x9f3d('0x21')](_0x59d1e8,_0x15dacc,!![]);}catch(_0xfdcfcf){return BPromise[_0x9f3d('0x22')](_0xfdcfcf);}return _0x59d1e8[_0x9f3d('0x23')]();};}function saveUpdates(_0x5cd245,_0x3760b1){return function(_0x9c3076){if(_0x9c3076){return _0x9c3076[_0x9f3d('0x24')](_0x5cd245)[_0x9f3d('0x25')](function(_0x28d11b){return _0x28d11b;});}return null;};}function removeEntity(_0x4d7c2e,_0x41f4c5){return function(_0x52af22){if(_0x52af22){return _0x52af22[_0x9f3d('0x26')]()[_0x9f3d('0x25')](function(){_0x4d7c2e[_0x9f3d('0x19')](0xcc)[_0x9f3d('0x18')]();});}};}function handleEntityNotFound(_0x3126d3,_0x8af906){return function(_0x25724c){if(!_0x25724c){_0x3126d3[_0x9f3d('0x17')](0x194);}return _0x25724c;};}function handleError(_0x5292bb,_0x4c6777){_0x4c6777=_0x4c6777||0x1f4;return function(_0x25d573){logger[_0x9f3d('0x27')](_0x25d573[_0x9f3d('0x28')]);if(_0x25d573[_0x9f3d('0x29')]){delete _0x25d573[_0x9f3d('0x29')];}_0x5292bb[_0x9f3d('0x19')](_0x4c6777)[_0x9f3d('0x2a')](_0x25d573);};}function getInteractionUsers(_0x27da0c,_0x26eb88){return new BPromise(function(_0x47e80f,_0x4fe2f6){try{if(_0x26eb88[_0x27da0c['id']]){_0x27da0c[_0x9f3d('0x2b')]=_[_0x9f3d('0x2c')](_0x26eb88[_0x27da0c['id']],function(_0x8dba31){return{'id':_0x8dba31['id'],'fullname':_0x8dba31[_0x9f3d('0x2d')]};});}}catch(_0x2650d9){_0x4fe2f6(_0x2650d9);}_0x47e80f(_0x27da0c);});}function getInteractionTags(_0x2e9005,_0x1e95e9){return new BPromise(function(_0x23ce40,_0x1a60ba){try{if(_0x2e9005[_0x9f3d('0x2e')]){_0x2e9005[_0x9f3d('0x2f')]=[];_0x2e9005['TagIds'][_0x9f3d('0x30')](',')[_0x9f3d('0x31')](function(_0x20ad35){_0x2e9005[_0x9f3d('0x2f')][_0x9f3d('0x32')](_0x1e95e9[_0x20ad35]);});}delete _0x2e9005[_0x9f3d('0x2e')];}catch(_0x3340a5){_0x1a60ba(_0x3340a5);}_0x23ce40(_0x2e9005);});}function updateSmsInteraction(_0x541f5e,_0x1afa48,_0x1b2945){return new BPromise(function(_0x595191,_0x2237cc){return getInteractionUsers(_0x541f5e,_0x1b2945)['then'](function(_0x47e7fb){return getInteractionTags(_0x47e7fb,_0x1afa48);})['then'](function(_0x21d3fa){_0x595191(_0x21d3fa);})['catch'](function(_0x22958c){_0x2237cc(_0x22958c);});});}exports[_0x9f3d('0x33')]=function(_0xde119b,_0x2fc568){var _0xf06437={},_0x1b98d8={},_0x4766e2={'count':0x0,'rows':[]};var _0x581812=_[_0x9f3d('0x2c')](db[_0x9f3d('0x34')][_0x9f3d('0x35')],function(_0x3cd062){return{'name':_0x3cd062[_0x9f3d('0x36')],'type':_0x3cd062[_0x9f3d('0x37')][_0x9f3d('0x38')]};});_0x1b98d8['model']=_[_0x9f3d('0x2c')](_0x581812,_0x9f3d('0x29'));_0x1b98d8['query']=_[_0x9f3d('0x39')](_0xde119b['query']);_0x1b98d8[_0x9f3d('0x3a')]=_[_0x9f3d('0x3b')](_0x1b98d8[_0x9f3d('0x3c')],_0x1b98d8[_0x9f3d('0x3d')]);_0xf06437['attributes']=_[_0x9f3d('0x3b')](_0x1b98d8[_0x9f3d('0x3c')],qs['fields'](_0xde119b[_0x9f3d('0x3d')][_0x9f3d('0x3e')]));_0xf06437[_0x9f3d('0x3f')]=_0xf06437[_0x9f3d('0x3f')]['length']?_0xf06437['attributes']:_0x1b98d8[_0x9f3d('0x3c')];if(!_0xde119b[_0x9f3d('0x3d')][_0x9f3d('0x40')]('nolimit')){_0xf06437[_0x9f3d('0x1d')]=qs[_0x9f3d('0x1d')](_0xde119b['query'][_0x9f3d('0x1d')]);_0xf06437[_0x9f3d('0x1b')]=qs[_0x9f3d('0x1b')](_0xde119b[_0x9f3d('0x3d')][_0x9f3d('0x1b')]);}_0xf06437[_0x9f3d('0x41')]=qs[_0x9f3d('0x42')](_0xde119b[_0x9f3d('0x3d')][_0x9f3d('0x42')]);_0xf06437[_0x9f3d('0x43')]=qs['filters'](_[_0x9f3d('0x44')](_0xde119b['query'],_0x1b98d8['filters']),_0x581812);var _0x1644e4=[];var _0x1096fd=squel['select']()[_0x9f3d('0x45')]('id')[_0x9f3d('0x45')](_0x9f3d('0x29'))[_0x9f3d('0x45')](_0x9f3d('0x46'))[_0x9f3d('0x47')](_0x9f3d('0x48'));var _0x17c057=squel[_0x9f3d('0x49')]()['field'](_0x9f3d('0x4a'))[_0x9f3d('0x45')](_0x9f3d('0x4b'))[_0x9f3d('0x45')](_0x9f3d('0x4c'))['from'](_0x9f3d('0x4d'),'ui')['left_join']('users','u','u.id\x20=\x20ui.UserId');var _0x1d7286=squel[_0x9f3d('0x49')]()[_0x9f3d('0x47')](_0x9f3d('0x4e'),'i')[_0x9f3d('0x4f')](_0x9f3d('0x50'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x9f3d('0x51'),'o',_0x9f3d('0x52'))[_0x9f3d('0x4f')](_0x9f3d('0x53'),'a','a.id\x20=\x20i.SmsAccountId')[_0x9f3d('0x4f')]('sms_messages','me',_0x9f3d('0x54'))[_0x9f3d('0x4f')](_0x9f3d('0x55'),'it','it.SmsInteractionId\x20=\x20i.id')[_0x9f3d('0x4f')](_0x9f3d('0x48'),'t',_0x9f3d('0x56'));var _0x553830=squel[_0x9f3d('0x57')]();var _0x228e14=[];var _0xfe1168=squel[_0x9f3d('0x57')]();var _0x5e4718;if(_0xde119b[_0x9f3d('0x3d')]['search']){_0x5e4718=as[_0x9f3d('0x58')](_0xde119b[_0x9f3d('0x3d')][_0x9f3d('0x59')]);var _0x3f1704=_0x5e4718[_0x9f3d('0x5a')];for(var _0x150e9e=0x0;_0x150e9e<_0x5e4718[_0x9f3d('0x5b')][_0x9f3d('0x5c')];_0x150e9e++){var _0x382f6a=_0x5e4718[_0x9f3d('0x5b')][_0x150e9e];var _0x5b70c3='i';var _0x2269fd=_[_0x9f3d('0x5d')](_0x581812,[_0x9f3d('0x29'),_0x382f6a[_0x9f3d('0x45')]]);if(!_0x2269fd){switch(_0x382f6a[_0x9f3d('0x45')]){case'unreadMessages':if(_0x382f6a[_0x9f3d('0x5e')]==0x1){_0x1d7286[_0x9f3d('0x5f')]('`'+_0x382f6a['field']+_0x9f3d('0x60'));}else{_0x1d7286[_0x9f3d('0x5f')]('`'+_0x382f6a[_0x9f3d('0x45')]+_0x9f3d('0x61'));}break;case _0x9f3d('0x62'):if(_0x382f6a[_0x9f3d('0x63')]===_0x9f3d('0x64')){if(_0x382f6a['value'][_0x9f3d('0x30')]('\x20')[_0x9f3d('0x5c')]>0x1){_0x553830[_0x3f1704]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x9f3d('0x65')](_0x382f6a['value']),null);}else{var _0xb343b8='%'+_0x382f6a[_0x9f3d('0x5e')]+'%';_0x553830[_0x3f1704](_0x9f3d('0x66'),_0xb343b8,_0xb343b8,_0xb343b8);}}else{_0x2269fd=_[_0x9f3d('0x5d')](_0x581812,['name','ContactId']);_0x382f6a[_0x9f3d('0x45')]=_0x9f3d('0x67');_0x130ffa=as[_0x9f3d('0x68')](_0x5b70c3,_0x2269fd[_0x9f3d('0x37')],_0x382f6a);_0x553830[_0x3f1704](_0x130ffa['text'],_0x130ffa[_0x9f3d('0x5e')]['start'],_0x130ffa[_0x9f3d('0x5e')][_0x9f3d('0x18')]);}break;case'Tag':var _0x1ab815=_0x382f6a[_0x9f3d('0x5e')][_0x9f3d('0x30')](',')[_0x9f3d('0x2c')](function(_0x28ad84){return Number(_0x28ad84);});_0x1ab815['forEach'](function(_0x4c21d2){_0xfe1168['or'](_0x9f3d('0x69'),'%,'+_0x4c21d2+',%');});_0x228e14=_[_0x9f3d('0x6a')](_0x228e14,_0x1ab815);break;case _0x9f3d('0x6b'):if(_0x382f6a[_0x9f3d('0x63')]===_0x9f3d('0x64')){_0x553830[_0x3f1704](_0x9f3d('0x6c'),'%'+_0x382f6a[_0x9f3d('0x5e')]+'%',null);}else{_0x2269fd=_[_0x9f3d('0x5d')](_0x581812,[_0x9f3d('0x29'),_0x9f3d('0x6d')]);_0x382f6a[_0x9f3d('0x45')]=_0x9f3d('0x6d');_0x130ffa=as['buildExpression'](_0x5b70c3,_0x2269fd[_0x9f3d('0x37')],_0x382f6a);_0x553830[_0x3f1704](_0x130ffa['text'],_0x130ffa[_0x9f3d('0x5e')][_0x9f3d('0x6e')],_0x130ffa[_0x9f3d('0x5e')]['end']);}break;case'body':_0x130ffa=as[_0x9f3d('0x68')]('me',null,_0x382f6a);_0x553830[_0x3f1704](_0x130ffa[_0x9f3d('0x6f')],_0x130ffa[_0x9f3d('0x5e')][_0x9f3d('0x6e')],_0x130ffa['value']['end']);break;}}else{var _0x130ffa=as['buildExpression'](_0x5b70c3,_0x2269fd[_0x9f3d('0x37')],_0x382f6a);_0x553830[_0x3f1704](_0x130ffa[_0x9f3d('0x6f')],_0x130ffa['value']['start'],_0x130ffa[_0x9f3d('0x5e')][_0x9f3d('0x18')]);}}}else{var _0x480031=_(_0xde119b[_0x9f3d('0x3d')])[_0x9f3d('0x39')]()[_0x9f3d('0x2c')](function(_0x2c1760){return _[_0x9f3d('0x70')](_0x581812,[_0x9f3d('0x29'),_0x2c1760])?_0x2c1760:undefined;})[_0x9f3d('0x71')]()[_0x9f3d('0x5e')]();if(!_[_0x9f3d('0x72')](_0x480031)){_0x480031[_0x9f3d('0x31')](function(_0x1aed12){if(_0x1aed12===_0x9f3d('0x73')){_0x1d7286['where'](_0x9f3d('0x74'),[]['concat'](_0xde119b[_0x9f3d('0x3d')][_0x1aed12]));}else if(_0x1aed12===_0x9f3d('0x75')){var _0x4157df=JSON['parse'](_0xde119b[_0x9f3d('0x3d')][_0x1aed12])[_0x9f3d('0x76')];var _0x5efd1b=JSON[_0x9f3d('0x77')](_0xde119b[_0x9f3d('0x3d')][_0x1aed12])[_0x9f3d('0x78')];_0x1d7286['where'](_0x9f3d('0x79'),_0x4157df,_0x5efd1b);}else{if(_0xde119b[_0x9f3d('0x3d')][_0x1aed12]===_0x9f3d('0x7a')){_0x1d7286['where']('i.'+_0x1aed12+_0x9f3d('0x7b'));}else{_0x1d7286[_0x9f3d('0x43')]('i.'+_0x1aed12+_0x9f3d('0x7c'),_0xde119b[_0x9f3d('0x3d')][_0x1aed12]);}}});}if(_0xde119b[_0x9f3d('0x3d')][_0x9f3d('0x7d')]){if(_0xde119b[_0x9f3d('0x3d')][_0x9f3d('0x7d')]==0x1){_0x1d7286[_0x9f3d('0x5f')]('`unreadMessages`\x20=\x200');}else{_0x1d7286[_0x9f3d('0x5f')]('`unreadMessages`\x20>\x200');}}if(_0xde119b[_0x9f3d('0x3d')]['tag']){_0x228e14=_[_0x9f3d('0x7e')](_0xde119b[_0x9f3d('0x3d')][_0x9f3d('0x7f')])?_0xde119b[_0x9f3d('0x3d')]['tag']:new Array(_0xde119b['query']['tag']);_0x228e14[_0x9f3d('0x31')](function(_0x19df73){_0xfe1168['or'](_0x9f3d('0x69'),'%,'+_0x19df73+',%');});}if(_0xde119b[_0x9f3d('0x3d')][_0x9f3d('0x80')]){var _0x44892c=_0xde119b[_0x9f3d('0x3d')][_0x9f3d('0x80')][_0x9f3d('0x81')]('\x5c','\x5c\x5c')[_0x9f3d('0x81')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x44892c)){_0x553830['or'](_0x9f3d('0x82'),_0x44892c+'%')['or']('i.phone\x20LIKE\x20?',_0x44892c+'%');}else{_0x553830['or'](_0x9f3d('0x83'),qs['getFullTextValue'](_0x44892c))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x44892c+'%');}}}_0x1d7286['where'](_0x553830);_0x1d7286[_0x9f3d('0x84')](_0x9f3d('0x85'));var _0x1dc410={'type':db[_0x9f3d('0x86')][_0x9f3d('0x87')][_0x9f3d('0x88')],'raw':!![]};var _0x376b2a=_0x1d7286[_0x9f3d('0x89')]();_0x376b2a['field']('i.id');_0x376b2a[_0x9f3d('0x45')](_0x9f3d('0x8a'),_0x9f3d('0x8b'));if(_0xf06437[_0x9f3d('0x41')]){_0xf06437[_0x9f3d('0x41')][_0x9f3d('0x31')](function(_0x1468cb){var _0x7568d6=_0x1468cb[0x0]==='contactName'?_0x1468cb[0x0]:'i.'+_0x1468cb[0x0];_0x1d7286[_0x9f3d('0x41')](_0x7568d6,_0x1468cb[0x1]==='DESC'?![]:!![]);});}if(!_[_0x9f3d('0x72')](_0x228e14)){_0x1d7286[_0x9f3d('0x5f')](_0xfe1168);_0x376b2a[_0x9f3d('0x43')](_0x9f3d('0x8c'),_0x228e14);}BPromise[_0x9f3d('0x8d')]()[_0x9f3d('0x25')](function(){if(!_0x5e4718){if(_0xde119b['query']['SmsAccountId'])return;_0x376b2a[_0x9f3d('0x43')](_0x9f3d('0x8e'));_0x1d7286[_0x9f3d('0x43')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}if(_0xde119b['user'][_0x9f3d('0x8f')]!==_0x9f3d('0x90'))return;return _0xde119b[_0x9f3d('0x91')][_0x9f3d('0x92')]({'attributes':['id'],'raw':!![]})[_0x9f3d('0x25')](function(_0x4329b7){if(_[_0x9f3d('0x72')](_0x4329b7)){_0x376b2a[_0x9f3d('0x43')](_0x9f3d('0x93'));_0x1d7286[_0x9f3d('0x43')](_0x9f3d('0x93'));}else{_0x376b2a['where'](_0x9f3d('0x74'),_[_0x9f3d('0x2c')](_0x4329b7,'id'));_0x1d7286[_0x9f3d('0x43')]('i.SmsAccountId\x20IN\x20?',_[_0x9f3d('0x2c')](_0x4329b7,'id'));}});})[_0x9f3d('0x25')](function(){if(_0xde119b[_0x9f3d('0x91')][_0x9f3d('0x8f')]===_0x9f3d('0x90')&&!_0x5e4718&&!_0xde119b['query'][_0x9f3d('0x73')])return[];return db[_0x9f3d('0x94')][_0x9f3d('0x3d')](_0x376b2a[_0x9f3d('0x95')](),_0x1dc410);})['then'](function(_0x4535a7){_0x4766e2[_0x9f3d('0x1e')]=_0x4535a7[_0x9f3d('0x5c')];if(_0x4766e2[_0x9f3d('0x1e')]===0x0)return[];return db[_0x9f3d('0x94')]['query'](_0x1096fd[_0x9f3d('0x95')](),_0x1dc410)[_0x9f3d('0x25')](function(_0x32e3c9){_0x1644e4=_['keyBy'](_0x32e3c9,'id');_0x1dc410=_[_0x9f3d('0x96')](_0x1dc410,{'model':db[_0x9f3d('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xde119b['query']['fields']){_0xf06437[_0x9f3d('0x3f')][_0x9f3d('0x31')](function(_0x1fd25e){_0x1d7286[_0x9f3d('0x45')]('i.'+_0x1fd25e);});}else{_0x1d7286[_0x9f3d('0x45')](_0x9f3d('0x8a'),_0x9f3d('0x8b'));_0x1d7286[_0x9f3d('0x45')]('a.key',_0x9f3d('0x97'));_0x1d7286[_0x9f3d('0x45')](_0x9f3d('0x98'),_0x9f3d('0x99'));_0x1d7286[_0x9f3d('0x45')](_0x9f3d('0x9a'),_0x9f3d('0x9b'));_0x1d7286[_0x9f3d('0x45')](_0x9f3d('0x9c'));_0x1d7286[_0x9f3d('0x45')](_0x9f3d('0x9d'),_0x9f3d('0x9e'));_0x1d7286[_0x9f3d('0x45')](_0x9f3d('0x9f'),_0x9f3d('0xa0'));_0x1d7286[_0x9f3d('0x45')](_0x9f3d('0xa1'),_0x9f3d('0xa2'));_0x1d7286[_0x9f3d('0x45')](_0x9f3d('0xa3'),'Contact.phone');_0x1d7286[_0x9f3d('0x45')]('c.mobile',_0x9f3d('0xa4'));_0x1d7286[_0x9f3d('0x45')](_0x9f3d('0xa5'),'Contact.fax');_0x1d7286[_0x9f3d('0x45')]('o.fullname',_0x9f3d('0xa6'));_0x1d7286[_0x9f3d('0x45')](_0x9f3d('0xa7'),'Owner.internal');_0x1d7286[_0x9f3d('0x45')](_0x9f3d('0xa8'),_0x9f3d('0x2e'));}if(_0xf06437[_0x9f3d('0x1d')])_0x1d7286[_0x9f3d('0x1d')](_0xf06437[_0x9f3d('0x1d')]);if(_0xf06437[_0x9f3d('0x1b')])_0x1d7286[_0x9f3d('0x1b')](_0xf06437[_0x9f3d('0x1b')]);return db[_0x9f3d('0x94')][_0x9f3d('0x3d')](_0x1d7286[_0x9f3d('0x95')](),_0x1dc410);})['then'](function(_0x3d1604){if(_0x3d1604[_0x9f3d('0x5c')]>0x0)_0x17c057[_0x9f3d('0x43')](_0x9f3d('0xa9'),_[_0x9f3d('0x2c')](_0x3d1604,'id'));return db['sequelize']['query'](_0x17c057[_0x9f3d('0x95')](),_0x1dc410)[_0x9f3d('0x25')](function(_0x9332c7){var _0xe5c964=_['groupBy'](_0x9332c7,_0x9f3d('0xaa'));var _0x5abc4d=[];_0x3d1604[_0x9f3d('0x31')](function(_0x1cabda){_0x5abc4d[_0x9f3d('0x32')](updateSmsInteraction(_0x1cabda,_0x1644e4,_0xe5c964));});return BPromise[_0x9f3d('0xab')](_0x5abc4d);});});})[_0x9f3d('0x25')](function(_0x25c9b0){_0x4766e2[_0x9f3d('0xac')]=_0x25c9b0;return _0x4766e2;})[_0x9f3d('0x25')](respondWithFilteredResult(_0x2fc568,_0xf06437))[_0x9f3d('0xad')](handleError(_0x2fc568,null));};exports[_0x9f3d('0xae')]=function(_0x29af7c,_0x4f8ac9){var _0x35a06d={'raw':![],'where':{'id':_0x29af7c[_0x9f3d('0xaf')]['id']}},_0x190dc5={};_0x190dc5['model']=_[_0x9f3d('0x39')](db[_0x9f3d('0x34')][_0x9f3d('0x35')]);_0x190dc5['query']=_[_0x9f3d('0x39')](_0x29af7c[_0x9f3d('0x3d')]);_0x190dc5[_0x9f3d('0x3a')]=_[_0x9f3d('0x3b')](_0x190dc5['model'],_0x190dc5[_0x9f3d('0x3d')]);_0x35a06d[_0x9f3d('0x3f')]=_[_0x9f3d('0x3b')](_0x190dc5[_0x9f3d('0x3c')],qs['fields'](_0x29af7c[_0x9f3d('0x3d')][_0x9f3d('0x3e')]));_0x35a06d[_0x9f3d('0x3f')]=_0x35a06d['attributes'][_0x9f3d('0x5c')]?_0x35a06d['attributes']:_0x190dc5[_0x9f3d('0x3c')];if(_0x29af7c[_0x9f3d('0x3d')][_0x9f3d('0xb0')]){_0x35a06d[_0x9f3d('0xb1')]=[{'all':!![]}];}_0x35a06d=_[_0x9f3d('0x96')]({},_0x35a06d,_0x29af7c[_0x9f3d('0xb2')]);return db['SmsInteraction']['find'](_0x35a06d)['then'](handleEntityNotFound(_0x4f8ac9,null))['then'](respondWithResult(_0x4f8ac9,null))[_0x9f3d('0xad')](handleError(_0x4f8ac9,null));};exports[_0x9f3d('0xb3')]=function(_0x9804ea,_0x2165e3){return db['SmsInteraction'][_0x9f3d('0xb3')](_0x9804ea[_0x9f3d('0xb4')],{})[_0x9f3d('0x25')](respondWithResult(_0x2165e3,0xc9))['catch'](handleError(_0x2165e3,null));};exports['update']=function(_0x2045ce,_0x131954){if(_0x2045ce[_0x9f3d('0xb4')]['id']){delete _0x2045ce[_0x9f3d('0xb4')]['id'];}return db[_0x9f3d('0x34')]['find']({'where':{'id':_0x2045ce[_0x9f3d('0xaf')]['id']}})[_0x9f3d('0x25')](handleEntityNotFound(_0x131954,null))[_0x9f3d('0x25')](saveUpdates(_0x2045ce[_0x9f3d('0xb4')],null))[_0x9f3d('0x25')](respondWithResult(_0x131954,null))['catch'](handleError(_0x131954,null));};exports[_0x9f3d('0x26')]=function(_0xb49a8a,_0x1e144c){return db['SmsInteraction'][_0x9f3d('0x5d')]({'where':{'id':_0xb49a8a[_0x9f3d('0xaf')]['id']}})['then'](handleEntityNotFound(_0x1e144c,null))[_0x9f3d('0x25')](removeEntity(_0x1e144c,null))[_0x9f3d('0xad')](handleError(_0x1e144c,null));};exports['describe']=function(_0x58094e,_0x480df9){return db[_0x9f3d('0x34')][_0x9f3d('0xb5')]()[_0x9f3d('0x25')](respondWithResult(_0x480df9,null))['catch'](handleError(_0x480df9,null));};exports[_0x9f3d('0xb6')]=function(_0x4b52b8,_0x34cf4b,_0x3990cb){return db['SmsMessage'][_0x9f3d('0x5d')]({'where':{'id':_0x4b52b8[_0x9f3d('0xaf')]['id']}})[_0x9f3d('0x25')](handleEntityNotFound(_0x34cf4b,null))[_0x9f3d('0x25')](function(_0x5b8a08){if(_0x5b8a08){return _0x5b8a08[_0x9f3d('0xb6')](_0x4b52b8[_0x9f3d('0xb4')][_0x9f3d('0xb7')],_['omit'](_0x4b52b8[_0x9f3d('0xb4')],[_0x9f3d('0xb7'),'id'])||{});}})[_0x9f3d('0x25')](respondWithResult(_0x34cf4b,null))[_0x9f3d('0xad')](handleError(_0x34cf4b,null));};exports[_0x9f3d('0xb8')]=function(_0x235f66,_0xa56b42,_0x4e0d09){var _0x209d2f={'raw':![],'where':{}};var _0x4e7d74={};var _0x2e2ff4={'count':0x0,'rows':[]};return db['SmsInteraction'][_0x9f3d('0xb9')]({'where':{'id':_0x235f66[_0x9f3d('0xaf')]['id']}})[_0x9f3d('0x25')](handleEntityNotFound(_0xa56b42,null))[_0x9f3d('0x25')](function(_0x1b9b85){if(_0x1b9b85){_0x4e7d74[_0x9f3d('0x3c')]=_[_0x9f3d('0x39')](db[_0x9f3d('0xba')][_0x9f3d('0x35')]);_0x4e7d74['query']=_['keys'](_0x235f66['query']);_0x4e7d74[_0x9f3d('0x3a')]=_[_0x9f3d('0x3b')](_0x4e7d74[_0x9f3d('0x3c')],_0x4e7d74[_0x9f3d('0x3d')]);_0x209d2f[_0x9f3d('0x3f')]=_[_0x9f3d('0x3b')](_0x4e7d74[_0x9f3d('0x3c')],qs[_0x9f3d('0x3e')](_0x235f66['query']['fields']));_0x209d2f['attributes']=_0x209d2f[_0x9f3d('0x3f')]['length']?_0x209d2f[_0x9f3d('0x3f')]:_0x4e7d74[_0x9f3d('0x3c')];if(!_0x235f66[_0x9f3d('0x3d')][_0x9f3d('0x40')]('nolimit')){_0x209d2f['limit']=qs[_0x9f3d('0x1d')](_0x235f66[_0x9f3d('0x3d')][_0x9f3d('0x1d')]);_0x209d2f[_0x9f3d('0x1b')]=qs['offset'](_0x235f66[_0x9f3d('0x3d')][_0x9f3d('0x1b')]);}_0x209d2f[_0x9f3d('0x41')]=qs[_0x9f3d('0x42')](_0x235f66[_0x9f3d('0x3d')]['sort']);_0x209d2f[_0x9f3d('0x43')]=qs[_0x9f3d('0x3a')](_[_0x9f3d('0x44')](_0x235f66[_0x9f3d('0x3d')],_0x4e7d74[_0x9f3d('0x3a')]));_0x209d2f['where'][_0x9f3d('0xaa')]=_0x1b9b85['id'];if(_0x235f66[_0x9f3d('0x3d')][_0x9f3d('0x80')]){_0x209d2f['where']=_[_0x9f3d('0x96')](_0x209d2f[_0x9f3d('0x43')],{'$or':_['map'](_0x209d2f[_0x9f3d('0x3f')],function(_0x1a6986){var _0x17e59d={};_0x17e59d[_0x1a6986]={'$like':'%'+_0x235f66[_0x9f3d('0x3d')][_0x9f3d('0x80')]+'%'};return _0x17e59d;})});}if(_0x235f66[_0x9f3d('0x3d')][_0x9f3d('0x76')]){var _0x2ce3a4=_0x235f66[_0x9f3d('0x3d')]['$gte'][_0x9f3d('0x30')](',');var _0x4fd870={};_0x4fd870[_0x2ce3a4[0x0]]={'$gte':moment(_0x2ce3a4[0x1])[_0x9f3d('0xbb')](_0x9f3d('0xbc'))};_0x209d2f[_0x9f3d('0x43')]=_['merge'](_0x209d2f['where'],_0x4fd870);}_0x209d2f=_[_0x9f3d('0x96')]({},_0x209d2f,_0x235f66['options']);return db[_0x9f3d('0xba')][_0x9f3d('0x1e')]({'where':_0x209d2f[_0x9f3d('0x43')]})[_0x9f3d('0x25')](function(_0x235a76){_0x2e2ff4[_0x9f3d('0x1e')]=_0x235a76;if(_0x235f66['query'][_0x9f3d('0xb0')]){_0x209d2f[_0x9f3d('0xb1')]=[{'all':!![]}];}return db[_0x9f3d('0xba')][_0x9f3d('0xbd')](_0x209d2f);})[_0x9f3d('0x25')](function(_0x59e01e){_0x2e2ff4[_0x9f3d('0xac')]=_0x59e01e;return _0x2e2ff4;});}})[_0x9f3d('0x25')](respondWithFilteredResult(_0xa56b42,_0x209d2f))[_0x9f3d('0xad')](handleError(_0xa56b42,null));};exports[_0x9f3d('0xbe')]=function(_0xc25cee,_0x3abd5e,_0x3be552){return db[_0x9f3d('0x34')]['find']({'where':{'id':_0xc25cee[_0x9f3d('0xaf')]['id']}})[_0x9f3d('0x25')](handleEntityNotFound(_0x3abd5e,null))[_0x9f3d('0x25')](function(_0x28ab5f){if(_0x28ab5f){return _0x28ab5f['setTags'](_0xc25cee[_0x9f3d('0xb4')][_0x9f3d('0xb7')],_[_0x9f3d('0xbf')](_0xc25cee[_0x9f3d('0xb4')],[_0x9f3d('0xb7'),'id'])||{})['spread'](function(){return db[_0x9f3d('0xc0')]['findAll']({'attributes':['id',_0x9f3d('0x29'),_0x9f3d('0x46')],'where':{'id':_0xc25cee[_0x9f3d('0xb4')][_0x9f3d('0xb7')]}});})['then'](function(_0x296b77){socket[_0x9f3d('0xc1')](_0x9f3d('0xc2'),{'id':Number(_0xc25cee[_0x9f3d('0xaf')]['id']),'tags':_0x296b77||[]});return{'id':Number(_0xc25cee['params']['id']),'tags':_0x296b77||[]};});}})['then'](respondWithResult(_0x3abd5e,null))[_0x9f3d('0xad')](handleError(_0x3abd5e,null));};exports[_0x9f3d('0xc3')]=function(_0x161071,_0x4b727d,_0x2e7347){return db[_0x9f3d('0x34')][_0x9f3d('0x5d')]({'where':{'id':_0x161071[_0x9f3d('0xaf')]['id']}})['then'](handleEntityNotFound(_0x4b727d,null))['then'](function(_0x2ffde2){if(_0x2ffde2){return _0x2ffde2['removeTags'](_0x161071[_0x9f3d('0x3d')][_0x9f3d('0xb7')]);}})[_0x9f3d('0x25')](respondWithStatusCode(_0x4b727d,null))[_0x9f3d('0xad')](handleError(_0x4b727d,null));};exports[_0x9f3d('0xc4')]=function(_0x572287,_0x577745){var _0x52529a=moment()['unix']()[_0x9f3d('0x95')]();var _0x5cf353=path[_0x9f3d('0xc5')](config[_0x9f3d('0xc6')],_0x9f3d('0xc7'),_0x9f3d('0xc8'),_0x9f3d('0xc9'));var _0xe045e=path[_0x9f3d('0xc5')](config[_0x9f3d('0xc6')],'server',_0x9f3d('0xc8'),_0x9f3d('0xca'));var _0x15572b=path['join'](_0x5cf353,_0x52529a);var _0x2da093=util[_0x9f3d('0xbb')](_0x9f3d('0xcb'),_0x572287['params']['id'],_0x52529a);var _0x3fb6b7=path['join'](_0x5cf353,_0x2da093);var _0x507ce7=[];_0x507ce7['push']({'model':db[_0x9f3d('0x6b')],'as':_0x9f3d('0x6b'),'attributes':['id',_0x9f3d('0x2d')],'raw':!![]});_0x507ce7[_0x9f3d('0x32')]({'model':db['CmContact'],'as':_0x9f3d('0x62'),'attributes':['id',_0x9f3d('0xcc'),_0x9f3d('0xcd')],'raw':!![]});var _0x2fb77a=[{'model':db[_0x9f3d('0xba')],'as':'Messages','attributes':['id','body','createdAt',_0x9f3d('0xce'),'secret','read'],'include':_0x507ce7}];_0x2fb77a[_0x9f3d('0x32')]({'model':db['SmsAccount'],'as':'Account','attributes':['id',_0x9f3d('0x29')]});_0x2fb77a[_0x9f3d('0x32')]({'model':db[_0x9f3d('0x6b')],'as':_0x9f3d('0xcf'),'attributes':['id',_0x9f3d('0x2d')]});return db[_0x9f3d('0x34')][_0x9f3d('0x5d')]({'where':{'id':_0x572287['params']['id']},'include':_0x2fb77a})[_0x9f3d('0x25')](handleEntityNotFound(_0x577745,null))[_0x9f3d('0x25')](function(_0x89cca){if(_0x89cca){var _0x13c034=_0x89cca['get']({'plain':!![]});fs[_0x9f3d('0xd0')](_0x15572b);var _0x4ba552={'channel':_0x9f3d('0xd1'),'account':_0x13c034[_0x9f3d('0xd2')][_0x9f3d('0x29')],'agent':_0x13c034[_0x9f3d('0xcf')]?_0x13c034[_0x9f3d('0xcf')][_0x9f3d('0x2d')]:'N.A.','createdAt':moment(_0x13c034[_0x9f3d('0x75')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x9f3d('0x95')](),'closedAt':_0x13c034[_0x9f3d('0xd3')]?moment(_0x13c034[_0x9f3d('0xd4')])[_0x9f3d('0xbb')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x13c034[_0x9f3d('0xd5')],'messages':_(_0x13c034['Messages'])['filter']({'secret':![]})[_0x9f3d('0x2c')](function(_0x295e5c){return{'date':moment(_0x295e5c[_0x9f3d('0x75')])[_0x9f3d('0xbb')](_0x9f3d('0xbc'))[_0x9f3d('0x95')](),'sender':_0x295e5c[_0x9f3d('0xce')]===_0x9f3d('0xd6')?_0x295e5c[_0x9f3d('0x6b')]?_0x295e5c['User'][_0x9f3d('0x2d')]:_0x9f3d('0xd7'):_0x295e5c[_0x9f3d('0x62')]['firstName']+(_0x295e5c[_0x9f3d('0x62')]['lastName']?'\x20'+_0x295e5c[_0x9f3d('0x62')]['lastName']:''),'body':_0x295e5c[_0x9f3d('0xb4')],'direction':_0x295e5c['direction']===_0x9f3d('0xd6')?'A':'C','secret':_0x295e5c[_0x9f3d('0xd8')],'read':_0x295e5c[_0x9f3d('0x7d')]};})['value']()};return ejs['renderFile'](path[_0x9f3d('0xc5')](config[_0x9f3d('0xc6')],_0x9f3d('0xc7'),_0x9f3d('0xd9'),_0x9f3d('0xda')),{'interaction':_0x4ba552})[_0x9f3d('0x25')](function(_0x5d0348){var _0x28a070=path[_0x9f3d('0xc5')](_0x15572b,_0x9f3d('0xdb')+_0x13c034['id']+'-'+_0x52529a+_0x9f3d('0xdc'));var _0x31a45a={'path':_0x28a070,'channel':_0x9f3d('0xd1'),'interactionId':_0x13c034['id']};return pdf[_0x9f3d('0xdd')](_0x5d0348,_0x31a45a);})[_0x9f3d('0x25')](function(){return new BPromise(function(_0x1f231b,_0x29020e){zipdir(_0x15572b,{'saveTo':_0x3fb6b7},function(_0x42c9b1,_0x1f65e8){if(_0x42c9b1)return _0x29020e(_0x42c9b1);return _0x1f231b(_0x1f65e8);});})[_0x9f3d('0x25')](function(){return new BPromise(function(_0x3152a6,_0x452c0a){rimraf(_0x15572b,function(_0x5a6666){if(_0x5a6666)_0x452c0a(_0x5a6666);return _0x3152a6();});});})[_0x9f3d('0x25')](function(){return _0x577745['download'](_0x3fb6b7,_0x2da093,function(_0xf191a4){if(_0xf191a4){console['log'](_0x9f3d('0xde'),_0xf191a4);}else{fs[_0x9f3d('0xdf')](_0x3fb6b7);}});});});}else{return _0x577745[_0x9f3d('0x17')](0xc8);}})['catch'](handleError(_0x577745,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 776e834..a1b8668 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 _0x7708=['hook','exports','events','../../mysqldb','remove','getUsers','then','setDataValue','Users','map','length','emit','catch'];(function(_0x123e12,_0x4aeaf7){var _0xd5d2b5=function(_0x2a18f4){while(--_0x2a18f4){_0x123e12['push'](_0x123e12['shift']());}};_0xd5d2b5(++_0x4aeaf7);}(_0x7708,0x188));var _0x8770=function(_0x53e3fa,_0x50c5f2){_0x53e3fa=_0x53e3fa-0x0;var _0xe8584a=_0x7708[_0x53e3fa];return _0xe8584a;};'use strict';var EventEmitter=require(_0x8770('0x0'));var SmsInteraction=require(_0x8770('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0x8770('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x8770('0x2')};function emitEvent(_0x1a796d){return function(_0x577b13,_0x40d401,_0x50bab7){_0x577b13[_0x8770('0x3')]({'attributes':['id'],'raw':!![]})[_0x8770('0x4')](function(_0x2b0295){_0x577b13[_0x8770('0x5')](_0x8770('0x6'),_0x2b0295[_0x8770('0x7')](function(_0x2d4a1d){return{'id':_0x2d4a1d['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x577b13['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8770('0x4')](function(_0x2ca830){_0x577b13[_0x8770('0x5')]('unreadMessages',_0x2ca830[_0x8770('0x8')]);SmsInteractionEvents[_0x8770('0x9')](_0x1a796d+':'+_0x577b13['id'],_0x577b13);SmsInteractionEvents[_0x8770('0x9')](_0x1a796d,_0x577b13);_0x50bab7(null);})[_0x8770('0xa')](_0x50bab7(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x8770('0xb')](e,emitEvent(event));}}module[_0x8770('0xc')]=SmsInteractionEvents; \ No newline at end of file +var _0xb03e=['SmsMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','map','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','SmsInteraction'];(function(_0x19c883,_0x2098c7){var _0x202144=function(_0x5b1523){while(--_0x5b1523){_0x19c883['push'](_0x19c883['shift']());}};_0x202144(++_0x2098c7);}(_0xb03e,0x1eb));var _0xeb03=function(_0x2f9fc6,_0x4452bb){_0x2f9fc6=_0x2f9fc6-0x0;var _0xf356ed=_0xb03e[_0x2f9fc6];return _0xf356ed;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0xeb03('0x0'))['db'][_0xeb03('0x1')];var SmsMessage=require(_0xeb03('0x0'))['db'][_0xeb03('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xeb03('0x3')](0x0);var events={'afterCreate':_0xeb03('0x4'),'afterUpdate':_0xeb03('0x5'),'afterDestroy':_0xeb03('0x6')};function emitEvent(_0x474450){return function(_0x3ba4b0,_0x88925b,_0xee2291){_0x3ba4b0['getUsers']({'attributes':['id'],'raw':!![]})[_0xeb03('0x7')](function(_0x3d3322){_0x3ba4b0[_0xeb03('0x8')](_0xeb03('0x9'),_0x3d3322[_0xeb03('0xa')](function(_0x28c772){return{'id':_0x28c772['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x3ba4b0['id'],'direction':'in','read':![]},'raw':!![]});})[_0xeb03('0x7')](function(_0x99f4e2){_0x3ba4b0[_0xeb03('0x8')]('unreadMessages',_0x99f4e2[_0xeb03('0xb')]);SmsInteractionEvents['emit'](_0x474450+':'+_0x3ba4b0['id'],_0x3ba4b0);SmsInteractionEvents[_0xeb03('0xc')](_0x474450,_0x3ba4b0);_0xee2291(null);})[_0xeb03('0xd')](_0xee2291(null));};}for(var e in events){if(events[_0xeb03('0xe')](e)){var event=events[e];SmsInteraction[_0xeb03('0xf')](e,emitEvent(event));}}module[_0xeb03('0x10')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 6f76daf..5afbb30 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 _0x4ee5=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','define','SmsInteraction','sms_interactions','YYYY-MM-DD\x20HH:mm:ss','util'];(function(_0x153828,_0x481f44){var _0x448ff6=function(_0x2de432){while(--_0x2de432){_0x153828['push'](_0x153828['shift']());}};_0x448ff6(++_0x481f44);}(_0x4ee5,0x1d8));var _0x54ee=function(_0x284c7b,_0x24f992){_0x284c7b=_0x284c7b-0x0;var _0x38a066=_0x4ee5[_0x284c7b];return _0x38a066;};'use strict';var _=require('lodash');var util=require(_0x54ee('0x0'));var logger=require(_0x54ee('0x1'))(_0x54ee('0x2'));var moment=require(_0x54ee('0x3'));var BPromise=require(_0x54ee('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x54ee('0x5'));var config=require(_0x54ee('0x6'));var attributes=require('./smsInteraction.attributes');module['exports']=function(_0x234025,_0x1a185e){return _0x234025[_0x54ee('0x7')](_0x54ee('0x8'),attributes,{'tableName':_0x54ee('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x10a6cd,_0x257de4,_0x5ce63f){if(_0x10a6cd['changed']('closed')){_0x10a6cd['closedAt']=moment()['format'](_0x54ee('0xa'));}_0x5ce63f(null,_0x10a6cd);}}});}; \ No newline at end of file +var _0x4705=['./smsInteraction.attributes','exports','SmsInteraction','sms_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x307a99,_0x2c49c8){var _0x5cdde0=function(_0x3286ae){while(--_0x3286ae){_0x307a99['push'](_0x307a99['shift']());}};_0x5cdde0(++_0x2c49c8);}(_0x4705,0x7f));var _0x5470=function(_0x16ffd7,_0x446a20){_0x16ffd7=_0x16ffd7-0x0;var _0x5e2468=_0x4705[_0x16ffd7];return _0x5e2468;};'use strict';var _=require(_0x5470('0x0'));var util=require(_0x5470('0x1'));var logger=require(_0x5470('0x2'))(_0x5470('0x3'));var moment=require(_0x5470('0x4'));var BPromise=require(_0x5470('0x5'));var rp=require(_0x5470('0x6'));var fs=require('fs');var path=require(_0x5470('0x7'));var rimraf=require(_0x5470('0x8'));var config=require('../../config/environment');var attributes=require(_0x5470('0x9'));module[_0x5470('0xa')]=function(_0x20670f,_0x3857f3){return _0x20670f['define'](_0x5470('0xb'),attributes,{'tableName':_0x5470('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3d438e,_0x44b174,_0x1563b5){if(_0x3d438e[_0x5470('0xd')](_0x5470('0xe'))){_0x3d438e[_0x5470('0xf')]=moment()['format'](_0x5470('0x10'));}_0x1563b5(null,_0x3d438e);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 0411464..20289c4 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 _0x019a=['register','request','then','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','UpdateSmsInteraction','SmsInteraction','update','options','raw','limit','find','where','addTags','body','omit','AddTags','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','./smsInteraction.socket'];(function(_0x16ce4b,_0x2097c4){var _0x346707=function(_0x166d4a){while(--_0x166d4a){_0x16ce4b['push'](_0x16ce4b['shift']());}};_0x346707(++_0x2097c4);}(_0x019a,0xd2));var _0xa019=function(_0x357f96,_0xd37191){_0x357f96=_0x357f96-0x0;var _0x5abdcc=_0x019a[_0x357f96];return _0x5abdcc;};'use strict';var _=require(_0xa019('0x0'));var util=require(_0xa019('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa019('0x2'));var fs=require('fs');var Redis=require(_0xa019('0x3'));var db=require(_0xa019('0x4'))['db'];var utils=require(_0xa019('0x5'));var logger=require(_0xa019('0x6'))('rpc');var config=require(_0xa019('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa019('0x8')]({'port':0x232a});config[_0xa019('0x9')]=_[_0xa019('0xa')](config[_0xa019('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa019('0x9')]));require(_0xa019('0xb'))[_0xa019('0xc')](socket);function respondWithRpcPromise(_0x32ea63,_0x5571a8,_0x52cd62){return new BPromise(function(_0x54a06d,_0x2761cc){return client[_0xa019('0xd')](_0x32ea63,_0x52cd62)[_0xa019('0xe')](function(_0x45cdc4){logger['info'](_0xa019('0xf'),_0x5571a8,_0xa019('0x10'));logger[_0xa019('0x11')](_0xa019('0x12'),_0x5571a8,_0xa019('0x10'),JSON[_0xa019('0x13')](_0x45cdc4));if(_0x45cdc4[_0xa019('0x14')]){if(_0x45cdc4[_0xa019('0x14')][_0xa019('0x15')]===0x1f4){logger['error']('SmsInteraction,\x20%s,\x20%s',_0x5571a8,_0x45cdc4[_0xa019('0x14')][_0xa019('0x16')]);return _0x2761cc(_0x45cdc4[_0xa019('0x14')][_0xa019('0x16')]);}logger[_0xa019('0x14')](_0xa019('0xf'),_0x5571a8,_0x45cdc4[_0xa019('0x14')][_0xa019('0x16')]);return _0x54a06d(_0x45cdc4[_0xa019('0x14')][_0xa019('0x16')]);}else{logger[_0xa019('0x17')](_0xa019('0xf'),_0x5571a8,_0xa019('0x10'));_0x54a06d(_0x45cdc4['result'][_0xa019('0x16')]);}})[_0xa019('0x18')](function(_0x15ff1b){logger['error']('SmsInteraction,\x20%s,\x20%s',_0x5571a8,_0x15ff1b);_0x2761cc(_0x15ff1b);});});}exports[_0xa019('0x19')]=function(_0x48b08b){var _0x4a01f4=this;return new Promise(function(_0x3f56f1,_0x59839a){return db[_0xa019('0x1a')][_0xa019('0x1b')](_0x48b08b['body'],{'raw':_0x48b08b['options']?_0x48b08b[_0xa019('0x1c')][_0xa019('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48b08b['options']?_0x48b08b['options']['where']||null:null,'attributes':_0x48b08b[_0xa019('0x1c')]?_0x48b08b[_0xa019('0x1c')]['attributes']||null:null,'limit':_0x48b08b[_0xa019('0x1c')]?_0x48b08b[_0xa019('0x1c')][_0xa019('0x1e')]||null:null})['then'](function(_0x466921){logger[_0xa019('0x17')](_0xa019('0x19'),_0x48b08b);logger[_0xa019('0x11')](_0xa019('0x19'),_0x48b08b,JSON[_0xa019('0x13')](_0x466921));_0x3f56f1(_0x466921);})[_0xa019('0x18')](function(_0x443728){logger['error'](_0xa019('0x19'),_0x443728[_0xa019('0x16')],_0x48b08b);_0x59839a(_0x4a01f4[_0xa019('0x14')](0x1f4,_0x443728['message']));});});};exports['AddTagsToSmsInteraction']=function(_0x3cc57e){return new Promise(function(_0x5a6cb8,_0x17df23){return db[_0xa019('0x1a')][_0xa019('0x1f')]({'where':_0x3cc57e['options']?_0x3cc57e['options'][_0xa019('0x20')]||null:null})[_0xa019('0xe')](function(_0x4bf1a9){if(_0x4bf1a9){return _0x4bf1a9[_0xa019('0x21')](_0x3cc57e[_0xa019('0x22')]['ids'],_[_0xa019('0x23')](_0x3cc57e[_0xa019('0x22')],['ids','id'])||{});}})['spread'](function(_0x34278d){logger[_0xa019('0x17')](_0xa019('0x24'),_0x3cc57e);logger[_0xa019('0x11')](_0xa019('0x24'),_0x3cc57e,JSON['stringify'](_0x34278d));_0x5a6cb8(_0x34278d);})['catch'](function(_0x232480){logger[_0xa019('0x14')](_0xa019('0x24'),_0x232480[_0xa019('0x16')],_0x3cc57e);_0x17df23(_this[_0xa019('0x14')](0x1f4,_0x232480['message']));});});}; \ No newline at end of file +var _0xcd22=['../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','socket.io-emitter','./smsInteraction.socket','request','then','info','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','SmsInteraction,\x20%s,\x20%s','UpdateSmsInteraction','body','options','raw','where','attributes','limit','SmsInteraction','addTags','ids','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x12fbdd,_0x157cc3){var _0x2c703e=function(_0x1dee08){while(--_0x1dee08){_0x12fbdd['push'](_0x12fbdd['shift']());}};_0x2c703e(++_0x157cc3);}(_0xcd22,0x72));var _0x2cd2=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xcd22[_0x5b78e8];return _0xf2c321;};'use strict';var _=require(_0x2cd2('0x0'));var util=require('util');var moment=require(_0x2cd2('0x1'));var BPromise=require(_0x2cd2('0x2'));var rs=require(_0x2cd2('0x3'));var fs=require('fs');var Redis=require(_0x2cd2('0x4'));var db=require(_0x2cd2('0x5'))['db'];var utils=require(_0x2cd2('0x6'));var logger=require(_0x2cd2('0x7'))(_0x2cd2('0x8'));var config=require(_0x2cd2('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2cd2('0xa')]['http']({'port':0x232a});config[_0x2cd2('0xb')]=_[_0x2cd2('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2cd2('0xd'))(new Redis(config['redis']));require(_0x2cd2('0xe'))['register'](socket);function respondWithRpcPromise(_0x83743d,_0x29c726,_0x2f644c){return new BPromise(function(_0x416175,_0x3a7180){return client[_0x2cd2('0xf')](_0x83743d,_0x2f644c)[_0x2cd2('0x10')](function(_0x1e59c3){logger[_0x2cd2('0x11')]('SmsInteraction,\x20%s,\x20%s',_0x29c726,_0x2cd2('0x12'));logger[_0x2cd2('0x13')](_0x2cd2('0x14'),_0x29c726,'request\x20sent',JSON[_0x2cd2('0x15')](_0x1e59c3));if(_0x1e59c3['error']){if(_0x1e59c3['error'][_0x2cd2('0x16')]===0x1f4){logger[_0x2cd2('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x29c726,_0x1e59c3[_0x2cd2('0x17')][_0x2cd2('0x18')]);return _0x3a7180(_0x1e59c3['error']['message']);}logger[_0x2cd2('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x29c726,_0x1e59c3[_0x2cd2('0x17')]['message']);return _0x416175(_0x1e59c3['error']['message']);}else{logger['info']('SmsInteraction,\x20%s,\x20%s',_0x29c726,'request\x20sent');_0x416175(_0x1e59c3[_0x2cd2('0x19')]['message']);}})[_0x2cd2('0x1a')](function(_0x49a6fb){logger[_0x2cd2('0x17')](_0x2cd2('0x1b'),_0x29c726,_0x49a6fb);_0x3a7180(_0x49a6fb);});});}exports[_0x2cd2('0x1c')]=function(_0x2a2c61){var _0x3b6aba=this;return new Promise(function(_0x3c2f3a,_0x12efd4){return db['SmsInteraction']['update'](_0x2a2c61[_0x2cd2('0x1d')],{'raw':_0x2a2c61[_0x2cd2('0x1e')]?_0x2a2c61[_0x2cd2('0x1e')][_0x2cd2('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a2c61[_0x2cd2('0x1e')]?_0x2a2c61[_0x2cd2('0x1e')][_0x2cd2('0x20')]||null:null,'attributes':_0x2a2c61[_0x2cd2('0x1e')]?_0x2a2c61[_0x2cd2('0x1e')][_0x2cd2('0x21')]||null:null,'limit':_0x2a2c61[_0x2cd2('0x1e')]?_0x2a2c61['options'][_0x2cd2('0x22')]||null:null})['then'](function(_0x45f3a2){logger[_0x2cd2('0x11')](_0x2cd2('0x1c'),_0x2a2c61);logger[_0x2cd2('0x13')](_0x2cd2('0x1c'),_0x2a2c61,JSON[_0x2cd2('0x15')](_0x45f3a2));_0x3c2f3a(_0x45f3a2);})[_0x2cd2('0x1a')](function(_0x37045c){logger[_0x2cd2('0x17')](_0x2cd2('0x1c'),_0x37045c[_0x2cd2('0x18')],_0x2a2c61);_0x12efd4(_0x3b6aba['error'](0x1f4,_0x37045c[_0x2cd2('0x18')]));});});};exports['AddTagsToSmsInteraction']=function(_0x2ccb83){return new Promise(function(_0x342f2c,_0x9915c){return db[_0x2cd2('0x23')]['find']({'where':_0x2ccb83[_0x2cd2('0x1e')]?_0x2ccb83[_0x2cd2('0x1e')][_0x2cd2('0x20')]||null:null})['then'](function(_0x106dea){if(_0x106dea){return _0x106dea[_0x2cd2('0x24')](_0x2ccb83[_0x2cd2('0x1d')][_0x2cd2('0x25')],_['omit'](_0x2ccb83['body'],[_0x2cd2('0x25'),'id'])||{});}})[_0x2cd2('0x26')](function(_0x4a6362){logger[_0x2cd2('0x11')](_0x2cd2('0x27'),_0x2ccb83);logger[_0x2cd2('0x13')](_0x2cd2('0x27'),_0x2ccb83,JSON[_0x2cd2('0x15')](_0x4a6362));_0x342f2c(_0x4a6362);})[_0x2cd2('0x1a')](function(_0x883ac9){logger[_0x2cd2('0x17')](_0x2cd2('0x27'),_0x883ac9[_0x2cd2('0x18')],_0x2ccb83);_0x9915c(_this[_0x2cd2('0x17')](0x1f4,_0x883ac9[_0x2cd2('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 92f6706..0c294d7 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 _0x9acd=['remove','update','emit','register','length','./smsInteraction.events','save'];(function(_0x21483e,_0x3f4a0f){var _0x70db12=function(_0x42eb85){while(--_0x42eb85){_0x21483e['push'](_0x21483e['shift']());}};_0x70db12(++_0x3f4a0f);}(_0x9acd,0x1e1));var _0xd9ac=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x9acd[_0x273c39];return _0x46d6b5;};'use strict';var SmsInteractionEvents=require(_0xd9ac('0x0'));var events=[_0xd9ac('0x1'),_0xd9ac('0x2'),_0xd9ac('0x3')];function createListener(_0x211bf2,_0x40573b){return function(_0x2e9aa5){_0x40573b[_0xd9ac('0x4')](_0x211bf2,_0x2e9aa5);};}function removeListener(_0x10e608,_0x2bff65){return function(){SmsInteractionEvents['removeListener'](_0x10e608,_0x2bff65);};}exports[_0xd9ac('0x5')]=function(_0xa0d2e4){for(var _0x642d66=0x0,_0x624570=events[_0xd9ac('0x6')];_0x642d66<_0x624570;_0x642d66++){var _0x650ffa=events[_0x642d66];var _0x241521=createListener('smsInteraction:'+_0x650ffa,_0xa0d2e4);SmsInteractionEvents['on'](_0x650ffa,_0x241521);}}; \ No newline at end of file +var _0x98e9=['smsInteraction:','./smsInteraction.events','update','emit','removeListener','register','length'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x98e9,0xfd));var _0x998e=function(_0x121e61,_0x77d9ae){_0x121e61=_0x121e61-0x0;var _0x31e4c6=_0x98e9[_0x121e61];return _0x31e4c6;};'use strict';var SmsInteractionEvents=require(_0x998e('0x0'));var events=['save','remove',_0x998e('0x1')];function createListener(_0x230c5c,_0x1eeb6d){return function(_0x5ba32a){_0x1eeb6d[_0x998e('0x2')](_0x230c5c,_0x5ba32a);};}function removeListener(_0x3bb4f9,_0x441ae4){return function(){SmsInteractionEvents[_0x998e('0x3')](_0x3bb4f9,_0x441ae4);};}exports[_0x998e('0x4')]=function(_0x47ff16){for(var _0xd8b2ee=0x0,_0x1ae61=events[_0x998e('0x5')];_0xd8b2ee<_0x1ae61;_0xd8b2ee++){var _0x4e1a04=events[_0xd8b2ee];var _0x17def8=createListener(_0x998e('0x6')+_0x4e1a04,_0x47ff16);SmsInteractionEvents['on'](_0x4e1a04,_0x17def8);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index cdc4da6..604edd7 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 _0x1e5a=['tracked','sms','smsmessage:create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','isAuthenticated','index','get','/describe','describe','post'];(function(_0xde9b34,_0x428b56){var _0x1d12b9=function(_0x1be9a6){while(--_0x1be9a6){_0xde9b34['push'](_0xde9b34['shift']());}};_0x1d12b9(++_0x428b56);}(_0x1e5a,0xb5));var _0xa1e5=function(_0x7f943a,_0x44ce53){_0x7f943a=_0x7f943a-0x0;var _0x5fa814=_0x1e5a[_0x7f943a];return _0x5fa814;};'use strict';var multer=require(_0xa1e5('0x0'));var util=require(_0xa1e5('0x1'));var path=require(_0xa1e5('0x2'));var timeout=require(_0xa1e5('0x3'));var express=require(_0xa1e5('0x4'));var router=express['Router']();var fs_extra=require(_0xa1e5('0x5'));var auth=require(_0xa1e5('0x6'));var interaction=require(_0xa1e5('0x7'));var config=require('../../config/environment');var controller=require(_0xa1e5('0x8'));router['get']('/',auth[_0xa1e5('0x9')](),controller[_0xa1e5('0xa')]);router[_0xa1e5('0xb')](_0xa1e5('0xc'),auth[_0xa1e5('0x9')](),controller[_0xa1e5('0xd')]);router['get']('/:id',auth[_0xa1e5('0x9')](),controller['show']);router[_0xa1e5('0xe')]('/',auth[_0xa1e5('0x9')](),interaction[_0xa1e5('0xf')](_0xa1e5('0x10'),_0xa1e5('0x11')),controller['create']);router['post'](_0xa1e5('0x12'),controller[_0xa1e5('0x13')]);router[_0xa1e5('0x14')]('/:id',auth[_0xa1e5('0x9')](),controller[_0xa1e5('0x15')]);router[_0xa1e5('0x14')](_0xa1e5('0x16'),auth[_0xa1e5('0x9')](),controller[_0xa1e5('0x17')]);router['put'](_0xa1e5('0x18'),auth['isAuthenticated'](),controller[_0xa1e5('0x19')]);router['delete']('/:id',auth[_0xa1e5('0x9')](),controller[_0xa1e5('0x1a')]);module[_0xa1e5('0x1b')]=router; \ No newline at end of file +var _0x253d=['reject','destroy','exports','multer','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','sms','create','/:id/status','status','put','/:id/accept','/:id/reject'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x253d,0x1b3));var _0xd253=function(_0x3c0d8b,_0x1fd7ed){_0x3c0d8b=_0x3c0d8b-0x0;var _0x2c7792=_0x253d[_0x3c0d8b];return _0x2c7792;};'use strict';var multer=require(_0xd253('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd253('0x1')]();var fs_extra=require(_0xd253('0x2'));var auth=require(_0xd253('0x3'));var interaction=require(_0xd253('0x4'));var config=require(_0xd253('0x5'));var controller=require('./smsMessage.controller');router[_0xd253('0x6')]('/',auth[_0xd253('0x7')](),controller[_0xd253('0x8')]);router[_0xd253('0x6')](_0xd253('0x9'),auth['isAuthenticated'](),controller[_0xd253('0xa')]);router[_0xd253('0x6')](_0xd253('0xb'),auth[_0xd253('0x7')](),controller[_0xd253('0xc')]);router[_0xd253('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0xd253('0xe'),'smsmessage:create'),controller[_0xd253('0xf')]);router[_0xd253('0xd')](_0xd253('0x10'),controller[_0xd253('0x11')]);router[_0xd253('0x12')](_0xd253('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xd253('0x12')](_0xd253('0x13'),auth[_0xd253('0x7')](),controller['accept']);router['put'](_0xd253('0x14'),auth[_0xd253('0x7')](),controller[_0xd253('0x15')]);router['delete'](_0xd253('0xb'),auth['isAuthenticated'](),controller[_0xd253('0x16')]);module[_0xd253('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 b428a09..ccb41b4 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 _0x79e5=['sequelize','TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x631a3c,_0x1b61b6){var _0x2bdfa3=function(_0x21711b){while(--_0x21711b){_0x631a3c['push'](_0x631a3c['shift']());}};_0x2bdfa3(++_0x1b61b6);}(_0x79e5,0x170));var _0x579e=function(_0x210af2,_0x86e1de){_0x210af2=_0x210af2-0x0;var _0x1b0ff9=_0x79e5[_0x210af2];return _0x1b0ff9;};'use strict';var Sequelize=require(_0x579e('0x0'));module['exports']={'body':{'type':Sequelize[_0x579e('0x1')](_0x579e('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x579e('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x579e('0x4')]('in','out'),'defaultValue':_0x579e('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x579e('0x6')](0xbe)},'phone':{'type':Sequelize[_0x579e('0x6')]},'readAt':{'type':Sequelize[_0x579e('0x7')]},'secret':{'type':Sequelize[_0x579e('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x579e('0x1')]}}; \ No newline at end of file +var _0x6990=['DATE','sequelize','exports','TEXT','medium','BOOLEAN','out','STRING'];(function(_0x5d73f2,_0x489e05){var _0x3ceb82=function(_0x188490){while(--_0x188490){_0x5d73f2['push'](_0x5d73f2['shift']());}};_0x3ceb82(++_0x489e05);}(_0x6990,0x199));var _0x0699=function(_0x727af7,_0x663167){_0x727af7=_0x727af7-0x0;var _0x99bda6=_0x6990[_0x727af7];return _0x99bda6;};'use strict';var Sequelize=require(_0x0699('0x0'));module[_0x0699('0x1')]={'body':{'type':Sequelize[_0x0699('0x2')](_0x0699('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x0699('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x0699('0x5')),'defaultValue':_0x0699('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x0699('0x6')](0xbe)},'phone':{'type':Sequelize[_0x0699('0x6')]},'readAt':{'type':Sequelize[_0x0699('0x7')]},'secret':{'type':Sequelize[_0x0699('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x0699('0x6')]},'providerResponse':{'type':Sequelize[_0x0699('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index f610d50..4922021 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 _0x8b75=['show','params','fields','find','create','body','describe','sms-interactions','accept','sms','read','format','UserId','user','SmsInteraction','SmsInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','email','internal','manual','channel','event','EventManager','acceptmessage','reject','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','fullname','interface','SIP/%s','rejectmessage','SmsAccount','debug','received\x20delivery\x20report\x20from','type','twilio','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','inspect','infobip','results','groupName','DELIVERED','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','http','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','json','offset','undefined','limit','count','Content-Range','save','update','destroy','status','end','sendStatus','name','send','map','SmsMessage','rawAttributes','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows'];(function(_0x1a105b,_0x385a8b){var _0x4a457f=function(_0x57d844){while(--_0x57d844){_0x1a105b['push'](_0x1a105b['shift']());}};_0x4a457f(++_0x385a8b);}(_0x8b75,0x166));var _0x58b7=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0x8b75[_0x2d8fc2];return _0x3a9e53;};'use strict';var emlformat=require(_0x58b7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x58b7('0x1'));var jsonpatch=require(_0x58b7('0x2'));var rp=require('request-promise');var moment=require(_0x58b7('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x58b7('0x4'));var util=require(_0x58b7('0x5'));var path=require(_0x58b7('0x6'));var sox=require('sox');var csv=require(_0x58b7('0x7'));var ejs=require(_0x58b7('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x58b7('0x9'));var squel=require('squel');var crypto=require(_0x58b7('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x58b7('0xb'));var toCsv=require(_0x58b7('0x7'));var querystring=require(_0x58b7('0xc'));var Papa=require(_0x58b7('0xd'));var Redis=require(_0x58b7('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x58b7('0xf'));var as=require(_0x58b7('0x10'));var hardwareService=require(_0x58b7('0x11'));var logger=require(_0x58b7('0x12'))(_0x58b7('0x13'));var utils=require(_0x58b7('0x14'));var config=require(_0x58b7('0x15'));var licenseUtil=require(_0x58b7('0x16'));var db=require(_0x58b7('0x17'))['db'];config[_0x58b7('0x18')]=_[_0x58b7('0x19')](config['redis'],{'host':_0x58b7('0x1a'),'port':0x18eb});var socket=require(_0x58b7('0x1b'))(new Redis(config[_0x58b7('0x18')]));require('./smsMessage.socket')[_0x58b7('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x58b7('0x1d')][_0x58b7('0x1e')]({'port':0x232c});var client9002=jayson[_0x58b7('0x1d')][_0x58b7('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x103c53,_0x1870db,_0x58dcf8,_0x3fd125){return new BPromise(function(_0x40a188,_0x29ef21){var _0x41c4cf=_0x3fd125||client;return _0x41c4cf['request'](_0x103c53,_0x58dcf8)[_0x58b7('0x1f')](function(_0x43fcb9){logger[_0x58b7('0x20')](_0x58b7('0x21'),_0x1870db,_0x58b7('0x22'));logger['debug'](_0x58b7('0x23'),_0x1870db,'request\x20sent',JSON['stringify'](_0x43fcb9));if(_0x43fcb9[_0x58b7('0x24')]){if(_0x43fcb9[_0x58b7('0x24')][_0x58b7('0x25')]===0x1f4){logger[_0x58b7('0x24')](_0x58b7('0x21'),_0x1870db,_0x43fcb9['error'][_0x58b7('0x26')]);return _0x29ef21(_0x43fcb9[_0x58b7('0x24')][_0x58b7('0x26')]);}logger[_0x58b7('0x24')](_0x58b7('0x21'),_0x1870db,_0x43fcb9[_0x58b7('0x24')]['message']);return _0x40a188(_0x43fcb9[_0x58b7('0x24')][_0x58b7('0x26')]);}else{logger[_0x58b7('0x20')](_0x58b7('0x21'),_0x1870db,_0x58b7('0x22'));_0x40a188(_0x43fcb9[_0x58b7('0x27')][_0x58b7('0x26')]);}})[_0x58b7('0x28')](function(_0x52c1ae){logger[_0x58b7('0x24')](_0x58b7('0x21'),_0x1870db,_0x52c1ae);_0x29ef21(_0x52c1ae);});});}function respondWithStatusCode(_0x4e23e0,_0x470350){_0x470350=_0x470350||0xcc;return function(_0x224f1b){if(_0x224f1b){return _0x4e23e0['sendStatus'](_0x470350);}return _0x4e23e0['status'](_0x470350)['end']();};}function respondWithResult(_0x3325be,_0x262129){_0x262129=_0x262129||0xc8;return function(_0x9b3441){if(_0x9b3441){return _0x3325be['status'](_0x262129)[_0x58b7('0x29')](_0x9b3441);}};}function respondWithFilteredResult(_0x206e41,_0x403476){return function(_0x1f2f68){if(_0x1f2f68){var _0x32bb7c=typeof _0x403476[_0x58b7('0x2a')]===_0x58b7('0x2b')&&typeof _0x403476[_0x58b7('0x2c')]===_0x58b7('0x2b');var _0x475c2d=_0x1f2f68[_0x58b7('0x2d')];var _0x2f3de0=_0x32bb7c?0x0:_0x403476[_0x58b7('0x2a')];var _0xf93249=_0x32bb7c?_0x1f2f68[_0x58b7('0x2d')]:_0x403476['offset']+_0x403476[_0x58b7('0x2c')];var _0x3593e7;if(_0xf93249>=_0x475c2d){_0xf93249=_0x475c2d;_0x3593e7=0xc8;}else{_0x3593e7=0xce;}_0x206e41['status'](_0x3593e7);return _0x206e41['set'](_0x58b7('0x2e'),_0x2f3de0+'-'+_0xf93249+'/'+_0x475c2d)[_0x58b7('0x29')](_0x1f2f68);}return null;};}function patchUpdates(_0x10d0f5){return function(_0x30db2f){try{jsonpatch['apply'](_0x30db2f,_0x10d0f5,!![]);}catch(_0x4cd5bb){return BPromise['reject'](_0x4cd5bb);}return _0x30db2f[_0x58b7('0x2f')]();};}function saveUpdates(_0x180b42,_0x4c1493){return function(_0xb9c916){if(_0xb9c916){return _0xb9c916[_0x58b7('0x30')](_0x180b42)[_0x58b7('0x1f')](function(_0x4c5730){return _0x4c5730;});}return null;};}function removeEntity(_0x31cd17,_0x3110ac){return function(_0x2528eb){if(_0x2528eb){return _0x2528eb[_0x58b7('0x31')]()[_0x58b7('0x1f')](function(){_0x31cd17[_0x58b7('0x32')](0xcc)[_0x58b7('0x33')]();});}};}function handleEntityNotFound(_0x3c34e6,_0x11bbe0){return function(_0x6d7e84){if(!_0x6d7e84){_0x3c34e6[_0x58b7('0x34')](0x194);}return _0x6d7e84;};}function handleError(_0x5cd815,_0x42cfd1){_0x42cfd1=_0x42cfd1||0x1f4;return function(_0x460ffe){logger['error'](_0x460ffe['stack']);if(_0x460ffe[_0x58b7('0x35')]){delete _0x460ffe[_0x58b7('0x35')];}_0x5cd815[_0x58b7('0x32')](_0x42cfd1)[_0x58b7('0x36')](_0x460ffe);};}exports['index']=function(_0x365247,_0x1c6842){var _0x1d1bf8={},_0x220c0d={},_0x320b56={'count':0x0,'rows':[]};var _0x28dd2d=_[_0x58b7('0x37')](db[_0x58b7('0x38')][_0x58b7('0x39')],function(_0x59aa3b){return{'name':_0x59aa3b['fieldName'],'type':_0x59aa3b['type']['key']};});_0x220c0d[_0x58b7('0x3a')]=_['map'](_0x28dd2d,'name');_0x220c0d['query']=_[_0x58b7('0x3b')](_0x365247[_0x58b7('0x3c')]);_0x220c0d[_0x58b7('0x3d')]=_[_0x58b7('0x3e')](_0x220c0d['model'],_0x220c0d[_0x58b7('0x3c')]);_0x1d1bf8['attributes']=_[_0x58b7('0x3e')](_0x220c0d[_0x58b7('0x3a')],qs['fields'](_0x365247[_0x58b7('0x3c')]['fields']));_0x1d1bf8[_0x58b7('0x3f')]=_0x1d1bf8[_0x58b7('0x3f')][_0x58b7('0x40')]?_0x1d1bf8[_0x58b7('0x3f')]:_0x220c0d[_0x58b7('0x3a')];if(!_0x365247[_0x58b7('0x3c')][_0x58b7('0x41')]('nolimit')){_0x1d1bf8[_0x58b7('0x2c')]=qs[_0x58b7('0x2c')](_0x365247[_0x58b7('0x3c')]['limit']);_0x1d1bf8[_0x58b7('0x2a')]=qs[_0x58b7('0x2a')](_0x365247['query'][_0x58b7('0x2a')]);}_0x1d1bf8[_0x58b7('0x42')]=qs['sort'](_0x365247['query'][_0x58b7('0x43')]);_0x1d1bf8[_0x58b7('0x44')]=qs[_0x58b7('0x3d')](_[_0x58b7('0x45')](_0x365247['query'],_0x220c0d[_0x58b7('0x3d')]),_0x28dd2d);if(_0x365247['query'][_0x58b7('0x46')]){_0x1d1bf8[_0x58b7('0x44')]=_[_0x58b7('0x47')](_0x1d1bf8[_0x58b7('0x44')],{'$or':_[_0x58b7('0x37')](_0x28dd2d,function(_0x4a45f9){if(_0x4a45f9['type']!=='VIRTUAL'){var _0x3a78ee={};_0x3a78ee[_0x4a45f9['name']]={'$like':'%'+_0x365247[_0x58b7('0x3c')][_0x58b7('0x46')]+'%'};return _0x3a78ee;}})});}_0x1d1bf8=_[_0x58b7('0x47')]({},_0x1d1bf8,_0x365247[_0x58b7('0x48')]);var _0xc8933={'where':_0x1d1bf8[_0x58b7('0x44')]};return db[_0x58b7('0x38')]['count'](_0xc8933)[_0x58b7('0x1f')](function(_0x11005a){_0x320b56[_0x58b7('0x2d')]=_0x11005a;if(_0x365247[_0x58b7('0x3c')][_0x58b7('0x49')]){_0x1d1bf8[_0x58b7('0x4a')]=[{'all':!![]}];}return db[_0x58b7('0x38')][_0x58b7('0x4b')](_0x1d1bf8);})['then'](function(_0x53c3a1){_0x320b56[_0x58b7('0x4c')]=_0x53c3a1;return _0x320b56;})[_0x58b7('0x1f')](respondWithFilteredResult(_0x1c6842,_0x1d1bf8))[_0x58b7('0x28')](handleError(_0x1c6842,null));};exports[_0x58b7('0x4d')]=function(_0x1086e2,_0x44f976){var _0x4051e4={'raw':!![],'where':{'id':_0x1086e2[_0x58b7('0x4e')]['id']}},_0x4b3df9={};_0x4b3df9[_0x58b7('0x3a')]=_[_0x58b7('0x3b')](db[_0x58b7('0x38')][_0x58b7('0x39')]);_0x4b3df9[_0x58b7('0x3c')]=_[_0x58b7('0x3b')](_0x1086e2[_0x58b7('0x3c')]);_0x4b3df9[_0x58b7('0x3d')]=_[_0x58b7('0x3e')](_0x4b3df9['model'],_0x4b3df9[_0x58b7('0x3c')]);_0x4051e4[_0x58b7('0x3f')]=_[_0x58b7('0x3e')](_0x4b3df9[_0x58b7('0x3a')],qs['fields'](_0x1086e2['query'][_0x58b7('0x4f')]));_0x4051e4['attributes']=_0x4051e4['attributes'][_0x58b7('0x40')]?_0x4051e4[_0x58b7('0x3f')]:_0x4b3df9[_0x58b7('0x3a')];if(_0x1086e2[_0x58b7('0x3c')]['includeAll']){_0x4051e4[_0x58b7('0x4a')]=[{'all':!![]}];}_0x4051e4=_[_0x58b7('0x47')]({},_0x4051e4,_0x1086e2[_0x58b7('0x48')]);return db['SmsMessage'][_0x58b7('0x50')](_0x4051e4)[_0x58b7('0x1f')](handleEntityNotFound(_0x44f976,null))[_0x58b7('0x1f')](respondWithResult(_0x44f976,null))[_0x58b7('0x28')](handleError(_0x44f976,null));};exports[_0x58b7('0x51')]=function(_0x234787,_0x5272ae){return db[_0x58b7('0x38')][_0x58b7('0x51')](_0x234787[_0x58b7('0x52')],{})[_0x58b7('0x1f')](respondWithResult(_0x5272ae,0xc9))[_0x58b7('0x28')](handleError(_0x5272ae,null));};exports[_0x58b7('0x30')]=function(_0x3ec9e4,_0xd60e1c){if(_0x3ec9e4[_0x58b7('0x52')]['id']){delete _0x3ec9e4['body']['id'];}return db[_0x58b7('0x38')][_0x58b7('0x50')]({'where':{'id':_0x3ec9e4[_0x58b7('0x4e')]['id']}})[_0x58b7('0x1f')](handleEntityNotFound(_0xd60e1c,null))['then'](saveUpdates(_0x3ec9e4[_0x58b7('0x52')],null))[_0x58b7('0x1f')](respondWithResult(_0xd60e1c,null))[_0x58b7('0x28')](handleError(_0xd60e1c,null));};exports['destroy']=function(_0x1304a0,_0x15bed0){return db['SmsMessage'][_0x58b7('0x50')]({'where':{'id':_0x1304a0['params']['id']}})[_0x58b7('0x1f')](handleEntityNotFound(_0x15bed0,null))[_0x58b7('0x1f')](removeEntity(_0x15bed0,null))[_0x58b7('0x28')](handleError(_0x15bed0,null));};exports[_0x58b7('0x53')]=function(_0x2f71ee,_0x455a94){return db[_0x58b7('0x38')]['describe']()[_0x58b7('0x1f')](respondWithResult(_0x455a94,null))[_0x58b7('0x28')](handleError(_0x455a94,null));};var interaction_log=require(_0x58b7('0x12'))(_0x58b7('0x54'));exports[_0x58b7('0x55')]=function(_0x5f2c37,_0x4f050f,_0x10e948){var _0x2ce86b={'agent':{},'channel':_0x58b7('0x56')};if(_0x5f2c37[_0x58b7('0x52')]['id']){delete _0x5f2c37['body']['id'];}_0x5f2c37[_0x58b7('0x52')][_0x58b7('0x57')]=!![];_0x5f2c37[_0x58b7('0x52')]['readAt']=moment()[_0x58b7('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0x5f2c37[_0x58b7('0x52')][_0x58b7('0x59')]=_0x5f2c37[_0x58b7('0x52')][_0x58b7('0x59')]||_0x5f2c37[_0x58b7('0x5a')]['id'];_0x2ce86b['agent']['id']=_0x5f2c37[_0x58b7('0x52')][_0x58b7('0x59')];return db[_0x58b7('0x38')]['find']({'where':{'id':_0x5f2c37[_0x58b7('0x4e')]['id'],'UserId':null}})[_0x58b7('0x1f')](handleEntityNotFound(_0x4f050f,null))[_0x58b7('0x1f')](saveUpdates(_0x5f2c37[_0x58b7('0x52')],null))[_0x58b7('0x1f')](function(_0x41237d){if(_0x41237d){_0x2ce86b[_0x58b7('0x26')]=_0x41237d['get']({'plain':!![]});return db[_0x58b7('0x5b')][_0x58b7('0x50')]({'where':{'id':_0x41237d[_0x58b7('0x5c')]}});}return null;})[_0x58b7('0x1f')](handleEntityNotFound(_0x4f050f,null))[_0x58b7('0x1f')](function(_0x2403b0){if(_0x2403b0){return _0x2403b0[_0x58b7('0x30')]({'UserId':_0x5f2c37[_0x58b7('0x52')]['UserId'],'read1stAt':_[_0x58b7('0x5d')](_0x2403b0['read1stAt'])?moment()[_0x58b7('0x58')](_0x58b7('0x5e')):undefined});}return null;})[_0x58b7('0x1f')](function(_0x52a0c3){if(_0x52a0c3){_0x2ce86b[_0x58b7('0x5f')]=_0x52a0c3[_0x58b7('0x60')]({'plain':!![]});interaction_log['info'](_0x58b7('0x61'),_0x5f2c37[_0x58b7('0x5a')]['id'],_0x5f2c37['user']['name'],_0x5f2c37['user'][_0x58b7('0x62')],_0x2ce86b[_0x58b7('0x5f')]['id'],_0x5f2c37[_0x58b7('0x52')]?JSON[_0x58b7('0x63')](_0x5f2c37[_0x58b7('0x52')]):_0x58b7('0x64'));return respondWithRpcPromise(_0x58b7('0x65'),_0x58b7('0x66'),_0x2ce86b);}return null;})[_0x58b7('0x1f')](function(_0x4e8c61){var _0x5c03fc=_0x58b7('0x67')+_0x4e8c61[_0x58b7('0x26')][_0x58b7('0x68')];return db[_0x58b7('0x69')][_0x58b7('0x3c')](_0x5c03fc,{'type':db[_0x58b7('0x6a')][_0x58b7('0x6b')][_0x58b7('0x6c')],'raw':!![]})[_0x58b7('0x1f')](function(_0x19afcb){return _0x19afcb;});})[_0x58b7('0x1f')](function(_0x40dd0a){if(_0x40dd0a){_0x2ce86b[_0x58b7('0x26')][_0x58b7('0x6d')]=_0x40dd0a[0x0];if(!_0x5f2c37[_0x58b7('0x52')]['UserId'])return;return db[_0x58b7('0x6e')][_0x58b7('0x50')]({'where':{'id':_0x5f2c37[_0x58b7('0x52')]['UserId'],'role':_0x58b7('0x6f')},'attributes':['id',_0x58b7('0x35'),'fullname',_0x58b7('0x70'),_0x58b7('0x71')],'raw':!![]});}return null;})[_0x58b7('0x1f')](function(_0x5072f8){if(!_0x5072f8)return null;_0x2ce86b[_0x58b7('0x26')]['agent']=_0x5072f8;return _0x2ce86b;})[_0x58b7('0x1f')](function(_0x453f40){if(_0x453f40){if(_0x5f2c37['body'][_0x58b7('0x72')]){_0x2ce86b['message']['interface']=util[_0x58b7('0x58')]('SIP/%s',_0x5f2c37[_0x58b7('0x5a')][_0x58b7('0x35')]);_0x2ce86b[_0x58b7('0x26')][_0x58b7('0x73')]=_0x2ce86b[_0x58b7('0x73')];_0x2ce86b[_0x58b7('0x26')][_0x58b7('0x74')]=_0x58b7('0x55');return respondWithRpcPromise(_0x58b7('0x75'),'EventManager',{'event':_0x58b7('0x76'),'message':_0x2ce86b[_0x58b7('0x26')]},client9002)[_0x58b7('0x1f')](function(){return _0x2ce86b;});}return _0x2ce86b;}return null;})[_0x58b7('0x1f')](respondWithResult(_0x4f050f,null))[_0x58b7('0x28')](handleError(_0x4f050f,null));};var interaction_log=require(_0x58b7('0x12'))(_0x58b7('0x54'));exports[_0x58b7('0x77')]=function(_0x404f74,_0x212ad8,_0x2dcde7){var _0x36436f={'agent':{},'channel':_0x58b7('0x56')};if(_0x404f74['body']['id']){delete _0x404f74[_0x58b7('0x52')]['id'];}_0x404f74[_0x58b7('0x52')]['UserId']=_0x404f74[_0x58b7('0x52')]['UserId']||_0x404f74[_0x58b7('0x5a')]['id'];_0x36436f['agent']['id']=_0x404f74[_0x58b7('0x52')]['UserId'];return db[_0x58b7('0x38')][_0x58b7('0x50')]({'where':{'id':_0x404f74[_0x58b7('0x4e')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x212ad8,null))[_0x58b7('0x1f')](function(_0x40de3a){if(_0x40de3a){_0x36436f[_0x58b7('0x26')]=_0x40de3a[_0x58b7('0x60')]({'plain':!![]});return db[_0x58b7('0x5b')][_0x58b7('0x50')]({'where':{'id':_0x40de3a[_0x58b7('0x5c')]}});}return null;})['then'](handleEntityNotFound(_0x212ad8,null))[_0x58b7('0x1f')](function(_0x3fcfd0){if(_0x3fcfd0){_0x36436f['interaction']=_0x3fcfd0[_0x58b7('0x60')]({'plain':!![]});interaction_log[_0x58b7('0x20')](_0x58b7('0x78'),_0x404f74['user']['id'],_0x404f74['user'][_0x58b7('0x35')],_0x404f74[_0x58b7('0x5a')][_0x58b7('0x62')],_0x36436f[_0x58b7('0x5f')]['id'],_0x404f74[_0x58b7('0x52')]?JSON['stringify'](_0x404f74['body']):_0x58b7('0x64'));return respondWithRpcPromise(_0x58b7('0x79'),'rejectMessage',_0x36436f);}return null;})['then'](function(_0x3f02be){var _0x45c9b6=_0x58b7('0x67')+_0x3f02be['message'][_0x58b7('0x68')];return db[_0x58b7('0x69')]['query'](_0x45c9b6,{'type':db[_0x58b7('0x6a')][_0x58b7('0x6b')][_0x58b7('0x6c')],'raw':!![]})[_0x58b7('0x1f')](function(_0x625837){return _0x625837;});})['then'](function(_0x45b5bf){if(_0x45b5bf){_0x36436f[_0x58b7('0x26')]['contact']=_0x45b5bf[0x0];if(!_0x404f74[_0x58b7('0x52')][_0x58b7('0x59')])return;return db[_0x58b7('0x6e')]['find']({'where':{'id':_0x404f74[_0x58b7('0x52')][_0x58b7('0x59')],'role':'agent'},'attributes':['id',_0x58b7('0x35'),_0x58b7('0x7a'),'email',_0x58b7('0x71')],'raw':!![]});}return null;})[_0x58b7('0x1f')](function(_0xaa5bc){if(!_0xaa5bc)return null;_0x36436f[_0x58b7('0x26')][_0x58b7('0x6f')]=_0xaa5bc;return _0x36436f;})['then'](function(_0x2c7e87){if(_0x2c7e87){_0x2c7e87[_0x58b7('0x26')][_0x58b7('0x7b')]=util['format'](_0x58b7('0x7c'),_0x404f74[_0x58b7('0x5a')][_0x58b7('0x35')]);_0x2c7e87[_0x58b7('0x26')][_0x58b7('0x73')]=_0x36436f[_0x58b7('0x73')];_0x2c7e87[_0x58b7('0x26')][_0x58b7('0x74')]='reject';respondWithRpcPromise(_0x58b7('0x75'),_0x58b7('0x75'),{'event':_0x58b7('0x7d'),'message':_0x2c7e87[_0x58b7('0x26')]},client9002);return _0x36436f;}return null;})[_0x58b7('0x1f')](respondWithResult(_0x212ad8,null))[_0x58b7('0x28')](handleError(_0x212ad8,null));};exports[_0x58b7('0x32')]=function(_0x36f253,_0x1633d5,_0x35dde2){if(_0x36f253['body']['id']){delete _0x36f253['body']['id'];}var _0x34267b;return db[_0x58b7('0x38')]['find']({'where':{'id':_0x36f253[_0x58b7('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1633d5,null))[_0x58b7('0x1f')](function(_0x4d5fa3){if(_0x4d5fa3){_0x34267b=_0x4d5fa3;return db[_0x58b7('0x7e')][_0x58b7('0x50')]({'where':{'id':_0x4d5fa3['SmsAccountId']}});}})[_0x58b7('0x1f')](handleEntityNotFound(_0x1633d5,null))['then'](function(_0x1c5556){if(_0x1c5556){logger[_0x58b7('0x7f')](_0x58b7('0x23'),_0x58b7('0x32'),_0x58b7('0x80'),_0x1c5556['type'],util['inspect'](_0x36f253['body'],{'showHidden':![],'depth':null}));switch(_0x1c5556[_0x58b7('0x81')]){case _0x58b7('0x82'):if(_0x36f253[_0x58b7('0x52')]['MessageSid']&&_0x36f253[_0x58b7('0x52')]['MessageSid']===_0x34267b[_0x58b7('0x83')]){return _0x34267b['update']({'read':!![]});}else{logger['error'](_0x58b7('0x84'),_0x58b7('0x32'),_0x58b7('0x82'),util['inspect'](_0x36f253[_0x58b7('0x52')],{'showHidden':![],'depth':null}));}break;case _0x58b7('0x85'):if(_0x36f253[_0x58b7('0x52')][_0x58b7('0x86')]&&_0x36f253['body'][_0x58b7('0x86')]===_0x34267b[_0x58b7('0x83')]&&_[_0x58b7('0x87')]([_0x58b7('0x88'),_0x58b7('0x89')],_0x36f253[_0x58b7('0x52')][_0x58b7('0x8a')])>=0x0){return _0x34267b[_0x58b7('0x30')]({'read':!![]});}else{logger[_0x58b7('0x24')](_0x58b7('0x84'),_0x58b7('0x32'),_0x58b7('0x8b'),util[_0x58b7('0x8c')](_0x36f253['body'],{'showHidden':![],'depth':null}));}break;case _0x58b7('0x8d'):var _0x53751a=_0x36f253['body'][_0x58b7('0x8e')][0x0];if(_0x53751a[_0x58b7('0x32')][_0x58b7('0x8f')]===_0x58b7('0x90')){return _0x34267b[_0x58b7('0x30')]({'read':!![]});}else{logger['error'](_0x58b7('0x84'),_0x58b7('0x32'),'infobip',util[_0x58b7('0x8c')](_0x36f253[_0x58b7('0x52')],{'showHidden':![],'depth':null}));}break;}return _0x34267b;}})[_0x58b7('0x1f')](respondWithResult(_0x1633d5,null))[_0x58b7('0x28')](handleError(_0x1633d5,null));}; \ No newline at end of file +var _0x567c=['UserId','user','agent','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','fullname','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','contact','User','email','rejectmessage','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','Status','infobip','results','groupName','DELIVERED','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','crypto','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./smsMessage.socket','jayson/promise','http','client','then','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','includeAll','findAll','rows','params','include','options','catch','create','body','find','destroy','describe','sms-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x567c,0xc8));var _0xc567=function(_0x3da2f8,_0x50e1f6){_0x3da2f8=_0x3da2f8-0x0;var _0xefcb74=_0x567c[_0x3da2f8];return _0xefcb74;};'use strict';var emlformat=require(_0xc567('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc567('0x1'));var jsonpatch=require(_0xc567('0x2'));var rp=require(_0xc567('0x3'));var moment=require(_0xc567('0x4'));var BPromise=require(_0xc567('0x5'));var Mustache=require(_0xc567('0x6'));var util=require(_0xc567('0x7'));var path=require('path');var sox=require(_0xc567('0x8'));var csv=require('to-csv');var ejs=require(_0xc567('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc567('0xa'));var squel=require('squel');var crypto=require(_0xc567('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc567('0xc'));var querystring=require(_0xc567('0xd'));var Papa=require('papaparse');var Redis=require(_0xc567('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xc567('0xf'));var as=require(_0xc567('0x10'));var hardwareService=require(_0xc567('0x11'));var logger=require(_0xc567('0x12'))(_0xc567('0x13'));var utils=require(_0xc567('0x14'));var config=require(_0xc567('0x15'));var licenseUtil=require(_0xc567('0x16'));var db=require(_0xc567('0x17'))['db'];config[_0xc567('0x18')]=_['defaults'](config['redis'],{'host':_0xc567('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc567('0x1a'))['register'](socket);var jayson=require(_0xc567('0x1b'));var client=jayson['client'][_0xc567('0x1c')]({'port':0x232c});var client9002=jayson[_0xc567('0x1d')][_0xc567('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x3ea104,_0x183e1c,_0xb18dcf,_0x42c203){return new BPromise(function(_0x3afdf7,_0x5ba368){var _0x33287b=_0x42c203||client;return _0x33287b['request'](_0x3ea104,_0xb18dcf)[_0xc567('0x1e')](function(_0xaddebb){logger[_0xc567('0x1f')](_0xc567('0x20'),_0x183e1c,'request\x20sent');logger[_0xc567('0x21')](_0xc567('0x22'),_0x183e1c,_0xc567('0x23'),JSON[_0xc567('0x24')](_0xaddebb));if(_0xaddebb['error']){if(_0xaddebb['error'][_0xc567('0x25')]===0x1f4){logger[_0xc567('0x26')](_0xc567('0x20'),_0x183e1c,_0xaddebb[_0xc567('0x26')][_0xc567('0x27')]);return _0x5ba368(_0xaddebb['error']['message']);}logger[_0xc567('0x26')]('SmsMessage,\x20%s,\x20%s',_0x183e1c,_0xaddebb[_0xc567('0x26')][_0xc567('0x27')]);return _0x3afdf7(_0xaddebb[_0xc567('0x26')][_0xc567('0x27')]);}else{logger[_0xc567('0x1f')](_0xc567('0x20'),_0x183e1c,_0xc567('0x23'));_0x3afdf7(_0xaddebb[_0xc567('0x28')][_0xc567('0x27')]);}})['catch'](function(_0x33a89b){logger['error'](_0xc567('0x20'),_0x183e1c,_0x33a89b);_0x5ba368(_0x33a89b);});});}function respondWithStatusCode(_0x1a6522,_0x3ed3d0){_0x3ed3d0=_0x3ed3d0||0xcc;return function(_0x443db8){if(_0x443db8){return _0x1a6522[_0xc567('0x29')](_0x3ed3d0);}return _0x1a6522[_0xc567('0x2a')](_0x3ed3d0)[_0xc567('0x2b')]();};}function respondWithResult(_0x68895c,_0x4937dd){_0x4937dd=_0x4937dd||0xc8;return function(_0x44c3f3){if(_0x44c3f3){return _0x68895c['status'](_0x4937dd)[_0xc567('0x2c')](_0x44c3f3);}};}function respondWithFilteredResult(_0x31867b,_0x7ae58a){return function(_0x20c1c9){if(_0x20c1c9){var _0x1b65eb=typeof _0x7ae58a[_0xc567('0x2d')]===_0xc567('0x2e')&&typeof _0x7ae58a[_0xc567('0x2f')]===_0xc567('0x2e');var _0x315dc8=_0x20c1c9['count'];var _0x4e0a18=_0x1b65eb?0x0:_0x7ae58a[_0xc567('0x2d')];var _0x434d36=_0x1b65eb?_0x20c1c9[_0xc567('0x30')]:_0x7ae58a[_0xc567('0x2d')]+_0x7ae58a[_0xc567('0x2f')];var _0x40ff5d;if(_0x434d36>=_0x315dc8){_0x434d36=_0x315dc8;_0x40ff5d=0xc8;}else{_0x40ff5d=0xce;}_0x31867b[_0xc567('0x2a')](_0x40ff5d);return _0x31867b[_0xc567('0x31')]('Content-Range',_0x4e0a18+'-'+_0x434d36+'/'+_0x315dc8)['json'](_0x20c1c9);}return null;};}function patchUpdates(_0x3baa35){return function(_0x40a8c9){try{jsonpatch[_0xc567('0x32')](_0x40a8c9,_0x3baa35,!![]);}catch(_0x20b52b){return BPromise[_0xc567('0x33')](_0x20b52b);}return _0x40a8c9['save']();};}function saveUpdates(_0x3de309,_0x4db3ca){return function(_0xafe285){if(_0xafe285){return _0xafe285[_0xc567('0x34')](_0x3de309)[_0xc567('0x1e')](function(_0x318dee){return _0x318dee;});}return null;};}function removeEntity(_0x46cbc8,_0xaa9bb8){return function(_0x488a03){if(_0x488a03){return _0x488a03['destroy']()[_0xc567('0x1e')](function(){_0x46cbc8['status'](0xcc)[_0xc567('0x2b')]();});}};}function handleEntityNotFound(_0x5402ef,_0x3afebf){return function(_0x24919b){if(!_0x24919b){_0x5402ef[_0xc567('0x29')](0x194);}return _0x24919b;};}function handleError(_0x1e9199,_0x5f8c0e){_0x5f8c0e=_0x5f8c0e||0x1f4;return function(_0x3ac675){logger[_0xc567('0x26')](_0x3ac675[_0xc567('0x35')]);if(_0x3ac675[_0xc567('0x36')]){delete _0x3ac675['name'];}_0x1e9199[_0xc567('0x2a')](_0x5f8c0e)[_0xc567('0x37')](_0x3ac675);};}exports[_0xc567('0x38')]=function(_0xafc48e,_0x541c21){var _0x2ecba2={},_0x62e676={},_0x2d4557={'count':0x0,'rows':[]};var _0x78b730=_[_0xc567('0x39')](db[_0xc567('0x3a')][_0xc567('0x3b')],function(_0x242b06){return{'name':_0x242b06[_0xc567('0x3c')],'type':_0x242b06['type'][_0xc567('0x3d')]};});_0x62e676[_0xc567('0x3e')]=_[_0xc567('0x39')](_0x78b730,'name');_0x62e676[_0xc567('0x3f')]=_[_0xc567('0x40')](_0xafc48e[_0xc567('0x3f')]);_0x62e676[_0xc567('0x41')]=_[_0xc567('0x42')](_0x62e676['model'],_0x62e676[_0xc567('0x3f')]);_0x2ecba2['attributes']=_[_0xc567('0x42')](_0x62e676['model'],qs[_0xc567('0x43')](_0xafc48e[_0xc567('0x3f')][_0xc567('0x43')]));_0x2ecba2[_0xc567('0x44')]=_0x2ecba2[_0xc567('0x44')][_0xc567('0x45')]?_0x2ecba2['attributes']:_0x62e676[_0xc567('0x3e')];if(!_0xafc48e[_0xc567('0x3f')][_0xc567('0x46')](_0xc567('0x47'))){_0x2ecba2[_0xc567('0x2f')]=qs[_0xc567('0x2f')](_0xafc48e[_0xc567('0x3f')][_0xc567('0x2f')]);_0x2ecba2[_0xc567('0x2d')]=qs['offset'](_0xafc48e[_0xc567('0x3f')][_0xc567('0x2d')]);}_0x2ecba2[_0xc567('0x48')]=qs[_0xc567('0x49')](_0xafc48e['query'][_0xc567('0x49')]);_0x2ecba2[_0xc567('0x4a')]=qs[_0xc567('0x41')](_[_0xc567('0x4b')](_0xafc48e[_0xc567('0x3f')],_0x62e676[_0xc567('0x41')]),_0x78b730);if(_0xafc48e[_0xc567('0x3f')][_0xc567('0x4c')]){_0x2ecba2[_0xc567('0x4a')]=_['merge'](_0x2ecba2[_0xc567('0x4a')],{'$or':_[_0xc567('0x39')](_0x78b730,function(_0x1f475a){if(_0x1f475a[_0xc567('0x4d')]!==_0xc567('0x4e')){var _0x14ee1c={};_0x14ee1c[_0x1f475a[_0xc567('0x36')]]={'$like':'%'+_0xafc48e['query']['filter']+'%'};return _0x14ee1c;}})});}_0x2ecba2=_[_0xc567('0x4f')]({},_0x2ecba2,_0xafc48e['options']);var _0x140c84={'where':_0x2ecba2[_0xc567('0x4a')]};return db[_0xc567('0x3a')][_0xc567('0x30')](_0x140c84)[_0xc567('0x1e')](function(_0x5698c3){_0x2d4557[_0xc567('0x30')]=_0x5698c3;if(_0xafc48e[_0xc567('0x3f')][_0xc567('0x50')]){_0x2ecba2['include']=[{'all':!![]}];}return db[_0xc567('0x3a')][_0xc567('0x51')](_0x2ecba2);})[_0xc567('0x1e')](function(_0x595fd0){_0x2d4557[_0xc567('0x52')]=_0x595fd0;return _0x2d4557;})[_0xc567('0x1e')](respondWithFilteredResult(_0x541c21,_0x2ecba2))['catch'](handleError(_0x541c21,null));};exports['show']=function(_0x5507cd,_0x19827d){var _0x45bbd6={'raw':!![],'where':{'id':_0x5507cd[_0xc567('0x53')]['id']}},_0x42ddf9={};_0x42ddf9[_0xc567('0x3e')]=_[_0xc567('0x40')](db[_0xc567('0x3a')][_0xc567('0x3b')]);_0x42ddf9['query']=_[_0xc567('0x40')](_0x5507cd[_0xc567('0x3f')]);_0x42ddf9[_0xc567('0x41')]=_[_0xc567('0x42')](_0x42ddf9['model'],_0x42ddf9[_0xc567('0x3f')]);_0x45bbd6[_0xc567('0x44')]=_[_0xc567('0x42')](_0x42ddf9[_0xc567('0x3e')],qs[_0xc567('0x43')](_0x5507cd[_0xc567('0x3f')][_0xc567('0x43')]));_0x45bbd6['attributes']=_0x45bbd6['attributes']['length']?_0x45bbd6['attributes']:_0x42ddf9[_0xc567('0x3e')];if(_0x5507cd['query'][_0xc567('0x50')]){_0x45bbd6[_0xc567('0x54')]=[{'all':!![]}];}_0x45bbd6=_[_0xc567('0x4f')]({},_0x45bbd6,_0x5507cd[_0xc567('0x55')]);return db[_0xc567('0x3a')]['find'](_0x45bbd6)['then'](handleEntityNotFound(_0x19827d,null))[_0xc567('0x1e')](respondWithResult(_0x19827d,null))[_0xc567('0x56')](handleError(_0x19827d,null));};exports[_0xc567('0x57')]=function(_0x1e85db,_0x583496){return db[_0xc567('0x3a')][_0xc567('0x57')](_0x1e85db[_0xc567('0x58')],{})['then'](respondWithResult(_0x583496,0xc9))[_0xc567('0x56')](handleError(_0x583496,null));};exports[_0xc567('0x34')]=function(_0x2729e4,_0x59ab47){if(_0x2729e4[_0xc567('0x58')]['id']){delete _0x2729e4[_0xc567('0x58')]['id'];}return db['SmsMessage'][_0xc567('0x59')]({'where':{'id':_0x2729e4[_0xc567('0x53')]['id']}})[_0xc567('0x1e')](handleEntityNotFound(_0x59ab47,null))[_0xc567('0x1e')](saveUpdates(_0x2729e4['body'],null))['then'](respondWithResult(_0x59ab47,null))[_0xc567('0x56')](handleError(_0x59ab47,null));};exports[_0xc567('0x5a')]=function(_0x338cb6,_0x14c69c){return db[_0xc567('0x3a')][_0xc567('0x59')]({'where':{'id':_0x338cb6['params']['id']}})[_0xc567('0x1e')](handleEntityNotFound(_0x14c69c,null))[_0xc567('0x1e')](removeEntity(_0x14c69c,null))[_0xc567('0x56')](handleError(_0x14c69c,null));};exports['describe']=function(_0x2a7829,_0x28c50b){return db[_0xc567('0x3a')][_0xc567('0x5b')]()[_0xc567('0x1e')](respondWithResult(_0x28c50b,null))['catch'](handleError(_0x28c50b,null));};var interaction_log=require('../../config/logger')(_0xc567('0x5c'));exports[_0xc567('0x5d')]=function(_0x136c7a,_0x26bdfc,_0x35d29e){var _0x31d7ca={'agent':{},'channel':'sms'};if(_0x136c7a[_0xc567('0x58')]['id']){delete _0x136c7a['body']['id'];}_0x136c7a[_0xc567('0x58')][_0xc567('0x5e')]=!![];_0x136c7a[_0xc567('0x58')][_0xc567('0x5f')]=moment()[_0xc567('0x60')](_0xc567('0x61'));_0x136c7a['body']['UserId']=_0x136c7a[_0xc567('0x58')][_0xc567('0x62')]||_0x136c7a[_0xc567('0x63')]['id'];_0x31d7ca[_0xc567('0x64')]['id']=_0x136c7a[_0xc567('0x58')]['UserId'];return db[_0xc567('0x3a')][_0xc567('0x59')]({'where':{'id':_0x136c7a[_0xc567('0x53')]['id'],'UserId':null}})[_0xc567('0x1e')](handleEntityNotFound(_0x26bdfc,null))[_0xc567('0x1e')](saveUpdates(_0x136c7a[_0xc567('0x58')],null))['then'](function(_0x2731ac){if(_0x2731ac){_0x31d7ca[_0xc567('0x27')]=_0x2731ac['get']({'plain':!![]});return db[_0xc567('0x65')]['find']({'where':{'id':_0x2731ac[_0xc567('0x66')]}});}return null;})[_0xc567('0x1e')](handleEntityNotFound(_0x26bdfc,null))[_0xc567('0x1e')](function(_0x3cf6cb){if(_0x3cf6cb){return _0x3cf6cb['update']({'UserId':_0x136c7a[_0xc567('0x58')][_0xc567('0x62')],'read1stAt':_[_0xc567('0x67')](_0x3cf6cb[_0xc567('0x68')])?moment()[_0xc567('0x60')](_0xc567('0x61')):undefined});}return null;})[_0xc567('0x1e')](function(_0x524021){if(_0x524021){_0x31d7ca[_0xc567('0x69')]=_0x524021[_0xc567('0x6a')]({'plain':!![]});interaction_log[_0xc567('0x1f')](_0xc567('0x6b'),_0x136c7a[_0xc567('0x63')]['id'],_0x136c7a[_0xc567('0x63')][_0xc567('0x36')],_0x136c7a[_0xc567('0x63')][_0xc567('0x6c')],_0x31d7ca[_0xc567('0x69')]['id'],_0x136c7a[_0xc567('0x58')]?JSON[_0xc567('0x24')](_0x136c7a[_0xc567('0x58')]):_0xc567('0x6d'));return respondWithRpcPromise(_0xc567('0x6e'),_0xc567('0x6f'),_0x31d7ca);}return null;})[_0xc567('0x1e')](function(_0x36e2c0){var _0x159a0e=_0xc567('0x70')+_0x36e2c0[_0xc567('0x27')][_0xc567('0x71')];return db[_0xc567('0x72')][_0xc567('0x3f')](_0x159a0e,{'type':db['Sequelize'][_0xc567('0x73')][_0xc567('0x74')],'raw':!![]})[_0xc567('0x1e')](function(_0x3d9485){return _0x3d9485;});})[_0xc567('0x1e')](function(_0x474f42){if(_0x474f42){_0x31d7ca[_0xc567('0x27')]['contact']=_0x474f42[0x0];if(!_0x136c7a[_0xc567('0x58')]['UserId'])return;return db['User']['find']({'where':{'id':_0x136c7a[_0xc567('0x58')]['UserId'],'role':_0xc567('0x64')},'attributes':['id',_0xc567('0x36'),_0xc567('0x75'),'email','internal'],'raw':!![]});}return null;})[_0xc567('0x1e')](function(_0x5d204a){if(!_0x5d204a)return null;_0x31d7ca[_0xc567('0x27')][_0xc567('0x64')]=_0x5d204a;return _0x31d7ca;})[_0xc567('0x1e')](function(_0x268925){if(_0x268925){if(_0x136c7a[_0xc567('0x58')][_0xc567('0x76')]){_0x31d7ca['message'][_0xc567('0x77')]=util[_0xc567('0x60')](_0xc567('0x78'),_0x136c7a[_0xc567('0x63')][_0xc567('0x36')]);_0x31d7ca[_0xc567('0x27')][_0xc567('0x79')]=_0x31d7ca[_0xc567('0x79')];_0x31d7ca[_0xc567('0x27')][_0xc567('0x7a')]=_0xc567('0x5d');return respondWithRpcPromise(_0xc567('0x7b'),_0xc567('0x7b'),{'event':_0xc567('0x7c'),'message':_0x31d7ca['message']},client9002)[_0xc567('0x1e')](function(){return _0x31d7ca;});}return _0x31d7ca;}return null;})['then'](respondWithResult(_0x26bdfc,null))['catch'](handleError(_0x26bdfc,null));};var interaction_log=require('../../config/logger')(_0xc567('0x5c'));exports[_0xc567('0x33')]=function(_0x2e54a1,_0x58f397,_0x34fa69){var _0x501d0d={'agent':{},'channel':'sms'};if(_0x2e54a1[_0xc567('0x58')]['id']){delete _0x2e54a1['body']['id'];}_0x2e54a1[_0xc567('0x58')][_0xc567('0x62')]=_0x2e54a1[_0xc567('0x58')][_0xc567('0x62')]||_0x2e54a1[_0xc567('0x63')]['id'];_0x501d0d[_0xc567('0x64')]['id']=_0x2e54a1[_0xc567('0x58')][_0xc567('0x62')];return db['SmsMessage'][_0xc567('0x59')]({'where':{'id':_0x2e54a1['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x58f397,null))['then'](function(_0x2051b6){if(_0x2051b6){_0x501d0d[_0xc567('0x27')]=_0x2051b6[_0xc567('0x6a')]({'plain':!![]});return db[_0xc567('0x65')]['find']({'where':{'id':_0x2051b6[_0xc567('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x58f397,null))[_0xc567('0x1e')](function(_0x318761){if(_0x318761){_0x501d0d['interaction']=_0x318761[_0xc567('0x6a')]({'plain':!![]});interaction_log['info'](_0xc567('0x7d'),_0x2e54a1[_0xc567('0x63')]['id'],_0x2e54a1[_0xc567('0x63')][_0xc567('0x36')],_0x2e54a1['user'][_0xc567('0x6c')],_0x501d0d['interaction']['id'],_0x2e54a1[_0xc567('0x58')]?JSON[_0xc567('0x24')](_0x2e54a1[_0xc567('0x58')]):_0xc567('0x6d'));return respondWithRpcPromise(_0xc567('0x7e'),_0xc567('0x7f'),_0x501d0d);}return null;})['then'](function(_0x2e7210){var _0x2697d9=_0xc567('0x70')+_0x2e7210[_0xc567('0x27')][_0xc567('0x71')];return db[_0xc567('0x72')][_0xc567('0x3f')](_0x2697d9,{'type':db['Sequelize'][_0xc567('0x73')][_0xc567('0x74')],'raw':!![]})[_0xc567('0x1e')](function(_0x32f06e){return _0x32f06e;});})[_0xc567('0x1e')](function(_0x5f038d){if(_0x5f038d){_0x501d0d[_0xc567('0x27')][_0xc567('0x80')]=_0x5f038d[0x0];if(!_0x2e54a1['body'][_0xc567('0x62')])return;return db[_0xc567('0x81')][_0xc567('0x59')]({'where':{'id':_0x2e54a1[_0xc567('0x58')]['UserId'],'role':'agent'},'attributes':['id',_0xc567('0x36'),_0xc567('0x75'),_0xc567('0x82'),'internal'],'raw':!![]});}return null;})[_0xc567('0x1e')](function(_0x628be0){if(!_0x628be0)return null;_0x501d0d[_0xc567('0x27')][_0xc567('0x64')]=_0x628be0;return _0x501d0d;})[_0xc567('0x1e')](function(_0xeba68f){if(_0xeba68f){_0xeba68f['message']['interface']=util[_0xc567('0x60')](_0xc567('0x78'),_0x2e54a1[_0xc567('0x63')][_0xc567('0x36')]);_0xeba68f[_0xc567('0x27')][_0xc567('0x79')]=_0x501d0d['channel'];_0xeba68f[_0xc567('0x27')][_0xc567('0x7a')]=_0xc567('0x33');respondWithRpcPromise(_0xc567('0x7b'),'EventManager',{'event':_0xc567('0x83'),'message':_0xeba68f[_0xc567('0x27')]},client9002);return _0x501d0d;}return null;})[_0xc567('0x1e')](respondWithResult(_0x58f397,null))[_0xc567('0x56')](handleError(_0x58f397,null));};exports[_0xc567('0x2a')]=function(_0x4aa5df,_0x49c043,_0x31db7b){if(_0x4aa5df['body']['id']){delete _0x4aa5df['body']['id'];}var _0x1e500a;return db[_0xc567('0x3a')]['find']({'where':{'id':_0x4aa5df[_0xc567('0x53')]['id']}})[_0xc567('0x1e')](handleEntityNotFound(_0x49c043,null))[_0xc567('0x1e')](function(_0x59ca6e){if(_0x59ca6e){_0x1e500a=_0x59ca6e;return db['SmsAccount'][_0xc567('0x59')]({'where':{'id':_0x59ca6e[_0xc567('0x84')]}});}})['then'](handleEntityNotFound(_0x49c043,null))[_0xc567('0x1e')](function(_0x2b81d0){if(_0x2b81d0){logger[_0xc567('0x21')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc567('0x2a'),_0xc567('0x85'),_0x2b81d0['type'],util[_0xc567('0x86')](_0x4aa5df['body'],{'showHidden':![],'depth':null}));switch(_0x2b81d0[_0xc567('0x4d')]){case _0xc567('0x87'):if(_0x4aa5df[_0xc567('0x58')]['MessageSid']&&_0x4aa5df['body'][_0xc567('0x88')]===_0x1e500a[_0xc567('0x89')]){return _0x1e500a[_0xc567('0x34')]({'read':!![]});}else{logger[_0xc567('0x26')](_0xc567('0x8a'),_0xc567('0x2a'),_0xc567('0x87'),util[_0xc567('0x86')](_0x4aa5df[_0xc567('0x58')],{'showHidden':![],'depth':null}));}break;case _0xc567('0x8b'):if(_0x4aa5df['body'][_0xc567('0x8c')]&&_0x4aa5df[_0xc567('0x58')]['MessageUUID']===_0x1e500a[_0xc567('0x89')]&&_[_0xc567('0x8d')]([_0xc567('0x8e'),_0xc567('0x8f')],_0x4aa5df['body'][_0xc567('0x90')])>=0x0){return _0x1e500a[_0xc567('0x34')]({'read':!![]});}else{logger['error'](_0xc567('0x8a'),_0xc567('0x2a'),'plivio',util[_0xc567('0x86')](_0x4aa5df[_0xc567('0x58')],{'showHidden':![],'depth':null}));}break;case _0xc567('0x91'):var _0x278565=_0x4aa5df[_0xc567('0x58')][_0xc567('0x92')][0x0];if(_0x278565[_0xc567('0x2a')][_0xc567('0x93')]===_0xc567('0x94')){return _0x1e500a[_0xc567('0x34')]({'read':!![]});}else{logger[_0xc567('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xc567('0x2a'),_0xc567('0x91'),util['inspect'](_0x4aa5df[_0xc567('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x1e500a;}})[_0xc567('0x1e')](respondWithResult(_0x49c043,null))[_0xc567('0x56')](handleError(_0x49c043,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index a6f3ec1..4b91fb4 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 _0x0664=['hook','../../mysqldb','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x5d03c5,_0x485a89){var _0x147cb0=function(_0x2969bd){while(--_0x2969bd){_0x5d03c5['push'](_0x5d03c5['shift']());}};_0x147cb0(++_0x485a89);}(_0x0664,0xd3));var _0x4066=function(_0x46fe0c,_0x5f01fc){_0x46fe0c=_0x46fe0c-0x0;var _0x387df3=_0x0664[_0x46fe0c];return _0x387df3;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x4066('0x0'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x4066('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4066('0x2'),'afterDestroy':'remove'};function emitEvent(_0x75b771){return function(_0x367879,_0x5c775e,_0x178603){SmsMessageEvents[_0x4066('0x3')](_0x75b771+':'+_0x367879['id'],_0x367879);SmsMessageEvents[_0x4066('0x3')](_0x75b771,_0x367879);_0x178603(null);};}for(var e in events){if(events[_0x4066('0x4')](e)){var event=events[e];SmsMessage[_0x4066('0x5')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0xe2a2=['../../mysqldb','setMaxListeners','remove','emit','hasOwnProperty','hook','exports'];(function(_0x4a8efb,_0x249f7b){var _0xeb2436=function(_0x438d4f){while(--_0x438d4f){_0x4a8efb['push'](_0x4a8efb['shift']());}};_0xeb2436(++_0x249f7b);}(_0xe2a2,0xcb));var _0x2e2a=function(_0x5d3922,_0x1f12b2){_0x5d3922=_0x5d3922-0x0;var _0x436ce8=_0xe2a2[_0x5d3922];return _0x436ce8;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x2e2a('0x0'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x2e2a('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x2e2a('0x2')};function emitEvent(_0x925ed6){return function(_0x4667b8,_0x2db14a,_0x4c719f){SmsMessageEvents[_0x2e2a('0x3')](_0x925ed6+':'+_0x4667b8['id'],_0x4667b8);SmsMessageEvents['emit'](_0x925ed6,_0x4667b8);_0x4c719f(null);};}for(var e in events){if(events[_0x2e2a('0x4')](e)){var event=events[e];SmsMessage[_0x2e2a('0x5')](e,emitEvent(event));}}module[_0x2e2a('0x6')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 2db7d19..7bbce68 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 _0x8b29=['read','afterCreate','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','%s:%s','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','remote','application/json','IBSSO\x20','infobip','crypto','apiKey','login','text','timestamp','keys','length','createHash','md5','digest','signature=','/external/get/send.php?','csc','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','bandwidth','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','message','Bearer\x20','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','request-promise','path','../../config/environment','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','models','get','toLowerCase','direction','out','secret','isNil','findOne','then','catch','SmsAccount','SmsAccountId','type','twilio','authToken','phone','messages','/api/sms/messages/','/status?token=','token','update','error','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','GET','split','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport'];(function(_0x172948,_0x4262cc){var _0x4aeaa9=function(_0x5ec4b3){while(--_0x5ec4b3){_0x172948['push'](_0x172948['shift']());}};_0x4aeaa9(++_0x4262cc);}(_0x8b29,0xbe));var _0x98b2=function(_0x13a799,_0x55f253){_0x13a799=_0x13a799-0x0;var _0x37d687=_0x8b29[_0x13a799];return _0x37d687;};'use strict';var _=require(_0x98b2('0x0'));var util=require('util');var logger=require(_0x98b2('0x1'))(_0x98b2('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x98b2('0x3'));var fs=require('fs');var path=require(_0x98b2('0x4'));var rimraf=require('rimraf');var config=require(_0x98b2('0x5'));var attributes=require('./smsMessage.attributes');module[_0x98b2('0x6')]=function(_0xa3c251,_0xb0082c){return _0xa3c251[_0x98b2('0x7')](_0x98b2('0x8'),attributes,{'tableName':_0x98b2('0x9'),'paranoid':![],'indexes':[{'name':_0x98b2('0xa'),'fields':[_0x98b2('0xa')]},{'name':_0x98b2('0xb'),'fields':[_0x98b2('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x48a17e,_0x599bf5,_0x14e049){var _0x39617c=_0xa3c251[_0x98b2('0xd')];var _0x2d3751=_0x48a17e[_0x98b2('0xe')]({'plain':!![]});if(_0x2d3751['direction'][_0x98b2('0xf')]()==='in'||_0x2d3751[_0x98b2('0x10')]['toLowerCase']()===_0x98b2('0x11')&&!_0x2d3751[_0x98b2('0x12')]&&!_[_0x98b2('0x13')](_0x2d3751['UserId'])){_0x39617c['SmsInteraction'][_0x98b2('0x14')]({'where':{'id':_0x2d3751['SmsInteractionId']}})[_0x98b2('0x15')](function(_0x49b151){if(_0x49b151){_0x49b151['update']({'lastMsgAt':_0x2d3751['createdAt'],'lastMsgDirection':_0x2d3751[_0x98b2('0x10')][_0x98b2('0xf')]()});}})[_0x98b2('0x16')](function(_0x5ecea1){console['error'](_0x5ecea1);});}if(_0x2d3751['direction']===_0x98b2('0x11')&&!_0x2d3751[_0x98b2('0x12')]){var _0x145d65;_0x39617c[_0x98b2('0x17')]['find']({'where':{'id':_0x2d3751[_0x98b2('0x18')]},'raw':!![]})['then'](function(_0x989082){_0x145d65=_0x989082;if(_0x145d65&&_0x145d65['type']){switch(_0x145d65[_0x98b2('0x19')]){case _0x98b2('0x1a'):var _0x1928c8=require(_0x98b2('0x1a'));if(_0x145d65['accountSid']&&_0x145d65[_0x98b2('0x1b')]&&_0x145d65[_0x98b2('0x1c')]){var _0x5dfdf7=new _0x1928c8(_0x145d65['accountSid'],_0x145d65[_0x98b2('0x1b')]);_0x5dfdf7[_0x98b2('0x1d')]['create']({'body':_0x2d3751['body'],'to':_0x2d3751[_0x98b2('0x1c')],'from':_0x145d65[_0x98b2('0x1c')],'statusCallback':_0x145d65['remote']+_0x98b2('0x1e')+_0x2d3751['id']+_0x98b2('0x1f')+_0x145d65[_0x98b2('0x20')]})['then'](function(_0x2a5587){if(_0x2a5587['sid']){return _0x48a17e[_0x98b2('0x21')]({'messageId':_0x2a5587['sid']});}})['catch'](function(_0x7b6ebc){logger[_0x98b2('0x22')](_0x98b2('0x23'),'afterCreate','twilio',util['inspect'](_0x7b6ebc,{'showHidden':![],'depth':null}));});}else{logger[_0x98b2('0x22')](_0x98b2('0x23'),'afterCreate',_0x98b2('0x1a'),_0x98b2('0x24'));}break;case _0x98b2('0x25'):var _0x56efb6=_0x98b2('0x26');if(_0x145d65[_0x98b2('0x27')]&&_0x145d65[_0x98b2('0x28')]){var _0xb4c6c4={'recipient':[_0x2d3751[_0x98b2('0x1c')]],'message':_0x2d3751['body'],'message_type':_0x145d65[_0x98b2('0x29')]};if(_0x145d65['smsMethod']&&_0x145d65[_0x98b2('0x29')]!=='SI'){_0xb4c6c4[_0x98b2('0x2a')]=_0x145d65['phone'];}var _0x3ffec9={'url':_0x56efb6+_0x98b2('0x2b')+_0x145d65['username']+_0x98b2('0x2c')+_0x145d65[_0x98b2('0x28')],'method':_0x98b2('0x2d')};rp(_0x3ffec9)[_0x98b2('0x15')](function(_0x4aee2a){var _0x5ed399=_0x4aee2a[_0x98b2('0x2e')](';');var _0x2c40b4={'user_key':_0x5ed399[0x0],'session_key':_0x5ed399[0x1]};_0x3ffec9={'url':_0x56efb6+_0x98b2('0x2f'),'method':_0x98b2('0x30'),'headers':{'user_key':_0x2c40b4[_0x98b2('0x31')],'Session_key':_0x2c40b4[_0x98b2('0x32')]},'json':!![],'body':_0xb4c6c4};return rp(_0x3ffec9);})['then'](function(_0x448c8b){if(_0x448c8b[_0x98b2('0x33')]>=0x1){var _0x2b48b6={'messageId':_0x448c8b[_0x98b2('0x34')]};if(_0x145d65[_0x98b2('0x29')]!=='GP'||!_0x145d65[_0x98b2('0x35')]){_0x2b48b6[_0x98b2('0x36')]=!![];}return _0x48a17e[_0x98b2('0x21')](_0x2b48b6);}else{return logger[_0x98b2('0x22')](_0x98b2('0x23'),_0x98b2('0x37'),_0x98b2('0x25'),util[_0x98b2('0x38')](_0x448c8b,{'showHidden':![],'depth':null}));}})['catch'](function(_0x50532e){return logger[_0x98b2('0x22')](_0x98b2('0x23'),_0x98b2('0x37'),_0x98b2('0x25'),util[_0x98b2('0x38')](_0x50532e,{'showHidden':![],'depth':null}));});}else{logger[_0x98b2('0x22')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x98b2('0x37'),_0x98b2('0x25'),_0x98b2('0x39'));}break;case _0x98b2('0x3a'):if(_0x145d65['authToken']){var _0x40cc81={'recipient':_0x2d3751[_0x98b2('0x1c')],'message':_0x2d3751[_0x98b2('0xc')],'sender':_0x145d65[_0x98b2('0x3b')]||_0x145d65[_0x98b2('0x1c')],'authorization':_0x145d65[_0x98b2('0x1b')]};var _0x599bf5={'method':'POST','uri':_0x98b2('0x3c'),'body':_0x40cc81,'json':!![]};rp(_0x599bf5)['then'](function(_0x18e14e){var _0x5130c4={'messageId':_0x18e14e[_0x98b2('0x3d')]};if(!_0x145d65[_0x98b2('0x35')]){_0x5130c4['read']=!![];}return _0x48a17e['update'](_0x5130c4);})[_0x98b2('0x16')](function(_0x3e206d){logger[_0x98b2('0x22')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x98b2('0x37'),_0x98b2('0x3a'),util[_0x98b2('0x38')](_0x3e206d,{'showHidden':![],'depth':null}));});}else{logger[_0x98b2('0x22')](_0x98b2('0x23'),_0x98b2('0x37'),'connectel',_0x98b2('0x3e'));}break;case _0x98b2('0x3f'):if(_0x145d65[_0x98b2('0x27')]&&_0x145d65['password']){var _0x40cc81={'messages':[{'source':_0x98b2('0x40'),'to':_0x2d3751[_0x98b2('0x1c')],'body':_0x2d3751[_0x98b2('0xc')],'from':_0x145d65[_0x98b2('0x3b')]||_0x145d65[_0x98b2('0x1c')]}]};var _0x1e6c8f=util[_0x98b2('0x41')]('%s:%s',_0x145d65[_0x98b2('0x27')],_0x145d65[_0x98b2('0x28')]);var _0x599bf5={'method':_0x98b2('0x30'),'uri':_0x98b2('0x42'),'body':_0x40cc81,'headers':{'Authorization':util[_0x98b2('0x41')](_0x98b2('0x43'),new Buffer(_0x1e6c8f)[_0x98b2('0x44')](_0x98b2('0x45')))},'json':!![]};rp(_0x599bf5)['then'](function(_0x352ee0){if(_0x352ee0['http_code']>=0xc8&&_0x352ee0[_0x98b2('0x46')]<=0xce){if(_0x352ee0[_0x98b2('0x47')]&&_0x352ee0[_0x98b2('0x47')][_0x98b2('0x48')]>0x0){var _0x28234f=_[_0x98b2('0x49')](_0x352ee0['data'][_0x98b2('0x1d')]);var _0x44633c={'messageId':_0x28234f[_0x98b2('0x4a')]};if(!_0x145d65[_0x98b2('0x35')]){_0x44633c[_0x98b2('0x36')]=!![];}return _0x48a17e['update'](_0x44633c);}else{logger['error'](_0x98b2('0x23'),_0x98b2('0x37'),_0x98b2('0x4b'),util[_0x98b2('0x38')](_0x352ee0,{'showHidden':![],'depth':null}));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x98b2('0x4b'),util[_0x98b2('0x38')](_0x352ee0,{'showHidden':![],'depth':null}));}})[_0x98b2('0x16')](function(_0x31b155){logger[_0x98b2('0x22')](_0x98b2('0x23'),_0x98b2('0x37'),_0x98b2('0x4b'),util[_0x98b2('0x38')](_0x31b155,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x98b2('0x23'),'afterCreate',_0x98b2('0x4b'),_0x98b2('0x39'));}break;case _0x98b2('0x4c'):if(_0x145d65[_0x98b2('0x4d')]&&_0x145d65['authToken']){var _0x40cc81={'dst':_0x2d3751[_0x98b2('0x1c')],'text':_0x2d3751[_0x98b2('0xc')],'src':_0x145d65[_0x98b2('0x3b')]||_0x145d65[_0x98b2('0x1c')],'url':_0x145d65['remote']+_0x98b2('0x1e')+_0x2d3751['id']+_0x98b2('0x1f')+_0x145d65[_0x98b2('0x20')]};var _0x1e6c8f=util[_0x98b2('0x41')](_0x98b2('0x4e'),_0x145d65[_0x98b2('0x4d')],_0x145d65[_0x98b2('0x1b')]);var _0x599bf5={'method':_0x98b2('0x30'),'uri':util[_0x98b2('0x41')](_0x98b2('0x4f'),_0x145d65['authId']),'body':_0x40cc81,'headers':{'Authorization':util[_0x98b2('0x41')](_0x98b2('0x43'),new Buffer(_0x1e6c8f)['toString']('base64'))},'json':!![]};rp(_0x599bf5)[_0x98b2('0x15')](function(_0x4ae70f){var _0x20ddfd={'messageId':_0x4ae70f[_0x98b2('0x50')][0x0]};return _0x48a17e[_0x98b2('0x21')](_0x20ddfd);})[_0x98b2('0x16')](function(_0x3c041f){logger[_0x98b2('0x22')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x98b2('0x37'),'plivo',util['inspect'](_0x3c041f,{'showHidden':![],'depth':null}));});}else{logger[_0x98b2('0x22')](_0x98b2('0x23'),'afterCreate',_0x98b2('0x4c'),_0x98b2('0x51'));}break;case'infobip':if(_0x145d65[_0x98b2('0x27')]&&_0x145d65[_0x98b2('0x28')]){if(_0x145d65[_0x98b2('0x52')]){var _0x1c9533={'method':'POST','uri':_0x145d65['baseUrl']+_0x98b2('0x53'),'body':{'username':_0x145d65[_0x98b2('0x27')],'password':_0x145d65[_0x98b2('0x28')]},'json':!![]};return rp(_0x1c9533)[_0x98b2('0x15')](function(_0x3aceb2){var _0x5bfb14={'method':'POST','uri':_0x145d65[_0x98b2('0x52')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x145d65[_0x98b2('0x1c')],'destinations':[{'to':_0x2d3751[_0x98b2('0x1c')]}],'text':_0x2d3751[_0x98b2('0xc')],'notifyUrl':_0x145d65[_0x98b2('0x54')]+_0x98b2('0x1e')+_0x2d3751['id']+_0x98b2('0x1f')+_0x145d65['token'],'notifyContentType':_0x98b2('0x55'),'callbackData':_0x145d65[_0x98b2('0x1c')]+';'+_0x2d3751[_0x98b2('0xc')]}]},'headers':{'Authorization':_0x98b2('0x56')+_0x3aceb2[_0x98b2('0x20')]},'json':!![]};return rp(_0x5bfb14)[_0x98b2('0x15')](function(_0x5bc714){if(_0x5bc714['messages']){var _0x250df6={'messageId':_0x5bc714[_0x98b2('0x1d')][0x0][_0x98b2('0xa')]};if(!_0x145d65[_0x98b2('0x35')]){_0x250df6[_0x98b2('0x36')]=!![];}return _0x48a17e[_0x98b2('0x21')](_0x250df6);}else{return logger[_0x98b2('0x22')](_0x98b2('0x23'),'afterCreate',_0x98b2('0x57'),util[_0x98b2('0x38')](_0x5bc714,{'showHidden':![],'depth':null}));}});})[_0x98b2('0x16')](function(_0x48c4f4){return logger[_0x98b2('0x22')](_0x98b2('0x23'),_0x98b2('0x37'),'infobip',util[_0x98b2('0x38')](_0x48c4f4,{'showHidden':![],'depth':null}));});}else{logger[_0x98b2('0x22')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x98b2('0x37'),'infobip','Missing\x20parameters:\x20base_url');}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x98b2('0x37'),_0x98b2('0x57'),_0x98b2('0x39'));}break;case'csc':var _0x62af95=require(_0x98b2('0x58'));if(_0x145d65[_0x98b2('0x59')]){var _0x3b06f9={};_0x3b06f9[_0x98b2('0x5a')]=_0x145d65[_0x98b2('0x27')];_0x3b06f9[_0x98b2('0x1c')]=_0x2d3751['phone'];_0x3b06f9[_0x98b2('0x2a')]=_0x145d65['phone'];_0x3b06f9[_0x98b2('0x5b')]=_0x2d3751[_0x98b2('0xc')];_0x3b06f9[_0x98b2('0x5c')]=+new Date();var _0x30db52='';var _0x122e76='';var _0x10351d=Object[_0x98b2('0x5d')](_0x3b06f9);_0x10351d['sort']();for(var _0x5296ed=0x0;_0x5296ed<_0x10351d[_0x98b2('0x5e')];_0x5296ed++){if(_0x30db52!=''){_0x30db52+='&';}_0x30db52+=_0x10351d[_0x5296ed]+'='+encodeURIComponent(_0x3b06f9[_0x10351d[_0x5296ed]]);_0x122e76+=_0x3b06f9[_0x10351d[_0x5296ed]];}_0x122e76+=_0x145d65[_0x98b2('0x59')];_0x122e76=_0x62af95[_0x98b2('0x5f')](_0x98b2('0x60'))['update'](_0x122e76)[_0x98b2('0x61')]('hex');if(_0x30db52!==''){_0x30db52+='&';}_0x30db52+=_0x98b2('0x62')+_0x122e76;var _0x3ffec9={'method':'GET','uri':_0x145d65[_0x98b2('0x52')]+_0x98b2('0x63')+_0x30db52,'json':!![]};return rp(_0x3ffec9)[_0x98b2('0x15')](function(_0x6d224a){var _0x260cc4=Object[_0x98b2('0x5d')](_0x6d224a);if(_0x6d224a[_0x260cc4[0x0]][_0x98b2('0x22')]&&parseInt(_0x6d224a[_0x260cc4[0x0]][_0x98b2('0x22')])===0x0){var _0xc90317={'messageId':_0x6d224a[_0x260cc4[0x0]]['id_sms']};if(!_0x145d65[_0x98b2('0x35')]){_0xc90317[_0x98b2('0x36')]=!![];}return _0x48a17e[_0x98b2('0x21')](_0xc90317);}else{return logger[_0x98b2('0x22')](_0x98b2('0x23'),_0x98b2('0x37'),_0x98b2('0x64'),util['inspect'](_0x6d224a[_0x98b2('0x22')],{'showHidden':![],'depth':null}));}})[_0x98b2('0x16')](function(_0x31ea44){return logger[_0x98b2('0x22')](_0x98b2('0x23'),'afterCreate',_0x98b2('0x64'),util['inspect'](_0x31ea44,{'showHidden':![],'depth':null}));});}else{logger[_0x98b2('0x22')](_0x98b2('0x23'),_0x98b2('0x37'),'csc',_0x98b2('0x65'));}break;case _0x98b2('0x66'):if(_0x145d65['apiKey']){var _0x3b969a={'method':'POST','uri':_0x98b2('0x67'),'headers':{'Authorization':_0x145d65['apiKey']},'body':{'content':_0x2d3751[_0x98b2('0xc')],'to':[_0x2d3751[_0x98b2('0x1c')]],'from':_0x145d65[_0x98b2('0x1c')],'binary':![],'clientMessageId':_0x98b2('0x68'),'charset':_0x98b2('0x69')},'json':!![]};rp(_0x3b969a)[_0x98b2('0x15')](function(_0x522e81){if(!_0x522e81[_0x98b2('0x22')]){var _0x491e66={'messageId':_0x522e81[_0x98b2('0x1d')][0x0][_0x98b2('0x6a')]};if(!_0x145d65[_0x98b2('0x35')]){_0x491e66[_0x98b2('0x36')]=!![];}return _0x48a17e['update'](_0x491e66);}else{return logger[_0x98b2('0x22')](_0x98b2('0x23'),_0x98b2('0x37'),_0x98b2('0x66'),util[_0x98b2('0x38')](_0x522e81[_0x98b2('0x22')],{'showHidden':![],'depth':null}));}})[_0x98b2('0x16')](function(_0x2c7db5){return logger['error'](_0x98b2('0x23'),'afterCreate',_0x98b2('0x66'),util[_0x98b2('0x38')](_0x2c7db5,{'showHidden':![],'depth':null}));});}else{logger[_0x98b2('0x22')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x98b2('0x66'),_0x98b2('0x65'));}break;case'bandwidth':if(_0x145d65['username']&&_0x145d65[_0x98b2('0x28')]){var _0x1e6c8f=util[_0x98b2('0x41')](_0x98b2('0x4e'),_0x145d65[_0x98b2('0x27')],_0x145d65[_0x98b2('0x28')]);var _0x599bf5={'method':_0x98b2('0x30'),'uri':_0x98b2('0x6b')+_0x145d65[_0x98b2('0x6c')]+_0x98b2('0x6d'),'body':{'to':[_0x2d3751['phone']],'text':_0x2d3751['body'],'from':_0x145d65[_0x98b2('0x1c')],'applicationId':_0x145d65[_0x98b2('0x6e')]},'headers':{'Authorization':util[_0x98b2('0x41')](_0x98b2('0x43'),new Buffer(_0x1e6c8f)[_0x98b2('0x44')](_0x98b2('0x45')))},'json':!![]};rp(_0x599bf5)[_0x98b2('0x15')](function(_0x416467){if(_0x416467['id']){var _0x1444f7={'messageId':_0x416467['id']};return _0x48a17e[_0x98b2('0x21')](_0x1444f7);}else{logger[_0x98b2('0x22')](_0x98b2('0x23'),_0x98b2('0x37'),_0x98b2('0x6f'),util[_0x98b2('0x38')](_0x416467,{'showHidden':![],'depth':null}));}})[_0x98b2('0x16')](function(_0x290177){logger[_0x98b2('0x22')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x98b2('0x37'),_0x98b2('0x6f'),util[_0x98b2('0x38')](_0x290177,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x98b2('0x6f'),_0x98b2('0x39'));}break;case _0x98b2('0x70'):if(_0x145d65[_0x98b2('0x59')]){var _0x75bacb={};var _0x3ffec9={'method':'POST','uri':_0x98b2('0x71'),'headers':{'Authorization':'Bearer\x20'+_0x145d65[_0x98b2('0x59')],'Content-Type':_0x98b2('0x55')},'body':{'from':_0x145d65['phone'],'to':_0x2d3751[_0x98b2('0x1c')],'text':_0x2d3751[_0x98b2('0xc')]},'json':!![]};return rp(_0x3ffec9)['then'](function(_0x249192){if(_0x249192['code']==0xca){_0x75bacb[_0x98b2('0x72')]=_0x249192;var _0x3a8092={'method':_0x98b2('0x30'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x98b2('0x73')+_0x145d65[_0x98b2('0x59')],'Content-Type':_0x98b2('0x55')},'body':{'refid':_0x75bacb['message'][_0x98b2('0x74')]},'json':!![]};return rp(_0x3a8092)[_0x98b2('0x15')](function(_0x1fbb01){_0x75bacb[_0x98b2('0x75')]=_0x1fbb01;var _0x337f10={'messageId':_0x75bacb[_0x98b2('0x72')][_0x98b2('0x74')],'read':!![]};return _0x48a17e['update'](_0x337f10);});}else{return logger[_0x98b2('0x22')](_0x98b2('0x23'),_0x98b2('0x37'),'intelepeer',util[_0x98b2('0x38')](_0x249192,{'showHidden':![],'depth':null}));}})[_0x98b2('0x16')](function(_0x4c1a77){return logger[_0x98b2('0x22')](_0x98b2('0x23'),_0x98b2('0x37'),_0x98b2('0x70'),util[_0x98b2('0x38')](_0x4c1a77,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x98b2('0x23'),'afterCreate',_0x98b2('0x70'),_0x98b2('0x76'));}break;}}})[_0x98b2('0x77')](function(){_0x14e049();});}else{_0x14e049();}}},'charset':_0x98b2('0x78'),'collate':_0x98b2('0x79')});}; \ No newline at end of file +var _0x87df=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','SmsInteraction','findOne','then','createdAt','catch','error','secret','SmsAccount','SmsAccountId','type','twilio','accountSid','phone','authToken','messages','create','remote','/api/sms/messages/','/status?token=','token','update','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','&password=','GET','split','sms','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','connectel','senderString','POST','requestid','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','%s:%s','https://rest.clicksend.com/v3/sms/send','format','Basic\x20%s','toString','base64','http_code','data','head','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','application/json','IBSSO\x20','crypto','apiKey','login','timestamp','keys','length','createHash','md5','digest','hex','/external/get/send.php?','id_sms','csc','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','UTF-8','clickatell','bandwidth','https://messaging.bandwidth.com/api/v2/users/','/messages','intelepeer','Bearer\x20','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x92921,_0x10d441){var _0x26e7af=function(_0x2d3546){while(--_0x2d3546){_0x92921['push'](_0x92921['shift']());}};_0x26e7af(++_0x10d441);}(_0x87df,0x167));var _0xf87d=function(_0x57d867,_0x2ee50b){_0x57d867=_0x57d867-0x0;var _0x33d270=_0x87df[_0x57d867];return _0x33d270;};'use strict';var _=require(_0xf87d('0x0'));var util=require(_0xf87d('0x1'));var logger=require(_0xf87d('0x2'))(_0xf87d('0x3'));var moment=require(_0xf87d('0x4'));var BPromise=require(_0xf87d('0x5'));var rp=require(_0xf87d('0x6'));var fs=require('fs');var path=require(_0xf87d('0x7'));var rimraf=require(_0xf87d('0x8'));var config=require(_0xf87d('0x9'));var attributes=require('./smsMessage.attributes');module['exports']=function(_0x38045e,_0x40a15b){return _0x38045e['define'](_0xf87d('0xa'),attributes,{'tableName':_0xf87d('0xb'),'paranoid':![],'indexes':[{'name':_0xf87d('0xc'),'fields':[_0xf87d('0xc')]},{'name':_0xf87d('0xd'),'fields':[_0xf87d('0xe')],'type':_0xf87d('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2a5c12,_0x28d624,_0x36f89f){var _0x11bb9b=_0x38045e[_0xf87d('0x10')];var _0x6bb69=_0x2a5c12[_0xf87d('0x11')]({'plain':!![]});if(_0x6bb69[_0xf87d('0x12')]['toLowerCase']()==='in'||_0x6bb69[_0xf87d('0x12')][_0xf87d('0x13')]()===_0xf87d('0x14')&&!_0x6bb69['secret']&&!_[_0xf87d('0x15')](_0x6bb69[_0xf87d('0x16')])){_0x11bb9b[_0xf87d('0x17')][_0xf87d('0x18')]({'where':{'id':_0x6bb69['SmsInteractionId']}})[_0xf87d('0x19')](function(_0x2487f0){if(_0x2487f0){_0x2487f0['update']({'lastMsgAt':_0x6bb69[_0xf87d('0x1a')],'lastMsgDirection':_0x6bb69[_0xf87d('0x12')][_0xf87d('0x13')]()});}})[_0xf87d('0x1b')](function(_0x2b72fc){console[_0xf87d('0x1c')](_0x2b72fc);});}if(_0x6bb69[_0xf87d('0x12')]==='out'&&!_0x6bb69[_0xf87d('0x1d')]){var _0x19889a;_0x11bb9b[_0xf87d('0x1e')]['find']({'where':{'id':_0x6bb69[_0xf87d('0x1f')]},'raw':!![]})[_0xf87d('0x19')](function(_0x39461e){_0x19889a=_0x39461e;if(_0x19889a&&_0x19889a[_0xf87d('0x20')]){switch(_0x19889a[_0xf87d('0x20')]){case _0xf87d('0x21'):var _0x577b68=require(_0xf87d('0x21'));if(_0x19889a[_0xf87d('0x22')]&&_0x19889a['authToken']&&_0x19889a[_0xf87d('0x23')]){var _0x17b09e=new _0x577b68(_0x19889a[_0xf87d('0x22')],_0x19889a[_0xf87d('0x24')]);_0x17b09e[_0xf87d('0x25')][_0xf87d('0x26')]({'body':_0x6bb69[_0xf87d('0xe')],'to':_0x6bb69['phone'],'from':_0x19889a[_0xf87d('0x23')],'statusCallback':_0x19889a[_0xf87d('0x27')]+_0xf87d('0x28')+_0x6bb69['id']+_0xf87d('0x29')+_0x19889a[_0xf87d('0x2a')]})[_0xf87d('0x19')](function(_0x5ebd5d){if(_0x5ebd5d['sid']){return _0x2a5c12[_0xf87d('0x2b')]({'messageId':_0x5ebd5d[_0xf87d('0x2c')]});}})[_0xf87d('0x1b')](function(_0x2ef1c3){logger['error'](_0xf87d('0x2d'),_0xf87d('0x2e'),_0xf87d('0x21'),util[_0xf87d('0x2f')](_0x2ef1c3,{'showHidden':![],'depth':null}));});}else{logger[_0xf87d('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf87d('0x2e'),_0xf87d('0x21'),_0xf87d('0x30'));}break;case _0xf87d('0x31'):var _0x3a0b95=_0xf87d('0x32');if(_0x19889a[_0xf87d('0x33')]&&_0x19889a[_0xf87d('0x34')]){var _0x36203c={'recipient':[_0x6bb69[_0xf87d('0x23')]],'message':_0x6bb69[_0xf87d('0xe')],'message_type':_0x19889a['smsMethod']};if(_0x19889a[_0xf87d('0x35')]&&_0x19889a[_0xf87d('0x35')]!=='SI'){_0x36203c['sender']=_0x19889a[_0xf87d('0x23')];}var _0x201b0f={'url':_0x3a0b95+'login?username='+_0x19889a[_0xf87d('0x33')]+_0xf87d('0x36')+_0x19889a['password'],'method':_0xf87d('0x37')};rp(_0x201b0f)[_0xf87d('0x19')](function(_0x1c7e92){var _0x4779ca=_0x1c7e92[_0xf87d('0x38')](';');var _0xad213f={'user_key':_0x4779ca[0x0],'session_key':_0x4779ca[0x1]};_0x201b0f={'url':_0x3a0b95+_0xf87d('0x39'),'method':'POST','headers':{'user_key':_0xad213f[_0xf87d('0x3a')],'Session_key':_0xad213f[_0xf87d('0x3b')]},'json':!![],'body':_0x36203c};return rp(_0x201b0f);})[_0xf87d('0x19')](function(_0x49a988){if(_0x49a988[_0xf87d('0x3c')]>=0x1){var _0x2e872={'messageId':_0x49a988[_0xf87d('0x3d')]};if(_0x19889a[_0xf87d('0x35')]!=='GP'||!_0x19889a[_0xf87d('0x3e')]){_0x2e872[_0xf87d('0x3f')]=!![];}return _0x2a5c12[_0xf87d('0x2b')](_0x2e872);}else{return logger[_0xf87d('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','skebby',util[_0xf87d('0x2f')](_0x49a988,{'showHidden':![],'depth':null}));}})['catch'](function(_0x13bb9f){return logger[_0xf87d('0x1c')](_0xf87d('0x2d'),_0xf87d('0x2e'),_0xf87d('0x31'),util[_0xf87d('0x2f')](_0x13bb9f,{'showHidden':![],'depth':null}));});}else{logger[_0xf87d('0x1c')](_0xf87d('0x2d'),'afterCreate',_0xf87d('0x31'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xf87d('0x40'):if(_0x19889a[_0xf87d('0x24')]){var _0x71fe4a={'recipient':_0x6bb69[_0xf87d('0x23')],'message':_0x6bb69[_0xf87d('0xe')],'sender':_0x19889a[_0xf87d('0x41')]||_0x19889a[_0xf87d('0x23')],'authorization':_0x19889a[_0xf87d('0x24')]};var _0x28d624={'method':_0xf87d('0x42'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x71fe4a,'json':!![]};rp(_0x28d624)[_0xf87d('0x19')](function(_0x5ee135){var _0x5c0cf6={'messageId':_0x5ee135[_0xf87d('0x43')]};if(!_0x19889a[_0xf87d('0x3e')]){_0x5c0cf6[_0xf87d('0x3f')]=!![];}return _0x2a5c12[_0xf87d('0x2b')](_0x5c0cf6);})[_0xf87d('0x1b')](function(_0x42ac7a){logger[_0xf87d('0x1c')](_0xf87d('0x2d'),_0xf87d('0x2e'),_0xf87d('0x40'),util[_0xf87d('0x2f')](_0x42ac7a,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf87d('0x2d'),_0xf87d('0x2e'),_0xf87d('0x40'),_0xf87d('0x44'));}break;case'clicksend':if(_0x19889a[_0xf87d('0x33')]&&_0x19889a[_0xf87d('0x34')]){var _0x71fe4a={'messages':[{'source':_0xf87d('0x45'),'to':_0x6bb69['phone'],'body':_0x6bb69[_0xf87d('0xe')],'from':_0x19889a[_0xf87d('0x41')]||_0x19889a[_0xf87d('0x23')]}]};var _0xb0eceb=util['format'](_0xf87d('0x46'),_0x19889a[_0xf87d('0x33')],_0x19889a[_0xf87d('0x34')]);var _0x28d624={'method':'POST','uri':_0xf87d('0x47'),'body':_0x71fe4a,'headers':{'Authorization':util[_0xf87d('0x48')](_0xf87d('0x49'),new Buffer(_0xb0eceb)[_0xf87d('0x4a')](_0xf87d('0x4b')))},'json':!![]};rp(_0x28d624)[_0xf87d('0x19')](function(_0x51f199){if(_0x51f199[_0xf87d('0x4c')]>=0xc8&&_0x51f199[_0xf87d('0x4c')]<=0xce){if(_0x51f199[_0xf87d('0x4d')]&&_0x51f199[_0xf87d('0x4d')]['queued_count']>0x0){var _0x5a07bb=_[_0xf87d('0x4e')](_0x51f199[_0xf87d('0x4d')]['messages']);var _0x280b97={'messageId':_0x5a07bb[_0xf87d('0x4f')]};if(!_0x19889a['deliveryReport']){_0x280b97[_0xf87d('0x3f')]=!![];}return _0x2a5c12[_0xf87d('0x2b')](_0x280b97);}else{logger[_0xf87d('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf87d('0x2e'),_0xf87d('0x50'),util[_0xf87d('0x2f')](_0x51f199,{'showHidden':![],'depth':null}));}}else{logger[_0xf87d('0x1c')](_0xf87d('0x2d'),_0xf87d('0x2e'),'clickSend',util[_0xf87d('0x2f')](_0x51f199,{'showHidden':![],'depth':null}));}})[_0xf87d('0x1b')](function(_0x103327){logger[_0xf87d('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf87d('0x2e'),_0xf87d('0x50'),util['inspect'](_0x103327,{'showHidden':![],'depth':null}));});}else{logger[_0xf87d('0x1c')](_0xf87d('0x2d'),_0xf87d('0x2e'),_0xf87d('0x50'),_0xf87d('0x51'));}break;case _0xf87d('0x52'):if(_0x19889a[_0xf87d('0x53')]&&_0x19889a[_0xf87d('0x24')]){var _0x71fe4a={'dst':_0x6bb69[_0xf87d('0x23')],'text':_0x6bb69['body'],'src':_0x19889a['senderString']||_0x19889a[_0xf87d('0x23')],'url':_0x19889a[_0xf87d('0x27')]+'/api/sms/messages/'+_0x6bb69['id']+_0xf87d('0x29')+_0x19889a['token']};var _0xb0eceb=util[_0xf87d('0x48')]('%s:%s',_0x19889a[_0xf87d('0x53')],_0x19889a['authToken']);var _0x28d624={'method':_0xf87d('0x42'),'uri':util['format'](_0xf87d('0x54'),_0x19889a[_0xf87d('0x53')]),'body':_0x71fe4a,'headers':{'Authorization':util['format'](_0xf87d('0x49'),new Buffer(_0xb0eceb)['toString'](_0xf87d('0x4b')))},'json':!![]};rp(_0x28d624)[_0xf87d('0x19')](function(_0x4b555a){var _0x46f540={'messageId':_0x4b555a[_0xf87d('0x55')][0x0]};return _0x2a5c12[_0xf87d('0x2b')](_0x46f540);})[_0xf87d('0x1b')](function(_0x1546b8){logger[_0xf87d('0x1c')](_0xf87d('0x2d'),_0xf87d('0x2e'),_0xf87d('0x52'),util[_0xf87d('0x2f')](_0x1546b8,{'showHidden':![],'depth':null}));});}else{logger[_0xf87d('0x1c')](_0xf87d('0x2d'),_0xf87d('0x2e'),_0xf87d('0x52'),_0xf87d('0x56'));}break;case _0xf87d('0x57'):if(_0x19889a[_0xf87d('0x33')]&&_0x19889a[_0xf87d('0x34')]){if(_0x19889a[_0xf87d('0x58')]){var _0x4327d2={'method':_0xf87d('0x42'),'uri':_0x19889a[_0xf87d('0x58')]+'/auth/1/session','body':{'username':_0x19889a['username'],'password':_0x19889a[_0xf87d('0x34')]},'json':!![]};return rp(_0x4327d2)['then'](function(_0x31fb5f){var _0xdabb16={'method':_0xf87d('0x42'),'uri':_0x19889a[_0xf87d('0x58')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x19889a[_0xf87d('0x23')],'destinations':[{'to':_0x6bb69['phone']}],'text':_0x6bb69[_0xf87d('0xe')],'notifyUrl':_0x19889a['remote']+_0xf87d('0x28')+_0x6bb69['id']+_0xf87d('0x29')+_0x19889a[_0xf87d('0x2a')],'notifyContentType':_0xf87d('0x59'),'callbackData':_0x19889a[_0xf87d('0x23')]+';'+_0x6bb69['body']}]},'headers':{'Authorization':_0xf87d('0x5a')+_0x31fb5f[_0xf87d('0x2a')]},'json':!![]};return rp(_0xdabb16)['then'](function(_0x36e490){if(_0x36e490['messages']){var _0x165803={'messageId':_0x36e490[_0xf87d('0x25')][0x0][_0xf87d('0xc')]};if(!_0x19889a[_0xf87d('0x3e')]){_0x165803[_0xf87d('0x3f')]=!![];}return _0x2a5c12[_0xf87d('0x2b')](_0x165803);}else{return logger['error'](_0xf87d('0x2d'),_0xf87d('0x2e'),'infobip',util[_0xf87d('0x2f')](_0x36e490,{'showHidden':![],'depth':null}));}});})[_0xf87d('0x1b')](function(_0x15a096){return logger[_0xf87d('0x1c')](_0xf87d('0x2d'),_0xf87d('0x2e'),'infobip',util[_0xf87d('0x2f')](_0x15a096,{'showHidden':![],'depth':null}));});}else{logger[_0xf87d('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf87d('0x2e'),_0xf87d('0x57'),'Missing\x20parameters:\x20base_url');}}else{logger[_0xf87d('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf87d('0x2e'),_0xf87d('0x57'),'Missing\x20parameters:\x20username,\x20password');}break;case'csc':var _0xf8ce4c=require(_0xf87d('0x5b'));if(_0x19889a[_0xf87d('0x5c')]){var _0x328e71={};_0x328e71[_0xf87d('0x5d')]=_0x19889a[_0xf87d('0x33')];_0x328e71['phone']=_0x6bb69[_0xf87d('0x23')];_0x328e71['sender']=_0x19889a[_0xf87d('0x23')];_0x328e71['text']=_0x6bb69[_0xf87d('0xe')];_0x328e71[_0xf87d('0x5e')]=+new Date();var _0x105f6c='';var _0x43bd99='';var _0x530844=Object[_0xf87d('0x5f')](_0x328e71);_0x530844['sort']();for(var _0x4973c6=0x0;_0x4973c6<_0x530844[_0xf87d('0x60')];_0x4973c6++){if(_0x105f6c!=''){_0x105f6c+='&';}_0x105f6c+=_0x530844[_0x4973c6]+'='+encodeURIComponent(_0x328e71[_0x530844[_0x4973c6]]);_0x43bd99+=_0x328e71[_0x530844[_0x4973c6]];}_0x43bd99+=_0x19889a[_0xf87d('0x5c')];_0x43bd99=_0xf8ce4c[_0xf87d('0x61')](_0xf87d('0x62'))['update'](_0x43bd99)[_0xf87d('0x63')](_0xf87d('0x64'));if(_0x105f6c!==''){_0x105f6c+='&';}_0x105f6c+='signature='+_0x43bd99;var _0x201b0f={'method':_0xf87d('0x37'),'uri':_0x19889a[_0xf87d('0x58')]+_0xf87d('0x65')+_0x105f6c,'json':!![]};return rp(_0x201b0f)[_0xf87d('0x19')](function(_0x265076){var _0xe8ecb0=Object[_0xf87d('0x5f')](_0x265076);if(_0x265076[_0xe8ecb0[0x0]][_0xf87d('0x1c')]&&parseInt(_0x265076[_0xe8ecb0[0x0]]['error'])===0x0){var _0x32dda7={'messageId':_0x265076[_0xe8ecb0[0x0]][_0xf87d('0x66')]};if(!_0x19889a[_0xf87d('0x3e')]){_0x32dda7[_0xf87d('0x3f')]=!![];}return _0x2a5c12[_0xf87d('0x2b')](_0x32dda7);}else{return logger[_0xf87d('0x1c')](_0xf87d('0x2d'),'afterCreate','csc',util['inspect'](_0x265076['error'],{'showHidden':![],'depth':null}));}})[_0xf87d('0x1b')](function(_0x46d8cc){return logger[_0xf87d('0x1c')](_0xf87d('0x2d'),_0xf87d('0x2e'),_0xf87d('0x67'),util[_0xf87d('0x2f')](_0x46d8cc,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf87d('0x2d'),'afterCreate',_0xf87d('0x67'),_0xf87d('0x68'));}break;case'clickatell':if(_0x19889a[_0xf87d('0x5c')]){var _0x48ebba={'method':_0xf87d('0x42'),'uri':_0xf87d('0x69'),'headers':{'Authorization':_0x19889a['apiKey']},'body':{'content':_0x6bb69[_0xf87d('0xe')],'to':[_0x6bb69[_0xf87d('0x23')]],'from':_0x19889a[_0xf87d('0x23')],'binary':![],'clientMessageId':'uuid','charset':_0xf87d('0x6a')},'json':!![]};rp(_0x48ebba)[_0xf87d('0x19')](function(_0x563ef4){if(!_0x563ef4['error']){var _0x381350={'messageId':_0x563ef4[_0xf87d('0x25')][0x0]['apiMessageId']};if(!_0x19889a[_0xf87d('0x3e')]){_0x381350[_0xf87d('0x3f')]=!![];}return _0x2a5c12['update'](_0x381350);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf87d('0x2e'),_0xf87d('0x6b'),util['inspect'](_0x563ef4['error'],{'showHidden':![],'depth':null}));}})[_0xf87d('0x1b')](function(_0x2b87f9){return logger[_0xf87d('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf87d('0x2e'),_0xf87d('0x6b'),util['inspect'](_0x2b87f9,{'showHidden':![],'depth':null}));});}else{logger[_0xf87d('0x1c')](_0xf87d('0x2d'),'afterCreate',_0xf87d('0x6b'),_0xf87d('0x68'));}break;case _0xf87d('0x6c'):if(_0x19889a[_0xf87d('0x33')]&&_0x19889a[_0xf87d('0x34')]){var _0xb0eceb=util[_0xf87d('0x48')](_0xf87d('0x46'),_0x19889a[_0xf87d('0x33')],_0x19889a[_0xf87d('0x34')]);var _0x28d624={'method':_0xf87d('0x42'),'uri':_0xf87d('0x6d')+_0x19889a['accountId']+_0xf87d('0x6e'),'body':{'to':[_0x6bb69[_0xf87d('0x23')]],'text':_0x6bb69['body'],'from':_0x19889a['phone'],'applicationId':_0x19889a['applicationId']},'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0xb0eceb)[_0xf87d('0x4a')](_0xf87d('0x4b')))},'json':!![]};rp(_0x28d624)['then'](function(_0x39e70d){if(_0x39e70d['id']){var _0x58b74f={'messageId':_0x39e70d['id']};return _0x2a5c12[_0xf87d('0x2b')](_0x58b74f);}else{logger[_0xf87d('0x1c')](_0xf87d('0x2d'),_0xf87d('0x2e'),_0xf87d('0x6c'),util[_0xf87d('0x2f')](_0x39e70d,{'showHidden':![],'depth':null}));}})[_0xf87d('0x1b')](function(_0x5c4c5d){logger[_0xf87d('0x1c')](_0xf87d('0x2d'),_0xf87d('0x2e'),_0xf87d('0x6c'),util[_0xf87d('0x2f')](_0x5c4c5d,{'showHidden':![],'depth':null}));});}else{logger[_0xf87d('0x1c')](_0xf87d('0x2d'),_0xf87d('0x2e'),_0xf87d('0x6c'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xf87d('0x6f'):if(_0x19889a[_0xf87d('0x5c')]){var _0x1842b0={};var _0x201b0f={'method':_0xf87d('0x42'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0xf87d('0x70')+_0x19889a[_0xf87d('0x5c')],'Content-Type':_0xf87d('0x59')},'body':{'from':_0x19889a['phone'],'to':_0x6bb69[_0xf87d('0x23')],'text':_0x6bb69[_0xf87d('0xe')]},'json':!![]};return rp(_0x201b0f)[_0xf87d('0x19')](function(_0x11b132){if(_0x11b132['code']==0xca){_0x1842b0[_0xf87d('0x71')]=_0x11b132;var _0xfef9d1={'method':_0xf87d('0x42'),'uri':_0xf87d('0x72'),'headers':{'Authorization':_0xf87d('0x70')+_0x19889a[_0xf87d('0x5c')],'Content-Type':_0xf87d('0x59')},'body':{'refid':_0x1842b0[_0xf87d('0x71')][_0xf87d('0x73')]},'json':!![]};return rp(_0xfef9d1)[_0xf87d('0x19')](function(_0x41c789){_0x1842b0[_0xf87d('0x74')]=_0x41c789;var _0x2e223c={'messageId':_0x1842b0['message'][_0xf87d('0x73')],'read':!![]};return _0x2a5c12[_0xf87d('0x2b')](_0x2e223c);});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf87d('0x2e'),'intelepeer',util[_0xf87d('0x2f')](_0x11b132,{'showHidden':![],'depth':null}));}})['catch'](function(_0x420ee5){return logger[_0xf87d('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xf87d('0x6f'),util[_0xf87d('0x2f')](_0x420ee5,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0xf87d('0x2d'),_0xf87d('0x2e'),_0xf87d('0x6f'),_0xf87d('0x75'));}break;}}})['finally'](function(){_0x36f89f();});}else{_0x36f89f();}}},'charset':_0xf87d('0x76'),'collate':_0xf87d('0x77')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 5ccdbd2..1eae0eb 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 _0x41ce=['CreateSmsMessage','SmsMessage','create','body','options','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x118ced,_0x29c3ea){var _0x59dea9=function(_0x3bd463){while(--_0x3bd463){_0x118ced['push'](_0x118ced['shift']());}};_0x59dea9(++_0x29c3ea);}(_0x41ce,0x16e));var _0xe41c=function(_0x2df252,_0x178d25){_0x2df252=_0x2df252-0x0;var _0x34307c=_0x41ce[_0x2df252];return _0x34307c;};'use strict';var _=require(_0xe41c('0x0'));var util=require(_0xe41c('0x1'));var moment=require(_0xe41c('0x2'));var BPromise=require(_0xe41c('0x3'));var rs=require(_0xe41c('0x4'));var fs=require('fs');var Redis=require(_0xe41c('0x5'));var db=require(_0xe41c('0x6'))['db'];var utils=require(_0xe41c('0x7'));var logger=require(_0xe41c('0x8'))(_0xe41c('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe41c('0xa')][_0xe41c('0xb')]({'port':0x232a});config[_0xe41c('0xc')]=_[_0xe41c('0xd')](config[_0xe41c('0xc')],{'host':_0xe41c('0xe'),'port':0x18eb});var socket=require(_0xe41c('0xf'))(new Redis(config[_0xe41c('0xc')]));require(_0xe41c('0x10'))[_0xe41c('0x11')](socket);function respondWithRpcPromise(_0x2a69f6,_0x59015f,_0x3ae8e3){return new BPromise(function(_0x556826,_0x10f342){return client[_0xe41c('0x12')](_0x2a69f6,_0x3ae8e3)[_0xe41c('0x13')](function(_0x5560b){logger[_0xe41c('0x14')](_0xe41c('0x15'),_0x59015f,_0xe41c('0x16'));logger[_0xe41c('0x17')](_0xe41c('0x18'),_0x59015f,'request\x20sent',JSON['stringify'](_0x5560b));if(_0x5560b[_0xe41c('0x19')]){if(_0x5560b['error'][_0xe41c('0x1a')]===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x59015f,_0x5560b['error'][_0xe41c('0x1b')]);return _0x10f342(_0x5560b['error'][_0xe41c('0x1b')]);}logger[_0xe41c('0x19')](_0xe41c('0x15'),_0x59015f,_0x5560b['error']['message']);return _0x556826(_0x5560b['error'][_0xe41c('0x1b')]);}else{logger['info'](_0xe41c('0x15'),_0x59015f,_0xe41c('0x16'));_0x556826(_0x5560b[_0xe41c('0x1c')][_0xe41c('0x1b')]);}})[_0xe41c('0x1d')](function(_0x598281){logger[_0xe41c('0x19')]('SmsMessage,\x20%s,\x20%s',_0x59015f,_0x598281);_0x10f342(_0x598281);});});}exports[_0xe41c('0x1e')]=function(_0x5d2f25){var _0x12afb2=this;return new Promise(function(_0x48c32c,_0x5931a5){return db[_0xe41c('0x1f')][_0xe41c('0x20')](_0x5d2f25[_0xe41c('0x21')],{'raw':_0x5d2f25[_0xe41c('0x22')]?_0x5d2f25[_0xe41c('0x22')]['raw']===undefined?!![]:![]:!![]})[_0xe41c('0x13')](function(_0x54d22f){logger[_0xe41c('0x14')]('CreateSmsMessage',_0x5d2f25);logger['debug'](_0xe41c('0x1e'),_0x5d2f25,JSON[_0xe41c('0x23')](_0x54d22f));_0x48c32c(_0x54d22f);})[_0xe41c('0x1d')](function(_0xfcca70){logger[_0xe41c('0x19')](_0xe41c('0x1e'),_0xfcca70[_0xe41c('0x1b')],_0x5d2f25);_0x5931a5(_0x12afb2['error'](0x1f4,_0xfcca70[_0xe41c('0x1b')]));});});}; \ No newline at end of file +var _0x09b8=['redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','SmsMessage,\x20%s,\x20%s','message','result','catch','CreateSmsMessage','SmsMessage','create','body','options','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http'];(function(_0x517985,_0x5b4d98){var _0x3e5bb9=function(_0x5e97e2){while(--_0x5e97e2){_0x517985['push'](_0x517985['shift']());}};_0x3e5bb9(++_0x5b4d98);}(_0x09b8,0xcc));var _0x809b=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x09b8[_0x525c7b];return _0x27b33e;};'use strict';var _=require(_0x809b('0x0'));var util=require(_0x809b('0x1'));var moment=require(_0x809b('0x2'));var BPromise=require(_0x809b('0x3'));var rs=require(_0x809b('0x4'));var fs=require('fs');var Redis=require(_0x809b('0x5'));var db=require(_0x809b('0x6'))['db'];var utils=require(_0x809b('0x7'));var logger=require('../../config/logger')(_0x809b('0x8'));var config=require('../../config/environment');var jayson=require(_0x809b('0x9'));var client=jayson[_0x809b('0xa')][_0x809b('0xb')]({'port':0x232a});config[_0x809b('0xc')]=_[_0x809b('0xd')](config[_0x809b('0xc')],{'host':_0x809b('0xe'),'port':0x18eb});var socket=require(_0x809b('0xf'))(new Redis(config[_0x809b('0xc')]));require(_0x809b('0x10'))[_0x809b('0x11')](socket);function respondWithRpcPromise(_0x57bbad,_0x2b3fbe,_0x15348a){return new BPromise(function(_0xf5befe,_0x276619){return client[_0x809b('0x12')](_0x57bbad,_0x15348a)[_0x809b('0x13')](function(_0x5c284d){logger[_0x809b('0x14')]('SmsMessage,\x20%s,\x20%s',_0x2b3fbe,_0x809b('0x15'));logger[_0x809b('0x16')](_0x809b('0x17'),_0x2b3fbe,'request\x20sent',JSON[_0x809b('0x18')](_0x5c284d));if(_0x5c284d['error']){if(_0x5c284d['error'][_0x809b('0x19')]===0x1f4){logger[_0x809b('0x1a')](_0x809b('0x1b'),_0x2b3fbe,_0x5c284d['error'][_0x809b('0x1c')]);return _0x276619(_0x5c284d[_0x809b('0x1a')][_0x809b('0x1c')]);}logger[_0x809b('0x1a')]('SmsMessage,\x20%s,\x20%s',_0x2b3fbe,_0x5c284d[_0x809b('0x1a')][_0x809b('0x1c')]);return _0xf5befe(_0x5c284d[_0x809b('0x1a')]['message']);}else{logger[_0x809b('0x14')]('SmsMessage,\x20%s,\x20%s',_0x2b3fbe,_0x809b('0x15'));_0xf5befe(_0x5c284d[_0x809b('0x1d')][_0x809b('0x1c')]);}})[_0x809b('0x1e')](function(_0x1450e8){logger[_0x809b('0x1a')](_0x809b('0x1b'),_0x2b3fbe,_0x1450e8);_0x276619(_0x1450e8);});});}exports[_0x809b('0x1f')]=function(_0x148190){var _0x51bb0e=this;return new Promise(function(_0x4a7ca4,_0x191c28){return db[_0x809b('0x20')][_0x809b('0x21')](_0x148190[_0x809b('0x22')],{'raw':_0x148190['options']?_0x148190[_0x809b('0x23')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x34cecb){logger[_0x809b('0x14')](_0x809b('0x1f'),_0x148190);logger[_0x809b('0x16')](_0x809b('0x1f'),_0x148190,JSON['stringify'](_0x34cecb));_0x4a7ca4(_0x34cecb);})['catch'](function(_0x3bbf93){logger[_0x809b('0x1a')](_0x809b('0x1f'),_0x3bbf93[_0x809b('0x1c')],_0x148190);_0x191c28(_0x51bb0e[_0x809b('0x1a')](0x1f4,_0x3bbf93[_0x809b('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 0f78901..3633ca4 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 _0xbc9d=['save','remove','update','removeListener','register','length','./smsMessage.events'];(function(_0x35d573,_0x1cf182){var _0x47b9e4=function(_0x29047b){while(--_0x29047b){_0x35d573['push'](_0x35d573['shift']());}};_0x47b9e4(++_0x1cf182);}(_0xbc9d,0x99));var _0xdbc9=function(_0x4ff25d,_0x10e26e){_0x4ff25d=_0x4ff25d-0x0;var _0x4e7e85=_0xbc9d[_0x4ff25d];return _0x4e7e85;};'use strict';var SmsMessageEvents=require(_0xdbc9('0x0'));var events=[_0xdbc9('0x1'),_0xdbc9('0x2'),_0xdbc9('0x3')];function createListener(_0x164f39,_0x55e3c2){return function(_0x2d64b9){_0x55e3c2['emit'](_0x164f39,_0x2d64b9);};}function removeListener(_0x3a326c,_0x24420a){return function(){SmsMessageEvents[_0xdbc9('0x4')](_0x3a326c,_0x24420a);};}exports[_0xdbc9('0x5')]=function(_0x237959){for(var _0x21fdc0=0x0,_0x20b0dd=events[_0xdbc9('0x6')];_0x21fdc0<_0x20b0dd;_0x21fdc0++){var _0x8b9f44=events[_0x21fdc0];var _0x46c50d=createListener('smsMessage:'+_0x8b9f44,_0x237959);SmsMessageEvents['on'](_0x8b9f44,_0x46c50d);}}; \ No newline at end of file +var _0x597d=['removeListener','register','length','smsMessage:','save','update','emit'];(function(_0x5eb7a4,_0x32b3d3){var _0x4e0d1d=function(_0x3c7df5){while(--_0x3c7df5){_0x5eb7a4['push'](_0x5eb7a4['shift']());}};_0x4e0d1d(++_0x32b3d3);}(_0x597d,0x15b));var _0xd597=function(_0x39aada,_0x8c1216){_0x39aada=_0x39aada-0x0;var _0x3cee43=_0x597d[_0x39aada];return _0x3cee43;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0xd597('0x0'),'remove',_0xd597('0x1')];function createListener(_0x4dccd0,_0x4abe08){return function(_0x186951){_0x4abe08[_0xd597('0x2')](_0x4dccd0,_0x186951);};}function removeListener(_0x2658ac,_0x564c6b){return function(){SmsMessageEvents[_0xd597('0x3')](_0x2658ac,_0x564c6b);};}exports[_0xd597('0x4')]=function(_0x405c65){for(var _0x26f22e=0x0,_0x34e70b=events[_0xd597('0x5')];_0x26f22e<_0x34e70b;_0x26f22e++){var _0x221e3e=events[_0x26f22e];var _0x56a102=createListener(_0xd597('0x6')+_0x221e3e,_0x405c65);SmsMessageEvents['on'](_0x221e3e,_0x56a102);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 524b973..b17e0ec 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 _0xc565=['put','update','delete','destroy','removeTeams','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','isAuthenticated','/describe','describe','get','/:id','show','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents'];(function(_0x1b9e10,_0x5bce32){var _0x301a96=function(_0x5c799d){while(--_0x5c799d){_0x1b9e10['push'](_0x1b9e10['shift']());}};_0x301a96(++_0x5bce32);}(_0xc565,0x18c));var _0x5c56=function(_0x1cc6a7,_0x1aa625){_0x1cc6a7=_0x1cc6a7-0x0;var _0x37ae5f=_0xc565[_0x1cc6a7];return _0x37ae5f;};'use strict';var multer=require(_0x5c56('0x0'));var util=require(_0x5c56('0x1'));var path=require('path');var timeout=require(_0x5c56('0x2'));var express=require('express');var router=express[_0x5c56('0x3')]();var fs_extra=require(_0x5c56('0x4'));var auth=require(_0x5c56('0x5'));var interaction=require(_0x5c56('0x6'));var config=require(_0x5c56('0x7'));var controller=require(_0x5c56('0x8'));router['get']('/',auth[_0x5c56('0x9')](),controller['index']);router['get'](_0x5c56('0xa'),auth[_0x5c56('0x9')](),controller[_0x5c56('0xb')]);router[_0x5c56('0xc')](_0x5c56('0xd'),auth[_0x5c56('0x9')](),controller[_0x5c56('0xe')]);router['get']('/:id/members',auth[_0x5c56('0x9')](),controller[_0x5c56('0xf')]);router[_0x5c56('0xc')]('/:id/teams',auth['isAuthenticated'](),controller[_0x5c56('0x10')]);router['get'](_0x5c56('0x11'),auth[_0x5c56('0x9')](),controller[_0x5c56('0x12')]);router[_0x5c56('0x13')]('/',auth[_0x5c56('0x9')](),controller[_0x5c56('0x14')]);router[_0x5c56('0x13')](_0x5c56('0x15'),auth[_0x5c56('0x9')](),controller[_0x5c56('0x16')]);router[_0x5c56('0x13')]('/:id/users',auth[_0x5c56('0x9')](),controller[_0x5c56('0x17')]);router[_0x5c56('0x18')](_0x5c56('0xd'),auth[_0x5c56('0x9')](),controller[_0x5c56('0x19')]);router[_0x5c56('0x1a')](_0x5c56('0xd'),auth[_0x5c56('0x9')](),controller[_0x5c56('0x1b')]);router[_0x5c56('0x1a')](_0x5c56('0x15'),auth[_0x5c56('0x9')](),controller[_0x5c56('0x1c')]);router['delete'](_0x5c56('0x11'),auth[_0x5c56('0x9')](),controller['removeAgents']);module[_0x5c56('0x1d')]=router; \ No newline at end of file +var _0x9f44=['destroy','removeAgents','exports','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','/describe','describe','/:id','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','create','post','addTeams','addAgents','put','update','delete'];(function(_0x400e1f,_0x93bfb6){var _0x18dc0e=function(_0x4bc88e){while(--_0x4bc88e){_0x400e1f['push'](_0x400e1f['shift']());}};_0x18dc0e(++_0x93bfb6);}(_0x9f44,0x85));var _0x49f4=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0x9f44[_0x19b3f9];return _0x18c3f6;};'use strict';var multer=require('multer');var util=require(_0x49f4('0x0'));var path=require('path');var timeout=require(_0x49f4('0x1'));var express=require(_0x49f4('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x49f4('0x3'));var config=require(_0x49f4('0x4'));var controller=require(_0x49f4('0x5'));router[_0x49f4('0x6')]('/',auth[_0x49f4('0x7')](),controller['index']);router[_0x49f4('0x6')](_0x49f4('0x8'),auth[_0x49f4('0x7')](),controller[_0x49f4('0x9')]);router['get'](_0x49f4('0xa'),auth[_0x49f4('0x7')](),controller['show']);router['get'](_0x49f4('0xb'),auth[_0x49f4('0x7')](),controller[_0x49f4('0xc')]);router[_0x49f4('0x6')](_0x49f4('0xd'),auth[_0x49f4('0x7')](),controller['getTeams']);router['get'](_0x49f4('0xe'),auth[_0x49f4('0x7')](),controller[_0x49f4('0xf')]);router['post']('/',auth[_0x49f4('0x7')](),controller[_0x49f4('0x10')]);router[_0x49f4('0x11')]('/:id/teams',auth[_0x49f4('0x7')](),controller[_0x49f4('0x12')]);router[_0x49f4('0x11')]('/:id/users',auth[_0x49f4('0x7')](),controller[_0x49f4('0x13')]);router[_0x49f4('0x14')](_0x49f4('0xa'),auth[_0x49f4('0x7')](),controller[_0x49f4('0x15')]);router[_0x49f4('0x16')](_0x49f4('0xa'),auth[_0x49f4('0x7')](),controller[_0x49f4('0x17')]);router[_0x49f4('0x16')](_0x49f4('0xd'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x49f4('0x16')](_0x49f4('0xe'),auth['isAuthenticated'](),controller[_0x49f4('0x18')]);module[_0x49f4('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index f1e4c5f..f8d8a63 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 _0x10d9=['beepall','sequelize','exports','name','STRING','INTEGER','ENUM','rrmemory'];(function(_0x5c201f,_0x59ce0d){var _0x1d5b6d=function(_0x149f69){while(--_0x149f69){_0x5c201f['push'](_0x5c201f['shift']());}};_0x1d5b6d(++_0x59ce0d);}(_0x10d9,0x161));var _0x910d=function(_0x51816d,_0x14cc69){_0x51816d=_0x51816d-0x0;var _0x17d069=_0x10d9[_0x51816d];return _0x17d069;};'use strict';var Sequelize=require(_0x910d('0x0'));module[_0x910d('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x910d('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x910d('0x3')]},'timeout':{'type':Sequelize[_0x910d('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x910d('0x5')](_0x910d('0x6'),_0x910d('0x7'),'roundrobin')}}; \ No newline at end of file +var _0x7583=['name','INTEGER','ENUM','beepall','roundrobin','exports','STRING'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x7583,0xd7));var _0x3758=function(_0x1cea7b,_0x37f5f4){_0x1cea7b=_0x1cea7b-0x0;var _0x5618d1=_0x7583[_0x1cea7b];return _0x5618d1;};'use strict';var Sequelize=require('sequelize');module[_0x3758('0x0')]={'name':{'type':Sequelize[_0x3758('0x1')],'unique':_0x3758('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x3758('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3758('0x4')]('rrmemory',_0x3758('0x5'),_0x3758('0x6'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 76a3b5e..ce5a207 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 _0x5f1f=['every','TeamId','includes','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','then','destroy','get','error','stack','name','send','map','SmsQueue','key','query','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','intersection','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','SmsQueues','find','userProfileId','autoAssociation','UserProfileResource','update','describe','getMembers','findOne','UserSmsQueue','rawAttributes','SmsQueueId','filter','findAll','User','findAndCountAll','UserId','agent','smsPause','createdAt','updatedAt','getTeams','Team','addTeams','ids','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','select','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT'];(function(_0x193018,_0x5a83a8){var _0x181dcc=function(_0x16052a){while(--_0x16052a){_0x193018['push'](_0x193018['shift']());}};_0x181dcc(++_0x5a83a8);}(_0x5f1f,0x129));var _0xf5f1=function(_0x3185ad,_0x5e5ca2){_0x3185ad=_0x3185ad-0x0;var _0x4f77fb=_0x5f1f[_0x3185ad];return _0x4f77fb;};'use strict';var emlformat=require(_0xf5f1('0x0'));var rimraf=require(_0xf5f1('0x1'));var zipdir=require(_0xf5f1('0x2'));var jsonpatch=require(_0xf5f1('0x3'));var rp=require(_0xf5f1('0x4'));var moment=require('moment');var BPromise=require(_0xf5f1('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf5f1('0x6'));var sox=require(_0xf5f1('0x7'));var csv=require(_0xf5f1('0x8'));var ejs=require(_0xf5f1('0x9'));var fs=require('fs');var fs_extra=require(_0xf5f1('0xa'));var _=require('lodash');var squel=require(_0xf5f1('0xb'));var crypto=require(_0xf5f1('0xc'));var jsforce=require(_0xf5f1('0xd'));var deskjs=require(_0xf5f1('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf5f1('0xf'));var Papa=require(_0xf5f1('0x10'));var Redis=require(_0xf5f1('0x11'));var authService=require(_0xf5f1('0x12'));var qs=require(_0xf5f1('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf5f1('0x14'));var logger=require(_0xf5f1('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xf5f1('0x16'));var licenseUtil=require(_0xf5f1('0x17'));var db=require(_0xf5f1('0x18'))['db'];config[_0xf5f1('0x19')]=_[_0xf5f1('0x1a')](config['redis'],{'host':_0xf5f1('0x1b'),'port':0x18eb});var socket=require(_0xf5f1('0x1c'))(new Redis(config[_0xf5f1('0x19')]));require(_0xf5f1('0x1d'))['register'](socket);function respondWithStatusCode(_0x3c9b21,_0x312e8e){_0x312e8e=_0x312e8e||0xcc;return function(_0x2200ef){if(_0x2200ef){return _0x3c9b21[_0xf5f1('0x1e')](_0x312e8e);}return _0x3c9b21['status'](_0x312e8e)[_0xf5f1('0x1f')]();};}function respondWithResult(_0x15d73e,_0x2a339c){_0x2a339c=_0x2a339c||0xc8;return function(_0x5402d5){if(_0x5402d5){return _0x15d73e['status'](_0x2a339c)[_0xf5f1('0x20')](_0x5402d5);}};}function respondWithFilteredResult(_0x10f2d9,_0x567adc){return function(_0x58e8fa){if(_0x58e8fa){var _0x12627c=typeof _0x567adc[_0xf5f1('0x21')]===_0xf5f1('0x22')&&typeof _0x567adc[_0xf5f1('0x23')]==='undefined';var _0x27c9eb=_0x58e8fa[_0xf5f1('0x24')];var _0x4a5316=_0x12627c?0x0:_0x567adc[_0xf5f1('0x21')];var _0x57d680=_0x12627c?_0x58e8fa[_0xf5f1('0x24')]:_0x567adc[_0xf5f1('0x21')]+_0x567adc[_0xf5f1('0x23')];var _0x30b551;if(_0x57d680>=_0x27c9eb){_0x57d680=_0x27c9eb;_0x30b551=0xc8;}else{_0x30b551=0xce;}_0x10f2d9[_0xf5f1('0x25')](_0x30b551);return _0x10f2d9[_0xf5f1('0x26')](_0xf5f1('0x27'),_0x4a5316+'-'+_0x57d680+'/'+_0x27c9eb)[_0xf5f1('0x20')](_0x58e8fa);}return null;};}function patchUpdates(_0x553ac7){return function(_0x37f104){try{jsonpatch[_0xf5f1('0x28')](_0x37f104,_0x553ac7,!![]);}catch(_0x98cf99){return BPromise[_0xf5f1('0x29')](_0x98cf99);}return _0x37f104[_0xf5f1('0x2a')]();};}function saveUpdates(_0x41f84d,_0x42d3c9){return function(_0x22e812){if(_0x22e812){return _0x22e812['update'](_0x41f84d)[_0xf5f1('0x2b')](function(_0x3a0f99){return _0x3a0f99;});}return null;};}function removeEntity(_0x464b15,_0x1b118c){return function(_0x196a49){if(_0x196a49){return _0x196a49[_0xf5f1('0x2c')]()['then'](function(){var _0xdc3879=_0x196a49[_0xf5f1('0x2d')]({'plain':!![]});var _0x1bfe17='SmsQueues';return db['UserProfileResource']['destroy']({'where':{'type':_0x1bfe17,'resourceId':_0xdc3879['id']}})[_0xf5f1('0x2b')](function(){return _0x196a49;});})[_0xf5f1('0x2b')](function(){_0x464b15['status'](0xcc)[_0xf5f1('0x1f')]();});}};}function handleEntityNotFound(_0x6329a6,_0x1a5f5e){return function(_0x4c34ee){if(!_0x4c34ee){_0x6329a6[_0xf5f1('0x1e')](0x194);}return _0x4c34ee;};}function handleError(_0x6b5e6f,_0x3c46e7){_0x3c46e7=_0x3c46e7||0x1f4;return function(_0x3f133c){logger[_0xf5f1('0x2e')](_0x3f133c[_0xf5f1('0x2f')]);if(_0x3f133c['name']){delete _0x3f133c[_0xf5f1('0x30')];}_0x6b5e6f[_0xf5f1('0x25')](_0x3c46e7)[_0xf5f1('0x31')](_0x3f133c);};}exports['index']=function(_0x26a45e,_0x3ceed8){var _0x372592={},_0x1d788f={},_0x81b2c1={'count':0x0,'rows':[]};var _0x2edfe2=_[_0xf5f1('0x32')](db[_0xf5f1('0x33')]['rawAttributes'],function(_0x30f4f1){return{'name':_0x30f4f1['fieldName'],'type':_0x30f4f1['type'][_0xf5f1('0x34')]};});_0x1d788f['model']=_[_0xf5f1('0x32')](_0x2edfe2,_0xf5f1('0x30'));_0x1d788f[_0xf5f1('0x35')]=_['keys'](_0x26a45e[_0xf5f1('0x35')]);_0x1d788f['filters']=_['intersection'](_0x1d788f[_0xf5f1('0x36')],_0x1d788f[_0xf5f1('0x35')]);_0x372592['attributes']=_['intersection'](_0x1d788f['model'],qs[_0xf5f1('0x37')](_0x26a45e[_0xf5f1('0x35')]['fields']));_0x372592['attributes']=_0x372592[_0xf5f1('0x38')][_0xf5f1('0x39')]?_0x372592[_0xf5f1('0x38')]:_0x1d788f[_0xf5f1('0x36')];if(!_0x26a45e[_0xf5f1('0x35')][_0xf5f1('0x3a')](_0xf5f1('0x3b'))){_0x372592[_0xf5f1('0x23')]=qs[_0xf5f1('0x23')](_0x26a45e[_0xf5f1('0x35')][_0xf5f1('0x23')]);_0x372592[_0xf5f1('0x21')]=qs[_0xf5f1('0x21')](_0x26a45e[_0xf5f1('0x35')][_0xf5f1('0x21')]);}_0x372592[_0xf5f1('0x3c')]=qs[_0xf5f1('0x3d')](_0x26a45e['query'][_0xf5f1('0x3d')]);_0x372592[_0xf5f1('0x3e')]=qs[_0xf5f1('0x3f')](_[_0xf5f1('0x40')](_0x26a45e[_0xf5f1('0x35')],_0x1d788f[_0xf5f1('0x3f')]),_0x2edfe2);if(_0x26a45e[_0xf5f1('0x35')]['filter']){_0x372592[_0xf5f1('0x3e')]=_[_0xf5f1('0x41')](_0x372592[_0xf5f1('0x3e')],{'$or':_[_0xf5f1('0x32')](_0x2edfe2,function(_0x357bc3){if(_0x357bc3[_0xf5f1('0x42')]!==_0xf5f1('0x43')){var _0x2b15d7={};_0x2b15d7[_0x357bc3[_0xf5f1('0x30')]]={'$like':'%'+_0x26a45e[_0xf5f1('0x35')]['filter']+'%'};return _0x2b15d7;}})});}_0x372592=_[_0xf5f1('0x41')]({},_0x372592,_0x26a45e[_0xf5f1('0x44')]);var _0x43507d={'where':_0x372592[_0xf5f1('0x3e')]};return db[_0xf5f1('0x33')][_0xf5f1('0x24')](_0x43507d)[_0xf5f1('0x2b')](function(_0x4d9c10){_0x81b2c1['count']=_0x4d9c10;if(_0x26a45e[_0xf5f1('0x35')][_0xf5f1('0x45')]){_0x372592[_0xf5f1('0x46')]=[{'all':!![]}];}return db['SmsQueue']['findAll'](_0x372592);})[_0xf5f1('0x2b')](function(_0x6aa2a0){_0x81b2c1[_0xf5f1('0x47')]=_0x6aa2a0;return _0x81b2c1;})[_0xf5f1('0x2b')](respondWithFilteredResult(_0x3ceed8,_0x372592))[_0xf5f1('0x48')](handleError(_0x3ceed8,null));};exports[_0xf5f1('0x49')]=function(_0x195f45,_0x58c0cb){var _0x370cc9={'raw':!![],'where':{'id':_0x195f45[_0xf5f1('0x4a')]['id']}},_0x184533={};_0x184533[_0xf5f1('0x36')]=_[_0xf5f1('0x4b')](db['SmsQueue']['rawAttributes']);_0x184533[_0xf5f1('0x35')]=_[_0xf5f1('0x4b')](_0x195f45[_0xf5f1('0x35')]);_0x184533[_0xf5f1('0x3f')]=_[_0xf5f1('0x4c')](_0x184533[_0xf5f1('0x36')],_0x184533[_0xf5f1('0x35')]);_0x370cc9[_0xf5f1('0x38')]=_[_0xf5f1('0x4c')](_0x184533[_0xf5f1('0x36')],qs[_0xf5f1('0x37')](_0x195f45[_0xf5f1('0x35')][_0xf5f1('0x37')]));_0x370cc9[_0xf5f1('0x38')]=_0x370cc9[_0xf5f1('0x38')][_0xf5f1('0x39')]?_0x370cc9[_0xf5f1('0x38')]:_0x184533['model'];if(_0x195f45[_0xf5f1('0x35')]['includeAll']){_0x370cc9['include']=[{'all':!![]}];}_0x370cc9=_[_0xf5f1('0x41')]({},_0x370cc9,_0x195f45[_0xf5f1('0x44')]);return db['SmsQueue']['find'](_0x370cc9)[_0xf5f1('0x2b')](handleEntityNotFound(_0x58c0cb,null))[_0xf5f1('0x2b')](respondWithResult(_0x58c0cb,null))['catch'](handleError(_0x58c0cb,null));};exports[_0xf5f1('0x4d')]=function(_0x457571,_0x41f0a8){return db['SmsQueue'][_0xf5f1('0x4d')](_0x457571[_0xf5f1('0x4e')],{})[_0xf5f1('0x2b')](function(_0x2fbd99){var _0x571eea=_0x457571[_0xf5f1('0x4f')]['get']({'plain':!![]});if(!_0x571eea)throw new Error(_0xf5f1('0x50'));if(_0x571eea['role']===_0xf5f1('0x4f')){var _0x125c42=_0x2fbd99[_0xf5f1('0x2d')]({'plain':!![]});var _0x25730c=_0xf5f1('0x51');return db['UserProfileSection'][_0xf5f1('0x52')]({'where':{'name':_0x25730c,'userProfileId':_0x571eea[_0xf5f1('0x53')]},'raw':!![]})['then'](function(_0x4003f4){if(_0x4003f4&&_0x4003f4[_0xf5f1('0x54')]===0x0){return db[_0xf5f1('0x55')][_0xf5f1('0x4d')]({'name':_0x125c42['name'],'resourceId':_0x125c42['id'],'type':_0x4003f4[_0xf5f1('0x30')],'sectionId':_0x4003f4['id']},{})[_0xf5f1('0x2b')](function(){return _0x2fbd99;});}else{return _0x2fbd99;}})[_0xf5f1('0x48')](function(_0x6be6f4){logger[_0xf5f1('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x6be6f4);throw _0x6be6f4;});}return _0x2fbd99;})[_0xf5f1('0x2b')](respondWithResult(_0x41f0a8,0xc9))[_0xf5f1('0x48')](handleError(_0x41f0a8,null));};exports[_0xf5f1('0x56')]=function(_0x2e2771,_0x39eb7d){if(_0x2e2771[_0xf5f1('0x4e')]['id']){delete _0x2e2771[_0xf5f1('0x4e')]['id'];}return db[_0xf5f1('0x33')][_0xf5f1('0x52')]({'where':{'id':_0x2e2771[_0xf5f1('0x4a')]['id']}})['then'](handleEntityNotFound(_0x39eb7d,null))[_0xf5f1('0x2b')](saveUpdates(_0x2e2771['body'],null))['then'](respondWithResult(_0x39eb7d,null))[_0xf5f1('0x48')](handleError(_0x39eb7d,null));};exports[_0xf5f1('0x2c')]=function(_0x5d12e3,_0x1f5716){return db[_0xf5f1('0x33')][_0xf5f1('0x52')]({'where':{'id':_0x5d12e3[_0xf5f1('0x4a')]['id']}})[_0xf5f1('0x2b')](handleEntityNotFound(_0x1f5716,null))[_0xf5f1('0x2b')](removeEntity(_0x1f5716,null))[_0xf5f1('0x48')](handleError(_0x1f5716,null));};exports['describe']=function(_0x238a6c,_0x19eefb){return db[_0xf5f1('0x33')][_0xf5f1('0x57')]()[_0xf5f1('0x2b')](respondWithResult(_0x19eefb,null))[_0xf5f1('0x48')](handleError(_0x19eefb,null));};exports[_0xf5f1('0x58')]=function(_0x167d83,_0x120acc,_0x54ecff){var _0x166681={'raw':!![],'where':{}},_0xf16b91={},_0x39917d;return db['SmsQueue'][_0xf5f1('0x59')]({'where':{'id':_0x167d83['params']['id']}})[_0xf5f1('0x2b')](handleEntityNotFound(_0x120acc,null))['then'](function(_0x3dd2d0){if(_0x3dd2d0){_0x39917d=_0x3dd2d0[_0xf5f1('0x2d')]({'plain':!![]});_0xf16b91[_0xf5f1('0x36')]=_[_0xf5f1('0x4b')](db[_0xf5f1('0x5a')][_0xf5f1('0x5b')]);_0xf16b91[_0xf5f1('0x35')]=_[_0xf5f1('0x4b')](_0x167d83[_0xf5f1('0x35')]);_0xf16b91[_0xf5f1('0x3f')]=_[_0xf5f1('0x4c')](_0xf16b91[_0xf5f1('0x36')],_0xf16b91[_0xf5f1('0x35')]);_0x166681[_0xf5f1('0x38')]=_[_0xf5f1('0x4c')](_0xf16b91[_0xf5f1('0x36')],qs['fields'](_0x167d83[_0xf5f1('0x35')][_0xf5f1('0x37')]));_0x166681['attributes']=_0x166681[_0xf5f1('0x38')][_0xf5f1('0x39')]?_0x166681[_0xf5f1('0x38')]:_0xf16b91[_0xf5f1('0x36')];if(!_0x167d83[_0xf5f1('0x35')][_0xf5f1('0x3a')](_0xf5f1('0x3b'))){_0x166681['limit']=qs[_0xf5f1('0x23')](_0x167d83[_0xf5f1('0x35')][_0xf5f1('0x23')]);_0x166681[_0xf5f1('0x21')]=qs['offset'](_0x167d83['query'][_0xf5f1('0x21')]);}_0x166681['order']=qs[_0xf5f1('0x3d')](_0x167d83[_0xf5f1('0x35')][_0xf5f1('0x3d')]);_0x166681['where']=qs['filters'](_[_0xf5f1('0x40')](_0x167d83[_0xf5f1('0x35')],_0xf16b91['filters']));_0x166681[_0xf5f1('0x3e')][_0xf5f1('0x5c')]=_0x3dd2d0['id'];if(_0x167d83[_0xf5f1('0x35')][_0xf5f1('0x5d')]){_0x166681['where']=_[_0xf5f1('0x41')](_0x166681[_0xf5f1('0x3e')],{'$or':_[_0xf5f1('0x32')](_0x166681[_0xf5f1('0x38')],function(_0x3de262){var _0x40fc9c={};_0x40fc9c[_0x3de262]={'$like':'%'+_0x167d83[_0xf5f1('0x35')][_0xf5f1('0x5d')]+'%'};return _0x40fc9c;})});}_0x166681=_['merge']({},_0x166681,_0x167d83[_0xf5f1('0x44')]);return db[_0xf5f1('0x5a')][_0xf5f1('0x5e')](_0x166681);}})[_0xf5f1('0x2b')](function(_0x3055b3){if(_0x3055b3){return db[_0xf5f1('0x5f')][_0xf5f1('0x60')]({'where':{'id':_[_0xf5f1('0x32')](_0x3055b3,_0xf5f1('0x61')),'role':_0xf5f1('0x62')},'attributes':['id',_0xf5f1('0x30'),_0xf5f1('0x63'),'updatedAt',_0xf5f1('0x64')]});}})['then'](function(_0x24df59){if(_0x24df59){return{'count':_0x24df59[_0xf5f1('0x24')],'rows':_[_0xf5f1('0x32')](_0x24df59['rows'],function(_0x3dbd88){return{'membername':_0x3dbd88[_0xf5f1('0x30')],'UserId':_0x3dbd88['id'],'queue_name':_0x39917d['name'],'SmsQueueId':_0x39917d['id'],'interface':util['format']('%s/%s','SIP',_0x3dbd88['name']),'penalty':0x0,'paused':_0x3dbd88[_0xf5f1('0x63')],'createdAt':_0x3dbd88[_0xf5f1('0x64')],'updatedAt':_0x3dbd88[_0xf5f1('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf5f1('0x2b')](respondWithFilteredResult(_0x120acc,_0x166681))[_0xf5f1('0x48')](handleError(_0x120acc,null));};exports[_0xf5f1('0x66')]=function(_0x211b81,_0x25963f,_0x5f20e9){var _0x8a3e86={};var _0x46a8c6={};var _0x4bf55d;var _0x12c20d;return db['SmsQueue'][_0xf5f1('0x59')]({'where':{'id':_0x211b81['params']['id']}})['then'](handleEntityNotFound(_0x25963f,null))[_0xf5f1('0x2b')](function(_0x4c67dd){if(_0x4c67dd){_0x4bf55d=_0x4c67dd;_0x46a8c6[_0xf5f1('0x36')]=_[_0xf5f1('0x4b')](db[_0xf5f1('0x67')][_0xf5f1('0x5b')]);_0x46a8c6[_0xf5f1('0x35')]=_[_0xf5f1('0x4b')](_0x211b81['query']);_0x46a8c6[_0xf5f1('0x3f')]=_[_0xf5f1('0x4c')](_0x46a8c6['model'],_0x46a8c6['query']);_0x8a3e86[_0xf5f1('0x38')]=_[_0xf5f1('0x4c')](_0x46a8c6['model'],qs[_0xf5f1('0x37')](_0x211b81[_0xf5f1('0x35')][_0xf5f1('0x37')]));_0x8a3e86[_0xf5f1('0x38')]=_0x8a3e86['attributes'][_0xf5f1('0x39')]?_0x8a3e86[_0xf5f1('0x38')]:_0x46a8c6['model'];_0x8a3e86[_0xf5f1('0x3c')]=qs[_0xf5f1('0x3d')](_0x211b81['query'][_0xf5f1('0x3d')]);_0x8a3e86[_0xf5f1('0x3e')]=qs[_0xf5f1('0x3f')](_[_0xf5f1('0x40')](_0x211b81['query'],_0x46a8c6['filters']));if(_0x211b81['query'][_0xf5f1('0x5d')]){_0x8a3e86[_0xf5f1('0x3e')]=_[_0xf5f1('0x41')](_0x8a3e86[_0xf5f1('0x3e')],{'$or':_['map'](_0x8a3e86[_0xf5f1('0x38')],function(_0x6f6983){var _0x3b7295={};_0x3b7295[_0x6f6983]={'$like':'%'+_0x211b81[_0xf5f1('0x35')][_0xf5f1('0x5d')]+'%'};return _0x3b7295;})});}_0x8a3e86=_[_0xf5f1('0x41')]({},_0x8a3e86,_0x211b81['options']);return _0x4bf55d[_0xf5f1('0x66')](_0x8a3e86);}})[_0xf5f1('0x2b')](function(_0x41f145){if(_0x41f145){_0x12c20d=_0x41f145['length'];if(!_0x211b81[_0xf5f1('0x35')][_0xf5f1('0x3a')](_0xf5f1('0x3b'))){_0x8a3e86[_0xf5f1('0x23')]=qs[_0xf5f1('0x23')](_0x211b81['query']['limit']);_0x8a3e86[_0xf5f1('0x21')]=qs[_0xf5f1('0x21')](_0x211b81[_0xf5f1('0x35')][_0xf5f1('0x21')]);}return _0x4bf55d['getTeams'](_0x8a3e86);}})[_0xf5f1('0x2b')](function(_0x23d475){if(_0x23d475){return _0x23d475?{'count':_0x12c20d,'rows':_0x23d475}:null;}})[_0xf5f1('0x2b')](respondWithResult(_0x25963f,null))[_0xf5f1('0x48')](handleError(_0x25963f,null));};exports[_0xf5f1('0x68')]=function(_0x3c492f,_0x54262b,_0x26289a){var _0x4cded7=_0x3c492f[_0xf5f1('0x4e')][_0xf5f1('0x69')];return db[_0xf5f1('0x67')][_0xf5f1('0x5e')]({'where':{'id':_0x4cded7},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0xf5f1('0x6a'),_0xf5f1('0x6b'),_0xf5f1('0x6c')],'raw':!![]}]})[_0xf5f1('0x2b')](function(_0x4662d3){if(_0x4662d3){var _0x58be82=_[_0xf5f1('0x6d')](_0x4662d3,function(_0x7f0455){var _0x39d03a=_0x7f0455[_0xf5f1('0x2d')]({'plain':!![]});return _0x39d03a[_0xf5f1('0x6e')];});return db['SmsQueue'][_0xf5f1('0x52')]({'where':{'id':_0x3c492f[_0xf5f1('0x4a')]['id']}})[_0xf5f1('0x2b')](function(_0x1061b1){return db[_0xf5f1('0x6f')][_0xf5f1('0x70')](function(_0x43a4b2){return _0x1061b1[_0xf5f1('0x68')](_0x4cded7,{'transaction':_0x43a4b2})[_0xf5f1('0x2b')](function(){return BPromise[_0xf5f1('0x71')](_0x58be82,function(_0x4a80a7){return db[_0xf5f1('0x5a')][_0xf5f1('0x72')]({'where':{'UserId':_0x4a80a7['id'],'SmsQueueId':_0x3c492f[_0xf5f1('0x4a')]['id']},'transaction':_0x43a4b2});});})['then'](function(){_0x58be82[_0xf5f1('0x73')](function(_0x3d70a7){socket[_0xf5f1('0x74')](_0xf5f1('0x75'),{'UserId':_0x3d70a7['id'],'SmsQueueId':_0x1061b1['id']});});});});});}})[_0xf5f1('0x2b')](respondWithStatusCode(_0x54262b,null))[_0xf5f1('0x48')](handleError(_0x54262b,null));};exports[_0xf5f1('0x76')]=function(_0x515a08,_0x46d42b,_0xf98b4d){return db[_0xf5f1('0x67')][_0xf5f1('0x5e')]({'where':{'id':_0x515a08[_0xf5f1('0x35')][_0xf5f1('0x69')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xf5f1('0x2b')](handleEntityNotFound(_0x46d42b,null))[_0xf5f1('0x2b')](function(_0x41b878){var _0xf53bfc=_['map'](_0x41b878,'id');var _0x44a780=[];var _0x350446=[];var _0x5255ac=squel[_0xf5f1('0x77')]();_0x5255ac['field']('tq.TeamId')[_0xf5f1('0x78')]('team_has_sms_queues','tq')[_0xf5f1('0x79')](_0xf5f1('0x7a'),'ut',_0xf5f1('0x7b'))[_0xf5f1('0x3e')]('SmsQueueId\x20=\x20?',_0x515a08[_0xf5f1('0x4a')]['id']);for(var _0x5d7e20=0x0;_0x5d7e20<_0x41b878[_0xf5f1('0x39')];_0x5d7e20+=0x1){let _0xe9b790=_0x41b878[_0x5d7e20];for(var _0x49aa20=0x0;_0x49aa20<_0xe9b790[_0xf5f1('0x6e')][_0xf5f1('0x39')];_0x49aa20+=0x1){let _0x3c4a17=_0xe9b790[_0xf5f1('0x6e')][_0x49aa20];var _0x3ce97b=_0x5255ac[_0xf5f1('0x7c')]();_0x3ce97b[_0xf5f1('0x3e')](_0xf5f1('0x7d'),_0x3c4a17['id']);_0x350446[_0xf5f1('0x7e')](db[_0xf5f1('0x6f')][_0xf5f1('0x35')](_0x3ce97b['toString'](),{'type':db[_0xf5f1('0x6f')][_0xf5f1('0x7f')][_0xf5f1('0x80')]})[_0xf5f1('0x2b')](function(_0x39d373){if(_0x39d373['length']===0x1){return _0x3c4a17['id'];}else{var _0x3b2d5b=_[_0xf5f1('0x81')](_[_0xf5f1('0x32')](_0x39d373,_0xf5f1('0x82')),function(_0x2a59b0){return _[_0xf5f1('0x83')](_0xf53bfc,_0x2a59b0);});if(_0x3b2d5b){return _0x3c4a17['id'];}}}));}}return BPromise['all'](_0x350446)['then'](function(_0x2b85d7){_0x44a780=_(_0x44a780)['union'](_0x2b85d7)[_0xf5f1('0x84')]()[_0xf5f1('0x85')]();return db[_0xf5f1('0x33')][_0xf5f1('0x52')]({'where':{'id':_0x515a08[_0xf5f1('0x4a')]['id']}})[_0xf5f1('0x2b')](function(_0x128d3f){return db[_0xf5f1('0x6f')][_0xf5f1('0x70')](function(_0x3bc898){return _0x128d3f['removeTeams'](_0x515a08[_0xf5f1('0x35')][_0xf5f1('0x69')],{'transaction':_0x3bc898})[_0xf5f1('0x2b')](function(){if(!_[_0xf5f1('0x86')](_0x44a780)){return _0x128d3f[_0xf5f1('0x87')](_0x44a780,{'transaction':_0x3bc898});}})[_0xf5f1('0x2b')](function(){_0x44a780[_0xf5f1('0x73')](function(_0x1ceff3){socket[_0xf5f1('0x74')](_0xf5f1('0x88'),{'UserId':_0x1ceff3,'SmsQueueId':_0x128d3f['id']});});});});});});})['then'](respondWithStatusCode(_0x46d42b,null))[_0xf5f1('0x48')](handleError(_0x46d42b,null));};exports[_0xf5f1('0x89')]=function(_0x28a07b,_0x496767,_0x356137){return db['SmsQueue'][_0xf5f1('0x52')]({'where':{'id':_0x28a07b[_0xf5f1('0x4a')]['id']}})['then'](handleEntityNotFound(_0x496767,null))[_0xf5f1('0x2b')](function(_0xc3122){if(_0xc3122){return _0xc3122[_0xf5f1('0x89')](_0x28a07b[_0xf5f1('0x4e')][_0xf5f1('0x69')],_[_0xf5f1('0x8a')](_0x28a07b[_0xf5f1('0x4e')],[_0xf5f1('0x69'),'id'])||{})[_0xf5f1('0x8b')](function(_0x4a8503){for(var _0x22d5ab=0x0;_0x22d5ab<_0x28a07b[_0xf5f1('0x4e')]['ids'][_0xf5f1('0x39')];_0x22d5ab+=0x1){socket[_0xf5f1('0x74')](_0xf5f1('0x75'),{'UserId':Number(_0x28a07b[_0xf5f1('0x4e')][_0xf5f1('0x69')][_0x22d5ab]),'SmsQueueId':Number(_0x28a07b[_0xf5f1('0x4a')]['id'])});}return _0x4a8503;});}})[_0xf5f1('0x2b')](respondWithResult(_0x496767,null))[_0xf5f1('0x48')](handleError(_0x496767,null));};exports[_0xf5f1('0x87')]=function(_0xdc8b5a,_0x466352,_0x3b7160){return db[_0xf5f1('0x33')][_0xf5f1('0x52')]({'where':{'id':_0xdc8b5a[_0xf5f1('0x4a')]['id']}})[_0xf5f1('0x2b')](handleEntityNotFound(_0x466352,null))[_0xf5f1('0x2b')](function(_0x32efd6){if(_0x32efd6){return _0x32efd6[_0xf5f1('0x87')](_0xdc8b5a[_0xf5f1('0x35')]['ids'])[_0xf5f1('0x2b')](function(){if(_[_0xf5f1('0x8c')](_0xdc8b5a[_0xf5f1('0x35')][_0xf5f1('0x69')])){for(var _0x3e5f02=0x0;_0x3e5f02<_0xdc8b5a[_0xf5f1('0x35')]['ids']['length'];_0x3e5f02+=0x1){socket[_0xf5f1('0x74')](_0xf5f1('0x88'),{'UserId':Number(_0xdc8b5a['query'][_0xf5f1('0x69')][_0x3e5f02]),'SmsQueueId':Number(_0xdc8b5a[_0xf5f1('0x4a')]['id'])});}}else{socket[_0xf5f1('0x74')](_0xf5f1('0x88'),{'UserId':Number(_0xdc8b5a[_0xf5f1('0x35')][_0xf5f1('0x69')]),'SmsQueueId':Number(_0xdc8b5a[_0xf5f1('0x4a')]['id'])});}});}})['then'](respondWithStatusCode(_0x466352,null))['catch'](handleError(_0x466352,null));};exports[_0xf5f1('0x8d')]=function(_0x3a0589,_0x1a08fd,_0x40f97e){var _0x1b6eae={};var _0x389162={};var _0x246b36;var _0x14c3e6;return db[_0xf5f1('0x33')][_0xf5f1('0x59')]({'where':{'id':_0x3a0589[_0xf5f1('0x4a')]['id']}})[_0xf5f1('0x2b')](handleEntityNotFound(_0x1a08fd,null))[_0xf5f1('0x2b')](function(_0x41c914){if(_0x41c914){_0x246b36=_0x41c914;_0x389162['model']=_[_0xf5f1('0x4b')](db['User'][_0xf5f1('0x5b')]);_0x389162[_0xf5f1('0x35')]=_[_0xf5f1('0x4b')](_0x3a0589[_0xf5f1('0x35')]);_0x389162[_0xf5f1('0x3f')]=_['intersection'](_0x389162[_0xf5f1('0x36')],_0x389162[_0xf5f1('0x35')]);_0x1b6eae[_0xf5f1('0x38')]=_[_0xf5f1('0x4c')](_0x389162[_0xf5f1('0x36')],qs['fields'](_0x3a0589[_0xf5f1('0x35')][_0xf5f1('0x37')]));_0x1b6eae[_0xf5f1('0x38')]=_0x1b6eae['attributes'][_0xf5f1('0x39')]?_0x1b6eae[_0xf5f1('0x38')]:_0x389162[_0xf5f1('0x36')];_0x1b6eae[_0xf5f1('0x3c')]=qs['sort'](_0x3a0589[_0xf5f1('0x35')]['sort']);_0x1b6eae[_0xf5f1('0x3e')]=qs[_0xf5f1('0x3f')](_[_0xf5f1('0x40')](_0x3a0589[_0xf5f1('0x35')],_0x389162[_0xf5f1('0x3f')]));if(_0x3a0589[_0xf5f1('0x35')]['filter']){_0x1b6eae[_0xf5f1('0x3e')]=_[_0xf5f1('0x41')](_0x1b6eae[_0xf5f1('0x3e')],{'$or':_[_0xf5f1('0x32')](_0x1b6eae[_0xf5f1('0x38')],function(_0x2133d2){var _0x1e75e8={};_0x1e75e8[_0x2133d2]={'$like':'%'+_0x3a0589[_0xf5f1('0x35')][_0xf5f1('0x5d')]+'%'};return _0x1e75e8;})});}_0x1b6eae=_['merge']({},_0x1b6eae,_0x3a0589[_0xf5f1('0x44')]);return _0x246b36['getAgents'](_0x1b6eae);}})[_0xf5f1('0x2b')](function(_0x3e0d9e){if(_0x3e0d9e){_0x14c3e6=_0x3e0d9e[_0xf5f1('0x39')];if(!_0x3a0589[_0xf5f1('0x35')]['hasOwnProperty']('nolimit')){_0x1b6eae[_0xf5f1('0x23')]=qs[_0xf5f1('0x23')](_0x3a0589['query'][_0xf5f1('0x23')]);_0x1b6eae[_0xf5f1('0x21')]=qs[_0xf5f1('0x21')](_0x3a0589[_0xf5f1('0x35')][_0xf5f1('0x21')]);}return _0x246b36[_0xf5f1('0x8d')](_0x1b6eae);}})[_0xf5f1('0x2b')](function(_0x35bd64){if(_0x35bd64){return _0x35bd64?{'count':_0x14c3e6,'rows':_0x35bd64}:null;}})[_0xf5f1('0x2b')](respondWithResult(_0x1a08fd,null))['catch'](handleError(_0x1a08fd,null));}; \ No newline at end of file +var _0x4d1f=['agent','smsPause','createdAt','rows','%s/%s','SIP','updatedAt','getTeams','ids','Team','Agents','online','voicePause','interface','transaction','each','forEach','userSmsQueue:save','select','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','TeamId','union','compact','value','removeTeams','isEmpty','emit','addAgents','spread','removeAgents','isArray','userSmsQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./smsQueue.socket','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','then','destroy','stack','name','index','SmsQueue','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','catch','params','rawAttributes','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsQueues','UserProfileSection','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','findOne','UserSmsQueue','SmsQueueId','User','findAndCountAll','UserId'];(function(_0x34f345,_0x1784b6){var _0x7c26e6=function(_0x383a20){while(--_0x383a20){_0x34f345['push'](_0x34f345['shift']());}};_0x7c26e6(++_0x1784b6);}(_0x4d1f,0x141));var _0xf4d1=function(_0xf8e12b,_0x511aa9){_0xf8e12b=_0xf8e12b-0x0;var _0x48ba63=_0x4d1f[_0xf8e12b];return _0x48ba63;};'use strict';var emlformat=require(_0xf4d1('0x0'));var rimraf=require(_0xf4d1('0x1'));var zipdir=require(_0xf4d1('0x2'));var jsonpatch=require(_0xf4d1('0x3'));var rp=require(_0xf4d1('0x4'));var moment=require(_0xf4d1('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf4d1('0x6'));var path=require('path');var sox=require(_0xf4d1('0x7'));var csv=require('to-csv');var ejs=require(_0xf4d1('0x8'));var fs=require('fs');var fs_extra=require(_0xf4d1('0x9'));var _=require(_0xf4d1('0xa'));var squel=require(_0xf4d1('0xb'));var crypto=require(_0xf4d1('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf4d1('0xd'));var Redis=require(_0xf4d1('0xe'));var authService=require(_0xf4d1('0xf'));var qs=require(_0xf4d1('0x10'));var as=require(_0xf4d1('0x11'));var hardwareService=require(_0xf4d1('0x12'));var logger=require(_0xf4d1('0x13'))('api');var utils=require(_0xf4d1('0x14'));var config=require(_0xf4d1('0x15'));var licenseUtil=require(_0xf4d1('0x16'));var db=require(_0xf4d1('0x17'))['db'];config['redis']=_[_0xf4d1('0x18')](config['redis'],{'host':_0xf4d1('0x19'),'port':0x18eb});var socket=require(_0xf4d1('0x1a'))(new Redis(config[_0xf4d1('0x1b')]));require(_0xf4d1('0x1c'))['register'](socket);function respondWithStatusCode(_0x5736b3,_0x104d34){_0x104d34=_0x104d34||0xcc;return function(_0x34a4e4){if(_0x34a4e4){return _0x5736b3[_0xf4d1('0x1d')](_0x104d34);}return _0x5736b3[_0xf4d1('0x1e')](_0x104d34)[_0xf4d1('0x1f')]();};}function respondWithResult(_0x4dc791,_0x1c5a7f){_0x1c5a7f=_0x1c5a7f||0xc8;return function(_0x2030d9){if(_0x2030d9){return _0x4dc791[_0xf4d1('0x1e')](_0x1c5a7f)['json'](_0x2030d9);}};}function respondWithFilteredResult(_0x70ffdc,_0x25eede){return function(_0x4cfeb5){if(_0x4cfeb5){var _0x13c728=typeof _0x25eede[_0xf4d1('0x20')]==='undefined'&&typeof _0x25eede[_0xf4d1('0x21')]===_0xf4d1('0x22');var _0xfd3e27=_0x4cfeb5[_0xf4d1('0x23')];var _0x4a570c=_0x13c728?0x0:_0x25eede['offset'];var _0x3b327c=_0x13c728?_0x4cfeb5[_0xf4d1('0x23')]:_0x25eede[_0xf4d1('0x20')]+_0x25eede[_0xf4d1('0x21')];var _0x4cae24;if(_0x3b327c>=_0xfd3e27){_0x3b327c=_0xfd3e27;_0x4cae24=0xc8;}else{_0x4cae24=0xce;}_0x70ffdc[_0xf4d1('0x1e')](_0x4cae24);return _0x70ffdc[_0xf4d1('0x24')](_0xf4d1('0x25'),_0x4a570c+'-'+_0x3b327c+'/'+_0xfd3e27)[_0xf4d1('0x26')](_0x4cfeb5);}return null;};}function patchUpdates(_0x48fab7){return function(_0x3ea44f){try{jsonpatch[_0xf4d1('0x27')](_0x3ea44f,_0x48fab7,!![]);}catch(_0x41ecae){return BPromise[_0xf4d1('0x28')](_0x41ecae);}return _0x3ea44f['save']();};}function saveUpdates(_0x205243,_0x1aef9c){return function(_0x50692d){if(_0x50692d){return _0x50692d[_0xf4d1('0x29')](_0x205243)['then'](function(_0x2e25f6){return _0x2e25f6;});}return null;};}function removeEntity(_0x3d316d,_0x52f4a5){return function(_0x2bf062){if(_0x2bf062){return _0x2bf062['destroy']()[_0xf4d1('0x2a')](function(){var _0x43d80e=_0x2bf062['get']({'plain':!![]});var _0x4dd433='SmsQueues';return db['UserProfileResource'][_0xf4d1('0x2b')]({'where':{'type':_0x4dd433,'resourceId':_0x43d80e['id']}})[_0xf4d1('0x2a')](function(){return _0x2bf062;});})['then'](function(){_0x3d316d['status'](0xcc)[_0xf4d1('0x1f')]();});}};}function handleEntityNotFound(_0x4718a3,_0x42dcef){return function(_0x4bebad){if(!_0x4bebad){_0x4718a3[_0xf4d1('0x1d')](0x194);}return _0x4bebad;};}function handleError(_0x38f106,_0x5f4a8b){_0x5f4a8b=_0x5f4a8b||0x1f4;return function(_0x4237d5){logger['error'](_0x4237d5[_0xf4d1('0x2c')]);if(_0x4237d5['name']){delete _0x4237d5[_0xf4d1('0x2d')];}_0x38f106['status'](_0x5f4a8b)['send'](_0x4237d5);};}exports[_0xf4d1('0x2e')]=function(_0x30e52e,_0x5dcecb){var _0x12da3a={},_0x436846={},_0x45cd85={'count':0x0,'rows':[]};var _0x2f0d55=_['map'](db[_0xf4d1('0x2f')]['rawAttributes'],function(_0x2b0103){return{'name':_0x2b0103[_0xf4d1('0x30')],'type':_0x2b0103[_0xf4d1('0x31')]['key']};});_0x436846[_0xf4d1('0x32')]=_['map'](_0x2f0d55,_0xf4d1('0x2d'));_0x436846[_0xf4d1('0x33')]=_[_0xf4d1('0x34')](_0x30e52e['query']);_0x436846[_0xf4d1('0x35')]=_[_0xf4d1('0x36')](_0x436846['model'],_0x436846[_0xf4d1('0x33')]);_0x12da3a['attributes']=_[_0xf4d1('0x36')](_0x436846[_0xf4d1('0x32')],qs[_0xf4d1('0x37')](_0x30e52e[_0xf4d1('0x33')][_0xf4d1('0x37')]));_0x12da3a[_0xf4d1('0x38')]=_0x12da3a[_0xf4d1('0x38')][_0xf4d1('0x39')]?_0x12da3a['attributes']:_0x436846[_0xf4d1('0x32')];if(!_0x30e52e[_0xf4d1('0x33')][_0xf4d1('0x3a')](_0xf4d1('0x3b'))){_0x12da3a[_0xf4d1('0x21')]=qs[_0xf4d1('0x21')](_0x30e52e[_0xf4d1('0x33')][_0xf4d1('0x21')]);_0x12da3a[_0xf4d1('0x20')]=qs[_0xf4d1('0x20')](_0x30e52e[_0xf4d1('0x33')][_0xf4d1('0x20')]);}_0x12da3a[_0xf4d1('0x3c')]=qs[_0xf4d1('0x3d')](_0x30e52e[_0xf4d1('0x33')][_0xf4d1('0x3d')]);_0x12da3a[_0xf4d1('0x3e')]=qs[_0xf4d1('0x35')](_[_0xf4d1('0x3f')](_0x30e52e[_0xf4d1('0x33')],_0x436846[_0xf4d1('0x35')]),_0x2f0d55);if(_0x30e52e['query'][_0xf4d1('0x40')]){_0x12da3a[_0xf4d1('0x3e')]=_[_0xf4d1('0x41')](_0x12da3a[_0xf4d1('0x3e')],{'$or':_[_0xf4d1('0x42')](_0x2f0d55,function(_0x28244d){if(_0x28244d['type']!==_0xf4d1('0x43')){var _0x4c0d99={};_0x4c0d99[_0x28244d['name']]={'$like':'%'+_0x30e52e['query']['filter']+'%'};return _0x4c0d99;}})});}_0x12da3a=_[_0xf4d1('0x41')]({},_0x12da3a,_0x30e52e[_0xf4d1('0x44')]);var _0xbac790={'where':_0x12da3a[_0xf4d1('0x3e')]};return db['SmsQueue']['count'](_0xbac790)['then'](function(_0x47b2e3){_0x45cd85[_0xf4d1('0x23')]=_0x47b2e3;if(_0x30e52e[_0xf4d1('0x33')][_0xf4d1('0x45')]){_0x12da3a[_0xf4d1('0x46')]=[{'all':!![]}];}return db[_0xf4d1('0x2f')][_0xf4d1('0x47')](_0x12da3a);})['then'](function(_0x44c688){_0x45cd85['rows']=_0x44c688;return _0x45cd85;})['then'](respondWithFilteredResult(_0x5dcecb,_0x12da3a))[_0xf4d1('0x48')](handleError(_0x5dcecb,null));};exports['show']=function(_0x13727b,_0x31118e){var _0x233078={'raw':!![],'where':{'id':_0x13727b[_0xf4d1('0x49')]['id']}},_0x5efbe4={};_0x5efbe4[_0xf4d1('0x32')]=_['keys'](db[_0xf4d1('0x2f')][_0xf4d1('0x4a')]);_0x5efbe4['query']=_[_0xf4d1('0x34')](_0x13727b[_0xf4d1('0x33')]);_0x5efbe4[_0xf4d1('0x35')]=_[_0xf4d1('0x36')](_0x5efbe4[_0xf4d1('0x32')],_0x5efbe4['query']);_0x233078[_0xf4d1('0x38')]=_[_0xf4d1('0x36')](_0x5efbe4[_0xf4d1('0x32')],qs[_0xf4d1('0x37')](_0x13727b[_0xf4d1('0x33')][_0xf4d1('0x37')]));_0x233078[_0xf4d1('0x38')]=_0x233078[_0xf4d1('0x38')][_0xf4d1('0x39')]?_0x233078[_0xf4d1('0x38')]:_0x5efbe4['model'];if(_0x13727b[_0xf4d1('0x33')]['includeAll']){_0x233078[_0xf4d1('0x46')]=[{'all':!![]}];}_0x233078=_[_0xf4d1('0x41')]({},_0x233078,_0x13727b['options']);return db['SmsQueue']['find'](_0x233078)[_0xf4d1('0x2a')](handleEntityNotFound(_0x31118e,null))[_0xf4d1('0x2a')](respondWithResult(_0x31118e,null))[_0xf4d1('0x48')](handleError(_0x31118e,null));};exports[_0xf4d1('0x4b')]=function(_0x349fc6,_0x5d766a){return db[_0xf4d1('0x2f')][_0xf4d1('0x4b')](_0x349fc6[_0xf4d1('0x4c')],{})[_0xf4d1('0x2a')](function(_0x2691b){var _0x2b7504=_0x349fc6['user'][_0xf4d1('0x4d')]({'plain':!![]});if(!_0x2b7504)throw new Error(_0xf4d1('0x4e'));if(_0x2b7504[_0xf4d1('0x4f')]==='user'){var _0x3a5cf6=_0x2691b['get']({'plain':!![]});var _0x53cf03=_0xf4d1('0x50');return db[_0xf4d1('0x51')]['find']({'where':{'name':_0x53cf03,'userProfileId':_0x2b7504['userProfileId']},'raw':!![]})[_0xf4d1('0x2a')](function(_0x42bc35){if(_0x42bc35&&_0x42bc35['autoAssociation']===0x0){return db[_0xf4d1('0x52')][_0xf4d1('0x4b')]({'name':_0x3a5cf6['name'],'resourceId':_0x3a5cf6['id'],'type':_0x42bc35[_0xf4d1('0x2d')],'sectionId':_0x42bc35['id']},{})[_0xf4d1('0x2a')](function(){return _0x2691b;});}else{return _0x2691b;}})[_0xf4d1('0x48')](function(_0x2bdd30){logger[_0xf4d1('0x53')](_0xf4d1('0x54'),_0x2bdd30);throw _0x2bdd30;});}return _0x2691b;})[_0xf4d1('0x2a')](respondWithResult(_0x5d766a,0xc9))['catch'](handleError(_0x5d766a,null));};exports[_0xf4d1('0x29')]=function(_0x179459,_0x10223a){if(_0x179459[_0xf4d1('0x4c')]['id']){delete _0x179459[_0xf4d1('0x4c')]['id'];}return db[_0xf4d1('0x2f')][_0xf4d1('0x55')]({'where':{'id':_0x179459[_0xf4d1('0x49')]['id']}})[_0xf4d1('0x2a')](handleEntityNotFound(_0x10223a,null))[_0xf4d1('0x2a')](saveUpdates(_0x179459[_0xf4d1('0x4c')],null))[_0xf4d1('0x2a')](respondWithResult(_0x10223a,null))[_0xf4d1('0x48')](handleError(_0x10223a,null));};exports[_0xf4d1('0x2b')]=function(_0x47b4f6,_0x41c614){return db['SmsQueue'][_0xf4d1('0x55')]({'where':{'id':_0x47b4f6['params']['id']}})['then'](handleEntityNotFound(_0x41c614,null))['then'](removeEntity(_0x41c614,null))[_0xf4d1('0x48')](handleError(_0x41c614,null));};exports[_0xf4d1('0x56')]=function(_0x361515,_0x2cca95){return db[_0xf4d1('0x2f')][_0xf4d1('0x56')]()['then'](respondWithResult(_0x2cca95,null))['catch'](handleError(_0x2cca95,null));};exports['getMembers']=function(_0x10c5dd,_0xe5aa87,_0x5f24ea){var _0x5a9bc3={'raw':!![],'where':{}},_0x8dcc41={},_0x369847;return db[_0xf4d1('0x2f')][_0xf4d1('0x57')]({'where':{'id':_0x10c5dd[_0xf4d1('0x49')]['id']}})[_0xf4d1('0x2a')](handleEntityNotFound(_0xe5aa87,null))[_0xf4d1('0x2a')](function(_0x20fd11){if(_0x20fd11){_0x369847=_0x20fd11[_0xf4d1('0x4d')]({'plain':!![]});_0x8dcc41[_0xf4d1('0x32')]=_[_0xf4d1('0x34')](db[_0xf4d1('0x58')][_0xf4d1('0x4a')]);_0x8dcc41['query']=_[_0xf4d1('0x34')](_0x10c5dd[_0xf4d1('0x33')]);_0x8dcc41['filters']=_[_0xf4d1('0x36')](_0x8dcc41[_0xf4d1('0x32')],_0x8dcc41[_0xf4d1('0x33')]);_0x5a9bc3[_0xf4d1('0x38')]=_[_0xf4d1('0x36')](_0x8dcc41[_0xf4d1('0x32')],qs[_0xf4d1('0x37')](_0x10c5dd[_0xf4d1('0x33')][_0xf4d1('0x37')]));_0x5a9bc3[_0xf4d1('0x38')]=_0x5a9bc3['attributes']['length']?_0x5a9bc3[_0xf4d1('0x38')]:_0x8dcc41[_0xf4d1('0x32')];if(!_0x10c5dd[_0xf4d1('0x33')][_0xf4d1('0x3a')](_0xf4d1('0x3b'))){_0x5a9bc3['limit']=qs[_0xf4d1('0x21')](_0x10c5dd[_0xf4d1('0x33')]['limit']);_0x5a9bc3['offset']=qs['offset'](_0x10c5dd[_0xf4d1('0x33')][_0xf4d1('0x20')]);}_0x5a9bc3[_0xf4d1('0x3c')]=qs[_0xf4d1('0x3d')](_0x10c5dd[_0xf4d1('0x33')]['sort']);_0x5a9bc3[_0xf4d1('0x3e')]=qs[_0xf4d1('0x35')](_[_0xf4d1('0x3f')](_0x10c5dd[_0xf4d1('0x33')],_0x8dcc41[_0xf4d1('0x35')]));_0x5a9bc3[_0xf4d1('0x3e')][_0xf4d1('0x59')]=_0x20fd11['id'];if(_0x10c5dd[_0xf4d1('0x33')][_0xf4d1('0x40')]){_0x5a9bc3[_0xf4d1('0x3e')]=_[_0xf4d1('0x41')](_0x5a9bc3[_0xf4d1('0x3e')],{'$or':_[_0xf4d1('0x42')](_0x5a9bc3[_0xf4d1('0x38')],function(_0x23b7c8){var _0x1ba5f5={};_0x1ba5f5[_0x23b7c8]={'$like':'%'+_0x10c5dd[_0xf4d1('0x33')]['filter']+'%'};return _0x1ba5f5;})});}_0x5a9bc3=_['merge']({},_0x5a9bc3,_0x10c5dd[_0xf4d1('0x44')]);return db['UserSmsQueue']['findAll'](_0x5a9bc3);}})[_0xf4d1('0x2a')](function(_0x20033b){if(_0x20033b){return db[_0xf4d1('0x5a')][_0xf4d1('0x5b')]({'where':{'id':_[_0xf4d1('0x42')](_0x20033b,_0xf4d1('0x5c')),'role':_0xf4d1('0x5d')},'attributes':['id','name',_0xf4d1('0x5e'),'updatedAt',_0xf4d1('0x5f')]});}})['then'](function(_0x859c93){if(_0x859c93){return{'count':_0x859c93[_0xf4d1('0x23')],'rows':_[_0xf4d1('0x42')](_0x859c93[_0xf4d1('0x60')],function(_0x41b1df){return{'membername':_0x41b1df['name'],'UserId':_0x41b1df['id'],'queue_name':_0x369847[_0xf4d1('0x2d')],'SmsQueueId':_0x369847['id'],'interface':util['format'](_0xf4d1('0x61'),_0xf4d1('0x62'),_0x41b1df[_0xf4d1('0x2d')]),'penalty':0x0,'paused':_0x41b1df['smsPause'],'createdAt':_0x41b1df['createdAt'],'updatedAt':_0x41b1df[_0xf4d1('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0xe5aa87,_0x5a9bc3))[_0xf4d1('0x48')](handleError(_0xe5aa87,null));};exports['getTeams']=function(_0x646adc,_0x4397e1,_0x18043d){var _0x3a19b1={};var _0x427b56={};var _0x1d830a;var _0x1b7fa6;return db[_0xf4d1('0x2f')]['findOne']({'where':{'id':_0x646adc[_0xf4d1('0x49')]['id']}})[_0xf4d1('0x2a')](handleEntityNotFound(_0x4397e1,null))[_0xf4d1('0x2a')](function(_0x524522){if(_0x524522){_0x1d830a=_0x524522;_0x427b56[_0xf4d1('0x32')]=_[_0xf4d1('0x34')](db['Team'][_0xf4d1('0x4a')]);_0x427b56['query']=_[_0xf4d1('0x34')](_0x646adc[_0xf4d1('0x33')]);_0x427b56['filters']=_['intersection'](_0x427b56['model'],_0x427b56[_0xf4d1('0x33')]);_0x3a19b1[_0xf4d1('0x38')]=_[_0xf4d1('0x36')](_0x427b56[_0xf4d1('0x32')],qs[_0xf4d1('0x37')](_0x646adc['query']['fields']));_0x3a19b1[_0xf4d1('0x38')]=_0x3a19b1[_0xf4d1('0x38')][_0xf4d1('0x39')]?_0x3a19b1[_0xf4d1('0x38')]:_0x427b56['model'];_0x3a19b1[_0xf4d1('0x3c')]=qs[_0xf4d1('0x3d')](_0x646adc['query'][_0xf4d1('0x3d')]);_0x3a19b1[_0xf4d1('0x3e')]=qs['filters'](_['pick'](_0x646adc[_0xf4d1('0x33')],_0x427b56[_0xf4d1('0x35')]));if(_0x646adc[_0xf4d1('0x33')]['filter']){_0x3a19b1[_0xf4d1('0x3e')]=_[_0xf4d1('0x41')](_0x3a19b1[_0xf4d1('0x3e')],{'$or':_['map'](_0x3a19b1[_0xf4d1('0x38')],function(_0x2fd6f9){var _0xd8f4b2={};_0xd8f4b2[_0x2fd6f9]={'$like':'%'+_0x646adc[_0xf4d1('0x33')][_0xf4d1('0x40')]+'%'};return _0xd8f4b2;})});}_0x3a19b1=_[_0xf4d1('0x41')]({},_0x3a19b1,_0x646adc[_0xf4d1('0x44')]);return _0x1d830a[_0xf4d1('0x64')](_0x3a19b1);}})[_0xf4d1('0x2a')](function(_0x3fef0b){if(_0x3fef0b){_0x1b7fa6=_0x3fef0b['length'];if(!_0x646adc[_0xf4d1('0x33')]['hasOwnProperty'](_0xf4d1('0x3b'))){_0x3a19b1[_0xf4d1('0x21')]=qs['limit'](_0x646adc[_0xf4d1('0x33')]['limit']);_0x3a19b1[_0xf4d1('0x20')]=qs[_0xf4d1('0x20')](_0x646adc[_0xf4d1('0x33')]['offset']);}return _0x1d830a[_0xf4d1('0x64')](_0x3a19b1);}})[_0xf4d1('0x2a')](function(_0x239d0d){if(_0x239d0d){return _0x239d0d?{'count':_0x1b7fa6,'rows':_0x239d0d}:null;}})[_0xf4d1('0x2a')](respondWithResult(_0x4397e1,null))['catch'](handleError(_0x4397e1,null));};exports['addTeams']=function(_0x531970,_0x30ff30,_0xcc5a70){var _0x5bceeb=_0x531970[_0xf4d1('0x4c')][_0xf4d1('0x65')];return db[_0xf4d1('0x66')]['findAll']({'where':{'id':_0x5bceeb},'attributes':['id'],'include':[{'model':db[_0xf4d1('0x5a')],'as':_0xf4d1('0x67'),'attributes':['id',_0xf4d1('0x2d'),_0xf4d1('0x68'),_0xf4d1('0x69'),_0xf4d1('0x6a')],'raw':!![]}]})[_0xf4d1('0x2a')](function(_0x44ab32){if(_0x44ab32){var _0x45aba1=_['flatMap'](_0x44ab32,function(_0x559402){var _0x581b29=_0x559402[_0xf4d1('0x4d')]({'plain':!![]});return _0x581b29['Agents'];});return db[_0xf4d1('0x2f')][_0xf4d1('0x55')]({'where':{'id':_0x531970[_0xf4d1('0x49')]['id']}})[_0xf4d1('0x2a')](function(_0x316418){return db['sequelize'][_0xf4d1('0x6b')](function(_0x2ab375){return _0x316418['addTeams'](_0x5bceeb,{'transaction':_0x2ab375})[_0xf4d1('0x2a')](function(){return BPromise[_0xf4d1('0x6c')](_0x45aba1,function(_0x4b7899){return db[_0xf4d1('0x58')]['findOrCreate']({'where':{'UserId':_0x4b7899['id'],'SmsQueueId':_0x531970[_0xf4d1('0x49')]['id']},'transaction':_0x2ab375});});})[_0xf4d1('0x2a')](function(){_0x45aba1[_0xf4d1('0x6d')](function(_0x458fc7){socket['emit'](_0xf4d1('0x6e'),{'UserId':_0x458fc7['id'],'SmsQueueId':_0x316418['id']});});});});});}})[_0xf4d1('0x2a')](respondWithStatusCode(_0x30ff30,null))[_0xf4d1('0x48')](handleError(_0x30ff30,null));};exports['removeTeams']=function(_0x2ec5c0,_0x2a8d12,_0x1dd527){return db[_0xf4d1('0x66')][_0xf4d1('0x47')]({'where':{'id':_0x2ec5c0[_0xf4d1('0x33')][_0xf4d1('0x65')]},'attributes':['id'],'include':[{'model':db[_0xf4d1('0x5a')],'as':_0xf4d1('0x67'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2a8d12,null))[_0xf4d1('0x2a')](function(_0x46a668){var _0x4b1525=_['map'](_0x46a668,'id');var _0x34da26=[];var _0x398530=[];var _0x4627b5=squel[_0xf4d1('0x6f')]();_0x4627b5[_0xf4d1('0x70')]('tq.TeamId')[_0xf4d1('0x71')]('team_has_sms_queues','tq')[_0xf4d1('0x72')](_0xf4d1('0x73'),'ut',_0xf4d1('0x74'))['where'](_0xf4d1('0x75'),_0x2ec5c0[_0xf4d1('0x49')]['id']);for(var _0x3674e4=0x0;_0x3674e4<_0x46a668[_0xf4d1('0x39')];_0x3674e4+=0x1){let _0x8600=_0x46a668[_0x3674e4];for(var _0x4fffd8=0x0;_0x4fffd8<_0x8600[_0xf4d1('0x67')][_0xf4d1('0x39')];_0x4fffd8+=0x1){let _0x1e9ded=_0x8600[_0xf4d1('0x67')][_0x4fffd8];var _0x51209e=_0x4627b5[_0xf4d1('0x76')]();_0x51209e[_0xf4d1('0x3e')](_0xf4d1('0x77'),_0x1e9ded['id']);_0x398530[_0xf4d1('0x78')](db[_0xf4d1('0x79')]['query'](_0x51209e[_0xf4d1('0x7a')](),{'type':db[_0xf4d1('0x79')][_0xf4d1('0x7b')][_0xf4d1('0x7c')]})[_0xf4d1('0x2a')](function(_0x545458){if(_0x545458[_0xf4d1('0x39')]===0x1){return _0x1e9ded['id'];}else{var _0x1e8d0b=_['every'](_['map'](_0x545458,_0xf4d1('0x7d')),function(_0x2fbdcf){return _['includes'](_0x4b1525,_0x2fbdcf);});if(_0x1e8d0b){return _0x1e9ded['id'];}}}));}}return BPromise['all'](_0x398530)[_0xf4d1('0x2a')](function(_0x4eb391){_0x34da26=_(_0x34da26)[_0xf4d1('0x7e')](_0x4eb391)[_0xf4d1('0x7f')]()[_0xf4d1('0x80')]();return db[_0xf4d1('0x2f')]['find']({'where':{'id':_0x2ec5c0[_0xf4d1('0x49')]['id']}})[_0xf4d1('0x2a')](function(_0x293182){return db[_0xf4d1('0x79')][_0xf4d1('0x6b')](function(_0x41e525){return _0x293182[_0xf4d1('0x81')](_0x2ec5c0[_0xf4d1('0x33')]['ids'],{'transaction':_0x41e525})[_0xf4d1('0x2a')](function(){if(!_[_0xf4d1('0x82')](_0x34da26)){return _0x293182['removeAgents'](_0x34da26,{'transaction':_0x41e525});}})[_0xf4d1('0x2a')](function(){_0x34da26[_0xf4d1('0x6d')](function(_0x4511d7){socket[_0xf4d1('0x83')]('userSmsQueue:remove',{'UserId':_0x4511d7,'SmsQueueId':_0x293182['id']});});});});});});})['then'](respondWithStatusCode(_0x2a8d12,null))[_0xf4d1('0x48')](handleError(_0x2a8d12,null));};exports['addAgents']=function(_0x2e1d1c,_0x29df25,_0x170489){return db[_0xf4d1('0x2f')][_0xf4d1('0x55')]({'where':{'id':_0x2e1d1c[_0xf4d1('0x49')]['id']}})[_0xf4d1('0x2a')](handleEntityNotFound(_0x29df25,null))['then'](function(_0x460b5b){if(_0x460b5b){return _0x460b5b[_0xf4d1('0x84')](_0x2e1d1c['body'][_0xf4d1('0x65')],_['omit'](_0x2e1d1c['body'],['ids','id'])||{})[_0xf4d1('0x85')](function(_0x1ae00c){for(var _0x45fc38=0x0;_0x45fc38<_0x2e1d1c[_0xf4d1('0x4c')][_0xf4d1('0x65')][_0xf4d1('0x39')];_0x45fc38+=0x1){socket['emit']('userSmsQueue:save',{'UserId':Number(_0x2e1d1c[_0xf4d1('0x4c')]['ids'][_0x45fc38]),'SmsQueueId':Number(_0x2e1d1c[_0xf4d1('0x49')]['id'])});}return _0x1ae00c;});}})[_0xf4d1('0x2a')](respondWithResult(_0x29df25,null))[_0xf4d1('0x48')](handleError(_0x29df25,null));};exports[_0xf4d1('0x86')]=function(_0x12fed0,_0x1b3eeb,_0x25a327){return db['SmsQueue']['find']({'where':{'id':_0x12fed0[_0xf4d1('0x49')]['id']}})['then'](handleEntityNotFound(_0x1b3eeb,null))[_0xf4d1('0x2a')](function(_0x4f7344){if(_0x4f7344){return _0x4f7344[_0xf4d1('0x86')](_0x12fed0[_0xf4d1('0x33')][_0xf4d1('0x65')])[_0xf4d1('0x2a')](function(){if(_[_0xf4d1('0x87')](_0x12fed0['query'][_0xf4d1('0x65')])){for(var _0xa987bd=0x0;_0xa987bd<_0x12fed0['query']['ids']['length'];_0xa987bd+=0x1){socket['emit'](_0xf4d1('0x88'),{'UserId':Number(_0x12fed0['query'][_0xf4d1('0x65')][_0xa987bd]),'SmsQueueId':Number(_0x12fed0[_0xf4d1('0x49')]['id'])});}}else{socket['emit'](_0xf4d1('0x88'),{'UserId':Number(_0x12fed0[_0xf4d1('0x33')]['ids']),'SmsQueueId':Number(_0x12fed0[_0xf4d1('0x49')]['id'])});}});}})[_0xf4d1('0x2a')](respondWithStatusCode(_0x1b3eeb,null))['catch'](handleError(_0x1b3eeb,null));};exports['getAgents']=function(_0x3fd4c3,_0x45aef2,_0x3e486a){var _0xa70973={};var _0x2afcba={};var _0x42a45e;var _0x2b2b72;return db['SmsQueue'][_0xf4d1('0x57')]({'where':{'id':_0x3fd4c3[_0xf4d1('0x49')]['id']}})['then'](handleEntityNotFound(_0x45aef2,null))[_0xf4d1('0x2a')](function(_0x42d399){if(_0x42d399){_0x42a45e=_0x42d399;_0x2afcba[_0xf4d1('0x32')]=_[_0xf4d1('0x34')](db[_0xf4d1('0x5a')]['rawAttributes']);_0x2afcba['query']=_[_0xf4d1('0x34')](_0x3fd4c3[_0xf4d1('0x33')]);_0x2afcba[_0xf4d1('0x35')]=_[_0xf4d1('0x36')](_0x2afcba[_0xf4d1('0x32')],_0x2afcba[_0xf4d1('0x33')]);_0xa70973[_0xf4d1('0x38')]=_['intersection'](_0x2afcba['model'],qs[_0xf4d1('0x37')](_0x3fd4c3['query']['fields']));_0xa70973[_0xf4d1('0x38')]=_0xa70973[_0xf4d1('0x38')][_0xf4d1('0x39')]?_0xa70973[_0xf4d1('0x38')]:_0x2afcba[_0xf4d1('0x32')];_0xa70973[_0xf4d1('0x3c')]=qs[_0xf4d1('0x3d')](_0x3fd4c3[_0xf4d1('0x33')][_0xf4d1('0x3d')]);_0xa70973[_0xf4d1('0x3e')]=qs[_0xf4d1('0x35')](_[_0xf4d1('0x3f')](_0x3fd4c3[_0xf4d1('0x33')],_0x2afcba[_0xf4d1('0x35')]));if(_0x3fd4c3['query'][_0xf4d1('0x40')]){_0xa70973[_0xf4d1('0x3e')]=_[_0xf4d1('0x41')](_0xa70973[_0xf4d1('0x3e')],{'$or':_['map'](_0xa70973[_0xf4d1('0x38')],function(_0x18e730){var _0x53fec7={};_0x53fec7[_0x18e730]={'$like':'%'+_0x3fd4c3['query'][_0xf4d1('0x40')]+'%'};return _0x53fec7;})});}_0xa70973=_[_0xf4d1('0x41')]({},_0xa70973,_0x3fd4c3[_0xf4d1('0x44')]);return _0x42a45e[_0xf4d1('0x89')](_0xa70973);}})[_0xf4d1('0x2a')](function(_0x924404){if(_0x924404){_0x2b2b72=_0x924404[_0xf4d1('0x39')];if(!_0x3fd4c3[_0xf4d1('0x33')][_0xf4d1('0x3a')]('nolimit')){_0xa70973[_0xf4d1('0x21')]=qs[_0xf4d1('0x21')](_0x3fd4c3[_0xf4d1('0x33')][_0xf4d1('0x21')]);_0xa70973[_0xf4d1('0x20')]=qs[_0xf4d1('0x20')](_0x3fd4c3['query'][_0xf4d1('0x20')]);}return _0x42a45e[_0xf4d1('0x89')](_0xa70973);}})['then'](function(_0x273e54){if(_0x273e54){return _0x273e54?{'count':_0x2b2b72,'rows':_0x273e54}:null;}})[_0xf4d1('0x2a')](respondWithResult(_0x45aef2,null))[_0xf4d1('0x48')](handleError(_0x45aef2,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index b8ad7f9..3f4995e 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 _0x33ba=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsQueue','setMaxListeners','save','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x33ba,0x17b));var _0xa33b=function(_0x27135f,_0x96dd4){_0x27135f=_0x27135f-0x0;var _0x1e1360=_0x33ba[_0x27135f];return _0x1e1360;};'use strict';var EventEmitter=require(_0xa33b('0x0'));var SmsQueue=require(_0xa33b('0x1'))['db'][_0xa33b('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xa33b('0x3')](0x0);var events={'afterCreate':_0xa33b('0x4'),'afterUpdate':_0xa33b('0x5'),'afterDestroy':_0xa33b('0x6')};function emitEvent(_0x4474b8){return function(_0x4f2807,_0xc6ca6e,_0x5a37b3){SmsQueueEvents[_0xa33b('0x7')](_0x4474b8+':'+_0x4f2807['id'],_0x4f2807);SmsQueueEvents['emit'](_0x4474b8,_0x4f2807);_0x5a37b3(null);};}for(var e in events){if(events[_0xa33b('0x8')](e)){var event=events[e];SmsQueue[_0xa33b('0x9')](e,emitEvent(event));}}module[_0xa33b('0xa')]=SmsQueueEvents; \ No newline at end of file +var _0x718f=['../../mysqldb','emit','hasOwnProperty','hook','exports','events'];(function(_0x89da48,_0x12f96c){var _0x5f4c9a=function(_0x2a9019){while(--_0x2a9019){_0x89da48['push'](_0x89da48['shift']());}};_0x5f4c9a(++_0x12f96c);}(_0x718f,0x197));var _0xf718=function(_0x117994,_0x46bbbb){_0x117994=_0x117994-0x0;var _0x40814a=_0x718f[_0x117994];return _0x40814a;};'use strict';var EventEmitter=require(_0xf718('0x0'));var SmsQueue=require(_0xf718('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x48d762){return function(_0x1c40ce,_0xba08e0,_0x1b2126){SmsQueueEvents[_0xf718('0x2')](_0x48d762+':'+_0x1c40ce['id'],_0x1c40ce);SmsQueueEvents[_0xf718('0x2')](_0x48d762,_0x1c40ce);_0x1b2126(null);};}for(var e in events){if(events[_0xf718('0x3')](e)){var event=events[e];SmsQueue[_0xf718('0x4')](e,emitEvent(event));}}module[_0xf718('0x5')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 596dcd6..134e78c 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 _0x3d43=['request-promise','rimraf','../../config/environment','./smsQueue.attributes','exports','sms_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1449e6,_0x1f3968){var _0x4553bf=function(_0x2ada69){while(--_0x2ada69){_0x1449e6['push'](_0x1449e6['shift']());}};_0x4553bf(++_0x1f3968);}(_0x3d43,0xc6));var _0x33d4=function(_0x3b632f,_0x453380){_0x3b632f=_0x3b632f-0x0;var _0x10e788=_0x3d43[_0x3b632f];return _0x10e788;};'use strict';var _=require(_0x33d4('0x0'));var util=require(_0x33d4('0x1'));var logger=require(_0x33d4('0x2'))(_0x33d4('0x3'));var moment=require(_0x33d4('0x4'));var BPromise=require(_0x33d4('0x5'));var rp=require(_0x33d4('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x33d4('0x7'));var config=require(_0x33d4('0x8'));var attributes=require(_0x33d4('0x9'));module[_0x33d4('0xa')]=function(_0x299a2a,_0x5b5120){return _0x299a2a['define']('SmsQueue',attributes,{'tableName':_0x33d4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3d58=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','define','SmsQueue','lodash'];(function(_0x583306,_0x3ca2b4){var _0x3a09d2=function(_0x750ad8){while(--_0x750ad8){_0x583306['push'](_0x583306['shift']());}};_0x3a09d2(++_0x3ca2b4);}(_0x3d58,0x117));var _0x83d5=function(_0x1f8da6,_0xda349e){_0x1f8da6=_0x1f8da6-0x0;var _0x1882d1=_0x3d58[_0x1f8da6];return _0x1882d1;};'use strict';var _=require(_0x83d5('0x0'));var util=require(_0x83d5('0x1'));var logger=require(_0x83d5('0x2'))(_0x83d5('0x3'));var moment=require(_0x83d5('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x83d5('0x5'));var rimraf=require(_0x83d5('0x6'));var config=require(_0x83d5('0x7'));var attributes=require('./smsQueue.attributes');module['exports']=function(_0x24d646,_0x571ab1){return _0x24d646[_0x83d5('0x8')](_0x83d5('0x9'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 1a1b6ce..ff8363c 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 _0xe635=['error','code','message','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','include','map','attributes','model','ShowSmsQueue','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x20add4,_0xcb494b){var _0x588f43=function(_0x350920){while(--_0x350920){_0x20add4['push'](_0x20add4['shift']());}};_0x588f43(++_0xcb494b);}(_0xe635,0xc9));var _0x5e63=function(_0x3976fd,_0x4094e1){_0x3976fd=_0x3976fd-0x0;var _0x49005a=_0xe635[_0x3976fd];return _0x49005a;};'use strict';var _=require(_0x5e63('0x0'));var util=require(_0x5e63('0x1'));var moment=require(_0x5e63('0x2'));var BPromise=require(_0x5e63('0x3'));var rs=require(_0x5e63('0x4'));var fs=require('fs');var Redis=require(_0x5e63('0x5'));var db=require(_0x5e63('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5e63('0x7'))(_0x5e63('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5e63('0x9')][_0x5e63('0xa')]({'port':0x232a});config['redis']=_[_0x5e63('0xb')](config['redis'],{'host':_0x5e63('0xc'),'port':0x18eb});var socket=require(_0x5e63('0xd'))(new Redis(config['redis']));require(_0x5e63('0xe'))[_0x5e63('0xf')](socket);function respondWithRpcPromise(_0x7dfbc2,_0x421d45,_0x119e6a){return new BPromise(function(_0x3eeeab,_0x5b883b){return client[_0x5e63('0x10')](_0x7dfbc2,_0x119e6a)[_0x5e63('0x11')](function(_0x2344f9){logger[_0x5e63('0x12')](_0x5e63('0x13'),_0x421d45,'request\x20sent');logger['debug']('SmsQueue,\x20%s,\x20%s,\x20%s',_0x421d45,_0x5e63('0x14'),JSON['stringify'](_0x2344f9));if(_0x2344f9[_0x5e63('0x15')]){if(_0x2344f9['error'][_0x5e63('0x16')]===0x1f4){logger['error'](_0x5e63('0x13'),_0x421d45,_0x2344f9['error'][_0x5e63('0x17')]);return _0x5b883b(_0x2344f9[_0x5e63('0x15')][_0x5e63('0x17')]);}logger[_0x5e63('0x15')](_0x5e63('0x13'),_0x421d45,_0x2344f9['error'][_0x5e63('0x17')]);return _0x3eeeab(_0x2344f9['error'][_0x5e63('0x17')]);}else{logger[_0x5e63('0x12')](_0x5e63('0x13'),_0x421d45,'request\x20sent');_0x3eeeab(_0x2344f9['result']['message']);}})[_0x5e63('0x18')](function(_0x1d497f){logger[_0x5e63('0x15')]('SmsQueue,\x20%s,\x20%s',_0x421d45,_0x1d497f);_0x5b883b(_0x1d497f);});});}exports[_0x5e63('0x19')]=function(_0x3584b2){var _0xb8960b=this;return new Promise(function(_0x42ae03,_0x4769ab){return db[_0x5e63('0x1a')][_0x5e63('0x1b')]({'raw':_0x3584b2[_0x5e63('0x1c')]?_0x3584b2[_0x5e63('0x1c')][_0x5e63('0x1d')]===undefined?!![]:![]:!![],'where':_0x3584b2[_0x5e63('0x1c')]?_0x3584b2[_0x5e63('0x1c')][_0x5e63('0x1e')]||null:null,'attributes':_0x3584b2[_0x5e63('0x1c')]?_0x3584b2['options']['attributes']||null:null,'limit':_0x3584b2[_0x5e63('0x1c')]?_0x3584b2[_0x5e63('0x1c')]['limit']||null:null,'include':_0x3584b2['options']?_0x3584b2[_0x5e63('0x1c')][_0x5e63('0x1f')]?_[_0x5e63('0x20')](_0x3584b2[_0x5e63('0x1c')][_0x5e63('0x1f')],function(_0x28bfe3){return{'model':db[_0x28bfe3['model']],'as':_0x28bfe3['as'],'attributes':_0x28bfe3[_0x5e63('0x21')],'include':_0x28bfe3['include']?_[_0x5e63('0x20')](_0x28bfe3[_0x5e63('0x1f')],function(_0x538fb0){return{'model':db[_0x538fb0[_0x5e63('0x22')]],'as':_0x538fb0['as'],'attributes':_0x538fb0[_0x5e63('0x21')],'include':_0x538fb0[_0x5e63('0x1f')]?_[_0x5e63('0x20')](_0x538fb0['include'],function(_0x4f3908){return{'model':db[_0x4f3908[_0x5e63('0x22')]],'as':_0x4f3908['as'],'attributes':_0x4f3908[_0x5e63('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5e63('0x11')](function(_0x5a954d){logger['info'](_0x5e63('0x19'),_0x3584b2);logger['debug'](_0x5e63('0x19'),_0x3584b2,JSON['stringify'](_0x5a954d));_0x42ae03(_0x5a954d);})['catch'](function(_0x479ead){logger[_0x5e63('0x15')](_0x5e63('0x19'),_0x479ead[_0x5e63('0x17')],_0x3584b2);_0x4769ab(_0xb8960b[_0x5e63('0x15')](0x1f4,_0x479ead[_0x5e63('0x17')]));});});};exports[_0x5e63('0x23')]=function(_0x5eef26){var _0xb5b1b1=this;return new Promise(function(_0x4a4c0b,_0x4fcce6){return db[_0x5e63('0x1a')]['find']({'raw':_0x5eef26['options']?_0x5eef26[_0x5e63('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x5eef26[_0x5e63('0x1c')]?_0x5eef26[_0x5e63('0x1c')][_0x5e63('0x1e')]||null:null,'attributes':_0x5eef26['options']?_0x5eef26[_0x5e63('0x1c')][_0x5e63('0x21')]||null:null,'include':_0x5eef26['options']?_0x5eef26[_0x5e63('0x1c')]['include']?_[_0x5e63('0x20')](_0x5eef26[_0x5e63('0x1c')][_0x5e63('0x1f')],function(_0x50715d){return{'model':db[_0x50715d[_0x5e63('0x22')]],'as':_0x50715d['as'],'attributes':_0x50715d[_0x5e63('0x21')],'include':_0x50715d[_0x5e63('0x1f')]?_[_0x5e63('0x20')](_0x50715d['include'],function(_0x55201d){return{'model':db[_0x55201d[_0x5e63('0x22')]],'as':_0x55201d['as'],'attributes':_0x55201d[_0x5e63('0x21')],'include':_0x55201d[_0x5e63('0x1f')]?_[_0x5e63('0x20')](_0x55201d[_0x5e63('0x1f')],function(_0x3af194){return{'model':db[_0x3af194[_0x5e63('0x22')]],'as':_0x3af194['as'],'attributes':_0x3af194[_0x5e63('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5e63('0x11')](function(_0x73dd31){logger[_0x5e63('0x12')](_0x5e63('0x23'),_0x5eef26);logger[_0x5e63('0x24')]('ShowSmsQueue',_0x5eef26,JSON['stringify'](_0x73dd31));_0x4a4c0b(_0x73dd31);})[_0x5e63('0x18')](function(_0x30b361){logger[_0x5e63('0x15')](_0x5e63('0x23'),_0x30b361[_0x5e63('0x17')],_0x5eef26);_0x4fcce6(_0xb5b1b1[_0x5e63('0x15')](0x1f4,_0x30b361[_0x5e63('0x17')]));});});}; \ No newline at end of file +var _0x96c0=['debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit','map','include','model','then','find','ShowSmsQueue','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./smsQueue.socket','register','request','info','SmsQueue,\x20%s,\x20%s','request\x20sent'];(function(_0xc109b,_0x147897){var _0x3c738b=function(_0x4b78e3){while(--_0x4b78e3){_0xc109b['push'](_0xc109b['shift']());}};_0x3c738b(++_0x147897);}(_0x96c0,0xb5));var _0x096c=function(_0x3cde49,_0x18d284){_0x3cde49=_0x3cde49-0x0;var _0x830041=_0x96c0[_0x3cde49];return _0x830041;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x096c('0x0'));var BPromise=require(_0x096c('0x1'));var rs=require(_0x096c('0x2'));var fs=require('fs');var Redis=require(_0x096c('0x3'));var db=require(_0x096c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x096c('0x5'))(_0x096c('0x6'));var config=require(_0x096c('0x7'));var jayson=require(_0x096c('0x8'));var client=jayson[_0x096c('0x9')][_0x096c('0xa')]({'port':0x232a});config[_0x096c('0xb')]=_[_0x096c('0xc')](config[_0x096c('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x096c('0xd'))[_0x096c('0xe')](socket);function respondWithRpcPromise(_0x37fc40,_0x4ad419,_0x125d3b){return new BPromise(function(_0x2a54cd,_0x5b8666){return client[_0x096c('0xf')](_0x37fc40,_0x125d3b)['then'](function(_0x4270c9){logger[_0x096c('0x10')](_0x096c('0x11'),_0x4ad419,_0x096c('0x12'));logger[_0x096c('0x13')](_0x096c('0x14'),_0x4ad419,'request\x20sent',JSON[_0x096c('0x15')](_0x4270c9));if(_0x4270c9[_0x096c('0x16')]){if(_0x4270c9[_0x096c('0x16')][_0x096c('0x17')]===0x1f4){logger[_0x096c('0x16')]('SmsQueue,\x20%s,\x20%s',_0x4ad419,_0x4270c9[_0x096c('0x16')]['message']);return _0x5b8666(_0x4270c9[_0x096c('0x16')]['message']);}logger[_0x096c('0x16')](_0x096c('0x11'),_0x4ad419,_0x4270c9[_0x096c('0x16')][_0x096c('0x18')]);return _0x2a54cd(_0x4270c9[_0x096c('0x16')]['message']);}else{logger[_0x096c('0x10')]('SmsQueue,\x20%s,\x20%s',_0x4ad419,_0x096c('0x12'));_0x2a54cd(_0x4270c9['result'][_0x096c('0x18')]);}})[_0x096c('0x19')](function(_0x45eed7){logger['error'](_0x096c('0x11'),_0x4ad419,_0x45eed7);_0x5b8666(_0x45eed7);});});}exports[_0x096c('0x1a')]=function(_0x5158f2){var _0x11a2f3=this;return new Promise(function(_0x4d9fe2,_0x3b8b17){return db[_0x096c('0x1b')][_0x096c('0x1c')]({'raw':_0x5158f2[_0x096c('0x1d')]?_0x5158f2[_0x096c('0x1d')][_0x096c('0x1e')]===undefined?!![]:![]:!![],'where':_0x5158f2[_0x096c('0x1d')]?_0x5158f2[_0x096c('0x1d')][_0x096c('0x1f')]||null:null,'attributes':_0x5158f2[_0x096c('0x1d')]?_0x5158f2[_0x096c('0x1d')][_0x096c('0x20')]||null:null,'limit':_0x5158f2[_0x096c('0x1d')]?_0x5158f2['options'][_0x096c('0x21')]||null:null,'include':_0x5158f2['options']?_0x5158f2[_0x096c('0x1d')]['include']?_[_0x096c('0x22')](_0x5158f2[_0x096c('0x1d')]['include'],function(_0xf83e95){return{'model':db[_0xf83e95['model']],'as':_0xf83e95['as'],'attributes':_0xf83e95['attributes'],'include':_0xf83e95[_0x096c('0x23')]?_[_0x096c('0x22')](_0xf83e95[_0x096c('0x23')],function(_0x31782b){return{'model':db[_0x31782b[_0x096c('0x24')]],'as':_0x31782b['as'],'attributes':_0x31782b[_0x096c('0x20')],'include':_0x31782b[_0x096c('0x23')]?_['map'](_0x31782b[_0x096c('0x23')],function(_0x47111d){return{'model':db[_0x47111d['model']],'as':_0x47111d['as'],'attributes':_0x47111d[_0x096c('0x20')]};}):[]};}):[]};}):[]:[]})[_0x096c('0x25')](function(_0x139ad7){logger[_0x096c('0x10')]('GetSmsQueue',_0x5158f2);logger[_0x096c('0x13')]('GetSmsQueue',_0x5158f2,JSON[_0x096c('0x15')](_0x139ad7));_0x4d9fe2(_0x139ad7);})[_0x096c('0x19')](function(_0x3285fc){logger[_0x096c('0x16')](_0x096c('0x1a'),_0x3285fc[_0x096c('0x18')],_0x5158f2);_0x3b8b17(_0x11a2f3['error'](0x1f4,_0x3285fc[_0x096c('0x18')]));});});};exports['ShowSmsQueue']=function(_0x498990){var _0x339332=this;return new Promise(function(_0x5d95ad,_0x11c53a){return db[_0x096c('0x1b')][_0x096c('0x26')]({'raw':_0x498990[_0x096c('0x1d')]?_0x498990[_0x096c('0x1d')][_0x096c('0x1e')]===undefined?!![]:![]:!![],'where':_0x498990[_0x096c('0x1d')]?_0x498990[_0x096c('0x1d')][_0x096c('0x1f')]||null:null,'attributes':_0x498990[_0x096c('0x1d')]?_0x498990[_0x096c('0x1d')][_0x096c('0x20')]||null:null,'include':_0x498990[_0x096c('0x1d')]?_0x498990[_0x096c('0x1d')][_0x096c('0x23')]?_[_0x096c('0x22')](_0x498990[_0x096c('0x1d')][_0x096c('0x23')],function(_0x4b35b7){return{'model':db[_0x4b35b7[_0x096c('0x24')]],'as':_0x4b35b7['as'],'attributes':_0x4b35b7[_0x096c('0x20')],'include':_0x4b35b7[_0x096c('0x23')]?_[_0x096c('0x22')](_0x4b35b7[_0x096c('0x23')],function(_0xc843d1){return{'model':db[_0xc843d1[_0x096c('0x24')]],'as':_0xc843d1['as'],'attributes':_0xc843d1[_0x096c('0x20')],'include':_0xc843d1[_0x096c('0x23')]?_['map'](_0xc843d1[_0x096c('0x23')],function(_0x2e0224){return{'model':db[_0x2e0224['model']],'as':_0x2e0224['as'],'attributes':_0x2e0224[_0x096c('0x20')]};}):[]};}):[]};}):[]:[]})[_0x096c('0x25')](function(_0x50b8aa){logger[_0x096c('0x10')]('ShowSmsQueue',_0x498990);logger[_0x096c('0x13')]('ShowSmsQueue',_0x498990,JSON[_0x096c('0x15')](_0x50b8aa));_0x5d95ad(_0x50b8aa);})['catch'](function(_0x409149){logger[_0x096c('0x16')](_0x096c('0x27'),_0x409149['message'],_0x498990);_0x11c53a(_0x339332['error'](0x1f4,_0x409149[_0x096c('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 08a7332..f2cb4aa 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 _0x5749=['emit','removeListener','register','length','smsQueue:','./smsQueue.events','save','remove'];(function(_0x1b6b92,_0x3539e1){var _0x220630=function(_0x416d22){while(--_0x416d22){_0x1b6b92['push'](_0x1b6b92['shift']());}};_0x220630(++_0x3539e1);}(_0x5749,0xfd));var _0x9574=function(_0x1f7d0a,_0x1c431e){_0x1f7d0a=_0x1f7d0a-0x0;var _0x5b45a8=_0x5749[_0x1f7d0a];return _0x5b45a8;};'use strict';var SmsQueueEvents=require(_0x9574('0x0'));var events=[_0x9574('0x1'),_0x9574('0x2'),'update'];function createListener(_0x104404,_0x386b8){return function(_0x13bd3d){_0x386b8[_0x9574('0x3')](_0x104404,_0x13bd3d);};}function removeListener(_0x19dc17,_0x4255ee){return function(){SmsQueueEvents[_0x9574('0x4')](_0x19dc17,_0x4255ee);};}exports[_0x9574('0x5')]=function(_0x1d6b02){for(var _0x2fd573=0x0,_0x4f4dc0=events[_0x9574('0x6')];_0x2fd573<_0x4f4dc0;_0x2fd573++){var _0x1dbaea=events[_0x2fd573];var _0xa80234=createListener(_0x9574('0x7')+_0x1dbaea,_0x1d6b02);SmsQueueEvents['on'](_0x1dbaea,_0xa80234);}}; \ No newline at end of file +var _0xa5c8=['removeListener','register','length','smsQueue:','./smsQueue.events','save','update','emit'];(function(_0x11a8ec,_0x116a80){var _0x6d22f7=function(_0x51ad5){while(--_0x51ad5){_0x11a8ec['push'](_0x11a8ec['shift']());}};_0x6d22f7(++_0x116a80);}(_0xa5c8,0x10c));var _0x8a5c=function(_0x542324,_0x12aff0){_0x542324=_0x542324-0x0;var _0x116ace=_0xa5c8[_0x542324];return _0x116ace;};'use strict';var SmsQueueEvents=require(_0x8a5c('0x0'));var events=[_0x8a5c('0x1'),'remove',_0x8a5c('0x2')];function createListener(_0x4d7435,_0x4f6023){return function(_0x3addde){_0x4f6023[_0x8a5c('0x3')](_0x4d7435,_0x3addde);};}function removeListener(_0x52ba79,_0x48917e){return function(){SmsQueueEvents[_0x8a5c('0x4')](_0x52ba79,_0x48917e);};}exports[_0x8a5c('0x5')]=function(_0x156059){for(var _0x36247b=0x0,_0x8ed7e=events[_0x8a5c('0x6')];_0x36247b<_0x8ed7e;_0x36247b++){var _0x1b0569=events[_0x36247b];var _0x246e85=createListener(_0x8a5c('0x7')+_0x1b0569,_0x156059);SmsQueueEvents['on'](_0x1b0569,_0x246e85);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 18c4b5f..13d79e0 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 _0xdab6=['describe','/:id','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x2cb77c,_0x5ac8d7){var _0x562dc1=function(_0x18fcf0){while(--_0x18fcf0){_0x2cb77c['push'](_0x2cb77c['shift']());}};_0x562dc1(++_0x5ac8d7);}(_0xdab6,0x9a));var _0x6dab=function(_0x4c03f5,_0x9d280e){_0x4c03f5=_0x4c03f5-0x0;var _0x15b66b=_0xdab6[_0x4c03f5];return _0x15b66b;};'use strict';var multer=require(_0x6dab('0x0'));var util=require(_0x6dab('0x1'));var path=require(_0x6dab('0x2'));var timeout=require(_0x6dab('0x3'));var express=require(_0x6dab('0x4'));var router=express[_0x6dab('0x5')]();var fs_extra=require(_0x6dab('0x6'));var auth=require(_0x6dab('0x7'));var interaction=require(_0x6dab('0x8'));var config=require(_0x6dab('0x9'));var controller=require('./smsQueueReport.controller');router[_0x6dab('0xa')]('/',auth[_0x6dab('0xb')](),controller[_0x6dab('0xc')]);router[_0x6dab('0xa')](_0x6dab('0xd'),auth[_0x6dab('0xb')](),controller[_0x6dab('0xe')]);router[_0x6dab('0xa')](_0x6dab('0xf'),auth[_0x6dab('0xb')](),controller['show']);router[_0x6dab('0x10')]('/',auth[_0x6dab('0xb')](),controller[_0x6dab('0x11')]);router['put'](_0x6dab('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x6dab('0x12')](_0x6dab('0xf'),auth[_0x6dab('0xb')](),controller[_0x6dab('0x13')]);module[_0x6dab('0x14')]=router; \ No newline at end of file +var _0xe577=['../../components/interaction/service','./smsQueueReport.controller','isAuthenticated','index','get','/describe','/:id','show','post','create','put','delete','multer','util','path','connect-timeout','Router'];(function(_0x1f9833,_0x1fcdc1){var _0x595578=function(_0x3d636b){while(--_0x3d636b){_0x1f9833['push'](_0x1f9833['shift']());}};_0x595578(++_0x1fcdc1);}(_0xe577,0xb6));var _0x7e57=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xe577[_0x55f8b4];return _0x2475f9;};'use strict';var multer=require(_0x7e57('0x0'));var util=require(_0x7e57('0x1'));var path=require(_0x7e57('0x2'));var timeout=require(_0x7e57('0x3'));var express=require('express');var router=express[_0x7e57('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7e57('0x5'));var config=require('../../config/environment');var controller=require(_0x7e57('0x6'));router['get']('/',auth[_0x7e57('0x7')](),controller[_0x7e57('0x8')]);router[_0x7e57('0x9')](_0x7e57('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x7e57('0x9')](_0x7e57('0xb'),auth[_0x7e57('0x7')](),controller[_0x7e57('0xc')]);router[_0x7e57('0xd')]('/',auth[_0x7e57('0x7')](),controller[_0x7e57('0xe')]);router[_0x7e57('0xf')](_0x7e57('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x7e57('0x10')](_0x7e57('0xb'),auth[_0x7e57('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 537a02d..e4d3dc7 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 _0xb280=['DATE','exports','STRING'];(function(_0x3c0a2e,_0x4794b1){var _0x3089e8=function(_0x4de9bc){while(--_0x4de9bc){_0x3c0a2e['push'](_0x3c0a2e['shift']());}};_0x3089e8(++_0x4794b1);}(_0xb280,0x148));var _0x0b28=function(_0x5bfb4c,_0x51e626){_0x5bfb4c=_0x5bfb4c-0x0;var _0x22fd4e=_0xb280[_0x5bfb4c];return _0x22fd4e;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x0b28('0x0')]={'uniqueid':{'type':Sequelize[_0x0b28('0x1')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x0b28('0x2')]},'acceptAt':{'type':Sequelize[_0x0b28('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5d86=['STRING','DATE','moment','sequelize','exports'];(function(_0x524fca,_0xd8465d){var _0x388af1=function(_0x5ceecf){while(--_0x5ceecf){_0x524fca['push'](_0x524fca['shift']());}};_0x388af1(++_0xd8465d);}(_0x5d86,0x1e2));var _0x65d8=function(_0x2a0183,_0x3fc93c){_0x2a0183=_0x2a0183-0x0;var _0x158c3a=_0x5d86[_0x2a0183];return _0x158c3a;};'use strict';var moment=require(_0x65d8('0x0'));var Sequelize=require(_0x65d8('0x1'));module[_0x65d8('0x2')]={'uniqueid':{'type':Sequelize[_0x65d8('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x65d8('0x3')]},'joinAt':{'type':Sequelize[_0x65d8('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x65d8('0x4')]},'exitAt':{'type':Sequelize[_0x65d8('0x4')]},'reason':{'type':Sequelize[_0x65d8('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 1c74832..7ab80fc 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 _0xe907=['create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','squel','crypto','jsforce','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','SmsQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','find'];(function(_0xa71525,_0x389a74){var _0x13a2d2=function(_0x31fb51){while(--_0x31fb51){_0xa71525['push'](_0xa71525['shift']());}};_0x13a2d2(++_0x389a74);}(_0xe907,0x93));var _0x7e90=function(_0x5c037a,_0x345a53){_0x5c037a=_0x5c037a-0x0;var _0xd51614=_0xe907[_0x5c037a];return _0xd51614;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7e90('0x0'));var zipdir=require(_0x7e90('0x1'));var jsonpatch=require(_0x7e90('0x2'));var rp=require(_0x7e90('0x3'));var moment=require(_0x7e90('0x4'));var BPromise=require(_0x7e90('0x5'));var Mustache=require('mustache');var util=require(_0x7e90('0x6'));var path=require('path');var sox=require(_0x7e90('0x7'));var csv=require(_0x7e90('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7e90('0x9'));var _=require('lodash');var squel=require(_0x7e90('0xa'));var crypto=require(_0x7e90('0xb'));var jsforce=require(_0x7e90('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x7e90('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7e90('0xd'));var as=require(_0x7e90('0xe'));var hardwareService=require(_0x7e90('0xf'));var logger=require(_0x7e90('0x10'))(_0x7e90('0x11'));var utils=require(_0x7e90('0x12'));var config=require(_0x7e90('0x13'));var licenseUtil=require(_0x7e90('0x14'));var db=require(_0x7e90('0x15'))['db'];function respondWithStatusCode(_0x2f5cd8,_0x4db689){_0x4db689=_0x4db689||0xcc;return function(_0x5d7b3b){if(_0x5d7b3b){return _0x2f5cd8['sendStatus'](_0x4db689);}return _0x2f5cd8[_0x7e90('0x16')](_0x4db689)[_0x7e90('0x17')]();};}function respondWithResult(_0x54080a,_0x3eef09){_0x3eef09=_0x3eef09||0xc8;return function(_0x43f224){if(_0x43f224){return _0x54080a[_0x7e90('0x16')](_0x3eef09)[_0x7e90('0x18')](_0x43f224);}};}function respondWithFilteredResult(_0x5847f8,_0x1f9ec7){return function(_0xa407e8){if(_0xa407e8){var _0x30a978=typeof _0x1f9ec7[_0x7e90('0x19')]==='undefined'&&typeof _0x1f9ec7[_0x7e90('0x1a')]==='undefined';var _0x2e1cb1=_0xa407e8[_0x7e90('0x1b')];var _0x46a80d=_0x30a978?0x0:_0x1f9ec7[_0x7e90('0x19')];var _0x12b6a2=_0x30a978?_0xa407e8['count']:_0x1f9ec7['offset']+_0x1f9ec7[_0x7e90('0x1a')];var _0x20619c;if(_0x12b6a2>=_0x2e1cb1){_0x12b6a2=_0x2e1cb1;_0x20619c=0xc8;}else{_0x20619c=0xce;}_0x5847f8['status'](_0x20619c);return _0x5847f8[_0x7e90('0x1c')](_0x7e90('0x1d'),_0x46a80d+'-'+_0x12b6a2+'/'+_0x2e1cb1)[_0x7e90('0x18')](_0xa407e8);}return null;};}function patchUpdates(_0x46265a){return function(_0x42dc91){try{jsonpatch[_0x7e90('0x1e')](_0x42dc91,_0x46265a,!![]);}catch(_0x5117af){return BPromise[_0x7e90('0x1f')](_0x5117af);}return _0x42dc91[_0x7e90('0x20')]();};}function saveUpdates(_0x22a42c,_0xda3430){return function(_0x2e2e1c){if(_0x2e2e1c){return _0x2e2e1c[_0x7e90('0x21')](_0x22a42c)[_0x7e90('0x22')](function(_0x37bd99){return _0x37bd99;});}return null;};}function removeEntity(_0x25d18a,_0x27546b){return function(_0x1c5bd2){if(_0x1c5bd2){return _0x1c5bd2[_0x7e90('0x23')]()[_0x7e90('0x22')](function(){_0x25d18a['status'](0xcc)[_0x7e90('0x17')]();});}};}function handleEntityNotFound(_0x210adb,_0x47069b){return function(_0x3f16b9){if(!_0x3f16b9){_0x210adb['sendStatus'](0x194);}return _0x3f16b9;};}function handleError(_0x321967,_0x5c843a){_0x5c843a=_0x5c843a||0x1f4;return function(_0x5b3b1a){logger[_0x7e90('0x24')](_0x5b3b1a[_0x7e90('0x25')]);if(_0x5b3b1a[_0x7e90('0x26')]){delete _0x5b3b1a[_0x7e90('0x26')];}_0x321967[_0x7e90('0x16')](_0x5c843a)['send'](_0x5b3b1a);};}exports[_0x7e90('0x27')]=function(_0x140b2b,_0x2331e3){var _0x176749={},_0x354b7a={},_0x1a08e4={'count':0x0,'rows':[]};var _0x39bea5=_[_0x7e90('0x28')](db[_0x7e90('0x29')][_0x7e90('0x2a')],function(_0x3a820d){return{'name':_0x3a820d[_0x7e90('0x2b')],'type':_0x3a820d[_0x7e90('0x2c')]['key']};});_0x354b7a[_0x7e90('0x2d')]=_[_0x7e90('0x28')](_0x39bea5,_0x7e90('0x26'));_0x354b7a[_0x7e90('0x2e')]=_[_0x7e90('0x2f')](_0x140b2b[_0x7e90('0x2e')]);_0x354b7a[_0x7e90('0x30')]=_[_0x7e90('0x31')](_0x354b7a[_0x7e90('0x2d')],_0x354b7a['query']);_0x176749[_0x7e90('0x32')]=_[_0x7e90('0x31')](_0x354b7a[_0x7e90('0x2d')],qs[_0x7e90('0x33')](_0x140b2b['query'][_0x7e90('0x33')]));_0x176749[_0x7e90('0x32')]=_0x176749[_0x7e90('0x32')][_0x7e90('0x34')]?_0x176749[_0x7e90('0x32')]:_0x354b7a[_0x7e90('0x2d')];if(!_0x140b2b[_0x7e90('0x2e')][_0x7e90('0x35')](_0x7e90('0x36'))){_0x176749[_0x7e90('0x1a')]=qs['limit'](_0x140b2b['query']['limit']);_0x176749[_0x7e90('0x19')]=qs['offset'](_0x140b2b['query'][_0x7e90('0x19')]);}_0x176749['order']=qs[_0x7e90('0x37')](_0x140b2b[_0x7e90('0x2e')][_0x7e90('0x37')]);_0x176749[_0x7e90('0x38')]=qs['filters'](_[_0x7e90('0x39')](_0x140b2b['query'],_0x354b7a[_0x7e90('0x30')]),_0x39bea5);if(_0x140b2b[_0x7e90('0x2e')][_0x7e90('0x3a')]){_0x176749[_0x7e90('0x38')]=_[_0x7e90('0x3b')](_0x176749[_0x7e90('0x38')],{'$or':_[_0x7e90('0x28')](_0x39bea5,function(_0x1716b7){if(_0x1716b7['type']!==_0x7e90('0x3c')){var _0x59ab32={};_0x59ab32[_0x1716b7[_0x7e90('0x26')]]={'$like':'%'+_0x140b2b['query'][_0x7e90('0x3a')]+'%'};return _0x59ab32;}})});}_0x176749=_[_0x7e90('0x3b')]({},_0x176749,_0x140b2b['options']);var _0x19bc9e={'where':_0x176749[_0x7e90('0x38')]};return db[_0x7e90('0x29')][_0x7e90('0x1b')](_0x19bc9e)['then'](function(_0x1ff8e8){_0x1a08e4[_0x7e90('0x1b')]=_0x1ff8e8;if(_0x140b2b[_0x7e90('0x2e')][_0x7e90('0x3d')]){_0x176749[_0x7e90('0x3e')]=[{'all':!![]}];}return db['SmsQueueReport'][_0x7e90('0x3f')](_0x176749);})['then'](function(_0x2a2703){_0x1a08e4[_0x7e90('0x40')]=_0x2a2703;return _0x1a08e4;})[_0x7e90('0x22')](respondWithFilteredResult(_0x2331e3,_0x176749))[_0x7e90('0x41')](handleError(_0x2331e3,null));};exports[_0x7e90('0x42')]=function(_0x187c13,_0x5dfe87){var _0x1fccda={'raw':!![],'where':{'id':_0x187c13['params']['id']}},_0x2a1713={};_0x2a1713[_0x7e90('0x2d')]=_[_0x7e90('0x2f')](db[_0x7e90('0x29')]['rawAttributes']);_0x2a1713[_0x7e90('0x2e')]=_[_0x7e90('0x2f')](_0x187c13[_0x7e90('0x2e')]);_0x2a1713[_0x7e90('0x30')]=_[_0x7e90('0x31')](_0x2a1713[_0x7e90('0x2d')],_0x2a1713[_0x7e90('0x2e')]);_0x1fccda['attributes']=_[_0x7e90('0x31')](_0x2a1713['model'],qs[_0x7e90('0x33')](_0x187c13[_0x7e90('0x2e')][_0x7e90('0x33')]));_0x1fccda[_0x7e90('0x32')]=_0x1fccda[_0x7e90('0x32')][_0x7e90('0x34')]?_0x1fccda[_0x7e90('0x32')]:_0x2a1713[_0x7e90('0x2d')];if(_0x187c13[_0x7e90('0x2e')]['includeAll']){_0x1fccda[_0x7e90('0x3e')]=[{'all':!![]}];}_0x1fccda=_[_0x7e90('0x3b')]({},_0x1fccda,_0x187c13[_0x7e90('0x43')]);return db[_0x7e90('0x29')][_0x7e90('0x44')](_0x1fccda)['then'](handleEntityNotFound(_0x5dfe87,null))[_0x7e90('0x22')](respondWithResult(_0x5dfe87,null))[_0x7e90('0x41')](handleError(_0x5dfe87,null));};exports[_0x7e90('0x45')]=function(_0x17bd35,_0x383c25){return db[_0x7e90('0x29')][_0x7e90('0x45')](_0x17bd35['body'],{})[_0x7e90('0x22')](respondWithResult(_0x383c25,0xc9))[_0x7e90('0x41')](handleError(_0x383c25,null));};exports['update']=function(_0x359712,_0x39f4fd){if(_0x359712[_0x7e90('0x46')]['id']){delete _0x359712[_0x7e90('0x46')]['id'];}return db[_0x7e90('0x29')][_0x7e90('0x44')]({'where':{'id':_0x359712['params']['id']}})[_0x7e90('0x22')](handleEntityNotFound(_0x39f4fd,null))[_0x7e90('0x22')](saveUpdates(_0x359712['body'],null))[_0x7e90('0x22')](respondWithResult(_0x39f4fd,null))[_0x7e90('0x41')](handleError(_0x39f4fd,null));};exports[_0x7e90('0x23')]=function(_0x4b2df2,_0x4bc094){return db[_0x7e90('0x29')][_0x7e90('0x44')]({'where':{'id':_0x4b2df2['params']['id']}})['then'](handleEntityNotFound(_0x4bc094,null))[_0x7e90('0x22')](removeEntity(_0x4bc094,null))[_0x7e90('0x41')](handleError(_0x4bc094,null));};exports[_0x7e90('0x47')]=function(_0x4d74b5,_0x8bd1d3){return db[_0x7e90('0x29')]['describe']()[_0x7e90('0x22')](respondWithResult(_0x8bd1d3,null))[_0x7e90('0x41')](handleError(_0x8bd1d3,null));}; \ No newline at end of file +var _0xbe89=['sort','where','pick','merge','VIRTUAL','options','includeAll','include','rows','catch','show','rawAttributes','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','SmsQueueReport','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order'];(function(_0xf73390,_0x14c109){var _0x4b212f=function(_0x3e2b63){while(--_0x3e2b63){_0xf73390['push'](_0xf73390['shift']());}};_0x4b212f(++_0x14c109);}(_0xbe89,0xa7));var _0x9be8=function(_0x49e490,_0x1cbb68){_0x49e490=_0x49e490-0x0;var _0x3d477d=_0xbe89[_0x49e490];return _0x3d477d;};'use strict';var emlformat=require(_0x9be8('0x0'));var rimraf=require(_0x9be8('0x1'));var zipdir=require(_0x9be8('0x2'));var jsonpatch=require(_0x9be8('0x3'));var rp=require(_0x9be8('0x4'));var moment=require(_0x9be8('0x5'));var BPromise=require(_0x9be8('0x6'));var Mustache=require(_0x9be8('0x7'));var util=require('util');var path=require(_0x9be8('0x8'));var sox=require(_0x9be8('0x9'));var csv=require(_0x9be8('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9be8('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9be8('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9be8('0xa'));var querystring=require(_0x9be8('0xd'));var Papa=require(_0x9be8('0xe'));var Redis=require('ioredis');var authService=require(_0x9be8('0xf'));var qs=require(_0x9be8('0x10'));var as=require(_0x9be8('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9be8('0x12'))(_0x9be8('0x13'));var utils=require(_0x9be8('0x14'));var config=require(_0x9be8('0x15'));var licenseUtil=require(_0x9be8('0x16'));var db=require(_0x9be8('0x17'))['db'];function respondWithStatusCode(_0x4fe212,_0x5746b2){_0x5746b2=_0x5746b2||0xcc;return function(_0x51c883){if(_0x51c883){return _0x4fe212[_0x9be8('0x18')](_0x5746b2);}return _0x4fe212[_0x9be8('0x19')](_0x5746b2)[_0x9be8('0x1a')]();};}function respondWithResult(_0x5a7eeb,_0x452bb8){_0x452bb8=_0x452bb8||0xc8;return function(_0x17becb){if(_0x17becb){return _0x5a7eeb[_0x9be8('0x19')](_0x452bb8)[_0x9be8('0x1b')](_0x17becb);}};}function respondWithFilteredResult(_0x234910,_0x99730f){return function(_0x2bbd5b){if(_0x2bbd5b){var _0x321268=typeof _0x99730f['offset']===_0x9be8('0x1c')&&typeof _0x99730f['limit']===_0x9be8('0x1c');var _0x34b9db=_0x2bbd5b[_0x9be8('0x1d')];var _0x3fd15c=_0x321268?0x0:_0x99730f[_0x9be8('0x1e')];var _0x475449=_0x321268?_0x2bbd5b[_0x9be8('0x1d')]:_0x99730f[_0x9be8('0x1e')]+_0x99730f[_0x9be8('0x1f')];var _0x58e473;if(_0x475449>=_0x34b9db){_0x475449=_0x34b9db;_0x58e473=0xc8;}else{_0x58e473=0xce;}_0x234910[_0x9be8('0x19')](_0x58e473);return _0x234910['set'](_0x9be8('0x20'),_0x3fd15c+'-'+_0x475449+'/'+_0x34b9db)['json'](_0x2bbd5b);}return null;};}function patchUpdates(_0x1e7c23){return function(_0x566f2f){try{jsonpatch[_0x9be8('0x21')](_0x566f2f,_0x1e7c23,!![]);}catch(_0x2c58c8){return BPromise[_0x9be8('0x22')](_0x2c58c8);}return _0x566f2f[_0x9be8('0x23')]();};}function saveUpdates(_0x48c370,_0xee14cd){return function(_0x230e98){if(_0x230e98){return _0x230e98[_0x9be8('0x24')](_0x48c370)['then'](function(_0x53d836){return _0x53d836;});}return null;};}function removeEntity(_0x589d15,_0x310782){return function(_0x3c05f8){if(_0x3c05f8){return _0x3c05f8['destroy']()[_0x9be8('0x25')](function(){_0x589d15[_0x9be8('0x19')](0xcc)[_0x9be8('0x1a')]();});}};}function handleEntityNotFound(_0x23180a,_0x528a47){return function(_0x446fa5){if(!_0x446fa5){_0x23180a[_0x9be8('0x18')](0x194);}return _0x446fa5;};}function handleError(_0x30a2f2,_0x2731cf){_0x2731cf=_0x2731cf||0x1f4;return function(_0x5e04b6){logger[_0x9be8('0x26')](_0x5e04b6[_0x9be8('0x27')]);if(_0x5e04b6[_0x9be8('0x28')]){delete _0x5e04b6[_0x9be8('0x28')];}_0x30a2f2[_0x9be8('0x19')](_0x2731cf)[_0x9be8('0x29')](_0x5e04b6);};}exports[_0x9be8('0x2a')]=function(_0x3b6f8f,_0x85e672){var _0x3f04a0={},_0x2ab6e2={},_0x2a8b06={'count':0x0,'rows':[]};var _0x8885c2=_[_0x9be8('0x2b')](db[_0x9be8('0x2c')]['rawAttributes'],function(_0x3a8714){return{'name':_0x3a8714[_0x9be8('0x2d')],'type':_0x3a8714[_0x9be8('0x2e')]['key']};});_0x2ab6e2[_0x9be8('0x2f')]=_['map'](_0x8885c2,'name');_0x2ab6e2[_0x9be8('0x30')]=_[_0x9be8('0x31')](_0x3b6f8f[_0x9be8('0x30')]);_0x2ab6e2[_0x9be8('0x32')]=_[_0x9be8('0x33')](_0x2ab6e2[_0x9be8('0x2f')],_0x2ab6e2[_0x9be8('0x30')]);_0x3f04a0['attributes']=_['intersection'](_0x2ab6e2['model'],qs[_0x9be8('0x34')](_0x3b6f8f['query'][_0x9be8('0x34')]));_0x3f04a0[_0x9be8('0x35')]=_0x3f04a0[_0x9be8('0x35')][_0x9be8('0x36')]?_0x3f04a0[_0x9be8('0x35')]:_0x2ab6e2[_0x9be8('0x2f')];if(!_0x3b6f8f[_0x9be8('0x30')][_0x9be8('0x37')](_0x9be8('0x38'))){_0x3f04a0[_0x9be8('0x1f')]=qs[_0x9be8('0x1f')](_0x3b6f8f[_0x9be8('0x30')][_0x9be8('0x1f')]);_0x3f04a0['offset']=qs[_0x9be8('0x1e')](_0x3b6f8f[_0x9be8('0x30')][_0x9be8('0x1e')]);}_0x3f04a0[_0x9be8('0x39')]=qs[_0x9be8('0x3a')](_0x3b6f8f['query'][_0x9be8('0x3a')]);_0x3f04a0[_0x9be8('0x3b')]=qs[_0x9be8('0x32')](_[_0x9be8('0x3c')](_0x3b6f8f[_0x9be8('0x30')],_0x2ab6e2[_0x9be8('0x32')]),_0x8885c2);if(_0x3b6f8f[_0x9be8('0x30')]['filter']){_0x3f04a0[_0x9be8('0x3b')]=_[_0x9be8('0x3d')](_0x3f04a0[_0x9be8('0x3b')],{'$or':_[_0x9be8('0x2b')](_0x8885c2,function(_0x3102fa){if(_0x3102fa[_0x9be8('0x2e')]!==_0x9be8('0x3e')){var _0x26acc0={};_0x26acc0[_0x3102fa['name']]={'$like':'%'+_0x3b6f8f['query']['filter']+'%'};return _0x26acc0;}})});}_0x3f04a0=_[_0x9be8('0x3d')]({},_0x3f04a0,_0x3b6f8f[_0x9be8('0x3f')]);var _0x2fa8a6={'where':_0x3f04a0[_0x9be8('0x3b')]};return db[_0x9be8('0x2c')]['count'](_0x2fa8a6)[_0x9be8('0x25')](function(_0x330697){_0x2a8b06[_0x9be8('0x1d')]=_0x330697;if(_0x3b6f8f['query'][_0x9be8('0x40')]){_0x3f04a0[_0x9be8('0x41')]=[{'all':!![]}];}return db[_0x9be8('0x2c')]['findAll'](_0x3f04a0);})[_0x9be8('0x25')](function(_0x661832){_0x2a8b06[_0x9be8('0x42')]=_0x661832;return _0x2a8b06;})['then'](respondWithFilteredResult(_0x85e672,_0x3f04a0))[_0x9be8('0x43')](handleError(_0x85e672,null));};exports[_0x9be8('0x44')]=function(_0x563540,_0x859c12){var _0xcda3cc={'raw':!![],'where':{'id':_0x563540['params']['id']}},_0x5b0ca8={};_0x5b0ca8[_0x9be8('0x2f')]=_[_0x9be8('0x31')](db['SmsQueueReport'][_0x9be8('0x45')]);_0x5b0ca8['query']=_[_0x9be8('0x31')](_0x563540[_0x9be8('0x30')]);_0x5b0ca8[_0x9be8('0x32')]=_[_0x9be8('0x33')](_0x5b0ca8[_0x9be8('0x2f')],_0x5b0ca8[_0x9be8('0x30')]);_0xcda3cc[_0x9be8('0x35')]=_['intersection'](_0x5b0ca8[_0x9be8('0x2f')],qs[_0x9be8('0x34')](_0x563540['query'][_0x9be8('0x34')]));_0xcda3cc[_0x9be8('0x35')]=_0xcda3cc['attributes'][_0x9be8('0x36')]?_0xcda3cc[_0x9be8('0x35')]:_0x5b0ca8[_0x9be8('0x2f')];if(_0x563540[_0x9be8('0x30')][_0x9be8('0x40')]){_0xcda3cc['include']=[{'all':!![]}];}_0xcda3cc=_[_0x9be8('0x3d')]({},_0xcda3cc,_0x563540['options']);return db[_0x9be8('0x2c')][_0x9be8('0x46')](_0xcda3cc)[_0x9be8('0x25')](handleEntityNotFound(_0x859c12,null))['then'](respondWithResult(_0x859c12,null))[_0x9be8('0x43')](handleError(_0x859c12,null));};exports[_0x9be8('0x47')]=function(_0x38ac53,_0x414114){return db[_0x9be8('0x2c')]['create'](_0x38ac53['body'],{})[_0x9be8('0x25')](respondWithResult(_0x414114,0xc9))['catch'](handleError(_0x414114,null));};exports['update']=function(_0x39717b,_0x25a4bf){if(_0x39717b[_0x9be8('0x48')]['id']){delete _0x39717b['body']['id'];}return db['SmsQueueReport']['find']({'where':{'id':_0x39717b[_0x9be8('0x49')]['id']}})['then'](handleEntityNotFound(_0x25a4bf,null))[_0x9be8('0x25')](saveUpdates(_0x39717b[_0x9be8('0x48')],null))[_0x9be8('0x25')](respondWithResult(_0x25a4bf,null))[_0x9be8('0x43')](handleError(_0x25a4bf,null));};exports['destroy']=function(_0x7b6984,_0x18c663){return db[_0x9be8('0x2c')][_0x9be8('0x46')]({'where':{'id':_0x7b6984[_0x9be8('0x49')]['id']}})[_0x9be8('0x25')](handleEntityNotFound(_0x18c663,null))[_0x9be8('0x25')](removeEntity(_0x18c663,null))[_0x9be8('0x43')](handleError(_0x18c663,null));};exports[_0x9be8('0x4a')]=function(_0xdd1b6,_0x49b822){return db[_0x9be8('0x2c')][_0x9be8('0x4a')]()['then'](respondWithResult(_0x49b822,null))[_0x9be8('0x43')](handleError(_0x49b822,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index fb83135..732cc27 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x103478,_0x353eca){var _0x55d015=function(_0x5a8665){while(--_0x5a8665){_0x103478['push'](_0x103478['shift']());}};_0x55d015(++_0x353eca);}(_0xe706,0xa3));var _0x6e70=function(_0x15de7b,_0x1f9e4e){_0x15de7b=_0x15de7b-0x0;var _0x1456c4=_0xe706[_0x15de7b];return _0x1456c4;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x127783,_0x258715){var _0x14f298=function(_0x32090e){while(--_0x32090e){_0x127783['push'](_0x127783['shift']());}};_0x14f298(++_0x258715);}(_0xe706,0xa3));var _0x6e70=function(_0xbbbeae,_0x4a414a){_0xbbbeae=_0xbbbeae-0x0;var _0x1cb9c9=_0xe706[_0xbbbeae];return _0x1cb9c9;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index f106594..8d55e58 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 _0x681c=['where','attributes','limit','UpdateSmsQueueReport','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','update'];(function(_0x4fa0ff,_0x3a0661){var _0x5ce52c=function(_0x3c4469){while(--_0x3c4469){_0x4fa0ff['push'](_0x4fa0ff['shift']());}};_0x5ce52c(++_0x3a0661);}(_0x681c,0x88));var _0xc681=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x681c[_0x40ac5e];return _0x2839d6;};'use strict';var _=require('lodash');var util=require(_0xc681('0x0'));var moment=require(_0xc681('0x1'));var BPromise=require('bluebird');var rs=require(_0xc681('0x2'));var fs=require('fs');var Redis=require(_0xc681('0x3'));var db=require(_0xc681('0x4'))['db'];var utils=require(_0xc681('0x5'));var logger=require('../../config/logger')(_0xc681('0x6'));var config=require(_0xc681('0x7'));var jayson=require(_0xc681('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x8f0106,_0xddf03e,_0x12a41a){return new BPromise(function(_0xa8e323,_0x15774b){return client[_0xc681('0x9')](_0x8f0106,_0x12a41a)[_0xc681('0xa')](function(_0x4a7441){logger['info'](_0xc681('0xb'),_0xddf03e,_0xc681('0xc'));logger[_0xc681('0xd')](_0xc681('0xe'),_0xddf03e,'request\x20sent',JSON[_0xc681('0xf')](_0x4a7441));if(_0x4a7441['error']){if(_0x4a7441[_0xc681('0x10')][_0xc681('0x11')]===0x1f4){logger[_0xc681('0x10')](_0xc681('0xb'),_0xddf03e,_0x4a7441['error']['message']);return _0x15774b(_0x4a7441[_0xc681('0x10')][_0xc681('0x12')]);}logger[_0xc681('0x10')](_0xc681('0xb'),_0xddf03e,_0x4a7441[_0xc681('0x10')][_0xc681('0x12')]);return _0xa8e323(_0x4a7441[_0xc681('0x10')][_0xc681('0x12')]);}else{logger[_0xc681('0x13')](_0xc681('0xb'),_0xddf03e,'request\x20sent');_0xa8e323(_0x4a7441[_0xc681('0x14')]['message']);}})[_0xc681('0x15')](function(_0x7b206e){logger[_0xc681('0x10')](_0xc681('0xb'),_0xddf03e,_0x7b206e);_0x15774b(_0x7b206e);});});}exports[_0xc681('0x16')]=function(_0x11b19e){var _0x3a09b6=this;return new Promise(function(_0x1eae71,_0x10d033){return db[_0xc681('0x17')][_0xc681('0x18')](_0x11b19e[_0xc681('0x19')],{'raw':_0x11b19e[_0xc681('0x1a')]?_0x11b19e[_0xc681('0x1a')][_0xc681('0x1b')]===undefined?!![]:![]:!![]})[_0xc681('0xa')](function(_0xbeaa37){logger['info'](_0xc681('0x16'),_0x11b19e);logger[_0xc681('0xd')](_0xc681('0x16'),_0x11b19e,JSON['stringify'](_0xbeaa37));_0x1eae71(_0xbeaa37);})[_0xc681('0x15')](function(_0xc934a8){logger[_0xc681('0x10')](_0xc681('0x16'),_0xc934a8[_0xc681('0x12')],_0x11b19e);_0x10d033(_0x3a09b6[_0xc681('0x10')](0x1f4,_0xc934a8[_0xc681('0x12')]));});});};exports['UpdateSmsQueueReport']=function(_0x21a238){var _0x4efac4=this;return new Promise(function(_0xd6f8d9,_0x58ab30){return db[_0xc681('0x17')][_0xc681('0x1c')](_0x21a238[_0xc681('0x19')],{'raw':_0x21a238[_0xc681('0x1a')]?_0x21a238[_0xc681('0x1a')][_0xc681('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21a238[_0xc681('0x1a')]?_0x21a238[_0xc681('0x1a')][_0xc681('0x1d')]||null:null,'attributes':_0x21a238[_0xc681('0x1a')]?_0x21a238[_0xc681('0x1a')][_0xc681('0x1e')]||null:null,'limit':_0x21a238[_0xc681('0x1a')]?_0x21a238[_0xc681('0x1a')][_0xc681('0x1f')]||null:null})[_0xc681('0xa')](function(_0x322b0d){logger['info']('UpdateSmsQueueReport',_0x21a238);logger[_0xc681('0xd')](_0xc681('0x20'),_0x21a238,JSON[_0xc681('0xf')](_0x322b0d));_0xd6f8d9(_0x322b0d);})[_0xc681('0x15')](function(_0x17a477){logger['error'](_0xc681('0x20'),_0x17a477[_0xc681('0x12')],_0x21a238);_0x58ab30(_0x4efac4[_0xc681('0x10')](0x1f4,_0x17a477[_0xc681('0x12')]));});});}; \ No newline at end of file +var _0x1c9d=['update','where','attributes','limit','UpdateSmsQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw'];(function(_0xbc346f,_0x3db5c0){var _0x9f9260=function(_0x37e6b9){while(--_0x37e6b9){_0xbc346f['push'](_0xbc346f['shift']());}};_0x9f9260(++_0x3db5c0);}(_0x1c9d,0x74));var _0xd1c9=function(_0x28beae,_0x5ba3d1){_0x28beae=_0x28beae-0x0;var _0x1531cb=_0x1c9d[_0x28beae];return _0x1531cb;};'use strict';var _=require('lodash');var util=require(_0xd1c9('0x0'));var moment=require(_0xd1c9('0x1'));var BPromise=require(_0xd1c9('0x2'));var rs=require(_0xd1c9('0x3'));var fs=require('fs');var Redis=require(_0xd1c9('0x4'));var db=require(_0xd1c9('0x5'))['db'];var utils=require(_0xd1c9('0x6'));var logger=require(_0xd1c9('0x7'))(_0xd1c9('0x8'));var config=require(_0xd1c9('0x9'));var jayson=require(_0xd1c9('0xa'));var client=jayson[_0xd1c9('0xb')][_0xd1c9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x25c219,_0x22f488,_0x43ed21){return new BPromise(function(_0x3818c2,_0x36f45e){return client[_0xd1c9('0xd')](_0x25c219,_0x43ed21)[_0xd1c9('0xe')](function(_0x8b0ce6){logger['info'](_0xd1c9('0xf'),_0x22f488,_0xd1c9('0x10'));logger[_0xd1c9('0x11')](_0xd1c9('0x12'),_0x22f488,'request\x20sent',JSON[_0xd1c9('0x13')](_0x8b0ce6));if(_0x8b0ce6['error']){if(_0x8b0ce6['error'][_0xd1c9('0x14')]===0x1f4){logger[_0xd1c9('0x15')](_0xd1c9('0xf'),_0x22f488,_0x8b0ce6['error']['message']);return _0x36f45e(_0x8b0ce6[_0xd1c9('0x15')][_0xd1c9('0x16')]);}logger[_0xd1c9('0x15')](_0xd1c9('0xf'),_0x22f488,_0x8b0ce6[_0xd1c9('0x15')][_0xd1c9('0x16')]);return _0x3818c2(_0x8b0ce6[_0xd1c9('0x15')][_0xd1c9('0x16')]);}else{logger[_0xd1c9('0x17')](_0xd1c9('0xf'),_0x22f488,'request\x20sent');_0x3818c2(_0x8b0ce6[_0xd1c9('0x18')][_0xd1c9('0x16')]);}})[_0xd1c9('0x19')](function(_0x12d0d){logger[_0xd1c9('0x15')](_0xd1c9('0xf'),_0x22f488,_0x12d0d);_0x36f45e(_0x12d0d);});});}exports[_0xd1c9('0x1a')]=function(_0x268685){var _0x7fca87=this;return new Promise(function(_0x270b98,_0x26b38a){return db[_0xd1c9('0x1b')][_0xd1c9('0x1c')](_0x268685[_0xd1c9('0x1d')],{'raw':_0x268685[_0xd1c9('0x1e')]?_0x268685[_0xd1c9('0x1e')][_0xd1c9('0x1f')]===undefined?!![]:![]:!![]})[_0xd1c9('0xe')](function(_0x11ae7a){logger[_0xd1c9('0x17')](_0xd1c9('0x1a'),_0x268685);logger[_0xd1c9('0x11')](_0xd1c9('0x1a'),_0x268685,JSON[_0xd1c9('0x13')](_0x11ae7a));_0x270b98(_0x11ae7a);})[_0xd1c9('0x19')](function(_0x4b9f7b){logger[_0xd1c9('0x15')](_0xd1c9('0x1a'),_0x4b9f7b[_0xd1c9('0x16')],_0x268685);_0x26b38a(_0x7fca87[_0xd1c9('0x15')](0x1f4,_0x4b9f7b['message']));});});};exports['UpdateSmsQueueReport']=function(_0x35214d){var _0x586610=this;return new Promise(function(_0x2b64d7,_0x5adeb6){return db['SmsQueueReport'][_0xd1c9('0x20')](_0x35214d[_0xd1c9('0x1d')],{'raw':_0x35214d[_0xd1c9('0x1e')]?_0x35214d[_0xd1c9('0x1e')][_0xd1c9('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35214d[_0xd1c9('0x1e')]?_0x35214d[_0xd1c9('0x1e')][_0xd1c9('0x21')]||null:null,'attributes':_0x35214d[_0xd1c9('0x1e')]?_0x35214d['options'][_0xd1c9('0x22')]||null:null,'limit':_0x35214d[_0xd1c9('0x1e')]?_0x35214d[_0xd1c9('0x1e')][_0xd1c9('0x23')]||null:null})[_0xd1c9('0xe')](function(_0x36591b){logger[_0xd1c9('0x17')]('UpdateSmsQueueReport',_0x35214d);logger[_0xd1c9('0x11')]('UpdateSmsQueueReport',_0x35214d,JSON[_0xd1c9('0x13')](_0x36591b));_0x2b64d7(_0x36591b);})[_0xd1c9('0x19')](function(_0x4d4ba9){logger['error'](_0xd1c9('0x24'),_0x4d4ba9[_0xd1c9('0x16')],_0x35214d);_0x5adeb6(_0x586610[_0xd1c9('0x15')](0x1f4,_0x4d4ba9['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 0ce147d..c189feb 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 _0x90b5=['/describe','describe','/:id','show','post','put','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x2553e6,_0x371bf3){var _0x4a57a2=function(_0x421661){while(--_0x421661){_0x2553e6['push'](_0x2553e6['shift']());}};_0x4a57a2(++_0x371bf3);}(_0x90b5,0x139));var _0x590b=function(_0x389006,_0x1c0ff1){_0x389006=_0x389006-0x0;var _0x18282c=_0x90b5[_0x389006];return _0x18282c;};'use strict';var multer=require(_0x590b('0x0'));var util=require('util');var path=require(_0x590b('0x1'));var timeout=require(_0x590b('0x2'));var express=require(_0x590b('0x3'));var router=express[_0x590b('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x590b('0x5'));var config=require(_0x590b('0x6'));var controller=require('./smsTransferReport.controller');router[_0x590b('0x7')]('/',auth[_0x590b('0x8')](),controller[_0x590b('0x9')]);router['get'](_0x590b('0xa'),auth[_0x590b('0x8')](),controller[_0x590b('0xb')]);router[_0x590b('0x7')](_0x590b('0xc'),auth[_0x590b('0x8')](),controller[_0x590b('0xd')]);router[_0x590b('0xe')]('/',auth[_0x590b('0x8')](),controller['create']);router[_0x590b('0xf')](_0x590b('0xc'),auth['isAuthenticated'](),controller[_0x590b('0x10')]);router['delete'](_0x590b('0xc'),auth[_0x590b('0x8')](),controller[_0x590b('0x11')]);module[_0x590b('0x12')]=router; \ No newline at end of file +var _0xdf98=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','post','create','put','/:id','update','delete','destroy','exports','multer','path','Router'];(function(_0x24697b,_0x2eb072){var _0x585b99=function(_0x261980){while(--_0x261980){_0x24697b['push'](_0x24697b['shift']());}};_0x585b99(++_0x2eb072);}(_0xdf98,0xcf));var _0x8df9=function(_0x3be0c4,_0x5b7eff){_0x3be0c4=_0x3be0c4-0x0;var _0x11af9f=_0xdf98[_0x3be0c4];return _0x11af9f;};'use strict';var multer=require(_0x8df9('0x0'));var util=require('util');var path=require(_0x8df9('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8df9('0x2')]();var fs_extra=require(_0x8df9('0x3'));var auth=require(_0x8df9('0x4'));var interaction=require(_0x8df9('0x5'));var config=require(_0x8df9('0x6'));var controller=require(_0x8df9('0x7'));router[_0x8df9('0x8')]('/',auth[_0x8df9('0x9')](),controller[_0x8df9('0xa')]);router['get'](_0x8df9('0xb'),auth[_0x8df9('0x9')](),controller[_0x8df9('0xc')]);router['get']('/:id',auth[_0x8df9('0x9')](),controller['show']);router[_0x8df9('0xd')]('/',auth[_0x8df9('0x9')](),controller[_0x8df9('0xe')]);router[_0x8df9('0xf')](_0x8df9('0x10'),auth[_0x8df9('0x9')](),controller[_0x8df9('0x11')]);router[_0x8df9('0x12')]('/:id',auth[_0x8df9('0x9')](),controller[_0x8df9('0x13')]);module[_0x8df9('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 9617bef..161c870 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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x5a9755,_0x4efc62){var _0x339d5d=function(_0x1b9f3e){while(--_0x1b9f3e){_0x5a9755['push'](_0x5a9755['shift']());}};_0x339d5d(++_0x4efc62);}(_0x70e0,0x17b));var _0x070e=function(_0x9fb0b5,_0x29af51){_0x9fb0b5=_0x9fb0b5-0x0;var _0x45bb0f=_0x70e0[_0x9fb0b5];return _0x45bb0f;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file +var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x1b5bc2,_0x453d84){var _0x1a5382=function(_0x4ffafb){while(--_0x4ffafb){_0x1b5bc2['push'](_0x1b5bc2['shift']());}};_0x1a5382(++_0x453d84);}(_0x54ef,0x112));var _0xf54e=function(_0x5bc988,_0x2b4aab){_0x5bc988=_0x5bc988-0x0;var _0x43869c=_0x54ef[_0x5bc988];return _0x43869c;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 49b769c..e66789a 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 _0xd75f=['status','json','offset','undefined','limit','count','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','SmsTransferReport','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','include','rows','catch','params','rawAttributes','includeAll','options','find','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x144c0c,_0x113cfe){var _0x436221=function(_0x231dd7){while(--_0x231dd7){_0x144c0c['push'](_0x144c0c['shift']());}};_0x436221(++_0x113cfe);}(_0xd75f,0xbf));var _0xfd75=function(_0x332e30,_0x2c78a2){_0x332e30=_0x332e30-0x0;var _0x32df8e=_0xd75f[_0x332e30];return _0x32df8e;};'use strict';var emlformat=require(_0xfd75('0x0'));var rimraf=require(_0xfd75('0x1'));var zipdir=require(_0xfd75('0x2'));var jsonpatch=require(_0xfd75('0x3'));var rp=require(_0xfd75('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfd75('0x5'));var util=require(_0xfd75('0x6'));var path=require(_0xfd75('0x7'));var sox=require('sox');var csv=require(_0xfd75('0x8'));var ejs=require(_0xfd75('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfd75('0xa'));var squel=require(_0xfd75('0xb'));var crypto=require(_0xfd75('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xfd75('0xd'));var toCsv=require('to-csv');var querystring=require(_0xfd75('0xe'));var Papa=require('papaparse');var Redis=require(_0xfd75('0xf'));var authService=require(_0xfd75('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xfd75('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xfd75('0x12'));var utils=require(_0xfd75('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xfd75('0x14'));var db=require(_0xfd75('0x15'))['db'];function respondWithStatusCode(_0x488d3,_0xe34d0f){_0xe34d0f=_0xe34d0f||0xcc;return function(_0x5f3555){if(_0x5f3555){return _0x488d3['sendStatus'](_0xe34d0f);}return _0x488d3[_0xfd75('0x16')](_0xe34d0f)['end']();};}function respondWithResult(_0x34f898,_0x3f07cd){_0x3f07cd=_0x3f07cd||0xc8;return function(_0x383ca3){if(_0x383ca3){return _0x34f898[_0xfd75('0x16')](_0x3f07cd)[_0xfd75('0x17')](_0x383ca3);}};}function respondWithFilteredResult(_0x5685de,_0x75f075){return function(_0x19d033){if(_0x19d033){var _0x503751=typeof _0x75f075[_0xfd75('0x18')]===_0xfd75('0x19')&&typeof _0x75f075[_0xfd75('0x1a')]===_0xfd75('0x19');var _0x1995be=_0x19d033[_0xfd75('0x1b')];var _0x460c00=_0x503751?0x0:_0x75f075[_0xfd75('0x18')];var _0xfe5213=_0x503751?_0x19d033[_0xfd75('0x1b')]:_0x75f075[_0xfd75('0x18')]+_0x75f075[_0xfd75('0x1a')];var _0x21b397;if(_0xfe5213>=_0x1995be){_0xfe5213=_0x1995be;_0x21b397=0xc8;}else{_0x21b397=0xce;}_0x5685de['status'](_0x21b397);return _0x5685de['set']('Content-Range',_0x460c00+'-'+_0xfe5213+'/'+_0x1995be)[_0xfd75('0x17')](_0x19d033);}return null;};}function patchUpdates(_0x14d66e){return function(_0x5b3186){try{jsonpatch[_0xfd75('0x1c')](_0x5b3186,_0x14d66e,!![]);}catch(_0x2bdce9){return BPromise[_0xfd75('0x1d')](_0x2bdce9);}return _0x5b3186[_0xfd75('0x1e')]();};}function saveUpdates(_0x4d4560,_0x2be10b){return function(_0x33ef87){if(_0x33ef87){return _0x33ef87[_0xfd75('0x1f')](_0x4d4560)[_0xfd75('0x20')](function(_0x3bba8b){return _0x3bba8b;});}return null;};}function removeEntity(_0x42c501,_0x2fdab0){return function(_0x36444f){if(_0x36444f){return _0x36444f['destroy']()['then'](function(){_0x42c501['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ee65e,_0xbfffe7){return function(_0x5f19d3){if(!_0x5f19d3){_0x1ee65e[_0xfd75('0x21')](0x194);}return _0x5f19d3;};}function handleError(_0xb10214,_0x3fcbda){_0x3fcbda=_0x3fcbda||0x1f4;return function(_0x18f668){logger[_0xfd75('0x22')](_0x18f668[_0xfd75('0x23')]);if(_0x18f668[_0xfd75('0x24')]){delete _0x18f668[_0xfd75('0x24')];}_0xb10214[_0xfd75('0x16')](_0x3fcbda)[_0xfd75('0x25')](_0x18f668);};}exports[_0xfd75('0x26')]=function(_0x425189,_0x42026){var _0x24a953={},_0x53f945={},_0x70f62d={'count':0x0,'rows':[]};var _0x1b19df=_['map'](db[_0xfd75('0x27')]['rawAttributes'],function(_0x15570b){return{'name':_0x15570b[_0xfd75('0x28')],'type':_0x15570b['type'][_0xfd75('0x29')]};});_0x53f945[_0xfd75('0x2a')]=_[_0xfd75('0x2b')](_0x1b19df,'name');_0x53f945[_0xfd75('0x2c')]=_[_0xfd75('0x2d')](_0x425189[_0xfd75('0x2c')]);_0x53f945['filters']=_[_0xfd75('0x2e')](_0x53f945['model'],_0x53f945['query']);_0x24a953[_0xfd75('0x2f')]=_[_0xfd75('0x2e')](_0x53f945['model'],qs[_0xfd75('0x30')](_0x425189[_0xfd75('0x2c')][_0xfd75('0x30')]));_0x24a953[_0xfd75('0x2f')]=_0x24a953[_0xfd75('0x2f')][_0xfd75('0x31')]?_0x24a953[_0xfd75('0x2f')]:_0x53f945['model'];if(!_0x425189[_0xfd75('0x2c')][_0xfd75('0x32')](_0xfd75('0x33'))){_0x24a953[_0xfd75('0x1a')]=qs[_0xfd75('0x1a')](_0x425189[_0xfd75('0x2c')]['limit']);_0x24a953[_0xfd75('0x18')]=qs[_0xfd75('0x18')](_0x425189['query']['offset']);}_0x24a953[_0xfd75('0x34')]=qs[_0xfd75('0x35')](_0x425189[_0xfd75('0x2c')]['sort']);_0x24a953[_0xfd75('0x36')]=qs[_0xfd75('0x37')](_[_0xfd75('0x38')](_0x425189['query'],_0x53f945[_0xfd75('0x37')]),_0x1b19df);if(_0x425189[_0xfd75('0x2c')][_0xfd75('0x39')]){_0x24a953['where']=_[_0xfd75('0x3a')](_0x24a953['where'],{'$or':_[_0xfd75('0x2b')](_0x1b19df,function(_0xb88549){if(_0xb88549['type']!==_0xfd75('0x3b')){var _0x11e5b9={};_0x11e5b9[_0xb88549['name']]={'$like':'%'+_0x425189[_0xfd75('0x2c')][_0xfd75('0x39')]+'%'};return _0x11e5b9;}})});}_0x24a953=_['merge']({},_0x24a953,_0x425189['options']);var _0x361805={'where':_0x24a953['where']};return db[_0xfd75('0x27')]['count'](_0x361805)[_0xfd75('0x20')](function(_0x4b76fe){_0x70f62d[_0xfd75('0x1b')]=_0x4b76fe;if(_0x425189[_0xfd75('0x2c')]['includeAll']){_0x24a953[_0xfd75('0x3c')]=[{'all':!![]}];}return db[_0xfd75('0x27')]['findAll'](_0x24a953);})[_0xfd75('0x20')](function(_0x726352){_0x70f62d[_0xfd75('0x3d')]=_0x726352;return _0x70f62d;})[_0xfd75('0x20')](respondWithFilteredResult(_0x42026,_0x24a953))[_0xfd75('0x3e')](handleError(_0x42026,null));};exports['show']=function(_0x56618a,_0xd8b7db){var _0x4d0b16={'raw':!![],'where':{'id':_0x56618a[_0xfd75('0x3f')]['id']}},_0x205a94={};_0x205a94[_0xfd75('0x2a')]=_[_0xfd75('0x2d')](db['SmsTransferReport'][_0xfd75('0x40')]);_0x205a94[_0xfd75('0x2c')]=_[_0xfd75('0x2d')](_0x56618a['query']);_0x205a94[_0xfd75('0x37')]=_['intersection'](_0x205a94[_0xfd75('0x2a')],_0x205a94[_0xfd75('0x2c')]);_0x4d0b16['attributes']=_['intersection'](_0x205a94[_0xfd75('0x2a')],qs['fields'](_0x56618a[_0xfd75('0x2c')]['fields']));_0x4d0b16[_0xfd75('0x2f')]=_0x4d0b16[_0xfd75('0x2f')][_0xfd75('0x31')]?_0x4d0b16[_0xfd75('0x2f')]:_0x205a94[_0xfd75('0x2a')];if(_0x56618a['query'][_0xfd75('0x41')]){_0x4d0b16[_0xfd75('0x3c')]=[{'all':!![]}];}_0x4d0b16=_[_0xfd75('0x3a')]({},_0x4d0b16,_0x56618a[_0xfd75('0x42')]);return db[_0xfd75('0x27')][_0xfd75('0x43')](_0x4d0b16)[_0xfd75('0x20')](handleEntityNotFound(_0xd8b7db,null))[_0xfd75('0x20')](respondWithResult(_0xd8b7db,null))[_0xfd75('0x3e')](handleError(_0xd8b7db,null));};exports['create']=function(_0x5f21d5,_0x265c01){return db[_0xfd75('0x27')]['create'](_0x5f21d5[_0xfd75('0x44')],{})['then'](respondWithResult(_0x265c01,0xc9))[_0xfd75('0x3e')](handleError(_0x265c01,null));};exports['update']=function(_0x528d71,_0x286b6e){if(_0x528d71['body']['id']){delete _0x528d71['body']['id'];}return db[_0xfd75('0x27')][_0xfd75('0x43')]({'where':{'id':_0x528d71[_0xfd75('0x3f')]['id']}})[_0xfd75('0x20')](handleEntityNotFound(_0x286b6e,null))[_0xfd75('0x20')](saveUpdates(_0x528d71['body'],null))[_0xfd75('0x20')](respondWithResult(_0x286b6e,null))['catch'](handleError(_0x286b6e,null));};exports[_0xfd75('0x45')]=function(_0x310540,_0x92c62a){return db['SmsTransferReport'][_0xfd75('0x43')]({'where':{'id':_0x310540[_0xfd75('0x3f')]['id']}})[_0xfd75('0x20')](handleEntityNotFound(_0x92c62a,null))[_0xfd75('0x20')](removeEntity(_0x92c62a,null))[_0xfd75('0x3e')](handleError(_0x92c62a,null));};exports['describe']=function(_0x26ac78,_0x1a17fc){return db[_0xfd75('0x27')][_0xfd75('0x46')]()[_0xfd75('0x20')](respondWithResult(_0x1a17fc,null))[_0xfd75('0x3e')](handleError(_0x1a17fc,null));}; \ No newline at end of file +var _0x2782=['Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','SmsTransferReport','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set'];(function(_0x1371f4,_0x51abc4){var _0x646089=function(_0x3a9a8d){while(--_0x3a9a8d){_0x1371f4['push'](_0x1371f4['shift']());}};_0x646089(++_0x51abc4);}(_0x2782,0x166));var _0x2278=function(_0x4ed4d2,_0x47acf7){_0x4ed4d2=_0x4ed4d2-0x0;var _0x15ae2e=_0x2782[_0x4ed4d2];return _0x15ae2e;};'use strict';var emlformat=require(_0x2278('0x0'));var rimraf=require(_0x2278('0x1'));var zipdir=require(_0x2278('0x2'));var jsonpatch=require(_0x2278('0x3'));var rp=require(_0x2278('0x4'));var moment=require(_0x2278('0x5'));var BPromise=require(_0x2278('0x6'));var Mustache=require(_0x2278('0x7'));var util=require(_0x2278('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2278('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2278('0xa'));var squel=require(_0x2278('0xb'));var crypto=require(_0x2278('0xc'));var jsforce=require(_0x2278('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2278('0xe'));var querystring=require('querystring');var Papa=require(_0x2278('0xf'));var Redis=require(_0x2278('0x10'));var authService=require(_0x2278('0x11'));var qs=require(_0x2278('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2278('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x2278('0x14'));var config=require(_0x2278('0x15'));var licenseUtil=require(_0x2278('0x16'));var db=require(_0x2278('0x17'))['db'];function respondWithStatusCode(_0x311378,_0x365c43){_0x365c43=_0x365c43||0xcc;return function(_0xed610){if(_0xed610){return _0x311378[_0x2278('0x18')](_0x365c43);}return _0x311378[_0x2278('0x19')](_0x365c43)['end']();};}function respondWithResult(_0x332eef,_0x4fef31){_0x4fef31=_0x4fef31||0xc8;return function(_0x3f4161){if(_0x3f4161){return _0x332eef['status'](_0x4fef31)[_0x2278('0x1a')](_0x3f4161);}};}function respondWithFilteredResult(_0x3d38d1,_0x541351){return function(_0x1cc442){if(_0x1cc442){var _0x51e90b=typeof _0x541351[_0x2278('0x1b')]===_0x2278('0x1c')&&typeof _0x541351[_0x2278('0x1d')]===_0x2278('0x1c');var _0x57e924=_0x1cc442[_0x2278('0x1e')];var _0x1d59ec=_0x51e90b?0x0:_0x541351[_0x2278('0x1b')];var _0x2cfcbb=_0x51e90b?_0x1cc442[_0x2278('0x1e')]:_0x541351[_0x2278('0x1b')]+_0x541351['limit'];var _0x3ceee4;if(_0x2cfcbb>=_0x57e924){_0x2cfcbb=_0x57e924;_0x3ceee4=0xc8;}else{_0x3ceee4=0xce;}_0x3d38d1[_0x2278('0x19')](_0x3ceee4);return _0x3d38d1[_0x2278('0x1f')](_0x2278('0x20'),_0x1d59ec+'-'+_0x2cfcbb+'/'+_0x57e924)[_0x2278('0x1a')](_0x1cc442);}return null;};}function patchUpdates(_0x157c6f){return function(_0x5535ae){try{jsonpatch[_0x2278('0x21')](_0x5535ae,_0x157c6f,!![]);}catch(_0x1ee4de){return BPromise[_0x2278('0x22')](_0x1ee4de);}return _0x5535ae[_0x2278('0x23')]();};}function saveUpdates(_0x2a0d9a,_0x44aa88){return function(_0x5bd512){if(_0x5bd512){return _0x5bd512[_0x2278('0x24')](_0x2a0d9a)[_0x2278('0x25')](function(_0x6b2b67){return _0x6b2b67;});}return null;};}function removeEntity(_0x378ca3,_0x298935){return function(_0x541cda){if(_0x541cda){return _0x541cda[_0x2278('0x26')]()[_0x2278('0x25')](function(){_0x378ca3[_0x2278('0x19')](0xcc)[_0x2278('0x27')]();});}};}function handleEntityNotFound(_0xd09b63,_0x5676b1){return function(_0x5b4fd1){if(!_0x5b4fd1){_0xd09b63['sendStatus'](0x194);}return _0x5b4fd1;};}function handleError(_0x3c7927,_0x1a8e21){_0x1a8e21=_0x1a8e21||0x1f4;return function(_0x3016af){logger['error'](_0x3016af[_0x2278('0x28')]);if(_0x3016af[_0x2278('0x29')]){delete _0x3016af['name'];}_0x3c7927[_0x2278('0x19')](_0x1a8e21)[_0x2278('0x2a')](_0x3016af);};}exports[_0x2278('0x2b')]=function(_0x330ef3,_0x1547f3){var _0x5e1a5b={},_0x16852d={},_0x330889={'count':0x0,'rows':[]};var _0x42f929=_[_0x2278('0x2c')](db['SmsTransferReport'][_0x2278('0x2d')],function(_0x146286){return{'name':_0x146286[_0x2278('0x2e')],'type':_0x146286[_0x2278('0x2f')][_0x2278('0x30')]};});_0x16852d[_0x2278('0x31')]=_[_0x2278('0x2c')](_0x42f929,_0x2278('0x29'));_0x16852d['query']=_[_0x2278('0x32')](_0x330ef3[_0x2278('0x33')]);_0x16852d[_0x2278('0x34')]=_[_0x2278('0x35')](_0x16852d[_0x2278('0x31')],_0x16852d[_0x2278('0x33')]);_0x5e1a5b['attributes']=_[_0x2278('0x35')](_0x16852d[_0x2278('0x31')],qs[_0x2278('0x36')](_0x330ef3[_0x2278('0x33')][_0x2278('0x36')]));_0x5e1a5b[_0x2278('0x37')]=_0x5e1a5b[_0x2278('0x37')][_0x2278('0x38')]?_0x5e1a5b[_0x2278('0x37')]:_0x16852d[_0x2278('0x31')];if(!_0x330ef3[_0x2278('0x33')][_0x2278('0x39')]('nolimit')){_0x5e1a5b['limit']=qs['limit'](_0x330ef3[_0x2278('0x33')][_0x2278('0x1d')]);_0x5e1a5b['offset']=qs[_0x2278('0x1b')](_0x330ef3[_0x2278('0x33')][_0x2278('0x1b')]);}_0x5e1a5b[_0x2278('0x3a')]=qs['sort'](_0x330ef3['query'][_0x2278('0x3b')]);_0x5e1a5b[_0x2278('0x3c')]=qs[_0x2278('0x34')](_[_0x2278('0x3d')](_0x330ef3['query'],_0x16852d[_0x2278('0x34')]),_0x42f929);if(_0x330ef3[_0x2278('0x33')][_0x2278('0x3e')]){_0x5e1a5b[_0x2278('0x3c')]=_['merge'](_0x5e1a5b[_0x2278('0x3c')],{'$or':_[_0x2278('0x2c')](_0x42f929,function(_0x5760ee){if(_0x5760ee['type']!==_0x2278('0x3f')){var _0x65529d={};_0x65529d[_0x5760ee[_0x2278('0x29')]]={'$like':'%'+_0x330ef3['query']['filter']+'%'};return _0x65529d;}})});}_0x5e1a5b=_[_0x2278('0x40')]({},_0x5e1a5b,_0x330ef3['options']);var _0x51887b={'where':_0x5e1a5b[_0x2278('0x3c')]};return db[_0x2278('0x41')]['count'](_0x51887b)['then'](function(_0x55de0d){_0x330889[_0x2278('0x1e')]=_0x55de0d;if(_0x330ef3[_0x2278('0x33')][_0x2278('0x42')]){_0x5e1a5b[_0x2278('0x43')]=[{'all':!![]}];}return db[_0x2278('0x41')][_0x2278('0x44')](_0x5e1a5b);})[_0x2278('0x25')](function(_0x482cd2){_0x330889[_0x2278('0x45')]=_0x482cd2;return _0x330889;})['then'](respondWithFilteredResult(_0x1547f3,_0x5e1a5b))[_0x2278('0x46')](handleError(_0x1547f3,null));};exports[_0x2278('0x47')]=function(_0x3f0f07,_0x4381e0){var _0x3a3002={'raw':!![],'where':{'id':_0x3f0f07[_0x2278('0x48')]['id']}},_0x677ff3={};_0x677ff3[_0x2278('0x31')]=_['keys'](db[_0x2278('0x41')][_0x2278('0x2d')]);_0x677ff3[_0x2278('0x33')]=_['keys'](_0x3f0f07[_0x2278('0x33')]);_0x677ff3[_0x2278('0x34')]=_[_0x2278('0x35')](_0x677ff3['model'],_0x677ff3['query']);_0x3a3002[_0x2278('0x37')]=_[_0x2278('0x35')](_0x677ff3[_0x2278('0x31')],qs['fields'](_0x3f0f07[_0x2278('0x33')]['fields']));_0x3a3002[_0x2278('0x37')]=_0x3a3002[_0x2278('0x37')]['length']?_0x3a3002[_0x2278('0x37')]:_0x677ff3['model'];if(_0x3f0f07[_0x2278('0x33')][_0x2278('0x42')]){_0x3a3002[_0x2278('0x43')]=[{'all':!![]}];}_0x3a3002=_['merge']({},_0x3a3002,_0x3f0f07[_0x2278('0x49')]);return db[_0x2278('0x41')][_0x2278('0x4a')](_0x3a3002)[_0x2278('0x25')](handleEntityNotFound(_0x4381e0,null))['then'](respondWithResult(_0x4381e0,null))[_0x2278('0x46')](handleError(_0x4381e0,null));};exports[_0x2278('0x4b')]=function(_0x57854a,_0x12e3fd){return db[_0x2278('0x41')][_0x2278('0x4b')](_0x57854a['body'],{})[_0x2278('0x25')](respondWithResult(_0x12e3fd,0xc9))[_0x2278('0x46')](handleError(_0x12e3fd,null));};exports['update']=function(_0x5d2a07,_0x10b9be){if(_0x5d2a07[_0x2278('0x4c')]['id']){delete _0x5d2a07[_0x2278('0x4c')]['id'];}return db[_0x2278('0x41')][_0x2278('0x4a')]({'where':{'id':_0x5d2a07[_0x2278('0x48')]['id']}})[_0x2278('0x25')](handleEntityNotFound(_0x10b9be,null))['then'](saveUpdates(_0x5d2a07[_0x2278('0x4c')],null))[_0x2278('0x25')](respondWithResult(_0x10b9be,null))[_0x2278('0x46')](handleError(_0x10b9be,null));};exports[_0x2278('0x26')]=function(_0x300a77,_0x5ef349){return db[_0x2278('0x41')][_0x2278('0x4a')]({'where':{'id':_0x300a77[_0x2278('0x48')]['id']}})[_0x2278('0x25')](handleEntityNotFound(_0x5ef349,null))['then'](removeEntity(_0x5ef349,null))[_0x2278('0x46')](handleError(_0x5ef349,null));};exports[_0x2278('0x4d')]=function(_0x3c4220,_0xc83970){return db[_0x2278('0x41')][_0x2278('0x4d')]()[_0x2278('0x25')](respondWithResult(_0xc83970,null))[_0x2278('0x46')](handleError(_0xc83970,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index e4e78cd..b632f47 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 _0x34e5=['moment','bluebird','request-promise','path','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','uniqueid','util','api'];(function(_0x594b04,_0x276b8b){var _0x3e0343=function(_0x425473){while(--_0x425473){_0x594b04['push'](_0x594b04['shift']());}};_0x3e0343(++_0x276b8b);}(_0x34e5,0x172));var _0x534e=function(_0x532c2e,_0x4de82b){_0x532c2e=_0x532c2e-0x0;var _0x2d3b47=_0x34e5[_0x532c2e];return _0x2d3b47;};'use strict';var _=require('lodash');var util=require(_0x534e('0x0'));var logger=require('../../config/logger')(_0x534e('0x1'));var moment=require(_0x534e('0x2'));var BPromise=require(_0x534e('0x3'));var rp=require(_0x534e('0x4'));var fs=require('fs');var path=require(_0x534e('0x5'));var rimraf=require('rimraf');var config=require(_0x534e('0x6'));var attributes=require(_0x534e('0x7'));module[_0x534e('0x8')]=function(_0x117f0c,_0x436a92){return _0x117f0c[_0x534e('0x9')](_0x534e('0xa'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x534e('0xb'),'fields':[_0x534e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x91f6=['exports','SmsTransferReport','report_sms_transfer','uniqueid','../../config/logger','moment','request-promise','rimraf','../../config/environment','./smsTransferReport.attributes'];(function(_0x37829c,_0x1a9992){var _0xaeaa8c=function(_0x142323){while(--_0x142323){_0x37829c['push'](_0x37829c['shift']());}};_0xaeaa8c(++_0x1a9992);}(_0x91f6,0x7c));var _0x691f=function(_0xf1a3d0,_0x289e5c){_0xf1a3d0=_0xf1a3d0-0x0;var _0x591ba1=_0x91f6[_0xf1a3d0];return _0x591ba1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x691f('0x0'))('api');var moment=require(_0x691f('0x1'));var BPromise=require('bluebird');var rp=require(_0x691f('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x691f('0x3'));var config=require(_0x691f('0x4'));var attributes=require(_0x691f('0x5'));module[_0x691f('0x6')]=function(_0x479ef7,_0x3c5412){return _0x479ef7['define'](_0x691f('0x7'),attributes,{'tableName':_0x691f('0x8'),'paranoid':![],'indexes':[{'name':_0x691f('0x9'),'fields':[_0x691f('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index a7b860f..8b36aa1 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 _0x5089=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x5ef55a,_0x2a03b1){var _0x20ae40=function(_0x46ce81){while(--_0x46ce81){_0x5ef55a['push'](_0x5ef55a['shift']());}};_0x20ae40(++_0x2a03b1);}(_0x5089,0x1bb));var _0x9508=function(_0x58803c,_0x4a34df){_0x58803c=_0x58803c-0x0;var _0xf95b9b=_0x5089[_0x58803c];return _0xf95b9b;};'use strict';var _=require(_0x9508('0x0'));var util=require(_0x9508('0x1'));var moment=require('moment');var BPromise=require(_0x9508('0x2'));var rs=require(_0x9508('0x3'));var fs=require('fs');var Redis=require(_0x9508('0x4'));var db=require(_0x9508('0x5'))['db'];var utils=require(_0x9508('0x6'));var logger=require('../../config/logger')(_0x9508('0x7'));var config=require('../../config/environment');var jayson=require(_0x9508('0x8'));var client=jayson[_0x9508('0x9')][_0x9508('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ab3c6,_0x1dc04c,_0x42d13a){return new BPromise(function(_0x55a5de,_0x14dae7){return client[_0x9508('0xb')](_0x4ab3c6,_0x42d13a)['then'](function(_0x342ddd){logger['info'](_0x9508('0xc'),_0x1dc04c,_0x9508('0xd'));logger[_0x9508('0xe')](_0x9508('0xf'),_0x1dc04c,_0x9508('0xd'),JSON[_0x9508('0x10')](_0x342ddd));if(_0x342ddd['error']){if(_0x342ddd[_0x9508('0x11')]['code']===0x1f4){logger[_0x9508('0x11')](_0x9508('0xc'),_0x1dc04c,_0x342ddd['error'][_0x9508('0x12')]);return _0x14dae7(_0x342ddd[_0x9508('0x11')][_0x9508('0x12')]);}logger[_0x9508('0x11')]('SmsTransferReport,\x20%s,\x20%s',_0x1dc04c,_0x342ddd[_0x9508('0x11')][_0x9508('0x12')]);return _0x55a5de(_0x342ddd['error'][_0x9508('0x12')]);}else{logger['info'](_0x9508('0xc'),_0x1dc04c,_0x9508('0xd'));_0x55a5de(_0x342ddd[_0x9508('0x13')][_0x9508('0x12')]);}})[_0x9508('0x14')](function(_0x343802){logger[_0x9508('0x11')](_0x9508('0xc'),_0x1dc04c,_0x343802);_0x14dae7(_0x343802);});});} \ No newline at end of file +var _0xf360=['error','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xa132f9,_0x32f20d){var _0x342190=function(_0x350278){while(--_0x350278){_0xa132f9['push'](_0xa132f9['shift']());}};_0x342190(++_0x32f20d);}(_0xf360,0x9e));var _0x0f36=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xf360[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x0f36('0x0'));var util=require(_0x0f36('0x1'));var moment=require(_0x0f36('0x2'));var BPromise=require('bluebird');var rs=require(_0x0f36('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0f36('0x4'))['db'];var utils=require(_0x0f36('0x5'));var logger=require(_0x0f36('0x6'))('rpc');var config=require(_0x0f36('0x7'));var jayson=require(_0x0f36('0x8'));var client=jayson[_0x0f36('0x9')][_0x0f36('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2db632,_0x259878,_0x2d4bb7){return new BPromise(function(_0x370193,_0x5c356f){return client[_0x0f36('0xb')](_0x2db632,_0x2d4bb7)[_0x0f36('0xc')](function(_0x47718b){logger[_0x0f36('0xd')](_0x0f36('0xe'),_0x259878,_0x0f36('0xf'));logger['debug'](_0x0f36('0x10'),_0x259878,_0x0f36('0xf'),JSON[_0x0f36('0x11')](_0x47718b));if(_0x47718b['error']){if(_0x47718b[_0x0f36('0x12')]['code']===0x1f4){logger['error'](_0x0f36('0xe'),_0x259878,_0x47718b[_0x0f36('0x12')]['message']);return _0x5c356f(_0x47718b[_0x0f36('0x12')][_0x0f36('0x13')]);}logger[_0x0f36('0x12')](_0x0f36('0xe'),_0x259878,_0x47718b['error'][_0x0f36('0x13')]);return _0x370193(_0x47718b['error'][_0x0f36('0x13')]);}else{logger[_0x0f36('0xd')](_0x0f36('0xe'),_0x259878,_0x0f36('0xf'));_0x370193(_0x47718b[_0x0f36('0x14')][_0x0f36('0x13')]);}})[_0x0f36('0x15')](function(_0x486739){logger['error'](_0x0f36('0xe'),_0x259878,_0x486739);_0x5c356f(_0x486739);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 0557a9d..2214ce1 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 _0x60d6=['delete','/:id','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','show','/:id/download','download','diskStorage','join','root','originalname','extname','now','post','create','update'];(function(_0x1098eb,_0xee2701){var _0x12d9cf=function(_0x22dfa9){while(--_0x22dfa9){_0x1098eb['push'](_0x1098eb['shift']());}};_0x12d9cf(++_0xee2701);}(_0x60d6,0x110));var _0x660d=function(_0x3f95a4,_0x480a0f){_0x3f95a4=_0x3f95a4-0x0;var _0x5157c2=_0x60d6[_0x3f95a4];return _0x5157c2;};'use strict';var multer=require(_0x660d('0x0'));var util=require(_0x660d('0x1'));var path=require(_0x660d('0x2'));var timeout=require(_0x660d('0x3'));var express=require(_0x660d('0x4'));var router=express[_0x660d('0x5')]();var fs_extra=require(_0x660d('0x6'));var auth=require(_0x660d('0x7'));var interaction=require(_0x660d('0x8'));var config=require(_0x660d('0x9'));var controller=require(_0x660d('0xa'));router[_0x660d('0xb')]('/',auth[_0x660d('0xc')](),controller['index']);router['get']('/:id',auth[_0x660d('0xc')](),controller[_0x660d('0xd')]);router[_0x660d('0xb')](_0x660d('0xe'),auth[_0x660d('0xc')](),controller[_0x660d('0xf')]);var upload=multer({'storage':multer[_0x660d('0x10')]({'destination':function(_0x129705,_0x2c26c8,_0x308316){_0x308316(null,path[_0x660d('0x11')](config[_0x660d('0x12')],'server/files/sounds/original/'));},'filename':function(_0x1c786b,_0x24609c,_0x2df187){_0x24609c['originalname']=_0x24609c['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2df187(null,util['format']('%s-%s%s',path['basename'](_0x24609c[_0x660d('0x13')],path[_0x660d('0x14')](_0x24609c['originalname'])),Date[_0x660d('0x15')](),path[_0x660d('0x14')](_0x24609c[_0x660d('0x13')])));}})});router[_0x660d('0x16')]('/',upload['single']('file'),controller[_0x660d('0x17')]);router['put']('/:id',auth[_0x660d('0xc')](),controller[_0x660d('0x18')]);router[_0x660d('0x19')](_0x660d('0x1a'),auth[_0x660d('0xc')](),controller[_0x660d('0x19')]);module['exports']=router; \ No newline at end of file +var _0x3c75=['now','post','single','file','create','put','/:id','delete','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./sound.controller','get','isAuthenticated','show','/:id/download','diskStorage','join','root','server/files/sounds/original/','originalname','format','%s-%s%s','basename','extname'];(function(_0x36cff7,_0x5cb048){var _0x21c697=function(_0x1aab10){while(--_0x1aab10){_0x36cff7['push'](_0x36cff7['shift']());}};_0x21c697(++_0x5cb048);}(_0x3c75,0x1e4));var _0x53c7=function(_0x39700f,_0x4fbfb7){_0x39700f=_0x39700f-0x0;var _0x2c2453=_0x3c75[_0x39700f];return _0x2c2453;};'use strict';var multer=require('multer');var util=require(_0x53c7('0x0'));var path=require(_0x53c7('0x1'));var timeout=require(_0x53c7('0x2'));var express=require(_0x53c7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x53c7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x53c7('0x5'));var controller=require(_0x53c7('0x6'));router[_0x53c7('0x7')]('/',auth[_0x53c7('0x8')](),controller['index']);router['get']('/:id',auth[_0x53c7('0x8')](),controller[_0x53c7('0x9')]);router[_0x53c7('0x7')](_0x53c7('0xa'),auth[_0x53c7('0x8')](),controller['download']);var upload=multer({'storage':multer[_0x53c7('0xb')]({'destination':function(_0xe5cb45,_0x2030d8,_0x50a961){_0x50a961(null,path[_0x53c7('0xc')](config[_0x53c7('0xd')],_0x53c7('0xe')));},'filename':function(_0x14d350,_0x5471d3,_0x533386){_0x5471d3[_0x53c7('0xf')]=_0x5471d3[_0x53c7('0xf')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x533386(null,util[_0x53c7('0x10')](_0x53c7('0x11'),path[_0x53c7('0x12')](_0x5471d3[_0x53c7('0xf')],path[_0x53c7('0x13')](_0x5471d3[_0x53c7('0xf')])),Date[_0x53c7('0x14')](),path['extname'](_0x5471d3[_0x53c7('0xf')])));}})});router[_0x53c7('0x15')]('/',upload[_0x53c7('0x16')](_0x53c7('0x17')),controller[_0x53c7('0x18')]);router[_0x53c7('0x19')](_0x53c7('0x1a'),auth[_0x53c7('0x8')](),controller['update']);router[_0x53c7('0x1b')](_0x53c7('0x1a'),auth['isAuthenticated'](),controller[_0x53c7('0x1b')]);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 1f082b8..13490d9 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 _0x18a2=['name','FLOAT','BIGINT','INTEGER','sequelize','exports','STRING'];(function(_0x1177d5,_0x22b649){var _0xc3ddc2=function(_0x43ff95){while(--_0x43ff95){_0x1177d5['push'](_0x1177d5['shift']());}};_0xc3ddc2(++_0x22b649);}(_0x18a2,0x1d9));var _0x218a=function(_0x2a473f,_0x3b24df){_0x2a473f=_0x2a473f-0x0;var _0x137c0e=_0x18a2[_0x2a473f];return _0x137c0e;};'use strict';var Sequelize=require(_0x218a('0x0'));module[_0x218a('0x1')]={'name':{'type':Sequelize[_0x218a('0x2')],'unique':_0x218a('0x3'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x218a('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x218a('0x2')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x218a('0x4')]},'original_sampleCount':{'type':Sequelize[_0x218a('0x5')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x218a('0x5')]},'original_sampleRate':{'type':Sequelize[_0x218a('0x6')]},'converted_format':{'type':Sequelize[_0x218a('0x2')]},'converted_duration':{'type':Sequelize[_0x218a('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x218a('0x5')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x218a('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x218a('0x6')]}}; \ No newline at end of file +var _0x6445=['INTEGER','BIGINT','FLOAT','sequelize','exports','STRING','name'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x6445,0x88));var _0x5644=function(_0x377c6e,_0x2d15c5){_0x377c6e=_0x377c6e-0x0;var _0x2d93c8=_0x6445[_0x377c6e];return _0x2d93c8;};'use strict';var Sequelize=require(_0x5644('0x0'));module[_0x5644('0x1')]={'name':{'type':Sequelize[_0x5644('0x2')],'unique':_0x5644('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x5644('0x2')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x5644('0x2')]},'original_format':{'type':Sequelize[_0x5644('0x2')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x5644('0x4')]},'original_bitRate':{'type':Sequelize[_0x5644('0x5')]},'original_sampleRate':{'type':Sequelize[_0x5644('0x4')]},'converted_format':{'type':Sequelize[_0x5644('0x2')]},'converted_duration':{'type':Sequelize[_0x5644('0x6')]},'converted_sampleCount':{'type':Sequelize[_0x5644('0x5')]},'converted_channelCount':{'type':Sequelize[_0x5644('0x4')]},'converted_bitRate':{'type':Sequelize[_0x5644('0x5')]},'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 0b6b654..d541533 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 _0x6d5b=['params','save_name','converted_format','existsSync','root','server/files/sounds/converted','join','format','%s.%s','create','basename','file','originalname','extname','filename','wav','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','error','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Sounds','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','server/files/sounds/original','original_format','zip-dir','fast-json-patch','mustache','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','get','stack','name','send','index','map','rawAttributes','type','key','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','Sound','include','rows','catch','show','keys','includeAll','find','download'];(function(_0xa46a22,_0x5e0979){var _0x36aa7a=function(_0x133e65){while(--_0x133e65){_0xa46a22['push'](_0xa46a22['shift']());}};_0x36aa7a(++_0x5e0979);}(_0x6d5b,0x1a7));var _0xb6d5=function(_0x437560,_0xc5d67f){_0x437560=_0x437560-0x0;var _0x278361=_0x6d5b[_0x437560];return _0x278361;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb6d5('0x0'));var jsonpatch=require(_0xb6d5('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb6d5('0x2'));var util=require('util');var path=require(_0xb6d5('0x3'));var sox=require(_0xb6d5('0x4'));var csv=require(_0xb6d5('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb6d5('0x6'));var _=require(_0xb6d5('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb6d5('0x8'));var deskjs=require(_0xb6d5('0x9'));var toCsv=require(_0xb6d5('0x5'));var querystring=require(_0xb6d5('0xa'));var Papa=require('papaparse');var Redis=require(_0xb6d5('0xb'));var authService=require(_0xb6d5('0xc'));var qs=require(_0xb6d5('0xd'));var as=require(_0xb6d5('0xe'));var hardwareService=require(_0xb6d5('0xf'));var logger=require(_0xb6d5('0x10'))(_0xb6d5('0x11'));var utils=require(_0xb6d5('0x12'));var config=require(_0xb6d5('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x498103,_0x4ad940){_0x4ad940=_0x4ad940||0xcc;return function(_0x25753f){if(_0x25753f){return _0x498103[_0xb6d5('0x14')](_0x4ad940);}return _0x498103[_0xb6d5('0x15')](_0x4ad940)[_0xb6d5('0x16')]();};}function respondWithResult(_0x1313c5,_0x5ded78){_0x5ded78=_0x5ded78||0xc8;return function(_0x30079b){if(_0x30079b){return _0x1313c5[_0xb6d5('0x15')](_0x5ded78)[_0xb6d5('0x17')](_0x30079b);}};}function respondWithFilteredResult(_0x44f655,_0x1cb156){return function(_0x41c30f){if(_0x41c30f){var _0x4a54ba=typeof _0x1cb156[_0xb6d5('0x18')]===_0xb6d5('0x19')&&typeof _0x1cb156[_0xb6d5('0x1a')]===_0xb6d5('0x19');var _0x234873=_0x41c30f[_0xb6d5('0x1b')];var _0xcec757=_0x4a54ba?0x0:_0x1cb156[_0xb6d5('0x18')];var _0x4bd236=_0x4a54ba?_0x41c30f[_0xb6d5('0x1b')]:_0x1cb156['offset']+_0x1cb156[_0xb6d5('0x1a')];var _0x29dca5;if(_0x4bd236>=_0x234873){_0x4bd236=_0x234873;_0x29dca5=0xc8;}else{_0x29dca5=0xce;}_0x44f655['status'](_0x29dca5);return _0x44f655['set'](_0xb6d5('0x1c'),_0xcec757+'-'+_0x4bd236+'/'+_0x234873)[_0xb6d5('0x17')](_0x41c30f);}return null;};}function patchUpdates(_0x5546d5){return function(_0x5607c6){try{jsonpatch[_0xb6d5('0x1d')](_0x5607c6,_0x5546d5,!![]);}catch(_0x6c87f3){return BPromise[_0xb6d5('0x1e')](_0x6c87f3);}return _0x5607c6['save']();};}function saveUpdates(_0x27af4d,_0x5414ae){return function(_0x710654){if(_0x710654){return _0x710654[_0xb6d5('0x1f')](_0x27af4d)[_0xb6d5('0x20')](function(_0x295c5a){return _0x295c5a;});}return null;};}function removeEntity(_0xff85ae,_0x3bbf08){return function(_0x54d0e6){if(_0x54d0e6){return _0x54d0e6[_0xb6d5('0x21')]()[_0xb6d5('0x20')](function(){var _0x4fac14=_0x54d0e6[_0xb6d5('0x22')]({'plain':!![]});var _0x3f9e9a='Sounds';return db['UserProfileResource'][_0xb6d5('0x21')]({'where':{'type':_0x3f9e9a,'resourceId':_0x4fac14['id']}})[_0xb6d5('0x20')](function(){return _0x54d0e6;});})[_0xb6d5('0x20')](function(){_0xff85ae['status'](0xcc)[_0xb6d5('0x16')]();});}};}function handleEntityNotFound(_0x113f01,_0x22e30e){return function(_0x7e4231){if(!_0x7e4231){_0x113f01[_0xb6d5('0x14')](0x194);}return _0x7e4231;};}function handleError(_0x3f41b3,_0x224b7e){_0x224b7e=_0x224b7e||0x1f4;return function(_0xdc46e7){logger['error'](_0xdc46e7[_0xb6d5('0x23')]);if(_0xdc46e7[_0xb6d5('0x24')]){delete _0xdc46e7[_0xb6d5('0x24')];}_0x3f41b3[_0xb6d5('0x15')](_0x224b7e)[_0xb6d5('0x25')](_0xdc46e7);};}exports[_0xb6d5('0x26')]=function(_0x420bf9,_0x58c926){var _0x1d0c12={},_0x35262f={},_0x4831ed={'count':0x0,'rows':[]};var _0x239090=_[_0xb6d5('0x27')](db['Sound'][_0xb6d5('0x28')],function(_0x58184b){return{'name':_0x58184b['fieldName'],'type':_0x58184b[_0xb6d5('0x29')][_0xb6d5('0x2a')]};});_0x35262f['model']=_['map'](_0x239090,_0xb6d5('0x24'));_0x35262f[_0xb6d5('0x2b')]=_['keys'](_0x420bf9[_0xb6d5('0x2b')]);_0x35262f[_0xb6d5('0x2c')]=_['intersection'](_0x35262f[_0xb6d5('0x2d')],_0x35262f[_0xb6d5('0x2b')]);_0x1d0c12['attributes']=_[_0xb6d5('0x2e')](_0x35262f['model'],qs['fields'](_0x420bf9[_0xb6d5('0x2b')][_0xb6d5('0x2f')]));_0x1d0c12[_0xb6d5('0x30')]=_0x1d0c12['attributes'][_0xb6d5('0x31')]?_0x1d0c12['attributes']:_0x35262f[_0xb6d5('0x2d')];if(!_0x420bf9[_0xb6d5('0x2b')][_0xb6d5('0x32')](_0xb6d5('0x33'))){_0x1d0c12[_0xb6d5('0x1a')]=qs[_0xb6d5('0x1a')](_0x420bf9[_0xb6d5('0x2b')]['limit']);_0x1d0c12[_0xb6d5('0x18')]=qs['offset'](_0x420bf9[_0xb6d5('0x2b')]['offset']);}_0x1d0c12[_0xb6d5('0x34')]=qs[_0xb6d5('0x35')](_0x420bf9[_0xb6d5('0x2b')]['sort']);_0x1d0c12['where']=qs['filters'](_[_0xb6d5('0x36')](_0x420bf9[_0xb6d5('0x2b')],_0x35262f[_0xb6d5('0x2c')]),_0x239090);if(_0x420bf9[_0xb6d5('0x2b')][_0xb6d5('0x37')]){_0x1d0c12[_0xb6d5('0x38')]=_[_0xb6d5('0x39')](_0x1d0c12[_0xb6d5('0x38')],{'$or':_[_0xb6d5('0x27')](_0x239090,function(_0x2a835a){if(_0x2a835a[_0xb6d5('0x29')]!==_0xb6d5('0x3a')){var _0x5044c6={};_0x5044c6[_0x2a835a[_0xb6d5('0x24')]]={'$like':'%'+_0x420bf9[_0xb6d5('0x2b')][_0xb6d5('0x37')]+'%'};return _0x5044c6;}})});}_0x1d0c12=_[_0xb6d5('0x39')]({},_0x1d0c12,_0x420bf9[_0xb6d5('0x3b')]);var _0x2fc376={'where':_0x1d0c12['where']};return db[_0xb6d5('0x3c')][_0xb6d5('0x1b')](_0x2fc376)['then'](function(_0x4413fe){_0x4831ed[_0xb6d5('0x1b')]=_0x4413fe;if(_0x420bf9[_0xb6d5('0x2b')]['includeAll']){_0x1d0c12[_0xb6d5('0x3d')]=[{'all':!![]}];}return db[_0xb6d5('0x3c')]['findAll'](_0x1d0c12);})[_0xb6d5('0x20')](function(_0x2f3b0c){_0x4831ed[_0xb6d5('0x3e')]=_0x2f3b0c;return _0x4831ed;})['then'](respondWithFilteredResult(_0x58c926,_0x1d0c12))[_0xb6d5('0x3f')](handleError(_0x58c926,null));};exports[_0xb6d5('0x40')]=function(_0x3a4d1c,_0x1ca8d6){var _0x64463e={'raw':!![],'where':{'id':_0x3a4d1c['params']['id']}},_0x25d576={};_0x25d576[_0xb6d5('0x2d')]=_[_0xb6d5('0x41')](db[_0xb6d5('0x3c')][_0xb6d5('0x28')]);_0x25d576[_0xb6d5('0x2b')]=_[_0xb6d5('0x41')](_0x3a4d1c[_0xb6d5('0x2b')]);_0x25d576[_0xb6d5('0x2c')]=_['intersection'](_0x25d576[_0xb6d5('0x2d')],_0x25d576['query']);_0x64463e['attributes']=_['intersection'](_0x25d576[_0xb6d5('0x2d')],qs[_0xb6d5('0x2f')](_0x3a4d1c[_0xb6d5('0x2b')][_0xb6d5('0x2f')]));_0x64463e['attributes']=_0x64463e[_0xb6d5('0x30')][_0xb6d5('0x31')]?_0x64463e[_0xb6d5('0x30')]:_0x25d576[_0xb6d5('0x2d')];if(_0x3a4d1c[_0xb6d5('0x2b')][_0xb6d5('0x42')]){_0x64463e['include']=[{'all':!![]}];}_0x64463e=_[_0xb6d5('0x39')]({},_0x64463e,_0x3a4d1c[_0xb6d5('0x3b')]);return db[_0xb6d5('0x3c')][_0xb6d5('0x43')](_0x64463e)[_0xb6d5('0x20')](handleEntityNotFound(_0x1ca8d6,null))[_0xb6d5('0x20')](respondWithResult(_0x1ca8d6,null))[_0xb6d5('0x3f')](handleError(_0x1ca8d6,null));};exports[_0xb6d5('0x44')]=function(_0x5e2585,_0x28efa3,_0x7e8432){return db[_0xb6d5('0x3c')][_0xb6d5('0x43')]({'where':{'id':_0x5e2585[_0xb6d5('0x45')]['id']},'attributes':[_0xb6d5('0x24'),_0xb6d5('0x46'),_0xb6d5('0x47')],'raw':!![]})['then'](handleEntityNotFound(_0x28efa3,null))[_0xb6d5('0x20')](function(_0x49006e){if(_0x49006e){if(!fs[_0xb6d5('0x48')](path['join'](config[_0xb6d5('0x49')],_0xb6d5('0x4a'),_0x49006e[_0xb6d5('0x46')]+'.'+_0x49006e[_0xb6d5('0x47')]))){throw new db['Sequelize']['ValidationError']('Sound\x20not\x20found');}return _0x28efa3[_0xb6d5('0x44')](path[_0xb6d5('0x4b')](config[_0xb6d5('0x49')],_0xb6d5('0x4a'),util[_0xb6d5('0x4c')](_0xb6d5('0x4d'),_0x49006e[_0xb6d5('0x46')],_0x49006e[_0xb6d5('0x47')])),util['format'](_0xb6d5('0x4d'),_0x49006e[_0xb6d5('0x24')],_0x49006e[_0xb6d5('0x47')]));}return null;})[_0xb6d5('0x3f')](handleError(_0x28efa3,null));};exports[_0xb6d5('0x4e')]=function(_0x2003e7,_0x554e1a,_0x58fc23){var _0xf58373={'name':path[_0xb6d5('0x4f')](_0x2003e7[_0xb6d5('0x50')][_0xb6d5('0x51')],path[_0xb6d5('0x52')](_0x2003e7[_0xb6d5('0x50')][_0xb6d5('0x51')])),'save_name':path[_0xb6d5('0x4f')](_0x2003e7['file']['filename'],path['extname'](_0x2003e7[_0xb6d5('0x50')][_0xb6d5('0x53')])),'original_format':path[_0xb6d5('0x52')](_0x2003e7[_0xb6d5('0x50')][_0xb6d5('0x51')])['substring'](0x1),'converted_format':_0xb6d5('0x54')};var _0xd3469b=path[_0xb6d5('0x4b')](config[_0xb6d5('0x49')],'server/files/sounds/original',_0x2003e7['file'][_0xb6d5('0x53')]);var _0x403f06=path[_0xb6d5('0x4b')](config[_0xb6d5('0x49')],_0xb6d5('0x4a'),util[_0xb6d5('0x4c')](_0xb6d5('0x4d'),path['basename'](_0x2003e7[_0xb6d5('0x50')][_0xb6d5('0x53')],path['extname'](_0x2003e7['file']['filename'])),_0xf58373[_0xb6d5('0x47')]));logger[_0xb6d5('0x55')](_0xb6d5('0x56'),_0xd3469b);logger[_0xb6d5('0x55')](_0xb6d5('0x57'),_0x403f06);try{fs[_0xb6d5('0x58')](_0xd3469b,parseInt(_0xb6d5('0x59'),0x8));var _0x4264f3=sox['transcode'](_0xd3469b,_0x403f06,{'sampleRate':0x1f40,'format':_0xb6d5('0x54'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4264f3['on'](_0xb6d5('0x5a'),function(_0x19d174){fs[_0xb6d5('0x5b')](_0xd3469b);_0x554e1a['status'](0x1f4)[_0xb6d5('0x25')](_0x19d174);});_0x4264f3['on'](_0xb6d5('0x5c'),function(_0x433ac8){_0xf58373[_0xb6d5('0x5d')]=isNaN(_0x433ac8['duration'])?null:_0x433ac8[_0xb6d5('0x5e')]*0x3e8;_0xf58373[_0xb6d5('0x5f')]=isNaN(_0x433ac8[_0xb6d5('0x60')])?null:_0x433ac8[_0xb6d5('0x60')];_0xf58373[_0xb6d5('0x61')]=isNaN(_0x433ac8['channelCount'])?null:_0x433ac8[_0xb6d5('0x62')];_0xf58373[_0xb6d5('0x63')]=isNaN(_0x433ac8[_0xb6d5('0x64')])?null:_0x433ac8[_0xb6d5('0x64')];_0xf58373['original_sampleRate']=isNaN(_0x433ac8['sampleRate'])?null:_0x433ac8[_0xb6d5('0x65')];});_0x4264f3['on'](_0xb6d5('0x66'),function(_0x5420e1){_0xf58373[_0xb6d5('0x67')]=isNaN(_0x5420e1[_0xb6d5('0x5e')])?null:_0x5420e1['duration']*0x3e8;_0xf58373[_0xb6d5('0x68')]=isNaN(_0x5420e1[_0xb6d5('0x60')])?null:_0x5420e1[_0xb6d5('0x60')];_0xf58373[_0xb6d5('0x69')]=isNaN(_0x5420e1[_0xb6d5('0x62')])?null:_0x5420e1[_0xb6d5('0x62')];_0xf58373[_0xb6d5('0x6a')]=isNaN(_0x5420e1[_0xb6d5('0x64')])?null:_0x5420e1[_0xb6d5('0x64')];_0xf58373[_0xb6d5('0x6b')]=isNaN(_0x5420e1[_0xb6d5('0x65')])?null:_0x5420e1['sampleRate'];});_0x4264f3['on'](_0xb6d5('0x16'),function(){fs[_0xb6d5('0x58')](_0x403f06,parseInt('0777',0x8));return db['Sound'][_0xb6d5('0x4e')](_0xf58373)['then'](function(_0x538693){var _0x1b5ec7={'role':_0x2003e7[_0xb6d5('0x6c')][_0xb6d5('0x6d')],'userProfileId':_0x2003e7[_0xb6d5('0x6c')][_0xb6d5('0x6e')]};if(!_0x1b5ec7)throw new Error(_0xb6d5('0x6f'));if(_0x1b5ec7[_0xb6d5('0x6d')]===_0xb6d5('0x70')){var _0x256e77=_0x538693[_0xb6d5('0x22')]({'plain':!![]});return db[_0xb6d5('0x71')][_0xb6d5('0x43')]({'where':{'name':_0xb6d5('0x72'),'userProfileId':_0x1b5ec7['userProfileId']},'raw':!![]})[_0xb6d5('0x20')](function(_0x5e585e){if(_0x5e585e&&_0x5e585e[_0xb6d5('0x73')]===0x0){return db[_0xb6d5('0x74')][_0xb6d5('0x4e')]({'name':_0x256e77['name'],'resourceId':_0x256e77['id'],'type':_0x5e585e[_0xb6d5('0x24')],'sectionId':_0x5e585e['id']},{})[_0xb6d5('0x20')](function(){return _0x538693;});}else{return _0x538693;}})['catch'](function(_0x315ff5){logger[_0xb6d5('0x5a')](_0xb6d5('0x75'),_0x315ff5);throw _0x315ff5;});}return _0x538693;})[_0xb6d5('0x20')](respondWithResult(_0x554e1a,null))[_0xb6d5('0x3f')](handleError(_0x554e1a,null));});_0x4264f3[_0xb6d5('0x76')]();}catch(_0xcce6a0){_0x554e1a[_0xb6d5('0x15')](0x1f4)[_0xb6d5('0x25')](_0xcce6a0);}};exports[_0xb6d5('0x1f')]=function(_0x3e4c02,_0xc87663,_0x27db60){return db[_0xb6d5('0x3c')][_0xb6d5('0x43')]({'where':{'id':_0x3e4c02[_0xb6d5('0x45')]['id']}})[_0xb6d5('0x20')](handleEntityNotFound(_0xc87663,null))[_0xb6d5('0x20')](saveUpdates(_[_0xb6d5('0x36')](_0x3e4c02[_0xb6d5('0x6c')],[_0xb6d5('0x24'),_0xb6d5('0x77')]),null))['then'](respondWithResult(_0xc87663,null))[_0xb6d5('0x3f')](handleError(_0xc87663,null));};exports[_0xb6d5('0x78')]=function(_0x4aaa9b,_0x529154,_0x12bf05){return db['Sound'][_0xb6d5('0x43')]({'where':{'id':_0x4aaa9b['params']['id']}})[_0xb6d5('0x20')](function(_0x5e4293){if(_0x5e4293){return _0x5e4293[_0xb6d5('0x21')]();}})[_0xb6d5('0x20')](function(_0x583e26){var _0x11b8f2=path[_0xb6d5('0x4b')](config[_0xb6d5('0x49')],_0xb6d5('0x79'),util[_0xb6d5('0x4c')](_0xb6d5('0x4d'),_0x583e26[_0xb6d5('0x46')],_0x583e26[_0xb6d5('0x7a')]));var _0x22ccaa=path[_0xb6d5('0x4b')](config['root'],_0xb6d5('0x4a'),util[_0xb6d5('0x4c')]('%s.%s',_0x583e26[_0xb6d5('0x46')],_0x583e26[_0xb6d5('0x47')]));fs['unlinkSync'](_0x11b8f2);fs[_0xb6d5('0x5b')](_0x22ccaa);return _0x583e26;})[_0xb6d5('0x20')](function(_0x48a387){if(_0x48a387){return _0x529154['status'](0xcc)['end']();}})[_0xb6d5('0x20')](handleEntityNotFound(_0x529154,null))[_0xb6d5('0x3f')](handleError(_0x529154,null));}; \ No newline at end of file +var _0x2ae9=['Sound\x20upload\x20filepath:\x20%s','chmodSync','transcode','wav','unlinkSync','send','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_duration','converted_sampleCount','converted_sampleRate','0777','body','role','user','UserProfileSection','Sounds','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','original_format','eml-format','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','get','UserProfileResource','destroy','end','stack','name','index','map','Sound','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','where','merge','type','VIRTUAL','filter','options','includeAll','include','rows','show','params','find','download','save_name','converted_format','join','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','catch','create','basename','originalname','extname','file','filename','server/files/sounds/original','root','info'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x2ae9,0x193));var _0x92ae=function(_0x376f50,_0x1b6855){_0x376f50=_0x376f50-0x0;var _0x1c5f2e=_0x2ae9[_0x376f50];return _0x1c5f2e;};'use strict';var emlformat=require(_0x92ae('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x92ae('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x92ae('0x2'));var Mustache=require(_0x92ae('0x3'));var util=require(_0x92ae('0x4'));var path=require(_0x92ae('0x5'));var sox=require(_0x92ae('0x6'));var csv=require(_0x92ae('0x7'));var ejs=require(_0x92ae('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x92ae('0x9'));var crypto=require(_0x92ae('0xa'));var jsforce=require(_0x92ae('0xb'));var deskjs=require(_0x92ae('0xc'));var toCsv=require(_0x92ae('0x7'));var querystring=require(_0x92ae('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x92ae('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x92ae('0xf'));var logger=require(_0x92ae('0x10'))(_0x92ae('0x11'));var utils=require(_0x92ae('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x92ae('0x13'))['db'];function respondWithStatusCode(_0x3d0b81,_0x3765ae){_0x3765ae=_0x3765ae||0xcc;return function(_0x305470){if(_0x305470){return _0x3d0b81[_0x92ae('0x14')](_0x3765ae);}return _0x3d0b81[_0x92ae('0x15')](_0x3765ae)['end']();};}function respondWithResult(_0x15ebf4,_0x27c59f){_0x27c59f=_0x27c59f||0xc8;return function(_0x3277aa){if(_0x3277aa){return _0x15ebf4[_0x92ae('0x15')](_0x27c59f)[_0x92ae('0x16')](_0x3277aa);}};}function respondWithFilteredResult(_0x220b6e,_0x2abcb1){return function(_0x277950){if(_0x277950){var _0x187e19=typeof _0x2abcb1[_0x92ae('0x17')]===_0x92ae('0x18')&&typeof _0x2abcb1[_0x92ae('0x19')]==='undefined';var _0x3631b6=_0x277950[_0x92ae('0x1a')];var _0x52cf34=_0x187e19?0x0:_0x2abcb1[_0x92ae('0x17')];var _0x26290f=_0x187e19?_0x277950[_0x92ae('0x1a')]:_0x2abcb1[_0x92ae('0x17')]+_0x2abcb1['limit'];var _0x4c82f7;if(_0x26290f>=_0x3631b6){_0x26290f=_0x3631b6;_0x4c82f7=0xc8;}else{_0x4c82f7=0xce;}_0x220b6e['status'](_0x4c82f7);return _0x220b6e[_0x92ae('0x1b')](_0x92ae('0x1c'),_0x52cf34+'-'+_0x26290f+'/'+_0x3631b6)[_0x92ae('0x16')](_0x277950);}return null;};}function patchUpdates(_0x27c02e){return function(_0x362f07){try{jsonpatch[_0x92ae('0x1d')](_0x362f07,_0x27c02e,!![]);}catch(_0x2a6c0c){return BPromise[_0x92ae('0x1e')](_0x2a6c0c);}return _0x362f07['save']();};}function saveUpdates(_0x2ff575,_0x557878){return function(_0x5b58ff){if(_0x5b58ff){return _0x5b58ff[_0x92ae('0x1f')](_0x2ff575)[_0x92ae('0x20')](function(_0x192140){return _0x192140;});}return null;};}function removeEntity(_0x2fab40,_0x37d7af){return function(_0x2c9dcf){if(_0x2c9dcf){return _0x2c9dcf['destroy']()[_0x92ae('0x20')](function(){var _0x2880a3=_0x2c9dcf[_0x92ae('0x21')]({'plain':!![]});var _0x1073e3='Sounds';return db[_0x92ae('0x22')][_0x92ae('0x23')]({'where':{'type':_0x1073e3,'resourceId':_0x2880a3['id']}})[_0x92ae('0x20')](function(){return _0x2c9dcf;});})[_0x92ae('0x20')](function(){_0x2fab40[_0x92ae('0x15')](0xcc)[_0x92ae('0x24')]();});}};}function handleEntityNotFound(_0x515470,_0x26d207){return function(_0x545ea){if(!_0x545ea){_0x515470[_0x92ae('0x14')](0x194);}return _0x545ea;};}function handleError(_0x37a850,_0x91a85e){_0x91a85e=_0x91a85e||0x1f4;return function(_0x1f9125){logger['error'](_0x1f9125[_0x92ae('0x25')]);if(_0x1f9125[_0x92ae('0x26')]){delete _0x1f9125[_0x92ae('0x26')];}_0x37a850[_0x92ae('0x15')](_0x91a85e)['send'](_0x1f9125);};}exports[_0x92ae('0x27')]=function(_0x1b7c91,_0x41a955){var _0x41cc4c={},_0x5f0f60={},_0x2a4b39={'count':0x0,'rows':[]};var _0x49ae1c=_[_0x92ae('0x28')](db[_0x92ae('0x29')]['rawAttributes'],function(_0x1e9ff9){return{'name':_0x1e9ff9[_0x92ae('0x2a')],'type':_0x1e9ff9['type'][_0x92ae('0x2b')]};});_0x5f0f60[_0x92ae('0x2c')]=_[_0x92ae('0x28')](_0x49ae1c,_0x92ae('0x26'));_0x5f0f60[_0x92ae('0x2d')]=_[_0x92ae('0x2e')](_0x1b7c91[_0x92ae('0x2d')]);_0x5f0f60['filters']=_[_0x92ae('0x2f')](_0x5f0f60[_0x92ae('0x2c')],_0x5f0f60[_0x92ae('0x2d')]);_0x41cc4c[_0x92ae('0x30')]=_['intersection'](_0x5f0f60['model'],qs[_0x92ae('0x31')](_0x1b7c91['query'][_0x92ae('0x31')]));_0x41cc4c[_0x92ae('0x30')]=_0x41cc4c[_0x92ae('0x30')][_0x92ae('0x32')]?_0x41cc4c[_0x92ae('0x30')]:_0x5f0f60['model'];if(!_0x1b7c91[_0x92ae('0x2d')][_0x92ae('0x33')](_0x92ae('0x34'))){_0x41cc4c[_0x92ae('0x19')]=qs[_0x92ae('0x19')](_0x1b7c91[_0x92ae('0x2d')]['limit']);_0x41cc4c[_0x92ae('0x17')]=qs[_0x92ae('0x17')](_0x1b7c91[_0x92ae('0x2d')][_0x92ae('0x17')]);}_0x41cc4c[_0x92ae('0x35')]=qs[_0x92ae('0x36')](_0x1b7c91[_0x92ae('0x2d')][_0x92ae('0x36')]);_0x41cc4c['where']=qs['filters'](_[_0x92ae('0x37')](_0x1b7c91[_0x92ae('0x2d')],_0x5f0f60[_0x92ae('0x38')]),_0x49ae1c);if(_0x1b7c91[_0x92ae('0x2d')]['filter']){_0x41cc4c[_0x92ae('0x39')]=_[_0x92ae('0x3a')](_0x41cc4c[_0x92ae('0x39')],{'$or':_['map'](_0x49ae1c,function(_0x5a2fe6){if(_0x5a2fe6[_0x92ae('0x3b')]!==_0x92ae('0x3c')){var _0x50bb56={};_0x50bb56[_0x5a2fe6[_0x92ae('0x26')]]={'$like':'%'+_0x1b7c91[_0x92ae('0x2d')][_0x92ae('0x3d')]+'%'};return _0x50bb56;}})});}_0x41cc4c=_[_0x92ae('0x3a')]({},_0x41cc4c,_0x1b7c91[_0x92ae('0x3e')]);var _0x368a09={'where':_0x41cc4c[_0x92ae('0x39')]};return db[_0x92ae('0x29')][_0x92ae('0x1a')](_0x368a09)[_0x92ae('0x20')](function(_0x3208eb){_0x2a4b39['count']=_0x3208eb;if(_0x1b7c91[_0x92ae('0x2d')][_0x92ae('0x3f')]){_0x41cc4c[_0x92ae('0x40')]=[{'all':!![]}];}return db[_0x92ae('0x29')]['findAll'](_0x41cc4c);})['then'](function(_0x4a9a44){_0x2a4b39[_0x92ae('0x41')]=_0x4a9a44;return _0x2a4b39;})[_0x92ae('0x20')](respondWithFilteredResult(_0x41a955,_0x41cc4c))['catch'](handleError(_0x41a955,null));};exports[_0x92ae('0x42')]=function(_0x576320,_0x56b310){var _0x333e68={'raw':!![],'where':{'id':_0x576320[_0x92ae('0x43')]['id']}},_0x5cf70f={};_0x5cf70f[_0x92ae('0x2c')]=_[_0x92ae('0x2e')](db[_0x92ae('0x29')]['rawAttributes']);_0x5cf70f[_0x92ae('0x2d')]=_[_0x92ae('0x2e')](_0x576320['query']);_0x5cf70f['filters']=_[_0x92ae('0x2f')](_0x5cf70f['model'],_0x5cf70f[_0x92ae('0x2d')]);_0x333e68[_0x92ae('0x30')]=_[_0x92ae('0x2f')](_0x5cf70f[_0x92ae('0x2c')],qs['fields'](_0x576320[_0x92ae('0x2d')][_0x92ae('0x31')]));_0x333e68['attributes']=_0x333e68['attributes']['length']?_0x333e68[_0x92ae('0x30')]:_0x5cf70f[_0x92ae('0x2c')];if(_0x576320[_0x92ae('0x2d')][_0x92ae('0x3f')]){_0x333e68[_0x92ae('0x40')]=[{'all':!![]}];}_0x333e68=_['merge']({},_0x333e68,_0x576320[_0x92ae('0x3e')]);return db[_0x92ae('0x29')][_0x92ae('0x44')](_0x333e68)[_0x92ae('0x20')](handleEntityNotFound(_0x56b310,null))[_0x92ae('0x20')](respondWithResult(_0x56b310,null))['catch'](handleError(_0x56b310,null));};exports[_0x92ae('0x45')]=function(_0x4ca3d2,_0x2d95bc,_0x437b05){return db[_0x92ae('0x29')][_0x92ae('0x44')]({'where':{'id':_0x4ca3d2[_0x92ae('0x43')]['id']},'attributes':['name',_0x92ae('0x46'),_0x92ae('0x47')],'raw':!![]})[_0x92ae('0x20')](handleEntityNotFound(_0x2d95bc,null))[_0x92ae('0x20')](function(_0x434d5c){if(_0x434d5c){if(!fs['existsSync'](path[_0x92ae('0x48')](config['root'],_0x92ae('0x49'),_0x434d5c[_0x92ae('0x46')]+'.'+_0x434d5c[_0x92ae('0x47')]))){throw new db[(_0x92ae('0x4a'))][(_0x92ae('0x4b'))](_0x92ae('0x4c'));}return _0x2d95bc[_0x92ae('0x45')](path[_0x92ae('0x48')](config['root'],'server/files/sounds/converted',util[_0x92ae('0x4d')](_0x92ae('0x4e'),_0x434d5c[_0x92ae('0x46')],_0x434d5c['converted_format'])),util[_0x92ae('0x4d')](_0x92ae('0x4e'),_0x434d5c['name'],_0x434d5c[_0x92ae('0x47')]));}return null;})[_0x92ae('0x4f')](handleError(_0x2d95bc,null));};exports[_0x92ae('0x50')]=function(_0x87b503,_0x13df76,_0x5697ab){var _0x47154c={'name':path[_0x92ae('0x51')](_0x87b503['file'][_0x92ae('0x52')],path[_0x92ae('0x53')](_0x87b503[_0x92ae('0x54')]['originalname'])),'save_name':path['basename'](_0x87b503[_0x92ae('0x54')][_0x92ae('0x55')],path[_0x92ae('0x53')](_0x87b503[_0x92ae('0x54')][_0x92ae('0x55')])),'original_format':path[_0x92ae('0x53')](_0x87b503['file'][_0x92ae('0x52')])['substring'](0x1),'converted_format':'wav'};var _0x14ed3b=path[_0x92ae('0x48')](config['root'],_0x92ae('0x56'),_0x87b503[_0x92ae('0x54')][_0x92ae('0x55')]);var _0x3b6eaa=path['join'](config[_0x92ae('0x57')],_0x92ae('0x49'),util[_0x92ae('0x4d')](_0x92ae('0x4e'),path[_0x92ae('0x51')](_0x87b503[_0x92ae('0x54')][_0x92ae('0x55')],path[_0x92ae('0x53')](_0x87b503[_0x92ae('0x54')][_0x92ae('0x55')])),_0x47154c[_0x92ae('0x47')]));logger[_0x92ae('0x58')](_0x92ae('0x59'),_0x14ed3b);logger[_0x92ae('0x58')]('Sound\x20upload\x20destination:\x20%s',_0x3b6eaa);try{fs[_0x92ae('0x5a')](_0x14ed3b,parseInt('0777',0x8));var _0x3df85a=sox[_0x92ae('0x5b')](_0x14ed3b,_0x3b6eaa,{'sampleRate':0x1f40,'format':_0x92ae('0x5c'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3df85a['on']('error',function(_0x3aa700){fs[_0x92ae('0x5d')](_0x14ed3b);_0x13df76['status'](0x1f4)[_0x92ae('0x5e')](_0x3aa700);});_0x3df85a['on'](_0x92ae('0x5f'),function(_0x6d9832){_0x47154c[_0x92ae('0x60')]=isNaN(_0x6d9832[_0x92ae('0x61')])?null:_0x6d9832['duration']*0x3e8;_0x47154c[_0x92ae('0x62')]=isNaN(_0x6d9832[_0x92ae('0x63')])?null:_0x6d9832['sampleCount'];_0x47154c[_0x92ae('0x64')]=isNaN(_0x6d9832[_0x92ae('0x65')])?null:_0x6d9832[_0x92ae('0x65')];_0x47154c[_0x92ae('0x66')]=isNaN(_0x6d9832['bitRate'])?null:_0x6d9832[_0x92ae('0x67')];_0x47154c[_0x92ae('0x68')]=isNaN(_0x6d9832[_0x92ae('0x69')])?null:_0x6d9832[_0x92ae('0x69')];});_0x3df85a['on']('dest',function(_0x453078){_0x47154c[_0x92ae('0x6a')]=isNaN(_0x453078[_0x92ae('0x61')])?null:_0x453078[_0x92ae('0x61')]*0x3e8;_0x47154c[_0x92ae('0x6b')]=isNaN(_0x453078[_0x92ae('0x63')])?null:_0x453078[_0x92ae('0x63')];_0x47154c['converted_channelCount']=isNaN(_0x453078[_0x92ae('0x65')])?null:_0x453078[_0x92ae('0x65')];_0x47154c['converted_bitRate']=isNaN(_0x453078[_0x92ae('0x67')])?null:_0x453078[_0x92ae('0x67')];_0x47154c[_0x92ae('0x6c')]=isNaN(_0x453078['sampleRate'])?null:_0x453078[_0x92ae('0x69')];});_0x3df85a['on'](_0x92ae('0x24'),function(){fs[_0x92ae('0x5a')](_0x3b6eaa,parseInt(_0x92ae('0x6d'),0x8));return db[_0x92ae('0x29')]['create'](_0x47154c)['then'](function(_0xb977cb){var _0x33286f={'role':_0x87b503[_0x92ae('0x6e')][_0x92ae('0x6f')],'userProfileId':_0x87b503[_0x92ae('0x6e')]['userProfileId']};if(!_0x33286f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x33286f['role']===_0x92ae('0x70')){var _0x34b7bd=_0xb977cb['get']({'plain':!![]});return db[_0x92ae('0x71')][_0x92ae('0x44')]({'where':{'name':_0x92ae('0x72'),'userProfileId':_0x33286f[_0x92ae('0x73')]},'raw':!![]})['then'](function(_0x210e94){if(_0x210e94&&_0x210e94[_0x92ae('0x74')]===0x0){return db['UserProfileResource'][_0x92ae('0x50')]({'name':_0x34b7bd[_0x92ae('0x26')],'resourceId':_0x34b7bd['id'],'type':_0x210e94[_0x92ae('0x26')],'sectionId':_0x210e94['id']},{})[_0x92ae('0x20')](function(){return _0xb977cb;});}else{return _0xb977cb;}})['catch'](function(_0x158054){logger[_0x92ae('0x75')](_0x92ae('0x76'),_0x158054);throw _0x158054;});}return _0xb977cb;})[_0x92ae('0x20')](respondWithResult(_0x13df76,null))[_0x92ae('0x4f')](handleError(_0x13df76,null));});_0x3df85a[_0x92ae('0x77')]();}catch(_0x22c800){_0x13df76[_0x92ae('0x15')](0x1f4)[_0x92ae('0x5e')](_0x22c800);}};exports[_0x92ae('0x1f')]=function(_0x26e238,_0x807148,_0x17c5b0){return db['Sound'][_0x92ae('0x44')]({'where':{'id':_0x26e238[_0x92ae('0x43')]['id']}})['then'](handleEntityNotFound(_0x807148,null))[_0x92ae('0x20')](saveUpdates(_[_0x92ae('0x37')](_0x26e238['body'],[_0x92ae('0x26'),_0x92ae('0x78')]),null))[_0x92ae('0x20')](respondWithResult(_0x807148,null))[_0x92ae('0x4f')](handleError(_0x807148,null));};exports[_0x92ae('0x79')]=function(_0x12d4e8,_0x251ae6,_0x41fa87){return db[_0x92ae('0x29')][_0x92ae('0x44')]({'where':{'id':_0x12d4e8[_0x92ae('0x43')]['id']}})[_0x92ae('0x20')](function(_0x4ba09e){if(_0x4ba09e){return _0x4ba09e[_0x92ae('0x23')]();}})[_0x92ae('0x20')](function(_0x2e0215){var _0x264c00=path[_0x92ae('0x48')](config[_0x92ae('0x57')],_0x92ae('0x56'),util['format'](_0x92ae('0x4e'),_0x2e0215[_0x92ae('0x46')],_0x2e0215[_0x92ae('0x7a')]));var _0x50bc1c=path[_0x92ae('0x48')](config[_0x92ae('0x57')],_0x92ae('0x49'),util[_0x92ae('0x4d')](_0x92ae('0x4e'),_0x2e0215[_0x92ae('0x46')],_0x2e0215[_0x92ae('0x47')]));fs[_0x92ae('0x5d')](_0x264c00);fs[_0x92ae('0x5d')](_0x50bc1c);return _0x2e0215;})[_0x92ae('0x20')](function(_0x273e99){if(_0x273e99){return _0x251ae6[_0x92ae('0x15')](0xcc)[_0x92ae('0x24')]();}})[_0x92ae('0x20')](handleEntityNotFound(_0x251ae6,null))[_0x92ae('0x4f')](handleError(_0x251ae6,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index a096c81..e4311b2 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 _0xaf9c=['../../config/environment','./sound.attributes','exports','define','Sound','lodash','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x3fe2be,_0x24cfba){var _0x16b3ca=function(_0x266d1e){while(--_0x266d1e){_0x3fe2be['push'](_0x3fe2be['shift']());}};_0x16b3ca(++_0x24cfba);}(_0xaf9c,0x1b5));var _0xcaf9=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0xaf9c[_0x1ccdf7];return _0x52a0ae;};'use strict';var _=require(_0xcaf9('0x0'));var util=require(_0xcaf9('0x1'));var logger=require('../../config/logger')(_0xcaf9('0x2'));var moment=require(_0xcaf9('0x3'));var BPromise=require(_0xcaf9('0x4'));var rp=require(_0xcaf9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcaf9('0x6'));var config=require(_0xcaf9('0x7'));var attributes=require(_0xcaf9('0x8'));module[_0xcaf9('0x9')]=function(_0x49b9d0,_0x33e33b){return _0x49b9d0[_0xcaf9('0xa')](_0xcaf9('0xb'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf53a=['api','moment','bluebird','request-promise','rimraf','define','Sound','tools_sounds','lodash','../../config/logger'];(function(_0x189305,_0x46c43f){var _0xea3406=function(_0x2aa435){while(--_0x2aa435){_0x189305['push'](_0x189305['shift']());}};_0xea3406(++_0x46c43f);}(_0xf53a,0x1e8));var _0xaf53=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0xf53a[_0x525c7b];return _0x27b33e;};'use strict';var _=require(_0xaf53('0x0'));var util=require('util');var logger=require(_0xaf53('0x1'))(_0xaf53('0x2'));var moment=require(_0xaf53('0x3'));var BPromise=require(_0xaf53('0x4'));var rp=require(_0xaf53('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaf53('0x6'));var config=require('../../config/environment');var attributes=require('./sound.attributes');module['exports']=function(_0x44006f,_0xf583e7){return _0x44006f[_0xaf53('0x7')](_0xaf53('0x8'),attributes,{'tableName':_0xaf53('0x9'),'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 0995490..e14b96b 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 _0x8146=['options','raw','include','attributes','map','model','ShowSound','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','Sound','find'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8146,0xc1));var _0x6814=function(_0x4e3840,_0x427c06){_0x4e3840=_0x4e3840-0x0;var _0x5868b3=_0x8146[_0x4e3840];return _0x5868b3;};'use strict';var _=require('lodash');var util=require(_0x6814('0x0'));var moment=require(_0x6814('0x1'));var BPromise=require('bluebird');var rs=require(_0x6814('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6814('0x3'))['db'];var utils=require(_0x6814('0x4'));var logger=require(_0x6814('0x5'))(_0x6814('0x6'));var config=require(_0x6814('0x7'));var jayson=require(_0x6814('0x8'));var client=jayson['client'][_0x6814('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x82342f,_0x305f5e,_0x5577f2){return new BPromise(function(_0x13774a,_0x2be5d2){return client[_0x6814('0xa')](_0x82342f,_0x5577f2)[_0x6814('0xb')](function(_0x2ce56f){logger[_0x6814('0xc')](_0x6814('0xd'),_0x305f5e,_0x6814('0xe'));logger[_0x6814('0xf')]('Sound,\x20%s,\x20%s,\x20%s',_0x305f5e,_0x6814('0xe'),JSON[_0x6814('0x10')](_0x2ce56f));if(_0x2ce56f['error']){if(_0x2ce56f[_0x6814('0x11')][_0x6814('0x12')]===0x1f4){logger[_0x6814('0x11')](_0x6814('0xd'),_0x305f5e,_0x2ce56f[_0x6814('0x11')][_0x6814('0x13')]);return _0x2be5d2(_0x2ce56f[_0x6814('0x11')][_0x6814('0x13')]);}logger[_0x6814('0x11')](_0x6814('0xd'),_0x305f5e,_0x2ce56f['error'][_0x6814('0x13')]);return _0x13774a(_0x2ce56f[_0x6814('0x11')]['message']);}else{logger['info'](_0x6814('0xd'),_0x305f5e,'request\x20sent');_0x13774a(_0x2ce56f[_0x6814('0x14')]['message']);}})[_0x6814('0x15')](function(_0x5d3ec4){logger[_0x6814('0x11')](_0x6814('0xd'),_0x305f5e,_0x5d3ec4);_0x2be5d2(_0x5d3ec4);});});}exports['ShowSound']=function(_0x11a5d2){var _0x21dc9c=this;return new Promise(function(_0x3a07fb,_0x354ad9){return db[_0x6814('0x16')][_0x6814('0x17')]({'raw':_0x11a5d2[_0x6814('0x18')]?_0x11a5d2[_0x6814('0x18')][_0x6814('0x19')]===undefined?!![]:![]:!![],'where':_0x11a5d2[_0x6814('0x18')]?_0x11a5d2[_0x6814('0x18')]['where']||null:null,'attributes':_0x11a5d2[_0x6814('0x18')]?_0x11a5d2[_0x6814('0x18')]['attributes']||null:null,'include':_0x11a5d2[_0x6814('0x18')]?_0x11a5d2['options'][_0x6814('0x1a')]?_['map'](_0x11a5d2['options'][_0x6814('0x1a')],function(_0xb4866a){return{'model':db[_0xb4866a['model']],'as':_0xb4866a['as'],'attributes':_0xb4866a[_0x6814('0x1b')],'include':_0xb4866a[_0x6814('0x1a')]?_[_0x6814('0x1c')](_0xb4866a['include'],function(_0x478d48){return{'model':db[_0x478d48[_0x6814('0x1d')]],'as':_0x478d48['as'],'attributes':_0x478d48[_0x6814('0x1b')],'include':_0x478d48[_0x6814('0x1a')]?_['map'](_0x478d48[_0x6814('0x1a')],function(_0x36699b){return{'model':db[_0x36699b[_0x6814('0x1d')]],'as':_0x36699b['as'],'attributes':_0x36699b['attributes']};}):[]};}):[]};}):[]:[]})[_0x6814('0xb')](function(_0x133a3f){logger[_0x6814('0xc')](_0x6814('0x1e'),_0x11a5d2);logger[_0x6814('0xf')]('ShowSound',_0x11a5d2,JSON[_0x6814('0x10')](_0x133a3f));_0x3a07fb(_0x133a3f);})[_0x6814('0x15')](function(_0x23be1c){logger[_0x6814('0x11')](_0x6814('0x1e'),_0x23be1c[_0x6814('0x13')],_0x11a5d2);_0x354ad9(_0x21dc9c[_0x6814('0x11')](0x1f4,_0x23be1c['message']));});});}; \ No newline at end of file +var _0x746d=['catch','ShowSound','Sound','find','options','raw','where','attributes','map','include','model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','error','Sound,\x20%s,\x20%s','message','result'];(function(_0x118a5c,_0x3c7663){var _0x1b5973=function(_0x53b546){while(--_0x53b546){_0x118a5c['push'](_0x118a5c['shift']());}};_0x1b5973(++_0x3c7663);}(_0x746d,0x16c));var _0xd746=function(_0x6f4e96,_0x296366){_0x6f4e96=_0x6f4e96-0x0;var _0x4edc79=_0x746d[_0x6f4e96];return _0x4edc79;};'use strict';var _=require(_0xd746('0x0'));var util=require(_0xd746('0x1'));var moment=require(_0xd746('0x2'));var BPromise=require(_0xd746('0x3'));var rs=require(_0xd746('0x4'));var fs=require('fs');var Redis=require(_0xd746('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd746('0x6'));var logger=require(_0xd746('0x7'))(_0xd746('0x8'));var config=require(_0xd746('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd746('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a1d51,_0x50dbf5,_0x4c83bb){return new BPromise(function(_0x106f1e,_0x58c90a){return client[_0xd746('0xb')](_0x1a1d51,_0x4c83bb)[_0xd746('0xc')](function(_0x583d53){logger[_0xd746('0xd')]('Sound,\x20%s,\x20%s',_0x50dbf5,_0xd746('0xe'));logger[_0xd746('0xf')]('Sound,\x20%s,\x20%s,\x20%s',_0x50dbf5,'request\x20sent',JSON['stringify'](_0x583d53));if(_0x583d53['error']){if(_0x583d53[_0xd746('0x10')]['code']===0x1f4){logger['error'](_0xd746('0x11'),_0x50dbf5,_0x583d53[_0xd746('0x10')][_0xd746('0x12')]);return _0x58c90a(_0x583d53[_0xd746('0x10')][_0xd746('0x12')]);}logger['error'](_0xd746('0x11'),_0x50dbf5,_0x583d53['error'][_0xd746('0x12')]);return _0x106f1e(_0x583d53[_0xd746('0x10')]['message']);}else{logger['info']('Sound,\x20%s,\x20%s',_0x50dbf5,_0xd746('0xe'));_0x106f1e(_0x583d53[_0xd746('0x13')][_0xd746('0x12')]);}})[_0xd746('0x14')](function(_0x3a4b42){logger[_0xd746('0x10')](_0xd746('0x11'),_0x50dbf5,_0x3a4b42);_0x58c90a(_0x3a4b42);});});}exports[_0xd746('0x15')]=function(_0x4b98de){var _0x533569=this;return new Promise(function(_0x3d2362,_0x5a536a){return db[_0xd746('0x16')][_0xd746('0x17')]({'raw':_0x4b98de[_0xd746('0x18')]?_0x4b98de[_0xd746('0x18')][_0xd746('0x19')]===undefined?!![]:![]:!![],'where':_0x4b98de[_0xd746('0x18')]?_0x4b98de[_0xd746('0x18')][_0xd746('0x1a')]||null:null,'attributes':_0x4b98de[_0xd746('0x18')]?_0x4b98de[_0xd746('0x18')][_0xd746('0x1b')]||null:null,'include':_0x4b98de[_0xd746('0x18')]?_0x4b98de[_0xd746('0x18')]['include']?_[_0xd746('0x1c')](_0x4b98de[_0xd746('0x18')]['include'],function(_0x13590a){return{'model':db[_0x13590a['model']],'as':_0x13590a['as'],'attributes':_0x13590a[_0xd746('0x1b')],'include':_0x13590a[_0xd746('0x1d')]?_[_0xd746('0x1c')](_0x13590a['include'],function(_0x1722f0){return{'model':db[_0x1722f0['model']],'as':_0x1722f0['as'],'attributes':_0x1722f0[_0xd746('0x1b')],'include':_0x1722f0[_0xd746('0x1d')]?_[_0xd746('0x1c')](_0x1722f0[_0xd746('0x1d')],function(_0x283d1f){return{'model':db[_0x283d1f[_0xd746('0x1e')]],'as':_0x283d1f['as'],'attributes':_0x283d1f['attributes']};}):[]};}):[]};}):[]:[]})[_0xd746('0xc')](function(_0x533141){logger[_0xd746('0xd')]('ShowSound',_0x4b98de);logger[_0xd746('0xf')](_0xd746('0x15'),_0x4b98de,JSON[_0xd746('0x1f')](_0x533141));_0x3d2362(_0x533141);})[_0xd746('0x14')](function(_0x59e2b6){logger['error']('ShowSound',_0x59e2b6[_0xd746('0x12')],_0x4b98de);_0x5a536a(_0x533569['error'](0x1f4,_0x59e2b6[_0xd746('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 82ce301..ee5a422 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 _0x4fc2=['show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','/:id'];(function(_0xbe31a4,_0x11ba89){var _0x15ec28=function(_0x124633){while(--_0x124633){_0xbe31a4['push'](_0xbe31a4['shift']());}};_0x15ec28(++_0x11ba89);}(_0x4fc2,0x111));var _0x24fc=function(_0x31da33,_0x5aab94){_0x31da33=_0x31da33-0x0;var _0x7ec2a2=_0x4fc2[_0x31da33];return _0x7ec2a2;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xe')]);router['put'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xf')]);router[_0x24fc('0x10')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x11')]);module[_0x24fc('0x12')]=router; \ No newline at end of file +var _0x5eb8=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports','path','connect-timeout','express','Router'];(function(_0x11c0a0,_0x2350b2){var _0x194ea2=function(_0x48cbfb){while(--_0x48cbfb){_0x11c0a0['push'](_0x11c0a0['shift']());}};_0x194ea2(++_0x2350b2);}(_0x5eb8,0xb0));var _0x85eb=function(_0xdd2bfa,_0x5bd304){_0xdd2bfa=_0xdd2bfa-0x0;var _0x55397e=_0x5eb8[_0xdd2bfa];return _0x55397e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['post']('/',auth[_0x85eb('0xa')](),controller['create']);router[_0x85eb('0xe')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xf')]);router[_0x85eb('0x10')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller['destroy']);module[_0x85eb('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 576fa3a..243ca9e 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 _0xdcd7=['sequelize','exports','STRING','medium','ENUM','out','TEXT'];(function(_0x17345c,_0x513597){var _0x459170=function(_0x3a6942){while(--_0x3a6942){_0x17345c['push'](_0x17345c['shift']());}};_0x459170(++_0x513597);}(_0xdcd7,0x19d));var _0x7dcd=function(_0x3596ba,_0x25a81d){_0x3596ba=_0x3596ba-0x0;var _0x575d45=_0xdcd7[_0x3596ba];return _0x575d45;};'use strict';var Sequelize=require(_0x7dcd('0x0'));module[_0x7dcd('0x1')]={'uniqueid':{'type':Sequelize[_0x7dcd('0x2')]},'body':{'type':Sequelize['TEXT'](_0x7dcd('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x7dcd('0x4')]('in',_0x7dcd('0x5')),'defaultValue':_0x7dcd('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x7dcd('0x2')]},'providerResponse':{'type':Sequelize[_0x7dcd('0x6')]}}; \ No newline at end of file +var _0xb8f5=['STRING','medium','ENUM','out','TEXT','sequelize','exports'];(function(_0x345a59,_0x59856c){var _0x22ca7b=function(_0x2aee80){while(--_0x2aee80){_0x345a59['push'](_0x345a59['shift']());}};_0x22ca7b(++_0x59856c);}(_0xb8f5,0x1ef));var _0x5b8f=function(_0x5c2e89,_0x94653c){_0x5c2e89=_0x5c2e89-0x0;var _0x33de61=_0xb8f5[_0x5c2e89];return _0x33de61;};'use strict';var Sequelize=require(_0x5b8f('0x0'));module[_0x5b8f('0x1')]={'uniqueid':{'type':Sequelize[_0x5b8f('0x2')]},'body':{'type':Sequelize['TEXT'](_0x5b8f('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x5b8f('0x4')]('in',_0x5b8f('0x5')),'defaultValue':_0x5b8f('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x5b8f('0x2')]},'providerResponse':{'type':Sequelize[_0x5b8f('0x6')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index e02027c..9bbeaef 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 _0x4732=['map','SquareMessage','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','type','VIRTUAL','includeAll','findAll','rows','show','params','include','find','catch','create','body','update','destroy','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','reject','save','then','end','error','stack','name','send'];(function(_0x487ab4,_0x1e24e8){var _0x3bef77=function(_0x5ce664){while(--_0x5ce664){_0x487ab4['push'](_0x487ab4['shift']());}};_0x3bef77(++_0x1e24e8);}(_0x4732,0x17d));var _0x2473=function(_0x4c184d,_0x4278ab){_0x4c184d=_0x4c184d-0x0;var _0x23d997=_0x4732[_0x4c184d];return _0x23d997;};'use strict';var emlformat=require(_0x2473('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2473('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2473('0x2'));var moment=require(_0x2473('0x3'));var BPromise=require(_0x2473('0x4'));var Mustache=require(_0x2473('0x5'));var util=require(_0x2473('0x6'));var path=require(_0x2473('0x7'));var sox=require(_0x2473('0x8'));var csv=require('to-csv');var ejs=require(_0x2473('0x9'));var fs=require('fs');var fs_extra=require(_0x2473('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2473('0xb'));var deskjs=require(_0x2473('0xc'));var toCsv=require(_0x2473('0xd'));var querystring=require(_0x2473('0xe'));var Papa=require(_0x2473('0xf'));var Redis=require('ioredis');var authService=require(_0x2473('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2473('0x11'));var hardwareService=require(_0x2473('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x2473('0x13'));var config=require(_0x2473('0x14'));var licenseUtil=require(_0x2473('0x15'));var db=require(_0x2473('0x16'))['db'];function respondWithStatusCode(_0x501ca5,_0x19221b){_0x19221b=_0x19221b||0xcc;return function(_0x4367e8){if(_0x4367e8){return _0x501ca5[_0x2473('0x17')](_0x19221b);}return _0x501ca5[_0x2473('0x18')](_0x19221b)['end']();};}function respondWithResult(_0x530a4a,_0x5126c1){_0x5126c1=_0x5126c1||0xc8;return function(_0x2737b6){if(_0x2737b6){return _0x530a4a[_0x2473('0x18')](_0x5126c1)[_0x2473('0x19')](_0x2737b6);}};}function respondWithFilteredResult(_0x1a81cd,_0x35d4b0){return function(_0x1c7239){if(_0x1c7239){var _0x590f26=typeof _0x35d4b0[_0x2473('0x1a')]===_0x2473('0x1b')&&typeof _0x35d4b0[_0x2473('0x1c')]===_0x2473('0x1b');var _0x2470c8=_0x1c7239[_0x2473('0x1d')];var _0x28d995=_0x590f26?0x0:_0x35d4b0['offset'];var _0x2dcaf1=_0x590f26?_0x1c7239[_0x2473('0x1d')]:_0x35d4b0[_0x2473('0x1a')]+_0x35d4b0[_0x2473('0x1c')];var _0x2a858a;if(_0x2dcaf1>=_0x2470c8){_0x2dcaf1=_0x2470c8;_0x2a858a=0xc8;}else{_0x2a858a=0xce;}_0x1a81cd[_0x2473('0x18')](_0x2a858a);return _0x1a81cd[_0x2473('0x1e')]('Content-Range',_0x28d995+'-'+_0x2dcaf1+'/'+_0x2470c8)[_0x2473('0x19')](_0x1c7239);}return null;};}function patchUpdates(_0x3a8111){return function(_0xc4b4d3){try{jsonpatch['apply'](_0xc4b4d3,_0x3a8111,!![]);}catch(_0x26afc4){return BPromise[_0x2473('0x1f')](_0x26afc4);}return _0xc4b4d3[_0x2473('0x20')]();};}function saveUpdates(_0x5cd072,_0x132878){return function(_0x29066d){if(_0x29066d){return _0x29066d['update'](_0x5cd072)[_0x2473('0x21')](function(_0xc8d1eb){return _0xc8d1eb;});}return null;};}function removeEntity(_0x2ae644,_0x3c2d1d){return function(_0x58e709){if(_0x58e709){return _0x58e709['destroy']()[_0x2473('0x21')](function(){_0x2ae644[_0x2473('0x18')](0xcc)[_0x2473('0x22')]();});}};}function handleEntityNotFound(_0x3c4df9,_0x2d5e60){return function(_0x803ab8){if(!_0x803ab8){_0x3c4df9[_0x2473('0x17')](0x194);}return _0x803ab8;};}function handleError(_0x41cc48,_0x2d03ec){_0x2d03ec=_0x2d03ec||0x1f4;return function(_0x5d9aaf){logger[_0x2473('0x23')](_0x5d9aaf[_0x2473('0x24')]);if(_0x5d9aaf['name']){delete _0x5d9aaf[_0x2473('0x25')];}_0x41cc48[_0x2473('0x18')](_0x2d03ec)[_0x2473('0x26')](_0x5d9aaf);};}exports['index']=function(_0x433e9d,_0x29444d){var _0x1796fa={},_0x50fd3b={},_0x249afb={'count':0x0,'rows':[]};var _0x5293a9=_[_0x2473('0x27')](db[_0x2473('0x28')]['rawAttributes'],function(_0x46c595){return{'name':_0x46c595[_0x2473('0x29')],'type':_0x46c595['type']['key']};});_0x50fd3b[_0x2473('0x2a')]=_[_0x2473('0x27')](_0x5293a9,_0x2473('0x25'));_0x50fd3b[_0x2473('0x2b')]=_[_0x2473('0x2c')](_0x433e9d['query']);_0x50fd3b[_0x2473('0x2d')]=_[_0x2473('0x2e')](_0x50fd3b[_0x2473('0x2a')],_0x50fd3b[_0x2473('0x2b')]);_0x1796fa[_0x2473('0x2f')]=_[_0x2473('0x2e')](_0x50fd3b[_0x2473('0x2a')],qs['fields'](_0x433e9d[_0x2473('0x2b')][_0x2473('0x30')]));_0x1796fa[_0x2473('0x2f')]=_0x1796fa['attributes'][_0x2473('0x31')]?_0x1796fa[_0x2473('0x2f')]:_0x50fd3b[_0x2473('0x2a')];if(!_0x433e9d['query'][_0x2473('0x32')](_0x2473('0x33'))){_0x1796fa[_0x2473('0x1c')]=qs[_0x2473('0x1c')](_0x433e9d[_0x2473('0x2b')]['limit']);_0x1796fa[_0x2473('0x1a')]=qs[_0x2473('0x1a')](_0x433e9d[_0x2473('0x2b')]['offset']);}_0x1796fa['order']=qs['sort'](_0x433e9d[_0x2473('0x2b')]['sort']);_0x1796fa[_0x2473('0x34')]=qs[_0x2473('0x2d')](_[_0x2473('0x35')](_0x433e9d[_0x2473('0x2b')],_0x50fd3b[_0x2473('0x2d')]),_0x5293a9);if(_0x433e9d[_0x2473('0x2b')][_0x2473('0x36')]){_0x1796fa[_0x2473('0x34')]=_[_0x2473('0x37')](_0x1796fa[_0x2473('0x34')],{'$or':_['map'](_0x5293a9,function(_0x3a939b){if(_0x3a939b[_0x2473('0x38')]!==_0x2473('0x39')){var _0x3bdffb={};_0x3bdffb[_0x3a939b[_0x2473('0x25')]]={'$like':'%'+_0x433e9d[_0x2473('0x2b')][_0x2473('0x36')]+'%'};return _0x3bdffb;}})});}_0x1796fa=_['merge']({},_0x1796fa,_0x433e9d['options']);var _0x22fbff={'where':_0x1796fa['where']};return db[_0x2473('0x28')][_0x2473('0x1d')](_0x22fbff)[_0x2473('0x21')](function(_0x1b6f68){_0x249afb[_0x2473('0x1d')]=_0x1b6f68;if(_0x433e9d[_0x2473('0x2b')][_0x2473('0x3a')]){_0x1796fa['include']=[{'all':!![]}];}return db[_0x2473('0x28')][_0x2473('0x3b')](_0x1796fa);})[_0x2473('0x21')](function(_0x495b22){_0x249afb[_0x2473('0x3c')]=_0x495b22;return _0x249afb;})[_0x2473('0x21')](respondWithFilteredResult(_0x29444d,_0x1796fa))['catch'](handleError(_0x29444d,null));};exports[_0x2473('0x3d')]=function(_0x3c40cc,_0x2a7683){var _0x31537d={'raw':!![],'where':{'id':_0x3c40cc[_0x2473('0x3e')]['id']}},_0xd638e5={};_0xd638e5[_0x2473('0x2a')]=_[_0x2473('0x2c')](db[_0x2473('0x28')]['rawAttributes']);_0xd638e5[_0x2473('0x2b')]=_[_0x2473('0x2c')](_0x3c40cc['query']);_0xd638e5['filters']=_[_0x2473('0x2e')](_0xd638e5[_0x2473('0x2a')],_0xd638e5[_0x2473('0x2b')]);_0x31537d[_0x2473('0x2f')]=_[_0x2473('0x2e')](_0xd638e5[_0x2473('0x2a')],qs[_0x2473('0x30')](_0x3c40cc[_0x2473('0x2b')][_0x2473('0x30')]));_0x31537d[_0x2473('0x2f')]=_0x31537d[_0x2473('0x2f')]['length']?_0x31537d[_0x2473('0x2f')]:_0xd638e5['model'];if(_0x3c40cc['query']['includeAll']){_0x31537d[_0x2473('0x3f')]=[{'all':!![]}];}_0x31537d=_[_0x2473('0x37')]({},_0x31537d,_0x3c40cc['options']);return db[_0x2473('0x28')][_0x2473('0x40')](_0x31537d)[_0x2473('0x21')](handleEntityNotFound(_0x2a7683,null))[_0x2473('0x21')](respondWithResult(_0x2a7683,null))[_0x2473('0x41')](handleError(_0x2a7683,null));};exports['create']=function(_0x1de16e,_0x58b1d5){return db[_0x2473('0x28')][_0x2473('0x42')](_0x1de16e[_0x2473('0x43')],{})[_0x2473('0x21')](respondWithResult(_0x58b1d5,0xc9))[_0x2473('0x41')](handleError(_0x58b1d5,null));};exports[_0x2473('0x44')]=function(_0x36e261,_0x243844){if(_0x36e261[_0x2473('0x43')]['id']){delete _0x36e261[_0x2473('0x43')]['id'];}return db[_0x2473('0x28')][_0x2473('0x40')]({'where':{'id':_0x36e261[_0x2473('0x3e')]['id']}})[_0x2473('0x21')](handleEntityNotFound(_0x243844,null))[_0x2473('0x21')](saveUpdates(_0x36e261[_0x2473('0x43')],null))[_0x2473('0x21')](respondWithResult(_0x243844,null))['catch'](handleError(_0x243844,null));};exports[_0x2473('0x45')]=function(_0x2bbabf,_0x50ef63){return db[_0x2473('0x28')][_0x2473('0x40')]({'where':{'id':_0x2bbabf[_0x2473('0x3e')]['id']}})[_0x2473('0x21')](handleEntityNotFound(_0x50ef63,null))[_0x2473('0x21')](removeEntity(_0x50ef63,null))[_0x2473('0x41')](handleError(_0x50ef63,null));}; \ No newline at end of file +var _0xc97a=['rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','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','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','reject','save','update','then','destroy','error','stack','send','index','map','SquareMessage','type','key','name','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','keys','include','options','find','create','body','eml-format'];(function(_0x4610b1,_0x1d49c2){var _0x2ac81b=function(_0x2da6c3){while(--_0x2da6c3){_0x4610b1['push'](_0x4610b1['shift']());}};_0x2ac81b(++_0x1d49c2);}(_0xc97a,0x1d9));var _0xac97=function(_0x312679,_0x20e59f){_0x312679=_0x312679-0x0;var _0x57cbb8=_0xc97a[_0x312679];return _0x57cbb8;};'use strict';var emlformat=require(_0xac97('0x0'));var rimraf=require(_0xac97('0x1'));var zipdir=require(_0xac97('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xac97('0x3'));var moment=require(_0xac97('0x4'));var BPromise=require(_0xac97('0x5'));var Mustache=require(_0xac97('0x6'));var util=require(_0xac97('0x7'));var path=require('path');var sox=require(_0xac97('0x8'));var csv=require(_0xac97('0x9'));var ejs=require(_0xac97('0xa'));var fs=require('fs');var fs_extra=require(_0xac97('0xb'));var _=require(_0xac97('0xc'));var squel=require('squel');var crypto=require(_0xac97('0xd'));var jsforce=require(_0xac97('0xe'));var deskjs=require(_0xac97('0xf'));var toCsv=require(_0xac97('0x9'));var querystring=require(_0xac97('0x10'));var Papa=require(_0xac97('0x11'));var Redis=require('ioredis');var authService=require(_0xac97('0x12'));var qs=require(_0xac97('0x13'));var as=require(_0xac97('0x14'));var hardwareService=require(_0xac97('0x15'));var logger=require(_0xac97('0x16'))(_0xac97('0x17'));var utils=require(_0xac97('0x18'));var config=require(_0xac97('0x19'));var licenseUtil=require(_0xac97('0x1a'));var db=require(_0xac97('0x1b'))['db'];function respondWithStatusCode(_0x56845e,_0x4659b7){_0x4659b7=_0x4659b7||0xcc;return function(_0x14d71c){if(_0x14d71c){return _0x56845e[_0xac97('0x1c')](_0x4659b7);}return _0x56845e['status'](_0x4659b7)[_0xac97('0x1d')]();};}function respondWithResult(_0x33ead2,_0x4c555d){_0x4c555d=_0x4c555d||0xc8;return function(_0x1a3ed6){if(_0x1a3ed6){return _0x33ead2['status'](_0x4c555d)[_0xac97('0x1e')](_0x1a3ed6);}};}function respondWithFilteredResult(_0x47b564,_0x54e2ba){return function(_0x208924){if(_0x208924){var _0x3cc046=typeof _0x54e2ba[_0xac97('0x1f')]===_0xac97('0x20')&&typeof _0x54e2ba[_0xac97('0x21')]===_0xac97('0x20');var _0x5b6de3=_0x208924[_0xac97('0x22')];var _0x41e59b=_0x3cc046?0x0:_0x54e2ba[_0xac97('0x1f')];var _0x4ed9c3=_0x3cc046?_0x208924['count']:_0x54e2ba[_0xac97('0x1f')]+_0x54e2ba[_0xac97('0x21')];var _0x30fa81;if(_0x4ed9c3>=_0x5b6de3){_0x4ed9c3=_0x5b6de3;_0x30fa81=0xc8;}else{_0x30fa81=0xce;}_0x47b564[_0xac97('0x23')](_0x30fa81);return _0x47b564['set'](_0xac97('0x24'),_0x41e59b+'-'+_0x4ed9c3+'/'+_0x5b6de3)[_0xac97('0x1e')](_0x208924);}return null;};}function patchUpdates(_0x304a2a){return function(_0x2403e2){try{jsonpatch['apply'](_0x2403e2,_0x304a2a,!![]);}catch(_0x29d5ea){return BPromise[_0xac97('0x25')](_0x29d5ea);}return _0x2403e2[_0xac97('0x26')]();};}function saveUpdates(_0x9d6a8e,_0x4be8ac){return function(_0x39bfa0){if(_0x39bfa0){return _0x39bfa0[_0xac97('0x27')](_0x9d6a8e)[_0xac97('0x28')](function(_0x35a316){return _0x35a316;});}return null;};}function removeEntity(_0x21dc29,_0x5ef7b2){return function(_0x10e5cf){if(_0x10e5cf){return _0x10e5cf[_0xac97('0x29')]()[_0xac97('0x28')](function(){_0x21dc29[_0xac97('0x23')](0xcc)[_0xac97('0x1d')]();});}};}function handleEntityNotFound(_0x828da,_0x476498){return function(_0x373d06){if(!_0x373d06){_0x828da[_0xac97('0x1c')](0x194);}return _0x373d06;};}function handleError(_0xd9719a,_0x2407ac){_0x2407ac=_0x2407ac||0x1f4;return function(_0x28d3a4){logger[_0xac97('0x2a')](_0x28d3a4[_0xac97('0x2b')]);if(_0x28d3a4['name']){delete _0x28d3a4['name'];}_0xd9719a[_0xac97('0x23')](_0x2407ac)[_0xac97('0x2c')](_0x28d3a4);};}exports[_0xac97('0x2d')]=function(_0x55d1d6,_0x22e1d4){var _0x177e4e={},_0x48b031={},_0x303f2e={'count':0x0,'rows':[]};var _0x1f1e22=_[_0xac97('0x2e')](db[_0xac97('0x2f')]['rawAttributes'],function(_0x45a0ae){return{'name':_0x45a0ae['fieldName'],'type':_0x45a0ae[_0xac97('0x30')][_0xac97('0x31')]};});_0x48b031['model']=_[_0xac97('0x2e')](_0x1f1e22,_0xac97('0x32'));_0x48b031[_0xac97('0x33')]=_['keys'](_0x55d1d6[_0xac97('0x33')]);_0x48b031[_0xac97('0x34')]=_['intersection'](_0x48b031[_0xac97('0x35')],_0x48b031[_0xac97('0x33')]);_0x177e4e[_0xac97('0x36')]=_[_0xac97('0x37')](_0x48b031[_0xac97('0x35')],qs['fields'](_0x55d1d6[_0xac97('0x33')][_0xac97('0x38')]));_0x177e4e[_0xac97('0x36')]=_0x177e4e[_0xac97('0x36')][_0xac97('0x39')]?_0x177e4e[_0xac97('0x36')]:_0x48b031[_0xac97('0x35')];if(!_0x55d1d6['query'][_0xac97('0x3a')](_0xac97('0x3b'))){_0x177e4e[_0xac97('0x21')]=qs['limit'](_0x55d1d6[_0xac97('0x33')][_0xac97('0x21')]);_0x177e4e[_0xac97('0x1f')]=qs['offset'](_0x55d1d6[_0xac97('0x33')]['offset']);}_0x177e4e[_0xac97('0x3c')]=qs[_0xac97('0x3d')](_0x55d1d6['query']['sort']);_0x177e4e[_0xac97('0x3e')]=qs[_0xac97('0x34')](_[_0xac97('0x3f')](_0x55d1d6[_0xac97('0x33')],_0x48b031[_0xac97('0x34')]),_0x1f1e22);if(_0x55d1d6[_0xac97('0x33')][_0xac97('0x40')]){_0x177e4e['where']=_[_0xac97('0x41')](_0x177e4e['where'],{'$or':_[_0xac97('0x2e')](_0x1f1e22,function(_0x6fa49c){if(_0x6fa49c[_0xac97('0x30')]!==_0xac97('0x42')){var _0x4c3b03={};_0x4c3b03[_0x6fa49c[_0xac97('0x32')]]={'$like':'%'+_0x55d1d6['query'][_0xac97('0x40')]+'%'};return _0x4c3b03;}})});}_0x177e4e=_[_0xac97('0x41')]({},_0x177e4e,_0x55d1d6['options']);var _0x5dfc4d={'where':_0x177e4e['where']};return db[_0xac97('0x2f')][_0xac97('0x22')](_0x5dfc4d)[_0xac97('0x28')](function(_0xad21d){_0x303f2e[_0xac97('0x22')]=_0xad21d;if(_0x55d1d6[_0xac97('0x33')][_0xac97('0x43')]){_0x177e4e['include']=[{'all':!![]}];}return db[_0xac97('0x2f')][_0xac97('0x44')](_0x177e4e);})[_0xac97('0x28')](function(_0x3023e9){_0x303f2e[_0xac97('0x45')]=_0x3023e9;return _0x303f2e;})[_0xac97('0x28')](respondWithFilteredResult(_0x22e1d4,_0x177e4e))[_0xac97('0x46')](handleError(_0x22e1d4,null));};exports[_0xac97('0x47')]=function(_0x53ca23,_0x93eb5a){var _0x3c6a05={'raw':!![],'where':{'id':_0x53ca23[_0xac97('0x48')]['id']}},_0x1b9e4b={};_0x1b9e4b[_0xac97('0x35')]=_[_0xac97('0x49')](db[_0xac97('0x2f')]['rawAttributes']);_0x1b9e4b[_0xac97('0x33')]=_[_0xac97('0x49')](_0x53ca23['query']);_0x1b9e4b[_0xac97('0x34')]=_[_0xac97('0x37')](_0x1b9e4b[_0xac97('0x35')],_0x1b9e4b[_0xac97('0x33')]);_0x3c6a05[_0xac97('0x36')]=_[_0xac97('0x37')](_0x1b9e4b[_0xac97('0x35')],qs[_0xac97('0x38')](_0x53ca23[_0xac97('0x33')]['fields']));_0x3c6a05['attributes']=_0x3c6a05['attributes'][_0xac97('0x39')]?_0x3c6a05[_0xac97('0x36')]:_0x1b9e4b[_0xac97('0x35')];if(_0x53ca23[_0xac97('0x33')][_0xac97('0x43')]){_0x3c6a05[_0xac97('0x4a')]=[{'all':!![]}];}_0x3c6a05=_['merge']({},_0x3c6a05,_0x53ca23[_0xac97('0x4b')]);return db['SquareMessage'][_0xac97('0x4c')](_0x3c6a05)[_0xac97('0x28')](handleEntityNotFound(_0x93eb5a,null))[_0xac97('0x28')](respondWithResult(_0x93eb5a,null))[_0xac97('0x46')](handleError(_0x93eb5a,null));};exports['create']=function(_0x508b55,_0x5979e7){return db['SquareMessage'][_0xac97('0x4d')](_0x508b55['body'],{})['then'](respondWithResult(_0x5979e7,0xc9))[_0xac97('0x46')](handleError(_0x5979e7,null));};exports[_0xac97('0x27')]=function(_0xb01b66,_0x53e847){if(_0xb01b66[_0xac97('0x4e')]['id']){delete _0xb01b66[_0xac97('0x4e')]['id'];}return db[_0xac97('0x2f')][_0xac97('0x4c')]({'where':{'id':_0xb01b66[_0xac97('0x48')]['id']}})['then'](handleEntityNotFound(_0x53e847,null))[_0xac97('0x28')](saveUpdates(_0xb01b66[_0xac97('0x4e')],null))[_0xac97('0x28')](respondWithResult(_0x53e847,null))[_0xac97('0x46')](handleError(_0x53e847,null));};exports[_0xac97('0x29')]=function(_0x25a358,_0x464b4d){return db['SquareMessage']['find']({'where':{'id':_0x25a358[_0xac97('0x48')]['id']}})[_0xac97('0x28')](handleEntityNotFound(_0x464b4d,null))['then'](removeEntity(_0x464b4d,null))[_0xac97('0x46')](handleError(_0x464b4d,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index c42f4ab..27977eb 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 _0xa119=['../../config/environment','./squareMessage.attributes','exports','SquareMessage','square_messages','lodash','util','../../config/logger','api','moment','path','rimraf'];(function(_0xa652b3,_0x420d94){var _0x47c326=function(_0x34b96f){while(--_0x34b96f){_0xa652b3['push'](_0xa652b3['shift']());}};_0x47c326(++_0x420d94);}(_0xa119,0x1c1));var _0x9a11=function(_0x4c0833,_0x5e93f7){_0x4c0833=_0x4c0833-0x0;var _0x44dc41=_0xa119[_0x4c0833];return _0x44dc41;};'use strict';var _=require(_0x9a11('0x0'));var util=require(_0x9a11('0x1'));var logger=require(_0x9a11('0x2'))(_0x9a11('0x3'));var moment=require(_0x9a11('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9a11('0x5'));var rimraf=require(_0x9a11('0x6'));var config=require(_0x9a11('0x7'));var attributes=require(_0x9a11('0x8'));module[_0x9a11('0x9')]=function(_0x2b38d4,_0x4ed5ea){return _0x2b38d4['define'](_0x9a11('0xa'),attributes,{'tableName':_0x9a11('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeb6f=['lodash','../../config/logger','api','bluebird','rimraf','../../config/environment','exports','define','SquareMessage','square_messages'];(function(_0x510c60,_0x50247e){var _0x49c4aa=function(_0x3149c7){while(--_0x3149c7){_0x510c60['push'](_0x510c60['shift']());}};_0x49c4aa(++_0x50247e);}(_0xeb6f,0xf0));var _0xfeb6=function(_0x55ff3e,_0x41077f){_0x55ff3e=_0x55ff3e-0x0;var _0x2709eb=_0xeb6f[_0x55ff3e];return _0x2709eb;};'use strict';var _=require(_0xfeb6('0x0'));var util=require('util');var logger=require(_0xfeb6('0x1'))(_0xfeb6('0x2'));var moment=require('moment');var BPromise=require(_0xfeb6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfeb6('0x4'));var config=require(_0xfeb6('0x5'));var attributes=require('./squareMessage.attributes');module[_0xfeb6('0x6')]=function(_0x57989c,_0x58def5){return _0x57989c[_0xfeb6('0x7')](_0xfeb6('0x8'),attributes,{'tableName':_0xfeb6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 0008397..b524b34 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 _0x324b=['create','options','raw','then','CreateSquareMessage','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x2ed470,_0x54a05a){var _0x367bcf=function(_0xc2d63b){while(--_0xc2d63b){_0x2ed470['push'](_0x2ed470['shift']());}};_0x367bcf(++_0x54a05a);}(_0x324b,0x171));var _0xb324=function(_0x3a45ca,_0x48fa18){_0x3a45ca=_0x3a45ca-0x0;var _0x763df5=_0x324b[_0x3a45ca];return _0x763df5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb324('0x0'));var BPromise=require(_0xb324('0x1'));var rs=require(_0xb324('0x2'));var fs=require('fs');var Redis=require(_0xb324('0x3'));var db=require(_0xb324('0x4'))['db'];var utils=require(_0xb324('0x5'));var logger=require(_0xb324('0x6'))(_0xb324('0x7'));var config=require(_0xb324('0x8'));var jayson=require(_0xb324('0x9'));var client=jayson['client'][_0xb324('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c62ab,_0x1a6e2d,_0x532538){return new BPromise(function(_0x5b57fd,_0x33556a){return client[_0xb324('0xb')](_0x4c62ab,_0x532538)['then'](function(_0x1a793e){logger['info'](_0xb324('0xc'),_0x1a6e2d,_0xb324('0xd'));logger[_0xb324('0xe')](_0xb324('0xf'),_0x1a6e2d,'request\x20sent',JSON[_0xb324('0x10')](_0x1a793e));if(_0x1a793e['error']){if(_0x1a793e[_0xb324('0x11')][_0xb324('0x12')]===0x1f4){logger['error'](_0xb324('0xc'),_0x1a6e2d,_0x1a793e[_0xb324('0x11')][_0xb324('0x13')]);return _0x33556a(_0x1a793e[_0xb324('0x11')][_0xb324('0x13')]);}logger[_0xb324('0x11')]('SquareMessage,\x20%s,\x20%s',_0x1a6e2d,_0x1a793e[_0xb324('0x11')][_0xb324('0x13')]);return _0x5b57fd(_0x1a793e['error'][_0xb324('0x13')]);}else{logger[_0xb324('0x14')](_0xb324('0xc'),_0x1a6e2d,'request\x20sent');_0x5b57fd(_0x1a793e[_0xb324('0x15')][_0xb324('0x13')]);}})[_0xb324('0x16')](function(_0x2b7890){logger[_0xb324('0x11')](_0xb324('0xc'),_0x1a6e2d,_0x2b7890);_0x33556a(_0x2b7890);});});}exports['CreateSquareMessage']=function(_0x2d197b){var _0x56a2ba=this;return new Promise(function(_0x5cc1b4,_0x40addd){return db['SquareMessage'][_0xb324('0x17')](_0x2d197b['body'],{'raw':_0x2d197b[_0xb324('0x18')]?_0x2d197b[_0xb324('0x18')][_0xb324('0x19')]===undefined?!![]:![]:!![]})[_0xb324('0x1a')](function(_0x5d7baa){logger['info'](_0xb324('0x1b'),_0x2d197b);logger['debug']('CreateSquareMessage',_0x2d197b,JSON[_0xb324('0x10')](_0x5d7baa));_0x5cc1b4(_0x5d7baa);})[_0xb324('0x16')](function(_0x36cda2){logger['error'](_0xb324('0x1b'),_0x36cda2[_0xb324('0x13')],_0x2d197b);_0x40addd(_0x56a2ba[_0xb324('0x11')](0x1f4,_0x36cda2[_0xb324('0x13')]));});});}; \ No newline at end of file +var _0x7119=['message','result','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x44c567,_0xaacf99){var _0x3e8623=function(_0x6b7512){while(--_0x6b7512){_0x44c567['push'](_0x44c567['shift']());}};_0x3e8623(++_0xaacf99);}(_0x7119,0x76));var _0x9711=function(_0x1c3370,_0xf617e8){_0x1c3370=_0x1c3370-0x0;var _0xa9b358=_0x7119[_0x1c3370];return _0xa9b358;};'use strict';var _=require(_0x9711('0x0'));var util=require('util');var moment=require(_0x9711('0x1'));var BPromise=require(_0x9711('0x2'));var rs=require(_0x9711('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9711('0x4'))['db'];var utils=require(_0x9711('0x5'));var logger=require('../../config/logger')(_0x9711('0x6'));var config=require('../../config/environment');var jayson=require(_0x9711('0x7'));var client=jayson[_0x9711('0x8')][_0x9711('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x12ce0d,_0x5c8663,_0x577c3b){return new BPromise(function(_0xea1fa,_0x5e1ad8){return client['request'](_0x12ce0d,_0x577c3b)[_0x9711('0xa')](function(_0x1c69ba){logger[_0x9711('0xb')](_0x9711('0xc'),_0x5c8663,_0x9711('0xd'));logger['debug'](_0x9711('0xe'),_0x5c8663,_0x9711('0xd'),JSON[_0x9711('0xf')](_0x1c69ba));if(_0x1c69ba[_0x9711('0x10')]){if(_0x1c69ba[_0x9711('0x10')]['code']===0x1f4){logger[_0x9711('0x10')]('SquareMessage,\x20%s,\x20%s',_0x5c8663,_0x1c69ba['error'][_0x9711('0x11')]);return _0x5e1ad8(_0x1c69ba[_0x9711('0x10')][_0x9711('0x11')]);}logger[_0x9711('0x10')]('SquareMessage,\x20%s,\x20%s',_0x5c8663,_0x1c69ba[_0x9711('0x10')][_0x9711('0x11')]);return _0xea1fa(_0x1c69ba['error'][_0x9711('0x11')]);}else{logger[_0x9711('0xb')]('SquareMessage,\x20%s,\x20%s',_0x5c8663,_0x9711('0xd'));_0xea1fa(_0x1c69ba[_0x9711('0x12')][_0x9711('0x11')]);}})[_0x9711('0x13')](function(_0x22275f){logger['error'](_0x9711('0xc'),_0x5c8663,_0x22275f);_0x5e1ad8(_0x22275f);});});}exports[_0x9711('0x14')]=function(_0x4ba070){var _0x4a60d1=this;return new Promise(function(_0x331704,_0x5e7e68){return db[_0x9711('0x15')][_0x9711('0x16')](_0x4ba070[_0x9711('0x17')],{'raw':_0x4ba070[_0x9711('0x18')]?_0x4ba070[_0x9711('0x18')][_0x9711('0x19')]===undefined?!![]:![]:!![]})[_0x9711('0xa')](function(_0xec443e){logger[_0x9711('0xb')](_0x9711('0x14'),_0x4ba070);logger[_0x9711('0x1a')](_0x9711('0x14'),_0x4ba070,JSON[_0x9711('0xf')](_0xec443e));_0x331704(_0xec443e);})['catch'](function(_0x6ecd91){logger[_0x9711('0x10')](_0x9711('0x14'),_0x6ecd91[_0x9711('0x11')],_0x4ba070);_0x5e7e68(_0x4a60d1['error'](0x1f4,_0x6ecd91['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 626c843..e8ea4cd 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 _0x5672=['./squareOdbc.controller','isAuthenticated','get','15s','test','post','create','put','/:id','update','delete','destroy','exports','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x5672,0x92));var _0x2567=function(_0x58c86a,_0x602654){_0x58c86a=_0x58c86a-0x0;var _0x2bb374=_0x5672[_0x58c86a];return _0x2bb374;};'use strict';var multer=require('multer');var util=require(_0x2567('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2567('0x1')]();var fs_extra=require(_0x2567('0x2'));var auth=require(_0x2567('0x3'));var interaction=require(_0x2567('0x4'));var config=require(_0x2567('0x5'));var controller=require(_0x2567('0x6'));router['get']('/',auth[_0x2567('0x7')](),controller['index']);router['get']('/:id',auth[_0x2567('0x7')](),controller['show']);router[_0x2567('0x8')]('/:id/test',auth[_0x2567('0x7')](),timeout(_0x2567('0x9')),controller[_0x2567('0xa')]);router[_0x2567('0xb')]('/',auth['isAuthenticated'](),controller[_0x2567('0xc')]);router[_0x2567('0xd')](_0x2567('0xe'),auth['isAuthenticated'](),controller[_0x2567('0xf')]);router[_0x2567('0x10')](_0x2567('0xe'),auth['isAuthenticated'](),controller[_0x2567('0x11')]);module[_0x2567('0x12')]=router; \ No newline at end of file +var _0x4974=['destroy','exports','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','/:id/test','test','post','create','put','update','delete'];(function(_0x249cc4,_0x41d2ae){var _0x1f048b=function(_0x340e89){while(--_0x340e89){_0x249cc4['push'](_0x249cc4['shift']());}};_0x1f048b(++_0x41d2ae);}(_0x4974,0x145));var _0x4497=function(_0x23b70b,_0x827be7){_0x23b70b=_0x23b70b-0x0;var _0x69d657=_0x4974[_0x23b70b];return _0x69d657;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x4497('0x0'));var express=require('express');var router=express[_0x4497('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x4497('0x2'));var interaction=require(_0x4497('0x3'));var config=require(_0x4497('0x4'));var controller=require(_0x4497('0x5'));router[_0x4497('0x6')]('/',auth[_0x4497('0x7')](),controller[_0x4497('0x8')]);router['get'](_0x4497('0x9'),auth[_0x4497('0x7')](),controller['show']);router[_0x4497('0x6')](_0x4497('0xa'),auth['isAuthenticated'](),timeout('15s'),controller[_0x4497('0xb')]);router[_0x4497('0xc')]('/',auth[_0x4497('0x7')](),controller[_0x4497('0xd')]);router[_0x4497('0xe')](_0x4497('0x9'),auth[_0x4497('0x7')](),controller[_0x4497('0xf')]);router[_0x4497('0x10')](_0x4497('0x9'),auth[_0x4497('0x7')](),controller[_0x4497('0x11')]);module[_0x4497('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index de174a4..ebe6d8e 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 _0xb882=['STRING','name','sequelize','exports'];(function(_0x4b14b7,_0x374f8f){var _0x2168e9=function(_0xcaf5ac){while(--_0xcaf5ac){_0x4b14b7['push'](_0x4b14b7['shift']());}};_0x2168e9(++_0x374f8f);}(_0xb882,0x6a));var _0x2b88=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xb882[_0x38a7ac];return _0x53061a;};'use strict';var Sequelize=require(_0x2b88('0x0'));module[_0x2b88('0x1')]={'name':{'type':Sequelize[_0x2b88('0x2')],'unique':_0x2b88('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x2b88('0x2')]},'description':{'type':Sequelize[_0x2b88('0x2')]}}; \ No newline at end of file +var _0x55e1=['name','exports','STRING'];(function(_0xb65ffb,_0x2cc0af){var _0x58f55c=function(_0x24ba56){while(--_0x24ba56){_0xb65ffb['push'](_0xb65ffb['shift']());}};_0x58f55c(++_0x2cc0af);}(_0x55e1,0x127));var _0x155e=function(_0x4930da,_0x59c575){_0x4930da=_0x4930da-0x0;var _0x3d3e54=_0x55e1[_0x4930da];return _0x3d3e54;};'use strict';var Sequelize=require('sequelize');module[_0x155e('0x0')]={'name':{'type':Sequelize[_0x155e('0x1')],'unique':_0x155e('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x155e('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index c3f1f59..749de45 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 _0xc055=['length','hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','dsn','odbc','openSync','closeSync','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','get','ODBC','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','SquareOdbc','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields'];(function(_0x3b63bd,_0x40b8c7){var _0x14c82e=function(_0x288ac0){while(--_0x288ac0){_0x3b63bd['push'](_0x3b63bd['shift']());}};_0x14c82e(++_0x40b8c7);}(_0xc055,0x11f));var _0x5c05=function(_0xfbac0b,_0x20b38b){_0xfbac0b=_0xfbac0b-0x0;var _0x14e054=_0xc055[_0xfbac0b];return _0x14e054;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5c05('0x0'));var zipdir=require(_0x5c05('0x1'));var jsonpatch=require(_0x5c05('0x2'));var rp=require(_0x5c05('0x3'));var moment=require('moment');var BPromise=require(_0x5c05('0x4'));var Mustache=require('mustache');var util=require(_0x5c05('0x5'));var path=require(_0x5c05('0x6'));var sox=require(_0x5c05('0x7'));var csv=require(_0x5c05('0x8'));var ejs=require(_0x5c05('0x9'));var fs=require('fs');var fs_extra=require(_0x5c05('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5c05('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5c05('0x8'));var querystring=require(_0x5c05('0xc'));var Papa=require(_0x5c05('0xd'));var Redis=require(_0x5c05('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x5c05('0xf'));var as=require(_0x5c05('0x10'));var hardwareService=require(_0x5c05('0x11'));var logger=require(_0x5c05('0x12'))(_0x5c05('0x13'));var utils=require('../../config/utils');var config=require(_0x5c05('0x14'));var licenseUtil=require(_0x5c05('0x15'));var db=require(_0x5c05('0x16'))['db'];function respondWithStatusCode(_0x326791,_0x18ab0f){_0x18ab0f=_0x18ab0f||0xcc;return function(_0x5f3907){if(_0x5f3907){return _0x326791['sendStatus'](_0x18ab0f);}return _0x326791[_0x5c05('0x17')](_0x18ab0f)[_0x5c05('0x18')]();};}function respondWithResult(_0x286a77,_0x22c86f){_0x22c86f=_0x22c86f||0xc8;return function(_0xe52fa2){if(_0xe52fa2){return _0x286a77[_0x5c05('0x17')](_0x22c86f)['json'](_0xe52fa2);}};}function respondWithFilteredResult(_0x4421be,_0x38e867){return function(_0x11a1f1){if(_0x11a1f1){var _0xa77d6b=typeof _0x38e867['offset']===_0x5c05('0x19')&&typeof _0x38e867['limit']==='undefined';var _0x1a3bb3=_0x11a1f1[_0x5c05('0x1a')];var _0x5504c6=_0xa77d6b?0x0:_0x38e867['offset'];var _0x14a068=_0xa77d6b?_0x11a1f1[_0x5c05('0x1a')]:_0x38e867['offset']+_0x38e867[_0x5c05('0x1b')];var _0x1d61c0;if(_0x14a068>=_0x1a3bb3){_0x14a068=_0x1a3bb3;_0x1d61c0=0xc8;}else{_0x1d61c0=0xce;}_0x4421be[_0x5c05('0x17')](_0x1d61c0);return _0x4421be[_0x5c05('0x1c')](_0x5c05('0x1d'),_0x5504c6+'-'+_0x14a068+'/'+_0x1a3bb3)['json'](_0x11a1f1);}return null;};}function patchUpdates(_0x508f3b){return function(_0x320ee0){try{jsonpatch[_0x5c05('0x1e')](_0x320ee0,_0x508f3b,!![]);}catch(_0x336658){return BPromise[_0x5c05('0x1f')](_0x336658);}return _0x320ee0[_0x5c05('0x20')]();};}function saveUpdates(_0x1cc1b3,_0x361deb){return function(_0x3e5e45){if(_0x3e5e45){return _0x3e5e45[_0x5c05('0x21')](_0x1cc1b3)['then'](function(_0x454a30){return _0x454a30;});}return null;};}function removeEntity(_0x3b3569,_0x3a15a4){return function(_0x4aeac0){if(_0x4aeac0){return _0x4aeac0['destroy']()[_0x5c05('0x22')](function(){var _0xe56b2f=_0x4aeac0[_0x5c05('0x23')]({'plain':!![]});var _0x41968c=_0x5c05('0x24');return db[_0x5c05('0x25')][_0x5c05('0x26')]({'where':{'type':_0x41968c,'resourceId':_0xe56b2f['id']}})[_0x5c05('0x22')](function(){return _0x4aeac0;});})[_0x5c05('0x22')](function(){_0x3b3569[_0x5c05('0x17')](0xcc)[_0x5c05('0x18')]();});}};}function handleEntityNotFound(_0x499ca7,_0x16a1d1){return function(_0x2e73cc){if(!_0x2e73cc){_0x499ca7[_0x5c05('0x27')](0x194);}return _0x2e73cc;};}function handleError(_0xb675e3,_0x4a8c3f){_0x4a8c3f=_0x4a8c3f||0x1f4;return function(_0x405cf4){logger[_0x5c05('0x28')](_0x405cf4[_0x5c05('0x29')]);if(_0x405cf4[_0x5c05('0x2a')]){delete _0x405cf4[_0x5c05('0x2a')];}_0xb675e3['status'](_0x4a8c3f)[_0x5c05('0x2b')](_0x405cf4);};}exports[_0x5c05('0x2c')]=function(_0x20a696,_0x29fadf){var _0x1dfc2a={},_0x5612d0={},_0x183b2b={'count':0x0,'rows':[]};var _0x78f69d=_[_0x5c05('0x2d')](db[_0x5c05('0x2e')]['rawAttributes'],function(_0x445ca2){return{'name':_0x445ca2[_0x5c05('0x2f')],'type':_0x445ca2[_0x5c05('0x30')][_0x5c05('0x31')]};});_0x5612d0['model']=_[_0x5c05('0x2d')](_0x78f69d,_0x5c05('0x2a'));_0x5612d0['query']=_[_0x5c05('0x32')](_0x20a696[_0x5c05('0x33')]);_0x5612d0[_0x5c05('0x34')]=_[_0x5c05('0x35')](_0x5612d0[_0x5c05('0x36')],_0x5612d0[_0x5c05('0x33')]);_0x1dfc2a[_0x5c05('0x37')]=_[_0x5c05('0x35')](_0x5612d0[_0x5c05('0x36')],qs[_0x5c05('0x38')](_0x20a696[_0x5c05('0x33')][_0x5c05('0x38')]));_0x1dfc2a[_0x5c05('0x37')]=_0x1dfc2a[_0x5c05('0x37')][_0x5c05('0x39')]?_0x1dfc2a[_0x5c05('0x37')]:_0x5612d0[_0x5c05('0x36')];if(!_0x20a696[_0x5c05('0x33')][_0x5c05('0x3a')](_0x5c05('0x3b'))){_0x1dfc2a['limit']=qs[_0x5c05('0x1b')](_0x20a696['query'][_0x5c05('0x1b')]);_0x1dfc2a[_0x5c05('0x3c')]=qs['offset'](_0x20a696[_0x5c05('0x33')][_0x5c05('0x3c')]);}_0x1dfc2a['order']=qs[_0x5c05('0x3d')](_0x20a696[_0x5c05('0x33')][_0x5c05('0x3d')]);_0x1dfc2a[_0x5c05('0x3e')]=qs[_0x5c05('0x34')](_[_0x5c05('0x3f')](_0x20a696[_0x5c05('0x33')],_0x5612d0[_0x5c05('0x34')]),_0x78f69d);if(_0x20a696[_0x5c05('0x33')][_0x5c05('0x40')]){_0x1dfc2a[_0x5c05('0x3e')]=_['merge'](_0x1dfc2a['where'],{'$or':_[_0x5c05('0x2d')](_0x78f69d,function(_0x46cef5){if(_0x46cef5[_0x5c05('0x30')]!=='VIRTUAL'){var _0xddd2fb={};_0xddd2fb[_0x46cef5[_0x5c05('0x2a')]]={'$like':'%'+_0x20a696[_0x5c05('0x33')][_0x5c05('0x40')]+'%'};return _0xddd2fb;}})});}_0x1dfc2a=_[_0x5c05('0x41')]({},_0x1dfc2a,_0x20a696['options']);var _0x4d8046={'where':_0x1dfc2a[_0x5c05('0x3e')]};return db['SquareOdbc'][_0x5c05('0x1a')](_0x4d8046)['then'](function(_0x1c57a2){_0x183b2b[_0x5c05('0x1a')]=_0x1c57a2;if(_0x20a696['query'][_0x5c05('0x42')]){_0x1dfc2a[_0x5c05('0x43')]=[{'all':!![]}];}return db[_0x5c05('0x2e')][_0x5c05('0x44')](_0x1dfc2a);})[_0x5c05('0x22')](function(_0x5ec588){_0x183b2b[_0x5c05('0x45')]=_0x5ec588;return _0x183b2b;})[_0x5c05('0x22')](respondWithFilteredResult(_0x29fadf,_0x1dfc2a))[_0x5c05('0x46')](handleError(_0x29fadf,null));};exports[_0x5c05('0x47')]=function(_0x3c6879,_0x5a2064){var _0x150305={'raw':!![],'where':{'id':_0x3c6879[_0x5c05('0x48')]['id']}},_0xb9fd5a={};_0xb9fd5a[_0x5c05('0x36')]=_['keys'](db[_0x5c05('0x2e')][_0x5c05('0x49')]);_0xb9fd5a[_0x5c05('0x33')]=_[_0x5c05('0x32')](_0x3c6879[_0x5c05('0x33')]);_0xb9fd5a[_0x5c05('0x34')]=_[_0x5c05('0x35')](_0xb9fd5a['model'],_0xb9fd5a[_0x5c05('0x33')]);_0x150305['attributes']=_[_0x5c05('0x35')](_0xb9fd5a[_0x5c05('0x36')],qs[_0x5c05('0x38')](_0x3c6879['query'][_0x5c05('0x38')]));_0x150305[_0x5c05('0x37')]=_0x150305[_0x5c05('0x37')]['length']?_0x150305[_0x5c05('0x37')]:_0xb9fd5a[_0x5c05('0x36')];if(_0x3c6879[_0x5c05('0x33')]['includeAll']){_0x150305['include']=[{'all':!![]}];}_0x150305=_[_0x5c05('0x41')]({},_0x150305,_0x3c6879[_0x5c05('0x4a')]);return db[_0x5c05('0x2e')][_0x5c05('0x4b')](_0x150305)[_0x5c05('0x22')](handleEntityNotFound(_0x5a2064,null))[_0x5c05('0x22')](respondWithResult(_0x5a2064,null))[_0x5c05('0x46')](handleError(_0x5a2064,null));};exports[_0x5c05('0x4c')]=function(_0x53da8c,_0x151b3d){return db[_0x5c05('0x2e')][_0x5c05('0x4c')](_0x53da8c[_0x5c05('0x4d')],{})[_0x5c05('0x22')](function(_0x3b0dd5){var _0x37c7dd=_0x53da8c['user'][_0x5c05('0x23')]({'plain':!![]});if(!_0x37c7dd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x37c7dd[_0x5c05('0x4e')]==='user'){var _0x52c3b7=_0x3b0dd5[_0x5c05('0x23')]({'plain':!![]});var _0x2ae9c1=_0x5c05('0x24');return db[_0x5c05('0x4f')]['find']({'where':{'name':_0x2ae9c1,'userProfileId':_0x37c7dd[_0x5c05('0x50')]},'raw':!![]})['then'](function(_0xf1b279){if(_0xf1b279&&_0xf1b279['autoAssociation']===0x0){return db[_0x5c05('0x25')][_0x5c05('0x4c')]({'name':_0x52c3b7[_0x5c05('0x2a')],'resourceId':_0x52c3b7['id'],'type':_0xf1b279['name'],'sectionId':_0xf1b279['id']},{})[_0x5c05('0x22')](function(){return _0x3b0dd5;});}else{return _0x3b0dd5;}})[_0x5c05('0x46')](function(_0xc74ff8){logger[_0x5c05('0x28')](_0x5c05('0x51'),_0xc74ff8);throw _0xc74ff8;});}return _0x3b0dd5;})[_0x5c05('0x22')](respondWithResult(_0x151b3d,0xc9))[_0x5c05('0x46')](handleError(_0x151b3d,null));};exports[_0x5c05('0x21')]=function(_0x456e0c,_0x2f93c1){if(_0x456e0c[_0x5c05('0x4d')]['id']){delete _0x456e0c[_0x5c05('0x4d')]['id'];}return db[_0x5c05('0x2e')][_0x5c05('0x4b')]({'where':{'id':_0x456e0c[_0x5c05('0x48')]['id']}})[_0x5c05('0x22')](handleEntityNotFound(_0x2f93c1,null))['then'](saveUpdates(_0x456e0c[_0x5c05('0x4d')],null))[_0x5c05('0x22')](respondWithResult(_0x2f93c1,null))[_0x5c05('0x46')](handleError(_0x2f93c1,null));};exports['destroy']=function(_0xe2e079,_0xfe5e09){return db['SquareOdbc']['find']({'where':{'id':_0xe2e079[_0x5c05('0x48')]['id']}})[_0x5c05('0x22')](handleEntityNotFound(_0xfe5e09,null))['then'](removeEntity(_0xfe5e09,null))[_0x5c05('0x46')](handleError(_0xfe5e09,null));};exports['test']=function(_0x21cdc7,_0x5faa74,_0x49d077){var _0x126892;return db['SquareOdbc'][_0x5c05('0x4b')]({'where':{'id':_0x21cdc7[_0x5c05('0x48')]['id']},'attributes':['id',_0x5c05('0x52')]})[_0x5c05('0x22')](handleEntityNotFound(_0x5faa74,null))[_0x5c05('0x22')](function(_0x3cb340){if(_0x3cb340){var _0x311f27=require(_0x5c05('0x53'))();_0x311f27[_0x5c05('0x54')](_0x3cb340[_0x5c05('0x52')]);_0x311f27[_0x5c05('0x55')]();return _0x3cb340;}})[_0x5c05('0x22')](respondWithResult(_0x5faa74,null))['catch'](handleError(_0x5faa74,null));}; \ No newline at end of file +var _0x3850=['fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','ODBC','error','stack','name','send','index','map','SquareOdbc','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','catch','show','params','include','find','create','body','user','get','role','UserProfileSection','autoAssociation','UserProfileResource','test','dsn','odbc','openSync','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv'];(function(_0x346974,_0x58b2ae){var _0x3f21eb=function(_0x397817){while(--_0x397817){_0x346974['push'](_0x346974['shift']());}};_0x3f21eb(++_0x58b2ae);}(_0x3850,0xa2));var _0x0385=function(_0x5eb2e2,_0x472765){_0x5eb2e2=_0x5eb2e2-0x0;var _0x3581b5=_0x3850[_0x5eb2e2];return _0x3581b5;};'use strict';var emlformat=require(_0x0385('0x0'));var rimraf=require(_0x0385('0x1'));var zipdir=require(_0x0385('0x2'));var jsonpatch=require(_0x0385('0x3'));var rp=require(_0x0385('0x4'));var moment=require(_0x0385('0x5'));var BPromise=require(_0x0385('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0385('0x7'));var sox=require(_0x0385('0x8'));var csv=require(_0x0385('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0385('0xa'));var _=require('lodash');var squel=require(_0x0385('0xb'));var crypto=require(_0x0385('0xc'));var jsforce=require(_0x0385('0xd'));var deskjs=require(_0x0385('0xe'));var toCsv=require(_0x0385('0x9'));var querystring=require('querystring');var Papa=require(_0x0385('0xf'));var Redis=require(_0x0385('0x10'));var authService=require(_0x0385('0x11'));var qs=require(_0x0385('0x12'));var as=require(_0x0385('0x13'));var hardwareService=require(_0x0385('0x14'));var logger=require(_0x0385('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x0385('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0385('0x17'))['db'];function respondWithStatusCode(_0x289539,_0x30e868){_0x30e868=_0x30e868||0xcc;return function(_0x34c568){if(_0x34c568){return _0x289539[_0x0385('0x18')](_0x30e868);}return _0x289539[_0x0385('0x19')](_0x30e868)['end']();};}function respondWithResult(_0x1ad5a6,_0x7daf30){_0x7daf30=_0x7daf30||0xc8;return function(_0x53f7ba){if(_0x53f7ba){return _0x1ad5a6['status'](_0x7daf30)['json'](_0x53f7ba);}};}function respondWithFilteredResult(_0x4dd47a,_0x32bb06){return function(_0x523627){if(_0x523627){var _0x12e9bc=typeof _0x32bb06['offset']===_0x0385('0x1a')&&typeof _0x32bb06[_0x0385('0x1b')]===_0x0385('0x1a');var _0x261287=_0x523627[_0x0385('0x1c')];var _0x55d482=_0x12e9bc?0x0:_0x32bb06[_0x0385('0x1d')];var _0x111b4c=_0x12e9bc?_0x523627[_0x0385('0x1c')]:_0x32bb06['offset']+_0x32bb06[_0x0385('0x1b')];var _0x4dc8ed;if(_0x111b4c>=_0x261287){_0x111b4c=_0x261287;_0x4dc8ed=0xc8;}else{_0x4dc8ed=0xce;}_0x4dd47a[_0x0385('0x19')](_0x4dc8ed);return _0x4dd47a['set'](_0x0385('0x1e'),_0x55d482+'-'+_0x111b4c+'/'+_0x261287)[_0x0385('0x1f')](_0x523627);}return null;};}function patchUpdates(_0xebe659){return function(_0x68fe86){try{jsonpatch[_0x0385('0x20')](_0x68fe86,_0xebe659,!![]);}catch(_0xde579b){return BPromise[_0x0385('0x21')](_0xde579b);}return _0x68fe86[_0x0385('0x22')]();};}function saveUpdates(_0x34cfd7,_0x19143a){return function(_0x17c618){if(_0x17c618){return _0x17c618[_0x0385('0x23')](_0x34cfd7)[_0x0385('0x24')](function(_0x1f8026){return _0x1f8026;});}return null;};}function removeEntity(_0x13ffc1,_0x501196){return function(_0x3f491b){if(_0x3f491b){return _0x3f491b[_0x0385('0x25')]()[_0x0385('0x24')](function(){var _0x23ff5f=_0x3f491b['get']({'plain':!![]});var _0x4c8295=_0x0385('0x26');return db['UserProfileResource'][_0x0385('0x25')]({'where':{'type':_0x4c8295,'resourceId':_0x23ff5f['id']}})[_0x0385('0x24')](function(){return _0x3f491b;});})['then'](function(){_0x13ffc1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x14d0e0,_0x4aad8a){return function(_0x378839){if(!_0x378839){_0x14d0e0[_0x0385('0x18')](0x194);}return _0x378839;};}function handleError(_0x1196d0,_0x52b00a){_0x52b00a=_0x52b00a||0x1f4;return function(_0x5ea03d){logger[_0x0385('0x27')](_0x5ea03d[_0x0385('0x28')]);if(_0x5ea03d['name']){delete _0x5ea03d[_0x0385('0x29')];}_0x1196d0[_0x0385('0x19')](_0x52b00a)[_0x0385('0x2a')](_0x5ea03d);};}exports[_0x0385('0x2b')]=function(_0x47dd3e,_0x3bf9ed){var _0x437df9={},_0x3e9471={},_0x408031={'count':0x0,'rows':[]};var _0x13a924=_[_0x0385('0x2c')](db[_0x0385('0x2d')][_0x0385('0x2e')],function(_0x390de8){return{'name':_0x390de8[_0x0385('0x2f')],'type':_0x390de8[_0x0385('0x30')][_0x0385('0x31')]};});_0x3e9471[_0x0385('0x32')]=_[_0x0385('0x2c')](_0x13a924,_0x0385('0x29'));_0x3e9471[_0x0385('0x33')]=_[_0x0385('0x34')](_0x47dd3e[_0x0385('0x33')]);_0x3e9471[_0x0385('0x35')]=_[_0x0385('0x36')](_0x3e9471[_0x0385('0x32')],_0x3e9471[_0x0385('0x33')]);_0x437df9['attributes']=_[_0x0385('0x36')](_0x3e9471['model'],qs[_0x0385('0x37')](_0x47dd3e[_0x0385('0x33')][_0x0385('0x37')]));_0x437df9['attributes']=_0x437df9[_0x0385('0x38')][_0x0385('0x39')]?_0x437df9[_0x0385('0x38')]:_0x3e9471[_0x0385('0x32')];if(!_0x47dd3e[_0x0385('0x33')]['hasOwnProperty'](_0x0385('0x3a'))){_0x437df9[_0x0385('0x1b')]=qs[_0x0385('0x1b')](_0x47dd3e[_0x0385('0x33')][_0x0385('0x1b')]);_0x437df9[_0x0385('0x1d')]=qs[_0x0385('0x1d')](_0x47dd3e['query']['offset']);}_0x437df9[_0x0385('0x3b')]=qs[_0x0385('0x3c')](_0x47dd3e[_0x0385('0x33')][_0x0385('0x3c')]);_0x437df9[_0x0385('0x3d')]=qs[_0x0385('0x35')](_[_0x0385('0x3e')](_0x47dd3e['query'],_0x3e9471[_0x0385('0x35')]),_0x13a924);if(_0x47dd3e[_0x0385('0x33')][_0x0385('0x3f')]){_0x437df9['where']=_[_0x0385('0x40')](_0x437df9[_0x0385('0x3d')],{'$or':_[_0x0385('0x2c')](_0x13a924,function(_0x44a75c){if(_0x44a75c[_0x0385('0x30')]!==_0x0385('0x41')){var _0x15526a={};_0x15526a[_0x44a75c[_0x0385('0x29')]]={'$like':'%'+_0x47dd3e[_0x0385('0x33')][_0x0385('0x3f')]+'%'};return _0x15526a;}})});}_0x437df9=_[_0x0385('0x40')]({},_0x437df9,_0x47dd3e[_0x0385('0x42')]);var _0x45b351={'where':_0x437df9[_0x0385('0x3d')]};return db[_0x0385('0x2d')][_0x0385('0x1c')](_0x45b351)[_0x0385('0x24')](function(_0xb14ec9){_0x408031['count']=_0xb14ec9;if(_0x47dd3e[_0x0385('0x33')][_0x0385('0x43')]){_0x437df9['include']=[{'all':!![]}];}return db['SquareOdbc']['findAll'](_0x437df9);})[_0x0385('0x24')](function(_0x4f6055){_0x408031['rows']=_0x4f6055;return _0x408031;})['then'](respondWithFilteredResult(_0x3bf9ed,_0x437df9))[_0x0385('0x44')](handleError(_0x3bf9ed,null));};exports[_0x0385('0x45')]=function(_0x278f33,_0x2ec57c){var _0x265649={'raw':!![],'where':{'id':_0x278f33[_0x0385('0x46')]['id']}},_0x157fe8={};_0x157fe8[_0x0385('0x32')]=_[_0x0385('0x34')](db[_0x0385('0x2d')][_0x0385('0x2e')]);_0x157fe8['query']=_[_0x0385('0x34')](_0x278f33[_0x0385('0x33')]);_0x157fe8['filters']=_[_0x0385('0x36')](_0x157fe8[_0x0385('0x32')],_0x157fe8[_0x0385('0x33')]);_0x265649['attributes']=_['intersection'](_0x157fe8[_0x0385('0x32')],qs[_0x0385('0x37')](_0x278f33['query'][_0x0385('0x37')]));_0x265649[_0x0385('0x38')]=_0x265649[_0x0385('0x38')][_0x0385('0x39')]?_0x265649[_0x0385('0x38')]:_0x157fe8['model'];if(_0x278f33[_0x0385('0x33')][_0x0385('0x43')]){_0x265649[_0x0385('0x47')]=[{'all':!![]}];}_0x265649=_[_0x0385('0x40')]({},_0x265649,_0x278f33[_0x0385('0x42')]);return db[_0x0385('0x2d')][_0x0385('0x48')](_0x265649)[_0x0385('0x24')](handleEntityNotFound(_0x2ec57c,null))[_0x0385('0x24')](respondWithResult(_0x2ec57c,null))[_0x0385('0x44')](handleError(_0x2ec57c,null));};exports[_0x0385('0x49')]=function(_0x1153c7,_0x8ecf54){return db[_0x0385('0x2d')][_0x0385('0x49')](_0x1153c7[_0x0385('0x4a')],{})[_0x0385('0x24')](function(_0x3fa039){var _0x28e651=_0x1153c7[_0x0385('0x4b')][_0x0385('0x4c')]({'plain':!![]});if(!_0x28e651)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x28e651[_0x0385('0x4d')]===_0x0385('0x4b')){var _0x340b18=_0x3fa039[_0x0385('0x4c')]({'plain':!![]});var _0x78149f='ODBC';return db[_0x0385('0x4e')][_0x0385('0x48')]({'where':{'name':_0x78149f,'userProfileId':_0x28e651['userProfileId']},'raw':!![]})[_0x0385('0x24')](function(_0x14e8e0){if(_0x14e8e0&&_0x14e8e0[_0x0385('0x4f')]===0x0){return db[_0x0385('0x50')][_0x0385('0x49')]({'name':_0x340b18[_0x0385('0x29')],'resourceId':_0x340b18['id'],'type':_0x14e8e0[_0x0385('0x29')],'sectionId':_0x14e8e0['id']},{})[_0x0385('0x24')](function(){return _0x3fa039;});}else{return _0x3fa039;}})['catch'](function(_0x1652f6){logger[_0x0385('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1652f6);throw _0x1652f6;});}return _0x3fa039;})[_0x0385('0x24')](respondWithResult(_0x8ecf54,0xc9))[_0x0385('0x44')](handleError(_0x8ecf54,null));};exports[_0x0385('0x23')]=function(_0x42e14f,_0x36d4c8){if(_0x42e14f[_0x0385('0x4a')]['id']){delete _0x42e14f['body']['id'];}return db[_0x0385('0x2d')][_0x0385('0x48')]({'where':{'id':_0x42e14f['params']['id']}})[_0x0385('0x24')](handleEntityNotFound(_0x36d4c8,null))[_0x0385('0x24')](saveUpdates(_0x42e14f[_0x0385('0x4a')],null))[_0x0385('0x24')](respondWithResult(_0x36d4c8,null))[_0x0385('0x44')](handleError(_0x36d4c8,null));};exports[_0x0385('0x25')]=function(_0x4f8db0,_0x4e1c8e){return db[_0x0385('0x2d')][_0x0385('0x48')]({'where':{'id':_0x4f8db0[_0x0385('0x46')]['id']}})['then'](handleEntityNotFound(_0x4e1c8e,null))[_0x0385('0x24')](removeEntity(_0x4e1c8e,null))[_0x0385('0x44')](handleError(_0x4e1c8e,null));};exports[_0x0385('0x51')]=function(_0x4200f4,_0x14c789,_0x3b3207){var _0xbe2fe5;return db['SquareOdbc'][_0x0385('0x48')]({'where':{'id':_0x4200f4[_0x0385('0x46')]['id']},'attributes':['id',_0x0385('0x52')]})[_0x0385('0x24')](handleEntityNotFound(_0x14c789,null))[_0x0385('0x24')](function(_0x1b91ab){if(_0x1b91ab){var _0x47b261=require(_0x0385('0x53'))();_0x47b261[_0x0385('0x54')](_0x1b91ab[_0x0385('0x52')]);_0x47b261[_0x0385('0x55')]();return _0x1b91ab;}})[_0x0385('0x24')](respondWithResult(_0x14c789,null))[_0x0385('0x44')](handleError(_0x14c789,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 2b835e7..4181735 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 _0x1535=['path','rimraf','exports','define','square_odbc','util','../../config/logger','bluebird','request-promise'];(function(_0x3f688f,_0x11cbb2){var _0x2c4e48=function(_0x2ebde3){while(--_0x2ebde3){_0x3f688f['push'](_0x3f688f['shift']());}};_0x2c4e48(++_0x11cbb2);}(_0x1535,0xe6));var _0x5153=function(_0x3e3685,_0x26bdbf){_0x3e3685=_0x3e3685-0x0;var _0x3ce2b8=_0x1535[_0x3e3685];return _0x3ce2b8;};'use strict';var _=require('lodash');var util=require(_0x5153('0x0'));var logger=require(_0x5153('0x1'))('api');var moment=require('moment');var BPromise=require(_0x5153('0x2'));var rp=require(_0x5153('0x3'));var fs=require('fs');var path=require(_0x5153('0x4'));var rimraf=require(_0x5153('0x5'));var config=require('../../config/environment');var attributes=require('./squareOdbc.attributes');module[_0x5153('0x6')]=function(_0x21838b,_0x4e9833){return _0x21838b[_0x5153('0x7')]('SquareOdbc',attributes,{'tableName':_0x5153('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xff4c=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','SquareOdbc','square_odbc','lodash','util','../../config/logger'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xff4c,0x69));var _0xcff4=function(_0x374ada,_0x27b3a5){_0x374ada=_0x374ada-0x0;var _0x449ed8=_0xff4c[_0x374ada];return _0x449ed8;};'use strict';var _=require(_0xcff4('0x0'));var util=require(_0xcff4('0x1'));var logger=require(_0xcff4('0x2'))('api');var moment=require(_0xcff4('0x3'));var BPromise=require(_0xcff4('0x4'));var rp=require(_0xcff4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcff4('0x6'));var config=require(_0xcff4('0x7'));var attributes=require('./squareOdbc.attributes');module[_0xcff4('0x8')]=function(_0x49329c,_0x48d2d3){return _0x49329c[_0xcff4('0x9')](_0xcff4('0xa'),attributes,{'tableName':_0xcff4('0xb'),'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 318c5f2..97b4e7c 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 _0x2239=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','debug','request\x20sent','error','message','result','ShowSquareOdbc','find','options','raw','where','include','map','model','attributes','catch','lodash','util','moment','bluebird'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x2239,0x9c));var _0x9223=function(_0x507a03,_0x22a49d){_0x507a03=_0x507a03-0x0;var _0xb5e753=_0x2239[_0x507a03];return _0xb5e753;};'use strict';var _=require(_0x9223('0x0'));var util=require(_0x9223('0x1'));var moment=require(_0x9223('0x2'));var BPromise=require(_0x9223('0x3'));var rs=require(_0x9223('0x4'));var fs=require('fs');var Redis=require(_0x9223('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9223('0x6'));var logger=require(_0x9223('0x7'))(_0x9223('0x8'));var config=require(_0x9223('0x9'));var jayson=require(_0x9223('0xa'));var client=jayson[_0x9223('0xb')][_0x9223('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3bf04c,_0x97344c,_0x1f6df4){return new BPromise(function(_0x325263,_0xb81d04){return client[_0x9223('0xd')](_0x3bf04c,_0x1f6df4)[_0x9223('0xe')](function(_0x2c887d){logger[_0x9223('0xf')](_0x9223('0x10'),_0x97344c,'request\x20sent');logger[_0x9223('0x11')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x97344c,_0x9223('0x12'),JSON['stringify'](_0x2c887d));if(_0x2c887d[_0x9223('0x13')]){if(_0x2c887d[_0x9223('0x13')]['code']===0x1f4){logger[_0x9223('0x13')]('SquareOdbc,\x20%s,\x20%s',_0x97344c,_0x2c887d['error'][_0x9223('0x14')]);return _0xb81d04(_0x2c887d[_0x9223('0x13')]['message']);}logger['error']('SquareOdbc,\x20%s,\x20%s',_0x97344c,_0x2c887d['error']['message']);return _0x325263(_0x2c887d[_0x9223('0x13')]['message']);}else{logger[_0x9223('0xf')](_0x9223('0x10'),_0x97344c,'request\x20sent');_0x325263(_0x2c887d[_0x9223('0x15')]['message']);}})['catch'](function(_0xff209e){logger[_0x9223('0x13')](_0x9223('0x10'),_0x97344c,_0xff209e);_0xb81d04(_0xff209e);});});}exports[_0x9223('0x16')]=function(_0x3f8ecd){var _0x4cf78f=this;return new Promise(function(_0x1751bf,_0x15338c){return db['SquareOdbc'][_0x9223('0x17')]({'raw':_0x3f8ecd[_0x9223('0x18')]?_0x3f8ecd[_0x9223('0x18')][_0x9223('0x19')]===undefined?!![]:![]:!![],'where':_0x3f8ecd[_0x9223('0x18')]?_0x3f8ecd['options'][_0x9223('0x1a')]||null:null,'attributes':_0x3f8ecd['options']?_0x3f8ecd['options']['attributes']||null:null,'include':_0x3f8ecd[_0x9223('0x18')]?_0x3f8ecd[_0x9223('0x18')][_0x9223('0x1b')]?_[_0x9223('0x1c')](_0x3f8ecd[_0x9223('0x18')][_0x9223('0x1b')],function(_0x7ead2f){return{'model':db[_0x7ead2f[_0x9223('0x1d')]],'as':_0x7ead2f['as'],'attributes':_0x7ead2f[_0x9223('0x1e')],'include':_0x7ead2f[_0x9223('0x1b')]?_['map'](_0x7ead2f['include'],function(_0x2bd955){return{'model':db[_0x2bd955[_0x9223('0x1d')]],'as':_0x2bd955['as'],'attributes':_0x2bd955[_0x9223('0x1e')],'include':_0x2bd955[_0x9223('0x1b')]?_[_0x9223('0x1c')](_0x2bd955[_0x9223('0x1b')],function(_0x25770c){return{'model':db[_0x25770c[_0x9223('0x1d')]],'as':_0x25770c['as'],'attributes':_0x25770c[_0x9223('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x9223('0xe')](function(_0x5a9cf5){logger['info'](_0x9223('0x16'),_0x3f8ecd);logger[_0x9223('0x11')]('ShowSquareOdbc',_0x3f8ecd,JSON['stringify'](_0x5a9cf5));_0x1751bf(_0x5a9cf5);})[_0x9223('0x1f')](function(_0x396356){logger[_0x9223('0x13')](_0x9223('0x16'),_0x396356[_0x9223('0x14')],_0x3f8ecd);_0x15338c(_0x4cf78f['error'](0x1f4,_0x396356['message']));});});}; \ No newline at end of file +var _0xa58f=['map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','ShowSquareOdbc','find','options','raw','where','attributes','include'];(function(_0x3b55a8,_0x4edbf4){var _0x418f4a=function(_0x578a15){while(--_0x578a15){_0x3b55a8['push'](_0x3b55a8['shift']());}};_0x418f4a(++_0x4edbf4);}(_0xa58f,0x10a));var _0xfa58=function(_0x5562fe,_0x4e809c){_0x5562fe=_0x5562fe-0x0;var _0x1829c7=_0xa58f[_0x5562fe];return _0x1829c7;};'use strict';var _=require(_0xfa58('0x0'));var util=require(_0xfa58('0x1'));var moment=require(_0xfa58('0x2'));var BPromise=require(_0xfa58('0x3'));var rs=require(_0xfa58('0x4'));var fs=require('fs');var Redis=require(_0xfa58('0x5'));var db=require(_0xfa58('0x6'))['db'];var utils=require(_0xfa58('0x7'));var logger=require(_0xfa58('0x8'))(_0xfa58('0x9'));var config=require(_0xfa58('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xfa58('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x573635,_0x185804,_0x237fc1){return new BPromise(function(_0x488d47,_0x1a4577){return client[_0xfa58('0xc')](_0x573635,_0x237fc1)[_0xfa58('0xd')](function(_0x4bff3c){logger['info'](_0xfa58('0xe'),_0x185804,'request\x20sent');logger[_0xfa58('0xf')](_0xfa58('0x10'),_0x185804,_0xfa58('0x11'),JSON[_0xfa58('0x12')](_0x4bff3c));if(_0x4bff3c['error']){if(_0x4bff3c[_0xfa58('0x13')][_0xfa58('0x14')]===0x1f4){logger['error'](_0xfa58('0xe'),_0x185804,_0x4bff3c[_0xfa58('0x13')][_0xfa58('0x15')]);return _0x1a4577(_0x4bff3c['error'][_0xfa58('0x15')]);}logger[_0xfa58('0x13')](_0xfa58('0xe'),_0x185804,_0x4bff3c[_0xfa58('0x13')][_0xfa58('0x15')]);return _0x488d47(_0x4bff3c[_0xfa58('0x13')][_0xfa58('0x15')]);}else{logger[_0xfa58('0x16')](_0xfa58('0xe'),_0x185804,_0xfa58('0x11'));_0x488d47(_0x4bff3c['result']['message']);}})[_0xfa58('0x17')](function(_0x572c4d){logger['error'](_0xfa58('0xe'),_0x185804,_0x572c4d);_0x1a4577(_0x572c4d);});});}exports[_0xfa58('0x18')]=function(_0x27c557){var _0x2e813e=this;return new Promise(function(_0x440b45,_0x3f1334){return db['SquareOdbc'][_0xfa58('0x19')]({'raw':_0x27c557[_0xfa58('0x1a')]?_0x27c557[_0xfa58('0x1a')][_0xfa58('0x1b')]===undefined?!![]:![]:!![],'where':_0x27c557[_0xfa58('0x1a')]?_0x27c557[_0xfa58('0x1a')][_0xfa58('0x1c')]||null:null,'attributes':_0x27c557[_0xfa58('0x1a')]?_0x27c557['options'][_0xfa58('0x1d')]||null:null,'include':_0x27c557[_0xfa58('0x1a')]?_0x27c557[_0xfa58('0x1a')][_0xfa58('0x1e')]?_[_0xfa58('0x1f')](_0x27c557[_0xfa58('0x1a')]['include'],function(_0x59ecd1){return{'model':db[_0x59ecd1['model']],'as':_0x59ecd1['as'],'attributes':_0x59ecd1[_0xfa58('0x1d')],'include':_0x59ecd1['include']?_[_0xfa58('0x1f')](_0x59ecd1[_0xfa58('0x1e')],function(_0x38bba3){return{'model':db[_0x38bba3['model']],'as':_0x38bba3['as'],'attributes':_0x38bba3[_0xfa58('0x1d')],'include':_0x38bba3[_0xfa58('0x1e')]?_[_0xfa58('0x1f')](_0x38bba3[_0xfa58('0x1e')],function(_0x2e3d98){return{'model':db[_0x2e3d98[_0xfa58('0x20')]],'as':_0x2e3d98['as'],'attributes':_0x2e3d98['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1431aa){logger[_0xfa58('0x16')](_0xfa58('0x18'),_0x27c557);logger[_0xfa58('0xf')](_0xfa58('0x18'),_0x27c557,JSON[_0xfa58('0x12')](_0x1431aa));_0x440b45(_0x1431aa);})[_0xfa58('0x17')](function(_0x5bc710){logger[_0xfa58('0x13')](_0xfa58('0x18'),_0x5bc710[_0xfa58('0x15')],_0x27c557);_0x3f1334(_0x2e813e[_0xfa58('0x13')](0x1f4,_0x5bc710[_0xfa58('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index f03bd74..384db94 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 _0xedd7=['Router','fs-extra','../../components/auth/service','../../config/environment','./squareProject.controller','get','index','isAuthenticated','show','/:id/users','create','addUsers','put','/:id','update','delete','destroy','removeUsers','exports','util','path','connect-timeout','express'];(function(_0x1e8dca,_0x485ca2){var _0x452fda=function(_0x31ab53){while(--_0x31ab53){_0x1e8dca['push'](_0x1e8dca['shift']());}};_0x452fda(++_0x485ca2);}(_0xedd7,0x6f));var _0x7edd=function(_0x51f309,_0x416ab1){_0x51f309=_0x51f309-0x0;var _0x529ea0=_0xedd7[_0x51f309];return _0x529ea0;};'use strict';var multer=require('multer');var util=require(_0x7edd('0x0'));var path=require(_0x7edd('0x1'));var timeout=require(_0x7edd('0x2'));var express=require(_0x7edd('0x3'));var router=express[_0x7edd('0x4')]();var fs_extra=require(_0x7edd('0x5'));var auth=require(_0x7edd('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7edd('0x7'));var controller=require(_0x7edd('0x8'));router[_0x7edd('0x9')]('/',auth['isAuthenticated'](),controller[_0x7edd('0xa')]);router[_0x7edd('0x9')]('/:id',auth[_0x7edd('0xb')](),controller[_0x7edd('0xc')]);router[_0x7edd('0x9')](_0x7edd('0xd'),auth[_0x7edd('0xb')](),controller['getUsers']);router['post']('/',auth['isAuthenticated'](),controller[_0x7edd('0xe')]);router['post'](_0x7edd('0xd'),auth[_0x7edd('0xb')](),controller[_0x7edd('0xf')]);router[_0x7edd('0x10')](_0x7edd('0x11'),auth[_0x7edd('0xb')](),controller[_0x7edd('0x12')]);router[_0x7edd('0x13')](_0x7edd('0x11'),auth['isAuthenticated'](),controller[_0x7edd('0x14')]);router[_0x7edd('0x13')](_0x7edd('0xd'),auth[_0x7edd('0xb')](),controller[_0x7edd('0x15')]);module[_0x7edd('0x16')]=router; \ No newline at end of file +var _0x1681=['put','/:id','update','destroy','delete','removeUsers','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./squareProject.controller','get','index','isAuthenticated','/:id/users','getUsers','post','create','addUsers'];(function(_0x18baf4,_0x33086b){var _0x278ed1=function(_0x3ea0a2){while(--_0x3ea0a2){_0x18baf4['push'](_0x18baf4['shift']());}};_0x278ed1(++_0x33086b);}(_0x1681,0x12c));var _0x1168=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1681[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1168('0x0'));var timeout=require(_0x1168('0x1'));var express=require(_0x1168('0x2'));var router=express[_0x1168('0x3')]();var fs_extra=require(_0x1168('0x4'));var auth=require(_0x1168('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1168('0x6'));router[_0x1168('0x7')]('/',auth['isAuthenticated'](),controller[_0x1168('0x8')]);router[_0x1168('0x7')]('/:id',auth[_0x1168('0x9')](),controller['show']);router[_0x1168('0x7')](_0x1168('0xa'),auth['isAuthenticated'](),controller[_0x1168('0xb')]);router[_0x1168('0xc')]('/',auth['isAuthenticated'](),controller[_0x1168('0xd')]);router[_0x1168('0xc')]('/:id/users',auth['isAuthenticated'](),controller[_0x1168('0xe')]);router[_0x1168('0xf')](_0x1168('0x10'),auth[_0x1168('0x9')](),controller[_0x1168('0x11')]);router['delete'](_0x1168('0x10'),auth[_0x1168('0x9')](),controller[_0x1168('0x12')]);router[_0x1168('0x13')](_0x1168('0xa'),auth['isAuthenticated'](),controller[_0x1168('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 110fdde..8c1071c 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 _0x605b=['name','TEXT','getDataValue','preproduction','toString','BLOB','long','production','utf8','DATE','sequelize','exports','STRING'];(function(_0x574159,_0x952110){var _0x5dd226=function(_0x5a32f2){while(--_0x5a32f2){_0x574159['push'](_0x574159['shift']());}};_0x5dd226(++_0x952110);}(_0x605b,0xf4));var _0xb605=function(_0x37fc8b,_0x3b6daa){_0x37fc8b=_0x37fc8b-0x0;var _0x18944e=_0x605b[_0x37fc8b];return _0x18944e;};'use strict';var Sequelize=require(_0xb605('0x0'));module[_0xb605('0x1')]={'name':{'type':Sequelize[_0xb605('0x2')],'unique':_0xb605('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0xb605('0x4')]},'preproduction':{'type':Sequelize['BLOB']('long'),'get':function(){if(this[_0xb605('0x5')]('preproduction')){return this[_0xb605('0x5')](_0xb605('0x6'))[_0xb605('0x7')]('utf8');}}},'production':{'type':Sequelize[_0xb605('0x8')](_0xb605('0x9')),'get':function(){if(this[_0xb605('0x5')](_0xb605('0xa'))){return this[_0xb605('0x5')](_0xb605('0xa'))[_0xb605('0x7')](_0xb605('0xb'));}}},'savedAt':{'type':Sequelize[_0xb605('0xc')]},'publishedAt':{'type':Sequelize[_0xb605('0xc')]}}; \ No newline at end of file +var _0x55c3=['TEXT','BLOB','long','getDataValue','preproduction','toString','utf8','production','DATE','exports','STRING','name'];(function(_0x435476,_0x24d3bc){var _0x4f50e7=function(_0x4f392a){while(--_0x4f392a){_0x435476['push'](_0x435476['shift']());}};_0x4f50e7(++_0x24d3bc);}(_0x55c3,0x189));var _0x355c=function(_0x385ab1,_0x43321e){_0x385ab1=_0x385ab1-0x0;var _0x4655fd=_0x55c3[_0x385ab1];return _0x4655fd;};'use strict';var Sequelize=require('sequelize');module[_0x355c('0x0')]={'name':{'type':Sequelize[_0x355c('0x1')],'unique':_0x355c('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x355c('0x1')]},'notes':{'type':Sequelize[_0x355c('0x3')]},'preproduction':{'type':Sequelize[_0x355c('0x4')](_0x355c('0x5')),'get':function(){if(this[_0x355c('0x6')](_0x355c('0x7'))){return this[_0x355c('0x6')](_0x355c('0x7'))[_0x355c('0x8')](_0x355c('0x9'));}}},'production':{'type':Sequelize[_0x355c('0x4')]('long'),'get':function(){if(this['getDataValue'](_0x355c('0xa'))){return this[_0x355c('0x6')](_0x355c('0xa'))[_0x355c('0x8')](_0x355c('0x9'));}}},'savedAt':{'type':Sequelize[_0x355c('0xb')]},'publishedAt':{'type':Sequelize[_0x355c('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 367d50b..a0d40f7 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 _0xdfb8=['addUsers','ids','removeUsers','emit','userSquareProject:remove','getUsers','User','pick','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','sendStatus','status','json','undefined','limit','offset','count','Content-Range','apply','reject','save','update','then','destroy','get','SquareProjects','UserProfileResource','error','stack','name','send','index','SquareProject','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','options','includeAll','include','rows','catch','show','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params'];(function(_0x223461,_0x2bca70){var _0x4dbe0a=function(_0x3c3cb6){while(--_0x3c3cb6){_0x223461['push'](_0x223461['shift']());}};_0x4dbe0a(++_0x2bca70);}(_0xdfb8,0x1e8));var _0x8dfb=function(_0x2f19d1,_0x2867df){_0x2f19d1=_0x2f19d1-0x0;var _0x9fd241=_0xdfb8[_0x2f19d1];return _0x9fd241;};'use strict';var emlformat=require(_0x8dfb('0x0'));var rimraf=require(_0x8dfb('0x1'));var zipdir=require(_0x8dfb('0x2'));var jsonpatch=require(_0x8dfb('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8dfb('0x4'));var util=require(_0x8dfb('0x5'));var path=require(_0x8dfb('0x6'));var sox=require(_0x8dfb('0x7'));var csv=require('to-csv');var ejs=require(_0x8dfb('0x8'));var fs=require('fs');var fs_extra=require(_0x8dfb('0x9'));var _=require(_0x8dfb('0xa'));var squel=require(_0x8dfb('0xb'));var crypto=require(_0x8dfb('0xc'));var jsforce=require(_0x8dfb('0xd'));var deskjs=require(_0x8dfb('0xe'));var toCsv=require(_0x8dfb('0xf'));var querystring=require(_0x8dfb('0x10'));var Papa=require(_0x8dfb('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8dfb('0x12'));var as=require(_0x8dfb('0x13'));var hardwareService=require(_0x8dfb('0x14'));var logger=require(_0x8dfb('0x15'))(_0x8dfb('0x16'));var utils=require(_0x8dfb('0x17'));var config=require(_0x8dfb('0x18'));var licenseUtil=require(_0x8dfb('0x19'));var db=require(_0x8dfb('0x1a'))['db'];config['redis']=_[_0x8dfb('0x1b')](config[_0x8dfb('0x1c')],{'host':_0x8dfb('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8dfb('0x1c')]));require('./squareProject.socket')['register'](socket);function respondWithStatusCode(_0x152d7d,_0x2070a3){_0x2070a3=_0x2070a3||0xcc;return function(_0x395211){if(_0x395211){return _0x152d7d[_0x8dfb('0x1e')](_0x2070a3);}return _0x152d7d[_0x8dfb('0x1f')](_0x2070a3)['end']();};}function respondWithResult(_0x57d04a,_0x3d6b97){_0x3d6b97=_0x3d6b97||0xc8;return function(_0x1ff57b){if(_0x1ff57b){return _0x57d04a[_0x8dfb('0x1f')](_0x3d6b97)[_0x8dfb('0x20')](_0x1ff57b);}};}function respondWithFilteredResult(_0x49da2a,_0x280e45){return function(_0x473c73){if(_0x473c73){var _0xfa9415=typeof _0x280e45['offset']===_0x8dfb('0x21')&&typeof _0x280e45[_0x8dfb('0x22')]===_0x8dfb('0x21');var _0x1682d2=_0x473c73['count'];var _0x19a962=_0xfa9415?0x0:_0x280e45[_0x8dfb('0x23')];var _0x55ee1d=_0xfa9415?_0x473c73[_0x8dfb('0x24')]:_0x280e45['offset']+_0x280e45[_0x8dfb('0x22')];var _0x2c745e;if(_0x55ee1d>=_0x1682d2){_0x55ee1d=_0x1682d2;_0x2c745e=0xc8;}else{_0x2c745e=0xce;}_0x49da2a[_0x8dfb('0x1f')](_0x2c745e);return _0x49da2a['set'](_0x8dfb('0x25'),_0x19a962+'-'+_0x55ee1d+'/'+_0x1682d2)[_0x8dfb('0x20')](_0x473c73);}return null;};}function patchUpdates(_0x3fb5e0){return function(_0xf0a98f){try{jsonpatch[_0x8dfb('0x26')](_0xf0a98f,_0x3fb5e0,!![]);}catch(_0x4a1cf2){return BPromise[_0x8dfb('0x27')](_0x4a1cf2);}return _0xf0a98f[_0x8dfb('0x28')]();};}function saveUpdates(_0x559890,_0x1a4ac5){return function(_0x32a138){if(_0x32a138){return _0x32a138[_0x8dfb('0x29')](_0x559890)[_0x8dfb('0x2a')](function(_0x10cf44){return _0x10cf44;});}return null;};}function removeEntity(_0x510743,_0x3503f7){return function(_0x20837f){if(_0x20837f){return _0x20837f[_0x8dfb('0x2b')]()['then'](function(){var _0x28ee22=_0x20837f[_0x8dfb('0x2c')]({'plain':!![]});var _0x1e49cc=_0x8dfb('0x2d');return db[_0x8dfb('0x2e')][_0x8dfb('0x2b')]({'where':{'type':_0x1e49cc,'resourceId':_0x28ee22['id']}})['then'](function(){return _0x20837f;});})['then'](function(){_0x510743[_0x8dfb('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x263ae9,_0x243533){return function(_0x40b769){if(!_0x40b769){_0x263ae9[_0x8dfb('0x1e')](0x194);}return _0x40b769;};}function handleError(_0x32acc6,_0x4f82cd){_0x4f82cd=_0x4f82cd||0x1f4;return function(_0x1e79b2){logger[_0x8dfb('0x2f')](_0x1e79b2[_0x8dfb('0x30')]);if(_0x1e79b2[_0x8dfb('0x31')]){delete _0x1e79b2[_0x8dfb('0x31')];}_0x32acc6['status'](_0x4f82cd)[_0x8dfb('0x32')](_0x1e79b2);};}exports[_0x8dfb('0x33')]=function(_0x5cd43e,_0x3af9cb){var _0x28cb4f={},_0x58f70e={},_0x147bf2={'count':0x0,'rows':[]};var _0x593b6c=_['map'](db[_0x8dfb('0x34')][_0x8dfb('0x35')],function(_0x2c2b4e){return{'name':_0x2c2b4e[_0x8dfb('0x36')],'type':_0x2c2b4e[_0x8dfb('0x37')][_0x8dfb('0x38')]};});_0x58f70e[_0x8dfb('0x39')]=_[_0x8dfb('0x3a')](_0x593b6c,_0x8dfb('0x31'));_0x58f70e[_0x8dfb('0x3b')]=_[_0x8dfb('0x3c')](_0x5cd43e[_0x8dfb('0x3b')]);_0x58f70e[_0x8dfb('0x3d')]=_[_0x8dfb('0x3e')](_0x58f70e[_0x8dfb('0x39')],_0x58f70e[_0x8dfb('0x3b')]);_0x28cb4f[_0x8dfb('0x3f')]=_[_0x8dfb('0x3e')](_0x58f70e['model'],qs['fields'](_0x5cd43e[_0x8dfb('0x3b')][_0x8dfb('0x40')]));_0x28cb4f[_0x8dfb('0x3f')]=_0x28cb4f['attributes'][_0x8dfb('0x41')]?_0x28cb4f['attributes']:_0x58f70e[_0x8dfb('0x39')];if(!_0x5cd43e[_0x8dfb('0x3b')]['hasOwnProperty'](_0x8dfb('0x42'))){_0x28cb4f['limit']=qs[_0x8dfb('0x22')](_0x5cd43e['query']['limit']);_0x28cb4f[_0x8dfb('0x23')]=qs[_0x8dfb('0x23')](_0x5cd43e[_0x8dfb('0x3b')]['offset']);}_0x28cb4f[_0x8dfb('0x43')]=qs['sort'](_0x5cd43e[_0x8dfb('0x3b')][_0x8dfb('0x44')]);_0x28cb4f[_0x8dfb('0x45')]=qs[_0x8dfb('0x3d')](_['pick'](_0x5cd43e['query'],_0x58f70e[_0x8dfb('0x3d')]),_0x593b6c);if(_0x5cd43e[_0x8dfb('0x3b')][_0x8dfb('0x46')]){_0x28cb4f[_0x8dfb('0x45')]=_[_0x8dfb('0x47')](_0x28cb4f[_0x8dfb('0x45')],{'$or':_['map'](_0x593b6c,function(_0x4acf14){if(_0x4acf14[_0x8dfb('0x37')]!=='VIRTUAL'){var _0x41c48c={};_0x41c48c[_0x4acf14[_0x8dfb('0x31')]]={'$like':'%'+_0x5cd43e[_0x8dfb('0x3b')]['filter']+'%'};return _0x41c48c;}})});}_0x28cb4f=_[_0x8dfb('0x47')]({},_0x28cb4f,_0x5cd43e[_0x8dfb('0x48')]);var _0x3c773b={'where':_0x28cb4f[_0x8dfb('0x45')]};return db[_0x8dfb('0x34')]['count'](_0x3c773b)[_0x8dfb('0x2a')](function(_0x4076ba){_0x147bf2['count']=_0x4076ba;if(_0x5cd43e[_0x8dfb('0x3b')][_0x8dfb('0x49')]){_0x28cb4f[_0x8dfb('0x4a')]=[{'all':!![]}];}return db[_0x8dfb('0x34')]['findAll'](_0x28cb4f);})[_0x8dfb('0x2a')](function(_0x1aa5da){_0x147bf2[_0x8dfb('0x4b')]=_0x1aa5da;return _0x147bf2;})[_0x8dfb('0x2a')](respondWithFilteredResult(_0x3af9cb,_0x28cb4f))[_0x8dfb('0x4c')](handleError(_0x3af9cb,null));};exports[_0x8dfb('0x4d')]=function(_0x2e2875,_0x3c7515){var _0x1941e8={'raw':![],'where':{'id':_0x2e2875['params']['id']}},_0x4d790a={};_0x4d790a['model']=_[_0x8dfb('0x3c')](db[_0x8dfb('0x34')][_0x8dfb('0x35')]);_0x4d790a[_0x8dfb('0x3b')]=_[_0x8dfb('0x3c')](_0x2e2875[_0x8dfb('0x3b')]);_0x4d790a['filters']=_[_0x8dfb('0x3e')](_0x4d790a[_0x8dfb('0x39')],_0x4d790a['query']);_0x1941e8[_0x8dfb('0x3f')]=_[_0x8dfb('0x3e')](_0x4d790a[_0x8dfb('0x39')],qs['fields'](_0x2e2875['query'][_0x8dfb('0x40')]));_0x1941e8[_0x8dfb('0x3f')]=_0x1941e8['attributes'][_0x8dfb('0x41')]?_0x1941e8[_0x8dfb('0x3f')]:_0x4d790a[_0x8dfb('0x39')];if(_0x2e2875[_0x8dfb('0x3b')][_0x8dfb('0x49')]){_0x1941e8[_0x8dfb('0x4a')]=[{'all':!![]}];}_0x1941e8=_['merge']({},_0x1941e8,_0x2e2875['options']);return db[_0x8dfb('0x34')][_0x8dfb('0x4e')](_0x1941e8)[_0x8dfb('0x2a')](handleEntityNotFound(_0x3c7515,null))['then'](respondWithResult(_0x3c7515,null))[_0x8dfb('0x4c')](handleError(_0x3c7515,null));};exports[_0x8dfb('0x4f')]=function(_0x433418,_0x5b0852){return db['SquareProject']['create'](_0x433418['body'],{})[_0x8dfb('0x2a')](function(_0x4e48f2){var _0xd31f9c=_0x433418[_0x8dfb('0x50')]['get']({'plain':!![]});if(!_0xd31f9c)throw new Error(_0x8dfb('0x51'));if(_0xd31f9c[_0x8dfb('0x52')]===_0x8dfb('0x50')){var _0x2473ac=_0x4e48f2[_0x8dfb('0x2c')]({'plain':!![]});var _0x1b95c8=_0x8dfb('0x2d');return db[_0x8dfb('0x53')][_0x8dfb('0x4e')]({'where':{'name':_0x1b95c8,'userProfileId':_0xd31f9c['userProfileId']},'raw':!![]})[_0x8dfb('0x2a')](function(_0x2b9844){if(_0x2b9844&&_0x2b9844[_0x8dfb('0x54')]===0x0){return db[_0x8dfb('0x2e')][_0x8dfb('0x4f')]({'name':_0x2473ac[_0x8dfb('0x31')],'resourceId':_0x2473ac['id'],'type':_0x2b9844[_0x8dfb('0x31')],'sectionId':_0x2b9844['id']},{})[_0x8dfb('0x2a')](function(){return _0x4e48f2;});}else{return _0x4e48f2;}})[_0x8dfb('0x4c')](function(_0x51033f){logger[_0x8dfb('0x2f')](_0x8dfb('0x55'),_0x51033f);throw _0x51033f;});}return _0x4e48f2;})[_0x8dfb('0x2a')](respondWithResult(_0x5b0852,0xc9))[_0x8dfb('0x4c')](handleError(_0x5b0852,null));};exports[_0x8dfb('0x29')]=function(_0x3fa588,_0x552f81){if(_0x3fa588['body']['id']){delete _0x3fa588[_0x8dfb('0x56')]['id'];}return db[_0x8dfb('0x34')][_0x8dfb('0x4e')]({'where':{'id':_0x3fa588[_0x8dfb('0x57')]['id']}})['then'](handleEntityNotFound(_0x552f81,null))[_0x8dfb('0x2a')](saveUpdates(_0x3fa588['body'],null))['then'](respondWithResult(_0x552f81,null))[_0x8dfb('0x4c')](handleError(_0x552f81,null));};exports[_0x8dfb('0x2b')]=function(_0x4fc492,_0x2fca11){return db['SquareProject'][_0x8dfb('0x4e')]({'where':{'id':_0x4fc492[_0x8dfb('0x57')]['id']}})['then'](handleEntityNotFound(_0x2fca11,null))['then'](removeEntity(_0x2fca11,null))[_0x8dfb('0x4c')](handleError(_0x2fca11,null));};exports[_0x8dfb('0x58')]=function(_0x343cd6,_0x23f656,_0x5a06c6){return db[_0x8dfb('0x34')]['find']({'where':{'id':_0x343cd6[_0x8dfb('0x57')]['id']}})[_0x8dfb('0x2a')](handleEntityNotFound(_0x23f656,null))[_0x8dfb('0x2a')](function(_0x5af347){if(_0x5af347){return _0x5af347[_0x8dfb('0x58')](_0x343cd6[_0x8dfb('0x56')][_0x8dfb('0x59')],_['omit'](_0x343cd6['body'],['ids','id'])||{});}})[_0x8dfb('0x2a')](respondWithResult(_0x23f656,null))['catch'](handleError(_0x23f656,null));};exports['removeUsers']=function(_0x3b750b,_0x489dfc,_0x3aff32){return db[_0x8dfb('0x34')][_0x8dfb('0x4e')]({'where':{'id':_0x3b750b[_0x8dfb('0x57')]['id']}})['then'](handleEntityNotFound(_0x489dfc,null))[_0x8dfb('0x2a')](function(_0x26baee){if(_0x26baee){return _0x26baee[_0x8dfb('0x5a')](_0x3b750b[_0x8dfb('0x3b')][_0x8dfb('0x59')])[_0x8dfb('0x2a')](function(){if(_['isArray'](_0x3b750b[_0x8dfb('0x3b')][_0x8dfb('0x59')])){for(var _0x444345=0x0;_0x444345<_0x3b750b[_0x8dfb('0x3b')][_0x8dfb('0x59')][_0x8dfb('0x41')];_0x444345+=0x1){socket[_0x8dfb('0x5b')](_0x8dfb('0x5c'),{'UserId':Number(_0x3b750b['query'][_0x8dfb('0x59')][_0x444345]),'SquareProjectId':Number(_0x3b750b['params']['id'])});}}else{socket['emit'](_0x8dfb('0x5c'),{'UserId':Number(_0x3b750b['query'][_0x8dfb('0x59')]),'SquareProjectId':Number(_0x3b750b[_0x8dfb('0x57')]['id'])});}});}})[_0x8dfb('0x2a')](respondWithStatusCode(_0x489dfc,null))[_0x8dfb('0x4c')](handleError(_0x489dfc,null));};exports[_0x8dfb('0x5d')]=function(_0x2f6158,_0xec89e4,_0x1c2ad6){var _0x56f32a={};var _0x127486={};var _0x118d98;var _0x43b7d8;return db[_0x8dfb('0x34')]['findOne']({'where':{'id':_0x2f6158[_0x8dfb('0x57')]['id']}})['then'](handleEntityNotFound(_0xec89e4,null))[_0x8dfb('0x2a')](function(_0x4758a6){if(_0x4758a6){_0x118d98=_0x4758a6;_0x127486['model']=_[_0x8dfb('0x3c')](db[_0x8dfb('0x5e')][_0x8dfb('0x35')]);_0x127486[_0x8dfb('0x3b')]=_[_0x8dfb('0x3c')](_0x2f6158[_0x8dfb('0x3b')]);_0x127486['filters']=_['intersection'](_0x127486['model'],_0x127486[_0x8dfb('0x3b')]);_0x56f32a['attributes']=_['intersection'](_0x127486[_0x8dfb('0x39')],qs['fields'](_0x2f6158[_0x8dfb('0x3b')][_0x8dfb('0x40')]));_0x56f32a[_0x8dfb('0x3f')]=_0x56f32a[_0x8dfb('0x3f')][_0x8dfb('0x41')]?_0x56f32a[_0x8dfb('0x3f')]:_0x127486[_0x8dfb('0x39')];_0x56f32a['order']=qs[_0x8dfb('0x44')](_0x2f6158[_0x8dfb('0x3b')][_0x8dfb('0x44')]);_0x56f32a['where']=qs[_0x8dfb('0x3d')](_[_0x8dfb('0x5f')](_0x2f6158[_0x8dfb('0x3b')],_0x127486[_0x8dfb('0x3d')]));if(_0x2f6158[_0x8dfb('0x3b')][_0x8dfb('0x46')]){_0x56f32a['where']=_[_0x8dfb('0x47')](_0x56f32a[_0x8dfb('0x45')],{'$or':_['map'](_0x56f32a['attributes'],function(_0x2c30cf){var _0x1e6382={};_0x1e6382[_0x2c30cf]={'$like':'%'+_0x2f6158['query']['filter']+'%'};return _0x1e6382;})});}_0x56f32a=_[_0x8dfb('0x47')]({},_0x56f32a,_0x2f6158['options']);return _0x118d98[_0x8dfb('0x5d')](_0x56f32a);}})[_0x8dfb('0x2a')](function(_0x2fa85f){if(_0x2fa85f){_0x43b7d8=_0x2fa85f[_0x8dfb('0x41')];if(!_0x2f6158[_0x8dfb('0x3b')]['hasOwnProperty'](_0x8dfb('0x42'))){_0x56f32a[_0x8dfb('0x22')]=qs['limit'](_0x2f6158[_0x8dfb('0x3b')][_0x8dfb('0x22')]);_0x56f32a[_0x8dfb('0x23')]=qs[_0x8dfb('0x23')](_0x2f6158[_0x8dfb('0x3b')]['offset']);}return _0x118d98[_0x8dfb('0x5d')](_0x56f32a);}})['then'](function(_0x1d881f){if(_0x1d881f){return _0x1d881f?{'count':_0x43b7d8,'rows':_0x1d881f}:null;}})[_0x8dfb('0x2a')](respondWithResult(_0xec89e4,null))[_0x8dfb('0x4c')](handleError(_0xec89e4,null));}; \ No newline at end of file +var _0x0ca9=['../../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','json','offset','undefined','count','limit','set','save','update','destroy','then','SquareProjects','UserProfileResource','end','error','stack','name','index','map','SquareProject','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','merge','where','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','filter','nolimit','zip-dir','moment','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service'];(function(_0x5eac8a,_0x1a4595){var _0x5c85aa=function(_0xbd1b50){while(--_0xbd1b50){_0x5eac8a['push'](_0x5eac8a['shift']());}};_0x5c85aa(++_0x1a4595);}(_0x0ca9,0x15f));var _0x90ca=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0ca9[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x90ca('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x90ca('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x90ca('0x2'));var sox=require(_0x90ca('0x3'));var csv=require('to-csv');var ejs=require(_0x90ca('0x4'));var fs=require('fs');var fs_extra=require(_0x90ca('0x5'));var _=require(_0x90ca('0x6'));var squel=require('squel');var crypto=require(_0x90ca('0x7'));var jsforce=require('jsforce');var deskjs=require(_0x90ca('0x8'));var toCsv=require(_0x90ca('0x9'));var querystring=require(_0x90ca('0xa'));var Papa=require('papaparse');var Redis=require(_0x90ca('0xb'));var authService=require(_0x90ca('0xc'));var qs=require(_0x90ca('0xd'));var as=require(_0x90ca('0xe'));var hardwareService=require(_0x90ca('0xf'));var logger=require(_0x90ca('0x10'))(_0x90ca('0x11'));var utils=require(_0x90ca('0x12'));var config=require(_0x90ca('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x90ca('0x14')]=_[_0x90ca('0x15')](config[_0x90ca('0x14')],{'host':_0x90ca('0x16'),'port':0x18eb});var socket=require(_0x90ca('0x17'))(new Redis(config['redis']));require('./squareProject.socket')[_0x90ca('0x18')](socket);function respondWithStatusCode(_0x4118c2,_0x50a614){_0x50a614=_0x50a614||0xcc;return function(_0x5da2cd){if(_0x5da2cd){return _0x4118c2[_0x90ca('0x19')](_0x50a614);}return _0x4118c2['status'](_0x50a614)['end']();};}function respondWithResult(_0x4bfef7,_0x5cf8d8){_0x5cf8d8=_0x5cf8d8||0xc8;return function(_0x2744e3){if(_0x2744e3){return _0x4bfef7[_0x90ca('0x1a')](_0x5cf8d8)[_0x90ca('0x1b')](_0x2744e3);}};}function respondWithFilteredResult(_0x689c57,_0x11bd9b){return function(_0x31a6b9){if(_0x31a6b9){var _0x1c769b=typeof _0x11bd9b[_0x90ca('0x1c')]===_0x90ca('0x1d')&&typeof _0x11bd9b['limit']===_0x90ca('0x1d');var _0xb06cc=_0x31a6b9['count'];var _0x30d3ca=_0x1c769b?0x0:_0x11bd9b[_0x90ca('0x1c')];var _0x4342c4=_0x1c769b?_0x31a6b9[_0x90ca('0x1e')]:_0x11bd9b[_0x90ca('0x1c')]+_0x11bd9b[_0x90ca('0x1f')];var _0x412a1f;if(_0x4342c4>=_0xb06cc){_0x4342c4=_0xb06cc;_0x412a1f=0xc8;}else{_0x412a1f=0xce;}_0x689c57[_0x90ca('0x1a')](_0x412a1f);return _0x689c57[_0x90ca('0x20')]('Content-Range',_0x30d3ca+'-'+_0x4342c4+'/'+_0xb06cc)[_0x90ca('0x1b')](_0x31a6b9);}return null;};}function patchUpdates(_0x2249b4){return function(_0x303dfb){try{jsonpatch['apply'](_0x303dfb,_0x2249b4,!![]);}catch(_0x5db1c6){return BPromise['reject'](_0x5db1c6);}return _0x303dfb[_0x90ca('0x21')]();};}function saveUpdates(_0x5a7556,_0x1e1483){return function(_0x5fe9cf){if(_0x5fe9cf){return _0x5fe9cf[_0x90ca('0x22')](_0x5a7556)['then'](function(_0x37758b){return _0x37758b;});}return null;};}function removeEntity(_0x5375aa,_0x712417){return function(_0x21c6e){if(_0x21c6e){return _0x21c6e[_0x90ca('0x23')]()[_0x90ca('0x24')](function(){var _0x437264=_0x21c6e['get']({'plain':!![]});var _0x2b4a1b=_0x90ca('0x25');return db[_0x90ca('0x26')]['destroy']({'where':{'type':_0x2b4a1b,'resourceId':_0x437264['id']}})[_0x90ca('0x24')](function(){return _0x21c6e;});})[_0x90ca('0x24')](function(){_0x5375aa[_0x90ca('0x1a')](0xcc)[_0x90ca('0x27')]();});}};}function handleEntityNotFound(_0x10b1e7,_0x24df57){return function(_0x4492d2){if(!_0x4492d2){_0x10b1e7[_0x90ca('0x19')](0x194);}return _0x4492d2;};}function handleError(_0x215404,_0x263d03){_0x263d03=_0x263d03||0x1f4;return function(_0x48c368){logger[_0x90ca('0x28')](_0x48c368[_0x90ca('0x29')]);if(_0x48c368[_0x90ca('0x2a')]){delete _0x48c368[_0x90ca('0x2a')];}_0x215404[_0x90ca('0x1a')](_0x263d03)['send'](_0x48c368);};}exports[_0x90ca('0x2b')]=function(_0x29962e,_0x58d472){var _0x581a66={},_0x5f577d={},_0x4de075={'count':0x0,'rows':[]};var _0x56a879=_[_0x90ca('0x2c')](db[_0x90ca('0x2d')][_0x90ca('0x2e')],function(_0x5186a6){return{'name':_0x5186a6[_0x90ca('0x2f')],'type':_0x5186a6[_0x90ca('0x30')][_0x90ca('0x31')]};});_0x5f577d[_0x90ca('0x32')]=_[_0x90ca('0x2c')](_0x56a879,'name');_0x5f577d[_0x90ca('0x33')]=_[_0x90ca('0x34')](_0x29962e[_0x90ca('0x33')]);_0x5f577d['filters']=_[_0x90ca('0x35')](_0x5f577d[_0x90ca('0x32')],_0x5f577d[_0x90ca('0x33')]);_0x581a66[_0x90ca('0x36')]=_[_0x90ca('0x35')](_0x5f577d[_0x90ca('0x32')],qs[_0x90ca('0x37')](_0x29962e[_0x90ca('0x33')][_0x90ca('0x37')]));_0x581a66[_0x90ca('0x36')]=_0x581a66[_0x90ca('0x36')][_0x90ca('0x38')]?_0x581a66[_0x90ca('0x36')]:_0x5f577d[_0x90ca('0x32')];if(!_0x29962e[_0x90ca('0x33')][_0x90ca('0x39')]('nolimit')){_0x581a66['limit']=qs['limit'](_0x29962e[_0x90ca('0x33')]['limit']);_0x581a66[_0x90ca('0x1c')]=qs[_0x90ca('0x1c')](_0x29962e[_0x90ca('0x33')][_0x90ca('0x1c')]);}_0x581a66[_0x90ca('0x3a')]=qs[_0x90ca('0x3b')](_0x29962e[_0x90ca('0x33')]['sort']);_0x581a66['where']=qs[_0x90ca('0x3c')](_[_0x90ca('0x3d')](_0x29962e[_0x90ca('0x33')],_0x5f577d['filters']),_0x56a879);if(_0x29962e[_0x90ca('0x33')]['filter']){_0x581a66['where']=_[_0x90ca('0x3e')](_0x581a66[_0x90ca('0x3f')],{'$or':_[_0x90ca('0x2c')](_0x56a879,function(_0x534868){if(_0x534868[_0x90ca('0x30')]!==_0x90ca('0x40')){var _0x178037={};_0x178037[_0x534868[_0x90ca('0x2a')]]={'$like':'%'+_0x29962e[_0x90ca('0x33')]['filter']+'%'};return _0x178037;}})});}_0x581a66=_[_0x90ca('0x3e')]({},_0x581a66,_0x29962e['options']);var _0x2a0ab4={'where':_0x581a66['where']};return db[_0x90ca('0x2d')][_0x90ca('0x1e')](_0x2a0ab4)['then'](function(_0x16a5e3){_0x4de075[_0x90ca('0x1e')]=_0x16a5e3;if(_0x29962e[_0x90ca('0x33')][_0x90ca('0x41')]){_0x581a66['include']=[{'all':!![]}];}return db[_0x90ca('0x2d')][_0x90ca('0x42')](_0x581a66);})['then'](function(_0x201827){_0x4de075[_0x90ca('0x43')]=_0x201827;return _0x4de075;})['then'](respondWithFilteredResult(_0x58d472,_0x581a66))[_0x90ca('0x44')](handleError(_0x58d472,null));};exports[_0x90ca('0x45')]=function(_0x2750e9,_0x74ef4f){var _0x5aba44={'raw':![],'where':{'id':_0x2750e9[_0x90ca('0x46')]['id']}},_0xfcb1dd={};_0xfcb1dd[_0x90ca('0x32')]=_[_0x90ca('0x34')](db[_0x90ca('0x2d')]['rawAttributes']);_0xfcb1dd[_0x90ca('0x33')]=_['keys'](_0x2750e9['query']);_0xfcb1dd['filters']=_[_0x90ca('0x35')](_0xfcb1dd['model'],_0xfcb1dd[_0x90ca('0x33')]);_0x5aba44[_0x90ca('0x36')]=_[_0x90ca('0x35')](_0xfcb1dd['model'],qs[_0x90ca('0x37')](_0x2750e9[_0x90ca('0x33')][_0x90ca('0x37')]));_0x5aba44[_0x90ca('0x36')]=_0x5aba44[_0x90ca('0x36')]['length']?_0x5aba44['attributes']:_0xfcb1dd[_0x90ca('0x32')];if(_0x2750e9[_0x90ca('0x33')][_0x90ca('0x41')]){_0x5aba44[_0x90ca('0x47')]=[{'all':!![]}];}_0x5aba44=_[_0x90ca('0x3e')]({},_0x5aba44,_0x2750e9['options']);return db['SquareProject'][_0x90ca('0x48')](_0x5aba44)['then'](handleEntityNotFound(_0x74ef4f,null))[_0x90ca('0x24')](respondWithResult(_0x74ef4f,null))[_0x90ca('0x44')](handleError(_0x74ef4f,null));};exports['create']=function(_0x24ce85,_0x552ee3){return db['SquareProject'][_0x90ca('0x49')](_0x24ce85[_0x90ca('0x4a')],{})['then'](function(_0x58ecda){var _0x674575=_0x24ce85[_0x90ca('0x4b')][_0x90ca('0x4c')]({'plain':!![]});if(!_0x674575)throw new Error(_0x90ca('0x4d'));if(_0x674575['role']==='user'){var _0x207bea=_0x58ecda[_0x90ca('0x4c')]({'plain':!![]});var _0x3de122=_0x90ca('0x25');return db['UserProfileSection']['find']({'where':{'name':_0x3de122,'userProfileId':_0x674575['userProfileId']},'raw':!![]})['then'](function(_0x18110b){if(_0x18110b&&_0x18110b[_0x90ca('0x4e')]===0x0){return db[_0x90ca('0x26')][_0x90ca('0x49')]({'name':_0x207bea[_0x90ca('0x2a')],'resourceId':_0x207bea['id'],'type':_0x18110b['name'],'sectionId':_0x18110b['id']},{})[_0x90ca('0x24')](function(){return _0x58ecda;});}else{return _0x58ecda;}})[_0x90ca('0x44')](function(_0x4b1516){logger[_0x90ca('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4b1516);throw _0x4b1516;});}return _0x58ecda;})[_0x90ca('0x24')](respondWithResult(_0x552ee3,0xc9))['catch'](handleError(_0x552ee3,null));};exports[_0x90ca('0x22')]=function(_0x58a678,_0x3dfe63){if(_0x58a678[_0x90ca('0x4a')]['id']){delete _0x58a678[_0x90ca('0x4a')]['id'];}return db[_0x90ca('0x2d')]['find']({'where':{'id':_0x58a678[_0x90ca('0x46')]['id']}})['then'](handleEntityNotFound(_0x3dfe63,null))[_0x90ca('0x24')](saveUpdates(_0x58a678[_0x90ca('0x4a')],null))[_0x90ca('0x24')](respondWithResult(_0x3dfe63,null))['catch'](handleError(_0x3dfe63,null));};exports[_0x90ca('0x23')]=function(_0x314fb6,_0x55fbf6){return db['SquareProject']['find']({'where':{'id':_0x314fb6[_0x90ca('0x46')]['id']}})[_0x90ca('0x24')](handleEntityNotFound(_0x55fbf6,null))[_0x90ca('0x24')](removeEntity(_0x55fbf6,null))[_0x90ca('0x44')](handleError(_0x55fbf6,null));};exports[_0x90ca('0x4f')]=function(_0x2c7d02,_0xcd809d,_0x2e8874){return db['SquareProject'][_0x90ca('0x48')]({'where':{'id':_0x2c7d02['params']['id']}})[_0x90ca('0x24')](handleEntityNotFound(_0xcd809d,null))[_0x90ca('0x24')](function(_0x2950dc){if(_0x2950dc){return _0x2950dc[_0x90ca('0x4f')](_0x2c7d02[_0x90ca('0x4a')][_0x90ca('0x50')],_[_0x90ca('0x51')](_0x2c7d02[_0x90ca('0x4a')],[_0x90ca('0x50'),'id'])||{});}})[_0x90ca('0x24')](respondWithResult(_0xcd809d,null))[_0x90ca('0x44')](handleError(_0xcd809d,null));};exports['removeUsers']=function(_0x4ba28a,_0x5c8b93,_0xd246f6){return db['SquareProject']['find']({'where':{'id':_0x4ba28a[_0x90ca('0x46')]['id']}})[_0x90ca('0x24')](handleEntityNotFound(_0x5c8b93,null))[_0x90ca('0x24')](function(_0x4cc844){if(_0x4cc844){return _0x4cc844[_0x90ca('0x52')](_0x4ba28a['query'][_0x90ca('0x50')])[_0x90ca('0x24')](function(){if(_[_0x90ca('0x53')](_0x4ba28a[_0x90ca('0x33')][_0x90ca('0x50')])){for(var _0x52bace=0x0;_0x52bace<_0x4ba28a[_0x90ca('0x33')][_0x90ca('0x50')]['length'];_0x52bace+=0x1){socket[_0x90ca('0x54')](_0x90ca('0x55'),{'UserId':Number(_0x4ba28a[_0x90ca('0x33')][_0x90ca('0x50')][_0x52bace]),'SquareProjectId':Number(_0x4ba28a[_0x90ca('0x46')]['id'])});}}else{socket[_0x90ca('0x54')](_0x90ca('0x55'),{'UserId':Number(_0x4ba28a['query'][_0x90ca('0x50')]),'SquareProjectId':Number(_0x4ba28a[_0x90ca('0x46')]['id'])});}});}})[_0x90ca('0x24')](respondWithStatusCode(_0x5c8b93,null))['catch'](handleError(_0x5c8b93,null));};exports[_0x90ca('0x56')]=function(_0x4223b0,_0x1ada05,_0x39720f){var _0x56761a={};var _0x10f883={};var _0x394146;var _0xa7dc6b;return db[_0x90ca('0x2d')][_0x90ca('0x57')]({'where':{'id':_0x4223b0[_0x90ca('0x46')]['id']}})[_0x90ca('0x24')](handleEntityNotFound(_0x1ada05,null))[_0x90ca('0x24')](function(_0x3cabca){if(_0x3cabca){_0x394146=_0x3cabca;_0x10f883[_0x90ca('0x32')]=_['keys'](db[_0x90ca('0x58')][_0x90ca('0x2e')]);_0x10f883[_0x90ca('0x33')]=_[_0x90ca('0x34')](_0x4223b0[_0x90ca('0x33')]);_0x10f883['filters']=_[_0x90ca('0x35')](_0x10f883[_0x90ca('0x32')],_0x10f883['query']);_0x56761a[_0x90ca('0x36')]=_[_0x90ca('0x35')](_0x10f883['model'],qs[_0x90ca('0x37')](_0x4223b0['query'][_0x90ca('0x37')]));_0x56761a['attributes']=_0x56761a[_0x90ca('0x36')][_0x90ca('0x38')]?_0x56761a['attributes']:_0x10f883[_0x90ca('0x32')];_0x56761a[_0x90ca('0x3a')]=qs[_0x90ca('0x3b')](_0x4223b0['query'][_0x90ca('0x3b')]);_0x56761a[_0x90ca('0x3f')]=qs[_0x90ca('0x3c')](_['pick'](_0x4223b0['query'],_0x10f883[_0x90ca('0x3c')]));if(_0x4223b0[_0x90ca('0x33')][_0x90ca('0x59')]){_0x56761a['where']=_['merge'](_0x56761a[_0x90ca('0x3f')],{'$or':_[_0x90ca('0x2c')](_0x56761a[_0x90ca('0x36')],function(_0xccb499){var _0x17217e={};_0x17217e[_0xccb499]={'$like':'%'+_0x4223b0[_0x90ca('0x33')][_0x90ca('0x59')]+'%'};return _0x17217e;})});}_0x56761a=_['merge']({},_0x56761a,_0x4223b0['options']);return _0x394146['getUsers'](_0x56761a);}})[_0x90ca('0x24')](function(_0x3433d0){if(_0x3433d0){_0xa7dc6b=_0x3433d0[_0x90ca('0x38')];if(!_0x4223b0['query'][_0x90ca('0x39')](_0x90ca('0x5a'))){_0x56761a[_0x90ca('0x1f')]=qs[_0x90ca('0x1f')](_0x4223b0[_0x90ca('0x33')][_0x90ca('0x1f')]);_0x56761a[_0x90ca('0x1c')]=qs[_0x90ca('0x1c')](_0x4223b0[_0x90ca('0x33')][_0x90ca('0x1c')]);}return _0x394146[_0x90ca('0x56')](_0x56761a);}})[_0x90ca('0x24')](function(_0x3576b0){if(_0x3576b0){return _0x3576b0?{'count':_0xa7dc6b,'rows':_0x3576b0}:null;}})[_0x90ca('0x24')](respondWithResult(_0x1ada05,null))[_0x90ca('0x44')](handleError(_0x1ada05,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 0136c6b..390ee73 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 _0xc7aa=['emit','exports','../../mysqldb','save','remove'];(function(_0x471969,_0x1bef30){var _0x5ac740=function(_0x5da6ac){while(--_0x5da6ac){_0x471969['push'](_0x471969['shift']());}};_0x5ac740(++_0x1bef30);}(_0xc7aa,0x124));var _0xac7a=function(_0x3f30d9,_0x2882b0){_0x3f30d9=_0x3f30d9-0x0;var _0x38692f=_0xc7aa[_0x3f30d9];return _0x38692f;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0xac7a('0x0'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xac7a('0x1'),'afterUpdate':'update','afterDestroy':_0xac7a('0x2')};function emitEvent(_0x40e48c){return function(_0x26ad11,_0x4f7772,_0x259af1){SquareProjectEvents[_0xac7a('0x3')](_0x40e48c+':'+_0x26ad11['id'],_0x26ad11);SquareProjectEvents[_0xac7a('0x3')](_0x40e48c,_0x26ad11);_0x259af1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0xac7a('0x4')]=SquareProjectEvents; \ No newline at end of file +var _0x116b=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','SquareProject','setMaxListeners','save'];(function(_0x1e9934,_0x1fc65b){var _0x1aec3f=function(_0x2fc866){while(--_0x2fc866){_0x1e9934['push'](_0x1e9934['shift']());}};_0x1aec3f(++_0x1fc65b);}(_0x116b,0x14f));var _0xb116=function(_0x3d5de4,_0x3c336c){_0x3d5de4=_0x3d5de4-0x0;var _0x5e1988=_0x116b[_0x3d5de4];return _0x5e1988;};'use strict';var EventEmitter=require(_0xb116('0x0'));var SquareProject=require(_0xb116('0x1'))['db'][_0xb116('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xb116('0x3')](0x0);var events={'afterCreate':_0xb116('0x4'),'afterUpdate':_0xb116('0x5'),'afterDestroy':_0xb116('0x6')};function emitEvent(_0x51443f){return function(_0x2999d7,_0x1068ec,_0x1d6d78){SquareProjectEvents['emit'](_0x51443f+':'+_0x2999d7['id'],_0x2999d7);SquareProjectEvents[_0xb116('0x7')](_0x51443f,_0x2999d7);_0x1d6d78(null);};}for(var e in events){if(events[_0xb116('0x8')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0xb116('0x9')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 18e77bc..cd07f3e 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 _0xd52b=['moment','bluebird','path','../../config/environment','./squareProject.attributes','exports','define','changed','preproduction','savedAt','production','publishedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api'];(function(_0x512629,_0x33a60b){var _0x2fea99=function(_0x16e929){while(--_0x16e929){_0x512629['push'](_0x512629['shift']());}};_0x2fea99(++_0x33a60b);}(_0xd52b,0x1ea));var _0xbd52=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xd52b[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0xbd52('0x0'));var logger=require(_0xbd52('0x1'))(_0xbd52('0x2'));var moment=require(_0xbd52('0x3'));var BPromise=require(_0xbd52('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd52('0x5'));var rimraf=require('rimraf');var config=require(_0xbd52('0x6'));var attributes=require(_0xbd52('0x7'));module[_0xbd52('0x8')]=function(_0x2a20e7,_0x4fd609){return _0x2a20e7[_0xbd52('0x9')]('SquareProject',attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x17e4c9,_0x532237,_0x12d320){if(_0x17e4c9[_0xbd52('0xa')](_0xbd52('0xb'))){_0x17e4c9[_0xbd52('0xc')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x17e4c9['changed'](_0xbd52('0xd'))){_0x17e4c9[_0xbd52('0xe')]=moment()[_0xbd52('0xf')](_0xbd52('0x10'));}_0x12d320(null,_0x17e4c9);}}});}; \ No newline at end of file +var _0x1d0c=['production','publishedAt','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','SquareProject','square_projects','savedAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x492806,_0x2b6106){var _0x2a61f3=function(_0x7aaedd){while(--_0x7aaedd){_0x492806['push'](_0x492806['shift']());}};_0x2a61f3(++_0x2b6106);}(_0x1d0c,0x91));var _0xc1d0=function(_0x53f8a1,_0x1d0a3d){_0x53f8a1=_0x53f8a1-0x0;var _0x1e3698=_0x1d0c[_0x53f8a1];return _0x1e3698;};'use strict';var _=require('lodash');var util=require(_0xc1d0('0x0'));var logger=require(_0xc1d0('0x1'))(_0xc1d0('0x2'));var moment=require(_0xc1d0('0x3'));var BPromise=require(_0xc1d0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc1d0('0x5'));var config=require(_0xc1d0('0x6'));var attributes=require('./squareProject.attributes');module['exports']=function(_0x46fd59,_0x5289ee){return _0x46fd59['define'](_0xc1d0('0x7'),attributes,{'tableName':_0xc1d0('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x590ad5,_0xe44e45,_0x30cf7c){if(_0x590ad5['changed']('preproduction')){_0x590ad5[_0xc1d0('0x9')]=moment()['format'](_0xc1d0('0xa'));}if(_0x590ad5['changed'](_0xc1d0('0xb'))){_0x590ad5[_0xc1d0('0xc')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x30cf7c(null,_0x590ad5);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index d5a4c78..89c3c7a 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 _0x5def=['request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowSquareProject','SquareProject','options','where','attributes','include','map','model','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','request','then','SquareProject,\x20%s,\x20%s'];(function(_0x22e02c,_0x247c23){var _0x3d0ab9=function(_0x4d7d9b){while(--_0x4d7d9b){_0x22e02c['push'](_0x22e02c['shift']());}};_0x3d0ab9(++_0x247c23);}(_0x5def,0x122));var _0xf5de=function(_0x41ed13,_0x1044be){_0x41ed13=_0x41ed13-0x0;var _0x1bb4d5=_0x5def[_0x41ed13];return _0x1bb4d5;};'use strict';var _=require(_0xf5de('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf5de('0x1'));var rs=require(_0xf5de('0x2'));var fs=require('fs');var Redis=require(_0xf5de('0x3'));var db=require(_0xf5de('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf5de('0x5'))('rpc');var config=require(_0xf5de('0x6'));var jayson=require(_0xf5de('0x7'));var client=jayson[_0xf5de('0x8')][_0xf5de('0x9')]({'port':0x232a});config[_0xf5de('0xa')]=_[_0xf5de('0xb')](config['redis'],{'host':_0xf5de('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf5de('0xa')]));require('./squareProject.socket')['register'](socket);function respondWithRpcPromise(_0x156b3b,_0x59adc0,_0x2ff727){return new BPromise(function(_0x3d2ba7,_0x1d0d7a){return client[_0xf5de('0xd')](_0x156b3b,_0x2ff727)[_0xf5de('0xe')](function(_0x3df940){logger['info'](_0xf5de('0xf'),_0x59adc0,_0xf5de('0x10'));logger[_0xf5de('0x11')](_0xf5de('0x12'),_0x59adc0,_0xf5de('0x10'),JSON[_0xf5de('0x13')](_0x3df940));if(_0x3df940['error']){if(_0x3df940[_0xf5de('0x14')][_0xf5de('0x15')]===0x1f4){logger[_0xf5de('0x14')](_0xf5de('0xf'),_0x59adc0,_0x3df940[_0xf5de('0x14')][_0xf5de('0x16')]);return _0x1d0d7a(_0x3df940[_0xf5de('0x14')][_0xf5de('0x16')]);}logger[_0xf5de('0x14')](_0xf5de('0xf'),_0x59adc0,_0x3df940[_0xf5de('0x14')][_0xf5de('0x16')]);return _0x3d2ba7(_0x3df940[_0xf5de('0x14')]['message']);}else{logger[_0xf5de('0x17')](_0xf5de('0xf'),_0x59adc0,_0xf5de('0x10'));_0x3d2ba7(_0x3df940[_0xf5de('0x18')][_0xf5de('0x16')]);}})[_0xf5de('0x19')](function(_0x19325d){logger[_0xf5de('0x14')](_0xf5de('0xf'),_0x59adc0,_0x19325d);_0x1d0d7a(_0x19325d);});});}exports[_0xf5de('0x1a')]=function(_0x2c61eb){var _0x339e3f=this;return new Promise(function(_0x285945,_0x17a2f2){return db[_0xf5de('0x1b')]['find']({'raw':_0x2c61eb['options']?_0x2c61eb[_0xf5de('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x2c61eb[_0xf5de('0x1c')]?_0x2c61eb[_0xf5de('0x1c')][_0xf5de('0x1d')]||null:null,'attributes':_0x2c61eb[_0xf5de('0x1c')]?_0x2c61eb[_0xf5de('0x1c')][_0xf5de('0x1e')]||null:null,'include':_0x2c61eb['options']?_0x2c61eb[_0xf5de('0x1c')][_0xf5de('0x1f')]?_[_0xf5de('0x20')](_0x2c61eb[_0xf5de('0x1c')][_0xf5de('0x1f')],function(_0x5cd104){return{'model':db[_0x5cd104['model']],'as':_0x5cd104['as'],'attributes':_0x5cd104[_0xf5de('0x1e')],'include':_0x5cd104['include']?_[_0xf5de('0x20')](_0x5cd104[_0xf5de('0x1f')],function(_0x55f357){return{'model':db[_0x55f357[_0xf5de('0x21')]],'as':_0x55f357['as'],'attributes':_0x55f357['attributes'],'include':_0x55f357['include']?_[_0xf5de('0x20')](_0x55f357['include'],function(_0x17c9b0){return{'model':db[_0x17c9b0['model']],'as':_0x17c9b0['as'],'attributes':_0x17c9b0[_0xf5de('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf5de('0xe')](function(_0x364eae){logger['info'](_0xf5de('0x1a'),_0x2c61eb);logger[_0xf5de('0x11')](_0xf5de('0x1a'),_0x2c61eb,JSON['stringify'](_0x364eae));_0x285945(_0x364eae);})[_0xf5de('0x19')](function(_0x156a40){logger['error']('ShowSquareProject',_0x156a40[_0xf5de('0x16')],_0x2c61eb);_0x17a2f2(_0x339e3f['error'](0x1f4,_0x156a40[_0xf5de('0x16')]));});});}; \ No newline at end of file +var _0x4399=['ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareProject,\x20%s,\x20%s','message','request\x20sent','catch','ShowSquareProject','find','options','raw','where','attributes','map','model','include','lodash','bluebird','randomstring'];(function(_0xb24b2f,_0x38ac03){var _0x4155d5=function(_0x249a9c){while(--_0x249a9c){_0xb24b2f['push'](_0xb24b2f['shift']());}};_0x4155d5(++_0x38ac03);}(_0x4399,0xb1));var _0x9439=function(_0x1958a5,_0x10dc57){_0x1958a5=_0x1958a5-0x0;var _0xa2ab95=_0x4399[_0x1958a5];return _0xa2ab95;};'use strict';var _=require(_0x9439('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9439('0x1'));var rs=require(_0x9439('0x2'));var fs=require('fs');var Redis=require(_0x9439('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9439('0x4'))(_0x9439('0x5'));var config=require(_0x9439('0x6'));var jayson=require(_0x9439('0x7'));var client=jayson[_0x9439('0x8')][_0x9439('0x9')]({'port':0x232a});config[_0x9439('0xa')]=_[_0x9439('0xb')](config[_0x9439('0xa')],{'host':_0x9439('0xc'),'port':0x18eb});var socket=require(_0x9439('0xd'))(new Redis(config[_0x9439('0xa')]));require('./squareProject.socket')[_0x9439('0xe')](socket);function respondWithRpcPromise(_0x4f82b5,_0x3a4d8f,_0x182f07){return new BPromise(function(_0x299117,_0x5a7c43){return client[_0x9439('0xf')](_0x4f82b5,_0x182f07)[_0x9439('0x10')](function(_0x1385f4){logger[_0x9439('0x11')]('SquareProject,\x20%s,\x20%s',_0x3a4d8f,'request\x20sent');logger[_0x9439('0x12')](_0x9439('0x13'),_0x3a4d8f,'request\x20sent',JSON[_0x9439('0x14')](_0x1385f4));if(_0x1385f4[_0x9439('0x15')]){if(_0x1385f4[_0x9439('0x15')][_0x9439('0x16')]===0x1f4){logger[_0x9439('0x15')](_0x9439('0x17'),_0x3a4d8f,_0x1385f4['error']['message']);return _0x5a7c43(_0x1385f4[_0x9439('0x15')]['message']);}logger[_0x9439('0x15')](_0x9439('0x17'),_0x3a4d8f,_0x1385f4[_0x9439('0x15')]['message']);return _0x299117(_0x1385f4['error'][_0x9439('0x18')]);}else{logger[_0x9439('0x11')](_0x9439('0x17'),_0x3a4d8f,_0x9439('0x19'));_0x299117(_0x1385f4['result'][_0x9439('0x18')]);}})[_0x9439('0x1a')](function(_0x2daf3c){logger[_0x9439('0x15')]('SquareProject,\x20%s,\x20%s',_0x3a4d8f,_0x2daf3c);_0x5a7c43(_0x2daf3c);});});}exports[_0x9439('0x1b')]=function(_0x4b3805){var _0x175dc5=this;return new Promise(function(_0x428115,_0x1600cc){return db['SquareProject'][_0x9439('0x1c')]({'raw':_0x4b3805['options']?_0x4b3805[_0x9439('0x1d')][_0x9439('0x1e')]===undefined?!![]:![]:!![],'where':_0x4b3805[_0x9439('0x1d')]?_0x4b3805[_0x9439('0x1d')][_0x9439('0x1f')]||null:null,'attributes':_0x4b3805[_0x9439('0x1d')]?_0x4b3805[_0x9439('0x1d')][_0x9439('0x20')]||null:null,'include':_0x4b3805[_0x9439('0x1d')]?_0x4b3805['options']['include']?_[_0x9439('0x21')](_0x4b3805['options']['include'],function(_0x4b279b){return{'model':db[_0x4b279b[_0x9439('0x22')]],'as':_0x4b279b['as'],'attributes':_0x4b279b['attributes'],'include':_0x4b279b[_0x9439('0x23')]?_[_0x9439('0x21')](_0x4b279b[_0x9439('0x23')],function(_0x55981a){return{'model':db[_0x55981a[_0x9439('0x22')]],'as':_0x55981a['as'],'attributes':_0x55981a[_0x9439('0x20')],'include':_0x55981a[_0x9439('0x23')]?_['map'](_0x55981a[_0x9439('0x23')],function(_0x2a1ffb){return{'model':db[_0x2a1ffb[_0x9439('0x22')]],'as':_0x2a1ffb['as'],'attributes':_0x2a1ffb['attributes']};}):[]};}):[]};}):[]:[]})[_0x9439('0x10')](function(_0x39be74){logger[_0x9439('0x11')]('ShowSquareProject',_0x4b3805);logger[_0x9439('0x12')](_0x9439('0x1b'),_0x4b3805,JSON['stringify'](_0x39be74));_0x428115(_0x39be74);})[_0x9439('0x1a')](function(_0x46f99a){logger['error']('ShowSquareProject',_0x46f99a['message'],_0x4b3805);_0x1600cc(_0x175dc5['error'](0x1f4,_0x46f99a[_0x9439('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 4657132..53ac3e7 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 _0x9d6f=['remove','update','emit','register','./squareProject.events','save'];(function(_0x307ebc,_0x213a87){var _0x56cf43=function(_0xa8f3a0){while(--_0xa8f3a0){_0x307ebc['push'](_0x307ebc['shift']());}};_0x56cf43(++_0x213a87);}(_0x9d6f,0x1f0));var _0xf9d6=function(_0x254763,_0x5e48fe){_0x254763=_0x254763-0x0;var _0xb35ad7=_0x9d6f[_0x254763];return _0xb35ad7;};'use strict';var SquareProjectEvents=require(_0xf9d6('0x0'));var events=[_0xf9d6('0x1'),_0xf9d6('0x2'),_0xf9d6('0x3')];function createListener(_0x448d72,_0x471ac5){return function(_0x31e86b){_0x471ac5[_0xf9d6('0x4')](_0x448d72,_0x31e86b);};}function removeListener(_0x5d2406,_0x2f64cd){return function(){SquareProjectEvents['removeListener'](_0x5d2406,_0x2f64cd);};}exports[_0xf9d6('0x5')]=function(_0x409e25){for(var _0x14bba8=0x0,_0x38a3ec=events['length'];_0x14bba8<_0x38a3ec;_0x14bba8++){var _0x594efc=events[_0x14bba8];var _0x4777fd=createListener('squareProject:'+_0x594efc,_0x409e25);SquareProjectEvents['on'](_0x594efc,_0x4777fd);}}; \ No newline at end of file +var _0xdd6a=['removeListener','squareProject:','./squareProject.events','save','update'];(function(_0x5ae07c,_0x12c336){var _0x4fc53a=function(_0x118034){while(--_0x118034){_0x5ae07c['push'](_0x5ae07c['shift']());}};_0x4fc53a(++_0x12c336);}(_0xdd6a,0x11a));var _0xadd6=function(_0xf482c1,_0x32cbca){_0xf482c1=_0xf482c1-0x0;var _0x184548=_0xdd6a[_0xf482c1];return _0x184548;};'use strict';var SquareProjectEvents=require(_0xadd6('0x0'));var events=[_0xadd6('0x1'),'remove',_0xadd6('0x2')];function createListener(_0x465053,_0x1c2592){return function(_0x1caa73){_0x1c2592['emit'](_0x465053,_0x1caa73);};}function removeListener(_0x35c788,_0x2e5164){return function(){SquareProjectEvents[_0xadd6('0x3')](_0x35c788,_0x2e5164);};}exports['register']=function(_0x39703d){for(var _0x5ef9ad=0x0,_0x2ad8f0=events['length'];_0x5ef9ad<_0x2ad8f0;_0x5ef9ad++){var _0x462ea8=events[_0x5ef9ad];var _0x349b85=createListener(_0xadd6('0x4')+_0x462ea8,_0x39703d);SquareProjectEvents['on'](_0x462ea8,_0x349b85);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 489addb..f15a937 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 _0xf494=['../../config/environment','./squareRecording.controller','get','isAuthenticated','index','show','/:id/download','download','post','create','/:id','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x40417c,_0x31cf81){var _0x210018=function(_0x3d8ac6){while(--_0x3d8ac6){_0x40417c['push'](_0x40417c['shift']());}};_0x210018(++_0x31cf81);}(_0xf494,0x1c6));var _0x4f49=function(_0x25b78d,_0x347586){_0x25b78d=_0x25b78d-0x0;var _0x3d04f5=_0xf494[_0x25b78d];return _0x3d04f5;};'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 fs_extra=require(_0x4f49('0x5'));var auth=require(_0x4f49('0x6'));var interaction=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var controller=require(_0x4f49('0x9'));router[_0x4f49('0xa')]('/',auth[_0x4f49('0xb')](),controller[_0x4f49('0xc')]);router[_0x4f49('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x4f49('0xd')]);router[_0x4f49('0xa')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller[_0x4f49('0xf')]);router[_0x4f49('0x10')]('/',auth[_0x4f49('0xb')](),controller[_0x4f49('0x11')]);router['put'](_0x4f49('0x12'),auth[_0x4f49('0xb')](),controller['update']);router[_0x4f49('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x4f49('0x14')]);module[_0x4f49('0x15')]=router; \ No newline at end of file +var _0x7a54=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','index','/:id','isAuthenticated','post','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x2e735d,_0x5e9cd3){var _0x1d7c9c=function(_0x29612b){while(--_0x29612b){_0x2e735d['push'](_0x2e735d['shift']());}};_0x1d7c9c(++_0x5e9cd3);}(_0x7a54,0x106));var _0x47a5=function(_0x31b1d0,_0x1490b8){_0x31b1d0=_0x31b1d0-0x0;var _0x23b10e=_0x7a54[_0x31b1d0];return _0x23b10e;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0x9')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x47a5('0xd')]('/',auth[_0x47a5('0xc')](),controller['create']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);module[_0x47a5('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 00f3df4..09b3d57 100644 --- a/server/api/squareRecording/squareRecording.attributes.js +++ b/server/api/squareRecording/squareRecording.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['substring','lastIndexOf','sequelize','exports','STRING','VIRTUAL','getDataValue','savePath'];(function(_0x15a9da,_0x248749){var _0x2d79f2=function(_0x3e65f1){while(--_0x3e65f1){_0x15a9da['push'](_0x15a9da['shift']());}};_0x2d79f2(++_0x248749);}(_0x814b,0x1a2));var _0xb814=function(_0x19a11f,_0x6d8be7){_0x19a11f=_0x19a11f-0x0;var _0x51485f=_0x814b[_0x19a11f];return _0x51485f;};'use strict';var Sequelize=require(_0xb814('0x0'));module[_0xb814('0x1')]={'uniqueid':{'type':Sequelize[_0xb814('0x2')]},'callerid':{'type':Sequelize[_0xb814('0x2')]},'calleridname':{'type':Sequelize[_0xb814('0x2')]},'context':{'type':Sequelize[_0xb814('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xb814('0x2')]},'accountcode':{'type':Sequelize[_0xb814('0x2')]},'dnid':{'type':Sequelize[_0xb814('0x2')]},'projectName':{'type':Sequelize[_0xb814('0x2')]},'saveName':{'type':Sequelize[_0xb814('0x2')]},'filename':{'type':Sequelize[_0xb814('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xb814('0x3')],'get':function(){var _0x2e6272='';var _0x5c8539=this[_0xb814('0x4')](_0xb814('0x5'));if(_0x5c8539){_0x2e6272=_0x5c8539[_0xb814('0x6')](_0x5c8539[_0xb814('0x7')]('.'));}return _0x2e6272;}}}; \ No newline at end of file +var _0x8958=['savePath','substring','lastIndexOf','exports','STRING','VIRTUAL'];(function(_0x7f3667,_0x30c3f1){var _0x2c4c24=function(_0xf070f3){while(--_0xf070f3){_0x7f3667['push'](_0x7f3667['shift']());}};_0x2c4c24(++_0x30c3f1);}(_0x8958,0x93));var _0x8895=function(_0x125d6d,_0x52f01a){_0x125d6d=_0x125d6d-0x0;var _0x5c1026=_0x8958[_0x125d6d];return _0x5c1026;};'use strict';var Sequelize=require('sequelize');module[_0x8895('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x8895('0x1')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x8895('0x1')]},'dnid':{'type':Sequelize[_0x8895('0x1')]},'projectName':{'type':Sequelize[_0x8895('0x1')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x8895('0x1')]},'savePath':{'type':Sequelize[_0x8895('0x1')]},'format':{'type':Sequelize[_0x8895('0x2')],'get':function(){var _0x40cec6='';var _0x33013a=this['getDataValue'](_0x8895('0x3'));if(_0x33013a){_0x40cec6=_0x33013a[_0x8895('0x4')](_0x33013a[_0x8895('0x5')]('.'));}return _0x40cec6;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index a8a03b9..1965f06 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 _0xec3c=['type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','params','includeAll','create','body','download','../../components/encryptor','uniqueid','find','savePath','%s.cypher','existsSync','secrets','recording','ValidationError','SquareRecording\x20not\x20found','filename','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','count','json','apply','reject','update','then','destroy','stack','name','send','SquareRecording','rawAttributes','fieldName'];(function(_0x1a042b,_0x45a06c){var _0x3db897=function(_0x2f3409){while(--_0x2f3409){_0x1a042b['push'](_0x1a042b['shift']());}};_0x3db897(++_0x45a06c);}(_0xec3c,0x8c));var _0xcec3=function(_0x316c1c,_0x446eaa){_0x316c1c=_0x316c1c-0x0;var _0x48e472=_0xec3c[_0x316c1c];return _0x48e472;};'use strict';var emlformat=require(_0xcec3('0x0'));var rimraf=require(_0xcec3('0x1'));var zipdir=require(_0xcec3('0x2'));var jsonpatch=require(_0xcec3('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcec3('0x4'));var util=require('util');var path=require(_0xcec3('0x5'));var sox=require(_0xcec3('0x6'));var csv=require(_0xcec3('0x7'));var ejs=require(_0xcec3('0x8'));var fs=require('fs');var fs_extra=require(_0xcec3('0x9'));var _=require(_0xcec3('0xa'));var squel=require(_0xcec3('0xb'));var crypto=require('crypto');var jsforce=require(_0xcec3('0xc'));var deskjs=require(_0xcec3('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xcec3('0xe'));var Redis=require('ioredis');var authService=require(_0xcec3('0xf'));var qs=require(_0xcec3('0x10'));var as=require(_0xcec3('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcec3('0x12'))(_0xcec3('0x13'));var utils=require(_0xcec3('0x14'));var config=require(_0xcec3('0x15'));var licenseUtil=require(_0xcec3('0x16'));var db=require(_0xcec3('0x17'))['db'];function respondWithStatusCode(_0x8d2b8b,_0x54b1ba){_0x54b1ba=_0x54b1ba||0xcc;return function(_0x559198){if(_0x559198){return _0x8d2b8b['sendStatus'](_0x54b1ba);}return _0x8d2b8b[_0xcec3('0x18')](_0x54b1ba)[_0xcec3('0x19')]();};}function respondWithResult(_0x1b946b,_0x162401){_0x162401=_0x162401||0xc8;return function(_0x3e0b87){if(_0x3e0b87){return _0x1b946b[_0xcec3('0x18')](_0x162401)['json'](_0x3e0b87);}};}function respondWithFilteredResult(_0x549161,_0x454eb5){return function(_0x3ca59d){if(_0x3ca59d){var _0x48b878=typeof _0x454eb5[_0xcec3('0x1a')]==='undefined'&&typeof _0x454eb5['limit']==='undefined';var _0xd6dbb7=_0x3ca59d[_0xcec3('0x1b')];var _0x26c223=_0x48b878?0x0:_0x454eb5['offset'];var _0x59b231=_0x48b878?_0x3ca59d[_0xcec3('0x1b')]:_0x454eb5[_0xcec3('0x1a')]+_0x454eb5['limit'];var _0x30a638;if(_0x59b231>=_0xd6dbb7){_0x59b231=_0xd6dbb7;_0x30a638=0xc8;}else{_0x30a638=0xce;}_0x549161[_0xcec3('0x18')](_0x30a638);return _0x549161['set']('Content-Range',_0x26c223+'-'+_0x59b231+'/'+_0xd6dbb7)[_0xcec3('0x1c')](_0x3ca59d);}return null;};}function patchUpdates(_0x1fe420){return function(_0x26ad1b){try{jsonpatch[_0xcec3('0x1d')](_0x26ad1b,_0x1fe420,!![]);}catch(_0x15e7bb){return BPromise[_0xcec3('0x1e')](_0x15e7bb);}return _0x26ad1b['save']();};}function saveUpdates(_0x28fc8f,_0x2061c8){return function(_0x100445){if(_0x100445){return _0x100445[_0xcec3('0x1f')](_0x28fc8f)[_0xcec3('0x20')](function(_0x551556){return _0x551556;});}return null;};}function removeEntity(_0x824c41,_0x224ac2){return function(_0x49d769){if(_0x49d769){return _0x49d769[_0xcec3('0x21')]()[_0xcec3('0x20')](function(){_0x824c41[_0xcec3('0x18')](0xcc)[_0xcec3('0x19')]();});}};}function handleEntityNotFound(_0x1cb7a0,_0x3e8934){return function(_0xdf351d){if(!_0xdf351d){_0x1cb7a0['sendStatus'](0x194);}return _0xdf351d;};}function handleError(_0x2c25ee,_0x5b33ed){_0x5b33ed=_0x5b33ed||0x1f4;return function(_0x63a8b2){logger['error'](_0x63a8b2[_0xcec3('0x22')]);if(_0x63a8b2[_0xcec3('0x23')]){delete _0x63a8b2[_0xcec3('0x23')];}_0x2c25ee[_0xcec3('0x18')](_0x5b33ed)[_0xcec3('0x24')](_0x63a8b2);};}exports['index']=function(_0x3e990b,_0x3bffd8){var _0x1b226f={},_0x11d2cd={},_0x430335={'count':0x0,'rows':[]};var _0x409a1c=_['map'](db[_0xcec3('0x25')][_0xcec3('0x26')],function(_0x1dc06e){return{'name':_0x1dc06e[_0xcec3('0x27')],'type':_0x1dc06e[_0xcec3('0x28')][_0xcec3('0x29')]};});_0x11d2cd[_0xcec3('0x2a')]=_[_0xcec3('0x2b')](_0x409a1c,'name');_0x11d2cd[_0xcec3('0x2c')]=_[_0xcec3('0x2d')](_0x3e990b['query']);_0x11d2cd[_0xcec3('0x2e')]=_[_0xcec3('0x2f')](_0x11d2cd[_0xcec3('0x2a')],_0x11d2cd['query']);_0x1b226f[_0xcec3('0x30')]=_['intersection'](_0x11d2cd[_0xcec3('0x2a')],qs[_0xcec3('0x31')](_0x3e990b[_0xcec3('0x2c')][_0xcec3('0x31')]));_0x1b226f[_0xcec3('0x30')]=_0x1b226f[_0xcec3('0x30')][_0xcec3('0x32')]?_0x1b226f['attributes']:_0x11d2cd[_0xcec3('0x2a')];if(!_0x3e990b['query'][_0xcec3('0x33')]('nolimit')){_0x1b226f[_0xcec3('0x34')]=qs['limit'](_0x3e990b[_0xcec3('0x2c')]['limit']);_0x1b226f[_0xcec3('0x1a')]=qs['offset'](_0x3e990b[_0xcec3('0x2c')][_0xcec3('0x1a')]);}_0x1b226f[_0xcec3('0x35')]=qs[_0xcec3('0x36')](_0x3e990b[_0xcec3('0x2c')][_0xcec3('0x36')]);_0x1b226f[_0xcec3('0x37')]=qs[_0xcec3('0x2e')](_[_0xcec3('0x38')](_0x3e990b['query'],_0x11d2cd[_0xcec3('0x2e')]),_0x409a1c);if(_0x3e990b[_0xcec3('0x2c')][_0xcec3('0x39')]){_0x1b226f[_0xcec3('0x37')]=_[_0xcec3('0x3a')](_0x1b226f[_0xcec3('0x37')],{'$or':_[_0xcec3('0x2b')](_0x409a1c,function(_0x531ffe){if(_0x531ffe[_0xcec3('0x28')]!==_0xcec3('0x3b')){var _0x1692b8={};_0x1692b8[_0x531ffe[_0xcec3('0x23')]]={'$like':'%'+_0x3e990b[_0xcec3('0x2c')][_0xcec3('0x39')]+'%'};return _0x1692b8;}})});}_0x1b226f=_[_0xcec3('0x3a')]({},_0x1b226f,_0x3e990b[_0xcec3('0x3c')]);var _0x1d02d7={'where':_0x1b226f['where']};return db[_0xcec3('0x25')][_0xcec3('0x1b')](_0x1d02d7)['then'](function(_0x129610){_0x430335[_0xcec3('0x1b')]=_0x129610;if(_0x3e990b['query']['includeAll']){_0x1b226f[_0xcec3('0x3d')]=[{'all':!![]}];}return db[_0xcec3('0x25')][_0xcec3('0x3e')](_0x1b226f);})['then'](function(_0x1525b4){_0x430335['rows']=_0x1525b4;return _0x430335;})[_0xcec3('0x20')](respondWithFilteredResult(_0x3bffd8,_0x1b226f))[_0xcec3('0x3f')](handleError(_0x3bffd8,null));};exports['show']=function(_0x4cf379,_0x39336b){var _0x2c6d0c={'raw':!![],'where':{'id':_0x4cf379[_0xcec3('0x40')]['id']}},_0x205352={};_0x205352[_0xcec3('0x2a')]=_['keys'](db[_0xcec3('0x25')][_0xcec3('0x26')]);_0x205352[_0xcec3('0x2c')]=_[_0xcec3('0x2d')](_0x4cf379[_0xcec3('0x2c')]);_0x205352['filters']=_['intersection'](_0x205352[_0xcec3('0x2a')],_0x205352[_0xcec3('0x2c')]);_0x2c6d0c[_0xcec3('0x30')]=_['intersection'](_0x205352['model'],qs[_0xcec3('0x31')](_0x4cf379[_0xcec3('0x2c')][_0xcec3('0x31')]));_0x2c6d0c[_0xcec3('0x30')]=_0x2c6d0c[_0xcec3('0x30')][_0xcec3('0x32')]?_0x2c6d0c['attributes']:_0x205352[_0xcec3('0x2a')];if(_0x4cf379['query'][_0xcec3('0x41')]){_0x2c6d0c[_0xcec3('0x3d')]=[{'all':!![]}];}_0x2c6d0c=_[_0xcec3('0x3a')]({},_0x2c6d0c,_0x4cf379['options']);return db['SquareRecording']['find'](_0x2c6d0c)[_0xcec3('0x20')](handleEntityNotFound(_0x39336b,null))['then'](respondWithResult(_0x39336b,null))[_0xcec3('0x3f')](handleError(_0x39336b,null));};exports[_0xcec3('0x42')]=function(_0xb43044,_0x36c7d5){return db[_0xcec3('0x25')][_0xcec3('0x42')](_0xb43044[_0xcec3('0x43')],{})[_0xcec3('0x20')](respondWithResult(_0x36c7d5,0xc9))[_0xcec3('0x3f')](handleError(_0x36c7d5,null));};exports[_0xcec3('0x1f')]=function(_0x9bfbb4,_0xc3dc6){if(_0x9bfbb4[_0xcec3('0x43')]['id']){delete _0x9bfbb4['body']['id'];}return db[_0xcec3('0x25')]['find']({'where':{'id':_0x9bfbb4[_0xcec3('0x40')]['id']}})['then'](handleEntityNotFound(_0xc3dc6,null))[_0xcec3('0x20')](saveUpdates(_0x9bfbb4[_0xcec3('0x43')],null))[_0xcec3('0x20')](respondWithResult(_0xc3dc6,null))['catch'](handleError(_0xc3dc6,null));};exports[_0xcec3('0x44')]=function(_0x3004c8,_0x56d83a,_0x2296c4){var _0xc27e73=require(_0xcec3('0x45'));var _0x209c2a=![];var _0x50f702={};if(_0x3004c8[_0xcec3('0x2c')][_0xcec3('0x28')]&&_0x3004c8[_0xcec3('0x2c')][_0xcec3('0x28')]===_0xcec3('0x46')){_0x50f702[_0xcec3('0x46')]=_0x3004c8['params']['id'];}else{_0x50f702['id']=_0x3004c8[_0xcec3('0x40')]['id'];}return db['SquareRecording'][_0xcec3('0x47')]({'where':_0x50f702,'attributes':['id',_0xcec3('0x48'),'filename'],'raw':!![]})[_0xcec3('0x20')](handleEntityNotFound(_0x56d83a,null))[_0xcec3('0x20')](function(_0x580fb6){if(_0x580fb6){var _0x563221=_0x580fb6[_0xcec3('0x48')];var _0xc6d6ec=util['format'](_0xcec3('0x49'),_0x563221);if(fs[_0xcec3('0x4a')](_0xc6d6ec)){_0x209c2a=!![];return _0xc27e73['decryptFile'](_0xc6d6ec,_0x563221,config[_0xcec3('0x4b')][_0xcec3('0x4c')])['then'](function(){return _0x580fb6;});}return _0x580fb6;}})[_0xcec3('0x20')](function(_0x25c43f){if(_0x25c43f){var _0x2d3417=_0x25c43f[_0xcec3('0x48')];if(!fs[_0xcec3('0x4a')](_0x2d3417)){throw new db['Sequelize'][(_0xcec3('0x4d'))](_0xcec3('0x4e'));}if(_0x25c43f[_0xcec3('0x4f')]){return _0x56d83a[_0xcec3('0x44')](_0x2d3417,_0x25c43f[_0xcec3('0x4f')]+path['extname'](_0x2d3417),function(){if(_0x209c2a){fs[_0xcec3('0x50')](_0x2d3417);}});}else{return _0x56d83a[_0xcec3('0x44')](_0x2d3417,function(_0x254af6){if(_0x209c2a){fs[_0xcec3('0x50')](_0x2d3417);}});}}})[_0xcec3('0x3f')](function(_0x23f614){if(_0x23f614[_0xcec3('0x51')]===_0xcec3('0x4e')){_0x56d83a[_0xcec3('0x18')](0x194)['send'](_0xcec3('0x52'));}else{return handleError(_0x56d83a,null);}});};exports[_0xcec3('0x21')]=function(_0x3b3439,_0x12a0f8){return db[_0xcec3('0x25')][_0xcec3('0x47')]({'where':{'id':_0x3b3439[_0xcec3('0x40')]['id']}})[_0xcec3('0x20')](function(_0x28e26a){if(_[_0xcec3('0x53')](_0x28e26a)){throw new ReferenceError(_0xcec3('0x54'));}return _0x28e26a;})[_0xcec3('0x20')](function(_0x57254b){var _0x3a65e1=_0x57254b['savePath'];logger[_0xcec3('0x55')]('cancellazione\x20fisica\x20documento\x20%s',_0x3a65e1);if(!_[_0xcec3('0x53')](_0x57254b[_0xcec3('0x48')])&&fs['existsSync'](_0x3a65e1)){logger[_0xcec3('0x55')](_0xcec3('0x56')+_0x3a65e1+_0xcec3('0x57'));fs['unlinkSync'](_0x3a65e1);}_0x3a65e1=_0x3a65e1+_0xcec3('0x58');if(!_[_0xcec3('0x53')](_0x57254b[_0xcec3('0x48')])&&fs[_0xcec3('0x4a')](_0x3a65e1)){logger[_0xcec3('0x55')](_0xcec3('0x56')+_0x3a65e1+_0xcec3('0x57'));fs[_0xcec3('0x59')](_0x3a65e1);}return _0x57254b;})['then'](function(_0x805312){if(!_0x805312)throw new InternalError();return _0x805312[_0xcec3('0x21')]();})[_0xcec3('0x20')](function(){_0x12a0f8[_0xcec3('0x18')](0xcc)[_0xcec3('0x19')]();})[_0xcec3('0x3f')](handleError(_0x12a0f8,null));}; \ No newline at end of file +var _0xe5d2=['findAll','show','params','keys','includeAll','find','catch','create','body','download','uniqueid','savePath','format','%s.cypher','existsSync','decryptFile','secrets','Sequelize','ValidationError','filename','extname','unlink','message','SquareRecording\x20not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','destroy','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','json','offset','limit','undefined','count','status','Content-Range','reject','save','update','end','sendStatus','error','stack','send','index','map','SquareRecording','rawAttributes','type','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','include'];(function(_0x4da59a,_0x315d38){var _0x149cd6=function(_0x1aea46){while(--_0x1aea46){_0x4da59a['push'](_0x4da59a['shift']());}};_0x149cd6(++_0x315d38);}(_0xe5d2,0x1ac));var _0x2e5d=function(_0x5d7583,_0x48a446){_0x5d7583=_0x5d7583-0x0;var _0x1e615c=_0xe5d2[_0x5d7583];return _0x1e615c;};'use strict';var emlformat=require(_0x2e5d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2e5d('0x1'));var rp=require(_0x2e5d('0x2'));var moment=require(_0x2e5d('0x3'));var BPromise=require(_0x2e5d('0x4'));var Mustache=require(_0x2e5d('0x5'));var util=require('util');var path=require(_0x2e5d('0x6'));var sox=require(_0x2e5d('0x7'));var csv=require('to-csv');var ejs=require(_0x2e5d('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2e5d('0x9'));var squel=require(_0x2e5d('0xa'));var crypto=require('crypto');var jsforce=require(_0x2e5d('0xb'));var deskjs=require(_0x2e5d('0xc'));var toCsv=require(_0x2e5d('0xd'));var querystring=require('querystring');var Papa=require(_0x2e5d('0xe'));var Redis=require(_0x2e5d('0xf'));var authService=require(_0x2e5d('0x10'));var qs=require(_0x2e5d('0x11'));var as=require(_0x2e5d('0x12'));var hardwareService=require(_0x2e5d('0x13'));var logger=require(_0x2e5d('0x14'))(_0x2e5d('0x15'));var utils=require(_0x2e5d('0x16'));var config=require(_0x2e5d('0x17'));var licenseUtil=require(_0x2e5d('0x18'));var db=require(_0x2e5d('0x19'))['db'];function respondWithStatusCode(_0x4208ac,_0x16f73f){_0x16f73f=_0x16f73f||0xcc;return function(_0xf491bf){if(_0xf491bf){return _0x4208ac['sendStatus'](_0x16f73f);}return _0x4208ac['status'](_0x16f73f)['end']();};}function respondWithResult(_0x10aa1a,_0x3938d3){_0x3938d3=_0x3938d3||0xc8;return function(_0x1bd033){if(_0x1bd033){return _0x10aa1a['status'](_0x3938d3)[_0x2e5d('0x1a')](_0x1bd033);}};}function respondWithFilteredResult(_0x299798,_0x404092){return function(_0x1ac2d8){if(_0x1ac2d8){var _0x45e97a=typeof _0x404092[_0x2e5d('0x1b')]==='undefined'&&typeof _0x404092[_0x2e5d('0x1c')]===_0x2e5d('0x1d');var _0xe0a100=_0x1ac2d8[_0x2e5d('0x1e')];var _0x3a00e8=_0x45e97a?0x0:_0x404092[_0x2e5d('0x1b')];var _0x10f4ee=_0x45e97a?_0x1ac2d8['count']:_0x404092['offset']+_0x404092[_0x2e5d('0x1c')];var _0x453eb1;if(_0x10f4ee>=_0xe0a100){_0x10f4ee=_0xe0a100;_0x453eb1=0xc8;}else{_0x453eb1=0xce;}_0x299798[_0x2e5d('0x1f')](_0x453eb1);return _0x299798['set'](_0x2e5d('0x20'),_0x3a00e8+'-'+_0x10f4ee+'/'+_0xe0a100)[_0x2e5d('0x1a')](_0x1ac2d8);}return null;};}function patchUpdates(_0xb808b6){return function(_0x3d9351){try{jsonpatch['apply'](_0x3d9351,_0xb808b6,!![]);}catch(_0x360687){return BPromise[_0x2e5d('0x21')](_0x360687);}return _0x3d9351[_0x2e5d('0x22')]();};}function saveUpdates(_0x1e4f09,_0x2708e0){return function(_0x4a7426){if(_0x4a7426){return _0x4a7426[_0x2e5d('0x23')](_0x1e4f09)['then'](function(_0xc8cf16){return _0xc8cf16;});}return null;};}function removeEntity(_0x4bb39d,_0x444471){return function(_0x54263e){if(_0x54263e){return _0x54263e['destroy']()['then'](function(){_0x4bb39d['status'](0xcc)[_0x2e5d('0x24')]();});}};}function handleEntityNotFound(_0x4c7d1f,_0x4e76ee){return function(_0x45b075){if(!_0x45b075){_0x4c7d1f[_0x2e5d('0x25')](0x194);}return _0x45b075;};}function handleError(_0x3a4828,_0x301258){_0x301258=_0x301258||0x1f4;return function(_0x300766){logger[_0x2e5d('0x26')](_0x300766[_0x2e5d('0x27')]);if(_0x300766['name']){delete _0x300766['name'];}_0x3a4828[_0x2e5d('0x1f')](_0x301258)[_0x2e5d('0x28')](_0x300766);};}exports[_0x2e5d('0x29')]=function(_0x28887f,_0x91681f){var _0x302440={},_0x8035fe={},_0x356e68={'count':0x0,'rows':[]};var _0x4726e5=_[_0x2e5d('0x2a')](db[_0x2e5d('0x2b')][_0x2e5d('0x2c')],function(_0x2d55a5){return{'name':_0x2d55a5['fieldName'],'type':_0x2d55a5[_0x2e5d('0x2d')][_0x2e5d('0x2e')]};});_0x8035fe[_0x2e5d('0x2f')]=_[_0x2e5d('0x2a')](_0x4726e5,_0x2e5d('0x30'));_0x8035fe['query']=_['keys'](_0x28887f[_0x2e5d('0x31')]);_0x8035fe[_0x2e5d('0x32')]=_[_0x2e5d('0x33')](_0x8035fe['model'],_0x8035fe[_0x2e5d('0x31')]);_0x302440[_0x2e5d('0x34')]=_[_0x2e5d('0x33')](_0x8035fe[_0x2e5d('0x2f')],qs[_0x2e5d('0x35')](_0x28887f['query'][_0x2e5d('0x35')]));_0x302440['attributes']=_0x302440[_0x2e5d('0x34')][_0x2e5d('0x36')]?_0x302440[_0x2e5d('0x34')]:_0x8035fe['model'];if(!_0x28887f['query'][_0x2e5d('0x37')](_0x2e5d('0x38'))){_0x302440[_0x2e5d('0x1c')]=qs[_0x2e5d('0x1c')](_0x28887f[_0x2e5d('0x31')][_0x2e5d('0x1c')]);_0x302440['offset']=qs[_0x2e5d('0x1b')](_0x28887f[_0x2e5d('0x31')][_0x2e5d('0x1b')]);}_0x302440[_0x2e5d('0x39')]=qs[_0x2e5d('0x3a')](_0x28887f['query'][_0x2e5d('0x3a')]);_0x302440[_0x2e5d('0x3b')]=qs[_0x2e5d('0x32')](_[_0x2e5d('0x3c')](_0x28887f[_0x2e5d('0x31')],_0x8035fe['filters']),_0x4726e5);if(_0x28887f[_0x2e5d('0x31')][_0x2e5d('0x3d')]){_0x302440[_0x2e5d('0x3b')]=_[_0x2e5d('0x3e')](_0x302440[_0x2e5d('0x3b')],{'$or':_['map'](_0x4726e5,function(_0x3f8836){if(_0x3f8836[_0x2e5d('0x2d')]!==_0x2e5d('0x3f')){var _0x25b413={};_0x25b413[_0x3f8836['name']]={'$like':'%'+_0x28887f['query']['filter']+'%'};return _0x25b413;}})});}_0x302440=_[_0x2e5d('0x3e')]({},_0x302440,_0x28887f[_0x2e5d('0x40')]);var _0x401ce9={'where':_0x302440['where']};return db['SquareRecording'][_0x2e5d('0x1e')](_0x401ce9)[_0x2e5d('0x41')](function(_0x556227){_0x356e68['count']=_0x556227;if(_0x28887f[_0x2e5d('0x31')]['includeAll']){_0x302440[_0x2e5d('0x42')]=[{'all':!![]}];}return db['SquareRecording'][_0x2e5d('0x43')](_0x302440);})[_0x2e5d('0x41')](function(_0x102f35){_0x356e68['rows']=_0x102f35;return _0x356e68;})[_0x2e5d('0x41')](respondWithFilteredResult(_0x91681f,_0x302440))['catch'](handleError(_0x91681f,null));};exports[_0x2e5d('0x44')]=function(_0x130130,_0x27dea3){var _0x40fa0c={'raw':!![],'where':{'id':_0x130130[_0x2e5d('0x45')]['id']}},_0x520d26={};_0x520d26['model']=_[_0x2e5d('0x46')](db[_0x2e5d('0x2b')]['rawAttributes']);_0x520d26[_0x2e5d('0x31')]=_[_0x2e5d('0x46')](_0x130130[_0x2e5d('0x31')]);_0x520d26[_0x2e5d('0x32')]=_[_0x2e5d('0x33')](_0x520d26[_0x2e5d('0x2f')],_0x520d26[_0x2e5d('0x31')]);_0x40fa0c['attributes']=_[_0x2e5d('0x33')](_0x520d26[_0x2e5d('0x2f')],qs['fields'](_0x130130[_0x2e5d('0x31')]['fields']));_0x40fa0c[_0x2e5d('0x34')]=_0x40fa0c[_0x2e5d('0x34')][_0x2e5d('0x36')]?_0x40fa0c[_0x2e5d('0x34')]:_0x520d26['model'];if(_0x130130[_0x2e5d('0x31')][_0x2e5d('0x47')]){_0x40fa0c['include']=[{'all':!![]}];}_0x40fa0c=_[_0x2e5d('0x3e')]({},_0x40fa0c,_0x130130['options']);return db[_0x2e5d('0x2b')][_0x2e5d('0x48')](_0x40fa0c)[_0x2e5d('0x41')](handleEntityNotFound(_0x27dea3,null))[_0x2e5d('0x41')](respondWithResult(_0x27dea3,null))[_0x2e5d('0x49')](handleError(_0x27dea3,null));};exports[_0x2e5d('0x4a')]=function(_0x32ba50,_0x3ecfb5){return db[_0x2e5d('0x2b')][_0x2e5d('0x4a')](_0x32ba50[_0x2e5d('0x4b')],{})['then'](respondWithResult(_0x3ecfb5,0xc9))[_0x2e5d('0x49')](handleError(_0x3ecfb5,null));};exports[_0x2e5d('0x23')]=function(_0x628f03,_0x3ab69f){if(_0x628f03[_0x2e5d('0x4b')]['id']){delete _0x628f03[_0x2e5d('0x4b')]['id'];}return db['SquareRecording'][_0x2e5d('0x48')]({'where':{'id':_0x628f03[_0x2e5d('0x45')]['id']}})['then'](handleEntityNotFound(_0x3ab69f,null))[_0x2e5d('0x41')](saveUpdates(_0x628f03[_0x2e5d('0x4b')],null))[_0x2e5d('0x41')](respondWithResult(_0x3ab69f,null))[_0x2e5d('0x49')](handleError(_0x3ab69f,null));};exports[_0x2e5d('0x4c')]=function(_0x4d6335,_0x56d76c,_0xe2cf7e){var _0x136a39=require('../../components/encryptor');var _0x53eba6=![];var _0x379b7c={};if(_0x4d6335[_0x2e5d('0x31')][_0x2e5d('0x2d')]&&_0x4d6335[_0x2e5d('0x31')][_0x2e5d('0x2d')]===_0x2e5d('0x4d')){_0x379b7c['uniqueid']=_0x4d6335[_0x2e5d('0x45')]['id'];}else{_0x379b7c['id']=_0x4d6335[_0x2e5d('0x45')]['id'];}return db[_0x2e5d('0x2b')][_0x2e5d('0x48')]({'where':_0x379b7c,'attributes':['id',_0x2e5d('0x4e'),'filename'],'raw':!![]})[_0x2e5d('0x41')](handleEntityNotFound(_0x56d76c,null))[_0x2e5d('0x41')](function(_0x2710e5){if(_0x2710e5){var _0x37e341=_0x2710e5[_0x2e5d('0x4e')];var _0x3c5c39=util[_0x2e5d('0x4f')](_0x2e5d('0x50'),_0x37e341);if(fs[_0x2e5d('0x51')](_0x3c5c39)){_0x53eba6=!![];return _0x136a39[_0x2e5d('0x52')](_0x3c5c39,_0x37e341,config[_0x2e5d('0x53')]['recording'])['then'](function(){return _0x2710e5;});}return _0x2710e5;}})['then'](function(_0x3b2178){if(_0x3b2178){var _0x476997=_0x3b2178[_0x2e5d('0x4e')];if(!fs[_0x2e5d('0x51')](_0x476997)){throw new db[(_0x2e5d('0x54'))][(_0x2e5d('0x55'))]('SquareRecording\x20not\x20found');}if(_0x3b2178[_0x2e5d('0x56')]){return _0x56d76c[_0x2e5d('0x4c')](_0x476997,_0x3b2178[_0x2e5d('0x56')]+path[_0x2e5d('0x57')](_0x476997),function(){if(_0x53eba6){fs['unlink'](_0x476997);}});}else{return _0x56d76c[_0x2e5d('0x4c')](_0x476997,function(_0x41c5b7){if(_0x53eba6){fs[_0x2e5d('0x58')](_0x476997);}});}}})[_0x2e5d('0x49')](function(_0x51b407){if(_0x51b407[_0x2e5d('0x59')]===_0x2e5d('0x5a')){_0x56d76c['status'](0x194)['send']('Not\x20found');}else{return handleError(_0x56d76c,null);}});};exports['destroy']=function(_0x5821bd,_0x137c18){return db[_0x2e5d('0x2b')][_0x2e5d('0x48')]({'where':{'id':_0x5821bd[_0x2e5d('0x45')]['id']}})[_0x2e5d('0x41')](function(_0x8ac263){if(_['isNil'](_0x8ac263)){throw new ReferenceError(_0x2e5d('0x5b'));}return _0x8ac263;})[_0x2e5d('0x41')](function(_0x1361e7){var _0x1e4b4e=_0x1361e7['savePath'];logger[_0x2e5d('0x5c')](_0x2e5d('0x5d'),_0x1e4b4e);if(!_['isNil'](_0x1361e7[_0x2e5d('0x4e')])&&fs[_0x2e5d('0x51')](_0x1e4b4e)){logger['info'](_0x2e5d('0x5e')+_0x1e4b4e+_0x2e5d('0x5f'));fs['unlinkSync'](_0x1e4b4e);}_0x1e4b4e=_0x1e4b4e+_0x2e5d('0x60');if(!_['isNil'](_0x1361e7[_0x2e5d('0x4e')])&&fs[_0x2e5d('0x51')](_0x1e4b4e)){logger[_0x2e5d('0x5c')](_0x2e5d('0x5e')+_0x1e4b4e+_0x2e5d('0x5f'));fs[_0x2e5d('0x61')](_0x1e4b4e);}return _0x1361e7;})['then'](function(_0x2a58ae){if(!_0x2a58ae)throw new InternalError();return _0x2a58ae[_0x2e5d('0x62')]();})['then'](function(){_0x137c18[_0x2e5d('0x1f')](0xcc)[_0x2e5d('0x24')]();})[_0x2e5d('0x49')](handleError(_0x137c18,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index f6c914c..28bccd3 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 _0xe056=['../../config/environment','define','SquareRecording','../../config/logger','api','moment','request-promise','rimraf'];(function(_0xeb521c,_0x22fc37){var _0x8c61d4=function(_0x5101dd){while(--_0x5101dd){_0xeb521c['push'](_0xeb521c['shift']());}};_0x8c61d4(++_0x22fc37);}(_0xe056,0xdb));var _0x6e05=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xe056[_0x4b055c];return _0x4b62bb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6e05('0x0'))(_0x6e05('0x1'));var moment=require(_0x6e05('0x2'));var BPromise=require('bluebird');var rp=require(_0x6e05('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6e05('0x4'));var config=require(_0x6e05('0x5'));var attributes=require('./squareRecording.attributes');module['exports']=function(_0x51e5dd,_0x19837b){return _0x51e5dd[_0x6e05('0x6')](_0x6e05('0x7'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf277=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','square_recordings','lodash','util','api'];(function(_0x4af911,_0x598ea9){var _0x3369c3=function(_0x135abd){while(--_0x135abd){_0x4af911['push'](_0x4af911['shift']());}};_0x3369c3(++_0x598ea9);}(_0xf277,0x1e1));var _0x7f27=function(_0x2f94e9,_0x285ca2){_0x2f94e9=_0x2f94e9-0x0;var _0x1e9af3=_0xf277[_0x2f94e9];return _0x1e9af3;};'use strict';var _=require(_0x7f27('0x0'));var util=require(_0x7f27('0x1'));var logger=require('../../config/logger')(_0x7f27('0x2'));var moment=require('moment');var BPromise=require(_0x7f27('0x3'));var rp=require(_0x7f27('0x4'));var fs=require('fs');var path=require(_0x7f27('0x5'));var rimraf=require(_0x7f27('0x6'));var config=require(_0x7f27('0x7'));var attributes=require('./squareRecording.attributes');module[_0x7f27('0x8')]=function(_0x57b338,_0x40bcdf){return _0x57b338[_0x7f27('0x9')]('SquareRecording',attributes,{'tableName':_0x7f27('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 5921cf2..86a1bcd 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 _0xb383=['request','then','info','SquareRecording,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','CreateSquareRecording','create','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x1dc256,_0x3c239c){var _0x3f6cdd=function(_0x38086c){while(--_0x38086c){_0x1dc256['push'](_0x1dc256['shift']());}};_0x3f6cdd(++_0x3c239c);}(_0xb383,0x138));var _0x3b38=function(_0x507dae,_0x38f871){_0x507dae=_0x507dae-0x0;var _0x58bb9c=_0xb383[_0x507dae];return _0x58bb9c;};'use strict';var _=require(_0x3b38('0x0'));var util=require('util');var moment=require(_0x3b38('0x1'));var BPromise=require(_0x3b38('0x2'));var rs=require(_0x3b38('0x3'));var fs=require('fs');var Redis=require(_0x3b38('0x4'));var db=require(_0x3b38('0x5'))['db'];var utils=require(_0x3b38('0x6'));var logger=require(_0x3b38('0x7'))(_0x3b38('0x8'));var config=require(_0x3b38('0x9'));var jayson=require(_0x3b38('0xa'));var client=jayson['client'][_0x3b38('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5dda79,_0xd16814,_0x386a9a){return new BPromise(function(_0x18db54,_0x4d1fd5){return client[_0x3b38('0xc')](_0x5dda79,_0x386a9a)[_0x3b38('0xd')](function(_0x3489be){logger[_0x3b38('0xe')](_0x3b38('0xf'),_0xd16814,'request\x20sent');logger[_0x3b38('0x10')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0xd16814,_0x3b38('0x11'),JSON[_0x3b38('0x12')](_0x3489be));if(_0x3489be[_0x3b38('0x13')]){if(_0x3489be[_0x3b38('0x13')][_0x3b38('0x14')]===0x1f4){logger['error'](_0x3b38('0xf'),_0xd16814,_0x3489be[_0x3b38('0x13')][_0x3b38('0x15')]);return _0x4d1fd5(_0x3489be[_0x3b38('0x13')][_0x3b38('0x15')]);}logger['error'](_0x3b38('0xf'),_0xd16814,_0x3489be[_0x3b38('0x13')][_0x3b38('0x15')]);return _0x18db54(_0x3489be[_0x3b38('0x13')][_0x3b38('0x15')]);}else{logger[_0x3b38('0xe')](_0x3b38('0xf'),_0xd16814,'request\x20sent');_0x18db54(_0x3489be[_0x3b38('0x16')]['message']);}})['catch'](function(_0x1d54dc){logger[_0x3b38('0x13')](_0x3b38('0xf'),_0xd16814,_0x1d54dc);_0x4d1fd5(_0x1d54dc);});});}exports[_0x3b38('0x17')]=function(_0x50706b){var _0x4536de=this;return new Promise(function(_0x2d6200,_0x93a100){return db['SquareRecording'][_0x3b38('0x18')](_0x50706b['body'],{'raw':_0x50706b[_0x3b38('0x19')]?_0x50706b[_0x3b38('0x19')][_0x3b38('0x1a')]===undefined?!![]:![]:!![]})[_0x3b38('0xd')](function(_0x488620){logger[_0x3b38('0xe')]('CreateSquareRecording',_0x50706b);logger[_0x3b38('0x10')](_0x3b38('0x17'),_0x50706b,JSON['stringify'](_0x488620));_0x2d6200(_0x488620);})['catch'](function(_0x496af7){logger[_0x3b38('0x13')](_0x3b38('0x17'),_0x496af7[_0x3b38('0x15')],_0x50706b);_0x93a100(_0x4536de[_0x3b38('0x13')](0x1f4,_0x496af7[_0x3b38('0x15')]));});});}; \ No newline at end of file +var _0x0f58=['result','catch','create','body','options','raw','CreateSquareRecording','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x49e28f,_0x1b00d7){var _0x14f114=function(_0x29fd57){while(--_0x29fd57){_0x49e28f['push'](_0x49e28f['shift']());}};_0x14f114(++_0x1b00d7);}(_0x0f58,0x164));var _0x80f5=function(_0x31b5b2,_0x5ab927){_0x31b5b2=_0x31b5b2-0x0;var _0x364f13=_0x0f58[_0x31b5b2];return _0x364f13;};'use strict';var _=require(_0x80f5('0x0'));var util=require(_0x80f5('0x1'));var moment=require(_0x80f5('0x2'));var BPromise=require(_0x80f5('0x3'));var rs=require(_0x80f5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x80f5('0x5'))['db'];var utils=require(_0x80f5('0x6'));var logger=require(_0x80f5('0x7'))(_0x80f5('0x8'));var config=require(_0x80f5('0x9'));var jayson=require(_0x80f5('0xa'));var client=jayson[_0x80f5('0xb')][_0x80f5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2bec6d,_0x5a8aaf,_0x1e981f){return new BPromise(function(_0x5b232a,_0x412483){return client['request'](_0x2bec6d,_0x1e981f)[_0x80f5('0xd')](function(_0x124f61){logger[_0x80f5('0xe')](_0x80f5('0xf'),_0x5a8aaf,_0x80f5('0x10'));logger['debug'](_0x80f5('0x11'),_0x5a8aaf,'request\x20sent',JSON[_0x80f5('0x12')](_0x124f61));if(_0x124f61[_0x80f5('0x13')]){if(_0x124f61[_0x80f5('0x13')]['code']===0x1f4){logger['error']('SquareRecording,\x20%s,\x20%s',_0x5a8aaf,_0x124f61[_0x80f5('0x13')][_0x80f5('0x14')]);return _0x412483(_0x124f61[_0x80f5('0x13')]['message']);}logger[_0x80f5('0x13')]('SquareRecording,\x20%s,\x20%s',_0x5a8aaf,_0x124f61[_0x80f5('0x13')][_0x80f5('0x14')]);return _0x5b232a(_0x124f61[_0x80f5('0x13')][_0x80f5('0x14')]);}else{logger[_0x80f5('0xe')](_0x80f5('0xf'),_0x5a8aaf,_0x80f5('0x10'));_0x5b232a(_0x124f61[_0x80f5('0x15')][_0x80f5('0x14')]);}})[_0x80f5('0x16')](function(_0x2df7e8){logger[_0x80f5('0x13')](_0x80f5('0xf'),_0x5a8aaf,_0x2df7e8);_0x412483(_0x2df7e8);});});}exports['CreateSquareRecording']=function(_0x551a89){var _0x306e10=this;return new Promise(function(_0x2a23aa,_0x22a65d){return db['SquareRecording'][_0x80f5('0x17')](_0x551a89[_0x80f5('0x18')],{'raw':_0x551a89[_0x80f5('0x19')]?_0x551a89[_0x80f5('0x19')][_0x80f5('0x1a')]===undefined?!![]:![]:!![]})[_0x80f5('0xd')](function(_0x3df93d){logger[_0x80f5('0xe')](_0x80f5('0x1b'),_0x551a89);logger[_0x80f5('0x1c')](_0x80f5('0x1b'),_0x551a89,JSON[_0x80f5('0x12')](_0x3df93d));_0x2a23aa(_0x3df93d);})['catch'](function(_0xcdcbeb){logger['error']('CreateSquareRecording',_0xcdcbeb[_0x80f5('0x14')],_0x551a89);_0x22a65d(_0x306e10[_0x80f5('0x13')](0x1f4,_0xcdcbeb[_0x80f5('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 62138a6..a6e8fa2 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 _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x13cb73,_0x13054d){var _0x4ab0ff=function(_0x19bdef){while(--_0x19bdef){_0x13cb73['push'](_0x13cb73['shift']());}};_0x4ab0ff(++_0x13054d);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file +var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x5aed69,_0x259b5e){var _0x48b0f9=function(_0x31e169){while(--_0x31e169){_0x5aed69['push'](_0x5aed69['shift']());}};_0x48b0f9(++_0x259b5e);}(_0xe706,0xa3));var _0x6e70=function(_0x3110ab,_0x5b6a7a){_0x3110ab=_0x3110ab-0x0;var _0x24c310=_0xe706[_0x3110ab];return _0x24c310;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index c4f2f44..5722952 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 _0xb457=['exports','STRING','DATE','BOOLEAN','sequelize'];(function(_0x424cfd,_0x40b1d3){var _0x16975b=function(_0x54971a){while(--_0x54971a){_0x424cfd['push'](_0x424cfd['shift']());}};_0x16975b(++_0x40b1d3);}(_0xb457,0xf9));var _0x7b45=function(_0x5cb97e,_0x132a39){_0x5cb97e=_0x5cb97e-0x0;var _0x1714b4=_0xb457[_0x5cb97e];return _0x1714b4;};'use strict';var Sequelize=require(_0x7b45('0x0'));module[_0x7b45('0x1')]={'network':{'type':Sequelize[_0x7b45('0x2')]},'network_script':{'type':Sequelize[_0x7b45('0x2')]},'request':{'type':Sequelize[_0x7b45('0x2')]},'channel':{'type':Sequelize[_0x7b45('0x2')]},'language':{'type':Sequelize[_0x7b45('0x2')]},'type':{'type':Sequelize[_0x7b45('0x2')]},'uniqueid':{'type':Sequelize[_0x7b45('0x2')]},'version':{'type':Sequelize[_0x7b45('0x2')]},'callerid':{'type':Sequelize[_0x7b45('0x2')]},'calleridname':{'type':Sequelize[_0x7b45('0x2')]},'callingpres':{'type':Sequelize[_0x7b45('0x2')]},'callingani2':{'type':Sequelize[_0x7b45('0x2')]},'callington':{'type':Sequelize[_0x7b45('0x2')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x7b45('0x2')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x7b45('0x2')]},'extension':{'type':Sequelize[_0x7b45('0x2')]},'priority':{'type':Sequelize[_0x7b45('0x2')]},'enhanced':{'type':Sequelize[_0x7b45('0x2')]},'accountcode':{'type':Sequelize[_0x7b45('0x2')]},'threadid':{'type':Sequelize[_0x7b45('0x2')]},'project_name':{'type':Sequelize[_0x7b45('0x2')]},'joinAt':{'type':Sequelize[_0x7b45('0x3')]},'leaveAt':{'type':Sequelize[_0x7b45('0x3')]},'bot':{'type':Sequelize[_0x7b45('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xa867=['DATE','STRING'];(function(_0x5a947d,_0x1d7090){var _0x4f4305=function(_0x40cd28){while(--_0x40cd28){_0x5a947d['push'](_0x5a947d['shift']());}};_0x4f4305(++_0x1d7090);}(_0xa867,0xd9));var _0x7a86=function(_0x1cddce,_0x1c9287){_0x1cddce=_0x1cddce-0x0;var _0x245b0a=_0xa867[_0x1cddce];return _0x245b0a;};'use strict';var Sequelize=require('sequelize');module['exports']={'network':{'type':Sequelize[_0x7a86('0x0')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x7a86('0x0')]},'channel':{'type':Sequelize[_0x7a86('0x0')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x7a86('0x0')]},'uniqueid':{'type':Sequelize[_0x7a86('0x0')]},'version':{'type':Sequelize[_0x7a86('0x0')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x7a86('0x0')]},'callingpres':{'type':Sequelize[_0x7a86('0x0')]},'callingani2':{'type':Sequelize[_0x7a86('0x0')]},'callington':{'type':Sequelize[_0x7a86('0x0')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x7a86('0x0')]},'rdnis':{'type':Sequelize[_0x7a86('0x0')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x7a86('0x0')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x7a86('0x0')]},'accountcode':{'type':Sequelize[_0x7a86('0x0')]},'threadid':{'type':Sequelize[_0x7a86('0x0')]},'project_name':{'type':Sequelize[_0x7a86('0x0')]},'joinAt':{'type':Sequelize[_0x7a86('0x1')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 53878b9..7bbef69 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 _0x976a=['name','send','map','SquareReport','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','update','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','then','error','stack'];(function(_0x2d16fd,_0x3a3936){var _0x466170=function(_0x367ff8){while(--_0x367ff8){_0x2d16fd['push'](_0x2d16fd['shift']());}};_0x466170(++_0x3a3936);}(_0x976a,0x119));var _0xa976=function(_0x1e2c73,_0x12cd55){_0x1e2c73=_0x1e2c73-0x0;var _0x46f8d5=_0x976a[_0x1e2c73];return _0x46f8d5;};'use strict';var emlformat=require(_0xa976('0x0'));var rimraf=require(_0xa976('0x1'));var zipdir=require(_0xa976('0x2'));var jsonpatch=require(_0xa976('0x3'));var rp=require(_0xa976('0x4'));var moment=require(_0xa976('0x5'));var BPromise=require(_0xa976('0x6'));var Mustache=require(_0xa976('0x7'));var util=require(_0xa976('0x8'));var path=require(_0xa976('0x9'));var sox=require(_0xa976('0xa'));var csv=require(_0xa976('0xb'));var ejs=require(_0xa976('0xc'));var fs=require('fs');var fs_extra=require(_0xa976('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa976('0xe'));var deskjs=require(_0xa976('0xf'));var toCsv=require(_0xa976('0xb'));var querystring=require(_0xa976('0x10'));var Papa=require('papaparse');var Redis=require(_0xa976('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa976('0x12'));var as=require(_0xa976('0x13'));var hardwareService=require(_0xa976('0x14'));var logger=require(_0xa976('0x15'))(_0xa976('0x16'));var utils=require(_0xa976('0x17'));var config=require(_0xa976('0x18'));var licenseUtil=require(_0xa976('0x19'));var db=require(_0xa976('0x1a'))['db'];function respondWithStatusCode(_0x384ef8,_0x5ceb4f){_0x5ceb4f=_0x5ceb4f||0xcc;return function(_0x36d0e4){if(_0x36d0e4){return _0x384ef8[_0xa976('0x1b')](_0x5ceb4f);}return _0x384ef8[_0xa976('0x1c')](_0x5ceb4f)[_0xa976('0x1d')]();};}function respondWithResult(_0x16e2c8,_0x12464a){_0x12464a=_0x12464a||0xc8;return function(_0x3669a5){if(_0x3669a5){return _0x16e2c8[_0xa976('0x1c')](_0x12464a)[_0xa976('0x1e')](_0x3669a5);}};}function respondWithFilteredResult(_0x45fb31,_0x2c9495){return function(_0x4ef733){if(_0x4ef733){var _0x42a5ef=typeof _0x2c9495['offset']==='undefined'&&typeof _0x2c9495['limit']===_0xa976('0x1f');var _0x215ba6=_0x4ef733[_0xa976('0x20')];var _0x1cc01b=_0x42a5ef?0x0:_0x2c9495[_0xa976('0x21')];var _0x3a7c26=_0x42a5ef?_0x4ef733[_0xa976('0x20')]:_0x2c9495[_0xa976('0x21')]+_0x2c9495[_0xa976('0x22')];var _0x49696f;if(_0x3a7c26>=_0x215ba6){_0x3a7c26=_0x215ba6;_0x49696f=0xc8;}else{_0x49696f=0xce;}_0x45fb31[_0xa976('0x1c')](_0x49696f);return _0x45fb31[_0xa976('0x23')](_0xa976('0x24'),_0x1cc01b+'-'+_0x3a7c26+'/'+_0x215ba6)['json'](_0x4ef733);}return null;};}function patchUpdates(_0x11e50a){return function(_0x1bfa77){try{jsonpatch[_0xa976('0x25')](_0x1bfa77,_0x11e50a,!![]);}catch(_0x5615c3){return BPromise[_0xa976('0x26')](_0x5615c3);}return _0x1bfa77[_0xa976('0x27')]();};}function saveUpdates(_0x465277,_0x22c946){return function(_0x11c2f0){if(_0x11c2f0){return _0x11c2f0['update'](_0x465277)[_0xa976('0x28')](function(_0x156476){return _0x156476;});}return null;};}function removeEntity(_0x3b6aff,_0xf08e5e){return function(_0x235b29){if(_0x235b29){return _0x235b29['destroy']()[_0xa976('0x28')](function(){_0x3b6aff[_0xa976('0x1c')](0xcc)[_0xa976('0x1d')]();});}};}function handleEntityNotFound(_0x14ae6e,_0x1f60de){return function(_0x5e9ef8){if(!_0x5e9ef8){_0x14ae6e[_0xa976('0x1b')](0x194);}return _0x5e9ef8;};}function handleError(_0x25d286,_0xb84042){_0xb84042=_0xb84042||0x1f4;return function(_0x4c23b8){logger[_0xa976('0x29')](_0x4c23b8[_0xa976('0x2a')]);if(_0x4c23b8[_0xa976('0x2b')]){delete _0x4c23b8[_0xa976('0x2b')];}_0x25d286[_0xa976('0x1c')](_0xb84042)[_0xa976('0x2c')](_0x4c23b8);};}exports['index']=function(_0x53d767,_0x39eb04){var _0xfb6b5f={},_0x5507d1={},_0x1422c8={'count':0x0,'rows':[]};var _0x4e913f=_[_0xa976('0x2d')](db[_0xa976('0x2e')]['rawAttributes'],function(_0x2fa57e){return{'name':_0x2fa57e['fieldName'],'type':_0x2fa57e[_0xa976('0x2f')][_0xa976('0x30')]};});_0x5507d1['model']=_[_0xa976('0x2d')](_0x4e913f,'name');_0x5507d1[_0xa976('0x31')]=_[_0xa976('0x32')](_0x53d767[_0xa976('0x31')]);_0x5507d1[_0xa976('0x33')]=_[_0xa976('0x34')](_0x5507d1[_0xa976('0x35')],_0x5507d1[_0xa976('0x31')]);_0xfb6b5f[_0xa976('0x36')]=_[_0xa976('0x34')](_0x5507d1[_0xa976('0x35')],qs[_0xa976('0x37')](_0x53d767[_0xa976('0x31')][_0xa976('0x37')]));_0xfb6b5f[_0xa976('0x36')]=_0xfb6b5f[_0xa976('0x36')][_0xa976('0x38')]?_0xfb6b5f['attributes']:_0x5507d1[_0xa976('0x35')];if(!_0x53d767[_0xa976('0x31')][_0xa976('0x39')](_0xa976('0x3a'))){_0xfb6b5f[_0xa976('0x22')]=qs[_0xa976('0x22')](_0x53d767[_0xa976('0x31')][_0xa976('0x22')]);_0xfb6b5f['offset']=qs[_0xa976('0x21')](_0x53d767[_0xa976('0x31')][_0xa976('0x21')]);}_0xfb6b5f[_0xa976('0x3b')]=qs['sort'](_0x53d767[_0xa976('0x31')][_0xa976('0x3c')]);_0xfb6b5f[_0xa976('0x3d')]=qs[_0xa976('0x33')](_[_0xa976('0x3e')](_0x53d767[_0xa976('0x31')],_0x5507d1[_0xa976('0x33')]),_0x4e913f);if(_0x53d767[_0xa976('0x31')][_0xa976('0x3f')]){_0xfb6b5f['where']=_[_0xa976('0x40')](_0xfb6b5f[_0xa976('0x3d')],{'$or':_['map'](_0x4e913f,function(_0x36ad82){if(_0x36ad82[_0xa976('0x2f')]!==_0xa976('0x41')){var _0x487e32={};_0x487e32[_0x36ad82[_0xa976('0x2b')]]={'$like':'%'+_0x53d767[_0xa976('0x31')][_0xa976('0x3f')]+'%'};return _0x487e32;}})});}_0xfb6b5f=_['merge']({},_0xfb6b5f,_0x53d767[_0xa976('0x42')]);var _0x57e886={'where':_0xfb6b5f[_0xa976('0x3d')]};return db[_0xa976('0x2e')][_0xa976('0x20')](_0x57e886)[_0xa976('0x28')](function(_0x4a26dc){_0x1422c8[_0xa976('0x20')]=_0x4a26dc;if(_0x53d767['query']['includeAll']){_0xfb6b5f[_0xa976('0x43')]=[{'all':!![]}];}return db[_0xa976('0x2e')][_0xa976('0x44')](_0xfb6b5f);})[_0xa976('0x28')](function(_0x3c5dde){_0x1422c8[_0xa976('0x45')]=_0x3c5dde;return _0x1422c8;})[_0xa976('0x28')](respondWithFilteredResult(_0x39eb04,_0xfb6b5f))[_0xa976('0x46')](handleError(_0x39eb04,null));};exports[_0xa976('0x47')]=function(_0x3188c5,_0x2a2029){var _0x2ea197={'raw':!![],'where':{'id':_0x3188c5[_0xa976('0x48')]['id']}},_0x2489b0={};_0x2489b0[_0xa976('0x35')]=_[_0xa976('0x32')](db[_0xa976('0x2e')][_0xa976('0x49')]);_0x2489b0[_0xa976('0x31')]=_[_0xa976('0x32')](_0x3188c5[_0xa976('0x31')]);_0x2489b0[_0xa976('0x33')]=_[_0xa976('0x34')](_0x2489b0['model'],_0x2489b0['query']);_0x2ea197['attributes']=_[_0xa976('0x34')](_0x2489b0[_0xa976('0x35')],qs['fields'](_0x3188c5['query']['fields']));_0x2ea197[_0xa976('0x36')]=_0x2ea197[_0xa976('0x36')][_0xa976('0x38')]?_0x2ea197[_0xa976('0x36')]:_0x2489b0[_0xa976('0x35')];if(_0x3188c5[_0xa976('0x31')][_0xa976('0x4a')]){_0x2ea197['include']=[{'all':!![]}];}_0x2ea197=_['merge']({},_0x2ea197,_0x3188c5[_0xa976('0x42')]);return db[_0xa976('0x2e')][_0xa976('0x4b')](_0x2ea197)[_0xa976('0x28')](handleEntityNotFound(_0x2a2029,null))['then'](respondWithResult(_0x2a2029,null))[_0xa976('0x46')](handleError(_0x2a2029,null));};exports[_0xa976('0x4c')]=function(_0x9011c5,_0x58e773){return db[_0xa976('0x2e')]['create'](_0x9011c5[_0xa976('0x4d')],{})[_0xa976('0x28')](respondWithResult(_0x58e773,0xc9))[_0xa976('0x46')](handleError(_0x58e773,null));};exports[_0xa976('0x4e')]=function(_0x3acbca,_0x48dec5){if(_0x3acbca[_0xa976('0x4d')]['id']){delete _0x3acbca[_0xa976('0x4d')]['id'];}return db[_0xa976('0x2e')][_0xa976('0x4b')]({'where':{'id':_0x3acbca[_0xa976('0x48')]['id']}})[_0xa976('0x28')](handleEntityNotFound(_0x48dec5,null))[_0xa976('0x28')](saveUpdates(_0x3acbca['body'],null))[_0xa976('0x28')](respondWithResult(_0x48dec5,null))[_0xa976('0x46')](handleError(_0x48dec5,null));};exports[_0xa976('0x4f')]=function(_0x13f410,_0x42598e){return db[_0xa976('0x2e')][_0xa976('0x4b')]({'where':{'id':_0x13f410[_0xa976('0x48')]['id']}})[_0xa976('0x28')](handleEntityNotFound(_0x42598e,null))[_0xa976('0x28')](removeEntity(_0x42598e,null))[_0xa976('0x46')](handleError(_0x42598e,null));};exports[_0xa976('0x50')]=function(_0x16b7e2,_0x1d7eeb){return db['SquareReport']['describe']()[_0xa976('0x28')](respondWithResult(_0x1d7eeb,null))[_0xa976('0x46')](handleError(_0x1d7eeb,null));}; \ No newline at end of file +var _0x799d=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','end','error','stack','name','send','index','map','SquareReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','create','body','destroy','describe','zip-dir','fast-json-patch','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x15b829,_0x451b78){var _0x3cd3c3=function(_0x38e2f1){while(--_0x38e2f1){_0x15b829['push'](_0x15b829['shift']());}};_0x3cd3c3(++_0x451b78);}(_0x799d,0xd2));var _0xd799=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x799d[_0x126558];return _0x1f6d14;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd799('0x0'));var jsonpatch=require(_0xd799('0x1'));var rp=require('request-promise');var moment=require(_0xd799('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xd799('0x3'));var sox=require(_0xd799('0x4'));var csv=require(_0xd799('0x5'));var ejs=require(_0xd799('0x6'));var fs=require('fs');var fs_extra=require(_0xd799('0x7'));var _=require(_0xd799('0x8'));var squel=require(_0xd799('0x9'));var crypto=require(_0xd799('0xa'));var jsforce=require(_0xd799('0xb'));var deskjs=require(_0xd799('0xc'));var toCsv=require(_0xd799('0x5'));var querystring=require(_0xd799('0xd'));var Papa=require(_0xd799('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd799('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd799('0x10'));var logger=require(_0xd799('0x11'))('api');var utils=require(_0xd799('0x12'));var config=require(_0xd799('0x13'));var licenseUtil=require(_0xd799('0x14'));var db=require(_0xd799('0x15'))['db'];function respondWithStatusCode(_0x290523,_0x4f0392){_0x4f0392=_0x4f0392||0xcc;return function(_0x3caedb){if(_0x3caedb){return _0x290523[_0xd799('0x16')](_0x4f0392);}return _0x290523[_0xd799('0x17')](_0x4f0392)['end']();};}function respondWithResult(_0x19e1da,_0x2257fb){_0x2257fb=_0x2257fb||0xc8;return function(_0x207f46){if(_0x207f46){return _0x19e1da['status'](_0x2257fb)[_0xd799('0x18')](_0x207f46);}};}function respondWithFilteredResult(_0x3440f6,_0x20ffae){return function(_0xd58afc){if(_0xd58afc){var _0x19524e=typeof _0x20ffae[_0xd799('0x19')]===_0xd799('0x1a')&&typeof _0x20ffae['limit']==='undefined';var _0x21a281=_0xd58afc[_0xd799('0x1b')];var _0x245963=_0x19524e?0x0:_0x20ffae[_0xd799('0x19')];var _0x3591a5=_0x19524e?_0xd58afc[_0xd799('0x1b')]:_0x20ffae['offset']+_0x20ffae['limit'];var _0x14119c;if(_0x3591a5>=_0x21a281){_0x3591a5=_0x21a281;_0x14119c=0xc8;}else{_0x14119c=0xce;}_0x3440f6[_0xd799('0x17')](_0x14119c);return _0x3440f6[_0xd799('0x1c')](_0xd799('0x1d'),_0x245963+'-'+_0x3591a5+'/'+_0x21a281)['json'](_0xd58afc);}return null;};}function patchUpdates(_0x714cf1){return function(_0x3e1771){try{jsonpatch[_0xd799('0x1e')](_0x3e1771,_0x714cf1,!![]);}catch(_0x4a1fd3){return BPromise[_0xd799('0x1f')](_0x4a1fd3);}return _0x3e1771['save']();};}function saveUpdates(_0x48d6db,_0x22659e){return function(_0x4c1d94){if(_0x4c1d94){return _0x4c1d94[_0xd799('0x20')](_0x48d6db)[_0xd799('0x21')](function(_0x302176){return _0x302176;});}return null;};}function removeEntity(_0x2fb1c7,_0x3d4a1e){return function(_0x26bf5d){if(_0x26bf5d){return _0x26bf5d['destroy']()['then'](function(){_0x2fb1c7[_0xd799('0x17')](0xcc)[_0xd799('0x22')]();});}};}function handleEntityNotFound(_0xa070cd,_0x2f9b78){return function(_0x3834c2){if(!_0x3834c2){_0xa070cd[_0xd799('0x16')](0x194);}return _0x3834c2;};}function handleError(_0x34c75a,_0x4c593b){_0x4c593b=_0x4c593b||0x1f4;return function(_0x5acd39){logger[_0xd799('0x23')](_0x5acd39[_0xd799('0x24')]);if(_0x5acd39[_0xd799('0x25')]){delete _0x5acd39[_0xd799('0x25')];}_0x34c75a['status'](_0x4c593b)[_0xd799('0x26')](_0x5acd39);};}exports[_0xd799('0x27')]=function(_0x54937c,_0x2a4a36){var _0x1941ae={},_0x41dca1={},_0x3a515c={'count':0x0,'rows':[]};var _0x46eaf1=_[_0xd799('0x28')](db[_0xd799('0x29')][_0xd799('0x2a')],function(_0x474b70){return{'name':_0x474b70[_0xd799('0x2b')],'type':_0x474b70[_0xd799('0x2c')][_0xd799('0x2d')]};});_0x41dca1[_0xd799('0x2e')]=_[_0xd799('0x28')](_0x46eaf1,_0xd799('0x25'));_0x41dca1[_0xd799('0x2f')]=_[_0xd799('0x30')](_0x54937c[_0xd799('0x2f')]);_0x41dca1[_0xd799('0x31')]=_['intersection'](_0x41dca1[_0xd799('0x2e')],_0x41dca1[_0xd799('0x2f')]);_0x1941ae['attributes']=_[_0xd799('0x32')](_0x41dca1[_0xd799('0x2e')],qs[_0xd799('0x33')](_0x54937c[_0xd799('0x2f')][_0xd799('0x33')]));_0x1941ae['attributes']=_0x1941ae[_0xd799('0x34')][_0xd799('0x35')]?_0x1941ae[_0xd799('0x34')]:_0x41dca1[_0xd799('0x2e')];if(!_0x54937c['query'][_0xd799('0x36')](_0xd799('0x37'))){_0x1941ae[_0xd799('0x38')]=qs[_0xd799('0x38')](_0x54937c['query'][_0xd799('0x38')]);_0x1941ae[_0xd799('0x19')]=qs['offset'](_0x54937c[_0xd799('0x2f')]['offset']);}_0x1941ae['order']=qs[_0xd799('0x39')](_0x54937c[_0xd799('0x2f')][_0xd799('0x39')]);_0x1941ae[_0xd799('0x3a')]=qs[_0xd799('0x31')](_[_0xd799('0x3b')](_0x54937c[_0xd799('0x2f')],_0x41dca1['filters']),_0x46eaf1);if(_0x54937c[_0xd799('0x2f')][_0xd799('0x3c')]){_0x1941ae[_0xd799('0x3a')]=_[_0xd799('0x3d')](_0x1941ae['where'],{'$or':_[_0xd799('0x28')](_0x46eaf1,function(_0x3d4534){if(_0x3d4534[_0xd799('0x2c')]!==_0xd799('0x3e')){var _0x15d6fe={};_0x15d6fe[_0x3d4534['name']]={'$like':'%'+_0x54937c[_0xd799('0x2f')][_0xd799('0x3c')]+'%'};return _0x15d6fe;}})});}_0x1941ae=_[_0xd799('0x3d')]({},_0x1941ae,_0x54937c[_0xd799('0x3f')]);var _0x4e6770={'where':_0x1941ae['where']};return db['SquareReport'][_0xd799('0x1b')](_0x4e6770)[_0xd799('0x21')](function(_0x2e459e){_0x3a515c[_0xd799('0x1b')]=_0x2e459e;if(_0x54937c['query'][_0xd799('0x40')]){_0x1941ae[_0xd799('0x41')]=[{'all':!![]}];}return db['SquareReport'][_0xd799('0x42')](_0x1941ae);})[_0xd799('0x21')](function(_0x16777d){_0x3a515c[_0xd799('0x43')]=_0x16777d;return _0x3a515c;})[_0xd799('0x21')](respondWithFilteredResult(_0x2a4a36,_0x1941ae))['catch'](handleError(_0x2a4a36,null));};exports['show']=function(_0x593e10,_0x21a7d1){var _0x4f35bd={'raw':!![],'where':{'id':_0x593e10[_0xd799('0x44')]['id']}},_0x5086b0={};_0x5086b0[_0xd799('0x2e')]=_[_0xd799('0x30')](db['SquareReport'][_0xd799('0x2a')]);_0x5086b0['query']=_[_0xd799('0x30')](_0x593e10[_0xd799('0x2f')]);_0x5086b0[_0xd799('0x31')]=_[_0xd799('0x32')](_0x5086b0[_0xd799('0x2e')],_0x5086b0[_0xd799('0x2f')]);_0x4f35bd[_0xd799('0x34')]=_[_0xd799('0x32')](_0x5086b0[_0xd799('0x2e')],qs['fields'](_0x593e10['query'][_0xd799('0x33')]));_0x4f35bd[_0xd799('0x34')]=_0x4f35bd[_0xd799('0x34')][_0xd799('0x35')]?_0x4f35bd[_0xd799('0x34')]:_0x5086b0[_0xd799('0x2e')];if(_0x593e10[_0xd799('0x2f')]['includeAll']){_0x4f35bd[_0xd799('0x41')]=[{'all':!![]}];}_0x4f35bd=_[_0xd799('0x3d')]({},_0x4f35bd,_0x593e10['options']);return db['SquareReport'][_0xd799('0x45')](_0x4f35bd)[_0xd799('0x21')](handleEntityNotFound(_0x21a7d1,null))[_0xd799('0x21')](respondWithResult(_0x21a7d1,null))[_0xd799('0x46')](handleError(_0x21a7d1,null));};exports[_0xd799('0x47')]=function(_0x5df27a,_0x3de092){return db[_0xd799('0x29')][_0xd799('0x47')](_0x5df27a[_0xd799('0x48')],{})[_0xd799('0x21')](respondWithResult(_0x3de092,0xc9))['catch'](handleError(_0x3de092,null));};exports['update']=function(_0x3f27b0,_0x59606f){if(_0x3f27b0[_0xd799('0x48')]['id']){delete _0x3f27b0[_0xd799('0x48')]['id'];}return db[_0xd799('0x29')]['find']({'where':{'id':_0x3f27b0[_0xd799('0x44')]['id']}})['then'](handleEntityNotFound(_0x59606f,null))['then'](saveUpdates(_0x3f27b0['body'],null))[_0xd799('0x21')](respondWithResult(_0x59606f,null))[_0xd799('0x46')](handleError(_0x59606f,null));};exports[_0xd799('0x49')]=function(_0x33bfb6,_0x3b7369){return db[_0xd799('0x29')][_0xd799('0x45')]({'where':{'id':_0x33bfb6['params']['id']}})[_0xd799('0x21')](handleEntityNotFound(_0x3b7369,null))['then'](removeEntity(_0x3b7369,null))[_0xd799('0x46')](handleError(_0x3b7369,null));};exports[_0xd799('0x4a')]=function(_0x1ce57d,_0x18ff33){return db[_0xd799('0x29')][_0xd799('0x4a')]()['then'](respondWithResult(_0x18ff33,null))[_0xd799('0x46')](handleError(_0x18ff33,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index c68aaea..a01fa5c 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 _0x604d=['report_square','uid_pname','uniqueid','leaveAt','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./squareReport.attributes','define','SquareReport'];(function(_0x55933f,_0x468536){var _0x18f69b=function(_0x3eaf61){while(--_0x3eaf61){_0x55933f['push'](_0x55933f['shift']());}};_0x18f69b(++_0x468536);}(_0x604d,0x1e4));var _0xd604=function(_0x13270e,_0x38de35){_0x13270e=_0x13270e-0x0;var _0x3e20c7=_0x604d[_0x13270e];return _0x3e20c7;};'use strict';var _=require('lodash');var util=require(_0xd604('0x0'));var logger=require(_0xd604('0x1'))(_0xd604('0x2'));var moment=require(_0xd604('0x3'));var BPromise=require(_0xd604('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd604('0x5'));var rimraf=require(_0xd604('0x6'));var config=require(_0xd604('0x7'));var attributes=require(_0xd604('0x8'));module['exports']=function(_0x3f2c18,_0x3729e6){return _0x3f2c18[_0xd604('0x9')](_0xd604('0xa'),attributes,{'tableName':_0xd604('0xb'),'paranoid':![],'indexes':[{'name':_0xd604('0xc'),'fields':[_0xd604('0xd'),'project_name']},{'name':'leaveAt','fields':[_0xd604('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9735=['uid_pname','project_name','leaveAt','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SquareReport','report_square'];(function(_0x1c7137,_0x4c7c26){var _0xeb4432=function(_0x26d850){while(--_0x26d850){_0x1c7137['push'](_0x1c7137['shift']());}};_0xeb4432(++_0x4c7c26);}(_0x9735,0x1e3));var _0x5973=function(_0x14c5aa,_0x145fb6){_0x14c5aa=_0x14c5aa-0x0;var _0x4281f7=_0x9735[_0x14c5aa];return _0x4281f7;};'use strict';var _=require(_0x5973('0x0'));var util=require(_0x5973('0x1'));var logger=require('../../config/logger')(_0x5973('0x2'));var moment=require(_0x5973('0x3'));var BPromise=require(_0x5973('0x4'));var rp=require(_0x5973('0x5'));var fs=require('fs');var path=require(_0x5973('0x6'));var rimraf=require(_0x5973('0x7'));var config=require(_0x5973('0x8'));var attributes=require('./squareReport.attributes');module[_0x5973('0x9')]=function(_0x4476a5,_0x3e58dd){return _0x4476a5[_0x5973('0xa')](_0x5973('0xb'),attributes,{'tableName':_0x5973('0xc'),'paranoid':![],'indexes':[{'name':_0x5973('0xd'),'fields':['uniqueid',_0x5973('0xe')]},{'name':'leaveAt','fields':[_0x5973('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index b26c9ca..23f8338 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 _0x411d=['http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateSquareReport','create','body','options','raw','stringify','UpdateSquareReport','SquareReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','jayson/promise','client'];(function(_0x436854,_0x4e191d){var _0xccb95d=function(_0x39593e){while(--_0x39593e){_0x436854['push'](_0x436854['shift']());}};_0xccb95d(++_0x4e191d);}(_0x411d,0x9c));var _0xd411=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x411d[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xd411('0x0'));var util=require(_0xd411('0x1'));var moment=require(_0xd411('0x2'));var BPromise=require(_0xd411('0x3'));var rs=require(_0xd411('0x4'));var fs=require('fs');var Redis=require(_0xd411('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd411('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xd411('0x7'));var client=jayson[_0xd411('0x8')][_0xd411('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x452b66,_0x5c8a72,_0x455107){return new BPromise(function(_0x4a772b,_0x517de8){return client[_0xd411('0xa')](_0x452b66,_0x455107)[_0xd411('0xb')](function(_0x405d21){logger[_0xd411('0xc')](_0xd411('0xd'),_0x5c8a72,_0xd411('0xe'));logger[_0xd411('0xf')](_0xd411('0x10'),_0x5c8a72,'request\x20sent',JSON['stringify'](_0x405d21));if(_0x405d21[_0xd411('0x11')]){if(_0x405d21['error'][_0xd411('0x12')]===0x1f4){logger[_0xd411('0x11')](_0xd411('0xd'),_0x5c8a72,_0x405d21[_0xd411('0x11')]['message']);return _0x517de8(_0x405d21[_0xd411('0x11')][_0xd411('0x13')]);}logger[_0xd411('0x11')](_0xd411('0xd'),_0x5c8a72,_0x405d21['error']['message']);return _0x4a772b(_0x405d21[_0xd411('0x11')][_0xd411('0x13')]);}else{logger[_0xd411('0xc')](_0xd411('0xd'),_0x5c8a72,_0xd411('0xe'));_0x4a772b(_0x405d21['result'][_0xd411('0x13')]);}})[_0xd411('0x14')](function(_0x5556d5){logger['error'](_0xd411('0xd'),_0x5c8a72,_0x5556d5);_0x517de8(_0x5556d5);});});}exports[_0xd411('0x15')]=function(_0x3c79c1){var _0x1553f8=this;return new Promise(function(_0x4096c1,_0x36de16){return db['SquareReport'][_0xd411('0x16')](_0x3c79c1[_0xd411('0x17')],{'raw':_0x3c79c1[_0xd411('0x18')]?_0x3c79c1[_0xd411('0x18')][_0xd411('0x19')]===undefined?!![]:![]:!![]})[_0xd411('0xb')](function(_0x1ccf4c){logger[_0xd411('0xc')](_0xd411('0x15'),_0x3c79c1);logger[_0xd411('0xf')](_0xd411('0x15'),_0x3c79c1,JSON[_0xd411('0x1a')](_0x1ccf4c));_0x4096c1(_0x1ccf4c);})[_0xd411('0x14')](function(_0x314a1c){logger['error'](_0xd411('0x15'),_0x314a1c[_0xd411('0x13')],_0x3c79c1);_0x36de16(_0x1553f8['error'](0x1f4,_0x314a1c['message']));});});};exports[_0xd411('0x1b')]=function(_0x422923){var _0x403d2b=this;return new Promise(function(_0x264868,_0x3fcf9b){return db[_0xd411('0x1c')][_0xd411('0x1d')](_0x422923['body'],{'raw':_0x422923[_0xd411('0x18')]?_0x422923[_0xd411('0x18')][_0xd411('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x422923[_0xd411('0x18')]?_0x422923[_0xd411('0x18')][_0xd411('0x1e')]||null:null,'attributes':_0x422923[_0xd411('0x18')]?_0x422923[_0xd411('0x18')][_0xd411('0x1f')]||null:null,'limit':_0x422923[_0xd411('0x18')]?_0x422923['options'][_0xd411('0x20')]||null:null})['then'](function(_0x476d07){logger[_0xd411('0xc')](_0xd411('0x1b'),_0x422923);logger[_0xd411('0xf')](_0xd411('0x1b'),_0x422923,JSON['stringify'](_0x476d07));_0x264868(_0x476d07);})['catch'](function(_0x21da35){logger[_0xd411('0x11')](_0xd411('0x1b'),_0x21da35[_0xd411('0x13')],_0x422923);_0x3fcf9b(_0x403d2b[_0xd411('0x11')](0x1f4,_0x21da35['message']));});});}; \ No newline at end of file +var _0x1684=['request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SquareReport','body','options','raw','CreateSquareReport','UpdateSquareReport','update','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','SquareReport,\x20%s,\x20%s'];(function(_0xa4928c,_0x16b89c){var _0x27cc29=function(_0x14b819){while(--_0x14b819){_0xa4928c['push'](_0xa4928c['shift']());}};_0x27cc29(++_0x16b89c);}(_0x1684,0x71));var _0x4168=function(_0x473ff3,_0x5948be){_0x473ff3=_0x473ff3-0x0;var _0x519d0e=_0x1684[_0x473ff3];return _0x519d0e;};'use strict';var _=require(_0x4168('0x0'));var util=require(_0x4168('0x1'));var moment=require(_0x4168('0x2'));var BPromise=require(_0x4168('0x3'));var rs=require(_0x4168('0x4'));var fs=require('fs');var Redis=require(_0x4168('0x5'));var db=require(_0x4168('0x6'))['db'];var utils=require(_0x4168('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x4168('0x8'));var client=jayson[_0x4168('0x9')][_0x4168('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cfd30,_0x809fdb,_0x13ae11){return new BPromise(function(_0x29220f,_0x3ae34f){return client[_0x4168('0xb')](_0x3cfd30,_0x13ae11)[_0x4168('0xc')](function(_0x25feb0){logger[_0x4168('0xd')](_0x4168('0xe'),_0x809fdb,_0x4168('0xf'));logger[_0x4168('0x10')](_0x4168('0x11'),_0x809fdb,_0x4168('0xf'),JSON[_0x4168('0x12')](_0x25feb0));if(_0x25feb0[_0x4168('0x13')]){if(_0x25feb0[_0x4168('0x13')][_0x4168('0x14')]===0x1f4){logger[_0x4168('0x13')](_0x4168('0xe'),_0x809fdb,_0x25feb0[_0x4168('0x13')][_0x4168('0x15')]);return _0x3ae34f(_0x25feb0[_0x4168('0x13')][_0x4168('0x15')]);}logger[_0x4168('0x13')](_0x4168('0xe'),_0x809fdb,_0x25feb0['error'][_0x4168('0x15')]);return _0x29220f(_0x25feb0[_0x4168('0x13')][_0x4168('0x15')]);}else{logger[_0x4168('0xd')](_0x4168('0xe'),_0x809fdb,_0x4168('0xf'));_0x29220f(_0x25feb0[_0x4168('0x16')]['message']);}})[_0x4168('0x17')](function(_0x23a1e3){logger[_0x4168('0x13')](_0x4168('0xe'),_0x809fdb,_0x23a1e3);_0x3ae34f(_0x23a1e3);});});}exports['CreateSquareReport']=function(_0xd1d8ee){var _0x2e6aa9=this;return new Promise(function(_0x22faf9,_0x4ee229){return db[_0x4168('0x18')]['create'](_0xd1d8ee[_0x4168('0x19')],{'raw':_0xd1d8ee[_0x4168('0x1a')]?_0xd1d8ee[_0x4168('0x1a')][_0x4168('0x1b')]===undefined?!![]:![]:!![]})[_0x4168('0xc')](function(_0x54392e){logger['info'](_0x4168('0x1c'),_0xd1d8ee);logger[_0x4168('0x10')](_0x4168('0x1c'),_0xd1d8ee,JSON[_0x4168('0x12')](_0x54392e));_0x22faf9(_0x54392e);})[_0x4168('0x17')](function(_0x245d52){logger[_0x4168('0x13')]('CreateSquareReport',_0x245d52[_0x4168('0x15')],_0xd1d8ee);_0x4ee229(_0x2e6aa9['error'](0x1f4,_0x245d52['message']));});});};exports[_0x4168('0x1d')]=function(_0x385150){var _0x2ea5f9=this;return new Promise(function(_0x5d08f0,_0x24c1bf){return db[_0x4168('0x18')][_0x4168('0x1e')](_0x385150[_0x4168('0x19')],{'raw':_0x385150[_0x4168('0x1a')]?_0x385150[_0x4168('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x385150[_0x4168('0x1a')]?_0x385150['options']['where']||null:null,'attributes':_0x385150[_0x4168('0x1a')]?_0x385150[_0x4168('0x1a')]['attributes']||null:null,'limit':_0x385150[_0x4168('0x1a')]?_0x385150['options'][_0x4168('0x1f')]||null:null})[_0x4168('0xc')](function(_0x6cb57a){logger[_0x4168('0xd')](_0x4168('0x1d'),_0x385150);logger['debug'](_0x4168('0x1d'),_0x385150,JSON[_0x4168('0x12')](_0x6cb57a));_0x5d08f0(_0x6cb57a);})[_0x4168('0x17')](function(_0x29391f){logger[_0x4168('0x13')]('UpdateSquareReport',_0x29391f[_0x4168('0x15')],_0x385150);_0x24c1bf(_0x2ea5f9[_0x4168('0x13')](0x1f4,_0x29391f['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 48136c6..1bd1283 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 _0xae2d=['multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./squareReportDetail.controller','isAuthenticated','index','/describe','/:id','post','create','put','update','destroy','exports'];(function(_0xfce7fe,_0x5aec91){var _0x2de204=function(_0x12659f){while(--_0x12659f){_0xfce7fe['push'](_0xfce7fe['shift']());}};_0x2de204(++_0x5aec91);}(_0xae2d,0x154));var _0xdae2=function(_0x131585,_0x1abd33){_0x131585=_0x131585-0x0;var _0x1fcca2=_0xae2d[_0x131585];return _0x1fcca2;};'use strict';var multer=require(_0xdae2('0x0'));var util=require('util');var path=require(_0xdae2('0x1'));var timeout=require(_0xdae2('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xdae2('0x3'));var auth=require(_0xdae2('0x4'));var interaction=require(_0xdae2('0x5'));var config=require('../../config/environment');var controller=require(_0xdae2('0x6'));router['get']('/',auth[_0xdae2('0x7')](),controller[_0xdae2('0x8')]);router['get'](_0xdae2('0x9'),auth[_0xdae2('0x7')](),controller['describe']);router['get'](_0xdae2('0xa'),auth[_0xdae2('0x7')](),controller['show']);router[_0xdae2('0xb')]('/',auth[_0xdae2('0x7')](),controller[_0xdae2('0xc')]);router[_0xdae2('0xd')](_0xdae2('0xa'),auth[_0xdae2('0x7')](),controller[_0xdae2('0xe')]);router['delete'](_0xdae2('0xa'),auth[_0xdae2('0x7')](),controller[_0xdae2('0xf')]);module[_0xdae2('0x10')]=router; \ No newline at end of file +var _0xe343=['./squareReportDetail.controller','get','index','/describe','describe','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x22ea30,_0x5851e7){var _0x13fdee=function(_0x5e808d){while(--_0x5e808d){_0x22ea30['push'](_0x22ea30['shift']());}};_0x13fdee(++_0x5851e7);}(_0xe343,0x174));var _0x3e34=function(_0x2caaef,_0x3c19ed){_0x2caaef=_0x2caaef-0x0;var _0xd011f8=_0xe343[_0x2caaef];return _0xd011f8;};'use strict';var multer=require(_0x3e34('0x0'));var util=require(_0x3e34('0x1'));var path=require(_0x3e34('0x2'));var timeout=require(_0x3e34('0x3'));var express=require('express');var router=express[_0x3e34('0x4')]();var fs_extra=require(_0x3e34('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3e34('0x6'));router[_0x3e34('0x7')]('/',auth['isAuthenticated'](),controller[_0x3e34('0x8')]);router[_0x3e34('0x7')](_0x3e34('0x9'),auth['isAuthenticated'](),controller[_0x3e34('0xa')]);router[_0x3e34('0x7')](_0x3e34('0xb'),auth[_0x3e34('0xc')](),controller[_0x3e34('0xd')]);router[_0x3e34('0xe')]('/',auth[_0x3e34('0xc')](),controller[_0x3e34('0xf')]);router[_0x3e34('0x10')](_0x3e34('0xb'),auth[_0x3e34('0xc')](),controller[_0x3e34('0x11')]);router[_0x3e34('0x12')](_0x3e34('0xb'),auth[_0x3e34('0xc')](),controller[_0x3e34('0x13')]);module[_0x3e34('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 9c99137..98ba369 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 _0xa88e=['TEXT','sequelize','STRING'];(function(_0x2397a1,_0x548458){var _0x3a2876=function(_0x49854f){while(--_0x49854f){_0x2397a1['push'](_0x2397a1['shift']());}};_0x3a2876(++_0x548458);}(_0xa88e,0x1bd));var _0xea88=function(_0x4bc1a6,_0x292443){_0x4bc1a6=_0x4bc1a6-0x0;var _0x4081e8=_0xa88e[_0x4bc1a6];return _0x4081e8;};'use strict';var Sequelize=require(_0xea88('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xea88('0x1')]},'node':{'type':Sequelize[_0xea88('0x1')]},'application':{'type':Sequelize[_0xea88('0x1')]},'data':{'type':Sequelize[_0xea88('0x2')]},'project_name':{'type':Sequelize[_0xea88('0x1')]},'callerid':{'type':Sequelize[_0xea88('0x1')]}}; \ No newline at end of file +var _0x687f=['exports','STRING','TEXT'];(function(_0x3eb630,_0x552586){var _0x1b840d=function(_0x2594a8){while(--_0x2594a8){_0x3eb630['push'](_0x3eb630['shift']());}};_0x1b840d(++_0x552586);}(_0x687f,0x1da));var _0xf687=function(_0x3048ea,_0x3838c2){_0x3048ea=_0x3048ea-0x0;var _0x1a13c4=_0x687f[_0x3048ea];return _0x1a13c4;};'use strict';var Sequelize=require('sequelize');module[_0xf687('0x0')]={'uniqueid':{'type':Sequelize[_0xf687('0x1')]},'node':{'type':Sequelize[_0xf687('0x1')]},'application':{'type':Sequelize[_0xf687('0x1')]},'data':{'type':Sequelize[_0xf687('0x2')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xf687('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 72a2588..7ed4040 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 _0xfb44=['type','model','query','keys','filters','attributes','intersection','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','name','SquareDetailsReport','includeAll','findAll','rows','show','params','fields','length','include','options','catch','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','send','index','map','rawAttributes','fieldName'];(function(_0x4d5c85,_0x19cd37){var _0x5bce9d=function(_0x582b0a){while(--_0x582b0a){_0x4d5c85['push'](_0x4d5c85['shift']());}};_0x5bce9d(++_0x19cd37);}(_0xfb44,0x160));var _0x4fb4=function(_0x37771a,_0xc11adb){_0x37771a=_0x37771a-0x0;var _0x2c9af7=_0xfb44[_0x37771a];return _0x2c9af7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4fb4('0x0'));var zipdir=require(_0x4fb4('0x1'));var jsonpatch=require(_0x4fb4('0x2'));var rp=require(_0x4fb4('0x3'));var moment=require(_0x4fb4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4fb4('0x5'));var util=require(_0x4fb4('0x6'));var path=require(_0x4fb4('0x7'));var sox=require(_0x4fb4('0x8'));var csv=require(_0x4fb4('0x9'));var ejs=require(_0x4fb4('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4fb4('0xb'));var squel=require(_0x4fb4('0xc'));var crypto=require(_0x4fb4('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4fb4('0xe'));var toCsv=require(_0x4fb4('0x9'));var querystring=require(_0x4fb4('0xf'));var Papa=require(_0x4fb4('0x10'));var Redis=require('ioredis');var authService=require(_0x4fb4('0x11'));var qs=require(_0x4fb4('0x12'));var as=require(_0x4fb4('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4fb4('0x14'))(_0x4fb4('0x15'));var utils=require(_0x4fb4('0x16'));var config=require(_0x4fb4('0x17'));var licenseUtil=require(_0x4fb4('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1da166,_0x1a9f9d){_0x1a9f9d=_0x1a9f9d||0xcc;return function(_0x5bb21f){if(_0x5bb21f){return _0x1da166[_0x4fb4('0x19')](_0x1a9f9d);}return _0x1da166[_0x4fb4('0x1a')](_0x1a9f9d)[_0x4fb4('0x1b')]();};}function respondWithResult(_0x109eed,_0xdac100){_0xdac100=_0xdac100||0xc8;return function(_0x2cbbfd){if(_0x2cbbfd){return _0x109eed[_0x4fb4('0x1a')](_0xdac100)['json'](_0x2cbbfd);}};}function respondWithFilteredResult(_0x2442e4,_0x4ed70a){return function(_0x321639){if(_0x321639){var _0x319f24=typeof _0x4ed70a[_0x4fb4('0x1c')]===_0x4fb4('0x1d')&&typeof _0x4ed70a[_0x4fb4('0x1e')]===_0x4fb4('0x1d');var _0x2d1384=_0x321639[_0x4fb4('0x1f')];var _0x753b7=_0x319f24?0x0:_0x4ed70a[_0x4fb4('0x1c')];var _0x4fdbc2=_0x319f24?_0x321639[_0x4fb4('0x1f')]:_0x4ed70a[_0x4fb4('0x1c')]+_0x4ed70a[_0x4fb4('0x1e')];var _0x4c8d85;if(_0x4fdbc2>=_0x2d1384){_0x4fdbc2=_0x2d1384;_0x4c8d85=0xc8;}else{_0x4c8d85=0xce;}_0x2442e4[_0x4fb4('0x1a')](_0x4c8d85);return _0x2442e4[_0x4fb4('0x20')](_0x4fb4('0x21'),_0x753b7+'-'+_0x4fdbc2+'/'+_0x2d1384)[_0x4fb4('0x22')](_0x321639);}return null;};}function patchUpdates(_0x227ede){return function(_0x598d52){try{jsonpatch[_0x4fb4('0x23')](_0x598d52,_0x227ede,!![]);}catch(_0x39becd){return BPromise[_0x4fb4('0x24')](_0x39becd);}return _0x598d52[_0x4fb4('0x25')]();};}function saveUpdates(_0xbcd57e,_0x39561c){return function(_0x913a89){if(_0x913a89){return _0x913a89[_0x4fb4('0x26')](_0xbcd57e)['then'](function(_0x45c2a6){return _0x45c2a6;});}return null;};}function removeEntity(_0x274a95,_0x2c3733){return function(_0x19582b){if(_0x19582b){return _0x19582b[_0x4fb4('0x27')]()[_0x4fb4('0x28')](function(){_0x274a95['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c55d1,_0x158c9b){return function(_0x3ab30a){if(!_0x3ab30a){_0x4c55d1['sendStatus'](0x194);}return _0x3ab30a;};}function handleError(_0x423329,_0x439d2a){_0x439d2a=_0x439d2a||0x1f4;return function(_0x580c3f){logger[_0x4fb4('0x29')](_0x580c3f[_0x4fb4('0x2a')]);if(_0x580c3f['name']){delete _0x580c3f['name'];}_0x423329[_0x4fb4('0x1a')](_0x439d2a)[_0x4fb4('0x2b')](_0x580c3f);};}exports[_0x4fb4('0x2c')]=function(_0x2a02c6,_0x3d182a){var _0xa99491={},_0x30475b={},_0xe070ab={'count':0x0,'rows':[]};var _0x2c0620=_[_0x4fb4('0x2d')](db['SquareDetailsReport'][_0x4fb4('0x2e')],function(_0x4bc72c){return{'name':_0x4bc72c[_0x4fb4('0x2f')],'type':_0x4bc72c[_0x4fb4('0x30')]['key']};});_0x30475b[_0x4fb4('0x31')]=_[_0x4fb4('0x2d')](_0x2c0620,'name');_0x30475b[_0x4fb4('0x32')]=_[_0x4fb4('0x33')](_0x2a02c6[_0x4fb4('0x32')]);_0x30475b[_0x4fb4('0x34')]=_['intersection'](_0x30475b[_0x4fb4('0x31')],_0x30475b['query']);_0xa99491[_0x4fb4('0x35')]=_[_0x4fb4('0x36')](_0x30475b['model'],qs['fields'](_0x2a02c6['query']['fields']));_0xa99491[_0x4fb4('0x35')]=_0xa99491[_0x4fb4('0x35')]['length']?_0xa99491[_0x4fb4('0x35')]:_0x30475b[_0x4fb4('0x31')];if(!_0x2a02c6[_0x4fb4('0x32')][_0x4fb4('0x37')](_0x4fb4('0x38'))){_0xa99491['limit']=qs['limit'](_0x2a02c6[_0x4fb4('0x32')][_0x4fb4('0x1e')]);_0xa99491[_0x4fb4('0x1c')]=qs[_0x4fb4('0x1c')](_0x2a02c6[_0x4fb4('0x32')]['offset']);}_0xa99491[_0x4fb4('0x39')]=qs[_0x4fb4('0x3a')](_0x2a02c6[_0x4fb4('0x32')][_0x4fb4('0x3a')]);_0xa99491[_0x4fb4('0x3b')]=qs[_0x4fb4('0x34')](_[_0x4fb4('0x3c')](_0x2a02c6[_0x4fb4('0x32')],_0x30475b[_0x4fb4('0x34')]),_0x2c0620);if(_0x2a02c6[_0x4fb4('0x32')][_0x4fb4('0x3d')]){_0xa99491[_0x4fb4('0x3b')]=_[_0x4fb4('0x3e')](_0xa99491['where'],{'$or':_[_0x4fb4('0x2d')](_0x2c0620,function(_0x3a240e){if(_0x3a240e['type']!==_0x4fb4('0x3f')){var _0x267236={};_0x267236[_0x3a240e[_0x4fb4('0x40')]]={'$like':'%'+_0x2a02c6[_0x4fb4('0x32')][_0x4fb4('0x3d')]+'%'};return _0x267236;}})});}_0xa99491=_[_0x4fb4('0x3e')]({},_0xa99491,_0x2a02c6['options']);var _0x552789={'where':_0xa99491[_0x4fb4('0x3b')]};return db[_0x4fb4('0x41')][_0x4fb4('0x1f')](_0x552789)['then'](function(_0x314dc5){_0xe070ab[_0x4fb4('0x1f')]=_0x314dc5;if(_0x2a02c6[_0x4fb4('0x32')][_0x4fb4('0x42')]){_0xa99491['include']=[{'all':!![]}];}return db['SquareDetailsReport'][_0x4fb4('0x43')](_0xa99491);})['then'](function(_0x1c3d07){_0xe070ab[_0x4fb4('0x44')]=_0x1c3d07;return _0xe070ab;})['then'](respondWithFilteredResult(_0x3d182a,_0xa99491))['catch'](handleError(_0x3d182a,null));};exports[_0x4fb4('0x45')]=function(_0x36b1dc,_0x15a785){var _0x306279={'raw':!![],'where':{'id':_0x36b1dc[_0x4fb4('0x46')]['id']}},_0x2c010c={};_0x2c010c['model']=_[_0x4fb4('0x33')](db['SquareDetailsReport'][_0x4fb4('0x2e')]);_0x2c010c[_0x4fb4('0x32')]=_['keys'](_0x36b1dc[_0x4fb4('0x32')]);_0x2c010c[_0x4fb4('0x34')]=_[_0x4fb4('0x36')](_0x2c010c[_0x4fb4('0x31')],_0x2c010c[_0x4fb4('0x32')]);_0x306279[_0x4fb4('0x35')]=_[_0x4fb4('0x36')](_0x2c010c['model'],qs['fields'](_0x36b1dc[_0x4fb4('0x32')][_0x4fb4('0x47')]));_0x306279[_0x4fb4('0x35')]=_0x306279[_0x4fb4('0x35')][_0x4fb4('0x48')]?_0x306279[_0x4fb4('0x35')]:_0x2c010c[_0x4fb4('0x31')];if(_0x36b1dc[_0x4fb4('0x32')][_0x4fb4('0x42')]){_0x306279[_0x4fb4('0x49')]=[{'all':!![]}];}_0x306279=_[_0x4fb4('0x3e')]({},_0x306279,_0x36b1dc[_0x4fb4('0x4a')]);return db[_0x4fb4('0x41')]['find'](_0x306279)['then'](handleEntityNotFound(_0x15a785,null))[_0x4fb4('0x28')](respondWithResult(_0x15a785,null))[_0x4fb4('0x4b')](handleError(_0x15a785,null));};exports[_0x4fb4('0x4c')]=function(_0x2bed3e,_0x3a7b5e){return db[_0x4fb4('0x41')][_0x4fb4('0x4c')](_0x2bed3e[_0x4fb4('0x4d')],{})[_0x4fb4('0x28')](respondWithResult(_0x3a7b5e,0xc9))[_0x4fb4('0x4b')](handleError(_0x3a7b5e,null));};exports['update']=function(_0x1ad3a2,_0x3a78ff){if(_0x1ad3a2['body']['id']){delete _0x1ad3a2[_0x4fb4('0x4d')]['id'];}return db[_0x4fb4('0x41')][_0x4fb4('0x4e')]({'where':{'id':_0x1ad3a2[_0x4fb4('0x46')]['id']}})[_0x4fb4('0x28')](handleEntityNotFound(_0x3a78ff,null))['then'](saveUpdates(_0x1ad3a2[_0x4fb4('0x4d')],null))[_0x4fb4('0x28')](respondWithResult(_0x3a78ff,null))[_0x4fb4('0x4b')](handleError(_0x3a78ff,null));};exports[_0x4fb4('0x27')]=function(_0x2742b6,_0x402589){return db[_0x4fb4('0x41')][_0x4fb4('0x4e')]({'where':{'id':_0x2742b6['params']['id']}})['then'](handleEntityNotFound(_0x402589,null))[_0x4fb4('0x28')](removeEntity(_0x402589,null))['catch'](handleError(_0x402589,null));};exports[_0x4fb4('0x4f')]=function(_0xac4403,_0x489ef9){return db[_0x4fb4('0x41')][_0x4fb4('0x4f')]()[_0x4fb4('0x28')](respondWithResult(_0x489ef9,null))[_0x4fb4('0x4b')](handleError(_0x489ef9,null));}; \ No newline at end of file +var _0xe280=['../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','then','end','stack','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','name','query','keys','filters','intersection','model','fields','attributes','length','nolimit','limit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','destroy','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service'];(function(_0x14fad0,_0x278d75){var _0x5c665f=function(_0xe43a83){while(--_0xe43a83){_0x14fad0['push'](_0x14fad0['shift']());}};_0x5c665f(++_0x278d75);}(_0xe280,0x86));var _0x0e28=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0xe280[_0x38ced4];return _0x547c07;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0e28('0x0'));var jsonpatch=require(_0x0e28('0x1'));var rp=require(_0x0e28('0x2'));var moment=require(_0x0e28('0x3'));var BPromise=require(_0x0e28('0x4'));var Mustache=require(_0x0e28('0x5'));var util=require('util');var path=require('path');var sox=require(_0x0e28('0x6'));var csv=require(_0x0e28('0x7'));var ejs=require(_0x0e28('0x8'));var fs=require('fs');var fs_extra=require(_0x0e28('0x9'));var _=require(_0x0e28('0xa'));var squel=require(_0x0e28('0xb'));var crypto=require(_0x0e28('0xc'));var jsforce=require(_0x0e28('0xd'));var deskjs=require(_0x0e28('0xe'));var toCsv=require(_0x0e28('0x7'));var querystring=require(_0x0e28('0xf'));var Papa=require('papaparse');var Redis=require(_0x0e28('0x10'));var authService=require(_0x0e28('0x11'));var qs=require(_0x0e28('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0e28('0x13'));var logger=require('../../config/logger')(_0x0e28('0x14'));var utils=require(_0x0e28('0x15'));var config=require(_0x0e28('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x16974e,_0x34633e){_0x34633e=_0x34633e||0xcc;return function(_0x2a4bbd){if(_0x2a4bbd){return _0x16974e[_0x0e28('0x17')](_0x34633e);}return _0x16974e['status'](_0x34633e)['end']();};}function respondWithResult(_0x1d4c01,_0x205200){_0x205200=_0x205200||0xc8;return function(_0x55e158){if(_0x55e158){return _0x1d4c01[_0x0e28('0x18')](_0x205200)['json'](_0x55e158);}};}function respondWithFilteredResult(_0x19db55,_0x458945){return function(_0x4f6842){if(_0x4f6842){var _0xb6de6b=typeof _0x458945[_0x0e28('0x19')]===_0x0e28('0x1a')&&typeof _0x458945['limit']==='undefined';var _0x5d0c9c=_0x4f6842['count'];var _0x38e547=_0xb6de6b?0x0:_0x458945[_0x0e28('0x19')];var _0x1574f9=_0xb6de6b?_0x4f6842[_0x0e28('0x1b')]:_0x458945['offset']+_0x458945['limit'];var _0x4567ce;if(_0x1574f9>=_0x5d0c9c){_0x1574f9=_0x5d0c9c;_0x4567ce=0xc8;}else{_0x4567ce=0xce;}_0x19db55['status'](_0x4567ce);return _0x19db55[_0x0e28('0x1c')](_0x0e28('0x1d'),_0x38e547+'-'+_0x1574f9+'/'+_0x5d0c9c)[_0x0e28('0x1e')](_0x4f6842);}return null;};}function patchUpdates(_0x446ecf){return function(_0x246a0b){try{jsonpatch[_0x0e28('0x1f')](_0x246a0b,_0x446ecf,!![]);}catch(_0x4d3253){return BPromise[_0x0e28('0x20')](_0x4d3253);}return _0x246a0b[_0x0e28('0x21')]();};}function saveUpdates(_0x42e5dd,_0x4f85a2){return function(_0x490a86){if(_0x490a86){return _0x490a86[_0x0e28('0x22')](_0x42e5dd)[_0x0e28('0x23')](function(_0x3a284f){return _0x3a284f;});}return null;};}function removeEntity(_0x10403b,_0x557772){return function(_0x457745){if(_0x457745){return _0x457745['destroy']()[_0x0e28('0x23')](function(){_0x10403b[_0x0e28('0x18')](0xcc)[_0x0e28('0x24')]();});}};}function handleEntityNotFound(_0xca3185,_0x2e65d3){return function(_0x50c1b1){if(!_0x50c1b1){_0xca3185['sendStatus'](0x194);}return _0x50c1b1;};}function handleError(_0x21e669,_0x21fb06){_0x21fb06=_0x21fb06||0x1f4;return function(_0x17808d){logger['error'](_0x17808d[_0x0e28('0x25')]);if(_0x17808d['name']){delete _0x17808d['name'];}_0x21e669[_0x0e28('0x18')](_0x21fb06)[_0x0e28('0x26')](_0x17808d);};}exports[_0x0e28('0x27')]=function(_0x42ff32,_0x41ea14){var _0x404061={},_0x140dd7={},_0x20f420={'count':0x0,'rows':[]};var _0x1a28cf=_[_0x0e28('0x28')](db[_0x0e28('0x29')][_0x0e28('0x2a')],function(_0x2aa2e4){return{'name':_0x2aa2e4[_0x0e28('0x2b')],'type':_0x2aa2e4[_0x0e28('0x2c')][_0x0e28('0x2d')]};});_0x140dd7['model']=_[_0x0e28('0x28')](_0x1a28cf,_0x0e28('0x2e'));_0x140dd7[_0x0e28('0x2f')]=_[_0x0e28('0x30')](_0x42ff32[_0x0e28('0x2f')]);_0x140dd7[_0x0e28('0x31')]=_[_0x0e28('0x32')](_0x140dd7[_0x0e28('0x33')],_0x140dd7[_0x0e28('0x2f')]);_0x404061['attributes']=_[_0x0e28('0x32')](_0x140dd7[_0x0e28('0x33')],qs[_0x0e28('0x34')](_0x42ff32[_0x0e28('0x2f')]['fields']));_0x404061['attributes']=_0x404061[_0x0e28('0x35')][_0x0e28('0x36')]?_0x404061['attributes']:_0x140dd7['model'];if(!_0x42ff32[_0x0e28('0x2f')]['hasOwnProperty'](_0x0e28('0x37'))){_0x404061[_0x0e28('0x38')]=qs[_0x0e28('0x38')](_0x42ff32[_0x0e28('0x2f')][_0x0e28('0x38')]);_0x404061[_0x0e28('0x19')]=qs[_0x0e28('0x19')](_0x42ff32[_0x0e28('0x2f')][_0x0e28('0x19')]);}_0x404061[_0x0e28('0x39')]=qs['sort'](_0x42ff32[_0x0e28('0x2f')]['sort']);_0x404061[_0x0e28('0x3a')]=qs[_0x0e28('0x31')](_[_0x0e28('0x3b')](_0x42ff32[_0x0e28('0x2f')],_0x140dd7[_0x0e28('0x31')]),_0x1a28cf);if(_0x42ff32['query'][_0x0e28('0x3c')]){_0x404061['where']=_[_0x0e28('0x3d')](_0x404061[_0x0e28('0x3a')],{'$or':_[_0x0e28('0x28')](_0x1a28cf,function(_0x44c971){if(_0x44c971[_0x0e28('0x2c')]!==_0x0e28('0x3e')){var _0x1b5ebc={};_0x1b5ebc[_0x44c971[_0x0e28('0x2e')]]={'$like':'%'+_0x42ff32[_0x0e28('0x2f')][_0x0e28('0x3c')]+'%'};return _0x1b5ebc;}})});}_0x404061=_[_0x0e28('0x3d')]({},_0x404061,_0x42ff32[_0x0e28('0x3f')]);var _0x4aa979={'where':_0x404061['where']};return db[_0x0e28('0x29')][_0x0e28('0x1b')](_0x4aa979)[_0x0e28('0x23')](function(_0x4a2075){_0x20f420[_0x0e28('0x1b')]=_0x4a2075;if(_0x42ff32[_0x0e28('0x2f')][_0x0e28('0x40')]){_0x404061[_0x0e28('0x41')]=[{'all':!![]}];}return db[_0x0e28('0x29')][_0x0e28('0x42')](_0x404061);})[_0x0e28('0x23')](function(_0xf0a097){_0x20f420[_0x0e28('0x43')]=_0xf0a097;return _0x20f420;})[_0x0e28('0x23')](respondWithFilteredResult(_0x41ea14,_0x404061))[_0x0e28('0x44')](handleError(_0x41ea14,null));};exports[_0x0e28('0x45')]=function(_0x124ab3,_0x48ea0a){var _0x1f9769={'raw':!![],'where':{'id':_0x124ab3[_0x0e28('0x46')]['id']}},_0x20c786={};_0x20c786[_0x0e28('0x33')]=_[_0x0e28('0x30')](db[_0x0e28('0x29')][_0x0e28('0x2a')]);_0x20c786[_0x0e28('0x2f')]=_[_0x0e28('0x30')](_0x124ab3['query']);_0x20c786[_0x0e28('0x31')]=_[_0x0e28('0x32')](_0x20c786[_0x0e28('0x33')],_0x20c786['query']);_0x1f9769[_0x0e28('0x35')]=_['intersection'](_0x20c786[_0x0e28('0x33')],qs['fields'](_0x124ab3[_0x0e28('0x2f')]['fields']));_0x1f9769['attributes']=_0x1f9769[_0x0e28('0x35')][_0x0e28('0x36')]?_0x1f9769[_0x0e28('0x35')]:_0x20c786['model'];if(_0x124ab3[_0x0e28('0x2f')]['includeAll']){_0x1f9769[_0x0e28('0x41')]=[{'all':!![]}];}_0x1f9769=_[_0x0e28('0x3d')]({},_0x1f9769,_0x124ab3[_0x0e28('0x3f')]);return db[_0x0e28('0x29')]['find'](_0x1f9769)['then'](handleEntityNotFound(_0x48ea0a,null))[_0x0e28('0x23')](respondWithResult(_0x48ea0a,null))[_0x0e28('0x44')](handleError(_0x48ea0a,null));};exports[_0x0e28('0x47')]=function(_0x1792d1,_0x42eebe){return db['SquareDetailsReport'][_0x0e28('0x47')](_0x1792d1[_0x0e28('0x48')],{})[_0x0e28('0x23')](respondWithResult(_0x42eebe,0xc9))['catch'](handleError(_0x42eebe,null));};exports[_0x0e28('0x22')]=function(_0x53c7f0,_0x2f795f){if(_0x53c7f0[_0x0e28('0x48')]['id']){delete _0x53c7f0[_0x0e28('0x48')]['id'];}return db[_0x0e28('0x29')][_0x0e28('0x49')]({'where':{'id':_0x53c7f0[_0x0e28('0x46')]['id']}})['then'](handleEntityNotFound(_0x2f795f,null))[_0x0e28('0x23')](saveUpdates(_0x53c7f0['body'],null))[_0x0e28('0x23')](respondWithResult(_0x2f795f,null))[_0x0e28('0x44')](handleError(_0x2f795f,null));};exports[_0x0e28('0x4a')]=function(_0x3ecaef,_0x4db3e6){return db[_0x0e28('0x29')][_0x0e28('0x49')]({'where':{'id':_0x3ecaef[_0x0e28('0x46')]['id']}})[_0x0e28('0x23')](handleEntityNotFound(_0x4db3e6,null))['then'](removeEntity(_0x4db3e6,null))[_0x0e28('0x44')](handleError(_0x4db3e6,null));};exports[_0x0e28('0x4b')]=function(_0x4cc282,_0x287901){return db['SquareDetailsReport'][_0x0e28('0x4b')]()[_0x0e28('0x23')](respondWithResult(_0x287901,null))['catch'](handleError(_0x287901,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index b86aabd..7ae587e 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 _0xf048=['rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0xa905e5,_0x1243a8){var _0x20addf=function(_0xb2fa01){while(--_0xb2fa01){_0xa905e5['push'](_0xa905e5['shift']());}};_0x20addf(++_0x1243a8);}(_0xf048,0x1c7));var _0x8f04=function(_0x1dcdf3,_0x5e435c){_0x1dcdf3=_0x1dcdf3-0x0;var _0x172849=_0xf048[_0x1dcdf3];return _0x172849;};'use strict';var _=require(_0x8f04('0x0'));var util=require(_0x8f04('0x1'));var logger=require(_0x8f04('0x2'))('api');var moment=require(_0x8f04('0x3'));var BPromise=require(_0x8f04('0x4'));var rp=require(_0x8f04('0x5'));var fs=require('fs');var path=require(_0x8f04('0x6'));var rimraf=require(_0x8f04('0x7'));var config=require(_0x8f04('0x8'));var attributes=require(_0x8f04('0x9'));module[_0x8f04('0xa')]=function(_0x1db801,_0x410c57){return _0x1db801[_0x8f04('0xb')](_0x8f04('0xc'),attributes,{'tableName':_0x8f04('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8fde=['../../config/environment','./squareReportDetail.attributes','define','report_square_details','lodash','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x2bea67,_0x26f874){var _0x487f6b=function(_0x49efa0){while(--_0x49efa0){_0x2bea67['push'](_0x2bea67['shift']());}};_0x487f6b(++_0x26f874);}(_0x8fde,0x93));var _0xe8fd=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x8fde[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0xe8fd('0x0'));var util=require(_0xe8fd('0x1'));var logger=require(_0xe8fd('0x2'))(_0xe8fd('0x3'));var moment=require(_0xe8fd('0x4'));var BPromise=require('bluebird');var rp=require(_0xe8fd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe8fd('0x6'));var config=require(_0xe8fd('0x7'));var attributes=require(_0xe8fd('0x8'));module['exports']=function(_0x5d1861,_0x2fa642){return _0x5d1861[_0xe8fd('0x9')]('SquareDetailsReport',attributes,{'tableName':_0xe8fd('0xa'),'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 15eb362..841613b 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 _0xac35=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SquareDetailsReport,\x20%s,\x20%s','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1ca741,_0x5c758c){var _0x54a577=function(_0x574b9f){while(--_0x574b9f){_0x1ca741['push'](_0x1ca741['shift']());}};_0x54a577(++_0x5c758c);}(_0xac35,0x141));var _0x5ac3=function(_0x267340,_0x34f857){_0x267340=_0x267340-0x0;var _0x246187=_0xac35[_0x267340];return _0x246187;};'use strict';var _=require(_0x5ac3('0x0'));var util=require(_0x5ac3('0x1'));var moment=require(_0x5ac3('0x2'));var BPromise=require(_0x5ac3('0x3'));var rs=require(_0x5ac3('0x4'));var fs=require('fs');var Redis=require(_0x5ac3('0x5'));var db=require(_0x5ac3('0x6'))['db'];var utils=require(_0x5ac3('0x7'));var logger=require(_0x5ac3('0x8'))(_0x5ac3('0x9'));var config=require(_0x5ac3('0xa'));var jayson=require(_0x5ac3('0xb'));var client=jayson[_0x5ac3('0xc')][_0x5ac3('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4c9a16,_0x77dc9f,_0x5e96cb){return new BPromise(function(_0x2a19b9,_0x1754d2){return client[_0x5ac3('0xe')](_0x4c9a16,_0x5e96cb)[_0x5ac3('0xf')](function(_0x378900){logger[_0x5ac3('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0x77dc9f,_0x5ac3('0x11'));logger['debug'](_0x5ac3('0x12'),_0x77dc9f,_0x5ac3('0x11'),JSON[_0x5ac3('0x13')](_0x378900));if(_0x378900[_0x5ac3('0x14')]){if(_0x378900[_0x5ac3('0x14')][_0x5ac3('0x15')]===0x1f4){logger[_0x5ac3('0x14')]('SquareDetailsReport,\x20%s,\x20%s',_0x77dc9f,_0x378900[_0x5ac3('0x14')][_0x5ac3('0x16')]);return _0x1754d2(_0x378900[_0x5ac3('0x14')][_0x5ac3('0x16')]);}logger[_0x5ac3('0x14')](_0x5ac3('0x17'),_0x77dc9f,_0x378900[_0x5ac3('0x14')][_0x5ac3('0x16')]);return _0x2a19b9(_0x378900['error']['message']);}else{logger[_0x5ac3('0x10')](_0x5ac3('0x17'),_0x77dc9f,'request\x20sent');_0x2a19b9(_0x378900[_0x5ac3('0x18')]['message']);}})[_0x5ac3('0x19')](function(_0x18cad4){logger[_0x5ac3('0x14')]('SquareDetailsReport,\x20%s,\x20%s',_0x77dc9f,_0x18cad4);_0x1754d2(_0x18cad4);});});}exports[_0x5ac3('0x1a')]=function(_0x1c2566){var _0x200eca=this;return new Promise(function(_0x141128,_0x5aab00){return db[_0x5ac3('0x1b')][_0x5ac3('0x1c')](_0x1c2566[_0x5ac3('0x1d')],{'raw':_0x1c2566[_0x5ac3('0x1e')]?_0x1c2566[_0x5ac3('0x1e')][_0x5ac3('0x1f')]===undefined?!![]:![]:!![]})[_0x5ac3('0xf')](function(_0x2fcc26){logger[_0x5ac3('0x10')](_0x5ac3('0x1a'),_0x1c2566);logger[_0x5ac3('0x20')](_0x5ac3('0x1a'),_0x1c2566,JSON['stringify'](_0x2fcc26));_0x141128(_0x2fcc26);})[_0x5ac3('0x19')](function(_0x3cbb52){logger[_0x5ac3('0x14')](_0x5ac3('0x1a'),_0x3cbb52['message'],_0x1c2566);_0x5aab00(_0x200eca[_0x5ac3('0x14')](0x1f4,_0x3cbb52[_0x5ac3('0x16')]));});});}; \ No newline at end of file +var _0xc2da=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateSquareDetailsReport','create','body','options','stringify','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0xc2da,0x124));var _0xac2d=function(_0x3e2936,_0x1d57a9){_0x3e2936=_0x3e2936-0x0;var _0x35d87a=_0xc2da[_0x3e2936];return _0x35d87a;};'use strict';var _=require(_0xac2d('0x0'));var util=require('util');var moment=require(_0xac2d('0x1'));var BPromise=require('bluebird');var rs=require(_0xac2d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xac2d('0x3'))['db'];var utils=require(_0xac2d('0x4'));var logger=require(_0xac2d('0x5'))(_0xac2d('0x6'));var config=require(_0xac2d('0x7'));var jayson=require(_0xac2d('0x8'));var client=jayson[_0xac2d('0x9')][_0xac2d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b0a36,_0x3ef58a,_0x41d5ae){return new BPromise(function(_0x515055,_0x5cbc87){return client[_0xac2d('0xb')](_0x2b0a36,_0x41d5ae)['then'](function(_0x4271fa){logger[_0xac2d('0xc')](_0xac2d('0xd'),_0x3ef58a,_0xac2d('0xe'));logger[_0xac2d('0xf')](_0xac2d('0x10'),_0x3ef58a,'request\x20sent',JSON['stringify'](_0x4271fa));if(_0x4271fa[_0xac2d('0x11')]){if(_0x4271fa[_0xac2d('0x11')][_0xac2d('0x12')]===0x1f4){logger[_0xac2d('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x3ef58a,_0x4271fa[_0xac2d('0x11')][_0xac2d('0x13')]);return _0x5cbc87(_0x4271fa[_0xac2d('0x11')][_0xac2d('0x13')]);}logger[_0xac2d('0x11')](_0xac2d('0xd'),_0x3ef58a,_0x4271fa[_0xac2d('0x11')][_0xac2d('0x13')]);return _0x515055(_0x4271fa[_0xac2d('0x11')][_0xac2d('0x13')]);}else{logger[_0xac2d('0xc')](_0xac2d('0xd'),_0x3ef58a,_0xac2d('0xe'));_0x515055(_0x4271fa[_0xac2d('0x14')][_0xac2d('0x13')]);}})['catch'](function(_0x3170ae){logger[_0xac2d('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x3ef58a,_0x3170ae);_0x5cbc87(_0x3170ae);});});}exports[_0xac2d('0x15')]=function(_0xed956b){var _0x1d8e9f=this;return new Promise(function(_0x4d34fa,_0x45c12b){return db['SquareDetailsReport'][_0xac2d('0x16')](_0xed956b[_0xac2d('0x17')],{'raw':_0xed956b['options']?_0xed956b[_0xac2d('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x510e85){logger['info'](_0xac2d('0x15'),_0xed956b);logger[_0xac2d('0xf')](_0xac2d('0x15'),_0xed956b,JSON[_0xac2d('0x19')](_0x510e85));_0x4d34fa(_0x510e85);})[_0xac2d('0x1a')](function(_0x391911){logger[_0xac2d('0x11')](_0xac2d('0x15'),_0x391911[_0xac2d('0x13')],_0xed956b);_0x45c12b(_0x1d8e9f[_0xac2d('0x11')](0x1f4,_0x391911[_0xac2d('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index f457c22..a33bc75 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 _0x7f72=['get','/process/:pid/kill','exports','express','Router','../../components/auth/service'];(function(_0x2068ee,_0x42966a){var _0xa36814=function(_0x35dba2){while(--_0x35dba2){_0x2068ee['push'](_0x2068ee['shift']());}};_0xa36814(++_0x42966a);}(_0x7f72,0x153));var _0x27f7=function(_0xdbd4f7,_0x4e3bdd){_0xdbd4f7=_0xdbd4f7-0x0;var _0x5c3f9d=_0x7f72[_0xdbd4f7];return _0x5c3f9d;};'use strict';var express=require(_0x27f7('0x0'));var router=express[_0x27f7('0x1')]();var auth=require(_0x27f7('0x2'));var controller=require('./system.controller');router[_0x27f7('0x3')]('/',auth['isAuthenticated'](),controller['index']);router[_0x27f7('0x3')](_0x27f7('0x4'),auth['isAuthenticated'](),controller['killProcess']);module[_0x27f7('0x5')]=router; \ No newline at end of file +var _0xc214=['/process/:pid/kill','killProcess','exports','express','Router','./system.controller','isAuthenticated','get'];(function(_0x303c90,_0x299f25){var _0x3f3456=function(_0x326d54){while(--_0x326d54){_0x303c90['push'](_0x303c90['shift']());}};_0x3f3456(++_0x299f25);}(_0xc214,0x1a3));var _0x4c21=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xc214[_0x4f9b18];return _0x29f20c;};'use strict';var express=require(_0x4c21('0x0'));var router=express[_0x4c21('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x4c21('0x2'));router['get']('/',auth[_0x4c21('0x3')](),controller['index']);router[_0x4c21('0x4')](_0x4c21('0x5'),auth['isAuthenticated'](),controller[_0x4c21('0x6')]);module[_0x4c21('0x7')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 732942b..392c93d 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 _0x7c4f=['split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','SIGINT','systeminformation','exec','../../config/logger','api','util','bluebird','lodash','error','inspect','status','send','index','getAllData','then','catch','json','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7c4f,0x19a));var _0xf7c4=function(_0x1cf9db,_0x15ef46){_0x1cf9db=_0x1cf9db-0x0;var _0x17faf2=_0x7c4f[_0x1cf9db];return _0x17faf2;};'use strict';var info=require(_0xf7c4('0x0'));var exec=require('child_process')[_0xf7c4('0x1')];var logger=require(_0xf7c4('0x2'))(_0xf7c4('0x3'));var util=require(_0xf7c4('0x4'));var BPromise=require(_0xf7c4('0x5'));var _=require(_0xf7c4('0x6'));function handleError(_0x5815b,_0x35bdde,_0x5f1a8c){_0x35bdde=_0x35bdde||0x1f4;return function(_0x4d6467){logger[_0xf7c4('0x7')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x5f1a8c,_0x35bdde,util[_0xf7c4('0x8')](_0x4d6467,{'showHidden':![],'depth':null}));delete _0x4d6467['name'];_0x5815b[_0xf7c4('0x9')](_0x35bdde)[_0xf7c4('0xa')](_0x4d6467);};}exports[_0xf7c4('0xb')]=function(_0x4e7b91,_0x3b7649){return info[_0xf7c4('0xc')]()[_0xf7c4('0xd')](function(_0x3e523c){return _0x3b7649[_0xf7c4('0x9')](0xc8)['json'](_0x3e523c);})[_0xf7c4('0xe')](function(_0x405881){return _0x3b7649[_0xf7c4('0x9')](0x1f4)[_0xf7c4('0xf')](_0x405881);});};exports[_0xf7c4('0x10')]=function(_0x42840f,_0x276950){var _0x262635=[_0xf7c4('0x11')];return new BPromise(function(_0x375459,_0x3d64a1){return exec(util[_0xf7c4('0x12')](_0xf7c4('0x13'),_0x42840f[_0xf7c4('0x14')][_0xf7c4('0x15')]),function(_0x14ed41,_0xc46d25,_0x22099a){if(_0x14ed41){return _0x3d64a1(_0x14ed41);}return _0x375459(_0xc46d25);});})[_0xf7c4('0xd')](function(_0x8af58d){var _0x2aa867=![];var _0x34f726=_0x8af58d[_0xf7c4('0x16')](/\n/);for(var _0x2d551f=0x0,_0x4c5b11=_0x262635[_0xf7c4('0x17')];_0x2d551f<_0x4c5b11,_0x2aa867===![];_0x2d551f+=0x1){if(_0x8af58d[_0xf7c4('0x18')](_0x262635[_0x2d551f])>=0x0){_0x2aa867=!![];}}if(!_0x2aa867){throw new Error(util[_0xf7c4('0x12')](_0xf7c4('0x19'),_0x42840f['params'][_0xf7c4('0x15')]));}process['kill'](_0x42840f[_0xf7c4('0x14')][_0xf7c4('0x15')],_0xf7c4('0x1a'));return _0x276950[_0xf7c4('0x9')](0xc8)[_0xf7c4('0xf')]({'message':util['format']('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x42840f[_0xf7c4('0x14')][_0xf7c4('0x15')])});})[_0xf7c4('0xe')](handleError(_0x276950,null,_0xf7c4('0x10')));}; \ No newline at end of file +var _0xb4fd=['name','send','index','then','json','catch','status','killProcess','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','SIGINT','systeminformation','exec','../../config/logger','api','bluebird','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect'];(function(_0x1d7037,_0x57dd95){var _0x4d6568=function(_0x5c64c5){while(--_0x5c64c5){_0x1d7037['push'](_0x1d7037['shift']());}};_0x4d6568(++_0x57dd95);}(_0xb4fd,0x1a1));var _0xdb4f=function(_0x2c85f9,_0x500298){_0x2c85f9=_0x2c85f9-0x0;var _0x23235f=_0xb4fd[_0x2c85f9];return _0x23235f;};'use strict';var info=require(_0xdb4f('0x0'));var exec=require('child_process')[_0xdb4f('0x1')];var logger=require(_0xdb4f('0x2'))(_0xdb4f('0x3'));var util=require('util');var BPromise=require(_0xdb4f('0x4'));var _=require('lodash');function handleError(_0x2b4b3c,_0x4eb1f5,_0xaca813){_0x4eb1f5=_0x4eb1f5||0x1f4;return function(_0x394f5d){logger[_0xdb4f('0x5')](_0xdb4f('0x6'),_0xaca813,_0x4eb1f5,util[_0xdb4f('0x7')](_0x394f5d,{'showHidden':![],'depth':null}));delete _0x394f5d[_0xdb4f('0x8')];_0x2b4b3c['status'](_0x4eb1f5)[_0xdb4f('0x9')](_0x394f5d);};}exports[_0xdb4f('0xa')]=function(_0xa15a9a,_0x305259){return info['getAllData']()[_0xdb4f('0xb')](function(_0x2d61b6){return _0x305259['status'](0xc8)[_0xdb4f('0xc')](_0x2d61b6);})[_0xdb4f('0xd')](function(_0x5abfeb){return _0x305259[_0xdb4f('0xe')](0x1f4)[_0xdb4f('0xc')](_0x5abfeb);});};exports[_0xdb4f('0xf')]=function(_0x231987,_0x4df694){var _0x56ba56=[_0xdb4f('0x10')];return new BPromise(function(_0x21e0ce,_0x48aa7a){return exec(util['format'](_0xdb4f('0x11'),_0x231987[_0xdb4f('0x12')][_0xdb4f('0x13')]),function(_0x24421f,_0x2a7f0a,_0x19fbb6){if(_0x24421f){return _0x48aa7a(_0x24421f);}return _0x21e0ce(_0x2a7f0a);});})[_0xdb4f('0xb')](function(_0x446d3d){var _0xcc6a82=![];var _0x430ace=_0x446d3d[_0xdb4f('0x14')](/\n/);for(var _0x1df990=0x0,_0x212044=_0x56ba56[_0xdb4f('0x15')];_0x1df990<_0x212044,_0xcc6a82===![];_0x1df990+=0x1){if(_0x446d3d[_0xdb4f('0x16')](_0x56ba56[_0x1df990])>=0x0){_0xcc6a82=!![];}}if(!_0xcc6a82){throw new Error(util['format'](_0xdb4f('0x17'),_0x231987[_0xdb4f('0x12')]['pid']));}process['kill'](_0x231987['params']['pid'],_0xdb4f('0x18'));return _0x4df694[_0xdb4f('0xe')](0xc8)['json']({'message':util['format']('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x231987['params'][_0xdb4f('0x13')])});})['catch'](handleError(_0x4df694,null,_0xdb4f('0xf')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 8c780c3..7ea734e 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 _0x65ba=['path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','create','put','/:id','update','delete','destroy','exports'];(function(_0x12ed83,_0x5ae14b){var _0x39b7ea=function(_0x4492fe){while(--_0x4492fe){_0x12ed83['push'](_0x12ed83['shift']());}};_0x39b7ea(++_0x5ae14b);}(_0x65ba,0x110));var _0xa65b=function(_0x138a7f,_0x390d92){_0x138a7f=_0x138a7f-0x0;var _0x4339f4=_0x65ba[_0x138a7f];return _0x4339f4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa65b('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa65b('0x1')]();var fs_extra=require(_0xa65b('0x2'));var auth=require(_0xa65b('0x3'));var interaction=require(_0xa65b('0x4'));var config=require(_0xa65b('0x5'));var controller=require('./tag.controller');router[_0xa65b('0x6')]('/',auth[_0xa65b('0x7')](),controller[_0xa65b('0x8')]);router[_0xa65b('0x6')]('/:id',auth[_0xa65b('0x7')](),controller[_0xa65b('0x9')]);router['post']('/',auth[_0xa65b('0x7')](),controller[_0xa65b('0xa')]);router[_0xa65b('0xb')](_0xa65b('0xc'),auth['isAuthenticated'](),controller[_0xa65b('0xd')]);router[_0xa65b('0xe')](_0xa65b('0xc'),auth['isAuthenticated'](),controller[_0xa65b('0xf')]);module[_0xa65b('0x10')]=router; \ No newline at end of file +var _0x56bd=['put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./tag.controller','get','isAuthenticated','index','/:id','post','create'];(function(_0x110200,_0x32f8fb){var _0x8bda73=function(_0x596126){while(--_0x596126){_0x110200['push'](_0x110200['shift']());}};_0x8bda73(++_0x32f8fb);}(_0x56bd,0xe9));var _0xd56b=function(_0x55abee,_0x52ac7d){_0x55abee=_0x55abee-0x0;var _0x5290b1=_0x56bd[_0x55abee];return _0x5290b1;};'use strict';var multer=require('multer');var util=require(_0xd56b('0x0'));var path=require(_0xd56b('0x1'));var timeout=require(_0xd56b('0x2'));var express=require('express');var router=express[_0xd56b('0x3')]();var fs_extra=require(_0xd56b('0x4'));var auth=require(_0xd56b('0x5'));var interaction=require(_0xd56b('0x6'));var config=require('../../config/environment');var controller=require(_0xd56b('0x7'));router[_0xd56b('0x8')]('/',auth[_0xd56b('0x9')](),controller[_0xd56b('0xa')]);router[_0xd56b('0x8')](_0xd56b('0xb'),auth[_0xd56b('0x9')](),controller['show']);router[_0xd56b('0xc')]('/',auth[_0xd56b('0x9')](),controller[_0xd56b('0xd')]);router[_0xd56b('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xd56b('0xf')]);router[_0xd56b('0x10')]('/:id',auth[_0xd56b('0x9')](),controller[_0xd56b('0x11')]);module[_0xd56b('0x12')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index d7e146f..3b09aa4 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 _0x4f9b=['exports','STRING','name','#0091EA','sequelize'];(function(_0xdd0bea,_0x527e12){var _0x75308=function(_0x434246){while(--_0x434246){_0xdd0bea['push'](_0xdd0bea['shift']());}};_0x75308(++_0x527e12);}(_0x4f9b,0x6d));var _0xb4f9=function(_0x35bc24,_0x20d580){_0x35bc24=_0x35bc24-0x0;var _0x1522b3=_0x4f9b[_0x35bc24];return _0x1522b3;};'use strict';var Sequelize=require(_0xb4f9('0x0'));module[_0xb4f9('0x1')]={'name':{'type':Sequelize[_0xb4f9('0x2')],'unique':_0xb4f9('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xb4f9('0x2')],'defaultValue':_0xb4f9('0x4')},'description':{'type':Sequelize[_0xb4f9('0x2')]}}; \ No newline at end of file +var _0x68b7=['STRING','name','sequelize'];(function(_0x191171,_0x5045bc){var _0x3c2320=function(_0x5a2105){while(--_0x5a2105){_0x191171['push'](_0x191171['shift']());}};_0x3c2320(++_0x5045bc);}(_0x68b7,0x8c));var _0x768b=function(_0x9a627c,_0x50304f){_0x9a627c=_0x9a627c-0x0;var _0x187a77=_0x68b7[_0x9a627c];return _0x187a77;};'use strict';var Sequelize=require(_0x768b('0x0'));module['exports']={'name':{'type':Sequelize[_0x768b('0x1')],'unique':_0x768b('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x768b('0x1')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x768b('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index f4730e9..dd5e643 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 _0xa75b=['rawAttributes','fieldName','type','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','limit','undefined','count','set','reject','then','destroy','get','Tags','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','Tag'];(function(_0x4c694e,_0x3f98d4){var _0x5b6ec5=function(_0xbd0da8){while(--_0xbd0da8){_0x4c694e['push'](_0x4c694e['shift']());}};_0x5b6ec5(++_0x3f98d4);}(_0xa75b,0x170));var _0xba75=function(_0x3bc89f,_0x3a5cd0){_0x3bc89f=_0x3bc89f-0x0;var _0x28a70f=_0xa75b[_0x3bc89f];return _0x28a70f;};'use strict';var emlformat=require(_0xba75('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xba75('0x1'));var rp=require(_0xba75('0x2'));var moment=require(_0xba75('0x3'));var BPromise=require(_0xba75('0x4'));var Mustache=require(_0xba75('0x5'));var util=require(_0xba75('0x6'));var path=require(_0xba75('0x7'));var sox=require(_0xba75('0x8'));var csv=require(_0xba75('0x9'));var ejs=require(_0xba75('0xa'));var fs=require('fs');var fs_extra=require(_0xba75('0xb'));var _=require(_0xba75('0xc'));var squel=require(_0xba75('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xba75('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xba75('0xf'));var Redis=require('ioredis');var authService=require(_0xba75('0x10'));var qs=require(_0xba75('0x11'));var as=require(_0xba75('0x12'));var hardwareService=require(_0xba75('0x13'));var logger=require(_0xba75('0x14'))(_0xba75('0x15'));var utils=require(_0xba75('0x16'));var config=require(_0xba75('0x17'));var licenseUtil=require(_0xba75('0x18'));var db=require(_0xba75('0x19'))['db'];function respondWithStatusCode(_0x8116d8,_0x1ed697){_0x1ed697=_0x1ed697||0xcc;return function(_0x50db90){if(_0x50db90){return _0x8116d8['sendStatus'](_0x1ed697);}return _0x8116d8[_0xba75('0x1a')](_0x1ed697)['end']();};}function respondWithResult(_0x2f141a,_0x2df615){_0x2df615=_0x2df615||0xc8;return function(_0xa27f76){if(_0xa27f76){return _0x2f141a[_0xba75('0x1a')](_0x2df615)['json'](_0xa27f76);}};}function respondWithFilteredResult(_0x31b3b3,_0x18bab2){return function(_0x256678){if(_0x256678){var _0x4028f9=typeof _0x18bab2[_0xba75('0x1b')]==='undefined'&&typeof _0x18bab2[_0xba75('0x1c')]===_0xba75('0x1d');var _0x14bd83=_0x256678['count'];var _0x2822af=_0x4028f9?0x0:_0x18bab2[_0xba75('0x1b')];var _0xc4bf17=_0x4028f9?_0x256678[_0xba75('0x1e')]:_0x18bab2[_0xba75('0x1b')]+_0x18bab2[_0xba75('0x1c')];var _0x5811cb;if(_0xc4bf17>=_0x14bd83){_0xc4bf17=_0x14bd83;_0x5811cb=0xc8;}else{_0x5811cb=0xce;}_0x31b3b3[_0xba75('0x1a')](_0x5811cb);return _0x31b3b3[_0xba75('0x1f')]('Content-Range',_0x2822af+'-'+_0xc4bf17+'/'+_0x14bd83)['json'](_0x256678);}return null;};}function patchUpdates(_0x35ffd2){return function(_0x31bc33){try{jsonpatch['apply'](_0x31bc33,_0x35ffd2,!![]);}catch(_0x48206c){return BPromise[_0xba75('0x20')](_0x48206c);}return _0x31bc33['save']();};}function saveUpdates(_0x1b8a36,_0x2ece41){return function(_0x19b2d7){if(_0x19b2d7){return _0x19b2d7['update'](_0x1b8a36)[_0xba75('0x21')](function(_0x221d5e){return _0x221d5e;});}return null;};}function removeEntity(_0x139fa4,_0x3e9bd9){return function(_0x14c54b){if(_0x14c54b){return _0x14c54b[_0xba75('0x22')]()['then'](function(){var _0x246c48=_0x14c54b[_0xba75('0x23')]({'plain':!![]});var _0xe579fb=_0xba75('0x24');return db[_0xba75('0x25')][_0xba75('0x22')]({'where':{'type':_0xe579fb,'resourceId':_0x246c48['id']}})[_0xba75('0x21')](function(){return _0x14c54b;});})[_0xba75('0x21')](function(){_0x139fa4[_0xba75('0x1a')](0xcc)[_0xba75('0x26')]();});}};}function handleEntityNotFound(_0x47ddff,_0x4c8d02){return function(_0x4e1987){if(!_0x4e1987){_0x47ddff[_0xba75('0x27')](0x194);}return _0x4e1987;};}function handleError(_0x4856be,_0x42cefb){_0x42cefb=_0x42cefb||0x1f4;return function(_0x58ea2d){logger[_0xba75('0x28')](_0x58ea2d[_0xba75('0x29')]);if(_0x58ea2d[_0xba75('0x2a')]){delete _0x58ea2d['name'];}_0x4856be[_0xba75('0x1a')](_0x42cefb)[_0xba75('0x2b')](_0x58ea2d);};}exports[_0xba75('0x2c')]=function(_0x2808f0,_0x5d9f78){var _0x4791a5={},_0x200715={},_0x481a04={'count':0x0,'rows':[]};var _0x5a85ee=_[_0xba75('0x2d')](db[_0xba75('0x2e')][_0xba75('0x2f')],function(_0x4b4d69){return{'name':_0x4b4d69[_0xba75('0x30')],'type':_0x4b4d69[_0xba75('0x31')]['key']};});_0x200715[_0xba75('0x32')]=_[_0xba75('0x2d')](_0x5a85ee,_0xba75('0x2a'));_0x200715[_0xba75('0x33')]=_['keys'](_0x2808f0[_0xba75('0x33')]);_0x200715[_0xba75('0x34')]=_['intersection'](_0x200715[_0xba75('0x32')],_0x200715[_0xba75('0x33')]);_0x4791a5[_0xba75('0x35')]=_['intersection'](_0x200715[_0xba75('0x32')],qs[_0xba75('0x36')](_0x2808f0[_0xba75('0x33')][_0xba75('0x36')]));_0x4791a5[_0xba75('0x35')]=_0x4791a5[_0xba75('0x35')][_0xba75('0x37')]?_0x4791a5['attributes']:_0x200715['model'];if(!_0x2808f0[_0xba75('0x33')][_0xba75('0x38')](_0xba75('0x39'))){_0x4791a5['limit']=qs[_0xba75('0x1c')](_0x2808f0[_0xba75('0x33')]['limit']);_0x4791a5['offset']=qs[_0xba75('0x1b')](_0x2808f0[_0xba75('0x33')][_0xba75('0x1b')]);}_0x4791a5[_0xba75('0x3a')]=qs[_0xba75('0x3b')](_0x2808f0['query']['sort']);_0x4791a5[_0xba75('0x3c')]=qs[_0xba75('0x34')](_[_0xba75('0x3d')](_0x2808f0[_0xba75('0x33')],_0x200715[_0xba75('0x34')]),_0x5a85ee);if(_0x2808f0[_0xba75('0x33')][_0xba75('0x3e')]){_0x4791a5['where']=_[_0xba75('0x3f')](_0x4791a5[_0xba75('0x3c')],{'$or':_['map'](_0x5a85ee,function(_0x1f28e8){if(_0x1f28e8[_0xba75('0x31')]!==_0xba75('0x40')){var _0x45d8cd={};_0x45d8cd[_0x1f28e8[_0xba75('0x2a')]]={'$like':'%'+_0x2808f0[_0xba75('0x33')][_0xba75('0x3e')]+'%'};return _0x45d8cd;}})});}_0x4791a5=_['merge']({},_0x4791a5,_0x2808f0[_0xba75('0x41')]);var _0x59d005={'where':_0x4791a5[_0xba75('0x3c')]};return db['Tag'][_0xba75('0x1e')](_0x59d005)[_0xba75('0x21')](function(_0x9c32ad){_0x481a04[_0xba75('0x1e')]=_0x9c32ad;if(_0x2808f0[_0xba75('0x33')][_0xba75('0x42')]){_0x4791a5[_0xba75('0x43')]=[{'all':!![]}];}return db[_0xba75('0x2e')][_0xba75('0x44')](_0x4791a5);})['then'](function(_0x30b5f0){_0x481a04[_0xba75('0x45')]=_0x30b5f0;return _0x481a04;})['then'](respondWithFilteredResult(_0x5d9f78,_0x4791a5))[_0xba75('0x46')](handleError(_0x5d9f78,null));};exports[_0xba75('0x47')]=function(_0x1130ac,_0x5bf935){var _0x5043a5={'raw':!![],'where':{'id':_0x1130ac['params']['id']}},_0x5c6491={};_0x5c6491[_0xba75('0x32')]=_['keys'](db[_0xba75('0x2e')][_0xba75('0x2f')]);_0x5c6491[_0xba75('0x33')]=_[_0xba75('0x48')](_0x1130ac[_0xba75('0x33')]);_0x5c6491['filters']=_['intersection'](_0x5c6491[_0xba75('0x32')],_0x5c6491['query']);_0x5043a5[_0xba75('0x35')]=_['intersection'](_0x5c6491[_0xba75('0x32')],qs[_0xba75('0x36')](_0x1130ac[_0xba75('0x33')][_0xba75('0x36')]));_0x5043a5['attributes']=_0x5043a5[_0xba75('0x35')][_0xba75('0x37')]?_0x5043a5[_0xba75('0x35')]:_0x5c6491[_0xba75('0x32')];if(_0x1130ac[_0xba75('0x33')][_0xba75('0x42')]){_0x5043a5[_0xba75('0x43')]=[{'all':!![]}];}_0x5043a5=_[_0xba75('0x3f')]({},_0x5043a5,_0x1130ac['options']);return db[_0xba75('0x2e')][_0xba75('0x49')](_0x5043a5)[_0xba75('0x21')](handleEntityNotFound(_0x5bf935,null))[_0xba75('0x21')](respondWithResult(_0x5bf935,null))[_0xba75('0x46')](handleError(_0x5bf935,null));};exports['create']=function(_0x2a1f84,_0x25ae33){return db[_0xba75('0x2e')][_0xba75('0x4a')](_0x2a1f84[_0xba75('0x4b')],{})[_0xba75('0x21')](function(_0x2c9085){var _0x5dc5f8=_0x2a1f84[_0xba75('0x4c')][_0xba75('0x23')]({'plain':!![]});if(!_0x5dc5f8)throw new Error(_0xba75('0x4d'));if(_0x5dc5f8['role']===_0xba75('0x4c')){var _0x29b4fc=_0x2c9085['get']({'plain':!![]});var _0x4d7e7e=_0xba75('0x24');return db['UserProfileSection']['find']({'where':{'name':_0x4d7e7e,'userProfileId':_0x5dc5f8[_0xba75('0x4e')]},'raw':!![]})['then'](function(_0xbb87b9){if(_0xbb87b9&&_0xbb87b9[_0xba75('0x4f')]===0x0){return db[_0xba75('0x25')][_0xba75('0x4a')]({'name':_0x29b4fc[_0xba75('0x2a')],'resourceId':_0x29b4fc['id'],'type':_0xbb87b9['name'],'sectionId':_0xbb87b9['id']},{})[_0xba75('0x21')](function(){return _0x2c9085;});}else{return _0x2c9085;}})[_0xba75('0x46')](function(_0x57aaa6){logger[_0xba75('0x28')](_0xba75('0x50'),_0x57aaa6);throw _0x57aaa6;});}return _0x2c9085;})[_0xba75('0x21')](respondWithResult(_0x25ae33,0xc9))[_0xba75('0x46')](handleError(_0x25ae33,null));};exports[_0xba75('0x51')]=function(_0x52b2c9,_0x43f4b7){if(_0x52b2c9[_0xba75('0x4b')]['id']){delete _0x52b2c9['body']['id'];}return db[_0xba75('0x2e')][_0xba75('0x49')]({'where':{'id':_0x52b2c9[_0xba75('0x52')]['id']}})[_0xba75('0x21')](handleEntityNotFound(_0x43f4b7,null))[_0xba75('0x21')](saveUpdates(_0x52b2c9[_0xba75('0x4b')],null))['then'](respondWithResult(_0x43f4b7,null))[_0xba75('0x46')](handleError(_0x43f4b7,null));};exports[_0xba75('0x22')]=function(_0x361efb,_0x429e26){return db[_0xba75('0x2e')][_0xba75('0x49')]({'where':{'id':_0x361efb['params']['id']}})['then'](handleEntityNotFound(_0x429e26,null))['then'](removeEntity(_0x429e26,null))['catch'](handleError(_0x429e26,null));}; \ No newline at end of file +var _0x4ea3=['order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','rawAttributes','keys','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','error','stack','name','send','map','Tag','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty'];(function(_0x3abd1d,_0x37af23){var _0x3a107d=function(_0x2378e7){while(--_0x2378e7){_0x3abd1d['push'](_0x3abd1d['shift']());}};_0x3a107d(++_0x37af23);}(_0x4ea3,0x70));var _0x34ea=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x4ea3[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require(_0x34ea('0x0'));var rimraf=require(_0x34ea('0x1'));var zipdir=require(_0x34ea('0x2'));var jsonpatch=require(_0x34ea('0x3'));var rp=require('request-promise');var moment=require(_0x34ea('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x34ea('0x5'));var util=require('util');var path=require('path');var sox=require(_0x34ea('0x6'));var csv=require(_0x34ea('0x7'));var ejs=require(_0x34ea('0x8'));var fs=require('fs');var fs_extra=require(_0x34ea('0x9'));var _=require(_0x34ea('0xa'));var squel=require(_0x34ea('0xb'));var crypto=require(_0x34ea('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x34ea('0xd'));var toCsv=require(_0x34ea('0x7'));var querystring=require(_0x34ea('0xe'));var Papa=require('papaparse');var Redis=require(_0x34ea('0xf'));var authService=require(_0x34ea('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x34ea('0x11'));var logger=require(_0x34ea('0x12'))(_0x34ea('0x13'));var utils=require('../../config/utils');var config=require(_0x34ea('0x14'));var licenseUtil=require(_0x34ea('0x15'));var db=require(_0x34ea('0x16'))['db'];function respondWithStatusCode(_0x233b11,_0x60725f){_0x60725f=_0x60725f||0xcc;return function(_0xc56a7d){if(_0xc56a7d){return _0x233b11[_0x34ea('0x17')](_0x60725f);}return _0x233b11[_0x34ea('0x18')](_0x60725f)[_0x34ea('0x19')]();};}function respondWithResult(_0x2a19c6,_0x36a4c6){_0x36a4c6=_0x36a4c6||0xc8;return function(_0x5ef9ae){if(_0x5ef9ae){return _0x2a19c6[_0x34ea('0x18')](_0x36a4c6)[_0x34ea('0x1a')](_0x5ef9ae);}};}function respondWithFilteredResult(_0x14ebb9,_0x3f9ffe){return function(_0x44e44e){if(_0x44e44e){var _0x56b2d7=typeof _0x3f9ffe[_0x34ea('0x1b')]===_0x34ea('0x1c')&&typeof _0x3f9ffe[_0x34ea('0x1d')]===_0x34ea('0x1c');var _0x5f420f=_0x44e44e[_0x34ea('0x1e')];var _0x34caea=_0x56b2d7?0x0:_0x3f9ffe[_0x34ea('0x1b')];var _0x5340a4=_0x56b2d7?_0x44e44e[_0x34ea('0x1e')]:_0x3f9ffe[_0x34ea('0x1b')]+_0x3f9ffe[_0x34ea('0x1d')];var _0x127308;if(_0x5340a4>=_0x5f420f){_0x5340a4=_0x5f420f;_0x127308=0xc8;}else{_0x127308=0xce;}_0x14ebb9['status'](_0x127308);return _0x14ebb9[_0x34ea('0x1f')](_0x34ea('0x20'),_0x34caea+'-'+_0x5340a4+'/'+_0x5f420f)[_0x34ea('0x1a')](_0x44e44e);}return null;};}function patchUpdates(_0x247ee7){return function(_0x4fc1a2){try{jsonpatch['apply'](_0x4fc1a2,_0x247ee7,!![]);}catch(_0xe3b292){return BPromise[_0x34ea('0x21')](_0xe3b292);}return _0x4fc1a2[_0x34ea('0x22')]();};}function saveUpdates(_0x51022f,_0x5197a2){return function(_0x2eafc6){if(_0x2eafc6){return _0x2eafc6[_0x34ea('0x23')](_0x51022f)[_0x34ea('0x24')](function(_0x30c4b0){return _0x30c4b0;});}return null;};}function removeEntity(_0x12e7e9,_0x697475){return function(_0x5ade46){if(_0x5ade46){return _0x5ade46[_0x34ea('0x25')]()[_0x34ea('0x24')](function(){var _0x3c0983=_0x5ade46[_0x34ea('0x26')]({'plain':!![]});var _0x5b5885='Tags';return db['UserProfileResource'][_0x34ea('0x25')]({'where':{'type':_0x5b5885,'resourceId':_0x3c0983['id']}})[_0x34ea('0x24')](function(){return _0x5ade46;});})[_0x34ea('0x24')](function(){_0x12e7e9[_0x34ea('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26c80b,_0x267083){return function(_0x27c6f7){if(!_0x27c6f7){_0x26c80b['sendStatus'](0x194);}return _0x27c6f7;};}function handleError(_0x4cded8,_0x5b4727){_0x5b4727=_0x5b4727||0x1f4;return function(_0x4d4360){logger[_0x34ea('0x27')](_0x4d4360[_0x34ea('0x28')]);if(_0x4d4360[_0x34ea('0x29')]){delete _0x4d4360[_0x34ea('0x29')];}_0x4cded8['status'](_0x5b4727)[_0x34ea('0x2a')](_0x4d4360);};}exports['index']=function(_0x2c6de8,_0x4f2b77){var _0x3272f9={},_0x14e018={},_0x3cb968={'count':0x0,'rows':[]};var _0x57b19d=_[_0x34ea('0x2b')](db[_0x34ea('0x2c')]['rawAttributes'],function(_0x10bcfe){return{'name':_0x10bcfe['fieldName'],'type':_0x10bcfe[_0x34ea('0x2d')][_0x34ea('0x2e')]};});_0x14e018[_0x34ea('0x2f')]=_['map'](_0x57b19d,'name');_0x14e018[_0x34ea('0x30')]=_['keys'](_0x2c6de8[_0x34ea('0x30')]);_0x14e018[_0x34ea('0x31')]=_['intersection'](_0x14e018[_0x34ea('0x2f')],_0x14e018[_0x34ea('0x30')]);_0x3272f9[_0x34ea('0x32')]=_[_0x34ea('0x33')](_0x14e018['model'],qs['fields'](_0x2c6de8['query'][_0x34ea('0x34')]));_0x3272f9[_0x34ea('0x32')]=_0x3272f9[_0x34ea('0x32')]['length']?_0x3272f9['attributes']:_0x14e018['model'];if(!_0x2c6de8[_0x34ea('0x30')][_0x34ea('0x35')]('nolimit')){_0x3272f9[_0x34ea('0x1d')]=qs[_0x34ea('0x1d')](_0x2c6de8[_0x34ea('0x30')][_0x34ea('0x1d')]);_0x3272f9[_0x34ea('0x1b')]=qs[_0x34ea('0x1b')](_0x2c6de8['query'][_0x34ea('0x1b')]);}_0x3272f9[_0x34ea('0x36')]=qs[_0x34ea('0x37')](_0x2c6de8[_0x34ea('0x30')]['sort']);_0x3272f9['where']=qs[_0x34ea('0x31')](_[_0x34ea('0x38')](_0x2c6de8[_0x34ea('0x30')],_0x14e018[_0x34ea('0x31')]),_0x57b19d);if(_0x2c6de8[_0x34ea('0x30')]['filter']){_0x3272f9[_0x34ea('0x39')]=_[_0x34ea('0x3a')](_0x3272f9[_0x34ea('0x39')],{'$or':_[_0x34ea('0x2b')](_0x57b19d,function(_0x5787db){if(_0x5787db[_0x34ea('0x2d')]!==_0x34ea('0x3b')){var _0xa1ff39={};_0xa1ff39[_0x5787db[_0x34ea('0x29')]]={'$like':'%'+_0x2c6de8[_0x34ea('0x30')][_0x34ea('0x3c')]+'%'};return _0xa1ff39;}})});}_0x3272f9=_[_0x34ea('0x3a')]({},_0x3272f9,_0x2c6de8[_0x34ea('0x3d')]);var _0x41fefb={'where':_0x3272f9[_0x34ea('0x39')]};return db[_0x34ea('0x2c')]['count'](_0x41fefb)[_0x34ea('0x24')](function(_0x4ae353){_0x3cb968[_0x34ea('0x1e')]=_0x4ae353;if(_0x2c6de8[_0x34ea('0x30')][_0x34ea('0x3e')]){_0x3272f9[_0x34ea('0x3f')]=[{'all':!![]}];}return db[_0x34ea('0x2c')][_0x34ea('0x40')](_0x3272f9);})[_0x34ea('0x24')](function(_0x17ba01){_0x3cb968[_0x34ea('0x41')]=_0x17ba01;return _0x3cb968;})['then'](respondWithFilteredResult(_0x4f2b77,_0x3272f9))[_0x34ea('0x42')](handleError(_0x4f2b77,null));};exports['show']=function(_0x45f170,_0x273a51){var _0x39bc9a={'raw':!![],'where':{'id':_0x45f170[_0x34ea('0x43')]['id']}},_0x379282={};_0x379282[_0x34ea('0x2f')]=_['keys'](db[_0x34ea('0x2c')][_0x34ea('0x44')]);_0x379282['query']=_[_0x34ea('0x45')](_0x45f170[_0x34ea('0x30')]);_0x379282[_0x34ea('0x31')]=_[_0x34ea('0x33')](_0x379282[_0x34ea('0x2f')],_0x379282['query']);_0x39bc9a[_0x34ea('0x32')]=_[_0x34ea('0x33')](_0x379282[_0x34ea('0x2f')],qs[_0x34ea('0x34')](_0x45f170[_0x34ea('0x30')][_0x34ea('0x34')]));_0x39bc9a['attributes']=_0x39bc9a['attributes'][_0x34ea('0x46')]?_0x39bc9a[_0x34ea('0x32')]:_0x379282[_0x34ea('0x2f')];if(_0x45f170['query'][_0x34ea('0x3e')]){_0x39bc9a['include']=[{'all':!![]}];}_0x39bc9a=_[_0x34ea('0x3a')]({},_0x39bc9a,_0x45f170['options']);return db[_0x34ea('0x2c')][_0x34ea('0x47')](_0x39bc9a)[_0x34ea('0x24')](handleEntityNotFound(_0x273a51,null))['then'](respondWithResult(_0x273a51,null))[_0x34ea('0x42')](handleError(_0x273a51,null));};exports['create']=function(_0x404a59,_0x3fb739){return db[_0x34ea('0x2c')][_0x34ea('0x48')](_0x404a59['body'],{})[_0x34ea('0x24')](function(_0x2d07cf){var _0x312ff8=_0x404a59[_0x34ea('0x49')][_0x34ea('0x26')]({'plain':!![]});if(!_0x312ff8)throw new Error(_0x34ea('0x4a'));if(_0x312ff8[_0x34ea('0x4b')]==='user'){var _0x1059dc=_0x2d07cf[_0x34ea('0x26')]({'plain':!![]});var _0x26ea1d=_0x34ea('0x4c');return db[_0x34ea('0x4d')][_0x34ea('0x47')]({'where':{'name':_0x26ea1d,'userProfileId':_0x312ff8[_0x34ea('0x4e')]},'raw':!![]})[_0x34ea('0x24')](function(_0x11a9f7){if(_0x11a9f7&&_0x11a9f7[_0x34ea('0x4f')]===0x0){return db[_0x34ea('0x50')][_0x34ea('0x48')]({'name':_0x1059dc[_0x34ea('0x29')],'resourceId':_0x1059dc['id'],'type':_0x11a9f7['name'],'sectionId':_0x11a9f7['id']},{})[_0x34ea('0x24')](function(){return _0x2d07cf;});}else{return _0x2d07cf;}})[_0x34ea('0x42')](function(_0x33f7c6){logger['error'](_0x34ea('0x51'),_0x33f7c6);throw _0x33f7c6;});}return _0x2d07cf;})['then'](respondWithResult(_0x3fb739,0xc9))[_0x34ea('0x42')](handleError(_0x3fb739,null));};exports[_0x34ea('0x23')]=function(_0x47aab6,_0xe8d397){if(_0x47aab6[_0x34ea('0x52')]['id']){delete _0x47aab6[_0x34ea('0x52')]['id'];}return db['Tag']['find']({'where':{'id':_0x47aab6[_0x34ea('0x43')]['id']}})['then'](handleEntityNotFound(_0xe8d397,null))['then'](saveUpdates(_0x47aab6[_0x34ea('0x52')],null))['then'](respondWithResult(_0xe8d397,null))[_0x34ea('0x42')](handleError(_0xe8d397,null));};exports[_0x34ea('0x25')]=function(_0x3918c5,_0x443c98){return db[_0x34ea('0x2c')][_0x34ea('0x47')]({'where':{'id':_0x3918c5[_0x34ea('0x43')]['id']}})[_0x34ea('0x24')](handleEntityNotFound(_0x443c98,null))[_0x34ea('0x24')](removeEntity(_0x443c98,null))[_0x34ea('0x42')](handleError(_0x443c98,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 1508514..29f3b77 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 _0xc570=['bluebird','request-promise','path','rimraf','define','Tag','tools_tags','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc570,0x142));var _0x0c57=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xc570[_0x54d4fe];return _0x1ab5bb;};'use strict';var _=require('lodash');var util=require(_0x0c57('0x0'));var logger=require(_0x0c57('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0c57('0x2'));var rp=require(_0x0c57('0x3'));var fs=require('fs');var path=require(_0x0c57('0x4'));var rimraf=require(_0x0c57('0x5'));var config=require('../../config/environment');var attributes=require('./tag.attributes');module['exports']=function(_0x50c5a9,_0x139f94){return _0x50c5a9[_0x0c57('0x6')](_0x0c57('0x7'),attributes,{'tableName':_0x0c57('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb70f=['./tag.attributes','exports','define','Tag','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x1f8d59,_0xacff75){var _0x3ad5f1=function(_0x4e2af1){while(--_0x4e2af1){_0x1f8d59['push'](_0x1f8d59['shift']());}};_0x3ad5f1(++_0xacff75);}(_0xb70f,0xba));var _0xfb70=function(_0x1df200,_0x54e950){_0x1df200=_0x1df200-0x0;var _0x261c50=_0xb70f[_0x1df200];return _0x261c50;};'use strict';var _=require(_0xfb70('0x0'));var util=require(_0xfb70('0x1'));var logger=require(_0xfb70('0x2'))(_0xfb70('0x3'));var moment=require(_0xfb70('0x4'));var BPromise=require('bluebird');var rp=require(_0xfb70('0x5'));var fs=require('fs');var path=require(_0xfb70('0x6'));var rimraf=require(_0xfb70('0x7'));var config=require(_0xfb70('0x8'));var attributes=require(_0xfb70('0x9'));module[_0xfb70('0xa')]=function(_0x50030a,_0x92b73b){return _0x50030a[_0xfb70('0xb')](_0xfb70('0xc'),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 eec0f49..94e2fd6 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 _0x54f3=['moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','http','then','info','Tag,\x20%s,\x20%s','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','util'];(function(_0xd6f6ad,_0x228271){var _0x43768c=function(_0x332fbe){while(--_0x332fbe){_0xd6f6ad['push'](_0xd6f6ad['shift']());}};_0x43768c(++_0x228271);}(_0x54f3,0x120));var _0x354f=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x54f3[_0x178e48];return _0x440d7e;};'use strict';var _=require('lodash');var util=require(_0x354f('0x0'));var moment=require(_0x354f('0x1'));var BPromise=require(_0x354f('0x2'));var rs=require(_0x354f('0x3'));var fs=require('fs');var Redis=require(_0x354f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x354f('0x5'))(_0x354f('0x6'));var config=require(_0x354f('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x354f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x51cd16,_0x1da503,_0x4311ad){return new BPromise(function(_0x2f111a,_0x173e1d){return client['request'](_0x51cd16,_0x4311ad)[_0x354f('0x9')](function(_0x5d1e5d){logger[_0x354f('0xa')](_0x354f('0xb'),_0x1da503,'request\x20sent');logger['debug'](_0x354f('0xc'),_0x1da503,_0x354f('0xd'),JSON['stringify'](_0x5d1e5d));if(_0x5d1e5d[_0x354f('0xe')]){if(_0x5d1e5d[_0x354f('0xe')]['code']===0x1f4){logger[_0x354f('0xe')](_0x354f('0xb'),_0x1da503,_0x5d1e5d[_0x354f('0xe')][_0x354f('0xf')]);return _0x173e1d(_0x5d1e5d[_0x354f('0xe')][_0x354f('0xf')]);}logger[_0x354f('0xe')]('Tag,\x20%s,\x20%s',_0x1da503,_0x5d1e5d[_0x354f('0xe')][_0x354f('0xf')]);return _0x2f111a(_0x5d1e5d[_0x354f('0xe')]['message']);}else{logger[_0x354f('0xa')](_0x354f('0xb'),_0x1da503,_0x354f('0xd'));_0x2f111a(_0x5d1e5d['result']['message']);}})[_0x354f('0x10')](function(_0x1d7627){logger[_0x354f('0xe')](_0x354f('0xb'),_0x1da503,_0x1d7627);_0x173e1d(_0x1d7627);});});} \ No newline at end of file +var _0x6737=['stringify','error','code','message','info','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','Tag,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x12f56c,_0x24840d){var _0xac1fde=function(_0xc61eb){while(--_0xc61eb){_0x12f56c['push'](_0x12f56c['shift']());}};_0xac1fde(++_0x24840d);}(_0x6737,0xe2));var _0x7673=function(_0x52fa55,_0x3e67d7){_0x52fa55=_0x52fa55-0x0;var _0x31392e=_0x6737[_0x52fa55];return _0x31392e;};'use strict';var _=require('lodash');var util=require(_0x7673('0x0'));var moment=require(_0x7673('0x1'));var BPromise=require('bluebird');var rs=require(_0x7673('0x2'));var fs=require('fs');var Redis=require(_0x7673('0x3'));var db=require(_0x7673('0x4'))['db'];var utils=require(_0x7673('0x5'));var logger=require('../../config/logger')(_0x7673('0x6'));var config=require(_0x7673('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7673('0x8')][_0x7673('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5af802,_0x4e4b24,_0x53d67d){return new BPromise(function(_0x5292f7,_0x285c6d){return client['request'](_0x5af802,_0x53d67d)[_0x7673('0xa')](function(_0x1fb769){logger['info'](_0x7673('0xb'),_0x4e4b24,_0x7673('0xc'));logger[_0x7673('0xd')]('Tag,\x20%s,\x20%s,\x20%s',_0x4e4b24,'request\x20sent',JSON[_0x7673('0xe')](_0x1fb769));if(_0x1fb769['error']){if(_0x1fb769[_0x7673('0xf')][_0x7673('0x10')]===0x1f4){logger[_0x7673('0xf')](_0x7673('0xb'),_0x4e4b24,_0x1fb769[_0x7673('0xf')][_0x7673('0x11')]);return _0x285c6d(_0x1fb769[_0x7673('0xf')][_0x7673('0x11')]);}logger[_0x7673('0xf')](_0x7673('0xb'),_0x4e4b24,_0x1fb769['error'][_0x7673('0x11')]);return _0x5292f7(_0x1fb769[_0x7673('0xf')][_0x7673('0x11')]);}else{logger[_0x7673('0x12')](_0x7673('0xb'),_0x4e4b24,_0x7673('0xc'));_0x5292f7(_0x1fb769[_0x7673('0x13')]['message']);}})['catch'](function(_0x164d05){logger[_0x7673('0xf')]('Tag,\x20%s,\x20%s',_0x4e4b24,_0x164d05);_0x285c6d(_0x164d05);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index c4278e1..8ca5ff4 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index f174cbe..37ae642 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 _0xbaf0=['name','exports','STRING'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file +var _0x0713=['STRING','name'];(function(_0x332d04,_0x969e42){var _0x1661f6=function(_0x5431b0){while(--_0x5431b0){_0x332d04['push'](_0x332d04['shift']());}};_0x1661f6(++_0x969e42);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 225d15d..f8fd9ad 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 _0x6281=['defaults','redis','socket.io-emitter','./team.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','get','Teams','UserProfileResource','error','stack','name','index','Team','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getQueues','findOne','channel','Sequelize','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','order','Queues','addQueues','add','removeQueues','isValidChannel','remove','ids','addAgents','Voice','Chat','Mail','Sms','Openchannel','Whatsapp','transaction','through','QueueId','TeamVoiceQueue','penalty','User','findOrCreate','Queue:save','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','all','spread','removeAgents','Fax','parse','emit','Queue:remove','getAgents','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x4168ef,_0x1d0494){var _0xc1eeeb=function(_0x590150){while(--_0x590150){_0x4168ef['push'](_0x4168ef['shift']());}};_0xc1eeeb(++_0x1d0494);}(_0x6281,0x101));var _0x1628=function(_0x4dbcd6,_0x34326c){_0x4dbcd6=_0x4dbcd6-0x0;var _0x541e55=_0x6281[_0x4dbcd6];return _0x541e55;};'use strict';var emlformat=require(_0x1628('0x0'));var rimraf=require(_0x1628('0x1'));var zipdir=require(_0x1628('0x2'));var jsonpatch=require(_0x1628('0x3'));var rp=require('request-promise');var moment=require(_0x1628('0x4'));var BPromise=require(_0x1628('0x5'));var Mustache=require(_0x1628('0x6'));var util=require('util');var path=require(_0x1628('0x7'));var sox=require(_0x1628('0x8'));var csv=require(_0x1628('0x9'));var ejs=require(_0x1628('0xa'));var fs=require('fs');var fs_extra=require(_0x1628('0xb'));var _=require(_0x1628('0xc'));var squel=require(_0x1628('0xd'));var crypto=require(_0x1628('0xe'));var jsforce=require(_0x1628('0xf'));var deskjs=require(_0x1628('0x10'));var toCsv=require(_0x1628('0x9'));var querystring=require('querystring');var Papa=require(_0x1628('0x11'));var Redis=require(_0x1628('0x12'));var authService=require(_0x1628('0x13'));var qs=require(_0x1628('0x14'));var as=require(_0x1628('0x15'));var hardwareService=require(_0x1628('0x16'));var logger=require(_0x1628('0x17'))('api');var utils=require(_0x1628('0x18'));var config=require(_0x1628('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x1628('0x1a'))['db'];config['redis']=_[_0x1628('0x1b')](config[_0x1628('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x1628('0x1d'))(new Redis(config[_0x1628('0x1c')]));require(_0x1628('0x1e'))[_0x1628('0x1f')](socket);function respondWithStatusCode(_0x1b6392,_0x3984af){_0x3984af=_0x3984af||0xcc;return function(_0x1b7f97){if(_0x1b7f97){return _0x1b6392[_0x1628('0x20')](_0x3984af);}return _0x1b6392[_0x1628('0x21')](_0x3984af)[_0x1628('0x22')]();};}function respondWithResult(_0x323b12,_0x44e681){_0x44e681=_0x44e681||0xc8;return function(_0x4ad4d0){if(_0x4ad4d0){return _0x323b12[_0x1628('0x21')](_0x44e681)[_0x1628('0x23')](_0x4ad4d0);}};}function respondWithFilteredResult(_0x42b578,_0x59cac){return function(_0x6b10a){if(_0x6b10a){var _0x3e497d=typeof _0x59cac[_0x1628('0x24')]==='undefined'&&typeof _0x59cac['limit']===_0x1628('0x25');var _0x1ad1be=_0x6b10a[_0x1628('0x26')];var _0x32037b=_0x3e497d?0x0:_0x59cac[_0x1628('0x24')];var _0x7f595=_0x3e497d?_0x6b10a[_0x1628('0x26')]:_0x59cac['offset']+_0x59cac[_0x1628('0x27')];var _0x1a134a;if(_0x7f595>=_0x1ad1be){_0x7f595=_0x1ad1be;_0x1a134a=0xc8;}else{_0x1a134a=0xce;}_0x42b578[_0x1628('0x21')](_0x1a134a);return _0x42b578[_0x1628('0x28')](_0x1628('0x29'),_0x32037b+'-'+_0x7f595+'/'+_0x1ad1be)['json'](_0x6b10a);}return null;};}function patchUpdates(_0x1606ef){return function(_0x277c7e){try{jsonpatch[_0x1628('0x2a')](_0x277c7e,_0x1606ef,!![]);}catch(_0x2cf378){return BPromise[_0x1628('0x2b')](_0x2cf378);}return _0x277c7e['save']();};}function saveUpdates(_0x1a937b,_0x43fa26){return function(_0xe47088){if(_0xe47088){return _0xe47088[_0x1628('0x2c')](_0x1a937b)[_0x1628('0x2d')](function(_0x4f0409){return _0x4f0409;});}return null;};}function removeEntity(_0x4c678b,_0x3232d3){return function(_0x1f3e13){if(_0x1f3e13){return _0x1f3e13[_0x1628('0x2e')]()['then'](function(){var _0x5a4eab=_0x1f3e13[_0x1628('0x2f')]({'plain':!![]});var _0x73df94=_0x1628('0x30');return db[_0x1628('0x31')][_0x1628('0x2e')]({'where':{'type':_0x73df94,'resourceId':_0x5a4eab['id']}})['then'](function(){return _0x1f3e13;});})[_0x1628('0x2d')](function(){_0x4c678b[_0x1628('0x21')](0xcc)[_0x1628('0x22')]();});}};}function handleEntityNotFound(_0x1264de,_0x3c38bc){return function(_0x3b557c){if(!_0x3b557c){_0x1264de[_0x1628('0x20')](0x194);}return _0x3b557c;};}function handleError(_0x168fd5,_0x178683){_0x178683=_0x178683||0x1f4;return function(_0x365002){logger[_0x1628('0x32')](_0x365002[_0x1628('0x33')]);if(_0x365002[_0x1628('0x34')]){delete _0x365002[_0x1628('0x34')];}_0x168fd5[_0x1628('0x21')](_0x178683)['send'](_0x365002);};}exports[_0x1628('0x35')]=function(_0x1fd623,_0x4908d7){var _0x9464ad={},_0x3dd548={},_0x12d8c3={'count':0x0,'rows':[]};var _0x37325a=_['map'](db[_0x1628('0x36')][_0x1628('0x37')],function(_0x4b9977){return{'name':_0x4b9977[_0x1628('0x38')],'type':_0x4b9977[_0x1628('0x39')][_0x1628('0x3a')]};});_0x3dd548[_0x1628('0x3b')]=_[_0x1628('0x3c')](_0x37325a,'name');_0x3dd548[_0x1628('0x3d')]=_[_0x1628('0x3e')](_0x1fd623[_0x1628('0x3d')]);_0x3dd548[_0x1628('0x3f')]=_[_0x1628('0x40')](_0x3dd548[_0x1628('0x3b')],_0x3dd548[_0x1628('0x3d')]);_0x9464ad[_0x1628('0x41')]=_[_0x1628('0x40')](_0x3dd548[_0x1628('0x3b')],qs[_0x1628('0x42')](_0x1fd623[_0x1628('0x3d')][_0x1628('0x42')]));_0x9464ad[_0x1628('0x41')]=_0x9464ad[_0x1628('0x41')][_0x1628('0x43')]?_0x9464ad['attributes']:_0x3dd548[_0x1628('0x3b')];if(!_0x1fd623[_0x1628('0x3d')]['hasOwnProperty'](_0x1628('0x44'))){_0x9464ad['limit']=qs[_0x1628('0x27')](_0x1fd623[_0x1628('0x3d')][_0x1628('0x27')]);_0x9464ad[_0x1628('0x24')]=qs[_0x1628('0x24')](_0x1fd623[_0x1628('0x3d')]['offset']);}_0x9464ad['order']=qs[_0x1628('0x45')](_0x1fd623[_0x1628('0x3d')][_0x1628('0x45')]);_0x9464ad['where']=qs[_0x1628('0x3f')](_[_0x1628('0x46')](_0x1fd623[_0x1628('0x3d')],_0x3dd548[_0x1628('0x3f')]),_0x37325a);if(_0x1fd623[_0x1628('0x3d')][_0x1628('0x47')]){_0x9464ad['where']=_['merge'](_0x9464ad[_0x1628('0x48')],{'$or':_[_0x1628('0x3c')](_0x37325a,function(_0x3d23f4){if(_0x3d23f4['type']!==_0x1628('0x49')){var _0x8c34c5={};_0x8c34c5[_0x3d23f4['name']]={'$like':'%'+_0x1fd623['query']['filter']+'%'};return _0x8c34c5;}})});}_0x9464ad=_[_0x1628('0x4a')]({},_0x9464ad,_0x1fd623[_0x1628('0x4b')]);var _0xa01f7a={'where':_0x9464ad['where']};return db[_0x1628('0x36')]['count'](_0xa01f7a)[_0x1628('0x2d')](function(_0x18739e){_0x12d8c3[_0x1628('0x26')]=_0x18739e;if(_0x1fd623['query'][_0x1628('0x4c')]){_0x9464ad[_0x1628('0x4d')]=[{'all':!![]}];}return db['Team'][_0x1628('0x4e')](_0x9464ad);})[_0x1628('0x2d')](function(_0x2a1af7){_0x12d8c3[_0x1628('0x4f')]=_0x2a1af7;return _0x12d8c3;})[_0x1628('0x2d')](respondWithFilteredResult(_0x4908d7,_0x9464ad))[_0x1628('0x50')](handleError(_0x4908d7,null));};exports[_0x1628('0x51')]=function(_0x4de69f,_0x556d89){var _0x1eb7d4={'raw':![],'where':{'id':_0x4de69f[_0x1628('0x52')]['id']}},_0x8d1c88={};_0x8d1c88['model']=_[_0x1628('0x3e')](db[_0x1628('0x36')][_0x1628('0x37')]);_0x8d1c88['query']=_['keys'](_0x4de69f['query']);_0x8d1c88[_0x1628('0x3f')]=_[_0x1628('0x40')](_0x8d1c88[_0x1628('0x3b')],_0x8d1c88[_0x1628('0x3d')]);_0x1eb7d4[_0x1628('0x41')]=_[_0x1628('0x40')](_0x8d1c88[_0x1628('0x3b')],qs['fields'](_0x4de69f['query'][_0x1628('0x42')]));_0x1eb7d4[_0x1628('0x41')]=_0x1eb7d4[_0x1628('0x41')][_0x1628('0x43')]?_0x1eb7d4[_0x1628('0x41')]:_0x8d1c88['model'];if(_0x4de69f[_0x1628('0x3d')][_0x1628('0x4c')]){_0x1eb7d4[_0x1628('0x4d')]=[{'all':!![]}];}_0x1eb7d4=_[_0x1628('0x4a')]({},_0x1eb7d4,_0x4de69f[_0x1628('0x4b')]);return db[_0x1628('0x36')][_0x1628('0x53')](_0x1eb7d4)['then'](handleEntityNotFound(_0x556d89,null))[_0x1628('0x2d')](respondWithResult(_0x556d89,null))[_0x1628('0x50')](handleError(_0x556d89,null));};exports[_0x1628('0x54')]=function(_0x23232e,_0x1f2d47){return db['Team'][_0x1628('0x54')](_0x23232e[_0x1628('0x55')],{})[_0x1628('0x2d')](function(_0x11e4e0){var _0xfc411d=_0x23232e[_0x1628('0x56')][_0x1628('0x2f')]({'plain':!![]});if(!_0xfc411d)throw new Error(_0x1628('0x57'));if(_0xfc411d[_0x1628('0x58')]===_0x1628('0x56')){var _0x27e7c6=_0x11e4e0[_0x1628('0x2f')]({'plain':!![]});var _0x4af975=_0x1628('0x30');return db[_0x1628('0x59')][_0x1628('0x53')]({'where':{'name':_0x4af975,'userProfileId':_0xfc411d[_0x1628('0x5a')]},'raw':!![]})[_0x1628('0x2d')](function(_0x153563){if(_0x153563&&_0x153563[_0x1628('0x5b')]===0x0){return db[_0x1628('0x31')][_0x1628('0x54')]({'name':_0x27e7c6[_0x1628('0x34')],'resourceId':_0x27e7c6['id'],'type':_0x153563[_0x1628('0x34')],'sectionId':_0x153563['id']},{})['then'](function(){return _0x11e4e0;});}else{return _0x11e4e0;}})['catch'](function(_0x3ada70){logger[_0x1628('0x32')](_0x1628('0x5c'),_0x3ada70);throw _0x3ada70;});}return _0x11e4e0;})[_0x1628('0x2d')](respondWithResult(_0x1f2d47,0xc9))['catch'](handleError(_0x1f2d47,null));};exports[_0x1628('0x2c')]=function(_0x2ccfa8,_0x49dbb9){if(_0x2ccfa8[_0x1628('0x55')]['id']){delete _0x2ccfa8['body']['id'];}return db[_0x1628('0x36')]['find']({'where':{'id':_0x2ccfa8['params']['id']}})['then'](handleEntityNotFound(_0x49dbb9,null))[_0x1628('0x2d')](saveUpdates(_0x2ccfa8[_0x1628('0x55')],null))[_0x1628('0x2d')](respondWithResult(_0x49dbb9,null))['catch'](handleError(_0x49dbb9,null));};exports['destroy']=function(_0x468fbe,_0x16b419){return db['Team'][_0x1628('0x53')]({'where':{'id':_0x468fbe[_0x1628('0x52')]['id']}})[_0x1628('0x2d')](handleEntityNotFound(_0x16b419,null))[_0x1628('0x2d')](removeEntity(_0x16b419,null))[_0x1628('0x50')](handleError(_0x16b419,null));};exports[_0x1628('0x5d')]=function(_0x4ebb54,_0xc0e19a,_0x433d4d){return db[_0x1628('0x36')][_0x1628('0x5e')]({'where':{'id':_0x4ebb54[_0x1628('0x52')]['id']}})['then'](handleEntityNotFound(_0xc0e19a,null))[_0x1628('0x2d')](function(_0x3152f0){if(!_0x4ebb54['query']['channel']||!utils['isValidChannel'](_0x4ebb54['query'][_0x1628('0x5f')])){throw new db[(_0x1628('0x60'))][(_0x1628('0x61'))](_0x1628('0x62'));}var _0x26be32={};var _0x3bc953={};_0x3bc953['model']=_[_0x1628('0x3e')](db[_[_0x1628('0x63')](_0x4ebb54[_0x1628('0x3d')]['channel'][_0x1628('0x64')]())+_0x1628('0x65')][_0x1628('0x37')]);_0x3bc953[_0x1628('0x3d')]=_[_0x1628('0x3e')](_0x4ebb54['query']);_0x3bc953[_0x1628('0x3f')]=_['intersection'](_0x3bc953['model'],_0x3bc953[_0x1628('0x3d')]);_0x26be32[_0x1628('0x41')]=_[_0x1628('0x40')](_0x3bc953[_0x1628('0x3b')],qs[_0x1628('0x42')](_0x4ebb54['query'][_0x1628('0x42')]));_0x26be32['attributes']=_0x26be32[_0x1628('0x41')][_0x1628('0x43')]?_0x26be32[_0x1628('0x41')]:_0x3bc953[_0x1628('0x3b')];_0x26be32[_0x1628('0x27')]=qs['limit'](_0x4ebb54[_0x1628('0x3d')][_0x1628('0x27')]);_0x26be32['offset']=qs[_0x1628('0x24')](_0x4ebb54[_0x1628('0x3d')]['offset']);_0x26be32[_0x1628('0x66')]=qs['sort'](_0x4ebb54[_0x1628('0x3d')][_0x1628('0x45')]);_0x26be32[_0x1628('0x48')]=qs['filters'](_['pick'](_0x4ebb54[_0x1628('0x3d')],_0x3bc953[_0x1628('0x3f')]));_0x26be32=_[_0x1628('0x4a')]({},_0x26be32,_0x4ebb54[_0x1628('0x4b')]);return _0x3152f0[_0x1628('0x2f')+_[_0x1628('0x63')](_0x4ebb54[_0x1628('0x3d')]['channel'][_0x1628('0x64')]())+_0x1628('0x67')](_0x26be32);})[_0x1628('0x2d')](respondWithResult(_0xc0e19a,null))[_0x1628('0x50')](handleError(_0xc0e19a,null));};exports[_0x1628('0x68')]=function(_0x4a7b08,_0x4f1333,_0xfca100){return db[_0x1628('0x36')][_0x1628('0x5e')]({'where':{'id':_0x4a7b08[_0x1628('0x52')]['id']}})[_0x1628('0x2d')](function(_0xf17705){if(_0xf17705){if(!_0x4a7b08[_0x1628('0x55')][_0x1628('0x5f')]||!utils['isValidChannel'](_0x4a7b08[_0x1628('0x55')][_0x1628('0x5f')])){throw new db['Sequelize'][(_0x1628('0x61'))]('Unknown\x20channel');}return _0xf17705[_0x1628('0x69')+_['capitalize'](_0x4a7b08[_0x1628('0x55')][_0x1628('0x5f')][_0x1628('0x64')]())+_0x1628('0x67')](_0x4a7b08[_0x1628('0x55')]['ids']);}return null;})[_0x1628('0x2d')](handleEntityNotFound(_0x4f1333,null))['then'](respondWithStatusCode(_0x4f1333,null))[_0x1628('0x50')](handleError(_0x4f1333,null));};exports[_0x1628('0x6a')]=function(_0x35736f,_0xc68d47,_0x1b6f92){return db['Team'][_0x1628('0x5e')]({'where':{'id':_0x35736f[_0x1628('0x52')]['id']}})[_0x1628('0x2d')](function(_0x4a9ee1){if(_0x4a9ee1){if(!_0x35736f[_0x1628('0x3d')][_0x1628('0x5f')]||!utils[_0x1628('0x6b')](_0x35736f[_0x1628('0x3d')][_0x1628('0x5f')])){throw new db[(_0x1628('0x60'))][(_0x1628('0x61'))](_0x1628('0x62'));}return _0x4a9ee1[_0x1628('0x6c')+_[_0x1628('0x63')](_0x35736f[_0x1628('0x3d')][_0x1628('0x5f')][_0x1628('0x64')]())+_0x1628('0x67')](_0x35736f[_0x1628('0x3d')][_0x1628('0x6d')]);}return null;})[_0x1628('0x2d')](handleEntityNotFound(_0xc68d47,null))[_0x1628('0x2d')](respondWithStatusCode(_0xc68d47,null))['catch'](handleError(_0xc68d47,null));};exports[_0x1628('0x6e')]=function(_0x50399e,_0xd5354c){return db[_0x1628('0x36')][_0x1628('0x53')]({'where':{'id':_0x50399e[_0x1628('0x52')]['id']}})[_0x1628('0x2d')](handleEntityNotFound(_0xd5354c,null))[_0x1628('0x2d')](function(_0x4e89c9){if(_0x4e89c9){var _0xdeb8b0=[_0x1628('0x6f'),_0x1628('0x70'),_0x1628('0x71'),_0x1628('0x72'),'Fax',_0x1628('0x73'),_0x1628('0x74')];return db['sequelize'][_0x1628('0x75')](function(_0x50222f){var _0x399cc0=_[_0x1628('0x3c')](_0xdeb8b0,function(_0x31b2d4){var _0x470369={'attributes':['id',_0x1628('0x34')]};if(_0x31b2d4===_0x1628('0x6f')){_0x470369[_0x1628('0x76')]={'attributes':['penalty']};}return _0x4e89c9['get'+_0x31b2d4+_0x1628('0x67')](_0x470369)['then'](function(_0x404159){var _0xbe7e69=_[_0x1628('0x3c')](_0x404159,function(_0x4718c0){var _0x4eb953=_[_0x1628('0x3c')](_0x50399e[_0x1628('0x55')]['ids'],function(_0x3c04f5){var _0x31a76a={'where':{'UserId':_0x3c04f5,[_0x31b2d4+_0x1628('0x77')]:_0x4718c0['id']},'transaction':_0x50222f};if(_0x31b2d4==='Voice'){_0x31a76a['defaults']={'penalty':_0x4718c0[_0x1628('0x78')][_0x1628('0x79')]};}return db[_0x1628('0x7a')+_0x31b2d4+_0x1628('0x65')][_0x1628('0x7b')](_0x31a76a)['then'](function(){socket['emit'](_0x1628('0x56')+_0x31b2d4+_0x1628('0x7c'),{'UserId':_0x3c04f5,[_0x31b2d4+_0x1628('0x77')]:_0x4718c0['id']});if(_0x31b2d4!==_0x1628('0x6f'))return;return db[_0x1628('0x7a')]['findAll']({'where':{'id':_0x50399e[_0x1628('0x55')]['ids'],'online':0x1},'attributes':['id',_0x1628('0x34'),_0x1628('0x7d'),_0x1628('0x7e'),_0x1628('0x7f')],'raw':!![]})[_0x1628('0x2d')](function(_0x22c57e){var _0x20ed07=_[_0x1628('0x3c')](_0x22c57e,function(_0xed704f){return db[_0x1628('0x80')][_0x1628('0x81')]({'membername':_0xed704f[_0x1628('0x34')],'UserId':_0xed704f['id'],'queue_name':_0x4718c0[_0x1628('0x34')],'VoiceQueueId':_0x4718c0['id'],'interface':_[_0x1628('0x82')](_0xed704f[_0x1628('0x7f')])?util[_0x1628('0x83')](_0x1628('0x84'),_0xed704f[_0x1628('0x34')]):_0xed704f['interface'],'paused':_0xed704f[_0x1628('0x7e')]||![],'penalty':_0x4718c0['TeamVoiceQueue'][_0x1628('0x79')]},{'transaction':_0x50222f});});return Promise[_0x1628('0x85')](_0x20ed07);});});});return Promise[_0x1628('0x85')](_0x4eb953);});return Promise['all'](_0xbe7e69);});});return Promise['all'](_0x399cc0)['then'](function(){return _0x4e89c9['addAgents'](_0x50399e[_0x1628('0x55')][_0x1628('0x6d')],{'transaction':_0x50222f})[_0x1628('0x86')](function(_0x394e95){return _0x394e95;});});});}})[_0x1628('0x2d')](respondWithResult(_0xd5354c,null))['catch'](handleError(_0xd5354c,null));};exports[_0x1628('0x87')]=function(_0x38936b,_0x4280e3){return db[_0x1628('0x36')][_0x1628('0x53')]({'where':{'id':_0x38936b[_0x1628('0x52')]['id']}})[_0x1628('0x2d')](handleEntityNotFound(_0x4280e3,null))[_0x1628('0x2d')](function(_0x4e406d){if(_0x4e406d){var _0x445cc7=[_0x1628('0x6f'),_0x1628('0x70'),_0x1628('0x71'),_0x1628('0x72'),_0x1628('0x88'),'Openchannel',_0x1628('0x74')];return db['sequelize'][_0x1628('0x75')](function(_0x3835cb){var _0x4561af=_[_0x1628('0x3c')](_0x445cc7,function(_0xf08984){var _0x2e191b={'attributes':['id',_0x1628('0x34')]};return _0x4e406d['get'+_0xf08984+'Queues'](_0x2e191b)[_0x1628('0x2d')](function(_0x361a7a){var _0x390e10=_['map'](_0x361a7a,function(_0x5ccb67){return _0x5ccb67[_0x1628('0x87')](_0x38936b[_0x1628('0x3d')][_0x1628('0x6d')],{'transaction':_0x3835cb})[_0x1628('0x2d')](function(){var _0x59f080=JSON[_0x1628('0x89')]('['+_0x38936b['query']['ids']+']');var _0x11cff4=_[_0x1628('0x3c')](_0x59f080,function(_0x3f0e0b){socket[_0x1628('0x8a')]('user'+_0xf08984+_0x1628('0x8b'),{'UserId':Number(_0x3f0e0b),[_0xf08984+_0x1628('0x77')]:_0x5ccb67['id']});if(_0xf08984!==_0x1628('0x6f'))return;return db['UserVoiceQueueRt'][_0x1628('0x2e')]({'where':{'VoiceQueueId':_0x5ccb67['id'],'UserId':_0x3f0e0b},'transaction':_0x3835cb});});return Promise[_0x1628('0x85')](_0x11cff4);});});return Promise[_0x1628('0x85')](_0x390e10);});});return Promise[_0x1628('0x85')](_0x4561af)['then'](function(){return _0x4e406d['removeAgents'](_0x38936b[_0x1628('0x3d')]['ids'],{'transaction':_0x3835cb});});});}})[_0x1628('0x2d')](respondWithStatusCode(_0x4280e3,null))[_0x1628('0x50')](handleError(_0x4280e3,null));};exports[_0x1628('0x8c')]=function(_0x23468c,_0x178c14,_0x7af2fb){var _0x5e354f={};var _0x146dc9={};var _0x5e5fa0;var _0x42a78f;return db[_0x1628('0x36')][_0x1628('0x5e')]({'where':{'id':_0x23468c[_0x1628('0x52')]['id']}})[_0x1628('0x2d')](handleEntityNotFound(_0x178c14,null))[_0x1628('0x2d')](function(_0x315fc3){if(_0x315fc3){_0x5e5fa0=_0x315fc3;_0x146dc9[_0x1628('0x3b')]=_[_0x1628('0x3e')](db[_0x1628('0x7a')][_0x1628('0x37')]);_0x146dc9[_0x1628('0x3d')]=_['keys'](_0x23468c['query']);_0x146dc9[_0x1628('0x3f')]=_[_0x1628('0x40')](_0x146dc9['model'],_0x146dc9['query']);_0x5e354f['attributes']=_[_0x1628('0x40')](_0x146dc9['model'],qs[_0x1628('0x42')](_0x23468c[_0x1628('0x3d')]['fields']));_0x5e354f[_0x1628('0x41')]=_0x5e354f['attributes']['length']?_0x5e354f['attributes']:_0x146dc9[_0x1628('0x3b')];_0x5e354f['order']=qs[_0x1628('0x45')](_0x23468c['query'][_0x1628('0x45')]);_0x5e354f[_0x1628('0x48')]=qs[_0x1628('0x3f')](_[_0x1628('0x46')](_0x23468c[_0x1628('0x3d')],_0x146dc9[_0x1628('0x3f')]));if(_0x23468c[_0x1628('0x3d')][_0x1628('0x47')]){_0x5e354f[_0x1628('0x48')]=_['merge'](_0x5e354f[_0x1628('0x48')],{'$or':_[_0x1628('0x3c')](_0x5e354f[_0x1628('0x41')],function(_0x450329){var _0xf758e7={};_0xf758e7[_0x450329]={'$like':'%'+_0x23468c[_0x1628('0x3d')][_0x1628('0x47')]+'%'};return _0xf758e7;})});}_0x5e354f=_[_0x1628('0x4a')]({},_0x5e354f,_0x23468c[_0x1628('0x4b')]);return _0x5e5fa0[_0x1628('0x8c')](_0x5e354f);}})[_0x1628('0x2d')](function(_0x1ea5e8){if(_0x1ea5e8){_0x42a78f=_0x1ea5e8[_0x1628('0x43')];if(!_0x23468c[_0x1628('0x3d')][_0x1628('0x8d')]('nolimit')){_0x5e354f[_0x1628('0x27')]=qs[_0x1628('0x27')](_0x23468c[_0x1628('0x3d')][_0x1628('0x27')]);_0x5e354f[_0x1628('0x24')]=qs[_0x1628('0x24')](_0x23468c[_0x1628('0x3d')][_0x1628('0x24')]);}return _0x5e5fa0[_0x1628('0x8c')](_0x5e354f);}})['then'](function(_0x2aec4e){if(_0x2aec4e){return _0x2aec4e?{'count':_0x42a78f,'rows':_0x2aec4e}:null;}})[_0x1628('0x2d')](respondWithResult(_0x178c14,null))[_0x1628('0x50')](handleError(_0x178c14,null));}; \ No newline at end of file +var _0xc1af=['sequelize','transaction','through','QueueId','TeamVoiceQueue','penalty','User','emit','Queue:save','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','all','spread','Chat','Sms','Openchannel','parse','Queue:remove','getAgents','eml-format','fast-json-patch','sox','to-csv','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/util','../../mysqldb','defaults','redis','localhost','./team.socket','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','get','Teams','end','name','send','index','map','Team','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','options','include','findAll','catch','params','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','findOne','channel','isValidChannel','Sequelize','Unknown\x20channel','toLowerCase','Queue','order','Queues','addQueues','ValidationError','add','capitalize','removeQueues','remove','ids','Voice','Mail','Fax','Whatsapp'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0xc1af,0x181));var _0xfc1a=function(_0x1cb88d,_0x458122){_0x1cb88d=_0x1cb88d-0x0;var _0x186768=_0xc1af[_0x1cb88d];return _0x186768;};'use strict';var emlformat=require(_0xfc1a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfc1a('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xfc1a('0x2'));var csv=require(_0xfc1a('0x3'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfc1a('0x4'));var _=require(_0xfc1a('0x5'));var squel=require(_0xfc1a('0x6'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfc1a('0x3'));var querystring=require(_0xfc1a('0x7'));var Papa=require(_0xfc1a('0x8'));var Redis=require(_0xfc1a('0x9'));var authService=require(_0xfc1a('0xa'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfc1a('0xb'));var db=require(_0xfc1a('0xc'))['db'];config['redis']=_[_0xfc1a('0xd')](config[_0xfc1a('0xe')],{'host':_0xfc1a('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfc1a('0xe')]));require(_0xfc1a('0x10'))['register'](socket);function respondWithStatusCode(_0xb13858,_0x4ce5e3){_0x4ce5e3=_0x4ce5e3||0xcc;return function(_0x4f823f){if(_0x4f823f){return _0xb13858[_0xfc1a('0x11')](_0x4ce5e3);}return _0xb13858[_0xfc1a('0x12')](_0x4ce5e3)['end']();};}function respondWithResult(_0x4d3960,_0x4bb0cf){_0x4bb0cf=_0x4bb0cf||0xc8;return function(_0x36925e){if(_0x36925e){return _0x4d3960[_0xfc1a('0x12')](_0x4bb0cf)[_0xfc1a('0x13')](_0x36925e);}};}function respondWithFilteredResult(_0x575bd3,_0x1d501c){return function(_0xa1fa51){if(_0xa1fa51){var _0x5dc0bc=typeof _0x1d501c[_0xfc1a('0x14')]===_0xfc1a('0x15')&&typeof _0x1d501c[_0xfc1a('0x16')]===_0xfc1a('0x15');var _0x5cbae4=_0xa1fa51['count'];var _0x550e3c=_0x5dc0bc?0x0:_0x1d501c['offset'];var _0x51bd7c=_0x5dc0bc?_0xa1fa51[_0xfc1a('0x17')]:_0x1d501c[_0xfc1a('0x14')]+_0x1d501c[_0xfc1a('0x16')];var _0xb9418e;if(_0x51bd7c>=_0x5cbae4){_0x51bd7c=_0x5cbae4;_0xb9418e=0xc8;}else{_0xb9418e=0xce;}_0x575bd3[_0xfc1a('0x12')](_0xb9418e);return _0x575bd3['set'](_0xfc1a('0x18'),_0x550e3c+'-'+_0x51bd7c+'/'+_0x5cbae4)[_0xfc1a('0x13')](_0xa1fa51);}return null;};}function patchUpdates(_0x2f1f38){return function(_0x3441b9){try{jsonpatch[_0xfc1a('0x19')](_0x3441b9,_0x2f1f38,!![]);}catch(_0x542106){return BPromise[_0xfc1a('0x1a')](_0x542106);}return _0x3441b9[_0xfc1a('0x1b')]();};}function saveUpdates(_0x24c8ec,_0x3827fe){return function(_0x535cb6){if(_0x535cb6){return _0x535cb6['update'](_0x24c8ec)[_0xfc1a('0x1c')](function(_0x3c8ba5){return _0x3c8ba5;});}return null;};}function removeEntity(_0x29f700,_0x4b72fd){return function(_0x1dbfa9){if(_0x1dbfa9){return _0x1dbfa9[_0xfc1a('0x1d')]()[_0xfc1a('0x1c')](function(){var _0x1f5abd=_0x1dbfa9[_0xfc1a('0x1e')]({'plain':!![]});var _0x28604e=_0xfc1a('0x1f');return db['UserProfileResource'][_0xfc1a('0x1d')]({'where':{'type':_0x28604e,'resourceId':_0x1f5abd['id']}})[_0xfc1a('0x1c')](function(){return _0x1dbfa9;});})['then'](function(){_0x29f700['status'](0xcc)[_0xfc1a('0x20')]();});}};}function handleEntityNotFound(_0x22b879,_0x29c869){return function(_0xe59490){if(!_0xe59490){_0x22b879[_0xfc1a('0x11')](0x194);}return _0xe59490;};}function handleError(_0x2e7cc4,_0x5678aa){_0x5678aa=_0x5678aa||0x1f4;return function(_0x451c4a){logger['error'](_0x451c4a['stack']);if(_0x451c4a['name']){delete _0x451c4a[_0xfc1a('0x21')];}_0x2e7cc4[_0xfc1a('0x12')](_0x5678aa)[_0xfc1a('0x22')](_0x451c4a);};}exports[_0xfc1a('0x23')]=function(_0x97fff0,_0xb23623){var _0x5ea499={},_0x56192e={},_0x53ced8={'count':0x0,'rows':[]};var _0x3091dd=_[_0xfc1a('0x24')](db[_0xfc1a('0x25')]['rawAttributes'],function(_0x24953d){return{'name':_0x24953d[_0xfc1a('0x26')],'type':_0x24953d[_0xfc1a('0x27')][_0xfc1a('0x28')]};});_0x56192e['model']=_['map'](_0x3091dd,_0xfc1a('0x21'));_0x56192e[_0xfc1a('0x29')]=_[_0xfc1a('0x2a')](_0x97fff0[_0xfc1a('0x29')]);_0x56192e[_0xfc1a('0x2b')]=_[_0xfc1a('0x2c')](_0x56192e[_0xfc1a('0x2d')],_0x56192e[_0xfc1a('0x29')]);_0x5ea499[_0xfc1a('0x2e')]=_[_0xfc1a('0x2c')](_0x56192e[_0xfc1a('0x2d')],qs['fields'](_0x97fff0[_0xfc1a('0x29')][_0xfc1a('0x2f')]));_0x5ea499[_0xfc1a('0x2e')]=_0x5ea499[_0xfc1a('0x2e')][_0xfc1a('0x30')]?_0x5ea499[_0xfc1a('0x2e')]:_0x56192e[_0xfc1a('0x2d')];if(!_0x97fff0[_0xfc1a('0x29')][_0xfc1a('0x31')](_0xfc1a('0x32'))){_0x5ea499[_0xfc1a('0x16')]=qs['limit'](_0x97fff0[_0xfc1a('0x29')][_0xfc1a('0x16')]);_0x5ea499[_0xfc1a('0x14')]=qs[_0xfc1a('0x14')](_0x97fff0['query'][_0xfc1a('0x14')]);}_0x5ea499['order']=qs[_0xfc1a('0x33')](_0x97fff0['query'][_0xfc1a('0x33')]);_0x5ea499['where']=qs['filters'](_[_0xfc1a('0x34')](_0x97fff0[_0xfc1a('0x29')],_0x56192e[_0xfc1a('0x2b')]),_0x3091dd);if(_0x97fff0[_0xfc1a('0x29')][_0xfc1a('0x35')]){_0x5ea499['where']=_[_0xfc1a('0x36')](_0x5ea499[_0xfc1a('0x37')],{'$or':_[_0xfc1a('0x24')](_0x3091dd,function(_0x176085){if(_0x176085[_0xfc1a('0x27')]!=='VIRTUAL'){var _0x1a8212={};_0x1a8212[_0x176085[_0xfc1a('0x21')]]={'$like':'%'+_0x97fff0[_0xfc1a('0x29')][_0xfc1a('0x35')]+'%'};return _0x1a8212;}})});}_0x5ea499=_[_0xfc1a('0x36')]({},_0x5ea499,_0x97fff0[_0xfc1a('0x38')]);var _0x3c0eef={'where':_0x5ea499[_0xfc1a('0x37')]};return db[_0xfc1a('0x25')]['count'](_0x3c0eef)[_0xfc1a('0x1c')](function(_0x326229){_0x53ced8[_0xfc1a('0x17')]=_0x326229;if(_0x97fff0[_0xfc1a('0x29')]['includeAll']){_0x5ea499[_0xfc1a('0x39')]=[{'all':!![]}];}return db['Team'][_0xfc1a('0x3a')](_0x5ea499);})[_0xfc1a('0x1c')](function(_0xf6df37){_0x53ced8['rows']=_0xf6df37;return _0x53ced8;})[_0xfc1a('0x1c')](respondWithFilteredResult(_0xb23623,_0x5ea499))[_0xfc1a('0x3b')](handleError(_0xb23623,null));};exports['show']=function(_0x363de4,_0x279f3f){var _0x2a6546={'raw':![],'where':{'id':_0x363de4[_0xfc1a('0x3c')]['id']}},_0x304662={};_0x304662[_0xfc1a('0x2d')]=_['keys'](db[_0xfc1a('0x25')][_0xfc1a('0x3d')]);_0x304662[_0xfc1a('0x29')]=_[_0xfc1a('0x2a')](_0x363de4['query']);_0x304662[_0xfc1a('0x2b')]=_['intersection'](_0x304662['model'],_0x304662[_0xfc1a('0x29')]);_0x2a6546['attributes']=_[_0xfc1a('0x2c')](_0x304662[_0xfc1a('0x2d')],qs[_0xfc1a('0x2f')](_0x363de4[_0xfc1a('0x29')][_0xfc1a('0x2f')]));_0x2a6546[_0xfc1a('0x2e')]=_0x2a6546[_0xfc1a('0x2e')][_0xfc1a('0x30')]?_0x2a6546[_0xfc1a('0x2e')]:_0x304662[_0xfc1a('0x2d')];if(_0x363de4[_0xfc1a('0x29')]['includeAll']){_0x2a6546['include']=[{'all':!![]}];}_0x2a6546=_[_0xfc1a('0x36')]({},_0x2a6546,_0x363de4[_0xfc1a('0x38')]);return db['Team'][_0xfc1a('0x3e')](_0x2a6546)[_0xfc1a('0x1c')](handleEntityNotFound(_0x279f3f,null))[_0xfc1a('0x1c')](respondWithResult(_0x279f3f,null))[_0xfc1a('0x3b')](handleError(_0x279f3f,null));};exports['create']=function(_0x3da1ea,_0x5da665){return db['Team'][_0xfc1a('0x3f')](_0x3da1ea[_0xfc1a('0x40')],{})[_0xfc1a('0x1c')](function(_0x561366){var _0x274bc3=_0x3da1ea['user'][_0xfc1a('0x1e')]({'plain':!![]});if(!_0x274bc3)throw new Error(_0xfc1a('0x41'));if(_0x274bc3[_0xfc1a('0x42')]===_0xfc1a('0x43')){var _0x1caabe=_0x561366['get']({'plain':!![]});var _0x22b485=_0xfc1a('0x1f');return db[_0xfc1a('0x44')][_0xfc1a('0x3e')]({'where':{'name':_0x22b485,'userProfileId':_0x274bc3[_0xfc1a('0x45')]},'raw':!![]})[_0xfc1a('0x1c')](function(_0x57b990){if(_0x57b990&&_0x57b990[_0xfc1a('0x46')]===0x0){return db[_0xfc1a('0x47')][_0xfc1a('0x3f')]({'name':_0x1caabe[_0xfc1a('0x21')],'resourceId':_0x1caabe['id'],'type':_0x57b990[_0xfc1a('0x21')],'sectionId':_0x57b990['id']},{})[_0xfc1a('0x1c')](function(){return _0x561366;});}else{return _0x561366;}})[_0xfc1a('0x3b')](function(_0x31d6e0){logger[_0xfc1a('0x48')](_0xfc1a('0x49'),_0x31d6e0);throw _0x31d6e0;});}return _0x561366;})['then'](respondWithResult(_0x5da665,0xc9))[_0xfc1a('0x3b')](handleError(_0x5da665,null));};exports[_0xfc1a('0x4a')]=function(_0x5cbe03,_0x74d53b){if(_0x5cbe03['body']['id']){delete _0x5cbe03[_0xfc1a('0x40')]['id'];}return db['Team'][_0xfc1a('0x3e')]({'where':{'id':_0x5cbe03[_0xfc1a('0x3c')]['id']}})[_0xfc1a('0x1c')](handleEntityNotFound(_0x74d53b,null))[_0xfc1a('0x1c')](saveUpdates(_0x5cbe03['body'],null))[_0xfc1a('0x1c')](respondWithResult(_0x74d53b,null))['catch'](handleError(_0x74d53b,null));};exports[_0xfc1a('0x1d')]=function(_0x2e20cc,_0x41e081){return db[_0xfc1a('0x25')]['find']({'where':{'id':_0x2e20cc[_0xfc1a('0x3c')]['id']}})['then'](handleEntityNotFound(_0x41e081,null))[_0xfc1a('0x1c')](removeEntity(_0x41e081,null))[_0xfc1a('0x3b')](handleError(_0x41e081,null));};exports['getQueues']=function(_0x1b1c85,_0x194efb,_0x112ca6){return db[_0xfc1a('0x25')][_0xfc1a('0x4b')]({'where':{'id':_0x1b1c85['params']['id']}})[_0xfc1a('0x1c')](handleEntityNotFound(_0x194efb,null))[_0xfc1a('0x1c')](function(_0x20c04f){if(!_0x1b1c85[_0xfc1a('0x29')][_0xfc1a('0x4c')]||!utils[_0xfc1a('0x4d')](_0x1b1c85[_0xfc1a('0x29')][_0xfc1a('0x4c')])){throw new db[(_0xfc1a('0x4e'))]['ValidationError'](_0xfc1a('0x4f'));}var _0xcd8239={};var _0x5c4a2a={};_0x5c4a2a[_0xfc1a('0x2d')]=_[_0xfc1a('0x2a')](db[_['capitalize'](_0x1b1c85[_0xfc1a('0x29')][_0xfc1a('0x4c')][_0xfc1a('0x50')]())+_0xfc1a('0x51')]['rawAttributes']);_0x5c4a2a[_0xfc1a('0x29')]=_[_0xfc1a('0x2a')](_0x1b1c85[_0xfc1a('0x29')]);_0x5c4a2a[_0xfc1a('0x2b')]=_[_0xfc1a('0x2c')](_0x5c4a2a[_0xfc1a('0x2d')],_0x5c4a2a[_0xfc1a('0x29')]);_0xcd8239['attributes']=_['intersection'](_0x5c4a2a[_0xfc1a('0x2d')],qs[_0xfc1a('0x2f')](_0x1b1c85[_0xfc1a('0x29')][_0xfc1a('0x2f')]));_0xcd8239[_0xfc1a('0x2e')]=_0xcd8239[_0xfc1a('0x2e')][_0xfc1a('0x30')]?_0xcd8239[_0xfc1a('0x2e')]:_0x5c4a2a[_0xfc1a('0x2d')];_0xcd8239['limit']=qs['limit'](_0x1b1c85[_0xfc1a('0x29')][_0xfc1a('0x16')]);_0xcd8239['offset']=qs['offset'](_0x1b1c85[_0xfc1a('0x29')][_0xfc1a('0x14')]);_0xcd8239[_0xfc1a('0x52')]=qs[_0xfc1a('0x33')](_0x1b1c85[_0xfc1a('0x29')][_0xfc1a('0x33')]);_0xcd8239['where']=qs[_0xfc1a('0x2b')](_[_0xfc1a('0x34')](_0x1b1c85[_0xfc1a('0x29')],_0x5c4a2a[_0xfc1a('0x2b')]));_0xcd8239=_['merge']({},_0xcd8239,_0x1b1c85[_0xfc1a('0x38')]);return _0x20c04f[_0xfc1a('0x1e')+_['capitalize'](_0x1b1c85[_0xfc1a('0x29')]['channel']['toLowerCase']())+_0xfc1a('0x53')](_0xcd8239);})[_0xfc1a('0x1c')](respondWithResult(_0x194efb,null))[_0xfc1a('0x3b')](handleError(_0x194efb,null));};exports[_0xfc1a('0x54')]=function(_0x3e4969,_0x578b67,_0x5e304f){return db['Team'][_0xfc1a('0x4b')]({'where':{'id':_0x3e4969['params']['id']}})['then'](function(_0x495ebe){if(_0x495ebe){if(!_0x3e4969[_0xfc1a('0x40')][_0xfc1a('0x4c')]||!utils['isValidChannel'](_0x3e4969[_0xfc1a('0x40')][_0xfc1a('0x4c')])){throw new db[(_0xfc1a('0x4e'))][(_0xfc1a('0x55'))](_0xfc1a('0x4f'));}return _0x495ebe[_0xfc1a('0x56')+_[_0xfc1a('0x57')](_0x3e4969['body'][_0xfc1a('0x4c')][_0xfc1a('0x50')]())+_0xfc1a('0x53')](_0x3e4969[_0xfc1a('0x40')]['ids']);}return null;})[_0xfc1a('0x1c')](handleEntityNotFound(_0x578b67,null))[_0xfc1a('0x1c')](respondWithStatusCode(_0x578b67,null))[_0xfc1a('0x3b')](handleError(_0x578b67,null));};exports[_0xfc1a('0x58')]=function(_0x165412,_0x4c581a,_0x4a7601){return db[_0xfc1a('0x25')][_0xfc1a('0x4b')]({'where':{'id':_0x165412[_0xfc1a('0x3c')]['id']}})['then'](function(_0x2988dc){if(_0x2988dc){if(!_0x165412[_0xfc1a('0x29')]['channel']||!utils[_0xfc1a('0x4d')](_0x165412[_0xfc1a('0x29')][_0xfc1a('0x4c')])){throw new db[(_0xfc1a('0x4e'))][(_0xfc1a('0x55'))](_0xfc1a('0x4f'));}return _0x2988dc[_0xfc1a('0x59')+_[_0xfc1a('0x57')](_0x165412['query'][_0xfc1a('0x4c')]['toLowerCase']())+_0xfc1a('0x53')](_0x165412[_0xfc1a('0x29')][_0xfc1a('0x5a')]);}return null;})[_0xfc1a('0x1c')](handleEntityNotFound(_0x4c581a,null))[_0xfc1a('0x1c')](respondWithStatusCode(_0x4c581a,null))['catch'](handleError(_0x4c581a,null));};exports['addAgents']=function(_0x470728,_0x49a14e){return db[_0xfc1a('0x25')][_0xfc1a('0x3e')]({'where':{'id':_0x470728[_0xfc1a('0x3c')]['id']}})['then'](handleEntityNotFound(_0x49a14e,null))[_0xfc1a('0x1c')](function(_0x25b7c4){if(_0x25b7c4){var _0x3e3aeb=[_0xfc1a('0x5b'),'Chat',_0xfc1a('0x5c'),'Sms',_0xfc1a('0x5d'),'Openchannel',_0xfc1a('0x5e')];return db[_0xfc1a('0x5f')][_0xfc1a('0x60')](function(_0xe82c05){var _0x4d913c=_[_0xfc1a('0x24')](_0x3e3aeb,function(_0x191d6e){var _0x2fb0bd={'attributes':['id',_0xfc1a('0x21')]};if(_0x191d6e===_0xfc1a('0x5b')){_0x2fb0bd[_0xfc1a('0x61')]={'attributes':['penalty']};}return _0x25b7c4[_0xfc1a('0x1e')+_0x191d6e+_0xfc1a('0x53')](_0x2fb0bd)[_0xfc1a('0x1c')](function(_0x51d09d){var _0x26aeb0=_['map'](_0x51d09d,function(_0xec9afe){var _0x53cb09=_[_0xfc1a('0x24')](_0x470728[_0xfc1a('0x40')][_0xfc1a('0x5a')],function(_0x2166e7){var _0x24f0c2={'where':{'UserId':_0x2166e7,[_0x191d6e+_0xfc1a('0x62')]:_0xec9afe['id']},'transaction':_0xe82c05};if(_0x191d6e===_0xfc1a('0x5b')){_0x24f0c2[_0xfc1a('0xd')]={'penalty':_0xec9afe[_0xfc1a('0x63')][_0xfc1a('0x64')]};}return db[_0xfc1a('0x65')+_0x191d6e+_0xfc1a('0x51')]['findOrCreate'](_0x24f0c2)['then'](function(){socket[_0xfc1a('0x66')]('user'+_0x191d6e+_0xfc1a('0x67'),{'UserId':_0x2166e7,[_0x191d6e+_0xfc1a('0x62')]:_0xec9afe['id']});if(_0x191d6e!==_0xfc1a('0x5b'))return;return db['User'][_0xfc1a('0x3a')]({'where':{'id':_0x470728[_0xfc1a('0x40')][_0xfc1a('0x5a')],'online':0x1},'attributes':['id','name',_0xfc1a('0x68'),_0xfc1a('0x69'),_0xfc1a('0x6a')],'raw':!![]})['then'](function(_0x2560d0){var _0x5093c6=_[_0xfc1a('0x24')](_0x2560d0,function(_0x424e29){return db[_0xfc1a('0x6b')][_0xfc1a('0x6c')]({'membername':_0x424e29['name'],'UserId':_0x424e29['id'],'queue_name':_0xec9afe['name'],'VoiceQueueId':_0xec9afe['id'],'interface':_[_0xfc1a('0x6d')](_0x424e29['interface'])?util[_0xfc1a('0x6e')](_0xfc1a('0x6f'),_0x424e29[_0xfc1a('0x21')]):_0x424e29[_0xfc1a('0x6a')],'paused':_0x424e29['voicePause']||![],'penalty':_0xec9afe[_0xfc1a('0x63')][_0xfc1a('0x64')]},{'transaction':_0xe82c05});});return Promise['all'](_0x5093c6);});});});return Promise[_0xfc1a('0x70')](_0x53cb09);});return Promise['all'](_0x26aeb0);});});return Promise[_0xfc1a('0x70')](_0x4d913c)[_0xfc1a('0x1c')](function(){return _0x25b7c4['addAgents'](_0x470728[_0xfc1a('0x40')][_0xfc1a('0x5a')],{'transaction':_0xe82c05})[_0xfc1a('0x71')](function(_0x3730f6){return _0x3730f6;});});});}})[_0xfc1a('0x1c')](respondWithResult(_0x49a14e,null))[_0xfc1a('0x3b')](handleError(_0x49a14e,null));};exports['removeAgents']=function(_0x55b961,_0x5e302f){return db[_0xfc1a('0x25')][_0xfc1a('0x3e')]({'where':{'id':_0x55b961['params']['id']}})[_0xfc1a('0x1c')](handleEntityNotFound(_0x5e302f,null))[_0xfc1a('0x1c')](function(_0x2660b6){if(_0x2660b6){var _0x1050db=[_0xfc1a('0x5b'),_0xfc1a('0x72'),'Mail',_0xfc1a('0x73'),_0xfc1a('0x5d'),_0xfc1a('0x74'),'Whatsapp'];return db[_0xfc1a('0x5f')][_0xfc1a('0x60')](function(_0x51577d){var _0x57d095=_[_0xfc1a('0x24')](_0x1050db,function(_0x1cf79b){var _0x2d266d={'attributes':['id',_0xfc1a('0x21')]};return _0x2660b6[_0xfc1a('0x1e')+_0x1cf79b+_0xfc1a('0x53')](_0x2d266d)['then'](function(_0x18f785){var _0x535bc3=_[_0xfc1a('0x24')](_0x18f785,function(_0x55d27d){return _0x55d27d['removeAgents'](_0x55b961[_0xfc1a('0x29')][_0xfc1a('0x5a')],{'transaction':_0x51577d})[_0xfc1a('0x1c')](function(){var _0x1fd618=JSON[_0xfc1a('0x75')]('['+_0x55b961[_0xfc1a('0x29')][_0xfc1a('0x5a')]+']');var _0x31bf2c=_[_0xfc1a('0x24')](_0x1fd618,function(_0x1b73b5){socket[_0xfc1a('0x66')](_0xfc1a('0x43')+_0x1cf79b+_0xfc1a('0x76'),{'UserId':Number(_0x1b73b5),[_0x1cf79b+_0xfc1a('0x62')]:_0x55d27d['id']});if(_0x1cf79b!==_0xfc1a('0x5b'))return;return db[_0xfc1a('0x6b')][_0xfc1a('0x1d')]({'where':{'VoiceQueueId':_0x55d27d['id'],'UserId':_0x1b73b5},'transaction':_0x51577d});});return Promise[_0xfc1a('0x70')](_0x31bf2c);});});return Promise[_0xfc1a('0x70')](_0x535bc3);});});return Promise[_0xfc1a('0x70')](_0x57d095)[_0xfc1a('0x1c')](function(){return _0x2660b6['removeAgents'](_0x55b961['query'][_0xfc1a('0x5a')],{'transaction':_0x51577d});});});}})[_0xfc1a('0x1c')](respondWithStatusCode(_0x5e302f,null))[_0xfc1a('0x3b')](handleError(_0x5e302f,null));};exports[_0xfc1a('0x77')]=function(_0x2e77b3,_0x27ec44,_0x21747c){var _0x37acb4={};var _0x2ac8a6={};var _0x600272;var _0x3f829e;return db[_0xfc1a('0x25')][_0xfc1a('0x4b')]({'where':{'id':_0x2e77b3['params']['id']}})[_0xfc1a('0x1c')](handleEntityNotFound(_0x27ec44,null))[_0xfc1a('0x1c')](function(_0x51bcbe){if(_0x51bcbe){_0x600272=_0x51bcbe;_0x2ac8a6[_0xfc1a('0x2d')]=_[_0xfc1a('0x2a')](db['User'][_0xfc1a('0x3d')]);_0x2ac8a6[_0xfc1a('0x29')]=_[_0xfc1a('0x2a')](_0x2e77b3['query']);_0x2ac8a6[_0xfc1a('0x2b')]=_['intersection'](_0x2ac8a6['model'],_0x2ac8a6['query']);_0x37acb4[_0xfc1a('0x2e')]=_[_0xfc1a('0x2c')](_0x2ac8a6[_0xfc1a('0x2d')],qs[_0xfc1a('0x2f')](_0x2e77b3[_0xfc1a('0x29')][_0xfc1a('0x2f')]));_0x37acb4[_0xfc1a('0x2e')]=_0x37acb4['attributes'][_0xfc1a('0x30')]?_0x37acb4[_0xfc1a('0x2e')]:_0x2ac8a6[_0xfc1a('0x2d')];_0x37acb4['order']=qs['sort'](_0x2e77b3[_0xfc1a('0x29')][_0xfc1a('0x33')]);_0x37acb4[_0xfc1a('0x37')]=qs[_0xfc1a('0x2b')](_[_0xfc1a('0x34')](_0x2e77b3[_0xfc1a('0x29')],_0x2ac8a6['filters']));if(_0x2e77b3[_0xfc1a('0x29')][_0xfc1a('0x35')]){_0x37acb4['where']=_[_0xfc1a('0x36')](_0x37acb4[_0xfc1a('0x37')],{'$or':_[_0xfc1a('0x24')](_0x37acb4[_0xfc1a('0x2e')],function(_0x4059e5){var _0x5ebfaa={};_0x5ebfaa[_0x4059e5]={'$like':'%'+_0x2e77b3[_0xfc1a('0x29')][_0xfc1a('0x35')]+'%'};return _0x5ebfaa;})});}_0x37acb4=_['merge']({},_0x37acb4,_0x2e77b3['options']);return _0x600272[_0xfc1a('0x77')](_0x37acb4);}})[_0xfc1a('0x1c')](function(_0x1ae8aa){if(_0x1ae8aa){_0x3f829e=_0x1ae8aa[_0xfc1a('0x30')];if(!_0x2e77b3[_0xfc1a('0x29')]['hasOwnProperty']('nolimit')){_0x37acb4[_0xfc1a('0x16')]=qs['limit'](_0x2e77b3[_0xfc1a('0x29')][_0xfc1a('0x16')]);_0x37acb4[_0xfc1a('0x14')]=qs[_0xfc1a('0x14')](_0x2e77b3[_0xfc1a('0x29')][_0xfc1a('0x14')]);}return _0x600272[_0xfc1a('0x77')](_0x37acb4);}})['then'](function(_0x28a3d7){if(_0x28a3d7){return _0x28a3d7?{'count':_0x3f829e,'rows':_0x28a3d7}:null;}})[_0xfc1a('0x1c')](respondWithResult(_0x27ec44,null))[_0xfc1a('0x3b')](handleError(_0x27ec44,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 20a856c..1bd850f 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 _0x4706=['hasOwnProperty','hook','../../mysqldb','Team','setMaxListeners','save','update','remove','emit'];(function(_0x1fd2e6,_0x319411){var _0x38284b=function(_0x220170){while(--_0x220170){_0x1fd2e6['push'](_0x1fd2e6['shift']());}};_0x38284b(++_0x319411);}(_0x4706,0xd1));var _0x6470=function(_0x21c56f,_0x3b2035){_0x21c56f=_0x21c56f-0x0;var _0x201f05=_0x4706[_0x21c56f];return _0x201f05;};'use strict';var EventEmitter=require('events');var Team=require(_0x6470('0x0'))['db'][_0x6470('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x6470('0x2')](0x0);var events={'afterCreate':_0x6470('0x3'),'afterUpdate':_0x6470('0x4'),'afterDestroy':_0x6470('0x5')};function emitEvent(_0x1ecebe){return function(_0x1253c7,_0x15980b,_0x488602){TeamEvents[_0x6470('0x6')](_0x1ecebe+':'+_0x1253c7['id'],_0x1253c7);TeamEvents[_0x6470('0x6')](_0x1ecebe,_0x1253c7);_0x488602(null);};}for(var e in events){if(events[_0x6470('0x7')](e)){var event=events[e];Team[_0x6470('0x8')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0x6029=['hasOwnProperty','exports','events','../../mysqldb','Team','save','update','remove','emit'];(function(_0xa1b777,_0x479ce3){var _0x3d8838=function(_0x3d6aaa){while(--_0x3d6aaa){_0xa1b777['push'](_0xa1b777['shift']());}};_0x3d8838(++_0x479ce3);}(_0x6029,0xb6));var _0x9602=function(_0x3740f6,_0x220caa){_0x3740f6=_0x3740f6-0x0;var _0x5c5d2b=_0x6029[_0x3740f6];return _0x5c5d2b;};'use strict';var EventEmitter=require(_0x9602('0x0'));var Team=require(_0x9602('0x1'))['db'][_0x9602('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9602('0x3'),'afterUpdate':_0x9602('0x4'),'afterDestroy':_0x9602('0x5')};function emitEvent(_0x184ba8){return function(_0xaea755,_0x7eb6,_0x8193a1){TeamEvents[_0x9602('0x6')](_0x184ba8+':'+_0xaea755['id'],_0xaea755);TeamEvents['emit'](_0x184ba8,_0xaea755);_0x8193a1(null);};}for(var e in events){if(events[_0x9602('0x7')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x9602('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 01026f4..a0911bd 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 _0x0665=['Team','teams','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./team.attributes','exports','define'];(function(_0x5ac84c,_0x287781){var _0x3c53d2=function(_0x40cde0){while(--_0x40cde0){_0x5ac84c['push'](_0x5ac84c['shift']());}};_0x3c53d2(++_0x287781);}(_0x0665,0x115));var _0x5066=function(_0x40d078,_0x210a77){_0x40d078=_0x40d078-0x0;var _0x46fc81=_0x0665[_0x40d078];return _0x46fc81;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5066('0x0'))(_0x5066('0x1'));var moment=require(_0x5066('0x2'));var BPromise=require(_0x5066('0x3'));var rp=require(_0x5066('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5066('0x5'));var attributes=require(_0x5066('0x6'));module[_0x5066('0x7')]=function(_0x179b27,_0x449ee5){return _0x179b27[_0x5066('0x8')](_0x5066('0x9'),attributes,{'tableName':_0x5066('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x79e8=['exports','define','teams','util','../../config/logger','request-promise','path','../../config/environment'];(function(_0x25acf4,_0x1d6473){var _0x305730=function(_0x245a27){while(--_0x245a27){_0x25acf4['push'](_0x25acf4['shift']());}};_0x305730(++_0x1d6473);}(_0x79e8,0xf3));var _0x879e=function(_0x1ff7a9,_0x121237){_0x1ff7a9=_0x1ff7a9-0x0;var _0x413ad7=_0x79e8[_0x1ff7a9];return _0x413ad7;};'use strict';var _=require('lodash');var util=require(_0x879e('0x0'));var logger=require(_0x879e('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x879e('0x2'));var fs=require('fs');var path=require(_0x879e('0x3'));var rimraf=require('rimraf');var config=require(_0x879e('0x4'));var attributes=require('./team.attributes');module[_0x879e('0x5')]=function(_0xb69ba5,_0x339c3b){return _0xb69ba5[_0x879e('0x6')]('Team',attributes,{'tableName':_0x879e('0x7'),'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 2e4e797..d829ac4 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 _0xf767=['request\x20sent','error','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','then','info','Team,\x20%s,\x20%s','debug','Team,\x20%s,\x20%s,\x20%s'];(function(_0x4970ba,_0x401fdf){var _0x50a32b=function(_0x217c71){while(--_0x217c71){_0x4970ba['push'](_0x4970ba['shift']());}};_0x50a32b(++_0x401fdf);}(_0xf767,0x6d));var _0x7f76=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xf767[_0x1b349a];return _0x5d1f7c;};'use strict';var _=require(_0x7f76('0x0'));var util=require(_0x7f76('0x1'));var moment=require('moment');var BPromise=require(_0x7f76('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7f76('0x3'));var db=require(_0x7f76('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7f76('0x5'));var config=require('../../config/environment');var jayson=require(_0x7f76('0x6'));var client=jayson[_0x7f76('0x7')][_0x7f76('0x8')]({'port':0x232a});config[_0x7f76('0x9')]=_[_0x7f76('0xa')](config[_0x7f76('0x9')],{'host':_0x7f76('0xb'),'port':0x18eb});var socket=require(_0x7f76('0xc'))(new Redis(config[_0x7f76('0x9')]));require(_0x7f76('0xd'))[_0x7f76('0xe')](socket);function respondWithRpcPromise(_0x87bb53,_0x2cf20f,_0x278d36){return new BPromise(function(_0x4f47f5,_0x3eb8f5){return client[_0x7f76('0xf')](_0x87bb53,_0x278d36)[_0x7f76('0x10')](function(_0x29a75e){logger[_0x7f76('0x11')](_0x7f76('0x12'),_0x2cf20f,'request\x20sent');logger[_0x7f76('0x13')](_0x7f76('0x14'),_0x2cf20f,_0x7f76('0x15'),JSON['stringify'](_0x29a75e));if(_0x29a75e['error']){if(_0x29a75e[_0x7f76('0x16')]['code']===0x1f4){logger[_0x7f76('0x16')](_0x7f76('0x12'),_0x2cf20f,_0x29a75e[_0x7f76('0x16')][_0x7f76('0x17')]);return _0x3eb8f5(_0x29a75e['error']['message']);}logger[_0x7f76('0x16')](_0x7f76('0x12'),_0x2cf20f,_0x29a75e['error'][_0x7f76('0x17')]);return _0x4f47f5(_0x29a75e['error']['message']);}else{logger['info'](_0x7f76('0x12'),_0x2cf20f,_0x7f76('0x15'));_0x4f47f5(_0x29a75e[_0x7f76('0x18')][_0x7f76('0x17')]);}})[_0x7f76('0x19')](function(_0x232e18){logger[_0x7f76('0x16')](_0x7f76('0x12'),_0x2cf20f,_0x232e18);_0x3eb8f5(_0x232e18);});});} \ No newline at end of file +var _0xbf78=['request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','then','info','Team,\x20%s,\x20%s'];(function(_0x7a74d8,_0x2e7dd5){var _0x58ce43=function(_0x42e61e){while(--_0x42e61e){_0x7a74d8['push'](_0x7a74d8['shift']());}};_0x58ce43(++_0x2e7dd5);}(_0xbf78,0x17e));var _0x8bf7=function(_0x4038eb,_0x819d40){_0x4038eb=_0x4038eb-0x0;var _0x2df680=_0xbf78[_0x4038eb];return _0x2df680;};'use strict';var _=require(_0x8bf7('0x0'));var util=require(_0x8bf7('0x1'));var moment=require('moment');var BPromise=require(_0x8bf7('0x2'));var rs=require(_0x8bf7('0x3'));var fs=require('fs');var Redis=require(_0x8bf7('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8bf7('0x5'))('rpc');var config=require(_0x8bf7('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x8bf7('0x7')][_0x8bf7('0x8')]({'port':0x232a});config[_0x8bf7('0x9')]=_[_0x8bf7('0xa')](config['redis'],{'host':_0x8bf7('0xb'),'port':0x18eb});var socket=require(_0x8bf7('0xc'))(new Redis(config[_0x8bf7('0x9')]));require(_0x8bf7('0xd'))[_0x8bf7('0xe')](socket);function respondWithRpcPromise(_0x146a07,_0x43604b,_0x57fda2){return new BPromise(function(_0x521501,_0x3c4e61){return client['request'](_0x146a07,_0x57fda2)[_0x8bf7('0xf')](function(_0x1dc1e5){logger[_0x8bf7('0x10')](_0x8bf7('0x11'),_0x43604b,_0x8bf7('0x12'));logger[_0x8bf7('0x13')](_0x8bf7('0x14'),_0x43604b,_0x8bf7('0x12'),JSON['stringify'](_0x1dc1e5));if(_0x1dc1e5[_0x8bf7('0x15')]){if(_0x1dc1e5[_0x8bf7('0x15')]['code']===0x1f4){logger[_0x8bf7('0x15')]('Team,\x20%s,\x20%s',_0x43604b,_0x1dc1e5[_0x8bf7('0x15')]['message']);return _0x3c4e61(_0x1dc1e5[_0x8bf7('0x15')]['message']);}logger[_0x8bf7('0x15')](_0x8bf7('0x11'),_0x43604b,_0x1dc1e5[_0x8bf7('0x15')][_0x8bf7('0x16')]);return _0x521501(_0x1dc1e5[_0x8bf7('0x15')]['message']);}else{logger[_0x8bf7('0x10')](_0x8bf7('0x11'),_0x43604b,'request\x20sent');_0x521501(_0x1dc1e5[_0x8bf7('0x17')][_0x8bf7('0x16')]);}})[_0x8bf7('0x18')](function(_0x2fb652){logger[_0x8bf7('0x15')](_0x8bf7('0x11'),_0x43604b,_0x2fb652);_0x3c4e61(_0x2fb652);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index bc14d4e..6582531 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 _0xe864=['emit','register','length','team:','./team.events','save','remove','update'];(function(_0x438c10,_0x3db06a){var _0x21b46a=function(_0x3ff0fe){while(--_0x3ff0fe){_0x438c10['push'](_0x438c10['shift']());}};_0x21b46a(++_0x3db06a);}(_0xe864,0x1ac));var _0x4e86=function(_0x1fd1e6,_0x591c7e){_0x1fd1e6=_0x1fd1e6-0x0;var _0x39c9d3=_0xe864[_0x1fd1e6];return _0x39c9d3;};'use strict';var TeamEvents=require(_0x4e86('0x0'));var events=[_0x4e86('0x1'),_0x4e86('0x2'),_0x4e86('0x3')];function createListener(_0x1b5271,_0x3c6554){return function(_0x3afb34){_0x3c6554[_0x4e86('0x4')](_0x1b5271,_0x3afb34);};}function removeListener(_0x2994fe,_0xb524b9){return function(){TeamEvents['removeListener'](_0x2994fe,_0xb524b9);};}exports[_0x4e86('0x5')]=function(_0x4ed953){for(var _0xe980b8=0x0,_0x1585fd=events[_0x4e86('0x6')];_0xe980b8<_0x1585fd;_0xe980b8++){var _0x5ea59e=events[_0xe980b8];var _0x46ab8b=createListener(_0x4e86('0x7')+_0x5ea59e,_0x4ed953);TeamEvents['on'](_0x5ea59e,_0x46ab8b);}}; \ No newline at end of file +var _0x03f8=['register','length','./team.events','save','update','emit','removeListener'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x03f8,0x1d0));var _0x803f=function(_0xe260c2,_0x56d51e){_0xe260c2=_0xe260c2-0x0;var _0x32ddfb=_0x03f8[_0xe260c2];return _0x32ddfb;};'use strict';var TeamEvents=require(_0x803f('0x0'));var events=[_0x803f('0x1'),'remove',_0x803f('0x2')];function createListener(_0x5eed88,_0x3b7d84){return function(_0x101ddd){_0x3b7d84[_0x803f('0x3')](_0x5eed88,_0x101ddd);};}function removeListener(_0x1a7997,_0xf388d){return function(){TeamEvents[_0x803f('0x4')](_0x1a7997,_0xf388d);};}exports[_0x803f('0x5')]=function(_0x43a484){for(var _0x107ac6=0x0,_0x56ed41=events[_0x803f('0x6')];_0x107ac6<_0x56ed41;_0x107ac6++){var _0x3698ec=events[_0x107ac6];var _0x2e06aa=createListener('team:'+_0x3698ec,_0x43a484);TeamEvents['on'](_0x3698ec,_0x2e06aa);}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 7143dfb..b6fdbb0 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x21481c,_0x1b51ba){var _0x5dd77a=function(_0x4ee13c){while(--_0x4ee13c){_0x21481c['push'](_0x21481c['shift']());}};_0x5dd77a(++_0x1b51ba);}(_0x9c44,0x178));var _0x49c4=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x9c44[_0x160c73];return _0xd9302;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x495762,_0x39449c){var _0x29222e=function(_0x1d5cd5){while(--_0x1d5cd5){_0x495762['push'](_0x495762['shift']());}};_0x29222e(++_0x39449c);}(_0xedd9,0xfc));var _0x9edd=function(_0x2e6be8,_0x46c6ef){_0x2e6be8=_0x2e6be8-0x0;var _0x7b6b45=_0xedd9[_0x2e6be8];return _0x7b6b45;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 0d7ab7c..a8af31a 100644 --- a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js +++ b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe873=['sequelize','exports'];(function(_0x576590,_0x2651cf){var _0x504490=function(_0x468a6f){while(--_0x468a6f){_0x576590['push'](_0x576590['shift']());}};_0x504490(++_0x2651cf);}(_0xe873,0x1e6));var _0x3e87=function(_0x324674,_0x425b51){_0x324674=_0x324674-0x0;var _0x213555=_0xe873[_0x324674];return _0x213555;};'use strict';var Sequelize=require(_0x3e87('0x0'));module[_0x3e87('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x8a62=['sequelize','exports'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0x8a62,0x130));var _0x28a6=function(_0x367056,_0x3b2731){_0x367056=_0x367056-0x0;var _0x1e979a=_0x8a62[_0x367056];return _0x1e979a;};'use strict';var Sequelize=require(_0x28a6('0x0'));module[_0x28a6('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 7380296..74795be 100644 --- a/server/api/teamVoiceQueue/teamVoiceQueue.model.js +++ b/server/api/teamVoiceQueue/teamVoiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4944=['team_has_voice_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue'];(function(_0x3ef186,_0x30c94b){var _0x4f5f22=function(_0x3794c2){while(--_0x3794c2){_0x3ef186['push'](_0x3ef186['shift']());}};_0x4f5f22(++_0x30c94b);}(_0x4944,0x6d));var _0x4494=function(_0x3daebb,_0x5bdc3a){_0x3daebb=_0x3daebb-0x0;var _0x5597a1=_0x4944[_0x3daebb];return _0x5597a1;};'use strict';var _=require(_0x4494('0x0'));var util=require('util');var logger=require(_0x4494('0x1'))(_0x4494('0x2'));var moment=require(_0x4494('0x3'));var BPromise=require(_0x4494('0x4'));var rp=require(_0x4494('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4494('0x6'));var config=require('../../config/environment');var attributes=require(_0x4494('0x7'));module[_0x4494('0x8')]=function(_0x38480d,_0xb94d02){return _0x38480d[_0x4494('0x9')](_0x4494('0xa'),attributes,{'tableName':_0x4494('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9099=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','lodash'];(function(_0x388323,_0x2c1de1){var _0x589216=function(_0x353920){while(--_0x353920){_0x388323['push'](_0x388323['shift']());}};_0x589216(++_0x2c1de1);}(_0x9099,0x1ac));var _0x9909=function(_0x3fb9dd,_0x174fff){_0x3fb9dd=_0x3fb9dd-0x0;var _0x20136a=_0x9099[_0x3fb9dd];return _0x20136a;};'use strict';var _=require(_0x9909('0x0'));var util=require('util');var logger=require(_0x9909('0x1'))(_0x9909('0x2'));var moment=require(_0x9909('0x3'));var BPromise=require(_0x9909('0x4'));var rp=require(_0x9909('0x5'));var fs=require('fs');var path=require(_0x9909('0x6'));var rimraf=require(_0x9909('0x7'));var config=require(_0x9909('0x8'));var attributes=require(_0x9909('0x9'));module[_0x9909('0xa')]=function(_0x3947ed,_0x41c07e){return _0x3947ed[_0x9909('0xb')](_0x9909('0xc'),attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 7ae67ab..e3349f4 100644 --- a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js +++ b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7dfc=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','TeamVoiceQueue,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7dfc,0x19b));var _0xc7df=function(_0x1066a3,_0x2507d7){_0x1066a3=_0x1066a3-0x0;var _0x4496d8=_0x7dfc[_0x1066a3];return _0x4496d8;};'use strict';var _=require(_0xc7df('0x0'));var util=require(_0xc7df('0x1'));var moment=require('moment');var BPromise=require(_0xc7df('0x2'));var rs=require(_0xc7df('0x3'));var fs=require('fs');var Redis=require(_0xc7df('0x4'));var db=require(_0xc7df('0x5'))['db'];var utils=require(_0xc7df('0x6'));var logger=require(_0xc7df('0x7'))(_0xc7df('0x8'));var config=require(_0xc7df('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc7df('0xa')][_0xc7df('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x288e4e,_0x2d142c,_0x2fbf63){return new BPromise(function(_0x491233,_0x69cedb){return client[_0xc7df('0xc')](_0x288e4e,_0x2fbf63)['then'](function(_0x4c81f9){logger[_0xc7df('0xd')]('TeamVoiceQueue,\x20%s,\x20%s',_0x2d142c,_0xc7df('0xe'));logger[_0xc7df('0xf')](_0xc7df('0x10'),_0x2d142c,_0xc7df('0xe'),JSON['stringify'](_0x4c81f9));if(_0x4c81f9['error']){if(_0x4c81f9[_0xc7df('0x11')][_0xc7df('0x12')]===0x1f4){logger[_0xc7df('0x11')](_0xc7df('0x13'),_0x2d142c,_0x4c81f9['error'][_0xc7df('0x14')]);return _0x69cedb(_0x4c81f9[_0xc7df('0x11')][_0xc7df('0x14')]);}logger[_0xc7df('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x2d142c,_0x4c81f9[_0xc7df('0x11')][_0xc7df('0x14')]);return _0x491233(_0x4c81f9[_0xc7df('0x11')][_0xc7df('0x14')]);}else{logger[_0xc7df('0xd')](_0xc7df('0x13'),_0x2d142c,'request\x20sent');_0x491233(_0x4c81f9[_0xc7df('0x15')][_0xc7df('0x14')]);}})[_0xc7df('0x16')](function(_0x3c580b){logger['error'](_0xc7df('0x13'),_0x2d142c,_0x3c580b);_0x69cedb(_0x3c580b);});});} \ No newline at end of file +var _0x3c31=['result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','TeamVoiceQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x3c31,0xb1));var _0x13c3=function(_0xf79bc3,_0x16f062){_0xf79bc3=_0xf79bc3-0x0;var _0x5262f4=_0x3c31[_0xf79bc3];return _0x5262f4;};'use strict';var _=require(_0x13c3('0x0'));var util=require(_0x13c3('0x1'));var moment=require(_0x13c3('0x2'));var BPromise=require(_0x13c3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x13c3('0x4'));var db=require(_0x13c3('0x5'))['db'];var utils=require(_0x13c3('0x6'));var logger=require(_0x13c3('0x7'))(_0x13c3('0x8'));var config=require(_0x13c3('0x9'));var jayson=require(_0x13c3('0xa'));var client=jayson[_0x13c3('0xb')][_0x13c3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3c217d,_0x367bba,_0x21a72c){return new BPromise(function(_0x4802e1,_0xaf7a8d){return client[_0x13c3('0xd')](_0x3c217d,_0x21a72c)[_0x13c3('0xe')](function(_0x2a9a20){logger['info'](_0x13c3('0xf'),_0x367bba,'request\x20sent');logger[_0x13c3('0x10')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x367bba,_0x13c3('0x11'),JSON[_0x13c3('0x12')](_0x2a9a20));if(_0x2a9a20[_0x13c3('0x13')]){if(_0x2a9a20[_0x13c3('0x13')][_0x13c3('0x14')]===0x1f4){logger[_0x13c3('0x13')](_0x13c3('0xf'),_0x367bba,_0x2a9a20['error'][_0x13c3('0x15')]);return _0xaf7a8d(_0x2a9a20['error'][_0x13c3('0x15')]);}logger[_0x13c3('0x13')]('TeamVoiceQueue,\x20%s,\x20%s',_0x367bba,_0x2a9a20[_0x13c3('0x13')][_0x13c3('0x15')]);return _0x4802e1(_0x2a9a20[_0x13c3('0x13')]['message']);}else{logger[_0x13c3('0x16')]('TeamVoiceQueue,\x20%s,\x20%s',_0x367bba,_0x13c3('0x11'));_0x4802e1(_0x2a9a20[_0x13c3('0x17')][_0x13c3('0x15')]);}})[_0x13c3('0x18')](function(_0x5cdcc3){logger['error'](_0x13c3('0xf'),_0x367bba,_0x5cdcc3);_0xaf7a8d(_0x5cdcc3);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index dbe5e55..c32d749 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 _0x2d07=['get','index','/:id','post','isAuthenticated','update','delete','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller'];(function(_0x313eb6,_0xe35c6e){var _0x554612=function(_0x104d84){while(--_0x104d84){_0x313eb6['push'](_0x313eb6['shift']());}};_0x554612(++_0xe35c6e);}(_0x2d07,0x13a));var _0x72d0=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x2d07[_0x12d033];return _0x3b4e80;};'use strict';var multer=require(_0x72d0('0x0'));var util=require(_0x72d0('0x1'));var path=require('path');var timeout=require(_0x72d0('0x2'));var express=require(_0x72d0('0x3'));var router=express['Router']();var fs_extra=require(_0x72d0('0x4'));var auth=require(_0x72d0('0x5'));var interaction=require(_0x72d0('0x6'));var config=require(_0x72d0('0x7'));var controller=require(_0x72d0('0x8'));router[_0x72d0('0x9')]('/',auth['isAuthenticated'](),controller[_0x72d0('0xa')]);router[_0x72d0('0x9')](_0x72d0('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x72d0('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x72d0('0xb'),auth[_0x72d0('0xd')](),controller[_0x72d0('0xe')]);router[_0x72d0('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x72d0('0x10')]=router; \ No newline at end of file +var _0x73a1=['get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x548c75,_0x3d294d){var _0x4967b2=function(_0x3bb644){while(--_0x3bb644){_0x548c75['push'](_0x548c75['shift']());}};_0x4967b2(++_0x3d294d);}(_0x73a1,0x161));var _0x173a=function(_0x152449,_0x49f41d){_0x152449=_0x152449-0x0;var _0x5b58b2=_0x73a1[_0x152449];return _0x5b58b2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x173a('0x0'));var timeout=require(_0x173a('0x1'));var express=require('express');var router=express[_0x173a('0x2')]();var fs_extra=require(_0x173a('0x3'));var auth=require(_0x173a('0x4'));var interaction=require(_0x173a('0x5'));var config=require(_0x173a('0x6'));var controller=require('./template.controller');router[_0x173a('0x7')]('/',auth[_0x173a('0x8')](),controller[_0x173a('0x9')]);router[_0x173a('0x7')](_0x173a('0xa'),auth[_0x173a('0x8')](),controller[_0x173a('0xb')]);router[_0x173a('0xc')]('/',auth[_0x173a('0x8')](),controller[_0x173a('0xd')]);router[_0x173a('0xe')](_0x173a('0xa'),auth['isAuthenticated'](),controller[_0x173a('0xf')]);router['delete'](_0x173a('0xa'),auth[_0x173a('0x8')](),controller[_0x173a('0x10')]);module[_0x173a('0x11')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index e1e55a7..d0cd31a 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 _0x4444=['exports','TEXT','sequelize'];(function(_0x2b819f,_0x471dd9){var _0x1335cb=function(_0x338bc8){while(--_0x338bc8){_0x2b819f['push'](_0x2b819f['shift']());}};_0x1335cb(++_0x471dd9);}(_0x4444,0x1c7));var _0x4444=function(_0x2fcf6b,_0xd140ff){_0x2fcf6b=_0x2fcf6b-0x0;var _0x155073=_0x4444[_0x2fcf6b];return _0x155073;};'use strict';var Sequelize=require(_0x4444('0x0'));module[_0x4444('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0x4444('0x2')]}}; \ No newline at end of file +var _0x0985=['exports','STRING','sequelize'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x0985,0x185));var _0x5098=function(_0x1cd08f,_0x1eaa41){_0x1cd08f=_0x1cd08f-0x0;var _0x371fbd=_0x0985[_0x1cd08f];return _0x371fbd;};'use strict';var Sequelize=require(_0x5098('0x0'));module[_0x5098('0x1')]={'name':{'type':Sequelize[_0x5098('0x2')]},'description':{'type':Sequelize[_0x5098('0x2')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index e317591..80de8fc 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 _0x0555=['pick','where','merge','type','filter','options','includeAll','include','catch','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Template','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x760093,_0x1e96f0){var _0x161ff0=function(_0xfa2152){while(--_0xfa2152){_0x760093['push'](_0x760093['shift']());}};_0x161ff0(++_0x1e96f0);}(_0x0555,0x19e));var _0x5055=function(_0x243741,_0x5f4625){_0x243741=_0x243741-0x0;var _0x5f4e9c=_0x0555[_0x243741];return _0x5f4e9c;};'use strict';var emlformat=require(_0x5055('0x0'));var rimraf=require(_0x5055('0x1'));var zipdir=require(_0x5055('0x2'));var jsonpatch=require(_0x5055('0x3'));var rp=require(_0x5055('0x4'));var moment=require(_0x5055('0x5'));var BPromise=require(_0x5055('0x6'));var Mustache=require(_0x5055('0x7'));var util=require(_0x5055('0x8'));var path=require(_0x5055('0x9'));var sox=require(_0x5055('0xa'));var csv=require(_0x5055('0xb'));var ejs=require(_0x5055('0xc'));var fs=require('fs');var fs_extra=require(_0x5055('0xd'));var _=require(_0x5055('0xe'));var squel=require(_0x5055('0xf'));var crypto=require(_0x5055('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('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5055('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5055('0x12'))(_0x5055('0x13'));var utils=require(_0x5055('0x14'));var config=require(_0x5055('0x15'));var licenseUtil=require(_0x5055('0x16'));var db=require(_0x5055('0x17'))['db'];function respondWithStatusCode(_0x4cfb45,_0x3ec210){_0x3ec210=_0x3ec210||0xcc;return function(_0xd73fa4){if(_0xd73fa4){return _0x4cfb45[_0x5055('0x18')](_0x3ec210);}return _0x4cfb45[_0x5055('0x19')](_0x3ec210)[_0x5055('0x1a')]();};}function respondWithResult(_0x5b895c,_0x26bae8){_0x26bae8=_0x26bae8||0xc8;return function(_0x38730d){if(_0x38730d){return _0x5b895c[_0x5055('0x19')](_0x26bae8)[_0x5055('0x1b')](_0x38730d);}};}function respondWithFilteredResult(_0x2959a8,_0x4f9f75){return function(_0x1db01c){if(_0x1db01c){var _0x2a54bd=typeof _0x4f9f75[_0x5055('0x1c')]===_0x5055('0x1d')&&typeof _0x4f9f75['limit']==='undefined';var _0x302006=_0x1db01c[_0x5055('0x1e')];var _0x20813b=_0x2a54bd?0x0:_0x4f9f75[_0x5055('0x1c')];var _0x37ae9d=_0x2a54bd?_0x1db01c[_0x5055('0x1e')]:_0x4f9f75[_0x5055('0x1c')]+_0x4f9f75[_0x5055('0x1f')];var _0x4eea75;if(_0x37ae9d>=_0x302006){_0x37ae9d=_0x302006;_0x4eea75=0xc8;}else{_0x4eea75=0xce;}_0x2959a8[_0x5055('0x19')](_0x4eea75);return _0x2959a8[_0x5055('0x20')](_0x5055('0x21'),_0x20813b+'-'+_0x37ae9d+'/'+_0x302006)['json'](_0x1db01c);}return null;};}function patchUpdates(_0x13a542){return function(_0xb60ad1){try{jsonpatch['apply'](_0xb60ad1,_0x13a542,!![]);}catch(_0x4e70cb){return BPromise[_0x5055('0x22')](_0x4e70cb);}return _0xb60ad1[_0x5055('0x23')]();};}function saveUpdates(_0x30e2bb,_0xd84658){return function(_0x55f5b4){if(_0x55f5b4){return _0x55f5b4['update'](_0x30e2bb)[_0x5055('0x24')](function(_0x2f1835){return _0x2f1835;});}return null;};}function removeEntity(_0x2406af,_0x3b4fe8){return function(_0x3dd9cd){if(_0x3dd9cd){return _0x3dd9cd[_0x5055('0x25')]()['then'](function(){var _0xc07072=_0x3dd9cd[_0x5055('0x26')]({'plain':!![]});var _0x5655bb='Templates';return db[_0x5055('0x27')][_0x5055('0x25')]({'where':{'type':_0x5655bb,'resourceId':_0xc07072['id']}})[_0x5055('0x24')](function(){return _0x3dd9cd;});})[_0x5055('0x24')](function(){_0x2406af[_0x5055('0x19')](0xcc)[_0x5055('0x1a')]();});}};}function handleEntityNotFound(_0x4d81b9,_0x2b7273){return function(_0x122f02){if(!_0x122f02){_0x4d81b9[_0x5055('0x18')](0x194);}return _0x122f02;};}function handleError(_0x3a322b,_0x370b9b){_0x370b9b=_0x370b9b||0x1f4;return function(_0x19427d){logger[_0x5055('0x28')](_0x19427d[_0x5055('0x29')]);if(_0x19427d[_0x5055('0x2a')]){delete _0x19427d[_0x5055('0x2a')];}_0x3a322b[_0x5055('0x19')](_0x370b9b)[_0x5055('0x2b')](_0x19427d);};}exports[_0x5055('0x2c')]=function(_0x5a4d63,_0x3f89ff){var _0x312ec9={},_0xcd7306={},_0x7b03fb={'count':0x0,'rows':[]};var _0x5e039a=_[_0x5055('0x2d')](db[_0x5055('0x2e')]['rawAttributes'],function(_0x187d06){return{'name':_0x187d06[_0x5055('0x2f')],'type':_0x187d06['type']['key']};});_0xcd7306[_0x5055('0x30')]=_['map'](_0x5e039a,_0x5055('0x2a'));_0xcd7306[_0x5055('0x31')]=_[_0x5055('0x32')](_0x5a4d63[_0x5055('0x31')]);_0xcd7306[_0x5055('0x33')]=_[_0x5055('0x34')](_0xcd7306[_0x5055('0x30')],_0xcd7306[_0x5055('0x31')]);_0x312ec9[_0x5055('0x35')]=_[_0x5055('0x34')](_0xcd7306['model'],qs[_0x5055('0x36')](_0x5a4d63['query'][_0x5055('0x36')]));_0x312ec9[_0x5055('0x35')]=_0x312ec9[_0x5055('0x35')][_0x5055('0x37')]?_0x312ec9['attributes']:_0xcd7306[_0x5055('0x30')];if(!_0x5a4d63[_0x5055('0x31')][_0x5055('0x38')](_0x5055('0x39'))){_0x312ec9[_0x5055('0x1f')]=qs[_0x5055('0x1f')](_0x5a4d63[_0x5055('0x31')][_0x5055('0x1f')]);_0x312ec9['offset']=qs[_0x5055('0x1c')](_0x5a4d63[_0x5055('0x31')][_0x5055('0x1c')]);}_0x312ec9[_0x5055('0x3a')]=qs['sort'](_0x5a4d63['query'][_0x5055('0x3b')]);_0x312ec9['where']=qs[_0x5055('0x33')](_[_0x5055('0x3c')](_0x5a4d63[_0x5055('0x31')],_0xcd7306['filters']),_0x5e039a);if(_0x5a4d63[_0x5055('0x31')]['filter']){_0x312ec9[_0x5055('0x3d')]=_[_0x5055('0x3e')](_0x312ec9[_0x5055('0x3d')],{'$or':_['map'](_0x5e039a,function(_0x38bb46){if(_0x38bb46[_0x5055('0x3f')]!=='VIRTUAL'){var _0x5caade={};_0x5caade[_0x38bb46[_0x5055('0x2a')]]={'$like':'%'+_0x5a4d63['query'][_0x5055('0x40')]+'%'};return _0x5caade;}})});}_0x312ec9=_['merge']({},_0x312ec9,_0x5a4d63[_0x5055('0x41')]);var _0x218850={'where':_0x312ec9[_0x5055('0x3d')]};return db[_0x5055('0x2e')]['count'](_0x218850)[_0x5055('0x24')](function(_0x521b23){_0x7b03fb[_0x5055('0x1e')]=_0x521b23;if(_0x5a4d63['query'][_0x5055('0x42')]){_0x312ec9[_0x5055('0x43')]=[{'all':!![]}];}return db[_0x5055('0x2e')]['findAll'](_0x312ec9);})['then'](function(_0xb60173){_0x7b03fb['rows']=_0xb60173;return _0x7b03fb;})[_0x5055('0x24')](respondWithFilteredResult(_0x3f89ff,_0x312ec9))[_0x5055('0x44')](handleError(_0x3f89ff,null));};exports['show']=function(_0x158603,_0x4ac706){var _0x225e0d={'raw':!![],'where':{'id':_0x158603['params']['id']}},_0x5833da={};_0x5833da[_0x5055('0x30')]=_['keys'](db[_0x5055('0x2e')][_0x5055('0x45')]);_0x5833da[_0x5055('0x31')]=_[_0x5055('0x32')](_0x158603['query']);_0x5833da[_0x5055('0x33')]=_['intersection'](_0x5833da['model'],_0x5833da[_0x5055('0x31')]);_0x225e0d[_0x5055('0x35')]=_[_0x5055('0x34')](_0x5833da[_0x5055('0x30')],qs['fields'](_0x158603['query'][_0x5055('0x36')]));_0x225e0d[_0x5055('0x35')]=_0x225e0d[_0x5055('0x35')][_0x5055('0x37')]?_0x225e0d[_0x5055('0x35')]:_0x5833da[_0x5055('0x30')];if(_0x158603[_0x5055('0x31')][_0x5055('0x42')]){_0x225e0d[_0x5055('0x43')]=[{'all':!![]}];}_0x225e0d=_[_0x5055('0x3e')]({},_0x225e0d,_0x158603['options']);return db[_0x5055('0x2e')]['find'](_0x225e0d)['then'](handleEntityNotFound(_0x4ac706,null))[_0x5055('0x24')](respondWithResult(_0x4ac706,null))[_0x5055('0x44')](handleError(_0x4ac706,null));};exports['create']=function(_0x1fceda,_0x1f3def){return db['Template'][_0x5055('0x46')](_0x1fceda[_0x5055('0x47')],{})['then'](function(_0x32857a){var _0x2a4656=_0x1fceda[_0x5055('0x48')]['get']({'plain':!![]});if(!_0x2a4656)throw new Error(_0x5055('0x49'));if(_0x2a4656[_0x5055('0x4a')]===_0x5055('0x48')){var _0x3c0039=_0x32857a[_0x5055('0x26')]({'plain':!![]});var _0x212dd7='Templates';return db['UserProfileSection']['find']({'where':{'name':_0x212dd7,'userProfileId':_0x2a4656[_0x5055('0x4b')]},'raw':!![]})['then'](function(_0x179342){if(_0x179342&&_0x179342[_0x5055('0x4c')]===0x0){return db['UserProfileResource']['create']({'name':_0x3c0039[_0x5055('0x2a')],'resourceId':_0x3c0039['id'],'type':_0x179342[_0x5055('0x2a')],'sectionId':_0x179342['id']},{})[_0x5055('0x24')](function(){return _0x32857a;});}else{return _0x32857a;}})['catch'](function(_0x38584f){logger[_0x5055('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x38584f);throw _0x38584f;});}return _0x32857a;})[_0x5055('0x24')](respondWithResult(_0x1f3def,0xc9))[_0x5055('0x44')](handleError(_0x1f3def,null));};exports['update']=function(_0x2ad71a,_0x1a2760){if(_0x2ad71a[_0x5055('0x47')]['id']){delete _0x2ad71a['body']['id'];}return db[_0x5055('0x2e')][_0x5055('0x4d')]({'where':{'id':_0x2ad71a['params']['id']}})['then'](handleEntityNotFound(_0x1a2760,null))[_0x5055('0x24')](saveUpdates(_0x2ad71a[_0x5055('0x47')],null))['then'](respondWithResult(_0x1a2760,null))[_0x5055('0x44')](handleError(_0x1a2760,null));};exports[_0x5055('0x25')]=function(_0x4ac03b,_0x311127){return db[_0x5055('0x2e')][_0x5055('0x4d')]({'where':{'id':_0x4ac03b[_0x5055('0x4e')]['id']}})[_0x5055('0x24')](handleEntityNotFound(_0x311127,null))[_0x5055('0x24')](removeEntity(_0x311127,null))[_0x5055('0x44')](handleError(_0x311127,null));}; \ No newline at end of file +var _0x8501=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','reject','save','update','then','get','Templates','destroy','error','stack','name','send','index','map','Template','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x40b3f2,_0x2c4f5f){var _0x4ce90c=function(_0x516f31){while(--_0x516f31){_0x40b3f2['push'](_0x40b3f2['shift']());}};_0x4ce90c(++_0x2c4f5f);}(_0x8501,0xeb));var _0x1850=function(_0x142ec2,_0x5bb03d){_0x142ec2=_0x142ec2-0x0;var _0x45ef4e=_0x8501[_0x142ec2];return _0x45ef4e;};'use strict';var emlformat=require(_0x1850('0x0'));var rimraf=require(_0x1850('0x1'));var zipdir=require(_0x1850('0x2'));var jsonpatch=require(_0x1850('0x3'));var rp=require(_0x1850('0x4'));var moment=require(_0x1850('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1850('0x6'));var util=require(_0x1850('0x7'));var path=require('path');var sox=require(_0x1850('0x8'));var csv=require(_0x1850('0x9'));var ejs=require(_0x1850('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1850('0xb'));var squel=require(_0x1850('0xc'));var crypto=require(_0x1850('0xd'));var jsforce=require(_0x1850('0xe'));var deskjs=require(_0x1850('0xf'));var toCsv=require(_0x1850('0x9'));var querystring=require(_0x1850('0x10'));var Papa=require(_0x1850('0x11'));var Redis=require(_0x1850('0x12'));var authService=require(_0x1850('0x13'));var qs=require(_0x1850('0x14'));var as=require(_0x1850('0x15'));var hardwareService=require(_0x1850('0x16'));var logger=require('../../config/logger')(_0x1850('0x17'));var utils=require(_0x1850('0x18'));var config=require(_0x1850('0x19'));var licenseUtil=require(_0x1850('0x1a'));var db=require(_0x1850('0x1b'))['db'];function respondWithStatusCode(_0x273943,_0xf21266){_0xf21266=_0xf21266||0xcc;return function(_0x10b740){if(_0x10b740){return _0x273943[_0x1850('0x1c')](_0xf21266);}return _0x273943[_0x1850('0x1d')](_0xf21266)[_0x1850('0x1e')]();};}function respondWithResult(_0x5322c8,_0x321734){_0x321734=_0x321734||0xc8;return function(_0x34baec){if(_0x34baec){return _0x5322c8[_0x1850('0x1d')](_0x321734)[_0x1850('0x1f')](_0x34baec);}};}function respondWithFilteredResult(_0x16da18,_0x56a72d){return function(_0xa3adf6){if(_0xa3adf6){var _0x239448=typeof _0x56a72d['offset']===_0x1850('0x20')&&typeof _0x56a72d[_0x1850('0x21')]===_0x1850('0x20');var _0x140b19=_0xa3adf6[_0x1850('0x22')];var _0x490b66=_0x239448?0x0:_0x56a72d['offset'];var _0x1d1c8b=_0x239448?_0xa3adf6['count']:_0x56a72d[_0x1850('0x23')]+_0x56a72d[_0x1850('0x21')];var _0x29e396;if(_0x1d1c8b>=_0x140b19){_0x1d1c8b=_0x140b19;_0x29e396=0xc8;}else{_0x29e396=0xce;}_0x16da18[_0x1850('0x1d')](_0x29e396);return _0x16da18['set'](_0x1850('0x24'),_0x490b66+'-'+_0x1d1c8b+'/'+_0x140b19)[_0x1850('0x1f')](_0xa3adf6);}return null;};}function patchUpdates(_0x5a80ee){return function(_0x2716fa){try{jsonpatch['apply'](_0x2716fa,_0x5a80ee,!![]);}catch(_0x5aba37){return BPromise[_0x1850('0x25')](_0x5aba37);}return _0x2716fa[_0x1850('0x26')]();};}function saveUpdates(_0x49b6fb,_0x51121c){return function(_0x246748){if(_0x246748){return _0x246748[_0x1850('0x27')](_0x49b6fb)[_0x1850('0x28')](function(_0x421697){return _0x421697;});}return null;};}function removeEntity(_0x390e6f,_0x6cf7cf){return function(_0x1d43f7){if(_0x1d43f7){return _0x1d43f7['destroy']()[_0x1850('0x28')](function(){var _0x8af324=_0x1d43f7[_0x1850('0x29')]({'plain':!![]});var _0x58833b=_0x1850('0x2a');return db['UserProfileResource'][_0x1850('0x2b')]({'where':{'type':_0x58833b,'resourceId':_0x8af324['id']}})[_0x1850('0x28')](function(){return _0x1d43f7;});})[_0x1850('0x28')](function(){_0x390e6f[_0x1850('0x1d')](0xcc)[_0x1850('0x1e')]();});}};}function handleEntityNotFound(_0x38000c,_0xa3c639){return function(_0x6a7fc7){if(!_0x6a7fc7){_0x38000c[_0x1850('0x1c')](0x194);}return _0x6a7fc7;};}function handleError(_0x565e6c,_0x4f132d){_0x4f132d=_0x4f132d||0x1f4;return function(_0x1becf3){logger[_0x1850('0x2c')](_0x1becf3[_0x1850('0x2d')]);if(_0x1becf3[_0x1850('0x2e')]){delete _0x1becf3[_0x1850('0x2e')];}_0x565e6c[_0x1850('0x1d')](_0x4f132d)[_0x1850('0x2f')](_0x1becf3);};}exports[_0x1850('0x30')]=function(_0x45da69,_0x9022ac){var _0x5b305f={},_0x3f84a3={},_0x187859={'count':0x0,'rows':[]};var _0x58435e=_[_0x1850('0x31')](db[_0x1850('0x32')][_0x1850('0x33')],function(_0x3dbb10){return{'name':_0x3dbb10[_0x1850('0x34')],'type':_0x3dbb10[_0x1850('0x35')][_0x1850('0x36')]};});_0x3f84a3[_0x1850('0x37')]=_[_0x1850('0x31')](_0x58435e,'name');_0x3f84a3[_0x1850('0x38')]=_[_0x1850('0x39')](_0x45da69[_0x1850('0x38')]);_0x3f84a3[_0x1850('0x3a')]=_['intersection'](_0x3f84a3[_0x1850('0x37')],_0x3f84a3[_0x1850('0x38')]);_0x5b305f[_0x1850('0x3b')]=_[_0x1850('0x3c')](_0x3f84a3[_0x1850('0x37')],qs[_0x1850('0x3d')](_0x45da69['query'][_0x1850('0x3d')]));_0x5b305f[_0x1850('0x3b')]=_0x5b305f['attributes'][_0x1850('0x3e')]?_0x5b305f['attributes']:_0x3f84a3[_0x1850('0x37')];if(!_0x45da69['query'][_0x1850('0x3f')](_0x1850('0x40'))){_0x5b305f[_0x1850('0x21')]=qs[_0x1850('0x21')](_0x45da69[_0x1850('0x38')]['limit']);_0x5b305f['offset']=qs[_0x1850('0x23')](_0x45da69['query'][_0x1850('0x23')]);}_0x5b305f[_0x1850('0x41')]=qs[_0x1850('0x42')](_0x45da69[_0x1850('0x38')][_0x1850('0x42')]);_0x5b305f[_0x1850('0x43')]=qs[_0x1850('0x3a')](_[_0x1850('0x44')](_0x45da69[_0x1850('0x38')],_0x3f84a3[_0x1850('0x3a')]),_0x58435e);if(_0x45da69['query'][_0x1850('0x45')]){_0x5b305f[_0x1850('0x43')]=_[_0x1850('0x46')](_0x5b305f[_0x1850('0x43')],{'$or':_['map'](_0x58435e,function(_0x8fa4b1){if(_0x8fa4b1[_0x1850('0x35')]!==_0x1850('0x47')){var _0x24ffeb={};_0x24ffeb[_0x8fa4b1[_0x1850('0x2e')]]={'$like':'%'+_0x45da69[_0x1850('0x38')][_0x1850('0x45')]+'%'};return _0x24ffeb;}})});}_0x5b305f=_['merge']({},_0x5b305f,_0x45da69[_0x1850('0x48')]);var _0x3e47fb={'where':_0x5b305f[_0x1850('0x43')]};return db[_0x1850('0x32')][_0x1850('0x22')](_0x3e47fb)[_0x1850('0x28')](function(_0x5f5475){_0x187859[_0x1850('0x22')]=_0x5f5475;if(_0x45da69[_0x1850('0x38')][_0x1850('0x49')]){_0x5b305f[_0x1850('0x4a')]=[{'all':!![]}];}return db[_0x1850('0x32')][_0x1850('0x4b')](_0x5b305f);})[_0x1850('0x28')](function(_0x558642){_0x187859[_0x1850('0x4c')]=_0x558642;return _0x187859;})[_0x1850('0x28')](respondWithFilteredResult(_0x9022ac,_0x5b305f))[_0x1850('0x4d')](handleError(_0x9022ac,null));};exports[_0x1850('0x4e')]=function(_0x8d28d2,_0x30cbe1){var _0x28d6c2={'raw':!![],'where':{'id':_0x8d28d2[_0x1850('0x4f')]['id']}},_0x280db4={};_0x280db4[_0x1850('0x37')]=_[_0x1850('0x39')](db[_0x1850('0x32')]['rawAttributes']);_0x280db4[_0x1850('0x38')]=_[_0x1850('0x39')](_0x8d28d2[_0x1850('0x38')]);_0x280db4[_0x1850('0x3a')]=_[_0x1850('0x3c')](_0x280db4[_0x1850('0x37')],_0x280db4[_0x1850('0x38')]);_0x28d6c2[_0x1850('0x3b')]=_[_0x1850('0x3c')](_0x280db4[_0x1850('0x37')],qs[_0x1850('0x3d')](_0x8d28d2[_0x1850('0x38')][_0x1850('0x3d')]));_0x28d6c2[_0x1850('0x3b')]=_0x28d6c2[_0x1850('0x3b')][_0x1850('0x3e')]?_0x28d6c2[_0x1850('0x3b')]:_0x280db4['model'];if(_0x8d28d2[_0x1850('0x38')][_0x1850('0x49')]){_0x28d6c2['include']=[{'all':!![]}];}_0x28d6c2=_[_0x1850('0x46')]({},_0x28d6c2,_0x8d28d2['options']);return db['Template'][_0x1850('0x50')](_0x28d6c2)[_0x1850('0x28')](handleEntityNotFound(_0x30cbe1,null))[_0x1850('0x28')](respondWithResult(_0x30cbe1,null))[_0x1850('0x4d')](handleError(_0x30cbe1,null));};exports[_0x1850('0x51')]=function(_0x4bd1fa,_0x56f2b6){return db['Template'][_0x1850('0x51')](_0x4bd1fa[_0x1850('0x52')],{})['then'](function(_0x2e41c5){var _0x1b9647=_0x4bd1fa[_0x1850('0x53')][_0x1850('0x29')]({'plain':!![]});if(!_0x1b9647)throw new Error(_0x1850('0x54'));if(_0x1b9647[_0x1850('0x55')]===_0x1850('0x53')){var _0x26b19=_0x2e41c5['get']({'plain':!![]});var _0x72c4a1=_0x1850('0x2a');return db['UserProfileSection'][_0x1850('0x50')]({'where':{'name':_0x72c4a1,'userProfileId':_0x1b9647['userProfileId']},'raw':!![]})[_0x1850('0x28')](function(_0xfeef33){if(_0xfeef33&&_0xfeef33[_0x1850('0x56')]===0x0){return db['UserProfileResource'][_0x1850('0x51')]({'name':_0x26b19[_0x1850('0x2e')],'resourceId':_0x26b19['id'],'type':_0xfeef33[_0x1850('0x2e')],'sectionId':_0xfeef33['id']},{})[_0x1850('0x28')](function(){return _0x2e41c5;});}else{return _0x2e41c5;}})[_0x1850('0x4d')](function(_0x2ec816){logger[_0x1850('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ec816);throw _0x2ec816;});}return _0x2e41c5;})[_0x1850('0x28')](respondWithResult(_0x56f2b6,0xc9))[_0x1850('0x4d')](handleError(_0x56f2b6,null));};exports[_0x1850('0x27')]=function(_0x2dc8df,_0x32ab48){if(_0x2dc8df[_0x1850('0x52')]['id']){delete _0x2dc8df['body']['id'];}return db[_0x1850('0x32')]['find']({'where':{'id':_0x2dc8df[_0x1850('0x4f')]['id']}})[_0x1850('0x28')](handleEntityNotFound(_0x32ab48,null))[_0x1850('0x28')](saveUpdates(_0x2dc8df[_0x1850('0x52')],null))[_0x1850('0x28')](respondWithResult(_0x32ab48,null))[_0x1850('0x4d')](handleError(_0x32ab48,null));};exports[_0x1850('0x2b')]=function(_0x57e040,_0x2f9b3e){return db[_0x1850('0x32')][_0x1850('0x50')]({'where':{'id':_0x57e040[_0x1850('0x4f')]['id']}})[_0x1850('0x28')](handleEntityNotFound(_0x2f9b3e,null))['then'](removeEntity(_0x2f9b3e,null))[_0x1850('0x4d')](handleError(_0x2f9b3e,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 82c1e14..e555657 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 _0xc570=['rimraf','../../config/environment','Template','lodash','../../config/logger','api','moment','bluebird'];(function(_0x32e779,_0x1c2596){var _0x47d7b3=function(_0x37c2d8){while(--_0x37c2d8){_0x32e779['push'](_0x32e779['shift']());}};_0x47d7b3(++_0x1c2596);}(_0xc570,0x83));var _0x0c57=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xc570[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require(_0x0c57('0x0'));var util=require('util');var logger=require(_0x0c57('0x1'))(_0x0c57('0x2'));var moment=require(_0x0c57('0x3'));var BPromise=require(_0x0c57('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0c57('0x5'));var config=require(_0x0c57('0x6'));var attributes=require('./template.attributes');module['exports']=function(_0xf1c17f,_0x2305a0){return _0xf1c17f['define'](_0x0c57('0x7'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa2e9=['../../config/environment','./template.attributes','Template','tools_templates','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x17e696,_0xad1c39){var _0x1a9e33=function(_0x28d22a){while(--_0x28d22a){_0x17e696['push'](_0x17e696['shift']());}};_0x1a9e33(++_0xad1c39);}(_0xa2e9,0x117));var _0x9a2e=function(_0x36feb2,_0x53abef){_0x36feb2=_0x36feb2-0x0;var _0x292b43=_0xa2e9[_0x36feb2];return _0x292b43;};'use strict';var _=require(_0x9a2e('0x0'));var util=require(_0x9a2e('0x1'));var logger=require(_0x9a2e('0x2'))(_0x9a2e('0x3'));var moment=require('moment');var BPromise=require(_0x9a2e('0x4'));var rp=require(_0x9a2e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9a2e('0x6'));var config=require(_0x9a2e('0x7'));var attributes=require(_0x9a2e('0x8'));module['exports']=function(_0x1e58dd,_0x25bdb4){return _0x1e58dd['define'](_0x9a2e('0x9'),attributes,{'tableName':_0x9a2e('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 e0bbf47..ec7838e 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 _0x8a01=['attributes','include','map','model','stringify','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','error','message','result','GetTemplate','Template','findAll','options','where'];(function(_0x52ab9d,_0x1a7444){var _0x1ede12=function(_0x2b36ee){while(--_0x2b36ee){_0x52ab9d['push'](_0x52ab9d['shift']());}};_0x1ede12(++_0x1a7444);}(_0x8a01,0x13c));var _0x18a0=function(_0x137322,_0x201201){_0x137322=_0x137322-0x0;var _0x45ca3f=_0x8a01[_0x137322];return _0x45ca3f;};'use strict';var _=require('lodash');var util=require(_0x18a0('0x0'));var moment=require(_0x18a0('0x1'));var BPromise=require(_0x18a0('0x2'));var rs=require(_0x18a0('0x3'));var fs=require('fs');var Redis=require(_0x18a0('0x4'));var db=require(_0x18a0('0x5'))['db'];var utils=require(_0x18a0('0x6'));var logger=require(_0x18a0('0x7'))(_0x18a0('0x8'));var config=require(_0x18a0('0x9'));var jayson=require(_0x18a0('0xa'));var client=jayson['client'][_0x18a0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x297f53,_0x11a8dc,_0x494331){return new BPromise(function(_0x14c039,_0x2c7596){return client[_0x18a0('0xc')](_0x297f53,_0x494331)[_0x18a0('0xd')](function(_0x15e603){logger[_0x18a0('0xe')](_0x18a0('0xf'),_0x11a8dc,'request\x20sent');logger['debug']('Template,\x20%s,\x20%s,\x20%s',_0x11a8dc,_0x18a0('0x10'),JSON['stringify'](_0x15e603));if(_0x15e603['error']){if(_0x15e603[_0x18a0('0x11')]['code']===0x1f4){logger[_0x18a0('0x11')](_0x18a0('0xf'),_0x11a8dc,_0x15e603['error']['message']);return _0x2c7596(_0x15e603[_0x18a0('0x11')][_0x18a0('0x12')]);}logger[_0x18a0('0x11')](_0x18a0('0xf'),_0x11a8dc,_0x15e603[_0x18a0('0x11')][_0x18a0('0x12')]);return _0x14c039(_0x15e603[_0x18a0('0x11')][_0x18a0('0x12')]);}else{logger[_0x18a0('0xe')](_0x18a0('0xf'),_0x11a8dc,_0x18a0('0x10'));_0x14c039(_0x15e603[_0x18a0('0x13')][_0x18a0('0x12')]);}})['catch'](function(_0x1b2fc7){logger[_0x18a0('0x11')](_0x18a0('0xf'),_0x11a8dc,_0x1b2fc7);_0x2c7596(_0x1b2fc7);});});}exports[_0x18a0('0x14')]=function(_0xae464c){var _0x4efb32=this;return new Promise(function(_0xc977a7,_0x19583a){return db[_0x18a0('0x15')][_0x18a0('0x16')]({'raw':_0xae464c['options']?_0xae464c['options']['raw']===undefined?!![]:![]:!![],'where':_0xae464c[_0x18a0('0x17')]?_0xae464c['options'][_0x18a0('0x18')]||null:null,'attributes':_0xae464c[_0x18a0('0x17')]?_0xae464c[_0x18a0('0x17')][_0x18a0('0x19')]||null:null,'limit':_0xae464c[_0x18a0('0x17')]?_0xae464c['options']['limit']||null:null,'include':_0xae464c[_0x18a0('0x17')]?_0xae464c[_0x18a0('0x17')][_0x18a0('0x1a')]?_[_0x18a0('0x1b')](_0xae464c[_0x18a0('0x17')]['include'],function(_0x394232){return{'model':db[_0x394232[_0x18a0('0x1c')]],'as':_0x394232['as'],'attributes':_0x394232[_0x18a0('0x19')],'include':_0x394232['include']?_[_0x18a0('0x1b')](_0x394232[_0x18a0('0x1a')],function(_0x1e3d85){return{'model':db[_0x1e3d85[_0x18a0('0x1c')]],'as':_0x1e3d85['as'],'attributes':_0x1e3d85[_0x18a0('0x19')],'include':_0x1e3d85[_0x18a0('0x1a')]?_[_0x18a0('0x1b')](_0x1e3d85[_0x18a0('0x1a')],function(_0x46e642){return{'model':db[_0x46e642['model']],'as':_0x46e642['as'],'attributes':_0x46e642[_0x18a0('0x19')]};}):[]};}):[]};}):[]:[]})[_0x18a0('0xd')](function(_0x51768c){logger['info'](_0x18a0('0x14'),_0xae464c);logger['debug'](_0x18a0('0x14'),_0xae464c,JSON[_0x18a0('0x1d')](_0x51768c));_0xc977a7(_0x51768c);})[_0x18a0('0x1e')](function(_0x5a951c){logger['error']('GetTemplate',_0x5a951c[_0x18a0('0x12')],_0xae464c);_0x19583a(_0x4efb32[_0x18a0('0x11')](0x1f4,_0x5a951c[_0x18a0('0x12')]));});});}; \ No newline at end of file +var _0x307f=['code','message','catch','GetTemplate','options','attributes','limit','map','include','then','stringify','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','error'];(function(_0x40e7e9,_0x5d4829){var _0xe29fb4=function(_0x3b933c){while(--_0x3b933c){_0x40e7e9['push'](_0x40e7e9['shift']());}};_0xe29fb4(++_0x5d4829);}(_0x307f,0x1af));var _0xf307=function(_0x2f3c54,_0xa00f36){_0x2f3c54=_0x2f3c54-0x0;var _0x647bd=_0x307f[_0x2f3c54];return _0x647bd;};'use strict';var _=require(_0xf307('0x0'));var util=require(_0xf307('0x1'));var moment=require(_0xf307('0x2'));var BPromise=require(_0xf307('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf307('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf307('0x5'));var logger=require('../../config/logger')(_0xf307('0x6'));var config=require(_0xf307('0x7'));var jayson=require(_0xf307('0x8'));var client=jayson[_0xf307('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11d261,_0x36727d,_0x383806){return new BPromise(function(_0x1149cb,_0x432ddb){return client[_0xf307('0xa')](_0x11d261,_0x383806)['then'](function(_0x14fabe){logger[_0xf307('0xb')](_0xf307('0xc'),_0x36727d,_0xf307('0xd'));logger[_0xf307('0xe')](_0xf307('0xf'),_0x36727d,'request\x20sent',JSON['stringify'](_0x14fabe));if(_0x14fabe[_0xf307('0x10')]){if(_0x14fabe['error'][_0xf307('0x11')]===0x1f4){logger['error'](_0xf307('0xc'),_0x36727d,_0x14fabe[_0xf307('0x10')][_0xf307('0x12')]);return _0x432ddb(_0x14fabe['error']['message']);}logger[_0xf307('0x10')](_0xf307('0xc'),_0x36727d,_0x14fabe[_0xf307('0x10')][_0xf307('0x12')]);return _0x1149cb(_0x14fabe['error'][_0xf307('0x12')]);}else{logger[_0xf307('0xb')](_0xf307('0xc'),_0x36727d,_0xf307('0xd'));_0x1149cb(_0x14fabe['result']['message']);}})[_0xf307('0x13')](function(_0x860747){logger[_0xf307('0x10')](_0xf307('0xc'),_0x36727d,_0x860747);_0x432ddb(_0x860747);});});}exports[_0xf307('0x14')]=function(_0x305be0){var _0x727a25=this;return new Promise(function(_0x55aee7,_0x4ca2de){return db['Template']['findAll']({'raw':_0x305be0[_0xf307('0x15')]?_0x305be0[_0xf307('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x305be0['options']?_0x305be0[_0xf307('0x15')]['where']||null:null,'attributes':_0x305be0[_0xf307('0x15')]?_0x305be0['options'][_0xf307('0x16')]||null:null,'limit':_0x305be0[_0xf307('0x15')]?_0x305be0[_0xf307('0x15')][_0xf307('0x17')]||null:null,'include':_0x305be0['options']?_0x305be0[_0xf307('0x15')]['include']?_[_0xf307('0x18')](_0x305be0[_0xf307('0x15')][_0xf307('0x19')],function(_0x2dd754){return{'model':db[_0x2dd754['model']],'as':_0x2dd754['as'],'attributes':_0x2dd754[_0xf307('0x16')],'include':_0x2dd754[_0xf307('0x19')]?_['map'](_0x2dd754[_0xf307('0x19')],function(_0x24e8b6){return{'model':db[_0x24e8b6['model']],'as':_0x24e8b6['as'],'attributes':_0x24e8b6[_0xf307('0x16')],'include':_0x24e8b6[_0xf307('0x19')]?_[_0xf307('0x18')](_0x24e8b6['include'],function(_0x576991){return{'model':db[_0x576991['model']],'as':_0x576991['as'],'attributes':_0x576991[_0xf307('0x16')]};}):[]};}):[]};}):[]:[]})[_0xf307('0x1a')](function(_0x45bd9b){logger['info']('GetTemplate',_0x305be0);logger['debug'](_0xf307('0x14'),_0x305be0,JSON[_0xf307('0x1b')](_0x45bd9b));_0x55aee7(_0x45bd9b);})[_0xf307('0x13')](function(_0x2bb268){logger[_0xf307('0x10')](_0xf307('0x14'),_0x2bb268[_0xf307('0x12')],_0x305be0);_0x4ca2de(_0x727a25['error'](0x1f4,_0x2bb268[_0xf307('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 04c5e9a..a1d1119 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 _0xac67=['getAnyConditions','/:id/actions','getActions','post','create','addAnyCondition','addAction','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','isAuthenticated','/:id','get','/:id/all_conditions','getAllConditions','/:id/any_conditions'];(function(_0x1cdd50,_0x44941d){var _0x3546c3=function(_0x10b12c){while(--_0x10b12c){_0x1cdd50['push'](_0x1cdd50['shift']());}};_0x3546c3(++_0x44941d);}(_0xac67,0x1d7));var _0x7ac6=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xac67[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0x7ac6('0x0'));var util=require(_0x7ac6('0x1'));var path=require(_0x7ac6('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7ac6('0x3')]();var fs_extra=require(_0x7ac6('0x4'));var auth=require(_0x7ac6('0x5'));var interaction=require(_0x7ac6('0x6'));var config=require(_0x7ac6('0x7'));var controller=require(_0x7ac6('0x8'));router['get']('/',auth[_0x7ac6('0x9')](),controller['index']);router['get'](_0x7ac6('0xa'),auth[_0x7ac6('0x9')](),controller['show']);router[_0x7ac6('0xb')](_0x7ac6('0xc'),auth[_0x7ac6('0x9')](),controller[_0x7ac6('0xd')]);router[_0x7ac6('0xb')](_0x7ac6('0xe'),auth[_0x7ac6('0x9')](),controller[_0x7ac6('0xf')]);router[_0x7ac6('0xb')](_0x7ac6('0x10'),auth[_0x7ac6('0x9')](),controller[_0x7ac6('0x11')]);router[_0x7ac6('0x12')]('/',auth['isAuthenticated'](),controller[_0x7ac6('0x13')]);router[_0x7ac6('0x12')](_0x7ac6('0xc'),auth[_0x7ac6('0x9')](),controller['addAllCondition']);router[_0x7ac6('0x12')]('/:id/any_conditions',auth[_0x7ac6('0x9')](),controller[_0x7ac6('0x14')]);router[_0x7ac6('0x12')](_0x7ac6('0x10'),auth[_0x7ac6('0x9')](),controller[_0x7ac6('0x15')]);router[_0x7ac6('0x16')](_0x7ac6('0xa'),auth['isAuthenticated'](),controller[_0x7ac6('0x17')]);router[_0x7ac6('0x18')](_0x7ac6('0xa'),auth['isAuthenticated'](),controller[_0x7ac6('0x19')]);module[_0x7ac6('0x1a')]=router; \ No newline at end of file +var _0xcb2c=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','/:id','isAuthenticated','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','addAllCondition','addAnyCondition','addAction','put','update','delete','destroy'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xcb2c,0x17a));var _0xccb2=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xcb2c[_0x139a3c];return _0x2b375b;};'use strict';var multer=require(_0xccb2('0x0'));var util=require(_0xccb2('0x1'));var path=require(_0xccb2('0x2'));var timeout=require(_0xccb2('0x3'));var express=require(_0xccb2('0x4'));var router=express['Router']();var fs_extra=require(_0xccb2('0x5'));var auth=require(_0xccb2('0x6'));var interaction=require(_0xccb2('0x7'));var config=require(_0xccb2('0x8'));var controller=require(_0xccb2('0x9'));router[_0xccb2('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xccb2('0xa')](_0xccb2('0xb'),auth[_0xccb2('0xc')](),controller[_0xccb2('0xd')]);router[_0xccb2('0xa')](_0xccb2('0xe'),auth[_0xccb2('0xc')](),controller[_0xccb2('0xf')]);router[_0xccb2('0xa')](_0xccb2('0x10'),auth[_0xccb2('0xc')](),controller[_0xccb2('0x11')]);router['get'](_0xccb2('0x12'),auth[_0xccb2('0xc')](),controller[_0xccb2('0x13')]);router[_0xccb2('0x14')]('/',auth[_0xccb2('0xc')](),controller['create']);router[_0xccb2('0x14')](_0xccb2('0xe'),auth['isAuthenticated'](),controller[_0xccb2('0x15')]);router[_0xccb2('0x14')](_0xccb2('0x10'),auth[_0xccb2('0xc')](),controller[_0xccb2('0x16')]);router[_0xccb2('0x14')](_0xccb2('0x12'),auth[_0xccb2('0xc')](),controller[_0xccb2('0x17')]);router[_0xccb2('0x18')]('/:id',auth[_0xccb2('0xc')](),controller[_0xccb2('0x19')]);router[_0xccb2('0x1a')]('/:id',auth[_0xccb2('0xc')](),controller[_0xccb2('0x1b')]);module[_0xccb2('0x1c')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 3040b6d..c6bf10c 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 _0x8d56=['exports','STRING','BOOLEAN','sequelize'];(function(_0x4a94b1,_0x4f2518){var _0x20949f=function(_0x1c4aa6){while(--_0x1c4aa6){_0x4a94b1['push'](_0x4a94b1['shift']());}};_0x20949f(++_0x4f2518);}(_0x8d56,0x1c3));var _0x68d5=function(_0x549278,_0x450754){_0x549278=_0x549278-0x0;var _0x1ea9a1=_0x8d56[_0x549278];return _0x1ea9a1;};'use strict';var Sequelize=require(_0x68d5('0x0'));module[_0x68d5('0x1')]={'name':{'type':Sequelize[_0x68d5('0x2')]},'channel':{'type':Sequelize[_0x68d5('0x2')]},'description':{'type':Sequelize[_0x68d5('0x2')]},'status':{'type':Sequelize[_0x68d5('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x5ad8=['exports','sequelize'];(function(_0x30922e,_0x5bd9eb){var _0x4f1ec2=function(_0x8f9f33){while(--_0x8f9f33){_0x30922e['push'](_0x30922e['shift']());}};_0x4f1ec2(++_0x5bd9eb);}(_0x5ad8,0xa9));var _0x85ad=function(_0x88281e,_0x502f0b){_0x88281e=_0x88281e-0x0;var _0x4c8edf=_0x5ad8[_0x88281e];return _0x4c8edf;};'use strict';var Sequelize=require(_0x85ad('0x0'));module[_0x85ad('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'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 03942db..84480c5 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 _0x1406=['body','addAllCondition','Condition','TriggerAnyId','getAllConditions','findOne','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','Content-Range','apply','reject','save','then','destroy','UserProfileResource','end','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update'];(function(_0x480ef8,_0x59e36c){var _0x47cc06=function(_0x5ca4cf){while(--_0x5ca4cf){_0x480ef8['push'](_0x480ef8['shift']());}};_0x47cc06(++_0x59e36c);}(_0x1406,0x6b));var _0x6140=function(_0x454a44,_0x545081){_0x454a44=_0x454a44-0x0;var _0x4b5db9=_0x1406[_0x454a44];return _0x4b5db9;};'use strict';var emlformat=require(_0x6140('0x0'));var rimraf=require(_0x6140('0x1'));var zipdir=require(_0x6140('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6140('0x3'));var moment=require(_0x6140('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6140('0x5'));var util=require(_0x6140('0x6'));var path=require('path');var sox=require(_0x6140('0x7'));var csv=require(_0x6140('0x8'));var ejs=require(_0x6140('0x9'));var fs=require('fs');var fs_extra=require(_0x6140('0xa'));var _=require(_0x6140('0xb'));var squel=require('squel');var crypto=require(_0x6140('0xc'));var jsforce=require(_0x6140('0xd'));var deskjs=require(_0x6140('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6140('0xf'));var Papa=require(_0x6140('0x10'));var Redis=require(_0x6140('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6140('0x12'));var as=require(_0x6140('0x13'));var hardwareService=require(_0x6140('0x14'));var logger=require(_0x6140('0x15'))(_0x6140('0x16'));var utils=require(_0x6140('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x6140('0x18'));var db=require(_0x6140('0x19'))['db'];function respondWithStatusCode(_0x25c154,_0x19479d){_0x19479d=_0x19479d||0xcc;return function(_0x6bd921){if(_0x6bd921){return _0x25c154[_0x6140('0x1a')](_0x19479d);}return _0x25c154['status'](_0x19479d)['end']();};}function respondWithResult(_0x599868,_0x4383ef){_0x4383ef=_0x4383ef||0xc8;return function(_0x2ebd1e){if(_0x2ebd1e){return _0x599868[_0x6140('0x1b')](_0x4383ef)['json'](_0x2ebd1e);}};}function respondWithFilteredResult(_0x2c10db,_0x3f17f4){return function(_0x40086d){if(_0x40086d){var _0x375374=typeof _0x3f17f4[_0x6140('0x1c')]==='undefined'&&typeof _0x3f17f4[_0x6140('0x1d')]===_0x6140('0x1e');var _0x18ac48=_0x40086d[_0x6140('0x1f')];var _0x61cfc4=_0x375374?0x0:_0x3f17f4['offset'];var _0xf49a24=_0x375374?_0x40086d[_0x6140('0x1f')]:_0x3f17f4[_0x6140('0x1c')]+_0x3f17f4['limit'];var _0x456586;if(_0xf49a24>=_0x18ac48){_0xf49a24=_0x18ac48;_0x456586=0xc8;}else{_0x456586=0xce;}_0x2c10db[_0x6140('0x1b')](_0x456586);return _0x2c10db['set'](_0x6140('0x20'),_0x61cfc4+'-'+_0xf49a24+'/'+_0x18ac48)['json'](_0x40086d);}return null;};}function patchUpdates(_0x1a2ddf){return function(_0x73581d){try{jsonpatch[_0x6140('0x21')](_0x73581d,_0x1a2ddf,!![]);}catch(_0xf4dfe3){return BPromise[_0x6140('0x22')](_0xf4dfe3);}return _0x73581d[_0x6140('0x23')]();};}function saveUpdates(_0x548480,_0x22de9e){return function(_0xfa3e50){if(_0xfa3e50){return _0xfa3e50['update'](_0x548480)[_0x6140('0x24')](function(_0x5de603){return _0x5de603;});}return null;};}function removeEntity(_0x148bea,_0x9b8b8){return function(_0x19295c){if(_0x19295c){return _0x19295c[_0x6140('0x25')]()[_0x6140('0x24')](function(){var _0x14602c=_0x19295c['get']({'plain':!![]});var _0x49dbee='Triggers';return db[_0x6140('0x26')][_0x6140('0x25')]({'where':{'type':_0x49dbee,'resourceId':_0x14602c['id']}})['then'](function(){return _0x19295c;});})[_0x6140('0x24')](function(){_0x148bea[_0x6140('0x1b')](0xcc)[_0x6140('0x27')]();});}};}function handleEntityNotFound(_0x30f92b,_0x122b5e){return function(_0x1bd2a5){if(!_0x1bd2a5){_0x30f92b[_0x6140('0x1a')](0x194);}return _0x1bd2a5;};}function handleError(_0x4c14a0,_0x3a06b3){_0x3a06b3=_0x3a06b3||0x1f4;return function(_0x3d2184){logger[_0x6140('0x28')](_0x3d2184[_0x6140('0x29')]);if(_0x3d2184[_0x6140('0x2a')]){delete _0x3d2184['name'];}_0x4c14a0[_0x6140('0x1b')](_0x3a06b3)[_0x6140('0x2b')](_0x3d2184);};}exports[_0x6140('0x2c')]=function(_0xe86924,_0x4c0024){var _0x53ae08={},_0x3c5fa6={},_0x29b863={'count':0x0,'rows':[]};var _0x2777cd=_[_0x6140('0x2d')](db[_0x6140('0x2e')][_0x6140('0x2f')],function(_0x21dfcd){return{'name':_0x21dfcd[_0x6140('0x30')],'type':_0x21dfcd[_0x6140('0x31')][_0x6140('0x32')]};});_0x3c5fa6[_0x6140('0x33')]=_['map'](_0x2777cd,_0x6140('0x2a'));_0x3c5fa6['query']=_[_0x6140('0x34')](_0xe86924[_0x6140('0x35')]);_0x3c5fa6[_0x6140('0x36')]=_[_0x6140('0x37')](_0x3c5fa6[_0x6140('0x33')],_0x3c5fa6[_0x6140('0x35')]);_0x53ae08[_0x6140('0x38')]=_[_0x6140('0x37')](_0x3c5fa6['model'],qs[_0x6140('0x39')](_0xe86924[_0x6140('0x35')][_0x6140('0x39')]));_0x53ae08[_0x6140('0x38')]=_0x53ae08[_0x6140('0x38')][_0x6140('0x3a')]?_0x53ae08[_0x6140('0x38')]:_0x3c5fa6['model'];if(!_0xe86924['query'][_0x6140('0x3b')](_0x6140('0x3c'))){_0x53ae08['limit']=qs[_0x6140('0x1d')](_0xe86924[_0x6140('0x35')]['limit']);_0x53ae08[_0x6140('0x1c')]=qs['offset'](_0xe86924[_0x6140('0x35')][_0x6140('0x1c')]);}_0x53ae08[_0x6140('0x3d')]=qs[_0x6140('0x3e')](_0xe86924[_0x6140('0x35')]['sort']);_0x53ae08[_0x6140('0x3f')]=qs[_0x6140('0x36')](_[_0x6140('0x40')](_0xe86924[_0x6140('0x35')],_0x3c5fa6['filters']),_0x2777cd);if(_0xe86924[_0x6140('0x35')][_0x6140('0x41')]){_0x53ae08[_0x6140('0x3f')]=_[_0x6140('0x42')](_0x53ae08[_0x6140('0x3f')],{'$or':_[_0x6140('0x2d')](_0x2777cd,function(_0x21f8a3){if(_0x21f8a3[_0x6140('0x31')]!==_0x6140('0x43')){var _0x683a8d={};_0x683a8d[_0x21f8a3[_0x6140('0x2a')]]={'$like':'%'+_0xe86924[_0x6140('0x35')][_0x6140('0x41')]+'%'};return _0x683a8d;}})});}_0x53ae08=_[_0x6140('0x42')]({},_0x53ae08,_0xe86924[_0x6140('0x44')]);var _0x59d1b2={'where':_0x53ae08['where']};return db[_0x6140('0x2e')][_0x6140('0x1f')](_0x59d1b2)[_0x6140('0x24')](function(_0x18dd40){_0x29b863[_0x6140('0x1f')]=_0x18dd40;if(_0xe86924[_0x6140('0x35')][_0x6140('0x45')]){_0x53ae08[_0x6140('0x46')]=[{'all':!![]}];}return db[_0x6140('0x2e')]['findAll'](_0x53ae08);})[_0x6140('0x24')](function(_0x422f8e){_0x29b863[_0x6140('0x47')]=_0x422f8e;return _0x29b863;})['then'](respondWithFilteredResult(_0x4c0024,_0x53ae08))[_0x6140('0x48')](handleError(_0x4c0024,null));};exports['show']=function(_0x482b9e,_0x3c98f0){var _0x5654c3={'raw':![],'where':{'id':_0x482b9e[_0x6140('0x49')]['id']}},_0x56120e={};_0x56120e[_0x6140('0x33')]=_['keys'](db[_0x6140('0x2e')][_0x6140('0x2f')]);_0x56120e[_0x6140('0x35')]=_['keys'](_0x482b9e[_0x6140('0x35')]);_0x56120e[_0x6140('0x36')]=_[_0x6140('0x37')](_0x56120e[_0x6140('0x33')],_0x56120e[_0x6140('0x35')]);_0x5654c3['attributes']=_['intersection'](_0x56120e[_0x6140('0x33')],qs['fields'](_0x482b9e[_0x6140('0x35')][_0x6140('0x39')]));_0x5654c3[_0x6140('0x38')]=_0x5654c3[_0x6140('0x38')][_0x6140('0x3a')]?_0x5654c3[_0x6140('0x38')]:_0x56120e[_0x6140('0x33')];if(_0x482b9e[_0x6140('0x35')][_0x6140('0x45')]){_0x5654c3[_0x6140('0x46')]=[{'all':!![]}];}_0x5654c3=_[_0x6140('0x42')]({},_0x5654c3,_0x482b9e[_0x6140('0x44')]);return db[_0x6140('0x2e')][_0x6140('0x4a')](_0x5654c3)[_0x6140('0x24')](handleEntityNotFound(_0x3c98f0,null))['then'](respondWithResult(_0x3c98f0,null))['catch'](handleError(_0x3c98f0,null));};exports[_0x6140('0x4b')]=function(_0x2833a5,_0x1bea72){return db['Trigger']['create'](_0x2833a5['body'],{})[_0x6140('0x24')](function(_0x5abf12){var _0x5f3c7e=_0x2833a5[_0x6140('0x4c')][_0x6140('0x4d')]({'plain':!![]});if(!_0x5f3c7e)throw new Error(_0x6140('0x4e'));if(_0x5f3c7e[_0x6140('0x4f')]===_0x6140('0x4c')){var _0x2648f1=_0x5abf12[_0x6140('0x4d')]({'plain':!![]});var _0x41f54a=_0x6140('0x50');return db[_0x6140('0x51')][_0x6140('0x4a')]({'where':{'name':_0x41f54a,'userProfileId':_0x5f3c7e['userProfileId']},'raw':!![]})[_0x6140('0x24')](function(_0x3634fa){if(_0x3634fa&&_0x3634fa[_0x6140('0x52')]===0x0){return db[_0x6140('0x26')][_0x6140('0x4b')]({'name':_0x2648f1[_0x6140('0x2a')],'resourceId':_0x2648f1['id'],'type':_0x3634fa[_0x6140('0x2a')],'sectionId':_0x3634fa['id']},{})[_0x6140('0x24')](function(){return _0x5abf12;});}else{return _0x5abf12;}})[_0x6140('0x48')](function(_0x68c3cc){logger[_0x6140('0x28')](_0x6140('0x53'),_0x68c3cc);throw _0x68c3cc;});}return _0x5abf12;})[_0x6140('0x24')](respondWithResult(_0x1bea72,0xc9))[_0x6140('0x48')](handleError(_0x1bea72,null));};exports[_0x6140('0x54')]=function(_0x397379,_0x3c26d8){if(_0x397379[_0x6140('0x55')]['id']){delete _0x397379[_0x6140('0x55')]['id'];}return db[_0x6140('0x2e')][_0x6140('0x4a')]({'where':{'id':_0x397379[_0x6140('0x49')]['id']}})[_0x6140('0x24')](handleEntityNotFound(_0x3c26d8,null))['then'](saveUpdates(_0x397379[_0x6140('0x55')],null))[_0x6140('0x24')](respondWithResult(_0x3c26d8,null))[_0x6140('0x48')](handleError(_0x3c26d8,null));};exports[_0x6140('0x25')]=function(_0x2558e9,_0x1235b6){return db[_0x6140('0x2e')][_0x6140('0x4a')]({'where':{'id':_0x2558e9[_0x6140('0x49')]['id']}})[_0x6140('0x24')](handleEntityNotFound(_0x1235b6,null))[_0x6140('0x24')](removeEntity(_0x1235b6,null))[_0x6140('0x48')](handleError(_0x1235b6,null));};exports[_0x6140('0x56')]=function(_0x3e9c1c,_0x1a7e50,_0x415723){if(_0x3e9c1c[_0x6140('0x55')]['id']){delete _0x3e9c1c[_0x6140('0x55')]['id'];}return db[_0x6140('0x2e')][_0x6140('0x4a')]({'where':{'id':_0x3e9c1c[_0x6140('0x49')]['id']}})[_0x6140('0x24')](handleEntityNotFound(_0x1a7e50,null))[_0x6140('0x24')](function(_0xf4546f){if(_0xf4546f){_0x3e9c1c['body']['TriggerAllId']=_0xf4546f['id'];return db[_0x6140('0x57')][_0x6140('0x4b')](_0x3e9c1c[_0x6140('0x55')]);}})['then'](respondWithResult(_0x1a7e50,null))[_0x6140('0x48')](handleError(_0x1a7e50,null));};exports['addAnyCondition']=function(_0x43209a,_0x410626,_0x18c7bb){if(_0x43209a[_0x6140('0x55')]['id']){delete _0x43209a[_0x6140('0x55')]['id'];}return db[_0x6140('0x2e')]['find']({'where':{'id':_0x43209a[_0x6140('0x49')]['id']}})['then'](handleEntityNotFound(_0x410626,null))[_0x6140('0x24')](function(_0x8ff3c9){if(_0x8ff3c9){_0x43209a[_0x6140('0x55')][_0x6140('0x58')]=_0x8ff3c9['id'];return db[_0x6140('0x57')][_0x6140('0x4b')](_0x43209a['body']);}})[_0x6140('0x24')](respondWithResult(_0x410626,null))[_0x6140('0x48')](handleError(_0x410626,null));};exports[_0x6140('0x59')]=function(_0x2ecc55,_0x36f46c,_0x1ac5df){var _0xcac8e3={};var _0x357871={};var _0x2f4737;var _0x41f225;return db[_0x6140('0x2e')][_0x6140('0x5a')]({'where':{'id':_0x2ecc55[_0x6140('0x49')]['id']}})[_0x6140('0x24')](handleEntityNotFound(_0x36f46c,null))['then'](function(_0x1da3c1){if(_0x1da3c1){_0x2f4737=_0x1da3c1;_0x357871['model']=_[_0x6140('0x34')](db[_0x6140('0x57')]['rawAttributes']);_0x357871[_0x6140('0x35')]=_[_0x6140('0x34')](_0x2ecc55['query']);_0x357871['filters']=_[_0x6140('0x37')](_0x357871[_0x6140('0x33')],_0x357871[_0x6140('0x35')]);_0xcac8e3[_0x6140('0x38')]=_[_0x6140('0x37')](_0x357871[_0x6140('0x33')],qs['fields'](_0x2ecc55[_0x6140('0x35')][_0x6140('0x39')]));_0xcac8e3[_0x6140('0x38')]=_0xcac8e3['attributes'][_0x6140('0x3a')]?_0xcac8e3['attributes']:_0x357871['model'];_0xcac8e3[_0x6140('0x3d')]=qs[_0x6140('0x3e')](_0x2ecc55[_0x6140('0x35')][_0x6140('0x3e')]);_0xcac8e3[_0x6140('0x3f')]=qs[_0x6140('0x36')](_[_0x6140('0x40')](_0x2ecc55[_0x6140('0x35')],_0x357871[_0x6140('0x36')]));if(_0x2ecc55['query'][_0x6140('0x41')]){_0xcac8e3[_0x6140('0x3f')]=_[_0x6140('0x42')](_0xcac8e3[_0x6140('0x3f')],{'$or':_[_0x6140('0x2d')](_0xcac8e3[_0x6140('0x38')],function(_0x17abba){var _0x1d604d={};_0x1d604d[_0x17abba]={'$like':'%'+_0x2ecc55[_0x6140('0x35')][_0x6140('0x41')]+'%'};return _0x1d604d;})});}_0xcac8e3=_[_0x6140('0x42')]({},_0xcac8e3,_0x2ecc55[_0x6140('0x44')]);return _0x2f4737['getAllConditions'](_0xcac8e3);}})[_0x6140('0x24')](function(_0x30141f){if(_0x30141f){_0x41f225=_0x30141f[_0x6140('0x3a')];if(!_0x2ecc55[_0x6140('0x35')]['hasOwnProperty']('nolimit')){_0xcac8e3[_0x6140('0x1d')]=qs[_0x6140('0x1d')](_0x2ecc55[_0x6140('0x35')][_0x6140('0x1d')]);_0xcac8e3[_0x6140('0x1c')]=qs[_0x6140('0x1c')](_0x2ecc55[_0x6140('0x35')][_0x6140('0x1c')]);}return _0x2f4737[_0x6140('0x59')](_0xcac8e3);}})[_0x6140('0x24')](function(_0x369e2d){if(_0x369e2d){return _0x369e2d?{'count':_0x41f225,'rows':_0x369e2d}:null;}})[_0x6140('0x24')](respondWithResult(_0x36f46c,null))[_0x6140('0x48')](handleError(_0x36f46c,null));};exports[_0x6140('0x5b')]=function(_0x3a4231,_0x38adf8,_0x3e2ce){var _0x2b4adf={};var _0x5349f9={};var _0x50fcbc;var _0x2b1ad8;return db[_0x6140('0x2e')][_0x6140('0x5a')]({'where':{'id':_0x3a4231[_0x6140('0x49')]['id']}})['then'](handleEntityNotFound(_0x38adf8,null))[_0x6140('0x24')](function(_0x4d369b){if(_0x4d369b){_0x50fcbc=_0x4d369b;_0x5349f9[_0x6140('0x33')]=_[_0x6140('0x34')](db[_0x6140('0x57')][_0x6140('0x2f')]);_0x5349f9[_0x6140('0x35')]=_['keys'](_0x3a4231['query']);_0x5349f9['filters']=_[_0x6140('0x37')](_0x5349f9[_0x6140('0x33')],_0x5349f9['query']);_0x2b4adf[_0x6140('0x38')]=_[_0x6140('0x37')](_0x5349f9[_0x6140('0x33')],qs['fields'](_0x3a4231[_0x6140('0x35')][_0x6140('0x39')]));_0x2b4adf['attributes']=_0x2b4adf[_0x6140('0x38')][_0x6140('0x3a')]?_0x2b4adf[_0x6140('0x38')]:_0x5349f9[_0x6140('0x33')];_0x2b4adf[_0x6140('0x3d')]=qs['sort'](_0x3a4231[_0x6140('0x35')][_0x6140('0x3e')]);_0x2b4adf['where']=qs[_0x6140('0x36')](_[_0x6140('0x40')](_0x3a4231[_0x6140('0x35')],_0x5349f9[_0x6140('0x36')]));if(_0x3a4231['query']['filter']){_0x2b4adf[_0x6140('0x3f')]=_[_0x6140('0x42')](_0x2b4adf[_0x6140('0x3f')],{'$or':_[_0x6140('0x2d')](_0x2b4adf['attributes'],function(_0x502d75){var _0x59ffdf={};_0x59ffdf[_0x502d75]={'$like':'%'+_0x3a4231[_0x6140('0x35')][_0x6140('0x41')]+'%'};return _0x59ffdf;})});}_0x2b4adf=_[_0x6140('0x42')]({},_0x2b4adf,_0x3a4231[_0x6140('0x44')]);return _0x50fcbc[_0x6140('0x5b')](_0x2b4adf);}})['then'](function(_0x4b5838){if(_0x4b5838){_0x2b1ad8=_0x4b5838['length'];if(!_0x3a4231['query'][_0x6140('0x3b')](_0x6140('0x3c'))){_0x2b4adf[_0x6140('0x1d')]=qs[_0x6140('0x1d')](_0x3a4231[_0x6140('0x35')][_0x6140('0x1d')]);_0x2b4adf[_0x6140('0x1c')]=qs['offset'](_0x3a4231['query'][_0x6140('0x1c')]);}return _0x50fcbc[_0x6140('0x5b')](_0x2b4adf);}})[_0x6140('0x24')](function(_0x2990e8){if(_0x2990e8){return _0x2990e8?{'count':_0x2b1ad8,'rows':_0x2990e8}:null;}})['then'](respondWithResult(_0x38adf8,null))[_0x6140('0x48')](handleError(_0x38adf8,null));};exports[_0x6140('0x5c')]=function(_0x1e8726,_0x17fb98,_0x4bfcf6){if(_0x1e8726['body']['id']){delete _0x1e8726[_0x6140('0x55')]['id'];}return db[_0x6140('0x2e')][_0x6140('0x4a')]({'where':{'id':_0x1e8726['params']['id']}})['then'](handleEntityNotFound(_0x17fb98,null))[_0x6140('0x24')](function(_0x13eb82){if(_0x13eb82){_0x1e8726[_0x6140('0x55')][_0x6140('0x5d')]=_0x13eb82['id'];return db[_0x6140('0x5e')]['create'](_0x1e8726[_0x6140('0x55')]);}})[_0x6140('0x24')](respondWithResult(_0x17fb98,null))['catch'](handleError(_0x17fb98,null));};exports['getActions']=function(_0x53fb42,_0x141278,_0x5ecf7e){var _0x16674e={};var _0x294d45={};var _0x43528f;var _0x29b703;return db[_0x6140('0x2e')][_0x6140('0x5a')]({'where':{'id':_0x53fb42[_0x6140('0x49')]['id']}})[_0x6140('0x24')](handleEntityNotFound(_0x141278,null))[_0x6140('0x24')](function(_0x58c80a){if(_0x58c80a){_0x43528f=_0x58c80a;_0x294d45['model']=_[_0x6140('0x34')](db[_0x6140('0x5e')][_0x6140('0x2f')]);_0x294d45[_0x6140('0x35')]=_[_0x6140('0x34')](_0x53fb42['query']);_0x294d45['filters']=_[_0x6140('0x37')](_0x294d45['model'],_0x294d45[_0x6140('0x35')]);_0x16674e[_0x6140('0x38')]=_['intersection'](_0x294d45['model'],qs[_0x6140('0x39')](_0x53fb42[_0x6140('0x35')]['fields']));_0x16674e[_0x6140('0x38')]=_0x16674e['attributes'][_0x6140('0x3a')]?_0x16674e[_0x6140('0x38')]:_0x294d45[_0x6140('0x33')];_0x16674e[_0x6140('0x3d')]=qs['sort'](_0x53fb42[_0x6140('0x35')][_0x6140('0x3e')]);_0x16674e[_0x6140('0x3f')]=qs[_0x6140('0x36')](_['pick'](_0x53fb42['query'],_0x294d45['filters']));if(_0x53fb42[_0x6140('0x35')][_0x6140('0x41')]){_0x16674e[_0x6140('0x3f')]=_['merge'](_0x16674e[_0x6140('0x3f')],{'$or':_[_0x6140('0x2d')](_0x16674e[_0x6140('0x38')],function(_0x8d2519){var _0x1f22f1={};_0x1f22f1[_0x8d2519]={'$like':'%'+_0x53fb42[_0x6140('0x35')][_0x6140('0x41')]+'%'};return _0x1f22f1;})});}_0x16674e=_['merge']({},_0x16674e,_0x53fb42[_0x6140('0x44')]);return _0x43528f[_0x6140('0x5f')](_0x16674e);}})[_0x6140('0x24')](function(_0x3e4a2e){if(_0x3e4a2e){_0x29b703=_0x3e4a2e[_0x6140('0x3a')];if(!_0x53fb42[_0x6140('0x35')][_0x6140('0x3b')](_0x6140('0x3c'))){_0x16674e[_0x6140('0x1d')]=qs[_0x6140('0x1d')](_0x53fb42[_0x6140('0x35')]['limit']);_0x16674e[_0x6140('0x1c')]=qs[_0x6140('0x1c')](_0x53fb42[_0x6140('0x35')]['offset']);}return _0x43528f[_0x6140('0x5f')](_0x16674e);}})[_0x6140('0x24')](function(_0x51425f){if(_0x51425f){return _0x51425f?{'count':_0x29b703,'rows':_0x51425f}:null;}})[_0x6140('0x24')](respondWithResult(_0x141278,null))[_0x6140('0x48')](handleError(_0x141278,null));}; \ No newline at end of file +var _0xc364=['save','then','get','Triggers','UserProfileResource','destroy','sendStatus','stack','name','send','index','map','Trigger','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','catch','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','pick','getAnyConditions','addAction','TriggerId','getActions','Action','eml-format','rimraf','zip-dir','request-promise','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','status','offset','undefined','limit','count','set','json','apply','reject'];(function(_0x2f0c5d,_0xc8c90e){var _0x49ed7c=function(_0x1378c6){while(--_0x1378c6){_0x2f0c5d['push'](_0x2f0c5d['shift']());}};_0x49ed7c(++_0xc8c90e);}(_0xc364,0x152));var _0x4c36=function(_0x2b0113,_0x2fcc52){_0x2b0113=_0x2b0113-0x0;var _0x16c5e4=_0xc364[_0x2b0113];return _0x16c5e4;};'use strict';var emlformat=require(_0x4c36('0x0'));var rimraf=require(_0x4c36('0x1'));var zipdir=require(_0x4c36('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4c36('0x3'));var moment=require('moment');var BPromise=require(_0x4c36('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4c36('0x5'));var sox=require(_0x4c36('0x6'));var csv=require(_0x4c36('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4c36('0x8'));var _=require(_0x4c36('0x9'));var squel=require(_0x4c36('0xa'));var crypto=require(_0x4c36('0xb'));var jsforce=require(_0x4c36('0xc'));var deskjs=require(_0x4c36('0xd'));var toCsv=require(_0x4c36('0x7'));var querystring=require(_0x4c36('0xe'));var Papa=require('papaparse');var Redis=require(_0x4c36('0xf'));var authService=require(_0x4c36('0x10'));var qs=require(_0x4c36('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4c36('0x12'))('api');var utils=require(_0x4c36('0x13'));var config=require(_0x4c36('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xbdf970,_0x482876){_0x482876=_0x482876||0xcc;return function(_0x383783){if(_0x383783){return _0xbdf970['sendStatus'](_0x482876);}return _0xbdf970['status'](_0x482876)['end']();};}function respondWithResult(_0x2f6b0c,_0x3e236a){_0x3e236a=_0x3e236a||0xc8;return function(_0x700ca9){if(_0x700ca9){return _0x2f6b0c[_0x4c36('0x15')](_0x3e236a)['json'](_0x700ca9);}};}function respondWithFilteredResult(_0x4b2e59,_0x44ce0f){return function(_0xa11604){if(_0xa11604){var _0x758d17=typeof _0x44ce0f[_0x4c36('0x16')]===_0x4c36('0x17')&&typeof _0x44ce0f[_0x4c36('0x18')]===_0x4c36('0x17');var _0x284a46=_0xa11604[_0x4c36('0x19')];var _0x473215=_0x758d17?0x0:_0x44ce0f[_0x4c36('0x16')];var _0x5b982d=_0x758d17?_0xa11604[_0x4c36('0x19')]:_0x44ce0f['offset']+_0x44ce0f[_0x4c36('0x18')];var _0xe4724d;if(_0x5b982d>=_0x284a46){_0x5b982d=_0x284a46;_0xe4724d=0xc8;}else{_0xe4724d=0xce;}_0x4b2e59[_0x4c36('0x15')](_0xe4724d);return _0x4b2e59[_0x4c36('0x1a')]('Content-Range',_0x473215+'-'+_0x5b982d+'/'+_0x284a46)[_0x4c36('0x1b')](_0xa11604);}return null;};}function patchUpdates(_0x1694b1){return function(_0x216108){try{jsonpatch[_0x4c36('0x1c')](_0x216108,_0x1694b1,!![]);}catch(_0x457bb8){return BPromise[_0x4c36('0x1d')](_0x457bb8);}return _0x216108[_0x4c36('0x1e')]();};}function saveUpdates(_0x39f6b4,_0x451f00){return function(_0x4f9076){if(_0x4f9076){return _0x4f9076['update'](_0x39f6b4)[_0x4c36('0x1f')](function(_0x32c732){return _0x32c732;});}return null;};}function removeEntity(_0x4f87af,_0x354bf1){return function(_0x592b5b){if(_0x592b5b){return _0x592b5b['destroy']()[_0x4c36('0x1f')](function(){var _0x54de55=_0x592b5b[_0x4c36('0x20')]({'plain':!![]});var _0x1f72b1=_0x4c36('0x21');return db[_0x4c36('0x22')][_0x4c36('0x23')]({'where':{'type':_0x1f72b1,'resourceId':_0x54de55['id']}})[_0x4c36('0x1f')](function(){return _0x592b5b;});})[_0x4c36('0x1f')](function(){_0x4f87af[_0x4c36('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe187a5,_0x1d9a80){return function(_0x2a905e){if(!_0x2a905e){_0xe187a5[_0x4c36('0x24')](0x194);}return _0x2a905e;};}function handleError(_0x92ea90,_0x1ca1a0){_0x1ca1a0=_0x1ca1a0||0x1f4;return function(_0x37418c){logger['error'](_0x37418c[_0x4c36('0x25')]);if(_0x37418c[_0x4c36('0x26')]){delete _0x37418c[_0x4c36('0x26')];}_0x92ea90['status'](_0x1ca1a0)[_0x4c36('0x27')](_0x37418c);};}exports[_0x4c36('0x28')]=function(_0x52fbba,_0x355618){var _0x4e0142={},_0x19db7e={},_0x3e65f9={'count':0x0,'rows':[]};var _0x5bf328=_[_0x4c36('0x29')](db[_0x4c36('0x2a')][_0x4c36('0x2b')],function(_0x5e5ca4){return{'name':_0x5e5ca4[_0x4c36('0x2c')],'type':_0x5e5ca4['type'][_0x4c36('0x2d')]};});_0x19db7e['model']=_[_0x4c36('0x29')](_0x5bf328,'name');_0x19db7e[_0x4c36('0x2e')]=_[_0x4c36('0x2f')](_0x52fbba[_0x4c36('0x2e')]);_0x19db7e[_0x4c36('0x30')]=_[_0x4c36('0x31')](_0x19db7e['model'],_0x19db7e[_0x4c36('0x2e')]);_0x4e0142[_0x4c36('0x32')]=_[_0x4c36('0x31')](_0x19db7e[_0x4c36('0x33')],qs[_0x4c36('0x34')](_0x52fbba[_0x4c36('0x2e')][_0x4c36('0x34')]));_0x4e0142['attributes']=_0x4e0142['attributes'][_0x4c36('0x35')]?_0x4e0142[_0x4c36('0x32')]:_0x19db7e[_0x4c36('0x33')];if(!_0x52fbba['query'][_0x4c36('0x36')](_0x4c36('0x37'))){_0x4e0142['limit']=qs[_0x4c36('0x18')](_0x52fbba[_0x4c36('0x2e')][_0x4c36('0x18')]);_0x4e0142[_0x4c36('0x16')]=qs['offset'](_0x52fbba[_0x4c36('0x2e')]['offset']);}_0x4e0142[_0x4c36('0x38')]=qs[_0x4c36('0x39')](_0x52fbba[_0x4c36('0x2e')]['sort']);_0x4e0142['where']=qs[_0x4c36('0x30')](_['pick'](_0x52fbba[_0x4c36('0x2e')],_0x19db7e[_0x4c36('0x30')]),_0x5bf328);if(_0x52fbba['query'][_0x4c36('0x3a')]){_0x4e0142[_0x4c36('0x3b')]=_[_0x4c36('0x3c')](_0x4e0142[_0x4c36('0x3b')],{'$or':_['map'](_0x5bf328,function(_0x7aaacf){if(_0x7aaacf['type']!==_0x4c36('0x3d')){var _0x26d6ca={};_0x26d6ca[_0x7aaacf[_0x4c36('0x26')]]={'$like':'%'+_0x52fbba[_0x4c36('0x2e')]['filter']+'%'};return _0x26d6ca;}})});}_0x4e0142=_[_0x4c36('0x3c')]({},_0x4e0142,_0x52fbba[_0x4c36('0x3e')]);var _0x31a9a4={'where':_0x4e0142['where']};return db[_0x4c36('0x2a')]['count'](_0x31a9a4)['then'](function(_0x145531){_0x3e65f9[_0x4c36('0x19')]=_0x145531;if(_0x52fbba[_0x4c36('0x2e')][_0x4c36('0x3f')]){_0x4e0142[_0x4c36('0x40')]=[{'all':!![]}];}return db['Trigger']['findAll'](_0x4e0142);})[_0x4c36('0x1f')](function(_0x250c21){_0x3e65f9['rows']=_0x250c21;return _0x3e65f9;})['then'](respondWithFilteredResult(_0x355618,_0x4e0142))[_0x4c36('0x41')](handleError(_0x355618,null));};exports['show']=function(_0x4ea97e,_0x274ff7){var _0x3f6838={'raw':![],'where':{'id':_0x4ea97e[_0x4c36('0x42')]['id']}},_0x19324d={};_0x19324d['model']=_[_0x4c36('0x2f')](db[_0x4c36('0x2a')][_0x4c36('0x2b')]);_0x19324d[_0x4c36('0x2e')]=_[_0x4c36('0x2f')](_0x4ea97e[_0x4c36('0x2e')]);_0x19324d[_0x4c36('0x30')]=_[_0x4c36('0x31')](_0x19324d[_0x4c36('0x33')],_0x19324d['query']);_0x3f6838['attributes']=_[_0x4c36('0x31')](_0x19324d[_0x4c36('0x33')],qs[_0x4c36('0x34')](_0x4ea97e[_0x4c36('0x2e')][_0x4c36('0x34')]));_0x3f6838[_0x4c36('0x32')]=_0x3f6838[_0x4c36('0x32')]['length']?_0x3f6838['attributes']:_0x19324d[_0x4c36('0x33')];if(_0x4ea97e['query'][_0x4c36('0x3f')]){_0x3f6838[_0x4c36('0x40')]=[{'all':!![]}];}_0x3f6838=_[_0x4c36('0x3c')]({},_0x3f6838,_0x4ea97e[_0x4c36('0x3e')]);return db[_0x4c36('0x2a')][_0x4c36('0x43')](_0x3f6838)[_0x4c36('0x1f')](handleEntityNotFound(_0x274ff7,null))[_0x4c36('0x1f')](respondWithResult(_0x274ff7,null))['catch'](handleError(_0x274ff7,null));};exports['create']=function(_0x37b89a,_0x2ad864){return db[_0x4c36('0x2a')][_0x4c36('0x44')](_0x37b89a[_0x4c36('0x45')],{})[_0x4c36('0x1f')](function(_0x1426c1){var _0x5286bf=_0x37b89a['user'][_0x4c36('0x20')]({'plain':!![]});if(!_0x5286bf)throw new Error(_0x4c36('0x46'));if(_0x5286bf[_0x4c36('0x47')]===_0x4c36('0x48')){var _0x1eb8d7=_0x1426c1[_0x4c36('0x20')]({'plain':!![]});var _0x2ab034=_0x4c36('0x21');return db[_0x4c36('0x49')][_0x4c36('0x43')]({'where':{'name':_0x2ab034,'userProfileId':_0x5286bf[_0x4c36('0x4a')]},'raw':!![]})[_0x4c36('0x1f')](function(_0x3fa17b){if(_0x3fa17b&&_0x3fa17b[_0x4c36('0x4b')]===0x0){return db[_0x4c36('0x22')]['create']({'name':_0x1eb8d7[_0x4c36('0x26')],'resourceId':_0x1eb8d7['id'],'type':_0x3fa17b[_0x4c36('0x26')],'sectionId':_0x3fa17b['id']},{})[_0x4c36('0x1f')](function(){return _0x1426c1;});}else{return _0x1426c1;}})[_0x4c36('0x41')](function(_0x2e20e4){logger[_0x4c36('0x4c')](_0x4c36('0x4d'),_0x2e20e4);throw _0x2e20e4;});}return _0x1426c1;})['then'](respondWithResult(_0x2ad864,0xc9))[_0x4c36('0x41')](handleError(_0x2ad864,null));};exports[_0x4c36('0x4e')]=function(_0x546a2b,_0x47876e){if(_0x546a2b[_0x4c36('0x45')]['id']){delete _0x546a2b[_0x4c36('0x45')]['id'];}return db['Trigger'][_0x4c36('0x43')]({'where':{'id':_0x546a2b[_0x4c36('0x42')]['id']}})[_0x4c36('0x1f')](handleEntityNotFound(_0x47876e,null))[_0x4c36('0x1f')](saveUpdates(_0x546a2b['body'],null))[_0x4c36('0x1f')](respondWithResult(_0x47876e,null))[_0x4c36('0x41')](handleError(_0x47876e,null));};exports[_0x4c36('0x23')]=function(_0xed643,_0x53cd4d){return db[_0x4c36('0x2a')]['find']({'where':{'id':_0xed643[_0x4c36('0x42')]['id']}})[_0x4c36('0x1f')](handleEntityNotFound(_0x53cd4d,null))[_0x4c36('0x1f')](removeEntity(_0x53cd4d,null))[_0x4c36('0x41')](handleError(_0x53cd4d,null));};exports[_0x4c36('0x4f')]=function(_0x10a8bf,_0x44acab,_0x104340){if(_0x10a8bf[_0x4c36('0x45')]['id']){delete _0x10a8bf['body']['id'];}return db[_0x4c36('0x2a')][_0x4c36('0x43')]({'where':{'id':_0x10a8bf['params']['id']}})[_0x4c36('0x1f')](handleEntityNotFound(_0x44acab,null))[_0x4c36('0x1f')](function(_0x3b045a){if(_0x3b045a){_0x10a8bf['body'][_0x4c36('0x50')]=_0x3b045a['id'];return db[_0x4c36('0x51')][_0x4c36('0x44')](_0x10a8bf[_0x4c36('0x45')]);}})[_0x4c36('0x1f')](respondWithResult(_0x44acab,null))[_0x4c36('0x41')](handleError(_0x44acab,null));};exports[_0x4c36('0x52')]=function(_0x33fcba,_0x100068,_0x82fb36){if(_0x33fcba['body']['id']){delete _0x33fcba[_0x4c36('0x45')]['id'];}return db['Trigger'][_0x4c36('0x43')]({'where':{'id':_0x33fcba[_0x4c36('0x42')]['id']}})[_0x4c36('0x1f')](handleEntityNotFound(_0x100068,null))[_0x4c36('0x1f')](function(_0x2a2b4d){if(_0x2a2b4d){_0x33fcba[_0x4c36('0x45')][_0x4c36('0x53')]=_0x2a2b4d['id'];return db['Condition']['create'](_0x33fcba[_0x4c36('0x45')]);}})['then'](respondWithResult(_0x100068,null))[_0x4c36('0x41')](handleError(_0x100068,null));};exports[_0x4c36('0x54')]=function(_0x129039,_0x81c2f8,_0x4ba7b2){var _0x319d62={};var _0x21b23e={};var _0x4f6355;var _0x5e4a6a;return db[_0x4c36('0x2a')][_0x4c36('0x55')]({'where':{'id':_0x129039['params']['id']}})['then'](handleEntityNotFound(_0x81c2f8,null))['then'](function(_0x3f4175){if(_0x3f4175){_0x4f6355=_0x3f4175;_0x21b23e[_0x4c36('0x33')]=_[_0x4c36('0x2f')](db[_0x4c36('0x51')]['rawAttributes']);_0x21b23e['query']=_[_0x4c36('0x2f')](_0x129039[_0x4c36('0x2e')]);_0x21b23e[_0x4c36('0x30')]=_[_0x4c36('0x31')](_0x21b23e['model'],_0x21b23e['query']);_0x319d62[_0x4c36('0x32')]=_[_0x4c36('0x31')](_0x21b23e['model'],qs[_0x4c36('0x34')](_0x129039['query'][_0x4c36('0x34')]));_0x319d62[_0x4c36('0x32')]=_0x319d62[_0x4c36('0x32')][_0x4c36('0x35')]?_0x319d62[_0x4c36('0x32')]:_0x21b23e[_0x4c36('0x33')];_0x319d62['order']=qs[_0x4c36('0x39')](_0x129039['query'][_0x4c36('0x39')]);_0x319d62['where']=qs['filters'](_[_0x4c36('0x56')](_0x129039[_0x4c36('0x2e')],_0x21b23e['filters']));if(_0x129039['query'][_0x4c36('0x3a')]){_0x319d62[_0x4c36('0x3b')]=_[_0x4c36('0x3c')](_0x319d62[_0x4c36('0x3b')],{'$or':_[_0x4c36('0x29')](_0x319d62['attributes'],function(_0x394e8f){var _0x3a3ea2={};_0x3a3ea2[_0x394e8f]={'$like':'%'+_0x129039[_0x4c36('0x2e')][_0x4c36('0x3a')]+'%'};return _0x3a3ea2;})});}_0x319d62=_[_0x4c36('0x3c')]({},_0x319d62,_0x129039[_0x4c36('0x3e')]);return _0x4f6355[_0x4c36('0x54')](_0x319d62);}})[_0x4c36('0x1f')](function(_0x2dbc3b){if(_0x2dbc3b){_0x5e4a6a=_0x2dbc3b[_0x4c36('0x35')];if(!_0x129039[_0x4c36('0x2e')][_0x4c36('0x36')](_0x4c36('0x37'))){_0x319d62['limit']=qs[_0x4c36('0x18')](_0x129039[_0x4c36('0x2e')][_0x4c36('0x18')]);_0x319d62[_0x4c36('0x16')]=qs[_0x4c36('0x16')](_0x129039[_0x4c36('0x2e')][_0x4c36('0x16')]);}return _0x4f6355[_0x4c36('0x54')](_0x319d62);}})[_0x4c36('0x1f')](function(_0x2edbe){if(_0x2edbe){return _0x2edbe?{'count':_0x5e4a6a,'rows':_0x2edbe}:null;}})['then'](respondWithResult(_0x81c2f8,null))[_0x4c36('0x41')](handleError(_0x81c2f8,null));};exports[_0x4c36('0x57')]=function(_0x468718,_0x3282a3,_0x17b593){var _0x5cd16b={};var _0x44a00e={};var _0x19444c;var _0x1fa465;return db[_0x4c36('0x2a')][_0x4c36('0x55')]({'where':{'id':_0x468718[_0x4c36('0x42')]['id']}})[_0x4c36('0x1f')](handleEntityNotFound(_0x3282a3,null))[_0x4c36('0x1f')](function(_0x41e417){if(_0x41e417){_0x19444c=_0x41e417;_0x44a00e[_0x4c36('0x33')]=_[_0x4c36('0x2f')](db[_0x4c36('0x51')][_0x4c36('0x2b')]);_0x44a00e[_0x4c36('0x2e')]=_[_0x4c36('0x2f')](_0x468718['query']);_0x44a00e[_0x4c36('0x30')]=_[_0x4c36('0x31')](_0x44a00e['model'],_0x44a00e[_0x4c36('0x2e')]);_0x5cd16b[_0x4c36('0x32')]=_['intersection'](_0x44a00e['model'],qs[_0x4c36('0x34')](_0x468718[_0x4c36('0x2e')][_0x4c36('0x34')]));_0x5cd16b['attributes']=_0x5cd16b['attributes'][_0x4c36('0x35')]?_0x5cd16b[_0x4c36('0x32')]:_0x44a00e['model'];_0x5cd16b[_0x4c36('0x38')]=qs[_0x4c36('0x39')](_0x468718[_0x4c36('0x2e')][_0x4c36('0x39')]);_0x5cd16b[_0x4c36('0x3b')]=qs['filters'](_[_0x4c36('0x56')](_0x468718[_0x4c36('0x2e')],_0x44a00e[_0x4c36('0x30')]));if(_0x468718[_0x4c36('0x2e')]['filter']){_0x5cd16b[_0x4c36('0x3b')]=_[_0x4c36('0x3c')](_0x5cd16b['where'],{'$or':_[_0x4c36('0x29')](_0x5cd16b['attributes'],function(_0x586ba4){var _0x19e354={};_0x19e354[_0x586ba4]={'$like':'%'+_0x468718[_0x4c36('0x2e')][_0x4c36('0x3a')]+'%'};return _0x19e354;})});}_0x5cd16b=_[_0x4c36('0x3c')]({},_0x5cd16b,_0x468718[_0x4c36('0x3e')]);return _0x19444c[_0x4c36('0x57')](_0x5cd16b);}})[_0x4c36('0x1f')](function(_0x59c9c8){if(_0x59c9c8){_0x1fa465=_0x59c9c8[_0x4c36('0x35')];if(!_0x468718['query']['hasOwnProperty'](_0x4c36('0x37'))){_0x5cd16b[_0x4c36('0x18')]=qs['limit'](_0x468718['query'][_0x4c36('0x18')]);_0x5cd16b[_0x4c36('0x16')]=qs['offset'](_0x468718['query'][_0x4c36('0x16')]);}return _0x19444c['getAnyConditions'](_0x5cd16b);}})[_0x4c36('0x1f')](function(_0x488b65){if(_0x488b65){return _0x488b65?{'count':_0x1fa465,'rows':_0x488b65}:null;}})[_0x4c36('0x1f')](respondWithResult(_0x3282a3,null))[_0x4c36('0x41')](handleError(_0x3282a3,null));};exports[_0x4c36('0x58')]=function(_0x3d38d7,_0x3abb9c,_0x1dac67){if(_0x3d38d7['body']['id']){delete _0x3d38d7[_0x4c36('0x45')]['id'];}return db['Trigger'][_0x4c36('0x43')]({'where':{'id':_0x3d38d7['params']['id']}})[_0x4c36('0x1f')](handleEntityNotFound(_0x3abb9c,null))[_0x4c36('0x1f')](function(_0x1effff){if(_0x1effff){_0x3d38d7[_0x4c36('0x45')][_0x4c36('0x59')]=_0x1effff['id'];return db['Action'][_0x4c36('0x44')](_0x3d38d7[_0x4c36('0x45')]);}})[_0x4c36('0x1f')](respondWithResult(_0x3abb9c,null))[_0x4c36('0x41')](handleError(_0x3abb9c,null));};exports[_0x4c36('0x5a')]=function(_0x2fd201,_0x55f428,_0x379955){var _0x22cbc8={};var _0x5f00de={};var _0x112649;var _0x2c8132;return db[_0x4c36('0x2a')][_0x4c36('0x55')]({'where':{'id':_0x2fd201[_0x4c36('0x42')]['id']}})[_0x4c36('0x1f')](handleEntityNotFound(_0x55f428,null))[_0x4c36('0x1f')](function(_0x3cdc53){if(_0x3cdc53){_0x112649=_0x3cdc53;_0x5f00de[_0x4c36('0x33')]=_[_0x4c36('0x2f')](db[_0x4c36('0x5b')]['rawAttributes']);_0x5f00de[_0x4c36('0x2e')]=_[_0x4c36('0x2f')](_0x2fd201['query']);_0x5f00de[_0x4c36('0x30')]=_[_0x4c36('0x31')](_0x5f00de[_0x4c36('0x33')],_0x5f00de[_0x4c36('0x2e')]);_0x22cbc8[_0x4c36('0x32')]=_['intersection'](_0x5f00de[_0x4c36('0x33')],qs[_0x4c36('0x34')](_0x2fd201[_0x4c36('0x2e')]['fields']));_0x22cbc8['attributes']=_0x22cbc8[_0x4c36('0x32')][_0x4c36('0x35')]?_0x22cbc8['attributes']:_0x5f00de[_0x4c36('0x33')];_0x22cbc8[_0x4c36('0x38')]=qs[_0x4c36('0x39')](_0x2fd201[_0x4c36('0x2e')][_0x4c36('0x39')]);_0x22cbc8[_0x4c36('0x3b')]=qs[_0x4c36('0x30')](_['pick'](_0x2fd201['query'],_0x5f00de['filters']));if(_0x2fd201[_0x4c36('0x2e')][_0x4c36('0x3a')]){_0x22cbc8[_0x4c36('0x3b')]=_[_0x4c36('0x3c')](_0x22cbc8[_0x4c36('0x3b')],{'$or':_['map'](_0x22cbc8['attributes'],function(_0x601c73){var _0x2f6ef3={};_0x2f6ef3[_0x601c73]={'$like':'%'+_0x2fd201['query']['filter']+'%'};return _0x2f6ef3;})});}_0x22cbc8=_[_0x4c36('0x3c')]({},_0x22cbc8,_0x2fd201[_0x4c36('0x3e')]);return _0x112649['getActions'](_0x22cbc8);}})[_0x4c36('0x1f')](function(_0x3cc0cc){if(_0x3cc0cc){_0x2c8132=_0x3cc0cc[_0x4c36('0x35')];if(!_0x2fd201['query'][_0x4c36('0x36')](_0x4c36('0x37'))){_0x22cbc8['limit']=qs['limit'](_0x2fd201[_0x4c36('0x2e')][_0x4c36('0x18')]);_0x22cbc8[_0x4c36('0x16')]=qs[_0x4c36('0x16')](_0x2fd201[_0x4c36('0x2e')]['offset']);}return _0x112649[_0x4c36('0x5a')](_0x22cbc8);}})['then'](function(_0x3bf68c){if(_0x3bf68c){return _0x3bf68c?{'count':_0x2c8132,'rows':_0x3bf68c}:null;}})['then'](respondWithResult(_0x55f428,null))[_0x4c36('0x41')](handleError(_0x55f428,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 20b4789..1e62e80 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 _0x0a34=['api','moment','bluebird','path','rimraf','../../config/environment','exports','define','Trigger','tools_triggers','lodash','util'];(function(_0x4bab92,_0x497266){var _0x5ebe8b=function(_0x229d91){while(--_0x229d91){_0x4bab92['push'](_0x4bab92['shift']());}};_0x5ebe8b(++_0x497266);}(_0x0a34,0x12a));var _0x40a3=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x0a34[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require(_0x40a3('0x0'));var util=require(_0x40a3('0x1'));var logger=require('../../config/logger')(_0x40a3('0x2'));var moment=require(_0x40a3('0x3'));var BPromise=require(_0x40a3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x40a3('0x5'));var rimraf=require(_0x40a3('0x6'));var config=require(_0x40a3('0x7'));var attributes=require('./trigger.attributes');module[_0x40a3('0x8')]=function(_0x1cdc8a,_0xbda4a8){return _0x1cdc8a[_0x40a3('0x9')](_0x40a3('0xa'),attributes,{'tableName':_0x40a3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a72=['moment','request-promise','rimraf','./trigger.attributes','tools_triggers','util','../../config/logger'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0x7a72,0x1be));var _0x27a7=function(_0x56ee8f,_0xb8d831){_0x56ee8f=_0x56ee8f-0x0;var _0x4a7d1a=_0x7a72[_0x56ee8f];return _0x4a7d1a;};'use strict';var _=require('lodash');var util=require(_0x27a7('0x0'));var logger=require(_0x27a7('0x1'))('api');var moment=require(_0x27a7('0x2'));var BPromise=require('bluebird');var rp=require(_0x27a7('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x27a7('0x4'));var config=require('../../config/environment');var attributes=require(_0x27a7('0x5'));module['exports']=function(_0x320fad,_0x372bb8){return _0x320fad['define']('Trigger',attributes,{'tableName':_0x27a7('0x6'),'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 b7579b3..03a8d18 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 _0xcce2=['map','include','model','then','info','GetTrigger','ShowTrigger','where','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','request\x20sent','debug','stringify','error','message','Trigger,\x20%s,\x20%s','result','catch','Trigger','findAll','options','raw','attributes','limit'];(function(_0x6c343b,_0x34abbd){var _0x367cab=function(_0x36c820){while(--_0x36c820){_0x6c343b['push'](_0x6c343b['shift']());}};_0x367cab(++_0x34abbd);}(_0xcce2,0x173));var _0x2cce=function(_0x1281fa,_0x4c2ef8){_0x1281fa=_0x1281fa-0x0;var _0x2f4a53=_0xcce2[_0x1281fa];return _0x2f4a53;};'use strict';var _=require(_0x2cce('0x0'));var util=require(_0x2cce('0x1'));var moment=require('moment');var BPromise=require(_0x2cce('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2cce('0x3'));var db=require(_0x2cce('0x4'))['db'];var utils=require(_0x2cce('0x5'));var logger=require(_0x2cce('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2cce('0x7'));var client=jayson[_0x2cce('0x8')][_0x2cce('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x7eee76,_0x11621e,_0x9e66d5){return new BPromise(function(_0x13c46a,_0x44e9a8){return client[_0x2cce('0xa')](_0x7eee76,_0x9e66d5)['then'](function(_0x205f6b){logger['info']('Trigger,\x20%s,\x20%s',_0x11621e,_0x2cce('0xb'));logger[_0x2cce('0xc')]('Trigger,\x20%s,\x20%s,\x20%s',_0x11621e,'request\x20sent',JSON[_0x2cce('0xd')](_0x205f6b));if(_0x205f6b[_0x2cce('0xe')]){if(_0x205f6b[_0x2cce('0xe')]['code']===0x1f4){logger['error']('Trigger,\x20%s,\x20%s',_0x11621e,_0x205f6b['error'][_0x2cce('0xf')]);return _0x44e9a8(_0x205f6b['error']['message']);}logger['error'](_0x2cce('0x10'),_0x11621e,_0x205f6b[_0x2cce('0xe')][_0x2cce('0xf')]);return _0x13c46a(_0x205f6b[_0x2cce('0xe')]['message']);}else{logger['info'](_0x2cce('0x10'),_0x11621e,_0x2cce('0xb'));_0x13c46a(_0x205f6b[_0x2cce('0x11')][_0x2cce('0xf')]);}})[_0x2cce('0x12')](function(_0x3abd31){logger[_0x2cce('0xe')](_0x2cce('0x10'),_0x11621e,_0x3abd31);_0x44e9a8(_0x3abd31);});});}exports['GetTrigger']=function(_0x29775c){var _0x342dd3=this;return new Promise(function(_0x30b231,_0x5aaaae){return db[_0x2cce('0x13')][_0x2cce('0x14')]({'raw':_0x29775c[_0x2cce('0x15')]?_0x29775c['options'][_0x2cce('0x16')]===undefined?!![]:![]:!![],'where':_0x29775c[_0x2cce('0x15')]?_0x29775c[_0x2cce('0x15')]['where']||null:null,'attributes':_0x29775c[_0x2cce('0x15')]?_0x29775c[_0x2cce('0x15')][_0x2cce('0x17')]||null:null,'limit':_0x29775c[_0x2cce('0x15')]?_0x29775c['options'][_0x2cce('0x18')]||null:null,'include':_0x29775c[_0x2cce('0x15')]?_0x29775c[_0x2cce('0x15')]['include']?_[_0x2cce('0x19')](_0x29775c[_0x2cce('0x15')][_0x2cce('0x1a')],function(_0x559eec){return{'model':db[_0x559eec[_0x2cce('0x1b')]],'as':_0x559eec['as'],'attributes':_0x559eec['attributes'],'include':_0x559eec['include']?_[_0x2cce('0x19')](_0x559eec['include'],function(_0x121137){return{'model':db[_0x121137[_0x2cce('0x1b')]],'as':_0x121137['as'],'attributes':_0x121137['attributes'],'include':_0x121137[_0x2cce('0x1a')]?_[_0x2cce('0x19')](_0x121137[_0x2cce('0x1a')],function(_0x36dafc){return{'model':db[_0x36dafc[_0x2cce('0x1b')]],'as':_0x36dafc['as'],'attributes':_0x36dafc[_0x2cce('0x17')]};}):[]};}):[]};}):[]:[]})[_0x2cce('0x1c')](function(_0x66d7c7){logger[_0x2cce('0x1d')](_0x2cce('0x1e'),_0x29775c);logger[_0x2cce('0xc')](_0x2cce('0x1e'),_0x29775c,JSON[_0x2cce('0xd')](_0x66d7c7));_0x30b231(_0x66d7c7);})[_0x2cce('0x12')](function(_0x4587f5){logger['error'](_0x2cce('0x1e'),_0x4587f5[_0x2cce('0xf')],_0x29775c);_0x5aaaae(_0x342dd3[_0x2cce('0xe')](0x1f4,_0x4587f5[_0x2cce('0xf')]));});});};exports[_0x2cce('0x1f')]=function(_0x39f7d3){var _0x3aec7d=this;return new Promise(function(_0x52a071,_0x103368){return db[_0x2cce('0x13')]['find']({'raw':_0x39f7d3[_0x2cce('0x15')]?_0x39f7d3[_0x2cce('0x15')][_0x2cce('0x16')]===undefined?!![]:![]:!![],'where':_0x39f7d3[_0x2cce('0x15')]?_0x39f7d3[_0x2cce('0x15')][_0x2cce('0x20')]||null:null,'attributes':_0x39f7d3[_0x2cce('0x15')]?_0x39f7d3['options'][_0x2cce('0x17')]||null:null,'include':_0x39f7d3['options']?_0x39f7d3[_0x2cce('0x15')][_0x2cce('0x1a')]?_[_0x2cce('0x19')](_0x39f7d3[_0x2cce('0x15')]['include'],function(_0x543a07){return{'model':db[_0x543a07[_0x2cce('0x1b')]],'as':_0x543a07['as'],'attributes':_0x543a07[_0x2cce('0x17')],'include':_0x543a07[_0x2cce('0x1a')]?_['map'](_0x543a07[_0x2cce('0x1a')],function(_0x475a4f){return{'model':db[_0x475a4f[_0x2cce('0x1b')]],'as':_0x475a4f['as'],'attributes':_0x475a4f[_0x2cce('0x17')],'include':_0x475a4f[_0x2cce('0x1a')]?_[_0x2cce('0x19')](_0x475a4f[_0x2cce('0x1a')],function(_0x3d2801){return{'model':db[_0x3d2801[_0x2cce('0x1b')]],'as':_0x3d2801['as'],'attributes':_0x3d2801[_0x2cce('0x17')]};}):[]};}):[]};}):[]:[]})[_0x2cce('0x1c')](function(_0x76dd5a){logger[_0x2cce('0x1d')](_0x2cce('0x1f'),_0x39f7d3);logger[_0x2cce('0xc')](_0x2cce('0x1f'),_0x39f7d3,JSON[_0x2cce('0xd')](_0x76dd5a));_0x52a071(_0x76dd5a);})['catch'](function(_0x48e269){logger['error'](_0x2cce('0x1f'),_0x48e269['message'],_0x39f7d3);_0x103368(_0x3aec7d[_0x2cce('0xe')](0x1f4,_0x48e269[_0x2cce('0xf')]));});});}; \ No newline at end of file +var _0x03f3=['bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','Trigger,\x20%s,\x20%s','error','message','result','GetTrigger','Trigger','findAll','options','raw','where','limit','include','map','model','attributes','catch','ShowTrigger','find','then','stringify','util','moment'];(function(_0x323269,_0x20413d){var _0x569b7a=function(_0x33a3bf){while(--_0x33a3bf){_0x323269['push'](_0x323269['shift']());}};_0x569b7a(++_0x20413d);}(_0x03f3,0x116));var _0x303f=function(_0x3f369c,_0x1c5793){_0x3f369c=_0x3f369c-0x0;var _0x3f851a=_0x03f3[_0x3f369c];return _0x3f851a;};'use strict';var _=require('lodash');var util=require(_0x303f('0x0'));var moment=require(_0x303f('0x1'));var BPromise=require(_0x303f('0x2'));var rs=require(_0x303f('0x3'));var fs=require('fs');var Redis=require(_0x303f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x303f('0x5'));var logger=require('../../config/logger')(_0x303f('0x6'));var config=require(_0x303f('0x7'));var jayson=require(_0x303f('0x8'));var client=jayson[_0x303f('0x9')][_0x303f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x24dcea,_0x1b80c6,_0x991cfc){return new BPromise(function(_0x1b14de,_0x13d414){return client['request'](_0x24dcea,_0x991cfc)['then'](function(_0x432620){logger[_0x303f('0xb')]('Trigger,\x20%s,\x20%s',_0x1b80c6,_0x303f('0xc'));logger[_0x303f('0xd')](_0x303f('0xe'),_0x1b80c6,_0x303f('0xc'),JSON['stringify'](_0x432620));if(_0x432620['error']){if(_0x432620['error']['code']===0x1f4){logger['error'](_0x303f('0xf'),_0x1b80c6,_0x432620[_0x303f('0x10')]['message']);return _0x13d414(_0x432620['error'][_0x303f('0x11')]);}logger['error'](_0x303f('0xf'),_0x1b80c6,_0x432620[_0x303f('0x10')][_0x303f('0x11')]);return _0x1b14de(_0x432620[_0x303f('0x10')][_0x303f('0x11')]);}else{logger[_0x303f('0xb')](_0x303f('0xf'),_0x1b80c6,_0x303f('0xc'));_0x1b14de(_0x432620[_0x303f('0x12')][_0x303f('0x11')]);}})['catch'](function(_0x4b5c41){logger[_0x303f('0x10')](_0x303f('0xf'),_0x1b80c6,_0x4b5c41);_0x13d414(_0x4b5c41);});});}exports[_0x303f('0x13')]=function(_0x2b3bcd){var _0x52a728=this;return new Promise(function(_0x33ca12,_0x443fb4){return db[_0x303f('0x14')][_0x303f('0x15')]({'raw':_0x2b3bcd[_0x303f('0x16')]?_0x2b3bcd['options'][_0x303f('0x17')]===undefined?!![]:![]:!![],'where':_0x2b3bcd[_0x303f('0x16')]?_0x2b3bcd[_0x303f('0x16')][_0x303f('0x18')]||null:null,'attributes':_0x2b3bcd['options']?_0x2b3bcd[_0x303f('0x16')]['attributes']||null:null,'limit':_0x2b3bcd[_0x303f('0x16')]?_0x2b3bcd['options'][_0x303f('0x19')]||null:null,'include':_0x2b3bcd[_0x303f('0x16')]?_0x2b3bcd[_0x303f('0x16')][_0x303f('0x1a')]?_[_0x303f('0x1b')](_0x2b3bcd[_0x303f('0x16')][_0x303f('0x1a')],function(_0x351000){return{'model':db[_0x351000[_0x303f('0x1c')]],'as':_0x351000['as'],'attributes':_0x351000['attributes'],'include':_0x351000[_0x303f('0x1a')]?_['map'](_0x351000[_0x303f('0x1a')],function(_0x433a02){return{'model':db[_0x433a02[_0x303f('0x1c')]],'as':_0x433a02['as'],'attributes':_0x433a02[_0x303f('0x1d')],'include':_0x433a02['include']?_[_0x303f('0x1b')](_0x433a02['include'],function(_0x21b777){return{'model':db[_0x21b777['model']],'as':_0x21b777['as'],'attributes':_0x21b777[_0x303f('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x450efe){logger[_0x303f('0xb')](_0x303f('0x13'),_0x2b3bcd);logger[_0x303f('0xd')]('GetTrigger',_0x2b3bcd,JSON['stringify'](_0x450efe));_0x33ca12(_0x450efe);})[_0x303f('0x1e')](function(_0x4c6f4d){logger[_0x303f('0x10')]('GetTrigger',_0x4c6f4d[_0x303f('0x11')],_0x2b3bcd);_0x443fb4(_0x52a728[_0x303f('0x10')](0x1f4,_0x4c6f4d['message']));});});};exports[_0x303f('0x1f')]=function(_0x5af3e8){var _0x48c554=this;return new Promise(function(_0x10df4f,_0x98942e){return db[_0x303f('0x14')][_0x303f('0x20')]({'raw':_0x5af3e8[_0x303f('0x16')]?_0x5af3e8['options']['raw']===undefined?!![]:![]:!![],'where':_0x5af3e8['options']?_0x5af3e8['options'][_0x303f('0x18')]||null:null,'attributes':_0x5af3e8[_0x303f('0x16')]?_0x5af3e8['options'][_0x303f('0x1d')]||null:null,'include':_0x5af3e8[_0x303f('0x16')]?_0x5af3e8['options']['include']?_['map'](_0x5af3e8['options'][_0x303f('0x1a')],function(_0x32bb2e){return{'model':db[_0x32bb2e[_0x303f('0x1c')]],'as':_0x32bb2e['as'],'attributes':_0x32bb2e['attributes'],'include':_0x32bb2e[_0x303f('0x1a')]?_[_0x303f('0x1b')](_0x32bb2e[_0x303f('0x1a')],function(_0x41b729){return{'model':db[_0x41b729[_0x303f('0x1c')]],'as':_0x41b729['as'],'attributes':_0x41b729[_0x303f('0x1d')],'include':_0x41b729[_0x303f('0x1a')]?_[_0x303f('0x1b')](_0x41b729[_0x303f('0x1a')],function(_0x12def1){return{'model':db[_0x12def1[_0x303f('0x1c')]],'as':_0x12def1['as'],'attributes':_0x12def1[_0x303f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x303f('0x21')](function(_0x5e8c2a){logger[_0x303f('0xb')](_0x303f('0x1f'),_0x5af3e8);logger[_0x303f('0xd')](_0x303f('0x1f'),_0x5af3e8,JSON[_0x303f('0x22')](_0x5e8c2a));_0x10df4f(_0x5e8c2a);})[_0x303f('0x1e')](function(_0x3cbda8){logger[_0x303f('0x10')](_0x303f('0x1f'),_0x3cbda8[_0x303f('0x11')],_0x5af3e8);_0x98942e(_0x48c554[_0x303f('0x10')](0x1f4,_0x3cbda8['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 9e0f27e..5909d1b 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 _0xcdb7=['clone','create','put','/:id','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','show','post','/:id/clone'];(function(_0x485e16,_0x427be3){var _0x5dbc59=function(_0x293775){while(--_0x293775){_0x485e16['push'](_0x485e16['shift']());}};_0x5dbc59(++_0x427be3);}(_0xcdb7,0x1e9));var _0x7cdb=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xcdb7[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7cdb('0x0'));var util=require(_0x7cdb('0x1'));var path=require(_0x7cdb('0x2'));var timeout=require(_0x7cdb('0x3'));var express=require(_0x7cdb('0x4'));var router=express[_0x7cdb('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7cdb('0x6'));var config=require(_0x7cdb('0x7'));var controller=require(_0x7cdb('0x8'));router[_0x7cdb('0x9')]('/',auth[_0x7cdb('0xa')](),controller[_0x7cdb('0xb')]);router[_0x7cdb('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x7cdb('0xc')]);router[_0x7cdb('0xd')](_0x7cdb('0xe'),auth['isAuthenticated'](),controller[_0x7cdb('0xf')]);router[_0x7cdb('0xd')]('/',auth[_0x7cdb('0xa')](),controller[_0x7cdb('0x10')]);router[_0x7cdb('0x11')](_0x7cdb('0x12'),auth[_0x7cdb('0xa')](),controller['update']);router[_0x7cdb('0x13')]('/:id',auth[_0x7cdb('0xa')](),controller['destroy']);module[_0x7cdb('0x14')]=router; \ No newline at end of file +var _0x893a=['destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','post','/:id/clone','clone','put','update','delete','/:id'];(function(_0x166ed2,_0x2b3d78){var _0x24d614=function(_0x40a194){while(--_0x40a194){_0x166ed2['push'](_0x166ed2['shift']());}};_0x24d614(++_0x2b3d78);}(_0x893a,0x17c));var _0xa893=function(_0xaf01fb,_0x29a161){_0xaf01fb=_0xaf01fb-0x0;var _0x588da6=_0x893a[_0xaf01fb];return _0x588da6;};'use strict';var multer=require(_0xa893('0x0'));var util=require(_0xa893('0x1'));var path=require(_0xa893('0x2'));var timeout=require(_0xa893('0x3'));var express=require(_0xa893('0x4'));var router=express['Router']();var fs_extra=require(_0xa893('0x5'));var auth=require(_0xa893('0x6'));var interaction=require(_0xa893('0x7'));var config=require(_0xa893('0x8'));var controller=require('./trunk.controller');router['get']('/',auth[_0xa893('0x9')](),controller[_0xa893('0xa')]);router[_0xa893('0xb')]('/:id',auth[_0xa893('0x9')](),controller['show']);router[_0xa893('0xc')](_0xa893('0xd'),auth[_0xa893('0x9')](),controller[_0xa893('0xe')]);router[_0xa893('0xc')]('/',auth[_0xa893('0x9')](),controller['create']);router[_0xa893('0xf')]('/:id',auth[_0xa893('0x9')](),controller[_0xa893('0x10')]);router[_0xa893('0x11')](_0xa893('0x12'),auth[_0xa893('0x9')](),controller[_0xa893('0x13')]);module[_0xa893('0x14')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index f78cd1e..f4c2802 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 _0x5590=['force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','always','accept','refuse','uac','uas','pai','fingerprint','active','actpass','dynamic','nonat','update','update,nonat','sequelize','exports','STRING','friend','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split','rfc2833','info','shortinfo','inband','auto','outgoing','yes'];(function(_0x2e7a32,_0x5713f1){var _0x4b8247=function(_0x1a3ab2){while(--_0x1a3ab2){_0x2e7a32['push'](_0x2e7a32['shift']());}};_0x4b8247(++_0x5713f1);}(_0x5590,0x77));var _0x0559=function(_0x1cd1fa,_0x3b0280){_0x1cd1fa=_0x1cd1fa-0x0;var _0x34c915=_0x5590[_0x1cd1fa];return _0x34c915;};'use strict';var Sequelize=require(_0x0559('0x0'));module[_0x0559('0x1')]={'name':{'type':Sequelize[_0x0559('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x0559('0x3'),'user','peer'),'allowNull':![],'defaultValue':_0x0559('0x3')},'context':{'type':Sequelize[_0x0559('0x2')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x0559('0x4')](_0x0559('0x5'),_0x0559('0x6'),_0x0559('0x7'),_0x0559('0x8'),'PROHIB_NOT_SCREENED',_0x0559('0x9'),_0x0559('0xa'),_0x0559('0xb'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x0559('0x2')]},'secret':{'type':Sequelize[_0x0559('0x2')]},'md5secret':{'type':Sequelize[_0x0559('0x2')]},'remotesecret':{'type':Sequelize[_0x0559('0x2')]},'transport':{'type':Sequelize[_0x0559('0x2')],'defaultValue':_0x0559('0xc'),'set':function(_0x580ee5){this[_0x0559('0xd')](_0x0559('0xe'),_0x580ee5?_0x580ee5[_0x0559('0xf')](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0x0559('0x10')](_0x0559('0xe'))[_0x0559('0x11')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x0559('0x4')](_0x0559('0x12'),_0x0559('0x13'),_0x0559('0x14'),_0x0559('0x15'),_0x0559('0x16')),'defaultValue':_0x0559('0x12')},'directmedia':{'type':Sequelize[_0x0559('0x4')]('yes','no','nonat','update',_0x0559('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x0559('0x4')](_0x0559('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x0559('0x2')]},'nat':{'type':Sequelize[_0x0559('0x2')],'defaultValue':_0x0559('0x19'),'set':function(_0x146596){this[_0x0559('0xd')](_0x0559('0x1a'),_0x146596?_0x146596[_0x0559('0xf')](','):null);},'get':function(){return this[_0x0559('0x10')](_0x0559('0x1a'))?this[_0x0559('0x10')](_0x0559('0x1a'))[_0x0559('0x11')](','):null;},'comment':_0x0559('0x1b')},'callgroup':{'type':Sequelize[_0x0559('0x2')]},'namedcallgroup':{'type':Sequelize[_0x0559('0x2')]},'pickupgroup':{'type':Sequelize[_0x0559('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x0559('0x2')]},'language':{'type':Sequelize[_0x0559('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x0559('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x0559('0x2')],'defaultValue':_0x0559('0x1c')},'allow':{'type':Sequelize[_0x0559('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x18f9fd){this['setDataValue']('allow',_0x18f9fd?_0x18f9fd[_0x0559('0xf')](';'):_0x0559('0x1d'));},'get':function(){return this[_0x0559('0x10')]('allow')?this[_0x0559('0x10')]('allow')['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x0559('0x4')](_0x0559('0x18'),'no')},'insecure':{'type':Sequelize[_0x0559('0x2')],'defaultValue':_0x0559('0x1e'),'set':function(_0x2303dc){this[_0x0559('0xd')]('insecure',_0x2303dc?_0x2303dc['join'](','):null);},'get':function(){return this['getDataValue'](_0x0559('0x1f'))?this[_0x0559('0x10')](_0x0559('0x1f'))[_0x0559('0x11')](','):null;},'comment':_0x0559('0x20')},'trustrpid':{'type':Sequelize[_0x0559('0x4')](_0x0559('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x0559('0x4')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0559('0x4')](_0x0559('0x18'),'no','never')},'promiscredir':{'type':Sequelize['ENUM']('yes','no')},'useclientcode':{'type':Sequelize[_0x0559('0x4')](_0x0559('0x18'),'no')},'accountcode':{'type':Sequelize[_0x0559('0x21')](0xb)},'setvar':{'type':Sequelize[_0x0559('0x2')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x0559('0x22')},'amaflags':{'type':Sequelize[_0x0559('0x2')]},'callcounter':{'type':Sequelize[_0x0559('0x4')]('yes','no'),'defaultValue':_0x0559('0x18')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x0559('0x4')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0x0559('0x4')](_0x0559('0x18'),'no')},'allowtransfer':{'type':Sequelize[_0x0559('0x4')](_0x0559('0x18'),'no')},'ignoresdpversion':{'type':Sequelize[_0x0559('0x4')]('yes','no')},'subscribecontext':{'type':Sequelize[_0x0559('0x2')]},'template':{'type':Sequelize[_0x0559('0x2')]},'videosupport':{'type':Sequelize[_0x0559('0x4')]('yes','no',_0x0559('0x23')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x0559('0x21')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x0559('0x4')]('yes','no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x0559('0x4')](_0x0559('0x24'),_0x0559('0x25'),'originate')},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x0559('0x21')](0xb)},'session_refresher':{'type':Sequelize[_0x0559('0x4')](_0x0559('0x26'),'uas'),'defaultValue':_0x0559('0x27')},'t38pt_usertpsource':{'type':Sequelize[_0x0559('0x2')]},'regexten':{'type':Sequelize[_0x0559('0x2')]},'fromdomain':{'type':Sequelize[_0x0559('0x2')]},'fromuser':{'type':Sequelize[_0x0559('0x2')]},'port':{'type':Sequelize[_0x0559('0x21')](0x5)},'qualify':{'type':Sequelize[_0x0559('0x4')]('yes','no'),'defaultValue':_0x0559('0x18')},'keepalive':{'type':Sequelize[_0x0559('0x21')](0xb)},'defaultip':{'type':Sequelize[_0x0559('0x2')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0x0559('0x21')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x0559('0x21')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x0559('0x18'),'no',_0x0559('0x28')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0559('0x2')]},'callbackextension':{'type':Sequelize[_0x0559('0x2')]},'timert1':{'type':Sequelize[_0x0559('0x21')](0xb)},'timerb':{'type':Sequelize[_0x0559('0x21')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0x0559('0x2')]},'contactdeny':{'type':Sequelize[_0x0559('0x2')]},'contactacl':{'type':Sequelize[_0x0559('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x0559('0x2')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x0559('0x21')](0xb)},'encryption':{'type':Sequelize[_0x0559('0x4')](_0x0559('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x0559('0x4')]('yes','no')},'force_avp':{'type':Sequelize[_0x0559('0x4')](_0x0559('0x18'),'no')},'icesupport':{'type':Sequelize[_0x0559('0x4')]('yes','no')},'dtlsenable':{'type':Sequelize[_0x0559('0x4')](_0x0559('0x18'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x0559('0x18'),'no',_0x0559('0x29'),'certificate')},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x0559('0x2')]},'dtlscipher':{'type':Sequelize[_0x0559('0x2')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x0559('0x2')]},'dtlssetup':{'type':Sequelize[_0x0559('0x4')](_0x0559('0x2a'),'passive',_0x0559('0x2b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x0559('0x4')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x0559('0x2')]},'call_limit':{'type':Sequelize[_0x0559('0x21')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x0559('0x4')](_0x0559('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0x0559('0x4')](_0x0559('0x18'),'no')},'vmexten':{'type':Sequelize[_0x0559('0x2')]},'mohinterpret':{'type':Sequelize[_0x0559('0x2')]},'mohsuggest':{'type':Sequelize[_0x0559('0x2')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0559('0x2')]},'host':{'type':Sequelize[_0x0559('0x2')],'defaultValue':_0x0559('0x2c')},'canreinvite':{'type':Sequelize[_0x0559('0x4')](_0x0559('0x18'),'no',_0x0559('0x2d'),_0x0559('0x2e'),_0x0559('0x2f')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x0559('0x2')]},'otherFields':{'type':Sequelize[_0x0559('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0x58f4=['udp','setDataValue','transport','join','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','split','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]','INTEGER','\x22\x22\x20<>','accept','originate','uas','fingerprint','certificate','active','passive','actpass','update,nonat','exports','STRING','ENUM','friend','user','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN'];(function(_0x5ac188,_0x163bcf){var _0x32fa2f=function(_0x2331c0){while(--_0x2331c0){_0x5ac188['push'](_0x5ac188['shift']());}};_0x32fa2f(++_0x163bcf);}(_0x58f4,0x1c9));var _0x458f=function(_0x362362,_0x2c6d0a){_0x362362=_0x362362-0x0;var _0x1dcba9=_0x58f4[_0x362362];return _0x1dcba9;};'use strict';var Sequelize=require('sequelize');module[_0x458f('0x0')]={'name':{'type':Sequelize[_0x458f('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x458f('0x2')](_0x458f('0x3'),_0x458f('0x4'),'peer'),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x458f('0x5')},'callingpres':{'type':Sequelize[_0x458f('0x2')](_0x458f('0x6'),_0x458f('0x7'),_0x458f('0x8'),_0x458f('0x9'),_0x458f('0xa'),_0x458f('0xb'),_0x458f('0xc'),'PROHIB')},'deny':{'type':Sequelize[_0x458f('0x1')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x458f('0x1')]},'md5secret':{'type':Sequelize[_0x458f('0x1')]},'remotesecret':{'type':Sequelize[_0x458f('0x1')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0x458f('0xd'),'set':function(_0x1484fc){this[_0x458f('0xe')](_0x458f('0xf'),_0x1484fc?_0x1484fc[_0x458f('0x10')](','):null);},'get':function(){return this[_0x458f('0x11')]('transport')?this[_0x458f('0x11')]('transport')['split'](','):null;},'comment':_0x458f('0x12')},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833','info',_0x458f('0x13'),_0x458f('0x14'),_0x458f('0x15')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0x458f('0x16'),'no',_0x458f('0x17'),_0x458f('0x18'),_0x458f('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x458f('0x2')](_0x458f('0x16'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x458f('0x1')],'defaultValue':_0x458f('0x1a'),'set':function(_0x21392c){this[_0x458f('0xe')](_0x458f('0x1b'),_0x21392c?_0x21392c[_0x458f('0x10')](','):null);},'get':function(){return this[_0x458f('0x11')](_0x458f('0x1b'))?this['getDataValue'](_0x458f('0x1b'))[_0x458f('0x1c')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x458f('0x1')]},'namedcallgroup':{'type':Sequelize[_0x458f('0x1')]},'pickupgroup':{'type':Sequelize[_0x458f('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x458f('0x1')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x458f('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x458f('0x1')],'defaultValue':_0x458f('0x1d')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x458f('0x1e'),'set':function(_0x467822){this[_0x458f('0xe')](_0x458f('0x1f'),_0x467822?_0x467822[_0x458f('0x10')](';'):_0x458f('0x1e'));},'get':function(){return this[_0x458f('0x11')](_0x458f('0x1f'))?this[_0x458f('0x11')](_0x458f('0x1f'))[_0x458f('0x1c')](';'):null;},'comment':_0x458f('0x20')},'autoframing':{'type':Sequelize['ENUM'](_0x458f('0x16'),'no')},'insecure':{'type':Sequelize[_0x458f('0x1')],'defaultValue':_0x458f('0x21'),'set':function(_0x299106){this[_0x458f('0xe')]('insecure',_0x299106?_0x299106[_0x458f('0x10')](','):null);},'get':function(){return this[_0x458f('0x11')](_0x458f('0x22'))?this['getDataValue'](_0x458f('0x22'))['split'](','):null;},'comment':_0x458f('0x23')},'trustrpid':{'type':Sequelize['ENUM'](_0x458f('0x16'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x458f('0x2')](_0x458f('0x16'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x458f('0x2')](_0x458f('0x16'),'no','never')},'promiscredir':{'type':Sequelize['ENUM'](_0x458f('0x16'),'no')},'useclientcode':{'type':Sequelize[_0x458f('0x2')](_0x458f('0x16'),'no')},'accountcode':{'type':Sequelize[_0x458f('0x24')](0xb)},'setvar':{'type':Sequelize[_0x458f('0x1')]},'callerid':{'type':Sequelize[_0x458f('0x1')],'defaultValue':_0x458f('0x25')},'amaflags':{'type':Sequelize[_0x458f('0x1')]},'callcounter':{'type':Sequelize[_0x458f('0x2')](_0x458f('0x16'),'no'),'defaultValue':_0x458f('0x16')},'busylevel':{'type':Sequelize[_0x458f('0x24')](0xb)},'allowoverlap':{'type':Sequelize[_0x458f('0x2')](_0x458f('0x16'),'no')},'allowsubscribe':{'type':Sequelize[_0x458f('0x2')]('yes','no')},'allowtransfer':{'type':Sequelize[_0x458f('0x2')](_0x458f('0x16'),'no')},'ignoresdpversion':{'type':Sequelize[_0x458f('0x2')]('yes','no')},'subscribecontext':{'type':Sequelize[_0x458f('0x1')]},'template':{'type':Sequelize[_0x458f('0x1')]},'videosupport':{'type':Sequelize[_0x458f('0x2')](_0x458f('0x16'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x458f('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x458f('0x2')](_0x458f('0x16'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x458f('0x2')](_0x458f('0x26'),'refuse',_0x458f('0x27'))},'session_expires':{'type':Sequelize[_0x458f('0x24')](0xb)},'session_minse':{'type':Sequelize[_0x458f('0x24')](0xb)},'session_refresher':{'type':Sequelize[_0x458f('0x2')]('uac',_0x458f('0x28')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x458f('0x1')]},'regexten':{'type':Sequelize[_0x458f('0x1')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x458f('0x1')]},'port':{'type':Sequelize[_0x458f('0x24')](0x5)},'qualify':{'type':Sequelize[_0x458f('0x2')]('yes','no'),'defaultValue':_0x458f('0x16')},'keepalive':{'type':Sequelize[_0x458f('0x24')](0xb)},'defaultip':{'type':Sequelize[_0x458f('0x1')]},'defaultuser':{'type':Sequelize[_0x458f('0x1')]},'rtptimeout':{'type':Sequelize[_0x458f('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x458f('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x458f('0x24')](0xb)},'sendrpid':{'type':Sequelize[_0x458f('0x2')](_0x458f('0x16'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x458f('0x1')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x458f('0x24')](0xb)},'timerb':{'type':Sequelize[_0x458f('0x24')](0xb)},'qualifyfreq':{'type':Sequelize[_0x458f('0x24')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x458f('0x1')]},'contactacl':{'type':Sequelize[_0x458f('0x1')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x458f('0x1')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x458f('0x16'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x458f('0x16'),'no')},'force_avp':{'type':Sequelize['ENUM']('yes','no')},'icesupport':{'type':Sequelize[_0x458f('0x2')](_0x458f('0x16'),'no')},'dtlsenable':{'type':Sequelize[_0x458f('0x2')]('yes','no')},'dtlsverify':{'type':Sequelize[_0x458f('0x2')](_0x458f('0x16'),'no',_0x458f('0x29'),_0x458f('0x2a'))},'dtlsrekey':{'type':Sequelize[_0x458f('0x24')](0xb)},'dtlscertfile':{'type':Sequelize[_0x458f('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0x458f('0x1')]},'dtlscipher':{'type':Sequelize[_0x458f('0x1')]},'dtlscafile':{'type':Sequelize[_0x458f('0x1')]},'dtlscapath':{'type':Sequelize[_0x458f('0x1')]},'dtlssetup':{'type':Sequelize[_0x458f('0x2')](_0x458f('0x2b'),_0x458f('0x2c'),_0x458f('0x2d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x458f('0x1')]},'usereqphone':{'type':Sequelize['ENUM'](_0x458f('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x458f('0x1')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x458f('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x458f('0x16'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x458f('0x16'),'no')},'vmexten':{'type':Sequelize[_0x458f('0x1')]},'mohinterpret':{'type':Sequelize[_0x458f('0x1')]},'mohsuggest':{'type':Sequelize[_0x458f('0x1')]},'parkinglot':{'type':Sequelize[_0x458f('0x1')]},'description':{'type':Sequelize[_0x458f('0x1')]},'host':{'type':Sequelize[_0x458f('0x1')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x458f('0x2')]('yes','no',_0x458f('0x17'),_0x458f('0x18'),_0x458f('0x2e')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x458f('0x1')]},'otherFields':{'type':Sequelize[_0x458f('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x458f('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 0995a78..d786108 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 _0x9957=['clone','includeAll','merge','get','omit','createdAt','updatedAt','body','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findAll','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','Reload','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','update','destroy','Trunks','stack','name','send','map','Trunk','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','filter','options','include','rows','show','params','find'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];var jayson=require(_0x7995('0x1b'));var client=jayson[_0x7995('0x1c')][_0x7995('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x23999f,_0x2bbe7a,_0x4cc004,_0x58f5ad){return new BPromise(function(_0x2b4e94,_0x2233dd){var _0x24b5bb=_0x58f5ad||client;return _0x24b5bb[_0x7995('0x1e')](_0x23999f,_0x4cc004)[_0x7995('0x1f')](function(_0x1a5310){logger[_0x7995('0x20')](_0x7995('0x21'),_0x2bbe7a,'request\x20sent');logger[_0x7995('0x22')]('Trunk,\x20%s,\x20%s,\x20%s',_0x2bbe7a,_0x7995('0x23'),JSON[_0x7995('0x24')](_0x1a5310));if(_0x1a5310[_0x7995('0x25')]){if(_0x1a5310[_0x7995('0x25')][_0x7995('0x26')]===0x1f4){logger[_0x7995('0x25')]('Trunk,\x20%s,\x20%s',_0x2bbe7a,_0x1a5310['error'][_0x7995('0x27')]);return _0x2233dd(_0x1a5310['error']['message']);}logger[_0x7995('0x25')](_0x7995('0x21'),_0x2bbe7a,_0x1a5310['error'][_0x7995('0x27')]);return _0x2b4e94(_0x1a5310['error']['message']);}else{logger[_0x7995('0x20')](_0x7995('0x21'),_0x2bbe7a,_0x7995('0x23'));_0x2b4e94(_0x1a5310[_0x7995('0x28')][_0x7995('0x27')]);}})[_0x7995('0x29')](function(_0x5d40ae){logger[_0x7995('0x25')](_0x7995('0x21'),_0x2bbe7a,_0x5d40ae);_0x2233dd(_0x5d40ae);});});}function respondWithStatusCode(_0x204507,_0x285437){_0x285437=_0x285437||0xcc;return function(_0x563799){if(_0x563799){return _0x204507[_0x7995('0x2a')](_0x285437);}return _0x204507[_0x7995('0x2b')](_0x285437)[_0x7995('0x2c')]();};}function respondWithResult(_0x59405a,_0x39df42){_0x39df42=_0x39df42||0xc8;return function(_0x34e70c){if(_0x34e70c){return _0x59405a[_0x7995('0x2b')](_0x39df42)[_0x7995('0x2d')](_0x34e70c);}};}function respondWithFilteredResult(_0x3a3fcf,_0x2a307e){return function(_0x56691a){if(_0x56691a){var _0x47625f=typeof _0x2a307e['offset']===_0x7995('0x2e')&&typeof _0x2a307e[_0x7995('0x2f')]===_0x7995('0x2e');var _0x132a42=_0x56691a[_0x7995('0x30')];var _0x4b6f99=_0x47625f?0x0:_0x2a307e[_0x7995('0x31')];var _0x514445=_0x47625f?_0x56691a[_0x7995('0x30')]:_0x2a307e[_0x7995('0x31')]+_0x2a307e[_0x7995('0x2f')];var _0x574574;if(_0x514445>=_0x132a42){_0x514445=_0x132a42;_0x574574=0xc8;}else{_0x574574=0xce;}_0x3a3fcf['status'](_0x574574);return _0x3a3fcf['set'](_0x7995('0x32'),_0x4b6f99+'-'+_0x514445+'/'+_0x132a42)[_0x7995('0x2d')](_0x56691a);}return null;};}function patchUpdates(_0x327a81){return function(_0x2b874d){try{jsonpatch[_0x7995('0x33')](_0x2b874d,_0x327a81,!![]);}catch(_0x1ca460){return BPromise['reject'](_0x1ca460);}return _0x2b874d['save']();};}function saveUpdates(_0xfa8f15,_0x5524af){return function(_0x553671){if(_0x553671){return _0x553671[_0x7995('0x34')](_0xfa8f15)[_0x7995('0x1f')](function(_0x1e9fa4){return _0x1e9fa4;});}return null;};}function removeEntity(_0x1f7d27,_0x510841){return function(_0x44309d){if(_0x44309d){return _0x44309d[_0x7995('0x35')]()['then'](function(){var _0x48db25=_0x44309d['get']({'plain':!![]});var _0x45bc5e=_0x7995('0x36');return db['UserProfileResource'][_0x7995('0x35')]({'where':{'type':_0x45bc5e,'resourceId':_0x48db25['id']}})['then'](function(){return _0x44309d;});})[_0x7995('0x1f')](function(){_0x1f7d27[_0x7995('0x2b')](0xcc)[_0x7995('0x2c')]();});}};}function handleEntityNotFound(_0x5014d2,_0x52d76d){return function(_0x36d057){if(!_0x36d057){_0x5014d2['sendStatus'](0x194);}return _0x36d057;};}function handleError(_0x5d2428,_0x3e99cd){_0x3e99cd=_0x3e99cd||0x1f4;return function(_0xe328b1){logger['error'](_0xe328b1[_0x7995('0x37')]);if(_0xe328b1[_0x7995('0x38')]){delete _0xe328b1[_0x7995('0x38')];}_0x5d2428[_0x7995('0x2b')](_0x3e99cd)[_0x7995('0x39')](_0xe328b1);};}exports['index']=function(_0x2d4285,_0x242713){var _0xf612e6={},_0x1d60b8={},_0x4b1541={'count':0x0,'rows':[]};var _0x2be2c0=_[_0x7995('0x3a')](db[_0x7995('0x3b')][_0x7995('0x3c')],function(_0x1f5bee){return{'name':_0x1f5bee[_0x7995('0x3d')],'type':_0x1f5bee['type'][_0x7995('0x3e')]};});_0x1d60b8[_0x7995('0x3f')]=_[_0x7995('0x3a')](_0x2be2c0,_0x7995('0x38'));_0x1d60b8[_0x7995('0x40')]=_[_0x7995('0x41')](_0x2d4285[_0x7995('0x40')]);_0x1d60b8[_0x7995('0x42')]=_[_0x7995('0x43')](_0x1d60b8[_0x7995('0x3f')],_0x1d60b8[_0x7995('0x40')]);_0xf612e6[_0x7995('0x44')]=_[_0x7995('0x43')](_0x1d60b8['model'],qs['fields'](_0x2d4285[_0x7995('0x40')][_0x7995('0x45')]));_0xf612e6['attributes']=_0xf612e6['attributes'][_0x7995('0x46')]?_0xf612e6['attributes']:_0x1d60b8['model'];if(!_0x2d4285[_0x7995('0x40')][_0x7995('0x47')](_0x7995('0x48'))){_0xf612e6['limit']=qs[_0x7995('0x2f')](_0x2d4285['query'][_0x7995('0x2f')]);_0xf612e6['offset']=qs['offset'](_0x2d4285[_0x7995('0x40')][_0x7995('0x31')]);}_0xf612e6[_0x7995('0x49')]=qs[_0x7995('0x4a')](_0x2d4285['query'][_0x7995('0x4a')]);_0xf612e6[_0x7995('0x4b')]=qs[_0x7995('0x42')](_[_0x7995('0x4c')](_0x2d4285['query'],_0x1d60b8['filters']),_0x2be2c0);if(_0x2d4285[_0x7995('0x40')]['filter']){_0xf612e6[_0x7995('0x4b')]=_['merge'](_0xf612e6[_0x7995('0x4b')],{'$or':_['map'](_0x2be2c0,function(_0x1e795e){if(_0x1e795e[_0x7995('0x4d')]!=='VIRTUAL'){var _0x3e9e62={};_0x3e9e62[_0x1e795e[_0x7995('0x38')]]={'$like':'%'+_0x2d4285[_0x7995('0x40')][_0x7995('0x4e')]+'%'};return _0x3e9e62;}})});}_0xf612e6=_['merge']({},_0xf612e6,_0x2d4285[_0x7995('0x4f')]);var _0x3e787d={'where':_0xf612e6[_0x7995('0x4b')]};return db['Trunk'][_0x7995('0x30')](_0x3e787d)[_0x7995('0x1f')](function(_0x511567){_0x4b1541[_0x7995('0x30')]=_0x511567;if(_0x2d4285[_0x7995('0x40')]['includeAll']){_0xf612e6[_0x7995('0x50')]=[{'all':!![]}];}return db[_0x7995('0x3b')]['findAll'](_0xf612e6);})[_0x7995('0x1f')](function(_0x5843ba){_0x4b1541[_0x7995('0x51')]=_0x5843ba;return _0x4b1541;})[_0x7995('0x1f')](respondWithFilteredResult(_0x242713,_0xf612e6))[_0x7995('0x29')](handleError(_0x242713,null));};exports[_0x7995('0x52')]=function(_0xddf537,_0x14b537){var _0x1579b9={'raw':![],'where':{'id':_0xddf537[_0x7995('0x53')]['id']}},_0x4d46bc={};_0x4d46bc[_0x7995('0x3f')]=_[_0x7995('0x41')](db['Trunk'][_0x7995('0x3c')]);_0x4d46bc[_0x7995('0x40')]=_[_0x7995('0x41')](_0xddf537['query']);_0x4d46bc['filters']=_['intersection'](_0x4d46bc[_0x7995('0x3f')],_0x4d46bc[_0x7995('0x40')]);_0x1579b9['attributes']=_[_0x7995('0x43')](_0x4d46bc[_0x7995('0x3f')],qs[_0x7995('0x45')](_0xddf537[_0x7995('0x40')][_0x7995('0x45')]));_0x1579b9['attributes']=_0x1579b9[_0x7995('0x44')]['length']?_0x1579b9[_0x7995('0x44')]:_0x4d46bc[_0x7995('0x3f')];if(_0xddf537[_0x7995('0x40')]['includeAll']){_0x1579b9['include']=[{'all':!![]}];}_0x1579b9=_['merge']({},_0x1579b9,_0xddf537['options']);return db[_0x7995('0x3b')][_0x7995('0x54')](_0x1579b9)[_0x7995('0x1f')](handleEntityNotFound(_0x14b537,null))[_0x7995('0x1f')](respondWithResult(_0x14b537,null))[_0x7995('0x29')](handleError(_0x14b537,null));};exports[_0x7995('0x55')]=function(_0x1f4270,_0xda6ce8){var _0x328671={'where':{'id':_0x1f4270[_0x7995('0x53')]['id']}},_0x17ecd3={};_0x17ecd3[_0x7995('0x3f')]=_[_0x7995('0x41')](db[_0x7995('0x3b')][_0x7995('0x3c')]);_0x328671[_0x7995('0x44')]=_[_0x7995('0x43')](_0x17ecd3[_0x7995('0x3f')],qs[_0x7995('0x45')](_0x1f4270['query'][_0x7995('0x45')]));_0x328671[_0x7995('0x44')]=_0x328671[_0x7995('0x44')][_0x7995('0x46')]?_0x328671['attributes']:_0x17ecd3['model'];if(_0x1f4270[_0x7995('0x40')][_0x7995('0x56')]){_0x328671[_0x7995('0x50')]=[{'all':!![]}];}_0x328671=_[_0x7995('0x57')]({},_0x328671,_0x1f4270['options']);return db[_0x7995('0x3b')][_0x7995('0x54')](_0x328671)[_0x7995('0x1f')](handleEntityNotFound(_0xda6ce8,null))[_0x7995('0x1f')](function(_0x502d43){if(_0x502d43){var _0x5e2d97=_0x502d43[_0x7995('0x58')]({'plain':!![]});_0x5e2d97=qs[_0x7995('0x59')](_0x5e2d97,['id',_0x7995('0x5a'),_0x7995('0x5b')]);_0x1f4270[_0x7995('0x5c')]=_[_0x7995('0x59')](_0x1f4270[_0x7995('0x5c')],['id',_0x7995('0x5a'),_0x7995('0x5b')]);return db['Trunk'][_0x7995('0x5d')](_[_0x7995('0x57')](_0x5e2d97,_0x1f4270[_0x7995('0x5c')]),{'include':_0x1f4270[_0x7995('0x40')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x3053fd){var _0xebb5c8=_0x1f4270['user'][_0x7995('0x58')]({'plain':!![]});if(!_0xebb5c8)throw new Error(_0x7995('0x5e'));if(_0xebb5c8[_0x7995('0x5f')]===_0x7995('0x60')){var _0x32cb04=_0x3053fd['get']({'plain':!![]});var _0x457d09='Trunks';return db[_0x7995('0x61')][_0x7995('0x54')]({'where':{'name':_0x457d09,'userProfileId':_0xebb5c8[_0x7995('0x62')]},'raw':!![]})[_0x7995('0x1f')](function(_0x4388c1){if(_0x4388c1&&_0x4388c1[_0x7995('0x63')]===0x0){return db[_0x7995('0x64')][_0x7995('0x5d')]({'name':_0x32cb04[_0x7995('0x38')],'resourceId':_0x32cb04['id'],'type':_0x4388c1[_0x7995('0x38')],'sectionId':_0x4388c1['id']},{})[_0x7995('0x1f')](function(){return _0x3053fd;});}else{return _0x3053fd;}})[_0x7995('0x29')](function(_0x56eb85){logger[_0x7995('0x25')](_0x7995('0x65'),_0x56eb85);throw _0x56eb85;});}return _0x3053fd;});}})[_0x7995('0x1f')](respondWithResult(_0xda6ce8,0xc9))[_0x7995('0x29')](handleError(_0xda6ce8,null));};exports[_0x7995('0x5d')]=function(_0x54a2e0,_0x4b54f2,_0x268fde){var _0x87e38d;return db[_0x7995('0x3b')][_0x7995('0x5d')](_0x54a2e0['body'],{'raw':!![]})[_0x7995('0x1f')](function(_0x50a12e){_0x87e38d=_0x50a12e;return db['Trunk'][_0x7995('0x66')]({'raw':!![]});})[_0x7995('0x1f')](function(_0x3f0a71){var _0x44bf2b=fs[_0x7995('0x67')](path[_0x7995('0x68')](config[_0x7995('0x69')],_0x7995('0x6a')),_0x7995('0x6b'));var _0x2466df=fs['readFileSync'](path[_0x7995('0x68')](config[_0x7995('0x69')],_0x7995('0x6c')),'utf8');var _0x1fe1cb=ejs[_0x7995('0x6d')](_0x44bf2b,{'trunks':_0x3f0a71||[]});fs[_0x7995('0x6e')](_0x7995('0x6f'),_0x1fe1cb);if(_0x87e38d[_0x7995('0x70')]){var _0x51ab1e=ejs[_0x7995('0x6d')](_0x2466df,{'trunks':_0x3f0a71||[]});fs[_0x7995('0x6e')](_0x7995('0x71'),_0x51ab1e);}})[_0x7995('0x1f')](function(){return respondWithRpcPromise(_0x7995('0x72'),'create',{'module':'chan_sip.so'});})[_0x7995('0x1f')](function(){var _0xfe1105=_0x54a2e0[_0x7995('0x60')][_0x7995('0x58')]({'plain':!![]});if(!_0xfe1105)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfe1105[_0x7995('0x5f')]===_0x7995('0x60')){var _0x54b955=_0x87e38d['get']({'plain':!![]});return db[_0x7995('0x61')][_0x7995('0x54')]({'where':{'name':'Trunks','userProfileId':_0xfe1105[_0x7995('0x62')]},'raw':!![]})['then'](function(_0x3758f9){if(_0x3758f9&&_0x3758f9[_0x7995('0x63')]===0x0){return db['UserProfileResource']['create']({'name':_0x54b955[_0x7995('0x38')],'resourceId':_0x54b955['id'],'type':_0x3758f9['name'],'sectionId':_0x3758f9['id']},{})[_0x7995('0x1f')](function(){return _0x87e38d;});}else{return _0x87e38d;}})[_0x7995('0x29')](function(_0x3dd197){logger[_0x7995('0x25')](_0x7995('0x65'),_0x3dd197);throw _0x3dd197;});}return _0x87e38d;})[_0x7995('0x1f')](respondWithResult(_0x4b54f2,0xc9))[_0x7995('0x29')](handleError(_0x4b54f2,null));};exports[_0x7995('0x34')]=function(_0x29e0ee,_0x117317,_0x1ab590){var _0x16108c;return db[_0x7995('0x3b')][_0x7995('0x54')]({'where':{'id':_0x29e0ee[_0x7995('0x53')]['id']}})[_0x7995('0x1f')](handleEntityNotFound(_0x117317,null))[_0x7995('0x1f')](saveUpdates(_0x29e0ee[_0x7995('0x5c')],null))[_0x7995('0x1f')](function(_0xa2fc8e){if(_0xa2fc8e){_0x16108c=_0xa2fc8e;return db[_0x7995('0x3b')][_0x7995('0x66')]({'raw':!![]});}})[_0x7995('0x1f')](function(_0x280fbb){if(_0x280fbb){var _0x260ef1=fs[_0x7995('0x67')](path[_0x7995('0x68')](config[_0x7995('0x69')],'server/files/templates/trunk.ejs'),_0x7995('0x6b'));var _0x10f4ca=fs['readFileSync'](path['join'](config[_0x7995('0x69')],_0x7995('0x6c')),_0x7995('0x6b'));var _0x38acda=ejs[_0x7995('0x6d')](_0x260ef1,{'trunks':_0x280fbb||[]});fs[_0x7995('0x6e')]('/etc/asterisk/sip_xcally_trunks.conf',_0x38acda);var _0x2f8a2d=ejs[_0x7995('0x6d')](_0x10f4ca,{'trunks':_0x280fbb||[]});fs[_0x7995('0x6e')](_0x7995('0x71'),_0x2f8a2d);return respondWithRpcPromise(_0x7995('0x72'),_0x7995('0x34'),{'module':_0x7995('0x73')});}return null;})[_0x7995('0x1f')](function(_0x560095){if(_0x560095){return _0x16108c;}})[_0x7995('0x1f')](respondWithResult(_0x117317,null))[_0x7995('0x29')](handleError(_0x117317,null));};exports['destroy']=function(_0x479271,_0xd24c64,_0xf8c2ed){var _0x18e1a2;return db[_0x7995('0x3b')][_0x7995('0x54')]({'where':{'id':_0x479271['params']['id']}})[_0x7995('0x1f')](handleEntityNotFound(_0xd24c64,null))[_0x7995('0x1f')](removeEntity(_0xd24c64,null))['then'](function(){return db[_0x7995('0x3b')][_0x7995('0x66')]({'raw':!![]});})['then'](function(_0x1535a3){var _0x4a5bc5=fs[_0x7995('0x67')](path[_0x7995('0x68')](config[_0x7995('0x69')],_0x7995('0x6a')),_0x7995('0x6b'));var _0x5d16da=fs[_0x7995('0x67')](path[_0x7995('0x68')](config[_0x7995('0x69')],'server/files/templates/registry.ejs'),_0x7995('0x6b'));var _0x3f3434=ejs[_0x7995('0x6d')](_0x4a5bc5,{'trunks':_0x1535a3});var _0x308a26=ejs['render'](_0x5d16da,{'trunks':_0x1535a3});fs[_0x7995('0x6e')](_0x7995('0x6f'),_0x3f3434);fs[_0x7995('0x6e')]('/etc/asterisk/sip_xcally_registers.conf',_0x308a26);return respondWithRpcPromise('Reload',_0x7995('0x35'),{'module':_0x7995('0x73')});})['catch'](handleError(_0xd24c64,null));}; \ No newline at end of file +var _0x008c=['update','destroy','get','Trunks','UserProfileResource','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','Trunk','findAll','show','params','includeAll','include','options','clone','find','omit','createdAt','updatedAt','body','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','root','utf8','server/files/templates/registry.ejs','render','/etc/asterisk/sip_xcally_trunks.conf','registry','writeFileSync','Reload','chan_sip.so','server/files/templates/trunk.ejs','join','/etc/asterisk/sip_xcally_registers.conf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','Trunk,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save'];(function(_0x83b4e,_0x47c407){var _0x2beec8=function(_0x48848f){while(--_0x48848f){_0x83b4e['push'](_0x83b4e['shift']());}};_0x2beec8(++_0x47c407);}(_0x008c,0x188));var _0xc008=function(_0x33a0bb,_0x5c268b){_0x33a0bb=_0x33a0bb-0x0;var _0x229f56=_0x008c[_0x33a0bb];return _0x229f56;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];var jayson=require(_0xc008('0x18'));var client=jayson[_0xc008('0x19')][_0xc008('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x593f7a,_0x560e28,_0x33f44c,_0x50c1ab){return new BPromise(function(_0x25e13f,_0x4584e1){var _0x2073ef=_0x50c1ab||client;return _0x2073ef[_0xc008('0x1b')](_0x593f7a,_0x33f44c)[_0xc008('0x1c')](function(_0x5ee00b){logger['info']('Trunk,\x20%s,\x20%s',_0x560e28,_0xc008('0x1d'));logger[_0xc008('0x1e')](_0xc008('0x1f'),_0x560e28,_0xc008('0x1d'),JSON['stringify'](_0x5ee00b));if(_0x5ee00b['error']){if(_0x5ee00b['error']['code']===0x1f4){logger[_0xc008('0x20')](_0xc008('0x21'),_0x560e28,_0x5ee00b['error'][_0xc008('0x22')]);return _0x4584e1(_0x5ee00b['error']['message']);}logger['error']('Trunk,\x20%s,\x20%s',_0x560e28,_0x5ee00b[_0xc008('0x20')]['message']);return _0x25e13f(_0x5ee00b['error']['message']);}else{logger['info']('Trunk,\x20%s,\x20%s',_0x560e28,_0xc008('0x1d'));_0x25e13f(_0x5ee00b[_0xc008('0x23')][_0xc008('0x22')]);}})[_0xc008('0x24')](function(_0x11cc75){logger[_0xc008('0x20')]('Trunk,\x20%s,\x20%s',_0x560e28,_0x11cc75);_0x4584e1(_0x11cc75);});});}function respondWithStatusCode(_0x459fd9,_0x5c85f2){_0x5c85f2=_0x5c85f2||0xcc;return function(_0x58a6ea){if(_0x58a6ea){return _0x459fd9[_0xc008('0x25')](_0x5c85f2);}return _0x459fd9[_0xc008('0x26')](_0x5c85f2)[_0xc008('0x27')]();};}function respondWithResult(_0x3cb28c,_0x5410f5){_0x5410f5=_0x5410f5||0xc8;return function(_0x48582b){if(_0x48582b){return _0x3cb28c['status'](_0x5410f5)[_0xc008('0x28')](_0x48582b);}};}function respondWithFilteredResult(_0x15dade,_0x92c582){return function(_0x2e31c2){if(_0x2e31c2){var _0x5bebd9=typeof _0x92c582['offset']==='undefined'&&typeof _0x92c582['limit']==='undefined';var _0x3865c0=_0x2e31c2[_0xc008('0x29')];var _0x25eae4=_0x5bebd9?0x0:_0x92c582['offset'];var _0x24c14c=_0x5bebd9?_0x2e31c2[_0xc008('0x29')]:_0x92c582[_0xc008('0x2a')]+_0x92c582[_0xc008('0x2b')];var _0x4c5dec;if(_0x24c14c>=_0x3865c0){_0x24c14c=_0x3865c0;_0x4c5dec=0xc8;}else{_0x4c5dec=0xce;}_0x15dade[_0xc008('0x26')](_0x4c5dec);return _0x15dade[_0xc008('0x2c')]('Content-Range',_0x25eae4+'-'+_0x24c14c+'/'+_0x3865c0)['json'](_0x2e31c2);}return null;};}function patchUpdates(_0x539766){return function(_0x1032b2){try{jsonpatch[_0xc008('0x2d')](_0x1032b2,_0x539766,!![]);}catch(_0xf831f2){return BPromise[_0xc008('0x2e')](_0xf831f2);}return _0x1032b2[_0xc008('0x2f')]();};}function saveUpdates(_0xceebc3,_0x294f97){return function(_0x22d8e8){if(_0x22d8e8){return _0x22d8e8[_0xc008('0x30')](_0xceebc3)[_0xc008('0x1c')](function(_0x2f4b6b){return _0x2f4b6b;});}return null;};}function removeEntity(_0x1ac7c8,_0x596ee8){return function(_0x334a09){if(_0x334a09){return _0x334a09[_0xc008('0x31')]()['then'](function(){var _0xaf4b84=_0x334a09[_0xc008('0x32')]({'plain':!![]});var _0x383be7=_0xc008('0x33');return db[_0xc008('0x34')][_0xc008('0x31')]({'where':{'type':_0x383be7,'resourceId':_0xaf4b84['id']}})[_0xc008('0x1c')](function(){return _0x334a09;});})[_0xc008('0x1c')](function(){_0x1ac7c8[_0xc008('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x415b87,_0x389a40){return function(_0x459df4){if(!_0x459df4){_0x415b87[_0xc008('0x25')](0x194);}return _0x459df4;};}function handleError(_0x40002f,_0x315562){_0x315562=_0x315562||0x1f4;return function(_0x1667a0){logger['error'](_0x1667a0[_0xc008('0x35')]);if(_0x1667a0[_0xc008('0x36')]){delete _0x1667a0['name'];}_0x40002f[_0xc008('0x26')](_0x315562)[_0xc008('0x37')](_0x1667a0);};}exports['index']=function(_0x263473,_0x2e4ae1){var _0x280e9b={},_0x55ff48={},_0x53b353={'count':0x0,'rows':[]};var _0x478810=_[_0xc008('0x38')](db['Trunk'][_0xc008('0x39')],function(_0x3884dd){return{'name':_0x3884dd[_0xc008('0x3a')],'type':_0x3884dd[_0xc008('0x3b')][_0xc008('0x3c')]};});_0x55ff48[_0xc008('0x3d')]=_[_0xc008('0x38')](_0x478810,_0xc008('0x36'));_0x55ff48[_0xc008('0x3e')]=_[_0xc008('0x3f')](_0x263473[_0xc008('0x3e')]);_0x55ff48[_0xc008('0x40')]=_[_0xc008('0x41')](_0x55ff48[_0xc008('0x3d')],_0x55ff48['query']);_0x280e9b[_0xc008('0x42')]=_[_0xc008('0x41')](_0x55ff48[_0xc008('0x3d')],qs[_0xc008('0x43')](_0x263473['query'][_0xc008('0x43')]));_0x280e9b[_0xc008('0x42')]=_0x280e9b[_0xc008('0x42')][_0xc008('0x44')]?_0x280e9b[_0xc008('0x42')]:_0x55ff48['model'];if(!_0x263473[_0xc008('0x3e')][_0xc008('0x45')](_0xc008('0x46'))){_0x280e9b[_0xc008('0x2b')]=qs[_0xc008('0x2b')](_0x263473['query'][_0xc008('0x2b')]);_0x280e9b[_0xc008('0x2a')]=qs[_0xc008('0x2a')](_0x263473[_0xc008('0x3e')]['offset']);}_0x280e9b[_0xc008('0x47')]=qs[_0xc008('0x48')](_0x263473[_0xc008('0x3e')]['sort']);_0x280e9b[_0xc008('0x49')]=qs['filters'](_[_0xc008('0x4a')](_0x263473['query'],_0x55ff48[_0xc008('0x40')]),_0x478810);if(_0x263473[_0xc008('0x3e')]['filter']){_0x280e9b[_0xc008('0x49')]=_[_0xc008('0x4b')](_0x280e9b[_0xc008('0x49')],{'$or':_['map'](_0x478810,function(_0x1cec64){if(_0x1cec64[_0xc008('0x3b')]!==_0xc008('0x4c')){var _0x44fc5d={};_0x44fc5d[_0x1cec64[_0xc008('0x36')]]={'$like':'%'+_0x263473[_0xc008('0x3e')]['filter']+'%'};return _0x44fc5d;}})});}_0x280e9b=_['merge']({},_0x280e9b,_0x263473['options']);var _0x4552ed={'where':_0x280e9b[_0xc008('0x49')]};return db[_0xc008('0x4d')][_0xc008('0x29')](_0x4552ed)[_0xc008('0x1c')](function(_0x24f6a4){_0x53b353[_0xc008('0x29')]=_0x24f6a4;if(_0x263473[_0xc008('0x3e')]['includeAll']){_0x280e9b['include']=[{'all':!![]}];}return db['Trunk'][_0xc008('0x4e')](_0x280e9b);})[_0xc008('0x1c')](function(_0x158eae){_0x53b353['rows']=_0x158eae;return _0x53b353;})[_0xc008('0x1c')](respondWithFilteredResult(_0x2e4ae1,_0x280e9b))[_0xc008('0x24')](handleError(_0x2e4ae1,null));};exports[_0xc008('0x4f')]=function(_0x1c2c50,_0x4981b4){var _0x56e4ac={'raw':![],'where':{'id':_0x1c2c50[_0xc008('0x50')]['id']}},_0x17ec90={};_0x17ec90[_0xc008('0x3d')]=_[_0xc008('0x3f')](db['Trunk']['rawAttributes']);_0x17ec90[_0xc008('0x3e')]=_['keys'](_0x1c2c50[_0xc008('0x3e')]);_0x17ec90[_0xc008('0x40')]=_[_0xc008('0x41')](_0x17ec90['model'],_0x17ec90[_0xc008('0x3e')]);_0x56e4ac[_0xc008('0x42')]=_[_0xc008('0x41')](_0x17ec90[_0xc008('0x3d')],qs[_0xc008('0x43')](_0x1c2c50['query'][_0xc008('0x43')]));_0x56e4ac[_0xc008('0x42')]=_0x56e4ac['attributes'][_0xc008('0x44')]?_0x56e4ac[_0xc008('0x42')]:_0x17ec90['model'];if(_0x1c2c50['query'][_0xc008('0x51')]){_0x56e4ac[_0xc008('0x52')]=[{'all':!![]}];}_0x56e4ac=_[_0xc008('0x4b')]({},_0x56e4ac,_0x1c2c50[_0xc008('0x53')]);return db[_0xc008('0x4d')]['find'](_0x56e4ac)['then'](handleEntityNotFound(_0x4981b4,null))[_0xc008('0x1c')](respondWithResult(_0x4981b4,null))['catch'](handleError(_0x4981b4,null));};exports[_0xc008('0x54')]=function(_0x25d351,_0xf94fcb){var _0x2f1105={'where':{'id':_0x25d351[_0xc008('0x50')]['id']}},_0x44f42d={};_0x44f42d['model']=_[_0xc008('0x3f')](db[_0xc008('0x4d')][_0xc008('0x39')]);_0x2f1105[_0xc008('0x42')]=_[_0xc008('0x41')](_0x44f42d['model'],qs[_0xc008('0x43')](_0x25d351['query']['fields']));_0x2f1105['attributes']=_0x2f1105[_0xc008('0x42')][_0xc008('0x44')]?_0x2f1105[_0xc008('0x42')]:_0x44f42d['model'];if(_0x25d351[_0xc008('0x3e')][_0xc008('0x51')]){_0x2f1105[_0xc008('0x52')]=[{'all':!![]}];}_0x2f1105=_['merge']({},_0x2f1105,_0x25d351[_0xc008('0x53')]);return db[_0xc008('0x4d')][_0xc008('0x55')](_0x2f1105)[_0xc008('0x1c')](handleEntityNotFound(_0xf94fcb,null))['then'](function(_0x4022dd){if(_0x4022dd){var _0x4eaa6d=_0x4022dd[_0xc008('0x32')]({'plain':!![]});_0x4eaa6d=qs[_0xc008('0x56')](_0x4eaa6d,['id',_0xc008('0x57'),_0xc008('0x58')]);_0x25d351[_0xc008('0x59')]=_[_0xc008('0x56')](_0x25d351['body'],['id',_0xc008('0x57'),'updatedAt']);return db['Trunk'][_0xc008('0x5a')](_[_0xc008('0x4b')](_0x4eaa6d,_0x25d351['body']),{'include':_0x25d351[_0xc008('0x3e')][_0xc008('0x51')]?[{'all':!![]}]:undefined})[_0xc008('0x1c')](function(_0x4517c0){var _0x21ee6d=_0x25d351[_0xc008('0x5b')][_0xc008('0x32')]({'plain':!![]});if(!_0x21ee6d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x21ee6d[_0xc008('0x5c')]===_0xc008('0x5b')){var _0x3bfb15=_0x4517c0[_0xc008('0x32')]({'plain':!![]});var _0xb3ca0f=_0xc008('0x33');return db[_0xc008('0x5d')][_0xc008('0x55')]({'where':{'name':_0xb3ca0f,'userProfileId':_0x21ee6d[_0xc008('0x5e')]},'raw':!![]})[_0xc008('0x1c')](function(_0x1bef66){if(_0x1bef66&&_0x1bef66[_0xc008('0x5f')]===0x0){return db[_0xc008('0x34')][_0xc008('0x5a')]({'name':_0x3bfb15['name'],'resourceId':_0x3bfb15['id'],'type':_0x1bef66[_0xc008('0x36')],'sectionId':_0x1bef66['id']},{})[_0xc008('0x1c')](function(){return _0x4517c0;});}else{return _0x4517c0;}})[_0xc008('0x24')](function(_0x566dea){logger[_0xc008('0x20')](_0xc008('0x60'),_0x566dea);throw _0x566dea;});}return _0x4517c0;});}})['then'](respondWithResult(_0xf94fcb,0xc9))['catch'](handleError(_0xf94fcb,null));};exports[_0xc008('0x5a')]=function(_0x2a4c2b,_0x7bad14,_0x39083c){var _0x1a2ce7;return db[_0xc008('0x4d')][_0xc008('0x5a')](_0x2a4c2b[_0xc008('0x59')],{'raw':!![]})[_0xc008('0x1c')](function(_0x1b059b){_0x1a2ce7=_0x1b059b;return db[_0xc008('0x4d')]['findAll']({'raw':!![]});})[_0xc008('0x1c')](function(_0x25a52b){var _0xfdb5e3=fs[_0xc008('0x61')](path['join'](config[_0xc008('0x62')],'server/files/templates/trunk.ejs'),_0xc008('0x63'));var _0x46fa7b=fs[_0xc008('0x61')](path['join'](config[_0xc008('0x62')],_0xc008('0x64')),_0xc008('0x63'));var _0x553f5c=ejs[_0xc008('0x65')](_0xfdb5e3,{'trunks':_0x25a52b||[]});fs['writeFileSync'](_0xc008('0x66'),_0x553f5c);if(_0x1a2ce7[_0xc008('0x67')]){var _0x23012c=ejs[_0xc008('0x65')](_0x46fa7b,{'trunks':_0x25a52b||[]});fs[_0xc008('0x68')]('/etc/asterisk/sip_xcally_registers.conf',_0x23012c);}})[_0xc008('0x1c')](function(){return respondWithRpcPromise(_0xc008('0x69'),'create',{'module':_0xc008('0x6a')});})['then'](function(){var _0x278cbe=_0x2a4c2b['user'][_0xc008('0x32')]({'plain':!![]});if(!_0x278cbe)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x278cbe[_0xc008('0x5c')]===_0xc008('0x5b')){var _0x33d8e4=_0x1a2ce7[_0xc008('0x32')]({'plain':!![]});return db['UserProfileSection'][_0xc008('0x55')]({'where':{'name':_0xc008('0x33'),'userProfileId':_0x278cbe[_0xc008('0x5e')]},'raw':!![]})[_0xc008('0x1c')](function(_0x321500){if(_0x321500&&_0x321500[_0xc008('0x5f')]===0x0){return db[_0xc008('0x34')][_0xc008('0x5a')]({'name':_0x33d8e4['name'],'resourceId':_0x33d8e4['id'],'type':_0x321500[_0xc008('0x36')],'sectionId':_0x321500['id']},{})['then'](function(){return _0x1a2ce7;});}else{return _0x1a2ce7;}})['catch'](function(_0x4c84da){logger[_0xc008('0x20')](_0xc008('0x60'),_0x4c84da);throw _0x4c84da;});}return _0x1a2ce7;})[_0xc008('0x1c')](respondWithResult(_0x7bad14,0xc9))[_0xc008('0x24')](handleError(_0x7bad14,null));};exports[_0xc008('0x30')]=function(_0x2e9646,_0x23ef42,_0x519328){var _0x127bdf;return db['Trunk'][_0xc008('0x55')]({'where':{'id':_0x2e9646[_0xc008('0x50')]['id']}})[_0xc008('0x1c')](handleEntityNotFound(_0x23ef42,null))[_0xc008('0x1c')](saveUpdates(_0x2e9646[_0xc008('0x59')],null))[_0xc008('0x1c')](function(_0x23d4ff){if(_0x23d4ff){_0x127bdf=_0x23d4ff;return db[_0xc008('0x4d')][_0xc008('0x4e')]({'raw':!![]});}})[_0xc008('0x1c')](function(_0x334ed8){if(_0x334ed8){var _0x1dd9fe=fs['readFileSync'](path['join'](config[_0xc008('0x62')],_0xc008('0x6b')),_0xc008('0x63'));var _0x572d93=fs[_0xc008('0x61')](path[_0xc008('0x6c')](config['root'],'server/files/templates/registry.ejs'),'utf8');var _0x3fc44f=ejs[_0xc008('0x65')](_0x1dd9fe,{'trunks':_0x334ed8||[]});fs[_0xc008('0x68')](_0xc008('0x66'),_0x3fc44f);var _0x1101b8=ejs[_0xc008('0x65')](_0x572d93,{'trunks':_0x334ed8||[]});fs[_0xc008('0x68')](_0xc008('0x6d'),_0x1101b8);return respondWithRpcPromise(_0xc008('0x69'),_0xc008('0x30'),{'module':'chan_sip.so'});}return null;})['then'](function(_0xc644fe){if(_0xc644fe){return _0x127bdf;}})[_0xc008('0x1c')](respondWithResult(_0x23ef42,null))[_0xc008('0x24')](handleError(_0x23ef42,null));};exports[_0xc008('0x31')]=function(_0x2b94b2,_0x37fc2c,_0x4b434f){var _0x5794fe;return db[_0xc008('0x4d')][_0xc008('0x55')]({'where':{'id':_0x2b94b2[_0xc008('0x50')]['id']}})['then'](handleEntityNotFound(_0x37fc2c,null))['then'](removeEntity(_0x37fc2c,null))['then'](function(){return db['Trunk']['findAll']({'raw':!![]});})['then'](function(_0x276de2){var _0x52bf60=fs[_0xc008('0x61')](path['join'](config[_0xc008('0x62')],_0xc008('0x6b')),_0xc008('0x63'));var _0x5bc8b0=fs['readFileSync'](path[_0xc008('0x6c')](config['root'],_0xc008('0x64')),_0xc008('0x63'));var _0x544519=ejs[_0xc008('0x65')](_0x52bf60,{'trunks':_0x276de2});var _0x4db90b=ejs['render'](_0x5bc8b0,{'trunks':_0x276de2});fs[_0xc008('0x68')](_0xc008('0x66'),_0x544519);fs['writeFileSync'](_0xc008('0x6d'),_0x4db90b);return respondWithRpcPromise(_0xc008('0x69'),_0xc008('0x31'),{'module':'chan_sip.so'});})[_0xc008('0x24')](handleError(_0x37fc2c,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index f7d3729..5b96a57 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 _0xf412=['../../config/environment','./trunk.attributes','exports','Trunk','tools_trunks','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x5ca0b3,_0x33f5ef){var _0x6ba806=function(_0x58b844){while(--_0x58b844){_0x5ca0b3['push'](_0x5ca0b3['shift']());}};_0x6ba806(++_0x33f5ef);}(_0xf412,0x1a5));var _0x2f41=function(_0x23f3fe,_0x37a19c){_0x23f3fe=_0x23f3fe-0x0;var _0x1b1cb1=_0xf412[_0x23f3fe];return _0x1b1cb1;};'use strict';var _=require(_0x2f41('0x0'));var util=require(_0x2f41('0x1'));var logger=require(_0x2f41('0x2'))(_0x2f41('0x3'));var moment=require(_0x2f41('0x4'));var BPromise=require(_0x2f41('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2f41('0x6'));var rimraf=require(_0x2f41('0x7'));var config=require(_0x2f41('0x8'));var attributes=require(_0x2f41('0x9'));module[_0x2f41('0xa')]=function(_0x3fc7a0,_0x564c90){return _0x3fc7a0['define'](_0x2f41('0xb'),attributes,{'tableName':_0x2f41('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa36=['Trunk','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./trunk.attributes','define'];(function(_0xd7f086,_0x335f63){var _0x41c758=function(_0x58cb45){while(--_0x58cb45){_0xd7f086['push'](_0xd7f086['shift']());}};_0x41c758(++_0x335f63);}(_0xaa36,0x11f));var _0x6aa3=function(_0x347934,_0x5d9597){_0x347934=_0x347934-0x0;var _0x135906=_0xaa36[_0x347934];return _0x135906;};'use strict';var _=require(_0x6aa3('0x0'));var util=require(_0x6aa3('0x1'));var logger=require('../../config/logger')(_0x6aa3('0x2'));var moment=require(_0x6aa3('0x3'));var BPromise=require('bluebird');var rp=require(_0x6aa3('0x4'));var fs=require('fs');var path=require(_0x6aa3('0x5'));var rimraf=require(_0x6aa3('0x6'));var config=require(_0x6aa3('0x7'));var attributes=require(_0x6aa3('0x8'));module['exports']=function(_0x205f48,_0x198f47){return _0x205f48[_0x6aa3('0x9')](_0x6aa3('0xa'),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 1c903d1..e804d76 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 _0x98ff=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes','limit','include','map','model','ShowTrunk','find'];(function(_0xf4ef41,_0x1fb60b){var _0x284a3f=function(_0x5b8a46){while(--_0x5b8a46){_0xf4ef41['push'](_0xf4ef41['shift']());}};_0x284a3f(++_0x1fb60b);}(_0x98ff,0x1b0));var _0xf98f=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x98ff[_0x28947d];return _0x12d2ee;};'use strict';var _=require(_0xf98f('0x0'));var util=require(_0xf98f('0x1'));var moment=require('moment');var BPromise=require(_0xf98f('0x2'));var rs=require(_0xf98f('0x3'));var fs=require('fs');var Redis=require(_0xf98f('0x4'));var db=require(_0xf98f('0x5'))['db'];var utils=require(_0xf98f('0x6'));var logger=require(_0xf98f('0x7'))(_0xf98f('0x8'));var config=require(_0xf98f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf98f('0xa')][_0xf98f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52ae89,_0x26d096,_0xca01ad){return new BPromise(function(_0x10d3ea,_0x37bb3f){return client[_0xf98f('0xc')](_0x52ae89,_0xca01ad)[_0xf98f('0xd')](function(_0x498200){logger[_0xf98f('0xe')](_0xf98f('0xf'),_0x26d096,_0xf98f('0x10'));logger[_0xf98f('0x11')](_0xf98f('0x12'),_0x26d096,_0xf98f('0x10'),JSON[_0xf98f('0x13')](_0x498200));if(_0x498200[_0xf98f('0x14')]){if(_0x498200[_0xf98f('0x14')]['code']===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x26d096,_0x498200[_0xf98f('0x14')][_0xf98f('0x15')]);return _0x37bb3f(_0x498200[_0xf98f('0x14')][_0xf98f('0x15')]);}logger[_0xf98f('0x14')](_0xf98f('0xf'),_0x26d096,_0x498200[_0xf98f('0x14')][_0xf98f('0x15')]);return _0x10d3ea(_0x498200[_0xf98f('0x14')][_0xf98f('0x15')]);}else{logger[_0xf98f('0xe')]('Trunk,\x20%s,\x20%s',_0x26d096,_0xf98f('0x10'));_0x10d3ea(_0x498200['result'][_0xf98f('0x15')]);}})[_0xf98f('0x16')](function(_0x4dbe70){logger[_0xf98f('0x14')]('Trunk,\x20%s,\x20%s',_0x26d096,_0x4dbe70);_0x37bb3f(_0x4dbe70);});});}exports[_0xf98f('0x17')]=function(_0x2557d9){var _0x32d44c=this;return new Promise(function(_0x5411c2,_0x10c799){return db[_0xf98f('0x18')][_0xf98f('0x19')]({'raw':_0x2557d9[_0xf98f('0x1a')]?_0x2557d9['options'][_0xf98f('0x1b')]===undefined?!![]:![]:!![],'where':_0x2557d9[_0xf98f('0x1a')]?_0x2557d9[_0xf98f('0x1a')][_0xf98f('0x1c')]||null:null,'attributes':_0x2557d9[_0xf98f('0x1a')]?_0x2557d9[_0xf98f('0x1a')][_0xf98f('0x1d')]||null:null,'limit':_0x2557d9[_0xf98f('0x1a')]?_0x2557d9[_0xf98f('0x1a')][_0xf98f('0x1e')]||null:null,'include':_0x2557d9['options']?_0x2557d9[_0xf98f('0x1a')][_0xf98f('0x1f')]?_[_0xf98f('0x20')](_0x2557d9[_0xf98f('0x1a')][_0xf98f('0x1f')],function(_0x2d5ceb){return{'model':db[_0x2d5ceb[_0xf98f('0x21')]],'as':_0x2d5ceb['as'],'attributes':_0x2d5ceb['attributes'],'include':_0x2d5ceb[_0xf98f('0x1f')]?_[_0xf98f('0x20')](_0x2d5ceb['include'],function(_0x159ea9){return{'model':db[_0x159ea9['model']],'as':_0x159ea9['as'],'attributes':_0x159ea9[_0xf98f('0x1d')],'include':_0x159ea9[_0xf98f('0x1f')]?_[_0xf98f('0x20')](_0x159ea9[_0xf98f('0x1f')],function(_0x2b16ac){return{'model':db[_0x2b16ac['model']],'as':_0x2b16ac['as'],'attributes':_0x2b16ac[_0xf98f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf98f('0xd')](function(_0x311e85){logger[_0xf98f('0xe')]('GetTrunk',_0x2557d9);logger[_0xf98f('0x11')](_0xf98f('0x17'),_0x2557d9,JSON[_0xf98f('0x13')](_0x311e85));_0x5411c2(_0x311e85);})[_0xf98f('0x16')](function(_0xbaffd0){logger[_0xf98f('0x14')]('GetTrunk',_0xbaffd0[_0xf98f('0x15')],_0x2557d9);_0x10c799(_0x32d44c[_0xf98f('0x14')](0x1f4,_0xbaffd0[_0xf98f('0x15')]));});});};exports[_0xf98f('0x22')]=function(_0x49d4e1){var _0x1bcac3=this;return new Promise(function(_0x68a11d,_0x26bb78){return db['Trunk'][_0xf98f('0x23')]({'raw':_0x49d4e1[_0xf98f('0x1a')]?_0x49d4e1['options'][_0xf98f('0x1b')]===undefined?!![]:![]:!![],'where':_0x49d4e1[_0xf98f('0x1a')]?_0x49d4e1[_0xf98f('0x1a')][_0xf98f('0x1c')]||null:null,'attributes':_0x49d4e1['options']?_0x49d4e1['options']['attributes']||null:null,'include':_0x49d4e1['options']?_0x49d4e1[_0xf98f('0x1a')][_0xf98f('0x1f')]?_[_0xf98f('0x20')](_0x49d4e1[_0xf98f('0x1a')]['include'],function(_0x45eb6c){return{'model':db[_0x45eb6c['model']],'as':_0x45eb6c['as'],'attributes':_0x45eb6c['attributes'],'include':_0x45eb6c[_0xf98f('0x1f')]?_[_0xf98f('0x20')](_0x45eb6c[_0xf98f('0x1f')],function(_0x1bfffc){return{'model':db[_0x1bfffc['model']],'as':_0x1bfffc['as'],'attributes':_0x1bfffc[_0xf98f('0x1d')],'include':_0x1bfffc[_0xf98f('0x1f')]?_[_0xf98f('0x20')](_0x1bfffc[_0xf98f('0x1f')],function(_0x5fec9f){return{'model':db[_0x5fec9f[_0xf98f('0x21')]],'as':_0x5fec9f['as'],'attributes':_0x5fec9f['attributes']};}):[]};}):[]};}):[]:[]})[_0xf98f('0xd')](function(_0x27f834){logger[_0xf98f('0xe')](_0xf98f('0x22'),_0x49d4e1);logger[_0xf98f('0x11')](_0xf98f('0x22'),_0x49d4e1,JSON[_0xf98f('0x13')](_0x27f834));_0x68a11d(_0x27f834);})[_0xf98f('0x16')](function(_0x332154){logger[_0xf98f('0x14')]('ShowTrunk',_0x332154[_0xf98f('0x15')],_0x49d4e1);_0x26bb78(_0x1bcac3[_0xf98f('0x14')](0x1f4,_0x332154['message']));});});}; \ No newline at end of file +var _0x4861=['error','code','message','result','catch','GetTrunk','Trunk','findAll','options','raw','attributes','limit','include','map','model','ShowTrunk','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4861,0xb0));var _0x1486=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x4861[_0x4fde08];return _0x12e725;};'use strict';var _=require(_0x1486('0x0'));var util=require(_0x1486('0x1'));var moment=require('moment');var BPromise=require(_0x1486('0x2'));var rs=require(_0x1486('0x3'));var fs=require('fs');var Redis=require(_0x1486('0x4'));var db=require(_0x1486('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1486('0x6'))(_0x1486('0x7'));var config=require(_0x1486('0x8'));var jayson=require(_0x1486('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x17ea62,_0x30d89d,_0x5be00f){return new BPromise(function(_0x5dbd3e,_0x2d30d8){return client['request'](_0x17ea62,_0x5be00f)[_0x1486('0xa')](function(_0x289838){logger[_0x1486('0xb')](_0x1486('0xc'),_0x30d89d,_0x1486('0xd'));logger['debug'](_0x1486('0xe'),_0x30d89d,_0x1486('0xd'),JSON[_0x1486('0xf')](_0x289838));if(_0x289838[_0x1486('0x10')]){if(_0x289838[_0x1486('0x10')][_0x1486('0x11')]===0x1f4){logger['error'](_0x1486('0xc'),_0x30d89d,_0x289838['error'][_0x1486('0x12')]);return _0x2d30d8(_0x289838[_0x1486('0x10')]['message']);}logger[_0x1486('0x10')](_0x1486('0xc'),_0x30d89d,_0x289838[_0x1486('0x10')][_0x1486('0x12')]);return _0x5dbd3e(_0x289838[_0x1486('0x10')][_0x1486('0x12')]);}else{logger[_0x1486('0xb')](_0x1486('0xc'),_0x30d89d,_0x1486('0xd'));_0x5dbd3e(_0x289838[_0x1486('0x13')]['message']);}})[_0x1486('0x14')](function(_0xe18543){logger[_0x1486('0x10')](_0x1486('0xc'),_0x30d89d,_0xe18543);_0x2d30d8(_0xe18543);});});}exports[_0x1486('0x15')]=function(_0x57c201){var _0x471c4a=this;return new Promise(function(_0x2a65c3,_0x5a1342){return db[_0x1486('0x16')][_0x1486('0x17')]({'raw':_0x57c201[_0x1486('0x18')]?_0x57c201['options'][_0x1486('0x19')]===undefined?!![]:![]:!![],'where':_0x57c201[_0x1486('0x18')]?_0x57c201[_0x1486('0x18')]['where']||null:null,'attributes':_0x57c201['options']?_0x57c201[_0x1486('0x18')][_0x1486('0x1a')]||null:null,'limit':_0x57c201[_0x1486('0x18')]?_0x57c201[_0x1486('0x18')][_0x1486('0x1b')]||null:null,'include':_0x57c201[_0x1486('0x18')]?_0x57c201[_0x1486('0x18')][_0x1486('0x1c')]?_[_0x1486('0x1d')](_0x57c201[_0x1486('0x18')][_0x1486('0x1c')],function(_0xb3ecc9){return{'model':db[_0xb3ecc9[_0x1486('0x1e')]],'as':_0xb3ecc9['as'],'attributes':_0xb3ecc9['attributes'],'include':_0xb3ecc9[_0x1486('0x1c')]?_[_0x1486('0x1d')](_0xb3ecc9['include'],function(_0x3bab5d){return{'model':db[_0x3bab5d[_0x1486('0x1e')]],'as':_0x3bab5d['as'],'attributes':_0x3bab5d['attributes'],'include':_0x3bab5d[_0x1486('0x1c')]?_['map'](_0x3bab5d[_0x1486('0x1c')],function(_0x534a5c){return{'model':db[_0x534a5c[_0x1486('0x1e')]],'as':_0x534a5c['as'],'attributes':_0x534a5c[_0x1486('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1486('0xa')](function(_0x2201ee){logger[_0x1486('0xb')](_0x1486('0x15'),_0x57c201);logger['debug'](_0x1486('0x15'),_0x57c201,JSON[_0x1486('0xf')](_0x2201ee));_0x2a65c3(_0x2201ee);})['catch'](function(_0x3fb1f5){logger[_0x1486('0x10')](_0x1486('0x15'),_0x3fb1f5[_0x1486('0x12')],_0x57c201);_0x5a1342(_0x471c4a[_0x1486('0x10')](0x1f4,_0x3fb1f5[_0x1486('0x12')]));});});};exports[_0x1486('0x1f')]=function(_0x40a7c7){var _0x734412=this;return new Promise(function(_0x426dea,_0x3e9b23){return db['Trunk']['find']({'raw':_0x40a7c7[_0x1486('0x18')]?_0x40a7c7[_0x1486('0x18')][_0x1486('0x19')]===undefined?!![]:![]:!![],'where':_0x40a7c7[_0x1486('0x18')]?_0x40a7c7[_0x1486('0x18')]['where']||null:null,'attributes':_0x40a7c7[_0x1486('0x18')]?_0x40a7c7['options'][_0x1486('0x1a')]||null:null,'include':_0x40a7c7['options']?_0x40a7c7['options']['include']?_[_0x1486('0x1d')](_0x40a7c7[_0x1486('0x18')][_0x1486('0x1c')],function(_0x2c97ae){return{'model':db[_0x2c97ae[_0x1486('0x1e')]],'as':_0x2c97ae['as'],'attributes':_0x2c97ae[_0x1486('0x1a')],'include':_0x2c97ae['include']?_[_0x1486('0x1d')](_0x2c97ae[_0x1486('0x1c')],function(_0x134fd7){return{'model':db[_0x134fd7[_0x1486('0x1e')]],'as':_0x134fd7['as'],'attributes':_0x134fd7[_0x1486('0x1a')],'include':_0x134fd7[_0x1486('0x1c')]?_[_0x1486('0x1d')](_0x134fd7[_0x1486('0x1c')],function(_0x2a59aa){return{'model':db[_0x2a59aa[_0x1486('0x1e')]],'as':_0x2a59aa['as'],'attributes':_0x2a59aa[_0x1486('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x212081){logger['info'](_0x1486('0x1f'),_0x40a7c7);logger['debug'](_0x1486('0x1f'),_0x40a7c7,JSON['stringify'](_0x212081));_0x426dea(_0x212081);})['catch'](function(_0x459481){logger[_0x1486('0x10')](_0x1486('0x1f'),_0x459481[_0x1486('0x12')],_0x40a7c7);_0x3e9b23(_0x734412[_0x1486('0x10')](0x1f4,_0x459481[_0x1486('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 2a97782..49cce70 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 _0x6594=['removeOpenchannelAccounts','removeChatWebsites','/:id/whatsapp_accounts','removeApiKey','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','/describe','describe','/whoami','whoami','/presence','getPresence','/:id','/:id/avatar','getAvatar','getOpenTabs','/:id/contacts','getQueues','getVoiceQueuesRt','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','/:id/openchannel/interactions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','getLists','/:id/agents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/chat_websites','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','addContacts','post','create','bulkCreate','/:id/queues','addQueues','diskStorage','root','format','%s-%s','now','single','file','addAvatar','/:id/login','login','/:id/logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addFaxAccounts','addMailAccounts','/:id/sms_accounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','update','changePassword','delete','removeQueues','/:id/mail_interactions','removeMailInteractions','removeFaxInteractions','/:id/sms_interactions','removeSmsInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts'];(function(_0x4ef83e,_0x3ef6e3){var _0x15f946=function(_0x36a31f){while(--_0x36a31f){_0x4ef83e['push'](_0x4ef83e['shift']());}};_0x15f946(++_0x3ef6e3);}(_0x6594,0x152));var _0x4659=function(_0x4ff685,_0x282dce){_0x4ff685=_0x4ff685-0x0;var _0x10522f=_0x6594[_0x4ff685];return _0x10522f;};'use strict';var multer=require(_0x4659('0x0'));var util=require(_0x4659('0x1'));var path=require(_0x4659('0x2'));var timeout=require(_0x4659('0x3'));var express=require(_0x4659('0x4'));var router=express['Router']();var fs_extra=require(_0x4659('0x5'));var auth=require(_0x4659('0x6'));var interaction=require(_0x4659('0x7'));var config=require(_0x4659('0x8'));var controller=require(_0x4659('0x9'));router[_0x4659('0xa')]('/',auth[_0x4659('0xb')](),controller['index']);router['get'](_0x4659('0xc'),auth[_0x4659('0xb')](),controller[_0x4659('0xd')]);router[_0x4659('0xa')](_0x4659('0xe'),auth['isAuthenticated'](),controller[_0x4659('0xf')]);router['get'](_0x4659('0x10'),auth[_0x4659('0xb')](),controller[_0x4659('0x11')]);router[_0x4659('0xa')](_0x4659('0x12'),auth[_0x4659('0xb')](),controller['show']);router[_0x4659('0xa')](_0x4659('0x13'),controller[_0x4659('0x14')]);router[_0x4659('0xa')]('/:id/open_tabs',auth[_0x4659('0xb')](),controller[_0x4659('0x15')]);router[_0x4659('0xa')](_0x4659('0x16'),auth['isAuthenticated'](),controller['getContacts']);router[_0x4659('0xa')]('/:id/queues',auth['isAuthenticated'](),controller[_0x4659('0x17')]);router[_0x4659('0xa')]('/:id/queues_rt',auth[_0x4659('0xb')](),controller[_0x4659('0x18')]);router[_0x4659('0xa')]('/:id/groups',auth[_0x4659('0xb')](),controller['getGroups']);router[_0x4659('0xa')](_0x4659('0x19'),auth[_0x4659('0xb')](),controller[_0x4659('0x1a')]);router[_0x4659('0xa')](_0x4659('0x1b'),auth[_0x4659('0xb')](),controller[_0x4659('0x1c')]);router[_0x4659('0xa')](_0x4659('0x1d'),auth[_0x4659('0xb')](),controller['getChatInteractions']);router[_0x4659('0xa')](_0x4659('0x1e'),auth[_0x4659('0xb')](),controller['getOpenchannelInteractions']);router['get'](_0x4659('0x1f'),auth[_0x4659('0xb')](),controller[_0x4659('0x20')]);router[_0x4659('0xa')]('/:id/sms/interactions',auth['isAuthenticated'](),controller[_0x4659('0x21')]);router[_0x4659('0xa')]('/:id/fax/interactions',auth['isAuthenticated'](),controller['getFaxInteractions']);router[_0x4659('0xa')](_0x4659('0x22'),auth[_0x4659('0xb')](),controller[_0x4659('0x23')]);router[_0x4659('0xa')](_0x4659('0x24'),auth['isAuthenticated'](),controller[_0x4659('0x25')]);router['get']('/:id/lists',auth[_0x4659('0xb')](),controller[_0x4659('0x26')]);router[_0x4659('0xa')](_0x4659('0x27'),auth[_0x4659('0xb')](),controller['getAgents']);router[_0x4659('0xa')](_0x4659('0x28'),auth[_0x4659('0xb')](),controller[_0x4659('0x29')]);router[_0x4659('0xa')](_0x4659('0x2a'),auth['isAuthenticated'](),controller[_0x4659('0x2b')]);router[_0x4659('0xa')](_0x4659('0x2c'),auth[_0x4659('0xb')](),controller[_0x4659('0x2d')]);router[_0x4659('0xa')](_0x4659('0x2e'),auth[_0x4659('0xb')](),controller[_0x4659('0x2f')]);router['get']('/:id/sms_accounts',auth[_0x4659('0xb')](),controller['getSmsAccounts']);router[_0x4659('0xa')](_0x4659('0x30'),auth['isAuthenticated'](),controller['getChatWebsites']);router[_0x4659('0xa')]('/:id/whatsapp_accounts',auth[_0x4659('0xb')](),controller[_0x4659('0x31')]);router[_0x4659('0xa')](_0x4659('0x32'),auth[_0x4659('0xb')](),controller[_0x4659('0x33')]);router['get'](_0x4659('0x34'),auth['isAuthenticated'](),controller[_0x4659('0x35')]);router['get'](_0x4659('0x36'),auth[_0x4659('0xb')](),controller[_0x4659('0x37')]);router['post'](_0x4659('0x16'),auth[_0x4659('0xb')](),controller[_0x4659('0x38')]);router[_0x4659('0x39')]('/',auth[_0x4659('0xb')](),controller[_0x4659('0x3a')]);router[_0x4659('0x39')]('/create_many',auth[_0x4659('0xb')](),controller[_0x4659('0x3b')]);router['post'](_0x4659('0x3c'),auth[_0x4659('0xb')](),controller[_0x4659('0x3d')]);var upload=multer({'storage':multer[_0x4659('0x3e')]({'destination':function(_0x531b07,_0x25e89d,_0x7fba00){_0x7fba00(null,path['join'](config[_0x4659('0x3f')],'server/files/images/'));},'filename':function(_0x5c6a4a,_0x44f862,_0x337e92){_0x337e92(null,util[_0x4659('0x40')](_0x4659('0x41'),Date[_0x4659('0x42')](),_0x44f862['originalname']));}})});router[_0x4659('0x39')](_0x4659('0x13'),upload[_0x4659('0x43')](_0x4659('0x44')),controller[_0x4659('0x45')]);router[_0x4659('0x39')](_0x4659('0x46'),auth['isAuthenticated'](),controller[_0x4659('0x47')]);router[_0x4659('0x39')](_0x4659('0x48'),auth[_0x4659('0xb')](),controller['logout']);router['post'](_0x4659('0x49'),auth[_0x4659('0xb')](),controller[_0x4659('0x4a')]);router['post'](_0x4659('0x4b'),auth[_0x4659('0xb')](),controller[_0x4659('0x4c')]);router[_0x4659('0x39')](_0x4659('0x24'),auth[_0x4659('0xb')](),controller[_0x4659('0x4d')]);router['post'](_0x4659('0x4e'),auth[_0x4659('0xb')](),controller['addChatInteractions']);router[_0x4659('0x39')]('/:id/mail_interactions',auth[_0x4659('0xb')](),controller[_0x4659('0x4f')]);router[_0x4659('0x39')](_0x4659('0x50'),auth['isAuthenticated'](),controller[_0x4659('0x51')]);router['post']('/:id/sms_interactions',auth[_0x4659('0xb')](),controller[_0x4659('0x52')]);router[_0x4659('0x39')](_0x4659('0x53'),auth[_0x4659('0xb')](),controller[_0x4659('0x54')]);router[_0x4659('0x39')]('/:id/whatsapp_interactions',auth[_0x4659('0xb')](),controller['addWhatsappInteractions']);router['post'](_0x4659('0x2a'),auth[_0x4659('0xb')](),controller[_0x4659('0x55')]);router[_0x4659('0x39')](_0x4659('0x2c'),auth[_0x4659('0xb')](),controller[_0x4659('0x56')]);router['post']('/:id/openchannel_accounts',auth[_0x4659('0xb')](),controller['addOpenchannelAccounts']);router[_0x4659('0x39')](_0x4659('0x57'),auth['isAuthenticated'](),controller[_0x4659('0x58')]);router[_0x4659('0x39')](_0x4659('0x30'),auth['isAuthenticated'](),controller[_0x4659('0x59')]);router[_0x4659('0x39')]('/:id/whatsapp_accounts',auth[_0x4659('0xb')](),controller[_0x4659('0x5a')]);router['post'](_0x4659('0x32'),auth['isAuthenticated'](),controller[_0x4659('0x5b')]);router[_0x4659('0x39')](_0x4659('0x36'),auth[_0x4659('0xb')](),controller['createApiKey']);router['put'](_0x4659('0x12'),auth['isAuthenticated'](),controller[_0x4659('0x5c')]);router['put']('/:id/password',auth['isAuthenticated'](),controller[_0x4659('0x5d')]);router[_0x4659('0x5e')]('/:id/queues',auth[_0x4659('0xb')](),controller[_0x4659('0x5f')]);router[_0x4659('0x5e')]('/:id/teams',auth[_0x4659('0xb')](),controller['removeTeams']);router[_0x4659('0x5e')]('/:id',auth[_0x4659('0xb')](),controller['destroy']);router[_0x4659('0x5e')]('/:id/chat_interactions',auth[_0x4659('0xb')](),controller['removeChatInteractions']);router[_0x4659('0x5e')](_0x4659('0x60'),auth[_0x4659('0xb')](),controller[_0x4659('0x61')]);router[_0x4659('0x5e')](_0x4659('0x50'),auth[_0x4659('0xb')](),controller[_0x4659('0x62')]);router[_0x4659('0x5e')](_0x4659('0x63'),auth[_0x4659('0xb')](),controller[_0x4659('0x64')]);router[_0x4659('0x5e')](_0x4659('0x53'),auth[_0x4659('0xb')](),controller[_0x4659('0x65')]);router[_0x4659('0x5e')](_0x4659('0x66'),auth[_0x4659('0xb')](),controller[_0x4659('0x67')]);router[_0x4659('0x5e')]('/:id/fax_accounts',auth[_0x4659('0xb')](),controller[_0x4659('0x68')]);router[_0x4659('0x5e')](_0x4659('0x2c'),auth[_0x4659('0xb')](),controller[_0x4659('0x69')]);router[_0x4659('0x5e')](_0x4659('0x2e'),auth[_0x4659('0xb')](),controller[_0x4659('0x6a')]);router[_0x4659('0x5e')]('/:id/sms_accounts',auth[_0x4659('0xb')](),controller['removeSmsAccounts']);router[_0x4659('0x5e')](_0x4659('0x30'),auth[_0x4659('0xb')](),controller[_0x4659('0x6b')]);router[_0x4659('0x5e')](_0x4659('0x6c'),auth[_0x4659('0xb')](),controller['removeWhatsappAccounts']);router[_0x4659('0x5e')](_0x4659('0x32'),auth[_0x4659('0xb')](),controller['removeSquareProjects']);router['delete'](_0x4659('0x36'),auth[_0x4659('0xb')](),controller[_0x4659('0x6d')]);module[_0x4659('0x6e')]=router; \ No newline at end of file +var _0x3388=['getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','/:id/recordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','getScheduledCalls','getApiKey','addContacts','post','bulkCreate','addQueues','diskStorage','root','server/files/images/','format','%s-%s','now','originalname','single','file','addAvatar','login','/:id/logout','pause','/:id/unpause','unpause','/:id/teams','/:id/chat_interactions','addChatInteractions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','/:id/openchannel_interactions','addWhatsappInteractions','addMailAccounts','addOpenchannelAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','/:id/api_key','put','/:id/password','changePassword','delete','removeTeams','destroy','removeChatInteractions','/:id/mail_interactions','removeMailInteractions','removeFaxInteractions','/:id/sms_interactions','removeSmsInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./user.controller','get','/describe','isAuthenticated','describe','/whoami','whoami','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x3388,0xd3));var _0x8338=function(_0x351f7f,_0x1b5042){_0x351f7f=_0x351f7f-0x0;var _0x309b0c=_0x3388[_0x351f7f];return _0x309b0c;};'use strict';var multer=require('multer');var util=require(_0x8338('0x0'));var path=require(_0x8338('0x1'));var timeout=require(_0x8338('0x2'));var express=require('express');var router=express[_0x8338('0x3')]();var fs_extra=require(_0x8338('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8338('0x5'));var config=require('../../config/environment');var controller=require(_0x8338('0x6'));router[_0x8338('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8338('0x7')](_0x8338('0x8'),auth[_0x8338('0x9')](),controller[_0x8338('0xa')]);router[_0x8338('0x7')](_0x8338('0xb'),auth['isAuthenticated'](),controller[_0x8338('0xc')]);router[_0x8338('0x7')]('/presence',auth[_0x8338('0x9')](),controller[_0x8338('0xd')]);router[_0x8338('0x7')](_0x8338('0xe'),auth[_0x8338('0x9')](),controller[_0x8338('0xf')]);router[_0x8338('0x7')](_0x8338('0x10'),controller[_0x8338('0x11')]);router[_0x8338('0x7')](_0x8338('0x12'),auth[_0x8338('0x9')](),controller[_0x8338('0x13')]);router['get'](_0x8338('0x14'),auth[_0x8338('0x9')](),controller[_0x8338('0x15')]);router[_0x8338('0x7')](_0x8338('0x16'),auth[_0x8338('0x9')](),controller[_0x8338('0x17')]);router['get'](_0x8338('0x18'),auth['isAuthenticated'](),controller[_0x8338('0x19')]);router['get'](_0x8338('0x1a'),auth[_0x8338('0x9')](),controller['getGroups']);router['get'](_0x8338('0x1b'),auth[_0x8338('0x9')](),controller['getRecordings']);router[_0x8338('0x7')](_0x8338('0x1c'),auth[_0x8338('0x9')](),controller[_0x8338('0x1d')]);router[_0x8338('0x7')](_0x8338('0x1e'),auth[_0x8338('0x9')](),controller[_0x8338('0x1f')]);router['get'](_0x8338('0x20'),auth[_0x8338('0x9')](),controller[_0x8338('0x21')]);router[_0x8338('0x7')](_0x8338('0x22'),auth[_0x8338('0x9')](),controller[_0x8338('0x23')]);router[_0x8338('0x7')]('/:id/sms/interactions',auth['isAuthenticated'](),controller[_0x8338('0x24')]);router['get']('/:id/fax/interactions',auth[_0x8338('0x9')](),controller['getFaxInteractions']);router['get'](_0x8338('0x25'),auth[_0x8338('0x9')](),controller[_0x8338('0x26')]);router[_0x8338('0x7')]('/:id/teams',auth[_0x8338('0x9')](),controller[_0x8338('0x27')]);router[_0x8338('0x7')](_0x8338('0x28'),auth[_0x8338('0x9')](),controller[_0x8338('0x29')]);router[_0x8338('0x7')](_0x8338('0x2a'),auth[_0x8338('0x9')](),controller[_0x8338('0x2b')]);router[_0x8338('0x7')](_0x8338('0x2c'),auth[_0x8338('0x9')](),controller[_0x8338('0x2d')]);router[_0x8338('0x7')](_0x8338('0x2e'),auth[_0x8338('0x9')](),controller['getFaxAccounts']);router[_0x8338('0x7')](_0x8338('0x2f'),auth[_0x8338('0x9')](),controller[_0x8338('0x30')]);router['get'](_0x8338('0x31'),auth['isAuthenticated'](),controller[_0x8338('0x32')]);router[_0x8338('0x7')](_0x8338('0x33'),auth[_0x8338('0x9')](),controller[_0x8338('0x34')]);router['get'](_0x8338('0x35'),auth['isAuthenticated'](),controller[_0x8338('0x36')]);router['get'](_0x8338('0x37'),auth['isAuthenticated'](),controller[_0x8338('0x38')]);router[_0x8338('0x7')](_0x8338('0x39'),auth[_0x8338('0x9')](),controller[_0x8338('0x3a')]);router[_0x8338('0x7')]('/:id/scheduled_calls',auth['isAuthenticated'](),controller[_0x8338('0x3b')]);router['get']('/:id/api_key',auth[_0x8338('0x9')](),controller[_0x8338('0x3c')]);router['post'](_0x8338('0x14'),auth['isAuthenticated'](),controller[_0x8338('0x3d')]);router[_0x8338('0x3e')]('/',auth[_0x8338('0x9')](),controller['create']);router[_0x8338('0x3e')]('/create_many',auth[_0x8338('0x9')](),controller[_0x8338('0x3f')]);router[_0x8338('0x3e')](_0x8338('0x16'),auth['isAuthenticated'](),controller[_0x8338('0x40')]);var upload=multer({'storage':multer[_0x8338('0x41')]({'destination':function(_0x4546a4,_0x391c5f,_0x2f0d3b){_0x2f0d3b(null,path['join'](config[_0x8338('0x42')],_0x8338('0x43')));},'filename':function(_0x438a3d,_0xebf7e6,_0x59a255){_0x59a255(null,util[_0x8338('0x44')](_0x8338('0x45'),Date[_0x8338('0x46')](),_0xebf7e6[_0x8338('0x47')]));}})});router[_0x8338('0x3e')](_0x8338('0x10'),upload[_0x8338('0x48')](_0x8338('0x49')),controller[_0x8338('0x4a')]);router[_0x8338('0x3e')]('/:id/login',auth[_0x8338('0x9')](),controller[_0x8338('0x4b')]);router['post'](_0x8338('0x4c'),auth['isAuthenticated'](),controller['logout']);router['post']('/:id/pause',auth[_0x8338('0x9')](),controller[_0x8338('0x4d')]);router[_0x8338('0x3e')](_0x8338('0x4e'),auth[_0x8338('0x9')](),controller[_0x8338('0x4f')]);router[_0x8338('0x3e')](_0x8338('0x50'),auth['isAuthenticated'](),controller['addTeams']);router[_0x8338('0x3e')](_0x8338('0x51'),auth[_0x8338('0x9')](),controller[_0x8338('0x52')]);router[_0x8338('0x3e')]('/:id/mail_interactions',auth[_0x8338('0x9')](),controller[_0x8338('0x53')]);router[_0x8338('0x3e')](_0x8338('0x54'),auth[_0x8338('0x9')](),controller[_0x8338('0x55')]);router[_0x8338('0x3e')]('/:id/sms_interactions',auth[_0x8338('0x9')](),controller[_0x8338('0x56')]);router[_0x8338('0x3e')](_0x8338('0x57'),auth['isAuthenticated'](),controller['addOpenchannelInteractions']);router[_0x8338('0x3e')]('/:id/whatsapp_interactions',auth[_0x8338('0x9')](),controller[_0x8338('0x58')]);router['post'](_0x8338('0x2e'),auth[_0x8338('0x9')](),controller['addFaxAccounts']);router[_0x8338('0x3e')](_0x8338('0x2f'),auth[_0x8338('0x9')](),controller[_0x8338('0x59')]);router[_0x8338('0x3e')](_0x8338('0x31'),auth[_0x8338('0x9')](),controller[_0x8338('0x5a')]);router[_0x8338('0x3e')](_0x8338('0x33'),auth['isAuthenticated'](),controller['addSmsAccounts']);router[_0x8338('0x3e')](_0x8338('0x35'),auth[_0x8338('0x9')](),controller[_0x8338('0x5b')]);router[_0x8338('0x3e')](_0x8338('0x37'),auth[_0x8338('0x9')](),controller[_0x8338('0x5c')]);router['post'](_0x8338('0x39'),auth['isAuthenticated'](),controller[_0x8338('0x5d')]);router['post'](_0x8338('0x5e'),auth[_0x8338('0x9')](),controller['createApiKey']);router[_0x8338('0x5f')]('/:id',auth[_0x8338('0x9')](),controller['update']);router[_0x8338('0x5f')](_0x8338('0x60'),auth[_0x8338('0x9')](),controller[_0x8338('0x61')]);router['delete']('/:id/queues',auth[_0x8338('0x9')](),controller['removeQueues']);router[_0x8338('0x62')](_0x8338('0x50'),auth[_0x8338('0x9')](),controller[_0x8338('0x63')]);router[_0x8338('0x62')]('/:id',auth[_0x8338('0x9')](),controller[_0x8338('0x64')]);router[_0x8338('0x62')](_0x8338('0x51'),auth[_0x8338('0x9')](),controller[_0x8338('0x65')]);router['delete'](_0x8338('0x66'),auth['isAuthenticated'](),controller[_0x8338('0x67')]);router[_0x8338('0x62')](_0x8338('0x54'),auth[_0x8338('0x9')](),controller[_0x8338('0x68')]);router[_0x8338('0x62')](_0x8338('0x69'),auth[_0x8338('0x9')](),controller[_0x8338('0x6a')]);router['delete'](_0x8338('0x57'),auth[_0x8338('0x9')](),controller['removeOpenchannelInteractions']);router[_0x8338('0x62')](_0x8338('0x6b'),auth[_0x8338('0x9')](),controller[_0x8338('0x6c')]);router[_0x8338('0x62')]('/:id/fax_accounts',auth[_0x8338('0x9')](),controller[_0x8338('0x6d')]);router[_0x8338('0x62')](_0x8338('0x2f'),auth[_0x8338('0x9')](),controller[_0x8338('0x6e')]);router['delete'](_0x8338('0x31'),auth[_0x8338('0x9')](),controller[_0x8338('0x6f')]);router['delete'](_0x8338('0x33'),auth[_0x8338('0x9')](),controller['removeSmsAccounts']);router[_0x8338('0x62')](_0x8338('0x35'),auth[_0x8338('0x9')](),controller[_0x8338('0x70')]);router['delete']('/:id/whatsapp_accounts',auth[_0x8338('0x9')](),controller[_0x8338('0x71')]);router[_0x8338('0x62')](_0x8338('0x39'),auth['isAuthenticated'](),controller['removeSquareProjects']);router[_0x8338('0x62')](_0x8338('0x5e'),auth[_0x8338('0x9')](),controller[_0x8338('0x72')]);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 9176d28..a320465 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 _0x0c75=['dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','avpf','dtlsenable','/etc/pki/tls/certs/motion.crt','permissions','map','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blockedAt','loginAttempts','UNSIGNED','moment','lodash','exports','STRING','name','setDataValue','defaultuser','fullname','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','agent','telephone','local','accountcode','callerid','BOOLEAN','DATE','INTEGER','dynamic','friend','user','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','yes','nonat','update','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','\x22\x22\x20<>','always','accept','refuse','uac','uas','fingerprint','certificate','active','passive','actpass','TEXT','get','isArray','wss','udp','encryption','force_avp','icesupport'];(function(_0x4ea29a,_0x72e00c){var _0x53fc91=function(_0x524d48){while(--_0x524d48){_0x4ea29a['push'](_0x4ea29a['shift']());}};_0x53fc91(++_0x72e00c);}(_0x0c75,0x6a));var _0x50c7=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0c75[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x50c7('0x0'));var util=require('util');var _=require(_0x50c7('0x1'));module[_0x50c7('0x2')]={'name':{'type':Sequelize[_0x50c7('0x3')],'allowNull':![],'unique':_0x50c7('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x41ebd8){this[_0x50c7('0x5')](_0x50c7('0x4'),_0x41ebd8);this['setDataValue'](_0x50c7('0x6'),_0x41ebd8);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x50c7('0x3')],'allowNull':![],'set':function(_0x594830){this[_0x50c7('0x5')](_0x50c7('0x7'),_0x594830);this[_0x50c7('0x5')]('callerid',util['format'](_0x50c7('0x8'),_0x594830,this[_0x50c7('0x9')](_0x50c7('0xa'))));}},'alias':{'type':Sequelize[_0x50c7('0x3')]},'email':{'type':Sequelize[_0x50c7('0x3')],'allowNull':![],'unique':_0x50c7('0xb'),'validate':{'isEmail':!![]},'set':function(_0x1bc1d3){if(_0x1bc1d3){this['setDataValue']('email',_0x1bc1d3[_0x50c7('0xc')]());}}},'role':{'type':Sequelize[_0x50c7('0xd')](_0x50c7('0xe'),'user',_0x50c7('0xf'),_0x50c7('0x10')),'allowNull':![]},'password':{'type':Sequelize[_0x50c7('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x50c7('0x3')],'defaultValue':_0x50c7('0x11')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':'internal','set':function(_0x2d27dc){this[_0x50c7('0x5')]('internal',_0x2d27dc);this[_0x50c7('0x5')](_0x50c7('0x12'),_0x2d27dc);this[_0x50c7('0x5')](_0x50c7('0x13'),util['format'](_0x50c7('0x8'),this[_0x50c7('0x9')](_0x50c7('0x7')),_0x2d27dc));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x50c7('0x3')]},'mobile':{'type':Sequelize[_0x50c7('0x3')]},'address':{'type':Sequelize[_0x50c7('0x3')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x50c7('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x50c7('0x3')]},'online':{'type':Sequelize[_0x50c7('0x14')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x50c7('0x15')]},'voicePause':{'type':Sequelize[_0x50c7('0x14')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x50c7('0x14')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x50c7('0x14')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x50c7('0x14')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x50c7('0x14')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x50c7('0x14')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x50c7('0x3')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x50c7('0x15')]},'chatCapacity':{'type':Sequelize[_0x50c7('0x16')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x50c7('0x16')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x50c7('0x16')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x50c7('0x16')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x50c7('0x14')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x50c7('0x14')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x50c7('0x16')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x50c7('0x16')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x50c7('0x14')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x50c7('0x14')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x50c7('0x14')],'defaultValue':![]},'description':{'type':Sequelize[_0x50c7('0x3')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x50c7('0x17')},'ipaddr':{'type':Sequelize[_0x50c7('0x3')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x50c7('0x16')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x50c7('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x50c7('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x50c7('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x50c7('0xd')](_0x50c7('0x18'),_0x50c7('0x19'),_0x50c7('0x1a')),'allowNull':!![],'defaultValue':_0x50c7('0x18')},'context':{'type':Sequelize[_0x50c7('0x3')],'allowNull':!![],'defaultValue':_0x50c7('0x1b')},'callingpres':{'type':Sequelize['ENUM'](_0x50c7('0x1c'),_0x50c7('0x1d'),_0x50c7('0x1e'),_0x50c7('0x1f'),_0x50c7('0x20'),_0x50c7('0x21'),'PROHIB_FAILED_SCREEN',_0x50c7('0x22')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x50c7('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x50c7('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x50c7('0x3')],'allowNull':!![],'defaultValue':'udp','set':function(_0xa81bc8){this[_0x50c7('0x5')](_0x50c7('0x23'),_0xa81bc8?_0xa81bc8[_0x50c7('0x24')](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0x50c7('0x9')](_0x50c7('0x23'))[_0x50c7('0x25')](','):null;},'comment':_0x50c7('0x26')},'dtmfmode':{'type':Sequelize[_0x50c7('0xd')](_0x50c7('0x27'),_0x50c7('0x28'),_0x50c7('0x29'),_0x50c7('0x2a'),'auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x50c7('0xd')](_0x50c7('0x2b'),'no',_0x50c7('0x2c'),_0x50c7('0x2d'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x50c7('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x50c7('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0x50c7('0x3')],'allowNull':!![],'defaultValue':_0x50c7('0x2e'),'set':function(_0x2c6e3d){this[_0x50c7('0x5')](_0x50c7('0x2f'),_0x2c6e3d?_0x2c6e3d[_0x50c7('0x24')](','):null);},'get':function(){return this['getDataValue'](_0x50c7('0x2f'))?this[_0x50c7('0x9')](_0x50c7('0x2f'))[_0x50c7('0x25')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x50c7('0x3')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x50c7('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x50c7('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x50c7('0x3')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x50c7('0x30')},'allow':{'type':Sequelize[_0x50c7('0x3')],'allowNull':![],'defaultValue':_0x50c7('0x31'),'set':function(_0x36fe9a){this[_0x50c7('0x5')]('allow',_0x36fe9a?_0x36fe9a['join'](';'):_0x50c7('0x31'));},'get':function(){return this[_0x50c7('0x9')](_0x50c7('0x32'))?this['getDataValue'](_0x50c7('0x32'))[_0x50c7('0x25')](';'):null;},'comment':_0x50c7('0x33')},'autoframing':{'type':Sequelize['ENUM'](_0x50c7('0x2b'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x50c7('0x3')],'allowNull':!![],'set':function(_0x460486){this[_0x50c7('0x5')](_0x50c7('0x34'),_0x460486?_0x460486[_0x50c7('0x24')](','):null);},'get':function(){return this['getDataValue'](_0x50c7('0x34'))?this[_0x50c7('0x9')](_0x50c7('0x34'))[_0x50c7('0x25')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x50c7('0xd')](_0x50c7('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x50c7('0xd')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x50c7('0xd')](_0x50c7('0x2b'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x50c7('0xd')](_0x50c7('0x2b'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x50c7('0xd')](_0x50c7('0x2b'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x50c7('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x50c7('0x3')],'allowNull':!![],'defaultValue':_0x50c7('0x35')},'amaflags':{'type':Sequelize[_0x50c7('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x50c7('0xd')](_0x50c7('0x2b'),'no'),'allowNull':!![],'defaultValue':_0x50c7('0x2b')},'busylevel':{'type':Sequelize[_0x50c7('0x16')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x50c7('0xd')](_0x50c7('0x2b'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x50c7('0xd')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x50c7('0x2b'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x50c7('0xd')](_0x50c7('0x2b'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x50c7('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x50c7('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x50c7('0xd')](_0x50c7('0x2b'),'no',_0x50c7('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x50c7('0xd')](_0x50c7('0x2b'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x50c7('0x37'),_0x50c7('0x38'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x50c7('0x16')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x50c7('0x39'),'uas'),'allowNull':!![],'defaultValue':_0x50c7('0x3a')},'t38pt_usertpsource':{'type':Sequelize[_0x50c7('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x50c7('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x50c7('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x50c7('0xd')](_0x50c7('0x2b'),'no'),'allowNull':!![],'defaultValue':_0x50c7('0x2b')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x50c7('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x50c7('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x50c7('0x16')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x50c7('0x16')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x50c7('0xd')](_0x50c7('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x50c7('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x50c7('0x16')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x50c7('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x50c7('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x50c7('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x50c7('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x50c7('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x50c7('0xd')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x50c7('0xd')](_0x50c7('0x2b'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x50c7('0xd')](_0x50c7('0x2b'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x50c7('0xd')](_0x50c7('0x2b'),'no',_0x50c7('0x3b'),_0x50c7('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x50c7('0x16')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x50c7('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x50c7('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x50c7('0xd')](_0x50c7('0x3d'),_0x50c7('0x3e'),_0x50c7('0x3f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x50c7('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x50c7('0xd')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x50c7('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x50c7('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x50c7('0x16')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x50c7('0xd')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x50c7('0xd')](_0x50c7('0x2b'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x50c7('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x50c7('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x50c7('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x50c7('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x50c7('0xd')]('yes','no',_0x50c7('0x2c'),'update','update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x50c7('0x14')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x50c7('0x15')]},'passwordResetAt':{'type':Sequelize[_0x50c7('0x15')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x50c7('0x40')]},'showWebBar':{'type':Sequelize[_0x50c7('0x16')],'defaultValue':0x0,'set':function(_0xde1312){this[_0x50c7('0x5')]('showWebBar',_0xde1312);var _0x9d6596=this[_0x50c7('0x41')]({'plain':!![]});switch(_0xde1312){case 0x0:case 0x1:var _0x1d6972=_0x9d6596[_0x50c7('0x23')]?_[_0x50c7('0x42')](_0x9d6596[_0x50c7('0x23')])?_0x9d6596[_0x50c7('0x23')][_0x50c7('0x24')]():_0x9d6596['transport']:'udp';if(_0x1d6972===_0x50c7('0x43')){_0x1d6972=_0x50c7('0x44');}this[_0x50c7('0x5')](_0x50c7('0x23'),_0x1d6972);this[_0x50c7('0x5')](_0x50c7('0x45'),'no');this[_0x50c7('0x5')]('avpf',null);this['setDataValue'](_0x50c7('0x46'),null);this['setDataValue'](_0x50c7('0x47'),null);this[_0x50c7('0x5')]('dtlsenable',null);this[_0x50c7('0x5')](_0x50c7('0x48'),null);this[_0x50c7('0x5')](_0x50c7('0x49'),null);this[_0x50c7('0x5')](_0x50c7('0x4a'),null);this[_0x50c7('0x5')](_0x50c7('0x4b'),null);this[_0x50c7('0x5')](_0x50c7('0x4c'),'no');break;case 0x2:this[_0x50c7('0x5')]('transport','wss');this[_0x50c7('0x5')](_0x50c7('0x45'),'yes');this[_0x50c7('0x5')](_0x50c7('0x4d'),_0x50c7('0x2b'));this[_0x50c7('0x5')](_0x50c7('0x46'),_0x50c7('0x2b'));this[_0x50c7('0x5')]('icesupport','yes');this[_0x50c7('0x5')](_0x50c7('0x4e'),_0x50c7('0x2b'));this[_0x50c7('0x5')](_0x50c7('0x48'),'no');this[_0x50c7('0x5')](_0x50c7('0x49'),'actpass');this[_0x50c7('0x5')]('dtlscertfile',_0x9d6596['dtlscertfile']||_0x50c7('0x4f'));this['setDataValue'](_0x50c7('0x4b'),_0x9d6596[_0x50c7('0x4b')]||'/etc/pki/tls/private/motion.key');this[_0x50c7('0x5')](_0x50c7('0x4c'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0x50c7('0x40')],'set':function(_0x2834ed){this['setDataValue'](_0x50c7('0x50'),_0x2834ed?_0x2834ed['join'](','):[]);},'get':function(){return this[_0x50c7('0x9')](_0x50c7('0x50'))?_[_0x50c7('0x51')](this[_0x50c7('0x9')]('permissions')['split'](','),function(_0x5f0bfd){return parseInt(_0x5f0bfd,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x50c7('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x50c7('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x50c7('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x50c7('0x14')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x50c7('0x14')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x50c7('0x14')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x50c7('0x14')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x50c7('0x16')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x50c7('0xd')](_0x50c7('0x2b'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x50c7('0x14')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0x50c7('0x14')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x50c7('0x14')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x50c7('0x9')](_0x50c7('0x52'))?this[_0x50c7('0x9')](_0x50c7('0x52')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x50c7('0x14')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x50c7('0x14')],'defaultValue':![]},'interface':{'type':Sequelize[_0x50c7('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x50c7('0x14')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x50c7('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x50c7('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x50c7('0x14')],'defaultValue':![],'set':function(_0x849c7e){if(typeof _0x849c7e==='string'){var _0xb12700=_0x849c7e==='1'?!![]:_0x849c7e==='0'?![]:_0x849c7e===_0x50c7('0x53')?!![]:_0x849c7e===_0x50c7('0x54')?![]:![];this[_0x50c7('0x5')]('screenrecording',_0xb12700);}else{this['setDataValue'](_0x50c7('0x55'),_0x849c7e);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x58b020){this[_0x50c7('0x5')]('blocked',_0x58b020);if(_0x58b020===!![]){this[_0x50c7('0x5')](_0x50c7('0x56'),moment());this[_0x50c7('0x5')](_0x50c7('0x57'),0x0);}else{this[_0x50c7('0x5')](_0x50c7('0x56'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x50c7('0x16')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x50c7('0x14')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x50c7('0x16')](0x5)[_0x50c7('0x58')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x50c7('0x14')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x50c7('0x14')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x50c7('0x14')],'defaultValue':!![]}}; \ No newline at end of file +var _0xbe2a=['transport','isArray','udp','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsprivatekey','rtcp_mux','dtlssetup','dtlscertfile','/etc/pki/tls/certs/motion.crt','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','ENUM','user','agent','local','INTEGER','accountcode','BOOLEAN','DATE','DEFAULT\x20PAUSE','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','join','split','rfc2833','info','shortinfo','inband','auto','update','outgoing','yes','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','accept','refuse','originate','uac','uas','fingerprint','certificate','active','actpass','nonat','update,nonat','TEXT','showWebBar','get'];(function(_0x1e175d,_0x41ff45){var _0x3a3ce5=function(_0x186001){while(--_0x186001){_0x1e175d['push'](_0x1e175d['shift']());}};_0x3a3ce5(++_0x41ff45);}(_0xbe2a,0x1d9));var _0xabe2=function(_0x1ad00b,_0x7148d9){_0x1ad00b=_0x1ad00b-0x0;var _0x49c0b6=_0xbe2a[_0x1ad00b];return _0x49c0b6;};'use strict';var Sequelize=require(_0xabe2('0x0'));var moment=require(_0xabe2('0x1'));var util=require(_0xabe2('0x2'));var _=require(_0xabe2('0x3'));module[_0xabe2('0x4')]={'name':{'type':Sequelize[_0xabe2('0x5')],'allowNull':![],'unique':_0xabe2('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x485cec){this[_0xabe2('0x7')]('name',_0x485cec);this[_0xabe2('0x7')](_0xabe2('0x8'),_0x485cec);},'comment':_0xabe2('0x9')},'fullname':{'type':Sequelize[_0xabe2('0x5')],'allowNull':![],'set':function(_0x3538a0){this[_0xabe2('0x7')]('fullname',_0x3538a0);this[_0xabe2('0x7')](_0xabe2('0xa'),util[_0xabe2('0xb')](_0xabe2('0xc'),_0x3538a0,this[_0xabe2('0xd')](_0xabe2('0xe'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xabe2('0x5')],'allowNull':![],'unique':_0xabe2('0xf'),'validate':{'isEmail':!![]},'set':function(_0x35ddd1){if(_0x35ddd1){this['setDataValue']('email',_0x35ddd1['toLowerCase']());}}},'role':{'type':Sequelize[_0xabe2('0x10')]('admin',_0xabe2('0x11'),_0xabe2('0x12'),'telephone'),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xabe2('0x5')],'defaultValue':_0xabe2('0x13')},'internal':{'type':Sequelize[_0xabe2('0x14')](0xb),'allowNull':![],'unique':_0xabe2('0xe'),'set':function(_0x7aaa50){this[_0xabe2('0x7')](_0xabe2('0xe'),_0x7aaa50);this[_0xabe2('0x7')](_0xabe2('0x15'),_0x7aaa50);this[_0xabe2('0x7')]('callerid',util[_0xabe2('0xb')](_0xabe2('0xc'),this[_0xabe2('0xd')]('fullname'),_0x7aaa50));}},'salt':{'type':Sequelize[_0xabe2('0x5')]},'phone':{'type':Sequelize[_0xabe2('0x5')]},'mobile':{'type':Sequelize[_0xabe2('0x5')]},'address':{'type':Sequelize[_0xabe2('0x5')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0xabe2('0x5')]},'city':{'type':Sequelize[_0xabe2('0x5')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0xabe2('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xabe2('0x17')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xabe2('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xabe2('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xabe2('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xabe2('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xabe2('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xabe2('0x5')],'defaultValue':_0xabe2('0x18')},'lastPauseAt':{'type':Sequelize[_0xabe2('0x17')]},'chatCapacity':{'type':Sequelize[_0xabe2('0x14')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xabe2('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xabe2('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xabe2('0x16')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xabe2('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xabe2('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xabe2('0x14')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xabe2('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xabe2('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xabe2('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xabe2('0x5')],'allowNull':!![]},'host':{'type':Sequelize[_0xabe2('0x5')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0xabe2('0x5')],'allowNull':!![]},'port':{'type':Sequelize[_0xabe2('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xabe2('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0xabe2('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xabe2('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xabe2('0x10')](_0xabe2('0x19'),_0xabe2('0x11'),_0xabe2('0x1a')),'allowNull':!![],'defaultValue':_0xabe2('0x19')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xabe2('0x1b')},'callingpres':{'type':Sequelize[_0xabe2('0x10')](_0xabe2('0x1c'),_0xabe2('0x1d'),_0xabe2('0x1e'),'ALLOWED',_0xabe2('0x1f'),_0xabe2('0x20'),_0xabe2('0x21'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0xabe2('0x5')],'allowNull':!![]},'permit':{'type':Sequelize[_0xabe2('0x5')],'allowNull':!![]},'secret':{'type':Sequelize[_0xabe2('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xabe2('0x5')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xabe2('0x5')],'allowNull':!![]},'transport':{'type':Sequelize[_0xabe2('0x5')],'allowNull':!![],'defaultValue':'udp','set':function(_0x573d7a){this['setDataValue']('transport',_0x573d7a?_0x573d7a[_0xabe2('0x22')](','):null);},'get':function(){return this[_0xabe2('0xd')]('transport')?this[_0xabe2('0xd')]('transport')[_0xabe2('0x23')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0xabe2('0x24'),_0xabe2('0x25'),_0xabe2('0x26'),_0xabe2('0x27'),_0xabe2('0x28')),'allowNull':!![],'defaultValue':_0xabe2('0x24')},'directmedia':{'type':Sequelize['ENUM']('yes','no','nonat',_0xabe2('0x29'),_0xabe2('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xabe2('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0xabe2('0x5')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x25f4c6){this[_0xabe2('0x7')](_0xabe2('0x2c'),_0x25f4c6?_0x25f4c6[_0xabe2('0x22')](','):null);},'get':function(){return this[_0xabe2('0xd')](_0xabe2('0x2c'))?this[_0xabe2('0xd')](_0xabe2('0x2c'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xabe2('0x5')]},'namedcallgroup':{'type':Sequelize[_0xabe2('0x5')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xabe2('0x5')]},'language':{'type':Sequelize[_0xabe2('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xabe2('0x5')]},'disallow':{'type':Sequelize[_0xabe2('0x5')],'allowNull':![],'defaultValue':_0xabe2('0x2d')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xabe2('0x2e'),'set':function(_0x1c38e3){this['setDataValue']('allow',_0x1c38e3?_0x1c38e3[_0xabe2('0x22')](';'):'ulaw;alaw;gsm');},'get':function(){return this['getDataValue'](_0xabe2('0x2f'))?this[_0xabe2('0xd')](_0xabe2('0x2f'))[_0xabe2('0x23')](';'):null;},'comment':_0xabe2('0x30')},'autoframing':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0xc1345c){this['setDataValue'](_0xabe2('0x31'),_0xc1345c?_0xc1345c['join'](','):null);},'get':function(){return this[_0xabe2('0xd')](_0xabe2('0x31'))?this['getDataValue']('insecure')[_0xabe2('0x23')](','):null;},'comment':_0xabe2('0x32')},'trustrpid':{'type':Sequelize[_0xabe2('0x10')](_0xabe2('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xabe2('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xabe2('0x10')](_0xabe2('0x2b'),'no',_0xabe2('0x33')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0xabe2('0x2b'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xabe2('0x10')](_0xabe2('0x2b'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xabe2('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xabe2('0x5')],'allowNull':!![],'defaultValue':_0xabe2('0x34')},'amaflags':{'type':Sequelize[_0xabe2('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xabe2('0x10')](_0xabe2('0x2b'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xabe2('0x14')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xabe2('0x10')](_0xabe2('0x2b'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xabe2('0x10')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xabe2('0x10')](_0xabe2('0x2b'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xabe2('0x10')](_0xabe2('0x2b'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xabe2('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xabe2('0x10')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0xabe2('0x35'),_0xabe2('0x36'),_0xabe2('0x37')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xabe2('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xabe2('0x10')](_0xabe2('0x38'),_0xabe2('0x39')),'allowNull':!![],'defaultValue':_0xabe2('0x39')},'t38pt_usertpsource':{'type':Sequelize[_0xabe2('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xabe2('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xabe2('0x5')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xabe2('0x10')](_0xabe2('0x2b'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xabe2('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xabe2('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xabe2('0x14')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xabe2('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xabe2('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xabe2('0x10')](_0xabe2('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xabe2('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xabe2('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xabe2('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xabe2('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xabe2('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xabe2('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xabe2('0x5')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xabe2('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xabe2('0x10')](_0xabe2('0x2b'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xabe2('0x10')](_0xabe2('0x2b'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0xabe2('0x2b'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xabe2('0x10')](_0xabe2('0x2b'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0xabe2('0x2b'),'no',_0xabe2('0x3a'),_0xabe2('0x3b')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xabe2('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xabe2('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xabe2('0x5')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xabe2('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xabe2('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xabe2('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xabe2('0x10')](_0xabe2('0x3c'),'passive',_0xabe2('0x3d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xabe2('0x10')](_0xabe2('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xabe2('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xabe2('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xabe2('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xabe2('0x10')](_0xabe2('0x2b'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xabe2('0x10')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xabe2('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xabe2('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM']('yes','no',_0xabe2('0x3e'),_0xabe2('0x29'),_0xabe2('0x3f')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xabe2('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xabe2('0x5')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0xabe2('0x17')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xabe2('0x40')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x26d53c){this['setDataValue'](_0xabe2('0x41'),_0x26d53c);var _0x2a9c54=this[_0xabe2('0x42')]({'plain':!![]});switch(_0x26d53c){case 0x0:case 0x1:var _0x3c40ad=_0x2a9c54[_0xabe2('0x43')]?_[_0xabe2('0x44')](_0x2a9c54[_0xabe2('0x43')])?_0x2a9c54[_0xabe2('0x43')][_0xabe2('0x22')]():_0x2a9c54[_0xabe2('0x43')]:_0xabe2('0x45');if(_0x3c40ad===_0xabe2('0x46')){_0x3c40ad=_0xabe2('0x45');}this['setDataValue'](_0xabe2('0x43'),_0x3c40ad);this[_0xabe2('0x7')](_0xabe2('0x47'),'no');this[_0xabe2('0x7')](_0xabe2('0x48'),null);this[_0xabe2('0x7')](_0xabe2('0x49'),null);this[_0xabe2('0x7')](_0xabe2('0x4a'),null);this[_0xabe2('0x7')](_0xabe2('0x4b'),null);this[_0xabe2('0x7')]('dtlsverify',null);this[_0xabe2('0x7')]('dtlssetup',null);this[_0xabe2('0x7')]('dtlscertfile',null);this['setDataValue'](_0xabe2('0x4c'),null);this[_0xabe2('0x7')](_0xabe2('0x4d'),'no');break;case 0x2:this['setDataValue']('transport','wss');this[_0xabe2('0x7')](_0xabe2('0x47'),_0xabe2('0x2b'));this[_0xabe2('0x7')](_0xabe2('0x48'),_0xabe2('0x2b'));this['setDataValue'](_0xabe2('0x49'),_0xabe2('0x2b'));this[_0xabe2('0x7')](_0xabe2('0x4a'),_0xabe2('0x2b'));this['setDataValue']('dtlsenable',_0xabe2('0x2b'));this[_0xabe2('0x7')]('dtlsverify','no');this[_0xabe2('0x7')](_0xabe2('0x4e'),_0xabe2('0x3d'));this[_0xabe2('0x7')](_0xabe2('0x4f'),_0x2a9c54['dtlscertfile']||_0xabe2('0x50'));this[_0xabe2('0x7')](_0xabe2('0x4c'),_0x2a9c54[_0xabe2('0x4c')]||'/etc/pki/tls/private/motion.key');this['setDataValue'](_0xabe2('0x4d'),_0xabe2('0x2b'));break;default:}}},'permissions':{'type':Sequelize[_0xabe2('0x40')],'set':function(_0x3229f3){this[_0xabe2('0x7')](_0xabe2('0x51'),_0x3229f3?_0x3229f3['join'](','):[]);},'get':function(){return this[_0xabe2('0xd')](_0xabe2('0x51'))?_[_0xabe2('0x52')](this[_0xabe2('0xd')](_0xabe2('0x51'))[_0xabe2('0x23')](','),function(_0x51280f){return parseInt(_0x51280f,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xabe2('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xabe2('0x5')]},'phoneBarBusyNumber':{'type':Sequelize[_0xabe2('0x5')]},'phoneBarUnconditional':{'type':Sequelize[_0xabe2('0x16')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xabe2('0x16')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xabe2('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xabe2('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xabe2('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xabe2('0x5')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xabe2('0x14')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xabe2('0x10')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xabe2('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xabe2('0x5')]},'phoneBarEnableJaws':{'type':Sequelize[_0xabe2('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xabe2('0x16')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xabe2('0x53')],'get':function(){return this['getDataValue'](_0xabe2('0x54'))?this[_0xabe2('0xd')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xabe2('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xabe2('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xabe2('0x16')],'defaultValue':![]},'interface':{'type':Sequelize[_0xabe2('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xabe2('0x16')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xabe2('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xabe2('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xabe2('0x16')],'defaultValue':![],'set':function(_0x4377a3){if(typeof _0x4377a3==='string'){var _0x3d76f6=_0x4377a3==='1'?!![]:_0x4377a3==='0'?![]:_0x4377a3==='true'?!![]:_0x4377a3==='false'?![]:![];this[_0xabe2('0x7')]('screenrecording',_0x3d76f6);}else{this[_0xabe2('0x7')](_0xabe2('0x55'),_0x4377a3);}}},'blocked':{'type':Sequelize[_0xabe2('0x16')],'defaultValue':![],'set':function(_0x1769ed){this[_0xabe2('0x7')](_0xabe2('0x56'),_0x1769ed);if(_0x1769ed===!![]){this[_0xabe2('0x7')](_0xabe2('0x57'),moment());this[_0xabe2('0x7')](_0xabe2('0x58'),0x0);}else{this['setDataValue'](_0xabe2('0x57'),null);}}},'blockedAt':{'type':Sequelize[_0xabe2('0x17')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xabe2('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xabe2('0x16')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xabe2('0x14')](0x5)[_0xabe2('0x59')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xabe2('0x16')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xabe2('0x16')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xabe2('0x16')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 4d094b6..af58cdc 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 _0x94df=['forEach','YYYY-MM-DD\x20HH:mm:ss','LOGIN','device','PAUSE','MemberReport','bulkCreate','concat','isMiddleware','logout','pause','QueuePause','getChannels','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','faxPause','smsPause','whatsapppause','pauseType','lastPauseAt','manual','set','Pause','getTeams','Team','addTeams','setDataValue','Voice','getChatQueues','Chat','getMailQueues','Mail','getSmsQueues','getWhatsappQueues','getFaxQueues','Fax','Openchannel','flatten','transaction','getDataValue','Queue:save','removeTeams','Sms','getOpenchannelQueues','removeAgent','getLists','CmList','getAgents','values','addChatInteractions','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','removeSquareProjects','getScheduledCalls','CmHopper','$and','$or','$gt','$lt','$ne','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$overlap','$contains','$contained','$any','firstName','lastName','dialActive','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','createApiKey','generateApiKey','nonce','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','resolve','isEmpty','teams','queues','inbound','col','toString','asc','desc','substring','uniqBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','http','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','offline','idle','unknown','unavailable','ringing','voiceStatus','slice','toUpperCase','select','field','ui.','ui.createdAt','user_has_','_interactions','OpenTabs','moment','bluebird','util','path','lodash','squel','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','socket.io-emitter','redis','register','defaults','localhost','client','request','then','info','User,\x20%s,\x20%s','request\x20sent','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','json','offset','undefined','limit','count','update','role','agent','Telephones','ignore','map','value','find','name','UserProfileResource','destroy','end','stack','send','index','User','rawAttributes','fieldName','type','key','filter','password','getOptions','where','query','include','includes','attributes','push','findAll','rows','true','length','chat','dataValues','sms','mail','openchannel','whatsapp','params','model','keys','salt','intersection','merge','options','openTabs','fax','body','addContacts','ids','omit','Setting','findById','securePassword','max','internal','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','voicemail','VoiceMail','fullname','email','permissions','101','103','113','110','106','107','108','109','111','114','115','user','admin','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','Agents','create','Unauthorized','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','all','each','telephone','UserProfileSection','autoAssociation','compact','changePassword','oldPassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','loginInPause','interface','isValidChannel','Unknown\x20channel','capitalize','toLowerCase','Queues','penalty','spread','QueueId','voice','VoiceQueue','get','online','format','SIP/%s','voicePause','UserVoiceQueueRt','upsert','removeQueues','remove','isArray','emit','Queue:remove','userpic','file','server/files/images/logos/default_profile.png','download','existsSync','join','root','server/files/images/','getOpenTabs','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','getContacts','CmContact','filters','fields','order','sort','pick','includeAll','List','Tags','tag','getQueues','Queue','hasOwnProperty','nolimit','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','getScreenRecordings','ScreenRecording','UserId','getChatInteractions','ChatInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','login','phone','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','remoteAddress','socket','connection','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty'];(function(_0x313d6f,_0x122c8d){var _0x2059ac=function(_0x49c551){while(--_0x49c551){_0x313d6f['push'](_0x313d6f['shift']());}};_0x2059ac(++_0x122c8d);}(_0x94df,0xa3));var _0xf94d=function(_0x101c5c,_0x5d32e9){_0x101c5c=_0x101c5c-0x0;var _0x375669=_0x94df[_0x101c5c];return _0x375669;};'use strict';var moment=require(_0xf94d('0x0'));var BPromise=require(_0xf94d('0x1'));var util=require(_0xf94d('0x2'));var path=require(_0xf94d('0x3'));var fs=require('fs');var _=require(_0xf94d('0x4'));var squel=require(_0xf94d('0x5'));var jayson=require('jayson/promise');var Redis=require(_0xf94d('0x6'));var authService=require(_0xf94d('0x7'));var qs=require(_0xf94d('0x8'));var logger=require(_0xf94d('0x9'))(_0xf94d('0xa'));var utils=require(_0xf94d('0xb'));var config=require(_0xf94d('0xc'));var licenseUtil=require(_0xf94d('0xd'));var db=require(_0xf94d('0xe'))['db'];var socket=require(_0xf94d('0xf'))(new Redis(config[_0xf94d('0x10')]));require('./user.socket')[_0xf94d('0x11')](socket);config[_0xf94d('0x10')]=_[_0xf94d('0x12')](config[_0xf94d('0x10')],{'host':_0xf94d('0x13'),'port':0x18eb});var client=jayson[_0xf94d('0x14')]['http']({'port':0x232a});var values;function respondWithRpcPromise(_0x25c68e,_0x1c1bdf,_0x225d46,_0x19b1de){return new BPromise(function(_0x3a1e7c,_0x509bf2){var _0x580644=_0x19b1de||client;return _0x580644[_0xf94d('0x15')](_0x25c68e,_0x225d46)[_0xf94d('0x16')](function(_0x2f5395){logger[_0xf94d('0x17')](_0xf94d('0x18'),_0x1c1bdf,_0xf94d('0x19'));logger['debug'](_0xf94d('0x1a'),_0x1c1bdf,_0xf94d('0x19'),JSON[_0xf94d('0x1b')](_0x2f5395));if(_0x2f5395[_0xf94d('0x1c')]){if(_0x2f5395[_0xf94d('0x1c')][_0xf94d('0x1d')]===0x1f4){logger[_0xf94d('0x1c')](_0xf94d('0x18'),_0x1c1bdf,_0x2f5395['error'][_0xf94d('0x1e')]);return _0x509bf2(_0x2f5395['error'][_0xf94d('0x1e')]);}logger['error'](_0xf94d('0x18'),_0x1c1bdf,_0x2f5395['error'][_0xf94d('0x1e')]);return _0x3a1e7c(_0x2f5395[_0xf94d('0x1c')][_0xf94d('0x1e')]);}else{logger[_0xf94d('0x17')]('User,\x20%s,\x20%s',_0x1c1bdf,_0xf94d('0x19'));_0x3a1e7c(_0x2f5395['result'][_0xf94d('0x1e')]);}})[_0xf94d('0x1f')](function(_0x45adeb){logger[_0xf94d('0x1c')]('User,\x20%s,\x20%s',_0x1c1bdf,_0x45adeb);_0x509bf2(_0x45adeb);});});}function respondWithStatusCode(_0x4325ff,_0x5f2112){_0x5f2112=_0x5f2112||0xcc;return function(_0x39f75d){if(_0x39f75d){return _0x4325ff[_0xf94d('0x20')](_0x5f2112);}return _0x4325ff[_0xf94d('0x21')](_0x5f2112)['end']();};}function respondWithResult(_0x3f6b24,_0x8f50){_0x8f50=_0x8f50||0xc8;return function(_0x2142a1){if(_0x2142a1){return _0x3f6b24[_0xf94d('0x21')](_0x8f50)[_0xf94d('0x22')](_0x2142a1);}};}function respondWithFilteredResult(_0x533714,_0x301d2e){return function(_0x51f7f8){if(_0x51f7f8){var _0x4701e1=typeof _0x301d2e[_0xf94d('0x23')]===_0xf94d('0x24')&&typeof _0x301d2e[_0xf94d('0x25')]===_0xf94d('0x24');var _0x1c4bdf=_0x51f7f8[_0xf94d('0x26')];var _0x4152f0=_0x4701e1?0x0:_0x301d2e[_0xf94d('0x23')];var _0x13c229=_0x4701e1?_0x51f7f8[_0xf94d('0x26')]:_0x301d2e[_0xf94d('0x23')]+_0x301d2e[_0xf94d('0x25')];var _0x5aa72c;if(_0x13c229>=_0x1c4bdf){_0x13c229=_0x1c4bdf;_0x5aa72c=0xc8;}else{_0x5aa72c=0xce;}_0x533714['status'](_0x5aa72c);return _0x533714['set']('Content-Range',_0x4152f0+'-'+_0x13c229+'/'+_0x1c4bdf)[_0xf94d('0x22')](_0x51f7f8);}return null;};}function saveUpdates(_0x1e8242){return function(_0x56ab8c){if(_0x56ab8c){return _0x56ab8c[_0xf94d('0x27')](_0x1e8242)[_0xf94d('0x16')](function(_0x229ff7){return _0x229ff7;});}return null;};}function removeEntity(_0x59c273){return function(_0x41b863){if(_0x41b863){return _0x41b863['destroy']()[_0xf94d('0x16')](function(){var _0x1d15c5=_0x41b863['get']({'plain':!![]});if(_0x1d15c5[_0xf94d('0x28')]==='admin')return;var _0x18faf1=[{'name':'Users','value':'user','ignore':!![]},{'name':'Agents','value':_0xf94d('0x29'),'ignore':![]},{'name':_0xf94d('0x2a'),'value':'telephone','ignore':![]}];var _0xed666a=_(_0x18faf1)['filter'](_0xf94d('0x2b'))[_0xf94d('0x2c')]('value')[_0xf94d('0x2d')]();if(_['includes'](_0xed666a,_0x1d15c5[_0xf94d('0x28')])){return;}var _0x4c702d=_[_0xf94d('0x2e')](_0x18faf1,['value',_0x1d15c5[_0xf94d('0x28')]])[_0xf94d('0x2f')];return db[_0xf94d('0x30')][_0xf94d('0x31')]({'where':{'type':_0x4c702d,'resourceId':_0x1d15c5['id']}})['then'](function(){return _0x41b863;});})['then'](function(){_0x59c273['status'](0xcc)[_0xf94d('0x32')]();});}};}function handleEntityNotFound(_0x3f9f3d){return function(_0xe045f7){if(!_0xe045f7){_0x3f9f3d[_0xf94d('0x20')](0x194);}return _0xe045f7;};}function handleError(_0x4e86fc,_0x47efbc){_0x47efbc=_0x47efbc||0x1f4;return function(_0x5db44c){logger[_0xf94d('0x1c')](_0x5db44c[_0xf94d('0x33')]);if(_0x5db44c[_0xf94d('0x2f')]){delete _0x5db44c[_0xf94d('0x2f')];}_0x4e86fc['status'](_0x47efbc)[_0xf94d('0x34')](_0x5db44c);};}exports[_0xf94d('0x35')]=function(_0x385a75,_0xea51ad){var _0x565907={},_0x446189={'count':0x0,'rows':[]};var _0x19d52=_(db[_0xf94d('0x36')][_0xf94d('0x37')])[_0xf94d('0x2c')](function(_0x288262){return{'name':_0x288262[_0xf94d('0x38')],'type':_0x288262[_0xf94d('0x39')][_0xf94d('0x3a')]};})[_0xf94d('0x3b')](function(_0x525e03){return!_['includes']([_0xf94d('0x3c'),'salt'],_0x525e03[_0xf94d('0x2f')]);})['value']();_0x565907=qs[_0xf94d('0x3d')](_0x19d52,_0x385a75);var _0x9277c9={'where':_0x565907[_0xf94d('0x3e')]};return db[_0xf94d('0x36')][_0xf94d('0x26')](_0x9277c9)['then'](function(_0x2d95ee){_0x446189['count']=_0x2d95ee;if(_0x385a75[_0xf94d('0x3f')]['includeAll']){_0x565907[_0xf94d('0x40')]=[{'all':!![]}];}if(!_[_0xf94d('0x41')](_0x565907[_0xf94d('0x42')],'id')){_0x565907[_0xf94d('0x42')][_0xf94d('0x43')]('id');}return db[_0xf94d('0x36')][_0xf94d('0x44')](_0x565907);})['then'](function(_0x36ac14){_0x446189[_0xf94d('0x45')]=_0x36ac14;if(_0x385a75[_0xf94d('0x3f')]['openTabs']===_0xf94d('0x46')){var _0x3ca5ed=[];for(var _0x41c72d=0x0;_0x41c72d<_0x446189[_0xf94d('0x45')][_0xf94d('0x47')];_0x41c72d++){_0x3ca5ed[_0xf94d('0x43')](get_open_tabs(_0xf94d('0x48'),_0x446189['rows'][_0x41c72d][_0xf94d('0x49')]));_0x3ca5ed[_0xf94d('0x43')](get_open_tabs(_0xf94d('0x4a'),_0x446189[_0xf94d('0x45')][_0x41c72d][_0xf94d('0x49')]));_0x3ca5ed[_0xf94d('0x43')](get_open_tabs('fax',_0x446189['rows'][_0x41c72d][_0xf94d('0x49')]));_0x3ca5ed[_0xf94d('0x43')](get_open_tabs(_0xf94d('0x4b'),_0x446189[_0xf94d('0x45')][_0x41c72d][_0xf94d('0x49')]));_0x3ca5ed['push'](get_open_tabs(_0xf94d('0x4c'),_0x446189['rows'][_0x41c72d][_0xf94d('0x49')]));_0x3ca5ed[_0xf94d('0x43')](get_open_tabs(_0xf94d('0x4d'),_0x446189[_0xf94d('0x45')][_0x41c72d][_0xf94d('0x49')]));}return BPromise['all'](_0x3ca5ed)[_0xf94d('0x16')](function(_0x2118d6){return _0x446189;});}else{return _0x446189;}})[_0xf94d('0x16')](respondWithFilteredResult(_0xea51ad,_0x565907))[_0xf94d('0x1f')](handleError(_0xea51ad,null));};exports['show']=function(_0x159fb8,_0x4dee8f){var _0x50da17={'raw':![],'where':{'id':_0x159fb8[_0xf94d('0x4e')]['id']}},_0x2c3e83={};_0x2c3e83[_0xf94d('0x4f')]=_['differenceBy'](_[_0xf94d('0x50')](db['User'][_0xf94d('0x37')]),[_0xf94d('0x3c'),_0xf94d('0x51')]);_0x2c3e83[_0xf94d('0x3f')]=_[_0xf94d('0x50')](_0x159fb8[_0xf94d('0x3f')]);_0x2c3e83['filters']=_[_0xf94d('0x52')](_0x2c3e83[_0xf94d('0x4f')],_0x2c3e83[_0xf94d('0x3f')]);_0x50da17[_0xf94d('0x42')]=_['intersection'](_0x2c3e83[_0xf94d('0x4f')],qs['fields'](_0x159fb8[_0xf94d('0x3f')]['fields']));_0x50da17[_0xf94d('0x42')]=_0x50da17[_0xf94d('0x42')][_0xf94d('0x47')]?_0x50da17[_0xf94d('0x42')]:_0x2c3e83[_0xf94d('0x4f')];if(_0x159fb8['query']['includeAll']){_0x50da17[_0xf94d('0x40')]=[{'all':!![]}];}_0x50da17=_[_0xf94d('0x53')]({},_0x50da17,_0x159fb8[_0xf94d('0x54')]);if(!_[_0xf94d('0x41')](_0x50da17[_0xf94d('0x42')],'id')){_0x50da17[_0xf94d('0x42')]['push']('id');}return db[_0xf94d('0x36')][_0xf94d('0x2e')](_0x50da17)[_0xf94d('0x16')](handleEntityNotFound(_0x4dee8f,null))[_0xf94d('0x16')](function(_0x5b259f){var _0x4d58cf=[];values=_0x5b259f;if(_0x159fb8[_0xf94d('0x3f')][_0xf94d('0x55')]===_0xf94d('0x46')){_0x4d58cf['push'](get_open_tabs(_0xf94d('0x48'),_0x5b259f[_0xf94d('0x49')]));_0x4d58cf[_0xf94d('0x43')](get_open_tabs(_0xf94d('0x4a'),_0x5b259f[_0xf94d('0x49')]));_0x4d58cf[_0xf94d('0x43')](get_open_tabs(_0xf94d('0x4c'),_0x5b259f[_0xf94d('0x49')]));_0x4d58cf[_0xf94d('0x43')](get_open_tabs('whatsapp',_0x5b259f[_0xf94d('0x49')]));_0x4d58cf['push'](get_open_tabs(_0xf94d('0x56'),_0x5b259f['dataValues']));_0x4d58cf[_0xf94d('0x43')](get_open_tabs(_0xf94d('0x4b'),_0x5b259f[_0xf94d('0x49')]));return BPromise['all'](_0x4d58cf);}else{return values;}})[_0xf94d('0x16')](function(_0x3a55e9){return values;})[_0xf94d('0x16')](respondWithResult(_0x4dee8f,null))[_0xf94d('0x1f')](handleError(_0x4dee8f,null));};exports['update']=function(_0x4bbbea,_0x35411b){if(_0x4bbbea['body']['id']){delete _0x4bbbea['body']['id'];}delete _0x4bbbea[_0xf94d('0x57')][_0xf94d('0x28')];return db['User'][_0xf94d('0x2e')]({'where':{'id':_0x4bbbea['params']['id']}})['then'](handleEntityNotFound(_0x35411b,null))['then'](saveUpdates(_0x4bbbea[_0xf94d('0x57')],null))['then'](respondWithResult(_0x35411b,null))[_0xf94d('0x1f')](handleError(_0x35411b,null));};exports['describe']=function(_0x54f0c4,_0x556582){return db[_0xf94d('0x36')]['describe']()['then'](respondWithResult(_0x556582,null))[_0xf94d('0x1f')](handleError(_0x556582,null));};exports['addContacts']=function(_0x3bca62,_0x28123e){return db['User'][_0xf94d('0x2e')]({'where':{'id':_0x3bca62['params']['id']}})['then'](handleEntityNotFound(_0x28123e,null))[_0xf94d('0x16')](function(_0x52fca9){if(_0x52fca9){return _0x52fca9[_0xf94d('0x58')](_0x3bca62[_0xf94d('0x57')][_0xf94d('0x59')],_[_0xf94d('0x5a')](_0x3bca62['body'],[_0xf94d('0x59'),'id'])||{});}})[_0xf94d('0x16')](respondWithResult(_0x28123e,null))[_0xf94d('0x1f')](handleError(_0x28123e,null));};function validateUser(_0x1227e6){return new BPromise(function(_0x2e253b,_0x31814a){if(_0x1227e6['internal'])return _0x2e253b(_0x1227e6);return db[_0xf94d('0x5b')][_0xf94d('0x5c')](0x1)[_0xf94d('0x16')](function(_0x12952f){if(_0x12952f[_0xf94d('0x5d')])authService['validatePasswordPattern'](_0x1227e6[_0xf94d('0x3c')]);db[_0xf94d('0x36')][_0xf94d('0x5e')](_0xf94d('0x5f'))['then'](function(_0x17de08){if(_[_0xf94d('0x60')](_0x17de08)){_0x1227e6[_0xf94d('0x5f')]=_0x12952f[_0xf94d('0x61')]||0x1;return;}if(_[_0xf94d('0x60')](_0x12952f[_0xf94d('0x61')])||_0x12952f[_0xf94d('0x61')]===_0x17de08){_0x1227e6[_0xf94d('0x5f')]=_0x17de08+0x1;return;}if(_0x12952f[_0xf94d('0x61')]>_0x17de08){_0x1227e6[_0xf94d('0x5f')]=_0x12952f[_0xf94d('0x61')];return;}return db[_0xf94d('0x62')][_0xf94d('0x3f')](_0xf94d('0x63'),{'type':db[_0xf94d('0x62')][_0xf94d('0x64')][_0xf94d('0x65')]})[_0xf94d('0x16')](function(_0x39cb6e){if(_0x39cb6e&&_0x39cb6e[_0xf94d('0x47')]){for(var _0x1f146d=0x0,_0x1bc666=_0x39cb6e[_0xf94d('0x47')];_0x1f146d<_0x1bc666&&_['isNil'](_0x1227e6['internal']);_0x1f146d++){if(_0x12952f[_0xf94d('0x61')]<=_0x39cb6e[_0x1f146d][_0xf94d('0x66')]){_0x1227e6[_0xf94d('0x5f')]=_0x39cb6e[_0x1f146d][_0xf94d('0x66')];}else if(_0x12952f['min_internal']>_0x39cb6e[_0x1f146d][_0xf94d('0x66')]&&_0x12952f[_0xf94d('0x61')]<=_0x39cb6e[_0x1f146d]['to']){_0x1227e6['internal']=_0x12952f[_0xf94d('0x61')];}}}if(_['isNil'](_0x1227e6[_0xf94d('0x5f')])){_0x1227e6[_0xf94d('0x5f')]=_0x17de08+0x1;}return _0x2e253b(_0x1227e6);});});})[_0xf94d('0x1f')](function(_0x244f15){_0x31814a(_0x244f15);});});}function updateUser(_0x905919){return new BPromise(function(_0x3a0985,_0x3f3c1d){try{if(_0x905919[_0xf94d('0x67')]){_0x905919['mailbox']=_0x905919[_0xf94d('0x5f')];_0x905919[_0xf94d('0x68')]={'mailbox':_0x905919[_0xf94d('0x5f')],'password':_0x905919[_0xf94d('0x3c')],'fullname':_0x905919[_0xf94d('0x69')],'email':_0x905919[_0xf94d('0x6a')]};}if(_0x905919[_0xf94d('0x28')]===_0xf94d('0x29')){if(!_0x905919['permissions'])_0x905919[_0xf94d('0x6b')]=[_0xf94d('0x6c'),'102',_0xf94d('0x6d'),_0xf94d('0x6e'),_0xf94d('0x6f'),'104','105',_0xf94d('0x70'),_0xf94d('0x71'),_0xf94d('0x72'),_0xf94d('0x73'),'100',_0xf94d('0x74'),_0xf94d('0x75'),_0xf94d('0x76')];}_0x3a0985(_0x905919);}catch(_0x15b9f6){_0x3f3c1d(_0x15b9f6);}});}exports['create']=function(_0x2445e1,_0x19f9ff){if(_0x2445e1[_0xf94d('0x77')][_0xf94d('0x28')]===_0xf94d('0x29'))throw new Error('Unauthorized');if(_0x2445e1[_0xf94d('0x57')][_0xf94d('0x28')]==='user'&&_0x2445e1[_0xf94d('0x77')]['role']!==_0xf94d('0x78')){throw new Error(_0xf94d('0x79'));}if(_0x2445e1[_0xf94d('0x57')][_0xf94d('0x28')]===_0xf94d('0x78')&&_0x2445e1[_0xf94d('0x77')][_0xf94d('0x28')]!==_0xf94d('0x78')){throw new Error(_0xf94d('0x7a'));}return licenseUtil[_0xf94d('0x7b')]([_0x2445e1[_0xf94d('0x57')]])[_0xf94d('0x16')](function(){return validateUser(_0x2445e1['body']);})[_0xf94d('0x16')](function(_0x3cf35e){return updateUser(_0x3cf35e)[_0xf94d('0x16')](function(_0x1f5bdf){if(_0x1f5bdf[_0xf94d('0x28')]===_0xf94d('0x78')){_0x1f5bdf[_0xf94d('0x7c')]=_0x2445e1[_0xf94d('0x77')][_0xf94d('0x7c')];delete _0x1f5bdf[_0xf94d('0x7d')];}return _0x1f5bdf;});})[_0xf94d('0x16')](function(_0x351048){return db[_0xf94d('0x36')]['create'](_0x351048,{'include':[{'model':db['VoiceMail'],'as':_0xf94d('0x68')}]});})[_0xf94d('0x16')](function(_0x3a284b){if(_0x2445e1['body']['role']===_0xf94d('0x77'))return _0x3a284b;if(_0x2445e1[_0xf94d('0x77')][_0xf94d('0x28')]!==_0xf94d('0x77'))return _0x3a284b;return db['UserProfileSection']['find']({'where':{'name':_0x3a284b[_0xf94d('0x28')]===_0xf94d('0x29')?_0xf94d('0x7e'):_0xf94d('0x2a'),'userProfileId':_0x2445e1[_0xf94d('0x77')][_0xf94d('0x7d')]},'raw':!![]})[_0xf94d('0x16')](function(_0x50b98e){if(!_0x50b98e||_0x50b98e['autoAssociation']!=0x0)return _0x3a284b;return db['UserProfileResource'][_0xf94d('0x7f')]({'name':_0x3a284b[_0xf94d('0x2f')],'resourceId':_0x3a284b['id'],'type':_0x50b98e[_0xf94d('0x2f')],'sectionId':_0x50b98e['id']},{})[_0xf94d('0x16')](function(){return _0x3a284b;});})[_0xf94d('0x1f')](function(_0x4025c9){logger[_0xf94d('0x1c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4025c9);throw _0x4025c9;});})[_0xf94d('0x16')](respondWithResult(_0x19f9ff,0xc9))[_0xf94d('0x1f')](handleError(_0x19f9ff,null));};exports['bulkCreate']=function(_0x430ed0,_0x16eb8c){var _0x35813f=_0x430ed0[_0xf94d('0x57')];var _0x17c8c7=[];if(_0x430ed0[_0xf94d('0x77')][_0xf94d('0x28')]===_0xf94d('0x29'))throw new Error(_0xf94d('0x80'));if(_['some'](_0x35813f,[_0xf94d('0x28'),'user'])&&_0x430ed0['user']['role']!=='admin'){throw new Error(_0xf94d('0x79'));}if(_[_0xf94d('0x81')](_0x35813f,[_0xf94d('0x28'),'admin'])&&_0x430ed0['user'][_0xf94d('0x28')]!==_0xf94d('0x78')){throw new Error(_0xf94d('0x82'));}return licenseUtil['checkUserLimits'](_0x35813f)['then'](function(){return validateUser(_0x35813f[0x0]);})['then'](function(){for(var _0x3f46b4=0x1;_0x3f46b4<_0x35813f[_0xf94d('0x47')];_0x3f46b4++){var _0x64a792=_0x35813f[_0x3f46b4-0x1][_0xf94d('0x5f')];if(!_0x35813f[_0x3f46b4][_0xf94d('0x5f')])_0x35813f[_0x3f46b4][_0xf94d('0x5f')]=_0x64a792+0x1;_0x17c8c7[_0xf94d('0x43')](validateUser(_0x35813f[_0x3f46b4]));}return BPromise[_0xf94d('0x83')](_0x17c8c7);})[_0xf94d('0x16')](function(){_0x17c8c7=[];for(var _0x34649a=0x0;_0x34649a<_0x35813f[_0xf94d('0x47')];_0x34649a++){_0x17c8c7['push'](updateUser(_0x35813f[_0x34649a]));}return BPromise[_0xf94d('0x83')](_0x17c8c7);})[_0xf94d('0x16')](function(){return BPromise[_0xf94d('0x84')](_0x35813f,function(_0x6f28a1){return db[_0xf94d('0x36')][_0xf94d('0x7f')](_0x6f28a1,{'include':[{'model':db[_0xf94d('0x68')],'as':_0xf94d('0x68')}]})['then'](function(_0x17c48d){_0x6f28a1['id']=_0x17c48d['id'];return _0x6f28a1;});});})[_0xf94d('0x16')](function(_0x387f9e){if(_0x430ed0[_0xf94d('0x57')]['role']===_0xf94d('0x77'))return _0x387f9e;if(_0x430ed0[_0xf94d('0x77')][_0xf94d('0x28')]!=='user')return _0x387f9e;var _0x2d3765=_['some'](_0x387f9e,function(_0x41d9ff){return _0x41d9ff[_0xf94d('0x28')]===_0xf94d('0x29')||_0x41d9ff[_0xf94d('0x28')]===_0xf94d('0x85');});if(!_0x2d3765)return _0x387f9e;return db[_0xf94d('0x86')]['findAll']({'where':{'name':{'$or':[_0xf94d('0x7e'),_0xf94d('0x2a')]},'userProfileId':_0x430ed0[_0xf94d('0x77')]['userProfileId']},'raw':!![]})[_0xf94d('0x16')](function(_0x5de3f0){if(_['isEmpty'](_0x5de3f0)||!_['some'](_0x5de3f0,[_0xf94d('0x87'),0x0]))return _0x387f9e;_0x17c8c7=[];var _0x4097bf=_(_0x5de3f0)['map'](function(_0x1c224d){if(_0x1c224d[_0xf94d('0x87')]===0x1)return;return _0x1c224d[_0xf94d('0x2f')]===_0xf94d('0x7e')?_0xf94d('0x29'):_0xf94d('0x85');})[_0xf94d('0x88')]()['value']();for(var _0x4744e4=0x0;_0x4744e4<_0x387f9e[_0xf94d('0x47')];_0x4744e4++){if(!_['includes'](_0x4097bf,_0x387f9e[_0x4744e4][_0xf94d('0x28')]))return;var _0x1bf9b2=_0x387f9e[_0x4744e4][_0xf94d('0x28')]===_0xf94d('0x29')?_0xf94d('0x7e'):_0xf94d('0x2a');_0x17c8c7[_0xf94d('0x43')](db['UserProfileResource']['create']({'name':_0x387f9e[_0x4744e4]['name'],'resourceId':_0x387f9e[_0x4744e4]['id'],'type':_0x1bf9b2,'sectionId':_[_0xf94d('0x2e')](_0x5de3f0,['name',_0x1bf9b2])['id']},{}));}return BPromise[_0xf94d('0x83')](_0x17c8c7);});})[_0xf94d('0x16')](respondWithResult(_0x16eb8c,0xc9))[_0xf94d('0x1f')](handleError(_0x16eb8c,null));};exports[_0xf94d('0x89')]=function(_0x49b97e,_0x5502ae){if(_0x49b97e[_0xf94d('0x57')]['id']){delete _0x49b97e[_0xf94d('0x57')]['id'];}return db[_0xf94d('0x36')]['find']({'where':{'id':_0x49b97e[_0xf94d('0x4e')]['id']}})[_0xf94d('0x16')](function(_0x58d008){if(!_0x58d008)return null;if(_0x58d008['id']===_0x49b97e[_0xf94d('0x77')]['id']){if(!_0x49b97e[_0xf94d('0x57')][_0xf94d('0x8a')]||!_0x49b97e[_0xf94d('0x57')][_0xf94d('0x8b')]){throw new db[(_0xf94d('0x8c'))][(_0xf94d('0x8d'))](_0xf94d('0x8e'));}if(!_0x58d008[_0xf94d('0x8f')](_0x49b97e[_0xf94d('0x57')]['oldPassword'])){throw new db[(_0xf94d('0x8c'))]['ValidationError'](_0xf94d('0x90'));}if(_0x49b97e[_0xf94d('0x57')][_0xf94d('0x8a')]===_0x49b97e[_0xf94d('0x57')][_0xf94d('0x8b')]){throw new db['Sequelize'][(_0xf94d('0x8d'))](_0xf94d('0x91'));}}else if(_0x49b97e['user'][_0xf94d('0x28')]===_0xf94d('0x78')){if(!_0x49b97e[_0xf94d('0x57')]['newPassword']){throw new db[(_0xf94d('0x8c'))][(_0xf94d('0x8d'))](_0xf94d('0x92'));}}else if(_0x49b97e[_0xf94d('0x77')][_0xf94d('0x28')]===_0xf94d('0x77')){if(!_0x49b97e['body']['newPassword']){throw new db[(_0xf94d('0x8c'))][(_0xf94d('0x8d'))](_0xf94d('0x92'));}if(_0x58d008[_0xf94d('0x28')]!==_0xf94d('0x29')){throw new db[(_0xf94d('0x8c'))][(_0xf94d('0x8d'))]('Unauthorized');}}else{throw new db['Sequelize'][(_0xf94d('0x8d'))](_0xf94d('0x80'));}return _0x58d008;})['then'](handleEntityNotFound(_0x5502ae,null))[_0xf94d('0x16')](function(_0x159316){return db['Setting'][_0xf94d('0x93')]({'attributes':['id',_0xf94d('0x5d'),_0xf94d('0x94'),_0xf94d('0x95')]})[_0xf94d('0x16')](function(_0x571f32){if(_0x571f32['securePassword'])authService[_0xf94d('0x96')](_0x49b97e['body']['newPassword']);if(!_0x571f32[_0xf94d('0x94')]||!_0x159316[_0xf94d('0x97')])return _0x159316;authService[_0xf94d('0x98')](_0x49b97e[_0xf94d('0x57')][_0xf94d('0x8b')],_0x159316[_0xf94d('0x97')],_0x571f32[_0xf94d('0x95')]);return _0x159316;})[_0xf94d('0x16')](saveUpdates({'password':_0x49b97e['body'][_0xf94d('0x8b')],'passwordResetAt':_0x49b97e['user']['id']==_0x49b97e['params']['id']?moment():null,'previousPasswords':authService[_0xf94d('0x99')](_0x49b97e['body'][_0xf94d('0x8b')],_0x159316[_0xf94d('0x97')])},null));})[_0xf94d('0x16')](respondWithResult(_0x5502ae,null))[_0xf94d('0x1f')](handleError(_0x5502ae,null));};exports[_0xf94d('0x9a')]=function(_0x170505,_0x579efc){var _0x410a84=_0x170505[_0xf94d('0x57')][_0xf94d('0x9b')];return db[_0xf94d('0x36')][_0xf94d('0x2e')]({'where':{'id':_0x170505[_0xf94d('0x4e')]['id']},'attributes':['id',_0xf94d('0x2f'),'role','online',_0xf94d('0x9c'),'voicePause',_0xf94d('0x9d')]})[_0xf94d('0x16')](handleEntityNotFound(_0x579efc,null))[_0xf94d('0x16')](function(_0x5941e4){if(_0x5941e4){if(!utils[_0xf94d('0x9e')](_0x410a84)){throw new db[(_0xf94d('0x8c'))]['ValidationError'](_0xf94d('0x9f'));}return _0x5941e4['add'+_[_0xf94d('0xa0')](_0x410a84[_0xf94d('0xa1')]())+_0xf94d('0xa2')](_0x170505['body']['ids'],{'penalty':_0x170505[_0xf94d('0x57')][_0xf94d('0xa3')]||0x0})[_0xf94d('0xa4')](function(_0x499054){for(var _0xbe6efc=0x0;_0xbe6efc<_0x170505[_0xf94d('0x57')]['ids'][_0xf94d('0x47')];_0xbe6efc+=0x1){var _0x29a4b2={'UserId':Number(_0x170505['params']['id'])};_0x29a4b2[_[_0xf94d('0xa0')](_0x410a84[_0xf94d('0xa1')]())+_0xf94d('0xa5')]=Number(_0x170505[_0xf94d('0x57')][_0xf94d('0x59')][_0xbe6efc]);socket['emit'](_0xf94d('0x77')+_[_0xf94d('0xa0')](_0x410a84[_0xf94d('0xa1')]())+'Queue:save',_0x29a4b2);}return _0x499054;})[_0xf94d('0x16')](function(){if(_0x410a84===_0xf94d('0xa6')){return db[_0xf94d('0xa7')]['findAll']({'where':{'id':_0x170505['body'][_0xf94d('0x59')]||[]},'raw':!![],'attributes':['id',_0xf94d('0x2f')]});}})[_0xf94d('0x16')](function(_0x2acb1f){var _0x1ffffa=_0x5941e4[_0xf94d('0xa8')]({'plain':!![]});var _0x10bd7a=[];if(_0x410a84===_0xf94d('0xa6')&&_0x1ffffa[_0xf94d('0x28')]===_0xf94d('0x29')&&_0x1ffffa[_0xf94d('0xa9')]){for(var _0x55bb2b=0x0;_0x55bb2b<_0x2acb1f[_0xf94d('0x47')];_0x55bb2b+=0x1){_0x10bd7a[_0xf94d('0x43')]({'membername':_0x1ffffa[_0xf94d('0x2f')],'UserId':_0x1ffffa['id'],'queue_name':_0x2acb1f[_0x55bb2b]['name'],'VoiceQueueId':_0x2acb1f[_0x55bb2b]['id'],'interface':_[_0xf94d('0x60')](_0x1ffffa['interface'])?util[_0xf94d('0xaa')](_0xf94d('0xab'),_0x1ffffa[_0xf94d('0x2f')]):_0x1ffffa[_0xf94d('0x9d')],'paused':_0x1ffffa[_0xf94d('0xac')]||![],'penalty':_0x170505[_0xf94d('0x57')][_0xf94d('0xa3')]||0x0});}return BPromise[_0xf94d('0x84')](_0x10bd7a,function(_0x172f65){return db[_0xf94d('0xad')][_0xf94d('0xae')](_0x172f65);});}return _0x5941e4;});}})[_0xf94d('0x16')](respondWithStatusCode(_0x579efc,null))['catch'](handleError(_0x579efc,null));};exports[_0xf94d('0xaf')]=function(_0x225945,_0x55fc02){var _0x14a27e;return db[_0xf94d('0x36')][_0xf94d('0x2e')]({'where':{'id':_0x225945[_0xf94d('0x4e')]['id']},'attributes':['id','name',_0xf94d('0x28')]})[_0xf94d('0x16')](handleEntityNotFound(_0x55fc02,null))[_0xf94d('0x16')](function(_0x2279f0){if(_0x2279f0){_0x14a27e=_0x2279f0;if(!_0x225945[_0xf94d('0x3f')][_0xf94d('0x9b')]||!utils[_0xf94d('0x9e')](_0x225945[_0xf94d('0x3f')][_0xf94d('0x9b')])){throw new db[(_0xf94d('0x8c'))]['ValidationError'](_0xf94d('0x9f'));}return _0x2279f0[_0xf94d('0xb0')+_[_0xf94d('0xa0')](_0x225945[_0xf94d('0x3f')][_0xf94d('0x9b')]['toLowerCase']())+_0xf94d('0xa2')](_0x225945[_0xf94d('0x3f')][_0xf94d('0x59')]);}})[_0xf94d('0x16')](function(_0x584f9a){if(_[_0xf94d('0xb1')](_0x225945['query']['ids'])){for(var _0x2b5ad5=0x0;_0x2b5ad5<_0x225945[_0xf94d('0x3f')][_0xf94d('0x59')][_0xf94d('0x47')];_0x2b5ad5+=0x1){var _0x2e4a09={'UserId':Number(_0x225945[_0xf94d('0x4e')]['id'])};_0x2e4a09[_[_0xf94d('0xa0')](_0x225945[_0xf94d('0x3f')][_0xf94d('0x9b')][_0xf94d('0xa1')]())+_0xf94d('0xa5')]=Number(_0x225945['query'][_0xf94d('0x59')][_0x2b5ad5]);socket[_0xf94d('0xb2')]('user'+_[_0xf94d('0xa0')](_0x225945[_0xf94d('0x3f')][_0xf94d('0x9b')][_0xf94d('0xa1')]())+_0xf94d('0xb3'),_0x2e4a09);}}else{var _0x2e4a09={'UserId':Number(_0x225945[_0xf94d('0x4e')]['id'])};_0x2e4a09[_[_0xf94d('0xa0')](_0x225945['query'][_0xf94d('0x9b')][_0xf94d('0xa1')]())+'QueueId']=Number(_0x225945[_0xf94d('0x3f')][_0xf94d('0x59')]);socket[_0xf94d('0xb2')](_0xf94d('0x77')+_[_0xf94d('0xa0')](_0x225945[_0xf94d('0x3f')][_0xf94d('0x9b')][_0xf94d('0xa1')]())+'Queue:remove',_0x2e4a09);}return _0x584f9a;})[_0xf94d('0x16')](function(){if(_0x225945[_0xf94d('0x3f')]['channel']==='voice'){return db[_0xf94d('0xad')][_0xf94d('0x31')]({'where':{'UserId':_0x225945[_0xf94d('0x4e')]['id'],'VoiceQueueId':_0x225945[_0xf94d('0x3f')][_0xf94d('0x59')]},'individualHooks':!![]})[_0xf94d('0x16')](function(){return _0x14a27e;});}return _0x14a27e;})[_0xf94d('0x16')](respondWithStatusCode(_0x55fc02,null))[_0xf94d('0x1f')](handleError(_0x55fc02,null));};exports['addAvatar']=function(_0x30ac24,_0x5b3fad){_0x30ac24['body'][_0xf94d('0xb4')]=_0x30ac24[_0xf94d('0xb5')]['filename'];return db['User'][_0xf94d('0x2e')]({'where':{'id':_0x30ac24['params']['id']}})[_0xf94d('0x16')](handleEntityNotFound(_0x5b3fad,null))['then'](saveUpdates(_0x30ac24[_0xf94d('0x57')],null))['then'](respondWithResult(_0x5b3fad,null))[_0xf94d('0x1f')](handleError(_0x5b3fad,null));};exports['getAvatar']=function(_0x3e126d,_0x2f49ab){var _0x288604=path['join'](config['root'],_0xf94d('0xb6'));return db[_0xf94d('0x36')][_0xf94d('0x2e')]({'where':{'id':_0x3e126d[_0xf94d('0x4e')]['id']},'attributes':['id',_0xf94d('0xb4')],'raw':!![]})['then'](handleEntityNotFound(_0x2f49ab,null))['then'](function(_0x4a945e){if(_0x4a945e){if(_[_0xf94d('0x60')](_0x4a945e['userpic'])){return _0x2f49ab[_0xf94d('0xb7')](_0x288604);}else{if(!fs[_0xf94d('0xb8')](path[_0xf94d('0xb9')](config[_0xf94d('0xba')],_0xf94d('0xbb'),_0x4a945e[_0xf94d('0xb4')]))){return _0x2f49ab[_0xf94d('0xb7')](_0x288604);}return _0x2f49ab['download'](path[_0xf94d('0xb9')](config[_0xf94d('0xba')],_0xf94d('0xbb'),_0x4a945e[_0xf94d('0xb4')]));}}})[_0xf94d('0x1f')](handleError(_0x2f49ab,null));};exports[_0xf94d('0xbc')]=function(_0x18f925,_0x5b4172){return db[_0xf94d('0x36')][_0xf94d('0x2e')]({'where':{'id':_0x18f925['params']['id']},'attributes':['id']})[_0xf94d('0x16')](handleEntityNotFound(_0x5b4172,null))['then'](function(_0x2b656a){var _0x60e767=[];values=_0x2b656a[_0xf94d('0x49')];_0x60e767['push'](get_open_tabs(_0xf94d('0x48'),_0x2b656a[_0xf94d('0x49')]));_0x60e767[_0xf94d('0x43')](get_open_tabs(_0xf94d('0x4a'),_0x2b656a[_0xf94d('0x49')]));_0x60e767[_0xf94d('0x43')](get_open_tabs(_0xf94d('0x4c'),_0x2b656a[_0xf94d('0x49')]));_0x60e767[_0xf94d('0x43')](get_open_tabs('whatsapp',_0x2b656a['dataValues']));_0x60e767[_0xf94d('0x43')](get_open_tabs('fax',_0x2b656a[_0xf94d('0x49')]));_0x60e767[_0xf94d('0x43')](get_open_tabs(_0xf94d('0x4b'),_0x2b656a[_0xf94d('0x49')]));return BPromise[_0xf94d('0x83')](_0x60e767);})[_0xf94d('0x16')](function(_0x434e7f){var _0x48ce29=[];if(_0x434e7f){for(var _0xd6f577=0x0;_0xd6f577=_0x924f6e){_0x5df04f=_0x924f6e;_0x1a6758=0xc8;}else{_0x1a6758=0xce;}_0x1a8d66[_0xfef0('0x1f')](_0x1a6758);return _0x1a8d66[_0xfef0('0x25')](_0xfef0('0x26'),_0xab231c+'-'+_0x5df04f+'/'+_0x924f6e)[_0xfef0('0x20')](_0x249fe4);}return null;};}function saveUpdates(_0x1ac4a3){return function(_0x3e3c4c){if(_0x3e3c4c){return _0x3e3c4c[_0xfef0('0x27')](_0x1ac4a3)[_0xfef0('0x13')](function(_0x213a91){return _0x213a91;});}return null;};}function removeEntity(_0x3ee42f){return function(_0x3ffea0){if(_0x3ffea0){return _0x3ffea0['destroy']()[_0xfef0('0x13')](function(){var _0x5806bd=_0x3ffea0['get']({'plain':!![]});if(_0x5806bd[_0xfef0('0x28')]===_0xfef0('0x29'))return;var _0x4a481d=[{'name':'Users','value':'user','ignore':!![]},{'name':'Agents','value':'agent','ignore':![]},{'name':_0xfef0('0x2a'),'value':_0xfef0('0x2b'),'ignore':![]}];var _0x2fffae=_(_0x4a481d)['filter']('ignore')['map'](_0xfef0('0x2c'))['value']();if(_[_0xfef0('0x2d')](_0x2fffae,_0x5806bd[_0xfef0('0x28')])){return;}var _0x1b9f39=_['find'](_0x4a481d,[_0xfef0('0x2c'),_0x5806bd['role']])[_0xfef0('0x2e')];return db[_0xfef0('0x2f')][_0xfef0('0x30')]({'where':{'type':_0x1b9f39,'resourceId':_0x5806bd['id']}})[_0xfef0('0x13')](function(){return _0x3ffea0;});})[_0xfef0('0x13')](function(){_0x3ee42f[_0xfef0('0x1f')](0xcc)[_0xfef0('0x31')]();});}};}function handleEntityNotFound(_0x2d97f8){return function(_0x590e37){if(!_0x590e37){_0x2d97f8[_0xfef0('0x1e')](0x194);}return _0x590e37;};}function handleError(_0xea09ec,_0x388518){_0x388518=_0x388518||0x1f4;return function(_0x36b2d1){logger[_0xfef0('0x1a')](_0x36b2d1[_0xfef0('0x32')]);if(_0x36b2d1[_0xfef0('0x2e')]){delete _0x36b2d1[_0xfef0('0x2e')];}_0xea09ec[_0xfef0('0x1f')](_0x388518)[_0xfef0('0x33')](_0x36b2d1);};}exports[_0xfef0('0x34')]=function(_0x22acf9,_0x366667){var _0x4a8af4={},_0x1f4a1e={'count':0x0,'rows':[]};var _0x4a42a3=_(db[_0xfef0('0x35')][_0xfef0('0x36')])[_0xfef0('0x37')](function(_0x4ab401){return{'name':_0x4ab401[_0xfef0('0x38')],'type':_0x4ab401[_0xfef0('0x39')][_0xfef0('0x3a')]};})['filter'](function(_0x8613a0){return!_[_0xfef0('0x2d')]([_0xfef0('0x3b'),'salt'],_0x8613a0[_0xfef0('0x2e')]);})['value']();_0x4a8af4=qs['getOptions'](_0x4a42a3,_0x22acf9);var _0xf30aff={'where':_0x4a8af4['where']};return db['User'][_0xfef0('0x23')](_0xf30aff)[_0xfef0('0x13')](function(_0xc3d208){_0x1f4a1e[_0xfef0('0x23')]=_0xc3d208;if(_0x22acf9[_0xfef0('0x3c')][_0xfef0('0x3d')]){_0x4a8af4['include']=[{'all':!![]}];}if(!_[_0xfef0('0x2d')](_0x4a8af4[_0xfef0('0x3e')],'id')){_0x4a8af4['attributes']['push']('id');}return db[_0xfef0('0x35')]['findAll'](_0x4a8af4);})[_0xfef0('0x13')](function(_0x22c940){_0x1f4a1e[_0xfef0('0x3f')]=_0x22c940;if(_0x22acf9[_0xfef0('0x3c')][_0xfef0('0x40')]===_0xfef0('0x41')){var _0x166a7b=[];for(var _0x15b4a6=0x0;_0x15b4a6<_0x1f4a1e['rows'][_0xfef0('0x42')];_0x15b4a6++){_0x166a7b['push'](get_open_tabs('chat',_0x1f4a1e[_0xfef0('0x3f')][_0x15b4a6][_0xfef0('0x43')]));_0x166a7b['push'](get_open_tabs(_0xfef0('0x44'),_0x1f4a1e['rows'][_0x15b4a6][_0xfef0('0x43')]));_0x166a7b[_0xfef0('0x45')](get_open_tabs(_0xfef0('0x46'),_0x1f4a1e[_0xfef0('0x3f')][_0x15b4a6]['dataValues']));_0x166a7b[_0xfef0('0x45')](get_open_tabs(_0xfef0('0x47'),_0x1f4a1e['rows'][_0x15b4a6]['dataValues']));_0x166a7b[_0xfef0('0x45')](get_open_tabs('openchannel',_0x1f4a1e[_0xfef0('0x3f')][_0x15b4a6][_0xfef0('0x43')]));_0x166a7b[_0xfef0('0x45')](get_open_tabs(_0xfef0('0x48'),_0x1f4a1e[_0xfef0('0x3f')][_0x15b4a6][_0xfef0('0x43')]));}return BPromise['all'](_0x166a7b)[_0xfef0('0x13')](function(_0x559a28){return _0x1f4a1e;});}else{return _0x1f4a1e;}})['then'](respondWithFilteredResult(_0x366667,_0x4a8af4))[_0xfef0('0x1d')](handleError(_0x366667,null));};exports[_0xfef0('0x49')]=function(_0x2299d4,_0x5a9750){var _0xca3c48={'raw':![],'where':{'id':_0x2299d4['params']['id']}},_0x4e1271={};_0x4e1271['model']=_[_0xfef0('0x4a')](_[_0xfef0('0x4b')](db[_0xfef0('0x35')][_0xfef0('0x36')]),[_0xfef0('0x3b'),_0xfef0('0x4c')]);_0x4e1271[_0xfef0('0x3c')]=_[_0xfef0('0x4b')](_0x2299d4[_0xfef0('0x3c')]);_0x4e1271['filters']=_['intersection'](_0x4e1271[_0xfef0('0x4d')],_0x4e1271[_0xfef0('0x3c')]);_0xca3c48[_0xfef0('0x3e')]=_[_0xfef0('0x4e')](_0x4e1271[_0xfef0('0x4d')],qs[_0xfef0('0x4f')](_0x2299d4[_0xfef0('0x3c')][_0xfef0('0x4f')]));_0xca3c48['attributes']=_0xca3c48[_0xfef0('0x3e')][_0xfef0('0x42')]?_0xca3c48[_0xfef0('0x3e')]:_0x4e1271[_0xfef0('0x4d')];if(_0x2299d4[_0xfef0('0x3c')]['includeAll']){_0xca3c48['include']=[{'all':!![]}];}_0xca3c48=_['merge']({},_0xca3c48,_0x2299d4[_0xfef0('0x50')]);if(!_[_0xfef0('0x2d')](_0xca3c48[_0xfef0('0x3e')],'id')){_0xca3c48[_0xfef0('0x3e')]['push']('id');}return db[_0xfef0('0x35')][_0xfef0('0x51')](_0xca3c48)[_0xfef0('0x13')](handleEntityNotFound(_0x5a9750,null))[_0xfef0('0x13')](function(_0x19dcd3){var _0x2f94c4=[];values=_0x19dcd3;if(_0x2299d4[_0xfef0('0x3c')]['openTabs']===_0xfef0('0x41')){_0x2f94c4[_0xfef0('0x45')](get_open_tabs('chat',_0x19dcd3[_0xfef0('0x43')]));_0x2f94c4['push'](get_open_tabs(_0xfef0('0x44'),_0x19dcd3[_0xfef0('0x43')]));_0x2f94c4['push'](get_open_tabs(_0xfef0('0x52'),_0x19dcd3['dataValues']));_0x2f94c4['push'](get_open_tabs('whatsapp',_0x19dcd3[_0xfef0('0x43')]));_0x2f94c4[_0xfef0('0x45')](get_open_tabs(_0xfef0('0x46'),_0x19dcd3[_0xfef0('0x43')]));_0x2f94c4[_0xfef0('0x45')](get_open_tabs(_0xfef0('0x47'),_0x19dcd3['dataValues']));return BPromise[_0xfef0('0x53')](_0x2f94c4);}else{return values;}})[_0xfef0('0x13')](function(_0x12f52d){return values;})[_0xfef0('0x13')](respondWithResult(_0x5a9750,null))[_0xfef0('0x1d')](handleError(_0x5a9750,null));};exports['update']=function(_0x59d1b6,_0x4aef94){if(_0x59d1b6[_0xfef0('0x54')]['id']){delete _0x59d1b6['body']['id'];}delete _0x59d1b6[_0xfef0('0x54')][_0xfef0('0x28')];return db[_0xfef0('0x35')][_0xfef0('0x51')]({'where':{'id':_0x59d1b6[_0xfef0('0x55')]['id']}})['then'](handleEntityNotFound(_0x4aef94,null))[_0xfef0('0x13')](saveUpdates(_0x59d1b6['body'],null))[_0xfef0('0x13')](respondWithResult(_0x4aef94,null))[_0xfef0('0x1d')](handleError(_0x4aef94,null));};exports['describe']=function(_0x3a12c5,_0x3c5640){return db[_0xfef0('0x35')][_0xfef0('0x56')]()[_0xfef0('0x13')](respondWithResult(_0x3c5640,null))[_0xfef0('0x1d')](handleError(_0x3c5640,null));};exports[_0xfef0('0x57')]=function(_0x10045c,_0x17a595){return db[_0xfef0('0x35')][_0xfef0('0x51')]({'where':{'id':_0x10045c[_0xfef0('0x55')]['id']}})['then'](handleEntityNotFound(_0x17a595,null))[_0xfef0('0x13')](function(_0x3b660c){if(_0x3b660c){return _0x3b660c[_0xfef0('0x57')](_0x10045c[_0xfef0('0x54')][_0xfef0('0x58')],_['omit'](_0x10045c[_0xfef0('0x54')],[_0xfef0('0x58'),'id'])||{});}})[_0xfef0('0x13')](respondWithResult(_0x17a595,null))[_0xfef0('0x1d')](handleError(_0x17a595,null));};function validateUser(_0x176fc7){return new BPromise(function(_0x1765e2,_0xb9693b){if(_0x176fc7[_0xfef0('0x59')])return _0x1765e2(_0x176fc7);return db[_0xfef0('0x5a')][_0xfef0('0x5b')](0x1)['then'](function(_0x100c6a){if(_0x100c6a['securePassword'])authService[_0xfef0('0x5c')](_0x176fc7[_0xfef0('0x3b')]);db['User'][_0xfef0('0x5d')](_0xfef0('0x59'))[_0xfef0('0x13')](function(_0x6a4d10){if(_[_0xfef0('0x5e')](_0x6a4d10)){_0x176fc7['internal']=_0x100c6a[_0xfef0('0x5f')]||0x1;return;}if(_[_0xfef0('0x5e')](_0x100c6a[_0xfef0('0x5f')])||_0x100c6a['min_internal']===_0x6a4d10){_0x176fc7[_0xfef0('0x59')]=_0x6a4d10+0x1;return;}if(_0x100c6a[_0xfef0('0x5f')]>_0x6a4d10){_0x176fc7[_0xfef0('0x59')]=_0x100c6a[_0xfef0('0x5f')];return;}return db[_0xfef0('0x60')][_0xfef0('0x3c')](_0xfef0('0x61'),{'type':db['sequelize'][_0xfef0('0x62')][_0xfef0('0x63')]})[_0xfef0('0x13')](function(_0x350ca1){if(_0x350ca1&&_0x350ca1[_0xfef0('0x42')]){for(var _0x2dde67=0x0,_0x488db4=_0x350ca1[_0xfef0('0x42')];_0x2dde67<_0x488db4&&_[_0xfef0('0x5e')](_0x176fc7[_0xfef0('0x59')]);_0x2dde67++){if(_0x100c6a[_0xfef0('0x5f')]<=_0x350ca1[_0x2dde67]['from']){_0x176fc7[_0xfef0('0x59')]=_0x350ca1[_0x2dde67][_0xfef0('0x64')];}else if(_0x100c6a['min_internal']>_0x350ca1[_0x2dde67][_0xfef0('0x64')]&&_0x100c6a[_0xfef0('0x5f')]<=_0x350ca1[_0x2dde67]['to']){_0x176fc7[_0xfef0('0x59')]=_0x100c6a[_0xfef0('0x5f')];}}}if(_[_0xfef0('0x5e')](_0x176fc7['internal'])){_0x176fc7['internal']=_0x6a4d10+0x1;}return _0x1765e2(_0x176fc7);});});})['catch'](function(_0x118fe7){_0xb9693b(_0x118fe7);});});}function updateUser(_0xe36e48){return new BPromise(function(_0x2474b2,_0x4a154e){try{if(_0xe36e48[_0xfef0('0x65')]){_0xe36e48['mailbox']=_0xe36e48['internal'];_0xe36e48['VoiceMail']={'mailbox':_0xe36e48[_0xfef0('0x59')],'password':_0xe36e48[_0xfef0('0x3b')],'fullname':_0xe36e48['fullname'],'email':_0xe36e48[_0xfef0('0x66')]};}if(_0xe36e48[_0xfef0('0x28')]===_0xfef0('0x67')){if(!_0xe36e48['permissions'])_0xe36e48[_0xfef0('0x68')]=['101','102',_0xfef0('0x69'),_0xfef0('0x6a'),_0xfef0('0x6b'),_0xfef0('0x6c'),'105','106','107',_0xfef0('0x6d'),'109',_0xfef0('0x6e'),_0xfef0('0x6f'),_0xfef0('0x70'),_0xfef0('0x71')];}_0x2474b2(_0xe36e48);}catch(_0x3a4c92){_0x4a154e(_0x3a4c92);}});}exports['create']=function(_0x2c4654,_0x501cda){if(_0x2c4654['user'][_0xfef0('0x28')]===_0xfef0('0x67'))throw new Error(_0xfef0('0x72'));if(_0x2c4654[_0xfef0('0x54')]['role']==='user'&&_0x2c4654[_0xfef0('0x73')][_0xfef0('0x28')]!=='admin'){throw new Error(_0xfef0('0x74'));}if(_0x2c4654[_0xfef0('0x54')][_0xfef0('0x28')]===_0xfef0('0x29')&&_0x2c4654[_0xfef0('0x73')][_0xfef0('0x28')]!==_0xfef0('0x29')){throw new Error(_0xfef0('0x75'));}return licenseUtil[_0xfef0('0x76')]([_0x2c4654[_0xfef0('0x54')]])[_0xfef0('0x13')](function(){return validateUser(_0x2c4654[_0xfef0('0x54')]);})[_0xfef0('0x13')](function(_0x357e69){return updateUser(_0x357e69)[_0xfef0('0x13')](function(_0x2240da){if(_0x2240da[_0xfef0('0x28')]==='admin'){_0x2240da[_0xfef0('0x77')]=_0x2c4654[_0xfef0('0x73')][_0xfef0('0x77')];delete _0x2240da[_0xfef0('0x78')];}return _0x2240da;});})[_0xfef0('0x13')](function(_0xa93548){return db[_0xfef0('0x35')][_0xfef0('0x79')](_0xa93548,{'include':[{'model':db[_0xfef0('0x7a')],'as':_0xfef0('0x7a')}]});})[_0xfef0('0x13')](function(_0x17c350){if(_0x2c4654[_0xfef0('0x54')]['role']===_0xfef0('0x73'))return _0x17c350;if(_0x2c4654['user']['role']!==_0xfef0('0x73'))return _0x17c350;return db[_0xfef0('0x7b')]['find']({'where':{'name':_0x17c350[_0xfef0('0x28')]==='agent'?'Agents':_0xfef0('0x2a'),'userProfileId':_0x2c4654[_0xfef0('0x73')][_0xfef0('0x78')]},'raw':!![]})[_0xfef0('0x13')](function(_0x4cf73e){if(!_0x4cf73e||_0x4cf73e[_0xfef0('0x7c')]!=0x0)return _0x17c350;return db[_0xfef0('0x2f')]['create']({'name':_0x17c350[_0xfef0('0x2e')],'resourceId':_0x17c350['id'],'type':_0x4cf73e[_0xfef0('0x2e')],'sectionId':_0x4cf73e['id']},{})[_0xfef0('0x13')](function(){return _0x17c350;});})['catch'](function(_0x5842fc){logger[_0xfef0('0x1a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5842fc);throw _0x5842fc;});})['then'](respondWithResult(_0x501cda,0xc9))[_0xfef0('0x1d')](handleError(_0x501cda,null));};exports['bulkCreate']=function(_0xa8abf9,_0x1f0f46){var _0x14fe33=_0xa8abf9[_0xfef0('0x54')];var _0x1375ea=[];if(_0xa8abf9[_0xfef0('0x73')][_0xfef0('0x28')]===_0xfef0('0x67'))throw new Error(_0xfef0('0x72'));if(_[_0xfef0('0x7d')](_0x14fe33,['role',_0xfef0('0x73')])&&_0xa8abf9['user']['role']!==_0xfef0('0x29')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0xfef0('0x7d')](_0x14fe33,[_0xfef0('0x28'),_0xfef0('0x29')])&&_0xa8abf9[_0xfef0('0x73')][_0xfef0('0x28')]!==_0xfef0('0x29')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0xfef0('0x76')](_0x14fe33)[_0xfef0('0x13')](function(){return validateUser(_0x14fe33[0x0]);})[_0xfef0('0x13')](function(){for(var _0x17a514=0x1;_0x17a514<_0x14fe33[_0xfef0('0x42')];_0x17a514++){var _0x46106f=_0x14fe33[_0x17a514-0x1][_0xfef0('0x59')];if(!_0x14fe33[_0x17a514][_0xfef0('0x59')])_0x14fe33[_0x17a514]['internal']=_0x46106f+0x1;_0x1375ea[_0xfef0('0x45')](validateUser(_0x14fe33[_0x17a514]));}return BPromise[_0xfef0('0x53')](_0x1375ea);})['then'](function(){_0x1375ea=[];for(var _0x6f61bc=0x0;_0x6f61bc<_0x14fe33[_0xfef0('0x42')];_0x6f61bc++){_0x1375ea[_0xfef0('0x45')](updateUser(_0x14fe33[_0x6f61bc]));}return BPromise['all'](_0x1375ea);})[_0xfef0('0x13')](function(){return BPromise['each'](_0x14fe33,function(_0x1cb952){return db[_0xfef0('0x35')]['create'](_0x1cb952,{'include':[{'model':db[_0xfef0('0x7a')],'as':'VoiceMail'}]})[_0xfef0('0x13')](function(_0x8c4979){_0x1cb952['id']=_0x8c4979['id'];return _0x1cb952;});});})[_0xfef0('0x13')](function(_0x3eff14){if(_0xa8abf9[_0xfef0('0x54')][_0xfef0('0x28')]===_0xfef0('0x73'))return _0x3eff14;if(_0xa8abf9[_0xfef0('0x73')][_0xfef0('0x28')]!==_0xfef0('0x73'))return _0x3eff14;var _0x31a5e2=_['some'](_0x3eff14,function(_0x35aab4){return _0x35aab4['role']==='agent'||_0x35aab4[_0xfef0('0x28')]==='telephone';});if(!_0x31a5e2)return _0x3eff14;return db[_0xfef0('0x7b')]['findAll']({'where':{'name':{'$or':['Agents',_0xfef0('0x2a')]},'userProfileId':_0xa8abf9['user']['userProfileId']},'raw':!![]})['then'](function(_0x21c9d6){if(_[_0xfef0('0x7e')](_0x21c9d6)||!_[_0xfef0('0x7d')](_0x21c9d6,[_0xfef0('0x7c'),0x0]))return _0x3eff14;_0x1375ea=[];var _0x4e52b1=_(_0x21c9d6)[_0xfef0('0x37')](function(_0x257ccf){if(_0x257ccf[_0xfef0('0x7c')]===0x1)return;return _0x257ccf[_0xfef0('0x2e')]===_0xfef0('0x7f')?'agent':'telephone';})[_0xfef0('0x80')]()[_0xfef0('0x2c')]();for(var _0x5ab4ce=0x0;_0x5ab4ce<_0x3eff14[_0xfef0('0x42')];_0x5ab4ce++){if(!_[_0xfef0('0x2d')](_0x4e52b1,_0x3eff14[_0x5ab4ce][_0xfef0('0x28')]))return;var _0x10ff58=_0x3eff14[_0x5ab4ce][_0xfef0('0x28')]===_0xfef0('0x67')?_0xfef0('0x7f'):_0xfef0('0x2a');_0x1375ea['push'](db['UserProfileResource'][_0xfef0('0x79')]({'name':_0x3eff14[_0x5ab4ce][_0xfef0('0x2e')],'resourceId':_0x3eff14[_0x5ab4ce]['id'],'type':_0x10ff58,'sectionId':_[_0xfef0('0x51')](_0x21c9d6,[_0xfef0('0x2e'),_0x10ff58])['id']},{}));}return BPromise[_0xfef0('0x53')](_0x1375ea);});})[_0xfef0('0x13')](respondWithResult(_0x1f0f46,0xc9))[_0xfef0('0x1d')](handleError(_0x1f0f46,null));};exports[_0xfef0('0x81')]=function(_0x4a63f7,_0x5d7df9){if(_0x4a63f7[_0xfef0('0x54')]['id']){delete _0x4a63f7[_0xfef0('0x54')]['id'];}return db[_0xfef0('0x35')][_0xfef0('0x51')]({'where':{'id':_0x4a63f7[_0xfef0('0x55')]['id']}})[_0xfef0('0x13')](function(_0x5ac2df){if(!_0x5ac2df)return null;if(_0x5ac2df['id']===_0x4a63f7[_0xfef0('0x73')]['id']){if(!_0x4a63f7[_0xfef0('0x54')]['oldPassword']||!_0x4a63f7[_0xfef0('0x54')][_0xfef0('0x82')]){throw new db[(_0xfef0('0x83'))][(_0xfef0('0x84'))](_0xfef0('0x85'));}if(!_0x5ac2df[_0xfef0('0x86')](_0x4a63f7['body']['oldPassword'])){throw new db[(_0xfef0('0x83'))][(_0xfef0('0x84'))](_0xfef0('0x87'));}if(_0x4a63f7[_0xfef0('0x54')][_0xfef0('0x88')]===_0x4a63f7[_0xfef0('0x54')]['newPassword']){throw new db[(_0xfef0('0x83'))]['ValidationError'](_0xfef0('0x89'));}}else if(_0x4a63f7['user'][_0xfef0('0x28')]===_0xfef0('0x29')){if(!_0x4a63f7['body'][_0xfef0('0x82')]){throw new db[(_0xfef0('0x83'))][(_0xfef0('0x84'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x4a63f7['user']['role']===_0xfef0('0x73')){if(!_0x4a63f7['body'][_0xfef0('0x82')]){throw new db[(_0xfef0('0x83'))]['ValidationError'](_0xfef0('0x8a'));}if(_0x5ac2df['role']!==_0xfef0('0x67')){throw new db[(_0xfef0('0x83'))][(_0xfef0('0x84'))](_0xfef0('0x72'));}}else{throw new db[(_0xfef0('0x83'))][(_0xfef0('0x84'))](_0xfef0('0x72'));}return _0x5ac2df;})['then'](handleEntityNotFound(_0x5d7df9,null))[_0xfef0('0x13')](function(_0x459ec2){return db[_0xfef0('0x5a')][_0xfef0('0x8b')]({'attributes':['id',_0xfef0('0x8c'),_0xfef0('0x8d'),_0xfef0('0x8e')]})[_0xfef0('0x13')](function(_0x358752){if(_0x358752[_0xfef0('0x8c')])authService[_0xfef0('0x5c')](_0x4a63f7[_0xfef0('0x54')][_0xfef0('0x82')]);if(!_0x358752[_0xfef0('0x8d')]||!_0x459ec2['previousPasswords'])return _0x459ec2;authService[_0xfef0('0x8f')](_0x4a63f7[_0xfef0('0x54')][_0xfef0('0x82')],_0x459ec2[_0xfef0('0x90')],_0x358752[_0xfef0('0x8e')]);return _0x459ec2;})[_0xfef0('0x13')](saveUpdates({'password':_0x4a63f7[_0xfef0('0x54')][_0xfef0('0x82')],'passwordResetAt':_0x4a63f7[_0xfef0('0x73')]['id']==_0x4a63f7['params']['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x4a63f7[_0xfef0('0x54')]['newPassword'],_0x459ec2[_0xfef0('0x90')])},null));})[_0xfef0('0x13')](respondWithResult(_0x5d7df9,null))[_0xfef0('0x1d')](handleError(_0x5d7df9,null));};exports[_0xfef0('0x91')]=function(_0xd9c290,_0x365938){var _0x274e8b=_0xd9c290[_0xfef0('0x54')][_0xfef0('0x92')];return db[_0xfef0('0x35')][_0xfef0('0x51')]({'where':{'id':_0xd9c290['params']['id']},'attributes':['id',_0xfef0('0x2e'),_0xfef0('0x28'),'online',_0xfef0('0x93'),_0xfef0('0x94'),'interface']})[_0xfef0('0x13')](handleEntityNotFound(_0x365938,null))['then'](function(_0x6ccbf8){if(_0x6ccbf8){if(!utils[_0xfef0('0x95')](_0x274e8b)){throw new db[(_0xfef0('0x83'))][(_0xfef0('0x84'))](_0xfef0('0x96'));}return _0x6ccbf8['add'+_[_0xfef0('0x97')](_0x274e8b[_0xfef0('0x98')]())+'Queues'](_0xd9c290[_0xfef0('0x54')]['ids'],{'penalty':_0xd9c290[_0xfef0('0x54')][_0xfef0('0x99')]||0x0})[_0xfef0('0x9a')](function(_0x52fb8b){for(var _0x4551b2=0x0;_0x4551b2<_0xd9c290['body']['ids'][_0xfef0('0x42')];_0x4551b2+=0x1){var _0x57b2b4={'UserId':Number(_0xd9c290[_0xfef0('0x55')]['id'])};_0x57b2b4[_[_0xfef0('0x97')](_0x274e8b[_0xfef0('0x98')]())+_0xfef0('0x9b')]=Number(_0xd9c290[_0xfef0('0x54')][_0xfef0('0x58')][_0x4551b2]);socket[_0xfef0('0x9c')]('user'+_['capitalize'](_0x274e8b[_0xfef0('0x98')]())+'Queue:save',_0x57b2b4);}return _0x52fb8b;})[_0xfef0('0x13')](function(){if(_0x274e8b===_0xfef0('0x9d')){return db[_0xfef0('0x9e')][_0xfef0('0x9f')]({'where':{'id':_0xd9c290[_0xfef0('0x54')][_0xfef0('0x58')]||[]},'raw':!![],'attributes':['id',_0xfef0('0x2e')]});}})[_0xfef0('0x13')](function(_0x4a3b68){var _0x4ef673=_0x6ccbf8[_0xfef0('0xa0')]({'plain':!![]});var _0x1393d7=[];if(_0x274e8b===_0xfef0('0x9d')&&_0x4ef673[_0xfef0('0x28')]===_0xfef0('0x67')&&_0x4ef673['online']){for(var _0x54d98e=0x0;_0x54d98e<_0x4a3b68['length'];_0x54d98e+=0x1){_0x1393d7[_0xfef0('0x45')]({'membername':_0x4ef673[_0xfef0('0x2e')],'UserId':_0x4ef673['id'],'queue_name':_0x4a3b68[_0x54d98e]['name'],'VoiceQueueId':_0x4a3b68[_0x54d98e]['id'],'interface':_[_0xfef0('0x5e')](_0x4ef673['interface'])?util[_0xfef0('0xa1')](_0xfef0('0xa2'),_0x4ef673[_0xfef0('0x2e')]):_0x4ef673[_0xfef0('0xa3')],'paused':_0x4ef673[_0xfef0('0x94')]||![],'penalty':_0xd9c290[_0xfef0('0x54')][_0xfef0('0x99')]||0x0});}return BPromise[_0xfef0('0xa4')](_0x1393d7,function(_0x9550cd){return db[_0xfef0('0xa5')][_0xfef0('0xa6')](_0x9550cd);});}return _0x6ccbf8;});}})['then'](respondWithStatusCode(_0x365938,null))[_0xfef0('0x1d')](handleError(_0x365938,null));};exports['removeQueues']=function(_0xf763b1,_0x1fc6a0){var _0x224ef2;return db[_0xfef0('0x35')][_0xfef0('0x51')]({'where':{'id':_0xf763b1[_0xfef0('0x55')]['id']},'attributes':['id',_0xfef0('0x2e'),_0xfef0('0x28')]})[_0xfef0('0x13')](handleEntityNotFound(_0x1fc6a0,null))['then'](function(_0x5b0658){if(_0x5b0658){_0x224ef2=_0x5b0658;if(!_0xf763b1[_0xfef0('0x3c')]['channel']||!utils[_0xfef0('0x95')](_0xf763b1[_0xfef0('0x3c')][_0xfef0('0x92')])){throw new db[(_0xfef0('0x83'))][(_0xfef0('0x84'))]('Unknown\x20channel');}return _0x5b0658[_0xfef0('0xa7')+_['capitalize'](_0xf763b1[_0xfef0('0x3c')][_0xfef0('0x92')]['toLowerCase']())+_0xfef0('0xa8')](_0xf763b1['query'][_0xfef0('0x58')]);}})['then'](function(_0x594edb){if(_[_0xfef0('0xa9')](_0xf763b1['query'][_0xfef0('0x58')])){for(var _0x31e833=0x0;_0x31e833<_0xf763b1[_0xfef0('0x3c')]['ids']['length'];_0x31e833+=0x1){var _0x42604b={'UserId':Number(_0xf763b1[_0xfef0('0x55')]['id'])};_0x42604b[_[_0xfef0('0x97')](_0xf763b1[_0xfef0('0x3c')][_0xfef0('0x92')][_0xfef0('0x98')]())+_0xfef0('0x9b')]=Number(_0xf763b1[_0xfef0('0x3c')][_0xfef0('0x58')][_0x31e833]);socket['emit'](_0xfef0('0x73')+_[_0xfef0('0x97')](_0xf763b1[_0xfef0('0x3c')][_0xfef0('0x92')][_0xfef0('0x98')]())+_0xfef0('0xaa'),_0x42604b);}}else{var _0x42604b={'UserId':Number(_0xf763b1['params']['id'])};_0x42604b[_[_0xfef0('0x97')](_0xf763b1[_0xfef0('0x3c')]['channel'][_0xfef0('0x98')]())+_0xfef0('0x9b')]=Number(_0xf763b1[_0xfef0('0x3c')][_0xfef0('0x58')]);socket[_0xfef0('0x9c')]('user'+_[_0xfef0('0x97')](_0xf763b1['query'][_0xfef0('0x92')]['toLowerCase']())+'Queue:remove',_0x42604b);}return _0x594edb;})['then'](function(){if(_0xf763b1[_0xfef0('0x3c')]['channel']==='voice'){return db[_0xfef0('0xa5')][_0xfef0('0x30')]({'where':{'UserId':_0xf763b1['params']['id'],'VoiceQueueId':_0xf763b1[_0xfef0('0x3c')][_0xfef0('0x58')]},'individualHooks':!![]})[_0xfef0('0x13')](function(){return _0x224ef2;});}return _0x224ef2;})['then'](respondWithStatusCode(_0x1fc6a0,null))['catch'](handleError(_0x1fc6a0,null));};exports[_0xfef0('0xab')]=function(_0x515381,_0x1fcb15){_0x515381[_0xfef0('0x54')][_0xfef0('0xac')]=_0x515381[_0xfef0('0xad')][_0xfef0('0xae')];return db['User'][_0xfef0('0x51')]({'where':{'id':_0x515381[_0xfef0('0x55')]['id']}})[_0xfef0('0x13')](handleEntityNotFound(_0x1fcb15,null))[_0xfef0('0x13')](saveUpdates(_0x515381['body'],null))['then'](respondWithResult(_0x1fcb15,null))[_0xfef0('0x1d')](handleError(_0x1fcb15,null));};exports[_0xfef0('0xaf')]=function(_0x1f7ae7,_0x2fb465){var _0x3de158=path[_0xfef0('0xb0')](config[_0xfef0('0xb1')],'server/files/images/logos/default_profile.png');return db['User']['find']({'where':{'id':_0x1f7ae7[_0xfef0('0x55')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0xfef0('0x13')](handleEntityNotFound(_0x2fb465,null))['then'](function(_0x2daf2a){if(_0x2daf2a){if(_['isNil'](_0x2daf2a[_0xfef0('0xac')])){return _0x2fb465[_0xfef0('0xb2')](_0x3de158);}else{if(!fs[_0xfef0('0xb3')](path[_0xfef0('0xb0')](config[_0xfef0('0xb1')],'server/files/images/',_0x2daf2a[_0xfef0('0xac')]))){return _0x2fb465[_0xfef0('0xb2')](_0x3de158);}return _0x2fb465[_0xfef0('0xb2')](path[_0xfef0('0xb0')](config['root'],_0xfef0('0xb4'),_0x2daf2a['userpic']));}}})['catch'](handleError(_0x2fb465,null));};exports[_0xfef0('0xb5')]=function(_0x4b4b9d,_0x51ba9a){return db[_0xfef0('0x35')]['find']({'where':{'id':_0x4b4b9d[_0xfef0('0x55')]['id']},'attributes':['id']})[_0xfef0('0x13')](handleEntityNotFound(_0x51ba9a,null))[_0xfef0('0x13')](function(_0x1437cb){var _0x3f3ce2=[];values=_0x1437cb[_0xfef0('0x43')];_0x3f3ce2['push'](get_open_tabs(_0xfef0('0xb6'),_0x1437cb[_0xfef0('0x43')]));_0x3f3ce2[_0xfef0('0x45')](get_open_tabs('sms',_0x1437cb[_0xfef0('0x43')]));_0x3f3ce2['push'](get_open_tabs(_0xfef0('0x52'),_0x1437cb[_0xfef0('0x43')]));_0x3f3ce2[_0xfef0('0x45')](get_open_tabs('whatsapp',_0x1437cb[_0xfef0('0x43')]));_0x3f3ce2['push'](get_open_tabs('fax',_0x1437cb[_0xfef0('0x43')]));_0x3f3ce2[_0xfef0('0x45')](get_open_tabs('mail',_0x1437cb[_0xfef0('0x43')]));return BPromise[_0xfef0('0x53')](_0x3f3ce2);})[_0xfef0('0x13')](function(_0xbb65fb){var _0x48a018=[];if(_0xbb65fb){for(var _0x5171a0=0x0;_0x5171a0=_0xd631e9['agents']){throw new Error(_0x033b('0x53'));}})[_0x033b('0x13')](function(){if(_0x55d314){return db[_0x033b('0x2f')][_0x033b('0x4c')]({'where':{'membername':_0x55d314[_0x033b('0x2c')]},'individualHooks':!![]});}})[_0x033b('0x13')](function(){if(_0x55d314){return _0x55d314[_0x033b('0x54')]({'raw':!![]});}})['then'](function(_0x2cea08){if(_0x55d314){if(_0x2cea08){var _0x51cc29=[];_0x2b185e=_0x2cea08;if(_0x2b185e['length']){for(var _0x3c9b05=0x0;_0x3c9b05<_0x2b185e[_0x033b('0x32')];_0x3c9b05++){_0x51cc29['push'](db[_0x033b('0x2f')]['upsert']({'membername':_0x55d314[_0x033b('0x2c')],'UserId':_0x55d314['id'],'queue_name':_0x2b185e[_0x3c9b05][_0x033b('0x2c')],'VoiceQueueId':_0x2b185e[_0x3c9b05]['id'],'interface':_0x5d8010,'paused':_0x55d314['loginInPause']||![],'penalty':_0x2b185e[_0x3c9b05][_0x033b('0x55')]||0x0}));}return BPromise[_0x033b('0x4b')](_0x51cc29);}}}})[_0x033b('0x13')](function(){if(_0x55d314){return db['MemberReport'][_0x033b('0x1f')]({'where':{'membername':_0x55d314[_0x033b('0x2c')],'exitAt':null}});}})[_0x033b('0x13')](function(_0x2a6a82){if(_0x55d314){if(_0x2a6a82&&_0x2a6a82['length']){var _0x2667c9=[];_0x2a6a82[_0x033b('0x56')](function(_0x484e82){_0x2667c9[_0x033b('0x37')](_0x484e82[_0x033b('0x30')]({'exitAt':moment()[_0x033b('0x33')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x2667c9);}}})[_0x033b('0x13')](function(_0x26f058){if(_0x55d314){var _0x59aa53=[];var _0x8c3f73=[];var _0x45ecb=utils['getChannels']();var _0x5d7009={'membername':_0x55d314['name'],'interface':_0x5d8010,'enterAt':moment()[_0x033b('0x33')](_0x033b('0x34')),'role':_0x55d314[_0x033b('0x2d')],'internal':_0x55d314['internal']};_0x45ecb[_0x033b('0x56')](function(_0x49ab40){_0x59aa53['push'](_[_0x033b('0x57')]({'channel':_0x49ab40,'type':_0x033b('0x58'),'data1':'callysquare','data2':_0x5d8010},_0x5d7009));if(_0x55d314['loginInPause']){_0x8c3f73['push'](_['merge']({'channel':_0x49ab40,'type':_0x033b('0x31'),'data1':'LOGININPAUSE'},_0x5d7009));}});return db[_0x033b('0x48')]['bulkCreate'](_0x59aa53[_0x033b('0x59')](_0x8c3f73),{'individualHooks':!![]});}})['then'](function(){if(_0x55d314){return _0x55d314['update']({'online':!![],'lastLoginAt':moment()['format'](_0x033b('0x34')),'voicePause':_0x55d314['loginInPause']||![],'mailPause':_0x55d314[_0x033b('0x50')]||![],'chatPause':_0x55d314[_0x033b('0x50')]||![],'faxPause':_0x55d314['loginInPause']||![],'smsPause':_0x55d314[_0x033b('0x50')]||![],'openchannelPause':_0x55d314[_0x033b('0x50')]||![],'pauseType':_0x55d314[_0x033b('0x50')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x033b('0x33')](_0x033b('0x34')),'interface':_0x5d8010});}})[_0x033b('0x13')](function(_0x3e5374){_0x18c0a5(_0x3e5374);})[_0x033b('0x28')](function(_0xf89f81){_0x33cfa8(_0x4dc41c['error'](0x1f4,_0xf89f81[_0x033b('0x1b')]));});});}; \ No newline at end of file +var _0x05ae=['LOGININPAUSE','lodash','util','randomstring','../../config/utils','../../config/logger','jayson/promise','client','defaults','localhost','redis','./user.socket','register','request','then','User,\x20%s,\x20%s','debug','User,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','GetUser','User','findAll','options','raw','where','attributes','limit','map','include','model','stringify','ShowUser','find','PauseUser','name','role','interface','update','MemberReport','length','format','updateAttributes','getChannels','forEach','push','isNil','SIP/%s','PAUSE','YYYY-MM-DD\x20HH:mm:ss','body','type','DEFAULT\x20PAUSE','internal','uniqueid','bulkCreate','findOne','channel','Unknown\x20channel','voice','UserVoiceQueueRt','system','mail','chat','fax','openchannel','set','all','LogoutUser','destroy','LoginUser','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','loginInPause','UserVoiceQueue.penalty','merge','LOGIN'];(function(_0x584b3e,_0x401737){var _0x5ac470=function(_0x4e4dea){while(--_0x4e4dea){_0x584b3e['push'](_0x584b3e['shift']());}};_0x5ac470(++_0x401737);}(_0x05ae,0xb1));var _0xe05a=function(_0x499573,_0x5e995b){_0x499573=_0x499573-0x0;var _0x1757e5=_0x05ae[_0x499573];return _0x1757e5;};'use strict';var _=require(_0xe05a('0x0'));var util=require(_0xe05a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe05a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe05a('0x3'));var logger=require(_0xe05a('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe05a('0x5'));var client=jayson[_0xe05a('0x6')]['http']({'port':0x232a});config['redis']=_[_0xe05a('0x7')](config['redis'],{'host':_0xe05a('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe05a('0x9')]));require(_0xe05a('0xa'))[_0xe05a('0xb')](socket);function respondWithRpcPromise(_0x8077ee,_0x141e5d,_0x34566d){return new BPromise(function(_0x55e19c,_0x4f44d3){return client[_0xe05a('0xc')](_0x8077ee,_0x34566d)[_0xe05a('0xd')](function(_0x1e06d2){logger['info'](_0xe05a('0xe'),_0x141e5d,'request\x20sent');logger[_0xe05a('0xf')](_0xe05a('0x10'),_0x141e5d,_0xe05a('0x11'),JSON['stringify'](_0x1e06d2));if(_0x1e06d2[_0xe05a('0x12')]){if(_0x1e06d2[_0xe05a('0x12')][_0xe05a('0x13')]===0x1f4){logger['error'](_0xe05a('0xe'),_0x141e5d,_0x1e06d2[_0xe05a('0x12')][_0xe05a('0x14')]);return _0x4f44d3(_0x1e06d2[_0xe05a('0x12')][_0xe05a('0x14')]);}logger['error'](_0xe05a('0xe'),_0x141e5d,_0x1e06d2[_0xe05a('0x12')][_0xe05a('0x14')]);return _0x55e19c(_0x1e06d2[_0xe05a('0x12')]['message']);}else{logger[_0xe05a('0x15')](_0xe05a('0xe'),_0x141e5d,'request\x20sent');_0x55e19c(_0x1e06d2[_0xe05a('0x16')][_0xe05a('0x14')]);}})[_0xe05a('0x17')](function(_0x35d89f){logger[_0xe05a('0x12')](_0xe05a('0xe'),_0x141e5d,_0x35d89f);_0x4f44d3(_0x35d89f);});});}exports[_0xe05a('0x18')]=function(_0x2acf60){var _0x4192dd=this;return new Promise(function(_0x4c1b6e,_0x4303ee){return db[_0xe05a('0x19')][_0xe05a('0x1a')]({'raw':_0x2acf60['options']?_0x2acf60[_0xe05a('0x1b')][_0xe05a('0x1c')]===undefined?!![]:![]:!![],'where':_0x2acf60[_0xe05a('0x1b')]?_0x2acf60['options'][_0xe05a('0x1d')]||null:null,'attributes':_0x2acf60[_0xe05a('0x1b')]?_0x2acf60[_0xe05a('0x1b')][_0xe05a('0x1e')]||null:null,'limit':_0x2acf60[_0xe05a('0x1b')]?_0x2acf60[_0xe05a('0x1b')][_0xe05a('0x1f')]||null:null,'include':_0x2acf60[_0xe05a('0x1b')]?_0x2acf60['options']['include']?_[_0xe05a('0x20')](_0x2acf60[_0xe05a('0x1b')][_0xe05a('0x21')],function(_0x308bde){return{'model':db[_0x308bde[_0xe05a('0x22')]],'as':_0x308bde['as'],'attributes':_0x308bde[_0xe05a('0x1e')],'include':_0x308bde[_0xe05a('0x21')]?_[_0xe05a('0x20')](_0x308bde[_0xe05a('0x21')],function(_0x186b1e){return{'model':db[_0x186b1e['model']],'as':_0x186b1e['as'],'attributes':_0x186b1e[_0xe05a('0x1e')],'include':_0x186b1e[_0xe05a('0x21')]?_['map'](_0x186b1e['include'],function(_0x533d09){return{'model':db[_0x533d09['model']],'as':_0x533d09['as'],'attributes':_0x533d09[_0xe05a('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x363655){logger[_0xe05a('0x15')]('GetUser',_0x2acf60);logger[_0xe05a('0xf')]('GetUser',_0x2acf60,JSON[_0xe05a('0x23')](_0x363655));_0x4c1b6e(_0x363655);})[_0xe05a('0x17')](function(_0x25a7ae){logger[_0xe05a('0x12')]('GetUser',_0x25a7ae[_0xe05a('0x14')],_0x2acf60);_0x4303ee(_0x4192dd[_0xe05a('0x12')](0x1f4,_0x25a7ae['message']));});});};exports[_0xe05a('0x24')]=function(_0x54c7b9){var _0x4a00bd=this;return new Promise(function(_0x4410ad,_0x3467ce){return db['User'][_0xe05a('0x25')]({'raw':_0x54c7b9['options']?_0x54c7b9['options'][_0xe05a('0x1c')]===undefined?!![]:![]:!![],'where':_0x54c7b9[_0xe05a('0x1b')]?_0x54c7b9['options'][_0xe05a('0x1d')]||null:null,'attributes':_0x54c7b9[_0xe05a('0x1b')]?_0x54c7b9[_0xe05a('0x1b')][_0xe05a('0x1e')]||null:null,'include':_0x54c7b9[_0xe05a('0x1b')]?_0x54c7b9[_0xe05a('0x1b')][_0xe05a('0x21')]?_['map'](_0x54c7b9[_0xe05a('0x1b')]['include'],function(_0x1cb4c8){return{'model':db[_0x1cb4c8[_0xe05a('0x22')]],'as':_0x1cb4c8['as'],'attributes':_0x1cb4c8[_0xe05a('0x1e')],'include':_0x1cb4c8[_0xe05a('0x21')]?_['map'](_0x1cb4c8[_0xe05a('0x21')],function(_0x506667){return{'model':db[_0x506667[_0xe05a('0x22')]],'as':_0x506667['as'],'attributes':_0x506667['attributes'],'include':_0x506667[_0xe05a('0x21')]?_[_0xe05a('0x20')](_0x506667[_0xe05a('0x21')],function(_0x2b2230){return{'model':db[_0x2b2230[_0xe05a('0x22')]],'as':_0x2b2230['as'],'attributes':_0x2b2230[_0xe05a('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xe05a('0xd')](function(_0xcc4010){logger[_0xe05a('0x15')](_0xe05a('0x24'),_0x54c7b9);logger['debug'](_0xe05a('0x24'),_0x54c7b9,JSON[_0xe05a('0x23')](_0xcc4010));_0x4410ad(_0xcc4010);})[_0xe05a('0x17')](function(_0x5e5143){logger[_0xe05a('0x12')](_0xe05a('0x24'),_0x5e5143['message'],_0x54c7b9);_0x3467ce(_0x4a00bd['error'](0x1f4,_0x5e5143[_0xe05a('0x14')]));});});};exports[_0xe05a('0x26')]=function(_0x402657){var _0x38bbb6=this;return new Promise(function(_0x42c4c8,_0x280062){var _0x25d192;return db[_0xe05a('0x19')][_0xe05a('0x25')]({'where':_0x402657[_0xe05a('0x1b')][_0xe05a('0x1d')]||{},'attributes':['id',_0xe05a('0x27'),_0xe05a('0x28'),'internal',_0xe05a('0x29')]})[_0xe05a('0xd')](function(_0x4aee05){if(_0x4aee05){_0x25d192=_0x4aee05;return db['UserVoiceQueueRt'][_0xe05a('0x2a')]({'paused':0x1},{'where':{'UserId':_0x25d192['id']},'individualHooks':!![]});}})['then'](function(){if(_0x25d192){return db[_0xe05a('0x2b')][_0xe05a('0x1a')]({'where':{'membername':_0x25d192[_0xe05a('0x27')],'type':'PAUSE','exitAt':null}});}})[_0xe05a('0xd')](function(_0xc2ecdb){if(_0x25d192){if(_0xc2ecdb&&_0xc2ecdb[_0xe05a('0x2c')]){var _0x4fda3b=moment()[_0xe05a('0x2d')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x5cd30e=0x0,_0x56c722=_0xc2ecdb[_0xe05a('0x2c')];_0x5cd30e<_0x56c722;_0x5cd30e++){_0xc2ecdb[_0x5cd30e][_0xe05a('0x2e')]({'exitAt':_0x4fda3b});}}}})[_0xe05a('0xd')](function(){if(_0x25d192){var _0xf33554=[];var _0x29f70c=utils[_0xe05a('0x2f')]();_0x29f70c[_0xe05a('0x30')](function(_0x3194a5){_0xf33554[_0xe05a('0x31')]({'channel':_0x3194a5,'membername':_0x25d192[_0xe05a('0x27')],'interface':_[_0xe05a('0x32')](_0x25d192[_0xe05a('0x29')])?util[_0xe05a('0x2d')](_0xe05a('0x33'),_0x25d192[_0xe05a('0x27')]):_0x25d192[_0xe05a('0x29')],'type':_0xe05a('0x34'),'enterAt':moment()[_0xe05a('0x2d')](_0xe05a('0x35')),'data1':_0x402657[_0xe05a('0x36')][_0xe05a('0x37')]||_0xe05a('0x38'),'role':_0x25d192['role'],'internal':_0x25d192[_0xe05a('0x39')],'uniqueid':_0x402657[_0xe05a('0x36')][_0xe05a('0x3a')]||null});});return db['MemberReport'][_0xe05a('0x3b')](_0xf33554,{'individualHooks':!![]});}})[_0xe05a('0xd')](function(){if(_0x25d192){return _0x25d192['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x402657[_0xe05a('0x36')]['type']||_0xe05a('0x38'),'lastPauseAt':moment()[_0xe05a('0x2d')](_0xe05a('0x35'))});}})[_0xe05a('0xd')](function(_0x1273b8){_0x42c4c8(_0x1273b8);})['catch'](function(_0xadf727){_0x280062(_0x38bbb6[_0xe05a('0x12')](0x1f4,_0xadf727[_0xe05a('0x14')]));});});};exports['UnpauseUser']=function(_0x441bb5){var _0x3d3d49=this;return new Promise(function(_0x440984,_0x135719){var _0x335f8d;return db[_0xe05a('0x19')][_0xe05a('0x3c')]({'where':_0x441bb5['options'][_0xe05a('0x1d')]||{},'attributes':['id',_0xe05a('0x27')]})[_0xe05a('0xd')](function(_0x401550){if(_0x401550){_0x335f8d=_0x401550;if(_0x441bb5[_0xe05a('0x36')][_0xe05a('0x3d')]&&!utils['isValidChannel'](_0x441bb5[_0xe05a('0x36')][_0xe05a('0x3d')])){throw new Error(_0xe05a('0x3e'));}switch(_0x441bb5[_0xe05a('0x36')][_0xe05a('0x3d')]){case _0xe05a('0x3f'):return db[_0xe05a('0x40')][_0xe05a('0x2a')]({'paused':0x0},{'where':{'UserId':_0x335f8d['id']}})[_0xe05a('0xd')](function(){return db['MemberReport'][_0xe05a('0x25')]({'where':{'channel':_0x441bb5['body']['channel'],'membername':_0x335f8d[_0xe05a('0x27')],'type':_0xe05a('0x34'),'exitAt':null}});})[_0xe05a('0xd')](function(_0x478635){if(_0x478635){return _0x478635['update']({'exitAt':moment()[_0xe05a('0x2d')](_0xe05a('0x35')),'data2':_0xe05a('0x41')},{'individualHooks':!![]});}return null;})[_0xe05a('0xd')](function(){return _0x335f8d[_0xe05a('0x2a')]({'voicePause':![]});});case _0xe05a('0x42'):case _0xe05a('0x43'):case _0xe05a('0x44'):case'sms':case _0xe05a('0x45'):case'whatsapp':return db[_0xe05a('0x2b')][_0xe05a('0x25')]({'where':{'channel':_0x441bb5[_0xe05a('0x36')][_0xe05a('0x3d')],'membername':_0x335f8d['name'],'type':_0xe05a('0x34'),'exitAt':null}})[_0xe05a('0xd')](function(_0x18215d){return _0x18215d[_0xe05a('0x2a')]({'exitAt':moment()[_0xe05a('0x2d')](_0xe05a('0x35')),'data2':_0xe05a('0x41')},{'individualHooks':!![]});})[_0xe05a('0xd')](function(){var _0xd0c6cb={};_[_0xe05a('0x46')](_0xd0c6cb,util[_0xe05a('0x2d')]('%s%s',_0x441bb5[_0xe05a('0x36')][_0xe05a('0x3d')],'Pause'),![]);return _0x335f8d[_0xe05a('0x2a')](_0xd0c6cb);});default:return db['UserVoiceQueueRt']['update']({'paused':0x0},{'where':{'UserId':_0x335f8d['id']}})['then'](function(){return db[_0xe05a('0x2b')][_0xe05a('0x1a')]({'where':{'membername':_0x335f8d[_0xe05a('0x27')],'type':'PAUSE','exitAt':null}});})[_0xe05a('0xd')](function(_0x19f4ef){var _0x13b318=[];_0x19f4ef[_0xe05a('0x30')](function(_0x33f218){_0x13b318[_0xe05a('0x31')](_0x33f218[_0xe05a('0x2a')]({'exitAt':moment()[_0xe05a('0x2d')](_0xe05a('0x35')),'data2':_0xe05a('0x41')}));});return BPromise[_0xe05a('0x47')](_0x13b318);})[_0xe05a('0xd')](function(){return _0x335f8d[_0xe05a('0x2a')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0xe05a('0xd')](function(_0x1eaba4){_0x440984(_0x1eaba4);})[_0xe05a('0x17')](function(_0x587f8f){_0x135719(_0x3d3d49[_0xe05a('0x12')](0x1f4,_0x587f8f[_0xe05a('0x14')]));});});};exports[_0xe05a('0x48')]=function(_0x2c7c48){var _0x432a38=this;return new Promise(function(_0x3f4ddf,_0x3f92e5){var _0x569c8b;return db[_0xe05a('0x19')][_0xe05a('0x3c')]({'where':_0x2c7c48[_0xe05a('0x1b')][_0xe05a('0x1d')]||{},'attributes':['id',_0xe05a('0x27')]})[_0xe05a('0xd')](function(_0x9a6ae0){if(_0x9a6ae0){_0x569c8b=_0x9a6ae0;return db[_0xe05a('0x40')][_0xe05a('0x49')]({'where':{'membername':_0x569c8b[_0xe05a('0x27')]},'individualHooks':!![]});}})[_0xe05a('0xd')](function(){if(_0x569c8b){return db['MemberReport'][_0xe05a('0x1a')]({'where':{'membername':_0x569c8b[_0xe05a('0x27')],'exitAt':null}});}})[_0xe05a('0xd')](function(_0x21a8fb){if(_0x569c8b){if(_0x21a8fb&&_0x21a8fb['length']){var _0xd3a209=[];_0x21a8fb['forEach'](function(_0xb98a41){_0xd3a209[_0xe05a('0x31')](_0xb98a41['update']({'exitAt':moment()[_0xe05a('0x2d')](_0xe05a('0x35'))}));});return BPromise[_0xe05a('0x47')](_0xd3a209);}}})[_0xe05a('0xd')](function(){if(_0x569c8b){return _0x569c8b[_0xe05a('0x2a')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xe05a('0xd')](function(_0x10de66){_0x3f4ddf(_0x10de66);})[_0xe05a('0x17')](function(_0x572a99){_0x3f92e5(_0x432a38[_0xe05a('0x12')](0x1f4,_0x572a99[_0xe05a('0x14')]));});});};exports[_0xe05a('0x4a')]=function(_0x209b48){var _0x143481=this;return new Promise(function(_0x2e9468,_0x290427){var _0x48aca5;var _0x40e042;var _0x49c39e;var _0x187cee;return db[_0xe05a('0x19')]['findOne']({'where':_0x209b48[_0xe05a('0x1b')][_0xe05a('0x1d')]||{},'attributes':['id',_0xe05a('0x27'),'role','mobile','phone',_0xe05a('0x39'),'loginInPause',_0xe05a('0x29')]})['then'](function(_0x3d3aa7){if(_0x3d3aa7){_0x48aca5=_0x3d3aa7;_0x187cee=_0x209b48[_0xe05a('0x36')][_0xe05a('0x29')]?_0x209b48[_0xe05a('0x36')][_0xe05a('0x29')]:util[_0xe05a('0x2d')](_0xe05a('0x33'),_0x48aca5[_0xe05a('0x27')]);return db[_0xe05a('0x19')][_0xe05a('0x4b')]({'where':{'role':_0xe05a('0x4c'),'online':!![],'id':{'$ne':_0x48aca5['id']}}});}})['then'](function(_0x3021ba){if(_0x3021ba){_0x49c39e=_0x3021ba;return require(_0xe05a('0x4d'))[_0xe05a('0x4e')]();}})[_0xe05a('0xd')](function(_0x51f445){if(_0x51f445&&_0x51f445['agents']&&_0x49c39e>=_0x51f445[_0xe05a('0x4f')]){throw new Error(_0xe05a('0x50'));}})['then'](function(){if(_0x48aca5){return db[_0xe05a('0x40')][_0xe05a('0x49')]({'where':{'membername':_0x48aca5[_0xe05a('0x27')]},'individualHooks':!![]});}})[_0xe05a('0xd')](function(){if(_0x48aca5){return _0x48aca5[_0xe05a('0x51')]({'raw':!![]});}})[_0xe05a('0xd')](function(_0x59fa70){if(_0x48aca5){if(_0x59fa70){var _0x40d943=[];_0x40e042=_0x59fa70;if(_0x40e042[_0xe05a('0x2c')]){for(var _0xe3f4aa=0x0;_0xe3f4aa<_0x40e042[_0xe05a('0x2c')];_0xe3f4aa++){_0x40d943['push'](db['UserVoiceQueueRt'][_0xe05a('0x52')]({'membername':_0x48aca5['name'],'UserId':_0x48aca5['id'],'queue_name':_0x40e042[_0xe3f4aa][_0xe05a('0x27')],'VoiceQueueId':_0x40e042[_0xe3f4aa]['id'],'interface':_0x187cee,'paused':_0x48aca5[_0xe05a('0x53')]||![],'penalty':_0x40e042[_0xe3f4aa][_0xe05a('0x54')]||0x0}));}return BPromise['all'](_0x40d943);}}}})[_0xe05a('0xd')](function(){if(_0x48aca5){return db['MemberReport'][_0xe05a('0x1a')]({'where':{'membername':_0x48aca5['name'],'exitAt':null}});}})[_0xe05a('0xd')](function(_0x109592){if(_0x48aca5){if(_0x109592&&_0x109592['length']){var _0x425102=[];_0x109592[_0xe05a('0x30')](function(_0x238bde){_0x425102[_0xe05a('0x31')](_0x238bde[_0xe05a('0x2a')]({'exitAt':moment()[_0xe05a('0x2d')](_0xe05a('0x35'))}));});return BPromise[_0xe05a('0x47')](_0x425102);}}})[_0xe05a('0xd')](function(_0x54b121){if(_0x48aca5){var _0x355577=[];var _0x4228a7=[];var _0xb20883=utils['getChannels']();var _0xe1ab1f={'membername':_0x48aca5['name'],'interface':_0x187cee,'enterAt':moment()[_0xe05a('0x2d')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x48aca5[_0xe05a('0x28')],'internal':_0x48aca5['internal']};_0xb20883[_0xe05a('0x30')](function(_0x19bde5){_0x355577[_0xe05a('0x31')](_[_0xe05a('0x55')]({'channel':_0x19bde5,'type':_0xe05a('0x56'),'data1':'callysquare','data2':_0x187cee},_0xe1ab1f));if(_0x48aca5['loginInPause']){_0x4228a7[_0xe05a('0x31')](_[_0xe05a('0x55')]({'channel':_0x19bde5,'type':_0xe05a('0x34'),'data1':_0xe05a('0x57')},_0xe1ab1f));}});return db['MemberReport'][_0xe05a('0x3b')](_0x355577['concat'](_0x4228a7),{'individualHooks':!![]});}})['then'](function(){if(_0x48aca5){return _0x48aca5[_0xe05a('0x2a')]({'online':!![],'lastLoginAt':moment()[_0xe05a('0x2d')](_0xe05a('0x35')),'voicePause':_0x48aca5['loginInPause']||![],'mailPause':_0x48aca5[_0xe05a('0x53')]||![],'chatPause':_0x48aca5[_0xe05a('0x53')]||![],'faxPause':_0x48aca5[_0xe05a('0x53')]||![],'smsPause':_0x48aca5[_0xe05a('0x53')]||![],'openchannelPause':_0x48aca5['loginInPause']||![],'pauseType':_0x48aca5[_0xe05a('0x53')]?_0xe05a('0x57'):null,'lastPauseAt':moment()['format'](_0xe05a('0x35')),'interface':_0x187cee});}})[_0xe05a('0xd')](function(_0x8732d6){_0x2e9468(_0x8732d6);})['catch'](function(_0x5111eb){_0x290427(_0x143481[_0xe05a('0x12')](0x1f4,_0x5111eb[_0xe05a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 76180bf..eb6c6cd 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 _0x23f5=['save','update','emit','length','user:'];(function(_0x20e39,_0x2ff74f){var _0x44dc53=function(_0x5d5383){while(--_0x5d5383){_0x20e39['push'](_0x20e39['shift']());}};_0x44dc53(++_0x2ff74f);}(_0x23f5,0xaa));var _0x523f=function(_0x3a081b,_0x516437){_0x3a081b=_0x3a081b-0x0;var _0xb166c4=_0x23f5[_0x3a081b];return _0xb166c4;};'use strict';var UserEvents=require('./user.events');var events=[_0x523f('0x0'),'remove',_0x523f('0x1')];function createListener(_0x9b84a,_0x5dca2d){return function(_0x485656){_0x5dca2d[_0x523f('0x2')](_0x9b84a,_0x485656);};}function removeListener(_0x37ab1e,_0x4f016e){return function(){UserEvents['removeListener'](_0x37ab1e,_0x4f016e);};}exports['register']=function(_0xbbdcd0){for(var _0x4d1a2f=0x0,_0xdcc8ad=events[_0x523f('0x3')];_0x4d1a2f<_0xdcc8ad;_0x4d1a2f++){var _0x380fa9=events[_0x4d1a2f];var _0x15de58=createListener(_0x523f('0x4')+_0x380fa9,_0xbbdcd0);UserEvents['on'](_0x380fa9,_0x15de58);}}; \ No newline at end of file +var _0x8adc=['user:','./user.events','save','remove','update','emit','removeListener','length'];(function(_0xc33187,_0x5068ab){var _0x5c615a=function(_0x4c6e64){while(--_0x4c6e64){_0xc33187['push'](_0xc33187['shift']());}};_0x5c615a(++_0x5068ab);}(_0x8adc,0x99));var _0xc8ad=function(_0x33080e,_0x1c600a){_0x33080e=_0x33080e-0x0;var _0x407395=_0x8adc[_0x33080e];return _0x407395;};'use strict';var UserEvents=require(_0xc8ad('0x0'));var events=[_0xc8ad('0x1'),_0xc8ad('0x2'),_0xc8ad('0x3')];function createListener(_0x6553fe,_0x1e9b20){return function(_0xc07a5){_0x1e9b20[_0xc8ad('0x4')](_0x6553fe,_0xc07a5);};}function removeListener(_0x1ce056,_0x183a40){return function(){UserEvents[_0xc8ad('0x5')](_0x1ce056,_0x183a40);};}exports['register']=function(_0x16ab08){for(var _0x19beed=0x0,_0x1cd1e1=events[_0xc8ad('0x6')];_0x19beed<_0x1cd1e1;_0x19beed++){var _0x5e7c15=events[_0x19beed];var _0x274fcc=createListener(_0xc8ad('0x7')+_0x5e7c15,_0x16ab08);UserEvents['on'](_0x5e7c15,_0x274fcc);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index f74fd57..1a9333c 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0xa7d2bc,_0x209035){var _0x45c307=function(_0x328c4d){while(--_0x328c4d){_0xa7d2bc['push'](_0xa7d2bc['shift']());}};_0x45c307(++_0x209035);}(_0xe706,0xa3));var _0x6e70=function(_0x31a180,_0x3924b9){_0x31a180=_0x31a180-0x0;var _0x4b0502=_0xe706[_0x31a180];return _0x4b0502;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x104f03,_0x52a067){var _0x560ac1=function(_0x331fad){while(--_0x331fad){_0x104f03['push'](_0x104f03['shift']());}};_0x560ac1(++_0x52a067);}(_0x70e0,0x17b));var _0x070e=function(_0x1d50d3,_0x4efaeb){_0x1d50d3=_0x1d50d3-0x0;var _0x2adca2=_0x70e0[_0x1d50d3];return _0x2adca2;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 43bc327..a09ef4d 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 _0xe2e2=['sequelize','exports','INTEGER'];(function(_0x1f12ef,_0x4dddf2){var _0x3301d7=function(_0x54472d){while(--_0x54472d){_0x1f12ef['push'](_0x1f12ef['shift']());}};_0x3301d7(++_0x4dddf2);}(_0xe2e2,0xe4));var _0x2e2e=function(_0x258127,_0x4ef448){_0x258127=_0x258127-0x0;var _0x2bf1d7=_0xe2e2[_0x258127];return _0x2bf1d7;};'use strict';var Sequelize=require(_0x2e2e('0x0'));module[_0x2e2e('0x1')]={'penalty':{'type':Sequelize[_0x2e2e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd083=['exports','sequelize'];(function(_0x2ed656,_0x3cc0ef){var _0x1c9bb6=function(_0x322423){while(--_0x322423){_0x2ed656['push'](_0x2ed656['shift']());}};_0x1c9bb6(++_0x3cc0ef);}(_0xd083,0x19b));var _0x3d08=function(_0x39ea42,_0x3c1f50){_0x39ea42=_0x39ea42-0x0;var _0x33f5b7=_0xd083[_0x39ea42];return _0x33f5b7;};'use strict';var Sequelize=require(_0x3d08('0x0'));module[_0x3d08('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index b69ec53..7bb3b6f 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 _0x6d69=['user_has_chat_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes'];(function(_0x5f5495,_0x30d087){var _0x14d8a3=function(_0x40e773){while(--_0x40e773){_0x5f5495['push'](_0x5f5495['shift']());}};_0x14d8a3(++_0x30d087);}(_0x6d69,0xbc));var _0x96d6=function(_0x4cbe35,_0x38c4c2){_0x4cbe35=_0x4cbe35-0x0;var _0x2bb9ba=_0x6d69[_0x4cbe35];return _0x2bb9ba;};'use strict';var _=require(_0x96d6('0x0'));var util=require(_0x96d6('0x1'));var logger=require(_0x96d6('0x2'))(_0x96d6('0x3'));var moment=require('moment');var BPromise=require(_0x96d6('0x4'));var rp=require(_0x96d6('0x5'));var fs=require('fs');var path=require(_0x96d6('0x6'));var rimraf=require(_0x96d6('0x7'));var config=require(_0x96d6('0x8'));var attributes=require(_0x96d6('0x9'));module['exports']=function(_0x5894d8,_0x21c300){return _0x5894d8['define']('UserChatQueue',attributes,{'tableName':_0x96d6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c39=['api','request-promise','path','rimraf','./userChatQueue.attributes','exports','UserChatQueue','user_has_chat_queues','util','../../config/logger'];(function(_0x1bdd72,_0x80396f){var _0x190b6b=function(_0x53c8c7){while(--_0x53c8c7){_0x1bdd72['push'](_0x1bdd72['shift']());}};_0x190b6b(++_0x80396f);}(_0x6c39,0xe4));var _0x96c3=function(_0x2e655a,_0x6d5799){_0x2e655a=_0x2e655a-0x0;var _0x26f13b=_0x6c39[_0x2e655a];return _0x26f13b;};'use strict';var _=require('lodash');var util=require(_0x96c3('0x0'));var logger=require(_0x96c3('0x1'))(_0x96c3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x96c3('0x3'));var fs=require('fs');var path=require(_0x96c3('0x4'));var rimraf=require(_0x96c3('0x5'));var config=require('../../config/environment');var attributes=require(_0x96c3('0x6'));module[_0x96c3('0x7')]=function(_0x541020,_0x11b697){return _0x541020['define'](_0x96c3('0x8'),attributes,{'tableName':_0x96c3('0x9'),'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 1963333..7ad119d 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 _0x04f4=['UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x2d6096,_0x16f743){var _0x7ca378=function(_0x21f8e9){while(--_0x21f8e9){_0x2d6096['push'](_0x2d6096['shift']());}};_0x7ca378(++_0x16f743);}(_0x04f4,0xf0));var _0x404f=function(_0x2b65a7,_0x1ca639){_0x2b65a7=_0x2b65a7-0x0;var _0x22d19d=_0x04f4[_0x2b65a7];return _0x22d19d;};'use strict';var _=require('lodash');var util=require(_0x404f('0x0'));var moment=require('moment');var BPromise=require(_0x404f('0x1'));var rs=require(_0x404f('0x2'));var fs=require('fs');var Redis=require(_0x404f('0x3'));var db=require(_0x404f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x404f('0x5'))('rpc');var config=require(_0x404f('0x6'));var jayson=require(_0x404f('0x7'));var client=jayson[_0x404f('0x8')][_0x404f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2304db,_0x5d2438,_0x537cae){return new BPromise(function(_0xff86c5,_0x6e698d){return client['request'](_0x2304db,_0x537cae)[_0x404f('0xa')](function(_0x57d165){logger[_0x404f('0xb')](_0x404f('0xc'),_0x5d2438,_0x404f('0xd'));logger[_0x404f('0xe')](_0x404f('0xf'),_0x5d2438,_0x404f('0xd'),JSON[_0x404f('0x10')](_0x57d165));if(_0x57d165['error']){if(_0x57d165['error'][_0x404f('0x11')]===0x1f4){logger[_0x404f('0x12')](_0x404f('0xc'),_0x5d2438,_0x57d165[_0x404f('0x12')]['message']);return _0x6e698d(_0x57d165[_0x404f('0x12')][_0x404f('0x13')]);}logger[_0x404f('0x12')](_0x404f('0xc'),_0x5d2438,_0x57d165[_0x404f('0x12')][_0x404f('0x13')]);return _0xff86c5(_0x57d165[_0x404f('0x12')][_0x404f('0x13')]);}else{logger[_0x404f('0xb')](_0x404f('0xc'),_0x5d2438,_0x404f('0xd'));_0xff86c5(_0x57d165['result'][_0x404f('0x13')]);}})[_0x404f('0x14')](function(_0x571be8){logger[_0x404f('0x12')](_0x404f('0xc'),_0x5d2438,_0x571be8);_0x6e698d(_0x571be8);});});} \ No newline at end of file +var _0xd3f0=['UserChatQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise','client','request','then','info','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd3f0,0x190));var _0x0d3f=function(_0x51f80f,_0x55cb01){_0x51f80f=_0x51f80f-0x0;var _0x3a234a=_0xd3f0[_0x51f80f];return _0x3a234a;};'use strict';var _=require(_0x0d3f('0x0'));var util=require(_0x0d3f('0x1'));var moment=require(_0x0d3f('0x2'));var BPromise=require(_0x0d3f('0x3'));var rs=require(_0x0d3f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0d3f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0d3f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0d3f('0x7'));var client=jayson[_0x0d3f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2625b9,_0x3dc893,_0x51a69d){return new BPromise(function(_0x4fc1ff,_0x3f31ba){return client[_0x0d3f('0x9')](_0x2625b9,_0x51a69d)[_0x0d3f('0xa')](function(_0x441c3f){logger[_0x0d3f('0xb')]('UserChatQueue,\x20%s,\x20%s',_0x3dc893,_0x0d3f('0xc'));logger[_0x0d3f('0xd')](_0x0d3f('0xe'),_0x3dc893,_0x0d3f('0xc'),JSON[_0x0d3f('0xf')](_0x441c3f));if(_0x441c3f[_0x0d3f('0x10')]){if(_0x441c3f['error'][_0x0d3f('0x11')]===0x1f4){logger['error'](_0x0d3f('0x12'),_0x3dc893,_0x441c3f[_0x0d3f('0x10')]['message']);return _0x3f31ba(_0x441c3f[_0x0d3f('0x10')][_0x0d3f('0x13')]);}logger['error'](_0x0d3f('0x12'),_0x3dc893,_0x441c3f['error'][_0x0d3f('0x13')]);return _0x4fc1ff(_0x441c3f['error'][_0x0d3f('0x13')]);}else{logger['info'](_0x0d3f('0x12'),_0x3dc893,'request\x20sent');_0x4fc1ff(_0x441c3f[_0x0d3f('0x14')][_0x0d3f('0x13')]);}})[_0x0d3f('0x15')](function(_0x9b3dc9){logger[_0x0d3f('0x10')](_0x0d3f('0x12'),_0x3dc893,_0x9b3dc9);_0x3f31ba(_0x9b3dc9);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index d5e7d12..ff5b828 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x458032,_0x5ce714){var _0x4bb2f3=function(_0xbb82d2){while(--_0xbb82d2){_0x458032['push'](_0x458032['shift']());}};_0x4bb2f3(++_0x5ce714);}(_0xedd9,0xfc));var _0x9edd=function(_0x43a0bb,_0x11c9a4){_0x43a0bb=_0x43a0bb-0x0;var _0x125462=_0xedd9[_0x43a0bb];return _0x125462;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x56a97d,_0x344648){var _0x3967ed=function(_0x1fe429){while(--_0x1fe429){_0x56a97d['push'](_0x56a97d['shift']());}};_0x3967ed(++_0x344648);}(_0xe706,0xa3));var _0x6e70=function(_0x491842,_0x4ca9af){_0x491842=_0x491842-0x0;var _0x54b04e=_0xe706[_0x491842];return _0x54b04e;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 5ee16f3..f198d71 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 _0x47b6=['STRING','exports','INTEGER'];(function(_0x50c2bb,_0x5e72e0){var _0x28a623=function(_0x2b752a){while(--_0x2b752a){_0x50c2bb['push'](_0x50c2bb['shift']());}};_0x28a623(++_0x5e72e0);}(_0x47b6,0xbe));var _0x647b=function(_0x3794a0,_0x1a9cfc){_0x3794a0=_0x3794a0-0x0;var _0x5bdaba=_0x47b6[_0x3794a0];return _0x5bdaba;};'use strict';var Sequelize=require('sequelize');module[_0x647b('0x0')]={'penalty':{'type':Sequelize[_0x647b('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x647b('0x2')]}}; \ No newline at end of file +var _0x17a5=['STRING','exports','INTEGER'];(function(_0x1bad78,_0x167a99){var _0x36bb54=function(_0x4efec6){while(--_0x4efec6){_0x1bad78['push'](_0x1bad78['shift']());}};_0x36bb54(++_0x167a99);}(_0x17a5,0x1d5));var _0x517a=function(_0x368354,_0x3c4704){_0x368354=_0x368354-0x0;var _0x3d4770=_0x17a5[_0x368354];return _0x3d4770;};'use strict';var Sequelize=require('sequelize');module[_0x517a('0x0')]={'penalty':{'type':Sequelize[_0x517a('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x517a('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x517a('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 1cd3c4a..193b05e 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 _0x0d83=['path','../../config/environment','./userFaxQueue.attributes','define','user_has_fax_queues','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x524e02,_0x2937cd){var _0x4d90aa=function(_0x3cdd03){while(--_0x3cdd03){_0x524e02['push'](_0x524e02['shift']());}};_0x4d90aa(++_0x2937cd);}(_0x0d83,0x15a));var _0x30d8=function(_0x4a57f0,_0x376a2f){_0x4a57f0=_0x4a57f0-0x0;var _0x449c6c=_0x0d83[_0x4a57f0];return _0x449c6c;};'use strict';var _=require('lodash');var util=require(_0x30d8('0x0'));var logger=require(_0x30d8('0x1'))(_0x30d8('0x2'));var moment=require(_0x30d8('0x3'));var BPromise=require(_0x30d8('0x4'));var rp=require(_0x30d8('0x5'));var fs=require('fs');var path=require(_0x30d8('0x6'));var rimraf=require('rimraf');var config=require(_0x30d8('0x7'));var attributes=require(_0x30d8('0x8'));module['exports']=function(_0x31e834,_0x2a5fec){return _0x31e834[_0x30d8('0x9')]('UserFaxQueue',attributes,{'tableName':_0x30d8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2df2=['exports','define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x14a0a0,_0x45d0cf){var _0x56b651=function(_0x1fae09){while(--_0x1fae09){_0x14a0a0['push'](_0x14a0a0['shift']());}};_0x56b651(++_0x45d0cf);}(_0x2df2,0x117));var _0x22df=function(_0x2d39a0,_0x2dbeff){_0x2d39a0=_0x2d39a0-0x0;var _0x547c89=_0x2df2[_0x2d39a0];return _0x547c89;};'use strict';var _=require(_0x22df('0x0'));var util=require(_0x22df('0x1'));var logger=require(_0x22df('0x2'))(_0x22df('0x3'));var moment=require(_0x22df('0x4'));var BPromise=require('bluebird');var rp=require(_0x22df('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x22df('0x6'));var config=require('../../config/environment');var attributes=require('./userFaxQueue.attributes');module[_0x22df('0x7')]=function(_0x3db729,_0x8bc1a9){return _0x3db729[_0x22df('0x8')](_0x22df('0x9'),attributes,{'tableName':_0x22df('0xa'),'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 15a465b..173e186 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 _0x991f=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','moment','randomstring'];(function(_0x499775,_0x90728f){var _0x5e146b=function(_0x2a0b75){while(--_0x2a0b75){_0x499775['push'](_0x499775['shift']());}};_0x5e146b(++_0x90728f);}(_0x991f,0xf5));var _0xf991=function(_0x387ac0,_0x4d0f81){_0x387ac0=_0x387ac0-0x0;var _0x1eea2a=_0x991f[_0x387ac0];return _0x1eea2a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf991('0x0'));var BPromise=require('bluebird');var rs=require(_0xf991('0x1'));var fs=require('fs');var Redis=require(_0xf991('0x2'));var db=require(_0xf991('0x3'))['db'];var utils=require(_0xf991('0x4'));var logger=require(_0xf991('0x5'))('rpc');var config=require(_0xf991('0x6'));var jayson=require(_0xf991('0x7'));var client=jayson[_0xf991('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e9c78,_0x11e815,_0xdad3be){return new BPromise(function(_0x2a6f2f,_0x465769){return client[_0xf991('0x9')](_0x1e9c78,_0xdad3be)['then'](function(_0x38c0a2){logger[_0xf991('0xa')](_0xf991('0xb'),_0x11e815,_0xf991('0xc'));logger[_0xf991('0xd')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x11e815,_0xf991('0xc'),JSON[_0xf991('0xe')](_0x38c0a2));if(_0x38c0a2[_0xf991('0xf')]){if(_0x38c0a2[_0xf991('0xf')]['code']===0x1f4){logger[_0xf991('0xf')]('UserFaxQueue,\x20%s,\x20%s',_0x11e815,_0x38c0a2[_0xf991('0xf')][_0xf991('0x10')]);return _0x465769(_0x38c0a2[_0xf991('0xf')][_0xf991('0x10')]);}logger['error'](_0xf991('0xb'),_0x11e815,_0x38c0a2[_0xf991('0xf')][_0xf991('0x10')]);return _0x2a6f2f(_0x38c0a2[_0xf991('0xf')]['message']);}else{logger[_0xf991('0xa')](_0xf991('0xb'),_0x11e815,_0xf991('0xc'));_0x2a6f2f(_0x38c0a2[_0xf991('0x11')][_0xf991('0x10')]);}})[_0xf991('0x12')](function(_0x548dcc){logger[_0xf991('0xf')](_0xf991('0xb'),_0x11e815,_0x548dcc);_0x465769(_0x548dcc);});});} \ No newline at end of file +var _0x6b27=['UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','info'];(function(_0x25f0af,_0xbff78d){var _0x220c87=function(_0x300bc7){while(--_0x300bc7){_0x25f0af['push'](_0x25f0af['shift']());}};_0x220c87(++_0xbff78d);}(_0x6b27,0x1ab));var _0x76b2=function(_0x3965b5,_0x1429f4){_0x3965b5=_0x3965b5-0x0;var _0x2dd536=_0x6b27[_0x3965b5];return _0x2dd536;};'use strict';var _=require(_0x76b2('0x0'));var util=require(_0x76b2('0x1'));var moment=require(_0x76b2('0x2'));var BPromise=require(_0x76b2('0x3'));var rs=require(_0x76b2('0x4'));var fs=require('fs');var Redis=require(_0x76b2('0x5'));var db=require(_0x76b2('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x76b2('0x7'))(_0x76b2('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76b2('0x9')][_0x76b2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36259e,_0x4058dd,_0x3cc290){return new BPromise(function(_0x358603,_0x5d5f2b){return client[_0x76b2('0xb')](_0x36259e,_0x3cc290)['then'](function(_0x476697){logger[_0x76b2('0xc')](_0x76b2('0xd'),_0x4058dd,_0x76b2('0xe'));logger[_0x76b2('0xf')](_0x76b2('0x10'),_0x4058dd,'request\x20sent',JSON[_0x76b2('0x11')](_0x476697));if(_0x476697[_0x76b2('0x12')]){if(_0x476697[_0x76b2('0x12')][_0x76b2('0x13')]===0x1f4){logger[_0x76b2('0x12')](_0x76b2('0xd'),_0x4058dd,_0x476697['error']['message']);return _0x5d5f2b(_0x476697['error'][_0x76b2('0x14')]);}logger[_0x76b2('0x12')]('UserFaxQueue,\x20%s,\x20%s',_0x4058dd,_0x476697[_0x76b2('0x12')][_0x76b2('0x14')]);return _0x358603(_0x476697[_0x76b2('0x12')]['message']);}else{logger[_0x76b2('0xc')](_0x76b2('0xd'),_0x4058dd,_0x76b2('0xe'));_0x358603(_0x476697[_0x76b2('0x15')][_0x76b2('0x14')]);}})['catch'](function(_0x4cf4c4){logger[_0x76b2('0x12')]('UserFaxQueue,\x20%s,\x20%s',_0x4058dd,_0x4cf4c4);_0x5d5f2b(_0x4cf4c4);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index dc33ec3..84e56c4 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x86a8fa,_0x323e96){var _0x551384=function(_0x434c2b){while(--_0x434c2b){_0x86a8fa['push'](_0x86a8fa['shift']());}};_0x551384(++_0x323e96);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x1d71d8,_0x5c8355){var _0x1332d7=function(_0x1b6a64){while(--_0x1b6a64){_0x1d71d8['push'](_0x1d71d8['shift']());}};_0x1332d7(++_0x5c8355);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4849f6,_0x104836){_0x4849f6=_0x4849f6-0x0;var _0x1a3dcd=_0xcb91[_0x4849f6];return _0x1a3dcd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 619789e..2db9509 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 _0x4588=['INTEGER'];(function(_0x148bc9,_0x4ea630){var _0x17ca4a=function(_0x1ca286){while(--_0x1ca286){_0x148bc9['push'](_0x148bc9['shift']());}};_0x17ca4a(++_0x4ea630);}(_0x4588,0x9c));var _0x8458=function(_0x5f519b,_0x5b606f){_0x5f519b=_0x5f519b-0x0;var _0x2461e2=_0x4588[_0x5f519b];return _0x2461e2;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x8458('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3b5d=['INTEGER','exports'];(function(_0x3b4b31,_0x25c0b2){var _0xf7497=function(_0x47dacd){while(--_0x47dacd){_0x3b4b31['push'](_0x3b4b31['shift']());}};_0xf7497(++_0x25c0b2);}(_0x3b5d,0x1a1));var _0xd3b5=function(_0x5155fd,_0xaa956f){_0x5155fd=_0x5155fd-0x0;var _0x1bf312=_0x3b5d[_0x5155fd];return _0x1bf312;};'use strict';var Sequelize=require('sequelize');module[_0xd3b5('0x0')]={'penalty':{'type':Sequelize[_0xd3b5('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 5cb395e..18d3cb9 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 _0xf8ac=['exports','define','user_has_mail_queues','util','api','bluebird','rimraf'];(function(_0xf0bc07,_0x510ebf){var _0x1c50c2=function(_0x2e2bdf){while(--_0x2e2bdf){_0xf0bc07['push'](_0xf0bc07['shift']());}};_0x1c50c2(++_0x510ebf);}(_0xf8ac,0x153));var _0xcf8a=function(_0x569caa,_0x5174ce){_0x569caa=_0x569caa-0x0;var _0x44cb5a=_0xf8ac[_0x569caa];return _0x44cb5a;};'use strict';var _=require('lodash');var util=require(_0xcf8a('0x0'));var logger=require('../../config/logger')(_0xcf8a('0x1'));var moment=require('moment');var BPromise=require(_0xcf8a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xcf8a('0x3'));var config=require('../../config/environment');var attributes=require('./userMailQueue.attributes');module[_0xcf8a('0x4')]=function(_0x31238e,_0x52278d){return _0x31238e[_0xcf8a('0x5')]('UserMailQueue',attributes,{'tableName':_0xcf8a('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7dc2=['rimraf','../../config/environment','./userMailQueue.attributes','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xf1091f,_0x104f00){var _0xfafb20=function(_0xcf465c){while(--_0xcf465c){_0xf1091f['push'](_0xf1091f['shift']());}};_0xfafb20(++_0x104f00);}(_0x7dc2,0x149));var _0x27dc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7dc2[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x27dc('0x0'));var util=require(_0x27dc('0x1'));var logger=require(_0x27dc('0x2'))(_0x27dc('0x3'));var moment=require(_0x27dc('0x4'));var BPromise=require(_0x27dc('0x5'));var rp=require(_0x27dc('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x27dc('0x7'));var config=require(_0x27dc('0x8'));var attributes=require(_0x27dc('0x9'));module['exports']=function(_0xc20d2a,_0x4eaa19){return _0xc20d2a['define'](_0x27dc('0xa'),attributes,{'tableName':_0x27dc('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 6e63ca3..0c637c9 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 _0x3e74=['rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','UserMailQueue,\x20%s,\x20%s','message','info','catch','lodash','moment','bluebird','randomstring','../../config/utils'];(function(_0x48c620,_0x421d98){var _0x44640a=function(_0x14255e){while(--_0x14255e){_0x48c620['push'](_0x48c620['shift']());}};_0x44640a(++_0x421d98);}(_0x3e74,0x175));var _0x43e7=function(_0x4e558d,_0x1c99c6){_0x4e558d=_0x4e558d-0x0;var _0x52c432=_0x3e74[_0x4e558d];return _0x52c432;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){return client[_0x43e7('0xa')](_0x503698,_0x3491d6)['then'](function(_0x212c6c){logger['info']('UserMailQueue,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'),JSON['stringify'](_0x212c6c));if(_0x212c6c[_0x43e7('0xd')]){if(_0x212c6c[_0x43e7('0xd')]['code']===0x1f4){logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')][_0x43e7('0xf')]);return _0x8528fc(_0x212c6c['error']['message']);}logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')]['message']);return _0x2ede2d(_0x212c6c['error'][_0x43e7('0xf')]);}else{logger[_0x43e7('0x10')](_0x43e7('0xe'),_0x45a0d1,_0x43e7('0xb'));_0x2ede2d(_0x212c6c['result']['message']);}})[_0x43e7('0x11')](function(_0x264575){logger[_0x43e7('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});} \ No newline at end of file +var _0x5fc3=['../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','code','message','UserMailQueue,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x1b1e7e,_0x5e1fd8){var _0x454ca4=function(_0xd6ded8){while(--_0xd6ded8){_0x1b1e7e['push'](_0x1b1e7e['shift']());}};_0x454ca4(++_0x5e1fd8);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5ef905,_0x564b87){_0x5ef905=_0x5ef905-0x0;var _0x367808=_0x5fc3[_0x5ef905];return _0x367808;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('UserMailQueue,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('UserMailQueue,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 972eec4..f626999 100644 --- a/server/api/userNotification/index.js +++ b/server/api/userNotification/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x447f=['isAuthenticated','sendUserNotification','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./userNotification.controller','post'];(function(_0x28c45a,_0x48ca08){var _0x38134d=function(_0xee2728){while(--_0xee2728){_0x28c45a['push'](_0x28c45a['shift']());}};_0x38134d(++_0x48ca08);}(_0x447f,0x196));var _0xf447=function(_0x26368d,_0x21eb1d){_0x26368d=_0x26368d-0x0;var _0x16bb2e=_0x447f[_0x26368d];return _0x16bb2e;};'use strict';var multer=require(_0xf447('0x0'));var util=require(_0xf447('0x1'));var path=require(_0xf447('0x2'));var timeout=require(_0xf447('0x3'));var express=require(_0xf447('0x4'));var router=express[_0xf447('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf447('0x6'));var interaction=require(_0xf447('0x7'));var config=require('../../config/environment');var controller=require(_0xf447('0x8'));router[_0xf447('0x9')]('/',auth[_0xf447('0xa')](),controller[_0xf447('0xb')]);module[_0xf447('0xc')]=router; \ No newline at end of file +var _0x0dc6=['../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x2f0bf9,_0x2dbe2f){var _0x16d87f=function(_0x29428f){while(--_0x29428f){_0x2f0bf9['push'](_0x2f0bf9['shift']());}};_0x16d87f(++_0x2dbe2f);}(_0x0dc6,0x162));var _0x60dc=function(_0x1440d9,_0x4a2c7e){_0x1440d9=_0x1440d9-0x0;var _0x4a0cfb=_0x0dc6[_0x1440d9];return _0x4a0cfb;};'use strict';var multer=require('multer');var util=require(_0x60dc('0x0'));var path=require(_0x60dc('0x1'));var timeout=require(_0x60dc('0x2'));var express=require('express');var router=express[_0x60dc('0x3')]();var fs_extra=require(_0x60dc('0x4'));var auth=require(_0x60dc('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x60dc('0x6'));var controller=require(_0x60dc('0x7'));router[_0x60dc('0x8')]('/',auth[_0x60dc('0x9')](),controller[_0x60dc('0xa')]);module[_0x60dc('0xb')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 2af3d82..50fa5ce 100644 --- a/server/api/userNotification/userNotification.attributes.js +++ b/server/api/userNotification/userNotification.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7ba2=['STRING','BOOLEAN','sequelize','TEXT'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7ba2,0xee));var _0x27ba=function(_0x564b7f,_0x162734){_0x564b7f=_0x564b7f-0x0;var _0x194ae6=_0x7ba2[_0x564b7f];return _0x194ae6;};'use strict';var Sequelize=require(_0x27ba('0x0'));module['exports']={'body':{'type':Sequelize[_0x27ba('0x1')]},'senderName':{'type':Sequelize[_0x27ba('0x2')]},'recipientsId':{'type':Sequelize[_0x27ba('0x1')]},'recipientsDescription':{'type':Sequelize[_0x27ba('0x2')]},'beep':{'type':Sequelize[_0x27ba('0x3')]}}; \ No newline at end of file +var _0x24f5=['sequelize','exports','TEXT','STRING'];(function(_0x1a21ff,_0x4a7550){var _0x25afc1=function(_0x4a66ec){while(--_0x4a66ec){_0x1a21ff['push'](_0x1a21ff['shift']());}};_0x25afc1(++_0x4a7550);}(_0x24f5,0x74));var _0x524f=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x24f5[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x524f('0x0'));module[_0x524f('0x1')]={'body':{'type':Sequelize[_0x524f('0x2')]},'senderName':{'type':Sequelize[_0x524f('0x3')]},'recipientsId':{'type':Sequelize[_0x524f('0x2')]},'recipientsDescription':{'type':Sequelize[_0x524f('0x3')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index c9eb04e..0cb9a41 100644 --- a/server/api/userNotification/userNotification.controller.js +++ b/server/api/userNotification/userNotification.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc219=['forEach','recipient','emit','catch','text','Template','findOne','html','render','toLowerCase','union','ids','queue','replace','Queue','push','flatten','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','api','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','register','sendStatus','status','offset','undefined','limit','count','Content-Range','json','reject','save','destroy','then','end','stack','name','send','sendUserNotification','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','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','smsqueue','voicequeue','team','some','includes','model','senderName','recipientsDescription','isEmpty','beep','SenderId','user','recipientsId','sortBy','join','UserNotification','create'];(function(_0x24b773,_0x392c26){var _0x35f6c9=function(_0x37b5c3){while(--_0x37b5c3){_0x24b773['push'](_0x24b773['shift']());}};_0x35f6c9(++_0x392c26);}(_0xc219,0x6f));var _0x9c21=function(_0x31a576,_0x424419){_0x31a576=_0x31a576-0x0;var _0x30b1d3=_0xc219[_0x31a576];return _0x30b1d3;};'use strict';var emlformat=require(_0x9c21('0x0'));var rimraf=require(_0x9c21('0x1'));var zipdir=require(_0x9c21('0x2'));var jsonpatch=require(_0x9c21('0x3'));var rp=require(_0x9c21('0x4'));var moment=require(_0x9c21('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9c21('0x6'));var util=require(_0x9c21('0x7'));var path=require(_0x9c21('0x8'));var sox=require('sox');var csv=require(_0x9c21('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9c21('0xa'));var _=require(_0x9c21('0xb'));var squel=require(_0x9c21('0xc'));var crypto=require(_0x9c21('0xd'));var jsforce=require(_0x9c21('0xe'));var deskjs=require(_0x9c21('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9c21('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9c21('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9c21('0x12'));var utils=require('../../config/utils');var config=require(_0x9c21('0x13'));var licenseUtil=require(_0x9c21('0x14'));var db=require('../../mysqldb')['db'];config[_0x9c21('0x15')]=_['defaults'](config[_0x9c21('0x15')],{'host':_0x9c21('0x16'),'port':0x18eb});var socket=require(_0x9c21('0x17'))(new Redis(config[_0x9c21('0x15')]));require('./userNotification.socket')[_0x9c21('0x18')](socket);function respondWithStatusCode(_0x464712,_0x65052){_0x65052=_0x65052||0xcc;return function(_0x24a3a2){if(_0x24a3a2){return _0x464712[_0x9c21('0x19')](_0x65052);}return _0x464712[_0x9c21('0x1a')](_0x65052)['end']();};}function respondWithResult(_0x1f142c,_0x24a9b5){_0x24a9b5=_0x24a9b5||0xc8;return function(_0x49fb32){if(_0x49fb32){return _0x1f142c[_0x9c21('0x1a')](_0x24a9b5)['json'](_0x49fb32);}};}function respondWithFilteredResult(_0x45b05b,_0x2a9b51){return function(_0x5d653d){if(_0x5d653d){var _0x15e5cb=typeof _0x2a9b51[_0x9c21('0x1b')]===_0x9c21('0x1c')&&typeof _0x2a9b51[_0x9c21('0x1d')]===_0x9c21('0x1c');var _0x2a7882=_0x5d653d[_0x9c21('0x1e')];var _0x3e01c9=_0x15e5cb?0x0:_0x2a9b51[_0x9c21('0x1b')];var _0x42c291=_0x15e5cb?_0x5d653d[_0x9c21('0x1e')]:_0x2a9b51['offset']+_0x2a9b51[_0x9c21('0x1d')];var _0x1022e2;if(_0x42c291>=_0x2a7882){_0x42c291=_0x2a7882;_0x1022e2=0xc8;}else{_0x1022e2=0xce;}_0x45b05b[_0x9c21('0x1a')](_0x1022e2);return _0x45b05b['set'](_0x9c21('0x1f'),_0x3e01c9+'-'+_0x42c291+'/'+_0x2a7882)[_0x9c21('0x20')](_0x5d653d);}return null;};}function patchUpdates(_0x247284){return function(_0x13fdf0){try{jsonpatch['apply'](_0x13fdf0,_0x247284,!![]);}catch(_0xea3fc8){return BPromise[_0x9c21('0x21')](_0xea3fc8);}return _0x13fdf0[_0x9c21('0x22')]();};}function saveUpdates(_0x2b1e9f,_0x5631b9){return function(_0x2d0567){if(_0x2d0567){return _0x2d0567['update'](_0x2b1e9f)['then'](function(_0x1f6e5f){return _0x1f6e5f;});}return null;};}function removeEntity(_0x5c221b,_0x1c8cc2){return function(_0x396748){if(_0x396748){return _0x396748[_0x9c21('0x23')]()[_0x9c21('0x24')](function(){_0x5c221b[_0x9c21('0x1a')](0xcc)[_0x9c21('0x25')]();});}};}function handleEntityNotFound(_0x2e5e4a,_0x4f2c6f){return function(_0x401254){if(!_0x401254){_0x2e5e4a['sendStatus'](0x194);}return _0x401254;};}function handleError(_0x40df7e,_0x53cbc1){_0x53cbc1=_0x53cbc1||0x1f4;return function(_0x2464de){logger['error'](_0x2464de[_0x9c21('0x26')]);if(_0x2464de[_0x9c21('0x27')]){delete _0x2464de[_0x9c21('0x27')];}_0x40df7e[_0x9c21('0x1a')](_0x53cbc1)[_0x9c21('0x28')](_0x2464de);};}exports[_0x9c21('0x29')]=function(_0x4176b7,_0x37c884,_0x1f4085){if(!_0x4176b7[_0x9c21('0x2a')][_0x9c21('0x2b')]('text')&&!_0x4176b7['body'][_0x9c21('0x2b')](_0x9c21('0x2c'))){throw new db[(_0x9c21('0x2d'))][(_0x9c21('0x2e'))](_0x9c21('0x2f'));}else{if(_0x4176b7[_0x9c21('0x2a')][_0x9c21('0x2b')](_0x9c21('0x2c'))&&!_0x4176b7[_0x9c21('0x2a')][_0x9c21('0x2b')](_0x9c21('0x30'))){throw new db['Sequelize']['ValidationError'](_0x9c21('0x31'));}if(!_0x4176b7[_0x9c21('0x2a')][_0x9c21('0x2b')](_0x9c21('0x32'))){throw new db['Sequelize'][(_0x9c21('0x2e'))](_0x9c21('0x33'));}else{try{var _0x464b7b=JSON[_0x9c21('0x34')](_0x4176b7[_0x9c21('0x2a')][_0x9c21('0x32')]);}catch(_0x55965d){logger['error'](_0x55965d);throw new db[(_0x9c21('0x2d'))][(_0x9c21('0x2e'))](_0x9c21('0x35'));}var _0x50ea6a=['chatqueue',_0x9c21('0x36'),_0x9c21('0x37'),'openchannelqueue',_0x9c21('0x38'),_0x9c21('0x39'),'whatsappqueue',_0x9c21('0x3a'),'user'];if(_[_0x9c21('0x3b')](_0x464b7b,function(_0x4d1ca0){return!_[_0x9c21('0x3c')](_0x50ea6a,_0x4d1ca0[_0x9c21('0x3d')]['toLowerCase']());})){throw new db[(_0x9c21('0x2d'))][(_0x9c21('0x2e'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x4b8173={};_0x4b8173['senderName']=_0x4176b7[_0x9c21('0x2a')][_0x9c21('0x2b')](_0x9c21('0x3e'))?_0x4176b7[_0x9c21('0x2a')][_0x9c21('0x3e')]:_0x4176b7['user']['fullname'];_0x4b8173[_0x9c21('0x3f')]=_[_0x9c21('0x40')](_0x4176b7[_0x9c21('0x2a')][_0x9c21('0x3f')])?null:_0x4176b7['body'][_0x9c21('0x3f')];_0x4b8173[_0x9c21('0x41')]=_0x4176b7[_0x9c21('0x2a')]['beep']||![];_0x4b8173[_0x9c21('0x42')]=_0x4176b7[_0x9c21('0x43')]['id'];return getContent(_0x4176b7[_0x9c21('0x2a')])[_0x9c21('0x24')](function(_0x2a8c4b){_0x4b8173[_0x9c21('0x2a')]=_0x2a8c4b;return getRecipients(_0x464b7b);})[_0x9c21('0x24')](function(_0x42d2ba){_0x4b8173[_0x9c21('0x44')]=_[_0x9c21('0x45')](_0x42d2ba)[_0x9c21('0x46')](',');return db['sequelize']['transaction'](function(_0x48d7ff){return db[_0x9c21('0x47')][_0x9c21('0x48')](_0x4b8173,{'raw':!![],'transaction':_0x48d7ff})['then'](function(_0x566490){var _0x3f572b={'sender':_0x4b8173[_0x9c21('0x3e')],'description':_0x4b8173[_0x9c21('0x3f')],'content':_0x4b8173[_0x9c21('0x2a')],'beep':_0x4b8173[_0x9c21('0x41')]};_0x42d2ba[_0x9c21('0x49')](function(_0x339d8c){_0x3f572b[_0x9c21('0x4a')]=_0x339d8c;socket[_0x9c21('0x4b')]('userNotification:send',_0x3f572b);});return _0x566490;});});})[_0x9c21('0x24')](respondWithResult(_0x37c884,0xc9))[_0x9c21('0x4c')](handleError(_0x37c884,null));};function getContent(_0xb590b7){return new BPromise(function(_0x11427b,_0x4df269){if(_0xb590b7[_0x9c21('0x4d')]){_0x11427b(_0xb590b7[_0x9c21('0x4d')]);return;}return db[_0x9c21('0x4e')][_0x9c21('0x4f')]({'attributes':[_0x9c21('0x50')],'where':{'id':_0xb590b7[_0x9c21('0x2c')]},'raw':!![]})[_0x9c21('0x24')](function(_0x43e2af){if(!_0x43e2af)throw new db[(_0x9c21('0x2d'))][(_0x9c21('0x2e'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x2a107d=Mustache[_0x9c21('0x51')](_0x43e2af[_0x9c21('0x50')],_0xb590b7[_0x9c21('0x30')]);_0x11427b(_0x2a107d);})['catch'](function(_0x23c264){_0x4df269(_0x23c264);});});}function getRecipients(_0x1b1cb5){return new BPromise(function(_0x32a854,_0x2bc378){var _0x1e65d8=[];var _0x1d950a=[];_0x1b1cb5[_0x9c21('0x49')](function(_0x1c0626){var _0x5adb5e=_['startCase'](_0x1c0626[_0x9c21('0x3d')][_0x9c21('0x52')]());if(_0x5adb5e==='User'){_0x1e65d8=_[_0x9c21('0x53')](_0x1e65d8,_0x1c0626[_0x9c21('0x54')]);}else{if(_[_0x9c21('0x3c')](_0x5adb5e,_0x9c21('0x55')))_0x5adb5e=_0x5adb5e[_0x9c21('0x56')]('queue',_0x9c21('0x57'));_0x1c0626[_0x9c21('0x54')][_0x9c21('0x49')](function(_0x347e0f){_0x1d950a[_0x9c21('0x58')](getAgents(_0x5adb5e,_0x347e0f));});}});return BPromise['all'](_0x1d950a)['then'](function(_0xdb261d){_0x1e65d8=_[_0x9c21('0x53')](_0x1e65d8,_[_0x9c21('0x59')](_0xdb261d));_0x32a854(_0x1e65d8);})[_0x9c21('0x4c')](function(_0x2063fc){_0x2bc378(_0x2063fc);});});}function getAgents(_0x5bbffd,_0xbc5804){return new BPromise(function(_0x4babd7,_0x21ef3f){return db[_0x5bbffd][_0x9c21('0x4f')]({'where':{'id':_0xbc5804}})['then'](function(_0x19373f){return _0x19373f[_0x9c21('0x5a')]({'attributes':['id'],'raw':!![]})[_0x9c21('0x24')](function(_0x3a4123){var _0xe090ec=_[_0x9c21('0x5b')](_0x3a4123,'id');_0x4babd7(_0xe090ec);});})[_0x9c21('0x4c')](function(_0xd4d795){_0x21ef3f(_0xd4d795);});});} \ No newline at end of file +var _0x86c0=['view','Missing\x20\x27view\x27\x20parameter','recipients','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep','SenderId','join','sequelize','forEach','emit','userNotification:send','catch','text','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','toLowerCase','User','queue','replace','Queue','ids','all','union','flatten','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','error','body','hasOwnProperty','TemplateId','Sequelize','ValidationError'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x86c0,0x141));var _0x086c=function(_0x21922a,_0x1ff195){_0x21922a=_0x21922a-0x0;var _0x975ddc=_0x86c0[_0x21922a];return _0x975ddc;};'use strict';var emlformat=require(_0x086c('0x0'));var rimraf=require(_0x086c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x086c('0x2'));var rp=require(_0x086c('0x3'));var moment=require(_0x086c('0x4'));var BPromise=require(_0x086c('0x5'));var Mustache=require(_0x086c('0x6'));var util=require(_0x086c('0x7'));var path=require('path');var sox=require(_0x086c('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x086c('0x9'));var _=require(_0x086c('0xa'));var squel=require(_0x086c('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x086c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x086c('0xd'));var Papa=require(_0x086c('0xe'));var Redis=require(_0x086c('0xf'));var authService=require(_0x086c('0x10'));var qs=require(_0x086c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x086c('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x086c('0x13'));var config=require(_0x086c('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x086c('0x15'))['db'];config['redis']=_[_0x086c('0x16')](config[_0x086c('0x17')],{'host':_0x086c('0x18'),'port':0x18eb});var socket=require(_0x086c('0x19'))(new Redis(config[_0x086c('0x17')]));require('./userNotification.socket')[_0x086c('0x1a')](socket);function respondWithStatusCode(_0x648ec6,_0x169765){_0x169765=_0x169765||0xcc;return function(_0x3f88f4){if(_0x3f88f4){return _0x648ec6[_0x086c('0x1b')](_0x169765);}return _0x648ec6[_0x086c('0x1c')](_0x169765)['end']();};}function respondWithResult(_0x1f70ed,_0xce8b2e){_0xce8b2e=_0xce8b2e||0xc8;return function(_0x32eb26){if(_0x32eb26){return _0x1f70ed[_0x086c('0x1c')](_0xce8b2e)[_0x086c('0x1d')](_0x32eb26);}};}function respondWithFilteredResult(_0x4d715b,_0x300cbf){return function(_0x1b6f57){if(_0x1b6f57){var _0x43954b=typeof _0x300cbf[_0x086c('0x1e')]==='undefined'&&typeof _0x300cbf['limit']===_0x086c('0x1f');var _0x206949=_0x1b6f57[_0x086c('0x20')];var _0x106c02=_0x43954b?0x0:_0x300cbf['offset'];var _0x57a406=_0x43954b?_0x1b6f57['count']:_0x300cbf[_0x086c('0x1e')]+_0x300cbf[_0x086c('0x21')];var _0xb9364b;if(_0x57a406>=_0x206949){_0x57a406=_0x206949;_0xb9364b=0xc8;}else{_0xb9364b=0xce;}_0x4d715b[_0x086c('0x1c')](_0xb9364b);return _0x4d715b[_0x086c('0x22')](_0x086c('0x23'),_0x106c02+'-'+_0x57a406+'/'+_0x206949)['json'](_0x1b6f57);}return null;};}function patchUpdates(_0x40248a){return function(_0x1b616c){try{jsonpatch[_0x086c('0x24')](_0x1b616c,_0x40248a,!![]);}catch(_0x11019d){return BPromise[_0x086c('0x25')](_0x11019d);}return _0x1b616c['save']();};}function saveUpdates(_0x5e9451,_0x5b42c2){return function(_0x2b6056){if(_0x2b6056){return _0x2b6056[_0x086c('0x26')](_0x5e9451)[_0x086c('0x27')](function(_0x43425e){return _0x43425e;});}return null;};}function removeEntity(_0x5cf294,_0x31e569){return function(_0x47145c){if(_0x47145c){return _0x47145c[_0x086c('0x28')]()[_0x086c('0x27')](function(){_0x5cf294['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x43c2ce,_0x5959ca){return function(_0x19f74d){if(!_0x19f74d){_0x43c2ce[_0x086c('0x1b')](0x194);}return _0x19f74d;};}function handleError(_0x4dfad7,_0x361c62){_0x361c62=_0x361c62||0x1f4;return function(_0x35d7c8){logger[_0x086c('0x29')](_0x35d7c8['stack']);if(_0x35d7c8['name']){delete _0x35d7c8['name'];}_0x4dfad7[_0x086c('0x1c')](_0x361c62)['send'](_0x35d7c8);};}exports['sendUserNotification']=function(_0x1563cd,_0x5945a1,_0x3faf8c){if(!_0x1563cd[_0x086c('0x2a')]['hasOwnProperty']('text')&&!_0x1563cd[_0x086c('0x2a')][_0x086c('0x2b')](_0x086c('0x2c'))){throw new db[(_0x086c('0x2d'))][(_0x086c('0x2e'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x1563cd['body']['hasOwnProperty'](_0x086c('0x2c'))&&!_0x1563cd[_0x086c('0x2a')][_0x086c('0x2b')](_0x086c('0x2f'))){throw new db['Sequelize'][(_0x086c('0x2e'))](_0x086c('0x30'));}if(!_0x1563cd['body'][_0x086c('0x2b')](_0x086c('0x31'))){throw new db['Sequelize']['ValidationError']('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x8f15=JSON[_0x086c('0x32')](_0x1563cd['body'][_0x086c('0x31')]);}catch(_0x216c1e){logger[_0x086c('0x29')](_0x216c1e);throw new db[(_0x086c('0x2d'))][(_0x086c('0x2e'))](_0x086c('0x33'));}var _0xe9b3dc=[_0x086c('0x34'),_0x086c('0x35'),_0x086c('0x36'),_0x086c('0x37'),_0x086c('0x38'),_0x086c('0x39'),_0x086c('0x3a'),_0x086c('0x3b'),_0x086c('0x3c')];if(_['some'](_0x8f15,function(_0x47e0c0){return!_[_0x086c('0x3d')](_0xe9b3dc,_0x47e0c0[_0x086c('0x3e')]['toLowerCase']());})){throw new db['Sequelize'][(_0x086c('0x2e'))](_0x086c('0x3f'));}}}var _0x2d21b4={};_0x2d21b4[_0x086c('0x40')]=_0x1563cd['body']['hasOwnProperty'](_0x086c('0x40'))?_0x1563cd[_0x086c('0x2a')]['senderName']:_0x1563cd[_0x086c('0x3c')][_0x086c('0x41')];_0x2d21b4[_0x086c('0x42')]=_['isEmpty'](_0x1563cd['body'][_0x086c('0x42')])?null:_0x1563cd['body'][_0x086c('0x42')];_0x2d21b4[_0x086c('0x43')]=_0x1563cd[_0x086c('0x2a')]['beep']||![];_0x2d21b4[_0x086c('0x44')]=_0x1563cd[_0x086c('0x3c')]['id'];return getContent(_0x1563cd[_0x086c('0x2a')])['then'](function(_0xb113a7){_0x2d21b4[_0x086c('0x2a')]=_0xb113a7;return getRecipients(_0x8f15);})[_0x086c('0x27')](function(_0x26e4ed){_0x2d21b4['recipientsId']=_['sortBy'](_0x26e4ed)[_0x086c('0x45')](',');return db[_0x086c('0x46')]['transaction'](function(_0x2cc66e){return db['UserNotification']['create'](_0x2d21b4,{'raw':!![],'transaction':_0x2cc66e})[_0x086c('0x27')](function(_0x175e66){var _0x168d63={'sender':_0x2d21b4[_0x086c('0x40')],'description':_0x2d21b4['recipientsDescription'],'content':_0x2d21b4['body'],'beep':_0x2d21b4[_0x086c('0x43')]};_0x26e4ed[_0x086c('0x47')](function(_0x5980b9){_0x168d63['recipient']=_0x5980b9;socket[_0x086c('0x48')](_0x086c('0x49'),_0x168d63);});return _0x175e66;});});})[_0x086c('0x27')](respondWithResult(_0x5945a1,0xc9))[_0x086c('0x4a')](handleError(_0x5945a1,null));};function getContent(_0x726a43){return new BPromise(function(_0x20978d,_0x20a343){if(_0x726a43[_0x086c('0x4b')]){_0x20978d(_0x726a43['text']);return;}return db[_0x086c('0x4c')][_0x086c('0x4d')]({'attributes':[_0x086c('0x4e')],'where':{'id':_0x726a43[_0x086c('0x2c')]},'raw':!![]})[_0x086c('0x27')](function(_0x26bcfc){if(!_0x26bcfc)throw new db[(_0x086c('0x2d'))][(_0x086c('0x2e'))](_0x086c('0x4f'));var _0x12befd=Mustache[_0x086c('0x50')](_0x26bcfc[_0x086c('0x4e')],_0x726a43[_0x086c('0x2f')]);_0x20978d(_0x12befd);})['catch'](function(_0x5b853b){_0x20a343(_0x5b853b);});});}function getRecipients(_0x1294c0){return new BPromise(function(_0x6d2ad7,_0x160ac6){var _0xa2df5=[];var _0x36e668=[];_0x1294c0[_0x086c('0x47')](function(_0x1883f5){var _0x281e9f=_[_0x086c('0x51')](_0x1883f5['model'][_0x086c('0x52')]());if(_0x281e9f===_0x086c('0x53')){_0xa2df5=_['union'](_0xa2df5,_0x1883f5['ids']);}else{if(_[_0x086c('0x3d')](_0x281e9f,_0x086c('0x54')))_0x281e9f=_0x281e9f[_0x086c('0x55')](_0x086c('0x54'),_0x086c('0x56'));_0x1883f5[_0x086c('0x57')][_0x086c('0x47')](function(_0x30afb9){_0x36e668['push'](getAgents(_0x281e9f,_0x30afb9));});}});return BPromise[_0x086c('0x58')](_0x36e668)['then'](function(_0xe0fec8){_0xa2df5=_[_0x086c('0x59')](_0xa2df5,_[_0x086c('0x5a')](_0xe0fec8));_0x6d2ad7(_0xa2df5);})[_0x086c('0x4a')](function(_0x59d120){_0x160ac6(_0x59d120);});});}function getAgents(_0x349c71,_0x62ddec){return new BPromise(function(_0x58729e,_0x4cea6a){return db[_0x349c71]['findOne']({'where':{'id':_0x62ddec}})[_0x086c('0x27')](function(_0x510116){return _0x510116[_0x086c('0x5b')]({'attributes':['id'],'raw':!![]})[_0x086c('0x27')](function(_0x14a056){var _0x4fbf66=_['map'](_0x14a056,'id');_0x58729e(_0x4fbf66);});})['catch'](function(_0x7e3991){_0x4cea6a(_0x7e3991);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 4bc33a2..8a01d17 100644 --- a/server/api/userNotification/userNotification.events.js +++ b/server/api/userNotification/userNotification.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdf30=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','../../mysqldb','UserNotification'];(function(_0x3f6077,_0x359242){var _0x411045=function(_0x89034f){while(--_0x89034f){_0x3f6077['push'](_0x3f6077['shift']());}};_0x411045(++_0x359242);}(_0xdf30,0x73));var _0x0df3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdf30[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x0df3('0x0'))['db'][_0x0df3('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x0df3('0x2')](0x0);var events={'afterCreate':_0x0df3('0x3'),'afterUpdate':_0x0df3('0x4'),'afterDestroy':_0x0df3('0x5')};function emitEvent(_0xb5b108){return function(_0x44d8dd,_0x3d53f3,_0x448c2a){UserNotificationEvents['emit'](_0xb5b108+':'+_0x44d8dd['id'],_0x44d8dd);UserNotificationEvents[_0x0df3('0x6')](_0xb5b108,_0x44d8dd);_0x448c2a(null);};}for(var e in events){if(events[_0x0df3('0x7')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0x0df3('0x8')]=UserNotificationEvents; \ No newline at end of file +var _0xcebd=['UserNotification','setMaxListeners','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x4fe120,_0x1c3239){var _0xf82b8e=function(_0x1fe46f){while(--_0x1fe46f){_0x4fe120['push'](_0x4fe120['shift']());}};_0xf82b8e(++_0x1c3239);}(_0xcebd,0xbb));var _0xdceb=function(_0x238e7e,_0x304479){_0x238e7e=_0x238e7e-0x0;var _0x46c55c=_0xcebd[_0x238e7e];return _0x46c55c;};'use strict';var EventEmitter=require(_0xdceb('0x0'));var UserNotification=require(_0xdceb('0x1'))['db'][_0xdceb('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xdceb('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdceb('0x4'),'afterDestroy':_0xdceb('0x5')};function emitEvent(_0x3682e4){return function(_0x3019d8,_0x5bcf00,_0x59980f){UserNotificationEvents[_0xdceb('0x6')](_0x3682e4+':'+_0x3019d8['id'],_0x3019d8);UserNotificationEvents[_0xdceb('0x6')](_0x3682e4,_0x3019d8);_0x59980f(null);};}for(var e in events){if(events[_0xdceb('0x7')](e)){var event=events[e];UserNotification[_0xdceb('0x8')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 9658c8a..bc605fc 100644 --- a/server/api/userNotification/userNotification.model.js +++ b/server/api/userNotification/userNotification.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xceab=['../../config/environment','./userNotification.attributes','exports','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0x41fc0d,_0x5eac67){var _0x1e15c1=function(_0x577646){while(--_0x577646){_0x41fc0d['push'](_0x41fc0d['shift']());}};_0x1e15c1(++_0x5eac67);}(_0xceab,0x93));var _0xbcea=function(_0x24e0a6,_0x52fd89){_0x24e0a6=_0x24e0a6-0x0;var _0x2b8303=_0xceab[_0x24e0a6];return _0x2b8303;};'use strict';var _=require(_0xbcea('0x0'));var util=require(_0xbcea('0x1'));var logger=require(_0xbcea('0x2'))(_0xbcea('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xbcea('0x4'));var fs=require('fs');var path=require(_0xbcea('0x5'));var rimraf=require(_0xbcea('0x6'));var config=require(_0xbcea('0x7'));var attributes=require(_0xbcea('0x8'));module[_0xbcea('0x9')]=function(_0x124e3b,_0x24fc03){return _0x124e3b['define'](_0xbcea('0xa'),attributes,{'tableName':_0xbcea('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbcea('0xc'),'collate':_0xbcea('0xd')});}; \ No newline at end of file +var _0x910d=['../../config/environment','./userNotification.attributes','exports','userNotifications','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x910d,0x179));var _0xd910=function(_0x261d12,_0x1e093c){_0x261d12=_0x261d12-0x0;var _0x441715=_0x910d[_0x261d12];return _0x441715;};'use strict';var _=require(_0xd910('0x0'));var util=require('util');var logger=require(_0xd910('0x1'))('api');var moment=require(_0xd910('0x2'));var BPromise=require(_0xd910('0x3'));var rp=require(_0xd910('0x4'));var fs=require('fs');var path=require(_0xd910('0x5'));var rimraf=require(_0xd910('0x6'));var config=require(_0xd910('0x7'));var attributes=require(_0xd910('0x8'));module[_0xd910('0x9')]=function(_0x34e322,_0x1361ee){return _0x34e322['define']('UserNotification',attributes,{'tableName':_0xd910('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd910('0xb')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index d460c8c..2a4ae09 100644 --- a/server/api/userNotification/userNotification.rpc.js +++ b/server/api/userNotification/userNotification.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc933=['then','info','UserNotification,\x20%s,\x20%s','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./userNotification.socket','register','request'];(function(_0x1d39b8,_0x454428){var _0x52b14b=function(_0x5c1aa8){while(--_0x5c1aa8){_0x1d39b8['push'](_0x1d39b8['shift']());}};_0x52b14b(++_0x454428);}(_0xc933,0x15c));var _0x3c93=function(_0x227d1c,_0x1e8367){_0x227d1c=_0x227d1c-0x0;var _0x3d4140=_0xc933[_0x227d1c];return _0x3d4140;};'use strict';var _=require(_0x3c93('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3c93('0x1'));var rs=require(_0x3c93('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3c93('0x3'))['db'];var utils=require(_0x3c93('0x4'));var logger=require(_0x3c93('0x5'))(_0x3c93('0x6'));var config=require(_0x3c93('0x7'));var jayson=require(_0x3c93('0x8'));var client=jayson[_0x3c93('0x9')]['http']({'port':0x232a});config[_0x3c93('0xa')]=_['defaults'](config[_0x3c93('0xa')],{'host':_0x3c93('0xb'),'port':0x18eb});var socket=require(_0x3c93('0xc'))(new Redis(config['redis']));require(_0x3c93('0xd'))[_0x3c93('0xe')](socket);function respondWithRpcPromise(_0x2acd8d,_0x496c18,_0x41914a){return new BPromise(function(_0x32757a,_0x3b0e5b){return client[_0x3c93('0xf')](_0x2acd8d,_0x41914a)[_0x3c93('0x10')](function(_0x41de76){logger[_0x3c93('0x11')](_0x3c93('0x12'),_0x496c18,_0x3c93('0x13'));logger['debug'](_0x3c93('0x14'),_0x496c18,'request\x20sent',JSON[_0x3c93('0x15')](_0x41de76));if(_0x41de76[_0x3c93('0x16')]){if(_0x41de76[_0x3c93('0x16')]['code']===0x1f4){logger[_0x3c93('0x16')](_0x3c93('0x12'),_0x496c18,_0x41de76[_0x3c93('0x16')][_0x3c93('0x17')]);return _0x3b0e5b(_0x41de76[_0x3c93('0x16')]['message']);}logger[_0x3c93('0x16')](_0x3c93('0x12'),_0x496c18,_0x41de76[_0x3c93('0x16')][_0x3c93('0x17')]);return _0x32757a(_0x41de76[_0x3c93('0x16')][_0x3c93('0x17')]);}else{logger[_0x3c93('0x11')](_0x3c93('0x12'),_0x496c18,_0x3c93('0x13'));_0x32757a(_0x41de76[_0x3c93('0x18')]['message']);}})[_0x3c93('0x19')](function(_0x5308b1){logger['error'](_0x3c93('0x12'),_0x496c18,_0x5308b1);_0x3b0e5b(_0x5308b1);});});} \ No newline at end of file +var _0x6244=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','register','request','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util'];(function(_0x1e6876,_0x574eda){var _0xc77d36=function(_0x3bcef4){while(--_0x3bcef4){_0x1e6876['push'](_0x1e6876['shift']());}};_0xc77d36(++_0x574eda);}(_0x6244,0x1de));var _0x4624=function(_0x3044e0,_0x4e748f){_0x3044e0=_0x3044e0-0x0;var _0x5677e0=_0x6244[_0x3044e0];return _0x5677e0;};'use strict';var _=require(_0x4624('0x0'));var util=require(_0x4624('0x1'));var moment=require('moment');var BPromise=require(_0x4624('0x2'));var rs=require(_0x4624('0x3'));var fs=require('fs');var Redis=require(_0x4624('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4624('0x5'));var logger=require(_0x4624('0x6'))('rpc');var config=require(_0x4624('0x7'));var jayson=require(_0x4624('0x8'));var client=jayson[_0x4624('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x4624('0xa')],{'host':_0x4624('0xb'),'port':0x18eb});var socket=require(_0x4624('0xc'))(new Redis(config[_0x4624('0xa')]));require('./userNotification.socket')[_0x4624('0xd')](socket);function respondWithRpcPromise(_0x58ef70,_0x249936,_0x1cf697){return new BPromise(function(_0x3231ea,_0x342352){return client[_0x4624('0xe')](_0x58ef70,_0x1cf697)['then'](function(_0x5a5204){logger[_0x4624('0xf')](_0x4624('0x10'),_0x249936,_0x4624('0x11'));logger[_0x4624('0x12')](_0x4624('0x13'),_0x249936,_0x4624('0x11'),JSON['stringify'](_0x5a5204));if(_0x5a5204['error']){if(_0x5a5204[_0x4624('0x14')]['code']===0x1f4){logger[_0x4624('0x14')]('UserNotification,\x20%s,\x20%s',_0x249936,_0x5a5204['error'][_0x4624('0x15')]);return _0x342352(_0x5a5204['error'][_0x4624('0x15')]);}logger[_0x4624('0x14')](_0x4624('0x10'),_0x249936,_0x5a5204[_0x4624('0x14')][_0x4624('0x15')]);return _0x3231ea(_0x5a5204[_0x4624('0x14')][_0x4624('0x15')]);}else{logger[_0x4624('0xf')](_0x4624('0x10'),_0x249936,_0x4624('0x11'));_0x3231ea(_0x5a5204[_0x4624('0x16')][_0x4624('0x15')]);}})[_0x4624('0x17')](function(_0x2ecfc0){logger['error'](_0x4624('0x10'),_0x249936,_0x2ecfc0);_0x342352(_0x2ecfc0);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 41a2af6..5f18c76 100644 --- a/server/api/userNotification/userNotification.socket.js +++ b/server/api/userNotification/userNotification.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x42c7=['save','remove','emit','removeListener','register','length','userNotification:'];(function(_0x385fd2,_0x40df67){var _0x3ef59b=function(_0x662f3a){while(--_0x662f3a){_0x385fd2['push'](_0x385fd2['shift']());}};_0x3ef59b(++_0x40df67);}(_0x42c7,0x173));var _0x742c=function(_0x44225a,_0x5ccc84){_0x44225a=_0x44225a-0x0;var _0xe330dd=_0x42c7[_0x44225a];return _0xe330dd;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0x742c('0x0'),_0x742c('0x1'),'update'];function createListener(_0x299cf7,_0x2fc86b){return function(_0x3651c9){_0x2fc86b[_0x742c('0x2')](_0x299cf7,_0x3651c9);};}function removeListener(_0xbf9656,_0x2fc017){return function(){UserNotificationEvents[_0x742c('0x3')](_0xbf9656,_0x2fc017);};}exports[_0x742c('0x4')]=function(_0x100f19){for(var _0x2198f8=0x0,_0x3f2049=events[_0x742c('0x5')];_0x2198f8<_0x3f2049;_0x2198f8++){var _0x11e39b=events[_0x2198f8];var _0x51d006=createListener(_0x742c('0x6')+_0x11e39b,_0x100f19);UserNotificationEvents['on'](_0x11e39b,_0x51d006);}}; \ No newline at end of file +var _0xbac0=['save','removeListener','register','length','./userNotification.events'];(function(_0xb5a1a6,_0x1e2d06){var _0x15f149=function(_0x1456d0){while(--_0x1456d0){_0xb5a1a6['push'](_0xb5a1a6['shift']());}};_0x15f149(++_0x1e2d06);}(_0xbac0,0x1c1));var _0x0bac=function(_0x20936e,_0x4d5283){_0x20936e=_0x20936e-0x0;var _0x50a212=_0xbac0[_0x20936e];return _0x50a212;};'use strict';var UserNotificationEvents=require(_0x0bac('0x0'));var events=[_0x0bac('0x1'),'remove','update'];function createListener(_0x52b741,_0x6cbaf){return function(_0x41cfa3){_0x6cbaf['emit'](_0x52b741,_0x41cfa3);};}function removeListener(_0x320de1,_0x3e4365){return function(){UserNotificationEvents[_0x0bac('0x2')](_0x320de1,_0x3e4365);};}exports[_0x0bac('0x3')]=function(_0x3d1101){for(var _0x348366=0x0,_0x13d4d5=events[_0x0bac('0x4')];_0x348366<_0x13d4d5;_0x348366++){var _0x2a1e58=events[_0x348366];var _0x2c17f6=createListener('userNotification:'+_0x2a1e58,_0x3d1101);UserNotificationEvents['on'](_0x2a1e58,_0x2c17f6);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 584a1cb..392ae7a 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x10ac8c,_0x1c8f8a){var _0x162c3c=function(_0x13d57c){while(--_0x13d57c){_0x10ac8c['push'](_0x10ac8c['shift']());}};_0x162c3c(++_0x1c8f8a);}(_0x70e0,0x17b));var _0x070e=function(_0x91b3ab,_0x99fb55){_0x91b3ab=_0x91b3ab-0x0;var _0x26765c=_0x70e0[_0x91b3ab];return _0x26765c;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x1f6083,_0x280176){var _0x2b1abb=function(_0x49225a){while(--_0x49225a){_0x1f6083['push'](_0x1f6083['shift']());}};_0x2b1abb(++_0x280176);}(_0x70e0,0x17b));var _0x070e=function(_0x5065d2,_0xd0770b){_0x5065d2=_0x5065d2-0x0;var _0x5ba1f9=_0x70e0[_0x5065d2];return _0x5ba1f9;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 7e8cf79..0884d2d 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 _0x8787=['INTEGER','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8787,0x1af));var _0x7878=function(_0x16d055,_0xa15ac1){_0x16d055=_0x16d055-0x0;var _0x4c1889=_0x8787[_0x16d055];return _0x4c1889;};'use strict';var Sequelize=require(_0x7878('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x7878('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x525d=['INTEGER','sequelize'];(function(_0x42232a,_0x5bdbca){var _0x11ef8a=function(_0x157223){while(--_0x157223){_0x42232a['push'](_0x42232a['shift']());}};_0x11ef8a(++_0x5bdbca);}(_0x525d,0x77));var _0xd525=function(_0x26d74e,_0x2ba005){_0x26d74e=_0x26d74e-0x0;var _0x39ab44=_0x525d[_0x26d74e];return _0x39ab44;};'use strict';var Sequelize=require(_0xd525('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xd525('0x1')],'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 64502ff..f1d87f0 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 _0x2c1c=['define','user_has_openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports'];(function(_0x3c54d8,_0x5f47bf){var _0x223193=function(_0x4f9821){while(--_0x4f9821){_0x3c54d8['push'](_0x3c54d8['shift']());}};_0x223193(++_0x5f47bf);}(_0x2c1c,0xb8));var _0xc2c1=function(_0xafdec6,_0x3d94df){_0xafdec6=_0xafdec6-0x0;var _0x372bdb=_0x2c1c[_0xafdec6];return _0x372bdb;};'use strict';var _=require(_0xc2c1('0x0'));var util=require(_0xc2c1('0x1'));var logger=require(_0xc2c1('0x2'))(_0xc2c1('0x3'));var moment=require(_0xc2c1('0x4'));var BPromise=require(_0xc2c1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc2c1('0x6'));var rimraf=require(_0xc2c1('0x7'));var config=require(_0xc2c1('0x8'));var attributes=require(_0xc2c1('0x9'));module[_0xc2c1('0xa')]=function(_0xd3e46c,_0x3987b5){return _0xd3e46c[_0xc2c1('0xb')]('UserOpenchannelQueue',attributes,{'tableName':_0xc2c1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x666e=['request-promise','path','rimraf','user_has_openchannel_queues','lodash','util','../../config/logger','api','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x666e,0x13f));var _0xe666=function(_0x5a2358,_0x16bfff){_0x5a2358=_0x5a2358-0x0;var _0x2be9f1=_0x666e[_0x5a2358];return _0x2be9f1;};'use strict';var _=require(_0xe666('0x0'));var util=require(_0xe666('0x1'));var logger=require(_0xe666('0x2'))(_0xe666('0x3'));var moment=require('moment');var BPromise=require(_0xe666('0x4'));var rp=require(_0xe666('0x5'));var fs=require('fs');var path=require(_0xe666('0x6'));var rimraf=require(_0xe666('0x7'));var config=require('../../config/environment');var attributes=require('./userOpenchannelQueue.attributes');module['exports']=function(_0x5e2540,_0x498060){return _0x5e2540['define']('UserOpenchannelQueue',attributes,{'tableName':_0xe666('0x8'),'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 28a6bcd..e91eae4 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 _0x0aa1=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x0aa1,0x14a));var _0x10aa=function(_0x4ad77b,_0xf69e35){_0x4ad77b=_0x4ad77b-0x0;var _0x1b0f05=_0x0aa1[_0x4ad77b];return _0x1b0f05;};'use strict';var _=require(_0x10aa('0x0'));var util=require(_0x10aa('0x1'));var moment=require(_0x10aa('0x2'));var BPromise=require(_0x10aa('0x3'));var rs=require(_0x10aa('0x4'));var fs=require('fs');var Redis=require(_0x10aa('0x5'));var db=require(_0x10aa('0x6'))['db'];var utils=require(_0x10aa('0x7'));var logger=require('../../config/logger')(_0x10aa('0x8'));var config=require(_0x10aa('0x9'));var jayson=require(_0x10aa('0xa'));var client=jayson[_0x10aa('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x142f0e,_0x37b53f,_0x3f61be){return new BPromise(function(_0x275418,_0x4caf49){return client['request'](_0x142f0e,_0x3f61be)[_0x10aa('0xc')](function(_0xa9c180){logger['info'](_0x10aa('0xd'),_0x37b53f,_0x10aa('0xe'));logger['debug'](_0x10aa('0xf'),_0x37b53f,_0x10aa('0xe'),JSON['stringify'](_0xa9c180));if(_0xa9c180[_0x10aa('0x10')]){if(_0xa9c180[_0x10aa('0x10')][_0x10aa('0x11')]===0x1f4){logger[_0x10aa('0x10')](_0x10aa('0xd'),_0x37b53f,_0xa9c180['error'][_0x10aa('0x12')]);return _0x4caf49(_0xa9c180['error']['message']);}logger[_0x10aa('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x37b53f,_0xa9c180[_0x10aa('0x10')][_0x10aa('0x12')]);return _0x275418(_0xa9c180[_0x10aa('0x10')][_0x10aa('0x12')]);}else{logger[_0x10aa('0x13')](_0x10aa('0xd'),_0x37b53f,'request\x20sent');_0x275418(_0xa9c180[_0x10aa('0x14')][_0x10aa('0x12')]);}})['catch'](function(_0x1a67fb){logger[_0x10aa('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x37b53f,_0x1a67fb);_0x4caf49(_0x1a67fb);});});} \ No newline at end of file +var _0x5187=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','catch','util','moment'];(function(_0x2ef58c,_0x1a35f5){var _0x9757a2=function(_0x2f65a4){while(--_0x2f65a4){_0x2ef58c['push'](_0x2ef58c['shift']());}};_0x9757a2(++_0x1a35f5);}(_0x5187,0xf0));var _0x7518=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0x5187[_0x5c9307];return _0x373e29;};'use strict';var _=require('lodash');var util=require(_0x7518('0x0'));var moment=require(_0x7518('0x1'));var BPromise=require(_0x7518('0x2'));var rs=require(_0x7518('0x3'));var fs=require('fs');var Redis=require(_0x7518('0x4'));var db=require(_0x7518('0x5'))['db'];var utils=require(_0x7518('0x6'));var logger=require(_0x7518('0x7'))(_0x7518('0x8'));var config=require(_0x7518('0x9'));var jayson=require(_0x7518('0xa'));var client=jayson[_0x7518('0xb')][_0x7518('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xe3a3cb,_0x4a602d,_0x1aadd3){return new BPromise(function(_0x56acc4,_0x3a8609){return client[_0x7518('0xd')](_0xe3a3cb,_0x1aadd3)['then'](function(_0x25c757){logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x4a602d,'request\x20sent');logger[_0x7518('0xe')](_0x7518('0xf'),_0x4a602d,_0x7518('0x10'),JSON['stringify'](_0x25c757));if(_0x25c757[_0x7518('0x11')]){if(_0x25c757['error'][_0x7518('0x12')]===0x1f4){logger[_0x7518('0x11')](_0x7518('0x13'),_0x4a602d,_0x25c757['error']['message']);return _0x3a8609(_0x25c757[_0x7518('0x11')][_0x7518('0x14')]);}logger[_0x7518('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x4a602d,_0x25c757[_0x7518('0x11')][_0x7518('0x14')]);return _0x56acc4(_0x25c757[_0x7518('0x11')]['message']);}else{logger['info'](_0x7518('0x13'),_0x4a602d,_0x7518('0x10'));_0x56acc4(_0x25c757['result']['message']);}})[_0x7518('0x15')](function(_0x4f111f){logger[_0x7518('0x11')](_0x7518('0x13'),_0x4a602d,_0x4f111f);_0x3a8609(_0x4f111f);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 3a9bb8d..5530c25 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 _0x58f0=['../../config/environment','./userProfile.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/sections','getSections','getResources','post','create','/:id/clone','clone','addSections','/:id/resources','addResources','update','delete','destroy','removeSections','removeResources','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x10114f,_0x3b593f){var _0x3c822e=function(_0x47e0b7){while(--_0x47e0b7){_0x10114f['push'](_0x10114f['shift']());}};_0x3c822e(++_0x3b593f);}(_0x58f0,0xe9));var _0x058f=function(_0x109579,_0x4b4f01){_0x109579=_0x109579-0x0;var _0x532e7d=_0x58f0[_0x109579];return _0x532e7d;};'use strict';var multer=require('multer');var util=require(_0x058f('0x0'));var path=require(_0x058f('0x1'));var timeout=require(_0x058f('0x2'));var express=require('express');var router=express[_0x058f('0x3')]();var fs_extra=require(_0x058f('0x4'));var auth=require(_0x058f('0x5'));var interaction=require(_0x058f('0x6'));var config=require(_0x058f('0x7'));var controller=require(_0x058f('0x8'));router[_0x058f('0x9')]('/',auth[_0x058f('0xa')](),controller['index']);router[_0x058f('0x9')](_0x058f('0xb'),auth[_0x058f('0xa')](),controller[_0x058f('0xc')]);router[_0x058f('0x9')](_0x058f('0xd'),auth[_0x058f('0xa')](),controller[_0x058f('0xe')]);router[_0x058f('0x9')](_0x058f('0xf'),auth[_0x058f('0xa')](),controller[_0x058f('0x10')]);router[_0x058f('0x9')]('/:id/resources',auth[_0x058f('0xa')](),controller[_0x058f('0x11')]);router[_0x058f('0x12')]('/',auth[_0x058f('0xa')](),controller[_0x058f('0x13')]);router[_0x058f('0x12')](_0x058f('0x14'),auth['isAuthenticated'](),controller[_0x058f('0x15')]);router['post'](_0x058f('0xf'),auth[_0x058f('0xa')](),controller[_0x058f('0x16')]);router[_0x058f('0x12')](_0x058f('0x17'),auth[_0x058f('0xa')](),controller[_0x058f('0x18')]);router['put']('/:id',auth[_0x058f('0xa')](),controller[_0x058f('0x19')]);router[_0x058f('0x1a')](_0x058f('0xd'),auth['isAuthenticated'](),controller[_0x058f('0x1b')]);router[_0x058f('0x1a')]('/:id/sections',auth['isAuthenticated'](),controller[_0x058f('0x1c')]);router[_0x058f('0x1a')]('/:id/resources',auth[_0x058f('0xa')](),controller[_0x058f('0x1d')]);module['exports']=router; \ No newline at end of file +var _0x469d=['../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/sections','/:id/resources','getResources','post','/:id/clone','clone','addSections','addResources','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x38670a,_0x304ca2){var _0xb885c7=function(_0x4cf45d){while(--_0x4cf45d){_0x38670a['push'](_0x38670a['shift']());}};_0xb885c7(++_0x304ca2);}(_0x469d,0x1bb));var _0xd469=function(_0x5890bd,_0x1237f8){_0x5890bd=_0x5890bd-0x0;var _0x44d736=_0x469d[_0x5890bd];return _0x44d736;};'use strict';var multer=require(_0xd469('0x0'));var util=require(_0xd469('0x1'));var path=require(_0xd469('0x2'));var timeout=require(_0xd469('0x3'));var express=require(_0xd469('0x4'));var router=express[_0xd469('0x5')]();var fs_extra=require(_0xd469('0x6'));var auth=require(_0xd469('0x7'));var interaction=require(_0xd469('0x8'));var config=require(_0xd469('0x9'));var controller=require(_0xd469('0xa'));router['get']('/',auth[_0xd469('0xb')](),controller[_0xd469('0xc')]);router[_0xd469('0xd')](_0xd469('0xe'),auth[_0xd469('0xb')](),controller[_0xd469('0xf')]);router[_0xd469('0xd')](_0xd469('0x10'),auth[_0xd469('0xb')](),controller[_0xd469('0x11')]);router['get'](_0xd469('0x12'),auth[_0xd469('0xb')](),controller['getSections']);router[_0xd469('0xd')](_0xd469('0x13'),auth[_0xd469('0xb')](),controller[_0xd469('0x14')]);router[_0xd469('0x15')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd469('0x15')](_0xd469('0x16'),auth[_0xd469('0xb')](),controller[_0xd469('0x17')]);router[_0xd469('0x15')]('/:id/sections',auth[_0xd469('0xb')](),controller[_0xd469('0x18')]);router[_0xd469('0x15')](_0xd469('0x13'),auth[_0xd469('0xb')](),controller[_0xd469('0x19')]);router[_0xd469('0x1a')]('/:id',auth[_0xd469('0xb')](),controller['update']);router[_0xd469('0x1b')](_0xd469('0x10'),auth[_0xd469('0xb')](),controller[_0xd469('0x1c')]);router[_0xd469('0x1b')](_0xd469('0x12'),auth[_0xd469('0xb')](),controller['removeSections']);router['delete'](_0xd469('0x13'),auth[_0xd469('0xb')](),controller['removeResources']);module[_0xd469('0x1d')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index dbbc91f..84dac2b 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 _0xe385=['setDataValue','crudPermissions','join','getDataValue','split','BOOLEAN','sequelize','exports','STRING','name'];(function(_0x14aa67,_0x65028d){var _0x4c431b=function(_0x276dc6){while(--_0x276dc6){_0x14aa67['push'](_0x14aa67['shift']());}};_0x4c431b(++_0x65028d);}(_0xe385,0xba));var _0x5e38=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xe385[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x5e38('0x0'));module[_0x5e38('0x1')]={'name':{'type':Sequelize[_0x5e38('0x2')],'allowNull':![],'unique':_0x5e38('0x3')},'crudPermissions':{'type':Sequelize[_0x5e38('0x2')],'set':function(_0x37a61d){this[_0x5e38('0x4')](_0x5e38('0x5'),_0x37a61d?_0x37a61d[_0x5e38('0x6')](''):[]);},'get':function(){return this[_0x5e38('0x7')](_0x5e38('0x5'))?this[_0x5e38('0x7')]('crudPermissions')[_0x5e38('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x5e38('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x5e38('0x9')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x5e38('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x5e38('0x9')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x5e38('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x5e38('0x9')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x5e38('0x9')],'defaultValue':!![]}}; \ No newline at end of file +var _0x22af=['exports','STRING','name','setDataValue','join','getDataValue','BOOLEAN'];(function(_0xaf44e8,_0x4e7f99){var _0x32f1e1=function(_0x2bb5dd){while(--_0x2bb5dd){_0xaf44e8['push'](_0xaf44e8['shift']());}};_0x32f1e1(++_0x4e7f99);}(_0x22af,0xee));var _0xf22a=function(_0x1fb1c1,_0x4ebe69){_0x1fb1c1=_0x1fb1c1-0x0;var _0x1622df=_0x22af[_0x1fb1c1];return _0x1622df;};'use strict';var Sequelize=require('sequelize');module[_0xf22a('0x0')]={'name':{'type':Sequelize[_0xf22a('0x1')],'allowNull':![],'unique':_0xf22a('0x2')},'crudPermissions':{'type':Sequelize[_0xf22a('0x1')],'set':function(_0x39dde8){this[_0xf22a('0x3')]('crudPermissions',_0x39dde8?_0x39dde8[_0xf22a('0x4')](''):[]);},'get':function(){return this[_0xf22a('0x5')]('crudPermissions')?this[_0xf22a('0x5')]('crudPermissions')['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xf22a('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xf22a('0x6')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xf22a('0x6')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xf22a('0x6')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xf22a('0x6')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xf22a('0x6')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xf22a('0x6')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 7093cd1..adaa06c 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 _0x4253=['ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','undefined','count','offset','Content-Range','json','apply','save','then','destroy','end','error','stack','name','send','index','map','UserProfile','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','catch','show','includeAll','find','create','body','clone','params','createdAt','updatedAt','crudPermissions','omit','sequelize','transaction','get','UserProfileSection','each','findAll','userProfileId','Resources','update','describe','UserProfileResource','push','removeSections','ids','getSections','enabled','includes','sectionId','isEmpty','subsections','autoAssociation','findOne','forEach','Plugin','resourceId','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x501c43,_0x29364c){var _0x1f5d04=function(_0x15c2ea){while(--_0x15c2ea){_0x501c43['push'](_0x501c43['shift']());}};_0x1f5d04(++_0x29364c);}(_0x4253,0x14c));var _0x3425=function(_0x3daeb4,_0x15a177){_0x3daeb4=_0x3daeb4-0x0;var _0x134850=_0x4253[_0x3daeb4];return _0x134850;};'use strict';var emlformat=require(_0x3425('0x0'));var rimraf=require(_0x3425('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3425('0x2'));var rp=require('request-promise');var moment=require(_0x3425('0x3'));var BPromise=require(_0x3425('0x4'));var Mustache=require(_0x3425('0x5'));var util=require(_0x3425('0x6'));var path=require(_0x3425('0x7'));var sox=require(_0x3425('0x8'));var csv=require(_0x3425('0x9'));var ejs=require(_0x3425('0xa'));var fs=require('fs');var fs_extra=require(_0x3425('0xb'));var _=require('lodash');var squel=require(_0x3425('0xc'));var crypto=require(_0x3425('0xd'));var jsforce=require(_0x3425('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3425('0x9'));var querystring=require(_0x3425('0xf'));var Papa=require('papaparse');var Redis=require(_0x3425('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3425('0x11'));var logger=require(_0x3425('0x12'))(_0x3425('0x13'));var utils=require('../../config/utils');var config=require(_0x3425('0x14'));var licenseUtil=require(_0x3425('0x15'));var db=require(_0x3425('0x16'))['db'];config['redis']=_[_0x3425('0x17')](config[_0x3425('0x18')],{'host':_0x3425('0x19'),'port':0x18eb});var socket=require(_0x3425('0x1a'))(new Redis(config[_0x3425('0x18')]));require(_0x3425('0x1b'))[_0x3425('0x1c')](socket);function respondWithStatusCode(_0x4ded18,_0x1b5984){_0x1b5984=_0x1b5984||0xcc;return function(_0x47b584){if(_0x47b584){return _0x4ded18[_0x3425('0x1d')](_0x1b5984);}return _0x4ded18[_0x3425('0x1e')](_0x1b5984)['end']();};}function respondWithResult(_0x169458,_0x1ab174){_0x1ab174=_0x1ab174||0xc8;return function(_0x57fe16){if(_0x57fe16){return _0x169458[_0x3425('0x1e')](_0x1ab174)['json'](_0x57fe16);}};}function respondWithFilteredResult(_0xd43449,_0x2ffce2){return function(_0x1565c8){if(_0x1565c8){var _0x2156c4=typeof _0x2ffce2['offset']===_0x3425('0x1f')&&typeof _0x2ffce2['limit']===_0x3425('0x1f');var _0xe4b66e=_0x1565c8[_0x3425('0x20')];var _0x72df8b=_0x2156c4?0x0:_0x2ffce2[_0x3425('0x21')];var _0x3444b6=_0x2156c4?_0x1565c8[_0x3425('0x20')]:_0x2ffce2[_0x3425('0x21')]+_0x2ffce2['limit'];var _0x4a6131;if(_0x3444b6>=_0xe4b66e){_0x3444b6=_0xe4b66e;_0x4a6131=0xc8;}else{_0x4a6131=0xce;}_0xd43449[_0x3425('0x1e')](_0x4a6131);return _0xd43449['set'](_0x3425('0x22'),_0x72df8b+'-'+_0x3444b6+'/'+_0xe4b66e)[_0x3425('0x23')](_0x1565c8);}return null;};}function patchUpdates(_0x11705a){return function(_0x29abdd){try{jsonpatch[_0x3425('0x24')](_0x29abdd,_0x11705a,!![]);}catch(_0x2f9881){return BPromise['reject'](_0x2f9881);}return _0x29abdd[_0x3425('0x25')]();};}function saveUpdates(_0x34617c,_0x476504){return function(_0x1e6ef0){if(_0x1e6ef0){return _0x1e6ef0['update'](_0x34617c)[_0x3425('0x26')](function(_0x31d4d5){return _0x31d4d5;});}return null;};}function removeEntity(_0x2a2162,_0x407a76){return function(_0x6f3dd7){if(_0x6f3dd7){return _0x6f3dd7[_0x3425('0x27')]()[_0x3425('0x26')](function(){_0x2a2162[_0x3425('0x1e')](0xcc)[_0x3425('0x28')]();});}};}function handleEntityNotFound(_0xd63a3f,_0x354cb8){return function(_0x16c50a){if(!_0x16c50a){_0xd63a3f[_0x3425('0x1d')](0x194);}return _0x16c50a;};}function handleError(_0x3643e5,_0x4d862d){_0x4d862d=_0x4d862d||0x1f4;return function(_0x1ae04f){logger[_0x3425('0x29')](_0x1ae04f[_0x3425('0x2a')]);if(_0x1ae04f[_0x3425('0x2b')]){delete _0x1ae04f[_0x3425('0x2b')];}_0x3643e5[_0x3425('0x1e')](_0x4d862d)[_0x3425('0x2c')](_0x1ae04f);};}exports[_0x3425('0x2d')]=function(_0xc2f4f5,_0x15aca6){var _0x24b353={},_0xf4111={},_0x256a64={'count':0x0,'rows':[]};var _0x425753=_[_0x3425('0x2e')](db[_0x3425('0x2f')][_0x3425('0x30')],function(_0x4001ac){return{'name':_0x4001ac['fieldName'],'type':_0x4001ac[_0x3425('0x31')][_0x3425('0x32')]};});_0xf4111[_0x3425('0x33')]=_['map'](_0x425753,_0x3425('0x2b'));_0xf4111[_0x3425('0x34')]=_[_0x3425('0x35')](_0xc2f4f5[_0x3425('0x34')]);_0xf4111[_0x3425('0x36')]=_[_0x3425('0x37')](_0xf4111[_0x3425('0x33')],_0xf4111[_0x3425('0x34')]);_0x24b353[_0x3425('0x38')]=_[_0x3425('0x37')](_0xf4111[_0x3425('0x33')],qs[_0x3425('0x39')](_0xc2f4f5['query'][_0x3425('0x39')]));_0x24b353[_0x3425('0x38')]=_0x24b353[_0x3425('0x38')][_0x3425('0x3a')]?_0x24b353[_0x3425('0x38')]:_0xf4111[_0x3425('0x33')];if(!_0xc2f4f5[_0x3425('0x34')][_0x3425('0x3b')](_0x3425('0x3c'))){_0x24b353[_0x3425('0x3d')]=qs[_0x3425('0x3d')](_0xc2f4f5[_0x3425('0x34')]['limit']);_0x24b353[_0x3425('0x21')]=qs[_0x3425('0x21')](_0xc2f4f5[_0x3425('0x34')][_0x3425('0x21')]);}_0x24b353[_0x3425('0x3e')]=qs[_0x3425('0x3f')](_0xc2f4f5[_0x3425('0x34')][_0x3425('0x3f')]);_0x24b353[_0x3425('0x40')]=qs[_0x3425('0x36')](_[_0x3425('0x41')](_0xc2f4f5['query'],_0xf4111[_0x3425('0x36')]),_0x425753);if(_0xc2f4f5[_0x3425('0x34')]['filter']){_0x24b353[_0x3425('0x40')]=_[_0x3425('0x42')](_0x24b353[_0x3425('0x40')],{'$or':_[_0x3425('0x2e')](_0x425753,function(_0x4c6efd){if(_0x4c6efd[_0x3425('0x31')]!==_0x3425('0x43')){var _0x3b3d46={};_0x3b3d46[_0x4c6efd['name']]={'$like':'%'+_0xc2f4f5['query'][_0x3425('0x44')]+'%'};return _0x3b3d46;}})});}_0x24b353=_[_0x3425('0x42')]({},_0x24b353,_0xc2f4f5[_0x3425('0x45')]);var _0xd83775={'where':_0x24b353['where']};return db[_0x3425('0x2f')][_0x3425('0x20')](_0xd83775)[_0x3425('0x26')](function(_0x175084){_0x256a64[_0x3425('0x20')]=_0x175084;if(_0xc2f4f5[_0x3425('0x34')]['includeAll']){_0x24b353[_0x3425('0x46')]=[{'all':!![]}];}return db[_0x3425('0x2f')]['findAll'](_0x24b353);})['then'](function(_0x1b8633){_0x256a64['rows']=_0x1b8633;return _0x256a64;})[_0x3425('0x26')](respondWithFilteredResult(_0x15aca6,_0x24b353))[_0x3425('0x47')](handleError(_0x15aca6,null));};exports[_0x3425('0x48')]=function(_0x1435b4,_0x40db42){var _0x660947={'raw':![],'where':{'id':_0x1435b4['params']['id']}},_0x217a16={};_0x217a16['model']=_[_0x3425('0x35')](db[_0x3425('0x2f')][_0x3425('0x30')]);_0x217a16[_0x3425('0x34')]=_[_0x3425('0x35')](_0x1435b4[_0x3425('0x34')]);_0x217a16['filters']=_[_0x3425('0x37')](_0x217a16[_0x3425('0x33')],_0x217a16[_0x3425('0x34')]);_0x660947[_0x3425('0x38')]=_[_0x3425('0x37')](_0x217a16[_0x3425('0x33')],qs['fields'](_0x1435b4[_0x3425('0x34')][_0x3425('0x39')]));_0x660947['attributes']=_0x660947[_0x3425('0x38')]['length']?_0x660947['attributes']:_0x217a16[_0x3425('0x33')];if(_0x1435b4[_0x3425('0x34')][_0x3425('0x49')]){_0x660947['include']=[{'all':!![]}];}_0x660947=_[_0x3425('0x42')]({},_0x660947,_0x1435b4['options']);return db[_0x3425('0x2f')][_0x3425('0x4a')](_0x660947)['then'](handleEntityNotFound(_0x40db42,null))[_0x3425('0x26')](respondWithResult(_0x40db42,null))[_0x3425('0x47')](handleError(_0x40db42,null));};exports[_0x3425('0x4b')]=function(_0x17626f,_0x357312){return db[_0x3425('0x2f')][_0x3425('0x4b')](_0x17626f[_0x3425('0x4c')],{})[_0x3425('0x26')](respondWithResult(_0x357312,0xc9))[_0x3425('0x47')](handleError(_0x357312,null));};exports[_0x3425('0x4d')]=function(_0x511379,_0x7bb1d){var _0x25d92b={'where':{'id':_0x511379[_0x3425('0x4e')]['id']}},_0x567164={};_0x567164[_0x3425('0x33')]=_['keys'](db['UserProfile'][_0x3425('0x30')]);_0x25d92b[_0x3425('0x38')]=_[_0x3425('0x37')](_0x567164['model'],qs[_0x3425('0x39')](_0x511379[_0x3425('0x34')][_0x3425('0x39')]));_0x25d92b['attributes']=_0x25d92b['attributes'][_0x3425('0x3a')]?_0x25d92b[_0x3425('0x38')]:_0x567164[_0x3425('0x33')];if(_0x511379[_0x3425('0x34')][_0x3425('0x49')]){_0x25d92b['include']=[{'all':!![]}];}_0x25d92b=_['merge']({},_0x25d92b,_0x511379[_0x3425('0x45')]);return db[_0x3425('0x2f')][_0x3425('0x4a')](_0x25d92b)['then'](handleEntityNotFound(_0x7bb1d,null))[_0x3425('0x26')](function(_0x4907d6){if(_0x4907d6){var _0x6c3b72=_0x4907d6['get']({'plain':!![]});_0x6c3b72=qs['omit'](_0x6c3b72,['id',_0x3425('0x4f'),_0x3425('0x50'),_0x3425('0x51')]);_0x511379[_0x3425('0x4c')]=_[_0x3425('0x52')](_0x511379[_0x3425('0x4c')],['id',_0x3425('0x4f'),_0x3425('0x50')]);return db[_0x3425('0x53')][_0x3425('0x54')](function(_0x1a3f16){return db[_0x3425('0x2f')][_0x3425('0x4b')](_[_0x3425('0x42')](_0x6c3b72,_0x511379['body']),{'include':_0x511379[_0x3425('0x34')][_0x3425('0x49')]?[{'all':!![]}]:undefined,'transaction':_0x1a3f16})['then'](function(_0x3e0abc){var _0x23e2b9=_0x3e0abc[_0x3425('0x55')]({'plain':!![]});return db[_0x3425('0x56')]['findAll']({'where':{'userProfileId':_0x511379[_0x3425('0x4e')]['id']},'raw':!![]})['then'](function(_0x3ccead){if(_0x3ccead){return BPromise[_0x3425('0x57')](_0x3ccead,function(_0x5a2919){return new BPromise(function(_0x136067,_0x1c6724){if(_0x5a2919['autoAssociation']===null||_0x5a2919['autoAssociation']===0x1)_0x136067(null);return db['UserProfileResource'][_0x3425('0x58')]({'where':{'sectionId':_0x5a2919['id']},'raw':!![]})[_0x3425('0x26')](function(_0x588472){var _0x37a8ce=_['map'](_0x588472,function(_0x2d3513){return qs[_0x3425('0x52')](_0x2d3513,['id',_0x3425('0x4f'),_0x3425('0x50'),'sectionId']);});_0x136067(_0x37a8ce);})[_0x3425('0x47')](function(_0x247ea9){_0x1c6724(_0x247ea9);});})[_0x3425('0x26')](function(_0x3eb74c){var _0x11844b=qs[_0x3425('0x52')](_0x5a2919,['id',_0x3425('0x4f'),_0x3425('0x50')]);_0x11844b[_0x3425('0x59')]=_0x23e2b9['id'];if(_0x3eb74c)_0x11844b[_0x3425('0x5a')]=_0x3eb74c;return _0x11844b;})['then'](function(_0x28682d){return db[_0x3425('0x56')][_0x3425('0x4b')](_0x28682d,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x1a3f16});});})[_0x3425('0x26')](function(){return _0x23e2b9;});}});});});}})['then'](respondWithResult(_0x7bb1d,0xc9))[_0x3425('0x47')](handleError(_0x7bb1d,null));};exports[_0x3425('0x5b')]=function(_0x4e1f18,_0x3492f0){if(_0x4e1f18[_0x3425('0x4c')]['id']){delete _0x4e1f18[_0x3425('0x4c')]['id'];}return db[_0x3425('0x2f')][_0x3425('0x4a')]({'where':{'id':_0x4e1f18[_0x3425('0x4e')]['id']}})[_0x3425('0x26')](handleEntityNotFound(_0x3492f0,null))[_0x3425('0x26')](saveUpdates(_0x4e1f18[_0x3425('0x4c')],null))[_0x3425('0x26')](respondWithResult(_0x3492f0,null))['catch'](handleError(_0x3492f0,null));};exports[_0x3425('0x27')]=function(_0x279b7a,_0x22bdd4){return db['UserProfile']['find']({'where':{'id':_0x279b7a[_0x3425('0x4e')]['id']}})[_0x3425('0x26')](handleEntityNotFound(_0x22bdd4,null))[_0x3425('0x26')](removeEntity(_0x22bdd4,null))['catch'](handleError(_0x22bdd4,null));};exports[_0x3425('0x5c')]=function(_0x3f93f3,_0x653713){return db[_0x3425('0x2f')][_0x3425('0x5c')]()[_0x3425('0x26')](respondWithResult(_0x653713,null))[_0x3425('0x47')](handleError(_0x653713,null));};exports['addSections']=function(_0x118f00,_0x37622f){var _0x37dda2=_0x118f00[_0x3425('0x4c')];return db[_0x3425('0x2f')]['find']({'where':{'id':_0x118f00[_0x3425('0x4e')]['id']}})['then'](handleEntityNotFound(_0x37622f,null))[_0x3425('0x26')](function(_0x491c5c){if(_0x491c5c){return db[_0x3425('0x53')]['transaction'](function(_0x2b584a){return db[_0x3425('0x56')]['destroy']({'where':{'userProfileId':_0x118f00['params']['id'],'sectionId':_[_0x3425('0x2e')](_0x37dda2,function(_0x388ea6){return _0x388ea6['sectionId'];})},'transaction':_0x2b584a})[_0x3425('0x26')](function(){var _0x5d43a=_[_0x3425('0x2e')](_0x37dda2,function(_0x5cd73c){_0x5cd73c[_0x3425('0x59')]=_0x118f00[_0x3425('0x4e')]['id'];return _0x5cd73c;});var _0x3fb9fe=[];return BPromise[_0x3425('0x57')](_0x5d43a,function(_0x582f49){return db['UserProfileSection']['create'](_0x582f49,{'include':[{'model':db[_0x3425('0x5d')],'as':_0x3425('0x5a')}],'raw':!![],'transaction':_0x2b584a})['then'](function(_0x4946bb){_0x3fb9fe[_0x3425('0x5e')](_0x4946bb[_0x3425('0x55')]({'plain':!![]}));});})[_0x3425('0x26')](function(){return _0x3fb9fe;});});});}})['then'](function(_0x4946d3){return _0x4946d3;})[_0x3425('0x26')](respondWithResult(_0x37622f,null))[_0x3425('0x47')](handleError(_0x37622f,null));};exports[_0x3425('0x5f')]=function(_0x1fd540,_0x4c169e){var _0x3b07de;return db[_0x3425('0x2f')][_0x3425('0x4a')]({'where':{'id':_0x1fd540[_0x3425('0x4e')]['id']},'attributes':['id','name']})[_0x3425('0x26')](handleEntityNotFound(_0x4c169e,null))['then'](function(_0x1248d3){if(_0x1248d3){_0x3b07de=_0x1248d3;return db['UserProfileSection'][_0x3425('0x27')]({'where':{'userProfileId':_0x1fd540[_0x3425('0x4e')]['id'],'sectionId':_0x1fd540[_0x3425('0x34')][_0x3425('0x60')]}});}})[_0x3425('0x26')](function(){return _0x3b07de;})[_0x3425('0x26')](respondWithStatusCode(_0x4c169e,null))[_0x3425('0x47')](handleError(_0x4c169e,null));};exports[_0x3425('0x61')]=function(_0x5b2b50,_0x5b53b8){var _0x2de35f=[];var _0x2a15f5=[];return db[_0x3425('0x56')][_0x3425('0x58')]({'where':{'userProfileId':_0x5b2b50[_0x3425('0x4e')]['id']},'raw':!![]})['then'](function(_0x40bf7a){_0x2de35f=_[_0x3425('0x44')](_0x40bf7a,function(_0x544643){return _0x544643[_0x3425('0x62')]===0x1||_[_0x3425('0x63')]([0x3eb,0x709],_0x544643[_0x3425('0x64')]);});if(!_[_0x3425('0x65')](_0x2de35f)){return _[_0x3425('0x2e')](_0x2de35f,function(_0x13b127){return _0x13b127['sectionId'];});}else{return;}})['then'](function(_0x35f4d8){if(_0x35f4d8)_0x2a15f5=_0x35f4d8;if(_[_0x3425('0x63')](_0x2a15f5,0x64)){var _0x2098cf=_[_0x3425('0x4a')](_0x2de35f,{'sectionId':0x64});return hasDefaultDashboard(_0x2098cf)[_0x3425('0x26')](function(_0x10d93f){return _[_0x3425('0x2e')](_0x2de35f,function(_0x544299){if(_0x544299[_0x3425('0x64')]===0x64){_0x544299[_0x3425('0x66')]=_0x10d93f;}return _0x544299;});});}else{return;}})[_0x3425('0x26')](function(_0x2b8671){if(_0x2b8671)_0x2de35f=_0x2b8671;if(_['includes'](_0x2a15f5,0x3eb)){var _0x5bc7ad=_[_0x3425('0x4a')](_0x2de35f,{'sectionId':0x3eb});return getCustomDashboards(_0x5bc7ad)[_0x3425('0x26')](function(_0x47eb35){return _['map'](_0x2de35f,function(_0x1ed036){if(_0x5bc7ad[_0x3425('0x62')]){if(_0x1ed036[_0x3425('0x64')]===0x3eb){_0x1ed036['subsections']=_0x47eb35;}}else{if(_0x1ed036[_0x3425('0x64')]===0x64){_0x1ed036[_0x3425('0x66')]=_0x47eb35;}}return _0x1ed036;});});}else{return;}})[_0x3425('0x26')](function(_0x50f26e){if(_0x50f26e)_0x2de35f=_0x50f26e;if(_[_0x3425('0x63')](_0x2a15f5,0x709)){var _0x358906=_[_0x3425('0x4a')](_0x2de35f,{'sectionId':0x709});return getPlugins(_0x358906)[_0x3425('0x26')](function(_0x2e5001){if(_0x358906[_0x3425('0x62')]){return _[_0x3425('0x2e')](_0x2de35f,function(_0x33641e){if(_0x33641e['sectionId']===0x709){_0x33641e[_0x3425('0x66')]=_0x2e5001;}return _0x33641e;});}else{var _0x44ee53={'sectionId':0x76c,'enabled':0x1,'subsections':_0x2e5001};var _0x13bbea=_[_0x3425('0x2e')](_0x2de35f);_0x13bbea['push'](_0x44ee53);return _0x13bbea;}});}else{return;}})[_0x3425('0x26')](function(_0x48e287){if(_0x48e287)_0x2de35f=_0x48e287;return _['filter'](_0x2de35f,[_0x3425('0x62'),0x1]);})[_0x3425('0x26')](respondWithResult(_0x5b53b8,null))[_0x3425('0x47')](handleError(_0x5b53b8,null));};function hasDefaultDashboard(_0x29922d){var _0x2523db=[0x65];return new BPromise(function(_0xf73d26,_0x55bc9c){try{if(_0x29922d[_0x3425('0x67')]){_0xf73d26(_0x2523db);}else{return db[_0x3425('0x5d')][_0x3425('0x68')]({'where':{'sectionId':_0x29922d['id']},'raw':!![]})[_0x3425('0x26')](function(_0x9043dc){_0x9043dc?_0xf73d26(_0x2523db):_0xf73d26();});}}catch(_0x2f0091){_0x55bc9c(_0x2f0091);}});}function getCustomDashboards(_0x56b9e3){var _0x212e51=[];return new BPromise(function(_0xebd283,_0x111cdd){try{if(_0x56b9e3[_0x3425('0x67')]){return db['Dashboard'][_0x3425('0x58')]({'raw':!![]})['then'](function(_0x29130a){_0x29130a[_0x3425('0x69')](function(_0xa99fe3){_0x212e51[_0x3425('0x5e')](_0xa99fe3['id']+0x1869f);});_0xebd283(_0x212e51);});}else{return db[_0x3425('0x5d')]['findAll']({'where':{'sectionId':_0x56b9e3['id']},'raw':!![]})['then'](function(_0x4268cc){_0x4268cc['forEach'](function(_0x490adf){_0x212e51['push'](_0x490adf['resourceId']+0x1869f);});_0xebd283(_0x212e51);});}}catch(_0x376a08){_0x111cdd(_0x376a08);}});}function getPlugins(_0x5b453f){var _0x493f2c=[];return new BPromise(function(_0x3e2eaf,_0x166da7){try{if(_0x5b453f[_0x3425('0x67')]){return db[_0x3425('0x6a')][_0x3425('0x58')]({'raw':!![]})[_0x3425('0x26')](function(_0x2af420){_0x2af420[_0x3425('0x69')](function(_0x3bf581){_0x493f2c[_0x3425('0x5e')](_0x3bf581['id']+0x15b38);});_0x3e2eaf(_0x493f2c);});}else{return db[_0x3425('0x5d')][_0x3425('0x58')]({'where':{'sectionId':_0x5b453f['id']},'raw':!![]})['then'](function(_0x4c9cb0){_0x4c9cb0[_0x3425('0x69')](function(_0xd4ab0){_0x493f2c[_0x3425('0x5e')](_0xd4ab0[_0x3425('0x6b')]+0x15b38);});_0x3e2eaf(_0x493f2c);});}}catch(_0x13c6d4){_0x166da7(_0x13c6d4);}});}exports['addResources']=function(_0x198ee7,_0x536d8a){return db['UserProfile'][_0x3425('0x4a')]({'where':{'id':_0x198ee7['params']['id']}})[_0x3425('0x26')](handleEntityNotFound(_0x536d8a,null))[_0x3425('0x26')](function(_0x4b8232){if(_0x4b8232){return db['sequelize']['transaction'](function(_0x609d54){return db[_0x3425('0x56')]['findAll']({'where':{'userProfileId':_0x198ee7[_0x3425('0x4e')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x48f3e1){if(_0x48f3e1){return db[_0x3425('0x56')][_0x3425('0x27')]({'where':{'userProfileId':_0x198ee7[_0x3425('0x4e')]['id'],'id':_[_0x3425('0x2e')](_0x48f3e1,function(_0x156e03){return _0x156e03['id'];})},'transaction':_0x609d54});}})[_0x3425('0x26')](function(_0x4f2a8a){var _0x46d743=_['map'](_0x198ee7[_0x3425('0x4c')],function(_0x242625){_0x242625['userProfileId']=_0x198ee7[_0x3425('0x4e')]['id'];return _0x242625;});return db[_0x3425('0x56')][_0x3425('0x6c')](_0x46d743,{'raw':!![],'transaction':_0x609d54});})[_0x3425('0x26')](function(_0x348074){var _0x3701d9=_['filter'](_[_0x3425('0x2e')](_0x348074,function(_0x5095b6){return _0x5095b6['get']({'plain':!![]});}),{'includeAll':![]});if(_0x3701d9){return db[_0x3425('0x56')]['findAll']({'where':{'userProfileId':_0x198ee7[_0x3425('0x4e')]['id'],'sectionId':_[_0x3425('0x2e')](_0x3701d9,function(_0x262e36){return _0x262e36[_0x3425('0x64')];})},'attributes':['id','sectionId'],'raw':!![]})[_0x3425('0x26')](function(_0x36cbc0){var _0x53b9d1=_['map'](_0x198ee7[_0x3425('0x4c')],function(_0x38fe17){_0x38fe17[_0x3425('0x59')]=_0x198ee7[_0x3425('0x4e')]['id'];return _0x38fe17;});return db['UserProfileResource'][_0x3425('0x6c')](_0x53b9d1,{'raw':!![],'transaction':_0x609d54});});}})['catch'](handleError(_0x536d8a,null));});}})[_0x3425('0x26')](function(_0xb35aee){var _0x2c502a=_[_0x3425('0x2e')](_0xb35aee,function(_0x37e605){return _0x37e605['get']({'plain':!![]});});})[_0x3425('0x26')](respondWithResult(_0x536d8a,null))[_0x3425('0x47')](handleError(_0x536d8a,null));};exports[_0x3425('0x6d')]=function(_0x480e50,_0x36508c,_0x339e01){return db[_0x3425('0x2f')][_0x3425('0x4a')]({'where':{'id':_0x480e50['params']['id']}})['then'](handleEntityNotFound(_0x36508c,null))[_0x3425('0x26')](function(_0x14f0ac){if(_0x14f0ac){return _0x14f0ac[_0x3425('0x6d')](_0x480e50['query'][_0x3425('0x60')]);}})[_0x3425('0x26')](respondWithStatusCode(_0x36508c,null))[_0x3425('0x47')](handleError(_0x36508c,null));};exports[_0x3425('0x6e')]=function(_0x137f84,_0x4a7955){var _0x1c8734={};if(!_0x137f84[_0x3425('0x34')][_0x3425('0x6f')])throw new Error(_0x3425('0x70'));if(!_0x137f84[_0x3425('0x34')]['hasOwnProperty'](_0x3425('0x3c'))){_0x1c8734[_0x3425('0x3d')]=qs[_0x3425('0x3d')](_0x137f84[_0x3425('0x34')][_0x3425('0x3d')]);_0x1c8734[_0x3425('0x21')]=qs[_0x3425('0x21')](_0x137f84[_0x3425('0x34')][_0x3425('0x21')]);}return db['UserProfile'][_0x3425('0x4a')]({'where':{'id':_0x137f84['params']['id']}})[_0x3425('0x26')](function(_0x3a4788){if(!_0x3a4788)throw new Error(_0x3425('0x71')+_0x137f84['params']['id']);return db[_0x3425('0x2f')][_0x3425('0x6e')](_0x137f84);})['then'](respondWithFilteredResult(_0x4a7955,_0x1c8734))[_0x3425('0x47')](handleError(_0x4a7955,null));}; \ No newline at end of file +var _0x1189=['params','fields','include','find','create','body','clone','get','omit','createdAt','updatedAt','crudPermissions','transaction','UserProfileSection','each','autoAssociation','sectionId','UserProfileResource','Resources','describe','sequelize','userProfileId','push','ids','getSections','enabled','includes','subsections','findOne','Dashboard','Plugin','forEach','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','destroy','then','end','error','stack','name','send','UserProfile','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','length','hasOwnProperty','order','sort','where','filters','pick','merge','filter','options','includeAll','findAll','rows','catch'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x1189,0x17f));var _0x9118=function(_0x274939,_0x2a2cb8){_0x274939=_0x274939-0x0;var _0x28478e=_0x1189[_0x274939];return _0x28478e;};'use strict';var emlformat=require(_0x9118('0x0'));var rimraf=require(_0x9118('0x1'));var zipdir=require(_0x9118('0x2'));var jsonpatch=require(_0x9118('0x3'));var rp=require('request-promise');var moment=require(_0x9118('0x4'));var BPromise=require(_0x9118('0x5'));var Mustache=require(_0x9118('0x6'));var util=require(_0x9118('0x7'));var path=require(_0x9118('0x8'));var sox=require(_0x9118('0x9'));var csv=require(_0x9118('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9118('0xb'));var _=require(_0x9118('0xc'));var squel=require(_0x9118('0xd'));var crypto=require(_0x9118('0xe'));var jsforce=require(_0x9118('0xf'));var deskjs=require(_0x9118('0x10'));var toCsv=require('to-csv');var querystring=require(_0x9118('0x11'));var Papa=require(_0x9118('0x12'));var Redis=require(_0x9118('0x13'));var authService=require(_0x9118('0x14'));var qs=require(_0x9118('0x15'));var as=require(_0x9118('0x16'));var hardwareService=require(_0x9118('0x17'));var logger=require('../../config/logger')(_0x9118('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9118('0x19'));var db=require(_0x9118('0x1a'))['db'];config['redis']=_[_0x9118('0x1b')](config[_0x9118('0x1c')],{'host':_0x9118('0x1d'),'port':0x18eb});var socket=require(_0x9118('0x1e'))(new Redis(config[_0x9118('0x1c')]));require(_0x9118('0x1f'))[_0x9118('0x20')](socket);function respondWithStatusCode(_0x11b1b9,_0x2b19c5){_0x2b19c5=_0x2b19c5||0xcc;return function(_0x389301){if(_0x389301){return _0x11b1b9[_0x9118('0x21')](_0x2b19c5);}return _0x11b1b9['status'](_0x2b19c5)['end']();};}function respondWithResult(_0x30241a,_0x563d91){_0x563d91=_0x563d91||0xc8;return function(_0x45a089){if(_0x45a089){return _0x30241a[_0x9118('0x22')](_0x563d91)[_0x9118('0x23')](_0x45a089);}};}function respondWithFilteredResult(_0x1f0b31,_0x48cad0){return function(_0x3b37ac){if(_0x3b37ac){var _0x5ec298=typeof _0x48cad0[_0x9118('0x24')]==='undefined'&&typeof _0x48cad0[_0x9118('0x25')]===_0x9118('0x26');var _0x4d4826=_0x3b37ac[_0x9118('0x27')];var _0x1e133b=_0x5ec298?0x0:_0x48cad0[_0x9118('0x24')];var _0x172d10=_0x5ec298?_0x3b37ac[_0x9118('0x27')]:_0x48cad0['offset']+_0x48cad0[_0x9118('0x25')];var _0x178b01;if(_0x172d10>=_0x4d4826){_0x172d10=_0x4d4826;_0x178b01=0xc8;}else{_0x178b01=0xce;}_0x1f0b31[_0x9118('0x22')](_0x178b01);return _0x1f0b31[_0x9118('0x28')](_0x9118('0x29'),_0x1e133b+'-'+_0x172d10+'/'+_0x4d4826)[_0x9118('0x23')](_0x3b37ac);}return null;};}function patchUpdates(_0x2ad073){return function(_0x1b312d){try{jsonpatch[_0x9118('0x2a')](_0x1b312d,_0x2ad073,!![]);}catch(_0x47177b){return BPromise['reject'](_0x47177b);}return _0x1b312d[_0x9118('0x2b')]();};}function saveUpdates(_0x5b0c3b,_0x18919b){return function(_0x2a2ee8){if(_0x2a2ee8){return _0x2a2ee8[_0x9118('0x2c')](_0x5b0c3b)['then'](function(_0x5b9861){return _0x5b9861;});}return null;};}function removeEntity(_0x279923,_0x1183d9){return function(_0x4961fe){if(_0x4961fe){return _0x4961fe[_0x9118('0x2d')]()[_0x9118('0x2e')](function(){_0x279923[_0x9118('0x22')](0xcc)[_0x9118('0x2f')]();});}};}function handleEntityNotFound(_0x730b31,_0x12c254){return function(_0x3ff148){if(!_0x3ff148){_0x730b31[_0x9118('0x21')](0x194);}return _0x3ff148;};}function handleError(_0x5397be,_0x2ec827){_0x2ec827=_0x2ec827||0x1f4;return function(_0x28429c){logger[_0x9118('0x30')](_0x28429c[_0x9118('0x31')]);if(_0x28429c[_0x9118('0x32')]){delete _0x28429c[_0x9118('0x32')];}_0x5397be[_0x9118('0x22')](_0x2ec827)[_0x9118('0x33')](_0x28429c);};}exports['index']=function(_0x41f842,_0x450c78){var _0x5c1d8f={},_0x10a2bf={},_0x4d3da7={'count':0x0,'rows':[]};var _0x5c8964=_['map'](db[_0x9118('0x34')][_0x9118('0x35')],function(_0x452e13){return{'name':_0x452e13[_0x9118('0x36')],'type':_0x452e13[_0x9118('0x37')][_0x9118('0x38')]};});_0x10a2bf[_0x9118('0x39')]=_[_0x9118('0x3a')](_0x5c8964,'name');_0x10a2bf[_0x9118('0x3b')]=_[_0x9118('0x3c')](_0x41f842[_0x9118('0x3b')]);_0x10a2bf['filters']=_[_0x9118('0x3d')](_0x10a2bf[_0x9118('0x39')],_0x10a2bf[_0x9118('0x3b')]);_0x5c1d8f['attributes']=_[_0x9118('0x3d')](_0x10a2bf['model'],qs['fields'](_0x41f842[_0x9118('0x3b')]['fields']));_0x5c1d8f[_0x9118('0x3e')]=_0x5c1d8f[_0x9118('0x3e')][_0x9118('0x3f')]?_0x5c1d8f[_0x9118('0x3e')]:_0x10a2bf[_0x9118('0x39')];if(!_0x41f842[_0x9118('0x3b')][_0x9118('0x40')]('nolimit')){_0x5c1d8f['limit']=qs[_0x9118('0x25')](_0x41f842[_0x9118('0x3b')]['limit']);_0x5c1d8f[_0x9118('0x24')]=qs[_0x9118('0x24')](_0x41f842[_0x9118('0x3b')]['offset']);}_0x5c1d8f[_0x9118('0x41')]=qs[_0x9118('0x42')](_0x41f842[_0x9118('0x3b')][_0x9118('0x42')]);_0x5c1d8f[_0x9118('0x43')]=qs[_0x9118('0x44')](_[_0x9118('0x45')](_0x41f842[_0x9118('0x3b')],_0x10a2bf['filters']),_0x5c8964);if(_0x41f842[_0x9118('0x3b')]['filter']){_0x5c1d8f['where']=_[_0x9118('0x46')](_0x5c1d8f[_0x9118('0x43')],{'$or':_[_0x9118('0x3a')](_0x5c8964,function(_0x5584c3){if(_0x5584c3[_0x9118('0x37')]!=='VIRTUAL'){var _0x54db50={};_0x54db50[_0x5584c3['name']]={'$like':'%'+_0x41f842['query'][_0x9118('0x47')]+'%'};return _0x54db50;}})});}_0x5c1d8f=_['merge']({},_0x5c1d8f,_0x41f842[_0x9118('0x48')]);var _0x1ff8a2={'where':_0x5c1d8f[_0x9118('0x43')]};return db['UserProfile'][_0x9118('0x27')](_0x1ff8a2)[_0x9118('0x2e')](function(_0x5442bc){_0x4d3da7['count']=_0x5442bc;if(_0x41f842[_0x9118('0x3b')][_0x9118('0x49')]){_0x5c1d8f['include']=[{'all':!![]}];}return db[_0x9118('0x34')][_0x9118('0x4a')](_0x5c1d8f);})['then'](function(_0x2cfc54){_0x4d3da7[_0x9118('0x4b')]=_0x2cfc54;return _0x4d3da7;})[_0x9118('0x2e')](respondWithFilteredResult(_0x450c78,_0x5c1d8f))[_0x9118('0x4c')](handleError(_0x450c78,null));};exports['show']=function(_0x3b848a,_0x28656e){var _0x4512ef={'raw':![],'where':{'id':_0x3b848a[_0x9118('0x4d')]['id']}},_0x587504={};_0x587504[_0x9118('0x39')]=_[_0x9118('0x3c')](db['UserProfile'][_0x9118('0x35')]);_0x587504[_0x9118('0x3b')]=_[_0x9118('0x3c')](_0x3b848a[_0x9118('0x3b')]);_0x587504[_0x9118('0x44')]=_[_0x9118('0x3d')](_0x587504['model'],_0x587504[_0x9118('0x3b')]);_0x4512ef[_0x9118('0x3e')]=_[_0x9118('0x3d')](_0x587504[_0x9118('0x39')],qs['fields'](_0x3b848a[_0x9118('0x3b')][_0x9118('0x4e')]));_0x4512ef[_0x9118('0x3e')]=_0x4512ef[_0x9118('0x3e')][_0x9118('0x3f')]?_0x4512ef[_0x9118('0x3e')]:_0x587504[_0x9118('0x39')];if(_0x3b848a[_0x9118('0x3b')]['includeAll']){_0x4512ef[_0x9118('0x4f')]=[{'all':!![]}];}_0x4512ef=_[_0x9118('0x46')]({},_0x4512ef,_0x3b848a[_0x9118('0x48')]);return db['UserProfile'][_0x9118('0x50')](_0x4512ef)[_0x9118('0x2e')](handleEntityNotFound(_0x28656e,null))['then'](respondWithResult(_0x28656e,null))[_0x9118('0x4c')](handleError(_0x28656e,null));};exports['create']=function(_0x4d1aca,_0x5e78a3){return db[_0x9118('0x34')][_0x9118('0x51')](_0x4d1aca[_0x9118('0x52')],{})[_0x9118('0x2e')](respondWithResult(_0x5e78a3,0xc9))[_0x9118('0x4c')](handleError(_0x5e78a3,null));};exports[_0x9118('0x53')]=function(_0x1c40d1,_0x4b0510){var _0x514372={'where':{'id':_0x1c40d1[_0x9118('0x4d')]['id']}},_0xa9858a={};_0xa9858a['model']=_['keys'](db[_0x9118('0x34')]['rawAttributes']);_0x514372['attributes']=_[_0x9118('0x3d')](_0xa9858a[_0x9118('0x39')],qs[_0x9118('0x4e')](_0x1c40d1[_0x9118('0x3b')][_0x9118('0x4e')]));_0x514372[_0x9118('0x3e')]=_0x514372[_0x9118('0x3e')][_0x9118('0x3f')]?_0x514372[_0x9118('0x3e')]:_0xa9858a['model'];if(_0x1c40d1[_0x9118('0x3b')][_0x9118('0x49')]){_0x514372[_0x9118('0x4f')]=[{'all':!![]}];}_0x514372=_['merge']({},_0x514372,_0x1c40d1[_0x9118('0x48')]);return db[_0x9118('0x34')][_0x9118('0x50')](_0x514372)['then'](handleEntityNotFound(_0x4b0510,null))[_0x9118('0x2e')](function(_0x3d8692){if(_0x3d8692){var _0x48213b=_0x3d8692[_0x9118('0x54')]({'plain':!![]});_0x48213b=qs[_0x9118('0x55')](_0x48213b,['id',_0x9118('0x56'),_0x9118('0x57'),_0x9118('0x58')]);_0x1c40d1[_0x9118('0x52')]=_[_0x9118('0x55')](_0x1c40d1['body'],['id',_0x9118('0x56'),_0x9118('0x57')]);return db['sequelize'][_0x9118('0x59')](function(_0xa68a8c){return db[_0x9118('0x34')][_0x9118('0x51')](_[_0x9118('0x46')](_0x48213b,_0x1c40d1['body']),{'include':_0x1c40d1[_0x9118('0x3b')][_0x9118('0x49')]?[{'all':!![]}]:undefined,'transaction':_0xa68a8c})[_0x9118('0x2e')](function(_0x2e7adc){var _0x6d32ff=_0x2e7adc['get']({'plain':!![]});return db[_0x9118('0x5a')][_0x9118('0x4a')]({'where':{'userProfileId':_0x1c40d1[_0x9118('0x4d')]['id']},'raw':!![]})[_0x9118('0x2e')](function(_0x51711b){if(_0x51711b){return BPromise[_0x9118('0x5b')](_0x51711b,function(_0x34bc3b){return new BPromise(function(_0x2c7208,_0x337513){if(_0x34bc3b[_0x9118('0x5c')]===null||_0x34bc3b[_0x9118('0x5c')]===0x1)_0x2c7208(null);return db['UserProfileResource'][_0x9118('0x4a')]({'where':{'sectionId':_0x34bc3b['id']},'raw':!![]})[_0x9118('0x2e')](function(_0x2767b6){var _0x10037f=_[_0x9118('0x3a')](_0x2767b6,function(_0x18e229){return qs[_0x9118('0x55')](_0x18e229,['id',_0x9118('0x56'),_0x9118('0x57'),_0x9118('0x5d')]);});_0x2c7208(_0x10037f);})[_0x9118('0x4c')](function(_0xdb1ef0){_0x337513(_0xdb1ef0);});})['then'](function(_0x58cf66){var _0x280bdb=qs[_0x9118('0x55')](_0x34bc3b,['id',_0x9118('0x56'),'updatedAt']);_0x280bdb['userProfileId']=_0x6d32ff['id'];if(_0x58cf66)_0x280bdb['Resources']=_0x58cf66;return _0x280bdb;})[_0x9118('0x2e')](function(_0x31b7d5){return db[_0x9118('0x5a')][_0x9118('0x51')](_0x31b7d5,{'include':[{'model':db[_0x9118('0x5e')],'as':_0x9118('0x5f')}],'raw':!![],'transaction':_0xa68a8c});});})[_0x9118('0x2e')](function(){return _0x6d32ff;});}});});});}})[_0x9118('0x2e')](respondWithResult(_0x4b0510,0xc9))[_0x9118('0x4c')](handleError(_0x4b0510,null));};exports['update']=function(_0x450cea,_0x1fb248){if(_0x450cea[_0x9118('0x52')]['id']){delete _0x450cea['body']['id'];}return db[_0x9118('0x34')][_0x9118('0x50')]({'where':{'id':_0x450cea[_0x9118('0x4d')]['id']}})[_0x9118('0x2e')](handleEntityNotFound(_0x1fb248,null))[_0x9118('0x2e')](saveUpdates(_0x450cea[_0x9118('0x52')],null))[_0x9118('0x2e')](respondWithResult(_0x1fb248,null))[_0x9118('0x4c')](handleError(_0x1fb248,null));};exports[_0x9118('0x2d')]=function(_0x591ff7,_0x3244e6){return db[_0x9118('0x34')][_0x9118('0x50')]({'where':{'id':_0x591ff7[_0x9118('0x4d')]['id']}})[_0x9118('0x2e')](handleEntityNotFound(_0x3244e6,null))[_0x9118('0x2e')](removeEntity(_0x3244e6,null))[_0x9118('0x4c')](handleError(_0x3244e6,null));};exports[_0x9118('0x60')]=function(_0x7ce353,_0x56ec18){return db['UserProfile'][_0x9118('0x60')]()['then'](respondWithResult(_0x56ec18,null))[_0x9118('0x4c')](handleError(_0x56ec18,null));};exports['addSections']=function(_0x15a2f2,_0x2e00eb){var _0x444d4a=_0x15a2f2[_0x9118('0x52')];return db['UserProfile'][_0x9118('0x50')]({'where':{'id':_0x15a2f2[_0x9118('0x4d')]['id']}})[_0x9118('0x2e')](handleEntityNotFound(_0x2e00eb,null))[_0x9118('0x2e')](function(_0xff9178){if(_0xff9178){return db[_0x9118('0x61')]['transaction'](function(_0x47d793){return db[_0x9118('0x5a')][_0x9118('0x2d')]({'where':{'userProfileId':_0x15a2f2[_0x9118('0x4d')]['id'],'sectionId':_[_0x9118('0x3a')](_0x444d4a,function(_0x356678){return _0x356678[_0x9118('0x5d')];})},'transaction':_0x47d793})['then'](function(){var _0x5bcc95=_['map'](_0x444d4a,function(_0x140e66){_0x140e66[_0x9118('0x62')]=_0x15a2f2[_0x9118('0x4d')]['id'];return _0x140e66;});var _0x40429f=[];return BPromise['each'](_0x5bcc95,function(_0x275459){return db[_0x9118('0x5a')][_0x9118('0x51')](_0x275459,{'include':[{'model':db[_0x9118('0x5e')],'as':_0x9118('0x5f')}],'raw':!![],'transaction':_0x47d793})[_0x9118('0x2e')](function(_0x3b961e){_0x40429f[_0x9118('0x63')](_0x3b961e[_0x9118('0x54')]({'plain':!![]}));});})[_0x9118('0x2e')](function(){return _0x40429f;});});});}})[_0x9118('0x2e')](function(_0x3aa5c6){return _0x3aa5c6;})[_0x9118('0x2e')](respondWithResult(_0x2e00eb,null))[_0x9118('0x4c')](handleError(_0x2e00eb,null));};exports['removeSections']=function(_0x49cb54,_0x1251c1){var _0x22efc8;return db[_0x9118('0x34')][_0x9118('0x50')]({'where':{'id':_0x49cb54[_0x9118('0x4d')]['id']},'attributes':['id',_0x9118('0x32')]})[_0x9118('0x2e')](handleEntityNotFound(_0x1251c1,null))[_0x9118('0x2e')](function(_0x2a335f){if(_0x2a335f){_0x22efc8=_0x2a335f;return db[_0x9118('0x5a')][_0x9118('0x2d')]({'where':{'userProfileId':_0x49cb54['params']['id'],'sectionId':_0x49cb54[_0x9118('0x3b')][_0x9118('0x64')]}});}})['then'](function(){return _0x22efc8;})[_0x9118('0x2e')](respondWithStatusCode(_0x1251c1,null))[_0x9118('0x4c')](handleError(_0x1251c1,null));};exports[_0x9118('0x65')]=function(_0x197ad4,_0x5d72a4){var _0x1db622=[];var _0x4b3b06=[];return db[_0x9118('0x5a')][_0x9118('0x4a')]({'where':{'userProfileId':_0x197ad4[_0x9118('0x4d')]['id']},'raw':!![]})[_0x9118('0x2e')](function(_0x47506a){_0x1db622=_[_0x9118('0x47')](_0x47506a,function(_0x5598f0){return _0x5598f0[_0x9118('0x66')]===0x1||_[_0x9118('0x67')]([0x3eb,0x709],_0x5598f0[_0x9118('0x5d')]);});if(!_['isEmpty'](_0x1db622)){return _[_0x9118('0x3a')](_0x1db622,function(_0x57dd19){return _0x57dd19[_0x9118('0x5d')];});}else{return;}})['then'](function(_0x18de57){if(_0x18de57)_0x4b3b06=_0x18de57;if(_[_0x9118('0x67')](_0x4b3b06,0x64)){var _0x39155c=_[_0x9118('0x50')](_0x1db622,{'sectionId':0x64});return hasDefaultDashboard(_0x39155c)[_0x9118('0x2e')](function(_0x563cc6){return _[_0x9118('0x3a')](_0x1db622,function(_0x84c5c8){if(_0x84c5c8[_0x9118('0x5d')]===0x64){_0x84c5c8[_0x9118('0x68')]=_0x563cc6;}return _0x84c5c8;});});}else{return;}})['then'](function(_0x2b5dd0){if(_0x2b5dd0)_0x1db622=_0x2b5dd0;if(_[_0x9118('0x67')](_0x4b3b06,0x3eb)){var _0x2cf489=_[_0x9118('0x50')](_0x1db622,{'sectionId':0x3eb});return getCustomDashboards(_0x2cf489)['then'](function(_0x4d29ff){return _[_0x9118('0x3a')](_0x1db622,function(_0x367cb9){if(_0x2cf489[_0x9118('0x66')]){if(_0x367cb9[_0x9118('0x5d')]===0x3eb){_0x367cb9[_0x9118('0x68')]=_0x4d29ff;}}else{if(_0x367cb9[_0x9118('0x5d')]===0x64){_0x367cb9[_0x9118('0x68')]=_0x4d29ff;}}return _0x367cb9;});});}else{return;}})['then'](function(_0x25525b){if(_0x25525b)_0x1db622=_0x25525b;if(_['includes'](_0x4b3b06,0x709)){var _0xf9ee69=_[_0x9118('0x50')](_0x1db622,{'sectionId':0x709});return getPlugins(_0xf9ee69)['then'](function(_0x55e51e){if(_0xf9ee69[_0x9118('0x66')]){return _['map'](_0x1db622,function(_0x189f97){if(_0x189f97[_0x9118('0x5d')]===0x709){_0x189f97[_0x9118('0x68')]=_0x55e51e;}return _0x189f97;});}else{var _0x3e7e61={'sectionId':0x76c,'enabled':0x1,'subsections':_0x55e51e};var _0x3c399f=_[_0x9118('0x3a')](_0x1db622);_0x3c399f['push'](_0x3e7e61);return _0x3c399f;}});}else{return;}})[_0x9118('0x2e')](function(_0x3dac5f){if(_0x3dac5f)_0x1db622=_0x3dac5f;return _['filter'](_0x1db622,['enabled',0x1]);})[_0x9118('0x2e')](respondWithResult(_0x5d72a4,null))[_0x9118('0x4c')](handleError(_0x5d72a4,null));};function hasDefaultDashboard(_0x436a5e){var _0xfc3076=[0x65];return new BPromise(function(_0x591113,_0x2ec3a7){try{if(_0x436a5e[_0x9118('0x5c')]){_0x591113(_0xfc3076);}else{return db[_0x9118('0x5e')][_0x9118('0x69')]({'where':{'sectionId':_0x436a5e['id']},'raw':!![]})[_0x9118('0x2e')](function(_0x11dd1f){_0x11dd1f?_0x591113(_0xfc3076):_0x591113();});}}catch(_0x4790c2){_0x2ec3a7(_0x4790c2);}});}function getCustomDashboards(_0x3134dd){var _0x5b2944=[];return new BPromise(function(_0x1170f2,_0x40ed59){try{if(_0x3134dd[_0x9118('0x5c')]){return db[_0x9118('0x6a')][_0x9118('0x4a')]({'raw':!![]})['then'](function(_0x22632e){_0x22632e['forEach'](function(_0x4f0e34){_0x5b2944['push'](_0x4f0e34['id']+0x1869f);});_0x1170f2(_0x5b2944);});}else{return db[_0x9118('0x5e')]['findAll']({'where':{'sectionId':_0x3134dd['id']},'raw':!![]})[_0x9118('0x2e')](function(_0x43c3a1){_0x43c3a1['forEach'](function(_0x1579f9){_0x5b2944[_0x9118('0x63')](_0x1579f9['resourceId']+0x1869f);});_0x1170f2(_0x5b2944);});}}catch(_0x362e66){_0x40ed59(_0x362e66);}});}function getPlugins(_0x27266f){var _0x2ab593=[];return new BPromise(function(_0x38eb7a,_0x54a2ef){try{if(_0x27266f['autoAssociation']){return db[_0x9118('0x6b')]['findAll']({'raw':!![]})[_0x9118('0x2e')](function(_0x165c60){_0x165c60[_0x9118('0x6c')](function(_0x5a4cf2){_0x2ab593['push'](_0x5a4cf2['id']+0x15b38);});_0x38eb7a(_0x2ab593);});}else{return db[_0x9118('0x5e')][_0x9118('0x4a')]({'where':{'sectionId':_0x27266f['id']},'raw':!![]})['then'](function(_0xda5761){_0xda5761[_0x9118('0x6c')](function(_0x404948){_0x2ab593[_0x9118('0x63')](_0x404948['resourceId']+0x15b38);});_0x38eb7a(_0x2ab593);});}}catch(_0x42b93a){_0x54a2ef(_0x42b93a);}});}exports[_0x9118('0x6d')]=function(_0x168ac0,_0x4f9cb0){return db[_0x9118('0x34')][_0x9118('0x50')]({'where':{'id':_0x168ac0['params']['id']}})['then'](handleEntityNotFound(_0x4f9cb0,null))[_0x9118('0x2e')](function(_0x38b0ca){if(_0x38b0ca){return db[_0x9118('0x61')][_0x9118('0x59')](function(_0x1008ba){return db[_0x9118('0x5a')][_0x9118('0x4a')]({'where':{'userProfileId':_0x168ac0[_0x9118('0x4d')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x2c2a6c){if(_0x2c2a6c){return db[_0x9118('0x5a')][_0x9118('0x2d')]({'where':{'userProfileId':_0x168ac0[_0x9118('0x4d')]['id'],'id':_['map'](_0x2c2a6c,function(_0x552ef9){return _0x552ef9['id'];})},'transaction':_0x1008ba});}})[_0x9118('0x2e')](function(_0x2be0a6){var _0x21d459=_[_0x9118('0x3a')](_0x168ac0[_0x9118('0x52')],function(_0x50c4d2){_0x50c4d2[_0x9118('0x62')]=_0x168ac0[_0x9118('0x4d')]['id'];return _0x50c4d2;});return db[_0x9118('0x5a')]['bulkCreate'](_0x21d459,{'raw':!![],'transaction':_0x1008ba});})[_0x9118('0x2e')](function(_0x5bc393){var _0x2f25f3=_['filter'](_['map'](_0x5bc393,function(_0x29b736){return _0x29b736['get']({'plain':!![]});}),{'includeAll':![]});if(_0x2f25f3){return db[_0x9118('0x5a')][_0x9118('0x4a')]({'where':{'userProfileId':_0x168ac0[_0x9118('0x4d')]['id'],'sectionId':_[_0x9118('0x3a')](_0x2f25f3,function(_0x5ba916){return _0x5ba916['sectionId'];})},'attributes':['id','sectionId'],'raw':!![]})[_0x9118('0x2e')](function(_0x556b82){var _0x59e745=_[_0x9118('0x3a')](_0x168ac0['body'],function(_0x41adeb){_0x41adeb[_0x9118('0x62')]=_0x168ac0['params']['id'];return _0x41adeb;});return db[_0x9118('0x5e')][_0x9118('0x6e')](_0x59e745,{'raw':!![],'transaction':_0x1008ba});});}})[_0x9118('0x4c')](handleError(_0x4f9cb0,null));});}})['then'](function(_0x3b6146){var _0x3ef8ac=_[_0x9118('0x3a')](_0x3b6146,function(_0xb9cf38){return _0xb9cf38[_0x9118('0x54')]({'plain':!![]});});})[_0x9118('0x2e')](respondWithResult(_0x4f9cb0,null))[_0x9118('0x4c')](handleError(_0x4f9cb0,null));};exports[_0x9118('0x6f')]=function(_0x203b8b,_0x5e264c,_0x3eceed){return db[_0x9118('0x34')]['find']({'where':{'id':_0x203b8b[_0x9118('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5e264c,null))[_0x9118('0x2e')](function(_0x3fc900){if(_0x3fc900){return _0x3fc900[_0x9118('0x6f')](_0x203b8b[_0x9118('0x3b')][_0x9118('0x64')]);}})[_0x9118('0x2e')](respondWithStatusCode(_0x5e264c,null))[_0x9118('0x4c')](handleError(_0x5e264c,null));};exports[_0x9118('0x70')]=function(_0x12a412,_0x18256e){var _0x2ad2f3={};if(!_0x12a412[_0x9118('0x3b')][_0x9118('0x71')])throw new Error(_0x9118('0x72'));if(!_0x12a412['query']['hasOwnProperty']('nolimit')){_0x2ad2f3[_0x9118('0x25')]=qs[_0x9118('0x25')](_0x12a412[_0x9118('0x3b')][_0x9118('0x25')]);_0x2ad2f3[_0x9118('0x24')]=qs[_0x9118('0x24')](_0x12a412[_0x9118('0x3b')][_0x9118('0x24')]);}return db[_0x9118('0x34')][_0x9118('0x50')]({'where':{'id':_0x12a412[_0x9118('0x4d')]['id']}})[_0x9118('0x2e')](function(_0x389fff){if(!_0x389fff)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x12a412[_0x9118('0x4d')]['id']);return db['UserProfile'][_0x9118('0x70')](_0x12a412);})[_0x9118('0x2e')](respondWithFilteredResult(_0x18256e,_0x2ad2f3))[_0x9118('0x4c')](handleError(_0x18256e,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index deff8ec..4307778 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 _0xd991=['UserProfile','setMaxListeners','save','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x19c438,_0x1e157b){var _0x5dcf2e=function(_0xa171e1){while(--_0xa171e1){_0x19c438['push'](_0x19c438['shift']());}};_0x5dcf2e(++_0x1e157b);}(_0xd991,0x115));var _0x1d99=function(_0x30c519,_0x49750b){_0x30c519=_0x30c519-0x0;var _0x4e8aad=_0xd991[_0x30c519];return _0x4e8aad;};'use strict';var EventEmitter=require(_0x1d99('0x0'));var UserProfile=require(_0x1d99('0x1'))['db'][_0x1d99('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x1d99('0x3')](0x0);var events={'afterCreate':_0x1d99('0x4'),'afterUpdate':'update','afterDestroy':_0x1d99('0x5')};function emitEvent(_0xe9aefb){return function(_0xf03459,_0x1f6da3,_0x300c32){UserProfileEvents[_0x1d99('0x6')](_0xe9aefb+':'+_0xf03459['id'],_0xf03459);UserProfileEvents['emit'](_0xe9aefb,_0xf03459);_0x300c32(null);};}for(var e in events){if(events[_0x1d99('0x7')](e)){var event=events[e];UserProfile[_0x1d99('0x8')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0x2d72=['UserProfile','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x52e57f,_0x545436){var _0x2aac74=function(_0x282faa){while(--_0x282faa){_0x52e57f['push'](_0x52e57f['shift']());}};_0x2aac74(++_0x545436);}(_0x2d72,0xa8));var _0x22d7=function(_0x444142,_0x374bdc){_0x444142=_0x444142-0x0;var _0x488723=_0x2d72[_0x444142];return _0x488723;};'use strict';var EventEmitter=require(_0x22d7('0x0'));var UserProfile=require(_0x22d7('0x1'))['db'][_0x22d7('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x22d7('0x3')](0x0);var events={'afterCreate':_0x22d7('0x4'),'afterUpdate':_0x22d7('0x5'),'afterDestroy':_0x22d7('0x6')};function emitEvent(_0x1738ec){return function(_0x35cf66,_0xfd6d11,_0x17cfba){UserProfileEvents[_0x22d7('0x7')](_0x1738ec+':'+_0x35cf66['id'],_0x35cf66);UserProfileEvents[_0x22d7('0x7')](_0x1738ec,_0x35cf66);_0x17cfba(null);};}for(var e in events){if(events[_0x22d7('0x8')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x22d7('0x9')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index ae7e6b2..caead0a 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 _0x7046=['ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','Agents','membername','role','Telephones','User','telephone','VoiceQueues','inbound','queue','outbound','musiconholds','chanspies','voiceprefixes','VoicePrefix','ivrcampaigns','mailqueues','MailQueue','MailAccount','mailsubstatuses','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsaccounts','SmsAccount','WhatsappQueue','WhatsappAccount','teams','Team','queuecampaigns','VoiceQueue','users','telephones','Users','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','freshdeskaccounts','FreshdeskAccount','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','Sound','tags','templates','Template','triggers','Trigger','trunks','Trunk','Variable','plugins','Plugin','extractedreports','reportId','AnalyticMetric','charAt','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','from','where','ui.UserId\x20=\x20?','sequelize','OpenTabs','define','UserProfile','query','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','all','ignore','autoAssociation','keys','intersection','attributes','fields','limit','offset','order','sort','filters','pick','key','foreignKey','forEach','merge','includeAll','reportType','custom','count','rows','Tags','tag','Tag','color','include','openTabs','true','dataValues','fax','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','models','filter','value','associatedResources','map','catch','field','model','findAll','then','name','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','projectName','projects','JscriptyProject','CmContact','ListId','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7046,0x144));var _0x6704=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x7046[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x6704('0x0'));var attributes=require(_0x6704('0x1'));var qs=require(_0x6704('0x2'));var squel=require(_0x6704('0x3'));module['exports']=function(_0x1fd895){var _0x4399c6=_0x1fd895[_0x6704('0x4')];function _0x5258e7(_0x1e9b2a,_0x35bcc6){return new Promise(function(_0x3f4169,_0x626a14){if(!_0x35bcc6)return _0x3f4169(null);var _0x2917be=_0x35bcc6['filter']?{[_0x35bcc6[_0x6704('0x5')]['field']]:_0x35bcc6['filter'][_0x6704('0x6')]}:undefined;return _0x4399c6[_0x1e9b2a]['findAll']({'where':_0x2917be,'raw':!![]})['then'](function(_0x3ca599){_0x35bcc6[_0x6704('0x7')]=_[_0x6704('0x8')](_0x3ca599,'id');_0x3f4169(_0x35bcc6);})[_0x6704('0x9')](function(_0x356687){_0x626a14(_0x356687);});});}function _0x40d57d(_0x3dfda4,_0x426715){return new Promise(function(_0x58cc09,_0x2c8b0f){var _0x29e6f7=_0x3dfda4['filter']?{[_0x3dfda4[_0x6704('0x5')][_0x6704('0xa')]]:_0x3dfda4[_0x6704('0x5')][_0x6704('0x6')]}:undefined;return _0x4399c6[_0x3dfda4[_0x6704('0xb')]][_0x6704('0xc')]({'where':_0x29e6f7,'raw':!![]})[_0x6704('0xd')](function(_0x2da4df){_0x426715[_0x6704('0x7')]=_['map'](_0x2da4df,function(_0x168258){return _0x168258[_0x6704('0xe')];});_0x58cc09(_0x426715);})[_0x6704('0x9')](function(_0x4fef80){_0x2c8b0f(_0x4fef80);});});}function _0x11782a(_0x244537,_0x3e7d1f,_0x29fa46){if(!_0x3e7d1f)return Promise[_0x6704('0xf')](null);return new Promise(function(_0x5adb35,_0x1e5f6e){return _0x4399c6[_0x6704('0x10')][_0x6704('0xc')]({'where':{'sectionId':_0x3e7d1f['id']},'raw':!![]})[_0x6704('0xd')](function(_0x344ed9){if(_0x244537['field']&&_0x244537[_0x6704('0xa')]!=='id'){_0x3e7d1f[_0x6704('0x7')]=_[_0x6704('0x8')](_0x344ed9,function(_0x156106){return _0x156106[_0x244537[_0x6704('0xa')]];});}else{if(_0x29fa46===_0x6704('0x11')){_0x3e7d1f[_0x6704('0x7')]=_['map'](_0x344ed9,function(_0x1df6d7){return{'id':_0x1df6d7[_0x6704('0x12')],'type':_0x1df6d7[_0x6704('0x13')]};});}else{_0x3e7d1f['associatedResources']=_['map'](_0x344ed9,function(_0x48d829){return _0x48d829[_0x6704('0x12')];});}}_0x5adb35(_0x3e7d1f);})[_0x6704('0x9')](function(_0x4ecf4c){_0x1e5f6e(_0x4ecf4c);});});}function _0x41f89e(_0x56d1e1,_0xf2c459){var _0xabb97a={'parentSections':[]};switch(_0x56d1e1[_0x6704('0x14')]()){case _0x6704('0x15'):_0xabb97a[_0x6704('0x16')]=_0x6704('0x17');break;case _0x6704('0x18'):_0xabb97a[_0x6704('0x16')]=_0x6704('0x19');break;case _0x6704('0x1a'):_0xabb97a[_0x6704('0x16')]=_0x6704('0x1b');_0xabb97a[_0x6704('0x1c')]=[{'name':'SquareProjects','field':'name','foreignKey':_0x6704('0x1d')}];break;case _0x6704('0x1e'):_0xabb97a[_0x6704('0x16')]=_0x6704('0x1f');break;case'contacts':_0xabb97a[_0x6704('0x16')]=_0x6704('0x20');_0xabb97a['parentSections']=[{'name':'Lists','field':'id','foreignKey':_0x6704('0x21')}];break;case'lists':_0xabb97a[_0x6704('0x16')]='CmList';break;case'companies':_0xabb97a[_0x6704('0x16')]=_0x6704('0x22');break;case _0x6704('0x23'):_0xabb97a['childModel']=_0x6704('0x24');break;case _0x6704('0x25'):_0xabb97a[_0x6704('0x16')]=_0x6704('0x26');break;case _0x6704('0x27'):_0xabb97a[_0x6704('0x16')]=_0x6704('0x28');break;case _0x6704('0x29'):_0xabb97a[_0x6704('0x16')]=_0x6704('0x2a');break;case _0x6704('0x2b'):_0xabb97a[_0x6704('0x16')]=_0x6704('0x2c');break;case _0x6704('0x2d'):case _0x6704('0x2e'):case _0x6704('0x2f'):_0xabb97a[_0x6704('0x16')]=_0x6704('0x30');break;case _0x6704('0x31'):_0xabb97a[_0x6704('0x16')]=_0x6704('0x32');break;case _0x6704('0x33'):_0xabb97a[_0x6704('0x16')]=_0x6704('0x34');break;case _0x6704('0x35'):_0xabb97a['childModel']='VoiceRecording';_0xabb97a['parentSections']=[{'name':_0x6704('0x36'),'field':_0x6704('0xe'),'foreignKey':_0x6704('0x37'),'model':'User','filter':{'field':_0x6704('0x38'),'value':['agent']}},{'name':_0x6704('0x39'),'field':_0x6704('0xe'),'foreignKey':_0x6704('0x37'),'model':_0x6704('0x3a'),'filter':{'field':_0x6704('0x38'),'value':[_0x6704('0x3b')]}},{'name':_0x6704('0x3c'),'field':_0x6704('0xe'),'foreignKey':'queue','model':'VoiceQueue','filter':{'field':_0x6704('0x13'),'value':[_0x6704('0x3d')]}},{'name':'QueueCampaigns','field':'name','foreignKey':_0x6704('0x3e'),'model':'VoiceQueue','filter':{'field':_0x6704('0x13'),'value':[_0x6704('0x3f')]}}];break;case _0x6704('0x40'):_0xabb97a[_0x6704('0x16')]='VoiceMusicOnHold';break;case _0x6704('0x41'):_0xabb97a[_0x6704('0x16')]='VoiceChanSpy';break;case _0x6704('0x42'):_0xabb97a['childModel']=_0x6704('0x43');break;case _0x6704('0x44'):_0xabb97a[_0x6704('0x16')]='Campaign';break;case _0x6704('0x45'):_0xabb97a[_0x6704('0x16')]=_0x6704('0x46');break;case'mailaccounts':_0xabb97a[_0x6704('0x16')]=_0x6704('0x47');break;case _0x6704('0x48'):_0xabb97a[_0x6704('0x16')]='MailSubstatus';break;case _0x6704('0x49'):_0xabb97a['childModel']=_0x6704('0x4a');break;case _0x6704('0x4b'):_0xabb97a[_0x6704('0x16')]=_0x6704('0x4c');break;case'smsqueues':_0xabb97a['childModel']='SmsQueue';break;case _0x6704('0x4d'):_0xabb97a['childModel']=_0x6704('0x4e');break;case'whatsappqueues':_0xabb97a[_0x6704('0x16')]=_0x6704('0x4f');break;case'whatsappaccounts':_0xabb97a[_0x6704('0x16')]=_0x6704('0x50');break;case _0x6704('0x51'):_0xabb97a[_0x6704('0x16')]=_0x6704('0x52');break;case'voicequeues':case _0x6704('0x53'):_0xabb97a[_0x6704('0x16')]=_0x6704('0x54');if(_0xf2c459){_0xabb97a[_0x6704('0x1c')]=[{'name':_0x6704('0x3c')},{'name':'QueueCampaigns'}];}break;case _0x6704('0x55'):case'agents':case _0x6704('0x56'):_0xabb97a[_0x6704('0x16')]=_0x6704('0x3a');if(_0xf2c459){_0xabb97a[_0x6704('0x1c')]=[{'name':_0x6704('0x57'),'filter':{'field':'role','value':[_0x6704('0x58'),_0x6704('0x59')]},'ignore':!![]},{'name':'Agents'},{'name':_0x6704('0x39')}];}break;case _0x6704('0x5a'):_0xabb97a[_0x6704('0x16')]=_0x6704('0x5b');break;case _0x6704('0x5c'):_0xabb97a[_0x6704('0x16')]='SalesforceAccount';break;case _0x6704('0x5d'):_0xabb97a['childModel']=_0x6704('0x5e');break;case'sugarcrmaccounts':_0xabb97a[_0x6704('0x16')]='SugarcrmAccount';break;case'deskaccounts':_0xabb97a[_0x6704('0x16')]=_0x6704('0x5f');break;case _0x6704('0x60'):_0xabb97a[_0x6704('0x16')]=_0x6704('0x61');break;case _0x6704('0x62'):_0xabb97a['childModel']='User';break;case _0x6704('0x63'):_0xabb97a[_0x6704('0x16')]=_0x6704('0x64');break;case _0x6704('0x65'):_0xabb97a[_0x6704('0x16')]=_0x6704('0x66');break;case _0x6704('0x67'):_0xabb97a[_0x6704('0x16')]=_0x6704('0x68');break;case _0x6704('0x69'):_0xabb97a[_0x6704('0x16')]=_0x6704('0x6a');break;case _0x6704('0x6b'):_0xabb97a[_0x6704('0x16')]=_0x6704('0x6c');break;case _0x6704('0x6d'):_0xabb97a[_0x6704('0x16')]='Schedule';break;case'sounds':_0xabb97a[_0x6704('0x16')]=_0x6704('0x6e');break;case _0x6704('0x6f'):_0xabb97a[_0x6704('0x16')]='Tag';break;case _0x6704('0x70'):_0xabb97a[_0x6704('0x16')]=_0x6704('0x71');break;case _0x6704('0x72'):_0xabb97a['childModel']=_0x6704('0x73');break;case _0x6704('0x74'):_0xabb97a[_0x6704('0x16')]=_0x6704('0x75');break;case'variables':_0xabb97a['childModel']=_0x6704('0x76');break;case _0x6704('0x77'):_0xabb97a[_0x6704('0x16')]=_0x6704('0x78');break;case _0x6704('0x79'):_0xabb97a[_0x6704('0x16')]='AnalyticExtractedReport';_0xabb97a[_0x6704('0x1c')]=[{'name':'Reports','field':'id','foreignKey':_0x6704('0x7a')}];break;case'metrics':_0xabb97a['childModel']=_0x6704('0x7b');break;}return _0xabb97a;}function _0x2d1603(_0x18003e,_0xedf7ac){var _0x1514c5=_0x18003e[_0x6704('0x7c')](0x0)['toUpperCase']()+_0x18003e['slice'](0x1);var _0x46c386={'type':_0x4399c6[_0x6704('0x7d')][_0x6704('0x7e')][_0x6704('0x7f')],'raw':!![]};return new Promise(function(_0x3d6c5b,_0x15131a){var _0x5759ca=squel[_0x6704('0x80')]()[_0x6704('0xa')](_0x6704('0x81')+_0x1514c5+_0x6704('0x82'),'id')[_0x6704('0xa')](_0x6704('0x83'))[_0x6704('0x84')]('user_has_'+_0x18003e+'_interactions','ui')[_0x6704('0x85')](_0x6704('0x86'),_0xedf7ac['id']);return _0x4399c6[_0x6704('0x87')]['query'](_0x5759ca['toString'](),_0x46c386)[_0x6704('0xd')](function(_0x334ddb){_0xedf7ac[_0x1514c5+_0x6704('0x88')]=_0x334ddb;_0x3d6c5b(_0x334ddb);})[_0x6704('0x9')](function(_0x5d6f52){_0x15131a(_0x5d6f52);});});}return _0x1fd895[_0x6704('0x89')](_0x6704('0x8a'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x4e3626){var _0x27b424={'raw':![],'where':{}};var _0x270e9e={};var _0x3f93f2={'count':0x0,'rows':[]};var _0x2d9b2f=_0x4e3626[_0x6704('0x8b')][_0x6704('0x8c')];var _0x295b2f=_0x4e3626['query'][_0x6704('0x8d')]||![];var _0x40f1f8=_0x41f89e(_0x2d9b2f,_0x295b2f);if(!_0x40f1f8[_0x6704('0x16')])throw new Error(_0x6704('0x8e')+_0x2d9b2f+'\x27');var _0x1ea6b2=[{'name':_0x2d9b2f}];if(!_[_0x6704('0x8f')](_0x40f1f8[_0x6704('0x1c')]))_0x1ea6b2=_0x40f1f8[_0x6704('0x1c')];var _0x1b81d6=[];for(var _0x3e99c6=0x0;_0x3e99c6<_0x1ea6b2[_0x6704('0x90')];_0x3e99c6++){_0x1b81d6[_0x6704('0x91')](_0x4399c6[_0x6704('0x92')][_0x6704('0x93')]({'where':{'userProfileId':_0x4e3626[_0x6704('0x94')]['id'],'name':_0x1ea6b2[_0x3e99c6][_0x6704('0xe')]},'raw':!![]}));}return Promise[_0x6704('0x95')](_0x1b81d6)[_0x6704('0xd')](function(_0x202ec0){var _0x58c74f=_[_0x6704('0x5')](_0x202ec0,function(_0x74daa4){return _0x74daa4?_0x74daa4:undefined;});var _0xb8b952=_[_0x6704('0x5')](_0x1ea6b2,['ignore',!![]]);var _0x51e599=_[_0x6704('0x8f')](_0x58c74f)&&_['isEmpty'](_0xb8b952)?null:_['union'](_0xb8b952,_0x58c74f);if(!_0x51e599)return null;var _0x1fb2d4=[];for(var _0x4e4f30=0x0;_0x4e4f30<_0x51e599[_0x6704('0x90')];_0x4e4f30++){var _0x574d48=_[_0x6704('0x93')](_0x1ea6b2,function(_0x57c55d){return _0x51e599[_0x4e4f30]?_0x57c55d[_0x6704('0xe')]===_0x51e599[_0x4e4f30][_0x6704('0xe')]:null;});if(_0x574d48){if(_0x51e599[_0x4e4f30][_0x6704('0x96')]){_0x1fb2d4['push'](_0x5258e7(_0x40f1f8['childModel'],_0x51e599[_0x4e4f30]));}else{if(!_0x51e599[_0x4e4f30][_0x6704('0x97')]){_0x1fb2d4['push'](_0x11782a(_0x574d48,_0x51e599[_0x4e4f30],_0x40f1f8[_0x6704('0x16')]));}else{if(_0x574d48['model']){_0x1fb2d4[_0x6704('0x91')](_0x40d57d(_0x574d48,_0x51e599[_0x4e4f30]));}}}}}return Promise[_0x6704('0x95')](_0x1fb2d4);})[_0x6704('0xd')](function(_0x1d0388){var _0x1b131a=_0x1d0388;var _0x12d9fc=null;if(_0x1b131a){_0x12d9fc=_0x1b131a[_0x6704('0x90')]===0x1?_0x1b131a[0x0]:null;}if(!_0x12d9fc&&!_0x1b131a)return _0x3f93f2;var _0x2e08dc=_0x4399c6[_0x40f1f8['childModel']]['rawAttributes'];_0x270e9e[_0x6704('0xb')]=_[_0x6704('0x98')](_0x2e08dc);_0x270e9e[_0x6704('0x8b')]=_[_0x6704('0x98')](_0x4e3626[_0x6704('0x8b')]);_0x270e9e['filters']=_[_0x6704('0x99')](_0x270e9e[_0x6704('0xb')],_0x270e9e[_0x6704('0x8b')]);_0x27b424[_0x6704('0x9a')]=_[_0x6704('0x99')](_0x270e9e['model'],qs[_0x6704('0x9b')](_0x4e3626[_0x6704('0x8b')][_0x6704('0x9b')]));_0x27b424['attributes']=_0x27b424['attributes'][_0x6704('0x90')]?_0x27b424[_0x6704('0x9a')]:_0x270e9e[_0x6704('0xb')];if(!_0x4e3626[_0x6704('0x8b')]['hasOwnProperty']('nolimit')){_0x27b424['limit']=qs[_0x6704('0x9c')](_0x4e3626[_0x6704('0x8b')]['limit']);_0x27b424['offset']=qs[_0x6704('0x9d')](_0x4e3626[_0x6704('0x8b')][_0x6704('0x9d')]);}_0x27b424[_0x6704('0x9e')]=qs[_0x6704('0x9f')](_0x4e3626['query'][_0x6704('0x9f')]);_0x27b424[_0x6704('0x85')]=qs[_0x6704('0xa0')](_[_0x6704('0xa1')](_0x4e3626[_0x6704('0x8b')],_0x270e9e[_0x6704('0xa0')]));if(_0x4e3626[_0x6704('0x8b')][_0x6704('0x5')]){_0x27b424[_0x6704('0x85')]=_['merge'](_0x27b424[_0x6704('0x85')],{'$or':_[_0x6704('0x8')](_0x2e08dc,function(_0x361f12){if(_0x361f12[_0x6704('0x13')][_0x6704('0xa2')]!=='VIRTUAL'){var _0x370e44={};_0x370e44[_0x361f12['field']]={'$like':'%'+_0x4e3626[_0x6704('0x8b')][_0x6704('0x5')]+'%'};return _0x370e44;}})});}var _0x39bdeb=[];var _0x35eba8=null;var _0x2f778e={};if(_0x12d9fc){_0x35eba8=_[_0x6704('0x93')](_0x1ea6b2,[_0x6704('0xe'),_0x12d9fc[_0x6704('0xe')]]);if(_0x35eba8['field']){_0x2f778e={};if(_0x40f1f8['childModel']===_0x6704('0x11')){_0x2f778e[_0x35eba8[_0x6704('0xa3')]]=_[_0x6704('0x8')](_0x12d9fc[_0x6704('0x7')],'id');}else{_0x2f778e[_0x35eba8[_0x6704('0xa3')]]=_0x12d9fc[_0x6704('0x7')];}_0x39bdeb['push'](_0x2f778e);}else{_0x27b424[_0x6704('0x85')]['id']=_0x12d9fc['associatedResources'];}}else{for(var _0x39483b=0x0;_0x39483b<_0x1b131a[_0x6704('0x90')];_0x39483b++){_0x35eba8=_[_0x6704('0x93')](_0x1ea6b2,[_0x6704('0xe'),_0x1b131a[_0x39483b][_0x6704('0xe')]]);if(_0x35eba8[_0x6704('0xa')]){_0x2f778e={};_0x2f778e[_0x35eba8[_0x6704('0xa3')]]=_0x1b131a[_0x39483b][_0x6704('0x7')];_0x39bdeb[_0x6704('0x91')](_0x2f778e);}else{if(!_0x27b424['where']['id'])_0x27b424[_0x6704('0x85')]['id']=[];_0x1b131a[_0x39483b][_0x6704('0x7')][_0x6704('0xa4')](function(_0x4f03f0){_0x27b424[_0x6704('0x85')]['id'][_0x6704('0x91')](_0x4f03f0);});}}}if(!_[_0x6704('0x8f')](_0x39bdeb)){_0x27b424[_0x6704('0x85')]=_['merge'](_0x27b424['where'],{'$and':{'$or':_0x39bdeb}});}_0x27b424=_[_0x6704('0xa5')]({},_0x27b424,_0x4e3626['options']);if(_0x12d9fc&&!_0x12d9fc[_0x6704('0x97')]&&_0x40f1f8[_0x6704('0x16')]===_0x6704('0x11')){if(_0x4e3626['query'][_0x6704('0xa6')]){_0x27b424['include']=[{'all':!![]}];}return _0x4399c6[_0x40f1f8[_0x6704('0x16')]][_0x6704('0xc')](_0x27b424)[_0x6704('0xd')](function(_0x586f77){var _0x48c6bd=[];_0x586f77['forEach'](function(_0x14d04a){var _0x33659d;switch(_0x14d04a[_0x6704('0xa7')]){case'default':_0x33659d=_[_0x6704('0x93')](_0x12d9fc['associatedResources'],function(_0x2761b5){return _0x2761b5['id']===_0x14d04a['reportId']&&_0x2761b5[_0x6704('0x13')]==='DefaultReports';});break;case _0x6704('0xa8'):_0x33659d=_[_0x6704('0x93')](_0x12d9fc['associatedResources'],function(_0x31dd63){return _0x31dd63['id']===_0x14d04a[_0x6704('0x7a')]&&_0x31dd63[_0x6704('0x13')]==='CustomReports';});break;}if(_0x33659d)_0x48c6bd['push'](_0x14d04a);});_0x3f93f2[_0x6704('0xa9')]=_0x48c6bd[_0x6704('0x90')];_0x3f93f2[_0x6704('0xaa')]=_0x48c6bd;return _0x3f93f2;});}else{return _0x4399c6[_0x40f1f8[_0x6704('0x16')]][_0x6704('0xa9')]({'where':_0x27b424[_0x6704('0x85')]})[_0x6704('0xd')](function(_0x51420d){_0x3f93f2[_0x6704('0xa9')]=_0x51420d;if(_0x4e3626[_0x6704('0x8b')][_0x6704('0xa6')]){if(_0x40f1f8[_0x6704('0x16')]===_0x6704('0x20')){_0x27b424['include']=[{'model':_0x4399c6['Tag'],'as':_0x6704('0xab'),'attributes':['id','name','color'],'required':_0x4e3626[_0x6704('0x8b')][_0x6704('0xac')]?!![]:![]},{'model':_0x4399c6[_0x6704('0xad')],'as':'ThroughTags','attributes':['id',_0x6704('0xe'),_0x6704('0xae')],'through':_0x4e3626[_0x6704('0x8b')][_0x6704('0xac')]?{'attributes':[],'where':{'TagId':_0x4e3626[_0x6704('0x8b')][_0x6704('0xac')]||undefined}}:{},'required':_0x4e3626[_0x6704('0x8b')][_0x6704('0xac')]?!![]:![]}];}else{_0x27b424[_0x6704('0xaf')]=[{'all':!![]}];}}return _0x4399c6[_0x40f1f8[_0x6704('0x16')]][_0x6704('0xc')](_0x27b424);})[_0x6704('0xd')](function(_0x27727e){_0x3f93f2[_0x6704('0xaa')]=_0x27727e;if(_0x2d9b2f===_0x6704('0x36')&&_0x4e3626[_0x6704('0x8b')][_0x6704('0xb0')]===_0x6704('0xb1')){var _0x583faa=[];for(var _0x1c5af4=0x0;_0x1c5af4<_0x3f93f2[_0x6704('0xaa')]['length'];_0x1c5af4++){_0x583faa[_0x6704('0x91')](_0x2d1603('chat',_0x3f93f2[_0x6704('0xaa')][_0x1c5af4]['dataValues']));_0x583faa['push'](_0x2d1603('sms',_0x3f93f2[_0x6704('0xaa')][_0x1c5af4][_0x6704('0xb2')]));_0x583faa['push'](_0x2d1603(_0x6704('0xb3'),_0x3f93f2[_0x6704('0xaa')][_0x1c5af4][_0x6704('0xb2')]));_0x583faa['push'](_0x2d1603('mail',_0x3f93f2[_0x6704('0xaa')][_0x1c5af4][_0x6704('0xb2')]));_0x583faa[_0x6704('0x91')](_0x2d1603(_0x6704('0xb4'),_0x3f93f2[_0x6704('0xaa')][_0x1c5af4][_0x6704('0xb2')]));_0x583faa[_0x6704('0x91')](_0x2d1603(_0x6704('0xb5'),_0x3f93f2[_0x6704('0xaa')][_0x1c5af4][_0x6704('0xb2')]));}return Promise[_0x6704('0x95')](_0x583faa)[_0x6704('0xd')](function(){return _0x3f93f2;});}return _0x3f93f2;});}});}}});}; \ No newline at end of file +var _0x7bd0=['sounds','tags','Tag','templates','Template','Trigger','Trunk','variables','plugins','Plugin','extractedreports','Reports','reportId','charAt','slice','Sequelize','QueryTypes','select','ui.','InteractionId','ui.createdAt','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','toString','define','UserProfile','query','mergeResources','isEmpty','length','push','UserProfileSection','find','params','all','ignore','union','autoAssociation','rawAttributes','model','keys','filters','intersection','attributes','fields','nolimit','limit','offset','sort','merge','key','VIRTUAL','foreignKey','options','includeAll','include','forEach','reportType','default','DefaultReports','custom','CustomReports','count','rows','Tags','color','tag','ThroughTags','openTabs','true','chat','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','findAll','then','map','catch','field','associatedResources','name','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','JscriptyProject','contacts','CmContact','Lists','ListId','lists','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatWebsite','faxqueues','FaxQueue','faxaccounts','internalroutes','outboundroutes','VoiceExtension','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','role','Telephones','membername','User','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','VoicePrefix','ivrcampaigns','Campaign','MailQueue','mailaccounts','MailAccount','mailsubstatuses','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsqueues','SmsQueue','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','Team','voicequeues','queuecampaigns','agents','telephones','Users','admin','user','zendeskaccounts','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Schedule'];(function(_0x4a098c,_0x9b9756){var _0x1e7482=function(_0x550ae7){while(--_0x550ae7){_0x4a098c['push'](_0x4a098c['shift']());}};_0x1e7482(++_0x9b9756);}(_0x7bd0,0x111));var _0x07bd=function(_0x3203a1,_0x46c498){_0x3203a1=_0x3203a1-0x0;var _0x24215e=_0x7bd0[_0x3203a1];return _0x24215e;};'use strict';var _=require(_0x07bd('0x0'));var attributes=require(_0x07bd('0x1'));var qs=require(_0x07bd('0x2'));var squel=require(_0x07bd('0x3'));module[_0x07bd('0x4')]=function(_0x1b76fd){var _0x38f4d1=_0x1b76fd[_0x07bd('0x5')];function _0x5beba7(_0x2d7245,_0x3b4f4f){return new Promise(function(_0x38f3f1,_0x313548){if(!_0x3b4f4f)return _0x38f3f1(null);var _0x3e8349=_0x3b4f4f[_0x07bd('0x6')]?{[_0x3b4f4f[_0x07bd('0x6')]['field']]:_0x3b4f4f[_0x07bd('0x6')]['value']}:undefined;return _0x38f4d1[_0x2d7245][_0x07bd('0x7')]({'where':_0x3e8349,'raw':!![]})[_0x07bd('0x8')](function(_0x323724){_0x3b4f4f['associatedResources']=_[_0x07bd('0x9')](_0x323724,'id');_0x38f3f1(_0x3b4f4f);})[_0x07bd('0xa')](function(_0x324a46){_0x313548(_0x324a46);});});}function _0x169b07(_0x489311,_0x3a45f3){return new Promise(function(_0x313ca5,_0x1b067a){var _0x222efa=_0x489311[_0x07bd('0x6')]?{[_0x489311[_0x07bd('0x6')][_0x07bd('0xb')]]:_0x489311[_0x07bd('0x6')]['value']}:undefined;return _0x38f4d1[_0x489311['model']][_0x07bd('0x7')]({'where':_0x222efa,'raw':!![]})[_0x07bd('0x8')](function(_0x1c59c2){_0x3a45f3[_0x07bd('0xc')]=_[_0x07bd('0x9')](_0x1c59c2,function(_0x2406b0){return _0x2406b0[_0x07bd('0xd')];});_0x313ca5(_0x3a45f3);})['catch'](function(_0x418444){_0x1b067a(_0x418444);});});}function _0x505839(_0x229bf1,_0x2dd97b,_0x31655a){if(!_0x2dd97b)return Promise[_0x07bd('0xe')](null);return new Promise(function(_0x8aa645,_0x4929d6){return _0x38f4d1[_0x07bd('0xf')][_0x07bd('0x7')]({'where':{'sectionId':_0x2dd97b['id']},'raw':!![]})['then'](function(_0x3e8ec4){if(_0x229bf1[_0x07bd('0xb')]&&_0x229bf1[_0x07bd('0xb')]!=='id'){_0x2dd97b[_0x07bd('0xc')]=_[_0x07bd('0x9')](_0x3e8ec4,function(_0x109dbc){return _0x109dbc[_0x229bf1[_0x07bd('0xb')]];});}else{if(_0x31655a===_0x07bd('0x10')){_0x2dd97b[_0x07bd('0xc')]=_['map'](_0x3e8ec4,function(_0x15c0b8){return{'id':_0x15c0b8[_0x07bd('0x11')],'type':_0x15c0b8[_0x07bd('0x12')]};});}else{_0x2dd97b[_0x07bd('0xc')]=_[_0x07bd('0x9')](_0x3e8ec4,function(_0x47bd50){return _0x47bd50['resourceId'];});}}_0x8aa645(_0x2dd97b);})[_0x07bd('0xa')](function(_0x51ca22){_0x4929d6(_0x51ca22);});});}function _0x2b0dee(_0x480c9c,_0x50bd12){var _0x4165bc={'parentSections':[]};switch(_0x480c9c[_0x07bd('0x13')]()){case _0x07bd('0x14'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x16');break;case _0x07bd('0x17'):_0x4165bc['childModel']=_0x07bd('0x18');break;case _0x07bd('0x19'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x1a');_0x4165bc[_0x07bd('0x1b')]=[{'name':_0x07bd('0x1c'),'field':'name','foreignKey':'projectName'}];break;case'projects':_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x1d');break;case _0x07bd('0x1e'):_0x4165bc['childModel']=_0x07bd('0x1f');_0x4165bc[_0x07bd('0x1b')]=[{'name':_0x07bd('0x20'),'field':'id','foreignKey':_0x07bd('0x21')}];break;case _0x07bd('0x22'):_0x4165bc[_0x07bd('0x15')]='CmList';break;case _0x07bd('0x23'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x24');break;case _0x07bd('0x25'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x26');break;case _0x07bd('0x27'):_0x4165bc[_0x07bd('0x15')]='ChatQueue';break;case'chatwebsites':_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x28');break;case _0x07bd('0x29'):_0x4165bc['childModel']=_0x07bd('0x2a');break;case _0x07bd('0x2b'):_0x4165bc[_0x07bd('0x15')]='FaxAccount';break;case'inboundroutes':case _0x07bd('0x2c'):case _0x07bd('0x2d'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x2e');break;case'contexts':_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x2f');break;case _0x07bd('0x30'):_0x4165bc['childModel']=_0x07bd('0x31');break;case _0x07bd('0x32'):_0x4165bc['childModel']=_0x07bd('0x33');_0x4165bc[_0x07bd('0x1b')]=[{'name':_0x07bd('0x34'),'field':_0x07bd('0xd'),'foreignKey':'membername','model':'User','filter':{'field':_0x07bd('0x35'),'value':['agent']}},{'name':_0x07bd('0x36'),'field':_0x07bd('0xd'),'foreignKey':_0x07bd('0x37'),'model':_0x07bd('0x38'),'filter':{'field':_0x07bd('0x35'),'value':[_0x07bd('0x39')]}},{'name':_0x07bd('0x3a'),'field':_0x07bd('0xd'),'foreignKey':_0x07bd('0x3b'),'model':_0x07bd('0x3c'),'filter':{'field':_0x07bd('0x12'),'value':[_0x07bd('0x3d')]}},{'name':_0x07bd('0x3e'),'field':'name','foreignKey':_0x07bd('0x3b'),'model':_0x07bd('0x3c'),'filter':{'field':_0x07bd('0x12'),'value':[_0x07bd('0x3f')]}}];break;case'musiconholds':_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x40');break;case _0x07bd('0x41'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x42');break;case'voiceprefixes':_0x4165bc['childModel']=_0x07bd('0x43');break;case _0x07bd('0x44'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x45');break;case'mailqueues':_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x46');break;case _0x07bd('0x47'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x48');break;case _0x07bd('0x49'):_0x4165bc[_0x07bd('0x15')]='MailSubstatus';break;case _0x07bd('0x4a'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x4b');break;case _0x07bd('0x4c'):_0x4165bc[_0x07bd('0x15')]='OpenchannelAccount';break;case _0x07bd('0x4d'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x4e');break;case _0x07bd('0x4f'):_0x4165bc[_0x07bd('0x15')]='SmsAccount';break;case _0x07bd('0x50'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x51');break;case _0x07bd('0x52'):_0x4165bc['childModel']='WhatsappAccount';break;case _0x07bd('0x53'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x54');break;case _0x07bd('0x55'):case _0x07bd('0x56'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x3c');if(_0x50bd12){_0x4165bc[_0x07bd('0x1b')]=[{'name':_0x07bd('0x3a')},{'name':'QueueCampaigns'}];}break;case'users':case _0x07bd('0x57'):case _0x07bd('0x58'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x38');if(_0x50bd12){_0x4165bc[_0x07bd('0x1b')]=[{'name':_0x07bd('0x59'),'filter':{'field':'role','value':[_0x07bd('0x5a'),_0x07bd('0x5b')]},'ignore':!![]},{'name':_0x07bd('0x34')},{'name':_0x07bd('0x36')}];}break;case _0x07bd('0x5c'):_0x4165bc[_0x07bd('0x15')]='ZendeskAccount';break;case _0x07bd('0x5d'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x5e');break;case _0x07bd('0x5f'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x60');break;case _0x07bd('0x61'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x62');break;case _0x07bd('0x63'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x64');break;case'zohoaccounts':_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x65');break;case _0x07bd('0x66'):_0x4165bc['childModel']='User';break;case _0x07bd('0x67'):_0x4165bc['childModel']=_0x07bd('0x68');break;case _0x07bd('0x69'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x6a');break;case _0x07bd('0x6b'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x6c');break;case _0x07bd('0x6d'):_0x4165bc['childModel']=_0x07bd('0x6e');break;case _0x07bd('0x6f'):_0x4165bc[_0x07bd('0x15')]='Pause';break;case'scheduler':_0x4165bc['childModel']=_0x07bd('0x70');break;case _0x07bd('0x71'):_0x4165bc[_0x07bd('0x15')]='Sound';break;case _0x07bd('0x72'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x73');break;case _0x07bd('0x74'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x75');break;case'triggers':_0x4165bc['childModel']=_0x07bd('0x76');break;case'trunks':_0x4165bc['childModel']=_0x07bd('0x77');break;case _0x07bd('0x78'):_0x4165bc[_0x07bd('0x15')]='Variable';break;case _0x07bd('0x79'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x7a');break;case _0x07bd('0x7b'):_0x4165bc[_0x07bd('0x15')]=_0x07bd('0x10');_0x4165bc[_0x07bd('0x1b')]=[{'name':_0x07bd('0x7c'),'field':'id','foreignKey':_0x07bd('0x7d')}];break;case'metrics':_0x4165bc[_0x07bd('0x15')]='AnalyticMetric';break;}return _0x4165bc;}function _0x304796(_0x41fa36,_0x2b7907){var _0x4944e3=_0x41fa36[_0x07bd('0x7e')](0x0)['toUpperCase']()+_0x41fa36[_0x07bd('0x7f')](0x1);var _0x2ff31c={'type':_0x38f4d1[_0x07bd('0x80')][_0x07bd('0x81')]['SELECT'],'raw':!![]};return new Promise(function(_0x5dc6f6,_0x135e4e){var _0x5e4670=squel[_0x07bd('0x82')]()[_0x07bd('0xb')](_0x07bd('0x83')+_0x4944e3+_0x07bd('0x84'),'id')[_0x07bd('0xb')](_0x07bd('0x85'))['from'](_0x07bd('0x86')+_0x41fa36+_0x07bd('0x87'),'ui')[_0x07bd('0x88')](_0x07bd('0x89'),_0x2b7907['id']);return _0x38f4d1[_0x07bd('0x8a')]['query'](_0x5e4670[_0x07bd('0x8b')](),_0x2ff31c)[_0x07bd('0x8')](function(_0x278df2){_0x2b7907[_0x4944e3+'OpenTabs']=_0x278df2;_0x5dc6f6(_0x278df2);})[_0x07bd('0xa')](function(_0x585f90){_0x135e4e(_0x585f90);});});}return _0x1b76fd[_0x07bd('0x8c')](_0x07bd('0x8d'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x598367){var _0x34005e={'raw':![],'where':{}};var _0x1b5b4b={};var _0x2986c2={'count':0x0,'rows':[]};var _0x7c7408=_0x598367[_0x07bd('0x8e')]['section'];var _0x145482=_0x598367['query'][_0x07bd('0x8f')]||![];var _0x53b975=_0x2b0dee(_0x7c7408,_0x145482);if(!_0x53b975[_0x07bd('0x15')])throw new Error('Invalid\x20section\x20\x27'+_0x7c7408+'\x27');var _0x5419d1=[{'name':_0x7c7408}];if(!_[_0x07bd('0x90')](_0x53b975[_0x07bd('0x1b')]))_0x5419d1=_0x53b975[_0x07bd('0x1b')];var _0x14bcaf=[];for(var _0x475039=0x0;_0x475039<_0x5419d1[_0x07bd('0x91')];_0x475039++){_0x14bcaf[_0x07bd('0x92')](_0x38f4d1[_0x07bd('0x93')][_0x07bd('0x94')]({'where':{'userProfileId':_0x598367[_0x07bd('0x95')]['id'],'name':_0x5419d1[_0x475039]['name']},'raw':!![]}));}return Promise[_0x07bd('0x96')](_0x14bcaf)['then'](function(_0x43bcec){var _0x39360b=_[_0x07bd('0x6')](_0x43bcec,function(_0x5855e7){return _0x5855e7?_0x5855e7:undefined;});var _0x523cb0=_[_0x07bd('0x6')](_0x5419d1,[_0x07bd('0x97'),!![]]);var _0x3f7194=_[_0x07bd('0x90')](_0x39360b)&&_[_0x07bd('0x90')](_0x523cb0)?null:_[_0x07bd('0x98')](_0x523cb0,_0x39360b);if(!_0x3f7194)return null;var _0x4e630c=[];for(var _0xf256e1=0x0;_0xf256e1<_0x3f7194[_0x07bd('0x91')];_0xf256e1++){var _0x6bf34b=_['find'](_0x5419d1,function(_0x29a452){return _0x3f7194[_0xf256e1]?_0x29a452[_0x07bd('0xd')]===_0x3f7194[_0xf256e1][_0x07bd('0xd')]:null;});if(_0x6bf34b){if(_0x3f7194[_0xf256e1][_0x07bd('0x97')]){_0x4e630c['push'](_0x5beba7(_0x53b975[_0x07bd('0x15')],_0x3f7194[_0xf256e1]));}else{if(!_0x3f7194[_0xf256e1][_0x07bd('0x99')]){_0x4e630c[_0x07bd('0x92')](_0x505839(_0x6bf34b,_0x3f7194[_0xf256e1],_0x53b975[_0x07bd('0x15')]));}else{if(_0x6bf34b['model']){_0x4e630c[_0x07bd('0x92')](_0x169b07(_0x6bf34b,_0x3f7194[_0xf256e1]));}}}}}return Promise['all'](_0x4e630c);})[_0x07bd('0x8')](function(_0x15be68){var _0x128c30=_0x15be68;var _0x1968cd=null;if(_0x128c30){_0x1968cd=_0x128c30['length']===0x1?_0x128c30[0x0]:null;}if(!_0x1968cd&&!_0x128c30)return _0x2986c2;var _0x3e512e=_0x38f4d1[_0x53b975[_0x07bd('0x15')]][_0x07bd('0x9a')];_0x1b5b4b[_0x07bd('0x9b')]=_[_0x07bd('0x9c')](_0x3e512e);_0x1b5b4b[_0x07bd('0x8e')]=_[_0x07bd('0x9c')](_0x598367['query']);_0x1b5b4b[_0x07bd('0x9d')]=_[_0x07bd('0x9e')](_0x1b5b4b[_0x07bd('0x9b')],_0x1b5b4b[_0x07bd('0x8e')]);_0x34005e[_0x07bd('0x9f')]=_['intersection'](_0x1b5b4b[_0x07bd('0x9b')],qs[_0x07bd('0xa0')](_0x598367[_0x07bd('0x8e')]['fields']));_0x34005e[_0x07bd('0x9f')]=_0x34005e[_0x07bd('0x9f')][_0x07bd('0x91')]?_0x34005e[_0x07bd('0x9f')]:_0x1b5b4b[_0x07bd('0x9b')];if(!_0x598367['query']['hasOwnProperty'](_0x07bd('0xa1'))){_0x34005e[_0x07bd('0xa2')]=qs[_0x07bd('0xa2')](_0x598367[_0x07bd('0x8e')][_0x07bd('0xa2')]);_0x34005e[_0x07bd('0xa3')]=qs[_0x07bd('0xa3')](_0x598367[_0x07bd('0x8e')][_0x07bd('0xa3')]);}_0x34005e['order']=qs[_0x07bd('0xa4')](_0x598367[_0x07bd('0x8e')][_0x07bd('0xa4')]);_0x34005e[_0x07bd('0x88')]=qs[_0x07bd('0x9d')](_['pick'](_0x598367[_0x07bd('0x8e')],_0x1b5b4b['filters']));if(_0x598367[_0x07bd('0x8e')][_0x07bd('0x6')]){_0x34005e['where']=_[_0x07bd('0xa5')](_0x34005e['where'],{'$or':_['map'](_0x3e512e,function(_0x18a2b0){if(_0x18a2b0[_0x07bd('0x12')][_0x07bd('0xa6')]!==_0x07bd('0xa7')){var _0x1d64b0={};_0x1d64b0[_0x18a2b0['field']]={'$like':'%'+_0x598367[_0x07bd('0x8e')][_0x07bd('0x6')]+'%'};return _0x1d64b0;}})});}var _0x193c87=[];var _0x591fc3=null;var _0x9b9402={};if(_0x1968cd){_0x591fc3=_[_0x07bd('0x94')](_0x5419d1,['name',_0x1968cd[_0x07bd('0xd')]]);if(_0x591fc3[_0x07bd('0xb')]){_0x9b9402={};if(_0x53b975['childModel']===_0x07bd('0x10')){_0x9b9402[_0x591fc3[_0x07bd('0xa8')]]=_[_0x07bd('0x9')](_0x1968cd[_0x07bd('0xc')],'id');}else{_0x9b9402[_0x591fc3[_0x07bd('0xa8')]]=_0x1968cd[_0x07bd('0xc')];}_0x193c87[_0x07bd('0x92')](_0x9b9402);}else{_0x34005e[_0x07bd('0x88')]['id']=_0x1968cd['associatedResources'];}}else{for(var _0x780517=0x0;_0x780517<_0x128c30[_0x07bd('0x91')];_0x780517++){_0x591fc3=_['find'](_0x5419d1,[_0x07bd('0xd'),_0x128c30[_0x780517][_0x07bd('0xd')]]);if(_0x591fc3[_0x07bd('0xb')]){_0x9b9402={};_0x9b9402[_0x591fc3[_0x07bd('0xa8')]]=_0x128c30[_0x780517]['associatedResources'];_0x193c87[_0x07bd('0x92')](_0x9b9402);}else{if(!_0x34005e[_0x07bd('0x88')]['id'])_0x34005e[_0x07bd('0x88')]['id']=[];_0x128c30[_0x780517][_0x07bd('0xc')]['forEach'](function(_0x15a175){_0x34005e[_0x07bd('0x88')]['id'][_0x07bd('0x92')](_0x15a175);});}}}if(!_[_0x07bd('0x90')](_0x193c87)){_0x34005e[_0x07bd('0x88')]=_[_0x07bd('0xa5')](_0x34005e[_0x07bd('0x88')],{'$and':{'$or':_0x193c87}});}_0x34005e=_[_0x07bd('0xa5')]({},_0x34005e,_0x598367[_0x07bd('0xa9')]);if(_0x1968cd&&!_0x1968cd[_0x07bd('0x99')]&&_0x53b975[_0x07bd('0x15')]===_0x07bd('0x10')){if(_0x598367[_0x07bd('0x8e')][_0x07bd('0xaa')]){_0x34005e[_0x07bd('0xab')]=[{'all':!![]}];}return _0x38f4d1[_0x53b975[_0x07bd('0x15')]][_0x07bd('0x7')](_0x34005e)[_0x07bd('0x8')](function(_0x5811ef){var _0x578808=[];_0x5811ef[_0x07bd('0xac')](function(_0x2aeceb){var _0x2704c7;switch(_0x2aeceb[_0x07bd('0xad')]){case _0x07bd('0xae'):_0x2704c7=_[_0x07bd('0x94')](_0x1968cd[_0x07bd('0xc')],function(_0x3727d7){return _0x3727d7['id']===_0x2aeceb[_0x07bd('0x7d')]&&_0x3727d7['type']===_0x07bd('0xaf');});break;case _0x07bd('0xb0'):_0x2704c7=_[_0x07bd('0x94')](_0x1968cd[_0x07bd('0xc')],function(_0x25658e){return _0x25658e['id']===_0x2aeceb[_0x07bd('0x7d')]&&_0x25658e[_0x07bd('0x12')]===_0x07bd('0xb1');});break;}if(_0x2704c7)_0x578808[_0x07bd('0x92')](_0x2aeceb);});_0x2986c2[_0x07bd('0xb2')]=_0x578808[_0x07bd('0x91')];_0x2986c2[_0x07bd('0xb3')]=_0x578808;return _0x2986c2;});}else{return _0x38f4d1[_0x53b975[_0x07bd('0x15')]][_0x07bd('0xb2')]({'where':_0x34005e[_0x07bd('0x88')]})[_0x07bd('0x8')](function(_0x28b036){_0x2986c2[_0x07bd('0xb2')]=_0x28b036;if(_0x598367[_0x07bd('0x8e')][_0x07bd('0xaa')]){if(_0x53b975[_0x07bd('0x15')]===_0x07bd('0x1f')){_0x34005e['include']=[{'model':_0x38f4d1[_0x07bd('0x73')],'as':_0x07bd('0xb4'),'attributes':['id','name',_0x07bd('0xb5')],'required':_0x598367['query'][_0x07bd('0xb6')]?!![]:![]},{'model':_0x38f4d1['Tag'],'as':_0x07bd('0xb7'),'attributes':['id',_0x07bd('0xd'),'color'],'through':_0x598367[_0x07bd('0x8e')][_0x07bd('0xb6')]?{'attributes':[],'where':{'TagId':_0x598367['query'][_0x07bd('0xb6')]||undefined}}:{},'required':_0x598367['query'][_0x07bd('0xb6')]?!![]:![]}];}else{_0x34005e[_0x07bd('0xab')]=[{'all':!![]}];}}return _0x38f4d1[_0x53b975[_0x07bd('0x15')]][_0x07bd('0x7')](_0x34005e);})[_0x07bd('0x8')](function(_0x3f8539){_0x2986c2[_0x07bd('0xb3')]=_0x3f8539;if(_0x7c7408==='Agents'&&_0x598367['query'][_0x07bd('0xb8')]===_0x07bd('0xb9')){var _0x3bf215=[];for(var _0x1c2766=0x0;_0x1c2766<_0x2986c2[_0x07bd('0xb3')][_0x07bd('0x91')];_0x1c2766++){_0x3bf215['push'](_0x304796(_0x07bd('0xba'),_0x2986c2['rows'][_0x1c2766][_0x07bd('0xbb')]));_0x3bf215['push'](_0x304796(_0x07bd('0xbc'),_0x2986c2[_0x07bd('0xb3')][_0x1c2766][_0x07bd('0xbb')]));_0x3bf215[_0x07bd('0x92')](_0x304796(_0x07bd('0xbd'),_0x2986c2['rows'][_0x1c2766][_0x07bd('0xbb')]));_0x3bf215[_0x07bd('0x92')](_0x304796(_0x07bd('0xbe'),_0x2986c2[_0x07bd('0xb3')][_0x1c2766][_0x07bd('0xbb')]));_0x3bf215[_0x07bd('0x92')](_0x304796(_0x07bd('0xbf'),_0x2986c2[_0x07bd('0xb3')][_0x1c2766][_0x07bd('0xbb')]));_0x3bf215['push'](_0x304796(_0x07bd('0xc0'),_0x2986c2[_0x07bd('0xb3')][_0x1c2766][_0x07bd('0xbb')]));}return Promise['all'](_0x3bf215)[_0x07bd('0x8')](function(){return _0x2986c2;});}return _0x2986c2;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 5a13ad1..46fdb81 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(_0x316ad3,_0x24e897){var _0x1d81e0=function(_0x218f04){while(--_0x218f04){_0x316ad3['push'](_0x316ad3['shift']());}};_0x1d81e0(++_0x24e897);}(_0x5fab,0x177));var _0xb5fa=function(_0x3815b2,_0xdeaa84){_0x3815b2=_0x3815b2-0x0;var _0x2ebd79=_0x5fab[_0x3815b2];return _0x2ebd79;};'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 _0x6144=['register','request','info','UserProfile,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter'];(function(_0x5946db,_0x20568f){var _0x16df5f=function(_0x3925e5){while(--_0x3925e5){_0x5946db['push'](_0x5946db['shift']());}};_0x16df5f(++_0x20568f);}(_0x6144,0x99));var _0x4614=function(_0x1cea42,_0x7c265f){_0x1cea42=_0x1cea42-0x0;var _0xe00b80=_0x6144[_0x1cea42];return _0xe00b80;};'use strict';var _=require(_0x4614('0x0'));var util=require(_0x4614('0x1'));var moment=require(_0x4614('0x2'));var BPromise=require(_0x4614('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4614('0x4'));var db=require(_0x4614('0x5'))['db'];var utils=require(_0x4614('0x6'));var logger=require(_0x4614('0x7'))('rpc');var config=require(_0x4614('0x8'));var jayson=require(_0x4614('0x9'));var client=jayson[_0x4614('0xa')][_0x4614('0xb')]({'port':0x232a});config[_0x4614('0xc')]=_['defaults'](config[_0x4614('0xc')],{'host':_0x4614('0xd'),'port':0x18eb});var socket=require(_0x4614('0xe'))(new Redis(config[_0x4614('0xc')]));require('./userProfile.socket')[_0x4614('0xf')](socket);function respondWithRpcPromise(_0x3953bd,_0x7df8c,_0x3c339c){return new BPromise(function(_0x270e8d,_0x2b0439){return client[_0x4614('0x10')](_0x3953bd,_0x3c339c)['then'](function(_0x3f4202){logger[_0x4614('0x11')](_0x4614('0x12'),_0x7df8c,_0x4614('0x13'));logger['debug']('UserProfile,\x20%s,\x20%s,\x20%s',_0x7df8c,_0x4614('0x13'),JSON[_0x4614('0x14')](_0x3f4202));if(_0x3f4202[_0x4614('0x15')]){if(_0x3f4202['error']['code']===0x1f4){logger['error'](_0x4614('0x12'),_0x7df8c,_0x3f4202[_0x4614('0x15')]['message']);return _0x2b0439(_0x3f4202[_0x4614('0x15')][_0x4614('0x16')]);}logger[_0x4614('0x15')]('UserProfile,\x20%s,\x20%s',_0x7df8c,_0x3f4202[_0x4614('0x15')][_0x4614('0x16')]);return _0x270e8d(_0x3f4202[_0x4614('0x15')][_0x4614('0x16')]);}else{logger[_0x4614('0x11')](_0x4614('0x12'),_0x7df8c,'request\x20sent');_0x270e8d(_0x3f4202[_0x4614('0x17')][_0x4614('0x16')]);}})['catch'](function(_0xb8c6fd){logger[_0x4614('0x15')](_0x4614('0x12'),_0x7df8c,_0xb8c6fd);_0x2b0439(_0xb8c6fd);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 9399898..789d23d 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 _0x1d5d=['./userProfile.events','remove','emit','removeListener','register','userProfile:'];(function(_0x27cf75,_0x1ffef9){var _0x2fbda5=function(_0x3cc1df){while(--_0x3cc1df){_0x27cf75['push'](_0x27cf75['shift']());}};_0x2fbda5(++_0x1ffef9);}(_0x1d5d,0xc6));var _0xd1d5=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0x1d5d[_0x34bc30];return _0x5706de;};'use strict';var UserProfileEvents=require(_0xd1d5('0x0'));var events=['save',_0xd1d5('0x1'),'update'];function createListener(_0x41b1fd,_0x42fa24){return function(_0x4e0579){_0x42fa24[_0xd1d5('0x2')](_0x41b1fd,_0x4e0579);};}function removeListener(_0xca7da1,_0x428b34){return function(){UserProfileEvents[_0xd1d5('0x3')](_0xca7da1,_0x428b34);};}exports[_0xd1d5('0x4')]=function(_0x38f986){for(var _0x1183af=0x0,_0x4d58f9=events['length'];_0x1183af<_0x4d58f9;_0x1183af++){var _0x11b7a4=events[_0x1183af];var _0x58adab=createListener(_0xd1d5('0x5')+_0x11b7a4,_0x38f986);UserProfileEvents['on'](_0x11b7a4,_0x58adab);}}; \ No newline at end of file +var _0x40cf=['register','remove','update','emit','removeListener'];(function(_0x1a3fd7,_0x4ea6ea){var _0x310c47=function(_0x35108c){while(--_0x35108c){_0x1a3fd7['push'](_0x1a3fd7['shift']());}};_0x310c47(++_0x4ea6ea);}(_0x40cf,0x169));var _0xf40c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x40cf[_0x3dd15e];return _0x231fd0;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=['save',_0xf40c('0x0'),_0xf40c('0x1')];function createListener(_0x1213ca,_0x46a746){return function(_0x178919){_0x46a746[_0xf40c('0x2')](_0x1213ca,_0x178919);};}function removeListener(_0x23b937,_0x4e140b){return function(){UserProfileEvents[_0xf40c('0x3')](_0x23b937,_0x4e140b);};}exports[_0xf40c('0x4')]=function(_0x58f6b6){for(var _0x1136d3=0x0,_0xcbb266=events['length'];_0x1136d3<_0xcbb266;_0x1136d3++){var _0x4f4123=events[_0x1136d3];var _0x280db4=createListener('userProfile:'+_0x4f4123,_0x58f6b6);UserProfileEvents['on'](_0x4f4123,_0x280db4);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 955ce07..c9ae77a 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 _0xeaef=['destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','delete'];(function(_0x550296,_0x22e9d7){var _0x5a9993=function(_0x104c18){while(--_0x104c18){_0x550296['push'](_0x550296['shift']());}};_0x5a9993(++_0x22e9d7);}(_0xeaef,0x131));var _0xfeae=function(_0x567775,_0xbbdc1b){_0x567775=_0x567775-0x0;var _0x5d2a1b=_0xeaef[_0x567775];return _0x5d2a1b;};'use strict';var multer=require(_0xfeae('0x0'));var util=require(_0xfeae('0x1'));var path=require(_0xfeae('0x2'));var timeout=require('connect-timeout');var express=require(_0xfeae('0x3'));var router=express[_0xfeae('0x4')]();var fs_extra=require(_0xfeae('0x5'));var auth=require(_0xfeae('0x6'));var interaction=require(_0xfeae('0x7'));var config=require('../../config/environment');var controller=require('./userProfileResource.controller');router[_0xfeae('0x8')]('/',auth[_0xfeae('0x9')](),controller[_0xfeae('0xa')]);router[_0xfeae('0x8')](_0xfeae('0xb'),auth['isAuthenticated'](),controller[_0xfeae('0xc')]);router['get'](_0xfeae('0xd'),auth[_0xfeae('0x9')](),controller[_0xfeae('0xe')]);router[_0xfeae('0xf')]('/',auth[_0xfeae('0x9')](),controller[_0xfeae('0x10')]);router['put'](_0xfeae('0xd'),auth[_0xfeae('0x9')](),controller['update']);router[_0xfeae('0x11')](_0xfeae('0xd'),auth['isAuthenticated'](),controller[_0xfeae('0x12')]);module['exports']=router; \ No newline at end of file +var _0x1f09=['post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','describe','/:id'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x1f09,0xaf));var _0x91f0=function(_0xd80660,_0xa02d91){_0xd80660=_0xd80660-0x0;var _0x3f2e1c=_0x1f09[_0xd80660];return _0x3f2e1c;};'use strict';var multer=require(_0x91f0('0x0'));var util=require(_0x91f0('0x1'));var path=require('path');var timeout=require(_0x91f0('0x2'));var express=require(_0x91f0('0x3'));var router=express['Router']();var fs_extra=require(_0x91f0('0x4'));var auth=require(_0x91f0('0x5'));var interaction=require(_0x91f0('0x6'));var config=require(_0x91f0('0x7'));var controller=require(_0x91f0('0x8'));router[_0x91f0('0x9')]('/',auth[_0x91f0('0xa')](),controller[_0x91f0('0xb')]);router[_0x91f0('0x9')]('/describe',auth[_0x91f0('0xa')](),controller[_0x91f0('0xc')]);router[_0x91f0('0x9')](_0x91f0('0xd'),auth[_0x91f0('0xa')](),controller['show']);router[_0x91f0('0xe')]('/',auth[_0x91f0('0xa')](),controller[_0x91f0('0xf')]);router[_0x91f0('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x91f0('0x11')]);router[_0x91f0('0x12')](_0x91f0('0xd'),auth[_0x91f0('0xa')](),controller[_0x91f0('0x13')]);module[_0x91f0('0x14')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index a0fbf74..0ba9a06 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 _0x631a=['sequelize','exports','INTEGER','STRING'];(function(_0x15a33a,_0x24cee6){var _0x34b217=function(_0x4923f0){while(--_0x4923f0){_0x15a33a['push'](_0x15a33a['shift']());}};_0x34b217(++_0x24cee6);}(_0x631a,0x178));var _0xa631=function(_0x3a1f77,_0xac1a8f){_0x3a1f77=_0x3a1f77-0x0;var _0x151eca=_0x631a[_0x3a1f77];return _0x151eca;};'use strict';var Sequelize=require(_0xa631('0x0'));module[_0xa631('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0xa631('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xa631('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0xe456=['INTEGER','sequelize','exports','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe456,0x1a1));var _0x6e45=function(_0x32e1c4,_0x324d5d){_0x32e1c4=_0x32e1c4-0x0;var _0x8f8e7b=_0xe456[_0x32e1c4];return _0x8f8e7b;};'use strict';var Sequelize=require(_0x6e45('0x0'));module[_0x6e45('0x1')]={'name':{'type':Sequelize[_0x6e45('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x6e45('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x6e45('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 5cf47f8..eb4584f 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 _0x6d38=['findAll','rows','show','keys','filters','intersection','create','catch','body','find','params','describe','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','save','update','then','stack','name','send','index','map','UserProfileResource','rawAttributes','type','key','model','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include'];(function(_0x234ae1,_0x42bdd6){var _0x227ba0=function(_0x1f6531){while(--_0x1f6531){_0x234ae1['push'](_0x234ae1['shift']());}};_0x227ba0(++_0x42bdd6);}(_0x6d38,0x1ef));var _0x86d3=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x6d38[_0x4243a3];return _0x1b2a33;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x86d3('0x0'));var zipdir=require(_0x86d3('0x1'));var jsonpatch=require(_0x86d3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x86d3('0x3'));var Mustache=require('mustache');var util=require(_0x86d3('0x4'));var path=require(_0x86d3('0x5'));var sox=require(_0x86d3('0x6'));var csv=require('to-csv');var ejs=require(_0x86d3('0x7'));var fs=require('fs');var fs_extra=require(_0x86d3('0x8'));var _=require(_0x86d3('0x9'));var squel=require(_0x86d3('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x86d3('0xb'));var toCsv=require(_0x86d3('0xc'));var querystring=require(_0x86d3('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x86d3('0xe'));var qs=require(_0x86d3('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x86d3('0x10'))(_0x86d3('0x11'));var utils=require('../../config/utils');var config=require(_0x86d3('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x86d3('0x13'))['db'];function respondWithStatusCode(_0x7d4d2e,_0x440a55){_0x440a55=_0x440a55||0xcc;return function(_0x26d64c){if(_0x26d64c){return _0x7d4d2e[_0x86d3('0x14')](_0x440a55);}return _0x7d4d2e[_0x86d3('0x15')](_0x440a55)[_0x86d3('0x16')]();};}function respondWithResult(_0x12ef4a,_0x5ce2ff){_0x5ce2ff=_0x5ce2ff||0xc8;return function(_0x1c1ba8){if(_0x1c1ba8){return _0x12ef4a[_0x86d3('0x15')](_0x5ce2ff)[_0x86d3('0x17')](_0x1c1ba8);}};}function respondWithFilteredResult(_0x207f6f,_0x1ea535){return function(_0x34fb3b){if(_0x34fb3b){var _0x1ff008=typeof _0x1ea535[_0x86d3('0x18')]==='undefined'&&typeof _0x1ea535[_0x86d3('0x19')]===_0x86d3('0x1a');var _0x431b3f=_0x34fb3b[_0x86d3('0x1b')];var _0x46feec=_0x1ff008?0x0:_0x1ea535[_0x86d3('0x18')];var _0x33e459=_0x1ff008?_0x34fb3b[_0x86d3('0x1b')]:_0x1ea535[_0x86d3('0x18')]+_0x1ea535['limit'];var _0x191ba5;if(_0x33e459>=_0x431b3f){_0x33e459=_0x431b3f;_0x191ba5=0xc8;}else{_0x191ba5=0xce;}_0x207f6f['status'](_0x191ba5);return _0x207f6f[_0x86d3('0x1c')]('Content-Range',_0x46feec+'-'+_0x33e459+'/'+_0x431b3f)['json'](_0x34fb3b);}return null;};}function patchUpdates(_0x41486a){return function(_0x1edb6d){try{jsonpatch[_0x86d3('0x1d')](_0x1edb6d,_0x41486a,!![]);}catch(_0x1720ae){return BPromise['reject'](_0x1720ae);}return _0x1edb6d[_0x86d3('0x1e')]();};}function saveUpdates(_0x55e1c3,_0x36e0fa){return function(_0x3fdf67){if(_0x3fdf67){return _0x3fdf67[_0x86d3('0x1f')](_0x55e1c3)['then'](function(_0x39d819){return _0x39d819;});}return null;};}function removeEntity(_0x72b3d4,_0x1fa4ac){return function(_0x4bf5b8){if(_0x4bf5b8){return _0x4bf5b8['destroy']()[_0x86d3('0x20')](function(){_0x72b3d4['status'](0xcc)[_0x86d3('0x16')]();});}};}function handleEntityNotFound(_0x1bea5e,_0x3dfecd){return function(_0x3c5fe4){if(!_0x3c5fe4){_0x1bea5e['sendStatus'](0x194);}return _0x3c5fe4;};}function handleError(_0x481077,_0x3359e4){_0x3359e4=_0x3359e4||0x1f4;return function(_0x611764){logger['error'](_0x611764[_0x86d3('0x21')]);if(_0x611764['name']){delete _0x611764[_0x86d3('0x22')];}_0x481077[_0x86d3('0x15')](_0x3359e4)[_0x86d3('0x23')](_0x611764);};}exports[_0x86d3('0x24')]=function(_0x11a6fd,_0x14c9ff){var _0x1f203e={},_0x35d708={},_0x303f13={'count':0x0,'rows':[]};var _0x44dacf=_[_0x86d3('0x25')](db[_0x86d3('0x26')][_0x86d3('0x27')],function(_0x28c25e){return{'name':_0x28c25e['fieldName'],'type':_0x28c25e[_0x86d3('0x28')][_0x86d3('0x29')]};});_0x35d708[_0x86d3('0x2a')]=_[_0x86d3('0x25')](_0x44dacf,_0x86d3('0x22'));_0x35d708[_0x86d3('0x2b')]=_['keys'](_0x11a6fd[_0x86d3('0x2b')]);_0x35d708['filters']=_['intersection'](_0x35d708[_0x86d3('0x2a')],_0x35d708[_0x86d3('0x2b')]);_0x1f203e[_0x86d3('0x2c')]=_['intersection'](_0x35d708[_0x86d3('0x2a')],qs[_0x86d3('0x2d')](_0x11a6fd['query'][_0x86d3('0x2d')]));_0x1f203e[_0x86d3('0x2c')]=_0x1f203e[_0x86d3('0x2c')][_0x86d3('0x2e')]?_0x1f203e[_0x86d3('0x2c')]:_0x35d708[_0x86d3('0x2a')];if(!_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x2f')]('nolimit')){_0x1f203e['limit']=qs['limit'](_0x11a6fd[_0x86d3('0x2b')]['limit']);_0x1f203e[_0x86d3('0x18')]=qs['offset'](_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x18')]);}_0x1f203e[_0x86d3('0x30')]=qs[_0x86d3('0x31')](_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x31')]);_0x1f203e[_0x86d3('0x32')]=qs['filters'](_[_0x86d3('0x33')](_0x11a6fd[_0x86d3('0x2b')],_0x35d708['filters']),_0x44dacf);if(_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x34')]){_0x1f203e[_0x86d3('0x32')]=_[_0x86d3('0x35')](_0x1f203e['where'],{'$or':_[_0x86d3('0x25')](_0x44dacf,function(_0x42ac0d){if(_0x42ac0d[_0x86d3('0x28')]!=='VIRTUAL'){var _0x5762ca={};_0x5762ca[_0x42ac0d[_0x86d3('0x22')]]={'$like':'%'+_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x34')]+'%'};return _0x5762ca;}})});}_0x1f203e=_[_0x86d3('0x35')]({},_0x1f203e,_0x11a6fd[_0x86d3('0x36')]);var _0x3666fc={'where':_0x1f203e[_0x86d3('0x32')]};return db['UserProfileResource'][_0x86d3('0x1b')](_0x3666fc)[_0x86d3('0x20')](function(_0x2bdc67){_0x303f13[_0x86d3('0x1b')]=_0x2bdc67;if(_0x11a6fd['query'][_0x86d3('0x37')]){_0x1f203e[_0x86d3('0x38')]=[{'all':!![]}];}return db[_0x86d3('0x26')][_0x86d3('0x39')](_0x1f203e);})['then'](function(_0x587747){_0x303f13[_0x86d3('0x3a')]=_0x587747;return _0x303f13;})['then'](respondWithFilteredResult(_0x14c9ff,_0x1f203e))['catch'](handleError(_0x14c9ff,null));};exports[_0x86d3('0x3b')]=function(_0x1385fc,_0x43490a){var _0x35d6fe={'raw':![],'where':{'id':_0x1385fc['params']['id']}},_0x23ef72={};_0x23ef72[_0x86d3('0x2a')]=_[_0x86d3('0x3c')](db[_0x86d3('0x26')]['rawAttributes']);_0x23ef72[_0x86d3('0x2b')]=_[_0x86d3('0x3c')](_0x1385fc['query']);_0x23ef72[_0x86d3('0x3d')]=_[_0x86d3('0x3e')](_0x23ef72['model'],_0x23ef72['query']);_0x35d6fe['attributes']=_[_0x86d3('0x3e')](_0x23ef72[_0x86d3('0x2a')],qs[_0x86d3('0x2d')](_0x1385fc[_0x86d3('0x2b')][_0x86d3('0x2d')]));_0x35d6fe[_0x86d3('0x2c')]=_0x35d6fe['attributes'][_0x86d3('0x2e')]?_0x35d6fe[_0x86d3('0x2c')]:_0x23ef72['model'];if(_0x1385fc[_0x86d3('0x2b')][_0x86d3('0x37')]){_0x35d6fe[_0x86d3('0x38')]=[{'all':!![]}];}_0x35d6fe=_[_0x86d3('0x35')]({},_0x35d6fe,_0x1385fc[_0x86d3('0x36')]);return db[_0x86d3('0x26')]['find'](_0x35d6fe)[_0x86d3('0x20')](handleEntityNotFound(_0x43490a,null))[_0x86d3('0x20')](respondWithResult(_0x43490a,null))['catch'](handleError(_0x43490a,null));};exports[_0x86d3('0x3f')]=function(_0x412d0e,_0xd20863){return db[_0x86d3('0x26')][_0x86d3('0x3f')](_0x412d0e['body'],{})[_0x86d3('0x20')](respondWithResult(_0xd20863,0xc9))[_0x86d3('0x40')](handleError(_0xd20863,null));};exports[_0x86d3('0x1f')]=function(_0x14fa58,_0x369b75){if(_0x14fa58[_0x86d3('0x41')]['id']){delete _0x14fa58[_0x86d3('0x41')]['id'];}return db[_0x86d3('0x26')][_0x86d3('0x42')]({'where':{'id':_0x14fa58[_0x86d3('0x43')]['id']}})[_0x86d3('0x20')](handleEntityNotFound(_0x369b75,null))[_0x86d3('0x20')](saveUpdates(_0x14fa58['body'],null))[_0x86d3('0x20')](respondWithResult(_0x369b75,null))[_0x86d3('0x40')](handleError(_0x369b75,null));};exports['destroy']=function(_0x43290d,_0x23a6ee){return db[_0x86d3('0x26')][_0x86d3('0x42')]({'where':{'id':_0x43290d[_0x86d3('0x43')]['id']}})[_0x86d3('0x20')](handleEntityNotFound(_0x23a6ee,null))['then'](removeEntity(_0x23a6ee,null))['catch'](handleError(_0x23a6ee,null));};exports['describe']=function(_0x5bedc6,_0x159253){return db[_0x86d3('0x26')][_0x86d3('0x44')]()[_0x86d3('0x20')](respondWithResult(_0x159253,null))[_0x86d3('0x40')](handleError(_0x159253,null));}; \ No newline at end of file +var _0x7a54=['set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','UserProfileResource','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit'];(function(_0x27378b,_0x1a7162){var _0x4b637b=function(_0x719b6a){while(--_0x719b6a){_0x27378b['push'](_0x27378b['shift']());}};_0x4b637b(++_0x1a7162);}(_0x7a54,0x106));var _0x47a5=function(_0x15166e,_0x23b9ce){_0x15166e=_0x15166e-0x0;var _0x170a69=_0x7a54[_0x15166e];return _0x170a69;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['UserProfileResource'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['UserProfileResource']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['UserProfileResource']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x48')]=function(_0x1c9a62,_0x5f6a){return db['UserProfileResource'][_0x47a5('0x48')]()['then'](respondWithResult(_0x5f6a,null))[_0x47a5('0x46')](handleError(_0x5f6a,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 201fc8f..f9e03df 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 _0xb3f0=['exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','util','../../config/logger','api','request-promise','path','rimraf','./userProfileResource.attributes'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xb3f0,0x19c));var _0x0b3f=function(_0x235482,_0x14b833){_0x235482=_0x235482-0x0;var _0x5f5bea=_0xb3f0[_0x235482];return _0x5f5bea;};'use strict';var _=require(_0x0b3f('0x0'));var util=require(_0x0b3f('0x1'));var logger=require(_0x0b3f('0x2'))(_0x0b3f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0b3f('0x4'));var fs=require('fs');var path=require(_0x0b3f('0x5'));var rimraf=require(_0x0b3f('0x6'));var config=require('../../config/environment');var attributes=require(_0x0b3f('0x7'));module[_0x0b3f('0x8')]=function(_0xd523a1,_0x443252){return _0xd523a1[_0x0b3f('0x9')](_0x0b3f('0xa'),attributes,{'tableName':_0x0b3f('0xb'),'paranoid':![],'indexes':[{'name':_0x0b3f('0xc'),'fields':[_0x0b3f('0xd'),_0x0b3f('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0496=['define','lodash','util','api','moment','bluebird','request-promise','rimraf','exports'];(function(_0x2984b7,_0x55130f){var _0x97bf80=function(_0xae5bdb){while(--_0xae5bdb){_0x2984b7['push'](_0x2984b7['shift']());}};_0x97bf80(++_0x55130f);}(_0x0496,0xa3));var _0x6049=function(_0x273708,_0x2a0f38){_0x273708=_0x273708-0x0;var _0x1e5425=_0x0496[_0x273708];return _0x1e5425;};'use strict';var _=require(_0x6049('0x0'));var util=require(_0x6049('0x1'));var logger=require('../../config/logger')(_0x6049('0x2'));var moment=require(_0x6049('0x3'));var BPromise=require(_0x6049('0x4'));var rp=require(_0x6049('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6049('0x6'));var config=require('../../config/environment');var attributes=require('./userProfileResource.attributes');module[_0x6049('0x7')]=function(_0x330013,_0x1f3893){return _0x330013[_0x6049('0x8')]('UserProfileResource',attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':'compositeIndex','fields':['resourceId','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 ef4dc18..1772978 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 _0x4ea2=['result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x259a38,_0x50d10c){var _0x19369a=function(_0x13dadd){while(--_0x13dadd){_0x259a38['push'](_0x259a38['shift']());}};_0x19369a(++_0x50d10c);}(_0x4ea2,0xe8));var _0x24ea=function(_0x57db49,_0x288094){_0x57db49=_0x57db49-0x0;var _0xd0636f=_0x4ea2[_0x57db49];return _0xd0636f;};'use strict';var _=require('lodash');var util=require(_0x24ea('0x0'));var moment=require(_0x24ea('0x1'));var BPromise=require(_0x24ea('0x2'));var rs=require(_0x24ea('0x3'));var fs=require('fs');var Redis=require(_0x24ea('0x4'));var db=require(_0x24ea('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x24ea('0x6'))(_0x24ea('0x7'));var config=require('../../config/environment');var jayson=require(_0x24ea('0x8'));var client=jayson[_0x24ea('0x9')][_0x24ea('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x30b2d6,_0x56c5ab,_0x298bc8){return new BPromise(function(_0x5e11f6,_0x5eecf4){return client['request'](_0x30b2d6,_0x298bc8)[_0x24ea('0xb')](function(_0x228c11){logger[_0x24ea('0xc')](_0x24ea('0xd'),_0x56c5ab,_0x24ea('0xe'));logger[_0x24ea('0xf')](_0x24ea('0x10'),_0x56c5ab,_0x24ea('0xe'),JSON[_0x24ea('0x11')](_0x228c11));if(_0x228c11['error']){if(_0x228c11[_0x24ea('0x12')][_0x24ea('0x13')]===0x1f4){logger['error'](_0x24ea('0xd'),_0x56c5ab,_0x228c11[_0x24ea('0x12')][_0x24ea('0x14')]);return _0x5eecf4(_0x228c11[_0x24ea('0x12')][_0x24ea('0x14')]);}logger[_0x24ea('0x12')](_0x24ea('0xd'),_0x56c5ab,_0x228c11['error'][_0x24ea('0x14')]);return _0x5e11f6(_0x228c11[_0x24ea('0x12')]['message']);}else{logger['info']('UserProfileResource,\x20%s,\x20%s',_0x56c5ab,_0x24ea('0xe'));_0x5e11f6(_0x228c11[_0x24ea('0x15')]['message']);}})[_0x24ea('0x16')](function(_0x29c3d5){logger['error'](_0x24ea('0xd'),_0x56c5ab,_0x29c3d5);_0x5eecf4(_0x29c3d5);});});} \ No newline at end of file +var _0x1362=['info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then'];(function(_0x367e58,_0x2a9e49){var _0x37a2c5=function(_0xbd2d99){while(--_0xbd2d99){_0x367e58['push'](_0x367e58['shift']());}};_0x37a2c5(++_0x2a9e49);}(_0x1362,0xbe));var _0x2136=function(_0x2f380d,_0x151d3f){_0x2f380d=_0x2f380d-0x0;var _0x217e57=_0x1362[_0x2f380d];return _0x217e57;};'use strict';var _=require(_0x2136('0x0'));var util=require(_0x2136('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2136('0x2'));var db=require(_0x2136('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2136('0x4'))(_0x2136('0x5'));var config=require(_0x2136('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x2136('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xeff0d8,_0x69e25d,_0x5d83b2){return new BPromise(function(_0x5d52bb,_0x38a5ff){return client[_0x2136('0x8')](_0xeff0d8,_0x5d83b2)[_0x2136('0x9')](function(_0x4b27a1){logger[_0x2136('0xa')](_0x2136('0xb'),_0x69e25d,_0x2136('0xc'));logger[_0x2136('0xd')](_0x2136('0xe'),_0x69e25d,_0x2136('0xc'),JSON[_0x2136('0xf')](_0x4b27a1));if(_0x4b27a1[_0x2136('0x10')]){if(_0x4b27a1[_0x2136('0x10')][_0x2136('0x11')]===0x1f4){logger[_0x2136('0x10')](_0x2136('0xb'),_0x69e25d,_0x4b27a1['error']['message']);return _0x38a5ff(_0x4b27a1['error']['message']);}logger[_0x2136('0x10')](_0x2136('0xb'),_0x69e25d,_0x4b27a1[_0x2136('0x10')]['message']);return _0x5d52bb(_0x4b27a1['error'][_0x2136('0x12')]);}else{logger['info'](_0x2136('0xb'),_0x69e25d,'request\x20sent');_0x5d52bb(_0x4b27a1[_0x2136('0x13')]['message']);}})['catch'](function(_0x3ebe2d){logger[_0x2136('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x69e25d,_0x3ebe2d);_0x38a5ff(_0x3ebe2d);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index deac242..9d548ed 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 _0xea1b=['index','/describe','describe','get','/:id','show','post','put','update','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfileSection.controller','isAuthenticated'];(function(_0x49e1a0,_0x589050){var _0x29bec9=function(_0x4de286){while(--_0x4de286){_0x49e1a0['push'](_0x49e1a0['shift']());}};_0x29bec9(++_0x589050);}(_0xea1b,0xaa));var _0xbea1=function(_0x44bb45,_0x35fd75){_0x44bb45=_0x44bb45-0x0;var _0x44397f=_0xea1b[_0x44bb45];return _0x44397f;};'use strict';var multer=require(_0xbea1('0x0'));var util=require(_0xbea1('0x1'));var path=require('path');var timeout=require(_0xbea1('0x2'));var express=require(_0xbea1('0x3'));var router=express[_0xbea1('0x4')]();var fs_extra=require(_0xbea1('0x5'));var auth=require(_0xbea1('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbea1('0x7'));var controller=require(_0xbea1('0x8'));router['get']('/',auth[_0xbea1('0x9')](),controller[_0xbea1('0xa')]);router['get'](_0xbea1('0xb'),auth[_0xbea1('0x9')](),controller[_0xbea1('0xc')]);router[_0xbea1('0xd')](_0xbea1('0xe'),auth[_0xbea1('0x9')](),controller[_0xbea1('0xf')]);router[_0xbea1('0x10')]('/',auth[_0xbea1('0x9')](),controller['create']);router[_0xbea1('0x11')]('/:id',auth[_0xbea1('0x9')](),controller[_0xbea1('0x12')]);router['delete'](_0xbea1('0xe'),auth[_0xbea1('0x9')](),controller[_0xbea1('0x13')]);module['exports']=router; \ No newline at end of file +var _0x1c83=['fs-extra','../../config/environment','isAuthenticated','get','/describe','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0xe99dfe,_0x27a002){var _0x50370a=function(_0xc25b3d){while(--_0xc25b3d){_0xe99dfe['push'](_0xe99dfe['shift']());}};_0x50370a(++_0x27a002);}(_0x1c83,0x14e));var _0x31c8=function(_0x64790b,_0x5f4fda){_0x64790b=_0x64790b-0x0;var _0xc75859=_0x1c83[_0x64790b];return _0xc75859;};'use strict';var multer=require(_0x31c8('0x0'));var util=require(_0x31c8('0x1'));var path=require(_0x31c8('0x2'));var timeout=require(_0x31c8('0x3'));var express=require(_0x31c8('0x4'));var router=express[_0x31c8('0x5')]();var fs_extra=require(_0x31c8('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x31c8('0x7'));var controller=require('./userProfileSection.controller');router['get']('/',auth[_0x31c8('0x8')](),controller['index']);router[_0x31c8('0x9')](_0x31c8('0xa'),auth[_0x31c8('0x8')](),controller[_0x31c8('0xb')]);router[_0x31c8('0x9')](_0x31c8('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x31c8('0xd')]('/',auth[_0x31c8('0x8')](),controller[_0x31c8('0xe')]);router[_0x31c8('0xf')]('/:id',auth[_0x31c8('0x8')](),controller[_0x31c8('0x10')]);router[_0x31c8('0x11')](_0x31c8('0xc'),auth[_0x31c8('0x8')](),controller[_0x31c8('0x12')]);module[_0x31c8('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 0005d9d..e1baf23 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 _0xb7e7=['crudPermissions','getDataValue','sequelize','STRING','INTEGER','BOOLEAN','setDataValue'];(function(_0x443b89,_0x17390d){var _0x473689=function(_0x42783b){while(--_0x42783b){_0x443b89['push'](_0x443b89['shift']());}};_0x473689(++_0x17390d);}(_0xb7e7,0x121));var _0x7b7e=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xb7e7[_0x138adb];return _0x1b27f2;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x7b7e('0x2')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x7b7e('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x31d0ed){this[_0x7b7e('0x4')](_0x7b7e('0x5'),_0x31d0ed?_0x31d0ed['join'](''):[]);},'get':function(){return this['getDataValue'](_0x7b7e('0x5'))?this[_0x7b7e('0x6')](_0x7b7e('0x5'))['split'](''):[];}}}; \ No newline at end of file +var _0xeffd=['STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split','sequelize'];(function(_0x7feb90,_0x28e700){var _0x3c5b33=function(_0x113cfa){while(--_0x113cfa){_0x7feb90['push'](_0x7feb90['shift']());}};_0x3c5b33(++_0x28e700);}(_0xeffd,0x6b));var _0xdeff=function(_0x9a0731,_0x5a8372){_0x9a0731=_0x9a0731-0x0;var _0x3fee67=_0xeffd[_0x9a0731];return _0x3fee67;};'use strict';var Sequelize=require(_0xdeff('0x0'));module['exports']={'name':{'type':Sequelize[_0xdeff('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0xdeff('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xdeff('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0xdeff('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xdeff('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xdeff('0x1')],'set':function(_0x298274){this[_0xdeff('0x4')](_0xdeff('0x5'),_0x298274?_0x298274[_0xdeff('0x6')](''):[]);},'get':function(){return this[_0xdeff('0x7')](_0xdeff('0x5'))?this[_0xdeff('0x7')](_0xdeff('0x5'))[_0xdeff('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index cd7a246..9491454 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 _0x2110=['fast-json-patch','request-promise','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','undefined','count','set','apply','reject','save','destroy','then','error','name','send','UserProfileSection','rawAttributes','fieldName','key','map','query','keys','model','attributes','intersection','fields','nolimit','order','filters','filter','where','merge','type','options','includeAll','rows','catch','show','params','create','update','body','find','describe','eml-format','rimraf','zip-dir'];(function(_0x272700,_0x525483){var _0x3927a4=function(_0x5a98e0){while(--_0x5a98e0){_0x272700['push'](_0x272700['shift']());}};_0x3927a4(++_0x525483);}(_0x2110,0x160));var _0x0211=function(_0x4dd1ef,_0x23051d){_0x4dd1ef=_0x4dd1ef-0x0;var _0x3f0ad0=_0x2110[_0x4dd1ef];return _0x3f0ad0;};'use strict';var emlformat=require(_0x0211('0x0'));var rimraf=require(_0x0211('0x1'));var zipdir=require(_0x0211('0x2'));var jsonpatch=require(_0x0211('0x3'));var rp=require(_0x0211('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0211('0x5'));var util=require(_0x0211('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0211('0x7'));var fs=require('fs');var fs_extra=require(_0x0211('0x8'));var _=require(_0x0211('0x9'));var squel=require(_0x0211('0xa'));var crypto=require(_0x0211('0xb'));var jsforce=require(_0x0211('0xc'));var deskjs=require(_0x0211('0xd'));var toCsv=require(_0x0211('0xe'));var querystring=require(_0x0211('0xf'));var Papa=require('papaparse');var Redis=require(_0x0211('0x10'));var authService=require(_0x0211('0x11'));var qs=require(_0x0211('0x12'));var as=require(_0x0211('0x13'));var hardwareService=require(_0x0211('0x14'));var logger=require(_0x0211('0x15'))(_0x0211('0x16'));var utils=require(_0x0211('0x17'));var config=require(_0x0211('0x18'));var licenseUtil=require(_0x0211('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c3bd4,_0x546c75){_0x546c75=_0x546c75||0xcc;return function(_0x238d3e){if(_0x238d3e){return _0x2c3bd4['sendStatus'](_0x546c75);}return _0x2c3bd4[_0x0211('0x1a')](_0x546c75)[_0x0211('0x1b')]();};}function respondWithResult(_0x76b544,_0x11d04b){_0x11d04b=_0x11d04b||0xc8;return function(_0x442112){if(_0x442112){return _0x76b544[_0x0211('0x1a')](_0x11d04b)[_0x0211('0x1c')](_0x442112);}};}function respondWithFilteredResult(_0x2c3a6a,_0x5728d6){return function(_0x55bded){if(_0x55bded){var _0x40fdfa=typeof _0x5728d6[_0x0211('0x1d')]==='undefined'&&typeof _0x5728d6[_0x0211('0x1e')]===_0x0211('0x1f');var _0x708364=_0x55bded['count'];var _0x5e52e9=_0x40fdfa?0x0:_0x5728d6[_0x0211('0x1d')];var _0x36f60f=_0x40fdfa?_0x55bded[_0x0211('0x20')]:_0x5728d6[_0x0211('0x1d')]+_0x5728d6[_0x0211('0x1e')];var _0x3649ee;if(_0x36f60f>=_0x708364){_0x36f60f=_0x708364;_0x3649ee=0xc8;}else{_0x3649ee=0xce;}_0x2c3a6a[_0x0211('0x1a')](_0x3649ee);return _0x2c3a6a[_0x0211('0x21')]('Content-Range',_0x5e52e9+'-'+_0x36f60f+'/'+_0x708364)[_0x0211('0x1c')](_0x55bded);}return null;};}function patchUpdates(_0x2665eb){return function(_0xc6d96b){try{jsonpatch[_0x0211('0x22')](_0xc6d96b,_0x2665eb,!![]);}catch(_0x4e45de){return BPromise[_0x0211('0x23')](_0x4e45de);}return _0xc6d96b[_0x0211('0x24')]();};}function saveUpdates(_0x4d56ed,_0x27bf81){return function(_0x12aca4){if(_0x12aca4){return _0x12aca4['update'](_0x4d56ed)['then'](function(_0x3ee285){return _0x3ee285;});}return null;};}function removeEntity(_0x634f76,_0x3f3831){return function(_0xf2c099){if(_0xf2c099){return _0xf2c099[_0x0211('0x25')]()[_0x0211('0x26')](function(){_0x634f76['status'](0xcc)[_0x0211('0x1b')]();});}};}function handleEntityNotFound(_0x240504,_0x37ddb6){return function(_0x21e7c3){if(!_0x21e7c3){_0x240504['sendStatus'](0x194);}return _0x21e7c3;};}function handleError(_0x16093a,_0x4002bd){_0x4002bd=_0x4002bd||0x1f4;return function(_0x4dec7d){logger[_0x0211('0x27')](_0x4dec7d['stack']);if(_0x4dec7d[_0x0211('0x28')]){delete _0x4dec7d[_0x0211('0x28')];}_0x16093a[_0x0211('0x1a')](_0x4002bd)[_0x0211('0x29')](_0x4dec7d);};}exports['index']=function(_0x1eb101,_0xddb8a0){var _0x1cca25={},_0x5f2162={},_0x24e424={'count':0x0,'rows':[]};var _0x4fe676=_['map'](db[_0x0211('0x2a')][_0x0211('0x2b')],function(_0x3a1212){return{'name':_0x3a1212[_0x0211('0x2c')],'type':_0x3a1212['type'][_0x0211('0x2d')]};});_0x5f2162['model']=_[_0x0211('0x2e')](_0x4fe676,_0x0211('0x28'));_0x5f2162[_0x0211('0x2f')]=_[_0x0211('0x30')](_0x1eb101[_0x0211('0x2f')]);_0x5f2162['filters']=_['intersection'](_0x5f2162[_0x0211('0x31')],_0x5f2162[_0x0211('0x2f')]);_0x1cca25[_0x0211('0x32')]=_[_0x0211('0x33')](_0x5f2162[_0x0211('0x31')],qs[_0x0211('0x34')](_0x1eb101[_0x0211('0x2f')][_0x0211('0x34')]));_0x1cca25['attributes']=_0x1cca25['attributes']['length']?_0x1cca25[_0x0211('0x32')]:_0x5f2162[_0x0211('0x31')];if(!_0x1eb101[_0x0211('0x2f')]['hasOwnProperty'](_0x0211('0x35'))){_0x1cca25[_0x0211('0x1e')]=qs[_0x0211('0x1e')](_0x1eb101[_0x0211('0x2f')][_0x0211('0x1e')]);_0x1cca25[_0x0211('0x1d')]=qs[_0x0211('0x1d')](_0x1eb101[_0x0211('0x2f')][_0x0211('0x1d')]);}_0x1cca25[_0x0211('0x36')]=qs['sort'](_0x1eb101[_0x0211('0x2f')]['sort']);_0x1cca25['where']=qs[_0x0211('0x37')](_['pick'](_0x1eb101[_0x0211('0x2f')],_0x5f2162[_0x0211('0x37')]),_0x4fe676);if(_0x1eb101[_0x0211('0x2f')][_0x0211('0x38')]){_0x1cca25[_0x0211('0x39')]=_[_0x0211('0x3a')](_0x1cca25[_0x0211('0x39')],{'$or':_[_0x0211('0x2e')](_0x4fe676,function(_0x421595){if(_0x421595[_0x0211('0x3b')]!=='VIRTUAL'){var _0x441446={};_0x441446[_0x421595[_0x0211('0x28')]]={'$like':'%'+_0x1eb101[_0x0211('0x2f')][_0x0211('0x38')]+'%'};return _0x441446;}})});}_0x1cca25=_['merge']({},_0x1cca25,_0x1eb101[_0x0211('0x3c')]);var _0x3f1c0f={'where':_0x1cca25[_0x0211('0x39')]};return db[_0x0211('0x2a')][_0x0211('0x20')](_0x3f1c0f)[_0x0211('0x26')](function(_0x3a5139){_0x24e424[_0x0211('0x20')]=_0x3a5139;if(_0x1eb101['query'][_0x0211('0x3d')]){_0x1cca25['include']=[{'all':!![]}];}return db['UserProfileSection']['findAll'](_0x1cca25);})[_0x0211('0x26')](function(_0x4ac88b){_0x24e424[_0x0211('0x3e')]=_0x4ac88b;return _0x24e424;})[_0x0211('0x26')](respondWithFilteredResult(_0xddb8a0,_0x1cca25))[_0x0211('0x3f')](handleError(_0xddb8a0,null));};exports[_0x0211('0x40')]=function(_0x5854a0,_0x26cdd8){var _0x1b9a9a={'raw':![],'where':{'id':_0x5854a0[_0x0211('0x41')]['id']}},_0xe8d340={};_0xe8d340[_0x0211('0x31')]=_['keys'](db[_0x0211('0x2a')][_0x0211('0x2b')]);_0xe8d340['query']=_[_0x0211('0x30')](_0x5854a0[_0x0211('0x2f')]);_0xe8d340['filters']=_[_0x0211('0x33')](_0xe8d340[_0x0211('0x31')],_0xe8d340[_0x0211('0x2f')]);_0x1b9a9a[_0x0211('0x32')]=_[_0x0211('0x33')](_0xe8d340[_0x0211('0x31')],qs[_0x0211('0x34')](_0x5854a0[_0x0211('0x2f')][_0x0211('0x34')]));_0x1b9a9a[_0x0211('0x32')]=_0x1b9a9a[_0x0211('0x32')]['length']?_0x1b9a9a[_0x0211('0x32')]:_0xe8d340['model'];if(_0x5854a0[_0x0211('0x2f')]['includeAll']){_0x1b9a9a['include']=[{'all':!![]}];}_0x1b9a9a=_['merge']({},_0x1b9a9a,_0x5854a0[_0x0211('0x3c')]);return db[_0x0211('0x2a')]['find'](_0x1b9a9a)[_0x0211('0x26')](handleEntityNotFound(_0x26cdd8,null))[_0x0211('0x26')](respondWithResult(_0x26cdd8,null))['catch'](handleError(_0x26cdd8,null));};exports[_0x0211('0x42')]=function(_0x28a6d2,_0xd75e59){return db[_0x0211('0x2a')][_0x0211('0x42')](_0x28a6d2['body'],{})[_0x0211('0x26')](respondWithResult(_0xd75e59,0xc9))[_0x0211('0x3f')](handleError(_0xd75e59,null));};exports[_0x0211('0x43')]=function(_0x5a59c2,_0x434712){if(_0x5a59c2[_0x0211('0x44')]['id']){delete _0x5a59c2[_0x0211('0x44')]['id'];}return db['UserProfileSection'][_0x0211('0x45')]({'where':{'id':_0x5a59c2['params']['id']}})[_0x0211('0x26')](handleEntityNotFound(_0x434712,null))[_0x0211('0x26')](saveUpdates(_0x5a59c2[_0x0211('0x44')],null))[_0x0211('0x26')](respondWithResult(_0x434712,null))[_0x0211('0x3f')](handleError(_0x434712,null));};exports[_0x0211('0x25')]=function(_0x378e3c,_0x4c7c70){return db[_0x0211('0x2a')][_0x0211('0x45')]({'where':{'id':_0x378e3c[_0x0211('0x41')]['id']}})[_0x0211('0x26')](handleEntityNotFound(_0x4c7c70,null))[_0x0211('0x26')](removeEntity(_0x4c7c70,null))['catch'](handleError(_0x4c7c70,null));};exports['describe']=function(_0x45b3ca,_0x7a1f50){return db[_0x0211('0x2a')][_0x0211('0x46')]()[_0x0211('0x26')](respondWithResult(_0x7a1f50,null))[_0x0211('0x3f')](handleError(_0x7a1f50,null));}; \ No newline at end of file +var _0xec2d=['end','error','stack','name','send','map','UserProfileSection','type','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','model','find','create','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','json','limit','undefined','count','offset','set','apply','save','update','destroy','then'];(function(_0x42bd13,_0x13edb1){var _0x164df6=function(_0x2640a6){while(--_0x2640a6){_0x42bd13['push'](_0x42bd13['shift']());}};_0x164df6(++_0x13edb1);}(_0xec2d,0x6d));var _0xdec2=function(_0x4bfe6f,_0x2a4e4c){_0x4bfe6f=_0x4bfe6f-0x0;var _0x388d9e=_0xec2d[_0x4bfe6f];return _0x388d9e;};'use strict';var emlformat=require(_0xdec2('0x0'));var rimraf=require(_0xdec2('0x1'));var zipdir=require(_0xdec2('0x2'));var jsonpatch=require(_0xdec2('0x3'));var rp=require(_0xdec2('0x4'));var moment=require(_0xdec2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdec2('0x6'));var util=require(_0xdec2('0x7'));var path=require('path');var sox=require(_0xdec2('0x8'));var csv=require(_0xdec2('0x9'));var ejs=require(_0xdec2('0xa'));var fs=require('fs');var fs_extra=require(_0xdec2('0xb'));var _=require(_0xdec2('0xc'));var squel=require('squel');var crypto=require(_0xdec2('0xd'));var jsforce=require(_0xdec2('0xe'));var deskjs=require(_0xdec2('0xf'));var toCsv=require('to-csv');var querystring=require(_0xdec2('0x10'));var Papa=require(_0xdec2('0x11'));var Redis=require(_0xdec2('0x12'));var authService=require(_0xdec2('0x13'));var qs=require(_0xdec2('0x14'));var as=require(_0xdec2('0x15'));var hardwareService=require(_0xdec2('0x16'));var logger=require(_0xdec2('0x17'))('api');var utils=require(_0xdec2('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xdec2('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17e385,_0x279468){_0x279468=_0x279468||0xcc;return function(_0x626fe4){if(_0x626fe4){return _0x17e385[_0xdec2('0x1a')](_0x279468);}return _0x17e385[_0xdec2('0x1b')](_0x279468)['end']();};}function respondWithResult(_0x1cf557,_0x109228){_0x109228=_0x109228||0xc8;return function(_0x8ecda4){if(_0x8ecda4){return _0x1cf557[_0xdec2('0x1b')](_0x109228)[_0xdec2('0x1c')](_0x8ecda4);}};}function respondWithFilteredResult(_0x4c0352,_0x4ada5b){return function(_0x383d60){if(_0x383d60){var _0x37f7a2=typeof _0x4ada5b['offset']==='undefined'&&typeof _0x4ada5b[_0xdec2('0x1d')]===_0xdec2('0x1e');var _0x417d9d=_0x383d60['count'];var _0x2775c0=_0x37f7a2?0x0:_0x4ada5b['offset'];var _0xc56c65=_0x37f7a2?_0x383d60[_0xdec2('0x1f')]:_0x4ada5b[_0xdec2('0x20')]+_0x4ada5b['limit'];var _0x21ce09;if(_0xc56c65>=_0x417d9d){_0xc56c65=_0x417d9d;_0x21ce09=0xc8;}else{_0x21ce09=0xce;}_0x4c0352[_0xdec2('0x1b')](_0x21ce09);return _0x4c0352[_0xdec2('0x21')]('Content-Range',_0x2775c0+'-'+_0xc56c65+'/'+_0x417d9d)[_0xdec2('0x1c')](_0x383d60);}return null;};}function patchUpdates(_0x131139){return function(_0x2b60dd){try{jsonpatch[_0xdec2('0x22')](_0x2b60dd,_0x131139,!![]);}catch(_0xc97978){return BPromise['reject'](_0xc97978);}return _0x2b60dd[_0xdec2('0x23')]();};}function saveUpdates(_0x1bc635,_0x153587){return function(_0x4dc54a){if(_0x4dc54a){return _0x4dc54a[_0xdec2('0x24')](_0x1bc635)['then'](function(_0x3e750c){return _0x3e750c;});}return null;};}function removeEntity(_0x1c1e15,_0x466cdf){return function(_0xeffd9f){if(_0xeffd9f){return _0xeffd9f[_0xdec2('0x25')]()[_0xdec2('0x26')](function(){_0x1c1e15[_0xdec2('0x1b')](0xcc)[_0xdec2('0x27')]();});}};}function handleEntityNotFound(_0x2377bd,_0x2dd8bc){return function(_0x455e8f){if(!_0x455e8f){_0x2377bd['sendStatus'](0x194);}return _0x455e8f;};}function handleError(_0x51346f,_0x502e40){_0x502e40=_0x502e40||0x1f4;return function(_0x1ce54f){logger[_0xdec2('0x28')](_0x1ce54f[_0xdec2('0x29')]);if(_0x1ce54f[_0xdec2('0x2a')]){delete _0x1ce54f['name'];}_0x51346f['status'](_0x502e40)[_0xdec2('0x2b')](_0x1ce54f);};}exports['index']=function(_0x2c6f22,_0x1d6542){var _0x328ad1={},_0x319bde={},_0x1f5f39={'count':0x0,'rows':[]};var _0x2d9aca=_[_0xdec2('0x2c')](db[_0xdec2('0x2d')]['rawAttributes'],function(_0x4b8178){return{'name':_0x4b8178['fieldName'],'type':_0x4b8178[_0xdec2('0x2e')]['key']};});_0x319bde['model']=_[_0xdec2('0x2c')](_0x2d9aca,_0xdec2('0x2a'));_0x319bde[_0xdec2('0x2f')]=_[_0xdec2('0x30')](_0x2c6f22['query']);_0x319bde[_0xdec2('0x31')]=_[_0xdec2('0x32')](_0x319bde['model'],_0x319bde[_0xdec2('0x2f')]);_0x328ad1['attributes']=_[_0xdec2('0x32')](_0x319bde['model'],qs[_0xdec2('0x33')](_0x2c6f22[_0xdec2('0x2f')][_0xdec2('0x33')]));_0x328ad1[_0xdec2('0x34')]=_0x328ad1[_0xdec2('0x34')][_0xdec2('0x35')]?_0x328ad1[_0xdec2('0x34')]:_0x319bde['model'];if(!_0x2c6f22[_0xdec2('0x2f')]['hasOwnProperty'](_0xdec2('0x36'))){_0x328ad1[_0xdec2('0x1d')]=qs[_0xdec2('0x1d')](_0x2c6f22[_0xdec2('0x2f')][_0xdec2('0x1d')]);_0x328ad1[_0xdec2('0x20')]=qs[_0xdec2('0x20')](_0x2c6f22[_0xdec2('0x2f')][_0xdec2('0x20')]);}_0x328ad1[_0xdec2('0x37')]=qs[_0xdec2('0x38')](_0x2c6f22[_0xdec2('0x2f')]['sort']);_0x328ad1[_0xdec2('0x39')]=qs[_0xdec2('0x31')](_[_0xdec2('0x3a')](_0x2c6f22[_0xdec2('0x2f')],_0x319bde[_0xdec2('0x31')]),_0x2d9aca);if(_0x2c6f22[_0xdec2('0x2f')][_0xdec2('0x3b')]){_0x328ad1[_0xdec2('0x39')]=_[_0xdec2('0x3c')](_0x328ad1['where'],{'$or':_['map'](_0x2d9aca,function(_0x392393){if(_0x392393[_0xdec2('0x2e')]!=='VIRTUAL'){var _0x3c8813={};_0x3c8813[_0x392393['name']]={'$like':'%'+_0x2c6f22[_0xdec2('0x2f')][_0xdec2('0x3b')]+'%'};return _0x3c8813;}})});}_0x328ad1=_[_0xdec2('0x3c')]({},_0x328ad1,_0x2c6f22[_0xdec2('0x3d')]);var _0x48b20e={'where':_0x328ad1[_0xdec2('0x39')]};return db[_0xdec2('0x2d')][_0xdec2('0x1f')](_0x48b20e)[_0xdec2('0x26')](function(_0x13934b){_0x1f5f39[_0xdec2('0x1f')]=_0x13934b;if(_0x2c6f22[_0xdec2('0x2f')][_0xdec2('0x3e')]){_0x328ad1[_0xdec2('0x3f')]=[{'all':!![]}];}return db[_0xdec2('0x2d')][_0xdec2('0x40')](_0x328ad1);})[_0xdec2('0x26')](function(_0x245c69){_0x1f5f39[_0xdec2('0x41')]=_0x245c69;return _0x1f5f39;})[_0xdec2('0x26')](respondWithFilteredResult(_0x1d6542,_0x328ad1))['catch'](handleError(_0x1d6542,null));};exports[_0xdec2('0x42')]=function(_0x21f47c,_0x5052e1){var _0x4a553a={'raw':![],'where':{'id':_0x21f47c['params']['id']}},_0x5d93a1={};_0x5d93a1[_0xdec2('0x43')]=_[_0xdec2('0x30')](db[_0xdec2('0x2d')]['rawAttributes']);_0x5d93a1[_0xdec2('0x2f')]=_[_0xdec2('0x30')](_0x21f47c[_0xdec2('0x2f')]);_0x5d93a1['filters']=_[_0xdec2('0x32')](_0x5d93a1[_0xdec2('0x43')],_0x5d93a1[_0xdec2('0x2f')]);_0x4a553a['attributes']=_[_0xdec2('0x32')](_0x5d93a1[_0xdec2('0x43')],qs[_0xdec2('0x33')](_0x21f47c[_0xdec2('0x2f')]['fields']));_0x4a553a[_0xdec2('0x34')]=_0x4a553a['attributes'][_0xdec2('0x35')]?_0x4a553a[_0xdec2('0x34')]:_0x5d93a1[_0xdec2('0x43')];if(_0x21f47c[_0xdec2('0x2f')][_0xdec2('0x3e')]){_0x4a553a[_0xdec2('0x3f')]=[{'all':!![]}];}_0x4a553a=_['merge']({},_0x4a553a,_0x21f47c[_0xdec2('0x3d')]);return db[_0xdec2('0x2d')][_0xdec2('0x44')](_0x4a553a)[_0xdec2('0x26')](handleEntityNotFound(_0x5052e1,null))[_0xdec2('0x26')](respondWithResult(_0x5052e1,null))['catch'](handleError(_0x5052e1,null));};exports[_0xdec2('0x45')]=function(_0x2f1d57,_0x4275e2){return db[_0xdec2('0x2d')][_0xdec2('0x45')](_0x2f1d57['body'],{})['then'](respondWithResult(_0x4275e2,0xc9))[_0xdec2('0x46')](handleError(_0x4275e2,null));};exports[_0xdec2('0x24')]=function(_0x1349a8,_0x37aced){if(_0x1349a8[_0xdec2('0x47')]['id']){delete _0x1349a8[_0xdec2('0x47')]['id'];}return db[_0xdec2('0x2d')][_0xdec2('0x44')]({'where':{'id':_0x1349a8[_0xdec2('0x48')]['id']}})[_0xdec2('0x26')](handleEntityNotFound(_0x37aced,null))[_0xdec2('0x26')](saveUpdates(_0x1349a8[_0xdec2('0x47')],null))[_0xdec2('0x26')](respondWithResult(_0x37aced,null))[_0xdec2('0x46')](handleError(_0x37aced,null));};exports[_0xdec2('0x25')]=function(_0x11ad09,_0x4f3106){return db[_0xdec2('0x2d')][_0xdec2('0x44')]({'where':{'id':_0x11ad09[_0xdec2('0x48')]['id']}})[_0xdec2('0x26')](handleEntityNotFound(_0x4f3106,null))[_0xdec2('0x26')](removeEntity(_0x4f3106,null))[_0xdec2('0x46')](handleError(_0x4f3106,null));};exports[_0xdec2('0x49')]=function(_0x59c9c7,_0x5130a8){return db['UserProfileSection'][_0xdec2('0x49')]()[_0xdec2('0x26')](respondWithResult(_0x5130a8,null))[_0xdec2('0x46')](handleError(_0x5130a8,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 2b8987e..e6584c3 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 _0x875b=['define','UserProfileSection','user_profile_has_sections','sectionId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes'];(function(_0x5afabd,_0x109f2c){var _0x2563c1=function(_0xf46836){while(--_0xf46836){_0x5afabd['push'](_0x5afabd['shift']());}};_0x2563c1(++_0x109f2c);}(_0x875b,0xe5));var _0xb875=function(_0x1be790,_0x112549){_0x1be790=_0x1be790-0x0;var _0x7668c8=_0x875b[_0x1be790];return _0x7668c8;};'use strict';var _=require(_0xb875('0x0'));var util=require(_0xb875('0x1'));var logger=require(_0xb875('0x2'))(_0xb875('0x3'));var moment=require(_0xb875('0x4'));var BPromise=require(_0xb875('0x5'));var rp=require(_0xb875('0x6'));var fs=require('fs');var path=require(_0xb875('0x7'));var rimraf=require(_0xb875('0x8'));var config=require(_0xb875('0x9'));var attributes=require(_0xb875('0xa'));module['exports']=function(_0x4d2b09,_0x162349){return _0x4d2b09[_0xb875('0xb')](_0xb875('0xc'),attributes,{'tableName':_0xb875('0xd'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xb875('0xe'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xbfb7=['UserProfileSection','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./userProfileSection.attributes','exports','define'];(function(_0x513047,_0x2199c5){var _0x15b779=function(_0x412fd5){while(--_0x412fd5){_0x513047['push'](_0x513047['shift']());}};_0x15b779(++_0x2199c5);}(_0xbfb7,0x130));var _0x7bfb=function(_0x3011b7,_0x56b4b0){_0x3011b7=_0x3011b7-0x0;var _0x304ca2=_0xbfb7[_0x3011b7];return _0x304ca2;};'use strict';var _=require(_0x7bfb('0x0'));var util=require(_0x7bfb('0x1'));var logger=require(_0x7bfb('0x2'))(_0x7bfb('0x3'));var moment=require('moment');var BPromise=require(_0x7bfb('0x4'));var rp=require(_0x7bfb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7bfb('0x6'));var config=require(_0x7bfb('0x7'));var attributes=require(_0x7bfb('0x8'));module[_0x7bfb('0x9')]=function(_0x5cb754,_0xbe1f7){return _0x5cb754[_0x7bfb('0xa')](_0x7bfb('0xb'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x7bfb('0xc'),'fields':[_0x7bfb('0xd'),_0x7bfb('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 7805c44..9742348 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 _0xbe41=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x142cae,_0x3b7b41){var _0x58b603=function(_0x1d56eb){while(--_0x1d56eb){_0x142cae['push'](_0x142cae['shift']());}};_0x58b603(++_0x3b7b41);}(_0xbe41,0x1b9));var _0x1be4=function(_0x3a1cba,_0x5c0ade){_0x3a1cba=_0x3a1cba-0x0;var _0x3f4d83=_0xbe41[_0x3a1cba];return _0x3f4d83;};'use strict';var _=require(_0x1be4('0x0'));var util=require(_0x1be4('0x1'));var moment=require(_0x1be4('0x2'));var BPromise=require(_0x1be4('0x3'));var rs=require(_0x1be4('0x4'));var fs=require('fs');var Redis=require(_0x1be4('0x5'));var db=require(_0x1be4('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1be4('0x7'))(_0x1be4('0x8'));var config=require(_0x1be4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1be4('0xa')][_0x1be4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x313492,_0x118bef,_0x3c4573){return new BPromise(function(_0x5daf08,_0x4feda0){return client['request'](_0x313492,_0x3c4573)['then'](function(_0x2dfd84){logger[_0x1be4('0xc')](_0x1be4('0xd'),_0x118bef,_0x1be4('0xe'));logger['debug'](_0x1be4('0xf'),_0x118bef,_0x1be4('0xe'),JSON[_0x1be4('0x10')](_0x2dfd84));if(_0x2dfd84[_0x1be4('0x11')]){if(_0x2dfd84[_0x1be4('0x11')][_0x1be4('0x12')]===0x1f4){logger[_0x1be4('0x11')](_0x1be4('0xd'),_0x118bef,_0x2dfd84[_0x1be4('0x11')][_0x1be4('0x13')]);return _0x4feda0(_0x2dfd84[_0x1be4('0x11')]['message']);}logger['error'](_0x1be4('0xd'),_0x118bef,_0x2dfd84[_0x1be4('0x11')][_0x1be4('0x13')]);return _0x5daf08(_0x2dfd84[_0x1be4('0x11')][_0x1be4('0x13')]);}else{logger[_0x1be4('0xc')]('UserProfileSection,\x20%s,\x20%s',_0x118bef,_0x1be4('0xe'));_0x5daf08(_0x2dfd84[_0x1be4('0x14')]['message']);}})[_0x1be4('0x15')](function(_0x4d650c){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x118bef,_0x4d650c);_0x4feda0(_0x4d650c);});});} \ No newline at end of file +var _0xf3e9=['message','info','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x54c8a2,_0x1467a4){var _0x20d5e7=function(_0x1a7d65){while(--_0x1a7d65){_0x54c8a2['push'](_0x54c8a2['shift']());}};_0x20d5e7(++_0x1467a4);}(_0xf3e9,0x64));var _0x9f3e=function(_0x465a0b,_0x5dbb05){_0x465a0b=_0x465a0b-0x0;var _0x348c8b=_0xf3e9[_0x465a0b];return _0x348c8b;};'use strict';var _=require(_0x9f3e('0x0'));var util=require('util');var moment=require(_0x9f3e('0x1'));var BPromise=require('bluebird');var rs=require(_0x9f3e('0x2'));var fs=require('fs');var Redis=require(_0x9f3e('0x3'));var db=require(_0x9f3e('0x4'))['db'];var utils=require(_0x9f3e('0x5'));var logger=require(_0x9f3e('0x6'))('rpc');var config=require(_0x9f3e('0x7'));var jayson=require(_0x9f3e('0x8'));var client=jayson[_0x9f3e('0x9')][_0x9f3e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x49b083,_0x10c49f,_0x51efbc){return new BPromise(function(_0x34ff18,_0x1e2f0a){return client[_0x9f3e('0xb')](_0x49b083,_0x51efbc)[_0x9f3e('0xc')](function(_0x4ba13b){logger['info'](_0x9f3e('0xd'),_0x10c49f,_0x9f3e('0xe'));logger[_0x9f3e('0xf')](_0x9f3e('0x10'),_0x10c49f,_0x9f3e('0xe'),JSON[_0x9f3e('0x11')](_0x4ba13b));if(_0x4ba13b[_0x9f3e('0x12')]){if(_0x4ba13b['error'][_0x9f3e('0x13')]===0x1f4){logger[_0x9f3e('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x10c49f,_0x4ba13b['error'][_0x9f3e('0x14')]);return _0x1e2f0a(_0x4ba13b[_0x9f3e('0x12')]['message']);}logger['error']('UserProfileSection,\x20%s,\x20%s',_0x10c49f,_0x4ba13b['error']['message']);return _0x34ff18(_0x4ba13b[_0x9f3e('0x12')][_0x9f3e('0x14')]);}else{logger[_0x9f3e('0x15')]('UserProfileSection,\x20%s,\x20%s',_0x10c49f,_0x9f3e('0xe'));_0x34ff18(_0x4ba13b[_0x9f3e('0x16')][_0x9f3e('0x14')]);}})[_0x9f3e('0x17')](function(_0x2b5787){logger[_0x9f3e('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x10c49f,_0x2b5787);_0x1e2f0a(_0x2b5787);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index a28d9f8..5dac47b 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x4bab52,_0x299f01){var _0x4b6fff=function(_0x202840){while(--_0x202840){_0x4bab52['push'](_0x4bab52['shift']());}};_0x4b6fff(++_0x299f01);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x550a43,_0x23aa2){var _0x2596e4=function(_0x46410a){while(--_0x46410a){_0x550a43['push'](_0x550a43['shift']());}};_0x2596e4(++_0x23aa2);}(_0x70e0,0x17b));var _0x070e=function(_0x410010,_0x539c51){_0x410010=_0x410010-0x0;var _0x473a2c=_0x70e0[_0x410010];return _0x473a2c;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index b022ee8..3166e0a 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 _0x7a0f=['INTEGER','sequelize'];(function(_0x2a7ec4,_0x43d555){var _0xfd12a3=function(_0x42f881){while(--_0x42f881){_0x2a7ec4['push'](_0x2a7ec4['shift']());}};_0xfd12a3(++_0x43d555);}(_0x7a0f,0x199));var _0xf7a0=function(_0x8a45d,_0x210fd3){_0x8a45d=_0x8a45d-0x0;var _0x1f9483=_0x7a0f[_0x8a45d];return _0x1f9483;};'use strict';var Sequelize=require(_0xf7a0('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xf7a0('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1d63=['INTEGER'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x1d63,0x144));var _0x31d6=function(_0x4c850d,_0x2bb920){_0x4c850d=_0x4c850d-0x0;var _0x3ca4d3=_0x1d63[_0x4c850d];return _0x3ca4d3;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x31d6('0x0')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 2787512..eb6d383 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 _0x7096=['exports','define','UserSmsQueue','user_has_sms_queues','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes'];(function(_0x5eef05,_0x1be989){var _0x56d4b8=function(_0x57993d){while(--_0x57993d){_0x5eef05['push'](_0x5eef05['shift']());}};_0x56d4b8(++_0x1be989);}(_0x7096,0x10c));var _0x6709=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x7096[_0x1ac595];return _0x455fff;};'use strict';var _=require('lodash');var util=require(_0x6709('0x0'));var logger=require('../../config/logger')(_0x6709('0x1'));var moment=require('moment');var BPromise=require(_0x6709('0x2'));var rp=require(_0x6709('0x3'));var fs=require('fs');var path=require(_0x6709('0x4'));var rimraf=require(_0x6709('0x5'));var config=require(_0x6709('0x6'));var attributes=require(_0x6709('0x7'));module[_0x6709('0x8')]=function(_0x9d630f,_0xa35832){return _0x9d630f[_0x6709('0x9')](_0x6709('0xa'),attributes,{'tableName':_0x6709('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x71ab=['exports','define','UserSmsQueue','user_has_sms_queues','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes'];(function(_0x1b8bd4,_0x4273a7){var _0x3cf8e3=function(_0x14d15d){while(--_0x14d15d){_0x1b8bd4['push'](_0x1b8bd4['shift']());}};_0x3cf8e3(++_0x4273a7);}(_0x71ab,0x64));var _0xb71a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x71ab[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xb71a('0x0'));var logger=require('../../config/logger')(_0xb71a('0x1'));var moment=require('moment');var BPromise=require(_0xb71a('0x2'));var rp=require(_0xb71a('0x3'));var fs=require('fs');var path=require(_0xb71a('0x4'));var rimraf=require(_0xb71a('0x5'));var config=require(_0xb71a('0x6'));var attributes=require(_0xb71a('0x7'));module[_0xb71a('0x8')]=function(_0x38d931,_0x22c072){return _0x38d931[_0xb71a('0x9')](_0xb71a('0xa'),attributes,{'tableName':_0xb71a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 3e3453c..6c599be 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 _0x52c9=['client','http','request','info','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserSmsQueue,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x8b1d6d,_0x3d088e){var _0x47e267=function(_0x346bb){while(--_0x346bb){_0x8b1d6d['push'](_0x8b1d6d['shift']());}};_0x47e267(++_0x3d088e);}(_0x52c9,0xdc));var _0x952c=function(_0x2f5cf6,_0x254474){_0x2f5cf6=_0x2f5cf6-0x0;var _0x68e2ce=_0x52c9[_0x2f5cf6];return _0x68e2ce;};'use strict';var _=require(_0x952c('0x0'));var util=require(_0x952c('0x1'));var moment=require(_0x952c('0x2'));var BPromise=require(_0x952c('0x3'));var rs=require(_0x952c('0x4'));var fs=require('fs');var Redis=require(_0x952c('0x5'));var db=require(_0x952c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x952c('0x7'))(_0x952c('0x8'));var config=require(_0x952c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x952c('0xa')][_0x952c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4aba9d,_0x46116c,_0x4e2f14){return new BPromise(function(_0x47c5c1,_0x3158b8){return client[_0x952c('0xc')](_0x4aba9d,_0x4e2f14)['then'](function(_0x58a040){logger[_0x952c('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x46116c,_0x952c('0xe'));logger[_0x952c('0xf')](_0x952c('0x10'),_0x46116c,_0x952c('0xe'),JSON[_0x952c('0x11')](_0x58a040));if(_0x58a040[_0x952c('0x12')]){if(_0x58a040[_0x952c('0x12')][_0x952c('0x13')]===0x1f4){logger[_0x952c('0x12')](_0x952c('0x14'),_0x46116c,_0x58a040[_0x952c('0x12')][_0x952c('0x15')]);return _0x3158b8(_0x58a040[_0x952c('0x12')]['message']);}logger[_0x952c('0x12')](_0x952c('0x14'),_0x46116c,_0x58a040[_0x952c('0x12')][_0x952c('0x15')]);return _0x47c5c1(_0x58a040[_0x952c('0x12')]['message']);}else{logger[_0x952c('0xd')](_0x952c('0x14'),_0x46116c,_0x952c('0xe'));_0x47c5c1(_0x58a040['result'][_0x952c('0x15')]);}})[_0x952c('0x16')](function(_0x7a6bf7){logger[_0x952c('0x12')](_0x952c('0x14'),_0x46116c,_0x7a6bf7);_0x3158b8(_0x7a6bf7);});});} \ No newline at end of file +var _0xb8cb=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result'];(function(_0x45ccf6,_0x187595){var _0x140e18=function(_0xf5582f){while(--_0xf5582f){_0x45ccf6['push'](_0x45ccf6['shift']());}};_0x140e18(++_0x187595);}(_0xb8cb,0x111));var _0xbb8c=function(_0x2161e5,_0x428880){_0x2161e5=_0x2161e5-0x0;var _0x8fcb8a=_0xb8cb[_0x2161e5];return _0x8fcb8a;};'use strict';var _=require(_0xbb8c('0x0'));var util=require(_0xbb8c('0x1'));var moment=require(_0xbb8c('0x2'));var BPromise=require(_0xbb8c('0x3'));var rs=require(_0xbb8c('0x4'));var fs=require('fs');var Redis=require(_0xbb8c('0x5'));var db=require(_0xbb8c('0x6'))['db'];var utils=require(_0xbb8c('0x7'));var logger=require(_0xbb8c('0x8'))(_0xbb8c('0x9'));var config=require('../../config/environment');var jayson=require(_0xbb8c('0xa'));var client=jayson[_0xbb8c('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1eea0f,_0x14af36,_0x36c5e9){return new BPromise(function(_0x5bbf13,_0x241cf6){return client['request'](_0x1eea0f,_0x36c5e9)[_0xbb8c('0xc')](function(_0x23637b){logger[_0xbb8c('0xd')](_0xbb8c('0xe'),_0x14af36,_0xbb8c('0xf'));logger[_0xbb8c('0x10')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x14af36,_0xbb8c('0xf'),JSON['stringify'](_0x23637b));if(_0x23637b[_0xbb8c('0x11')]){if(_0x23637b['error'][_0xbb8c('0x12')]===0x1f4){logger[_0xbb8c('0x11')](_0xbb8c('0xe'),_0x14af36,_0x23637b[_0xbb8c('0x11')][_0xbb8c('0x13')]);return _0x241cf6(_0x23637b[_0xbb8c('0x11')]['message']);}logger['error'](_0xbb8c('0xe'),_0x14af36,_0x23637b[_0xbb8c('0x11')][_0xbb8c('0x13')]);return _0x5bbf13(_0x23637b[_0xbb8c('0x11')][_0xbb8c('0x13')]);}else{logger[_0xbb8c('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x14af36,_0xbb8c('0xf'));_0x5bbf13(_0x23637b[_0xbb8c('0x14')][_0xbb8c('0x13')]);}})['catch'](function(_0x3899a8){logger['error'](_0xbb8c('0xe'),_0x14af36,_0x3899a8);_0x241cf6(_0x3899a8);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index a14e8b7..492a8a3 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x19037e,_0x352e32){var _0x38b385=function(_0x18363f){while(--_0x18363f){_0x19037e['push'](_0x19037e['shift']());}};_0x38b385(++_0x352e32);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x22026f,_0x1e4533){var _0xdd6962=function(_0xe096c9){while(--_0xe096c9){_0x22026f['push'](_0x22026f['shift']());}};_0xdd6962(++_0x1e4533);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index acd486b..d2ba5d6 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 _0x436c=['exports','INTEGER'];(function(_0x43ca6d,_0x931e7f){var _0x20536c=function(_0x2622f1){while(--_0x2622f1){_0x43ca6d['push'](_0x43ca6d['shift']());}};_0x20536c(++_0x931e7f);}(_0x436c,0x82));var _0xc436=function(_0x1dba4b,_0x384907){_0x1dba4b=_0x1dba4b-0x0;var _0xecae12=_0x436c[_0x1dba4b];return _0xecae12;};'use strict';var Sequelize=require('sequelize');module[_0xc436('0x0')]={'penalty':{'type':Sequelize[_0xc436('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xdacc=['sequelize','exports'];(function(_0x2dfc28,_0x422598){var _0x5a55fb=function(_0xa7f141){while(--_0xa7f141){_0x2dfc28['push'](_0x2dfc28['shift']());}};_0x5a55fb(++_0x422598);}(_0xdacc,0x1d0));var _0xcdac=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdacc[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xcdac('0x0'));module[_0xcdac('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 4ec4ac4..36b4ef9 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 _0x26fa=['define','user_has_voice_queues','lodash','util','../../config/logger','api','bluebird','../../config/environment','./userVoiceQueue.attributes','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x26fa,0xfc));var _0xa26f=function(_0x1962fa,_0x6e55fc){_0x1962fa=_0x1962fa-0x0;var _0x2acc3e=_0x26fa[_0x1962fa];return _0x2acc3e;};'use strict';var _=require(_0xa26f('0x0'));var util=require(_0xa26f('0x1'));var logger=require(_0xa26f('0x2'))(_0xa26f('0x3'));var moment=require('moment');var BPromise=require(_0xa26f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa26f('0x5'));var attributes=require(_0xa26f('0x6'));module[_0xa26f('0x7')]=function(_0x366570,_0x2e17b1){return _0x366570[_0xa26f('0x8')]('UserVoiceQueue',attributes,{'tableName':_0xa26f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb64=['bluebird','request-promise','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','../../config/logger','moment'];(function(_0x4d7cd8,_0x21ed3e){var _0xff49d1=function(_0x4e5606){while(--_0x4e5606){_0x4d7cd8['push'](_0x4d7cd8['shift']());}};_0xff49d1(++_0x21ed3e);}(_0xfb64,0x1dd));var _0x4fb6=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xfb64[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x4fb6('0x0'));var util=require('util');var logger=require(_0x4fb6('0x1'))('api');var moment=require(_0x4fb6('0x2'));var BPromise=require(_0x4fb6('0x3'));var rp=require(_0x4fb6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4fb6('0x5'));var config=require(_0x4fb6('0x6'));var attributes=require(_0x4fb6('0x7'));module[_0x4fb6('0x8')]=function(_0x111336,_0x3a42e5){return _0x111336[_0x4fb6('0x9')](_0x4fb6('0xa'),attributes,{'tableName':_0x4fb6('0xb'),'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 40d40bd..074dabe 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 _0x5c9e=['code','message','UserVoiceQueue,\x20%s,\x20%s','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x539fac,_0x4def01){var _0x2a1f20=function(_0x48b0e2){while(--_0x48b0e2){_0x539fac['push'](_0x539fac['shift']());}};_0x2a1f20(++_0x4def01);}(_0x5c9e,0x1e7));var _0xe5c9=function(_0x501a6f,_0x1f2980){_0x501a6f=_0x501a6f-0x0;var _0x557334=_0x5c9e[_0x501a6f];return _0x557334;};'use strict';var _=require(_0xe5c9('0x0'));var util=require(_0xe5c9('0x1'));var moment=require(_0xe5c9('0x2'));var BPromise=require('bluebird');var rs=require(_0xe5c9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe5c9('0x4'))['db'];var utils=require(_0xe5c9('0x5'));var logger=require(_0xe5c9('0x6'))(_0xe5c9('0x7'));var config=require(_0xe5c9('0x8'));var jayson=require(_0xe5c9('0x9'));var client=jayson['client'][_0xe5c9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x357bc7,_0x3b1f39,_0x7bcae6){return new BPromise(function(_0xc5777,_0x3919eb){return client['request'](_0x357bc7,_0x7bcae6)['then'](function(_0x2489de){logger[_0xe5c9('0xb')]('UserVoiceQueue,\x20%s,\x20%s',_0x3b1f39,_0xe5c9('0xc'));logger[_0xe5c9('0xd')](_0xe5c9('0xe'),_0x3b1f39,_0xe5c9('0xc'),JSON[_0xe5c9('0xf')](_0x2489de));if(_0x2489de[_0xe5c9('0x10')]){if(_0x2489de['error'][_0xe5c9('0x11')]===0x1f4){logger[_0xe5c9('0x10')]('UserVoiceQueue,\x20%s,\x20%s',_0x3b1f39,_0x2489de['error'][_0xe5c9('0x12')]);return _0x3919eb(_0x2489de[_0xe5c9('0x10')][_0xe5c9('0x12')]);}logger[_0xe5c9('0x10')](_0xe5c9('0x13'),_0x3b1f39,_0x2489de['error'][_0xe5c9('0x12')]);return _0xc5777(_0x2489de['error'][_0xe5c9('0x12')]);}else{logger[_0xe5c9('0xb')]('UserVoiceQueue,\x20%s,\x20%s',_0x3b1f39,_0xe5c9('0xc'));_0xc5777(_0x2489de['result']['message']);}})[_0xe5c9('0x14')](function(_0x400df0){logger[_0xe5c9('0x10')](_0xe5c9('0x13'),_0x3b1f39,_0x400df0);_0x3919eb(_0x400df0);});});} \ No newline at end of file +var _0x834f=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','http','request','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','lodash'];(function(_0x3f0f93,_0x21016d){var _0x4ab816=function(_0x31d9a4){while(--_0x31d9a4){_0x3f0f93['push'](_0x3f0f93['shift']());}};_0x4ab816(++_0x21016d);}(_0x834f,0x18b));var _0xf834=function(_0x3b5acc,_0x41aa20){_0x3b5acc=_0x3b5acc-0x0;var _0x36f25d=_0x834f[_0x3b5acc];return _0x36f25d;};'use strict';var _=require(_0xf834('0x0'));var util=require(_0xf834('0x1'));var moment=require('moment');var BPromise=require(_0xf834('0x2'));var rs=require(_0xf834('0x3'));var fs=require('fs');var Redis=require(_0xf834('0x4'));var db=require(_0xf834('0x5'))['db'];var utils=require(_0xf834('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xf834('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf834('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1e141d,_0x4113d5,_0xd4997){return new BPromise(function(_0x15541c,_0x211453){return client[_0xf834('0x9')](_0x1e141d,_0xd4997)['then'](function(_0x3f634f){logger[_0xf834('0xa')](_0xf834('0xb'),_0x4113d5,_0xf834('0xc'));logger['debug']('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x4113d5,_0xf834('0xc'),JSON[_0xf834('0xd')](_0x3f634f));if(_0x3f634f['error']){if(_0x3f634f['error'][_0xf834('0xe')]===0x1f4){logger[_0xf834('0xf')](_0xf834('0xb'),_0x4113d5,_0x3f634f[_0xf834('0xf')][_0xf834('0x10')]);return _0x211453(_0x3f634f[_0xf834('0xf')][_0xf834('0x10')]);}logger[_0xf834('0xf')](_0xf834('0xb'),_0x4113d5,_0x3f634f[_0xf834('0xf')][_0xf834('0x10')]);return _0x15541c(_0x3f634f[_0xf834('0xf')][_0xf834('0x10')]);}else{logger['info'](_0xf834('0xb'),_0x4113d5,_0xf834('0xc'));_0x15541c(_0x3f634f['result'][_0xf834('0x10')]);}})[_0xf834('0x11')](function(_0xca6d3){logger['error'](_0xf834('0xb'),_0x4113d5,_0xca6d3);_0x211453(_0xca6d3);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 4e3bbf4..3c9434a 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x2706b7,_0x8c4f4c){var _0x5f09c9=function(_0x42d233){while(--_0x42d233){_0x2706b7['push'](_0x2706b7['shift']());}};_0x5f09c9(++_0x8c4f4c);}(_0xe706,0xa3));var _0x6e70=function(_0x283952,_0x442596){_0x283952=_0x283952-0x0;var _0x57bb99=_0xe706[_0x283952];return _0x57bb99;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x20dd9b,_0x3c0fb8){var _0x2de3b0=function(_0x5673d2){while(--_0x5673d2){_0x20dd9b['push'](_0x20dd9b['shift']());}};_0x2de3b0(++_0x3c0fb8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 090e7c9..e898ddc 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 _0x687f=['exports','Required\x20by\x20Asterisk','STRING','INTEGER','queue_interface','sequelize'];(function(_0x48694f,_0x44690e){var _0x28aeb0=function(_0x205204){while(--_0x205204){_0x48694f['push'](_0x48694f['shift']());}};_0x28aeb0(++_0x44690e);}(_0x687f,0x113));var _0xf687=function(_0xf89c3,_0x351bf1){_0xf89c3=_0xf89c3-0x0;var _0x274fc8=_0x687f[_0xf89c3];return _0x274fc8;};'use strict';var Sequelize=require(_0xf687('0x0'));module[_0xf687('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0xf687('0x2')},'membername':{'type':Sequelize[_0xf687('0x3')],'allowNull':![],'comment':_0xf687('0x2')},'UserId':{'type':Sequelize[_0xf687('0x4')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xf687('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0xf687('0x2')},'VoiceQueueId':{'type':Sequelize[_0xf687('0x4')],'allowNull':![]},'interface':{'type':Sequelize[_0xf687('0x3')],'allowNull':![],'unique':_0xf687('0x5'),'comment':_0xf687('0x2')},'penalty':{'type':Sequelize[_0xf687('0x4')](0xb),'defaultValue':0x0,'comment':_0xf687('0x2')},'paused':{'type':Sequelize[_0xf687('0x4')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0x3cf5=['exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x3cf5,0x1a3));var _0x53cf=function(_0x5bf18d,_0x264c55){_0x5bf18d=_0x5bf18d-0x0;var _0x1d6cc0=_0x3cf5[_0x5bf18d];return _0x1d6cc0;};'use strict';var Sequelize=require(_0x53cf('0x0'));module[_0x53cf('0x1')]={'uniqueid':{'type':Sequelize[_0x53cf('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x53cf('0x3')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x53cf('0x3')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x53cf('0x4')],'allowNull':![],'unique':_0x53cf('0x5'),'comment':_0x53cf('0x3')},'VoiceQueueId':{'type':Sequelize[_0x53cf('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x53cf('0x4')],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x53cf('0x3')},'paused':{'type':Sequelize[_0x53cf('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 695f1ae..46e39d9 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 _0xb231=['events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x4463c9,_0x1778d7){var _0x843847=function(_0xe7b570){while(--_0xe7b570){_0x4463c9['push'](_0x4463c9['shift']());}};_0x843847(++_0x1778d7);}(_0xb231,0xe7));var _0x1b23=function(_0x3e6c73,_0x39168a){_0x3e6c73=_0x3e6c73-0x0;var _0x597672=_0xb231[_0x3e6c73];return _0x597672;};'use strict';var EventEmitter=require(_0x1b23('0x0'));var UserVoiceQueueRt=require(_0x1b23('0x1'))['db'][_0x1b23('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x1b23('0x3')](0x0);var events={'afterCreate':_0x1b23('0x4'),'afterUpdate':_0x1b23('0x5'),'afterDestroy':_0x1b23('0x6')};function emitEvent(_0x1fe8c1){return function(_0x47f043,_0x42671b,_0x3a435b){UserVoiceQueueRtEvents[_0x1b23('0x7')](_0x1fe8c1+':'+_0x47f043['id'],_0x47f043);UserVoiceQueueRtEvents[_0x1b23('0x7')](_0x1fe8c1,_0x47f043);_0x3a435b(null);};}for(var e in events){if(events[_0x1b23('0x8')](e)){var event=events[e];UserVoiceQueueRt[_0x1b23('0x9')](e,emitEvent(event));}}module[_0x1b23('0xa')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x7469=['exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x58321f,_0x5730b9){var _0x3728ea=function(_0x53e4ac){while(--_0x53e4ac){_0x58321f['push'](_0x58321f['shift']());}};_0x3728ea(++_0x5730b9);}(_0x7469,0x10f));var _0x9746=function(_0x1b4d9d,_0x51f7e4){_0x1b4d9d=_0x1b4d9d-0x0;var _0x2c4b7e=_0x7469[_0x1b4d9d];return _0x2c4b7e;};'use strict';var EventEmitter=require(_0x9746('0x0'));var UserVoiceQueueRt=require(_0x9746('0x1'))['db'][_0x9746('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x9746('0x3')](0x0);var events={'afterCreate':_0x9746('0x4'),'afterUpdate':_0x9746('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4b623c){return function(_0x512b52,_0x3b9135,_0x3ec874){UserVoiceQueueRtEvents['emit'](_0x4b623c+':'+_0x512b52['id'],_0x512b52);UserVoiceQueueRtEvents[_0x9746('0x6')](_0x4b623c,_0x512b52);_0x3ec874(null);};}for(var e in events){if(events[_0x9746('0x7')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0x9746('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 8834609..130d128 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 _0x4390=['UserVoiceQueueRt','user_has_voice_queues_rt','lodash','moment','request-promise','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports'];(function(_0x443e72,_0x50737f){var _0x87c5e2=function(_0x58c87b){while(--_0x58c87b){_0x443e72['push'](_0x443e72['shift']());}};_0x87c5e2(++_0x50737f);}(_0x4390,0x6e));var _0x0439=function(_0x31d4c3,_0x26b370){_0x31d4c3=_0x31d4c3-0x0;var _0x5dcfe1=_0x4390[_0x31d4c3];return _0x5dcfe1;};'use strict';var _=require(_0x0439('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x0439('0x1'));var BPromise=require('bluebird');var rp=require(_0x0439('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0439('0x3'));var config=require(_0x0439('0x4'));var attributes=require(_0x0439('0x5'));module[_0x0439('0x6')]=function(_0x2bed52,_0x1aea17){return _0x2bed52['define'](_0x0439('0x7'),attributes,{'tableName':_0x0439('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd5f3=['path','../../config/environment','./userVoiceQueueRt.attributes','exports','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','api','moment','bluebird','request-promise'];(function(_0x3dfc8d,_0xe7f3a4){var _0x23b588=function(_0x18c864){while(--_0x18c864){_0x3dfc8d['push'](_0x3dfc8d['shift']());}};_0x23b588(++_0xe7f3a4);}(_0xd5f3,0x102));var _0x3d5f=function(_0x1132d1,_0xca8eda){_0x1132d1=_0x1132d1-0x0;var _0x37fb46=_0xd5f3[_0x1132d1];return _0x37fb46;};'use strict';var _=require(_0x3d5f('0x0'));var util=require(_0x3d5f('0x1'));var logger=require('../../config/logger')(_0x3d5f('0x2'));var moment=require(_0x3d5f('0x3'));var BPromise=require(_0x3d5f('0x4'));var rp=require(_0x3d5f('0x5'));var fs=require('fs');var path=require(_0x3d5f('0x6'));var rimraf=require('rimraf');var config=require(_0x3d5f('0x7'));var attributes=require(_0x3d5f('0x8'));module[_0x3d5f('0x9')]=function(_0x429eed,_0x9c6e6e){return _0x429eed['define'](_0x3d5f('0xa'),attributes,{'tableName':_0x3d5f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index d23dbaa..931deff 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 _0x9af8=['options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','GetVoiceQueueRtPauses','stringify','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','redis','defaults','socket.io-emitter','./userVoiceQueueRt.socket','register','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','message','catch','UserVoiceQueueRt','findAll'];(function(_0x565743,_0x2b2dcd){var _0x45b852=function(_0x1d981c){while(--_0x1d981c){_0x565743['push'](_0x565743['shift']());}};_0x45b852(++_0x2b2dcd);}(_0x9af8,0xbe));var _0x89af=function(_0x440139,_0x26412e){_0x440139=_0x440139-0x0;var _0x3a469b=_0x9af8[_0x440139];return _0x3a469b;};'use strict';var _=require(_0x89af('0x0'));var util=require(_0x89af('0x1'));var moment=require('moment');var BPromise=require(_0x89af('0x2'));var rs=require(_0x89af('0x3'));var fs=require('fs');var Redis=require(_0x89af('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x89af('0x5'))(_0x89af('0x6'));var config=require(_0x89af('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x89af('0x8')]['http']({'port':0x232a});config[_0x89af('0x9')]=_[_0x89af('0xa')](config[_0x89af('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x89af('0xb'))(new Redis(config[_0x89af('0x9')]));require(_0x89af('0xc'))[_0x89af('0xd')](socket);function respondWithRpcPromise(_0x4f99c4,_0x345216,_0x436aae){return new BPromise(function(_0xefcc4c,_0x1edd01){return client['request'](_0x4f99c4,_0x436aae)[_0x89af('0xe')](function(_0x414ce9){logger[_0x89af('0xf')](_0x89af('0x10'),_0x345216,_0x89af('0x11'));logger[_0x89af('0x12')](_0x89af('0x13'),_0x345216,_0x89af('0x11'),JSON['stringify'](_0x414ce9));if(_0x414ce9['error']){if(_0x414ce9[_0x89af('0x14')][_0x89af('0x15')]===0x1f4){logger[_0x89af('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x345216,_0x414ce9[_0x89af('0x14')][_0x89af('0x16')]);return _0x1edd01(_0x414ce9[_0x89af('0x14')][_0x89af('0x16')]);}logger['error'](_0x89af('0x10'),_0x345216,_0x414ce9[_0x89af('0x14')][_0x89af('0x16')]);return _0xefcc4c(_0x414ce9[_0x89af('0x14')][_0x89af('0x16')]);}else{logger[_0x89af('0xf')](_0x89af('0x10'),_0x345216,'request\x20sent');_0xefcc4c(_0x414ce9['result'][_0x89af('0x16')]);}})[_0x89af('0x17')](function(_0x5332e5){logger['error'](_0x89af('0x10'),_0x345216,_0x5332e5);_0x1edd01(_0x5332e5);});});}exports['GetVoiceQueueRtPauses']=function(_0x458d55){var _0x23873c=this;return new Promise(function(_0x3e7644,_0x5f06e4){return db[_0x89af('0x18')][_0x89af('0x19')]({'raw':_0x458d55[_0x89af('0x1a')]?_0x458d55[_0x89af('0x1a')][_0x89af('0x1b')]===undefined?!![]:![]:!![],'where':_0x458d55[_0x89af('0x1a')]?_0x458d55['options'][_0x89af('0x1c')]||null:null,'attributes':[[db[_0x89af('0x1d')]['fn'](_0x89af('0x1e'),db['sequelize']['fn']('IF',db[_0x89af('0x1d')][_0x89af('0x1f')](_0x89af('0x20')))),_0x89af('0x21')]]})[_0x89af('0xe')](function(_0x596473){logger[_0x89af('0xf')](_0x89af('0x22'),_0x458d55);logger[_0x89af('0x12')](_0x89af('0x22'),_0x458d55,JSON[_0x89af('0x23')](_0x596473));_0x3e7644(_0x596473);})[_0x89af('0x17')](function(_0x53efc0){logger[_0x89af('0x14')](_0x89af('0x22'),_0x53efc0[_0x89af('0x16')],_0x458d55);_0x5f06e4(_0x23873c[_0x89af('0x14')](0x1f4,_0x53efc0['message']));});});}; \ No newline at end of file +var _0x7087=['result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','COUNT','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5e5dfc,_0x15028e){var _0x562c04=function(_0x172531){while(--_0x172531){_0x5e5dfc['push'](_0x5e5dfc['shift']());}};_0x562c04(++_0x15028e);}(_0x7087,0xe9));var _0x7708=function(_0x427695,_0x2d826e){_0x427695=_0x427695-0x0;var _0x56b4f0=_0x7087[_0x427695];return _0x56b4f0;};'use strict';var _=require(_0x7708('0x0'));var util=require('util');var moment=require(_0x7708('0x1'));var BPromise=require(_0x7708('0x2'));var rs=require(_0x7708('0x3'));var fs=require('fs');var Redis=require(_0x7708('0x4'));var db=require(_0x7708('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7708('0x6'))('rpc');var config=require(_0x7708('0x7'));var jayson=require(_0x7708('0x8'));var client=jayson['client'][_0x7708('0x9')]({'port':0x232a});config[_0x7708('0xa')]=_[_0x7708('0xb')](config['redis'],{'host':_0x7708('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7708('0xd'))[_0x7708('0xe')](socket);function respondWithRpcPromise(_0x3cd5cc,_0x2d9797,_0x2d1698){return new BPromise(function(_0x46d1f6,_0x20c91b){return client[_0x7708('0xf')](_0x3cd5cc,_0x2d1698)[_0x7708('0x10')](function(_0x505db2){logger[_0x7708('0x11')](_0x7708('0x12'),_0x2d9797,_0x7708('0x13'));logger[_0x7708('0x14')](_0x7708('0x15'),_0x2d9797,_0x7708('0x13'),JSON[_0x7708('0x16')](_0x505db2));if(_0x505db2[_0x7708('0x17')]){if(_0x505db2[_0x7708('0x17')][_0x7708('0x18')]===0x1f4){logger[_0x7708('0x17')](_0x7708('0x12'),_0x2d9797,_0x505db2[_0x7708('0x17')][_0x7708('0x19')]);return _0x20c91b(_0x505db2['error'][_0x7708('0x19')]);}logger[_0x7708('0x17')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x2d9797,_0x505db2[_0x7708('0x17')][_0x7708('0x19')]);return _0x46d1f6(_0x505db2[_0x7708('0x17')][_0x7708('0x19')]);}else{logger[_0x7708('0x11')](_0x7708('0x12'),_0x2d9797,_0x7708('0x13'));_0x46d1f6(_0x505db2[_0x7708('0x1a')][_0x7708('0x19')]);}})[_0x7708('0x1b')](function(_0x15759e){logger[_0x7708('0x17')](_0x7708('0x12'),_0x2d9797,_0x15759e);_0x20c91b(_0x15759e);});});}exports[_0x7708('0x1c')]=function(_0x380b8b){var _0x1740d3=this;return new Promise(function(_0x3aaee3,_0x1199d8){return db[_0x7708('0x1d')][_0x7708('0x1e')]({'raw':_0x380b8b[_0x7708('0x1f')]?_0x380b8b['options'][_0x7708('0x20')]===undefined?!![]:![]:!![],'where':_0x380b8b[_0x7708('0x1f')]?_0x380b8b[_0x7708('0x1f')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0x7708('0x21'),db[_0x7708('0x22')]['fn']('IF',db[_0x7708('0x22')][_0x7708('0x23')](_0x7708('0x24')))),'outboundQueuePauses']]})['then'](function(_0x5d354b){logger[_0x7708('0x11')](_0x7708('0x1c'),_0x380b8b);logger[_0x7708('0x14')](_0x7708('0x1c'),_0x380b8b,JSON[_0x7708('0x16')](_0x5d354b));_0x3aaee3(_0x5d354b);})[_0x7708('0x1b')](function(_0x2f6d5b){logger[_0x7708('0x17')](_0x7708('0x1c'),_0x2f6d5b['message'],_0x380b8b);_0x1199d8(_0x1740d3[_0x7708('0x17')](0x1f4,_0x2f6d5b[_0x7708('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index d1f80ee..a4460db 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 _0x8d0a=['remove','update','emit','removeListener','length','./userVoiceQueueRt.events'];(function(_0x11599d,_0xaa9019){var _0x115ab6=function(_0x3b6a6b){while(--_0x3b6a6b){_0x11599d['push'](_0x11599d['shift']());}};_0x115ab6(++_0xaa9019);}(_0x8d0a,0x65));var _0xa8d0=function(_0x22f686,_0x5e6394){_0x22f686=_0x22f686-0x0;var _0x26d25d=_0x8d0a[_0x22f686];return _0x26d25d;};'use strict';var UserVoiceQueueRtEvents=require(_0xa8d0('0x0'));var events=['save',_0xa8d0('0x1'),_0xa8d0('0x2')];function createListener(_0x1e83ea,_0x10995c){return function(_0x6ec9e7){_0x10995c[_0xa8d0('0x3')](_0x1e83ea,_0x6ec9e7);};}function removeListener(_0x528287,_0x202833){return function(){UserVoiceQueueRtEvents[_0xa8d0('0x4')](_0x528287,_0x202833);};}exports['register']=function(_0x1cac4f){for(var _0x212aaf=0x0,_0x1f95a7=events[_0xa8d0('0x5')];_0x212aaf<_0x1f95a7;_0x212aaf++){var _0x3ee6b4=events[_0x212aaf];var _0x55ffc0=createListener('userVoiceQueueRt:'+_0x3ee6b4,_0x1cac4f);UserVoiceQueueRtEvents['on'](_0x3ee6b4,_0x55ffc0);}}; \ No newline at end of file +var _0x1d7e=['remove','update','emit','removeListener','register','length','save'];(function(_0x1bb1aa,_0x38a53a){var _0x3686c4=function(_0x45c095){while(--_0x45c095){_0x1bb1aa['push'](_0x1bb1aa['shift']());}};_0x3686c4(++_0x38a53a);}(_0x1d7e,0x7d));var _0xe1d7=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x1d7e[_0x187ee1];return _0x388160;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0xe1d7('0x0'),_0xe1d7('0x1'),_0xe1d7('0x2')];function createListener(_0x47c24f,_0x141274){return function(_0x4c39bd){_0x141274[_0xe1d7('0x3')](_0x47c24f,_0x4c39bd);};}function removeListener(_0x118bc6,_0x354906){return function(){UserVoiceQueueRtEvents[_0xe1d7('0x4')](_0x118bc6,_0x354906);};}exports[_0xe1d7('0x5')]=function(_0x4058fe){for(var _0x252026=0x0,_0x867e5=events[_0xe1d7('0x6')];_0x252026<_0x867e5;_0x252026++){var _0x439ffd=events[_0x252026];var _0x3f1859=createListener('userVoiceQueueRt:'+_0x439ffd,_0x4058fe);UserVoiceQueueRtEvents['on'](_0x439ffd,_0x3f1859);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 5b88b3f..64bbe96 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x199980,_0x343207){var _0x1ac163=function(_0x582ce9){while(--_0x582ce9){_0x199980['push'](_0x199980['shift']());}};_0x1ac163(++_0x343207);}(_0x70e0,0x17b));var _0x070e=function(_0x43b7fe,_0x11b6bc){_0x43b7fe=_0x43b7fe-0x0;var _0xfb746c=_0x70e0[_0x43b7fe];return _0xfb746c;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x3bca19,_0x498388){var _0x417009=function(_0x51a8c6){while(--_0x51a8c6){_0x3bca19['push'](_0x3bca19['shift']());}};_0x417009(++_0x498388);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 9006424..82b14af 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. * // * * // ************************************************************************* -'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x14ac=['INTEGER','sequelize'];(function(_0x12dbaf,_0x505476){var _0x1dbf3d=function(_0x2a92a6){while(--_0x2a92a6){_0x12dbaf['push'](_0x12dbaf['shift']());}};_0x1dbf3d(++_0x505476);}(_0x14ac,0x9d));var _0xc14a=function(_0xa82c60,_0x3f05bf){_0xa82c60=_0xa82c60-0x0;var _0x291fef=_0x14ac[_0xa82c60];return _0x291fef;};'use strict';var Sequelize=require(_0xc14a('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xc14a('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index b28a733..90039e3 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 _0x1f78=['./userWhatsappQueue.attributes','exports','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','bluebird','request-promise','path','../../config/environment'];(function(_0x1af464,_0x581f4b){var _0x10838a=function(_0x39d166){while(--_0x39d166){_0x1af464['push'](_0x1af464['shift']());}};_0x10838a(++_0x581f4b);}(_0x1f78,0xae));var _0x81f7=function(_0x16620d,_0x14319f){_0x16620d=_0x16620d-0x0;var _0x561fc8=_0x1f78[_0x16620d];return _0x561fc8;};'use strict';var _=require(_0x81f7('0x0'));var util=require(_0x81f7('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x81f7('0x2'));var rp=require(_0x81f7('0x3'));var fs=require('fs');var path=require(_0x81f7('0x4'));var rimraf=require('rimraf');var config=require(_0x81f7('0x5'));var attributes=require(_0x81f7('0x6'));module[_0x81f7('0x7')]=function(_0x3e07da,_0x39f2fe){return _0x3e07da['define'](_0x81f7('0x8'),attributes,{'tableName':_0x81f7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x11a3=['path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','user_has_whatsapp_queues','lodash','api','moment','bluebird','request-promise'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x11a3,0x103));var _0x311a=function(_0x3e6d5d,_0x264c7a){_0x3e6d5d=_0x3e6d5d-0x0;var _0x238923=_0x11a3[_0x3e6d5d];return _0x238923;};'use strict';var _=require(_0x311a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x311a('0x1'));var moment=require(_0x311a('0x2'));var BPromise=require(_0x311a('0x3'));var rp=require(_0x311a('0x4'));var fs=require('fs');var path=require(_0x311a('0x5'));var rimraf=require(_0x311a('0x6'));var config=require(_0x311a('0x7'));var attributes=require(_0x311a('0x8'));module[_0x311a('0x9')]=function(_0x58bb16,_0x2ce328){return _0x58bb16[_0x311a('0xa')]('UserWhatsappQueue',attributes,{'tableName':_0x311a('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 6f3f58d..e4fdbb2 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 _0xe3c0=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','UserWhatsappQueue,\x20%s,\x20%s','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils'];(function(_0x319402,_0x90dd39){var _0x4dd72a=function(_0x1e39d0){while(--_0x1e39d0){_0x319402['push'](_0x319402['shift']());}};_0x4dd72a(++_0x90dd39);}(_0xe3c0,0x1de));var _0x0e3c=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0xe3c0[_0x5608a3];return _0x1ed50a;};'use strict';var _=require(_0x0e3c('0x0'));var util=require(_0x0e3c('0x1'));var moment=require(_0x0e3c('0x2'));var BPromise=require('bluebird');var rs=require(_0x0e3c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0e3c('0x4'))['db'];var utils=require(_0x0e3c('0x5'));var logger=require(_0x0e3c('0x6'))(_0x0e3c('0x7'));var config=require(_0x0e3c('0x8'));var jayson=require(_0x0e3c('0x9'));var client=jayson[_0x0e3c('0xa')][_0x0e3c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x484ce8,_0x487c6e,_0x2e70f6){return new BPromise(function(_0x1844e1,_0x282458){return client[_0x0e3c('0xc')](_0x484ce8,_0x2e70f6)['then'](function(_0x42ae08){logger['info'](_0x0e3c('0xd'),_0x487c6e,'request\x20sent');logger[_0x0e3c('0xe')](_0x0e3c('0xf'),_0x487c6e,_0x0e3c('0x10'),JSON[_0x0e3c('0x11')](_0x42ae08));if(_0x42ae08[_0x0e3c('0x12')]){if(_0x42ae08[_0x0e3c('0x12')]['code']===0x1f4){logger[_0x0e3c('0x12')](_0x0e3c('0xd'),_0x487c6e,_0x42ae08[_0x0e3c('0x12')][_0x0e3c('0x13')]);return _0x282458(_0x42ae08['error'][_0x0e3c('0x13')]);}logger[_0x0e3c('0x12')]('UserWhatsappQueue,\x20%s,\x20%s',_0x487c6e,_0x42ae08[_0x0e3c('0x12')][_0x0e3c('0x13')]);return _0x1844e1(_0x42ae08[_0x0e3c('0x12')]['message']);}else{logger[_0x0e3c('0x14')](_0x0e3c('0xd'),_0x487c6e,'request\x20sent');_0x1844e1(_0x42ae08['result'][_0x0e3c('0x13')]);}})[_0x0e3c('0x15')](function(_0x1c25b2){logger[_0x0e3c('0x12')](_0x0e3c('0xd'),_0x487c6e,_0x1c25b2);_0x282458(_0x1c25b2);});});} \ No newline at end of file +var _0xae0b=['../../config/environment','jayson/promise','http','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3da832,_0x2133f1){var _0xe602f2=function(_0xb7b2f){while(--_0xb7b2f){_0x3da832['push'](_0x3da832['shift']());}};_0xe602f2(++_0x2133f1);}(_0xae0b,0xff));var _0xbae0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xae0b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xbae0('0x0'));var moment=require(_0xbae0('0x1'));var BPromise=require(_0xbae0('0x2'));var rs=require(_0xbae0('0x3'));var fs=require('fs');var Redis=require(_0xbae0('0x4'));var db=require(_0xbae0('0x5'))['db'];var utils=require(_0xbae0('0x6'));var logger=require(_0xbae0('0x7'))(_0xbae0('0x8'));var config=require(_0xbae0('0x9'));var jayson=require(_0xbae0('0xa'));var client=jayson['client'][_0xbae0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2356f2,_0x934028,_0x9f1a7c){return new BPromise(function(_0x27c1e1,_0x33668b){return client['request'](_0x2356f2,_0x9f1a7c)[_0xbae0('0xc')](function(_0x2a2a28){logger[_0xbae0('0xd')](_0xbae0('0xe'),_0x934028,_0xbae0('0xf'));logger['debug'](_0xbae0('0x10'),_0x934028,_0xbae0('0xf'),JSON[_0xbae0('0x11')](_0x2a2a28));if(_0x2a2a28[_0xbae0('0x12')]){if(_0x2a2a28[_0xbae0('0x12')][_0xbae0('0x13')]===0x1f4){logger['error'](_0xbae0('0xe'),_0x934028,_0x2a2a28[_0xbae0('0x12')][_0xbae0('0x14')]);return _0x33668b(_0x2a2a28[_0xbae0('0x12')]['message']);}logger[_0xbae0('0x12')](_0xbae0('0xe'),_0x934028,_0x2a2a28[_0xbae0('0x12')]['message']);return _0x27c1e1(_0x2a2a28[_0xbae0('0x12')][_0xbae0('0x14')]);}else{logger[_0xbae0('0xd')](_0xbae0('0xe'),_0x934028,_0xbae0('0xf'));_0x27c1e1(_0x2a2a28[_0xbae0('0x15')][_0xbae0('0x14')]);}})['catch'](function(_0x126bfb){logger[_0xbae0('0x12')](_0xbae0('0xe'),_0x934028,_0x126bfb);_0x33668b(_0x126bfb);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index e96284f..d3f5b66 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 _0x9b9b=['show','post','update','destroy','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id'];(function(_0x5da83d,_0x3815bb){var _0x67238=function(_0xd95650){while(--_0xd95650){_0x5da83d['push'](_0x5da83d['shift']());}};_0x67238(++_0x3815bb);}(_0x9b9b,0x114));var _0xb9b9=function(_0x13a9d4,_0x165963){_0x13a9d4=_0x13a9d4-0x0;var _0x911f0f=_0x9b9b[_0x13a9d4];return _0x911f0f;};'use strict';var multer=require('multer');var util=require(_0xb9b9('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb9b9('0x1'));var router=express[_0xb9b9('0x2')]();var fs_extra=require(_0xb9b9('0x3'));var auth=require(_0xb9b9('0x4'));var interaction=require(_0xb9b9('0x5'));var config=require(_0xb9b9('0x6'));var controller=require(_0xb9b9('0x7'));router[_0xb9b9('0x8')]('/',auth[_0xb9b9('0x9')](),controller[_0xb9b9('0xa')]);router[_0xb9b9('0x8')](_0xb9b9('0xb'),auth[_0xb9b9('0x9')](),controller[_0xb9b9('0xc')]);router[_0xb9b9('0xd')]('/',auth[_0xb9b9('0x9')](),controller['create']);router['put'](_0xb9b9('0xb'),auth[_0xb9b9('0x9')](),controller[_0xb9b9('0xe')]);router['delete'](_0xb9b9('0xb'),auth[_0xb9b9('0x9')](),controller[_0xb9b9('0xf')]);module['exports']=router; \ No newline at end of file +var _0x4584=['delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x1954ba,_0x142730){var _0x432c9f=function(_0x5a2687){while(--_0x5a2687){_0x1954ba['push'](_0x1954ba['shift']());}};_0x432c9f(++_0x142730);}(_0x4584,0x1cf));var _0x4458=function(_0x5cf6eb,_0x5be218){_0x5cf6eb=_0x5cf6eb-0x0;var _0x5489c2=_0x4584[_0x5cf6eb];return _0x5489c2;};'use strict';var multer=require(_0x4458('0x0'));var util=require('util');var path=require(_0x4458('0x1'));var timeout=require(_0x4458('0x2'));var express=require(_0x4458('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4458('0x4'));var interaction=require(_0x4458('0x5'));var config=require(_0x4458('0x6'));var controller=require(_0x4458('0x7'));router[_0x4458('0x8')]('/',auth[_0x4458('0x9')](),controller[_0x4458('0xa')]);router[_0x4458('0x8')](_0x4458('0xb'),auth['isAuthenticated'](),controller[_0x4458('0xc')]);router[_0x4458('0xd')]('/',auth[_0x4458('0x9')](),controller[_0x4458('0xe')]);router[_0x4458('0xf')](_0x4458('0xb'),auth[_0x4458('0x9')](),controller[_0x4458('0x10')]);router[_0x4458('0x11')]('/:id',auth[_0x4458('0x9')](),controller[_0x4458('0x12')]);module[_0x4458('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 04779ee..130f306 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 _0x24f5=['exports','STRING','sequelize'];(function(_0x5d734a,_0x575b21){var _0x2dd447=function(_0x206155){while(--_0x206155){_0x5d734a['push'](_0x5d734a['shift']());}};_0x2dd447(++_0x575b21);}(_0x24f5,0x1ee));var _0x524f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x24f5[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x524f('0x0'));module[_0x524f('0x1')]={'name':{'type':Sequelize[_0x524f('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x21ca=['exports','STRING'];(function(_0x52dd48,_0x12f911){var _0x15f323=function(_0x53ada7){while(--_0x53ada7){_0x52dd48['push'](_0x52dd48['shift']());}};_0x15f323(++_0x12f911);}(_0x21ca,0x14e));var _0xa21c=function(_0x137aeb,_0x399a0b){_0x137aeb=_0x137aeb-0x0;var _0x424aed=_0x21ca[_0x137aeb];return _0x424aed;};'use strict';var Sequelize=require('sequelize');module[_0xa21c('0x0')]={'name':{'type':Sequelize[_0xa21c('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa21c('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 46408c5..4af0172 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 _0x9be4=['desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','limit','undefined','count','offset','apply','save','update','then','destroy','get','Variables','UserProfileResource','error','stack','name','send','index','map','Variable','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce'];(function(_0x5dfd38,_0xa5a0b3){var _0x79facf=function(_0x47f627){while(--_0x47f627){_0x5dfd38['push'](_0x5dfd38['shift']());}};_0x79facf(++_0xa5a0b3);}(_0x9be4,0x9b));var _0x49be=function(_0xd84cb6,_0x55ed79){_0xd84cb6=_0xd84cb6-0x0;var _0x27cff1=_0x9be4[_0xd84cb6];return _0x27cff1;};'use strict';var emlformat=require(_0x49be('0x0'));var rimraf=require(_0x49be('0x1'));var zipdir=require(_0x49be('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x49be('0x3'));var moment=require('moment');var BPromise=require(_0x49be('0x4'));var Mustache=require(_0x49be('0x5'));var util=require(_0x49be('0x6'));var path=require(_0x49be('0x7'));var sox=require(_0x49be('0x8'));var csv=require(_0x49be('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x49be('0xa'));var squel=require('squel');var crypto=require(_0x49be('0xb'));var jsforce=require(_0x49be('0xc'));var deskjs=require(_0x49be('0xd'));var toCsv=require(_0x49be('0x9'));var querystring=require('querystring');var Papa=require(_0x49be('0xe'));var Redis=require('ioredis');var authService=require(_0x49be('0xf'));var qs=require(_0x49be('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x49be('0x11'));var logger=require(_0x49be('0x12'))(_0x49be('0x13'));var utils=require(_0x49be('0x14'));var config=require(_0x49be('0x15'));var licenseUtil=require(_0x49be('0x16'));var db=require(_0x49be('0x17'))['db'];function respondWithStatusCode(_0x3b0a42,_0x9f806e){_0x9f806e=_0x9f806e||0xcc;return function(_0x1b7381){if(_0x1b7381){return _0x3b0a42['sendStatus'](_0x9f806e);}return _0x3b0a42['status'](_0x9f806e)[_0x49be('0x18')]();};}function respondWithResult(_0x319f18,_0x26b669){_0x26b669=_0x26b669||0xc8;return function(_0x104535){if(_0x104535){return _0x319f18[_0x49be('0x19')](_0x26b669)[_0x49be('0x1a')](_0x104535);}};}function respondWithFilteredResult(_0x27f203,_0x469125){return function(_0x28aa1a){if(_0x28aa1a){var _0x372e04=typeof _0x469125['offset']==='undefined'&&typeof _0x469125[_0x49be('0x1b')]===_0x49be('0x1c');var _0x1f2a6d=_0x28aa1a[_0x49be('0x1d')];var _0x4b8419=_0x372e04?0x0:_0x469125['offset'];var _0x4c6d99=_0x372e04?_0x28aa1a[_0x49be('0x1d')]:_0x469125[_0x49be('0x1e')]+_0x469125[_0x49be('0x1b')];var _0x37a4f9;if(_0x4c6d99>=_0x1f2a6d){_0x4c6d99=_0x1f2a6d;_0x37a4f9=0xc8;}else{_0x37a4f9=0xce;}_0x27f203[_0x49be('0x19')](_0x37a4f9);return _0x27f203['set']('Content-Range',_0x4b8419+'-'+_0x4c6d99+'/'+_0x1f2a6d)['json'](_0x28aa1a);}return null;};}function patchUpdates(_0x3c594e){return function(_0x2685a0){try{jsonpatch[_0x49be('0x1f')](_0x2685a0,_0x3c594e,!![]);}catch(_0x37f41e){return BPromise['reject'](_0x37f41e);}return _0x2685a0[_0x49be('0x20')]();};}function saveUpdates(_0x17b2e3,_0x4010cf){return function(_0x24b5bb){if(_0x24b5bb){return _0x24b5bb[_0x49be('0x21')](_0x17b2e3)[_0x49be('0x22')](function(_0x33f71c){return _0x33f71c;});}return null;};}function removeEntity(_0x1ebc35,_0x236be1){return function(_0x35b6c4){if(_0x35b6c4){return _0x35b6c4[_0x49be('0x23')]()['then'](function(){var _0x482b21=_0x35b6c4[_0x49be('0x24')]({'plain':!![]});var _0x2dda1e=_0x49be('0x25');return db[_0x49be('0x26')][_0x49be('0x23')]({'where':{'type':_0x2dda1e,'resourceId':_0x482b21['id']}})[_0x49be('0x22')](function(){return _0x35b6c4;});})[_0x49be('0x22')](function(){_0x1ebc35[_0x49be('0x19')](0xcc)[_0x49be('0x18')]();});}};}function handleEntityNotFound(_0x4eea70,_0x3421ed){return function(_0x33a8bd){if(!_0x33a8bd){_0x4eea70['sendStatus'](0x194);}return _0x33a8bd;};}function handleError(_0x35121b,_0x3c88ba){_0x3c88ba=_0x3c88ba||0x1f4;return function(_0x1c4604){logger[_0x49be('0x27')](_0x1c4604[_0x49be('0x28')]);if(_0x1c4604[_0x49be('0x29')]){delete _0x1c4604['name'];}_0x35121b[_0x49be('0x19')](_0x3c88ba)[_0x49be('0x2a')](_0x1c4604);};}exports[_0x49be('0x2b')]=function(_0x2f9d72,_0x80f3e4){var _0x4bb8a4={},_0x3249db={},_0x18c98f={'count':0x0,'rows':[]};var _0x5d458a=_[_0x49be('0x2c')](db[_0x49be('0x2d')]['rawAttributes'],function(_0x329be4){return{'name':_0x329be4[_0x49be('0x2e')],'type':_0x329be4['type'][_0x49be('0x2f')]};});_0x3249db[_0x49be('0x30')]=_['map'](_0x5d458a,'name');_0x3249db[_0x49be('0x31')]=_[_0x49be('0x32')](_0x2f9d72[_0x49be('0x31')]);_0x3249db[_0x49be('0x33')]=_[_0x49be('0x34')](_0x3249db[_0x49be('0x30')],_0x3249db['query']);_0x4bb8a4[_0x49be('0x35')]=_['intersection'](_0x3249db[_0x49be('0x30')],qs[_0x49be('0x36')](_0x2f9d72[_0x49be('0x31')][_0x49be('0x36')]));_0x4bb8a4['attributes']=_0x4bb8a4['attributes'][_0x49be('0x37')]?_0x4bb8a4[_0x49be('0x35')]:_0x3249db[_0x49be('0x30')];if(!_0x2f9d72['query'][_0x49be('0x38')](_0x49be('0x39'))){_0x4bb8a4[_0x49be('0x1b')]=qs[_0x49be('0x1b')](_0x2f9d72['query']['limit']);_0x4bb8a4['offset']=qs[_0x49be('0x1e')](_0x2f9d72[_0x49be('0x31')][_0x49be('0x1e')]);}_0x4bb8a4[_0x49be('0x3a')]=qs[_0x49be('0x3b')](_0x2f9d72['query'][_0x49be('0x3b')]);_0x4bb8a4['where']=qs[_0x49be('0x33')](_[_0x49be('0x3c')](_0x2f9d72[_0x49be('0x31')],_0x3249db[_0x49be('0x33')]),_0x5d458a);if(_0x2f9d72['query'][_0x49be('0x3d')]){_0x4bb8a4[_0x49be('0x3e')]=_[_0x49be('0x3f')](_0x4bb8a4[_0x49be('0x3e')],{'$or':_[_0x49be('0x2c')](_0x5d458a,function(_0x181fb6){if(_0x181fb6[_0x49be('0x40')]!==_0x49be('0x41')){var _0x18eb37={};_0x18eb37[_0x181fb6[_0x49be('0x29')]]={'$like':'%'+_0x2f9d72['query'][_0x49be('0x3d')]+'%'};return _0x18eb37;}})});}_0x4bb8a4=_['merge']({},_0x4bb8a4,_0x2f9d72[_0x49be('0x42')]);var _0x5563b1={'where':_0x4bb8a4[_0x49be('0x3e')]};return db['Variable'][_0x49be('0x1d')](_0x5563b1)['then'](function(_0x3d9bb1){_0x18c98f[_0x49be('0x1d')]=_0x3d9bb1;if(_0x2f9d72[_0x49be('0x31')][_0x49be('0x43')]){_0x4bb8a4[_0x49be('0x44')]=[{'all':!![]}];}return db[_0x49be('0x2d')][_0x49be('0x45')](_0x4bb8a4);})[_0x49be('0x22')](function(_0x22fe6a){_0x18c98f[_0x49be('0x46')]=_0x22fe6a;return _0x18c98f;})['then'](respondWithFilteredResult(_0x80f3e4,_0x4bb8a4))[_0x49be('0x47')](handleError(_0x80f3e4,null));};exports[_0x49be('0x48')]=function(_0x52c3ff,_0x3d95ba){var _0x4e922e={'raw':!![],'where':{'id':_0x52c3ff['params']['id']}},_0x48e325={};_0x48e325[_0x49be('0x30')]=_['keys'](db['Variable'][_0x49be('0x49')]);_0x48e325[_0x49be('0x31')]=_['keys'](_0x52c3ff[_0x49be('0x31')]);_0x48e325['filters']=_['intersection'](_0x48e325['model'],_0x48e325[_0x49be('0x31')]);_0x4e922e[_0x49be('0x35')]=_[_0x49be('0x34')](_0x48e325[_0x49be('0x30')],qs[_0x49be('0x36')](_0x52c3ff[_0x49be('0x31')][_0x49be('0x36')]));_0x4e922e['attributes']=_0x4e922e[_0x49be('0x35')][_0x49be('0x37')]?_0x4e922e[_0x49be('0x35')]:_0x48e325['model'];if(_0x52c3ff['query'][_0x49be('0x43')]){_0x4e922e[_0x49be('0x44')]=[{'all':!![]}];}_0x4e922e=_[_0x49be('0x3f')]({},_0x4e922e,_0x52c3ff[_0x49be('0x42')]);return db[_0x49be('0x2d')]['find'](_0x4e922e)[_0x49be('0x22')](handleEntityNotFound(_0x3d95ba,null))[_0x49be('0x22')](respondWithResult(_0x3d95ba,null))[_0x49be('0x47')](handleError(_0x3d95ba,null));};exports['create']=function(_0x1e4792,_0x1deadf){return db[_0x49be('0x2d')][_0x49be('0x4a')](_0x1e4792['body'],{})[_0x49be('0x22')](function(_0x1d1c28){var _0x1d4664=_0x1e4792['user'][_0x49be('0x24')]({'plain':!![]});if(!_0x1d4664)throw new Error(_0x49be('0x4b'));if(_0x1d4664['role']===_0x49be('0x4c')){var _0x930440=_0x1d1c28[_0x49be('0x24')]({'plain':!![]});var _0x576ed9=_0x49be('0x25');return db[_0x49be('0x4d')][_0x49be('0x4e')]({'where':{'name':_0x576ed9,'userProfileId':_0x1d4664[_0x49be('0x4f')]},'raw':!![]})[_0x49be('0x22')](function(_0x243e9a){if(_0x243e9a&&_0x243e9a[_0x49be('0x50')]===0x0){return db[_0x49be('0x26')][_0x49be('0x4a')]({'name':_0x930440['name'],'resourceId':_0x930440['id'],'type':_0x243e9a['name'],'sectionId':_0x243e9a['id']},{})[_0x49be('0x22')](function(){return _0x1d1c28;});}else{return _0x1d1c28;}})[_0x49be('0x47')](function(_0x4d8ba6){logger[_0x49be('0x27')](_0x49be('0x51'),_0x4d8ba6);throw _0x4d8ba6;});}return _0x1d1c28;})[_0x49be('0x22')](respondWithResult(_0x1deadf,0xc9))[_0x49be('0x47')](handleError(_0x1deadf,null));};exports['update']=function(_0x2822a8,_0x4c6488){if(_0x2822a8[_0x49be('0x52')]['id']){delete _0x2822a8[_0x49be('0x52')]['id'];}return db[_0x49be('0x2d')][_0x49be('0x4e')]({'where':{'id':_0x2822a8[_0x49be('0x53')]['id']}})[_0x49be('0x22')](handleEntityNotFound(_0x4c6488,null))[_0x49be('0x22')](saveUpdates(_0x2822a8['body'],null))[_0x49be('0x22')](respondWithResult(_0x4c6488,null))[_0x49be('0x47')](handleError(_0x4c6488,null));};exports[_0x49be('0x23')]=function(_0x403db7,_0x496da1){return db['Variable'][_0x49be('0x4e')]({'where':{'id':_0x403db7['params']['id']}})[_0x49be('0x22')](handleEntityNotFound(_0x496da1,null))['then'](removeEntity(_0x496da1,null))[_0x49be('0x47')](handleError(_0x496da1,null));}; \ No newline at end of file +var _0x3b49=['UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','save','then','get','Variables','UserProfileResource','destroy','error','stack','name','send','index','map','Variable','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','nolimit','sort','where','filters','merge','VIRTUAL','filter','includeAll','include','findAll','catch','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x479e36,_0x456f6e){var _0x4ac62d=function(_0x1168fe){while(--_0x1168fe){_0x479e36['push'](_0x479e36['shift']());}};_0x4ac62d(++_0x456f6e);}(_0x3b49,0x13f));var _0x93b4=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x3b49[_0x4b055c];return _0x4b62bb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x93b4('0x0'));var zipdir=require(_0x93b4('0x1'));var jsonpatch=require(_0x93b4('0x2'));var rp=require(_0x93b4('0x3'));var moment=require(_0x93b4('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x93b4('0x5'));var path=require(_0x93b4('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x93b4('0x7'));var _=require(_0x93b4('0x8'));var squel=require(_0x93b4('0x9'));var crypto=require(_0x93b4('0xa'));var jsforce=require(_0x93b4('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x93b4('0xc'));var Papa=require('papaparse');var Redis=require(_0x93b4('0xd'));var authService=require(_0x93b4('0xe'));var qs=require(_0x93b4('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x93b4('0x10'));var logger=require(_0x93b4('0x11'))(_0x93b4('0x12'));var utils=require('../../config/utils');var config=require(_0x93b4('0x13'));var licenseUtil=require(_0x93b4('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ca5ba,_0x320441){_0x320441=_0x320441||0xcc;return function(_0x244a51){if(_0x244a51){return _0x3ca5ba[_0x93b4('0x15')](_0x320441);}return _0x3ca5ba['status'](_0x320441)[_0x93b4('0x16')]();};}function respondWithResult(_0x4f274e,_0x49c01b){_0x49c01b=_0x49c01b||0xc8;return function(_0x582ea4){if(_0x582ea4){return _0x4f274e[_0x93b4('0x17')](_0x49c01b)['json'](_0x582ea4);}};}function respondWithFilteredResult(_0x5916aa,_0xea99a4){return function(_0x43c81d){if(_0x43c81d){var _0x1b92f1=typeof _0xea99a4[_0x93b4('0x18')]==='undefined'&&typeof _0xea99a4['limit']===_0x93b4('0x19');var _0x42180d=_0x43c81d[_0x93b4('0x1a')];var _0x45ff75=_0x1b92f1?0x0:_0xea99a4[_0x93b4('0x18')];var _0x2a5fe9=_0x1b92f1?_0x43c81d['count']:_0xea99a4[_0x93b4('0x18')]+_0xea99a4[_0x93b4('0x1b')];var _0x3ea354;if(_0x2a5fe9>=_0x42180d){_0x2a5fe9=_0x42180d;_0x3ea354=0xc8;}else{_0x3ea354=0xce;}_0x5916aa[_0x93b4('0x17')](_0x3ea354);return _0x5916aa[_0x93b4('0x1c')](_0x93b4('0x1d'),_0x45ff75+'-'+_0x2a5fe9+'/'+_0x42180d)[_0x93b4('0x1e')](_0x43c81d);}return null;};}function patchUpdates(_0xdd19f4){return function(_0x495bd9){try{jsonpatch[_0x93b4('0x1f')](_0x495bd9,_0xdd19f4,!![]);}catch(_0x4314db){return BPromise['reject'](_0x4314db);}return _0x495bd9[_0x93b4('0x20')]();};}function saveUpdates(_0x563811,_0x1d749b){return function(_0x532e2b){if(_0x532e2b){return _0x532e2b['update'](_0x563811)['then'](function(_0x37307c){return _0x37307c;});}return null;};}function removeEntity(_0xb33afe,_0x3036ad){return function(_0x50aa6c){if(_0x50aa6c){return _0x50aa6c['destroy']()[_0x93b4('0x21')](function(){var _0x4845c2=_0x50aa6c[_0x93b4('0x22')]({'plain':!![]});var _0x83db8f=_0x93b4('0x23');return db[_0x93b4('0x24')][_0x93b4('0x25')]({'where':{'type':_0x83db8f,'resourceId':_0x4845c2['id']}})['then'](function(){return _0x50aa6c;});})[_0x93b4('0x21')](function(){_0xb33afe[_0x93b4('0x17')](0xcc)[_0x93b4('0x16')]();});}};}function handleEntityNotFound(_0x554fd8,_0x54a661){return function(_0x379d92){if(!_0x379d92){_0x554fd8['sendStatus'](0x194);}return _0x379d92;};}function handleError(_0x9a2fc4,_0x14f8f5){_0x14f8f5=_0x14f8f5||0x1f4;return function(_0x4b272d){logger[_0x93b4('0x26')](_0x4b272d[_0x93b4('0x27')]);if(_0x4b272d[_0x93b4('0x28')]){delete _0x4b272d[_0x93b4('0x28')];}_0x9a2fc4['status'](_0x14f8f5)[_0x93b4('0x29')](_0x4b272d);};}exports[_0x93b4('0x2a')]=function(_0x4d6604,_0x3866dd){var _0x113768={},_0x4a72a5={},_0x511faf={'count':0x0,'rows':[]};var _0x56d6a3=_[_0x93b4('0x2b')](db[_0x93b4('0x2c')][_0x93b4('0x2d')],function(_0x1c54f5){return{'name':_0x1c54f5[_0x93b4('0x2e')],'type':_0x1c54f5['type'][_0x93b4('0x2f')]};});_0x4a72a5[_0x93b4('0x30')]=_[_0x93b4('0x2b')](_0x56d6a3,'name');_0x4a72a5[_0x93b4('0x31')]=_[_0x93b4('0x32')](_0x4d6604[_0x93b4('0x31')]);_0x4a72a5['filters']=_['intersection'](_0x4a72a5[_0x93b4('0x30')],_0x4a72a5[_0x93b4('0x31')]);_0x113768[_0x93b4('0x33')]=_[_0x93b4('0x34')](_0x4a72a5['model'],qs[_0x93b4('0x35')](_0x4d6604['query']['fields']));_0x113768[_0x93b4('0x33')]=_0x113768[_0x93b4('0x33')][_0x93b4('0x36')]?_0x113768[_0x93b4('0x33')]:_0x4a72a5[_0x93b4('0x30')];if(!_0x4d6604[_0x93b4('0x31')]['hasOwnProperty'](_0x93b4('0x37'))){_0x113768[_0x93b4('0x1b')]=qs[_0x93b4('0x1b')](_0x4d6604['query'][_0x93b4('0x1b')]);_0x113768[_0x93b4('0x18')]=qs[_0x93b4('0x18')](_0x4d6604[_0x93b4('0x31')][_0x93b4('0x18')]);}_0x113768['order']=qs[_0x93b4('0x38')](_0x4d6604[_0x93b4('0x31')]['sort']);_0x113768[_0x93b4('0x39')]=qs['filters'](_['pick'](_0x4d6604[_0x93b4('0x31')],_0x4a72a5[_0x93b4('0x3a')]),_0x56d6a3);if(_0x4d6604['query']['filter']){_0x113768[_0x93b4('0x39')]=_[_0x93b4('0x3b')](_0x113768[_0x93b4('0x39')],{'$or':_['map'](_0x56d6a3,function(_0x17f6ba){if(_0x17f6ba['type']!==_0x93b4('0x3c')){var _0x2e5e1d={};_0x2e5e1d[_0x17f6ba['name']]={'$like':'%'+_0x4d6604[_0x93b4('0x31')][_0x93b4('0x3d')]+'%'};return _0x2e5e1d;}})});}_0x113768=_[_0x93b4('0x3b')]({},_0x113768,_0x4d6604['options']);var _0x194aa5={'where':_0x113768[_0x93b4('0x39')]};return db[_0x93b4('0x2c')]['count'](_0x194aa5)['then'](function(_0x5d1590){_0x511faf[_0x93b4('0x1a')]=_0x5d1590;if(_0x4d6604['query'][_0x93b4('0x3e')]){_0x113768[_0x93b4('0x3f')]=[{'all':!![]}];}return db[_0x93b4('0x2c')][_0x93b4('0x40')](_0x113768);})[_0x93b4('0x21')](function(_0xfdb6e7){_0x511faf['rows']=_0xfdb6e7;return _0x511faf;})['then'](respondWithFilteredResult(_0x3866dd,_0x113768))[_0x93b4('0x41')](handleError(_0x3866dd,null));};exports['show']=function(_0x31d492,_0xc0add9){var _0x12aae3={'raw':!![],'where':{'id':_0x31d492[_0x93b4('0x42')]['id']}},_0x454eed={};_0x454eed[_0x93b4('0x30')]=_[_0x93b4('0x32')](db[_0x93b4('0x2c')][_0x93b4('0x2d')]);_0x454eed[_0x93b4('0x31')]=_[_0x93b4('0x32')](_0x31d492[_0x93b4('0x31')]);_0x454eed[_0x93b4('0x3a')]=_[_0x93b4('0x34')](_0x454eed[_0x93b4('0x30')],_0x454eed[_0x93b4('0x31')]);_0x12aae3['attributes']=_[_0x93b4('0x34')](_0x454eed[_0x93b4('0x30')],qs[_0x93b4('0x35')](_0x31d492['query'][_0x93b4('0x35')]));_0x12aae3[_0x93b4('0x33')]=_0x12aae3['attributes']['length']?_0x12aae3[_0x93b4('0x33')]:_0x454eed[_0x93b4('0x30')];if(_0x31d492[_0x93b4('0x31')][_0x93b4('0x3e')]){_0x12aae3[_0x93b4('0x3f')]=[{'all':!![]}];}_0x12aae3=_[_0x93b4('0x3b')]({},_0x12aae3,_0x31d492['options']);return db[_0x93b4('0x2c')]['find'](_0x12aae3)[_0x93b4('0x21')](handleEntityNotFound(_0xc0add9,null))['then'](respondWithResult(_0xc0add9,null))[_0x93b4('0x41')](handleError(_0xc0add9,null));};exports['create']=function(_0x380aa4,_0xcb79be){return db[_0x93b4('0x2c')][_0x93b4('0x43')](_0x380aa4['body'],{})['then'](function(_0x353b59){var _0x75987a=_0x380aa4[_0x93b4('0x44')]['get']({'plain':!![]});if(!_0x75987a)throw new Error(_0x93b4('0x45'));if(_0x75987a[_0x93b4('0x46')]===_0x93b4('0x44')){var _0x51b910=_0x353b59[_0x93b4('0x22')]({'plain':!![]});var _0x33989e='Variables';return db[_0x93b4('0x47')]['find']({'where':{'name':_0x33989e,'userProfileId':_0x75987a[_0x93b4('0x48')]},'raw':!![]})[_0x93b4('0x21')](function(_0x101b73){if(_0x101b73&&_0x101b73[_0x93b4('0x49')]===0x0){return db[_0x93b4('0x24')]['create']({'name':_0x51b910[_0x93b4('0x28')],'resourceId':_0x51b910['id'],'type':_0x101b73[_0x93b4('0x28')],'sectionId':_0x101b73['id']},{})[_0x93b4('0x21')](function(){return _0x353b59;});}else{return _0x353b59;}})[_0x93b4('0x41')](function(_0x1eb804){logger['error'](_0x93b4('0x4a'),_0x1eb804);throw _0x1eb804;});}return _0x353b59;})[_0x93b4('0x21')](respondWithResult(_0xcb79be,0xc9))[_0x93b4('0x41')](handleError(_0xcb79be,null));};exports[_0x93b4('0x4b')]=function(_0x38e421,_0x28d961){if(_0x38e421[_0x93b4('0x4c')]['id']){delete _0x38e421[_0x93b4('0x4c')]['id'];}return db[_0x93b4('0x2c')]['find']({'where':{'id':_0x38e421[_0x93b4('0x42')]['id']}})[_0x93b4('0x21')](handleEntityNotFound(_0x28d961,null))[_0x93b4('0x21')](saveUpdates(_0x38e421[_0x93b4('0x4c')],null))[_0x93b4('0x21')](respondWithResult(_0x28d961,null))[_0x93b4('0x41')](handleError(_0x28d961,null));};exports[_0x93b4('0x25')]=function(_0x570af4,_0x18bb6f){return db[_0x93b4('0x2c')][_0x93b4('0x4d')]({'where':{'id':_0x570af4['params']['id']}})[_0x93b4('0x21')](handleEntityNotFound(_0x18bb6f,null))[_0x93b4('0x21')](removeEntity(_0x18bb6f,null))['catch'](handleError(_0x18bb6f,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index f51925f..3252edc 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 _0xdac7=['request-promise','path','exports','define','Variable','tools_variables','lodash','util','../../config/logger','bluebird'];(function(_0xae1a83,_0x1980d4){var _0xdb9da8=function(_0x36fc99){while(--_0x36fc99){_0xae1a83['push'](_0xae1a83['shift']());}};_0xdb9da8(++_0x1980d4);}(_0xdac7,0x11e));var _0x7dac=function(_0x32d6c2,_0x3e3b64){_0x32d6c2=_0x32d6c2-0x0;var _0x1cb0ee=_0xdac7[_0x32d6c2];return _0x1cb0ee;};'use strict';var _=require(_0x7dac('0x0'));var util=require(_0x7dac('0x1'));var logger=require(_0x7dac('0x2'))('api');var moment=require('moment');var BPromise=require(_0x7dac('0x3'));var rp=require(_0x7dac('0x4'));var fs=require('fs');var path=require(_0x7dac('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./variable.attributes');module[_0x7dac('0x6')]=function(_0x2e6ca5,_0x3c44d4){return _0x2e6ca5[_0x7dac('0x7')](_0x7dac('0x8'),attributes,{'tableName':_0x7dac('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x29f2=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./variable.attributes','exports','Variable','tools_variables','lodash','util'];(function(_0x577e58,_0x161b0e){var _0x21ac1d=function(_0x3e9099){while(--_0x3e9099){_0x577e58['push'](_0x577e58['shift']());}};_0x21ac1d(++_0x161b0e);}(_0x29f2,0x136));var _0x229f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x29f2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x229f('0x0'));var util=require(_0x229f('0x1'));var logger=require(_0x229f('0x2'))('api');var moment=require(_0x229f('0x3'));var BPromise=require('bluebird');var rp=require(_0x229f('0x4'));var fs=require('fs');var path=require(_0x229f('0x5'));var rimraf=require(_0x229f('0x6'));var config=require(_0x229f('0x7'));var attributes=require(_0x229f('0x8'));module[_0x229f('0x9')]=function(_0x549705,_0x9ce139){return _0x549705['define'](_0x229f('0xa'),attributes,{'tableName':_0x229f('0xb'),'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 99819a9..ac1ab1c 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 _0x6aa7=['include','model','attributes','map','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowVariable','find','options','raw','where'];(function(_0x2f2961,_0x55308c){var _0x2b3c61=function(_0x5f0605){while(--_0x5f0605){_0x2f2961['push'](_0x2f2961['shift']());}};_0x2b3c61(++_0x55308c);}(_0x6aa7,0x178));var _0x76aa=function(_0x3e3eba,_0xe74dd5){_0x3e3eba=_0x3e3eba-0x0;var _0x2b6fc4=_0x6aa7[_0x3e3eba];return _0x2b6fc4;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});}exports[_0x76aa('0x16')]=function(_0x21c16d){var _0xa1bc7=this;return new Promise(function(_0x3ead3f,_0x496902){return db['Variable'][_0x76aa('0x17')]({'raw':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x19')]===undefined?!![]:![]:!![],'where':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1a')]||null:null,'attributes':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')]['attributes']||null:null,'include':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1b')]?_['map'](_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1b')],function(_0x31252f){return{'model':db[_0x31252f[_0x76aa('0x1c')]],'as':_0x31252f['as'],'attributes':_0x31252f[_0x76aa('0x1d')],'include':_0x31252f[_0x76aa('0x1b')]?_[_0x76aa('0x1e')](_0x31252f[_0x76aa('0x1b')],function(_0x32bf9f){return{'model':db[_0x32bf9f[_0x76aa('0x1c')]],'as':_0x32bf9f['as'],'attributes':_0x32bf9f[_0x76aa('0x1d')],'include':_0x32bf9f[_0x76aa('0x1b')]?_[_0x76aa('0x1e')](_0x32bf9f['include'],function(_0xb5e8a9){return{'model':db[_0xb5e8a9[_0x76aa('0x1c')]],'as':_0xb5e8a9['as'],'attributes':_0xb5e8a9[_0x76aa('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x76aa('0xa')](function(_0xa1e6){logger[_0x76aa('0xb')](_0x76aa('0x16'),_0x21c16d);logger[_0x76aa('0xe')](_0x76aa('0x16'),_0x21c16d,JSON[_0x76aa('0x10')](_0xa1e6));_0x3ead3f(_0xa1e6);})['catch'](function(_0x3fcb7f){logger['error'](_0x76aa('0x16'),_0x3fcb7f[_0x76aa('0x13')],_0x21c16d);_0x496902(_0xa1bc7[_0x76aa('0x11')](0x1f4,_0x3fcb7f[_0x76aa('0x13')]));});});}; \ No newline at end of file +var _0x814b=['model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowVariable','options','where','include','map','attributes'];(function(_0x4ac70e,_0x11785f){var _0x3ad421=function(_0x5d5353){while(--_0x5d5353){_0x4ac70e['push'](_0x4ac70e['shift']());}};_0x3ad421(++_0x11785f);}(_0x814b,0x1a2));var _0xb814=function(_0x3b22e9,_0x354406){_0x3b22e9=_0x3b22e9-0x0;var _0x230314=_0x814b[_0x3b22e9];return _0x230314;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('Variable,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});}exports[_0xb814('0x18')]=function(_0x55ba16){var _0x270598=this;return new Promise(function(_0xfac75b,_0x4c3007){return db['Variable']['find']({'raw':_0x55ba16[_0xb814('0x19')]?_0x55ba16['options']['raw']===undefined?!![]:![]:!![],'where':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1a')]||null:null,'attributes':_0x55ba16['options']?_0x55ba16[_0xb814('0x19')]['attributes']||null:null,'include':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')],function(_0x1f5d40){return{'model':db[_0x1f5d40['model']],'as':_0x1f5d40['as'],'attributes':_0x1f5d40[_0xb814('0x1d')],'include':_0x1f5d40['include']?_[_0xb814('0x1c')](_0x1f5d40[_0xb814('0x1b')],function(_0x31c7ec){return{'model':db[_0x31c7ec[_0xb814('0x1e')]],'as':_0x31c7ec['as'],'attributes':_0x31c7ec[_0xb814('0x1d')],'include':_0x31c7ec[_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x31c7ec['include'],function(_0x392222){return{'model':db[_0x392222[_0xb814('0x1e')]],'as':_0x392222['as'],'attributes':_0x392222[_0xb814('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb814('0xd')](function(_0x32ed56){logger[_0xb814('0xe')](_0xb814('0x18'),_0x55ba16);logger[_0xb814('0x11')]('ShowVariable',_0x55ba16,JSON[_0xb814('0x1f')](_0x32ed56));_0xfac75b(_0x32ed56);})[_0xb814('0x17')](function(_0x52ed64){logger[_0xb814('0x13')](_0xb814('0x18'),_0x52ed64[_0xb814('0x15')],_0x55ba16);_0x4c3007(_0x270598['error'](0x1f4,_0x52ed64[_0xb814('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 8f6f8ac..6ca3459 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 _0x238a=['Router','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','fetch','/reset','canUpdate','reset','/pull','pull','/restart','restart','/migrations','migrations','exports','express'];(function(_0x4d8b54,_0x3528b5){var _0x16f0a7=function(_0x216cdc){while(--_0x216cdc){_0x4d8b54['push'](_0x4d8b54['shift']());}};_0x16f0a7(++_0x3528b5);}(_0x238a,0xf6));var _0xa238=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x238a[_0x3b0731];return _0x4204d7;};'use strict';var express=require(_0xa238('0x0'));var router=express[_0xa238('0x1')]();var auth=require(_0xa238('0x2'));var controller=require(_0xa238('0x3'));router[_0xa238('0x4')]('/',controller[_0xa238('0x5')]);router[_0xa238('0x4')](_0xa238('0x6'),auth[_0xa238('0x7')](),auth['canUpdate'](),controller[_0xa238('0x8')]);router[_0xa238('0x4')](_0xa238('0x9'),auth['isAuthenticated'](),auth[_0xa238('0xa')](),controller[_0xa238('0xb')]);router[_0xa238('0x4')](_0xa238('0xc'),auth[_0xa238('0x7')](),auth['canUpdate'](),controller[_0xa238('0xd')]);router[_0xa238('0x4')](_0xa238('0xe'),auth['isAuthenticated'](),controller[_0xa238('0xf')]);router['get'](_0xa238('0x10'),controller[_0xa238('0x11')]);module[_0xa238('0x12')]=router; \ No newline at end of file +var _0x3b1b=['./version.controller','get','index','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','/restart','/migrations','express','../../components/auth/service'];(function(_0x374b9d,_0x59eadb){var _0xf81d32=function(_0x355376){while(--_0x355376){_0x374b9d['push'](_0x374b9d['shift']());}};_0xf81d32(++_0x59eadb);}(_0x3b1b,0xde));var _0xb3b1=function(_0x2c698f,_0x330d36){_0x2c698f=_0x2c698f-0x0;var _0x394bb1=_0x3b1b[_0x2c698f];return _0x394bb1;};'use strict';var express=require(_0xb3b1('0x0'));var router=express['Router']();var auth=require(_0xb3b1('0x1'));var controller=require(_0xb3b1('0x2'));router[_0xb3b1('0x3')]('/',controller[_0xb3b1('0x4')]);router[_0xb3b1('0x3')](_0xb3b1('0x5'),auth[_0xb3b1('0x6')](),auth[_0xb3b1('0x7')](),controller[_0xb3b1('0x8')]);router[_0xb3b1('0x3')](_0xb3b1('0x9'),auth[_0xb3b1('0x6')](),auth[_0xb3b1('0x7')](),controller[_0xb3b1('0xa')]);router['get'](_0xb3b1('0xb'),auth[_0xb3b1('0x6')](),auth[_0xb3b1('0x7')](),controller['pull']);router[_0xb3b1('0x3')](_0xb3b1('0xc'),auth['isAuthenticated'](),controller['restart']);router['get'](_0xb3b1('0xd'),controller['migrations']);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 dfa9baf..28f36e7 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 _0x0b55=['json','status','origin','master','error','info','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','root','server','migrations','length','replace','.js','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','compare-versions','child_process','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','index','exports','version','query','latest','fetch','tags'];(function(_0x3000e4,_0x56bfd3){var _0x5380d9=function(_0x4cff5a){while(--_0x4cff5a){_0x3000e4['push'](_0x3000e4['shift']());}};_0x5380d9(++_0x56bfd3);}(_0x0b55,0x13d));var _0x50b5=function(_0x576df5,_0x471f9c){_0x576df5=_0x576df5-0x0;var _0x43076a=_0x0b55[_0x576df5];return _0x43076a;};'use strict';var Umzug=require(_0x50b5('0x0'));var path=require(_0x50b5('0x1'));var fs=require('fs');var _=require(_0x50b5('0x2'));var pkginfo=require(_0x50b5('0x3'))(module,'version');var compareVersions=require(_0x50b5('0x4'));var exec=require(_0x50b5('0x5'))['exec'];var db=require(_0x50b5('0x6'))['db'];var config=require(_0x50b5('0x7'));var pm2=require(_0x50b5('0x8'));var logger=require(_0x50b5('0x9'))(_0x50b5('0xa'));var git=require(_0x50b5('0xb'))(config['root']);exports[_0x50b5('0xc')]=function(_0x328ac8,_0x34b929){var _0x9197c9={'current':module[_0x50b5('0xd')][_0x50b5('0xe')],'phonebar':0x2};if(_0x328ac8[_0x50b5('0xf')]&&_0x328ac8[_0x50b5('0xf')][_0x50b5('0x10')]){return git[_0x50b5('0x11')]()[_0x50b5('0x12')](function(_0x16867b,_0x57c42c){_0x9197c9[_0x50b5('0x10')]=(_0x16867b?module[_0x50b5('0xd')]['version']:_0x57c42c[_0x50b5('0x10')])||'2.0.0';return _0x34b929['status'](0xc8)[_0x50b5('0x13')](_0x9197c9);});}else{return _0x34b929[_0x50b5('0x14')](0xc8)['json'](_0x9197c9);}};exports[_0x50b5('0x11')]=function(_0x48b9b8,_0x79e35a){return git[_0x50b5('0x11')]([_0x50b5('0x15'),_0x50b5('0x16')],function(_0x3d236b){if(_0x3d236b){logger[_0x50b5('0x17')](_0x3d236b);return _0x79e35a[_0x50b5('0x14')](0x1f4)[_0x50b5('0x13')](_0x3d236b);}logger[_0x50b5('0x18')]('git\x20fetch');return _0x79e35a[_0x50b5('0x14')](0xc8)[_0x50b5('0x13')]({'output':_0x50b5('0x19')});});};exports[_0x50b5('0x1a')]=function(_0x23997b,_0x3c5d07){return git[_0x50b5('0x1a')]([_0x50b5('0x1b'),'FETCH_HEAD'],function(_0x1bca24){if(_0x1bca24){logger[_0x50b5('0x17')](_0x1bca24);return _0x3c5d07[_0x50b5('0x14')](0x1f4)[_0x50b5('0x13')](_0x1bca24);}logger[_0x50b5('0x18')](_0x50b5('0x1c'));return _0x3c5d07[_0x50b5('0x14')](0xc8)[_0x50b5('0x13')]({'output':_0x50b5('0x1d')});});};exports[_0x50b5('0x1e')]=function(_0x2735cc,_0x3777e5){exec(_0x50b5('0x1f'),function(_0x21728d,_0x4a66c5,_0x4378e2){logger[_0x50b5('0x18')](_0x4a66c5);logger[_0x50b5('0x18')](_0x4378e2);if(_0x21728d){logger[_0x50b5('0x17')](_0x21728d);return _0x3777e5[_0x50b5('0x14')](0x1f4)[_0x50b5('0x13')](_0x21728d);}return _0x3777e5[_0x50b5('0x14')](0xc8)[_0x50b5('0x13')]({'output':_0x4a66c5});});};exports[_0x50b5('0x20')]=function(_0x2d4cf4,_0x3ca302){return pm2[_0x50b5('0x20')](_0x50b5('0x21'))[_0x50b5('0x22')](function(_0x4298d6){logger[_0x50b5('0x18')](_0x50b5('0x23'),_0x4298d6);return _0x3ca302[_0x50b5('0x14')](0xc8)['json']({'output':_0x50b5('0x24')});})[_0x50b5('0x25')](function(_0x321978){logger['error'](_0x321978);return _0x3ca302[_0x50b5('0x14')](0x1f4)[_0x50b5('0x13')](_0x321978);});};exports['migrations']=function(_0x393e1c,_0x146b26){var _0x1a257d=fs['readdirSync'](path['join'](config[_0x50b5('0x26')],_0x50b5('0x27'),_0x50b5('0x28')));var _0x4e2da0=[];for(var _0x4641c9=0x0;_0x4641c9<_0x1a257d[_0x50b5('0x29')];_0x4641c9++){var _0x2519a0=_0x1a257d[_0x4641c9][_0x50b5('0x2a')](_0x50b5('0x2b'),'');if(compareVersions(module[_0x50b5('0xd')][_0x50b5('0xe')],_0x2519a0)===-0x1){_0x4e2da0['push'](_0x2519a0);}}if(_0x4e2da0[_0x50b5('0x29')]){var _0x335db2=_0x4e2da0['sort'](compareVersions);var _0x19898b=new Umzug({'storage':_0x50b5('0x2c'),'storageOptions':{'model':db[_0x50b5('0x2d')],'modelName':_0x50b5('0x2d'),'columnName':_0x50b5('0xe')},'migrations':{'params':[db['sequelize'][_0x50b5('0x2e')](),db[_0x50b5('0x2c')][_0x50b5('0x2f')],function(){throw new Error(_0x50b5('0x30'));}],'path':path[_0x50b5('0x31')](config[_0x50b5('0x26')],_0x50b5('0x27'),_0x50b5('0x28')),'pattern':/\.js$/}});_0x19898b['up']({'migrations':_[_0x50b5('0x32')](_0x335db2,function(_0x515c3a){return _0x515c3a+_0x50b5('0x2b');})})[_0x50b5('0x22')](function(){return _0x146b26['status'](0xc8)['json']({'output':_0x50b5('0x33')+module[_0x50b5('0xd')][_0x50b5('0xe')]+_0x50b5('0x34')+_[_0x50b5('0x35')](_0x335db2),'migrations':_[_0x50b5('0x31')](_0x335db2)});})[_0x50b5('0x25')](function(_0x308677){if(_0x308677 instanceof db[_0x50b5('0x2c')][_0x50b5('0x36')]){return _0x146b26[_0x50b5('0x14')](0xc8)[_0x50b5('0x13')]({'output':_0x50b5('0x37')});}else{return _0x146b26[_0x50b5('0x14')](0x1f4)[_0x50b5('0x13')](_0x308677);}});}else{return _0x146b26[_0x50b5('0x14')](0xc8)[_0x50b5('0x13')]({'output':_0x50b5('0x37')});}}; \ No newline at end of file +var _0x2449=['umzug','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','root','query','latest','fetch','tags','exports','status','json','origin','error','info','git\x20fetch','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','restart','then','pm2\x20restart\x20motion\x20%s','catch','migrations','readdirSync','join','server','replace','.js','push','length','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','\x20to\x20','last','Database\x20already\x20up-to-date'];(function(_0x28de36,_0x1ba1da){var _0x22e775=function(_0x4417eb){while(--_0x4417eb){_0x28de36['push'](_0x28de36['shift']());}};_0x22e775(++_0x1ba1da);}(_0x2449,0x104));var _0x9244=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2449[_0x3dd15e];return _0x231fd0;};'use strict';var Umzug=require(_0x9244('0x0'));var path=require(_0x9244('0x1'));var fs=require('fs');var _=require(_0x9244('0x2'));var pkginfo=require(_0x9244('0x3'))(module,_0x9244('0x4'));var compareVersions=require(_0x9244('0x5'));var exec=require(_0x9244('0x6'))[_0x9244('0x7')];var db=require(_0x9244('0x8'))['db'];var config=require(_0x9244('0x9'));var pm2=require(_0x9244('0xa'));var logger=require(_0x9244('0xb'))(_0x9244('0xc'));var git=require('simple-git')(config[_0x9244('0xd')]);exports['index']=function(_0x457e36,_0x141379){var _0x163872={'current':module['exports'][_0x9244('0x4')],'phonebar':0x2};if(_0x457e36[_0x9244('0xe')]&&_0x457e36[_0x9244('0xe')][_0x9244('0xf')]){return git[_0x9244('0x10')]()[_0x9244('0x11')](function(_0x338dc9,_0x4f3893){_0x163872[_0x9244('0xf')]=(_0x338dc9?module[_0x9244('0x12')][_0x9244('0x4')]:_0x4f3893[_0x9244('0xf')])||'2.0.0';return _0x141379[_0x9244('0x13')](0xc8)[_0x9244('0x14')](_0x163872);});}else{return _0x141379[_0x9244('0x13')](0xc8)[_0x9244('0x14')](_0x163872);}};exports[_0x9244('0x10')]=function(_0x382167,_0x34e0b9){return git[_0x9244('0x10')]([_0x9244('0x15'),'master'],function(_0x271e02){if(_0x271e02){logger[_0x9244('0x16')](_0x271e02);return _0x34e0b9['status'](0x1f4)[_0x9244('0x14')](_0x271e02);}logger[_0x9244('0x17')](_0x9244('0x18'));return _0x34e0b9[_0x9244('0x13')](0xc8)[_0x9244('0x14')]({'output':'git\x20fetch\x20origin\x20master'});});};exports['reset']=function(_0x4e5b1a,_0x354204){return git[_0x9244('0x19')]([_0x9244('0x1a'),_0x9244('0x1b')],function(_0x107176){if(_0x107176){logger[_0x9244('0x16')](_0x107176);return _0x354204[_0x9244('0x13')](0x1f4)[_0x9244('0x14')](_0x107176);}logger['info']('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x354204[_0x9244('0x13')](0xc8)[_0x9244('0x14')]({'output':_0x9244('0x1c')});});};exports['pull']=function(_0x588a3f,_0x413393){exec(_0x9244('0x1d'),function(_0x6dd084,_0x4e29e0,_0x3a7505){logger['info'](_0x4e29e0);logger[_0x9244('0x17')](_0x3a7505);if(_0x6dd084){logger[_0x9244('0x16')](_0x6dd084);return _0x413393[_0x9244('0x13')](0x1f4)[_0x9244('0x14')](_0x6dd084);}return _0x413393['status'](0xc8)['json']({'output':_0x4e29e0});});};exports['restart']=function(_0x19ba28,_0x51db8e){return pm2[_0x9244('0x1e')]('motion2')[_0x9244('0x1f')](function(_0x1e1587){logger[_0x9244('0x17')](_0x9244('0x20'),_0x1e1587);return _0x51db8e[_0x9244('0x13')](0xc8)[_0x9244('0x14')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x9244('0x21')](function(_0x322b8a){logger[_0x9244('0x16')](_0x322b8a);return _0x51db8e[_0x9244('0x13')](0x1f4)[_0x9244('0x14')](_0x322b8a);});};exports[_0x9244('0x22')]=function(_0x73aa69,_0x37127b){var _0xa7579=fs[_0x9244('0x23')](path[_0x9244('0x24')](config[_0x9244('0xd')],_0x9244('0x25'),'migrations'));var _0x48dcde=[];for(var _0x342e6a=0x0;_0x342e6a<_0xa7579['length'];_0x342e6a++){var _0x354c20=_0xa7579[_0x342e6a][_0x9244('0x26')](_0x9244('0x27'),'');if(compareVersions(module['exports'][_0x9244('0x4')],_0x354c20)===-0x1){_0x48dcde[_0x9244('0x28')](_0x354c20);}}if(_0x48dcde[_0x9244('0x29')]){var _0x5a23f0=_0x48dcde[_0x9244('0x2a')](compareVersions);var _0x4f6817=new Umzug({'storage':_0x9244('0x2b'),'storageOptions':{'model':db[_0x9244('0x2c')],'modelName':_0x9244('0x2c'),'columnName':_0x9244('0x4')},'migrations':{'params':[db['sequelize'][_0x9244('0x2d')](),db[_0x9244('0x2b')][_0x9244('0x2e')],function(){throw new Error(_0x9244('0x2f'));}],'path':path[_0x9244('0x24')](config[_0x9244('0xd')],'server',_0x9244('0x22')),'pattern':/\.js$/}});_0x4f6817['up']({'migrations':_[_0x9244('0x30')](_0x5a23f0,function(_0x123517){return _0x123517+_0x9244('0x27');})})[_0x9244('0x1f')](function(){return _0x37127b[_0x9244('0x13')](0xc8)[_0x9244('0x14')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x9244('0x12')][_0x9244('0x4')]+_0x9244('0x31')+_[_0x9244('0x32')](_0x5a23f0),'migrations':_[_0x9244('0x24')](_0x5a23f0)});})[_0x9244('0x21')](function(_0x5cb101){if(_0x5cb101 instanceof db[_0x9244('0x2b')]['UniqueConstraintError']){return _0x37127b[_0x9244('0x13')](0xc8)[_0x9244('0x14')]({'output':_0x9244('0x33')});}else{return _0x37127b[_0x9244('0x13')](0x1f4)['json'](_0x5cb101);}});}else{return _0x37127b[_0x9244('0x13')](0xc8)[_0x9244('0x14')]({'output':_0x9244('0x33')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 119a0dc..29efde4 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 _0xe451=['multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','post','put','/:id','update','delete','destroy','exports'];(function(_0x3e9bdf,_0x63bc10){var _0x33ad9e=function(_0x2b4fe7){while(--_0x2b4fe7){_0x3e9bdf['push'](_0x3e9bdf['shift']());}};_0x33ad9e(++_0x63bc10);}(_0xe451,0x143));var _0x1e45=function(_0x44768e,_0x31dbc2){_0x44768e=_0x44768e-0x0;var _0x13aa9b=_0xe451[_0x44768e];return _0x13aa9b;};'use strict';var multer=require(_0x1e45('0x0'));var util=require('util');var path=require(_0x1e45('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1e45('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x1e45('0x3'));var interaction=require(_0x1e45('0x4'));var config=require(_0x1e45('0x5'));var controller=require(_0x1e45('0x6'));router[_0x1e45('0x7')]('/',auth[_0x1e45('0x8')](),controller[_0x1e45('0x9')]);router['get'](_0x1e45('0xa'),auth[_0x1e45('0x8')](),controller[_0x1e45('0xb')]);router[_0x1e45('0x7')]('/:id',auth[_0x1e45('0x8')](),controller['show']);router[_0x1e45('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1e45('0xd')](_0x1e45('0xe'),auth[_0x1e45('0x8')](),controller[_0x1e45('0xf')]);router[_0x1e45('0x10')](_0x1e45('0xe'),auth['isAuthenticated'](),controller[_0x1e45('0x11')]);module[_0x1e45('0x12')]=router; \ No newline at end of file +var _0x7294=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','index','/describe','isAuthenticated','describe','get','/:id','show','post','create','put','update','delete','destroy','multer','util'];(function(_0x46ea96,_0x2ada2a){var _0x23be1a=function(_0x41fe97){while(--_0x41fe97){_0x46ea96['push'](_0x46ea96['shift']());}};_0x23be1a(++_0x2ada2a);}(_0x7294,0x157));var _0x4729=function(_0x35fd1d,_0x1ff72a){_0x35fd1d=_0x35fd1d-0x0;var _0x59fc26=_0x7294[_0x35fd1d];return _0x59fc26;};'use strict';var multer=require(_0x4729('0x0'));var util=require(_0x4729('0x1'));var path=require(_0x4729('0x2'));var timeout=require(_0x4729('0x3'));var express=require(_0x4729('0x4'));var router=express[_0x4729('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4729('0x6'));var interaction=require(_0x4729('0x7'));var config=require(_0x4729('0x8'));var controller=require(_0x4729('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x4729('0xa')]);router['get'](_0x4729('0xb'),auth[_0x4729('0xc')](),controller[_0x4729('0xd')]);router[_0x4729('0xe')](_0x4729('0xf'),auth['isAuthenticated'](),controller[_0x4729('0x10')]);router[_0x4729('0x11')]('/',auth['isAuthenticated'](),controller[_0x4729('0x12')]);router[_0x4729('0x13')]('/:id',auth[_0x4729('0xc')](),controller[_0x4729('0x14')]);router[_0x4729('0x15')](_0x4729('0xf'),auth[_0x4729('0xc')](),controller[_0x4729('0x16')]);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 9e6acb2..700f8de 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 _0xd4a2=['STRING','DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xd4a2,0x173));var _0x2d4a=function(_0x1ade3a,_0x940738){_0x1ade3a=_0x1ade3a-0x0;var _0x460695=_0xd4a2[_0x1ade3a];return _0x460695;};'use strict';var Sequelize=require(_0x2d4a('0x0'));module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x2d4a('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2d4a('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x2d4a('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x2d4a('0x2')]},'agentconnectAt':{'type':Sequelize[_0x2d4a('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x2d4a('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x2d4a('0x2')]},'agentdumpAt':{'type':Sequelize[_0x2d4a('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x2d4a('0x3')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x2d4a('0x3')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x2d4a('0x3')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x2d4a('0x4')]},'agentacw':{'type':Sequelize[_0x2d4a('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x2d4a('0x4')]},'reason':{'type':Sequelize[_0x2d4a('0x1')]},'lastevent':{'type':Sequelize[_0x2d4a('0x1')]},'channel':{'type':Sequelize[_0x2d4a('0x1')]},'channelstate':{'type':Sequelize[_0x2d4a('0x4')]},'channelstatedesc':{'type':Sequelize[_0x2d4a('0x1')]},'connectedlinenum':{'type':Sequelize[_0x2d4a('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x2d4a('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x2d4a('0x1')]},'priority':{'type':Sequelize[_0x2d4a('0x1')]},'destchannel':{'type':Sequelize[_0x2d4a('0x1')]},'destchannelstate':{'type':Sequelize[_0x2d4a('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x2d4a('0x1')]},'destcalleridnum':{'type':Sequelize[_0x2d4a('0x1')]},'destcalleridname':{'type':Sequelize[_0x2d4a('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x2d4a('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x2d4a('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x2d4a('0x1')]},'destpriority':{'type':Sequelize[_0x2d4a('0x1')]},'destuniqueid':{'type':Sequelize[_0x2d4a('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x2d4a('0x1')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x2d4a('0x3')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x2d4a('0x5')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x2d4a('0x1')]},'agententerreason':{'type':Sequelize[_0x2d4a('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2d0b=['exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x7af8c9,_0x509a97){var _0xdca022=function(_0x50b77a){while(--_0x50b77a){_0x7af8c9['push'](_0x7af8c9['shift']());}};_0xdca022(++_0x509a97);}(_0x2d0b,0x102));var _0xb2d0=function(_0x31d001,_0x57fa55){_0x31d001=_0x31d001-0x0;var _0x37e546=_0x2d0b[_0x31d001];return _0x37e546;};'use strict';var Sequelize=require('sequelize');module[_0xb2d0('0x0')]={'type':{'type':Sequelize[_0xb2d0('0x1')]},'uniqueid':{'type':Sequelize[_0xb2d0('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xb2d0('0x1')]},'queue':{'type':Sequelize[_0xb2d0('0x1')]},'interface':{'type':Sequelize[_0xb2d0('0x1')]},'membername':{'type':Sequelize[_0xb2d0('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xb2d0('0x2')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0xb2d0('0x2')]},'agentdumpAt':{'type':Sequelize[_0xb2d0('0x2')]},'holdtime':{'type':Sequelize[_0xb2d0('0x3')]},'agentcomplete':{'type':Sequelize[_0xb2d0('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xb2d0('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xb2d0('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xb2d0('0x3')]},'agentacw':{'type':Sequelize[_0xb2d0('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xb2d0('0x3')]},'reason':{'type':Sequelize[_0xb2d0('0x1')]},'lastevent':{'type':Sequelize[_0xb2d0('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xb2d0('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xb2d0('0x1')]},'exten':{'type':Sequelize[_0xb2d0('0x1')]},'priority':{'type':Sequelize[_0xb2d0('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xb2d0('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xb2d0('0x1')]},'destcalleridname':{'type':Sequelize[_0xb2d0('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xb2d0('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xb2d0('0x1')]},'destlanguage':{'type':Sequelize[_0xb2d0('0x1')]},'destaccountcode':{'type':Sequelize[_0xb2d0('0x1')]},'destcontext':{'type':Sequelize[_0xb2d0('0x1')]},'destexten':{'type':Sequelize[_0xb2d0('0x1')]},'destpriority':{'type':Sequelize[_0xb2d0('0x1')]},'destuniqueid':{'type':Sequelize[_0xb2d0('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xb2d0('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0xb2d0('0x1')]},'transfer':{'type':Sequelize[_0xb2d0('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xb2d0('0x1')],'comment':_0xb2d0('0x5')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0xb2d0('0x1')]},'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 17d17e0..cd612d2 100644 --- a/server/api/voiceAgentReport/voiceAgentReport.controller.js +++ b/server/api/voiceAgentReport/voiceAgentReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['type','options','includeAll','include','findAll','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','VoiceAgentReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file +var _0xa9e0=['type','options','includeAll','include','findAll','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','VoiceAgentReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index bfc25ac..67f2c6a 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 _0x3c17=['bluebird','request-promise','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','VoiceAgentReport','report_agent','uniqueid','lodash','../../config/logger','moment'];(function(_0x130e14,_0x236d06){var _0x1992c8=function(_0x172a8e){while(--_0x172a8e){_0x130e14['push'](_0x130e14['shift']());}};_0x1992c8(++_0x236d06);}(_0x3c17,0x1a1));var _0x73c1=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x3c17[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x73c1('0x0'));var util=require('util');var logger=require(_0x73c1('0x1'))('api');var moment=require(_0x73c1('0x2'));var BPromise=require(_0x73c1('0x3'));var rp=require(_0x73c1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x73c1('0x5'));var config=require(_0x73c1('0x6'));var attributes=require(_0x73c1('0x7'));module[_0x73c1('0x8')]=function(_0x48c943,_0x382f82){return _0x48c943['define'](_0x73c1('0x9'),attributes,{'tableName':_0x73c1('0xa'),'paranoid':![],'indexes':[{'fields':[_0x73c1('0xb'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd67b=['../../config/environment','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','util','api','moment','bluebird','path'];(function(_0x2efff2,_0x1e2899){var _0x417482=function(_0xe33fb9){while(--_0xe33fb9){_0x2efff2['push'](_0x2efff2['shift']());}};_0x417482(++_0x1e2899);}(_0xd67b,0x133));var _0xbd67=function(_0x3785e6,_0x15779c){_0x3785e6=_0x3785e6-0x0;var _0x4bf863=_0xd67b[_0x3785e6];return _0x4bf863;};'use strict';var _=require('lodash');var util=require(_0xbd67('0x0'));var logger=require('../../config/logger')(_0xbd67('0x1'));var moment=require(_0xbd67('0x2'));var BPromise=require(_0xbd67('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd67('0x4'));var rimraf=require('rimraf');var config=require(_0xbd67('0x5'));var attributes=require('./voiceAgentReport.attributes');module[_0xbd67('0x6')]=function(_0xa5c384,_0x2ad142){return _0xa5c384[_0xbd67('0x7')](_0xbd67('0x8'),attributes,{'tableName':_0xbd67('0x9'),'paranoid':![],'indexes':[{'fields':[_0xbd67('0xa'),_0xbd67('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index cb542da..6b09bf2 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 _0x8286=['VoiceAgentReport,\x20%s,\x20%s','message','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','catch','UpdateVoiceAgentReport','update','where','attributes','limit','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','request','then','info','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x59d668,_0x4df459){var _0x425083=function(_0x3aaa34){while(--_0x3aaa34){_0x59d668['push'](_0x59d668['shift']());}};_0x425083(++_0x4df459);}(_0x8286,0xe7));var _0x6828=function(_0x1b48af,_0x58ed83){_0x1b48af=_0x1b48af-0x0;var _0x5ce7da=_0x8286[_0x1b48af];return _0x5ce7da;};'use strict';var _=require(_0x6828('0x0'));var util=require(_0x6828('0x1'));var moment=require(_0x6828('0x2'));var BPromise=require(_0x6828('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6828('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6828('0x5'))(_0x6828('0x6'));var config=require('../../config/environment');var jayson=require(_0x6828('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x304db7,_0x23a6cd,_0x4e2b1e){return new BPromise(function(_0x575527,_0xdcceee){return client[_0x6828('0x8')](_0x304db7,_0x4e2b1e)[_0x6828('0x9')](function(_0x2d6063){logger[_0x6828('0xa')]('VoiceAgentReport,\x20%s,\x20%s',_0x23a6cd,'request\x20sent');logger[_0x6828('0xb')](_0x6828('0xc'),_0x23a6cd,_0x6828('0xd'),JSON[_0x6828('0xe')](_0x2d6063));if(_0x2d6063['error']){if(_0x2d6063[_0x6828('0xf')][_0x6828('0x10')]===0x1f4){logger[_0x6828('0xf')](_0x6828('0x11'),_0x23a6cd,_0x2d6063['error'][_0x6828('0x12')]);return _0xdcceee(_0x2d6063['error'][_0x6828('0x12')]);}logger[_0x6828('0xf')]('VoiceAgentReport,\x20%s,\x20%s',_0x23a6cd,_0x2d6063[_0x6828('0xf')][_0x6828('0x12')]);return _0x575527(_0x2d6063[_0x6828('0xf')][_0x6828('0x12')]);}else{logger[_0x6828('0xa')](_0x6828('0x11'),_0x23a6cd,_0x6828('0xd'));_0x575527(_0x2d6063['result']['message']);}})['catch'](function(_0x54a1a3){logger[_0x6828('0xf')]('VoiceAgentReport,\x20%s,\x20%s',_0x23a6cd,_0x54a1a3);_0xdcceee(_0x54a1a3);});});}exports[_0x6828('0x13')]=function(_0x231a04){var _0x39022f=this;return new Promise(function(_0x3ba033,_0x5a0c95){return db[_0x6828('0x14')][_0x6828('0x15')](_0x231a04[_0x6828('0x16')],{'raw':_0x231a04[_0x6828('0x17')]?_0x231a04[_0x6828('0x17')][_0x6828('0x18')]===undefined?!![]:![]:!![]})[_0x6828('0x9')](function(_0x3f083d){logger[_0x6828('0xa')]('CreateVoiceAgentReport',_0x231a04);logger[_0x6828('0xb')](_0x6828('0x13'),_0x231a04,JSON[_0x6828('0xe')](_0x3f083d));_0x3ba033(_0x3f083d);})[_0x6828('0x19')](function(_0xc93e4c){logger[_0x6828('0xf')](_0x6828('0x13'),_0xc93e4c['message'],_0x231a04);_0x5a0c95(_0x39022f[_0x6828('0xf')](0x1f4,_0xc93e4c[_0x6828('0x12')]));});});};exports[_0x6828('0x1a')]=function(_0x30cda8){var _0x37b4fb=this;return new Promise(function(_0x2b1b54,_0x382517){return db[_0x6828('0x14')][_0x6828('0x1b')](_0x30cda8[_0x6828('0x16')],{'raw':_0x30cda8[_0x6828('0x17')]?_0x30cda8[_0x6828('0x17')][_0x6828('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30cda8[_0x6828('0x17')]?_0x30cda8['options'][_0x6828('0x1c')]||null:null,'attributes':_0x30cda8[_0x6828('0x17')]?_0x30cda8['options'][_0x6828('0x1d')]||null:null,'limit':_0x30cda8[_0x6828('0x17')]?_0x30cda8[_0x6828('0x17')][_0x6828('0x1e')]||null:null})['then'](function(_0x35e50e){logger['info']('UpdateVoiceAgentReport',_0x30cda8);logger['debug']('UpdateVoiceAgentReport',_0x30cda8,JSON[_0x6828('0xe')](_0x35e50e));_0x2b1b54(_0x35e50e);})['catch'](function(_0x5a4d82){logger['error'](_0x6828('0x1a'),_0x5a4d82[_0x6828('0x12')],_0x30cda8);_0x382517(_0x37b4fb[_0x6828('0xf')](0x1f4,_0x5a4d82[_0x6828('0x12')]));});});}; \ No newline at end of file +var _0xe551=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','body','options','debug','UpdateVoiceAgentReport','update','raw','where','lodash','util','moment','bluebird'];(function(_0x277eb4,_0x3076f9){var _0x41dfb7=function(_0x426f2f){while(--_0x426f2f){_0x277eb4['push'](_0x277eb4['shift']());}};_0x41dfb7(++_0x3076f9);}(_0xe551,0x113));var _0x1e55=function(_0x5d32cc,_0x2d6ffb){_0x5d32cc=_0x5d32cc-0x0;var _0x4a9404=_0xe551[_0x5d32cc];return _0x4a9404;};'use strict';var _=require(_0x1e55('0x0'));var util=require(_0x1e55('0x1'));var moment=require(_0x1e55('0x2'));var BPromise=require(_0x1e55('0x3'));var rs=require(_0x1e55('0x4'));var fs=require('fs');var Redis=require(_0x1e55('0x5'));var db=require(_0x1e55('0x6'))['db'];var utils=require(_0x1e55('0x7'));var logger=require(_0x1e55('0x8'))(_0x1e55('0x9'));var config=require('../../config/environment');var jayson=require(_0x1e55('0xa'));var client=jayson[_0x1e55('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1928c0,_0x1f3cfa,_0x1cb9d4){return new BPromise(function(_0x199114,_0x11972b){return client['request'](_0x1928c0,_0x1cb9d4)[_0x1e55('0xc')](function(_0x5a5cc1){logger[_0x1e55('0xd')](_0x1e55('0xe'),_0x1f3cfa,_0x1e55('0xf'));logger['debug'](_0x1e55('0x10'),_0x1f3cfa,_0x1e55('0xf'),JSON[_0x1e55('0x11')](_0x5a5cc1));if(_0x5a5cc1[_0x1e55('0x12')]){if(_0x5a5cc1[_0x1e55('0x12')]['code']===0x1f4){logger[_0x1e55('0x12')](_0x1e55('0xe'),_0x1f3cfa,_0x5a5cc1[_0x1e55('0x12')]['message']);return _0x11972b(_0x5a5cc1[_0x1e55('0x12')]['message']);}logger['error'](_0x1e55('0xe'),_0x1f3cfa,_0x5a5cc1[_0x1e55('0x12')][_0x1e55('0x13')]);return _0x199114(_0x5a5cc1['error'][_0x1e55('0x13')]);}else{logger[_0x1e55('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x1f3cfa,_0x1e55('0xf'));_0x199114(_0x5a5cc1[_0x1e55('0x14')][_0x1e55('0x13')]);}})[_0x1e55('0x15')](function(_0x31ec6c){logger[_0x1e55('0x12')](_0x1e55('0xe'),_0x1f3cfa,_0x31ec6c);_0x11972b(_0x31ec6c);});});}exports[_0x1e55('0x16')]=function(_0x505637){var _0x57b5dc=this;return new Promise(function(_0x560dda,_0x1571ed){return db[_0x1e55('0x17')]['create'](_0x505637[_0x1e55('0x18')],{'raw':_0x505637['options']?_0x505637[_0x1e55('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x1e55('0xc')](function(_0x25f38e){logger[_0x1e55('0xd')](_0x1e55('0x16'),_0x505637);logger[_0x1e55('0x1a')](_0x1e55('0x16'),_0x505637,JSON['stringify'](_0x25f38e));_0x560dda(_0x25f38e);})[_0x1e55('0x15')](function(_0x19d058){logger[_0x1e55('0x12')](_0x1e55('0x16'),_0x19d058[_0x1e55('0x13')],_0x505637);_0x1571ed(_0x57b5dc[_0x1e55('0x12')](0x1f4,_0x19d058[_0x1e55('0x13')]));});});};exports[_0x1e55('0x1b')]=function(_0xf8a7f9){var _0x3b541d=this;return new Promise(function(_0x511f99,_0x43e0e5){return db[_0x1e55('0x17')][_0x1e55('0x1c')](_0xf8a7f9['body'],{'raw':_0xf8a7f9[_0x1e55('0x19')]?_0xf8a7f9['options'][_0x1e55('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf8a7f9['options']?_0xf8a7f9['options'][_0x1e55('0x1e')]||null:null,'attributes':_0xf8a7f9[_0x1e55('0x19')]?_0xf8a7f9['options']['attributes']||null:null,'limit':_0xf8a7f9[_0x1e55('0x19')]?_0xf8a7f9[_0x1e55('0x19')]['limit']||null:null})['then'](function(_0x5a6df4){logger[_0x1e55('0xd')](_0x1e55('0x1b'),_0xf8a7f9);logger[_0x1e55('0x1a')]('UpdateVoiceAgentReport',_0xf8a7f9,JSON[_0x1e55('0x11')](_0x5a6df4));_0x511f99(_0x5a6df4);})[_0x1e55('0x15')](function(_0x2dc6e2){logger[_0x1e55('0x12')]('UpdateVoiceAgentReport',_0x2dc6e2['message'],_0xf8a7f9);_0x43e0e5(_0x3b541d[_0x1e55('0x12')](0x1f4,_0x2dc6e2[_0x1e55('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 71fe6ec..915150e 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 _0x207c=['/:id','show','post','isAuthenticated','create','put','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','index','get','/describe','describe'];(function(_0x417955,_0x4ed8c8){var _0x3a94ef=function(_0xa3a38d){while(--_0xa3a38d){_0x417955['push'](_0x417955['shift']());}};_0x3a94ef(++_0x4ed8c8);}(_0x207c,0x1e8));var _0xc207=function(_0x3abe58,_0x184dd9){_0x3abe58=_0x3abe58-0x0;var _0x457389=_0x207c[_0x3abe58];return _0x457389;};'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 fs_extra=require(_0xc207('0x5'));var auth=require(_0xc207('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc207('0x7'));var controller=require('./voiceCallReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xc207('0x8')]);router[_0xc207('0x9')](_0xc207('0xa'),auth['isAuthenticated'](),controller[_0xc207('0xb')]);router[_0xc207('0x9')](_0xc207('0xc'),auth['isAuthenticated'](),controller[_0xc207('0xd')]);router[_0xc207('0xe')]('/',auth[_0xc207('0xf')](),controller[_0xc207('0x10')]);router[_0xc207('0x11')](_0xc207('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc207('0xc'),auth['isAuthenticated'](),controller[_0xc207('0x12')]);module[_0xc207('0x13')]=router; \ No newline at end of file +var _0xd0bb=['express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','destroy','exports','multer','util','path'];(function(_0x46e2b6,_0xd29cf6){var _0x25f85d=function(_0x3bb0c6){while(--_0x3bb0c6){_0x46e2b6['push'](_0x46e2b6['shift']());}};_0x25f85d(++_0xd29cf6);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x3987a1,_0x447793){_0x3987a1=_0x3987a1-0x0;var _0xe2596e=_0xd0bb[_0x3987a1];return _0xe2596e;};'use strict';var multer=require(_0xbd0b('0x0'));var util=require(_0xbd0b('0x1'));var path=require(_0xbd0b('0x2'));var timeout=require('connect-timeout');var express=require(_0xbd0b('0x3'));var router=express['Router']();var fs_extra=require(_0xbd0b('0x4'));var auth=require(_0xbd0b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbd0b('0x6'));var controller=require('./voiceCallReport.controller');router[_0xbd0b('0x7')]('/',auth[_0xbd0b('0x8')](),controller[_0xbd0b('0x9')]);router[_0xbd0b('0x7')](_0xbd0b('0xa'),auth['isAuthenticated'](),controller[_0xbd0b('0xb')]);router[_0xbd0b('0x7')](_0xbd0b('0xc'),auth[_0xbd0b('0x8')](),controller[_0xbd0b('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbd0b('0xe')]);router[_0xbd0b('0xf')]('/:id',auth[_0xbd0b('0x8')](),controller[_0xbd0b('0x10')]);router['delete'](_0xbd0b('0xc'),auth[_0xbd0b('0x8')](),controller[_0xbd0b('0x11')]);module[_0xbd0b('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 38399d9..091749d 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 _0xd2ed=['dialer','DATE','INTEGER','sequelize','exports','STRING','ENUM','inbound','internal','outbound','inbound-fax'];(function(_0x26b5af,_0x38291e){var _0x13dad4=function(_0x56117c){while(--_0x56117c){_0x26b5af['push'](_0x26b5af['shift']());}};_0x13dad4(++_0x38291e);}(_0xd2ed,0x14d));var _0xdd2e=function(_0x328bb6,_0x8d69fd){_0x328bb6=_0x328bb6-0x0;var _0x2f4c7f=_0xd2ed[_0x328bb6];return _0x2f4c7f;};'use strict';var Sequelize=require(_0xdd2e('0x0'));module[_0xdd2e('0x1')]={'uniqueid':{'type':Sequelize[_0xdd2e('0x2')]},'type':{'type':Sequelize[_0xdd2e('0x3')](_0xdd2e('0x4'),_0xdd2e('0x5'),_0xdd2e('0x6'),_0xdd2e('0x7'),'outbound-fax',_0xdd2e('0x8'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xdd2e('0x2')]},'source':{'type':Sequelize[_0xdd2e('0x2')]},'destination':{'type':Sequelize[_0xdd2e('0x2')]},'destinationcontext':{'type':Sequelize[_0xdd2e('0x2')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xdd2e('0x2')]},'destinationchannel':{'type':Sequelize[_0xdd2e('0x2')]},'lastapplication':{'type':Sequelize[_0xdd2e('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0xdd2e('0x9')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xdd2e('0x9')]},'duration':{'type':Sequelize[_0xdd2e('0xa')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xdd2e('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xdd2e('0x2')]},'userfield':{'type':Sequelize[_0xdd2e('0x2')]},'userDisposition':{'type':Sequelize[_0xdd2e('0x2')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0xdd2e('0x2')]},'note':{'type':Sequelize[_0xdd2e('0x2')]},'prefix':{'type':Sequelize[_0xdd2e('0x2')]},'routeid':{'type':Sequelize[_0xdd2e('0xa')]},'sipcallid':{'type':Sequelize[_0xdd2e('0x2')]}}; \ No newline at end of file +var _0xbfba=['exports','STRING','ENUM','inbound','internal','inbound-fax','dialer','TEXT','DATE','INTEGER','sequelize'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xbfba,0x1ac));var _0xabfb=function(_0xe571b7,_0x4d9a13){_0xe571b7=_0xe571b7-0x0;var _0x4eca74=_0xbfba[_0xe571b7];return _0x4eca74;};'use strict';var Sequelize=require(_0xabfb('0x0'));module[_0xabfb('0x1')]={'uniqueid':{'type':Sequelize[_0xabfb('0x2')]},'type':{'type':Sequelize[_0xabfb('0x3')](_0xabfb('0x4'),_0xabfb('0x5'),'outbound',_0xabfb('0x6'),'outbound-fax',_0xabfb('0x7'))},'tag':{'type':Sequelize[_0xabfb('0x2')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xabfb('0x2')]},'channel':{'type':Sequelize[_0xabfb('0x2')]},'destinationchannel':{'type':Sequelize[_0xabfb('0x2')]},'lastapplication':{'type':Sequelize[_0xabfb('0x2')]},'lastdata':{'type':Sequelize[_0xabfb('0x8')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0xabfb('0x9')]},'answertime':{'type':Sequelize[_0xabfb('0x9')]},'endtime':{'type':Sequelize[_0xabfb('0x9')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xabfb('0xa')]},'mohtime':{'type':Sequelize[_0xabfb('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xabfb('0x2')]},'amaflags':{'type':Sequelize[_0xabfb('0x2')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0xabfb('0x2')]},'userSecondDisposition':{'type':Sequelize[_0xabfb('0x2')]},'userThirdDisposition':{'type':Sequelize[_0xabfb('0x2')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xabfb('0x2')]},'routeid':{'type':Sequelize[_0xabfb('0xa')]},'sipcallid':{'type':Sequelize[_0xabfb('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index d57e2e8..ecca20c 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 _0x5f66=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','VoiceCallReport','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','type','VIRTUAL','includeAll','include','fullname','alias','User','rows','catch','show','params','find','create','body','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x5f66[_0x3e5086];return _0xfeb102;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65f6('0x1'));var rp=require(_0x65f6('0x2'));var moment=require(_0x65f6('0x3'));var BPromise=require(_0x65f6('0x4'));var Mustache=require(_0x65f6('0x5'));var util=require('util');var path=require(_0x65f6('0x6'));var sox=require('sox');var csv=require(_0x65f6('0x7'));var ejs=require(_0x65f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x7'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65f6('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419819,_0x4862a5){_0x4862a5=_0x4862a5||0xcc;return function(_0x2f964a){if(_0x2f964a){return _0x419819[_0x65f6('0x14')](_0x4862a5);}return _0x419819[_0x65f6('0x15')](_0x4862a5)[_0x65f6('0x16')]();};}function respondWithResult(_0x369f96,_0x1d29fd){_0x1d29fd=_0x1d29fd||0xc8;return function(_0x44144b){if(_0x44144b){return _0x369f96[_0x65f6('0x15')](_0x1d29fd)[_0x65f6('0x17')](_0x44144b);}};}function respondWithFilteredResult(_0x3440af,_0x59154e){return function(_0x19b9ff){if(_0x19b9ff){var _0x49a913=typeof _0x59154e['offset']===_0x65f6('0x18')&&typeof _0x59154e[_0x65f6('0x19')]===_0x65f6('0x18');var _0x1c955c=_0x19b9ff[_0x65f6('0x1a')];var _0x1f974c=_0x49a913?0x0:_0x59154e[_0x65f6('0x1b')];var _0x18380e=_0x49a913?_0x19b9ff['count']:_0x59154e['offset']+_0x59154e[_0x65f6('0x19')];var _0x5b4055;if(_0x18380e>=_0x1c955c){_0x18380e=_0x1c955c;_0x5b4055=0xc8;}else{_0x5b4055=0xce;}_0x3440af['status'](_0x5b4055);return _0x3440af['set'](_0x65f6('0x1c'),_0x1f974c+'-'+_0x18380e+'/'+_0x1c955c)[_0x65f6('0x17')](_0x19b9ff);}return null;};}function patchUpdates(_0x5114a4){return function(_0x39e19f){try{jsonpatch[_0x65f6('0x1d')](_0x39e19f,_0x5114a4,!![]);}catch(_0xbee6a4){return BPromise[_0x65f6('0x1e')](_0xbee6a4);}return _0x39e19f[_0x65f6('0x1f')]();};}function saveUpdates(_0xc139c2,_0x581374){return function(_0x197a49){if(_0x197a49){return _0x197a49['update'](_0xc139c2)['then'](function(_0x212247){return _0x212247;});}return null;};}function removeEntity(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(_0x1eeaaa){return _0x1eeaaa[_0x65f6('0x20')]()[_0x65f6('0x21')](function(){_0xd173f4[_0x65f6('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d7bb0,_0x59ea32){return function(_0x20a161){if(!_0x20a161){_0x9d7bb0['sendStatus'](0x194);}return _0x20a161;};}function handleError(_0x5cb131,_0x4fde2f){_0x4fde2f=_0x4fde2f||0x1f4;return function(_0x29abdb){logger[_0x65f6('0x22')](_0x29abdb['stack']);if(_0x29abdb[_0x65f6('0x23')]){delete _0x29abdb[_0x65f6('0x23')];}_0x5cb131['status'](_0x4fde2f)[_0x65f6('0x24')](_0x29abdb);};}exports[_0x65f6('0x25')]=function(_0x28d0df,_0x559330){var _0x4ac04b={},_0x488d36={},_0x266cfe={'count':0x0,'rows':[]};var _0x3c032f=_[_0x65f6('0x26')](db[_0x65f6('0x27')][_0x65f6('0x28')],function(_0x14a387){return{'name':_0x14a387[_0x65f6('0x29')],'type':_0x14a387['type']['key']};});_0x488d36[_0x65f6('0x2a')]=_[_0x65f6('0x26')](_0x3c032f,'name');_0x488d36['query']=_[_0x65f6('0x2b')](_0x28d0df[_0x65f6('0x2c')]);_0x488d36[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],_0x488d36[_0x65f6('0x2c')]);_0x4ac04b['attributes']=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x28d0df['query'][_0x65f6('0x2f')]));_0x4ac04b[_0x65f6('0x30')]=_0x4ac04b[_0x65f6('0x30')][_0x65f6('0x31')]?_0x4ac04b[_0x65f6('0x30')]:_0x488d36[_0x65f6('0x2a')];if(!_0x28d0df['query'][_0x65f6('0x32')](_0x65f6('0x33'))){_0x4ac04b['limit']=qs[_0x65f6('0x19')](_0x28d0df['query'][_0x65f6('0x19')]);_0x4ac04b['offset']=qs[_0x65f6('0x1b')](_0x28d0df[_0x65f6('0x2c')]['offset']);}_0x4ac04b[_0x65f6('0x34')]=qs[_0x65f6('0x35')](_0x28d0df[_0x65f6('0x2c')]['sort']);_0x4ac04b['where']=qs[_0x65f6('0x2d')](_['pick'](_0x28d0df[_0x65f6('0x2c')],_0x488d36['filters']),_0x3c032f);if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]){_0x4ac04b['where']=_[_0x65f6('0x37')](_0x4ac04b['where'],{'$or':_['map'](_0x3c032f,function(_0x71b16b){if(_0x71b16b[_0x65f6('0x38')]!==_0x65f6('0x39')){var _0x313be5={};_0x313be5[_0x71b16b[_0x65f6('0x23')]]={'$like':'%'+_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]+'%'};return _0x313be5;}})});}_0x4ac04b=_[_0x65f6('0x37')]({},_0x4ac04b,_0x28d0df['options']);var _0x3aa254={'where':_0x4ac04b['where']};return db[_0x65f6('0x27')][_0x65f6('0x1a')](_0x3aa254)[_0x65f6('0x21')](function(_0x2ea7f7){_0x266cfe['count']=_0x2ea7f7;if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x4ac04b[_0x65f6('0x3b')]=[{'attributes':['id',_0x65f6('0x23'),_0x65f6('0x3c'),_0x65f6('0x3d')],'model':db[_0x65f6('0x3e')],'as':_0x65f6('0x3e')}];}return db[_0x65f6('0x27')]['findAll'](_0x4ac04b);})[_0x65f6('0x21')](function(_0x400ed2){_0x266cfe[_0x65f6('0x3f')]=_0x400ed2;return _0x266cfe;})[_0x65f6('0x21')](respondWithFilteredResult(_0x559330,_0x4ac04b))[_0x65f6('0x40')](handleError(_0x559330,null));};exports[_0x65f6('0x41')]=function(_0xe0b72d,_0x2e91e8){var _0x461393={'raw':!![],'where':{'id':_0xe0b72d[_0x65f6('0x42')]['id']}},_0x2abbed={};_0x2abbed[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](db[_0x65f6('0x27')][_0x65f6('0x28')]);_0x2abbed[_0x65f6('0x2c')]=_['keys'](_0xe0b72d[_0x65f6('0x2c')]);_0x2abbed[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],_0x2abbed['query']);_0x461393[_0x65f6('0x30')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],qs['fields'](_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x2f')]));_0x461393[_0x65f6('0x30')]=_0x461393[_0x65f6('0x30')]['length']?_0x461393[_0x65f6('0x30')]:_0x2abbed['model'];if(_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x461393['include']=[{'all':!![]}];}_0x461393=_[_0x65f6('0x37')]({},_0x461393,_0xe0b72d['options']);return db[_0x65f6('0x27')][_0x65f6('0x43')](_0x461393)[_0x65f6('0x21')](handleEntityNotFound(_0x2e91e8,null))[_0x65f6('0x21')](respondWithResult(_0x2e91e8,null))[_0x65f6('0x40')](handleError(_0x2e91e8,null));};exports[_0x65f6('0x44')]=function(_0x4d30c5,_0x51bf6c){return db[_0x65f6('0x27')][_0x65f6('0x44')](_0x4d30c5[_0x65f6('0x45')],{})[_0x65f6('0x21')](respondWithResult(_0x51bf6c,0xc9))[_0x65f6('0x40')](handleError(_0x51bf6c,null));};exports[_0x65f6('0x20')]=function(_0x149c28,_0x41690c){return db[_0x65f6('0x27')]['find']({'where':{'id':_0x149c28[_0x65f6('0x42')]['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x41690c,null))[_0x65f6('0x21')](removeEntity(_0x41690c,null))['catch'](handleError(_0x41690c,null));};exports[_0x65f6('0x46')]=function(_0x42d453,_0x49ba5a){return db[_0x65f6('0x27')][_0x65f6('0x46')]()['then'](respondWithResult(_0x49ba5a,null))[_0x65f6('0x40')](handleError(_0x49ba5a,null));};exports['update']=function(_0x247be3,_0x3b241f){if(_0x247be3[_0x65f6('0x45')]['uniqueid']){delete _0x247be3[_0x65f6('0x45')][_0x65f6('0x47')];}return db['VoiceCallReport'][_0x65f6('0x43')]({'where':{'uniqueid':_0x247be3[_0x65f6('0x42')]['id'],'UserId':{'$or':[null,_0x247be3['user']['id']]}}})[_0x65f6('0x21')](handleEntityNotFound(_0x3b241f,null))[_0x65f6('0x21')](saveUpdates(_0x247be3[_0x65f6('0x45')],null))[_0x65f6('0x21')](respondWithResult(_0x3b241f,null))[_0x65f6('0x40')](handleError(_0x3b241f,null));}; \ No newline at end of file +var _0xadb5=['filter','VIRTUAL','merge','options','includeAll','include','fullname','User','findAll','rows','show','rawAttributes','length','find','catch','body','params','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters'];(function(_0x36a469,_0x59d84c){var _0x3347fc=function(_0x3860e7){while(--_0x3860e7){_0x36a469['push'](_0x36a469['shift']());}};_0x3347fc(++_0x59d84c);}(_0xadb5,0xad));var _0x5adb=function(_0x3cc6a0,_0x839cc5){_0x3cc6a0=_0x3cc6a0-0x0;var _0x3473a0=_0xadb5[_0x3cc6a0];return _0x3473a0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['VoiceCallReport']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'attributes':['id',_0x5adb('0x26'),_0x5adb('0x40'),'alias'],'model':db['User'],'as':_0x5adb('0x41')}];}return db['VoiceCallReport'][_0x5adb('0x42')](_0x5d457e);})[_0x5adb('0x22')](function(_0x299746){_0x1eac55[_0x5adb('0x43')]=_0x299746;return _0x1eac55;})[_0x5adb('0x22')](respondWithFilteredResult(_0x49992e,_0x5d457e))['catch'](handleError(_0x49992e,null));};exports[_0x5adb('0x44')]=function(_0x565b03,_0x508690){var _0x4160ad={'raw':!![],'where':{'id':_0x565b03['params']['id']}},_0x1a256c={};_0x1a256c[_0x5adb('0x2e')]=_[_0x5adb('0x30')](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x1a256c[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x565b03[_0x5adb('0x2f')]);_0x1a256c['filters']=_['intersection'](_0x1a256c[_0x5adb('0x2e')],_0x1a256c[_0x5adb('0x2f')]);_0x4160ad[_0x5adb('0x32')]=_[_0x5adb('0x31')](_0x1a256c['model'],qs['fields'](_0x565b03[_0x5adb('0x2f')][_0x5adb('0x33')]));_0x4160ad[_0x5adb('0x32')]=_0x4160ad[_0x5adb('0x32')][_0x5adb('0x46')]?_0x4160ad['attributes']:_0x1a256c[_0x5adb('0x2e')];if(_0x565b03[_0x5adb('0x2f')]['includeAll']){_0x4160ad[_0x5adb('0x3f')]=[{'all':!![]}];}_0x4160ad=_[_0x5adb('0x3c')]({},_0x4160ad,_0x565b03[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')][_0x5adb('0x47')](_0x4160ad)[_0x5adb('0x22')](handleEntityNotFound(_0x508690,null))[_0x5adb('0x22')](respondWithResult(_0x508690,null))[_0x5adb('0x48')](handleError(_0x508690,null));};exports['create']=function(_0x3a925b,_0x57dc8b){return db['VoiceCallReport']['create'](_0x3a925b[_0x5adb('0x49')],{})[_0x5adb('0x22')](respondWithResult(_0x57dc8b,0xc9))[_0x5adb('0x48')](handleError(_0x57dc8b,null));};exports['destroy']=function(_0x2ad69d,_0x5cbab5){return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'id':_0x2ad69d[_0x5adb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5cbab5,null))[_0x5adb('0x22')](removeEntity(_0x5cbab5,null))['catch'](handleError(_0x5cbab5,null));};exports[_0x5adb('0x4b')]=function(_0x6dc067,_0x55c535){return db[_0x5adb('0x2a')][_0x5adb('0x4b')]()[_0x5adb('0x22')](respondWithResult(_0x55c535,null))[_0x5adb('0x48')](handleError(_0x55c535,null));};exports[_0x5adb('0x21')]=function(_0x4cb36c,_0x36b847){if(_0x4cb36c[_0x5adb('0x49')][_0x5adb('0x4c')]){delete _0x4cb36c[_0x5adb('0x49')]['uniqueid'];}return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'uniqueid':_0x4cb36c[_0x5adb('0x4a')]['id'],'UserId':{'$or':[null,_0x4cb36c['user']['id']]}}})[_0x5adb('0x22')](handleEntityNotFound(_0x36b847,null))[_0x5adb('0x22')](saveUpdates(_0x4cb36c[_0x5adb('0x49')],null))[_0x5adb('0x22')](respondWithResult(_0x36b847,null))['catch'](handleError(_0x36b847,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index d6780f0..cd97f09 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 _0xc9f5=['path','rimraf','../../config/environment','exports','define','VoiceCallReport','report_call','uniqueid','lodash','../../config/logger','moment','request-promise'];(function(_0x26ac23,_0x1e78b2){var _0x399b36=function(_0x54616f){while(--_0x54616f){_0x26ac23['push'](_0x26ac23['shift']());}};_0x399b36(++_0x1e78b2);}(_0xc9f5,0x14c));var _0x5c9f=function(_0x3817a9,_0x29e215){_0x3817a9=_0x3817a9-0x0;var _0x443f30=_0xc9f5[_0x3817a9];return _0x443f30;};'use strict';var _=require(_0x5c9f('0x0'));var util=require('util');var logger=require(_0x5c9f('0x1'))('api');var moment=require(_0x5c9f('0x2'));var BPromise=require('bluebird');var rp=require(_0x5c9f('0x3'));var fs=require('fs');var path=require(_0x5c9f('0x4'));var rimraf=require(_0x5c9f('0x5'));var config=require(_0x5c9f('0x6'));var attributes=require('./voiceCallReport.attributes');module[_0x5c9f('0x7')]=function(_0x3cc4b2,_0x5c1957){return _0x3cc4b2[_0x5c9f('0x8')](_0x5c9f('0x9'),attributes,{'tableName':_0x5c9f('0xa'),'paranoid':![],'indexes':[{'fields':[_0x5c9f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xca06=['api','moment','bluebird','request-promise','path','./voiceCallReport.attributes','define','VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger'];(function(_0x3f18d9,_0x3b2f8f){var _0x243ff4=function(_0xee1c4a){while(--_0xee1c4a){_0x3f18d9['push'](_0x3f18d9['shift']());}};_0x243ff4(++_0x3b2f8f);}(_0xca06,0x142));var _0x6ca0=function(_0x79a38f,_0x5162c7){_0x79a38f=_0x79a38f-0x0;var _0x3cc8b7=_0xca06[_0x79a38f];return _0x3cc8b7;};'use strict';var _=require(_0x6ca0('0x0'));var util=require(_0x6ca0('0x1'));var logger=require(_0x6ca0('0x2'))(_0x6ca0('0x3'));var moment=require(_0x6ca0('0x4'));var BPromise=require(_0x6ca0('0x5'));var rp=require(_0x6ca0('0x6'));var fs=require('fs');var path=require(_0x6ca0('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6ca0('0x8'));module['exports']=function(_0x536caa,_0x27f756){return _0x536caa[_0x6ca0('0x9')](_0x6ca0('0xa'),attributes,{'tableName':_0x6ca0('0xb'),'paranoid':![],'indexes':[{'fields':[_0x6ca0('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 3dc8ce3..255c36e 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 _0x36d3=['include','map','model','attributes','stringify','VoiceCallReport','body','CreateVoiceCallReport','UpdateVoiceCallReport','update','where','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','code','VoiceCallReport,\x20%s,\x20%s','message','info','catch','GetVoiceCallReport','findAll','options','raw'];(function(_0x1e16fa,_0x229f1e){var _0x5c9a39=function(_0x283170){while(--_0x283170){_0x1e16fa['push'](_0x1e16fa['shift']());}};_0x5c9a39(++_0x229f1e);}(_0x36d3,0x13d));var _0x336d=function(_0x5e6489,_0x38abf6){_0x5e6489=_0x5e6489-0x0;var _0x1c51b1=_0x36d3[_0x5e6489];return _0x1c51b1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x336d('0x0'));var BPromise=require(_0x336d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x336d('0x2'));var db=require(_0x336d('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x336d('0x4'))(_0x336d('0x5'));var config=require(_0x336d('0x6'));var jayson=require(_0x336d('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3a1576,_0x5e9f18,_0x3b9a88){return new BPromise(function(_0x1c99c6,_0x143baf){return client[_0x336d('0x8')](_0x3a1576,_0x3b9a88)[_0x336d('0x9')](function(_0x3b2b39){logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x5e9f18,_0x336d('0xa'));logger[_0x336d('0xb')](_0x336d('0xc'),_0x5e9f18,_0x336d('0xa'),JSON['stringify'](_0x3b2b39));if(_0x3b2b39[_0x336d('0xd')]){if(_0x3b2b39[_0x336d('0xd')][_0x336d('0xe')]===0x1f4){logger[_0x336d('0xd')](_0x336d('0xf'),_0x5e9f18,_0x3b2b39[_0x336d('0xd')]['message']);return _0x143baf(_0x3b2b39['error'][_0x336d('0x10')]);}logger[_0x336d('0xd')](_0x336d('0xf'),_0x5e9f18,_0x3b2b39['error'][_0x336d('0x10')]);return _0x1c99c6(_0x3b2b39[_0x336d('0xd')][_0x336d('0x10')]);}else{logger[_0x336d('0x11')](_0x336d('0xf'),_0x5e9f18,_0x336d('0xa'));_0x1c99c6(_0x3b2b39['result'][_0x336d('0x10')]);}})[_0x336d('0x12')](function(_0x22a25c){logger[_0x336d('0xd')](_0x336d('0xf'),_0x5e9f18,_0x22a25c);_0x143baf(_0x22a25c);});});}exports[_0x336d('0x13')]=function(_0x5d69de){var _0x143440=this;return new Promise(function(_0x4df783,_0x355d76){return db['VoiceCallReport'][_0x336d('0x14')]({'raw':_0x5d69de[_0x336d('0x15')]?_0x5d69de[_0x336d('0x15')][_0x336d('0x16')]===undefined?!![]:![]:!![],'where':_0x5d69de[_0x336d('0x15')]?_0x5d69de['options']['where']||null:null,'attributes':_0x5d69de[_0x336d('0x15')]?_0x5d69de[_0x336d('0x15')]['attributes']||null:null,'limit':_0x5d69de['options']?_0x5d69de[_0x336d('0x15')]['limit']||null:null,'include':_0x5d69de['options']?_0x5d69de[_0x336d('0x15')][_0x336d('0x17')]?_[_0x336d('0x18')](_0x5d69de['options'][_0x336d('0x17')],function(_0x42d7fe){return{'model':db[_0x42d7fe[_0x336d('0x19')]],'as':_0x42d7fe['as'],'attributes':_0x42d7fe[_0x336d('0x1a')],'include':_0x42d7fe[_0x336d('0x17')]?_['map'](_0x42d7fe[_0x336d('0x17')],function(_0x203156){return{'model':db[_0x203156[_0x336d('0x19')]],'as':_0x203156['as'],'attributes':_0x203156[_0x336d('0x1a')],'include':_0x203156['include']?_['map'](_0x203156[_0x336d('0x17')],function(_0x564f18){return{'model':db[_0x564f18[_0x336d('0x19')]],'as':_0x564f18['as'],'attributes':_0x564f18[_0x336d('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x517ed1){logger['info'](_0x336d('0x13'),_0x5d69de);logger[_0x336d('0xb')](_0x336d('0x13'),_0x5d69de,JSON[_0x336d('0x1b')](_0x517ed1));_0x4df783(_0x517ed1);})['catch'](function(_0x21083c){logger[_0x336d('0xd')]('GetVoiceCallReport',_0x21083c['message'],_0x5d69de);_0x355d76(_0x143440['error'](0x1f4,_0x21083c['message']));});});};exports['CreateVoiceCallReport']=function(_0x334fc3){var _0x244e78=this;return new Promise(function(_0x41d205,_0x5d8055){return db[_0x336d('0x1c')]['create'](_0x334fc3[_0x336d('0x1d')],{'raw':_0x334fc3[_0x336d('0x15')]?_0x334fc3[_0x336d('0x15')][_0x336d('0x16')]===undefined?!![]:![]:!![]})[_0x336d('0x9')](function(_0x12e4e2){logger[_0x336d('0x11')](_0x336d('0x1e'),_0x334fc3);logger[_0x336d('0xb')]('CreateVoiceCallReport',_0x334fc3,JSON[_0x336d('0x1b')](_0x12e4e2));_0x41d205(_0x12e4e2);})[_0x336d('0x12')](function(_0x88c57d){logger[_0x336d('0xd')]('CreateVoiceCallReport',_0x88c57d[_0x336d('0x10')],_0x334fc3);_0x5d8055(_0x244e78[_0x336d('0xd')](0x1f4,_0x88c57d[_0x336d('0x10')]));});});};exports[_0x336d('0x1f')]=function(_0x491e2c){var _0x392847=this;return new Promise(function(_0x44bb34,_0x125cc6){return db[_0x336d('0x1c')][_0x336d('0x20')](_0x491e2c[_0x336d('0x1d')],{'raw':_0x491e2c['options']?_0x491e2c['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x491e2c[_0x336d('0x15')]?_0x491e2c['options'][_0x336d('0x21')]||null:null,'attributes':_0x491e2c[_0x336d('0x15')]?_0x491e2c[_0x336d('0x15')]['attributes']||null:null,'limit':_0x491e2c[_0x336d('0x15')]?_0x491e2c[_0x336d('0x15')]['limit']||null:null})[_0x336d('0x9')](function(_0x6ec01f){logger[_0x336d('0x11')]('UpdateVoiceCallReport',_0x491e2c);logger['debug'](_0x336d('0x1f'),_0x491e2c,JSON['stringify'](_0x6ec01f));_0x44bb34(_0x6ec01f);})['catch'](function(_0x21f16c){logger[_0x336d('0xd')](_0x336d('0x1f'),_0x21f16c[_0x336d('0x10')],_0x491e2c);_0x125cc6(_0x392847['error'](0x1f4,_0x21f16c[_0x336d('0x10')]));});});}; \ No newline at end of file +var _0xeebb=['update','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','VoiceCallReport,\x20%s,\x20%s','info','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','limit','map','include','model','attributes','stringify','CreateVoiceCallReport','create','body','UpdateVoiceCallReport'];(function(_0x2fa568,_0x5665fb){var _0x3fa2f7=function(_0x7dd701){while(--_0x7dd701){_0x2fa568['push'](_0x2fa568['shift']());}};_0x3fa2f7(++_0x5665fb);}(_0xeebb,0x172));var _0xbeeb=function(_0x203f4c,_0x12a096){_0x203f4c=_0x203f4c-0x0;var _0x3cf56e=_0xeebb[_0x203f4c];return _0x3cf56e;};'use strict';var _=require(_0xbeeb('0x0'));var util=require(_0xbeeb('0x1'));var moment=require(_0xbeeb('0x2'));var BPromise=require(_0xbeeb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbeeb('0x4'));var db=require(_0xbeeb('0x5'))['db'];var utils=require(_0xbeeb('0x6'));var logger=require(_0xbeeb('0x7'))(_0xbeeb('0x8'));var config=require(_0xbeeb('0x9'));var jayson=require(_0xbeeb('0xa'));var client=jayson['client'][_0xbeeb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b3d61,_0x5610da,_0x1b0d99){return new BPromise(function(_0x14c46a,_0x508d4b){return client[_0xbeeb('0xc')](_0x5b3d61,_0x1b0d99)[_0xbeeb('0xd')](function(_0x5d5d45){logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x5610da,'request\x20sent');logger[_0xbeeb('0xe')](_0xbeeb('0xf'),_0x5610da,_0xbeeb('0x10'),JSON['stringify'](_0x5d5d45));if(_0x5d5d45[_0xbeeb('0x11')]){if(_0x5d5d45['error'][_0xbeeb('0x12')]===0x1f4){logger[_0xbeeb('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x5610da,_0x5d5d45['error'][_0xbeeb('0x13')]);return _0x508d4b(_0x5d5d45[_0xbeeb('0x11')][_0xbeeb('0x13')]);}logger[_0xbeeb('0x11')](_0xbeeb('0x14'),_0x5610da,_0x5d5d45[_0xbeeb('0x11')]['message']);return _0x14c46a(_0x5d5d45[_0xbeeb('0x11')]['message']);}else{logger[_0xbeeb('0x15')](_0xbeeb('0x14'),_0x5610da,_0xbeeb('0x10'));_0x14c46a(_0x5d5d45[_0xbeeb('0x16')][_0xbeeb('0x13')]);}})[_0xbeeb('0x17')](function(_0x1b0854){logger[_0xbeeb('0x11')](_0xbeeb('0x14'),_0x5610da,_0x1b0854);_0x508d4b(_0x1b0854);});});}exports[_0xbeeb('0x18')]=function(_0x120552){var _0x327478=this;return new Promise(function(_0x5ac57d,_0x1589e6){return db[_0xbeeb('0x19')][_0xbeeb('0x1a')]({'raw':_0x120552['options']?_0x120552[_0xbeeb('0x1b')][_0xbeeb('0x1c')]===undefined?!![]:![]:!![],'where':_0x120552['options']?_0x120552[_0xbeeb('0x1b')][_0xbeeb('0x1d')]||null:null,'attributes':_0x120552[_0xbeeb('0x1b')]?_0x120552['options']['attributes']||null:null,'limit':_0x120552[_0xbeeb('0x1b')]?_0x120552['options'][_0xbeeb('0x1e')]||null:null,'include':_0x120552['options']?_0x120552[_0xbeeb('0x1b')]['include']?_[_0xbeeb('0x1f')](_0x120552[_0xbeeb('0x1b')][_0xbeeb('0x20')],function(_0x348ac5){return{'model':db[_0x348ac5['model']],'as':_0x348ac5['as'],'attributes':_0x348ac5['attributes'],'include':_0x348ac5['include']?_[_0xbeeb('0x1f')](_0x348ac5[_0xbeeb('0x20')],function(_0x30e879){return{'model':db[_0x30e879['model']],'as':_0x30e879['as'],'attributes':_0x30e879['attributes'],'include':_0x30e879[_0xbeeb('0x20')]?_[_0xbeeb('0x1f')](_0x30e879['include'],function(_0x16cc62){return{'model':db[_0x16cc62[_0xbeeb('0x21')]],'as':_0x16cc62['as'],'attributes':_0x16cc62[_0xbeeb('0x22')]};}):[]};}):[]};}):[]:[]})[_0xbeeb('0xd')](function(_0x13e4d0){logger[_0xbeeb('0x15')](_0xbeeb('0x18'),_0x120552);logger['debug']('GetVoiceCallReport',_0x120552,JSON[_0xbeeb('0x23')](_0x13e4d0));_0x5ac57d(_0x13e4d0);})[_0xbeeb('0x17')](function(_0x5375e3){logger[_0xbeeb('0x11')](_0xbeeb('0x18'),_0x5375e3[_0xbeeb('0x13')],_0x120552);_0x1589e6(_0x327478['error'](0x1f4,_0x5375e3['message']));});});};exports[_0xbeeb('0x24')]=function(_0x224db1){var _0x381fbb=this;return new Promise(function(_0x594b39,_0x29c77f){return db[_0xbeeb('0x19')][_0xbeeb('0x25')](_0x224db1[_0xbeeb('0x26')],{'raw':_0x224db1[_0xbeeb('0x1b')]?_0x224db1[_0xbeeb('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xbeeb('0xd')](function(_0x232c40){logger[_0xbeeb('0x15')](_0xbeeb('0x24'),_0x224db1);logger[_0xbeeb('0xe')](_0xbeeb('0x24'),_0x224db1,JSON[_0xbeeb('0x23')](_0x232c40));_0x594b39(_0x232c40);})[_0xbeeb('0x17')](function(_0x4a813e){logger[_0xbeeb('0x11')](_0xbeeb('0x24'),_0x4a813e[_0xbeeb('0x13')],_0x224db1);_0x29c77f(_0x381fbb['error'](0x1f4,_0x4a813e[_0xbeeb('0x13')]));});});};exports[_0xbeeb('0x27')]=function(_0x5cf5a9){var _0xf7c303=this;return new Promise(function(_0x5d55e0,_0x520ca8){return db[_0xbeeb('0x19')][_0xbeeb('0x28')](_0x5cf5a9[_0xbeeb('0x26')],{'raw':_0x5cf5a9[_0xbeeb('0x1b')]?_0x5cf5a9[_0xbeeb('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5cf5a9[_0xbeeb('0x1b')]?_0x5cf5a9[_0xbeeb('0x1b')]['where']||null:null,'attributes':_0x5cf5a9[_0xbeeb('0x1b')]?_0x5cf5a9[_0xbeeb('0x1b')][_0xbeeb('0x22')]||null:null,'limit':_0x5cf5a9[_0xbeeb('0x1b')]?_0x5cf5a9[_0xbeeb('0x1b')][_0xbeeb('0x1e')]||null:null})[_0xbeeb('0xd')](function(_0xd309f3){logger[_0xbeeb('0x15')](_0xbeeb('0x27'),_0x5cf5a9);logger[_0xbeeb('0xe')](_0xbeeb('0x27'),_0x5cf5a9,JSON['stringify'](_0xd309f3));_0x5d55e0(_0xd309f3);})[_0xbeeb('0x17')](function(_0x3b6f8c){logger[_0xbeeb('0x11')]('UpdateVoiceCallReport',_0x3b6f8c[_0xbeeb('0x13')],_0x5cf5a9);_0x520ca8(_0xf7c303[_0xbeeb('0x11')](0x1f4,_0x3b6f8c[_0xbeeb('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 78889b3..b0e4f58 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 _0x348e=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','index','/:id','isAuthenticated','post','create','update','delete','exports','multer','path'];(function(_0x5c9712,_0x69c801){var _0x59ba56=function(_0x41661e){while(--_0x41661e){_0x5c9712['push'](_0x5c9712['shift']());}};_0x59ba56(++_0x69c801);}(_0x348e,0x166));var _0xe348=function(_0x13b755,_0x5c5422){_0x13b755=_0x13b755-0x0;var _0x1b156d=_0x348e[_0x13b755];return _0x1b156d;};'use strict';var multer=require(_0xe348('0x0'));var util=require('util');var path=require(_0xe348('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe348('0x2'));var interaction=require(_0xe348('0x3'));var config=require(_0xe348('0x4'));var controller=require(_0xe348('0x5'));router[_0xe348('0x6')]('/',auth['isAuthenticated'](),controller[_0xe348('0x7')]);router['get'](_0xe348('0x8'),auth[_0xe348('0x9')](),controller['show']);router[_0xe348('0xa')]('/',auth[_0xe348('0x9')](),controller[_0xe348('0xb')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xe348('0xc')]);router[_0xe348('0xd')](_0xe348('0x8'),auth[_0xe348('0x9')](),controller['destroy']);module[_0xe348('0xe')]=router; \ No newline at end of file +var _0xb036=['exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy'];(function(_0x102fa8,_0x1f51ca){var _0x290480=function(_0x4e95d7){while(--_0x4e95d7){_0x102fa8['push'](_0x102fa8['shift']());}};_0x290480(++_0x1f51ca);}(_0xb036,0x67));var _0x6b03=function(_0x149d44,_0x1416b1){_0x149d44=_0x149d44-0x0;var _0x41653b=_0xb036[_0x149d44];return _0x41653b;};'use strict';var multer=require(_0x6b03('0x0'));var util=require('util');var path=require(_0x6b03('0x1'));var timeout=require(_0x6b03('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6b03('0x3'));var interaction=require(_0x6b03('0x4'));var config=require('../../config/environment');var controller=require(_0x6b03('0x5'));router[_0x6b03('0x6')]('/',auth[_0x6b03('0x7')](),controller[_0x6b03('0x8')]);router[_0x6b03('0x6')](_0x6b03('0x9'),auth['isAuthenticated'](),controller[_0x6b03('0xa')]);router[_0x6b03('0xb')]('/',auth[_0x6b03('0x7')](),controller['create']);router[_0x6b03('0xc')](_0x6b03('0x9'),auth[_0x6b03('0x7')](),controller[_0x6b03('0xd')]);router[_0x6b03('0xe')](_0x6b03('0x9'),auth[_0x6b03('0x7')](),controller[_0x6b03('0xf')]);module[_0x6b03('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 4c63c93..6b57738 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 _0xdacc=['STRING','name','setDataValue','options','join','BOOLEAN','sequelize','exports'];(function(_0x294e00,_0x37506a){var _0x171b4d=function(_0xeccb5b){while(--_0xeccb5b){_0x294e00['push'](_0x294e00['shift']());}};_0x171b4d(++_0x37506a);}(_0xdacc,0x17e));var _0xcdac=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xdacc[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xcdac('0x0'));module[_0xcdac('0x1')]={'name':{'type':Sequelize[_0xcdac('0x2')]},'prefix':{'type':Sequelize[_0xcdac('0x2')],'unique':_0xcdac('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xcdac('0x2')],'set':function(_0x1dcf62){this[_0xcdac('0x4')](_0xcdac('0x5'),_0x1dcf62?_0x1dcf62[_0xcdac('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0xcdac('0x5'))?this['getDataValue'](_0xcdac('0x5'))['split'](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0xcdac('0x2')]},'record':{'type':Sequelize[_0xcdac('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xcdac('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf4e7=['join','getDataValue','split','BOOLEAN','exports','STRING','setDataValue','options'];(function(_0x4849f0,_0x55be66){var _0x5a5e4d=function(_0xef5b6b){while(--_0xef5b6b){_0x4849f0['push'](_0x4849f0['shift']());}};_0x5a5e4d(++_0x55be66);}(_0xf4e7,0xbc));var _0x7f4e=function(_0x3bc1dc,_0x36927b){_0x3bc1dc=_0x3bc1dc-0x0;var _0x59aea8=_0xf4e7[_0x3bc1dc];return _0x59aea8;};'use strict';var Sequelize=require('sequelize');module[_0x7f4e('0x0')]={'name':{'type':Sequelize[_0x7f4e('0x1')]},'prefix':{'type':Sequelize[_0x7f4e('0x1')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0x7f4e('0x1')],'set':function(_0x56557b){this[_0x7f4e('0x2')](_0x7f4e('0x3'),_0x56557b?_0x56557b[_0x7f4e('0x4')](''):[]);},'get':function(){return this[_0x7f4e('0x5')](_0x7f4e('0x3'))?this['getDataValue']('options')[_0x7f4e('0x6')](''):[];}},'auth':{'type':Sequelize[_0x7f4e('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0x7f4e('0x1')]},'record':{'type':Sequelize[_0x7f4e('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x7f4e('0x1')]},'description':{'type':Sequelize[_0x7f4e('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 754e4ed..febbcb8 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 _0x8ce3=['hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChanSpies','UserProfileSection','autoAssociation','UserProfileResource','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','stack','name','send','map','VoiceChanSpy','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields'];(function(_0x359bbe,_0x5b7fcc){var _0x1b3353=function(_0x34b41c){while(--_0x34b41c){_0x359bbe['push'](_0x359bbe['shift']());}};_0x1b3353(++_0x5b7fcc);}(_0x8ce3,0xc3));var _0x38ce=function(_0x948e6c,_0x21ba9c){_0x948e6c=_0x948e6c-0x0;var _0x1302c5=_0x8ce3[_0x948e6c];return _0x1302c5;};'use strict';var emlformat=require(_0x38ce('0x0'));var rimraf=require(_0x38ce('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x38ce('0x2'));var rp=require(_0x38ce('0x3'));var moment=require(_0x38ce('0x4'));var BPromise=require(_0x38ce('0x5'));var Mustache=require(_0x38ce('0x6'));var util=require(_0x38ce('0x7'));var path=require(_0x38ce('0x8'));var sox=require(_0x38ce('0x9'));var csv=require('to-csv');var ejs=require(_0x38ce('0xa'));var fs=require('fs');var fs_extra=require(_0x38ce('0xb'));var _=require('lodash');var squel=require(_0x38ce('0xc'));var crypto=require(_0x38ce('0xd'));var jsforce=require(_0x38ce('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x38ce('0xf'));var querystring=require('querystring');var Papa=require(_0x38ce('0x10'));var Redis=require('ioredis');var authService=require(_0x38ce('0x11'));var qs=require(_0x38ce('0x12'));var as=require(_0x38ce('0x13'));var hardwareService=require(_0x38ce('0x14'));var logger=require(_0x38ce('0x15'))(_0x38ce('0x16'));var utils=require(_0x38ce('0x17'));var config=require(_0x38ce('0x18'));var licenseUtil=require(_0x38ce('0x19'));var db=require(_0x38ce('0x1a'))['db'];function respondWithStatusCode(_0x42e234,_0x3ef662){_0x3ef662=_0x3ef662||0xcc;return function(_0x28b554){if(_0x28b554){return _0x42e234[_0x38ce('0x1b')](_0x3ef662);}return _0x42e234[_0x38ce('0x1c')](_0x3ef662)[_0x38ce('0x1d')]();};}function respondWithResult(_0x56a09f,_0x48ba7c){_0x48ba7c=_0x48ba7c||0xc8;return function(_0x3c4d7f){if(_0x3c4d7f){return _0x56a09f[_0x38ce('0x1c')](_0x48ba7c)[_0x38ce('0x1e')](_0x3c4d7f);}};}function respondWithFilteredResult(_0x55be6a,_0x2f3b99){return function(_0x54fcd3){if(_0x54fcd3){var _0x2771ec=typeof _0x2f3b99[_0x38ce('0x1f')]==='undefined'&&typeof _0x2f3b99[_0x38ce('0x20')]===_0x38ce('0x21');var _0x1dfaba=_0x54fcd3['count'];var _0xe4099a=_0x2771ec?0x0:_0x2f3b99[_0x38ce('0x1f')];var _0x3df527=_0x2771ec?_0x54fcd3[_0x38ce('0x22')]:_0x2f3b99[_0x38ce('0x1f')]+_0x2f3b99[_0x38ce('0x20')];var _0x2d4218;if(_0x3df527>=_0x1dfaba){_0x3df527=_0x1dfaba;_0x2d4218=0xc8;}else{_0x2d4218=0xce;}_0x55be6a['status'](_0x2d4218);return _0x55be6a[_0x38ce('0x23')](_0x38ce('0x24'),_0xe4099a+'-'+_0x3df527+'/'+_0x1dfaba)[_0x38ce('0x1e')](_0x54fcd3);}return null;};}function patchUpdates(_0x303391){return function(_0x30b060){try{jsonpatch[_0x38ce('0x25')](_0x30b060,_0x303391,!![]);}catch(_0x323490){return BPromise[_0x38ce('0x26')](_0x323490);}return _0x30b060[_0x38ce('0x27')]();};}function saveUpdates(_0x3cf50b,_0x1aace7){return function(_0x580cf3){if(_0x580cf3){return _0x580cf3[_0x38ce('0x28')](_0x3cf50b)[_0x38ce('0x29')](function(_0xe40e9c){return _0xe40e9c;});}return null;};}function removeEntity(_0xcf5d9e,_0x4a56b0){return function(_0x2c85e6){if(_0x2c85e6){return _0x2c85e6[_0x38ce('0x2a')]()['then'](function(){var _0xe0af00=_0x2c85e6[_0x38ce('0x2b')]({'plain':!![]});var _0x43b479='ChanSpies';return db['UserProfileResource'][_0x38ce('0x2a')]({'where':{'type':_0x43b479,'resourceId':_0xe0af00['id']}})[_0x38ce('0x29')](function(){return _0x2c85e6;});})[_0x38ce('0x29')](function(){_0xcf5d9e[_0x38ce('0x1c')](0xcc)[_0x38ce('0x1d')]();});}};}function handleEntityNotFound(_0x2a59fe,_0x13e2fc){return function(_0xce1f64){if(!_0xce1f64){_0x2a59fe[_0x38ce('0x1b')](0x194);}return _0xce1f64;};}function handleError(_0x4649be,_0xfc590a){_0xfc590a=_0xfc590a||0x1f4;return function(_0x381703){logger['error'](_0x381703[_0x38ce('0x2c')]);if(_0x381703[_0x38ce('0x2d')]){delete _0x381703['name'];}_0x4649be[_0x38ce('0x1c')](_0xfc590a)[_0x38ce('0x2e')](_0x381703);};}exports['index']=function(_0xd96d33,_0x282ee4){var _0x568d94={},_0x28d775={},_0x53f2c9={'count':0x0,'rows':[]};var _0x1aa8fb=_[_0x38ce('0x2f')](db[_0x38ce('0x30')][_0x38ce('0x31')],function(_0x444b93){return{'name':_0x444b93[_0x38ce('0x32')],'type':_0x444b93[_0x38ce('0x33')][_0x38ce('0x34')]};});_0x28d775['model']=_['map'](_0x1aa8fb,_0x38ce('0x2d'));_0x28d775[_0x38ce('0x35')]=_[_0x38ce('0x36')](_0xd96d33[_0x38ce('0x35')]);_0x28d775[_0x38ce('0x37')]=_['intersection'](_0x28d775[_0x38ce('0x38')],_0x28d775[_0x38ce('0x35')]);_0x568d94[_0x38ce('0x39')]=_[_0x38ce('0x3a')](_0x28d775[_0x38ce('0x38')],qs[_0x38ce('0x3b')](_0xd96d33[_0x38ce('0x35')]['fields']));_0x568d94[_0x38ce('0x39')]=_0x568d94[_0x38ce('0x39')]['length']?_0x568d94[_0x38ce('0x39')]:_0x28d775[_0x38ce('0x38')];if(!_0xd96d33[_0x38ce('0x35')][_0x38ce('0x3c')](_0x38ce('0x3d'))){_0x568d94[_0x38ce('0x20')]=qs[_0x38ce('0x20')](_0xd96d33[_0x38ce('0x35')]['limit']);_0x568d94[_0x38ce('0x1f')]=qs[_0x38ce('0x1f')](_0xd96d33[_0x38ce('0x35')][_0x38ce('0x1f')]);}_0x568d94['order']=qs[_0x38ce('0x3e')](_0xd96d33['query'][_0x38ce('0x3e')]);_0x568d94[_0x38ce('0x3f')]=qs[_0x38ce('0x37')](_[_0x38ce('0x40')](_0xd96d33[_0x38ce('0x35')],_0x28d775[_0x38ce('0x37')]),_0x1aa8fb);if(_0xd96d33['query'][_0x38ce('0x41')]){_0x568d94['where']=_[_0x38ce('0x42')](_0x568d94[_0x38ce('0x3f')],{'$or':_[_0x38ce('0x2f')](_0x1aa8fb,function(_0x37b738){if(_0x37b738[_0x38ce('0x33')]!==_0x38ce('0x43')){var _0x5209ee={};_0x5209ee[_0x37b738[_0x38ce('0x2d')]]={'$like':'%'+_0xd96d33[_0x38ce('0x35')][_0x38ce('0x41')]+'%'};return _0x5209ee;}})});}_0x568d94=_[_0x38ce('0x42')]({},_0x568d94,_0xd96d33[_0x38ce('0x44')]);var _0x467d3e={'where':_0x568d94['where']};return db['VoiceChanSpy'][_0x38ce('0x22')](_0x467d3e)[_0x38ce('0x29')](function(_0x174c86){_0x53f2c9[_0x38ce('0x22')]=_0x174c86;if(_0xd96d33[_0x38ce('0x35')][_0x38ce('0x45')]){_0x568d94[_0x38ce('0x46')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0x38ce('0x47')](_0x568d94);})[_0x38ce('0x29')](function(_0x5a689b){_0x53f2c9[_0x38ce('0x48')]=_0x5a689b;return _0x53f2c9;})[_0x38ce('0x29')](respondWithFilteredResult(_0x282ee4,_0x568d94))[_0x38ce('0x49')](handleError(_0x282ee4,null));};exports['show']=function(_0xaf99ce,_0xd95bc8){var _0x33f6a6={'raw':![],'where':{'id':_0xaf99ce[_0x38ce('0x4a')]['id']}},_0x981068={};_0x981068[_0x38ce('0x38')]=_['keys'](db[_0x38ce('0x30')][_0x38ce('0x31')]);_0x981068[_0x38ce('0x35')]=_[_0x38ce('0x36')](_0xaf99ce[_0x38ce('0x35')]);_0x981068[_0x38ce('0x37')]=_['intersection'](_0x981068[_0x38ce('0x38')],_0x981068[_0x38ce('0x35')]);_0x33f6a6['attributes']=_['intersection'](_0x981068['model'],qs[_0x38ce('0x3b')](_0xaf99ce[_0x38ce('0x35')]['fields']));_0x33f6a6['attributes']=_0x33f6a6[_0x38ce('0x39')]['length']?_0x33f6a6[_0x38ce('0x39')]:_0x981068['model'];if(_0xaf99ce[_0x38ce('0x35')][_0x38ce('0x45')]){_0x33f6a6['include']=[{'all':!![]}];}_0x33f6a6=_[_0x38ce('0x42')]({},_0x33f6a6,_0xaf99ce[_0x38ce('0x44')]);return db['VoiceChanSpy'][_0x38ce('0x4b')](_0x33f6a6)[_0x38ce('0x29')](handleEntityNotFound(_0xd95bc8,null))[_0x38ce('0x29')](respondWithResult(_0xd95bc8,null))[_0x38ce('0x49')](handleError(_0xd95bc8,null));};exports[_0x38ce('0x4c')]=function(_0x25a299,_0x58cc6f){return db[_0x38ce('0x30')][_0x38ce('0x4c')](_0x25a299['body'],{})[_0x38ce('0x29')](function(_0x316eec){var _0x429517=_0x25a299[_0x38ce('0x4d')][_0x38ce('0x2b')]({'plain':!![]});if(!_0x429517)throw new Error(_0x38ce('0x4e'));if(_0x429517[_0x38ce('0x4f')]==='user'){var _0x3e1522=_0x316eec[_0x38ce('0x2b')]({'plain':!![]});var _0x3f88df=_0x38ce('0x50');return db[_0x38ce('0x51')][_0x38ce('0x4b')]({'where':{'name':_0x3f88df,'userProfileId':_0x429517['userProfileId']},'raw':!![]})['then'](function(_0xc2c9d3){if(_0xc2c9d3&&_0xc2c9d3[_0x38ce('0x52')]===0x0){return db[_0x38ce('0x53')][_0x38ce('0x4c')]({'name':_0x3e1522[_0x38ce('0x2d')],'resourceId':_0x3e1522['id'],'type':_0xc2c9d3[_0x38ce('0x2d')],'sectionId':_0xc2c9d3['id']},{})['then'](function(){return _0x316eec;});}else{return _0x316eec;}})['catch'](function(_0x199c5b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x199c5b);throw _0x199c5b;});}return _0x316eec;})[_0x38ce('0x29')](respondWithResult(_0x58cc6f,0xc9))[_0x38ce('0x49')](handleError(_0x58cc6f,null));};exports[_0x38ce('0x28')]=function(_0xbe5626,_0xd031c0){if(_0xbe5626['body']['id']){delete _0xbe5626[_0x38ce('0x54')]['id'];}return db[_0x38ce('0x30')][_0x38ce('0x4b')]({'where':{'id':_0xbe5626[_0x38ce('0x4a')]['id']}})[_0x38ce('0x29')](handleEntityNotFound(_0xd031c0,null))[_0x38ce('0x29')](saveUpdates(_0xbe5626[_0x38ce('0x54')],null))[_0x38ce('0x29')](respondWithResult(_0xd031c0,null))[_0x38ce('0x49')](handleError(_0xd031c0,null));};exports[_0x38ce('0x2a')]=function(_0x2db125,_0x56d63e){return db['VoiceChanSpy'][_0x38ce('0x4b')]({'where':{'id':_0x2db125[_0x38ce('0x4a')]['id']}})[_0x38ce('0x29')](handleEntityNotFound(_0x56d63e,null))[_0x38ce('0x29')](removeEntity(_0x56d63e,null))['catch'](handleError(_0x56d63e,null));}; \ No newline at end of file +var _0xa74f=['zip-dir','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','limit','count','set','json','reject','save','destroy','then','ChanSpies','UserProfileResource','error','stack','send','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','name','query','intersection','attributes','fields','length','order','sort','where','filters','pick','filter','merge','VIRTUAL','rows','catch','show','params','keys','include','find','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update'];(function(_0x448f8,_0x2aa1d7){var _0xa73126=function(_0x1fcafa){while(--_0x1fcafa){_0x448f8['push'](_0x448f8['shift']());}};_0xa73126(++_0x2aa1d7);}(_0xa74f,0x9a));var _0xfa74=function(_0x48961c,_0x280e9d){_0x48961c=_0x48961c-0x0;var _0x1d895d=_0xa74f[_0x48961c];return _0x1d895d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfa74('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfa74('0x1'));var BPromise=require(_0xfa74('0x2'));var Mustache=require(_0xfa74('0x3'));var util=require(_0xfa74('0x4'));var path=require('path');var sox=require(_0xfa74('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfa74('0x6'));var _=require(_0xfa74('0x7'));var squel=require(_0xfa74('0x8'));var crypto=require(_0xfa74('0x9'));var jsforce=require(_0xfa74('0xa'));var deskjs=require(_0xfa74('0xb'));var toCsv=require('to-csv');var querystring=require(_0xfa74('0xc'));var Papa=require(_0xfa74('0xd'));var Redis=require(_0xfa74('0xe'));var authService=require(_0xfa74('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xfa74('0x10'));var hardwareService=require(_0xfa74('0x11'));var logger=require('../../config/logger')(_0xfa74('0x12'));var utils=require(_0xfa74('0x13'));var config=require(_0xfa74('0x14'));var licenseUtil=require(_0xfa74('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23591a,_0x998585){_0x998585=_0x998585||0xcc;return function(_0x78173f){if(_0x78173f){return _0x23591a[_0xfa74('0x16')](_0x998585);}return _0x23591a['status'](_0x998585)[_0xfa74('0x17')]();};}function respondWithResult(_0x33cda3,_0x3eb49b){_0x3eb49b=_0x3eb49b||0xc8;return function(_0x3947ca){if(_0x3947ca){return _0x33cda3[_0xfa74('0x18')](_0x3eb49b)['json'](_0x3947ca);}};}function respondWithFilteredResult(_0x199d20,_0x13d911){return function(_0x947da6){if(_0x947da6){var _0x1f1de0=typeof _0x13d911[_0xfa74('0x19')]===_0xfa74('0x1a')&&typeof _0x13d911[_0xfa74('0x1b')]==='undefined';var _0x58a67a=_0x947da6[_0xfa74('0x1c')];var _0x51dda1=_0x1f1de0?0x0:_0x13d911['offset'];var _0x31d3c1=_0x1f1de0?_0x947da6[_0xfa74('0x1c')]:_0x13d911[_0xfa74('0x19')]+_0x13d911['limit'];var _0x3bede6;if(_0x31d3c1>=_0x58a67a){_0x31d3c1=_0x58a67a;_0x3bede6=0xc8;}else{_0x3bede6=0xce;}_0x199d20[_0xfa74('0x18')](_0x3bede6);return _0x199d20[_0xfa74('0x1d')]('Content-Range',_0x51dda1+'-'+_0x31d3c1+'/'+_0x58a67a)[_0xfa74('0x1e')](_0x947da6);}return null;};}function patchUpdates(_0x302eb4){return function(_0x2e6c33){try{jsonpatch['apply'](_0x2e6c33,_0x302eb4,!![]);}catch(_0x5466ca){return BPromise[_0xfa74('0x1f')](_0x5466ca);}return _0x2e6c33[_0xfa74('0x20')]();};}function saveUpdates(_0x9932db,_0xeaaa19){return function(_0x1a453d){if(_0x1a453d){return _0x1a453d['update'](_0x9932db)['then'](function(_0x3721bf){return _0x3721bf;});}return null;};}function removeEntity(_0x5aa8a7,_0x48cbd3){return function(_0x529810){if(_0x529810){return _0x529810[_0xfa74('0x21')]()[_0xfa74('0x22')](function(){var _0x42d9bf=_0x529810['get']({'plain':!![]});var _0x530f99=_0xfa74('0x23');return db[_0xfa74('0x24')]['destroy']({'where':{'type':_0x530f99,'resourceId':_0x42d9bf['id']}})[_0xfa74('0x22')](function(){return _0x529810;});})['then'](function(){_0x5aa8a7[_0xfa74('0x18')](0xcc)[_0xfa74('0x17')]();});}};}function handleEntityNotFound(_0x55d8e4,_0x298388){return function(_0x1130de){if(!_0x1130de){_0x55d8e4[_0xfa74('0x16')](0x194);}return _0x1130de;};}function handleError(_0x218c86,_0x4f7337){_0x4f7337=_0x4f7337||0x1f4;return function(_0xd9c55d){logger[_0xfa74('0x25')](_0xd9c55d[_0xfa74('0x26')]);if(_0xd9c55d['name']){delete _0xd9c55d['name'];}_0x218c86[_0xfa74('0x18')](_0x4f7337)[_0xfa74('0x27')](_0xd9c55d);};}exports['index']=function(_0x4b38fc,_0x343466){var _0x564060={},_0x2238d4={},_0x4d6d0a={'count':0x0,'rows':[]};var _0x363173=_[_0xfa74('0x28')](db[_0xfa74('0x29')][_0xfa74('0x2a')],function(_0x4c506f){return{'name':_0x4c506f[_0xfa74('0x2b')],'type':_0x4c506f[_0xfa74('0x2c')][_0xfa74('0x2d')]};});_0x2238d4[_0xfa74('0x2e')]=_[_0xfa74('0x28')](_0x363173,_0xfa74('0x2f'));_0x2238d4[_0xfa74('0x30')]=_['keys'](_0x4b38fc[_0xfa74('0x30')]);_0x2238d4['filters']=_[_0xfa74('0x31')](_0x2238d4[_0xfa74('0x2e')],_0x2238d4[_0xfa74('0x30')]);_0x564060[_0xfa74('0x32')]=_['intersection'](_0x2238d4['model'],qs[_0xfa74('0x33')](_0x4b38fc[_0xfa74('0x30')][_0xfa74('0x33')]));_0x564060[_0xfa74('0x32')]=_0x564060['attributes'][_0xfa74('0x34')]?_0x564060[_0xfa74('0x32')]:_0x2238d4['model'];if(!_0x4b38fc['query']['hasOwnProperty']('nolimit')){_0x564060['limit']=qs[_0xfa74('0x1b')](_0x4b38fc[_0xfa74('0x30')][_0xfa74('0x1b')]);_0x564060[_0xfa74('0x19')]=qs[_0xfa74('0x19')](_0x4b38fc[_0xfa74('0x30')][_0xfa74('0x19')]);}_0x564060[_0xfa74('0x35')]=qs[_0xfa74('0x36')](_0x4b38fc['query'][_0xfa74('0x36')]);_0x564060[_0xfa74('0x37')]=qs[_0xfa74('0x38')](_[_0xfa74('0x39')](_0x4b38fc[_0xfa74('0x30')],_0x2238d4[_0xfa74('0x38')]),_0x363173);if(_0x4b38fc['query'][_0xfa74('0x3a')]){_0x564060[_0xfa74('0x37')]=_[_0xfa74('0x3b')](_0x564060[_0xfa74('0x37')],{'$or':_['map'](_0x363173,function(_0x207566){if(_0x207566[_0xfa74('0x2c')]!==_0xfa74('0x3c')){var _0x35f252={};_0x35f252[_0x207566['name']]={'$like':'%'+_0x4b38fc[_0xfa74('0x30')][_0xfa74('0x3a')]+'%'};return _0x35f252;}})});}_0x564060=_[_0xfa74('0x3b')]({},_0x564060,_0x4b38fc['options']);var _0x5d32bc={'where':_0x564060[_0xfa74('0x37')]};return db[_0xfa74('0x29')][_0xfa74('0x1c')](_0x5d32bc)[_0xfa74('0x22')](function(_0x55f4e3){_0x4d6d0a[_0xfa74('0x1c')]=_0x55f4e3;if(_0x4b38fc[_0xfa74('0x30')]['includeAll']){_0x564060['include']=[{'all':!![]}];}return db['VoiceChanSpy']['findAll'](_0x564060);})[_0xfa74('0x22')](function(_0x3098ca){_0x4d6d0a[_0xfa74('0x3d')]=_0x3098ca;return _0x4d6d0a;})[_0xfa74('0x22')](respondWithFilteredResult(_0x343466,_0x564060))[_0xfa74('0x3e')](handleError(_0x343466,null));};exports[_0xfa74('0x3f')]=function(_0x7735c5,_0x5aac45){var _0x274062={'raw':![],'where':{'id':_0x7735c5[_0xfa74('0x40')]['id']}},_0x3938c1={};_0x3938c1[_0xfa74('0x2e')]=_[_0xfa74('0x41')](db['VoiceChanSpy'][_0xfa74('0x2a')]);_0x3938c1[_0xfa74('0x30')]=_[_0xfa74('0x41')](_0x7735c5[_0xfa74('0x30')]);_0x3938c1[_0xfa74('0x38')]=_[_0xfa74('0x31')](_0x3938c1[_0xfa74('0x2e')],_0x3938c1[_0xfa74('0x30')]);_0x274062[_0xfa74('0x32')]=_[_0xfa74('0x31')](_0x3938c1['model'],qs[_0xfa74('0x33')](_0x7735c5['query'][_0xfa74('0x33')]));_0x274062[_0xfa74('0x32')]=_0x274062[_0xfa74('0x32')][_0xfa74('0x34')]?_0x274062['attributes']:_0x3938c1[_0xfa74('0x2e')];if(_0x7735c5[_0xfa74('0x30')]['includeAll']){_0x274062[_0xfa74('0x42')]=[{'all':!![]}];}_0x274062=_[_0xfa74('0x3b')]({},_0x274062,_0x7735c5['options']);return db[_0xfa74('0x29')][_0xfa74('0x43')](_0x274062)[_0xfa74('0x22')](handleEntityNotFound(_0x5aac45,null))[_0xfa74('0x22')](respondWithResult(_0x5aac45,null))[_0xfa74('0x3e')](handleError(_0x5aac45,null));};exports['create']=function(_0x54e06c,_0x36f6ca){return db[_0xfa74('0x29')]['create'](_0x54e06c[_0xfa74('0x44')],{})[_0xfa74('0x22')](function(_0x3100f2){var _0x4ca49e=_0x54e06c['user'][_0xfa74('0x45')]({'plain':!![]});if(!_0x4ca49e)throw new Error(_0xfa74('0x46'));if(_0x4ca49e[_0xfa74('0x47')]===_0xfa74('0x48')){var _0x36508a=_0x3100f2[_0xfa74('0x45')]({'plain':!![]});var _0x2d217d=_0xfa74('0x23');return db['UserProfileSection'][_0xfa74('0x43')]({'where':{'name':_0x2d217d,'userProfileId':_0x4ca49e[_0xfa74('0x49')]},'raw':!![]})[_0xfa74('0x22')](function(_0x2654b5){if(_0x2654b5&&_0x2654b5['autoAssociation']===0x0){return db['UserProfileResource'][_0xfa74('0x4a')]({'name':_0x36508a['name'],'resourceId':_0x36508a['id'],'type':_0x2654b5[_0xfa74('0x2f')],'sectionId':_0x2654b5['id']},{})[_0xfa74('0x22')](function(){return _0x3100f2;});}else{return _0x3100f2;}})[_0xfa74('0x3e')](function(_0x33e31e){logger[_0xfa74('0x25')](_0xfa74('0x4b'),_0x33e31e);throw _0x33e31e;});}return _0x3100f2;})[_0xfa74('0x22')](respondWithResult(_0x36f6ca,0xc9))['catch'](handleError(_0x36f6ca,null));};exports[_0xfa74('0x4c')]=function(_0x4bcee3,_0x21d7c5){if(_0x4bcee3['body']['id']){delete _0x4bcee3['body']['id'];}return db[_0xfa74('0x29')][_0xfa74('0x43')]({'where':{'id':_0x4bcee3['params']['id']}})['then'](handleEntityNotFound(_0x21d7c5,null))[_0xfa74('0x22')](saveUpdates(_0x4bcee3[_0xfa74('0x44')],null))[_0xfa74('0x22')](respondWithResult(_0x21d7c5,null))[_0xfa74('0x3e')](handleError(_0x21d7c5,null));};exports[_0xfa74('0x21')]=function(_0xfc3547,_0x1198f3){return db[_0xfa74('0x29')][_0xfa74('0x43')]({'where':{'id':_0xfc3547[_0xfa74('0x40')]['id']}})['then'](handleEntityNotFound(_0x1198f3,null))[_0xfa74('0x22')](removeEntity(_0x1198f3,null))[_0xfa74('0x3e')](handleError(_0x1198f3,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 543dec7..378bd71 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 _0x4781=['${UNIQUEID}.%s,a','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','User','findAll','agent','then','catch','exports','VoiceChanSpy','VoiceExtension','destroy','bulkCreate','lodash','bluebird','from-sip','format','system','push','merge','Set','CDR(type)=%s','chanspy','record'];(function(_0x8564db,_0x40c807){var _0x3c2d07=function(_0x47c659){while(--_0x47c659){_0x8564db['push'](_0x8564db['shift']());}};_0x3c2d07(++_0x40c807);}(_0x4781,0xe3));var _0x1478=function(_0x582849,_0x1a7da2){_0x582849=_0x582849-0x0;var _0x2ea77d=_0x4781[_0x582849];return _0x2ea77d;};'use strict';var _=require(_0x1478('0x0'));var util=require('util');var BPromise=require(_0x1478('0x1'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x5ec305,_0x3ef939,_0x1276e6){var _0x46599e=0x1;var _0x3e039f=[];var _0x1223d1={'context':_0x3ef939['context']||_0x1478('0x2'),'exten':util[_0x1478('0x3')]('%s%s',_0x5ec305['prefix'],_0x1276e6),'type':_0x1478('0x4'),'isApp':![],'ChanSpyId':_0x5ec305['id'],'UserId':_0x3ef939['id']};_0x3e039f[_0x1478('0x5')](_[_0x1478('0x6')]({'app':_0x1478('0x7'),'appdata':util['format'](_0x1478('0x8'),_0x1478('0x9')),'priority':_0x46599e++},_0x1223d1));if(_0x5ec305[_0x1478('0xa')]){_0x3e039f['push'](_[_0x1478('0x6')]({'app':'MixMonitor','appdata':util[_0x1478('0x3')](_0x1478('0xb'),_0x5ec305['recordingFormat']),'priority':_0x46599e++},_0x1223d1));}if(_0x5ec305[_0x1478('0xc')]){_0x3e039f[_0x1478('0x5')](_[_0x1478('0x6')]({'app':_0x1478('0xd'),'appdata':_0x5ec305[_0x1478('0xe')],'priority':_0x46599e++},_0x1223d1));}_0x3e039f[_0x1478('0x5')](_[_0x1478('0x6')]({'app':_0x1478('0xf'),'appdata':util['format'](_0x1478('0x10'),_0x3ef939[_0x1478('0x11')],_0x5ec305[_0x1478('0x12')]?_0x5ec305[_0x1478('0x12')][_0x1478('0x13')](''):''),'priority':_0x46599e++},_0x1223d1));if(_0x5ec305[_0x1478('0xa')]){_0x3e039f[_0x1478('0x5')](_['merge']({'app':_0x1478('0x14'),'priority':_0x46599e++},_0x1223d1));}return _0x3e039f;};var getChanSpyApplications=function(_0x2813d8,_0x2538fe){var _0x1976f3=[];for(var _0xc16704=0x0,_0x2c51fd=0x1;_0xc16704<_0x2538fe[_0x1478('0x15')];_0xc16704++,_0x2c51fd=0x1){_0x1976f3=_0x1976f3[_0x1478('0x16')](getUserApplications(_0x2813d8,_0x2538fe[_0xc16704],_0x2538fe[_0xc16704][_0x1478('0x17')]));if(_0x2538fe[_0xc16704][_0x1478('0x17')]!=_0x2538fe[_0xc16704][_0x1478('0x11')]){_0x1976f3=_0x1976f3['concat'](getUserApplications(_0x2813d8,_0x2538fe[_0xc16704],_0x2538fe[_0xc16704][_0x1478('0x11')]));}}return _0x1976f3;};var getChanSpyPromise=function(_0x3cf2d5,_0x22d401){return new BPromise(function(_0x4bea00,_0x20f4cf){return _0x3cf2d5[_0x1478('0x18')][_0x1478('0x19')]({'attributes':['id',_0x1478('0x11'),_0x1478('0x17')],'where':{'role':_0x1478('0x1a'),'chanspy':!![]},'raw':!![]})[_0x1478('0x1b')](function(_0x55004b){if(_0x55004b){return _0x4bea00(getChanSpyApplications(_0x22d401,_0x55004b));}return _0x4bea00([]);})[_0x1478('0x1c')](function(_0x537822){_0x20f4cf(_0x537822);});});};module[_0x1478('0x1d')]=function(_0x2ae389,_0x3c7836){var _0x52d653=_0x2ae389['models'];return _0x2ae389['define'](_0x1478('0x1e'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xf0e73c,_0x35b219,_0x35eb11){return getChanSpyPromise(_0x52d653,_0xf0e73c)[_0x1478('0x1b')](function(_0x175f80){if(_0x175f80&&_0x175f80['length']){return _0x52d653[_0x1478('0x1f')]['bulkCreate'](_0x175f80);}})[_0x1478('0x1b')](function(){_0x35eb11();})[_0x1478('0x1c')](function(_0x40c6e5){_0x35eb11(_0x40c6e5);});},'afterUpdate':function(_0x4e964c,_0x44fd3b,_0x5dfc3e){return _0x52d653[_0x1478('0x1f')][_0x1478('0x20')]({'where':{'ChanSpyId':_0x4e964c['id']}})[_0x1478('0x1b')](function(){return getChanSpyPromise(_0x52d653,_0x4e964c);})[_0x1478('0x1b')](function(_0x1bf790){if(_0x1bf790&&_0x1bf790[_0x1478('0x15')]){return _0x52d653['VoiceExtension'][_0x1478('0x21')](_0x1bf790);}})[_0x1478('0x1b')](function(){_0x5dfc3e();})[_0x1478('0x1c')](function(_0x261c63){_0x5dfc3e(_0x261c63);});},'afterDestroy':function(_0x13000e,_0xb77202,_0x59fa56){return _0x52d653['VoiceExtension'][_0x1478('0x20')]({'where':{'ChanSpyId':_0x13000e['id']}})['then'](function(){_0x59fa56();})['catch'](function(_0x49ce5b){_0x59fa56(_0x49ce5b);});}}});}; \ No newline at end of file +var _0x121e=['join','length','concat','internal','User','agent','then','catch','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','format','%s%s','prefix','system','merge','Set','CDR(type)=%s','chanspy','record','${UNIQUEID}.%s,a','recordingFormat','push','ChanSpy','name','options'];(function(_0x57d09e,_0x48ae67){var _0x1a5c3f=function(_0x249fd5){while(--_0x249fd5){_0x57d09e['push'](_0x57d09e['shift']());}};_0x1a5c3f(++_0x48ae67);}(_0x121e,0x130));var _0xe121=function(_0x278ca8,_0x1d0f95){_0x278ca8=_0x278ca8-0x0;var _0x5a96ef=_0x121e[_0x278ca8];return _0x5a96ef;};'use strict';var _=require(_0xe121('0x0'));var util=require(_0xe121('0x1'));var BPromise=require(_0xe121('0x2'));var attributes=require(_0xe121('0x3'));var getUserApplications=function(_0x35ee2a,_0x1e407b,_0x39d262){var _0x217935=0x1;var _0x1f1755=[];var _0x14b4a0={'context':_0x1e407b[_0xe121('0x4')]||'from-sip','exten':util[_0xe121('0x5')](_0xe121('0x6'),_0x35ee2a[_0xe121('0x7')],_0x39d262),'type':_0xe121('0x8'),'isApp':![],'ChanSpyId':_0x35ee2a['id'],'UserId':_0x1e407b['id']};_0x1f1755['push'](_[_0xe121('0x9')]({'app':_0xe121('0xa'),'appdata':util[_0xe121('0x5')](_0xe121('0xb'),_0xe121('0xc')),'priority':_0x217935++},_0x14b4a0));if(_0x35ee2a[_0xe121('0xd')]){_0x1f1755['push'](_[_0xe121('0x9')]({'app':'MixMonitor','appdata':util[_0xe121('0x5')](_0xe121('0xe'),_0x35ee2a[_0xe121('0xf')]),'priority':_0x217935++},_0x14b4a0));}if(_0x35ee2a['auth']){_0x1f1755[_0xe121('0x10')](_[_0xe121('0x9')]({'app':'Authenticate','appdata':_0x35ee2a['password'],'priority':_0x217935++},_0x14b4a0));}_0x1f1755[_0xe121('0x10')](_['merge']({'app':_0xe121('0x11'),'appdata':util['format']('SIP/%s,%s',_0x1e407b[_0xe121('0x12')],_0x35ee2a[_0xe121('0x13')]?_0x35ee2a[_0xe121('0x13')][_0xe121('0x14')](''):''),'priority':_0x217935++},_0x14b4a0));if(_0x35ee2a[_0xe121('0xd')]){_0x1f1755[_0xe121('0x10')](_[_0xe121('0x9')]({'app':'StopMixMonitor','priority':_0x217935++},_0x14b4a0));}return _0x1f1755;};var getChanSpyApplications=function(_0x572a4c,_0x52cad1){var _0x5ea099=[];for(var _0x2bddbb=0x0,_0x2fa79c=0x1;_0x2bddbb<_0x52cad1[_0xe121('0x15')];_0x2bddbb++,_0x2fa79c=0x1){_0x5ea099=_0x5ea099[_0xe121('0x16')](getUserApplications(_0x572a4c,_0x52cad1[_0x2bddbb],_0x52cad1[_0x2bddbb][_0xe121('0x17')]));if(_0x52cad1[_0x2bddbb][_0xe121('0x17')]!=_0x52cad1[_0x2bddbb]['name']){_0x5ea099=_0x5ea099[_0xe121('0x16')](getUserApplications(_0x572a4c,_0x52cad1[_0x2bddbb],_0x52cad1[_0x2bddbb][_0xe121('0x12')]));}}return _0x5ea099;};var getChanSpyPromise=function(_0x4c9dcb,_0x42ea46){return new BPromise(function(_0x19db50,_0x4e9385){return _0x4c9dcb[_0xe121('0x18')]['findAll']({'attributes':['id','name',_0xe121('0x17')],'where':{'role':_0xe121('0x19'),'chanspy':!![]},'raw':!![]})[_0xe121('0x1a')](function(_0x250fbe){if(_0x250fbe){return _0x19db50(getChanSpyApplications(_0x42ea46,_0x250fbe));}return _0x19db50([]);})[_0xe121('0x1b')](function(_0x3361b7){_0x4e9385(_0x3361b7);});});};module[_0xe121('0x1c')]=function(_0x265e43,_0x41f649){var _0x518dd0=_0x265e43[_0xe121('0x1d')];return _0x265e43[_0xe121('0x1e')](_0xe121('0x1f'),attributes,{'tableName':_0xe121('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x54e63c,_0x332800,_0x15ec39){return getChanSpyPromise(_0x518dd0,_0x54e63c)['then'](function(_0x3c5058){if(_0x3c5058&&_0x3c5058[_0xe121('0x15')]){return _0x518dd0[_0xe121('0x21')][_0xe121('0x22')](_0x3c5058);}})['then'](function(){_0x15ec39();})[_0xe121('0x1b')](function(_0x61d9de){_0x15ec39(_0x61d9de);});},'afterUpdate':function(_0x325b63,_0x31c740,_0x2230c4){return _0x518dd0[_0xe121('0x21')][_0xe121('0x23')]({'where':{'ChanSpyId':_0x325b63['id']}})[_0xe121('0x1a')](function(){return getChanSpyPromise(_0x518dd0,_0x325b63);})['then'](function(_0x58904b){if(_0x58904b&&_0x58904b['length']){return _0x518dd0[_0xe121('0x21')][_0xe121('0x22')](_0x58904b);}})[_0xe121('0x1a')](function(){_0x2230c4();})[_0xe121('0x1b')](function(_0x3e4af5){_0x2230c4(_0x3e4af5);});},'afterDestroy':function(_0x1868e4,_0x3bdbbb,_0x595315){return _0x518dd0[_0xe121('0x21')][_0xe121('0x23')]({'where':{'ChanSpyId':_0x1868e4['id']}})[_0xe121('0x1a')](function(){_0x595315();})['catch'](function(_0x223565){_0x595315(_0x223565);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 8e2e075..bd9f760 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 _0x7af2=['catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','error','message','VoiceChanSpy,\x20%s,\x20%s','result'];(function(_0x22f4f9,_0x2257ea){var _0x478331=function(_0x33ad55){while(--_0x33ad55){_0x22f4f9['push'](_0x22f4f9['shift']());}};_0x478331(++_0x2257ea);}(_0x7af2,0x119));var _0x27af=function(_0x49455b,_0x4ac1e0){_0x49455b=_0x49455b-0x0;var _0x27e182=_0x7af2[_0x49455b];return _0x27e182;};'use strict';var _=require('lodash');var util=require(_0x27af('0x0'));var moment=require(_0x27af('0x1'));var BPromise=require(_0x27af('0x2'));var rs=require(_0x27af('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x27af('0x4'))['db'];var utils=require(_0x27af('0x5'));var logger=require(_0x27af('0x6'))(_0x27af('0x7'));var config=require(_0x27af('0x8'));var jayson=require(_0x27af('0x9'));var client=jayson[_0x27af('0xa')][_0x27af('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2193c6,_0x572219,_0x1e2509){return new BPromise(function(_0x366868,_0x389e97){return client['request'](_0x2193c6,_0x1e2509)[_0x27af('0xc')](function(_0xfa1882){logger[_0x27af('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x572219,_0x27af('0xe'));logger['debug']('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x572219,_0x27af('0xe'),JSON['stringify'](_0xfa1882));if(_0xfa1882['error']){if(_0xfa1882[_0x27af('0xf')]['code']===0x1f4){logger[_0x27af('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x572219,_0xfa1882[_0x27af('0xf')][_0x27af('0x10')]);return _0x389e97(_0xfa1882[_0x27af('0xf')][_0x27af('0x10')]);}logger[_0x27af('0xf')](_0x27af('0x11'),_0x572219,_0xfa1882[_0x27af('0xf')][_0x27af('0x10')]);return _0x366868(_0xfa1882[_0x27af('0xf')][_0x27af('0x10')]);}else{logger[_0x27af('0xd')](_0x27af('0x11'),_0x572219,_0x27af('0xe'));_0x366868(_0xfa1882[_0x27af('0x12')][_0x27af('0x10')]);}})[_0x27af('0x13')](function(_0x13f8ed){logger[_0x27af('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x572219,_0x13f8ed);_0x389e97(_0x13f8ed);});});} \ No newline at end of file +var _0xa902=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xa902,0x8d));var _0x2a90=function(_0x1c0eaf,_0x2c0649){_0x1c0eaf=_0x1c0eaf-0x0;var _0x44eedd=_0xa902[_0x1c0eaf];return _0x44eedd;};'use strict';var _=require(_0x2a90('0x0'));var util=require(_0x2a90('0x1'));var moment=require(_0x2a90('0x2'));var BPromise=require(_0x2a90('0x3'));var rs=require(_0x2a90('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2a90('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2a90('0x6'));var config=require(_0x2a90('0x7'));var jayson=require(_0x2a90('0x8'));var client=jayson[_0x2a90('0x9')][_0x2a90('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25bcfc,_0x58369a,_0x4109e6){return new BPromise(function(_0x570659,_0x5ec2b9){return client[_0x2a90('0xb')](_0x25bcfc,_0x4109e6)[_0x2a90('0xc')](function(_0xe500bc){logger[_0x2a90('0xd')](_0x2a90('0xe'),_0x58369a,'request\x20sent');logger[_0x2a90('0xf')](_0x2a90('0x10'),_0x58369a,_0x2a90('0x11'),JSON[_0x2a90('0x12')](_0xe500bc));if(_0xe500bc['error']){if(_0xe500bc[_0x2a90('0x13')]['code']===0x1f4){logger[_0x2a90('0x13')]('VoiceChanSpy,\x20%s,\x20%s',_0x58369a,_0xe500bc[_0x2a90('0x13')]['message']);return _0x5ec2b9(_0xe500bc[_0x2a90('0x13')][_0x2a90('0x14')]);}logger[_0x2a90('0x13')]('VoiceChanSpy,\x20%s,\x20%s',_0x58369a,_0xe500bc['error']['message']);return _0x570659(_0xe500bc[_0x2a90('0x13')][_0x2a90('0x14')]);}else{logger['info'](_0x2a90('0xe'),_0x58369a,_0x2a90('0x11'));_0x570659(_0xe500bc[_0x2a90('0x15')][_0x2a90('0x14')]);}})[_0x2a90('0x16')](function(_0x37858e){logger[_0x2a90('0x13')](_0x2a90('0xe'),_0x58369a,_0x37858e);_0x5ec2b9(_0x37858e);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 3709c26..73d3be6 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 _0x9723=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','isAuthenticated','index','get','show','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x4c60c0,_0x1c5fe7){var _0x398848=function(_0x4fd3dd){while(--_0x4fd3dd){_0x4c60c0['push'](_0x4c60c0['shift']());}};_0x398848(++_0x1c5fe7);}(_0x9723,0xd8));var _0x3972=function(_0x2eea9a,_0x368daf){_0x2eea9a=_0x2eea9a-0x0;var _0x1ec61e=_0x9723[_0x2eea9a];return _0x1ec61e;};'use strict';var multer=require(_0x3972('0x0'));var util=require(_0x3972('0x1'));var path=require(_0x3972('0x2'));var timeout=require(_0x3972('0x3'));var express=require(_0x3972('0x4'));var router=express['Router']();var fs_extra=require(_0x3972('0x5'));var auth=require(_0x3972('0x6'));var interaction=require(_0x3972('0x7'));var config=require(_0x3972('0x8'));var controller=require(_0x3972('0x9'));router['get']('/',auth[_0x3972('0xa')](),controller[_0x3972('0xb')]);router[_0x3972('0xc')]('/:id',auth[_0x3972('0xa')](),controller[_0x3972('0xd')]);router['post']('/',auth[_0x3972('0xa')](),controller[_0x3972('0xe')]);router[_0x3972('0xf')](_0x3972('0x10'),auth[_0x3972('0xa')](),controller[_0x3972('0x11')]);router[_0x3972('0x12')](_0x3972('0x10'),auth[_0x3972('0xa')](),controller[_0x3972('0x13')]);module['exports']=router; \ No newline at end of file +var _0xe5de=['index','post','put','update','delete','/:id','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','isAuthenticated'];(function(_0x20fdd4,_0x5db61c){var _0x4e0929=function(_0x397b62){while(--_0x397b62){_0x20fdd4['push'](_0x20fdd4['shift']());}};_0x4e0929(++_0x5db61c);}(_0xe5de,0xb1));var _0xee5d=function(_0x4d7570,_0x2463af){_0x4d7570=_0x4d7570-0x0;var _0x38e79e=_0xe5de[_0x4d7570];return _0x38e79e;};'use strict';var multer=require('multer');var util=require(_0xee5d('0x0'));var path=require(_0xee5d('0x1'));var timeout=require(_0xee5d('0x2'));var express=require(_0xee5d('0x3'));var router=express['Router']();var fs_extra=require(_0xee5d('0x4'));var auth=require(_0xee5d('0x5'));var interaction=require(_0xee5d('0x6'));var config=require(_0xee5d('0x7'));var controller=require(_0xee5d('0x8'));router['get']('/',auth[_0xee5d('0x9')](),controller[_0xee5d('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xee5d('0xb')]('/',auth[_0xee5d('0x9')](),controller['create']);router[_0xee5d('0xc')]('/:id',auth[_0xee5d('0x9')](),controller[_0xee5d('0xd')]);router[_0xee5d('0xe')](_0xee5d('0xf'),auth[_0xee5d('0x9')](),controller['destroy']);module[_0xee5d('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 2066b6e..4a6757a 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 _0x9a2f=['sequelize','exports'];(function(_0x4ee54b,_0x5d4345){var _0x1045fb=function(_0x3a4d6b){while(--_0x3a4d6b){_0x4ee54b['push'](_0x4ee54b['shift']());}};_0x1045fb(++_0x5d4345);}(_0x9a2f,0x1ce));var _0xf9a2=function(_0x29dbe9,_0x4e9351){_0x29dbe9=_0x29dbe9-0x0;var _0x24ce13=_0x9a2f[_0x29dbe9];return _0x24ce13;};'use strict';var Sequelize=require(_0xf9a2('0x0'));module[_0xf9a2('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x15ce=['name','STRING','BOOLEAN','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x15ce,0x1f3));var _0xe15c=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x15ce[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0xe15c('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xe15c('0x1')},'description':{'type':Sequelize[_0xe15c('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xe15c('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 7bbb3b8..8eb4585 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 _0x2986=['VoiceContext,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','end','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','then','destroy','get','Contexts','stack','name','send','index','map','rawAttributes','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','merge','VIRTUAL','filter','options','VoiceContext','includeAll','findAll','params','include','find','create','body','root','utf8','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','server/files/templates/context.ejs','render','update','rimraf','zip-dir','bluebird','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','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','info'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x2986,0xa9));var _0x6298=function(_0x58c904,_0x3cfbe8){_0x58c904=_0x58c904-0x0;var _0x3d640e=_0x2986[_0x58c904];return _0x3d640e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6298('0x0'));var zipdir=require(_0x6298('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6298('0x2'));var Mustache=require('mustache');var util=require(_0x6298('0x3'));var path=require('path');var sox=require(_0x6298('0x4'));var csv=require(_0x6298('0x5'));var ejs=require(_0x6298('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6298('0x7'));var squel=require(_0x6298('0x8'));var crypto=require(_0x6298('0x9'));var jsforce=require(_0x6298('0xa'));var deskjs=require(_0x6298('0xb'));var toCsv=require(_0x6298('0x5'));var querystring=require(_0x6298('0xc'));var Papa=require(_0x6298('0xd'));var Redis=require(_0x6298('0xe'));var authService=require(_0x6298('0xf'));var qs=require(_0x6298('0x10'));var as=require(_0x6298('0x11'));var hardwareService=require(_0x6298('0x12'));var logger=require('../../config/logger')(_0x6298('0x13'));var utils=require('../../config/utils');var config=require(_0x6298('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x6298('0x15'))['db'];var jayson=require(_0x6298('0x16'));var client=jayson[_0x6298('0x17')][_0x6298('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x304076,_0xc5db52,_0x47f5ce,_0x5e619d){return new BPromise(function(_0x39c7bf,_0x392115){var _0x1149bd=_0x5e619d||client;return _0x1149bd[_0x6298('0x19')](_0x304076,_0x47f5ce)['then'](function(_0x462a82){logger[_0x6298('0x1a')](_0x6298('0x1b'),_0xc5db52,_0x6298('0x1c'));logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0xc5db52,'request\x20sent',JSON[_0x6298('0x1d')](_0x462a82));if(_0x462a82[_0x6298('0x1e')]){if(_0x462a82[_0x6298('0x1e')][_0x6298('0x1f')]===0x1f4){logger['error'](_0x6298('0x1b'),_0xc5db52,_0x462a82[_0x6298('0x1e')][_0x6298('0x20')]);return _0x392115(_0x462a82[_0x6298('0x1e')][_0x6298('0x20')]);}logger[_0x6298('0x1e')](_0x6298('0x1b'),_0xc5db52,_0x462a82[_0x6298('0x1e')][_0x6298('0x20')]);return _0x39c7bf(_0x462a82['error'][_0x6298('0x20')]);}else{logger['info'](_0x6298('0x1b'),_0xc5db52,_0x6298('0x1c'));_0x39c7bf(_0x462a82[_0x6298('0x21')][_0x6298('0x20')]);}})[_0x6298('0x22')](function(_0x46d1d8){logger[_0x6298('0x1e')](_0x6298('0x1b'),_0xc5db52,_0x46d1d8);_0x392115(_0x46d1d8);});});}function respondWithStatusCode(_0x29d1f0,_0x35936e){_0x35936e=_0x35936e||0xcc;return function(_0x1ecf73){if(_0x1ecf73){return _0x29d1f0['sendStatus'](_0x35936e);}return _0x29d1f0['status'](_0x35936e)[_0x6298('0x23')]();};}function respondWithResult(_0x42ed2e,_0x5a3d78){_0x5a3d78=_0x5a3d78||0xc8;return function(_0x315e26){if(_0x315e26){return _0x42ed2e[_0x6298('0x24')](_0x5a3d78)['json'](_0x315e26);}};}function respondWithFilteredResult(_0x5dfc54,_0x188230){return function(_0x517f76){if(_0x517f76){var _0x28400d=typeof _0x188230[_0x6298('0x25')]===_0x6298('0x26')&&typeof _0x188230[_0x6298('0x27')]==='undefined';var _0xe43359=_0x517f76[_0x6298('0x28')];var _0x3ed416=_0x28400d?0x0:_0x188230[_0x6298('0x25')];var _0x495ec8=_0x28400d?_0x517f76['count']:_0x188230[_0x6298('0x25')]+_0x188230[_0x6298('0x27')];var _0x5a9dc6;if(_0x495ec8>=_0xe43359){_0x495ec8=_0xe43359;_0x5a9dc6=0xc8;}else{_0x5a9dc6=0xce;}_0x5dfc54[_0x6298('0x24')](_0x5a9dc6);return _0x5dfc54['set'](_0x6298('0x29'),_0x3ed416+'-'+_0x495ec8+'/'+_0xe43359)[_0x6298('0x2a')](_0x517f76);}return null;};}function patchUpdates(_0x416591){return function(_0x546c0a){try{jsonpatch[_0x6298('0x2b')](_0x546c0a,_0x416591,!![]);}catch(_0x3c9411){return BPromise[_0x6298('0x2c')](_0x3c9411);}return _0x546c0a[_0x6298('0x2d')]();};}function saveUpdates(_0x2f9750,_0x57aeff){return function(_0x156661){if(_0x156661){return _0x156661['update'](_0x2f9750)[_0x6298('0x2e')](function(_0x44a498){return _0x44a498;});}return null;};}function removeEntity(_0x57cbfa,_0x368576){return function(_0x5a3c4c){if(_0x5a3c4c){return _0x5a3c4c[_0x6298('0x2f')]()[_0x6298('0x2e')](function(){var _0x48fae9=_0x5a3c4c[_0x6298('0x30')]({'plain':!![]});var _0x59f1da=_0x6298('0x31');return db['UserProfileResource']['destroy']({'where':{'type':_0x59f1da,'resourceId':_0x48fae9['id']}})[_0x6298('0x2e')](function(){return _0x5a3c4c;});})['then'](function(){_0x57cbfa[_0x6298('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5785c5,_0x27150e){return function(_0x53e1b2){if(!_0x53e1b2){_0x5785c5['sendStatus'](0x194);}return _0x53e1b2;};}function handleError(_0x298825,_0x292d8a){_0x292d8a=_0x292d8a||0x1f4;return function(_0x3beb78){logger[_0x6298('0x1e')](_0x3beb78[_0x6298('0x32')]);if(_0x3beb78[_0x6298('0x33')]){delete _0x3beb78[_0x6298('0x33')];}_0x298825[_0x6298('0x24')](_0x292d8a)[_0x6298('0x34')](_0x3beb78);};}exports[_0x6298('0x35')]=function(_0x512859,_0x4004e3){var _0x170fc0={},_0x470346={},_0x575d57={'count':0x0,'rows':[]};var _0x27fd2a=_[_0x6298('0x36')](db['VoiceContext'][_0x6298('0x37')],function(_0x2cf15f){return{'name':_0x2cf15f['fieldName'],'type':_0x2cf15f['type']['key']};});_0x470346[_0x6298('0x38')]=_[_0x6298('0x36')](_0x27fd2a,_0x6298('0x33'));_0x470346[_0x6298('0x39')]=_[_0x6298('0x3a')](_0x512859[_0x6298('0x39')]);_0x470346['filters']=_[_0x6298('0x3b')](_0x470346[_0x6298('0x38')],_0x470346[_0x6298('0x39')]);_0x170fc0['attributes']=_['intersection'](_0x470346[_0x6298('0x38')],qs[_0x6298('0x3c')](_0x512859[_0x6298('0x39')][_0x6298('0x3c')]));_0x170fc0[_0x6298('0x3d')]=_0x170fc0[_0x6298('0x3d')][_0x6298('0x3e')]?_0x170fc0[_0x6298('0x3d')]:_0x470346[_0x6298('0x38')];if(!_0x512859[_0x6298('0x39')][_0x6298('0x3f')](_0x6298('0x40'))){_0x170fc0[_0x6298('0x27')]=qs[_0x6298('0x27')](_0x512859[_0x6298('0x39')][_0x6298('0x27')]);_0x170fc0[_0x6298('0x25')]=qs['offset'](_0x512859[_0x6298('0x39')][_0x6298('0x25')]);}_0x170fc0['order']=qs[_0x6298('0x41')](_0x512859['query'][_0x6298('0x41')]);_0x170fc0[_0x6298('0x42')]=qs[_0x6298('0x43')](_['pick'](_0x512859[_0x6298('0x39')],_0x470346[_0x6298('0x43')]),_0x27fd2a);if(_0x512859[_0x6298('0x39')]['filter']){_0x170fc0['where']=_[_0x6298('0x44')](_0x170fc0[_0x6298('0x42')],{'$or':_[_0x6298('0x36')](_0x27fd2a,function(_0x137ab4){if(_0x137ab4['type']!==_0x6298('0x45')){var _0x3fbf4e={};_0x3fbf4e[_0x137ab4['name']]={'$like':'%'+_0x512859[_0x6298('0x39')][_0x6298('0x46')]+'%'};return _0x3fbf4e;}})});}_0x170fc0=_[_0x6298('0x44')]({},_0x170fc0,_0x512859[_0x6298('0x47')]);var _0x30cdc2={'where':_0x170fc0[_0x6298('0x42')]};return db[_0x6298('0x48')][_0x6298('0x28')](_0x30cdc2)[_0x6298('0x2e')](function(_0x19fd8d){_0x575d57[_0x6298('0x28')]=_0x19fd8d;if(_0x512859[_0x6298('0x39')][_0x6298('0x49')]){_0x170fc0['include']=[{'all':!![]}];}return db[_0x6298('0x48')][_0x6298('0x4a')](_0x170fc0);})['then'](function(_0x13984f){_0x575d57['rows']=_0x13984f;return _0x575d57;})['then'](respondWithFilteredResult(_0x4004e3,_0x170fc0))['catch'](handleError(_0x4004e3,null));};exports['show']=function(_0x5b15eb,_0x5a91ab){var _0x40100b={'raw':![],'where':{'id':_0x5b15eb[_0x6298('0x4b')]['id']}},_0x2f4e6f={};_0x2f4e6f[_0x6298('0x38')]=_[_0x6298('0x3a')](db[_0x6298('0x48')]['rawAttributes']);_0x2f4e6f[_0x6298('0x39')]=_[_0x6298('0x3a')](_0x5b15eb[_0x6298('0x39')]);_0x2f4e6f[_0x6298('0x43')]=_[_0x6298('0x3b')](_0x2f4e6f[_0x6298('0x38')],_0x2f4e6f[_0x6298('0x39')]);_0x40100b[_0x6298('0x3d')]=_[_0x6298('0x3b')](_0x2f4e6f[_0x6298('0x38')],qs[_0x6298('0x3c')](_0x5b15eb[_0x6298('0x39')]['fields']));_0x40100b['attributes']=_0x40100b[_0x6298('0x3d')][_0x6298('0x3e')]?_0x40100b[_0x6298('0x3d')]:_0x2f4e6f[_0x6298('0x38')];if(_0x5b15eb[_0x6298('0x39')][_0x6298('0x49')]){_0x40100b[_0x6298('0x4c')]=[{'all':!![]}];}_0x40100b=_[_0x6298('0x44')]({},_0x40100b,_0x5b15eb['options']);return db['VoiceContext'][_0x6298('0x4d')](_0x40100b)[_0x6298('0x2e')](handleEntityNotFound(_0x5a91ab,null))[_0x6298('0x2e')](respondWithResult(_0x5a91ab,null))[_0x6298('0x22')](handleError(_0x5a91ab,null));};exports[_0x6298('0x4e')]=function(_0x1f9053,_0x10a569,_0x422be){var _0x401d32;return db[_0x6298('0x48')][_0x6298('0x4e')](_0x1f9053[_0x6298('0x4f')],{'raw':!![]})[_0x6298('0x2e')](function(_0x37d2b3){_0x401d32=_0x37d2b3;return db[_0x6298('0x48')]['findAll']({'raw':!![]});})[_0x6298('0x2e')](function(_0x3dda64){var _0xdd623f=fs['readFileSync'](path['join'](config[_0x6298('0x50')],'server/files/templates/context.ejs'),_0x6298('0x51'));var _0x189f1a=ejs['render'](_0xdd623f,{'contexts':_0x3dda64||[]});fs[_0x6298('0x52')](_0x6298('0x53'),_0x189f1a);})[_0x6298('0x2e')](function(){return respondWithRpcPromise(_0x6298('0x54'),'create',{'module':_0x6298('0x55')});})['then'](function(){var _0x3b6b8d=_0x1f9053[_0x6298('0x56')][_0x6298('0x30')]({'plain':!![]});if(!_0x3b6b8d)throw new Error(_0x6298('0x57'));if(_0x3b6b8d[_0x6298('0x58')]===_0x6298('0x56')){var _0x1478e7=_0x401d32['get']({'plain':!![]});return db['UserProfileSection'][_0x6298('0x4d')]({'where':{'name':_0x6298('0x31'),'userProfileId':_0x3b6b8d[_0x6298('0x59')]},'raw':!![]})[_0x6298('0x2e')](function(_0x37b35f){if(_0x37b35f&&_0x37b35f[_0x6298('0x5a')]===0x0){return db[_0x6298('0x5b')][_0x6298('0x4e')]({'name':_0x1478e7[_0x6298('0x33')],'resourceId':_0x1478e7['id'],'type':_0x37b35f[_0x6298('0x33')],'sectionId':_0x37b35f['id']},{})['then'](function(){return _0x401d32;});}else{return _0x401d32;}})[_0x6298('0x22')](function(_0x5efef9){logger[_0x6298('0x1e')](_0x6298('0x5c'),_0x5efef9);throw _0x5efef9;});}return _0x401d32;})[_0x6298('0x2e')](respondWithResult(_0x10a569,0xc9))[_0x6298('0x22')](handleError(_0x10a569,null));};exports['update']=function(_0x1fe34b,_0x2e8907,_0x57a6a8){var _0x3770ed;return db[_0x6298('0x48')][_0x6298('0x4d')]({'where':{'id':_0x1fe34b[_0x6298('0x4b')]['id']}})[_0x6298('0x2e')](handleEntityNotFound(_0x2e8907,null))[_0x6298('0x2e')](saveUpdates(_0x1fe34b[_0x6298('0x4f')],null))[_0x6298('0x2e')](function(_0x1e5c9e){if(_0x1e5c9e){_0x3770ed=_0x1e5c9e;return db[_0x6298('0x48')][_0x6298('0x4a')]({'raw':!![]});}})[_0x6298('0x2e')](function(_0x2b9d49){var _0x4a247b=fs[_0x6298('0x5d')](path[_0x6298('0x5e')](config[_0x6298('0x50')],_0x6298('0x5f')),_0x6298('0x51'));var _0x3ab9b2=ejs[_0x6298('0x60')](_0x4a247b,{'contexts':_0x2b9d49||[]});fs[_0x6298('0x52')](_0x6298('0x53'),_0x3ab9b2);})[_0x6298('0x2e')](function(){return respondWithRpcPromise(_0x6298('0x54'),_0x6298('0x61'),{'module':_0x6298('0x55')});})[_0x6298('0x2e')](function(){return _0x3770ed;})[_0x6298('0x2e')](respondWithResult(_0x2e8907,null))['catch'](handleError(_0x2e8907,null));};exports['destroy']=function(_0x2df568,_0x6753e6,_0x3aa656){var _0x519474;return db['VoiceContext'][_0x6298('0x4d')]({'where':{'id':_0x2df568[_0x6298('0x4b')]['id']}})[_0x6298('0x2e')](handleEntityNotFound(_0x6753e6,null))[_0x6298('0x2e')](removeEntity(_0x6753e6,null))[_0x6298('0x2e')](function(){return db[_0x6298('0x48')]['findAll']({'raw':!![]});})['then'](function(_0x3a211a){var _0x250f87=fs[_0x6298('0x5d')](path[_0x6298('0x5e')](config[_0x6298('0x50')],_0x6298('0x5f')),_0x6298('0x51'));var _0x5d1810=ejs['render'](_0x250f87,{'contexts':_0x3a211a});fs[_0x6298('0x52')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x5d1810);return respondWithRpcPromise(_0x6298('0x54'),_0x6298('0x2f'),{'module':_0x6298('0x55')});})[_0x6298('0x22')](handleError(_0x6753e6,null));}; \ No newline at end of file +var _0xc2b0=['hasOwnProperty','order','sort','filter','where','merge','include','findAll','rows','show','params','length','includeAll','options','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Reload','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','jayson/promise','client','http','request','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','Contexts','UserProfileResource','destroy','stack','name','send','VoiceContext','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xc2b0,0x1c3));var _0x0c2b=function(_0x37d172,_0x55b556){_0x37d172=_0x37d172-0x0;var _0xc6dac3=_0xc2b0[_0x37d172];return _0xc6dac3;};'use strict';var emlformat=require(_0x0c2b('0x0'));var rimraf=require(_0x0c2b('0x1'));var zipdir=require(_0x0c2b('0x2'));var jsonpatch=require(_0x0c2b('0x3'));var rp=require(_0x0c2b('0x4'));var moment=require('moment');var BPromise=require(_0x0c2b('0x5'));var Mustache=require(_0x0c2b('0x6'));var util=require(_0x0c2b('0x7'));var path=require(_0x0c2b('0x8'));var sox=require(_0x0c2b('0x9'));var csv=require(_0x0c2b('0xa'));var ejs=require(_0x0c2b('0xb'));var fs=require('fs');var fs_extra=require(_0x0c2b('0xc'));var _=require(_0x0c2b('0xd'));var squel=require(_0x0c2b('0xe'));var crypto=require(_0x0c2b('0xf'));var jsforce=require(_0x0c2b('0x10'));var deskjs=require(_0x0c2b('0x11'));var toCsv=require('to-csv');var querystring=require(_0x0c2b('0x12'));var Papa=require(_0x0c2b('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0c2b('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0c2b('0x15'));var logger=require('../../config/logger')(_0x0c2b('0x16'));var utils=require('../../config/utils');var config=require(_0x0c2b('0x17'));var licenseUtil=require(_0x0c2b('0x18'));var db=require('../../mysqldb')['db'];var jayson=require(_0x0c2b('0x19'));var client=jayson[_0x0c2b('0x1a')][_0x0c2b('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0xb0cf76,_0x1fdf2f,_0x4d5b48,_0x27ce4f){return new BPromise(function(_0x1fa430,_0x273b26){var _0x42115e=_0x27ce4f||client;return _0x42115e[_0x0c2b('0x1c')](_0xb0cf76,_0x4d5b48)['then'](function(_0x416f11){logger['info'](_0x0c2b('0x1d'),_0x1fdf2f,_0x0c2b('0x1e'));logger[_0x0c2b('0x1f')](_0x0c2b('0x20'),_0x1fdf2f,'request\x20sent',JSON[_0x0c2b('0x21')](_0x416f11));if(_0x416f11[_0x0c2b('0x22')]){if(_0x416f11[_0x0c2b('0x22')][_0x0c2b('0x23')]===0x1f4){logger['error'](_0x0c2b('0x1d'),_0x1fdf2f,_0x416f11['error'][_0x0c2b('0x24')]);return _0x273b26(_0x416f11[_0x0c2b('0x22')][_0x0c2b('0x24')]);}logger[_0x0c2b('0x22')](_0x0c2b('0x1d'),_0x1fdf2f,_0x416f11[_0x0c2b('0x22')][_0x0c2b('0x24')]);return _0x1fa430(_0x416f11[_0x0c2b('0x22')][_0x0c2b('0x24')]);}else{logger[_0x0c2b('0x25')](_0x0c2b('0x1d'),_0x1fdf2f,'request\x20sent');_0x1fa430(_0x416f11[_0x0c2b('0x26')][_0x0c2b('0x24')]);}})[_0x0c2b('0x27')](function(_0x3b55c6){logger[_0x0c2b('0x22')](_0x0c2b('0x1d'),_0x1fdf2f,_0x3b55c6);_0x273b26(_0x3b55c6);});});}function respondWithStatusCode(_0x4ae721,_0x1976b7){_0x1976b7=_0x1976b7||0xcc;return function(_0x291ecc){if(_0x291ecc){return _0x4ae721[_0x0c2b('0x28')](_0x1976b7);}return _0x4ae721[_0x0c2b('0x29')](_0x1976b7)[_0x0c2b('0x2a')]();};}function respondWithResult(_0x15fbfb,_0x598604){_0x598604=_0x598604||0xc8;return function(_0x456fcf){if(_0x456fcf){return _0x15fbfb[_0x0c2b('0x29')](_0x598604)[_0x0c2b('0x2b')](_0x456fcf);}};}function respondWithFilteredResult(_0x28e3c3,_0x90d0c6){return function(_0x1ed751){if(_0x1ed751){var _0x53f578=typeof _0x90d0c6[_0x0c2b('0x2c')]==='undefined'&&typeof _0x90d0c6[_0x0c2b('0x2d')]===_0x0c2b('0x2e');var _0x5c2d3b=_0x1ed751[_0x0c2b('0x2f')];var _0x10c2e3=_0x53f578?0x0:_0x90d0c6[_0x0c2b('0x2c')];var _0x1a34ce=_0x53f578?_0x1ed751[_0x0c2b('0x2f')]:_0x90d0c6[_0x0c2b('0x2c')]+_0x90d0c6[_0x0c2b('0x2d')];var _0xd44b75;if(_0x1a34ce>=_0x5c2d3b){_0x1a34ce=_0x5c2d3b;_0xd44b75=0xc8;}else{_0xd44b75=0xce;}_0x28e3c3[_0x0c2b('0x29')](_0xd44b75);return _0x28e3c3[_0x0c2b('0x30')](_0x0c2b('0x31'),_0x10c2e3+'-'+_0x1a34ce+'/'+_0x5c2d3b)['json'](_0x1ed751);}return null;};}function patchUpdates(_0x464636){return function(_0x1444b7){try{jsonpatch[_0x0c2b('0x32')](_0x1444b7,_0x464636,!![]);}catch(_0x53b192){return BPromise[_0x0c2b('0x33')](_0x53b192);}return _0x1444b7[_0x0c2b('0x34')]();};}function saveUpdates(_0x7b3266,_0x13f76e){return function(_0x4f4962){if(_0x4f4962){return _0x4f4962[_0x0c2b('0x35')](_0x7b3266)[_0x0c2b('0x36')](function(_0x46d3c7){return _0x46d3c7;});}return null;};}function removeEntity(_0x5e695a,_0x2b0cdf){return function(_0x5f0b0f){if(_0x5f0b0f){return _0x5f0b0f['destroy']()[_0x0c2b('0x36')](function(){var _0x501f16=_0x5f0b0f['get']({'plain':!![]});var _0xd41e81=_0x0c2b('0x37');return db[_0x0c2b('0x38')][_0x0c2b('0x39')]({'where':{'type':_0xd41e81,'resourceId':_0x501f16['id']}})['then'](function(){return _0x5f0b0f;});})[_0x0c2b('0x36')](function(){_0x5e695a['status'](0xcc)[_0x0c2b('0x2a')]();});}};}function handleEntityNotFound(_0x32d6ca,_0x385891){return function(_0x2569d9){if(!_0x2569d9){_0x32d6ca[_0x0c2b('0x28')](0x194);}return _0x2569d9;};}function handleError(_0x11e324,_0x2d35fa){_0x2d35fa=_0x2d35fa||0x1f4;return function(_0x2bc183){logger[_0x0c2b('0x22')](_0x2bc183[_0x0c2b('0x3a')]);if(_0x2bc183[_0x0c2b('0x3b')]){delete _0x2bc183[_0x0c2b('0x3b')];}_0x11e324[_0x0c2b('0x29')](_0x2d35fa)[_0x0c2b('0x3c')](_0x2bc183);};}exports['index']=function(_0x560e07,_0x5d56ab){var _0x4f8c6e={},_0x58e25e={},_0x86f62b={'count':0x0,'rows':[]};var _0x62f6c3=_['map'](db[_0x0c2b('0x3d')][_0x0c2b('0x3e')],function(_0x17611c){return{'name':_0x17611c[_0x0c2b('0x3f')],'type':_0x17611c[_0x0c2b('0x40')][_0x0c2b('0x41')]};});_0x58e25e[_0x0c2b('0x42')]=_[_0x0c2b('0x43')](_0x62f6c3,'name');_0x58e25e[_0x0c2b('0x44')]=_[_0x0c2b('0x45')](_0x560e07['query']);_0x58e25e[_0x0c2b('0x46')]=_[_0x0c2b('0x47')](_0x58e25e[_0x0c2b('0x42')],_0x58e25e[_0x0c2b('0x44')]);_0x4f8c6e[_0x0c2b('0x48')]=_[_0x0c2b('0x47')](_0x58e25e[_0x0c2b('0x42')],qs[_0x0c2b('0x49')](_0x560e07[_0x0c2b('0x44')]['fields']));_0x4f8c6e[_0x0c2b('0x48')]=_0x4f8c6e[_0x0c2b('0x48')]['length']?_0x4f8c6e['attributes']:_0x58e25e['model'];if(!_0x560e07[_0x0c2b('0x44')][_0x0c2b('0x4a')]('nolimit')){_0x4f8c6e[_0x0c2b('0x2d')]=qs[_0x0c2b('0x2d')](_0x560e07[_0x0c2b('0x44')]['limit']);_0x4f8c6e[_0x0c2b('0x2c')]=qs['offset'](_0x560e07[_0x0c2b('0x44')]['offset']);}_0x4f8c6e[_0x0c2b('0x4b')]=qs[_0x0c2b('0x4c')](_0x560e07['query'][_0x0c2b('0x4c')]);_0x4f8c6e['where']=qs[_0x0c2b('0x46')](_['pick'](_0x560e07[_0x0c2b('0x44')],_0x58e25e[_0x0c2b('0x46')]),_0x62f6c3);if(_0x560e07[_0x0c2b('0x44')][_0x0c2b('0x4d')]){_0x4f8c6e[_0x0c2b('0x4e')]=_[_0x0c2b('0x4f')](_0x4f8c6e[_0x0c2b('0x4e')],{'$or':_['map'](_0x62f6c3,function(_0x1625d7){if(_0x1625d7[_0x0c2b('0x40')]!=='VIRTUAL'){var _0x356157={};_0x356157[_0x1625d7[_0x0c2b('0x3b')]]={'$like':'%'+_0x560e07['query']['filter']+'%'};return _0x356157;}})});}_0x4f8c6e=_[_0x0c2b('0x4f')]({},_0x4f8c6e,_0x560e07['options']);var _0x500959={'where':_0x4f8c6e['where']};return db[_0x0c2b('0x3d')]['count'](_0x500959)['then'](function(_0x2995be){_0x86f62b[_0x0c2b('0x2f')]=_0x2995be;if(_0x560e07[_0x0c2b('0x44')]['includeAll']){_0x4f8c6e[_0x0c2b('0x50')]=[{'all':!![]}];}return db['VoiceContext'][_0x0c2b('0x51')](_0x4f8c6e);})['then'](function(_0x4cf961){_0x86f62b[_0x0c2b('0x52')]=_0x4cf961;return _0x86f62b;})[_0x0c2b('0x36')](respondWithFilteredResult(_0x5d56ab,_0x4f8c6e))['catch'](handleError(_0x5d56ab,null));};exports[_0x0c2b('0x53')]=function(_0xcb76cd,_0x29d197){var _0x1921c8={'raw':![],'where':{'id':_0xcb76cd[_0x0c2b('0x54')]['id']}},_0x56ac0d={};_0x56ac0d['model']=_[_0x0c2b('0x45')](db['VoiceContext'][_0x0c2b('0x3e')]);_0x56ac0d[_0x0c2b('0x44')]=_[_0x0c2b('0x45')](_0xcb76cd[_0x0c2b('0x44')]);_0x56ac0d['filters']=_[_0x0c2b('0x47')](_0x56ac0d['model'],_0x56ac0d['query']);_0x1921c8['attributes']=_[_0x0c2b('0x47')](_0x56ac0d['model'],qs[_0x0c2b('0x49')](_0xcb76cd[_0x0c2b('0x44')]['fields']));_0x1921c8[_0x0c2b('0x48')]=_0x1921c8[_0x0c2b('0x48')][_0x0c2b('0x55')]?_0x1921c8[_0x0c2b('0x48')]:_0x56ac0d['model'];if(_0xcb76cd['query'][_0x0c2b('0x56')]){_0x1921c8[_0x0c2b('0x50')]=[{'all':!![]}];}_0x1921c8=_[_0x0c2b('0x4f')]({},_0x1921c8,_0xcb76cd[_0x0c2b('0x57')]);return db[_0x0c2b('0x3d')][_0x0c2b('0x58')](_0x1921c8)[_0x0c2b('0x36')](handleEntityNotFound(_0x29d197,null))['then'](respondWithResult(_0x29d197,null))['catch'](handleError(_0x29d197,null));};exports[_0x0c2b('0x59')]=function(_0x4fd1ef,_0x3b9bf0,_0x337d82){var _0x2e7a89;return db[_0x0c2b('0x3d')]['create'](_0x4fd1ef[_0x0c2b('0x5a')],{'raw':!![]})[_0x0c2b('0x36')](function(_0x4d74f3){_0x2e7a89=_0x4d74f3;return db['VoiceContext'][_0x0c2b('0x51')]({'raw':!![]});})[_0x0c2b('0x36')](function(_0x5ebc34){var _0x3b5203=fs[_0x0c2b('0x5b')](path[_0x0c2b('0x5c')](config[_0x0c2b('0x5d')],_0x0c2b('0x5e')),_0x0c2b('0x5f'));var _0x1e2178=ejs[_0x0c2b('0x60')](_0x3b5203,{'contexts':_0x5ebc34||[]});fs['writeFileSync'](_0x0c2b('0x61'),_0x1e2178);})[_0x0c2b('0x36')](function(){return respondWithRpcPromise('Reload',_0x0c2b('0x59'),{'module':_0x0c2b('0x62')});})[_0x0c2b('0x36')](function(){var _0x4c7537=_0x4fd1ef[_0x0c2b('0x63')]['get']({'plain':!![]});if(!_0x4c7537)throw new Error(_0x0c2b('0x64'));if(_0x4c7537[_0x0c2b('0x65')]===_0x0c2b('0x63')){var _0x216ad1=_0x2e7a89['get']({'plain':!![]});return db['UserProfileSection'][_0x0c2b('0x58')]({'where':{'name':_0x0c2b('0x37'),'userProfileId':_0x4c7537[_0x0c2b('0x66')]},'raw':!![]})[_0x0c2b('0x36')](function(_0x4ee879){if(_0x4ee879&&_0x4ee879['autoAssociation']===0x0){return db['UserProfileResource'][_0x0c2b('0x59')]({'name':_0x216ad1[_0x0c2b('0x3b')],'resourceId':_0x216ad1['id'],'type':_0x4ee879[_0x0c2b('0x3b')],'sectionId':_0x4ee879['id']},{})[_0x0c2b('0x36')](function(){return _0x2e7a89;});}else{return _0x2e7a89;}})['catch'](function(_0x5053a0){logger[_0x0c2b('0x22')](_0x0c2b('0x67'),_0x5053a0);throw _0x5053a0;});}return _0x2e7a89;})[_0x0c2b('0x36')](respondWithResult(_0x3b9bf0,0xc9))['catch'](handleError(_0x3b9bf0,null));};exports['update']=function(_0x548945,_0x18b250,_0x4f097a){var _0x2fe6d0;return db[_0x0c2b('0x3d')][_0x0c2b('0x58')]({'where':{'id':_0x548945['params']['id']}})[_0x0c2b('0x36')](handleEntityNotFound(_0x18b250,null))[_0x0c2b('0x36')](saveUpdates(_0x548945['body'],null))['then'](function(_0x2539ee){if(_0x2539ee){_0x2fe6d0=_0x2539ee;return db['VoiceContext'][_0x0c2b('0x51')]({'raw':!![]});}})[_0x0c2b('0x36')](function(_0x252fcb){var _0x452dc1=fs['readFileSync'](path[_0x0c2b('0x5c')](config[_0x0c2b('0x5d')],_0x0c2b('0x5e')),_0x0c2b('0x5f'));var _0x54c3be=ejs['render'](_0x452dc1,{'contexts':_0x252fcb||[]});fs['writeFileSync'](_0x0c2b('0x61'),_0x54c3be);})['then'](function(){return respondWithRpcPromise(_0x0c2b('0x68'),'update',{'module':'chan_sip.so'});})[_0x0c2b('0x36')](function(){return _0x2fe6d0;})['then'](respondWithResult(_0x18b250,null))['catch'](handleError(_0x18b250,null));};exports[_0x0c2b('0x39')]=function(_0x3e5a3b,_0x37f8f7,_0xdaeaaa){var _0x179956;return db[_0x0c2b('0x3d')][_0x0c2b('0x58')]({'where':{'id':_0x3e5a3b[_0x0c2b('0x54')]['id']}})['then'](handleEntityNotFound(_0x37f8f7,null))['then'](removeEntity(_0x37f8f7,null))[_0x0c2b('0x36')](function(){return db[_0x0c2b('0x3d')]['findAll']({'raw':!![]});})['then'](function(_0x537f9f){var _0x128c61=fs[_0x0c2b('0x5b')](path[_0x0c2b('0x5c')](config[_0x0c2b('0x5d')],_0x0c2b('0x5e')),_0x0c2b('0x5f'));var _0x963c24=ejs[_0x0c2b('0x60')](_0x128c61,{'contexts':_0x537f9f});fs['writeFileSync'](_0x0c2b('0x61'),_0x963c24);return respondWithRpcPromise('Reload',_0x0c2b('0x39'),{'module':'chan_sip.so'});})['catch'](handleError(_0x37f8f7,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 54e262e..4f3f97f 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 _0x94da=['path','rimraf','../../config/environment','./voiceContext.attributes','define','VoiceContext','util','api','moment'];(function(_0x81fee8,_0x32f097){var _0x2b2c4e=function(_0x20c43e){while(--_0x20c43e){_0x81fee8['push'](_0x81fee8['shift']());}};_0x2b2c4e(++_0x32f097);}(_0x94da,0x1c8));var _0xa94d=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0x94da[_0x166d93];return _0xba708;};'use strict';var _=require('lodash');var util=require(_0xa94d('0x0'));var logger=require('../../config/logger')(_0xa94d('0x1'));var moment=require(_0xa94d('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa94d('0x3'));var rimraf=require(_0xa94d('0x4'));var config=require(_0xa94d('0x5'));var attributes=require(_0xa94d('0x6'));module['exports']=function(_0x1e04cd,_0x4f503d){return _0x1e04cd[_0xa94d('0x7')](_0xa94d('0x8'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa7ef=['VoiceContext','voice_contexts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','exports','define'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xa7ef,0x16a));var _0xfa7e=function(_0x168713,_0x5323c7){_0x168713=_0x168713-0x0;var _0x1e647b=_0xa7ef[_0x168713];return _0x1e647b;};'use strict';var _=require(_0xfa7e('0x0'));var util=require(_0xfa7e('0x1'));var logger=require(_0xfa7e('0x2'))(_0xfa7e('0x3'));var moment=require(_0xfa7e('0x4'));var BPromise=require(_0xfa7e('0x5'));var rp=require(_0xfa7e('0x6'));var fs=require('fs');var path=require(_0xfa7e('0x7'));var rimraf=require(_0xfa7e('0x8'));var config=require(_0xfa7e('0x9'));var attributes=require(_0xfa7e('0xa'));module[_0xfa7e('0xb')]=function(_0xf2a1f8,_0x56a1cc){return _0xf2a1f8[_0xfa7e('0xc')](_0xfa7e('0xd'),attributes,{'tableName':_0xfa7e('0xe'),'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 57809ed..78d3837 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 _0xc5cf=['code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xc5cf,0x15b));var _0xfc5c=function(_0x386ca8,_0x64d6ca){_0x386ca8=_0x386ca8-0x0;var _0x5872ef=_0xc5cf[_0x386ca8];return _0x5872ef;};'use strict';var _=require(_0xfc5c('0x0'));var util=require(_0xfc5c('0x1'));var moment=require(_0xfc5c('0x2'));var BPromise=require(_0xfc5c('0x3'));var rs=require(_0xfc5c('0x4'));var fs=require('fs');var Redis=require(_0xfc5c('0x5'));var db=require(_0xfc5c('0x6'))['db'];var utils=require(_0xfc5c('0x7'));var logger=require(_0xfc5c('0x8'))('rpc');var config=require(_0xfc5c('0x9'));var jayson=require(_0xfc5c('0xa'));var client=jayson[_0xfc5c('0xb')][_0xfc5c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2e99e9,_0x5e2429,_0x56a628){return new BPromise(function(_0x5b53e1,_0x102495){return client[_0xfc5c('0xd')](_0x2e99e9,_0x56a628)[_0xfc5c('0xe')](function(_0x43bbc6){logger['info'](_0xfc5c('0xf'),_0x5e2429,_0xfc5c('0x10'));logger[_0xfc5c('0x11')](_0xfc5c('0x12'),_0x5e2429,_0xfc5c('0x10'),JSON[_0xfc5c('0x13')](_0x43bbc6));if(_0x43bbc6[_0xfc5c('0x14')]){if(_0x43bbc6[_0xfc5c('0x14')][_0xfc5c('0x15')]===0x1f4){logger[_0xfc5c('0x14')](_0xfc5c('0xf'),_0x5e2429,_0x43bbc6[_0xfc5c('0x14')][_0xfc5c('0x16')]);return _0x102495(_0x43bbc6[_0xfc5c('0x14')][_0xfc5c('0x16')]);}logger['error'](_0xfc5c('0xf'),_0x5e2429,_0x43bbc6['error'][_0xfc5c('0x16')]);return _0x5b53e1(_0x43bbc6[_0xfc5c('0x14')][_0xfc5c('0x16')]);}else{logger['info'](_0xfc5c('0xf'),_0x5e2429,'request\x20sent');_0x5b53e1(_0x43bbc6['result']['message']);}})['catch'](function(_0x86f98e){logger['error'](_0xfc5c('0xf'),_0x5e2429,_0x86f98e);_0x102495(_0x86f98e);});});} \ No newline at end of file +var _0xcc1b=['code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceContext,\x20%s,\x20%s','request\x20sent','error'];(function(_0x5439b6,_0x5365e8){var _0x2de07c=function(_0x24fbdf){while(--_0x24fbdf){_0x5439b6['push'](_0x5439b6['shift']());}};_0x2de07c(++_0x5365e8);}(_0xcc1b,0x100));var _0xbcc1=function(_0x12964a,_0x1956bc){_0x12964a=_0x12964a-0x0;var _0x519fbf=_0xcc1b[_0x12964a];return _0x519fbf;};'use strict';var _=require(_0xbcc1('0x0'));var util=require('util');var moment=require(_0xbcc1('0x1'));var BPromise=require(_0xbcc1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbcc1('0x3'));var db=require(_0xbcc1('0x4'))['db'];var utils=require(_0xbcc1('0x5'));var logger=require(_0xbcc1('0x6'))(_0xbcc1('0x7'));var config=require(_0xbcc1('0x8'));var jayson=require(_0xbcc1('0x9'));var client=jayson[_0xbcc1('0xa')][_0xbcc1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x559efa,_0x39bea1,_0x5ae0e1){return new BPromise(function(_0x2581d3,_0x50a057){return client[_0xbcc1('0xc')](_0x559efa,_0x5ae0e1)[_0xbcc1('0xd')](function(_0x1abc8a){logger['info'](_0xbcc1('0xe'),_0x39bea1,'request\x20sent');logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0x39bea1,_0xbcc1('0xf'),JSON['stringify'](_0x1abc8a));if(_0x1abc8a[_0xbcc1('0x10')]){if(_0x1abc8a[_0xbcc1('0x10')][_0xbcc1('0x11')]===0x1f4){logger[_0xbcc1('0x10')](_0xbcc1('0xe'),_0x39bea1,_0x1abc8a['error'][_0xbcc1('0x12')]);return _0x50a057(_0x1abc8a['error'][_0xbcc1('0x12')]);}logger[_0xbcc1('0x10')](_0xbcc1('0xe'),_0x39bea1,_0x1abc8a[_0xbcc1('0x10')][_0xbcc1('0x12')]);return _0x2581d3(_0x1abc8a[_0xbcc1('0x10')][_0xbcc1('0x12')]);}else{logger['info'](_0xbcc1('0xe'),_0x39bea1,_0xbcc1('0xf'));_0x2581d3(_0x1abc8a[_0xbcc1('0x13')][_0xbcc1('0x12')]);}})[_0xbcc1('0x14')](function(_0xd33be0){logger[_0xbcc1('0x10')]('VoiceContext,\x20%s,\x20%s',_0x39bea1,_0xd33be0);_0x50a057(_0xd33be0);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 7560f8c..718c63c 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 _0xae3d=['describe','show','post','create','put','/:id','delete','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./voiceDialReport.controller','get','isAuthenticated','index','/describe'];(function(_0x371649,_0x24ea21){var _0x2bb9ed=function(_0x550da3){while(--_0x550da3){_0x371649['push'](_0x371649['shift']());}};_0x2bb9ed(++_0x24ea21);}(_0xae3d,0x1e3));var _0xdae3=function(_0x45bf86,_0x75586e){_0x45bf86=_0x45bf86-0x0;var _0x1f02b7=_0xae3d[_0x45bf86];return _0x1f02b7;};'use strict';var multer=require(_0xdae3('0x0'));var util=require(_0xdae3('0x1'));var path=require('path');var timeout=require(_0xdae3('0x2'));var express=require(_0xdae3('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdae3('0x4'));var interaction=require(_0xdae3('0x5'));var config=require('../../config/environment');var controller=require(_0xdae3('0x6'));router[_0xdae3('0x7')]('/',auth[_0xdae3('0x8')](),controller[_0xdae3('0x9')]);router[_0xdae3('0x7')](_0xdae3('0xa'),auth[_0xdae3('0x8')](),controller[_0xdae3('0xb')]);router['get']('/:id',auth[_0xdae3('0x8')](),controller[_0xdae3('0xc')]);router[_0xdae3('0xd')]('/',auth[_0xdae3('0x8')](),controller[_0xdae3('0xe')]);router[_0xdae3('0xf')](_0xdae3('0x10'),auth[_0xdae3('0x8')](),controller['update']);router[_0xdae3('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xdae3('0x12')]=router; \ No newline at end of file +var _0xc874=['multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceDialReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','destroy','exports'];(function(_0x1ecfb6,_0x1b1395){var _0xf46dd5=function(_0x11409e){while(--_0x11409e){_0x1ecfb6['push'](_0x1ecfb6['shift']());}};_0xf46dd5(++_0x1b1395);}(_0xc874,0x154));var _0x4c87=function(_0x673722,_0x275d7e){_0x673722=_0x673722-0x0;var _0x21249c=_0xc874[_0x673722];return _0x21249c;};'use strict';var multer=require(_0x4c87('0x0'));var util=require('util');var path=require(_0x4c87('0x1'));var timeout=require(_0x4c87('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4c87('0x3'));var auth=require(_0x4c87('0x4'));var interaction=require(_0x4c87('0x5'));var config=require('../../config/environment');var controller=require(_0x4c87('0x6'));router[_0x4c87('0x7')]('/',auth['isAuthenticated'](),controller[_0x4c87('0x8')]);router[_0x4c87('0x7')](_0x4c87('0x9'),auth[_0x4c87('0xa')](),controller[_0x4c87('0xb')]);router['get'](_0x4c87('0xc'),auth['isAuthenticated'](),controller[_0x4c87('0xd')]);router[_0x4c87('0xe')]('/',auth[_0x4c87('0xa')](),controller[_0x4c87('0xf')]);router[_0x4c87('0x10')]('/:id',auth[_0x4c87('0xa')](),controller[_0x4c87('0x11')]);router['delete'](_0x4c87('0xc'),auth[_0x4c87('0xa')](),controller[_0x4c87('0x12')]);module[_0x4c87('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index d57139f..dce005f 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 _0xf2ca=['DATE','called,connect,complete','sequelize','exports','STRING','INTEGER'];(function(_0x51353f,_0x1fca1d){var _0x43390a=function(_0x833698){while(--_0x833698){_0x51353f['push'](_0x51353f['shift']());}};_0x43390a(++_0x1fca1d);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x430459,_0x58519c){_0x430459=_0x430459-0x0;var _0x3a2439=_0xf2ca[_0x430459];return _0x3a2439;};'use strict';var Sequelize=require(_0xaf2c('0x0'));module[_0xaf2c('0x1')]={'privilege':{'type':Sequelize[_0xaf2c('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xaf2c('0x3')]},'channelstatedesc':{'type':Sequelize[_0xaf2c('0x2')]},'calleridnum':{'type':Sequelize[_0xaf2c('0x2')]},'calleridname':{'type':Sequelize[_0xaf2c('0x2')]},'connectedlinenum':{'type':Sequelize[_0xaf2c('0x2')]},'connectedlinename':{'type':Sequelize[_0xaf2c('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xaf2c('0x2')]},'context':{'type':Sequelize[_0xaf2c('0x2')]},'exten':{'type':Sequelize[_0xaf2c('0x2')]},'priority':{'type':Sequelize[_0xaf2c('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xaf2c('0x2')]},'destchannel':{'type':Sequelize[_0xaf2c('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xaf2c('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xaf2c('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xaf2c('0x2')]},'destlanguage':{'type':Sequelize[_0xaf2c('0x2')]},'destaccountcode':{'type':Sequelize[_0xaf2c('0x2')]},'destcontext':{'type':Sequelize[_0xaf2c('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0xaf2c('0x2')]},'destlinkedid':{'type':Sequelize[_0xaf2c('0x2')]},'dialstring':{'type':Sequelize[_0xaf2c('0x2')]},'dialstatus':{'type':Sequelize[_0xaf2c('0x2')]},'starttime':{'type':Sequelize[_0xaf2c('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xaf2c('0x2')],'comment':_0xaf2c('0x5')},'routeId':{'type':Sequelize[_0xaf2c('0x3')]},'duration':{'type':Sequelize[_0xaf2c('0x3')]},'holdtime':{'type':Sequelize[_0xaf2c('0x3')]},'billableseconds':{'type':Sequelize[_0xaf2c('0x3')]}}; \ No newline at end of file +var _0x00bb=['STRING','INTEGER','DATE','called,connect,complete','sequelize','exports'];(function(_0x256fd6,_0x4cb467){var _0x543801=function(_0x11e227){while(--_0x11e227){_0x256fd6['push'](_0x256fd6['shift']());}};_0x543801(++_0x4cb467);}(_0x00bb,0x1d8));var _0xb00b=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x00bb[_0x618414];return _0x21c19a;};'use strict';var Sequelize=require(_0xb00b('0x0'));module[_0xb00b('0x1')]={'privilege':{'type':Sequelize[_0xb00b('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xb00b('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xb00b('0x2')]},'calleridname':{'type':Sequelize[_0xb00b('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xb00b('0x2')]},'language':{'type':Sequelize[_0xb00b('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xb00b('0x3')]},'uniqueid':{'type':Sequelize[_0xb00b('0x2')]},'linkedid':{'type':Sequelize[_0xb00b('0x2')]},'destchannel':{'type':Sequelize[_0xb00b('0x2')]},'destchannelstate':{'type':Sequelize[_0xb00b('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xb00b('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xb00b('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xb00b('0x2')]},'destlanguage':{'type':Sequelize[_0xb00b('0x2')]},'destaccountcode':{'type':Sequelize[_0xb00b('0x2')]},'destcontext':{'type':Sequelize[_0xb00b('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xb00b('0x3')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0xb00b('0x2')]},'starttime':{'type':Sequelize[_0xb00b('0x4')]},'answertime':{'type':Sequelize[_0xb00b('0x4')]},'endtime':{'type':Sequelize[_0xb00b('0x4')]},'lastevent':{'type':Sequelize[_0xb00b('0x2')],'comment':_0xb00b('0x5')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0xb00b('0x3')]},'holdtime':{'type':Sequelize[_0xb00b('0x3')]},'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 3f9c336..9432054 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 _0xcaf1=['model','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','intersection','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','offset','limit','undefined','count','json','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','query','filters'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xcaf1,0x13c));var _0x1caf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcaf1[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x1caf('0x0'));var rimraf=require(_0x1caf('0x1'));var zipdir=require(_0x1caf('0x2'));var jsonpatch=require(_0x1caf('0x3'));var rp=require(_0x1caf('0x4'));var moment=require('moment');var BPromise=require(_0x1caf('0x5'));var Mustache=require('mustache');var util=require(_0x1caf('0x6'));var path=require(_0x1caf('0x7'));var sox=require('sox');var csv=require(_0x1caf('0x8'));var ejs=require(_0x1caf('0x9'));var fs=require('fs');var fs_extra=require(_0x1caf('0xa'));var _=require(_0x1caf('0xb'));var squel=require(_0x1caf('0xc'));var crypto=require(_0x1caf('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1caf('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1caf('0xf'));var Redis=require('ioredis');var authService=require(_0x1caf('0x10'));var qs=require(_0x1caf('0x11'));var as=require(_0x1caf('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1caf('0x13'))(_0x1caf('0x14'));var utils=require(_0x1caf('0x15'));var config=require(_0x1caf('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x588b85,_0x3a4b45){_0x3a4b45=_0x3a4b45||0xcc;return function(_0x422504){if(_0x422504){return _0x588b85[_0x1caf('0x17')](_0x3a4b45);}return _0x588b85['status'](_0x3a4b45)[_0x1caf('0x18')]();};}function respondWithResult(_0x378839,_0x1691fd){_0x1691fd=_0x1691fd||0xc8;return function(_0x482f4e){if(_0x482f4e){return _0x378839[_0x1caf('0x19')](_0x1691fd)['json'](_0x482f4e);}};}function respondWithFilteredResult(_0x44702f,_0x47efe7){return function(_0x3c97e3){if(_0x3c97e3){var _0x594160=typeof _0x47efe7[_0x1caf('0x1a')]==='undefined'&&typeof _0x47efe7[_0x1caf('0x1b')]===_0x1caf('0x1c');var _0x30013a=_0x3c97e3[_0x1caf('0x1d')];var _0x5cd5f6=_0x594160?0x0:_0x47efe7[_0x1caf('0x1a')];var _0x54b7c2=_0x594160?_0x3c97e3[_0x1caf('0x1d')]:_0x47efe7[_0x1caf('0x1a')]+_0x47efe7[_0x1caf('0x1b')];var _0x4379ca;if(_0x54b7c2>=_0x30013a){_0x54b7c2=_0x30013a;_0x4379ca=0xc8;}else{_0x4379ca=0xce;}_0x44702f['status'](_0x4379ca);return _0x44702f['set']('Content-Range',_0x5cd5f6+'-'+_0x54b7c2+'/'+_0x30013a)[_0x1caf('0x1e')](_0x3c97e3);}return null;};}function patchUpdates(_0x3830b6){return function(_0x3e5e5f){try{jsonpatch['apply'](_0x3e5e5f,_0x3830b6,!![]);}catch(_0x27c4a6){return BPromise[_0x1caf('0x1f')](_0x27c4a6);}return _0x3e5e5f[_0x1caf('0x20')]();};}function saveUpdates(_0xdf5991,_0x11bfea){return function(_0x206c2f){if(_0x206c2f){return _0x206c2f[_0x1caf('0x21')](_0xdf5991)[_0x1caf('0x22')](function(_0x2519c4){return _0x2519c4;});}return null;};}function removeEntity(_0x2fa3e6,_0xaa0df1){return function(_0xa16d18){if(_0xa16d18){return _0xa16d18[_0x1caf('0x23')]()['then'](function(){_0x2fa3e6[_0x1caf('0x19')](0xcc)[_0x1caf('0x18')]();});}};}function handleEntityNotFound(_0x34c78c,_0x323225){return function(_0x3aaf13){if(!_0x3aaf13){_0x34c78c[_0x1caf('0x17')](0x194);}return _0x3aaf13;};}function handleError(_0xd028a4,_0x4a0ae0){_0x4a0ae0=_0x4a0ae0||0x1f4;return function(_0x378219){logger[_0x1caf('0x24')](_0x378219[_0x1caf('0x25')]);if(_0x378219[_0x1caf('0x26')]){delete _0x378219[_0x1caf('0x26')];}_0xd028a4[_0x1caf('0x19')](_0x4a0ae0)[_0x1caf('0x27')](_0x378219);};}exports[_0x1caf('0x28')]=function(_0x44fc37,_0x1734e1){var _0x287126={},_0x16ecff={},_0x4ebaea={'count':0x0,'rows':[]};var _0xbb1625=_[_0x1caf('0x29')](db[_0x1caf('0x2a')][_0x1caf('0x2b')],function(_0x2df812){return{'name':_0x2df812[_0x1caf('0x2c')],'type':_0x2df812[_0x1caf('0x2d')][_0x1caf('0x2e')]};});_0x16ecff['model']=_[_0x1caf('0x29')](_0xbb1625,_0x1caf('0x26'));_0x16ecff[_0x1caf('0x2f')]=_['keys'](_0x44fc37[_0x1caf('0x2f')]);_0x16ecff[_0x1caf('0x30')]=_['intersection'](_0x16ecff[_0x1caf('0x31')],_0x16ecff[_0x1caf('0x2f')]);_0x287126[_0x1caf('0x32')]=_['intersection'](_0x16ecff[_0x1caf('0x31')],qs[_0x1caf('0x33')](_0x44fc37[_0x1caf('0x2f')][_0x1caf('0x33')]));_0x287126[_0x1caf('0x32')]=_0x287126['attributes'][_0x1caf('0x34')]?_0x287126['attributes']:_0x16ecff[_0x1caf('0x31')];if(!_0x44fc37[_0x1caf('0x2f')][_0x1caf('0x35')]('nolimit')){_0x287126[_0x1caf('0x1b')]=qs['limit'](_0x44fc37['query'][_0x1caf('0x1b')]);_0x287126[_0x1caf('0x1a')]=qs['offset'](_0x44fc37['query'][_0x1caf('0x1a')]);}_0x287126['order']=qs[_0x1caf('0x36')](_0x44fc37[_0x1caf('0x2f')][_0x1caf('0x36')]);_0x287126['where']=qs[_0x1caf('0x30')](_[_0x1caf('0x37')](_0x44fc37[_0x1caf('0x2f')],_0x16ecff['filters']),_0xbb1625);if(_0x44fc37[_0x1caf('0x2f')][_0x1caf('0x38')]){_0x287126[_0x1caf('0x39')]=_[_0x1caf('0x3a')](_0x287126[_0x1caf('0x39')],{'$or':_[_0x1caf('0x29')](_0xbb1625,function(_0x29e856){if(_0x29e856[_0x1caf('0x2d')]!==_0x1caf('0x3b')){var _0x1a200b={};_0x1a200b[_0x29e856[_0x1caf('0x26')]]={'$like':'%'+_0x44fc37['query'][_0x1caf('0x38')]+'%'};return _0x1a200b;}})});}_0x287126=_[_0x1caf('0x3a')]({},_0x287126,_0x44fc37[_0x1caf('0x3c')]);var _0x5a3996={'where':_0x287126[_0x1caf('0x39')]};return db['VoiceDialReport'][_0x1caf('0x1d')](_0x5a3996)[_0x1caf('0x22')](function(_0x1b84cd){_0x4ebaea[_0x1caf('0x1d')]=_0x1b84cd;if(_0x44fc37[_0x1caf('0x2f')][_0x1caf('0x3d')]){_0x287126[_0x1caf('0x3e')]=[{'all':!![]}];}return db[_0x1caf('0x2a')]['findAll'](_0x287126);})[_0x1caf('0x22')](function(_0x522e95){_0x4ebaea[_0x1caf('0x3f')]=_0x522e95;return _0x4ebaea;})[_0x1caf('0x22')](respondWithFilteredResult(_0x1734e1,_0x287126))[_0x1caf('0x40')](handleError(_0x1734e1,null));};exports[_0x1caf('0x41')]=function(_0xbc7592,_0x5c61ed){var _0x5371d2={'raw':!![],'where':{'id':_0xbc7592[_0x1caf('0x42')]['id']}},_0xb14952={};_0xb14952[_0x1caf('0x31')]=_[_0x1caf('0x43')](db[_0x1caf('0x2a')]['rawAttributes']);_0xb14952[_0x1caf('0x2f')]=_[_0x1caf('0x43')](_0xbc7592[_0x1caf('0x2f')]);_0xb14952['filters']=_[_0x1caf('0x44')](_0xb14952[_0x1caf('0x31')],_0xb14952[_0x1caf('0x2f')]);_0x5371d2[_0x1caf('0x32')]=_[_0x1caf('0x44')](_0xb14952[_0x1caf('0x31')],qs[_0x1caf('0x33')](_0xbc7592[_0x1caf('0x2f')][_0x1caf('0x33')]));_0x5371d2[_0x1caf('0x32')]=_0x5371d2[_0x1caf('0x32')][_0x1caf('0x34')]?_0x5371d2[_0x1caf('0x32')]:_0xb14952[_0x1caf('0x31')];if(_0xbc7592[_0x1caf('0x2f')]['includeAll']){_0x5371d2[_0x1caf('0x3e')]=[{'all':!![]}];}_0x5371d2=_['merge']({},_0x5371d2,_0xbc7592[_0x1caf('0x3c')]);return db[_0x1caf('0x2a')][_0x1caf('0x45')](_0x5371d2)[_0x1caf('0x22')](handleEntityNotFound(_0x5c61ed,null))[_0x1caf('0x22')](respondWithResult(_0x5c61ed,null))[_0x1caf('0x40')](handleError(_0x5c61ed,null));};exports[_0x1caf('0x46')]=function(_0x37fc58,_0xea4bee){return db[_0x1caf('0x2a')][_0x1caf('0x46')](_0x37fc58[_0x1caf('0x47')],{})['then'](respondWithResult(_0xea4bee,0xc9))[_0x1caf('0x40')](handleError(_0xea4bee,null));};exports[_0x1caf('0x21')]=function(_0x20bf36,_0x7d5e2c){if(_0x20bf36[_0x1caf('0x47')]['id']){delete _0x20bf36[_0x1caf('0x47')]['id'];}return db[_0x1caf('0x2a')]['find']({'where':{'id':_0x20bf36['params']['id']}})[_0x1caf('0x22')](handleEntityNotFound(_0x7d5e2c,null))[_0x1caf('0x22')](saveUpdates(_0x20bf36[_0x1caf('0x47')],null))['then'](respondWithResult(_0x7d5e2c,null))['catch'](handleError(_0x7d5e2c,null));};exports[_0x1caf('0x23')]=function(_0x2d5e5b,_0x16be23){return db[_0x1caf('0x2a')]['find']({'where':{'id':_0x2d5e5b[_0x1caf('0x42')]['id']}})[_0x1caf('0x22')](handleEntityNotFound(_0x16be23,null))[_0x1caf('0x22')](removeEntity(_0x16be23,null))[_0x1caf('0x40')](handleError(_0x16be23,null));};exports['describe']=function(_0x838a6,_0x5240c1){return db['VoiceDialReport'][_0x1caf('0x48')]()[_0x1caf('0x22')](respondWithResult(_0x5240c1,null))[_0x1caf('0x40')](handleError(_0x5240c1,null));}; \ No newline at end of file +var _0x2137=['key','model','query','filters','intersection','attributes','nolimit','sort','where','pick','filter','merge','options','VoiceDialReport','include','findAll','rows','show','params','keys','fields','length','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','count','limit','set','Content-Range','apply','save','update','then','error','name','send','index','map','rawAttributes','type'];(function(_0x4f32d7,_0xd7f0f8){var _0x34b5d4=function(_0x49cf32){while(--_0x49cf32){_0x4f32d7['push'](_0x4f32d7['shift']());}};_0x34b5d4(++_0xd7f0f8);}(_0x2137,0xed));var _0x7213=function(_0x6f3151,_0x406745){_0x6f3151=_0x6f3151-0x0;var _0x305fb8=_0x2137[_0x6f3151];return _0x305fb8;};'use strict';var emlformat=require(_0x7213('0x0'));var rimraf=require(_0x7213('0x1'));var zipdir=require(_0x7213('0x2'));var jsonpatch=require(_0x7213('0x3'));var rp=require('request-promise');var moment=require(_0x7213('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7213('0x5'));var path=require(_0x7213('0x6'));var sox=require(_0x7213('0x7'));var csv=require(_0x7213('0x8'));var ejs=require(_0x7213('0x9'));var fs=require('fs');var fs_extra=require(_0x7213('0xa'));var _=require('lodash');var squel=require(_0x7213('0xb'));var crypto=require('crypto');var jsforce=require(_0x7213('0xc'));var deskjs=require(_0x7213('0xd'));var toCsv=require(_0x7213('0x8'));var querystring=require(_0x7213('0xe'));var Papa=require(_0x7213('0xf'));var Redis=require(_0x7213('0x10'));var authService=require(_0x7213('0x11'));var qs=require(_0x7213('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7213('0x13'));var logger=require(_0x7213('0x14'))('api');var utils=require(_0x7213('0x15'));var config=require(_0x7213('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x7213('0x17'))['db'];function respondWithStatusCode(_0x44036c,_0x2a6717){_0x2a6717=_0x2a6717||0xcc;return function(_0x3f60f6){if(_0x3f60f6){return _0x44036c[_0x7213('0x18')](_0x2a6717);}return _0x44036c[_0x7213('0x19')](_0x2a6717)['end']();};}function respondWithResult(_0x36d94b,_0x94bd4){_0x94bd4=_0x94bd4||0xc8;return function(_0x4864ab){if(_0x4864ab){return _0x36d94b[_0x7213('0x19')](_0x94bd4)[_0x7213('0x1a')](_0x4864ab);}};}function respondWithFilteredResult(_0x5588ae,_0x169ed0){return function(_0xf35894){if(_0xf35894){var _0x5ce049=typeof _0x169ed0[_0x7213('0x1b')]==='undefined'&&typeof _0x169ed0['limit']==='undefined';var _0x7d0a21=_0xf35894[_0x7213('0x1c')];var _0x1cf9a7=_0x5ce049?0x0:_0x169ed0[_0x7213('0x1b')];var _0x499022=_0x5ce049?_0xf35894['count']:_0x169ed0['offset']+_0x169ed0[_0x7213('0x1d')];var _0x402bb7;if(_0x499022>=_0x7d0a21){_0x499022=_0x7d0a21;_0x402bb7=0xc8;}else{_0x402bb7=0xce;}_0x5588ae[_0x7213('0x19')](_0x402bb7);return _0x5588ae[_0x7213('0x1e')](_0x7213('0x1f'),_0x1cf9a7+'-'+_0x499022+'/'+_0x7d0a21)['json'](_0xf35894);}return null;};}function patchUpdates(_0x125d27){return function(_0x59fc27){try{jsonpatch[_0x7213('0x20')](_0x59fc27,_0x125d27,!![]);}catch(_0x670ab4){return BPromise['reject'](_0x670ab4);}return _0x59fc27[_0x7213('0x21')]();};}function saveUpdates(_0x110a51,_0x5ce829){return function(_0x571a5a){if(_0x571a5a){return _0x571a5a[_0x7213('0x22')](_0x110a51)['then'](function(_0x10bf82){return _0x10bf82;});}return null;};}function removeEntity(_0x2430aa,_0x23f2d0){return function(_0x57c02c){if(_0x57c02c){return _0x57c02c['destroy']()[_0x7213('0x23')](function(){_0x2430aa['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c346a,_0x1cf481){return function(_0x1ef7bf){if(!_0x1ef7bf){_0x5c346a[_0x7213('0x18')](0x194);}return _0x1ef7bf;};}function handleError(_0x513f3a,_0x1a5d16){_0x1a5d16=_0x1a5d16||0x1f4;return function(_0x5222c6){logger[_0x7213('0x24')](_0x5222c6['stack']);if(_0x5222c6[_0x7213('0x25')]){delete _0x5222c6[_0x7213('0x25')];}_0x513f3a['status'](_0x1a5d16)[_0x7213('0x26')](_0x5222c6);};}exports[_0x7213('0x27')]=function(_0x147ed8,_0x47685b){var _0x4319bb={},_0x1f9022={},_0x2b60d2={'count':0x0,'rows':[]};var _0x3a211f=_[_0x7213('0x28')](db['VoiceDialReport'][_0x7213('0x29')],function(_0x3aa382){return{'name':_0x3aa382['fieldName'],'type':_0x3aa382[_0x7213('0x2a')][_0x7213('0x2b')]};});_0x1f9022[_0x7213('0x2c')]=_[_0x7213('0x28')](_0x3a211f,_0x7213('0x25'));_0x1f9022['query']=_['keys'](_0x147ed8[_0x7213('0x2d')]);_0x1f9022[_0x7213('0x2e')]=_[_0x7213('0x2f')](_0x1f9022[_0x7213('0x2c')],_0x1f9022[_0x7213('0x2d')]);_0x4319bb['attributes']=_[_0x7213('0x2f')](_0x1f9022[_0x7213('0x2c')],qs['fields'](_0x147ed8[_0x7213('0x2d')]['fields']));_0x4319bb['attributes']=_0x4319bb['attributes']['length']?_0x4319bb[_0x7213('0x30')]:_0x1f9022[_0x7213('0x2c')];if(!_0x147ed8[_0x7213('0x2d')]['hasOwnProperty'](_0x7213('0x31'))){_0x4319bb[_0x7213('0x1d')]=qs[_0x7213('0x1d')](_0x147ed8[_0x7213('0x2d')][_0x7213('0x1d')]);_0x4319bb[_0x7213('0x1b')]=qs['offset'](_0x147ed8[_0x7213('0x2d')][_0x7213('0x1b')]);}_0x4319bb['order']=qs[_0x7213('0x32')](_0x147ed8[_0x7213('0x2d')][_0x7213('0x32')]);_0x4319bb[_0x7213('0x33')]=qs[_0x7213('0x2e')](_[_0x7213('0x34')](_0x147ed8[_0x7213('0x2d')],_0x1f9022[_0x7213('0x2e')]),_0x3a211f);if(_0x147ed8[_0x7213('0x2d')][_0x7213('0x35')]){_0x4319bb[_0x7213('0x33')]=_[_0x7213('0x36')](_0x4319bb[_0x7213('0x33')],{'$or':_['map'](_0x3a211f,function(_0xa52562){if(_0xa52562[_0x7213('0x2a')]!=='VIRTUAL'){var _0x1fd533={};_0x1fd533[_0xa52562[_0x7213('0x25')]]={'$like':'%'+_0x147ed8[_0x7213('0x2d')][_0x7213('0x35')]+'%'};return _0x1fd533;}})});}_0x4319bb=_[_0x7213('0x36')]({},_0x4319bb,_0x147ed8[_0x7213('0x37')]);var _0x32411e={'where':_0x4319bb[_0x7213('0x33')]};return db[_0x7213('0x38')][_0x7213('0x1c')](_0x32411e)[_0x7213('0x23')](function(_0xa36cde){_0x2b60d2[_0x7213('0x1c')]=_0xa36cde;if(_0x147ed8[_0x7213('0x2d')]['includeAll']){_0x4319bb[_0x7213('0x39')]=[{'all':!![]}];}return db[_0x7213('0x38')][_0x7213('0x3a')](_0x4319bb);})[_0x7213('0x23')](function(_0x3106e8){_0x2b60d2[_0x7213('0x3b')]=_0x3106e8;return _0x2b60d2;})[_0x7213('0x23')](respondWithFilteredResult(_0x47685b,_0x4319bb))['catch'](handleError(_0x47685b,null));};exports[_0x7213('0x3c')]=function(_0x185a98,_0x7ea707){var _0x428031={'raw':!![],'where':{'id':_0x185a98[_0x7213('0x3d')]['id']}},_0xe10040={};_0xe10040['model']=_[_0x7213('0x3e')](db[_0x7213('0x38')][_0x7213('0x29')]);_0xe10040[_0x7213('0x2d')]=_[_0x7213('0x3e')](_0x185a98['query']);_0xe10040[_0x7213('0x2e')]=_[_0x7213('0x2f')](_0xe10040['model'],_0xe10040['query']);_0x428031['attributes']=_[_0x7213('0x2f')](_0xe10040[_0x7213('0x2c')],qs[_0x7213('0x3f')](_0x185a98[_0x7213('0x2d')][_0x7213('0x3f')]));_0x428031[_0x7213('0x30')]=_0x428031[_0x7213('0x30')][_0x7213('0x40')]?_0x428031[_0x7213('0x30')]:_0xe10040['model'];if(_0x185a98[_0x7213('0x2d')]['includeAll']){_0x428031[_0x7213('0x39')]=[{'all':!![]}];}_0x428031=_[_0x7213('0x36')]({},_0x428031,_0x185a98['options']);return db[_0x7213('0x38')][_0x7213('0x41')](_0x428031)[_0x7213('0x23')](handleEntityNotFound(_0x7ea707,null))[_0x7213('0x23')](respondWithResult(_0x7ea707,null))[_0x7213('0x42')](handleError(_0x7ea707,null));};exports[_0x7213('0x43')]=function(_0xd66d43,_0x3186c3){return db['VoiceDialReport'][_0x7213('0x43')](_0xd66d43['body'],{})[_0x7213('0x23')](respondWithResult(_0x3186c3,0xc9))[_0x7213('0x42')](handleError(_0x3186c3,null));};exports['update']=function(_0x4313e6,_0x18c0a0){if(_0x4313e6[_0x7213('0x44')]['id']){delete _0x4313e6['body']['id'];}return db[_0x7213('0x38')][_0x7213('0x41')]({'where':{'id':_0x4313e6[_0x7213('0x3d')]['id']}})[_0x7213('0x23')](handleEntityNotFound(_0x18c0a0,null))[_0x7213('0x23')](saveUpdates(_0x4313e6['body'],null))[_0x7213('0x23')](respondWithResult(_0x18c0a0,null))['catch'](handleError(_0x18c0a0,null));};exports['destroy']=function(_0xa15153,_0x16e398){return db['VoiceDialReport']['find']({'where':{'id':_0xa15153[_0x7213('0x3d')]['id']}})['then'](handleEntityNotFound(_0x16e398,null))[_0x7213('0x23')](removeEntity(_0x16e398,null))[_0x7213('0x42')](handleError(_0x16e398,null));};exports[_0x7213('0x45')]=function(_0x4147d6,_0x5ba393){return db[_0x7213('0x38')]['describe']()[_0x7213('0x23')](respondWithResult(_0x5ba393,null))[_0x7213('0x42')](handleError(_0x5ba393,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 5267a9b..750a183 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 _0xe20d=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger'];(function(_0x2f2866,_0x222d25){var _0x2c8e9a=function(_0x3db27c){while(--_0x3db27c){_0x2f2866['push'](_0x2f2866['shift']());}};_0x2c8e9a(++_0x222d25);}(_0xe20d,0x1bd));var _0xde20=function(_0x10b0c0,_0x2f5220){_0x10b0c0=_0x10b0c0-0x0;var _0x1e22bc=_0xe20d[_0x10b0c0];return _0x1e22bc;};'use strict';var _=require(_0xde20('0x0'));var util=require(_0xde20('0x1'));var logger=require(_0xde20('0x2'))(_0xde20('0x3'));var moment=require(_0xde20('0x4'));var BPromise=require(_0xde20('0x5'));var rp=require(_0xde20('0x6'));var fs=require('fs');var path=require(_0xde20('0x7'));var rimraf=require(_0xde20('0x8'));var config=require(_0xde20('0x9'));var attributes=require(_0xde20('0xa'));module[_0xde20('0xb')]=function(_0x20a5d7,_0x757746){return _0x20a5d7[_0xde20('0xc')](_0xde20('0xd'),attributes,{'tableName':_0xde20('0xe'),'paranoid':![],'indexes':[{'fields':[_0xde20('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x00ca=['uniqueid','lodash','util','api','bluebird','path','rimraf','../../config/environment','./voiceDialReport.attributes','define','VoiceDialReport','report_dial'];(function(_0x527108,_0xc4c5d0){var _0x1b40c8=function(_0x33b942){while(--_0x33b942){_0x527108['push'](_0x527108['shift']());}};_0x1b40c8(++_0xc4c5d0);}(_0x00ca,0x1bd));var _0xa00c=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x00ca[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0xa00c('0x0'));var util=require(_0xa00c('0x1'));var logger=require('../../config/logger')(_0xa00c('0x2'));var moment=require('moment');var BPromise=require(_0xa00c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa00c('0x4'));var rimraf=require(_0xa00c('0x5'));var config=require(_0xa00c('0x6'));var attributes=require(_0xa00c('0x7'));module['exports']=function(_0x588463,_0x1eaf78){return _0x588463[_0xa00c('0x8')](_0xa00c('0x9'),attributes,{'tableName':_0xa00c('0xa'),'paranoid':![],'indexes':[{'fields':[_0xa00c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index e318afb..947f7ff 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 _0x4010=['../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceDialReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','where','attributes','limit','UpdateVoiceDialReport','util','bluebird','randomstring'];(function(_0x1d97eb,_0x204281){var _0x1eccbe=function(_0x288046){while(--_0x288046){_0x1d97eb['push'](_0x1d97eb['shift']());}};_0x1eccbe(++_0x204281);}(_0x4010,0x1dd));var _0x0401=function(_0x52445c,_0x1f6c7b){_0x52445c=_0x52445c-0x0;var _0x250789=_0x4010[_0x52445c];return _0x250789;};'use strict';var _=require('lodash');var util=require(_0x0401('0x0'));var moment=require('moment');var BPromise=require(_0x0401('0x1'));var rs=require(_0x0401('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0401('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0401('0x4'));var config=require(_0x0401('0x5'));var jayson=require(_0x0401('0x6'));var client=jayson[_0x0401('0x7')][_0x0401('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x16770c,_0xa1e4ad,_0x231560){return new BPromise(function(_0xd16418,_0x2569a0){return client['request'](_0x16770c,_0x231560)[_0x0401('0x9')](function(_0x2f2981){logger[_0x0401('0xa')](_0x0401('0xb'),_0xa1e4ad,'request\x20sent');logger[_0x0401('0xc')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0xa1e4ad,_0x0401('0xd'),JSON[_0x0401('0xe')](_0x2f2981));if(_0x2f2981[_0x0401('0xf')]){if(_0x2f2981[_0x0401('0xf')][_0x0401('0x10')]===0x1f4){logger['error'](_0x0401('0xb'),_0xa1e4ad,_0x2f2981[_0x0401('0xf')]['message']);return _0x2569a0(_0x2f2981['error'][_0x0401('0x11')]);}logger['error']('VoiceDialReport,\x20%s,\x20%s',_0xa1e4ad,_0x2f2981[_0x0401('0xf')][_0x0401('0x11')]);return _0xd16418(_0x2f2981[_0x0401('0xf')][_0x0401('0x11')]);}else{logger[_0x0401('0xa')](_0x0401('0xb'),_0xa1e4ad,_0x0401('0xd'));_0xd16418(_0x2f2981[_0x0401('0x12')][_0x0401('0x11')]);}})[_0x0401('0x13')](function(_0x2e3e93){logger[_0x0401('0xf')](_0x0401('0xb'),_0xa1e4ad,_0x2e3e93);_0x2569a0(_0x2e3e93);});});}exports[_0x0401('0x14')]=function(_0x4eb201){var _0x152713=this;return new Promise(function(_0x20ad44,_0x103571){return db[_0x0401('0x15')][_0x0401('0x16')](_0x4eb201[_0x0401('0x17')],{'raw':_0x4eb201[_0x0401('0x18')]?_0x4eb201['options'][_0x0401('0x19')]===undefined?!![]:![]:!![]})[_0x0401('0x9')](function(_0x35a75b){logger[_0x0401('0xa')](_0x0401('0x14'),_0x4eb201);logger[_0x0401('0xc')]('CreateVoiceDialReport',_0x4eb201,JSON[_0x0401('0xe')](_0x35a75b));_0x20ad44(_0x35a75b);})[_0x0401('0x13')](function(_0x345345){logger[_0x0401('0xf')]('CreateVoiceDialReport',_0x345345[_0x0401('0x11')],_0x4eb201);_0x103571(_0x152713[_0x0401('0xf')](0x1f4,_0x345345[_0x0401('0x11')]));});});};exports['UpdateVoiceDialReport']=function(_0x381323){var _0xf37f89=this;return new Promise(function(_0x4327fb,_0x32db36){return db[_0x0401('0x15')]['update'](_0x381323[_0x0401('0x17')],{'raw':_0x381323[_0x0401('0x18')]?_0x381323[_0x0401('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x381323[_0x0401('0x18')]?_0x381323[_0x0401('0x18')][_0x0401('0x1a')]||null:null,'attributes':_0x381323[_0x0401('0x18')]?_0x381323[_0x0401('0x18')][_0x0401('0x1b')]||null:null,'limit':_0x381323['options']?_0x381323[_0x0401('0x18')][_0x0401('0x1c')]||null:null})['then'](function(_0x2a06d7){logger['info'](_0x0401('0x1d'),_0x381323);logger[_0x0401('0xc')](_0x0401('0x1d'),_0x381323,JSON[_0x0401('0xe')](_0x2a06d7));_0x4327fb(_0x2a06d7);})[_0x0401('0x13')](function(_0x329a09){logger[_0x0401('0xf')](_0x0401('0x1d'),_0x329a09[_0x0401('0x11')],_0x381323);_0x32db36(_0xf37f89[_0x0401('0xf')](0x1f4,_0x329a09['message']));});});}; \ No newline at end of file +var _0x96fc=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','VoiceDialReport','body','options','raw','CreateVoiceDialReport','stringify','UpdateVoiceDialReport','update','where','attributes','lodash','util','bluebird','randomstring','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x96fc,0xfb));var _0xc96f=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x96fc[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0xc96f('0x0'));var util=require(_0xc96f('0x1'));var moment=require('moment');var BPromise=require(_0xc96f('0x2'));var rs=require(_0xc96f('0x3'));var fs=require('fs');var Redis=require(_0xc96f('0x4'));var db=require(_0xc96f('0x5'))['db'];var utils=require(_0xc96f('0x6'));var logger=require('../../config/logger')(_0xc96f('0x7'));var config=require(_0xc96f('0x8'));var jayson=require(_0xc96f('0x9'));var client=jayson[_0xc96f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x50657b,_0x11e67d,_0x4eaaba){return new BPromise(function(_0x487291,_0x196ca1){return client['request'](_0x50657b,_0x4eaaba)[_0xc96f('0xb')](function(_0x18d4be){logger['info'](_0xc96f('0xc'),_0x11e67d,'request\x20sent');logger[_0xc96f('0xd')](_0xc96f('0xe'),_0x11e67d,_0xc96f('0xf'),JSON['stringify'](_0x18d4be));if(_0x18d4be[_0xc96f('0x10')]){if(_0x18d4be[_0xc96f('0x10')][_0xc96f('0x11')]===0x1f4){logger[_0xc96f('0x10')]('VoiceDialReport,\x20%s,\x20%s',_0x11e67d,_0x18d4be[_0xc96f('0x10')][_0xc96f('0x12')]);return _0x196ca1(_0x18d4be[_0xc96f('0x10')][_0xc96f('0x12')]);}logger[_0xc96f('0x10')](_0xc96f('0xc'),_0x11e67d,_0x18d4be[_0xc96f('0x10')][_0xc96f('0x12')]);return _0x487291(_0x18d4be['error']['message']);}else{logger[_0xc96f('0x13')](_0xc96f('0xc'),_0x11e67d,_0xc96f('0xf'));_0x487291(_0x18d4be[_0xc96f('0x14')][_0xc96f('0x12')]);}})[_0xc96f('0x15')](function(_0x3aeac8){logger[_0xc96f('0x10')](_0xc96f('0xc'),_0x11e67d,_0x3aeac8);_0x196ca1(_0x3aeac8);});});}exports['CreateVoiceDialReport']=function(_0x37c7dd){var _0x345dcf=this;return new Promise(function(_0x55c57a,_0x14ad09){return db[_0xc96f('0x16')]['create'](_0x37c7dd[_0xc96f('0x17')],{'raw':_0x37c7dd[_0xc96f('0x18')]?_0x37c7dd[_0xc96f('0x18')][_0xc96f('0x19')]===undefined?!![]:![]:!![]})[_0xc96f('0xb')](function(_0x1aef65){logger[_0xc96f('0x13')](_0xc96f('0x1a'),_0x37c7dd);logger[_0xc96f('0xd')](_0xc96f('0x1a'),_0x37c7dd,JSON[_0xc96f('0x1b')](_0x1aef65));_0x55c57a(_0x1aef65);})[_0xc96f('0x15')](function(_0x38c912){logger[_0xc96f('0x10')](_0xc96f('0x1a'),_0x38c912['message'],_0x37c7dd);_0x14ad09(_0x345dcf['error'](0x1f4,_0x38c912[_0xc96f('0x12')]));});});};exports[_0xc96f('0x1c')]=function(_0x21c8d3){var _0x4eae4d=this;return new Promise(function(_0x4d9e25,_0xcd556c){return db[_0xc96f('0x16')][_0xc96f('0x1d')](_0x21c8d3[_0xc96f('0x17')],{'raw':_0x21c8d3[_0xc96f('0x18')]?_0x21c8d3['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21c8d3[_0xc96f('0x18')]?_0x21c8d3[_0xc96f('0x18')][_0xc96f('0x1e')]||null:null,'attributes':_0x21c8d3[_0xc96f('0x18')]?_0x21c8d3[_0xc96f('0x18')][_0xc96f('0x1f')]||null:null,'limit':_0x21c8d3['options']?_0x21c8d3[_0xc96f('0x18')]['limit']||null:null})[_0xc96f('0xb')](function(_0x422946){logger[_0xc96f('0x13')](_0xc96f('0x1c'),_0x21c8d3);logger[_0xc96f('0xd')](_0xc96f('0x1c'),_0x21c8d3,JSON[_0xc96f('0x1b')](_0x422946));_0x4d9e25(_0x422946);})[_0xc96f('0x15')](function(_0xa49f59){logger[_0xc96f('0x10')](_0xc96f('0x1c'),_0xa49f59[_0xc96f('0x12')],_0x21c8d3);_0xcd556c(_0x4eae4d['error'](0x1f4,_0xa49f59[_0xc96f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 6a27b0e..370cd19 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 _0x8d8e=['addApplications','delete','destroy','exports','multer','path','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','/:id/applications'];(function(_0x4b56cf,_0x3ae76f){var _0x4fcf66=function(_0x1d22ee){while(--_0x1d22ee){_0x4b56cf['push'](_0x4b56cf['shift']());}};_0x4fcf66(++_0x3ae76f);}(_0x8d8e,0x158));var _0xe8d8=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x8d8e[_0x42245d];return _0x4b211a;};'use strict';var multer=require(_0xe8d8('0x0'));var util=require('util');var path=require(_0xe8d8('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe8d8('0x2')]();var fs_extra=require(_0xe8d8('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xe8d8('0x4'));var config=require('../../config/environment');var controller=require('./voiceExtension.controller');router[_0xe8d8('0x5')]('/',auth[_0xe8d8('0x6')](),controller[_0xe8d8('0x7')]);router['get'](_0xe8d8('0x8'),auth[_0xe8d8('0x6')](),controller[_0xe8d8('0x9')]);router[_0xe8d8('0xa')]('/',auth[_0xe8d8('0x6')](),controller[_0xe8d8('0xb')]);router[_0xe8d8('0xa')](_0xe8d8('0xc'),auth[_0xe8d8('0x6')](),controller[_0xe8d8('0xd')]);router['put'](_0xe8d8('0x8'),auth[_0xe8d8('0x6')](),controller['update']);router[_0xe8d8('0xe')](_0xe8d8('0x8'),auth['isAuthenticated'](),controller[_0xe8d8('0xf')]);module[_0xe8d8('0x10')]=router; \ No newline at end of file +var _0x050d=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','post','create','/:id/applications','addApplications','update','/:id','destroy','exports','multer','path','connect-timeout'];(function(_0x3f424e,_0x312a2e){var _0x33db6b=function(_0x58a557){while(--_0x58a557){_0x3f424e['push'](_0x3f424e['shift']());}};_0x33db6b(++_0x312a2e);}(_0x050d,0xcf));var _0xd050=function(_0x27feb9,_0x315114){_0x27feb9=_0x27feb9-0x0;var _0xba94e0=_0x050d[_0x27feb9];return _0xba94e0;};'use strict';var multer=require(_0xd050('0x0'));var util=require('util');var path=require(_0xd050('0x1'));var timeout=require(_0xd050('0x2'));var express=require(_0xd050('0x3'));var router=express[_0xd050('0x4')]();var fs_extra=require(_0xd050('0x5'));var auth=require(_0xd050('0x6'));var interaction=require(_0xd050('0x7'));var config=require(_0xd050('0x8'));var controller=require(_0xd050('0x9'));router[_0xd050('0xa')]('/',auth[_0xd050('0xb')](),controller[_0xd050('0xc')]);router[_0xd050('0xa')]('/:id',auth[_0xd050('0xb')](),controller['show']);router[_0xd050('0xd')]('/',auth[_0xd050('0xb')](),controller[_0xd050('0xe')]);router['post'](_0xd050('0xf'),auth[_0xd050('0xb')](),controller[_0xd050('0x10')]);router['put']('/:id',auth[_0xd050('0xb')](),controller[_0xd050('0x11')]);router['delete'](_0xd050('0x12'),auth['isAuthenticated'](),controller[_0xd050('0x13')]);module[_0xd050('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 68b9f6e..b8ee24a 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 _0xfc53=['*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','outbound-fax','system','any'];(function(_0x379bcf,_0x26ea15){var _0x5c9c77=function(_0x1f4c6f){while(--_0x1f4c6f){_0x379bcf['push'](_0x379bcf['shift']());}};_0x5c9c77(++_0x26ea15);}(_0xfc53,0x7d));var _0x3fc5=function(_0x1384c5,_0x1e8c76){_0x1384c5=_0x1384c5-0x0;var _0x327d8b=_0xfc53[_0x1384c5];return _0x327d8b;};'use strict';var Sequelize=require(_0x3fc5('0x0'));module[_0x3fc5('0x1')]={'context':{'type':Sequelize[_0x3fc5('0x2')],'allowNull':![],'unique':_0x3fc5('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3fc5('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x3fc5('0x3')},'tag':{'type':Sequelize[_0x3fc5('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x3fc5('0x2')],'allowNull':![],'defaultValue':_0x3fc5('0x4')},'appdata':{'type':Sequelize[_0x3fc5('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x3fc5('0x5')](_0x3fc5('0x6'),_0x3fc5('0x7'),'internal','inbound-fax',_0x3fc5('0x8'),_0x3fc5('0x9'),_0x3fc5('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0x3fc5('0x2')]},'interval':{'type':Sequelize[_0x3fc5('0x2')],'allowNull':![],'defaultValue':_0x3fc5('0xb')},'IntervalId':{'type':Sequelize[_0x3fc5('0xc')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x3fc5('0x2')],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize[_0x3fc5('0xd')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x3fc5('0xc')]},'recordingFormat':{'type':Sequelize[_0x3fc5('0x2')],'defaultValue':_0x3fc5('0xe')},'answer':{'type':Sequelize[_0x3fc5('0xd')],'defaultValue':!![]},'name':{'type':Sequelize[_0x3fc5('0xf')],'get':function(_0x322279){return this['getDataValue'](_0x3fc5('0x10'));}},'alias':{'type':Sequelize[_0x3fc5('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xb5ee=['system','any','*,*,*,*','BOOLEAN','INTEGER','wav','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','inbound-fax','outbound-fax'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xb5ee,0x10d));var _0xeb5e=function(_0x5aa373,_0x54c7f4){_0x5aa373=_0x5aa373-0x0;var _0x590e8e=_0xb5ee[_0x5aa373];return _0x590e8e;};'use strict';var Sequelize=require(_0xeb5e('0x0'));module[_0xeb5e('0x1')]={'context':{'type':Sequelize[_0xeb5e('0x2')],'allowNull':![],'unique':_0xeb5e('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xeb5e('0x2')],'allowNull':![],'unique':_0xeb5e('0x3')},'priority':{'type':Sequelize[_0xeb5e('0x2')],'allowNull':![],'defaultValue':'1','unique':_0xeb5e('0x3')},'tag':{'type':Sequelize[_0xeb5e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xeb5e('0x4')},'appdata':{'type':Sequelize[_0xeb5e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xeb5e('0x5')](_0xeb5e('0x6'),_0xeb5e('0x7'),_0xeb5e('0x8'),_0xeb5e('0x9'),_0xeb5e('0xa'),_0xeb5e('0xb'),_0xeb5e('0xc')),'allowNull':![]},'description':{'type':Sequelize[_0xeb5e('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xeb5e('0xd')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0xeb5e('0xe')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xeb5e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0xeb5e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xeb5e('0xf')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0xeb5e('0x10')},'answer':{'type':Sequelize[_0xeb5e('0xe')],'defaultValue':!![]},'name':{'type':Sequelize[_0xeb5e('0x11')],'get':function(_0x5ade71){return this[_0xeb5e('0x12')](_0xeb5e('0x13'));}},'alias':{'type':Sequelize[_0xeb5e('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index ec20c96..57ab38b 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 _0xe943=['type','name','UserProfileResource','error','stack','send','index','VoiceExtension','rawAttributes','fieldName','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','find','create','body','startsWith','exten','concat','user','role','inbound','internal','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','description','recordingFormat','cutdigits','alias','findOne','sequelize','transaction','rewriteDial','createRouting','bulkCreate','cast(priority\x20as\x20unsigned)','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','set','apply','reject','update','then','destroy','get','InboundRoutes','outbound','InternalRoutes','filter','ignore','map','value','includes'];(function(_0x261e01,_0x305dba){var _0x280527=function(_0x4f54c8){while(--_0x4f54c8){_0x261e01['push'](_0x261e01['shift']());}};_0x280527(++_0x305dba);}(_0xe943,0x187));var _0x3e94=function(_0x204ad4,_0x502841){_0x204ad4=_0x204ad4-0x0;var _0x50675f=_0xe943[_0x204ad4];return _0x50675f;};'use strict';var emlformat=require(_0x3e94('0x0'));var rimraf=require(_0x3e94('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3e94('0x2'));var rp=require(_0x3e94('0x3'));var moment=require(_0x3e94('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3e94('0x5'));var util=require(_0x3e94('0x6'));var path=require(_0x3e94('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3e94('0x8'));var fs=require('fs');var fs_extra=require(_0x3e94('0x9'));var _=require(_0x3e94('0xa'));var squel=require(_0x3e94('0xb'));var crypto=require('crypto');var jsforce=require(_0x3e94('0xc'));var deskjs=require(_0x3e94('0xd'));var toCsv=require(_0x3e94('0xe'));var querystring=require(_0x3e94('0xf'));var Papa=require(_0x3e94('0x10'));var Redis=require(_0x3e94('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3e94('0x12'));var as=require(_0x3e94('0x13'));var hardwareService=require(_0x3e94('0x14'));var logger=require(_0x3e94('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x3e94('0x16'));var licenseUtil=require(_0x3e94('0x17'));var db=require('../../mysqldb')['db'];config[_0x3e94('0x18')]=_[_0x3e94('0x19')](config[_0x3e94('0x18')],{'host':_0x3e94('0x1a'),'port':0x18eb});var socket=require(_0x3e94('0x1b'))(new Redis(config[_0x3e94('0x18')]));require(_0x3e94('0x1c'))[_0x3e94('0x1d')](socket);function respondWithStatusCode(_0x4d62b2,_0x278217){_0x278217=_0x278217||0xcc;return function(_0x2d4645){if(_0x2d4645){return _0x4d62b2[_0x3e94('0x1e')](_0x278217);}return _0x4d62b2['status'](_0x278217)[_0x3e94('0x1f')]();};}function respondWithResult(_0x3d448e,_0x5af3cc){_0x5af3cc=_0x5af3cc||0xc8;return function(_0x1390ac){if(_0x1390ac){return _0x3d448e[_0x3e94('0x20')](_0x5af3cc)[_0x3e94('0x21')](_0x1390ac);}};}function respondWithFilteredResult(_0x3422c3,_0x29b7a1){return function(_0x1c874e){if(_0x1c874e){var _0x4057e9=typeof _0x29b7a1[_0x3e94('0x22')]===_0x3e94('0x23')&&typeof _0x29b7a1['limit']===_0x3e94('0x23');var _0x270c1f=_0x1c874e[_0x3e94('0x24')];var _0x5e2fc6=_0x4057e9?0x0:_0x29b7a1['offset'];var _0x4e1229=_0x4057e9?_0x1c874e[_0x3e94('0x24')]:_0x29b7a1[_0x3e94('0x22')]+_0x29b7a1[_0x3e94('0x25')];var _0x2c203a;if(_0x4e1229>=_0x270c1f){_0x4e1229=_0x270c1f;_0x2c203a=0xc8;}else{_0x2c203a=0xce;}_0x3422c3[_0x3e94('0x20')](_0x2c203a);return _0x3422c3[_0x3e94('0x26')]('Content-Range',_0x5e2fc6+'-'+_0x4e1229+'/'+_0x270c1f)[_0x3e94('0x21')](_0x1c874e);}return null;};}function patchUpdates(_0x394cda){return function(_0x20aa97){try{jsonpatch[_0x3e94('0x27')](_0x20aa97,_0x394cda,!![]);}catch(_0x94c281){return BPromise[_0x3e94('0x28')](_0x94c281);}return _0x20aa97['save']();};}function saveUpdates(_0x8d2a17,_0x5387a4){return function(_0x49438e){if(_0x49438e){return _0x49438e[_0x3e94('0x29')](_0x8d2a17)[_0x3e94('0x2a')](function(_0x219af8){return _0x219af8;});}return null;};}function removeEntity(_0x2e56ac,_0x5c8e17){return function(_0x5bf0f0){if(_0x5bf0f0){return _0x5bf0f0[_0x3e94('0x2b')]()[_0x3e94('0x2a')](function(){var _0x5b59cb=_0x5bf0f0[_0x3e94('0x2c')]({'plain':!![]});var _0x4ced8b=[{'name':_0x3e94('0x2d'),'value':'inbound','ignore':![]},{'name':'OutboundRoutes','value':_0x3e94('0x2e'),'ignore':![]},{'name':_0x3e94('0x2f'),'value':'internal','ignore':![]}];var _0xec4690=_(_0x4ced8b)[_0x3e94('0x30')](_0x3e94('0x31'))[_0x3e94('0x32')]('value')[_0x3e94('0x33')]();if(_[_0x3e94('0x34')](_0xec4690,_0x5b59cb['type'])){return;}var _0x59ac4c=_['find'](_0x4ced8b,[_0x3e94('0x33'),_0x5b59cb[_0x3e94('0x35')]])[_0x3e94('0x36')];return db[_0x3e94('0x37')][_0x3e94('0x2b')]({'where':{'type':_0x59ac4c,'resourceId':_0x5b59cb['id']}})[_0x3e94('0x2a')](function(){return _0x5bf0f0;});})[_0x3e94('0x2a')](function(){_0x2e56ac[_0x3e94('0x20')](0xcc)[_0x3e94('0x1f')]();});}};}function handleEntityNotFound(_0x8e8f77,_0x483da0){return function(_0x45da9b){if(!_0x45da9b){_0x8e8f77['sendStatus'](0x194);}return _0x45da9b;};}function handleError(_0x4c272d,_0x22d3ba){_0x22d3ba=_0x22d3ba||0x1f4;return function(_0x50b08e){logger[_0x3e94('0x38')](_0x50b08e[_0x3e94('0x39')]);if(_0x50b08e[_0x3e94('0x36')]){delete _0x50b08e['name'];}_0x4c272d[_0x3e94('0x20')](_0x22d3ba)[_0x3e94('0x3a')](_0x50b08e);};}exports[_0x3e94('0x3b')]=function(_0x25dfb0,_0x2abcd4){var _0x1c57a4={},_0x43cdab={},_0x4748c6={'count':0x0,'rows':[]};var _0x42bf21=_[_0x3e94('0x32')](db[_0x3e94('0x3c')][_0x3e94('0x3d')],function(_0x26cec7){return{'name':_0x26cec7[_0x3e94('0x3e')],'type':_0x26cec7['type'][_0x3e94('0x3f')]};});_0x43cdab['model']=_[_0x3e94('0x32')](_0x42bf21,_0x3e94('0x36'));_0x43cdab['query']=_[_0x3e94('0x40')](_0x25dfb0[_0x3e94('0x41')]);_0x43cdab[_0x3e94('0x42')]=_[_0x3e94('0x43')](_0x43cdab['model'],_0x43cdab[_0x3e94('0x41')]);_0x1c57a4[_0x3e94('0x44')]=_[_0x3e94('0x43')](_0x43cdab[_0x3e94('0x45')],qs[_0x3e94('0x46')](_0x25dfb0['query']['fields']));_0x1c57a4[_0x3e94('0x44')]=_0x1c57a4[_0x3e94('0x44')][_0x3e94('0x47')]?_0x1c57a4[_0x3e94('0x44')]:_0x43cdab[_0x3e94('0x45')];if(!_0x25dfb0[_0x3e94('0x41')][_0x3e94('0x48')](_0x3e94('0x49'))){_0x1c57a4[_0x3e94('0x25')]=qs[_0x3e94('0x25')](_0x25dfb0['query'][_0x3e94('0x25')]);_0x1c57a4[_0x3e94('0x22')]=qs[_0x3e94('0x22')](_0x25dfb0[_0x3e94('0x41')][_0x3e94('0x22')]);}_0x1c57a4[_0x3e94('0x4a')]=qs[_0x3e94('0x4b')](_0x25dfb0[_0x3e94('0x41')]['sort']);_0x1c57a4[_0x3e94('0x4c')]=qs[_0x3e94('0x42')](_[_0x3e94('0x4d')](_0x25dfb0[_0x3e94('0x41')],_0x43cdab[_0x3e94('0x42')]),_0x42bf21);if(_0x25dfb0[_0x3e94('0x41')][_0x3e94('0x30')]){_0x1c57a4['where']=_[_0x3e94('0x4e')](_0x1c57a4[_0x3e94('0x4c')],{'$or':_[_0x3e94('0x32')](_0x42bf21,function(_0x15e2e5){if(_0x15e2e5[_0x3e94('0x35')]!==_0x3e94('0x4f')){var _0x3e50ea={};_0x3e50ea[_0x15e2e5['name']]={'$like':'%'+_0x25dfb0[_0x3e94('0x41')]['filter']+'%'};return _0x3e50ea;}})});}_0x1c57a4=_[_0x3e94('0x4e')]({},_0x1c57a4,_0x25dfb0[_0x3e94('0x50')]);var _0x11066d={'where':_0x1c57a4[_0x3e94('0x4c')]};return db[_0x3e94('0x3c')]['count'](_0x11066d)[_0x3e94('0x2a')](function(_0x305c84){_0x4748c6[_0x3e94('0x24')]=_0x305c84;if(_0x25dfb0[_0x3e94('0x41')][_0x3e94('0x51')]){_0x1c57a4['include']=[{'all':!![]}];}return db[_0x3e94('0x3c')][_0x3e94('0x52')](_0x1c57a4);})['then'](function(_0x4f3043){_0x4748c6[_0x3e94('0x53')]=_0x4f3043;return _0x4748c6;})[_0x3e94('0x2a')](respondWithFilteredResult(_0x2abcd4,_0x1c57a4))[_0x3e94('0x54')](handleError(_0x2abcd4,null));};exports['show']=function(_0x6a230f,_0x538161){var _0x5bb94f={'raw':![],'where':{'id':_0x6a230f[_0x3e94('0x55')]['id']}},_0x2c014d={};_0x2c014d[_0x3e94('0x45')]=_[_0x3e94('0x40')](db[_0x3e94('0x3c')][_0x3e94('0x3d')]);_0x2c014d['query']=_['keys'](_0x6a230f[_0x3e94('0x41')]);_0x2c014d[_0x3e94('0x42')]=_[_0x3e94('0x43')](_0x2c014d['model'],_0x2c014d[_0x3e94('0x41')]);_0x5bb94f[_0x3e94('0x44')]=_[_0x3e94('0x43')](_0x2c014d[_0x3e94('0x45')],qs[_0x3e94('0x46')](_0x6a230f[_0x3e94('0x41')][_0x3e94('0x46')]));_0x5bb94f['attributes']=_0x5bb94f[_0x3e94('0x44')]['length']?_0x5bb94f[_0x3e94('0x44')]:_0x2c014d[_0x3e94('0x45')];if(_0x6a230f[_0x3e94('0x41')]['includeAll']){_0x5bb94f['include']=[{'all':!![]}];}_0x5bb94f=_[_0x3e94('0x4e')]({},_0x5bb94f,_0x6a230f[_0x3e94('0x50')]);return db['VoiceExtension'][_0x3e94('0x56')](_0x5bb94f)[_0x3e94('0x2a')](handleEntityNotFound(_0x538161,null))[_0x3e94('0x2a')](respondWithResult(_0x538161,null))['catch'](handleError(_0x538161,null));};exports[_0x3e94('0x2b')]=function(_0x51c169,_0x3aa291){return db['VoiceExtension'][_0x3e94('0x56')]({'where':{'id':_0x51c169[_0x3e94('0x55')]['id']}})[_0x3e94('0x2a')](handleEntityNotFound(_0x3aa291,null))[_0x3e94('0x2a')](removeEntity(_0x3aa291,null))[_0x3e94('0x54')](handleError(_0x3aa291,null));};exports[_0x3e94('0x57')]=function(_0x17ed25,_0x31802b){if(_0x17ed25[_0x3e94('0x58')][_0x3e94('0x35')]===_0x3e94('0x2e')&&!_[_0x3e94('0x59')](_0x17ed25[_0x3e94('0x58')][_0x3e94('0x5a')],'_')){_0x17ed25[_0x3e94('0x58')][_0x3e94('0x5a')]='_'[_0x3e94('0x5b')](_0x17ed25[_0x3e94('0x58')]['exten']);}return db[_0x3e94('0x3c')][_0x3e94('0x57')](_0x17ed25[_0x3e94('0x58')],{'raw':![]})[_0x3e94('0x2a')](function(_0xf27785){var _0x410288=_0x17ed25[_0x3e94('0x5c')][_0x3e94('0x2c')]({'plain':!![]});if(!_0x410288)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x410288[_0x3e94('0x5d')]==='user'){var _0x190fce=_0xf27785[_0x3e94('0x2c')]({'plain':!![]});var _0x23bcc4=[{'name':_0x3e94('0x2d'),'value':_0x3e94('0x5e')},{'name':'OutboundRoutes','value':_0x3e94('0x2e')},{'name':'InternalRoutes','value':_0x3e94('0x5f')}];var _0xb35632=_[_0x3e94('0x56')](_0x23bcc4,[_0x3e94('0x33'),_0x190fce[_0x3e94('0x35')]])[_0x3e94('0x36')];return db[_0x3e94('0x60')][_0x3e94('0x56')]({'where':{'name':_0xb35632,'userProfileId':_0x410288['userProfileId']},'raw':!![]})[_0x3e94('0x2a')](function(_0x54f791){if(_0x54f791&&_0x54f791[_0x3e94('0x61')]===0x0){return db[_0x3e94('0x37')][_0x3e94('0x57')]({'name':_0x190fce[_0x3e94('0x36')],'resourceId':_0x190fce['id'],'type':_0x54f791[_0x3e94('0x36')],'sectionId':_0x54f791['id']},{})['then'](function(){return _0xf27785;});}else{return _0xf27785;}})[_0x3e94('0x54')](function(_0x31333c){logger[_0x3e94('0x38')](_0x3e94('0x62'),_0x31333c);throw _0x31333c;});}return _0xf27785;})[_0x3e94('0x2a')](respondWithResult(_0x31802b,0xc9))[_0x3e94('0x54')](handleError(_0x31802b,null));};exports['update']=function(_0x2c0aba,_0xc827ad){if(_0x2c0aba[_0x3e94('0x58')]['id']){delete _0x2c0aba[_0x3e94('0x58')]['id'];}return db[_0x3e94('0x3c')]['find']({'where':{'id':_0x2c0aba['params']['id']}})['then'](handleEntityNotFound(_0xc827ad,null))[_0x3e94('0x2a')](function(_0x5a4865){if(_0x5a4865){return db[_0x3e94('0x3c')][_0x3e94('0x29')](_[_0x3e94('0x4d')](_0x2c0aba['body'],[_0x3e94('0x5a'),_0x3e94('0x63'),_0x3e94('0x64'),_0x3e94('0x65'),_0x3e94('0x66'),'mandatoryDisposition',_0x3e94('0x67')]),{'where':{'context':_0x5a4865[_0x3e94('0x63')],'exten':_0x5a4865['exten']},'individualHooks':!![]})['then'](function(_0x2b556f){return _0x2b556f;});}return null;})[_0x3e94('0x2a')](respondWithStatusCode(_0xc827ad,null))['catch'](handleError(_0xc827ad,null));};exports['addApplications']=function(_0x20d9af,_0x20e21f){return db[_0x3e94('0x3c')][_0x3e94('0x68')]({'where':{'id':_0x20d9af[_0x3e94('0x55')]['id']}})['then'](function(_0x35d57c){if(_0x35d57c){return db[_0x3e94('0x69')][_0x3e94('0x6a')](function(_0x1c3716){return db[_0x3e94('0x3c')]['destroy']({'where':{'VoiceExtensionId':_0x20d9af['params']['id']},'transaction':_0x1c3716})[_0x3e94('0x2a')](function(){var _0xc324ff=_['map'](_0x20d9af['body'],function(_0x4771e5){_0x4771e5['VoiceExtensionId']=_0x20d9af['params']['id'];_0x4771e5['isApp']=!![];return _0x4771e5;});var _0x35d35b=_0x20d9af[_0x3e94('0x41')][_0x3e94('0x6b')]&&_0x20d9af[_0x3e94('0x41')]['rewriteDial']['toLowerCase']()==='true'?!![]:![];return _0x35d57c[_0x3e94('0x6c')](_0xc324ff,_0x35d35b);})[_0x3e94('0x2a')](function(_0x4547b5){return db[_0x3e94('0x3c')][_0x3e94('0x6d')](_0x4547b5,{'transaction':_0x1c3716});});})[_0x3e94('0x2a')](function(){return db['VoiceExtension']['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x20d9af['params']['id']},'order':_0x3e94('0x6e')});});}})[_0x3e94('0x2a')](respondWithResult(_0x20e21f,null))[_0x3e94('0x54')](handleError(_0x20e21f,null));}; \ No newline at end of file +var _0x50b0=['catch','show','params','create','outbound','startsWith','body','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OutboundRoutes','internal','UserProfileSection','userProfileId','autoAssociation','context','description','recordingFormat','mandatoryDisposition','addApplications','findOne','transaction','VoiceExtensionId','isApp','rewriteDial','true','bulkCreate','findAndCountAll','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','destroy','then','get','InboundRoutes','inbound','InternalRoutes','ignore','map','value','type','find','UserProfileResource','error','stack','name','index','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows'];(function(_0x40b3f2,_0x2c4f5f){var _0x4ce90c=function(_0x516f31){while(--_0x516f31){_0x40b3f2['push'](_0x40b3f2['shift']());}};_0x4ce90c(++_0x2c4f5f);}(_0x50b0,0x1de));var _0x050b=function(_0x2e3793,_0x17a8fc){_0x2e3793=_0x2e3793-0x0;var _0x577255=_0x50b0[_0x2e3793];return _0x577255;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x050b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x050b('0x1'));var rp=require(_0x050b('0x2'));var moment=require('moment');var BPromise=require(_0x050b('0x3'));var Mustache=require(_0x050b('0x4'));var util=require(_0x050b('0x5'));var path=require(_0x050b('0x6'));var sox=require(_0x050b('0x7'));var csv=require(_0x050b('0x8'));var ejs=require(_0x050b('0x9'));var fs=require('fs');var fs_extra=require(_0x050b('0xa'));var _=require('lodash');var squel=require(_0x050b('0xb'));var crypto=require(_0x050b('0xc'));var jsforce=require(_0x050b('0xd'));var deskjs=require(_0x050b('0xe'));var toCsv=require(_0x050b('0x8'));var querystring=require(_0x050b('0xf'));var Papa=require(_0x050b('0x10'));var Redis=require(_0x050b('0x11'));var authService=require(_0x050b('0x12'));var qs=require(_0x050b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x050b('0x14'));var logger=require('../../config/logger')(_0x050b('0x15'));var utils=require(_0x050b('0x16'));var config=require(_0x050b('0x17'));var licenseUtil=require(_0x050b('0x18'));var db=require(_0x050b('0x19'))['db'];config[_0x050b('0x1a')]=_['defaults'](config[_0x050b('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x050b('0x1b'))(new Redis(config[_0x050b('0x1a')]));require(_0x050b('0x1c'))[_0x050b('0x1d')](socket);function respondWithStatusCode(_0x50edf5,_0xc9b3d2){_0xc9b3d2=_0xc9b3d2||0xcc;return function(_0x4f4259){if(_0x4f4259){return _0x50edf5[_0x050b('0x1e')](_0xc9b3d2);}return _0x50edf5[_0x050b('0x1f')](_0xc9b3d2)[_0x050b('0x20')]();};}function respondWithResult(_0x3f8a79,_0x39ae3b){_0x39ae3b=_0x39ae3b||0xc8;return function(_0x4234db){if(_0x4234db){return _0x3f8a79['status'](_0x39ae3b)['json'](_0x4234db);}};}function respondWithFilteredResult(_0x41c073,_0x38672a){return function(_0x1a5186){if(_0x1a5186){var _0x41b109=typeof _0x38672a[_0x050b('0x21')]===_0x050b('0x22')&&typeof _0x38672a[_0x050b('0x23')]===_0x050b('0x22');var _0x1d2521=_0x1a5186[_0x050b('0x24')];var _0x2c3053=_0x41b109?0x0:_0x38672a['offset'];var _0x1a4f41=_0x41b109?_0x1a5186[_0x050b('0x24')]:_0x38672a[_0x050b('0x21')]+_0x38672a[_0x050b('0x23')];var _0x31d6bd;if(_0x1a4f41>=_0x1d2521){_0x1a4f41=_0x1d2521;_0x31d6bd=0xc8;}else{_0x31d6bd=0xce;}_0x41c073[_0x050b('0x1f')](_0x31d6bd);return _0x41c073[_0x050b('0x25')](_0x050b('0x26'),_0x2c3053+'-'+_0x1a4f41+'/'+_0x1d2521)[_0x050b('0x27')](_0x1a5186);}return null;};}function patchUpdates(_0x1b4945){return function(_0x1cc57b){try{jsonpatch['apply'](_0x1cc57b,_0x1b4945,!![]);}catch(_0x437fb6){return BPromise[_0x050b('0x28')](_0x437fb6);}return _0x1cc57b[_0x050b('0x29')]();};}function saveUpdates(_0x29b30e,_0x5d395c){return function(_0x110644){if(_0x110644){return _0x110644[_0x050b('0x2a')](_0x29b30e)['then'](function(_0x6c6313){return _0x6c6313;});}return null;};}function removeEntity(_0x281ec6,_0x18fd9a){return function(_0x15b713){if(_0x15b713){return _0x15b713[_0x050b('0x2b')]()[_0x050b('0x2c')](function(){var _0x3364d6=_0x15b713[_0x050b('0x2d')]({'plain':!![]});var _0x154604=[{'name':_0x050b('0x2e'),'value':_0x050b('0x2f'),'ignore':![]},{'name':'OutboundRoutes','value':'outbound','ignore':![]},{'name':_0x050b('0x30'),'value':'internal','ignore':![]}];var _0x4ebb7e=_(_0x154604)['filter'](_0x050b('0x31'))[_0x050b('0x32')](_0x050b('0x33'))[_0x050b('0x33')]();if(_['includes'](_0x4ebb7e,_0x3364d6[_0x050b('0x34')])){return;}var _0x318519=_[_0x050b('0x35')](_0x154604,[_0x050b('0x33'),_0x3364d6[_0x050b('0x34')]])['name'];return db[_0x050b('0x36')][_0x050b('0x2b')]({'where':{'type':_0x318519,'resourceId':_0x3364d6['id']}})['then'](function(){return _0x15b713;});})[_0x050b('0x2c')](function(){_0x281ec6[_0x050b('0x1f')](0xcc)[_0x050b('0x20')]();});}};}function handleEntityNotFound(_0x3c924c,_0x2ce8bf){return function(_0x28d216){if(!_0x28d216){_0x3c924c[_0x050b('0x1e')](0x194);}return _0x28d216;};}function handleError(_0x284078,_0x450ca7){_0x450ca7=_0x450ca7||0x1f4;return function(_0xca83eb){logger[_0x050b('0x37')](_0xca83eb[_0x050b('0x38')]);if(_0xca83eb[_0x050b('0x39')]){delete _0xca83eb[_0x050b('0x39')];}_0x284078['status'](_0x450ca7)['send'](_0xca83eb);};}exports[_0x050b('0x3a')]=function(_0x38df97,_0x238074){var _0x21c396={},_0x16b47e={},_0x3eb32c={'count':0x0,'rows':[]};var _0x48273d=_['map'](db[_0x050b('0x3b')][_0x050b('0x3c')],function(_0x1d9075){return{'name':_0x1d9075[_0x050b('0x3d')],'type':_0x1d9075[_0x050b('0x34')][_0x050b('0x3e')]};});_0x16b47e[_0x050b('0x3f')]=_[_0x050b('0x32')](_0x48273d,'name');_0x16b47e[_0x050b('0x40')]=_[_0x050b('0x41')](_0x38df97[_0x050b('0x40')]);_0x16b47e[_0x050b('0x42')]=_[_0x050b('0x43')](_0x16b47e[_0x050b('0x3f')],_0x16b47e['query']);_0x21c396['attributes']=_[_0x050b('0x43')](_0x16b47e[_0x050b('0x3f')],qs[_0x050b('0x44')](_0x38df97[_0x050b('0x40')][_0x050b('0x44')]));_0x21c396[_0x050b('0x45')]=_0x21c396['attributes']['length']?_0x21c396[_0x050b('0x45')]:_0x16b47e[_0x050b('0x3f')];if(!_0x38df97[_0x050b('0x40')][_0x050b('0x46')](_0x050b('0x47'))){_0x21c396[_0x050b('0x23')]=qs[_0x050b('0x23')](_0x38df97[_0x050b('0x40')][_0x050b('0x23')]);_0x21c396[_0x050b('0x21')]=qs['offset'](_0x38df97[_0x050b('0x40')][_0x050b('0x21')]);}_0x21c396['order']=qs[_0x050b('0x48')](_0x38df97[_0x050b('0x40')][_0x050b('0x48')]);_0x21c396[_0x050b('0x49')]=qs[_0x050b('0x42')](_[_0x050b('0x4a')](_0x38df97[_0x050b('0x40')],_0x16b47e[_0x050b('0x42')]),_0x48273d);if(_0x38df97[_0x050b('0x40')]['filter']){_0x21c396['where']=_[_0x050b('0x4b')](_0x21c396[_0x050b('0x49')],{'$or':_['map'](_0x48273d,function(_0x42b18f){if(_0x42b18f['type']!=='VIRTUAL'){var _0x218e4b={};_0x218e4b[_0x42b18f[_0x050b('0x39')]]={'$like':'%'+_0x38df97['query'][_0x050b('0x4c')]+'%'};return _0x218e4b;}})});}_0x21c396=_[_0x050b('0x4b')]({},_0x21c396,_0x38df97[_0x050b('0x4d')]);var _0x5040f9={'where':_0x21c396[_0x050b('0x49')]};return db[_0x050b('0x3b')][_0x050b('0x24')](_0x5040f9)[_0x050b('0x2c')](function(_0x5b628e){_0x3eb32c[_0x050b('0x24')]=_0x5b628e;if(_0x38df97[_0x050b('0x40')][_0x050b('0x4e')]){_0x21c396[_0x050b('0x4f')]=[{'all':!![]}];}return db['VoiceExtension'][_0x050b('0x50')](_0x21c396);})[_0x050b('0x2c')](function(_0x2b8f7f){_0x3eb32c[_0x050b('0x51')]=_0x2b8f7f;return _0x3eb32c;})[_0x050b('0x2c')](respondWithFilteredResult(_0x238074,_0x21c396))[_0x050b('0x52')](handleError(_0x238074,null));};exports[_0x050b('0x53')]=function(_0x26063c,_0x278fef){var _0x2ec0b5={'raw':![],'where':{'id':_0x26063c[_0x050b('0x54')]['id']}},_0xce8672={};_0xce8672[_0x050b('0x3f')]=_[_0x050b('0x41')](db['VoiceExtension'][_0x050b('0x3c')]);_0xce8672[_0x050b('0x40')]=_[_0x050b('0x41')](_0x26063c['query']);_0xce8672[_0x050b('0x42')]=_['intersection'](_0xce8672[_0x050b('0x3f')],_0xce8672[_0x050b('0x40')]);_0x2ec0b5[_0x050b('0x45')]=_['intersection'](_0xce8672[_0x050b('0x3f')],qs[_0x050b('0x44')](_0x26063c[_0x050b('0x40')][_0x050b('0x44')]));_0x2ec0b5[_0x050b('0x45')]=_0x2ec0b5['attributes']['length']?_0x2ec0b5[_0x050b('0x45')]:_0xce8672[_0x050b('0x3f')];if(_0x26063c[_0x050b('0x40')][_0x050b('0x4e')]){_0x2ec0b5[_0x050b('0x4f')]=[{'all':!![]}];}_0x2ec0b5=_[_0x050b('0x4b')]({},_0x2ec0b5,_0x26063c['options']);return db[_0x050b('0x3b')]['find'](_0x2ec0b5)[_0x050b('0x2c')](handleEntityNotFound(_0x278fef,null))[_0x050b('0x2c')](respondWithResult(_0x278fef,null))['catch'](handleError(_0x278fef,null));};exports[_0x050b('0x2b')]=function(_0x762e2f,_0x3a112d){return db['VoiceExtension']['find']({'where':{'id':_0x762e2f[_0x050b('0x54')]['id']}})['then'](handleEntityNotFound(_0x3a112d,null))[_0x050b('0x2c')](removeEntity(_0x3a112d,null))[_0x050b('0x52')](handleError(_0x3a112d,null));};exports[_0x050b('0x55')]=function(_0x455e5a,_0x130f94){if(_0x455e5a['body'][_0x050b('0x34')]===_0x050b('0x56')&&!_[_0x050b('0x57')](_0x455e5a[_0x050b('0x58')][_0x050b('0x59')],'_')){_0x455e5a[_0x050b('0x58')][_0x050b('0x59')]='_'[_0x050b('0x5a')](_0x455e5a[_0x050b('0x58')][_0x050b('0x59')]);}return db['VoiceExtension']['create'](_0x455e5a[_0x050b('0x58')],{'raw':![]})[_0x050b('0x2c')](function(_0x32fbd4){var _0x40075c=_0x455e5a[_0x050b('0x5b')]['get']({'plain':!![]});if(!_0x40075c)throw new Error(_0x050b('0x5c'));if(_0x40075c[_0x050b('0x5d')]===_0x050b('0x5b')){var _0x15cd19=_0x32fbd4[_0x050b('0x2d')]({'plain':!![]});var _0x53f64c=[{'name':'InboundRoutes','value':_0x050b('0x2f')},{'name':_0x050b('0x5e'),'value':_0x050b('0x56')},{'name':_0x050b('0x30'),'value':_0x050b('0x5f')}];var _0x31a408=_[_0x050b('0x35')](_0x53f64c,[_0x050b('0x33'),_0x15cd19[_0x050b('0x34')]])[_0x050b('0x39')];return db[_0x050b('0x60')][_0x050b('0x35')]({'where':{'name':_0x31a408,'userProfileId':_0x40075c[_0x050b('0x61')]},'raw':!![]})[_0x050b('0x2c')](function(_0x409b92){if(_0x409b92&&_0x409b92[_0x050b('0x62')]===0x0){return db[_0x050b('0x36')][_0x050b('0x55')]({'name':_0x15cd19['name'],'resourceId':_0x15cd19['id'],'type':_0x409b92[_0x050b('0x39')],'sectionId':_0x409b92['id']},{})[_0x050b('0x2c')](function(){return _0x32fbd4;});}else{return _0x32fbd4;}})[_0x050b('0x52')](function(_0xd4b023){logger[_0x050b('0x37')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xd4b023);throw _0xd4b023;});}return _0x32fbd4;})[_0x050b('0x2c')](respondWithResult(_0x130f94,0xc9))[_0x050b('0x52')](handleError(_0x130f94,null));};exports[_0x050b('0x2a')]=function(_0x5858c9,_0x3bf2f6){if(_0x5858c9[_0x050b('0x58')]['id']){delete _0x5858c9[_0x050b('0x58')]['id'];}return db[_0x050b('0x3b')][_0x050b('0x35')]({'where':{'id':_0x5858c9[_0x050b('0x54')]['id']}})[_0x050b('0x2c')](handleEntityNotFound(_0x3bf2f6,null))[_0x050b('0x2c')](function(_0x53e136){if(_0x53e136){return db[_0x050b('0x3b')][_0x050b('0x2a')](_['pick'](_0x5858c9[_0x050b('0x58')],[_0x050b('0x59'),_0x050b('0x63'),_0x050b('0x64'),_0x050b('0x65'),'cutdigits',_0x050b('0x66'),'alias']),{'where':{'context':_0x53e136[_0x050b('0x63')],'exten':_0x53e136['exten']},'individualHooks':!![]})['then'](function(_0x39496c){return _0x39496c;});}return null;})[_0x050b('0x2c')](respondWithStatusCode(_0x3bf2f6,null))[_0x050b('0x52')](handleError(_0x3bf2f6,null));};exports[_0x050b('0x67')]=function(_0x454f4f,_0x439dca){return db[_0x050b('0x3b')][_0x050b('0x68')]({'where':{'id':_0x454f4f[_0x050b('0x54')]['id']}})[_0x050b('0x2c')](function(_0x68d0ce){if(_0x68d0ce){return db['sequelize'][_0x050b('0x69')](function(_0x231071){return db['VoiceExtension'][_0x050b('0x2b')]({'where':{'VoiceExtensionId':_0x454f4f[_0x050b('0x54')]['id']},'transaction':_0x231071})['then'](function(){var _0x999874=_[_0x050b('0x32')](_0x454f4f[_0x050b('0x58')],function(_0x57dbee){_0x57dbee[_0x050b('0x6a')]=_0x454f4f[_0x050b('0x54')]['id'];_0x57dbee[_0x050b('0x6b')]=!![];return _0x57dbee;});var _0x304727=_0x454f4f['query'][_0x050b('0x6c')]&&_0x454f4f[_0x050b('0x40')][_0x050b('0x6c')]['toLowerCase']()===_0x050b('0x6d')?!![]:![];return _0x68d0ce['createRouting'](_0x999874,_0x304727);})[_0x050b('0x2c')](function(_0x58507a){return db['VoiceExtension'][_0x050b('0x6e')](_0x58507a,{'transaction':_0x231071});});})['then'](function(){return db[_0x050b('0x3b')][_0x050b('0x6f')]({'where':{'isApp':!![],'VoiceExtensionId':_0x454f4f[_0x050b('0x54')]['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})[_0x050b('0x2c')](respondWithResult(_0x439dca,null))[_0x050b('0x52')](handleError(_0x439dca,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 8e36b1b..96871b0 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 _0x152c=['remove','emit','exports','events','VoiceExtension','save','update'];(function(_0x24a737,_0x3ff299){var _0x37b618=function(_0x3f0b2f){while(--_0x3f0b2f){_0x24a737['push'](_0x24a737['shift']());}};_0x37b618(++_0x3ff299);}(_0x152c,0x114));var _0xc152=function(_0x21a359,_0x25fda9){_0x21a359=_0x21a359-0x0;var _0x3998ec=_0x152c[_0x21a359];return _0x3998ec;};'use strict';var EventEmitter=require(_0xc152('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0xc152('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc152('0x2'),'afterUpdate':_0xc152('0x3'),'afterDestroy':_0xc152('0x4')};function emitEvent(_0x15442e){return function(_0x2945c7,_0x5e1e42,_0x298de3){VoiceExtensionEvents[_0xc152('0x5')](_0x15442e+':'+_0x2945c7['id'],_0x2945c7);VoiceExtensionEvents[_0xc152('0x5')](_0x15442e,_0x2945c7);_0x298de3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0xc152('0x6')]=VoiceExtensionEvents; \ No newline at end of file +var _0x6c07=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceExtension','setMaxListeners'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6c07,0xcb));var _0x76c0=function(_0x400a15,_0x5b1256){_0x400a15=_0x400a15-0x0;var _0x37140f=_0x6c07[_0x400a15];return _0x37140f;};'use strict';var EventEmitter=require(_0x76c0('0x0'));var VoiceExtension=require(_0x76c0('0x1'))['db'][_0x76c0('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x76c0('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x76c0('0x4')};function emitEvent(_0x13f8e7){return function(_0x46f465,_0x574426,_0x5156f7){VoiceExtensionEvents[_0x76c0('0x5')](_0x13f8e7+':'+_0x46f465['id'],_0x46f465);VoiceExtensionEvents[_0x76c0('0x5')](_0x13f8e7,_0x46f465);_0x5156f7(null);};}for(var e in events){if(events[_0x76c0('0x6')](e)){var event=events[e];VoiceExtension[_0x76c0('0x7')](e,emitEvent(event));}}module[_0x76c0('0x8')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 4b440e5..43303b2 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 _0xe6c8=['inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','outbound','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=noprefix','MONITOR_OPTIONS=ab','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','trunk','options','url','split','length','param','prefix','phone','SIP','join','indexOf','U(xcally-mixmonitor-context)','replace','Interval','findAll','interval','IntervalId','then','*,*,*,*','intervals','toLowerCase','hasOwnProperty','tag','CDR(tag)=','Set(CALLERID(all)=','callerID','NoOp(No\x20number\x20available)','answer','queue','includes','app','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','appdata','priority','concat','last','define','VoiceExtension','voice_extensions','util','lodash','./voiceExtension.attributes','exports','type','Set','context','exten','alias','CDR(routeAlias)=','No\x20alias\x20set'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0xe6c8,0xd0));var _0x8e6c=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xe6c8[_0x618414];return _0x21c19a;};'use strict';var util=require(_0x8e6c('0x0'));var _=require(_0x8e6c('0x1'));var attributes=require(_0x8e6c('0x2'));module[_0x8e6c('0x3')]=function(_0x682f2b){var _0x361278=_0x682f2b['models'];function _0x2f7ad6(_0xd58e44){var _0x37ff1e=0x2;var _0x3060c8=[{'type':_0xd58e44[_0x8e6c('0x4')],'app':_0x8e6c('0x5'),'appdata':'CDR(type)='+_0xd58e44[_0x8e6c('0x4')],'context':_0xd58e44[_0x8e6c('0x6')],'exten':_0xd58e44[_0x8e6c('0x7')],'priority':_0x37ff1e++,'VoiceExtensionId':_0xd58e44['id']},{'type':_0xd58e44['type'],'app':_0xd58e44[_0x8e6c('0x8')]?_0x8e6c('0x5'):'NoOp','appdata':_0xd58e44[_0x8e6c('0x8')]?_0x8e6c('0x9')+_0xd58e44[_0x8e6c('0x8')]:_0x8e6c('0xa'),'context':_0xd58e44[_0x8e6c('0x6')],'exten':_0xd58e44[_0x8e6c('0x7')],'priority':_0x37ff1e++,'VoiceExtensionId':_0xd58e44['id']}];if(_0xd58e44['type']===_0x8e6c('0xb')){_0x3060c8[_0x8e6c('0xc')]({'type':_0x8e6c('0xb'),'app':_0x8e6c('0x5'),'appdata':_0x8e6c('0xd')+_0xd58e44['id'],'context':_0xd58e44['context'],'exten':_0xd58e44['exten'],'priority':_0x37ff1e++,'VoiceExtensionId':_0xd58e44['id']});}_0x3060c8[_0x8e6c('0xc')]({'type':_0xd58e44['type'],'app':_0x8e6c('0x5'),'appdata':_0x8e6c('0xe'),'context':_0xd58e44[_0x8e6c('0x6')],'exten':_0xd58e44[_0x8e6c('0x7')],'priority':_0x37ff1e++,'VoiceExtensionId':_0xd58e44['id']},{'type':_0xd58e44['type'],'app':_0x8e6c('0x5'),'appdata':_0x8e6c('0xf'),'context':_0xd58e44[_0x8e6c('0x6')],'exten':_0xd58e44[_0x8e6c('0x7')],'priority':_0x37ff1e++,'VoiceExtensionId':_0xd58e44['id']},{'type':_0xd58e44[_0x8e6c('0x4')],'app':_0x8e6c('0x5'),'appdata':'MONITOR_OPTIONS=ab','context':_0xd58e44[_0x8e6c('0x6')],'exten':_0xd58e44[_0x8e6c('0x7')],'priority':_0x37ff1e++,'VoiceExtensionId':_0xd58e44['id']});return _0x3060c8;}function _0x143a60(_0x17120f){var _0x14525f=0x2;var _0x2bfc99=[{'type':_0x8e6c('0x10'),'app':'Set','appdata':'CDR(type)=outbound','context':_0x17120f['context'],'exten':_0x17120f[_0x8e6c('0x7')],'priority':_0x14525f++,'VoiceExtensionId':_0x17120f['id']},{'type':_0x8e6c('0x10'),'app':_0x17120f[_0x8e6c('0x8')]?_0x8e6c('0x5'):'NoOp','appdata':_0x17120f[_0x8e6c('0x8')]?'CDR(routeAlias)='+_0x17120f[_0x8e6c('0x8')]:_0x8e6c('0xa'),'context':_0x17120f[_0x8e6c('0x6')],'exten':_0x17120f[_0x8e6c('0x7')],'priority':_0x14525f++,'VoiceExtensionId':_0x17120f['id']},{'type':_0x8e6c('0x10'),'app':_0x8e6c('0x5'),'appdata':'CDR(destination)='+(_0x17120f[_0x8e6c('0x11')]?_0x8e6c('0x12')+_0x17120f['cutdigits']+'}':_0x8e6c('0x13')),'context':_0x17120f[_0x8e6c('0x6')],'exten':_0x17120f[_0x8e6c('0x7')],'priority':_0x14525f++,'VoiceExtensionId':_0x17120f['id']},{'type':_0x8e6c('0x10'),'app':_0x8e6c('0x5'),'appdata':_0x8e6c('0xd')+_0x17120f['id'],'context':_0x17120f[_0x8e6c('0x6')],'exten':_0x17120f['exten'],'priority':_0x14525f++,'VoiceExtensionId':_0x17120f['id']},{'type':_0x8e6c('0x10'),'app':_0x8e6c('0x14'),'appdata':_0x8e6c('0x15')+(_0x14525f+0x2)+'):Goto('+(_0x14525f+0x1)+')','context':_0x17120f[_0x8e6c('0x6')],'exten':_0x17120f['exten'],'priority':_0x14525f++,'VoiceExtensionId':_0x17120f['id']},{'type':_0x8e6c('0x10'),'app':_0x8e6c('0x5'),'appdata':_0x17120f[_0x8e6c('0x11')]?'CDR(prefix)=${EXTEN:0:'+_0x17120f[_0x8e6c('0x11')]+'}':_0x8e6c('0x16'),'context':_0x17120f[_0x8e6c('0x6')],'exten':_0x17120f[_0x8e6c('0x7')],'priority':_0x14525f++,'VoiceExtensionId':_0x17120f['id']},{'type':'outbound','app':_0x8e6c('0x5'),'appdata':_0x8e6c('0xe'),'context':_0x17120f[_0x8e6c('0x6')],'exten':_0x17120f[_0x8e6c('0x7')],'priority':_0x14525f++,'VoiceExtensionId':_0x17120f['id']},{'type':_0x8e6c('0x10'),'app':_0x8e6c('0x5'),'appdata':_0x8e6c('0xf'),'context':_0x17120f[_0x8e6c('0x6')],'exten':_0x17120f[_0x8e6c('0x7')],'priority':_0x14525f++,'VoiceExtensionId':_0x17120f['id']},{'type':_0x8e6c('0x10'),'app':_0x8e6c('0x5'),'appdata':_0x8e6c('0x17'),'context':_0x17120f['context'],'exten':_0x17120f[_0x8e6c('0x7')],'priority':_0x14525f++,'VoiceExtensionId':_0x17120f['id']},{'type':_0x8e6c('0x10'),'app':_0x8e6c('0x5'),'appdata':'outboundrouteid='+_0x17120f['id'],'context':_0x17120f[_0x8e6c('0x6')],'exten':_0x17120f[_0x8e6c('0x7')],'priority':_0x14525f++,'VoiceExtensionId':_0x17120f['id']}];if(_0x17120f['hasOwnProperty'](_0x8e6c('0x18'))&&_0x17120f[_0x8e6c('0x18')]!==_0x8e6c('0x19')){_0x2bfc99[_0x8e6c('0xc')]({'type':'outbound','app':_0x8e6c('0x5'),'appdata':_0x8e6c('0x1a'),'context':_0x17120f[_0x8e6c('0x6')],'exten':_0x17120f[_0x8e6c('0x7')],'priority':_0x14525f++,'VoiceExtensionId':_0x17120f['id']},{'type':'outbound','app':_0x8e6c('0x5'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x17120f[_0x8e6c('0x18')]||_0x8e6c('0x1b'),'context':_0x17120f[_0x8e6c('0x6')],'exten':_0x17120f[_0x8e6c('0x7')],'priority':_0x14525f++,'VoiceExtensionId':_0x17120f['id']});}return _0x2bfc99;}function _0xc926ea(_0x4849db){var _0x55b246=[{'name':_0x8e6c('0x1c'),'param':0x0},{'name':'timeout','param':0x1},{'name':_0x8e6c('0x1d'),'param':0x2},{'name':_0x8e6c('0x1e'),'param':0x3}];var _0x2de633={};var _0x33b0b5=_0x4849db[_0x8e6c('0x1f')](',');var _0x341e17=[];for(var _0x1d32d6=0x0;_0x1d32d6<_0x55b246[_0x8e6c('0x20')];_0x1d32d6++){switch(_0x55b246[_0x1d32d6]['name']){case _0x8e6c('0x1c'):_0x2de633[_0x8e6c('0x1c')]=_0x33b0b5[_0x55b246[_0x1d32d6][_0x8e6c('0x21')]][_0x8e6c('0x1f')]('/')[0x1];_0x2de633['phone']=_0x33b0b5[_0x55b246[_0x1d32d6][_0x8e6c('0x21')]][_0x8e6c('0x1f')]('/')[0x2];_0x2de633[_0x8e6c('0x22')]=_0x2de633['phone']?_0x2de633[_0x8e6c('0x23')][_0x8e6c('0x1f')]('$')[0x0]:undefined;_0x2de633[_0x8e6c('0x23')]=route[_0x8e6c('0x11')]?(_0x2de633[_0x8e6c('0x22')]||'')+_0x8e6c('0x12')+route[_0x8e6c('0x11')]+'}':(_0x2de633[_0x8e6c('0x22')]||'')+_0x8e6c('0x13');_0x341e17[_0x55b246[_0x1d32d6][_0x8e6c('0x21')]]=[_0x8e6c('0x24'),_0x2de633[_0x8e6c('0x1c')],_0x2de633[_0x8e6c('0x23')]][_0x8e6c('0x25')]('/');break;case _0x8e6c('0x1d'):_0x2de633['options']=_0x33b0b5[_0x55b246[_0x1d32d6]['param']];if(route['recordingFormat']!==_0x8e6c('0x19')){if(_0x2de633[_0x8e6c('0x1d')][_0x8e6c('0x26')]('U(xcally-mixmonitor-context)')<0x0){_0x2de633['options']+=_0x8e6c('0x27');}}else{_0x2de633[_0x8e6c('0x1d')]=_0x2de633[_0x8e6c('0x1d')][_0x8e6c('0x28')](_0x8e6c('0x27'),'');}_0x341e17[_0x55b246[_0x1d32d6][_0x8e6c('0x21')]]=_0x2de633[_0x8e6c('0x1d')];break;default:_0x341e17[_0x55b246[_0x1d32d6]['param']]=_0x33b0b5[_0x55b246[_0x1d32d6][_0x8e6c('0x21')]];}}return _0x341e17[_0x8e6c('0x25')](',');}function _0x1a9240(_0x36eef0,_0x38a796,_0x830ee2,_0x2edd9f){return new Promise(function(_0x28d9c4,_0x92eecc){var _0xa1052b=[];if(_['isEmpty'](_0x38a796))return _0x28d9c4(_0xa1052b);_0x361278[_0x8e6c('0x29')][_0x8e6c('0x2a')]({'attributes':['id',_0x8e6c('0x2b'),_0x8e6c('0x2c')],'raw':!![]})[_0x8e6c('0x2d')](function(_0x3890c2){for(var _0x5e2b17=0x0,_0x1deec0=0x0;_0x5e2b17<_0x38a796[_0x8e6c('0x20')];_0x5e2b17++,_0x1deec0=0x0){var _0x6d0d8b=_0x38a796[_0x5e2b17];var _0x5dbb5f=[];var _0x46198b=[];if(_0x6d0d8b[_0x8e6c('0x2b')]!==_0x8e6c('0x2e')){_0x6d0d8b[_0x8e6c('0x2f')]=[_0x6d0d8b['interval']];}else{_0x6d0d8b[_0x8e6c('0x2f')]=_0x6d0d8b['IntervalId']?_['map'](_['filter'](_0x3890c2,{'IntervalId':_0x6d0d8b[_0x8e6c('0x2c')]}),'interval'):[];}_0x6d0d8b[_0x8e6c('0x6')]=_0x36eef0[_0x8e6c('0x6')];_0x6d0d8b['exten']=_0x36eef0['exten'];if(_0x6d0d8b[_0x8e6c('0x4')])_0x6d0d8b[_0x8e6c('0x4')]=_0x6d0d8b['type'][_0x8e6c('0x30')]();if(_0x36eef0['type']===_0x8e6c('0x10')){if(_0x6d0d8b[_0x8e6c('0x31')](_0x8e6c('0x32'))&&_0x6d0d8b[_0x8e6c('0x32')]&&_0x6d0d8b[_0x8e6c('0x32')]!=='--'){_0x5dbb5f[_0x8e6c('0xc')]({'type':_0x6d0d8b['type'][_0x8e6c('0x30')](),'app':_0x8e6c('0x5'),'appdata':_0x8e6c('0x33')+_0x6d0d8b['tag'],'context':_0x36eef0[_0x8e6c('0x6')],'exten':_0x36eef0[_0x8e6c('0x7')],'priority':_0x6d0d8b[_0x8e6c('0x2f')][_0x8e6c('0x20')]+_0x830ee2+_0x1deec0++,'VoiceExtensionId':_0x36eef0['id']});}_0x5dbb5f[_0x8e6c('0xc')]({'type':_0x6d0d8b[_0x8e6c('0x4')]['toLowerCase'](),'app':_0x8e6c('0x14'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x6d0d8b['callerID']?_0x8e6c('0x34')+_0x6d0d8b[_0x8e6c('0x35')]+')':_0x8e6c('0x36')),'context':_0x36eef0[_0x8e6c('0x6')],'exten':_0x36eef0[_0x8e6c('0x7')],'priority':_0x6d0d8b['intervals'][_0x8e6c('0x20')]+_0x830ee2+_0x1deec0++,'VoiceExtensionId':_0x36eef0['id']});}else{if(_0x6d0d8b[_0x8e6c('0x31')](_0x8e6c('0x37'))){if([_0x8e6c('0x38'),'playback'][_0x8e6c('0x39')](_0x6d0d8b[_0x8e6c('0x3a')][_0x8e6c('0x30')]())&&_0x6d0d8b[_0x8e6c('0x3b')]!==_0x8e6c('0x3c')){if(_0x6d0d8b[_0x8e6c('0x37')]){_0x5dbb5f[_0x8e6c('0xc')]({'type':_0x6d0d8b[_0x8e6c('0x4')][_0x8e6c('0x30')](),'app':_0x8e6c('0x14'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x36eef0[_0x8e6c('0x6')],'exten':_0x36eef0[_0x8e6c('0x7')],'priority':_0x6d0d8b['intervals']['length']+_0x830ee2+_0x1deec0++,'VoiceExtensionId':_0x36eef0['id']});_0x5dbb5f[_0x8e6c('0xc')]({'type':_0x6d0d8b['type'][_0x8e6c('0x30')](),'app':'Set','appdata':_0x8e6c('0x3d'),'context':_0x36eef0['context'],'exten':_0x36eef0[_0x8e6c('0x7')],'priority':_0x6d0d8b['intervals'][_0x8e6c('0x20')]+_0x830ee2+_0x1deec0++,'VoiceExtensionId':_0x36eef0['id']});}else{_0x5dbb5f[_0x8e6c('0xc')]({'type':_0x6d0d8b[_0x8e6c('0x4')]['toLowerCase'](),'app':_0x8e6c('0x14'),'appdata':_0x8e6c('0x3e'),'context':_0x36eef0[_0x8e6c('0x6')],'exten':_0x36eef0['exten'],'priority':_0x6d0d8b[_0x8e6c('0x2f')]['length']+_0x830ee2+_0x1deec0++,'VoiceExtensionId':_0x36eef0['id']});_0x5dbb5f[_0x8e6c('0xc')]({'type':_0x6d0d8b[_0x8e6c('0x4')][_0x8e6c('0x30')](),'app':_0x8e6c('0x5'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x36eef0[_0x8e6c('0x6')],'exten':_0x36eef0[_0x8e6c('0x7')],'priority':_0x6d0d8b[_0x8e6c('0x2f')][_0x8e6c('0x20')]+_0x830ee2+_0x1deec0++,'VoiceExtensionId':_0x36eef0['id']});}}}}for(var _0x4938c3=0x0;_0x4938c3<_0x6d0d8b[_0x8e6c('0x2f')][_0x8e6c('0x20')];_0x4938c3++){var _0x45587a=_0x830ee2+_0x6d0d8b[_0x8e6c('0x2f')]['length'];var _0x5bcf2e=_0x4938c3===_0x6d0d8b[_0x8e6c('0x2f')][_0x8e6c('0x20')]-0x1?_0x830ee2+_0x5dbb5f['length']+_0x46198b[_0x8e6c('0x20')]+0x2:_0x830ee2+_0x4938c3+0x1;_0x5dbb5f[_0x8e6c('0x3f')](_0x4938c3,0x0,{'type':_0x36eef0[_0x8e6c('0x4')],'app':_0x8e6c('0x40'),'appdata':_0x6d0d8b[_0x8e6c('0x2f')][_0x4938c3]+'?'+_0x36eef0['context']+_0x8e6c('0x41')+_0x45587a+':'+_0x36eef0[_0x8e6c('0x6')]+_0x8e6c('0x41')+_0x5bcf2e,'exten':_0x36eef0[_0x8e6c('0x7')],'context':_0x36eef0[_0x8e6c('0x6')],'priority':_0x830ee2+_0x4938c3,'VoiceExtensionId':_0x36eef0['id']});}if(_0x2edd9f&&_0x6d0d8b[_0x8e6c('0x3b')]==='outboundDial')_0x6d0d8b[_0x8e6c('0x42')]=_0xc926ea(_0x6d0d8b[_0x8e6c('0x42')]);_0x6d0d8b[_0x8e6c('0x43')]=_0x5dbb5f[_0x8e6c('0x20')]?_['last'](_0x5dbb5f)[_0x8e6c('0x43')]+0x1:_0x830ee2;_0xa1052b=_[_0x8e6c('0x44')](_0xa1052b,_0x5dbb5f,[_0x6d0d8b],_0x46198b);_0x830ee2=_[_0x8e6c('0x45')](_0xa1052b)[_0x8e6c('0x43')]+0x1;}return _0x28d9c4(_0xa1052b);})['catch'](function(_0x62fd57){_0x92eecc(_0x62fd57);});});}return _0x682f2b[_0x8e6c('0x46')](_0x8e6c('0x47'),attributes,{'tableName':_0x8e6c('0x48'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x47e750,_0x355119){var _0x46f4b8=this;var _0x6a35b8=_0x46f4b8[_0x8e6c('0x4')]===_0x8e6c('0x10')?_0x143a60(_0x46f4b8):_0x2f7ad6(_0x46f4b8);return _0x1a9240(_0x46f4b8,_0x47e750,_[_0x8e6c('0x45')](_0x6a35b8)[_0x8e6c('0x43')]+0x1,_0x355119)[_0x8e6c('0x2d')](function(_0x57eebf){var _0x10d06b=_[_0x8e6c('0x44')](_0x6a35b8,_0x57eebf);_0x10d06b[_0x8e6c('0xc')]({'type':_0x46f4b8[_0x8e6c('0x4')],'app':'Hangup','exten':_0x46f4b8[_0x8e6c('0x7')],'context':_0x46f4b8[_0x8e6c('0x6')],'priority':_['last'](_0x10d06b)[_0x8e6c('0x43')]+0x1,'VoiceExtensionId':_0x46f4b8['id']});return _0x10d06b;});}}});}; \ No newline at end of file +var _0xa1d6=['name','trunk','param','split','prefix','phone','SIP','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','then','*,*,*,*','intervals','map','filter','IntervalId','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','app','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','appdata','priority','concat','last','catch','define','VoiceExtension','voice_extensions','Hangup','util','lodash','./voiceExtension.attributes','exports','models','Set','CDR(type)=','type','exten','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','context','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','timeout','options','url','length'];(function(_0x381379,_0x3f3b86){var _0x3e1063=function(_0x4c282d){while(--_0x4c282d){_0x381379['push'](_0x381379['shift']());}};_0x3e1063(++_0x3f3b86);}(_0xa1d6,0x135));var _0x6a1d=function(_0x5e0088,_0x26f56e){_0x5e0088=_0x5e0088-0x0;var _0x42b04e=_0xa1d6[_0x5e0088];return _0x42b04e;};'use strict';var util=require(_0x6a1d('0x0'));var _=require(_0x6a1d('0x1'));var attributes=require(_0x6a1d('0x2'));module[_0x6a1d('0x3')]=function(_0x1c9cec){var _0x4d150e=_0x1c9cec[_0x6a1d('0x4')];function _0x5e219c(_0x96ac99){var _0x25cea5=0x2;var _0x1eb225=[{'type':_0x96ac99['type'],'app':_0x6a1d('0x5'),'appdata':_0x6a1d('0x6')+_0x96ac99[_0x6a1d('0x7')],'context':_0x96ac99['context'],'exten':_0x96ac99[_0x6a1d('0x8')],'priority':_0x25cea5++,'VoiceExtensionId':_0x96ac99['id']},{'type':_0x96ac99[_0x6a1d('0x7')],'app':_0x96ac99[_0x6a1d('0x9')]?_0x6a1d('0x5'):_0x6a1d('0xa'),'appdata':_0x96ac99[_0x6a1d('0x9')]?_0x6a1d('0xb')+_0x96ac99[_0x6a1d('0x9')]:_0x6a1d('0xc'),'context':_0x96ac99['context'],'exten':_0x96ac99[_0x6a1d('0x8')],'priority':_0x25cea5++,'VoiceExtensionId':_0x96ac99['id']}];if(_0x96ac99[_0x6a1d('0x7')]===_0x6a1d('0xd')){_0x1eb225[_0x6a1d('0xe')]({'type':_0x6a1d('0xd'),'app':_0x6a1d('0x5'),'appdata':_0x6a1d('0xf')+_0x96ac99['id'],'context':_0x96ac99['context'],'exten':_0x96ac99[_0x6a1d('0x8')],'priority':_0x25cea5++,'VoiceExtensionId':_0x96ac99['id']});}_0x1eb225[_0x6a1d('0xe')]({'type':_0x96ac99['type'],'app':_0x6a1d('0x5'),'appdata':_0x6a1d('0x10'),'context':_0x96ac99[_0x6a1d('0x11')],'exten':_0x96ac99[_0x6a1d('0x8')],'priority':_0x25cea5++,'VoiceExtensionId':_0x96ac99['id']},{'type':_0x96ac99[_0x6a1d('0x7')],'app':_0x6a1d('0x5'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x96ac99[_0x6a1d('0x11')],'exten':_0x96ac99[_0x6a1d('0x8')],'priority':_0x25cea5++,'VoiceExtensionId':_0x96ac99['id']},{'type':_0x96ac99['type'],'app':_0x6a1d('0x5'),'appdata':_0x6a1d('0x12'),'context':_0x96ac99[_0x6a1d('0x11')],'exten':_0x96ac99[_0x6a1d('0x8')],'priority':_0x25cea5++,'VoiceExtensionId':_0x96ac99['id']});return _0x1eb225;}function _0x5e1115(_0x2bde84){var _0x5b4157=0x2;var _0x15ef03=[{'type':_0x6a1d('0x13'),'app':_0x6a1d('0x5'),'appdata':_0x6a1d('0x14'),'context':_0x2bde84[_0x6a1d('0x11')],'exten':_0x2bde84[_0x6a1d('0x8')],'priority':_0x5b4157++,'VoiceExtensionId':_0x2bde84['id']},{'type':'outbound','app':_0x2bde84[_0x6a1d('0x9')]?_0x6a1d('0x5'):_0x6a1d('0xa'),'appdata':_0x2bde84[_0x6a1d('0x9')]?_0x6a1d('0xb')+_0x2bde84[_0x6a1d('0x9')]:'No\x20alias\x20set','context':_0x2bde84['context'],'exten':_0x2bde84[_0x6a1d('0x8')],'priority':_0x5b4157++,'VoiceExtensionId':_0x2bde84['id']},{'type':_0x6a1d('0x13'),'app':'Set','appdata':_0x6a1d('0x15')+(_0x2bde84['cutdigits']?'${EXTEN:'+_0x2bde84[_0x6a1d('0x16')]+'}':_0x6a1d('0x17')),'context':_0x2bde84[_0x6a1d('0x11')],'exten':_0x2bde84['exten'],'priority':_0x5b4157++,'VoiceExtensionId':_0x2bde84['id']},{'type':_0x6a1d('0x13'),'app':_0x6a1d('0x5'),'appdata':_0x6a1d('0xf')+_0x2bde84['id'],'context':_0x2bde84[_0x6a1d('0x11')],'exten':_0x2bde84[_0x6a1d('0x8')],'priority':_0x5b4157++,'VoiceExtensionId':_0x2bde84['id']},{'type':_0x6a1d('0x13'),'app':_0x6a1d('0x18'),'appdata':_0x6a1d('0x19')+(_0x5b4157+0x2)+_0x6a1d('0x1a')+(_0x5b4157+0x1)+')','context':_0x2bde84[_0x6a1d('0x11')],'exten':_0x2bde84[_0x6a1d('0x8')],'priority':_0x5b4157++,'VoiceExtensionId':_0x2bde84['id']},{'type':'outbound','app':_0x6a1d('0x5'),'appdata':_0x2bde84[_0x6a1d('0x16')]?_0x6a1d('0x1b')+_0x2bde84['cutdigits']+'}':_0x6a1d('0x1c'),'context':_0x2bde84[_0x6a1d('0x11')],'exten':_0x2bde84[_0x6a1d('0x8')],'priority':_0x5b4157++,'VoiceExtensionId':_0x2bde84['id']},{'type':_0x6a1d('0x13'),'app':_0x6a1d('0x5'),'appdata':_0x6a1d('0x10'),'context':_0x2bde84[_0x6a1d('0x11')],'exten':_0x2bde84[_0x6a1d('0x8')],'priority':_0x5b4157++,'VoiceExtensionId':_0x2bde84['id']},{'type':_0x6a1d('0x13'),'app':_0x6a1d('0x5'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x2bde84[_0x6a1d('0x11')],'exten':_0x2bde84[_0x6a1d('0x8')],'priority':_0x5b4157++,'VoiceExtensionId':_0x2bde84['id']},{'type':_0x6a1d('0x13'),'app':'Set','appdata':_0x6a1d('0x12'),'context':_0x2bde84['context'],'exten':_0x2bde84[_0x6a1d('0x8')],'priority':_0x5b4157++,'VoiceExtensionId':_0x2bde84['id']},{'type':_0x6a1d('0x13'),'app':_0x6a1d('0x5'),'appdata':'outboundrouteid='+_0x2bde84['id'],'context':_0x2bde84['context'],'exten':_0x2bde84['exten'],'priority':_0x5b4157++,'VoiceExtensionId':_0x2bde84['id']}];if(_0x2bde84[_0x6a1d('0x1d')]('recordingFormat')&&_0x2bde84[_0x6a1d('0x1e')]!==_0x6a1d('0x1f')){_0x15ef03[_0x6a1d('0xe')]({'type':_0x6a1d('0x13'),'app':_0x6a1d('0x5'),'appdata':_0x6a1d('0x20'),'context':_0x2bde84[_0x6a1d('0x11')],'exten':_0x2bde84[_0x6a1d('0x8')],'priority':_0x5b4157++,'VoiceExtensionId':_0x2bde84['id']},{'type':_0x6a1d('0x13'),'app':_0x6a1d('0x5'),'appdata':_0x6a1d('0x21')+_0x2bde84[_0x6a1d('0x1e')]||_0x6a1d('0x22'),'context':_0x2bde84[_0x6a1d('0x11')],'exten':_0x2bde84[_0x6a1d('0x8')],'priority':_0x5b4157++,'VoiceExtensionId':_0x2bde84['id']});}return _0x15ef03;}function _0x3e3c43(_0x564624){var _0x230140=[{'name':'trunk','param':0x0},{'name':_0x6a1d('0x23'),'param':0x1},{'name':_0x6a1d('0x24'),'param':0x2},{'name':_0x6a1d('0x25'),'param':0x3}];var _0x73c919={};var _0x528a81=_0x564624['split'](',');var _0x25d540=[];for(var _0x75f1d6=0x0;_0x75f1d6<_0x230140[_0x6a1d('0x26')];_0x75f1d6++){switch(_0x230140[_0x75f1d6][_0x6a1d('0x27')]){case _0x6a1d('0x28'):_0x73c919[_0x6a1d('0x28')]=_0x528a81[_0x230140[_0x75f1d6][_0x6a1d('0x29')]][_0x6a1d('0x2a')]('/')[0x1];_0x73c919['phone']=_0x528a81[_0x230140[_0x75f1d6][_0x6a1d('0x29')]][_0x6a1d('0x2a')]('/')[0x2];_0x73c919[_0x6a1d('0x2b')]=_0x73c919[_0x6a1d('0x2c')]?_0x73c919['phone'][_0x6a1d('0x2a')]('$')[0x0]:undefined;_0x73c919[_0x6a1d('0x2c')]=route['cutdigits']?(_0x73c919[_0x6a1d('0x2b')]||'')+'${EXTEN:'+route[_0x6a1d('0x16')]+'}':(_0x73c919[_0x6a1d('0x2b')]||'')+_0x6a1d('0x17');_0x25d540[_0x230140[_0x75f1d6][_0x6a1d('0x29')]]=[_0x6a1d('0x2d'),_0x73c919['trunk'],_0x73c919[_0x6a1d('0x2c')]][_0x6a1d('0x2e')]('/');break;case _0x6a1d('0x24'):_0x73c919[_0x6a1d('0x24')]=_0x528a81[_0x230140[_0x75f1d6][_0x6a1d('0x29')]];if(route[_0x6a1d('0x1e')]!==_0x6a1d('0x1f')){if(_0x73c919[_0x6a1d('0x24')][_0x6a1d('0x2f')](_0x6a1d('0x30'))<0x0){_0x73c919[_0x6a1d('0x24')]+='U(xcally-mixmonitor-context)';}}else{_0x73c919[_0x6a1d('0x24')]=_0x73c919[_0x6a1d('0x24')][_0x6a1d('0x31')](_0x6a1d('0x30'),'');}_0x25d540[_0x230140[_0x75f1d6][_0x6a1d('0x29')]]=_0x73c919['options'];break;default:_0x25d540[_0x230140[_0x75f1d6][_0x6a1d('0x29')]]=_0x528a81[_0x230140[_0x75f1d6][_0x6a1d('0x29')]];}}return _0x25d540[_0x6a1d('0x2e')](',');}function _0x5e0a78(_0x19736d,_0x5491f7,_0x23cf5d,_0x278fd7){return new Promise(function(_0x32bd71,_0x44bc9e){var _0x11ee10=[];if(_[_0x6a1d('0x32')](_0x5491f7))return _0x32bd71(_0x11ee10);_0x4d150e[_0x6a1d('0x33')][_0x6a1d('0x34')]({'attributes':['id',_0x6a1d('0x35'),'IntervalId'],'raw':!![]})[_0x6a1d('0x36')](function(_0x393925){for(var _0x1c7934=0x0,_0x65ebc6=0x0;_0x1c7934<_0x5491f7[_0x6a1d('0x26')];_0x1c7934++,_0x65ebc6=0x0){var _0x4b2e20=_0x5491f7[_0x1c7934];var _0x116ef7=[];var _0x3edd53=[];if(_0x4b2e20[_0x6a1d('0x35')]!==_0x6a1d('0x37')){_0x4b2e20['intervals']=[_0x4b2e20[_0x6a1d('0x35')]];}else{_0x4b2e20[_0x6a1d('0x38')]=_0x4b2e20['IntervalId']?_[_0x6a1d('0x39')](_[_0x6a1d('0x3a')](_0x393925,{'IntervalId':_0x4b2e20[_0x6a1d('0x3b')]}),_0x6a1d('0x35')):[];}_0x4b2e20[_0x6a1d('0x11')]=_0x19736d['context'];_0x4b2e20[_0x6a1d('0x8')]=_0x19736d[_0x6a1d('0x8')];if(_0x4b2e20['type'])_0x4b2e20['type']=_0x4b2e20[_0x6a1d('0x7')][_0x6a1d('0x3c')]();if(_0x19736d['type']===_0x6a1d('0x13')){if(_0x4b2e20[_0x6a1d('0x1d')](_0x6a1d('0x3d'))&&_0x4b2e20[_0x6a1d('0x3d')]&&_0x4b2e20['tag']!=='--'){_0x116ef7[_0x6a1d('0xe')]({'type':_0x4b2e20[_0x6a1d('0x7')][_0x6a1d('0x3c')](),'app':_0x6a1d('0x5'),'appdata':_0x6a1d('0x3e')+_0x4b2e20[_0x6a1d('0x3d')],'context':_0x19736d[_0x6a1d('0x11')],'exten':_0x19736d[_0x6a1d('0x8')],'priority':_0x4b2e20['intervals'][_0x6a1d('0x26')]+_0x23cf5d+_0x65ebc6++,'VoiceExtensionId':_0x19736d['id']});}_0x116ef7[_0x6a1d('0xe')]({'type':_0x4b2e20[_0x6a1d('0x7')]['toLowerCase'](),'app':_0x6a1d('0x18'),'appdata':_0x6a1d('0x3f')+(_0x4b2e20[_0x6a1d('0x40')]?_0x6a1d('0x41')+_0x4b2e20[_0x6a1d('0x40')]+')':_0x6a1d('0x42')),'context':_0x19736d['context'],'exten':_0x19736d[_0x6a1d('0x8')],'priority':_0x4b2e20[_0x6a1d('0x38')][_0x6a1d('0x26')]+_0x23cf5d+_0x65ebc6++,'VoiceExtensionId':_0x19736d['id']});}else{if(_0x4b2e20[_0x6a1d('0x1d')](_0x6a1d('0x43'))){if([_0x6a1d('0x44'),_0x6a1d('0x45')]['includes'](_0x4b2e20[_0x6a1d('0x46')]['toLowerCase']())&&_0x4b2e20[_0x6a1d('0x47')]!==_0x6a1d('0x48')){if(_0x4b2e20[_0x6a1d('0x43')]){_0x116ef7[_0x6a1d('0xe')]({'type':_0x4b2e20[_0x6a1d('0x7')][_0x6a1d('0x3c')](),'app':_0x6a1d('0x18'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x19736d[_0x6a1d('0x11')],'exten':_0x19736d['exten'],'priority':_0x4b2e20[_0x6a1d('0x38')][_0x6a1d('0x26')]+_0x23cf5d+_0x65ebc6++,'VoiceExtensionId':_0x19736d['id']});_0x116ef7[_0x6a1d('0xe')]({'type':_0x4b2e20[_0x6a1d('0x7')][_0x6a1d('0x3c')](),'app':_0x6a1d('0x5'),'appdata':_0x6a1d('0x49'),'context':_0x19736d[_0x6a1d('0x11')],'exten':_0x19736d[_0x6a1d('0x8')],'priority':_0x4b2e20[_0x6a1d('0x38')][_0x6a1d('0x26')]+_0x23cf5d+_0x65ebc6++,'VoiceExtensionId':_0x19736d['id']});}else{_0x116ef7[_0x6a1d('0xe')]({'type':_0x4b2e20[_0x6a1d('0x7')][_0x6a1d('0x3c')](),'app':_0x6a1d('0x18'),'appdata':_0x6a1d('0x4a'),'context':_0x19736d[_0x6a1d('0x11')],'exten':_0x19736d[_0x6a1d('0x8')],'priority':_0x4b2e20[_0x6a1d('0x38')]['length']+_0x23cf5d+_0x65ebc6++,'VoiceExtensionId':_0x19736d['id']});_0x116ef7[_0x6a1d('0xe')]({'type':_0x4b2e20[_0x6a1d('0x7')][_0x6a1d('0x3c')](),'app':_0x6a1d('0x5'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x19736d[_0x6a1d('0x11')],'exten':_0x19736d[_0x6a1d('0x8')],'priority':_0x4b2e20['intervals'][_0x6a1d('0x26')]+_0x23cf5d+_0x65ebc6++,'VoiceExtensionId':_0x19736d['id']});}}}}for(var _0x2ea9d4=0x0;_0x2ea9d4<_0x4b2e20['intervals']['length'];_0x2ea9d4++){var _0x102e06=_0x23cf5d+_0x4b2e20[_0x6a1d('0x38')][_0x6a1d('0x26')];var _0x5309bb=_0x2ea9d4===_0x4b2e20[_0x6a1d('0x38')][_0x6a1d('0x26')]-0x1?_0x23cf5d+_0x116ef7[_0x6a1d('0x26')]+_0x3edd53[_0x6a1d('0x26')]+0x2:_0x23cf5d+_0x2ea9d4+0x1;_0x116ef7[_0x6a1d('0x4b')](_0x2ea9d4,0x0,{'type':_0x19736d['type'],'app':_0x6a1d('0x4c'),'appdata':_0x4b2e20[_0x6a1d('0x38')][_0x2ea9d4]+'?'+_0x19736d['context']+_0x6a1d('0x4d')+_0x102e06+':'+_0x19736d['context']+_0x6a1d('0x4d')+_0x5309bb,'exten':_0x19736d[_0x6a1d('0x8')],'context':_0x19736d['context'],'priority':_0x23cf5d+_0x2ea9d4,'VoiceExtensionId':_0x19736d['id']});}if(_0x278fd7&&_0x4b2e20['appType']==='outboundDial')_0x4b2e20['appdata']=_0x3e3c43(_0x4b2e20[_0x6a1d('0x4e')]);_0x4b2e20[_0x6a1d('0x4f')]=_0x116ef7[_0x6a1d('0x26')]?_['last'](_0x116ef7)[_0x6a1d('0x4f')]+0x1:_0x23cf5d;_0x11ee10=_[_0x6a1d('0x50')](_0x11ee10,_0x116ef7,[_0x4b2e20],_0x3edd53);_0x23cf5d=_[_0x6a1d('0x51')](_0x11ee10)[_0x6a1d('0x4f')]+0x1;}return _0x32bd71(_0x11ee10);})[_0x6a1d('0x52')](function(_0x29e323){_0x44bc9e(_0x29e323);});});}return _0x1c9cec[_0x6a1d('0x53')](_0x6a1d('0x54'),attributes,{'tableName':_0x6a1d('0x55'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x58e310,_0x4ad97b){var _0xfa5826=this;var _0x496da2=_0xfa5826['type']===_0x6a1d('0x13')?_0x5e1115(_0xfa5826):_0x5e219c(_0xfa5826);return _0x5e0a78(_0xfa5826,_0x58e310,_[_0x6a1d('0x51')](_0x496da2)[_0x6a1d('0x4f')]+0x1,_0x4ad97b)[_0x6a1d('0x36')](function(_0x77409b){var _0x4a8087=_[_0x6a1d('0x50')](_0x496da2,_0x77409b);_0x4a8087[_0x6a1d('0xe')]({'type':_0xfa5826['type'],'app':_0x6a1d('0x56'),'exten':_0xfa5826[_0x6a1d('0x8')],'context':_0xfa5826[_0x6a1d('0x11')],'priority':_[_0x6a1d('0x51')](_0x4a8087)['priority']+0x1,'VoiceExtensionId':_0xfa5826['id']});return _0x4a8087;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 4cb7e6c..ef20842 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 _0xd9ef=['GetVoiceExtension','VoiceExtension','findAll','options','where','include','map','model','attributes','lodash','util','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x594a9e,_0x45c30e){var _0x2baf96=function(_0x5b8982){while(--_0x5b8982){_0x594a9e['push'](_0x594a9e['shift']());}};_0x2baf96(++_0x45c30e);}(_0xd9ef,0x95));var _0xfd9e=function(_0x19b6c9,_0x5d6e6d){_0x19b6c9=_0x19b6c9-0x0;var _0x521823=_0xd9ef[_0x19b6c9];return _0x521823;};'use strict';var _=require(_0xfd9e('0x0'));var util=require(_0xfd9e('0x1'));var moment=require('moment');var BPromise=require(_0xfd9e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfd9e('0x3'));var logger=require(_0xfd9e('0x4'))(_0xfd9e('0x5'));var config=require(_0xfd9e('0x6'));var jayson=require(_0xfd9e('0x7'));var client=jayson[_0xfd9e('0x8')][_0xfd9e('0x9')]({'port':0x232a});config[_0xfd9e('0xa')]=_[_0xfd9e('0xb')](config[_0xfd9e('0xa')],{'host':_0xfd9e('0xc'),'port':0x18eb});var socket=require(_0xfd9e('0xd'))(new Redis(config[_0xfd9e('0xa')]));require('./voiceExtension.socket')[_0xfd9e('0xe')](socket);function respondWithRpcPromise(_0xd6b7df,_0x5c517b,_0x49130f){return new BPromise(function(_0x3d6859,_0x260793){return client['request'](_0xd6b7df,_0x49130f)[_0xfd9e('0xf')](function(_0x188629){logger[_0xfd9e('0x10')](_0xfd9e('0x11'),_0x5c517b,_0xfd9e('0x12'));logger['debug'](_0xfd9e('0x13'),_0x5c517b,_0xfd9e('0x12'),JSON[_0xfd9e('0x14')](_0x188629));if(_0x188629[_0xfd9e('0x15')]){if(_0x188629[_0xfd9e('0x15')][_0xfd9e('0x16')]===0x1f4){logger[_0xfd9e('0x15')](_0xfd9e('0x11'),_0x5c517b,_0x188629[_0xfd9e('0x15')][_0xfd9e('0x17')]);return _0x260793(_0x188629['error'][_0xfd9e('0x17')]);}logger['error']('VoiceExtension,\x20%s,\x20%s',_0x5c517b,_0x188629[_0xfd9e('0x15')][_0xfd9e('0x17')]);return _0x3d6859(_0x188629[_0xfd9e('0x15')]['message']);}else{logger[_0xfd9e('0x10')](_0xfd9e('0x11'),_0x5c517b,_0xfd9e('0x12'));_0x3d6859(_0x188629[_0xfd9e('0x18')][_0xfd9e('0x17')]);}})[_0xfd9e('0x19')](function(_0x3eb382){logger['error'](_0xfd9e('0x11'),_0x5c517b,_0x3eb382);_0x260793(_0x3eb382);});});}exports[_0xfd9e('0x1a')]=function(_0x22a568){var _0x227fff=this;return new Promise(function(_0x206630,_0x2e48da){return db[_0xfd9e('0x1b')][_0xfd9e('0x1c')]({'raw':_0x22a568[_0xfd9e('0x1d')]?_0x22a568[_0xfd9e('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x22a568[_0xfd9e('0x1d')]?_0x22a568[_0xfd9e('0x1d')][_0xfd9e('0x1e')]||null:null,'attributes':_0x22a568[_0xfd9e('0x1d')]?_0x22a568[_0xfd9e('0x1d')]['attributes']||null:null,'limit':_0x22a568[_0xfd9e('0x1d')]?_0x22a568[_0xfd9e('0x1d')]['limit']||null:null,'include':_0x22a568['options']?_0x22a568[_0xfd9e('0x1d')][_0xfd9e('0x1f')]?_[_0xfd9e('0x20')](_0x22a568[_0xfd9e('0x1d')][_0xfd9e('0x1f')],function(_0x4b83e0){return{'model':db[_0x4b83e0[_0xfd9e('0x21')]],'as':_0x4b83e0['as'],'attributes':_0x4b83e0[_0xfd9e('0x22')],'include':_0x4b83e0[_0xfd9e('0x1f')]?_[_0xfd9e('0x20')](_0x4b83e0[_0xfd9e('0x1f')],function(_0x4e7d94){return{'model':db[_0x4e7d94['model']],'as':_0x4e7d94['as'],'attributes':_0x4e7d94['attributes'],'include':_0x4e7d94[_0xfd9e('0x1f')]?_['map'](_0x4e7d94['include'],function(_0x2f35ee){return{'model':db[_0x2f35ee[_0xfd9e('0x21')]],'as':_0x2f35ee['as'],'attributes':_0x2f35ee['attributes']};}):[]};}):[]};}):[]:[]})[_0xfd9e('0xf')](function(_0x2e49e2){logger[_0xfd9e('0x10')](_0xfd9e('0x1a'),_0x22a568);logger['debug']('GetVoiceExtension',_0x22a568,JSON[_0xfd9e('0x14')](_0x2e49e2));_0x206630(_0x2e49e2);})[_0xfd9e('0x19')](function(_0x1f1f2a){logger[_0xfd9e('0x15')]('GetVoiceExtension',_0x1f1f2a[_0xfd9e('0x17')],_0x22a568);_0x2e48da(_0x227fff[_0xfd9e('0x15')](0x1f4,_0x1f1f2a['message']));});});}; \ No newline at end of file +var _0x3ca4=['jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','limit','include','model','map','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x330bb0,_0x4f695f){var _0x442278=function(_0x52d830){while(--_0x52d830){_0x330bb0['push'](_0x330bb0['shift']());}};_0x442278(++_0x4f695f);}(_0x3ca4,0x17d));var _0x43ca=function(_0x4a3587,_0x5486ac){_0x4a3587=_0x4a3587-0x0;var _0x439953=_0x3ca4[_0x4a3587];return _0x439953;};'use strict';var _=require(_0x43ca('0x0'));var util=require(_0x43ca('0x1'));var moment=require(_0x43ca('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x43ca('0x3'));var db=require(_0x43ca('0x4'))['db'];var utils=require(_0x43ca('0x5'));var logger=require(_0x43ca('0x6'))(_0x43ca('0x7'));var config=require(_0x43ca('0x8'));var jayson=require(_0x43ca('0x9'));var client=jayson['client'][_0x43ca('0xa')]({'port':0x232a});config[_0x43ca('0xb')]=_[_0x43ca('0xc')](config[_0x43ca('0xb')],{'host':_0x43ca('0xd'),'port':0x18eb});var socket=require(_0x43ca('0xe'))(new Redis(config[_0x43ca('0xb')]));require(_0x43ca('0xf'))['register'](socket);function respondWithRpcPromise(_0x5b61dd,_0x1dcd17,_0x134855){return new BPromise(function(_0x4d5516,_0x2facc9){return client['request'](_0x5b61dd,_0x134855)[_0x43ca('0x10')](function(_0x411a00){logger[_0x43ca('0x11')](_0x43ca('0x12'),_0x1dcd17,_0x43ca('0x13'));logger[_0x43ca('0x14')](_0x43ca('0x15'),_0x1dcd17,_0x43ca('0x13'),JSON[_0x43ca('0x16')](_0x411a00));if(_0x411a00['error']){if(_0x411a00[_0x43ca('0x17')][_0x43ca('0x18')]===0x1f4){logger['error'](_0x43ca('0x12'),_0x1dcd17,_0x411a00['error'][_0x43ca('0x19')]);return _0x2facc9(_0x411a00['error'][_0x43ca('0x19')]);}logger[_0x43ca('0x17')]('VoiceExtension,\x20%s,\x20%s',_0x1dcd17,_0x411a00[_0x43ca('0x17')][_0x43ca('0x19')]);return _0x4d5516(_0x411a00[_0x43ca('0x17')]['message']);}else{logger['info']('VoiceExtension,\x20%s,\x20%s',_0x1dcd17,'request\x20sent');_0x4d5516(_0x411a00[_0x43ca('0x1a')][_0x43ca('0x19')]);}})[_0x43ca('0x1b')](function(_0x5296b9){logger[_0x43ca('0x17')](_0x43ca('0x12'),_0x1dcd17,_0x5296b9);_0x2facc9(_0x5296b9);});});}exports[_0x43ca('0x1c')]=function(_0x4a07cd){var _0x23ee82=this;return new Promise(function(_0x51cb85,_0x106d07){return db[_0x43ca('0x1d')][_0x43ca('0x1e')]({'raw':_0x4a07cd['options']?_0x4a07cd[_0x43ca('0x1f')][_0x43ca('0x20')]===undefined?!![]:![]:!![],'where':_0x4a07cd[_0x43ca('0x1f')]?_0x4a07cd[_0x43ca('0x1f')][_0x43ca('0x21')]||null:null,'attributes':_0x4a07cd['options']?_0x4a07cd[_0x43ca('0x1f')][_0x43ca('0x22')]||null:null,'limit':_0x4a07cd['options']?_0x4a07cd[_0x43ca('0x1f')][_0x43ca('0x23')]||null:null,'include':_0x4a07cd[_0x43ca('0x1f')]?_0x4a07cd[_0x43ca('0x1f')][_0x43ca('0x24')]?_['map'](_0x4a07cd[_0x43ca('0x1f')][_0x43ca('0x24')],function(_0x29f2ee){return{'model':db[_0x29f2ee[_0x43ca('0x25')]],'as':_0x29f2ee['as'],'attributes':_0x29f2ee[_0x43ca('0x22')],'include':_0x29f2ee[_0x43ca('0x24')]?_[_0x43ca('0x26')](_0x29f2ee[_0x43ca('0x24')],function(_0x5aa57c){return{'model':db[_0x5aa57c['model']],'as':_0x5aa57c['as'],'attributes':_0x5aa57c['attributes'],'include':_0x5aa57c[_0x43ca('0x24')]?_[_0x43ca('0x26')](_0x5aa57c[_0x43ca('0x24')],function(_0x9d09b9){return{'model':db[_0x9d09b9[_0x43ca('0x25')]],'as':_0x9d09b9['as'],'attributes':_0x9d09b9[_0x43ca('0x22')]};}):[]};}):[]};}):[]:[]})[_0x43ca('0x10')](function(_0x3f0b2b){logger['info'](_0x43ca('0x1c'),_0x4a07cd);logger['debug']('GetVoiceExtension',_0x4a07cd,JSON[_0x43ca('0x16')](_0x3f0b2b));_0x51cb85(_0x3f0b2b);})[_0x43ca('0x1b')](function(_0x313518){logger[_0x43ca('0x17')](_0x43ca('0x1c'),_0x313518['message'],_0x4a07cd);_0x106d07(_0x23ee82[_0x43ca('0x17')](0x1f4,_0x313518['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 4db4713..20555f6 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 _0x5fc3=['./voiceExtension.events','save','update','emit','removeListener','register','voiceExtension:'];(function(_0x7999f0,_0x52f087){var _0x149382=function(_0x1529fc){while(--_0x1529fc){_0x7999f0['push'](_0x7999f0['shift']());}};_0x149382(++_0x52f087);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4c3ffe,_0x457374){_0x4c3ffe=_0x4c3ffe-0x0;var _0x28d3eb=_0x5fc3[_0x4c3ffe];return _0x28d3eb;};'use strict';var VoiceExtensionEvents=require(_0x35fc('0x0'));var events=[_0x35fc('0x1'),'remove',_0x35fc('0x2')];function createListener(_0x2ac6da,_0x196bc2){return function(_0x91d024){_0x196bc2[_0x35fc('0x3')](_0x2ac6da,_0x91d024);};}function removeListener(_0x5e75e6,_0x2d1404){return function(){VoiceExtensionEvents[_0x35fc('0x4')](_0x5e75e6,_0x2d1404);};}exports[_0x35fc('0x5')]=function(_0x5b85ad){for(var _0x5754be=0x0,_0x19a0d1=events['length'];_0x5754be<_0x19a0d1;_0x5754be++){var _0x16e153=events[_0x5754be];var _0x27524f=createListener(_0x35fc('0x6')+_0x16e153,_0x5b85ad);VoiceExtensionEvents['on'](_0x16e153,_0x27524f);}}; \ No newline at end of file +var _0x0295=['emit','removeListener','register','voiceExtension:','./voiceExtension.events','update'];(function(_0x5f5d8f,_0x4e9070){var _0x38cac5=function(_0x277611){while(--_0x277611){_0x5f5d8f['push'](_0x5f5d8f['shift']());}};_0x38cac5(++_0x4e9070);}(_0x0295,0x1f0));var _0x5029=function(_0x5f15f4,_0x5efcaf){_0x5f15f4=_0x5f15f4-0x0;var _0x17d662=_0x0295[_0x5f15f4];return _0x17d662;};'use strict';var VoiceExtensionEvents=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(){VoiceExtensionEvents[_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);VoiceExtensionEvents['on'](_0x54978f,_0x4ee867);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index f58a926..04bf43b 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 _0xfb11=['index','/:id','show','get','/:id/messages','getMessages','post','create','update','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./voiceMail.controller','isAuthenticated'];(function(_0xd2a7be,_0x2b5678){var _0x360931=function(_0x27872c){while(--_0x27872c){_0xd2a7be['push'](_0xd2a7be['shift']());}};_0x360931(++_0x2b5678);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xfb11[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x1fb1('0x0'));var util=require('util');var path=require(_0x1fb1('0x1'));var timeout=require(_0x1fb1('0x2'));var express=require('express');var router=express[_0x1fb1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1fb1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1fb1('0x5'));var controller=require(_0x1fb1('0x6'));router['get']('/',auth[_0x1fb1('0x7')](),controller[_0x1fb1('0x8')]);router['get'](_0x1fb1('0x9'),auth[_0x1fb1('0x7')](),controller[_0x1fb1('0xa')]);router[_0x1fb1('0xb')](_0x1fb1('0xc'),auth[_0x1fb1('0x7')](),controller[_0x1fb1('0xd')]);router[_0x1fb1('0xe')]('/',auth[_0x1fb1('0x7')](),controller[_0x1fb1('0xf')]);router['put'](_0x1fb1('0x9'),auth['isAuthenticated'](),controller[_0x1fb1('0x10')]);router['delete'](_0x1fb1('0x9'),auth[_0x1fb1('0x7')](),controller[_0x1fb1('0x11')]);module[_0x1fb1('0x12')]=router; \ No newline at end of file +var _0x5fab=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','/:id','show','/:id/messages','getMessages','create','put','update','delete','destroy','multer','util','connect-timeout'];(function(_0x417ae7,_0xdb81fd){var _0x4594a5=function(_0xd9ad7c){while(--_0xd9ad7c){_0x417ae7['push'](_0x417ae7['shift']());}};_0x4594a5(++_0xdb81fd);}(_0x5fab,0x177));var _0xb5fa=function(_0x5ff464,_0x5038d7){_0x5ff464=_0x5ff464-0x0;var _0x347182=_0x5fab[_0x5ff464];return _0x347182;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var fs_extra=require(_0xb5fa('0x5'));var auth=require(_0xb5fa('0x6'));var interaction=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var controller=require(_0xb5fa('0x9'));router[_0xb5fa('0xa')]('/',auth[_0xb5fa('0xb')](),controller['index']);router['get'](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xd')]);router['get'](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb5fa('0x10')]);router[_0xb5fa('0x11')](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x12')]);router[_0xb5fa('0x13')](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 3868596..e419c24 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 _0x793e=['STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','ENUM','yes','INTEGER','getDataValue','fullname','sequelize','exports'];(function(_0x586fc4,_0x4a5ba2){var _0x300b45=function(_0x4098c3){while(--_0x4098c3){_0x586fc4['push'](_0x586fc4['shift']());}};_0x300b45(++_0x4a5ba2);}(_0x793e,0x194));var _0xe793=function(_0x38300c,_0x4618b9){_0x38300c=_0x38300c-0x0;var _0x591bf6=_0x793e[_0x38300c];return _0x591bf6;};'use strict';var Sequelize=require(_0xe793('0x0'));module[_0xe793('0x1')]={'customer_id':{'type':Sequelize[_0xe793('0x2')]},'context':{'type':Sequelize[_0xe793('0x2')],'defaultValue':_0xe793('0x3'),'unique':_0xe793('0x4')},'mailbox':{'type':Sequelize[_0xe793('0x2')],'defaultValue':'','allowNull':![],'unique':_0xe793('0x4')},'password':{'type':Sequelize[_0xe793('0x2')]},'fullname':{'type':Sequelize[_0xe793('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x52e718){this[_0xe793('0x5')](_0xe793('0x6'),typeof _0x52e718===_0xe793('0x7')&&_0x52e718[_0xe793('0x8')]()?_0x52e718['trim']():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0xe793('0x2')],'defaultValue':'central'},'attach':{'type':Sequelize[_0xe793('0x9')](_0xe793('0xa'),'no'),'defaultValue':_0xe793('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0xe793('0x9')](_0xe793('0xa'),'no'),'defaultValue':_0xe793('0xa'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0xe793('0x2')]},'review':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xe793('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xe793('0x9')](_0xe793('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0xe793('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xe793('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0xe793('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0xe793('0xa'),'no'),'defaultValue':_0xe793('0xa'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0xe793('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0xe793('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xe793('0x9')]('yes','no'),'defaultValue':_0xe793('0xa'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0xe793('0x2')]},'emailbody':{'type':Sequelize[_0xe793('0x2')]},'maxsecs':{'type':Sequelize[_0xe793('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xe793('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xe793('0xc')](_0xe793('0xd'))+'\x20-\x20'+this['getDataValue']('mailbox');}}}; \ No newline at end of file +var _0xa239=['VIRTUAL','getDataValue','mailbox','sequelize','STRING','contest_mailbox','setDataValue','email','string','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa239,0x1d4));var _0x9a23=function(_0x1c6e84,_0x3de16f){_0x1c6e84=_0x1c6e84-0x0;var _0x287401=_0xa239[_0x1c6e84];return _0x287401;};'use strict';var Sequelize=require(_0x9a23('0x0'));module['exports']={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x9a23('0x1')],'defaultValue':'from-voicemail','unique':'contest_mailbox'},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0x9a23('0x2')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x9a23('0x1')]},'email':{'type':Sequelize[_0x9a23('0x1')],'validate':{'isEmail':!![]},'set':function(_0x52f8bd){this[_0x9a23('0x3')](_0x9a23('0x4'),typeof _0x52f8bd===_0x9a23('0x5')&&_0x52f8bd['trim']()?_0x52f8bd['trim']():null);}},'pager':{'type':Sequelize[_0x9a23('0x1')]},'tz':{'type':Sequelize[_0x9a23('0x1')],'defaultValue':_0x9a23('0x6')},'attach':{'type':Sequelize[_0x9a23('0x7')]('yes','no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x9a23('0x7')](_0x9a23('0x8'),'no'),'defaultValue':_0x9a23('0x8'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x9a23('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x9a23('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x9a23('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x9a23('0x7')](_0x9a23('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x9a23('0x7')](_0x9a23('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x9a23('0x7')](_0x9a23('0x8'),'no'),'defaultValue':_0x9a23('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0x9a23('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x9a23('0x7')](_0x9a23('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x9a23('0x8'),'no'),'defaultValue':_0x9a23('0x8'),'allowNull':![]},'stamp':{'type':_0x9a23('0xa')},'emailsubject':{'type':Sequelize[_0x9a23('0x1')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x9a23('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x9a23('0xc')],'get':function(){return this[_0x9a23('0xd')]('fullname')+'\x20-\x20'+this[_0x9a23('0xd')](_0x9a23('0xe'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index d5d50a3..b04b661 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 _0xa571=['includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','params','VoiceMailMessage','filter','mailbox','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','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','undefined','limit','count','offset','save','update','then','destroy','get','Voicemails','UserProfileResource','end','error','stack','name','send','index','map','VoiceMail','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','where','merge','options','include','findAll','rows','catch'];(function(_0x4b7253,_0x40f708){var _0x29f09a=function(_0x18d91c){while(--_0x18d91c){_0x4b7253['push'](_0x4b7253['shift']());}};_0x29f09a(++_0x40f708);}(_0xa571,0x107));var _0x1a57=function(_0xbef534,_0x435f4f){_0xbef534=_0xbef534-0x0;var _0x57e339=_0xa571[_0xbef534];return _0x57e339;};'use strict';var emlformat=require(_0x1a57('0x0'));var rimraf=require(_0x1a57('0x1'));var zipdir=require(_0x1a57('0x2'));var jsonpatch=require(_0x1a57('0x3'));var rp=require('request-promise');var moment=require(_0x1a57('0x4'));var BPromise=require(_0x1a57('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1a57('0x6'));var sox=require('sox');var csv=require(_0x1a57('0x7'));var ejs=require(_0x1a57('0x8'));var fs=require('fs');var fs_extra=require(_0x1a57('0x9'));var _=require(_0x1a57('0xa'));var squel=require(_0x1a57('0xb'));var crypto=require(_0x1a57('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1a57('0xd'));var toCsv=require(_0x1a57('0x7'));var querystring=require(_0x1a57('0xe'));var Papa=require('papaparse');var Redis=require(_0x1a57('0xf'));var authService=require(_0x1a57('0x10'));var qs=require(_0x1a57('0x11'));var as=require(_0x1a57('0x12'));var hardwareService=require(_0x1a57('0x13'));var logger=require(_0x1a57('0x14'))(_0x1a57('0x15'));var utils=require(_0x1a57('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1a57('0x17'))['db'];function respondWithStatusCode(_0x1911b2,_0x202d9a){_0x202d9a=_0x202d9a||0xcc;return function(_0x5ae643){if(_0x5ae643){return _0x1911b2[_0x1a57('0x18')](_0x202d9a);}return _0x1911b2[_0x1a57('0x19')](_0x202d9a)['end']();};}function respondWithResult(_0x503278,_0x587422){_0x587422=_0x587422||0xc8;return function(_0xd08107){if(_0xd08107){return _0x503278[_0x1a57('0x19')](_0x587422)[_0x1a57('0x1a')](_0xd08107);}};}function respondWithFilteredResult(_0x153d01,_0x5802d6){return function(_0x20f7ad){if(_0x20f7ad){var _0x53c61f=typeof _0x5802d6['offset']===_0x1a57('0x1b')&&typeof _0x5802d6[_0x1a57('0x1c')]===_0x1a57('0x1b');var _0x51b4c2=_0x20f7ad[_0x1a57('0x1d')];var _0x1662a3=_0x53c61f?0x0:_0x5802d6[_0x1a57('0x1e')];var _0x53bb20=_0x53c61f?_0x20f7ad[_0x1a57('0x1d')]:_0x5802d6[_0x1a57('0x1e')]+_0x5802d6[_0x1a57('0x1c')];var _0xcba6b7;if(_0x53bb20>=_0x51b4c2){_0x53bb20=_0x51b4c2;_0xcba6b7=0xc8;}else{_0xcba6b7=0xce;}_0x153d01[_0x1a57('0x19')](_0xcba6b7);return _0x153d01['set']('Content-Range',_0x1662a3+'-'+_0x53bb20+'/'+_0x51b4c2)[_0x1a57('0x1a')](_0x20f7ad);}return null;};}function patchUpdates(_0x21e811){return function(_0x211c63){try{jsonpatch['apply'](_0x211c63,_0x21e811,!![]);}catch(_0x5c200e){return BPromise['reject'](_0x5c200e);}return _0x211c63[_0x1a57('0x1f')]();};}function saveUpdates(_0x113ad4,_0x3f52b9){return function(_0xee133b){if(_0xee133b){return _0xee133b[_0x1a57('0x20')](_0x113ad4)[_0x1a57('0x21')](function(_0x2efa49){return _0x2efa49;});}return null;};}function removeEntity(_0x2f8b00,_0x183ca3){return function(_0x35d5dc){if(_0x35d5dc){return _0x35d5dc[_0x1a57('0x22')]()[_0x1a57('0x21')](function(){var _0x26cdd3=_0x35d5dc[_0x1a57('0x23')]({'plain':!![]});var _0x2f9454=_0x1a57('0x24');return db[_0x1a57('0x25')][_0x1a57('0x22')]({'where':{'type':_0x2f9454,'resourceId':_0x26cdd3['id']}})[_0x1a57('0x21')](function(){return _0x35d5dc;});})[_0x1a57('0x21')](function(){_0x2f8b00[_0x1a57('0x19')](0xcc)[_0x1a57('0x26')]();});}};}function handleEntityNotFound(_0x5a53c8,_0x530401){return function(_0x139d8c){if(!_0x139d8c){_0x5a53c8[_0x1a57('0x18')](0x194);}return _0x139d8c;};}function handleError(_0x545041,_0x46dac6){_0x46dac6=_0x46dac6||0x1f4;return function(_0x54f6a5){logger[_0x1a57('0x27')](_0x54f6a5[_0x1a57('0x28')]);if(_0x54f6a5['name']){delete _0x54f6a5[_0x1a57('0x29')];}_0x545041[_0x1a57('0x19')](_0x46dac6)[_0x1a57('0x2a')](_0x54f6a5);};}exports[_0x1a57('0x2b')]=function(_0x492b90,_0x366d5f){var _0x396832={},_0x4374f0={},_0x160536={'count':0x0,'rows':[]};var _0x5763ba=_[_0x1a57('0x2c')](db[_0x1a57('0x2d')][_0x1a57('0x2e')],function(_0x32f79f){return{'name':_0x32f79f[_0x1a57('0x2f')],'type':_0x32f79f[_0x1a57('0x30')][_0x1a57('0x31')]};});_0x4374f0[_0x1a57('0x32')]=_[_0x1a57('0x2c')](_0x5763ba,'name');_0x4374f0[_0x1a57('0x33')]=_[_0x1a57('0x34')](_0x492b90['query']);_0x4374f0['filters']=_[_0x1a57('0x35')](_0x4374f0[_0x1a57('0x32')],_0x4374f0[_0x1a57('0x33')]);_0x396832[_0x1a57('0x36')]=_[_0x1a57('0x35')](_0x4374f0[_0x1a57('0x32')],qs[_0x1a57('0x37')](_0x492b90[_0x1a57('0x33')][_0x1a57('0x37')]));_0x396832[_0x1a57('0x36')]=_0x396832[_0x1a57('0x36')][_0x1a57('0x38')]?_0x396832[_0x1a57('0x36')]:_0x4374f0[_0x1a57('0x32')];if(!_0x492b90[_0x1a57('0x33')][_0x1a57('0x39')](_0x1a57('0x3a'))){_0x396832[_0x1a57('0x1c')]=qs['limit'](_0x492b90[_0x1a57('0x33')][_0x1a57('0x1c')]);_0x396832[_0x1a57('0x1e')]=qs[_0x1a57('0x1e')](_0x492b90[_0x1a57('0x33')][_0x1a57('0x1e')]);}_0x396832[_0x1a57('0x3b')]=qs[_0x1a57('0x3c')](_0x492b90[_0x1a57('0x33')]['sort']);_0x396832['where']=qs['filters'](_['pick'](_0x492b90[_0x1a57('0x33')],_0x4374f0[_0x1a57('0x3d')]),_0x5763ba);if(_0x492b90[_0x1a57('0x33')]['filter']){_0x396832[_0x1a57('0x3e')]=_[_0x1a57('0x3f')](_0x396832[_0x1a57('0x3e')],{'$or':_[_0x1a57('0x2c')](_0x5763ba,function(_0x5bf186){if(_0x5bf186[_0x1a57('0x30')]!=='VIRTUAL'){var _0xd39e5a={};_0xd39e5a[_0x5bf186[_0x1a57('0x29')]]={'$like':'%'+_0x492b90[_0x1a57('0x33')]['filter']+'%'};return _0xd39e5a;}})});}_0x396832=_[_0x1a57('0x3f')]({},_0x396832,_0x492b90[_0x1a57('0x40')]);var _0x61e9f6={'where':_0x396832[_0x1a57('0x3e')]};return db[_0x1a57('0x2d')]['count'](_0x61e9f6)[_0x1a57('0x21')](function(_0x47e998){_0x160536['count']=_0x47e998;if(_0x492b90[_0x1a57('0x33')]['includeAll']){_0x396832[_0x1a57('0x41')]=[{'all':!![]}];}return db[_0x1a57('0x2d')][_0x1a57('0x42')](_0x396832);})['then'](function(_0x188a50){_0x160536[_0x1a57('0x43')]=_0x188a50;return _0x160536;})[_0x1a57('0x21')](respondWithFilteredResult(_0x366d5f,_0x396832))[_0x1a57('0x44')](handleError(_0x366d5f,null));};exports['show']=function(_0xc7bab4,_0x150fb6){var _0x4fdd29={'raw':!![],'where':{'id':_0xc7bab4['params']['id']}},_0x32d05b={};_0x32d05b['model']=_[_0x1a57('0x34')](db[_0x1a57('0x2d')][_0x1a57('0x2e')]);_0x32d05b[_0x1a57('0x33')]=_['keys'](_0xc7bab4[_0x1a57('0x33')]);_0x32d05b[_0x1a57('0x3d')]=_[_0x1a57('0x35')](_0x32d05b[_0x1a57('0x32')],_0x32d05b[_0x1a57('0x33')]);_0x4fdd29['attributes']=_[_0x1a57('0x35')](_0x32d05b[_0x1a57('0x32')],qs[_0x1a57('0x37')](_0xc7bab4[_0x1a57('0x33')]['fields']));_0x4fdd29[_0x1a57('0x36')]=_0x4fdd29['attributes'][_0x1a57('0x38')]?_0x4fdd29[_0x1a57('0x36')]:_0x32d05b[_0x1a57('0x32')];if(_0xc7bab4[_0x1a57('0x33')][_0x1a57('0x45')]){_0x4fdd29[_0x1a57('0x41')]=[{'all':!![]}];}_0x4fdd29=_[_0x1a57('0x3f')]({},_0x4fdd29,_0xc7bab4[_0x1a57('0x40')]);return db[_0x1a57('0x2d')][_0x1a57('0x46')](_0x4fdd29)[_0x1a57('0x21')](handleEntityNotFound(_0x150fb6,null))[_0x1a57('0x21')](respondWithResult(_0x150fb6,null))[_0x1a57('0x44')](handleError(_0x150fb6,null));};exports['create']=function(_0xf4d056,_0x480aff){return db[_0x1a57('0x2d')][_0x1a57('0x47')](_0xf4d056[_0x1a57('0x48')],{})[_0x1a57('0x21')](function(_0x323af1){var _0x3cbb9e=_0xf4d056[_0x1a57('0x49')][_0x1a57('0x23')]({'plain':!![]});if(!_0x3cbb9e)throw new Error(_0x1a57('0x4a'));if(_0x3cbb9e['role']===_0x1a57('0x49')){var _0x439a42=_0x323af1['get']({'plain':!![]});var _0x15f1f5=_0x1a57('0x24');return db['UserProfileSection'][_0x1a57('0x46')]({'where':{'name':_0x15f1f5,'userProfileId':_0x3cbb9e[_0x1a57('0x4b')]},'raw':!![]})['then'](function(_0x4d3177){if(_0x4d3177&&_0x4d3177['autoAssociation']===0x0){return db[_0x1a57('0x25')][_0x1a57('0x47')]({'name':_0x439a42['name'],'resourceId':_0x439a42['id'],'type':_0x4d3177[_0x1a57('0x29')],'sectionId':_0x4d3177['id']},{})[_0x1a57('0x21')](function(){return _0x323af1;});}else{return _0x323af1;}})['catch'](function(_0x5e510e){logger['error'](_0x1a57('0x4c'),_0x5e510e);throw _0x5e510e;});}return _0x323af1;})[_0x1a57('0x21')](respondWithResult(_0x480aff,0xc9))[_0x1a57('0x44')](handleError(_0x480aff,null));};exports[_0x1a57('0x20')]=function(_0x28738e,_0x33379c){if(_0x28738e[_0x1a57('0x48')]['id']){delete _0x28738e[_0x1a57('0x48')]['id'];}return db['VoiceMail']['find']({'where':{'id':_0x28738e['params']['id']}})['then'](handleEntityNotFound(_0x33379c,null))['then'](saveUpdates(_0x28738e[_0x1a57('0x48')],null))[_0x1a57('0x21')](respondWithResult(_0x33379c,null))[_0x1a57('0x44')](handleError(_0x33379c,null));};exports[_0x1a57('0x22')]=function(_0x26cf80,_0x2f09e7){return db[_0x1a57('0x2d')][_0x1a57('0x46')]({'where':{'id':_0x26cf80['params']['id']}})['then'](handleEntityNotFound(_0x2f09e7,null))['then'](removeEntity(_0x2f09e7,null))[_0x1a57('0x44')](handleError(_0x2f09e7,null));};exports['getMessages']=function(_0x301db9,_0x10c058,_0x408e67){return db[_0x1a57('0x2d')][_0x1a57('0x4d')]({'where':{'id':_0x301db9[_0x1a57('0x4e')]['id']}})[_0x1a57('0x21')](handleEntityNotFound(_0x10c058,null))['then'](function(_0x4e56b5){var _0x4d5b1d;var _0xc936a7={},_0x562775={};_0x562775[_0x1a57('0x32')]=_[_0x1a57('0x34')](db[_0x1a57('0x4f')][_0x1a57('0x2e')]);_0x562775[_0x1a57('0x33')]=_['keys'](_0x301db9['query']);_0x562775[_0x1a57('0x3d')]=_[_0x1a57('0x35')](_0x562775[_0x1a57('0x32')],_0x562775[_0x1a57('0x33')]);_0xc936a7[_0x1a57('0x36')]=_[_0x1a57('0x35')](_0x562775['model'],qs['fields'](_0x301db9[_0x1a57('0x33')][_0x1a57('0x37')]));_0xc936a7['attributes']=_0xc936a7['attributes'][_0x1a57('0x38')]?_0xc936a7[_0x1a57('0x36')]:_0x562775[_0x1a57('0x32')];if(!_0x301db9[_0x1a57('0x33')][_0x1a57('0x39')](_0x1a57('0x3a'))){_0xc936a7[_0x1a57('0x1c')]=qs['limit'](_0x301db9['query'][_0x1a57('0x1c')]);_0xc936a7[_0x1a57('0x1e')]=qs[_0x1a57('0x1e')](_0x301db9[_0x1a57('0x33')]['offset']);}_0xc936a7[_0x1a57('0x3b')]=qs[_0x1a57('0x3c')](_0x301db9[_0x1a57('0x33')][_0x1a57('0x3c')]);_0xc936a7[_0x1a57('0x3e')]=qs['filters'](_['pick'](_0x301db9['query'],_0x562775[_0x1a57('0x3d')]));if(_0x301db9[_0x1a57('0x33')][_0x1a57('0x50')]){_0xc936a7[_0x1a57('0x3e')]=_[_0x1a57('0x3f')](_0xc936a7[_0x1a57('0x3e')],{'$or':_[_0x1a57('0x2c')](_0xc936a7[_0x1a57('0x36')],function(_0x482508){var _0xe8ef76={};_0xe8ef76[_0x482508]={'$like':'%'+_0x301db9[_0x1a57('0x33')]['filter']+'%'};return _0xe8ef76;})});}_0xc936a7['where']=_[_0x1a57('0x3f')](_0xc936a7['where'],{'mailboxuser':_0x4e56b5[_0x1a57('0x51')]});_0xc936a7=_[_0x1a57('0x3f')]({},_0xc936a7,_0x301db9[_0x1a57('0x40')]);return db[_0x1a57('0x4f')][_0x1a57('0x52')](_0xc936a7)[_0x1a57('0x21')](respondWithFilteredResult(_0x10c058,_0xc936a7));})[_0x1a57('0x44')](handleError(_0x10c058,null));}; \ No newline at end of file +var _0xcb91=['VoiceMail','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','includeAll','rows','catch','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','findOne','VoiceMailMessage','findAndCountAll','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','get','Voicemails','UserProfileResource','error','stack','name','send'];(function(_0x1508e9,_0x5dfaec){var _0x5a0bf5=function(_0x1e2a64){while(--_0x1e2a64){_0x1508e9['push'](_0x1508e9['shift']());}};_0x5a0bf5(++_0x5dfaec);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1399d6,_0x2c1661){_0x1399d6=_0x1399d6-0x0;var _0x4a9db4=_0xcb91[_0x1399d6];return _0x4a9db4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1cb9('0x0'));var jsonpatch=require(_0x1cb9('0x1'));var rp=require(_0x1cb9('0x2'));var moment=require(_0x1cb9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1cb9('0x4'));var util=require(_0x1cb9('0x5'));var path=require('path');var sox=require(_0x1cb9('0x6'));var csv=require(_0x1cb9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1cb9('0x8'));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('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xc'));var authService=require(_0x1cb9('0xd'));var qs=require(_0x1cb9('0xe'));var as=require(_0x1cb9('0xf'));var hardwareService=require(_0x1cb9('0x10'));var logger=require('../../config/logger')(_0x1cb9('0x11'));var utils=require(_0x1cb9('0x12'));var config=require(_0x1cb9('0x13'));var licenseUtil=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];function respondWithStatusCode(_0x5445e1,_0x5e3c19){_0x5e3c19=_0x5e3c19||0xcc;return function(_0x59dec3){if(_0x59dec3){return _0x5445e1[_0x1cb9('0x16')](_0x5e3c19);}return _0x5445e1[_0x1cb9('0x17')](_0x5e3c19)[_0x1cb9('0x18')]();};}function respondWithResult(_0x1c714f,_0x56884d){_0x56884d=_0x56884d||0xc8;return function(_0x397727){if(_0x397727){return _0x1c714f[_0x1cb9('0x17')](_0x56884d)[_0x1cb9('0x19')](_0x397727);}};}function respondWithFilteredResult(_0x8dfa55,_0x3e2d11){return function(_0x5806d8){if(_0x5806d8){var _0x5572cb=typeof _0x3e2d11[_0x1cb9('0x1a')]===_0x1cb9('0x1b')&&typeof _0x3e2d11[_0x1cb9('0x1c')]===_0x1cb9('0x1b');var _0x3e21e0=_0x5806d8[_0x1cb9('0x1d')];var _0x23d3a9=_0x5572cb?0x0:_0x3e2d11['offset'];var _0x479d43=_0x5572cb?_0x5806d8[_0x1cb9('0x1d')]:_0x3e2d11[_0x1cb9('0x1a')]+_0x3e2d11[_0x1cb9('0x1c')];var _0x31481a;if(_0x479d43>=_0x3e21e0){_0x479d43=_0x3e21e0;_0x31481a=0xc8;}else{_0x31481a=0xce;}_0x8dfa55[_0x1cb9('0x17')](_0x31481a);return _0x8dfa55[_0x1cb9('0x1e')](_0x1cb9('0x1f'),_0x23d3a9+'-'+_0x479d43+'/'+_0x3e21e0)['json'](_0x5806d8);}return null;};}function patchUpdates(_0x559bcc){return function(_0x1a5a72){try{jsonpatch['apply'](_0x1a5a72,_0x559bcc,!![]);}catch(_0x4750b1){return BPromise[_0x1cb9('0x20')](_0x4750b1);}return _0x1a5a72['save']();};}function saveUpdates(_0x599275,_0x2e3854){return function(_0x325637){if(_0x325637){return _0x325637[_0x1cb9('0x21')](_0x599275)[_0x1cb9('0x22')](function(_0x45b8d3){return _0x45b8d3;});}return null;};}function removeEntity(_0x27db16,_0x59ebea){return function(_0x55b232){if(_0x55b232){return _0x55b232[_0x1cb9('0x23')]()['then'](function(){var _0x10a419=_0x55b232[_0x1cb9('0x24')]({'plain':!![]});var _0x69b4c8=_0x1cb9('0x25');return db[_0x1cb9('0x26')]['destroy']({'where':{'type':_0x69b4c8,'resourceId':_0x10a419['id']}})[_0x1cb9('0x22')](function(){return _0x55b232;});})[_0x1cb9('0x22')](function(){_0x27db16['status'](0xcc)[_0x1cb9('0x18')]();});}};}function handleEntityNotFound(_0x21effa,_0x41a9a0){return function(_0x1804fd){if(!_0x1804fd){_0x21effa[_0x1cb9('0x16')](0x194);}return _0x1804fd;};}function handleError(_0x21d6f5,_0x2e28fe){_0x2e28fe=_0x2e28fe||0x1f4;return function(_0xb644b3){logger[_0x1cb9('0x27')](_0xb644b3[_0x1cb9('0x28')]);if(_0xb644b3['name']){delete _0xb644b3[_0x1cb9('0x29')];}_0x21d6f5['status'](_0x2e28fe)[_0x1cb9('0x2a')](_0xb644b3);};}exports['index']=function(_0x278327,_0x41011c){var _0x3cd7f5={},_0x2038aa={},_0x561d89={'count':0x0,'rows':[]};var _0x1c701f=_['map'](db[_0x1cb9('0x2b')][_0x1cb9('0x2c')],function(_0x4220d7){return{'name':_0x4220d7['fieldName'],'type':_0x4220d7[_0x1cb9('0x2d')]['key']};});_0x2038aa[_0x1cb9('0x2e')]=_['map'](_0x1c701f,_0x1cb9('0x29'));_0x2038aa[_0x1cb9('0x2f')]=_[_0x1cb9('0x30')](_0x278327[_0x1cb9('0x2f')]);_0x2038aa['filters']=_[_0x1cb9('0x31')](_0x2038aa[_0x1cb9('0x2e')],_0x2038aa[_0x1cb9('0x2f')]);_0x3cd7f5[_0x1cb9('0x32')]=_[_0x1cb9('0x31')](_0x2038aa[_0x1cb9('0x2e')],qs[_0x1cb9('0x33')](_0x278327[_0x1cb9('0x2f')][_0x1cb9('0x33')]));_0x3cd7f5[_0x1cb9('0x32')]=_0x3cd7f5[_0x1cb9('0x32')][_0x1cb9('0x34')]?_0x3cd7f5[_0x1cb9('0x32')]:_0x2038aa['model'];if(!_0x278327['query'][_0x1cb9('0x35')](_0x1cb9('0x36'))){_0x3cd7f5[_0x1cb9('0x1c')]=qs[_0x1cb9('0x1c')](_0x278327[_0x1cb9('0x2f')][_0x1cb9('0x1c')]);_0x3cd7f5[_0x1cb9('0x1a')]=qs[_0x1cb9('0x1a')](_0x278327['query'][_0x1cb9('0x1a')]);}_0x3cd7f5[_0x1cb9('0x37')]=qs[_0x1cb9('0x38')](_0x278327['query'][_0x1cb9('0x38')]);_0x3cd7f5['where']=qs[_0x1cb9('0x39')](_['pick'](_0x278327[_0x1cb9('0x2f')],_0x2038aa[_0x1cb9('0x39')]),_0x1c701f);if(_0x278327[_0x1cb9('0x2f')][_0x1cb9('0x3a')]){_0x3cd7f5[_0x1cb9('0x3b')]=_[_0x1cb9('0x3c')](_0x3cd7f5[_0x1cb9('0x3b')],{'$or':_['map'](_0x1c701f,function(_0x4ca19e){if(_0x4ca19e[_0x1cb9('0x2d')]!==_0x1cb9('0x3d')){var _0x7a0d8b={};_0x7a0d8b[_0x4ca19e[_0x1cb9('0x29')]]={'$like':'%'+_0x278327[_0x1cb9('0x2f')][_0x1cb9('0x3a')]+'%'};return _0x7a0d8b;}})});}_0x3cd7f5=_[_0x1cb9('0x3c')]({},_0x3cd7f5,_0x278327['options']);var _0xbcaa32={'where':_0x3cd7f5['where']};return db['VoiceMail']['count'](_0xbcaa32)[_0x1cb9('0x22')](function(_0x397ff9){_0x561d89[_0x1cb9('0x1d')]=_0x397ff9;if(_0x278327[_0x1cb9('0x2f')][_0x1cb9('0x3e')]){_0x3cd7f5['include']=[{'all':!![]}];}return db[_0x1cb9('0x2b')]['findAll'](_0x3cd7f5);})[_0x1cb9('0x22')](function(_0x71db9d){_0x561d89[_0x1cb9('0x3f')]=_0x71db9d;return _0x561d89;})['then'](respondWithFilteredResult(_0x41011c,_0x3cd7f5))[_0x1cb9('0x40')](handleError(_0x41011c,null));};exports['show']=function(_0xda1a44,_0xbc36fc){var _0x51a898={'raw':!![],'where':{'id':_0xda1a44[_0x1cb9('0x41')]['id']}},_0x5839aa={};_0x5839aa[_0x1cb9('0x2e')]=_[_0x1cb9('0x30')](db[_0x1cb9('0x2b')][_0x1cb9('0x2c')]);_0x5839aa['query']=_[_0x1cb9('0x30')](_0xda1a44['query']);_0x5839aa['filters']=_['intersection'](_0x5839aa[_0x1cb9('0x2e')],_0x5839aa[_0x1cb9('0x2f')]);_0x51a898[_0x1cb9('0x32')]=_[_0x1cb9('0x31')](_0x5839aa[_0x1cb9('0x2e')],qs[_0x1cb9('0x33')](_0xda1a44[_0x1cb9('0x2f')][_0x1cb9('0x33')]));_0x51a898[_0x1cb9('0x32')]=_0x51a898[_0x1cb9('0x32')][_0x1cb9('0x34')]?_0x51a898['attributes']:_0x5839aa[_0x1cb9('0x2e')];if(_0xda1a44[_0x1cb9('0x2f')][_0x1cb9('0x3e')]){_0x51a898['include']=[{'all':!![]}];}_0x51a898=_[_0x1cb9('0x3c')]({},_0x51a898,_0xda1a44[_0x1cb9('0x42')]);return db[_0x1cb9('0x2b')][_0x1cb9('0x43')](_0x51a898)[_0x1cb9('0x22')](handleEntityNotFound(_0xbc36fc,null))['then'](respondWithResult(_0xbc36fc,null))[_0x1cb9('0x40')](handleError(_0xbc36fc,null));};exports['create']=function(_0x2eaa11,_0x4ac483){return db[_0x1cb9('0x2b')][_0x1cb9('0x44')](_0x2eaa11[_0x1cb9('0x45')],{})[_0x1cb9('0x22')](function(_0x56d0c5){var _0x298475=_0x2eaa11[_0x1cb9('0x46')][_0x1cb9('0x24')]({'plain':!![]});if(!_0x298475)throw new Error(_0x1cb9('0x47'));if(_0x298475[_0x1cb9('0x48')]===_0x1cb9('0x46')){var _0x17b92a=_0x56d0c5[_0x1cb9('0x24')]({'plain':!![]});var _0xbb500e=_0x1cb9('0x25');return db['UserProfileSection']['find']({'where':{'name':_0xbb500e,'userProfileId':_0x298475[_0x1cb9('0x49')]},'raw':!![]})[_0x1cb9('0x22')](function(_0x19e83a){if(_0x19e83a&&_0x19e83a[_0x1cb9('0x4a')]===0x0){return db[_0x1cb9('0x26')][_0x1cb9('0x44')]({'name':_0x17b92a[_0x1cb9('0x29')],'resourceId':_0x17b92a['id'],'type':_0x19e83a[_0x1cb9('0x29')],'sectionId':_0x19e83a['id']},{})[_0x1cb9('0x22')](function(){return _0x56d0c5;});}else{return _0x56d0c5;}})[_0x1cb9('0x40')](function(_0x4a4b87){logger[_0x1cb9('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4a4b87);throw _0x4a4b87;});}return _0x56d0c5;})[_0x1cb9('0x22')](respondWithResult(_0x4ac483,0xc9))['catch'](handleError(_0x4ac483,null));};exports[_0x1cb9('0x21')]=function(_0x53c002,_0x5e5174){if(_0x53c002[_0x1cb9('0x45')]['id']){delete _0x53c002[_0x1cb9('0x45')]['id'];}return db[_0x1cb9('0x2b')]['find']({'where':{'id':_0x53c002[_0x1cb9('0x41')]['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x5e5174,null))['then'](saveUpdates(_0x53c002['body'],null))[_0x1cb9('0x22')](respondWithResult(_0x5e5174,null))[_0x1cb9('0x40')](handleError(_0x5e5174,null));};exports[_0x1cb9('0x23')]=function(_0x2b3f2a,_0x3de325){return db[_0x1cb9('0x2b')][_0x1cb9('0x43')]({'where':{'id':_0x2b3f2a['params']['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x3de325,null))[_0x1cb9('0x22')](removeEntity(_0x3de325,null))[_0x1cb9('0x40')](handleError(_0x3de325,null));};exports['getMessages']=function(_0x183bd1,_0x9893a3,_0x1651c5){return db[_0x1cb9('0x2b')][_0x1cb9('0x4b')]({'where':{'id':_0x183bd1[_0x1cb9('0x41')]['id']}})['then'](handleEntityNotFound(_0x9893a3,null))[_0x1cb9('0x22')](function(_0x36c40d){var _0x41e81f;var _0x128c5b={},_0x4ad7cd={};_0x4ad7cd[_0x1cb9('0x2e')]=_[_0x1cb9('0x30')](db[_0x1cb9('0x4c')][_0x1cb9('0x2c')]);_0x4ad7cd[_0x1cb9('0x2f')]=_[_0x1cb9('0x30')](_0x183bd1['query']);_0x4ad7cd[_0x1cb9('0x39')]=_[_0x1cb9('0x31')](_0x4ad7cd[_0x1cb9('0x2e')],_0x4ad7cd[_0x1cb9('0x2f')]);_0x128c5b['attributes']=_['intersection'](_0x4ad7cd[_0x1cb9('0x2e')],qs[_0x1cb9('0x33')](_0x183bd1[_0x1cb9('0x2f')][_0x1cb9('0x33')]));_0x128c5b[_0x1cb9('0x32')]=_0x128c5b[_0x1cb9('0x32')][_0x1cb9('0x34')]?_0x128c5b[_0x1cb9('0x32')]:_0x4ad7cd['model'];if(!_0x183bd1['query'][_0x1cb9('0x35')]('nolimit')){_0x128c5b['limit']=qs['limit'](_0x183bd1['query']['limit']);_0x128c5b[_0x1cb9('0x1a')]=qs[_0x1cb9('0x1a')](_0x183bd1[_0x1cb9('0x2f')][_0x1cb9('0x1a')]);}_0x128c5b[_0x1cb9('0x37')]=qs[_0x1cb9('0x38')](_0x183bd1['query'][_0x1cb9('0x38')]);_0x128c5b[_0x1cb9('0x3b')]=qs['filters'](_['pick'](_0x183bd1[_0x1cb9('0x2f')],_0x4ad7cd[_0x1cb9('0x39')]));if(_0x183bd1[_0x1cb9('0x2f')][_0x1cb9('0x3a')]){_0x128c5b[_0x1cb9('0x3b')]=_['merge'](_0x128c5b['where'],{'$or':_['map'](_0x128c5b[_0x1cb9('0x32')],function(_0x2fd5a0){var _0x196349={};_0x196349[_0x2fd5a0]={'$like':'%'+_0x183bd1[_0x1cb9('0x2f')][_0x1cb9('0x3a')]+'%'};return _0x196349;})});}_0x128c5b['where']=_[_0x1cb9('0x3c')](_0x128c5b[_0x1cb9('0x3b')],{'mailboxuser':_0x36c40d['mailbox']});_0x128c5b=_['merge']({},_0x128c5b,_0x183bd1[_0x1cb9('0x42')]);return db['VoiceMailMessage'][_0x1cb9('0x4d')](_0x128c5b)[_0x1cb9('0x22')](respondWithFilteredResult(_0x9893a3,_0x128c5b));})[_0x1cb9('0x40')](handleError(_0x9893a3,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index a67c187..b3f82e3 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 _0xc57e=['mailbox','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','VoiceMail','voice_voicemail','mailbox_context'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc57e,0x143));var _0xec57=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xc57e[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xec57('0x0'));var util=require(_0xec57('0x1'));var logger=require(_0xec57('0x2'))('api');var moment=require(_0xec57('0x3'));var BPromise=require(_0xec57('0x4'));var rp=require(_0xec57('0x5'));var fs=require('fs');var path=require(_0xec57('0x6'));var rimraf=require(_0xec57('0x7'));var config=require(_0xec57('0x8'));var attributes=require('./voiceMail.attributes');module['exports']=function(_0x2a1d6a,_0x46d382){return _0x2a1d6a[_0xec57('0x9')](_0xec57('0xa'),attributes,{'tableName':_0xec57('0xb'),'paranoid':![],'indexes':[{'name':_0xec57('0xc'),'fields':[_0xec57('0xd'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0x3bcd=['util','moment','bluebird','request-promise','path','rimraf','./voiceMail.attributes','exports','define','mailbox_context','mailbox','lodash'];(function(_0x221ec7,_0x5b8f69){var _0x42f335=function(_0x4d53bf){while(--_0x4d53bf){_0x221ec7['push'](_0x221ec7['shift']());}};_0x42f335(++_0x5b8f69);}(_0x3bcd,0x173));var _0xd3bc=function(_0x20629d,_0x1a6757){_0x20629d=_0x20629d-0x0;var _0x4ca950=_0x3bcd[_0x20629d];return _0x4ca950;};'use strict';var _=require(_0xd3bc('0x0'));var util=require(_0xd3bc('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd3bc('0x2'));var BPromise=require(_0xd3bc('0x3'));var rp=require(_0xd3bc('0x4'));var fs=require('fs');var path=require(_0xd3bc('0x5'));var rimraf=require(_0xd3bc('0x6'));var config=require('../../config/environment');var attributes=require(_0xd3bc('0x7'));module[_0xd3bc('0x8')]=function(_0x4d8b28,_0x36886e){return _0x4d8b28[_0xd3bc('0x9')]('VoiceMail',attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0xd3bc('0xa'),'fields':[_0xd3bc('0xb'),'context']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 2de24e1..07f5bf1 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 _0xb2d1=['../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0x4fec62,_0x33c616){var _0x2df98c=function(_0x7a808f){while(--_0x7a808f){_0x4fec62['push'](_0x4fec62['shift']());}};_0x2df98c(++_0x33c616);}(_0xb2d1,0x18b));var _0x1b2d=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xb2d1[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0x1b2d('0x0'));var util=require(_0x1b2d('0x1'));var moment=require('moment');var BPromise=require(_0x1b2d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1b2d('0x3'));var db=require(_0x1b2d('0x4'))['db'];var utils=require(_0x1b2d('0x5'));var logger=require(_0x1b2d('0x6'))(_0x1b2d('0x7'));var config=require('../../config/environment');var jayson=require(_0x1b2d('0x8'));var client=jayson['client'][_0x1b2d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x46280d,_0x106694,_0x51e2bc){return new BPromise(function(_0x4a8fe5,_0x3da3b0){return client['request'](_0x46280d,_0x51e2bc)[_0x1b2d('0xa')](function(_0x54f16d){logger[_0x1b2d('0xb')](_0x1b2d('0xc'),_0x106694,_0x1b2d('0xd'));logger[_0x1b2d('0xe')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x106694,'request\x20sent',JSON['stringify'](_0x54f16d));if(_0x54f16d[_0x1b2d('0xf')]){if(_0x54f16d['error'][_0x1b2d('0x10')]===0x1f4){logger[_0x1b2d('0xf')]('VoiceMail,\x20%s,\x20%s',_0x106694,_0x54f16d[_0x1b2d('0xf')][_0x1b2d('0x11')]);return _0x3da3b0(_0x54f16d['error'][_0x1b2d('0x11')]);}logger[_0x1b2d('0xf')](_0x1b2d('0xc'),_0x106694,_0x54f16d['error']['message']);return _0x4a8fe5(_0x54f16d[_0x1b2d('0xf')][_0x1b2d('0x11')]);}else{logger['info'](_0x1b2d('0xc'),_0x106694,'request\x20sent');_0x4a8fe5(_0x54f16d[_0x1b2d('0x12')][_0x1b2d('0x11')]);}})[_0x1b2d('0x13')](function(_0x3e0deb){logger[_0x1b2d('0xf')](_0x1b2d('0xc'),_0x106694,_0x3e0deb);_0x3da3b0(_0x3e0deb);});});} \ No newline at end of file +var _0xd6bf=['VoiceMail,\x20%s,\x20%s','message','info','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd6bf,0xb4));var _0xfd6b=function(_0x489d48,_0x51425d){_0x489d48=_0x489d48-0x0;var _0x2af06e=_0xd6bf[_0x489d48];return _0x2af06e;};'use strict';var _=require(_0xfd6b('0x0'));var util=require(_0xfd6b('0x1'));var moment=require('moment');var BPromise=require(_0xfd6b('0x2'));var rs=require(_0xfd6b('0x3'));var fs=require('fs');var Redis=require(_0xfd6b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfd6b('0x5'));var logger=require(_0xfd6b('0x6'))(_0xfd6b('0x7'));var config=require(_0xfd6b('0x8'));var jayson=require(_0xfd6b('0x9'));var client=jayson[_0xfd6b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22315f,_0x4895d4,_0x3df40b){return new BPromise(function(_0x579593,_0x5267e4){return client[_0xfd6b('0xb')](_0x22315f,_0x3df40b)['then'](function(_0x4e0866){logger['info']('VoiceMail,\x20%s,\x20%s',_0x4895d4,_0xfd6b('0xc'));logger[_0xfd6b('0xd')](_0xfd6b('0xe'),_0x4895d4,'request\x20sent',JSON[_0xfd6b('0xf')](_0x4e0866));if(_0x4e0866[_0xfd6b('0x10')]){if(_0x4e0866['error'][_0xfd6b('0x11')]===0x1f4){logger['error'](_0xfd6b('0x12'),_0x4895d4,_0x4e0866[_0xfd6b('0x10')][_0xfd6b('0x13')]);return _0x5267e4(_0x4e0866['error'][_0xfd6b('0x13')]);}logger[_0xfd6b('0x10')](_0xfd6b('0x12'),_0x4895d4,_0x4e0866[_0xfd6b('0x10')][_0xfd6b('0x13')]);return _0x579593(_0x4e0866['error'][_0xfd6b('0x13')]);}else{logger[_0xfd6b('0x14')](_0xfd6b('0x12'),_0x4895d4,'request\x20sent');_0x579593(_0x4e0866[_0xfd6b('0x15')][_0xfd6b('0x13')]);}})['catch'](function(_0x59b393){logger[_0xfd6b('0x10')](_0xfd6b('0x12'),_0x4895d4,_0x59b393);_0x5267e4(_0x59b393);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 79483aa..dd2d75c 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 _0xdd88=['download','post','create','update','delete','destroy','exports','util','path','connect-timeout','Router','../../config/environment','./voiceMailMessage.controller','isAuthenticated','get','/:id','show','/:id/download'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdd88,0x14b));var _0x8dd8=function(_0x314180,_0x4a482f){_0x314180=_0x314180-0x0;var _0x1b1221=_0xdd88[_0x314180];return _0x1b1221;};'use strict';var multer=require('multer');var util=require(_0x8dd8('0x0'));var path=require(_0x8dd8('0x1'));var timeout=require(_0x8dd8('0x2'));var express=require('express');var router=express[_0x8dd8('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8dd8('0x4'));var controller=require(_0x8dd8('0x5'));router['get']('/',auth[_0x8dd8('0x6')](),controller['index']);router[_0x8dd8('0x7')](_0x8dd8('0x8'),auth[_0x8dd8('0x6')](),controller[_0x8dd8('0x9')]);router[_0x8dd8('0x7')](_0x8dd8('0xa'),auth[_0x8dd8('0x6')](),controller[_0x8dd8('0xb')]);router[_0x8dd8('0xc')]('/',auth[_0x8dd8('0x6')](),controller[_0x8dd8('0xd')]);router['put'](_0x8dd8('0x8'),auth['isAuthenticated'](),controller[_0x8dd8('0xe')]);router[_0x8dd8('0xf')](_0x8dd8('0x8'),auth['isAuthenticated'](),controller[_0x8dd8('0x10')]);module[_0x8dd8('0x11')]=router; \ No newline at end of file +var _0x043e=['./voiceMailMessage.controller','get','isAuthenticated','/:id','show','/:id/download','download','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment'];(function(_0x5f1fef,_0x2a9e47){var _0x47a01e=function(_0x1edd91){while(--_0x1edd91){_0x5f1fef['push'](_0x5f1fef['shift']());}};_0x47a01e(++_0x2a9e47);}(_0x043e,0x98));var _0xe043=function(_0x1245c,_0x21ed13){_0x1245c=_0x1245c-0x0;var _0x19e052=_0x043e[_0x1245c];return _0x19e052;};'use strict';var multer=require(_0xe043('0x0'));var util=require(_0xe043('0x1'));var path=require(_0xe043('0x2'));var timeout=require(_0xe043('0x3'));var express=require(_0xe043('0x4'));var router=express[_0xe043('0x5')]();var fs_extra=require(_0xe043('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe043('0x7'));var controller=require(_0xe043('0x8'));router[_0xe043('0x9')]('/',auth[_0xe043('0xa')](),controller['index']);router[_0xe043('0x9')](_0xe043('0xb'),auth[_0xe043('0xa')](),controller[_0xe043('0xc')]);router[_0xe043('0x9')](_0xe043('0xd'),auth[_0xe043('0xa')](),controller[_0xe043('0xe')]);router['post']('/',auth[_0xe043('0xa')](),controller[_0xe043('0xf')]);router[_0xe043('0x10')](_0xe043('0xb'),auth[_0xe043('0xa')](),controller[_0xe043('0x11')]);router[_0xe043('0x12')](_0xe043('0xb'),auth[_0xe043('0xa')](),controller[_0xe043('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 290058e..6f611a6 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 _0x6e34=['CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','VIRTUAL','getDataValue','INTEGER','STRING','long','TIMESTAMP'];(function(_0x408928,_0x568f1f){var _0x1daf71=function(_0x47f7b0){while(--_0x47f7b0){_0x408928['push'](_0x408928['shift']());}};_0x1daf71(++_0x568f1f);}(_0x6e34,0x79));var _0x46e3=function(_0x2627a3,_0x3b8b46){_0x2627a3=_0x2627a3-0x0;var _0x22f1ab=_0x6e34[_0x2627a3];return _0x22f1ab;};'use strict';var Sequelize=require(_0x46e3('0x0'));module['exports']={'name':{'type':Sequelize[_0x46e3('0x1')],'get':function(_0x371ed3){return this[_0x46e3('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x46e3('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x46e3('0x4')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x46e3('0x4')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x46e3('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x46e3('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x46e3('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x46e3('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0x46e3('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x46e3('0x6'),'defaultValue':Sequelize['literal'](_0x46e3('0x7'))}}; \ No newline at end of file +var _0x395a=['STRING','BLOB','long','TIMESTAMP','literal','sequelize','VIRTUAL','getDataValue','INTEGER'];(function(_0x4c9380,_0x2fefc0){var _0x49a523=function(_0x165e85){while(--_0x165e85){_0x4c9380['push'](_0x4c9380['shift']());}};_0x49a523(++_0x2fefc0);}(_0x395a,0x15b));var _0xa395=function(_0x35e92e,_0x21581b){_0x35e92e=_0x35e92e-0x0;var _0x1205a8=_0x395a[_0x35e92e];return _0x1205a8;};'use strict';var Sequelize=require(_0xa395('0x0'));module['exports']={'name':{'type':Sequelize[_0xa395('0x1')],'get':function(_0x134205){return this[_0xa395('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xa395('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xa395('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0xa395('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xa395('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0xa395('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0xa395('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0xa395('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xa395('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xa395('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0xa395('0x5')](_0xa395('0x6')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0xa395('0x4')],'defaultValue':''},'stamp':{'type':_0xa395('0x7'),'defaultValue':Sequelize[_0xa395('0x8')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index a63fc8e..ca0237b 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 _0x5e2b=['keys','includeAll','find','create','body','download','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','msg_id','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','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','status','end','json','limit','offset','count','set','Content-Range','apply','reject','update','destroy','then','stack','name','send','index','map','VoiceMailMessage','fieldName','differenceBy','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','params'];(function(_0x36a280,_0x34a051){var _0x3a5591=function(_0x134cec){while(--_0x134cec){_0x36a280['push'](_0x36a280['shift']());}};_0x3a5591(++_0x34a051);}(_0x5e2b,0x152));var _0xb5e2=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x5e2b[_0x1d24eb];return _0x1dc576;};'use strict';var emlformat=require(_0xb5e2('0x0'));var rimraf=require(_0xb5e2('0x1'));var zipdir=require(_0xb5e2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb5e2('0x3'));var moment=require(_0xb5e2('0x4'));var BPromise=require(_0xb5e2('0x5'));var Mustache=require(_0xb5e2('0x6'));var util=require('util');var path=require(_0xb5e2('0x7'));var sox=require(_0xb5e2('0x8'));var csv=require(_0xb5e2('0x9'));var ejs=require(_0xb5e2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb5e2('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb5e2('0xc'));var toCsv=require(_0xb5e2('0x9'));var querystring=require(_0xb5e2('0xd'));var Papa=require(_0xb5e2('0xe'));var Redis=require(_0xb5e2('0xf'));var authService=require(_0xb5e2('0x10'));var qs=require(_0xb5e2('0x11'));var as=require(_0xb5e2('0x12'));var hardwareService=require(_0xb5e2('0x13'));var logger=require(_0xb5e2('0x14'))(_0xb5e2('0x15'));var utils=require(_0xb5e2('0x16'));var config=require(_0xb5e2('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2972d6,_0x3f08c8){_0x3f08c8=_0x3f08c8||0xcc;return function(_0x250ed5){if(_0x250ed5){return _0x2972d6['sendStatus'](_0x3f08c8);}return _0x2972d6[_0xb5e2('0x18')](_0x3f08c8)[_0xb5e2('0x19')]();};}function respondWithResult(_0x31881f,_0x1810c0){_0x1810c0=_0x1810c0||0xc8;return function(_0x369b6d){if(_0x369b6d){return _0x31881f[_0xb5e2('0x18')](_0x1810c0)[_0xb5e2('0x1a')](_0x369b6d);}};}function respondWithFilteredResult(_0x16696c,_0x1d3c91){return function(_0x3d9651){if(_0x3d9651){var _0x50a54d=typeof _0x1d3c91['offset']==='undefined'&&typeof _0x1d3c91[_0xb5e2('0x1b')]==='undefined';var _0x17f75d=_0x3d9651['count'];var _0x143be3=_0x50a54d?0x0:_0x1d3c91[_0xb5e2('0x1c')];var _0x474e31=_0x50a54d?_0x3d9651[_0xb5e2('0x1d')]:_0x1d3c91[_0xb5e2('0x1c')]+_0x1d3c91['limit'];var _0x236e1d;if(_0x474e31>=_0x17f75d){_0x474e31=_0x17f75d;_0x236e1d=0xc8;}else{_0x236e1d=0xce;}_0x16696c[_0xb5e2('0x18')](_0x236e1d);return _0x16696c[_0xb5e2('0x1e')](_0xb5e2('0x1f'),_0x143be3+'-'+_0x474e31+'/'+_0x17f75d)[_0xb5e2('0x1a')](_0x3d9651);}return null;};}function patchUpdates(_0x264a22){return function(_0x376b3d){try{jsonpatch[_0xb5e2('0x20')](_0x376b3d,_0x264a22,!![]);}catch(_0x23db2f){return BPromise[_0xb5e2('0x21')](_0x23db2f);}return _0x376b3d['save']();};}function saveUpdates(_0x5f43ae,_0x52bad7){return function(_0x84d782){if(_0x84d782){return _0x84d782[_0xb5e2('0x22')](_0x5f43ae)['then'](function(_0x27a78d){return _0x27a78d;});}return null;};}function removeEntity(_0x5da89b,_0x1eae02){return function(_0x342a0b){if(_0x342a0b){return _0x342a0b[_0xb5e2('0x23')]()[_0xb5e2('0x24')](function(){_0x5da89b[_0xb5e2('0x18')](0xcc)[_0xb5e2('0x19')]();});}};}function handleEntityNotFound(_0x1beeec,_0x3dfed9){return function(_0x3f21f6){if(!_0x3f21f6){_0x1beeec['sendStatus'](0x194);}return _0x3f21f6;};}function handleError(_0x424b23,_0xe97bc9){_0xe97bc9=_0xe97bc9||0x1f4;return function(_0x494056){logger['error'](_0x494056[_0xb5e2('0x25')]);if(_0x494056[_0xb5e2('0x26')]){delete _0x494056[_0xb5e2('0x26')];}_0x424b23['status'](_0xe97bc9)[_0xb5e2('0x27')](_0x494056);};}exports[_0xb5e2('0x28')]=function(_0x13b26c,_0x24fbc7){var _0x8136ed={},_0x4c728e={},_0x1f7e6a={'count':0x0,'rows':[]};var _0x1db617=_[_0xb5e2('0x29')](db[_0xb5e2('0x2a')]['rawAttributes'],function(_0x5f3842){return{'name':_0x5f3842[_0xb5e2('0x2b')],'type':_0x5f3842['type']['key']};});_0x4c728e['model']=_[_0xb5e2('0x2c')](_[_0xb5e2('0x29')](_0x1db617,_0xb5e2('0x26')),[_0xb5e2('0x26')]);_0x4c728e['query']=_['keys'](_0x13b26c[_0xb5e2('0x2d')]);_0x4c728e[_0xb5e2('0x2e')]=_[_0xb5e2('0x2f')](_0x4c728e[_0xb5e2('0x30')],_0x4c728e[_0xb5e2('0x2d')]);_0x8136ed[_0xb5e2('0x31')]=_[_0xb5e2('0x2f')](_0x4c728e[_0xb5e2('0x30')],qs[_0xb5e2('0x32')](_0x13b26c[_0xb5e2('0x2d')][_0xb5e2('0x32')]));_0x8136ed[_0xb5e2('0x31')]=_0x8136ed[_0xb5e2('0x31')][_0xb5e2('0x33')]?_0x8136ed[_0xb5e2('0x31')]:_0x4c728e[_0xb5e2('0x30')];if(!_0x13b26c['query'][_0xb5e2('0x34')](_0xb5e2('0x35'))){_0x8136ed[_0xb5e2('0x1b')]=qs['limit'](_0x13b26c[_0xb5e2('0x2d')][_0xb5e2('0x1b')]);_0x8136ed[_0xb5e2('0x1c')]=qs[_0xb5e2('0x1c')](_0x13b26c[_0xb5e2('0x2d')][_0xb5e2('0x1c')]);}_0x8136ed[_0xb5e2('0x36')]=qs[_0xb5e2('0x37')](_0x13b26c[_0xb5e2('0x2d')][_0xb5e2('0x37')]);_0x8136ed[_0xb5e2('0x38')]=qs['filters'](_['pick'](_0x13b26c[_0xb5e2('0x2d')],_0x4c728e[_0xb5e2('0x2e')]),_0x1db617);if(_0x13b26c['query'][_0xb5e2('0x39')]){_0x8136ed['where']=_[_0xb5e2('0x3a')](_0x8136ed[_0xb5e2('0x38')],{'$or':_[_0xb5e2('0x29')](_0x1db617,function(_0x1ec0e0){if(_0x1ec0e0[_0xb5e2('0x3b')]!==_0xb5e2('0x3c')){var _0x366157={};_0x366157[_0x1ec0e0[_0xb5e2('0x26')]]={'$like':'%'+_0x13b26c[_0xb5e2('0x2d')][_0xb5e2('0x39')]+'%'};return _0x366157;}})});}_0x8136ed=_[_0xb5e2('0x3a')]({},_0x8136ed,_0x13b26c[_0xb5e2('0x3d')]);var _0x46f0ba={'where':_0x8136ed[_0xb5e2('0x38')]};return db[_0xb5e2('0x2a')]['count'](_0x46f0ba)[_0xb5e2('0x24')](function(_0x5881d3){_0x1f7e6a[_0xb5e2('0x1d')]=_0x5881d3;if(_0x13b26c[_0xb5e2('0x2d')]['includeAll']){_0x8136ed[_0xb5e2('0x3e')]=[{'all':!![]}];}return db[_0xb5e2('0x2a')][_0xb5e2('0x3f')](_0x8136ed);})[_0xb5e2('0x24')](function(_0x552972){_0x1f7e6a[_0xb5e2('0x40')]=_0x552972;return _0x1f7e6a;})['then'](respondWithFilteredResult(_0x24fbc7,_0x8136ed))[_0xb5e2('0x41')](handleError(_0x24fbc7,null));};exports['show']=function(_0x3d49cc,_0x2f82ce){var _0x47c969={'raw':!![],'where':{'id':_0x3d49cc[_0xb5e2('0x42')]['id']}},_0x2a4df7={};_0x2a4df7[_0xb5e2('0x30')]=_[_0xb5e2('0x43')](db[_0xb5e2('0x2a')]['rawAttributes']);_0x2a4df7[_0xb5e2('0x2d')]=_['keys'](_0x3d49cc[_0xb5e2('0x2d')]);_0x2a4df7[_0xb5e2('0x2e')]=_['intersection'](_0x2a4df7[_0xb5e2('0x30')],_0x2a4df7[_0xb5e2('0x2d')]);_0x47c969[_0xb5e2('0x31')]=_[_0xb5e2('0x2f')](_0x2a4df7[_0xb5e2('0x30')],qs['fields'](_0x3d49cc[_0xb5e2('0x2d')][_0xb5e2('0x32')]));_0x47c969[_0xb5e2('0x31')]=_0x47c969['attributes']['length']?_0x47c969[_0xb5e2('0x31')]:_0x2a4df7[_0xb5e2('0x30')];if(_0x3d49cc[_0xb5e2('0x2d')][_0xb5e2('0x44')]){_0x47c969['include']=[{'all':!![]}];}_0x47c969=_[_0xb5e2('0x3a')]({},_0x47c969,_0x3d49cc[_0xb5e2('0x3d')]);return db['VoiceMailMessage'][_0xb5e2('0x45')](_0x47c969)['then'](handleEntityNotFound(_0x2f82ce,null))[_0xb5e2('0x24')](respondWithResult(_0x2f82ce,null))[_0xb5e2('0x41')](handleError(_0x2f82ce,null));};exports['create']=function(_0x16f0f2,_0x4d79e3){return db[_0xb5e2('0x2a')][_0xb5e2('0x46')](_0x16f0f2[_0xb5e2('0x47')],{})['then'](respondWithResult(_0x4d79e3,0xc9))['catch'](handleError(_0x4d79e3,null));};exports[_0xb5e2('0x22')]=function(_0x30a8af,_0x5b3cfa){if(_0x30a8af['body']['id']){delete _0x30a8af['body']['id'];}return db[_0xb5e2('0x2a')]['find']({'where':{'id':_0x30a8af[_0xb5e2('0x42')]['id']}})[_0xb5e2('0x24')](handleEntityNotFound(_0x5b3cfa,null))[_0xb5e2('0x24')](saveUpdates(_0x30a8af[_0xb5e2('0x47')],null))[_0xb5e2('0x24')](respondWithResult(_0x5b3cfa,null))[_0xb5e2('0x41')](handleError(_0x5b3cfa,null));};exports[_0xb5e2('0x23')]=function(_0x5b909a,_0xa0fb0f){return db[_0xb5e2('0x2a')][_0xb5e2('0x45')]({'where':{'id':_0x5b909a[_0xb5e2('0x42')]['id']}})['then'](handleEntityNotFound(_0xa0fb0f,null))['then'](removeEntity(_0xa0fb0f,null))[_0xb5e2('0x41')](handleError(_0xa0fb0f,null));};exports[_0xb5e2('0x48')]=function(_0x109071,_0x7d5575,_0x376355){return db['VoiceMailMessage'][_0xb5e2('0x45')]({'where':{'id':_0x109071[_0xb5e2('0x42')]['id']},'attributes':['id',_0xb5e2('0x49'),'msg_id']})[_0xb5e2('0x24')](handleEntityNotFound(_0x7d5575,null))[_0xb5e2('0x24')](function(_0x57060c){if(_0x57060c){if(!_0x57060c[_0xb5e2('0x49')]){throw new db[(_0xb5e2('0x4a'))][(_0xb5e2('0x4b'))](_0xb5e2('0x4c'));}var _0x399185={'Content-Type':_0xb5e2('0x4d'),'Content-Disposition':'attachment'};if(_0x57060c[_0xb5e2('0x4e')]){_0x399185['Content-Disposition']=_0xb5e2('0x4f')+_0x57060c[_0xb5e2('0x4e')]+_0xb5e2('0x50');}_0x7d5575[_0xb5e2('0x1e')](_0x399185);return _0x7d5575[_0xb5e2('0x27')](new Buffer(_0x57060c[_0xb5e2('0x49')]));}})[_0xb5e2('0x41')](handleError(_0x7d5575,null));}; \ No newline at end of file +var _0x731c=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','limit','apply','reject','save','destroy','then','error','stack','name','send','VoiceMailMessage','fieldName','key','model','differenceBy','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','update','download','recording','msg_id','attachment','.wav\x22','eml-format'];(function(_0x827a9a,_0x33002e){var _0x4648fa=function(_0x4324bf){while(--_0x4324bf){_0x827a9a['push'](_0x827a9a['shift']());}};_0x4648fa(++_0x33002e);}(_0x731c,0xe9));var _0xc731=function(_0x2b931a,_0x4c306d){_0x2b931a=_0x2b931a-0x0;var _0x44eb13=_0x731c[_0x2b931a];return _0x44eb13;};'use strict';var emlformat=require(_0xc731('0x0'));var rimraf=require(_0xc731('0x1'));var zipdir=require(_0xc731('0x2'));var jsonpatch=require(_0xc731('0x3'));var rp=require(_0xc731('0x4'));var moment=require(_0xc731('0x5'));var BPromise=require(_0xc731('0x6'));var Mustache=require(_0xc731('0x7'));var util=require(_0xc731('0x8'));var path=require(_0xc731('0x9'));var sox=require(_0xc731('0xa'));var csv=require(_0xc731('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc731('0xc'));var _=require('lodash');var squel=require(_0xc731('0xd'));var crypto=require(_0xc731('0xe'));var jsforce=require(_0xc731('0xf'));var deskjs=require(_0xc731('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc731('0x11'));var Redis=require('ioredis');var authService=require(_0xc731('0x12'));var qs=require(_0xc731('0x13'));var as=require(_0xc731('0x14'));var hardwareService=require(_0xc731('0x15'));var logger=require(_0xc731('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xc731('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xc731('0x18'))['db'];function respondWithStatusCode(_0xc2e3b2,_0x1b4f5f){_0x1b4f5f=_0x1b4f5f||0xcc;return function(_0x427245){if(_0x427245){return _0xc2e3b2['sendStatus'](_0x1b4f5f);}return _0xc2e3b2[_0xc731('0x19')](_0x1b4f5f)[_0xc731('0x1a')]();};}function respondWithResult(_0x293a9a,_0xb63d83){_0xb63d83=_0xb63d83||0xc8;return function(_0x43da90){if(_0x43da90){return _0x293a9a['status'](_0xb63d83)[_0xc731('0x1b')](_0x43da90);}};}function respondWithFilteredResult(_0x5f06fa,_0x4d38e9){return function(_0x1bcabf){if(_0x1bcabf){var _0x350cd0=typeof _0x4d38e9[_0xc731('0x1c')]===_0xc731('0x1d')&&typeof _0x4d38e9['limit']===_0xc731('0x1d');var _0x1510a5=_0x1bcabf[_0xc731('0x1e')];var _0x126da4=_0x350cd0?0x0:_0x4d38e9[_0xc731('0x1c')];var _0x541a3a=_0x350cd0?_0x1bcabf[_0xc731('0x1e')]:_0x4d38e9['offset']+_0x4d38e9[_0xc731('0x1f')];var _0x4cb31f;if(_0x541a3a>=_0x1510a5){_0x541a3a=_0x1510a5;_0x4cb31f=0xc8;}else{_0x4cb31f=0xce;}_0x5f06fa[_0xc731('0x19')](_0x4cb31f);return _0x5f06fa['set']('Content-Range',_0x126da4+'-'+_0x541a3a+'/'+_0x1510a5)[_0xc731('0x1b')](_0x1bcabf);}return null;};}function patchUpdates(_0x1a1ec9){return function(_0x508875){try{jsonpatch[_0xc731('0x20')](_0x508875,_0x1a1ec9,!![]);}catch(_0x38bd26){return BPromise[_0xc731('0x21')](_0x38bd26);}return _0x508875[_0xc731('0x22')]();};}function saveUpdates(_0x3e9552,_0x2e6508){return function(_0x253f06){if(_0x253f06){return _0x253f06['update'](_0x3e9552)['then'](function(_0xf12437){return _0xf12437;});}return null;};}function removeEntity(_0x2dcee5,_0x4c53ee){return function(_0x3c6c35){if(_0x3c6c35){return _0x3c6c35[_0xc731('0x23')]()[_0xc731('0x24')](function(){_0x2dcee5[_0xc731('0x19')](0xcc)[_0xc731('0x1a')]();});}};}function handleEntityNotFound(_0x10e9c5,_0x33fe64){return function(_0x225335){if(!_0x225335){_0x10e9c5['sendStatus'](0x194);}return _0x225335;};}function handleError(_0x4ebe3b,_0x386075){_0x386075=_0x386075||0x1f4;return function(_0x52aebf){logger[_0xc731('0x25')](_0x52aebf[_0xc731('0x26')]);if(_0x52aebf[_0xc731('0x27')]){delete _0x52aebf[_0xc731('0x27')];}_0x4ebe3b['status'](_0x386075)[_0xc731('0x28')](_0x52aebf);};}exports['index']=function(_0x40e3d3,_0x502c0e){var _0x3d2af8={},_0x53a089={},_0x47d569={'count':0x0,'rows':[]};var _0x547461=_['map'](db[_0xc731('0x29')]['rawAttributes'],function(_0x21bb37){return{'name':_0x21bb37[_0xc731('0x2a')],'type':_0x21bb37['type'][_0xc731('0x2b')]};});_0x53a089[_0xc731('0x2c')]=_[_0xc731('0x2d')](_[_0xc731('0x2e')](_0x547461,_0xc731('0x27')),[_0xc731('0x27')]);_0x53a089[_0xc731('0x2f')]=_['keys'](_0x40e3d3[_0xc731('0x2f')]);_0x53a089[_0xc731('0x30')]=_['intersection'](_0x53a089['model'],_0x53a089['query']);_0x3d2af8[_0xc731('0x31')]=_[_0xc731('0x32')](_0x53a089[_0xc731('0x2c')],qs[_0xc731('0x33')](_0x40e3d3[_0xc731('0x2f')][_0xc731('0x33')]));_0x3d2af8[_0xc731('0x31')]=_0x3d2af8[_0xc731('0x31')][_0xc731('0x34')]?_0x3d2af8[_0xc731('0x31')]:_0x53a089[_0xc731('0x2c')];if(!_0x40e3d3[_0xc731('0x2f')][_0xc731('0x35')](_0xc731('0x36'))){_0x3d2af8['limit']=qs['limit'](_0x40e3d3[_0xc731('0x2f')][_0xc731('0x1f')]);_0x3d2af8[_0xc731('0x1c')]=qs[_0xc731('0x1c')](_0x40e3d3[_0xc731('0x2f')]['offset']);}_0x3d2af8['order']=qs['sort'](_0x40e3d3['query'][_0xc731('0x37')]);_0x3d2af8[_0xc731('0x38')]=qs[_0xc731('0x30')](_['pick'](_0x40e3d3['query'],_0x53a089['filters']),_0x547461);if(_0x40e3d3['query'][_0xc731('0x39')]){_0x3d2af8['where']=_['merge'](_0x3d2af8[_0xc731('0x38')],{'$or':_[_0xc731('0x2e')](_0x547461,function(_0x2649ec){if(_0x2649ec['type']!==_0xc731('0x3a')){var _0x1332c8={};_0x1332c8[_0x2649ec[_0xc731('0x27')]]={'$like':'%'+_0x40e3d3[_0xc731('0x2f')][_0xc731('0x39')]+'%'};return _0x1332c8;}})});}_0x3d2af8=_[_0xc731('0x3b')]({},_0x3d2af8,_0x40e3d3['options']);var _0x1a1cb4={'where':_0x3d2af8[_0xc731('0x38')]};return db[_0xc731('0x29')]['count'](_0x1a1cb4)[_0xc731('0x24')](function(_0x25e8e3){_0x47d569[_0xc731('0x1e')]=_0x25e8e3;if(_0x40e3d3['query'][_0xc731('0x3c')]){_0x3d2af8[_0xc731('0x3d')]=[{'all':!![]}];}return db[_0xc731('0x29')][_0xc731('0x3e')](_0x3d2af8);})['then'](function(_0x2cc80d){_0x47d569[_0xc731('0x3f')]=_0x2cc80d;return _0x47d569;})[_0xc731('0x24')](respondWithFilteredResult(_0x502c0e,_0x3d2af8))[_0xc731('0x40')](handleError(_0x502c0e,null));};exports[_0xc731('0x41')]=function(_0x973b07,_0x3aa39e){var _0xd5ddb3={'raw':!![],'where':{'id':_0x973b07[_0xc731('0x42')]['id']}},_0x1ff4f0={};_0x1ff4f0[_0xc731('0x2c')]=_[_0xc731('0x43')](db['VoiceMailMessage']['rawAttributes']);_0x1ff4f0[_0xc731('0x2f')]=_['keys'](_0x973b07[_0xc731('0x2f')]);_0x1ff4f0[_0xc731('0x30')]=_[_0xc731('0x32')](_0x1ff4f0['model'],_0x1ff4f0[_0xc731('0x2f')]);_0xd5ddb3[_0xc731('0x31')]=_[_0xc731('0x32')](_0x1ff4f0[_0xc731('0x2c')],qs['fields'](_0x973b07['query'][_0xc731('0x33')]));_0xd5ddb3[_0xc731('0x31')]=_0xd5ddb3[_0xc731('0x31')][_0xc731('0x34')]?_0xd5ddb3['attributes']:_0x1ff4f0[_0xc731('0x2c')];if(_0x973b07[_0xc731('0x2f')][_0xc731('0x3c')]){_0xd5ddb3[_0xc731('0x3d')]=[{'all':!![]}];}_0xd5ddb3=_['merge']({},_0xd5ddb3,_0x973b07[_0xc731('0x44')]);return db[_0xc731('0x29')][_0xc731('0x45')](_0xd5ddb3)[_0xc731('0x24')](handleEntityNotFound(_0x3aa39e,null))[_0xc731('0x24')](respondWithResult(_0x3aa39e,null))['catch'](handleError(_0x3aa39e,null));};exports[_0xc731('0x46')]=function(_0x198ff0,_0x5e44d0){return db[_0xc731('0x29')]['create'](_0x198ff0[_0xc731('0x47')],{})[_0xc731('0x24')](respondWithResult(_0x5e44d0,0xc9))[_0xc731('0x40')](handleError(_0x5e44d0,null));};exports[_0xc731('0x48')]=function(_0x52efd7,_0x15a0d6){if(_0x52efd7[_0xc731('0x47')]['id']){delete _0x52efd7['body']['id'];}return db[_0xc731('0x29')][_0xc731('0x45')]({'where':{'id':_0x52efd7[_0xc731('0x42')]['id']}})[_0xc731('0x24')](handleEntityNotFound(_0x15a0d6,null))[_0xc731('0x24')](saveUpdates(_0x52efd7[_0xc731('0x47')],null))[_0xc731('0x24')](respondWithResult(_0x15a0d6,null))[_0xc731('0x40')](handleError(_0x15a0d6,null));};exports[_0xc731('0x23')]=function(_0x8bc003,_0xac51da){return db[_0xc731('0x29')][_0xc731('0x45')]({'where':{'id':_0x8bc003[_0xc731('0x42')]['id']}})[_0xc731('0x24')](handleEntityNotFound(_0xac51da,null))[_0xc731('0x24')](removeEntity(_0xac51da,null))[_0xc731('0x40')](handleError(_0xac51da,null));};exports[_0xc731('0x49')]=function(_0x8dc53c,_0x44d26f,_0x563244){return db[_0xc731('0x29')][_0xc731('0x45')]({'where':{'id':_0x8dc53c[_0xc731('0x42')]['id']},'attributes':['id',_0xc731('0x4a'),_0xc731('0x4b')]})[_0xc731('0x24')](handleEntityNotFound(_0x44d26f,null))['then'](function(_0x27d34f){if(_0x27d34f){if(!_0x27d34f[_0xc731('0x4a')]){throw new db['Sequelize']['ValidationError']('VoiceMailMessage\x20not\x20found');}var _0xc23c7e={'Content-Type':'audio/wav','Content-Disposition':_0xc731('0x4c')};if(_0x27d34f[_0xc731('0x4b')]){_0xc23c7e['Content-Disposition']='attachment;\x20filename=\x22'+_0x27d34f[_0xc731('0x4b')]+_0xc731('0x4d');}_0x44d26f['set'](_0xc23c7e);return _0x44d26f[_0xc731('0x28')](new Buffer(_0x27d34f[_0xc731('0x4a')]));}})[_0xc731('0x40')](handleError(_0x44d26f,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 3c5fa58..29a36d3 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 _0xfbfa=['dir','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages'];(function(_0xee55cd,_0x5145bf){var _0x1ebf67=function(_0x395c07){while(--_0x395c07){_0xee55cd['push'](_0xee55cd['shift']());}};_0x1ebf67(++_0x5145bf);}(_0xfbfa,0x151));var _0xafbf=function(_0x19babd,_0x1d4ef7){_0x19babd=_0x19babd-0x0;var _0x314eaf=_0xfbfa[_0x19babd];return _0x314eaf;};'use strict';var _=require(_0xafbf('0x0'));var util=require('util');var logger=require(_0xafbf('0x1'))(_0xafbf('0x2'));var moment=require(_0xafbf('0x3'));var BPromise=require('bluebird');var rp=require(_0xafbf('0x4'));var fs=require('fs');var path=require(_0xafbf('0x5'));var rimraf=require(_0xafbf('0x6'));var config=require(_0xafbf('0x7'));var attributes=require(_0xafbf('0x8'));module[_0xafbf('0x9')]=function(_0x1f0c86,_0xb2e7af){return _0x1f0c86[_0xafbf('0xa')](_0xafbf('0xb'),attributes,{'tableName':_0xafbf('0xc'),'paranoid':![],'indexes':[{'name':_0xafbf('0xd'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0xae7d=['rimraf','../../config/environment','./voiceMailMessage.attributes','exports','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0xda0909,_0x1e6466){var _0x1bb656=function(_0x3c63b8){while(--_0x3c63b8){_0xda0909['push'](_0xda0909['shift']());}};_0x1bb656(++_0x1e6466);}(_0xae7d,0x1ce));var _0xdae7=function(_0x49355b,_0xf9711e){_0x49355b=_0x49355b-0x0;var _0x1131c3=_0xae7d[_0x49355b];return _0x1131c3;};'use strict';var _=require(_0xdae7('0x0'));var util=require(_0xdae7('0x1'));var logger=require(_0xdae7('0x2'))(_0xdae7('0x3'));var moment=require('moment');var BPromise=require(_0xdae7('0x4'));var rp=require(_0xdae7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdae7('0x6'));var config=require(_0xdae7('0x7'));var attributes=require(_0xdae7('0x8'));module[_0xdae7('0x9')]=function(_0x5ade9e,_0x2766aa){return _0x5ade9e['define'](_0xdae7('0xa'),attributes,{'tableName':_0xdae7('0xb'),'paranoid':![],'indexes':[{'name':_0xdae7('0xc'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index c862347..b067e9c 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 _0xd76a=['message','request\x20sent','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','info','VoiceMailMessage,\x20%s,\x20%s','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','code','error'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xd76a,0xe0));var _0xad76=function(_0x1b5da2,_0x2cc527){_0x1b5da2=_0x1b5da2-0x0;var _0x2b8a77=_0xd76a[_0x1b5da2];return _0x2b8a77;};'use strict';var _=require(_0xad76('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xad76('0x1'));var rs=require(_0xad76('0x2'));var fs=require('fs');var Redis=require(_0xad76('0x3'));var db=require(_0xad76('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xad76('0x5'))(_0xad76('0x6'));var config=require(_0xad76('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xad76('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3b3880,_0x13aafa,_0x1aceef){return new BPromise(function(_0x38550d,_0x2945e2){return client['request'](_0x3b3880,_0x1aceef)['then'](function(_0x2a8ded){logger[_0xad76('0x9')](_0xad76('0xa'),_0x13aafa,'request\x20sent');logger[_0xad76('0xb')](_0xad76('0xc'),_0x13aafa,'request\x20sent',JSON[_0xad76('0xd')](_0x2a8ded));if(_0x2a8ded['error']){if(_0x2a8ded['error'][_0xad76('0xe')]===0x1f4){logger[_0xad76('0xf')](_0xad76('0xa'),_0x13aafa,_0x2a8ded[_0xad76('0xf')]['message']);return _0x2945e2(_0x2a8ded['error'][_0xad76('0x10')]);}logger[_0xad76('0xf')](_0xad76('0xa'),_0x13aafa,_0x2a8ded[_0xad76('0xf')][_0xad76('0x10')]);return _0x38550d(_0x2a8ded[_0xad76('0xf')][_0xad76('0x10')]);}else{logger[_0xad76('0x9')](_0xad76('0xa'),_0x13aafa,_0xad76('0x11'));_0x38550d(_0x2a8ded[_0xad76('0x12')][_0xad76('0x10')]);}})[_0xad76('0x13')](function(_0x1a63f6){logger[_0xad76('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x13aafa,_0x1a63f6);_0x2945e2(_0x1a63f6);});});} \ No newline at end of file +var _0x9ea5=['request','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4ed955,_0x5b2b35){var _0x24bd1b=function(_0x93d4b6){while(--_0x93d4b6){_0x4ed955['push'](_0x4ed955['shift']());}};_0x24bd1b(++_0x5b2b35);}(_0x9ea5,0x180));var _0x59ea=function(_0x310544,_0x12dfe1){_0x310544=_0x310544-0x0;var _0x2670a0=_0x9ea5[_0x310544];return _0x2670a0;};'use strict';var _=require('lodash');var util=require(_0x59ea('0x0'));var moment=require(_0x59ea('0x1'));var BPromise=require(_0x59ea('0x2'));var rs=require(_0x59ea('0x3'));var fs=require('fs');var Redis=require(_0x59ea('0x4'));var db=require(_0x59ea('0x5'))['db'];var utils=require(_0x59ea('0x6'));var logger=require(_0x59ea('0x7'))(_0x59ea('0x8'));var config=require(_0x59ea('0x9'));var jayson=require(_0x59ea('0xa'));var client=jayson[_0x59ea('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x165af1,_0x203e53,_0x31aa55){return new BPromise(function(_0x354647,_0x14f4f0){return client[_0x59ea('0xc')](_0x165af1,_0x31aa55)['then'](function(_0x592d26){logger[_0x59ea('0xd')](_0x59ea('0xe'),_0x203e53,_0x59ea('0xf'));logger['debug'](_0x59ea('0x10'),_0x203e53,_0x59ea('0xf'),JSON[_0x59ea('0x11')](_0x592d26));if(_0x592d26[_0x59ea('0x12')]){if(_0x592d26[_0x59ea('0x12')][_0x59ea('0x13')]===0x1f4){logger[_0x59ea('0x12')](_0x59ea('0xe'),_0x203e53,_0x592d26[_0x59ea('0x12')][_0x59ea('0x14')]);return _0x14f4f0(_0x592d26['error'][_0x59ea('0x14')]);}logger['error'](_0x59ea('0xe'),_0x203e53,_0x592d26[_0x59ea('0x12')][_0x59ea('0x14')]);return _0x354647(_0x592d26[_0x59ea('0x12')][_0x59ea('0x14')]);}else{logger[_0x59ea('0xd')](_0x59ea('0xe'),_0x203e53,_0x59ea('0xf'));_0x354647(_0x592d26[_0x59ea('0x15')][_0x59ea('0x14')]);}})['catch'](function(_0x116aae){logger['error'](_0x59ea('0xe'),_0x203e53,_0x116aae);_0x14f4f0(_0x116aae);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index be9a44e..72aecbe 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 _0x3262=['../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','/:id/sounds','getSounds','post','create','addSound','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x3af8a7,_0x55bd35){var _0x534be6=function(_0x2d08e8){while(--_0x2d08e8){_0x3af8a7['push'](_0x3af8a7['shift']());}};_0x534be6(++_0x55bd35);}(_0x3262,0xde));var _0x2326=function(_0x38441d,_0x12e5f5){_0x38441d=_0x38441d-0x0;var _0x23c0a0=_0x3262[_0x38441d];return _0x23c0a0;};'use strict';var multer=require(_0x2326('0x0'));var util=require(_0x2326('0x1'));var path=require(_0x2326('0x2'));var timeout=require(_0x2326('0x3'));var express=require(_0x2326('0x4'));var router=express[_0x2326('0x5')]();var fs_extra=require(_0x2326('0x6'));var auth=require(_0x2326('0x7'));var interaction=require(_0x2326('0x8'));var config=require(_0x2326('0x9'));var controller=require('./voiceMusicOnHold.controller');router['get']('/',auth[_0x2326('0xa')](),controller['index']);router[_0x2326('0xb')](_0x2326('0xc'),auth[_0x2326('0xa')](),controller[_0x2326('0xd')]);router[_0x2326('0xb')](_0x2326('0xe'),auth[_0x2326('0xa')](),controller[_0x2326('0xf')]);router[_0x2326('0x10')]('/',auth[_0x2326('0xa')](),controller[_0x2326('0x11')]);router[_0x2326('0x10')]('/:id/sounds',auth[_0x2326('0xa')](),controller[_0x2326('0x12')]);router[_0x2326('0x13')](_0x2326('0xc'),auth[_0x2326('0xa')](),controller[_0x2326('0x14')]);router[_0x2326('0x15')](_0x2326('0xc'),auth['isAuthenticated'](),controller['destroy']);router[_0x2326('0x15')]('/:id/sounds/:id2',auth[_0x2326('0xa')](),controller['removeSound']);module[_0x2326('0x16')]=router; \ No newline at end of file +var _0xe053=['post','addSound','put','destroy','delete','/:id/sounds/:id2','removeSound','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','isAuthenticated','index','/:id','/:id/sounds','getSounds'];(function(_0x115dc2,_0x272b45){var _0x58ae32=function(_0x293f57){while(--_0x293f57){_0x115dc2['push'](_0x115dc2['shift']());}};_0x58ae32(++_0x272b45);}(_0xe053,0x1bd));var _0x3e05=function(_0x5ae8f7,_0x330d91){_0x5ae8f7=_0x5ae8f7-0x0;var _0x54c636=_0xe053[_0x5ae8f7];return _0x54c636;};'use strict';var multer=require(_0x3e05('0x0'));var util=require('util');var path=require(_0x3e05('0x1'));var timeout=require(_0x3e05('0x2'));var express=require(_0x3e05('0x3'));var router=express[_0x3e05('0x4')]();var fs_extra=require(_0x3e05('0x5'));var auth=require(_0x3e05('0x6'));var interaction=require(_0x3e05('0x7'));var config=require(_0x3e05('0x8'));var controller=require(_0x3e05('0x9'));router['get']('/',auth[_0x3e05('0xa')](),controller[_0x3e05('0xb')]);router['get'](_0x3e05('0xc'),auth[_0x3e05('0xa')](),controller['show']);router['get'](_0x3e05('0xd'),auth['isAuthenticated'](),controller[_0x3e05('0xe')]);router[_0x3e05('0xf')]('/',auth[_0x3e05('0xa')](),controller['create']);router[_0x3e05('0xf')](_0x3e05('0xd'),auth[_0x3e05('0xa')](),controller[_0x3e05('0x10')]);router[_0x3e05('0x11')]('/:id',auth[_0x3e05('0xa')](),controller['update']);router['delete'](_0x3e05('0xc'),auth['isAuthenticated'](),controller[_0x3e05('0x12')]);router[_0x3e05('0x13')](_0x3e05('0x14'),auth[_0x3e05('0xa')](),controller[_0x3e05('0x15')]);module[_0x3e05('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index cd9bbbd..7bef921 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 _0xcace=['TIMESTAMP','BOOLEAN','sequelize','exports','STRING','name','ENUM','custom','files','quietmp3nb','quietmp3','mp3','alpha'];(function(_0x13b677,_0x441ab5){var _0x120a3d=function(_0x36899d){while(--_0x36899d){_0x13b677['push'](_0x13b677['shift']());}};_0x120a3d(++_0x441ab5);}(_0xcace,0x1d6));var _0xecac=function(_0x222b3f,_0x133be7){_0x222b3f=_0x222b3f-0x0;var _0x20b57a=_0xcace[_0x222b3f];return _0x20b57a;};'use strict';var Sequelize=require(_0xecac('0x0'));module[_0xecac('0x1')]={'name':{'type':Sequelize[_0xecac('0x2')],'allowNull':![],'unique':_0xecac('0x3')},'mode':{'type':Sequelize[_0xecac('0x4')](_0xecac('0x5'),_0xecac('0x6'),'mp3nb',_0xecac('0x7'),_0xecac('0x8'),_0xecac('0x9')),'allowNull':!![],'defaultValue':_0xecac('0x6')},'directory':{'type':Sequelize[_0xecac('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xecac('0x2')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xecac('0xa')},'format':{'type':Sequelize[_0xecac('0x2')],'allowNull':!![]},'stamp':{'type':_0xecac('0xb')},'defaultEntry':{'type':Sequelize[_0xecac('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa651=['sequelize','exports','name','ENUM','custom','mp3nb','quietmp3nb','STRING','TIMESTAMP','BOOLEAN'];(function(_0xfbd911,_0x1eb1ca){var _0x20010a=function(_0x5f0f6e){while(--_0x5f0f6e){_0xfbd911['push'](_0xfbd911['shift']());}};_0x20010a(++_0x1eb1ca);}(_0xa651,0xd2));var _0x1a65=function(_0x5162ed,_0x386cb7){_0x5162ed=_0x5162ed-0x0;var _0x4c579b=_0xa651[_0x5162ed];return _0x4c579b;};'use strict';var Sequelize=require(_0x1a65('0x0'));module[_0x1a65('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x1a65('0x2')},'mode':{'type':Sequelize[_0x1a65('0x3')](_0x1a65('0x4'),'files',_0x1a65('0x5'),_0x1a65('0x6'),'quietmp3','mp3'),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x1a65('0x7')],'allowNull':!![]},'sort':{'type':Sequelize[_0x1a65('0x7')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x1a65('0x8')},'defaultEntry':{'type':Sequelize[_0x1a65('0x9')],'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 5a5e1d8..445959f 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 _0xafed=['pick','filter','where','merge','VIRTUAL','includeAll','include','VoiceMusicOnHold','rows','catch','show','find','body','params','create','sequelize','transaction','mode','files','directory','join','root','server/files/moh','mkdirSync','0777','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','addSound','Sound','findOne','converted_format','createdAt','server/files/sounds/converted','basename','save_name','extname','format','%s.%s','symlinkSync','Sequelize','ValidationError','message','removeSound','id2','keys','options','getSounds','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','get','MusicOnHolds','UserProfileResource','then','end','send','index','map','rawAttributes','fieldName','type','key','name','query','filters','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','order','sort'];(function(_0x1c207a,_0x3d83fd){var _0x7f85cc=function(_0x3799bd){while(--_0x3799bd){_0x1c207a['push'](_0x1c207a['shift']());}};_0x7f85cc(++_0x3d83fd);}(_0xafed,0x11e));var _0xdafe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xafed[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xdafe('0x0'));var rimraf=require(_0xdafe('0x1'));var zipdir=require(_0xdafe('0x2'));var jsonpatch=require(_0xdafe('0x3'));var rp=require(_0xdafe('0x4'));var moment=require(_0xdafe('0x5'));var BPromise=require(_0xdafe('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xdafe('0x7'));var sox=require(_0xdafe('0x8'));var csv=require(_0xdafe('0x9'));var ejs=require(_0xdafe('0xa'));var fs=require('fs');var fs_extra=require(_0xdafe('0xb'));var _=require(_0xdafe('0xc'));var squel=require(_0xdafe('0xd'));var crypto=require(_0xdafe('0xe'));var jsforce=require(_0xdafe('0xf'));var deskjs=require(_0xdafe('0x10'));var toCsv=require(_0xdafe('0x9'));var querystring=require(_0xdafe('0x11'));var Papa=require('papaparse');var Redis=require(_0xdafe('0x12'));var authService=require(_0xdafe('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xdafe('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xdafe('0x15'));var utils=require('../../config/utils');var config=require(_0xdafe('0x16'));var licenseUtil=require(_0xdafe('0x17'));var db=require(_0xdafe('0x18'))['db'];function respondWithStatusCode(_0x37fc4c,_0x10ff8a){_0x10ff8a=_0x10ff8a||0xcc;return function(_0x2adc5f){if(_0x2adc5f){return _0x37fc4c[_0xdafe('0x19')](_0x10ff8a);}return _0x37fc4c[_0xdafe('0x1a')](_0x10ff8a)['end']();};}function respondWithResult(_0x3907ba,_0x352636){_0x352636=_0x352636||0xc8;return function(_0x15aef5){if(_0x15aef5){return _0x3907ba[_0xdafe('0x1a')](_0x352636)[_0xdafe('0x1b')](_0x15aef5);}};}function respondWithFilteredResult(_0x116327,_0x428f70){return function(_0x13deea){if(_0x13deea){var _0x4fcc66=typeof _0x428f70[_0xdafe('0x1c')]===_0xdafe('0x1d')&&typeof _0x428f70[_0xdafe('0x1e')]==='undefined';var _0x64da90=_0x13deea[_0xdafe('0x1f')];var _0x53ef16=_0x4fcc66?0x0:_0x428f70[_0xdafe('0x1c')];var _0x14e5bd=_0x4fcc66?_0x13deea[_0xdafe('0x1f')]:_0x428f70[_0xdafe('0x1c')]+_0x428f70[_0xdafe('0x1e')];var _0x411313;if(_0x14e5bd>=_0x64da90){_0x14e5bd=_0x64da90;_0x411313=0xc8;}else{_0x411313=0xce;}_0x116327['status'](_0x411313);return _0x116327[_0xdafe('0x20')](_0xdafe('0x21'),_0x53ef16+'-'+_0x14e5bd+'/'+_0x64da90)['json'](_0x13deea);}return null;};}function patchUpdates(_0x37629f){return function(_0x2b175b){try{jsonpatch[_0xdafe('0x22')](_0x2b175b,_0x37629f,!![]);}catch(_0x31849b){return BPromise['reject'](_0x31849b);}return _0x2b175b[_0xdafe('0x23')]();};}function saveUpdates(_0x3aa794,_0x13dca5){return function(_0x930d87){if(_0x930d87){return _0x930d87[_0xdafe('0x24')](_0x3aa794)['then'](function(_0x2068df){return _0x2068df;});}return null;};}function removeEntity(_0x4c9754,_0x3fe7bd){return function(_0x32b71c){if(_0x32b71c){return _0x32b71c[_0xdafe('0x25')]()['then'](function(){var _0x27118b=_0x32b71c[_0xdafe('0x26')]({'plain':!![]});var _0x30e542=_0xdafe('0x27');return db[_0xdafe('0x28')][_0xdafe('0x25')]({'where':{'type':_0x30e542,'resourceId':_0x27118b['id']}})[_0xdafe('0x29')](function(){return _0x32b71c;});})[_0xdafe('0x29')](function(){_0x4c9754[_0xdafe('0x1a')](0xcc)[_0xdafe('0x2a')]();});}};}function handleEntityNotFound(_0x420da1,_0x5264c5){return function(_0x5edf08){if(!_0x5edf08){_0x420da1[_0xdafe('0x19')](0x194);}return _0x5edf08;};}function handleError(_0x117304,_0x529355){_0x529355=_0x529355||0x1f4;return function(_0x12edad){logger['error'](_0x12edad['stack']);if(_0x12edad['name']){delete _0x12edad['name'];}_0x117304['status'](_0x529355)[_0xdafe('0x2b')](_0x12edad);};}exports[_0xdafe('0x2c')]=function(_0x25f2d4,_0x23e71e){var _0x5dfcb9={},_0x402671={},_0x4be967={'count':0x0,'rows':[]};var _0xdea73e=_[_0xdafe('0x2d')](db['VoiceMusicOnHold'][_0xdafe('0x2e')],function(_0x2ced25){return{'name':_0x2ced25[_0xdafe('0x2f')],'type':_0x2ced25[_0xdafe('0x30')][_0xdafe('0x31')]};});_0x402671['model']=_['map'](_0xdea73e,_0xdafe('0x32'));_0x402671[_0xdafe('0x33')]=_['keys'](_0x25f2d4[_0xdafe('0x33')]);_0x402671[_0xdafe('0x34')]=_['intersection'](_0x402671['model'],_0x402671[_0xdafe('0x33')]);_0x5dfcb9['attributes']=_[_0xdafe('0x35')](_0x402671['model'],qs[_0xdafe('0x36')](_0x25f2d4[_0xdafe('0x33')]['fields']));_0x5dfcb9[_0xdafe('0x37')]=_0x5dfcb9[_0xdafe('0x37')][_0xdafe('0x38')]?_0x5dfcb9[_0xdafe('0x37')]:_0x402671[_0xdafe('0x39')];if(!_0x25f2d4[_0xdafe('0x33')][_0xdafe('0x3a')](_0xdafe('0x3b'))){_0x5dfcb9[_0xdafe('0x1e')]=qs[_0xdafe('0x1e')](_0x25f2d4[_0xdafe('0x33')][_0xdafe('0x1e')]);_0x5dfcb9[_0xdafe('0x1c')]=qs[_0xdafe('0x1c')](_0x25f2d4[_0xdafe('0x33')]['offset']);}_0x5dfcb9[_0xdafe('0x3c')]=qs[_0xdafe('0x3d')](_0x25f2d4[_0xdafe('0x33')][_0xdafe('0x3d')]);delete _0x25f2d4['query']['sort'];_0x5dfcb9['where']=qs[_0xdafe('0x34')](_[_0xdafe('0x3e')](_0x25f2d4['query'],_0x402671[_0xdafe('0x34')]),_0xdea73e);if(_0x25f2d4[_0xdafe('0x33')][_0xdafe('0x3f')]){_0x5dfcb9[_0xdafe('0x40')]=_[_0xdafe('0x41')](_0x5dfcb9[_0xdafe('0x40')],{'$or':_[_0xdafe('0x2d')](_0xdea73e,function(_0x41d87c){if(_0x41d87c[_0xdafe('0x30')]!==_0xdafe('0x42')){var _0x1186aa={};_0x1186aa[_0x41d87c[_0xdafe('0x32')]]={'$like':'%'+_0x25f2d4[_0xdafe('0x33')]['filter']+'%'};return _0x1186aa;}})});}_0x5dfcb9=_[_0xdafe('0x41')]({},_0x5dfcb9,_0x25f2d4['options']);var _0x40d76a={'where':_0x5dfcb9[_0xdafe('0x40')]};return db['VoiceMusicOnHold'][_0xdafe('0x1f')](_0x40d76a)[_0xdafe('0x29')](function(_0xe155e0){_0x4be967['count']=_0xe155e0;if(_0x25f2d4[_0xdafe('0x33')][_0xdafe('0x43')]){_0x5dfcb9[_0xdafe('0x44')]=[{'all':!![]}];}return db[_0xdafe('0x45')]['findAll'](_0x5dfcb9);})[_0xdafe('0x29')](function(_0x1b8349){_0x4be967[_0xdafe('0x46')]=_0x1b8349;return _0x4be967;})[_0xdafe('0x29')](respondWithFilteredResult(_0x23e71e,_0x5dfcb9))[_0xdafe('0x47')](handleError(_0x23e71e,null));};exports[_0xdafe('0x48')]=function(_0x36ee17,_0x5af7ed){var _0x41c053={'raw':![],'where':{'id':_0x36ee17['params']['id']}},_0x1d5758={};_0x1d5758['model']=_['keys'](db[_0xdafe('0x45')][_0xdafe('0x2e')]);_0x1d5758[_0xdafe('0x33')]=_['keys'](_0x36ee17[_0xdafe('0x33')]);_0x1d5758[_0xdafe('0x34')]=_[_0xdafe('0x35')](_0x1d5758[_0xdafe('0x39')],_0x1d5758['query']);_0x41c053[_0xdafe('0x37')]=_[_0xdafe('0x35')](_0x1d5758[_0xdafe('0x39')],qs['fields'](_0x36ee17[_0xdafe('0x33')]['fields']));_0x41c053[_0xdafe('0x37')]=_0x41c053[_0xdafe('0x37')][_0xdafe('0x38')]?_0x41c053[_0xdafe('0x37')]:_0x1d5758[_0xdafe('0x39')];if(_0x36ee17[_0xdafe('0x33')][_0xdafe('0x43')]){_0x41c053[_0xdafe('0x44')]=[{'all':!![]}];}_0x41c053=_[_0xdafe('0x41')]({},_0x41c053,_0x36ee17['options']);return db[_0xdafe('0x45')][_0xdafe('0x49')](_0x41c053)['then'](handleEntityNotFound(_0x5af7ed,null))[_0xdafe('0x29')](respondWithResult(_0x5af7ed,null))[_0xdafe('0x47')](handleError(_0x5af7ed,null));};exports[_0xdafe('0x24')]=function(_0xe2e20,_0x471796){if(_0xe2e20[_0xdafe('0x4a')]['id']){delete _0xe2e20[_0xdafe('0x4a')]['id'];}return db[_0xdafe('0x45')][_0xdafe('0x49')]({'where':{'id':_0xe2e20[_0xdafe('0x4b')]['id']}})[_0xdafe('0x29')](handleEntityNotFound(_0x471796,null))[_0xdafe('0x29')](saveUpdates(_0xe2e20[_0xdafe('0x4a')],null))['then'](respondWithResult(_0x471796,null))[_0xdafe('0x47')](handleError(_0x471796,null));};exports[_0xdafe('0x4c')]=function(_0x3157f8,_0x25e799,_0x3b4406){return db[_0xdafe('0x4d')][_0xdafe('0x4e')](function(_0x4cdbe8){if(_0x3157f8['body'][_0xdafe('0x4f')]===_0xdafe('0x50')){_0x3157f8[_0xdafe('0x4a')][_0xdafe('0x51')]=path[_0xdafe('0x52')](config[_0xdafe('0x53')],_0xdafe('0x54'),_0x3157f8[_0xdafe('0x4a')][_0xdafe('0x32')]);}return db[_0xdafe('0x45')]['create'](_0x3157f8[_0xdafe('0x4a')],{'transaction':_0x4cdbe8})['then'](function(_0x2a838a){if(_0x3157f8[_0xdafe('0x4a')][_0xdafe('0x4f')]===_0xdafe('0x50')){fs[_0xdafe('0x55')](_0x2a838a[_0xdafe('0x51')],parseInt(_0xdafe('0x56'),0x8));}var _0x53ad15=_0x3157f8[_0xdafe('0x57')][_0xdafe('0x26')]({'plain':!![]});if(!_0x53ad15)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x53ad15[_0xdafe('0x58')]===_0xdafe('0x57')){var _0x4e72da=_0x2a838a[_0xdafe('0x26')]({'plain':!![]});return db[_0xdafe('0x59')][_0xdafe('0x49')]({'where':{'name':_0xdafe('0x27'),'userProfileId':_0x53ad15['userProfileId']},'raw':!![]})[_0xdafe('0x29')](function(_0x561aa8){if(_0x561aa8&&_0x561aa8[_0xdafe('0x5a')]===0x0){return db['UserProfileResource'][_0xdafe('0x4c')]({'name':_0x4e72da['name'],'resourceId':_0x4e72da['id'],'type':_0x561aa8['name'],'sectionId':_0x561aa8['id']},{})[_0xdafe('0x29')](function(){return _0x2a838a;});}else{return _0x2a838a;}})[_0xdafe('0x47')](function(_0x747d8e){logger['error'](_0xdafe('0x5b'),_0x747d8e);});}return _0x2a838a;});})[_0xdafe('0x29')](respondWithResult(_0x25e799,0xc9))[_0xdafe('0x47')](handleError(_0x25e799,null));};exports[_0xdafe('0x25')]=function(_0x3e0c53,_0x13218e,_0x1514b1){var _0x2c6134;return db[_0xdafe('0x45')][_0xdafe('0x49')]({'where':{'id':_0x3e0c53[_0xdafe('0x4b')]['id']}})[_0xdafe('0x29')](function(_0x244018){if(_0x244018){return db['sequelize']['transaction'](function(_0xa9629d){return _0x244018[_0xdafe('0x25')]({'transaction':_0xa9629d,'raw':!![]})[_0xdafe('0x29')](function(_0x3d4053){if(_0x3d4053[_0xdafe('0x51')]){fs[_0xdafe('0x5c')](_0x3d4053[_0xdafe('0x51')])[_0xdafe('0x5d')](function(_0x3373ac){fs[_0xdafe('0x5e')](path[_0xdafe('0x52')](_0x3d4053[_0xdafe('0x51')],_0x3373ac));});fs[_0xdafe('0x5f')](_0x3d4053[_0xdafe('0x51')]);}return _0x3d4053;});})[_0xdafe('0x47')](function(_0x1a0f23){throw new db['Sequelize']['ValidationError'](_0x1a0f23['message']);});}})[_0xdafe('0x29')](handleEntityNotFound(_0x13218e,null))[_0xdafe('0x29')](removeEntity(_0x13218e,null))[_0xdafe('0x47')](handleError(_0x13218e,null));};exports[_0xdafe('0x60')]=function(_0x185cc7,_0x3af076,_0x53cb02){return db['sequelize'][_0xdafe('0x4e')](function(_0x39a350){var _0x3d7e08;return db[_0xdafe('0x45')][_0xdafe('0x49')]({'where':{'id':_0x185cc7[_0xdafe('0x4b')]['id']}})[_0xdafe('0x29')](function(_0x38d9bf){if(_0x38d9bf){_0x3d7e08=_0x38d9bf;return _0x38d9bf[_0xdafe('0x60')](_0x185cc7[_0xdafe('0x4a')]['id'],{'transaction':_0x39a350});}})[_0xdafe('0x29')](function(_0x59d556){if(_0x59d556){return db[_0xdafe('0x61')][_0xdafe('0x62')]({'where':{'id':_0x185cc7[_0xdafe('0x4a')]['id']},'attributes':['id',_0xdafe('0x32'),'save_name',_0xdafe('0x63'),_0xdafe('0x64')],'raw':!![]});}})[_0xdafe('0x29')](function(_0x42a3f8){if(_0x42a3f8){var _0x3b6caf=path[_0xdafe('0x52')](config[_0xdafe('0x53')],_0xdafe('0x65'),util['format']('%s.%s',path[_0xdafe('0x66')](_0x42a3f8[_0xdafe('0x67')],path[_0xdafe('0x68')](_0x42a3f8[_0xdafe('0x67')])),_0x42a3f8['converted_format']));var _0x1dadfc=path['join'](config[_0xdafe('0x53')],_0xdafe('0x54'),_0x3d7e08[_0xdafe('0x32')],util[_0xdafe('0x69')](_0xdafe('0x6a'),_0x42a3f8[_0xdafe('0x32')],_0x42a3f8['converted_format']));fs[_0xdafe('0x6b')](_0x3b6caf,_0x1dadfc);return _0x42a3f8;}})[_0xdafe('0x47')](function(_0x201bb4){throw new db[(_0xdafe('0x6c'))][(_0xdafe('0x6d'))](_0x201bb4[_0xdafe('0x6e')]);});})[_0xdafe('0x29')](handleEntityNotFound(_0x3af076,null))[_0xdafe('0x29')](respondWithResult(_0x3af076,0xc9))['catch'](handleError(_0x3af076,null));};exports[_0xdafe('0x6f')]=function(_0x24f550,_0x5bdacd,_0xe26db){return db[_0xdafe('0x4d')][_0xdafe('0x4e')](function(_0x4650d6){var _0x357e06;return db['VoiceMusicOnHold'][_0xdafe('0x62')]({'where':{'id':_0x24f550[_0xdafe('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5bdacd,null))[_0xdafe('0x29')](function(_0x3b1011){if(_0x3b1011){_0x357e06=_0x3b1011;return _0x3b1011['removeSound'](_0x24f550[_0xdafe('0x4b')][_0xdafe('0x70')]);}})[_0xdafe('0x29')](function(_0x620a44){if(_0x620a44){return db['Sound'][_0xdafe('0x62')]({'where':{'id':_0x24f550[_0xdafe('0x4b')][_0xdafe('0x70')]},'attributes':['id',_0xdafe('0x32'),_0xdafe('0x67'),'converted_format',_0xdafe('0x64')],'raw':!![]});}})[_0xdafe('0x29')](function(_0x3dd2aa){if(_0x3dd2aa){fs['unlinkSync'](path['join'](_0x357e06[_0xdafe('0x51')],util[_0xdafe('0x69')](_0xdafe('0x6a'),_0x3dd2aa[_0xdafe('0x32')],_0x3dd2aa['converted_format'])));return _0x3dd2aa;}})['catch'](function(_0x2ecf47){throw new db[(_0xdafe('0x6c'))][(_0xdafe('0x6d'))](_0x2ecf47[_0xdafe('0x6e')]);});})[_0xdafe('0x29')](handleEntityNotFound(_0x5bdacd,null))[_0xdafe('0x29')](respondWithStatusCode(_0x5bdacd,0xcc))[_0xdafe('0x47')](handleError(_0x5bdacd,null));};exports['getSounds']=function(_0xa9a700,_0x524ee7,_0x55886f){var _0x1ea44c={};var _0x198323={};var _0x534f68;var _0x174ac2;return db[_0xdafe('0x45')][_0xdafe('0x62')]({'where':{'id':_0xa9a700[_0xdafe('0x4b')]['id']}})[_0xdafe('0x29')](handleEntityNotFound(_0x524ee7,null))['then'](function(_0x10d2bd){if(_0x10d2bd){_0x534f68=_0x10d2bd;_0x198323[_0xdafe('0x39')]=_[_0xdafe('0x71')](db[_0xdafe('0x61')][_0xdafe('0x2e')]);_0x198323[_0xdafe('0x33')]=_[_0xdafe('0x71')](_0xa9a700['query']);_0x198323[_0xdafe('0x34')]=_[_0xdafe('0x35')](_0x198323[_0xdafe('0x39')],_0x198323[_0xdafe('0x33')]);_0x1ea44c[_0xdafe('0x37')]=_[_0xdafe('0x35')](_0x198323['model'],qs[_0xdafe('0x36')](_0xa9a700[_0xdafe('0x33')]['fields']));_0x1ea44c[_0xdafe('0x37')]=_0x1ea44c[_0xdafe('0x37')]['length']?_0x1ea44c['attributes']:_0x198323[_0xdafe('0x39')];_0x1ea44c['order']=qs[_0xdafe('0x3d')](_0xa9a700[_0xdafe('0x33')]['sort']);_0x1ea44c[_0xdafe('0x40')]=qs[_0xdafe('0x34')](_[_0xdafe('0x3e')](_0xa9a700['query'],_0x198323['filters']));if(_0xa9a700['query']['filter']){_0x1ea44c[_0xdafe('0x40')]=_['merge'](_0x1ea44c[_0xdafe('0x40')],{'$or':_[_0xdafe('0x2d')](_0x1ea44c[_0xdafe('0x37')],function(_0x382f8b){var _0x32e412={};_0x32e412[_0x382f8b]={'$like':'%'+_0xa9a700['query'][_0xdafe('0x3f')]+'%'};return _0x32e412;})});}_0x1ea44c=_[_0xdafe('0x41')]({},_0x1ea44c,_0xa9a700[_0xdafe('0x72')]);return _0x534f68[_0xdafe('0x73')](_0x1ea44c);}})['then'](function(_0x58f015){if(_0x58f015){_0x174ac2=_0x58f015[_0xdafe('0x38')];if(!_0xa9a700[_0xdafe('0x33')][_0xdafe('0x3a')](_0xdafe('0x3b'))){_0x1ea44c[_0xdafe('0x1e')]=qs[_0xdafe('0x1e')](_0xa9a700[_0xdafe('0x33')]['limit']);_0x1ea44c[_0xdafe('0x1c')]=qs['offset'](_0xa9a700[_0xdafe('0x33')]['offset']);}return _0x534f68[_0xdafe('0x73')](_0x1ea44c);}})['then'](function(_0x2e0369){if(_0x2e0369){return _0x2e0369?{'count':_0x174ac2,'rows':_0x2e0369}:null;}})[_0xdafe('0x29')](respondWithResult(_0x524ee7,null))[_0xdafe('0x47')](handleError(_0x524ee7,null));}; \ No newline at end of file +var _0x5008=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','stack','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','name','keys','filters','intersection','attributes','model','query','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','params','options','body','find','create','sequelize','mode','files','root','server/files/moh','directory','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','transaction','readdirSync','forEach','unlinkSync','join','rmdirSync','message','addSound','Sound','findOne','save_name','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','converted_format','symlinkSync','Sequelize','removeSound','id2','getSounds','sort','eml-format'];(function(_0x57d8b8,_0x4811e2){var _0x1ab181=function(_0x489663){while(--_0x489663){_0x57d8b8['push'](_0x57d8b8['shift']());}};_0x1ab181(++_0x4811e2);}(_0x5008,0x75));var _0x8500=function(_0x1b5aea,_0x1afe6f){_0x1b5aea=_0x1b5aea-0x0;var _0x51cae9=_0x5008[_0x1b5aea];return _0x51cae9;};'use strict';var emlformat=require(_0x8500('0x0'));var rimraf=require(_0x8500('0x1'));var zipdir=require(_0x8500('0x2'));var jsonpatch=require(_0x8500('0x3'));var rp=require(_0x8500('0x4'));var moment=require(_0x8500('0x5'));var BPromise=require(_0x8500('0x6'));var Mustache=require(_0x8500('0x7'));var util=require(_0x8500('0x8'));var path=require(_0x8500('0x9'));var sox=require(_0x8500('0xa'));var csv=require('to-csv');var ejs=require(_0x8500('0xb'));var fs=require('fs');var fs_extra=require(_0x8500('0xc'));var _=require(_0x8500('0xd'));var squel=require(_0x8500('0xe'));var crypto=require(_0x8500('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x8500('0x10'));var toCsv=require('to-csv');var querystring=require(_0x8500('0x11'));var Papa=require(_0x8500('0x12'));var Redis=require(_0x8500('0x13'));var authService=require(_0x8500('0x14'));var qs=require(_0x8500('0x15'));var as=require(_0x8500('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8500('0x17'))(_0x8500('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8500('0x19'))['db'];function respondWithStatusCode(_0x356309,_0x96c061){_0x96c061=_0x96c061||0xcc;return function(_0x2c5acf){if(_0x2c5acf){return _0x356309[_0x8500('0x1a')](_0x96c061);}return _0x356309[_0x8500('0x1b')](_0x96c061)[_0x8500('0x1c')]();};}function respondWithResult(_0x45730a,_0x3192e7){_0x3192e7=_0x3192e7||0xc8;return function(_0x3615e0){if(_0x3615e0){return _0x45730a[_0x8500('0x1b')](_0x3192e7)['json'](_0x3615e0);}};}function respondWithFilteredResult(_0x17d693,_0x42d913){return function(_0x57e348){if(_0x57e348){var _0x2ea741=typeof _0x42d913[_0x8500('0x1d')]===_0x8500('0x1e')&&typeof _0x42d913[_0x8500('0x1f')]===_0x8500('0x1e');var _0x4e6d93=_0x57e348['count'];var _0x4fdb60=_0x2ea741?0x0:_0x42d913[_0x8500('0x1d')];var _0x4e6cee=_0x2ea741?_0x57e348[_0x8500('0x20')]:_0x42d913['offset']+_0x42d913['limit'];var _0x155db8;if(_0x4e6cee>=_0x4e6d93){_0x4e6cee=_0x4e6d93;_0x155db8=0xc8;}else{_0x155db8=0xce;}_0x17d693[_0x8500('0x1b')](_0x155db8);return _0x17d693[_0x8500('0x21')](_0x8500('0x22'),_0x4fdb60+'-'+_0x4e6cee+'/'+_0x4e6d93)[_0x8500('0x23')](_0x57e348);}return null;};}function patchUpdates(_0x27e0c8){return function(_0x168332){try{jsonpatch[_0x8500('0x24')](_0x168332,_0x27e0c8,!![]);}catch(_0x463a11){return BPromise[_0x8500('0x25')](_0x463a11);}return _0x168332[_0x8500('0x26')]();};}function saveUpdates(_0x16dcc7,_0x3da1fe){return function(_0x1fa88e){if(_0x1fa88e){return _0x1fa88e[_0x8500('0x27')](_0x16dcc7)[_0x8500('0x28')](function(_0x578606){return _0x578606;});}return null;};}function removeEntity(_0x1ef6a9,_0x530932){return function(_0x22a203){if(_0x22a203){return _0x22a203[_0x8500('0x29')]()[_0x8500('0x28')](function(){var _0x169ed3=_0x22a203[_0x8500('0x2a')]({'plain':!![]});var _0x2bb773=_0x8500('0x2b');return db[_0x8500('0x2c')][_0x8500('0x29')]({'where':{'type':_0x2bb773,'resourceId':_0x169ed3['id']}})['then'](function(){return _0x22a203;});})['then'](function(){_0x1ef6a9[_0x8500('0x1b')](0xcc)[_0x8500('0x1c')]();});}};}function handleEntityNotFound(_0x79623c,_0x2c8832){return function(_0xf03a85){if(!_0xf03a85){_0x79623c['sendStatus'](0x194);}return _0xf03a85;};}function handleError(_0x55e09b,_0x1cdf07){_0x1cdf07=_0x1cdf07||0x1f4;return function(_0x3f025b){logger['error'](_0x3f025b[_0x8500('0x2d')]);if(_0x3f025b['name']){delete _0x3f025b['name'];}_0x55e09b[_0x8500('0x1b')](_0x1cdf07)[_0x8500('0x2e')](_0x3f025b);};}exports[_0x8500('0x2f')]=function(_0x2e4b45,_0x3ff9ee){var _0x784069={},_0x1ef31d={},_0x5358c3={'count':0x0,'rows':[]};var _0x210a94=_[_0x8500('0x30')](db[_0x8500('0x31')][_0x8500('0x32')],function(_0x6bb8ff){return{'name':_0x6bb8ff[_0x8500('0x33')],'type':_0x6bb8ff[_0x8500('0x34')][_0x8500('0x35')]};});_0x1ef31d['model']=_[_0x8500('0x30')](_0x210a94,_0x8500('0x36'));_0x1ef31d['query']=_[_0x8500('0x37')](_0x2e4b45['query']);_0x1ef31d[_0x8500('0x38')]=_[_0x8500('0x39')](_0x1ef31d['model'],_0x1ef31d['query']);_0x784069[_0x8500('0x3a')]=_[_0x8500('0x39')](_0x1ef31d[_0x8500('0x3b')],qs['fields'](_0x2e4b45[_0x8500('0x3c')][_0x8500('0x3d')]));_0x784069['attributes']=_0x784069[_0x8500('0x3a')][_0x8500('0x3e')]?_0x784069[_0x8500('0x3a')]:_0x1ef31d[_0x8500('0x3b')];if(!_0x2e4b45[_0x8500('0x3c')][_0x8500('0x3f')](_0x8500('0x40'))){_0x784069[_0x8500('0x1f')]=qs['limit'](_0x2e4b45['query']['limit']);_0x784069[_0x8500('0x1d')]=qs[_0x8500('0x1d')](_0x2e4b45[_0x8500('0x3c')]['offset']);}_0x784069[_0x8500('0x41')]=qs['sort'](_0x2e4b45[_0x8500('0x3c')]['sort']);delete _0x2e4b45[_0x8500('0x3c')]['sort'];_0x784069[_0x8500('0x42')]=qs['filters'](_[_0x8500('0x43')](_0x2e4b45[_0x8500('0x3c')],_0x1ef31d['filters']),_0x210a94);if(_0x2e4b45[_0x8500('0x3c')][_0x8500('0x44')]){_0x784069[_0x8500('0x42')]=_['merge'](_0x784069['where'],{'$or':_[_0x8500('0x30')](_0x210a94,function(_0x492a1d){if(_0x492a1d[_0x8500('0x34')]!==_0x8500('0x45')){var _0x360f8e={};_0x360f8e[_0x492a1d['name']]={'$like':'%'+_0x2e4b45[_0x8500('0x3c')][_0x8500('0x44')]+'%'};return _0x360f8e;}})});}_0x784069=_[_0x8500('0x46')]({},_0x784069,_0x2e4b45['options']);var _0xa866c6={'where':_0x784069[_0x8500('0x42')]};return db[_0x8500('0x31')][_0x8500('0x20')](_0xa866c6)[_0x8500('0x28')](function(_0x336f8b){_0x5358c3[_0x8500('0x20')]=_0x336f8b;if(_0x2e4b45[_0x8500('0x3c')][_0x8500('0x47')]){_0x784069[_0x8500('0x48')]=[{'all':!![]}];}return db[_0x8500('0x31')][_0x8500('0x49')](_0x784069);})[_0x8500('0x28')](function(_0x4f2cd2){_0x5358c3[_0x8500('0x4a')]=_0x4f2cd2;return _0x5358c3;})[_0x8500('0x28')](respondWithFilteredResult(_0x3ff9ee,_0x784069))[_0x8500('0x4b')](handleError(_0x3ff9ee,null));};exports['show']=function(_0x4b1e9e,_0x269f76){var _0x6ea7f1={'raw':![],'where':{'id':_0x4b1e9e[_0x8500('0x4c')]['id']}},_0x1b685c={};_0x1b685c[_0x8500('0x3b')]=_[_0x8500('0x37')](db['VoiceMusicOnHold']['rawAttributes']);_0x1b685c[_0x8500('0x3c')]=_[_0x8500('0x37')](_0x4b1e9e['query']);_0x1b685c[_0x8500('0x38')]=_[_0x8500('0x39')](_0x1b685c[_0x8500('0x3b')],_0x1b685c[_0x8500('0x3c')]);_0x6ea7f1[_0x8500('0x3a')]=_[_0x8500('0x39')](_0x1b685c['model'],qs[_0x8500('0x3d')](_0x4b1e9e['query'][_0x8500('0x3d')]));_0x6ea7f1['attributes']=_0x6ea7f1[_0x8500('0x3a')]['length']?_0x6ea7f1[_0x8500('0x3a')]:_0x1b685c['model'];if(_0x4b1e9e[_0x8500('0x3c')][_0x8500('0x47')]){_0x6ea7f1[_0x8500('0x48')]=[{'all':!![]}];}_0x6ea7f1=_[_0x8500('0x46')]({},_0x6ea7f1,_0x4b1e9e[_0x8500('0x4d')]);return db[_0x8500('0x31')]['find'](_0x6ea7f1)[_0x8500('0x28')](handleEntityNotFound(_0x269f76,null))[_0x8500('0x28')](respondWithResult(_0x269f76,null))[_0x8500('0x4b')](handleError(_0x269f76,null));};exports[_0x8500('0x27')]=function(_0x52e094,_0x2c9472){if(_0x52e094[_0x8500('0x4e')]['id']){delete _0x52e094['body']['id'];}return db[_0x8500('0x31')][_0x8500('0x4f')]({'where':{'id':_0x52e094[_0x8500('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2c9472,null))[_0x8500('0x28')](saveUpdates(_0x52e094[_0x8500('0x4e')],null))[_0x8500('0x28')](respondWithResult(_0x2c9472,null))[_0x8500('0x4b')](handleError(_0x2c9472,null));};exports[_0x8500('0x50')]=function(_0x341b43,_0x3eff40,_0x43d9e2){return db[_0x8500('0x51')]['transaction'](function(_0x51c86a){if(_0x341b43['body'][_0x8500('0x52')]===_0x8500('0x53')){_0x341b43[_0x8500('0x4e')]['directory']=path['join'](config[_0x8500('0x54')],_0x8500('0x55'),_0x341b43[_0x8500('0x4e')][_0x8500('0x36')]);}return db[_0x8500('0x31')]['create'](_0x341b43[_0x8500('0x4e')],{'transaction':_0x51c86a})[_0x8500('0x28')](function(_0x4d2c16){if(_0x341b43[_0x8500('0x4e')][_0x8500('0x52')]===_0x8500('0x53')){fs['mkdirSync'](_0x4d2c16[_0x8500('0x56')],parseInt(_0x8500('0x57'),0x8));}var _0x23c485=_0x341b43[_0x8500('0x58')][_0x8500('0x2a')]({'plain':!![]});if(!_0x23c485)throw new Error(_0x8500('0x59'));if(_0x23c485[_0x8500('0x5a')]===_0x8500('0x58')){var _0x18e737=_0x4d2c16[_0x8500('0x2a')]({'plain':!![]});return db[_0x8500('0x5b')]['find']({'where':{'name':_0x8500('0x2b'),'userProfileId':_0x23c485['userProfileId']},'raw':!![]})['then'](function(_0x10121b){if(_0x10121b&&_0x10121b[_0x8500('0x5c')]===0x0){return db[_0x8500('0x2c')][_0x8500('0x50')]({'name':_0x18e737[_0x8500('0x36')],'resourceId':_0x18e737['id'],'type':_0x10121b['name'],'sectionId':_0x10121b['id']},{})[_0x8500('0x28')](function(){return _0x4d2c16;});}else{return _0x4d2c16;}})['catch'](function(_0x5df8b2){logger[_0x8500('0x5d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5df8b2);});}return _0x4d2c16;});})[_0x8500('0x28')](respondWithResult(_0x3eff40,0xc9))[_0x8500('0x4b')](handleError(_0x3eff40,null));};exports[_0x8500('0x29')]=function(_0x5c5bd8,_0x43e903,_0x477928){var _0x5f00c9;return db[_0x8500('0x31')]['find']({'where':{'id':_0x5c5bd8[_0x8500('0x4c')]['id']}})['then'](function(_0xe4a7b6){if(_0xe4a7b6){return db[_0x8500('0x51')][_0x8500('0x5e')](function(_0x267903){return _0xe4a7b6[_0x8500('0x29')]({'transaction':_0x267903,'raw':!![]})[_0x8500('0x28')](function(_0x4882c4){if(_0x4882c4[_0x8500('0x56')]){fs[_0x8500('0x5f')](_0x4882c4[_0x8500('0x56')])[_0x8500('0x60')](function(_0x44f09d){fs[_0x8500('0x61')](path[_0x8500('0x62')](_0x4882c4[_0x8500('0x56')],_0x44f09d));});fs[_0x8500('0x63')](_0x4882c4[_0x8500('0x56')]);}return _0x4882c4;});})['catch'](function(_0x51c46d){throw new db['Sequelize']['ValidationError'](_0x51c46d[_0x8500('0x64')]);});}})[_0x8500('0x28')](handleEntityNotFound(_0x43e903,null))['then'](removeEntity(_0x43e903,null))[_0x8500('0x4b')](handleError(_0x43e903,null));};exports['addSound']=function(_0x3fbfd2,_0x54841b,_0x436079){return db[_0x8500('0x51')][_0x8500('0x5e')](function(_0x3c29fb){var _0x4d21f6;return db['VoiceMusicOnHold'][_0x8500('0x4f')]({'where':{'id':_0x3fbfd2[_0x8500('0x4c')]['id']}})[_0x8500('0x28')](function(_0x43544a){if(_0x43544a){_0x4d21f6=_0x43544a;return _0x43544a[_0x8500('0x65')](_0x3fbfd2[_0x8500('0x4e')]['id'],{'transaction':_0x3c29fb});}})[_0x8500('0x28')](function(_0x44e60f){if(_0x44e60f){return db[_0x8500('0x66')][_0x8500('0x67')]({'where':{'id':_0x3fbfd2[_0x8500('0x4e')]['id']},'attributes':['id',_0x8500('0x36'),_0x8500('0x68'),'converted_format',_0x8500('0x69')],'raw':!![]});}})[_0x8500('0x28')](function(_0x3d21d0){if(_0x3d21d0){var _0x19e546=path['join'](config[_0x8500('0x54')],_0x8500('0x6a'),util[_0x8500('0x6b')](_0x8500('0x6c'),path[_0x8500('0x6d')](_0x3d21d0['save_name'],path[_0x8500('0x6e')](_0x3d21d0['save_name'])),_0x3d21d0[_0x8500('0x6f')]));var _0x4476d1=path[_0x8500('0x62')](config['root'],_0x8500('0x55'),_0x4d21f6['name'],util[_0x8500('0x6b')](_0x8500('0x6c'),_0x3d21d0[_0x8500('0x36')],_0x3d21d0[_0x8500('0x6f')]));fs[_0x8500('0x70')](_0x19e546,_0x4476d1);return _0x3d21d0;}})[_0x8500('0x4b')](function(_0x252c49){throw new db[(_0x8500('0x71'))]['ValidationError'](_0x252c49[_0x8500('0x64')]);});})[_0x8500('0x28')](handleEntityNotFound(_0x54841b,null))['then'](respondWithResult(_0x54841b,0xc9))[_0x8500('0x4b')](handleError(_0x54841b,null));};exports[_0x8500('0x72')]=function(_0xe1a015,_0x28f221,_0x1dd85a){return db[_0x8500('0x51')]['transaction'](function(_0x4a1dea){var _0x1e4dcd;return db[_0x8500('0x31')][_0x8500('0x67')]({'where':{'id':_0xe1a015[_0x8500('0x4c')]['id']}})[_0x8500('0x28')](handleEntityNotFound(_0x28f221,null))[_0x8500('0x28')](function(_0x28499f){if(_0x28499f){_0x1e4dcd=_0x28499f;return _0x28499f['removeSound'](_0xe1a015[_0x8500('0x4c')][_0x8500('0x73')]);}})[_0x8500('0x28')](function(_0x3da1d0){if(_0x3da1d0){return db[_0x8500('0x66')]['findOne']({'where':{'id':_0xe1a015[_0x8500('0x4c')]['id2']},'attributes':['id','name',_0x8500('0x68'),_0x8500('0x6f'),_0x8500('0x69')],'raw':!![]});}})[_0x8500('0x28')](function(_0x19aa37){if(_0x19aa37){fs['unlinkSync'](path['join'](_0x1e4dcd[_0x8500('0x56')],util[_0x8500('0x6b')](_0x8500('0x6c'),_0x19aa37['name'],_0x19aa37[_0x8500('0x6f')])));return _0x19aa37;}})[_0x8500('0x4b')](function(_0x5e584b){throw new db['Sequelize']['ValidationError'](_0x5e584b[_0x8500('0x64')]);});})[_0x8500('0x28')](handleEntityNotFound(_0x28f221,null))[_0x8500('0x28')](respondWithStatusCode(_0x28f221,0xcc))[_0x8500('0x4b')](handleError(_0x28f221,null));};exports[_0x8500('0x74')]=function(_0x31f272,_0x5a4dea,_0x33e6e1){var _0x371d92={};var _0x1fc52c={};var _0x3b53d7;var _0x498fd0;return db[_0x8500('0x31')]['findOne']({'where':{'id':_0x31f272[_0x8500('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5a4dea,null))[_0x8500('0x28')](function(_0x3a2f7a){if(_0x3a2f7a){_0x3b53d7=_0x3a2f7a;_0x1fc52c[_0x8500('0x3b')]=_[_0x8500('0x37')](db[_0x8500('0x66')][_0x8500('0x32')]);_0x1fc52c['query']=_['keys'](_0x31f272['query']);_0x1fc52c['filters']=_[_0x8500('0x39')](_0x1fc52c['model'],_0x1fc52c[_0x8500('0x3c')]);_0x371d92['attributes']=_[_0x8500('0x39')](_0x1fc52c['model'],qs[_0x8500('0x3d')](_0x31f272[_0x8500('0x3c')]['fields']));_0x371d92[_0x8500('0x3a')]=_0x371d92['attributes']['length']?_0x371d92['attributes']:_0x1fc52c[_0x8500('0x3b')];_0x371d92[_0x8500('0x41')]=qs[_0x8500('0x75')](_0x31f272[_0x8500('0x3c')][_0x8500('0x75')]);_0x371d92[_0x8500('0x42')]=qs[_0x8500('0x38')](_['pick'](_0x31f272['query'],_0x1fc52c[_0x8500('0x38')]));if(_0x31f272[_0x8500('0x3c')][_0x8500('0x44')]){_0x371d92[_0x8500('0x42')]=_[_0x8500('0x46')](_0x371d92['where'],{'$or':_['map'](_0x371d92[_0x8500('0x3a')],function(_0x3edf2c){var _0x627e55={};_0x627e55[_0x3edf2c]={'$like':'%'+_0x31f272[_0x8500('0x3c')][_0x8500('0x44')]+'%'};return _0x627e55;})});}_0x371d92=_[_0x8500('0x46')]({},_0x371d92,_0x31f272[_0x8500('0x4d')]);return _0x3b53d7[_0x8500('0x74')](_0x371d92);}})[_0x8500('0x28')](function(_0x3c277e){if(_0x3c277e){_0x498fd0=_0x3c277e['length'];if(!_0x31f272['query']['hasOwnProperty']('nolimit')){_0x371d92[_0x8500('0x1f')]=qs[_0x8500('0x1f')](_0x31f272[_0x8500('0x3c')][_0x8500('0x1f')]);_0x371d92[_0x8500('0x1d')]=qs[_0x8500('0x1d')](_0x31f272[_0x8500('0x3c')][_0x8500('0x1d')]);}return _0x3b53d7[_0x8500('0x74')](_0x371d92);}})['then'](function(_0x428033){if(_0x428033){return _0x428033?{'count':_0x498fd0,'rows':_0x428033}:null;}})[_0x8500('0x28')](respondWithResult(_0x5a4dea,null))[_0x8500('0x4b')](handleError(_0x5a4dea,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 92df224..cc868e5 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 _0xc37c=['path','rimraf','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x21d0c3,_0x16c71c){var _0x4df18e=function(_0x576bfe){while(--_0x576bfe){_0x21d0c3['push'](_0x21d0c3['shift']());}};_0x4df18e(++_0x16c71c);}(_0xc37c,0xba));var _0xcc37=function(_0x30a31e,_0x31f766){_0x30a31e=_0x30a31e-0x0;var _0x170879=_0xc37c[_0x30a31e];return _0x170879;};'use strict';var _=require('lodash');var util=require(_0xcc37('0x0'));var logger=require(_0xcc37('0x1'))(_0xcc37('0x2'));var moment=require(_0xcc37('0x3'));var BPromise=require(_0xcc37('0x4'));var rp=require(_0xcc37('0x5'));var fs=require('fs');var path=require(_0xcc37('0x6'));var rimraf=require(_0xcc37('0x7'));var config=require('../../config/environment');var attributes=require(_0xcc37('0x8'));module[_0xcc37('0x9')]=function(_0x7de28e,_0x5e55fb){return _0x7de28e[_0xcc37('0xa')](_0xcc37('0xb'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ccc=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','VoiceMusicOnHold','voice_musiconhold','util','../../config/logger','api'];(function(_0x2c7cb1,_0x588d5a){var _0x31437b=function(_0x24e92d){while(--_0x24e92d){_0x2c7cb1['push'](_0x2c7cb1['shift']());}};_0x31437b(++_0x588d5a);}(_0x4ccc,0x1d1));var _0xc4cc=function(_0x4624d9,_0x2fb5a4){_0x4624d9=_0x4624d9-0x0;var _0x4471fe=_0x4ccc[_0x4624d9];return _0x4471fe;};'use strict';var _=require('lodash');var util=require(_0xc4cc('0x0'));var logger=require(_0xc4cc('0x1'))(_0xc4cc('0x2'));var moment=require(_0xc4cc('0x3'));var BPromise=require(_0xc4cc('0x4'));var rp=require(_0xc4cc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc4cc('0x6'));var config=require(_0xc4cc('0x7'));var attributes=require('./voiceMusicOnHold.attributes');module[_0xc4cc('0x8')]=function(_0x16fd3b,_0x3796af){return _0x16fd3b[_0xc4cc('0x9')](_0xc4cc('0xa'),attributes,{'tableName':_0xc4cc('0xb'),'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 7b5dc75..2ced35e 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 _0xe706=['http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2aa63e,_0xbbe720){var _0x445a06=function(_0x30e097){while(--_0x30e097){_0x2aa63e['push'](_0x2aa63e['shift']());}};_0x445a06(++_0xbbe720);}(_0xe706,0xa3));var _0x6e70=function(_0x5c1cdc,_0x322014){_0x5c1cdc=_0x5c1cdc-0x0;var _0x2e8317=_0xe706[_0x5c1cdc];return _0x2e8317;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +var _0xa9e0=['http','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\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(_0x4bfc0f,_0x1b268f){var _0x592584=function(_0x2e3dfc){while(--_0x2e3dfc){_0x4bfc0f['push'](_0x4bfc0f['shift']());}};_0x592584(++_0x1b268f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'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/voicePrefix/index.js b/server/api/voicePrefix/index.js index d917236..2d79fdc 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 _0x9026=['../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/users','getAgents','create','post','put','update','delete','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x9026,0x125));var _0x6902=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x9026[_0x12fc8d];return _0x3f9d04;};'use strict';var multer=require('multer');var util=require(_0x6902('0x0'));var path=require('path');var timeout=require(_0x6902('0x1'));var express=require(_0x6902('0x2'));var router=express['Router']();var fs_extra=require(_0x6902('0x3'));var auth=require(_0x6902('0x4'));var interaction=require(_0x6902('0x5'));var config=require(_0x6902('0x6'));var controller=require(_0x6902('0x7'));router[_0x6902('0x8')]('/',auth[_0x6902('0x9')](),controller[_0x6902('0xa')]);router[_0x6902('0x8')](_0x6902('0xb'),auth['isAuthenticated'](),controller[_0x6902('0xc')]);router[_0x6902('0x8')](_0x6902('0xd'),auth['isAuthenticated'](),controller[_0x6902('0xe')]);router[_0x6902('0x8')](_0x6902('0xf'),auth[_0x6902('0x9')](),controller[_0x6902('0x10')]);router['post']('/',auth[_0x6902('0x9')](),controller[_0x6902('0x11')]);router[_0x6902('0x12')](_0x6902('0xf'),auth[_0x6902('0x9')](),controller['addAgents']);router[_0x6902('0x13')](_0x6902('0xd'),auth[_0x6902('0x9')](),controller[_0x6902('0x14')]);router[_0x6902('0x15')](_0x6902('0xd'),auth[_0x6902('0x9')](),controller['destroy']);router['delete'](_0x6902('0xf'),auth[_0x6902('0x9')](),controller['removeAgents']);module[_0x6902('0x16')]=router; \ No newline at end of file +var _0xc21e=['getAgents','post','addAgents','put','update','delete','removeAgents','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id'];(function(_0x56ca4f,_0x2d896a){var _0x47f89f=function(_0x28293b){while(--_0x28293b){_0x56ca4f['push'](_0x56ca4f['shift']());}};_0x47f89f(++_0x2d896a);}(_0xc21e,0x170));var _0xec21=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xc21e[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xec21('0x0'));var util=require(_0xec21('0x1'));var path=require('path');var timeout=require(_0xec21('0x2'));var express=require('express');var router=express[_0xec21('0x3')]();var fs_extra=require(_0xec21('0x4'));var auth=require(_0xec21('0x5'));var interaction=require(_0xec21('0x6'));var config=require('../../config/environment');var controller=require('./voicePrefix.controller');router[_0xec21('0x7')]('/',auth[_0xec21('0x8')](),controller['index']);router[_0xec21('0x7')](_0xec21('0x9'),auth[_0xec21('0x8')](),controller[_0xec21('0xa')]);router[_0xec21('0x7')](_0xec21('0xb'),auth[_0xec21('0x8')](),controller['show']);router[_0xec21('0x7')]('/:id/users',auth[_0xec21('0x8')](),controller[_0xec21('0xc')]);router[_0xec21('0xd')]('/',auth[_0xec21('0x8')](),controller['create']);router['post']('/:id/users',auth[_0xec21('0x8')](),controller[_0xec21('0xe')]);router[_0xec21('0xf')](_0xec21('0xb'),auth[_0xec21('0x8')](),controller[_0xec21('0x10')]);router[_0xec21('0x11')](_0xec21('0xb'),auth[_0xec21('0x8')](),controller['destroy']);router['delete']('/:id/users',auth[_0xec21('0x8')](),controller[_0xec21('0x12')]);module[_0xec21('0x13')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 0cb2a25..90ab66e 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 _0x3165=['name','INTEGER','sequelize','exports','STRING','system-','getDataValue'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x3165,0x6b));var _0x5316=function(_0x27b56d,_0x3e88b1){_0x27b56d=_0x27b56d-0x0;var _0x4cada5=_0x3165[_0x27b56d];return _0x4cada5;};'use strict';var Sequelize=require(_0x5316('0x0'));module[_0x5316('0x1')]={'name':{'type':Sequelize[_0x5316('0x2')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x26af9f){return _0x5316('0x3')+this[_0x5316('0x4')](_0x5316('0x5'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x5316('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x5316('0x6')]}}; \ No newline at end of file +var _0xcfad=['exports','STRING','name','VIRTUAL','system-','INTEGER','sequelize'];(function(_0x454165,_0x1f3e74){var _0x56db53=function(_0x23388c){while(--_0x23388c){_0x454165['push'](_0x454165['shift']());}};_0x56db53(++_0x1f3e74);}(_0xcfad,0x1f0));var _0xdcfa=function(_0x5f1e0d,_0x35e06f){_0x5f1e0d=_0x5f1e0d-0x0;var _0x44b8fb=_0xcfad[_0x5f1e0d];return _0x44b8fb;};'use strict';var Sequelize=require(_0xdcfa('0x0'));module[_0xdcfa('0x1')]={'name':{'type':Sequelize[_0xdcfa('0x2')],'allowNull':![],'unique':_0xdcfa('0x3')},'prefix':{'type':Sequelize[_0xdcfa('0x4')],'get':function(_0x9692f5){return _0xdcfa('0x5')+this['getDataValue'](_0xdcfa('0x3'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0xdcfa('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 21e7aa5..cdaab93 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 _0x8185=['sort','where','filters','pick','VIRTUAL','filter','merge','include','rows','params','includeAll','options','find','catch','describe','create','body','VoiceExtension','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','app','system','Voice\x20Prefix\x20Extension','appdata','NoOp','Voice\x20Prefix','VoiceExtensionId','VoicePrefixId','Extensions\x20creation\x20failed','prefix','CDR(prefix)=','callerIdAll','push','Set','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','sequelize','findById','addAgents','ids','omit','spread','userVoicePrefix:save','isArray','emit','userVoicePrefix:remove','getAgents','findOne','User','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voicePrefix.socket','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','VoicePrefixes','UserProfileResource','error','name','index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x66c79d,_0x15b7ac){var _0x38dc37=function(_0x5347ac){while(--_0x5347ac){_0x66c79d['push'](_0x66c79d['shift']());}};_0x38dc37(++_0x15b7ac);}(_0x8185,0xb8));var _0x5818=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x8185[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0x5818('0x0'));var rimraf=require(_0x5818('0x1'));var zipdir=require(_0x5818('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5818('0x3'));var moment=require(_0x5818('0x4'));var BPromise=require(_0x5818('0x5'));var Mustache=require(_0x5818('0x6'));var util=require(_0x5818('0x7'));var path=require('path');var sox=require(_0x5818('0x8'));var csv=require(_0x5818('0x9'));var ejs=require(_0x5818('0xa'));var fs=require('fs');var fs_extra=require(_0x5818('0xb'));var _=require(_0x5818('0xc'));var squel=require(_0x5818('0xd'));var crypto=require(_0x5818('0xe'));var jsforce=require(_0x5818('0xf'));var deskjs=require(_0x5818('0x10'));var toCsv=require(_0x5818('0x9'));var querystring=require('querystring');var Papa=require(_0x5818('0x11'));var Redis=require(_0x5818('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x5818('0x13'));var as=require(_0x5818('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5818('0x15'));var utils=require(_0x5818('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5818('0x17'));var db=require(_0x5818('0x18'))['db'];config[_0x5818('0x19')]=_['defaults'](config[_0x5818('0x19')],{'host':_0x5818('0x1a'),'port':0x18eb});var socket=require(_0x5818('0x1b'))(new Redis(config[_0x5818('0x19')]));require(_0x5818('0x1c'))['register'](socket);function respondWithStatusCode(_0x15ef16,_0x116158){_0x116158=_0x116158||0xcc;return function(_0x22009d){if(_0x22009d){return _0x15ef16[_0x5818('0x1d')](_0x116158);}return _0x15ef16[_0x5818('0x1e')](_0x116158)[_0x5818('0x1f')]();};}function respondWithResult(_0x1b683e,_0x58f32e){_0x58f32e=_0x58f32e||0xc8;return function(_0xe77578){if(_0xe77578){return _0x1b683e['status'](_0x58f32e)['json'](_0xe77578);}};}function respondWithFilteredResult(_0x3111a1,_0x550dff){return function(_0x845081){if(_0x845081){var _0x1618e6=typeof _0x550dff[_0x5818('0x20')]===_0x5818('0x21')&&typeof _0x550dff[_0x5818('0x22')]==='undefined';var _0x6f919f=_0x845081[_0x5818('0x23')];var _0x3e49ba=_0x1618e6?0x0:_0x550dff[_0x5818('0x20')];var _0xae2494=_0x1618e6?_0x845081[_0x5818('0x23')]:_0x550dff[_0x5818('0x20')]+_0x550dff[_0x5818('0x22')];var _0x36f108;if(_0xae2494>=_0x6f919f){_0xae2494=_0x6f919f;_0x36f108=0xc8;}else{_0x36f108=0xce;}_0x3111a1[_0x5818('0x1e')](_0x36f108);return _0x3111a1[_0x5818('0x24')](_0x5818('0x25'),_0x3e49ba+'-'+_0xae2494+'/'+_0x6f919f)['json'](_0x845081);}return null;};}function patchUpdates(_0x2d8c32){return function(_0x5a50c7){try{jsonpatch[_0x5818('0x26')](_0x5a50c7,_0x2d8c32,!![]);}catch(_0x406c3a){return BPromise[_0x5818('0x27')](_0x406c3a);}return _0x5a50c7[_0x5818('0x28')]();};}function saveUpdates(_0x4dc4a0,_0x261170){return function(_0x541d40){if(_0x541d40){return _0x541d40[_0x5818('0x29')](_0x4dc4a0)[_0x5818('0x2a')](function(_0xaa31bc){return _0xaa31bc;});}return null;};}function removeEntity(_0x389d86,_0x350fdf){return function(_0x48be1d){if(_0x48be1d){return _0x48be1d[_0x5818('0x2b')]()[_0x5818('0x2a')](function(){var _0x305ebb=_0x48be1d[_0x5818('0x2c')]({'plain':!![]});var _0x504efd=_0x5818('0x2d');return db[_0x5818('0x2e')]['destroy']({'where':{'type':_0x504efd,'resourceId':_0x305ebb['id']}})[_0x5818('0x2a')](function(){return _0x48be1d;});})[_0x5818('0x2a')](function(){_0x389d86['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d55c5,_0x3a815b){return function(_0x2ae9b7){if(!_0x2ae9b7){_0x3d55c5['sendStatus'](0x194);}return _0x2ae9b7;};}function handleError(_0xe03d9,_0x242f1a){_0x242f1a=_0x242f1a||0x1f4;return function(_0x5482fb){logger[_0x5818('0x2f')](_0x5482fb['stack']);if(_0x5482fb[_0x5818('0x30')]){delete _0x5482fb['name'];}_0xe03d9['status'](_0x242f1a)['send'](_0x5482fb);};}exports[_0x5818('0x31')]=function(_0x367dc1,_0x3eae01){var _0xf639fb={},_0x44c2ad={},_0x28df75={'count':0x0,'rows':[]};var _0x303901=_[_0x5818('0x32')](db[_0x5818('0x33')][_0x5818('0x34')],function(_0x597e71){return{'name':_0x597e71[_0x5818('0x35')],'type':_0x597e71[_0x5818('0x36')][_0x5818('0x37')]};});_0x44c2ad[_0x5818('0x38')]=_['map'](_0x303901,'name');_0x44c2ad['query']=_[_0x5818('0x39')](_0x367dc1[_0x5818('0x3a')]);_0x44c2ad['filters']=_[_0x5818('0x3b')](_0x44c2ad[_0x5818('0x38')],_0x44c2ad[_0x5818('0x3a')]);_0xf639fb['attributes']=_['intersection'](_0x44c2ad[_0x5818('0x38')],qs[_0x5818('0x3c')](_0x367dc1[_0x5818('0x3a')]['fields']));_0xf639fb[_0x5818('0x3d')]=_0xf639fb[_0x5818('0x3d')][_0x5818('0x3e')]?_0xf639fb['attributes']:_0x44c2ad[_0x5818('0x38')];if(!_0x367dc1['query'][_0x5818('0x3f')](_0x5818('0x40'))){_0xf639fb[_0x5818('0x22')]=qs['limit'](_0x367dc1[_0x5818('0x3a')][_0x5818('0x22')]);_0xf639fb[_0x5818('0x20')]=qs[_0x5818('0x20')](_0x367dc1[_0x5818('0x3a')][_0x5818('0x20')]);}_0xf639fb[_0x5818('0x41')]=qs[_0x5818('0x42')](_0x367dc1['query'][_0x5818('0x42')]);_0xf639fb[_0x5818('0x43')]=qs[_0x5818('0x44')](_[_0x5818('0x45')](_0x367dc1['query'],_0x44c2ad[_0x5818('0x44')]),_0x303901);if(_0x367dc1['query']['filter']){_0xf639fb[_0x5818('0x43')]=_['merge'](_0xf639fb[_0x5818('0x43')],{'$or':_['map'](_0x303901,function(_0x284170){if(_0x284170[_0x5818('0x36')]!==_0x5818('0x46')){var _0x2cae5d={};_0x2cae5d[_0x284170['name']]={'$like':'%'+_0x367dc1['query'][_0x5818('0x47')]+'%'};return _0x2cae5d;}})});}_0xf639fb=_[_0x5818('0x48')]({},_0xf639fb,_0x367dc1['options']);var _0xc5311b={'where':_0xf639fb[_0x5818('0x43')]};return db[_0x5818('0x33')]['count'](_0xc5311b)['then'](function(_0xacefa2){_0x28df75[_0x5818('0x23')]=_0xacefa2;if(_0x367dc1[_0x5818('0x3a')]['includeAll']){_0xf639fb[_0x5818('0x49')]=[{'all':!![]}];}return db[_0x5818('0x33')]['findAll'](_0xf639fb);})[_0x5818('0x2a')](function(_0x266e38){_0x28df75[_0x5818('0x4a')]=_0x266e38;return _0x28df75;})[_0x5818('0x2a')](respondWithFilteredResult(_0x3eae01,_0xf639fb))['catch'](handleError(_0x3eae01,null));};exports['show']=function(_0x2fd361,_0x54818e){var _0x1e2488={'raw':![],'where':{'id':_0x2fd361[_0x5818('0x4b')]['id']}},_0xec8b39={};_0xec8b39[_0x5818('0x38')]=_[_0x5818('0x39')](db[_0x5818('0x33')][_0x5818('0x34')]);_0xec8b39[_0x5818('0x3a')]=_[_0x5818('0x39')](_0x2fd361[_0x5818('0x3a')]);_0xec8b39[_0x5818('0x44')]=_[_0x5818('0x3b')](_0xec8b39[_0x5818('0x38')],_0xec8b39[_0x5818('0x3a')]);_0x1e2488[_0x5818('0x3d')]=_[_0x5818('0x3b')](_0xec8b39['model'],qs['fields'](_0x2fd361[_0x5818('0x3a')]['fields']));_0x1e2488[_0x5818('0x3d')]=_0x1e2488[_0x5818('0x3d')]['length']?_0x1e2488[_0x5818('0x3d')]:_0xec8b39[_0x5818('0x38')];if(_0x2fd361[_0x5818('0x3a')][_0x5818('0x4c')]){_0x1e2488[_0x5818('0x49')]=[{'all':!![]}];}_0x1e2488=_[_0x5818('0x48')]({},_0x1e2488,_0x2fd361[_0x5818('0x4d')]);return db[_0x5818('0x33')][_0x5818('0x4e')](_0x1e2488)[_0x5818('0x2a')](handleEntityNotFound(_0x54818e,null))['then'](respondWithResult(_0x54818e,null))[_0x5818('0x4f')](handleError(_0x54818e,null));};exports['destroy']=function(_0x52a7e4,_0xd9ccf){return db[_0x5818('0x33')][_0x5818('0x4e')]({'where':{'id':_0x52a7e4['params']['id']}})[_0x5818('0x2a')](handleEntityNotFound(_0xd9ccf,null))[_0x5818('0x2a')](removeEntity(_0xd9ccf,null))[_0x5818('0x4f')](handleError(_0xd9ccf,null));};exports[_0x5818('0x50')]=function(_0x2b2f00,_0x553f4e){return db[_0x5818('0x33')][_0x5818('0x50')]()[_0x5818('0x2a')](respondWithResult(_0x553f4e,null))[_0x5818('0x4f')](handleError(_0x553f4e,null));};exports[_0x5818('0x51')]=function(_0x27619e,_0x4b8352){var _0xea55bd;return db['sequelize']['transaction'](function(_0x52dab0){return db['VoicePrefix'][_0x5818('0x51')](_0x27619e[_0x5818('0x52')],{'transaction':_0x52dab0})['then'](function(_0x18f492){_0xea55bd=_0x18f492['get']({'plain':!![]});return db[_0x5818('0x53')][_0x5818('0x4e')]({'where':{'id':_0xea55bd['VoiceExtensionId']},'raw':!![]})[_0x5818('0x2a')](function(_0x45f3f3){return createVoicePrefixExtensions(_0xea55bd,_0x45f3f3,_0x52dab0);});});})[_0x5818('0x2a')](function(){var _0x4e6b5e=_0x27619e[_0x5818('0x54')][_0x5818('0x2c')]({'plain':!![]});if(!_0x4e6b5e)throw new Error(_0x5818('0x55'));if(_0x4e6b5e['role']==='user'){var _0x43bcc7=_0xea55bd;return db[_0x5818('0x56')][_0x5818('0x4e')]({'where':{'name':'VoicePrefixes','userProfileId':_0x4e6b5e[_0x5818('0x57')]},'raw':!![]})[_0x5818('0x2a')](function(_0x110c6f){if(_0x110c6f&&_0x110c6f[_0x5818('0x58')]===0x0){return db['UserProfileResource'][_0x5818('0x51')]({'name':_0x43bcc7[_0x5818('0x30')],'resourceId':_0x43bcc7['id'],'type':_0x110c6f[_0x5818('0x30')],'sectionId':_0x110c6f['id']},{})['then'](function(){return _0xea55bd;});}else{return _0xea55bd;}})[_0x5818('0x4f')](function(_0x3e9a29){logger[_0x5818('0x2f')](_0x5818('0x59'),_0x3e9a29);throw _0x3e9a29;});}return _0xea55bd;})['then'](respondWithResult(_0x4b8352,null))[_0x5818('0x4f')](handleError(_0x4b8352,null));};function Extension(_0x102c33,_0xd179d3,_0x48d177,_0x2b9dbf){this[_0x5818('0x5a')]=_0x5818('0x5b');this['exten']=_0x102c33;this[_0x5818('0x5c')]=_0x48d177;this['type']=_0x5818('0x5d');this['description']=_0x5818('0x5e');this['priority']=_0xd179d3;this[_0x5818('0x5f')]=_0x2b9dbf;}function createVoicePrefixExtensions(_0x2326e3,_0x502fd9,_0x21e231){return new BPromise(function(_0x4a6c72,_0x1d0417){var _0x4085e5=new Extension(formatPrefixName(_0x2326e3['prefix']),0x1,_0x5818('0x60'),_0x5818('0x61'));_0x4085e5['VoicePrefixId']=_0x2326e3['id'];return db[_0x5818('0x53')][_0x5818('0x51')](_0x4085e5,{'transaction':_0x21e231})['then'](function(_0x215782){var _0x2c8337=_0x215782['get']({'plain':!![]});var _0x22d8ab=_[_0x5818('0x32')](addVoicePrefixExtensions(_0x2326e3,_0x502fd9),function(_0x5dd2b4){_0x5dd2b4[_0x5818('0x62')]=_0x2c8337['id'];_0x5dd2b4[_0x5818('0x63')]=_0x2326e3['id'];return _0x5dd2b4;});return db[_0x5818('0x53')]['bulkCreate'](_0x22d8ab,{'transaction':_0x21e231})[_0x5818('0x2a')](function(_0x512ffa){if(!_0x512ffa){return _0x1d0417(_0x5818('0x64'));}else{return _0x4a6c72(_0x512ffa);}})[_0x5818('0x4f')](function(_0xfb7658){return _0x1d0417(_0xfb7658);});});;});};function addVoicePrefixExtensions(_0x5257f1,_0x162f57){var _0x81ce4=[];var _0x3be3c1=formatPrefixName(_0x5257f1[_0x5818('0x65')]);_0x81ce4['push'](new Extension(_0x3be3c1,0x2,'Set',_0x5818('0x66')+_0x5257f1[_0x5818('0x30')]));if(_0x5257f1[_0x5818('0x67')]){_0x81ce4[_0x5818('0x68')](new Extension(_0x3be3c1,0x3,_0x5818('0x69'),_0x5818('0x6a')+_0x5257f1[_0x5818('0x67')]));}else{_0x81ce4[_0x5818('0x68')](new Extension(_0x3be3c1,0x3,_0x5818('0x60'),_0x5818('0x6b')));}_0x81ce4[_0x5818('0x68')](new Extension(_0x3be3c1,0x4,_0x5818('0x6c'),_0x162f57[_0x5818('0x5a')]+','+_0x5818('0x6d')+(0x8+_0x5257f1[_0x5818('0x30')]['length'])+'}'+','+0x1));return _0x81ce4;}function formatPrefixName(_0x2d62c7){var _0x4b998d='_';for(var _0x1911e6=0x0;_0x1911e6<_0x2d62c7['length'];_0x1911e6++){if(_0x2d62c7[_0x5818('0x6e')](_0x1911e6)=='-'){_0x4b998d+=_0x2d62c7[_0x5818('0x6e')](_0x1911e6);}else{_0x4b998d+='['+_0x2d62c7[_0x5818('0x6e')](_0x1911e6)+']';}}_0x4b998d+='.';return _0x4b998d;}exports['update']=function(_0x331e61,_0x29277d,_0x25c0ba){var _0x592334=_0x331e61['body'];_0x592334[_0x5818('0x65')]=_0x5818('0x6f')+_0x592334['name']+'-';return db[_0x5818('0x70')]['transaction'](function(_0x316e65){return db[_0x5818('0x33')]['update'](_0x592334,{'where':{'id':_0x592334['id']},'transaction':_0x316e65})['then'](function(){return db['VoiceExtension'][_0x5818('0x2b')]({'where':{'VoicePrefixId':_0x592334['id']},'transaction':_0x316e65})[_0x5818('0x2a')](function(){return db['VoiceExtension']['find']({'where':{'id':_0x592334[_0x5818('0x62')]},'raw':!![]})['then'](function(_0x16bcd8){return createVoicePrefixExtensions(_0x592334,_0x16bcd8,_0x316e65);});});});})[_0x5818('0x2a')](function(){return db['VoicePrefix'][_0x5818('0x71')](_0x592334['id']);})[_0x5818('0x2a')](respondWithResult(_0x29277d,null))[_0x5818('0x4f')](handleError(_0x29277d,null));};exports[_0x5818('0x72')]=function(_0x27d7ff,_0x143ac0,_0x3596ed){return db[_0x5818('0x33')]['find']({'where':{'id':_0x27d7ff[_0x5818('0x4b')]['id']}})['then'](handleEntityNotFound(_0x143ac0,null))[_0x5818('0x2a')](function(_0x59a7f0){if(_0x59a7f0){return _0x59a7f0['addAgents'](_0x27d7ff[_0x5818('0x52')][_0x5818('0x73')],_[_0x5818('0x74')](_0x27d7ff[_0x5818('0x52')],[_0x5818('0x73'),'id'])||{})[_0x5818('0x75')](function(_0x59f32a){for(var _0x4b5a2c=0x0;_0x4b5a2c<_0x27d7ff[_0x5818('0x52')]['ids'][_0x5818('0x3e')];_0x4b5a2c+=0x1){socket['emit'](_0x5818('0x76'),{'UserId':Number(_0x27d7ff['body']['ids'][_0x4b5a2c]),'VoicePrefixId':Number(_0x27d7ff[_0x5818('0x4b')]['id'])});}return _0x59f32a;});}})[_0x5818('0x2a')](respondWithResult(_0x143ac0,null))['catch'](handleError(_0x143ac0,null));};exports['removeAgents']=function(_0x2a5df9,_0x49359e,_0x57cc5e){return db[_0x5818('0x33')][_0x5818('0x4e')]({'where':{'id':_0x2a5df9[_0x5818('0x4b')]['id']}})[_0x5818('0x2a')](handleEntityNotFound(_0x49359e,null))[_0x5818('0x2a')](function(_0x153eb4){if(_0x153eb4){return _0x153eb4['removeAgents'](_0x2a5df9['query']['ids'])[_0x5818('0x2a')](function(){if(_[_0x5818('0x77')](_0x2a5df9[_0x5818('0x3a')][_0x5818('0x73')])){for(var _0x174beb=0x0;_0x174beb<_0x2a5df9[_0x5818('0x3a')]['ids']['length'];_0x174beb+=0x1){socket[_0x5818('0x78')](_0x5818('0x79'),{'UserId':Number(_0x2a5df9[_0x5818('0x3a')][_0x5818('0x73')][_0x174beb]),'VoicePrefixId':Number(_0x2a5df9[_0x5818('0x4b')]['id'])});}}else{socket['emit'](_0x5818('0x79'),{'UserId':Number(_0x2a5df9['query'][_0x5818('0x73')]),'VoicePrefixId':Number(_0x2a5df9[_0x5818('0x4b')]['id'])});}});}})[_0x5818('0x2a')](respondWithStatusCode(_0x49359e,null))[_0x5818('0x4f')](handleError(_0x49359e,null));};exports[_0x5818('0x7a')]=function(_0x43ed59,_0x1b81f9,_0x4d377c){var _0x543390={};var _0x274a3a={};var _0x5826cd;var _0x2e7194;return db[_0x5818('0x33')][_0x5818('0x7b')]({'where':{'id':_0x43ed59['params']['id']}})[_0x5818('0x2a')](handleEntityNotFound(_0x1b81f9,null))[_0x5818('0x2a')](function(_0x6e1e9c){if(_0x6e1e9c){_0x5826cd=_0x6e1e9c;_0x274a3a['model']=_[_0x5818('0x39')](db[_0x5818('0x7c')][_0x5818('0x34')]);_0x274a3a[_0x5818('0x3a')]=_['keys'](_0x43ed59[_0x5818('0x3a')]);_0x274a3a['filters']=_[_0x5818('0x3b')](_0x274a3a[_0x5818('0x38')],_0x274a3a[_0x5818('0x3a')]);_0x543390[_0x5818('0x3d')]=_[_0x5818('0x3b')](_0x274a3a['model'],qs[_0x5818('0x3c')](_0x43ed59[_0x5818('0x3a')][_0x5818('0x3c')]));_0x543390[_0x5818('0x3d')]=_0x543390[_0x5818('0x3d')]['length']?_0x543390[_0x5818('0x3d')]:_0x274a3a['model'];_0x543390[_0x5818('0x41')]=qs[_0x5818('0x42')](_0x43ed59['query']['sort']);_0x543390[_0x5818('0x43')]=qs[_0x5818('0x44')](_[_0x5818('0x45')](_0x43ed59['query'],_0x274a3a['filters']));if(_0x43ed59[_0x5818('0x3a')]['filter']){_0x543390[_0x5818('0x43')]=_['merge'](_0x543390[_0x5818('0x43')],{'$or':_['map'](_0x543390['attributes'],function(_0x2101e1){var _0x3eda67={};_0x3eda67[_0x2101e1]={'$like':'%'+_0x43ed59['query']['filter']+'%'};return _0x3eda67;})});}_0x543390=_[_0x5818('0x48')]({},_0x543390,_0x43ed59[_0x5818('0x4d')]);return _0x5826cd[_0x5818('0x7a')](_0x543390);}})[_0x5818('0x2a')](function(_0x1792d5){if(_0x1792d5){_0x2e7194=_0x1792d5['length'];if(!_0x43ed59[_0x5818('0x3a')][_0x5818('0x3f')](_0x5818('0x40'))){_0x543390[_0x5818('0x22')]=qs['limit'](_0x43ed59['query']['limit']);_0x543390[_0x5818('0x20')]=qs[_0x5818('0x20')](_0x43ed59[_0x5818('0x3a')]['offset']);}return _0x5826cd[_0x5818('0x7a')](_0x543390);}})[_0x5818('0x2a')](function(_0x8250b7){if(_0x8250b7){return _0x8250b7?{'count':_0x2e7194,'rows':_0x8250b7}:null;}})['then'](respondWithResult(_0x1b81f9,null))[_0x5818('0x4f')](handleError(_0x1b81f9,null));}; \ No newline at end of file +var _0xc2f4=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','VoicePrefixes','UserProfileResource','destroy','end','stack','name','send','index','map','VoicePrefix','rawAttributes','fieldName','type','key','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','keys','include','find','describe','sequelize','transaction','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoiceExtensionId','VoicePrefixId','VoiceExtension','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','addAgents','ids','omit','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','eml-format'];(function(_0x54c3ce,_0x3f8f73){var _0x555e24=function(_0x2de4b0){while(--_0x2de4b0){_0x54c3ce['push'](_0x54c3ce['shift']());}};_0x555e24(++_0x3f8f73);}(_0xc2f4,0x107));var _0x4c2f=function(_0x1937c8,_0x5a1f28){_0x1937c8=_0x1937c8-0x0;var _0x48bedf=_0xc2f4[_0x1937c8];return _0x48bedf;};'use strict';var emlformat=require(_0x4c2f('0x0'));var rimraf=require(_0x4c2f('0x1'));var zipdir=require(_0x4c2f('0x2'));var jsonpatch=require(_0x4c2f('0x3'));var rp=require(_0x4c2f('0x4'));var moment=require(_0x4c2f('0x5'));var BPromise=require(_0x4c2f('0x6'));var Mustache=require('mustache');var util=require(_0x4c2f('0x7'));var path=require(_0x4c2f('0x8'));var sox=require(_0x4c2f('0x9'));var csv=require(_0x4c2f('0xa'));var ejs=require(_0x4c2f('0xb'));var fs=require('fs');var fs_extra=require(_0x4c2f('0xc'));var _=require('lodash');var squel=require(_0x4c2f('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4c2f('0xe'));var toCsv=require(_0x4c2f('0xa'));var querystring=require('querystring');var Papa=require(_0x4c2f('0xf'));var Redis=require('ioredis');var authService=require(_0x4c2f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4c2f('0x11'));var hardwareService=require(_0x4c2f('0x12'));var logger=require(_0x4c2f('0x13'))(_0x4c2f('0x14'));var utils=require(_0x4c2f('0x15'));var config=require(_0x4c2f('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x4c2f('0x17'))['db'];config[_0x4c2f('0x18')]=_['defaults'](config[_0x4c2f('0x18')],{'host':_0x4c2f('0x19'),'port':0x18eb});var socket=require(_0x4c2f('0x1a'))(new Redis(config[_0x4c2f('0x18')]));require('./voicePrefix.socket')[_0x4c2f('0x1b')](socket);function respondWithStatusCode(_0x5b4804,_0x5ae1c5){_0x5ae1c5=_0x5ae1c5||0xcc;return function(_0x91b9a4){if(_0x91b9a4){return _0x5b4804[_0x4c2f('0x1c')](_0x5ae1c5);}return _0x5b4804[_0x4c2f('0x1d')](_0x5ae1c5)['end']();};}function respondWithResult(_0x1e2b23,_0x22b507){_0x22b507=_0x22b507||0xc8;return function(_0x468cf7){if(_0x468cf7){return _0x1e2b23['status'](_0x22b507)[_0x4c2f('0x1e')](_0x468cf7);}};}function respondWithFilteredResult(_0x5aa0c7,_0x42c5c3){return function(_0x413ae0){if(_0x413ae0){var _0x50898b=typeof _0x42c5c3[_0x4c2f('0x1f')]===_0x4c2f('0x20')&&typeof _0x42c5c3[_0x4c2f('0x21')]===_0x4c2f('0x20');var _0x6d7ddf=_0x413ae0['count'];var _0x101456=_0x50898b?0x0:_0x42c5c3[_0x4c2f('0x1f')];var _0x10fa87=_0x50898b?_0x413ae0[_0x4c2f('0x22')]:_0x42c5c3['offset']+_0x42c5c3[_0x4c2f('0x21')];var _0x4c0537;if(_0x10fa87>=_0x6d7ddf){_0x10fa87=_0x6d7ddf;_0x4c0537=0xc8;}else{_0x4c0537=0xce;}_0x5aa0c7[_0x4c2f('0x1d')](_0x4c0537);return _0x5aa0c7[_0x4c2f('0x23')](_0x4c2f('0x24'),_0x101456+'-'+_0x10fa87+'/'+_0x6d7ddf)['json'](_0x413ae0);}return null;};}function patchUpdates(_0x59672c){return function(_0x186ad8){try{jsonpatch[_0x4c2f('0x25')](_0x186ad8,_0x59672c,!![]);}catch(_0xf4d0d){return BPromise[_0x4c2f('0x26')](_0xf4d0d);}return _0x186ad8[_0x4c2f('0x27')]();};}function saveUpdates(_0x32c745,_0x31e81a){return function(_0xb7ae58){if(_0xb7ae58){return _0xb7ae58[_0x4c2f('0x28')](_0x32c745)[_0x4c2f('0x29')](function(_0x303bab){return _0x303bab;});}return null;};}function removeEntity(_0x57f5d2,_0x9a13b4){return function(_0x36c03f){if(_0x36c03f){return _0x36c03f['destroy']()['then'](function(){var _0x11a3dc=_0x36c03f[_0x4c2f('0x2a')]({'plain':!![]});var _0x56e7ad=_0x4c2f('0x2b');return db[_0x4c2f('0x2c')][_0x4c2f('0x2d')]({'where':{'type':_0x56e7ad,'resourceId':_0x11a3dc['id']}})[_0x4c2f('0x29')](function(){return _0x36c03f;});})[_0x4c2f('0x29')](function(){_0x57f5d2['status'](0xcc)[_0x4c2f('0x2e')]();});}};}function handleEntityNotFound(_0x103358,_0x3ed5ff){return function(_0x36eb86){if(!_0x36eb86){_0x103358[_0x4c2f('0x1c')](0x194);}return _0x36eb86;};}function handleError(_0x49b469,_0x271d0e){_0x271d0e=_0x271d0e||0x1f4;return function(_0x3f3d02){logger['error'](_0x3f3d02[_0x4c2f('0x2f')]);if(_0x3f3d02[_0x4c2f('0x30')]){delete _0x3f3d02[_0x4c2f('0x30')];}_0x49b469[_0x4c2f('0x1d')](_0x271d0e)[_0x4c2f('0x31')](_0x3f3d02);};}exports[_0x4c2f('0x32')]=function(_0x49351c,_0x4e3475){var _0x175f81={},_0x273511={},_0x2af1ad={'count':0x0,'rows':[]};var _0x33736a=_[_0x4c2f('0x33')](db[_0x4c2f('0x34')][_0x4c2f('0x35')],function(_0x1276be){return{'name':_0x1276be[_0x4c2f('0x36')],'type':_0x1276be[_0x4c2f('0x37')][_0x4c2f('0x38')]};});_0x273511['model']=_['map'](_0x33736a,_0x4c2f('0x30'));_0x273511[_0x4c2f('0x39')]=_['keys'](_0x49351c[_0x4c2f('0x39')]);_0x273511['filters']=_[_0x4c2f('0x3a')](_0x273511[_0x4c2f('0x3b')],_0x273511[_0x4c2f('0x39')]);_0x175f81['attributes']=_[_0x4c2f('0x3a')](_0x273511[_0x4c2f('0x3b')],qs[_0x4c2f('0x3c')](_0x49351c['query'][_0x4c2f('0x3c')]));_0x175f81[_0x4c2f('0x3d')]=_0x175f81[_0x4c2f('0x3d')][_0x4c2f('0x3e')]?_0x175f81[_0x4c2f('0x3d')]:_0x273511[_0x4c2f('0x3b')];if(!_0x49351c['query'][_0x4c2f('0x3f')](_0x4c2f('0x40'))){_0x175f81[_0x4c2f('0x21')]=qs[_0x4c2f('0x21')](_0x49351c['query'][_0x4c2f('0x21')]);_0x175f81[_0x4c2f('0x1f')]=qs[_0x4c2f('0x1f')](_0x49351c['query']['offset']);}_0x175f81[_0x4c2f('0x41')]=qs['sort'](_0x49351c['query'][_0x4c2f('0x42')]);_0x175f81[_0x4c2f('0x43')]=qs[_0x4c2f('0x44')](_[_0x4c2f('0x45')](_0x49351c[_0x4c2f('0x39')],_0x273511[_0x4c2f('0x44')]),_0x33736a);if(_0x49351c[_0x4c2f('0x39')]['filter']){_0x175f81[_0x4c2f('0x43')]=_[_0x4c2f('0x46')](_0x175f81['where'],{'$or':_['map'](_0x33736a,function(_0x134af1){if(_0x134af1['type']!==_0x4c2f('0x47')){var _0x3e236a={};_0x3e236a[_0x134af1[_0x4c2f('0x30')]]={'$like':'%'+_0x49351c[_0x4c2f('0x39')][_0x4c2f('0x48')]+'%'};return _0x3e236a;}})});}_0x175f81=_['merge']({},_0x175f81,_0x49351c[_0x4c2f('0x49')]);var _0x168039={'where':_0x175f81[_0x4c2f('0x43')]};return db[_0x4c2f('0x34')][_0x4c2f('0x22')](_0x168039)[_0x4c2f('0x29')](function(_0xfb72c3){_0x2af1ad[_0x4c2f('0x22')]=_0xfb72c3;if(_0x49351c[_0x4c2f('0x39')][_0x4c2f('0x4a')]){_0x175f81['include']=[{'all':!![]}];}return db[_0x4c2f('0x34')][_0x4c2f('0x4b')](_0x175f81);})[_0x4c2f('0x29')](function(_0x6fa755){_0x2af1ad[_0x4c2f('0x4c')]=_0x6fa755;return _0x2af1ad;})[_0x4c2f('0x29')](respondWithFilteredResult(_0x4e3475,_0x175f81))[_0x4c2f('0x4d')](handleError(_0x4e3475,null));};exports[_0x4c2f('0x4e')]=function(_0x348776,_0xf03006){var _0x2c9411={'raw':![],'where':{'id':_0x348776[_0x4c2f('0x4f')]['id']}},_0x1c9bd1={};_0x1c9bd1[_0x4c2f('0x3b')]=_[_0x4c2f('0x50')](db['VoicePrefix'][_0x4c2f('0x35')]);_0x1c9bd1['query']=_[_0x4c2f('0x50')](_0x348776['query']);_0x1c9bd1[_0x4c2f('0x44')]=_[_0x4c2f('0x3a')](_0x1c9bd1[_0x4c2f('0x3b')],_0x1c9bd1[_0x4c2f('0x39')]);_0x2c9411[_0x4c2f('0x3d')]=_['intersection'](_0x1c9bd1['model'],qs[_0x4c2f('0x3c')](_0x348776[_0x4c2f('0x39')][_0x4c2f('0x3c')]));_0x2c9411[_0x4c2f('0x3d')]=_0x2c9411[_0x4c2f('0x3d')][_0x4c2f('0x3e')]?_0x2c9411['attributes']:_0x1c9bd1[_0x4c2f('0x3b')];if(_0x348776['query']['includeAll']){_0x2c9411[_0x4c2f('0x51')]=[{'all':!![]}];}_0x2c9411=_[_0x4c2f('0x46')]({},_0x2c9411,_0x348776[_0x4c2f('0x49')]);return db[_0x4c2f('0x34')][_0x4c2f('0x52')](_0x2c9411)[_0x4c2f('0x29')](handleEntityNotFound(_0xf03006,null))[_0x4c2f('0x29')](respondWithResult(_0xf03006,null))[_0x4c2f('0x4d')](handleError(_0xf03006,null));};exports[_0x4c2f('0x2d')]=function(_0x1ffbda,_0x57e559){return db['VoicePrefix']['find']({'where':{'id':_0x1ffbda[_0x4c2f('0x4f')]['id']}})[_0x4c2f('0x29')](handleEntityNotFound(_0x57e559,null))['then'](removeEntity(_0x57e559,null))[_0x4c2f('0x4d')](handleError(_0x57e559,null));};exports[_0x4c2f('0x53')]=function(_0x1befc9,_0x889354){return db['VoicePrefix'][_0x4c2f('0x53')]()[_0x4c2f('0x29')](respondWithResult(_0x889354,null))['catch'](handleError(_0x889354,null));};exports['create']=function(_0x17b523,_0x3da426){var _0x7d4a5;return db[_0x4c2f('0x54')][_0x4c2f('0x55')](function(_0x46b996){return db[_0x4c2f('0x34')][_0x4c2f('0x56')](_0x17b523[_0x4c2f('0x57')],{'transaction':_0x46b996})[_0x4c2f('0x29')](function(_0x3dce67){_0x7d4a5=_0x3dce67[_0x4c2f('0x2a')]({'plain':!![]});return db['VoiceExtension'][_0x4c2f('0x52')]({'where':{'id':_0x7d4a5['VoiceExtensionId']},'raw':!![]})[_0x4c2f('0x29')](function(_0x528afe){return createVoicePrefixExtensions(_0x7d4a5,_0x528afe,_0x46b996);});});})[_0x4c2f('0x29')](function(){var _0x5ac22e=_0x17b523[_0x4c2f('0x58')]['get']({'plain':!![]});if(!_0x5ac22e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5ac22e[_0x4c2f('0x59')]===_0x4c2f('0x58')){var _0x1da18c=_0x7d4a5;return db[_0x4c2f('0x5a')][_0x4c2f('0x52')]({'where':{'name':'VoicePrefixes','userProfileId':_0x5ac22e[_0x4c2f('0x5b')]},'raw':!![]})['then'](function(_0x56c4cc){if(_0x56c4cc&&_0x56c4cc[_0x4c2f('0x5c')]===0x0){return db[_0x4c2f('0x2c')][_0x4c2f('0x56')]({'name':_0x1da18c[_0x4c2f('0x30')],'resourceId':_0x1da18c['id'],'type':_0x56c4cc['name'],'sectionId':_0x56c4cc['id']},{})[_0x4c2f('0x29')](function(){return _0x7d4a5;});}else{return _0x7d4a5;}})[_0x4c2f('0x4d')](function(_0x4b8413){logger[_0x4c2f('0x5d')](_0x4c2f('0x5e'),_0x4b8413);throw _0x4b8413;});}return _0x7d4a5;})[_0x4c2f('0x29')](respondWithResult(_0x3da426,null))[_0x4c2f('0x4d')](handleError(_0x3da426,null));};function Extension(_0x1b47b6,_0x309710,_0x3a6598,_0x2e0745){this[_0x4c2f('0x5f')]=_0x4c2f('0x60');this['exten']=_0x1b47b6;this[_0x4c2f('0x61')]=_0x3a6598;this['type']=_0x4c2f('0x62');this[_0x4c2f('0x63')]=_0x4c2f('0x64');this[_0x4c2f('0x65')]=_0x309710;this[_0x4c2f('0x66')]=_0x2e0745;}function createVoicePrefixExtensions(_0x59b308,_0x2d9b9d,_0x24ce19){return new BPromise(function(_0x41c69e,_0xecf76a){var _0x5ad18a=new Extension(formatPrefixName(_0x59b308[_0x4c2f('0x67')]),0x1,_0x4c2f('0x68'),_0x4c2f('0x69'));_0x5ad18a['VoicePrefixId']=_0x59b308['id'];return db['VoiceExtension']['create'](_0x5ad18a,{'transaction':_0x24ce19})[_0x4c2f('0x29')](function(_0x36e488){var _0x32a05b=_0x36e488[_0x4c2f('0x2a')]({'plain':!![]});var _0x274ea1=_[_0x4c2f('0x33')](addVoicePrefixExtensions(_0x59b308,_0x2d9b9d),function(_0x48d075){_0x48d075[_0x4c2f('0x6a')]=_0x32a05b['id'];_0x48d075[_0x4c2f('0x6b')]=_0x59b308['id'];return _0x48d075;});return db[_0x4c2f('0x6c')][_0x4c2f('0x6d')](_0x274ea1,{'transaction':_0x24ce19})['then'](function(_0x32e400){if(!_0x32e400){return _0xecf76a(_0x4c2f('0x6e'));}else{return _0x41c69e(_0x32e400);}})[_0x4c2f('0x4d')](function(_0x5aa99f){return _0xecf76a(_0x5aa99f);});});;});};function addVoicePrefixExtensions(_0x23a19e,_0xcb4df6){var _0x494335=[];var _0x5b2bd5=formatPrefixName(_0x23a19e[_0x4c2f('0x67')]);_0x494335[_0x4c2f('0x6f')](new Extension(_0x5b2bd5,0x2,_0x4c2f('0x70'),_0x4c2f('0x71')+_0x23a19e['name']));if(_0x23a19e[_0x4c2f('0x72')]){_0x494335[_0x4c2f('0x6f')](new Extension(_0x5b2bd5,0x3,'Set',_0x4c2f('0x73')+_0x23a19e[_0x4c2f('0x72')]));}else{_0x494335[_0x4c2f('0x6f')](new Extension(_0x5b2bd5,0x3,_0x4c2f('0x68'),_0x4c2f('0x74')));}_0x494335['push'](new Extension(_0x5b2bd5,0x4,_0x4c2f('0x75'),_0xcb4df6[_0x4c2f('0x5f')]+','+_0x4c2f('0x76')+(0x8+_0x23a19e[_0x4c2f('0x30')][_0x4c2f('0x3e')])+'}'+','+0x1));return _0x494335;}function formatPrefixName(_0x8370a8){var _0xead981='_';for(var _0x16d545=0x0;_0x16d545<_0x8370a8[_0x4c2f('0x3e')];_0x16d545++){if(_0x8370a8[_0x4c2f('0x77')](_0x16d545)=='-'){_0xead981+=_0x8370a8[_0x4c2f('0x77')](_0x16d545);}else{_0xead981+='['+_0x8370a8[_0x4c2f('0x77')](_0x16d545)+']';}}_0xead981+='.';return _0xead981;}exports[_0x4c2f('0x28')]=function(_0x5919f8,_0x3a3662,_0x9afd61){var _0x59a6d5=_0x5919f8[_0x4c2f('0x57')];_0x59a6d5[_0x4c2f('0x67')]=_0x4c2f('0x78')+_0x59a6d5[_0x4c2f('0x30')]+'-';return db[_0x4c2f('0x54')][_0x4c2f('0x55')](function(_0x33819c){return db[_0x4c2f('0x34')][_0x4c2f('0x28')](_0x59a6d5,{'where':{'id':_0x59a6d5['id']},'transaction':_0x33819c})[_0x4c2f('0x29')](function(){return db[_0x4c2f('0x6c')][_0x4c2f('0x2d')]({'where':{'VoicePrefixId':_0x59a6d5['id']},'transaction':_0x33819c})['then'](function(){return db['VoiceExtension'][_0x4c2f('0x52')]({'where':{'id':_0x59a6d5[_0x4c2f('0x6a')]},'raw':!![]})[_0x4c2f('0x29')](function(_0x3a6727){return createVoicePrefixExtensions(_0x59a6d5,_0x3a6727,_0x33819c);});});});})[_0x4c2f('0x29')](function(){return db[_0x4c2f('0x34')]['findById'](_0x59a6d5['id']);})['then'](respondWithResult(_0x3a3662,null))[_0x4c2f('0x4d')](handleError(_0x3a3662,null));};exports['addAgents']=function(_0xa574a2,_0x1701a8,_0x29ba5a){return db['VoicePrefix'][_0x4c2f('0x52')]({'where':{'id':_0xa574a2[_0x4c2f('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1701a8,null))[_0x4c2f('0x29')](function(_0x2d4322){if(_0x2d4322){return _0x2d4322[_0x4c2f('0x79')](_0xa574a2[_0x4c2f('0x57')][_0x4c2f('0x7a')],_[_0x4c2f('0x7b')](_0xa574a2[_0x4c2f('0x57')],[_0x4c2f('0x7a'),'id'])||{})['spread'](function(_0x98e184){for(var _0xb5cb0d=0x0;_0xb5cb0d<_0xa574a2[_0x4c2f('0x57')][_0x4c2f('0x7a')][_0x4c2f('0x3e')];_0xb5cb0d+=0x1){socket[_0x4c2f('0x7c')](_0x4c2f('0x7d'),{'UserId':Number(_0xa574a2[_0x4c2f('0x57')][_0x4c2f('0x7a')][_0xb5cb0d]),'VoicePrefixId':Number(_0xa574a2[_0x4c2f('0x4f')]['id'])});}return _0x98e184;});}})[_0x4c2f('0x29')](respondWithResult(_0x1701a8,null))[_0x4c2f('0x4d')](handleError(_0x1701a8,null));};exports[_0x4c2f('0x7e')]=function(_0x219613,_0x7b49fa,_0x228445){return db[_0x4c2f('0x34')][_0x4c2f('0x52')]({'where':{'id':_0x219613[_0x4c2f('0x4f')]['id']}})[_0x4c2f('0x29')](handleEntityNotFound(_0x7b49fa,null))[_0x4c2f('0x29')](function(_0x5d613f){if(_0x5d613f){return _0x5d613f[_0x4c2f('0x7e')](_0x219613[_0x4c2f('0x39')][_0x4c2f('0x7a')])[_0x4c2f('0x29')](function(){if(_[_0x4c2f('0x7f')](_0x219613['query'][_0x4c2f('0x7a')])){for(var _0x37e104=0x0;_0x37e104<_0x219613[_0x4c2f('0x39')]['ids'][_0x4c2f('0x3e')];_0x37e104+=0x1){socket[_0x4c2f('0x7c')](_0x4c2f('0x80'),{'UserId':Number(_0x219613['query'][_0x4c2f('0x7a')][_0x37e104]),'VoicePrefixId':Number(_0x219613[_0x4c2f('0x4f')]['id'])});}}else{socket[_0x4c2f('0x7c')](_0x4c2f('0x80'),{'UserId':Number(_0x219613[_0x4c2f('0x39')]['ids']),'VoicePrefixId':Number(_0x219613[_0x4c2f('0x4f')]['id'])});}});}})['then'](respondWithStatusCode(_0x7b49fa,null))['catch'](handleError(_0x7b49fa,null));};exports[_0x4c2f('0x81')]=function(_0x52254,_0x578bf5,_0x5864d6){var _0x206767={};var _0x19c751={};var _0x8f8946;var _0x2c400a;return db[_0x4c2f('0x34')][_0x4c2f('0x82')]({'where':{'id':_0x52254['params']['id']}})[_0x4c2f('0x29')](handleEntityNotFound(_0x578bf5,null))[_0x4c2f('0x29')](function(_0x11b439){if(_0x11b439){_0x8f8946=_0x11b439;_0x19c751[_0x4c2f('0x3b')]=_[_0x4c2f('0x50')](db[_0x4c2f('0x83')]['rawAttributes']);_0x19c751[_0x4c2f('0x39')]=_[_0x4c2f('0x50')](_0x52254['query']);_0x19c751[_0x4c2f('0x44')]=_[_0x4c2f('0x3a')](_0x19c751[_0x4c2f('0x3b')],_0x19c751['query']);_0x206767[_0x4c2f('0x3d')]=_[_0x4c2f('0x3a')](_0x19c751[_0x4c2f('0x3b')],qs[_0x4c2f('0x3c')](_0x52254[_0x4c2f('0x39')][_0x4c2f('0x3c')]));_0x206767[_0x4c2f('0x3d')]=_0x206767[_0x4c2f('0x3d')]['length']?_0x206767[_0x4c2f('0x3d')]:_0x19c751[_0x4c2f('0x3b')];_0x206767['order']=qs[_0x4c2f('0x42')](_0x52254[_0x4c2f('0x39')][_0x4c2f('0x42')]);_0x206767['where']=qs[_0x4c2f('0x44')](_[_0x4c2f('0x45')](_0x52254[_0x4c2f('0x39')],_0x19c751[_0x4c2f('0x44')]));if(_0x52254[_0x4c2f('0x39')][_0x4c2f('0x48')]){_0x206767[_0x4c2f('0x43')]=_[_0x4c2f('0x46')](_0x206767[_0x4c2f('0x43')],{'$or':_['map'](_0x206767['attributes'],function(_0x5c6561){var _0x4cec55={};_0x4cec55[_0x5c6561]={'$like':'%'+_0x52254[_0x4c2f('0x39')]['filter']+'%'};return _0x4cec55;})});}_0x206767=_[_0x4c2f('0x46')]({},_0x206767,_0x52254[_0x4c2f('0x49')]);return _0x8f8946[_0x4c2f('0x81')](_0x206767);}})['then'](function(_0x473fec){if(_0x473fec){_0x2c400a=_0x473fec[_0x4c2f('0x3e')];if(!_0x52254['query'][_0x4c2f('0x3f')]('nolimit')){_0x206767[_0x4c2f('0x21')]=qs['limit'](_0x52254[_0x4c2f('0x39')][_0x4c2f('0x21')]);_0x206767[_0x4c2f('0x1f')]=qs[_0x4c2f('0x1f')](_0x52254['query'][_0x4c2f('0x1f')]);}return _0x8f8946[_0x4c2f('0x81')](_0x206767);}})[_0x4c2f('0x29')](function(_0x2e68d2){if(_0x2e68d2){return _0x2e68d2?{'count':_0x2c400a,'rows':_0x2e68d2}:null;}})[_0x4c2f('0x29')](respondWithResult(_0x578bf5,null))[_0x4c2f('0x4d')](handleError(_0x578bf5,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 6874f5d..8c6038a 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 _0x32de=['VoicePrefix','setMaxListeners','save','update','remove','hasOwnProperty','hook','events'];(function(_0x311be2,_0x4d651b){var _0x357036=function(_0x1e34fd){while(--_0x1e34fd){_0x311be2['push'](_0x311be2['shift']());}};_0x357036(++_0x4d651b);}(_0x32de,0x1cf));var _0xe32d=function(_0x222550,_0x3c0a0c){_0x222550=_0x222550-0x0;var _0x58ac61=_0x32de[_0x222550];return _0x58ac61;};'use strict';var EventEmitter=require(_0xe32d('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0xe32d('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xe32d('0x2')](0x0);var events={'afterCreate':_0xe32d('0x3'),'afterUpdate':_0xe32d('0x4'),'afterDestroy':_0xe32d('0x5')};function emitEvent(_0x1b01b5){return function(_0x36e56e,_0x311b05,_0x3994b8){VoicePrefixEvents['emit'](_0x1b01b5+':'+_0x36e56e['id'],_0x36e56e);VoicePrefixEvents['emit'](_0x1b01b5,_0x36e56e);_0x3994b8(null);};}for(var e in events){if(events[_0xe32d('0x6')](e)){var event=events[e];VoicePrefix[_0xe32d('0x7')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0x3fff=['hook','exports','events','VoicePrefix','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x35bfd9,_0x1109ba){var _0x477aa7=function(_0x13eb30){while(--_0x13eb30){_0x35bfd9['push'](_0x35bfd9['shift']());}};_0x477aa7(++_0x1109ba);}(_0x3fff,0x142));var _0xf3ff=function(_0x5160bf,_0x511947){_0x5160bf=_0x5160bf-0x0;var _0x1d33a9=_0x3fff[_0x5160bf];return _0x1d33a9;};'use strict';var EventEmitter=require(_0xf3ff('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0xf3ff('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xf3ff('0x2')](0x0);var events={'afterCreate':_0xf3ff('0x3'),'afterUpdate':_0xf3ff('0x4'),'afterDestroy':_0xf3ff('0x5')};function emitEvent(_0x5988b7){return function(_0x1b4c30,_0x4c7254,_0x38218e){VoicePrefixEvents['emit'](_0x5988b7+':'+_0x1b4c30['id'],_0x1b4c30);VoicePrefixEvents[_0xf3ff('0x6')](_0x5988b7,_0x1b4c30);_0x38218e(null);};}for(var e in events){if(events[_0xf3ff('0x7')](e)){var event=events[e];VoicePrefix[_0xf3ff('0x8')](e,emitEvent(event));}}module[_0xf3ff('0x9')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 34ce59f..1691714 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 _0xf9d1=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','define','VoicePrefix','voice_prefixes'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0xf9d1,0xfc));var _0x1f9d=function(_0x4a4eb6,_0x5ef9a3){_0x4a4eb6=_0x4a4eb6-0x0;var _0x5308ce=_0xf9d1[_0x4a4eb6];return _0x5308ce;};'use strict';var _=require(_0x1f9d('0x0'));var util=require(_0x1f9d('0x1'));var logger=require(_0x1f9d('0x2'))(_0x1f9d('0x3'));var moment=require(_0x1f9d('0x4'));var BPromise=require(_0x1f9d('0x5'));var rp=require(_0x1f9d('0x6'));var fs=require('fs');var path=require(_0x1f9d('0x7'));var rimraf=require(_0x1f9d('0x8'));var config=require(_0x1f9d('0x9'));var attributes=require(_0x1f9d('0xa'));module['exports']=function(_0x466cf2,_0x7f21fa){return _0x466cf2[_0x1f9d('0xb')](_0x1f9d('0xc'),attributes,{'tableName':_0x1f9d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe3e4=['path','../../config/environment','./voicePrefix.attributes','define','VoicePrefix','voice_prefixes','../../config/logger','api','bluebird','request-promise'];(function(_0x33fadb,_0x2fe9d9){var _0x40935e=function(_0x193f52){while(--_0x193f52){_0x33fadb['push'](_0x33fadb['shift']());}};_0x40935e(++_0x2fe9d9);}(_0xe3e4,0x1be));var _0x4e3e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe3e4[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4e3e('0x0'))(_0x4e3e('0x1'));var moment=require('moment');var BPromise=require(_0x4e3e('0x2'));var rp=require(_0x4e3e('0x3'));var fs=require('fs');var path=require(_0x4e3e('0x4'));var rimraf=require('rimraf');var config=require(_0x4e3e('0x5'));var attributes=require(_0x4e3e('0x6'));module['exports']=function(_0x5d6e91,_0x13ca14){return _0x5d6e91[_0x4e3e('0x7')](_0x4e3e('0x8'),attributes,{'tableName':_0x4e3e('0x9'),'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 481199a..254ca12 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 _0x2d95=['VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x299b84,_0x193d99){var _0x13223a=function(_0x4727e4){while(--_0x4727e4){_0x299b84['push'](_0x299b84['shift']());}};_0x13223a(++_0x193d99);}(_0x2d95,0xca));var _0x52d9=function(_0x200289,_0x133e69){_0x200289=_0x200289-0x0;var _0x126483=_0x2d95[_0x200289];return _0x126483;};'use strict';var _=require(_0x52d9('0x0'));var util=require('util');var moment=require(_0x52d9('0x1'));var BPromise=require('bluebird');var rs=require(_0x52d9('0x2'));var fs=require('fs');var Redis=require(_0x52d9('0x3'));var db=require(_0x52d9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x52d9('0x5'))(_0x52d9('0x6'));var config=require(_0x52d9('0x7'));var jayson=require(_0x52d9('0x8'));var client=jayson[_0x52d9('0x9')][_0x52d9('0xa')]({'port':0x232a});config[_0x52d9('0xb')]=_[_0x52d9('0xc')](config[_0x52d9('0xb')],{'host':_0x52d9('0xd'),'port':0x18eb});var socket=require(_0x52d9('0xe'))(new Redis(config[_0x52d9('0xb')]));require(_0x52d9('0xf'))[_0x52d9('0x10')](socket);function respondWithRpcPromise(_0x5b0892,_0x57ffbd,_0x5a2ec3){return new BPromise(function(_0x28dbf4,_0x4474c2){return client[_0x52d9('0x11')](_0x5b0892,_0x5a2ec3)[_0x52d9('0x12')](function(_0xe82376){logger['info'](_0x52d9('0x13'),_0x57ffbd,_0x52d9('0x14'));logger[_0x52d9('0x15')](_0x52d9('0x16'),_0x57ffbd,'request\x20sent',JSON['stringify'](_0xe82376));if(_0xe82376[_0x52d9('0x17')]){if(_0xe82376[_0x52d9('0x17')][_0x52d9('0x18')]===0x1f4){logger[_0x52d9('0x17')](_0x52d9('0x13'),_0x57ffbd,_0xe82376[_0x52d9('0x17')]['message']);return _0x4474c2(_0xe82376[_0x52d9('0x17')][_0x52d9('0x19')]);}logger[_0x52d9('0x17')](_0x52d9('0x13'),_0x57ffbd,_0xe82376['error'][_0x52d9('0x19')]);return _0x28dbf4(_0xe82376['error'][_0x52d9('0x19')]);}else{logger['info'](_0x52d9('0x13'),_0x57ffbd,_0x52d9('0x14'));_0x28dbf4(_0xe82376[_0x52d9('0x1a')][_0x52d9('0x19')]);}})[_0x52d9('0x1b')](function(_0x359f0b){logger[_0x52d9('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x57ffbd,_0x359f0b);_0x4474c2(_0x359f0b);});});} \ No newline at end of file +var _0xca6e=['http','defaults','localhost','socket.io-emitter','redis','./voicePrefix.socket','register','request','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client'];(function(_0x5933fb,_0x9115ad){var _0x44d988=function(_0x295228){while(--_0x295228){_0x5933fb['push'](_0x5933fb['shift']());}};_0x44d988(++_0x9115ad);}(_0xca6e,0x1c1));var _0xeca6=function(_0x4d30d4,_0x3efb99){_0x4d30d4=_0x4d30d4-0x0;var _0x5425c8=_0xca6e[_0x4d30d4];return _0x5425c8;};'use strict';var _=require(_0xeca6('0x0'));var util=require(_0xeca6('0x1'));var moment=require(_0xeca6('0x2'));var BPromise=require(_0xeca6('0x3'));var rs=require(_0xeca6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeca6('0x5'))['db'];var utils=require(_0xeca6('0x6'));var logger=require('../../config/logger')(_0xeca6('0x7'));var config=require('../../config/environment');var jayson=require(_0xeca6('0x8'));var client=jayson[_0xeca6('0x9')][_0xeca6('0xa')]({'port':0x232a});config['redis']=_[_0xeca6('0xb')](config['redis'],{'host':_0xeca6('0xc'),'port':0x18eb});var socket=require(_0xeca6('0xd'))(new Redis(config[_0xeca6('0xe')]));require(_0xeca6('0xf'))[_0xeca6('0x10')](socket);function respondWithRpcPromise(_0x4a3a13,_0xbf428e,_0xd946bf){return new BPromise(function(_0x31db18,_0x1499a2){return client[_0xeca6('0x11')](_0x4a3a13,_0xd946bf)['then'](function(_0x1f8b3d){logger[_0xeca6('0x12')](_0xeca6('0x13'),_0xbf428e,_0xeca6('0x14'));logger[_0xeca6('0x15')](_0xeca6('0x16'),_0xbf428e,'request\x20sent',JSON['stringify'](_0x1f8b3d));if(_0x1f8b3d[_0xeca6('0x17')]){if(_0x1f8b3d[_0xeca6('0x17')][_0xeca6('0x18')]===0x1f4){logger[_0xeca6('0x17')]('VoicePrefix,\x20%s,\x20%s',_0xbf428e,_0x1f8b3d[_0xeca6('0x17')]['message']);return _0x1499a2(_0x1f8b3d[_0xeca6('0x17')][_0xeca6('0x19')]);}logger[_0xeca6('0x17')](_0xeca6('0x13'),_0xbf428e,_0x1f8b3d[_0xeca6('0x17')]['message']);return _0x31db18(_0x1f8b3d[_0xeca6('0x17')]['message']);}else{logger[_0xeca6('0x12')]('VoicePrefix,\x20%s,\x20%s',_0xbf428e,_0xeca6('0x14'));_0x31db18(_0x1f8b3d[_0xeca6('0x1a')][_0xeca6('0x19')]);}})['catch'](function(_0x516b94){logger[_0xeca6('0x17')](_0xeca6('0x13'),_0xbf428e,_0x516b94);_0x1499a2(_0x516b94);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 488673e..dc9e36b 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 _0x644a=['voicePrefix:','./voicePrefix.events','save','remove','update','emit','removeListener','register','length'];(function(_0x32b045,_0x1e2449){var _0x1d7bc5=function(_0x14a861){while(--_0x14a861){_0x32b045['push'](_0x32b045['shift']());}};_0x1d7bc5(++_0x1e2449);}(_0x644a,0xfd));var _0xa644=function(_0x21bfc8,_0x2a67d2){_0x21bfc8=_0x21bfc8-0x0;var _0x2029c0=_0x644a[_0x21bfc8];return _0x2029c0;};'use strict';var VoicePrefixEvents=require(_0xa644('0x0'));var events=[_0xa644('0x1'),_0xa644('0x2'),_0xa644('0x3')];function createListener(_0x3a3218,_0x48801b){return function(_0x1423b7){_0x48801b[_0xa644('0x4')](_0x3a3218,_0x1423b7);};}function removeListener(_0x526de6,_0x4f6ed9){return function(){VoicePrefixEvents[_0xa644('0x5')](_0x526de6,_0x4f6ed9);};}exports[_0xa644('0x6')]=function(_0x3e1ca6){for(var _0x5d78a7=0x0,_0xa4af13=events[_0xa644('0x7')];_0x5d78a7<_0xa4af13;_0x5d78a7++){var _0x4f8b23=events[_0x5d78a7];var _0x15995f=createListener(_0xa644('0x8')+_0x4f8b23,_0x3e1ca6);VoicePrefixEvents['on'](_0x4f8b23,_0x15995f);}}; \ No newline at end of file +var _0x3fb7=['register','length','voicePrefix:','save','update','removeListener'];(function(_0x3d86f5,_0x257914){var _0x2d6881=function(_0x2d912e){while(--_0x2d912e){_0x3d86f5['push'](_0x3d86f5['shift']());}};_0x2d6881(++_0x257914);}(_0x3fb7,0x189));var _0x73fb=function(_0xca3a3,_0x4e5711){_0xca3a3=_0xca3a3-0x0;var _0x5212cc=_0x3fb7[_0xca3a3];return _0x5212cc;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0x73fb('0x0'),'remove',_0x73fb('0x1')];function createListener(_0x302333,_0x4e9e05){return function(_0xdecce4){_0x4e9e05['emit'](_0x302333,_0xdecce4);};}function removeListener(_0x309b77,_0x2c4f8c){return function(){VoicePrefixEvents[_0x73fb('0x2')](_0x309b77,_0x2c4f8c);};}exports[_0x73fb('0x3')]=function(_0x3330e3){for(var _0x423496=0x0,_0x33d35b=events[_0x73fb('0x4')];_0x423496<_0x33d35b;_0x423496++){var _0x1455de=events[_0x423496];var _0x2413ee=createListener(_0x73fb('0x5')+_0x1455de,_0x3330e3);VoicePrefixEvents['on'](_0x1455de,_0x2413ee);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index fa16d3a..1b0c5d2 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 _0xc830=['/:id/blacklists','getBlackLists','post','/:id/clone','clone','addTeams','addLists','put','destroy','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./voiceQueue.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','getLists'];(function(_0x3b8c69,_0x4d4652){var _0x48f80d=function(_0x4d6672){while(--_0x4d6672){_0x3b8c69['push'](_0x3b8c69['shift']());}};_0x48f80d(++_0x4d4652);}(_0xc830,0xdc));var _0x0c83=function(_0x56b81a,_0x289618){_0x56b81a=_0x56b81a-0x0;var _0x1b48cb=_0xc830[_0x56b81a];return _0x1b48cb;};'use strict';var multer=require(_0x0c83('0x0'));var util=require(_0x0c83('0x1'));var path=require(_0x0c83('0x2'));var timeout=require('connect-timeout');var express=require(_0x0c83('0x3'));var router=express[_0x0c83('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0c83('0x5'));var interaction=require(_0x0c83('0x6'));var config=require('../../config/environment');var controller=require(_0x0c83('0x7'));router[_0x0c83('0x8')]('/',auth[_0x0c83('0x9')](),controller[_0x0c83('0xa')]);router['get'](_0x0c83('0xb'),auth[_0x0c83('0x9')](),controller[_0x0c83('0xc')]);router['get'](_0x0c83('0xd'),auth[_0x0c83('0x9')](),controller['getHoppers']);router['get'](_0x0c83('0xe'),auth[_0x0c83('0x9')](),controller[_0x0c83('0xf')]);router['get'](_0x0c83('0x10'),auth['isAuthenticated'](),controller['getHopperFinals']);router[_0x0c83('0x8')](_0x0c83('0x11'),auth['isAuthenticated'](),controller[_0x0c83('0x12')]);router['get'](_0x0c83('0x13'),auth[_0x0c83('0x9')](),controller[_0x0c83('0x14')]);router['get'](_0x0c83('0x15'),auth[_0x0c83('0x9')](),controller[_0x0c83('0x16')]);router[_0x0c83('0x8')](_0x0c83('0x17'),auth[_0x0c83('0x9')](),controller[_0x0c83('0x18')]);router[_0x0c83('0x8')]('/:id/lists',auth[_0x0c83('0x9')](),controller[_0x0c83('0x19')]);router[_0x0c83('0x8')](_0x0c83('0x1a'),auth[_0x0c83('0x9')](),controller[_0x0c83('0x1b')]);router['post']('/',auth[_0x0c83('0x9')](),controller['create']);router[_0x0c83('0x1c')](_0x0c83('0x1d'),auth['isAuthenticated'](),controller[_0x0c83('0x1e')]);router[_0x0c83('0x1c')](_0x0c83('0x13'),auth[_0x0c83('0x9')](),controller[_0x0c83('0x1f')]);router['post']('/:id/users',auth[_0x0c83('0x9')](),controller['addAgents']);router['post']('/:id/lists',auth[_0x0c83('0x9')](),controller[_0x0c83('0x20')]);router[_0x0c83('0x1c')](_0x0c83('0x1a'),auth[_0x0c83('0x9')](),controller['addBlackLists']);router[_0x0c83('0x21')](_0x0c83('0xb'),auth[_0x0c83('0x9')](),controller['update']);router['delete'](_0x0c83('0xb'),auth[_0x0c83('0x9')](),controller[_0x0c83('0x22')]);router[_0x0c83('0x23')]('/:id/teams',auth[_0x0c83('0x9')](),controller[_0x0c83('0x24')]);router[_0x0c83('0x23')](_0x0c83('0x15'),auth[_0x0c83('0x9')](),controller[_0x0c83('0x25')]);router[_0x0c83('0x23')]('/:id/lists',auth[_0x0c83('0x9')](),controller[_0x0c83('0x26')]);router[_0x0c83('0x23')](_0x0c83('0x1a'),auth[_0x0c83('0x9')](),controller[_0x0c83('0x27')]);module[_0x0c83('0x28')]=router; \ No newline at end of file +var _0x5d02=['addAgents','addLists','addBlackLists','put','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceQueue.controller','get','isAuthenticated','/:id','show','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','/:id/users','/:id/members','getMembers','/:id/lists','getLists','/:id/blacklists','post','create','/:id/clone','clone'];(function(_0x516c2d,_0x533a6f){var _0x3078f5=function(_0x91877f){while(--_0x91877f){_0x516c2d['push'](_0x516c2d['shift']());}};_0x3078f5(++_0x533a6f);}(_0x5d02,0x18e));var _0x25d0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5d02[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x25d0('0x0'));var path=require(_0x25d0('0x1'));var timeout=require(_0x25d0('0x2'));var express=require(_0x25d0('0x3'));var router=express[_0x25d0('0x4')]();var fs_extra=require(_0x25d0('0x5'));var auth=require(_0x25d0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x25d0('0x7'));var controller=require(_0x25d0('0x8'));router[_0x25d0('0x9')]('/',auth[_0x25d0('0xa')](),controller['index']);router[_0x25d0('0x9')](_0x25d0('0xb'),auth[_0x25d0('0xa')](),controller[_0x25d0('0xc')]);router[_0x25d0('0x9')](_0x25d0('0xd'),auth[_0x25d0('0xa')](),controller[_0x25d0('0xe')]);router[_0x25d0('0x9')]('/:id/hopper_histories',auth[_0x25d0('0xa')](),controller[_0x25d0('0xf')]);router[_0x25d0('0x9')](_0x25d0('0x10'),auth[_0x25d0('0xa')](),controller[_0x25d0('0x11')]);router[_0x25d0('0x9')](_0x25d0('0x12'),auth['isAuthenticated'](),controller[_0x25d0('0x13')]);router[_0x25d0('0x9')](_0x25d0('0x14'),auth['isAuthenticated'](),controller[_0x25d0('0x15')]);router[_0x25d0('0x9')](_0x25d0('0x16'),auth['isAuthenticated'](),controller['getAgents']);router['get'](_0x25d0('0x17'),auth[_0x25d0('0xa')](),controller[_0x25d0('0x18')]);router['get'](_0x25d0('0x19'),auth[_0x25d0('0xa')](),controller[_0x25d0('0x1a')]);router[_0x25d0('0x9')](_0x25d0('0x1b'),auth[_0x25d0('0xa')](),controller['getBlackLists']);router[_0x25d0('0x1c')]('/',auth[_0x25d0('0xa')](),controller[_0x25d0('0x1d')]);router[_0x25d0('0x1c')](_0x25d0('0x1e'),auth[_0x25d0('0xa')](),controller[_0x25d0('0x1f')]);router[_0x25d0('0x1c')](_0x25d0('0x14'),auth[_0x25d0('0xa')](),controller['addTeams']);router[_0x25d0('0x1c')](_0x25d0('0x16'),auth['isAuthenticated'](),controller[_0x25d0('0x20')]);router['post'](_0x25d0('0x19'),auth[_0x25d0('0xa')](),controller[_0x25d0('0x21')]);router[_0x25d0('0x1c')](_0x25d0('0x1b'),auth['isAuthenticated'](),controller[_0x25d0('0x22')]);router[_0x25d0('0x23')](_0x25d0('0xb'),auth[_0x25d0('0xa')](),controller[_0x25d0('0x24')]);router[_0x25d0('0x25')](_0x25d0('0xb'),auth['isAuthenticated'](),controller[_0x25d0('0x26')]);router[_0x25d0('0x25')](_0x25d0('0x14'),auth[_0x25d0('0xa')](),controller[_0x25d0('0x27')]);router[_0x25d0('0x25')](_0x25d0('0x16'),auth['isAuthenticated'](),controller[_0x25d0('0x28')]);router[_0x25d0('0x25')](_0x25d0('0x19'),auth[_0x25d0('0xa')](),controller[_0x25d0('0x29')]);router['delete'](_0x25d0('0x1b'),auth[_0x25d0('0xa')](),controller[_0x25d0('0x2a')]);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 cf44fb6..ec20f24 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 _0xb698=['Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','tTxX','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#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','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','exports','STRING','name','ENUM','outbound','ringall','fewestcalls','random','rrmemory','linear','wrandom','rrordered','setDataValue','getDataValue','type','dialMethod','strategy','inbound','booked','roundrobin','progressive','predictive','INTEGER','yes','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','power','Dial\x20Method.','UNSIGNED'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xb698,0x16a));var _0x8b69=function(_0x29cf74,_0x3656ba){_0x29cf74=_0x29cf74-0x0;var _0x5e4cab=_0xb698[_0x29cf74];return _0x5e4cab;};'use strict';var Sequelize=require('sequelize');module[_0x8b69('0x0')]={'name':{'type':Sequelize[_0x8b69('0x1')],'allowNull':![],'unique':_0x8b69('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x8b69('0x3')]('inbound',_0x8b69('0x4')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0x8b69('0x1')],'defaultValue':'default'},'announce':{'type':Sequelize[_0x8b69('0x1')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0x8b69('0x5'),'leastrecent',_0x8b69('0x6'),_0x8b69('0x7'),_0x8b69('0x8'),_0x8b69('0x9'),_0x8b69('0xa'),_0x8b69('0xb')),'allowNull':![],'defaultValue':_0x8b69('0x5'),'set':function(_0x5dd232){this[_0x8b69('0xc')]('strategy',_0x5dd232?_0x5dd232:_0x8b69('0x8'));},'get':function(){var _0x3afde0=this[_0x8b69('0xd')](_0x8b69('0xe'));var _0x1a9251=this[_0x8b69('0xd')](_0x8b69('0xf'));var _0x130b01=this[_0x8b69('0xd')](_0x8b69('0x10'));if(_0x3afde0===_0x8b69('0x11')){return _0x130b01;}if(_0x1a9251===_0x8b69('0x12')&&_0x130b01==='rrmemory'||_0x1a9251===_0x8b69('0x12')&&_0x130b01===_0x8b69('0x13')){return _0x130b01;}if(_0x1a9251===_0x8b69('0x14')||_0x1a9251===_0x8b69('0x15')||_0x1a9251==='power'){return _0x130b01;}return null;}},'servicelevel':{'type':Sequelize[_0x8b69('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x8b69('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x8b69('0x16')](0xb)},'timeout':{'type':Sequelize[_0x8b69('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x8b69('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x8b69('0x1')]},'weight':{'type':Sequelize[_0x8b69('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x8b69('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x8b69('0x3')](_0x8b69('0x17'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0x8b69('0x3')](_0x8b69('0x17'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0x8b69('0x3')](_0x8b69('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x8b69('0x3')](_0x8b69('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM']('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x8b69('0x3')](_0x8b69('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x8b69('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x8b69('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x8b69('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x8b69('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0x8b69('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x8b69('0x3')](_0x8b69('0x17'),'no'),'defaultValue':_0x8b69('0x17')},'announce_holdtime':{'type':Sequelize[_0x8b69('0x3')](_0x8b69('0x17'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x8b69('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x8b69('0x17'),'no')},'announce_position_limit':{'type':Sequelize[_0x8b69('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x8b69('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x8b69('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x8b69('0x1')]},'queue_youarenext':{'type':Sequelize[_0x8b69('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x8b69('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x8b69('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x8b69('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x8b69('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x8b69('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x8b69('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x8b69('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x8b69('0x1')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x8b69('0x1')]},'queue_less_than':{'type':Sequelize[_0x8b69('0x1')]},'periodic_announce':{'type':Sequelize[_0x8b69('0x18')],'set':function(_0x3d762d){this[_0x8b69('0xc')](_0x8b69('0x19'),_0x3d762d?_0x3d762d[_0x8b69('0x1a')](','):[]);},'get':function(){return this[_0x8b69('0xd')](_0x8b69('0x19'))?this[_0x8b69('0xd')]('periodic_announce')[_0x8b69('0x1b')](','):[];}},'joinempty':{'type':Sequelize[_0x8b69('0x1')],'defaultValue':_0x8b69('0x17'),'set':function(_0x550798){this[_0x8b69('0xc')](_0x8b69('0x1c'),_0x550798?_0x550798[_0x8b69('0x1a')](','):undefined);},'get':function(){return this[_0x8b69('0xd')](_0x8b69('0x1c'))?this['getDataValue']('joinempty')[_0x8b69('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x8b69('0x1')],'defaultValue':'no','set':function(_0x32b81f){this[_0x8b69('0xc')](_0x8b69('0x1d'),_0x32b81f?_0x32b81f['join'](','):undefined);},'get':function(){return this['getDataValue'](_0x8b69('0x1d'))?this[_0x8b69('0xd')](_0x8b69('0x1d'))['split'](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x8b69('0x3')](_0x8b69('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x8b69('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0x8b69('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x8b69('0x1')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0x8b69('0x1e')],'defaultValue':0x0,'set':function(_0x577a5a){this['setDataValue'](_0x8b69('0x1f'),_0x577a5a);if(_0x577a5a){if(this['getDataValue'](_0x8b69('0x20'))<0x2){this[_0x8b69('0xc')](_0x8b69('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x8b69('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x8b69('0x1e')],'defaultValue':0x0,'comment':_0x8b69('0x21')},'dialMethod':{'type':Sequelize['ENUM'](_0x8b69('0x22'),_0x8b69('0x14'),_0x8b69('0x23'),_0x8b69('0x15'),_0x8b69('0x12')),'defaultValue':_0x8b69('0x14'),'comment':_0x8b69('0x24')},'dialLimitChannel':{'type':Sequelize[_0x8b69('0x16')](0x4)[_0x8b69('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x8b69('0x26')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x8b69('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x8b69('0x27')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x8b69('0x25')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x8b69('0x28')},'dialPredictiveOptimization':{'type':Sequelize[_0x8b69('0x3')](_0x8b69('0x29'),_0x8b69('0x2a')),'defaultValue':'dropRate','comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x8b69('0x2b')](0x2)[_0x8b69('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x8b69('0x2c')},'dialPredictiveInterval':{'type':Sequelize[_0x8b69('0x16')](0x3)[_0x8b69('0x25')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x8b69('0x2d')},'dialOriginateCallerIdName':{'type':Sequelize[_0x8b69('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x8b69('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x8b69('0x16')](0x3)[_0x8b69('0x25')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0x8b69('0x1')],'defaultValue':_0x8b69('0x2e'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0x8b69('0x16')](0x3)[_0x8b69('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8b69('0x2f')},'dialQueueProject':{'type':Sequelize[_0x8b69('0x1')],'comment':_0x8b69('0x30')},'dialCongestionMaxRetry':{'type':Sequelize[_0x8b69('0x16')](0x3)[_0x8b69('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8b69('0x31')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x8b69('0x16')](0x5)[_0x8b69('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8b69('0x32')},'dialBusyMaxRetry':{'type':Sequelize[_0x8b69('0x16')](0x3)[_0x8b69('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8b69('0x33')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x8b69('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8b69('0x34')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x8b69('0x16')](0x3)[_0x8b69('0x25')],'defaultValue':0x3,'comment':_0x8b69('0x35')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x8b69('0x16')](0x5)[_0x8b69('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x8b69('0x16')](0x3)[_0x8b69('0x25')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x8b69('0x36')},'dialTimezone':{'type':Sequelize[_0x8b69('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x8b69('0x1')],'defaultValue':_0x8b69('0x37')},'dialPrefix':{'type':Sequelize[_0x8b69('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x8b69('0x3')](_0x8b69('0x38'),_0x8b69('0x39'),_0x8b69('0x3a')),'defaultValue':_0x8b69('0x38')},'dialAMDActive':{'type':Sequelize[_0x8b69('0x1e')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x8b69('0x16')](0x9)[_0x8b69('0x25')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x8b69('0x3b')},'dialAMDGreeting':{'type':Sequelize[_0x8b69('0x16')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x8b69('0x16')](0x9)[_0x8b69('0x25')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x8b69('0x3c')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x8b69('0x16')](0x9)[_0x8b69('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8b69('0x3d')},'dialAMDMinWordLength':{'type':Sequelize[_0x8b69('0x16')](0x9)[_0x8b69('0x25')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x8b69('0x3e')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x8b69('0x16')](0x9)[_0x8b69('0x25')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x8b69('0x3f')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x8b69('0x16')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x8b69('0x40')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x8b69('0x16')](0x5)[_0x8b69('0x25')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x8b69('0x41')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x8b69('0x16')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8b69('0x42')},'dialRecallMeTimeout':{'type':Sequelize[_0x8b69('0x16')](0x5)[_0x8b69('0x25')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x8b69('0x43')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x8b69('0x44')},'dialOrderByScheduledAt':{'type':Sequelize[_0x8b69('0x3')](_0x8b69('0x45'),_0x8b69('0x46')),'defaultValue':_0x8b69('0x45')},'dialQueueProject2':{'type':Sequelize[_0x8b69('0x1')],'comment':_0x8b69('0x30')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8b69('0x47')},'dialCutDigit':{'type':Sequelize[_0x8b69('0x16')](0x3)[_0x8b69('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x8b69('0x16')](0x3)[_0x8b69('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8b69('0x48')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x8b69('0x16')](0x5)[_0x8b69('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8b69('0x49')},'dialDropMaxRetry':{'type':Sequelize[_0x8b69('0x16')](0x3)[_0x8b69('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x8b69('0x16')](0x5)[_0x8b69('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8b69('0x4a')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x8b69('0x16')](0x3)[_0x8b69('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8b69('0x4b')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8b69('0x4c')},'dialMachineMaxRetry':{'type':Sequelize[_0x8b69('0x16')](0x3)[_0x8b69('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8b69('0x4d')},'dialMachineRetryFrequency':{'type':Sequelize[_0x8b69('0x16')](0x5)[_0x8b69('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x8b69('0x16')](0x3)[_0x8b69('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8b69('0x4e')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x8b69('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8b69('0x16')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x8b69('0x1e')],'defaultValue':![],'comment':_0x8b69('0x4f'),'set':function(_0xf0f59b){if(!_0xf0f59b)this[_0x8b69('0xc')]('mandatoryDispositionPauseId',null);this[_0x8b69('0xc')]('mandatoryDisposition',_0xf0f59b);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x8b69('0x16')](0x3)[_0x8b69('0x25')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x8b69('0x25')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file +var _0x4c60=['predictive','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','UNSIGNED','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','inbound','default','ENUM','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','ringall','setDataValue','strategy','getDataValue','type','dialMethod','booked','roundrobin','progressive','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview'];(function(_0x22dac7,_0x45d32a){var _0x3e6cfa=function(_0x4c2e9d){while(--_0x4c2e9d){_0x22dac7['push'](_0x22dac7['shift']());}};_0x3e6cfa(++_0x45d32a);}(_0x4c60,0x166));var _0x04c6=function(_0x43fc15,_0x15b048){_0x43fc15=_0x43fc15-0x0;var _0x238c93=_0x4c60[_0x43fc15];return _0x238c93;};'use strict';var Sequelize=require(_0x04c6('0x0'));module[_0x04c6('0x1')]={'name':{'type':Sequelize[_0x04c6('0x2')],'allowNull':![],'unique':_0x04c6('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x04c6('0x4'),'outbound'),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0x04c6('0x2')],'defaultValue':_0x04c6('0x5')},'announce':{'type':Sequelize[_0x04c6('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x04c6('0x6')]('rr','ringall',_0x04c6('0x7'),_0x04c6('0x8'),_0x04c6('0x9'),_0x04c6('0xa'),_0x04c6('0xb'),_0x04c6('0xc'),'rrordered'),'allowNull':![],'defaultValue':_0x04c6('0xd'),'set':function(_0x21aa75){this[_0x04c6('0xe')](_0x04c6('0xf'),_0x21aa75?_0x21aa75:_0x04c6('0xa'));},'get':function(){var _0x527530=this[_0x04c6('0x10')](_0x04c6('0x11'));var _0x520780=this[_0x04c6('0x10')](_0x04c6('0x12'));var _0x1d645a=this[_0x04c6('0x10')](_0x04c6('0xf'));if(_0x527530==='inbound'){return _0x1d645a;}if(_0x520780===_0x04c6('0x13')&&_0x1d645a===_0x04c6('0xa')||_0x520780==='booked'&&_0x1d645a===_0x04c6('0x14')){return _0x1d645a;}if(_0x520780===_0x04c6('0x15')||_0x520780==='predictive'||_0x520780==='power'){return _0x1d645a;}return null;}},'servicelevel':{'type':Sequelize[_0x04c6('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x04c6('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x04c6('0x16')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x04c6('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x04c6('0x2')]},'weight':{'type':Sequelize[_0x04c6('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x04c6('0x6')]('yes','no'),'defaultValue':_0x04c6('0x17')},'autopause':{'type':Sequelize[_0x04c6('0x6')]('yes','no',_0x04c6('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0x04c6('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x04c6('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0x04c6('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x04c6('0x6')](_0x04c6('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x04c6('0x6')](_0x04c6('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x04c6('0x6')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x04c6('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x04c6('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x04c6('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x04c6('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x04c6('0x6')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x04c6('0x6')](_0x04c6('0x17'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0x04c6('0x6')](_0x04c6('0x17'),'no',_0x04c6('0x19')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x04c6('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x04c6('0x6')](_0x04c6('0x17'),'no')},'announce_position_limit':{'type':Sequelize[_0x04c6('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x04c6('0x6')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x04c6('0x2')]},'queue_youarenext':{'type':Sequelize[_0x04c6('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x04c6('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x04c6('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x04c6('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x04c6('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x04c6('0x2')]},'queue_quantity1':{'type':Sequelize[_0x04c6('0x2')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x04c6('0x2')]},'queue_less_than':{'type':Sequelize[_0x04c6('0x2')]},'periodic_announce':{'type':Sequelize[_0x04c6('0x1a')],'set':function(_0x227f8f){this[_0x04c6('0xe')](_0x04c6('0x1b'),_0x227f8f?_0x227f8f[_0x04c6('0x1c')](','):[]);},'get':function(){return this[_0x04c6('0x10')]('periodic_announce')?this[_0x04c6('0x10')](_0x04c6('0x1b'))[_0x04c6('0x1d')](','):[];}},'joinempty':{'type':Sequelize[_0x04c6('0x2')],'defaultValue':_0x04c6('0x17'),'set':function(_0x5aff1d){this[_0x04c6('0xe')](_0x04c6('0x1e'),_0x5aff1d?_0x5aff1d[_0x04c6('0x1c')](','):undefined);},'get':function(){return this[_0x04c6('0x10')](_0x04c6('0x1e'))?this[_0x04c6('0x10')]('joinempty')[_0x04c6('0x1d')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x04c6('0x2')],'defaultValue':'no','set':function(_0x3262b5){this[_0x04c6('0xe')](_0x04c6('0x1f'),_0x3262b5?_0x3262b5[_0x04c6('0x1c')](','):undefined);},'get':function(){return this[_0x04c6('0x10')]('leavewhenempty')?this['getDataValue'](_0x04c6('0x1f'))['split'](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0x04c6('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x04c6('0x6')](_0x04c6('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x04c6('0x6')](_0x04c6('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x04c6('0x2')]},'acw':{'type':Sequelize[_0x04c6('0x20')],'defaultValue':0x0,'set':function(_0x2fbe5c){this[_0x04c6('0xe')](_0x04c6('0x21'),_0x2fbe5c);if(_0x2fbe5c){if(this['getDataValue']('wrapuptime')<0x2){this[_0x04c6('0xe')](_0x04c6('0x22'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x04c6('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x04c6('0x20')],'defaultValue':0x0,'comment':_0x04c6('0x23')},'dialMethod':{'type':Sequelize[_0x04c6('0x6')](_0x04c6('0x24'),_0x04c6('0x15'),'power',_0x04c6('0x25'),_0x04c6('0x13')),'defaultValue':'progressive','comment':_0x04c6('0x26')},'dialLimitChannel':{'type':Sequelize[_0x04c6('0x16')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x04c6('0x27')},'dialLimitQueue':{'type':Sequelize[_0x04c6('0x16')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x04c6('0x28')},'dialPowerLevel':{'type':Sequelize[_0x04c6('0x29')](0x2)[_0x04c6('0x2a')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x04c6('0x2b')},'dialPredictiveOptimization':{'type':Sequelize[_0x04c6('0x6')](_0x04c6('0x2c'),_0x04c6('0x2d')),'defaultValue':_0x04c6('0x2d'),'comment':_0x04c6('0x2e')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x04c6('0x29')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0x04c6('0x16')](0x3)[_0x04c6('0x2a')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x04c6('0x2f')},'dialOriginateCallerIdName':{'type':Sequelize[_0x04c6('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x04c6('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x04c6('0x2a')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x04c6('0x30')},'dialQueueOptions':{'type':Sequelize[_0x04c6('0x2')],'defaultValue':_0x04c6('0x31'),'comment':_0x04c6('0x32')},'dialQueueTimeout':{'type':Sequelize[_0x04c6('0x16')](0x3)[_0x04c6('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x04c6('0x33')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x04c6('0x16')](0x3)[_0x04c6('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x04c6('0x34')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x04c6('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x04c6('0x35')},'dialBusyMaxRetry':{'type':Sequelize[_0x04c6('0x16')](0x3)[_0x04c6('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x04c6('0x36')},'dialBusyRetryFrequency':{'type':Sequelize[_0x04c6('0x16')](0x5)[_0x04c6('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x04c6('0x37')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x04c6('0x16')](0x3)[_0x04c6('0x2a')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x04c6('0x16')](0x5)[_0x04c6('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x04c6('0x38')},'dialGlobalMaxRetry':{'type':Sequelize[_0x04c6('0x16')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x04c6('0x39')},'dialTimezone':{'type':Sequelize[_0x04c6('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x04c6('0x2')],'defaultValue':_0x04c6('0x3a')},'dialPrefix':{'type':Sequelize[_0x04c6('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x04c6('0x6')](_0x04c6('0x3b'),'never',_0x04c6('0x3c')),'defaultValue':_0x04c6('0x3b')},'dialAMDActive':{'type':Sequelize[_0x04c6('0x20')],'defaultValue':0x0,'comment':_0x04c6('0x3d')},'dialAMDInitialSilence':{'type':Sequelize[_0x04c6('0x16')](0x9)[_0x04c6('0x2a')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x04c6('0x16')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x04c6('0x16')](0x9)[_0x04c6('0x2a')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x04c6('0x3e')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x04c6('0x2a')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x04c6('0x3f')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x04c6('0x2a')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x04c6('0x40')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x04c6('0x16')](0x9)[_0x04c6('0x2a')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x04c6('0x2a')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x04c6('0x41')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x04c6('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x04c6('0x16')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x04c6('0x42')},'dialRecallMeTimeout':{'type':Sequelize[_0x04c6('0x16')](0x5)[_0x04c6('0x2a')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0x04c6('0x20')],'defaultValue':0x0,'comment':_0x04c6('0x43')},'dialOrderByScheduledAt':{'type':Sequelize[_0x04c6('0x6')](_0x04c6('0x44'),_0x04c6('0x45')),'defaultValue':_0x04c6('0x44')},'dialQueueProject2':{'type':Sequelize[_0x04c6('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x04c6('0x20')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x04c6('0x16')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x04c6('0x16')](0x3)[_0x04c6('0x2a')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x04c6('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x04c6('0x46')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x04c6('0x16')](0x5)[_0x04c6('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x04c6('0x47')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x04c6('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x04c6('0x48')},'dialDropRetryFrequency':{'type':Sequelize[_0x04c6('0x16')](0x5)[_0x04c6('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x04c6('0x16')](0x3)[_0x04c6('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x04c6('0x49')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x04c6('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x04c6('0x4a')},'dialMachineMaxRetry':{'type':Sequelize[_0x04c6('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x04c6('0x4b')},'dialMachineRetryFrequency':{'type':Sequelize[_0x04c6('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x04c6('0x4c')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x04c6('0x16')](0x3)[_0x04c6('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x04c6('0x4d')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x04c6('0x16')](0x5)[_0x04c6('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x04c6('0x4e')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x04c6('0x16')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3b7e15){if(!_0x3b7e15)this[_0x04c6('0xe')]('mandatoryDispositionPauseId',null);this[_0x04c6('0xe')]('mandatoryDisposition',_0x3b7e15);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x04c6('0x16')](0x3)[_0x04c6('0x2a')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'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 0a84d29..f042e35 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 _0xf866=['offset','undefined','limit','count','set','Content-Range','apply','then','get','VoiceQueues','inbound','QueueCampaigns','filter','ignore','map','value','includes','type','find','name','UserProfileResource','destroy','sendStatus','error','stack','send','VoiceQueue','fieldName','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','merge','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','outbound','UserProfileSection','userProfileId','autoAssociation','omit','updatedAt','body','createdAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','findOne','CmHopper','VoiceQueueId','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','Agents','online','voicePause','forEach','penalty','transaction','each','UserVoiceQueueRt','isNil','interface','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','User','select','field','tq.TeamId','team_has_voice_queues','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','clone','push','sequelize','toString','QueryTypes','TeamId','all','union','compact','removeAgents','userVoiceQueue:remove','addAgents','spread','upsert','format','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','phone','scheduledAt','ContactId','ListId','NOW()','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','COALESCE(phone,\x27\x27)','fromQuery','cm_contacts','cm_hopper','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','./voiceQueue.socket','status','end','json'];(function(_0xb02753,_0x187fca){var _0xaeb42d=function(_0x54beb3){while(--_0x54beb3){_0xb02753['push'](_0xb02753['shift']());}};_0xaeb42d(++_0x187fca);}(_0xf866,0x141));var _0x6f86=function(_0x32c973,_0x4cd1ea){_0x32c973=_0x32c973-0x0;var _0x269874=_0xf866[_0x32c973];return _0x269874;};'use strict';var emlformat=require(_0x6f86('0x0'));var rimraf=require(_0x6f86('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6f86('0x2'));var rp=require(_0x6f86('0x3'));var moment=require(_0x6f86('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6f86('0x5'));var util=require(_0x6f86('0x6'));var path=require(_0x6f86('0x7'));var sox=require(_0x6f86('0x8'));var csv=require(_0x6f86('0x9'));var ejs=require(_0x6f86('0xa'));var fs=require('fs');var fs_extra=require(_0x6f86('0xb'));var _=require(_0x6f86('0xc'));var squel=require('squel');var crypto=require(_0x6f86('0xd'));var jsforce=require(_0x6f86('0xe'));var deskjs=require(_0x6f86('0xf'));var toCsv=require(_0x6f86('0x9'));var querystring=require('querystring');var Papa=require(_0x6f86('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6f86('0x11'));var as=require(_0x6f86('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6f86('0x13'));var utils=require(_0x6f86('0x14'));var config=require(_0x6f86('0x15'));var licenseUtil=require(_0x6f86('0x16'));var db=require(_0x6f86('0x17'))['db'];config[_0x6f86('0x18')]=_['defaults'](config[_0x6f86('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6f86('0x18')]));require(_0x6f86('0x19'))['register'](socket);function respondWithStatusCode(_0x44f382,_0x20f929){_0x20f929=_0x20f929||0xcc;return function(_0x5a33c7){if(_0x5a33c7){return _0x44f382['sendStatus'](_0x20f929);}return _0x44f382[_0x6f86('0x1a')](_0x20f929)[_0x6f86('0x1b')]();};}function respondWithResult(_0x30cd7c,_0x4579ce){_0x4579ce=_0x4579ce||0xc8;return function(_0x98a912){if(_0x98a912){return _0x30cd7c['status'](_0x4579ce)[_0x6f86('0x1c')](_0x98a912);}};}function respondWithFilteredResult(_0x351162,_0x59f090){return function(_0x5d18af){if(_0x5d18af){var _0x4d33eb=typeof _0x59f090[_0x6f86('0x1d')]===_0x6f86('0x1e')&&typeof _0x59f090[_0x6f86('0x1f')]===_0x6f86('0x1e');var _0x5049a7=_0x5d18af[_0x6f86('0x20')];var _0x46917c=_0x4d33eb?0x0:_0x59f090[_0x6f86('0x1d')];var _0xba054e=_0x4d33eb?_0x5d18af[_0x6f86('0x20')]:_0x59f090[_0x6f86('0x1d')]+_0x59f090[_0x6f86('0x1f')];var _0x5e3564;if(_0xba054e>=_0x5049a7){_0xba054e=_0x5049a7;_0x5e3564=0xc8;}else{_0x5e3564=0xce;}_0x351162[_0x6f86('0x1a')](_0x5e3564);return _0x351162[_0x6f86('0x21')](_0x6f86('0x22'),_0x46917c+'-'+_0xba054e+'/'+_0x5049a7)[_0x6f86('0x1c')](_0x5d18af);}return null;};}function patchUpdates(_0x593d67){return function(_0x8b2253){try{jsonpatch[_0x6f86('0x23')](_0x8b2253,_0x593d67,!![]);}catch(_0x50d839){return BPromise['reject'](_0x50d839);}return _0x8b2253['save']();};}function saveUpdates(_0x3ab5d4,_0x5a1cca){return function(_0x4b1a27){if(_0x4b1a27){return _0x4b1a27['update'](_0x3ab5d4)[_0x6f86('0x24')](function(_0x3e9d7f){return _0x3e9d7f;});}return null;};}function removeEntity(_0x38ea76,_0x10aee1){return function(_0x44bad6){if(_0x44bad6){return _0x44bad6['destroy']()[_0x6f86('0x24')](function(){var _0x347684=_0x44bad6[_0x6f86('0x25')]({'plain':!![]});var _0x410487=[{'name':_0x6f86('0x26'),'value':_0x6f86('0x27'),'ignore':![]},{'name':_0x6f86('0x28'),'value':'outbound','ignore':![]}];var _0x434063=_(_0x410487)[_0x6f86('0x29')](_0x6f86('0x2a'))[_0x6f86('0x2b')](_0x6f86('0x2c'))['value']();if(_[_0x6f86('0x2d')](_0x434063,_0x347684[_0x6f86('0x2e')])){return;}var _0x295e78=_[_0x6f86('0x2f')](_0x410487,[_0x6f86('0x2c'),_0x347684['type']])[_0x6f86('0x30')];return db[_0x6f86('0x31')][_0x6f86('0x32')]({'where':{'type':_0x295e78,'resourceId':_0x347684['id']}})[_0x6f86('0x24')](function(){return _0x44bad6;});})[_0x6f86('0x24')](function(){_0x38ea76[_0x6f86('0x1a')](0xcc)[_0x6f86('0x1b')]();});}};}function handleEntityNotFound(_0x2eacac,_0x2c63e7){return function(_0x48172f){if(!_0x48172f){_0x2eacac[_0x6f86('0x33')](0x194);}return _0x48172f;};}function handleError(_0x15d502,_0x2e245c){_0x2e245c=_0x2e245c||0x1f4;return function(_0x579916){logger[_0x6f86('0x34')](_0x579916[_0x6f86('0x35')]);if(_0x579916['name']){delete _0x579916[_0x6f86('0x30')];}_0x15d502[_0x6f86('0x1a')](_0x2e245c)[_0x6f86('0x36')](_0x579916);};}exports['index']=function(_0x17fd33,_0xbe8c4d){var _0x5661f4={},_0x5f0d10={},_0x1d0abd={'count':0x0,'rows':[]};var _0x55d486=_[_0x6f86('0x2b')](db[_0x6f86('0x37')]['rawAttributes'],function(_0x2ce3df){return{'name':_0x2ce3df[_0x6f86('0x38')],'type':_0x2ce3df[_0x6f86('0x2e')][_0x6f86('0x39')]};});_0x5f0d10['model']=_[_0x6f86('0x2b')](_0x55d486,_0x6f86('0x30'));_0x5f0d10[_0x6f86('0x3a')]=_[_0x6f86('0x3b')](_0x17fd33[_0x6f86('0x3a')]);_0x5f0d10[_0x6f86('0x3c')]=_['intersection'](_0x5f0d10[_0x6f86('0x3d')],_0x5f0d10[_0x6f86('0x3a')]);_0x5661f4[_0x6f86('0x3e')]=_[_0x6f86('0x3f')](_0x5f0d10[_0x6f86('0x3d')],qs['fields'](_0x17fd33[_0x6f86('0x3a')][_0x6f86('0x40')]));_0x5661f4[_0x6f86('0x3e')]=_0x5661f4['attributes'][_0x6f86('0x41')]?_0x5661f4['attributes']:_0x5f0d10['model'];if(!_0x17fd33['query'][_0x6f86('0x42')](_0x6f86('0x43'))){_0x5661f4['limit']=qs[_0x6f86('0x1f')](_0x17fd33['query'][_0x6f86('0x1f')]);_0x5661f4[_0x6f86('0x1d')]=qs[_0x6f86('0x1d')](_0x17fd33['query'][_0x6f86('0x1d')]);}_0x5661f4[_0x6f86('0x44')]=qs[_0x6f86('0x45')](_0x17fd33[_0x6f86('0x3a')]['sort']);_0x5661f4[_0x6f86('0x46')]=qs[_0x6f86('0x3c')](_[_0x6f86('0x47')](_0x17fd33[_0x6f86('0x3a')],_0x5f0d10['filters']),_0x55d486);if(_0x17fd33['query'][_0x6f86('0x29')]){_0x5661f4[_0x6f86('0x46')]=_['merge'](_0x5661f4[_0x6f86('0x46')],{'$or':_['map'](_0x55d486,function(_0x53f117){if(_0x53f117[_0x6f86('0x2e')]!=='VIRTUAL'){var _0x33164a={};_0x33164a[_0x53f117[_0x6f86('0x30')]]={'$like':'%'+_0x17fd33[_0x6f86('0x3a')]['filter']+'%'};return _0x33164a;}})});}_0x5661f4=_['merge']({},_0x5661f4,_0x17fd33[_0x6f86('0x48')]);var _0x1cad27={'where':_0x5661f4['where']};return db[_0x6f86('0x37')][_0x6f86('0x20')](_0x1cad27)[_0x6f86('0x24')](function(_0x274274){_0x1d0abd['count']=_0x274274;if(_0x17fd33[_0x6f86('0x3a')][_0x6f86('0x49')]){_0x5661f4[_0x6f86('0x4a')]=[{'all':!![]}];}return db[_0x6f86('0x37')][_0x6f86('0x4b')](_0x5661f4);})[_0x6f86('0x24')](function(_0x419105){_0x1d0abd[_0x6f86('0x4c')]=_0x419105;return _0x1d0abd;})[_0x6f86('0x24')](respondWithFilteredResult(_0xbe8c4d,_0x5661f4))[_0x6f86('0x4d')](handleError(_0xbe8c4d,null));};exports[_0x6f86('0x4e')]=function(_0x1d4b72,_0x537aea){var _0x57ccb5={'raw':![],'where':{'id':_0x1d4b72[_0x6f86('0x4f')]['id']}},_0x55469c={};_0x55469c[_0x6f86('0x3d')]=_[_0x6f86('0x3b')](db[_0x6f86('0x37')][_0x6f86('0x50')]);_0x55469c['query']=_[_0x6f86('0x3b')](_0x1d4b72[_0x6f86('0x3a')]);_0x55469c[_0x6f86('0x3c')]=_[_0x6f86('0x3f')](_0x55469c[_0x6f86('0x3d')],_0x55469c[_0x6f86('0x3a')]);_0x57ccb5[_0x6f86('0x3e')]=_[_0x6f86('0x3f')](_0x55469c[_0x6f86('0x3d')],qs[_0x6f86('0x40')](_0x1d4b72['query'][_0x6f86('0x40')]));_0x57ccb5[_0x6f86('0x3e')]=_0x57ccb5['attributes'][_0x6f86('0x41')]?_0x57ccb5[_0x6f86('0x3e')]:_0x55469c[_0x6f86('0x3d')];if(_0x1d4b72[_0x6f86('0x3a')][_0x6f86('0x49')]){_0x57ccb5[_0x6f86('0x4a')]=[{'all':!![]}];}_0x57ccb5=_[_0x6f86('0x51')]({},_0x57ccb5,_0x1d4b72['options']);return db[_0x6f86('0x37')]['find'](_0x57ccb5)[_0x6f86('0x24')](handleEntityNotFound(_0x537aea,null))['then'](respondWithResult(_0x537aea,null))[_0x6f86('0x4d')](handleError(_0x537aea,null));};exports[_0x6f86('0x52')]=function(_0x2feb37,_0x572378){return db[_0x6f86('0x37')][_0x6f86('0x52')](_0x2feb37['body'],{})[_0x6f86('0x24')](function(_0x4c932b){var _0x32e1b5=_0x2feb37[_0x6f86('0x53')][_0x6f86('0x25')]({'plain':!![]});if(!_0x32e1b5)throw new Error(_0x6f86('0x54'));if(_0x32e1b5[_0x6f86('0x55')]==='user'){var _0xc5033b=_0x4c932b[_0x6f86('0x25')]({'plain':!![]});var _0xc0a710=[{'name':_0x6f86('0x26'),'value':_0x6f86('0x27')},{'name':_0x6f86('0x28'),'value':_0x6f86('0x56')}];var _0x58ca66=_[_0x6f86('0x2f')](_0xc0a710,[_0x6f86('0x2c'),_0xc5033b['type']])[_0x6f86('0x30')];return db[_0x6f86('0x57')]['find']({'where':{'name':_0x58ca66,'userProfileId':_0x32e1b5[_0x6f86('0x58')]},'raw':!![]})[_0x6f86('0x24')](function(_0x277163){if(_0x277163&&_0x277163[_0x6f86('0x59')]===0x0){return db[_0x6f86('0x31')][_0x6f86('0x52')]({'name':_0xc5033b[_0x6f86('0x30')],'resourceId':_0xc5033b['id'],'type':_0x277163['name'],'sectionId':_0x277163['id']},{})['then'](function(){return _0x4c932b;});}else{return _0x4c932b;}})[_0x6f86('0x4d')](function(_0x3b2276){logger[_0x6f86('0x34')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3b2276);throw _0x3b2276;});}return _0x4c932b;})[_0x6f86('0x24')](respondWithResult(_0x572378,0xc9))[_0x6f86('0x4d')](handleError(_0x572378,null));};exports['clone']=function(_0x46593c,_0x1a6576){var _0x22d61e={'where':{'id':_0x46593c[_0x6f86('0x4f')]['id']}},_0x322071={};_0x322071['model']=_[_0x6f86('0x3b')](db[_0x6f86('0x37')][_0x6f86('0x50')]);_0x22d61e['attributes']=_[_0x6f86('0x3f')](_0x322071[_0x6f86('0x3d')],qs[_0x6f86('0x40')](_0x46593c['query'][_0x6f86('0x40')]));_0x22d61e[_0x6f86('0x3e')]=_0x22d61e[_0x6f86('0x3e')][_0x6f86('0x41')]?_0x22d61e[_0x6f86('0x3e')]:_0x322071[_0x6f86('0x3d')];if(_0x46593c[_0x6f86('0x3a')][_0x6f86('0x49')]){_0x22d61e[_0x6f86('0x4a')]=[{'all':!![]}];}_0x22d61e=_['merge']({},_0x22d61e,_0x46593c[_0x6f86('0x48')]);return db[_0x6f86('0x37')]['find'](_0x22d61e)[_0x6f86('0x24')](handleEntityNotFound(_0x1a6576,null))[_0x6f86('0x24')](function(_0x36e0c9){if(_0x36e0c9){var _0x1dc73a=_0x36e0c9[_0x6f86('0x25')]({'plain':!![]});_0x1dc73a=qs[_0x6f86('0x5a')](_0x1dc73a,['id','createdAt',_0x6f86('0x5b')]);_0x46593c[_0x6f86('0x5c')]=_[_0x6f86('0x5a')](_0x46593c[_0x6f86('0x5c')],['id',_0x6f86('0x5d'),_0x6f86('0x5b')]);return db[_0x6f86('0x37')][_0x6f86('0x52')](_['merge'](_0x1dc73a,_0x46593c[_0x6f86('0x5c')]),{'include':_0x46593c['query']['includeAll']?[{'all':!![]}]:undefined})[_0x6f86('0x24')](function(_0x1e98e9){var _0x46f2c0=_0x46593c['user'][_0x6f86('0x25')]({'plain':!![]});if(!_0x46f2c0)throw new Error(_0x6f86('0x54'));if(_0x46f2c0[_0x6f86('0x55')]===_0x6f86('0x53')){var _0x209cac=_0x1e98e9[_0x6f86('0x25')]({'plain':!![]});var _0x3304f0=[{'name':_0x6f86('0x26'),'value':'inbound'},{'name':_0x6f86('0x28'),'value':_0x6f86('0x56')}];var _0x29fac2=_['find'](_0x3304f0,[_0x6f86('0x2c'),_0x209cac[_0x6f86('0x2e')]])['name'];return db[_0x6f86('0x57')][_0x6f86('0x2f')]({'where':{'name':_0x29fac2,'userProfileId':_0x46f2c0[_0x6f86('0x58')]},'raw':!![]})[_0x6f86('0x24')](function(_0x5ce94a){if(_0x5ce94a&&_0x5ce94a[_0x6f86('0x59')]===0x0){return db[_0x6f86('0x31')]['create']({'name':_0x209cac[_0x6f86('0x30')],'resourceId':_0x209cac['id'],'type':_0x5ce94a[_0x6f86('0x30')],'sectionId':_0x5ce94a['id']},{})['then'](function(){return _0x1e98e9;});}else{return _0x1e98e9;}})['catch'](function(_0xf3f999){logger[_0x6f86('0x34')](_0x6f86('0x5e'),_0xf3f999);throw _0xf3f999;});}return _0x1e98e9;});}})['then'](respondWithResult(_0x1a6576,0xc9))[_0x6f86('0x4d')](handleError(_0x1a6576,null));};exports[_0x6f86('0x5f')]=function(_0x45a0ac,_0xcfaeb){if(_0x45a0ac[_0x6f86('0x5c')]['id']){delete _0x45a0ac[_0x6f86('0x5c')]['id'];}return db[_0x6f86('0x37')][_0x6f86('0x2f')]({'where':{'id':_0x45a0ac['params']['id']}})[_0x6f86('0x24')](handleEntityNotFound(_0xcfaeb,null))[_0x6f86('0x24')](saveUpdates(_0x45a0ac[_0x6f86('0x5c')],null))[_0x6f86('0x24')](respondWithResult(_0xcfaeb,null))[_0x6f86('0x4d')](handleError(_0xcfaeb,null));};exports[_0x6f86('0x32')]=function(_0x3b280b,_0x2bacbd){return db[_0x6f86('0x37')][_0x6f86('0x2f')]({'where':{'id':_0x3b280b[_0x6f86('0x4f')]['id']}})[_0x6f86('0x24')](handleEntityNotFound(_0x2bacbd,null))[_0x6f86('0x24')](removeEntity(_0x2bacbd,null))[_0x6f86('0x4d')](handleError(_0x2bacbd,null));};exports['getHoppers']=function(_0x32fb0c,_0x10857e,_0xcfa801){var _0x540005={'raw':![],'where':{}};var _0x2f28e7={};var _0x1bcb52={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x6f86('0x60')]({'where':{'id':_0x32fb0c[_0x6f86('0x4f')]['id']}})[_0x6f86('0x24')](handleEntityNotFound(_0x10857e,null))[_0x6f86('0x24')](function(_0x2c9489){if(_0x2c9489){_0x2f28e7['model']=_[_0x6f86('0x3b')](db[_0x6f86('0x61')][_0x6f86('0x50')]);_0x2f28e7[_0x6f86('0x3a')]=_[_0x6f86('0x3b')](_0x32fb0c['query']);_0x2f28e7[_0x6f86('0x3c')]=_[_0x6f86('0x3f')](_0x2f28e7[_0x6f86('0x3d')],_0x2f28e7[_0x6f86('0x3a')]);_0x540005[_0x6f86('0x3e')]=_[_0x6f86('0x3f')](_0x2f28e7[_0x6f86('0x3d')],qs[_0x6f86('0x40')](_0x32fb0c['query'][_0x6f86('0x40')]));_0x540005[_0x6f86('0x3e')]=_0x540005[_0x6f86('0x3e')][_0x6f86('0x41')]?_0x540005[_0x6f86('0x3e')]:_0x2f28e7[_0x6f86('0x3d')];if(!_0x32fb0c[_0x6f86('0x3a')]['hasOwnProperty'](_0x6f86('0x43'))){_0x540005[_0x6f86('0x1f')]=qs[_0x6f86('0x1f')](_0x32fb0c[_0x6f86('0x3a')][_0x6f86('0x1f')]);_0x540005['offset']=qs['offset'](_0x32fb0c[_0x6f86('0x3a')][_0x6f86('0x1d')]);}_0x540005[_0x6f86('0x44')]=qs[_0x6f86('0x45')](_0x32fb0c['query'][_0x6f86('0x45')]);_0x540005[_0x6f86('0x46')]=qs[_0x6f86('0x3c')](_[_0x6f86('0x47')](_0x32fb0c[_0x6f86('0x3a')],_0x2f28e7[_0x6f86('0x3c')]));_0x540005['where'][_0x6f86('0x62')]=_0x2c9489['id'];if(_0x32fb0c['query'][_0x6f86('0x29')]){_0x540005[_0x6f86('0x46')]=_[_0x6f86('0x51')](_0x540005[_0x6f86('0x46')],{'$or':_[_0x6f86('0x2b')](_0x540005[_0x6f86('0x3e')],function(_0x56c444){var _0x430905={};_0x430905[_0x56c444]={'$like':'%'+_0x32fb0c['query'][_0x6f86('0x29')]+'%'};return _0x430905;})});}_0x540005=_[_0x6f86('0x51')]({},_0x540005,_0x32fb0c[_0x6f86('0x48')]);return db['CmHopper'][_0x6f86('0x20')]({'where':_0x540005['where']})[_0x6f86('0x24')](function(_0x34546e){_0x1bcb52[_0x6f86('0x20')]=_0x34546e;if(_0x32fb0c['query'][_0x6f86('0x49')]){_0x540005[_0x6f86('0x4a')]=[{'all':!![]}];}return db[_0x6f86('0x61')][_0x6f86('0x4b')](_0x540005);})[_0x6f86('0x24')](function(_0x3bba89){_0x1bcb52['rows']=_0x3bba89;return _0x1bcb52;});}})['then'](respondWithFilteredResult(_0x10857e,_0x540005))[_0x6f86('0x4d')](handleError(_0x10857e,null));};exports['getHopperHistories']=function(_0x175c7f,_0x24be6e,_0x47e733){var _0x50a843={'raw':!![],'where':{}};var _0x20170d={};var _0x3e458d={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x6f86('0x60')]({'where':{'id':_0x175c7f[_0x6f86('0x4f')]['id']}})[_0x6f86('0x24')](handleEntityNotFound(_0x24be6e,null))[_0x6f86('0x24')](function(_0x36695e){if(_0x36695e){_0x20170d[_0x6f86('0x3d')]=_[_0x6f86('0x3b')](db[_0x6f86('0x63')]['rawAttributes']);_0x20170d[_0x6f86('0x3a')]=_[_0x6f86('0x3b')](_0x175c7f[_0x6f86('0x3a')]);_0x20170d[_0x6f86('0x3c')]=_[_0x6f86('0x3f')](_0x20170d[_0x6f86('0x3d')],_0x20170d[_0x6f86('0x3a')]);_0x50a843[_0x6f86('0x3e')]=_['intersection'](_0x20170d[_0x6f86('0x3d')],qs[_0x6f86('0x40')](_0x175c7f[_0x6f86('0x3a')]['fields']));_0x50a843['attributes']=_0x50a843[_0x6f86('0x3e')][_0x6f86('0x41')]?_0x50a843[_0x6f86('0x3e')]:_0x20170d['model'];if(!_0x175c7f[_0x6f86('0x3a')][_0x6f86('0x42')](_0x6f86('0x43'))){_0x50a843[_0x6f86('0x1f')]=qs['limit'](_0x175c7f[_0x6f86('0x3a')]['limit']);_0x50a843[_0x6f86('0x1d')]=qs[_0x6f86('0x1d')](_0x175c7f[_0x6f86('0x3a')]['offset']);}_0x50a843[_0x6f86('0x44')]=qs['sort'](_0x175c7f[_0x6f86('0x3a')][_0x6f86('0x45')]);_0x50a843['where']=qs[_0x6f86('0x3c')](_[_0x6f86('0x47')](_0x175c7f['query'],_0x20170d['filters']));_0x50a843[_0x6f86('0x46')][_0x6f86('0x62')]=_0x36695e['id'];if(_0x175c7f[_0x6f86('0x3a')][_0x6f86('0x29')]){_0x50a843[_0x6f86('0x46')]=_[_0x6f86('0x51')](_0x50a843['where'],{'$or':_[_0x6f86('0x2b')](_0x50a843[_0x6f86('0x3e')],function(_0x2afc45){var _0x3e719d={};_0x3e719d[_0x2afc45]={'$like':'%'+_0x175c7f['query']['filter']+'%'};return _0x3e719d;})});}_0x50a843=_[_0x6f86('0x51')]({},_0x50a843,_0x175c7f[_0x6f86('0x48')]);return db[_0x6f86('0x63')]['count']({'where':_0x50a843[_0x6f86('0x46')]})[_0x6f86('0x24')](function(_0x4be1bc){_0x3e458d[_0x6f86('0x20')]=_0x4be1bc;if(_0x175c7f[_0x6f86('0x3a')]['includeAll']){_0x50a843[_0x6f86('0x4a')]=[{'all':!![]}];}return db[_0x6f86('0x63')][_0x6f86('0x4b')](_0x50a843);})[_0x6f86('0x24')](function(_0x457763){_0x3e458d[_0x6f86('0x4c')]=_0x457763;return _0x3e458d;});}})['then'](respondWithFilteredResult(_0x24be6e,_0x50a843))[_0x6f86('0x4d')](handleError(_0x24be6e,null));};exports[_0x6f86('0x64')]=function(_0x245672,_0x2613f5,_0x4b2d3f){var _0x3ad225={'raw':!![],'where':{}};var _0x4ed2af={};var _0x464439={'count':0x0,'rows':[]};return db[_0x6f86('0x37')]['findOne']({'where':{'id':_0x245672[_0x6f86('0x4f')]['id']}})[_0x6f86('0x24')](handleEntityNotFound(_0x2613f5,null))['then'](function(_0x5c94b4){if(_0x5c94b4){_0x4ed2af['model']=_['keys'](db[_0x6f86('0x65')][_0x6f86('0x50')]);_0x4ed2af['query']=_[_0x6f86('0x3b')](_0x245672[_0x6f86('0x3a')]);_0x4ed2af[_0x6f86('0x3c')]=_[_0x6f86('0x3f')](_0x4ed2af[_0x6f86('0x3d')],_0x4ed2af[_0x6f86('0x3a')]);_0x3ad225[_0x6f86('0x3e')]=_[_0x6f86('0x3f')](_0x4ed2af[_0x6f86('0x3d')],qs[_0x6f86('0x40')](_0x245672['query'][_0x6f86('0x40')]));_0x3ad225[_0x6f86('0x3e')]=_0x3ad225[_0x6f86('0x3e')][_0x6f86('0x41')]?_0x3ad225[_0x6f86('0x3e')]:_0x4ed2af[_0x6f86('0x3d')];if(!_0x245672[_0x6f86('0x3a')][_0x6f86('0x42')](_0x6f86('0x43'))){_0x3ad225[_0x6f86('0x1f')]=qs[_0x6f86('0x1f')](_0x245672['query'][_0x6f86('0x1f')]);_0x3ad225[_0x6f86('0x1d')]=qs[_0x6f86('0x1d')](_0x245672[_0x6f86('0x3a')][_0x6f86('0x1d')]);}_0x3ad225[_0x6f86('0x44')]=qs['sort'](_0x245672[_0x6f86('0x3a')][_0x6f86('0x45')]);_0x3ad225['where']=qs['filters'](_[_0x6f86('0x47')](_0x245672[_0x6f86('0x3a')],_0x4ed2af[_0x6f86('0x3c')]));_0x3ad225['where']['VoiceQueueId']=_0x5c94b4['id'];if(_0x245672[_0x6f86('0x3a')][_0x6f86('0x29')]){_0x3ad225[_0x6f86('0x46')]=_[_0x6f86('0x51')](_0x3ad225[_0x6f86('0x46')],{'$or':_['map'](_0x3ad225['attributes'],function(_0x5768f3){var _0x281269={};_0x281269[_0x5768f3]={'$like':'%'+_0x245672[_0x6f86('0x3a')]['filter']+'%'};return _0x281269;})});}_0x3ad225=_['merge']({},_0x3ad225,_0x245672['options']);return db[_0x6f86('0x65')]['count']({'where':_0x3ad225[_0x6f86('0x46')]})[_0x6f86('0x24')](function(_0x4ec816){_0x464439['count']=_0x4ec816;if(_0x245672['query'][_0x6f86('0x49')]){_0x3ad225['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0x6f86('0x4b')](_0x3ad225);})[_0x6f86('0x24')](function(_0x5a63fa){_0x464439[_0x6f86('0x4c')]=_0x5a63fa;return _0x464439;});}})[_0x6f86('0x24')](respondWithFilteredResult(_0x2613f5,_0x3ad225))[_0x6f86('0x4d')](handleError(_0x2613f5,null));};exports[_0x6f86('0x66')]=function(_0x581d79,_0x401881,_0x2aefe7){var _0x2de424={'raw':!![],'where':{}};var _0x1f9330={};var _0x56be66={'count':0x0,'rows':[]};return db[_0x6f86('0x37')]['findOne']({'where':{'id':_0x581d79[_0x6f86('0x4f')]['id']}})[_0x6f86('0x24')](handleEntityNotFound(_0x401881,null))[_0x6f86('0x24')](function(_0x4fdae0){if(_0x4fdae0){_0x1f9330[_0x6f86('0x3d')]=_[_0x6f86('0x3b')](db[_0x6f86('0x67')][_0x6f86('0x50')]);_0x1f9330[_0x6f86('0x3a')]=_[_0x6f86('0x3b')](_0x581d79[_0x6f86('0x3a')]);_0x1f9330[_0x6f86('0x3c')]=_[_0x6f86('0x3f')](_0x1f9330[_0x6f86('0x3d')],_0x1f9330[_0x6f86('0x3a')]);_0x2de424[_0x6f86('0x3e')]=_[_0x6f86('0x3f')](_0x1f9330[_0x6f86('0x3d')],qs['fields'](_0x581d79[_0x6f86('0x3a')][_0x6f86('0x40')]));_0x2de424[_0x6f86('0x3e')]=_0x2de424['attributes'][_0x6f86('0x41')]?_0x2de424[_0x6f86('0x3e')]:_0x1f9330[_0x6f86('0x3d')];if(!_0x581d79[_0x6f86('0x3a')][_0x6f86('0x42')]('nolimit')){_0x2de424[_0x6f86('0x1f')]=qs[_0x6f86('0x1f')](_0x581d79[_0x6f86('0x3a')]['limit']);_0x2de424[_0x6f86('0x1d')]=qs[_0x6f86('0x1d')](_0x581d79[_0x6f86('0x3a')]['offset']);}_0x2de424[_0x6f86('0x44')]=qs[_0x6f86('0x45')](_0x581d79[_0x6f86('0x3a')]['sort']);_0x2de424[_0x6f86('0x46')]=qs[_0x6f86('0x3c')](_[_0x6f86('0x47')](_0x581d79[_0x6f86('0x3a')],_0x1f9330['filters']));_0x2de424['where'][_0x6f86('0x62')]=_0x4fdae0['id'];if(_0x581d79['query'][_0x6f86('0x29')]){_0x2de424[_0x6f86('0x46')]=_[_0x6f86('0x51')](_0x2de424[_0x6f86('0x46')],{'$or':_[_0x6f86('0x2b')](_0x2de424['attributes'],function(_0x5f2d20){var _0xfec962={};_0xfec962[_0x5f2d20]={'$like':'%'+_0x581d79[_0x6f86('0x3a')][_0x6f86('0x29')]+'%'};return _0xfec962;})});}_0x2de424=_[_0x6f86('0x51')]({},_0x2de424,_0x581d79[_0x6f86('0x48')]);return db[_0x6f86('0x67')][_0x6f86('0x20')]({'where':_0x2de424[_0x6f86('0x46')]})[_0x6f86('0x24')](function(_0x1863f3){_0x56be66['count']=_0x1863f3;if(_0x581d79[_0x6f86('0x3a')][_0x6f86('0x49')]){_0x2de424[_0x6f86('0x4a')]=[{'all':!![]}];}return db[_0x6f86('0x67')][_0x6f86('0x4b')](_0x2de424);})[_0x6f86('0x24')](function(_0x290fab){_0x56be66[_0x6f86('0x4c')]=_0x290fab;return _0x56be66;});}})['then'](respondWithFilteredResult(_0x401881,_0x2de424))[_0x6f86('0x4d')](handleError(_0x401881,null));};exports[_0x6f86('0x68')]=function(_0x13a0f0,_0x4c21eb,_0x77c01b){var _0x522c95={};var _0x340577={};var _0x7c77e7;var _0xe3aaa;return db[_0x6f86('0x37')][_0x6f86('0x60')]({'where':{'id':_0x13a0f0[_0x6f86('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4c21eb,null))[_0x6f86('0x24')](function(_0x132728){if(_0x132728){_0x7c77e7=_0x132728;_0x340577[_0x6f86('0x3d')]=_[_0x6f86('0x3b')](db[_0x6f86('0x69')][_0x6f86('0x50')]);_0x340577[_0x6f86('0x3a')]=_[_0x6f86('0x3b')](_0x13a0f0[_0x6f86('0x3a')]);_0x340577[_0x6f86('0x3c')]=_['intersection'](_0x340577[_0x6f86('0x3d')],_0x340577['query']);_0x522c95[_0x6f86('0x3e')]=_[_0x6f86('0x3f')](_0x340577[_0x6f86('0x3d')],qs[_0x6f86('0x40')](_0x13a0f0[_0x6f86('0x3a')]['fields']));_0x522c95[_0x6f86('0x3e')]=_0x522c95['attributes']['length']?_0x522c95[_0x6f86('0x3e')]:_0x340577[_0x6f86('0x3d')];_0x522c95[_0x6f86('0x44')]=qs['sort'](_0x13a0f0['query'][_0x6f86('0x45')]);_0x522c95[_0x6f86('0x46')]=qs[_0x6f86('0x3c')](_[_0x6f86('0x47')](_0x13a0f0[_0x6f86('0x3a')],_0x340577[_0x6f86('0x3c')]));if(_0x13a0f0[_0x6f86('0x3a')][_0x6f86('0x29')]){_0x522c95['where']=_[_0x6f86('0x51')](_0x522c95[_0x6f86('0x46')],{'$or':_['map'](_0x522c95['attributes'],function(_0xc633b9){var _0x32b4a9={};_0x32b4a9[_0xc633b9]={'$like':'%'+_0x13a0f0['query'][_0x6f86('0x29')]+'%'};return _0x32b4a9;})});}_0x522c95=_[_0x6f86('0x51')]({},_0x522c95,_0x13a0f0['options']);return _0x7c77e7[_0x6f86('0x68')](_0x522c95);}})['then'](function(_0x516894){if(_0x516894){_0xe3aaa=_0x516894[_0x6f86('0x41')];if(!_0x13a0f0[_0x6f86('0x3a')][_0x6f86('0x42')](_0x6f86('0x43'))){_0x522c95[_0x6f86('0x1f')]=qs[_0x6f86('0x1f')](_0x13a0f0[_0x6f86('0x3a')][_0x6f86('0x1f')]);_0x522c95[_0x6f86('0x1d')]=qs[_0x6f86('0x1d')](_0x13a0f0['query'][_0x6f86('0x1d')]);}return _0x7c77e7[_0x6f86('0x68')](_0x522c95);}})[_0x6f86('0x24')](function(_0x36b027){if(_0x36b027){return _0x36b027?{'count':_0xe3aaa,'rows':_0x36b027}:null;}})[_0x6f86('0x24')](respondWithResult(_0x4c21eb,null))[_0x6f86('0x4d')](handleError(_0x4c21eb,null));};exports[_0x6f86('0x6a')]=function(_0x887c7a,_0x24a10e,_0x28ce1c){var _0x24aa19=_0x887c7a[_0x6f86('0x5c')][_0x6f86('0x6b')];var _0x2628ad=_[_0x6f86('0x2b')](_0x24aa19,'id');return db['Team'][_0x6f86('0x4b')]({'where':{'id':_0x2628ad},'attributes':['id'],'include':[{'model':db['User'],'as':_0x6f86('0x6c'),'attributes':['id',_0x6f86('0x30'),_0x6f86('0x6d'),_0x6f86('0x6e'),'interface'],'raw':!![]}]})[_0x6f86('0x24')](function(_0x298995){if(_0x298995){var _0x266a2b=_['flatMap'](_0x298995,function(_0x2f7ef7){var _0x5cf558=_0x2f7ef7[_0x6f86('0x25')]({'plain':!![]});_0x5cf558[_0x6f86('0x6c')][_0x6f86('0x6f')](function(_0x4b6764){_0x4b6764[_0x6f86('0x70')]=_[_0x6f86('0x2f')](_0x24aa19,{'id':_0x5cf558['id']})[_0x6f86('0x70')];});return _0x5cf558['Agents'];});return db[_0x6f86('0x37')][_0x6f86('0x2f')]({'where':{'id':_0x887c7a[_0x6f86('0x4f')]['id']}})['then'](function(_0xf0e9de){return db['sequelize'][_0x6f86('0x71')](function(_0x4e58c0){return _0xf0e9de[_0x6f86('0x6a')](_0x2628ad,{'transaction':_0x4e58c0})[_0x6f86('0x24')](function(){return BPromise[_0x6f86('0x72')](_0x24aa19,function(_0x4086d1){return db['TeamVoiceQueue']['upsert']({'TeamId':_0x4086d1['id'],'VoiceQueueId':_0x887c7a[_0x6f86('0x4f')]['id'],'penalty':_0x4086d1[_0x6f86('0x70')]},{'transaction':_0x4e58c0});});})[_0x6f86('0x24')](function(){return BPromise[_0x6f86('0x72')](_0x266a2b,function(_0x41d092){return db['UserVoiceQueue']['findOrCreate']({'where':{'UserId':_0x41d092['id'],'VoiceQueueId':_0x887c7a['params']['id']},'defaults':{'penalty':_0x41d092['penalty']},'transaction':_0x4e58c0});});})[_0x6f86('0x24')](function(){return BPromise[_0x6f86('0x72')](_[_0x6f86('0x29')](_0x266a2b,{'online':!![]}),function(_0x8cd366){return db[_0x6f86('0x73')]['upsert']({'membername':_0x8cd366[_0x6f86('0x30')],'UserId':_0x8cd366['id'],'queue_name':_0xf0e9de[_0x6f86('0x30')],'VoiceQueueId':_0xf0e9de['id'],'interface':_[_0x6f86('0x74')](_0x8cd366[_0x6f86('0x75')])?util['format'](_0x6f86('0x76'),_0x8cd366['name']):_0x8cd366[_0x6f86('0x75')],'paused':_0x8cd366[_0x6f86('0x6e')]||![],'penalty':_0x8cd366[_0x6f86('0x70')]},{'transaction':_0x4e58c0});});})[_0x6f86('0x24')](function(){_0x266a2b[_0x6f86('0x6f')](function(_0xf47d10){socket[_0x6f86('0x77')](_0x6f86('0x78'),{'UserId':_0xf47d10['id'],'VoiceQueueId':_0xf0e9de['id']});});});});});}})[_0x6f86('0x24')](respondWithStatusCode(_0x24a10e,null))[_0x6f86('0x4d')](handleError(_0x24a10e,null));};exports[_0x6f86('0x79')]=function(_0x16ad92,_0x3931df,_0x256f0f){return db[_0x6f86('0x69')][_0x6f86('0x4b')]({'where':{'id':_0x16ad92[_0x6f86('0x3a')][_0x6f86('0x7a')]},'attributes':['id'],'include':[{'model':db[_0x6f86('0x7b')],'as':_0x6f86('0x6c'),'attributes':['id'],'raw':!![]}]})[_0x6f86('0x24')](handleEntityNotFound(_0x3931df,null))[_0x6f86('0x24')](function(_0x15e6f6){var _0x53d058=_[_0x6f86('0x2b')](_0x15e6f6,'id');var _0x21394b=[];var _0x4a06d9=[];var _0x524309=squel[_0x6f86('0x7c')]();_0x524309[_0x6f86('0x7d')](_0x6f86('0x7e'))['from'](_0x6f86('0x7f'),'tq')['join']('user_has_teams','ut',_0x6f86('0x80'))[_0x6f86('0x46')](_0x6f86('0x81'),_0x16ad92[_0x6f86('0x4f')]['id']);for(var _0x354f31=0x0;_0x354f31<_0x15e6f6[_0x6f86('0x41')];_0x354f31+=0x1){let _0x531f6f=_0x15e6f6[_0x354f31];for(var _0x33f1a4=0x0;_0x33f1a4<_0x531f6f[_0x6f86('0x6c')][_0x6f86('0x41')];_0x33f1a4+=0x1){let _0x388d70=_0x531f6f[_0x6f86('0x6c')][_0x33f1a4];var _0x3ac990=_0x524309[_0x6f86('0x82')]();_0x3ac990[_0x6f86('0x46')]('ut.UserId\x20=\x20?',_0x388d70['id']);_0x4a06d9[_0x6f86('0x83')](db[_0x6f86('0x84')]['query'](_0x3ac990[_0x6f86('0x85')](),{'type':db[_0x6f86('0x84')][_0x6f86('0x86')]['SELECT']})[_0x6f86('0x24')](function(_0x1df4e5){if(_0x1df4e5[_0x6f86('0x41')]===0x1){return _0x388d70['id'];}else{var _0x634af0=_['every'](_[_0x6f86('0x2b')](_0x1df4e5,_0x6f86('0x87')),function(_0x395ab7){return _['includes'](_0x53d058,_0x395ab7);});if(_0x634af0){return _0x388d70['id'];}}}));}}return BPromise[_0x6f86('0x88')](_0x4a06d9)[_0x6f86('0x24')](function(_0x522eec){_0x21394b=_(_0x21394b)[_0x6f86('0x89')](_0x522eec)[_0x6f86('0x8a')]()[_0x6f86('0x2c')]();return db[_0x6f86('0x37')][_0x6f86('0x2f')]({'where':{'id':_0x16ad92[_0x6f86('0x4f')]['id']}})['then'](function(_0x344e60){return db['sequelize']['transaction'](function(_0xcf65ae){return _0x344e60[_0x6f86('0x79')](_0x16ad92[_0x6f86('0x3a')][_0x6f86('0x7a')],{'transaction':_0xcf65ae})[_0x6f86('0x24')](function(){if(!_['isEmpty'](_0x21394b)){return _0x344e60[_0x6f86('0x8b')](_0x21394b,{'transaction':_0xcf65ae})['then'](function(){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x16ad92[_0x6f86('0x4f')]['id'],'UserId':_0x21394b},'transaction':_0xcf65ae});});}})[_0x6f86('0x24')](function(){_0x21394b['forEach'](function(_0x2ecf47){socket[_0x6f86('0x77')](_0x6f86('0x8c'),{'UserId':_0x2ecf47,'VoiceQueueId':_0x344e60['id']});});});});});});})[_0x6f86('0x24')](respondWithStatusCode(_0x3931df,null))[_0x6f86('0x4d')](handleError(_0x3931df,null));};exports[_0x6f86('0x8d')]=function(_0x4360b4,_0x9ab9bc,_0x305b5d){var _0x53fba6,_0x2f39d1;return db['VoiceQueue'][_0x6f86('0x2f')]({'where':{'id':_0x4360b4[_0x6f86('0x4f')]['id']}})[_0x6f86('0x24')](handleEntityNotFound(_0x9ab9bc,null))['then'](function(_0x258929){if(_0x258929){_0x2f39d1=_0x258929;return _0x258929[_0x6f86('0x8d')](_0x4360b4[_0x6f86('0x5c')][_0x6f86('0x7a')],_[_0x6f86('0x5a')](_0x4360b4[_0x6f86('0x5c')],[_0x6f86('0x7a'),'id'])||{})[_0x6f86('0x8e')](function(_0x346a03){for(var _0x2c4b2d=0x0;_0x2c4b2d<_0x4360b4[_0x6f86('0x5c')][_0x6f86('0x7a')][_0x6f86('0x41')];_0x2c4b2d+=0x1){socket[_0x6f86('0x77')](_0x6f86('0x78'),{'UserId':Number(_0x4360b4[_0x6f86('0x5c')]['ids'][_0x2c4b2d]),'VoiceQueueId':Number(_0x4360b4['params']['id'])});}return _0x346a03;});}})[_0x6f86('0x24')](function(_0x446e5a){_0x53fba6=_0x446e5a||[];if(_0x2f39d1){return db[_0x6f86('0x7b')][_0x6f86('0x4b')]({'where':{'id':_0x4360b4[_0x6f86('0x5c')][_0x6f86('0x7a')]},'attributes':['id',_0x6f86('0x30'),'online',_0x6f86('0x6e'),_0x6f86('0x75')],'raw':!![]});}})[_0x6f86('0x24')](function(_0x537a32){if(!_['isEmpty'](_0x537a32)){var _0x3a775b=[];for(var _0x44c56e=0x0;_0x44c56e<_0x537a32[_0x6f86('0x41')];_0x44c56e++){if(_0x537a32[_0x44c56e][_0x6f86('0x6d')]){_0x3a775b[_0x6f86('0x83')](db[_0x6f86('0x73')][_0x6f86('0x8f')]({'membername':_0x537a32[_0x44c56e]['name'],'UserId':_0x537a32[_0x44c56e]['id'],'queue_name':_0x2f39d1['name'],'VoiceQueueId':_0x2f39d1['id'],'interface':_['isNil'](_0x537a32[_0x44c56e][_0x6f86('0x75')])?util[_0x6f86('0x90')](_0x6f86('0x76'),_0x537a32[_0x44c56e][_0x6f86('0x30')]):_0x537a32[_0x44c56e][_0x6f86('0x75')],'paused':_0x537a32[_0x44c56e][_0x6f86('0x6e')]||![],'penalty':_0x4360b4[_0x6f86('0x5c')][_0x6f86('0x70')]||0x0}));}}return BPromise['all'](_0x3a775b);}})[_0x6f86('0x24')](function(){return _0x53fba6;})[_0x6f86('0x24')](respondWithResult(_0x9ab9bc,null))['catch'](handleError(_0x9ab9bc,null));};exports['removeAgents']=function(_0x109429,_0x505162,_0x46f91e){return db['VoiceQueue'][_0x6f86('0x2f')]({'where':{'id':_0x109429[_0x6f86('0x4f')]['id']}})['then'](handleEntityNotFound(_0x505162,null))[_0x6f86('0x24')](function(_0x153fbf){if(_0x153fbf){return _0x153fbf[_0x6f86('0x8b')](_0x109429[_0x6f86('0x3a')][_0x6f86('0x7a')])['then'](function(){if(_[_0x6f86('0x91')](_0x109429[_0x6f86('0x3a')][_0x6f86('0x7a')])){for(var _0x175c91=0x0;_0x175c91<_0x109429[_0x6f86('0x3a')]['ids']['length'];_0x175c91+=0x1){socket['emit']('userVoiceQueue:remove',{'UserId':Number(_0x109429['query'][_0x6f86('0x7a')][_0x175c91]),'VoiceQueueId':Number(_0x109429[_0x6f86('0x4f')]['id'])});}}else{socket[_0x6f86('0x77')]('userVoiceQueue:remove',{'UserId':Number(_0x109429[_0x6f86('0x3a')]['ids']),'VoiceQueueId':Number(_0x109429[_0x6f86('0x4f')]['id'])});}});}})[_0x6f86('0x24')](function(_0x2d5401){return db[_0x6f86('0x73')]['destroy']({'where':{'VoiceQueueId':_0x109429[_0x6f86('0x4f')]['id'],'UserId':_0x109429[_0x6f86('0x3a')][_0x6f86('0x7a')]}})[_0x6f86('0x24')](function(){return _0x2d5401;});})[_0x6f86('0x24')](respondWithStatusCode(_0x505162,null))[_0x6f86('0x4d')](handleError(_0x505162,null));};exports['getAgents']=function(_0x43dbdd,_0x52bdfd,_0x1193ff){var _0x13fd5b={};var _0x579770={};var _0x363566;var _0x1eb7eb;return db[_0x6f86('0x37')][_0x6f86('0x60')]({'where':{'id':_0x43dbdd['params']['id']}})[_0x6f86('0x24')](handleEntityNotFound(_0x52bdfd,null))[_0x6f86('0x24')](function(_0x644679){if(_0x644679){_0x363566=_0x644679;_0x579770[_0x6f86('0x3d')]=_['keys'](db[_0x6f86('0x7b')][_0x6f86('0x50')]);_0x579770[_0x6f86('0x3a')]=_[_0x6f86('0x3b')](_0x43dbdd[_0x6f86('0x3a')]);_0x579770[_0x6f86('0x3c')]=_['intersection'](_0x579770[_0x6f86('0x3d')],_0x579770[_0x6f86('0x3a')]);_0x13fd5b[_0x6f86('0x3e')]=_[_0x6f86('0x3f')](_0x579770['model'],qs[_0x6f86('0x40')](_0x43dbdd[_0x6f86('0x3a')]['fields']));_0x13fd5b[_0x6f86('0x3e')]=_0x13fd5b[_0x6f86('0x3e')][_0x6f86('0x41')]?_0x13fd5b['attributes']:_0x579770[_0x6f86('0x3d')];_0x13fd5b[_0x6f86('0x44')]=qs['sort'](_0x43dbdd[_0x6f86('0x3a')][_0x6f86('0x45')]);_0x13fd5b[_0x6f86('0x46')]=qs[_0x6f86('0x3c')](_['pick'](_0x43dbdd[_0x6f86('0x3a')],_0x579770[_0x6f86('0x3c')]));if(_0x43dbdd[_0x6f86('0x3a')]['filter']){_0x13fd5b['where']=_[_0x6f86('0x51')](_0x13fd5b[_0x6f86('0x46')],{'$or':_[_0x6f86('0x2b')](_0x13fd5b['attributes'],function(_0x4d7792){var _0x552820={};_0x552820[_0x4d7792]={'$like':'%'+_0x43dbdd[_0x6f86('0x3a')][_0x6f86('0x29')]+'%'};return _0x552820;})});}_0x13fd5b=_[_0x6f86('0x51')]({},_0x13fd5b,_0x43dbdd[_0x6f86('0x48')]);return _0x363566[_0x6f86('0x92')](_0x13fd5b);}})[_0x6f86('0x24')](function(_0x2a27a0){if(_0x2a27a0){_0x1eb7eb=_0x2a27a0[_0x6f86('0x41')];if(!_0x43dbdd['query'][_0x6f86('0x42')](_0x6f86('0x43'))){_0x13fd5b[_0x6f86('0x1f')]=qs[_0x6f86('0x1f')](_0x43dbdd[_0x6f86('0x3a')][_0x6f86('0x1f')]);_0x13fd5b[_0x6f86('0x1d')]=qs[_0x6f86('0x1d')](_0x43dbdd['query'][_0x6f86('0x1d')]);}return _0x363566[_0x6f86('0x92')](_0x13fd5b);}})['then'](function(_0x2f2768){if(_0x2f2768){return _0x2f2768?{'count':_0x1eb7eb,'rows':_0x2f2768}:null;}})[_0x6f86('0x24')](respondWithResult(_0x52bdfd,null))[_0x6f86('0x4d')](handleError(_0x52bdfd,null));};exports[_0x6f86('0x93')]=function(_0x1610a0,_0x2b294f,_0x504f90){var _0x13edb4={};var _0x1fd34b={};var _0x2dc1e8;var _0x5eb7e7;return db[_0x6f86('0x37')][_0x6f86('0x60')]({'where':{'id':_0x1610a0[_0x6f86('0x4f')]['id']}})[_0x6f86('0x24')](handleEntityNotFound(_0x2b294f,null))['then'](function(_0x256f2d){if(_0x256f2d){_0x2dc1e8=_0x256f2d;_0x1fd34b[_0x6f86('0x3d')]=_['keys'](db['UserVoiceQueueRt']['rawAttributes']);_0x1fd34b['query']=_[_0x6f86('0x3b')](_0x1610a0[_0x6f86('0x3a')]);_0x1fd34b[_0x6f86('0x3c')]=_[_0x6f86('0x3f')](_0x1fd34b[_0x6f86('0x3d')],_0x1fd34b[_0x6f86('0x3a')]);_0x13edb4[_0x6f86('0x3e')]=_[_0x6f86('0x3f')](_0x1fd34b[_0x6f86('0x3d')],qs['fields'](_0x1610a0['query']['fields']));_0x13edb4['attributes']=_0x13edb4['attributes'][_0x6f86('0x41')]?_0x13edb4['attributes']:_0x1fd34b[_0x6f86('0x3d')];_0x13edb4[_0x6f86('0x44')]=qs[_0x6f86('0x45')](_0x1610a0[_0x6f86('0x3a')]['sort']);_0x13edb4[_0x6f86('0x46')]=qs[_0x6f86('0x3c')](_[_0x6f86('0x47')](_0x1610a0[_0x6f86('0x3a')],_0x1fd34b[_0x6f86('0x3c')]));if(_0x1610a0['query']['filter']){_0x13edb4[_0x6f86('0x46')]=_['merge'](_0x13edb4[_0x6f86('0x46')],{'$or':_[_0x6f86('0x2b')](_0x13edb4[_0x6f86('0x3e')],function(_0x3b6053){var _0x3ea420={};_0x3ea420[_0x3b6053]={'$like':'%'+_0x1610a0[_0x6f86('0x3a')][_0x6f86('0x29')]+'%'};return _0x3ea420;})});}_0x13edb4=_[_0x6f86('0x51')]({},_0x13edb4,_0x1610a0['options']);return _0x2dc1e8['getMembers'](_0x13edb4);}})[_0x6f86('0x24')](function(_0x5e8892){if(_0x5e8892){_0x5eb7e7=_0x5e8892[_0x6f86('0x41')];if(!_0x1610a0[_0x6f86('0x3a')][_0x6f86('0x42')](_0x6f86('0x43'))){_0x13edb4[_0x6f86('0x1f')]=qs[_0x6f86('0x1f')](_0x1610a0[_0x6f86('0x3a')][_0x6f86('0x1f')]);_0x13edb4[_0x6f86('0x1d')]=qs[_0x6f86('0x1d')](_0x1610a0['query'][_0x6f86('0x1d')]);}return _0x2dc1e8[_0x6f86('0x93')](_0x13edb4);}})[_0x6f86('0x24')](function(_0x185b70){return _0x185b70?{'count':_0x5eb7e7,'rows':_0x185b70}:null;})[_0x6f86('0x24')](respondWithResult(_0x2b294f,null))['catch'](handleError(_0x2b294f,null));};exports[_0x6f86('0x94')]=function(_0x38a4a2,_0xc5a6dd,_0x4058d6){var _0x295291={};var _0x2b9588={};var _0x2c6ba5;var _0x3be3e6;return db[_0x6f86('0x37')]['findOne']({'where':{'id':_0x38a4a2[_0x6f86('0x4f')]['id']}})[_0x6f86('0x24')](handleEntityNotFound(_0xc5a6dd,null))[_0x6f86('0x24')](function(_0x138237){if(_0x138237){_0x2c6ba5=_0x138237;_0x2b9588[_0x6f86('0x3d')]=_[_0x6f86('0x3b')](db[_0x6f86('0x95')]['rawAttributes']);_0x2b9588[_0x6f86('0x3a')]=_[_0x6f86('0x3b')](_0x38a4a2['query']);_0x2b9588['filters']=_[_0x6f86('0x3f')](_0x2b9588[_0x6f86('0x3d')],_0x2b9588[_0x6f86('0x3a')]);_0x295291['attributes']=_[_0x6f86('0x3f')](_0x2b9588[_0x6f86('0x3d')],qs['fields'](_0x38a4a2[_0x6f86('0x3a')][_0x6f86('0x40')]));_0x295291[_0x6f86('0x3e')]=_0x295291['attributes'][_0x6f86('0x41')]?_0x295291[_0x6f86('0x3e')]:_0x2b9588['model'];_0x295291[_0x6f86('0x44')]=qs['sort'](_0x38a4a2[_0x6f86('0x3a')]['sort']);_0x295291[_0x6f86('0x46')]=qs[_0x6f86('0x3c')](_[_0x6f86('0x47')](_0x38a4a2[_0x6f86('0x3a')],_0x2b9588[_0x6f86('0x3c')]));if(_0x38a4a2[_0x6f86('0x3a')][_0x6f86('0x29')]){_0x295291[_0x6f86('0x46')]=_[_0x6f86('0x51')](_0x295291['where'],{'$or':_['map'](_0x295291['attributes'],function(_0x277280){var _0x574366={};_0x574366[_0x277280]={'$like':'%'+_0x38a4a2['query']['filter']+'%'};return _0x574366;})});}_0x295291=_[_0x6f86('0x51')]({},_0x295291,_0x38a4a2['options']);return _0x2c6ba5[_0x6f86('0x94')](_0x295291);}})[_0x6f86('0x24')](function(_0x3a5502){if(_0x3a5502){_0x3be3e6=_0x3a5502[_0x6f86('0x41')];if(!_0x38a4a2[_0x6f86('0x3a')][_0x6f86('0x42')](_0x6f86('0x43'))){_0x295291['limit']=qs[_0x6f86('0x1f')](_0x38a4a2['query'][_0x6f86('0x1f')]);_0x295291[_0x6f86('0x1d')]=qs[_0x6f86('0x1d')](_0x38a4a2['query'][_0x6f86('0x1d')]);}return _0x2c6ba5[_0x6f86('0x94')](_0x295291);}})[_0x6f86('0x24')](function(_0x1e6b64){if(_0x1e6b64){return _0x1e6b64?{'count':_0x3be3e6,'rows':_0x1e6b64}:null;}})[_0x6f86('0x24')](respondWithResult(_0xc5a6dd,null))[_0x6f86('0x4d')](handleError(_0xc5a6dd,null));};exports[_0x6f86('0x96')]=function(_0x1ab305,_0x3a4435,_0x1c6d2e){var _0x126d56,_0x237c6a;return db['VoiceQueue'][_0x6f86('0x2f')]({'where':{'id':_0x1ab305['params']['id']}})[_0x6f86('0x24')](handleEntityNotFound(_0x3a4435,null))[_0x6f86('0x24')](function(_0x117281){if(_0x117281){_0x237c6a=_0x117281;return _0x117281[_0x6f86('0x96')](_0x1ab305[_0x6f86('0x5c')][_0x6f86('0x7a')],_['omit'](_0x1ab305[_0x6f86('0x5c')],['ids','id'])||{});}return null;})[_0x6f86('0x8e')](function(_0x205507){var _0x2b5dc2;_0x126d56=_0x205507||[];var _0x158156=[];if(_0x205507){for(var _0x497971=0x0;_0x497971<_0x205507[_0x6f86('0x41')];_0x497971+=0x1){var _0x31a59e=_0x205507[_0x497971]['get']({'plain':!![]});_0x237c6a[_0x6f86('0x97')]=_0x1ab305[_0x6f86('0x5c')][_0x6f86('0x97')]?_0x1ab305['body'][_0x6f86('0x97')]:_0x237c6a[_0x6f86('0x97')];switch(_0x237c6a[_0x6f86('0x97')]){case _0x6f86('0x98'):_0x2b5dc2=squel[_0x6f86('0x99')]()[_0x6f86('0x9a')]('cm_hopper')['fromQuery']([_0x6f86('0x9b'),_0x6f86('0x9c'),_0x6f86('0x9d'),_0x6f86('0x9e'),'VoiceQueueId',_0x6f86('0x5d'),_0x6f86('0x5b')],squel[_0x6f86('0x7c')]()[_0x6f86('0x7d')]('phone',_0x6f86('0x9b'))[_0x6f86('0x7d')](_0x6f86('0x9f'),_0x6f86('0x9c'))[_0x6f86('0x7d')]('id',_0x6f86('0x9d'))[_0x6f86('0x7d')](_0x31a59e['CmListId'][_0x6f86('0x85')](),_0x6f86('0x9e'))[_0x6f86('0x7d')](_0x1ab305['params']['id']['toString'](),_0x6f86('0x62'))[_0x6f86('0x7d')]('NOW()',_0x6f86('0x5d'))[_0x6f86('0x7d')](_0x6f86('0x9f'),_0x6f86('0x5b'))[_0x6f86('0xa0')]('cm_contacts')[_0x6f86('0x46')](_0x6f86('0xa1'))[_0x6f86('0x46')](_0x6f86('0xa2'),_0x31a59e[_0x6f86('0xa3')][_0x6f86('0x85')]())[_0x6f86('0x46')](_0x6f86('0xa4'))['where'](_0x6f86('0xa5'),squel[_0x6f86('0x7c')]()['field']('COALESCE(calleridnum,\x27\x27)')[_0x6f86('0xa0')](_0x6f86('0xa6'))[_0x6f86('0x46')](_0x6f86('0x81'),_0x1ab305[_0x6f86('0x4f')]['id'][_0x6f86('0x85')]()))[_0x6f86('0x46')]('phone\x20NOT\x20IN\x20(?)',squel[_0x6f86('0x7c')]()[_0x6f86('0x7d')](_0x6f86('0xa7'))[_0x6f86('0xa0')]('cm_hopper')[_0x6f86('0x46')](_0x6f86('0x81'),_0x1ab305[_0x6f86('0x4f')]['id']['toString']())))['toString']();break;case'onlyIfOpen':_0x2b5dc2=squel['insert']()['into']('cm_hopper')[_0x6f86('0xa8')]([_0x6f86('0x9b'),'scheduledAt','ContactId','ListId','VoiceQueueId',_0x6f86('0x5d'),_0x6f86('0x5b')],squel[_0x6f86('0x7c')]()[_0x6f86('0x7d')](_0x6f86('0x9b'),'phone')[_0x6f86('0x7d')](_0x6f86('0x9f'),'scheduledAt')['field']('id',_0x6f86('0x9d'))[_0x6f86('0x7d')](_0x31a59e[_0x6f86('0xa3')][_0x6f86('0x85')](),_0x6f86('0x9e'))[_0x6f86('0x7d')](_0x1ab305[_0x6f86('0x4f')]['id']['toString'](),'VoiceQueueId')[_0x6f86('0x7d')](_0x6f86('0x9f'),_0x6f86('0x5d'))[_0x6f86('0x7d')]('NOW()','updatedAt')[_0x6f86('0xa0')](_0x6f86('0xa9'))['where'](_0x6f86('0xa1'))[_0x6f86('0x46')](_0x6f86('0xa2'),_0x31a59e[_0x6f86('0xa3')][_0x6f86('0x85')]())[_0x6f86('0x46')](_0x6f86('0xa4'))['where'](_0x6f86('0xa5'),squel['select']()[_0x6f86('0x7d')](_0x6f86('0xa7'))[_0x6f86('0xa0')](_0x6f86('0xaa'))[_0x6f86('0x46')](_0x6f86('0x81'),_0x1ab305['params']['id'][_0x6f86('0x85')]())))[_0x6f86('0x85')]();break;default:_0x2b5dc2=squel[_0x6f86('0x99')]()[_0x6f86('0x9a')](_0x6f86('0xaa'))[_0x6f86('0xa8')]([_0x6f86('0x9b'),'scheduledAt',_0x6f86('0x9d'),_0x6f86('0x9e'),_0x6f86('0x62'),_0x6f86('0x5d'),_0x6f86('0x5b')],squel[_0x6f86('0x7c')]()['field'](_0x6f86('0x9b'),'phone')[_0x6f86('0x7d')](_0x6f86('0x9f'),_0x6f86('0x9c'))[_0x6f86('0x7d')]('id',_0x6f86('0x9d'))[_0x6f86('0x7d')](_0x31a59e[_0x6f86('0xa3')][_0x6f86('0x85')](),_0x6f86('0x9e'))[_0x6f86('0x7d')](_0x1ab305[_0x6f86('0x4f')]['id'][_0x6f86('0x85')](),_0x6f86('0x62'))['field']('NOW()',_0x6f86('0x5d'))[_0x6f86('0x7d')]('NOW()',_0x6f86('0x5b'))['from'](_0x6f86('0xa9'))['where']('deletedAt\x20IS\x20NULL')[_0x6f86('0x46')](_0x6f86('0xa2'),_0x31a59e[_0x6f86('0xa3')]['toString']())[_0x6f86('0x46')](_0x6f86('0xa4')))[_0x6f86('0x85')]();}_0x158156[_0x6f86('0x83')](db[_0x6f86('0x84')][_0x6f86('0x3a')](_0x2b5dc2));}return BPromise[_0x6f86('0x88')](_0x158156);}})[_0x6f86('0x24')](function(){return _0x126d56;})[_0x6f86('0x24')](respondWithResult(_0x3a4435,null))[_0x6f86('0x4d')](handleError(_0x3a4435,null));};exports['removeLists']=function(_0x3654ef,_0x34415e,_0x1515db){return db[_0x6f86('0x37')]['find']({'where':{'id':_0x3654ef[_0x6f86('0x4f')]['id']}})['then'](handleEntityNotFound(_0x34415e,null))[_0x6f86('0x24')](function(_0x4e08a3){if(_0x4e08a3){return _0x4e08a3['removeLists'](_0x3654ef['query'][_0x6f86('0x7a')]);}})[_0x6f86('0x24')](function(_0x496637){if(_0x496637){return db[_0x6f86('0x61')][_0x6f86('0x32')]({'where':{'ListId':_0x3654ef[_0x6f86('0x3a')][_0x6f86('0x7a')],'VoiceQueueId':_0x3654ef[_0x6f86('0x4f')]['id']}})[_0x6f86('0x24')](function(){return _0x496637;});}})[_0x6f86('0x24')](respondWithStatusCode(_0x34415e,null))[_0x6f86('0x4d')](handleError(_0x34415e,null));};exports['getBlackLists']=function(_0x332c43,_0x1548e3,_0x384519){var _0xd6e8fe={};var _0x365d2f={};var _0x1d7897;var _0x3bcff6;return db['VoiceQueue']['findOne']({'where':{'id':_0x332c43[_0x6f86('0x4f')]['id']}})[_0x6f86('0x24')](handleEntityNotFound(_0x1548e3,null))[_0x6f86('0x24')](function(_0x5dd23a){if(_0x5dd23a){_0x1d7897=_0x5dd23a;_0x365d2f[_0x6f86('0x3d')]=_[_0x6f86('0x3b')](db[_0x6f86('0x95')][_0x6f86('0x50')]);_0x365d2f['query']=_[_0x6f86('0x3b')](_0x332c43[_0x6f86('0x3a')]);_0x365d2f['filters']=_[_0x6f86('0x3f')](_0x365d2f[_0x6f86('0x3d')],_0x365d2f[_0x6f86('0x3a')]);_0xd6e8fe[_0x6f86('0x3e')]=_[_0x6f86('0x3f')](_0x365d2f[_0x6f86('0x3d')],qs[_0x6f86('0x40')](_0x332c43[_0x6f86('0x3a')][_0x6f86('0x40')]));_0xd6e8fe[_0x6f86('0x3e')]=_0xd6e8fe['attributes']['length']?_0xd6e8fe['attributes']:_0x365d2f[_0x6f86('0x3d')];_0xd6e8fe[_0x6f86('0x44')]=qs[_0x6f86('0x45')](_0x332c43[_0x6f86('0x3a')][_0x6f86('0x45')]);_0xd6e8fe[_0x6f86('0x46')]=qs[_0x6f86('0x3c')](_[_0x6f86('0x47')](_0x332c43[_0x6f86('0x3a')],_0x365d2f['filters']));if(_0x332c43[_0x6f86('0x3a')][_0x6f86('0x29')]){_0xd6e8fe[_0x6f86('0x46')]=_[_0x6f86('0x51')](_0xd6e8fe[_0x6f86('0x46')],{'$or':_['map'](_0xd6e8fe['attributes'],function(_0x1c73a3){var _0x312a88={};_0x312a88[_0x1c73a3]={'$like':'%'+_0x332c43[_0x6f86('0x3a')][_0x6f86('0x29')]+'%'};return _0x312a88;})});}_0xd6e8fe=_[_0x6f86('0x51')]({},_0xd6e8fe,_0x332c43['options']);return _0x1d7897[_0x6f86('0xab')](_0xd6e8fe);}})[_0x6f86('0x24')](function(_0x43f3b4){if(_0x43f3b4){_0x3bcff6=_0x43f3b4[_0x6f86('0x41')];if(!_0x332c43['query']['hasOwnProperty'](_0x6f86('0x43'))){_0xd6e8fe['limit']=qs['limit'](_0x332c43[_0x6f86('0x3a')][_0x6f86('0x1f')]);_0xd6e8fe['offset']=qs[_0x6f86('0x1d')](_0x332c43[_0x6f86('0x3a')]['offset']);}return _0x1d7897[_0x6f86('0xab')](_0xd6e8fe);}})[_0x6f86('0x24')](function(_0x31d4f0){if(_0x31d4f0){return _0x31d4f0?{'count':_0x3bcff6,'rows':_0x31d4f0}:null;}})[_0x6f86('0x24')](respondWithResult(_0x1548e3,null))[_0x6f86('0x4d')](handleError(_0x1548e3,null));};exports[_0x6f86('0xac')]=function(_0x2b04c7,_0x42d7a3,_0x40e167){var _0x196aca,_0x10435c;return db['VoiceQueue'][_0x6f86('0x2f')]({'where':{'id':_0x2b04c7[_0x6f86('0x4f')]['id']}})['then'](handleEntityNotFound(_0x42d7a3,null))[_0x6f86('0x24')](function(_0xda0af1){if(_0xda0af1){_0x10435c=_0xda0af1;return _0xda0af1[_0x6f86('0xac')](_0x2b04c7[_0x6f86('0x5c')][_0x6f86('0x7a')],_[_0x6f86('0x5a')](_0x2b04c7[_0x6f86('0x5c')],[_0x6f86('0x7a'),'id'])||{});}return null;})['spread'](function(_0x59c7c1){var _0x1c6d6e;_0x196aca=_0x59c7c1||[];var _0x1f6f69=[];if(_0x59c7c1){for(var _0x407218=0x0;_0x407218<_0x59c7c1[_0x6f86('0x41')];_0x407218+=0x1){var _0x21ba4c=_0x59c7c1[_0x407218]['get']({'plain':!![]});_0x1c6d6e=squel[_0x6f86('0x99')]()[_0x6f86('0x9a')](_0x6f86('0xad'))[_0x6f86('0xa8')]([_0x6f86('0x9b'),_0x6f86('0x9d'),_0x6f86('0x9e'),_0x6f86('0x62'),_0x6f86('0x5d'),_0x6f86('0x5b')],squel[_0x6f86('0x7c')]()['field'](_0x6f86('0x9b'),_0x6f86('0x9b'))[_0x6f86('0x7d')]('id',_0x6f86('0x9d'))['field'](_0x21ba4c['CmListId']['toString'](),'ListId')[_0x6f86('0x7d')](_0x2b04c7[_0x6f86('0x4f')]['id'][_0x6f86('0x85')](),_0x6f86('0x62'))[_0x6f86('0x7d')](_0x6f86('0x9f'),_0x6f86('0x5d'))[_0x6f86('0x7d')]('NOW()',_0x6f86('0x5b'))[_0x6f86('0xa0')]('cm_contacts')[_0x6f86('0x46')]('deletedAt\x20IS\x20NULL')['where'](_0x6f86('0xa2'),_0x21ba4c[_0x6f86('0xa3')][_0x6f86('0x85')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x6f86('0x85')]();_0x1f6f69[_0x6f86('0x83')](db[_0x6f86('0x84')][_0x6f86('0x3a')](_0x1c6d6e));}return BPromise['all'](_0x1f6f69);}})['then'](function(){return _0x196aca;})[_0x6f86('0x24')](respondWithResult(_0x42d7a3,null))[_0x6f86('0x4d')](handleError(_0x42d7a3,null));};exports['removeBlackLists']=function(_0x3ca714,_0x18a878,_0x1f1da1){return db[_0x6f86('0x37')]['find']({'where':{'id':_0x3ca714[_0x6f86('0x4f')]['id']}})[_0x6f86('0x24')](handleEntityNotFound(_0x18a878,null))[_0x6f86('0x24')](function(_0x7fc70d){if(_0x7fc70d){return _0x7fc70d[_0x6f86('0xae')](_0x3ca714[_0x6f86('0x3a')][_0x6f86('0x7a')]);}})[_0x6f86('0x24')](function(_0x38d8f1){if(_0x38d8f1){return db['CmHopperBlack']['destroy']({'where':{'ListId':_0x3ca714[_0x6f86('0x3a')][_0x6f86('0x7a')],'VoiceQueueId':_0x3ca714[_0x6f86('0x4f')]['id']}})[_0x6f86('0x24')](function(){return _0x38d8f1;});}})[_0x6f86('0x24')](respondWithStatusCode(_0x18a878,null))[_0x6f86('0x4d')](handleError(_0x18a878,null));}; \ No newline at end of file +var _0x4058=['getAgents','getMembers','CmList','getLists','addLists','dialCheckDuplicateType','insert','cm_hopper','fromQuery','phone','scheduledAt','ListId','NOW()','ContactId','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','into','cm_contacts','removeLists','getBlackLists','addBlackLists','cm_hopper_black','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','apply','reject','update','then','get','VoiceQueues','inbound','outbound','filter','ignore','map','value','includes','find','type','name','destroy','stack','index','VoiceQueue','fieldName','model','query','keys','filters','intersection','fields','length','nolimit','sort','pick','where','merge','VIRTUAL','options','includeAll','include','catch','params','attributes','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','UserProfileResource','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rawAttributes','omit','createdAt','updatedAt','body','QueueCampaigns','userProfileId','hasOwnProperty','order','findAll','rows','getHopperHistories','findOne','CmHopperHistory','VoiceQueueId','getHopperFinals','CmHopperFinal','CmHopperBlack','getTeams','addTeams','User','Agents','online','interface','flatMap','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','voicePause','emit','userVoiceQueue:save','removeTeams','Team','ids','select','field','tq.TeamId','from','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','all','compact','removeAgents','userVoiceQueue:remove','spread','push','isArray'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4058,0x189));var _0x8405=function(_0x28c3fe,_0x142a08){_0x28c3fe=_0x28c3fe-0x0;var _0x13bef8=_0x4058[_0x28c3fe];return _0x13bef8;};'use strict';var emlformat=require(_0x8405('0x0'));var rimraf=require(_0x8405('0x1'));var zipdir=require(_0x8405('0x2'));var jsonpatch=require(_0x8405('0x3'));var rp=require(_0x8405('0x4'));var moment=require(_0x8405('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8405('0x6'));var util=require('util');var path=require(_0x8405('0x7'));var sox=require(_0x8405('0x8'));var csv=require('to-csv');var ejs=require(_0x8405('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8405('0xa'));var squel=require(_0x8405('0xb'));var crypto=require(_0x8405('0xc'));var jsforce=require(_0x8405('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8405('0xe'));var querystring=require(_0x8405('0xf'));var Papa=require(_0x8405('0x10'));var Redis=require(_0x8405('0x11'));var authService=require(_0x8405('0x12'));var qs=require(_0x8405('0x13'));var as=require(_0x8405('0x14'));var hardwareService=require(_0x8405('0x15'));var logger=require(_0x8405('0x16'))(_0x8405('0x17'));var utils=require(_0x8405('0x18'));var config=require(_0x8405('0x19'));var licenseUtil=require(_0x8405('0x1a'));var db=require(_0x8405('0x1b'))['db'];config[_0x8405('0x1c')]=_[_0x8405('0x1d')](config[_0x8405('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x8405('0x1e'))(new Redis(config['redis']));require('./voiceQueue.socket')['register'](socket);function respondWithStatusCode(_0x4c9d2f,_0x377664){_0x377664=_0x377664||0xcc;return function(_0x57106e){if(_0x57106e){return _0x4c9d2f[_0x8405('0x1f')](_0x377664);}return _0x4c9d2f[_0x8405('0x20')](_0x377664)[_0x8405('0x21')]();};}function respondWithResult(_0x654c75,_0x22a379){_0x22a379=_0x22a379||0xc8;return function(_0x4b83aa){if(_0x4b83aa){return _0x654c75[_0x8405('0x20')](_0x22a379)['json'](_0x4b83aa);}};}function respondWithFilteredResult(_0x2a4f7a,_0x44bf99){return function(_0x23263b){if(_0x23263b){var _0x3ae375=typeof _0x44bf99[_0x8405('0x22')]==='undefined'&&typeof _0x44bf99[_0x8405('0x23')]===_0x8405('0x24');var _0x77ef07=_0x23263b['count'];var _0x285ed8=_0x3ae375?0x0:_0x44bf99[_0x8405('0x22')];var _0x1541fc=_0x3ae375?_0x23263b[_0x8405('0x25')]:_0x44bf99[_0x8405('0x22')]+_0x44bf99[_0x8405('0x23')];var _0x5daf07;if(_0x1541fc>=_0x77ef07){_0x1541fc=_0x77ef07;_0x5daf07=0xc8;}else{_0x5daf07=0xce;}_0x2a4f7a[_0x8405('0x20')](_0x5daf07);return _0x2a4f7a['set'](_0x8405('0x26'),_0x285ed8+'-'+_0x1541fc+'/'+_0x77ef07)[_0x8405('0x27')](_0x23263b);}return null;};}function patchUpdates(_0x22a21b){return function(_0x33dd0d){try{jsonpatch[_0x8405('0x28')](_0x33dd0d,_0x22a21b,!![]);}catch(_0x242a30){return BPromise[_0x8405('0x29')](_0x242a30);}return _0x33dd0d['save']();};}function saveUpdates(_0x383cf5,_0x58e937){return function(_0x37a8af){if(_0x37a8af){return _0x37a8af[_0x8405('0x2a')](_0x383cf5)[_0x8405('0x2b')](function(_0xa256c2){return _0xa256c2;});}return null;};}function removeEntity(_0x3a35cd,_0x4839f4){return function(_0x85fbc0){if(_0x85fbc0){return _0x85fbc0['destroy']()[_0x8405('0x2b')](function(){var _0x455c2c=_0x85fbc0[_0x8405('0x2c')]({'plain':!![]});var _0x5a2d2f=[{'name':_0x8405('0x2d'),'value':_0x8405('0x2e'),'ignore':![]},{'name':'QueueCampaigns','value':_0x8405('0x2f'),'ignore':![]}];var _0x1c54da=_(_0x5a2d2f)[_0x8405('0x30')](_0x8405('0x31'))[_0x8405('0x32')](_0x8405('0x33'))[_0x8405('0x33')]();if(_[_0x8405('0x34')](_0x1c54da,_0x455c2c['type'])){return;}var _0x48c292=_[_0x8405('0x35')](_0x5a2d2f,[_0x8405('0x33'),_0x455c2c[_0x8405('0x36')]])[_0x8405('0x37')];return db['UserProfileResource'][_0x8405('0x38')]({'where':{'type':_0x48c292,'resourceId':_0x455c2c['id']}})['then'](function(){return _0x85fbc0;});})['then'](function(){_0x3a35cd[_0x8405('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x410f56,_0x411eeb){return function(_0xc8815c){if(!_0xc8815c){_0x410f56[_0x8405('0x1f')](0x194);}return _0xc8815c;};}function handleError(_0x13770c,_0x4c02c7){_0x4c02c7=_0x4c02c7||0x1f4;return function(_0x47ae32){logger['error'](_0x47ae32[_0x8405('0x39')]);if(_0x47ae32['name']){delete _0x47ae32[_0x8405('0x37')];}_0x13770c['status'](_0x4c02c7)['send'](_0x47ae32);};}exports[_0x8405('0x3a')]=function(_0x31b98b,_0x3232ff){var _0x8a56be={},_0x30f64b={},_0x42e045={'count':0x0,'rows':[]};var _0x393b51=_[_0x8405('0x32')](db[_0x8405('0x3b')]['rawAttributes'],function(_0xf07995){return{'name':_0xf07995[_0x8405('0x3c')],'type':_0xf07995[_0x8405('0x36')]['key']};});_0x30f64b[_0x8405('0x3d')]=_['map'](_0x393b51,_0x8405('0x37'));_0x30f64b[_0x8405('0x3e')]=_[_0x8405('0x3f')](_0x31b98b['query']);_0x30f64b[_0x8405('0x40')]=_[_0x8405('0x41')](_0x30f64b[_0x8405('0x3d')],_0x30f64b[_0x8405('0x3e')]);_0x8a56be['attributes']=_[_0x8405('0x41')](_0x30f64b[_0x8405('0x3d')],qs[_0x8405('0x42')](_0x31b98b[_0x8405('0x3e')]['fields']));_0x8a56be['attributes']=_0x8a56be['attributes'][_0x8405('0x43')]?_0x8a56be['attributes']:_0x30f64b[_0x8405('0x3d')];if(!_0x31b98b[_0x8405('0x3e')]['hasOwnProperty'](_0x8405('0x44'))){_0x8a56be[_0x8405('0x23')]=qs[_0x8405('0x23')](_0x31b98b[_0x8405('0x3e')][_0x8405('0x23')]);_0x8a56be[_0x8405('0x22')]=qs[_0x8405('0x22')](_0x31b98b[_0x8405('0x3e')][_0x8405('0x22')]);}_0x8a56be['order']=qs[_0x8405('0x45')](_0x31b98b[_0x8405('0x3e')][_0x8405('0x45')]);_0x8a56be['where']=qs[_0x8405('0x40')](_[_0x8405('0x46')](_0x31b98b['query'],_0x30f64b[_0x8405('0x40')]),_0x393b51);if(_0x31b98b[_0x8405('0x3e')][_0x8405('0x30')]){_0x8a56be[_0x8405('0x47')]=_[_0x8405('0x48')](_0x8a56be[_0x8405('0x47')],{'$or':_[_0x8405('0x32')](_0x393b51,function(_0x5c9834){if(_0x5c9834[_0x8405('0x36')]!==_0x8405('0x49')){var _0x5b864d={};_0x5b864d[_0x5c9834[_0x8405('0x37')]]={'$like':'%'+_0x31b98b[_0x8405('0x3e')][_0x8405('0x30')]+'%'};return _0x5b864d;}})});}_0x8a56be=_['merge']({},_0x8a56be,_0x31b98b[_0x8405('0x4a')]);var _0xae9aef={'where':_0x8a56be[_0x8405('0x47')]};return db['VoiceQueue'][_0x8405('0x25')](_0xae9aef)['then'](function(_0x175f80){_0x42e045[_0x8405('0x25')]=_0x175f80;if(_0x31b98b[_0x8405('0x3e')][_0x8405('0x4b')]){_0x8a56be[_0x8405('0x4c')]=[{'all':!![]}];}return db[_0x8405('0x3b')]['findAll'](_0x8a56be);})[_0x8405('0x2b')](function(_0x46a285){_0x42e045['rows']=_0x46a285;return _0x42e045;})[_0x8405('0x2b')](respondWithFilteredResult(_0x3232ff,_0x8a56be))[_0x8405('0x4d')](handleError(_0x3232ff,null));};exports['show']=function(_0x56661c,_0x52f8ca){var _0x70983={'raw':![],'where':{'id':_0x56661c[_0x8405('0x4e')]['id']}},_0x5740b1={};_0x5740b1['model']=_[_0x8405('0x3f')](db['VoiceQueue']['rawAttributes']);_0x5740b1['query']=_[_0x8405('0x3f')](_0x56661c[_0x8405('0x3e')]);_0x5740b1[_0x8405('0x40')]=_[_0x8405('0x41')](_0x5740b1[_0x8405('0x3d')],_0x5740b1[_0x8405('0x3e')]);_0x70983[_0x8405('0x4f')]=_[_0x8405('0x41')](_0x5740b1[_0x8405('0x3d')],qs[_0x8405('0x42')](_0x56661c[_0x8405('0x3e')]['fields']));_0x70983[_0x8405('0x4f')]=_0x70983['attributes'][_0x8405('0x43')]?_0x70983['attributes']:_0x5740b1[_0x8405('0x3d')];if(_0x56661c['query'][_0x8405('0x4b')]){_0x70983[_0x8405('0x4c')]=[{'all':!![]}];}_0x70983=_[_0x8405('0x48')]({},_0x70983,_0x56661c[_0x8405('0x4a')]);return db[_0x8405('0x3b')][_0x8405('0x35')](_0x70983)[_0x8405('0x2b')](handleEntityNotFound(_0x52f8ca,null))[_0x8405('0x2b')](respondWithResult(_0x52f8ca,null))[_0x8405('0x4d')](handleError(_0x52f8ca,null));};exports['create']=function(_0x1323f3,_0x629d64){return db[_0x8405('0x3b')]['create'](_0x1323f3['body'],{})[_0x8405('0x2b')](function(_0x49cdef){var _0x5284b1=_0x1323f3['user']['get']({'plain':!![]});if(!_0x5284b1)throw new Error(_0x8405('0x50'));if(_0x5284b1[_0x8405('0x51')]===_0x8405('0x52')){var _0x4eb82c=_0x49cdef[_0x8405('0x2c')]({'plain':!![]});var _0x4ced86=[{'name':'VoiceQueues','value':_0x8405('0x2e')},{'name':'QueueCampaigns','value':_0x8405('0x2f')}];var _0x2d60ad=_['find'](_0x4ced86,[_0x8405('0x33'),_0x4eb82c[_0x8405('0x36')]])[_0x8405('0x37')];return db['UserProfileSection'][_0x8405('0x35')]({'where':{'name':_0x2d60ad,'userProfileId':_0x5284b1['userProfileId']},'raw':!![]})[_0x8405('0x2b')](function(_0x262307){if(_0x262307&&_0x262307[_0x8405('0x53')]===0x0){return db[_0x8405('0x54')][_0x8405('0x55')]({'name':_0x4eb82c[_0x8405('0x37')],'resourceId':_0x4eb82c['id'],'type':_0x262307[_0x8405('0x37')],'sectionId':_0x262307['id']},{})[_0x8405('0x2b')](function(){return _0x49cdef;});}else{return _0x49cdef;}})[_0x8405('0x4d')](function(_0x226c38){logger[_0x8405('0x56')](_0x8405('0x57'),_0x226c38);throw _0x226c38;});}return _0x49cdef;})[_0x8405('0x2b')](respondWithResult(_0x629d64,0xc9))[_0x8405('0x4d')](handleError(_0x629d64,null));};exports['clone']=function(_0x223688,_0x513454){var _0x44cb2b={'where':{'id':_0x223688[_0x8405('0x4e')]['id']}},_0x82e57f={};_0x82e57f[_0x8405('0x3d')]=_[_0x8405('0x3f')](db[_0x8405('0x3b')][_0x8405('0x58')]);_0x44cb2b[_0x8405('0x4f')]=_['intersection'](_0x82e57f[_0x8405('0x3d')],qs[_0x8405('0x42')](_0x223688[_0x8405('0x3e')][_0x8405('0x42')]));_0x44cb2b[_0x8405('0x4f')]=_0x44cb2b[_0x8405('0x4f')][_0x8405('0x43')]?_0x44cb2b[_0x8405('0x4f')]:_0x82e57f[_0x8405('0x3d')];if(_0x223688[_0x8405('0x3e')][_0x8405('0x4b')]){_0x44cb2b[_0x8405('0x4c')]=[{'all':!![]}];}_0x44cb2b=_[_0x8405('0x48')]({},_0x44cb2b,_0x223688[_0x8405('0x4a')]);return db['VoiceQueue'][_0x8405('0x35')](_0x44cb2b)[_0x8405('0x2b')](handleEntityNotFound(_0x513454,null))[_0x8405('0x2b')](function(_0x3d5aa5){if(_0x3d5aa5){var _0x3da44c=_0x3d5aa5['get']({'plain':!![]});_0x3da44c=qs[_0x8405('0x59')](_0x3da44c,['id',_0x8405('0x5a'),_0x8405('0x5b')]);_0x223688[_0x8405('0x5c')]=_['omit'](_0x223688[_0x8405('0x5c')],['id','createdAt',_0x8405('0x5b')]);return db[_0x8405('0x3b')][_0x8405('0x55')](_[_0x8405('0x48')](_0x3da44c,_0x223688['body']),{'include':_0x223688[_0x8405('0x3e')][_0x8405('0x4b')]?[{'all':!![]}]:undefined})['then'](function(_0x3154a1){var _0x3e1d74=_0x223688[_0x8405('0x52')][_0x8405('0x2c')]({'plain':!![]});if(!_0x3e1d74)throw new Error(_0x8405('0x50'));if(_0x3e1d74[_0x8405('0x51')]==='user'){var _0x3e6789=_0x3154a1[_0x8405('0x2c')]({'plain':!![]});var _0x167c3f=[{'name':'VoiceQueues','value':_0x8405('0x2e')},{'name':_0x8405('0x5d'),'value':_0x8405('0x2f')}];var _0x1b5b71=_[_0x8405('0x35')](_0x167c3f,[_0x8405('0x33'),_0x3e6789[_0x8405('0x36')]])[_0x8405('0x37')];return db['UserProfileSection'][_0x8405('0x35')]({'where':{'name':_0x1b5b71,'userProfileId':_0x3e1d74[_0x8405('0x5e')]},'raw':!![]})[_0x8405('0x2b')](function(_0x3022c1){if(_0x3022c1&&_0x3022c1['autoAssociation']===0x0){return db[_0x8405('0x54')]['create']({'name':_0x3e6789['name'],'resourceId':_0x3e6789['id'],'type':_0x3022c1[_0x8405('0x37')],'sectionId':_0x3022c1['id']},{})[_0x8405('0x2b')](function(){return _0x3154a1;});}else{return _0x3154a1;}})[_0x8405('0x4d')](function(_0x11c2eb){logger['error'](_0x8405('0x57'),_0x11c2eb);throw _0x11c2eb;});}return _0x3154a1;});}})[_0x8405('0x2b')](respondWithResult(_0x513454,0xc9))['catch'](handleError(_0x513454,null));};exports[_0x8405('0x2a')]=function(_0x517f00,_0x3be9b3){if(_0x517f00[_0x8405('0x5c')]['id']){delete _0x517f00[_0x8405('0x5c')]['id'];}return db[_0x8405('0x3b')][_0x8405('0x35')]({'where':{'id':_0x517f00['params']['id']}})[_0x8405('0x2b')](handleEntityNotFound(_0x3be9b3,null))[_0x8405('0x2b')](saveUpdates(_0x517f00[_0x8405('0x5c')],null))['then'](respondWithResult(_0x3be9b3,null))[_0x8405('0x4d')](handleError(_0x3be9b3,null));};exports[_0x8405('0x38')]=function(_0x319efd,_0xf53e09){return db[_0x8405('0x3b')][_0x8405('0x35')]({'where':{'id':_0x319efd[_0x8405('0x4e')]['id']}})[_0x8405('0x2b')](handleEntityNotFound(_0xf53e09,null))[_0x8405('0x2b')](removeEntity(_0xf53e09,null))[_0x8405('0x4d')](handleError(_0xf53e09,null));};exports['getHoppers']=function(_0xca9d36,_0x4ce301,_0x50c8cc){var _0x181357={'raw':![],'where':{}};var _0x2eaaa2={};var _0x36414f={'count':0x0,'rows':[]};return db[_0x8405('0x3b')]['findOne']({'where':{'id':_0xca9d36[_0x8405('0x4e')]['id']}})[_0x8405('0x2b')](handleEntityNotFound(_0x4ce301,null))[_0x8405('0x2b')](function(_0xe2991){if(_0xe2991){_0x2eaaa2[_0x8405('0x3d')]=_[_0x8405('0x3f')](db['CmHopper'][_0x8405('0x58')]);_0x2eaaa2['query']=_['keys'](_0xca9d36['query']);_0x2eaaa2[_0x8405('0x40')]=_[_0x8405('0x41')](_0x2eaaa2['model'],_0x2eaaa2[_0x8405('0x3e')]);_0x181357['attributes']=_[_0x8405('0x41')](_0x2eaaa2[_0x8405('0x3d')],qs[_0x8405('0x42')](_0xca9d36[_0x8405('0x3e')][_0x8405('0x42')]));_0x181357['attributes']=_0x181357[_0x8405('0x4f')][_0x8405('0x43')]?_0x181357[_0x8405('0x4f')]:_0x2eaaa2['model'];if(!_0xca9d36[_0x8405('0x3e')][_0x8405('0x5f')](_0x8405('0x44'))){_0x181357[_0x8405('0x23')]=qs[_0x8405('0x23')](_0xca9d36[_0x8405('0x3e')][_0x8405('0x23')]);_0x181357[_0x8405('0x22')]=qs[_0x8405('0x22')](_0xca9d36[_0x8405('0x3e')]['offset']);}_0x181357[_0x8405('0x60')]=qs[_0x8405('0x45')](_0xca9d36[_0x8405('0x3e')]['sort']);_0x181357[_0x8405('0x47')]=qs[_0x8405('0x40')](_[_0x8405('0x46')](_0xca9d36[_0x8405('0x3e')],_0x2eaaa2[_0x8405('0x40')]));_0x181357[_0x8405('0x47')]['VoiceQueueId']=_0xe2991['id'];if(_0xca9d36['query']['filter']){_0x181357['where']=_[_0x8405('0x48')](_0x181357[_0x8405('0x47')],{'$or':_['map'](_0x181357['attributes'],function(_0x226c74){var _0x46ecd7={};_0x46ecd7[_0x226c74]={'$like':'%'+_0xca9d36[_0x8405('0x3e')][_0x8405('0x30')]+'%'};return _0x46ecd7;})});}_0x181357=_['merge']({},_0x181357,_0xca9d36[_0x8405('0x4a')]);return db['CmHopper'][_0x8405('0x25')]({'where':_0x181357[_0x8405('0x47')]})[_0x8405('0x2b')](function(_0x12db31){_0x36414f['count']=_0x12db31;if(_0xca9d36[_0x8405('0x3e')][_0x8405('0x4b')]){_0x181357[_0x8405('0x4c')]=[{'all':!![]}];}return db['CmHopper'][_0x8405('0x61')](_0x181357);})[_0x8405('0x2b')](function(_0x4a1884){_0x36414f[_0x8405('0x62')]=_0x4a1884;return _0x36414f;});}})[_0x8405('0x2b')](respondWithFilteredResult(_0x4ce301,_0x181357))[_0x8405('0x4d')](handleError(_0x4ce301,null));};exports[_0x8405('0x63')]=function(_0x7ab3ad,_0x4f77ce,_0x566fa1){var _0x34c044={'raw':!![],'where':{}};var _0x788db2={};var _0x611dc4={'count':0x0,'rows':[]};return db[_0x8405('0x3b')][_0x8405('0x64')]({'where':{'id':_0x7ab3ad['params']['id']}})[_0x8405('0x2b')](handleEntityNotFound(_0x4f77ce,null))[_0x8405('0x2b')](function(_0x435b99){if(_0x435b99){_0x788db2[_0x8405('0x3d')]=_['keys'](db[_0x8405('0x65')]['rawAttributes']);_0x788db2['query']=_[_0x8405('0x3f')](_0x7ab3ad[_0x8405('0x3e')]);_0x788db2[_0x8405('0x40')]=_[_0x8405('0x41')](_0x788db2[_0x8405('0x3d')],_0x788db2['query']);_0x34c044['attributes']=_[_0x8405('0x41')](_0x788db2[_0x8405('0x3d')],qs[_0x8405('0x42')](_0x7ab3ad[_0x8405('0x3e')][_0x8405('0x42')]));_0x34c044['attributes']=_0x34c044['attributes'][_0x8405('0x43')]?_0x34c044[_0x8405('0x4f')]:_0x788db2[_0x8405('0x3d')];if(!_0x7ab3ad[_0x8405('0x3e')]['hasOwnProperty'](_0x8405('0x44'))){_0x34c044[_0x8405('0x23')]=qs[_0x8405('0x23')](_0x7ab3ad[_0x8405('0x3e')][_0x8405('0x23')]);_0x34c044[_0x8405('0x22')]=qs['offset'](_0x7ab3ad['query']['offset']);}_0x34c044[_0x8405('0x60')]=qs['sort'](_0x7ab3ad[_0x8405('0x3e')][_0x8405('0x45')]);_0x34c044[_0x8405('0x47')]=qs[_0x8405('0x40')](_[_0x8405('0x46')](_0x7ab3ad[_0x8405('0x3e')],_0x788db2[_0x8405('0x40')]));_0x34c044[_0x8405('0x47')][_0x8405('0x66')]=_0x435b99['id'];if(_0x7ab3ad[_0x8405('0x3e')][_0x8405('0x30')]){_0x34c044['where']=_[_0x8405('0x48')](_0x34c044[_0x8405('0x47')],{'$or':_['map'](_0x34c044['attributes'],function(_0x3745f8){var _0x14ebde={};_0x14ebde[_0x3745f8]={'$like':'%'+_0x7ab3ad[_0x8405('0x3e')][_0x8405('0x30')]+'%'};return _0x14ebde;})});}_0x34c044=_[_0x8405('0x48')]({},_0x34c044,_0x7ab3ad[_0x8405('0x4a')]);return db['CmHopperHistory'][_0x8405('0x25')]({'where':_0x34c044['where']})[_0x8405('0x2b')](function(_0x472460){_0x611dc4['count']=_0x472460;if(_0x7ab3ad[_0x8405('0x3e')][_0x8405('0x4b')]){_0x34c044[_0x8405('0x4c')]=[{'all':!![]}];}return db[_0x8405('0x65')][_0x8405('0x61')](_0x34c044);})[_0x8405('0x2b')](function(_0x2a811c){_0x611dc4[_0x8405('0x62')]=_0x2a811c;return _0x611dc4;});}})[_0x8405('0x2b')](respondWithFilteredResult(_0x4f77ce,_0x34c044))[_0x8405('0x4d')](handleError(_0x4f77ce,null));};exports[_0x8405('0x67')]=function(_0xbf5dc5,_0x31d041,_0x5be391){var _0x142417={'raw':!![],'where':{}};var _0x1c95e1={};var _0x3838ce={'count':0x0,'rows':[]};return db[_0x8405('0x3b')][_0x8405('0x64')]({'where':{'id':_0xbf5dc5['params']['id']}})[_0x8405('0x2b')](handleEntityNotFound(_0x31d041,null))[_0x8405('0x2b')](function(_0x341fff){if(_0x341fff){_0x1c95e1[_0x8405('0x3d')]=_['keys'](db[_0x8405('0x68')][_0x8405('0x58')]);_0x1c95e1[_0x8405('0x3e')]=_[_0x8405('0x3f')](_0xbf5dc5['query']);_0x1c95e1['filters']=_['intersection'](_0x1c95e1[_0x8405('0x3d')],_0x1c95e1[_0x8405('0x3e')]);_0x142417['attributes']=_[_0x8405('0x41')](_0x1c95e1[_0x8405('0x3d')],qs[_0x8405('0x42')](_0xbf5dc5['query'][_0x8405('0x42')]));_0x142417[_0x8405('0x4f')]=_0x142417[_0x8405('0x4f')][_0x8405('0x43')]?_0x142417[_0x8405('0x4f')]:_0x1c95e1[_0x8405('0x3d')];if(!_0xbf5dc5[_0x8405('0x3e')]['hasOwnProperty'](_0x8405('0x44'))){_0x142417[_0x8405('0x23')]=qs[_0x8405('0x23')](_0xbf5dc5[_0x8405('0x3e')]['limit']);_0x142417[_0x8405('0x22')]=qs[_0x8405('0x22')](_0xbf5dc5['query'][_0x8405('0x22')]);}_0x142417['order']=qs[_0x8405('0x45')](_0xbf5dc5[_0x8405('0x3e')][_0x8405('0x45')]);_0x142417[_0x8405('0x47')]=qs[_0x8405('0x40')](_['pick'](_0xbf5dc5[_0x8405('0x3e')],_0x1c95e1[_0x8405('0x40')]));_0x142417['where'][_0x8405('0x66')]=_0x341fff['id'];if(_0xbf5dc5[_0x8405('0x3e')]['filter']){_0x142417[_0x8405('0x47')]=_[_0x8405('0x48')](_0x142417[_0x8405('0x47')],{'$or':_['map'](_0x142417['attributes'],function(_0x2be722){var _0x3c14a4={};_0x3c14a4[_0x2be722]={'$like':'%'+_0xbf5dc5[_0x8405('0x3e')][_0x8405('0x30')]+'%'};return _0x3c14a4;})});}_0x142417=_[_0x8405('0x48')]({},_0x142417,_0xbf5dc5[_0x8405('0x4a')]);return db['CmHopperFinal'][_0x8405('0x25')]({'where':_0x142417[_0x8405('0x47')]})['then'](function(_0x24e567){_0x3838ce[_0x8405('0x25')]=_0x24e567;if(_0xbf5dc5['query'][_0x8405('0x4b')]){_0x142417[_0x8405('0x4c')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x8405('0x61')](_0x142417);})['then'](function(_0x10401c){_0x3838ce[_0x8405('0x62')]=_0x10401c;return _0x3838ce;});}})[_0x8405('0x2b')](respondWithFilteredResult(_0x31d041,_0x142417))[_0x8405('0x4d')](handleError(_0x31d041,null));};exports['getHopperBlacks']=function(_0x55fa95,_0x4e88ef,_0x355835){var _0x17b1a0={'raw':!![],'where':{}};var _0xf8f62d={};var _0x3e853e={'count':0x0,'rows':[]};return db[_0x8405('0x3b')][_0x8405('0x64')]({'where':{'id':_0x55fa95['params']['id']}})[_0x8405('0x2b')](handleEntityNotFound(_0x4e88ef,null))['then'](function(_0x55b0d2){if(_0x55b0d2){_0xf8f62d[_0x8405('0x3d')]=_['keys'](db[_0x8405('0x69')]['rawAttributes']);_0xf8f62d[_0x8405('0x3e')]=_[_0x8405('0x3f')](_0x55fa95['query']);_0xf8f62d[_0x8405('0x40')]=_['intersection'](_0xf8f62d[_0x8405('0x3d')],_0xf8f62d[_0x8405('0x3e')]);_0x17b1a0['attributes']=_[_0x8405('0x41')](_0xf8f62d[_0x8405('0x3d')],qs[_0x8405('0x42')](_0x55fa95['query'][_0x8405('0x42')]));_0x17b1a0[_0x8405('0x4f')]=_0x17b1a0[_0x8405('0x4f')][_0x8405('0x43')]?_0x17b1a0[_0x8405('0x4f')]:_0xf8f62d['model'];if(!_0x55fa95[_0x8405('0x3e')][_0x8405('0x5f')]('nolimit')){_0x17b1a0[_0x8405('0x23')]=qs[_0x8405('0x23')](_0x55fa95[_0x8405('0x3e')][_0x8405('0x23')]);_0x17b1a0[_0x8405('0x22')]=qs[_0x8405('0x22')](_0x55fa95[_0x8405('0x3e')][_0x8405('0x22')]);}_0x17b1a0[_0x8405('0x60')]=qs[_0x8405('0x45')](_0x55fa95[_0x8405('0x3e')][_0x8405('0x45')]);_0x17b1a0[_0x8405('0x47')]=qs[_0x8405('0x40')](_[_0x8405('0x46')](_0x55fa95[_0x8405('0x3e')],_0xf8f62d[_0x8405('0x40')]));_0x17b1a0[_0x8405('0x47')]['VoiceQueueId']=_0x55b0d2['id'];if(_0x55fa95[_0x8405('0x3e')][_0x8405('0x30')]){_0x17b1a0['where']=_[_0x8405('0x48')](_0x17b1a0[_0x8405('0x47')],{'$or':_[_0x8405('0x32')](_0x17b1a0[_0x8405('0x4f')],function(_0x51b135){var _0xaece63={};_0xaece63[_0x51b135]={'$like':'%'+_0x55fa95[_0x8405('0x3e')]['filter']+'%'};return _0xaece63;})});}_0x17b1a0=_[_0x8405('0x48')]({},_0x17b1a0,_0x55fa95[_0x8405('0x4a')]);return db[_0x8405('0x69')]['count']({'where':_0x17b1a0[_0x8405('0x47')]})['then'](function(_0x404521){_0x3e853e[_0x8405('0x25')]=_0x404521;if(_0x55fa95[_0x8405('0x3e')][_0x8405('0x4b')]){_0x17b1a0[_0x8405('0x4c')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x8405('0x61')](_0x17b1a0);})['then'](function(_0x4b791c){_0x3e853e[_0x8405('0x62')]=_0x4b791c;return _0x3e853e;});}})[_0x8405('0x2b')](respondWithFilteredResult(_0x4e88ef,_0x17b1a0))['catch'](handleError(_0x4e88ef,null));};exports[_0x8405('0x6a')]=function(_0x3a8188,_0x401e42,_0xaf0456){var _0x3379d4={};var _0x4b1cd2={};var _0x4926bc;var _0x27e3e0;return db[_0x8405('0x3b')][_0x8405('0x64')]({'where':{'id':_0x3a8188[_0x8405('0x4e')]['id']}})[_0x8405('0x2b')](handleEntityNotFound(_0x401e42,null))['then'](function(_0x2f4636){if(_0x2f4636){_0x4926bc=_0x2f4636;_0x4b1cd2[_0x8405('0x3d')]=_['keys'](db['Team'][_0x8405('0x58')]);_0x4b1cd2['query']=_[_0x8405('0x3f')](_0x3a8188[_0x8405('0x3e')]);_0x4b1cd2[_0x8405('0x40')]=_[_0x8405('0x41')](_0x4b1cd2[_0x8405('0x3d')],_0x4b1cd2[_0x8405('0x3e')]);_0x3379d4[_0x8405('0x4f')]=_['intersection'](_0x4b1cd2['model'],qs['fields'](_0x3a8188['query'][_0x8405('0x42')]));_0x3379d4[_0x8405('0x4f')]=_0x3379d4[_0x8405('0x4f')][_0x8405('0x43')]?_0x3379d4['attributes']:_0x4b1cd2[_0x8405('0x3d')];_0x3379d4[_0x8405('0x60')]=qs[_0x8405('0x45')](_0x3a8188[_0x8405('0x3e')]['sort']);_0x3379d4['where']=qs[_0x8405('0x40')](_[_0x8405('0x46')](_0x3a8188[_0x8405('0x3e')],_0x4b1cd2[_0x8405('0x40')]));if(_0x3a8188[_0x8405('0x3e')][_0x8405('0x30')]){_0x3379d4[_0x8405('0x47')]=_['merge'](_0x3379d4[_0x8405('0x47')],{'$or':_['map'](_0x3379d4[_0x8405('0x4f')],function(_0x3a711b){var _0x359997={};_0x359997[_0x3a711b]={'$like':'%'+_0x3a8188[_0x8405('0x3e')][_0x8405('0x30')]+'%'};return _0x359997;})});}_0x3379d4=_['merge']({},_0x3379d4,_0x3a8188[_0x8405('0x4a')]);return _0x4926bc[_0x8405('0x6a')](_0x3379d4);}})['then'](function(_0x3ea69c){if(_0x3ea69c){_0x27e3e0=_0x3ea69c[_0x8405('0x43')];if(!_0x3a8188[_0x8405('0x3e')][_0x8405('0x5f')]('nolimit')){_0x3379d4[_0x8405('0x23')]=qs['limit'](_0x3a8188[_0x8405('0x3e')]['limit']);_0x3379d4['offset']=qs[_0x8405('0x22')](_0x3a8188[_0x8405('0x3e')][_0x8405('0x22')]);}return _0x4926bc[_0x8405('0x6a')](_0x3379d4);}})[_0x8405('0x2b')](function(_0x55142b){if(_0x55142b){return _0x55142b?{'count':_0x27e3e0,'rows':_0x55142b}:null;}})[_0x8405('0x2b')](respondWithResult(_0x401e42,null))[_0x8405('0x4d')](handleError(_0x401e42,null));};exports[_0x8405('0x6b')]=function(_0x2b68cd,_0x24eb1d,_0x3ca45e){var _0x79ad9e=_0x2b68cd['body']['teams'];var _0x4eb581=_['map'](_0x79ad9e,'id');return db['Team']['findAll']({'where':{'id':_0x4eb581},'attributes':['id'],'include':[{'model':db[_0x8405('0x6c')],'as':_0x8405('0x6d'),'attributes':['id','name',_0x8405('0x6e'),'voicePause',_0x8405('0x6f')],'raw':!![]}]})[_0x8405('0x2b')](function(_0x2ea995){if(_0x2ea995){var _0x420dda=_[_0x8405('0x70')](_0x2ea995,function(_0xbf2650){var _0x3706fb=_0xbf2650['get']({'plain':!![]});_0x3706fb[_0x8405('0x6d')][_0x8405('0x71')](function(_0xbb628e){_0xbb628e[_0x8405('0x72')]=_[_0x8405('0x35')](_0x79ad9e,{'id':_0x3706fb['id']})[_0x8405('0x72')];});return _0x3706fb[_0x8405('0x6d')];});return db[_0x8405('0x3b')][_0x8405('0x35')]({'where':{'id':_0x2b68cd[_0x8405('0x4e')]['id']}})[_0x8405('0x2b')](function(_0x2e664f){return db[_0x8405('0x73')][_0x8405('0x74')](function(_0x5c6f3a){return _0x2e664f[_0x8405('0x6b')](_0x4eb581,{'transaction':_0x5c6f3a})[_0x8405('0x2b')](function(){return BPromise[_0x8405('0x75')](_0x79ad9e,function(_0x32fe70){return db[_0x8405('0x76')][_0x8405('0x77')]({'TeamId':_0x32fe70['id'],'VoiceQueueId':_0x2b68cd[_0x8405('0x4e')]['id'],'penalty':_0x32fe70[_0x8405('0x72')]},{'transaction':_0x5c6f3a});});})[_0x8405('0x2b')](function(){return BPromise[_0x8405('0x75')](_0x420dda,function(_0x120ff6){return db[_0x8405('0x78')][_0x8405('0x79')]({'where':{'UserId':_0x120ff6['id'],'VoiceQueueId':_0x2b68cd[_0x8405('0x4e')]['id']},'defaults':{'penalty':_0x120ff6['penalty']},'transaction':_0x5c6f3a});});})[_0x8405('0x2b')](function(){return BPromise[_0x8405('0x75')](_[_0x8405('0x30')](_0x420dda,{'online':!![]}),function(_0x3e10a3){return db[_0x8405('0x7a')]['upsert']({'membername':_0x3e10a3[_0x8405('0x37')],'UserId':_0x3e10a3['id'],'queue_name':_0x2e664f['name'],'VoiceQueueId':_0x2e664f['id'],'interface':_[_0x8405('0x7b')](_0x3e10a3[_0x8405('0x6f')])?util[_0x8405('0x7c')](_0x8405('0x7d'),_0x3e10a3[_0x8405('0x37')]):_0x3e10a3[_0x8405('0x6f')],'paused':_0x3e10a3[_0x8405('0x7e')]||![],'penalty':_0x3e10a3[_0x8405('0x72')]},{'transaction':_0x5c6f3a});});})[_0x8405('0x2b')](function(){_0x420dda[_0x8405('0x71')](function(_0x1a1ff5){socket[_0x8405('0x7f')](_0x8405('0x80'),{'UserId':_0x1a1ff5['id'],'VoiceQueueId':_0x2e664f['id']});});});});});}})['then'](respondWithStatusCode(_0x24eb1d,null))[_0x8405('0x4d')](handleError(_0x24eb1d,null));};exports[_0x8405('0x81')]=function(_0x347af5,_0x109b74,_0x1d3bf5){return db[_0x8405('0x82')][_0x8405('0x61')]({'where':{'id':_0x347af5[_0x8405('0x3e')][_0x8405('0x83')]},'attributes':['id'],'include':[{'model':db[_0x8405('0x6c')],'as':_0x8405('0x6d'),'attributes':['id'],'raw':!![]}]})[_0x8405('0x2b')](handleEntityNotFound(_0x109b74,null))[_0x8405('0x2b')](function(_0x1e95ed){var _0x2276ff=_[_0x8405('0x32')](_0x1e95ed,'id');var _0x4562af=[];var _0x5ebc1b=[];var _0x3e0ab7=squel[_0x8405('0x84')]();_0x3e0ab7[_0x8405('0x85')](_0x8405('0x86'))[_0x8405('0x87')](_0x8405('0x88'),'tq')['join'](_0x8405('0x89'),'ut',_0x8405('0x8a'))[_0x8405('0x47')]('VoiceQueueId\x20=\x20?',_0x347af5[_0x8405('0x4e')]['id']);for(var _0x124630=0x0;_0x124630<_0x1e95ed[_0x8405('0x43')];_0x124630+=0x1){let _0x40abdc=_0x1e95ed[_0x124630];for(var _0x15b48a=0x0;_0x15b48a<_0x40abdc[_0x8405('0x6d')][_0x8405('0x43')];_0x15b48a+=0x1){let _0x276478=_0x40abdc['Agents'][_0x15b48a];var _0xda028f=_0x3e0ab7[_0x8405('0x8b')]();_0xda028f[_0x8405('0x47')](_0x8405('0x8c'),_0x276478['id']);_0x5ebc1b['push'](db['sequelize']['query'](_0xda028f[_0x8405('0x8d')](),{'type':db[_0x8405('0x73')][_0x8405('0x8e')][_0x8405('0x8f')]})[_0x8405('0x2b')](function(_0x515789){if(_0x515789[_0x8405('0x43')]===0x1){return _0x276478['id'];}else{var _0x17f7f3=_[_0x8405('0x90')](_[_0x8405('0x32')](_0x515789,_0x8405('0x91')),function(_0x13c3c8){return _[_0x8405('0x34')](_0x2276ff,_0x13c3c8);});if(_0x17f7f3){return _0x276478['id'];}}}));}}return BPromise[_0x8405('0x92')](_0x5ebc1b)[_0x8405('0x2b')](function(_0x5587f7){_0x4562af=_(_0x4562af)['union'](_0x5587f7)[_0x8405('0x93')]()[_0x8405('0x33')]();return db['VoiceQueue']['find']({'where':{'id':_0x347af5[_0x8405('0x4e')]['id']}})[_0x8405('0x2b')](function(_0x2c6ca7){return db[_0x8405('0x73')][_0x8405('0x74')](function(_0x2e4a05){return _0x2c6ca7[_0x8405('0x81')](_0x347af5[_0x8405('0x3e')][_0x8405('0x83')],{'transaction':_0x2e4a05})['then'](function(){if(!_['isEmpty'](_0x4562af)){return _0x2c6ca7[_0x8405('0x94')](_0x4562af,{'transaction':_0x2e4a05})[_0x8405('0x2b')](function(){return db[_0x8405('0x7a')][_0x8405('0x38')]({'where':{'VoiceQueueId':_0x347af5[_0x8405('0x4e')]['id'],'UserId':_0x4562af},'transaction':_0x2e4a05});});}})[_0x8405('0x2b')](function(){_0x4562af[_0x8405('0x71')](function(_0x4b1f8b){socket[_0x8405('0x7f')](_0x8405('0x95'),{'UserId':_0x4b1f8b,'VoiceQueueId':_0x2c6ca7['id']});});});});});});})[_0x8405('0x2b')](respondWithStatusCode(_0x109b74,null))[_0x8405('0x4d')](handleError(_0x109b74,null));};exports['addAgents']=function(_0x27ad7e,_0x2c8774,_0x4b40a7){var _0x45e804,_0x5ad40d;return db[_0x8405('0x3b')]['find']({'where':{'id':_0x27ad7e['params']['id']}})[_0x8405('0x2b')](handleEntityNotFound(_0x2c8774,null))[_0x8405('0x2b')](function(_0x25ea44){if(_0x25ea44){_0x5ad40d=_0x25ea44;return _0x25ea44['addAgents'](_0x27ad7e['body'][_0x8405('0x83')],_[_0x8405('0x59')](_0x27ad7e[_0x8405('0x5c')],[_0x8405('0x83'),'id'])||{})[_0x8405('0x96')](function(_0x1829f9){for(var _0x5b21f1=0x0;_0x5b21f1<_0x27ad7e[_0x8405('0x5c')]['ids']['length'];_0x5b21f1+=0x1){socket[_0x8405('0x7f')]('userVoiceQueue:save',{'UserId':Number(_0x27ad7e[_0x8405('0x5c')][_0x8405('0x83')][_0x5b21f1]),'VoiceQueueId':Number(_0x27ad7e[_0x8405('0x4e')]['id'])});}return _0x1829f9;});}})[_0x8405('0x2b')](function(_0x521baf){_0x45e804=_0x521baf||[];if(_0x5ad40d){return db[_0x8405('0x6c')][_0x8405('0x61')]({'where':{'id':_0x27ad7e[_0x8405('0x5c')][_0x8405('0x83')]},'attributes':['id',_0x8405('0x37'),_0x8405('0x6e'),_0x8405('0x7e'),'interface'],'raw':!![]});}})['then'](function(_0x108399){if(!_['isEmpty'](_0x108399)){var _0x5d52c9=[];for(var _0x174943=0x0;_0x174943<_0x108399[_0x8405('0x43')];_0x174943++){if(_0x108399[_0x174943][_0x8405('0x6e')]){_0x5d52c9[_0x8405('0x97')](db[_0x8405('0x7a')][_0x8405('0x77')]({'membername':_0x108399[_0x174943][_0x8405('0x37')],'UserId':_0x108399[_0x174943]['id'],'queue_name':_0x5ad40d[_0x8405('0x37')],'VoiceQueueId':_0x5ad40d['id'],'interface':_[_0x8405('0x7b')](_0x108399[_0x174943][_0x8405('0x6f')])?util['format'](_0x8405('0x7d'),_0x108399[_0x174943]['name']):_0x108399[_0x174943][_0x8405('0x6f')],'paused':_0x108399[_0x174943][_0x8405('0x7e')]||![],'penalty':_0x27ad7e['body']['penalty']||0x0}));}}return BPromise['all'](_0x5d52c9);}})[_0x8405('0x2b')](function(){return _0x45e804;})[_0x8405('0x2b')](respondWithResult(_0x2c8774,null))[_0x8405('0x4d')](handleError(_0x2c8774,null));};exports[_0x8405('0x94')]=function(_0x4b27ef,_0x3a4292,_0x3d2c41){return db[_0x8405('0x3b')][_0x8405('0x35')]({'where':{'id':_0x4b27ef[_0x8405('0x4e')]['id']}})[_0x8405('0x2b')](handleEntityNotFound(_0x3a4292,null))['then'](function(_0x4f9f17){if(_0x4f9f17){return _0x4f9f17['removeAgents'](_0x4b27ef[_0x8405('0x3e')]['ids'])[_0x8405('0x2b')](function(){if(_[_0x8405('0x98')](_0x4b27ef[_0x8405('0x3e')]['ids'])){for(var _0x9091ac=0x0;_0x9091ac<_0x4b27ef[_0x8405('0x3e')][_0x8405('0x83')][_0x8405('0x43')];_0x9091ac+=0x1){socket[_0x8405('0x7f')](_0x8405('0x95'),{'UserId':Number(_0x4b27ef[_0x8405('0x3e')][_0x8405('0x83')][_0x9091ac]),'VoiceQueueId':Number(_0x4b27ef['params']['id'])});}}else{socket['emit'](_0x8405('0x95'),{'UserId':Number(_0x4b27ef[_0x8405('0x3e')][_0x8405('0x83')]),'VoiceQueueId':Number(_0x4b27ef[_0x8405('0x4e')]['id'])});}});}})['then'](function(_0x2b18e4){return db[_0x8405('0x7a')][_0x8405('0x38')]({'where':{'VoiceQueueId':_0x4b27ef[_0x8405('0x4e')]['id'],'UserId':_0x4b27ef[_0x8405('0x3e')]['ids']}})['then'](function(){return _0x2b18e4;});})[_0x8405('0x2b')](respondWithStatusCode(_0x3a4292,null))['catch'](handleError(_0x3a4292,null));};exports[_0x8405('0x99')]=function(_0x44f43b,_0x45178f,_0x1b5d51){var _0x5cd8d3={};var _0x27db81={};var _0x2e2bfb;var _0x48852b;return db[_0x8405('0x3b')][_0x8405('0x64')]({'where':{'id':_0x44f43b[_0x8405('0x4e')]['id']}})[_0x8405('0x2b')](handleEntityNotFound(_0x45178f,null))[_0x8405('0x2b')](function(_0x297346){if(_0x297346){_0x2e2bfb=_0x297346;_0x27db81[_0x8405('0x3d')]=_['keys'](db[_0x8405('0x6c')][_0x8405('0x58')]);_0x27db81[_0x8405('0x3e')]=_['keys'](_0x44f43b['query']);_0x27db81[_0x8405('0x40')]=_[_0x8405('0x41')](_0x27db81['model'],_0x27db81[_0x8405('0x3e')]);_0x5cd8d3[_0x8405('0x4f')]=_[_0x8405('0x41')](_0x27db81[_0x8405('0x3d')],qs[_0x8405('0x42')](_0x44f43b[_0x8405('0x3e')][_0x8405('0x42')]));_0x5cd8d3[_0x8405('0x4f')]=_0x5cd8d3[_0x8405('0x4f')][_0x8405('0x43')]?_0x5cd8d3[_0x8405('0x4f')]:_0x27db81[_0x8405('0x3d')];_0x5cd8d3[_0x8405('0x60')]=qs[_0x8405('0x45')](_0x44f43b[_0x8405('0x3e')][_0x8405('0x45')]);_0x5cd8d3[_0x8405('0x47')]=qs[_0x8405('0x40')](_[_0x8405('0x46')](_0x44f43b[_0x8405('0x3e')],_0x27db81[_0x8405('0x40')]));if(_0x44f43b[_0x8405('0x3e')][_0x8405('0x30')]){_0x5cd8d3[_0x8405('0x47')]=_[_0x8405('0x48')](_0x5cd8d3[_0x8405('0x47')],{'$or':_[_0x8405('0x32')](_0x5cd8d3[_0x8405('0x4f')],function(_0x5aa42f){var _0xaf8df={};_0xaf8df[_0x5aa42f]={'$like':'%'+_0x44f43b[_0x8405('0x3e')][_0x8405('0x30')]+'%'};return _0xaf8df;})});}_0x5cd8d3=_[_0x8405('0x48')]({},_0x5cd8d3,_0x44f43b[_0x8405('0x4a')]);return _0x2e2bfb[_0x8405('0x99')](_0x5cd8d3);}})[_0x8405('0x2b')](function(_0x3e5a99){if(_0x3e5a99){_0x48852b=_0x3e5a99[_0x8405('0x43')];if(!_0x44f43b[_0x8405('0x3e')]['hasOwnProperty'](_0x8405('0x44'))){_0x5cd8d3[_0x8405('0x23')]=qs[_0x8405('0x23')](_0x44f43b[_0x8405('0x3e')][_0x8405('0x23')]);_0x5cd8d3[_0x8405('0x22')]=qs[_0x8405('0x22')](_0x44f43b[_0x8405('0x3e')][_0x8405('0x22')]);}return _0x2e2bfb[_0x8405('0x99')](_0x5cd8d3);}})['then'](function(_0x5c4f52){if(_0x5c4f52){return _0x5c4f52?{'count':_0x48852b,'rows':_0x5c4f52}:null;}})[_0x8405('0x2b')](respondWithResult(_0x45178f,null))['catch'](handleError(_0x45178f,null));};exports[_0x8405('0x9a')]=function(_0x4d80a8,_0x364f9c,_0x1118c8){var _0x194c8d={};var _0x1707f9={};var _0x4ce578;var _0x51c5bf;return db[_0x8405('0x3b')]['findOne']({'where':{'id':_0x4d80a8['params']['id']}})[_0x8405('0x2b')](handleEntityNotFound(_0x364f9c,null))[_0x8405('0x2b')](function(_0x4f8aa1){if(_0x4f8aa1){_0x4ce578=_0x4f8aa1;_0x1707f9[_0x8405('0x3d')]=_[_0x8405('0x3f')](db[_0x8405('0x7a')][_0x8405('0x58')]);_0x1707f9[_0x8405('0x3e')]=_['keys'](_0x4d80a8[_0x8405('0x3e')]);_0x1707f9[_0x8405('0x40')]=_[_0x8405('0x41')](_0x1707f9[_0x8405('0x3d')],_0x1707f9['query']);_0x194c8d[_0x8405('0x4f')]=_[_0x8405('0x41')](_0x1707f9[_0x8405('0x3d')],qs[_0x8405('0x42')](_0x4d80a8['query']['fields']));_0x194c8d[_0x8405('0x4f')]=_0x194c8d[_0x8405('0x4f')][_0x8405('0x43')]?_0x194c8d['attributes']:_0x1707f9['model'];_0x194c8d[_0x8405('0x60')]=qs['sort'](_0x4d80a8[_0x8405('0x3e')][_0x8405('0x45')]);_0x194c8d['where']=qs[_0x8405('0x40')](_[_0x8405('0x46')](_0x4d80a8[_0x8405('0x3e')],_0x1707f9[_0x8405('0x40')]));if(_0x4d80a8[_0x8405('0x3e')][_0x8405('0x30')]){_0x194c8d[_0x8405('0x47')]=_['merge'](_0x194c8d[_0x8405('0x47')],{'$or':_['map'](_0x194c8d['attributes'],function(_0x522c34){var _0x494a84={};_0x494a84[_0x522c34]={'$like':'%'+_0x4d80a8[_0x8405('0x3e')][_0x8405('0x30')]+'%'};return _0x494a84;})});}_0x194c8d=_['merge']({},_0x194c8d,_0x4d80a8[_0x8405('0x4a')]);return _0x4ce578['getMembers'](_0x194c8d);}})[_0x8405('0x2b')](function(_0x196500){if(_0x196500){_0x51c5bf=_0x196500[_0x8405('0x43')];if(!_0x4d80a8[_0x8405('0x3e')][_0x8405('0x5f')]('nolimit')){_0x194c8d['limit']=qs[_0x8405('0x23')](_0x4d80a8[_0x8405('0x3e')][_0x8405('0x23')]);_0x194c8d[_0x8405('0x22')]=qs[_0x8405('0x22')](_0x4d80a8[_0x8405('0x3e')][_0x8405('0x22')]);}return _0x4ce578[_0x8405('0x9a')](_0x194c8d);}})[_0x8405('0x2b')](function(_0x19013d){return _0x19013d?{'count':_0x51c5bf,'rows':_0x19013d}:null;})[_0x8405('0x2b')](respondWithResult(_0x364f9c,null))[_0x8405('0x4d')](handleError(_0x364f9c,null));};exports['getLists']=function(_0x3cf285,_0x58cc5c,_0x4bb41c){var _0x58c11={};var _0x51585b={};var _0x3a331b;var _0x1fa7f7;return db[_0x8405('0x3b')]['findOne']({'where':{'id':_0x3cf285['params']['id']}})['then'](handleEntityNotFound(_0x58cc5c,null))[_0x8405('0x2b')](function(_0xf33bfd){if(_0xf33bfd){_0x3a331b=_0xf33bfd;_0x51585b['model']=_['keys'](db[_0x8405('0x9b')][_0x8405('0x58')]);_0x51585b[_0x8405('0x3e')]=_[_0x8405('0x3f')](_0x3cf285[_0x8405('0x3e')]);_0x51585b['filters']=_[_0x8405('0x41')](_0x51585b[_0x8405('0x3d')],_0x51585b[_0x8405('0x3e')]);_0x58c11[_0x8405('0x4f')]=_[_0x8405('0x41')](_0x51585b[_0x8405('0x3d')],qs[_0x8405('0x42')](_0x3cf285['query'][_0x8405('0x42')]));_0x58c11[_0x8405('0x4f')]=_0x58c11[_0x8405('0x4f')]['length']?_0x58c11['attributes']:_0x51585b[_0x8405('0x3d')];_0x58c11[_0x8405('0x60')]=qs['sort'](_0x3cf285[_0x8405('0x3e')]['sort']);_0x58c11[_0x8405('0x47')]=qs[_0x8405('0x40')](_[_0x8405('0x46')](_0x3cf285[_0x8405('0x3e')],_0x51585b['filters']));if(_0x3cf285[_0x8405('0x3e')][_0x8405('0x30')]){_0x58c11[_0x8405('0x47')]=_[_0x8405('0x48')](_0x58c11[_0x8405('0x47')],{'$or':_['map'](_0x58c11[_0x8405('0x4f')],function(_0x1f2252){var _0x23fa7a={};_0x23fa7a[_0x1f2252]={'$like':'%'+_0x3cf285[_0x8405('0x3e')]['filter']+'%'};return _0x23fa7a;})});}_0x58c11=_[_0x8405('0x48')]({},_0x58c11,_0x3cf285[_0x8405('0x4a')]);return _0x3a331b[_0x8405('0x9c')](_0x58c11);}})[_0x8405('0x2b')](function(_0x1342fa){if(_0x1342fa){_0x1fa7f7=_0x1342fa[_0x8405('0x43')];if(!_0x3cf285[_0x8405('0x3e')][_0x8405('0x5f')]('nolimit')){_0x58c11[_0x8405('0x23')]=qs[_0x8405('0x23')](_0x3cf285[_0x8405('0x3e')][_0x8405('0x23')]);_0x58c11[_0x8405('0x22')]=qs['offset'](_0x3cf285[_0x8405('0x3e')][_0x8405('0x22')]);}return _0x3a331b[_0x8405('0x9c')](_0x58c11);}})['then'](function(_0x39fbeb){if(_0x39fbeb){return _0x39fbeb?{'count':_0x1fa7f7,'rows':_0x39fbeb}:null;}})['then'](respondWithResult(_0x58cc5c,null))[_0x8405('0x4d')](handleError(_0x58cc5c,null));};exports[_0x8405('0x9d')]=function(_0x3d5899,_0x573cfc,_0x4dafc7){var _0xbb0139,_0x1e7312;return db[_0x8405('0x3b')][_0x8405('0x35')]({'where':{'id':_0x3d5899[_0x8405('0x4e')]['id']}})[_0x8405('0x2b')](handleEntityNotFound(_0x573cfc,null))[_0x8405('0x2b')](function(_0xbf0eec){if(_0xbf0eec){_0x1e7312=_0xbf0eec;return _0xbf0eec['addLists'](_0x3d5899['body'][_0x8405('0x83')],_[_0x8405('0x59')](_0x3d5899['body'],[_0x8405('0x83'),'id'])||{});}return null;})[_0x8405('0x96')](function(_0x348431){var _0x357e90;_0xbb0139=_0x348431||[];var _0x5e479d=[];if(_0x348431){for(var _0xa99b73=0x0;_0xa99b73<_0x348431[_0x8405('0x43')];_0xa99b73+=0x1){var _0x27c2e0=_0x348431[_0xa99b73][_0x8405('0x2c')]({'plain':!![]});_0x1e7312['dialCheckDuplicateType']=_0x3d5899[_0x8405('0x5c')][_0x8405('0x9e')]?_0x3d5899[_0x8405('0x5c')]['dialCheckDuplicateType']:_0x1e7312[_0x8405('0x9e')];switch(_0x1e7312['dialCheckDuplicateType']){case'always':_0x357e90=squel[_0x8405('0x9f')]()['into'](_0x8405('0xa0'))[_0x8405('0xa1')]([_0x8405('0xa2'),_0x8405('0xa3'),'ContactId',_0x8405('0xa4'),_0x8405('0x66'),_0x8405('0x5a'),_0x8405('0x5b')],squel[_0x8405('0x84')]()[_0x8405('0x85')](_0x8405('0xa2'),'phone')[_0x8405('0x85')](_0x8405('0xa5'),_0x8405('0xa3'))[_0x8405('0x85')]('id',_0x8405('0xa6'))[_0x8405('0x85')](_0x27c2e0['CmListId'][_0x8405('0x8d')](),'ListId')[_0x8405('0x85')](_0x3d5899[_0x8405('0x4e')]['id'][_0x8405('0x8d')](),'VoiceQueueId')['field']('NOW()',_0x8405('0x5a'))[_0x8405('0x85')]('NOW()','updatedAt')['from']('cm_contacts')[_0x8405('0x47')](_0x8405('0xa7'))[_0x8405('0x47')](_0x8405('0xa8'),_0x27c2e0[_0x8405('0xa9')][_0x8405('0x8d')]())['where'](_0x8405('0xaa'))[_0x8405('0x47')](_0x8405('0xab'),squel[_0x8405('0x84')]()[_0x8405('0x85')](_0x8405('0xac'))[_0x8405('0x87')]('cm_hopper_final')[_0x8405('0x47')](_0x8405('0xad'),_0x3d5899['params']['id']['toString']()))[_0x8405('0x47')](_0x8405('0xab'),squel[_0x8405('0x84')]()['field'](_0x8405('0xae'))['from'](_0x8405('0xa0'))[_0x8405('0x47')](_0x8405('0xad'),_0x3d5899[_0x8405('0x4e')]['id'][_0x8405('0x8d')]())))['toString']();break;case _0x8405('0xaf'):_0x357e90=squel[_0x8405('0x9f')]()[_0x8405('0xb0')]('cm_hopper')[_0x8405('0xa1')]([_0x8405('0xa2'),_0x8405('0xa3'),_0x8405('0xa6'),_0x8405('0xa4'),_0x8405('0x66'),'createdAt',_0x8405('0x5b')],squel[_0x8405('0x84')]()[_0x8405('0x85')](_0x8405('0xa2'),_0x8405('0xa2'))[_0x8405('0x85')](_0x8405('0xa5'),_0x8405('0xa3'))[_0x8405('0x85')]('id',_0x8405('0xa6'))['field'](_0x27c2e0[_0x8405('0xa9')][_0x8405('0x8d')](),'ListId')[_0x8405('0x85')](_0x3d5899[_0x8405('0x4e')]['id'][_0x8405('0x8d')](),'VoiceQueueId')['field'](_0x8405('0xa5'),_0x8405('0x5a'))[_0x8405('0x85')](_0x8405('0xa5'),_0x8405('0x5b'))['from'](_0x8405('0xb1'))[_0x8405('0x47')]('deletedAt\x20IS\x20NULL')[_0x8405('0x47')](_0x8405('0xa8'),_0x27c2e0['CmListId'][_0x8405('0x8d')]())[_0x8405('0x47')](_0x8405('0xaa'))[_0x8405('0x47')]('phone\x20NOT\x20IN\x20(?)',squel['select']()['field']('COALESCE(phone,\x27\x27)')['from']('cm_hopper')[_0x8405('0x47')](_0x8405('0xad'),_0x3d5899[_0x8405('0x4e')]['id'][_0x8405('0x8d')]())))[_0x8405('0x8d')]();break;default:_0x357e90=squel[_0x8405('0x9f')]()[_0x8405('0xb0')]('cm_hopper')[_0x8405('0xa1')]([_0x8405('0xa2'),_0x8405('0xa3'),_0x8405('0xa6'),_0x8405('0xa4'),_0x8405('0x66'),_0x8405('0x5a'),_0x8405('0x5b')],squel['select']()[_0x8405('0x85')](_0x8405('0xa2'),'phone')[_0x8405('0x85')]('NOW()',_0x8405('0xa3'))[_0x8405('0x85')]('id',_0x8405('0xa6'))[_0x8405('0x85')](_0x27c2e0['CmListId'][_0x8405('0x8d')](),_0x8405('0xa4'))[_0x8405('0x85')](_0x3d5899[_0x8405('0x4e')]['id'][_0x8405('0x8d')](),'VoiceQueueId')[_0x8405('0x85')](_0x8405('0xa5'),_0x8405('0x5a'))[_0x8405('0x85')](_0x8405('0xa5'),'updatedAt')[_0x8405('0x87')]('cm_contacts')[_0x8405('0x47')]('deletedAt\x20IS\x20NULL')['where'](_0x8405('0xa8'),_0x27c2e0[_0x8405('0xa9')][_0x8405('0x8d')]())[_0x8405('0x47')](_0x8405('0xaa')))[_0x8405('0x8d')]();}_0x5e479d['push'](db[_0x8405('0x73')][_0x8405('0x3e')](_0x357e90));}return BPromise[_0x8405('0x92')](_0x5e479d);}})[_0x8405('0x2b')](function(){return _0xbb0139;})[_0x8405('0x2b')](respondWithResult(_0x573cfc,null))['catch'](handleError(_0x573cfc,null));};exports[_0x8405('0xb2')]=function(_0x1f6393,_0x416e28,_0xcd7c83){return db['VoiceQueue']['find']({'where':{'id':_0x1f6393[_0x8405('0x4e')]['id']}})[_0x8405('0x2b')](handleEntityNotFound(_0x416e28,null))[_0x8405('0x2b')](function(_0x41a7c8){if(_0x41a7c8){return _0x41a7c8[_0x8405('0xb2')](_0x1f6393[_0x8405('0x3e')][_0x8405('0x83')]);}})['then'](function(_0x34e661){if(_0x34e661){return db['CmHopper']['destroy']({'where':{'ListId':_0x1f6393[_0x8405('0x3e')][_0x8405('0x83')],'VoiceQueueId':_0x1f6393[_0x8405('0x4e')]['id']}})[_0x8405('0x2b')](function(){return _0x34e661;});}})[_0x8405('0x2b')](respondWithStatusCode(_0x416e28,null))[_0x8405('0x4d')](handleError(_0x416e28,null));};exports[_0x8405('0xb3')]=function(_0x4199fd,_0x46111a,_0x3f28b8){var _0x2c2f11={};var _0x1cd745={};var _0x509136;var _0x39c2d9;return db[_0x8405('0x3b')][_0x8405('0x64')]({'where':{'id':_0x4199fd[_0x8405('0x4e')]['id']}})[_0x8405('0x2b')](handleEntityNotFound(_0x46111a,null))[_0x8405('0x2b')](function(_0x431e71){if(_0x431e71){_0x509136=_0x431e71;_0x1cd745[_0x8405('0x3d')]=_[_0x8405('0x3f')](db[_0x8405('0x9b')]['rawAttributes']);_0x1cd745[_0x8405('0x3e')]=_[_0x8405('0x3f')](_0x4199fd[_0x8405('0x3e')]);_0x1cd745[_0x8405('0x40')]=_[_0x8405('0x41')](_0x1cd745[_0x8405('0x3d')],_0x1cd745[_0x8405('0x3e')]);_0x2c2f11[_0x8405('0x4f')]=_[_0x8405('0x41')](_0x1cd745[_0x8405('0x3d')],qs[_0x8405('0x42')](_0x4199fd[_0x8405('0x3e')][_0x8405('0x42')]));_0x2c2f11[_0x8405('0x4f')]=_0x2c2f11[_0x8405('0x4f')][_0x8405('0x43')]?_0x2c2f11['attributes']:_0x1cd745['model'];_0x2c2f11[_0x8405('0x60')]=qs[_0x8405('0x45')](_0x4199fd[_0x8405('0x3e')][_0x8405('0x45')]);_0x2c2f11[_0x8405('0x47')]=qs[_0x8405('0x40')](_[_0x8405('0x46')](_0x4199fd['query'],_0x1cd745[_0x8405('0x40')]));if(_0x4199fd['query'][_0x8405('0x30')]){_0x2c2f11[_0x8405('0x47')]=_[_0x8405('0x48')](_0x2c2f11[_0x8405('0x47')],{'$or':_['map'](_0x2c2f11[_0x8405('0x4f')],function(_0x283e62){var _0x2cc8b9={};_0x2cc8b9[_0x283e62]={'$like':'%'+_0x4199fd['query'][_0x8405('0x30')]+'%'};return _0x2cc8b9;})});}_0x2c2f11=_['merge']({},_0x2c2f11,_0x4199fd[_0x8405('0x4a')]);return _0x509136[_0x8405('0xb3')](_0x2c2f11);}})[_0x8405('0x2b')](function(_0x5f7744){if(_0x5f7744){_0x39c2d9=_0x5f7744[_0x8405('0x43')];if(!_0x4199fd[_0x8405('0x3e')][_0x8405('0x5f')](_0x8405('0x44'))){_0x2c2f11[_0x8405('0x23')]=qs[_0x8405('0x23')](_0x4199fd['query'][_0x8405('0x23')]);_0x2c2f11[_0x8405('0x22')]=qs[_0x8405('0x22')](_0x4199fd[_0x8405('0x3e')]['offset']);}return _0x509136[_0x8405('0xb3')](_0x2c2f11);}})['then'](function(_0x5a2a72){if(_0x5a2a72){return _0x5a2a72?{'count':_0x39c2d9,'rows':_0x5a2a72}:null;}})['then'](respondWithResult(_0x46111a,null))[_0x8405('0x4d')](handleError(_0x46111a,null));};exports['addBlackLists']=function(_0x4a963d,_0x8e585f,_0x2655a6){var _0x5c7895,_0xde0d56;return db[_0x8405('0x3b')][_0x8405('0x35')]({'where':{'id':_0x4a963d[_0x8405('0x4e')]['id']}})[_0x8405('0x2b')](handleEntityNotFound(_0x8e585f,null))['then'](function(_0x2bc8fd){if(_0x2bc8fd){_0xde0d56=_0x2bc8fd;return _0x2bc8fd[_0x8405('0xb4')](_0x4a963d['body'][_0x8405('0x83')],_[_0x8405('0x59')](_0x4a963d[_0x8405('0x5c')],[_0x8405('0x83'),'id'])||{});}return null;})[_0x8405('0x96')](function(_0x10e772){var _0x14dfdf;_0x5c7895=_0x10e772||[];var _0x7038cc=[];if(_0x10e772){for(var _0xb59552=0x0;_0xb59552<_0x10e772[_0x8405('0x43')];_0xb59552+=0x1){var _0x560315=_0x10e772[_0xb59552]['get']({'plain':!![]});_0x14dfdf=squel[_0x8405('0x9f')]()[_0x8405('0xb0')](_0x8405('0xb5'))['fromQuery']([_0x8405('0xa2'),_0x8405('0xa6'),_0x8405('0xa4'),_0x8405('0x66'),_0x8405('0x5a'),_0x8405('0x5b')],squel[_0x8405('0x84')]()[_0x8405('0x85')](_0x8405('0xa2'),_0x8405('0xa2'))[_0x8405('0x85')]('id',_0x8405('0xa6'))['field'](_0x560315[_0x8405('0xa9')][_0x8405('0x8d')](),'ListId')[_0x8405('0x85')](_0x4a963d['params']['id']['toString'](),_0x8405('0x66'))[_0x8405('0x85')](_0x8405('0xa5'),'createdAt')['field'](_0x8405('0xa5'),_0x8405('0x5b'))[_0x8405('0x87')](_0x8405('0xb1'))[_0x8405('0x47')]('deletedAt\x20IS\x20NULL')[_0x8405('0x47')]('ListId\x20=\x20?',_0x560315[_0x8405('0xa9')][_0x8405('0x8d')]())[_0x8405('0x47')]('phone\x20IS\x20NOT\x20NULL'))[_0x8405('0x8d')]();_0x7038cc[_0x8405('0x97')](db[_0x8405('0x73')][_0x8405('0x3e')](_0x14dfdf));}return BPromise[_0x8405('0x92')](_0x7038cc);}})[_0x8405('0x2b')](function(){return _0x5c7895;})['then'](respondWithResult(_0x8e585f,null))['catch'](handleError(_0x8e585f,null));};exports['removeBlackLists']=function(_0x10e7df,_0x198f83,_0x3331b1){return db[_0x8405('0x3b')]['find']({'where':{'id':_0x10e7df[_0x8405('0x4e')]['id']}})[_0x8405('0x2b')](handleEntityNotFound(_0x198f83,null))[_0x8405('0x2b')](function(_0x131730){if(_0x131730){return _0x131730['removeBlackLists'](_0x10e7df[_0x8405('0x3e')][_0x8405('0x83')]);}})[_0x8405('0x2b')](function(_0x161022){if(_0x161022){return db[_0x8405('0x69')][_0x8405('0x38')]({'where':{'ListId':_0x10e7df[_0x8405('0x3e')][_0x8405('0x83')],'VoiceQueueId':_0x10e7df['params']['id']}})['then'](function(){return _0x161022;});}})[_0x8405('0x2b')](respondWithStatusCode(_0x198f83,null))[_0x8405('0x4d')](handleError(_0x198f83,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 76b07d3..0bc1fe5 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 _0xcca6=['emit','exports','events','../../mysqldb','VoiceQueue','save','update','remove'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xcca6,0x1f2));var _0x6cca=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0xcca6[_0x13ce0c];return _0x4388fb;};'use strict';var EventEmitter=require(_0x6cca('0x0'));var VoiceQueue=require(_0x6cca('0x1'))['db'][_0x6cca('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6cca('0x3'),'afterUpdate':_0x6cca('0x4'),'afterDestroy':_0x6cca('0x5')};function emitEvent(_0x49a5ad){return function(_0x37a3f6,_0x1f4be4,_0x3dfe48){VoiceQueueEvents[_0x6cca('0x6')](_0x49a5ad+':'+_0x37a3f6['id'],_0x37a3f6);VoiceQueueEvents[_0x6cca('0x6')](_0x49a5ad,_0x37a3f6);_0x3dfe48(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x6cca('0x7')]=VoiceQueueEvents; \ No newline at end of file +var _0x282c=['events','../../mysqldb','VoiceQueue','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0x282c,0x104));var _0xc282=function(_0x505115,_0x426d78){_0x505115=_0x505115-0x0;var _0x57d081=_0x282c[_0x505115];return _0x57d081;};'use strict';var EventEmitter=require(_0xc282('0x0'));var VoiceQueue=require(_0xc282('0x1'))['db'][_0xc282('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xc282('0x3')](0x0);var events={'afterCreate':_0xc282('0x4'),'afterUpdate':'update','afterDestroy':_0xc282('0x5')};function emitEvent(_0x3c0a27){return function(_0xe60a54,_0x22080a,_0x2ec92a){VoiceQueueEvents['emit'](_0x3c0a27+':'+_0xe60a54['id'],_0xe60a54);VoiceQueueEvents[_0xc282('0x6')](_0x3c0a27,_0xe60a54);_0x2ec92a(null);};}for(var e in events){if(events[_0xc282('0x7')](e)){var event=events[e];VoiceQueue[_0xc282('0x8')](e,emitEvent(event));}}module[_0xc282('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 8136cd8..280a3b6 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['exports','VoiceQueue','voice_queues','lodash','../../config/logger','api','moment','path','../../config/environment','./voiceQueue.attributes'];(function(_0x1415ef,_0x5c219e){var _0x234acc=function(_0x2dbfca){while(--_0x2dbfca){_0x1415ef['push'](_0x1415ef['shift']());}};_0x234acc(++_0x5c219e);}(_0x3e74,0x175));var _0x43e7=function(_0x325635,_0x3bae66){_0x325635=_0x325635-0x0;var _0x55dc33=_0x3e74[_0x325635];return _0x55dc33;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x008c=['define','voice_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports'];(function(_0x2bbdc4,_0x2cb88e){var _0x482d0c=function(_0x4da8ce){while(--_0x4da8ce){_0x2bbdc4['push'](_0x2bbdc4['shift']());}};_0x482d0c(++_0x2cb88e);}(_0x008c,0x188));var _0xc008=function(_0x8b631b,_0x386724){_0x8b631b=_0x8b631b-0x0;var _0x3e6832=_0x008c[_0x8b631b];return _0x3e6832;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('VoiceQueue',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index ba8e133..0b8db97 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 _0x194e=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./voiceQueue.socket','request','then','info','request\x20sent','debug','stringify','error','code','VoiceQueue,\x20%s,\x20%s','message','result','catch','VoiceQueue','findAll','options','raw','attributes','limit','include','map','model','GetVoiceQueue','ShowVoiceQueue','find','where','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x194e,0x181));var _0xe194=function(_0x36e162,_0xeae5c4){_0x36e162=_0x36e162-0x0;var _0x8d7b=_0x194e[_0x36e162];return _0x8d7b;};'use strict';var _=require(_0xe194('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe194('0x1'));var rs=require(_0xe194('0x2'));var fs=require('fs');var Redis=require(_0xe194('0x3'));var db=require(_0xe194('0x4'))['db'];var utils=require(_0xe194('0x5'));var logger=require(_0xe194('0x6'))('rpc');var config=require(_0xe194('0x7'));var jayson=require(_0xe194('0x8'));var client=jayson[_0xe194('0x9')][_0xe194('0xa')]({'port':0x232a});config[_0xe194('0xb')]=_['defaults'](config[_0xe194('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xe194('0xc'))(new Redis(config[_0xe194('0xb')]));require(_0xe194('0xd'))['register'](socket);function respondWithRpcPromise(_0x2e578f,_0x299de6,_0x206837){return new BPromise(function(_0x95888f,_0x51bdcf){return client[_0xe194('0xe')](_0x2e578f,_0x206837)[_0xe194('0xf')](function(_0x13ef50){logger[_0xe194('0x10')]('VoiceQueue,\x20%s,\x20%s',_0x299de6,_0xe194('0x11'));logger[_0xe194('0x12')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x299de6,_0xe194('0x11'),JSON[_0xe194('0x13')](_0x13ef50));if(_0x13ef50[_0xe194('0x14')]){if(_0x13ef50[_0xe194('0x14')][_0xe194('0x15')]===0x1f4){logger[_0xe194('0x14')](_0xe194('0x16'),_0x299de6,_0x13ef50['error'][_0xe194('0x17')]);return _0x51bdcf(_0x13ef50[_0xe194('0x14')][_0xe194('0x17')]);}logger[_0xe194('0x14')](_0xe194('0x16'),_0x299de6,_0x13ef50[_0xe194('0x14')][_0xe194('0x17')]);return _0x95888f(_0x13ef50['error'][_0xe194('0x17')]);}else{logger[_0xe194('0x10')](_0xe194('0x16'),_0x299de6,_0xe194('0x11'));_0x95888f(_0x13ef50[_0xe194('0x18')][_0xe194('0x17')]);}})[_0xe194('0x19')](function(_0x39e24d){logger['error'](_0xe194('0x16'),_0x299de6,_0x39e24d);_0x51bdcf(_0x39e24d);});});}exports['GetVoiceQueue']=function(_0x5037fe){var _0x4a1258=this;return new Promise(function(_0x22bbf7,_0x40f84f){return db[_0xe194('0x1a')][_0xe194('0x1b')]({'raw':_0x5037fe[_0xe194('0x1c')]?_0x5037fe['options'][_0xe194('0x1d')]===undefined?!![]:![]:!![],'where':_0x5037fe['options']?_0x5037fe[_0xe194('0x1c')]['where']||null:null,'attributes':_0x5037fe[_0xe194('0x1c')]?_0x5037fe['options'][_0xe194('0x1e')]||null:null,'limit':_0x5037fe[_0xe194('0x1c')]?_0x5037fe['options'][_0xe194('0x1f')]||null:null,'include':_0x5037fe['options']?_0x5037fe['options'][_0xe194('0x20')]?_[_0xe194('0x21')](_0x5037fe[_0xe194('0x1c')][_0xe194('0x20')],function(_0xce9ff4){return{'model':db[_0xce9ff4[_0xe194('0x22')]],'as':_0xce9ff4['as'],'attributes':_0xce9ff4[_0xe194('0x1e')],'include':_0xce9ff4[_0xe194('0x20')]?_[_0xe194('0x21')](_0xce9ff4[_0xe194('0x20')],function(_0x423718){return{'model':db[_0x423718[_0xe194('0x22')]],'as':_0x423718['as'],'attributes':_0x423718[_0xe194('0x1e')],'include':_0x423718['include']?_[_0xe194('0x21')](_0x423718['include'],function(_0x2a92c4){return{'model':db[_0x2a92c4[_0xe194('0x22')]],'as':_0x2a92c4['as'],'attributes':_0x2a92c4[_0xe194('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xe194('0xf')](function(_0x1c4ce9){logger[_0xe194('0x10')](_0xe194('0x23'),_0x5037fe);logger[_0xe194('0x12')](_0xe194('0x23'),_0x5037fe,JSON[_0xe194('0x13')](_0x1c4ce9));_0x22bbf7(_0x1c4ce9);})[_0xe194('0x19')](function(_0x48b992){logger[_0xe194('0x14')](_0xe194('0x23'),_0x48b992['message'],_0x5037fe);_0x40f84f(_0x4a1258[_0xe194('0x14')](0x1f4,_0x48b992[_0xe194('0x17')]));});});};exports[_0xe194('0x24')]=function(_0x3e4bc3){var _0x35ef82=this;return new Promise(function(_0x3eda16,_0x243f65){return db[_0xe194('0x1a')][_0xe194('0x25')]({'raw':_0x3e4bc3[_0xe194('0x1c')]?_0x3e4bc3[_0xe194('0x1c')][_0xe194('0x1d')]===undefined?!![]:![]:!![],'where':_0x3e4bc3[_0xe194('0x1c')]?_0x3e4bc3['options'][_0xe194('0x26')]||null:null,'attributes':_0x3e4bc3[_0xe194('0x1c')]?_0x3e4bc3[_0xe194('0x1c')][_0xe194('0x1e')]||null:null,'include':_0x3e4bc3[_0xe194('0x1c')]?_0x3e4bc3['options'][_0xe194('0x20')]?_['map'](_0x3e4bc3[_0xe194('0x1c')]['include'],function(_0xc8944b){return{'model':db[_0xc8944b[_0xe194('0x22')]],'as':_0xc8944b['as'],'attributes':_0xc8944b['attributes'],'include':_0xc8944b[_0xe194('0x20')]?_[_0xe194('0x21')](_0xc8944b[_0xe194('0x20')],function(_0x4fe8cc){return{'model':db[_0x4fe8cc['model']],'as':_0x4fe8cc['as'],'attributes':_0x4fe8cc[_0xe194('0x1e')],'include':_0x4fe8cc[_0xe194('0x20')]?_['map'](_0x4fe8cc[_0xe194('0x20')],function(_0x38712a){return{'model':db[_0x38712a['model']],'as':_0x38712a['as'],'attributes':_0x38712a[_0xe194('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4823e4){logger[_0xe194('0x10')](_0xe194('0x24'),_0x3e4bc3);logger['debug'](_0xe194('0x24'),_0x3e4bc3,JSON[_0xe194('0x13')](_0x4823e4));_0x3eda16(_0x4823e4);})[_0xe194('0x19')](function(_0x720f5d){logger[_0xe194('0x14')](_0xe194('0x24'),_0x720f5d[_0xe194('0x17')],_0x3e4bc3);_0x243f65(_0x35ef82['error'](0x1f4,_0x720f5d[_0xe194('0x17')]));});});}; \ No newline at end of file +var _0x1e36=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','./voiceQueue.socket','register','request','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','include','map','model','then','stringify','ShowVoiceQueue','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x3a86a7,_0x12ade0){var _0x19b1b6=function(_0x2af9d0){while(--_0x2af9d0){_0x3a86a7['push'](_0x3a86a7['shift']());}};_0x19b1b6(++_0x12ade0);}(_0x1e36,0x9a));var _0x61e3=function(_0x35387d,_0x1ba72f){_0x35387d=_0x35387d-0x0;var _0x3aba56=_0x1e36[_0x35387d];return _0x3aba56;};'use strict';var _=require(_0x61e3('0x0'));var util=require(_0x61e3('0x1'));var moment=require(_0x61e3('0x2'));var BPromise=require(_0x61e3('0x3'));var rs=require(_0x61e3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x61e3('0x5'))['db'];var utils=require(_0x61e3('0x6'));var logger=require(_0x61e3('0x7'))(_0x61e3('0x8'));var config=require(_0x61e3('0x9'));var jayson=require(_0x61e3('0xa'));var client=jayson['client'][_0x61e3('0xb')]({'port':0x232a});config[_0x61e3('0xc')]=_['defaults'](config[_0x61e3('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x61e3('0xd'))(new Redis(config[_0x61e3('0xc')]));require(_0x61e3('0xe'))[_0x61e3('0xf')](socket);function respondWithRpcPromise(_0x1a09fc,_0x206021,_0x4eeda1){return new BPromise(function(_0x53e3f0,_0xd8a5e8){return client[_0x61e3('0x10')](_0x1a09fc,_0x4eeda1)['then'](function(_0x354203){logger['info'](_0x61e3('0x11'),_0x206021,_0x61e3('0x12'));logger[_0x61e3('0x13')](_0x61e3('0x14'),_0x206021,_0x61e3('0x12'),JSON['stringify'](_0x354203));if(_0x354203[_0x61e3('0x15')]){if(_0x354203[_0x61e3('0x15')][_0x61e3('0x16')]===0x1f4){logger[_0x61e3('0x15')](_0x61e3('0x11'),_0x206021,_0x354203[_0x61e3('0x15')][_0x61e3('0x17')]);return _0xd8a5e8(_0x354203['error']['message']);}logger[_0x61e3('0x15')](_0x61e3('0x11'),_0x206021,_0x354203[_0x61e3('0x15')]['message']);return _0x53e3f0(_0x354203['error']['message']);}else{logger[_0x61e3('0x18')](_0x61e3('0x11'),_0x206021,_0x61e3('0x12'));_0x53e3f0(_0x354203[_0x61e3('0x19')][_0x61e3('0x17')]);}})[_0x61e3('0x1a')](function(_0x84e35e){logger[_0x61e3('0x15')](_0x61e3('0x11'),_0x206021,_0x84e35e);_0xd8a5e8(_0x84e35e);});});}exports[_0x61e3('0x1b')]=function(_0x447fbb){var _0x37125d=this;return new Promise(function(_0x15e2a3,_0x2e0819){return db[_0x61e3('0x1c')][_0x61e3('0x1d')]({'raw':_0x447fbb['options']?_0x447fbb[_0x61e3('0x1e')][_0x61e3('0x1f')]===undefined?!![]:![]:!![],'where':_0x447fbb[_0x61e3('0x1e')]?_0x447fbb[_0x61e3('0x1e')][_0x61e3('0x20')]||null:null,'attributes':_0x447fbb[_0x61e3('0x1e')]?_0x447fbb[_0x61e3('0x1e')][_0x61e3('0x21')]||null:null,'limit':_0x447fbb['options']?_0x447fbb[_0x61e3('0x1e')]['limit']||null:null,'include':_0x447fbb[_0x61e3('0x1e')]?_0x447fbb[_0x61e3('0x1e')][_0x61e3('0x22')]?_['map'](_0x447fbb['options'][_0x61e3('0x22')],function(_0x1395ab){return{'model':db[_0x1395ab['model']],'as':_0x1395ab['as'],'attributes':_0x1395ab['attributes'],'include':_0x1395ab[_0x61e3('0x22')]?_[_0x61e3('0x23')](_0x1395ab[_0x61e3('0x22')],function(_0x500db0){return{'model':db[_0x500db0[_0x61e3('0x24')]],'as':_0x500db0['as'],'attributes':_0x500db0[_0x61e3('0x21')],'include':_0x500db0[_0x61e3('0x22')]?_[_0x61e3('0x23')](_0x500db0['include'],function(_0x25615b){return{'model':db[_0x25615b[_0x61e3('0x24')]],'as':_0x25615b['as'],'attributes':_0x25615b[_0x61e3('0x21')]};}):[]};}):[]};}):[]:[]})[_0x61e3('0x25')](function(_0x213872){logger[_0x61e3('0x18')](_0x61e3('0x1b'),_0x447fbb);logger[_0x61e3('0x13')](_0x61e3('0x1b'),_0x447fbb,JSON[_0x61e3('0x26')](_0x213872));_0x15e2a3(_0x213872);})[_0x61e3('0x1a')](function(_0x12d7ac){logger['error'](_0x61e3('0x1b'),_0x12d7ac[_0x61e3('0x17')],_0x447fbb);_0x2e0819(_0x37125d[_0x61e3('0x15')](0x1f4,_0x12d7ac[_0x61e3('0x17')]));});});};exports[_0x61e3('0x27')]=function(_0x31c15a){var _0x3a8e32=this;return new Promise(function(_0x4d03f3,_0x5cb635){return db['VoiceQueue']['find']({'raw':_0x31c15a[_0x61e3('0x1e')]?_0x31c15a[_0x61e3('0x1e')][_0x61e3('0x1f')]===undefined?!![]:![]:!![],'where':_0x31c15a[_0x61e3('0x1e')]?_0x31c15a[_0x61e3('0x1e')]['where']||null:null,'attributes':_0x31c15a[_0x61e3('0x1e')]?_0x31c15a[_0x61e3('0x1e')]['attributes']||null:null,'include':_0x31c15a[_0x61e3('0x1e')]?_0x31c15a[_0x61e3('0x1e')][_0x61e3('0x22')]?_[_0x61e3('0x23')](_0x31c15a['options'][_0x61e3('0x22')],function(_0x1a847f){return{'model':db[_0x1a847f[_0x61e3('0x24')]],'as':_0x1a847f['as'],'attributes':_0x1a847f['attributes'],'include':_0x1a847f[_0x61e3('0x22')]?_[_0x61e3('0x23')](_0x1a847f[_0x61e3('0x22')],function(_0x43f212){return{'model':db[_0x43f212[_0x61e3('0x24')]],'as':_0x43f212['as'],'attributes':_0x43f212[_0x61e3('0x21')],'include':_0x43f212['include']?_[_0x61e3('0x23')](_0x43f212[_0x61e3('0x22')],function(_0x2515e0){return{'model':db[_0x2515e0[_0x61e3('0x24')]],'as':_0x2515e0['as'],'attributes':_0x2515e0[_0x61e3('0x21')]};}):[]};}):[]};}):[]:[]})[_0x61e3('0x25')](function(_0x2229ce){logger[_0x61e3('0x18')](_0x61e3('0x27'),_0x31c15a);logger[_0x61e3('0x13')]('ShowVoiceQueue',_0x31c15a,JSON[_0x61e3('0x26')](_0x2229ce));_0x4d03f3(_0x2229ce);})[_0x61e3('0x1a')](function(_0x59246d){logger[_0x61e3('0x15')]('ShowVoiceQueue',_0x59246d[_0x61e3('0x17')],_0x31c15a);_0x5cb635(_0x3a8e32[_0x61e3('0x15')](0x1f4,_0x59246d[_0x61e3('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 313bc42..62814bf 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 _0xb4d6=['register','length','voiceQueue:','./voiceQueue.events','save','remove','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb4d6,0x176));var _0x6b4d=function(_0x12daa3,_0x5725c8){_0x12daa3=_0x12daa3-0x0;var _0x219113=_0xb4d6[_0x12daa3];return _0x219113;};'use strict';var VoiceQueueEvents=require(_0x6b4d('0x0'));var events=[_0x6b4d('0x1'),_0x6b4d('0x2'),_0x6b4d('0x3')];function createListener(_0x1931b9,_0x1b75ac){return function(_0x6591dd){_0x1b75ac['emit'](_0x1931b9,_0x6591dd);};}function removeListener(_0x1fdad1,_0x506eaa){return function(){VoiceQueueEvents['removeListener'](_0x1fdad1,_0x506eaa);};}exports[_0x6b4d('0x4')]=function(_0x87f91d){for(var _0x3c9dff=0x0,_0x20abe3=events[_0x6b4d('0x5')];_0x3c9dff<_0x20abe3;_0x3c9dff++){var _0x21a526=events[_0x3c9dff];var _0x59fdfa=createListener(_0x6b4d('0x6')+_0x21a526,_0x87f91d);VoiceQueueEvents['on'](_0x21a526,_0x59fdfa);}}; \ No newline at end of file +var _0xff48=['length','voiceQueue:','./voiceQueue.events','save','remove','update','emit','register'];(function(_0x18a486,_0x199c8f){var _0x3ce1f6=function(_0x50fe21){while(--_0x50fe21){_0x18a486['push'](_0x18a486['shift']());}};_0x3ce1f6(++_0x199c8f);}(_0xff48,0x162));var _0x8ff4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xff48[_0x321bb2];return _0x9c12ed;};'use strict';var VoiceQueueEvents=require(_0x8ff4('0x0'));var events=[_0x8ff4('0x1'),_0x8ff4('0x2'),_0x8ff4('0x3')];function createListener(_0x161db2,_0x468ffc){return function(_0x2e3f5a){_0x468ffc[_0x8ff4('0x4')](_0x161db2,_0x2e3f5a);};}function removeListener(_0x3c5b77,_0x57dc28){return function(){VoiceQueueEvents['removeListener'](_0x3c5b77,_0x57dc28);};}exports[_0x8ff4('0x5')]=function(_0x26de1e){for(var _0x3ebca2=0x0,_0x52bf1e=events[_0x8ff4('0x6')];_0x3ebca2<_0x52bf1e;_0x3ebca2++){var _0x4adf73=events[_0x3ebca2];var _0x81edb2=createListener(_0x8ff4('0x7')+_0x4adf73,_0x26de1e);VoiceQueueEvents['on'](_0x4adf73,_0x81edb2);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index cb63eb0..c235de6 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 _0xf525=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','index','/describe','describe','isAuthenticated','getVoiceQueuesReport','/:id','show','post','create','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x16ccc4,_0x439e40){var _0x2d3fd0=function(_0x16c8e2){while(--_0x16c8e2){_0x16ccc4['push'](_0x16ccc4['shift']());}};_0x2d3fd0(++_0x439e40);}(_0xf525,0xea));var _0x5f52=function(_0x36a127,_0x18c480){_0x36a127=_0x36a127-0x0;var _0x281ad7=_0xf525[_0x36a127];return _0x281ad7;};'use strict';var multer=require(_0x5f52('0x0'));var util=require(_0x5f52('0x1'));var path=require('path');var timeout=require(_0x5f52('0x2'));var express=require(_0x5f52('0x3'));var router=express[_0x5f52('0x4')]();var fs_extra=require(_0x5f52('0x5'));var auth=require(_0x5f52('0x6'));var interaction=require(_0x5f52('0x7'));var config=require(_0x5f52('0x8'));var controller=require(_0x5f52('0x9'));router[_0x5f52('0xa')]('/',auth['isAuthenticated'](),controller[_0x5f52('0xb')]);router[_0x5f52('0xa')](_0x5f52('0xc'),auth['isAuthenticated'](),controller[_0x5f52('0xd')]);router[_0x5f52('0xa')]('/index',auth[_0x5f52('0xe')](),controller[_0x5f52('0xf')]);router[_0x5f52('0xa')](_0x5f52('0x10'),auth['isAuthenticated'](),controller[_0x5f52('0x11')]);router[_0x5f52('0x12')]('/',auth[_0x5f52('0xe')](),controller[_0x5f52('0x13')]);router[_0x5f52('0x14')](_0x5f52('0x10'),auth[_0x5f52('0xe')](),controller[_0x5f52('0x15')]);router['delete'](_0x5f52('0x10'),auth[_0x5f52('0xe')](),controller[_0x5f52('0x16')]);module[_0x5f52('0x17')]=router; \ No newline at end of file +var _0xe23f=['post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','../../components/interaction/service','./voiceQueueReport.controller','get','isAuthenticated','index','describe','/index','/:id','show'];(function(_0x1df53d,_0x557c00){var _0x3e0f71=function(_0x18d99c){while(--_0x18d99c){_0x1df53d['push'](_0x1df53d['shift']());}};_0x3e0f71(++_0x557c00);}(_0xe23f,0x16f));var _0xfe23=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe23f[_0x2641f9];return _0x585741;};'use strict';var multer=require('multer');var util=require(_0xfe23('0x0'));var path=require(_0xfe23('0x1'));var timeout=require(_0xfe23('0x2'));var express=require(_0xfe23('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfe23('0x4'));var config=require('../../config/environment');var controller=require(_0xfe23('0x5'));router[_0xfe23('0x6')]('/',auth[_0xfe23('0x7')](),controller[_0xfe23('0x8')]);router[_0xfe23('0x6')]('/describe',auth['isAuthenticated'](),controller[_0xfe23('0x9')]);router['get'](_0xfe23('0xa'),auth[_0xfe23('0x7')](),controller['getVoiceQueuesReport']);router[_0xfe23('0x6')](_0xfe23('0xb'),auth[_0xfe23('0x7')](),controller[_0xfe23('0xc')]);router[_0xfe23('0xd')]('/',auth[_0xfe23('0x7')](),controller[_0xfe23('0xe')]);router[_0xfe23('0xf')]('/:id',auth[_0xfe23('0x7')](),controller[_0xfe23('0x10')]);router[_0xfe23('0x11')](_0xfe23('0xb'),auth[_0xfe23('0x7')](),controller[_0xfe23('0x12')]);module[_0xfe23('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 7bebdd6..3d13d8d 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 _0xd98d=['diff','setDataValue','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','STRING','DATE','getDataValue','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd98d,0x111));var _0xdd98=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd98d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xdd98('0x0'));var moment=require(_0xdd98('0x1'));module['exports']={'type':{'type':Sequelize[_0xdd98('0x2')]},'uniqueid':{'type':Sequelize[_0xdd98('0x2')]},'calleridnum':{'type':Sequelize[_0xdd98('0x2')]},'calleridname':{'type':Sequelize[_0xdd98('0x2')]},'queue':{'type':Sequelize[_0xdd98('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0xdd98('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0xdd98('0x3')],'set':function(_0x299132){var _0x54a2bb=moment(_0x299132);var _0x4f9d78=moment(this[_0xdd98('0x4')](_0xdd98('0x5')))['format'](_0xdd98('0x6'));var _0x1175f8=_0x54a2bb[_0xdd98('0x7')](_0x4f9d78,'seconds');this[_0xdd98('0x8')]('queuecallerleaveAt',_0x299132);this['setDataValue'](_0xdd98('0x9'),_0x1175f8||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0xdd98('0xa')]},'queuecallerabandon':{'type':Sequelize[_0xdd98('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xdd98('0x3')]},'queuecallercomplete':{'type':Sequelize[_0xdd98('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xdd98('0x3')]},'queuecallerexit':{'type':Sequelize[_0xdd98('0xb')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xdd98('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0xdd98('0x2')],'comment':_0xdd98('0xc')},'originalposition':{'type':Sequelize[_0xdd98('0xa')]},'channel':{'type':Sequelize[_0xdd98('0x2')]},'connectedlinenum':{'type':Sequelize[_0xdd98('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xdd98('0x2')]},'context':{'type':Sequelize[_0xdd98('0x2')]},'exten':{'type':Sequelize[_0xdd98('0x2')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0xdd98('0xa')]},'mohtime':{'type':Sequelize[_0xdd98('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xdd98('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xdd98('0xd')},'transferexten':{'type':Sequelize[_0xdd98('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xdd98('0x2')]},'thirdDisposition':{'type':Sequelize[_0xdd98('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0xdd98('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5aec=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','diff','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','moment','exports','STRING'];(function(_0x388e27,_0x276fd5){var _0x19613d=function(_0x2fe730){while(--_0x2fe730){_0x388e27['push'](_0x388e27['shift']());}};_0x19613d(++_0x276fd5);}(_0x5aec,0x189));var _0xc5ae=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0x5aec[_0x3c8e9a];return _0x2d4c57;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xc5ae('0x0'));module[_0xc5ae('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xc5ae('0x2')]},'calleridnum':{'type':Sequelize[_0xc5ae('0x2')]},'calleridname':{'type':Sequelize[_0xc5ae('0x2')]},'queue':{'type':Sequelize[_0xc5ae('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0xc5ae('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0xc5ae('0x3')],'set':function(_0x2be476){var _0x4e2825=moment(_0x2be476);var _0x5383c2=moment(this['getDataValue']('queuecallerjoinAt'))[_0xc5ae('0x4')](_0xc5ae('0x5'));var _0x191e7f=_0x4e2825[_0xc5ae('0x6')](_0x5383c2,'seconds');this[_0xc5ae('0x7')](_0xc5ae('0x8'),_0x2be476);this[_0xc5ae('0x7')](_0xc5ae('0x9'),_0x191e7f||null);}},'position':{'type':Sequelize[_0xc5ae('0xa')]},'count':{'type':Sequelize[_0xc5ae('0xa')]},'queuecallerabandon':{'type':Sequelize[_0xc5ae('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xc5ae('0x3')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xc5ae('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0xc5ae('0x2')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0xc5ae('0xa')]},'channel':{'type':Sequelize[_0xc5ae('0x2')]},'connectedlinenum':{'type':Sequelize[_0xc5ae('0x2')]},'connectedlinename':{'type':Sequelize[_0xc5ae('0x2')]},'accountcode':{'type':Sequelize[_0xc5ae('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xc5ae('0x2')]},'holdtime':{'type':Sequelize[_0xc5ae('0xa')]},'mohtime':{'type':Sequelize[_0xc5ae('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xc5ae('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xc5ae('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xc5ae('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xc5ae('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xc5ae('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0xc5ae('0xa')],'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 9491961..56283a9 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 _0x5726=['api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','limit','Content-Range','json','apply','reject','save','then','destroy','error','name','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','params','find','catch','create','body','describe','hasOwnProperty','rows','getVoiceQueuesReport','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x418c27,_0xbaeedb){var _0x1a6851=function(_0x1c3df1){while(--_0x1c3df1){_0x418c27['push'](_0x418c27['shift']());}};_0x1a6851(++_0xbaeedb);}(_0x5726,0x16e));var _0x6572=function(_0x5d55e3,_0x442b43){_0x5d55e3=_0x5d55e3-0x0;var _0x31aed8=_0x5726[_0x5d55e3];return _0x31aed8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6572('0x0'));var zipdir=require(_0x6572('0x1'));var jsonpatch=require(_0x6572('0x2'));var rp=require('request-promise');var moment=require(_0x6572('0x3'));var BPromise=require(_0x6572('0x4'));var Mustache=require(_0x6572('0x5'));var util=require('util');var path=require(_0x6572('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6572('0x7'));var squel=require(_0x6572('0x8'));var crypto=require(_0x6572('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x6572('0xa'));var toCsv=require(_0x6572('0xb'));var querystring=require(_0x6572('0xc'));var Papa=require(_0x6572('0xd'));var Redis=require(_0x6572('0xe'));var authService=require(_0x6572('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x6572('0x10'));var hardwareService=require(_0x6572('0x11'));var logger=require(_0x6572('0x12'))(_0x6572('0x13'));var utils=require(_0x6572('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x6572('0x15'));var db=require(_0x6572('0x16'))['db'];config[_0x6572('0x17')]=_['defaults'](config[_0x6572('0x17')],{'host':_0x6572('0x18'),'port':0x18eb});var socket=require(_0x6572('0x19'))(new Redis(config[_0x6572('0x17')]));require('./voiceQueueReport.socket')[_0x6572('0x1a')](socket);function respondWithStatusCode(_0x560850,_0x295cd6){_0x295cd6=_0x295cd6||0xcc;return function(_0x4fa07e){if(_0x4fa07e){return _0x560850[_0x6572('0x1b')](_0x295cd6);}return _0x560850[_0x6572('0x1c')](_0x295cd6)[_0x6572('0x1d')]();};}function respondWithResult(_0x42d8f7,_0x19d61b){_0x19d61b=_0x19d61b||0xc8;return function(_0x2e98bf){if(_0x2e98bf){return _0x42d8f7['status'](_0x19d61b)['json'](_0x2e98bf);}};}function respondWithFilteredResult(_0x151905,_0x3e3837){return function(_0x2b3aaf){if(_0x2b3aaf){var _0x4a9caf=typeof _0x3e3837[_0x6572('0x1e')]===_0x6572('0x1f')&&typeof _0x3e3837[_0x6572('0x20')]===_0x6572('0x1f');var _0x584319=_0x2b3aaf['count'];var _0x199d17=_0x4a9caf?0x0:_0x3e3837['offset'];var _0x485451=_0x4a9caf?_0x2b3aaf['count']:_0x3e3837[_0x6572('0x1e')]+_0x3e3837['limit'];var _0x389802;if(_0x485451>=_0x584319){_0x485451=_0x584319;_0x389802=0xc8;}else{_0x389802=0xce;}_0x151905[_0x6572('0x1c')](_0x389802);return _0x151905['set'](_0x6572('0x21'),_0x199d17+'-'+_0x485451+'/'+_0x584319)[_0x6572('0x22')](_0x2b3aaf);}return null;};}function patchUpdates(_0x49b57e){return function(_0x380c27){try{jsonpatch[_0x6572('0x23')](_0x380c27,_0x49b57e,!![]);}catch(_0x41a524){return BPromise[_0x6572('0x24')](_0x41a524);}return _0x380c27[_0x6572('0x25')]();};}function saveUpdates(_0x48396d,_0x3a53ba){return function(_0x5327a6){if(_0x5327a6){return _0x5327a6['update'](_0x48396d)[_0x6572('0x26')](function(_0x18ada3){return _0x18ada3;});}return null;};}function removeEntity(_0x58afe3,_0x14ff2f){return function(_0x57d1fb){if(_0x57d1fb){return _0x57d1fb[_0x6572('0x27')]()['then'](function(){_0x58afe3[_0x6572('0x1c')](0xcc)[_0x6572('0x1d')]();});}};}function handleEntityNotFound(_0x3c6a20,_0x5b5b2a){return function(_0x48d3dc){if(!_0x48d3dc){_0x3c6a20[_0x6572('0x1b')](0x194);}return _0x48d3dc;};}function handleError(_0x3e6053,_0x47fdfd){_0x47fdfd=_0x47fdfd||0x1f4;return function(_0x2e4e6b){logger[_0x6572('0x28')](_0x2e4e6b['stack']);if(_0x2e4e6b[_0x6572('0x29')]){delete _0x2e4e6b[_0x6572('0x29')];}_0x3e6053['status'](_0x47fdfd)['send'](_0x2e4e6b);};}exports['index']=function(_0x5015b0,_0x14c6d2){var _0x3560cc={},_0xbd04f3={},_0x159a28={'count':0x0,'rows':[]};var _0x20acf0=_[_0x6572('0x2a')](db[_0x6572('0x2b')][_0x6572('0x2c')],function(_0x269f14){return{'name':_0x269f14[_0x6572('0x2d')],'type':_0x269f14[_0x6572('0x2e')][_0x6572('0x2f')]};});_0xbd04f3[_0x6572('0x30')]=_[_0x6572('0x2a')](_0x20acf0,_0x6572('0x29'));_0xbd04f3[_0x6572('0x31')]=_[_0x6572('0x32')](_0x5015b0['query']);_0xbd04f3[_0x6572('0x33')]=_[_0x6572('0x34')](_0xbd04f3['model'],_0xbd04f3['query']);_0x3560cc[_0x6572('0x35')]=_['intersection'](_0xbd04f3[_0x6572('0x30')],qs[_0x6572('0x36')](_0x5015b0[_0x6572('0x31')][_0x6572('0x36')]));_0x3560cc['attributes']=_0x3560cc[_0x6572('0x35')][_0x6572('0x37')]?_0x3560cc[_0x6572('0x35')]:_0xbd04f3['model'];if(!_0x5015b0['query']['hasOwnProperty']('nolimit')){_0x3560cc[_0x6572('0x20')]=qs['limit'](_0x5015b0[_0x6572('0x31')][_0x6572('0x20')]);_0x3560cc[_0x6572('0x1e')]=qs[_0x6572('0x1e')](_0x5015b0[_0x6572('0x31')][_0x6572('0x1e')]);}_0x3560cc[_0x6572('0x38')]=qs[_0x6572('0x39')](_0x5015b0[_0x6572('0x31')][_0x6572('0x39')]);_0x3560cc[_0x6572('0x3a')]=qs[_0x6572('0x33')](_[_0x6572('0x3b')](_0x5015b0['query'],_0xbd04f3[_0x6572('0x33')]),_0x20acf0);if(_0x5015b0[_0x6572('0x31')][_0x6572('0x3c')]){_0x3560cc['where']=_['merge'](_0x3560cc['where'],{'$or':_[_0x6572('0x2a')](_0x20acf0,function(_0x272178){if(_0x272178[_0x6572('0x2e')]!==_0x6572('0x3d')){var _0x33b123={};_0x33b123[_0x272178[_0x6572('0x29')]]={'$like':'%'+_0x5015b0[_0x6572('0x31')][_0x6572('0x3c')]+'%'};return _0x33b123;}})});}_0x3560cc=_[_0x6572('0x3e')]({},_0x3560cc,_0x5015b0[_0x6572('0x3f')]);var _0x58105b={'where':_0x3560cc[_0x6572('0x3a')]};return db[_0x6572('0x2b')][_0x6572('0x40')](_0x58105b)[_0x6572('0x26')](function(_0x249eb0){_0x159a28[_0x6572('0x40')]=_0x249eb0;if(_0x5015b0[_0x6572('0x31')][_0x6572('0x41')]){_0x3560cc[_0x6572('0x42')]=[{'all':!![]}];}return db[_0x6572('0x2b')][_0x6572('0x43')](_0x3560cc);})[_0x6572('0x26')](function(_0x258d9a){_0x159a28['rows']=_0x258d9a;return _0x159a28;})[_0x6572('0x26')](respondWithFilteredResult(_0x14c6d2,_0x3560cc))['catch'](handleError(_0x14c6d2,null));};exports['show']=function(_0x356450,_0x3dbad8){var _0x2e49c5={'raw':![],'where':{'id':_0x356450[_0x6572('0x44')]['id']}},_0x544c7d={};_0x544c7d['model']=_[_0x6572('0x32')](db['VoiceQueueReport']['rawAttributes']);_0x544c7d[_0x6572('0x31')]=_[_0x6572('0x32')](_0x356450[_0x6572('0x31')]);_0x544c7d[_0x6572('0x33')]=_[_0x6572('0x34')](_0x544c7d[_0x6572('0x30')],_0x544c7d[_0x6572('0x31')]);_0x2e49c5[_0x6572('0x35')]=_[_0x6572('0x34')](_0x544c7d[_0x6572('0x30')],qs[_0x6572('0x36')](_0x356450[_0x6572('0x31')][_0x6572('0x36')]));_0x2e49c5[_0x6572('0x35')]=_0x2e49c5[_0x6572('0x35')][_0x6572('0x37')]?_0x2e49c5['attributes']:_0x544c7d[_0x6572('0x30')];if(_0x356450[_0x6572('0x31')][_0x6572('0x41')]){_0x2e49c5[_0x6572('0x42')]=[{'all':!![]}];}_0x2e49c5=_[_0x6572('0x3e')]({},_0x2e49c5,_0x356450[_0x6572('0x3f')]);return db[_0x6572('0x2b')][_0x6572('0x45')](_0x2e49c5)['then'](handleEntityNotFound(_0x3dbad8,null))['then'](respondWithResult(_0x3dbad8,null))[_0x6572('0x46')](handleError(_0x3dbad8,null));};exports[_0x6572('0x47')]=function(_0x103e83,_0xadbac0){return db[_0x6572('0x2b')][_0x6572('0x47')](_0x103e83['body'],{})[_0x6572('0x26')](respondWithResult(_0xadbac0,0xc9))[_0x6572('0x46')](handleError(_0xadbac0,null));};exports['update']=function(_0x127c8e,_0x48c5df){if(_0x127c8e[_0x6572('0x48')]['id']){delete _0x127c8e[_0x6572('0x48')]['id'];}return db[_0x6572('0x2b')][_0x6572('0x45')]({'where':{'id':_0x127c8e['params']['id']}})[_0x6572('0x26')](handleEntityNotFound(_0x48c5df,null))[_0x6572('0x26')](saveUpdates(_0x127c8e[_0x6572('0x48')],null))[_0x6572('0x26')](respondWithResult(_0x48c5df,null))['catch'](handleError(_0x48c5df,null));};exports[_0x6572('0x27')]=function(_0x33c13d,_0xf313de){return db[_0x6572('0x2b')][_0x6572('0x45')]({'where':{'id':_0x33c13d['params']['id']}})[_0x6572('0x26')](handleEntityNotFound(_0xf313de,null))[_0x6572('0x26')](removeEntity(_0xf313de,null))[_0x6572('0x46')](handleError(_0xf313de,null));};exports[_0x6572('0x49')]=function(_0x56b6d8,_0x1947df){return db[_0x6572('0x2b')][_0x6572('0x49')]()[_0x6572('0x26')](respondWithResult(_0x1947df,null))[_0x6572('0x46')](handleError(_0x1947df,null));};exports['getVoiceQueuesReport']=function(_0x34e26c,_0x4a90db){var _0x515439={},_0x3f7f61={},_0x5663d1={'count':0x0,'rows':[]};_0x3f7f61[_0x6572('0x30')]=_[_0x6572('0x32')](db[_0x6572('0x2b')][_0x6572('0x2c')]);_0x3f7f61['query']=_['keys'](_0x34e26c[_0x6572('0x31')]);_0x3f7f61[_0x6572('0x33')]=_[_0x6572('0x34')](_0x3f7f61[_0x6572('0x30')],_0x3f7f61[_0x6572('0x31')]);_0x515439[_0x6572('0x35')]=_['intersection'](_0x3f7f61[_0x6572('0x30')],qs['fields'](_0x34e26c[_0x6572('0x31')][_0x6572('0x36')]));_0x515439[_0x6572('0x35')]=_0x515439['attributes'][_0x6572('0x37')]?_0x515439[_0x6572('0x35')]:_0x3f7f61[_0x6572('0x30')];if(!_0x34e26c['query'][_0x6572('0x4a')]('nolimit')){_0x515439[_0x6572('0x20')]=qs[_0x6572('0x20')](_0x34e26c[_0x6572('0x31')]['limit']);_0x515439[_0x6572('0x1e')]=qs[_0x6572('0x1e')](_0x34e26c[_0x6572('0x31')][_0x6572('0x1e')]);}_0x515439[_0x6572('0x38')]=qs['sort'](_0x34e26c[_0x6572('0x31')][_0x6572('0x39')]);_0x515439['where']=qs['filters'](_['pick'](_0x34e26c[_0x6572('0x31')],_0x3f7f61[_0x6572('0x33')]));if(_0x34e26c[_0x6572('0x31')][_0x6572('0x3c')]){_0x515439[_0x6572('0x3a')]=_[_0x6572('0x3e')](_0x515439['where'],{'$or':_['map'](_0x515439[_0x6572('0x35')],function(_0x4fadd5){var _0x2495d5={};_0x2495d5[_0x4fadd5]={'$like':'%'+_0x34e26c[_0x6572('0x31')][_0x6572('0x3c')]+'%'};return _0x2495d5;})});}_0x515439=_[_0x6572('0x3e')]({},_0x515439,_0x34e26c[_0x6572('0x3f')]);var _0x46cfed={'where':_0x515439['where']};return db[_0x6572('0x2b')]['count'](_0x46cfed)[_0x6572('0x26')](function(_0x304b5a){_0x5663d1[_0x6572('0x40')]=_0x304b5a;if(_0x34e26c[_0x6572('0x31')]['includeAll']){_0x515439['include']=[{'all':!![]}];}return db[_0x6572('0x2b')][_0x6572('0x43')](_0x515439);})[_0x6572('0x26')](function(_0x249a6c){_0x5663d1[_0x6572('0x4b')]=_0x249a6c;return _0x5663d1;})[_0x6572('0x26')](respondWithFilteredResult(_0x4a90db,_0x515439,'getVoiceQueuesReport'))[_0x6572('0x46')](handleError(_0x4a90db,null,_0x6572('0x4c')));}; \ No newline at end of file +var _0x2b26=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','index','map','VoiceQueueReport','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','length','find','create','body','catch','params','describe','nolimit','getVoiceQueuesReport','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x1034ca,_0x14ecd6){var _0x1a023a=function(_0x2cfa65){while(--_0x2cfa65){_0x1034ca['push'](_0x1034ca['shift']());}};_0x1a023a(++_0x14ecd6);}(_0x2b26,0xe7));var _0x62b2=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x2b26[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x62b2('0x0'));var zipdir=require(_0x62b2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x62b2('0x2'));var moment=require('moment');var BPromise=require(_0x62b2('0x3'));var Mustache=require(_0x62b2('0x4'));var util=require(_0x62b2('0x5'));var path=require(_0x62b2('0x6'));var sox=require('sox');var csv=require(_0x62b2('0x7'));var ejs=require(_0x62b2('0x8'));var fs=require('fs');var fs_extra=require(_0x62b2('0x9'));var _=require('lodash');var squel=require(_0x62b2('0xa'));var crypto=require(_0x62b2('0xb'));var jsforce=require(_0x62b2('0xc'));var deskjs=require(_0x62b2('0xd'));var toCsv=require('to-csv');var querystring=require(_0x62b2('0xe'));var Papa=require(_0x62b2('0xf'));var Redis=require(_0x62b2('0x10'));var authService=require(_0x62b2('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x62b2('0x12'));var hardwareService=require(_0x62b2('0x13'));var logger=require('../../config/logger')(_0x62b2('0x14'));var utils=require(_0x62b2('0x15'));var config=require(_0x62b2('0x16'));var licenseUtil=require(_0x62b2('0x17'));var db=require(_0x62b2('0x18'))['db'];config[_0x62b2('0x19')]=_[_0x62b2('0x1a')](config[_0x62b2('0x19')],{'host':_0x62b2('0x1b'),'port':0x18eb});var socket=require(_0x62b2('0x1c'))(new Redis(config[_0x62b2('0x19')]));require(_0x62b2('0x1d'))['register'](socket);function respondWithStatusCode(_0xffc1a3,_0x29c2a0){_0x29c2a0=_0x29c2a0||0xcc;return function(_0x23f65b){if(_0x23f65b){return _0xffc1a3[_0x62b2('0x1e')](_0x29c2a0);}return _0xffc1a3[_0x62b2('0x1f')](_0x29c2a0)['end']();};}function respondWithResult(_0x18bf04,_0x14c465){_0x14c465=_0x14c465||0xc8;return function(_0x2d2185){if(_0x2d2185){return _0x18bf04['status'](_0x14c465)['json'](_0x2d2185);}};}function respondWithFilteredResult(_0x1b8db8,_0x42c097){return function(_0x327543){if(_0x327543){var _0x168737=typeof _0x42c097[_0x62b2('0x20')]===_0x62b2('0x21')&&typeof _0x42c097[_0x62b2('0x22')]===_0x62b2('0x21');var _0x578056=_0x327543[_0x62b2('0x23')];var _0x8599fd=_0x168737?0x0:_0x42c097[_0x62b2('0x20')];var _0x24f38a=_0x168737?_0x327543[_0x62b2('0x23')]:_0x42c097['offset']+_0x42c097[_0x62b2('0x22')];var _0x55ddd3;if(_0x24f38a>=_0x578056){_0x24f38a=_0x578056;_0x55ddd3=0xc8;}else{_0x55ddd3=0xce;}_0x1b8db8['status'](_0x55ddd3);return _0x1b8db8[_0x62b2('0x24')](_0x62b2('0x25'),_0x8599fd+'-'+_0x24f38a+'/'+_0x578056)['json'](_0x327543);}return null;};}function patchUpdates(_0x48a6bd){return function(_0x48314b){try{jsonpatch[_0x62b2('0x26')](_0x48314b,_0x48a6bd,!![]);}catch(_0x123bc1){return BPromise['reject'](_0x123bc1);}return _0x48314b[_0x62b2('0x27')]();};}function saveUpdates(_0x3571eb,_0x5cfcf2){return function(_0x1a4a4d){if(_0x1a4a4d){return _0x1a4a4d[_0x62b2('0x28')](_0x3571eb)[_0x62b2('0x29')](function(_0x51827c){return _0x51827c;});}return null;};}function removeEntity(_0x5a0805,_0x490384){return function(_0x5e6aac){if(_0x5e6aac){return _0x5e6aac[_0x62b2('0x2a')]()[_0x62b2('0x29')](function(){_0x5a0805[_0x62b2('0x1f')](0xcc)[_0x62b2('0x2b')]();});}};}function handleEntityNotFound(_0x62a8be,_0x4f4f68){return function(_0x1a9e8b){if(!_0x1a9e8b){_0x62a8be[_0x62b2('0x1e')](0x194);}return _0x1a9e8b;};}function handleError(_0x5159ef,_0x538670){_0x538670=_0x538670||0x1f4;return function(_0x527eb4){logger[_0x62b2('0x2c')](_0x527eb4[_0x62b2('0x2d')]);if(_0x527eb4[_0x62b2('0x2e')]){delete _0x527eb4[_0x62b2('0x2e')];}_0x5159ef[_0x62b2('0x1f')](_0x538670)[_0x62b2('0x2f')](_0x527eb4);};}exports[_0x62b2('0x30')]=function(_0x40bd1a,_0x7457ac){var _0x349231={},_0x2bb883={},_0x18235f={'count':0x0,'rows':[]};var _0x5bc904=_[_0x62b2('0x31')](db[_0x62b2('0x32')][_0x62b2('0x33')],function(_0x6c6f9a){return{'name':_0x6c6f9a['fieldName'],'type':_0x6c6f9a['type'][_0x62b2('0x34')]};});_0x2bb883[_0x62b2('0x35')]=_['map'](_0x5bc904,_0x62b2('0x2e'));_0x2bb883[_0x62b2('0x36')]=_[_0x62b2('0x37')](_0x40bd1a['query']);_0x2bb883[_0x62b2('0x38')]=_[_0x62b2('0x39')](_0x2bb883['model'],_0x2bb883[_0x62b2('0x36')]);_0x349231[_0x62b2('0x3a')]=_['intersection'](_0x2bb883[_0x62b2('0x35')],qs['fields'](_0x40bd1a[_0x62b2('0x36')][_0x62b2('0x3b')]));_0x349231['attributes']=_0x349231[_0x62b2('0x3a')]['length']?_0x349231[_0x62b2('0x3a')]:_0x2bb883[_0x62b2('0x35')];if(!_0x40bd1a[_0x62b2('0x36')][_0x62b2('0x3c')]('nolimit')){_0x349231[_0x62b2('0x22')]=qs[_0x62b2('0x22')](_0x40bd1a[_0x62b2('0x36')][_0x62b2('0x22')]);_0x349231[_0x62b2('0x20')]=qs[_0x62b2('0x20')](_0x40bd1a[_0x62b2('0x36')]['offset']);}_0x349231[_0x62b2('0x3d')]=qs['sort'](_0x40bd1a[_0x62b2('0x36')][_0x62b2('0x3e')]);_0x349231[_0x62b2('0x3f')]=qs[_0x62b2('0x38')](_[_0x62b2('0x40')](_0x40bd1a[_0x62b2('0x36')],_0x2bb883['filters']),_0x5bc904);if(_0x40bd1a[_0x62b2('0x36')][_0x62b2('0x41')]){_0x349231[_0x62b2('0x3f')]=_[_0x62b2('0x42')](_0x349231['where'],{'$or':_[_0x62b2('0x31')](_0x5bc904,function(_0x3b2c74){if(_0x3b2c74[_0x62b2('0x43')]!==_0x62b2('0x44')){var _0xca2fed={};_0xca2fed[_0x3b2c74[_0x62b2('0x2e')]]={'$like':'%'+_0x40bd1a['query'][_0x62b2('0x41')]+'%'};return _0xca2fed;}})});}_0x349231=_[_0x62b2('0x42')]({},_0x349231,_0x40bd1a[_0x62b2('0x45')]);var _0x239a4f={'where':_0x349231['where']};return db['VoiceQueueReport'][_0x62b2('0x23')](_0x239a4f)['then'](function(_0x448205){_0x18235f[_0x62b2('0x23')]=_0x448205;if(_0x40bd1a[_0x62b2('0x36')][_0x62b2('0x46')]){_0x349231[_0x62b2('0x47')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x62b2('0x48')](_0x349231);})['then'](function(_0x3a64b5){_0x18235f[_0x62b2('0x49')]=_0x3a64b5;return _0x18235f;})['then'](respondWithFilteredResult(_0x7457ac,_0x349231))['catch'](handleError(_0x7457ac,null));};exports[_0x62b2('0x4a')]=function(_0x45e6b6,_0xa63c19){var _0x128695={'raw':![],'where':{'id':_0x45e6b6['params']['id']}},_0x1dc784={};_0x1dc784[_0x62b2('0x35')]=_[_0x62b2('0x37')](db[_0x62b2('0x32')][_0x62b2('0x33')]);_0x1dc784['query']=_[_0x62b2('0x37')](_0x45e6b6[_0x62b2('0x36')]);_0x1dc784['filters']=_[_0x62b2('0x39')](_0x1dc784[_0x62b2('0x35')],_0x1dc784['query']);_0x128695['attributes']=_['intersection'](_0x1dc784[_0x62b2('0x35')],qs[_0x62b2('0x3b')](_0x45e6b6[_0x62b2('0x36')]['fields']));_0x128695[_0x62b2('0x3a')]=_0x128695[_0x62b2('0x3a')][_0x62b2('0x4b')]?_0x128695[_0x62b2('0x3a')]:_0x1dc784[_0x62b2('0x35')];if(_0x45e6b6[_0x62b2('0x36')]['includeAll']){_0x128695[_0x62b2('0x47')]=[{'all':!![]}];}_0x128695=_['merge']({},_0x128695,_0x45e6b6[_0x62b2('0x45')]);return db[_0x62b2('0x32')][_0x62b2('0x4c')](_0x128695)[_0x62b2('0x29')](handleEntityNotFound(_0xa63c19,null))['then'](respondWithResult(_0xa63c19,null))['catch'](handleError(_0xa63c19,null));};exports['create']=function(_0x45944b,_0x539e17){return db['VoiceQueueReport'][_0x62b2('0x4d')](_0x45944b[_0x62b2('0x4e')],{})[_0x62b2('0x29')](respondWithResult(_0x539e17,0xc9))[_0x62b2('0x4f')](handleError(_0x539e17,null));};exports[_0x62b2('0x28')]=function(_0x1184a3,_0x26cdc9){if(_0x1184a3[_0x62b2('0x4e')]['id']){delete _0x1184a3[_0x62b2('0x4e')]['id'];}return db[_0x62b2('0x32')][_0x62b2('0x4c')]({'where':{'id':_0x1184a3[_0x62b2('0x50')]['id']}})['then'](handleEntityNotFound(_0x26cdc9,null))['then'](saveUpdates(_0x1184a3[_0x62b2('0x4e')],null))['then'](respondWithResult(_0x26cdc9,null))[_0x62b2('0x4f')](handleError(_0x26cdc9,null));};exports[_0x62b2('0x2a')]=function(_0x4830bf,_0x4a598a){return db[_0x62b2('0x32')]['find']({'where':{'id':_0x4830bf[_0x62b2('0x50')]['id']}})[_0x62b2('0x29')](handleEntityNotFound(_0x4a598a,null))[_0x62b2('0x29')](removeEntity(_0x4a598a,null))[_0x62b2('0x4f')](handleError(_0x4a598a,null));};exports[_0x62b2('0x51')]=function(_0x2f5c33,_0x13e920){return db[_0x62b2('0x32')][_0x62b2('0x51')]()['then'](respondWithResult(_0x13e920,null))[_0x62b2('0x4f')](handleError(_0x13e920,null));};exports['getVoiceQueuesReport']=function(_0x5df978,_0x269b8e){var _0xeac341={},_0x26534b={},_0x2cb310={'count':0x0,'rows':[]};_0x26534b[_0x62b2('0x35')]=_[_0x62b2('0x37')](db['VoiceQueueReport'][_0x62b2('0x33')]);_0x26534b['query']=_['keys'](_0x5df978[_0x62b2('0x36')]);_0x26534b[_0x62b2('0x38')]=_[_0x62b2('0x39')](_0x26534b[_0x62b2('0x35')],_0x26534b['query']);_0xeac341[_0x62b2('0x3a')]=_['intersection'](_0x26534b[_0x62b2('0x35')],qs[_0x62b2('0x3b')](_0x5df978['query'][_0x62b2('0x3b')]));_0xeac341[_0x62b2('0x3a')]=_0xeac341[_0x62b2('0x3a')][_0x62b2('0x4b')]?_0xeac341[_0x62b2('0x3a')]:_0x26534b[_0x62b2('0x35')];if(!_0x5df978[_0x62b2('0x36')][_0x62b2('0x3c')](_0x62b2('0x52'))){_0xeac341[_0x62b2('0x22')]=qs[_0x62b2('0x22')](_0x5df978['query'][_0x62b2('0x22')]);_0xeac341['offset']=qs['offset'](_0x5df978[_0x62b2('0x36')][_0x62b2('0x20')]);}_0xeac341[_0x62b2('0x3d')]=qs[_0x62b2('0x3e')](_0x5df978[_0x62b2('0x36')][_0x62b2('0x3e')]);_0xeac341[_0x62b2('0x3f')]=qs[_0x62b2('0x38')](_[_0x62b2('0x40')](_0x5df978[_0x62b2('0x36')],_0x26534b[_0x62b2('0x38')]));if(_0x5df978[_0x62b2('0x36')]['filter']){_0xeac341[_0x62b2('0x3f')]=_['merge'](_0xeac341[_0x62b2('0x3f')],{'$or':_[_0x62b2('0x31')](_0xeac341['attributes'],function(_0x4a62bf){var _0x5b8ce4={};_0x5b8ce4[_0x4a62bf]={'$like':'%'+_0x5df978['query'][_0x62b2('0x41')]+'%'};return _0x5b8ce4;})});}_0xeac341=_[_0x62b2('0x42')]({},_0xeac341,_0x5df978['options']);var _0x4d78af={'where':_0xeac341[_0x62b2('0x3f')]};return db[_0x62b2('0x32')][_0x62b2('0x23')](_0x4d78af)['then'](function(_0x3c7a67){_0x2cb310[_0x62b2('0x23')]=_0x3c7a67;if(_0x5df978[_0x62b2('0x36')][_0x62b2('0x46')]){_0xeac341[_0x62b2('0x47')]=[{'all':!![]}];}return db[_0x62b2('0x32')][_0x62b2('0x48')](_0xeac341);})['then'](function(_0x3f95f3){_0x2cb310[_0x62b2('0x49')]=_0x3f95f3;return _0x2cb310;})[_0x62b2('0x29')](respondWithFilteredResult(_0x269b8e,_0xeac341,'getVoiceQueuesReport'))[_0x62b2('0x4f')](handleError(_0x269b8e,null,_0x62b2('0x53')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 6fa8999..2e76109 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 _0x4ca5=['emit','hasOwnProperty','events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','remove'];(function(_0x24dd08,_0x10ea7f){var _0x524acd=function(_0x4d8695){while(--_0x4d8695){_0x24dd08['push'](_0x24dd08['shift']());}};_0x524acd(++_0x10ea7f);}(_0x4ca5,0x17c));var _0x54ca=function(_0x4dad97,_0xfdc395){_0x4dad97=_0x4dad97-0x0;var _0x4fcc4e=_0x4ca5[_0x4dad97];return _0x4fcc4e;};'use strict';var EventEmitter=require(_0x54ca('0x0'));var VoiceQueueReport=require(_0x54ca('0x1'))['db'][_0x54ca('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x54ca('0x3')](0x0);var events={'afterCreate':_0x54ca('0x4'),'afterUpdate':_0x54ca('0x5'),'afterDestroy':_0x54ca('0x6')};function emitEvent(_0x36981c){return function(_0x3fcd9f,_0x15f501,_0x5dfcc8){VoiceQueueReportEvents[_0x54ca('0x7')](_0x36981c+':'+_0x3fcd9f['id'],_0x3fcd9f);VoiceQueueReportEvents[_0x54ca('0x7')](_0x36981c,_0x3fcd9f);_0x5dfcc8(null);};}for(var e in events){if(events[_0x54ca('0x8')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0xd81f=['update','remove','emit','hasOwnProperty','hook','exports','save'];(function(_0x5a19fc,_0x58f9f4){var _0x34b413=function(_0x344feb){while(--_0x344feb){_0x5a19fc['push'](_0x5a19fc['shift']());}};_0x34b413(++_0x58f9f4);}(_0xd81f,0x1c6));var _0xfd81=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0xd81f[_0x38ced4];return _0x547c07;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require('../../mysqldb')['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfd81('0x0'),'afterUpdate':_0xfd81('0x1'),'afterDestroy':_0xfd81('0x2')};function emitEvent(_0x435680){return function(_0x1028fe,_0x1df328,_0x1f135c){VoiceQueueReportEvents[_0xfd81('0x3')](_0x435680+':'+_0x1028fe['id'],_0x1028fe);VoiceQueueReportEvents[_0xfd81('0x3')](_0x435680,_0x1028fe);_0x1f135c(null);};}for(var e in events){if(events[_0xfd81('0x4')](e)){var event=events[e];VoiceQueueReport[_0xfd81('0x5')](e,emitEvent(event));}}module[_0xfd81('0x6')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 04635b2..6b2e812 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 _0x70a6=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum'];(function(_0x5b1aed,_0x322c17){var _0x26add8=function(_0x58a9d7){while(--_0x58a9d7){_0x5b1aed['push'](_0x5b1aed['shift']());}};_0x26add8(++_0x322c17);}(_0x70a6,0x1e0));var _0x670a=function(_0x7a1679,_0x312789){_0x7a1679=_0x7a1679-0x0;var _0x55db19=_0x70a6[_0x7a1679];return _0x55db19;};'use strict';var _=require(_0x670a('0x0'));var util=require(_0x670a('0x1'));var logger=require(_0x670a('0x2'))(_0x670a('0x3'));var moment=require(_0x670a('0x4'));var BPromise=require('bluebird');var rp=require(_0x670a('0x5'));var fs=require('fs');var path=require(_0x670a('0x6'));var rimraf=require(_0x670a('0x7'));var config=require(_0x670a('0x8'));var attributes=require(_0x670a('0x9'));module[_0x670a('0xa')]=function(_0x2dd6bb,_0x5abfc0){return _0x2dd6bb[_0x670a('0xb')](_0x670a('0xc'),attributes,{'tableName':_0x670a('0xd'),'paranoid':![],'indexes':[{'fields':[_0x670a('0xe')]},{'fields':[_0x670a('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf5a3=['request-promise','path','exports','define','VoiceQueueReport','report_queue','calleridnum','lodash','util','api','bluebird'];(function(_0x1dc30f,_0x3066b9){var _0xe41a0f=function(_0x3ecf5e){while(--_0x3ecf5e){_0x1dc30f['push'](_0x1dc30f['shift']());}};_0xe41a0f(++_0x3066b9);}(_0xf5a3,0x193));var _0x3f5a=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xf5a3[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0x3f5a('0x0'));var util=require(_0x3f5a('0x1'));var logger=require('../../config/logger')(_0x3f5a('0x2'));var moment=require('moment');var BPromise=require(_0x3f5a('0x3'));var rp=require(_0x3f5a('0x4'));var fs=require('fs');var path=require(_0x3f5a('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceQueueReport.attributes');module[_0x3f5a('0x6')]=function(_0xbe0541,_0x3ef929){return _0xbe0541[_0x3f5a('0x7')](_0x3f5a('0x8'),attributes,{'tableName':_0x3f5a('0x9'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0x3f5a('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index e6e96fe..adc53a4 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 _0x8bb9=['localhost','socket.io-emitter','register','request','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','include','map','model','attributes','debug','CreateVoiceQueueReport','create','then','catch','UpdateVoiceQueueReport','update','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis'];(function(_0x143cc6,_0xf94536){var _0x2cedba=function(_0x15a2ad){while(--_0x15a2ad){_0x143cc6['push'](_0x143cc6['shift']());}};_0x2cedba(++_0xf94536);}(_0x8bb9,0x197));var _0x98bb=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0x8bb9[_0x40bffc];return _0x3007e9;};'use strict';var _=require(_0x98bb('0x0'));var util=require(_0x98bb('0x1'));var moment=require(_0x98bb('0x2'));var BPromise=require(_0x98bb('0x3'));var rs=require(_0x98bb('0x4'));var fs=require('fs');var Redis=require(_0x98bb('0x5'));var db=require(_0x98bb('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x98bb('0x7'))(_0x98bb('0x8'));var config=require(_0x98bb('0x9'));var jayson=require(_0x98bb('0xa'));var client=jayson[_0x98bb('0xb')]['http']({'port':0x232a});config[_0x98bb('0xc')]=_['defaults'](config[_0x98bb('0xc')],{'host':_0x98bb('0xd'),'port':0x18eb});var socket=require(_0x98bb('0xe'))(new Redis(config[_0x98bb('0xc')]));require('./voiceQueueReport.socket')[_0x98bb('0xf')](socket);function respondWithRpcPromise(_0x605fb3,_0x478bc5,_0x161223){return new BPromise(function(_0x15e2ff,_0x45844a){return client[_0x98bb('0x10')](_0x605fb3,_0x161223)['then'](function(_0x169d08){logger[_0x98bb('0x11')](_0x98bb('0x12'),_0x478bc5,'request\x20sent');logger['debug']('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x478bc5,_0x98bb('0x13'),JSON[_0x98bb('0x14')](_0x169d08));if(_0x169d08[_0x98bb('0x15')]){if(_0x169d08[_0x98bb('0x15')]['code']===0x1f4){logger[_0x98bb('0x15')](_0x98bb('0x12'),_0x478bc5,_0x169d08['error'][_0x98bb('0x16')]);return _0x45844a(_0x169d08[_0x98bb('0x15')]['message']);}logger[_0x98bb('0x15')](_0x98bb('0x12'),_0x478bc5,_0x169d08['error'][_0x98bb('0x16')]);return _0x15e2ff(_0x169d08[_0x98bb('0x15')][_0x98bb('0x16')]);}else{logger['info'](_0x98bb('0x12'),_0x478bc5,_0x98bb('0x13'));_0x15e2ff(_0x169d08[_0x98bb('0x17')][_0x98bb('0x16')]);}})['catch'](function(_0x3a577a){logger[_0x98bb('0x15')](_0x98bb('0x12'),_0x478bc5,_0x3a577a);_0x45844a(_0x3a577a);});});}exports[_0x98bb('0x18')]=function(_0x19e415){var _0x248b88=this;return new Promise(function(_0x352992,_0x5cda6d){return db[_0x98bb('0x19')][_0x98bb('0x1a')]({'raw':_0x19e415['options']?_0x19e415[_0x98bb('0x1b')][_0x98bb('0x1c')]===undefined?!![]:![]:!![],'where':_0x19e415[_0x98bb('0x1b')]?_0x19e415[_0x98bb('0x1b')][_0x98bb('0x1d')]||null:null,'attributes':_0x19e415['options']?_0x19e415[_0x98bb('0x1b')]['attributes']||null:null,'limit':_0x19e415['options']?_0x19e415[_0x98bb('0x1b')]['limit']||null:null,'include':_0x19e415['options']?_0x19e415[_0x98bb('0x1b')][_0x98bb('0x1e')]?_[_0x98bb('0x1f')](_0x19e415[_0x98bb('0x1b')][_0x98bb('0x1e')],function(_0x4088b6){return{'model':db[_0x4088b6[_0x98bb('0x20')]],'as':_0x4088b6['as'],'attributes':_0x4088b6[_0x98bb('0x21')],'include':_0x4088b6['include']?_[_0x98bb('0x1f')](_0x4088b6['include'],function(_0x1e5fee){return{'model':db[_0x1e5fee[_0x98bb('0x20')]],'as':_0x1e5fee['as'],'attributes':_0x1e5fee[_0x98bb('0x21')],'include':_0x1e5fee[_0x98bb('0x1e')]?_['map'](_0x1e5fee[_0x98bb('0x1e')],function(_0x18a31f){return{'model':db[_0x18a31f['model']],'as':_0x18a31f['as'],'attributes':_0x18a31f[_0x98bb('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5c2e09){logger['info'](_0x98bb('0x18'),_0x19e415);logger[_0x98bb('0x22')](_0x98bb('0x18'),_0x19e415,JSON['stringify'](_0x5c2e09));_0x352992(_0x5c2e09);})['catch'](function(_0x2be444){logger[_0x98bb('0x15')](_0x98bb('0x18'),_0x2be444[_0x98bb('0x16')],_0x19e415);_0x5cda6d(_0x248b88[_0x98bb('0x15')](0x1f4,_0x2be444[_0x98bb('0x16')]));});});};exports[_0x98bb('0x23')]=function(_0x41efb7){var _0x3e765f=this;return new Promise(function(_0x22181b,_0x164512){return db[_0x98bb('0x19')][_0x98bb('0x24')](_0x41efb7['body'],{'raw':_0x41efb7['options']?_0x41efb7['options'][_0x98bb('0x1c')]===undefined?!![]:![]:!![]})[_0x98bb('0x25')](function(_0x401236){logger['info'](_0x98bb('0x23'),_0x41efb7);logger[_0x98bb('0x22')]('CreateVoiceQueueReport',_0x41efb7,JSON[_0x98bb('0x14')](_0x401236));_0x22181b(_0x401236);})[_0x98bb('0x26')](function(_0x43b8ab){logger['error'](_0x98bb('0x23'),_0x43b8ab[_0x98bb('0x16')],_0x41efb7);_0x164512(_0x3e765f[_0x98bb('0x15')](0x1f4,_0x43b8ab[_0x98bb('0x16')]));});});};exports[_0x98bb('0x27')]=function(_0x531ddc){var _0x4f41dc=this;return new Promise(function(_0x147118,_0x5dac86){return db[_0x98bb('0x19')][_0x98bb('0x28')](_0x531ddc['body'],{'raw':_0x531ddc[_0x98bb('0x1b')]?_0x531ddc['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x531ddc['options']?_0x531ddc['options'][_0x98bb('0x1d')]||null:null,'attributes':_0x531ddc[_0x98bb('0x1b')]?_0x531ddc[_0x98bb('0x1b')][_0x98bb('0x21')]||null:null,'limit':_0x531ddc[_0x98bb('0x1b')]?_0x531ddc[_0x98bb('0x1b')][_0x98bb('0x29')]||null:null})[_0x98bb('0x25')](function(_0x5ab15c){logger[_0x98bb('0x11')]('UpdateVoiceQueueReport',_0x531ddc);logger[_0x98bb('0x22')](_0x98bb('0x27'),_0x531ddc,JSON[_0x98bb('0x14')](_0x5ab15c));_0x147118(_0x5ab15c);})[_0x98bb('0x26')](function(_0x2c76fa){logger[_0x98bb('0x15')](_0x98bb('0x27'),_0x2c76fa[_0x98bb('0x16')],_0x531ddc);_0x5dac86(_0x4f41dc[_0x98bb('0x15')](0x1f4,_0x2c76fa['message']));});});}; \ No newline at end of file +var _0x4238=['map','model','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','redis','defaults','localhost','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','attributes','limit','include'];(function(_0x113290,_0x6eb947){var _0x3d7730=function(_0x46d6cb){while(--_0x46d6cb){_0x113290['push'](_0x113290['shift']());}};_0x3d7730(++_0x6eb947);}(_0x4238,0x182));var _0x8423=function(_0x3598bb,_0x24befa){_0x3598bb=_0x3598bb-0x0;var _0x13c837=_0x4238[_0x3598bb];return _0x13c837;};'use strict';var _=require(_0x8423('0x0'));var util=require(_0x8423('0x1'));var moment=require(_0x8423('0x2'));var BPromise=require(_0x8423('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8423('0x4'));var db=require(_0x8423('0x5'))['db'];var utils=require(_0x8423('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x8423('0x7'));var jayson=require(_0x8423('0x8'));var client=jayson['client'][_0x8423('0x9')]({'port':0x232a});config[_0x8423('0xa')]=_[_0x8423('0xb')](config[_0x8423('0xa')],{'host':_0x8423('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8423('0xa')]));require(_0x8423('0xd'))[_0x8423('0xe')](socket);function respondWithRpcPromise(_0x3f8342,_0x2c9e30,_0x11e73f){return new BPromise(function(_0x141ba0,_0x54bf55){return client[_0x8423('0xf')](_0x3f8342,_0x11e73f)[_0x8423('0x10')](function(_0x327eb8){logger[_0x8423('0x11')](_0x8423('0x12'),_0x2c9e30,'request\x20sent');logger[_0x8423('0x13')](_0x8423('0x14'),_0x2c9e30,_0x8423('0x15'),JSON[_0x8423('0x16')](_0x327eb8));if(_0x327eb8['error']){if(_0x327eb8[_0x8423('0x17')]['code']===0x1f4){logger[_0x8423('0x17')](_0x8423('0x12'),_0x2c9e30,_0x327eb8[_0x8423('0x17')][_0x8423('0x18')]);return _0x54bf55(_0x327eb8[_0x8423('0x17')][_0x8423('0x18')]);}logger[_0x8423('0x17')](_0x8423('0x12'),_0x2c9e30,_0x327eb8[_0x8423('0x17')][_0x8423('0x18')]);return _0x141ba0(_0x327eb8[_0x8423('0x17')]['message']);}else{logger[_0x8423('0x11')](_0x8423('0x12'),_0x2c9e30,'request\x20sent');_0x141ba0(_0x327eb8[_0x8423('0x19')][_0x8423('0x18')]);}})[_0x8423('0x1a')](function(_0x5cb1de){logger[_0x8423('0x17')](_0x8423('0x12'),_0x2c9e30,_0x5cb1de);_0x54bf55(_0x5cb1de);});});}exports[_0x8423('0x1b')]=function(_0x4972f7){var _0x16e97c=this;return new Promise(function(_0x18c455,_0x22d652){return db[_0x8423('0x1c')][_0x8423('0x1d')]({'raw':_0x4972f7['options']?_0x4972f7['options']['raw']===undefined?!![]:![]:!![],'where':_0x4972f7['options']?_0x4972f7['options']['where']||null:null,'attributes':_0x4972f7[_0x8423('0x1e')]?_0x4972f7[_0x8423('0x1e')][_0x8423('0x1f')]||null:null,'limit':_0x4972f7['options']?_0x4972f7[_0x8423('0x1e')][_0x8423('0x20')]||null:null,'include':_0x4972f7['options']?_0x4972f7['options'][_0x8423('0x21')]?_[_0x8423('0x22')](_0x4972f7[_0x8423('0x1e')]['include'],function(_0x1a8545){return{'model':db[_0x1a8545['model']],'as':_0x1a8545['as'],'attributes':_0x1a8545[_0x8423('0x1f')],'include':_0x1a8545['include']?_[_0x8423('0x22')](_0x1a8545[_0x8423('0x21')],function(_0x3dcfc0){return{'model':db[_0x3dcfc0[_0x8423('0x23')]],'as':_0x3dcfc0['as'],'attributes':_0x3dcfc0[_0x8423('0x1f')],'include':_0x3dcfc0[_0x8423('0x21')]?_[_0x8423('0x22')](_0x3dcfc0['include'],function(_0x137a03){return{'model':db[_0x137a03[_0x8423('0x23')]],'as':_0x137a03['as'],'attributes':_0x137a03[_0x8423('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x8423('0x10')](function(_0x187ff3){logger['info']('GetVoiceQueueReport',_0x4972f7);logger[_0x8423('0x13')]('GetVoiceQueueReport',_0x4972f7,JSON[_0x8423('0x16')](_0x187ff3));_0x18c455(_0x187ff3);})['catch'](function(_0xda4802){logger[_0x8423('0x17')]('GetVoiceQueueReport',_0xda4802[_0x8423('0x18')],_0x4972f7);_0x22d652(_0x16e97c[_0x8423('0x17')](0x1f4,_0xda4802[_0x8423('0x18')]));});});};exports[_0x8423('0x24')]=function(_0x5a8579){var _0xf65ea=this;return new Promise(function(_0x4ea681,_0x1339dd){return db['VoiceQueueReport'][_0x8423('0x25')](_0x5a8579[_0x8423('0x26')],{'raw':_0x5a8579[_0x8423('0x1e')]?_0x5a8579['options']['raw']===undefined?!![]:![]:!![]})[_0x8423('0x10')](function(_0x1af3b1){logger[_0x8423('0x11')](_0x8423('0x24'),_0x5a8579);logger['debug'](_0x8423('0x24'),_0x5a8579,JSON[_0x8423('0x16')](_0x1af3b1));_0x4ea681(_0x1af3b1);})[_0x8423('0x1a')](function(_0x5c437f){logger[_0x8423('0x17')](_0x8423('0x24'),_0x5c437f[_0x8423('0x18')],_0x5a8579);_0x1339dd(_0xf65ea[_0x8423('0x17')](0x1f4,_0x5c437f['message']));});});};exports[_0x8423('0x27')]=function(_0x24ef1d){var _0x345baf=this;return new Promise(function(_0x3ebdf1,_0x220c71){return db['VoiceQueueReport'][_0x8423('0x28')](_0x24ef1d[_0x8423('0x26')],{'raw':_0x24ef1d['options']?_0x24ef1d[_0x8423('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24ef1d['options']?_0x24ef1d[_0x8423('0x1e')][_0x8423('0x29')]||null:null,'attributes':_0x24ef1d['options']?_0x24ef1d[_0x8423('0x1e')][_0x8423('0x1f')]||null:null,'limit':_0x24ef1d['options']?_0x24ef1d[_0x8423('0x1e')][_0x8423('0x20')]||null:null})[_0x8423('0x10')](function(_0x29984d){logger[_0x8423('0x11')]('UpdateVoiceQueueReport',_0x24ef1d);logger[_0x8423('0x13')]('UpdateVoiceQueueReport',_0x24ef1d,JSON['stringify'](_0x29984d));_0x3ebdf1(_0x29984d);})[_0x8423('0x1a')](function(_0x889ad0){logger[_0x8423('0x17')]('UpdateVoiceQueueReport',_0x889ad0[_0x8423('0x18')],_0x24ef1d);_0x220c71(_0x345baf[_0x8423('0x17')](0x1f4,_0x889ad0[_0x8423('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index b7b7cd4..2a3e981 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 _0x8f23=['update','removeListener','register','length','voiceQueueReport:','./voiceQueueReport.events','save','remove'];(function(_0x2ec4ce,_0x55db74){var _0x51b836=function(_0x5a2c4b){while(--_0x5a2c4b){_0x2ec4ce['push'](_0x2ec4ce['shift']());}};_0x51b836(++_0x55db74);}(_0x8f23,0x1e5));var _0x38f2=function(_0x2d37de,_0x258cc2){_0x2d37de=_0x2d37de-0x0;var _0x16f029=_0x8f23[_0x2d37de];return _0x16f029;};'use strict';var VoiceQueueReportEvents=require(_0x38f2('0x0'));var events=[_0x38f2('0x1'),_0x38f2('0x2'),_0x38f2('0x3')];function createListener(_0x724038,_0x7f4a7b){return function(_0x5c312c){_0x7f4a7b['emit'](_0x724038,_0x5c312c);};}function removeListener(_0x31dbb0,_0x38155a){return function(){VoiceQueueReportEvents[_0x38f2('0x4')](_0x31dbb0,_0x38155a);};}exports[_0x38f2('0x5')]=function(_0x1997ec){for(var _0x3590e8=0x0,_0x374473=events[_0x38f2('0x6')];_0x3590e8<_0x374473;_0x3590e8++){var _0x4e27a2=events[_0x3590e8];var _0x19f604=createListener(_0x38f2('0x7')+_0x4e27a2,_0x1997ec);VoiceQueueReportEvents['on'](_0x4e27a2,_0x19f604);}}; \ No newline at end of file +var _0x8403=['remove','update','emit','removeListener','register','length','voiceQueueReport:','./voiceQueueReport.events','save'];(function(_0x70e09e,_0x332f30){var _0x47dc95=function(_0x4a869f){while(--_0x4a869f){_0x70e09e['push'](_0x70e09e['shift']());}};_0x47dc95(++_0x332f30);}(_0x8403,0x1a5));var _0x3840=function(_0x5e8379,_0x483d66){_0x5e8379=_0x5e8379-0x0;var _0x5c0d6e=_0x8403[_0x5e8379];return _0x5c0d6e;};'use strict';var VoiceQueueReportEvents=require(_0x3840('0x0'));var events=[_0x3840('0x1'),_0x3840('0x2'),_0x3840('0x3')];function createListener(_0x28b106,_0x43a9f0){return function(_0x502e0d){_0x43a9f0[_0x3840('0x4')](_0x28b106,_0x502e0d);};}function removeListener(_0x12aa6f,_0x579d29){return function(){VoiceQueueReportEvents[_0x3840('0x5')](_0x12aa6f,_0x579d29);};}exports[_0x3840('0x6')]=function(_0x1cd658){for(var _0x233be3=0x0,_0x1fcfd8=events[_0x3840('0x7')];_0x233be3<_0x1fcfd8;_0x233be3++){var _0x59923c=events[_0x233be3];var _0x5aa2c4=createListener(_0x3840('0x8')+_0x59923c,_0x1cd658);VoiceQueueReportEvents['on'](_0x59923c,_0x5aa2c4);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 4dc2fb8..3283227 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 _0xb4f2=['show','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','isAuthenticated','get','/:id'];(function(_0x576a60,_0x279f28){var _0x54c179=function(_0x527e46){while(--_0x527e46){_0x576a60['push'](_0x576a60['shift']());}};_0x54c179(++_0x279f28);}(_0xb4f2,0x1eb));var _0x2b4f=function(_0x2e1195,_0xf331e9){_0x2e1195=_0x2e1195-0x0;var _0x2ea2eb=_0xb4f2[_0x2e1195];return _0x2ea2eb;};'use strict';var multer=require(_0x2b4f('0x0'));var util=require(_0x2b4f('0x1'));var path=require(_0x2b4f('0x2'));var timeout=require(_0x2b4f('0x3'));var express=require(_0x2b4f('0x4'));var router=express['Router']();var fs_extra=require(_0x2b4f('0x5'));var auth=require(_0x2b4f('0x6'));var interaction=require(_0x2b4f('0x7'));var config=require(_0x2b4f('0x8'));var controller=require(_0x2b4f('0x9'));router['get']('/',auth[_0x2b4f('0xa')](),controller['index']);router[_0x2b4f('0xb')](_0x2b4f('0xc'),auth[_0x2b4f('0xa')](),controller[_0x2b4f('0xd')]);router['post']('/',auth[_0x2b4f('0xa')](),controller['create']);router[_0x2b4f('0xe')](_0x2b4f('0xc'),auth[_0x2b4f('0xa')](),controller[_0x2b4f('0xf')]);router['delete'](_0x2b4f('0xc'),auth['isAuthenticated'](),controller[_0x2b4f('0x10')]);module[_0x2b4f('0x11')]=router; \ No newline at end of file +var _0x0d0b=['destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','/:id','show','post','put','delete'];(function(_0x3c504b,_0x437693){var _0x2e5354=function(_0x456709){while(--_0x456709){_0x3c504b['push'](_0x3c504b['shift']());}};_0x2e5354(++_0x437693);}(_0x0d0b,0x1ef));var _0xb0d0=function(_0x17fec8,_0x76aa0b){_0x17fec8=_0x17fec8-0x0;var _0x30d9a0=_0x0d0b[_0x17fec8];return _0x30d9a0;};'use strict';var multer=require('multer');var util=require(_0xb0d0('0x0'));var path=require('path');var timeout=require(_0xb0d0('0x1'));var express=require('express');var router=express[_0xb0d0('0x2')]();var fs_extra=require(_0xb0d0('0x3'));var auth=require(_0xb0d0('0x4'));var interaction=require(_0xb0d0('0x5'));var config=require(_0xb0d0('0x6'));var controller=require(_0xb0d0('0x7'));router[_0xb0d0('0x8')]('/',auth[_0xb0d0('0x9')](),controller['index']);router[_0xb0d0('0x8')](_0xb0d0('0xa'),auth[_0xb0d0('0x9')](),controller[_0xb0d0('0xb')]);router[_0xb0d0('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb0d0('0xd')](_0xb0d0('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xb0d0('0xe')](_0xb0d0('0xa'),auth[_0xb0d0('0x9')](),controller[_0xb0d0('0xf')]);module[_0xb0d0('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index eebb8d5..8bf97f1 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 _0xe108=['STRING','DATE','format','moment'];(function(_0x4bfb8b,_0x3fbf99){var _0x45bbed=function(_0xce1b1f){while(--_0xce1b1f){_0x4bfb8b['push'](_0x4bfb8b['shift']());}};_0x45bbed(++_0x3fbf99);}(_0xe108,0x6b));var _0x8e10=function(_0x2b3bb9,_0x1556ce){_0x2b3bb9=_0x2b3bb9-0x0;var _0x5d3da5=_0xe108[_0x2b3bb9];return _0x5d3da5;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x8e10('0x0'));module['exports']={'time':{'type':Sequelize[_0x8e10('0x1')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x8e10('0x1')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x8e10('0x1')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x8e10('0x1')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x8e10('0x1')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x8e10('0x1')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x8e10('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x8e10('0x1')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x8e10('0x2')],'allowNull':![],'defaultValue':moment()[_0x8e10('0x3')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file +var _0xe740=['YYYY-MM-DD\x20HH:mm:ss','sequelize','exports','STRING','DATE','format'];(function(_0xf67aef,_0x19aa34){var _0x1518b7=function(_0x4c5ae2){while(--_0x4c5ae2){_0xf67aef['push'](_0xf67aef['shift']());}};_0x1518b7(++_0x19aa34);}(_0xe740,0x14b));var _0x0e74=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xe740[_0x5f3f88];return _0xd08119;};'use strict';var Sequelize=require(_0x0e74('0x0'));var moment=require('moment');module[_0x0e74('0x1')]={'time':{'type':Sequelize[_0x0e74('0x2')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x0e74('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x0e74('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x0e74('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x0e74('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x0e74('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x0e74('0x3')],'allowNull':![],'defaultValue':moment()[_0x0e74('0x4')](_0x0e74('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index eecdd5c..d2f0d35 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 _0x9400=['to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','Content-Range','apply','reject','save','then','sendStatus','error','name','send','map','VoiceQueuesLog','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','limit','sort','where','merge','type','filter','options','include','findAll','catch','params','keys','length','includeAll','create','body','update','find','destroy','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','fs-extra','lodash','desk.js'];(function(_0x263e02,_0x104322){var _0x4545c4=function(_0x32d613){while(--_0x32d613){_0x263e02['push'](_0x263e02['shift']());}};_0x4545c4(++_0x104322);}(_0x9400,0x144));var _0x0940=function(_0x406664,_0x5ce15c){_0x406664=_0x406664-0x0;var _0x5a5e=_0x9400[_0x406664];return _0x5a5e;};'use strict';var emlformat=require(_0x0940('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0940('0x1'));var jsonpatch=require(_0x0940('0x2'));var rp=require('request-promise');var moment=require(_0x0940('0x3'));var BPromise=require(_0x0940('0x4'));var Mustache=require(_0x0940('0x5'));var util=require('util');var path=require(_0x0940('0x6'));var sox=require(_0x0940('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0940('0x8'));var _=require(_0x0940('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0940('0xa'));var toCsv=require(_0x0940('0xb'));var querystring=require(_0x0940('0xc'));var Papa=require(_0x0940('0xd'));var Redis=require(_0x0940('0xe'));var authService=require(_0x0940('0xf'));var qs=require(_0x0940('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0940('0x11'))('api');var utils=require(_0x0940('0x12'));var config=require(_0x0940('0x13'));var licenseUtil=require(_0x0940('0x14'));var db=require(_0x0940('0x15'))['db'];function respondWithStatusCode(_0x11c661,_0x29c5e5){_0x29c5e5=_0x29c5e5||0xcc;return function(_0x4a49b8){if(_0x4a49b8){return _0x11c661['sendStatus'](_0x29c5e5);}return _0x11c661['status'](_0x29c5e5)[_0x0940('0x16')]();};}function respondWithResult(_0x40b59b,_0x474c5f){_0x474c5f=_0x474c5f||0xc8;return function(_0x1081a8){if(_0x1081a8){return _0x40b59b[_0x0940('0x17')](_0x474c5f)[_0x0940('0x18')](_0x1081a8);}};}function respondWithFilteredResult(_0x58d540,_0x3ccc56){return function(_0x304147){if(_0x304147){var _0x50b8df=typeof _0x3ccc56[_0x0940('0x19')]===_0x0940('0x1a')&&typeof _0x3ccc56['limit']==='undefined';var _0x3e8ec4=_0x304147[_0x0940('0x1b')];var _0x19e48e=_0x50b8df?0x0:_0x3ccc56[_0x0940('0x19')];var _0x59b9a6=_0x50b8df?_0x304147[_0x0940('0x1b')]:_0x3ccc56[_0x0940('0x19')]+_0x3ccc56['limit'];var _0x5e2c84;if(_0x59b9a6>=_0x3e8ec4){_0x59b9a6=_0x3e8ec4;_0x5e2c84=0xc8;}else{_0x5e2c84=0xce;}_0x58d540[_0x0940('0x17')](_0x5e2c84);return _0x58d540['set'](_0x0940('0x1c'),_0x19e48e+'-'+_0x59b9a6+'/'+_0x3e8ec4)[_0x0940('0x18')](_0x304147);}return null;};}function patchUpdates(_0xfde4b9){return function(_0x33494f){try{jsonpatch[_0x0940('0x1d')](_0x33494f,_0xfde4b9,!![]);}catch(_0x4103fc){return BPromise[_0x0940('0x1e')](_0x4103fc);}return _0x33494f[_0x0940('0x1f')]();};}function saveUpdates(_0x29da36,_0x328796){return function(_0xfba1b6){if(_0xfba1b6){return _0xfba1b6['update'](_0x29da36)[_0x0940('0x20')](function(_0x66fbb0){return _0x66fbb0;});}return null;};}function removeEntity(_0x303acc,_0x31c010){return function(_0x53095d){if(_0x53095d){return _0x53095d['destroy']()[_0x0940('0x20')](function(){_0x303acc[_0x0940('0x17')](0xcc)[_0x0940('0x16')]();});}};}function handleEntityNotFound(_0x50be7b,_0x1af21d){return function(_0x6a5c1c){if(!_0x6a5c1c){_0x50be7b[_0x0940('0x21')](0x194);}return _0x6a5c1c;};}function handleError(_0x31224a,_0x46100d){_0x46100d=_0x46100d||0x1f4;return function(_0x331f9c){logger[_0x0940('0x22')](_0x331f9c['stack']);if(_0x331f9c[_0x0940('0x23')]){delete _0x331f9c['name'];}_0x31224a['status'](_0x46100d)[_0x0940('0x24')](_0x331f9c);};}exports['index']=function(_0x56fbf3,_0x3c0fd8){var _0x2df091={},_0x3ec4ea={},_0xa30373={'count':0x0,'rows':[]};var _0x1ca09f=_[_0x0940('0x25')](db[_0x0940('0x26')][_0x0940('0x27')],function(_0x1c614a){return{'name':_0x1c614a[_0x0940('0x28')],'type':_0x1c614a['type'][_0x0940('0x29')]};});_0x3ec4ea['model']=_[_0x0940('0x25')](_0x1ca09f,_0x0940('0x23'));_0x3ec4ea[_0x0940('0x2a')]=_['keys'](_0x56fbf3[_0x0940('0x2a')]);_0x3ec4ea[_0x0940('0x2b')]=_[_0x0940('0x2c')](_0x3ec4ea[_0x0940('0x2d')],_0x3ec4ea[_0x0940('0x2a')]);_0x2df091[_0x0940('0x2e')]=_[_0x0940('0x2c')](_0x3ec4ea[_0x0940('0x2d')],qs[_0x0940('0x2f')](_0x56fbf3[_0x0940('0x2a')][_0x0940('0x2f')]));_0x2df091[_0x0940('0x2e')]=_0x2df091[_0x0940('0x2e')]['length']?_0x2df091['attributes']:_0x3ec4ea['model'];if(!_0x56fbf3[_0x0940('0x2a')]['hasOwnProperty']('nolimit')){_0x2df091[_0x0940('0x30')]=qs[_0x0940('0x30')](_0x56fbf3[_0x0940('0x2a')]['limit']);_0x2df091[_0x0940('0x19')]=qs[_0x0940('0x19')](_0x56fbf3['query'][_0x0940('0x19')]);}_0x2df091['order']=qs[_0x0940('0x31')](_0x56fbf3[_0x0940('0x2a')][_0x0940('0x31')]);_0x2df091[_0x0940('0x32')]=qs[_0x0940('0x2b')](_['pick'](_0x56fbf3[_0x0940('0x2a')],_0x3ec4ea['filters']),_0x1ca09f);if(_0x56fbf3[_0x0940('0x2a')]['filter']){_0x2df091[_0x0940('0x32')]=_[_0x0940('0x33')](_0x2df091['where'],{'$or':_['map'](_0x1ca09f,function(_0x537d0d){if(_0x537d0d[_0x0940('0x34')]!=='VIRTUAL'){var _0x51f5c8={};_0x51f5c8[_0x537d0d[_0x0940('0x23')]]={'$like':'%'+_0x56fbf3[_0x0940('0x2a')][_0x0940('0x35')]+'%'};return _0x51f5c8;}})});}_0x2df091=_[_0x0940('0x33')]({},_0x2df091,_0x56fbf3[_0x0940('0x36')]);var _0x47be0e={'where':_0x2df091[_0x0940('0x32')]};return db[_0x0940('0x26')][_0x0940('0x1b')](_0x47be0e)[_0x0940('0x20')](function(_0x3e50d7){_0xa30373[_0x0940('0x1b')]=_0x3e50d7;if(_0x56fbf3['query']['includeAll']){_0x2df091[_0x0940('0x37')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x0940('0x38')](_0x2df091);})[_0x0940('0x20')](function(_0xfdf4f9){_0xa30373['rows']=_0xfdf4f9;return _0xa30373;})[_0x0940('0x20')](respondWithFilteredResult(_0x3c0fd8,_0x2df091))[_0x0940('0x39')](handleError(_0x3c0fd8,null));};exports['show']=function(_0x324f89,_0x5d0c52){var _0xcb4a93={'raw':!![],'where':{'id':_0x324f89[_0x0940('0x3a')]['id']}},_0x560e65={};_0x560e65['model']=_[_0x0940('0x3b')](db[_0x0940('0x26')][_0x0940('0x27')]);_0x560e65['query']=_['keys'](_0x324f89['query']);_0x560e65['filters']=_[_0x0940('0x2c')](_0x560e65[_0x0940('0x2d')],_0x560e65['query']);_0xcb4a93[_0x0940('0x2e')]=_[_0x0940('0x2c')](_0x560e65[_0x0940('0x2d')],qs['fields'](_0x324f89[_0x0940('0x2a')][_0x0940('0x2f')]));_0xcb4a93[_0x0940('0x2e')]=_0xcb4a93[_0x0940('0x2e')][_0x0940('0x3c')]?_0xcb4a93[_0x0940('0x2e')]:_0x560e65['model'];if(_0x324f89[_0x0940('0x2a')][_0x0940('0x3d')]){_0xcb4a93[_0x0940('0x37')]=[{'all':!![]}];}_0xcb4a93=_[_0x0940('0x33')]({},_0xcb4a93,_0x324f89[_0x0940('0x36')]);return db['VoiceQueuesLog']['find'](_0xcb4a93)['then'](handleEntityNotFound(_0x5d0c52,null))[_0x0940('0x20')](respondWithResult(_0x5d0c52,null))[_0x0940('0x39')](handleError(_0x5d0c52,null));};exports[_0x0940('0x3e')]=function(_0x40e28b,_0x4f30d2){return db[_0x0940('0x26')][_0x0940('0x3e')](_0x40e28b[_0x0940('0x3f')],{})[_0x0940('0x20')](respondWithResult(_0x4f30d2,0xc9))[_0x0940('0x39')](handleError(_0x4f30d2,null));};exports[_0x0940('0x40')]=function(_0x5d87fe,_0x5e582e){if(_0x5d87fe['body']['id']){delete _0x5d87fe['body']['id'];}return db[_0x0940('0x26')][_0x0940('0x41')]({'where':{'id':_0x5d87fe[_0x0940('0x3a')]['id']}})[_0x0940('0x20')](handleEntityNotFound(_0x5e582e,null))['then'](saveUpdates(_0x5d87fe['body'],null))[_0x0940('0x20')](respondWithResult(_0x5e582e,null))[_0x0940('0x39')](handleError(_0x5e582e,null));};exports[_0x0940('0x42')]=function(_0x28ae7a,_0x53ca56){return db[_0x0940('0x26')][_0x0940('0x41')]({'where':{'id':_0x28ae7a[_0x0940('0x3a')]['id']}})[_0x0940('0x20')](handleEntityNotFound(_0x53ca56,null))[_0x0940('0x20')](removeEntity(_0x53ca56,null))[_0x0940('0x39')](handleError(_0x53ca56,null));}; \ No newline at end of file +var _0x3f3f=['body','update','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','apply','reject','then','destroy','stack','name','send','map','VoiceQueuesLog','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','length','find','create'];(function(_0xb7215a,_0x1f31b1){var _0x54d2af=function(_0x2ed4a5){while(--_0x2ed4a5){_0xb7215a['push'](_0xb7215a['shift']());}};_0x54d2af(++_0x1f31b1);}(_0x3f3f,0x11e));var _0xf3f3=function(_0x132399,_0x1c4b0f){_0x132399=_0x132399-0x0;var _0x2a27e9=_0x3f3f[_0x132399];return _0x2a27e9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf3f3('0x0'));var jsonpatch=require(_0xf3f3('0x1'));var rp=require(_0xf3f3('0x2'));var moment=require(_0xf3f3('0x3'));var BPromise=require(_0xf3f3('0x4'));var Mustache=require(_0xf3f3('0x5'));var util=require(_0xf3f3('0x6'));var path=require(_0xf3f3('0x7'));var sox=require(_0xf3f3('0x8'));var csv=require('to-csv');var ejs=require(_0xf3f3('0x9'));var fs=require('fs');var fs_extra=require(_0xf3f3('0xa'));var _=require(_0xf3f3('0xb'));var squel=require(_0xf3f3('0xc'));var crypto=require(_0xf3f3('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf3f3('0xe'));var querystring=require('querystring');var Papa=require(_0xf3f3('0xf'));var Redis=require('ioredis');var authService=require(_0xf3f3('0x10'));var qs=require(_0xf3f3('0x11'));var as=require(_0xf3f3('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf3f3('0x13'))(_0xf3f3('0x14'));var utils=require(_0xf3f3('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf3f3('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x183b92,_0x2b2cff){_0x2b2cff=_0x2b2cff||0xcc;return function(_0x37f8c2){if(_0x37f8c2){return _0x183b92[_0xf3f3('0x17')](_0x2b2cff);}return _0x183b92[_0xf3f3('0x18')](_0x2b2cff)[_0xf3f3('0x19')]();};}function respondWithResult(_0x58f780,_0x1b2f01){_0x1b2f01=_0x1b2f01||0xc8;return function(_0x454068){if(_0x454068){return _0x58f780[_0xf3f3('0x18')](_0x1b2f01)[_0xf3f3('0x1a')](_0x454068);}};}function respondWithFilteredResult(_0x5f07ac,_0x581be9){return function(_0x189b47){if(_0x189b47){var _0x18d4e4=typeof _0x581be9[_0xf3f3('0x1b')]===_0xf3f3('0x1c')&&typeof _0x581be9['limit']==='undefined';var _0x327db4=_0x189b47[_0xf3f3('0x1d')];var _0x3d4904=_0x18d4e4?0x0:_0x581be9[_0xf3f3('0x1b')];var _0xee9401=_0x18d4e4?_0x189b47[_0xf3f3('0x1d')]:_0x581be9[_0xf3f3('0x1b')]+_0x581be9[_0xf3f3('0x1e')];var _0x2f677a;if(_0xee9401>=_0x327db4){_0xee9401=_0x327db4;_0x2f677a=0xc8;}else{_0x2f677a=0xce;}_0x5f07ac[_0xf3f3('0x18')](_0x2f677a);return _0x5f07ac['set']('Content-Range',_0x3d4904+'-'+_0xee9401+'/'+_0x327db4)[_0xf3f3('0x1a')](_0x189b47);}return null;};}function patchUpdates(_0x33451d){return function(_0x199d6f){try{jsonpatch[_0xf3f3('0x1f')](_0x199d6f,_0x33451d,!![]);}catch(_0x541533){return BPromise[_0xf3f3('0x20')](_0x541533);}return _0x199d6f['save']();};}function saveUpdates(_0x1e2186,_0x59e767){return function(_0x245eed){if(_0x245eed){return _0x245eed['update'](_0x1e2186)[_0xf3f3('0x21')](function(_0x1e8296){return _0x1e8296;});}return null;};}function removeEntity(_0x158c5c,_0x389dd6){return function(_0x623628){if(_0x623628){return _0x623628[_0xf3f3('0x22')]()[_0xf3f3('0x21')](function(){_0x158c5c['status'](0xcc)[_0xf3f3('0x19')]();});}};}function handleEntityNotFound(_0x4adf9,_0x16c7f7){return function(_0x120f4d){if(!_0x120f4d){_0x4adf9[_0xf3f3('0x17')](0x194);}return _0x120f4d;};}function handleError(_0x34f3cd,_0x443b0b){_0x443b0b=_0x443b0b||0x1f4;return function(_0x4247a7){logger['error'](_0x4247a7[_0xf3f3('0x23')]);if(_0x4247a7[_0xf3f3('0x24')]){delete _0x4247a7[_0xf3f3('0x24')];}_0x34f3cd['status'](_0x443b0b)[_0xf3f3('0x25')](_0x4247a7);};}exports['index']=function(_0x454036,_0x16cf39){var _0xefedd7={},_0xcac22f={},_0x1f3c2c={'count':0x0,'rows':[]};var _0x146bfd=_[_0xf3f3('0x26')](db[_0xf3f3('0x27')]['rawAttributes'],function(_0x36905f){return{'name':_0x36905f[_0xf3f3('0x28')],'type':_0x36905f[_0xf3f3('0x29')][_0xf3f3('0x2a')]};});_0xcac22f[_0xf3f3('0x2b')]=_[_0xf3f3('0x26')](_0x146bfd,'name');_0xcac22f[_0xf3f3('0x2c')]=_['keys'](_0x454036[_0xf3f3('0x2c')]);_0xcac22f[_0xf3f3('0x2d')]=_[_0xf3f3('0x2e')](_0xcac22f[_0xf3f3('0x2b')],_0xcac22f[_0xf3f3('0x2c')]);_0xefedd7[_0xf3f3('0x2f')]=_[_0xf3f3('0x2e')](_0xcac22f[_0xf3f3('0x2b')],qs[_0xf3f3('0x30')](_0x454036[_0xf3f3('0x2c')][_0xf3f3('0x30')]));_0xefedd7['attributes']=_0xefedd7[_0xf3f3('0x2f')]['length']?_0xefedd7['attributes']:_0xcac22f['model'];if(!_0x454036[_0xf3f3('0x2c')]['hasOwnProperty'](_0xf3f3('0x31'))){_0xefedd7['limit']=qs[_0xf3f3('0x1e')](_0x454036[_0xf3f3('0x2c')]['limit']);_0xefedd7[_0xf3f3('0x1b')]=qs[_0xf3f3('0x1b')](_0x454036['query'][_0xf3f3('0x1b')]);}_0xefedd7[_0xf3f3('0x32')]=qs[_0xf3f3('0x33')](_0x454036[_0xf3f3('0x2c')][_0xf3f3('0x33')]);_0xefedd7[_0xf3f3('0x34')]=qs[_0xf3f3('0x2d')](_['pick'](_0x454036[_0xf3f3('0x2c')],_0xcac22f[_0xf3f3('0x2d')]),_0x146bfd);if(_0x454036[_0xf3f3('0x2c')]['filter']){_0xefedd7[_0xf3f3('0x34')]=_['merge'](_0xefedd7['where'],{'$or':_[_0xf3f3('0x26')](_0x146bfd,function(_0x55bc73){if(_0x55bc73[_0xf3f3('0x29')]!==_0xf3f3('0x35')){var _0x38e5cf={};_0x38e5cf[_0x55bc73[_0xf3f3('0x24')]]={'$like':'%'+_0x454036[_0xf3f3('0x2c')][_0xf3f3('0x36')]+'%'};return _0x38e5cf;}})});}_0xefedd7=_[_0xf3f3('0x37')]({},_0xefedd7,_0x454036[_0xf3f3('0x38')]);var _0x3d4fd3={'where':_0xefedd7[_0xf3f3('0x34')]};return db[_0xf3f3('0x27')][_0xf3f3('0x1d')](_0x3d4fd3)[_0xf3f3('0x21')](function(_0x240f1b){_0x1f3c2c[_0xf3f3('0x1d')]=_0x240f1b;if(_0x454036[_0xf3f3('0x2c')][_0xf3f3('0x39')]){_0xefedd7[_0xf3f3('0x3a')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0xf3f3('0x3b')](_0xefedd7);})['then'](function(_0x4f24e7){_0x1f3c2c[_0xf3f3('0x3c')]=_0x4f24e7;return _0x1f3c2c;})['then'](respondWithFilteredResult(_0x16cf39,_0xefedd7))[_0xf3f3('0x3d')](handleError(_0x16cf39,null));};exports[_0xf3f3('0x3e')]=function(_0x51d0b2,_0x538f3b){var _0x2b238d={'raw':!![],'where':{'id':_0x51d0b2[_0xf3f3('0x3f')]['id']}},_0x5ea048={};_0x5ea048[_0xf3f3('0x2b')]=_[_0xf3f3('0x40')](db[_0xf3f3('0x27')][_0xf3f3('0x41')]);_0x5ea048[_0xf3f3('0x2c')]=_[_0xf3f3('0x40')](_0x51d0b2['query']);_0x5ea048[_0xf3f3('0x2d')]=_['intersection'](_0x5ea048[_0xf3f3('0x2b')],_0x5ea048['query']);_0x2b238d[_0xf3f3('0x2f')]=_[_0xf3f3('0x2e')](_0x5ea048[_0xf3f3('0x2b')],qs[_0xf3f3('0x30')](_0x51d0b2['query']['fields']));_0x2b238d['attributes']=_0x2b238d['attributes'][_0xf3f3('0x42')]?_0x2b238d['attributes']:_0x5ea048[_0xf3f3('0x2b')];if(_0x51d0b2[_0xf3f3('0x2c')]['includeAll']){_0x2b238d[_0xf3f3('0x3a')]=[{'all':!![]}];}_0x2b238d=_[_0xf3f3('0x37')]({},_0x2b238d,_0x51d0b2[_0xf3f3('0x38')]);return db[_0xf3f3('0x27')][_0xf3f3('0x43')](_0x2b238d)['then'](handleEntityNotFound(_0x538f3b,null))[_0xf3f3('0x21')](respondWithResult(_0x538f3b,null))[_0xf3f3('0x3d')](handleError(_0x538f3b,null));};exports[_0xf3f3('0x44')]=function(_0x22cb03,_0x4fce45){return db[_0xf3f3('0x27')][_0xf3f3('0x44')](_0x22cb03[_0xf3f3('0x45')],{})[_0xf3f3('0x21')](respondWithResult(_0x4fce45,0xc9))[_0xf3f3('0x3d')](handleError(_0x4fce45,null));};exports[_0xf3f3('0x46')]=function(_0x4907b4,_0x4287f5){if(_0x4907b4['body']['id']){delete _0x4907b4[_0xf3f3('0x45')]['id'];}return db[_0xf3f3('0x27')][_0xf3f3('0x43')]({'where':{'id':_0x4907b4[_0xf3f3('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4287f5,null))['then'](saveUpdates(_0x4907b4[_0xf3f3('0x45')],null))[_0xf3f3('0x21')](respondWithResult(_0x4287f5,null))[_0xf3f3('0x3d')](handleError(_0x4287f5,null));};exports[_0xf3f3('0x22')]=function(_0x28a244,_0x4432d8){return db['VoiceQueuesLog'][_0xf3f3('0x43')]({'where':{'id':_0x28a244[_0xf3f3('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4432d8,null))[_0xf3f3('0x21')](removeEntity(_0x4432d8,null))[_0xf3f3('0x3d')](handleError(_0x4432d8,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 9b3a698..0e08643 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 _0x91e3=['event','dtm','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueuesLog.attributes','define','VoiceQueuesLog','voice_queues_log','event_dtm'];(function(_0x41d024,_0x77db4b){var _0x35fbcf=function(_0x5f008b){while(--_0x5f008b){_0x41d024['push'](_0x41d024['shift']());}};_0x35fbcf(++_0x77db4b);}(_0x91e3,0x132));var _0x391e=function(_0x7fabe1,_0x5d2150){_0x7fabe1=_0x7fabe1-0x0;var _0x43669e=_0x91e3[_0x7fabe1];return _0x43669e;};'use strict';var _=require(_0x391e('0x0'));var util=require(_0x391e('0x1'));var logger=require(_0x391e('0x2'))(_0x391e('0x3'));var moment=require(_0x391e('0x4'));var BPromise=require(_0x391e('0x5'));var rp=require(_0x391e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x391e('0x7'));var config=require(_0x391e('0x8'));var attributes=require(_0x391e('0x9'));module['exports']=function(_0x3b7eb0,_0x26a494){return _0x3b7eb0[_0x391e('0xa')](_0x391e('0xb'),attributes,{'tableName':_0x391e('0xc'),'paranoid':![],'indexes':[{'name':_0x391e('0xd'),'fields':[_0x391e('0xe'),_0x391e('0xf')]}],'timestamps':![]});}; \ No newline at end of file +var _0x8cd6=['path','rimraf','exports','define','VoiceQueuesLog','event_dtm','dtm','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3db122,_0x5e6bee){var _0x325b67=function(_0x5095af){while(--_0x5095af){_0x3db122['push'](_0x3db122['shift']());}};_0x325b67(++_0x5e6bee);}(_0x8cd6,0xbd));var _0x68cd=function(_0x12f53d,_0x3b8f99){_0x12f53d=_0x12f53d-0x0;var _0x590201=_0x8cd6[_0x12f53d];return _0x590201;};'use strict';var _=require(_0x68cd('0x0'));var util=require('util');var logger=require(_0x68cd('0x1'))(_0x68cd('0x2'));var moment=require(_0x68cd('0x3'));var BPromise=require(_0x68cd('0x4'));var rp=require(_0x68cd('0x5'));var fs=require('fs');var path=require(_0x68cd('0x6'));var rimraf=require(_0x68cd('0x7'));var config=require('../../config/environment');var attributes=require('./voiceQueuesLog.attributes');module[_0x68cd('0x8')]=function(_0x2630c2,_0x1b424e){return _0x2630c2[_0x68cd('0x9')](_0x68cd('0xa'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x68cd('0xb'),'fields':['event',_0x68cd('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index bb39449..e753700 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 _0x8150=['error','code','message','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x8150,0x1a7));var _0x0815=function(_0x30bfbd,_0x3b7dd7){_0x30bfbd=_0x30bfbd-0x0;var _0x5d5e24=_0x8150[_0x30bfbd];return _0x5d5e24;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x0815('0x0'));var rs=require(_0x0815('0x1'));var fs=require('fs');var Redis=require(_0x0815('0x2'));var db=require(_0x0815('0x3'))['db'];var utils=require(_0x0815('0x4'));var logger=require('../../config/logger')(_0x0815('0x5'));var config=require('../../config/environment');var jayson=require(_0x0815('0x6'));var client=jayson[_0x0815('0x7')][_0x0815('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x47cf9c,_0x3c2014,_0x37c337){return new BPromise(function(_0xa3e790,_0x2fe044){return client[_0x0815('0x9')](_0x47cf9c,_0x37c337)[_0x0815('0xa')](function(_0x2b53a3){logger[_0x0815('0xb')](_0x0815('0xc'),_0x3c2014,_0x0815('0xd'));logger[_0x0815('0xe')](_0x0815('0xf'),_0x3c2014,'request\x20sent',JSON[_0x0815('0x10')](_0x2b53a3));if(_0x2b53a3[_0x0815('0x11')]){if(_0x2b53a3['error'][_0x0815('0x12')]===0x1f4){logger[_0x0815('0x11')](_0x0815('0xc'),_0x3c2014,_0x2b53a3['error'][_0x0815('0x13')]);return _0x2fe044(_0x2b53a3[_0x0815('0x11')][_0x0815('0x13')]);}logger[_0x0815('0x11')](_0x0815('0xc'),_0x3c2014,_0x2b53a3['error'][_0x0815('0x13')]);return _0xa3e790(_0x2b53a3[_0x0815('0x11')][_0x0815('0x13')]);}else{logger[_0x0815('0xb')](_0x0815('0xc'),_0x3c2014,_0x0815('0xd'));_0xa3e790(_0x2b53a3[_0x0815('0x14')][_0x0815('0x13')]);}})[_0x0815('0x15')](function(_0x1eb43d){logger[_0x0815('0x11')](_0x0815('0xc'),_0x3c2014,_0x1eb43d);_0x2fe044(_0x1eb43d);});});} \ No newline at end of file +var _0xe9da=['info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x15d8cf,_0x4d9d20){var _0x329722=function(_0x1b06c4){while(--_0x1b06c4){_0x15d8cf['push'](_0x15d8cf['shift']());}};_0x329722(++_0x4d9d20);}(_0xe9da,0x1dd));var _0xae9d=function(_0x17f062,_0x114e15){_0x17f062=_0x17f062-0x0;var _0x51b20c=_0xe9da[_0x17f062];return _0x51b20c;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xae9d('0x0'));var db=require(_0xae9d('0x1'))['db'];var utils=require(_0xae9d('0x2'));var logger=require('../../config/logger')(_0xae9d('0x3'));var config=require(_0xae9d('0x4'));var jayson=require(_0xae9d('0x5'));var client=jayson[_0xae9d('0x6')][_0xae9d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x35f87d,_0x1256ef,_0x2c270e){return new BPromise(function(_0x28fe51,_0x76b864){return client[_0xae9d('0x8')](_0x35f87d,_0x2c270e)['then'](function(_0x20c8e7){logger[_0xae9d('0x9')](_0xae9d('0xa'),_0x1256ef,_0xae9d('0xb'));logger['debug'](_0xae9d('0xc'),_0x1256ef,_0xae9d('0xb'),JSON[_0xae9d('0xd')](_0x20c8e7));if(_0x20c8e7['error']){if(_0x20c8e7[_0xae9d('0xe')]['code']===0x1f4){logger[_0xae9d('0xe')](_0xae9d('0xa'),_0x1256ef,_0x20c8e7[_0xae9d('0xe')][_0xae9d('0xf')]);return _0x76b864(_0x20c8e7[_0xae9d('0xe')][_0xae9d('0xf')]);}logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x1256ef,_0x20c8e7['error'][_0xae9d('0xf')]);return _0x28fe51(_0x20c8e7['error'][_0xae9d('0xf')]);}else{logger[_0xae9d('0x9')](_0xae9d('0xa'),_0x1256ef,'request\x20sent');_0x28fe51(_0x20c8e7[_0xae9d('0x10')][_0xae9d('0xf')]);}})[_0xae9d('0x11')](function(_0x7a5994){logger[_0xae9d('0xe')](_0xae9d('0xa'),_0x1256ef,_0x7a5994);_0x76b864(_0x7a5994);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 61e62f9..d4742d2 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 _0xba33=['/:id/transcribe','downloadTranscribe','post','create','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','/:id/download','download'];(function(_0x4417a6,_0x2e9b9b){var _0x49ccb1=function(_0x557e83){while(--_0x557e83){_0x4417a6['push'](_0x4417a6['shift']());}};_0x49ccb1(++_0x2e9b9b);}(_0xba33,0x170));var _0x3ba3=function(_0x36faa5,_0x226a15){_0x36faa5=_0x36faa5-0x0;var _0x54497d=_0xba33[_0x36faa5];return _0x54497d;};'use strict';var multer=require(_0x3ba3('0x0'));var util=require(_0x3ba3('0x1'));var path=require('path');var timeout=require(_0x3ba3('0x2'));var express=require(_0x3ba3('0x3'));var router=express[_0x3ba3('0x4')]();var fs_extra=require(_0x3ba3('0x5'));var auth=require(_0x3ba3('0x6'));var interaction=require(_0x3ba3('0x7'));var config=require(_0x3ba3('0x8'));var controller=require('./voiceRecording.controller');router[_0x3ba3('0x9')]('/',auth[_0x3ba3('0xa')](),controller[_0x3ba3('0xb')]);router[_0x3ba3('0x9')](_0x3ba3('0xc'),auth[_0x3ba3('0xa')](),controller['describe']);router[_0x3ba3('0x9')](_0x3ba3('0xd'),auth[_0x3ba3('0xa')](),controller['show']);router['get'](_0x3ba3('0xe'),auth['isAuthenticated'](),controller[_0x3ba3('0xf')]);router['get']('/:id/downloads',controller['downloads']);router[_0x3ba3('0x9')](_0x3ba3('0x10'),auth[_0x3ba3('0xa')](),controller[_0x3ba3('0x11')]);router[_0x3ba3('0x12')]('/',auth[_0x3ba3('0xa')](),controller[_0x3ba3('0x13')]);router[_0x3ba3('0x12')](_0x3ba3('0x10'),auth[_0x3ba3('0xa')](),controller['runTranscribe']);router[_0x3ba3('0x14')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x3ba3('0x15')]('/:id',auth[_0x3ba3('0xa')](),controller[_0x3ba3('0x16')]);module[_0x3ba3('0x17')]=router; \ No newline at end of file +var _0x95e0=['create','post','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe'];(function(_0x585dca,_0x400705){var _0x3016e1=function(_0x3df491){while(--_0x3df491){_0x585dca['push'](_0x585dca['shift']());}};_0x3016e1(++_0x400705);}(_0x95e0,0x18c));var _0x095e=function(_0x5188e0,_0x5e1b09){_0x5188e0=_0x5188e0-0x0;var _0xd70786=_0x95e0[_0x5188e0];return _0xd70786;};'use strict';var multer=require(_0x095e('0x0'));var util=require(_0x095e('0x1'));var path=require(_0x095e('0x2'));var timeout=require(_0x095e('0x3'));var express=require('express');var router=express[_0x095e('0x4')]();var fs_extra=require(_0x095e('0x5'));var auth=require(_0x095e('0x6'));var interaction=require(_0x095e('0x7'));var config=require(_0x095e('0x8'));var controller=require('./voiceRecording.controller');router[_0x095e('0x9')]('/',auth[_0x095e('0xa')](),controller[_0x095e('0xb')]);router[_0x095e('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x095e('0x9')](_0x095e('0xc'),auth[_0x095e('0xa')](),controller[_0x095e('0xd')]);router[_0x095e('0x9')](_0x095e('0xe'),auth['isAuthenticated'](),controller[_0x095e('0xf')]);router[_0x095e('0x9')](_0x095e('0x10'),controller[_0x095e('0x11')]);router[_0x095e('0x9')](_0x095e('0x12'),auth[_0x095e('0xa')](),controller[_0x095e('0x13')]);router['post']('/',auth[_0x095e('0xa')](),controller[_0x095e('0x14')]);router[_0x095e('0x15')](_0x095e('0x12'),auth[_0x095e('0xa')](),controller['runTranscribe']);router['put'](_0x095e('0xc'),auth['isAuthenticated'](),controller[_0x095e('0x16')]);router[_0x095e('0x17')]('/:id',auth[_0x095e('0xa')](),controller[_0x095e('0x18')]);module[_0x095e('0x19')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 814ebc3..cc7cc4d 100644 --- a/server/api/voiceRecording/voiceRecording.attributes.js +++ b/server/api/voiceRecording/voiceRecording.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file +var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 1d9f38d..09ecab8 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 _0x9497=['runTranscribe','Setting','transcribeAccountId','transcribeRegion','language','bucket','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','data1','data2','Buckets','Name','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','writeFile','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','count','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','VoiceRecording','type','key','model','format','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','rawAttributes','find','create','body','params','describe','../../components/encryptor','uniqueid','value','%s.cypher','decryptFile','recording','existsSync','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','download','extname','unlink','message','Not\x20found','sequelize','MD5','$and','push','secrets','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','unlinkSync','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','createBucket','upload','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','Location','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus'];(function(_0xd511d,_0x3546b9){var _0x3f148e=function(_0x51f35f){while(--_0x51f35f){_0xd511d['push'](_0xd511d['shift']());}};_0x3f148e(++_0x3546b9);}(_0x9497,0x1d4));var _0x7949=function(_0x58662e,_0x3749bf){_0x58662e=_0x58662e-0x0;var _0x36b91c=_0x9497[_0x58662e];return _0x36b91c;};'use strict';var emlformat=require(_0x7949('0x0'));var rimraf=require(_0x7949('0x1'));var zipdir=require(_0x7949('0x2'));var jsonpatch=require(_0x7949('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7949('0x4'));var Mustache=require(_0x7949('0x5'));var util=require(_0x7949('0x6'));var path=require(_0x7949('0x7'));var sox=require(_0x7949('0x8'));var csv=require(_0x7949('0x9'));var ejs=require(_0x7949('0xa'));var fs=require('fs');var fs_extra=require(_0x7949('0xb'));var _=require(_0x7949('0xc'));var squel=require(_0x7949('0xd'));var crypto=require('crypto');var jsforce=require(_0x7949('0xe'));var deskjs=require(_0x7949('0xf'));var toCsv=require(_0x7949('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var AWS=require(_0x7949('0x10'));var uuidv4=require(_0x7949('0x11'));var Redis=require(_0x7949('0x12'));var authService=require(_0x7949('0x13'));var qs=require(_0x7949('0x14'));var as=require(_0x7949('0x15'));var hardwareService=require(_0x7949('0x16'));var logger=require('../../config/logger')(_0x7949('0x17'));var utils=require('../../config/utils');var config=require(_0x7949('0x18'));var licenseUtil=require(_0x7949('0x19'));var db=require(_0x7949('0x1a'))['db'];function respondWithStatusCode(_0xfe90e7,_0xd9e76b){_0xd9e76b=_0xd9e76b||0xcc;return function(_0x36d73a){if(_0x36d73a){return _0xfe90e7[_0x7949('0x1b')](_0xd9e76b);}return _0xfe90e7['status'](_0xd9e76b)[_0x7949('0x1c')]();};}function respondWithResult(_0x4375df,_0x7c134){_0x7c134=_0x7c134||0xc8;return function(_0x2b8719){if(_0x2b8719){return _0x4375df[_0x7949('0x1d')](_0x7c134)[_0x7949('0x1e')](_0x2b8719);}};}function respondWithFilteredResult(_0x3f6088,_0x149c79){return function(_0x13217d){if(_0x13217d){var _0x383047=typeof _0x149c79[_0x7949('0x1f')]==='undefined'&&typeof _0x149c79['limit']==='undefined';var _0x5eda8d=_0x13217d[_0x7949('0x20')];var _0x1c8983=_0x383047?0x0:_0x149c79[_0x7949('0x1f')];var _0x371af3=_0x383047?_0x13217d[_0x7949('0x20')]:_0x149c79[_0x7949('0x1f')]+_0x149c79['limit'];var _0x39d92b;if(_0x371af3>=_0x5eda8d){_0x371af3=_0x5eda8d;_0x39d92b=0xc8;}else{_0x39d92b=0xce;}_0x3f6088[_0x7949('0x1d')](_0x39d92b);return _0x3f6088['set'](_0x7949('0x21'),_0x1c8983+'-'+_0x371af3+'/'+_0x5eda8d)[_0x7949('0x1e')](_0x13217d);}return null;};}function patchUpdates(_0x1188d2){return function(_0xe38f1a){try{jsonpatch[_0x7949('0x22')](_0xe38f1a,_0x1188d2,!![]);}catch(_0x20633b){return BPromise[_0x7949('0x23')](_0x20633b);}return _0xe38f1a[_0x7949('0x24')]();};}function saveUpdates(_0x48aad6,_0x34f6c4){return function(_0x112d24){if(_0x112d24){return _0x112d24[_0x7949('0x25')](_0x48aad6)[_0x7949('0x26')](function(_0x2ed75d){return _0x2ed75d;});}return null;};}function removeEntity(_0x30a254,_0x54a980){return function(_0x25e8a3){if(_0x25e8a3){return _0x25e8a3[_0x7949('0x27')]()[_0x7949('0x26')](function(){_0x30a254[_0x7949('0x1d')](0xcc)[_0x7949('0x1c')]();});}};}function handleEntityNotFound(_0x435e9f,_0x3aecc1){return function(_0x1c57ba){if(!_0x1c57ba){_0x435e9f[_0x7949('0x1b')](0x194);}return _0x1c57ba;};}function handleError(_0x36998a,_0x429d92){_0x429d92=_0x429d92||0x1f4;return function(_0x34697d){logger[_0x7949('0x28')](_0x34697d['stack']);if(_0x34697d[_0x7949('0x29')]){delete _0x34697d[_0x7949('0x29')];}_0x36998a[_0x7949('0x1d')](_0x429d92)[_0x7949('0x2a')](_0x34697d);};}exports[_0x7949('0x2b')]=function(_0x45ded2,_0xf117af){var _0x4dace1={},_0x5917ca={},_0x499954={'count':0x0,'rows':[]};var _0x174564=_[_0x7949('0x2c')](db[_0x7949('0x2d')]['rawAttributes'],function(_0x4d09fb){return{'name':_0x4d09fb['fieldName'],'type':_0x4d09fb[_0x7949('0x2e')][_0x7949('0x2f')]};});_0x5917ca[_0x7949('0x30')]=_['differenceBy'](_[_0x7949('0x2c')](_0x174564,'name'),[_0x7949('0x31')]);_0x5917ca[_0x7949('0x32')]=_[_0x7949('0x33')](_0x45ded2['query']);_0x5917ca[_0x7949('0x34')]=_['intersection'](_0x5917ca[_0x7949('0x30')],_0x5917ca[_0x7949('0x32')]);_0x4dace1['attributes']=_[_0x7949('0x35')](_0x5917ca[_0x7949('0x30')],qs[_0x7949('0x36')](_0x45ded2[_0x7949('0x32')][_0x7949('0x36')]));_0x4dace1[_0x7949('0x37')]=_0x4dace1['attributes'][_0x7949('0x38')]?_0x4dace1['attributes']:_0x5917ca['model'];if(!_0x45ded2[_0x7949('0x32')]['hasOwnProperty'](_0x7949('0x39'))){_0x4dace1[_0x7949('0x3a')]=qs[_0x7949('0x3a')](_0x45ded2[_0x7949('0x32')][_0x7949('0x3a')]);_0x4dace1[_0x7949('0x1f')]=qs['offset'](_0x45ded2[_0x7949('0x32')]['offset']);}_0x4dace1[_0x7949('0x3b')]=qs[_0x7949('0x3c')](_0x45ded2['query']['sort']);_0x4dace1[_0x7949('0x3d')]=qs['filters'](_['pick'](_0x45ded2[_0x7949('0x32')],_0x5917ca[_0x7949('0x34')]),_0x174564);if(_0x45ded2[_0x7949('0x32')][_0x7949('0x3e')]){_0x4dace1[_0x7949('0x3d')]=_[_0x7949('0x3f')](_0x4dace1['where'],{'$or':_[_0x7949('0x2c')](_0x174564,function(_0x925cc8){if(_0x925cc8['type']!==_0x7949('0x40')){var _0x1d6227={};_0x1d6227[_0x925cc8[_0x7949('0x29')]]={'$like':'%'+_0x45ded2[_0x7949('0x32')][_0x7949('0x3e')]+'%'};return _0x1d6227;}})});}_0x4dace1=_['merge']({},_0x4dace1,_0x45ded2[_0x7949('0x41')]);var _0x2c3dee={'where':_0x4dace1[_0x7949('0x3d')]};return db[_0x7949('0x2d')][_0x7949('0x20')](_0x2c3dee)[_0x7949('0x26')](function(_0x486f03){_0x499954[_0x7949('0x20')]=_0x486f03;if(_0x45ded2[_0x7949('0x32')][_0x7949('0x42')]){_0x4dace1['include']=[{'all':!![]}];}return db[_0x7949('0x2d')][_0x7949('0x43')](_0x4dace1);})[_0x7949('0x26')](function(_0x1ef5cd){_0x499954[_0x7949('0x44')]=_0x1ef5cd;return _0x499954;})[_0x7949('0x26')](respondWithFilteredResult(_0xf117af,_0x4dace1))[_0x7949('0x45')](handleError(_0xf117af,null));};exports[_0x7949('0x46')]=function(_0x240782,_0x4562be){var _0x3172dc={'raw':![],'where':{'id':_0x240782['params']['id']}},_0x2b5285={};_0x2b5285[_0x7949('0x30')]=_[_0x7949('0x33')](db['VoiceRecording'][_0x7949('0x47')]);_0x2b5285[_0x7949('0x32')]=_[_0x7949('0x33')](_0x240782[_0x7949('0x32')]);_0x2b5285[_0x7949('0x34')]=_[_0x7949('0x35')](_0x2b5285[_0x7949('0x30')],_0x2b5285[_0x7949('0x32')]);_0x3172dc[_0x7949('0x37')]=_[_0x7949('0x35')](_0x2b5285[_0x7949('0x30')],qs[_0x7949('0x36')](_0x240782[_0x7949('0x32')][_0x7949('0x36')]));_0x3172dc[_0x7949('0x37')]=_0x3172dc[_0x7949('0x37')][_0x7949('0x38')]?_0x3172dc[_0x7949('0x37')]:_0x2b5285[_0x7949('0x30')];if(_0x240782[_0x7949('0x32')][_0x7949('0x42')]){_0x3172dc['include']=[{'all':!![]}];}_0x3172dc=_[_0x7949('0x3f')]({},_0x3172dc,_0x240782[_0x7949('0x41')]);return db[_0x7949('0x2d')][_0x7949('0x48')](_0x3172dc)[_0x7949('0x26')](handleEntityNotFound(_0x4562be,null))[_0x7949('0x26')](respondWithResult(_0x4562be,null))[_0x7949('0x45')](handleError(_0x4562be,null));};exports[_0x7949('0x49')]=function(_0x4ec34b,_0x948e1b){return db['VoiceRecording'][_0x7949('0x49')](_0x4ec34b['body'],{})['then'](respondWithResult(_0x948e1b,0xc9))[_0x7949('0x45')](handleError(_0x948e1b,null));};exports[_0x7949('0x25')]=function(_0x24cb72,_0x1370f1){if(_0x24cb72[_0x7949('0x4a')]['id']){delete _0x24cb72[_0x7949('0x4a')]['id'];}return db[_0x7949('0x2d')][_0x7949('0x48')]({'where':{'id':_0x24cb72[_0x7949('0x4b')]['id']}})[_0x7949('0x26')](handleEntityNotFound(_0x1370f1,null))[_0x7949('0x26')](saveUpdates(_0x24cb72[_0x7949('0x4a')],null))[_0x7949('0x26')](respondWithResult(_0x1370f1,null))['catch'](handleError(_0x1370f1,null));};exports[_0x7949('0x4c')]=function(_0x2dcc55,_0x9b37ef){return db['VoiceRecording'][_0x7949('0x4c')]()[_0x7949('0x26')](respondWithResult(_0x9b37ef,null))[_0x7949('0x45')](handleError(_0x9b37ef,null));};exports['download']=function(_0x4fd260,_0x5e0fc3,_0x42103e){var _0x4d9129=require(_0x7949('0x4d'));var _0x198717=![];var _0x5425b9={};if(_0x4fd260['query'][_0x7949('0x2e')]&&_0x4fd260[_0x7949('0x32')][_0x7949('0x2e')]===_0x7949('0x4e')){_0x5425b9['uniqueid']=_0x4fd260[_0x7949('0x4b')]['id'];}else{_0x5425b9['id']=_0x4fd260['params']['id'];}return db['VoiceRecording']['find']({'where':_0x5425b9,'attributes':['id',_0x7949('0x4f')],'raw':!![]})[_0x7949('0x26')](handleEntityNotFound(_0x5e0fc3,null))[_0x7949('0x26')](function(_0x10bb83){if(_0x10bb83){var _0x1e789a=_0x10bb83['value'];var _0x13d38a=util[_0x7949('0x31')](_0x7949('0x50'),_0x1e789a);if(fs['existsSync'](_0x13d38a)){_0x198717=!![];return _0x4d9129[_0x7949('0x51')](_0x13d38a,_0x1e789a,config['secrets'][_0x7949('0x52')])[_0x7949('0x26')](function(){return _0x10bb83;});}return _0x10bb83;}})[_0x7949('0x26')](function(_0x5a1dff){if(_0x5a1dff){var _0x33285e=_0x5a1dff[_0x7949('0x4f')];if(!fs[_0x7949('0x53')](_0x33285e)){throw new db[(_0x7949('0x54'))][(_0x7949('0x55'))](_0x7949('0x56'));}if(_0x5a1dff[_0x7949('0x57')]){return _0x5e0fc3[_0x7949('0x58')](_0x33285e,_0x5a1dff['filename']+path[_0x7949('0x59')](_0x33285e),function(){if(_0x198717){fs[_0x7949('0x5a')](_0x33285e);}});}else{return _0x5e0fc3[_0x7949('0x58')](_0x33285e,function(_0x1141a8){if(_0x198717){fs[_0x7949('0x5a')](_0x33285e);}});}}})[_0x7949('0x45')](function(_0xf4e7a2){if(_0xf4e7a2[_0x7949('0x5b')]===_0x7949('0x56')){_0x5e0fc3[_0x7949('0x1d')](0x194)[_0x7949('0x2a')](_0x7949('0x5c'));}else{return handleError(_0x5e0fc3,null);}});};exports['downloads']=function(_0x487d35,_0x582b47,_0x16f558){var _0xbbc5d7=require(_0x7949('0x4d'));var _0x54375c=![];var _0x56d9ee={'$and':[db[_0x7949('0x5d')][_0x7949('0x3d')](db['sequelize']['fn'](_0x7949('0x5e'),db[_0x7949('0x5d')]['col'](_0x7949('0x4e'))),_0x487d35[_0x7949('0x32')]['token'])]};if(_0x487d35[_0x7949('0x32')][_0x7949('0x2e')]&&_0x487d35[_0x7949('0x32')][_0x7949('0x2e')]===_0x7949('0x4e')){_0x56d9ee[_0x7949('0x5f')][_0x7949('0x60')]({'uniqueid':_0x487d35[_0x7949('0x4b')]['id']});}else{_0x56d9ee[_0x7949('0x5f')][_0x7949('0x60')]({'id':_0x487d35[_0x7949('0x4b')]['id']});}return db[_0x7949('0x2d')][_0x7949('0x48')]({'where':_0x56d9ee,'attributes':['id',_0x7949('0x4f')],'raw':!![]})[_0x7949('0x26')](handleEntityNotFound(_0x582b47,null))[_0x7949('0x26')](function(_0x3e4ee6){if(_0x3e4ee6){var _0x168b62=util[_0x7949('0x31')](_0x7949('0x50'),_0x3e4ee6['value']);if(fs[_0x7949('0x53')](_0x168b62)){_0x54375c=!![];return _0xbbc5d7[_0x7949('0x51')](_0x168b62,_0x3e4ee6[_0x7949('0x4f')],config[_0x7949('0x61')]['recording'])[_0x7949('0x26')](function(){return _0x3e4ee6;});}return _0x3e4ee6;}})['then'](function(_0x4668a1){if(_0x4668a1){if(!fs[_0x7949('0x53')](_0x4668a1[_0x7949('0x4f')])){throw new db[(_0x7949('0x54'))][(_0x7949('0x55'))](_0x7949('0x56'));}if(_0x4668a1[_0x7949('0x57')]){return _0x582b47[_0x7949('0x58')](_0x4668a1[_0x7949('0x4f')],_0x4668a1[_0x7949('0x57')]+path[_0x7949('0x59')](_0x4668a1[_0x7949('0x4f')]),function(){if(_0x54375c){fs[_0x7949('0x5a')](_0x4668a1[_0x7949('0x4f')]);}});}else{return _0x582b47['download'](_0x4668a1[_0x7949('0x4f')],function(_0x24b146){if(_0x54375c){fs[_0x7949('0x5a')](_0x4668a1['value']);}});}}})['catch'](handleError(_0x582b47,null));};exports[_0x7949('0x27')]=function(_0x3f57b3,_0x4da891){return db[_0x7949('0x2d')][_0x7949('0x48')]({'where':{'id':_0x3f57b3[_0x7949('0x4b')]['id']}})[_0x7949('0x26')](function(_0x29caad){if(_[_0x7949('0x62')](_0x29caad)){throw new ReferenceError(_0x7949('0x63'));}return _0x29caad;})[_0x7949('0x26')](function(_0x42bbe5){var _0x448d90=_0x42bbe5[_0x7949('0x4f')];logger[_0x7949('0x64')](_0x7949('0x65'),_0x448d90);if(!_[_0x7949('0x62')](_0x42bbe5['value'])&&fs[_0x7949('0x53')](_0x448d90)){logger[_0x7949('0x64')]('File:\x20\x22'+_0x448d90+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x7949('0x66')](_0x448d90);}_0x448d90=_0x448d90+'.cypher';if(!_[_0x7949('0x62')](_0x42bbe5[_0x7949('0x4f')])&&fs[_0x7949('0x53')](_0x448d90)){logger[_0x7949('0x64')](_0x7949('0x67')+_0x448d90+_0x7949('0x68'));fs[_0x7949('0x66')](_0x448d90);}return _0x42bbe5;})[_0x7949('0x26')](function(_0x44836c){if(!_0x44836c)throw new InternalError();return _0x44836c[_0x7949('0x27')]();})[_0x7949('0x26')](function(){_0x4da891[_0x7949('0x1d')](0xcc)[_0x7949('0x1c')]();})[_0x7949('0x45')](handleError(_0x4da891,null));};function getBucketslist(_0x1a147a,_0x1b3f0a,_0x3dbca4){return new Promise(function(_0x4d5e11,_0x4ae9b2){var _0x1bd252=new AWS['S3']({'accessKeyId':_0x1b3f0a,'secretAccessKey':_0x1a147a,'region':_0x3dbca4});_0x1bd252['listBuckets']({},function(_0x1269a3,_0x282b60){if(_0x1269a3){return _0x4ae9b2(_0x1269a3);}else{return _0x4d5e11(_0x282b60);}});});}function createBucket(_0x2fbc8e,_0x1a446b,_0x567fed,_0x338965){return new Promise(function(_0x58c704,_0x3e7e7b){var _0x315778=new AWS['S3']({'accessKeyId':_0x1a446b,'secretAccessKey':_0x2fbc8e,'region':_0x567fed});_0x315778[_0x7949('0x69')]({'Bucket':_0x338965},function(_0x4f4bd7,_0x2266a6){if(_0x4f4bd7){return _0x3e7e7b(_0x4f4bd7);}else{return _0x58c704(_0x2266a6);}});});}function uploadFile(_0x5a03ea,_0xad74ba,_0x34ec5d,_0x5b59b4,_0x5c5796,_0x16e25a){return new Promise(function(_0x129600,_0x183f89){var _0x1b62c7=new AWS['S3']({'accessKeyId':_0xad74ba,'secretAccessKey':_0x5a03ea,'region':_0x34ec5d});_0x1b62c7[_0x7949('0x6a')]({'Bucket':_0x5b59b4,'Key':_0x5c5796,'Body':_0x16e25a},function(_0x1b8462,_0x12d7ed){if(_0x1b8462){return _0x183f89(_0x1b8462);}else{return _0x129600(_0x12d7ed);}});});}function startTranscribe(_0x29689a,_0x5c54bb,_0x2845be,_0x1fccc0,_0x4afc1f,_0x2beab8){return new Promise(function(_0x3c0e00,_0x36333a){var _0x4ecf41=new AWS[(_0x7949('0x6b'))]({'accessKeyId':_0x5c54bb,'secretAccessKey':_0x29689a,'region':_0x2845be});_0x4ecf41['startTranscriptionJob']({'TranscriptionJobName':_0x1fccc0,'LanguageCode':_0x4afc1f,'Media':{'MediaFileUri':_0x2beab8}},function(_0x469f1d,_0x3e7080){if(_0x469f1d){return _0x36333a(_0x469f1d);}else{return _0x3c0e00(_0x3e7080);}});});}function transcribe(_0x444f4a,_0x142c10,_0x2834a4,_0x1f1d19,_0x205794,_0x3fd2f5,_0x5bd2c1){return new Promise(function(_0x5e401b,_0x3c9265){var _0xef2324={};logger[_0x7949('0x64')](util['format'](_0x7949('0x6c'),_0x444f4a,_0x205794));return uploadFile(_0x142c10,_0x2834a4,_0x1f1d19,_0x205794,path[_0x7949('0x6d')](_0x3fd2f5),fs['readFileSync'](_0x3fd2f5))[_0x7949('0x26')](function(_0x279711){logger[_0x7949('0x64')](util[_0x7949('0x31')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x444f4a,_0x205794,_0x279711[_0x7949('0x6e')]));_0xef2324['bucket']=_0x279711[_0x7949('0x6f')];_0xef2324[_0x7949('0x70')]=_0x279711[_0x7949('0x6e')];logger['info'](util[_0x7949('0x31')](_0x7949('0x71'),_0x444f4a));return startTranscribe(_0x142c10,_0x2834a4,_0x1f1d19,uuidv4(),_0x5bd2c1,_0x279711[_0x7949('0x6e')]);})[_0x7949('0x26')](function(_0x4173df){logger['info'](util[_0x7949('0x31')](_0x7949('0x72'),_0x444f4a,_0x4173df[_0x7949('0x73')][_0x7949('0x74')]));_0xef2324[_0x7949('0x75')]=_0x4173df['TranscriptionJob']['TranscriptionJobName'];_0xef2324[_0x7949('0x76')]=_0x4173df[_0x7949('0x73')][_0x7949('0x77')];return _0x5e401b(_0xef2324);})[_0x7949('0x45')](function(_0x419b2f){return _0x3c9265(_0x419b2f);});});}exports[_0x7949('0x78')]=function(_0xabfe44,_0x4924e3,_0x2dc9a4){var _0x4b2193;var _0x4b1658;var _0x540450;var _0x29a488=require(_0x7949('0x4d'));return db['VoiceRecording']['findOne']({'where':{'id':_0xabfe44[_0x7949('0x4b')]['id']}})[_0x7949('0x26')](function(_0x5cb91e){if(_0x5cb91e){var _0x4685f4=util[_0x7949('0x31')](_0x7949('0x50'),_0x5cb91e[_0x7949('0x4f')]);if(fs[_0x7949('0x53')](_0x4685f4)){cypher=!![];return _0x29a488[_0x7949('0x51')](_0x4685f4,_0x5cb91e[_0x7949('0x4f')],config[_0x7949('0x61')]['recording'])[_0x7949('0x26')](function(){return _0x5cb91e;});}return _0x5cb91e;}})[_0x7949('0x26')](function(_0x18e0eb){if(!_0x18e0eb){throw new db[(_0x7949('0x54'))][(_0x7949('0x55'))]('Voice\x20Recording\x20not\x20found');}_0x4b1658=_0x18e0eb;return db[_0x7949('0x79')]['findOne']({'where':{'id':0x1}});})[_0x7949('0x26')](handleEntityNotFound(_0x4924e3,null))[_0x7949('0x26')](function(_0x3500c2){if(_0x3500c2){_0x4b2193=_0x3500c2;if(!_0x4b2193['transcribe']||!_0x4b2193[_0x7949('0x7a')]||!_0x4b2193[_0x7949('0x7b')]||!_0x4b2193[_0x7949('0x7c')]||!_0x4b2193[_0x7949('0x7d')]){throw new db[(_0x7949('0x54'))][(_0x7949('0x55'))](_0x7949('0x7e'));}if(_0xabfe44[_0x7949('0x4a')][_0x7949('0x7f')]&&(!_0x4b2193[_0x7949('0x80')]||!_0x4b2193['sentimentAccountId']||!_0x4b2193[_0x7949('0x81')]||!_0x4b2193[_0x7949('0x7c')]||!_0x4b2193[_0x7949('0x7d')])){throw new db['Sequelize'][(_0x7949('0x55'))](_0x7949('0x82'));}return db[_0x7949('0x83')][_0x7949('0x84')]({'where':{'id':_0x4b2193[_0x7949('0x7a')]}});}})['then'](function(_0x412beb){if(!_0x412beb){throw new db[(_0x7949('0x54'))][(_0x7949('0x55'))](_0x7949('0x85'));}if(!_0x412beb['data1']||!_0x412beb['data2']){throw new db[(_0x7949('0x54'))][(_0x7949('0x55'))](_0x7949('0x86'));}_0x540450=_0x412beb;return getBucketslist(_0x540450[_0x7949('0x87')],_0x540450[_0x7949('0x88')],_0x4b2193[_0x7949('0x7b')]);})['then'](function(_0x475d3b){if(_0x475d3b&&_0x475d3b[_0x7949('0x89')]){var _0x31e90c=_['find'](_0x475d3b[_0x7949('0x89')],function(_0x1b131c){return _0x1b131c[_0x7949('0x8a')]===_0x4b2193[_0x7949('0x7d')];});if(!_0x31e90c){logger['info'](util[_0x7949('0x31')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0xabfe44[_0x7949('0x4b')]['id'],_0x4b2193[_0x7949('0x7d')]));return createBucket(_0x540450[_0x7949('0x87')],_0x540450[_0x7949('0x88')],_0x4b2193[_0x7949('0x7b')],_0x4b2193[_0x7949('0x7d')]);}logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0xabfe44[_0x7949('0x4b')]['id'],_0x4b2193[_0x7949('0x7d')]));return;}})['then'](function(_0x3ad11b){if(_0x4b1658[_0x7949('0x76')]===_0x7949('0x8b')){return transcribe(_0xabfe44[_0x7949('0x4b')]['id'],_0x540450[_0x7949('0x87')],_0x540450[_0x7949('0x88')],_0x4b2193['transcribeRegion'],_0x4b2193[_0x7949('0x7d')],_0x4b1658[_0x7949('0x4f')],_0x4b2193['language']);}else{logger[_0x7949('0x64')](util[_0x7949('0x31')](_0x7949('0x8c'),_0xabfe44[_0x7949('0x4b')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0x7949('0x26')](function(_0x51d1e6){if(_0x51d1e6){_0x51d1e6['tempSentiment']=_0xabfe44[_0x7949('0x4a')][_0x7949('0x7f')];return _0x4b1658['updateAttributes'](_0x51d1e6);}})[_0x7949('0x26')](respondWithResult(_0x4924e3,null))[_0x7949('0x45')](handleError(_0x4924e3,null));};function writeFile(_0x42a47e,_0x331d43){return new Promise(function(_0x46e61d,_0x2e065c){fs[_0x7949('0x8d')](_0x331d43,_0x42a47e,function(_0x2028ab,_0x4a15c8){if(_0x2028ab){return _0x2e065c(_0x2028ab);}else{return _0x46e61d(_0x4a15c8);}});});}exports['downloadTranscribe']=function(_0x15eb6f,_0x1d8512,_0x2d7a75){return db[_0x7949('0x2d')][_0x7949('0x84')]({'where':{'id':_0x15eb6f[_0x7949('0x4b')]['id']}})[_0x7949('0x26')](handleEntityNotFound(_0x1d8512))[_0x7949('0x26')](function(_0x23ec35){if(_0x23ec35&&_0x23ec35[_0x7949('0x8e')]){var _0x1d543f=_0x23ec35[_0x7949('0x8e')];var _0x564edb=config[_0x7949('0x8f')]+_0x7949('0x90')+_0x23ec35['id']+_0x7949('0x91');if(fs[_0x7949('0x53')](_0x564edb)){return _0x564edb;}return writeFile(_0x1d543f,_0x564edb)[_0x7949('0x26')](function(){return _0x564edb;});}else{throw new db['Sequelize']['ValidationError'](_0x7949('0x92'));}})[_0x7949('0x26')](function(_0x2a98a4){return _0x1d8512[_0x7949('0x58')](_0x2a98a4);})[_0x7949('0x45')](handleError(_0x1d8512));}; \ No newline at end of file +var _0x3baa=['sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','undefined','count','offset','set','reject','save','then','destroy','error','name','send','index','map','VoiceRecording','rawAttributes','fieldName','key','model','differenceBy','format','query','filters','attributes','intersection','fields','length','nolimit','limit','sort','where','pick','filter','merge','type','options','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','update','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','VoiceRecording\x20not\x20found','unlink','downloads','sequelize','col','$and','push','ValidationError','filename','extname','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','Voice\x20Recording\x20not\x20found','Setting','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment'];(function(_0x4260a5,_0x2f05a1){var _0xb79142=function(_0x37caa2){while(--_0x37caa2){_0x4260a5['push'](_0x4260a5['shift']());}};_0xb79142(++_0x2f05a1);}(_0x3baa,0xaf));var _0xa3ba=function(_0x4080dd,_0x5b595d){_0x4080dd=_0x4080dd-0x0;var _0x4ecf85=_0x3baa[_0x4080dd];return _0x4ecf85;};'use strict';var emlformat=require(_0xa3ba('0x0'));var rimraf=require(_0xa3ba('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa3ba('0x2'));var rp=require(_0xa3ba('0x3'));var moment=require(_0xa3ba('0x4'));var BPromise=require(_0xa3ba('0x5'));var Mustache=require(_0xa3ba('0x6'));var util=require(_0xa3ba('0x7'));var path=require('path');var sox=require(_0xa3ba('0x8'));var csv=require(_0xa3ba('0x9'));var ejs=require(_0xa3ba('0xa'));var fs=require('fs');var fs_extra=require(_0xa3ba('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa3ba('0xc'));var deskjs=require(_0xa3ba('0xd'));var toCsv=require(_0xa3ba('0x9'));var querystring=require(_0xa3ba('0xe'));var Papa=require(_0xa3ba('0xf'));var AWS=require(_0xa3ba('0x10'));var uuidv4=require(_0xa3ba('0x11'));var Redis=require('ioredis');var authService=require(_0xa3ba('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xa3ba('0x13'));var hardwareService=require(_0xa3ba('0x14'));var logger=require(_0xa3ba('0x15'))(_0xa3ba('0x16'));var utils=require(_0xa3ba('0x17'));var config=require(_0xa3ba('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e895f,_0x441fc3){_0x441fc3=_0x441fc3||0xcc;return function(_0x2821f5){if(_0x2821f5){return _0x2e895f[_0xa3ba('0x19')](_0x441fc3);}return _0x2e895f['status'](_0x441fc3)[_0xa3ba('0x1a')]();};}function respondWithResult(_0x34bcb8,_0x540d78){_0x540d78=_0x540d78||0xc8;return function(_0x2e0792){if(_0x2e0792){return _0x34bcb8[_0xa3ba('0x1b')](_0x540d78)[_0xa3ba('0x1c')](_0x2e0792);}};}function respondWithFilteredResult(_0x29e52d,_0x1c2f99){return function(_0x428168){if(_0x428168){var _0x1c9440=typeof _0x1c2f99['offset']===_0xa3ba('0x1d')&&typeof _0x1c2f99['limit']===_0xa3ba('0x1d');var _0x2f71e4=_0x428168[_0xa3ba('0x1e')];var _0x177798=_0x1c9440?0x0:_0x1c2f99[_0xa3ba('0x1f')];var _0x56f183=_0x1c9440?_0x428168['count']:_0x1c2f99['offset']+_0x1c2f99['limit'];var _0x7a462b;if(_0x56f183>=_0x2f71e4){_0x56f183=_0x2f71e4;_0x7a462b=0xc8;}else{_0x7a462b=0xce;}_0x29e52d['status'](_0x7a462b);return _0x29e52d[_0xa3ba('0x20')]('Content-Range',_0x177798+'-'+_0x56f183+'/'+_0x2f71e4)[_0xa3ba('0x1c')](_0x428168);}return null;};}function patchUpdates(_0xadb733){return function(_0x16bb65){try{jsonpatch['apply'](_0x16bb65,_0xadb733,!![]);}catch(_0x27272b){return BPromise[_0xa3ba('0x21')](_0x27272b);}return _0x16bb65[_0xa3ba('0x22')]();};}function saveUpdates(_0x1d4f5b,_0x5a8b5c){return function(_0x553ee5){if(_0x553ee5){return _0x553ee5['update'](_0x1d4f5b)[_0xa3ba('0x23')](function(_0x2a6a4c){return _0x2a6a4c;});}return null;};}function removeEntity(_0x2ca36c,_0x4f8261){return function(_0x237e3f){if(_0x237e3f){return _0x237e3f[_0xa3ba('0x24')]()[_0xa3ba('0x23')](function(){_0x2ca36c[_0xa3ba('0x1b')](0xcc)[_0xa3ba('0x1a')]();});}};}function handleEntityNotFound(_0x49d8d0,_0x52b8d1){return function(_0x4fe73e){if(!_0x4fe73e){_0x49d8d0[_0xa3ba('0x19')](0x194);}return _0x4fe73e;};}function handleError(_0x5616b8,_0x2aa5de){_0x2aa5de=_0x2aa5de||0x1f4;return function(_0x264921){logger[_0xa3ba('0x25')](_0x264921['stack']);if(_0x264921[_0xa3ba('0x26')]){delete _0x264921[_0xa3ba('0x26')];}_0x5616b8[_0xa3ba('0x1b')](_0x2aa5de)[_0xa3ba('0x27')](_0x264921);};}exports[_0xa3ba('0x28')]=function(_0x54d6cb,_0x26fe7c){var _0x236d05={},_0x4e86df={},_0x433b0d={'count':0x0,'rows':[]};var _0xbb1555=_[_0xa3ba('0x29')](db[_0xa3ba('0x2a')][_0xa3ba('0x2b')],function(_0x2b480f){return{'name':_0x2b480f[_0xa3ba('0x2c')],'type':_0x2b480f['type'][_0xa3ba('0x2d')]};});_0x4e86df[_0xa3ba('0x2e')]=_[_0xa3ba('0x2f')](_[_0xa3ba('0x29')](_0xbb1555,_0xa3ba('0x26')),[_0xa3ba('0x30')]);_0x4e86df[_0xa3ba('0x31')]=_['keys'](_0x54d6cb[_0xa3ba('0x31')]);_0x4e86df[_0xa3ba('0x32')]=_['intersection'](_0x4e86df[_0xa3ba('0x2e')],_0x4e86df[_0xa3ba('0x31')]);_0x236d05[_0xa3ba('0x33')]=_[_0xa3ba('0x34')](_0x4e86df[_0xa3ba('0x2e')],qs['fields'](_0x54d6cb[_0xa3ba('0x31')][_0xa3ba('0x35')]));_0x236d05[_0xa3ba('0x33')]=_0x236d05[_0xa3ba('0x33')][_0xa3ba('0x36')]?_0x236d05[_0xa3ba('0x33')]:_0x4e86df[_0xa3ba('0x2e')];if(!_0x54d6cb[_0xa3ba('0x31')]['hasOwnProperty'](_0xa3ba('0x37'))){_0x236d05[_0xa3ba('0x38')]=qs[_0xa3ba('0x38')](_0x54d6cb['query'][_0xa3ba('0x38')]);_0x236d05[_0xa3ba('0x1f')]=qs[_0xa3ba('0x1f')](_0x54d6cb[_0xa3ba('0x31')]['offset']);}_0x236d05['order']=qs[_0xa3ba('0x39')](_0x54d6cb['query'][_0xa3ba('0x39')]);_0x236d05[_0xa3ba('0x3a')]=qs['filters'](_[_0xa3ba('0x3b')](_0x54d6cb[_0xa3ba('0x31')],_0x4e86df[_0xa3ba('0x32')]),_0xbb1555);if(_0x54d6cb[_0xa3ba('0x31')][_0xa3ba('0x3c')]){_0x236d05[_0xa3ba('0x3a')]=_[_0xa3ba('0x3d')](_0x236d05[_0xa3ba('0x3a')],{'$or':_['map'](_0xbb1555,function(_0x233995){if(_0x233995[_0xa3ba('0x3e')]!=='VIRTUAL'){var _0x45ef65={};_0x45ef65[_0x233995[_0xa3ba('0x26')]]={'$like':'%'+_0x54d6cb[_0xa3ba('0x31')][_0xa3ba('0x3c')]+'%'};return _0x45ef65;}})});}_0x236d05=_[_0xa3ba('0x3d')]({},_0x236d05,_0x54d6cb[_0xa3ba('0x3f')]);var _0x267c53={'where':_0x236d05[_0xa3ba('0x3a')]};return db[_0xa3ba('0x2a')]['count'](_0x267c53)['then'](function(_0x24e3c8){_0x433b0d[_0xa3ba('0x1e')]=_0x24e3c8;if(_0x54d6cb[_0xa3ba('0x31')][_0xa3ba('0x40')]){_0x236d05['include']=[{'all':!![]}];}return db['VoiceRecording'][_0xa3ba('0x41')](_0x236d05);})['then'](function(_0x5cd6a2){_0x433b0d[_0xa3ba('0x42')]=_0x5cd6a2;return _0x433b0d;})[_0xa3ba('0x23')](respondWithFilteredResult(_0x26fe7c,_0x236d05))[_0xa3ba('0x43')](handleError(_0x26fe7c,null));};exports[_0xa3ba('0x44')]=function(_0x28874f,_0x10fb0d){var _0x665003={'raw':![],'where':{'id':_0x28874f[_0xa3ba('0x45')]['id']}},_0x1f499b={};_0x1f499b[_0xa3ba('0x2e')]=_[_0xa3ba('0x46')](db[_0xa3ba('0x2a')]['rawAttributes']);_0x1f499b[_0xa3ba('0x31')]=_['keys'](_0x28874f['query']);_0x1f499b[_0xa3ba('0x32')]=_[_0xa3ba('0x34')](_0x1f499b[_0xa3ba('0x2e')],_0x1f499b[_0xa3ba('0x31')]);_0x665003[_0xa3ba('0x33')]=_[_0xa3ba('0x34')](_0x1f499b[_0xa3ba('0x2e')],qs['fields'](_0x28874f[_0xa3ba('0x31')]['fields']));_0x665003[_0xa3ba('0x33')]=_0x665003['attributes'][_0xa3ba('0x36')]?_0x665003[_0xa3ba('0x33')]:_0x1f499b['model'];if(_0x28874f[_0xa3ba('0x31')][_0xa3ba('0x40')]){_0x665003[_0xa3ba('0x47')]=[{'all':!![]}];}_0x665003=_[_0xa3ba('0x3d')]({},_0x665003,_0x28874f[_0xa3ba('0x3f')]);return db[_0xa3ba('0x2a')][_0xa3ba('0x48')](_0x665003)[_0xa3ba('0x23')](handleEntityNotFound(_0x10fb0d,null))['then'](respondWithResult(_0x10fb0d,null))[_0xa3ba('0x43')](handleError(_0x10fb0d,null));};exports[_0xa3ba('0x49')]=function(_0x5d3b27,_0x15802a){return db[_0xa3ba('0x2a')]['create'](_0x5d3b27[_0xa3ba('0x4a')],{})[_0xa3ba('0x23')](respondWithResult(_0x15802a,0xc9))[_0xa3ba('0x43')](handleError(_0x15802a,null));};exports[_0xa3ba('0x4b')]=function(_0xe22c54,_0x22b4b9){if(_0xe22c54['body']['id']){delete _0xe22c54[_0xa3ba('0x4a')]['id'];}return db[_0xa3ba('0x2a')][_0xa3ba('0x48')]({'where':{'id':_0xe22c54[_0xa3ba('0x45')]['id']}})[_0xa3ba('0x23')](handleEntityNotFound(_0x22b4b9,null))[_0xa3ba('0x23')](saveUpdates(_0xe22c54[_0xa3ba('0x4a')],null))[_0xa3ba('0x23')](respondWithResult(_0x22b4b9,null))[_0xa3ba('0x43')](handleError(_0x22b4b9,null));};exports[_0xa3ba('0x4c')]=function(_0xce66bb,_0x346934){return db[_0xa3ba('0x2a')][_0xa3ba('0x4c')]()[_0xa3ba('0x23')](respondWithResult(_0x346934,null))[_0xa3ba('0x43')](handleError(_0x346934,null));};exports[_0xa3ba('0x4d')]=function(_0x3044a9,_0x25ecbb,_0x41e0fc){var _0x409f03=require(_0xa3ba('0x4e'));var _0x38f3a7=![];var _0x5dfa02={};if(_0x3044a9[_0xa3ba('0x31')][_0xa3ba('0x3e')]&&_0x3044a9[_0xa3ba('0x31')][_0xa3ba('0x3e')]===_0xa3ba('0x4f')){_0x5dfa02[_0xa3ba('0x4f')]=_0x3044a9[_0xa3ba('0x45')]['id'];}else{_0x5dfa02['id']=_0x3044a9[_0xa3ba('0x45')]['id'];}return db['VoiceRecording'][_0xa3ba('0x48')]({'where':_0x5dfa02,'attributes':['id',_0xa3ba('0x50')],'raw':!![]})[_0xa3ba('0x23')](handleEntityNotFound(_0x25ecbb,null))['then'](function(_0x5cf6e6){if(_0x5cf6e6){var _0x30d366=_0x5cf6e6[_0xa3ba('0x50')];var _0x289a20=util[_0xa3ba('0x30')](_0xa3ba('0x51'),_0x30d366);if(fs[_0xa3ba('0x52')](_0x289a20)){_0x38f3a7=!![];return _0x409f03[_0xa3ba('0x53')](_0x289a20,_0x30d366,config[_0xa3ba('0x54')][_0xa3ba('0x55')])[_0xa3ba('0x23')](function(){return _0x5cf6e6;});}return _0x5cf6e6;}})[_0xa3ba('0x23')](function(_0x43ca88){if(_0x43ca88){var _0x599817=_0x43ca88[_0xa3ba('0x50')];if(!fs['existsSync'](_0x599817)){throw new db[(_0xa3ba('0x56'))]['ValidationError'](_0xa3ba('0x57'));}if(_0x43ca88['filename']){return _0x25ecbb[_0xa3ba('0x4d')](_0x599817,_0x43ca88['filename']+path['extname'](_0x599817),function(){if(_0x38f3a7){fs[_0xa3ba('0x58')](_0x599817);}});}else{return _0x25ecbb['download'](_0x599817,function(_0x167b96){if(_0x38f3a7){fs[_0xa3ba('0x58')](_0x599817);}});}}})[_0xa3ba('0x43')](function(_0x4449a4){if(_0x4449a4['message']==='VoiceRecording\x20not\x20found'){_0x25ecbb[_0xa3ba('0x1b')](0x194)['send']('Not\x20found');}else{return handleError(_0x25ecbb,null);}});};exports[_0xa3ba('0x59')]=function(_0x5494a9,_0x1497a5,_0x48ad69){var _0x3ea336=require(_0xa3ba('0x4e'));var _0x23d66e=![];var _0x3f8147={'$and':[db[_0xa3ba('0x5a')][_0xa3ba('0x3a')](db['sequelize']['fn']('MD5',db['sequelize'][_0xa3ba('0x5b')](_0xa3ba('0x4f'))),_0x5494a9[_0xa3ba('0x31')]['token'])]};if(_0x5494a9[_0xa3ba('0x31')][_0xa3ba('0x3e')]&&_0x5494a9[_0xa3ba('0x31')]['type']===_0xa3ba('0x4f')){_0x3f8147[_0xa3ba('0x5c')][_0xa3ba('0x5d')]({'uniqueid':_0x5494a9['params']['id']});}else{_0x3f8147[_0xa3ba('0x5c')][_0xa3ba('0x5d')]({'id':_0x5494a9[_0xa3ba('0x45')]['id']});}return db[_0xa3ba('0x2a')]['find']({'where':_0x3f8147,'attributes':['id',_0xa3ba('0x50')],'raw':!![]})[_0xa3ba('0x23')](handleEntityNotFound(_0x1497a5,null))[_0xa3ba('0x23')](function(_0x29b684){if(_0x29b684){var _0x544d53=util[_0xa3ba('0x30')]('%s.cypher',_0x29b684['value']);if(fs[_0xa3ba('0x52')](_0x544d53)){_0x23d66e=!![];return _0x3ea336['decryptFile'](_0x544d53,_0x29b684[_0xa3ba('0x50')],config[_0xa3ba('0x54')][_0xa3ba('0x55')])[_0xa3ba('0x23')](function(){return _0x29b684;});}return _0x29b684;}})[_0xa3ba('0x23')](function(_0x3b8f7e){if(_0x3b8f7e){if(!fs[_0xa3ba('0x52')](_0x3b8f7e['value'])){throw new db[(_0xa3ba('0x56'))][(_0xa3ba('0x5e'))](_0xa3ba('0x57'));}if(_0x3b8f7e[_0xa3ba('0x5f')]){return _0x1497a5[_0xa3ba('0x4d')](_0x3b8f7e[_0xa3ba('0x50')],_0x3b8f7e[_0xa3ba('0x5f')]+path[_0xa3ba('0x60')](_0x3b8f7e[_0xa3ba('0x50')]),function(){if(_0x23d66e){fs[_0xa3ba('0x58')](_0x3b8f7e[_0xa3ba('0x50')]);}});}else{return _0x1497a5[_0xa3ba('0x4d')](_0x3b8f7e['value'],function(_0x3b7d07){if(_0x23d66e){fs['unlink'](_0x3b8f7e['value']);}});}}})[_0xa3ba('0x43')](handleError(_0x1497a5,null));};exports['destroy']=function(_0xb30141,_0x43abc9){return db[_0xa3ba('0x2a')][_0xa3ba('0x48')]({'where':{'id':_0xb30141['params']['id']}})['then'](function(_0x414330){if(_[_0xa3ba('0x61')](_0x414330)){throw new ReferenceError(_0xa3ba('0x62'));}return _0x414330;})[_0xa3ba('0x23')](function(_0x237a43){var _0x44fb50=_0x237a43['value'];logger[_0xa3ba('0x63')]('cancellazione\x20fisica\x20documento\x20%s',_0x44fb50);if(!_[_0xa3ba('0x61')](_0x237a43[_0xa3ba('0x50')])&&fs[_0xa3ba('0x52')](_0x44fb50)){logger[_0xa3ba('0x63')](_0xa3ba('0x64')+_0x44fb50+_0xa3ba('0x65'));fs['unlinkSync'](_0x44fb50);}_0x44fb50=_0x44fb50+_0xa3ba('0x66');if(!_[_0xa3ba('0x61')](_0x237a43['value'])&&fs['existsSync'](_0x44fb50)){logger['info'](_0xa3ba('0x64')+_0x44fb50+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xa3ba('0x67')](_0x44fb50);}return _0x237a43;})[_0xa3ba('0x23')](function(_0x8fad40){if(!_0x8fad40)throw new InternalError();return _0x8fad40['destroy']();})[_0xa3ba('0x23')](function(){_0x43abc9[_0xa3ba('0x1b')](0xcc)[_0xa3ba('0x1a')]();})[_0xa3ba('0x43')](handleError(_0x43abc9,null));};function getBucketslist(_0x4a90c2,_0x1ab849,_0x2c8e83){return new Promise(function(_0x26cb1f,_0x438103){var _0x290607=new AWS['S3']({'accessKeyId':_0x1ab849,'secretAccessKey':_0x4a90c2,'region':_0x2c8e83});_0x290607[_0xa3ba('0x68')]({},function(_0x43eb3b,_0x3a372b){if(_0x43eb3b){return _0x438103(_0x43eb3b);}else{return _0x26cb1f(_0x3a372b);}});});}function createBucket(_0x9ec883,_0x3b7079,_0x5e3fb0,_0x4cec8d){return new Promise(function(_0x137c6f,_0x314044){var _0x160702=new AWS['S3']({'accessKeyId':_0x3b7079,'secretAccessKey':_0x9ec883,'region':_0x5e3fb0});_0x160702[_0xa3ba('0x69')]({'Bucket':_0x4cec8d},function(_0x124d99,_0x35a656){if(_0x124d99){return _0x314044(_0x124d99);}else{return _0x137c6f(_0x35a656);}});});}function uploadFile(_0xfc6013,_0x331b02,_0x5ad1b2,_0x4b2146,_0xa1e316,_0x1c8435){return new Promise(function(_0x217d30,_0x1519fb){var _0x5d3d00=new AWS['S3']({'accessKeyId':_0x331b02,'secretAccessKey':_0xfc6013,'region':_0x5ad1b2});_0x5d3d00[_0xa3ba('0x6a')]({'Bucket':_0x4b2146,'Key':_0xa1e316,'Body':_0x1c8435},function(_0x4d9c7f,_0x3e1ad2){if(_0x4d9c7f){return _0x1519fb(_0x4d9c7f);}else{return _0x217d30(_0x3e1ad2);}});});}function startTranscribe(_0x2aafa5,_0x30fa0a,_0x54a74d,_0x3ef447,_0x4b59fa,_0x2cdba7){return new Promise(function(_0x54977d,_0x3b655b){var _0x476c24=new AWS[(_0xa3ba('0x6b'))]({'accessKeyId':_0x30fa0a,'secretAccessKey':_0x2aafa5,'region':_0x54a74d});_0x476c24[_0xa3ba('0x6c')]({'TranscriptionJobName':_0x3ef447,'LanguageCode':_0x4b59fa,'Media':{'MediaFileUri':_0x2cdba7}},function(_0x2182f4,_0x3aa03b){if(_0x2182f4){return _0x3b655b(_0x2182f4);}else{return _0x54977d(_0x3aa03b);}});});}function transcribe(_0x19b962,_0xb829c9,_0x23c0ff,_0x2b76bf,_0x5b7a25,_0x5e381f,_0x39f7ec){return new Promise(function(_0x515453,_0x39e290){var _0x3f47e4={};logger[_0xa3ba('0x63')](util['format'](_0xa3ba('0x6d'),_0x19b962,_0x5b7a25));return uploadFile(_0xb829c9,_0x23c0ff,_0x2b76bf,_0x5b7a25,path[_0xa3ba('0x6e')](_0x5e381f),fs['readFileSync'](_0x5e381f))[_0xa3ba('0x23')](function(_0x517b3d){logger['info'](util[_0xa3ba('0x30')](_0xa3ba('0x6f'),_0x19b962,_0x5b7a25,_0x517b3d['Location']));_0x3f47e4[_0xa3ba('0x70')]=_0x517b3d[_0xa3ba('0x71')];_0x3f47e4[_0xa3ba('0x72')]=_0x517b3d[_0xa3ba('0x73')];logger['info'](util['format'](_0xa3ba('0x74'),_0x19b962));return startTranscribe(_0xb829c9,_0x23c0ff,_0x2b76bf,uuidv4(),_0x39f7ec,_0x517b3d[_0xa3ba('0x73')]);})['then'](function(_0x6658f7){logger[_0xa3ba('0x63')](util[_0xa3ba('0x30')](_0xa3ba('0x75'),_0x19b962,_0x6658f7[_0xa3ba('0x76')][_0xa3ba('0x77')]));_0x3f47e4[_0xa3ba('0x78')]=_0x6658f7[_0xa3ba('0x76')]['TranscriptionJobName'];_0x3f47e4[_0xa3ba('0x79')]=_0x6658f7[_0xa3ba('0x76')][_0xa3ba('0x7a')];return _0x515453(_0x3f47e4);})[_0xa3ba('0x43')](function(_0x4b4b6f){return _0x39e290(_0x4b4b6f);});});}exports['runTranscribe']=function(_0x3d5f3e,_0x5b845d,_0x3c49c7){var _0x3afeaf;var _0x47f222;var _0x30ce1f;var _0x11fdd7=require('../../components/encryptor');return db['VoiceRecording']['findOne']({'where':{'id':_0x3d5f3e[_0xa3ba('0x45')]['id']}})['then'](function(_0x23d7ab){if(_0x23d7ab){var _0x432022=util[_0xa3ba('0x30')](_0xa3ba('0x51'),_0x23d7ab['value']);if(fs[_0xa3ba('0x52')](_0x432022)){cypher=!![];return _0x11fdd7[_0xa3ba('0x53')](_0x432022,_0x23d7ab['value'],config[_0xa3ba('0x54')][_0xa3ba('0x55')])[_0xa3ba('0x23')](function(){return _0x23d7ab;});}return _0x23d7ab;}})[_0xa3ba('0x23')](function(_0x3e1346){if(!_0x3e1346){throw new db[(_0xa3ba('0x56'))][(_0xa3ba('0x5e'))](_0xa3ba('0x7b'));}_0x47f222=_0x3e1346;return db[_0xa3ba('0x7c')]['findOne']({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x5b845d,null))[_0xa3ba('0x23')](function(_0x2cce8c){if(_0x2cce8c){_0x3afeaf=_0x2cce8c;if(!_0x3afeaf['transcribe']||!_0x3afeaf[_0xa3ba('0x7d')]||!_0x3afeaf[_0xa3ba('0x7e')]||!_0x3afeaf[_0xa3ba('0x7f')]||!_0x3afeaf[_0xa3ba('0x70')]){throw new db[(_0xa3ba('0x56'))][(_0xa3ba('0x5e'))](_0xa3ba('0x80'));}if(_0x3d5f3e[_0xa3ba('0x4a')][_0xa3ba('0x81')]&&(!_0x3afeaf[_0xa3ba('0x82')]||!_0x3afeaf[_0xa3ba('0x83')]||!_0x3afeaf[_0xa3ba('0x84')]||!_0x3afeaf['language']||!_0x3afeaf[_0xa3ba('0x70')])){throw new db[(_0xa3ba('0x56'))][(_0xa3ba('0x5e'))](_0xa3ba('0x85'));}return db[_0xa3ba('0x86')][_0xa3ba('0x87')]({'where':{'id':_0x3afeaf['transcribeAccountId']}});}})['then'](function(_0x16e874){if(!_0x16e874){throw new db[(_0xa3ba('0x56'))][(_0xa3ba('0x5e'))](_0xa3ba('0x88'));}if(!_0x16e874[_0xa3ba('0x89')]||!_0x16e874[_0xa3ba('0x8a')]){throw new db[(_0xa3ba('0x56'))][(_0xa3ba('0x5e'))](_0xa3ba('0x8b'));}_0x30ce1f=_0x16e874;return getBucketslist(_0x30ce1f[_0xa3ba('0x89')],_0x30ce1f[_0xa3ba('0x8a')],_0x3afeaf[_0xa3ba('0x7e')]);})[_0xa3ba('0x23')](function(_0x37bc77){if(_0x37bc77&&_0x37bc77[_0xa3ba('0x8c')]){var _0x32f4df=_[_0xa3ba('0x48')](_0x37bc77[_0xa3ba('0x8c')],function(_0x44f2df){return _0x44f2df[_0xa3ba('0x8d')]===_0x3afeaf['bucket'];});if(!_0x32f4df){logger[_0xa3ba('0x63')](util[_0xa3ba('0x30')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x3d5f3e[_0xa3ba('0x45')]['id'],_0x3afeaf[_0xa3ba('0x70')]));return createBucket(_0x30ce1f['data1'],_0x30ce1f[_0xa3ba('0x8a')],_0x3afeaf[_0xa3ba('0x7e')],_0x3afeaf['bucket']);}logger['info'](util[_0xa3ba('0x30')](_0xa3ba('0x8e'),_0x3d5f3e[_0xa3ba('0x45')]['id'],_0x3afeaf[_0xa3ba('0x70')]));return;}})[_0xa3ba('0x23')](function(_0x2d5307){if(_0x47f222[_0xa3ba('0x79')]===_0xa3ba('0x8f')){return transcribe(_0x3d5f3e[_0xa3ba('0x45')]['id'],_0x30ce1f[_0xa3ba('0x89')],_0x30ce1f['data2'],_0x3afeaf[_0xa3ba('0x7e')],_0x3afeaf['bucket'],_0x47f222[_0xa3ba('0x50')],_0x3afeaf['language']);}else{logger[_0xa3ba('0x63')](util[_0xa3ba('0x30')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x3d5f3e[_0xa3ba('0x45')]['id']));return{'transcribeStatus':_0xa3ba('0x90')};}})[_0xa3ba('0x23')](function(_0x387aa0){if(_0x387aa0){_0x387aa0[_0xa3ba('0x91')]=_0x3d5f3e[_0xa3ba('0x4a')][_0xa3ba('0x81')];return _0x47f222[_0xa3ba('0x92')](_0x387aa0);}})[_0xa3ba('0x23')](respondWithResult(_0x5b845d,null))[_0xa3ba('0x43')](handleError(_0x5b845d,null));};function writeFile(_0x4fdfe1,_0x4bf099){return new Promise(function(_0xa48b0b,_0x24e84c){fs[_0xa3ba('0x93')](_0x4bf099,_0x4fdfe1,function(_0x3a3318,_0x5a15d3){if(_0x3a3318){return _0x24e84c(_0x3a3318);}else{return _0xa48b0b(_0x5a15d3);}});});}exports[_0xa3ba('0x94')]=function(_0x5238c1,_0x140f71,_0x13cced){return db['VoiceRecording'][_0xa3ba('0x87')]({'where':{'id':_0x5238c1['params']['id']}})['then'](handleEntityNotFound(_0x140f71))[_0xa3ba('0x23')](function(_0x47322c){if(_0x47322c&&_0x47322c[_0xa3ba('0x95')]){var _0x3d604e=_0x47322c[_0xa3ba('0x95')];var _0x5dc82d=config[_0xa3ba('0x96')]+_0xa3ba('0x97')+_0x47322c['id']+'.txt';if(fs['existsSync'](_0x5dc82d)){return _0x5dc82d;}return writeFile(_0x3d604e,_0x5dc82d)[_0xa3ba('0x23')](function(){return _0x5dc82d;});}else{throw new db[(_0xa3ba('0x56'))]['ValidationError'](_0xa3ba('0x98'));}})['then'](function(_0x3c2184){return _0x140f71['download'](_0x3c2184);})['catch'](handleError(_0x140f71));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index ad76a3b..13d6c78 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 _0x57ca=['define','VoiceRecording','voice_recordings','uniqueid','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./voiceRecording.attributes','exports'];(function(_0x5a5961,_0x5a9348){var _0x44a46a=function(_0x2ecc49){while(--_0x2ecc49){_0x5a5961['push'](_0x5a5961['shift']());}};_0x44a46a(++_0x5a9348);}(_0x57ca,0x108));var _0xa57c=function(_0x3b2f14,_0x429d92){_0x3b2f14=_0x3b2f14-0x0;var _0x3e563d=_0x57ca[_0x3b2f14];return _0x3e563d;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var logger=require(_0xa57c('0x1'))('api');var moment=require(_0xa57c('0x2'));var BPromise=require(_0xa57c('0x3'));var rp=require(_0xa57c('0x4'));var fs=require('fs');var path=require(_0xa57c('0x5'));var rimraf=require(_0xa57c('0x6'));var config=require('../../config/environment');var attributes=require(_0xa57c('0x7'));module[_0xa57c('0x8')]=function(_0x113dcf,_0x19473f){return _0x113dcf[_0xa57c('0x9')](_0xa57c('0xa'),attributes,{'tableName':_0xa57c('0xb'),'paranoid':![],'indexes':[{'name':_0xa57c('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x260e=['rimraf','../../config/environment','./voiceRecording.attributes','exports','define','VoiceRecording','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xe5e3fb,_0x2fa636){var _0xdc5834=function(_0x5960b7){while(--_0x5960b7){_0xe5e3fb['push'](_0xe5e3fb['shift']());}};_0xdc5834(++_0x2fa636);}(_0x260e,0x1b9));var _0xe260=function(_0x510e3b,_0x47d5c1){_0x510e3b=_0x510e3b-0x0;var _0x477cbe=_0x260e[_0x510e3b];return _0x477cbe;};'use strict';var _=require(_0xe260('0x0'));var util=require(_0xe260('0x1'));var logger=require(_0xe260('0x2'))(_0xe260('0x3'));var moment=require(_0xe260('0x4'));var BPromise=require(_0xe260('0x5'));var rp=require(_0xe260('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe260('0x7'));var config=require(_0xe260('0x8'));var attributes=require(_0xe260('0x9'));module[_0xe260('0xa')]=function(_0x5dfb93,_0x1e44c1){return _0x5dfb93[_0xe260('0xb')](_0xe260('0xc'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0xe260('0xd'),'fields':[_0xe260('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 4c0ed53..bf013e3 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 _0xd943=['info','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','error','code','VoiceRecording,\x20%s,\x20%s','message','result','catch','UpdateVoiceRecording','VoiceRecording','body','options','raw','where','attributes','debug','stringify','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','existsSync','value','format','secrets','recording','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then'];(function(_0x40d719,_0x4ed66c){var _0x29812b=function(_0x1d912a){while(--_0x1d912a){_0x40d719['push'](_0x40d719['shift']());}};_0x29812b(++_0x4ed66c);}(_0xd943,0x15d));var _0x3d94=function(_0x5f2944,_0x34ab4f){_0x5f2944=_0x5f2944-0x0;var _0x597fef=_0xd943[_0x5f2944];return _0x597fef;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var moment=require(_0x3d94('0x2'));var BPromise=require(_0x3d94('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d94('0x4'));var db=require(_0x3d94('0x5'))['db'];var utils=require(_0x3d94('0x6'));var logger=require(_0x3d94('0x7'))(_0x3d94('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3d94('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54e81f,_0x4d29e7,_0x20f4d1){return new BPromise(function(_0x35d36a,_0x5244c3){return client['request'](_0x54e81f,_0x20f4d1)[_0x3d94('0xa')](function(_0x27e381){logger[_0x3d94('0xb')]('VoiceRecording,\x20%s,\x20%s',_0x4d29e7,_0x3d94('0xc'));logger['debug'](_0x3d94('0xd'),_0x4d29e7,_0x3d94('0xc'),JSON['stringify'](_0x27e381));if(_0x27e381[_0x3d94('0xe')]){if(_0x27e381[_0x3d94('0xe')][_0x3d94('0xf')]===0x1f4){logger[_0x3d94('0xe')](_0x3d94('0x10'),_0x4d29e7,_0x27e381['error'][_0x3d94('0x11')]);return _0x5244c3(_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);}logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);return _0x35d36a(_0x27e381['error'][_0x3d94('0x11')]);}else{logger[_0x3d94('0xb')](_0x3d94('0x10'),_0x4d29e7,_0x3d94('0xc'));_0x35d36a(_0x27e381[_0x3d94('0x12')][_0x3d94('0x11')]);}})[_0x3d94('0x13')](function(_0x9893cb){logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x9893cb);_0x5244c3(_0x9893cb);});});}exports[_0x3d94('0x14')]=function(_0x2acee3){var _0x1c35a8=this;return new Promise(function(_0x4afc92,_0x3ca0e3){return db[_0x3d94('0x15')]['update'](_0x2acee3[_0x3d94('0x16')],{'raw':_0x2acee3['options']?_0x2acee3[_0x3d94('0x17')][_0x3d94('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2acee3[_0x3d94('0x17')]?_0x2acee3[_0x3d94('0x17')][_0x3d94('0x19')]||null:null,'attributes':_0x2acee3['options']?_0x2acee3['options'][_0x3d94('0x1a')]||null:null,'limit':_0x2acee3[_0x3d94('0x17')]?_0x2acee3[_0x3d94('0x17')]['limit']||null:null})[_0x3d94('0xa')](function(_0x2e8c91){logger[_0x3d94('0xb')](_0x3d94('0x14'),_0x2acee3);logger[_0x3d94('0x1b')](_0x3d94('0x14'),_0x2acee3,JSON[_0x3d94('0x1c')](_0x2e8c91));_0x4afc92(_0x2e8c91);})[_0x3d94('0x13')](function(_0xee7b8d){logger[_0x3d94('0xe')](_0x3d94('0x14'),_0xee7b8d[_0x3d94('0x11')],_0x2acee3);_0x3ca0e3(_0x1c35a8[_0x3d94('0xe')](0x1f4,_0xee7b8d[_0x3d94('0x11')]));});});};exports[_0x3d94('0x1d')]=function(_0x5b3b31){var _0x123183=this;return new Promise(function(_0x558fd2,_0x28a698){var _0x1d0a7a=require(_0x3d94('0x1e'));var _0x439173;return db[_0x3d94('0x1f')][_0x3d94('0x20')]({'attributes':['id',_0x3d94('0x21')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x584c4a){_0x439173=_0x584c4a;return db[_0x3d94('0x15')]['create'](_0x5b3b31['body']);})[_0x3d94('0xa')](function(_0x58c0d0){if(_0x439173[_0x3d94('0x21')]&&fs[_0x3d94('0x22')](_0x58c0d0[_0x3d94('0x23')])){var _0x4cef9c=util[_0x3d94('0x24')]('%s.cypher',_0x58c0d0[_0x3d94('0x23')]);return _0x1d0a7a['encryptFile'](_0x58c0d0[_0x3d94('0x23')],_0x4cef9c,config[_0x3d94('0x25')][_0x3d94('0x26')])[_0x3d94('0xa')](function(){fs['unlink'](_0x58c0d0[_0x3d94('0x23')]);logger['info'](_0x3d94('0x27'));return _0x58c0d0;});}return _0x58c0d0;})[_0x3d94('0xa')](function(_0x51d308){logger['info'](_0x3d94('0x1d'),_0x5b3b31);logger[_0x3d94('0x1b')](_0x3d94('0x1d'),_0x5b3b31,JSON['stringify'](_0x51d308));_0x558fd2(_0x51d308);})[_0x3d94('0x13')](function(_0x3d29fd){logger['error'](_0x3d94('0x1d'),_0x3d29fd[_0x3d94('0x11')],_0x5b3b31);_0x28a698(_0x123183[_0x3d94('0xe')](0x1f4,_0x3d29fd[_0x3d94('0x11')]));});});}; \ No newline at end of file +var _0xb016=['options','raw','attributes','limit','debug','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','value','format','encryptFile','secrets','recording','unlink','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','body'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xb016,0x159));var _0x6b01=function(_0x35799a,_0x497e86){_0x35799a=_0x35799a-0x0;var _0xcfd7ce=_0xb016[_0x35799a];return _0xcfd7ce;};'use strict';var _=require(_0x6b01('0x0'));var util=require(_0x6b01('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6b01('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6b01('0x3'))['db'];var utils=require(_0x6b01('0x4'));var logger=require(_0x6b01('0x5'))(_0x6b01('0x6'));var config=require('../../config/environment');var jayson=require(_0x6b01('0x7'));var client=jayson[_0x6b01('0x8')][_0x6b01('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5759a1,_0x5c5bfb,_0x374aab){return new BPromise(function(_0x39f9fa,_0x526a7d){return client['request'](_0x5759a1,_0x374aab)[_0x6b01('0xa')](function(_0x1cb3a6){logger[_0x6b01('0xb')](_0x6b01('0xc'),_0x5c5bfb,_0x6b01('0xd'));logger['debug']('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x5c5bfb,_0x6b01('0xd'),JSON[_0x6b01('0xe')](_0x1cb3a6));if(_0x1cb3a6[_0x6b01('0xf')]){if(_0x1cb3a6['error'][_0x6b01('0x10')]===0x1f4){logger['error']('VoiceRecording,\x20%s,\x20%s',_0x5c5bfb,_0x1cb3a6[_0x6b01('0xf')]['message']);return _0x526a7d(_0x1cb3a6[_0x6b01('0xf')][_0x6b01('0x11')]);}logger['error'](_0x6b01('0xc'),_0x5c5bfb,_0x1cb3a6['error']['message']);return _0x39f9fa(_0x1cb3a6['error'][_0x6b01('0x11')]);}else{logger['info']('VoiceRecording,\x20%s,\x20%s',_0x5c5bfb,_0x6b01('0xd'));_0x39f9fa(_0x1cb3a6[_0x6b01('0x12')][_0x6b01('0x11')]);}})[_0x6b01('0x13')](function(_0x3d7045){logger[_0x6b01('0xf')](_0x6b01('0xc'),_0x5c5bfb,_0x3d7045);_0x526a7d(_0x3d7045);});});}exports[_0x6b01('0x14')]=function(_0x9c6571){var _0xc4e1b1=this;return new Promise(function(_0x18f336,_0x4f2d08){return db[_0x6b01('0x15')][_0x6b01('0x16')](_0x9c6571[_0x6b01('0x17')],{'raw':_0x9c6571[_0x6b01('0x18')]?_0x9c6571[_0x6b01('0x18')][_0x6b01('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9c6571[_0x6b01('0x18')]?_0x9c6571[_0x6b01('0x18')]['where']||null:null,'attributes':_0x9c6571[_0x6b01('0x18')]?_0x9c6571[_0x6b01('0x18')][_0x6b01('0x1a')]||null:null,'limit':_0x9c6571[_0x6b01('0x18')]?_0x9c6571[_0x6b01('0x18')][_0x6b01('0x1b')]||null:null})[_0x6b01('0xa')](function(_0x542fab){logger[_0x6b01('0xb')](_0x6b01('0x14'),_0x9c6571);logger[_0x6b01('0x1c')]('UpdateVoiceRecording',_0x9c6571,JSON[_0x6b01('0xe')](_0x542fab));_0x18f336(_0x542fab);})[_0x6b01('0x13')](function(_0x304393){logger[_0x6b01('0xf')](_0x6b01('0x14'),_0x304393[_0x6b01('0x11')],_0x9c6571);_0x4f2d08(_0xc4e1b1[_0x6b01('0xf')](0x1f4,_0x304393[_0x6b01('0x11')]));});});};exports[_0x6b01('0x1d')]=function(_0x152dda){var _0x3c0607=this;return new Promise(function(_0xa846d8,_0x154dfc){var _0x55ca4b=require(_0x6b01('0x1e'));var _0x220efb;return db[_0x6b01('0x1f')][_0x6b01('0x20')]({'attributes':['id',_0x6b01('0x21')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x54f030){_0x220efb=_0x54f030;return db[_0x6b01('0x15')][_0x6b01('0x22')](_0x152dda[_0x6b01('0x17')]);})[_0x6b01('0xa')](function(_0x2a894e){if(_0x220efb[_0x6b01('0x21')]&&fs['existsSync'](_0x2a894e[_0x6b01('0x23')])){var _0x5482a8=util[_0x6b01('0x24')]('%s.cypher',_0x2a894e[_0x6b01('0x23')]);return _0x55ca4b[_0x6b01('0x25')](_0x2a894e[_0x6b01('0x23')],_0x5482a8,config[_0x6b01('0x26')][_0x6b01('0x27')])['then'](function(){fs[_0x6b01('0x28')](_0x2a894e[_0x6b01('0x23')]);logger[_0x6b01('0xb')]('CreateVoiceRecording\x20file\x20encrypted');return _0x2a894e;});}return _0x2a894e;})['then'](function(_0x3578ef){logger['info'](_0x6b01('0x1d'),_0x152dda);logger[_0x6b01('0x1c')](_0x6b01('0x1d'),_0x152dda,JSON['stringify'](_0x3578ef));_0xa846d8(_0x3578ef);})[_0x6b01('0x13')](function(_0x42d5f7){logger[_0x6b01('0xf')]('CreateVoiceRecording',_0x42d5f7[_0x6b01('0x11')],_0x152dda);_0x154dfc(_0x3c0607[_0x6b01('0xf')](0x1f4,_0x42d5f7[_0x6b01('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index b26eb1c..746595b 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 _0x9309=['describe','/:id','post','create','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0x9309,0x115));var _0x9930=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9309[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x9930('0x0'));var util=require(_0x9930('0x1'));var path=require('path');var timeout=require(_0x9930('0x2'));var express=require(_0x9930('0x3'));var router=express[_0x9930('0x4')]();var fs_extra=require(_0x9930('0x5'));var auth=require(_0x9930('0x6'));var interaction=require(_0x9930('0x7'));var config=require('../../config/environment');var controller=require('./voiceTransferReport.controller');router[_0x9930('0x8')]('/',auth[_0x9930('0x9')](),controller[_0x9930('0xa')]);router[_0x9930('0x8')]('/describe',auth[_0x9930('0x9')](),controller[_0x9930('0xb')]);router['get'](_0x9930('0xc'),auth[_0x9930('0x9')](),controller['show']);router[_0x9930('0xd')]('/',auth[_0x9930('0x9')](),controller[_0x9930('0xe')]);router['put'](_0x9930('0xc'),auth[_0x9930('0x9')](),controller[_0x9930('0xf')]);router['delete'](_0x9930('0xc'),auth[_0x9930('0x9')](),controller[_0x9930('0x10')]);module[_0x9930('0x11')]=router; \ No newline at end of file +var _0xd064=['post','put','/:id','update','delete','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','describe','show'];(function(_0x4f98bd,_0x5a478d){var _0x143a7d=function(_0xb4e744){while(--_0xb4e744){_0x4f98bd['push'](_0x4f98bd['shift']());}};_0x143a7d(++_0x5a478d);}(_0xd064,0xfd));var _0x4d06=function(_0xa96b73,_0x5d4c0c){_0xa96b73=_0xa96b73-0x0;var _0x4aacc7=_0xd064[_0xa96b73];return _0x4aacc7;};'use strict';var multer=require(_0x4d06('0x0'));var util=require(_0x4d06('0x1'));var path=require(_0x4d06('0x2'));var timeout=require('connect-timeout');var express=require(_0x4d06('0x3'));var router=express['Router']();var fs_extra=require(_0x4d06('0x4'));var auth=require(_0x4d06('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4d06('0x6'));var controller=require(_0x4d06('0x7'));router[_0x4d06('0x8')]('/',auth[_0x4d06('0x9')](),controller[_0x4d06('0xa')]);router[_0x4d06('0x8')]('/describe',auth[_0x4d06('0x9')](),controller[_0x4d06('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x4d06('0xc')]);router[_0x4d06('0xd')]('/',auth[_0x4d06('0x9')](),controller['create']);router[_0x4d06('0xe')](_0x4d06('0xf'),auth[_0x4d06('0x9')](),controller[_0x4d06('0x10')]);router[_0x4d06('0x11')](_0x4d06('0xf'),auth[_0x4d06('0x9')](),controller['destroy']);module[_0x4d06('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index cc6f396..7084e21 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 _0x9203=['STRING','Yes','sequelize','moment','ENUM','blind','attended'];(function(_0x5468ca,_0x4a4126){var _0x3a9fa0=function(_0x3bf264){while(--_0x3bf264){_0x5468ca['push'](_0x5468ca['shift']());}};_0x3a9fa0(++_0x4a4126);}(_0x9203,0xaa));var _0x3920=function(_0x4a7145,_0x14c18b){_0x4a7145=_0x4a7145-0x0;var _0x9e46d5=_0x9203[_0x4a7145];return _0x9e46d5;};'use strict';var Sequelize=require(_0x3920('0x0'));var moment=require(_0x3920('0x1'));module['exports']={'type':{'type':Sequelize[_0x3920('0x2')](_0x3920('0x3'),_0x3920('0x4'))},'result':{'type':Sequelize[_0x3920('0x5')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x3920('0x5')]},'transferercalleridname':{'type':Sequelize[_0x3920('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x3920('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x3920('0x5')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x3920('0x5')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0x3920('0x5')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0x3920('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x3920('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0x3920('0x5')]},'transfereecontext':{'type':Sequelize[_0x3920('0x5')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize['ENUM'](_0x3920('0x6'),'No')},'context':{'type':Sequelize[_0x3920('0x5')]},'extension':{'type':Sequelize[_0x3920('0x5')]}}; \ No newline at end of file +var _0x8f2d=['attended','STRING','sequelize','moment','ENUM'];(function(_0x1a4138,_0x5be5a2){var _0x3f8f8e=function(_0x5ec154){while(--_0x5ec154){_0x1a4138['push'](_0x1a4138['shift']());}};_0x3f8f8e(++_0x5be5a2);}(_0x8f2d,0xd9));var _0xd8f2=function(_0x4486a2,_0x47f1f3){_0x4486a2=_0x4486a2-0x0;var _0x242b6d=_0x8f2d[_0x4486a2];return _0x242b6d;};'use strict';var Sequelize=require(_0xd8f2('0x0'));var moment=require(_0xd8f2('0x1'));module['exports']={'type':{'type':Sequelize[_0xd8f2('0x2')]('blind',_0xd8f2('0x3'))},'result':{'type':Sequelize[_0xd8f2('0x4')]},'transfererchannel':{'type':Sequelize[_0xd8f2('0x4')]},'transferercalleridnum':{'type':Sequelize[_0xd8f2('0x4')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0xd8f2('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0xd8f2('0x4')]},'transfereraccountcode':{'type':Sequelize[_0xd8f2('0x4')]},'transferercontext':{'type':Sequelize[_0xd8f2('0x4')]},'transfererexten':{'type':Sequelize[_0xd8f2('0x4')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0xd8f2('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0xd8f2('0x4')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0xd8f2('0x4')]},'transfereeexten':{'type':Sequelize[_0xd8f2('0x4')]},'transfereelinkedid':{'type':Sequelize[_0xd8f2('0x4')]},'isexternal':{'type':Sequelize['ENUM']('Yes','No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 1e0aba2..fe8f9ea 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 _0x3f31=['filter','merge','VIRTUAL','VoiceTransferReport','includeAll','include','rows','show','params','keys','rawAttributes','length','options','find','create','catch','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','end','json','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick'];(function(_0xe472be,_0x358281){var _0x15792a=function(_0x3703f1){while(--_0x3703f1){_0xe472be['push'](_0xe472be['shift']());}};_0x15792a(++_0x358281);}(_0x3f31,0x136));var _0x13f3=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x3f31[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require(_0x13f3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x13f3('0x1'));var jsonpatch=require(_0x13f3('0x2'));var rp=require(_0x13f3('0x3'));var moment=require(_0x13f3('0x4'));var BPromise=require(_0x13f3('0x5'));var Mustache=require(_0x13f3('0x6'));var util=require(_0x13f3('0x7'));var path=require('path');var sox=require(_0x13f3('0x8'));var csv=require(_0x13f3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x13f3('0xa'));var _=require(_0x13f3('0xb'));var squel=require('squel');var crypto=require(_0x13f3('0xc'));var jsforce=require(_0x13f3('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x13f3('0xe'));var Redis=require('ioredis');var authService=require(_0x13f3('0xf'));var qs=require(_0x13f3('0x10'));var as=require(_0x13f3('0x11'));var hardwareService=require(_0x13f3('0x12'));var logger=require('../../config/logger')(_0x13f3('0x13'));var utils=require('../../config/utils');var config=require(_0x13f3('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x13f3('0x15'))['db'];function respondWithStatusCode(_0x3dfec1,_0x210789){_0x210789=_0x210789||0xcc;return function(_0x976508){if(_0x976508){return _0x3dfec1['sendStatus'](_0x210789);}return _0x3dfec1[_0x13f3('0x16')](_0x210789)[_0x13f3('0x17')]();};}function respondWithResult(_0x486020,_0x1afb6c){_0x1afb6c=_0x1afb6c||0xc8;return function(_0x423501){if(_0x423501){return _0x486020[_0x13f3('0x16')](_0x1afb6c)[_0x13f3('0x18')](_0x423501);}};}function respondWithFilteredResult(_0x1e5894,_0xd605dc){return function(_0x318925){if(_0x318925){var _0x3502f3=typeof _0xd605dc['offset']===_0x13f3('0x19')&&typeof _0xd605dc[_0x13f3('0x1a')]===_0x13f3('0x19');var _0x261464=_0x318925[_0x13f3('0x1b')];var _0xce8f0e=_0x3502f3?0x0:_0xd605dc['offset'];var _0xe3aa53=_0x3502f3?_0x318925[_0x13f3('0x1b')]:_0xd605dc['offset']+_0xd605dc[_0x13f3('0x1a')];var _0x1cf812;if(_0xe3aa53>=_0x261464){_0xe3aa53=_0x261464;_0x1cf812=0xc8;}else{_0x1cf812=0xce;}_0x1e5894[_0x13f3('0x16')](_0x1cf812);return _0x1e5894['set'](_0x13f3('0x1c'),_0xce8f0e+'-'+_0xe3aa53+'/'+_0x261464)[_0x13f3('0x18')](_0x318925);}return null;};}function patchUpdates(_0x263eb4){return function(_0x3bb174){try{jsonpatch[_0x13f3('0x1d')](_0x3bb174,_0x263eb4,!![]);}catch(_0x3de86a){return BPromise[_0x13f3('0x1e')](_0x3de86a);}return _0x3bb174[_0x13f3('0x1f')]();};}function saveUpdates(_0x1558b3,_0x11ec1a){return function(_0xb2f6cc){if(_0xb2f6cc){return _0xb2f6cc[_0x13f3('0x20')](_0x1558b3)[_0x13f3('0x21')](function(_0x263ba8){return _0x263ba8;});}return null;};}function removeEntity(_0x397615,_0x13cb01){return function(_0xa0c406){if(_0xa0c406){return _0xa0c406[_0x13f3('0x22')]()[_0x13f3('0x21')](function(){_0x397615[_0x13f3('0x16')](0xcc)[_0x13f3('0x17')]();});}};}function handleEntityNotFound(_0x542319,_0x143291){return function(_0x407bc5){if(!_0x407bc5){_0x542319[_0x13f3('0x23')](0x194);}return _0x407bc5;};}function handleError(_0x2ff0a9,_0x317eec){_0x317eec=_0x317eec||0x1f4;return function(_0x545819){logger['error'](_0x545819[_0x13f3('0x24')]);if(_0x545819[_0x13f3('0x25')]){delete _0x545819['name'];}_0x2ff0a9[_0x13f3('0x16')](_0x317eec)[_0x13f3('0x26')](_0x545819);};}exports[_0x13f3('0x27')]=function(_0xc4f21d,_0x1fc585){var _0x5dd540={},_0x489f47={},_0x29904c={'count':0x0,'rows':[]};var _0x255079=_[_0x13f3('0x28')](db['VoiceTransferReport']['rawAttributes'],function(_0x554187){return{'name':_0x554187[_0x13f3('0x29')],'type':_0x554187[_0x13f3('0x2a')][_0x13f3('0x2b')]};});_0x489f47[_0x13f3('0x2c')]=_[_0x13f3('0x28')](_0x255079,_0x13f3('0x25'));_0x489f47[_0x13f3('0x2d')]=_['keys'](_0xc4f21d['query']);_0x489f47[_0x13f3('0x2e')]=_[_0x13f3('0x2f')](_0x489f47[_0x13f3('0x2c')],_0x489f47[_0x13f3('0x2d')]);_0x5dd540[_0x13f3('0x30')]=_['intersection'](_0x489f47[_0x13f3('0x2c')],qs['fields'](_0xc4f21d['query'][_0x13f3('0x31')]));_0x5dd540[_0x13f3('0x30')]=_0x5dd540['attributes']['length']?_0x5dd540['attributes']:_0x489f47[_0x13f3('0x2c')];if(!_0xc4f21d['query']['hasOwnProperty'](_0x13f3('0x32'))){_0x5dd540[_0x13f3('0x1a')]=qs[_0x13f3('0x1a')](_0xc4f21d['query'][_0x13f3('0x1a')]);_0x5dd540['offset']=qs['offset'](_0xc4f21d[_0x13f3('0x2d')]['offset']);}_0x5dd540[_0x13f3('0x33')]=qs[_0x13f3('0x34')](_0xc4f21d['query'][_0x13f3('0x34')]);_0x5dd540[_0x13f3('0x35')]=qs[_0x13f3('0x2e')](_[_0x13f3('0x36')](_0xc4f21d[_0x13f3('0x2d')],_0x489f47[_0x13f3('0x2e')]),_0x255079);if(_0xc4f21d[_0x13f3('0x2d')][_0x13f3('0x37')]){_0x5dd540[_0x13f3('0x35')]=_[_0x13f3('0x38')](_0x5dd540[_0x13f3('0x35')],{'$or':_[_0x13f3('0x28')](_0x255079,function(_0x4c4b46){if(_0x4c4b46['type']!==_0x13f3('0x39')){var _0x27de47={};_0x27de47[_0x4c4b46['name']]={'$like':'%'+_0xc4f21d['query'][_0x13f3('0x37')]+'%'};return _0x27de47;}})});}_0x5dd540=_['merge']({},_0x5dd540,_0xc4f21d['options']);var _0x1d2f8b={'where':_0x5dd540['where']};return db[_0x13f3('0x3a')][_0x13f3('0x1b')](_0x1d2f8b)[_0x13f3('0x21')](function(_0x42eef7){_0x29904c[_0x13f3('0x1b')]=_0x42eef7;if(_0xc4f21d[_0x13f3('0x2d')][_0x13f3('0x3b')]){_0x5dd540[_0x13f3('0x3c')]=[{'all':!![]}];}return db['VoiceTransferReport']['findAll'](_0x5dd540);})[_0x13f3('0x21')](function(_0x454996){_0x29904c[_0x13f3('0x3d')]=_0x454996;return _0x29904c;})[_0x13f3('0x21')](respondWithFilteredResult(_0x1fc585,_0x5dd540))['catch'](handleError(_0x1fc585,null));};exports[_0x13f3('0x3e')]=function(_0x498698,_0x333d2e){var _0x3dd091={'raw':!![],'where':{'id':_0x498698[_0x13f3('0x3f')]['id']}},_0x10e6a6={};_0x10e6a6[_0x13f3('0x2c')]=_[_0x13f3('0x40')](db['VoiceTransferReport'][_0x13f3('0x41')]);_0x10e6a6[_0x13f3('0x2d')]=_[_0x13f3('0x40')](_0x498698[_0x13f3('0x2d')]);_0x10e6a6['filters']=_[_0x13f3('0x2f')](_0x10e6a6[_0x13f3('0x2c')],_0x10e6a6[_0x13f3('0x2d')]);_0x3dd091[_0x13f3('0x30')]=_[_0x13f3('0x2f')](_0x10e6a6[_0x13f3('0x2c')],qs[_0x13f3('0x31')](_0x498698['query'][_0x13f3('0x31')]));_0x3dd091[_0x13f3('0x30')]=_0x3dd091['attributes'][_0x13f3('0x42')]?_0x3dd091[_0x13f3('0x30')]:_0x10e6a6[_0x13f3('0x2c')];if(_0x498698[_0x13f3('0x2d')][_0x13f3('0x3b')]){_0x3dd091[_0x13f3('0x3c')]=[{'all':!![]}];}_0x3dd091=_['merge']({},_0x3dd091,_0x498698[_0x13f3('0x43')]);return db['VoiceTransferReport'][_0x13f3('0x44')](_0x3dd091)[_0x13f3('0x21')](handleEntityNotFound(_0x333d2e,null))[_0x13f3('0x21')](respondWithResult(_0x333d2e,null))['catch'](handleError(_0x333d2e,null));};exports[_0x13f3('0x45')]=function(_0x496955,_0x326591){return db[_0x13f3('0x3a')][_0x13f3('0x45')](_0x496955['body'],{})[_0x13f3('0x21')](respondWithResult(_0x326591,0xc9))[_0x13f3('0x46')](handleError(_0x326591,null));};exports['update']=function(_0x1dcb9d,_0x3186a8){if(_0x1dcb9d[_0x13f3('0x47')]['id']){delete _0x1dcb9d[_0x13f3('0x47')]['id'];}return db['VoiceTransferReport'][_0x13f3('0x44')]({'where':{'id':_0x1dcb9d['params']['id']}})[_0x13f3('0x21')](handleEntityNotFound(_0x3186a8,null))['then'](saveUpdates(_0x1dcb9d[_0x13f3('0x47')],null))['then'](respondWithResult(_0x3186a8,null))[_0x13f3('0x46')](handleError(_0x3186a8,null));};exports[_0x13f3('0x22')]=function(_0x324650,_0x3d4258){return db[_0x13f3('0x3a')][_0x13f3('0x44')]({'where':{'id':_0x324650[_0x13f3('0x3f')]['id']}})[_0x13f3('0x21')](handleEntityNotFound(_0x3d4258,null))[_0x13f3('0x21')](removeEntity(_0x3d4258,null))['catch'](handleError(_0x3d4258,null));};exports[_0x13f3('0x48')]=function(_0xde532a,_0x1ea7b5){return db[_0x13f3('0x3a')][_0x13f3('0x48')]()[_0x13f3('0x21')](respondWithResult(_0x1ea7b5,null))[_0x13f3('0x46')](handleError(_0x1ea7b5,null));}; \ No newline at end of file +var _0xbb63=['error','stack','name','send','index','VoiceTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','catch','show','params','keys','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','count','limit','set','apply','save','update','then','destroy','end','sendStatus'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xbb63,0xf9));var _0x3bb6=function(_0x2baa7a,_0x3f8e88){_0x2baa7a=_0x2baa7a-0x0;var _0x25bd96=_0xbb63[_0x2baa7a];return _0x25bd96;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3bb6('0x0'));var zipdir=require(_0x3bb6('0x1'));var jsonpatch=require(_0x3bb6('0x2'));var rp=require(_0x3bb6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3bb6('0x4'));var util=require('util');var path=require(_0x3bb6('0x5'));var sox=require(_0x3bb6('0x6'));var csv=require(_0x3bb6('0x7'));var ejs=require(_0x3bb6('0x8'));var fs=require('fs');var fs_extra=require(_0x3bb6('0x9'));var _=require(_0x3bb6('0xa'));var squel=require(_0x3bb6('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3bb6('0xc'));var toCsv=require(_0x3bb6('0x7'));var querystring=require('querystring');var Papa=require(_0x3bb6('0xd'));var Redis=require(_0x3bb6('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3bb6('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3bb6('0x10'));var logger=require(_0x3bb6('0x11'))('api');var utils=require(_0x3bb6('0x12'));var config=require(_0x3bb6('0x13'));var licenseUtil=require(_0x3bb6('0x14'));var db=require(_0x3bb6('0x15'))['db'];function respondWithStatusCode(_0x34db68,_0x53c196){_0x53c196=_0x53c196||0xcc;return function(_0x2db1f8){if(_0x2db1f8){return _0x34db68['sendStatus'](_0x53c196);}return _0x34db68[_0x3bb6('0x16')](_0x53c196)['end']();};}function respondWithResult(_0x1b868c,_0x556eb6){_0x556eb6=_0x556eb6||0xc8;return function(_0x2b263b){if(_0x2b263b){return _0x1b868c[_0x3bb6('0x16')](_0x556eb6)['json'](_0x2b263b);}};}function respondWithFilteredResult(_0x32cdb0,_0x1863f6){return function(_0x6c8706){if(_0x6c8706){var _0x5295de=typeof _0x1863f6[_0x3bb6('0x17')]===_0x3bb6('0x18')&&typeof _0x1863f6['limit']===_0x3bb6('0x18');var _0x55a7e8=_0x6c8706[_0x3bb6('0x19')];var _0x34f1e9=_0x5295de?0x0:_0x1863f6[_0x3bb6('0x17')];var _0x323974=_0x5295de?_0x6c8706[_0x3bb6('0x19')]:_0x1863f6[_0x3bb6('0x17')]+_0x1863f6[_0x3bb6('0x1a')];var _0x12aba6;if(_0x323974>=_0x55a7e8){_0x323974=_0x55a7e8;_0x12aba6=0xc8;}else{_0x12aba6=0xce;}_0x32cdb0[_0x3bb6('0x16')](_0x12aba6);return _0x32cdb0[_0x3bb6('0x1b')]('Content-Range',_0x34f1e9+'-'+_0x323974+'/'+_0x55a7e8)['json'](_0x6c8706);}return null;};}function patchUpdates(_0x71b4a4){return function(_0x1aeb87){try{jsonpatch[_0x3bb6('0x1c')](_0x1aeb87,_0x71b4a4,!![]);}catch(_0x1c3827){return BPromise['reject'](_0x1c3827);}return _0x1aeb87[_0x3bb6('0x1d')]();};}function saveUpdates(_0x4a6029,_0x3562ef){return function(_0x10474b){if(_0x10474b){return _0x10474b[_0x3bb6('0x1e')](_0x4a6029)[_0x3bb6('0x1f')](function(_0x57e7a4){return _0x57e7a4;});}return null;};}function removeEntity(_0x46fd74,_0x2370e2){return function(_0x17cee0){if(_0x17cee0){return _0x17cee0[_0x3bb6('0x20')]()[_0x3bb6('0x1f')](function(){_0x46fd74[_0x3bb6('0x16')](0xcc)[_0x3bb6('0x21')]();});}};}function handleEntityNotFound(_0x3d447e,_0x16f4c3){return function(_0x64a9ec){if(!_0x64a9ec){_0x3d447e[_0x3bb6('0x22')](0x194);}return _0x64a9ec;};}function handleError(_0x76203d,_0x2ea9ce){_0x2ea9ce=_0x2ea9ce||0x1f4;return function(_0xf566e1){logger[_0x3bb6('0x23')](_0xf566e1[_0x3bb6('0x24')]);if(_0xf566e1[_0x3bb6('0x25')]){delete _0xf566e1[_0x3bb6('0x25')];}_0x76203d[_0x3bb6('0x16')](_0x2ea9ce)[_0x3bb6('0x26')](_0xf566e1);};}exports[_0x3bb6('0x27')]=function(_0x2be2db,_0x4d3157){var _0x489676={},_0x2d5586={},_0x5dd7c0={'count':0x0,'rows':[]};var _0x5ecb51=_['map'](db[_0x3bb6('0x28')][_0x3bb6('0x29')],function(_0x55010d){return{'name':_0x55010d[_0x3bb6('0x2a')],'type':_0x55010d[_0x3bb6('0x2b')][_0x3bb6('0x2c')]};});_0x2d5586[_0x3bb6('0x2d')]=_['map'](_0x5ecb51,_0x3bb6('0x25'));_0x2d5586[_0x3bb6('0x2e')]=_['keys'](_0x2be2db[_0x3bb6('0x2e')]);_0x2d5586[_0x3bb6('0x2f')]=_[_0x3bb6('0x30')](_0x2d5586[_0x3bb6('0x2d')],_0x2d5586[_0x3bb6('0x2e')]);_0x489676[_0x3bb6('0x31')]=_[_0x3bb6('0x30')](_0x2d5586[_0x3bb6('0x2d')],qs[_0x3bb6('0x32')](_0x2be2db[_0x3bb6('0x2e')][_0x3bb6('0x32')]));_0x489676[_0x3bb6('0x31')]=_0x489676[_0x3bb6('0x31')][_0x3bb6('0x33')]?_0x489676['attributes']:_0x2d5586[_0x3bb6('0x2d')];if(!_0x2be2db[_0x3bb6('0x2e')][_0x3bb6('0x34')](_0x3bb6('0x35'))){_0x489676[_0x3bb6('0x1a')]=qs[_0x3bb6('0x1a')](_0x2be2db[_0x3bb6('0x2e')]['limit']);_0x489676[_0x3bb6('0x17')]=qs[_0x3bb6('0x17')](_0x2be2db[_0x3bb6('0x2e')][_0x3bb6('0x17')]);}_0x489676[_0x3bb6('0x36')]=qs[_0x3bb6('0x37')](_0x2be2db['query'][_0x3bb6('0x37')]);_0x489676[_0x3bb6('0x38')]=qs[_0x3bb6('0x2f')](_[_0x3bb6('0x39')](_0x2be2db[_0x3bb6('0x2e')],_0x2d5586[_0x3bb6('0x2f')]),_0x5ecb51);if(_0x2be2db[_0x3bb6('0x2e')][_0x3bb6('0x3a')]){_0x489676[_0x3bb6('0x38')]=_[_0x3bb6('0x3b')](_0x489676['where'],{'$or':_['map'](_0x5ecb51,function(_0x29d49e){if(_0x29d49e['type']!=='VIRTUAL'){var _0x1c702f={};_0x1c702f[_0x29d49e[_0x3bb6('0x25')]]={'$like':'%'+_0x2be2db['query']['filter']+'%'};return _0x1c702f;}})});}_0x489676=_['merge']({},_0x489676,_0x2be2db[_0x3bb6('0x3c')]);var _0xe5ca38={'where':_0x489676[_0x3bb6('0x38')]};return db[_0x3bb6('0x28')][_0x3bb6('0x19')](_0xe5ca38)[_0x3bb6('0x1f')](function(_0x2dbeb4){_0x5dd7c0[_0x3bb6('0x19')]=_0x2dbeb4;if(_0x2be2db[_0x3bb6('0x2e')][_0x3bb6('0x3d')]){_0x489676[_0x3bb6('0x3e')]=[{'all':!![]}];}return db['VoiceTransferReport']['findAll'](_0x489676);})[_0x3bb6('0x1f')](function(_0x1beb7d){_0x5dd7c0['rows']=_0x1beb7d;return _0x5dd7c0;})[_0x3bb6('0x1f')](respondWithFilteredResult(_0x4d3157,_0x489676))[_0x3bb6('0x3f')](handleError(_0x4d3157,null));};exports[_0x3bb6('0x40')]=function(_0x53c1c4,_0x101bea){var _0x3ff541={'raw':!![],'where':{'id':_0x53c1c4[_0x3bb6('0x41')]['id']}},_0x5e2ff4={};_0x5e2ff4[_0x3bb6('0x2d')]=_['keys'](db[_0x3bb6('0x28')][_0x3bb6('0x29')]);_0x5e2ff4['query']=_[_0x3bb6('0x42')](_0x53c1c4['query']);_0x5e2ff4[_0x3bb6('0x2f')]=_[_0x3bb6('0x30')](_0x5e2ff4[_0x3bb6('0x2d')],_0x5e2ff4[_0x3bb6('0x2e')]);_0x3ff541[_0x3bb6('0x31')]=_[_0x3bb6('0x30')](_0x5e2ff4['model'],qs[_0x3bb6('0x32')](_0x53c1c4[_0x3bb6('0x2e')][_0x3bb6('0x32')]));_0x3ff541[_0x3bb6('0x31')]=_0x3ff541[_0x3bb6('0x31')][_0x3bb6('0x33')]?_0x3ff541[_0x3bb6('0x31')]:_0x5e2ff4[_0x3bb6('0x2d')];if(_0x53c1c4[_0x3bb6('0x2e')]['includeAll']){_0x3ff541[_0x3bb6('0x3e')]=[{'all':!![]}];}_0x3ff541=_[_0x3bb6('0x3b')]({},_0x3ff541,_0x53c1c4['options']);return db[_0x3bb6('0x28')][_0x3bb6('0x43')](_0x3ff541)['then'](handleEntityNotFound(_0x101bea,null))[_0x3bb6('0x1f')](respondWithResult(_0x101bea,null))['catch'](handleError(_0x101bea,null));};exports['create']=function(_0x259976,_0x2fa829){return db[_0x3bb6('0x28')][_0x3bb6('0x44')](_0x259976[_0x3bb6('0x45')],{})[_0x3bb6('0x1f')](respondWithResult(_0x2fa829,0xc9))[_0x3bb6('0x3f')](handleError(_0x2fa829,null));};exports[_0x3bb6('0x1e')]=function(_0x579b40,_0x38597b){if(_0x579b40[_0x3bb6('0x45')]['id']){delete _0x579b40[_0x3bb6('0x45')]['id'];}return db[_0x3bb6('0x28')]['find']({'where':{'id':_0x579b40[_0x3bb6('0x41')]['id']}})[_0x3bb6('0x1f')](handleEntityNotFound(_0x38597b,null))['then'](saveUpdates(_0x579b40[_0x3bb6('0x45')],null))['then'](respondWithResult(_0x38597b,null))['catch'](handleError(_0x38597b,null));};exports[_0x3bb6('0x20')]=function(_0x1551eb,_0x97a1e1){return db[_0x3bb6('0x28')]['find']({'where':{'id':_0x1551eb[_0x3bb6('0x41')]['id']}})[_0x3bb6('0x1f')](handleEntityNotFound(_0x97a1e1,null))['then'](removeEntity(_0x97a1e1,null))[_0x3bb6('0x3f')](handleError(_0x97a1e1,null));};exports[_0x3bb6('0x46')]=function(_0x5dc12c,_0x656a35){return db[_0x3bb6('0x28')]['describe']()[_0x3bb6('0x1f')](respondWithResult(_0x656a35,null))[_0x3bb6('0x3f')](handleError(_0x656a35,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index e67a25e..d47054f 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 _0x1f45=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','util'];(function(_0x24c8fa,_0x1e9b54){var _0x190c9a=function(_0x25f8cb){while(--_0x25f8cb){_0x24c8fa['push'](_0x24c8fa['shift']());}};_0x190c9a(++_0x1e9b54);}(_0x1f45,0x1df));var _0x51f4=function(_0x343563,_0x1ded46){_0x343563=_0x343563-0x0;var _0x26ab2d=_0x1f45[_0x343563];return _0x26ab2d;};'use strict';var _=require('lodash');var util=require(_0x51f4('0x0'));var logger=require(_0x51f4('0x1'))(_0x51f4('0x2'));var moment=require(_0x51f4('0x3'));var BPromise=require(_0x51f4('0x4'));var rp=require(_0x51f4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x51f4('0x6'));var attributes=require(_0x51f4('0x7'));module[_0x51f4('0x8')]=function(_0x4299a4,_0x5b73a3){return _0x4299a4[_0x51f4('0x9')](_0x51f4('0xa'),attributes,{'tableName':_0x51f4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e16=['exports','define','report_call_transfer','lodash','util','api','moment','bluebird','request-promise','../../config/environment','./voiceTransferReport.attributes'];(function(_0x45d51f,_0x1b60e5){var _0x9afa32=function(_0x284dda){while(--_0x284dda){_0x45d51f['push'](_0x45d51f['shift']());}};_0x9afa32(++_0x1b60e5);}(_0x0e16,0x1b0));var _0x60e1=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x0e16[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x60e1('0x0'));var util=require(_0x60e1('0x1'));var logger=require('../../config/logger')(_0x60e1('0x2'));var moment=require(_0x60e1('0x3'));var BPromise=require(_0x60e1('0x4'));var rp=require(_0x60e1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x60e1('0x6'));var attributes=require(_0x60e1('0x7'));module[_0x60e1('0x8')]=function(_0x15118c,_0x47757a){return _0x15118c[_0x60e1('0x9')]('VoiceTransferReport',attributes,{'tableName':_0x60e1('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 c8dd3b5..e9bca84 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 _0x0881=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','CreateVoiceTransferReport','VoiceTransferReport','create','body','raw','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x19e38e,_0xb15cc7){var _0x14bec3=function(_0xd38dd3){while(--_0xd38dd3){_0x19e38e['push'](_0x19e38e['shift']());}};_0x14bec3(++_0xb15cc7);}(_0x0881,0x107));var _0x1088=function(_0x5e8b4d,_0x4e5ba1){_0x5e8b4d=_0x5e8b4d-0x0;var _0x5d0091=_0x0881[_0x5e8b4d];return _0x5d0091;};'use strict';var _=require(_0x1088('0x0'));var util=require(_0x1088('0x1'));var moment=require(_0x1088('0x2'));var BPromise=require(_0x1088('0x3'));var rs=require(_0x1088('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1088('0x5'))['db'];var utils=require(_0x1088('0x6'));var logger=require(_0x1088('0x7'))(_0x1088('0x8'));var config=require(_0x1088('0x9'));var jayson=require(_0x1088('0xa'));var client=jayson[_0x1088('0xb')][_0x1088('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x39a44b,_0x9383eb,_0x49b7ce){return new BPromise(function(_0x1981df,_0x55cd25){return client[_0x1088('0xd')](_0x39a44b,_0x49b7ce)[_0x1088('0xe')](function(_0x2a408d){logger['info'](_0x1088('0xf'),_0x9383eb,_0x1088('0x10'));logger[_0x1088('0x11')](_0x1088('0x12'),_0x9383eb,_0x1088('0x10'),JSON[_0x1088('0x13')](_0x2a408d));if(_0x2a408d[_0x1088('0x14')]){if(_0x2a408d[_0x1088('0x14')]['code']===0x1f4){logger['error'](_0x1088('0xf'),_0x9383eb,_0x2a408d[_0x1088('0x14')][_0x1088('0x15')]);return _0x55cd25(_0x2a408d[_0x1088('0x14')][_0x1088('0x15')]);}logger[_0x1088('0x14')](_0x1088('0xf'),_0x9383eb,_0x2a408d[_0x1088('0x14')][_0x1088('0x15')]);return _0x1981df(_0x2a408d[_0x1088('0x14')]['message']);}else{logger[_0x1088('0x16')]('VoiceTransferReport,\x20%s,\x20%s',_0x9383eb,_0x1088('0x10'));_0x1981df(_0x2a408d[_0x1088('0x17')][_0x1088('0x15')]);}})['catch'](function(_0x5afcf4){logger[_0x1088('0x14')](_0x1088('0xf'),_0x9383eb,_0x5afcf4);_0x55cd25(_0x5afcf4);});});}exports[_0x1088('0x18')]=function(_0x327fc2){var _0x18966c=this;return new Promise(function(_0x803a61,_0x6686b5){return db[_0x1088('0x19')][_0x1088('0x1a')](_0x327fc2[_0x1088('0x1b')],{'raw':_0x327fc2['options']?_0x327fc2['options'][_0x1088('0x1c')]===undefined?!![]:![]:!![]})[_0x1088('0xe')](function(_0x1d8bd0){logger[_0x1088('0x16')](_0x1088('0x18'),_0x327fc2);logger[_0x1088('0x11')](_0x1088('0x18'),_0x327fc2,JSON['stringify'](_0x1d8bd0));_0x803a61(_0x1d8bd0);})[_0x1088('0x1d')](function(_0x4f1d0d){logger[_0x1088('0x14')](_0x1088('0x18'),_0x4f1d0d['message'],_0x327fc2);_0x6686b5(_0x18966c['error'](0x1f4,_0x4f1d0d[_0x1088('0x15')]));});});}; \ No newline at end of file +var _0x5280=['info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','options','raw','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x157002,_0x5805ee){var _0x4aa780=function(_0x137eb4){while(--_0x137eb4){_0x157002['push'](_0x157002['shift']());}};_0x4aa780(++_0x5805ee);}(_0x5280,0xdb));var _0x0528=function(_0x2f52d1,_0x36e3b1){_0x2f52d1=_0x2f52d1-0x0;var _0x3f9871=_0x5280[_0x2f52d1];return _0x3f9871;};'use strict';var _=require(_0x0528('0x0'));var util=require(_0x0528('0x1'));var moment=require(_0x0528('0x2'));var BPromise=require(_0x0528('0x3'));var rs=require(_0x0528('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0528('0x5'));var logger=require(_0x0528('0x6'))(_0x0528('0x7'));var config=require(_0x0528('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0528('0x9')][_0x0528('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59ce84,_0x4ef009,_0x17837d){return new BPromise(function(_0x2b064f,_0x4daeab){return client[_0x0528('0xb')](_0x59ce84,_0x17837d)[_0x0528('0xc')](function(_0x237a30){logger[_0x0528('0xd')](_0x0528('0xe'),_0x4ef009,_0x0528('0xf'));logger[_0x0528('0x10')](_0x0528('0x11'),_0x4ef009,_0x0528('0xf'),JSON[_0x0528('0x12')](_0x237a30));if(_0x237a30[_0x0528('0x13')]){if(_0x237a30['error'][_0x0528('0x14')]===0x1f4){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x4ef009,_0x237a30[_0x0528('0x13')][_0x0528('0x15')]);return _0x4daeab(_0x237a30['error'][_0x0528('0x15')]);}logger['error'](_0x0528('0xe'),_0x4ef009,_0x237a30[_0x0528('0x13')][_0x0528('0x15')]);return _0x2b064f(_0x237a30[_0x0528('0x13')][_0x0528('0x15')]);}else{logger[_0x0528('0xd')](_0x0528('0xe'),_0x4ef009,_0x0528('0xf'));_0x2b064f(_0x237a30[_0x0528('0x16')][_0x0528('0x15')]);}})[_0x0528('0x17')](function(_0x237e6f){logger[_0x0528('0x13')](_0x0528('0xe'),_0x4ef009,_0x237e6f);_0x4daeab(_0x237e6f);});});}exports[_0x0528('0x18')]=function(_0xcb3b0c){var _0x24c55=this;return new Promise(function(_0x4bfef0,_0x4a1b1e){return db[_0x0528('0x19')][_0x0528('0x1a')](_0xcb3b0c['body'],{'raw':_0xcb3b0c[_0x0528('0x1b')]?_0xcb3b0c[_0x0528('0x1b')][_0x0528('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x4db5d3){logger[_0x0528('0xd')](_0x0528('0x18'),_0xcb3b0c);logger['debug'](_0x0528('0x18'),_0xcb3b0c,JSON[_0x0528('0x12')](_0x4db5d3));_0x4bfef0(_0x4db5d3);})['catch'](function(_0x2b450e){logger['error'](_0x0528('0x18'),_0x2b450e[_0x0528('0x15')],_0xcb3b0c);_0x4a1b1e(_0x24c55['error'](0x1f4,_0x2b450e[_0x0528('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index f20cb63..9d59307 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 _0x7e4b=['/hangup','isAuthenticated','hangup','/answer','/hold','hold','/unhold','unhold','/calls','calls','transfer','exports','Router','../../components/auth/service','post','canUpdate'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x7e4b,0x11c));var _0xb7e4=function(_0x2600a2,_0x400678){_0x2600a2=_0x2600a2-0x0;var _0x510de7=_0x7e4b[_0x2600a2];return _0x510de7;};'use strict';var express=require('express');var router=express[_0xb7e4('0x0')]();var auth=require(_0xb7e4('0x1'));var controller=require('./webbar.controller');router[_0xb7e4('0x2')]('/originate',auth['isAuthenticated'](),auth[_0xb7e4('0x3')](),controller['originate']);router[_0xb7e4('0x2')](_0xb7e4('0x4'),auth[_0xb7e4('0x5')](),auth[_0xb7e4('0x3')](),controller[_0xb7e4('0x6')]);router['post'](_0xb7e4('0x7'),auth['isAuthenticated'](),auth['canUpdate'](),controller['answer']);router[_0xb7e4('0x2')](_0xb7e4('0x8'),auth[_0xb7e4('0x5')](),auth[_0xb7e4('0x3')](),controller[_0xb7e4('0x9')]);router[_0xb7e4('0x2')](_0xb7e4('0xa'),auth['isAuthenticated'](),auth[_0xb7e4('0x3')](),controller[_0xb7e4('0xb')]);router[_0xb7e4('0x2')](_0xb7e4('0xc'),auth[_0xb7e4('0x5')](),auth[_0xb7e4('0x3')](),controller[_0xb7e4('0xd')]);router[_0xb7e4('0x2')]('/transfer',auth['isAuthenticated'](),auth[_0xb7e4('0x3')](),controller[_0xb7e4('0xe')]);module[_0xb7e4('0xf')]=router; \ No newline at end of file +var _0x56cb=['isAuthenticated','canUpdate','originate','/hangup','hangup','/answer','answer','/hold','hold','unhold','/calls','/transfer','express','Router','../../components/auth/service','./webbar.controller','post'];(function(_0x5bb95a,_0x3d15d2){var _0x8a5f27=function(_0x537c56){while(--_0x537c56){_0x5bb95a['push'](_0x5bb95a['shift']());}};_0x8a5f27(++_0x3d15d2);}(_0x56cb,0x13e));var _0xb56c=function(_0x296144,_0x26bbbf){_0x296144=_0x296144-0x0;var _0x5329b1=_0x56cb[_0x296144];return _0x5329b1;};'use strict';var express=require(_0xb56c('0x0'));var router=express[_0xb56c('0x1')]();var auth=require(_0xb56c('0x2'));var controller=require(_0xb56c('0x3'));router[_0xb56c('0x4')]('/originate',auth[_0xb56c('0x5')](),auth[_0xb56c('0x6')](),controller[_0xb56c('0x7')]);router[_0xb56c('0x4')](_0xb56c('0x8'),auth[_0xb56c('0x5')](),auth[_0xb56c('0x6')](),controller[_0xb56c('0x9')]);router[_0xb56c('0x4')](_0xb56c('0xa'),auth[_0xb56c('0x5')](),auth[_0xb56c('0x6')](),controller[_0xb56c('0xb')]);router[_0xb56c('0x4')](_0xb56c('0xc'),auth[_0xb56c('0x5')](),auth[_0xb56c('0x6')](),controller[_0xb56c('0xd')]);router[_0xb56c('0x4')]('/unhold',auth['isAuthenticated'](),auth[_0xb56c('0x6')](),controller[_0xb56c('0xe')]);router[_0xb56c('0x4')](_0xb56c('0xf'),auth[_0xb56c('0x5')](),auth['canUpdate'](),controller['calls']);router[_0xb56c('0x4')](_0xb56c('0x10'),auth[_0xb56c('0x5')](),auth[_0xb56c('0x6')](),controller['transfer']);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 845cbad..a9f15e7 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 _0xfd28=['all','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','info','originate\x20fired:','body','json','callNumber','callbackUrl','entityFound:','format','webbar:originate','originate\x20executed!','hangup','user:%s','hangup\x20executed!','answer\x20fired:','userId','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','calls','calls\x20fired:','VoiceChannels','filter','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','webbar:transfer','transfer\x20executed!','lodash','../../mysqldb','util','jayson/promise','client','http','webbarapi','ioredis','redis','defaults','validate','number','string','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','stringify','emit','handleError:','error','stack','name','status','NotFound','then','code','message','result','catch','User','findOne','agent'];(function(_0x2445a6,_0x494d27){var _0x45c842=function(_0x1e8163){while(--_0x1e8163){_0x2445a6['push'](_0x2445a6['shift']());}};_0x45c842(++_0x494d27);}(_0xfd28,0x148));var _0x8fd2=function(_0x5f1cf8,_0x5e0923){_0x5f1cf8=_0x5f1cf8-0x0;var _0x27d0fa=_0xfd28[_0x5f1cf8];return _0x27d0fa;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x8fd2('0x0'));var db=require(_0x8fd2('0x1'))['db'];var config=require('../../config/environment');var util=require(_0x8fd2('0x2'));var BPromise=require('bluebird');var jayson=require(_0x8fd2('0x3'));var amiClient=jayson[_0x8fd2('0x4')][_0x8fd2('0x5')]({'port':0x232a});var logger=require('../../config/logger')(_0x8fd2('0x6'));var Redis=require(_0x8fd2('0x7'));config[_0x8fd2('0x8')]=_[_0x8fd2('0x9')](config[_0x8fd2('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8fd2('0x8')]));var Schema=require(_0x8fd2('0xa'));var originateValidation=new Schema({'userId':{'type':_0x8fd2('0xb'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x8fd2('0xc'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x8fd2('0xc')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0x8fd2('0xb'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x8fd2('0xc'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8fd2('0xd')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x8fd2('0xb'),'required':[!![],_0x8fd2('0xd')]},'sessionId':{'type':_0x8fd2('0xc'),'required':[!![],_0x8fd2('0xe')]},'transferNumber':{'type':_0x8fd2('0xc'),'required':[!![],_0x8fd2('0xf')]}});var holdValidation=new Schema({'userId':{'type':_0x8fd2('0xb'),'required':[!![],_0x8fd2('0xd')]},'sessionId':{'type':_0x8fd2('0xc'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x8fd2('0xb'),'required':[!![],_0x8fd2('0xd')]},'sessionId':{'type':_0x8fd2('0xc'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x8fd2('0xb'),'required':[!![],_0x8fd2('0xd')]}});var conferenceValidation=new Schema({'userId':{'type':_0x8fd2('0xb'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x20daca,_0x5ef478,_0x4f0b17){logger['info'](_0x20daca,_0x5ef478,JSON[_0x8fd2('0x10')](_0x4f0b17));io['to'](_0x20daca)[_0x8fd2('0x11')](_0x5ef478,_0x4f0b17);}function handleError(_0x1ced10){return function(_0x12e8a3){console['log'](_0x8fd2('0x12'),_0x12e8a3,_0x12e8a3 instanceof RangeError);logger[_0x8fd2('0x13')](_0x12e8a3[_0x8fd2('0x14')]);if(_0x12e8a3 instanceof RangeError){if(_0x12e8a3[_0x8fd2('0x15')]){delete _0x12e8a3[_0x8fd2('0x15')];}_0x1ced10['status'](0x194)['send'](_0x12e8a3);}else{if(_0x12e8a3[_0x8fd2('0x15')]){delete _0x12e8a3['name'];}_0x1ced10[_0x8fd2('0x16')](0x1f4)['send'](_0x12e8a3);}};}function checkError(){return function(_0x1631c6){if(!_0x1631c6){throw new RangeError(_0x8fd2('0x17'));}return _0x1631c6;};}function respondWithRpcPromise(_0x4f81dc,_0x122b60){return new BPromise(function(_0x4c2be8,_0xd3981f){var _0x44ee7a=amiClient;return _0x44ee7a['request'](_0x4f81dc,_0x122b60)[_0x8fd2('0x18')](function(_0x2a9c3c){if(_0x2a9c3c[_0x8fd2('0x13')]){if(_0x2a9c3c['error'][_0x8fd2('0x19')]===0x1f4){return _0xd3981f(_0x2a9c3c[_0x8fd2('0x13')][_0x8fd2('0x1a')]);}return _0x4c2be8(_0x2a9c3c[_0x8fd2('0x13')][_0x8fd2('0x1a')]);}else{_0x4c2be8(_0x2a9c3c[_0x8fd2('0x1b')]);}})[_0x8fd2('0x1c')](function(_0x398925){_0xd3981f(_0x398925);});});}function getAgent(_0x1456b4){return db[_0x8fd2('0x1d')][_0x8fd2('0x1e')]({'where':{'id':_0x1456b4,'role':_0x8fd2('0x1f')}})[_0x8fd2('0x18')](checkError());}function getAgentCheckSession(_0x512e5a,_0x4c6af7){return new BPromise(function(_0x345bc3,_0x1858a9){var _0x288bcd=respondWithRpcPromise('VoiceChannels');var _0x2f26ae=getAgent(_0x512e5a);Promise[_0x8fd2('0x20')]([_0x288bcd,_0x2f26ae])[_0x8fd2('0x18')](function(_0x960869){var _0x119439=_0x960869[0x0];var _0x4745bf=_0x960869[0x1];var _0x332ab0=_['filter'](_0x119439[_0x8fd2('0x21')],function(_0x13c9b9){return _0x13c9b9[_0x8fd2('0x22')]==_0x4745bf['id']&&_0x13c9b9[_0x8fd2('0x23')]==_0x4c6af7;});if(_0x332ab0[_0x8fd2('0x24')]==0x1){_0x345bc3(_0x4745bf);}else{_0x1858a9(new RangeError(_0x8fd2('0x25')+_0x4c6af7+_0x8fd2('0x26')));}});});}exports['originate']=function(_0x5b992a,_0x5144ba){logger[_0x8fd2('0x27')](_0x8fd2('0x28'),_0x5b992a[_0x8fd2('0x29')]);var _0xe4987b=originateValidation['validate'](_0x5b992a['body']);if(_0xe4987b[_0x8fd2('0x24')]>0x0){return _0x5144ba[_0x8fd2('0x16')](0x190)[_0x8fd2('0x2a')](_0xe4987b);}var _0x18fe4e=_0x5b992a[_0x8fd2('0x29')]['userId'];var _0x328964=_0x5b992a['body'][_0x8fd2('0x2b')];var _0x4ade8c=_0x5b992a[_0x8fd2('0x29')]['callerId'];var _0x134420=_0x5b992a[_0x8fd2('0x29')][_0x8fd2('0x2c')];return getAgent(_0x18fe4e)['then'](function(_0x339291){logger['info'](_0x8fd2('0x2d'),_0x339291[_0x8fd2('0x15')]);emit(util[_0x8fd2('0x2e')]('user:%s',_0x339291[_0x8fd2('0x15')]),_0x8fd2('0x2f'),{'callNumber':_0x328964,'callerId':_0x4ade8c,'callbackUrl':_0x134420});return _0x5144ba[_0x8fd2('0x16')](0xc8)['json']({'error':![],'message':_0x8fd2('0x30')});})[_0x8fd2('0x1c')](handleError(_0x5144ba));};exports[_0x8fd2('0x31')]=function(_0x4adfa2,_0x37a24b){logger[_0x8fd2('0x27')]('hangup\x20fired:',_0x4adfa2[_0x8fd2('0x29')]);var _0x130072=hangupValidation[_0x8fd2('0xa')](_0x4adfa2[_0x8fd2('0x29')]);if(_0x130072[_0x8fd2('0x24')]>0x0){return _0x37a24b[_0x8fd2('0x16')](0x190)[_0x8fd2('0x2a')](_0x130072);}var _0x5e6140=_0x4adfa2[_0x8fd2('0x29')]['userId'];var _0x566c9e=_0x4adfa2[_0x8fd2('0x29')][_0x8fd2('0x23')];return getAgent(_0x5e6140)[_0x8fd2('0x18')](function(_0x2edcfd){logger[_0x8fd2('0x27')](_0x8fd2('0x2d'),_0x2edcfd['name']);emit(util['format'](_0x8fd2('0x32'),_0x2edcfd['name']),'webbar:hangup',{'sessionId':_0x566c9e});return _0x37a24b[_0x8fd2('0x16')](0xc8)[_0x8fd2('0x2a')]({'error':![],'message':_0x8fd2('0x33')});})[_0x8fd2('0x1c')](handleError(_0x37a24b));};exports['answer']=function(_0x39cd8e,_0x1d5458){logger[_0x8fd2('0x27')](_0x8fd2('0x34'),_0x39cd8e[_0x8fd2('0x29')]);var _0x1de9aa=answerValidation[_0x8fd2('0xa')](_0x39cd8e['body']);if(_0x1de9aa[_0x8fd2('0x24')]>0x0){return _0x1d5458[_0x8fd2('0x16')](0x190)[_0x8fd2('0x2a')](_0x1de9aa);}var _0x70404e=_0x39cd8e[_0x8fd2('0x29')][_0x8fd2('0x35')];var _0x40a572=_0x39cd8e['body'][_0x8fd2('0x23')];return getAgent(_0x70404e)[_0x8fd2('0x18')](function(_0x2abd80){logger[_0x8fd2('0x27')](_0x8fd2('0x2d'),_0x2abd80[_0x8fd2('0x15')]);emit(util[_0x8fd2('0x2e')]('user:%s',_0x2abd80[_0x8fd2('0x15')]),'webbar:answer',{'sessionId':_0x40a572});return _0x1d5458[_0x8fd2('0x16')](0xc8)['json']({'error':![],'message':_0x8fd2('0x36')});})[_0x8fd2('0x1c')](handleError(_0x1d5458));};exports[_0x8fd2('0x37')]=function(_0x5c0632,_0x290467){logger[_0x8fd2('0x27')](_0x8fd2('0x38'),_0x5c0632['body']);var _0x3c65c4=holdValidation['validate'](_0x5c0632[_0x8fd2('0x29')]);if(_0x3c65c4[_0x8fd2('0x24')]>0x0){return _0x290467[_0x8fd2('0x16')](0x190)[_0x8fd2('0x2a')](_0x3c65c4);}var _0xc62e9e=_0x5c0632[_0x8fd2('0x29')][_0x8fd2('0x35')];var _0x34ffed=_0x5c0632[_0x8fd2('0x29')][_0x8fd2('0x23')];return getAgent(_0xc62e9e)[_0x8fd2('0x18')](function(_0x34f3a2){logger[_0x8fd2('0x27')](_0x8fd2('0x2d'),_0x34f3a2[_0x8fd2('0x15')]);emit(util[_0x8fd2('0x2e')](_0x8fd2('0x32'),_0x34f3a2[_0x8fd2('0x15')]),_0x8fd2('0x39'),{'sessionId':_0x34ffed});return _0x290467['status'](0xc8)['json']({'error':![],'message':_0x8fd2('0x3a')});})[_0x8fd2('0x1c')](handleError(_0x290467));};exports[_0x8fd2('0x3b')]=function(_0x5d79c3,_0x4d5b81){logger[_0x8fd2('0x27')]('unhold\x20fired:',_0x5d79c3[_0x8fd2('0x29')]);var _0x1295c4=unholdValidation[_0x8fd2('0xa')](_0x5d79c3['body']);if(_0x1295c4[_0x8fd2('0x24')]>0x0){return _0x4d5b81[_0x8fd2('0x16')](0x190)['json'](_0x1295c4);}var _0x331ada=_0x5d79c3[_0x8fd2('0x29')][_0x8fd2('0x35')];var _0x56050f=_0x5d79c3[_0x8fd2('0x29')][_0x8fd2('0x23')];return getAgent(_0x331ada)[_0x8fd2('0x18')](function(_0x2c5766){logger[_0x8fd2('0x27')](_0x8fd2('0x2d'),_0x2c5766['name']);emit(util['format'](_0x8fd2('0x32'),_0x2c5766[_0x8fd2('0x15')]),'webbar:unhold',{'sessionId':_0x56050f});return _0x4d5b81[_0x8fd2('0x16')](0xc8)['json']({'error':![],'message':'unhold\x20executed!'});})[_0x8fd2('0x1c')](handleError(_0x4d5b81));};exports[_0x8fd2('0x3c')]=function(_0x337354,_0x29a00e){logger[_0x8fd2('0x27')](_0x8fd2('0x3d'),_0x29a00e['body']);var _0x2f4759=callsValidation[_0x8fd2('0xa')](_0x337354[_0x8fd2('0x29')]);if(_0x2f4759[_0x8fd2('0x24')]>0x0){return _0x29a00e[_0x8fd2('0x16')](0x190)['json'](_0x2f4759);}var _0x5cf641=_0x337354['body']['userId'];var _0x57b8f6=respondWithRpcPromise(_0x8fd2('0x3e'));var _0x382154=getAgent(_0x5cf641);return Promise[_0x8fd2('0x20')]([_0x57b8f6,_0x382154])[_0x8fd2('0x18')](function(_0x21696c){var _0x25abdc=_0x21696c[0x0];var _0x460f31=_0x21696c[0x1];var _0x4a81ab=_[_0x8fd2('0x3f')](_0x25abdc['rows'],function(_0x351cfe){return _0x351cfe[_0x8fd2('0x22')]==_0x460f31['id'];});return _0x29a00e['status'](0xc8)['json']({'count':_0x4a81ab[_0x8fd2('0x24')],'rows':_0x4a81ab});})[_0x8fd2('0x1c')](handleError(_0x29a00e));};exports[_0x8fd2('0x40')]=function(_0x30a952,_0x37ddfa){logger['info'](_0x8fd2('0x41'),_0x30a952[_0x8fd2('0x29')]);var _0x1b46d6=conferenceValidation[_0x8fd2('0xa')](_0x30a952['body']);if(_0x1b46d6[_0x8fd2('0x24')]>0x0){return _0x37ddfa[_0x8fd2('0x16')](0x190)[_0x8fd2('0x2a')](_0x1b46d6);}var _0x23c608=_0x30a952['body']['userId'];return getAgent(_0x23c608)['then'](function(_0x2e5693){logger[_0x8fd2('0x27')](_0x8fd2('0x2d'),_0x2e5693[_0x8fd2('0x15')]);emit(util[_0x8fd2('0x2e')]('user:%s',_0x2e5693[_0x8fd2('0x15')]),_0x8fd2('0x42'));return _0x37ddfa['status'](0xc8)[_0x8fd2('0x2a')]({'error':![],'message':_0x8fd2('0x43')});})[_0x8fd2('0x1c')](handleError(_0x37ddfa));};exports[_0x8fd2('0x44')]=function(_0x305d83,_0x5547c7){logger[_0x8fd2('0x27')](_0x8fd2('0x45'),_0x305d83[_0x8fd2('0x29')]);var _0x4606f7=transferValidation[_0x8fd2('0xa')](_0x305d83[_0x8fd2('0x29')]);if(_0x4606f7[_0x8fd2('0x24')]>0x0){return _0x5547c7[_0x8fd2('0x16')](0x190)[_0x8fd2('0x2a')](_0x4606f7);}var _0x4680f0=_0x305d83[_0x8fd2('0x29')][_0x8fd2('0x35')];var _0x40ffd5=_0x305d83['body'][_0x8fd2('0x23')];var _0x237756=_0x305d83['body']['transferNumber'];return getAgent(_0x4680f0)['then'](function(_0x2bd1d0){logger[_0x8fd2('0x27')](_0x8fd2('0x2d'),_0x2bd1d0[_0x8fd2('0x15')]);emit(util[_0x8fd2('0x2e')](_0x8fd2('0x32'),_0x2bd1d0['name']),_0x8fd2('0x46'),{'sessionId':_0x40ffd5,'transferNumber':_0x237756});return _0x5547c7[_0x8fd2('0x16')](0xc8)['json']({'error':![],'message':_0x8fd2('0x47')});})['catch'](handleError(_0x5547c7));}; \ No newline at end of file +var _0xe812=['webbar:originate','hangup','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer\x20fired:','entityFound:','hold','hold\x20fired:','hold\x20executed!','unhold','unhold\x20fired:','calls','calls\x20fired:','all','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transfer\x20executed!','lodash','../../mysqldb','bluebird','jayson/promise','http','../../config/logger','ioredis','redis','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','transferNumber\x20is\x20required','info','emit','log','handleError:','error','stack','name','status','send','NotFound','then','code','message','catch','User','findOne','agent','VoiceChannels','filter','rows','UserId','sessionId','length','sessionId\x20','originate','originate\x20fired:','body','json','userId','format','user:%s'];(function(_0x23f616,_0x28cb5e){var _0x328dee=function(_0x5f5203){while(--_0x5f5203){_0x23f616['push'](_0x23f616['shift']());}};_0x328dee(++_0x28cb5e);}(_0xe812,0x1f2));var _0x2e81=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe812[_0x3dd15e];return _0x231fd0;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x2e81('0x0'));var db=require(_0x2e81('0x1'))['db'];var config=require('../../config/environment');var util=require('util');var BPromise=require(_0x2e81('0x2'));var jayson=require(_0x2e81('0x3'));var amiClient=jayson['client'][_0x2e81('0x4')]({'port':0x232a});var logger=require(_0x2e81('0x5'))('webbarapi');var Redis=require(_0x2e81('0x6'));config[_0x2e81('0x7')]=_['defaults'](config[_0x2e81('0x7')],{'host':_0x2e81('0x8'),'port':0x18eb});var io=require(_0x2e81('0x9'))(new Redis(config['redis']));var Schema=require(_0x2e81('0xa'));var originateValidation=new Schema({'userId':{'type':_0x2e81('0xb'),'required':[!![],_0x2e81('0xc')]},'callNumber':{'type':_0x2e81('0xd'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x2e81('0xd')},'callbackUrl':{'type':_0x2e81('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0x2e81('0xb'),'required':[!![],_0x2e81('0xc')]},'sessionId':{'type':_0x2e81('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x2e81('0xb'),'required':[!![],_0x2e81('0xc')]},'sessionId':{'type':_0x2e81('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x2e81('0xb'),'required':[!![],_0x2e81('0xc')]},'sessionId':{'type':_0x2e81('0xd'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x2e81('0xd'),'required':[!![],_0x2e81('0xe')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x2e81('0xc')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x2e81('0xb'),'required':[!![],_0x2e81('0xc')]},'sessionId':{'type':_0x2e81('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x2e81('0xb'),'required':[!![],_0x2e81('0xc')]}});var conferenceValidation=new Schema({'userId':{'type':_0x2e81('0xb'),'required':[!![],'userId\x20is\x20required']}});function emit(_0xc4d315,_0x258749,_0x52b5e4){logger[_0x2e81('0xf')](_0xc4d315,_0x258749,JSON['stringify'](_0x52b5e4));io['to'](_0xc4d315)[_0x2e81('0x10')](_0x258749,_0x52b5e4);}function handleError(_0xaa8034){return function(_0x4c1b11){console[_0x2e81('0x11')](_0x2e81('0x12'),_0x4c1b11,_0x4c1b11 instanceof RangeError);logger[_0x2e81('0x13')](_0x4c1b11[_0x2e81('0x14')]);if(_0x4c1b11 instanceof RangeError){if(_0x4c1b11[_0x2e81('0x15')]){delete _0x4c1b11[_0x2e81('0x15')];}_0xaa8034[_0x2e81('0x16')](0x194)[_0x2e81('0x17')](_0x4c1b11);}else{if(_0x4c1b11[_0x2e81('0x15')]){delete _0x4c1b11[_0x2e81('0x15')];}_0xaa8034['status'](0x1f4)[_0x2e81('0x17')](_0x4c1b11);}};}function checkError(){return function(_0x23957a){if(!_0x23957a){throw new RangeError(_0x2e81('0x18'));}return _0x23957a;};}function respondWithRpcPromise(_0x65be57,_0x11daeb){return new BPromise(function(_0x386721,_0x18b9be){var _0x39ffa8=amiClient;return _0x39ffa8['request'](_0x65be57,_0x11daeb)[_0x2e81('0x19')](function(_0x49e9f1){if(_0x49e9f1[_0x2e81('0x13')]){if(_0x49e9f1['error'][_0x2e81('0x1a')]===0x1f4){return _0x18b9be(_0x49e9f1['error']['message']);}return _0x386721(_0x49e9f1[_0x2e81('0x13')][_0x2e81('0x1b')]);}else{_0x386721(_0x49e9f1['result']);}})[_0x2e81('0x1c')](function(_0x19b1a9){_0x18b9be(_0x19b1a9);});});}function getAgent(_0x1c4547){return db[_0x2e81('0x1d')][_0x2e81('0x1e')]({'where':{'id':_0x1c4547,'role':_0x2e81('0x1f')}})[_0x2e81('0x19')](checkError());}function getAgentCheckSession(_0x4669aa,_0x1b34db){return new BPromise(function(_0x1bf5a6,_0x3c0066){var _0xc0720f=respondWithRpcPromise(_0x2e81('0x20'));var _0x3ec91d=getAgent(_0x4669aa);Promise['all']([_0xc0720f,_0x3ec91d])['then'](function(_0xfc7ce3){var _0x38cbc2=_0xfc7ce3[0x0];var _0x20ef21=_0xfc7ce3[0x1];var _0x1eb8f6=_[_0x2e81('0x21')](_0x38cbc2[_0x2e81('0x22')],function(_0x243b20){return _0x243b20[_0x2e81('0x23')]==_0x20ef21['id']&&_0x243b20[_0x2e81('0x24')]==_0x1b34db;});if(_0x1eb8f6[_0x2e81('0x25')]==0x1){_0x1bf5a6(_0x20ef21);}else{_0x3c0066(new RangeError(_0x2e81('0x26')+_0x1b34db+'\x20not\x20found!'));}});});}exports[_0x2e81('0x27')]=function(_0x115b08,_0x1d0437){logger[_0x2e81('0xf')](_0x2e81('0x28'),_0x115b08[_0x2e81('0x29')]);var _0x2fad97=originateValidation[_0x2e81('0xa')](_0x115b08[_0x2e81('0x29')]);if(_0x2fad97[_0x2e81('0x25')]>0x0){return _0x1d0437[_0x2e81('0x16')](0x190)[_0x2e81('0x2a')](_0x2fad97);}var _0x1c24f1=_0x115b08[_0x2e81('0x29')][_0x2e81('0x2b')];var _0x1be530=_0x115b08[_0x2e81('0x29')]['callNumber'];var _0x371e5d=_0x115b08[_0x2e81('0x29')]['callerId'];var _0x215d57=_0x115b08[_0x2e81('0x29')]['callbackUrl'];return getAgent(_0x1c24f1)[_0x2e81('0x19')](function(_0x36ccb7){logger[_0x2e81('0xf')]('entityFound:',_0x36ccb7[_0x2e81('0x15')]);emit(util[_0x2e81('0x2c')](_0x2e81('0x2d'),_0x36ccb7[_0x2e81('0x15')]),_0x2e81('0x2e'),{'callNumber':_0x1be530,'callerId':_0x371e5d,'callbackUrl':_0x215d57});return _0x1d0437['status'](0xc8)['json']({'error':![],'message':'originate\x20executed!'});})['catch'](handleError(_0x1d0437));};exports[_0x2e81('0x2f')]=function(_0x5493d7,_0x4c7ff6){logger[_0x2e81('0xf')](_0x2e81('0x30'),_0x5493d7[_0x2e81('0x29')]);var _0x50e75f=hangupValidation[_0x2e81('0xa')](_0x5493d7[_0x2e81('0x29')]);if(_0x50e75f[_0x2e81('0x25')]>0x0){return _0x4c7ff6[_0x2e81('0x16')](0x190)[_0x2e81('0x2a')](_0x50e75f);}var _0x4b0a7f=_0x5493d7['body'][_0x2e81('0x2b')];var _0x35a2e5=_0x5493d7[_0x2e81('0x29')]['sessionId'];return getAgent(_0x4b0a7f)[_0x2e81('0x19')](function(_0x44d10c){logger[_0x2e81('0xf')]('entityFound:',_0x44d10c[_0x2e81('0x15')]);emit(util[_0x2e81('0x2c')](_0x2e81('0x2d'),_0x44d10c[_0x2e81('0x15')]),_0x2e81('0x31'),{'sessionId':_0x35a2e5});return _0x4c7ff6[_0x2e81('0x16')](0xc8)[_0x2e81('0x2a')]({'error':![],'message':_0x2e81('0x32')});})['catch'](handleError(_0x4c7ff6));};exports['answer']=function(_0xfb706a,_0x507936){logger[_0x2e81('0xf')](_0x2e81('0x33'),_0xfb706a[_0x2e81('0x29')]);var _0x42154f=answerValidation[_0x2e81('0xa')](_0xfb706a[_0x2e81('0x29')]);if(_0x42154f['length']>0x0){return _0x507936['status'](0x190)[_0x2e81('0x2a')](_0x42154f);}var _0x2bc2a7=_0xfb706a[_0x2e81('0x29')]['userId'];var _0x4499b7=_0xfb706a[_0x2e81('0x29')]['sessionId'];return getAgent(_0x2bc2a7)[_0x2e81('0x19')](function(_0x4b5c2d){logger[_0x2e81('0xf')](_0x2e81('0x34'),_0x4b5c2d[_0x2e81('0x15')]);emit(util[_0x2e81('0x2c')]('user:%s',_0x4b5c2d[_0x2e81('0x15')]),'webbar:answer',{'sessionId':_0x4499b7});return _0x507936[_0x2e81('0x16')](0xc8)[_0x2e81('0x2a')]({'error':![],'message':'answer\x20executed!'});})[_0x2e81('0x1c')](handleError(_0x507936));};exports[_0x2e81('0x35')]=function(_0x15ec68,_0x3cee87){logger[_0x2e81('0xf')](_0x2e81('0x36'),_0x15ec68[_0x2e81('0x29')]);var _0x4cd20c=holdValidation[_0x2e81('0xa')](_0x15ec68['body']);if(_0x4cd20c['length']>0x0){return _0x3cee87[_0x2e81('0x16')](0x190)['json'](_0x4cd20c);}var _0x551ad0=_0x15ec68[_0x2e81('0x29')][_0x2e81('0x2b')];var _0x36aae0=_0x15ec68['body']['sessionId'];return getAgent(_0x551ad0)[_0x2e81('0x19')](function(_0x1dd4d7){logger[_0x2e81('0xf')](_0x2e81('0x34'),_0x1dd4d7['name']);emit(util['format'](_0x2e81('0x2d'),_0x1dd4d7[_0x2e81('0x15')]),'webbar:hold',{'sessionId':_0x36aae0});return _0x3cee87['status'](0xc8)[_0x2e81('0x2a')]({'error':![],'message':_0x2e81('0x37')});})['catch'](handleError(_0x3cee87));};exports[_0x2e81('0x38')]=function(_0x33a4d7,_0x25b243){logger[_0x2e81('0xf')](_0x2e81('0x39'),_0x33a4d7['body']);var _0x7a56f1=unholdValidation[_0x2e81('0xa')](_0x33a4d7[_0x2e81('0x29')]);if(_0x7a56f1[_0x2e81('0x25')]>0x0){return _0x25b243['status'](0x190)['json'](_0x7a56f1);}var _0x1f5024=_0x33a4d7[_0x2e81('0x29')][_0x2e81('0x2b')];var _0x127d1b=_0x33a4d7[_0x2e81('0x29')]['sessionId'];return getAgent(_0x1f5024)[_0x2e81('0x19')](function(_0x7b48bf){logger[_0x2e81('0xf')](_0x2e81('0x34'),_0x7b48bf[_0x2e81('0x15')]);emit(util['format'](_0x2e81('0x2d'),_0x7b48bf[_0x2e81('0x15')]),'webbar:unhold',{'sessionId':_0x127d1b});return _0x25b243['status'](0xc8)[_0x2e81('0x2a')]({'error':![],'message':'unhold\x20executed!'});})[_0x2e81('0x1c')](handleError(_0x25b243));};exports[_0x2e81('0x3a')]=function(_0xba3975,_0x40d8a4){logger[_0x2e81('0xf')](_0x2e81('0x3b'),_0x40d8a4[_0x2e81('0x29')]);var _0x1570c1=callsValidation['validate'](_0xba3975[_0x2e81('0x29')]);if(_0x1570c1['length']>0x0){return _0x40d8a4[_0x2e81('0x16')](0x190)[_0x2e81('0x2a')](_0x1570c1);}var _0x56135f=_0xba3975[_0x2e81('0x29')][_0x2e81('0x2b')];var _0x56b2d0=respondWithRpcPromise(_0x2e81('0x20'));var _0x5c3b81=getAgent(_0x56135f);return Promise[_0x2e81('0x3c')]([_0x56b2d0,_0x5c3b81])[_0x2e81('0x19')](function(_0x12ae3b){var _0x3980ce=_0x12ae3b[0x0];var _0x4584b5=_0x12ae3b[0x1];var _0x4659c8=_[_0x2e81('0x21')](_0x3980ce[_0x2e81('0x22')],function(_0x4fe65c){return _0x4fe65c[_0x2e81('0x23')]==_0x4584b5['id'];});return _0x40d8a4[_0x2e81('0x16')](0xc8)[_0x2e81('0x2a')]({'count':_0x4659c8[_0x2e81('0x25')],'rows':_0x4659c8});})[_0x2e81('0x1c')](handleError(_0x40d8a4));};exports[_0x2e81('0x3d')]=function(_0x176147,_0x8a1f0f){logger[_0x2e81('0xf')](_0x2e81('0x3e'),_0x176147[_0x2e81('0x29')]);var _0x1a92be=conferenceValidation[_0x2e81('0xa')](_0x176147[_0x2e81('0x29')]);if(_0x1a92be[_0x2e81('0x25')]>0x0){return _0x8a1f0f['status'](0x190)['json'](_0x1a92be);}var _0x354e39=_0x176147[_0x2e81('0x29')][_0x2e81('0x2b')];return getAgent(_0x354e39)[_0x2e81('0x19')](function(_0x45b114){logger[_0x2e81('0xf')](_0x2e81('0x34'),_0x45b114[_0x2e81('0x15')]);emit(util['format']('user:%s',_0x45b114[_0x2e81('0x15')]),_0x2e81('0x3f'));return _0x8a1f0f['status'](0xc8)[_0x2e81('0x2a')]({'error':![],'message':_0x2e81('0x40')});})[_0x2e81('0x1c')](handleError(_0x8a1f0f));};exports[_0x2e81('0x41')]=function(_0x1f4805,_0x85a455){logger[_0x2e81('0xf')](_0x2e81('0x42'),_0x1f4805['body']);var _0x143f60=transferValidation['validate'](_0x1f4805[_0x2e81('0x29')]);if(_0x143f60[_0x2e81('0x25')]>0x0){return _0x85a455[_0x2e81('0x16')](0x190)[_0x2e81('0x2a')](_0x143f60);}var _0xafbd8c=_0x1f4805[_0x2e81('0x29')][_0x2e81('0x2b')];var _0xd0861=_0x1f4805[_0x2e81('0x29')][_0x2e81('0x24')];var _0x12ce2a=_0x1f4805[_0x2e81('0x29')]['transferNumber'];return getAgent(_0xafbd8c)[_0x2e81('0x19')](function(_0x3b1754){logger[_0x2e81('0xf')](_0x2e81('0x34'),_0x3b1754[_0x2e81('0x15')]);emit(util['format'](_0x2e81('0x2d'),_0x3b1754[_0x2e81('0x15')]),'webbar:transfer',{'sessionId':_0xd0861,'transferNumber':_0x12ce2a});return _0x85a455[_0x2e81('0x16')](0xc8)[_0x2e81('0x2a')]({'error':![],'message':_0x2e81('0x43')});})[_0x2e81('0x1c')](handleError(_0x85a455));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index aa44454..b188d62 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 _0x57ca=['addDisposition','addAnswer','addApplications','/:id/notify','notify','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','create','post','/:id/dispositions'];(function(_0x16e3ef,_0x403937){var _0x4862cd=function(_0x1a6963){while(--_0x1a6963){_0x16e3ef['push'](_0x16e3ef['shift']());}};_0x4862cd(++_0x403937);}(_0x57ca,0x108));var _0xa57c=function(_0x34f678,_0x2d9303){_0x34f678=_0x34f678-0x0;var _0x47f04c=_0x57ca[_0x34f678];return _0x47f04c;};'use strict';var multer=require('multer');var util=require(_0xa57c('0x0'));var path=require(_0xa57c('0x1'));var timeout=require('connect-timeout');var express=require(_0xa57c('0x2'));var router=express[_0xa57c('0x3')]();var fs_extra=require(_0xa57c('0x4'));var auth=require(_0xa57c('0x5'));var interaction=require(_0xa57c('0x6'));var config=require('../../config/environment');var controller=require(_0xa57c('0x7'));router[_0xa57c('0x8')]('/',auth[_0xa57c('0x9')](),controller[_0xa57c('0xa')]);router[_0xa57c('0x8')](_0xa57c('0xb'),auth[_0xa57c('0x9')](),controller[_0xa57c('0xc')]);router['get'](_0xa57c('0xd'),auth['isAuthenticated'](),controller[_0xa57c('0xe')]);router[_0xa57c('0x8')]('/:id/dispositions',auth[_0xa57c('0x9')](),controller['getDispositions']);router[_0xa57c('0x8')](_0xa57c('0xf'),auth['isAuthenticated'](),controller[_0xa57c('0x10')]);router['get'](_0xa57c('0x11'),auth[_0xa57c('0x9')](),controller[_0xa57c('0x12')]);router[_0xa57c('0x8')](_0xa57c('0x13'),auth['isAuthenticated'](),controller[_0xa57c('0x14')]);router['post']('/',auth[_0xa57c('0x9')](),controller[_0xa57c('0x15')]);router[_0xa57c('0x16')](_0xa57c('0x17'),auth[_0xa57c('0x9')](),controller[_0xa57c('0x18')]);router[_0xa57c('0x16')]('/:id/canned_answers',auth[_0xa57c('0x9')](),controller[_0xa57c('0x19')]);router[_0xa57c('0x16')]('/:id/users',auth[_0xa57c('0x9')](),controller['addAgents']);router[_0xa57c('0x16')](_0xa57c('0x13'),auth[_0xa57c('0x9')](),controller[_0xa57c('0x1a')]);router[_0xa57c('0x16')](_0xa57c('0x1b'),controller[_0xa57c('0x1c')]);router[_0xa57c('0x16')]('/:id/send',auth[_0xa57c('0x9')](),controller['send']);router['put'](_0xa57c('0xd'),auth[_0xa57c('0x9')](),controller[_0xa57c('0x1d')]);router[_0xa57c('0x1e')]('/:id',auth[_0xa57c('0x9')](),controller[_0xa57c('0x1f')]);router[_0xa57c('0x1e')](_0xa57c('0x17'),auth[_0xa57c('0x9')](),controller[_0xa57c('0x20')]);router[_0xa57c('0x1e')](_0xa57c('0xf'),auth[_0xa57c('0x9')](),controller[_0xa57c('0x21')]);router[_0xa57c('0x1e')](_0xa57c('0x11'),auth[_0xa57c('0x9')](),controller[_0xa57c('0x22')]);module[_0xa57c('0x23')]=router; \ No newline at end of file +var _0x7708=['../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/users','/:id/applications','getApplications','post','create','addDisposition','addAnswer','addAgents','/:id/notify','notify','/:id/send','put','update','destroy','delete','removeDispositions','removeAnswers','exports','multer','util','connect-timeout','../../components/interaction/service'];(function(_0x483346,_0x8f7c1c){var _0x128df5=function(_0x54f882){while(--_0x54f882){_0x483346['push'](_0x483346['shift']());}};_0x128df5(++_0x8f7c1c);}(_0x7708,0x188));var _0x8770=function(_0xacb1e2,_0x55e0ab){_0xacb1e2=_0xacb1e2-0x0;var _0x463815=_0x7708[_0xacb1e2];return _0x463815;};'use strict';var multer=require(_0x8770('0x0'));var util=require(_0x8770('0x1'));var path=require('path');var timeout=require(_0x8770('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8770('0x3'));var config=require(_0x8770('0x4'));var controller=require('./whatsappAccount.controller');router[_0x8770('0x5')]('/',auth['isAuthenticated'](),controller[_0x8770('0x6')]);router[_0x8770('0x5')](_0x8770('0x7'),auth[_0x8770('0x8')](),controller[_0x8770('0x9')]);router[_0x8770('0x5')](_0x8770('0xa'),auth['isAuthenticated'](),controller[_0x8770('0xb')]);router[_0x8770('0x5')](_0x8770('0xc'),auth['isAuthenticated'](),controller[_0x8770('0xd')]);router[_0x8770('0x5')](_0x8770('0xe'),auth[_0x8770('0x8')](),controller['getAnswers']);router[_0x8770('0x5')](_0x8770('0xf'),auth[_0x8770('0x8')](),controller['getAgents']);router[_0x8770('0x5')](_0x8770('0x10'),auth[_0x8770('0x8')](),controller[_0x8770('0x11')]);router[_0x8770('0x12')]('/',auth[_0x8770('0x8')](),controller[_0x8770('0x13')]);router[_0x8770('0x12')]('/:id/dispositions',auth[_0x8770('0x8')](),controller[_0x8770('0x14')]);router['post'](_0x8770('0xe'),auth['isAuthenticated'](),controller[_0x8770('0x15')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0x8770('0x16')]);router[_0x8770('0x12')](_0x8770('0x10'),auth[_0x8770('0x8')](),controller['addApplications']);router['post'](_0x8770('0x17'),controller[_0x8770('0x18')]);router[_0x8770('0x12')](_0x8770('0x19'),auth[_0x8770('0x8')](),controller['send']);router[_0x8770('0x1a')](_0x8770('0xa'),auth[_0x8770('0x8')](),controller[_0x8770('0x1b')]);router['delete']('/:id',auth[_0x8770('0x8')](),controller[_0x8770('0x1c')]);router[_0x8770('0x1d')](_0x8770('0xc'),auth[_0x8770('0x8')](),controller[_0x8770('0x1e')]);router['delete'](_0x8770('0xe'),auth[_0x8770('0x8')](),controller[_0x8770('0x1f')]);router[_0x8770('0x1d')]('/:id/users',auth[_0x8770('0x8')](),controller['removeAgents']);module[_0x8770('0x20')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 75d252e..05bfded 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 _0x4f34=['ENUM','INTEGER','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','generate'];(function(_0x2be413,_0x506ac9){var _0x2da85c=function(_0x589dcc){while(--_0x589dcc){_0x2be413['push'](_0x2be413['shift']());}};_0x2da85c(++_0x506ac9);}(_0x4f34,0xc2));var _0x44f3=function(_0x25e434,_0x48e43a){_0x25e434=_0x25e434-0x0;var _0x546adb=_0x4f34[_0x25e434];return _0x546adb;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x44f3('0x0'));module[_0x44f3('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x44f3('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x44f3('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x44f3('0x2')],'defaultValue':function(){return rs[_0x44f3('0x3')]();}},'phone':{'type':Sequelize[_0x44f3('0x2')]},'type':{'type':Sequelize[_0x44f3('0x4')]('twilio')},'accountSid':{'type':Sequelize[_0x44f3('0x2')]},'authToken':{'type':Sequelize[_0x44f3('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x44f3('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x44f3('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x44f3('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x44f3('0x5')],'comment':_0x44f3('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x44f3('0x6')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x461d2e){if(!_0x461d2e){this[_0x44f3('0x8')](_0x44f3('0x9'),null);}this[_0x44f3('0x8')](_0x44f3('0xa'),_0x461d2e);}},'description':{'type':Sequelize[_0x44f3('0x2')]}}; \ No newline at end of file +var _0x4e10=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','ENUM','twilio'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0x4e10,0xd9));var _0x04e1=function(_0x2afa19,_0x5d17ec){_0x2afa19=_0x2afa19-0x0;var _0x5a6442=_0x4e10[_0x2afa19];return _0x5a6442;};'use strict';var Sequelize=require(_0x04e1('0x0'));var rs=require(_0x04e1('0x1'));module[_0x04e1('0x2')]={'name':{'type':Sequelize[_0x04e1('0x3')],'unique':_0x04e1('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x04e1('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x04e1('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x04e1('0x3')]},'type':{'type':Sequelize[_0x04e1('0x5')](_0x04e1('0x6'))},'accountSid':{'type':Sequelize[_0x04e1('0x3')]},'authToken':{'type':Sequelize[_0x04e1('0x3')]},'notificationTemplate':{'type':Sequelize[_0x04e1('0x7')],'defaultValue':function(){return _0x04e1('0x8');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x04e1('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x04e1('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x04e1('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x04e1('0x9')],'comment':_0x04e1('0xb')},'mandatoryDisposition':{'type':Sequelize[_0x04e1('0xa')],'defaultValue':![],'comment':_0x04e1('0xc'),'set':function(_0x4c991b){if(!_0x4c991b){this[_0x04e1('0xd')](_0x04e1('0xe'),null);}this[_0x04e1('0xd')](_0x04e1('0xf'),_0x4c991b);}},'description':{'type':Sequelize[_0x04e1('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index fe5cdaa..ac2bcde 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 _0x2e88=['to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappAccount,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','get','WhatsappAccounts','UserProfileResource','destroy','stack','name','send','index','Pause','map','WhatsappAccount','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','show','params','mandatoryDispositionPause','fields','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','WhatsappAccountId','Disposition','getDispositions','findOne','rows','removeDispositions','CannedAnswer','getAnswers','removeAnswers','ids','addAgents','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','transaction','WhatsappApplication','bulkCreate','getApplications','notify','whatsapp','Applications','account','applications','orderBy','CmContact','Sequelize','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','mobile','twilio','from','From','replace','whatsapp:','Body','messageId','MessageSid','isNil','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','list','omit','defaults','interaction','created','autoclose','push','close','WhatsappMessage','ContactId','agent','startRouting','Start','receiveMessage','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','text/xml','\x0a','CmList','List','WhatsappInteraction','Messages','dataValues','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x2e88,0x15e));var _0x82e8=function(_0x2dc96f,_0x459058){_0x2dc96f=_0x2dc96f-0x0;var _0xd012da=_0x2e88[_0x2dc96f];return _0xd012da;};'use strict';var emlformat=require(_0x82e8('0x0'));var rimraf=require(_0x82e8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x82e8('0x2'));var moment=require(_0x82e8('0x3'));var BPromise=require(_0x82e8('0x4'));var Mustache=require('mustache');var util=require(_0x82e8('0x5'));var path=require(_0x82e8('0x6'));var sox=require(_0x82e8('0x7'));var csv=require(_0x82e8('0x8'));var ejs=require(_0x82e8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x82e8('0xa'));var crypto=require(_0x82e8('0xb'));var jsforce=require(_0x82e8('0xc'));var deskjs=require(_0x82e8('0xd'));var toCsv=require(_0x82e8('0x8'));var querystring=require(_0x82e8('0xe'));var Papa=require(_0x82e8('0xf'));var Redis=require(_0x82e8('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x82e8('0x11'));var logger=require(_0x82e8('0x12'))(_0x82e8('0x13'));var utils=require(_0x82e8('0x14'));var config=require(_0x82e8('0x15'));var licenseUtil=require(_0x82e8('0x16'));var db=require(_0x82e8('0x17'))['db'];config['redis']=_['defaults'](config[_0x82e8('0x18')],{'host':_0x82e8('0x19'),'port':0x18eb});var socket=require(_0x82e8('0x1a'))(new Redis(config[_0x82e8('0x18')]));require(_0x82e8('0x1b'))[_0x82e8('0x1c')](socket);var jayson=require(_0x82e8('0x1d'));var client=jayson[_0x82e8('0x1e')][_0x82e8('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x532c3d,_0x53f3c1,_0x2b8248,_0x2577c4){return new BPromise(function(_0x53058d,_0x54439d){var _0x3d9ee5=_0x2577c4||client;return _0x3d9ee5[_0x82e8('0x20')](_0x532c3d,_0x2b8248)[_0x82e8('0x21')](function(_0xf26609){logger[_0x82e8('0x22')]('WhatsappAccount,\x20%s,\x20%s',_0x53f3c1,_0x82e8('0x23'));logger['debug'](_0x82e8('0x24'),_0x53f3c1,_0x82e8('0x23'),JSON[_0x82e8('0x25')](_0xf26609));if(_0xf26609[_0x82e8('0x26')]){if(_0xf26609['error']['code']===0x1f4){logger['error'](_0x82e8('0x27'),_0x53f3c1,_0xf26609[_0x82e8('0x26')]['message']);return _0x54439d(_0xf26609[_0x82e8('0x26')][_0x82e8('0x28')]);}logger[_0x82e8('0x26')]('WhatsappAccount,\x20%s,\x20%s',_0x53f3c1,_0xf26609[_0x82e8('0x26')]['message']);return _0x53058d(_0xf26609['error']['message']);}else{logger['info'](_0x82e8('0x27'),_0x53f3c1,_0x82e8('0x23'));_0x53058d(_0xf26609['result'][_0x82e8('0x28')]);}})[_0x82e8('0x29')](function(_0x1f0cdc){logger[_0x82e8('0x26')](_0x82e8('0x27'),_0x53f3c1,_0x1f0cdc);_0x54439d(_0x1f0cdc);});});}function respondWithStatusCode(_0x28de6e,_0x398b7d){_0x398b7d=_0x398b7d||0xcc;return function(_0x302dbd){if(_0x302dbd){return _0x28de6e[_0x82e8('0x2a')](_0x398b7d);}return _0x28de6e[_0x82e8('0x2b')](_0x398b7d)[_0x82e8('0x2c')]();};}function respondWithResult(_0x383418,_0x5c4171){_0x5c4171=_0x5c4171||0xc8;return function(_0x3137de){if(_0x3137de){return _0x383418[_0x82e8('0x2b')](_0x5c4171)[_0x82e8('0x2d')](_0x3137de);}};}function respondWithFilteredResult(_0x33d7ab,_0x335a34){return function(_0x44dcd0){if(_0x44dcd0){var _0x3e1042=typeof _0x335a34[_0x82e8('0x2e')]===_0x82e8('0x2f')&&typeof _0x335a34[_0x82e8('0x30')]===_0x82e8('0x2f');var _0x4e1bee=_0x44dcd0[_0x82e8('0x31')];var _0x504ecb=_0x3e1042?0x0:_0x335a34[_0x82e8('0x2e')];var _0x55fbb1=_0x3e1042?_0x44dcd0[_0x82e8('0x31')]:_0x335a34['offset']+_0x335a34['limit'];var _0x296a7d;if(_0x55fbb1>=_0x4e1bee){_0x55fbb1=_0x4e1bee;_0x296a7d=0xc8;}else{_0x296a7d=0xce;}_0x33d7ab[_0x82e8('0x2b')](_0x296a7d);return _0x33d7ab['set'](_0x82e8('0x32'),_0x504ecb+'-'+_0x55fbb1+'/'+_0x4e1bee)[_0x82e8('0x2d')](_0x44dcd0);}return null;};}function patchUpdates(_0xd19805){return function(_0x2d9d35){try{jsonpatch['apply'](_0x2d9d35,_0xd19805,!![]);}catch(_0x400fc7){return BPromise[_0x82e8('0x33')](_0x400fc7);}return _0x2d9d35[_0x82e8('0x34')]();};}function saveUpdates(_0x135d3e,_0x5d482d){return function(_0x465339){if(_0x465339){return _0x465339['update'](_0x135d3e)[_0x82e8('0x21')](function(_0x31aa68){return _0x31aa68;});}return null;};}function removeEntity(_0x15510,_0x573647){return function(_0x37b481){if(_0x37b481){return _0x37b481['destroy']()[_0x82e8('0x21')](function(){var _0x4f826f=_0x37b481[_0x82e8('0x35')]({'plain':!![]});var _0x2adbb7=_0x82e8('0x36');return db[_0x82e8('0x37')][_0x82e8('0x38')]({'where':{'type':_0x2adbb7,'resourceId':_0x4f826f['id']}})[_0x82e8('0x21')](function(){return _0x37b481;});})[_0x82e8('0x21')](function(){_0x15510['status'](0xcc)[_0x82e8('0x2c')]();});}};}function handleEntityNotFound(_0x3b2703,_0x29a6b0){return function(_0x813ff4){if(!_0x813ff4){_0x3b2703[_0x82e8('0x2a')](0x194);}return _0x813ff4;};}function handleError(_0x27dd72,_0x12b45b){_0x12b45b=_0x12b45b||0x1f4;return function(_0x431d33){logger['error'](_0x431d33[_0x82e8('0x39')]);if(_0x431d33[_0x82e8('0x3a')]){delete _0x431d33['name'];}_0x27dd72[_0x82e8('0x2b')](_0x12b45b)[_0x82e8('0x3b')](_0x431d33);};}exports[_0x82e8('0x3c')]=function(_0x39b290,_0x37da76){var _0x4854d3={'include':[{'model':db[_0x82e8('0x3d')],'as':'mandatoryDispositionPause'}]},_0x2b6fbf={},_0x2617c7={'count':0x0,'rows':[]};var _0xdd14c4=_[_0x82e8('0x3e')](db[_0x82e8('0x3f')][_0x82e8('0x40')],function(_0x109460){return{'name':_0x109460['fieldName'],'type':_0x109460[_0x82e8('0x41')][_0x82e8('0x42')]};});_0x2b6fbf[_0x82e8('0x43')]=_['map'](_0xdd14c4,_0x82e8('0x3a'));_0x2b6fbf[_0x82e8('0x44')]=_[_0x82e8('0x45')](_0x39b290['query']);_0x2b6fbf[_0x82e8('0x46')]=_['intersection'](_0x2b6fbf[_0x82e8('0x43')],_0x2b6fbf[_0x82e8('0x44')]);_0x4854d3[_0x82e8('0x47')]=_[_0x82e8('0x48')](_0x2b6fbf['model'],qs['fields'](_0x39b290[_0x82e8('0x44')]['fields']));_0x4854d3[_0x82e8('0x47')]=_0x4854d3[_0x82e8('0x47')][_0x82e8('0x49')]?_0x4854d3[_0x82e8('0x47')]:_0x2b6fbf['model'];if(!_0x39b290[_0x82e8('0x44')][_0x82e8('0x4a')](_0x82e8('0x4b'))){_0x4854d3['limit']=qs['limit'](_0x39b290['query'][_0x82e8('0x30')]);_0x4854d3[_0x82e8('0x2e')]=qs[_0x82e8('0x2e')](_0x39b290[_0x82e8('0x44')][_0x82e8('0x2e')]);}_0x4854d3[_0x82e8('0x4c')]=qs[_0x82e8('0x4d')](_0x39b290[_0x82e8('0x44')]['sort']);_0x4854d3['where']=qs['filters'](_[_0x82e8('0x4e')](_0x39b290[_0x82e8('0x44')],_0x2b6fbf[_0x82e8('0x46')]),_0xdd14c4);if(_0x39b290[_0x82e8('0x44')][_0x82e8('0x4f')]){_0x4854d3[_0x82e8('0x50')]=_[_0x82e8('0x51')](_0x4854d3[_0x82e8('0x50')],{'$or':_[_0x82e8('0x3e')](_0xdd14c4,function(_0x20102e){if(_0x20102e[_0x82e8('0x41')]!=='VIRTUAL'){var _0x142d39={};_0x142d39[_0x20102e[_0x82e8('0x3a')]]={'$like':'%'+_0x39b290[_0x82e8('0x44')][_0x82e8('0x4f')]+'%'};return _0x142d39;}})});}_0x4854d3=_[_0x82e8('0x51')]({},_0x4854d3,_0x39b290[_0x82e8('0x52')]);var _0x53b4c3={'where':_0x4854d3[_0x82e8('0x50')]};return db[_0x82e8('0x3f')]['count'](_0x53b4c3)['then'](function(_0x5db21a){_0x2617c7[_0x82e8('0x31')]=_0x5db21a;if(_0x39b290[_0x82e8('0x44')][_0x82e8('0x53')]){_0x4854d3[_0x82e8('0x54')]=[{'all':!![]}];}return db[_0x82e8('0x3f')][_0x82e8('0x55')](_0x4854d3);})[_0x82e8('0x21')](function(_0x36ec67){_0x2617c7['rows']=_0x36ec67;return _0x2617c7;})['then'](respondWithFilteredResult(_0x37da76,_0x4854d3))[_0x82e8('0x29')](handleError(_0x37da76,null));};exports[_0x82e8('0x56')]=function(_0x355117,_0x36385c){var _0x580193={'raw':![],'where':{'id':_0x355117[_0x82e8('0x57')]['id']},'include':[{'model':db[_0x82e8('0x3d')],'as':_0x82e8('0x58')}]},_0x5f4c5f={};_0x5f4c5f[_0x82e8('0x43')]=_[_0x82e8('0x45')](db['WhatsappAccount'][_0x82e8('0x40')]);_0x5f4c5f[_0x82e8('0x44')]=_[_0x82e8('0x45')](_0x355117[_0x82e8('0x44')]);_0x5f4c5f[_0x82e8('0x46')]=_[_0x82e8('0x48')](_0x5f4c5f[_0x82e8('0x43')],_0x5f4c5f[_0x82e8('0x44')]);_0x580193[_0x82e8('0x47')]=_[_0x82e8('0x48')](_0x5f4c5f[_0x82e8('0x43')],qs['fields'](_0x355117[_0x82e8('0x44')][_0x82e8('0x59')]));_0x580193['attributes']=_0x580193[_0x82e8('0x47')]['length']?_0x580193[_0x82e8('0x47')]:_0x5f4c5f['model'];if(_0x355117[_0x82e8('0x44')][_0x82e8('0x53')]){_0x580193[_0x82e8('0x54')]=[{'all':!![]}];}_0x580193=_[_0x82e8('0x51')]({},_0x580193,_0x355117[_0x82e8('0x52')]);return db[_0x82e8('0x3f')][_0x82e8('0x5a')](_0x580193)[_0x82e8('0x21')](handleEntityNotFound(_0x36385c,null))[_0x82e8('0x21')](respondWithResult(_0x36385c,null))[_0x82e8('0x29')](handleError(_0x36385c,null));};exports['create']=function(_0x48b663,_0x502636){return db[_0x82e8('0x3f')]['create'](_0x48b663[_0x82e8('0x5b')],{})['then'](function(_0x4dd6a6){var _0x18c0f7=_0x48b663[_0x82e8('0x5c')][_0x82e8('0x35')]({'plain':!![]});if(!_0x18c0f7)throw new Error(_0x82e8('0x5d'));if(_0x18c0f7[_0x82e8('0x5e')]==='user'){var _0x59a44e=_0x4dd6a6[_0x82e8('0x35')]({'plain':!![]});var _0xf7e72c=_0x82e8('0x36');return db[_0x82e8('0x5f')][_0x82e8('0x5a')]({'where':{'name':_0xf7e72c,'userProfileId':_0x18c0f7[_0x82e8('0x60')]},'raw':!![]})['then'](function(_0x2a840e){if(_0x2a840e&&_0x2a840e[_0x82e8('0x61')]===0x0){return db[_0x82e8('0x37')][_0x82e8('0x62')]({'name':_0x59a44e[_0x82e8('0x3a')],'resourceId':_0x59a44e['id'],'type':_0x2a840e[_0x82e8('0x3a')],'sectionId':_0x2a840e['id']},{})[_0x82e8('0x21')](function(){return _0x4dd6a6;});}else{return _0x4dd6a6;}})[_0x82e8('0x29')](function(_0x20670c){logger[_0x82e8('0x26')](_0x82e8('0x63'),_0x20670c);throw _0x20670c;});}return _0x4dd6a6;})['then'](respondWithResult(_0x502636,0xc9))['catch'](handleError(_0x502636,null));};exports[_0x82e8('0x64')]=function(_0xed2127,_0x5f4d3b){if(_0xed2127[_0x82e8('0x5b')]['id']){delete _0xed2127['body']['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0xed2127['params']['id']},'include':[{'model':db[_0x82e8('0x3d')],'as':_0x82e8('0x58')}]})['then'](handleEntityNotFound(_0x5f4d3b,null))['then'](saveUpdates(_0xed2127[_0x82e8('0x5b')],null))[_0x82e8('0x21')](respondWithResult(_0x5f4d3b,null))[_0x82e8('0x29')](handleError(_0x5f4d3b,null));};exports[_0x82e8('0x38')]=function(_0x378494,_0x265374){return db[_0x82e8('0x3f')]['find']({'where':{'id':_0x378494[_0x82e8('0x57')]['id']}})['then'](handleEntityNotFound(_0x265374,null))[_0x82e8('0x21')](removeEntity(_0x265374,null))[_0x82e8('0x29')](handleError(_0x265374,null));};exports[_0x82e8('0x65')]=function(_0x29be41,_0x5d8566){return db[_0x82e8('0x3f')][_0x82e8('0x65')]()['then'](respondWithResult(_0x5d8566,null))[_0x82e8('0x29')](handleError(_0x5d8566,null));};exports['addDisposition']=function(_0x577818,_0x2a237e,_0xb2f568){if(_0x577818[_0x82e8('0x5b')]['id']){delete _0x577818[_0x82e8('0x5b')]['id'];}return db[_0x82e8('0x3f')]['find']({'where':{'id':_0x577818[_0x82e8('0x57')]['id']}})[_0x82e8('0x21')](handleEntityNotFound(_0x2a237e,null))[_0x82e8('0x21')](function(_0x5adcc9){if(_0x5adcc9){_0x577818[_0x82e8('0x5b')][_0x82e8('0x66')]=_0x5adcc9['id'];return db[_0x82e8('0x67')][_0x82e8('0x62')](_0x577818[_0x82e8('0x5b')]);}})[_0x82e8('0x21')](respondWithResult(_0x2a237e,null))['catch'](handleError(_0x2a237e,null));};exports[_0x82e8('0x68')]=function(_0x5b0f94,_0xd28068,_0x51fc8b){var _0x5918cb={'raw':![],'where':{}};var _0x27b015={};var _0x219ebf={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x82e8('0x69')]({'where':{'id':_0x5b0f94[_0x82e8('0x57')]['id']}})[_0x82e8('0x21')](handleEntityNotFound(_0xd28068,null))[_0x82e8('0x21')](function(_0x540a02){if(_0x540a02){_0x27b015[_0x82e8('0x43')]=_['keys'](db[_0x82e8('0x67')]['rawAttributes']);_0x27b015[_0x82e8('0x44')]=_['keys'](_0x5b0f94[_0x82e8('0x44')]);_0x27b015[_0x82e8('0x46')]=_[_0x82e8('0x48')](_0x27b015['model'],_0x27b015[_0x82e8('0x44')]);_0x5918cb[_0x82e8('0x47')]=_['intersection'](_0x27b015['model'],qs[_0x82e8('0x59')](_0x5b0f94[_0x82e8('0x44')]['fields']));_0x5918cb[_0x82e8('0x47')]=_0x5918cb['attributes'][_0x82e8('0x49')]?_0x5918cb[_0x82e8('0x47')]:_0x27b015[_0x82e8('0x43')];if(!_0x5b0f94[_0x82e8('0x44')][_0x82e8('0x4a')]('nolimit')){_0x5918cb[_0x82e8('0x30')]=qs[_0x82e8('0x30')](_0x5b0f94[_0x82e8('0x44')][_0x82e8('0x30')]);_0x5918cb['offset']=qs['offset'](_0x5b0f94['query'][_0x82e8('0x2e')]);}_0x5918cb[_0x82e8('0x4c')]=qs['sort'](_0x5b0f94[_0x82e8('0x44')][_0x82e8('0x4d')]);_0x5918cb[_0x82e8('0x50')]=qs['filters'](_[_0x82e8('0x4e')](_0x5b0f94[_0x82e8('0x44')],_0x27b015[_0x82e8('0x46')]));_0x5918cb['where'][_0x82e8('0x66')]=_0x540a02['id'];if(_0x5b0f94[_0x82e8('0x44')][_0x82e8('0x4f')]){_0x5918cb[_0x82e8('0x50')]=_[_0x82e8('0x51')](_0x5918cb[_0x82e8('0x50')],{'$or':_['map'](_0x5918cb[_0x82e8('0x47')],function(_0x456445){var _0x149e93={};_0x149e93[_0x456445]={'$like':'%'+_0x5b0f94[_0x82e8('0x44')][_0x82e8('0x4f')]+'%'};return _0x149e93;})});}_0x5918cb=_[_0x82e8('0x51')]({},_0x5918cb,_0x5b0f94[_0x82e8('0x52')]);return db[_0x82e8('0x67')][_0x82e8('0x31')]({'where':_0x5918cb[_0x82e8('0x50')]})[_0x82e8('0x21')](function(_0x135336){_0x219ebf[_0x82e8('0x31')]=_0x135336;if(_0x5b0f94['query'][_0x82e8('0x53')]){_0x5918cb[_0x82e8('0x54')]=[{'all':!![]}];}return db[_0x82e8('0x67')]['findAll'](_0x5918cb);})[_0x82e8('0x21')](function(_0x32863c){_0x219ebf[_0x82e8('0x6a')]=_0x32863c;return _0x219ebf;});}})[_0x82e8('0x21')](respondWithFilteredResult(_0xd28068,_0x5918cb))[_0x82e8('0x29')](handleError(_0xd28068,null));};exports[_0x82e8('0x6b')]=function(_0x33f31c,_0x292076,_0x3aa1d0){return db[_0x82e8('0x3f')]['find']({'where':{'id':_0x33f31c['params']['id']}})[_0x82e8('0x21')](handleEntityNotFound(_0x292076,null))[_0x82e8('0x21')](function(_0x252982){if(_0x252982){return _0x252982['removeDispositions'](_0x33f31c[_0x82e8('0x44')]['ids']);}})[_0x82e8('0x21')](respondWithStatusCode(_0x292076,null))[_0x82e8('0x29')](handleError(_0x292076,null));};exports['addAnswer']=function(_0x15bddc,_0x4eefb9,_0x53c5d7){if(_0x15bddc['body']['id']){delete _0x15bddc[_0x82e8('0x5b')]['id'];}return db[_0x82e8('0x3f')][_0x82e8('0x5a')]({'where':{'id':_0x15bddc[_0x82e8('0x57')]['id']}})[_0x82e8('0x21')](handleEntityNotFound(_0x4eefb9,null))[_0x82e8('0x21')](function(_0x4d5030){if(_0x4d5030){_0x15bddc[_0x82e8('0x5b')][_0x82e8('0x66')]=_0x4d5030['id'];return db[_0x82e8('0x6c')][_0x82e8('0x62')](_0x15bddc['body']);}})[_0x82e8('0x21')](respondWithResult(_0x4eefb9,null))['catch'](handleError(_0x4eefb9,null));};exports[_0x82e8('0x6d')]=function(_0x2501cb,_0x5015d8,_0x4525a8){var _0x3dac7e={'raw':![],'where':{}};var _0x4ba869={};var _0x4bc9f3={'count':0x0,'rows':[]};return db[_0x82e8('0x3f')]['findOne']({'where':{'id':_0x2501cb[_0x82e8('0x57')]['id']}})[_0x82e8('0x21')](handleEntityNotFound(_0x5015d8,null))[_0x82e8('0x21')](function(_0x3a2579){if(_0x3a2579){_0x4ba869[_0x82e8('0x43')]=_[_0x82e8('0x45')](db['CannedAnswer']['rawAttributes']);_0x4ba869[_0x82e8('0x44')]=_[_0x82e8('0x45')](_0x2501cb['query']);_0x4ba869['filters']=_['intersection'](_0x4ba869['model'],_0x4ba869[_0x82e8('0x44')]);_0x3dac7e[_0x82e8('0x47')]=_[_0x82e8('0x48')](_0x4ba869[_0x82e8('0x43')],qs['fields'](_0x2501cb['query'][_0x82e8('0x59')]));_0x3dac7e[_0x82e8('0x47')]=_0x3dac7e[_0x82e8('0x47')]['length']?_0x3dac7e[_0x82e8('0x47')]:_0x4ba869[_0x82e8('0x43')];if(!_0x2501cb['query'][_0x82e8('0x4a')]('nolimit')){_0x3dac7e[_0x82e8('0x30')]=qs[_0x82e8('0x30')](_0x2501cb['query'][_0x82e8('0x30')]);_0x3dac7e[_0x82e8('0x2e')]=qs[_0x82e8('0x2e')](_0x2501cb[_0x82e8('0x44')]['offset']);}_0x3dac7e[_0x82e8('0x4c')]=qs['sort'](_0x2501cb['query'][_0x82e8('0x4d')]);_0x3dac7e[_0x82e8('0x50')]=qs[_0x82e8('0x46')](_[_0x82e8('0x4e')](_0x2501cb[_0x82e8('0x44')],_0x4ba869['filters']));_0x3dac7e['where'][_0x82e8('0x66')]=_0x3a2579['id'];if(_0x2501cb[_0x82e8('0x44')]['filter']){_0x3dac7e[_0x82e8('0x50')]=_[_0x82e8('0x51')](_0x3dac7e[_0x82e8('0x50')],{'$or':_[_0x82e8('0x3e')](_0x3dac7e[_0x82e8('0x47')],function(_0x555557){var _0x57721c={};_0x57721c[_0x555557]={'$like':'%'+_0x2501cb[_0x82e8('0x44')]['filter']+'%'};return _0x57721c;})});}_0x3dac7e=_[_0x82e8('0x51')]({},_0x3dac7e,_0x2501cb['options']);return db['CannedAnswer']['count']({'where':_0x3dac7e[_0x82e8('0x50')]})[_0x82e8('0x21')](function(_0x4392de){_0x4bc9f3[_0x82e8('0x31')]=_0x4392de;if(_0x2501cb[_0x82e8('0x44')][_0x82e8('0x53')]){_0x3dac7e[_0x82e8('0x54')]=[{'all':!![]}];}return db[_0x82e8('0x6c')][_0x82e8('0x55')](_0x3dac7e);})[_0x82e8('0x21')](function(_0x24a4e3){_0x4bc9f3[_0x82e8('0x6a')]=_0x24a4e3;return _0x4bc9f3;});}})[_0x82e8('0x21')](respondWithFilteredResult(_0x5015d8,_0x3dac7e))[_0x82e8('0x29')](handleError(_0x5015d8,null));};exports['removeAnswers']=function(_0x1d30b2,_0x38ae9f,_0x5305a9){return db['WhatsappAccount'][_0x82e8('0x5a')]({'where':{'id':_0x1d30b2[_0x82e8('0x57')]['id']}})[_0x82e8('0x21')](handleEntityNotFound(_0x38ae9f,null))[_0x82e8('0x21')](function(_0x3234c2){if(_0x3234c2){return _0x3234c2[_0x82e8('0x6e')](_0x1d30b2[_0x82e8('0x44')][_0x82e8('0x6f')]);}})[_0x82e8('0x21')](respondWithStatusCode(_0x38ae9f,null))[_0x82e8('0x29')](handleError(_0x38ae9f,null));};exports[_0x82e8('0x70')]=function(_0x1ec95,_0xa1260,_0x2d2d1f){return db[_0x82e8('0x3f')][_0x82e8('0x5a')]({'where':{'id':_0x1ec95[_0x82e8('0x57')]['id']}})['then'](handleEntityNotFound(_0xa1260,null))[_0x82e8('0x21')](function(_0x23458f){if(_0x23458f){return _0x23458f[_0x82e8('0x70')](_0x1ec95[_0x82e8('0x5b')][_0x82e8('0x6f')],_['omit'](_0x1ec95['body'],[_0x82e8('0x6f'),'id'])||{})[_0x82e8('0x71')](function(_0x2a8187){for(var _0x59687f=0x0;_0x59687f<_0x1ec95[_0x82e8('0x5b')]['ids'][_0x82e8('0x49')];_0x59687f+=0x1){socket[_0x82e8('0x72')](_0x82e8('0x73'),{'UserId':Number(_0x1ec95['body']['ids'][_0x59687f]),'WhatsappAccountId':Number(_0x1ec95[_0x82e8('0x57')]['id'])});}return _0x2a8187;});}})[_0x82e8('0x21')](respondWithResult(_0xa1260,null))[_0x82e8('0x29')](handleError(_0xa1260,null));};exports[_0x82e8('0x74')]=function(_0x3cd6aa,_0x26f3e6,_0x64c769){return db[_0x82e8('0x3f')][_0x82e8('0x5a')]({'where':{'id':_0x3cd6aa['params']['id']}})[_0x82e8('0x21')](handleEntityNotFound(_0x26f3e6,null))[_0x82e8('0x21')](function(_0x16fa0d){if(_0x16fa0d){return _0x16fa0d[_0x82e8('0x74')](_0x3cd6aa['query']['ids'])[_0x82e8('0x21')](function(){if(_[_0x82e8('0x75')](_0x3cd6aa[_0x82e8('0x44')]['ids'])){for(var _0x46e08d=0x0;_0x46e08d<_0x3cd6aa[_0x82e8('0x44')][_0x82e8('0x6f')][_0x82e8('0x49')];_0x46e08d+=0x1){socket[_0x82e8('0x72')](_0x82e8('0x76'),{'UserId':Number(_0x3cd6aa[_0x82e8('0x44')][_0x82e8('0x6f')][_0x46e08d]),'WhatsappAccountId':Number(_0x3cd6aa['params']['id'])});}}else{socket[_0x82e8('0x72')]('userWhatsappAccount:remove',{'UserId':Number(_0x3cd6aa[_0x82e8('0x44')]['ids']),'WhatsappAccountId':Number(_0x3cd6aa['params']['id'])});}});}})[_0x82e8('0x21')](respondWithStatusCode(_0x26f3e6,null))['catch'](handleError(_0x26f3e6,null));};exports[_0x82e8('0x77')]=function(_0x3450d9,_0x4f9024,_0x1783b2){var _0x575773={};var _0x4f3ae5={};var _0x4995da;var _0x303021;return db[_0x82e8('0x3f')]['findOne']({'where':{'id':_0x3450d9[_0x82e8('0x57')]['id']}})[_0x82e8('0x21')](handleEntityNotFound(_0x4f9024,null))[_0x82e8('0x21')](function(_0x310b7f){if(_0x310b7f){_0x4995da=_0x310b7f;_0x4f3ae5[_0x82e8('0x43')]=_[_0x82e8('0x45')](db[_0x82e8('0x78')][_0x82e8('0x40')]);_0x4f3ae5[_0x82e8('0x44')]=_[_0x82e8('0x45')](_0x3450d9[_0x82e8('0x44')]);_0x4f3ae5[_0x82e8('0x46')]=_[_0x82e8('0x48')](_0x4f3ae5[_0x82e8('0x43')],_0x4f3ae5['query']);_0x575773[_0x82e8('0x47')]=_['intersection'](_0x4f3ae5[_0x82e8('0x43')],qs[_0x82e8('0x59')](_0x3450d9[_0x82e8('0x44')][_0x82e8('0x59')]));_0x575773[_0x82e8('0x47')]=_0x575773['attributes'][_0x82e8('0x49')]?_0x575773[_0x82e8('0x47')]:_0x4f3ae5[_0x82e8('0x43')];_0x575773[_0x82e8('0x4c')]=qs[_0x82e8('0x4d')](_0x3450d9['query']['sort']);_0x575773['where']=qs[_0x82e8('0x46')](_['pick'](_0x3450d9[_0x82e8('0x44')],_0x4f3ae5['filters']));if(_0x3450d9[_0x82e8('0x44')]['filter']){_0x575773['where']=_[_0x82e8('0x51')](_0x575773['where'],{'$or':_[_0x82e8('0x3e')](_0x575773['attributes'],function(_0x8d9029){var _0xe87d0a={};_0xe87d0a[_0x8d9029]={'$like':'%'+_0x3450d9[_0x82e8('0x44')]['filter']+'%'};return _0xe87d0a;})});}_0x575773=_[_0x82e8('0x51')]({},_0x575773,_0x3450d9[_0x82e8('0x52')]);return _0x4995da['getAgents'](_0x575773);}})[_0x82e8('0x21')](function(_0x352cf7){if(_0x352cf7){_0x303021=_0x352cf7[_0x82e8('0x49')];if(!_0x3450d9['query'][_0x82e8('0x4a')]('nolimit')){_0x575773[_0x82e8('0x30')]=qs['limit'](_0x3450d9[_0x82e8('0x44')][_0x82e8('0x30')]);_0x575773['offset']=qs[_0x82e8('0x2e')](_0x3450d9['query'][_0x82e8('0x2e')]);}return _0x4995da['getAgents'](_0x575773);}})[_0x82e8('0x21')](function(_0x39d54c){if(_0x39d54c){return _0x39d54c?{'count':_0x303021,'rows':_0x39d54c}:null;}})['then'](respondWithResult(_0x4f9024,null))['catch'](handleError(_0x4f9024,null));};exports['addApplications']=function(_0x295aec,_0x2b22b9,_0x31ea47){return db[_0x82e8('0x3f')][_0x82e8('0x69')]({'where':{'id':_0x295aec[_0x82e8('0x57')]['id']}})[_0x82e8('0x21')](handleEntityNotFound(_0x2b22b9,null))[_0x82e8('0x21')](function(_0x28eb0a){if(_0x28eb0a){return db['sequelize'][_0x82e8('0x79')](function(_0x32e025){return db[_0x82e8('0x7a')]['destroy']({'where':{'WhatsappAccountId':_0x295aec[_0x82e8('0x57')]['id']},'transaction':_0x32e025})[_0x82e8('0x21')](function(_0x154f82){var _0x1a5b4b=_[_0x82e8('0x3e')](_0x295aec[_0x82e8('0x5b')],function(_0x3b540b){_0x3b540b[_0x82e8('0x66')]=_0x295aec[_0x82e8('0x57')]['id'];return _0x3b540b;});return db[_0x82e8('0x7a')][_0x82e8('0x7b')](_0x1a5b4b,{'transaction':_0x32e025});});})[_0x82e8('0x21')](function(){return db['WhatsappApplication']['findAndCountAll']({'where':{'WhatsappAccountId':_0x295aec['params']['id']},'order':'priority'});});}})[_0x82e8('0x21')](respondWithResult(_0x2b22b9,null))[_0x82e8('0x29')](handleError(_0x2b22b9,null));};exports['getApplications']=function(_0xe62648,_0x218c3d,_0x453870){var _0x3a5b76={};var _0x50ee5c={};var _0x45e500;var _0x3e8909;return db[_0x82e8('0x3f')][_0x82e8('0x69')]({'where':{'id':_0xe62648[_0x82e8('0x57')]['id']}})['then'](handleEntityNotFound(_0x218c3d,null))[_0x82e8('0x21')](function(_0x32b336){if(_0x32b336){_0x45e500=_0x32b336;_0x50ee5c[_0x82e8('0x43')]=_['keys'](db[_0x82e8('0x7a')][_0x82e8('0x40')]);_0x50ee5c['query']=_[_0x82e8('0x45')](_0xe62648[_0x82e8('0x44')]);_0x50ee5c[_0x82e8('0x46')]=_['intersection'](_0x50ee5c[_0x82e8('0x43')],_0x50ee5c[_0x82e8('0x44')]);_0x3a5b76[_0x82e8('0x47')]=_[_0x82e8('0x48')](_0x50ee5c[_0x82e8('0x43')],qs[_0x82e8('0x59')](_0xe62648[_0x82e8('0x44')][_0x82e8('0x59')]));_0x3a5b76[_0x82e8('0x47')]=_0x3a5b76['attributes']['length']?_0x3a5b76['attributes']:_0x50ee5c[_0x82e8('0x43')];_0x3a5b76[_0x82e8('0x4c')]=qs[_0x82e8('0x4d')](_0xe62648[_0x82e8('0x44')][_0x82e8('0x4d')]);_0x3a5b76['where']=qs['filters'](_[_0x82e8('0x4e')](_0xe62648[_0x82e8('0x44')],_0x50ee5c[_0x82e8('0x46')]));if(_0xe62648['query'][_0x82e8('0x4f')]){_0x3a5b76[_0x82e8('0x50')]=_['merge'](_0x3a5b76['where'],{'$or':_[_0x82e8('0x3e')](_0x3a5b76['attributes'],function(_0x111b4e){var _0x1ffcd7={};_0x1ffcd7[_0x111b4e]={'$like':'%'+_0xe62648[_0x82e8('0x44')][_0x82e8('0x4f')]+'%'};return _0x1ffcd7;})});}_0x3a5b76=_[_0x82e8('0x51')]({},_0x3a5b76,_0xe62648[_0x82e8('0x52')]);return _0x45e500['getApplications'](_0x3a5b76);}})['then'](function(_0x5d9e7c){if(_0x5d9e7c){_0x3e8909=_0x5d9e7c[_0x82e8('0x49')];if(!_0xe62648[_0x82e8('0x44')][_0x82e8('0x4a')]('nolimit')){_0x3a5b76[_0x82e8('0x30')]=qs[_0x82e8('0x30')](_0xe62648[_0x82e8('0x44')][_0x82e8('0x30')]);_0x3a5b76[_0x82e8('0x2e')]=qs[_0x82e8('0x2e')](_0xe62648[_0x82e8('0x44')]['offset']);}return _0x45e500[_0x82e8('0x7c')](_0x3a5b76);}})[_0x82e8('0x21')](function(_0x22f8b0){if(_0x22f8b0){return _0x22f8b0?{'count':_0x3e8909,'rows':_0x22f8b0}:null;}})[_0x82e8('0x21')](respondWithResult(_0x218c3d,null))[_0x82e8('0x29')](handleError(_0x218c3d,null));};exports[_0x82e8('0x7d')]=function(_0x4e885e,_0x873ac3,_0x190125){var _0xe46324={'channel':_0x82e8('0x7e')};var _0x281bc8=[];var _0x452cec=[];var _0xb404ab={};return db['WhatsappAccount'][_0x82e8('0x5a')]({'where':{'id':_0x4e885e[_0x82e8('0x57')]['id']},'include':[{'model':db[_0x82e8('0x7a')],'as':_0x82e8('0x7f')}]})['then'](handleEntityNotFound(_0x873ac3,null))[_0x82e8('0x21')](function(_0x594540){_0xe46324[_0x82e8('0x80')]=_0x594540;_0xe46324[_0x82e8('0x81')]=_[_0x82e8('0x82')](_0x594540['Applications'],['priority'],['asc']);if(_0xe46324['account'][_0x82e8('0x7f')]){delete _0xe46324[_0x82e8('0x80')][_0x82e8('0x7f')];}return db[_0x82e8('0x83')][_0x82e8('0x65')]();})[_0x82e8('0x21')](function(_0x35fd24){if(!_0x35fd24){throw new db[(_0x82e8('0x84'))]['ValidationError'](_0x82e8('0x85'));}_0x281bc8=_[_0x82e8('0x86')](_['keys'](_0x35fd24),['createdAt',_0x82e8('0x87')]);_0x452cec=_['difference'](_[_0x82e8('0x45')](_0x35fd24),[_0x82e8('0x88'),_0x82e8('0x87'),_0x82e8('0x89'),_0x82e8('0x8a')]);_0xe46324[_0x82e8('0x5b')]={'mapKey':_0x82e8('0x8b')};if(_0xe46324[_0x82e8('0x80')][_0x82e8('0x41')]&&_0xe46324[_0x82e8('0x80')][_0x82e8('0x41')]===_0x82e8('0x8c')){_0xe46324[_0x82e8('0x5b')][_0x82e8('0x8d')]=_0x4e885e['body'][_0x82e8('0x8e')][_0x82e8('0x8f')](_0x82e8('0x90'),'');_0xe46324[_0x82e8('0x5b')][_0x82e8('0x5b')]=_0x4e885e[_0x82e8('0x5b')][_0x82e8('0x91')];_0xe46324[_0x82e8('0x5b')][_0x82e8('0x92')]=_0x4e885e[_0x82e8('0x5b')][_0x82e8('0x93')];}if(_0xe46324[_0x82e8('0x5b')]['id']){delete _0xe46324[_0x82e8('0x5b')]['id'];}if(_[_0x82e8('0x94')](_0xe46324[_0x82e8('0x5b')][_0x82e8('0x8d')])){throw new db[(_0x82e8('0x84'))][(_0x82e8('0x95'))]('from\x20is\x20mandatory');}if(_[_0x82e8('0x94')](_0xe46324[_0x82e8('0x5b')][_0x82e8('0x5b')])||_0xe46324[_0x82e8('0x5b')][_0x82e8('0x5b')]===''){throw new db['Sequelize'][(_0x82e8('0x95'))](_0x82e8('0x96'));}if(_[_0x82e8('0x94')](_0xe46324[_0x82e8('0x5b')][_0x82e8('0x97')])){throw new db[(_0x82e8('0x84'))][(_0x82e8('0x95'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x452cec);}if(!_['includes'](_0x452cec,_0xe46324[_0x82e8('0x5b')][_0x82e8('0x97')])){throw new db['Sequelize'][(_0x82e8('0x95'))](_0x82e8('0x98')+_0x452cec);}_0xb404ab[_0xe46324[_0x82e8('0x5b')][_0x82e8('0x97')]]=_0xe46324['body'][_0x82e8('0x8d')];return db['CmList'][_0x82e8('0x5a')]({'where':{'id':_0xe46324[_0x82e8('0x80')][_0x82e8('0x8a')]},'include':[{'model':db[_0x82e8('0x83')],'as':_0x82e8('0x99'),'where':_0xb404ab,'limit':0x1,'order':[[_0x82e8('0x87'),_0x82e8('0x9a')]]}]});})[_0x82e8('0x21')](handleEntityNotFound(_0x873ac3,null))['then'](function(_0x398c65){if(_0x398c65){_0xe46324[_0x82e8('0x9b')]=_[_0x82e8('0x9c')](_0x398c65,[_0x82e8('0x99')]);if(_0x398c65[_0x82e8('0x99')][_0x82e8('0x49')]){return _0x398c65[_0x82e8('0x99')][0x0];}var _0x36542c=_[_0x82e8('0x9d')](_0xe46324[_0x82e8('0x5b')],{'firstName':_0xe46324['body'][_0x82e8('0x8d')],'ListId':_0x398c65['id']});_0x36542c[_0xe46324['body'][_0x82e8('0x97')]]=_0xe46324[_0x82e8('0x5b')][_0x82e8('0x8d')];return db[_0x82e8('0x83')][_0x82e8('0x62')](_0x36542c,{'fields':_0x281bc8,'raw':!![]});}})[_0x82e8('0x21')](handleEntityNotFound(_0x873ac3,null))[_0x82e8('0x21')](function(_0x5de20e){if(_0x5de20e){_0xe46324['contact']=_0x5de20e;var _0x583f1c={'ContactId':_0x5de20e['id'],'phone':_0xe46324[_0x82e8('0x5b')][_0x82e8('0x8d')],'WhatsappAccountId':_0x4e885e[_0x82e8('0x57')]['id']};var _0xa463f0={'ContactId':_0x5de20e['id'],'WhatsappAccountId':_0x4e885e[_0x82e8('0x57')]['id'],'closed':![]};return db['WhatsappInteraction']['find']({'where':_0xa463f0})[_0x82e8('0x21')](function(_0x43303b){if(_0x43303b){return[_0x43303b,![]];}return db['WhatsappInteraction'][_0x82e8('0x62')](_0x583f1c)[_0x82e8('0x21')](function(_0x2e9c7d){return[_0x2e9c7d,!![]];});});}})['spread'](function(_0x4f78bc,_0x3865e5){_0xe46324[_0x82e8('0x9e')]=_0x4f78bc[_0x82e8('0x35')]({'plain':!![]});_0xe46324['interaction'][_0x82e8('0x9f')]=![];if(_0x3865e5){if(_0xe46324[_0x82e8('0x80')][_0x82e8('0xa0')]){_0xe46324[_0x82e8('0x81')][_0x82e8('0xa1')]({'id':0x0,'priority':_0xe46324[_0x82e8('0x81')][_0x82e8('0x49')]+0x1,'app':_0x82e8('0xa2'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0xe46324[_0x82e8('0x9e')][_0x82e8('0x9f')]=!![];}return db[_0x82e8('0xa3')][_0x82e8('0x62')]({'phone':_0xe46324['body']['from'],'messageId':_0xe46324[_0x82e8('0x5b')][_0x82e8('0x92')],'body':_0xe46324[_0x82e8('0x5b')][_0x82e8('0x5b')],'WhatsappAccountId':_0x4e885e[_0x82e8('0x57')]['id'],'WhatsappInteractionId':_0x4f78bc['id'],'direction':'in','ContactId':_0x4f78bc[_0x82e8('0xa4')],'AttachmentId':_0xe46324[_0x82e8('0x5b')]['AttachmentId']});})[_0x82e8('0x21')](function(_0x526b50){_0xe46324[_0x82e8('0x28')]=_0x526b50;if(_0xe46324['interaction']['UserId']){return db[_0x82e8('0x78')][_0x82e8('0x5a')]({'attributes':['id',_0x82e8('0x3a')],'where':{'id':_0xe46324[_0x82e8('0x9e')]['UserId']}})[_0x82e8('0x21')](function(_0x2d7e9e){if(_0x2d7e9e){_0xe46324[_0x82e8('0x81')]['unshift']({'id':0x0,'priority':0x0,'app':_0x82e8('0xa5'),'appdata':_0x2d7e9e[_0x82e8('0x3a')]+','+(_0xe46324[_0x82e8('0x80')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0x82e8('0xa6'),_0xe46324);});}return respondWithRpcPromise(_0x82e8('0xa7'),'startRouting',_0xe46324);})[_0x82e8('0x21')](function(_0x2f0996){if(_0x2f0996){var _0x59e174=0xc8;var _0x318223=_0x82e8('0xa8');logger[_0x82e8('0x22')](_0x82e8('0x24'),_0x318223,_0x59e174,'entity\x20found');logger[_0x82e8('0xa9')](_0x82e8('0xaa'),_0x318223,_0x59e174,'entity\x20found',JSON[_0x82e8('0x25')](_0x2f0996));if(_0xe46324['account'][_0x82e8('0x41')]===_0x82e8('0x8c')){return _0x873ac3['status'](_0x59e174)[_0x82e8('0xab')]('Content-Type',_0x82e8('0xac'))['send'](_0x82e8('0xad'));}else{return _0x873ac3['status'](_0x59e174)[_0x82e8('0x2d')](_0x2f0996);}}})['catch'](handleError(_0x873ac3,null));};exports[_0x82e8('0x3b')]=function(_0x2b757f,_0x462112,_0x59eef2){var _0x2b9c04,_0x503444,_0x5d141f;if(_['isNil'](_0x2b757f[_0x82e8('0x5b')]['body'])||_0x2b757f[_0x82e8('0x5b')][_0x82e8('0x5b')]===''){throw new db[(_0x82e8('0x84'))]['ValidationError'](_0x82e8('0x96'));}if(_[_0x82e8('0x94')](_0x2b757f[_0x82e8('0x5b')]['to'])){throw new db['Sequelize'][(_0x82e8('0x95'))]('to\x20is\x20mandatory');}_0x2b9c04=_0x2b757f[_0x82e8('0x5b')]['to'];return db[_0x82e8('0x3f')][_0x82e8('0x5a')]({'where':{'id':_0x2b757f[_0x82e8('0x57')]['id']},'include':[{'model':db[_0x82e8('0xae')],'as':_0x82e8('0xaf'),'include':[{'model':db[_0x82e8('0x83')],'as':_0x82e8('0x99'),'where':{'mobile':_0x2b9c04},'limit':0x1,'order':[[_0x82e8('0x87'),_0x82e8('0x9a')]]}]}]})['then'](handleEntityNotFound(_0x462112,null))[_0x82e8('0x21')](function(_0x39d944){if(_0x39d944&&_0x39d944[_0x82e8('0xaf')]){_0x503444=_0x39d944['get']({'plain':!![]});if(_0x503444[_0x82e8('0xaf')]&&_0x503444[_0x82e8('0xaf')][_0x82e8('0x99')]['length']){return _0x503444[_0x82e8('0xaf')][_0x82e8('0x99')][0x0];}return db[_0x82e8('0x83')][_0x82e8('0x62')](_[_0x82e8('0x9d')](_0x2b757f[_0x82e8('0x5b')],{'firstName':_0x2b9c04,'mobile':_0x2b9c04,'phone':_0x2b9c04,'ListId':_0x503444[_0x82e8('0x8a')]}));}})[_0x82e8('0x21')](handleEntityNotFound(_0x462112,null))['then'](function(_0x97acfd){if(_0x97acfd){_0x5d141f=_0x97acfd;return db[_0x82e8('0xb0')]['find']({'where':{'ContactId':_0x5d141f['id'],'closed':![],'WhatsappAccountId':_0x503444['id']}})[_0x82e8('0x21')](function(_0x100986){if(_0x100986){return[_0x100986,![]];}return db[_0x82e8('0xb0')][_0x82e8('0x62')]({'UserId':_0x2b757f[_0x82e8('0x5c')]['id'],'ContactId':_0x5d141f['id'],'WhatsappAccountId':_0x503444['id'],'phone':_0x2b9c04,'firstMsgDirection':'out','Messages':[_[_0x82e8('0x51')](_0x2b757f[_0x82e8('0x5b')],{'read':![],'body':_0x2b757f['body'][_0x82e8('0x5b')],'phone':_0x2b9c04,'WhatsappAccountId':_0x503444['id'],'UserId':_0x2b757f[_0x82e8('0x5c')]['id'],'ContactId':_0x5d141f['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x82e8('0xb1')}]})[_0x82e8('0x21')](function(_0x5a0078){return[_0x5a0078,!![]];});});}})[_0x82e8('0x71')](function(_0x53c362,_0x248ccb){if(_0x248ccb){return _0x53c362;}return db[_0x82e8('0xa3')][_0x82e8('0x62')](_['merge'](_0x2b757f[_0x82e8('0x5b')],{'read':![],'body':_0x2b757f[_0x82e8('0x5b')][_0x82e8('0x5b')],'phone':_0x2b9c04,'WhatsappAccountId':_0x503444['id'],'WhatsappInteractionId':_0x53c362['id'],'UserId':_0x2b757f[_0x82e8('0x5c')]['id'],'ContactId':_0x5d141f['id']}))[_0x82e8('0x21')](function(_0x40ea00){_0x53c362[_0x82e8('0xb2')]['Messages']=[];_0x53c362[_0x82e8('0xb2')][_0x82e8('0xb1')][_0x82e8('0xa1')](_0x40ea00[_0x82e8('0xb2')]);return _0x53c362;});})['then'](respondWithResult(_0x462112,null))[_0x82e8('0x29')](handleError(_0x462112,null));}; \ No newline at end of file +var _0xf094=['findAll','rawAttributes','create','body','user','get','UserProfileSection','autoAssociation','update','find','params','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','order','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','hasOwnProperty','filter','rows','removeAnswers','addAgents','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','sequelize','transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','Applications','applications','orderBy','asc','account','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','mobile','from','From','replace','whatsapp:','Body','messageId','MessageSid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','list','omit','Contacts','contact','WhatsappInteraction','interaction','created','push','unmanaged','*,*,*,*','WhatsappMessage','User','UserId','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','debug','stringify','twilio','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','DESC','out','Messages','dataValues','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','client','http','request','info','WhatsappAccount,\x20%s,\x20%s','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','reject','save','then','destroy','WhatsappAccounts','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','map','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','sort','where','pick','merge','VIRTUAL','options','includeAll','include','WhatsappAccount'];(function(_0x862729,_0x15bc3c){var _0xc17ff5=function(_0x147ecc){while(--_0x147ecc){_0x862729['push'](_0x862729['shift']());}};_0xc17ff5(++_0x15bc3c);}(_0xf094,0x1e1));var _0x4f09=function(_0x4fcb07,_0x4a77a4){_0x4fcb07=_0x4fcb07-0x0;var _0xf2eeb=_0xf094[_0x4fcb07];return _0xf2eeb;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4f09('0x0'));var jsonpatch=require(_0x4f09('0x1'));var rp=require(_0x4f09('0x2'));var moment=require('moment');var BPromise=require(_0x4f09('0x3'));var Mustache=require(_0x4f09('0x4'));var util=require(_0x4f09('0x5'));var path=require(_0x4f09('0x6'));var sox=require(_0x4f09('0x7'));var csv=require(_0x4f09('0x8'));var ejs=require(_0x4f09('0x9'));var fs=require('fs');var fs_extra=require(_0x4f09('0xa'));var _=require(_0x4f09('0xb'));var squel=require(_0x4f09('0xc'));var crypto=require(_0x4f09('0xd'));var jsforce=require(_0x4f09('0xe'));var deskjs=require(_0x4f09('0xf'));var toCsv=require(_0x4f09('0x8'));var querystring=require(_0x4f09('0x10'));var Papa=require(_0x4f09('0x11'));var Redis=require(_0x4f09('0x12'));var authService=require(_0x4f09('0x13'));var qs=require(_0x4f09('0x14'));var as=require(_0x4f09('0x15'));var hardwareService=require(_0x4f09('0x16'));var logger=require(_0x4f09('0x17'))(_0x4f09('0x18'));var utils=require(_0x4f09('0x19'));var config=require(_0x4f09('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x4f09('0x1b'))['db'];config['redis']=_[_0x4f09('0x1c')](config[_0x4f09('0x1d')],{'host':_0x4f09('0x1e'),'port':0x18eb});var socket=require(_0x4f09('0x1f'))(new Redis(config['redis']));require(_0x4f09('0x20'))[_0x4f09('0x21')](socket);var jayson=require('jayson/promise');var client=jayson[_0x4f09('0x22')][_0x4f09('0x23')]({'port':0x232c});function respondWithRpcPromise(_0x4b7ed6,_0x3617c8,_0x2b6bbb,_0x5f4e2c){return new BPromise(function(_0x4838bf,_0x20e8ab){var _0x4466e1=_0x5f4e2c||client;return _0x4466e1[_0x4f09('0x24')](_0x4b7ed6,_0x2b6bbb)['then'](function(_0x595cae){logger[_0x4f09('0x25')](_0x4f09('0x26'),_0x3617c8,'request\x20sent');logger['debug'](_0x4f09('0x27'),_0x3617c8,_0x4f09('0x28'),JSON['stringify'](_0x595cae));if(_0x595cae[_0x4f09('0x29')]){if(_0x595cae['error'][_0x4f09('0x2a')]===0x1f4){logger[_0x4f09('0x29')](_0x4f09('0x26'),_0x3617c8,_0x595cae['error'][_0x4f09('0x2b')]);return _0x20e8ab(_0x595cae[_0x4f09('0x29')][_0x4f09('0x2b')]);}logger[_0x4f09('0x29')]('WhatsappAccount,\x20%s,\x20%s',_0x3617c8,_0x595cae['error']['message']);return _0x4838bf(_0x595cae['error']['message']);}else{logger[_0x4f09('0x25')](_0x4f09('0x26'),_0x3617c8,_0x4f09('0x28'));_0x4838bf(_0x595cae[_0x4f09('0x2c')]['message']);}})[_0x4f09('0x2d')](function(_0x305b13){logger[_0x4f09('0x29')](_0x4f09('0x26'),_0x3617c8,_0x305b13);_0x20e8ab(_0x305b13);});});}function respondWithStatusCode(_0x4aed5c,_0x182df3){_0x182df3=_0x182df3||0xcc;return function(_0x4f7a80){if(_0x4f7a80){return _0x4aed5c[_0x4f09('0x2e')](_0x182df3);}return _0x4aed5c[_0x4f09('0x2f')](_0x182df3)[_0x4f09('0x30')]();};}function respondWithResult(_0x2651fb,_0x4295fb){_0x4295fb=_0x4295fb||0xc8;return function(_0x2054d5){if(_0x2054d5){return _0x2651fb[_0x4f09('0x2f')](_0x4295fb)[_0x4f09('0x31')](_0x2054d5);}};}function respondWithFilteredResult(_0x34e908,_0x41b6f1){return function(_0x3a153e){if(_0x3a153e){var _0x2b74e7=typeof _0x41b6f1[_0x4f09('0x32')]==='undefined'&&typeof _0x41b6f1['limit']==='undefined';var _0x56c4fa=_0x3a153e[_0x4f09('0x33')];var _0x492026=_0x2b74e7?0x0:_0x41b6f1['offset'];var _0x5e3680=_0x2b74e7?_0x3a153e[_0x4f09('0x33')]:_0x41b6f1[_0x4f09('0x32')]+_0x41b6f1[_0x4f09('0x34')];var _0x3d6e74;if(_0x5e3680>=_0x56c4fa){_0x5e3680=_0x56c4fa;_0x3d6e74=0xc8;}else{_0x3d6e74=0xce;}_0x34e908[_0x4f09('0x2f')](_0x3d6e74);return _0x34e908[_0x4f09('0x35')](_0x4f09('0x36'),_0x492026+'-'+_0x5e3680+'/'+_0x56c4fa)['json'](_0x3a153e);}return null;};}function patchUpdates(_0x5dca34){return function(_0x4313cc){try{jsonpatch[_0x4f09('0x37')](_0x4313cc,_0x5dca34,!![]);}catch(_0x73bbe){return BPromise[_0x4f09('0x38')](_0x73bbe);}return _0x4313cc[_0x4f09('0x39')]();};}function saveUpdates(_0x556fef,_0x79bb3e){return function(_0x40d3aa){if(_0x40d3aa){return _0x40d3aa['update'](_0x556fef)[_0x4f09('0x3a')](function(_0x268689){return _0x268689;});}return null;};}function removeEntity(_0x3235b8,_0x8f1193){return function(_0x744383){if(_0x744383){return _0x744383[_0x4f09('0x3b')]()[_0x4f09('0x3a')](function(){var _0x58c0b4=_0x744383['get']({'plain':!![]});var _0x39cbb2=_0x4f09('0x3c');return db[_0x4f09('0x3d')][_0x4f09('0x3b')]({'where':{'type':_0x39cbb2,'resourceId':_0x58c0b4['id']}})['then'](function(){return _0x744383;});})['then'](function(){_0x3235b8['status'](0xcc)[_0x4f09('0x30')]();});}};}function handleEntityNotFound(_0x12d38a,_0xf7c852){return function(_0x4ecb3f){if(!_0x4ecb3f){_0x12d38a[_0x4f09('0x2e')](0x194);}return _0x4ecb3f;};}function handleError(_0x6ee8bb,_0x317643){_0x317643=_0x317643||0x1f4;return function(_0x2460b6){logger[_0x4f09('0x29')](_0x2460b6[_0x4f09('0x3e')]);if(_0x2460b6[_0x4f09('0x3f')]){delete _0x2460b6[_0x4f09('0x3f')];}_0x6ee8bb['status'](_0x317643)[_0x4f09('0x40')](_0x2460b6);};}exports['index']=function(_0x2cb173,_0x31e75b){var _0x3b2b95={'include':[{'model':db[_0x4f09('0x41')],'as':_0x4f09('0x42')}]},_0x20a3fc={},_0x72a674={'count':0x0,'rows':[]};var _0x386034=_[_0x4f09('0x43')](db['WhatsappAccount']['rawAttributes'],function(_0x334f7b){return{'name':_0x334f7b[_0x4f09('0x44')],'type':_0x334f7b[_0x4f09('0x45')][_0x4f09('0x46')]};});_0x20a3fc['model']=_['map'](_0x386034,_0x4f09('0x3f'));_0x20a3fc[_0x4f09('0x47')]=_[_0x4f09('0x48')](_0x2cb173['query']);_0x20a3fc[_0x4f09('0x49')]=_['intersection'](_0x20a3fc['model'],_0x20a3fc[_0x4f09('0x47')]);_0x3b2b95['attributes']=_[_0x4f09('0x4a')](_0x20a3fc[_0x4f09('0x4b')],qs[_0x4f09('0x4c')](_0x2cb173[_0x4f09('0x47')][_0x4f09('0x4c')]));_0x3b2b95[_0x4f09('0x4d')]=_0x3b2b95[_0x4f09('0x4d')][_0x4f09('0x4e')]?_0x3b2b95[_0x4f09('0x4d')]:_0x20a3fc[_0x4f09('0x4b')];if(!_0x2cb173[_0x4f09('0x47')]['hasOwnProperty'](_0x4f09('0x4f'))){_0x3b2b95['limit']=qs[_0x4f09('0x34')](_0x2cb173[_0x4f09('0x47')]['limit']);_0x3b2b95[_0x4f09('0x32')]=qs[_0x4f09('0x32')](_0x2cb173[_0x4f09('0x47')][_0x4f09('0x32')]);}_0x3b2b95['order']=qs[_0x4f09('0x50')](_0x2cb173['query'][_0x4f09('0x50')]);_0x3b2b95[_0x4f09('0x51')]=qs[_0x4f09('0x49')](_[_0x4f09('0x52')](_0x2cb173[_0x4f09('0x47')],_0x20a3fc[_0x4f09('0x49')]),_0x386034);if(_0x2cb173[_0x4f09('0x47')]['filter']){_0x3b2b95[_0x4f09('0x51')]=_[_0x4f09('0x53')](_0x3b2b95[_0x4f09('0x51')],{'$or':_[_0x4f09('0x43')](_0x386034,function(_0x5382ad){if(_0x5382ad[_0x4f09('0x45')]!==_0x4f09('0x54')){var _0x3d799c={};_0x3d799c[_0x5382ad['name']]={'$like':'%'+_0x2cb173['query']['filter']+'%'};return _0x3d799c;}})});}_0x3b2b95=_['merge']({},_0x3b2b95,_0x2cb173[_0x4f09('0x55')]);var _0x294e4a={'where':_0x3b2b95[_0x4f09('0x51')]};return db['WhatsappAccount']['count'](_0x294e4a)[_0x4f09('0x3a')](function(_0x561ee0){_0x72a674[_0x4f09('0x33')]=_0x561ee0;if(_0x2cb173[_0x4f09('0x47')][_0x4f09('0x56')]){_0x3b2b95[_0x4f09('0x57')]=[{'all':!![]}];}return db[_0x4f09('0x58')][_0x4f09('0x59')](_0x3b2b95);})[_0x4f09('0x3a')](function(_0x369ae2){_0x72a674['rows']=_0x369ae2;return _0x72a674;})['then'](respondWithFilteredResult(_0x31e75b,_0x3b2b95))[_0x4f09('0x2d')](handleError(_0x31e75b,null));};exports['show']=function(_0x27e8f6,_0x1c2cc4){var _0x49a29e={'raw':![],'where':{'id':_0x27e8f6['params']['id']},'include':[{'model':db[_0x4f09('0x41')],'as':_0x4f09('0x42')}]},_0x2c0a2b={};_0x2c0a2b[_0x4f09('0x4b')]=_['keys'](db[_0x4f09('0x58')][_0x4f09('0x5a')]);_0x2c0a2b[_0x4f09('0x47')]=_[_0x4f09('0x48')](_0x27e8f6[_0x4f09('0x47')]);_0x2c0a2b[_0x4f09('0x49')]=_['intersection'](_0x2c0a2b[_0x4f09('0x4b')],_0x2c0a2b[_0x4f09('0x47')]);_0x49a29e[_0x4f09('0x4d')]=_[_0x4f09('0x4a')](_0x2c0a2b[_0x4f09('0x4b')],qs[_0x4f09('0x4c')](_0x27e8f6[_0x4f09('0x47')][_0x4f09('0x4c')]));_0x49a29e[_0x4f09('0x4d')]=_0x49a29e[_0x4f09('0x4d')][_0x4f09('0x4e')]?_0x49a29e[_0x4f09('0x4d')]:_0x2c0a2b[_0x4f09('0x4b')];if(_0x27e8f6[_0x4f09('0x47')][_0x4f09('0x56')]){_0x49a29e['include']=[{'all':!![]}];}_0x49a29e=_[_0x4f09('0x53')]({},_0x49a29e,_0x27e8f6[_0x4f09('0x55')]);return db['WhatsappAccount']['find'](_0x49a29e)[_0x4f09('0x3a')](handleEntityNotFound(_0x1c2cc4,null))[_0x4f09('0x3a')](respondWithResult(_0x1c2cc4,null))[_0x4f09('0x2d')](handleError(_0x1c2cc4,null));};exports[_0x4f09('0x5b')]=function(_0x49b7c9,_0x32c527){return db[_0x4f09('0x58')][_0x4f09('0x5b')](_0x49b7c9[_0x4f09('0x5c')],{})[_0x4f09('0x3a')](function(_0x4b07db){var _0x57de4a=_0x49b7c9[_0x4f09('0x5d')]['get']({'plain':!![]});if(!_0x57de4a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x57de4a['role']==='user'){var _0x5ebc5d=_0x4b07db[_0x4f09('0x5e')]({'plain':!![]});var _0x5bde0f=_0x4f09('0x3c');return db[_0x4f09('0x5f')]['find']({'where':{'name':_0x5bde0f,'userProfileId':_0x57de4a['userProfileId']},'raw':!![]})[_0x4f09('0x3a')](function(_0x1c3132){if(_0x1c3132&&_0x1c3132[_0x4f09('0x60')]===0x0){return db[_0x4f09('0x3d')][_0x4f09('0x5b')]({'name':_0x5ebc5d['name'],'resourceId':_0x5ebc5d['id'],'type':_0x1c3132[_0x4f09('0x3f')],'sectionId':_0x1c3132['id']},{})['then'](function(){return _0x4b07db;});}else{return _0x4b07db;}})['catch'](function(_0x30d1b4){logger[_0x4f09('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x30d1b4);throw _0x30d1b4;});}return _0x4b07db;})[_0x4f09('0x3a')](respondWithResult(_0x32c527,0xc9))[_0x4f09('0x2d')](handleError(_0x32c527,null));};exports[_0x4f09('0x61')]=function(_0x578fac,_0x4a26b3){if(_0x578fac[_0x4f09('0x5c')]['id']){delete _0x578fac[_0x4f09('0x5c')]['id'];}return db[_0x4f09('0x58')][_0x4f09('0x62')]({'where':{'id':_0x578fac[_0x4f09('0x63')]['id']},'include':[{'model':db[_0x4f09('0x41')],'as':_0x4f09('0x42')}]})[_0x4f09('0x3a')](handleEntityNotFound(_0x4a26b3,null))[_0x4f09('0x3a')](saveUpdates(_0x578fac[_0x4f09('0x5c')],null))[_0x4f09('0x3a')](respondWithResult(_0x4a26b3,null))[_0x4f09('0x2d')](handleError(_0x4a26b3,null));};exports[_0x4f09('0x3b')]=function(_0x4ea7ed,_0x18f997){return db[_0x4f09('0x58')][_0x4f09('0x62')]({'where':{'id':_0x4ea7ed[_0x4f09('0x63')]['id']}})[_0x4f09('0x3a')](handleEntityNotFound(_0x18f997,null))[_0x4f09('0x3a')](removeEntity(_0x18f997,null))[_0x4f09('0x2d')](handleError(_0x18f997,null));};exports[_0x4f09('0x64')]=function(_0x21a007,_0x13e6e0){return db[_0x4f09('0x58')][_0x4f09('0x64')]()[_0x4f09('0x3a')](respondWithResult(_0x13e6e0,null))[_0x4f09('0x2d')](handleError(_0x13e6e0,null));};exports[_0x4f09('0x65')]=function(_0xc7985,_0x4a2196,_0x5e9617){if(_0xc7985['body']['id']){delete _0xc7985[_0x4f09('0x5c')]['id'];}return db[_0x4f09('0x58')]['find']({'where':{'id':_0xc7985[_0x4f09('0x63')]['id']}})[_0x4f09('0x3a')](handleEntityNotFound(_0x4a2196,null))[_0x4f09('0x3a')](function(_0x327650){if(_0x327650){_0xc7985[_0x4f09('0x5c')][_0x4f09('0x66')]=_0x327650['id'];return db[_0x4f09('0x67')][_0x4f09('0x5b')](_0xc7985[_0x4f09('0x5c')]);}})[_0x4f09('0x3a')](respondWithResult(_0x4a2196,null))[_0x4f09('0x2d')](handleError(_0x4a2196,null));};exports[_0x4f09('0x68')]=function(_0x319b14,_0x19f7f0,_0x5e5243){var _0x263cd5={'raw':![],'where':{}};var _0x1f0367={};var _0x12ebe8={'count':0x0,'rows':[]};return db[_0x4f09('0x58')][_0x4f09('0x69')]({'where':{'id':_0x319b14[_0x4f09('0x63')]['id']}})[_0x4f09('0x3a')](handleEntityNotFound(_0x19f7f0,null))['then'](function(_0x4810ee){if(_0x4810ee){_0x1f0367[_0x4f09('0x4b')]=_[_0x4f09('0x48')](db[_0x4f09('0x67')]['rawAttributes']);_0x1f0367['query']=_[_0x4f09('0x48')](_0x319b14[_0x4f09('0x47')]);_0x1f0367[_0x4f09('0x49')]=_['intersection'](_0x1f0367['model'],_0x1f0367[_0x4f09('0x47')]);_0x263cd5[_0x4f09('0x4d')]=_['intersection'](_0x1f0367['model'],qs[_0x4f09('0x4c')](_0x319b14[_0x4f09('0x47')][_0x4f09('0x4c')]));_0x263cd5[_0x4f09('0x4d')]=_0x263cd5[_0x4f09('0x4d')][_0x4f09('0x4e')]?_0x263cd5[_0x4f09('0x4d')]:_0x1f0367[_0x4f09('0x4b')];if(!_0x319b14[_0x4f09('0x47')]['hasOwnProperty']('nolimit')){_0x263cd5[_0x4f09('0x34')]=qs['limit'](_0x319b14[_0x4f09('0x47')][_0x4f09('0x34')]);_0x263cd5['offset']=qs[_0x4f09('0x32')](_0x319b14[_0x4f09('0x47')][_0x4f09('0x32')]);}_0x263cd5[_0x4f09('0x6a')]=qs[_0x4f09('0x50')](_0x319b14[_0x4f09('0x47')]['sort']);_0x263cd5[_0x4f09('0x51')]=qs[_0x4f09('0x49')](_['pick'](_0x319b14[_0x4f09('0x47')],_0x1f0367[_0x4f09('0x49')]));_0x263cd5[_0x4f09('0x51')][_0x4f09('0x66')]=_0x4810ee['id'];if(_0x319b14[_0x4f09('0x47')]['filter']){_0x263cd5['where']=_[_0x4f09('0x53')](_0x263cd5[_0x4f09('0x51')],{'$or':_[_0x4f09('0x43')](_0x263cd5['attributes'],function(_0x5129ec){var _0x40aaac={};_0x40aaac[_0x5129ec]={'$like':'%'+_0x319b14['query']['filter']+'%'};return _0x40aaac;})});}_0x263cd5=_[_0x4f09('0x53')]({},_0x263cd5,_0x319b14[_0x4f09('0x55')]);return db[_0x4f09('0x67')][_0x4f09('0x33')]({'where':_0x263cd5[_0x4f09('0x51')]})[_0x4f09('0x3a')](function(_0x26034c){_0x12ebe8[_0x4f09('0x33')]=_0x26034c;if(_0x319b14[_0x4f09('0x47')][_0x4f09('0x56')]){_0x263cd5[_0x4f09('0x57')]=[{'all':!![]}];}return db[_0x4f09('0x67')]['findAll'](_0x263cd5);})[_0x4f09('0x3a')](function(_0x5a73d0){_0x12ebe8['rows']=_0x5a73d0;return _0x12ebe8;});}})[_0x4f09('0x3a')](respondWithFilteredResult(_0x19f7f0,_0x263cd5))[_0x4f09('0x2d')](handleError(_0x19f7f0,null));};exports[_0x4f09('0x6b')]=function(_0x42beac,_0x5443cd,_0x3e2c31){return db[_0x4f09('0x58')][_0x4f09('0x62')]({'where':{'id':_0x42beac[_0x4f09('0x63')]['id']}})['then'](handleEntityNotFound(_0x5443cd,null))[_0x4f09('0x3a')](function(_0x4e85b7){if(_0x4e85b7){return _0x4e85b7['removeDispositions'](_0x42beac[_0x4f09('0x47')][_0x4f09('0x6c')]);}})[_0x4f09('0x3a')](respondWithStatusCode(_0x5443cd,null))['catch'](handleError(_0x5443cd,null));};exports[_0x4f09('0x6d')]=function(_0x4fe7a2,_0xde6f5e,_0x57785f){if(_0x4fe7a2[_0x4f09('0x5c')]['id']){delete _0x4fe7a2[_0x4f09('0x5c')]['id'];}return db[_0x4f09('0x58')][_0x4f09('0x62')]({'where':{'id':_0x4fe7a2[_0x4f09('0x63')]['id']}})[_0x4f09('0x3a')](handleEntityNotFound(_0xde6f5e,null))[_0x4f09('0x3a')](function(_0x1b888c){if(_0x1b888c){_0x4fe7a2[_0x4f09('0x5c')]['WhatsappAccountId']=_0x1b888c['id'];return db[_0x4f09('0x6e')]['create'](_0x4fe7a2[_0x4f09('0x5c')]);}})[_0x4f09('0x3a')](respondWithResult(_0xde6f5e,null))[_0x4f09('0x2d')](handleError(_0xde6f5e,null));};exports[_0x4f09('0x6f')]=function(_0x1404e4,_0x19979f,_0x3827cd){var _0x288976={'raw':![],'where':{}};var _0xf710aa={};var _0x279063={'count':0x0,'rows':[]};return db[_0x4f09('0x58')][_0x4f09('0x69')]({'where':{'id':_0x1404e4[_0x4f09('0x63')]['id']}})[_0x4f09('0x3a')](handleEntityNotFound(_0x19979f,null))['then'](function(_0x5d3363){if(_0x5d3363){_0xf710aa[_0x4f09('0x4b')]=_['keys'](db[_0x4f09('0x6e')][_0x4f09('0x5a')]);_0xf710aa[_0x4f09('0x47')]=_[_0x4f09('0x48')](_0x1404e4[_0x4f09('0x47')]);_0xf710aa[_0x4f09('0x49')]=_[_0x4f09('0x4a')](_0xf710aa['model'],_0xf710aa[_0x4f09('0x47')]);_0x288976[_0x4f09('0x4d')]=_[_0x4f09('0x4a')](_0xf710aa['model'],qs[_0x4f09('0x4c')](_0x1404e4['query'][_0x4f09('0x4c')]));_0x288976[_0x4f09('0x4d')]=_0x288976['attributes']['length']?_0x288976[_0x4f09('0x4d')]:_0xf710aa[_0x4f09('0x4b')];if(!_0x1404e4[_0x4f09('0x47')][_0x4f09('0x70')](_0x4f09('0x4f'))){_0x288976[_0x4f09('0x34')]=qs[_0x4f09('0x34')](_0x1404e4['query'][_0x4f09('0x34')]);_0x288976['offset']=qs[_0x4f09('0x32')](_0x1404e4[_0x4f09('0x47')][_0x4f09('0x32')]);}_0x288976[_0x4f09('0x6a')]=qs[_0x4f09('0x50')](_0x1404e4[_0x4f09('0x47')]['sort']);_0x288976['where']=qs[_0x4f09('0x49')](_[_0x4f09('0x52')](_0x1404e4[_0x4f09('0x47')],_0xf710aa[_0x4f09('0x49')]));_0x288976[_0x4f09('0x51')][_0x4f09('0x66')]=_0x5d3363['id'];if(_0x1404e4[_0x4f09('0x47')][_0x4f09('0x71')]){_0x288976[_0x4f09('0x51')]=_[_0x4f09('0x53')](_0x288976[_0x4f09('0x51')],{'$or':_[_0x4f09('0x43')](_0x288976[_0x4f09('0x4d')],function(_0x2fea18){var _0xfd91aa={};_0xfd91aa[_0x2fea18]={'$like':'%'+_0x1404e4[_0x4f09('0x47')][_0x4f09('0x71')]+'%'};return _0xfd91aa;})});}_0x288976=_[_0x4f09('0x53')]({},_0x288976,_0x1404e4[_0x4f09('0x55')]);return db[_0x4f09('0x6e')][_0x4f09('0x33')]({'where':_0x288976['where']})[_0x4f09('0x3a')](function(_0xe78bef){_0x279063[_0x4f09('0x33')]=_0xe78bef;if(_0x1404e4[_0x4f09('0x47')][_0x4f09('0x56')]){_0x288976[_0x4f09('0x57')]=[{'all':!![]}];}return db[_0x4f09('0x6e')]['findAll'](_0x288976);})[_0x4f09('0x3a')](function(_0x34c550){_0x279063[_0x4f09('0x72')]=_0x34c550;return _0x279063;});}})[_0x4f09('0x3a')](respondWithFilteredResult(_0x19979f,_0x288976))[_0x4f09('0x2d')](handleError(_0x19979f,null));};exports[_0x4f09('0x73')]=function(_0x44234d,_0x5736ec,_0x20e988){return db[_0x4f09('0x58')][_0x4f09('0x62')]({'where':{'id':_0x44234d[_0x4f09('0x63')]['id']}})[_0x4f09('0x3a')](handleEntityNotFound(_0x5736ec,null))[_0x4f09('0x3a')](function(_0x596a75){if(_0x596a75){return _0x596a75[_0x4f09('0x73')](_0x44234d[_0x4f09('0x47')][_0x4f09('0x6c')]);}})[_0x4f09('0x3a')](respondWithStatusCode(_0x5736ec,null))['catch'](handleError(_0x5736ec,null));};exports['addAgents']=function(_0x33a3e4,_0x1cdeef,_0x1ce378){return db[_0x4f09('0x58')]['find']({'where':{'id':_0x33a3e4[_0x4f09('0x63')]['id']}})['then'](handleEntityNotFound(_0x1cdeef,null))[_0x4f09('0x3a')](function(_0x8bc913){if(_0x8bc913){return _0x8bc913[_0x4f09('0x74')](_0x33a3e4[_0x4f09('0x5c')][_0x4f09('0x6c')],_['omit'](_0x33a3e4['body'],['ids','id'])||{})[_0x4f09('0x75')](function(_0x4c542c){for(var _0x108c59=0x0;_0x108c59<_0x33a3e4[_0x4f09('0x5c')][_0x4f09('0x6c')]['length'];_0x108c59+=0x1){socket[_0x4f09('0x76')](_0x4f09('0x77'),{'UserId':Number(_0x33a3e4['body'][_0x4f09('0x6c')][_0x108c59]),'WhatsappAccountId':Number(_0x33a3e4[_0x4f09('0x63')]['id'])});}return _0x4c542c;});}})['then'](respondWithResult(_0x1cdeef,null))['catch'](handleError(_0x1cdeef,null));};exports[_0x4f09('0x78')]=function(_0xcdc11,_0xeca79d,_0xd5aae2){return db[_0x4f09('0x58')]['find']({'where':{'id':_0xcdc11[_0x4f09('0x63')]['id']}})['then'](handleEntityNotFound(_0xeca79d,null))[_0x4f09('0x3a')](function(_0xcf304a){if(_0xcf304a){return _0xcf304a[_0x4f09('0x78')](_0xcdc11['query']['ids'])['then'](function(){if(_[_0x4f09('0x79')](_0xcdc11['query']['ids'])){for(var _0x1f30ff=0x0;_0x1f30ff<_0xcdc11['query'][_0x4f09('0x6c')][_0x4f09('0x4e')];_0x1f30ff+=0x1){socket[_0x4f09('0x76')](_0x4f09('0x7a'),{'UserId':Number(_0xcdc11[_0x4f09('0x47')][_0x4f09('0x6c')][_0x1f30ff]),'WhatsappAccountId':Number(_0xcdc11[_0x4f09('0x63')]['id'])});}}else{socket['emit'](_0x4f09('0x7a'),{'UserId':Number(_0xcdc11[_0x4f09('0x47')]['ids']),'WhatsappAccountId':Number(_0xcdc11[_0x4f09('0x63')]['id'])});}});}})[_0x4f09('0x3a')](respondWithStatusCode(_0xeca79d,null))[_0x4f09('0x2d')](handleError(_0xeca79d,null));};exports['getAgents']=function(_0x5b1ebf,_0x16d878,_0x34ce50){var _0x5d868b={};var _0xecbe3d={};var _0x4cefc5;var _0x46e649;return db[_0x4f09('0x58')][_0x4f09('0x69')]({'where':{'id':_0x5b1ebf[_0x4f09('0x63')]['id']}})['then'](handleEntityNotFound(_0x16d878,null))[_0x4f09('0x3a')](function(_0x2588d5){if(_0x2588d5){_0x4cefc5=_0x2588d5;_0xecbe3d[_0x4f09('0x4b')]=_[_0x4f09('0x48')](db['User']['rawAttributes']);_0xecbe3d[_0x4f09('0x47')]=_['keys'](_0x5b1ebf['query']);_0xecbe3d[_0x4f09('0x49')]=_[_0x4f09('0x4a')](_0xecbe3d[_0x4f09('0x4b')],_0xecbe3d[_0x4f09('0x47')]);_0x5d868b[_0x4f09('0x4d')]=_[_0x4f09('0x4a')](_0xecbe3d[_0x4f09('0x4b')],qs[_0x4f09('0x4c')](_0x5b1ebf[_0x4f09('0x47')]['fields']));_0x5d868b[_0x4f09('0x4d')]=_0x5d868b[_0x4f09('0x4d')][_0x4f09('0x4e')]?_0x5d868b['attributes']:_0xecbe3d['model'];_0x5d868b[_0x4f09('0x6a')]=qs[_0x4f09('0x50')](_0x5b1ebf[_0x4f09('0x47')][_0x4f09('0x50')]);_0x5d868b[_0x4f09('0x51')]=qs['filters'](_[_0x4f09('0x52')](_0x5b1ebf[_0x4f09('0x47')],_0xecbe3d['filters']));if(_0x5b1ebf['query']['filter']){_0x5d868b[_0x4f09('0x51')]=_[_0x4f09('0x53')](_0x5d868b[_0x4f09('0x51')],{'$or':_[_0x4f09('0x43')](_0x5d868b['attributes'],function(_0xbb1900){var _0x3fd618={};_0x3fd618[_0xbb1900]={'$like':'%'+_0x5b1ebf['query'][_0x4f09('0x71')]+'%'};return _0x3fd618;})});}_0x5d868b=_['merge']({},_0x5d868b,_0x5b1ebf['options']);return _0x4cefc5[_0x4f09('0x7b')](_0x5d868b);}})[_0x4f09('0x3a')](function(_0x3f0766){if(_0x3f0766){_0x46e649=_0x3f0766[_0x4f09('0x4e')];if(!_0x5b1ebf[_0x4f09('0x47')][_0x4f09('0x70')](_0x4f09('0x4f'))){_0x5d868b[_0x4f09('0x34')]=qs[_0x4f09('0x34')](_0x5b1ebf[_0x4f09('0x47')][_0x4f09('0x34')]);_0x5d868b['offset']=qs['offset'](_0x5b1ebf[_0x4f09('0x47')][_0x4f09('0x32')]);}return _0x4cefc5[_0x4f09('0x7b')](_0x5d868b);}})[_0x4f09('0x3a')](function(_0x182281){if(_0x182281){return _0x182281?{'count':_0x46e649,'rows':_0x182281}:null;}})[_0x4f09('0x3a')](respondWithResult(_0x16d878,null))[_0x4f09('0x2d')](handleError(_0x16d878,null));};exports['addApplications']=function(_0xb7ba5e,_0x87f303,_0x2bda02){return db[_0x4f09('0x58')][_0x4f09('0x69')]({'where':{'id':_0xb7ba5e[_0x4f09('0x63')]['id']}})[_0x4f09('0x3a')](handleEntityNotFound(_0x87f303,null))[_0x4f09('0x3a')](function(_0x582498){if(_0x582498){return db[_0x4f09('0x7c')][_0x4f09('0x7d')](function(_0x107d6c){return db['WhatsappApplication']['destroy']({'where':{'WhatsappAccountId':_0xb7ba5e[_0x4f09('0x63')]['id']},'transaction':_0x107d6c})[_0x4f09('0x3a')](function(_0x409ea2){var _0x47fb7d=_[_0x4f09('0x43')](_0xb7ba5e['body'],function(_0x324c94){_0x324c94['WhatsappAccountId']=_0xb7ba5e[_0x4f09('0x63')]['id'];return _0x324c94;});return db[_0x4f09('0x7e')][_0x4f09('0x7f')](_0x47fb7d,{'transaction':_0x107d6c});});})['then'](function(){return db[_0x4f09('0x7e')][_0x4f09('0x80')]({'where':{'WhatsappAccountId':_0xb7ba5e[_0x4f09('0x63')]['id']},'order':_0x4f09('0x81')});});}})[_0x4f09('0x3a')](respondWithResult(_0x87f303,null))[_0x4f09('0x2d')](handleError(_0x87f303,null));};exports[_0x4f09('0x82')]=function(_0x5a4ed7,_0x2f5c21,_0x143dfa){var _0x925c6a={};var _0x28ee85={};var _0x1d41b7;var _0x58714b;return db[_0x4f09('0x58')][_0x4f09('0x69')]({'where':{'id':_0x5a4ed7[_0x4f09('0x63')]['id']}})[_0x4f09('0x3a')](handleEntityNotFound(_0x2f5c21,null))[_0x4f09('0x3a')](function(_0x1668a9){if(_0x1668a9){_0x1d41b7=_0x1668a9;_0x28ee85['model']=_[_0x4f09('0x48')](db[_0x4f09('0x7e')][_0x4f09('0x5a')]);_0x28ee85['query']=_['keys'](_0x5a4ed7[_0x4f09('0x47')]);_0x28ee85[_0x4f09('0x49')]=_[_0x4f09('0x4a')](_0x28ee85[_0x4f09('0x4b')],_0x28ee85['query']);_0x925c6a[_0x4f09('0x4d')]=_[_0x4f09('0x4a')](_0x28ee85[_0x4f09('0x4b')],qs[_0x4f09('0x4c')](_0x5a4ed7[_0x4f09('0x47')][_0x4f09('0x4c')]));_0x925c6a['attributes']=_0x925c6a[_0x4f09('0x4d')]['length']?_0x925c6a[_0x4f09('0x4d')]:_0x28ee85[_0x4f09('0x4b')];_0x925c6a['order']=qs[_0x4f09('0x50')](_0x5a4ed7[_0x4f09('0x47')][_0x4f09('0x50')]);_0x925c6a[_0x4f09('0x51')]=qs[_0x4f09('0x49')](_[_0x4f09('0x52')](_0x5a4ed7[_0x4f09('0x47')],_0x28ee85[_0x4f09('0x49')]));if(_0x5a4ed7[_0x4f09('0x47')]['filter']){_0x925c6a[_0x4f09('0x51')]=_['merge'](_0x925c6a[_0x4f09('0x51')],{'$or':_[_0x4f09('0x43')](_0x925c6a['attributes'],function(_0x135c20){var _0x1f15a5={};_0x1f15a5[_0x135c20]={'$like':'%'+_0x5a4ed7[_0x4f09('0x47')][_0x4f09('0x71')]+'%'};return _0x1f15a5;})});}_0x925c6a=_[_0x4f09('0x53')]({},_0x925c6a,_0x5a4ed7[_0x4f09('0x55')]);return _0x1d41b7[_0x4f09('0x82')](_0x925c6a);}})[_0x4f09('0x3a')](function(_0x50cfca){if(_0x50cfca){_0x58714b=_0x50cfca[_0x4f09('0x4e')];if(!_0x5a4ed7[_0x4f09('0x47')][_0x4f09('0x70')](_0x4f09('0x4f'))){_0x925c6a[_0x4f09('0x34')]=qs[_0x4f09('0x34')](_0x5a4ed7[_0x4f09('0x47')][_0x4f09('0x34')]);_0x925c6a[_0x4f09('0x32')]=qs[_0x4f09('0x32')](_0x5a4ed7[_0x4f09('0x47')][_0x4f09('0x32')]);}return _0x1d41b7[_0x4f09('0x82')](_0x925c6a);}})[_0x4f09('0x3a')](function(_0x3c866e){if(_0x3c866e){return _0x3c866e?{'count':_0x58714b,'rows':_0x3c866e}:null;}})['then'](respondWithResult(_0x2f5c21,null))[_0x4f09('0x2d')](handleError(_0x2f5c21,null));};exports[_0x4f09('0x83')]=function(_0x51d552,_0x26c7db,_0x4eab72){var _0x1f0e50={'channel':'whatsapp'};var _0x112a74=[];var _0x5d037b=[];var _0x28679a={};return db['WhatsappAccount']['find']({'where':{'id':_0x51d552[_0x4f09('0x63')]['id']},'include':[{'model':db[_0x4f09('0x7e')],'as':_0x4f09('0x84')}]})[_0x4f09('0x3a')](handleEntityNotFound(_0x26c7db,null))[_0x4f09('0x3a')](function(_0x5c37f9){_0x1f0e50['account']=_0x5c37f9;_0x1f0e50[_0x4f09('0x85')]=_[_0x4f09('0x86')](_0x5c37f9['Applications'],[_0x4f09('0x81')],[_0x4f09('0x87')]);if(_0x1f0e50[_0x4f09('0x88')][_0x4f09('0x84')]){delete _0x1f0e50[_0x4f09('0x88')]['Applications'];}return db[_0x4f09('0x89')][_0x4f09('0x64')]();})[_0x4f09('0x3a')](function(_0x28d32a){if(!_0x28d32a){throw new db[(_0x4f09('0x8a'))][(_0x4f09('0x8b'))](_0x4f09('0x8c'));}_0x112a74=_['difference'](_['keys'](_0x28d32a),[_0x4f09('0x8d'),_0x4f09('0x8e')]);_0x5d037b=_[_0x4f09('0x8f')](_['keys'](_0x28d32a),['createdAt',_0x4f09('0x8e'),_0x4f09('0x90'),_0x4f09('0x91')]);_0x1f0e50[_0x4f09('0x5c')]={'mapKey':_0x4f09('0x92')};if(_0x1f0e50['account'][_0x4f09('0x45')]&&_0x1f0e50[_0x4f09('0x88')][_0x4f09('0x45')]==='twilio'){_0x1f0e50[_0x4f09('0x5c')][_0x4f09('0x93')]=_0x51d552[_0x4f09('0x5c')][_0x4f09('0x94')][_0x4f09('0x95')](_0x4f09('0x96'),'');_0x1f0e50[_0x4f09('0x5c')][_0x4f09('0x5c')]=_0x51d552['body'][_0x4f09('0x97')];_0x1f0e50[_0x4f09('0x5c')][_0x4f09('0x98')]=_0x51d552['body'][_0x4f09('0x99')];}if(_0x1f0e50[_0x4f09('0x5c')]['id']){delete _0x1f0e50[_0x4f09('0x5c')]['id'];}if(_[_0x4f09('0x9a')](_0x1f0e50[_0x4f09('0x5c')][_0x4f09('0x93')])){throw new db['Sequelize'][(_0x4f09('0x8b'))](_0x4f09('0x9b'));}if(_[_0x4f09('0x9a')](_0x1f0e50[_0x4f09('0x5c')][_0x4f09('0x5c')])||_0x1f0e50['body'][_0x4f09('0x5c')]===''){throw new db['Sequelize'][(_0x4f09('0x8b'))](_0x4f09('0x9c'));}if(_['isNil'](_0x1f0e50[_0x4f09('0x5c')][_0x4f09('0x9d')])){throw new db[(_0x4f09('0x8a'))][(_0x4f09('0x8b'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5d037b);}if(!_['includes'](_0x5d037b,_0x1f0e50['body'][_0x4f09('0x9d')])){throw new db[(_0x4f09('0x8a'))][(_0x4f09('0x8b'))](_0x4f09('0x9e')+_0x5d037b);}_0x28679a[_0x1f0e50[_0x4f09('0x5c')][_0x4f09('0x9d')]]=_0x1f0e50[_0x4f09('0x5c')][_0x4f09('0x93')];return db[_0x4f09('0x9f')]['find']({'where':{'id':_0x1f0e50['account'][_0x4f09('0x91')]},'include':[{'model':db[_0x4f09('0x89')],'as':'Contacts','where':_0x28679a,'limit':0x1,'order':[[_0x4f09('0x8e'),'DESC']]}]});})['then'](handleEntityNotFound(_0x26c7db,null))[_0x4f09('0x3a')](function(_0x45beaf){if(_0x45beaf){_0x1f0e50[_0x4f09('0xa0')]=_[_0x4f09('0xa1')](_0x45beaf,[_0x4f09('0xa2')]);if(_0x45beaf[_0x4f09('0xa2')][_0x4f09('0x4e')]){return _0x45beaf[_0x4f09('0xa2')][0x0];}var _0x55cfae=_[_0x4f09('0x1c')](_0x1f0e50['body'],{'firstName':_0x1f0e50[_0x4f09('0x5c')][_0x4f09('0x93')],'ListId':_0x45beaf['id']});_0x55cfae[_0x1f0e50[_0x4f09('0x5c')]['mapKey']]=_0x1f0e50[_0x4f09('0x5c')]['from'];return db[_0x4f09('0x89')][_0x4f09('0x5b')](_0x55cfae,{'fields':_0x112a74,'raw':!![]});}})[_0x4f09('0x3a')](handleEntityNotFound(_0x26c7db,null))['then'](function(_0x4fa83d){if(_0x4fa83d){_0x1f0e50[_0x4f09('0xa3')]=_0x4fa83d;var _0x5c6aa5={'ContactId':_0x4fa83d['id'],'phone':_0x1f0e50[_0x4f09('0x5c')][_0x4f09('0x93')],'WhatsappAccountId':_0x51d552[_0x4f09('0x63')]['id']};var _0xc0fa2f={'ContactId':_0x4fa83d['id'],'WhatsappAccountId':_0x51d552[_0x4f09('0x63')]['id'],'closed':![]};return db[_0x4f09('0xa4')][_0x4f09('0x62')]({'where':_0xc0fa2f})[_0x4f09('0x3a')](function(_0x5bc98f){if(_0x5bc98f){return[_0x5bc98f,![]];}return db['WhatsappInteraction'][_0x4f09('0x5b')](_0x5c6aa5)['then'](function(_0x387d89){return[_0x387d89,!![]];});});}})[_0x4f09('0x75')](function(_0x40fa5f,_0x55ff9b){_0x1f0e50[_0x4f09('0xa5')]=_0x40fa5f[_0x4f09('0x5e')]({'plain':!![]});_0x1f0e50[_0x4f09('0xa5')][_0x4f09('0xa6')]=![];if(_0x55ff9b){if(_0x1f0e50[_0x4f09('0x88')]['autoclose']){_0x1f0e50[_0x4f09('0x85')][_0x4f09('0xa7')]({'id':0x0,'priority':_0x1f0e50[_0x4f09('0x85')][_0x4f09('0x4e')]+0x1,'app':'close','appdata':_0x4f09('0xa8'),'interval':_0x4f09('0xa9')});}_0x1f0e50[_0x4f09('0xa5')][_0x4f09('0xa6')]=!![];}return db[_0x4f09('0xaa')][_0x4f09('0x5b')]({'phone':_0x1f0e50['body'][_0x4f09('0x93')],'messageId':_0x1f0e50[_0x4f09('0x5c')]['messageId'],'body':_0x1f0e50['body'][_0x4f09('0x5c')],'WhatsappAccountId':_0x51d552[_0x4f09('0x63')]['id'],'WhatsappInteractionId':_0x40fa5f['id'],'direction':'in','ContactId':_0x40fa5f['ContactId'],'AttachmentId':_0x1f0e50['body']['AttachmentId']});})['then'](function(_0x37c527){_0x1f0e50['message']=_0x37c527;if(_0x1f0e50[_0x4f09('0xa5')]['UserId']){return db[_0x4f09('0xab')]['find']({'attributes':['id','name'],'where':{'id':_0x1f0e50[_0x4f09('0xa5')][_0x4f09('0xac')]}})[_0x4f09('0x3a')](function(_0x4c048b){if(_0x4c048b){_0x1f0e50['applications']['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4c048b[_0x4f09('0x3f')]+','+(_0x1f0e50[_0x4f09('0x88')][_0x4f09('0xad')]||0xa),'interval':_0x4f09('0xa9')});}return respondWithRpcPromise(_0x4f09('0xae'),_0x4f09('0xaf'),_0x1f0e50);});}return respondWithRpcPromise(_0x4f09('0xae'),_0x4f09('0xaf'),_0x1f0e50);})[_0x4f09('0x3a')](function(_0x368d54){if(_0x368d54){var _0x538189=0xc8;var _0xd52f25=_0x4f09('0xb0');logger[_0x4f09('0x25')](_0x4f09('0x27'),_0xd52f25,_0x538189,_0x4f09('0xb1'));logger[_0x4f09('0xb2')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0xd52f25,_0x538189,_0x4f09('0xb1'),JSON[_0x4f09('0xb3')](_0x368d54));if(_0x1f0e50[_0x4f09('0x88')][_0x4f09('0x45')]===_0x4f09('0xb4')){return _0x26c7db[_0x4f09('0x2f')](_0x538189)[_0x4f09('0x35')](_0x4f09('0xb5'),_0x4f09('0xb6'))[_0x4f09('0x40')](_0x4f09('0xb7'));}else{return _0x26c7db[_0x4f09('0x2f')](_0x538189)[_0x4f09('0x31')](_0x368d54);}}})[_0x4f09('0x2d')](handleError(_0x26c7db,null));};exports['send']=function(_0x139736,_0x1ade7f,_0x30a533){var _0x1557ba,_0x5e782e,_0x28ebbf;if(_[_0x4f09('0x9a')](_0x139736[_0x4f09('0x5c')][_0x4f09('0x5c')])||_0x139736[_0x4f09('0x5c')][_0x4f09('0x5c')]===''){throw new db[(_0x4f09('0x8a'))][(_0x4f09('0x8b'))](_0x4f09('0x9c'));}if(_[_0x4f09('0x9a')](_0x139736[_0x4f09('0x5c')]['to'])){throw new db[(_0x4f09('0x8a'))]['ValidationError'](_0x4f09('0xb8'));}_0x1557ba=_0x139736['body']['to'];return db[_0x4f09('0x58')][_0x4f09('0x62')]({'where':{'id':_0x139736[_0x4f09('0x63')]['id']},'include':[{'model':db[_0x4f09('0x9f')],'as':_0x4f09('0xb9'),'include':[{'model':db[_0x4f09('0x89')],'as':_0x4f09('0xa2'),'where':{'mobile':_0x1557ba},'limit':0x1,'order':[[_0x4f09('0x8e'),_0x4f09('0xba')]]}]}]})[_0x4f09('0x3a')](handleEntityNotFound(_0x1ade7f,null))['then'](function(_0xf763a0){if(_0xf763a0&&_0xf763a0[_0x4f09('0xb9')]){_0x5e782e=_0xf763a0[_0x4f09('0x5e')]({'plain':!![]});if(_0x5e782e[_0x4f09('0xb9')]&&_0x5e782e[_0x4f09('0xb9')][_0x4f09('0xa2')][_0x4f09('0x4e')]){return _0x5e782e[_0x4f09('0xb9')][_0x4f09('0xa2')][0x0];}return db[_0x4f09('0x89')][_0x4f09('0x5b')](_[_0x4f09('0x1c')](_0x139736[_0x4f09('0x5c')],{'firstName':_0x1557ba,'mobile':_0x1557ba,'phone':_0x1557ba,'ListId':_0x5e782e[_0x4f09('0x91')]}));}})[_0x4f09('0x3a')](handleEntityNotFound(_0x1ade7f,null))[_0x4f09('0x3a')](function(_0x3c5979){if(_0x3c5979){_0x28ebbf=_0x3c5979;return db['WhatsappInteraction']['find']({'where':{'ContactId':_0x28ebbf['id'],'closed':![],'WhatsappAccountId':_0x5e782e['id']}})[_0x4f09('0x3a')](function(_0xb2b128){if(_0xb2b128){return[_0xb2b128,![]];}return db[_0x4f09('0xa4')]['create']({'UserId':_0x139736[_0x4f09('0x5d')]['id'],'ContactId':_0x28ebbf['id'],'WhatsappAccountId':_0x5e782e['id'],'phone':_0x1557ba,'firstMsgDirection':_0x4f09('0xbb'),'Messages':[_[_0x4f09('0x53')](_0x139736[_0x4f09('0x5c')],{'read':![],'body':_0x139736[_0x4f09('0x5c')]['body'],'phone':_0x1557ba,'WhatsappAccountId':_0x5e782e['id'],'UserId':_0x139736[_0x4f09('0x5d')]['id'],'ContactId':_0x28ebbf['id']})]},{'include':[{'model':db[_0x4f09('0xaa')],'as':_0x4f09('0xbc')}]})[_0x4f09('0x3a')](function(_0xf7b8e4){return[_0xf7b8e4,!![]];});});}})['spread'](function(_0x5ad15c,_0x589439){if(_0x589439){return _0x5ad15c;}return db['WhatsappMessage'][_0x4f09('0x5b')](_[_0x4f09('0x53')](_0x139736['body'],{'read':![],'body':_0x139736[_0x4f09('0x5c')][_0x4f09('0x5c')],'phone':_0x1557ba,'WhatsappAccountId':_0x5e782e['id'],'WhatsappInteractionId':_0x5ad15c['id'],'UserId':_0x139736[_0x4f09('0x5d')]['id'],'ContactId':_0x28ebbf['id']}))['then'](function(_0x47c17c){_0x5ad15c['dataValues'][_0x4f09('0xbc')]=[];_0x5ad15c[_0x4f09('0xbd')][_0x4f09('0xbc')][_0x4f09('0xa7')](_0x47c17c[_0x4f09('0xbd')]);return _0x5ad15c;});})[_0x4f09('0x3a')](respondWithResult(_0x1ade7f,null))[_0x4f09('0x2d')](handleError(_0x1ade7f,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index dcfa400..8fc2b70 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 _0x1db1=['update','remove','emit','hasOwnProperty','exports','WhatsappAccount','save'];(function(_0x24d894,_0x1ff2f7){var _0x26d5dc=function(_0x1591b5){while(--_0x1591b5){_0x24d894['push'](_0x24d894['shift']());}};_0x26d5dc(++_0x1ff2f7);}(_0x1db1,0x1cc));var _0x11db=function(_0x293c60,_0x90884d){_0x293c60=_0x293c60-0x0;var _0xbc3207=_0x1db1[_0x293c60];return _0xbc3207;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require('../../mysqldb')['db'][_0x11db('0x0')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x11db('0x1'),'afterUpdate':_0x11db('0x2'),'afterDestroy':_0x11db('0x3')};function emitEvent(_0x13323a){return function(_0x26a612,_0x15a1cf,_0x3f7c76){WhatsappAccountEvents[_0x11db('0x4')](_0x13323a+':'+_0x26a612['id'],_0x26a612);WhatsappAccountEvents[_0x11db('0x4')](_0x13323a,_0x26a612);_0x3f7c76(null);};}for(var e in events){if(events[_0x11db('0x5')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0x11db('0x6')]=WhatsappAccountEvents; \ No newline at end of file +var _0x4404=['save','emit','hasOwnProperty','exports','events','../../mysqldb','WhatsappAccount'];(function(_0x56c936,_0x4042a9){var _0x45c055=function(_0x958cc5){while(--_0x958cc5){_0x56c936['push'](_0x56c936['shift']());}};_0x45c055(++_0x4042a9);}(_0x4404,0x12a));var _0x4440=function(_0x2c0474,_0x43dc8a){_0x2c0474=_0x2c0474-0x0;var _0x53e9a0=_0x4404[_0x2c0474];return _0x53e9a0;};'use strict';var EventEmitter=require(_0x4440('0x0'));var WhatsappAccount=require(_0x4440('0x1'))['db'][_0x4440('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4440('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x12e720){return function(_0x361f3a,_0x10d67f,_0x3f979e){WhatsappAccountEvents[_0x4440('0x4')](_0x12e720+':'+_0x361f3a['id'],_0x361f3a);WhatsappAccountEvents[_0x4440('0x4')](_0x12e720,_0x361f3a);_0x3f979e(null);};}for(var e in events){if(events[_0x4440('0x5')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0x4440('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 784ccbf..ac206cf 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 _0xaad3=['exports','define','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./whatsappAccount.attributes'];(function(_0x468551,_0x291810){var _0x2c77b8=function(_0x30007c){while(--_0x30007c){_0x468551['push'](_0x468551['shift']());}};_0x2c77b8(++_0x291810);}(_0xaad3,0x14c));var _0x3aad=function(_0xc1100f,_0x5e636b){_0xc1100f=_0xc1100f-0x0;var _0x110e21=_0xaad3[_0xc1100f];return _0x110e21;};'use strict';var _=require(_0x3aad('0x0'));var util=require(_0x3aad('0x1'));var logger=require(_0x3aad('0x2'))(_0x3aad('0x3'));var moment=require(_0x3aad('0x4'));var BPromise=require('bluebird');var rp=require(_0x3aad('0x5'));var fs=require('fs');var path=require(_0x3aad('0x6'));var rimraf=require('rimraf');var config=require(_0x3aad('0x7'));var attributes=require(_0x3aad('0x8'));module[_0x3aad('0x9')]=function(_0x12019b,_0x2cf479){return _0x12019b[_0x3aad('0xa')]('WhatsappAccount',attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x366d=['api','moment','request-promise','path','./whatsappAccount.attributes','define','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger'];(function(_0x2a5e4c,_0x4256b0){var _0x4365f0=function(_0x4c78e4){while(--_0x4c78e4){_0x2a5e4c['push'](_0x2a5e4c['shift']());}};_0x4365f0(++_0x4256b0);}(_0x366d,0x1d6));var _0xd366=function(_0x48cc1f,_0x4e2b78){_0x48cc1f=_0x48cc1f-0x0;var _0xbc6c3c=_0x366d[_0x48cc1f];return _0xbc6c3c;};'use strict';var _=require(_0xd366('0x0'));var util=require(_0xd366('0x1'));var logger=require(_0xd366('0x2'))(_0xd366('0x3'));var moment=require(_0xd366('0x4'));var BPromise=require('bluebird');var rp=require(_0xd366('0x5'));var fs=require('fs');var path=require(_0xd366('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd366('0x7'));module['exports']=function(_0x2cf60a,_0x209333){return _0x2cf60a[_0xd366('0x8')](_0xd366('0x9'),attributes,{'tableName':_0xd366('0xa'),'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 0868490..e96157e 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 _0x30ad=['jayson/promise','client','http','redis','defaults','socket.io-emitter','./whatsappAccount.socket','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','ShowWhatsappAccount','find','options','where','attributes','include','map','model','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x4d67b8,_0x565134){var _0x55af3b=function(_0x145904){while(--_0x145904){_0x4d67b8['push'](_0x4d67b8['shift']());}};_0x55af3b(++_0x565134);}(_0x30ad,0xaa));var _0xd30a=function(_0x5297f1,_0x2c6b91){_0x5297f1=_0x5297f1-0x0;var _0x4faa91=_0x30ad[_0x5297f1];return _0x4faa91;};'use strict';var _=require(_0xd30a('0x0'));var util=require(_0xd30a('0x1'));var moment=require(_0xd30a('0x2'));var BPromise=require(_0xd30a('0x3'));var rs=require(_0xd30a('0x4'));var fs=require('fs');var Redis=require(_0xd30a('0x5'));var db=require(_0xd30a('0x6'))['db'];var utils=require(_0xd30a('0x7'));var logger=require(_0xd30a('0x8'))('rpc');var config=require(_0xd30a('0x9'));var jayson=require(_0xd30a('0xa'));var client=jayson[_0xd30a('0xb')][_0xd30a('0xc')]({'port':0x232a});config[_0xd30a('0xd')]=_[_0xd30a('0xe')](config[_0xd30a('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xd30a('0xf'))(new Redis(config['redis']));require(_0xd30a('0x10'))['register'](socket);function respondWithRpcPromise(_0x4c0030,_0x52667c,_0x3f8210){return new BPromise(function(_0x6b8723,_0x5560a6){return client[_0xd30a('0x11')](_0x4c0030,_0x3f8210)[_0xd30a('0x12')](function(_0x32b23c){logger[_0xd30a('0x13')](_0xd30a('0x14'),_0x52667c,_0xd30a('0x15'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x52667c,'request\x20sent',JSON[_0xd30a('0x16')](_0x32b23c));if(_0x32b23c[_0xd30a('0x17')]){if(_0x32b23c[_0xd30a('0x17')][_0xd30a('0x18')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x52667c,_0x32b23c['error']['message']);return _0x5560a6(_0x32b23c['error']['message']);}logger[_0xd30a('0x17')](_0xd30a('0x14'),_0x52667c,_0x32b23c[_0xd30a('0x17')][_0xd30a('0x19')]);return _0x6b8723(_0x32b23c['error'][_0xd30a('0x19')]);}else{logger[_0xd30a('0x13')](_0xd30a('0x14'),_0x52667c,_0xd30a('0x15'));_0x6b8723(_0x32b23c[_0xd30a('0x1a')]['message']);}})['catch'](function(_0x39d481){logger['error'](_0xd30a('0x14'),_0x52667c,_0x39d481);_0x5560a6(_0x39d481);});});}exports[_0xd30a('0x1b')]=function(_0x501519){var _0x2a16b8=this;return new Promise(function(_0x48dc46,_0x5b334c){return db['WhatsappAccount'][_0xd30a('0x1c')]({'raw':_0x501519[_0xd30a('0x1d')]?_0x501519['options']['raw']===undefined?!![]:![]:!![],'where':_0x501519[_0xd30a('0x1d')]?_0x501519[_0xd30a('0x1d')][_0xd30a('0x1e')]||null:null,'attributes':_0x501519[_0xd30a('0x1d')]?_0x501519[_0xd30a('0x1d')][_0xd30a('0x1f')]||null:null,'include':_0x501519[_0xd30a('0x1d')]?_0x501519[_0xd30a('0x1d')][_0xd30a('0x20')]?_[_0xd30a('0x21')](_0x501519['options'][_0xd30a('0x20')],function(_0x410ae4){return{'model':db[_0x410ae4[_0xd30a('0x22')]],'as':_0x410ae4['as'],'attributes':_0x410ae4[_0xd30a('0x1f')],'include':_0x410ae4[_0xd30a('0x20')]?_[_0xd30a('0x21')](_0x410ae4[_0xd30a('0x20')],function(_0x6b8052){return{'model':db[_0x6b8052[_0xd30a('0x22')]],'as':_0x6b8052['as'],'attributes':_0x6b8052[_0xd30a('0x1f')],'include':_0x6b8052[_0xd30a('0x20')]?_[_0xd30a('0x21')](_0x6b8052['include'],function(_0x400474){return{'model':db[_0x400474[_0xd30a('0x22')]],'as':_0x400474['as'],'attributes':_0x400474[_0xd30a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd30a('0x12')](function(_0x5e168b){logger[_0xd30a('0x13')](_0xd30a('0x1b'),_0x501519);logger[_0xd30a('0x23')]('ShowWhatsappAccount',_0x501519,JSON['stringify'](_0x5e168b));_0x48dc46(_0x5e168b);})['catch'](function(_0x791508){logger['error'](_0xd30a('0x1b'),_0x791508['message'],_0x501519);_0x5b334c(_0x2a16b8[_0xd30a('0x17')](0x1f4,_0x791508[_0xd30a('0x19')]));});});}; \ No newline at end of file +var _0x213c=['WhatsappAccount','find','raw','options','include','map','attributes','model','then','info','stringify','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','code','error','message','result','catch','ShowWhatsappAccount'];(function(_0xd6aad,_0x3fd78e){var _0x1109e6=function(_0x37f59c){while(--_0x37f59c){_0xd6aad['push'](_0xd6aad['shift']());}};_0x1109e6(++_0x3fd78e);}(_0x213c,0xc4));var _0xc213=function(_0x4945a9,_0x350457){_0x4945a9=_0x4945a9-0x0;var _0x5ccc17=_0x213c[_0x4945a9];return _0x5ccc17;};'use strict';var _=require(_0xc213('0x0'));var util=require('util');var moment=require(_0xc213('0x1'));var BPromise=require(_0xc213('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc213('0x3'));var db=require(_0xc213('0x4'))['db'];var utils=require(_0xc213('0x5'));var logger=require(_0xc213('0x6'))(_0xc213('0x7'));var config=require(_0xc213('0x8'));var jayson=require(_0xc213('0x9'));var client=jayson['client'][_0xc213('0xa')]({'port':0x232a});config[_0xc213('0xb')]=_[_0xc213('0xc')](config[_0xc213('0xb')],{'host':_0xc213('0xd'),'port':0x18eb});var socket=require(_0xc213('0xe'))(new Redis(config['redis']));require('./whatsappAccount.socket')[_0xc213('0xf')](socket);function respondWithRpcPromise(_0x3f0982,_0x26b3f4,_0xfc7f59){return new BPromise(function(_0x5ee50b,_0x13b17c){return client[_0xc213('0x10')](_0x3f0982,_0xfc7f59)['then'](function(_0x1f5a3b){logger['info'](_0xc213('0x11'),_0x26b3f4,_0xc213('0x12'));logger[_0xc213('0x13')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x26b3f4,_0xc213('0x12'),JSON['stringify'](_0x1f5a3b));if(_0x1f5a3b['error']){if(_0x1f5a3b['error'][_0xc213('0x14')]===0x1f4){logger[_0xc213('0x15')](_0xc213('0x11'),_0x26b3f4,_0x1f5a3b[_0xc213('0x15')][_0xc213('0x16')]);return _0x13b17c(_0x1f5a3b['error'][_0xc213('0x16')]);}logger[_0xc213('0x15')](_0xc213('0x11'),_0x26b3f4,_0x1f5a3b['error'][_0xc213('0x16')]);return _0x5ee50b(_0x1f5a3b[_0xc213('0x15')]['message']);}else{logger['info'](_0xc213('0x11'),_0x26b3f4,_0xc213('0x12'));_0x5ee50b(_0x1f5a3b[_0xc213('0x17')][_0xc213('0x16')]);}})[_0xc213('0x18')](function(_0x270495){logger['error'](_0xc213('0x11'),_0x26b3f4,_0x270495);_0x13b17c(_0x270495);});});}exports[_0xc213('0x19')]=function(_0x2a139e){var _0x1b6708=this;return new Promise(function(_0x55cb78,_0x315f94){return db[_0xc213('0x1a')][_0xc213('0x1b')]({'raw':_0x2a139e['options']?_0x2a139e['options'][_0xc213('0x1c')]===undefined?!![]:![]:!![],'where':_0x2a139e[_0xc213('0x1d')]?_0x2a139e[_0xc213('0x1d')]['where']||null:null,'attributes':_0x2a139e[_0xc213('0x1d')]?_0x2a139e[_0xc213('0x1d')]['attributes']||null:null,'include':_0x2a139e[_0xc213('0x1d')]?_0x2a139e[_0xc213('0x1d')][_0xc213('0x1e')]?_[_0xc213('0x1f')](_0x2a139e['options']['include'],function(_0x223ebc){return{'model':db[_0x223ebc['model']],'as':_0x223ebc['as'],'attributes':_0x223ebc[_0xc213('0x20')],'include':_0x223ebc['include']?_[_0xc213('0x1f')](_0x223ebc['include'],function(_0x24f689){return{'model':db[_0x24f689[_0xc213('0x21')]],'as':_0x24f689['as'],'attributes':_0x24f689[_0xc213('0x20')],'include':_0x24f689[_0xc213('0x1e')]?_[_0xc213('0x1f')](_0x24f689['include'],function(_0x2fcb4e){return{'model':db[_0x2fcb4e['model']],'as':_0x2fcb4e['as'],'attributes':_0x2fcb4e[_0xc213('0x20')]};}):[]};}):[]};}):[]:[]})[_0xc213('0x22')](function(_0x1c7c7a){logger[_0xc213('0x23')](_0xc213('0x19'),_0x2a139e);logger[_0xc213('0x13')]('ShowWhatsappAccount',_0x2a139e,JSON[_0xc213('0x24')](_0x1c7c7a));_0x55cb78(_0x1c7c7a);})['catch'](function(_0x20bbf9){logger[_0xc213('0x15')](_0xc213('0x19'),_0x20bbf9[_0xc213('0x16')],_0x2a139e);_0x315f94(_0x1b6708[_0xc213('0x15')](0x1f4,_0x20bbf9[_0xc213('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 82924b4..d6a7b2d 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 _0x36a6=['register','length','emit','removeListener'];(function(_0x334d1e,_0x28a488){var _0x3b33ba=function(_0x25afca){while(--_0x25afca){_0x334d1e['push'](_0x334d1e['shift']());}};_0x3b33ba(++_0x28a488);}(_0x36a6,0x1ba));var _0x636a=function(_0x4bdeb4,_0x718612){_0x4bdeb4=_0x4bdeb4-0x0;var _0x5578c2=_0x36a6[_0x4bdeb4];return _0x5578c2;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=['save','remove','update'];function createListener(_0x43df68,_0x2bab2d){return function(_0x1d5046){_0x2bab2d[_0x636a('0x0')](_0x43df68,_0x1d5046);};}function removeListener(_0x4ab0f3,_0x531380){return function(){WhatsappAccountEvents[_0x636a('0x1')](_0x4ab0f3,_0x531380);};}exports[_0x636a('0x2')]=function(_0x5c1998){for(var _0x235d55=0x0,_0x34fac8=events[_0x636a('0x3')];_0x235d55<_0x34fac8;_0x235d55++){var _0x510baa=events[_0x235d55];var _0x93a38b=createListener('whatsappAccount:'+_0x510baa,_0x5c1998);WhatsappAccountEvents['on'](_0x510baa,_0x93a38b);}}; \ No newline at end of file +var _0x2e87=['whatsappAccount:','./whatsappAccount.events','save','remove','emit','removeListener','register','length'];(function(_0x2e1f39,_0x5df28f){var _0x4e7d9a=function(_0x40ae20){while(--_0x40ae20){_0x2e1f39['push'](_0x2e1f39['shift']());}};_0x4e7d9a(++_0x5df28f);}(_0x2e87,0xd1));var _0x72e8=function(_0x17c8cc,_0x5e5647){_0x17c8cc=_0x17c8cc-0x0;var _0x3db4eb=_0x2e87[_0x17c8cc];return _0x3db4eb;};'use strict';var WhatsappAccountEvents=require(_0x72e8('0x0'));var events=[_0x72e8('0x1'),_0x72e8('0x2'),'update'];function createListener(_0x8fa28f,_0x3e6f31){return function(_0x533cac){_0x3e6f31[_0x72e8('0x3')](_0x8fa28f,_0x533cac);};}function removeListener(_0x15c758,_0x2f35ea){return function(){WhatsappAccountEvents[_0x72e8('0x4')](_0x15c758,_0x2f35ea);};}exports[_0x72e8('0x5')]=function(_0x23d81d){for(var _0x3f1312=0x0,_0x3352ee=events[_0x72e8('0x6')];_0x3f1312<_0x3352ee;_0x3f1312++){var _0x5f4ce3=events[_0x3f1312];var _0x4c7751=createListener(_0x72e8('0x7')+_0x5f4ce3,_0x23d81d);WhatsappAccountEvents['on'](_0x5f4ce3,_0x4c7751);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 5831ef9..954557c 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 _0xd442=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports'];(function(_0x5bc1ea,_0xb4b383){var _0xf3d5b9=function(_0x5a8d19){while(--_0x5a8d19){_0x5bc1ea['push'](_0x5bc1ea['shift']());}};_0xf3d5b9(++_0xb4b383);}(_0xd442,0x130));var _0x2d44=function(_0x2b2678,_0x3ee1df){_0x2b2678=_0x2b2678-0x0;var _0x42ccdc=_0xd442[_0x2b2678];return _0x42ccdc;};'use strict';var multer=require(_0x2d44('0x0'));var util=require(_0x2d44('0x1'));var path=require(_0x2d44('0x2'));var timeout=require(_0x2d44('0x3'));var express=require(_0x2d44('0x4'));var router=express[_0x2d44('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2d44('0x6'));var interaction=require(_0x2d44('0x7'));var config=require(_0x2d44('0x8'));var controller=require('./whatsappApplication.controller');router[_0x2d44('0x9')]('/',auth[_0x2d44('0xa')](),controller['index']);router[_0x2d44('0x9')](_0x2d44('0xb'),auth[_0x2d44('0xa')](),controller[_0x2d44('0xc')]);router[_0x2d44('0xd')]('/',auth[_0x2d44('0xa')](),controller[_0x2d44('0xe')]);router['put']('/:id',auth[_0x2d44('0xa')](),controller[_0x2d44('0xf')]);router[_0x2d44('0x10')](_0x2d44('0xb'),auth[_0x2d44('0xa')](),controller[_0x2d44('0x11')]);module[_0x2d44('0x12')]=router; \ No newline at end of file +var _0x6601=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy'];(function(_0x56b540,_0x37f450){var _0xf62ffc=function(_0x2a8224){while(--_0x2a8224){_0x56b540['push'](_0x56b540['shift']());}};_0xf62ffc(++_0x37f450);}(_0x6601,0x166));var _0x1660=function(_0x4477dc,_0x23e8c5){_0x4477dc=_0x4477dc-0x0;var _0x1d9a97=_0x6601[_0x4477dc];return _0x1d9a97;};'use strict';var multer=require(_0x1660('0x0'));var util=require(_0x1660('0x1'));var path=require(_0x1660('0x2'));var timeout=require(_0x1660('0x3'));var express=require(_0x1660('0x4'));var router=express[_0x1660('0x5')]();var fs_extra=require(_0x1660('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x1660('0x7'));var config=require(_0x1660('0x8'));var controller=require(_0x1660('0x9'));router[_0x1660('0xa')]('/',auth[_0x1660('0xb')](),controller[_0x1660('0xc')]);router[_0x1660('0xa')](_0x1660('0xd'),auth['isAuthenticated'](),controller[_0x1660('0xe')]);router[_0x1660('0xf')]('/',auth[_0x1660('0xb')](),controller[_0x1660('0x10')]);router[_0x1660('0x11')]('/:id',auth[_0x1660('0xb')](),controller[_0x1660('0x12')]);router['delete'](_0x1660('0xd'),auth['isAuthenticated'](),controller[_0x1660('0x13')]);module[_0x1660('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index f22df94..b1c1089 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 _0x9877=['INTEGER','noop','STRING','*,*,*,*','sequelize','exports'];(function(_0x2e0e55,_0x1a4e24){var _0x2c6fad=function(_0x3b3c1a){while(--_0x3b3c1a){_0x2e0e55['push'](_0x2e0e55['shift']());}};_0x2c6fad(++_0x1a4e24);}(_0x9877,0x178));var _0x7987=function(_0x53bd3f,_0xb2fb9b){_0x53bd3f=_0x53bd3f-0x0;var _0x346e1e=_0x9877[_0x53bd3f];return _0x346e1e;};'use strict';var Sequelize=require(_0x7987('0x0'));module[_0x7987('0x1')]={'priority':{'type':Sequelize[_0x7987('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7987('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x7987('0x4')]},'interval':{'type':Sequelize[_0x7987('0x4')],'defaultValue':_0x7987('0x5')}}; \ No newline at end of file +var _0xd43a=['noop','TEXT','sequelize','INTEGER','STRING'];(function(_0x5e1002,_0x43a5a1){var _0x5b510b=function(_0x519af3){while(--_0x519af3){_0x5e1002['push'](_0x5e1002['shift']());}};_0x5b510b(++_0x43a5a1);}(_0xd43a,0x18d));var _0xad43=function(_0x5e2403,_0x2569da){_0x5e2403=_0x5e2403-0x0;var _0x2d4d07=_0xd43a[_0x5e2403];return _0x2d4d07;};'use strict';var Sequelize=require(_0xad43('0x0'));module['exports']={'priority':{'type':Sequelize[_0xad43('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xad43('0x2')],'allowNull':![],'defaultValue':_0xad43('0x3')},'appdata':{'type':Sequelize[_0xad43('0x4')]()},'description':{'type':Sequelize[_0xad43('0x2')]},'interval':{'type':Sequelize[_0xad43('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 2450bd8..1a9e4b6 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 _0x8768=['includeAll','find','catch','create','body','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/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','WhatsappApplication','fieldName','key','keys','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','merge','map','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','length'];(function(_0x2b6127,_0x12e913){var _0x24a2d2=function(_0x241a71){while(--_0x241a71){_0x2b6127['push'](_0x2b6127['shift']());}};_0x24a2d2(++_0x12e913);}(_0x8768,0xa1));var _0x8876=function(_0x541d58,_0x46738){_0x541d58=_0x541d58-0x0;var _0x58323a=_0x8768[_0x541d58];return _0x58323a;};'use strict';var emlformat=require(_0x8876('0x0'));var rimraf=require(_0x8876('0x1'));var zipdir=require(_0x8876('0x2'));var jsonpatch=require(_0x8876('0x3'));var rp=require(_0x8876('0x4'));var moment=require(_0x8876('0x5'));var BPromise=require(_0x8876('0x6'));var Mustache=require(_0x8876('0x7'));var util=require(_0x8876('0x8'));var path=require(_0x8876('0x9'));var sox=require(_0x8876('0xa'));var csv=require(_0x8876('0xb'));var ejs=require(_0x8876('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8876('0xd'));var squel=require(_0x8876('0xe'));var crypto=require(_0x8876('0xf'));var jsforce=require(_0x8876('0x10'));var deskjs=require(_0x8876('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8876('0x12'));var Redis=require(_0x8876('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8876('0x14'));var hardwareService=require(_0x8876('0x15'));var logger=require(_0x8876('0x16'))(_0x8876('0x17'));var utils=require(_0x8876('0x18'));var config=require(_0x8876('0x19'));var licenseUtil=require(_0x8876('0x1a'));var db=require(_0x8876('0x1b'))['db'];function respondWithStatusCode(_0x1415ad,_0x3c3c10){_0x3c3c10=_0x3c3c10||0xcc;return function(_0x5d2f75){if(_0x5d2f75){return _0x1415ad[_0x8876('0x1c')](_0x3c3c10);}return _0x1415ad[_0x8876('0x1d')](_0x3c3c10)[_0x8876('0x1e')]();};}function respondWithResult(_0x44de2a,_0xb502bf){_0xb502bf=_0xb502bf||0xc8;return function(_0x4b71cf){if(_0x4b71cf){return _0x44de2a[_0x8876('0x1d')](_0xb502bf)[_0x8876('0x1f')](_0x4b71cf);}};}function respondWithFilteredResult(_0x16f98b,_0xcdaa43){return function(_0x262058){if(_0x262058){var _0x2d50ad=typeof _0xcdaa43[_0x8876('0x20')]==='undefined'&&typeof _0xcdaa43[_0x8876('0x21')]===_0x8876('0x22');var _0xeea8f9=_0x262058[_0x8876('0x23')];var _0x146fdf=_0x2d50ad?0x0:_0xcdaa43['offset'];var _0x482899=_0x2d50ad?_0x262058[_0x8876('0x23')]:_0xcdaa43[_0x8876('0x20')]+_0xcdaa43[_0x8876('0x21')];var _0x56771b;if(_0x482899>=_0xeea8f9){_0x482899=_0xeea8f9;_0x56771b=0xc8;}else{_0x56771b=0xce;}_0x16f98b[_0x8876('0x1d')](_0x56771b);return _0x16f98b[_0x8876('0x24')]('Content-Range',_0x146fdf+'-'+_0x482899+'/'+_0xeea8f9)[_0x8876('0x1f')](_0x262058);}return null;};}function patchUpdates(_0xe3c6a1){return function(_0x26074f){try{jsonpatch[_0x8876('0x25')](_0x26074f,_0xe3c6a1,!![]);}catch(_0x2522d7){return BPromise[_0x8876('0x26')](_0x2522d7);}return _0x26074f[_0x8876('0x27')]();};}function saveUpdates(_0x4e6b3c,_0x3dd3f1){return function(_0x5cfbd9){if(_0x5cfbd9){return _0x5cfbd9[_0x8876('0x28')](_0x4e6b3c)[_0x8876('0x29')](function(_0x327d58){return _0x327d58;});}return null;};}function removeEntity(_0x474843,_0x168170){return function(_0x460240){if(_0x460240){return _0x460240[_0x8876('0x2a')]()[_0x8876('0x29')](function(){_0x474843[_0x8876('0x1d')](0xcc)[_0x8876('0x1e')]();});}};}function handleEntityNotFound(_0x166c18,_0x1e0f91){return function(_0xbd6621){if(!_0xbd6621){_0x166c18['sendStatus'](0x194);}return _0xbd6621;};}function handleError(_0x302b9f,_0x2a5662){_0x2a5662=_0x2a5662||0x1f4;return function(_0x1d1f9a){logger[_0x8876('0x2b')](_0x1d1f9a[_0x8876('0x2c')]);if(_0x1d1f9a[_0x8876('0x2d')]){delete _0x1d1f9a[_0x8876('0x2d')];}_0x302b9f['status'](_0x2a5662)[_0x8876('0x2e')](_0x1d1f9a);};}exports['index']=function(_0x5dbffd,_0x18203c){var _0x57ea22={},_0x49de2e={},_0x41312a={'count':0x0,'rows':[]};var _0x53e2fc=_['map'](db[_0x8876('0x2f')]['rawAttributes'],function(_0x18e580){return{'name':_0x18e580[_0x8876('0x30')],'type':_0x18e580['type'][_0x8876('0x31')]};});_0x49de2e['model']=_['map'](_0x53e2fc,_0x8876('0x2d'));_0x49de2e['query']=_[_0x8876('0x32')](_0x5dbffd[_0x8876('0x33')]);_0x49de2e[_0x8876('0x34')]=_['intersection'](_0x49de2e[_0x8876('0x35')],_0x49de2e[_0x8876('0x33')]);_0x57ea22[_0x8876('0x36')]=_[_0x8876('0x37')](_0x49de2e[_0x8876('0x35')],qs['fields'](_0x5dbffd['query'][_0x8876('0x38')]));_0x57ea22[_0x8876('0x36')]=_0x57ea22[_0x8876('0x36')]['length']?_0x57ea22[_0x8876('0x36')]:_0x49de2e[_0x8876('0x35')];if(!_0x5dbffd['query'][_0x8876('0x39')](_0x8876('0x3a'))){_0x57ea22[_0x8876('0x21')]=qs[_0x8876('0x21')](_0x5dbffd[_0x8876('0x33')][_0x8876('0x21')]);_0x57ea22[_0x8876('0x20')]=qs[_0x8876('0x20')](_0x5dbffd[_0x8876('0x33')][_0x8876('0x20')]);}_0x57ea22['order']=qs[_0x8876('0x3b')](_0x5dbffd['query'][_0x8876('0x3b')]);_0x57ea22[_0x8876('0x3c')]=qs['filters'](_[_0x8876('0x3d')](_0x5dbffd[_0x8876('0x33')],_0x49de2e['filters']),_0x53e2fc);if(_0x5dbffd[_0x8876('0x33')]['filter']){_0x57ea22[_0x8876('0x3c')]=_[_0x8876('0x3e')](_0x57ea22[_0x8876('0x3c')],{'$or':_[_0x8876('0x3f')](_0x53e2fc,function(_0x373e9c){if(_0x373e9c['type']!==_0x8876('0x40')){var _0xc5698c={};_0xc5698c[_0x373e9c[_0x8876('0x2d')]]={'$like':'%'+_0x5dbffd['query']['filter']+'%'};return _0xc5698c;}})});}_0x57ea22=_[_0x8876('0x3e')]({},_0x57ea22,_0x5dbffd[_0x8876('0x41')]);var _0x90687f={'where':_0x57ea22[_0x8876('0x3c')]};return db[_0x8876('0x2f')][_0x8876('0x23')](_0x90687f)[_0x8876('0x29')](function(_0x54b888){_0x41312a['count']=_0x54b888;if(_0x5dbffd[_0x8876('0x33')]['includeAll']){_0x57ea22[_0x8876('0x42')]=[{'all':!![]}];}return db[_0x8876('0x2f')][_0x8876('0x43')](_0x57ea22);})[_0x8876('0x29')](function(_0x21a023){_0x41312a[_0x8876('0x44')]=_0x21a023;return _0x41312a;})[_0x8876('0x29')](respondWithFilteredResult(_0x18203c,_0x57ea22))['catch'](handleError(_0x18203c,null));};exports[_0x8876('0x45')]=function(_0x22ae1b,_0x39e021){var _0x44078a={'raw':!![],'where':{'id':_0x22ae1b[_0x8876('0x46')]['id']}},_0x3670ea={};_0x3670ea[_0x8876('0x35')]=_['keys'](db['WhatsappApplication'][_0x8876('0x47')]);_0x3670ea[_0x8876('0x33')]=_[_0x8876('0x32')](_0x22ae1b[_0x8876('0x33')]);_0x3670ea[_0x8876('0x34')]=_[_0x8876('0x37')](_0x3670ea['model'],_0x3670ea['query']);_0x44078a[_0x8876('0x36')]=_['intersection'](_0x3670ea['model'],qs[_0x8876('0x38')](_0x22ae1b[_0x8876('0x33')][_0x8876('0x38')]));_0x44078a[_0x8876('0x36')]=_0x44078a['attributes'][_0x8876('0x48')]?_0x44078a['attributes']:_0x3670ea[_0x8876('0x35')];if(_0x22ae1b[_0x8876('0x33')][_0x8876('0x49')]){_0x44078a[_0x8876('0x42')]=[{'all':!![]}];}_0x44078a=_[_0x8876('0x3e')]({},_0x44078a,_0x22ae1b[_0x8876('0x41')]);return db[_0x8876('0x2f')][_0x8876('0x4a')](_0x44078a)[_0x8876('0x29')](handleEntityNotFound(_0x39e021,null))['then'](respondWithResult(_0x39e021,null))[_0x8876('0x4b')](handleError(_0x39e021,null));};exports[_0x8876('0x4c')]=function(_0x1b93e6,_0x1075cb){return db[_0x8876('0x2f')][_0x8876('0x4c')](_0x1b93e6[_0x8876('0x4d')],{})[_0x8876('0x29')](respondWithResult(_0x1075cb,0xc9))['catch'](handleError(_0x1075cb,null));};exports['update']=function(_0x5673bf,_0x113fbb){if(_0x5673bf[_0x8876('0x4d')]['id']){delete _0x5673bf[_0x8876('0x4d')]['id'];}return db['WhatsappApplication'][_0x8876('0x4a')]({'where':{'id':_0x5673bf[_0x8876('0x46')]['id']}})[_0x8876('0x29')](handleEntityNotFound(_0x113fbb,null))[_0x8876('0x29')](saveUpdates(_0x5673bf[_0x8876('0x4d')],null))[_0x8876('0x29')](respondWithResult(_0x113fbb,null))[_0x8876('0x4b')](handleError(_0x113fbb,null));};exports[_0x8876('0x2a')]=function(_0x4e1716,_0x3d121e){return db[_0x8876('0x2f')][_0x8876('0x4a')]({'where':{'id':_0x4e1716['params']['id']}})['then'](handleEntityNotFound(_0x3d121e,null))[_0x8876('0x29')](removeEntity(_0x3d121e,null))[_0x8876('0x4b')](handleError(_0x3d121e,null));}; \ No newline at end of file +var _0x9582=['rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','offset','count','set','json','reject','save','update','then','destroy','error','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','eml-format'];(function(_0x4bb581,_0x6f7037){var _0x316bf5=function(_0x1f6ed0){while(--_0x1f6ed0){_0x4bb581['push'](_0x4bb581['shift']());}};_0x316bf5(++_0x6f7037);}(_0x9582,0x95));var _0x2958=function(_0x3e8995,_0xb640fc){_0x3e8995=_0x3e8995-0x0;var _0x90c919=_0x9582[_0x3e8995];return _0x90c919;};'use strict';var emlformat=require(_0x2958('0x0'));var rimraf=require(_0x2958('0x1'));var zipdir=require(_0x2958('0x2'));var jsonpatch=require(_0x2958('0x3'));var rp=require(_0x2958('0x4'));var moment=require(_0x2958('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2958('0x6'));var util=require(_0x2958('0x7'));var path=require(_0x2958('0x8'));var sox=require(_0x2958('0x9'));var csv=require(_0x2958('0xa'));var ejs=require(_0x2958('0xb'));var fs=require('fs');var fs_extra=require(_0x2958('0xc'));var _=require(_0x2958('0xd'));var squel=require(_0x2958('0xe'));var crypto=require(_0x2958('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2958('0xa'));var querystring=require('querystring');var Papa=require(_0x2958('0x10'));var Redis=require('ioredis');var authService=require(_0x2958('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2958('0x12'));var hardwareService=require(_0x2958('0x13'));var logger=require(_0x2958('0x14'))(_0x2958('0x15'));var utils=require(_0x2958('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2958('0x17'));var db=require(_0x2958('0x18'))['db'];function respondWithStatusCode(_0x33a13a,_0x20e06a){_0x20e06a=_0x20e06a||0xcc;return function(_0x47067d){if(_0x47067d){return _0x33a13a[_0x2958('0x19')](_0x20e06a);}return _0x33a13a[_0x2958('0x1a')](_0x20e06a)[_0x2958('0x1b')]();};}function respondWithResult(_0x5bd520,_0x42e976){_0x42e976=_0x42e976||0xc8;return function(_0x2e12d4){if(_0x2e12d4){return _0x5bd520['status'](_0x42e976)['json'](_0x2e12d4);}};}function respondWithFilteredResult(_0x21ed6c,_0x38e724){return function(_0x5f06b1){if(_0x5f06b1){var _0x3bef50=typeof _0x38e724['offset']==='undefined'&&typeof _0x38e724[_0x2958('0x1c')]===_0x2958('0x1d');var _0x55e261=_0x5f06b1['count'];var _0x28a92c=_0x3bef50?0x0:_0x38e724[_0x2958('0x1e')];var _0x310d07=_0x3bef50?_0x5f06b1[_0x2958('0x1f')]:_0x38e724[_0x2958('0x1e')]+_0x38e724['limit'];var _0x19a614;if(_0x310d07>=_0x55e261){_0x310d07=_0x55e261;_0x19a614=0xc8;}else{_0x19a614=0xce;}_0x21ed6c[_0x2958('0x1a')](_0x19a614);return _0x21ed6c[_0x2958('0x20')]('Content-Range',_0x28a92c+'-'+_0x310d07+'/'+_0x55e261)[_0x2958('0x21')](_0x5f06b1);}return null;};}function patchUpdates(_0x53b100){return function(_0x1da684){try{jsonpatch['apply'](_0x1da684,_0x53b100,!![]);}catch(_0x5eaf36){return BPromise[_0x2958('0x22')](_0x5eaf36);}return _0x1da684[_0x2958('0x23')]();};}function saveUpdates(_0x2a02a4,_0x26c5a5){return function(_0x2202f8){if(_0x2202f8){return _0x2202f8[_0x2958('0x24')](_0x2a02a4)[_0x2958('0x25')](function(_0x2b9818){return _0x2b9818;});}return null;};}function removeEntity(_0x330763,_0x2aa514){return function(_0xaf5547){if(_0xaf5547){return _0xaf5547[_0x2958('0x26')]()[_0x2958('0x25')](function(){_0x330763[_0x2958('0x1a')](0xcc)[_0x2958('0x1b')]();});}};}function handleEntityNotFound(_0x4f811a,_0x574df5){return function(_0x3c1155){if(!_0x3c1155){_0x4f811a[_0x2958('0x19')](0x194);}return _0x3c1155;};}function handleError(_0x28c1f5,_0x43cf73){_0x43cf73=_0x43cf73||0x1f4;return function(_0x52bd32){logger[_0x2958('0x27')](_0x52bd32['stack']);if(_0x52bd32[_0x2958('0x28')]){delete _0x52bd32[_0x2958('0x28')];}_0x28c1f5[_0x2958('0x1a')](_0x43cf73)[_0x2958('0x29')](_0x52bd32);};}exports[_0x2958('0x2a')]=function(_0x36e2a5,_0x153958){var _0x5d1dfc={},_0x21b919={},_0x5053d0={'count':0x0,'rows':[]};var _0x48650d=_[_0x2958('0x2b')](db[_0x2958('0x2c')][_0x2958('0x2d')],function(_0x34e56e){return{'name':_0x34e56e[_0x2958('0x2e')],'type':_0x34e56e[_0x2958('0x2f')][_0x2958('0x30')]};});_0x21b919[_0x2958('0x31')]=_['map'](_0x48650d,_0x2958('0x28'));_0x21b919[_0x2958('0x32')]=_['keys'](_0x36e2a5[_0x2958('0x32')]);_0x21b919['filters']=_[_0x2958('0x33')](_0x21b919['model'],_0x21b919[_0x2958('0x32')]);_0x5d1dfc['attributes']=_[_0x2958('0x33')](_0x21b919[_0x2958('0x31')],qs[_0x2958('0x34')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x34')]));_0x5d1dfc[_0x2958('0x35')]=_0x5d1dfc[_0x2958('0x35')][_0x2958('0x36')]?_0x5d1dfc[_0x2958('0x35')]:_0x21b919['model'];if(!_0x36e2a5[_0x2958('0x32')]['hasOwnProperty'](_0x2958('0x37'))){_0x5d1dfc['limit']=qs[_0x2958('0x1c')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x1c')]);_0x5d1dfc[_0x2958('0x1e')]=qs[_0x2958('0x1e')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x1e')]);}_0x5d1dfc[_0x2958('0x38')]=qs[_0x2958('0x39')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x39')]);_0x5d1dfc[_0x2958('0x3a')]=qs[_0x2958('0x3b')](_['pick'](_0x36e2a5[_0x2958('0x32')],_0x21b919[_0x2958('0x3b')]),_0x48650d);if(_0x36e2a5[_0x2958('0x32')][_0x2958('0x3c')]){_0x5d1dfc['where']=_[_0x2958('0x3d')](_0x5d1dfc[_0x2958('0x3a')],{'$or':_[_0x2958('0x2b')](_0x48650d,function(_0x3f7e27){if(_0x3f7e27[_0x2958('0x2f')]!==_0x2958('0x3e')){var _0x1ed89b={};_0x1ed89b[_0x3f7e27[_0x2958('0x28')]]={'$like':'%'+_0x36e2a5[_0x2958('0x32')][_0x2958('0x3c')]+'%'};return _0x1ed89b;}})});}_0x5d1dfc=_[_0x2958('0x3d')]({},_0x5d1dfc,_0x36e2a5[_0x2958('0x3f')]);var _0x319243={'where':_0x5d1dfc['where']};return db[_0x2958('0x2c')][_0x2958('0x1f')](_0x319243)['then'](function(_0x4fe061){_0x5053d0[_0x2958('0x1f')]=_0x4fe061;if(_0x36e2a5[_0x2958('0x32')][_0x2958('0x40')]){_0x5d1dfc[_0x2958('0x41')]=[{'all':!![]}];}return db[_0x2958('0x2c')][_0x2958('0x42')](_0x5d1dfc);})[_0x2958('0x25')](function(_0x13be6d){_0x5053d0[_0x2958('0x43')]=_0x13be6d;return _0x5053d0;})[_0x2958('0x25')](respondWithFilteredResult(_0x153958,_0x5d1dfc))[_0x2958('0x44')](handleError(_0x153958,null));};exports[_0x2958('0x45')]=function(_0xe33c56,_0x5a58ea){var _0x645b66={'raw':!![],'where':{'id':_0xe33c56[_0x2958('0x46')]['id']}},_0x112256={};_0x112256[_0x2958('0x31')]=_['keys'](db[_0x2958('0x2c')]['rawAttributes']);_0x112256['query']=_[_0x2958('0x47')](_0xe33c56[_0x2958('0x32')]);_0x112256[_0x2958('0x3b')]=_[_0x2958('0x33')](_0x112256[_0x2958('0x31')],_0x112256[_0x2958('0x32')]);_0x645b66['attributes']=_[_0x2958('0x33')](_0x112256['model'],qs['fields'](_0xe33c56[_0x2958('0x32')]['fields']));_0x645b66[_0x2958('0x35')]=_0x645b66[_0x2958('0x35')][_0x2958('0x36')]?_0x645b66[_0x2958('0x35')]:_0x112256[_0x2958('0x31')];if(_0xe33c56[_0x2958('0x32')][_0x2958('0x40')]){_0x645b66[_0x2958('0x41')]=[{'all':!![]}];}_0x645b66=_['merge']({},_0x645b66,_0xe33c56[_0x2958('0x3f')]);return db[_0x2958('0x2c')][_0x2958('0x48')](_0x645b66)[_0x2958('0x25')](handleEntityNotFound(_0x5a58ea,null))['then'](respondWithResult(_0x5a58ea,null))[_0x2958('0x44')](handleError(_0x5a58ea,null));};exports[_0x2958('0x49')]=function(_0x4a51b1,_0x1b6829){return db[_0x2958('0x2c')][_0x2958('0x49')](_0x4a51b1[_0x2958('0x4a')],{})[_0x2958('0x25')](respondWithResult(_0x1b6829,0xc9))[_0x2958('0x44')](handleError(_0x1b6829,null));};exports['update']=function(_0x1fff2a,_0x38b551){if(_0x1fff2a[_0x2958('0x4a')]['id']){delete _0x1fff2a[_0x2958('0x4a')]['id'];}return db[_0x2958('0x2c')][_0x2958('0x48')]({'where':{'id':_0x1fff2a[_0x2958('0x46')]['id']}})[_0x2958('0x25')](handleEntityNotFound(_0x38b551,null))[_0x2958('0x25')](saveUpdates(_0x1fff2a[_0x2958('0x4a')],null))[_0x2958('0x25')](respondWithResult(_0x38b551,null))[_0x2958('0x44')](handleError(_0x38b551,null));};exports[_0x2958('0x26')]=function(_0x3f7bc1,_0x1bb780){return db[_0x2958('0x2c')][_0x2958('0x48')]({'where':{'id':_0x3f7bc1['params']['id']}})[_0x2958('0x25')](handleEntityNotFound(_0x1bb780,null))['then'](removeEntity(_0x1bb780,null))[_0x2958('0x44')](handleError(_0x1bb780,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 12c4430..e42f4e7 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 _0x20ce=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x1fc84d,_0x3f469d){var _0x2658fa=function(_0x189ad0){while(--_0x189ad0){_0x1fc84d['push'](_0x1fc84d['shift']());}};_0x2658fa(++_0x3f469d);}(_0x20ce,0x10d));var _0xe20c=function(_0x2e6a82,_0x4ad451){_0x2e6a82=_0x2e6a82-0x0;var _0x1ea90d=_0x20ce[_0x2e6a82];return _0x1ea90d;};'use strict';var _=require(_0xe20c('0x0'));var util=require(_0xe20c('0x1'));var logger=require(_0xe20c('0x2'))('api');var moment=require(_0xe20c('0x3'));var BPromise=require(_0xe20c('0x4'));var rp=require(_0xe20c('0x5'));var fs=require('fs');var path=require(_0xe20c('0x6'));var rimraf=require(_0xe20c('0x7'));var config=require(_0xe20c('0x8'));var attributes=require(_0xe20c('0x9'));module[_0xe20c('0xa')]=function(_0x373f9f,_0x2c9e6a){return _0x373f9f[_0xe20c('0xb')](_0xe20c('0xc'),attributes,{'tableName':_0xe20c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe20c('0xe'),'collate':_0xe20c('0xf')});}; \ No newline at end of file +var _0x0ba7=['define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports'];(function(_0x5e05e2,_0x27b929){var _0x3801af=function(_0x409f87){while(--_0x409f87){_0x5e05e2['push'](_0x5e05e2['shift']());}};_0x3801af(++_0x27b929);}(_0x0ba7,0x16d));var _0x70ba=function(_0x4ce822,_0x5f0b59){_0x4ce822=_0x4ce822-0x0;var _0x57dc73=_0x0ba7[_0x4ce822];return _0x57dc73;};'use strict';var _=require(_0x70ba('0x0'));var util=require('util');var logger=require(_0x70ba('0x1'))(_0x70ba('0x2'));var moment=require(_0x70ba('0x3'));var BPromise=require(_0x70ba('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x70ba('0x5'));var rimraf=require(_0x70ba('0x6'));var config=require(_0x70ba('0x7'));var attributes=require(_0x70ba('0x8'));module[_0x70ba('0x9')]=function(_0x3f9877,_0x17a00c){return _0x3f9877[_0x70ba('0xa')](_0x70ba('0xb'),attributes,{'tableName':_0x70ba('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x70ba('0xd'),'collate':_0x70ba('0xe')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 6601c7a..40306a1 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 _0x4b84=['../../config/logger','rpc','http','then','info','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappApplication,\x20%s,\x20%s','message','lodash','util','randomstring','../../config/utils'];(function(_0x4f5f1e,_0xf26e2){var _0x1e5a37=function(_0x29822e){while(--_0x29822e){_0x4f5f1e['push'](_0x4f5f1e['shift']());}};_0x1e5a37(++_0xf26e2);}(_0x4b84,0x1cc));var _0x44b8=function(_0x350258,_0x4e0a50){_0x350258=_0x350258-0x0;var _0x3714b3=_0x4b84[_0x350258];return _0x3714b3;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44b8('0x3'));var logger=require(_0x44b8('0x4'))(_0x44b8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44b8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x54274b,_0x327f59,_0x5947f7){return new BPromise(function(_0x3e87c5,_0x5a2353){return client['request'](_0x54274b,_0x5947f7)[_0x44b8('0x7')](function(_0x42319d){logger[_0x44b8('0x8')]('WhatsappApplication,\x20%s,\x20%s',_0x327f59,_0x44b8('0x9'));logger[_0x44b8('0xa')](_0x44b8('0xb'),_0x327f59,_0x44b8('0x9'),JSON[_0x44b8('0xc')](_0x42319d));if(_0x42319d[_0x44b8('0xd')]){if(_0x42319d[_0x44b8('0xd')]['code']===0x1f4){logger[_0x44b8('0xd')](_0x44b8('0xe'),_0x327f59,_0x42319d['error'][_0x44b8('0xf')]);return _0x5a2353(_0x42319d['error'][_0x44b8('0xf')]);}logger[_0x44b8('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x327f59,_0x42319d[_0x44b8('0xd')]['message']);return _0x3e87c5(_0x42319d['error'][_0x44b8('0xf')]);}else{logger[_0x44b8('0x8')](_0x44b8('0xe'),_0x327f59,_0x44b8('0x9'));_0x3e87c5(_0x42319d['result']['message']);}})['catch'](function(_0x3fe9fb){logger['error'](_0x44b8('0xe'),_0x327f59,_0x3fe9fb);_0x5a2353(_0x3fe9fb);});});} \ No newline at end of file +var _0x24ca=['request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s'];(function(_0x2103d9,_0x8a6068){var _0x132cfe=function(_0x164c96){while(--_0x164c96){_0x2103d9['push'](_0x2103d9['shift']());}};_0x132cfe(++_0x8a6068);}(_0x24ca,0x1bc));var _0xa24c=function(_0x421eeb,_0x3d3e3e){_0x421eeb=_0x421eeb-0x0;var _0x2c7371=_0x24ca[_0x421eeb];return _0x2c7371;};'use strict';var _=require(_0xa24c('0x0'));var util=require('util');var moment=require(_0xa24c('0x1'));var BPromise=require(_0xa24c('0x2'));var rs=require(_0xa24c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa24c('0x4'))['db'];var utils=require(_0xa24c('0x5'));var logger=require(_0xa24c('0x6'))(_0xa24c('0x7'));var config=require(_0xa24c('0x8'));var jayson=require(_0xa24c('0x9'));var client=jayson[_0xa24c('0xa')][_0xa24c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2dd348,_0x257264,_0x9a5013){return new BPromise(function(_0x481196,_0x42d89c){return client[_0xa24c('0xc')](_0x2dd348,_0x9a5013)[_0xa24c('0xd')](function(_0x5eac78){logger[_0xa24c('0xe')](_0xa24c('0xf'),_0x257264,_0xa24c('0x10'));logger[_0xa24c('0x11')](_0xa24c('0x12'),_0x257264,_0xa24c('0x10'),JSON[_0xa24c('0x13')](_0x5eac78));if(_0x5eac78[_0xa24c('0x14')]){if(_0x5eac78[_0xa24c('0x14')]['code']===0x1f4){logger[_0xa24c('0x14')](_0xa24c('0xf'),_0x257264,_0x5eac78[_0xa24c('0x14')][_0xa24c('0x15')]);return _0x42d89c(_0x5eac78['error'][_0xa24c('0x15')]);}logger[_0xa24c('0x14')](_0xa24c('0xf'),_0x257264,_0x5eac78[_0xa24c('0x14')][_0xa24c('0x15')]);return _0x481196(_0x5eac78[_0xa24c('0x14')][_0xa24c('0x15')]);}else{logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x257264,_0xa24c('0x10'));_0x481196(_0x5eac78[_0xa24c('0x16')]['message']);}})['catch'](function(_0x221d21){logger[_0xa24c('0x14')]('WhatsappApplication,\x20%s,\x20%s',_0x257264,_0x221d21);_0x42d89c(_0x221d21);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index c5d9351..bfd349b 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 _0x7d9f=['isAuthenticated','describe','/:id','show','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','index','get'];(function(_0x2e8492,_0x4a13c1){var _0x102065=function(_0x2aa832){while(--_0x2aa832){_0x2e8492['push'](_0x2e8492['shift']());}};_0x102065(++_0x4a13c1);}(_0x7d9f,0x15c));var _0xf7d9=function(_0x47b03c,_0x2b8a51){_0x47b03c=_0x47b03c-0x0;var _0x2a3db5=_0x7d9f[_0x47b03c];return _0x2a3db5;};'use strict';var multer=require(_0xf7d9('0x0'));var util=require(_0xf7d9('0x1'));var path=require(_0xf7d9('0x2'));var timeout=require(_0xf7d9('0x3'));var express=require(_0xf7d9('0x4'));var router=express['Router']();var fs_extra=require(_0xf7d9('0x5'));var auth=require(_0xf7d9('0x6'));var interaction=require(_0xf7d9('0x7'));var config=require(_0xf7d9('0x8'));var controller=require(_0xf7d9('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xf7d9('0xa')]);router[_0xf7d9('0xb')]('/describe',auth[_0xf7d9('0xc')](),controller[_0xf7d9('0xd')]);router['get'](_0xf7d9('0xe'),auth['isAuthenticated'](),controller[_0xf7d9('0xf')]);router[_0xf7d9('0xb')]('/:id/messages',auth['isAuthenticated'](),controller[_0xf7d9('0x10')]);router[_0xf7d9('0xb')](_0xf7d9('0x11'),auth['isAuthenticated'](),controller['download']);router[_0xf7d9('0x12')]('/',auth[_0xf7d9('0xc')](),controller[_0xf7d9('0x13')]);router[_0xf7d9('0x12')]('/:id/messages',auth[_0xf7d9('0xc')](),controller[_0xf7d9('0x14')]);router[_0xf7d9('0x12')](_0xf7d9('0x15'),auth['isAuthenticated'](),interaction[_0xf7d9('0x16')](_0xf7d9('0x17'),_0xf7d9('0x18')),controller[_0xf7d9('0x19')]);router['put'](_0xf7d9('0xe'),auth[_0xf7d9('0xc')](),interaction[_0xf7d9('0x16')]('whatsapp','whatsappinteraction:update'),controller[_0xf7d9('0x1a')]);router[_0xf7d9('0x1b')](_0xf7d9('0xe'),auth['isAuthenticated'](),interaction[_0xf7d9('0x16')](_0xf7d9('0x17'),'whatsappinteraction:destroy'),controller[_0xf7d9('0x1c')]);router['delete'](_0xf7d9('0x15'),auth[_0xf7d9('0xc')](),controller['removeTags']);module[_0xf7d9('0x1d')]=router; \ No newline at end of file +var _0xe2bc=['destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappInteraction.controller','get','isAuthenticated','index','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','whatsapp','whatsappinteraction:addtags','tracked','delete','whatsappinteraction:destroy'];(function(_0x200692,_0x2b95ac){var _0x5a653d=function(_0x4ad7a5){while(--_0x4ad7a5){_0x200692['push'](_0x200692['shift']());}};_0x5a653d(++_0x2b95ac);}(_0xe2bc,0x1a6));var _0xce2b=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xe2bc[_0x5d4607];return _0x5e4a86;};'use strict';var multer=require(_0xce2b('0x0'));var util=require('util');var path=require(_0xce2b('0x1'));var timeout=require('connect-timeout');var express=require(_0xce2b('0x2'));var router=express[_0xce2b('0x3')]();var fs_extra=require(_0xce2b('0x4'));var auth=require(_0xce2b('0x5'));var interaction=require(_0xce2b('0x6'));var config=require('../../config/environment');var controller=require(_0xce2b('0x7'));router[_0xce2b('0x8')]('/',auth[_0xce2b('0x9')](),controller[_0xce2b('0xa')]);router[_0xce2b('0x8')]('/describe',auth[_0xce2b('0x9')](),controller[_0xce2b('0xb')]);router['get'](_0xce2b('0xc'),auth[_0xce2b('0x9')](),controller[_0xce2b('0xd')]);router[_0xce2b('0x8')](_0xce2b('0xe'),auth[_0xce2b('0x9')](),controller[_0xce2b('0xf')]);router[_0xce2b('0x8')](_0xce2b('0x10'),auth[_0xce2b('0x9')](),controller['download']);router[_0xce2b('0x11')]('/',auth['isAuthenticated'](),controller[_0xce2b('0x12')]);router[_0xce2b('0x11')](_0xce2b('0xe'),auth[_0xce2b('0x9')](),controller[_0xce2b('0x13')]);router[_0xce2b('0x11')](_0xce2b('0x14'),auth[_0xce2b('0x9')](),interaction['tracked'](_0xce2b('0x15'),_0xce2b('0x16')),controller['addTags']);router['put']('/:id',auth[_0xce2b('0x9')](),interaction[_0xce2b('0x17')](_0xce2b('0x15'),'whatsappinteraction:update'),controller['update']);router[_0xce2b('0x18')](_0xce2b('0xc'),auth[_0xce2b('0x9')](),interaction[_0xce2b('0x17')](_0xce2b('0x15'),_0xce2b('0x19')),controller[_0xce2b('0x1a')]);router[_0xce2b('0x18')](_0xce2b('0x14'),auth[_0xce2b('0x9')](),controller['removeTags']);module[_0xce2b('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index f48ab9f..d47407a 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 _0x5e8d=['ENUM','out','sequelize','moment','exports','BOOLEAN','DATE','STRING'];(function(_0x4fb16e,_0x396529){var _0x9d8d5f=function(_0x57de7f){while(--_0x57de7f){_0x4fb16e['push'](_0x4fb16e['shift']());}};_0x9d8d5f(++_0x396529);}(_0x5e8d,0x11a));var _0xd5e8=function(_0x208c07,_0x12d955){_0x208c07=_0x208c07-0x0;var _0xde8b68=_0x5e8d[_0x208c07];return _0xde8b68;};'use strict';var Sequelize=require(_0xd5e8('0x0'));var moment=require(_0xd5e8('0x1'));module[_0xd5e8('0x2')]={'closed':{'type':Sequelize[_0xd5e8('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd5e8('0x4')]},'disposition':{'type':Sequelize[_0xd5e8('0x5')]},'secondDisposition':{'type':Sequelize[_0xd5e8('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xd5e8('0x5')]},'phone':{'type':Sequelize[_0xd5e8('0x5')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xd5e8('0x6')]('in',_0xd5e8('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd5e8('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xd5e8('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xd5e8('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x43fd=['moment','DATE','STRING','ENUM','out','BOOLEAN'];(function(_0x564a56,_0x1822af){var _0x3dfca5=function(_0x5623f9){while(--_0x5623f9){_0x564a56['push'](_0x564a56['shift']());}};_0x3dfca5(++_0x1822af);}(_0x43fd,0x1ec));var _0xd43f=function(_0x52b406,_0x4b526d){_0x52b406=_0x52b406-0x0;var _0x45dba6=_0x43fd[_0x52b406];return _0x45dba6;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xd43f('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd43f('0x1')]},'disposition':{'type':Sequelize[_0xd43f('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xd43f('0x2')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xd43f('0x2')]},'read1stAt':{'type':Sequelize[_0xd43f('0x1')]},'firstMsgDirection':{'type':Sequelize[_0xd43f('0x3')]('in',_0xd43f('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xd43f('0x3')]('in',_0xd43f('0x4')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xd43f('0x5')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index d451624..09825f6 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 _0xbc82=['role','sequelize','toString','merge','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','push','all','rows','show','params','includeAll','options','catch','destroy','describe','addMessage','WhatsappMessage','ids','omit','getMessages','YYYY-MM-DD\x20HH:mm:ss','include','addTags','setTags','spread','findAll','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','attachments','format','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','Messages','direction','secret','WhatsappAccount','mkdirSync','Whatsapp','Owner','N.A.','closed','closedAt','existsSync','createReadStream','pipe','createWriteStream','basename','out','renderFile','downloadInteraction.ejs','transcript-','createPdfFromHTML','log','err','unlinkSync','sendStatus','eml-format','request-promise','mustache','sox','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','Users','fullname','TagIds','Tags','split','map','WhatsappInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','u.id','u.fullname','from','left_join','users','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','whatsapp_accounts','whatsapp_messages','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','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?','ContactId','text','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','find','UserId','buildExpression','body','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL'];(function(_0x4995b0,_0x4c9bab){var _0xa9fbf3=function(_0x5cef04){while(--_0x5cef04){_0x4995b0['push'](_0x4995b0['shift']());}};_0xa9fbf3(++_0x4c9bab);}(_0xbc82,0x13e));var _0x2bc8=function(_0x220540,_0x534c70){_0x220540=_0x220540-0x0;var _0x2b8b99=_0xbc82[_0x220540];return _0x2b8b99;};'use strict';var emlformat=require(_0x2bc8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2bc8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2bc8('0x2'));var util=require('util');var path=require('path');var sox=require(_0x2bc8('0x3'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2bc8('0x4'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2bc8('0x5'));var jsforce=require(_0x2bc8('0x6'));var deskjs=require(_0x2bc8('0x7'));var toCsv=require(_0x2bc8('0x8'));var querystring=require(_0x2bc8('0x9'));var Papa=require('papaparse');var Redis=require(_0x2bc8('0xa'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x2bc8('0xb'));var hardwareService=require(_0x2bc8('0xc'));var logger=require(_0x2bc8('0xd'))(_0x2bc8('0xe'));var utils=require(_0x2bc8('0xf'));var config=require(_0x2bc8('0x10'));var licenseUtil=require(_0x2bc8('0x11'));var db=require(_0x2bc8('0x12'))['db'];config[_0x2bc8('0x13')]=_['defaults'](config[_0x2bc8('0x13')],{'host':_0x2bc8('0x14'),'port':0x18eb});var socket=require(_0x2bc8('0x15'))(new Redis(config[_0x2bc8('0x13')]));require(_0x2bc8('0x16'))[_0x2bc8('0x17')](socket);function respondWithStatusCode(_0x2953bc,_0x2ef141){_0x2ef141=_0x2ef141||0xcc;return function(_0x3647f5){if(_0x3647f5){return _0x2953bc['sendStatus'](_0x2ef141);}return _0x2953bc[_0x2bc8('0x18')](_0x2ef141)[_0x2bc8('0x19')]();};}function respondWithResult(_0x2d2cbf,_0x1578d2){_0x1578d2=_0x1578d2||0xc8;return function(_0x4c5851){if(_0x4c5851){return _0x2d2cbf['status'](_0x1578d2)['json'](_0x4c5851);}};}function respondWithFilteredResult(_0x41fda2,_0x580855){return function(_0x54a20e){if(_0x54a20e){var _0xa9d06d=typeof _0x580855[_0x2bc8('0x1a')]==='undefined'&&typeof _0x580855['limit']===_0x2bc8('0x1b');var _0x5018cf=_0x54a20e['count'];var _0x388168=_0xa9d06d?0x0:_0x580855[_0x2bc8('0x1a')];var _0x38b115=_0xa9d06d?_0x54a20e[_0x2bc8('0x1c')]:_0x580855['offset']+_0x580855[_0x2bc8('0x1d')];var _0x2949b3;if(_0x38b115>=_0x5018cf){_0x38b115=_0x5018cf;_0x2949b3=0xc8;}else{_0x2949b3=0xce;}_0x41fda2[_0x2bc8('0x18')](_0x2949b3);return _0x41fda2[_0x2bc8('0x1e')](_0x2bc8('0x1f'),_0x388168+'-'+_0x38b115+'/'+_0x5018cf)[_0x2bc8('0x20')](_0x54a20e);}return null;};}function patchUpdates(_0x25da28){return function(_0x107f68){try{jsonpatch[_0x2bc8('0x21')](_0x107f68,_0x25da28,!![]);}catch(_0x4cb8e1){return BPromise[_0x2bc8('0x22')](_0x4cb8e1);}return _0x107f68[_0x2bc8('0x23')]();};}function saveUpdates(_0x46c783,_0x2e5e60){return function(_0x3ab75c){if(_0x3ab75c){return _0x3ab75c[_0x2bc8('0x24')](_0x46c783)[_0x2bc8('0x25')](function(_0x4ec831){return _0x4ec831;});}return null;};}function removeEntity(_0x10dea1,_0xd824cf){return function(_0x12f9ab){if(_0x12f9ab){return _0x12f9ab['destroy']()[_0x2bc8('0x25')](function(){_0x10dea1[_0x2bc8('0x18')](0xcc)[_0x2bc8('0x19')]();});}};}function handleEntityNotFound(_0x37ffb6,_0x546c4e){return function(_0x25342b){if(!_0x25342b){_0x37ffb6['sendStatus'](0x194);}return _0x25342b;};}function handleError(_0x8f2304,_0x3c8e5e){_0x3c8e5e=_0x3c8e5e||0x1f4;return function(_0x2b9d81){logger[_0x2bc8('0x26')](_0x2b9d81[_0x2bc8('0x27')]);if(_0x2b9d81['name']){delete _0x2b9d81[_0x2bc8('0x28')];}_0x8f2304['status'](_0x3c8e5e)['send'](_0x2b9d81);};}function getInteractionUsers(_0xcd2d3e,_0x2b5c6a){return new BPromise(function(_0x26e9ff,_0x4dc0fe){try{if(_0x2b5c6a[_0xcd2d3e['id']]){_0xcd2d3e[_0x2bc8('0x29')]=_['map'](_0x2b5c6a[_0xcd2d3e['id']],function(_0x2853a4){return{'id':_0x2853a4['id'],'fullname':_0x2853a4[_0x2bc8('0x2a')]};});}}catch(_0x3515ab){_0x4dc0fe(_0x3515ab);}_0x26e9ff(_0xcd2d3e);});}function getInteractionTags(_0x1262a3,_0x53e079){return new BPromise(function(_0x1a359f,_0x4f5361){try{if(_0x1262a3[_0x2bc8('0x2b')]){_0x1262a3[_0x2bc8('0x2c')]=[];_0x1262a3[_0x2bc8('0x2b')][_0x2bc8('0x2d')](',')['forEach'](function(_0x436515){_0x1262a3[_0x2bc8('0x2c')]['push'](_0x53e079[_0x436515]);});}delete _0x1262a3[_0x2bc8('0x2b')];}catch(_0x27e6c7){_0x4f5361(_0x27e6c7);}_0x1a359f(_0x1262a3);});}function updateWhatsappInteraction(_0x2450ca,_0x4af0f5,_0x5c87df){return new BPromise(function(_0x3576d0,_0x3b6b02){return getInteractionUsers(_0x2450ca,_0x5c87df)[_0x2bc8('0x25')](function(_0x2112d1){return getInteractionTags(_0x2112d1,_0x4af0f5);})[_0x2bc8('0x25')](function(_0x21bcfd){_0x3576d0(_0x21bcfd);})['catch'](function(_0x1b0c25){_0x3b6b02(_0x1b0c25);});});}exports['index']=function(_0x2c655e,_0x387231){var _0x4a7b33={},_0x505f5a={},_0x42bc4e={'count':0x0,'rows':[]};var _0x4e61ac=_[_0x2bc8('0x2e')](db[_0x2bc8('0x2f')][_0x2bc8('0x30')],function(_0x11656e){return{'name':_0x11656e[_0x2bc8('0x31')],'type':_0x11656e[_0x2bc8('0x32')][_0x2bc8('0x33')]};});_0x505f5a[_0x2bc8('0x34')]=_['map'](_0x4e61ac,_0x2bc8('0x28'));_0x505f5a[_0x2bc8('0x35')]=_[_0x2bc8('0x36')](_0x2c655e[_0x2bc8('0x35')]);_0x505f5a[_0x2bc8('0x37')]=_['intersection'](_0x505f5a[_0x2bc8('0x34')],_0x505f5a[_0x2bc8('0x35')]);_0x4a7b33[_0x2bc8('0x38')]=_[_0x2bc8('0x39')](_0x505f5a[_0x2bc8('0x34')],qs['fields'](_0x2c655e['query'][_0x2bc8('0x3a')]));_0x4a7b33[_0x2bc8('0x38')]=_0x4a7b33['attributes'][_0x2bc8('0x3b')]?_0x4a7b33[_0x2bc8('0x38')]:_0x505f5a[_0x2bc8('0x34')];if(!_0x2c655e['query'][_0x2bc8('0x3c')](_0x2bc8('0x3d'))){_0x4a7b33['limit']=qs[_0x2bc8('0x1d')](_0x2c655e[_0x2bc8('0x35')]['limit']);_0x4a7b33[_0x2bc8('0x1a')]=qs[_0x2bc8('0x1a')](_0x2c655e[_0x2bc8('0x35')][_0x2bc8('0x1a')]);}_0x4a7b33[_0x2bc8('0x3e')]=qs[_0x2bc8('0x3f')](_0x2c655e[_0x2bc8('0x35')]['sort']);_0x4a7b33[_0x2bc8('0x40')]=qs[_0x2bc8('0x37')](_[_0x2bc8('0x41')](_0x2c655e['query'],_0x505f5a[_0x2bc8('0x37')]),_0x4e61ac);var _0x55e244=[];var _0x23a3e0=squel[_0x2bc8('0x42')]()[_0x2bc8('0x43')]('id')[_0x2bc8('0x43')](_0x2bc8('0x28'))['field'](_0x2bc8('0x44'))['from']('tools_tags');var _0x1c426a=squel[_0x2bc8('0x42')]()[_0x2bc8('0x43')](_0x2bc8('0x45'))[_0x2bc8('0x43')](_0x2bc8('0x46'))['field']('ui.WhatsappInteractionId')[_0x2bc8('0x47')]('user_has_whatsapp_interactions','ui')[_0x2bc8('0x48')](_0x2bc8('0x49'),'u','u.id\x20=\x20ui.UserId');var _0x5aba05=squel['select']()[_0x2bc8('0x47')](_0x2bc8('0x4a'),'i')[_0x2bc8('0x48')](_0x2bc8('0x4b'),'c',_0x2bc8('0x4c'))['left_join'](_0x2bc8('0x49'),'o','o.id\x20=\x20i.UserId')[_0x2bc8('0x48')](_0x2bc8('0x4d'),'a','a.id\x20=\x20i.WhatsappAccountId')[_0x2bc8('0x48')](_0x2bc8('0x4e'),'me','me.WhatsappInteractionId\x20=\x20i.id')[_0x2bc8('0x48')](_0x2bc8('0x4f'),'it',_0x2bc8('0x50'))[_0x2bc8('0x48')](_0x2bc8('0x51'),'t',_0x2bc8('0x52'));var _0x2cd1d9=squel[_0x2bc8('0x53')]();var _0x57ba46=[];var _0x1b9720=squel[_0x2bc8('0x53')]();var _0x31446f;if(_0x2c655e[_0x2bc8('0x35')]['search']){_0x31446f=as[_0x2bc8('0x54')](_0x2c655e[_0x2bc8('0x35')][_0x2bc8('0x55')]);var _0x42f8fb=_0x31446f[_0x2bc8('0x56')];for(var _0x5ce32d=0x0;_0x5ce32d<_0x31446f[_0x2bc8('0x57')][_0x2bc8('0x3b')];_0x5ce32d++){var _0x5eeb9a=_0x31446f['conditions'][_0x5ce32d];var _0x4e79fe='i';var _0x2fa657=_['find'](_0x4e61ac,[_0x2bc8('0x28'),_0x5eeb9a[_0x2bc8('0x43')]]);if(!_0x2fa657){switch(_0x5eeb9a[_0x2bc8('0x43')]){case _0x2bc8('0x58'):if(_0x5eeb9a[_0x2bc8('0x59')]==0x1){_0x5aba05[_0x2bc8('0x5a')]('`'+_0x5eeb9a[_0x2bc8('0x43')]+_0x2bc8('0x5b'));}else{_0x5aba05[_0x2bc8('0x5a')]('`'+_0x5eeb9a[_0x2bc8('0x43')]+_0x2bc8('0x5c'));}break;case _0x2bc8('0x5d'):if(_0x5eeb9a[_0x2bc8('0x5e')]===_0x2bc8('0x5f')){if(_0x5eeb9a[_0x2bc8('0x59')][_0x2bc8('0x2d')]('\x20')['length']>0x1){_0x2cd1d9[_0x42f8fb](_0x2bc8('0x60'),qs[_0x2bc8('0x61')](_0x5eeb9a[_0x2bc8('0x59')]),null);}else{var _0x198cd4='%'+_0x5eeb9a[_0x2bc8('0x59')]+'%';_0x2cd1d9[_0x42f8fb](_0x2bc8('0x62'),_0x198cd4,_0x198cd4,_0x198cd4);}}else{_0x2fa657=_['find'](_0x4e61ac,[_0x2bc8('0x28'),'ContactId']);_0x5eeb9a['field']=_0x2bc8('0x63');_0x3b9311=as['buildExpression'](_0x4e79fe,_0x2fa657['type'],_0x5eeb9a);_0x2cd1d9[_0x42f8fb](_0x3b9311[_0x2bc8('0x64')],_0x3b9311[_0x2bc8('0x59')][_0x2bc8('0x65')],_0x3b9311[_0x2bc8('0x59')][_0x2bc8('0x19')]);}break;case _0x2bc8('0x66'):var _0x267f86=_0x5eeb9a[_0x2bc8('0x59')][_0x2bc8('0x2d')](',')[_0x2bc8('0x2e')](function(_0x3a4868){return Number(_0x3a4868);});_0x267f86[_0x2bc8('0x67')](function(_0x16d39c){_0x1b9720['or'](_0x2bc8('0x68'),'%,'+_0x16d39c+',%');});_0x57ba46=_[_0x2bc8('0x69')](_0x57ba46,_0x267f86);break;case _0x2bc8('0x6a'):if(_0x5eeb9a['operator']===_0x2bc8('0x5f')){_0x2cd1d9[_0x42f8fb]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x5eeb9a[_0x2bc8('0x59')]+'%',null);}else{_0x2fa657=_[_0x2bc8('0x6b')](_0x4e61ac,[_0x2bc8('0x28'),_0x2bc8('0x6c')]);_0x5eeb9a[_0x2bc8('0x43')]=_0x2bc8('0x6c');_0x3b9311=as[_0x2bc8('0x6d')](_0x4e79fe,_0x2fa657[_0x2bc8('0x32')],_0x5eeb9a);_0x2cd1d9[_0x42f8fb](_0x3b9311[_0x2bc8('0x64')],_0x3b9311[_0x2bc8('0x59')][_0x2bc8('0x65')],_0x3b9311[_0x2bc8('0x59')][_0x2bc8('0x19')]);}break;case _0x2bc8('0x6e'):_0x3b9311=as['buildExpression']('me',null,_0x5eeb9a);_0x2cd1d9[_0x42f8fb](_0x3b9311[_0x2bc8('0x64')],_0x3b9311[_0x2bc8('0x59')][_0x2bc8('0x65')],_0x3b9311[_0x2bc8('0x59')][_0x2bc8('0x19')]);break;}}else{var _0x3b9311=as[_0x2bc8('0x6d')](_0x4e79fe,_0x2fa657[_0x2bc8('0x32')],_0x5eeb9a);_0x2cd1d9[_0x42f8fb](_0x3b9311['text'],_0x3b9311['value'][_0x2bc8('0x65')],_0x3b9311[_0x2bc8('0x59')][_0x2bc8('0x19')]);}}}else{var _0x44dbcc=_(_0x2c655e[_0x2bc8('0x35')])[_0x2bc8('0x36')]()['map'](function(_0x27a1b8){return _['some'](_0x4e61ac,[_0x2bc8('0x28'),_0x27a1b8])?_0x27a1b8:undefined;})[_0x2bc8('0x6f')]()[_0x2bc8('0x59')]();if(!_[_0x2bc8('0x70')](_0x44dbcc)){_0x44dbcc['forEach'](function(_0x2f5880){if(_0x2f5880===_0x2bc8('0x71')){_0x5aba05['where'](_0x2bc8('0x72'),[][_0x2bc8('0x73')](_0x2c655e[_0x2bc8('0x35')][_0x2f5880]));}else if(_0x2f5880===_0x2bc8('0x74')){var _0xb7b396=JSON[_0x2bc8('0x75')](_0x2c655e['query'][_0x2f5880])[_0x2bc8('0x76')];var _0x508aac=JSON[_0x2bc8('0x75')](_0x2c655e[_0x2bc8('0x35')][_0x2f5880])[_0x2bc8('0x77')];_0x5aba05[_0x2bc8('0x40')](_0x2bc8('0x78'),_0xb7b396,_0x508aac);}else{if(_0x2c655e[_0x2bc8('0x35')][_0x2f5880]===_0x2bc8('0x79')){_0x5aba05[_0x2bc8('0x40')]('i.'+_0x2f5880+'\x20IS\x20NULL');}else{_0x5aba05[_0x2bc8('0x40')]('i.'+_0x2f5880+_0x2bc8('0x7a'),_0x2c655e['query'][_0x2f5880]);}}});}if(_0x2c655e['query'][_0x2bc8('0x7b')]){if(_0x2c655e[_0x2bc8('0x35')]['read']==0x1){_0x5aba05[_0x2bc8('0x5a')](_0x2bc8('0x7c'));}else{_0x5aba05[_0x2bc8('0x5a')](_0x2bc8('0x7d'));}}if(_0x2c655e[_0x2bc8('0x35')][_0x2bc8('0x7e')]){_0x57ba46=_['isArray'](_0x2c655e['query'][_0x2bc8('0x7e')])?_0x2c655e['query'][_0x2bc8('0x7e')]:new Array(_0x2c655e[_0x2bc8('0x35')][_0x2bc8('0x7e')]);_0x57ba46[_0x2bc8('0x67')](function(_0x538d5a){_0x1b9720['or'](_0x2bc8('0x68'),'%,'+_0x538d5a+',%');});}if(_0x2c655e['query'][_0x2bc8('0x7f')]){var _0x366e17=_0x2c655e[_0x2bc8('0x35')][_0x2bc8('0x7f')][_0x2bc8('0x80')]('\x5c','\x5c\x5c')[_0x2bc8('0x80')](/'/g,'\x27\x27');if(qs[_0x2bc8('0x81')](_0x366e17)){_0x2cd1d9['or'](_0x2bc8('0x82'),_0x366e17+'%')['or']('i.phone\x20LIKE\x20?',_0x366e17+'%');}else{_0x2cd1d9['or'](_0x2bc8('0x83'),qs[_0x2bc8('0x61')](_0x366e17))['or'](_0x2bc8('0x84'),_0x366e17+'%');}}}_0x5aba05['where'](_0x2cd1d9);_0x5aba05[_0x2bc8('0x85')](_0x2bc8('0x86'));var _0x2fc314={'type':db[_0x2bc8('0x87')][_0x2bc8('0x88')]['SELECT'],'raw':!![]};var _0x3cb838=_0x5aba05['clone']();_0x3cb838[_0x2bc8('0x43')](_0x2bc8('0x86'));_0x3cb838[_0x2bc8('0x43')](_0x2bc8('0x89'),'unreadMessages');if(_0x4a7b33[_0x2bc8('0x3e')]){_0x4a7b33[_0x2bc8('0x3e')][_0x2bc8('0x67')](function(_0x1f92f2){var _0x499bf6=_0x1f92f2[0x0]===_0x2bc8('0x8a')?_0x1f92f2[0x0]:'i.'+_0x1f92f2[0x0];_0x5aba05['order'](_0x499bf6,_0x1f92f2[0x1]===_0x2bc8('0x8b')?![]:!![]);});}if(!_['isEmpty'](_0x57ba46)){_0x5aba05[_0x2bc8('0x5a')](_0x1b9720);_0x3cb838['where']('t.id\x20IN\x20?',_0x57ba46);}BPromise[_0x2bc8('0x8c')]()[_0x2bc8('0x25')](function(){if(!_0x31446f){if(_0x2c655e[_0x2bc8('0x35')][_0x2bc8('0x71')])return;_0x3cb838['where'](_0x2bc8('0x8d'));_0x5aba05[_0x2bc8('0x40')](_0x2bc8('0x8d'));return;}if(_0x2c655e[_0x2bc8('0x8e')]['role']!==_0x2bc8('0x8f'))return;return _0x2c655e[_0x2bc8('0x8e')][_0x2bc8('0x90')]({'attributes':['id'],'raw':!![]})[_0x2bc8('0x25')](function(_0x26f8e1){if(_[_0x2bc8('0x70')](_0x26f8e1)){_0x3cb838[_0x2bc8('0x40')](_0x2bc8('0x91'));_0x5aba05[_0x2bc8('0x40')]('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x3cb838['where']('i.WhatsappAccountId\x20IN\x20?',_['map'](_0x26f8e1,'id'));_0x5aba05[_0x2bc8('0x40')](_0x2bc8('0x72'),_[_0x2bc8('0x2e')](_0x26f8e1,'id'));}});})['then'](function(){if(_0x2c655e[_0x2bc8('0x8e')][_0x2bc8('0x92')]===_0x2bc8('0x8f')&&!_0x31446f&&!_0x2c655e[_0x2bc8('0x35')][_0x2bc8('0x71')])return[];return db[_0x2bc8('0x93')][_0x2bc8('0x35')](_0x3cb838['toString'](),_0x2fc314);})[_0x2bc8('0x25')](function(_0x2d1cfb){_0x42bc4e[_0x2bc8('0x1c')]=_0x2d1cfb[_0x2bc8('0x3b')];if(_0x42bc4e['count']===0x0)return[];return db['sequelize'][_0x2bc8('0x35')](_0x23a3e0[_0x2bc8('0x94')](),_0x2fc314)[_0x2bc8('0x25')](function(_0x886866){_0x55e244=_['keyBy'](_0x886866,'id');_0x2fc314=_[_0x2bc8('0x95')](_0x2fc314,{'model':db[_0x2bc8('0x2f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2c655e[_0x2bc8('0x35')][_0x2bc8('0x3a')]){_0x4a7b33[_0x2bc8('0x38')][_0x2bc8('0x67')](function(_0x4403ee){_0x5aba05[_0x2bc8('0x43')]('i.'+_0x4403ee);});}else{_0x5aba05[_0x2bc8('0x43')](_0x2bc8('0x89'),'unreadMessages');_0x5aba05[_0x2bc8('0x43')](_0x2bc8('0x96'),'Account.key');_0x5aba05[_0x2bc8('0x43')](_0x2bc8('0x97'),_0x2bc8('0x98'));_0x5aba05[_0x2bc8('0x43')](_0x2bc8('0x99'),_0x2bc8('0x8a'));_0x5aba05[_0x2bc8('0x43')]('i.*');_0x5aba05[_0x2bc8('0x43')](_0x2bc8('0x9a'),_0x2bc8('0x9b'));_0x5aba05[_0x2bc8('0x43')](_0x2bc8('0x9c'),_0x2bc8('0x9d'));_0x5aba05[_0x2bc8('0x43')](_0x2bc8('0x9e'),_0x2bc8('0x9f'));_0x5aba05[_0x2bc8('0x43')](_0x2bc8('0xa0'),_0x2bc8('0xa1'));_0x5aba05['field'](_0x2bc8('0xa2'),_0x2bc8('0xa3'));_0x5aba05[_0x2bc8('0x43')](_0x2bc8('0xa4'),'Contact.fax');_0x5aba05[_0x2bc8('0x43')](_0x2bc8('0xa5'),'Owner.fullname');_0x5aba05[_0x2bc8('0x43')](_0x2bc8('0xa6'),_0x2bc8('0xa7'));_0x5aba05[_0x2bc8('0x43')](_0x2bc8('0xa8'),_0x2bc8('0x2b'));}if(_0x4a7b33[_0x2bc8('0x1d')])_0x5aba05['limit'](_0x4a7b33[_0x2bc8('0x1d')]);if(_0x4a7b33[_0x2bc8('0x1a')])_0x5aba05[_0x2bc8('0x1a')](_0x4a7b33[_0x2bc8('0x1a')]);return db[_0x2bc8('0x93')]['query'](_0x5aba05[_0x2bc8('0x94')](),_0x2fc314);})[_0x2bc8('0x25')](function(_0x1d54bc){if(_0x1d54bc[_0x2bc8('0x3b')]>0x0)_0x1c426a[_0x2bc8('0x40')](_0x2bc8('0xa9'),_[_0x2bc8('0x2e')](_0x1d54bc,'id'));return db[_0x2bc8('0x93')]['query'](_0x1c426a[_0x2bc8('0x94')](),_0x2fc314)[_0x2bc8('0x25')](function(_0x3486fc){var _0x232c1f=_[_0x2bc8('0xaa')](_0x3486fc,'WhatsappInteractionId');var _0x5379be=[];_0x1d54bc['forEach'](function(_0x122639){_0x5379be[_0x2bc8('0xab')](updateWhatsappInteraction(_0x122639,_0x55e244,_0x232c1f));});return BPromise[_0x2bc8('0xac')](_0x5379be);});});})[_0x2bc8('0x25')](function(_0x52f860){_0x42bc4e[_0x2bc8('0xad')]=_0x52f860;return _0x42bc4e;})['then'](respondWithFilteredResult(_0x387231,_0x4a7b33))['catch'](handleError(_0x387231,null));};exports[_0x2bc8('0xae')]=function(_0x4ec4c7,_0x47d497){var _0x467d7a={'raw':![],'where':{'id':_0x4ec4c7[_0x2bc8('0xaf')]['id']}},_0x56a89a={};_0x56a89a['model']=_['keys'](db[_0x2bc8('0x2f')][_0x2bc8('0x30')]);_0x56a89a[_0x2bc8('0x35')]=_[_0x2bc8('0x36')](_0x4ec4c7[_0x2bc8('0x35')]);_0x56a89a[_0x2bc8('0x37')]=_[_0x2bc8('0x39')](_0x56a89a[_0x2bc8('0x34')],_0x56a89a[_0x2bc8('0x35')]);_0x467d7a[_0x2bc8('0x38')]=_[_0x2bc8('0x39')](_0x56a89a[_0x2bc8('0x34')],qs['fields'](_0x4ec4c7[_0x2bc8('0x35')][_0x2bc8('0x3a')]));_0x467d7a[_0x2bc8('0x38')]=_0x467d7a['attributes'][_0x2bc8('0x3b')]?_0x467d7a[_0x2bc8('0x38')]:_0x56a89a[_0x2bc8('0x34')];if(_0x4ec4c7['query'][_0x2bc8('0xb0')]){_0x467d7a['include']=[{'all':!![]}];}_0x467d7a=_[_0x2bc8('0x95')]({},_0x467d7a,_0x4ec4c7[_0x2bc8('0xb1')]);return db[_0x2bc8('0x2f')][_0x2bc8('0x6b')](_0x467d7a)[_0x2bc8('0x25')](handleEntityNotFound(_0x47d497,null))['then'](respondWithResult(_0x47d497,null))[_0x2bc8('0xb2')](handleError(_0x47d497,null));};exports['create']=function(_0x43708b,_0x3312b6){return db[_0x2bc8('0x2f')]['create'](_0x43708b['body'],{})[_0x2bc8('0x25')](respondWithResult(_0x3312b6,0xc9))[_0x2bc8('0xb2')](handleError(_0x3312b6,null));};exports[_0x2bc8('0x24')]=function(_0x5396fc,_0x14d004){if(_0x5396fc['body']['id']){delete _0x5396fc[_0x2bc8('0x6e')]['id'];}return db[_0x2bc8('0x2f')][_0x2bc8('0x6b')]({'where':{'id':_0x5396fc['params']['id']}})[_0x2bc8('0x25')](handleEntityNotFound(_0x14d004,null))[_0x2bc8('0x25')](saveUpdates(_0x5396fc['body'],null))[_0x2bc8('0x25')](respondWithResult(_0x14d004,null))[_0x2bc8('0xb2')](handleError(_0x14d004,null));};exports[_0x2bc8('0xb3')]=function(_0x2376c8,_0x4185ef){return db[_0x2bc8('0x2f')]['find']({'where':{'id':_0x2376c8['params']['id']}})[_0x2bc8('0x25')](handleEntityNotFound(_0x4185ef,null))['then'](removeEntity(_0x4185ef,null))[_0x2bc8('0xb2')](handleError(_0x4185ef,null));};exports[_0x2bc8('0xb4')]=function(_0x1a4826,_0x3eb5b8){return db[_0x2bc8('0x2f')][_0x2bc8('0xb4')]()['then'](respondWithResult(_0x3eb5b8,null))[_0x2bc8('0xb2')](handleError(_0x3eb5b8,null));};exports[_0x2bc8('0xb5')]=function(_0x3d2528,_0x2aa3e1,_0x372d41){return db[_0x2bc8('0xb6')][_0x2bc8('0x6b')]({'where':{'id':_0x3d2528['params']['id']}})[_0x2bc8('0x25')](handleEntityNotFound(_0x2aa3e1,null))[_0x2bc8('0x25')](function(_0x2f4aa9){if(_0x2f4aa9){return _0x2f4aa9[_0x2bc8('0xb5')](_0x3d2528['body'][_0x2bc8('0xb7')],_[_0x2bc8('0xb8')](_0x3d2528[_0x2bc8('0x6e')],[_0x2bc8('0xb7'),'id'])||{});}})['then'](respondWithResult(_0x2aa3e1,null))['catch'](handleError(_0x2aa3e1,null));};exports[_0x2bc8('0xb9')]=function(_0x53bfe9,_0x513e38,_0x5bb43f){var _0xd5b6b0={'raw':![],'where':{}};var _0x4f82b3={};var _0x2d4f43={'count':0x0,'rows':[]};return db[_0x2bc8('0x2f')]['findOne']({'where':{'id':_0x53bfe9[_0x2bc8('0xaf')]['id']}})[_0x2bc8('0x25')](handleEntityNotFound(_0x513e38,null))['then'](function(_0x538a72){if(_0x538a72){_0x4f82b3['model']=_[_0x2bc8('0x36')](db[_0x2bc8('0xb6')][_0x2bc8('0x30')]);_0x4f82b3[_0x2bc8('0x35')]=_['keys'](_0x53bfe9[_0x2bc8('0x35')]);_0x4f82b3[_0x2bc8('0x37')]=_[_0x2bc8('0x39')](_0x4f82b3[_0x2bc8('0x34')],_0x4f82b3[_0x2bc8('0x35')]);_0xd5b6b0[_0x2bc8('0x38')]=_[_0x2bc8('0x39')](_0x4f82b3[_0x2bc8('0x34')],qs[_0x2bc8('0x3a')](_0x53bfe9['query'][_0x2bc8('0x3a')]));_0xd5b6b0['attributes']=_0xd5b6b0[_0x2bc8('0x38')][_0x2bc8('0x3b')]?_0xd5b6b0[_0x2bc8('0x38')]:_0x4f82b3[_0x2bc8('0x34')];if(!_0x53bfe9[_0x2bc8('0x35')]['hasOwnProperty'](_0x2bc8('0x3d'))){_0xd5b6b0[_0x2bc8('0x1d')]=qs['limit'](_0x53bfe9['query']['limit']);_0xd5b6b0[_0x2bc8('0x1a')]=qs[_0x2bc8('0x1a')](_0x53bfe9[_0x2bc8('0x35')][_0x2bc8('0x1a')]);}_0xd5b6b0[_0x2bc8('0x3e')]=qs['sort'](_0x53bfe9['query'][_0x2bc8('0x3f')]);_0xd5b6b0[_0x2bc8('0x40')]=qs[_0x2bc8('0x37')](_[_0x2bc8('0x41')](_0x53bfe9[_0x2bc8('0x35')],_0x4f82b3[_0x2bc8('0x37')]));_0xd5b6b0['where']['WhatsappInteractionId']=_0x538a72['id'];if(_0x53bfe9[_0x2bc8('0x35')][_0x2bc8('0x7f')]){_0xd5b6b0['where']=_['merge'](_0xd5b6b0['where'],{'$or':_['map'](_0xd5b6b0[_0x2bc8('0x38')],function(_0x2c4aa3){var _0x3ba1ac={};_0x3ba1ac[_0x2c4aa3]={'$like':'%'+_0x53bfe9[_0x2bc8('0x35')][_0x2bc8('0x7f')]+'%'};return _0x3ba1ac;})});}if(_0x53bfe9[_0x2bc8('0x35')][_0x2bc8('0x76')]){var _0x27116b=_0x53bfe9[_0x2bc8('0x35')]['$gte']['split'](',');var _0x250b10={};_0x250b10[_0x27116b[0x0]]={'$gte':moment(_0x27116b[0x1])['format'](_0x2bc8('0xba'))};_0xd5b6b0[_0x2bc8('0x40')]=_[_0x2bc8('0x95')](_0xd5b6b0[_0x2bc8('0x40')],_0x250b10);}_0xd5b6b0=_[_0x2bc8('0x95')]({},_0xd5b6b0,_0x53bfe9[_0x2bc8('0xb1')]);return db['WhatsappMessage']['count']({'where':_0xd5b6b0[_0x2bc8('0x40')]})[_0x2bc8('0x25')](function(_0x397a5a){_0x2d4f43[_0x2bc8('0x1c')]=_0x397a5a;if(_0x53bfe9[_0x2bc8('0x35')][_0x2bc8('0xb0')]){_0xd5b6b0[_0x2bc8('0xbb')]=[{'all':!![]}];}return db[_0x2bc8('0xb6')]['findAll'](_0xd5b6b0);})['then'](function(_0x375893){_0x2d4f43['rows']=_0x375893;return _0x2d4f43;});}})[_0x2bc8('0x25')](respondWithFilteredResult(_0x513e38,_0xd5b6b0))[_0x2bc8('0xb2')](handleError(_0x513e38,null));};exports[_0x2bc8('0xbc')]=function(_0x6e5df4,_0x27f7e3,_0x3846f3){return db[_0x2bc8('0x2f')][_0x2bc8('0x6b')]({'where':{'id':_0x6e5df4['params']['id']}})[_0x2bc8('0x25')](handleEntityNotFound(_0x27f7e3,null))[_0x2bc8('0x25')](function(_0x454919){if(_0x454919){return _0x454919[_0x2bc8('0xbd')](_0x6e5df4[_0x2bc8('0x6e')][_0x2bc8('0xb7')],_[_0x2bc8('0xb8')](_0x6e5df4[_0x2bc8('0x6e')],[_0x2bc8('0xb7'),'id'])||{})[_0x2bc8('0xbe')](function(){return db['Tag'][_0x2bc8('0xbf')]({'attributes':['id','name',_0x2bc8('0x44')],'where':{'id':_0x6e5df4[_0x2bc8('0x6e')][_0x2bc8('0xb7')]}});})['then'](function(_0x6912c7){socket[_0x2bc8('0xc0')](_0x2bc8('0xc1'),{'id':Number(_0x6e5df4[_0x2bc8('0xaf')]['id']),'tags':_0x6912c7||[]});return{'id':Number(_0x6e5df4[_0x2bc8('0xaf')]['id']),'tags':_0x6912c7||[]};});}})[_0x2bc8('0x25')](respondWithResult(_0x27f7e3,null))['catch'](handleError(_0x27f7e3,null));};exports[_0x2bc8('0xc2')]=function(_0x53fc8e,_0x7c24f8,_0x5983ea){return db[_0x2bc8('0x2f')][_0x2bc8('0x6b')]({'where':{'id':_0x53fc8e[_0x2bc8('0xaf')]['id']}})[_0x2bc8('0x25')](handleEntityNotFound(_0x7c24f8,null))['then'](function(_0x1c899f){if(_0x1c899f){return _0x1c899f[_0x2bc8('0xc2')](_0x53fc8e[_0x2bc8('0x35')]['ids']);}})[_0x2bc8('0x25')](respondWithStatusCode(_0x7c24f8,null))[_0x2bc8('0xb2')](handleError(_0x7c24f8,null));};exports[_0x2bc8('0xc3')]=function(_0x1cd086,_0x261ede){var _0x195720=moment()[_0x2bc8('0xc4')]()[_0x2bc8('0x94')]();var _0x514d22=path[_0x2bc8('0xc5')](config[_0x2bc8('0xc6')],_0x2bc8('0xc7'),'files','tmp');var _0x1a982e=path[_0x2bc8('0xc5')](config[_0x2bc8('0xc6')],_0x2bc8('0xc7'),_0x2bc8('0xc8'),_0x2bc8('0xc9'));var _0x26222f=path[_0x2bc8('0xc5')](_0x514d22,_0x195720);var _0x222817=util[_0x2bc8('0xca')](_0x2bc8('0xcb'),_0x1cd086[_0x2bc8('0xaf')]['id'],_0x195720);var _0x36f7d4=path[_0x2bc8('0xc5')](_0x514d22,_0x222817);var _0x2b862c=[];_0x2b862c['push']({'model':db[_0x2bc8('0x6a')],'as':_0x2bc8('0x6a'),'attributes':['id',_0x2bc8('0x2a')],'raw':!![]});_0x2b862c[_0x2bc8('0xab')]({'model':db[_0x2bc8('0xcc')],'as':_0x2bc8('0x5d'),'attributes':['id',_0x2bc8('0xcd'),_0x2bc8('0xce')],'raw':!![]});if(_0x1cd086['query'][_0x2bc8('0xc9')]){_0x2b862c[_0x2bc8('0xab')]({'model':db[_0x2bc8('0xcf')],'as':_0x2bc8('0xcf'),'raw':!![]});}var _0x3cd13b=[{'model':db[_0x2bc8('0xb6')],'as':_0x2bc8('0xd0'),'attributes':['id','body',_0x2bc8('0x74'),_0x2bc8('0xd1'),_0x2bc8('0xd2'),_0x2bc8('0x7b')],'include':_0x2b862c}];_0x3cd13b[_0x2bc8('0xab')]({'model':db[_0x2bc8('0xd3')],'as':'Account','attributes':['id','name']});_0x3cd13b[_0x2bc8('0xab')]({'model':db[_0x2bc8('0x6a')],'as':'Owner','attributes':['id','fullname']});return db['WhatsappInteraction'][_0x2bc8('0x6b')]({'where':{'id':_0x1cd086[_0x2bc8('0xaf')]['id']},'include':_0x3cd13b})[_0x2bc8('0x25')](handleEntityNotFound(_0x261ede,null))[_0x2bc8('0x25')](function(_0x291ab4){if(_0x291ab4){var _0x172752=_0x291ab4['get']({'plain':!![]});fs[_0x2bc8('0xd4')](_0x26222f);var _0x1cec94={'channel':_0x2bc8('0xd5'),'account':_0x172752['Account'][_0x2bc8('0x28')],'agent':_0x172752[_0x2bc8('0xd6')]?_0x172752[_0x2bc8('0xd6')][_0x2bc8('0x2a')]:_0x2bc8('0xd7'),'createdAt':moment(_0x172752['createdAt'])[_0x2bc8('0xca')]('YYYY-MM-DD\x20HH:mm:ss')[_0x2bc8('0x94')](),'closedAt':_0x172752[_0x2bc8('0xd8')]?moment(_0x172752[_0x2bc8('0xd9')])[_0x2bc8('0xca')](_0x2bc8('0xba'))['toString']():'','disposition':_0x172752['disposition'],'messages':_(_0x172752['Messages'])[_0x2bc8('0x7f')]({'secret':![]})['map'](function(_0x448a7a){if(_0x448a7a[_0x2bc8('0xcf')]){var _0x55e57d=path['join'](_0x1a982e,_0x448a7a['Attachment']['basename']);if(fs[_0x2bc8('0xda')](_0x55e57d)){fs[_0x2bc8('0xdb')](_0x55e57d)[_0x2bc8('0xdc')](fs[_0x2bc8('0xdd')](path[_0x2bc8('0xc5')](_0x26222f,_0x448a7a[_0x2bc8('0xcf')][_0x2bc8('0xde')])));}}return{'date':moment(_0x448a7a[_0x2bc8('0x74')])[_0x2bc8('0xca')](_0x2bc8('0xba'))[_0x2bc8('0x94')](),'sender':_0x448a7a['direction']===_0x2bc8('0xdf')?_0x448a7a[_0x2bc8('0x6a')]?_0x448a7a['User'][_0x2bc8('0x2a')]:'System':_0x448a7a[_0x2bc8('0x5d')][_0x2bc8('0xcd')]+(_0x448a7a[_0x2bc8('0x5d')][_0x2bc8('0xce')]?'\x20'+_0x448a7a['Contact'][_0x2bc8('0xce')]:''),'body':_0x448a7a[_0x2bc8('0xcf')]?_0x448a7a['Attachment'][_0x2bc8('0xde')]:_0x448a7a[_0x2bc8('0x6e')],'direction':_0x448a7a[_0x2bc8('0xd1')]===_0x2bc8('0xdf')?'A':'C','secret':_0x448a7a[_0x2bc8('0xd2')],'read':_0x448a7a['read'],'attachment':_0x448a7a[_0x2bc8('0xcf')]};})[_0x2bc8('0x59')]()};return ejs[_0x2bc8('0xe0')](path[_0x2bc8('0xc5')](config[_0x2bc8('0xc6')],_0x2bc8('0xc7'),'views',_0x2bc8('0xe1')),{'interaction':_0x1cec94})['then'](function(_0x8abf32){var _0x45972d=path[_0x2bc8('0xc5')](_0x26222f,_0x2bc8('0xe2')+_0x172752['id']+'-'+_0x195720+'.pdf');var _0xa7ca99={'path':_0x45972d,'channel':'Whatsapp','interactionId':_0x172752['id']};return pdf[_0x2bc8('0xe3')](_0x8abf32,_0xa7ca99);})[_0x2bc8('0x25')](function(){return new BPromise(function(_0x256546,_0x5d8c1b){zipdir(_0x26222f,{'saveTo':_0x36f7d4},function(_0x3bc83c,_0x5a026a){if(_0x3bc83c)return _0x5d8c1b(_0x3bc83c);return _0x256546(_0x5a026a);});})[_0x2bc8('0x25')](function(){return new BPromise(function(_0x36834a,_0x457b02){rimraf(_0x26222f,function(_0xcf261a){if(_0xcf261a)_0x457b02(_0xcf261a);return _0x36834a();});});})['then'](function(){return _0x261ede[_0x2bc8('0xc3')](_0x36f7d4,_0x222817,function(_0x1da79a){if(_0x1da79a){console[_0x2bc8('0xe4')](_0x2bc8('0xe5'),_0x1da79a);}else{fs[_0x2bc8('0xe6')](_0x36f7d4);}});});});}else{return _0x261ede[_0x2bc8('0xe7')](0xc8);}})['catch'](handleError(_0x261ede,null));}; \ No newline at end of file +var _0xe50a=['zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./whatsappInteraction.socket','register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','end','error','stack','name','send','Users','map','TagIds','forEach','catch','index','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','users','u.id\x20=\x20ui.UserId','left_join','cm_contacts','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','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','value','having','`\x20>\x200','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','agent','user','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','WhatsappInteraction','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','WhatsappInteractionId','rows','show','rawAttributes','include','options','create','update','params','destroy','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','format','includeAll','findAll','addTags','setTags','spread','whatsappInteractionTags:save','removeTags','download','join','root','server','files','tmp','attachments','push','CmContact','Contact','firstName','lastName','Attachment','Messages','direction','secret','WhatsappAccount','Account','Owner','fullname','get','mkdirSync','Whatsapp','closed','closedAt','disposition','basename','existsSync','createWriteStream','YYYY-MM-DD\x20HH:mm:ss','out','System','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','eml-format','rimraf'];(function(_0x16a92e,_0x50a230){var _0x43fe61=function(_0x579ba2){while(--_0x579ba2){_0x16a92e['push'](_0x16a92e['shift']());}};_0x43fe61(++_0x50a230);}(_0xe50a,0xf0));var _0xae50=function(_0x3f4dd9,_0xe0b819){_0x3f4dd9=_0x3f4dd9-0x0;var _0x31c54a=_0xe50a[_0x3f4dd9];return _0x31c54a;};'use strict';var emlformat=require(_0xae50('0x0'));var rimraf=require(_0xae50('0x1'));var zipdir=require(_0xae50('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xae50('0x3'));var moment=require('moment');var BPromise=require(_0xae50('0x4'));var Mustache=require(_0xae50('0x5'));var util=require('util');var path=require(_0xae50('0x6'));var sox=require(_0xae50('0x7'));var csv=require(_0xae50('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xae50('0x9'));var _=require('lodash');var squel=require(_0xae50('0xa'));var crypto=require('crypto');var jsforce=require(_0xae50('0xb'));var deskjs=require(_0xae50('0xc'));var toCsv=require(_0xae50('0x8'));var querystring=require(_0xae50('0xd'));var Papa=require(_0xae50('0xe'));var Redis=require(_0xae50('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xae50('0x10'));var as=require(_0xae50('0x11'));var pdf=require(_0xae50('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xae50('0x13'));var utils=require(_0xae50('0x14'));var config=require(_0xae50('0x15'));var licenseUtil=require(_0xae50('0x16'));var db=require('../../mysqldb')['db'];config[_0xae50('0x17')]=_[_0xae50('0x18')](config[_0xae50('0x17')],{'host':_0xae50('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xae50('0x17')]));require(_0xae50('0x1a'))[_0xae50('0x1b')](socket);function respondWithStatusCode(_0x1bc426,_0x5dea8c){_0x5dea8c=_0x5dea8c||0xcc;return function(_0x151667){if(_0x151667){return _0x1bc426[_0xae50('0x1c')](_0x5dea8c);}return _0x1bc426[_0xae50('0x1d')](_0x5dea8c)['end']();};}function respondWithResult(_0x407353,_0xf2c5ac){_0xf2c5ac=_0xf2c5ac||0xc8;return function(_0x852470){if(_0x852470){return _0x407353[_0xae50('0x1d')](_0xf2c5ac)[_0xae50('0x1e')](_0x852470);}};}function respondWithFilteredResult(_0x4a16f3,_0x25075b){return function(_0x28ed36){if(_0x28ed36){var _0x1461c8=typeof _0x25075b['offset']===_0xae50('0x1f')&&typeof _0x25075b[_0xae50('0x20')]===_0xae50('0x1f');var _0x3fc14d=_0x28ed36[_0xae50('0x21')];var _0x168836=_0x1461c8?0x0:_0x25075b[_0xae50('0x22')];var _0x7eee5f=_0x1461c8?_0x28ed36[_0xae50('0x21')]:_0x25075b[_0xae50('0x22')]+_0x25075b[_0xae50('0x20')];var _0x36cc67;if(_0x7eee5f>=_0x3fc14d){_0x7eee5f=_0x3fc14d;_0x36cc67=0xc8;}else{_0x36cc67=0xce;}_0x4a16f3[_0xae50('0x1d')](_0x36cc67);return _0x4a16f3[_0xae50('0x23')](_0xae50('0x24'),_0x168836+'-'+_0x7eee5f+'/'+_0x3fc14d)[_0xae50('0x1e')](_0x28ed36);}return null;};}function patchUpdates(_0x24956f){return function(_0x4fd374){try{jsonpatch[_0xae50('0x25')](_0x4fd374,_0x24956f,!![]);}catch(_0x24970b){return BPromise[_0xae50('0x26')](_0x24970b);}return _0x4fd374[_0xae50('0x27')]();};}function saveUpdates(_0xda013,_0x46a4a3){return function(_0x4ed38f){if(_0x4ed38f){return _0x4ed38f['update'](_0xda013)[_0xae50('0x28')](function(_0x41033c){return _0x41033c;});}return null;};}function removeEntity(_0x55e676,_0x24198c){return function(_0x592d7f){if(_0x592d7f){return _0x592d7f['destroy']()['then'](function(){_0x55e676['status'](0xcc)[_0xae50('0x29')]();});}};}function handleEntityNotFound(_0x246c6e,_0x2864e6){return function(_0x140344){if(!_0x140344){_0x246c6e['sendStatus'](0x194);}return _0x140344;};}function handleError(_0x2d794c,_0x34b600){_0x34b600=_0x34b600||0x1f4;return function(_0x5b0ffd){logger[_0xae50('0x2a')](_0x5b0ffd[_0xae50('0x2b')]);if(_0x5b0ffd[_0xae50('0x2c')]){delete _0x5b0ffd[_0xae50('0x2c')];}_0x2d794c[_0xae50('0x1d')](_0x34b600)[_0xae50('0x2d')](_0x5b0ffd);};}function getInteractionUsers(_0x17093a,_0xd3f21a){return new BPromise(function(_0x13b8e1,_0x53186a){try{if(_0xd3f21a[_0x17093a['id']]){_0x17093a[_0xae50('0x2e')]=_[_0xae50('0x2f')](_0xd3f21a[_0x17093a['id']],function(_0x4dcbb4){return{'id':_0x4dcbb4['id'],'fullname':_0x4dcbb4['fullname']};});}}catch(_0x247d03){_0x53186a(_0x247d03);}_0x13b8e1(_0x17093a);});}function getInteractionTags(_0x3af57d,_0x5609b5){return new BPromise(function(_0x21c159,_0x48ecc5){try{if(_0x3af57d[_0xae50('0x30')]){_0x3af57d['Tags']=[];_0x3af57d[_0xae50('0x30')]['split'](',')[_0xae50('0x31')](function(_0x4a7592){_0x3af57d['Tags']['push'](_0x5609b5[_0x4a7592]);});}delete _0x3af57d[_0xae50('0x30')];}catch(_0x5d845d){_0x48ecc5(_0x5d845d);}_0x21c159(_0x3af57d);});}function updateWhatsappInteraction(_0x4e8d27,_0x1cc441,_0x44e03e){return new BPromise(function(_0x21c530,_0x511146){return getInteractionUsers(_0x4e8d27,_0x44e03e)[_0xae50('0x28')](function(_0x2c4ea8){return getInteractionTags(_0x2c4ea8,_0x1cc441);})[_0xae50('0x28')](function(_0x2f6a97){_0x21c530(_0x2f6a97);})[_0xae50('0x32')](function(_0x1c25bb){_0x511146(_0x1c25bb);});});}exports[_0xae50('0x33')]=function(_0x4306cf,_0x4a3f9f){var _0x16f21b={},_0x52eb51={},_0x744026={'count':0x0,'rows':[]};var _0x2d6f46=_['map'](db['WhatsappInteraction']['rawAttributes'],function(_0x29b7bd){return{'name':_0x29b7bd[_0xae50('0x34')],'type':_0x29b7bd[_0xae50('0x35')][_0xae50('0x36')]};});_0x52eb51['model']=_[_0xae50('0x2f')](_0x2d6f46,_0xae50('0x2c'));_0x52eb51[_0xae50('0x37')]=_[_0xae50('0x38')](_0x4306cf['query']);_0x52eb51[_0xae50('0x39')]=_[_0xae50('0x3a')](_0x52eb51['model'],_0x52eb51['query']);_0x16f21b['attributes']=_[_0xae50('0x3a')](_0x52eb51[_0xae50('0x3b')],qs[_0xae50('0x3c')](_0x4306cf['query'][_0xae50('0x3c')]));_0x16f21b[_0xae50('0x3d')]=_0x16f21b[_0xae50('0x3d')][_0xae50('0x3e')]?_0x16f21b[_0xae50('0x3d')]:_0x52eb51[_0xae50('0x3b')];if(!_0x4306cf[_0xae50('0x37')][_0xae50('0x3f')](_0xae50('0x40'))){_0x16f21b['limit']=qs['limit'](_0x4306cf[_0xae50('0x37')]['limit']);_0x16f21b['offset']=qs['offset'](_0x4306cf['query'][_0xae50('0x22')]);}_0x16f21b[_0xae50('0x41')]=qs['sort'](_0x4306cf['query']['sort']);_0x16f21b[_0xae50('0x42')]=qs[_0xae50('0x39')](_[_0xae50('0x43')](_0x4306cf[_0xae50('0x37')],_0x52eb51[_0xae50('0x39')]),_0x2d6f46);var _0x4e404f=[];var _0x9bc7b8=squel[_0xae50('0x44')]()[_0xae50('0x45')]('id')['field'](_0xae50('0x2c'))['field'](_0xae50('0x46'))[_0xae50('0x47')](_0xae50('0x48'));var _0x3de3c1=squel[_0xae50('0x44')]()['field'](_0xae50('0x49'))[_0xae50('0x45')](_0xae50('0x4a'))[_0xae50('0x45')](_0xae50('0x4b'))[_0xae50('0x47')]('user_has_whatsapp_interactions','ui')['left_join'](_0xae50('0x4c'),'u',_0xae50('0x4d'));var _0x58a94b=squel['select']()[_0xae50('0x47')]('whatsapp_interactions','i')[_0xae50('0x4e')](_0xae50('0x4f'),'c',_0xae50('0x50'))[_0xae50('0x4e')]('users','o',_0xae50('0x51'))[_0xae50('0x4e')](_0xae50('0x52'),'a',_0xae50('0x53'))['left_join'](_0xae50('0x54'),'me',_0xae50('0x55'))[_0xae50('0x4e')](_0xae50('0x56'),'it',_0xae50('0x57'))[_0xae50('0x4e')](_0xae50('0x48'),'t','t.id\x20=\x20it.TagId');var _0x2a289c=squel[_0xae50('0x58')]();var _0x4d26f3=[];var _0xe94fe4=squel[_0xae50('0x58')]();var _0x3dea71;if(_0x4306cf[_0xae50('0x37')][_0xae50('0x59')]){_0x3dea71=as[_0xae50('0x5a')](_0x4306cf[_0xae50('0x37')]['search']);var _0x497096=_0x3dea71[_0xae50('0x5b')];for(var _0x4c6232=0x0;_0x4c6232<_0x3dea71[_0xae50('0x5c')][_0xae50('0x3e')];_0x4c6232++){var _0x40cd13=_0x3dea71[_0xae50('0x5c')][_0x4c6232];var _0x346bcf='i';var _0x35c181=_['find'](_0x2d6f46,[_0xae50('0x2c'),_0x40cd13[_0xae50('0x45')]]);if(!_0x35c181){switch(_0x40cd13[_0xae50('0x45')]){case _0xae50('0x5d'):if(_0x40cd13[_0xae50('0x5e')]==0x1){_0x58a94b[_0xae50('0x5f')]('`'+_0x40cd13[_0xae50('0x45')]+'`\x20=\x200');}else{_0x58a94b[_0xae50('0x5f')]('`'+_0x40cd13[_0xae50('0x45')]+_0xae50('0x60'));}break;case'Contact':if(_0x40cd13[_0xae50('0x61')]===_0xae50('0x62')){if(_0x40cd13[_0xae50('0x5e')][_0xae50('0x63')]('\x20')[_0xae50('0x3e')]>0x1){_0x2a289c[_0x497096](_0xae50('0x64'),qs[_0xae50('0x65')](_0x40cd13[_0xae50('0x5e')]),null);}else{var _0x1f7855='%'+_0x40cd13[_0xae50('0x5e')]+'%';_0x2a289c[_0x497096](_0xae50('0x66'),_0x1f7855,_0x1f7855,_0x1f7855);}}else{_0x35c181=_[_0xae50('0x67')](_0x2d6f46,[_0xae50('0x2c'),_0xae50('0x68')]);_0x40cd13[_0xae50('0x45')]='ContactId';_0x40fc25=as[_0xae50('0x69')](_0x346bcf,_0x35c181[_0xae50('0x35')],_0x40cd13);_0x2a289c[_0x497096](_0x40fc25[_0xae50('0x6a')],_0x40fc25['value'][_0xae50('0x6b')],_0x40fc25[_0xae50('0x5e')]['end']);}break;case _0xae50('0x6c'):var _0x3104ef=_0x40cd13[_0xae50('0x5e')][_0xae50('0x63')](',')['map'](function(_0x1c09de){return Number(_0x1c09de);});_0x3104ef[_0xae50('0x31')](function(_0xcc1077){_0xe94fe4['or'](_0xae50('0x6d'),'%,'+_0xcc1077+',%');});_0x4d26f3=_[_0xae50('0x6e')](_0x4d26f3,_0x3104ef);break;case _0xae50('0x6f'):if(_0x40cd13['operator']===_0xae50('0x62')){_0x2a289c[_0x497096](_0xae50('0x70'),'%'+_0x40cd13[_0xae50('0x5e')]+'%',null);}else{_0x35c181=_[_0xae50('0x67')](_0x2d6f46,[_0xae50('0x2c'),_0xae50('0x71')]);_0x40cd13['field']=_0xae50('0x71');_0x40fc25=as[_0xae50('0x69')](_0x346bcf,_0x35c181[_0xae50('0x35')],_0x40cd13);_0x2a289c[_0x497096](_0x40fc25['text'],_0x40fc25[_0xae50('0x5e')][_0xae50('0x6b')],_0x40fc25[_0xae50('0x5e')][_0xae50('0x29')]);}break;case _0xae50('0x72'):_0x40fc25=as[_0xae50('0x69')]('me',null,_0x40cd13);_0x2a289c[_0x497096](_0x40fc25[_0xae50('0x6a')],_0x40fc25[_0xae50('0x5e')]['start'],_0x40fc25[_0xae50('0x5e')]['end']);break;}}else{var _0x40fc25=as['buildExpression'](_0x346bcf,_0x35c181[_0xae50('0x35')],_0x40cd13);_0x2a289c[_0x497096](_0x40fc25[_0xae50('0x6a')],_0x40fc25[_0xae50('0x5e')]['start'],_0x40fc25[_0xae50('0x5e')][_0xae50('0x29')]);}}}else{var _0x4be003=_(_0x4306cf[_0xae50('0x37')])['keys']()['map'](function(_0x3d0126){return _[_0xae50('0x73')](_0x2d6f46,[_0xae50('0x2c'),_0x3d0126])?_0x3d0126:undefined;})[_0xae50('0x74')]()['value']();if(!_['isEmpty'](_0x4be003)){_0x4be003[_0xae50('0x31')](function(_0xe30929){if(_0xe30929===_0xae50('0x75')){_0x58a94b[_0xae50('0x42')](_0xae50('0x76'),[][_0xae50('0x77')](_0x4306cf[_0xae50('0x37')][_0xe30929]));}else if(_0xe30929===_0xae50('0x78')){var _0x21c812=JSON[_0xae50('0x79')](_0x4306cf[_0xae50('0x37')][_0xe30929])[_0xae50('0x7a')];var _0x5d0889=JSON['parse'](_0x4306cf[_0xae50('0x37')][_0xe30929])[_0xae50('0x7b')];_0x58a94b[_0xae50('0x42')](_0xae50('0x7c'),_0x21c812,_0x5d0889);}else{if(_0x4306cf[_0xae50('0x37')][_0xe30929]===_0xae50('0x7d')){_0x58a94b[_0xae50('0x42')]('i.'+_0xe30929+_0xae50('0x7e'));}else{_0x58a94b[_0xae50('0x42')]('i.'+_0xe30929+_0xae50('0x7f'),_0x4306cf[_0xae50('0x37')][_0xe30929]);}}});}if(_0x4306cf[_0xae50('0x37')][_0xae50('0x80')]){if(_0x4306cf[_0xae50('0x37')][_0xae50('0x80')]==0x1){_0x58a94b['having'](_0xae50('0x81'));}else{_0x58a94b[_0xae50('0x5f')](_0xae50('0x82'));}}if(_0x4306cf[_0xae50('0x37')][_0xae50('0x83')]){_0x4d26f3=_[_0xae50('0x84')](_0x4306cf['query'][_0xae50('0x83')])?_0x4306cf[_0xae50('0x37')]['tag']:new Array(_0x4306cf['query']['tag']);_0x4d26f3[_0xae50('0x31')](function(_0x47f1a1){_0xe94fe4['or'](_0xae50('0x6d'),'%,'+_0x47f1a1+',%');});}if(_0x4306cf[_0xae50('0x37')]['filter']){var _0x675b83=_0x4306cf[_0xae50('0x37')][_0xae50('0x85')][_0xae50('0x86')]('\x5c','\x5c\x5c')[_0xae50('0x86')](/'/g,'\x27\x27');if(qs[_0xae50('0x87')](_0x675b83)){_0x2a289c['or'](_0xae50('0x88'),_0x675b83+'%')['or'](_0xae50('0x89'),_0x675b83+'%');}else{_0x2a289c['or'](_0xae50('0x8a'),qs['getFullTextValue'](_0x675b83))['or'](_0xae50('0x8b'),_0x675b83+'%');}}}_0x58a94b[_0xae50('0x42')](_0x2a289c);_0x58a94b[_0xae50('0x8c')](_0xae50('0x8d'));var _0x357d48={'type':db['Sequelize'][_0xae50('0x8e')][_0xae50('0x8f')],'raw':!![]};var _0x2e116d=_0x58a94b['clone']();_0x2e116d[_0xae50('0x45')](_0xae50('0x8d'));_0x2e116d['field'](_0xae50('0x90'),_0xae50('0x5d'));if(_0x16f21b['order']){_0x16f21b[_0xae50('0x41')]['forEach'](function(_0x1602e6){var _0x1ded1a=_0x1602e6[0x0]===_0xae50('0x91')?_0x1602e6[0x0]:'i.'+_0x1602e6[0x0];_0x58a94b[_0xae50('0x41')](_0x1ded1a,_0x1602e6[0x1]===_0xae50('0x92')?![]:!![]);});}if(!_[_0xae50('0x93')](_0x4d26f3)){_0x58a94b[_0xae50('0x5f')](_0xe94fe4);_0x2e116d[_0xae50('0x42')](_0xae50('0x94'),_0x4d26f3);}BPromise[_0xae50('0x95')]()['then'](function(){if(!_0x3dea71){if(_0x4306cf[_0xae50('0x37')][_0xae50('0x75')])return;_0x2e116d[_0xae50('0x42')](_0xae50('0x96'));_0x58a94b[_0xae50('0x42')](_0xae50('0x96'));return;}if(_0x4306cf['user']['role']!==_0xae50('0x97'))return;return _0x4306cf[_0xae50('0x98')]['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x11dd6f){if(_['isEmpty'](_0x11dd6f)){_0x2e116d[_0xae50('0x42')](_0xae50('0x99'));_0x58a94b[_0xae50('0x42')](_0xae50('0x99'));}else{_0x2e116d['where'](_0xae50('0x76'),_[_0xae50('0x2f')](_0x11dd6f,'id'));_0x58a94b[_0xae50('0x42')]('i.WhatsappAccountId\x20IN\x20?',_[_0xae50('0x2f')](_0x11dd6f,'id'));}});})[_0xae50('0x28')](function(){if(_0x4306cf[_0xae50('0x98')]['role']===_0xae50('0x97')&&!_0x3dea71&&!_0x4306cf['query'][_0xae50('0x75')])return[];return db[_0xae50('0x9a')][_0xae50('0x37')](_0x2e116d[_0xae50('0x9b')](),_0x357d48);})[_0xae50('0x28')](function(_0x237e46){_0x744026[_0xae50('0x21')]=_0x237e46['length'];if(_0x744026[_0xae50('0x21')]===0x0)return[];return db[_0xae50('0x9a')][_0xae50('0x37')](_0x9bc7b8[_0xae50('0x9b')](),_0x357d48)[_0xae50('0x28')](function(_0x3ad488){_0x4e404f=_[_0xae50('0x9c')](_0x3ad488,'id');_0x357d48=_[_0xae50('0x9d')](_0x357d48,{'model':db[_0xae50('0x9e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4306cf[_0xae50('0x37')][_0xae50('0x3c')]){_0x16f21b[_0xae50('0x3d')][_0xae50('0x31')](function(_0x137ec6){_0x58a94b['field']('i.'+_0x137ec6);});}else{_0x58a94b[_0xae50('0x45')](_0xae50('0x90'),_0xae50('0x5d'));_0x58a94b[_0xae50('0x45')]('a.key',_0xae50('0x9f'));_0x58a94b[_0xae50('0x45')](_0xae50('0xa0'),_0xae50('0xa1'));_0x58a94b[_0xae50('0x45')](_0xae50('0xa2'),_0xae50('0x91'));_0x58a94b['field'](_0xae50('0xa3'));_0x58a94b['field'](_0xae50('0xa4'),_0xae50('0xa5'));_0x58a94b['field']('c.lastName',_0xae50('0xa6'));_0x58a94b[_0xae50('0x45')](_0xae50('0xa7'),_0xae50('0xa8'));_0x58a94b[_0xae50('0x45')](_0xae50('0xa9'),'Contact.phone');_0x58a94b[_0xae50('0x45')](_0xae50('0xaa'),'Contact.mobile');_0x58a94b['field']('c.fax','Contact.fax');_0x58a94b['field'](_0xae50('0xab'),_0xae50('0xac'));_0x58a94b[_0xae50('0x45')](_0xae50('0xad'),_0xae50('0xae'));_0x58a94b[_0xae50('0x45')](_0xae50('0xaf'),_0xae50('0x30'));}if(_0x16f21b[_0xae50('0x20')])_0x58a94b[_0xae50('0x20')](_0x16f21b['limit']);if(_0x16f21b[_0xae50('0x22')])_0x58a94b[_0xae50('0x22')](_0x16f21b[_0xae50('0x22')]);return db[_0xae50('0x9a')][_0xae50('0x37')](_0x58a94b[_0xae50('0x9b')](),_0x357d48);})[_0xae50('0x28')](function(_0x412306){if(_0x412306[_0xae50('0x3e')]>0x0)_0x3de3c1[_0xae50('0x42')]('ui.WhatsappInteractionId\x20IN\x20?',_[_0xae50('0x2f')](_0x412306,'id'));return db[_0xae50('0x9a')][_0xae50('0x37')](_0x3de3c1[_0xae50('0x9b')](),_0x357d48)[_0xae50('0x28')](function(_0x2b07f4){var _0x2346a8=_[_0xae50('0xb0')](_0x2b07f4,_0xae50('0xb1'));var _0x62ec6=[];_0x412306['forEach'](function(_0x1fdd4f){_0x62ec6['push'](updateWhatsappInteraction(_0x1fdd4f,_0x4e404f,_0x2346a8));});return BPromise['all'](_0x62ec6);});});})[_0xae50('0x28')](function(_0x55cf45){_0x744026[_0xae50('0xb2')]=_0x55cf45;return _0x744026;})[_0xae50('0x28')](respondWithFilteredResult(_0x4a3f9f,_0x16f21b))[_0xae50('0x32')](handleError(_0x4a3f9f,null));};exports[_0xae50('0xb3')]=function(_0x5d8501,_0x19693a){var _0x9ee4f0={'raw':![],'where':{'id':_0x5d8501['params']['id']}},_0x1bedf8={};_0x1bedf8[_0xae50('0x3b')]=_[_0xae50('0x38')](db[_0xae50('0x9e')][_0xae50('0xb4')]);_0x1bedf8[_0xae50('0x37')]=_['keys'](_0x5d8501[_0xae50('0x37')]);_0x1bedf8[_0xae50('0x39')]=_[_0xae50('0x3a')](_0x1bedf8[_0xae50('0x3b')],_0x1bedf8[_0xae50('0x37')]);_0x9ee4f0[_0xae50('0x3d')]=_['intersection'](_0x1bedf8[_0xae50('0x3b')],qs[_0xae50('0x3c')](_0x5d8501[_0xae50('0x37')]['fields']));_0x9ee4f0[_0xae50('0x3d')]=_0x9ee4f0[_0xae50('0x3d')][_0xae50('0x3e')]?_0x9ee4f0['attributes']:_0x1bedf8[_0xae50('0x3b')];if(_0x5d8501[_0xae50('0x37')]['includeAll']){_0x9ee4f0[_0xae50('0xb5')]=[{'all':!![]}];}_0x9ee4f0=_[_0xae50('0x9d')]({},_0x9ee4f0,_0x5d8501[_0xae50('0xb6')]);return db[_0xae50('0x9e')][_0xae50('0x67')](_0x9ee4f0)['then'](handleEntityNotFound(_0x19693a,null))[_0xae50('0x28')](respondWithResult(_0x19693a,null))['catch'](handleError(_0x19693a,null));};exports[_0xae50('0xb7')]=function(_0x9c93ef,_0x18d6b0){return db[_0xae50('0x9e')][_0xae50('0xb7')](_0x9c93ef[_0xae50('0x72')],{})[_0xae50('0x28')](respondWithResult(_0x18d6b0,0xc9))[_0xae50('0x32')](handleError(_0x18d6b0,null));};exports[_0xae50('0xb8')]=function(_0x37e0f4,_0x5c8ad6){if(_0x37e0f4[_0xae50('0x72')]['id']){delete _0x37e0f4[_0xae50('0x72')]['id'];}return db[_0xae50('0x9e')][_0xae50('0x67')]({'where':{'id':_0x37e0f4[_0xae50('0xb9')]['id']}})[_0xae50('0x28')](handleEntityNotFound(_0x5c8ad6,null))[_0xae50('0x28')](saveUpdates(_0x37e0f4[_0xae50('0x72')],null))[_0xae50('0x28')](respondWithResult(_0x5c8ad6,null))[_0xae50('0x32')](handleError(_0x5c8ad6,null));};exports[_0xae50('0xba')]=function(_0x1feb54,_0x459cc1){return db[_0xae50('0x9e')][_0xae50('0x67')]({'where':{'id':_0x1feb54['params']['id']}})[_0xae50('0x28')](handleEntityNotFound(_0x459cc1,null))['then'](removeEntity(_0x459cc1,null))[_0xae50('0x32')](handleError(_0x459cc1,null));};exports['describe']=function(_0xd3bb97,_0x147c97){return db[_0xae50('0x9e')][_0xae50('0xbb')]()[_0xae50('0x28')](respondWithResult(_0x147c97,null))[_0xae50('0x32')](handleError(_0x147c97,null));};exports[_0xae50('0xbc')]=function(_0xf415c9,_0x865347,_0x9fb5f7){return db[_0xae50('0xbd')][_0xae50('0x67')]({'where':{'id':_0xf415c9[_0xae50('0xb9')]['id']}})[_0xae50('0x28')](handleEntityNotFound(_0x865347,null))['then'](function(_0x341562){if(_0x341562){return _0x341562[_0xae50('0xbc')](_0xf415c9[_0xae50('0x72')][_0xae50('0xbe')],_[_0xae50('0xbf')](_0xf415c9[_0xae50('0x72')],[_0xae50('0xbe'),'id'])||{});}})['then'](respondWithResult(_0x865347,null))['catch'](handleError(_0x865347,null));};exports[_0xae50('0xc0')]=function(_0x452d2b,_0x1357c2,_0x15e1da){var _0x41a2c3={'raw':![],'where':{}};var _0x5a0fd9={};var _0x5a27a5={'count':0x0,'rows':[]};return db[_0xae50('0x9e')][_0xae50('0xc1')]({'where':{'id':_0x452d2b[_0xae50('0xb9')]['id']}})[_0xae50('0x28')](handleEntityNotFound(_0x1357c2,null))[_0xae50('0x28')](function(_0x57be0e){if(_0x57be0e){_0x5a0fd9[_0xae50('0x3b')]=_[_0xae50('0x38')](db[_0xae50('0xbd')][_0xae50('0xb4')]);_0x5a0fd9[_0xae50('0x37')]=_[_0xae50('0x38')](_0x452d2b['query']);_0x5a0fd9[_0xae50('0x39')]=_[_0xae50('0x3a')](_0x5a0fd9[_0xae50('0x3b')],_0x5a0fd9['query']);_0x41a2c3[_0xae50('0x3d')]=_[_0xae50('0x3a')](_0x5a0fd9['model'],qs['fields'](_0x452d2b[_0xae50('0x37')][_0xae50('0x3c')]));_0x41a2c3[_0xae50('0x3d')]=_0x41a2c3[_0xae50('0x3d')][_0xae50('0x3e')]?_0x41a2c3['attributes']:_0x5a0fd9[_0xae50('0x3b')];if(!_0x452d2b[_0xae50('0x37')]['hasOwnProperty'](_0xae50('0x40'))){_0x41a2c3[_0xae50('0x20')]=qs[_0xae50('0x20')](_0x452d2b[_0xae50('0x37')][_0xae50('0x20')]);_0x41a2c3[_0xae50('0x22')]=qs[_0xae50('0x22')](_0x452d2b[_0xae50('0x37')]['offset']);}_0x41a2c3[_0xae50('0x41')]=qs['sort'](_0x452d2b['query']['sort']);_0x41a2c3[_0xae50('0x42')]=qs[_0xae50('0x39')](_['pick'](_0x452d2b[_0xae50('0x37')],_0x5a0fd9[_0xae50('0x39')]));_0x41a2c3['where']['WhatsappInteractionId']=_0x57be0e['id'];if(_0x452d2b[_0xae50('0x37')]['filter']){_0x41a2c3[_0xae50('0x42')]=_[_0xae50('0x9d')](_0x41a2c3['where'],{'$or':_['map'](_0x41a2c3[_0xae50('0x3d')],function(_0x268e8a){var _0x851da2={};_0x851da2[_0x268e8a]={'$like':'%'+_0x452d2b[_0xae50('0x37')][_0xae50('0x85')]+'%'};return _0x851da2;})});}if(_0x452d2b[_0xae50('0x37')][_0xae50('0x7a')]){var _0x284f5d=_0x452d2b['query']['$gte'][_0xae50('0x63')](',');var _0x5b4f74={};_0x5b4f74[_0x284f5d[0x0]]={'$gte':moment(_0x284f5d[0x1])[_0xae50('0xc2')]('YYYY-MM-DD\x20HH:mm:ss')};_0x41a2c3['where']=_[_0xae50('0x9d')](_0x41a2c3[_0xae50('0x42')],_0x5b4f74);}_0x41a2c3=_[_0xae50('0x9d')]({},_0x41a2c3,_0x452d2b[_0xae50('0xb6')]);return db[_0xae50('0xbd')][_0xae50('0x21')]({'where':_0x41a2c3['where']})[_0xae50('0x28')](function(_0x9061e){_0x5a27a5['count']=_0x9061e;if(_0x452d2b[_0xae50('0x37')][_0xae50('0xc3')]){_0x41a2c3[_0xae50('0xb5')]=[{'all':!![]}];}return db[_0xae50('0xbd')][_0xae50('0xc4')](_0x41a2c3);})['then'](function(_0x37546a){_0x5a27a5[_0xae50('0xb2')]=_0x37546a;return _0x5a27a5;});}})[_0xae50('0x28')](respondWithFilteredResult(_0x1357c2,_0x41a2c3))[_0xae50('0x32')](handleError(_0x1357c2,null));};exports[_0xae50('0xc5')]=function(_0x6596e7,_0x16d40a,_0x10248d){return db[_0xae50('0x9e')][_0xae50('0x67')]({'where':{'id':_0x6596e7['params']['id']}})['then'](handleEntityNotFound(_0x16d40a,null))['then'](function(_0x101586){if(_0x101586){return _0x101586[_0xae50('0xc6')](_0x6596e7[_0xae50('0x72')]['ids'],_[_0xae50('0xbf')](_0x6596e7[_0xae50('0x72')],['ids','id'])||{})[_0xae50('0xc7')](function(){return db['Tag'][_0xae50('0xc4')]({'attributes':['id',_0xae50('0x2c'),'color'],'where':{'id':_0x6596e7[_0xae50('0x72')][_0xae50('0xbe')]}});})['then'](function(_0x15b073){socket['emit'](_0xae50('0xc8'),{'id':Number(_0x6596e7[_0xae50('0xb9')]['id']),'tags':_0x15b073||[]});return{'id':Number(_0x6596e7[_0xae50('0xb9')]['id']),'tags':_0x15b073||[]};});}})[_0xae50('0x28')](respondWithResult(_0x16d40a,null))[_0xae50('0x32')](handleError(_0x16d40a,null));};exports[_0xae50('0xc9')]=function(_0x348f7d,_0x2326eb,_0x2a22ac){return db[_0xae50('0x9e')][_0xae50('0x67')]({'where':{'id':_0x348f7d[_0xae50('0xb9')]['id']}})[_0xae50('0x28')](handleEntityNotFound(_0x2326eb,null))[_0xae50('0x28')](function(_0x910447){if(_0x910447){return _0x910447[_0xae50('0xc9')](_0x348f7d[_0xae50('0x37')][_0xae50('0xbe')]);}})[_0xae50('0x28')](respondWithStatusCode(_0x2326eb,null))[_0xae50('0x32')](handleError(_0x2326eb,null));};exports[_0xae50('0xca')]=function(_0x2ae21e,_0x17539c){var _0x5d6178=moment()['unix']()[_0xae50('0x9b')]();var _0xf3b957=path[_0xae50('0xcb')](config[_0xae50('0xcc')],_0xae50('0xcd'),_0xae50('0xce'),_0xae50('0xcf'));var _0x1fa593=path[_0xae50('0xcb')](config[_0xae50('0xcc')],_0xae50('0xcd'),_0xae50('0xce'),_0xae50('0xd0'));var _0x130df8=path['join'](_0xf3b957,_0x5d6178);var _0x2f1e14=util['format']('transcript-%d-%s.zip',_0x2ae21e['params']['id'],_0x5d6178);var _0x40eae7=path[_0xae50('0xcb')](_0xf3b957,_0x2f1e14);var _0xaa2ca0=[];_0xaa2ca0['push']({'model':db[_0xae50('0x6f')],'as':_0xae50('0x6f'),'attributes':['id','fullname'],'raw':!![]});_0xaa2ca0[_0xae50('0xd1')]({'model':db[_0xae50('0xd2')],'as':_0xae50('0xd3'),'attributes':['id',_0xae50('0xd4'),_0xae50('0xd5')],'raw':!![]});if(_0x2ae21e[_0xae50('0x37')][_0xae50('0xd0')]){_0xaa2ca0[_0xae50('0xd1')]({'model':db[_0xae50('0xd6')],'as':_0xae50('0xd6'),'raw':!![]});}var _0x2a6638=[{'model':db[_0xae50('0xbd')],'as':_0xae50('0xd7'),'attributes':['id',_0xae50('0x72'),_0xae50('0x78'),_0xae50('0xd8'),_0xae50('0xd9'),_0xae50('0x80')],'include':_0xaa2ca0}];_0x2a6638[_0xae50('0xd1')]({'model':db[_0xae50('0xda')],'as':_0xae50('0xdb'),'attributes':['id',_0xae50('0x2c')]});_0x2a6638['push']({'model':db['User'],'as':_0xae50('0xdc'),'attributes':['id',_0xae50('0xdd')]});return db[_0xae50('0x9e')]['find']({'where':{'id':_0x2ae21e[_0xae50('0xb9')]['id']},'include':_0x2a6638})[_0xae50('0x28')](handleEntityNotFound(_0x17539c,null))[_0xae50('0x28')](function(_0x5257a7){if(_0x5257a7){var _0x33a223=_0x5257a7[_0xae50('0xde')]({'plain':!![]});fs[_0xae50('0xdf')](_0x130df8);var _0x266b12={'channel':_0xae50('0xe0'),'account':_0x33a223[_0xae50('0xdb')][_0xae50('0x2c')],'agent':_0x33a223['Owner']?_0x33a223[_0xae50('0xdc')][_0xae50('0xdd')]:'N.A.','createdAt':moment(_0x33a223[_0xae50('0x78')])[_0xae50('0xc2')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x33a223[_0xae50('0xe1')]?moment(_0x33a223[_0xae50('0xe2')])[_0xae50('0xc2')]('YYYY-MM-DD\x20HH:mm:ss')[_0xae50('0x9b')]():'','disposition':_0x33a223[_0xae50('0xe3')],'messages':_(_0x33a223[_0xae50('0xd7')])[_0xae50('0x85')]({'secret':![]})[_0xae50('0x2f')](function(_0x1a7994){if(_0x1a7994[_0xae50('0xd6')]){var _0x49eaad=path[_0xae50('0xcb')](_0x1fa593,_0x1a7994[_0xae50('0xd6')][_0xae50('0xe4')]);if(fs[_0xae50('0xe5')](_0x49eaad)){fs['createReadStream'](_0x49eaad)['pipe'](fs[_0xae50('0xe6')](path[_0xae50('0xcb')](_0x130df8,_0x1a7994[_0xae50('0xd6')][_0xae50('0xe4')])));}}return{'date':moment(_0x1a7994[_0xae50('0x78')])[_0xae50('0xc2')](_0xae50('0xe7'))[_0xae50('0x9b')](),'sender':_0x1a7994['direction']===_0xae50('0xe8')?_0x1a7994[_0xae50('0x6f')]?_0x1a7994[_0xae50('0x6f')][_0xae50('0xdd')]:_0xae50('0xe9'):_0x1a7994[_0xae50('0xd3')][_0xae50('0xd4')]+(_0x1a7994[_0xae50('0xd3')][_0xae50('0xd5')]?'\x20'+_0x1a7994[_0xae50('0xd3')]['lastName']:''),'body':_0x1a7994[_0xae50('0xd6')]?_0x1a7994[_0xae50('0xd6')][_0xae50('0xe4')]:_0x1a7994[_0xae50('0x72')],'direction':_0x1a7994[_0xae50('0xd8')]===_0xae50('0xe8')?'A':'C','secret':_0x1a7994[_0xae50('0xd9')],'read':_0x1a7994[_0xae50('0x80')],'attachment':_0x1a7994[_0xae50('0xd6')]};})[_0xae50('0x5e')]()};return ejs[_0xae50('0xea')](path[_0xae50('0xcb')](config[_0xae50('0xcc')],_0xae50('0xcd'),_0xae50('0xeb'),_0xae50('0xec')),{'interaction':_0x266b12})['then'](function(_0xf85d8e){var _0x1347a7=path['join'](_0x130df8,_0xae50('0xed')+_0x33a223['id']+'-'+_0x5d6178+_0xae50('0xee'));var _0x1121cd={'path':_0x1347a7,'channel':_0xae50('0xe0'),'interactionId':_0x33a223['id']};return pdf[_0xae50('0xef')](_0xf85d8e,_0x1121cd);})[_0xae50('0x28')](function(){return new BPromise(function(_0x1c3523,_0x3f82c5){zipdir(_0x130df8,{'saveTo':_0x40eae7},function(_0x3f27a4,_0x1f50e2){if(_0x3f27a4)return _0x3f82c5(_0x3f27a4);return _0x1c3523(_0x1f50e2);});})[_0xae50('0x28')](function(){return new BPromise(function(_0x24a87b,_0x429327){rimraf(_0x130df8,function(_0x53d567){if(_0x53d567)_0x429327(_0x53d567);return _0x24a87b();});});})[_0xae50('0x28')](function(){return _0x17539c[_0xae50('0xca')](_0x40eae7,_0x2f1e14,function(_0xb2ff28){if(_0xb2ff28){console['log'](_0xae50('0xf0'),_0xb2ff28);}else{fs[_0xae50('0xf1')](_0x40eae7);}});});});}else{return _0x17539c[_0xae50('0x1c')](0xc8);}})['catch'](handleError(_0x17539c,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 99903fe..d5f14d6 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 _0x1306=['WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hook','events','../../mysqldb'];(function(_0x11b839,_0xe96968){var _0x323996=function(_0x8caf8a){while(--_0x8caf8a){_0x11b839['push'](_0x11b839['shift']());}};_0x323996(++_0xe96968);}(_0x1306,0x17a));var _0x6130=function(_0x2aa790,_0x26e934){_0x2aa790=_0x2aa790-0x0;var _0x527af5=_0x1306[_0x2aa790];return _0x527af5;};'use strict';var EventEmitter=require(_0x6130('0x0'));var WhatsappInteraction=require(_0x6130('0x1'))['db'][_0x6130('0x2')];var WhatsappMessage=require(_0x6130('0x1'))['db'][_0x6130('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x6130('0x4')](0x0);var events={'afterCreate':_0x6130('0x5'),'afterUpdate':_0x6130('0x6'),'afterDestroy':_0x6130('0x7')};function emitEvent(_0x33f042){return function(_0x447c7f,_0x181070,_0x213e6a){_0x447c7f[_0x6130('0x8')]({'attributes':['id'],'raw':!![]})[_0x6130('0x9')](function(_0x25469a){_0x447c7f[_0x6130('0xa')](_0x6130('0xb'),_0x25469a[_0x6130('0xc')](function(_0x2854a1){return{'id':_0x2854a1['id']};}));return WhatsappMessage[_0x6130('0xd')]({'where':{'WhatsappInteractionId':_0x447c7f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6130('0x9')](function(_0xb9c7e6){_0x447c7f[_0x6130('0xa')](_0x6130('0xe'),_0xb9c7e6[_0x6130('0xf')]);WhatsappInteractionEvents[_0x6130('0x10')](_0x33f042+':'+_0x447c7f['id'],_0x447c7f);WhatsappInteractionEvents[_0x6130('0x10')](_0x33f042,_0x447c7f);_0x213e6a(null);})[_0x6130('0x11')](_0x213e6a(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x6130('0x12')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0x6427=['setDataValue','Users','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','remove','getUsers','then'];(function(_0x173827,_0x2e09e4){var _0x144b18=function(_0x576fb4){while(--_0x576fb4){_0x173827['push'](_0x173827['shift']());}};_0x144b18(++_0x2e09e4);}(_0x6427,0xbe));var _0x7642=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x6427[_0x5f09c5];return _0x426ad9;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x7642('0x0'))['db'][_0x7642('0x1')];var WhatsappMessage=require(_0x7642('0x0'))['db'][_0x7642('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x7642('0x3')](0x0);var events={'afterCreate':_0x7642('0x4'),'afterUpdate':'update','afterDestroy':_0x7642('0x5')};function emitEvent(_0x33af1f){return function(_0x2e50e2,_0x279f07,_0x2e2fa7){_0x2e50e2[_0x7642('0x6')]({'attributes':['id'],'raw':!![]})[_0x7642('0x7')](function(_0x266b9b){_0x2e50e2[_0x7642('0x8')](_0x7642('0x9'),_0x266b9b['map'](function(_0x498c0d){return{'id':_0x498c0d['id']};}));return WhatsappMessage[_0x7642('0xa')]({'where':{'WhatsappInteractionId':_0x2e50e2['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7642('0x7')](function(_0x1ef8d3){_0x2e50e2[_0x7642('0x8')](_0x7642('0xb'),_0x1ef8d3[_0x7642('0xc')]);WhatsappInteractionEvents[_0x7642('0xd')](_0x33af1f+':'+_0x2e50e2['id'],_0x2e50e2);WhatsappInteractionEvents[_0x7642('0xd')](_0x33af1f,_0x2e50e2);_0x2e2fa7(null);})[_0x7642('0xe')](_0x2e2fa7(null));};}for(var e in events){if(events[_0x7642('0xf')](e)){var event=events[e];WhatsappInteraction[_0x7642('0x10')](e,emitEvent(event));}}module[_0x7642('0x11')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index efb9c40..1ea1afc 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 _0xb7ad=['moment','request-promise','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api'];(function(_0x3fff9e,_0xd58c1a){var _0xb9c14b=function(_0x8199ed){while(--_0x8199ed){_0x3fff9e['push'](_0x3fff9e['shift']());}};_0xb9c14b(++_0xd58c1a);}(_0xb7ad,0x1be));var _0xdb7a=function(_0x2c7368,_0x4e761b){_0x2c7368=_0x2c7368-0x0;var _0x3c7e26=_0xb7ad[_0x2c7368];return _0x3c7e26;};'use strict';var _=require(_0xdb7a('0x0'));var util=require(_0xdb7a('0x1'));var logger=require(_0xdb7a('0x2'))(_0xdb7a('0x3'));var moment=require(_0xdb7a('0x4'));var BPromise=require('bluebird');var rp=require(_0xdb7a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdb7a('0x6'));var config=require(_0xdb7a('0x7'));var attributes=require(_0xdb7a('0x8'));module[_0xdb7a('0x9')]=function(_0xd01c35,_0xd53809){return _0xd01c35[_0xdb7a('0xa')](_0xdb7a('0xb'),attributes,{'tableName':_0xdb7a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xd32824,_0x30e590,_0x25d207){if(_0xd32824[_0xdb7a('0xd')](_0xdb7a('0xe'))){_0xd32824[_0xdb7a('0xf')]=moment()[_0xdb7a('0x10')](_0xdb7a('0x11'));}_0x25d207(null,_0xd32824);}}});}; \ No newline at end of file +var _0x707d=['changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','whatsapp_interactions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x707d,0x18b));var _0xd707=function(_0x1b3dd8,_0x5a6232){_0x1b3dd8=_0x1b3dd8-0x0;var _0x5bfc50=_0x707d[_0x1b3dd8];return _0x5bfc50;};'use strict';var _=require(_0xd707('0x0'));var util=require(_0xd707('0x1'));var logger=require(_0xd707('0x2'))(_0xd707('0x3'));var moment=require(_0xd707('0x4'));var BPromise=require(_0xd707('0x5'));var rp=require(_0xd707('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd707('0x7'));var config=require(_0xd707('0x8'));var attributes=require(_0xd707('0x9'));module[_0xd707('0xa')]=function(_0x4d817d,_0x1327cb){return _0x4d817d[_0xd707('0xb')]('WhatsappInteraction',attributes,{'tableName':_0xd707('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xf596b4,_0x11edc8,_0x5d95fa){if(_0xf596b4[_0xd707('0xd')](_0xd707('0xe'))){_0xf596b4['closedAt']=moment()[_0xd707('0xf')](_0xd707('0x10'));}_0x5d95fa(null,_0xf596b4);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index e54e938..d38d1dc 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 _0xd3a3=['debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','WhatsappInteraction','body','options','raw','where','limit','UpdateWhatsappInteraction','catch','AddTagsToWhatsappInteraction','find','omit','ids','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','then','info'];(function(_0x3eb348,_0x182abd){var _0x5f6784=function(_0x1b068d){while(--_0x1b068d){_0x3eb348['push'](_0x3eb348['shift']());}};_0x5f6784(++_0x182abd);}(_0xd3a3,0x1d9));var _0x3d3a=function(_0x4f9d1f,_0x2619c4){_0x4f9d1f=_0x4f9d1f-0x0;var _0x3a9da5=_0xd3a3[_0x4f9d1f];return _0x3a9da5;};'use strict';var _=require(_0x3d3a('0x0'));var util=require(_0x3d3a('0x1'));var moment=require('moment');var BPromise=require(_0x3d3a('0x2'));var rs=require(_0x3d3a('0x3'));var fs=require('fs');var Redis=require(_0x3d3a('0x4'));var db=require(_0x3d3a('0x5'))['db'];var utils=require(_0x3d3a('0x6'));var logger=require(_0x3d3a('0x7'))(_0x3d3a('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3d3a('0x9')][_0x3d3a('0xa')]({'port':0x232a});config['redis']=_[_0x3d3a('0xb')](config[_0x3d3a('0xc')],{'host':_0x3d3a('0xd'),'port':0x18eb});var socket=require(_0x3d3a('0xe'))(new Redis(config['redis']));require(_0x3d3a('0xf'))[_0x3d3a('0x10')](socket);function respondWithRpcPromise(_0x1149c0,_0x4da90e,_0x484f49){return new BPromise(function(_0x469627,_0x1c092a){return client['request'](_0x1149c0,_0x484f49)[_0x3d3a('0x11')](function(_0x2d6e2f){logger[_0x3d3a('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x4da90e,'request\x20sent');logger[_0x3d3a('0x13')](_0x3d3a('0x14'),_0x4da90e,_0x3d3a('0x15'),JSON[_0x3d3a('0x16')](_0x2d6e2f));if(_0x2d6e2f[_0x3d3a('0x17')]){if(_0x2d6e2f[_0x3d3a('0x17')][_0x3d3a('0x18')]===0x1f4){logger[_0x3d3a('0x17')](_0x3d3a('0x19'),_0x4da90e,_0x2d6e2f['error'][_0x3d3a('0x1a')]);return _0x1c092a(_0x2d6e2f['error'][_0x3d3a('0x1a')]);}logger[_0x3d3a('0x17')](_0x3d3a('0x19'),_0x4da90e,_0x2d6e2f[_0x3d3a('0x17')][_0x3d3a('0x1a')]);return _0x469627(_0x2d6e2f[_0x3d3a('0x17')][_0x3d3a('0x1a')]);}else{logger[_0x3d3a('0x12')](_0x3d3a('0x19'),_0x4da90e,_0x3d3a('0x15'));_0x469627(_0x2d6e2f['result']['message']);}})['catch'](function(_0x17bb20){logger['error'](_0x3d3a('0x19'),_0x4da90e,_0x17bb20);_0x1c092a(_0x17bb20);});});}exports['UpdateWhatsappInteraction']=function(_0x5badeb){var _0x5ed994=this;return new Promise(function(_0x3d12ff,_0x3785ba){return db[_0x3d3a('0x1b')]['update'](_0x5badeb[_0x3d3a('0x1c')],{'raw':_0x5badeb[_0x3d3a('0x1d')]?_0x5badeb[_0x3d3a('0x1d')][_0x3d3a('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5badeb[_0x3d3a('0x1d')]?_0x5badeb[_0x3d3a('0x1d')][_0x3d3a('0x1f')]||null:null,'attributes':_0x5badeb[_0x3d3a('0x1d')]?_0x5badeb[_0x3d3a('0x1d')]['attributes']||null:null,'limit':_0x5badeb[_0x3d3a('0x1d')]?_0x5badeb['options'][_0x3d3a('0x20')]||null:null})[_0x3d3a('0x11')](function(_0x38ff8f){logger[_0x3d3a('0x12')](_0x3d3a('0x21'),_0x5badeb);logger[_0x3d3a('0x13')]('UpdateWhatsappInteraction',_0x5badeb,JSON['stringify'](_0x38ff8f));_0x3d12ff(_0x38ff8f);})[_0x3d3a('0x22')](function(_0x2d01c7){logger[_0x3d3a('0x17')]('UpdateWhatsappInteraction',_0x2d01c7[_0x3d3a('0x1a')],_0x5badeb);_0x3785ba(_0x5ed994['error'](0x1f4,_0x2d01c7['message']));});});};exports[_0x3d3a('0x23')]=function(_0x4c5da5){return new Promise(function(_0xdbc985,_0x394b10){return db[_0x3d3a('0x1b')][_0x3d3a('0x24')]({'where':_0x4c5da5[_0x3d3a('0x1d')]?_0x4c5da5[_0x3d3a('0x1d')][_0x3d3a('0x1f')]||null:null})[_0x3d3a('0x11')](function(_0x2ff909){if(_0x2ff909){return _0x2ff909['addTags'](_0x4c5da5[_0x3d3a('0x1c')]['ids'],_[_0x3d3a('0x25')](_0x4c5da5['body'],[_0x3d3a('0x26'),'id'])||{});}})[_0x3d3a('0x27')](function(_0x215a71){logger[_0x3d3a('0x12')]('AddTags',_0x4c5da5);logger[_0x3d3a('0x13')](_0x3d3a('0x28'),_0x4c5da5,JSON['stringify'](_0x215a71));_0xdbc985(_0x215a71);})[_0x3d3a('0x22')](function(_0x2b8e70){logger[_0x3d3a('0x17')]('AddTags',_0x2b8e70[_0x3d3a('0x1a')],_0x4c5da5);_0x394b10(_this[_0x3d3a('0x17')](0x1f4,_0x2b8e70[_0x3d3a('0x1a')]));});});}; \ No newline at end of file +var _0x996e=['moment','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','limit','AddTagsToWhatsappInteraction','addTags','ids','omit','spread','AddTags','lodash','util'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x996e,0x13e));var _0xe996=function(_0x31d137,_0x338993){_0x31d137=_0x31d137-0x0;var _0x3b7c4f=_0x996e[_0x31d137];return _0x3b7c4f;};'use strict';var _=require(_0xe996('0x0'));var util=require(_0xe996('0x1'));var moment=require(_0xe996('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe996('0x3'))['db'];var utils=require(_0xe996('0x4'));var logger=require(_0xe996('0x5'))(_0xe996('0x6'));var config=require('../../config/environment');var jayson=require(_0xe996('0x7'));var client=jayson['client'][_0xe996('0x8')]({'port':0x232a});config['redis']=_[_0xe996('0x9')](config[_0xe996('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xe996('0xb'))(new Redis(config[_0xe996('0xa')]));require(_0xe996('0xc'))[_0xe996('0xd')](socket);function respondWithRpcPromise(_0x402f25,_0x65fd77,_0x2579e5){return new BPromise(function(_0x43fd85,_0x48b24f){return client[_0xe996('0xe')](_0x402f25,_0x2579e5)[_0xe996('0xf')](function(_0x265dab){logger[_0xe996('0x10')](_0xe996('0x11'),_0x65fd77,_0xe996('0x12'));logger[_0xe996('0x13')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x65fd77,_0xe996('0x12'),JSON[_0xe996('0x14')](_0x265dab));if(_0x265dab[_0xe996('0x15')]){if(_0x265dab['error']['code']===0x1f4){logger[_0xe996('0x15')]('WhatsappInteraction,\x20%s,\x20%s',_0x65fd77,_0x265dab['error']['message']);return _0x48b24f(_0x265dab[_0xe996('0x15')][_0xe996('0x16')]);}logger[_0xe996('0x15')](_0xe996('0x11'),_0x65fd77,_0x265dab['error'][_0xe996('0x16')]);return _0x43fd85(_0x265dab[_0xe996('0x15')]['message']);}else{logger[_0xe996('0x10')](_0xe996('0x11'),_0x65fd77,_0xe996('0x12'));_0x43fd85(_0x265dab[_0xe996('0x17')][_0xe996('0x16')]);}})[_0xe996('0x18')](function(_0x68a5ef){logger['error'](_0xe996('0x11'),_0x65fd77,_0x68a5ef);_0x48b24f(_0x68a5ef);});});}exports[_0xe996('0x19')]=function(_0x3b03c7){var _0x9146b6=this;return new Promise(function(_0x5a6957,_0x33e866){return db[_0xe996('0x1a')][_0xe996('0x1b')](_0x3b03c7[_0xe996('0x1c')],{'raw':_0x3b03c7[_0xe996('0x1d')]?_0x3b03c7[_0xe996('0x1d')][_0xe996('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b03c7[_0xe996('0x1d')]?_0x3b03c7[_0xe996('0x1d')][_0xe996('0x1f')]||null:null,'attributes':_0x3b03c7[_0xe996('0x1d')]?_0x3b03c7[_0xe996('0x1d')][_0xe996('0x20')]||null:null,'limit':_0x3b03c7[_0xe996('0x1d')]?_0x3b03c7['options'][_0xe996('0x21')]||null:null})[_0xe996('0xf')](function(_0x39f917){logger[_0xe996('0x10')]('UpdateWhatsappInteraction',_0x3b03c7);logger[_0xe996('0x13')]('UpdateWhatsappInteraction',_0x3b03c7,JSON[_0xe996('0x14')](_0x39f917));_0x5a6957(_0x39f917);})[_0xe996('0x18')](function(_0x4f86e7){logger['error'](_0xe996('0x19'),_0x4f86e7[_0xe996('0x16')],_0x3b03c7);_0x33e866(_0x9146b6['error'](0x1f4,_0x4f86e7['message']));});});};exports[_0xe996('0x22')]=function(_0xcf0ee4){return new Promise(function(_0x44717f,_0x263fd7){return db['WhatsappInteraction']['find']({'where':_0xcf0ee4[_0xe996('0x1d')]?_0xcf0ee4[_0xe996('0x1d')][_0xe996('0x1f')]||null:null})[_0xe996('0xf')](function(_0x1bcbbc){if(_0x1bcbbc){return _0x1bcbbc[_0xe996('0x23')](_0xcf0ee4[_0xe996('0x1c')][_0xe996('0x24')],_[_0xe996('0x25')](_0xcf0ee4[_0xe996('0x1c')],['ids','id'])||{});}})[_0xe996('0x26')](function(_0x181e82){logger['info'](_0xe996('0x27'),_0xcf0ee4);logger[_0xe996('0x13')]('AddTags',_0xcf0ee4,JSON[_0xe996('0x14')](_0x181e82));_0x44717f(_0x181e82);})[_0xe996('0x18')](function(_0x1ca98d){logger['error'](_0xe996('0x27'),_0x1ca98d[_0xe996('0x16')],_0xcf0ee4);_0x263fd7(_this[_0xe996('0x15')](0x1f4,_0x1ca98d[_0xe996('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index ab614f0..a01d6d4 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 _0xe614=['save','remove','emit','removeListener','register','length','whatsappInteraction:'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xe614,0x1e3));var _0x4e61=function(_0x7ffccb,_0x3be537){_0x7ffccb=_0x7ffccb-0x0;var _0xb2b089=_0xe614[_0x7ffccb];return _0xb2b089;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0x4e61('0x0'),_0x4e61('0x1'),'update'];function createListener(_0x37dace,_0x2c2e90){return function(_0x4582f2){_0x2c2e90[_0x4e61('0x2')](_0x37dace,_0x4582f2);};}function removeListener(_0x4301aa,_0x34ddc6){return function(){WhatsappInteractionEvents[_0x4e61('0x3')](_0x4301aa,_0x34ddc6);};}exports[_0x4e61('0x4')]=function(_0x26f2b3){for(var _0x432cc9=0x0,_0x30c6e4=events[_0x4e61('0x5')];_0x432cc9<_0x30c6e4;_0x432cc9++){var _0x1d6b59=events[_0x432cc9];var _0x3f7f11=createListener(_0x4e61('0x6')+_0x1d6b59,_0x26f2b3);WhatsappInteractionEvents['on'](_0x1d6b59,_0x3f7f11);}}; \ No newline at end of file +var _0x0280=['update','emit','register','length','whatsappInteraction:','save','remove'];(function(_0x506dd2,_0x3d4500){var _0x35ef80=function(_0x5c2a33){while(--_0x5c2a33){_0x506dd2['push'](_0x506dd2['shift']());}};_0x35ef80(++_0x3d4500);}(_0x0280,0x1ef));var _0x0028=function(_0x385d36,_0x26a1e8){_0x385d36=_0x385d36-0x0;var _0x4945d1=_0x0280[_0x385d36];return _0x4945d1;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0x0028('0x0'),_0x0028('0x1'),_0x0028('0x2')];function createListener(_0x20082e,_0x425f3e){return function(_0x23474d){_0x425f3e[_0x0028('0x3')](_0x20082e,_0x23474d);};}function removeListener(_0x2b6473,_0x265e6f){return function(){WhatsappInteractionEvents['removeListener'](_0x2b6473,_0x265e6f);};}exports[_0x0028('0x4')]=function(_0x3ff587){for(var _0x1a8c0b=0x0,_0x10c0d7=events[_0x0028('0x5')];_0x1a8c0b<_0x10c0d7;_0x1a8c0b++){var _0x4c43a2=events[_0x1a8c0b];var _0x24cc36=createListener(_0x0028('0x6')+_0x4c43a2,_0x3ff587);WhatsappInteractionEvents['on'](_0x4c43a2,_0x24cc36);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index caa6ff8..40b4908 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 _0xef30=['path','connect-timeout','express','Router','../../components/interaction/service','./whatsappMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','accept','/:id/reject','reject','delete','destroy','exports','util'];(function(_0x5d6e35,_0x4d1ac0){var _0x5d7ada=function(_0x2f7dd3){while(--_0x2f7dd3){_0x5d6e35['push'](_0x5d6e35['shift']());}};_0x5d7ada(++_0x4d1ac0);}(_0xef30,0x1db));var _0x0ef3=function(_0x5e6bec,_0x1eb54d){_0x5e6bec=_0x5e6bec-0x0;var _0x5dc5cf=_0xef30[_0x5e6bec];return _0x5dc5cf;};'use strict';var multer=require('multer');var util=require(_0x0ef3('0x0'));var path=require(_0x0ef3('0x1'));var timeout=require(_0x0ef3('0x2'));var express=require(_0x0ef3('0x3'));var router=express[_0x0ef3('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0ef3('0x5'));var config=require('../../config/environment');var controller=require(_0x0ef3('0x6'));router['get']('/',auth[_0x0ef3('0x7')](),controller[_0x0ef3('0x8')]);router[_0x0ef3('0x9')](_0x0ef3('0xa'),auth[_0x0ef3('0x7')](),controller[_0x0ef3('0xb')]);router[_0x0ef3('0x9')](_0x0ef3('0xc'),auth[_0x0ef3('0x7')](),controller[_0x0ef3('0xd')]);router[_0x0ef3('0xe')]('/',auth[_0x0ef3('0x7')](),interaction[_0x0ef3('0xf')](_0x0ef3('0x10'),_0x0ef3('0x11')),controller[_0x0ef3('0x12')]);router[_0x0ef3('0xe')](_0x0ef3('0x13'),controller[_0x0ef3('0x14')]);router['put'](_0x0ef3('0xc'),auth[_0x0ef3('0x7')](),controller['update']);router[_0x0ef3('0x15')]('/:id/accept',auth[_0x0ef3('0x7')](),controller[_0x0ef3('0x16')]);router['put'](_0x0ef3('0x17'),auth[_0x0ef3('0x7')](),controller[_0x0ef3('0x18')]);router[_0x0ef3('0x19')](_0x0ef3('0xc'),auth['isAuthenticated'](),controller[_0x0ef3('0x1a')]);module[_0x0ef3('0x1b')]=router; \ No newline at end of file +var _0x340f=['isAuthenticated','index','/describe','describe','/:id','show','post','whatsapp','whatsappmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x340f,0xab));var _0xf340=function(_0x1e266e,_0x49f7a7){_0x1e266e=_0x1e266e-0x0;var _0x28dbd7=_0x340f[_0x1e266e];return _0x28dbd7;};'use strict';var multer=require(_0xf340('0x0'));var util=require(_0xf340('0x1'));var path=require('path');var timeout=require(_0xf340('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf340('0x3'));var auth=require(_0xf340('0x4'));var interaction=require(_0xf340('0x5'));var config=require(_0xf340('0x6'));var controller=require(_0xf340('0x7'));router[_0xf340('0x8')]('/',auth[_0xf340('0x9')](),controller[_0xf340('0xa')]);router[_0xf340('0x8')](_0xf340('0xb'),auth[_0xf340('0x9')](),controller[_0xf340('0xc')]);router['get'](_0xf340('0xd'),auth['isAuthenticated'](),controller[_0xf340('0xe')]);router[_0xf340('0xf')]('/',auth[_0xf340('0x9')](),interaction['tracked'](_0xf340('0x10'),_0xf340('0x11')),controller[_0xf340('0x12')]);router[_0xf340('0xf')](_0xf340('0x13'),controller[_0xf340('0x14')]);router[_0xf340('0x15')](_0xf340('0xd'),auth[_0xf340('0x9')](),controller[_0xf340('0x16')]);router[_0xf340('0x15')](_0xf340('0x17'),auth[_0xf340('0x9')](),controller[_0xf340('0x18')]);router[_0xf340('0x15')](_0xf340('0x19'),auth[_0xf340('0x9')](),controller[_0xf340('0x1a')]);router[_0xf340('0x1b')](_0xf340('0xd'),auth['isAuthenticated'](),controller[_0xf340('0x1c')]);module[_0xf340('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index dceba04..08312d1 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 _0x20ec=['exports','TEXT','medium','out','STRING','DATE','BOOLEAN','sequelize'];(function(_0x19fa35,_0x17f64e){var _0x4fa647=function(_0x345351){while(--_0x345351){_0x19fa35['push'](_0x19fa35['shift']());}};_0x4fa647(++_0x17f64e);}(_0x20ec,0x12f));var _0xc20e=function(_0x5673c6,_0xc302ec){_0x5673c6=_0x5673c6-0x0;var _0x130bd9=_0x20ec[_0x5673c6];return _0x130bd9;};'use strict';var Sequelize=require(_0xc20e('0x0'));module[_0xc20e('0x1')]={'body':{'type':Sequelize[_0xc20e('0x2')](_0xc20e('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xc20e('0x4')),'defaultValue':_0xc20e('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xc20e('0x5')](0xbe)},'phone':{'type':Sequelize[_0xc20e('0x5')]},'readAt':{'type':Sequelize[_0xc20e('0x6')]},'secret':{'type':Sequelize[_0xc20e('0x7')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xc20e('0x5')]},'providerResponse':{'type':Sequelize[_0xc20e('0x2')]}}; \ No newline at end of file +var _0x2cd0=['BOOLEAN','out','STRING','DATE','TEXT','sequelize','exports'];(function(_0x104210,_0x208a4b){var _0x4e7c6b=function(_0x43907f){while(--_0x43907f){_0x104210['push'](_0x104210['shift']());}};_0x4e7c6b(++_0x208a4b);}(_0x2cd0,0x8a));var _0x02cd=function(_0x354c01,_0x28a7f1){_0x354c01=_0x354c01-0x0;var _0x3a8262=_0x2cd0[_0x354c01];return _0x3a8262;};'use strict';var Sequelize=require(_0x02cd('0x0'));module[_0x02cd('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x02cd('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x02cd('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0x02cd('0x4')](0xbe)},'phone':{'type':Sequelize[_0x02cd('0x4')]},'readAt':{'type':Sequelize[_0x02cd('0x5')]},'secret':{'type':Sequelize[_0x02cd('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x02cd('0x4')]},'providerResponse':{'type':Sequelize[_0x02cd('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 60d1bfc..72a5145 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 _0x8c46=['apply','reject','update','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','keys','fields','find','create','body','destroy','params','describe','whatsapp-interactions','accept','read','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','get','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','SELECT','User','email','manual','interface','format','SIP/%s','channel','event','EventManager','acceptmessage','whatsapp','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','QueryTypes','contact','internal','rejectmessage','WhatsappAccount','WhatsappAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./whatsappMessage.socket','register','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json'];(function(_0x21a209,_0x1b8347){var _0x40c2a8=function(_0x25ed46){while(--_0x25ed46){_0x21a209['push'](_0x21a209['shift']());}};_0x40c2a8(++_0x1b8347);}(_0x8c46,0x171));var _0x68c4=function(_0xe6b3c0,_0x26a96b){_0xe6b3c0=_0xe6b3c0-0x0;var _0x500498=_0x8c46[_0xe6b3c0];return _0x500498;};'use strict';var emlformat=require(_0x68c4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x68c4('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x68c4('0x2'));var Mustache=require(_0x68c4('0x3'));var util=require(_0x68c4('0x4'));var path=require(_0x68c4('0x5'));var sox=require(_0x68c4('0x6'));var csv=require(_0x68c4('0x7'));var ejs=require(_0x68c4('0x8'));var fs=require('fs');var fs_extra=require(_0x68c4('0x9'));var _=require(_0x68c4('0xa'));var squel=require(_0x68c4('0xb'));var crypto=require('crypto');var jsforce=require(_0x68c4('0xc'));var deskjs=require(_0x68c4('0xd'));var toCsv=require(_0x68c4('0x7'));var querystring=require('querystring');var Papa=require(_0x68c4('0xe'));var Redis=require(_0x68c4('0xf'));var authService=require(_0x68c4('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x68c4('0x11'));var logger=require(_0x68c4('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x68c4('0x13'));var licenseUtil=require(_0x68c4('0x14'));var db=require(_0x68c4('0x15'))['db'];config['redis']=_[_0x68c4('0x16')](config[_0x68c4('0x17')],{'host':_0x68c4('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x68c4('0x17')]));require(_0x68c4('0x19'))[_0x68c4('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0x68c4('0x1b')][_0x68c4('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0x68c4('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x4ea2a4,_0x1a7045,_0x556aa6,_0x5497bf){return new BPromise(function(_0xc2ea2f,_0x5cb05f){var _0x4f4797=_0x5497bf||client;return _0x4f4797[_0x68c4('0x1d')](_0x4ea2a4,_0x556aa6)[_0x68c4('0x1e')](function(_0x38ac38){logger[_0x68c4('0x1f')](_0x68c4('0x20'),_0x1a7045,_0x68c4('0x21'));logger[_0x68c4('0x22')](_0x68c4('0x23'),_0x1a7045,_0x68c4('0x21'),JSON[_0x68c4('0x24')](_0x38ac38));if(_0x38ac38[_0x68c4('0x25')]){if(_0x38ac38['error'][_0x68c4('0x26')]===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x1a7045,_0x38ac38[_0x68c4('0x25')][_0x68c4('0x27')]);return _0x5cb05f(_0x38ac38[_0x68c4('0x25')][_0x68c4('0x27')]);}logger['error'](_0x68c4('0x20'),_0x1a7045,_0x38ac38[_0x68c4('0x25')]['message']);return _0xc2ea2f(_0x38ac38[_0x68c4('0x25')][_0x68c4('0x27')]);}else{logger[_0x68c4('0x1f')](_0x68c4('0x20'),_0x1a7045,_0x68c4('0x21'));_0xc2ea2f(_0x38ac38[_0x68c4('0x28')][_0x68c4('0x27')]);}})['catch'](function(_0x2ff4a5){logger['error'](_0x68c4('0x20'),_0x1a7045,_0x2ff4a5);_0x5cb05f(_0x2ff4a5);});});}function respondWithStatusCode(_0x10c67e,_0x57f32){_0x57f32=_0x57f32||0xcc;return function(_0x4f9d32){if(_0x4f9d32){return _0x10c67e[_0x68c4('0x29')](_0x57f32);}return _0x10c67e[_0x68c4('0x2a')](_0x57f32)[_0x68c4('0x2b')]();};}function respondWithResult(_0x31e177,_0x3b62a3){_0x3b62a3=_0x3b62a3||0xc8;return function(_0x22f053){if(_0x22f053){return _0x31e177[_0x68c4('0x2a')](_0x3b62a3)['json'](_0x22f053);}};}function respondWithFilteredResult(_0x26d56b,_0x4b4634){return function(_0x3772b3){if(_0x3772b3){var _0x1442ba=typeof _0x4b4634['offset']===_0x68c4('0x2c')&&typeof _0x4b4634[_0x68c4('0x2d')]==='undefined';var _0x29ef9d=_0x3772b3[_0x68c4('0x2e')];var _0xc3131c=_0x1442ba?0x0:_0x4b4634[_0x68c4('0x2f')];var _0x233cea=_0x1442ba?_0x3772b3[_0x68c4('0x2e')]:_0x4b4634[_0x68c4('0x2f')]+_0x4b4634[_0x68c4('0x2d')];var _0x3a7297;if(_0x233cea>=_0x29ef9d){_0x233cea=_0x29ef9d;_0x3a7297=0xc8;}else{_0x3a7297=0xce;}_0x26d56b[_0x68c4('0x2a')](_0x3a7297);return _0x26d56b[_0x68c4('0x30')](_0x68c4('0x31'),_0xc3131c+'-'+_0x233cea+'/'+_0x29ef9d)[_0x68c4('0x32')](_0x3772b3);}return null;};}function patchUpdates(_0x1ad882){return function(_0x3ce082){try{jsonpatch[_0x68c4('0x33')](_0x3ce082,_0x1ad882,!![]);}catch(_0x33fcc7){return BPromise[_0x68c4('0x34')](_0x33fcc7);}return _0x3ce082['save']();};}function saveUpdates(_0x1299fc,_0x194217){return function(_0x25eeea){if(_0x25eeea){return _0x25eeea[_0x68c4('0x35')](_0x1299fc)[_0x68c4('0x1e')](function(_0x5a4e0c){return _0x5a4e0c;});}return null;};}function removeEntity(_0x32fef0,_0x4f4672){return function(_0x586e9c){if(_0x586e9c){return _0x586e9c['destroy']()[_0x68c4('0x1e')](function(){_0x32fef0[_0x68c4('0x2a')](0xcc)[_0x68c4('0x2b')]();});}};}function handleEntityNotFound(_0x21c2f9,_0x5953cc){return function(_0x1ed80d){if(!_0x1ed80d){_0x21c2f9[_0x68c4('0x29')](0x194);}return _0x1ed80d;};}function handleError(_0xb8704e,_0x5ba21b){_0x5ba21b=_0x5ba21b||0x1f4;return function(_0x43de85){logger[_0x68c4('0x25')](_0x43de85[_0x68c4('0x36')]);if(_0x43de85[_0x68c4('0x37')]){delete _0x43de85[_0x68c4('0x37')];}_0xb8704e[_0x68c4('0x2a')](_0x5ba21b)[_0x68c4('0x38')](_0x43de85);};}exports[_0x68c4('0x39')]=function(_0x31efb7,_0x54fdbe){var _0x524e8d={},_0x50aa7c={},_0x326940={'count':0x0,'rows':[]};var _0x2baafa=_[_0x68c4('0x3a')](db[_0x68c4('0x3b')][_0x68c4('0x3c')],function(_0x13386d){return{'name':_0x13386d[_0x68c4('0x3d')],'type':_0x13386d[_0x68c4('0x3e')][_0x68c4('0x3f')]};});_0x50aa7c[_0x68c4('0x40')]=_[_0x68c4('0x3a')](_0x2baafa,_0x68c4('0x37'));_0x50aa7c[_0x68c4('0x41')]=_['keys'](_0x31efb7['query']);_0x50aa7c[_0x68c4('0x42')]=_[_0x68c4('0x43')](_0x50aa7c[_0x68c4('0x40')],_0x50aa7c[_0x68c4('0x41')]);_0x524e8d['attributes']=_[_0x68c4('0x43')](_0x50aa7c[_0x68c4('0x40')],qs['fields'](_0x31efb7['query']['fields']));_0x524e8d[_0x68c4('0x44')]=_0x524e8d['attributes'][_0x68c4('0x45')]?_0x524e8d['attributes']:_0x50aa7c[_0x68c4('0x40')];if(!_0x31efb7[_0x68c4('0x41')][_0x68c4('0x46')](_0x68c4('0x47'))){_0x524e8d['limit']=qs[_0x68c4('0x2d')](_0x31efb7[_0x68c4('0x41')][_0x68c4('0x2d')]);_0x524e8d[_0x68c4('0x2f')]=qs['offset'](_0x31efb7[_0x68c4('0x41')][_0x68c4('0x2f')]);}_0x524e8d[_0x68c4('0x48')]=qs[_0x68c4('0x49')](_0x31efb7[_0x68c4('0x41')]['sort']);_0x524e8d['where']=qs['filters'](_[_0x68c4('0x4a')](_0x31efb7[_0x68c4('0x41')],_0x50aa7c[_0x68c4('0x42')]),_0x2baafa);if(_0x31efb7[_0x68c4('0x41')]['filter']){_0x524e8d[_0x68c4('0x4b')]=_[_0x68c4('0x4c')](_0x524e8d[_0x68c4('0x4b')],{'$or':_[_0x68c4('0x3a')](_0x2baafa,function(_0x25be7a){if(_0x25be7a[_0x68c4('0x3e')]!==_0x68c4('0x4d')){var _0x5b8209={};_0x5b8209[_0x25be7a[_0x68c4('0x37')]]={'$like':'%'+_0x31efb7[_0x68c4('0x41')][_0x68c4('0x4e')]+'%'};return _0x5b8209;}})});}_0x524e8d=_['merge']({},_0x524e8d,_0x31efb7[_0x68c4('0x4f')]);var _0x4e796c={'where':_0x524e8d[_0x68c4('0x4b')]};return db[_0x68c4('0x3b')][_0x68c4('0x2e')](_0x4e796c)[_0x68c4('0x1e')](function(_0x5c7f35){_0x326940[_0x68c4('0x2e')]=_0x5c7f35;if(_0x31efb7['query'][_0x68c4('0x50')]){_0x524e8d[_0x68c4('0x51')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x68c4('0x52')](_0x524e8d);})[_0x68c4('0x1e')](function(_0x290430){_0x326940[_0x68c4('0x53')]=_0x290430;return _0x326940;})[_0x68c4('0x1e')](respondWithFilteredResult(_0x54fdbe,_0x524e8d))[_0x68c4('0x54')](handleError(_0x54fdbe,null));};exports['show']=function(_0x18e6ed,_0x13f9e8){var _0x3de389={'raw':!![],'where':{'id':_0x18e6ed['params']['id']}},_0x1b7059={};_0x1b7059[_0x68c4('0x40')]=_[_0x68c4('0x55')](db[_0x68c4('0x3b')][_0x68c4('0x3c')]);_0x1b7059[_0x68c4('0x41')]=_[_0x68c4('0x55')](_0x18e6ed['query']);_0x1b7059[_0x68c4('0x42')]=_[_0x68c4('0x43')](_0x1b7059[_0x68c4('0x40')],_0x1b7059['query']);_0x3de389[_0x68c4('0x44')]=_[_0x68c4('0x43')](_0x1b7059['model'],qs['fields'](_0x18e6ed[_0x68c4('0x41')][_0x68c4('0x56')]));_0x3de389[_0x68c4('0x44')]=_0x3de389[_0x68c4('0x44')][_0x68c4('0x45')]?_0x3de389[_0x68c4('0x44')]:_0x1b7059[_0x68c4('0x40')];if(_0x18e6ed[_0x68c4('0x41')]['includeAll']){_0x3de389[_0x68c4('0x51')]=[{'all':!![]}];}_0x3de389=_['merge']({},_0x3de389,_0x18e6ed['options']);return db['WhatsappMessage'][_0x68c4('0x57')](_0x3de389)[_0x68c4('0x1e')](handleEntityNotFound(_0x13f9e8,null))[_0x68c4('0x1e')](respondWithResult(_0x13f9e8,null))['catch'](handleError(_0x13f9e8,null));};exports[_0x68c4('0x58')]=function(_0x441371,_0x55466b){return db[_0x68c4('0x3b')]['create'](_0x441371[_0x68c4('0x59')],{})['then'](respondWithResult(_0x55466b,0xc9))[_0x68c4('0x54')](handleError(_0x55466b,null));};exports[_0x68c4('0x35')]=function(_0x507df8,_0x1303fc){if(_0x507df8[_0x68c4('0x59')]['id']){delete _0x507df8['body']['id'];}return db[_0x68c4('0x3b')][_0x68c4('0x57')]({'where':{'id':_0x507df8['params']['id']}})[_0x68c4('0x1e')](handleEntityNotFound(_0x1303fc,null))[_0x68c4('0x1e')](saveUpdates(_0x507df8[_0x68c4('0x59')],null))[_0x68c4('0x1e')](respondWithResult(_0x1303fc,null))[_0x68c4('0x54')](handleError(_0x1303fc,null));};exports[_0x68c4('0x5a')]=function(_0x1a2ede,_0x22424b){return db[_0x68c4('0x3b')]['find']({'where':{'id':_0x1a2ede[_0x68c4('0x5b')]['id']}})[_0x68c4('0x1e')](handleEntityNotFound(_0x22424b,null))[_0x68c4('0x1e')](removeEntity(_0x22424b,null))[_0x68c4('0x54')](handleError(_0x22424b,null));};exports[_0x68c4('0x5c')]=function(_0x120345,_0x318662){return db['WhatsappMessage']['describe']()[_0x68c4('0x1e')](respondWithResult(_0x318662,null))[_0x68c4('0x54')](handleError(_0x318662,null));};var interaction_log=require('../../config/logger')(_0x68c4('0x5d'));exports[_0x68c4('0x5e')]=function(_0x32d539,_0x1bde7a,_0x334fff){var _0x26af61={'agent':{},'channel':'whatsapp'};if(_0x32d539[_0x68c4('0x59')]['id']){delete _0x32d539[_0x68c4('0x59')]['id'];}_0x32d539[_0x68c4('0x59')][_0x68c4('0x5f')]=!![];_0x32d539[_0x68c4('0x59')]['readAt']=moment()['format'](_0x68c4('0x60'));_0x32d539[_0x68c4('0x59')][_0x68c4('0x61')]=_0x32d539[_0x68c4('0x59')][_0x68c4('0x61')]||_0x32d539['user']['id'];_0x26af61[_0x68c4('0x62')]['id']=_0x32d539[_0x68c4('0x59')][_0x68c4('0x61')];return db[_0x68c4('0x3b')][_0x68c4('0x57')]({'where':{'id':_0x32d539[_0x68c4('0x5b')]['id'],'UserId':null}})[_0x68c4('0x1e')](handleEntityNotFound(_0x1bde7a,null))[_0x68c4('0x1e')](saveUpdates(_0x32d539[_0x68c4('0x59')],null))[_0x68c4('0x1e')](function(_0x50ada0){if(_0x50ada0){_0x26af61[_0x68c4('0x27')]=_0x50ada0['get']({'plain':!![]});return db[_0x68c4('0x63')][_0x68c4('0x57')]({'where':{'id':_0x50ada0[_0x68c4('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x1bde7a,null))[_0x68c4('0x1e')](function(_0x4fa64d){if(_0x4fa64d){return _0x4fa64d[_0x68c4('0x35')]({'UserId':_0x32d539[_0x68c4('0x59')][_0x68c4('0x61')],'read1stAt':_[_0x68c4('0x65')](_0x4fa64d[_0x68c4('0x66')])?moment()['format'](_0x68c4('0x60')):undefined});}return null;})[_0x68c4('0x1e')](function(_0x30205d){if(_0x30205d){_0x26af61[_0x68c4('0x67')]=_0x30205d[_0x68c4('0x68')]({'plain':!![]});interaction_log['info'](_0x68c4('0x69'),_0x32d539[_0x68c4('0x6a')]['id'],_0x32d539[_0x68c4('0x6a')]['name'],_0x32d539[_0x68c4('0x6a')][_0x68c4('0x6b')],_0x26af61[_0x68c4('0x67')]['id'],_0x32d539['body']?JSON[_0x68c4('0x24')](_0x32d539['body']):'null');return respondWithRpcPromise(_0x68c4('0x6c'),_0x68c4('0x6d'),_0x26af61);}return null;})[_0x68c4('0x1e')](function(_0x508581){var _0x5b5353=_0x68c4('0x6e')+_0x508581[_0x68c4('0x27')]['ContactId'];return db[_0x68c4('0x6f')][_0x68c4('0x41')](_0x5b5353,{'type':db['Sequelize']['QueryTypes'][_0x68c4('0x70')],'raw':!![]})[_0x68c4('0x1e')](function(_0x3f9a43){return _0x3f9a43;});})[_0x68c4('0x1e')](function(_0x4cc92b){if(_0x4cc92b){_0x26af61[_0x68c4('0x27')]['contact']=_0x4cc92b[0x0];if(!_0x32d539[_0x68c4('0x59')][_0x68c4('0x61')])return;return db[_0x68c4('0x71')][_0x68c4('0x57')]({'where':{'id':_0x32d539[_0x68c4('0x59')][_0x68c4('0x61')],'role':_0x68c4('0x62')},'attributes':['id',_0x68c4('0x37'),'fullname',_0x68c4('0x72'),'internal'],'raw':!![]});}return null;})[_0x68c4('0x1e')](function(_0x2314b2){if(!_0x2314b2)return null;_0x26af61[_0x68c4('0x27')][_0x68c4('0x62')]=_0x2314b2;return _0x26af61;})[_0x68c4('0x1e')](function(_0x39c3e8){if(_0x39c3e8){if(_0x32d539[_0x68c4('0x59')][_0x68c4('0x73')]){_0x26af61[_0x68c4('0x27')][_0x68c4('0x74')]=util[_0x68c4('0x75')](_0x68c4('0x76'),_0x32d539[_0x68c4('0x6a')][_0x68c4('0x37')]);_0x26af61[_0x68c4('0x27')][_0x68c4('0x77')]=_0x26af61[_0x68c4('0x77')];_0x26af61[_0x68c4('0x27')][_0x68c4('0x78')]=_0x68c4('0x5e');return respondWithRpcPromise(_0x68c4('0x79'),_0x68c4('0x79'),{'event':_0x68c4('0x7a'),'message':_0x26af61[_0x68c4('0x27')]},client9002)[_0x68c4('0x1e')](function(){return _0x26af61;});}return _0x26af61;}return null;})['then'](respondWithResult(_0x1bde7a,null))[_0x68c4('0x54')](handleError(_0x1bde7a,null));};var interaction_log=require(_0x68c4('0x12'))('whatsapp-interactions');exports[_0x68c4('0x34')]=function(_0x186596,_0x4e5b7b,_0x88c15){var _0x1b704d={'agent':{},'channel':_0x68c4('0x7b')};if(_0x186596[_0x68c4('0x59')]['id']){delete _0x186596[_0x68c4('0x59')]['id'];}_0x186596[_0x68c4('0x59')][_0x68c4('0x61')]=_0x186596['body'][_0x68c4('0x61')]||_0x186596[_0x68c4('0x6a')]['id'];_0x1b704d[_0x68c4('0x62')]['id']=_0x186596[_0x68c4('0x59')][_0x68c4('0x61')];return db['WhatsappMessage']['find']({'where':{'id':_0x186596[_0x68c4('0x5b')]['id'],'UserId':null}})[_0x68c4('0x1e')](handleEntityNotFound(_0x4e5b7b,null))[_0x68c4('0x1e')](function(_0x2b70c3){if(_0x2b70c3){_0x1b704d[_0x68c4('0x27')]=_0x2b70c3[_0x68c4('0x68')]({'plain':!![]});return db['WhatsappInteraction'][_0x68c4('0x57')]({'where':{'id':_0x2b70c3[_0x68c4('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x4e5b7b,null))[_0x68c4('0x1e')](function(_0x1e16e6){if(_0x1e16e6){_0x1b704d[_0x68c4('0x67')]=_0x1e16e6[_0x68c4('0x68')]({'plain':!![]});interaction_log[_0x68c4('0x1f')](_0x68c4('0x7c'),_0x186596[_0x68c4('0x6a')]['id'],_0x186596[_0x68c4('0x6a')][_0x68c4('0x37')],_0x186596[_0x68c4('0x6a')][_0x68c4('0x6b')],_0x1b704d[_0x68c4('0x67')]['id'],_0x186596[_0x68c4('0x59')]?JSON[_0x68c4('0x24')](_0x186596[_0x68c4('0x59')]):'null');return respondWithRpcPromise(_0x68c4('0x7d'),_0x68c4('0x7e'),_0x1b704d);}return null;})[_0x68c4('0x1e')](function(_0x4ed8cf){var _0x50ff50=_0x68c4('0x6e')+_0x4ed8cf[_0x68c4('0x27')]['ContactId'];return db[_0x68c4('0x6f')][_0x68c4('0x41')](_0x50ff50,{'type':db[_0x68c4('0x7f')][_0x68c4('0x80')]['SELECT'],'raw':!![]})[_0x68c4('0x1e')](function(_0x3172dd){return _0x3172dd;});})[_0x68c4('0x1e')](function(_0x36e5dc){if(_0x36e5dc){_0x1b704d['message'][_0x68c4('0x81')]=_0x36e5dc[0x0];if(!_0x186596[_0x68c4('0x59')][_0x68c4('0x61')])return;return db[_0x68c4('0x71')][_0x68c4('0x57')]({'where':{'id':_0x186596[_0x68c4('0x59')][_0x68c4('0x61')],'role':_0x68c4('0x62')},'attributes':['id','name','fullname',_0x68c4('0x72'),_0x68c4('0x82')],'raw':!![]});}return null;})[_0x68c4('0x1e')](function(_0x1d10a8){if(!_0x1d10a8)return null;_0x1b704d[_0x68c4('0x27')][_0x68c4('0x62')]=_0x1d10a8;return _0x1b704d;})[_0x68c4('0x1e')](function(_0x18d162){if(_0x18d162){_0x18d162[_0x68c4('0x27')][_0x68c4('0x74')]=util['format'](_0x68c4('0x76'),_0x186596[_0x68c4('0x6a')]['name']);_0x18d162[_0x68c4('0x27')][_0x68c4('0x77')]=_0x1b704d[_0x68c4('0x77')];_0x18d162['message'][_0x68c4('0x78')]=_0x68c4('0x34');respondWithRpcPromise('EventManager',_0x68c4('0x79'),{'event':_0x68c4('0x83'),'message':_0x18d162[_0x68c4('0x27')]},client9002);return _0x1b704d;}return null;})[_0x68c4('0x1e')](respondWithResult(_0x4e5b7b,null))[_0x68c4('0x54')](handleError(_0x4e5b7b,null));};exports[_0x68c4('0x2a')]=function(_0x9bc613,_0x582c11,_0x20e9cd){if(_0x9bc613['body']['id']){delete _0x9bc613[_0x68c4('0x59')]['id'];}var _0x29859c;return db[_0x68c4('0x3b')]['find']({'where':{'id':_0x9bc613[_0x68c4('0x5b')]['id']}})[_0x68c4('0x1e')](handleEntityNotFound(_0x582c11,null))['then'](function(_0x125bf9){if(_0x125bf9){_0x29859c=_0x125bf9;return db[_0x68c4('0x84')][_0x68c4('0x57')]({'where':{'id':_0x125bf9[_0x68c4('0x85')]}});}})[_0x68c4('0x1e')](handleEntityNotFound(_0x582c11,null))['then'](function(_0x49d8c3){if(_0x49d8c3){logger[_0x68c4('0x22')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0x68c4('0x2a'),_0x68c4('0x86'),_0x49d8c3[_0x68c4('0x3e')],util[_0x68c4('0x87')](_0x9bc613[_0x68c4('0x59')],{'showHidden':![],'depth':null}));switch(_0x49d8c3['type']){case _0x68c4('0x88'):if(_0x9bc613[_0x68c4('0x59')][_0x68c4('0x89')]&&_0x9bc613[_0x68c4('0x59')][_0x68c4('0x89')]===_0x29859c['messageId']&&_0x9bc613['body'][_0x68c4('0x8a')]&&_0x9bc613['body'][_0x68c4('0x8a')]===_0x68c4('0x5f')){return _0x29859c[_0x68c4('0x35')]({'read':!![]});}else{logger[_0x68c4('0x25')](_0x68c4('0x8b'),_0x68c4('0x2a'),_0x68c4('0x88'),util[_0x68c4('0x87')](_0x9bc613[_0x68c4('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x29859c;}})['then'](respondWithResult(_0x582c11,null))[_0x68c4('0x54')](handleError(_0x582c11,null));}; \ No newline at end of file +var _0xa992=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','client','http','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','name','send','index','WhatsappMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','merge','filter','includeAll','include','findAll','show','params','create','body','find','destroy','describe','../../config/logger','whatsapp-interactions','accept','whatsapp','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','WhatsappInteraction','WhatsappInteractionId','read1stAt','format','interaction','get','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','email','internal','manual','channel','event','EventManager','acceptmessage','null','rejectMessage','sequelize','fullname','interface','SIP/%s','rejectmessage','WhatsappAccountId','received\x20delivery\x20report\x20from','twilio','MessageSid','MessageStatus','inspect','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x1af61c,_0x1893c3){var _0x4a8162=function(_0x239515){while(--_0x239515){_0x1af61c['push'](_0x1af61c['shift']());}};_0x4a8162(++_0x1893c3);}(_0xa992,0x18c));var _0x2a99=function(_0x34f830,_0x441e71){_0x34f830=_0x34f830-0x0;var _0x47676e=_0xa992[_0x34f830];return _0x47676e;};'use strict';var emlformat=require(_0x2a99('0x0'));var rimraf=require(_0x2a99('0x1'));var zipdir=require(_0x2a99('0x2'));var jsonpatch=require(_0x2a99('0x3'));var rp=require('request-promise');var moment=require(_0x2a99('0x4'));var BPromise=require(_0x2a99('0x5'));var Mustache=require(_0x2a99('0x6'));var util=require(_0x2a99('0x7'));var path=require(_0x2a99('0x8'));var sox=require(_0x2a99('0x9'));var csv=require(_0x2a99('0xa'));var ejs=require(_0x2a99('0xb'));var fs=require('fs');var fs_extra=require(_0x2a99('0xc'));var _=require(_0x2a99('0xd'));var squel=require('squel');var crypto=require(_0x2a99('0xe'));var jsforce=require(_0x2a99('0xf'));var deskjs=require(_0x2a99('0x10'));var toCsv=require(_0x2a99('0xa'));var querystring=require(_0x2a99('0x11'));var Papa=require(_0x2a99('0x12'));var Redis=require(_0x2a99('0x13'));var authService=require(_0x2a99('0x14'));var qs=require(_0x2a99('0x15'));var as=require(_0x2a99('0x16'));var hardwareService=require(_0x2a99('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0x2a99('0x18'));var config=require(_0x2a99('0x19'));var licenseUtil=require(_0x2a99('0x1a'));var db=require(_0x2a99('0x1b'))['db'];config[_0x2a99('0x1c')]=_[_0x2a99('0x1d')](config['redis'],{'host':_0x2a99('0x1e'),'port':0x18eb});var socket=require(_0x2a99('0x1f'))(new Redis(config[_0x2a99('0x1c')]));require(_0x2a99('0x20'))[_0x2a99('0x21')](socket);var jayson=require('jayson/promise');var client=jayson[_0x2a99('0x22')]['http']({'port':0x232c});var client9002=jayson['client'][_0x2a99('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x271db6,_0x343ba4,_0x4aa37c,_0x5bf701){return new BPromise(function(_0x55d1f0,_0x228606){var _0x4346c4=_0x5bf701||client;return _0x4346c4['request'](_0x271db6,_0x4aa37c)[_0x2a99('0x24')](function(_0x44ac46){logger[_0x2a99('0x25')](_0x2a99('0x26'),_0x343ba4,'request\x20sent');logger[_0x2a99('0x27')](_0x2a99('0x28'),_0x343ba4,_0x2a99('0x29'),JSON[_0x2a99('0x2a')](_0x44ac46));if(_0x44ac46[_0x2a99('0x2b')]){if(_0x44ac46['error'][_0x2a99('0x2c')]===0x1f4){logger[_0x2a99('0x2b')](_0x2a99('0x26'),_0x343ba4,_0x44ac46[_0x2a99('0x2b')][_0x2a99('0x2d')]);return _0x228606(_0x44ac46[_0x2a99('0x2b')][_0x2a99('0x2d')]);}logger[_0x2a99('0x2b')](_0x2a99('0x26'),_0x343ba4,_0x44ac46[_0x2a99('0x2b')]['message']);return _0x55d1f0(_0x44ac46[_0x2a99('0x2b')]['message']);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x343ba4,_0x2a99('0x29'));_0x55d1f0(_0x44ac46['result']['message']);}})[_0x2a99('0x2e')](function(_0x5ec334){logger[_0x2a99('0x2b')](_0x2a99('0x26'),_0x343ba4,_0x5ec334);_0x228606(_0x5ec334);});});}function respondWithStatusCode(_0x274707,_0x159064){_0x159064=_0x159064||0xcc;return function(_0x23dfba){if(_0x23dfba){return _0x274707[_0x2a99('0x2f')](_0x159064);}return _0x274707[_0x2a99('0x30')](_0x159064)[_0x2a99('0x31')]();};}function respondWithResult(_0x2b5d97,_0x2f0bf0){_0x2f0bf0=_0x2f0bf0||0xc8;return function(_0x48a7c0){if(_0x48a7c0){return _0x2b5d97[_0x2a99('0x30')](_0x2f0bf0)[_0x2a99('0x32')](_0x48a7c0);}};}function respondWithFilteredResult(_0x5ad092,_0x298b12){return function(_0x17a9a0){if(_0x17a9a0){var _0x12c857=typeof _0x298b12['offset']===_0x2a99('0x33')&&typeof _0x298b12[_0x2a99('0x34')]===_0x2a99('0x33');var _0x30f087=_0x17a9a0['count'];var _0x24dc9f=_0x12c857?0x0:_0x298b12[_0x2a99('0x35')];var _0x4864b6=_0x12c857?_0x17a9a0[_0x2a99('0x36')]:_0x298b12[_0x2a99('0x35')]+_0x298b12[_0x2a99('0x34')];var _0x56dee2;if(_0x4864b6>=_0x30f087){_0x4864b6=_0x30f087;_0x56dee2=0xc8;}else{_0x56dee2=0xce;}_0x5ad092[_0x2a99('0x30')](_0x56dee2);return _0x5ad092[_0x2a99('0x37')](_0x2a99('0x38'),_0x24dc9f+'-'+_0x4864b6+'/'+_0x30f087)[_0x2a99('0x32')](_0x17a9a0);}return null;};}function patchUpdates(_0x18ad48){return function(_0x5a6017){try{jsonpatch[_0x2a99('0x39')](_0x5a6017,_0x18ad48,!![]);}catch(_0x4fef34){return BPromise[_0x2a99('0x3a')](_0x4fef34);}return _0x5a6017[_0x2a99('0x3b')]();};}function saveUpdates(_0x29567a,_0x47281e){return function(_0x104460){if(_0x104460){return _0x104460[_0x2a99('0x3c')](_0x29567a)[_0x2a99('0x24')](function(_0x2b1c4a){return _0x2b1c4a;});}return null;};}function removeEntity(_0x30a4f8,_0x1232da){return function(_0x190318){if(_0x190318){return _0x190318['destroy']()[_0x2a99('0x24')](function(){_0x30a4f8[_0x2a99('0x30')](0xcc)[_0x2a99('0x31')]();});}};}function handleEntityNotFound(_0x3e77e1,_0x2e7b21){return function(_0x1747bf){if(!_0x1747bf){_0x3e77e1[_0x2a99('0x2f')](0x194);}return _0x1747bf;};}function handleError(_0x1dde9c,_0x24570f){_0x24570f=_0x24570f||0x1f4;return function(_0xbeca9f){logger['error'](_0xbeca9f['stack']);if(_0xbeca9f['name']){delete _0xbeca9f[_0x2a99('0x3d')];}_0x1dde9c[_0x2a99('0x30')](_0x24570f)[_0x2a99('0x3e')](_0xbeca9f);};}exports[_0x2a99('0x3f')]=function(_0x2f7fb9,_0x115054){var _0x1e5f48={},_0x4e6613={},_0x22c6e7={'count':0x0,'rows':[]};var _0x587665=_['map'](db[_0x2a99('0x40')][_0x2a99('0x41')],function(_0x5bdb4c){return{'name':_0x5bdb4c[_0x2a99('0x42')],'type':_0x5bdb4c[_0x2a99('0x43')][_0x2a99('0x44')]};});_0x4e6613[_0x2a99('0x45')]=_[_0x2a99('0x46')](_0x587665,_0x2a99('0x3d'));_0x4e6613[_0x2a99('0x47')]=_[_0x2a99('0x48')](_0x2f7fb9[_0x2a99('0x47')]);_0x4e6613[_0x2a99('0x49')]=_['intersection'](_0x4e6613[_0x2a99('0x45')],_0x4e6613[_0x2a99('0x47')]);_0x1e5f48['attributes']=_[_0x2a99('0x4a')](_0x4e6613[_0x2a99('0x45')],qs[_0x2a99('0x4b')](_0x2f7fb9[_0x2a99('0x47')][_0x2a99('0x4b')]));_0x1e5f48['attributes']=_0x1e5f48[_0x2a99('0x4c')][_0x2a99('0x4d')]?_0x1e5f48[_0x2a99('0x4c')]:_0x4e6613[_0x2a99('0x45')];if(!_0x2f7fb9['query'][_0x2a99('0x4e')](_0x2a99('0x4f'))){_0x1e5f48[_0x2a99('0x34')]=qs[_0x2a99('0x34')](_0x2f7fb9['query']['limit']);_0x1e5f48['offset']=qs[_0x2a99('0x35')](_0x2f7fb9['query'][_0x2a99('0x35')]);}_0x1e5f48[_0x2a99('0x50')]=qs['sort'](_0x2f7fb9[_0x2a99('0x47')]['sort']);_0x1e5f48[_0x2a99('0x51')]=qs[_0x2a99('0x49')](_[_0x2a99('0x52')](_0x2f7fb9['query'],_0x4e6613[_0x2a99('0x49')]),_0x587665);if(_0x2f7fb9['query']['filter']){_0x1e5f48[_0x2a99('0x51')]=_[_0x2a99('0x53')](_0x1e5f48[_0x2a99('0x51')],{'$or':_[_0x2a99('0x46')](_0x587665,function(_0xdca75c){if(_0xdca75c[_0x2a99('0x43')]!=='VIRTUAL'){var _0x265312={};_0x265312[_0xdca75c[_0x2a99('0x3d')]]={'$like':'%'+_0x2f7fb9[_0x2a99('0x47')][_0x2a99('0x54')]+'%'};return _0x265312;}})});}_0x1e5f48=_['merge']({},_0x1e5f48,_0x2f7fb9['options']);var _0x46a943={'where':_0x1e5f48[_0x2a99('0x51')]};return db[_0x2a99('0x40')][_0x2a99('0x36')](_0x46a943)[_0x2a99('0x24')](function(_0x54b5b6){_0x22c6e7[_0x2a99('0x36')]=_0x54b5b6;if(_0x2f7fb9[_0x2a99('0x47')][_0x2a99('0x55')]){_0x1e5f48[_0x2a99('0x56')]=[{'all':!![]}];}return db[_0x2a99('0x40')][_0x2a99('0x57')](_0x1e5f48);})[_0x2a99('0x24')](function(_0x2abf2b){_0x22c6e7['rows']=_0x2abf2b;return _0x22c6e7;})['then'](respondWithFilteredResult(_0x115054,_0x1e5f48))[_0x2a99('0x2e')](handleError(_0x115054,null));};exports[_0x2a99('0x58')]=function(_0x19884d,_0x3181bc){var _0x3f2f2c={'raw':!![],'where':{'id':_0x19884d[_0x2a99('0x59')]['id']}},_0x34d4da={};_0x34d4da['model']=_[_0x2a99('0x48')](db['WhatsappMessage'][_0x2a99('0x41')]);_0x34d4da[_0x2a99('0x47')]=_['keys'](_0x19884d[_0x2a99('0x47')]);_0x34d4da['filters']=_['intersection'](_0x34d4da[_0x2a99('0x45')],_0x34d4da['query']);_0x3f2f2c[_0x2a99('0x4c')]=_['intersection'](_0x34d4da[_0x2a99('0x45')],qs['fields'](_0x19884d[_0x2a99('0x47')][_0x2a99('0x4b')]));_0x3f2f2c[_0x2a99('0x4c')]=_0x3f2f2c[_0x2a99('0x4c')][_0x2a99('0x4d')]?_0x3f2f2c[_0x2a99('0x4c')]:_0x34d4da['model'];if(_0x19884d[_0x2a99('0x47')][_0x2a99('0x55')]){_0x3f2f2c['include']=[{'all':!![]}];}_0x3f2f2c=_['merge']({},_0x3f2f2c,_0x19884d['options']);return db[_0x2a99('0x40')]['find'](_0x3f2f2c)[_0x2a99('0x24')](handleEntityNotFound(_0x3181bc,null))['then'](respondWithResult(_0x3181bc,null))[_0x2a99('0x2e')](handleError(_0x3181bc,null));};exports[_0x2a99('0x5a')]=function(_0x2e6a5e,_0x2df93d){return db[_0x2a99('0x40')][_0x2a99('0x5a')](_0x2e6a5e['body'],{})['then'](respondWithResult(_0x2df93d,0xc9))[_0x2a99('0x2e')](handleError(_0x2df93d,null));};exports[_0x2a99('0x3c')]=function(_0x2a06b6,_0x12dfca){if(_0x2a06b6['body']['id']){delete _0x2a06b6[_0x2a99('0x5b')]['id'];}return db[_0x2a99('0x40')][_0x2a99('0x5c')]({'where':{'id':_0x2a06b6[_0x2a99('0x59')]['id']}})['then'](handleEntityNotFound(_0x12dfca,null))[_0x2a99('0x24')](saveUpdates(_0x2a06b6[_0x2a99('0x5b')],null))[_0x2a99('0x24')](respondWithResult(_0x12dfca,null))[_0x2a99('0x2e')](handleError(_0x12dfca,null));};exports[_0x2a99('0x5d')]=function(_0x19af19,_0x512464){return db[_0x2a99('0x40')]['find']({'where':{'id':_0x19af19[_0x2a99('0x59')]['id']}})[_0x2a99('0x24')](handleEntityNotFound(_0x512464,null))[_0x2a99('0x24')](removeEntity(_0x512464,null))['catch'](handleError(_0x512464,null));};exports[_0x2a99('0x5e')]=function(_0x8896f4,_0x1e98f9){return db['WhatsappMessage'][_0x2a99('0x5e')]()[_0x2a99('0x24')](respondWithResult(_0x1e98f9,null))['catch'](handleError(_0x1e98f9,null));};var interaction_log=require(_0x2a99('0x5f'))(_0x2a99('0x60'));exports[_0x2a99('0x61')]=function(_0x351337,_0x5ebf19,_0x37d472){var _0x540f30={'agent':{},'channel':_0x2a99('0x62')};if(_0x351337['body']['id']){delete _0x351337[_0x2a99('0x5b')]['id'];}_0x351337['body']['read']=!![];_0x351337[_0x2a99('0x5b')][_0x2a99('0x63')]=moment()['format'](_0x2a99('0x64'));_0x351337[_0x2a99('0x5b')]['UserId']=_0x351337[_0x2a99('0x5b')][_0x2a99('0x65')]||_0x351337[_0x2a99('0x66')]['id'];_0x540f30[_0x2a99('0x67')]['id']=_0x351337[_0x2a99('0x5b')]['UserId'];return db[_0x2a99('0x40')]['find']({'where':{'id':_0x351337[_0x2a99('0x59')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5ebf19,null))[_0x2a99('0x24')](saveUpdates(_0x351337[_0x2a99('0x5b')],null))[_0x2a99('0x24')](function(_0x30d69b){if(_0x30d69b){_0x540f30[_0x2a99('0x2d')]=_0x30d69b['get']({'plain':!![]});return db[_0x2a99('0x68')][_0x2a99('0x5c')]({'where':{'id':_0x30d69b[_0x2a99('0x69')]}});}return null;})[_0x2a99('0x24')](handleEntityNotFound(_0x5ebf19,null))['then'](function(_0x129d12){if(_0x129d12){return _0x129d12['update']({'UserId':_0x351337[_0x2a99('0x5b')][_0x2a99('0x65')],'read1stAt':_['isNil'](_0x129d12[_0x2a99('0x6a')])?moment()[_0x2a99('0x6b')](_0x2a99('0x64')):undefined});}return null;})[_0x2a99('0x24')](function(_0x365853){if(_0x365853){_0x540f30[_0x2a99('0x6c')]=_0x365853[_0x2a99('0x6d')]({'plain':!![]});interaction_log['info']('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x351337[_0x2a99('0x66')]['id'],_0x351337[_0x2a99('0x66')][_0x2a99('0x3d')],_0x351337[_0x2a99('0x66')][_0x2a99('0x6e')],_0x540f30['interaction']['id'],_0x351337[_0x2a99('0x5b')]?JSON[_0x2a99('0x2a')](_0x351337[_0x2a99('0x5b')]):'null');return respondWithRpcPromise(_0x2a99('0x6f'),_0x2a99('0x70'),_0x540f30);}return null;})[_0x2a99('0x24')](function(_0x3be0ba){var _0x1ffebc=_0x2a99('0x71')+_0x3be0ba[_0x2a99('0x2d')][_0x2a99('0x72')];return db['sequelize'][_0x2a99('0x47')](_0x1ffebc,{'type':db[_0x2a99('0x73')][_0x2a99('0x74')][_0x2a99('0x75')],'raw':!![]})[_0x2a99('0x24')](function(_0x3c27c0){return _0x3c27c0;});})[_0x2a99('0x24')](function(_0x5af847){if(_0x5af847){_0x540f30[_0x2a99('0x2d')][_0x2a99('0x76')]=_0x5af847[0x0];if(!_0x351337[_0x2a99('0x5b')][_0x2a99('0x65')])return;return db[_0x2a99('0x77')][_0x2a99('0x5c')]({'where':{'id':_0x351337[_0x2a99('0x5b')][_0x2a99('0x65')],'role':_0x2a99('0x67')},'attributes':['id',_0x2a99('0x3d'),'fullname',_0x2a99('0x78'),_0x2a99('0x79')],'raw':!![]});}return null;})['then'](function(_0xcd78bd){if(!_0xcd78bd)return null;_0x540f30[_0x2a99('0x2d')]['agent']=_0xcd78bd;return _0x540f30;})['then'](function(_0xa4cb22){if(_0xa4cb22){if(_0x351337[_0x2a99('0x5b')][_0x2a99('0x7a')]){_0x540f30[_0x2a99('0x2d')]['interface']=util[_0x2a99('0x6b')]('SIP/%s',_0x351337[_0x2a99('0x66')][_0x2a99('0x3d')]);_0x540f30[_0x2a99('0x2d')][_0x2a99('0x7b')]=_0x540f30[_0x2a99('0x7b')];_0x540f30[_0x2a99('0x2d')][_0x2a99('0x7c')]='accept';return respondWithRpcPromise(_0x2a99('0x7d'),_0x2a99('0x7d'),{'event':_0x2a99('0x7e'),'message':_0x540f30[_0x2a99('0x2d')]},client9002)[_0x2a99('0x24')](function(){return _0x540f30;});}return _0x540f30;}return null;})[_0x2a99('0x24')](respondWithResult(_0x5ebf19,null))[_0x2a99('0x2e')](handleError(_0x5ebf19,null));};var interaction_log=require(_0x2a99('0x5f'))(_0x2a99('0x60'));exports['reject']=function(_0x914fe0,_0x1ab779,_0x404ed7){var _0x5abd8d={'agent':{},'channel':_0x2a99('0x62')};if(_0x914fe0[_0x2a99('0x5b')]['id']){delete _0x914fe0['body']['id'];}_0x914fe0[_0x2a99('0x5b')]['UserId']=_0x914fe0[_0x2a99('0x5b')]['UserId']||_0x914fe0[_0x2a99('0x66')]['id'];_0x5abd8d[_0x2a99('0x67')]['id']=_0x914fe0[_0x2a99('0x5b')][_0x2a99('0x65')];return db['WhatsappMessage']['find']({'where':{'id':_0x914fe0[_0x2a99('0x59')]['id'],'UserId':null}})[_0x2a99('0x24')](handleEntityNotFound(_0x1ab779,null))['then'](function(_0x55bd01){if(_0x55bd01){_0x5abd8d['message']=_0x55bd01[_0x2a99('0x6d')]({'plain':!![]});return db['WhatsappInteraction'][_0x2a99('0x5c')]({'where':{'id':_0x55bd01['WhatsappInteractionId']}});}return null;})[_0x2a99('0x24')](handleEntityNotFound(_0x1ab779,null))[_0x2a99('0x24')](function(_0x1a840c){if(_0x1a840c){_0x5abd8d[_0x2a99('0x6c')]=_0x1a840c[_0x2a99('0x6d')]({'plain':!![]});interaction_log[_0x2a99('0x25')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x914fe0[_0x2a99('0x66')]['id'],_0x914fe0[_0x2a99('0x66')][_0x2a99('0x3d')],_0x914fe0[_0x2a99('0x66')][_0x2a99('0x6e')],_0x5abd8d[_0x2a99('0x6c')]['id'],_0x914fe0['body']?JSON['stringify'](_0x914fe0[_0x2a99('0x5b')]):_0x2a99('0x7f'));return respondWithRpcPromise('RejectMessage',_0x2a99('0x80'),_0x5abd8d);}return null;})[_0x2a99('0x24')](function(_0x411bab){var _0x30340f=_0x2a99('0x71')+_0x411bab[_0x2a99('0x2d')][_0x2a99('0x72')];return db[_0x2a99('0x81')][_0x2a99('0x47')](_0x30340f,{'type':db[_0x2a99('0x73')][_0x2a99('0x74')][_0x2a99('0x75')],'raw':!![]})[_0x2a99('0x24')](function(_0x48dcf9){return _0x48dcf9;});})[_0x2a99('0x24')](function(_0x24ac1a){if(_0x24ac1a){_0x5abd8d['message'][_0x2a99('0x76')]=_0x24ac1a[0x0];if(!_0x914fe0[_0x2a99('0x5b')][_0x2a99('0x65')])return;return db['User']['find']({'where':{'id':_0x914fe0[_0x2a99('0x5b')][_0x2a99('0x65')],'role':_0x2a99('0x67')},'attributes':['id',_0x2a99('0x3d'),_0x2a99('0x82'),_0x2a99('0x78'),_0x2a99('0x79')],'raw':!![]});}return null;})[_0x2a99('0x24')](function(_0x2ee5a0){if(!_0x2ee5a0)return null;_0x5abd8d[_0x2a99('0x2d')]['agent']=_0x2ee5a0;return _0x5abd8d;})['then'](function(_0x4565a7){if(_0x4565a7){_0x4565a7[_0x2a99('0x2d')][_0x2a99('0x83')]=util[_0x2a99('0x6b')](_0x2a99('0x84'),_0x914fe0[_0x2a99('0x66')]['name']);_0x4565a7['message']['channel']=_0x5abd8d[_0x2a99('0x7b')];_0x4565a7[_0x2a99('0x2d')]['event']=_0x2a99('0x3a');respondWithRpcPromise(_0x2a99('0x7d'),_0x2a99('0x7d'),{'event':_0x2a99('0x85'),'message':_0x4565a7[_0x2a99('0x2d')]},client9002);return _0x5abd8d;}return null;})[_0x2a99('0x24')](respondWithResult(_0x1ab779,null))['catch'](handleError(_0x1ab779,null));};exports['status']=function(_0x3a1dd8,_0x5b56ca,_0x35a5c5){if(_0x3a1dd8[_0x2a99('0x5b')]['id']){delete _0x3a1dd8[_0x2a99('0x5b')]['id'];}var _0x37bd6d;return db[_0x2a99('0x40')][_0x2a99('0x5c')]({'where':{'id':_0x3a1dd8[_0x2a99('0x59')]['id']}})['then'](handleEntityNotFound(_0x5b56ca,null))[_0x2a99('0x24')](function(_0x3bbf89){if(_0x3bbf89){_0x37bd6d=_0x3bbf89;return db['WhatsappAccount'][_0x2a99('0x5c')]({'where':{'id':_0x3bbf89[_0x2a99('0x86')]}});}})[_0x2a99('0x24')](handleEntityNotFound(_0x5b56ca,null))[_0x2a99('0x24')](function(_0x403f12){if(_0x403f12){logger[_0x2a99('0x27')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0x2a99('0x30'),_0x2a99('0x87'),_0x403f12[_0x2a99('0x43')],util['inspect'](_0x3a1dd8['body'],{'showHidden':![],'depth':null}));switch(_0x403f12[_0x2a99('0x43')]){case _0x2a99('0x88'):if(_0x3a1dd8[_0x2a99('0x5b')]['MessageSid']&&_0x3a1dd8[_0x2a99('0x5b')][_0x2a99('0x89')]===_0x37bd6d['messageId']&&_0x3a1dd8[_0x2a99('0x5b')][_0x2a99('0x8a')]&&_0x3a1dd8[_0x2a99('0x5b')]['MessageStatus']==='read'){return _0x37bd6d[_0x2a99('0x3c')]({'read':!![]});}else{logger[_0x2a99('0x2b')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x2a99('0x30'),_0x2a99('0x88'),util[_0x2a99('0x8b')](_0x3a1dd8[_0x2a99('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x37bd6d;}})['then'](respondWithResult(_0x5b56ca,null))['catch'](handleError(_0x5b56ca,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 8abb307..4c8493e 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 _0x6b24=['../../mysqldb','WhatsappMessage','setMaxListeners','save','emit','exports'];(function(_0x251fde,_0x384469){var _0x350af6=function(_0x15a6a3){while(--_0x15a6a3){_0x251fde['push'](_0x251fde['shift']());}};_0x350af6(++_0x384469);}(_0x6b24,0x1ce));var _0x46b2=function(_0x51b10b,_0x311567){_0x51b10b=_0x51b10b-0x0;var _0x45b2cf=_0x6b24[_0x51b10b];return _0x45b2cf;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0x46b2('0x0'))['db'][_0x46b2('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x46b2('0x2')](0x0);var events={'afterCreate':_0x46b2('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4cfef4){return function(_0x304ab5,_0x53ee5c,_0x186cda){WhatsappMessageEvents['emit'](_0x4cfef4+':'+_0x304ab5['id'],_0x304ab5);WhatsappMessageEvents[_0x46b2('0x4')](_0x4cfef4,_0x304ab5);_0x186cda(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0x46b2('0x5')]=WhatsappMessageEvents; \ No newline at end of file +var _0x0490=['hasOwnProperty','hook','../../mysqldb','remove','emit'];(function(_0x196dc5,_0x50be9d){var _0x56458e=function(_0x5bd98b){while(--_0x5bd98b){_0x196dc5['push'](_0x196dc5['shift']());}};_0x56458e(++_0x50be9d);}(_0x0490,0x147));var _0x0049=function(_0x363041,_0xf03c55){_0x363041=_0x363041-0x0;var _0x28802c=_0x0490[_0x363041];return _0x28802c;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0x0049('0x0'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x0049('0x1')};function emitEvent(_0x3b1b70){return function(_0x435d2d,_0x1f3b3c,_0x2872ec){WhatsappMessageEvents[_0x0049('0x2')](_0x3b1b70+':'+_0x435d2d['id'],_0x435d2d);WhatsappMessageEvents[_0x0049('0x2')](_0x3b1b70,_0x435d2d);_0x2872ec(null);};}for(var e in events){if(events[_0x0049('0x3')](e)){var event=events[e];WhatsappMessage[_0x0049('0x4')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index bd09038..59eb545 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 _0x5014=['createdAt','direction','error','WhatsappAccount','WhatsappAccountId','type','twilio','accountSid','authToken','create','whatsapp:','phone','remote','/api/whatsapp/messages/','token','sid','afterCreate','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','utf8mb4','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','define','WhatsappMessage','whatsapp_messages','messageId','body','FULLTEXT','models','get','toLowerCase','out','secret','UserId','findOne','then','update'];(function(_0x362de4,_0x5828b3){var _0x586087=function(_0x33624b){while(--_0x33624b){_0x362de4['push'](_0x362de4['shift']());}};_0x586087(++_0x5828b3);}(_0x5014,0x1d7));var _0x4501=function(_0x9b99da,_0x5a8535){_0x9b99da=_0x9b99da-0x0;var _0x52a08f=_0x5014[_0x9b99da];return _0x52a08f;};'use strict';var _=require('lodash');var util=require(_0x4501('0x0'));var logger=require('../../config/logger')(_0x4501('0x1'));var moment=require(_0x4501('0x2'));var BPromise=require(_0x4501('0x3'));var rp=require(_0x4501('0x4'));var fs=require('fs');var path=require(_0x4501('0x5'));var rimraf=require(_0x4501('0x6'));var config=require(_0x4501('0x7'));var attributes=require(_0x4501('0x8'));module['exports']=function(_0x25ff33,_0x4e05bf){return _0x25ff33[_0x4501('0x9')](_0x4501('0xa'),attributes,{'tableName':_0x4501('0xb'),'paranoid':![],'indexes':[{'name':_0x4501('0xc'),'fields':[_0x4501('0xc')]},{'name':'fti_whatsapp_messages','fields':[_0x4501('0xd')],'type':_0x4501('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x107d2c,_0x437d1c,_0x1d2f6f){var _0x5b191b=_0x25ff33[_0x4501('0xf')];var _0x2ece7b=_0x107d2c[_0x4501('0x10')]({'plain':!![]});if(_0x2ece7b['direction'][_0x4501('0x11')]()==='in'||_0x2ece7b['direction'][_0x4501('0x11')]()===_0x4501('0x12')&&!_0x2ece7b[_0x4501('0x13')]&&!_['isNil'](_0x2ece7b[_0x4501('0x14')])){_0x5b191b['WhatsappInteraction'][_0x4501('0x15')]({'where':{'id':_0x2ece7b['WhatsappInteractionId']}})[_0x4501('0x16')](function(_0x3f46be){if(_0x3f46be){_0x3f46be[_0x4501('0x17')]({'lastMsgAt':_0x2ece7b[_0x4501('0x18')],'lastMsgDirection':_0x2ece7b[_0x4501('0x19')][_0x4501('0x11')]()});}})['catch'](function(_0x2c990a){console[_0x4501('0x1a')](_0x2c990a);});}if(_0x2ece7b['direction']===_0x4501('0x12')&&!_0x2ece7b['secret']){var _0xf683c7;_0x5b191b[_0x4501('0x1b')]['find']({'where':{'id':_0x2ece7b[_0x4501('0x1c')]},'raw':!![]})[_0x4501('0x16')](function(_0x409f3a){_0xf683c7=_0x409f3a;if(_0xf683c7&&_0xf683c7[_0x4501('0x1d')]){switch(_0xf683c7[_0x4501('0x1d')]){case'twilio':var _0x42e116=require(_0x4501('0x1e'));if(_0xf683c7[_0x4501('0x1f')]&&_0xf683c7[_0x4501('0x20')]&&_0xf683c7['phone']){var _0x1c0010=new _0x42e116(_0xf683c7['accountSid'],_0xf683c7[_0x4501('0x20')]);_0x1c0010['messages'][_0x4501('0x21')]({'body':_0x2ece7b[_0x4501('0xd')],'to':_0x4501('0x22')+_0x2ece7b['phone'],'from':_0x4501('0x22')+_0xf683c7[_0x4501('0x23')],'statusCallback':_0xf683c7[_0x4501('0x24')]+_0x4501('0x25')+_0x2ece7b['id']+'/status?token='+_0xf683c7[_0x4501('0x26')]})['then'](function(_0x518972){if(_0x518972[_0x4501('0x27')]){return _0x107d2c[_0x4501('0x17')]({'messageId':_0x518972[_0x4501('0x27')]});}})['catch'](function(_0x11ccbb){logger[_0x4501('0x1a')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x4501('0x28'),_0x4501('0x1e'),util[_0x4501('0x29')](_0x11ccbb,{'showHidden':![],'depth':null}));});}else{logger[_0x4501('0x1a')](_0x4501('0x2a'),_0x4501('0x28'),'twilio',_0x4501('0x2b'));}break;}}})['finally'](function(){_0x1d2f6f();});}else{_0x1d2f6f();}}},'charset':_0x4501('0x2c'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x349a=['WhatsappInteractionId','then','update','createdAt','catch','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','sid','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','direction','toLowerCase','secret','isNil','UserId','WhatsappInteraction','findOne'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0x349a,0xd8));var _0xa349=function(_0x4914ad,_0x551a18){_0x4914ad=_0x4914ad-0x0;var _0x3cd61f=_0x349a[_0x4914ad];return _0x3cd61f;};'use strict';var _=require(_0xa349('0x0'));var util=require('util');var logger=require(_0xa349('0x1'))(_0xa349('0x2'));var moment=require('moment');var BPromise=require(_0xa349('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa349('0x4'));var rimraf=require(_0xa349('0x5'));var config=require(_0xa349('0x6'));var attributes=require(_0xa349('0x7'));module[_0xa349('0x8')]=function(_0x37bf46,_0x390abe){return _0x37bf46[_0xa349('0x9')](_0xa349('0xa'),attributes,{'tableName':_0xa349('0xb'),'paranoid':![],'indexes':[{'name':_0xa349('0xc'),'fields':[_0xa349('0xc')]},{'name':_0xa349('0xd'),'fields':[_0xa349('0xe')],'type':_0xa349('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2bd0c4,_0x4d2b90,_0x1bb07d){var _0x21acaf=_0x37bf46[_0xa349('0x10')];var _0x2993ff=_0x2bd0c4['get']({'plain':!![]});if(_0x2993ff[_0xa349('0x11')][_0xa349('0x12')]()==='in'||_0x2993ff[_0xa349('0x11')]['toLowerCase']()==='out'&&!_0x2993ff[_0xa349('0x13')]&&!_[_0xa349('0x14')](_0x2993ff[_0xa349('0x15')])){_0x21acaf[_0xa349('0x16')][_0xa349('0x17')]({'where':{'id':_0x2993ff[_0xa349('0x18')]}})[_0xa349('0x19')](function(_0x412c06){if(_0x412c06){_0x412c06[_0xa349('0x1a')]({'lastMsgAt':_0x2993ff[_0xa349('0x1b')],'lastMsgDirection':_0x2993ff['direction'][_0xa349('0x12')]()});}})[_0xa349('0x1c')](function(_0x597f31){console['error'](_0x597f31);});}if(_0x2993ff['direction']==='out'&&!_0x2993ff[_0xa349('0x13')]){var _0x59110f;_0x21acaf[_0xa349('0x1d')][_0xa349('0x1e')]({'where':{'id':_0x2993ff[_0xa349('0x1f')]},'raw':!![]})[_0xa349('0x19')](function(_0xdb407a){_0x59110f=_0xdb407a;if(_0x59110f&&_0x59110f['type']){switch(_0x59110f[_0xa349('0x20')]){case'twilio':var _0x56e3a1=require(_0xa349('0x21'));if(_0x59110f[_0xa349('0x22')]&&_0x59110f['authToken']&&_0x59110f['phone']){var _0x1dce36=new _0x56e3a1(_0x59110f[_0xa349('0x22')],_0x59110f[_0xa349('0x23')]);_0x1dce36[_0xa349('0x24')][_0xa349('0x25')]({'body':_0x2993ff['body'],'to':_0xa349('0x26')+_0x2993ff['phone'],'from':_0xa349('0x26')+_0x59110f['phone'],'statusCallback':_0x59110f[_0xa349('0x27')]+_0xa349('0x28')+_0x2993ff['id']+_0xa349('0x29')+_0x59110f['token']})[_0xa349('0x19')](function(_0x1e7281){if(_0x1e7281[_0xa349('0x2a')]){return _0x2bd0c4['update']({'messageId':_0x1e7281['sid']});}})[_0xa349('0x1c')](function(_0x2f368d){logger[_0xa349('0x2b')](_0xa349('0x2c'),_0xa349('0x2d'),_0xa349('0x21'),util['inspect'](_0x2f368d,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xa349('0x2c'),_0xa349('0x2d'),_0xa349('0x21'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;}}})['finally'](function(){_0x1bb07d();});}else{_0x1bb07d();}}},'charset':_0xa349('0x2e'),'collate':_0xa349('0x2f')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 582565f..f321204 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 _0x7932=['./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateWhatsappMessage','WhatsappMessage','create','body','options','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost'];(function(_0x83011b,_0x1b38af){var _0x103b40=function(_0x350ca4){while(--_0x350ca4){_0x83011b['push'](_0x83011b['shift']());}};_0x103b40(++_0x1b38af);}(_0x7932,0x113));var _0x2793=function(_0x217040,_0xc8081b){_0x217040=_0x217040-0x0;var _0x41da13=_0x7932[_0x217040];return _0x41da13;};'use strict';var _=require(_0x2793('0x0'));var util=require(_0x2793('0x1'));var moment=require(_0x2793('0x2'));var BPromise=require('bluebird');var rs=require(_0x2793('0x3'));var fs=require('fs');var Redis=require(_0x2793('0x4'));var db=require(_0x2793('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2793('0x6'))(_0x2793('0x7'));var config=require(_0x2793('0x8'));var jayson=require(_0x2793('0x9'));var client=jayson['client'][_0x2793('0xa')]({'port':0x232a});config[_0x2793('0xb')]=_['defaults'](config[_0x2793('0xb')],{'host':_0x2793('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2793('0xd'))[_0x2793('0xe')](socket);function respondWithRpcPromise(_0x1a3729,_0x58c122,_0x1c48ae){return new BPromise(function(_0x20ba61,_0x472351){return client[_0x2793('0xf')](_0x1a3729,_0x1c48ae)[_0x2793('0x10')](function(_0xe62e2f){logger[_0x2793('0x11')](_0x2793('0x12'),_0x58c122,_0x2793('0x13'));logger[_0x2793('0x14')](_0x2793('0x15'),_0x58c122,_0x2793('0x13'),JSON[_0x2793('0x16')](_0xe62e2f));if(_0xe62e2f['error']){if(_0xe62e2f[_0x2793('0x17')][_0x2793('0x18')]===0x1f4){logger['error'](_0x2793('0x12'),_0x58c122,_0xe62e2f['error'][_0x2793('0x19')]);return _0x472351(_0xe62e2f[_0x2793('0x17')][_0x2793('0x19')]);}logger[_0x2793('0x17')](_0x2793('0x12'),_0x58c122,_0xe62e2f[_0x2793('0x17')][_0x2793('0x19')]);return _0x20ba61(_0xe62e2f['error'][_0x2793('0x19')]);}else{logger[_0x2793('0x11')](_0x2793('0x12'),_0x58c122,_0x2793('0x13'));_0x20ba61(_0xe62e2f['result'][_0x2793('0x19')]);}})['catch'](function(_0x11924b){logger[_0x2793('0x17')](_0x2793('0x12'),_0x58c122,_0x11924b);_0x472351(_0x11924b);});});}exports[_0x2793('0x1a')]=function(_0x2c39ab){var _0x444b64=this;return new Promise(function(_0x263e58,_0x289b23){return db[_0x2793('0x1b')][_0x2793('0x1c')](_0x2c39ab[_0x2793('0x1d')],{'raw':_0x2c39ab['options']?_0x2c39ab[_0x2793('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x2793('0x10')](function(_0x3fc16f){logger[_0x2793('0x11')](_0x2793('0x1a'),_0x2c39ab);logger[_0x2793('0x14')](_0x2793('0x1a'),_0x2c39ab,JSON['stringify'](_0x3fc16f));_0x263e58(_0x3fc16f);})[_0x2793('0x1f')](function(_0x45e39c){logger[_0x2793('0x17')](_0x2793('0x1a'),_0x45e39c[_0x2793('0x19')],_0x2c39ab);_0x289b23(_0x444b64[_0x2793('0x17')](0x1f4,_0x45e39c[_0x2793('0x19')]));});});}; \ No newline at end of file +var _0xdfb7=['redis','localhost','./whatsappMessage.socket','request','info','WhatsappMessage,\x20%s,\x20%s,\x20%s','WhatsappMessage,\x20%s,\x20%s','error','message','result','CreateWhatsappMessage','create','options','then','debug','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x1474ba,_0x4e155e){var _0x3bbdf6=function(_0x2363f9){while(--_0x2363f9){_0x1474ba['push'](_0x1474ba['shift']());}};_0x3bbdf6(++_0x4e155e);}(_0xdfb7,0x16f));var _0x7dfb=function(_0x507d58,_0x476410){_0x507d58=_0x507d58-0x0;var _0xdf09b5=_0xdfb7[_0x507d58];return _0xdf09b5;};'use strict';var _=require(_0x7dfb('0x0'));var util=require(_0x7dfb('0x1'));var moment=require('moment');var BPromise=require(_0x7dfb('0x2'));var rs=require(_0x7dfb('0x3'));var fs=require('fs');var Redis=require(_0x7dfb('0x4'));var db=require(_0x7dfb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7dfb('0x6'))(_0x7dfb('0x7'));var config=require(_0x7dfb('0x8'));var jayson=require(_0x7dfb('0x9'));var client=jayson['client'][_0x7dfb('0xa')]({'port':0x232a});config[_0x7dfb('0xb')]=_['defaults'](config[_0x7dfb('0xb')],{'host':_0x7dfb('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7dfb('0xb')]));require(_0x7dfb('0xd'))['register'](socket);function respondWithRpcPromise(_0x36c6d7,_0x5e36cc,_0x285373){return new BPromise(function(_0x48aff5,_0x328054){return client[_0x7dfb('0xe')](_0x36c6d7,_0x285373)['then'](function(_0xfc843e){logger[_0x7dfb('0xf')]('WhatsappMessage,\x20%s,\x20%s',_0x5e36cc,'request\x20sent');logger['debug'](_0x7dfb('0x10'),_0x5e36cc,'request\x20sent',JSON['stringify'](_0xfc843e));if(_0xfc843e['error']){if(_0xfc843e['error']['code']===0x1f4){logger['error'](_0x7dfb('0x11'),_0x5e36cc,_0xfc843e[_0x7dfb('0x12')][_0x7dfb('0x13')]);return _0x328054(_0xfc843e[_0x7dfb('0x12')]['message']);}logger[_0x7dfb('0x12')](_0x7dfb('0x11'),_0x5e36cc,_0xfc843e[_0x7dfb('0x12')][_0x7dfb('0x13')]);return _0x48aff5(_0xfc843e['error'][_0x7dfb('0x13')]);}else{logger[_0x7dfb('0xf')](_0x7dfb('0x11'),_0x5e36cc,'request\x20sent');_0x48aff5(_0xfc843e[_0x7dfb('0x14')]['message']);}})['catch'](function(_0x1de0d7){logger[_0x7dfb('0x12')](_0x7dfb('0x11'),_0x5e36cc,_0x1de0d7);_0x328054(_0x1de0d7);});});}exports[_0x7dfb('0x15')]=function(_0x500064){var _0x434e1f=this;return new Promise(function(_0x18858f,_0x4e0b3b){return db['WhatsappMessage'][_0x7dfb('0x16')](_0x500064['body'],{'raw':_0x500064['options']?_0x500064[_0x7dfb('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x7dfb('0x18')](function(_0x2e4a17){logger[_0x7dfb('0xf')](_0x7dfb('0x15'),_0x500064);logger[_0x7dfb('0x19')](_0x7dfb('0x15'),_0x500064,JSON[_0x7dfb('0x1a')](_0x2e4a17));_0x18858f(_0x2e4a17);})['catch'](function(_0x17f12b){logger[_0x7dfb('0x12')](_0x7dfb('0x15'),_0x17f12b[_0x7dfb('0x13')],_0x500064);_0x4e0b3b(_0x434e1f['error'](0x1f4,_0x17f12b[_0x7dfb('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index b49770c..cc45b1e 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 _0xbb93=['length','whatsappMessage:','./whatsappMessage.events','save','remove','update','emit','removeListener','register'];(function(_0x28b9d2,_0xa19cb5){var _0x1f54e5=function(_0xf7c56b){while(--_0xf7c56b){_0x28b9d2['push'](_0x28b9d2['shift']());}};_0x1f54e5(++_0xa19cb5);}(_0xbb93,0x122));var _0x3bb9=function(_0x47a3d2,_0x50ec9b){_0x47a3d2=_0x47a3d2-0x0;var _0x2eecb4=_0xbb93[_0x47a3d2];return _0x2eecb4;};'use strict';var WhatsappMessageEvents=require(_0x3bb9('0x0'));var events=[_0x3bb9('0x1'),_0x3bb9('0x2'),_0x3bb9('0x3')];function createListener(_0x35bfdb,_0x4dddbb){return function(_0xf64a0e){_0x4dddbb[_0x3bb9('0x4')](_0x35bfdb,_0xf64a0e);};}function removeListener(_0x18a335,_0x158328){return function(){WhatsappMessageEvents[_0x3bb9('0x5')](_0x18a335,_0x158328);};}exports[_0x3bb9('0x6')]=function(_0xd10fc4){for(var _0x10aaf2=0x0,_0x14fe49=events[_0x3bb9('0x7')];_0x10aaf2<_0x14fe49;_0x10aaf2++){var _0x3cf31e=events[_0x10aaf2];var _0x17ac8e=createListener(_0x3bb9('0x8')+_0x3cf31e,_0xd10fc4);WhatsappMessageEvents['on'](_0x3cf31e,_0x17ac8e);}}; \ No newline at end of file +var _0x59bc=['length','./whatsappMessage.events','save','remove','update','removeListener','register'];(function(_0x521596,_0x4bc1b0){var _0x3acc8=function(_0x58deee){while(--_0x58deee){_0x521596['push'](_0x521596['shift']());}};_0x3acc8(++_0x4bc1b0);}(_0x59bc,0x182));var _0xc59b=function(_0x2b6062,_0x46a02c){_0x2b6062=_0x2b6062-0x0;var _0x21266b=_0x59bc[_0x2b6062];return _0x21266b;};'use strict';var WhatsappMessageEvents=require(_0xc59b('0x0'));var events=[_0xc59b('0x1'),_0xc59b('0x2'),_0xc59b('0x3')];function createListener(_0x4a3c0b,_0xf4a217){return function(_0x3220e5){_0xf4a217['emit'](_0x4a3c0b,_0x3220e5);};}function removeListener(_0x5a8489,_0x3d51dc){return function(){WhatsappMessageEvents[_0xc59b('0x4')](_0x5a8489,_0x3d51dc);};}exports[_0xc59b('0x5')]=function(_0x115749){for(var _0x4e9ccd=0x0,_0x4a336e=events[_0xc59b('0x6')];_0x4e9ccd<_0x4a336e;_0x4e9ccd++){var _0x5b1e83=events[_0x4e9ccd];var _0x3debf7=createListener('whatsappMessage:'+_0x5b1e83,_0x115749);WhatsappMessageEvents['on'](_0x5b1e83,_0x3debf7);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index d8efc27..0d791f6 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 _0x2f64=['isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','destroy','delete','removeAgents','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe'];(function(_0x451978,_0x191203){var _0x4f9533=function(_0x172ab3){while(--_0x172ab3){_0x451978['push'](_0x451978['shift']());}};_0x4f9533(++_0x191203);}(_0x2f64,0xde));var _0x42f6=function(_0x251597,_0x3ffa57){_0x251597=_0x251597-0x0;var _0x4c8d25=_0x2f64[_0x251597];return _0x4c8d25;};'use strict';var multer=require(_0x42f6('0x0'));var util=require('util');var path=require(_0x42f6('0x1'));var timeout=require(_0x42f6('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x42f6('0x3'));var auth=require(_0x42f6('0x4'));var interaction=require(_0x42f6('0x5'));var config=require(_0x42f6('0x6'));var controller=require('./whatsappQueue.controller');router[_0x42f6('0x7')]('/',auth['isAuthenticated'](),controller[_0x42f6('0x8')]);router['get'](_0x42f6('0x9'),auth[_0x42f6('0xa')](),controller[_0x42f6('0xb')]);router['get'](_0x42f6('0xc'),auth[_0x42f6('0xa')](),controller[_0x42f6('0xd')]);router[_0x42f6('0x7')](_0x42f6('0xe'),auth[_0x42f6('0xa')](),controller[_0x42f6('0xf')]);router['get'](_0x42f6('0x10'),auth[_0x42f6('0xa')](),controller[_0x42f6('0x11')]);router[_0x42f6('0x7')](_0x42f6('0x12'),auth[_0x42f6('0xa')](),controller[_0x42f6('0x13')]);router[_0x42f6('0x14')]('/',auth[_0x42f6('0xa')](),controller[_0x42f6('0x15')]);router[_0x42f6('0x14')](_0x42f6('0x10'),auth['isAuthenticated'](),controller[_0x42f6('0x16')]);router[_0x42f6('0x14')]('/:id/users',auth[_0x42f6('0xa')](),controller[_0x42f6('0x17')]);router[_0x42f6('0x18')](_0x42f6('0xc'),auth[_0x42f6('0xa')](),controller['update']);router['delete']('/:id',auth[_0x42f6('0xa')](),controller[_0x42f6('0x19')]);router[_0x42f6('0x1a')](_0x42f6('0x10'),auth[_0x42f6('0xa')](),controller['removeTeams']);router['delete'](_0x42f6('0x12'),auth[_0x42f6('0xa')](),controller[_0x42f6('0x1b')]);module[_0x42f6('0x1c')]=router; \ No newline at end of file +var _0x040e=['/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','getMembers'];(function(_0x10ba67,_0x5ea60c){var _0xd6bae9=function(_0x14361a){while(--_0x14361a){_0x10ba67['push'](_0x10ba67['shift']());}};_0xd6bae9(++_0x5ea60c);}(_0x040e,0x126));var _0xe040=function(_0x55b7ec,_0x12aa65){_0x55b7ec=_0x55b7ec-0x0;var _0x1e9df4=_0x040e[_0x55b7ec];return _0x1e9df4;};'use strict';var multer=require(_0xe040('0x0'));var util=require('util');var path=require(_0xe040('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe040('0x2')]();var fs_extra=require(_0xe040('0x3'));var auth=require(_0xe040('0x4'));var interaction=require(_0xe040('0x5'));var config=require(_0xe040('0x6'));var controller=require('./whatsappQueue.controller');router[_0xe040('0x7')]('/',auth[_0xe040('0x8')](),controller[_0xe040('0x9')]);router[_0xe040('0x7')]('/describe',auth[_0xe040('0x8')](),controller[_0xe040('0xa')]);router[_0xe040('0x7')](_0xe040('0xb'),auth[_0xe040('0x8')](),controller[_0xe040('0xc')]);router[_0xe040('0x7')]('/:id/members',auth[_0xe040('0x8')](),controller[_0xe040('0xd')]);router[_0xe040('0x7')](_0xe040('0xe'),auth[_0xe040('0x8')](),controller[_0xe040('0xf')]);router[_0xe040('0x7')](_0xe040('0x10'),auth[_0xe040('0x8')](),controller[_0xe040('0x11')]);router[_0xe040('0x12')]('/',auth[_0xe040('0x8')](),controller[_0xe040('0x13')]);router[_0xe040('0x12')]('/:id/teams',auth[_0xe040('0x8')](),controller[_0xe040('0x14')]);router[_0xe040('0x12')](_0xe040('0x10'),auth[_0xe040('0x8')](),controller[_0xe040('0x15')]);router[_0xe040('0x16')](_0xe040('0xb'),auth[_0xe040('0x8')](),controller[_0xe040('0x17')]);router[_0xe040('0x18')]('/:id',auth[_0xe040('0x8')](),controller[_0xe040('0x19')]);router[_0xe040('0x18')]('/:id/teams',auth[_0xe040('0x8')](),controller[_0xe040('0x1a')]);router[_0xe040('0x18')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0xe040('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index ea72081..5144c32 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 _0x5106=['INTEGER','ENUM','roundrobin','sequelize','STRING'];(function(_0x10b48a,_0x1a0a3f){var _0x2c4533=function(_0x5e4be6){while(--_0x5e4be6){_0x10b48a['push'](_0x10b48a['shift']());}};_0x2c4533(++_0x1a0a3f);}(_0x5106,0x116));var _0x6510=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x5106[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0x6510('0x0'));module['exports']={'name':{'type':Sequelize[_0x6510('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x6510('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6510('0x3')]('rrmemory','beepall',_0x6510('0x4'))},'description':{'type':Sequelize[_0x6510('0x1')]}}; \ No newline at end of file +var _0xd66c=['ENUM','beepall','roundrobin','sequelize','STRING','name','INTEGER'];(function(_0x10b515,_0x3143dc){var _0x191140=function(_0x56a9d8){while(--_0x56a9d8){_0x10b515['push'](_0x10b515['shift']());}};_0x191140(++_0x3143dc);}(_0xd66c,0x106));var _0xcd66=function(_0x544eca,_0xea202a){_0x544eca=_0x544eca-0x0;var _0x2408de=_0xd66c[_0x544eca];return _0x2408de;};'use strict';var Sequelize=require(_0xcd66('0x0'));module['exports']={'name':{'type':Sequelize[_0xcd66('0x1')],'unique':_0xcd66('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xcd66('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xcd66('0x4')]('rrmemory',_0xcd66('0x5'),_0xcd66('0x6'))},'description':{'type':Sequelize[_0xcd66('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 937296c..8b6274d 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 _0x1489=['clone','push','sequelize','toString','SELECT','TeamId','includes','all','compact','transaction','isEmpty','removeAgents','emit','addAgents','omit','spread','isArray','userWhatsappQueue:remove','getAgents','User','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','WhatsappQueues','UserProfileResource','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','params','keys','length','includeAll','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','error','describe','getMembers','findOne','UserWhatsappQueue','WhatsappQueueId','findAndCountAll','UserId','agent','rows','format','%s/%s','SIP','whatsappPause','createdAt','updatedAt','Team','getTeams','addTeams','ids','Agents','voicePause','interface','each','findOrCreate','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?'];(function(_0x2aa49a,_0x3c7c1f){var _0x4673f9=function(_0x23b67e){while(--_0x23b67e){_0x2aa49a['push'](_0x2aa49a['shift']());}};_0x4673f9(++_0x3c7c1f);}(_0x1489,0x12e));var _0x9148=function(_0x2d0448,_0x2829bb){_0x2d0448=_0x2d0448-0x0;var _0x16f567=_0x1489[_0x2d0448];return _0x16f567;};'use strict';var emlformat=require(_0x9148('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9148('0x1'));var jsonpatch=require(_0x9148('0x2'));var rp=require(_0x9148('0x3'));var moment=require(_0x9148('0x4'));var BPromise=require(_0x9148('0x5'));var Mustache=require(_0x9148('0x6'));var util=require(_0x9148('0x7'));var path=require(_0x9148('0x8'));var sox=require(_0x9148('0x9'));var csv=require(_0x9148('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9148('0xb'));var _=require(_0x9148('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9148('0xa'));var querystring=require(_0x9148('0xd'));var Papa=require(_0x9148('0xe'));var Redis=require('ioredis');var authService=require(_0x9148('0xf'));var qs=require(_0x9148('0x10'));var as=require(_0x9148('0x11'));var hardwareService=require(_0x9148('0x12'));var logger=require(_0x9148('0x13'))(_0x9148('0x14'));var utils=require(_0x9148('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9148('0x16'))['db'];config[_0x9148('0x17')]=_[_0x9148('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9148('0x19'))(new Redis(config[_0x9148('0x17')]));require(_0x9148('0x1a'))[_0x9148('0x1b')](socket);function respondWithStatusCode(_0xa1a498,_0x3b8d7c){_0x3b8d7c=_0x3b8d7c||0xcc;return function(_0x26cb9a){if(_0x26cb9a){return _0xa1a498[_0x9148('0x1c')](_0x3b8d7c);}return _0xa1a498[_0x9148('0x1d')](_0x3b8d7c)['end']();};}function respondWithResult(_0x268d51,_0x520634){_0x520634=_0x520634||0xc8;return function(_0x21b2d5){if(_0x21b2d5){return _0x268d51['status'](_0x520634)['json'](_0x21b2d5);}};}function respondWithFilteredResult(_0x293c44,_0x323031){return function(_0x3653b3){if(_0x3653b3){var _0x29bd24=typeof _0x323031[_0x9148('0x1e')]===_0x9148('0x1f')&&typeof _0x323031[_0x9148('0x20')]===_0x9148('0x1f');var _0x5d9ec0=_0x3653b3[_0x9148('0x21')];var _0x36c984=_0x29bd24?0x0:_0x323031[_0x9148('0x1e')];var _0x101b04=_0x29bd24?_0x3653b3[_0x9148('0x21')]:_0x323031['offset']+_0x323031['limit'];var _0xb138ed;if(_0x101b04>=_0x5d9ec0){_0x101b04=_0x5d9ec0;_0xb138ed=0xc8;}else{_0xb138ed=0xce;}_0x293c44[_0x9148('0x1d')](_0xb138ed);return _0x293c44[_0x9148('0x22')](_0x9148('0x23'),_0x36c984+'-'+_0x101b04+'/'+_0x5d9ec0)[_0x9148('0x24')](_0x3653b3);}return null;};}function patchUpdates(_0x5ac70b){return function(_0x3780a6){try{jsonpatch[_0x9148('0x25')](_0x3780a6,_0x5ac70b,!![]);}catch(_0x3de6ef){return BPromise[_0x9148('0x26')](_0x3de6ef);}return _0x3780a6[_0x9148('0x27')]();};}function saveUpdates(_0x1e585f,_0x41c3cc){return function(_0x18026e){if(_0x18026e){return _0x18026e[_0x9148('0x28')](_0x1e585f)[_0x9148('0x29')](function(_0x52ea2a){return _0x52ea2a;});}return null;};}function removeEntity(_0x4413c8,_0x441ad4){return function(_0x5e58dc){if(_0x5e58dc){return _0x5e58dc[_0x9148('0x2a')]()[_0x9148('0x29')](function(){var _0xc7a0aa=_0x5e58dc[_0x9148('0x2b')]({'plain':!![]});var _0x2b6766=_0x9148('0x2c');return db[_0x9148('0x2d')]['destroy']({'where':{'type':_0x2b6766,'resourceId':_0xc7a0aa['id']}})['then'](function(){return _0x5e58dc;});})['then'](function(){_0x4413c8[_0x9148('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x243db6,_0x323f28){return function(_0x44d0ad){if(!_0x44d0ad){_0x243db6[_0x9148('0x1c')](0x194);}return _0x44d0ad;};}function handleError(_0x105d56,_0x485331){_0x485331=_0x485331||0x1f4;return function(_0x434003){logger['error'](_0x434003['stack']);if(_0x434003[_0x9148('0x2e')]){delete _0x434003[_0x9148('0x2e')];}_0x105d56[_0x9148('0x1d')](_0x485331)[_0x9148('0x2f')](_0x434003);};}exports[_0x9148('0x30')]=function(_0x35c158,_0x19c887){var _0x55ebcc={},_0x3592eb={},_0x16b57d={'count':0x0,'rows':[]};var _0x77945=_[_0x9148('0x31')](db[_0x9148('0x32')][_0x9148('0x33')],function(_0x438a61){return{'name':_0x438a61[_0x9148('0x34')],'type':_0x438a61[_0x9148('0x35')][_0x9148('0x36')]};});_0x3592eb[_0x9148('0x37')]=_['map'](_0x77945,_0x9148('0x2e'));_0x3592eb[_0x9148('0x38')]=_['keys'](_0x35c158[_0x9148('0x38')]);_0x3592eb[_0x9148('0x39')]=_[_0x9148('0x3a')](_0x3592eb[_0x9148('0x37')],_0x3592eb[_0x9148('0x38')]);_0x55ebcc['attributes']=_[_0x9148('0x3a')](_0x3592eb[_0x9148('0x37')],qs[_0x9148('0x3b')](_0x35c158[_0x9148('0x38')][_0x9148('0x3b')]));_0x55ebcc[_0x9148('0x3c')]=_0x55ebcc['attributes']['length']?_0x55ebcc[_0x9148('0x3c')]:_0x3592eb[_0x9148('0x37')];if(!_0x35c158[_0x9148('0x38')][_0x9148('0x3d')](_0x9148('0x3e'))){_0x55ebcc[_0x9148('0x20')]=qs[_0x9148('0x20')](_0x35c158[_0x9148('0x38')]['limit']);_0x55ebcc[_0x9148('0x1e')]=qs['offset'](_0x35c158[_0x9148('0x38')][_0x9148('0x1e')]);}_0x55ebcc[_0x9148('0x3f')]=qs[_0x9148('0x40')](_0x35c158[_0x9148('0x38')][_0x9148('0x40')]);_0x55ebcc[_0x9148('0x41')]=qs[_0x9148('0x39')](_[_0x9148('0x42')](_0x35c158[_0x9148('0x38')],_0x3592eb[_0x9148('0x39')]),_0x77945);if(_0x35c158[_0x9148('0x38')]['filter']){_0x55ebcc['where']=_[_0x9148('0x43')](_0x55ebcc[_0x9148('0x41')],{'$or':_[_0x9148('0x31')](_0x77945,function(_0x1effa5){if(_0x1effa5[_0x9148('0x35')]!==_0x9148('0x44')){var _0x2ef47b={};_0x2ef47b[_0x1effa5['name']]={'$like':'%'+_0x35c158[_0x9148('0x38')][_0x9148('0x45')]+'%'};return _0x2ef47b;}})});}_0x55ebcc=_['merge']({},_0x55ebcc,_0x35c158[_0x9148('0x46')]);var _0x52eb28={'where':_0x55ebcc[_0x9148('0x41')]};return db['WhatsappQueue']['count'](_0x52eb28)[_0x9148('0x29')](function(_0xb28863){_0x16b57d[_0x9148('0x21')]=_0xb28863;if(_0x35c158[_0x9148('0x38')]['includeAll']){_0x55ebcc[_0x9148('0x47')]=[{'all':!![]}];}return db[_0x9148('0x32')][_0x9148('0x48')](_0x55ebcc);})[_0x9148('0x29')](function(_0x143c63){_0x16b57d['rows']=_0x143c63;return _0x16b57d;})[_0x9148('0x29')](respondWithFilteredResult(_0x19c887,_0x55ebcc))['catch'](handleError(_0x19c887,null));};exports['show']=function(_0x7f2cc5,_0x1aa206){var _0x6d2c3a={'raw':!![],'where':{'id':_0x7f2cc5[_0x9148('0x49')]['id']}},_0x94eaf5={};_0x94eaf5[_0x9148('0x37')]=_[_0x9148('0x4a')](db[_0x9148('0x32')][_0x9148('0x33')]);_0x94eaf5[_0x9148('0x38')]=_[_0x9148('0x4a')](_0x7f2cc5[_0x9148('0x38')]);_0x94eaf5[_0x9148('0x39')]=_['intersection'](_0x94eaf5[_0x9148('0x37')],_0x94eaf5[_0x9148('0x38')]);_0x6d2c3a[_0x9148('0x3c')]=_[_0x9148('0x3a')](_0x94eaf5[_0x9148('0x37')],qs[_0x9148('0x3b')](_0x7f2cc5[_0x9148('0x38')]['fields']));_0x6d2c3a[_0x9148('0x3c')]=_0x6d2c3a[_0x9148('0x3c')][_0x9148('0x4b')]?_0x6d2c3a['attributes']:_0x94eaf5[_0x9148('0x37')];if(_0x7f2cc5[_0x9148('0x38')][_0x9148('0x4c')]){_0x6d2c3a[_0x9148('0x47')]=[{'all':!![]}];}_0x6d2c3a=_[_0x9148('0x43')]({},_0x6d2c3a,_0x7f2cc5[_0x9148('0x46')]);return db[_0x9148('0x32')]['find'](_0x6d2c3a)[_0x9148('0x29')](handleEntityNotFound(_0x1aa206,null))[_0x9148('0x29')](respondWithResult(_0x1aa206,null))[_0x9148('0x4d')](handleError(_0x1aa206,null));};exports[_0x9148('0x4e')]=function(_0x30b994,_0x5a1543){return db[_0x9148('0x32')][_0x9148('0x4e')](_0x30b994[_0x9148('0x4f')],{})[_0x9148('0x29')](function(_0x97ed37){var _0x42106e=_0x30b994[_0x9148('0x50')][_0x9148('0x2b')]({'plain':!![]});if(!_0x42106e)throw new Error(_0x9148('0x51'));if(_0x42106e[_0x9148('0x52')]==='user'){var _0x2a3a31=_0x97ed37['get']({'plain':!![]});var _0xf15f5e=_0x9148('0x2c');return db[_0x9148('0x53')][_0x9148('0x54')]({'where':{'name':_0xf15f5e,'userProfileId':_0x42106e['userProfileId']},'raw':!![]})[_0x9148('0x29')](function(_0x23adba){if(_0x23adba&&_0x23adba[_0x9148('0x55')]===0x0){return db[_0x9148('0x2d')]['create']({'name':_0x2a3a31[_0x9148('0x2e')],'resourceId':_0x2a3a31['id'],'type':_0x23adba[_0x9148('0x2e')],'sectionId':_0x23adba['id']},{})[_0x9148('0x29')](function(){return _0x97ed37;});}else{return _0x97ed37;}})[_0x9148('0x4d')](function(_0x71c9f7){logger[_0x9148('0x56')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x71c9f7);throw _0x71c9f7;});}return _0x97ed37;})[_0x9148('0x29')](respondWithResult(_0x5a1543,0xc9))[_0x9148('0x4d')](handleError(_0x5a1543,null));};exports[_0x9148('0x28')]=function(_0x2b8be0,_0x5a08e4){if(_0x2b8be0[_0x9148('0x4f')]['id']){delete _0x2b8be0[_0x9148('0x4f')]['id'];}return db['WhatsappQueue'][_0x9148('0x54')]({'where':{'id':_0x2b8be0[_0x9148('0x49')]['id']}})[_0x9148('0x29')](handleEntityNotFound(_0x5a08e4,null))[_0x9148('0x29')](saveUpdates(_0x2b8be0[_0x9148('0x4f')],null))[_0x9148('0x29')](respondWithResult(_0x5a08e4,null))[_0x9148('0x4d')](handleError(_0x5a08e4,null));};exports[_0x9148('0x2a')]=function(_0x2ec802,_0x35e907){return db[_0x9148('0x32')][_0x9148('0x54')]({'where':{'id':_0x2ec802[_0x9148('0x49')]['id']}})['then'](handleEntityNotFound(_0x35e907,null))['then'](removeEntity(_0x35e907,null))[_0x9148('0x4d')](handleError(_0x35e907,null));};exports[_0x9148('0x57')]=function(_0x5c7f59,_0xb1e20a){return db[_0x9148('0x32')][_0x9148('0x57')]()[_0x9148('0x29')](respondWithResult(_0xb1e20a,null))[_0x9148('0x4d')](handleError(_0xb1e20a,null));};exports[_0x9148('0x58')]=function(_0x1decd5,_0x1590a5,_0x3f9689){var _0x452b21={'raw':!![],'where':{}},_0x3d1645={},_0x2cbdf6;return db[_0x9148('0x32')][_0x9148('0x59')]({'where':{'id':_0x1decd5['params']['id']}})[_0x9148('0x29')](handleEntityNotFound(_0x1590a5,null))[_0x9148('0x29')](function(_0x296f46){if(_0x296f46){_0x2cbdf6=_0x296f46['get']({'plain':!![]});_0x3d1645[_0x9148('0x37')]=_['keys'](db[_0x9148('0x5a')]['rawAttributes']);_0x3d1645[_0x9148('0x38')]=_[_0x9148('0x4a')](_0x1decd5[_0x9148('0x38')]);_0x3d1645['filters']=_[_0x9148('0x3a')](_0x3d1645[_0x9148('0x37')],_0x3d1645['query']);_0x452b21[_0x9148('0x3c')]=_['intersection'](_0x3d1645[_0x9148('0x37')],qs[_0x9148('0x3b')](_0x1decd5[_0x9148('0x38')]['fields']));_0x452b21['attributes']=_0x452b21['attributes'][_0x9148('0x4b')]?_0x452b21['attributes']:_0x3d1645[_0x9148('0x37')];if(!_0x1decd5[_0x9148('0x38')][_0x9148('0x3d')](_0x9148('0x3e'))){_0x452b21['limit']=qs[_0x9148('0x20')](_0x1decd5[_0x9148('0x38')][_0x9148('0x20')]);_0x452b21[_0x9148('0x1e')]=qs[_0x9148('0x1e')](_0x1decd5[_0x9148('0x38')][_0x9148('0x1e')]);}_0x452b21['order']=qs[_0x9148('0x40')](_0x1decd5['query'][_0x9148('0x40')]);_0x452b21[_0x9148('0x41')]=qs['filters'](_[_0x9148('0x42')](_0x1decd5[_0x9148('0x38')],_0x3d1645[_0x9148('0x39')]));_0x452b21[_0x9148('0x41')][_0x9148('0x5b')]=_0x296f46['id'];if(_0x1decd5[_0x9148('0x38')]['filter']){_0x452b21[_0x9148('0x41')]=_['merge'](_0x452b21[_0x9148('0x41')],{'$or':_[_0x9148('0x31')](_0x452b21[_0x9148('0x3c')],function(_0x30ee98){var _0x3aee0e={};_0x3aee0e[_0x30ee98]={'$like':'%'+_0x1decd5['query'][_0x9148('0x45')]+'%'};return _0x3aee0e;})});}_0x452b21=_['merge']({},_0x452b21,_0x1decd5[_0x9148('0x46')]);return db['UserWhatsappQueue']['findAll'](_0x452b21);}})[_0x9148('0x29')](function(_0x49e234){if(_0x49e234){return db['User'][_0x9148('0x5c')]({'where':{'id':_[_0x9148('0x31')](_0x49e234,_0x9148('0x5d')),'role':_0x9148('0x5e')},'attributes':['id',_0x9148('0x2e'),'whatsappPause','updatedAt','createdAt']});}})[_0x9148('0x29')](function(_0x47aa9a){if(_0x47aa9a){return{'count':_0x47aa9a[_0x9148('0x21')],'rows':_[_0x9148('0x31')](_0x47aa9a[_0x9148('0x5f')],function(_0x22e4f9){return{'membername':_0x22e4f9[_0x9148('0x2e')],'UserId':_0x22e4f9['id'],'queue_name':_0x2cbdf6[_0x9148('0x2e')],'WhatsappQueueId':_0x2cbdf6['id'],'interface':util[_0x9148('0x60')](_0x9148('0x61'),_0x9148('0x62'),_0x22e4f9[_0x9148('0x2e')]),'penalty':0x0,'paused':_0x22e4f9[_0x9148('0x63')],'createdAt':_0x22e4f9[_0x9148('0x64')],'updatedAt':_0x22e4f9[_0x9148('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9148('0x29')](respondWithFilteredResult(_0x1590a5,_0x452b21))[_0x9148('0x4d')](handleError(_0x1590a5,null));};exports['getTeams']=function(_0x120d7c,_0xa91c5c,_0x467760){var _0x525d3d={};var _0x157748={};var _0x248757;var _0x48a4ff;return db[_0x9148('0x32')][_0x9148('0x59')]({'where':{'id':_0x120d7c['params']['id']}})[_0x9148('0x29')](handleEntityNotFound(_0xa91c5c,null))[_0x9148('0x29')](function(_0x3c4f16){if(_0x3c4f16){_0x248757=_0x3c4f16;_0x157748[_0x9148('0x37')]=_[_0x9148('0x4a')](db[_0x9148('0x66')]['rawAttributes']);_0x157748[_0x9148('0x38')]=_[_0x9148('0x4a')](_0x120d7c['query']);_0x157748[_0x9148('0x39')]=_[_0x9148('0x3a')](_0x157748['model'],_0x157748[_0x9148('0x38')]);_0x525d3d[_0x9148('0x3c')]=_['intersection'](_0x157748['model'],qs['fields'](_0x120d7c[_0x9148('0x38')]['fields']));_0x525d3d['attributes']=_0x525d3d[_0x9148('0x3c')][_0x9148('0x4b')]?_0x525d3d[_0x9148('0x3c')]:_0x157748[_0x9148('0x37')];_0x525d3d[_0x9148('0x3f')]=qs['sort'](_0x120d7c['query'][_0x9148('0x40')]);_0x525d3d[_0x9148('0x41')]=qs[_0x9148('0x39')](_[_0x9148('0x42')](_0x120d7c[_0x9148('0x38')],_0x157748['filters']));if(_0x120d7c['query'][_0x9148('0x45')]){_0x525d3d[_0x9148('0x41')]=_[_0x9148('0x43')](_0x525d3d[_0x9148('0x41')],{'$or':_['map'](_0x525d3d[_0x9148('0x3c')],function(_0x132a82){var _0x3f375d={};_0x3f375d[_0x132a82]={'$like':'%'+_0x120d7c[_0x9148('0x38')][_0x9148('0x45')]+'%'};return _0x3f375d;})});}_0x525d3d=_[_0x9148('0x43')]({},_0x525d3d,_0x120d7c[_0x9148('0x46')]);return _0x248757[_0x9148('0x67')](_0x525d3d);}})[_0x9148('0x29')](function(_0x18273f){if(_0x18273f){_0x48a4ff=_0x18273f[_0x9148('0x4b')];if(!_0x120d7c[_0x9148('0x38')][_0x9148('0x3d')](_0x9148('0x3e'))){_0x525d3d['limit']=qs[_0x9148('0x20')](_0x120d7c[_0x9148('0x38')]['limit']);_0x525d3d['offset']=qs[_0x9148('0x1e')](_0x120d7c[_0x9148('0x38')][_0x9148('0x1e')]);}return _0x248757[_0x9148('0x67')](_0x525d3d);}})[_0x9148('0x29')](function(_0x35f445){if(_0x35f445){return _0x35f445?{'count':_0x48a4ff,'rows':_0x35f445}:null;}})[_0x9148('0x29')](respondWithResult(_0xa91c5c,null))[_0x9148('0x4d')](handleError(_0xa91c5c,null));};exports[_0x9148('0x68')]=function(_0x4c8280,_0x5bd624,_0x429b55){var _0x1f3b8d=_0x4c8280[_0x9148('0x4f')][_0x9148('0x69')];return db[_0x9148('0x66')]['findAll']({'where':{'id':_0x1f3b8d},'attributes':['id'],'include':[{'model':db['User'],'as':_0x9148('0x6a'),'attributes':['id',_0x9148('0x2e'),'online',_0x9148('0x6b'),_0x9148('0x6c')],'raw':!![]}]})['then'](function(_0x381def){if(_0x381def){var _0x53132c=_['flatMap'](_0x381def,function(_0x19a235){var _0x34a42d=_0x19a235[_0x9148('0x2b')]({'plain':!![]});return _0x34a42d[_0x9148('0x6a')];});return db[_0x9148('0x32')][_0x9148('0x54')]({'where':{'id':_0x4c8280[_0x9148('0x49')]['id']}})['then'](function(_0x23cb1a){return db['sequelize']['transaction'](function(_0x1d1733){return _0x23cb1a[_0x9148('0x68')](_0x1f3b8d,{'transaction':_0x1d1733})[_0x9148('0x29')](function(){return BPromise[_0x9148('0x6d')](_0x53132c,function(_0x315536){return db[_0x9148('0x5a')][_0x9148('0x6e')]({'where':{'UserId':_0x315536['id'],'WhatsappQueueId':_0x4c8280[_0x9148('0x49')]['id']},'transaction':_0x1d1733});});})[_0x9148('0x29')](function(){_0x53132c['forEach'](function(_0x1e4840){socket['emit'](_0x9148('0x6f'),{'UserId':_0x1e4840['id'],'WhatsappQueueId':_0x23cb1a['id']});});});});});}})['then'](respondWithStatusCode(_0x5bd624,null))[_0x9148('0x4d')](handleError(_0x5bd624,null));};exports[_0x9148('0x70')]=function(_0x2d5357,_0x3c9657,_0x234e37){return db[_0x9148('0x66')][_0x9148('0x48')]({'where':{'id':_0x2d5357['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x9148('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x9148('0x29')](handleEntityNotFound(_0x3c9657,null))['then'](function(_0x3e6741){var _0x3e87ee=_['map'](_0x3e6741,'id');var _0x5aa455=[];var _0x32883e=[];var _0x3006a1=squel[_0x9148('0x71')]();_0x3006a1[_0x9148('0x72')](_0x9148('0x73'))[_0x9148('0x74')](_0x9148('0x75'),'tq')[_0x9148('0x76')]('user_has_teams','ut',_0x9148('0x77'))['where'](_0x9148('0x78'),_0x2d5357['params']['id']);for(var _0x1ae50c=0x0;_0x1ae50c<_0x3e6741[_0x9148('0x4b')];_0x1ae50c+=0x1){let _0x1b5764=_0x3e6741[_0x1ae50c];for(var _0x378658=0x0;_0x378658<_0x1b5764['Agents'][_0x9148('0x4b')];_0x378658+=0x1){let _0x52f30f=_0x1b5764[_0x9148('0x6a')][_0x378658];var _0x5f5395=_0x3006a1[_0x9148('0x79')]();_0x5f5395[_0x9148('0x41')]('ut.UserId\x20=\x20?',_0x52f30f['id']);_0x32883e[_0x9148('0x7a')](db[_0x9148('0x7b')][_0x9148('0x38')](_0x5f5395[_0x9148('0x7c')](),{'type':db['sequelize']['QueryTypes'][_0x9148('0x7d')]})[_0x9148('0x29')](function(_0x4a0922){if(_0x4a0922[_0x9148('0x4b')]===0x1){return _0x52f30f['id'];}else{var _0x300e72=_['every'](_[_0x9148('0x31')](_0x4a0922,_0x9148('0x7e')),function(_0x314a86){return _[_0x9148('0x7f')](_0x3e87ee,_0x314a86);});if(_0x300e72){return _0x52f30f['id'];}}}));}}return BPromise[_0x9148('0x80')](_0x32883e)['then'](function(_0x336522){_0x5aa455=_(_0x5aa455)['union'](_0x336522)[_0x9148('0x81')]()['value']();return db[_0x9148('0x32')][_0x9148('0x54')]({'where':{'id':_0x2d5357[_0x9148('0x49')]['id']}})[_0x9148('0x29')](function(_0x1df141){return db[_0x9148('0x7b')][_0x9148('0x82')](function(_0x458933){return _0x1df141[_0x9148('0x70')](_0x2d5357[_0x9148('0x38')]['ids'],{'transaction':_0x458933})[_0x9148('0x29')](function(){if(!_[_0x9148('0x83')](_0x5aa455)){return _0x1df141[_0x9148('0x84')](_0x5aa455,{'transaction':_0x458933});}})[_0x9148('0x29')](function(){_0x5aa455['forEach'](function(_0x5f2fd8){socket[_0x9148('0x85')]('userWhatsappQueue:remove',{'UserId':_0x5f2fd8,'WhatsappQueueId':_0x1df141['id']});});});});});});})[_0x9148('0x29')](respondWithStatusCode(_0x3c9657,null))[_0x9148('0x4d')](handleError(_0x3c9657,null));};exports[_0x9148('0x86')]=function(_0x1e2e92,_0x31f8ae,_0x3a110a){return db[_0x9148('0x32')][_0x9148('0x54')]({'where':{'id':_0x1e2e92[_0x9148('0x49')]['id']}})[_0x9148('0x29')](handleEntityNotFound(_0x31f8ae,null))['then'](function(_0x3317f3){if(_0x3317f3){return _0x3317f3[_0x9148('0x86')](_0x1e2e92[_0x9148('0x4f')]['ids'],_[_0x9148('0x87')](_0x1e2e92['body'],[_0x9148('0x69'),'id'])||{})[_0x9148('0x88')](function(_0x531821){for(var _0x461876=0x0;_0x461876<_0x1e2e92[_0x9148('0x4f')][_0x9148('0x69')][_0x9148('0x4b')];_0x461876+=0x1){socket[_0x9148('0x85')]('userWhatsappQueue:save',{'UserId':Number(_0x1e2e92[_0x9148('0x4f')][_0x9148('0x69')][_0x461876]),'WhatsappQueueId':Number(_0x1e2e92[_0x9148('0x49')]['id'])});}return _0x531821;});}})['then'](respondWithResult(_0x31f8ae,null))['catch'](handleError(_0x31f8ae,null));};exports[_0x9148('0x84')]=function(_0x117b5f,_0x43532b,_0x5a6eef){return db[_0x9148('0x32')][_0x9148('0x54')]({'where':{'id':_0x117b5f[_0x9148('0x49')]['id']}})[_0x9148('0x29')](handleEntityNotFound(_0x43532b,null))[_0x9148('0x29')](function(_0x1b84e8){if(_0x1b84e8){return _0x1b84e8[_0x9148('0x84')](_0x117b5f[_0x9148('0x38')][_0x9148('0x69')])[_0x9148('0x29')](function(){if(_[_0x9148('0x89')](_0x117b5f[_0x9148('0x38')][_0x9148('0x69')])){for(var _0x3bd2e6=0x0;_0x3bd2e6<_0x117b5f[_0x9148('0x38')][_0x9148('0x69')]['length'];_0x3bd2e6+=0x1){socket[_0x9148('0x85')](_0x9148('0x8a'),{'UserId':Number(_0x117b5f[_0x9148('0x38')]['ids'][_0x3bd2e6]),'WhatsappQueueId':Number(_0x117b5f['params']['id'])});}}else{socket[_0x9148('0x85')]('userWhatsappQueue:remove',{'UserId':Number(_0x117b5f['query']['ids']),'WhatsappQueueId':Number(_0x117b5f[_0x9148('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x43532b,null))[_0x9148('0x4d')](handleError(_0x43532b,null));};exports[_0x9148('0x8b')]=function(_0x18d1db,_0x3ea5b2,_0x45208a){var _0x5c99e6={};var _0x3380da={};var _0x4a3af1;var _0x1fbe7f;return db['WhatsappQueue']['findOne']({'where':{'id':_0x18d1db['params']['id']}})[_0x9148('0x29')](handleEntityNotFound(_0x3ea5b2,null))[_0x9148('0x29')](function(_0x1cc161){if(_0x1cc161){_0x4a3af1=_0x1cc161;_0x3380da[_0x9148('0x37')]=_[_0x9148('0x4a')](db[_0x9148('0x8c')]['rawAttributes']);_0x3380da[_0x9148('0x38')]=_[_0x9148('0x4a')](_0x18d1db['query']);_0x3380da[_0x9148('0x39')]=_[_0x9148('0x3a')](_0x3380da[_0x9148('0x37')],_0x3380da[_0x9148('0x38')]);_0x5c99e6[_0x9148('0x3c')]=_[_0x9148('0x3a')](_0x3380da[_0x9148('0x37')],qs[_0x9148('0x3b')](_0x18d1db[_0x9148('0x38')][_0x9148('0x3b')]));_0x5c99e6['attributes']=_0x5c99e6[_0x9148('0x3c')]['length']?_0x5c99e6[_0x9148('0x3c')]:_0x3380da[_0x9148('0x37')];_0x5c99e6[_0x9148('0x3f')]=qs[_0x9148('0x40')](_0x18d1db['query'][_0x9148('0x40')]);_0x5c99e6[_0x9148('0x41')]=qs['filters'](_[_0x9148('0x42')](_0x18d1db['query'],_0x3380da[_0x9148('0x39')]));if(_0x18d1db[_0x9148('0x38')]['filter']){_0x5c99e6[_0x9148('0x41')]=_['merge'](_0x5c99e6[_0x9148('0x41')],{'$or':_[_0x9148('0x31')](_0x5c99e6['attributes'],function(_0x43f1a5){var _0x1691e2={};_0x1691e2[_0x43f1a5]={'$like':'%'+_0x18d1db[_0x9148('0x38')][_0x9148('0x45')]+'%'};return _0x1691e2;})});}_0x5c99e6=_['merge']({},_0x5c99e6,_0x18d1db['options']);return _0x4a3af1[_0x9148('0x8b')](_0x5c99e6);}})['then'](function(_0xcf4b7a){if(_0xcf4b7a){_0x1fbe7f=_0xcf4b7a['length'];if(!_0x18d1db[_0x9148('0x38')]['hasOwnProperty'](_0x9148('0x3e'))){_0x5c99e6[_0x9148('0x20')]=qs[_0x9148('0x20')](_0x18d1db[_0x9148('0x38')][_0x9148('0x20')]);_0x5c99e6[_0x9148('0x1e')]=qs['offset'](_0x18d1db[_0x9148('0x38')][_0x9148('0x1e')]);}return _0x4a3af1[_0x9148('0x8b')](_0x5c99e6);}})[_0x9148('0x29')](function(_0x44b106){if(_0x44b106){return _0x44b106?{'count':_0x1fbe7f,'rows':_0x44b106}:null;}})[_0x9148('0x29')](respondWithResult(_0x3ea5b2,null))[_0x9148('0x4d')](handleError(_0x3ea5b2,null));}; \ No newline at end of file +var _0xf5a4=['userWhatsappQueue:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','update','then','destroy','UserProfileResource','error','stack','index','map','WhatsappQueue','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','length','nolimit','sort','where','pick','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','rawAttributes','fields','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappQueues','userProfileId','params','describe','getMembers','findOne','UserWhatsappQueue','hasOwnProperty','WhatsappQueueId','UserId','agent','whatsappPause','updatedAt','createdAt','format','SIP','getTeams','Team','order','ids','User','Agents','online','interface','flatMap','sequelize','addTeams','findOrCreate','emit','userWhatsappQueue:save','removeTeams','select','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','transaction','isEmpty','removeAgents','forEach','addAgents','isArray'];(function(_0x36b20a,_0x26498d){var _0x523769=function(_0x3d30a1){while(--_0x3d30a1){_0x36b20a['push'](_0x36b20a['shift']());}};_0x523769(++_0x26498d);}(_0xf5a4,0x8e));var _0x4f5a=function(_0x27c482,_0x5bf1f4){_0x27c482=_0x27c482-0x0;var _0x2df31c=_0xf5a4[_0x27c482];return _0x2df31c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4f5a('0x0'));var zipdir=require(_0x4f5a('0x1'));var jsonpatch=require(_0x4f5a('0x2'));var rp=require(_0x4f5a('0x3'));var moment=require('moment');var BPromise=require(_0x4f5a('0x4'));var Mustache=require(_0x4f5a('0x5'));var util=require(_0x4f5a('0x6'));var path=require('path');var sox=require(_0x4f5a('0x7'));var csv=require(_0x4f5a('0x8'));var ejs=require(_0x4f5a('0x9'));var fs=require('fs');var fs_extra=require(_0x4f5a('0xa'));var _=require(_0x4f5a('0xb'));var squel=require(_0x4f5a('0xc'));var crypto=require('crypto');var jsforce=require(_0x4f5a('0xd'));var deskjs=require(_0x4f5a('0xe'));var toCsv=require(_0x4f5a('0x8'));var querystring=require(_0x4f5a('0xf'));var Papa=require(_0x4f5a('0x10'));var Redis=require('ioredis');var authService=require(_0x4f5a('0x11'));var qs=require(_0x4f5a('0x12'));var as=require(_0x4f5a('0x13'));var hardwareService=require(_0x4f5a('0x14'));var logger=require('../../config/logger')(_0x4f5a('0x15'));var utils=require(_0x4f5a('0x16'));var config=require(_0x4f5a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x4f5a('0x18'))['db'];config['redis']=_[_0x4f5a('0x19')](config[_0x4f5a('0x1a')],{'host':_0x4f5a('0x1b'),'port':0x18eb});var socket=require(_0x4f5a('0x1c'))(new Redis(config[_0x4f5a('0x1a')]));require(_0x4f5a('0x1d'))[_0x4f5a('0x1e')](socket);function respondWithStatusCode(_0x3d4b94,_0x478dfd){_0x478dfd=_0x478dfd||0xcc;return function(_0x145e5c){if(_0x145e5c){return _0x3d4b94[_0x4f5a('0x1f')](_0x478dfd);}return _0x3d4b94[_0x4f5a('0x20')](_0x478dfd)[_0x4f5a('0x21')]();};}function respondWithResult(_0x3ec055,_0x2c6242){_0x2c6242=_0x2c6242||0xc8;return function(_0x1a75f7){if(_0x1a75f7){return _0x3ec055[_0x4f5a('0x20')](_0x2c6242)[_0x4f5a('0x22')](_0x1a75f7);}};}function respondWithFilteredResult(_0xa228f2,_0x2ded81){return function(_0xa05303){if(_0xa05303){var _0x1b5da0=typeof _0x2ded81[_0x4f5a('0x23')]===_0x4f5a('0x24')&&typeof _0x2ded81['limit']===_0x4f5a('0x24');var _0x7904f4=_0xa05303[_0x4f5a('0x25')];var _0x6f64ae=_0x1b5da0?0x0:_0x2ded81[_0x4f5a('0x23')];var _0x47d44e=_0x1b5da0?_0xa05303['count']:_0x2ded81['offset']+_0x2ded81[_0x4f5a('0x26')];var _0x15ab12;if(_0x47d44e>=_0x7904f4){_0x47d44e=_0x7904f4;_0x15ab12=0xc8;}else{_0x15ab12=0xce;}_0xa228f2[_0x4f5a('0x20')](_0x15ab12);return _0xa228f2['set'](_0x4f5a('0x27'),_0x6f64ae+'-'+_0x47d44e+'/'+_0x7904f4)[_0x4f5a('0x22')](_0xa05303);}return null;};}function patchUpdates(_0x5c1c93){return function(_0x134e71){try{jsonpatch[_0x4f5a('0x28')](_0x134e71,_0x5c1c93,!![]);}catch(_0x29da3b){return BPromise['reject'](_0x29da3b);}return _0x134e71['save']();};}function saveUpdates(_0x47f7a9,_0x1d5b77){return function(_0x31cb9f){if(_0x31cb9f){return _0x31cb9f[_0x4f5a('0x29')](_0x47f7a9)[_0x4f5a('0x2a')](function(_0x2c2be6){return _0x2c2be6;});}return null;};}function removeEntity(_0xcc5cc3,_0x261995){return function(_0x4d96a7){if(_0x4d96a7){return _0x4d96a7[_0x4f5a('0x2b')]()[_0x4f5a('0x2a')](function(){var _0x5e9652=_0x4d96a7['get']({'plain':!![]});var _0x242109='WhatsappQueues';return db[_0x4f5a('0x2c')]['destroy']({'where':{'type':_0x242109,'resourceId':_0x5e9652['id']}})['then'](function(){return _0x4d96a7;});})[_0x4f5a('0x2a')](function(){_0xcc5cc3[_0x4f5a('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x193272,_0x4e9d95){return function(_0x2478d6){if(!_0x2478d6){_0x193272[_0x4f5a('0x1f')](0x194);}return _0x2478d6;};}function handleError(_0x43a7f6,_0x86d06){_0x86d06=_0x86d06||0x1f4;return function(_0x3e655d){logger[_0x4f5a('0x2d')](_0x3e655d[_0x4f5a('0x2e')]);if(_0x3e655d['name']){delete _0x3e655d['name'];}_0x43a7f6[_0x4f5a('0x20')](_0x86d06)['send'](_0x3e655d);};}exports[_0x4f5a('0x2f')]=function(_0x422c9f,_0x3f22e1){var _0x4a4461={},_0x337a49={},_0x470bed={'count':0x0,'rows':[]};var _0x53fa19=_[_0x4f5a('0x30')](db[_0x4f5a('0x31')]['rawAttributes'],function(_0x114a6f){return{'name':_0x114a6f[_0x4f5a('0x32')],'type':_0x114a6f[_0x4f5a('0x33')][_0x4f5a('0x34')]};});_0x337a49[_0x4f5a('0x35')]=_['map'](_0x53fa19,_0x4f5a('0x36'));_0x337a49[_0x4f5a('0x37')]=_[_0x4f5a('0x38')](_0x422c9f[_0x4f5a('0x37')]);_0x337a49[_0x4f5a('0x39')]=_[_0x4f5a('0x3a')](_0x337a49['model'],_0x337a49[_0x4f5a('0x37')]);_0x4a4461[_0x4f5a('0x3b')]=_[_0x4f5a('0x3a')](_0x337a49[_0x4f5a('0x35')],qs['fields'](_0x422c9f[_0x4f5a('0x37')]['fields']));_0x4a4461[_0x4f5a('0x3b')]=_0x4a4461[_0x4f5a('0x3b')][_0x4f5a('0x3c')]?_0x4a4461['attributes']:_0x337a49[_0x4f5a('0x35')];if(!_0x422c9f[_0x4f5a('0x37')]['hasOwnProperty'](_0x4f5a('0x3d'))){_0x4a4461['limit']=qs[_0x4f5a('0x26')](_0x422c9f[_0x4f5a('0x37')]['limit']);_0x4a4461[_0x4f5a('0x23')]=qs[_0x4f5a('0x23')](_0x422c9f[_0x4f5a('0x37')][_0x4f5a('0x23')]);}_0x4a4461['order']=qs[_0x4f5a('0x3e')](_0x422c9f[_0x4f5a('0x37')][_0x4f5a('0x3e')]);_0x4a4461[_0x4f5a('0x3f')]=qs[_0x4f5a('0x39')](_[_0x4f5a('0x40')](_0x422c9f[_0x4f5a('0x37')],_0x337a49[_0x4f5a('0x39')]),_0x53fa19);if(_0x422c9f[_0x4f5a('0x37')]['filter']){_0x4a4461[_0x4f5a('0x3f')]=_['merge'](_0x4a4461['where'],{'$or':_['map'](_0x53fa19,function(_0x474b71){if(_0x474b71[_0x4f5a('0x33')]!==_0x4f5a('0x41')){var _0x2dcb12={};_0x2dcb12[_0x474b71[_0x4f5a('0x36')]]={'$like':'%'+_0x422c9f[_0x4f5a('0x37')][_0x4f5a('0x42')]+'%'};return _0x2dcb12;}})});}_0x4a4461=_['merge']({},_0x4a4461,_0x422c9f[_0x4f5a('0x43')]);var _0x163ff7={'where':_0x4a4461['where']};return db[_0x4f5a('0x31')][_0x4f5a('0x25')](_0x163ff7)['then'](function(_0xcdf864){_0x470bed[_0x4f5a('0x25')]=_0xcdf864;if(_0x422c9f['query'][_0x4f5a('0x44')]){_0x4a4461[_0x4f5a('0x45')]=[{'all':!![]}];}return db[_0x4f5a('0x31')][_0x4f5a('0x46')](_0x4a4461);})[_0x4f5a('0x2a')](function(_0x9e2e8c){_0x470bed[_0x4f5a('0x47')]=_0x9e2e8c;return _0x470bed;})['then'](respondWithFilteredResult(_0x3f22e1,_0x4a4461))[_0x4f5a('0x48')](handleError(_0x3f22e1,null));};exports['show']=function(_0x4ec49a,_0x1f86a5){var _0x4af0f0={'raw':!![],'where':{'id':_0x4ec49a['params']['id']}},_0x19bfee={};_0x19bfee['model']=_['keys'](db[_0x4f5a('0x31')][_0x4f5a('0x49')]);_0x19bfee[_0x4f5a('0x37')]=_['keys'](_0x4ec49a[_0x4f5a('0x37')]);_0x19bfee[_0x4f5a('0x39')]=_['intersection'](_0x19bfee['model'],_0x19bfee[_0x4f5a('0x37')]);_0x4af0f0['attributes']=_[_0x4f5a('0x3a')](_0x19bfee[_0x4f5a('0x35')],qs[_0x4f5a('0x4a')](_0x4ec49a['query'][_0x4f5a('0x4a')]));_0x4af0f0['attributes']=_0x4af0f0[_0x4f5a('0x3b')][_0x4f5a('0x3c')]?_0x4af0f0[_0x4f5a('0x3b')]:_0x19bfee[_0x4f5a('0x35')];if(_0x4ec49a[_0x4f5a('0x37')][_0x4f5a('0x44')]){_0x4af0f0['include']=[{'all':!![]}];}_0x4af0f0=_[_0x4f5a('0x4b')]({},_0x4af0f0,_0x4ec49a[_0x4f5a('0x43')]);return db[_0x4f5a('0x31')][_0x4f5a('0x4c')](_0x4af0f0)[_0x4f5a('0x2a')](handleEntityNotFound(_0x1f86a5,null))[_0x4f5a('0x2a')](respondWithResult(_0x1f86a5,null))['catch'](handleError(_0x1f86a5,null));};exports['create']=function(_0xcf5f70,_0x17a32e){return db[_0x4f5a('0x31')][_0x4f5a('0x4d')](_0xcf5f70[_0x4f5a('0x4e')],{})[_0x4f5a('0x2a')](function(_0x322ffa){var _0x545693=_0xcf5f70[_0x4f5a('0x4f')]['get']({'plain':!![]});if(!_0x545693)throw new Error(_0x4f5a('0x50'));if(_0x545693[_0x4f5a('0x51')]==='user'){var _0x175eef=_0x322ffa['get']({'plain':!![]});var _0x21a661=_0x4f5a('0x52');return db['UserProfileSection'][_0x4f5a('0x4c')]({'where':{'name':_0x21a661,'userProfileId':_0x545693[_0x4f5a('0x53')]},'raw':!![]})['then'](function(_0x54608c){if(_0x54608c&&_0x54608c['autoAssociation']===0x0){return db[_0x4f5a('0x2c')][_0x4f5a('0x4d')]({'name':_0x175eef[_0x4f5a('0x36')],'resourceId':_0x175eef['id'],'type':_0x54608c[_0x4f5a('0x36')],'sectionId':_0x54608c['id']},{})['then'](function(){return _0x322ffa;});}else{return _0x322ffa;}})['catch'](function(_0x360bae){logger[_0x4f5a('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x360bae);throw _0x360bae;});}return _0x322ffa;})[_0x4f5a('0x2a')](respondWithResult(_0x17a32e,0xc9))[_0x4f5a('0x48')](handleError(_0x17a32e,null));};exports[_0x4f5a('0x29')]=function(_0xc04e59,_0x1cc0f2){if(_0xc04e59[_0x4f5a('0x4e')]['id']){delete _0xc04e59['body']['id'];}return db[_0x4f5a('0x31')][_0x4f5a('0x4c')]({'where':{'id':_0xc04e59[_0x4f5a('0x54')]['id']}})['then'](handleEntityNotFound(_0x1cc0f2,null))[_0x4f5a('0x2a')](saveUpdates(_0xc04e59[_0x4f5a('0x4e')],null))[_0x4f5a('0x2a')](respondWithResult(_0x1cc0f2,null))[_0x4f5a('0x48')](handleError(_0x1cc0f2,null));};exports[_0x4f5a('0x2b')]=function(_0x362a57,_0x62b734){return db[_0x4f5a('0x31')][_0x4f5a('0x4c')]({'where':{'id':_0x362a57[_0x4f5a('0x54')]['id']}})['then'](handleEntityNotFound(_0x62b734,null))[_0x4f5a('0x2a')](removeEntity(_0x62b734,null))[_0x4f5a('0x48')](handleError(_0x62b734,null));};exports[_0x4f5a('0x55')]=function(_0x321db9,_0x454b06){return db['WhatsappQueue'][_0x4f5a('0x55')]()[_0x4f5a('0x2a')](respondWithResult(_0x454b06,null))['catch'](handleError(_0x454b06,null));};exports[_0x4f5a('0x56')]=function(_0x3e0f5b,_0x440057,_0x1ba29){var _0x3ff702={'raw':!![],'where':{}},_0x40f25b={},_0x522486;return db[_0x4f5a('0x31')][_0x4f5a('0x57')]({'where':{'id':_0x3e0f5b[_0x4f5a('0x54')]['id']}})[_0x4f5a('0x2a')](handleEntityNotFound(_0x440057,null))[_0x4f5a('0x2a')](function(_0x43837a){if(_0x43837a){_0x522486=_0x43837a['get']({'plain':!![]});_0x40f25b[_0x4f5a('0x35')]=_['keys'](db[_0x4f5a('0x58')]['rawAttributes']);_0x40f25b[_0x4f5a('0x37')]=_[_0x4f5a('0x38')](_0x3e0f5b[_0x4f5a('0x37')]);_0x40f25b[_0x4f5a('0x39')]=_['intersection'](_0x40f25b['model'],_0x40f25b[_0x4f5a('0x37')]);_0x3ff702['attributes']=_[_0x4f5a('0x3a')](_0x40f25b[_0x4f5a('0x35')],qs[_0x4f5a('0x4a')](_0x3e0f5b[_0x4f5a('0x37')][_0x4f5a('0x4a')]));_0x3ff702[_0x4f5a('0x3b')]=_0x3ff702['attributes'][_0x4f5a('0x3c')]?_0x3ff702[_0x4f5a('0x3b')]:_0x40f25b[_0x4f5a('0x35')];if(!_0x3e0f5b[_0x4f5a('0x37')][_0x4f5a('0x59')]('nolimit')){_0x3ff702[_0x4f5a('0x26')]=qs[_0x4f5a('0x26')](_0x3e0f5b[_0x4f5a('0x37')]['limit']);_0x3ff702['offset']=qs[_0x4f5a('0x23')](_0x3e0f5b[_0x4f5a('0x37')]['offset']);}_0x3ff702['order']=qs['sort'](_0x3e0f5b['query'][_0x4f5a('0x3e')]);_0x3ff702[_0x4f5a('0x3f')]=qs[_0x4f5a('0x39')](_[_0x4f5a('0x40')](_0x3e0f5b[_0x4f5a('0x37')],_0x40f25b[_0x4f5a('0x39')]));_0x3ff702['where'][_0x4f5a('0x5a')]=_0x43837a['id'];if(_0x3e0f5b['query'][_0x4f5a('0x42')]){_0x3ff702[_0x4f5a('0x3f')]=_[_0x4f5a('0x4b')](_0x3ff702['where'],{'$or':_[_0x4f5a('0x30')](_0x3ff702[_0x4f5a('0x3b')],function(_0x34eb92){var _0x459438={};_0x459438[_0x34eb92]={'$like':'%'+_0x3e0f5b['query']['filter']+'%'};return _0x459438;})});}_0x3ff702=_[_0x4f5a('0x4b')]({},_0x3ff702,_0x3e0f5b[_0x4f5a('0x43')]);return db[_0x4f5a('0x58')]['findAll'](_0x3ff702);}})['then'](function(_0xdf50e){if(_0xdf50e){return db['User']['findAndCountAll']({'where':{'id':_[_0x4f5a('0x30')](_0xdf50e,_0x4f5a('0x5b')),'role':_0x4f5a('0x5c')},'attributes':['id',_0x4f5a('0x36'),_0x4f5a('0x5d'),_0x4f5a('0x5e'),_0x4f5a('0x5f')]});}})[_0x4f5a('0x2a')](function(_0x5cb50){if(_0x5cb50){return{'count':_0x5cb50[_0x4f5a('0x25')],'rows':_[_0x4f5a('0x30')](_0x5cb50[_0x4f5a('0x47')],function(_0x438580){return{'membername':_0x438580[_0x4f5a('0x36')],'UserId':_0x438580['id'],'queue_name':_0x522486[_0x4f5a('0x36')],'WhatsappQueueId':_0x522486['id'],'interface':util[_0x4f5a('0x60')]('%s/%s',_0x4f5a('0x61'),_0x438580['name']),'penalty':0x0,'paused':_0x438580[_0x4f5a('0x5d')],'createdAt':_0x438580[_0x4f5a('0x5f')],'updatedAt':_0x438580[_0x4f5a('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x4f5a('0x2a')](respondWithFilteredResult(_0x440057,_0x3ff702))[_0x4f5a('0x48')](handleError(_0x440057,null));};exports[_0x4f5a('0x62')]=function(_0x3dae72,_0x53f75b,_0x3451f8){var _0x108d4a={};var _0x38f82f={};var _0x498cde;var _0x26ad1e;return db[_0x4f5a('0x31')]['findOne']({'where':{'id':_0x3dae72[_0x4f5a('0x54')]['id']}})[_0x4f5a('0x2a')](handleEntityNotFound(_0x53f75b,null))[_0x4f5a('0x2a')](function(_0x13701){if(_0x13701){_0x498cde=_0x13701;_0x38f82f[_0x4f5a('0x35')]=_[_0x4f5a('0x38')](db[_0x4f5a('0x63')][_0x4f5a('0x49')]);_0x38f82f[_0x4f5a('0x37')]=_[_0x4f5a('0x38')](_0x3dae72[_0x4f5a('0x37')]);_0x38f82f[_0x4f5a('0x39')]=_[_0x4f5a('0x3a')](_0x38f82f['model'],_0x38f82f[_0x4f5a('0x37')]);_0x108d4a[_0x4f5a('0x3b')]=_['intersection'](_0x38f82f[_0x4f5a('0x35')],qs[_0x4f5a('0x4a')](_0x3dae72['query'][_0x4f5a('0x4a')]));_0x108d4a['attributes']=_0x108d4a['attributes'][_0x4f5a('0x3c')]?_0x108d4a[_0x4f5a('0x3b')]:_0x38f82f[_0x4f5a('0x35')];_0x108d4a[_0x4f5a('0x64')]=qs[_0x4f5a('0x3e')](_0x3dae72[_0x4f5a('0x37')][_0x4f5a('0x3e')]);_0x108d4a[_0x4f5a('0x3f')]=qs[_0x4f5a('0x39')](_['pick'](_0x3dae72[_0x4f5a('0x37')],_0x38f82f['filters']));if(_0x3dae72['query'][_0x4f5a('0x42')]){_0x108d4a[_0x4f5a('0x3f')]=_[_0x4f5a('0x4b')](_0x108d4a[_0x4f5a('0x3f')],{'$or':_[_0x4f5a('0x30')](_0x108d4a[_0x4f5a('0x3b')],function(_0x5acd36){var _0x1d0763={};_0x1d0763[_0x5acd36]={'$like':'%'+_0x3dae72[_0x4f5a('0x37')][_0x4f5a('0x42')]+'%'};return _0x1d0763;})});}_0x108d4a=_['merge']({},_0x108d4a,_0x3dae72['options']);return _0x498cde[_0x4f5a('0x62')](_0x108d4a);}})[_0x4f5a('0x2a')](function(_0x550078){if(_0x550078){_0x26ad1e=_0x550078[_0x4f5a('0x3c')];if(!_0x3dae72[_0x4f5a('0x37')]['hasOwnProperty'](_0x4f5a('0x3d'))){_0x108d4a[_0x4f5a('0x26')]=qs['limit'](_0x3dae72[_0x4f5a('0x37')][_0x4f5a('0x26')]);_0x108d4a[_0x4f5a('0x23')]=qs[_0x4f5a('0x23')](_0x3dae72[_0x4f5a('0x37')][_0x4f5a('0x23')]);}return _0x498cde[_0x4f5a('0x62')](_0x108d4a);}})[_0x4f5a('0x2a')](function(_0x2dd740){if(_0x2dd740){return _0x2dd740?{'count':_0x26ad1e,'rows':_0x2dd740}:null;}})['then'](respondWithResult(_0x53f75b,null))['catch'](handleError(_0x53f75b,null));};exports['addTeams']=function(_0x217ed7,_0x3d37b1,_0x2a316e){var _0x372179=_0x217ed7[_0x4f5a('0x4e')][_0x4f5a('0x65')];return db['Team']['findAll']({'where':{'id':_0x372179},'attributes':['id'],'include':[{'model':db[_0x4f5a('0x66')],'as':_0x4f5a('0x67'),'attributes':['id',_0x4f5a('0x36'),_0x4f5a('0x68'),'voicePause',_0x4f5a('0x69')],'raw':!![]}]})['then'](function(_0x5a0abe){if(_0x5a0abe){var _0x281eab=_[_0x4f5a('0x6a')](_0x5a0abe,function(_0x47c36a){var _0xe2a3c7=_0x47c36a['get']({'plain':!![]});return _0xe2a3c7[_0x4f5a('0x67')];});return db[_0x4f5a('0x31')]['find']({'where':{'id':_0x217ed7[_0x4f5a('0x54')]['id']}})['then'](function(_0x24d2bb){return db[_0x4f5a('0x6b')]['transaction'](function(_0x2e9ff4){return _0x24d2bb[_0x4f5a('0x6c')](_0x372179,{'transaction':_0x2e9ff4})[_0x4f5a('0x2a')](function(){return BPromise['each'](_0x281eab,function(_0x2f9d32){return db[_0x4f5a('0x58')][_0x4f5a('0x6d')]({'where':{'UserId':_0x2f9d32['id'],'WhatsappQueueId':_0x217ed7[_0x4f5a('0x54')]['id']},'transaction':_0x2e9ff4});});})[_0x4f5a('0x2a')](function(){_0x281eab['forEach'](function(_0x3da06d){socket[_0x4f5a('0x6e')](_0x4f5a('0x6f'),{'UserId':_0x3da06d['id'],'WhatsappQueueId':_0x24d2bb['id']});});});});});}})[_0x4f5a('0x2a')](respondWithStatusCode(_0x3d37b1,null))[_0x4f5a('0x48')](handleError(_0x3d37b1,null));};exports[_0x4f5a('0x70')]=function(_0x364ec6,_0x43c019,_0x3d1ab2){return db[_0x4f5a('0x63')][_0x4f5a('0x46')]({'where':{'id':_0x364ec6[_0x4f5a('0x37')][_0x4f5a('0x65')]},'attributes':['id'],'include':[{'model':db[_0x4f5a('0x66')],'as':_0x4f5a('0x67'),'attributes':['id'],'raw':!![]}]})[_0x4f5a('0x2a')](handleEntityNotFound(_0x43c019,null))['then'](function(_0x21a617){var _0x40ad95=_[_0x4f5a('0x30')](_0x21a617,'id');var _0x4b3325=[];var _0x2b3527=[];var _0x1d20fa=squel[_0x4f5a('0x71')]();_0x1d20fa['field'](_0x4f5a('0x72'))[_0x4f5a('0x73')](_0x4f5a('0x74'),'tq')[_0x4f5a('0x75')](_0x4f5a('0x76'),'ut',_0x4f5a('0x77'))['where'](_0x4f5a('0x78'),_0x364ec6['params']['id']);for(var _0x456916=0x0;_0x456916<_0x21a617['length'];_0x456916+=0x1){let _0x4b28ee=_0x21a617[_0x456916];for(var _0x3f4b37=0x0;_0x3f4b37<_0x4b28ee['Agents'][_0x4f5a('0x3c')];_0x3f4b37+=0x1){let _0x1000f7=_0x4b28ee[_0x4f5a('0x67')][_0x3f4b37];var _0x204115=_0x1d20fa[_0x4f5a('0x79')]();_0x204115[_0x4f5a('0x3f')]('ut.UserId\x20=\x20?',_0x1000f7['id']);_0x2b3527[_0x4f5a('0x7a')](db[_0x4f5a('0x6b')][_0x4f5a('0x37')](_0x204115[_0x4f5a('0x7b')](),{'type':db['sequelize'][_0x4f5a('0x7c')][_0x4f5a('0x7d')]})['then'](function(_0xa1663e){if(_0xa1663e[_0x4f5a('0x3c')]===0x1){return _0x1000f7['id'];}else{var _0x23b063=_[_0x4f5a('0x7e')](_[_0x4f5a('0x30')](_0xa1663e,_0x4f5a('0x7f')),function(_0x1ed169){return _[_0x4f5a('0x80')](_0x40ad95,_0x1ed169);});if(_0x23b063){return _0x1000f7['id'];}}}));}}return BPromise[_0x4f5a('0x81')](_0x2b3527)[_0x4f5a('0x2a')](function(_0x3debe5){_0x4b3325=_(_0x4b3325)['union'](_0x3debe5)[_0x4f5a('0x82')]()[_0x4f5a('0x83')]();return db[_0x4f5a('0x31')][_0x4f5a('0x4c')]({'where':{'id':_0x364ec6[_0x4f5a('0x54')]['id']}})[_0x4f5a('0x2a')](function(_0x955f04){return db[_0x4f5a('0x6b')][_0x4f5a('0x84')](function(_0x1ea4b5){return _0x955f04[_0x4f5a('0x70')](_0x364ec6[_0x4f5a('0x37')][_0x4f5a('0x65')],{'transaction':_0x1ea4b5})['then'](function(){if(!_[_0x4f5a('0x85')](_0x4b3325)){return _0x955f04[_0x4f5a('0x86')](_0x4b3325,{'transaction':_0x1ea4b5});}})[_0x4f5a('0x2a')](function(){_0x4b3325[_0x4f5a('0x87')](function(_0x366f3d){socket['emit']('userWhatsappQueue:remove',{'UserId':_0x366f3d,'WhatsappQueueId':_0x955f04['id']});});});});});});})[_0x4f5a('0x2a')](respondWithStatusCode(_0x43c019,null))[_0x4f5a('0x48')](handleError(_0x43c019,null));};exports[_0x4f5a('0x88')]=function(_0x45ca24,_0x5c1b6a,_0x22a7d9){return db['WhatsappQueue']['find']({'where':{'id':_0x45ca24[_0x4f5a('0x54')]['id']}})[_0x4f5a('0x2a')](handleEntityNotFound(_0x5c1b6a,null))['then'](function(_0x3ef24e){if(_0x3ef24e){return _0x3ef24e[_0x4f5a('0x88')](_0x45ca24[_0x4f5a('0x4e')][_0x4f5a('0x65')],_['omit'](_0x45ca24['body'],[_0x4f5a('0x65'),'id'])||{})['spread'](function(_0x54231d){for(var _0x4e162c=0x0;_0x4e162c<_0x45ca24[_0x4f5a('0x4e')][_0x4f5a('0x65')][_0x4f5a('0x3c')];_0x4e162c+=0x1){socket['emit'](_0x4f5a('0x6f'),{'UserId':Number(_0x45ca24[_0x4f5a('0x4e')][_0x4f5a('0x65')][_0x4e162c]),'WhatsappQueueId':Number(_0x45ca24[_0x4f5a('0x54')]['id'])});}return _0x54231d;});}})[_0x4f5a('0x2a')](respondWithResult(_0x5c1b6a,null))[_0x4f5a('0x48')](handleError(_0x5c1b6a,null));};exports['removeAgents']=function(_0x4d2565,_0x17b693,_0x5526fe){return db[_0x4f5a('0x31')][_0x4f5a('0x4c')]({'where':{'id':_0x4d2565[_0x4f5a('0x54')]['id']}})[_0x4f5a('0x2a')](handleEntityNotFound(_0x17b693,null))['then'](function(_0x1f9023){if(_0x1f9023){return _0x1f9023[_0x4f5a('0x86')](_0x4d2565[_0x4f5a('0x37')]['ids'])[_0x4f5a('0x2a')](function(){if(_[_0x4f5a('0x89')](_0x4d2565[_0x4f5a('0x37')][_0x4f5a('0x65')])){for(var _0x46400f=0x0;_0x46400f<_0x4d2565[_0x4f5a('0x37')][_0x4f5a('0x65')][_0x4f5a('0x3c')];_0x46400f+=0x1){socket[_0x4f5a('0x6e')](_0x4f5a('0x8a'),{'UserId':Number(_0x4d2565[_0x4f5a('0x37')][_0x4f5a('0x65')][_0x46400f]),'WhatsappQueueId':Number(_0x4d2565[_0x4f5a('0x54')]['id'])});}}else{socket[_0x4f5a('0x6e')](_0x4f5a('0x8a'),{'UserId':Number(_0x4d2565[_0x4f5a('0x37')][_0x4f5a('0x65')]),'WhatsappQueueId':Number(_0x4d2565[_0x4f5a('0x54')]['id'])});}});}})[_0x4f5a('0x2a')](respondWithStatusCode(_0x17b693,null))[_0x4f5a('0x48')](handleError(_0x17b693,null));};exports[_0x4f5a('0x8b')]=function(_0x3fc372,_0x41b724,_0xa43dc3){var _0x555db9={};var _0xfa50f2={};var _0x197493;var _0x2d0689;return db[_0x4f5a('0x31')][_0x4f5a('0x57')]({'where':{'id':_0x3fc372[_0x4f5a('0x54')]['id']}})[_0x4f5a('0x2a')](handleEntityNotFound(_0x41b724,null))['then'](function(_0x1a0b75){if(_0x1a0b75){_0x197493=_0x1a0b75;_0xfa50f2[_0x4f5a('0x35')]=_['keys'](db[_0x4f5a('0x66')][_0x4f5a('0x49')]);_0xfa50f2[_0x4f5a('0x37')]=_['keys'](_0x3fc372['query']);_0xfa50f2[_0x4f5a('0x39')]=_[_0x4f5a('0x3a')](_0xfa50f2[_0x4f5a('0x35')],_0xfa50f2[_0x4f5a('0x37')]);_0x555db9['attributes']=_[_0x4f5a('0x3a')](_0xfa50f2[_0x4f5a('0x35')],qs[_0x4f5a('0x4a')](_0x3fc372[_0x4f5a('0x37')][_0x4f5a('0x4a')]));_0x555db9[_0x4f5a('0x3b')]=_0x555db9[_0x4f5a('0x3b')][_0x4f5a('0x3c')]?_0x555db9[_0x4f5a('0x3b')]:_0xfa50f2[_0x4f5a('0x35')];_0x555db9['order']=qs[_0x4f5a('0x3e')](_0x3fc372[_0x4f5a('0x37')][_0x4f5a('0x3e')]);_0x555db9['where']=qs[_0x4f5a('0x39')](_[_0x4f5a('0x40')](_0x3fc372[_0x4f5a('0x37')],_0xfa50f2[_0x4f5a('0x39')]));if(_0x3fc372[_0x4f5a('0x37')][_0x4f5a('0x42')]){_0x555db9[_0x4f5a('0x3f')]=_[_0x4f5a('0x4b')](_0x555db9[_0x4f5a('0x3f')],{'$or':_[_0x4f5a('0x30')](_0x555db9[_0x4f5a('0x3b')],function(_0x1bacf3){var _0xf4db8e={};_0xf4db8e[_0x1bacf3]={'$like':'%'+_0x3fc372[_0x4f5a('0x37')][_0x4f5a('0x42')]+'%'};return _0xf4db8e;})});}_0x555db9=_[_0x4f5a('0x4b')]({},_0x555db9,_0x3fc372['options']);return _0x197493[_0x4f5a('0x8b')](_0x555db9);}})['then'](function(_0x2fb11d){if(_0x2fb11d){_0x2d0689=_0x2fb11d[_0x4f5a('0x3c')];if(!_0x3fc372[_0x4f5a('0x37')][_0x4f5a('0x59')](_0x4f5a('0x3d'))){_0x555db9[_0x4f5a('0x26')]=qs['limit'](_0x3fc372[_0x4f5a('0x37')][_0x4f5a('0x26')]);_0x555db9[_0x4f5a('0x23')]=qs[_0x4f5a('0x23')](_0x3fc372[_0x4f5a('0x37')][_0x4f5a('0x23')]);}return _0x197493[_0x4f5a('0x8b')](_0x555db9);}})['then'](function(_0x747e41){if(_0x747e41){return _0x747e41?{'count':_0x2d0689,'rows':_0x747e41}:null;}})[_0x4f5a('0x2a')](respondWithResult(_0x41b724,null))[_0x4f5a('0x48')](handleError(_0x41b724,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 08f44ae..b1c9544 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 _0xc381=['WhatsappQueue','update','remove','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x2bcb75,_0x5789a7){var _0x175345=function(_0x3a7d41){while(--_0x3a7d41){_0x2bcb75['push'](_0x2bcb75['shift']());}};_0x175345(++_0x5789a7);}(_0xc381,0x9e));var _0x1c38=function(_0x18ca36,_0x5bdb60){_0x18ca36=_0x18ca36-0x0;var _0x2813a8=_0xc381[_0x18ca36];return _0x2813a8;};'use strict';var EventEmitter=require(_0x1c38('0x0'));var WhatsappQueue=require(_0x1c38('0x1'))['db'][_0x1c38('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x1c38('0x3'),'afterDestroy':_0x1c38('0x4')};function emitEvent(_0x18aa05){return function(_0x3325a5,_0x5e8fc6,_0x4a45ee){WhatsappQueueEvents['emit'](_0x18aa05+':'+_0x3325a5['id'],_0x3325a5);WhatsappQueueEvents['emit'](_0x18aa05,_0x3325a5);_0x4a45ee(null);};}for(var e in events){if(events[_0x1c38('0x5')](e)){var event=events[e];WhatsappQueue[_0x1c38('0x6')](e,emitEvent(event));}}module[_0x1c38('0x7')]=WhatsappQueueEvents; \ No newline at end of file +var _0x5735=['../../mysqldb','WhatsappQueue','setMaxListeners','save','update','remove','emit','hook','events'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0x5735,0x1b8));var _0x5573=function(_0x58581e,_0x3a3aef){_0x58581e=_0x58581e-0x0;var _0x1a0645=_0x5735[_0x58581e];return _0x1a0645;};'use strict';var EventEmitter=require(_0x5573('0x0'));var WhatsappQueue=require(_0x5573('0x1'))['db'][_0x5573('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x5573('0x3')](0x0);var events={'afterCreate':_0x5573('0x4'),'afterUpdate':_0x5573('0x5'),'afterDestroy':_0x5573('0x6')};function emitEvent(_0x9f0c61){return function(_0x5ba153,_0xa3db30,_0x296285){WhatsappQueueEvents[_0x5573('0x7')](_0x9f0c61+':'+_0x5ba153['id'],_0x5ba153);WhatsappQueueEvents[_0x5573('0x7')](_0x9f0c61,_0x5ba153);_0x296285(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x5573('0x8')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 45850f8..93c2e98 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 _0xdd71=['request-promise','path','rimraf','./whatsappQueue.attributes','exports','WhatsappQueue','whatsapp_queues','util','../../config/logger','api','moment','bluebird'];(function(_0x58032c,_0x11b4c5){var _0x2cc4b4=function(_0x2b0a28){while(--_0x2b0a28){_0x58032c['push'](_0x58032c['shift']());}};_0x2cc4b4(++_0x11b4c5);}(_0xdd71,0xa3));var _0x1dd7=function(_0x79104b,_0x195577){_0x79104b=_0x79104b-0x0;var _0x55ea1e=_0xdd71[_0x79104b];return _0x55ea1e;};'use strict';var _=require('lodash');var util=require(_0x1dd7('0x0'));var logger=require(_0x1dd7('0x1'))(_0x1dd7('0x2'));var moment=require(_0x1dd7('0x3'));var BPromise=require(_0x1dd7('0x4'));var rp=require(_0x1dd7('0x5'));var fs=require('fs');var path=require(_0x1dd7('0x6'));var rimraf=require(_0x1dd7('0x7'));var config=require('../../config/environment');var attributes=require(_0x1dd7('0x8'));module[_0x1dd7('0x9')]=function(_0x27c07a,_0x1f7e94){return _0x27c07a['define'](_0x1dd7('0xa'),attributes,{'tableName':_0x1dd7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa2fc=['moment','request-promise','path','rimraf','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','api'];(function(_0x1a84b9,_0x152561){var _0x2dc075=function(_0x2d77eb){while(--_0x2d77eb){_0x1a84b9['push'](_0x1a84b9['shift']());}};_0x2dc075(++_0x152561);}(_0xa2fc,0x10d));var _0xca2f=function(_0x187718,_0x427383){_0x187718=_0x187718-0x0;var _0x29ddf4=_0xa2fc[_0x187718];return _0x29ddf4;};'use strict';var _=require(_0xca2f('0x0'));var util=require(_0xca2f('0x1'));var logger=require(_0xca2f('0x2'))(_0xca2f('0x3'));var moment=require(_0xca2f('0x4'));var BPromise=require('bluebird');var rp=require(_0xca2f('0x5'));var fs=require('fs');var path=require(_0xca2f('0x6'));var rimraf=require(_0xca2f('0x7'));var config=require('../../config/environment');var attributes=require(_0xca2f('0x8'));module[_0xca2f('0x9')]=function(_0x459888,_0x2ac1af){return _0x459888[_0xca2f('0xa')](_0xca2f('0xb'),attributes,{'tableName':_0xca2f('0xc'),'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 587b6b3..889ad43 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 _0xc964=['WhatsappQueue,\x20%s,\x20%s','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','result','catch','GetWhatsappQueue','findAll','options','where','attributes','include','model','map','ShowWhatsappQueue','WhatsappQueue','find','raw','lodash','util','../../mysqldb','rpc','../../config/environment','jayson/promise','defaults','redis','localhost','socket.io-emitter','./whatsappQueue.socket','request','then'];(function(_0x58332c,_0x39a512){var _0x359687=function(_0xf63909){while(--_0xf63909){_0x58332c['push'](_0x58332c['shift']());}};_0x359687(++_0x39a512);}(_0xc964,0xa2));var _0x4c96=function(_0x28f6f1,_0x4621a2){_0x28f6f1=_0x28f6f1-0x0;var _0x252696=_0xc964[_0x28f6f1];return _0x252696;};'use strict';var _=require(_0x4c96('0x0'));var util=require(_0x4c96('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4c96('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4c96('0x3'));var config=require(_0x4c96('0x4'));var jayson=require(_0x4c96('0x5'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x4c96('0x6')](config[_0x4c96('0x7')],{'host':_0x4c96('0x8'),'port':0x18eb});var socket=require(_0x4c96('0x9'))(new Redis(config[_0x4c96('0x7')]));require(_0x4c96('0xa'))['register'](socket);function respondWithRpcPromise(_0x1e4a0c,_0x37c876,_0x2e8a0d){return new BPromise(function(_0x39c7e3,_0x1330f7){return client[_0x4c96('0xb')](_0x1e4a0c,_0x2e8a0d)[_0x4c96('0xc')](function(_0x316532){logger['info'](_0x4c96('0xd'),_0x37c876,'request\x20sent');logger[_0x4c96('0xe')](_0x4c96('0xf'),_0x37c876,'request\x20sent',JSON['stringify'](_0x316532));if(_0x316532[_0x4c96('0x10')]){if(_0x316532['error'][_0x4c96('0x11')]===0x1f4){logger[_0x4c96('0x10')]('WhatsappQueue,\x20%s,\x20%s',_0x37c876,_0x316532[_0x4c96('0x10')]['message']);return _0x1330f7(_0x316532[_0x4c96('0x10')][_0x4c96('0x12')]);}logger[_0x4c96('0x10')](_0x4c96('0xd'),_0x37c876,_0x316532[_0x4c96('0x10')]['message']);return _0x39c7e3(_0x316532[_0x4c96('0x10')][_0x4c96('0x12')]);}else{logger[_0x4c96('0x13')](_0x4c96('0xd'),_0x37c876,_0x4c96('0x14'));_0x39c7e3(_0x316532[_0x4c96('0x15')][_0x4c96('0x12')]);}})[_0x4c96('0x16')](function(_0x3cc063){logger[_0x4c96('0x10')](_0x4c96('0xd'),_0x37c876,_0x3cc063);_0x1330f7(_0x3cc063);});});}exports[_0x4c96('0x17')]=function(_0xf47ddd){var _0x3c022f=this;return new Promise(function(_0x42d28d,_0x1af560){return db['WhatsappQueue'][_0x4c96('0x18')]({'raw':_0xf47ddd[_0x4c96('0x19')]?_0xf47ddd[_0x4c96('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0xf47ddd['options']?_0xf47ddd[_0x4c96('0x19')][_0x4c96('0x1a')]||null:null,'attributes':_0xf47ddd[_0x4c96('0x19')]?_0xf47ddd[_0x4c96('0x19')][_0x4c96('0x1b')]||null:null,'limit':_0xf47ddd['options']?_0xf47ddd['options']['limit']||null:null,'include':_0xf47ddd['options']?_0xf47ddd['options'][_0x4c96('0x1c')]?_['map'](_0xf47ddd[_0x4c96('0x19')][_0x4c96('0x1c')],function(_0x32475b){return{'model':db[_0x32475b[_0x4c96('0x1d')]],'as':_0x32475b['as'],'attributes':_0x32475b[_0x4c96('0x1b')],'include':_0x32475b[_0x4c96('0x1c')]?_['map'](_0x32475b['include'],function(_0x50e3d0){return{'model':db[_0x50e3d0[_0x4c96('0x1d')]],'as':_0x50e3d0['as'],'attributes':_0x50e3d0['attributes'],'include':_0x50e3d0[_0x4c96('0x1c')]?_[_0x4c96('0x1e')](_0x50e3d0[_0x4c96('0x1c')],function(_0x2469b6){return{'model':db[_0x2469b6[_0x4c96('0x1d')]],'as':_0x2469b6['as'],'attributes':_0x2469b6[_0x4c96('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4163bb){logger[_0x4c96('0x13')]('GetWhatsappQueue',_0xf47ddd);logger['debug'](_0x4c96('0x17'),_0xf47ddd,JSON['stringify'](_0x4163bb));_0x42d28d(_0x4163bb);})[_0x4c96('0x16')](function(_0x24760d){logger['error']('GetWhatsappQueue',_0x24760d[_0x4c96('0x12')],_0xf47ddd);_0x1af560(_0x3c022f[_0x4c96('0x10')](0x1f4,_0x24760d[_0x4c96('0x12')]));});});};exports[_0x4c96('0x1f')]=function(_0x2b3250){var _0xaa91ca=this;return new Promise(function(_0x5cf829,_0x301f30){return db[_0x4c96('0x20')][_0x4c96('0x21')]({'raw':_0x2b3250[_0x4c96('0x19')]?_0x2b3250[_0x4c96('0x19')][_0x4c96('0x22')]===undefined?!![]:![]:!![],'where':_0x2b3250[_0x4c96('0x19')]?_0x2b3250[_0x4c96('0x19')]['where']||null:null,'attributes':_0x2b3250[_0x4c96('0x19')]?_0x2b3250['options']['attributes']||null:null,'include':_0x2b3250['options']?_0x2b3250['options'][_0x4c96('0x1c')]?_[_0x4c96('0x1e')](_0x2b3250[_0x4c96('0x19')][_0x4c96('0x1c')],function(_0x2cb93e){return{'model':db[_0x2cb93e[_0x4c96('0x1d')]],'as':_0x2cb93e['as'],'attributes':_0x2cb93e[_0x4c96('0x1b')],'include':_0x2cb93e[_0x4c96('0x1c')]?_[_0x4c96('0x1e')](_0x2cb93e[_0x4c96('0x1c')],function(_0x127363){return{'model':db[_0x127363[_0x4c96('0x1d')]],'as':_0x127363['as'],'attributes':_0x127363[_0x4c96('0x1b')],'include':_0x127363[_0x4c96('0x1c')]?_['map'](_0x127363[_0x4c96('0x1c')],function(_0x324cf2){return{'model':db[_0x324cf2[_0x4c96('0x1d')]],'as':_0x324cf2['as'],'attributes':_0x324cf2[_0x4c96('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4c96('0xc')](function(_0x4c6c4a){logger[_0x4c96('0x13')]('ShowWhatsappQueue',_0x2b3250);logger[_0x4c96('0xe')](_0x4c96('0x1f'),_0x2b3250,JSON['stringify'](_0x4c6c4a));_0x5cf829(_0x4c6c4a);})[_0x4c96('0x16')](function(_0x4b053e){logger[_0x4c96('0x10')](_0x4c96('0x1f'),_0x4b053e[_0x4c96('0x12')],_0x2b3250);_0x301f30(_0xaa91ca[_0x4c96('0x10')](0x1f4,_0x4b053e[_0x4c96('0x12')]));});});}; \ No newline at end of file +var _0xd540=['where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappQueue,\x20%s,\x20%s','message','catch','WhatsappQueue','findAll','options','raw','attributes','limit','include','model','map','GetWhatsappQueue','ShowWhatsappQueue','find'];(function(_0x38a6c6,_0x4062ca){var _0x142f0a=function(_0x1531ce){while(--_0x1531ce){_0x38a6c6['push'](_0x38a6c6['shift']());}};_0x142f0a(++_0x4062ca);}(_0xd540,0x103));var _0x0d54=function(_0x57ff05,_0x96c940){_0x57ff05=_0x57ff05-0x0;var _0x1c90d6=_0xd540[_0x57ff05];return _0x1c90d6;};'use strict';var _=require(_0x0d54('0x0'));var util=require(_0x0d54('0x1'));var moment=require(_0x0d54('0x2'));var BPromise=require(_0x0d54('0x3'));var rs=require(_0x0d54('0x4'));var fs=require('fs');var Redis=require(_0x0d54('0x5'));var db=require(_0x0d54('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0d54('0x7'))(_0x0d54('0x8'));var config=require(_0x0d54('0x9'));var jayson=require(_0x0d54('0xa'));var client=jayson[_0x0d54('0xb')]['http']({'port':0x232a});config[_0x0d54('0xc')]=_[_0x0d54('0xd')](config[_0x0d54('0xc')],{'host':_0x0d54('0xe'),'port':0x18eb});var socket=require(_0x0d54('0xf'))(new Redis(config[_0x0d54('0xc')]));require(_0x0d54('0x10'))[_0x0d54('0x11')](socket);function respondWithRpcPromise(_0xd71524,_0x52bb9e,_0x3ea362){return new BPromise(function(_0x14ea62,_0x14629c){return client[_0x0d54('0x12')](_0xd71524,_0x3ea362)[_0x0d54('0x13')](function(_0x3f65de){logger[_0x0d54('0x14')]('WhatsappQueue,\x20%s,\x20%s',_0x52bb9e,_0x0d54('0x15'));logger[_0x0d54('0x16')](_0x0d54('0x17'),_0x52bb9e,'request\x20sent',JSON[_0x0d54('0x18')](_0x3f65de));if(_0x3f65de['error']){if(_0x3f65de[_0x0d54('0x19')][_0x0d54('0x1a')]===0x1f4){logger[_0x0d54('0x19')](_0x0d54('0x1b'),_0x52bb9e,_0x3f65de[_0x0d54('0x19')]['message']);return _0x14629c(_0x3f65de['error']['message']);}logger[_0x0d54('0x19')]('WhatsappQueue,\x20%s,\x20%s',_0x52bb9e,_0x3f65de['error']['message']);return _0x14ea62(_0x3f65de[_0x0d54('0x19')]['message']);}else{logger[_0x0d54('0x14')]('WhatsappQueue,\x20%s,\x20%s',_0x52bb9e,'request\x20sent');_0x14ea62(_0x3f65de['result'][_0x0d54('0x1c')]);}})[_0x0d54('0x1d')](function(_0x4c09b7){logger[_0x0d54('0x19')]('WhatsappQueue,\x20%s,\x20%s',_0x52bb9e,_0x4c09b7);_0x14629c(_0x4c09b7);});});}exports['GetWhatsappQueue']=function(_0x555aea){var _0x3edd3e=this;return new Promise(function(_0x3338b7,_0x2cae82){return db[_0x0d54('0x1e')][_0x0d54('0x1f')]({'raw':_0x555aea[_0x0d54('0x20')]?_0x555aea['options'][_0x0d54('0x21')]===undefined?!![]:![]:!![],'where':_0x555aea['options']?_0x555aea[_0x0d54('0x20')]['where']||null:null,'attributes':_0x555aea[_0x0d54('0x20')]?_0x555aea[_0x0d54('0x20')][_0x0d54('0x22')]||null:null,'limit':_0x555aea[_0x0d54('0x20')]?_0x555aea[_0x0d54('0x20')][_0x0d54('0x23')]||null:null,'include':_0x555aea[_0x0d54('0x20')]?_0x555aea['options'][_0x0d54('0x24')]?_['map'](_0x555aea['options']['include'],function(_0x204b59){return{'model':db[_0x204b59[_0x0d54('0x25')]],'as':_0x204b59['as'],'attributes':_0x204b59[_0x0d54('0x22')],'include':_0x204b59[_0x0d54('0x24')]?_[_0x0d54('0x26')](_0x204b59[_0x0d54('0x24')],function(_0x5cf189){return{'model':db[_0x5cf189[_0x0d54('0x25')]],'as':_0x5cf189['as'],'attributes':_0x5cf189[_0x0d54('0x22')],'include':_0x5cf189[_0x0d54('0x24')]?_[_0x0d54('0x26')](_0x5cf189[_0x0d54('0x24')],function(_0x836c2c){return{'model':db[_0x836c2c[_0x0d54('0x25')]],'as':_0x836c2c['as'],'attributes':_0x836c2c[_0x0d54('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0d54('0x13')](function(_0x1b1271){logger['info'](_0x0d54('0x27'),_0x555aea);logger[_0x0d54('0x16')](_0x0d54('0x27'),_0x555aea,JSON[_0x0d54('0x18')](_0x1b1271));_0x3338b7(_0x1b1271);})[_0x0d54('0x1d')](function(_0x255434){logger['error'](_0x0d54('0x27'),_0x255434[_0x0d54('0x1c')],_0x555aea);_0x2cae82(_0x3edd3e[_0x0d54('0x19')](0x1f4,_0x255434['message']));});});};exports[_0x0d54('0x28')]=function(_0x264970){var _0x4e0f2c=this;return new Promise(function(_0x436fb6,_0x422c80){return db[_0x0d54('0x1e')][_0x0d54('0x29')]({'raw':_0x264970['options']?_0x264970['options'][_0x0d54('0x21')]===undefined?!![]:![]:!![],'where':_0x264970[_0x0d54('0x20')]?_0x264970[_0x0d54('0x20')][_0x0d54('0x2a')]||null:null,'attributes':_0x264970['options']?_0x264970['options'][_0x0d54('0x22')]||null:null,'include':_0x264970[_0x0d54('0x20')]?_0x264970[_0x0d54('0x20')]['include']?_['map'](_0x264970[_0x0d54('0x20')]['include'],function(_0x14c993){return{'model':db[_0x14c993[_0x0d54('0x25')]],'as':_0x14c993['as'],'attributes':_0x14c993[_0x0d54('0x22')],'include':_0x14c993[_0x0d54('0x24')]?_[_0x0d54('0x26')](_0x14c993[_0x0d54('0x24')],function(_0x42c55e){return{'model':db[_0x42c55e['model']],'as':_0x42c55e['as'],'attributes':_0x42c55e[_0x0d54('0x22')],'include':_0x42c55e[_0x0d54('0x24')]?_[_0x0d54('0x26')](_0x42c55e[_0x0d54('0x24')],function(_0x2e3167){return{'model':db[_0x2e3167[_0x0d54('0x25')]],'as':_0x2e3167['as'],'attributes':_0x2e3167[_0x0d54('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0d54('0x13')](function(_0x46934d){logger[_0x0d54('0x14')](_0x0d54('0x28'),_0x264970);logger[_0x0d54('0x16')](_0x0d54('0x28'),_0x264970,JSON[_0x0d54('0x18')](_0x46934d));_0x436fb6(_0x46934d);})[_0x0d54('0x1d')](function(_0x579deb){logger[_0x0d54('0x19')](_0x0d54('0x28'),_0x579deb[_0x0d54('0x1c')],_0x264970);_0x422c80(_0x4e0f2c[_0x0d54('0x19')](0x1f4,_0x579deb[_0x0d54('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 0260438..0fe3fcd 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 _0x4caf=['length','whatsappQueue:','./whatsappQueue.events','remove','emit','removeListener','register'];(function(_0x303c30,_0x16edcb){var _0x43161b=function(_0x3330ff){while(--_0x3330ff){_0x303c30['push'](_0x303c30['shift']());}};_0x43161b(++_0x16edcb);}(_0x4caf,0xcd));var _0xf4ca=function(_0x5f3e9c,_0x18d2a3){_0x5f3e9c=_0x5f3e9c-0x0;var _0x15e88d=_0x4caf[_0x5f3e9c];return _0x15e88d;};'use strict';var WhatsappQueueEvents=require(_0xf4ca('0x0'));var events=['save',_0xf4ca('0x1'),'update'];function createListener(_0x2ecfdf,_0xaaa524){return function(_0x4c40ba){_0xaaa524[_0xf4ca('0x2')](_0x2ecfdf,_0x4c40ba);};}function removeListener(_0x2b7880,_0x518949){return function(){WhatsappQueueEvents[_0xf4ca('0x3')](_0x2b7880,_0x518949);};}exports[_0xf4ca('0x4')]=function(_0x22d266){for(var _0x99e9a9=0x0,_0x574ab9=events[_0xf4ca('0x5')];_0x99e9a9<_0x574ab9;_0x99e9a9++){var _0x4cb380=events[_0x99e9a9];var _0x2907c0=createListener(_0xf4ca('0x6')+_0x4cb380,_0x22d266);WhatsappQueueEvents['on'](_0x4cb380,_0x2907c0);}}; \ No newline at end of file +var _0x0cd5=['register','length','./whatsappQueue.events','save','remove','update','emit','removeListener'];(function(_0x12b83d,_0x4bcec7){var _0x1fd39d=function(_0x449185){while(--_0x449185){_0x12b83d['push'](_0x12b83d['shift']());}};_0x1fd39d(++_0x4bcec7);}(_0x0cd5,0x192));var _0x50cd=function(_0x3400ca,_0x27c04d){_0x3400ca=_0x3400ca-0x0;var _0x26e8d1=_0x0cd5[_0x3400ca];return _0x26e8d1;};'use strict';var WhatsappQueueEvents=require(_0x50cd('0x0'));var events=[_0x50cd('0x1'),_0x50cd('0x2'),_0x50cd('0x3')];function createListener(_0x36cb9e,_0x506499){return function(_0x43e3b1){_0x506499[_0x50cd('0x4')](_0x36cb9e,_0x43e3b1);};}function removeListener(_0x524718,_0x40f588){return function(){WhatsappQueueEvents[_0x50cd('0x5')](_0x524718,_0x40f588);};}exports[_0x50cd('0x6')]=function(_0x6516fa){for(var _0x3840c5=0x0,_0x536f56=events[_0x50cd('0x7')];_0x3840c5<_0x536f56;_0x3840c5++){var _0x4e4111=events[_0x3840c5];var _0x2e9e78=createListener('whatsappQueue:'+_0x4e4111,_0x6516fa);WhatsappQueueEvents['on'](_0x4e4111,_0x2e9e78);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index a468095..02ebca4 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 _0x245a=['describe','/:id','show','create','put','exports','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe'];(function(_0x5a91a5,_0x1eb099){var _0x8f99de=function(_0x579b28){while(--_0x579b28){_0x5a91a5['push'](_0x5a91a5['shift']());}};_0x8f99de(++_0x1eb099);}(_0x245a,0x1f3));var _0xa245=function(_0x24408b,_0x559626){_0x24408b=_0x24408b-0x0;var _0x6b7cae=_0x245a[_0x24408b];return _0x6b7cae;};'use strict';var multer=require('multer');var util=require(_0xa245('0x0'));var path=require(_0xa245('0x1'));var timeout=require(_0xa245('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa245('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa245('0x4'));var config=require(_0xa245('0x5'));var controller=require(_0xa245('0x6'));router[_0xa245('0x7')]('/',auth[_0xa245('0x8')](),controller[_0xa245('0x9')]);router[_0xa245('0x7')](_0xa245('0xa'),auth[_0xa245('0x8')](),controller[_0xa245('0xb')]);router[_0xa245('0x7')](_0xa245('0xc'),auth[_0xa245('0x8')](),controller[_0xa245('0xd')]);router['post']('/',auth[_0xa245('0x8')](),controller[_0xa245('0xe')]);router[_0xa245('0xf')](_0xa245('0xc'),auth[_0xa245('0x8')](),controller['update']);router['delete'](_0xa245('0xc'),auth[_0xa245('0x8')](),controller['destroy']);module[_0xa245('0x10')]=router; \ No newline at end of file +var _0x2b90=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x3d6e46,_0x110e62){var _0x209356=function(_0x19a715){while(--_0x19a715){_0x3d6e46['push'](_0x3d6e46['shift']());}};_0x209356(++_0x110e62);}(_0x2b90,0x14a));var _0x02b9=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x2b90[_0x1d9aa0];return _0x226868;};'use strict';var multer=require(_0x02b9('0x0'));var util=require(_0x02b9('0x1'));var path=require(_0x02b9('0x2'));var timeout=require(_0x02b9('0x3'));var express=require(_0x02b9('0x4'));var router=express[_0x02b9('0x5')]();var fs_extra=require(_0x02b9('0x6'));var auth=require(_0x02b9('0x7'));var interaction=require(_0x02b9('0x8'));var config=require(_0x02b9('0x9'));var controller=require('./whatsappQueueReport.controller');router[_0x02b9('0xa')]('/',auth[_0x02b9('0xb')](),controller['index']);router[_0x02b9('0xa')](_0x02b9('0xc'),auth[_0x02b9('0xb')](),controller['describe']);router[_0x02b9('0xa')](_0x02b9('0xd'),auth[_0x02b9('0xb')](),controller[_0x02b9('0xe')]);router[_0x02b9('0xf')]('/',auth[_0x02b9('0xb')](),controller['create']);router[_0x02b9('0x10')](_0x02b9('0xd'),auth[_0x02b9('0xb')](),controller[_0x02b9('0x11')]);router[_0x02b9('0x12')](_0x02b9('0xd'),auth[_0x02b9('0xb')](),controller[_0x02b9('0x13')]);module[_0x02b9('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index f6d5819..762d99f 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 _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x541aa1,_0x4d87ca){var _0x1a4b26=function(_0x512605){while(--_0x512605){_0x541aa1['push'](_0x541aa1['shift']());}};_0x1a4b26(++_0x4d87ca);}(_0x7a54,0x106));var _0x47a5=function(_0x471842,_0x59bf11){_0x471842=_0x471842-0x0;var _0xc94da1=_0x7a54[_0x471842];return _0xc94da1;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x5d076b,_0x3ae24b){var _0xe76951=function(_0x3178f0){while(--_0x3178f0){_0x5d076b['push'](_0x5d076b['shift']());}};_0xe76951(++_0x3ae24b);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 27c8b67..974b6c2 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 _0x757a=['include','findAll','rows','show','params','WhatsappQueueReport','find','create','body','catch','destroy','describe','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','status','json','offset','undefined','count','limit','Content-Range','apply','update','then','end','sendStatus','error','stack','name','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll'];(function(_0x57a35d,_0x471ba4){var _0x5c31b1=function(_0x31231a){while(--_0x31231a){_0x57a35d['push'](_0x57a35d['shift']());}};_0x5c31b1(++_0x471ba4);}(_0x757a,0xde));var _0xa757=function(_0x445f97,_0x29e113){_0x445f97=_0x445f97-0x0;var _0xd9976e=_0x757a[_0x445f97];return _0xd9976e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa757('0x0'));var zipdir=require(_0xa757('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa757('0x2'));var Mustache=require(_0xa757('0x3'));var util=require(_0xa757('0x4'));var path=require(_0xa757('0x5'));var sox=require(_0xa757('0x6'));var csv=require(_0xa757('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa757('0x8'));var _=require(_0xa757('0x9'));var squel=require('squel');var crypto=require(_0xa757('0xa'));var jsforce=require(_0xa757('0xb'));var deskjs=require(_0xa757('0xc'));var toCsv=require(_0xa757('0x7'));var querystring=require(_0xa757('0xd'));var Papa=require('papaparse');var Redis=require(_0xa757('0xe'));var authService=require(_0xa757('0xf'));var qs=require(_0xa757('0x10'));var as=require(_0xa757('0x11'));var hardwareService=require(_0xa757('0x12'));var logger=require(_0xa757('0x13'))(_0xa757('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4db68e,_0x421040){_0x421040=_0x421040||0xcc;return function(_0x544b45){if(_0x544b45){return _0x4db68e['sendStatus'](_0x421040);}return _0x4db68e[_0xa757('0x15')](_0x421040)['end']();};}function respondWithResult(_0x481508,_0x32112b){_0x32112b=_0x32112b||0xc8;return function(_0x1b670e){if(_0x1b670e){return _0x481508[_0xa757('0x15')](_0x32112b)[_0xa757('0x16')](_0x1b670e);}};}function respondWithFilteredResult(_0x86abd,_0x31cfd2){return function(_0xf12b68){if(_0xf12b68){var _0x2f7947=typeof _0x31cfd2[_0xa757('0x17')]===_0xa757('0x18')&&typeof _0x31cfd2['limit']===_0xa757('0x18');var _0x44eab8=_0xf12b68[_0xa757('0x19')];var _0x4d9f58=_0x2f7947?0x0:_0x31cfd2['offset'];var _0x151c04=_0x2f7947?_0xf12b68[_0xa757('0x19')]:_0x31cfd2[_0xa757('0x17')]+_0x31cfd2[_0xa757('0x1a')];var _0x27f4ba;if(_0x151c04>=_0x44eab8){_0x151c04=_0x44eab8;_0x27f4ba=0xc8;}else{_0x27f4ba=0xce;}_0x86abd[_0xa757('0x15')](_0x27f4ba);return _0x86abd['set'](_0xa757('0x1b'),_0x4d9f58+'-'+_0x151c04+'/'+_0x44eab8)['json'](_0xf12b68);}return null;};}function patchUpdates(_0x32c2a1){return function(_0x167640){try{jsonpatch[_0xa757('0x1c')](_0x167640,_0x32c2a1,!![]);}catch(_0x2c9ec6){return BPromise['reject'](_0x2c9ec6);}return _0x167640['save']();};}function saveUpdates(_0x40ec48,_0x2159cf){return function(_0x2ba923){if(_0x2ba923){return _0x2ba923[_0xa757('0x1d')](_0x40ec48)[_0xa757('0x1e')](function(_0x40562f){return _0x40562f;});}return null;};}function removeEntity(_0x2ca10d,_0x21f1af){return function(_0x2bf276){if(_0x2bf276){return _0x2bf276['destroy']()[_0xa757('0x1e')](function(){_0x2ca10d['status'](0xcc)[_0xa757('0x1f')]();});}};}function handleEntityNotFound(_0x47903b,_0x40551d){return function(_0x3859ce){if(!_0x3859ce){_0x47903b[_0xa757('0x20')](0x194);}return _0x3859ce;};}function handleError(_0x4d58a4,_0x2b19d5){_0x2b19d5=_0x2b19d5||0x1f4;return function(_0xcd98bd){logger[_0xa757('0x21')](_0xcd98bd[_0xa757('0x22')]);if(_0xcd98bd['name']){delete _0xcd98bd[_0xa757('0x23')];}_0x4d58a4['status'](_0x2b19d5)['send'](_0xcd98bd);};}exports['index']=function(_0x4f8de2,_0xfdf69d){var _0x596ae2={},_0x2208f9={},_0x3bc24c={'count':0x0,'rows':[]};var _0x55c5f8=_[_0xa757('0x24')](db['WhatsappQueueReport'][_0xa757('0x25')],function(_0xa6d0f6){return{'name':_0xa6d0f6['fieldName'],'type':_0xa6d0f6[_0xa757('0x26')]['key']};});_0x2208f9[_0xa757('0x27')]=_[_0xa757('0x24')](_0x55c5f8,_0xa757('0x23'));_0x2208f9[_0xa757('0x28')]=_[_0xa757('0x29')](_0x4f8de2[_0xa757('0x28')]);_0x2208f9[_0xa757('0x2a')]=_[_0xa757('0x2b')](_0x2208f9[_0xa757('0x27')],_0x2208f9[_0xa757('0x28')]);_0x596ae2[_0xa757('0x2c')]=_[_0xa757('0x2b')](_0x2208f9[_0xa757('0x27')],qs[_0xa757('0x2d')](_0x4f8de2[_0xa757('0x28')][_0xa757('0x2d')]));_0x596ae2[_0xa757('0x2c')]=_0x596ae2[_0xa757('0x2c')][_0xa757('0x2e')]?_0x596ae2[_0xa757('0x2c')]:_0x2208f9[_0xa757('0x27')];if(!_0x4f8de2[_0xa757('0x28')][_0xa757('0x2f')](_0xa757('0x30'))){_0x596ae2['limit']=qs[_0xa757('0x1a')](_0x4f8de2[_0xa757('0x28')][_0xa757('0x1a')]);_0x596ae2[_0xa757('0x17')]=qs[_0xa757('0x17')](_0x4f8de2['query'][_0xa757('0x17')]);}_0x596ae2[_0xa757('0x31')]=qs[_0xa757('0x32')](_0x4f8de2[_0xa757('0x28')][_0xa757('0x32')]);_0x596ae2[_0xa757('0x33')]=qs['filters'](_[_0xa757('0x34')](_0x4f8de2[_0xa757('0x28')],_0x2208f9[_0xa757('0x2a')]),_0x55c5f8);if(_0x4f8de2[_0xa757('0x28')][_0xa757('0x35')]){_0x596ae2[_0xa757('0x33')]=_[_0xa757('0x36')](_0x596ae2[_0xa757('0x33')],{'$or':_[_0xa757('0x24')](_0x55c5f8,function(_0x4f9d98){if(_0x4f9d98[_0xa757('0x26')]!==_0xa757('0x37')){var _0x9f73c6={};_0x9f73c6[_0x4f9d98[_0xa757('0x23')]]={'$like':'%'+_0x4f8de2[_0xa757('0x28')][_0xa757('0x35')]+'%'};return _0x9f73c6;}})});}_0x596ae2=_['merge']({},_0x596ae2,_0x4f8de2[_0xa757('0x38')]);var _0x6d77ed={'where':_0x596ae2['where']};return db['WhatsappQueueReport'][_0xa757('0x19')](_0x6d77ed)[_0xa757('0x1e')](function(_0x5b11fe){_0x3bc24c['count']=_0x5b11fe;if(_0x4f8de2[_0xa757('0x28')][_0xa757('0x39')]){_0x596ae2[_0xa757('0x3a')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0xa757('0x3b')](_0x596ae2);})[_0xa757('0x1e')](function(_0x26802c){_0x3bc24c[_0xa757('0x3c')]=_0x26802c;return _0x3bc24c;})[_0xa757('0x1e')](respondWithFilteredResult(_0xfdf69d,_0x596ae2))['catch'](handleError(_0xfdf69d,null));};exports[_0xa757('0x3d')]=function(_0x52c728,_0x564d40){var _0x43329c={'raw':!![],'where':{'id':_0x52c728[_0xa757('0x3e')]['id']}},_0x57298b={};_0x57298b[_0xa757('0x27')]=_[_0xa757('0x29')](db['WhatsappQueueReport']['rawAttributes']);_0x57298b[_0xa757('0x28')]=_[_0xa757('0x29')](_0x52c728[_0xa757('0x28')]);_0x57298b[_0xa757('0x2a')]=_[_0xa757('0x2b')](_0x57298b[_0xa757('0x27')],_0x57298b['query']);_0x43329c[_0xa757('0x2c')]=_[_0xa757('0x2b')](_0x57298b['model'],qs[_0xa757('0x2d')](_0x52c728['query'][_0xa757('0x2d')]));_0x43329c[_0xa757('0x2c')]=_0x43329c['attributes'][_0xa757('0x2e')]?_0x43329c[_0xa757('0x2c')]:_0x57298b['model'];if(_0x52c728[_0xa757('0x28')][_0xa757('0x39')]){_0x43329c[_0xa757('0x3a')]=[{'all':!![]}];}_0x43329c=_[_0xa757('0x36')]({},_0x43329c,_0x52c728['options']);return db[_0xa757('0x3f')][_0xa757('0x40')](_0x43329c)[_0xa757('0x1e')](handleEntityNotFound(_0x564d40,null))[_0xa757('0x1e')](respondWithResult(_0x564d40,null))['catch'](handleError(_0x564d40,null));};exports[_0xa757('0x41')]=function(_0x5b6017,_0x50c131){return db[_0xa757('0x3f')][_0xa757('0x41')](_0x5b6017[_0xa757('0x42')],{})['then'](respondWithResult(_0x50c131,0xc9))[_0xa757('0x43')](handleError(_0x50c131,null));};exports['update']=function(_0x2ed63f,_0x151cc3){if(_0x2ed63f[_0xa757('0x42')]['id']){delete _0x2ed63f[_0xa757('0x42')]['id'];}return db[_0xa757('0x3f')][_0xa757('0x40')]({'where':{'id':_0x2ed63f[_0xa757('0x3e')]['id']}})[_0xa757('0x1e')](handleEntityNotFound(_0x151cc3,null))['then'](saveUpdates(_0x2ed63f[_0xa757('0x42')],null))[_0xa757('0x1e')](respondWithResult(_0x151cc3,null))[_0xa757('0x43')](handleError(_0x151cc3,null));};exports[_0xa757('0x44')]=function(_0x319988,_0x1f10cf){return db[_0xa757('0x3f')][_0xa757('0x40')]({'where':{'id':_0x319988[_0xa757('0x3e')]['id']}})[_0xa757('0x1e')](handleEntityNotFound(_0x1f10cf,null))[_0xa757('0x1e')](removeEntity(_0x1f10cf,null))[_0xa757('0x43')](handleError(_0x1f10cf,null));};exports[_0xa757('0x45')]=function(_0x354ad5,_0x388573){return db[_0xa757('0x3f')]['describe']()[_0xa757('0x1e')](respondWithResult(_0x388573,null))['catch'](handleError(_0x388573,null));}; \ No newline at end of file +var _0x9348=['save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','options','WhatsappQueueReport','count','include','findAll','show','params','includeAll','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','apply','reject'];(function(_0x52fa7d,_0x320b10){var _0x5f0288=function(_0x3df0fa){while(--_0x3df0fa){_0x52fa7d['push'](_0x52fa7d['shift']());}};_0x5f0288(++_0x320b10);}(_0x9348,0x10d));var _0x8934=function(_0x4384bc,_0x127955){_0x4384bc=_0x4384bc-0x0;var _0x18e558=_0x9348[_0x4384bc];return _0x18e558;};'use strict';var emlformat=require(_0x8934('0x0'));var rimraf=require(_0x8934('0x1'));var zipdir=require(_0x8934('0x2'));var jsonpatch=require(_0x8934('0x3'));var rp=require(_0x8934('0x4'));var moment=require('moment');var BPromise=require(_0x8934('0x5'));var Mustache=require(_0x8934('0x6'));var util=require('util');var path=require(_0x8934('0x7'));var sox=require(_0x8934('0x8'));var csv=require(_0x8934('0x9'));var ejs=require(_0x8934('0xa'));var fs=require('fs');var fs_extra=require(_0x8934('0xb'));var _=require(_0x8934('0xc'));var squel=require('squel');var crypto=require(_0x8934('0xd'));var jsforce=require(_0x8934('0xe'));var deskjs=require(_0x8934('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8934('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8934('0x11'));var hardwareService=require(_0x8934('0x12'));var logger=require(_0x8934('0x13'))(_0x8934('0x14'));var utils=require(_0x8934('0x15'));var config=require(_0x8934('0x16'));var licenseUtil=require(_0x8934('0x17'));var db=require(_0x8934('0x18'))['db'];function respondWithStatusCode(_0x4a999c,_0x68427d){_0x68427d=_0x68427d||0xcc;return function(_0x108eab){if(_0x108eab){return _0x4a999c[_0x8934('0x19')](_0x68427d);}return _0x4a999c[_0x8934('0x1a')](_0x68427d)[_0x8934('0x1b')]();};}function respondWithResult(_0xdf59f4,_0x5b560f){_0x5b560f=_0x5b560f||0xc8;return function(_0x254720){if(_0x254720){return _0xdf59f4[_0x8934('0x1a')](_0x5b560f)[_0x8934('0x1c')](_0x254720);}};}function respondWithFilteredResult(_0x94b948,_0x34d4dc){return function(_0x41e6a9){if(_0x41e6a9){var _0x2a5b04=typeof _0x34d4dc[_0x8934('0x1d')]==='undefined'&&typeof _0x34d4dc[_0x8934('0x1e')]===_0x8934('0x1f');var _0x261c78=_0x41e6a9['count'];var _0x47f25e=_0x2a5b04?0x0:_0x34d4dc['offset'];var _0x2ff9ce=_0x2a5b04?_0x41e6a9['count']:_0x34d4dc[_0x8934('0x1d')]+_0x34d4dc[_0x8934('0x1e')];var _0x14b4e4;if(_0x2ff9ce>=_0x261c78){_0x2ff9ce=_0x261c78;_0x14b4e4=0xc8;}else{_0x14b4e4=0xce;}_0x94b948[_0x8934('0x1a')](_0x14b4e4);return _0x94b948[_0x8934('0x20')]('Content-Range',_0x47f25e+'-'+_0x2ff9ce+'/'+_0x261c78)[_0x8934('0x1c')](_0x41e6a9);}return null;};}function patchUpdates(_0x5ae49f){return function(_0x476c6c){try{jsonpatch[_0x8934('0x21')](_0x476c6c,_0x5ae49f,!![]);}catch(_0x1ccbe5){return BPromise[_0x8934('0x22')](_0x1ccbe5);}return _0x476c6c[_0x8934('0x23')]();};}function saveUpdates(_0x331e18,_0x36fe20){return function(_0x4f4a9b){if(_0x4f4a9b){return _0x4f4a9b[_0x8934('0x24')](_0x331e18)[_0x8934('0x25')](function(_0x32020a){return _0x32020a;});}return null;};}function removeEntity(_0x343e09,_0x43b89a){return function(_0x5e593b){if(_0x5e593b){return _0x5e593b[_0x8934('0x26')]()[_0x8934('0x25')](function(){_0x343e09[_0x8934('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16cfc2,_0x561df2){return function(_0x14c5f0){if(!_0x14c5f0){_0x16cfc2[_0x8934('0x19')](0x194);}return _0x14c5f0;};}function handleError(_0x110f7f,_0x5ef0ed){_0x5ef0ed=_0x5ef0ed||0x1f4;return function(_0x1fd5eb){logger[_0x8934('0x27')](_0x1fd5eb[_0x8934('0x28')]);if(_0x1fd5eb[_0x8934('0x29')]){delete _0x1fd5eb['name'];}_0x110f7f[_0x8934('0x1a')](_0x5ef0ed)[_0x8934('0x2a')](_0x1fd5eb);};}exports[_0x8934('0x2b')]=function(_0x3d93c7,_0x44972b){var _0x20d448={},_0x3f328a={},_0x457634={'count':0x0,'rows':[]};var _0x9c6a71=_[_0x8934('0x2c')](db['WhatsappQueueReport'][_0x8934('0x2d')],function(_0x3e973e){return{'name':_0x3e973e['fieldName'],'type':_0x3e973e[_0x8934('0x2e')][_0x8934('0x2f')]};});_0x3f328a[_0x8934('0x30')]=_[_0x8934('0x2c')](_0x9c6a71,'name');_0x3f328a[_0x8934('0x31')]=_[_0x8934('0x32')](_0x3d93c7[_0x8934('0x31')]);_0x3f328a[_0x8934('0x33')]=_[_0x8934('0x34')](_0x3f328a['model'],_0x3f328a[_0x8934('0x31')]);_0x20d448['attributes']=_['intersection'](_0x3f328a[_0x8934('0x30')],qs[_0x8934('0x35')](_0x3d93c7[_0x8934('0x31')][_0x8934('0x35')]));_0x20d448['attributes']=_0x20d448[_0x8934('0x36')][_0x8934('0x37')]?_0x20d448[_0x8934('0x36')]:_0x3f328a[_0x8934('0x30')];if(!_0x3d93c7[_0x8934('0x31')]['hasOwnProperty'](_0x8934('0x38'))){_0x20d448[_0x8934('0x1e')]=qs['limit'](_0x3d93c7['query'][_0x8934('0x1e')]);_0x20d448[_0x8934('0x1d')]=qs['offset'](_0x3d93c7['query'][_0x8934('0x1d')]);}_0x20d448[_0x8934('0x39')]=qs[_0x8934('0x3a')](_0x3d93c7[_0x8934('0x31')][_0x8934('0x3a')]);_0x20d448[_0x8934('0x3b')]=qs[_0x8934('0x33')](_[_0x8934('0x3c')](_0x3d93c7[_0x8934('0x31')],_0x3f328a[_0x8934('0x33')]),_0x9c6a71);if(_0x3d93c7[_0x8934('0x31')]['filter']){_0x20d448[_0x8934('0x3b')]=_[_0x8934('0x3d')](_0x20d448['where'],{'$or':_[_0x8934('0x2c')](_0x9c6a71,function(_0x122ad1){if(_0x122ad1[_0x8934('0x2e')]!==_0x8934('0x3e')){var _0xb189f1={};_0xb189f1[_0x122ad1['name']]={'$like':'%'+_0x3d93c7['query']['filter']+'%'};return _0xb189f1;}})});}_0x20d448=_[_0x8934('0x3d')]({},_0x20d448,_0x3d93c7[_0x8934('0x3f')]);var _0x8814f6={'where':_0x20d448['where']};return db[_0x8934('0x40')]['count'](_0x8814f6)['then'](function(_0x332098){_0x457634[_0x8934('0x41')]=_0x332098;if(_0x3d93c7['query']['includeAll']){_0x20d448[_0x8934('0x42')]=[{'all':!![]}];}return db[_0x8934('0x40')][_0x8934('0x43')](_0x20d448);})['then'](function(_0x46bfe7){_0x457634['rows']=_0x46bfe7;return _0x457634;})[_0x8934('0x25')](respondWithFilteredResult(_0x44972b,_0x20d448))['catch'](handleError(_0x44972b,null));};exports[_0x8934('0x44')]=function(_0x476ed9,_0x83be9e){var _0x566d67={'raw':!![],'where':{'id':_0x476ed9[_0x8934('0x45')]['id']}},_0xefdfab={};_0xefdfab[_0x8934('0x30')]=_[_0x8934('0x32')](db['WhatsappQueueReport'][_0x8934('0x2d')]);_0xefdfab[_0x8934('0x31')]=_[_0x8934('0x32')](_0x476ed9[_0x8934('0x31')]);_0xefdfab[_0x8934('0x33')]=_[_0x8934('0x34')](_0xefdfab[_0x8934('0x30')],_0xefdfab[_0x8934('0x31')]);_0x566d67['attributes']=_['intersection'](_0xefdfab['model'],qs[_0x8934('0x35')](_0x476ed9[_0x8934('0x31')]['fields']));_0x566d67[_0x8934('0x36')]=_0x566d67['attributes'][_0x8934('0x37')]?_0x566d67[_0x8934('0x36')]:_0xefdfab['model'];if(_0x476ed9[_0x8934('0x31')][_0x8934('0x46')]){_0x566d67[_0x8934('0x42')]=[{'all':!![]}];}_0x566d67=_[_0x8934('0x3d')]({},_0x566d67,_0x476ed9['options']);return db[_0x8934('0x40')][_0x8934('0x47')](_0x566d67)['then'](handleEntityNotFound(_0x83be9e,null))[_0x8934('0x25')](respondWithResult(_0x83be9e,null))[_0x8934('0x48')](handleError(_0x83be9e,null));};exports[_0x8934('0x49')]=function(_0x2d5c6a,_0x406d0a){return db[_0x8934('0x40')][_0x8934('0x49')](_0x2d5c6a[_0x8934('0x4a')],{})[_0x8934('0x25')](respondWithResult(_0x406d0a,0xc9))[_0x8934('0x48')](handleError(_0x406d0a,null));};exports[_0x8934('0x24')]=function(_0xe212bc,_0x2c322d){if(_0xe212bc[_0x8934('0x4a')]['id']){delete _0xe212bc[_0x8934('0x4a')]['id'];}return db[_0x8934('0x40')][_0x8934('0x47')]({'where':{'id':_0xe212bc[_0x8934('0x45')]['id']}})['then'](handleEntityNotFound(_0x2c322d,null))[_0x8934('0x25')](saveUpdates(_0xe212bc[_0x8934('0x4a')],null))['then'](respondWithResult(_0x2c322d,null))['catch'](handleError(_0x2c322d,null));};exports['destroy']=function(_0x4bc431,_0x3610a0){return db[_0x8934('0x40')][_0x8934('0x47')]({'where':{'id':_0x4bc431['params']['id']}})['then'](handleEntityNotFound(_0x3610a0,null))[_0x8934('0x25')](removeEntity(_0x3610a0,null))['catch'](handleError(_0x3610a0,null));};exports['describe']=function(_0xce93cd,_0x2778f9){return db[_0x8934('0x40')][_0x8934('0x4b')]()[_0x8934('0x25')](respondWithResult(_0x2778f9,null))[_0x8934('0x48')](handleError(_0x2778f9,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 56cd6a7..bdf4a30 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 _0xf839=['lodash','../../config/logger','api','request-promise','rimraf','../../config/environment','./whatsappQueueReport.attributes','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid'];(function(_0x38d317,_0x416030){var _0xf9425c=function(_0x37e435){while(--_0x37e435){_0x38d317['push'](_0x38d317['shift']());}};_0xf9425c(++_0x416030);}(_0xf839,0xf2));var _0x9f83=function(_0x131dae,_0x1b0cb0){_0x131dae=_0x131dae-0x0;var _0x231db5=_0xf839[_0x131dae];return _0x231db5;};'use strict';var _=require(_0x9f83('0x0'));var util=require('util');var logger=require(_0x9f83('0x1'))(_0x9f83('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9f83('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9f83('0x4'));var config=require(_0x9f83('0x5'));var attributes=require(_0x9f83('0x6'));module['exports']=function(_0x114f99,_0x4dfb49){return _0x114f99[_0x9f83('0x7')](_0x9f83('0x8'),attributes,{'tableName':_0x9f83('0x9'),'paranoid':![],'indexes':[{'name':_0x9f83('0xa'),'fields':[_0x9f83('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x880d=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','uniqueid','lodash','util'];(function(_0x50b9e1,_0x226bca){var _0x481f47=function(_0x4f582e){while(--_0x4f582e){_0x50b9e1['push'](_0x50b9e1['shift']());}};_0x481f47(++_0x226bca);}(_0x880d,0x85));var _0xd880=function(_0xdbe2de,_0x3bdc5a){_0xdbe2de=_0xdbe2de-0x0;var _0x2facd7=_0x880d[_0xdbe2de];return _0x2facd7;};'use strict';var _=require(_0xd880('0x0'));var util=require(_0xd880('0x1'));var logger=require(_0xd880('0x2'))(_0xd880('0x3'));var moment=require(_0xd880('0x4'));var BPromise=require(_0xd880('0x5'));var rp=require(_0xd880('0x6'));var fs=require('fs');var path=require(_0xd880('0x7'));var rimraf=require(_0xd880('0x8'));var config=require(_0xd880('0x9'));var attributes=require(_0xd880('0xa'));module[_0xd880('0xb')]=function(_0x1dab60,_0x2b0a8b){return _0x1dab60[_0xd880('0xc')](_0xd880('0xd'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0xd880('0xe'),'fields':[_0xd880('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 60eda34..abf5590 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 _0x6010=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','CreateWhatsappQueueReport','create','body','options','raw','debug','stringify','UpdateWhatsappQueueReport','WhatsappQueueReport','update','where','attributes','limit','then','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x38d5b2,_0xe77bf4){var _0x5b4ba8=function(_0x28ee00){while(--_0x28ee00){_0x38d5b2['push'](_0x38d5b2['shift']());}};_0x5b4ba8(++_0xe77bf4);}(_0x6010,0x1ce));var _0x0601=function(_0x398306,_0x560fd1){_0x398306=_0x398306-0x0;var _0x42644b=_0x6010[_0x398306];return _0x42644b;};'use strict';var _=require(_0x0601('0x0'));var util=require(_0x0601('0x1'));var moment=require(_0x0601('0x2'));var BPromise=require(_0x0601('0x3'));var rs=require(_0x0601('0x4'));var fs=require('fs');var Redis=require(_0x0601('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0601('0x6'));var logger=require('../../config/logger')(_0x0601('0x7'));var config=require(_0x0601('0x8'));var jayson=require(_0x0601('0x9'));var client=jayson[_0x0601('0xa')][_0x0601('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x452a38,_0x3c5f21,_0x1b66a5){return new BPromise(function(_0x489dfc,_0x5545ed){return client[_0x0601('0xc')](_0x452a38,_0x1b66a5)['then'](function(_0x1e3e60){logger[_0x0601('0xd')](_0x0601('0xe'),_0x3c5f21,_0x0601('0xf'));logger['debug'](_0x0601('0x10'),_0x3c5f21,_0x0601('0xf'),JSON['stringify'](_0x1e3e60));if(_0x1e3e60['error']){if(_0x1e3e60['error'][_0x0601('0x11')]===0x1f4){logger[_0x0601('0x12')](_0x0601('0xe'),_0x3c5f21,_0x1e3e60[_0x0601('0x12')][_0x0601('0x13')]);return _0x5545ed(_0x1e3e60['error'][_0x0601('0x13')]);}logger[_0x0601('0x12')](_0x0601('0xe'),_0x3c5f21,_0x1e3e60[_0x0601('0x12')][_0x0601('0x13')]);return _0x489dfc(_0x1e3e60[_0x0601('0x12')][_0x0601('0x13')]);}else{logger[_0x0601('0xd')](_0x0601('0xe'),_0x3c5f21,'request\x20sent');_0x489dfc(_0x1e3e60[_0x0601('0x14')][_0x0601('0x13')]);}})[_0x0601('0x15')](function(_0x513b87){logger[_0x0601('0x12')](_0x0601('0xe'),_0x3c5f21,_0x513b87);_0x5545ed(_0x513b87);});});}exports[_0x0601('0x16')]=function(_0xd3aa3b){var _0x6a166=this;return new Promise(function(_0x1a6676,_0xff14cd){return db['WhatsappQueueReport'][_0x0601('0x17')](_0xd3aa3b[_0x0601('0x18')],{'raw':_0xd3aa3b[_0x0601('0x19')]?_0xd3aa3b[_0x0601('0x19')][_0x0601('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x7f5b9f){logger[_0x0601('0xd')](_0x0601('0x16'),_0xd3aa3b);logger[_0x0601('0x1b')](_0x0601('0x16'),_0xd3aa3b,JSON[_0x0601('0x1c')](_0x7f5b9f));_0x1a6676(_0x7f5b9f);})[_0x0601('0x15')](function(_0x52fcf3){logger[_0x0601('0x12')](_0x0601('0x16'),_0x52fcf3[_0x0601('0x13')],_0xd3aa3b);_0xff14cd(_0x6a166['error'](0x1f4,_0x52fcf3[_0x0601('0x13')]));});});};exports[_0x0601('0x1d')]=function(_0x1b9cf8){var _0x153421=this;return new Promise(function(_0x46dd8a,_0xc52026){return db[_0x0601('0x1e')][_0x0601('0x1f')](_0x1b9cf8[_0x0601('0x18')],{'raw':_0x1b9cf8[_0x0601('0x19')]?_0x1b9cf8['options'][_0x0601('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b9cf8[_0x0601('0x19')]?_0x1b9cf8[_0x0601('0x19')][_0x0601('0x20')]||null:null,'attributes':_0x1b9cf8[_0x0601('0x19')]?_0x1b9cf8[_0x0601('0x19')][_0x0601('0x21')]||null:null,'limit':_0x1b9cf8['options']?_0x1b9cf8[_0x0601('0x19')][_0x0601('0x22')]||null:null})[_0x0601('0x23')](function(_0x2ec42c){logger[_0x0601('0xd')](_0x0601('0x1d'),_0x1b9cf8);logger['debug']('UpdateWhatsappQueueReport',_0x1b9cf8,JSON[_0x0601('0x1c')](_0x2ec42c));_0x46dd8a(_0x2ec42c);})[_0x0601('0x15')](function(_0x29d005){logger[_0x0601('0x12')]('UpdateWhatsappQueueReport',_0x29d005[_0x0601('0x13')],_0x1b9cf8);_0xc52026(_0x153421[_0x0601('0x12')](0x1f4,_0x29d005['message']));});});}; \ No newline at end of file +var _0x8c3f=['WhatsappQueueReport','create','options','raw','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','body','where','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','then','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result'];(function(_0x41a2ac,_0x2024bc){var _0x1ac339=function(_0x2a5bd7){while(--_0x2a5bd7){_0x41a2ac['push'](_0x41a2ac['shift']());}};_0x1ac339(++_0x2024bc);}(_0x8c3f,0xc5));var _0xf8c3=function(_0x1d087e,_0x49e0ba){_0x1d087e=_0x1d087e-0x0;var _0x365438=_0x8c3f[_0x1d087e];return _0x365438;};'use strict';var _=require(_0xf8c3('0x0'));var util=require(_0xf8c3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf8c3('0x2'));var fs=require('fs');var Redis=require(_0xf8c3('0x3'));var db=require(_0xf8c3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf8c3('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf8c3('0x6'));var client=jayson[_0xf8c3('0x7')][_0xf8c3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x599398,_0x4da8ca,_0xab59ff){return new BPromise(function(_0x1b57af,_0x288a66){return client['request'](_0x599398,_0xab59ff)[_0xf8c3('0x9')](function(_0x2d32ad){logger['info'](_0xf8c3('0xa'),_0x4da8ca,_0xf8c3('0xb'));logger[_0xf8c3('0xc')](_0xf8c3('0xd'),_0x4da8ca,_0xf8c3('0xb'),JSON[_0xf8c3('0xe')](_0x2d32ad));if(_0x2d32ad[_0xf8c3('0xf')]){if(_0x2d32ad[_0xf8c3('0xf')]['code']===0x1f4){logger[_0xf8c3('0xf')](_0xf8c3('0xa'),_0x4da8ca,_0x2d32ad[_0xf8c3('0xf')][_0xf8c3('0x10')]);return _0x288a66(_0x2d32ad['error']['message']);}logger[_0xf8c3('0xf')]('WhatsappQueueReport,\x20%s,\x20%s',_0x4da8ca,_0x2d32ad['error'][_0xf8c3('0x10')]);return _0x1b57af(_0x2d32ad[_0xf8c3('0xf')][_0xf8c3('0x10')]);}else{logger[_0xf8c3('0x11')](_0xf8c3('0xa'),_0x4da8ca,'request\x20sent');_0x1b57af(_0x2d32ad[_0xf8c3('0x12')][_0xf8c3('0x10')]);}})['catch'](function(_0x5ef386){logger[_0xf8c3('0xf')](_0xf8c3('0xa'),_0x4da8ca,_0x5ef386);_0x288a66(_0x5ef386);});});}exports['CreateWhatsappQueueReport']=function(_0x3883be){var _0x987b2a=this;return new Promise(function(_0x5725c8,_0x47e210){return db[_0xf8c3('0x13')][_0xf8c3('0x14')](_0x3883be['body'],{'raw':_0x3883be[_0xf8c3('0x15')]?_0x3883be['options'][_0xf8c3('0x16')]===undefined?!![]:![]:!![]})[_0xf8c3('0x9')](function(_0x3323e0){logger['info'](_0xf8c3('0x17'),_0x3883be);logger[_0xf8c3('0xc')](_0xf8c3('0x17'),_0x3883be,JSON[_0xf8c3('0xe')](_0x3323e0));_0x5725c8(_0x3323e0);})['catch'](function(_0x528df1){logger[_0xf8c3('0xf')]('CreateWhatsappQueueReport',_0x528df1[_0xf8c3('0x10')],_0x3883be);_0x47e210(_0x987b2a[_0xf8c3('0xf')](0x1f4,_0x528df1[_0xf8c3('0x10')]));});});};exports[_0xf8c3('0x18')]=function(_0x2af1a4){var _0x4476fd=this;return new Promise(function(_0x506fb3,_0x3de7e2){return db[_0xf8c3('0x13')]['update'](_0x2af1a4[_0xf8c3('0x19')],{'raw':_0x2af1a4[_0xf8c3('0x15')]?_0x2af1a4['options'][_0xf8c3('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2af1a4[_0xf8c3('0x15')]?_0x2af1a4[_0xf8c3('0x15')][_0xf8c3('0x1a')]||null:null,'attributes':_0x2af1a4[_0xf8c3('0x15')]?_0x2af1a4[_0xf8c3('0x15')]['attributes']||null:null,'limit':_0x2af1a4['options']?_0x2af1a4['options']['limit']||null:null})[_0xf8c3('0x9')](function(_0x14aa3c){logger['info'](_0xf8c3('0x18'),_0x2af1a4);logger[_0xf8c3('0xc')](_0xf8c3('0x18'),_0x2af1a4,JSON[_0xf8c3('0xe')](_0x14aa3c));_0x506fb3(_0x14aa3c);})['catch'](function(_0x7870b7){logger[_0xf8c3('0xf')]('UpdateWhatsappQueueReport',_0x7870b7[_0xf8c3('0x10')],_0x2af1a4);_0x3de7e2(_0x4476fd[_0xf8c3('0xf')](0x1f4,_0x7870b7[_0xf8c3('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index d6b8b9a..bce7da6 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 _0xd8b2=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','update','delete','destroy','exports','multer'];(function(_0x188bb3,_0x38870c){var _0x57cd44=function(_0x46a5be){while(--_0x46a5be){_0x188bb3['push'](_0x188bb3['shift']());}};_0x57cd44(++_0x38870c);}(_0xd8b2,0xd1));var _0x2d8b=function(_0x139196,_0x5f456d){_0x139196=_0x139196-0x0;var _0x311d80=_0xd8b2[_0x139196];return _0x311d80;};'use strict';var multer=require(_0x2d8b('0x0'));var util=require(_0x2d8b('0x1'));var path=require(_0x2d8b('0x2'));var timeout=require(_0x2d8b('0x3'));var express=require(_0x2d8b('0x4'));var router=express['Router']();var fs_extra=require(_0x2d8b('0x5'));var auth=require(_0x2d8b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2d8b('0x7'));var controller=require(_0x2d8b('0x8'));router[_0x2d8b('0x9')]('/',auth[_0x2d8b('0xa')](),controller[_0x2d8b('0xb')]);router[_0x2d8b('0x9')](_0x2d8b('0xc'),auth[_0x2d8b('0xa')](),controller[_0x2d8b('0xd')]);router[_0x2d8b('0x9')](_0x2d8b('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x2d8b('0xf')]('/',auth[_0x2d8b('0xa')](),controller[_0x2d8b('0x10')]);router['put'](_0x2d8b('0xe'),auth[_0x2d8b('0xa')](),controller[_0x2d8b('0x11')]);router[_0x2d8b('0x12')](_0x2d8b('0xe'),auth[_0x2d8b('0xa')](),controller[_0x2d8b('0x13')]);module[_0x2d8b('0x14')]=router; \ No newline at end of file +var _0xc208=['express','Router','../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller','get','isAuthenticated','index','describe','/:id','post','create','put','delete','destroy','exports','multer','util','path'];(function(_0x3968e2,_0x384b4f){var _0x14a327=function(_0x1956d6){while(--_0x1956d6){_0x3968e2['push'](_0x3968e2['shift']());}};_0x14a327(++_0x384b4f);}(_0xc208,0xa8));var _0x8c20=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc208[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x8c20('0x0'));var util=require(_0x8c20('0x1'));var path=require(_0x8c20('0x2'));var timeout=require('connect-timeout');var express=require(_0x8c20('0x3'));var router=express[_0x8c20('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8c20('0x5'));var interaction=require(_0x8c20('0x6'));var config=require('../../config/environment');var controller=require(_0x8c20('0x7'));router[_0x8c20('0x8')]('/',auth[_0x8c20('0x9')](),controller[_0x8c20('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x8c20('0xb')]);router[_0x8c20('0x8')](_0x8c20('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x8c20('0xd')]('/',auth[_0x8c20('0x9')](),controller[_0x8c20('0xe')]);router[_0x8c20('0xf')](_0x8c20('0xc'),auth[_0x8c20('0x9')](),controller['update']);router[_0x8c20('0x10')](_0x8c20('0xc'),auth['isAuthenticated'](),controller[_0x8c20('0x11')]);module[_0x8c20('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 5fa9c6b..dd297ca 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 _0x980c=['sequelize','exports','STRING','ENUM','account','agent','queue','DATE'];(function(_0x55751,_0x276e9f){var _0x169e99=function(_0x57b74d){while(--_0x57b74d){_0x55751['push'](_0x55751['shift']());}};_0x169e99(++_0x276e9f);}(_0x980c,0x100));var _0xc980=function(_0x1600cc,_0x1db028){_0x1600cc=_0x1600cc-0x0;var _0x240dfe=_0x980c[_0x1600cc];return _0x240dfe;};'use strict';var Sequelize=require(_0xc980('0x0'));module[_0xc980('0x1')]={'uniqueid':{'type':Sequelize[_0xc980('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xc980('0x3')](_0xc980('0x4'),_0xc980('0x5'),_0xc980('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xc980('0x7')]}}; \ No newline at end of file +var _0xf767=['ENUM','account','agent','STRING'];(function(_0x1450f9,_0x58e69f){var _0x13080b=function(_0x23988e){while(--_0x23988e){_0x1450f9['push'](_0x1450f9['shift']());}};_0x13080b(++_0x58e69f);}(_0xf767,0x183));var _0x7f76=function(_0x43b08,_0x15f967){_0x43b08=_0x43b08-0x0;var _0x5e05f4=_0xf767[_0x43b08];return _0x5e05f4;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x7f76('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0x7f76('0x1')](_0x7f76('0x2'),_0x7f76('0x3'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index d9629fc..e60b632 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 _0x0737=['../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','name','index','map','WhatsappTransferReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util'];(function(_0x302b5e,_0x564a8e){var _0x523ab7=function(_0x6aec8f){while(--_0x6aec8f){_0x302b5e['push'](_0x302b5e['shift']());}};_0x523ab7(++_0x564a8e);}(_0x0737,0x79));var _0x7073=function(_0x302802,_0x3abf64){_0x302802=_0x302802-0x0;var _0x422f93=_0x0737[_0x302802];return _0x422f93;};'use strict';var emlformat=require(_0x7073('0x0'));var rimraf=require(_0x7073('0x1'));var zipdir=require(_0x7073('0x2'));var jsonpatch=require(_0x7073('0x3'));var rp=require(_0x7073('0x4'));var moment=require(_0x7073('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7073('0x6'));var util=require(_0x7073('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7073('0x8'));var fs=require('fs');var fs_extra=require(_0x7073('0x9'));var _=require(_0x7073('0xa'));var squel=require(_0x7073('0xb'));var crypto=require(_0x7073('0xc'));var jsforce=require(_0x7073('0xd'));var deskjs=require(_0x7073('0xe'));var toCsv=require(_0x7073('0xf'));var querystring=require(_0x7073('0x10'));var Papa=require(_0x7073('0x11'));var Redis=require('ioredis');var authService=require(_0x7073('0x12'));var qs=require(_0x7073('0x13'));var as=require(_0x7073('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7073('0x15'))(_0x7073('0x16'));var utils=require(_0x7073('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x7073('0x18'));var db=require(_0x7073('0x19'))['db'];function respondWithStatusCode(_0x6b3141,_0xaad423){_0xaad423=_0xaad423||0xcc;return function(_0x3adbe1){if(_0x3adbe1){return _0x6b3141[_0x7073('0x1a')](_0xaad423);}return _0x6b3141[_0x7073('0x1b')](_0xaad423)[_0x7073('0x1c')]();};}function respondWithResult(_0x35f359,_0x10d726){_0x10d726=_0x10d726||0xc8;return function(_0x16674e){if(_0x16674e){return _0x35f359[_0x7073('0x1b')](_0x10d726)['json'](_0x16674e);}};}function respondWithFilteredResult(_0x5996f5,_0x5e3bc7){return function(_0x3139d5){if(_0x3139d5){var _0x309be9=typeof _0x5e3bc7['offset']===_0x7073('0x1d')&&typeof _0x5e3bc7[_0x7073('0x1e')]===_0x7073('0x1d');var _0x523e2a=_0x3139d5[_0x7073('0x1f')];var _0x441e50=_0x309be9?0x0:_0x5e3bc7[_0x7073('0x20')];var _0x4db251=_0x309be9?_0x3139d5[_0x7073('0x1f')]:_0x5e3bc7['offset']+_0x5e3bc7[_0x7073('0x1e')];var _0x3693d8;if(_0x4db251>=_0x523e2a){_0x4db251=_0x523e2a;_0x3693d8=0xc8;}else{_0x3693d8=0xce;}_0x5996f5[_0x7073('0x1b')](_0x3693d8);return _0x5996f5[_0x7073('0x21')](_0x7073('0x22'),_0x441e50+'-'+_0x4db251+'/'+_0x523e2a)['json'](_0x3139d5);}return null;};}function patchUpdates(_0x954334){return function(_0x45edc7){try{jsonpatch[_0x7073('0x23')](_0x45edc7,_0x954334,!![]);}catch(_0x5dfd64){return BPromise['reject'](_0x5dfd64);}return _0x45edc7[_0x7073('0x24')]();};}function saveUpdates(_0x1cf20c,_0x2ca21a){return function(_0x4dbd0c){if(_0x4dbd0c){return _0x4dbd0c[_0x7073('0x25')](_0x1cf20c)[_0x7073('0x26')](function(_0x307e63){return _0x307e63;});}return null;};}function removeEntity(_0xda181e,_0x429b1a){return function(_0xda738f){if(_0xda738f){return _0xda738f['destroy']()[_0x7073('0x26')](function(){_0xda181e[_0x7073('0x1b')](0xcc)[_0x7073('0x1c')]();});}};}function handleEntityNotFound(_0x1e8a19,_0x173d3c){return function(_0x2e9646){if(!_0x2e9646){_0x1e8a19[_0x7073('0x1a')](0x194);}return _0x2e9646;};}function handleError(_0x267d0d,_0xdd3792){_0xdd3792=_0xdd3792||0x1f4;return function(_0x27594f){logger['error'](_0x27594f['stack']);if(_0x27594f[_0x7073('0x27')]){delete _0x27594f['name'];}_0x267d0d[_0x7073('0x1b')](_0xdd3792)['send'](_0x27594f);};}exports[_0x7073('0x28')]=function(_0x1a0841,_0x238099){var _0x190fe8={},_0x573c8d={},_0x5236fc={'count':0x0,'rows':[]};var _0x4d6963=_[_0x7073('0x29')](db[_0x7073('0x2a')]['rawAttributes'],function(_0x306464){return{'name':_0x306464[_0x7073('0x2b')],'type':_0x306464[_0x7073('0x2c')][_0x7073('0x2d')]};});_0x573c8d[_0x7073('0x2e')]=_['map'](_0x4d6963,'name');_0x573c8d[_0x7073('0x2f')]=_[_0x7073('0x30')](_0x1a0841[_0x7073('0x2f')]);_0x573c8d['filters']=_[_0x7073('0x31')](_0x573c8d['model'],_0x573c8d[_0x7073('0x2f')]);_0x190fe8[_0x7073('0x32')]=_[_0x7073('0x31')](_0x573c8d['model'],qs[_0x7073('0x33')](_0x1a0841[_0x7073('0x2f')][_0x7073('0x33')]));_0x190fe8[_0x7073('0x32')]=_0x190fe8[_0x7073('0x32')][_0x7073('0x34')]?_0x190fe8[_0x7073('0x32')]:_0x573c8d[_0x7073('0x2e')];if(!_0x1a0841[_0x7073('0x2f')][_0x7073('0x35')]('nolimit')){_0x190fe8[_0x7073('0x1e')]=qs[_0x7073('0x1e')](_0x1a0841[_0x7073('0x2f')][_0x7073('0x1e')]);_0x190fe8[_0x7073('0x20')]=qs[_0x7073('0x20')](_0x1a0841[_0x7073('0x2f')][_0x7073('0x20')]);}_0x190fe8['order']=qs[_0x7073('0x36')](_0x1a0841[_0x7073('0x2f')][_0x7073('0x36')]);_0x190fe8['where']=qs['filters'](_[_0x7073('0x37')](_0x1a0841[_0x7073('0x2f')],_0x573c8d[_0x7073('0x38')]),_0x4d6963);if(_0x1a0841[_0x7073('0x2f')][_0x7073('0x39')]){_0x190fe8[_0x7073('0x3a')]=_[_0x7073('0x3b')](_0x190fe8[_0x7073('0x3a')],{'$or':_['map'](_0x4d6963,function(_0x45c817){if(_0x45c817[_0x7073('0x2c')]!==_0x7073('0x3c')){var _0x51f049={};_0x51f049[_0x45c817[_0x7073('0x27')]]={'$like':'%'+_0x1a0841[_0x7073('0x2f')][_0x7073('0x39')]+'%'};return _0x51f049;}})});}_0x190fe8=_[_0x7073('0x3b')]({},_0x190fe8,_0x1a0841[_0x7073('0x3d')]);var _0x3048f4={'where':_0x190fe8[_0x7073('0x3a')]};return db[_0x7073('0x2a')][_0x7073('0x1f')](_0x3048f4)['then'](function(_0xf6870e){_0x5236fc['count']=_0xf6870e;if(_0x1a0841[_0x7073('0x2f')][_0x7073('0x3e')]){_0x190fe8[_0x7073('0x3f')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x7073('0x40')](_0x190fe8);})[_0x7073('0x26')](function(_0x4f8045){_0x5236fc[_0x7073('0x41')]=_0x4f8045;return _0x5236fc;})[_0x7073('0x26')](respondWithFilteredResult(_0x238099,_0x190fe8))[_0x7073('0x42')](handleError(_0x238099,null));};exports['show']=function(_0x7ad8ae,_0x32b887){var _0x9e7a96={'raw':!![],'where':{'id':_0x7ad8ae[_0x7073('0x43')]['id']}},_0x17d5a4={};_0x17d5a4[_0x7073('0x2e')]=_['keys'](db[_0x7073('0x2a')][_0x7073('0x44')]);_0x17d5a4[_0x7073('0x2f')]=_[_0x7073('0x30')](_0x7ad8ae['query']);_0x17d5a4[_0x7073('0x38')]=_[_0x7073('0x31')](_0x17d5a4[_0x7073('0x2e')],_0x17d5a4['query']);_0x9e7a96['attributes']=_[_0x7073('0x31')](_0x17d5a4[_0x7073('0x2e')],qs[_0x7073('0x33')](_0x7ad8ae[_0x7073('0x2f')][_0x7073('0x33')]));_0x9e7a96[_0x7073('0x32')]=_0x9e7a96[_0x7073('0x32')][_0x7073('0x34')]?_0x9e7a96[_0x7073('0x32')]:_0x17d5a4[_0x7073('0x2e')];if(_0x7ad8ae[_0x7073('0x2f')]['includeAll']){_0x9e7a96[_0x7073('0x3f')]=[{'all':!![]}];}_0x9e7a96=_[_0x7073('0x3b')]({},_0x9e7a96,_0x7ad8ae[_0x7073('0x3d')]);return db[_0x7073('0x2a')]['find'](_0x9e7a96)[_0x7073('0x26')](handleEntityNotFound(_0x32b887,null))['then'](respondWithResult(_0x32b887,null))[_0x7073('0x42')](handleError(_0x32b887,null));};exports['create']=function(_0x57848d,_0x19fd79){return db['WhatsappTransferReport'][_0x7073('0x45')](_0x57848d[_0x7073('0x46')],{})['then'](respondWithResult(_0x19fd79,0xc9))[_0x7073('0x42')](handleError(_0x19fd79,null));};exports[_0x7073('0x25')]=function(_0x4bbfa5,_0x518252){if(_0x4bbfa5[_0x7073('0x46')]['id']){delete _0x4bbfa5[_0x7073('0x46')]['id'];}return db[_0x7073('0x2a')][_0x7073('0x47')]({'where':{'id':_0x4bbfa5[_0x7073('0x43')]['id']}})[_0x7073('0x26')](handleEntityNotFound(_0x518252,null))[_0x7073('0x26')](saveUpdates(_0x4bbfa5[_0x7073('0x46')],null))[_0x7073('0x26')](respondWithResult(_0x518252,null))[_0x7073('0x42')](handleError(_0x518252,null));};exports['destroy']=function(_0x1c05d2,_0x174897){return db[_0x7073('0x2a')][_0x7073('0x47')]({'where':{'id':_0x1c05d2[_0x7073('0x43')]['id']}})[_0x7073('0x26')](handleEntityNotFound(_0x174897,null))[_0x7073('0x26')](removeEntity(_0x174897,null))[_0x7073('0x42')](handleError(_0x174897,null));};exports[_0x7073('0x48')]=function(_0x39b9af,_0x2ab4c2){return db['WhatsappTransferReport'][_0x7073('0x48')]()[_0x7073('0x26')](respondWithResult(_0x2ab4c2,null))[_0x7073('0x42')](handleError(_0x2ab4c2,null));}; \ No newline at end of file +var _0xcd3b=['stack','name','send','index','rawAttributes','fieldName','key','model','map','query','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','type','VIRTUAL','merge','options','WhatsappTransferReport','includeAll','include','findAll','rows','params','keys','intersection','catch','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','count','json','reject','save','update','destroy','then','end'];(function(_0x327b6c,_0x2489c5){var _0x4ec5ad=function(_0x5a4f56){while(--_0x5a4f56){_0x327b6c['push'](_0x327b6c['shift']());}};_0x4ec5ad(++_0x2489c5);}(_0xcd3b,0x19c));var _0xbcd3=function(_0x3a7ece,_0x52dbca){_0x3a7ece=_0x3a7ece-0x0;var _0x52f617=_0xcd3b[_0x3a7ece];return _0x52f617;};'use strict';var emlformat=require(_0xbcd3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbcd3('0x1'));var jsonpatch=require(_0xbcd3('0x2'));var rp=require(_0xbcd3('0x3'));var moment=require(_0xbcd3('0x4'));var BPromise=require(_0xbcd3('0x5'));var Mustache=require('mustache');var util=require(_0xbcd3('0x6'));var path=require(_0xbcd3('0x7'));var sox=require(_0xbcd3('0x8'));var csv=require(_0xbcd3('0x9'));var ejs=require(_0xbcd3('0xa'));var fs=require('fs');var fs_extra=require(_0xbcd3('0xb'));var _=require('lodash');var squel=require(_0xbcd3('0xc'));var crypto=require(_0xbcd3('0xd'));var jsforce=require(_0xbcd3('0xe'));var deskjs=require(_0xbcd3('0xf'));var toCsv=require(_0xbcd3('0x9'));var querystring=require(_0xbcd3('0x10'));var Papa=require(_0xbcd3('0x11'));var Redis=require(_0xbcd3('0x12'));var authService=require(_0xbcd3('0x13'));var qs=require(_0xbcd3('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbcd3('0x15'));var logger=require(_0xbcd3('0x16'))('api');var utils=require(_0xbcd3('0x17'));var config=require(_0xbcd3('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xbcd3('0x19'))['db'];function respondWithStatusCode(_0x15799c,_0x3bf47f){_0x3bf47f=_0x3bf47f||0xcc;return function(_0x5bd145){if(_0x5bd145){return _0x15799c[_0xbcd3('0x1a')](_0x3bf47f);}return _0x15799c[_0xbcd3('0x1b')](_0x3bf47f)['end']();};}function respondWithResult(_0x4c4b09,_0x3fb8b5){_0x3fb8b5=_0x3fb8b5||0xc8;return function(_0x2a751d){if(_0x2a751d){return _0x4c4b09['status'](_0x3fb8b5)['json'](_0x2a751d);}};}function respondWithFilteredResult(_0x2e8567,_0x59f15c){return function(_0x12adae){if(_0x12adae){var _0x195bf7=typeof _0x59f15c[_0xbcd3('0x1c')]==='undefined'&&typeof _0x59f15c[_0xbcd3('0x1d')]==='undefined';var _0x5af826=_0x12adae[_0xbcd3('0x1e')];var _0x26939d=_0x195bf7?0x0:_0x59f15c[_0xbcd3('0x1c')];var _0x2d13c2=_0x195bf7?_0x12adae['count']:_0x59f15c[_0xbcd3('0x1c')]+_0x59f15c[_0xbcd3('0x1d')];var _0x4a2fba;if(_0x2d13c2>=_0x5af826){_0x2d13c2=_0x5af826;_0x4a2fba=0xc8;}else{_0x4a2fba=0xce;}_0x2e8567[_0xbcd3('0x1b')](_0x4a2fba);return _0x2e8567['set']('Content-Range',_0x26939d+'-'+_0x2d13c2+'/'+_0x5af826)[_0xbcd3('0x1f')](_0x12adae);}return null;};}function patchUpdates(_0x47cf0e){return function(_0x22345e){try{jsonpatch['apply'](_0x22345e,_0x47cf0e,!![]);}catch(_0x3717c7){return BPromise[_0xbcd3('0x20')](_0x3717c7);}return _0x22345e[_0xbcd3('0x21')]();};}function saveUpdates(_0x3e13a7,_0x24d176){return function(_0x192ae8){if(_0x192ae8){return _0x192ae8[_0xbcd3('0x22')](_0x3e13a7)['then'](function(_0x13edda){return _0x13edda;});}return null;};}function removeEntity(_0x2deae5,_0x256cab){return function(_0x3017ef){if(_0x3017ef){return _0x3017ef[_0xbcd3('0x23')]()[_0xbcd3('0x24')](function(){_0x2deae5[_0xbcd3('0x1b')](0xcc)[_0xbcd3('0x25')]();});}};}function handleEntityNotFound(_0x3a3336,_0x1177ab){return function(_0x5b5404){if(!_0x5b5404){_0x3a3336[_0xbcd3('0x1a')](0x194);}return _0x5b5404;};}function handleError(_0x48b6a8,_0x276989){_0x276989=_0x276989||0x1f4;return function(_0x1dc1d4){logger['error'](_0x1dc1d4[_0xbcd3('0x26')]);if(_0x1dc1d4[_0xbcd3('0x27')]){delete _0x1dc1d4[_0xbcd3('0x27')];}_0x48b6a8[_0xbcd3('0x1b')](_0x276989)[_0xbcd3('0x28')](_0x1dc1d4);};}exports[_0xbcd3('0x29')]=function(_0x235cab,_0x1834ff){var _0x41f884={},_0x3d12c4={},_0x3ed1f4={'count':0x0,'rows':[]};var _0x4052d3=_['map'](db['WhatsappTransferReport'][_0xbcd3('0x2a')],function(_0x21600d){return{'name':_0x21600d[_0xbcd3('0x2b')],'type':_0x21600d['type'][_0xbcd3('0x2c')]};});_0x3d12c4[_0xbcd3('0x2d')]=_[_0xbcd3('0x2e')](_0x4052d3,'name');_0x3d12c4['query']=_['keys'](_0x235cab[_0xbcd3('0x2f')]);_0x3d12c4['filters']=_['intersection'](_0x3d12c4['model'],_0x3d12c4[_0xbcd3('0x2f')]);_0x41f884[_0xbcd3('0x30')]=_['intersection'](_0x3d12c4['model'],qs[_0xbcd3('0x31')](_0x235cab['query'][_0xbcd3('0x31')]));_0x41f884[_0xbcd3('0x30')]=_0x41f884[_0xbcd3('0x30')][_0xbcd3('0x32')]?_0x41f884[_0xbcd3('0x30')]:_0x3d12c4[_0xbcd3('0x2d')];if(!_0x235cab[_0xbcd3('0x2f')][_0xbcd3('0x33')](_0xbcd3('0x34'))){_0x41f884[_0xbcd3('0x1d')]=qs[_0xbcd3('0x1d')](_0x235cab[_0xbcd3('0x2f')][_0xbcd3('0x1d')]);_0x41f884['offset']=qs[_0xbcd3('0x1c')](_0x235cab['query'][_0xbcd3('0x1c')]);}_0x41f884['order']=qs['sort'](_0x235cab[_0xbcd3('0x2f')][_0xbcd3('0x35')]);_0x41f884['where']=qs[_0xbcd3('0x36')](_[_0xbcd3('0x37')](_0x235cab[_0xbcd3('0x2f')],_0x3d12c4[_0xbcd3('0x36')]),_0x4052d3);if(_0x235cab['query'][_0xbcd3('0x38')]){_0x41f884[_0xbcd3('0x39')]=_['merge'](_0x41f884[_0xbcd3('0x39')],{'$or':_[_0xbcd3('0x2e')](_0x4052d3,function(_0x2523ea){if(_0x2523ea[_0xbcd3('0x3a')]!==_0xbcd3('0x3b')){var _0x14822b={};_0x14822b[_0x2523ea[_0xbcd3('0x27')]]={'$like':'%'+_0x235cab[_0xbcd3('0x2f')]['filter']+'%'};return _0x14822b;}})});}_0x41f884=_[_0xbcd3('0x3c')]({},_0x41f884,_0x235cab[_0xbcd3('0x3d')]);var _0x2beb2f={'where':_0x41f884['where']};return db[_0xbcd3('0x3e')][_0xbcd3('0x1e')](_0x2beb2f)[_0xbcd3('0x24')](function(_0x5af2c2){_0x3ed1f4[_0xbcd3('0x1e')]=_0x5af2c2;if(_0x235cab[_0xbcd3('0x2f')][_0xbcd3('0x3f')]){_0x41f884[_0xbcd3('0x40')]=[{'all':!![]}];}return db[_0xbcd3('0x3e')][_0xbcd3('0x41')](_0x41f884);})['then'](function(_0x1a3862){_0x3ed1f4[_0xbcd3('0x42')]=_0x1a3862;return _0x3ed1f4;})[_0xbcd3('0x24')](respondWithFilteredResult(_0x1834ff,_0x41f884))['catch'](handleError(_0x1834ff,null));};exports['show']=function(_0x1c9785,_0x2e6e3b){var _0x3a9f8d={'raw':!![],'where':{'id':_0x1c9785[_0xbcd3('0x43')]['id']}},_0x4a63cd={};_0x4a63cd['model']=_[_0xbcd3('0x44')](db[_0xbcd3('0x3e')][_0xbcd3('0x2a')]);_0x4a63cd[_0xbcd3('0x2f')]=_['keys'](_0x1c9785[_0xbcd3('0x2f')]);_0x4a63cd[_0xbcd3('0x36')]=_[_0xbcd3('0x45')](_0x4a63cd[_0xbcd3('0x2d')],_0x4a63cd[_0xbcd3('0x2f')]);_0x3a9f8d[_0xbcd3('0x30')]=_[_0xbcd3('0x45')](_0x4a63cd['model'],qs['fields'](_0x1c9785[_0xbcd3('0x2f')][_0xbcd3('0x31')]));_0x3a9f8d[_0xbcd3('0x30')]=_0x3a9f8d[_0xbcd3('0x30')]['length']?_0x3a9f8d['attributes']:_0x4a63cd['model'];if(_0x1c9785[_0xbcd3('0x2f')][_0xbcd3('0x3f')]){_0x3a9f8d['include']=[{'all':!![]}];}_0x3a9f8d=_[_0xbcd3('0x3c')]({},_0x3a9f8d,_0x1c9785[_0xbcd3('0x3d')]);return db[_0xbcd3('0x3e')]['find'](_0x3a9f8d)[_0xbcd3('0x24')](handleEntityNotFound(_0x2e6e3b,null))[_0xbcd3('0x24')](respondWithResult(_0x2e6e3b,null))[_0xbcd3('0x46')](handleError(_0x2e6e3b,null));};exports['create']=function(_0x2ecb02,_0x56dbfb){return db['WhatsappTransferReport'][_0xbcd3('0x47')](_0x2ecb02[_0xbcd3('0x48')],{})['then'](respondWithResult(_0x56dbfb,0xc9))[_0xbcd3('0x46')](handleError(_0x56dbfb,null));};exports[_0xbcd3('0x22')]=function(_0x4b9875,_0x2f6781){if(_0x4b9875['body']['id']){delete _0x4b9875[_0xbcd3('0x48')]['id'];}return db[_0xbcd3('0x3e')][_0xbcd3('0x49')]({'where':{'id':_0x4b9875['params']['id']}})[_0xbcd3('0x24')](handleEntityNotFound(_0x2f6781,null))[_0xbcd3('0x24')](saveUpdates(_0x4b9875[_0xbcd3('0x48')],null))['then'](respondWithResult(_0x2f6781,null))[_0xbcd3('0x46')](handleError(_0x2f6781,null));};exports['destroy']=function(_0x32333c,_0x5be761){return db[_0xbcd3('0x3e')][_0xbcd3('0x49')]({'where':{'id':_0x32333c['params']['id']}})[_0xbcd3('0x24')](handleEntityNotFound(_0x5be761,null))[_0xbcd3('0x24')](removeEntity(_0x5be761,null))[_0xbcd3('0x46')](handleError(_0x5be761,null));};exports[_0xbcd3('0x4a')]=function(_0x50484a,_0x2822f3){return db[_0xbcd3('0x3e')][_0xbcd3('0x4a')]()['then'](respondWithResult(_0x2822f3,null))[_0xbcd3('0x46')](handleError(_0x2822f3,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 507616c..f7fb6b9 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 _0x4efb=['report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x9bc5de,_0x4274b5){var _0x2569f3=function(_0x2fc5b9){while(--_0x2fc5b9){_0x9bc5de['push'](_0x9bc5de['shift']());}};_0x2569f3(++_0x4274b5);}(_0x4efb,0xe2));var _0xb4ef=function(_0x51fe88,_0x47c78c){_0x51fe88=_0x51fe88-0x0;var _0x11004b=_0x4efb[_0x51fe88];return _0x11004b;};'use strict';var _=require(_0xb4ef('0x0'));var util=require(_0xb4ef('0x1'));var logger=require(_0xb4ef('0x2'))(_0xb4ef('0x3'));var moment=require(_0xb4ef('0x4'));var BPromise=require(_0xb4ef('0x5'));var rp=require(_0xb4ef('0x6'));var fs=require('fs');var path=require(_0xb4ef('0x7'));var rimraf=require(_0xb4ef('0x8'));var config=require(_0xb4ef('0x9'));var attributes=require('./whatsappTransferReport.attributes');module[_0xb4ef('0xa')]=function(_0x5ac393,_0x1b26fb){return _0x5ac393[_0xb4ef('0xb')]('WhatsappTransferReport',attributes,{'tableName':_0xb4ef('0xc'),'paranoid':![],'indexes':[{'name':_0xb4ef('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf847=['rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','report_whatsapp_transfer','uniqueid','util','../../config/logger','api','moment','request-promise'];(function(_0x3e6517,_0x54c694){var _0x30ffc6=function(_0x1e7fd9){while(--_0x1e7fd9){_0x3e6517['push'](_0x3e6517['shift']());}};_0x30ffc6(++_0x54c694);}(_0xf847,0xaf));var _0x7f84=function(_0x136718,_0x17aaea){_0x136718=_0x136718-0x0;var _0x9be61d=_0xf847[_0x136718];return _0x9be61d;};'use strict';var _=require('lodash');var util=require(_0x7f84('0x0'));var logger=require(_0x7f84('0x1'))(_0x7f84('0x2'));var moment=require(_0x7f84('0x3'));var BPromise=require('bluebird');var rp=require(_0x7f84('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7f84('0x5'));var config=require(_0x7f84('0x6'));var attributes=require(_0x7f84('0x7'));module[_0x7f84('0x8')]=function(_0x645a84,_0x444576){return _0x645a84[_0x7f84('0x9')]('WhatsappTransferReport',attributes,{'tableName':_0x7f84('0xa'),'paranoid':![],'indexes':[{'name':_0x7f84('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 5212663..5c9d63c 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 _0xc458=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x153e72,_0x1cde75){var _0x2d060f=function(_0xdfa3b0){while(--_0xdfa3b0){_0x153e72['push'](_0x153e72['shift']());}};_0x2d060f(++_0x1cde75);}(_0xc458,0xb0));var _0x8c45=function(_0x512066,_0x1c9ca1){_0x512066=_0x512066-0x0;var _0x2b99bd=_0xc458[_0x512066];return _0x2b99bd;};'use strict';var _=require('lodash');var util=require(_0x8c45('0x0'));var moment=require(_0x8c45('0x1'));var BPromise=require(_0x8c45('0x2'));var rs=require(_0x8c45('0x3'));var fs=require('fs');var Redis=require(_0x8c45('0x4'));var db=require(_0x8c45('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8c45('0x6'))(_0x8c45('0x7'));var config=require(_0x8c45('0x8'));var jayson=require(_0x8c45('0x9'));var client=jayson[_0x8c45('0xa')][_0x8c45('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x11397c,_0x18a3fb,_0x586971){return new BPromise(function(_0x3bdfe5,_0x383190){return client[_0x8c45('0xc')](_0x11397c,_0x586971)['then'](function(_0x4cdf8f){logger[_0x8c45('0xd')](_0x8c45('0xe'),_0x18a3fb,_0x8c45('0xf'));logger[_0x8c45('0x10')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x18a3fb,_0x8c45('0xf'),JSON[_0x8c45('0x11')](_0x4cdf8f));if(_0x4cdf8f[_0x8c45('0x12')]){if(_0x4cdf8f[_0x8c45('0x12')][_0x8c45('0x13')]===0x1f4){logger[_0x8c45('0x12')](_0x8c45('0xe'),_0x18a3fb,_0x4cdf8f[_0x8c45('0x12')][_0x8c45('0x14')]);return _0x383190(_0x4cdf8f[_0x8c45('0x12')]['message']);}logger[_0x8c45('0x12')](_0x8c45('0xe'),_0x18a3fb,_0x4cdf8f[_0x8c45('0x12')][_0x8c45('0x14')]);return _0x3bdfe5(_0x4cdf8f[_0x8c45('0x12')][_0x8c45('0x14')]);}else{logger[_0x8c45('0xd')](_0x8c45('0xe'),_0x18a3fb,_0x8c45('0xf'));_0x3bdfe5(_0x4cdf8f[_0x8c45('0x15')][_0x8c45('0x14')]);}})['catch'](function(_0x215668){logger[_0x8c45('0x12')]('WhatsappTransferReport,\x20%s,\x20%s',_0x18a3fb,_0x215668);_0x383190(_0x215668);});});} \ No newline at end of file +var _0xef0e=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x18b6a6,_0xe0ee41){var _0x109350=function(_0x5dac09){while(--_0x5dac09){_0x18b6a6['push'](_0x18b6a6['shift']());}};_0x109350(++_0xe0ee41);}(_0xef0e,0x153));var _0xeef0=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xef0e[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xeef0('0x0'));var util=require(_0xeef0('0x1'));var moment=require(_0xeef0('0x2'));var BPromise=require(_0xeef0('0x3'));var rs=require(_0xeef0('0x4'));var fs=require('fs');var Redis=require(_0xeef0('0x5'));var db=require(_0xeef0('0x6'))['db'];var utils=require(_0xeef0('0x7'));var logger=require(_0xeef0('0x8'))(_0xeef0('0x9'));var config=require(_0xeef0('0xa'));var jayson=require(_0xeef0('0xb'));var client=jayson['client'][_0xeef0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5cc98e,_0x5ea895,_0x3be262){return new BPromise(function(_0x477399,_0x662cfb){return client['request'](_0x5cc98e,_0x3be262)[_0xeef0('0xd')](function(_0x1134db){logger['info'](_0xeef0('0xe'),_0x5ea895,_0xeef0('0xf'));logger[_0xeef0('0x10')](_0xeef0('0x11'),_0x5ea895,_0xeef0('0xf'),JSON[_0xeef0('0x12')](_0x1134db));if(_0x1134db[_0xeef0('0x13')]){if(_0x1134db[_0xeef0('0x13')][_0xeef0('0x14')]===0x1f4){logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0x5ea895,_0x1134db[_0xeef0('0x13')]['message']);return _0x662cfb(_0x1134db[_0xeef0('0x13')][_0xeef0('0x15')]);}logger[_0xeef0('0x13')](_0xeef0('0xe'),_0x5ea895,_0x1134db[_0xeef0('0x13')][_0xeef0('0x15')]);return _0x477399(_0x1134db['error'][_0xeef0('0x15')]);}else{logger[_0xeef0('0x16')](_0xeef0('0xe'),_0x5ea895,_0xeef0('0xf'));_0x477399(_0x1134db['result'][_0xeef0('0x15')]);}})['catch'](function(_0x435ca0){logger[_0xeef0('0x13')](_0xeef0('0xe'),_0x5ea895,_0x435ca0);_0x662cfb(_0x435ca0);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 169e5bd..7002c42 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0ca8=['seedDB','./config/seedDB','default','./config/license','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./rpc','./config/environment','app','./config/pm2','./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync','listen','then','start','info','map','filter','online','name','join','Offline\x20apps:','status','None'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0ca8,0x1e2));var _0x80ca=function(_0x4db525,_0x8de298){_0x4db525=_0x4db525-0x0;var _0x513f77=_0x0ca8[_0x4db525];return _0x513f77;};'use strict';var _=require(_0x80ca('0x0'));var mysqldb=require('./mysqldb');var rpc=require(_0x80ca('0x1'));var config=require(_0x80ca('0x2'));var logger=require('./config/logger')(_0x80ca('0x3'));var pm2=require(_0x80ca('0x4'));var pm2Config=require('./config/pm2/config');var schedule=require(_0x80ca('0x5'));var chat=require('./config/schedule/chat');var whatsapp=require(_0x80ca('0x6'));var transcribe=require(_0x80ca('0x7'));function main(){return mysqldb['db'][_0x80ca('0x8')][_0x80ca('0x9')]()['then'](function(){return rpc[_0x80ca('0xa')]();})[_0x80ca('0xb')](function(_0x206556){logger['info'](_0x206556);return chat[_0x80ca('0xc')]();})[_0x80ca('0xb')](function(){return whatsapp['start']();})[_0x80ca('0xb')](function(){return schedule['start']();})[_0x80ca('0xb')](function(){return transcribe['start']();})['then'](function(_0x5e76fc){logger[_0x80ca('0xd')](_0x5e76fc);return pm2[_0x80ca('0xc')](pm2Config);})[_0x80ca('0xb')](function(_0x3107fd){logger['info']('Online\x20apps:',_[_0x80ca('0xe')](_[_0x80ca('0xf')](_0x3107fd,{'status':_0x80ca('0x10')}),_0x80ca('0x11'))[_0x80ca('0x12')]());logger[_0x80ca('0xd')](_0x80ca('0x13'),_[_0x80ca('0xe')](_['filter'](_0x3107fd,function(_0x1c0ed0){return _0x1c0ed0[_0x80ca('0x14')]!==_0x80ca('0x10');}),_0x80ca('0x11'))[_0x80ca('0x12')]()||_0x80ca('0x15'));config[_0x80ca('0x16')]&&require(_0x80ca('0x17'))[_0x80ca('0x18')]();require(_0x80ca('0x19'))['default']();})[_0x80ca('0x1a')](function(_0x4a418c){logger['error'](_0x80ca('0x1b'),_0x4a418c);process['exit'](0x1);});}main(); \ No newline at end of file +var _0x0218=['exit','./mysqldb','./rpc','./config/logger','app','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','then','listen','info','start','Online\x20apps:','filter','online','name','join','Offline\x20apps:','map','status','seedDB','default','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s'];(function(_0x5af32b,_0x518fde){var _0x4e59b1=function(_0x3c5d2a){while(--_0x3c5d2a){_0x5af32b['push'](_0x5af32b['shift']());}};_0x4e59b1(++_0x518fde);}(_0x0218,0x153));var _0x8021=function(_0x411e04,_0x291718){_0x411e04=_0x411e04-0x0;var _0x4b66aa=_0x0218[_0x411e04];return _0x4b66aa;};'use strict';var _=require('lodash');var mysqldb=require(_0x8021('0x0'));var rpc=require(_0x8021('0x1'));var config=require('./config/environment');var logger=require(_0x8021('0x2'))(_0x8021('0x3'));var pm2=require('./config/pm2');var pm2Config=require('./config/pm2/config');var schedule=require(_0x8021('0x4'));var chat=require(_0x8021('0x5'));var whatsapp=require(_0x8021('0x6'));var transcribe=require(_0x8021('0x7'));function main(){return mysqldb['db']['sequelize']['sync']()[_0x8021('0x8')](function(){return rpc[_0x8021('0x9')]();})['then'](function(_0x32c160){logger[_0x8021('0xa')](_0x32c160);return chat[_0x8021('0xb')]();})['then'](function(){return whatsapp[_0x8021('0xb')]();})[_0x8021('0x8')](function(){return schedule[_0x8021('0xb')]();})[_0x8021('0x8')](function(){return transcribe[_0x8021('0xb')]();})['then'](function(_0x35cf8b){logger[_0x8021('0xa')](_0x35cf8b);return pm2[_0x8021('0xb')](pm2Config);})[_0x8021('0x8')](function(_0x6306b){logger['info'](_0x8021('0xc'),_['map'](_[_0x8021('0xd')](_0x6306b,{'status':_0x8021('0xe')}),_0x8021('0xf'))[_0x8021('0x10')]());logger[_0x8021('0xa')](_0x8021('0x11'),_[_0x8021('0x12')](_[_0x8021('0xd')](_0x6306b,function(_0x5f0f9e){return _0x5f0f9e[_0x8021('0x13')]!==_0x8021('0xe');}),'name')[_0x8021('0x10')]()||'None');config[_0x8021('0x14')]&&require('./config/seedDB')['default']();require('./config/license')[_0x8021('0x15')]();})[_0x8021('0x16')](function(_0x40edb){logger[_0x8021('0x17')](_0x8021('0x18'),_0x40edb);process[_0x8021('0x19')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index a0d9400..b84745c 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 _0x1b6d=['express-jwt','composable-middleware','bluebird','util','secrets','session','role','fullname','internal','email','userpic','permissions','md5secret','voicePause','chatPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadOmnichannelInteractions','downloadAttachments','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','closed','disposition','then','unmanaged','json','Unmanaged.','Forbidden.','catch','headers','authorization','startsWith','Basic','User','pass','status','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','query','sub','allowedLoginAttempts','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','blockDuration','minutes','find','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isMiddleware','signToken','motion.token','redirect','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','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~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','length','splice','unshift','encryptString','promisify','secret','payload','options','verify','randomBytes','now','toString','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash'];(function(_0x173eff,_0x55a7d0){var _0x119fbd=function(_0x31a223){while(--_0x31a223){_0x173eff['push'](_0x173eff['shift']());}};_0x119fbd(++_0x55a7d0);}(_0x1b6d,0x7c));var _0xd1b6=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x1b6d[_0x27af45];return _0x18df21;};'use strict';var db=require(_0xd1b6('0x0'))['db'];var config=require(_0xd1b6('0x1'));var hardwareConf=require(_0xd1b6('0x2'));var licenseUtil=require(_0xd1b6('0x3'));var encryptor=require(_0xd1b6('0x4'));var _=require(_0xd1b6('0x5'));var jwt=require('jsonwebtoken');var expressJwt=require(_0xd1b6('0x6'));var compose=require(_0xd1b6('0x7'));var basicAuth=require('basic-auth');var crypto=require('crypto');var BPromise=require(_0xd1b6('0x8'));var util=require(_0xd1b6('0x9'));var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0xd1b6('0xa')][_0xd1b6('0xb')]});var userAttributes=['id',_0xd1b6('0xc'),_0xd1b6('0xd'),'name',_0xd1b6('0xe'),_0xd1b6('0xf'),_0xd1b6('0x10'),_0xd1b6('0x11'),_0xd1b6('0x12'),_0xd1b6('0x13'),_0xd1b6('0x14'),'mailPause',_0xd1b6('0x15'),_0xd1b6('0x16'),_0xd1b6('0x17'),_0xd1b6('0x18'),_0xd1b6('0x19'),_0xd1b6('0x1a'),_0xd1b6('0x1b'),_0xd1b6('0x1c'),_0xd1b6('0x1d'),_0xd1b6('0x1e'),'alias',_0xd1b6('0x1f'),_0xd1b6('0x20'),_0xd1b6('0x21'),_0xd1b6('0x22'),_0xd1b6('0x23'),_0xd1b6('0x24'),_0xd1b6('0x25'),_0xd1b6('0x26'),_0xd1b6('0x27'),_0xd1b6('0x28'),_0xd1b6('0x29'),'interface',_0xd1b6('0x2a'),_0xd1b6('0x2b'),_0xd1b6('0x2c'),_0xd1b6('0x2d'),'downloadVoiceRecordings',_0xd1b6('0x2e'),_0xd1b6('0x2f')];exports[_0xd1b6('0x30')]=function(){return this[_0xd1b6('0x31')](!![])[_0xd1b6('0x32')](function(_0x64b19e,_0x4426a4,_0x3d6f4b){if(_0x64b19e[_0xd1b6('0x33')]){_0x3d6f4b();}else{return db[_0xd1b6('0x34')][_0xd1b6('0x35')]({'where':{'id':_0x64b19e['params']['id']},'attributes':['id',_0xd1b6('0x36'),_0xd1b6('0x37')],'raw':!![]})[_0xd1b6('0x38')](function(_0x49b0f1){if(_0x49b0f1&&_0x49b0f1[_0xd1b6('0x36')]){return _0x4426a4['status'](_0x49b0f1[_0xd1b6('0x37')]===_0xd1b6('0x39')?0x195:0x193)[_0xd1b6('0x3a')]({'message':_0x49b0f1['disposition']===_0xd1b6('0x39')?_0xd1b6('0x3b'):_0xd1b6('0x3c')});}else{_0x3d6f4b();}})[_0xd1b6('0x3d')](function(_0x428f49){_0x3d6f4b(_0x428f49);});}});};exports[_0xd1b6('0x31')]=function isAuthenticated(_0x36833a){return compose()[_0xd1b6('0x32')](function(_0x33264c,_0x77a621,_0x5c63e1){var _0x4722da;if(_0x33264c[_0xd1b6('0x3e')][_0xd1b6('0x3f')]){if(_[_0xd1b6('0x40')](_0x33264c[_0xd1b6('0x3e')][_0xd1b6('0x3f')],_0xd1b6('0x41'))){var _0x501a51=basicAuth(_0x33264c);db[_0xd1b6('0x42')]['find']({'where':{'name':_0x501a51['name']}})[_0xd1b6('0x38')](function(_0x3f3868){if(!_0x3f3868||!_0x3f3868['authenticate'](_0x501a51[_0xd1b6('0x43')])){return _0x77a621[_0xd1b6('0x44')](0x191)['json']({'message':_0xd1b6('0x45')});}_0x33264c[_0xd1b6('0x33')]={'id':_0x3f3868['id']};_0x5c63e1();})[_0xd1b6('0x3d')](function(_0x3ad3ac){_0x5c63e1(_0x3ad3ac);});}else if(_[_0xd1b6('0x40')](_0x33264c['headers'][_0xd1b6('0x3f')],_0xd1b6('0x46'))){validateJwt(_0x33264c,_0x77a621,_0x5c63e1);}else{if(_0x36833a){_0x5c63e1();}else{return _0x77a621[_0xd1b6('0x44')](0x193)[_0xd1b6('0x3a')]({'message':_0xd1b6('0x47')});}}}else if(_0x33264c['query'][_0xd1b6('0x48')]){try{var _0x10c9c7={'audience':hardwareConf[_0xd1b6('0x49')](),'issuer':hardwareConf[_0xd1b6('0x49')]()};verifyJwt(_0x33264c[_0xd1b6('0x4a')][_0xd1b6('0x48')],_0x10c9c7)['then'](function(_0x13db2f){return db[_0xd1b6('0x42')]['find']({'where':{'id':_0x13db2f[_0xd1b6('0x4b')]}})['then'](function(_0x10d696){_0x4722da=_0x10d696;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0xd1b6('0x4c'),'blockDuration'],'raw':!![]});})[_0xd1b6('0x38')](function(_0x190156){if(!_0x4722da||!_[_0xd1b6('0x4d')](_0x4722da[_0xd1b6('0x4e')],_0x13db2f[_0xd1b6('0x4f')])){return _0x77a621[_0xd1b6('0x44')](0x191)[_0xd1b6('0x3a')]({'message':_0xd1b6('0x50')});}if(_0x4722da[_0xd1b6('0x51')]){return _0x77a621['status'](0x191)['json']({'message':_0xd1b6('0x52')});}if(_0x4722da[_0xd1b6('0x53')]){if(_0x190156['blockDuration']>0x0){if(moment(_0x4722da[_0xd1b6('0x54')])[_0xd1b6('0x55')](_0x190156[_0xd1b6('0x56')],_0xd1b6('0x57'))>moment()){return _0x77a621['status'](0x191)[_0xd1b6('0x3a')]({'message':_0xd1b6('0x52')});}}else{return _0x77a621[_0xd1b6('0x44')](0x191)[_0xd1b6('0x3a')]({'message':_0xd1b6('0x52')});}}_0x33264c[_0xd1b6('0x33')]={'id':_0x4722da['id']};_0x5c63e1();});})[_0xd1b6('0x3d')](function(){return _0x77a621[_0xd1b6('0x44')](0x191)[_0xd1b6('0x3a')]({'message':_0xd1b6('0x52')});});}catch(_0x4981e5){_0x5c63e1(_0x4981e5);}}else if(_0x36833a){_0x5c63e1();}else{return _0x77a621[_0xd1b6('0x44')](0x193)['json']({'message':_0xd1b6('0x47')});}})['use'](function(_0x465156,_0x10e309,_0x41a46f){if(_0x465156[_0xd1b6('0x33')]){db['User'][_0xd1b6('0x58')]({'where':{'id':_0x465156[_0xd1b6('0x33')]['id']},'attributes':userAttributes})[_0xd1b6('0x38')](function(_0x3a47a6){if(!_0x3a47a6){return _0x10e309[_0xd1b6('0x44')](0x194)[_0xd1b6('0x3a')]({'message':'User\x20not\x20found.'});}_0x465156[_0xd1b6('0x33')]=_0x3a47a6;_0x41a46f();})[_0xd1b6('0x3d')](function(_0x46ed7c){_0x41a46f(_0x46ed7c);});}else if(_0x36833a){_0x41a46f();}else{return _0x10e309[_0xd1b6('0x44')](0x194)[_0xd1b6('0x3a')]({'message':_0xd1b6('0x59')});}});};exports[_0xd1b6('0x5a')]=function canUpdate(){return compose()[_0xd1b6('0x32')](function(_0x56e93c,_0x18ffb3,_0x42bc7a){return licenseUtil[_0xd1b6('0x5b')]()[_0xd1b6('0x38')](function(_0x48ce0a){if(_0x48ce0a[_0xd1b6('0x5c')]){_0x42bc7a();}else{return _0x18ffb3[_0xd1b6('0x44')](0x193)['json']({'message':_0xd1b6('0x5d')});}})[_0xd1b6('0x3d')](function(_0x55255c){_0x42bc7a(_0x55255c);});});};exports[_0xd1b6('0x5e')]=function(_0x15efa8,_0x1b2353,_0xc0f143){_0x15efa8[_0xd1b6('0x5e')]=!![];return _0xc0f143();};exports[_0xd1b6('0x5f')]=function signToken(_0x2697e5){return signJwt(_0x2697e5);};exports['setTokenCookie']=function(_0x1d0f51,_0x290d76){if(!_0x1d0f51[_0xd1b6('0x33')]){return _0x290d76['status'](0x194)['json']({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x500c9d={'payload':{'id':_0x1d0f51['user']['id'],'role':_0x1d0f51[_0xd1b6('0x33')][_0xd1b6('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0x500c9d)[_0xd1b6('0x38')](function(_0x3b2bab){_0x290d76['cookie'](_0xd1b6('0x60'),_0x3b2bab);_0x290d76[_0xd1b6('0x61')]('/dashboards/general');})['catch'](function(_0x39210c){return _0x290d76[_0xd1b6('0x44')](0x1f4)[_0xd1b6('0x62')](_0x39210c);});};exports[_0xd1b6('0x63')]=function(_0x46643a){if(_[_0xd1b6('0x64')](_0x46643a[_0xd1b6('0x4e')])||_['isNil'](_0x46643a[_0xd1b6('0x65')])){return null;}else{return createJwt(_0x46643a);}};exports[_0xd1b6('0x66')]=function(_0x112ad1){_0x112ad1['apiKeyNonce']=generateNonce();_0x112ad1[_0xd1b6('0x65')]=generateIssuedAt();return createJwt(_0x112ad1);};exports[_0xd1b6('0x67')]=function(_0x410d46,_0x129903){var _0x1f98b5=_0x410d46[_0xd1b6('0x4a')][_0xd1b6('0x48')];if(_0x1f98b5){var _0x449313={'nonce':_0x129903[_0xd1b6('0x4e')],'iat':_0x129903['apiKeyIat'],'audience':hardwareConf[_0xd1b6('0x49')](),'issuer':hardwareConf[_0xd1b6('0x49')]()};return verifyJwt(_0x1f98b5,_0x449313)['then'](function(){return generateApiKey(_0x129903);});}else{throw{'message':_0xd1b6('0x68')};}};exports['validatePasswordPattern']=function(_0x3d63b0){var _0x2186c3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x2186c3[_0xd1b6('0x69')](_0x3d63b0))throw new db['Sequelize'][(_0xd1b6('0x6a'))](_0xd1b6('0x6b'));return;};exports[_0xd1b6('0x6c')]=function(_0x57a644,_0x1ee5de,_0x197e53){var _0x34866c=encryptor[_0xd1b6('0x6d')](_0x1ee5de)[_0xd1b6('0x6e')](',');for(var _0x2c885f=0x0;_0x2c885f<_0x197e53;_0x2c885f++){if(!_0x34866c[_0x2c885f])break;if(_0x57a644[_0xd1b6('0x6f')]()===_0x34866c[_0x2c885f][_0xd1b6('0x6f')]()){var _0x3420eb=util[_0xd1b6('0x70')](_0xd1b6('0x71'),_0x197e53);if(_0x197e53===0x1){_0x3420eb=_0xd1b6('0x72');}throw new db[(_0xd1b6('0x73'))][(_0xd1b6('0x6a'))](_0x3420eb);}}return;};exports[_0xd1b6('0x74')]=function(_0x589add,_0x257678){var _0x56d081=_0x257678?encryptor[_0xd1b6('0x6d')](_0x257678)['split'](','):[];if(_0x56d081[_0xd1b6('0x75')]===0x5){_0x56d081[_0xd1b6('0x76')](-0x1,0x1);}_0x56d081[_0xd1b6('0x77')](_0x589add);return encryptor[_0xd1b6('0x78')](_0x56d081['join'](','));};function signJwt(_0x1a6ca6){var _0x2be1bb=BPromise[_0xd1b6('0x79')](jwt['sign'],{'context':jwt});var _0x246b3a=_0x1a6ca6[_0xd1b6('0x7a')]||config[_0xd1b6('0xa')][_0xd1b6('0xb')];return new BPromise(function(_0x3b9622,_0x5357e2){_0x2be1bb(_0x1a6ca6[_0xd1b6('0x7b')],_0x246b3a,_0x1a6ca6[_0xd1b6('0x7c')])['then'](function(_0x5530b0){_0x3b9622(_0x5530b0);})['catch'](function(_0x2fd789){_0x5357e2(_0x2fd789);});});}function verifyJwt(_0x2d8ada,_0x10cbfb,_0x3c14c7){var _0xc64a3f=BPromise[_0xd1b6('0x79')](jwt[_0xd1b6('0x7d')],{'context':jwt});var _0x51b47c=_0x3c14c7||config[_0xd1b6('0xa')][_0xd1b6('0xb')];return new BPromise(function(_0x3ae657,_0x41dd61){_0xc64a3f(_0x2d8ada,_0x51b47c,_0x10cbfb)[_0xd1b6('0x38')](function(_0x97bbcf){_0x3ae657(_0x97bbcf);})['catch'](function(_0x2c122d){_0x41dd61(_0x2c122d);});});}function generateNonce(){return crypto[_0xd1b6('0x7e')](0x10)['toString']('hex');}function generateIssuedAt(){return Math['floor'](Date[_0xd1b6('0x7f')]()/0x3e8)[_0xd1b6('0x80')]();}function createJwt(_0xc5dfb5){var _0x697ea1={'payload':{'iat':_0xc5dfb5[_0xd1b6('0x65')],'nonce':_0xc5dfb5[_0xd1b6('0x4e')]},'options':{'algorithm':_0xd1b6('0x81'),'subject':_0xc5dfb5['id'][_0xd1b6('0x80')](),'issuer':hardwareConf[_0xd1b6('0x49')](),'audience':hardwareConf[_0xd1b6('0x49')]()}};return signJwt(_0x697ea1)['then'](function(_0x11d1eb){return{'iat':_0xc5dfb5[_0xd1b6('0x65')],'nonce':_0xc5dfb5[_0xd1b6('0x4e')],'token':_0x11d1eb};});} \ No newline at end of file +var _0x59da=['json','Unmanaged.','Forbidden.','catch','headers','authorization','startsWith','Basic','find','pass','status','Unknown\x20authorization\x20format','query','apikey','getUuid','User','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','user','User\x20object\x20not\x20found.','canUpdate','getLicense','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','ValidationError','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','length','splice','unshift','encryptString','join','promisify','sign','secret','payload','options','verify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../encryptor','lodash','express-jwt','composable-middleware','basic-auth','crypto','bluebird','moment','secrets','fullname','name','internal','userpic','permissions','md5secret','chatPause','mailPause','openchannelPause','pauseType','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableSettings','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','isChatInteractionAuthorized','isAuthenticated','use','findOne','disposition','then','closed','unmanaged'];(function(_0x400b43,_0x55da4e){var _0x3c330f=function(_0x5bbd52){while(--_0x5bbd52){_0x400b43['push'](_0x400b43['shift']());}};_0x3c330f(++_0x55da4e);}(_0x59da,0x140));var _0xa59d=function(_0x55bf76,_0x25edca){_0x55bf76=_0x55bf76-0x0;var _0xb12a3d=_0x59da[_0x55bf76];return _0xb12a3d;};'use strict';var db=require(_0xa59d('0x0'))['db'];var config=require(_0xa59d('0x1'));var hardwareConf=require(_0xa59d('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0xa59d('0x3'));var _=require(_0xa59d('0x4'));var jwt=require('jsonwebtoken');var expressJwt=require(_0xa59d('0x5'));var compose=require(_0xa59d('0x6'));var basicAuth=require(_0xa59d('0x7'));var crypto=require(_0xa59d('0x8'));var BPromise=require(_0xa59d('0x9'));var util=require('util');var moment=require(_0xa59d('0xa'));var validateJwt=expressJwt({'secret':config[_0xa59d('0xb')]['session']});var userAttributes=['id','role',_0xa59d('0xc'),_0xa59d('0xd'),_0xa59d('0xe'),'email',_0xa59d('0xf'),_0xa59d('0x10'),_0xa59d('0x11'),'voicePause',_0xa59d('0x12'),_0xa59d('0x13'),'faxPause','smsPause',_0xa59d('0x14'),_0xa59d('0x15'),'showWebBar',_0xa59d('0x16'),_0xa59d('0x17'),_0xa59d('0x18'),_0xa59d('0x19'),_0xa59d('0x1a'),_0xa59d('0x1b'),_0xa59d('0x1c'),'phoneBarAutoAnswerDelay',_0xa59d('0x1d'),_0xa59d('0x1e'),'phoneBarEnableDtmfTone',_0xa59d('0x1f'),'phoneBarExpires',_0xa59d('0x20'),_0xa59d('0x21'),_0xa59d('0x22'),'hotdesk','interface','userProfileId',_0xa59d('0x23'),_0xa59d('0x24'),_0xa59d('0x25'),_0xa59d('0x26'),_0xa59d('0x27'),_0xa59d('0x28')];exports[_0xa59d('0x29')]=function(){return this[_0xa59d('0x2a')](!![])[_0xa59d('0x2b')](function(_0x4443e9,_0x109061,_0x5904e2){if(_0x4443e9['user']){_0x5904e2();}else{return db['ChatInteraction'][_0xa59d('0x2c')]({'where':{'id':_0x4443e9['params']['id']},'attributes':['id','closed',_0xa59d('0x2d')],'raw':!![]})[_0xa59d('0x2e')](function(_0x3abf1d){if(_0x3abf1d&&_0x3abf1d[_0xa59d('0x2f')]){return _0x109061['status'](_0x3abf1d['disposition']===_0xa59d('0x30')?0x195:0x193)[_0xa59d('0x31')]({'message':_0x3abf1d[_0xa59d('0x2d')]==='unmanaged'?_0xa59d('0x32'):_0xa59d('0x33')});}else{_0x5904e2();}})[_0xa59d('0x34')](function(_0x319bbd){_0x5904e2(_0x319bbd);});}});};exports[_0xa59d('0x2a')]=function isAuthenticated(_0x339f70){return compose()[_0xa59d('0x2b')](function(_0x5b41f7,_0xd27bd6,_0xd02afd){var _0x7b44b2;if(_0x5b41f7[_0xa59d('0x35')][_0xa59d('0x36')]){if(_[_0xa59d('0x37')](_0x5b41f7[_0xa59d('0x35')][_0xa59d('0x36')],_0xa59d('0x38'))){var _0x25cd86=basicAuth(_0x5b41f7);db['User'][_0xa59d('0x39')]({'where':{'name':_0x25cd86['name']}})[_0xa59d('0x2e')](function(_0x2319a9){if(!_0x2319a9||!_0x2319a9['authenticate'](_0x25cd86[_0xa59d('0x3a')])){return _0xd27bd6[_0xa59d('0x3b')](0x191)[_0xa59d('0x31')]({'message':'Wrong\x20credentials.'});}_0x5b41f7['user']={'id':_0x2319a9['id']};_0xd02afd();})[_0xa59d('0x34')](function(_0x170d85){_0xd02afd(_0x170d85);});}else if(_[_0xa59d('0x37')](_0x5b41f7['headers'][_0xa59d('0x36')],'Bearer')){validateJwt(_0x5b41f7,_0xd27bd6,_0xd02afd);}else{if(_0x339f70){_0xd02afd();}else{return _0xd27bd6[_0xa59d('0x3b')](0x193)['json']({'message':_0xa59d('0x3c')});}}}else if(_0x5b41f7[_0xa59d('0x3d')][_0xa59d('0x3e')]){try{var _0x5618a0={'audience':hardwareConf[_0xa59d('0x3f')](),'issuer':hardwareConf[_0xa59d('0x3f')]()};verifyJwt(_0x5b41f7[_0xa59d('0x3d')][_0xa59d('0x3e')],_0x5618a0)[_0xa59d('0x2e')](function(_0x534cfa){return db[_0xa59d('0x40')][_0xa59d('0x39')]({'where':{'id':_0x534cfa['sub']}})[_0xa59d('0x2e')](function(_0x379a95){_0x7b44b2=_0x379a95;return db[_0xa59d('0x41')]['findOne']({'where':{'id':0x1},'attributes':[_0xa59d('0x42'),_0xa59d('0x43')],'raw':!![]});})[_0xa59d('0x2e')](function(_0x6cfe24){if(!_0x7b44b2||!_[_0xa59d('0x44')](_0x7b44b2[_0xa59d('0x45')],_0x534cfa[_0xa59d('0x46')])){return _0xd27bd6[_0xa59d('0x3b')](0x191)[_0xa59d('0x31')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x7b44b2[_0xa59d('0x47')]){return _0xd27bd6['status'](0x191)['json']({'message':_0xa59d('0x48')});}if(_0x7b44b2[_0xa59d('0x49')]){if(_0x6cfe24[_0xa59d('0x43')]>0x0){if(moment(_0x7b44b2[_0xa59d('0x4a')])[_0xa59d('0x4b')](_0x6cfe24[_0xa59d('0x43')],_0xa59d('0x4c'))>moment()){return _0xd27bd6[_0xa59d('0x3b')](0x191)[_0xa59d('0x31')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0xd27bd6[_0xa59d('0x3b')](0x191)[_0xa59d('0x31')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x5b41f7[_0xa59d('0x4d')]={'id':_0x7b44b2['id']};_0xd02afd();});})[_0xa59d('0x34')](function(){return _0xd27bd6[_0xa59d('0x3b')](0x191)[_0xa59d('0x31')]({'message':_0xa59d('0x48')});});}catch(_0x1507b3){_0xd02afd(_0x1507b3);}}else if(_0x339f70){_0xd02afd();}else{return _0xd27bd6[_0xa59d('0x3b')](0x193)['json']({'message':_0xa59d('0x3c')});}})[_0xa59d('0x2b')](function(_0x6d4f65,_0x2b07e5,_0x37abd7){if(_0x6d4f65[_0xa59d('0x4d')]){db['User'][_0xa59d('0x39')]({'where':{'id':_0x6d4f65[_0xa59d('0x4d')]['id']},'attributes':userAttributes})[_0xa59d('0x2e')](function(_0x456b8e){if(!_0x456b8e){return _0x2b07e5[_0xa59d('0x3b')](0x194)[_0xa59d('0x31')]({'message':'User\x20not\x20found.'});}_0x6d4f65[_0xa59d('0x4d')]=_0x456b8e;_0x37abd7();})[_0xa59d('0x34')](function(_0x48b70b){_0x37abd7(_0x48b70b);});}else if(_0x339f70){_0x37abd7();}else{return _0x2b07e5[_0xa59d('0x3b')](0x194)[_0xa59d('0x31')]({'message':_0xa59d('0x4e')});}});};exports[_0xa59d('0x4f')]=function canUpdate(){return compose()['use'](function(_0x534926,_0x1483bd,_0x22fb2e){return licenseUtil[_0xa59d('0x50')]()['then'](function(_0x4ad55c){if(_0x4ad55c['update']){_0x22fb2e();}else{return _0x1483bd[_0xa59d('0x3b')](0x193)[_0xa59d('0x31')]({'message':'Forbidden'});}})[_0xa59d('0x34')](function(_0x47dfe5){_0x22fb2e(_0x47dfe5);});});};exports[_0xa59d('0x51')]=function(_0x407dd0,_0x1b8993,_0x386692){_0x407dd0[_0xa59d('0x51')]=!![];return _0x386692();};exports[_0xa59d('0x52')]=function signToken(_0x341a21){return signJwt(_0x341a21);};exports[_0xa59d('0x53')]=function(_0x1fa9fd,_0x5bb473){if(!_0x1fa9fd[_0xa59d('0x4d')]){return _0x5bb473[_0xa59d('0x3b')](0x194)[_0xa59d('0x31')]({'message':_0xa59d('0x54')});}var _0x15fdcd={'payload':{'id':_0x1fa9fd[_0xa59d('0x4d')]['id'],'role':_0x1fa9fd[_0xa59d('0x4d')][_0xa59d('0x55')]},'options':{'expiresIn':0x15180}};return signJwt(_0x15fdcd)[_0xa59d('0x2e')](function(_0x268938){_0x5bb473[_0xa59d('0x56')](_0xa59d('0x57'),_0x268938);_0x5bb473[_0xa59d('0x58')](_0xa59d('0x59'));})[_0xa59d('0x34')](function(_0x30ad39){return _0x5bb473[_0xa59d('0x3b')](0x1f4)[_0xa59d('0x5a')](_0x30ad39);});};exports[_0xa59d('0x5b')]=function(_0x4f8a9c){if(_[_0xa59d('0x5c')](_0x4f8a9c[_0xa59d('0x45')])||_[_0xa59d('0x5c')](_0x4f8a9c[_0xa59d('0x5d')])){return null;}else{return createJwt(_0x4f8a9c);}};exports['generateApiKey']=function(_0x22c21f){_0x22c21f[_0xa59d('0x45')]=generateNonce();_0x22c21f[_0xa59d('0x5d')]=generateIssuedAt();return createJwt(_0x22c21f);};exports[_0xa59d('0x5e')]=function(_0x3698e3,_0x31bef1){var _0x162fb9=_0x3698e3[_0xa59d('0x3d')][_0xa59d('0x3e')];if(_0x162fb9){var _0x39760f={'nonce':_0x31bef1[_0xa59d('0x45')],'iat':_0x31bef1['apiKeyIat'],'audience':hardwareConf[_0xa59d('0x3f')](),'issuer':hardwareConf[_0xa59d('0x3f')]()};return verifyJwt(_0x162fb9,_0x39760f)['then'](function(){return generateApiKey(_0x31bef1);});}else{throw{'message':_0xa59d('0x5f')};}};exports[_0xa59d('0x60')]=function(_0x6480e1){var _0x26039f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x26039f['test'](_0x6480e1))throw new db['Sequelize'][(_0xa59d('0x61'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0xa59d('0x62')]=function(_0x57bfd6,_0x12c9c3,_0xae8e3f){var _0xd83ef3=encryptor[_0xa59d('0x63')](_0x12c9c3)[_0xa59d('0x64')](',');for(var _0x4180dd=0x0;_0x4180dd<_0xae8e3f;_0x4180dd++){if(!_0xd83ef3[_0x4180dd])break;if(_0x57bfd6['toLowerCase']()===_0xd83ef3[_0x4180dd][_0xa59d('0x65')]()){var _0x4416f4=util[_0xa59d('0x66')](_0xa59d('0x67'),_0xae8e3f);if(_0xae8e3f===0x1){_0x4416f4=_0xa59d('0x68');}throw new db[(_0xa59d('0x69'))]['ValidationError'](_0x4416f4);}}return;};exports['updatePasswordsHistory']=function(_0x2ffd57,_0x5db3fe){var _0x31256d=_0x5db3fe?encryptor[_0xa59d('0x63')](_0x5db3fe)['split'](','):[];if(_0x31256d[_0xa59d('0x6a')]===0x5){_0x31256d[_0xa59d('0x6b')](-0x1,0x1);}_0x31256d[_0xa59d('0x6c')](_0x2ffd57);return encryptor[_0xa59d('0x6d')](_0x31256d[_0xa59d('0x6e')](','));};function signJwt(_0xe38a87){var _0x5c6c89=BPromise[_0xa59d('0x6f')](jwt[_0xa59d('0x70')],{'context':jwt});var _0x40f96d=_0xe38a87[_0xa59d('0x71')]||config['secrets']['session'];return new BPromise(function(_0xabb25f,_0x230c73){_0x5c6c89(_0xe38a87[_0xa59d('0x72')],_0x40f96d,_0xe38a87[_0xa59d('0x73')])[_0xa59d('0x2e')](function(_0x1bd513){_0xabb25f(_0x1bd513);})[_0xa59d('0x34')](function(_0x39373a){_0x230c73(_0x39373a);});});}function verifyJwt(_0x95b6fe,_0x411de3,_0x2e5b23){var _0x9d8aaa=BPromise[_0xa59d('0x6f')](jwt[_0xa59d('0x74')],{'context':jwt});var _0x2a0738=_0x2e5b23||config['secrets']['session'];return new BPromise(function(_0x1d5c5c,_0x4024de){_0x9d8aaa(_0x95b6fe,_0x2a0738,_0x411de3)['then'](function(_0x3fb2de){_0x1d5c5c(_0x3fb2de);})[_0xa59d('0x34')](function(_0x55a549){_0x4024de(_0x55a549);});});}function generateNonce(){return crypto[_0xa59d('0x75')](0x10)[_0xa59d('0x76')](_0xa59d('0x77'));}function generateIssuedAt(){return Math[_0xa59d('0x78')](Date[_0xa59d('0x79')]()/0x3e8)[_0xa59d('0x76')]();}function createJwt(_0x3fafb4){var _0x3aa76a={'payload':{'iat':_0x3fafb4[_0xa59d('0x5d')],'nonce':_0x3fafb4[_0xa59d('0x45')]},'options':{'algorithm':_0xa59d('0x7a'),'subject':_0x3fafb4['id'][_0xa59d('0x76')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0xa59d('0x3f')]()}};return signJwt(_0x3aa76a)[_0xa59d('0x2e')](function(_0x54f08f){return{'iat':_0x3fafb4['apiKeyIat'],'nonce':_0x3fafb4[_0xa59d('0x45')],'token':_0x54f08f};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 74cd80a..8a50dab 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 _0x33b7=['encrypt','algorithm','join','error','filter','indexOf','encryptFile','createWriteStream','createCipher','data','update','write','end','final','binary','close','unlink','decryptFile','createReadStream','createDecipher','encryptString','secret','utf8','base64','decryptString','crypto','lodash','../../config/environment','../../config/logger','app','secrets','session','aes-256-ctr','aes192'];(function(_0x196e1b,_0x55fa06){var _0x5e1f18=function(_0x3bdb41){while(--_0x3bdb41){_0x196e1b['push'](_0x196e1b['shift']());}};_0x5e1f18(++_0x55fa06);}(_0x33b7,0x14b));var _0x733b=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x33b7[_0x5b561d];return _0x431060;};'use strict';var crypto=require(_0x733b('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x733b('0x1'));var config=require(_0x733b('0x2'));var logger=require(_0x733b('0x3'))(_0x733b('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x733b('0x5')][_0x733b('0x6')],'algorithm':_0x733b('0x7')};const fileOptions={'algorithm':_0x733b('0x8')};if(config[_0x733b('0x9')]&&config[_0x733b('0x9')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0x733b('0x9')][_0x733b('0xa')]);if(isSupported){fileOptions[_0x733b('0xa')]=config[_0x733b('0x9')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0x733b('0xb')](',\x20');logger[_0x733b('0xc')](config[_0x733b('0x9')][_0x733b('0xa')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x2ce41a){return AES_SUPPORTED_RX['test'](_0x2ce41a);}function getSupportedCiphers(){return crypto['getCiphers']()[_0x733b('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x1ab274){return getSupportedCiphers()[_0x733b('0xe')](_0x1ab274)>-0x1;}function combineOptions(_0x55c8ad){var _0x48388b={};for(var _0x55258c in fileOptions){if(fileOptions['hasOwnProperty'](_0x55258c)){_0x48388b[_0x55258c]=fileOptions[_0x55258c];}}if(_0x55c8ad){for(var _0x522623 in _0x55c8ad){if(_0x55c8ad['hasOwnProperty'](_0x522623)){_0x48388b[_0x522623]=_0x55c8ad[_0x522623];}}}return _0x48388b;}exports[_0x733b('0xf')]=function(_0x348c76,_0x330382,_0x261cdd,_0x3cd2df){return new BPromise(function(_0x1e4d79,_0x594126){_0x3cd2df=combineOptions(_0x3cd2df);var _0x545692=new Buffer(_0x261cdd);var _0x3f227a=fs['createReadStream'](_0x348c76);var _0xd1afe8=fs[_0x733b('0x10')](_0x330382);var _0x187593=crypto[_0x733b('0x11')](_0x3cd2df[_0x733b('0xa')],_0x545692);_0x3f227a['on'](_0x733b('0x12'),function(_0x36b280){var _0x1d28e2=new Buffer(_0x187593[_0x733b('0x13')](_0x36b280),'binary');_0xd1afe8[_0x733b('0x14')](_0x1d28e2);});_0x3f227a['on'](_0x733b('0x15'),function(){try{var _0x22af6e=new Buffer(_0x187593[_0x733b('0x16')](_0x733b('0x17')),'binary');_0xd1afe8[_0x733b('0x14')](_0x22af6e);_0xd1afe8[_0x733b('0x15')]();_0xd1afe8['on'](_0x733b('0x18'),function(){return _0x1e4d79(_0x330382);});}catch(_0x33b4fc){fs[_0x733b('0x19')](_0x330382);return _0x594126(_0x33b4fc);}});});};exports[_0x733b('0x1a')]=function(_0x326215,_0x19dd8c,_0x4f7413,_0x139373){return new BPromise(function(_0x1eadcc,_0x1083ef){_0x139373=combineOptions(_0x139373);var _0x275da6=new Buffer(_0x4f7413);var _0x313794=fs[_0x733b('0x1b')](_0x326215);var _0x5a122c=fs[_0x733b('0x10')](_0x19dd8c);var _0x1dda27=crypto[_0x733b('0x1c')](_0x139373[_0x733b('0xa')],_0x275da6);_0x313794['on']('data',function(_0x1f0ecf){var _0x4da924=new Buffer(_0x1dda27['update'](_0x1f0ecf),'binary');_0x5a122c[_0x733b('0x14')](_0x4da924);});_0x313794['on'](_0x733b('0x15'),function(){try{var _0x42f74d=new Buffer(_0x1dda27[_0x733b('0x16')](_0x733b('0x17')),_0x733b('0x17'));_0x5a122c[_0x733b('0x14')](_0x42f74d);_0x5a122c[_0x733b('0x15')]();_0x5a122c['on'](_0x733b('0x18'),function(){return _0x1eadcc(_0x19dd8c);});}catch(_0x2bd26a){fs[_0x733b('0x19')](_0x19dd8c);return _0x1083ef(_0x2bd26a);}});});};exports[_0x733b('0x1d')]=function(_0x150ff4,_0x463ed5,_0x7322d6){var _0x2a1d25=_0x7322d6||stringOptions['algorithm'];var _0x436523=_0x463ed5||stringOptions[_0x733b('0x1e')];var _0x523daf=crypto['createCipher'](_0x2a1d25,_0x436523);var _0x435a2d=_0x523daf[_0x733b('0x13')](_0x150ff4,_0x733b('0x1f'),_0x733b('0x20'));_0x435a2d+=_0x523daf[_0x733b('0x16')](_0x733b('0x20'));return _0x435a2d;};exports[_0x733b('0x21')]=function(_0x3fbe35,_0x57fa00,_0x5e4458){var _0x16032a=_0x5e4458||stringOptions[_0x733b('0xa')];var _0x5a0492=_0x57fa00||stringOptions[_0x733b('0x1e')];var _0xfda18=crypto['createDecipher'](_0x16032a,_0x5a0492);var _0x2f93c3=_0xfda18[_0x733b('0x13')](_0x3fbe35,_0x733b('0x20'),_0x733b('0x1f'));_0x2f93c3+=_0xfda18[_0x733b('0x16')](_0x733b('0x1f'));return _0x2f93c3;}; \ No newline at end of file +var _0xc55d=['binary','write','final','end','unlink','decryptFile','createDecipher','data','update','close','secret','utf8','base64','decryptString','crypto','bluebird','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher'];(function(_0x5e57a4,_0x458c5d){var _0x5e35fd=function(_0x408940){while(--_0x408940){_0x5e57a4['push'](_0x5e57a4['shift']());}};_0x5e35fd(++_0x458c5d);}(_0xc55d,0x92));var _0xdc55=function(_0x3b2a54,_0x11f298){_0x3b2a54=_0x3b2a54-0x0;var _0xe00143=_0xc55d[_0x3b2a54];return _0xe00143;};'use strict';var crypto=require(_0xdc55('0x0'));var fs=require('fs');var BPromise=require(_0xdc55('0x1'));var _=require('lodash');var config=require('../../config/environment');var logger=require('../../config/logger')(_0xdc55('0x2'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xdc55('0x3')][_0xdc55('0x4')],'algorithm':_0xdc55('0x5')};const fileOptions={'algorithm':_0xdc55('0x6')};if(config['encrypt']&&config[_0xdc55('0x7')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0xdc55('0x7')][_0xdc55('0x8')]);if(isSupported){fileOptions['algorithm']=config[_0xdc55('0x7')][_0xdc55('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xdc55('0x9')](',\x20');logger['error'](config[_0xdc55('0x7')]['algorithm'],_0xdc55('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x3d3439){return AES_SUPPORTED_RX[_0xdc55('0xb')](_0x3d3439);}function getSupportedCiphers(){return crypto['getCiphers']()[_0xdc55('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x4cf62e){return getSupportedCiphers()[_0xdc55('0xd')](_0x4cf62e)>-0x1;}function combineOptions(_0x5af371){var _0x1226a9={};for(var _0x553e5c in fileOptions){if(fileOptions[_0xdc55('0xe')](_0x553e5c)){_0x1226a9[_0x553e5c]=fileOptions[_0x553e5c];}}if(_0x5af371){for(var _0xa71531 in _0x5af371){if(_0x5af371[_0xdc55('0xe')](_0xa71531)){_0x1226a9[_0xa71531]=_0x5af371[_0xa71531];}}}return _0x1226a9;}exports[_0xdc55('0xf')]=function(_0x4e557b,_0x3b94e4,_0x268b07,_0x930a9){return new BPromise(function(_0x94a408,_0x357ef4){_0x930a9=combineOptions(_0x930a9);var _0x5ebc27=new Buffer(_0x268b07);var _0x73a4f5=fs[_0xdc55('0x10')](_0x4e557b);var _0x53f42d=fs[_0xdc55('0x11')](_0x3b94e4);var _0xe04dfc=crypto[_0xdc55('0x12')](_0x930a9['algorithm'],_0x5ebc27);_0x73a4f5['on']('data',function(_0x4f31a2){var _0x2126f9=new Buffer(_0xe04dfc['update'](_0x4f31a2),_0xdc55('0x13'));_0x53f42d[_0xdc55('0x14')](_0x2126f9);});_0x73a4f5['on']('end',function(){try{var _0x31699b=new Buffer(_0xe04dfc[_0xdc55('0x15')](_0xdc55('0x13')),_0xdc55('0x13'));_0x53f42d['write'](_0x31699b);_0x53f42d[_0xdc55('0x16')]();_0x53f42d['on']('close',function(){return _0x94a408(_0x3b94e4);});}catch(_0x48e9e3){fs[_0xdc55('0x17')](_0x3b94e4);return _0x357ef4(_0x48e9e3);}});});};exports[_0xdc55('0x18')]=function(_0x2d7876,_0x17e9bb,_0x234eeb,_0x4bc3f6){return new BPromise(function(_0x5cc0c9,_0x41a596){_0x4bc3f6=combineOptions(_0x4bc3f6);var _0x13e9f9=new Buffer(_0x234eeb);var _0x245217=fs[_0xdc55('0x10')](_0x2d7876);var _0x2e6ff1=fs['createWriteStream'](_0x17e9bb);var _0x5587a9=crypto[_0xdc55('0x19')](_0x4bc3f6[_0xdc55('0x8')],_0x13e9f9);_0x245217['on'](_0xdc55('0x1a'),function(_0x30f4bc){var _0x3c75a2=new Buffer(_0x5587a9[_0xdc55('0x1b')](_0x30f4bc),'binary');_0x2e6ff1['write'](_0x3c75a2);});_0x245217['on'](_0xdc55('0x16'),function(){try{var _0x3d1507=new Buffer(_0x5587a9[_0xdc55('0x15')](_0xdc55('0x13')),'binary');_0x2e6ff1[_0xdc55('0x14')](_0x3d1507);_0x2e6ff1[_0xdc55('0x16')]();_0x2e6ff1['on'](_0xdc55('0x1c'),function(){return _0x5cc0c9(_0x17e9bb);});}catch(_0x404fc9){fs[_0xdc55('0x17')](_0x17e9bb);return _0x41a596(_0x404fc9);}});});};exports['encryptString']=function(_0x5086d6,_0x445d86,_0x5e3d5e){var _0x2e27c6=_0x5e3d5e||stringOptions[_0xdc55('0x8')];var _0x315ed8=_0x445d86||stringOptions[_0xdc55('0x1d')];var _0x13ec0e=crypto[_0xdc55('0x12')](_0x2e27c6,_0x315ed8);var _0x29c98b=_0x13ec0e[_0xdc55('0x1b')](_0x5086d6,_0xdc55('0x1e'),'base64');_0x29c98b+=_0x13ec0e[_0xdc55('0x15')](_0xdc55('0x1f'));return _0x29c98b;};exports[_0xdc55('0x20')]=function(_0x112c9d,_0x484cda,_0x4ebb60){var _0x2fe586=_0x4ebb60||stringOptions[_0xdc55('0x8')];var _0x3a6f55=_0x484cda||stringOptions[_0xdc55('0x1d')];var _0x414e28=crypto[_0xdc55('0x19')](_0x2fe586,_0x3a6f55);var _0x58bef3=_0x414e28[_0xdc55('0x1b')](_0x112c9d,_0xdc55('0x1f'),_0xdc55('0x1e'));_0x58bef3+=_0x414e28['final'](_0xdc55('0x1e'));return _0x58bef3;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 203b1fc..bc3a074 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 _0x6e6c=['length','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.csv','join','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','util','path','to-csv','bluebird','../../mysqldb','dbH','analytics','argv','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','then','splitSizeCsv','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty'];(function(_0x5d70d6,_0x5b30da){var _0x1ee4a6=function(_0x1608ec){while(--_0x1608ec){_0x5d70d6['push'](_0x5d70d6['shift']());}};_0x1ee4a6(++_0x5b30da);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6e6c[_0x2dafbe];return _0x58a45a;};'use strict';var util=require(_0xc6e6('0x0'));var path=require(_0xc6e6('0x1'));var _=require('lodash');var csv=require(_0xc6e6('0x2'));var fs=require('fs');var BPromise=require(_0xc6e6('0x3'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var db=require(_0xc6e6('0x4'))['db'];var dbH=require('../../mysqldb')[_0xc6e6('0x5')];var logger=require('../../config/logger')(_0xc6e6('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0xc6e6('0x7')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xc6e6('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x30a10b,_0x4da7bd){var _0x324706={'status':_0x30a10b};var _0x15d268={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4da7bd){_0x324706['savename']=_0x4da7bd;}return db[_0xc6e6('0x8')]['update'](_0x324706,_0x15d268);}function main(){var _0x172aa9=0x1388;var _0x3b2f50;logger[_0xc6e6('0x9')](util[_0xc6e6('0xa')](_0xc6e6('0xb'),EXTRACTED_REPORT_ID,_0xc6e6('0xc')));return db[_0xc6e6('0xd')][_0xc6e6('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xc6e6('0xf'),'splitSizeCsv']})[_0xc6e6('0x10')](function(_0x525d60){if(_0x525d60){_0x3b2f50=_0x525d60;_0x172aa9=_0x3b2f50[_0xc6e6('0x11')]||0x1388;}})[_0xc6e6('0x10')](function(){return dbH[_0xc6e6('0x12')][_0xc6e6('0x13')](util['format'](_0xc6e6('0x14'),QUERY),{'type':dbH[_0xc6e6('0x12')][_0xc6e6('0x15')][_0xc6e6('0x16')]});})[_0xc6e6('0x10')](function(_0x4cdf15){if(!_0x4cdf15[0x0][_0xc6e6('0x17')]){return analyticExtractedReport(_0xc6e6('0x18'));}var _0x569474=[];var _0x2f11b0=0x0;var _0x144039=!![];if(_0x4cdf15&&_0x4cdf15[_0xc6e6('0x19')]){var _0x4c978d=_0x4cdf15[0x0]['num']%(_0x2f11b0+_0x172aa9);if(_0x3b2f50['split']){for(;_0x144039;_0x2f11b0+=_0x172aa9,_0x4c978d=_0x4cdf15[0x0][_0xc6e6('0x17')]%(_0x2f11b0+_0x172aa9)){if(_0x4c978d==0x0||_0x4c978d==_0x4cdf15[0x0]['num']){_0x144039=![];}_0x569474[_0xc6e6('0x1a')](dbH[_0xc6e6('0x12')][_0xc6e6('0x13')](util[_0xc6e6('0xa')](_0xc6e6('0x1b'),QUERY,_0x172aa9,_0x2f11b0),{'type':dbH[_0xc6e6('0x12')][_0xc6e6('0x15')][_0xc6e6('0x16')]}));}}else{_0x569474[_0xc6e6('0x1a')](dbH[_0xc6e6('0x12')]['query'](QUERY,{'type':dbH[_0xc6e6('0x12')]['QueryTypes'][_0xc6e6('0x16')]}));}}var _0x1667b8=path[_0xc6e6('0x1c')](PATH);var _0x2f69f1=path['basename'](PATH,_0xc6e6('0x1d'));var _0xc87d11=_0x3b2f50[_0xc6e6('0xf')]&&_0x569474[_0xc6e6('0x19')]>0x1;var _0x107561=[];if(!fs['existsSync'](path[_0xc6e6('0x1e')](_0x1667b8,_0x2f69f1))&&_0xc87d11){fs['mkdirSync'](path[_0xc6e6('0x1e')](_0x1667b8,_0x2f69f1));}return BPromise[_0xc6e6('0x1f')](_0x569474,function(_0x2e5e0e){_0x107561[_0xc6e6('0x1a')](_0x2e5e0e);})['then'](function(){for(var _0x3ff8a4=0x0;_0x3ff8a4<_0x107561['length'];_0x3ff8a4+=0x1){var _0x28577b;var _0x534745=_0x107561[_0x3ff8a4];if(_0xc87d11){_0x28577b=path[_0xc6e6('0x1e')](_0x1667b8,_0x2f69f1,util[_0xc6e6('0xa')](_0xc6e6('0x20'),_0x2f69f1,_0x3ff8a4,_0xc6e6('0x21')));}else{_0x28577b=path[_0xc6e6('0x1e')](_0x1667b8,util['format'](_0xc6e6('0x22'),_0x2f69f1,_0xc6e6('0x21')));}fs[_0xc6e6('0x23')](_0x28577b,csv(_0x534745));}})[_0xc6e6('0x10')](function(){if(_0xc87d11){zipdir(path['join'](_0x1667b8,_0x2f69f1),{'saveTo':path[_0xc6e6('0x1e')](_0x1667b8,util['format'](_0xc6e6('0x22'),_0x2f69f1,_0xc6e6('0x24')))},function(_0x12c616,_0xc578b3){});rimraf(path[_0xc6e6('0x1e')](_0x1667b8,_0x2f69f1),function(){});}})[_0xc6e6('0x10')](function(){logger[_0xc6e6('0x9')](util[_0xc6e6('0xa')](_0xc6e6('0x25'),EXTRACTED_REPORT_ID,_0xc6e6('0xc')));return analyticExtractedReport(_0xc6e6('0x26'),_0xc87d11?util[_0xc6e6('0xa')](_0xc6e6('0x22'),_0x2f69f1,_0xc87d11?_0xc6e6('0x24'):_0xc6e6('0x21')):null);});})[_0xc6e6('0x27')](function(_0x1972da){logger['info'](util[_0xc6e6('0xa')](_0xc6e6('0x28'),EXTRACTED_REPORT_ID,'CSV'),util['inspect'](_0x1972da,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xc6e6('0x29'));})[_0xc6e6('0x2a')](function(){process[_0xc6e6('0x2b')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x6953=['writeFileSync','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','inspect','Failed','finally','exit','util','path','zip-dir','../../mysqldb','dbH','analytics','argv','savename','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','push','dirname','basename','.csv','join','mkdirSync','each','%s%d.%s','csv'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x6953,0x91));var _0x3695=function(_0x176475,_0x1f707c){_0x176475=_0x176475-0x0;var _0x177966=_0x6953[_0x176475];return _0x177966;};'use strict';var util=require(_0x3695('0x0'));var path=require(_0x3695('0x1'));var _=require('lodash');var csv=require('to-csv');var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x3695('0x2'));var rimraf=require('rimraf');var db=require(_0x3695('0x3'))['db'];var dbH=require(_0x3695('0x3'))[_0x3695('0x4')];var logger=require('../../config/logger')(_0x3695('0x5'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x3695('0x6')][0x3];var PATH=process[_0x3695('0x6')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x912099,_0x1a4e75){var _0x301e46={'status':_0x912099};var _0x4e337b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1a4e75){_0x301e46[_0x3695('0x7')]=_0x1a4e75;}return db['AnalyticExtractedReport'][_0x3695('0x8')](_0x301e46,_0x4e337b);}function main(){var _0x4b8f82=0x1388;var _0x523edd;logger[_0x3695('0x9')](util['format'](_0x3695('0xa'),EXTRACTED_REPORT_ID,_0x3695('0xb')));return db[_0x3695('0xc')][_0x3695('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x3695('0xe'),_0x3695('0xf')]})['then'](function(_0x19080e){if(_0x19080e){_0x523edd=_0x19080e;_0x4b8f82=_0x523edd[_0x3695('0xf')]||0x1388;}})[_0x3695('0x10')](function(){return dbH[_0x3695('0x11')][_0x3695('0x12')](util[_0x3695('0x13')](_0x3695('0x14'),QUERY),{'type':dbH[_0x3695('0x11')][_0x3695('0x15')][_0x3695('0x16')]});})[_0x3695('0x10')](function(_0x4ca317){if(!_0x4ca317[0x0][_0x3695('0x17')]){return analyticExtractedReport(_0x3695('0x18'));}var _0x2cdd3=[];var _0x3cb320=0x0;var _0x367191=!![];if(_0x4ca317&&_0x4ca317[_0x3695('0x19')]){var _0x36c3a4=_0x4ca317[0x0]['num']%(_0x3cb320+_0x4b8f82);if(_0x523edd[_0x3695('0xe')]){for(;_0x367191;_0x3cb320+=_0x4b8f82,_0x36c3a4=_0x4ca317[0x0]['num']%(_0x3cb320+_0x4b8f82)){if(_0x36c3a4==0x0||_0x36c3a4==_0x4ca317[0x0][_0x3695('0x17')]){_0x367191=![];}_0x2cdd3[_0x3695('0x1a')](dbH[_0x3695('0x11')][_0x3695('0x12')](util[_0x3695('0x13')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x4b8f82,_0x3cb320),{'type':dbH[_0x3695('0x11')][_0x3695('0x15')][_0x3695('0x16')]}));}}else{_0x2cdd3[_0x3695('0x1a')](dbH[_0x3695('0x11')][_0x3695('0x12')](QUERY,{'type':dbH[_0x3695('0x11')][_0x3695('0x15')][_0x3695('0x16')]}));}}var _0xbbffe2=path[_0x3695('0x1b')](PATH);var _0xf2c747=path[_0x3695('0x1c')](PATH,_0x3695('0x1d'));var _0x5340f2=_0x523edd[_0x3695('0xe')]&&_0x2cdd3[_0x3695('0x19')]>0x1;var _0x4899c0=[];if(!fs['existsSync'](path[_0x3695('0x1e')](_0xbbffe2,_0xf2c747))&&_0x5340f2){fs[_0x3695('0x1f')](path[_0x3695('0x1e')](_0xbbffe2,_0xf2c747));}return BPromise[_0x3695('0x20')](_0x2cdd3,function(_0x534d38){_0x4899c0[_0x3695('0x1a')](_0x534d38);})['then'](function(){for(var _0xeddb06=0x0;_0xeddb06<_0x4899c0['length'];_0xeddb06+=0x1){var _0xe085de;var _0x5adea3=_0x4899c0[_0xeddb06];if(_0x5340f2){_0xe085de=path[_0x3695('0x1e')](_0xbbffe2,_0xf2c747,util[_0x3695('0x13')](_0x3695('0x21'),_0xf2c747,_0xeddb06,_0x3695('0x22')));}else{_0xe085de=path[_0x3695('0x1e')](_0xbbffe2,util[_0x3695('0x13')]('%s.%s',_0xf2c747,_0x3695('0x22')));}fs[_0x3695('0x23')](_0xe085de,csv(_0x5adea3));}})['then'](function(){if(_0x5340f2){zipdir(path[_0x3695('0x1e')](_0xbbffe2,_0xf2c747),{'saveTo':path['join'](_0xbbffe2,util[_0x3695('0x13')](_0x3695('0x24'),_0xf2c747,_0x3695('0x25')))},function(_0x23ac01,_0x30a5ba){});rimraf(path[_0x3695('0x1e')](_0xbbffe2,_0xf2c747),function(){});}})[_0x3695('0x10')](function(){logger[_0x3695('0x9')](util['format'](_0x3695('0x26'),EXTRACTED_REPORT_ID,_0x3695('0xb')));return analyticExtractedReport(_0x3695('0x27'),_0x5340f2?util['format']('%s.%s',_0xf2c747,_0x5340f2?_0x3695('0x25'):'csv'):null);});})[_0x3695('0x28')](function(_0x471e4b){logger['info'](util[_0x3695('0x13')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x3695('0xb')),util[_0x3695('0x29')](_0x471e4b,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x3695('0x2a'));})[_0x3695('0x2b')](function(){process[_0x3695('0x2c')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index f69a5a2..82e0a8e 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 _0x451f=['Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','channel','interactionId','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','createWriteStream','finish','error','createPdfFromHTML','catch','lodash','util','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','JSDOM','window','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','map','tableHeader','toString','fill','length','auto','body','push','concat','chunk','keys','forEach','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','format','endDate','header','pageBreak','before','margin','landscape','\x20/\x20','footer','Arial','right','Empty','basename','.pdf','join','%s.%s','pdf','Setting','split','then','num','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','sequelize','existsSync','mkdirSync','all','flatten','createPdfKitDocument','%s%d.%s','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','zip'];(function(_0x3892b9,_0x5dcabb){var _0x3d9e64=function(_0x3cf5fb){while(--_0x3cf5fb){_0x3892b9['push'](_0x3892b9['shift']());}};_0x3d9e64(++_0x5dcabb);}(_0x451f,0x1cf));var _0xf451=function(_0x17fe90,_0x3f0e3c){_0x17fe90=_0x17fe90-0x0;var _0x1230f8=_0x451f[_0x17fe90];return _0x1230f8;};'use strict';var _=require(_0xf451('0x0'));var fs=require('fs');var util=require(_0xf451('0x1'));var path=require('path');var moment=require(_0xf451('0x2'));var htmlToPdfmake=require(_0xf451('0x3'));var PdfPrinter=require(_0xf451('0x4'));var zipdir=require(_0xf451('0x5'));var rimraf=require('rimraf');var JSDOM=require('jsdom')[_0xf451('0x6')];var window=new JSDOM('')[_0xf451('0x7')];var db=require(_0xf451('0x8'))['db'];var dbH=require('../../mysqldb')[_0xf451('0x9')];var logger=require(_0xf451('0xa'))(_0xf451('0xb'));var EXTRACTED_REPORT_ID=Number(process[_0xf451('0xc')][0x2]);var QUERY=process[_0xf451('0xc')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xf451('0xc')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x383a9f,_0xcdee06){var _0x4a768a={'status':_0x383a9f};var _0x43525b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xcdee06){_0x4a768a[_0xf451('0xd')]=_0xcdee06;}return db[_0xf451('0xe')]['update'](_0x4a768a,_0x43525b);}function getHeaders(_0x25a0f2){return _[_0xf451('0xf')](_0x25a0f2,function(_0x919595){return{'text':_0x919595,'style':_0xf451('0x10')};});}function getRows(_0x27afb3,_0xa6748e){return _[_0xf451('0xf')](_0xa6748e,function(_0x812456){return _(_0x812456)['pick'](_0x27afb3)[_0xf451('0xf')](function(_0x5b785c){return _0x5b785c?_[_0xf451('0x11')](_0x5b785c):'';})['value']();});}function createTable(_0x220d73,_0x115441){var _0x35827c={'widths':_[_0xf451('0x12')](Array(_0x220d73[_0xf451('0x13')]),0x91),'heights':function(_0x1fb319){return _0x1fb319===0x0?_0xf451('0x14'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x45f8b1=getHeaders(_0x220d73);_0x35827c[_0xf451('0x15')][_0xf451('0x16')](_0x45f8b1);var _0x16a07f=getRows(_0x220d73,_0x115441);_0x35827c['body']=_0x35827c[_0xf451('0x15')][_0xf451('0x17')](_0x16a07f);return _0x35827c;}function createTables(_0x32b6a1){var _0x44c169=[];var _0x3267fb=_[_0xf451('0x18')](Object[_0xf451('0x19')](_0x32b6a1[0x0]),0x5);_0x3267fb[_0xf451('0x1a')](function(_0x367111){_0x44c169[_0xf451('0x16')](createTable(_0x367111,_0x32b6a1));});return _0x44c169;}function getPDFDocDefinition(_0x39f49d){var _0x16d72b=util['format'](_0xf451('0x1b'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0xf451('0x1c')])[_0xf451('0x1d')](FORMAT),moment(EXTRACTED_REPORT[_0xf451('0x1e')])[_0xf451('0x1d')](FORMAT));var _0x1594c4=[];for(var _0x323ded=0x0;_0x323ded<_0x39f49d[_0xf451('0x13')];_0x323ded++){var _0x373a13=[];if(_0x323ded===0x0){_0x373a13[_0xf451('0x16')]({'text':_0x16d72b,'style':_0xf451('0x1f')});}var _0x9bc6fa={'table':_0x39f49d[_0x323ded]};if(_0x323ded>0x0){_0x9bc6fa[_0xf451('0x20')]=_0xf451('0x21');_0x9bc6fa[_0xf451('0x22')]=[0x0,0x46,0x0,0x0];}_0x373a13[_0xf451('0x16')](_0x9bc6fa);_0x1594c4[_0xf451('0x16')](_0x373a13);}return{'pageSize':'A4','pageOrientation':_0xf451('0x23'),'content':_0x1594c4,'footer':function(_0x235248,_0x51773f){return{'text':_0x235248[_0xf451('0x11')]()+_0xf451('0x24')+_0x51773f,'style':_0xf451('0x25')};},'defaultStyle':{'font':_0xf451('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0xf451('0x27'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x412ef7){var _0x3636d0=0x1388;var _0x4e7b09;if(!_0x412ef7[0x0]['num']){return analyticExtractedReport(_0xf451('0x28'));}var _0x7d3b49=[];var _0x449be5=0x0;var _0x3b9a5b=!![];var _0x4113e6=path['dirname'](PATH);var _0xba774b=path[_0xf451('0x29')](PATH,_0xf451('0x2a'));var _0x5ce540=path[_0xf451('0x2b')](_0x4113e6,util['format'](_0xf451('0x2c'),_0xba774b,_0xf451('0x2d')));var _0x2ac554=![];return db[_0xf451('0x2e')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf451('0x2f'),'splitSizePdf']})[_0xf451('0x30')](function(_0x12e817){if(_0x12e817){_0x4e7b09=_0x12e817;_0x3636d0=_0x4e7b09['splitSizePdf']||0x3e8;}})['then'](function(){if(_0x412ef7&&_0x412ef7['length']){var _0x5ba6ed=_0x412ef7[0x0][_0xf451('0x31')]%(_0x449be5+_0x3636d0);if(_0x4e7b09['split']){for(;_0x3b9a5b;_0x449be5+=_0x3636d0,_0x5ba6ed=_0x412ef7[0x0][_0xf451('0x31')]%(_0x449be5+_0x3636d0)){if(_0x5ba6ed==0x0||_0x5ba6ed==_0x412ef7[0x0]['num']){_0x3b9a5b=![];}_0x7d3b49[_0xf451('0x16')](dbH['sequelize'][_0xf451('0x32')](util[_0xf451('0x1d')](_0xf451('0x33'),QUERY,_0x3636d0,_0x449be5),{'type':dbH['sequelize'][_0xf451('0x34')][_0xf451('0x35')]}));}}else{_0x7d3b49[_0xf451('0x16')](dbH['sequelize'][_0xf451('0x32')](QUERY,{'type':dbH[_0xf451('0x36')][_0xf451('0x34')]['SELECT']}));}}_0x2ac554=_0x4e7b09[_0xf451('0x2f')]&&_0x7d3b49['length']>0x1;if(!fs[_0xf451('0x37')](path['join'](_0x4113e6,_0xba774b))&&_0x2ac554){fs[_0xf451('0x38')](path[_0xf451('0x2b')](_0x4113e6,_0xba774b));}return Promise[_0xf451('0x39')](_0x7d3b49);})[_0xf451('0x30')](function(_0x3c33bb){return createTables(_[_0xf451('0x3a')](_0x3c33bb));})[_0xf451('0x30')](function(_0x1c64bb){var _0x51e002=getPDFDocDefinition(_0x1c64bb);var _0x58b0d7=getPDFPrinter();var _0x5a3753=_0x58b0d7[_0xf451('0x3b')](_0x51e002);if(_0x2ac554)_0x5ce540=path[_0xf451('0x2b')](_0x4113e6,_0xba774b,util[_0xf451('0x1d')](_0xf451('0x3c'),_0xba774b,index,_0xf451('0x2d')));return writePDFDocument(_0x5a3753,_0x5ce540);})[_0xf451('0x30')](function(){if(!_0x2ac554)return;zipdir(path[_0xf451('0x2b')](_0x4113e6,_0xba774b),{'saveTo':path[_0xf451('0x2b')](_0x4113e6,util[_0xf451('0x1d')](_0xf451('0x2c'),_0xba774b,'zip'))},function(_0x5aedc3){if(_0x5aedc3)throw _0x5aedc3;return;});})[_0xf451('0x30')](function(){if(!_0x2ac554)return;rimraf(path['join'](_0x4113e6,_0xba774b),function(){});})[_0xf451('0x30')](function(){logger[_0xf451('0x3d')](util[_0xf451('0x1d')](_0xf451('0x3e'),EXTRACTED_REPORT_ID,_0xf451('0x3f')));return analyticExtractedReport('Completed',_0x2ac554?util[_0xf451('0x1d')](_0xf451('0x2c'),_0xba774b,_0x2ac554?_0xf451('0x40'):_0xf451('0x2d')):null);});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xf451('0x3d')](util[_0xf451('0x1d')](_0xf451('0x41'),EXTRACTED_REPORT_ID,_0xf451('0x42')));return db['AnalyticExtractedReport'][_0xf451('0x43')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xf451('0x30')](function(_0x3cb482){EXTRACTED_REPORT=_0x3cb482;return dbH[_0xf451('0x36')][_0xf451('0x32')](util[_0xf451('0x1d')](_0xf451('0x44'),QUERY),{'type':dbH[_0xf451('0x36')][_0xf451('0x34')][_0xf451('0x35')]});})[_0xf451('0x30')](extractReport)['catch'](function(_0x100562){logger[_0xf451('0x3d')](util[_0xf451('0x1d')](_0xf451('0x45'),EXTRACTED_REPORT_ID,_0xf451('0x42')),util[_0xf451('0x46')](_0x100562,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xf451('0x47'));})[_0xf451('0x48')](function(){process[_0xf451('0x49')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x51c6ed=new PdfPrinter({'Arial':{'normal':__dirname+_0xf451('0x4a'),'bold':__dirname+_0xf451('0x4b'),'italics':__dirname+_0xf451('0x4c'),'bolditalics':__dirname+_0xf451('0x4d')}});return _0x51c6ed;}function getPDFDocDefinitionFromHTML(_0x854bce,_0x56b4c1){var _0x38bac0=util[_0xf451('0x1d')]('%s\x20#%d',_0x56b4c1[_0xf451('0x4e')],_0x56b4c1[_0xf451('0x4f')]);var _0x53a215=moment()['format']('YYYY-MM-DD')['toString']();var _0x355124=htmlToPdfmake(_0x854bce,{'window':window,'tableAutoSize':!![]});return{'content':[_0x355124],'defaultStyle':{'font':_0xf451('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xf451('0x50'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xf451('0x50'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0xf451('0x51'),'style':'header'}];},'footer':function(_0x5918dd,_0x475822){return[{'text':util[_0xf451('0x1d')](_0xf451('0x52'),_0x38bac0,_0x5918dd,_0x475822,_0x53a215),'style':_0xf451('0x25')}];}};}function writePDFDocument(_0x1bb092,_0xcdcbf3){return new Promise(function(_0x28d13d,_0x134075){var _0x5786a7=_0x1bb092['pipe'](fs[_0xf451('0x53')](_0xcdcbf3));_0x5786a7['on'](_0xf451('0x54'),function(){_0x28d13d(_0xf451('0x54'));});_0x5786a7['on'](_0xf451('0x55'),function(_0x174c9a){_0x134075(_0x174c9a);});_0x1bb092['end']();});}exports[_0xf451('0x56')]=function(_0x3d56be,_0x47b209){var _0x3c5cfc=getPDFPrinter();var _0x34d4da=getPDFDocDefinitionFromHTML(_0x3d56be,_0x47b209);var _0x5e71fc=_0x3c5cfc['createPdfKitDocument'](_0x34d4da);return writePDFDocument(_0x5e71fc,_0x47b209['path'])[_0xf451('0x57')](function(_0x2acda0){throw _0x2acda0;});}; \ No newline at end of file +var _0x27c7=['dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','map','tableHeader','pick','toString','value','auto','body','push','concat','chunk','keys','forEach','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','format','endDate','length','header','pageBreak','before','margin','landscape','footer','Arial','black','right','num','Empty','basename','.pdf','join','pdf','Setting','find','splitSizePdf','then','split','sequelize','query','QueryTypes','SELECT','existsSync','all','flatten','createPdfKitDocument','%s%d.%s','%s.%s','zip','info','CSV','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','inspect','Failed','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','lodash','path','moment','html-to-pdfmake','pdfmake/src/printer','jsdom','JSDOM','window','../../mysqldb'];(function(_0x3425f9,_0x2358ca){var _0x814f39=function(_0x4cb267){while(--_0x4cb267){_0x3425f9['push'](_0x3425f9['shift']());}};_0x814f39(++_0x2358ca);}(_0x27c7,0x1be));var _0x727c=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x27c7[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x727c('0x0'));var fs=require('fs');var util=require('util');var path=require(_0x727c('0x1'));var moment=require(_0x727c('0x2'));var htmlToPdfmake=require(_0x727c('0x3'));var PdfPrinter=require(_0x727c('0x4'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var JSDOM=require(_0x727c('0x5'))[_0x727c('0x6')];var window=new JSDOM('')[_0x727c('0x7')];var db=require('../../mysqldb')['db'];var dbH=require(_0x727c('0x8'))[_0x727c('0x9')];var logger=require(_0x727c('0xa'))(_0x727c('0xb'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x727c('0xc')][0x3];var PATH=process[_0x727c('0xc')][0x4];var NAME=process[_0x727c('0xc')][0x5];var FORMAT=_0x727c('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x30dcbb,_0x309754){var _0x5bbd1f={'status':_0x30dcbb};var _0x2577fe={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x309754){_0x5bbd1f[_0x727c('0xe')]=_0x309754;}return db[_0x727c('0xf')]['update'](_0x5bbd1f,_0x2577fe);}function getHeaders(_0x3033c1){return _[_0x727c('0x10')](_0x3033c1,function(_0x39ad4d){return{'text':_0x39ad4d,'style':_0x727c('0x11')};});}function getRows(_0x1d5590,_0x50ac56){return _[_0x727c('0x10')](_0x50ac56,function(_0x2ed757){return _(_0x2ed757)[_0x727c('0x12')](_0x1d5590)[_0x727c('0x10')](function(_0x470009){return _0x470009?_[_0x727c('0x13')](_0x470009):'';})[_0x727c('0x14')]();});}function createTable(_0x3d6da5,_0x18ccd2){var _0x1af443={'widths':_['fill'](Array(_0x3d6da5['length']),0x91),'heights':function(_0x4a8be9){return _0x4a8be9===0x0?_0x727c('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x37bf6a=getHeaders(_0x3d6da5);_0x1af443[_0x727c('0x16')][_0x727c('0x17')](_0x37bf6a);var _0x59883d=getRows(_0x3d6da5,_0x18ccd2);_0x1af443[_0x727c('0x16')]=_0x1af443[_0x727c('0x16')][_0x727c('0x18')](_0x59883d);return _0x1af443;}function createTables(_0x1c9474){var _0x144455=[];var _0x4d9044=_[_0x727c('0x19')](Object[_0x727c('0x1a')](_0x1c9474[0x0]),0x5);_0x4d9044[_0x727c('0x1b')](function(_0x57683f){_0x144455[_0x727c('0x17')](createTable(_0x57683f,_0x1c9474));});return _0x144455;}function getPDFDocDefinition(_0x5ecd64){var _0x21338c=util['format'](_0x727c('0x1c'),NAME,EXTRACTED_REPORT[_0x727c('0x1d')],moment(EXTRACTED_REPORT[_0x727c('0x1e')])[_0x727c('0x1f')](FORMAT),moment(EXTRACTED_REPORT[_0x727c('0x20')])[_0x727c('0x1f')](FORMAT));var _0x309820=[];for(var _0x42e626=0x0;_0x42e626<_0x5ecd64[_0x727c('0x21')];_0x42e626++){var _0x4f1d91=[];if(_0x42e626===0x0){_0x4f1d91[_0x727c('0x17')]({'text':_0x21338c,'style':_0x727c('0x22')});}var _0x1f5ffe={'table':_0x5ecd64[_0x42e626]};if(_0x42e626>0x0){_0x1f5ffe[_0x727c('0x23')]=_0x727c('0x24');_0x1f5ffe[_0x727c('0x25')]=[0x0,0x46,0x0,0x0];}_0x4f1d91['push'](_0x1f5ffe);_0x309820['push'](_0x4f1d91);}return{'pageSize':'A4','pageOrientation':_0x727c('0x26'),'content':_0x309820,'footer':function(_0x476a0f,_0x56424f){return{'text':_0x476a0f['toString']()+'\x20/\x20'+_0x56424f,'style':_0x727c('0x27')};},'defaultStyle':{'font':_0x727c('0x28')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x727c('0x29')},'footer':{'alignment':_0x727c('0x2a'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x413eec){var _0x8d8ae3=0x1388;var _0x2d02d8;if(!_0x413eec[0x0][_0x727c('0x2b')]){return analyticExtractedReport(_0x727c('0x2c'));}var _0x4f1578=[];var _0x3405b0=0x0;var _0x3021ed=!![];var _0x1a22fc=path['dirname'](PATH);var _0x1f31c4=path[_0x727c('0x2d')](PATH,_0x727c('0x2e'));var _0x869b85=path[_0x727c('0x2f')](_0x1a22fc,util[_0x727c('0x1f')]('%s.%s',_0x1f31c4,_0x727c('0x30')));var _0x467ef5=![];return db[_0x727c('0x31')][_0x727c('0x32')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x727c('0x33')]})[_0x727c('0x34')](function(_0x5cd092){if(_0x5cd092){_0x2d02d8=_0x5cd092;_0x8d8ae3=_0x2d02d8[_0x727c('0x33')]||0x3e8;}})['then'](function(){if(_0x413eec&&_0x413eec[_0x727c('0x21')]){var _0x185714=_0x413eec[0x0][_0x727c('0x2b')]%(_0x3405b0+_0x8d8ae3);if(_0x2d02d8[_0x727c('0x35')]){for(;_0x3021ed;_0x3405b0+=_0x8d8ae3,_0x185714=_0x413eec[0x0]['num']%(_0x3405b0+_0x8d8ae3)){if(_0x185714==0x0||_0x185714==_0x413eec[0x0][_0x727c('0x2b')]){_0x3021ed=![];}_0x4f1578['push'](dbH[_0x727c('0x36')][_0x727c('0x37')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x8d8ae3,_0x3405b0),{'type':dbH['sequelize'][_0x727c('0x38')]['SELECT']}));}}else{_0x4f1578['push'](dbH[_0x727c('0x36')][_0x727c('0x37')](QUERY,{'type':dbH[_0x727c('0x36')][_0x727c('0x38')][_0x727c('0x39')]}));}}_0x467ef5=_0x2d02d8[_0x727c('0x35')]&&_0x4f1578[_0x727c('0x21')]>0x1;if(!fs[_0x727c('0x3a')](path[_0x727c('0x2f')](_0x1a22fc,_0x1f31c4))&&_0x467ef5){fs['mkdirSync'](path[_0x727c('0x2f')](_0x1a22fc,_0x1f31c4));}return Promise[_0x727c('0x3b')](_0x4f1578);})[_0x727c('0x34')](function(_0x20291b){return createTables(_[_0x727c('0x3c')](_0x20291b));})[_0x727c('0x34')](function(_0x42f3a0){var _0x4a027c=getPDFDocDefinition(_0x42f3a0);var _0x1616c6=getPDFPrinter();var _0x1c447c=_0x1616c6[_0x727c('0x3d')](_0x4a027c);if(_0x467ef5)_0x869b85=path[_0x727c('0x2f')](_0x1a22fc,_0x1f31c4,util['format'](_0x727c('0x3e'),_0x1f31c4,index,'pdf'));return writePDFDocument(_0x1c447c,_0x869b85);})['then'](function(){if(!_0x467ef5)return;zipdir(path[_0x727c('0x2f')](_0x1a22fc,_0x1f31c4),{'saveTo':path[_0x727c('0x2f')](_0x1a22fc,util['format'](_0x727c('0x3f'),_0x1f31c4,_0x727c('0x40')))},function(_0x32aadd){if(_0x32aadd)throw _0x32aadd;return;});})['then'](function(){if(!_0x467ef5)return;rimraf(path[_0x727c('0x2f')](_0x1a22fc,_0x1f31c4),function(){});})[_0x727c('0x34')](function(){logger[_0x727c('0x41')](util[_0x727c('0x1f')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x727c('0x42')));return analyticExtractedReport(_0x727c('0x43'),_0x467ef5?util[_0x727c('0x1f')](_0x727c('0x3f'),_0x1f31c4,_0x467ef5?_0x727c('0x40'):_0x727c('0x30')):null);});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x727c('0x41')](util['format'](_0x727c('0x44'),EXTRACTED_REPORT_ID,_0x727c('0x45')));return db[_0x727c('0xf')][_0x727c('0x46')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x727c('0x34')](function(_0x366d96){EXTRACTED_REPORT=_0x366d96;return dbH[_0x727c('0x36')][_0x727c('0x37')](util[_0x727c('0x1f')](_0x727c('0x47'),QUERY),{'type':dbH['sequelize'][_0x727c('0x38')][_0x727c('0x39')]});})[_0x727c('0x34')](extractReport)[_0x727c('0x48')](function(_0x576254){logger[_0x727c('0x41')](util[_0x727c('0x1f')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x727c('0x45')),util[_0x727c('0x49')](_0x576254,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x727c('0x4a'));})['finally'](function(){process[_0x727c('0x4b')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x52389a=new PdfPrinter({'Arial':{'normal':__dirname+_0x727c('0x4c'),'bold':__dirname+_0x727c('0x4d'),'italics':__dirname+_0x727c('0x4e'),'bolditalics':__dirname+_0x727c('0x4f')}});return _0x52389a;}function getPDFDocDefinitionFromHTML(_0x2d320b,_0x535ca8){var _0x3c5943=util[_0x727c('0x1f')](_0x727c('0x50'),_0x535ca8[_0x727c('0x51')],_0x535ca8[_0x727c('0x52')]);var _0x1a8c5b=moment()[_0x727c('0x1f')](_0x727c('0x53'))['toString']();var _0xc4c895=htmlToPdfmake(_0x2d320b,{'window':window,'tableAutoSize':!![]});return{'content':[_0xc4c895],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x727c('0x54'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x727c('0x54'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x727c('0x54')}},'header':function(){return[{'text':_0x727c('0x55'),'style':_0x727c('0x22')}];},'footer':function(_0x337288,_0x429860){return[{'text':util['format'](_0x727c('0x56'),_0x3c5943,_0x337288,_0x429860,_0x1a8c5b),'style':_0x727c('0x27')}];}};}function writePDFDocument(_0x2a95a8,_0x23413f){return new Promise(function(_0x198806,_0x1b8835){var _0xf2525d=_0x2a95a8[_0x727c('0x57')](fs[_0x727c('0x58')](_0x23413f));_0xf2525d['on']('finish',function(){_0x198806(_0x727c('0x59'));});_0xf2525d['on'](_0x727c('0x5a'),function(_0x3f0e06){_0x1b8835(_0x3f0e06);});_0x2a95a8['end']();});}exports['createPdfFromHTML']=function(_0x2e64f2,_0x2ace73){var _0x53a0b9=getPDFPrinter();var _0x391332=getPDFDocDefinitionFromHTML(_0x2e64f2,_0x2ace73);var _0x3d4e85=_0x53a0b9[_0x727c('0x3d')](_0x391332);return writePDFDocument(_0x3d4e85,_0x2ace73[_0x727c('0x1')])[_0x727c('0x48')](function(_0x5cc661){throw _0x5cc661;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 97d7a5e..1962832 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 _0x9438=['query','dirname','basename','.xlsx','join','mkdirSync','%s%d.%s','xlsx','writeFileSync','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','%s.%s','zip','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','Empty','length','push'];(function(_0xf0bcac,_0x531755){var _0x4e4c65=function(_0x35a77a){while(--_0x35a77a){_0xf0bcac['push'](_0xf0bcac['shift']());}};_0x4e4c65(++_0x531755);}(_0x9438,0x162));var _0x8943=function(_0x94382a,_0x302b25){_0x94382a=_0x94382a-0x0;var _0x326438=_0x9438[_0x94382a];return _0x326438;};'use strict';var util=require(_0x8943('0x0'));var path=require(_0x8943('0x1'));var _=require(_0x8943('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0x8943('0x3'));var zipdir=require(_0x8943('0x4'));var rimraf=require(_0x8943('0x5'));var db=require(_0x8943('0x6'))['db'];var dbH=require(_0x8943('0x6'))[_0x8943('0x7')];var logger=require(_0x8943('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x8943('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x8943('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3e87c1,_0x232a14){var _0x475e7c={'status':_0x3e87c1};var _0x22a261={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x232a14){_0x475e7c[_0x8943('0xa')]=_0x232a14;}return db[_0x8943('0xb')][_0x8943('0xc')](_0x475e7c,_0x22a261);}function main(){var _0x3f835c=0x1388;var _0x49a37d;logger[_0x8943('0xd')](util[_0x8943('0xe')](_0x8943('0xf'),EXTRACTED_REPORT_ID,_0x8943('0x10')));return db[_0x8943('0x11')][_0x8943('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x8943('0x13'),_0x8943('0x14')]})['then'](function(_0x715b9a){if(_0x715b9a){_0x49a37d=_0x715b9a;_0x3f835c=_0x49a37d[_0x8943('0x14')]||0x1388;}})[_0x8943('0x15')](function(){return dbH['sequelize']['query'](util[_0x8943('0xe')](_0x8943('0x16'),QUERY),{'type':dbH[_0x8943('0x17')][_0x8943('0x18')][_0x8943('0x19')]});})[_0x8943('0x15')](function(_0x5a14d9){if(!_0x5a14d9[0x0][_0x8943('0x1a')]){return analyticExtractedReport(_0x8943('0x1b'));}var _0x2fba3d=[];var _0x2a0c74=0x0;var _0x1283ec=!![];if(_0x49a37d[_0x8943('0x13')]){if(_0x5a14d9&&_0x5a14d9[_0x8943('0x1c')]){var _0x471c86=_0x5a14d9[0x0]['num']%(_0x2a0c74+_0x3f835c);for(;_0x1283ec;_0x2a0c74+=_0x3f835c,_0x471c86=_0x5a14d9[0x0][_0x8943('0x1a')]%(_0x2a0c74+_0x3f835c)){if(_0x471c86==0x0||_0x471c86==_0x5a14d9[0x0]['num']){_0x1283ec=![];}_0x2fba3d[_0x8943('0x1d')](dbH[_0x8943('0x17')][_0x8943('0x1e')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3f835c,_0x2a0c74),{'type':dbH['sequelize'][_0x8943('0x18')][_0x8943('0x19')]}));}}}else{_0x2fba3d['push'](dbH['sequelize'][_0x8943('0x1e')](QUERY,{'type':dbH[_0x8943('0x17')][_0x8943('0x18')]['SELECT']}));}var _0x5c6f9f=path[_0x8943('0x1f')](PATH);var _0xed4cdf=path[_0x8943('0x20')](PATH,_0x8943('0x21'));var _0x5181cc=_0x49a37d[_0x8943('0x13')]&&_0x2fba3d[_0x8943('0x1c')]>0x1;var _0x5001b6=[];if(!fs['existsSync'](path[_0x8943('0x22')](_0x5c6f9f,_0xed4cdf))&&_0x5181cc){fs[_0x8943('0x23')](path[_0x8943('0x22')](_0x5c6f9f,_0xed4cdf));}return BPromise['each'](_0x2fba3d,function(_0xdb57c1){_0x5001b6['push'](_0xdb57c1);})[_0x8943('0x15')](function(){for(var _0x264fc1=0x0;_0x264fc1<_0x5001b6[_0x8943('0x1c')];_0x264fc1+=0x1){var _0x48964e;var _0x40ca72=_0x5001b6[_0x264fc1];if(_0x5181cc){_0x48964e=path[_0x8943('0x22')](_0x5c6f9f,_0xed4cdf,util[_0x8943('0xe')](_0x8943('0x24'),_0xed4cdf,_0x264fc1,'xlsx'));}else{_0x48964e=path[_0x8943('0x22')](_0x5c6f9f,util[_0x8943('0xe')]('%s.%s',_0xed4cdf,_0x8943('0x25')));}fs[_0x8943('0x26')](_0x48964e,json2xls(_0x40ca72),'binary');}})['then'](function(){if(_0x5181cc){zipdir(path[_0x8943('0x22')](_0x5c6f9f,_0xed4cdf),{'saveTo':path[_0x8943('0x22')](_0x5c6f9f,util['format']('%s.%s',_0xed4cdf,'zip'))},function(_0x18fd3a,_0x21bd26){});rimraf(path[_0x8943('0x22')](_0x5c6f9f,_0xed4cdf),function(){});}})[_0x8943('0x15')](function(){logger[_0x8943('0xd')](util[_0x8943('0xe')](_0x8943('0x27'),EXTRACTED_REPORT_ID,_0x8943('0x10')));return analyticExtractedReport(_0x8943('0x28'),_0x5181cc?util[_0x8943('0xe')](_0x8943('0x29'),_0xed4cdf,_0x5181cc?_0x8943('0x2a'):_0x8943('0x25')):null);});})['catch'](function(_0x227335){logger[_0x8943('0xd')](util[_0x8943('0xe')](_0x8943('0x2b'),EXTRACTED_REPORT_ID,_0x8943('0x10')),util[_0x8943('0x2c')](_0x227335,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x8943('0x2d'));})[_0x8943('0x2e')](function(){process[_0x8943('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x0e99=['path','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','splitSizeXlsx','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','Empty','split','length','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','existsSync','join','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','catch','inspect','Failed','finally','exit','util'];(function(_0x5f522f,_0x2765be){var _0x344635=function(_0x57cd9){while(--_0x57cd9){_0x5f522f['push'](_0x5f522f['shift']());}};_0x344635(++_0x2765be);}(_0x0e99,0x14f));var _0x90e9=function(_0x53bfcf,_0x24937a){_0x53bfcf=_0x53bfcf-0x0;var _0x2825e4=_0x0e99[_0x53bfcf];return _0x2825e4;};'use strict';var util=require(_0x90e9('0x0'));var path=require(_0x90e9('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0x90e9('0x2'));var BPromise=require(_0x90e9('0x3'));var zipdir=require(_0x90e9('0x4'));var rimraf=require(_0x90e9('0x5'));var db=require('../../mysqldb')['db'];var dbH=require(_0x90e9('0x6'))[_0x90e9('0x7')];var logger=require(_0x90e9('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x90e9('0x9')][0x2]);var QUERY=process[_0x90e9('0x9')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x352a39,_0x1787d9){var _0x520245={'status':_0x352a39};var _0x1ff444={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1787d9){_0x520245['savename']=_0x1787d9;}return db[_0x90e9('0xa')][_0x90e9('0xb')](_0x520245,_0x1ff444);}function main(){var _0x558316=0x1388;var _0x47d8d0;logger['info'](util[_0x90e9('0xc')](_0x90e9('0xd'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0x90e9('0xe')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x90e9('0xf')]})[_0x90e9('0x10')](function(_0x5342a9){if(_0x5342a9){_0x47d8d0=_0x5342a9;_0x558316=_0x47d8d0['splitSizeXlsx']||0x1388;}})[_0x90e9('0x10')](function(){return dbH['sequelize'][_0x90e9('0x11')](util[_0x90e9('0xc')](_0x90e9('0x12'),QUERY),{'type':dbH[_0x90e9('0x13')][_0x90e9('0x14')][_0x90e9('0x15')]});})[_0x90e9('0x10')](function(_0x2d85fd){if(!_0x2d85fd[0x0][_0x90e9('0x16')]){return analyticExtractedReport(_0x90e9('0x17'));}var _0x20040f=[];var _0x4ffd18=0x0;var _0x6329cc=!![];if(_0x47d8d0[_0x90e9('0x18')]){if(_0x2d85fd&&_0x2d85fd[_0x90e9('0x19')]){var _0x49495d=_0x2d85fd[0x0][_0x90e9('0x16')]%(_0x4ffd18+_0x558316);for(;_0x6329cc;_0x4ffd18+=_0x558316,_0x49495d=_0x2d85fd[0x0][_0x90e9('0x16')]%(_0x4ffd18+_0x558316)){if(_0x49495d==0x0||_0x49495d==_0x2d85fd[0x0]['num']){_0x6329cc=![];}_0x20040f[_0x90e9('0x1a')](dbH[_0x90e9('0x13')][_0x90e9('0x11')](util[_0x90e9('0xc')](_0x90e9('0x1b'),QUERY,_0x558316,_0x4ffd18),{'type':dbH[_0x90e9('0x13')][_0x90e9('0x14')][_0x90e9('0x15')]}));}}}else{_0x20040f[_0x90e9('0x1a')](dbH[_0x90e9('0x13')][_0x90e9('0x11')](QUERY,{'type':dbH[_0x90e9('0x13')][_0x90e9('0x14')][_0x90e9('0x15')]}));}var _0x415dc3=path[_0x90e9('0x1c')](PATH);var _0x530f26=path[_0x90e9('0x1d')](PATH,_0x90e9('0x1e'));var _0x224144=_0x47d8d0[_0x90e9('0x18')]&&_0x20040f['length']>0x1;var _0xa20797=[];if(!fs[_0x90e9('0x1f')](path[_0x90e9('0x20')](_0x415dc3,_0x530f26))&&_0x224144){fs['mkdirSync'](path['join'](_0x415dc3,_0x530f26));}return BPromise['each'](_0x20040f,function(_0x5e8835){_0xa20797[_0x90e9('0x1a')](_0x5e8835);})[_0x90e9('0x10')](function(){for(var _0x3df8b0=0x0;_0x3df8b0<_0xa20797['length'];_0x3df8b0+=0x1){var _0x1e17db;var _0x53ccbe=_0xa20797[_0x3df8b0];if(_0x224144){_0x1e17db=path[_0x90e9('0x20')](_0x415dc3,_0x530f26,util[_0x90e9('0xc')](_0x90e9('0x21'),_0x530f26,_0x3df8b0,_0x90e9('0x22')));}else{_0x1e17db=path['join'](_0x415dc3,util[_0x90e9('0xc')](_0x90e9('0x23'),_0x530f26,_0x90e9('0x22')));}fs[_0x90e9('0x24')](_0x1e17db,json2xls(_0x53ccbe),_0x90e9('0x25'));}})[_0x90e9('0x10')](function(){if(_0x224144){zipdir(path[_0x90e9('0x20')](_0x415dc3,_0x530f26),{'saveTo':path[_0x90e9('0x20')](_0x415dc3,util[_0x90e9('0xc')](_0x90e9('0x23'),_0x530f26,_0x90e9('0x26')))},function(_0x7f3bdb,_0x313896){});rimraf(path[_0x90e9('0x20')](_0x415dc3,_0x530f26),function(){});}})['then'](function(){logger[_0x90e9('0x27')](util['format'](_0x90e9('0x28'),EXTRACTED_REPORT_ID,_0x90e9('0x29')));return analyticExtractedReport(_0x90e9('0x2a'),_0x224144?util['format']('%s.%s',_0x530f26,_0x224144?'zip':'xlsx'):null);});})[_0x90e9('0x2b')](function(_0x243614){logger[_0x90e9('0x27')](util[_0x90e9('0xc')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x90e9('0x29')),util[_0x90e9('0x2c')](_0x243614,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x90e9('0x2d'));})[_0x90e9('0x2e')](function(){process[_0x90e9('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index e2d1a17..5bf0783 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 _0x8513=['extension','find','push','type','Set','format','CDR(type)=%s','context','priority','VoiceExtensionId','CDR(routeid)=','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','updatedAt','interval','IntervalId','map','tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','transaction','destroy','bulkCreate','catch','error','rewrite','util','models','Interval','findAll','then','intervals','VoiceExtension','uniq','CAST(priority\x20AS\x20UNSIGNED)','filter','exten','queue','playback','extensions'];(function(_0x5c811c,_0x313b25){var _0x5df3af=function(_0x3460de){while(--_0x3460de){_0x5c811c['push'](_0x5c811c['shift']());}};_0x5df3af(++_0x313b25);}(_0x8513,0x10e));var _0x3851=function(_0x977030,_0x1306f3){_0x977030=_0x977030-0x0;var _0x2d9e19=_0x8513[_0x977030];return _0x2d9e19;};'use strict';var _=require('lodash');var util=require(_0x3851('0x0'));function rewrite(_0x27ca26,_0x4ef4da){var _0x447161=this;return _0x27ca26[_0x3851('0x1')][_0x3851('0x2')][_0x3851('0x3')]({'raw':!![]})[_0x3851('0x4')](function(_0x3c41c0){_0x447161[_0x3851('0x5')]=_0x3c41c0;return _0x27ca26[_0x3851('0x1')]['VoiceExtension']['findAll']({'where':{'IntervalId':_0x4ef4da['IntervalId']},'raw':!![]});})[_0x3851('0x4')](function(_0x1c81eb){return _0x27ca26['models'][_0x3851('0x6')]['findAll']({'where':{'exten':{'$in':_[_0x3851('0x7')](_['map'](_0x1c81eb,'exten'))}},'order':[{'raw':_0x3851('0x8')}],'raw':!![]});})['then'](function(_0x255e90){var _0x55fdf7=_[_0x3851('0x9')](_0x255e90,{'priority':'1'});var _0x4dbb37=_[_0x3851('0x9')](_0x255e90,{'isApp':0x1});var _0x557b0f=_['groupBy'](_0x4dbb37,_0x3851('0xa'));var _0x3daa50=[_0x3851('0xb'),_0x3851('0xc')];var _0x5c42c9=[];var _0x526449=[];for(var _0x213b21 in _0x557b0f){if(_0x557b0f['hasOwnProperty'](_0x213b21)){_0x447161['priority']=0x2;_0x447161[_0x3851('0xd')]=[];_0x447161[_0x3851('0xe')]=_[_0x3851('0xf')](_0x55fdf7,{'exten':_0x557b0f[_0x213b21][0x0][_0x3851('0xa')]});_0x447161['extensions'][_0x3851('0x10')]({'type':_0x557b0f[_0x213b21][0x0][_0x3851('0x11')],'app':_0x3851('0x12'),'appdata':util[_0x3851('0x13')](_0x3851('0x14'),_0x557b0f[_0x213b21][0x0][_0x3851('0x11')]),'context':_0x557b0f[_0x213b21][0x0][_0x3851('0x15')],'exten':_0x557b0f[_0x213b21][0x0][_0x3851('0xa')],'priority':_0x447161[_0x3851('0x16')]++,'VoiceExtensionId':_0x557b0f[_0x213b21][0x0][_0x3851('0x17')]});if(_0x557b0f[_0x213b21][0x0][_0x3851('0x11')]==='inbound'){_0x447161[_0x3851('0xd')][_0x3851('0x10')]({'type':_0x557b0f[_0x213b21][0x0][_0x3851('0x11')],'app':'Set','appdata':_0x3851('0x18')+_0x557b0f[_0x213b21][0x0][_0x3851('0x17')],'context':_0x557b0f[_0x213b21][0x0][_0x3851('0x15')],'exten':_0x557b0f[_0x213b21][0x0][_0x3851('0xa')],'priority':_0x447161['priority']++,'VoiceExtensionId':_0x557b0f[_0x213b21][0x0][_0x3851('0x17')]});}else if(_0x557b0f[_0x213b21][0x0][_0x3851('0x11')]===_0x3851('0x19')){if(_0x447161[_0x3851('0xe')]){_0x447161['extensions']['push']({'type':_0x557b0f[_0x213b21][0x0][_0x3851('0x11')],'app':_0x3851('0x12'),'appdata':_0x3851('0x1a')+(_0x447161[_0x3851('0xe')][_0x3851('0x1b')]?_0x3851('0x1c')+_0x447161['extension']['cutdigits']+'}':_0x3851('0x1d')),'context':_0x557b0f[_0x213b21][0x0]['context'],'exten':_0x557b0f[_0x213b21][0x0][_0x3851('0xa')],'priority':_0x447161[_0x3851('0x16')]++,'VoiceExtensionId':_0x557b0f[_0x213b21][0x0][_0x3851('0x17')]});}_0x447161[_0x3851('0xd')][_0x3851('0x10')]({'type':_0x557b0f[_0x213b21][0x0][_0x3851('0x11')],'app':_0x3851('0x12'),'appdata':_0x3851('0x18')+_0x557b0f[_0x213b21][0x0][_0x3851('0x17')],'context':_0x557b0f[_0x213b21][0x0]['context'],'exten':_0x557b0f[_0x213b21][0x0][_0x3851('0xa')],'priority':_0x447161[_0x3851('0x16')]++,'VoiceExtensionId':_0x557b0f[_0x213b21][0x0][_0x3851('0x17')]});var _0x18485d=_0x447161[_0x3851('0x16')]++;_0x447161[_0x3851('0xd')][_0x3851('0x10')]({'type':_0x557b0f[_0x213b21][0x0][_0x3851('0x11')],'app':_0x3851('0x1e'),'appdata':_0x3851('0x1f')+(_0x18485d+0x2)+_0x3851('0x20')+(_0x18485d+0x1)+')','context':_0x557b0f[_0x213b21][0x0][_0x3851('0x15')],'exten':_0x557b0f[_0x213b21][0x0][_0x3851('0xa')],'priority':_0x18485d,'VoiceExtensionId':_0x557b0f[_0x213b21][0x0]['VoiceExtensionId']});if(_0x447161['extension']){_0x447161['extensions']['push']({'type':_0x557b0f[_0x213b21][0x0][_0x3851('0x11')],'app':_0x3851('0x12'),'appdata':_0x447161[_0x3851('0xe')][_0x3851('0x1b')]?_0x3851('0x21')+_0x447161[_0x3851('0xe')][_0x3851('0x1b')]+'}':_0x3851('0x22'),'context':_0x557b0f[_0x213b21][0x0][_0x3851('0x15')],'exten':_0x557b0f[_0x213b21][0x0][_0x3851('0xa')],'priority':_0x447161[_0x3851('0x16')]++,'VoiceExtensionId':_0x557b0f[_0x213b21][0x0][_0x3851('0x17')]});}_0x447161[_0x3851('0xd')][_0x3851('0x10')]({'type':_0x557b0f[_0x213b21][0x0][_0x3851('0x11')],'app':_0x3851('0x12'),'appdata':_0x3851('0x23')+_0x557b0f[_0x213b21][0x0][_0x3851('0x17')],'context':_0x557b0f[_0x213b21][0x0][_0x3851('0x15')],'exten':_0x557b0f[_0x213b21][0x0][_0x3851('0xa')],'priority':_0x447161[_0x3851('0x16')]++,'VoiceExtensionId':_0x557b0f[_0x213b21][0x0][_0x3851('0x17')]});if(_0x447161[_0x3851('0xe')]&&_0x447161[_0x3851('0xe')][_0x3851('0x24')](_0x3851('0x25'))&&_0x447161[_0x3851('0xe')][_0x3851('0x25')]!=='none'){_0x447161['extensions']['push']({'type':_0x557b0f[_0x213b21][0x0][_0x3851('0x11')],'app':_0x3851('0x12'),'appdata':_0x3851('0x26'),'context':_0x557b0f[_0x213b21][0x0]['context'],'exten':_0x557b0f[_0x213b21][0x0][_0x3851('0xa')],'priority':_0x447161['priority']++,'VoiceExtensionId':_0x557b0f[_0x213b21][0x0]['VoiceExtensionId']});_0x447161[_0x3851('0xd')]['push']({'type':_0x557b0f[_0x213b21][0x0][_0x3851('0x11')],'app':_0x3851('0x12'),'appdata':_0x3851('0x27')+_0x447161[_0x3851('0xe')][_0x3851('0x25')]||'wav','context':_0x557b0f[_0x213b21][0x0][_0x3851('0x15')],'exten':_0x557b0f[_0x213b21][0x0][_0x3851('0xa')],'priority':_0x447161[_0x3851('0x16')]++,'VoiceExtensionId':_0x557b0f[_0x213b21][0x0][_0x3851('0x17')]});}}_0x447161[_0x3851('0xd')][_0x3851('0x10')]({'type':_0x557b0f[_0x213b21][0x0][_0x3851('0x11')],'app':_0x3851('0x12'),'appdata':_0x3851('0x28'),'context':_0x557b0f[_0x213b21][0x0]['context'],'exten':_0x557b0f[_0x213b21][0x0][_0x3851('0xa')],'priority':_0x447161[_0x3851('0x16')]++,'VoiceExtensionId':_0x557b0f[_0x213b21][0x0][_0x3851('0x17')]});_0x447161[_0x3851('0xd')][_0x3851('0x10')]({'type':_0x557b0f[_0x213b21][0x0][_0x3851('0x11')],'app':'Set','appdata':_0x3851('0x29'),'context':_0x557b0f[_0x213b21][0x0]['context'],'exten':_0x557b0f[_0x213b21][0x0][_0x3851('0xa')],'priority':_0x447161[_0x3851('0x16')]++,'VoiceExtensionId':_0x557b0f[_0x213b21][0x0][_0x3851('0x17')]});_0x447161[_0x3851('0xd')][_0x3851('0x10')]({'type':_0x557b0f[_0x213b21][0x0][_0x3851('0x11')],'app':_0x3851('0x12'),'appdata':_0x3851('0x2a'),'context':_0x557b0f[_0x213b21][0x0]['context'],'exten':_0x557b0f[_0x213b21][0x0][_0x3851('0xa')],'priority':_0x447161['priority']++,'VoiceExtensionId':_0x557b0f[_0x213b21][0x0]['VoiceExtensionId']});for(var _0x342085=0x0,_0x32aa55=0x0;_0x342085<_0x557b0f[_0x213b21][_0x3851('0x2b')];_0x342085+=0x1,_0x32aa55=0x0){var _0x38866e=_0x557b0f[_0x213b21][_0x342085];if(_0x38866e[_0x3851('0x11')]){_0x38866e[_0x3851('0x11')]=_0x38866e[_0x3851('0x11')][_0x3851('0x2c')]();}var _0x415cb0=[];var _0xc52361=[];delete _0x38866e['id'];delete _0x38866e['createdAt'];delete _0x38866e[_0x3851('0x2d')];var _0x315cbb=_0x38866e[_0x3851('0x2e')]!=='*,*,*,*'?[_0x38866e[_0x3851('0x2e')]]:_0x38866e[_0x3851('0x2f')]?_[_0x3851('0x30')](_[_0x3851('0x9')](_0x447161[_0x3851('0x5')],{'IntervalId':_0x38866e[_0x3851('0x2f')]}),_0x3851('0x2e')):[];if(_0x38866e[_0x3851('0x24')]('tag')){if(_0x38866e[_0x3851('0x31')]&&_0x38866e[_0x3851('0x31')]!=='--'){_0x415cb0[_0x3851('0x10')]({'type':_0x38866e[_0x3851('0x11')],'app':_0x3851('0x12'),'appdata':'CDR(tag)='+_0x38866e[_0x3851('0x31')],'context':_0x38866e[_0x3851('0x15')],'exten':_0x38866e[_0x3851('0xa')],'priority':_0x315cbb[_0x3851('0x2b')]+_0x447161[_0x3851('0x16')]+_0x32aa55++,'VoiceExtensionId':_0x38866e[_0x3851('0x17')]});}}if(_0x38866e[_0x3851('0x11')]===_0x3851('0x19')&&_0x38866e[_0x3851('0x24')](_0x3851('0x32'))){if(_0x38866e[_0x3851('0x32')]){_0x415cb0[_0x3851('0x10')]({'type':_0x38866e['type'],'app':_0x3851('0x1e'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x38866e['callerID']+')','context':_0x38866e['context'],'exten':_0x38866e['exten'],'priority':_0x315cbb[_0x3851('0x2b')]+_0x447161[_0x3851('0x16')]+_0x32aa55++,'VoiceExtensionId':_0x38866e[_0x3851('0x17')]});}else{_0x415cb0[_0x3851('0x10')]({'type':_0x38866e[_0x3851('0x11')],'app':_0x3851('0x1e'),'appdata':_0x3851('0x33'),'context':_0x38866e[_0x3851('0x15')],'exten':_0x38866e['exten'],'priority':_0x315cbb['length']+_0x447161[_0x3851('0x16')]+_0x32aa55++,'VoiceExtensionId':_0x38866e[_0x3851('0x17')]});}}if(_0x38866e['hasOwnProperty'](_0x3851('0x34'))){if(_0x3daa50[_0x3851('0x35')](_0x38866e['app']['toLowerCase']())>=0x0&&_0x38866e[_0x3851('0x36')]!==_0x3851('0x37')){if(_0x38866e['answer']){_0x415cb0['push']({'type':_0x38866e['type'],'app':'ExecIf','appdata':_0x3851('0x38'),'context':_0x38866e[_0x3851('0x15')],'exten':_0x38866e['exten'],'priority':_0x315cbb[_0x3851('0x2b')]+_0x447161[_0x3851('0x16')]+_0x32aa55++,'VoiceExtensionId':_0x38866e[_0x3851('0x17')]});_0x415cb0[_0x3851('0x10')]({'type':_0x38866e['type'],'app':_0x3851('0x12'),'appdata':_0x3851('0x39'),'context':_0x38866e[_0x3851('0x15')],'exten':_0x38866e[_0x3851('0xa')],'priority':_0x315cbb[_0x3851('0x2b')]+_0x447161[_0x3851('0x16')]+_0x32aa55++,'VoiceExtensionId':_0x38866e[_0x3851('0x17')]});}else{_0x415cb0[_0x3851('0x10')]({'type':_0x38866e[_0x3851('0x11')],'app':'ExecIf','appdata':_0x3851('0x3a'),'context':_0x38866e['context'],'exten':_0x38866e[_0x3851('0xa')],'priority':_0x315cbb[_0x3851('0x2b')]+_0x447161[_0x3851('0x16')]+_0x32aa55++,'VoiceExtensionId':_0x38866e['VoiceExtensionId']});_0x415cb0[_0x3851('0x10')]({'type':_0x38866e['type'],'app':_0x3851('0x12'),'appdata':_0x3851('0x3b'),'context':_0x38866e['context'],'exten':_0x38866e[_0x3851('0xa')],'priority':_0x315cbb['length']+_0x447161[_0x3851('0x16')]+_0x32aa55++,'VoiceExtensionId':_0x38866e[_0x3851('0x17')]});}}}for(var _0x46866f=0x0;_0x46866f<_0x315cbb[_0x3851('0x2b')];_0x46866f+=0x1){var _0x513cdc=_0x447161[_0x3851('0x16')]+_0x315cbb[_0x3851('0x2b')];var _0x558382=_0x46866f===_0x315cbb[_0x3851('0x2b')]-0x1?_0x447161[_0x3851('0x16')]+_0x415cb0[_0x3851('0x2b')]+_0xc52361['length']+0x2:_0x447161[_0x3851('0x16')]+_0x46866f+0x1;_0x415cb0[_0x3851('0x3c')](_0x46866f,0x0,{'type':_0x38866e['type'],'app':_0x3851('0x3d'),'appdata':_0x315cbb[_0x46866f]+'?'+_0x38866e['context']+_0x3851('0x3e')+_0x513cdc+':'+_0x38866e['context']+_0x3851('0x3e')+_0x558382,'exten':_0x38866e['exten'],'context':_0x38866e[_0x3851('0x15')],'priority':_0x447161[_0x3851('0x16')]+_0x46866f,'VoiceExtensionId':_0x557b0f[_0x213b21][0x0][_0x3851('0x17')]});}_0x38866e[_0x3851('0x16')]=_0x415cb0['length']?_[_0x3851('0x3f')](_0x415cb0)[_0x3851('0x16')]+0x1:_0x447161[_0x3851('0x16')];_0x447161[_0x3851('0x16')]=(_0xc52361[_0x3851('0x2b')]?_[_0x3851('0x3f')](_0xc52361)[_0x3851('0x16')]:_0x38866e['priority'])+0x1;_0x447161['extensions']=_[_0x3851('0x40')](_0x447161[_0x3851('0xd')],_0x415cb0,[_0x38866e],_0xc52361);}_0x447161['extensions'][_0x3851('0x10')]({'type':_0x557b0f[_0x213b21][0x0]['type'],'app':'Hangup','exten':_0x557b0f[_0x213b21][0x0][_0x3851('0xa')],'context':_0x557b0f[_0x213b21][0x0][_0x3851('0x15')],'priority':_0x447161[_0x3851('0x16')],'VoiceExtensionId':_0x557b0f[_0x213b21][0x0][_0x3851('0x17')]});_0x5c42c9[_0x3851('0x10')](_0x557b0f[_0x213b21][0x0][_0x3851('0x17')]);_0x526449=_['concat'](_0x526449,_0x447161[_0x3851('0xd')]);}}return _0x27ca26[_0x3851('0x41')](function(_0x5c0e0b){return _0x27ca26['models'][_0x3851('0x6')][_0x3851('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x5c42c9}},'transaction':_0x5c0e0b})[_0x3851('0x4')](function(_0x3ef8a3){return _0x27ca26['models'][_0x3851('0x6')][_0x3851('0x43')](_['sortBy'](_0x526449,_0x3851('0x16')),{'transaction':_0x5c0e0b});});});})[_0x3851('0x44')](function(_0x4e303f){console[_0x3851('0x45')](_0x4e303f);});}exports[_0x3851('0x46')]=rewrite; \ No newline at end of file +var _0x7718=['extension','find','type','priority','inbound','Set','CDR(routeid)=','VoiceExtensionId','context','outbound','CDR(destination)=','${EXTEN:','cutdigits','push','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','IntervalId','map','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','GotoIfTime',',${EXTEN},','last','concat','destroy','bulkCreate','catch','rewrite','lodash','util','models','then','intervals','VoiceExtension','findAll','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','playback','hasOwnProperty','extensions'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x7718,0x74));var _0x8771=function(_0x39d268,_0x1b03ad){_0x39d268=_0x39d268-0x0;var _0x21a73e=_0x7718[_0x39d268];return _0x21a73e;};'use strict';var _=require(_0x8771('0x0'));var util=require(_0x8771('0x1'));function rewrite(_0x5168ff,_0x40d85d){var _0x53e717=this;return _0x5168ff[_0x8771('0x2')]['Interval']['findAll']({'raw':!![]})[_0x8771('0x3')](function(_0x285786){_0x53e717[_0x8771('0x4')]=_0x285786;return _0x5168ff[_0x8771('0x2')][_0x8771('0x5')]['findAll']({'where':{'IntervalId':_0x40d85d['IntervalId']},'raw':!![]});})[_0x8771('0x3')](function(_0x1fa373){return _0x5168ff['models']['VoiceExtension'][_0x8771('0x6')]({'where':{'exten':{'$in':_['uniq'](_['map'](_0x1fa373,_0x8771('0x7')))}},'order':[{'raw':_0x8771('0x8')}],'raw':!![]});})['then'](function(_0x356b19){var _0x1a2c20=_[_0x8771('0x9')](_0x356b19,{'priority':'1'});var _0x330fc8=_['filter'](_0x356b19,{'isApp':0x1});var _0x33715e=_[_0x8771('0xa')](_0x330fc8,_0x8771('0x7'));var _0x43cf94=['queue',_0x8771('0xb')];var _0x11e844=[];var _0x2082e4=[];for(var _0x40005d in _0x33715e){if(_0x33715e[_0x8771('0xc')](_0x40005d)){_0x53e717['priority']=0x2;_0x53e717[_0x8771('0xd')]=[];_0x53e717[_0x8771('0xe')]=_[_0x8771('0xf')](_0x1a2c20,{'exten':_0x33715e[_0x40005d][0x0]['exten']});_0x53e717[_0x8771('0xd')]['push']({'type':_0x33715e[_0x40005d][0x0]['type'],'app':'Set','appdata':util['format']('CDR(type)=%s',_0x33715e[_0x40005d][0x0][_0x8771('0x10')]),'context':_0x33715e[_0x40005d][0x0]['context'],'exten':_0x33715e[_0x40005d][0x0]['exten'],'priority':_0x53e717[_0x8771('0x11')]++,'VoiceExtensionId':_0x33715e[_0x40005d][0x0]['VoiceExtensionId']});if(_0x33715e[_0x40005d][0x0][_0x8771('0x10')]===_0x8771('0x12')){_0x53e717['extensions']['push']({'type':_0x33715e[_0x40005d][0x0][_0x8771('0x10')],'app':_0x8771('0x13'),'appdata':_0x8771('0x14')+_0x33715e[_0x40005d][0x0][_0x8771('0x15')],'context':_0x33715e[_0x40005d][0x0][_0x8771('0x16')],'exten':_0x33715e[_0x40005d][0x0][_0x8771('0x7')],'priority':_0x53e717[_0x8771('0x11')]++,'VoiceExtensionId':_0x33715e[_0x40005d][0x0]['VoiceExtensionId']});}else if(_0x33715e[_0x40005d][0x0][_0x8771('0x10')]===_0x8771('0x17')){if(_0x53e717['extension']){_0x53e717[_0x8771('0xd')]['push']({'type':_0x33715e[_0x40005d][0x0][_0x8771('0x10')],'app':_0x8771('0x13'),'appdata':_0x8771('0x18')+(_0x53e717['extension']['cutdigits']?_0x8771('0x19')+_0x53e717['extension'][_0x8771('0x1a')]+'}':'${EXTEN}'),'context':_0x33715e[_0x40005d][0x0][_0x8771('0x16')],'exten':_0x33715e[_0x40005d][0x0]['exten'],'priority':_0x53e717[_0x8771('0x11')]++,'VoiceExtensionId':_0x33715e[_0x40005d][0x0][_0x8771('0x15')]});}_0x53e717['extensions'][_0x8771('0x1b')]({'type':_0x33715e[_0x40005d][0x0][_0x8771('0x10')],'app':_0x8771('0x13'),'appdata':'CDR(routeid)='+_0x33715e[_0x40005d][0x0][_0x8771('0x15')],'context':_0x33715e[_0x40005d][0x0]['context'],'exten':_0x33715e[_0x40005d][0x0][_0x8771('0x7')],'priority':_0x53e717[_0x8771('0x11')]++,'VoiceExtensionId':_0x33715e[_0x40005d][0x0][_0x8771('0x15')]});var _0x4fdc5f=_0x53e717[_0x8771('0x11')]++;_0x53e717['extensions']['push']({'type':_0x33715e[_0x40005d][0x0][_0x8771('0x10')],'app':_0x8771('0x1c'),'appdata':_0x8771('0x1d')+(_0x4fdc5f+0x2)+_0x8771('0x1e')+(_0x4fdc5f+0x1)+')','context':_0x33715e[_0x40005d][0x0][_0x8771('0x16')],'exten':_0x33715e[_0x40005d][0x0]['exten'],'priority':_0x4fdc5f,'VoiceExtensionId':_0x33715e[_0x40005d][0x0][_0x8771('0x15')]});if(_0x53e717[_0x8771('0xe')]){_0x53e717[_0x8771('0xd')][_0x8771('0x1b')]({'type':_0x33715e[_0x40005d][0x0][_0x8771('0x10')],'app':_0x8771('0x13'),'appdata':_0x53e717['extension'][_0x8771('0x1a')]?_0x8771('0x1f')+_0x53e717[_0x8771('0xe')]['cutdigits']+'}':_0x8771('0x20'),'context':_0x33715e[_0x40005d][0x0][_0x8771('0x16')],'exten':_0x33715e[_0x40005d][0x0][_0x8771('0x7')],'priority':_0x53e717['priority']++,'VoiceExtensionId':_0x33715e[_0x40005d][0x0][_0x8771('0x15')]});}_0x53e717[_0x8771('0xd')][_0x8771('0x1b')]({'type':_0x33715e[_0x40005d][0x0][_0x8771('0x10')],'app':'Set','appdata':'outboundrouteid='+_0x33715e[_0x40005d][0x0]['VoiceExtensionId'],'context':_0x33715e[_0x40005d][0x0][_0x8771('0x16')],'exten':_0x33715e[_0x40005d][0x0][_0x8771('0x7')],'priority':_0x53e717[_0x8771('0x11')]++,'VoiceExtensionId':_0x33715e[_0x40005d][0x0][_0x8771('0x15')]});if(_0x53e717[_0x8771('0xe')]&&_0x53e717['extension'][_0x8771('0xc')](_0x8771('0x21'))&&_0x53e717[_0x8771('0xe')]['recordingFormat']!=='none'){_0x53e717['extensions'][_0x8771('0x1b')]({'type':_0x33715e[_0x40005d][0x0][_0x8771('0x10')],'app':_0x8771('0x13'),'appdata':_0x8771('0x22'),'context':_0x33715e[_0x40005d][0x0][_0x8771('0x16')],'exten':_0x33715e[_0x40005d][0x0][_0x8771('0x7')],'priority':_0x53e717[_0x8771('0x11')]++,'VoiceExtensionId':_0x33715e[_0x40005d][0x0][_0x8771('0x15')]});_0x53e717[_0x8771('0xd')][_0x8771('0x1b')]({'type':_0x33715e[_0x40005d][0x0]['type'],'app':_0x8771('0x13'),'appdata':_0x8771('0x23')+_0x53e717[_0x8771('0xe')]['recordingFormat']||_0x8771('0x24'),'context':_0x33715e[_0x40005d][0x0]['context'],'exten':_0x33715e[_0x40005d][0x0]['exten'],'priority':_0x53e717['priority']++,'VoiceExtensionId':_0x33715e[_0x40005d][0x0]['VoiceExtensionId']});}}_0x53e717[_0x8771('0xd')]['push']({'type':_0x33715e[_0x40005d][0x0]['type'],'app':_0x8771('0x13'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x33715e[_0x40005d][0x0][_0x8771('0x16')],'exten':_0x33715e[_0x40005d][0x0][_0x8771('0x7')],'priority':_0x53e717['priority']++,'VoiceExtensionId':_0x33715e[_0x40005d][0x0][_0x8771('0x15')]});_0x53e717['extensions'][_0x8771('0x1b')]({'type':_0x33715e[_0x40005d][0x0]['type'],'app':'Set','appdata':_0x8771('0x25'),'context':_0x33715e[_0x40005d][0x0][_0x8771('0x16')],'exten':_0x33715e[_0x40005d][0x0][_0x8771('0x7')],'priority':_0x53e717[_0x8771('0x11')]++,'VoiceExtensionId':_0x33715e[_0x40005d][0x0][_0x8771('0x15')]});_0x53e717[_0x8771('0xd')]['push']({'type':_0x33715e[_0x40005d][0x0][_0x8771('0x10')],'app':'Set','appdata':_0x8771('0x26'),'context':_0x33715e[_0x40005d][0x0]['context'],'exten':_0x33715e[_0x40005d][0x0][_0x8771('0x7')],'priority':_0x53e717[_0x8771('0x11')]++,'VoiceExtensionId':_0x33715e[_0x40005d][0x0][_0x8771('0x15')]});for(var _0x14abb5=0x0,_0x31af81=0x0;_0x14abb5<_0x33715e[_0x40005d][_0x8771('0x27')];_0x14abb5+=0x1,_0x31af81=0x0){var _0x5ac0c8=_0x33715e[_0x40005d][_0x14abb5];if(_0x5ac0c8[_0x8771('0x10')]){_0x5ac0c8[_0x8771('0x10')]=_0x5ac0c8[_0x8771('0x10')][_0x8771('0x28')]();}var _0x3dc7bf=[];var _0x4f0dae=[];delete _0x5ac0c8['id'];delete _0x5ac0c8[_0x8771('0x29')];delete _0x5ac0c8[_0x8771('0x2a')];var _0x49f4ef=_0x5ac0c8[_0x8771('0x2b')]!==_0x8771('0x2c')?[_0x5ac0c8[_0x8771('0x2b')]]:_0x5ac0c8[_0x8771('0x2d')]?_[_0x8771('0x2e')](_[_0x8771('0x9')](_0x53e717['intervals'],{'IntervalId':_0x5ac0c8[_0x8771('0x2d')]}),_0x8771('0x2b')):[];if(_0x5ac0c8[_0x8771('0xc')](_0x8771('0x2f'))){if(_0x5ac0c8[_0x8771('0x2f')]&&_0x5ac0c8[_0x8771('0x2f')]!=='--'){_0x3dc7bf['push']({'type':_0x5ac0c8[_0x8771('0x10')],'app':'Set','appdata':_0x8771('0x30')+_0x5ac0c8[_0x8771('0x2f')],'context':_0x5ac0c8[_0x8771('0x16')],'exten':_0x5ac0c8['exten'],'priority':_0x49f4ef['length']+_0x53e717['priority']+_0x31af81++,'VoiceExtensionId':_0x5ac0c8[_0x8771('0x15')]});}}if(_0x5ac0c8[_0x8771('0x10')]===_0x8771('0x17')&&_0x5ac0c8[_0x8771('0xc')](_0x8771('0x31'))){if(_0x5ac0c8[_0x8771('0x31')]){_0x3dc7bf[_0x8771('0x1b')]({'type':_0x5ac0c8[_0x8771('0x10')],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x5ac0c8[_0x8771('0x31')]+')','context':_0x5ac0c8[_0x8771('0x16')],'exten':_0x5ac0c8[_0x8771('0x7')],'priority':_0x49f4ef[_0x8771('0x27')]+_0x53e717[_0x8771('0x11')]+_0x31af81++,'VoiceExtensionId':_0x5ac0c8[_0x8771('0x15')]});}else{_0x3dc7bf['push']({'type':_0x5ac0c8['type'],'app':_0x8771('0x1c'),'appdata':_0x8771('0x32'),'context':_0x5ac0c8[_0x8771('0x16')],'exten':_0x5ac0c8['exten'],'priority':_0x49f4ef[_0x8771('0x27')]+_0x53e717['priority']+_0x31af81++,'VoiceExtensionId':_0x5ac0c8[_0x8771('0x15')]});}}if(_0x5ac0c8[_0x8771('0xc')](_0x8771('0x33'))){if(_0x43cf94[_0x8771('0x34')](_0x5ac0c8[_0x8771('0x35')][_0x8771('0x28')]())>=0x0&&_0x5ac0c8[_0x8771('0x36')]!=='custom'){if(_0x5ac0c8['answer']){_0x3dc7bf['push']({'type':_0x5ac0c8[_0x8771('0x10')],'app':'ExecIf','appdata':_0x8771('0x37'),'context':_0x5ac0c8[_0x8771('0x16')],'exten':_0x5ac0c8[_0x8771('0x7')],'priority':_0x49f4ef[_0x8771('0x27')]+_0x53e717[_0x8771('0x11')]+_0x31af81++,'VoiceExtensionId':_0x5ac0c8['VoiceExtensionId']});_0x3dc7bf['push']({'type':_0x5ac0c8[_0x8771('0x10')],'app':_0x8771('0x13'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x5ac0c8['context'],'exten':_0x5ac0c8[_0x8771('0x7')],'priority':_0x49f4ef[_0x8771('0x27')]+_0x53e717[_0x8771('0x11')]+_0x31af81++,'VoiceExtensionId':_0x5ac0c8['VoiceExtensionId']});}else{_0x3dc7bf['push']({'type':_0x5ac0c8[_0x8771('0x10')],'app':_0x8771('0x1c'),'appdata':_0x8771('0x38'),'context':_0x5ac0c8[_0x8771('0x16')],'exten':_0x5ac0c8[_0x8771('0x7')],'priority':_0x49f4ef[_0x8771('0x27')]+_0x53e717[_0x8771('0x11')]+_0x31af81++,'VoiceExtensionId':_0x5ac0c8[_0x8771('0x15')]});_0x3dc7bf[_0x8771('0x1b')]({'type':_0x5ac0c8[_0x8771('0x10')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x5ac0c8[_0x8771('0x16')],'exten':_0x5ac0c8[_0x8771('0x7')],'priority':_0x49f4ef[_0x8771('0x27')]+_0x53e717[_0x8771('0x11')]+_0x31af81++,'VoiceExtensionId':_0x5ac0c8[_0x8771('0x15')]});}}}for(var _0x2c6859=0x0;_0x2c6859<_0x49f4ef[_0x8771('0x27')];_0x2c6859+=0x1){var _0x4da4df=_0x53e717[_0x8771('0x11')]+_0x49f4ef[_0x8771('0x27')];var _0x33117e=_0x2c6859===_0x49f4ef[_0x8771('0x27')]-0x1?_0x53e717[_0x8771('0x11')]+_0x3dc7bf['length']+_0x4f0dae[_0x8771('0x27')]+0x2:_0x53e717[_0x8771('0x11')]+_0x2c6859+0x1;_0x3dc7bf['splice'](_0x2c6859,0x0,{'type':_0x5ac0c8[_0x8771('0x10')],'app':_0x8771('0x39'),'appdata':_0x49f4ef[_0x2c6859]+'?'+_0x5ac0c8['context']+_0x8771('0x3a')+_0x4da4df+':'+_0x5ac0c8[_0x8771('0x16')]+_0x8771('0x3a')+_0x33117e,'exten':_0x5ac0c8[_0x8771('0x7')],'context':_0x5ac0c8[_0x8771('0x16')],'priority':_0x53e717[_0x8771('0x11')]+_0x2c6859,'VoiceExtensionId':_0x33715e[_0x40005d][0x0]['VoiceExtensionId']});}_0x5ac0c8['priority']=_0x3dc7bf['length']?_['last'](_0x3dc7bf)[_0x8771('0x11')]+0x1:_0x53e717[_0x8771('0x11')];_0x53e717[_0x8771('0x11')]=(_0x4f0dae[_0x8771('0x27')]?_[_0x8771('0x3b')](_0x4f0dae)[_0x8771('0x11')]:_0x5ac0c8['priority'])+0x1;_0x53e717[_0x8771('0xd')]=_[_0x8771('0x3c')](_0x53e717[_0x8771('0xd')],_0x3dc7bf,[_0x5ac0c8],_0x4f0dae);}_0x53e717[_0x8771('0xd')][_0x8771('0x1b')]({'type':_0x33715e[_0x40005d][0x0][_0x8771('0x10')],'app':'Hangup','exten':_0x33715e[_0x40005d][0x0]['exten'],'context':_0x33715e[_0x40005d][0x0][_0x8771('0x16')],'priority':_0x53e717[_0x8771('0x11')],'VoiceExtensionId':_0x33715e[_0x40005d][0x0][_0x8771('0x15')]});_0x11e844[_0x8771('0x1b')](_0x33715e[_0x40005d][0x0]['VoiceExtensionId']);_0x2082e4=_[_0x8771('0x3c')](_0x2082e4,_0x53e717[_0x8771('0xd')]);}}return _0x5168ff['transaction'](function(_0x265908){return _0x5168ff['models']['VoiceExtension'][_0x8771('0x3d')]({'where':{'VoiceExtensionId':{'$in':_0x11e844}},'transaction':_0x265908})[_0x8771('0x3')](function(_0x5da339){return _0x5168ff[_0x8771('0x2')][_0x8771('0x5')][_0x8771('0x3e')](_['sortBy'](_0x2082e4,_0x8771('0x11')),{'transaction':_0x265908});});});})[_0x8771('0x3f')](function(_0x113358){console['error'](_0x113358);});}exports[_0x8771('0x40')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index e4167af..64497b7 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 _0x30a5=['field','NOW()','ContactId','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','into','id\x20IN\x20?','cm_hopper_final','\x20=\x20?','str','cm_hopper_black','outbound','dialCheckDuplicateType','CmList','Lists','get','always','push','sequelize','query','VoiceQueueId','VoiceQueue','findAll','all','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','stringify','finally','emit','contact:csv_','resolve','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','info','CSV\x20import\x20process\x20stopped!','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','bluebird','util','lodash','squel','papaparse','ioredis','../../../config/environment','../../../config/logger','defaults','redis','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','pick','catch','Error\x20while\x20creating\x20contact:\x20','cmContact','checkHopper','insert','cm_hopper','fromQuery','scheduledAt','createdAt','updatedAt','select'];(function(_0x3ca3cb,_0x196167){var _0xa0ed10=function(_0x3a920d){while(--_0x3a920d){_0x3ca3cb['push'](_0x3ca3cb['shift']());}};_0xa0ed10(++_0x196167);}(_0x30a5,0x9e));var _0x530a=function(_0x36146a,_0x25778a){_0x36146a=_0x36146a-0x0;var _0x1f2ca6=_0x30a5[_0x36146a];return _0x1f2ca6;};'use strict';var BPromise=require(_0x530a('0x0'));var util=require(_0x530a('0x1'));var _=require(_0x530a('0x2'));var fs=require('fs');var squel=require(_0x530a('0x3'));var Papa=require(_0x530a('0x4'));var Redis=require(_0x530a('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0x530a('0x6'));var logger=require(_0x530a('0x7'))('api');config['redis']=_[_0x530a('0x8')](config[_0x530a('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x530a('0xa'))(new Redis(config[_0x530a('0x9')]));require(_0x530a('0xb'))['register'](socket);try{if(!process['argv'][0x2]||process[_0x530a('0xc')][0x2]===_0x530a('0xd')||process['argv'][0x2]===_0x530a('0xe')){throw new Error(_0x530a('0xf'));}var FILEPATH=process[_0x530a('0xc')][0x2];if(!process[_0x530a('0xc')][0x3]||process[_0x530a('0xc')][0x3]===_0x530a('0xd')||process['argv'][0x3]==='null'||!process[_0x530a('0xc')][0x4]||process['argv'][0x4]==='undefined'||process[_0x530a('0xc')][0x4]===_0x530a('0xe')){throw new Error(_0x530a('0x10'));}var FIELDS=_[_0x530a('0x11')](process[_0x530a('0xc')][0x3][_0x530a('0x12')](','),process[_0x530a('0xc')][0x4][_0x530a('0x12')](','));if(!process[_0x530a('0xc')][0x5]||process['argv'][0x5]==='undefined'||process['argv'][0x5]===_0x530a('0xe')){throw new Error(_0x530a('0x13'));}var LISTID=process[_0x530a('0xc')][0x5];var COMPANYID=process['argv'][0x6]&&process['argv'][0x6]!==_0x530a('0xd')&&process[_0x530a('0xc')][0x6]!==_0x530a('0xe')?process[_0x530a('0xc')][0x6]:null;var DUPLICATES=process[_0x530a('0xc')][0x7]&&process[_0x530a('0xc')][0x7]!=='undefined'&&process[_0x530a('0xc')][0x7]!==_0x530a('0xe')?process[_0x530a('0xc')][0x7]:null;if(!process['argv'][0x8]||process[_0x530a('0xc')][0x8]===_0x530a('0xd')||process['argv'][0x8]===_0x530a('0xe')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x530a('0xc')][0x8];}catch(_0xe6925b){logger[_0x530a('0x14')](_0xe6925b);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(_0x5edd5c,_0x4a6b7c,_0xc19571,_0x265677){var _0x4e102c={'message':_0x4a6b7c};_0x4e102c[_0x5edd5c]=!![];if(_0xc19571){_0x4e102c[_0x530a('0x15')]=_0xc19571;}if(_0x265677){_0x4e102c[_0x530a('0x16')]=_0x265677;}return _0x4e102c;}function isEmail(_0x3696a6){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))*$/[_0x530a('0x17')](_0x3696a6);}function checkRow(_0x9c5a9,_0x201ce8,_0x2c5c7b){return new BPromise(function(_0x5b98a5,_0x2268d2){if(_[_0x530a('0x18')](_0x9c5a9)){return _0x2268d2(handleCheckRowError(_0x530a('0x14'),_0x530a('0x19'),null,_0x2c5c7b));}if(_0x9c5a9['errors']&&_0x9c5a9[_0x530a('0x1a')][_0x530a('0x1b')]){var _0xb77c10=_[_0x530a('0x1c')](_0x9c5a9['errors'],_0x530a('0x1d'))[_0x530a('0x1e')](';');return _0x2268d2(handleCheckRowError(_0x530a('0x14'),_0xb77c10,null,_0x2c5c7b));}var _0x12b5e4={};for(var _0xc694e6 in FIELDS){if(FIELDS[_0x530a('0x1f')](_0xc694e6)&&FIELDS[_0xc694e6]){_0x12b5e4[_0xc694e6]=_0x9c5a9['data'][0x0][FIELDS[_0xc694e6]]||_0x9c5a9[_0x530a('0x20')][0x0]['\ufeff'+FIELDS[_0xc694e6]];}}if(!_0x12b5e4[_0x530a('0x21')]){return _0x2268d2(handleCheckRowError(_0x530a('0x14'),_0x530a('0x22'),null,_0x2c5c7b));}if(!_0x12b5e4[_0x530a('0x23')]){return _0x2268d2(handleCheckRowError('error','phone\x20not\x20specified!',null,_0x2c5c7b));}if(_0x12b5e4['birthDate']){var _0x5d05b9=moment(_0x12b5e4[_0x530a('0x24')],_0x530a('0x25'));if(!_0x5d05b9[_0x530a('0x26')]()){return _0x2268d2(handleCheckRowError(_0x530a('0x14'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x2c5c7b));}}if(_0x12b5e4[_0x530a('0x27')]){if(!isEmail(_0x12b5e4[_0x530a('0x27')])){return _0x2268d2(handleCheckRowError('error',_0x530a('0x28'),null,_0x2c5c7b));}}_0x12b5e4[_0x530a('0x29')]=LISTID;_0x12b5e4[_0x530a('0x2a')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x201ce8){var _0x43708a={};for(var _0x52d885=0x0,_0x127959=DUPLICATES[_0x530a('0x1b')];_0x52d885<_0x127959;_0x52d885+=0x1){_0x43708a[DUPLICATES[_0x52d885]]=_0x12b5e4[DUPLICATES[_0x52d885]];}var _0x5c151f=_[_0x530a('0x2b')](_0x201ce8,_0x43708a);if(_0x5c151f){return _0x2268d2(handleCheckRowError(_0x530a('0x2c'),_0x530a('0x2d'),_0x5c151f,_0x2c5c7b));}}return db[_0x530a('0x2e')][_0x530a('0x2f')](_0x12b5e4,{'raw':!![],'hooks':![],'fields':_[_0x530a('0x30')](_0x12b5e4)})[_0x530a('0x31')](function(_0x422394){if(DUPLICATES&&DUPLICATES['length']&&_0x201ce8){_0x201ce8['push'](_[_0x530a('0x32')](_0x12b5e4,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x422394['id'];return _0x5b98a5();})[_0x530a('0x33')](function(_0x7ff398){return _0x2268d2(handleCheckRowError('error',_0x530a('0x34')+(_0x7ff398[_0x530a('0x1d')]||JSON['stringify'](_0x7ff398)),null,_0x2c5c7b));});});}function checkHopper(){function _0x13f350(){return function(_0x4450dd){logger[_0x530a('0x14')](_0x530a('0x35'),_0x530a('0x36'),util['inspect'](_0x4450dd,{'showHidden':![],'depth':null}));};}var _0x9cb5f7=function(_0x2d6a41,_0x2877e5){var _0x2c5f47=squel[_0x530a('0x37')]()['into'](_0x530a('0x38'))[_0x530a('0x39')]([_0x530a('0x23'),_0x530a('0x3a'),'ContactId',_0x530a('0x29'),_0x2877e5,_0x530a('0x3b'),_0x530a('0x3c')],squel[_0x530a('0x3d')]()['field'](_0x530a('0x23'),'phone')[_0x530a('0x3e')](_0x530a('0x3f'),'scheduledAt')[_0x530a('0x3e')]('id',_0x530a('0x40'))[_0x530a('0x3e')](LISTID[_0x530a('0x41')](),_0x530a('0x29'))[_0x530a('0x3e')](_0x2d6a41['id'][_0x530a('0x41')](),_0x2877e5)[_0x530a('0x3e')](_0x530a('0x3f'),_0x530a('0x3b'))['field'](_0x530a('0x3f'),_0x530a('0x3c'))[_0x530a('0x42')](_0x530a('0x43'))[_0x530a('0x44')](_0x530a('0x45'))[_0x530a('0x44')](_0x530a('0x46'),LISTID['toString']())[_0x530a('0x44')](_0x530a('0x47'))[_0x530a('0x44')](_0x530a('0x48'),squel['select']()[_0x530a('0x3e')](_0x530a('0x23'))[_0x530a('0x42')](_0x530a('0x38'))['where'](_0x2877e5+'\x20=\x20?',_0x2d6a41['id'][_0x530a('0x41')]())))[_0x530a('0x41')]();return _0x2c5f47;};var _0x772b7c=function(_0xd118cf,_0x1b8bd7){var _0x4b3f88=squel[_0x530a('0x37')]()[_0x530a('0x49')](_0x530a('0x38'))['fromQuery']([_0x530a('0x23'),_0x530a('0x3a'),_0x530a('0x40'),'ListId',_0x1b8bd7,_0x530a('0x3b'),'updatedAt'],squel['select']()[_0x530a('0x3e')](_0x530a('0x23'),_0x530a('0x23'))[_0x530a('0x3e')]('NOW()',_0x530a('0x3a'))[_0x530a('0x3e')]('id',_0x530a('0x40'))[_0x530a('0x3e')](LISTID[_0x530a('0x41')](),_0x530a('0x29'))[_0x530a('0x3e')](_0xd118cf['id'][_0x530a('0x41')](),_0x1b8bd7)[_0x530a('0x3e')](_0x530a('0x3f'),_0x530a('0x3b'))[_0x530a('0x3e')](_0x530a('0x3f'),_0x530a('0x3c'))['from'](_0x530a('0x43'))[_0x530a('0x44')](_0x530a('0x45'))[_0x530a('0x44')]('ListId\x20=\x20?',LISTID[_0x530a('0x41')]())['where'](_0x530a('0x4a'),squel['str'](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL')[_0x530a('0x44')](_0x530a('0x48'),squel['select']()[_0x530a('0x3e')]('calleridnum')['from'](_0x530a('0x4b'))[_0x530a('0x44')](_0x1b8bd7+_0x530a('0x4c'),_0xd118cf['id'][_0x530a('0x41')]()))[_0x530a('0x44')]('phone\x20NOT\x20IN\x20(?)',squel[_0x530a('0x3d')]()[_0x530a('0x3e')](_0x530a('0x23'))[_0x530a('0x42')](_0x530a('0x38'))[_0x530a('0x44')](_0x1b8bd7+_0x530a('0x4c'),_0xd118cf['id'][_0x530a('0x41')]())))[_0x530a('0x41')]();return _0x4b3f88;};function _0x43146e(_0xf97607,_0x1d8e82){var _0x349437=squel[_0x530a('0x37')]()[_0x530a('0x49')](_0x530a('0x38'))[_0x530a('0x39')]([_0x530a('0x23'),'scheduledAt',_0x530a('0x40'),_0x530a('0x29'),_0x1d8e82,_0x530a('0x3b'),_0x530a('0x3c')],squel[_0x530a('0x3d')]()['field']('phone','phone')[_0x530a('0x3e')](_0x530a('0x3f'),_0x530a('0x3a'))[_0x530a('0x3e')]('id',_0x530a('0x40'))[_0x530a('0x3e')](LISTID[_0x530a('0x41')](),_0x530a('0x29'))[_0x530a('0x3e')](_0xf97607['id'][_0x530a('0x41')](),_0x1d8e82)['field'](_0x530a('0x3f'),_0x530a('0x3b'))[_0x530a('0x3e')](_0x530a('0x3f'),_0x530a('0x3c'))[_0x530a('0x42')](_0x530a('0x43'))[_0x530a('0x44')](_0x530a('0x45'))['where']('ListId\x20=\x20?',LISTID['toString']())[_0x530a('0x44')](_0x530a('0x4a'),squel[_0x530a('0x4d')](hopperContacts))[_0x530a('0x44')](_0x530a('0x47')))[_0x530a('0x41')]();return _0x349437;}function _0x3aaa52(_0x35fe92,_0x3eef88){var _0x305b0a=squel[_0x530a('0x37')]()[_0x530a('0x49')](_0x530a('0x4e'))['fromQuery']([_0x530a('0x23'),_0x530a('0x40'),'ListId',_0x3eef88,'createdAt',_0x530a('0x3c')],squel[_0x530a('0x3d')]()[_0x530a('0x3e')](_0x530a('0x23'),_0x530a('0x23'))[_0x530a('0x3e')]('id',_0x530a('0x40'))[_0x530a('0x3e')](LISTID[_0x530a('0x41')](),_0x530a('0x29'))['field'](_0x35fe92['id'][_0x530a('0x41')](),_0x3eef88)[_0x530a('0x3e')]('NOW()','createdAt')[_0x530a('0x3e')](_0x530a('0x3f'),_0x530a('0x3c'))[_0x530a('0x42')](_0x530a('0x43'))[_0x530a('0x44')](_0x530a('0x45'))['where'](_0x530a('0x46'),LISTID[_0x530a('0x41')]())[_0x530a('0x44')](_0x530a('0x4a'),squel['str'](hopperContacts))[_0x530a('0x44')]('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0x305b0a;}return db['VoiceQueue']['findAll']({'where':{'type':_0x530a('0x4f')},'attributes':['id',_0x530a('0x50')],'include':[{'model':db[_0x530a('0x51')],'as':_0x530a('0x52'),'where':{'id':LISTID}}]})[_0x530a('0x31')](function(_0x49585f){var _0x462fbf=[];if(_0x49585f){var _0x580f36;for(var _0x2c60fb=0x0,_0x5370c1;_0x2c60fb<_0x49585f[_0x530a('0x1b')];_0x2c60fb+=0x1){_0x5370c1=_0x49585f[_0x2c60fb][_0x530a('0x53')]({'plain':!![]});switch(_0x5370c1[_0x530a('0x50')]){case _0x530a('0x54'):_0x462fbf[_0x530a('0x55')](db[_0x530a('0x56')][_0x530a('0x57')](_0x772b7c(_0x5370c1,_0x530a('0x58')))[_0x530a('0x31')](function(){})[_0x530a('0x33')](_0x13f350()));break;case'onlyIfOpen':_0x462fbf[_0x530a('0x55')](db[_0x530a('0x56')]['query'](_0x9cb5f7(_0x5370c1,'VoiceQueueId'))[_0x530a('0x31')](function(){})[_0x530a('0x33')](_0x13f350()));break;default:_0x462fbf[_0x530a('0x55')](db['sequelize'][_0x530a('0x57')](_0x43146e(_0x5370c1,_0x530a('0x58')))[_0x530a('0x31')](function(){})[_0x530a('0x33')](_0x13f350()));}}}return _0x462fbf;})['all']()[_0x530a('0x31')](function(){return db[_0x530a('0x59')][_0x530a('0x5a')]({'where':{'type':_0x530a('0x4f')},'attributes':['id'],'include':[{'model':db[_0x530a('0x51')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x530a('0x31')](function(_0xaccb12){var _0x281ae9=[];if(_0xaccb12){var _0x11f945;for(var _0x174bc4=0x0,_0x301928;_0x174bc4<_0xaccb12['length'];_0x174bc4+=0x1){_0x301928=_0xaccb12[_0x174bc4][_0x530a('0x53')]({'plain':!![]});_0x281ae9[_0x530a('0x55')](db[_0x530a('0x56')][_0x530a('0x57')](_0x3aaa52(_0x301928,_0x530a('0x58')))[_0x530a('0x31')](function(){})[_0x530a('0x33')](_0x13f350()));}}return _0x281ae9;})[_0x530a('0x5b')]();})['then'](function(){return db['Campaign'][_0x530a('0x5a')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x530a('0x51')],'as':_0x530a('0x52'),'where':{'id':LISTID}}]})[_0x530a('0x31')](function(_0x52e3d7){var _0x21ed0a=[];if(_0x52e3d7){for(var _0x1366de=0x0,_0x36aece;_0x1366de<_0x52e3d7[_0x530a('0x1b')];_0x1366de+=0x1){_0x36aece=_0x52e3d7[_0x1366de]['get']({'plain':!![]});switch(_0x36aece['dialCheckDuplicateType']){case _0x530a('0x54'):_0x21ed0a[_0x530a('0x55')](db[_0x530a('0x56')]['query'](_0x772b7c(_0x36aece,_0x530a('0x5c')))[_0x530a('0x31')](function(){})['catch'](_0x13f350()));break;case'onlyIfOpen':_0x21ed0a[_0x530a('0x55')](db['sequelize']['query'](_0x9cb5f7(_0x36aece,_0x530a('0x5c')))[_0x530a('0x31')](function(){})[_0x530a('0x33')](_0x13f350()));break;default:_0x21ed0a[_0x530a('0x55')](db['sequelize']['query'](_0x43146e(_0x36aece,_0x530a('0x5c')))[_0x530a('0x31')](function(){})[_0x530a('0x33')](_0x13f350()));}}}return _0x21ed0a;})[_0x530a('0x5b')]();})[_0x530a('0x31')](function(){return db['Campaign']['findAll']({'attributes':['id'],'include':[{'model':db[_0x530a('0x51')],'as':_0x530a('0x5d'),'where':{'id':LISTID}}]})[_0x530a('0x31')](function(_0xc5a1b7){var _0xaa07ad=[];if(_0xc5a1b7){for(var _0x3d63c3=0x0,_0x28a5fe;_0x3d63c3<_0xc5a1b7['length'];_0x3d63c3+=0x1){_0x28a5fe=_0xc5a1b7[_0x3d63c3][_0x530a('0x53')]({'plain':!![]});_0xaa07ad[_0x530a('0x55')](db[_0x530a('0x56')]['query'](_0x3aaa52(_0x28a5fe,_0x530a('0x5c')))[_0x530a('0x31')](function(){})['catch'](_0x13f350()));}}return _0xaa07ad;})[_0x530a('0x5b')]();})[_0x530a('0x33')](function(_0x19a502){logger['error'](_0x530a('0x5e'),_0x530a('0x5f'),_0x19a502['message']);});}var processPromises=function(_0x49fd76){return BPromise[_0x530a('0x5b')](promises)['then'](function(_0x2608a2){})['catch'](function(_0x5fc33){logger['error'](_0x530a('0x60'),JSON[_0x530a('0x61')](_0x5fc33));})[_0x530a('0x62')](function(){socket[_0x530a('0x63')](_0x530a('0x64')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x49fd76){return _0x49fd76['resume']();}});};var endCsv=function(){return BPromise[_0x530a('0x65')]()[_0x530a('0x31')](function(){if(hopperContacts){return checkHopper();}})[_0x530a('0x31')](function(){socket[_0x530a('0x63')](_0x530a('0x64')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x2363ca){logger[_0x530a('0x14')](_0x530a('0x66'),JSON[_0x530a('0x61')](_0x2363ca));}finally{process['exit'](0x0);}});};process['on'](_0x530a('0x67'),function(){logger[_0x530a('0x68')](_0x530a('0x69'));endCsv();});function main(){return BPromise[_0x530a('0x65')]()[_0x530a('0x31')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x530a('0x12')](',');return db[_0x530a('0x2e')][_0x530a('0x5a')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x530a('0x31')](function(_0x14c824){var _0x189673=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x530a('0x6a')](_0x189673,{'header':!![],'skipEmptyLines':!![],'step':function(_0x327608,_0x528fd){total+=0x1;var _0x43871a=total;promises[_0x530a('0x55')](checkRow(_0x327608,_0x14c824,_0x43871a)[_0x530a('0x31')](function(){success+=0x1;})[_0x530a('0x33')](function(_0x3dd791){if(_0x3dd791[_0x530a('0x14')]){errors+=0x1;delete _0x3dd791['error'];}else if(_0x3dd791[_0x530a('0x2c')]){duplicates+=0x1;delete _0x3dd791[_0x530a('0x2c')];}rows[_0x530a('0x55')](_0x3dd791);}));if(total%0xc8===0x0){_0x528fd[_0x530a('0x6b')]();return processPromises(_0x528fd);}},'complete':function(){return processPromises()[_0x530a('0x31')](function(){logger[_0x530a('0x68')](_0x530a('0x6c'));endCsv();});},'error':function(_0x3a3711,_0x5aedda){logger[_0x530a('0x68')](_0x530a('0x6d'),JSON[_0x530a('0x61')](_0x3a3711));endCsv();}});})[_0x530a('0x33')](function(_0x382dec){logger[_0x530a('0x14')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x530a('0x61')](_0x382dec));});}main(); \ No newline at end of file +var _0xd2a8=['birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','then','pick','catch','Error\x20while\x20creating\x20contact:\x20','cmContact','inspect','insert','into','fromQuery','phone','scheduledAt','createdAt','updatedAt','select','NOW()','field','ContactId','toString','from','where','phone\x20IS\x20NOT\x20NULL','cm_hopper','\x20=\x20?','cm_contacts','id\x20IN\x20?','str','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','deletedAt\x20IS\x20NULL','cm_hopper_black','ListId\x20=\x20?','VoiceQueue','findAll','outbound','dialCheckDuplicateType','Lists','get','always','push','sequelize','query','VoiceQueueId','CmList','BlackLists','all','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','stringify','finally','emit','resume','contact:csv_','unlinkSync','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','CmContact','createReadStream','pause','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','argv','undefined','null','Missing\x20filepath\x20parameter!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','test','isNil','errors','length','map','message','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid'];(function(_0x2854f4,_0x325e45){var _0x3bfe00=function(_0x2f36bf){while(--_0x2f36bf){_0x2854f4['push'](_0x2854f4['shift']());}};_0x3bfe00(++_0x325e45);}(_0xd2a8,0x124));var _0x8d2a=function(_0x572781,_0x2d41b5){_0x572781=_0x572781-0x0;var _0x1805dc=_0xd2a8[_0x572781];return _0x1805dc;};'use strict';var BPromise=require(_0x8d2a('0x0'));var util=require(_0x8d2a('0x1'));var _=require(_0x8d2a('0x2'));var fs=require('fs');var squel=require(_0x8d2a('0x3'));var Papa=require(_0x8d2a('0x4'));var Redis=require(_0x8d2a('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0x8d2a('0x6'));var logger=require(_0x8d2a('0x7'))('api');config[_0x8d2a('0x8')]=_[_0x8d2a('0x9')](config[_0x8d2a('0x8')],{'host':_0x8d2a('0xa'),'port':0x18eb});var socket=require(_0x8d2a('0xb'))(new Redis(config[_0x8d2a('0x8')]));require('../../../api/cmContact/cmContact.socket')['register'](socket);try{if(!process[_0x8d2a('0xc')][0x2]||process[_0x8d2a('0xc')][0x2]===_0x8d2a('0xd')||process[_0x8d2a('0xc')][0x2]===_0x8d2a('0xe')){throw new Error(_0x8d2a('0xf'));}var FILEPATH=process[_0x8d2a('0xc')][0x2];if(!process[_0x8d2a('0xc')][0x3]||process[_0x8d2a('0xc')][0x3]===_0x8d2a('0xd')||process[_0x8d2a('0xc')][0x3]===_0x8d2a('0xe')||!process['argv'][0x4]||process[_0x8d2a('0xc')][0x4]===_0x8d2a('0xd')||process[_0x8d2a('0xc')][0x4]===_0x8d2a('0xe')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x8d2a('0x10')](process[_0x8d2a('0xc')][0x3][_0x8d2a('0x11')](','),process[_0x8d2a('0xc')][0x4][_0x8d2a('0x11')](','));if(!process[_0x8d2a('0xc')][0x5]||process[_0x8d2a('0xc')][0x5]===_0x8d2a('0xd')||process['argv'][0x5]===_0x8d2a('0xe')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x8d2a('0xc')][0x6]&&process[_0x8d2a('0xc')][0x6]!==_0x8d2a('0xd')&&process[_0x8d2a('0xc')][0x6]!=='null'?process['argv'][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x8d2a('0xc')][0x7]!==_0x8d2a('0xd')&&process[_0x8d2a('0xc')][0x7]!==_0x8d2a('0xe')?process['argv'][0x7]:null;if(!process[_0x8d2a('0xc')][0x8]||process[_0x8d2a('0xc')][0x8]==='undefined'||process[_0x8d2a('0xc')][0x8]===_0x8d2a('0xe')){throw new Error(_0x8d2a('0x12'));}var SOCKET_TIMESTAMP=process[_0x8d2a('0xc')][0x8];}catch(_0x46e7a3){logger[_0x8d2a('0x13')](_0x46e7a3);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(_0x130712,_0x72dc3b,_0x5557da,_0x1a0eb6){var _0x39ab94={'message':_0x72dc3b};_0x39ab94[_0x130712]=!![];if(_0x5557da){_0x39ab94[_0x8d2a('0x14')]=_0x5557da;}if(_0x1a0eb6){_0x39ab94['index']=_0x1a0eb6;}return _0x39ab94;}function isEmail(_0x1412c3){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))*$/[_0x8d2a('0x15')](_0x1412c3);}function checkRow(_0x43384f,_0x366b2f,_0x2d5c1a){return new BPromise(function(_0x2ccaa1,_0x188880){if(_[_0x8d2a('0x16')](_0x43384f)){return _0x188880(handleCheckRowError(_0x8d2a('0x13'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x2d5c1a));}if(_0x43384f[_0x8d2a('0x17')]&&_0x43384f['errors'][_0x8d2a('0x18')]){var _0x30585c=_[_0x8d2a('0x19')](_0x43384f[_0x8d2a('0x17')],_0x8d2a('0x1a'))['join'](';');return _0x188880(handleCheckRowError(_0x8d2a('0x13'),_0x30585c,null,_0x2d5c1a));}var _0x394815={};for(var _0x1e7a28 in FIELDS){if(FIELDS[_0x8d2a('0x1b')](_0x1e7a28)&&FIELDS[_0x1e7a28]){_0x394815[_0x1e7a28]=_0x43384f['data'][0x0][FIELDS[_0x1e7a28]]||_0x43384f[_0x8d2a('0x1c')][0x0]['\ufeff'+FIELDS[_0x1e7a28]];}}if(!_0x394815[_0x8d2a('0x1d')]){return _0x188880(handleCheckRowError('error',_0x8d2a('0x1e'),null,_0x2d5c1a));}if(!_0x394815['phone']){return _0x188880(handleCheckRowError(_0x8d2a('0x13'),_0x8d2a('0x1f'),null,_0x2d5c1a));}if(_0x394815[_0x8d2a('0x20')]){var _0x4bd684=moment(_0x394815[_0x8d2a('0x20')],_0x8d2a('0x21'));if(!_0x4bd684[_0x8d2a('0x22')]()){return _0x188880(handleCheckRowError(_0x8d2a('0x13'),_0x8d2a('0x23'),null,_0x2d5c1a));}}if(_0x394815['email']){if(!isEmail(_0x394815[_0x8d2a('0x24')])){return _0x188880(handleCheckRowError(_0x8d2a('0x13'),_0x8d2a('0x25'),null,_0x2d5c1a));}}_0x394815[_0x8d2a('0x26')]=LISTID;_0x394815[_0x8d2a('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x8d2a('0x18')]&&_0x366b2f){var _0x22e592={};for(var _0x382bde=0x0,_0x318937=DUPLICATES[_0x8d2a('0x18')];_0x382bde<_0x318937;_0x382bde+=0x1){_0x22e592[DUPLICATES[_0x382bde]]=_0x394815[DUPLICATES[_0x382bde]];}var _0x20aeac=_[_0x8d2a('0x28')](_0x366b2f,_0x22e592);if(_0x20aeac){return _0x188880(handleCheckRowError(_0x8d2a('0x29'),'Duplicate\x20Contact',_0x20aeac,_0x2d5c1a));}}return db['CmContact']['create'](_0x394815,{'raw':!![],'hooks':![],'fields':_['keys'](_0x394815)})[_0x8d2a('0x2a')](function(_0x29ea72){if(DUPLICATES&&DUPLICATES['length']&&_0x366b2f){_0x366b2f['push'](_[_0x8d2a('0x2b')](_0x394815,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x29ea72['id'];return _0x2ccaa1();})[_0x8d2a('0x2c')](function(_0x29ac54){return _0x188880(handleCheckRowError('error',_0x8d2a('0x2d')+(_0x29ac54['message']||JSON['stringify'](_0x29ac54)),null,_0x2d5c1a));});});}function checkHopper(){function _0x330da0(){return function(_0x92716a){logger[_0x8d2a('0x13')](_0x8d2a('0x2e'),'checkHopper',util[_0x8d2a('0x2f')](_0x92716a,{'showHidden':![],'depth':null}));};}var _0x4903a2=function(_0x313c47,_0x353e22){var _0x311b3e=squel[_0x8d2a('0x30')]()[_0x8d2a('0x31')]('cm_hopper')[_0x8d2a('0x32')]([_0x8d2a('0x33'),_0x8d2a('0x34'),'ContactId',_0x8d2a('0x26'),_0x353e22,_0x8d2a('0x35'),_0x8d2a('0x36')],squel[_0x8d2a('0x37')]()['field'](_0x8d2a('0x33'),_0x8d2a('0x33'))['field'](_0x8d2a('0x38'),_0x8d2a('0x34'))[_0x8d2a('0x39')]('id',_0x8d2a('0x3a'))[_0x8d2a('0x39')](LISTID[_0x8d2a('0x3b')](),_0x8d2a('0x26'))[_0x8d2a('0x39')](_0x313c47['id'][_0x8d2a('0x3b')](),_0x353e22)[_0x8d2a('0x39')](_0x8d2a('0x38'),_0x8d2a('0x35'))[_0x8d2a('0x39')](_0x8d2a('0x38'),_0x8d2a('0x36'))[_0x8d2a('0x3c')]('cm_contacts')[_0x8d2a('0x3d')]('deletedAt\x20IS\x20NULL')[_0x8d2a('0x3d')]('ListId\x20=\x20?',LISTID[_0x8d2a('0x3b')]())[_0x8d2a('0x3d')](_0x8d2a('0x3e'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x8d2a('0x37')]()[_0x8d2a('0x39')](_0x8d2a('0x33'))['from'](_0x8d2a('0x3f'))[_0x8d2a('0x3d')](_0x353e22+_0x8d2a('0x40'),_0x313c47['id']['toString']())))[_0x8d2a('0x3b')]();return _0x311b3e;};var _0x5de7ea=function(_0x2057c5,_0x412480){var _0x21c4e1=squel[_0x8d2a('0x30')]()[_0x8d2a('0x31')](_0x8d2a('0x3f'))[_0x8d2a('0x32')]([_0x8d2a('0x33'),_0x8d2a('0x34'),_0x8d2a('0x3a'),_0x8d2a('0x26'),_0x412480,_0x8d2a('0x35'),_0x8d2a('0x36')],squel['select']()['field'](_0x8d2a('0x33'),'phone')['field']('NOW()',_0x8d2a('0x34'))['field']('id',_0x8d2a('0x3a'))[_0x8d2a('0x39')](LISTID[_0x8d2a('0x3b')](),_0x8d2a('0x26'))[_0x8d2a('0x39')](_0x2057c5['id'][_0x8d2a('0x3b')](),_0x412480)[_0x8d2a('0x39')]('NOW()','createdAt')[_0x8d2a('0x39')](_0x8d2a('0x38'),'updatedAt')['from'](_0x8d2a('0x41'))[_0x8d2a('0x3d')]('deletedAt\x20IS\x20NULL')[_0x8d2a('0x3d')]('ListId\x20=\x20?',LISTID[_0x8d2a('0x3b')]())[_0x8d2a('0x3d')](_0x8d2a('0x42'),squel[_0x8d2a('0x43')](hopperContacts))[_0x8d2a('0x3d')](_0x8d2a('0x3e'))['where'](_0x8d2a('0x44'),squel[_0x8d2a('0x37')]()[_0x8d2a('0x39')](_0x8d2a('0x45'))['from'](_0x8d2a('0x46'))['where'](_0x412480+_0x8d2a('0x40'),_0x2057c5['id'][_0x8d2a('0x3b')]()))[_0x8d2a('0x3d')]('phone\x20NOT\x20IN\x20(?)',squel['select']()['field']('phone')[_0x8d2a('0x3c')](_0x8d2a('0x3f'))[_0x8d2a('0x3d')](_0x412480+_0x8d2a('0x40'),_0x2057c5['id']['toString']())))[_0x8d2a('0x3b')]();return _0x21c4e1;};function _0x50ded9(_0x56cbe2,_0x1d5c87){var _0x57a62f=squel[_0x8d2a('0x30')]()[_0x8d2a('0x31')](_0x8d2a('0x3f'))[_0x8d2a('0x32')](['phone',_0x8d2a('0x34'),'ContactId',_0x8d2a('0x26'),_0x1d5c87,_0x8d2a('0x35'),_0x8d2a('0x36')],squel[_0x8d2a('0x37')]()[_0x8d2a('0x39')](_0x8d2a('0x33'),_0x8d2a('0x33'))[_0x8d2a('0x39')](_0x8d2a('0x38'),_0x8d2a('0x34'))[_0x8d2a('0x39')]('id',_0x8d2a('0x3a'))[_0x8d2a('0x39')](LISTID['toString'](),_0x8d2a('0x26'))[_0x8d2a('0x39')](_0x56cbe2['id'][_0x8d2a('0x3b')](),_0x1d5c87)[_0x8d2a('0x39')](_0x8d2a('0x38'),_0x8d2a('0x35'))['field']('NOW()','updatedAt')[_0x8d2a('0x3c')]('cm_contacts')[_0x8d2a('0x3d')](_0x8d2a('0x47'))[_0x8d2a('0x3d')]('ListId\x20=\x20?',LISTID['toString']())[_0x8d2a('0x3d')](_0x8d2a('0x42'),squel[_0x8d2a('0x43')](hopperContacts))[_0x8d2a('0x3d')](_0x8d2a('0x3e')))[_0x8d2a('0x3b')]();return _0x57a62f;}function _0x4592d6(_0x4886c9,_0x528e99){var _0x3094fa=squel[_0x8d2a('0x30')]()[_0x8d2a('0x31')](_0x8d2a('0x48'))[_0x8d2a('0x32')]([_0x8d2a('0x33'),_0x8d2a('0x3a'),_0x8d2a('0x26'),_0x528e99,_0x8d2a('0x35'),_0x8d2a('0x36')],squel['select']()[_0x8d2a('0x39')](_0x8d2a('0x33'),_0x8d2a('0x33'))[_0x8d2a('0x39')]('id',_0x8d2a('0x3a'))['field'](LISTID['toString'](),_0x8d2a('0x26'))[_0x8d2a('0x39')](_0x4886c9['id'][_0x8d2a('0x3b')](),_0x528e99)[_0x8d2a('0x39')]('NOW()','createdAt')[_0x8d2a('0x39')]('NOW()',_0x8d2a('0x36'))['from'](_0x8d2a('0x41'))['where'](_0x8d2a('0x47'))['where'](_0x8d2a('0x49'),LISTID[_0x8d2a('0x3b')]())['where'](_0x8d2a('0x42'),squel[_0x8d2a('0x43')](hopperContacts))[_0x8d2a('0x3d')]('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0x3094fa;}return db[_0x8d2a('0x4a')][_0x8d2a('0x4b')]({'where':{'type':_0x8d2a('0x4c')},'attributes':['id',_0x8d2a('0x4d')],'include':[{'model':db['CmList'],'as':_0x8d2a('0x4e'),'where':{'id':LISTID}}]})[_0x8d2a('0x2a')](function(_0x226c6f){var _0x2c65a7=[];if(_0x226c6f){var _0x4edbec;for(var _0x594799=0x0,_0x17ded3;_0x594799<_0x226c6f['length'];_0x594799+=0x1){_0x17ded3=_0x226c6f[_0x594799][_0x8d2a('0x4f')]({'plain':!![]});switch(_0x17ded3[_0x8d2a('0x4d')]){case _0x8d2a('0x50'):_0x2c65a7[_0x8d2a('0x51')](db[_0x8d2a('0x52')][_0x8d2a('0x53')](_0x5de7ea(_0x17ded3,_0x8d2a('0x54')))[_0x8d2a('0x2a')](function(){})[_0x8d2a('0x2c')](_0x330da0()));break;case'onlyIfOpen':_0x2c65a7[_0x8d2a('0x51')](db[_0x8d2a('0x52')][_0x8d2a('0x53')](_0x4903a2(_0x17ded3,_0x8d2a('0x54')))[_0x8d2a('0x2a')](function(){})[_0x8d2a('0x2c')](_0x330da0()));break;default:_0x2c65a7[_0x8d2a('0x51')](db[_0x8d2a('0x52')][_0x8d2a('0x53')](_0x50ded9(_0x17ded3,_0x8d2a('0x54')))[_0x8d2a('0x2a')](function(){})[_0x8d2a('0x2c')](_0x330da0()));}}}return _0x2c65a7;})['all']()[_0x8d2a('0x2a')](function(){return db[_0x8d2a('0x4a')][_0x8d2a('0x4b')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0x8d2a('0x55')],'as':_0x8d2a('0x56'),'where':{'id':LISTID}}]})[_0x8d2a('0x2a')](function(_0x192a32){var _0x3651ed=[];if(_0x192a32){var _0x263f73;for(var _0x55123d=0x0,_0x5ef197;_0x55123d<_0x192a32['length'];_0x55123d+=0x1){_0x5ef197=_0x192a32[_0x55123d][_0x8d2a('0x4f')]({'plain':!![]});_0x3651ed['push'](db[_0x8d2a('0x52')]['query'](_0x4592d6(_0x5ef197,'VoiceQueueId'))[_0x8d2a('0x2a')](function(){})[_0x8d2a('0x2c')](_0x330da0()));}}return _0x3651ed;})[_0x8d2a('0x57')]();})[_0x8d2a('0x2a')](function(){return db[_0x8d2a('0x58')]['findAll']({'attributes':['id',_0x8d2a('0x4d')],'include':[{'model':db[_0x8d2a('0x55')],'as':_0x8d2a('0x4e'),'where':{'id':LISTID}}]})[_0x8d2a('0x2a')](function(_0x4962ea){var _0x5f4136=[];if(_0x4962ea){for(var _0x63cabf=0x0,_0x361052;_0x63cabf<_0x4962ea[_0x8d2a('0x18')];_0x63cabf+=0x1){_0x361052=_0x4962ea[_0x63cabf][_0x8d2a('0x4f')]({'plain':!![]});switch(_0x361052[_0x8d2a('0x4d')]){case _0x8d2a('0x50'):_0x5f4136[_0x8d2a('0x51')](db[_0x8d2a('0x52')][_0x8d2a('0x53')](_0x5de7ea(_0x361052,_0x8d2a('0x59')))[_0x8d2a('0x2a')](function(){})[_0x8d2a('0x2c')](_0x330da0()));break;case'onlyIfOpen':_0x5f4136[_0x8d2a('0x51')](db[_0x8d2a('0x52')][_0x8d2a('0x53')](_0x4903a2(_0x361052,_0x8d2a('0x59')))[_0x8d2a('0x2a')](function(){})['catch'](_0x330da0()));break;default:_0x5f4136[_0x8d2a('0x51')](db[_0x8d2a('0x52')][_0x8d2a('0x53')](_0x50ded9(_0x361052,_0x8d2a('0x59')))[_0x8d2a('0x2a')](function(){})['catch'](_0x330da0()));}}}return _0x5f4136;})[_0x8d2a('0x57')]();})['then'](function(){return db[_0x8d2a('0x58')][_0x8d2a('0x4b')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x8d2a('0x56'),'where':{'id':LISTID}}]})[_0x8d2a('0x2a')](function(_0x4fcd9f){var _0x36f386=[];if(_0x4fcd9f){for(var _0xe574ff=0x0,_0x267d90;_0xe574ff<_0x4fcd9f[_0x8d2a('0x18')];_0xe574ff+=0x1){_0x267d90=_0x4fcd9f[_0xe574ff][_0x8d2a('0x4f')]({'plain':!![]});_0x36f386['push'](db['sequelize'][_0x8d2a('0x53')](_0x4592d6(_0x267d90,_0x8d2a('0x59')))[_0x8d2a('0x2a')](function(){})[_0x8d2a('0x2c')](_0x330da0()));}}return _0x36f386;})['all']();})[_0x8d2a('0x2c')](function(_0x3fc8d1){logger[_0x8d2a('0x13')](_0x8d2a('0x5a'),_0x8d2a('0x5b'),_0x3fc8d1[_0x8d2a('0x1a')]);});}var processPromises=function(_0x17cdb6){return BPromise[_0x8d2a('0x57')](promises)[_0x8d2a('0x2a')](function(_0x1abbaf){})['catch'](function(_0x182cd3){logger[_0x8d2a('0x13')](_0x8d2a('0x5c'),JSON[_0x8d2a('0x5d')](_0x182cd3));})[_0x8d2a('0x5e')](function(){socket[_0x8d2a('0x5f')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x17cdb6){return _0x17cdb6[_0x8d2a('0x60')]();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket['emit'](_0x8d2a('0x61')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x8d2a('0x62')](FILEPATH);}catch(_0x2bccb3){logger['error']('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x8d2a('0x5d')](_0x2bccb3));}finally{process[_0x8d2a('0x63')](0x0);}});};process['on'](_0x8d2a('0x64'),function(){logger[_0x8d2a('0x65')](_0x8d2a('0x66'));endCsv();});function main(){return BPromise[_0x8d2a('0x67')]()[_0x8d2a('0x2a')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x8d2a('0x11')](',');return db[_0x8d2a('0x68')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x8d2a('0x2a')](function(_0x183345){var _0x1aa438=fs[_0x8d2a('0x69')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x1aa438,{'header':!![],'skipEmptyLines':!![],'step':function(_0x1a5bb2,_0x4e07de){total+=0x1;var _0x4f99be=total;promises[_0x8d2a('0x51')](checkRow(_0x1a5bb2,_0x183345,_0x4f99be)[_0x8d2a('0x2a')](function(){success+=0x1;})[_0x8d2a('0x2c')](function(_0x2cdb50){if(_0x2cdb50[_0x8d2a('0x13')]){errors+=0x1;delete _0x2cdb50[_0x8d2a('0x13')];}else if(_0x2cdb50[_0x8d2a('0x29')]){duplicates+=0x1;delete _0x2cdb50[_0x8d2a('0x29')];}rows['push'](_0x2cdb50);}));if(total%0xc8===0x0){_0x4e07de[_0x8d2a('0x6a')]();return processPromises(_0x4e07de);}},'complete':function(){return processPromises()[_0x8d2a('0x2a')](function(){logger[_0x8d2a('0x65')](_0x8d2a('0x6b'));endCsv();});},'error':function(_0x4673c4,_0xb9b316){logger[_0x8d2a('0x65')]('CSV\x20parse\x20error',JSON[_0x8d2a('0x5d')](_0x4673c4));endCsv();}});})[_0x8d2a('0x2c')](function(_0x539b95){logger[_0x8d2a('0x13')](_0x8d2a('0x6c'),JSON[_0x8d2a('0x5d')](_0x539b95));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 03817cb..c1694d0 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 _0x3e2e=['ListId','createdAt','updatedAt','priority','UserId','recallme','cm_contacts','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.phone','cm_hopper_black','fields','.CmListId','select','ListId\x20=\x20?','\x20=\x20?','concat','CompanyId','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','group','info','Received\x20SIGINT','error','message','exit','push','code','sequelize','query','spread','catch','main','stringify','send','start','binding','socket_timestamp','root','server/files/tmp','.csv','keys','header','parse','createReadStream','data','length','errors','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','includes','email','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','isNil',',\x20scheduledAt\x20=\x20NOW()','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','CampaignId','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','existsSync','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','map','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','../../../config/environment','../../../config/logger','defaults','localhost','socket.io-emitter','test','field','phone','from','join','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat'];(function(_0x3da2dc,_0x5ef93f){var _0x3150ec=function(_0x21a956){while(--_0x21a956){_0x3da2dc['push'](_0x3da2dc['shift']());}};_0x3150ec(++_0x5ef93f);}(_0x3e2e,0xda));var _0xe3e2=function(_0x6befb6,_0x31f4dc){_0x6befb6=_0x6befb6-0x0;var _0x4324aa=_0x3e2e[_0x6befb6];return _0x4324aa;};'use strict';var fs=require('fs');var path=require(_0xe3e2('0x0'));var _=require(_0xe3e2('0x1'));var Papa=require(_0xe3e2('0x2'));var util=require(_0xe3e2('0x3'));var BPromise=require(_0xe3e2('0x4'));var moment=require(_0xe3e2('0x5'));var squel=require('squel');var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require(_0xe3e2('0x6'));var logger=require(_0xe3e2('0x7'))('import');config['redis']=_[_0xe3e2('0x8')](config['redis'],{'host':_0xe3e2('0x9'),'port':0x18eb});var socket=require(_0xe3e2('0xa'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x3bc7e3){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))*$/[_0xe3e2('0xb')](_0x3bc7e3);}function selectNotIn(_0x2aeeb2,_0x3f74fe,_0x1126bc,_0x358496,_0x2126ca){return squel['select']()[_0xe3e2('0xc')](_0xe3e2('0xd'))[_0xe3e2('0xe')](_0x358496)[_0xe3e2('0xf')](_0x3f74fe,null,_0x3f74fe+_0xe3e2('0x10')+_0x358496+'.'+_0x1126bc)['where'](_0x358496+'.'+_0x1126bc+_0xe3e2('0x11')+_0x2aeeb2+'.'+_0x1126bc)[_0xe3e2('0x12')](_0x3f74fe+_0xe3e2('0x13')+_0x2126ca['join']()+')');}function insertCmHopper(_0x40a3eb,_0x3a72cc,_0x432f66,_0x46547a,_0x3e6a92){var _0x109313=['cm_contacts.phone',_0xe3e2('0x14'),_0xe3e2('0x15'),_0xe3e2('0x16'),_0x3a72cc+'.'+_0x46547a,_0xe3e2('0x17'),_0xe3e2('0x18'),_0xe3e2('0x19'),_0xe3e2('0x1a'),'\x22'+_0x3e6a92+'\x22'];return squel[_0xe3e2('0x1b')]()[_0xe3e2('0x1c')](_0xe3e2('0x1d'))[_0xe3e2('0x1e')]([_0xe3e2('0xd'),_0xe3e2('0x1f'),'ContactId',_0xe3e2('0x20'),_0x46547a,_0xe3e2('0x21'),_0xe3e2('0x22'),_0xe3e2('0x23'),_0xe3e2('0x24'),_0xe3e2('0x25')],squel['select']()['fields'](_0x109313)[_0xe3e2('0xe')](_0x3a72cc)[_0xe3e2('0xf')](_0xe3e2('0x26'),null,'cm_contacts.ListId\x20=\x20'+_0x3a72cc+'.CmListId')['join'](_0x432f66,null,_0x432f66+_0xe3e2('0x10')+_0x3a72cc+'.'+_0x46547a)[_0xe3e2('0x12')](_0x3a72cc+_0xe3e2('0x27'),_0x40a3eb)['where'](_0xe3e2('0x28'),NOW)[_0xe3e2('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x3a72cc,_0x432f66,_0x46547a,_0xe3e2('0x1d'),[_0xe3e2('0x29'),_0xe3e2('0x2a')]))[_0xe3e2('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x3a72cc,_0x432f66,_0x46547a,'cm_hopper',[_0xe3e2('0x29')])))[_0xe3e2('0x2b')]();}function insertCmHopperBlack(_0x16e9b1,_0x496f15,_0x34de4b,_0x5744b3){var _0x2a6905=[_0xe3e2('0x2c'),_0xe3e2('0x15'),_0xe3e2('0x16'),_0x496f15+'.'+_0x5744b3,_0xe3e2('0x17'),_0xe3e2('0x18')];return squel[_0xe3e2('0x1b')]()[_0xe3e2('0x1c')](_0xe3e2('0x2d'))[_0xe3e2('0x1e')]([_0xe3e2('0xd'),'ContactId',_0xe3e2('0x20'),_0x5744b3,'createdAt',_0xe3e2('0x22')],squel['select']()[_0xe3e2('0x2e')](_0x2a6905)[_0xe3e2('0xe')](_0x496f15)[_0xe3e2('0xf')](_0xe3e2('0x26'),null,'cm_contacts.ListId\x20=\x20'+_0x496f15+_0xe3e2('0x2f'))['join'](_0x34de4b,null,_0x34de4b+_0xe3e2('0x10')+_0x496f15+'.'+_0x5744b3)['where'](_0x496f15+_0xe3e2('0x27'),_0x16e9b1)[_0xe3e2('0x12')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xe3e2('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xe3e2('0x30')]()[_0xe3e2('0xc')]('phone')[_0xe3e2('0xe')]('cm_hopper_black')['where'](_0xe3e2('0x31'),_0x16e9b1)[_0xe3e2('0x12')](_0x5744b3+_0xe3e2('0x32'),_0x496f15+'.'+_0x5744b3)))['toString']();}function insertCmContact(_0x39aef2,_0x57f5dc,_0x589f98,_0x5c3517){var _0x83d8fe=_[_0xe3e2('0x33')](_['keys'](_0x5c3517),[_0xe3e2('0x20'),_0xe3e2('0x34'),_0xe3e2('0x21'),'updatedAt']);return squel[_0xe3e2('0x1b')]()[_0xe3e2('0x1c')](_0xe3e2('0x26'))[_0xe3e2('0x1e')](_0x83d8fe,squel[_0xe3e2('0x30')]()[_0xe3e2('0x2e')](_0x83d8fe)[_0xe3e2('0xe')](_0x57f5dc)[_0xe3e2('0x12')]('('+_0x589f98[_0xe3e2('0xf')](',')+')\x20NOT\x20IN\x20?',squel[_0xe3e2('0x30')]()['fields'](_0x589f98)[_0xe3e2('0xe')](_0xe3e2('0x26'))[_0xe3e2('0x12')](_0xe3e2('0x31'),_0x39aef2)['where'](_0xe3e2('0x35')))[_0xe3e2('0x12')](_0xe3e2('0x36'),squel['select']()[_0xe3e2('0xc')]('MIN(id)',_0xe3e2('0x37'))[_0xe3e2('0xe')](_0x57f5dc)[_0xe3e2('0x38')](_0x589f98['join'](','))))[_0xe3e2('0x2b')]();}function handleStop(){logger[_0xe3e2('0x39')](_0xe3e2('0x3a'));stopped=!![];}function handleUncaughtException(_0x556f8d){logger[_0xe3e2('0x3b')](_0x556f8d[_0xe3e2('0x3c')]);process[_0xe3e2('0x3d')](0x1);}function handleError(_0x45577f,_0x4a94bd){stats['errors'][_0xe3e2('0x3e')]({'name':_0x4a94bd[_0xe3e2('0x3f')],'message':_0x4a94bd[_0xe3e2('0x3c')],'row':_0x45577f});}function handleQuery(_0x9b9875){logger['info'](_0x9b9875);return db[_0xe3e2('0x40')][_0xe3e2('0x41')](_0x9b9875)[_0xe3e2('0x42')](function(_0x475582){results['push'](_0x475582);})[_0xe3e2('0x43')](function(_0x57c9b3){logger[_0xe3e2('0x3b')](_0x57c9b3[_0xe3e2('0x3c')]);});}function main(_0x5b75ac,_0x4945fa,_0x4152e1,_0x1ecf33){logger['info'](_0xe3e2('0x44'),_0x5b75ac,JSON[_0xe3e2('0x45')](_0x4945fa));process[_0xe3e2('0x46')](_0xe3e2('0x47'));var _0x26850a=_0x4945fa[_0xe3e2('0x48')];var _0x1aa31d=_0x4945fa[_0xe3e2('0x49')];var _0x54de46=path[_0xe3e2('0xf')](config[_0xe3e2('0x4a')],_0xe3e2('0x4b'),_0x1aa31d+_0xe3e2('0x4c'));var _0x1276c6=_[_0xe3e2('0x4d')](_0x26850a)[_0xe3e2('0xf')]();logger[_0xe3e2('0x39')](_0xe3e2('0x4e'),_0x1276c6);fs['writeFileSync'](_0x54de46,_0x1276c6+'\x0a');Papa[_0xe3e2('0x4f')](fs[_0xe3e2('0x50')](_0x5b75ac),{'header':!![],'skipEmptyLines':!![],'step':function(_0x141ec4,_0x4f8210){try{for(var _0x1ca027=0x0,_0x40e53a=[];_0x1ca027<_0x141ec4[_0xe3e2('0x51')][_0xe3e2('0x52')];_0x1ca027++){stats['rows']+=0x1;if(_0x141ec4[_0xe3e2('0x53')][_0x1ca027]){handleError(_0x141ec4[_0xe3e2('0x51')][_0x1ca027],_0x141ec4[_0xe3e2('0x53')][_0x1ca027]);}else{var _0x4628b5=[];for(var _0x27802d in _0x26850a){if(_0x26850a['hasOwnProperty'](_0x27802d)){if(_0x141ec4['data'][_0x1ca027][_0x26850a[_0x27802d]]){var _0x269eeb=_['trim'](_0x141ec4[_0xe3e2('0x51')][_0x1ca027][_0x26850a[_0x27802d]][_0xe3e2('0x54')](/"/g,'\x27'));switch(_0x27802d){case _0xe3e2('0x1f'):var _0xa87abf=moment(_0x269eeb,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0xa87abf[_0xe3e2('0x55')]()){_0x40e53a[_0xe3e2('0x3e')]('\x22'+_0x269eeb+'\x22');}else{_0x4628b5[_0xe3e2('0x3e')](_0xe3e2('0x56'));}break;case _0xe3e2('0x23'):var _0x44a19e=parseInt(_0x269eeb);_0x269eeb=_[_0xe3e2('0x57')](_0x44a19e)||_0x44a19e<0x0||_0x44a19e>0x4?_0x1ecf33?0x3:0x2:_0x44a19e;_0x40e53a['push']('\x22'+_0x269eeb+'\x22');break;case _0xe3e2('0x24'):var _0x196c86=parseInt(_0x269eeb);if(_['isNumber'](_0x196c86)&&_[_0xe3e2('0x58')](_0x4152e1,_0x196c86)){_0x40e53a[_0xe3e2('0x3e')]('\x22'+_0x196c86+'\x22');}else{_0x4628b5[_0xe3e2('0x3e')]('agent\x20not\x20exists');}break;case _0xe3e2('0x59'):if(isEmail(_0x269eeb)){_0x40e53a[_0xe3e2('0x3e')]('\x22'+_0x269eeb+'\x22');}else{_0x4628b5[_0xe3e2('0x3e')]('email\x20wrong\x20format');}break;case _0xe3e2('0x5a'):var _0x24cfd1=moment(_0x269eeb,_0xe3e2('0x5b'),!![]);if(_0x24cfd1[_0xe3e2('0x55')]()){_0x40e53a[_0xe3e2('0x3e')]('\x22'+_0x269eeb+'\x22');}else{_0x4628b5[_0xe3e2('0x3e')](_0xe3e2('0x5c'));}break;default:_0x40e53a[_0xe3e2('0x3e')]('\x22'+_0x269eeb+'\x22');}}else{switch(_0x27802d){case _0xe3e2('0x5d'):case _0xe3e2('0xd'):_0x4628b5[_0xe3e2('0x3e')](_0x27802d+_0xe3e2('0x5e'));break;default:_0x40e53a['push']('\x22\x22');}}}}if(_0x4628b5[_0xe3e2('0x52')]){handleError(_0x141ec4[_0xe3e2('0x51')][_0x1ca027],{'code':_0xe3e2('0x5f'),'message':_0x4628b5[_0xe3e2('0xf')]()});}else{fs[_0xe3e2('0x60')](_0x54de46,_0x40e53a[_0xe3e2('0xf')]()+'\x0a');}_0x40e53a=[];}if(!(stats['rows']%0xc8)){socket[_0xe3e2('0x61')]('contact:import:'+_0x1aa31d,stats);stats[_0xe3e2('0x53')]=[];}}if(stopped){logger[_0xe3e2('0x39')]('Abort\x20parser');_0x4f8210['abort']();}}catch(_0x4f1370){handleError(_0x141ec4[_0xe3e2('0x51')][_0x1ca027],{'code':_0xe3e2('0x62'),'message':_0x4f1370[_0xe3e2('0x3c')]});logger[_0xe3e2('0x3b')](_0xe3e2('0x63'),_0x4f1370['message']);}},'complete':function(){try{var _0xd299d5=[];var _0x192d86=_0xe3e2('0x26');if(_0x4945fa[_0xe3e2('0x64')]&&_0x4945fa['duplicates']['length']){_0x192d86=_0xe3e2('0x65')+_0x1aa31d;_0xd299d5[_0xe3e2('0x3e')](_0xe3e2('0x66')+_0x192d86+_0xe3e2('0x67'));}var _0x538b89=util['format']('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',_0x54de46,_0x192d86,_0x1276c6,_0x4945fa[_0xe3e2('0x20')],_0x4945fa[_0xe3e2('0x34')]||null,NOW,NOW);if(_[_0xe3e2('0x68')](_0x26850a['scheduledat'])){_0x538b89+=_0xe3e2('0x69');}_0xd299d5[_0xe3e2('0x3e')](_0x538b89);if(_0x4945fa[_0xe3e2('0x64')]&&_0x4945fa[_0xe3e2('0x64')][_0xe3e2('0x52')]){_0xd299d5['push'](insertCmContact(_0x4945fa[_0xe3e2('0x20')],_0x192d86,_0x4945fa[_0xe3e2('0x64')],_0x26850a));_0xd299d5[_0xe3e2('0x3e')]('DROP\x20TABLE\x20'+_0x192d86+';');}_0xd299d5[_0xe3e2('0x3e')](insertCmHopper(_0x4945fa[_0xe3e2('0x20')],_0xe3e2('0x6a'),_0xe3e2('0x6b'),_0xe3e2('0x6c'),_0x1ecf33));_0xd299d5[_0xe3e2('0x3e')](insertCmHopperBlack(_0x4945fa[_0xe3e2('0x20')],_0xe3e2('0x6d'),_0xe3e2('0x6b'),_0xe3e2('0x6c')));_0xd299d5[_0xe3e2('0x3e')](insertCmHopper(_0x4945fa[_0xe3e2('0x20')],_0xe3e2('0x6e'),_0xe3e2('0x6f'),_0xe3e2('0x70'),_0x1ecf33));_0xd299d5[_0xe3e2('0x3e')](insertCmHopperBlack(_0x4945fa[_0xe3e2('0x20')],'campaigns_has_cm_blacklists',_0xe3e2('0x6f'),_0xe3e2('0x70')));BPromise['each'](_0xd299d5,handleQuery)['then'](function(_0x5af509){stats['finish']=!![];stats[_0xe3e2('0x71')]=_0x4945fa['duplicates']&&_0x4945fa[_0xe3e2('0x64')][_0xe3e2('0x52')]?results[0x2][_0xe3e2('0x71')]:results[0x0]['affectedRows'];socket[_0xe3e2('0x61')]('contact:import:'+_0x1aa31d,stats);fs['unlink'](_0x5b75ac);fs[_0xe3e2('0x72')](_0x54de46);process[_0xe3e2('0x3d')](0x0);})['catch'](function(_0x354e2e){logger[_0xe3e2('0x3b')](_0x354e2e[_0xe3e2('0x3c')]);process[_0xe3e2('0x3d')](0x1);});}catch(_0x243013){logger['error'](_0xe3e2('0x73'),_0x243013[_0xe3e2('0x3c')]);process[_0xe3e2('0x3d')](0x1);}},'error':function(_0x39fc7f,_0x209b39,_0x5cf01c,_0x4db537){throw new Error(_0x4db537);}});}function validate(){if(process[_0xe3e2('0x74')]&&process['argv'][_0xe3e2('0x52')]<0x4){throw new Error(_0xe3e2('0x75'));}var _0x22eaec=path[_0xe3e2('0xf')](config['root'],_0xe3e2('0x4b'),process[_0xe3e2('0x74')][0x2]);if(!fs[_0xe3e2('0x76')](_0x22eaec)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x2852ac={};try{_0x2852ac=JSON[_0xe3e2('0x4f')](process[_0xe3e2('0x74')][0x3]);if(!_0x2852ac[_0xe3e2('0x48')]){throw new Error(_0xe3e2('0x77'));}if(!_0x2852ac[_0xe3e2('0x48')][_0xe3e2('0xd')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x2852ac[_0xe3e2('0x48')][_0xe3e2('0x5d')]){throw new Error(_0xe3e2('0x78'));}var _0x2ac937=0x0;if(_0x2852ac['binding'][_0xe3e2('0x24')]){_0x2ac937=0x1;}if(!_0x2852ac['ListId']){throw new Error(_0xe3e2('0x79'));}}catch(_0x2a685f){throw new Error('body\x20id\x20mandatory');}var _0x550bec=[];try{_0x550bec=_[_0xe3e2('0x7a')](JSON[_0xe3e2('0x4f')](process[_0xe3e2('0x74')][0x4]),'id');}catch(_0x301315){logger[_0xe3e2('0x39')]('No\x20agent\x20available');}main(_0x22eaec,_0x2852ac,_0x550bec,_0x2ac937);}validate();process['on'](_0xe3e2('0x7b'),handleStop);process['on'](_0xe3e2('0x7c'),handleUncaughtException); \ No newline at end of file +var _0x3480=['.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','cm_hopper','fromQuery','scheduledat','ListId','updatedAt','priority','UserId','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.createdAt','into','cm_hopper_black','fields','cm_contacts.createdAt\x20=\x20?','ListId\x20=\x20?','\x20=\x20?','concat','keys','CompanyId','createdAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','Received\x20SIGINT','message','exit','push','code','sequelize','spread','catch','info','main','stringify','send','start','binding','root','server/files/tmp','.csv','header','writeFileSync','parse','createReadStream','data','rows','errors','hasOwnProperty','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','includes','agent\x20not\x20exists','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','appendFileSync','emit','contact:import:','Abort\x20parser','abort','error','step','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','isNil',',\x20scheduledAt\x20=\x20NOW()','duplicates','length','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','CampaignId','campaigns_has_cm_blacklists','each','then','affectedRows','argv','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','lodash','papaparse','bluebird','moment','squel','ioredis','../../../mysqldb','import','redis','defaults','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join'];(function(_0x1ad69e,_0x5df2a9){var _0x5d6f52=function(_0x425709){while(--_0x425709){_0x1ad69e['push'](_0x1ad69e['shift']());}};_0x5d6f52(++_0x5df2a9);}(_0x3480,0x1f4));var _0x0348=function(_0x45f31b,_0x49805c){_0x45f31b=_0x45f31b-0x0;var _0x42e97a=_0x3480[_0x45f31b];return _0x42e97a;};'use strict';var fs=require('fs');var path=require(_0x0348('0x0'));var _=require(_0x0348('0x1'));var Papa=require(_0x0348('0x2'));var util=require('util');var BPromise=require(_0x0348('0x3'));var moment=require(_0x0348('0x4'));var squel=require(_0x0348('0x5'));var Redis=require(_0x0348('0x6'));var db=require(_0x0348('0x7'))['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x0348('0x8'));config[_0x0348('0x9')]=_[_0x0348('0xa')](config[_0x0348('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x0348('0xb'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x0348('0xc')](_0x0348('0xd'));function isEmail(_0x5d64c0){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))*$/[_0x0348('0xe')](_0x5d64c0);}function selectNotIn(_0x43652f,_0x2de2fc,_0x119f1f,_0x2f2831,_0x442920){return squel[_0x0348('0xf')]()[_0x0348('0x10')](_0x0348('0x11'))[_0x0348('0x12')](_0x2f2831)[_0x0348('0x13')](_0x2de2fc,null,_0x2de2fc+_0x0348('0x14')+_0x2f2831+'.'+_0x119f1f)[_0x0348('0x15')](_0x2f2831+'.'+_0x119f1f+'\x20=\x20'+_0x43652f+'.'+_0x119f1f)['where'](_0x2de2fc+_0x0348('0x16')+_0x442920[_0x0348('0x13')]()+')');}function insertCmHopper(_0x364ba3,_0x174e9a,_0x1f0dbc,_0x3d33f5,_0x4caa11){var _0x23d0ab=[_0x0348('0x17'),_0x0348('0x18'),_0x0348('0x19'),'cm_contacts.ListId',_0x174e9a+'.'+_0x3d33f5,'cm_contacts.createdAt',_0x0348('0x1a'),_0x0348('0x1b'),_0x0348('0x1c'),'\x22'+_0x4caa11+'\x22'];return squel[_0x0348('0x1d')]()['into'](_0x0348('0x1e'))[_0x0348('0x1f')]([_0x0348('0x11'),_0x0348('0x20'),'ContactId',_0x0348('0x21'),_0x3d33f5,'createdAt',_0x0348('0x22'),_0x0348('0x23'),_0x0348('0x24'),'recallme'],squel['select']()['fields'](_0x23d0ab)[_0x0348('0x12')](_0x174e9a)['join'](_0x0348('0x25'),null,_0x0348('0x26')+_0x174e9a+_0x0348('0x27'))[_0x0348('0x13')](_0x1f0dbc,null,_0x1f0dbc+_0x0348('0x14')+_0x174e9a+'.'+_0x3d33f5)[_0x0348('0x15')](_0x174e9a+_0x0348('0x28'),_0x364ba3)[_0x0348('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x0348('0x15')](_0x0348('0x29'),selectNotIn(_0x174e9a,_0x1f0dbc,_0x3d33f5,_0x0348('0x1e'),[_0x0348('0x2a'),_0x0348('0x2b')]))[_0x0348('0x15')](_0x0348('0x29'),selectNotIn(_0x174e9a,_0x1f0dbc,_0x3d33f5,_0x0348('0x1e'),['\x22always\x22'])))[_0x0348('0x2c')]();}function insertCmHopperBlack(_0x52a844,_0xcc8f32,_0x3fd9e9,_0x177fed){var _0x44186e=['cm_contacts.phone',_0x0348('0x19'),'cm_contacts.ListId',_0xcc8f32+'.'+_0x177fed,_0x0348('0x2d'),_0x0348('0x1a')];return squel[_0x0348('0x1d')]()[_0x0348('0x2e')](_0x0348('0x2f'))['fromQuery']([_0x0348('0x11'),'ContactId',_0x0348('0x21'),_0x177fed,'createdAt',_0x0348('0x22')],squel[_0x0348('0xf')]()[_0x0348('0x30')](_0x44186e)[_0x0348('0x12')](_0xcc8f32)[_0x0348('0x13')](_0x0348('0x25'),null,'cm_contacts.ListId\x20=\x20'+_0xcc8f32+'.CmListId')['join'](_0x3fd9e9,null,_0x3fd9e9+_0x0348('0x14')+_0xcc8f32+'.'+_0x177fed)[_0x0348('0x15')](_0xcc8f32+'.CmListId\x20=\x20?',_0x52a844)[_0x0348('0x15')](_0x0348('0x31'),NOW)['where'](_0x0348('0x29'),squel[_0x0348('0xf')]()['field'](_0x0348('0x11'))[_0x0348('0x12')](_0x0348('0x2f'))[_0x0348('0x15')](_0x0348('0x32'),_0x52a844)[_0x0348('0x15')](_0x177fed+_0x0348('0x33'),_0xcc8f32+'.'+_0x177fed)))[_0x0348('0x2c')]();}function insertCmContact(_0x5df22b,_0x186d9f,_0x1ce96f,_0x579638){var _0x5f39f3=_[_0x0348('0x34')](_[_0x0348('0x35')](_0x579638),[_0x0348('0x21'),_0x0348('0x36'),_0x0348('0x37'),_0x0348('0x22')]);return squel[_0x0348('0x1d')]()[_0x0348('0x2e')](_0x0348('0x25'))['fromQuery'](_0x5f39f3,squel[_0x0348('0xf')]()[_0x0348('0x30')](_0x5f39f3)[_0x0348('0x12')](_0x186d9f)[_0x0348('0x15')]('('+_0x1ce96f[_0x0348('0x13')](',')+_0x0348('0x38'),squel[_0x0348('0xf')]()[_0x0348('0x30')](_0x1ce96f)[_0x0348('0x12')](_0x0348('0x25'))[_0x0348('0x15')](_0x0348('0x32'),_0x5df22b)[_0x0348('0x15')](_0x0348('0x39')))[_0x0348('0x15')](_0x0348('0x3a'),squel[_0x0348('0xf')]()[_0x0348('0x10')](_0x0348('0x3b'),_0x0348('0x3c'))[_0x0348('0x12')](_0x186d9f)[_0x0348('0x3d')](_0x1ce96f[_0x0348('0x13')](','))))[_0x0348('0x2c')]();}function handleStop(){logger['info'](_0x0348('0x3e'));stopped=!![];}function handleUncaughtException(_0x396bf8){logger['error'](_0x396bf8[_0x0348('0x3f')]);process[_0x0348('0x40')](0x1);}function handleError(_0x4f42d8,_0xc1d2b){stats['errors'][_0x0348('0x41')]({'name':_0xc1d2b[_0x0348('0x42')],'message':_0xc1d2b['message'],'row':_0x4f42d8});}function handleQuery(_0x1a0091){logger['info'](_0x1a0091);return db[_0x0348('0x43')]['query'](_0x1a0091)[_0x0348('0x44')](function(_0x5dc403){results[_0x0348('0x41')](_0x5dc403);})[_0x0348('0x45')](function(_0x5dade1){logger['error'](_0x5dade1['message']);});}function main(_0x5b7c26,_0x56b03b,_0x1a60a1,_0x549d8f){logger[_0x0348('0x46')](_0x0348('0x47'),_0x5b7c26,JSON[_0x0348('0x48')](_0x56b03b));process[_0x0348('0x49')](_0x0348('0x4a'));var _0x4edb2e=_0x56b03b[_0x0348('0x4b')];var _0x512007=_0x56b03b['socket_timestamp'];var _0x467f9c=path[_0x0348('0x13')](config[_0x0348('0x4c')],_0x0348('0x4d'),_0x512007+_0x0348('0x4e'));var _0x1ed8d5=_[_0x0348('0x35')](_0x4edb2e)[_0x0348('0x13')]();logger[_0x0348('0x46')](_0x0348('0x4f'),_0x1ed8d5);fs[_0x0348('0x50')](_0x467f9c,_0x1ed8d5+'\x0a');Papa[_0x0348('0x51')](fs[_0x0348('0x52')](_0x5b7c26),{'header':!![],'skipEmptyLines':!![],'step':function(_0x59210e,_0x2a10dc){try{for(var _0x55a224=0x0,_0x2d0b55=[];_0x55a224<_0x59210e[_0x0348('0x53')]['length'];_0x55a224++){stats[_0x0348('0x54')]+=0x1;if(_0x59210e[_0x0348('0x55')][_0x55a224]){handleError(_0x59210e[_0x0348('0x53')][_0x55a224],_0x59210e[_0x0348('0x55')][_0x55a224]);}else{var _0x1196e3=[];for(var _0x3e4751 in _0x4edb2e){if(_0x4edb2e[_0x0348('0x56')](_0x3e4751)){if(_0x59210e['data'][_0x55a224][_0x4edb2e[_0x3e4751]]){var _0x1ba10c=_['trim'](_0x59210e[_0x0348('0x53')][_0x55a224][_0x4edb2e[_0x3e4751]][_0x0348('0x57')](/"/g,'\x27'));switch(_0x3e4751){case _0x0348('0x20'):var _0x58eb37=moment(_0x1ba10c,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x58eb37[_0x0348('0x58')]()){_0x2d0b55[_0x0348('0x41')]('\x22'+_0x1ba10c+'\x22');}else{_0x1196e3[_0x0348('0x41')](_0x0348('0x59'));}break;case _0x0348('0x23'):var _0x343dc6=parseInt(_0x1ba10c);_0x1ba10c=_['isNaN'](_0x343dc6)||_0x343dc6<0x0||_0x343dc6>0x4?_0x549d8f?0x3:0x2:_0x343dc6;_0x2d0b55[_0x0348('0x41')]('\x22'+_0x1ba10c+'\x22');break;case _0x0348('0x24'):var _0x52f2c1=parseInt(_0x1ba10c);if(_[_0x0348('0x5a')](_0x52f2c1)&&_[_0x0348('0x5b')](_0x1a60a1,_0x52f2c1)){_0x2d0b55[_0x0348('0x41')]('\x22'+_0x52f2c1+'\x22');}else{_0x1196e3[_0x0348('0x41')](_0x0348('0x5c'));}break;case'email':if(isEmail(_0x1ba10c)){_0x2d0b55['push']('\x22'+_0x1ba10c+'\x22');}else{_0x1196e3[_0x0348('0x41')]('email\x20wrong\x20format');}break;case _0x0348('0x5d'):var _0x465ce1=moment(_0x1ba10c,_0x0348('0x5e'),!![]);if(_0x465ce1[_0x0348('0x58')]()){_0x2d0b55['push']('\x22'+_0x1ba10c+'\x22');}else{_0x1196e3[_0x0348('0x41')](_0x0348('0x5f'));}break;default:_0x2d0b55[_0x0348('0x41')]('\x22'+_0x1ba10c+'\x22');}}else{switch(_0x3e4751){case _0x0348('0x60'):case _0x0348('0x11'):_0x1196e3[_0x0348('0x41')](_0x3e4751+_0x0348('0x61'));break;default:_0x2d0b55['push']('\x22\x22');}}}}if(_0x1196e3['length']){handleError(_0x59210e[_0x0348('0x53')][_0x55a224],{'code':'SystemRow','message':_0x1196e3['join']()});}else{fs[_0x0348('0x62')](_0x467f9c,_0x2d0b55['join']()+'\x0a');}_0x2d0b55=[];}if(!(stats[_0x0348('0x54')]%0xc8)){socket[_0x0348('0x63')](_0x0348('0x64')+_0x512007,stats);stats[_0x0348('0x55')]=[];}}if(stopped){logger[_0x0348('0x46')](_0x0348('0x65'));_0x2a10dc[_0x0348('0x66')]();}}catch(_0x5a18f0){handleError(_0x59210e[_0x0348('0x53')][_0x55a224],{'code':'SystemError','message':_0x5a18f0[_0x0348('0x3f')]});logger[_0x0348('0x67')](_0x0348('0x68'),_0x5a18f0['message']);}},'complete':function(){try{var _0x485e35=[];var _0x286482=_0x0348('0x25');if(_0x56b03b['duplicates']&&_0x56b03b['duplicates']['length']){_0x286482='cm_contacts_'+_0x512007;_0x485e35[_0x0348('0x41')](_0x0348('0x69')+_0x286482+_0x0348('0x6a'));}var _0x212894=util[_0x0348('0xc')]('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',_0x467f9c,_0x286482,_0x1ed8d5,_0x56b03b[_0x0348('0x21')],_0x56b03b[_0x0348('0x36')]||null,NOW,NOW);if(_[_0x0348('0x6b')](_0x4edb2e['scheduledat'])){_0x212894+=_0x0348('0x6c');}_0x485e35[_0x0348('0x41')](_0x212894);if(_0x56b03b[_0x0348('0x6d')]&&_0x56b03b[_0x0348('0x6d')][_0x0348('0x6e')]){_0x485e35[_0x0348('0x41')](insertCmContact(_0x56b03b[_0x0348('0x21')],_0x286482,_0x56b03b[_0x0348('0x6d')],_0x4edb2e));_0x485e35[_0x0348('0x41')]('DROP\x20TABLE\x20'+_0x286482+';');}_0x485e35[_0x0348('0x41')](insertCmHopper(_0x56b03b[_0x0348('0x21')],_0x0348('0x6f'),_0x0348('0x70'),_0x0348('0x71'),_0x549d8f));_0x485e35['push'](insertCmHopperBlack(_0x56b03b[_0x0348('0x21')],_0x0348('0x72'),_0x0348('0x70'),'VoiceQueueId'));_0x485e35[_0x0348('0x41')](insertCmHopper(_0x56b03b[_0x0348('0x21')],_0x0348('0x73'),'campaigns',_0x0348('0x74'),_0x549d8f));_0x485e35[_0x0348('0x41')](insertCmHopperBlack(_0x56b03b[_0x0348('0x21')],_0x0348('0x75'),'campaigns',_0x0348('0x74')));BPromise[_0x0348('0x76')](_0x485e35,handleQuery)[_0x0348('0x77')](function(_0x5bed11){stats['finish']=!![];stats[_0x0348('0x78')]=_0x56b03b[_0x0348('0x6d')]&&_0x56b03b[_0x0348('0x6d')][_0x0348('0x6e')]?results[0x2][_0x0348('0x78')]:results[0x0]['affectedRows'];socket[_0x0348('0x63')](_0x0348('0x64')+_0x512007,stats);fs['unlink'](_0x5b7c26);fs['unlink'](_0x467f9c);process[_0x0348('0x40')](0x0);})[_0x0348('0x45')](function(_0xec7604){logger[_0x0348('0x67')](_0xec7604[_0x0348('0x3f')]);process[_0x0348('0x40')](0x1);});}catch(_0x3847ac){logger['error']('complete',_0x3847ac[_0x0348('0x3f')]);process[_0x0348('0x40')](0x1);}},'error':function(_0x299f4f,_0x1dbc8a,_0x596c69,_0x38b265){throw new Error(_0x38b265);}});}function validate(){if(process[_0x0348('0x79')]&&process[_0x0348('0x79')]['length']<0x4){throw new Error('arguments\x20\x20\x20');}var _0x25ee16=path[_0x0348('0x13')](config[_0x0348('0x4c')],_0x0348('0x4d'),process['argv'][0x2]);if(!fs[_0x0348('0x7a')](_0x25ee16)){throw new Error(_0x0348('0x7b'));}var _0x4ffa47={};try{_0x4ffa47=JSON['parse'](process[_0x0348('0x79')][0x3]);if(!_0x4ffa47[_0x0348('0x4b')]){throw new Error(_0x0348('0x7c'));}if(!_0x4ffa47['binding'][_0x0348('0x11')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x4ffa47['binding'][_0x0348('0x60')]){throw new Error(_0x0348('0x7d'));}var _0x4b87ab=0x0;if(_0x4ffa47[_0x0348('0x4b')][_0x0348('0x24')]){_0x4b87ab=0x1;}if(!_0x4ffa47['ListId']){throw new Error(_0x0348('0x7e'));}}catch(_0x3d8063){throw new Error('body\x20id\x20mandatory');}var _0xa4668a=[];try{_0xa4668a=_[_0x0348('0x7f')](JSON[_0x0348('0x51')](process[_0x0348('0x79')][0x4]),'id');}catch(_0x57534f){logger[_0x0348('0x46')](_0x0348('0x80'));}main(_0x25ee16,_0x4ffa47,_0xa4668a,_0x4b87ab);}validate();process['on']('SIGINT',handleStop);process['on'](_0x0348('0x81'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 0e91959..6cd9474 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 _0x8192=['talktime','***\x20Call\x20Info\x20***','Called\x20Number','membername','uniqueid','starttime','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','inbound','push','queue','variable','outbound','Outbound\x20Call','getDescriptions','voice','keyValue','calleridnum','Caller\x20Name','calleridname','Queue','UniqueId','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridnum','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','agentcompleteAt','Talk\x20Time'];(function(_0x155d18,_0x18e15e){var _0x244f49=function(_0x21eae0){while(--_0x21eae0){_0x155d18['push'](_0x155d18['shift']());}};_0x244f49(++_0x18e15e);}(_0x8192,0x17d));var _0x2819=function(_0x2d910c,_0x1ef3bd){_0x2d910c=_0x2d910c-0x0;var _0x15e719=_0x8192[_0x2d910c];return _0x15e719;};'use strict';exports[_0x2819('0x0')]=function(_0x167a54,_0x45a1e8){var _0x4d3577=[{'type':_0x2819('0x1'),'content':_0x2819('0x2'),'variableName':null}];switch(_0x167a54[_0x2819('0x3')]()){case'voice':switch(_0x45a1e8[_0x2819('0x3')]()){case _0x2819('0x4'):_0x4d3577[_0x2819('0x5')]({'type':'variable','content':'','variableName':_0x2819('0x6')});_0x4d3577[_0x2819('0x5')]({'type':_0x2819('0x7'),'content':'','variableName':'calleridnum'});break;case _0x2819('0x8'):_0x4d3577['push']({'type':_0x2819('0x1'),'content':_0x2819('0x9'),'variableName':null});_0x4d3577[_0x2819('0x5')]({'type':_0x2819('0x7'),'content':'','variableName':'destcalleridnum'});break;}}return _0x4d3577;};exports[_0x2819('0xa')]=function(_0xabd46f,_0x20e03c){var _0x4238cf=[];switch(_0xabd46f[_0x2819('0x3')]()){case _0x2819('0xb'):switch(_0x20e03c['toLowerCase']()){case _0x2819('0x4'):_0x4238cf=[{'type':_0x2819('0x1'),'content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x2819('0xc'),'content':'','key':'Caller\x20Number','keyType':'variable','variableName':_0x2819('0xd')},{'type':'keyValue','content':'','key':_0x2819('0xe'),'keyType':_0x2819('0x7'),'variableName':_0x2819('0xf')},{'type':_0x2819('0xc'),'content':'','key':'Call\x20To','keyType':_0x2819('0x7'),'variableName':'destexten'},{'type':_0x2819('0xc'),'content':'','key':_0x2819('0x10'),'keyType':_0x2819('0x7'),'variableName':'queue'},{'type':_0x2819('0xc'),'content':'','key':_0x2819('0x11'),'keyType':_0x2819('0x7'),'variableName':'uniqueid'},{'type':_0x2819('0xc'),'content':'','key':_0x2819('0x12'),'keyType':'variable','variableName':_0x2819('0x13')},{'type':'string','content':_0x2819('0x14'),'key':null,'keyType':null,'variableName':null},{'type':_0x2819('0xc'),'content':'','key':_0x2819('0x15'),'keyType':_0x2819('0x7'),'variableName':'destcalleridname'},{'type':_0x2819('0xc'),'content':'','key':'Agent\x20Number','keyType':_0x2819('0x7'),'variableName':_0x2819('0x16')},{'type':_0x2819('0x1'),'content':_0x2819('0x17'),'key':null,'keyType':null,'variableName':null},{'type':_0x2819('0xc'),'content':'','key':_0x2819('0x18'),'keyType':_0x2819('0x7'),'variableName':_0x2819('0x13')},{'type':_0x2819('0xc'),'content':'','key':_0x2819('0x19'),'keyType':_0x2819('0x7'),'variableName':_0x2819('0x1a')},{'type':'keyValue','content':'','key':'Agent\x20Complete','keyType':_0x2819('0x7'),'variableName':_0x2819('0x1b')},{'type':_0x2819('0xc'),'content':'','key':'Hold\x20Time','keyType':_0x2819('0x7'),'variableName':'holdtime'},{'type':_0x2819('0xc'),'content':'','key':_0x2819('0x1c'),'keyType':'variable','variableName':_0x2819('0x1d')}];break;case _0x2819('0x8'):_0x4238cf=[{'type':_0x2819('0x1'),'content':_0x2819('0x1e'),'variableName':null},{'type':_0x2819('0xc'),'content':'','key':_0x2819('0x1f'),'keyType':_0x2819('0x7'),'keyContent':'','variableName':_0x2819('0x16')},{'type':'keyValue','content':'','key':'Member\x20Name','keyType':'variable','keyContent':'','variableName':_0x2819('0x20')},{'type':_0x2819('0xc'),'content':'','key':_0x2819('0x11'),'keyType':_0x2819('0x7'),'keyContent':'','variableName':_0x2819('0x21')},{'type':_0x2819('0xc'),'content':'','key':_0x2819('0x12'),'keyType':_0x2819('0x7'),'keyContent':'','variableName':_0x2819('0x22')},{'type':_0x2819('0x1'),'content':'***\x20Time\x20Info\x20***'},{'type':_0x2819('0xc'),'content':'','key':'Answer\x20Time','keyType':_0x2819('0x7'),'keyContent':'','variableName':'answertime'},{'type':'keyValue','content':'','key':_0x2819('0x23'),'keyType':'variable','keyContent':'','variableName':_0x2819('0x24')},{'type':'keyValue','content':'','key':_0x2819('0x25'),'keyType':_0x2819('0x7'),'keyContent':'','variableName':_0x2819('0x26')},{'type':_0x2819('0xc'),'content':'','key':_0x2819('0x27'),'keyType':_0x2819('0x7'),'keyContent':'','variableName':_0x2819('0x28')}];break;}}return _0x4238cf;}; \ No newline at end of file +var _0x4fbe=['Called\x20Number','Member\x20Name','membername','Answer\x20Time','answertime','Complete\x20Time','endtime','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','inbound','variable','push','outbound','Outbound\x20Call','destcalleridnum','getDescriptions','voice','keyValue','Caller\x20Number','calleridnum','Caller\x20Name','calleridname','Call\x20To','destexten','Queue','UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','destcalleridname','Agent\x20Number','Agent\x20Ring','agentconnectAt','Agent\x20Complete','Hold\x20Time','holdtime','Talk\x20Time','talktime','***\x20Call\x20Info\x20***'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0x4fbe,0xe5));var _0xe4fb=function(_0x247c88,_0x18efad){_0x247c88=_0x247c88-0x0;var _0x265f75=_0x4fbe[_0x247c88];return _0x265f75;};'use strict';exports[_0xe4fb('0x0')]=function(_0x2d8335,_0x589084){var _0x409997=[{'type':_0xe4fb('0x1'),'content':_0xe4fb('0x2'),'variableName':null}];switch(_0x2d8335[_0xe4fb('0x3')]()){case'voice':switch(_0x589084[_0xe4fb('0x3')]()){case _0xe4fb('0x4'):_0x409997['push']({'type':_0xe4fb('0x5'),'content':'','variableName':'queue'});_0x409997[_0xe4fb('0x6')]({'type':_0xe4fb('0x5'),'content':'','variableName':'calleridnum'});break;case _0xe4fb('0x7'):_0x409997[_0xe4fb('0x6')]({'type':_0xe4fb('0x1'),'content':_0xe4fb('0x8'),'variableName':null});_0x409997[_0xe4fb('0x6')]({'type':_0xe4fb('0x5'),'content':'','variableName':_0xe4fb('0x9')});break;}}return _0x409997;};exports[_0xe4fb('0xa')]=function(_0x43dd8c,_0x11841c){var _0x287a5d=[];switch(_0x43dd8c[_0xe4fb('0x3')]()){case _0xe4fb('0xb'):switch(_0x11841c['toLowerCase']()){case _0xe4fb('0x4'):_0x287a5d=[{'type':'string','content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xe4fb('0xc'),'content':'','key':_0xe4fb('0xd'),'keyType':_0xe4fb('0x5'),'variableName':_0xe4fb('0xe')},{'type':_0xe4fb('0xc'),'content':'','key':_0xe4fb('0xf'),'keyType':_0xe4fb('0x5'),'variableName':_0xe4fb('0x10')},{'type':_0xe4fb('0xc'),'content':'','key':_0xe4fb('0x11'),'keyType':'variable','variableName':_0xe4fb('0x12')},{'type':'keyValue','content':'','key':_0xe4fb('0x13'),'keyType':_0xe4fb('0x5'),'variableName':'queue'},{'type':_0xe4fb('0xc'),'content':'','key':_0xe4fb('0x14'),'keyType':_0xe4fb('0x5'),'variableName':_0xe4fb('0x15')},{'type':'keyValue','content':'','key':_0xe4fb('0x16'),'keyType':_0xe4fb('0x5'),'variableName':_0xe4fb('0x17')},{'type':_0xe4fb('0x1'),'content':_0xe4fb('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0xe4fb('0xc'),'content':'','key':'Agent\x20Name','keyType':_0xe4fb('0x5'),'variableName':_0xe4fb('0x19')},{'type':_0xe4fb('0xc'),'content':'','key':_0xe4fb('0x1a'),'keyType':_0xe4fb('0x5'),'variableName':'destcalleridnum'},{'type':_0xe4fb('0x1'),'content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xe4fb('0xc'),'content':'','key':_0xe4fb('0x1b'),'keyType':'variable','variableName':_0xe4fb('0x17')},{'type':_0xe4fb('0xc'),'content':'','key':'Agent\x20Connect','keyType':_0xe4fb('0x5'),'variableName':_0xe4fb('0x1c')},{'type':_0xe4fb('0xc'),'content':'','key':_0xe4fb('0x1d'),'keyType':_0xe4fb('0x5'),'variableName':'agentcompleteAt'},{'type':_0xe4fb('0xc'),'content':'','key':_0xe4fb('0x1e'),'keyType':_0xe4fb('0x5'),'variableName':_0xe4fb('0x1f')},{'type':_0xe4fb('0xc'),'content':'','key':_0xe4fb('0x20'),'keyType':_0xe4fb('0x5'),'variableName':_0xe4fb('0x21')}];break;case'outbound':_0x287a5d=[{'type':_0xe4fb('0x1'),'content':_0xe4fb('0x22'),'variableName':null},{'type':'keyValue','content':'','key':_0xe4fb('0x23'),'keyType':'variable','keyContent':'','variableName':'destcalleridnum'},{'type':'keyValue','content':'','key':_0xe4fb('0x24'),'keyType':_0xe4fb('0x5'),'keyContent':'','variableName':_0xe4fb('0x25')},{'type':_0xe4fb('0xc'),'content':'','key':_0xe4fb('0x14'),'keyType':'variable','keyContent':'','variableName':_0xe4fb('0x15')},{'type':_0xe4fb('0xc'),'content':'','key':'Date','keyType':'variable','keyContent':'','variableName':'starttime'},{'type':_0xe4fb('0x1'),'content':'***\x20Time\x20Info\x20***'},{'type':'keyValue','content':'','key':_0xe4fb('0x26'),'keyType':_0xe4fb('0x5'),'keyContent':'','variableName':_0xe4fb('0x27')},{'type':_0xe4fb('0xc'),'content':'','key':_0xe4fb('0x28'),'keyType':'variable','keyContent':'','variableName':_0xe4fb('0x29')},{'type':_0xe4fb('0xc'),'content':'','key':'Duration','keyType':'variable','keyContent':'','variableName':'duration'},{'type':'keyValue','content':'','key':_0xe4fb('0x2a'),'keyType':_0xe4fb('0x5'),'keyContent':'','variableName':_0xe4fb('0x2b')}];break;}}return _0x287a5d;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 8537cc3..7f06633 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 _0xda4a=['tracked','user','clone','body','omit','html','phone','fax','mobile','lodash','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction','findOne','then','info','catch','error'];(function(_0x3fc273,_0x5e467c){var _0x5bc0d4=function(_0x361b5c){while(--_0x361b5c){_0x3fc273['push'](_0x3fc273['shift']());}};_0x5bc0d4(++_0x5e467c);}(_0xda4a,0xa4));var _0xada4=function(_0x2ad07f,_0x264721){_0x2ad07f=_0x2ad07f-0x0;var _0x3472ba=_0xda4a[_0x2ad07f];return _0x3472ba;};'use strict';var _=require(_0xada4('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0xada4('0x1'))(_0xada4('0x2')),'mail':require(_0xada4('0x1'))(_0xada4('0x3')),'fax':require(_0xada4('0x1'))(_0xada4('0x4')),'sms':require(_0xada4('0x1'))('sms-interactions'),'chat':require(_0xada4('0x1'))('chat-interactions'),'whatsapp':require('../../config/logger')(_0xada4('0x5'))};function getInteractionId(_0x5a8714,_0x1462fb,_0x31daba){if(_0x5a8714&&_0x5a8714[_[_0xada4('0x6')](_0x31daba)+_0xada4('0x7')]){return _0x5a8714[_[_0xada4('0x6')](_0x31daba)+_0xada4('0x7')];}else if(_0x5a8714&&_0x5a8714['id']){return _0x5a8714['id'];}else if(_0x1462fb&&_0x1462fb['id']){return _0x1462fb['id'];}else{return _0xada4('0x8');}}function log(_0x39340f,_0xb704b1,_0x567dc5,_0x170d30,_0x18f109,_0x252d8f){loggers[_0x18f109[_0xada4('0x9')]()][_0x39340f](_0xada4('0xa'),_0x252d8f[_0xada4('0xb')](),_0xb704b1?_0xb704b1['id']:null,_0xb704b1?_0xb704b1[_0xada4('0xc')]:null,_0xb704b1?_0xb704b1[_0xada4('0xd')]:null,getInteractionId(_0x567dc5,_0x170d30,_0x18f109),_0x567dc5?JSON[_0xada4('0xe')](_0x567dc5):_0xada4('0xf'));}function updateUser(_0xf54584,_0x24ac10,_0x4681de,_0x408f7a,_0x23d362){db[_[_0xada4('0x6')](_0x408f7a)+_0xada4('0x10')][_0xada4('0x11')]({'where':{'id':getInteractionId(_0x24ac10,_0x4681de,_0x408f7a)}})['then'](function(_0x41b27d){if(_0x41b27d){return _0x41b27d['update']({'UserId':_0xf54584?_0xf54584['id']:null});}})[_0xada4('0x12')](function(_0x3632c1){if(_0x3632c1){log(_0xada4('0x13'),_0xf54584,_0x24ac10,_0x4681de,_0x408f7a,_0x23d362);}})[_0xada4('0x14')](function(){log(_0xada4('0x15'),_0xf54584,_0x24ac10,_0x4681de,_0x408f7a,_0x23d362);});}exports[_0xada4('0x16')]=function(_0x18a00e,_0x3f1da1){return function(_0x4637a2,_0x5b3045,_0x4de116){var _0x122619=_0x4637a2[_0xada4('0x17')];var _0x13fdfa={};var _0x3e892f=_0x4637a2['query'];if(_0x13fdfa){_0x13fdfa=_[_0xada4('0x18')](_0x4637a2[_0xada4('0x19')]);_0x13fdfa=_[_0xada4('0x1a')](_0x13fdfa,[_0xada4('0x19'),_0xada4('0x1b'),_0xada4('0x1c'),_0xada4('0x1d'),_0xada4('0x1e')]);}updateUser(_0x122619,_0x13fdfa,_0x3e892f,_0x18a00e,_0x3f1da1);_0x4de116(null);};}; \ No newline at end of file +var _0xa3db=['html','phone','fax','mobile','../../mysqldb','openchannel-interactions','../../config/logger','mail-interactions','fax-interactions','sms-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction','findOne','update','then','catch','query','clone','omit','body'];(function(_0x22f838,_0x34dff8){var _0x497384=function(_0x45525c){while(--_0x45525c){_0x22f838['push'](_0x22f838['shift']());}};_0x497384(++_0x34dff8);}(_0xa3db,0xb8));var _0xba3d=function(_0x4d6f10,_0x1bb9fc){_0x4d6f10=_0x4d6f10-0x0;var _0x251b9c=_0xa3db[_0x4d6f10];return _0x251b9c;};'use strict';var _=require('lodash');var db=require(_0xba3d('0x0'))['db'];var loggers={'openchannel':require('../../config/logger')(_0xba3d('0x1')),'mail':require(_0xba3d('0x2'))(_0xba3d('0x3')),'fax':require('../../config/logger')(_0xba3d('0x4')),'sms':require(_0xba3d('0x2'))(_0xba3d('0x5')),'chat':require(_0xba3d('0x2'))('chat-interactions'),'whatsapp':require('../../config/logger')(_0xba3d('0x6'))};function getInteractionId(_0x4f844b,_0x81e2fb,_0x25904e){if(_0x4f844b&&_0x4f844b[_[_0xba3d('0x7')](_0x25904e)+_0xba3d('0x8')]){return _0x4f844b[_[_0xba3d('0x7')](_0x25904e)+_0xba3d('0x8')];}else if(_0x4f844b&&_0x4f844b['id']){return _0x4f844b['id'];}else if(_0x81e2fb&&_0x81e2fb['id']){return _0x81e2fb['id'];}else{return _0xba3d('0x9');}}function log(_0x40ef96,_0x334b20,_0x401f16,_0x398873,_0xac9c1,_0x3ce222){loggers[_0xac9c1[_0xba3d('0xa')]()][_0x40ef96](_0xba3d('0xb'),_0x3ce222[_0xba3d('0xc')](),_0x334b20?_0x334b20['id']:null,_0x334b20?_0x334b20[_0xba3d('0xd')]:null,_0x334b20?_0x334b20[_0xba3d('0xe')]:null,getInteractionId(_0x401f16,_0x398873,_0xac9c1),_0x401f16?JSON[_0xba3d('0xf')](_0x401f16):_0xba3d('0x10'));}function updateUser(_0xe2791a,_0x3d132f,_0x28dc7e,_0x2ffa7f,_0x25f681){db[_[_0xba3d('0x7')](_0x2ffa7f)+_0xba3d('0x11')][_0xba3d('0x12')]({'where':{'id':getInteractionId(_0x3d132f,_0x28dc7e,_0x2ffa7f)}})['then'](function(_0xe7c00c){if(_0xe7c00c){return _0xe7c00c[_0xba3d('0x13')]({'UserId':_0xe2791a?_0xe2791a['id']:null});}})[_0xba3d('0x14')](function(_0x3207b5){if(_0x3207b5){log('info',_0xe2791a,_0x3d132f,_0x28dc7e,_0x2ffa7f,_0x25f681);}})[_0xba3d('0x15')](function(){log('error',_0xe2791a,_0x3d132f,_0x28dc7e,_0x2ffa7f,_0x25f681);});}exports['tracked']=function(_0x15af68,_0x442f7f){return function(_0x50bc2f,_0x13a530,_0x5c7abc){var _0x3b9c5f=_0x50bc2f['user'];var _0x6925d4={};var _0x15dda4=_0x50bc2f[_0xba3d('0x16')];if(_0x6925d4){_0x6925d4=_[_0xba3d('0x17')](_0x50bc2f['body']);_0x6925d4=_[_0xba3d('0x18')](_0x6925d4,[_0xba3d('0x19'),_0xba3d('0x1a'),_0xba3d('0x1b'),_0xba3d('0x1c'),_0xba3d('0x1d')]);}updateUser(_0x3b9c5f,_0x6925d4,_0x15dda4,_0x15af68,_0x442f7f);_0x5c7abc(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 4f481f6..d996ef4 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 _0xdcb9=['User','admin','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','data1','split','format','%s:%s:%s','update','base64','utf8','use','License','findOne','then','count','json','catch','users'];(function(_0x600df3,_0xcb91c8){var _0x2a71b3=function(_0x261752){while(--_0x261752){_0x600df3['push'](_0x600df3['shift']());}};_0x2a71b3(++_0xcb91c8);}(_0xdcb9,0x101));var _0x9dcb=function(_0x114a77,_0x19ce18){_0x114a77=_0x114a77-0x0;var _0xe43adf=_0xdcb9[_0x114a77];return _0xe43adf;};'use strict';var crypto=require(_0x9dcb('0x0'));var util=require(_0x9dcb('0x1'));var compose=require(_0x9dcb('0x2'));var db=require(_0x9dcb('0x3'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x6f3cc1,_0x227fb5){if(_0x6f3cc1&&_0x227fb5){if(_0x227fb5[_0x9dcb('0x4')]&&_0x227fb5['license']){var _0x3c33f9=_0x227fb5[_0x9dcb('0x4')];var _0x3403db=_0x227fb5['license'];var _0xac419c=_0x3c33f9['split']('-')[0x4];var _0x238652=_0x3c33f9[_0x9dcb('0x5')]('-')[0x0];var _0x3f2006=crypto['createDecipher']('aes-256-ctr',util[_0x9dcb('0x6')](_0x9dcb('0x7'),_0xac419c,_0x3c33f9,_0x238652));var _0x5876f8=_0x3f2006[_0x9dcb('0x8')](_0x3403db,_0x9dcb('0x9'),_0x9dcb('0xa'));_0x5876f8+=_0x3f2006['final'](_0x9dcb('0xa'));var _0x540b1b=JSON['parse'](_0x5876f8);return _0x540b1b['hasOwnProperty'](_0x6f3cc1)?_0x540b1b[_0x6f3cc1]:null;}}return null;}function isLimit(_0x5d2b49,_0xddf370,_0x5b13c8,_0x2efe18){var _0x3c7b6d=_0xddf370;return compose()[_0x9dcb('0xb')](function(_0x22a56a,_0x2f7fee,_0x3fcb9a){return db[_0x9dcb('0xc')][_0x9dcb('0xd')]({'where':{'id':0x1},'raw':!![]})[_0x9dcb('0xe')](function(_0x10321d){var _0x443342=getValueFromLicense(_0x5d2b49,_0x10321d);return _0x443342?_0x443342:_0x3c7b6d;})[_0x9dcb('0xe')](function(_0x4b8f3f){_0x3c7b6d=_0x4b8f3f;return _0x5b13c8[_0x9dcb('0xf')](_0x2efe18);})[_0x9dcb('0xe')](function(_0x1e4fa5){if(_0x1e4fa5>=_0x3c7b6d){return _0x2f7fee['status'](0x193)[_0x9dcb('0x10')]({'message':util[_0x9dcb('0x6')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x5d2b49)});}_0x3fcb9a();})[_0x9dcb('0x11')](function(_0x3c7af3){_0x3fcb9a(_0x3c7af3);});});}function isUserLimit(){return isLimit(_0x9dcb('0x12'),0x1,db[_0x9dcb('0x13')],{'where':{'$or':[{'role':_0x9dcb('0x14')},{'role':_0x9dcb('0x15')}]}});}exports[_0x9dcb('0x16')]=isUserLimit; \ No newline at end of file +var _0xb6c2=['crypto','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','use','then','count','json','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','user','isUserLimit'];(function(_0x1f30b1,_0x29c8e0){var _0x13df82=function(_0x4857d2){while(--_0x4857d2){_0x1f30b1['push'](_0x1f30b1['shift']());}};_0x13df82(++_0x29c8e0);}(_0xb6c2,0xd8));var _0x2b6c=function(_0xdbaa6b,_0x450151){_0xdbaa6b=_0xdbaa6b-0x0;var _0x1af40a=_0xb6c2[_0xdbaa6b];return _0x1af40a;};'use strict';var crypto=require(_0x2b6c('0x0'));var util=require('util');var compose=require(_0x2b6c('0x1'));var db=require(_0x2b6c('0x2'))['db'];var config=require(_0x2b6c('0x3'));function getValueFromLicense(_0x3a0d79,_0x488048){if(_0x3a0d79&&_0x488048){if(_0x488048[_0x2b6c('0x4')]&&_0x488048[_0x2b6c('0x5')]){var _0x364e63=_0x488048['data1'];var _0x5330fb=_0x488048[_0x2b6c('0x5')];var _0x1277b3=_0x364e63['split']('-')[0x4];var _0x4c9a9c=_0x364e63[_0x2b6c('0x6')]('-')[0x0];var _0x2761ef=crypto[_0x2b6c('0x7')]('aes-256-ctr',util['format'](_0x2b6c('0x8'),_0x1277b3,_0x364e63,_0x4c9a9c));var _0x3d5c7d=_0x2761ef[_0x2b6c('0x9')](_0x5330fb,_0x2b6c('0xa'),_0x2b6c('0xb'));_0x3d5c7d+=_0x2761ef[_0x2b6c('0xc')]('utf8');var _0x7d8f5=JSON[_0x2b6c('0xd')](_0x3d5c7d);return _0x7d8f5[_0x2b6c('0xe')](_0x3a0d79)?_0x7d8f5[_0x3a0d79]:null;}}return null;}function isLimit(_0x4b5935,_0x3e63c2,_0x321251,_0x8c44cf){var _0x17f2f4=_0x3e63c2;return compose()[_0x2b6c('0xf')](function(_0x3993c9,_0x4ba317,_0x3bbb20){return db['License']['findOne']({'where':{'id':0x1},'raw':!![]})[_0x2b6c('0x10')](function(_0xb695dd){var _0x3575c2=getValueFromLicense(_0x4b5935,_0xb695dd);return _0x3575c2?_0x3575c2:_0x17f2f4;})['then'](function(_0x40d53e){_0x17f2f4=_0x40d53e;return _0x321251[_0x2b6c('0x11')](_0x8c44cf);})['then'](function(_0x4c7ea3){if(_0x4c7ea3>=_0x17f2f4){return _0x4ba317['status'](0x193)[_0x2b6c('0x12')]({'message':util[_0x2b6c('0x13')](_0x2b6c('0x14'),_0x4b5935)});}_0x3bbb20();})['catch'](function(_0x3f10db){_0x3bbb20(_0x3f10db);});});}function isUserLimit(){return isLimit(_0x2b6c('0x15'),0x1,db['User'],{'where':{'$or':[{'role':'admin'},{'role':_0x2b6c('0x16')}]}});}exports[_0x2b6c('0x17')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 2b3311a..7ba7d4d 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 _0x82ca=['days','YYYY-MM-DD','castTo','text','CAST(','\x20AS\x20','field','$ne','\x20OR\x20','\x20IS\x20NULL)','$notIn','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','utcOffset','hours','format','lodash','moment','sqlOperator','startsWith','[$or]','and','replace','[$and]','length','split','slice','forEach','shift','match','filter','indexOf','map','conditions','push','DATE','operator','$eq','$between','value','includes','$gt','$lte','add'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x82ca,0x194));var _0xa82c=function(_0x26bf51,_0x5e261a){_0x26bf51=_0x26bf51-0x0;var _0x503415=_0x82ca[_0x26bf51];return _0x503415;};'use strict';var _=require(_0xa82c('0x0'));var moment=require(_0xa82c('0x1'));exports['parseSearch']=function(_0x1de5b0){var _0x44d67a={'conditions':[]};_0x44d67a[_0xa82c('0x2')]=_[_0xa82c('0x3')](_0x1de5b0,_0xa82c('0x4'))?'or':_0xa82c('0x5');var _0x524e25=_0x1de5b0[_0xa82c('0x6')](_0xa82c('0x7'),'')[_0xa82c('0x6')](_0xa82c('0x4'),'')['split']('||');for(var _0x3caf9b=0x0;_0x3caf9b<_0x524e25[_0xa82c('0x8')];_0x3caf9b++){var _0x254fcd=_0x524e25[_0x3caf9b][_0xa82c('0x9')](':=');var _0x44410f=_0x254fcd[0x0];var _0x23222a=_0x254fcd[_0xa82c('0xa')](0x1);_0x23222a[_0xa82c('0xb')](function(_0x1e53eb){var _0x5024d4=_0x1e53eb[_0xa82c('0x9')]('[')[_0xa82c('0xc')]();var _0x63c75b=_0x1e53eb[_0xa82c('0xd')](/\[(.*?)\]/g);_0x63c75b[_0xa82c('0xb')](function(_0x200072){var _0x1db9b6=_0x200072[_0xa82c('0x9')]('[')[_0xa82c('0xe')](function(_0x5c5440){return _0x5c5440[_0xa82c('0xf')](']')>-0x1;})[_0xa82c('0x10')](function(_0x2b8d86){return _0x2b8d86[_0xa82c('0x9')](']')[0x0];})[0x0];_0x44d67a[_0xa82c('0x11')][_0xa82c('0x12')]({'field':_0x44410f,'operator':_0x5024d4,'value':_0x1db9b6});});});}return _0x44d67a;};exports['buildExpression']=function(_0x8c3a46,_0x2fd14c,_0x16d7b4){var _0x5c991c={};if(_0x2fd14c===_0xa82c('0x13')){if(_0x16d7b4[_0xa82c('0x14')]===_0xa82c('0x15')){_0x16d7b4['operator']=_0xa82c('0x16');_0x16d7b4[_0xa82c('0x17')]+=','+_0x16d7b4['value'];}else if(_[_0xa82c('0x18')]([_0xa82c('0x19'),_0xa82c('0x1a')],_0x16d7b4[_0xa82c('0x14')])){_0x16d7b4[_0xa82c('0x17')]=moment(_0x16d7b4[_0xa82c('0x17')])[_0xa82c('0x1b')](0x1,_0xa82c('0x1c'))['format'](_0xa82c('0x1d'));}}if(_0x16d7b4[_0xa82c('0x1e')]){_0x2fd14c=_0x16d7b4[_0xa82c('0x1e')];_0x5c991c[_0xa82c('0x1f')]=_0xa82c('0x20')+_0x8c3a46+'.'+_0x16d7b4['field']+_0xa82c('0x21')+_0x16d7b4['castTo']+')\x20'+parseOperator(_0x16d7b4['operator']);}else{_0x5c991c[_0xa82c('0x1f')]=_0x8c3a46+'.'+_0x16d7b4[_0xa82c('0x22')]+'\x20'+parseOperator(_0x16d7b4[_0xa82c('0x14')]);}if(_['includes']([_0xa82c('0x23'),'$notIn'],_0x16d7b4[_0xa82c('0x14')]))_0x5c991c[_0xa82c('0x1f')]='('+_0x5c991c[_0xa82c('0x1f')]+_0xa82c('0x24')+_0x8c3a46+'.'+_0x16d7b4['field']+_0xa82c('0x25');_0x5c991c[_0xa82c('0x17')]=parseValue(_0x2fd14c,_0x16d7b4['operator'],_0x16d7b4[_0xa82c('0x17')]);return _0x5c991c;};function parseOperator(_0x969e8a){var _0x396ca4;switch(_0x969e8a){case'$in':_0x396ca4='IN\x20?';break;case _0xa82c('0x26'):_0x396ca4='NOT\x20IN\x20?';break;case _0xa82c('0x15'):_0x396ca4='=\x20?';break;case _0xa82c('0x23'):_0x396ca4=_0xa82c('0x27');break;case _0xa82c('0x28'):case _0xa82c('0x29'):case _0xa82c('0x2a'):_0x396ca4=_0xa82c('0x2b');break;case'$lt':_0x396ca4='<\x20?';break;case _0xa82c('0x19'):_0x396ca4=_0xa82c('0x2c');break;case _0xa82c('0x1a'):_0x396ca4=_0xa82c('0x2d');break;case _0xa82c('0x2e'):_0x396ca4=_0xa82c('0x2f');break;case _0xa82c('0x16'):_0x396ca4=_0xa82c('0x30');break;}return _0x396ca4;}function parseValue(_0x49306a,_0x5b6d55,_0x4bda2d){var _0x2393b5={'start':undefined,'end':undefined};switch(_0x5b6d55){case'$in':case _0xa82c('0x26'):_0x2393b5['start']=_0x4bda2d[_0xa82c('0x9')](',');break;case _0xa82c('0x28'):_0x2393b5[_0xa82c('0x31')]='%'+_0x4bda2d+'%';break;case _0xa82c('0x29'):_0x2393b5[_0xa82c('0x31')]=_0x4bda2d+'%';break;case _0xa82c('0x2a'):_0x2393b5['start']='%'+_0x4bda2d;break;case _0xa82c('0x16'):var _0x36bd83=_0x4bda2d[_0xa82c('0x9')](',');var _0x4bda2d=_0x36bd83[_0xa82c('0xc')]();var _0x3d68b0=_0x36bd83[_0xa82c('0x32')]();if(_0x49306a==='DATE'){_0x4bda2d=moment(_0x4bda2d)[_0xa82c('0x33')](0x0,!![])['format']();_0x3d68b0=moment(_0x3d68b0)[_0xa82c('0x33')](0x0,!![])[_0xa82c('0x1b')](0x17,_0xa82c('0x34'))[_0xa82c('0x1b')](0x3b,'minutes')[_0xa82c('0x1b')](0x3b,'seconds')[_0xa82c('0x35')]();}_0x2393b5={'start':_0x4bda2d,'end':_0x3d68b0};break;default:_0x2393b5[_0xa82c('0x31')]=_0x4bda2d;break;}return _0x2393b5;} \ No newline at end of file +var _0x938e=['$endsWith','LIKE\x20?','<\x20?','>\x20?','$lte','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$startsWith','pop','utcOffset','hours','minutes','seconds','lodash','moment','parseSearch','startsWith','[$or]','replace','[$and]','split','length','slice','shift','match','forEach','map','conditions','push','DATE','$eq','operator','$between','value','includes','$gt','add','days','format','castTo','text','CAST(','field','\x20AS\x20','$notIn','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','$ne','<>\x20?','$substring'];(function(_0x11d18c,_0x688ba3){var _0x20d237=function(_0x1d7970){while(--_0x1d7970){_0x11d18c['push'](_0x11d18c['shift']());}};_0x20d237(++_0x688ba3);}(_0x938e,0x160));var _0xe938=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x938e[_0x3d42d8];return _0x27fc41;};'use strict';var _=require(_0xe938('0x0'));var moment=require(_0xe938('0x1'));exports[_0xe938('0x2')]=function(_0x2a03ac){var _0x42c1c4={'conditions':[]};_0x42c1c4['sqlOperator']=_[_0xe938('0x3')](_0x2a03ac,_0xe938('0x4'))?'or':'and';var _0x5965a9=_0x2a03ac[_0xe938('0x5')](_0xe938('0x6'),'')[_0xe938('0x5')](_0xe938('0x4'),'')[_0xe938('0x7')]('||');for(var _0x417b5f=0x0;_0x417b5f<_0x5965a9[_0xe938('0x8')];_0x417b5f++){var _0x2296c3=_0x5965a9[_0x417b5f][_0xe938('0x7')](':=');var _0x3dde0c=_0x2296c3[0x0];var _0x49f1a3=_0x2296c3[_0xe938('0x9')](0x1);_0x49f1a3['forEach'](function(_0x83c49b){var _0x11e6cb=_0x83c49b[_0xe938('0x7')]('[')[_0xe938('0xa')]();var _0x43cf45=_0x83c49b[_0xe938('0xb')](/\[(.*?)\]/g);_0x43cf45[_0xe938('0xc')](function(_0x1c7e48){var _0xcf5839=_0x1c7e48['split']('[')['filter'](function(_0x58892f){return _0x58892f['indexOf'](']')>-0x1;})[_0xe938('0xd')](function(_0x1c8ec5){return _0x1c8ec5[_0xe938('0x7')](']')[0x0];})[0x0];_0x42c1c4[_0xe938('0xe')][_0xe938('0xf')]({'field':_0x3dde0c,'operator':_0x11e6cb,'value':_0xcf5839});});});}return _0x42c1c4;};exports['buildExpression']=function(_0x304df0,_0x40fa2d,_0x5ab334){var _0x41758c={};if(_0x40fa2d===_0xe938('0x10')){if(_0x5ab334['operator']===_0xe938('0x11')){_0x5ab334[_0xe938('0x12')]=_0xe938('0x13');_0x5ab334[_0xe938('0x14')]+=','+_0x5ab334[_0xe938('0x14')];}else if(_[_0xe938('0x15')]([_0xe938('0x16'),'$lte'],_0x5ab334[_0xe938('0x12')])){_0x5ab334[_0xe938('0x14')]=moment(_0x5ab334[_0xe938('0x14')])[_0xe938('0x17')](0x1,_0xe938('0x18'))[_0xe938('0x19')]('YYYY-MM-DD');}}if(_0x5ab334[_0xe938('0x1a')]){_0x40fa2d=_0x5ab334[_0xe938('0x1a')];_0x41758c[_0xe938('0x1b')]=_0xe938('0x1c')+_0x304df0+'.'+_0x5ab334[_0xe938('0x1d')]+_0xe938('0x1e')+_0x5ab334[_0xe938('0x1a')]+')\x20'+parseOperator(_0x5ab334[_0xe938('0x12')]);}else{_0x41758c[_0xe938('0x1b')]=_0x304df0+'.'+_0x5ab334[_0xe938('0x1d')]+'\x20'+parseOperator(_0x5ab334['operator']);}if(_[_0xe938('0x15')](['$ne',_0xe938('0x1f')],_0x5ab334[_0xe938('0x12')]))_0x41758c[_0xe938('0x1b')]='('+_0x41758c['text']+'\x20OR\x20'+_0x304df0+'.'+_0x5ab334['field']+_0xe938('0x20');_0x41758c['value']=parseValue(_0x40fa2d,_0x5ab334[_0xe938('0x12')],_0x5ab334[_0xe938('0x14')]);return _0x41758c;};function parseOperator(_0x2fdd49){var _0x70782f;switch(_0x2fdd49){case _0xe938('0x21'):_0x70782f=_0xe938('0x22');break;case _0xe938('0x1f'):_0x70782f=_0xe938('0x23');break;case _0xe938('0x11'):_0x70782f=_0xe938('0x24');break;case _0xe938('0x25'):_0x70782f=_0xe938('0x26');break;case _0xe938('0x27'):case'$startsWith':case _0xe938('0x28'):_0x70782f=_0xe938('0x29');break;case'$lt':_0x70782f=_0xe938('0x2a');break;case _0xe938('0x16'):_0x70782f=_0xe938('0x2b');break;case _0xe938('0x2c'):_0x70782f=_0xe938('0x2d');break;case _0xe938('0x2e'):_0x70782f=_0xe938('0x2f');break;case _0xe938('0x13'):_0x70782f=_0xe938('0x30');break;}return _0x70782f;}function parseValue(_0x1a997d,_0x1cf775,_0x3e0816){var _0x1dea97={'start':undefined,'end':undefined};switch(_0x1cf775){case _0xe938('0x21'):case _0xe938('0x1f'):_0x1dea97[_0xe938('0x31')]=_0x3e0816[_0xe938('0x7')](',');break;case _0xe938('0x27'):_0x1dea97[_0xe938('0x31')]='%'+_0x3e0816+'%';break;case _0xe938('0x32'):_0x1dea97[_0xe938('0x31')]=_0x3e0816+'%';break;case _0xe938('0x28'):_0x1dea97[_0xe938('0x31')]='%'+_0x3e0816;break;case _0xe938('0x13'):var _0x12802f=_0x3e0816[_0xe938('0x7')](',');var _0x3e0816=_0x12802f[_0xe938('0xa')]();var _0x3f6d0f=_0x12802f[_0xe938('0x33')]();if(_0x1a997d===_0xe938('0x10')){_0x3e0816=moment(_0x3e0816)['utcOffset'](0x0,!![])['format']();_0x3f6d0f=moment(_0x3f6d0f)[_0xe938('0x34')](0x0,!![])[_0xe938('0x17')](0x17,_0xe938('0x35'))[_0xe938('0x17')](0x3b,_0xe938('0x36'))[_0xe938('0x17')](0x3b,_0xe938('0x37'))[_0xe938('0x19')]();}_0x1dea97={'start':_0x3e0816,'end':_0x3f6d0f};break;default:_0x1dea97[_0xe938('0x31')]=_0x3e0816;break;}return _0x1dea97;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 73ec10b..6eb86c7 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 _0x480b=['isObject','isString','unset','hasOwnProperty','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','replace','push','join','$id','query','model','intersection','attributes','nolimit','order','sort','where','filter','merge','VIRTUAL','lower','options','lodash','sequelize','moment','parse','keys','includes','fields','split','filters','isEmpty','isPlainObject','$gte','format','utc','$lte','subtract','name','uniqueid','isArray','limit','offset','map','indexOf','priority','cast','col','unsigned','substr','DESC','omit','length'];(function(_0x2d2877,_0x2a69d7){var _0x5d0c8c=function(_0x4d14a8){while(--_0x4d14a8){_0x2d2877['push'](_0x2d2877['shift']());}};_0x5d0c8c(++_0x2a69d7);}(_0x480b,0x1a9));var _0xb480=function(_0x1d21a4,_0x4338f5){_0x1d21a4=_0x1d21a4-0x0;var _0x563713=_0x480b[_0x1d21a4];return _0x563713;};'use strict';var _=require(_0xb480('0x0'));var sequelize=require(_0xb480('0x1'));var moment=require(_0xb480('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x5eeb63){var _0x1e3a3a=['ne'];try{var _0x2c1405=JSON[_0xb480('0x3')](_0x5eeb63);var _0x30cb7b=Object[_0xb480('0x4')](_0x2c1405)[0x0];return _0x1e3a3a[_0xb480('0x5')](_0x30cb7b);}catch(_0x6d3907){return![];}}function getOperatorValue(_0x4253c5){var _0x191c62=JSON[_0xb480('0x3')](_0x4253c5);var _0x7b4ee5=Object[_0xb480('0x4')](_0x191c62)[0x0];var _0xe0a125=_0x191c62[_0x7b4ee5];return{['$'+_0x7b4ee5]:_0xe0a125};}exports[_0xb480('0x6')]=function(_0x307e64){var _0x280fdf=null;if(_0x307e64){_0x280fdf=_0x307e64[_0xb480('0x7')](',');}return _0x280fdf;};exports[_0xb480('0x8')]=function(_0xda08eb,_0x45f350){var _0x569fec={};if(!_[_0xb480('0x9')](_0xda08eb)){_['forOwn'](_0xda08eb,function(_0x50efb9,_0xd7925){try{if(_0x45f350){var _0x1e6c4a=_['find'](_0x45f350,{'name':_0xd7925})||{};if(hasSequelizeOperator(_0x50efb9)){_0x569fec[_0xd7925]=getOperatorValue(_0x50efb9);}else if(_0x1e6c4a['type']==='DATE'&&_[_0xb480('0xa')](_0x50efb9)){var _0x3e0997=JSON[_0xb480('0x3')](_0x50efb9);var _0xada523={'$gte':moment(moment(_0x3e0997[_0xb480('0xb')])[_0xb480('0xc')]('YYYY-MM-DD'))[_0xb480('0xd')]()[_0xb480('0xc')](),'$lte':moment(moment(_0x3e0997[_0xb480('0xe')])[_0xb480('0xc')]('YYYY-MM-DD'))[_0xb480('0xd')]()[_0xb480('0xf')](0x1,'s')['format']()};_0x569fec[_0xd7925]=_0xada523;}else if(_0x1e6c4a[_0xb480('0x10')]===_0xb480('0x11')){_0x569fec[_0xd7925]=_0x50efb9;}else{_0x569fec[_0xd7925]=_['isArray'](_0x50efb9)?_0x50efb9:JSON['parse'](_0x50efb9);}}else{_0x569fec[_0xd7925]=_[_0xb480('0x12')](_0x50efb9)?_0x50efb9:JSON['parse'](_0x50efb9);}}catch(_0x2bd378){_0x569fec[_0xd7925]=_0x50efb9[_0xb480('0x7')](',');}});}return _0x569fec;};exports[_0xb480('0x13')]=function(_0x526045){_0x526045=parseInt(_0x526045,0xa);if(!_0x526045||_0x526045<0x0){_0x526045=LIMIT_VALUE;}return _0x526045;};exports[_0xb480('0x14')]=function(_0x44451a){_0x44451a=parseInt(_0x44451a,0xa);if(!_0x44451a||_0x44451a<0x0){_0x44451a=0x0;}return _0x44451a;};exports['sort']=function(_0x4c8066){var _0x47c3c2,_0x3349fa=null;if(_0x4c8066){_0x47c3c2=_0x4c8066[_0xb480('0x7')](',');_0x3349fa=_[_0xb480('0x15')](_0x47c3c2,function(_0x15620f){if(_0x15620f[_0xb480('0x16')]('-')===0x0){return[_0x15620f===_0xb480('0x17')?sequelize[_0xb480('0x18')](sequelize[_0xb480('0x19')]('priority'),_0xb480('0x1a')):_0x15620f[_0xb480('0x1b')](0x1),_0xb480('0x1c')];}else{return[_0x15620f===_0xb480('0x17')?sequelize['cast'](sequelize[_0xb480('0x19')](_0xb480('0x17')),_0xb480('0x1a')):_0x15620f,'ASC'];}});}return _0x3349fa;};exports[_0xb480('0x1d')]=function(_0x34cf00,_0x21d636){if(_['isEmpty'](_0x34cf00)){return _0x34cf00;}if(_[_0xb480('0x12')](_0x34cf00)){for(var _0x37440f=0x0;_0x37440f<_0x34cf00[_0xb480('0x1e')];_0x37440f+=0x1){_0x34cf00[_0x37440f]=this[_0xb480('0x1d')](_0x34cf00[_0x37440f],_0x21d636);}return _0x34cf00;}if(!_[_0xb480('0x1f')](_0x34cf00)){return _0x34cf00;}if(_[_0xb480('0x20')](_0x21d636)){_0x21d636=[_0x21d636];}if(!_[_0xb480('0x12')](_0x21d636)){return _0x34cf00;}for(var _0x3ec86e=0x0;_0x3ec86e<_0x21d636[_0xb480('0x1e')];_0x3ec86e+=0x1){_[_0xb480('0x21')](_0x34cf00,_0x21d636[_0x3ec86e]);}for(var _0x321bc4 in _0x34cf00){if(_0x34cf00[_0xb480('0x22')](_0x321bc4)){_0x34cf00[_0x321bc4]=this['omit'](_0x34cf00[_0x321bc4],_0x21d636);}}return _0x34cf00;};exports['isNumeric']=function(_0x16cd85){return _0x16cd85[_0xb480('0x23')](RegExp(_0xb480('0x24')))?!![]:![];};exports[_0xb480('0x25')]=function(_0x5c84d4){return _0x5c84d4[_0xb480('0x23')](/^\S+@\S+$/)?!![]:![];};exports[_0xb480('0x26')]=function(_0x360389){var _0x5f5693=[];_0x360389[_0xb480('0x7')](/[ ,]+/)[_0xb480('0x27')](function(_0x2507ac){_0x2507ac=_0x2507ac[_0xb480('0x28')](/([^:]")"+/g,'$1');_0x2507ac='+'+_0x2507ac+'*';if(_0x2507ac[_0xb480('0x5')]('@'))_0x2507ac='\x22'+_0x2507ac+'\x22';_0x5f5693[_0xb480('0x29')](_0x2507ac);});return _0x5f5693[_0xb480('0x2a')]('\x20');};exports['getOptions']=function(_0x5b3492,_0x48fb76,_0x4971b6){var _0x41eacd={},_0x66ad9={};if(_0x48fb76['query'][_0xb480('0x2b')]){_0x48fb76[_0xb480('0x2c')]['id']=_0x48fb76[_0xb480('0x2c')]['$id'];delete _0x48fb76[_0xb480('0x2c')][_0xb480('0x2b')];}_0x41eacd[_0xb480('0x2d')]=_[_0xb480('0x15')](_0x5b3492,_0xb480('0x10'));_0x41eacd[_0xb480('0x2c')]=_[_0xb480('0x4')](_0x48fb76[_0xb480('0x2c')]);_0x41eacd[_0xb480('0x8')]=_[_0xb480('0x2e')](_0x41eacd[_0xb480('0x2d')],_0x41eacd[_0xb480('0x2c')]);_0x66ad9[_0xb480('0x2f')]=_[_0xb480('0x2e')](_0x41eacd[_0xb480('0x2d')],this[_0xb480('0x6')](_0x48fb76['query']['fields']));_0x66ad9[_0xb480('0x2f')]=_0x66ad9[_0xb480('0x2f')][_0xb480('0x1e')]?_0x66ad9['attributes']:_0x41eacd['model'];if(!_0x48fb76[_0xb480('0x2c')]['hasOwnProperty'](_0xb480('0x30'))){_0x66ad9['limit']=this[_0xb480('0x13')](_0x48fb76['query'][_0xb480('0x13')]);_0x66ad9[_0xb480('0x14')]=this[_0xb480('0x14')](_0x48fb76[_0xb480('0x2c')][_0xb480('0x14')]);}_0x66ad9[_0xb480('0x31')]=this[_0xb480('0x32')](_0x48fb76[_0xb480('0x2c')][_0xb480('0x32')]);_0x66ad9[_0xb480('0x33')]=this[_0xb480('0x8')](_['pick'](_0x48fb76[_0xb480('0x2c')],_0x41eacd[_0xb480('0x8')]),_0x5b3492);if(_0x48fb76[_0xb480('0x2c')][_0xb480('0x34')]){_0x66ad9[_0xb480('0x33')]=_[_0xb480('0x35')](_0x66ad9[_0xb480('0x33')],{'$or':_[_0xb480('0x15')](_0x5b3492,function(_0x42087a){if(_0x42087a['type']!==_0xb480('0x36')){if(_0x4971b6){return sequelize[_0xb480('0x33')](sequelize['fn']('lower',sequelize['col'](_0x42087a[_0xb480('0x10')])),{'$like':sequelize['fn'](_0xb480('0x37'),'%'+_0x48fb76[_0xb480('0x2c')][_0xb480('0x34')]+'%')});}else{var _0x322e4d={};_0x322e4d[_0x42087a['name']]={'$like':'%'+_0x48fb76[_0xb480('0x2c')][_0xb480('0x34')]+'%'};return _0x322e4d;}}})});}_0x66ad9=_[_0xb480('0x35')]({},_0x66ad9,_0x48fb76[_0xb480('0x38')]);return _0x66ad9;}; \ No newline at end of file +var _0x7e03=['filters','intersection','attributes','fields','nolimit','offset','order','where','filter','merge','lower','options','lodash','sequelize','moment','parse','keys','includes','split','forOwn','find','type','isPlainObject','$gte','format','utc','$lte','YYYY-MM-DD','subtract','uniqueid','isArray','limit','sort','map','indexOf','priority','cast','col','unsigned','ASC','omit','isEmpty','length','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','replace','push','getOptions','query','$id','model','name'];(function(_0x4c217f,_0x82a1ae){var _0x4033b2=function(_0x4752cb){while(--_0x4752cb){_0x4c217f['push'](_0x4c217f['shift']());}};_0x4033b2(++_0x82a1ae);}(_0x7e03,0x133));var _0x37e0=function(_0x3f5bde,_0x247dcf){_0x3f5bde=_0x3f5bde-0x0;var _0x4cf18e=_0x7e03[_0x3f5bde];return _0x4cf18e;};'use strict';var _=require(_0x37e0('0x0'));var sequelize=require(_0x37e0('0x1'));var moment=require(_0x37e0('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x2c4961){var _0x1f051d=['ne'];try{var _0xf1989=JSON[_0x37e0('0x3')](_0x2c4961);var _0x41a13d=Object[_0x37e0('0x4')](_0xf1989)[0x0];return _0x1f051d[_0x37e0('0x5')](_0x41a13d);}catch(_0x1bcbf6){return![];}}function getOperatorValue(_0x2428ca){var _0x2b33e9=JSON[_0x37e0('0x3')](_0x2428ca);var _0x509564=Object[_0x37e0('0x4')](_0x2b33e9)[0x0];var _0x415a94=_0x2b33e9[_0x509564];return{['$'+_0x509564]:_0x415a94};}exports['fields']=function(_0x11c161){var _0x4fab15=null;if(_0x11c161){_0x4fab15=_0x11c161[_0x37e0('0x6')](',');}return _0x4fab15;};exports['filters']=function(_0x159b2c,_0x39a5d9){var _0x4a706c={};if(!_['isEmpty'](_0x159b2c)){_[_0x37e0('0x7')](_0x159b2c,function(_0x4c521b,_0x223ae8){try{if(_0x39a5d9){var _0x130c6a=_[_0x37e0('0x8')](_0x39a5d9,{'name':_0x223ae8})||{};if(hasSequelizeOperator(_0x4c521b)){_0x4a706c[_0x223ae8]=getOperatorValue(_0x4c521b);}else if(_0x130c6a[_0x37e0('0x9')]==='DATE'&&_[_0x37e0('0xa')](_0x4c521b)){var _0x597928=JSON[_0x37e0('0x3')](_0x4c521b);var _0x129f35={'$gte':moment(moment(_0x597928[_0x37e0('0xb')])[_0x37e0('0xc')]('YYYY-MM-DD'))[_0x37e0('0xd')]()['format'](),'$lte':moment(moment(_0x597928[_0x37e0('0xe')])['format'](_0x37e0('0xf')))['utc']()[_0x37e0('0x10')](0x1,'s')[_0x37e0('0xc')]()};_0x4a706c[_0x223ae8]=_0x129f35;}else if(_0x130c6a['name']===_0x37e0('0x11')){_0x4a706c[_0x223ae8]=_0x4c521b;}else{_0x4a706c[_0x223ae8]=_[_0x37e0('0x12')](_0x4c521b)?_0x4c521b:JSON[_0x37e0('0x3')](_0x4c521b);}}else{_0x4a706c[_0x223ae8]=_['isArray'](_0x4c521b)?_0x4c521b:JSON[_0x37e0('0x3')](_0x4c521b);}}catch(_0x3f7edd){_0x4a706c[_0x223ae8]=_0x4c521b['split'](',');}});}return _0x4a706c;};exports[_0x37e0('0x13')]=function(_0x172f59){_0x172f59=parseInt(_0x172f59,0xa);if(!_0x172f59||_0x172f59<0x0){_0x172f59=LIMIT_VALUE;}return _0x172f59;};exports['offset']=function(_0x1f79cf){_0x1f79cf=parseInt(_0x1f79cf,0xa);if(!_0x1f79cf||_0x1f79cf<0x0){_0x1f79cf=0x0;}return _0x1f79cf;};exports[_0x37e0('0x14')]=function(_0x266f0d){var _0x29b9c8,_0x3cd90a=null;if(_0x266f0d){_0x29b9c8=_0x266f0d[_0x37e0('0x6')](',');_0x3cd90a=_[_0x37e0('0x15')](_0x29b9c8,function(_0x2951be){if(_0x2951be[_0x37e0('0x16')]('-')===0x0){return[_0x2951be===_0x37e0('0x17')?sequelize[_0x37e0('0x18')](sequelize[_0x37e0('0x19')](_0x37e0('0x17')),_0x37e0('0x1a')):_0x2951be['substr'](0x1),'DESC'];}else{return[_0x2951be==='priority'?sequelize[_0x37e0('0x18')](sequelize[_0x37e0('0x19')]('priority'),_0x37e0('0x1a')):_0x2951be,_0x37e0('0x1b')];}});}return _0x3cd90a;};exports[_0x37e0('0x1c')]=function(_0x255dab,_0x5ea5cd){if(_[_0x37e0('0x1d')](_0x255dab)){return _0x255dab;}if(_[_0x37e0('0x12')](_0x255dab)){for(var _0x5c8d64=0x0;_0x5c8d64<_0x255dab[_0x37e0('0x1e')];_0x5c8d64+=0x1){_0x255dab[_0x5c8d64]=this[_0x37e0('0x1c')](_0x255dab[_0x5c8d64],_0x5ea5cd);}return _0x255dab;}if(!_['isObject'](_0x255dab)){return _0x255dab;}if(_[_0x37e0('0x1f')](_0x5ea5cd)){_0x5ea5cd=[_0x5ea5cd];}if(!_[_0x37e0('0x12')](_0x5ea5cd)){return _0x255dab;}for(var _0x5c6e00=0x0;_0x5c6e00<_0x5ea5cd[_0x37e0('0x1e')];_0x5c6e00+=0x1){_[_0x37e0('0x20')](_0x255dab,_0x5ea5cd[_0x5c6e00]);}for(var _0x4e9e37 in _0x255dab){if(_0x255dab[_0x37e0('0x21')](_0x4e9e37)){_0x255dab[_0x4e9e37]=this[_0x37e0('0x1c')](_0x255dab[_0x4e9e37],_0x5ea5cd);}}return _0x255dab;};exports[_0x37e0('0x22')]=function(_0x2386c5){return _0x2386c5[_0x37e0('0x23')](RegExp(_0x37e0('0x24')))?!![]:![];};exports[_0x37e0('0x25')]=function(_0x18d5f7){return _0x18d5f7[_0x37e0('0x23')](/^\S+@\S+$/)?!![]:![];};exports[_0x37e0('0x26')]=function(_0x36fa2a){var _0xcb675d=[];_0x36fa2a[_0x37e0('0x6')](/[ ,]+/)[_0x37e0('0x27')](function(_0x18450f){_0x18450f=_0x18450f[_0x37e0('0x28')](/([^:]")"+/g,'$1');_0x18450f='+'+_0x18450f+'*';if(_0x18450f['includes']('@'))_0x18450f='\x22'+_0x18450f+'\x22';_0xcb675d[_0x37e0('0x29')](_0x18450f);});return _0xcb675d['join']('\x20');};exports[_0x37e0('0x2a')]=function(_0x1eff19,_0x3f2d52,_0x59221b){var _0xef588c={},_0x379e5a={};if(_0x3f2d52[_0x37e0('0x2b')][_0x37e0('0x2c')]){_0x3f2d52[_0x37e0('0x2b')]['id']=_0x3f2d52[_0x37e0('0x2b')]['$id'];delete _0x3f2d52[_0x37e0('0x2b')]['$id'];}_0xef588c[_0x37e0('0x2d')]=_[_0x37e0('0x15')](_0x1eff19,_0x37e0('0x2e'));_0xef588c[_0x37e0('0x2b')]=_[_0x37e0('0x4')](_0x3f2d52[_0x37e0('0x2b')]);_0xef588c[_0x37e0('0x2f')]=_[_0x37e0('0x30')](_0xef588c[_0x37e0('0x2d')],_0xef588c[_0x37e0('0x2b')]);_0x379e5a[_0x37e0('0x31')]=_['intersection'](_0xef588c[_0x37e0('0x2d')],this[_0x37e0('0x32')](_0x3f2d52[_0x37e0('0x2b')][_0x37e0('0x32')]));_0x379e5a[_0x37e0('0x31')]=_0x379e5a[_0x37e0('0x31')]['length']?_0x379e5a[_0x37e0('0x31')]:_0xef588c[_0x37e0('0x2d')];if(!_0x3f2d52['query'][_0x37e0('0x21')](_0x37e0('0x33'))){_0x379e5a[_0x37e0('0x13')]=this['limit'](_0x3f2d52['query'][_0x37e0('0x13')]);_0x379e5a[_0x37e0('0x34')]=this[_0x37e0('0x34')](_0x3f2d52['query'][_0x37e0('0x34')]);}_0x379e5a[_0x37e0('0x35')]=this[_0x37e0('0x14')](_0x3f2d52[_0x37e0('0x2b')][_0x37e0('0x14')]);_0x379e5a[_0x37e0('0x36')]=this[_0x37e0('0x2f')](_['pick'](_0x3f2d52[_0x37e0('0x2b')],_0xef588c['filters']),_0x1eff19);if(_0x3f2d52['query'][_0x37e0('0x37')]){_0x379e5a[_0x37e0('0x36')]=_[_0x37e0('0x38')](_0x379e5a[_0x37e0('0x36')],{'$or':_[_0x37e0('0x15')](_0x1eff19,function(_0x2c08ba){if(_0x2c08ba[_0x37e0('0x9')]!=='VIRTUAL'){if(_0x59221b){return sequelize[_0x37e0('0x36')](sequelize['fn']('lower',sequelize['col'](_0x2c08ba[_0x37e0('0x2e')])),{'$like':sequelize['fn'](_0x37e0('0x39'),'%'+_0x3f2d52['query']['filter']+'%')});}else{var _0x105008={};_0x105008[_0x2c08ba[_0x37e0('0x2e')]]={'$like':'%'+_0x3f2d52[_0x37e0('0x2b')][_0x37e0('0x37')]+'%'};return _0x105008;}}})});}_0x379e5a=_[_0x37e0('0x38')]({},_0x379e5a,_0x3f2d52[_0x37e0('0x3a')]);return _0x379e5a;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 80500d5..7e51ffd 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x71fc=['get','env','appPath','development','set','root','client','use','json\x20replacer','toISOString','split','static','views','html','ejs','renderFile','view\x20engine','50mb','json','serve-favicon','body-parser','method-override','cookie-parser','errorhandler','path','passport','cors','moment','./environment','../mysqldb','default'];(function(_0x18a875,_0x2eaca1){var _0xeeea03=function(_0x4f19c5){while(--_0x4f19c5){_0x18a875['push'](_0x18a875['shift']());}};_0xeeea03(++_0x2eaca1);}(_0x71fc,0x10b));var _0xc71f=function(_0x5b7fa5,_0x20335f){_0x5b7fa5=_0x5b7fa5-0x0;var _0x3bc384=_0x71fc[_0x5b7fa5];return _0x3bc384;};'use strict';var express=require('express');var favicon=require(_0xc71f('0x0'));var bodyParser=require(_0xc71f('0x1'));var methodOverride=require(_0xc71f('0x2'));var cookieParser=require(_0xc71f('0x3'));var errorHandler=require(_0xc71f('0x4'));var path=require(_0xc71f('0x5'));var passport=require(_0xc71f('0x6'));var cors=require(_0xc71f('0x7'));var moment=require(_0xc71f('0x8'));var config=require(_0xc71f('0x9'));var db=require(_0xc71f('0xa'))['db'];exports[_0xc71f('0xb')]=function(_0x225616){var _0x3cfb2f=_0x225616[_0xc71f('0xc')](_0xc71f('0xd'));if(_0x3cfb2f==='production'){_0x225616['set'](_0xc71f('0xe'),path['join'](config['root'],'public'));}if(_0x3cfb2f===_0xc71f('0xf')||_0x3cfb2f==='test'){_0x225616[_0xc71f('0x10')]('appPath',path['join'](config[_0xc71f('0x11')],_0xc71f('0x12')));_0x225616[_0xc71f('0x13')](errorHandler());}_0x225616[_0xc71f('0x10')](_0xc71f('0x14'),function(_0x1867c0,_0x19d3f0){if(this[_0x1867c0]instanceof Date){_0x19d3f0=this[_0x1867c0][_0xc71f('0x15')]()[_0xc71f('0x16')]('.')[0x0]+'Z';}return _0x19d3f0;});_0x225616['use'](express[_0xc71f('0x17')](_0x225616['get'](_0xc71f('0xe'))));_0x225616[_0xc71f('0x10')](_0xc71f('0x18'),config[_0xc71f('0x11')]+'/server/views');_0x225616['engine'](_0xc71f('0x19'),require(_0xc71f('0x1a'))[_0xc71f('0x1b')]);_0x225616['set'](_0xc71f('0x1c'),_0xc71f('0x19'));_0x225616['use'](bodyParser['urlencoded']({'limit':_0xc71f('0x1d'),'extended':!![]}));_0x225616['use'](bodyParser[_0xc71f('0x1e')]({'limit':_0xc71f('0x1d')}));_0x225616[_0xc71f('0x13')](cors());_0x225616[_0xc71f('0x13')](methodOverride());_0x225616['use'](cookieParser());_0x225616[_0xc71f('0x13')](passport['initialize']());}; \ No newline at end of file +var _0x2dc0=['view\x20engine','json','50mb','initialize','express','body-parser','method-override','cookie-parser','errorhandler','path','passport','cors','./environment','../mysqldb','default','production','set','root','public','development','test','appPath','join','client','use','toISOString','split','static','views','/server/views','engine','html','ejs'];(function(_0x213464,_0x67c63d){var _0x47fb2b=function(_0x490479){while(--_0x490479){_0x213464['push'](_0x213464['shift']());}};_0x47fb2b(++_0x67c63d);}(_0x2dc0,0xca));var _0x02dc=function(_0x247d79,_0x2637f8){_0x247d79=_0x247d79-0x0;var _0x5142c2=_0x2dc0[_0x247d79];return _0x5142c2;};'use strict';var express=require(_0x02dc('0x0'));var favicon=require('serve-favicon');var bodyParser=require(_0x02dc('0x1'));var methodOverride=require(_0x02dc('0x2'));var cookieParser=require(_0x02dc('0x3'));var errorHandler=require(_0x02dc('0x4'));var path=require(_0x02dc('0x5'));var passport=require(_0x02dc('0x6'));var cors=require(_0x02dc('0x7'));var moment=require('moment');var config=require(_0x02dc('0x8'));var db=require(_0x02dc('0x9'))['db'];exports[_0x02dc('0xa')]=function(_0x25e0b3){var _0x249105=_0x25e0b3['get']('env');if(_0x249105===_0x02dc('0xb')){_0x25e0b3[_0x02dc('0xc')]('appPath',path['join'](config[_0x02dc('0xd')],_0x02dc('0xe')));}if(_0x249105===_0x02dc('0xf')||_0x249105===_0x02dc('0x10')){_0x25e0b3[_0x02dc('0xc')](_0x02dc('0x11'),path[_0x02dc('0x12')](config['root'],_0x02dc('0x13')));_0x25e0b3[_0x02dc('0x14')](errorHandler());}_0x25e0b3[_0x02dc('0xc')]('json\x20replacer',function(_0x4d6314,_0x7a3f7c){if(this[_0x4d6314]instanceof Date){_0x7a3f7c=this[_0x4d6314][_0x02dc('0x15')]()[_0x02dc('0x16')]('.')[0x0]+'Z';}return _0x7a3f7c;});_0x25e0b3[_0x02dc('0x14')](express[_0x02dc('0x17')](_0x25e0b3['get'](_0x02dc('0x11'))));_0x25e0b3[_0x02dc('0xc')](_0x02dc('0x18'),config['root']+_0x02dc('0x19'));_0x25e0b3[_0x02dc('0x1a')](_0x02dc('0x1b'),require(_0x02dc('0x1c'))['renderFile']);_0x25e0b3[_0x02dc('0xc')](_0x02dc('0x1d'),_0x02dc('0x1b'));_0x25e0b3[_0x02dc('0x14')](bodyParser['urlencoded']({'limit':'50mb','extended':!![]}));_0x25e0b3[_0x02dc('0x14')](bodyParser[_0x02dc('0x1e')]({'limit':_0x02dc('0x1f')}));_0x25e0b3[_0x02dc('0x14')](cors());_0x25e0b3[_0x02dc('0x14')](methodOverride());_0x25e0b3[_0x02dc('0x14')](cookieParser());_0x25e0b3[_0x02dc('0x14')](passport[_0x02dc('0x20')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index b74f916..fa43649 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 _0xa224=['length','family','IPv4','internal','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','join','createHash','update','digest','hex','platform','test','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','substring','lodash','bimedia-machine-uuid','execSync','../environment','networkInterfaces'];(function(_0x5ec474,_0x16d228){var _0x24f5b3=function(_0x4fa3aa){while(--_0x4fa3aa){_0x5ec474['push'](_0x5ec474['shift']());}};_0x24f5b3(++_0x16d228);}(_0xa224,0x14f));var _0x4a22=function(_0x5a89da,_0xdda4a2){_0x5a89da=_0x5a89da-0x0;var _0x419ae8=_0xa224[_0x5a89da];return _0x419ae8;};'use strict';var _=require(_0x4a22('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0x4a22('0x1'));var exec=require('child_process')[_0x4a22('0x2')];var config=require(_0x4a22('0x3'));function getInterfaces(){var _0xaab908=[];var _0x13a42b=os[_0x4a22('0x4')]();var _0x4a576b=_['orderBy'](_['keys'](_0x13a42b));for(var _0x305963=0x0;_0x305963<_0x4a576b[_0x4a22('0x5')];_0x305963++){var _0x2b26c6=_0x13a42b[_0x4a576b[_0x305963]]['filter'](function(_0x3c9b6b){return _0x3c9b6b[_0x4a22('0x6')]===_0x4a22('0x7')&&_0x3c9b6b[_0x4a22('0x8')]===![];});_0xaab908=_0xaab908['concat'](_0x2b26c6);}return _0xaab908;}function getFirstInterface(){var _0x137546=_[_0x4a22('0x9')](getInterfaces());return{'macAddress':_0x137546&&_0x137546['mac']?_0x137546[_0x4a22('0xa')]:_0x4a22('0xb'),'ipAddress':_0x137546&&_0x137546[_0x4a22('0xc')]?_0x137546[_0x4a22('0xc')]:_0x4a22('0xd')};}exports[_0x4a22('0xe')]=getFirstInterface;function getCPUhash(){var _0x2ea2ce=_['orderBy'](os[_0x4a22('0xf')]()[_0x4a22('0x10')](function(_0x34c069){return _0x34c069[_0x4a22('0x11')];}))[_0x4a22('0x12')](':');return crypto[_0x4a22('0x13')]('md5')[_0x4a22('0x14')](_0x2ea2ce)[_0x4a22('0x15')](_0x4a22('0x16'));}exports['getUuid']=function(){var _0x5485db=os[_0x4a22('0x17')]();var _0x2afe0b=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x2afe0b[_0x4a22('0x18')](config[_0x4a22('0x19')])){return config[_0x4a22('0x19')];}else if(_0x5485db===_0x4a22('0x1a')){return exec(_0x4a22('0x1b'),{'encoding':_0x4a22('0x1c')})[_0x4a22('0x1d')]('\x0d\x0a','');}else{var _0x3ab03e=getFirstInterface();var _0x2fce96=getCPUhash();var _0x2e86b3=_0x2fce96+'|'+os[_0x4a22('0x1e')]()+'|'+_0x3ab03e[_0x4a22('0x1f')]+'|'+_0x3ab03e[_0x4a22('0x20')];var _0xab3d9d=crypto['createHash']('md5')[_0x4a22('0x14')](_0x2e86b3)['digest']('hex');return _0xab3d9d[_0x4a22('0x21')](0x0,0x8)+'-'+_0xab3d9d[_0x4a22('0x21')](0x8,0xc)+'-'+_0xab3d9d[_0x4a22('0x21')](0xc,0x10)+'-'+_0xab3d9d[_0x4a22('0x21')](0x10,0x14)+'-'+_0xab3d9d[_0x4a22('0x21')](0x14);}}; \ No newline at end of file +var _0x9e3f=['licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','macAddress','ipAddress','digest','hex','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','keys','length','filter','family','internal','concat','head','mac','00:00:00:00:00:00','address','cpus','map','createHash','md5','update','getUuid','platform'];(function(_0xb65e77,_0x238c3d){var _0x38134b=function(_0x39da21){while(--_0x39da21){_0xb65e77['push'](_0xb65e77['shift']());}};_0x38134b(++_0x238c3d);}(_0x9e3f,0x9b));var _0xf9e3=function(_0x395f6b,_0x35fc3c){_0x395f6b=_0x395f6b-0x0;var _0x131428=_0x9e3f[_0x395f6b];return _0x131428;};'use strict';var _=require(_0xf9e3('0x0'));var os=require('os');var crypto=require(_0xf9e3('0x1'));var machine=require(_0xf9e3('0x2'));var exec=require(_0xf9e3('0x3'))[_0xf9e3('0x4')];var config=require(_0xf9e3('0x5'));function getInterfaces(){var _0x4f27dd=[];var _0x182223=os[_0xf9e3('0x6')]();var _0x5c54b0=_[_0xf9e3('0x7')](_[_0xf9e3('0x8')](_0x182223));for(var _0x1e8b12=0x0;_0x1e8b12<_0x5c54b0[_0xf9e3('0x9')];_0x1e8b12++){var _0x1bb557=_0x182223[_0x5c54b0[_0x1e8b12]][_0xf9e3('0xa')](function(_0x2f501f){return _0x2f501f[_0xf9e3('0xb')]==='IPv4'&&_0x2f501f[_0xf9e3('0xc')]===![];});_0x4f27dd=_0x4f27dd[_0xf9e3('0xd')](_0x1bb557);}return _0x4f27dd;}function getFirstInterface(){var _0x549f16=_[_0xf9e3('0xe')](getInterfaces());return{'macAddress':_0x549f16&&_0x549f16[_0xf9e3('0xf')]?_0x549f16[_0xf9e3('0xf')]:_0xf9e3('0x10'),'ipAddress':_0x549f16&&_0x549f16[_0xf9e3('0x11')]?_0x549f16[_0xf9e3('0x11')]:'127.0.0.1'};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x12d511=_[_0xf9e3('0x7')](os[_0xf9e3('0x12')]()[_0xf9e3('0x13')](function(_0x59aab5){return _0x59aab5['model'];}))['join'](':');return crypto[_0xf9e3('0x14')](_0xf9e3('0x15'))[_0xf9e3('0x16')](_0x12d511)['digest']('hex');}exports[_0xf9e3('0x17')]=function(){var _0x1477f9=os[_0xf9e3('0x18')]();var _0x199572=/[0-9a-f-]{36}/;if(config[_0xf9e3('0x19')]&&_0x199572[_0xf9e3('0x1a')](config[_0xf9e3('0x19')])){return config[_0xf9e3('0x19')];}else if(_0x1477f9===_0xf9e3('0x1b')){return exec(_0xf9e3('0x1c'),{'encoding':_0xf9e3('0x1d')})[_0xf9e3('0x1e')]('\x0d\x0a','');}else{var _0x1718f8=getFirstInterface();var _0x7f9f7c=getCPUhash();var _0x837929=_0x7f9f7c+'|'+os['hostname']()+'|'+_0x1718f8[_0xf9e3('0x1f')]+'|'+_0x1718f8[_0xf9e3('0x20')];var _0x34a18b=crypto[_0xf9e3('0x14')](_0xf9e3('0x15'))[_0xf9e3('0x16')](_0x837929)[_0xf9e3('0x21')](_0xf9e3('0x22'));return _0x34a18b[_0xf9e3('0x23')](0x0,0x8)+'-'+_0x34a18b[_0xf9e3('0x23')](0x8,0xc)+'-'+_0x34a18b[_0xf9e3('0x23')](0xc,0x10)+'-'+_0x34a18b[_0xf9e3('0x23')](0x10,0x14)+'-'+_0x34a18b[_0xf9e3('0x23')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 7c6f802..a8d3fbb 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 _0x57ad=['pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','catch','get','data1','data2','license','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','Changed','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','decryptString','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','then','message','finally','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','moment','request-promise','bluebird'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x57ad,0x14a));var _0xd57a=function(_0x50fbd2,_0x45551c){_0x50fbd2=_0x50fbd2-0x0;var _0x25ff9e=_0x57ad[_0x50fbd2];return _0x25ff9e;};'use strict';var util=require('util');var moment=require(_0xd57a('0x0'));var rp=require(_0xd57a('0x1'));var BPromise=require(_0xd57a('0x2'));var pkginfo=require(_0xd57a('0x3'))(module,_0xd57a('0x4'));var db=require(_0xd57a('0x5'))['db'];var encryptor=require(_0xd57a('0x6'));var hardware=require(_0xd57a('0x7'));var logger=require(_0xd57a('0x8'))('license');var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x3b5c01){return new BPromise(function(_0x2b2c1b,_0x4b0658){var _0x459079=util[_0xd57a('0x9')]('%s/api/servers/%s/check?version=%s',HOST,_0x3b5c01,module['exports']['version']);if(oldToken){_0x459079=util[_0xd57a('0x9')](_0xd57a('0xa'),HOST,_0x3b5c01,module['exports'][_0xd57a('0x4')],oldToken);}var _0x185ef6={'uri':_0x459079,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x185ef6)['then'](function(_0x26f29e){_0x2b2c1b(_0x26f29e);})[_0xd57a('0xb')](function(_0x103f9b){_0x4b0658(_0x103f9b);});});}function manageLicense(_0x57ff9d,_0x27b66b){var _0x1c58e5=_0x27b66b[_0xd57a('0xc')]({'plain':!![]});if(!isOldTokenSent&&_0x1c58e5[_0xd57a('0xd')]!==_0x57ff9d&&!_0x1c58e5[_0xd57a('0xe')]){oldToken=_0x1c58e5['data1'];}httpRequest(_0x57ff9d)['then'](function(_0x30f326){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x30f326['active']){isOldTokenSent=![];if(!_0x1c58e5[_0xd57a('0xf')]&&_0x1c58e5[_0xd57a('0xf')]!=_0x30f326[_0xd57a('0xf')]||_0x1c58e5[_0xd57a('0xf')]&&_0x1c58e5[_0xd57a('0xe')]){logger[_0xd57a('0x10')](_0xd57a('0x11'));}if(_0x1c58e5[_0xd57a('0xf')]&&!_0x1c58e5[_0xd57a('0xe')]&&_0x1c58e5[_0xd57a('0xf')]!=_0x30f326['license']){logger[_0xd57a('0x10')](_0xd57a('0x12'));}if(_0x1c58e5['license']&&!_0x1c58e5[_0xd57a('0xe')]&&_0x1c58e5[_0xd57a('0xf')]==_0x30f326[_0xd57a('0xf')]){return _0x27b66b;}return _0x27b66b[_0xd57a('0x13')]({'data1':_0x57ff9d,'data2':null,'license':_0x30f326[_0xd57a('0xf')]});}else{if(_0x30f326[_0xd57a('0xf')]||_0x1c58e5[_0xd57a('0xf')]){if(!_0x1c58e5[_0xd57a('0xe')]){if(_0x1c58e5[_0xd57a('0xd')]==_0x57ff9d){GRAY_PERIOD_REASON=_0xd57a('0x14');logger[_0xd57a('0x10')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0xd57a('0x15');logger[_0xd57a('0x10')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x1c58e5[_0xd57a('0xd')],_0x57ff9d);}logger[_0xd57a('0x10')](_0xd57a('0x16'),GRAY_PERIOD_REASON[_0xd57a('0x17')](),moment()[_0xd57a('0x9')](_0xd57a('0x18')));return _0x27b66b[_0xd57a('0x13')]({'data2':encryptor['encryptString'](moment()[_0xd57a('0x9')](_0xd57a('0x18')))});}else{if(moment()[_0xd57a('0x19')](encryptor[_0xd57a('0x1a')](_0x1c58e5['data2']),'days')>DAYS){logger[_0xd57a('0x10')](_0xd57a('0x1b'),moment()[_0xd57a('0x9')](_0xd57a('0x18')));isOldTokenSent=![];return _0x27b66b[_0xd57a('0x13')]({'data1':_0x57ff9d,'data2':null,'license':null});}}}else{if(_0x1c58e5[_0xd57a('0xd')]!=_0x57ff9d){logger['info'](_0xd57a('0x1c'),_0x1c58e5[_0xd57a('0xd')],_0x57ff9d);return _0x27b66b[_0xd57a('0x13')]({'data1':_0x57ff9d,'data2':null,'license':null});}}}return _0x27b66b;})[_0xd57a('0x1d')](function(_0x350e96){_0x27b66b=_0x350e96;})[_0xd57a('0xb')](function(_0x11cfcf){logger['error'](_0x11cfcf[_0xd57a('0x1e')]);})[_0xd57a('0x1f')](function(){setTimeout(function(){manageLicense(hardware[_0xd57a('0x20')](),_0x27b66b);},TIME);});}function defaultLicense(){var _0x3904b2=hardware[_0xd57a('0x20')]();if(_0x3904b2){return db['License'][_0xd57a('0x21')]({'where':{'id':0x1},'defaults':{'data1':_0x3904b2}})[_0xd57a('0x22')](function(_0x2d4651,_0x56c601){logger[_0xd57a('0x10')](_0xd57a('0x23'),_0x3904b2);manageLicense(_0x3904b2,_0x2d4651);})['catch'](function(_0x40800b){logger[_0xd57a('0x24')](_0x40800b[_0xd57a('0x1e')]);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0x78e3=['update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','decryptString','DEMO\x20START\x20AT\x20%s','catch','message','getUuid','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','request-promise','bluebird','pkginfo','version','../../mysqldb','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','get','data1','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED'];(function(_0x7b5cdd,_0x8c88d8){var _0x3a29ae=function(_0x17859a){while(--_0x17859a){_0x7b5cdd['push'](_0x7b5cdd['shift']());}};_0x3a29ae(++_0x8c88d8);}(_0x78e3,0xcf));var _0x378e=function(_0x5cc3a2,_0x5679b6){_0x5cc3a2=_0x5cc3a2-0x0;var _0x537a53=_0x78e3[_0x5cc3a2];return _0x537a53;};'use strict';var util=require(_0x378e('0x0'));var moment=require('moment');var rp=require(_0x378e('0x1'));var BPromise=require(_0x378e('0x2'));var pkginfo=require(_0x378e('0x3'))(module,_0x378e('0x4'));var db=require(_0x378e('0x5'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0x378e('0x6'));var logger=require(_0x378e('0x7'))(_0x378e('0x8'));var HOST=_0x378e('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x4b592e){return new BPromise(function(_0x21c613,_0x544b73){var _0xc5227c=util[_0x378e('0xa')](_0x378e('0xb'),HOST,_0x4b592e,module[_0x378e('0xc')][_0x378e('0x4')]);if(oldToken){_0xc5227c=util['format'](_0x378e('0xd'),HOST,_0x4b592e,module[_0x378e('0xc')][_0x378e('0x4')],oldToken);}var _0x1a67c6={'uri':_0xc5227c,'method':_0x378e('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x1a67c6)[_0x378e('0xf')](function(_0x14b44a){_0x21c613(_0x14b44a);})['catch'](function(_0x5d40bd){_0x544b73(_0x5d40bd);});});}function manageLicense(_0xe2e4d8,_0x1111e4){var _0x18a1f5=_0x1111e4[_0x378e('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0x18a1f5[_0x378e('0x11')]!==_0xe2e4d8&&!_0x18a1f5[_0x378e('0x12')]){oldToken=_0x18a1f5['data1'];}httpRequest(_0xe2e4d8)[_0x378e('0xf')](function(_0x58b753){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x58b753['active']){isOldTokenSent=![];if(!_0x18a1f5['license']&&_0x18a1f5[_0x378e('0x8')]!=_0x58b753[_0x378e('0x8')]||_0x18a1f5['license']&&_0x18a1f5[_0x378e('0x12')]){logger[_0x378e('0x13')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x18a1f5[_0x378e('0x8')]&&!_0x18a1f5[_0x378e('0x12')]&&_0x18a1f5[_0x378e('0x8')]!=_0x58b753[_0x378e('0x8')]){logger[_0x378e('0x13')](_0x378e('0x14'));}if(_0x18a1f5[_0x378e('0x8')]&&!_0x18a1f5[_0x378e('0x12')]&&_0x18a1f5[_0x378e('0x8')]==_0x58b753['license']){return _0x1111e4;}return _0x1111e4[_0x378e('0x15')]({'data1':_0xe2e4d8,'data2':null,'license':_0x58b753[_0x378e('0x8')]});}else{if(_0x58b753[_0x378e('0x8')]||_0x18a1f5[_0x378e('0x8')]){if(!_0x18a1f5[_0x378e('0x12')]){if(_0x18a1f5['data1']==_0xe2e4d8){GRAY_PERIOD_REASON=_0x378e('0x16');logger['info'](_0x378e('0x17'));}else{GRAY_PERIOD_REASON='Changed';logger['info'](_0x378e('0x18'),_0x18a1f5[_0x378e('0x11')],_0xe2e4d8);}logger['info'](_0x378e('0x19'),GRAY_PERIOD_REASON[_0x378e('0x1a')](),moment()[_0x378e('0xa')](_0x378e('0x1b')));return _0x1111e4[_0x378e('0x15')]({'data2':encryptor['encryptString'](moment()[_0x378e('0xa')](_0x378e('0x1b')))});}else{if(moment()[_0x378e('0x1c')](encryptor[_0x378e('0x1d')](_0x18a1f5[_0x378e('0x12')]),'days')>DAYS){logger[_0x378e('0x13')](_0x378e('0x1e'),moment()[_0x378e('0xa')](_0x378e('0x1b')));isOldTokenSent=![];return _0x1111e4[_0x378e('0x15')]({'data1':_0xe2e4d8,'data2':null,'license':null});}}}else{if(_0x18a1f5[_0x378e('0x11')]!=_0xe2e4d8){logger[_0x378e('0x13')](_0x378e('0x18'),_0x18a1f5['data1'],_0xe2e4d8);return _0x1111e4[_0x378e('0x15')]({'data1':_0xe2e4d8,'data2':null,'license':null});}}}return _0x1111e4;})[_0x378e('0xf')](function(_0x42065d){_0x1111e4=_0x42065d;})[_0x378e('0x1f')](function(_0x1786e7){logger['error'](_0x1786e7[_0x378e('0x20')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x378e('0x21')](),_0x1111e4);},TIME);});}function defaultLicense(){var _0x3d8903=hardware[_0x378e('0x21')]();if(_0x3d8903){return db[_0x378e('0x22')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x3d8903}})[_0x378e('0x23')](function(_0x4fd214,_0x472573){logger[_0x378e('0x13')](_0x378e('0x24'),_0x3d8903);manageLicense(_0x3d8903,_0x4fd214);})[_0x378e('0x1f')](function(_0x4fbce9){logger['error'](_0x4fbce9['message']);});}}exports[_0x378e('0x25')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index eac8335..5456ad6 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 _0x8e7e=['uuid','machineUuid','add','grayReason','changed','disabled','message','User','role','sequelize','col','count','admin','user','telephone','users','telephones','forEach','countBy','License\x20limit\x20reached\x20for\x20users','exports','util','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','then','catch','license','isEmpty','data1','split','decryptString','format','%s:%s:%s','demo'];(function(_0x274a0a,_0x13cb96){var _0x5817c6=function(_0x79cb96){while(--_0x79cb96){_0x274a0a['push'](_0x274a0a['shift']());}};_0x5817c6(++_0x13cb96);}(_0x8e7e,0x18f));var _0xe8e7=function(_0x5351a1,_0x203bbc){_0x5351a1=_0x5351a1-0x0;var _0x256383=_0x8e7e[_0x5351a1];return _0x256383;};'use strict';var util=require(_0xe8e7('0x0'));var _=require(_0xe8e7('0x1'));var moment=require(_0xe8e7('0x2'));var BPromise=require(_0xe8e7('0x3'));var hardware=require(_0xe8e7('0x4'));var encryptor=require(_0xe8e7('0x5'));var db=require(_0xe8e7('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xe8e7('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xe8e7('0x8'),'machineUuid':hardware[_0xe8e7('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xe8e7('0xa'),'machineUuid':hardware[_0xe8e7('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x2d837a){return new BPromise(function(_0x1e2d04,_0xea864e){return db['License']['find'](_['defaults'](_0x2d837a,{'raw':!![],'where':{'id':0x1}}))[_0xe8e7('0xb')](function(_0x4fe4b7){return checkLicense(_0x4fe4b7,null);})[_0xe8e7('0xb')](function(_0xf734a7){_0x1e2d04(_0xf734a7);return;})[_0xe8e7('0xc')](function(_0x3db4b0){_0xea864e(_0x3db4b0);});});}function checkLicense(_0x4803bb,_0x45ba9d){if(!_0x4803bb){demoLicense['uuid']=_0x4803bb['data1'];return demoLicense;}try{var _0x4fa7b4=_0x45ba9d||_0x4803bb[_0xe8e7('0xd')];if(_[_0xe8e7('0xe')](_0x4fa7b4)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x11cf04=_0x4803bb[_0xe8e7('0xf')];var _0x343511=_0x4803bb['data2'];var _0xeadd7d=_0x11cf04[_0xe8e7('0x10')]('-')[0x4];var _0x4b1902=_0x11cf04[_0xe8e7('0x10')]('-')[0x0];var _0x5e662a=encryptor[_0xe8e7('0x11')](_0x4fa7b4,util[_0xe8e7('0x12')](_0xe8e7('0x13'),_0xeadd7d,_0x11cf04,_0x4b1902));var _0x513dbc=JSON['parse'](_0x5e662a);_0x513dbc[_0xe8e7('0x14')]=![];_0x513dbc[_0xe8e7('0x15')]=_0x11cf04;_0x513dbc[_0xe8e7('0x16')]=hardware[_0xe8e7('0x9')]();if(_0x343511){var _0x2710c3=encryptor[_0xe8e7('0x11')](_0x343511);_0x513dbc['gray']=_0x2710c3;_0x513dbc['deadline']=moment(_0x2710c3)[_0xe8e7('0x17')](0x7,'days')[_0xe8e7('0x12')]();_0x513dbc[_0xe8e7('0x18')]=_0x513dbc[_0xe8e7('0x15')]!=_0x513dbc[_0xe8e7('0x16')]?_0xe8e7('0x19'):_0xe8e7('0x1a');}return _0x513dbc;}catch(_0xd3d94f){breakingLicense['uuid']=_0x4803bb['data1'];breakingLicense[_0xe8e7('0x1b')]=_0xd3d94f[_0xe8e7('0x1b')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x551d6e,_0x4b322a){getLicense()[_0xe8e7('0xb')](function(_0x935b6a){return db[_0xe8e7('0x1c')]['findAll']({'attributes':[_0xe8e7('0x1d'),[db['sequelize']['fn']('COUNT',db[_0xe8e7('0x1e')][_0xe8e7('0x1f')](_0xe8e7('0x1d'))),_0xe8e7('0x20')]],'group':_0xe8e7('0x1d'),'where':{'role':{'$or':[_0xe8e7('0x21'),_0xe8e7('0x22'),_0xe8e7('0x23')]}},'raw':!![]})[_0xe8e7('0xb')](function(_0x23c447){var _0x1631b2={'user':_0x935b6a[_0xe8e7('0x24')]||0x0,'telephone':_0x935b6a[_0xe8e7('0x25')]||0x0};_0x23c447[_0xe8e7('0x26')](function(_0x5c9f73){var _0x565f0e=_0x5c9f73['role']===_0xe8e7('0x21')?_0xe8e7('0x22'):_0x5c9f73[_0xe8e7('0x1d')];_0x1631b2[_0x565f0e]-=_0x5c9f73[_0xe8e7('0x20')];if(_0x1631b2[_0x565f0e]<0x0)_0x1631b2[_0x565f0e]=0x0;});_0x551d6e(_0x1631b2);return;});})[_0xe8e7('0xc')](function(_0x53eee5){_0x4b322a(_0x53eee5);});});}function checkUserLimits(_0x1453ab){return new BPromise(function(_0xd426af,_0x22e435){getLimits()[_0xe8e7('0xb')](function(_0x2873cc){var _0x681eec=_['pick'](_[_0xe8e7('0x27')](_0x1453ab,_0xe8e7('0x1d')),[_0xe8e7('0x21'),_0xe8e7('0x22'),'telephone']);var _0x28462e=(_0x681eec[_0xe8e7('0x21')]||0x0)+(_0x681eec[_0xe8e7('0x22')]||0x0);var _0x363a02=_0x681eec[_0xe8e7('0x23')]||0x0;if(_0x28462e>_0x2873cc[_0xe8e7('0x22')])return _0x22e435(_0xe8e7('0x28'));if(_0x363a02>_0x2873cc[_0xe8e7('0x23')])return _0x22e435('License\x20limit\x20reached\x20for\x20telephones');return _0xd426af();})[_0xe8e7('0xc')](function(_0x1fcc44){_0x22e435(_0x1fcc44);});});}module[_0xe8e7('0x29')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x07a0=['COUNT','col','count','admin','user','users','telephones','forEach','telephone','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','Breaking\x20license','License','defaults','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','%s:%s:%s','parse','demo','machineUuid','getUuid','gray','deadline','add','days','format','changed','disabled','message','findAll','role','sequelize'];(function(_0x2e3bfa,_0x49d245){var _0x5a5653=function(_0x10912c){while(--_0x10912c){_0x2e3bfa['push'](_0x2e3bfa['shift']());}};_0x5a5653(++_0x49d245);}(_0x07a0,0x101));var _0x007a=function(_0x2a5d53,_0x3c82c7){_0x2a5d53=_0x2a5d53-0x0;var _0x205d6b=_0x07a0[_0x2a5d53];return _0x205d6b;};'use strict';var util=require(_0x007a('0x0'));var _=require(_0x007a('0x1'));var moment=require(_0x007a('0x2'));var BPromise=require(_0x007a('0x3'));var hardware=require('./hardware');var encryptor=require(_0x007a('0x4'));var db=require(_0x007a('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x007a('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x007a('0x7'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x007a('0x8'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x2a7ed6){return new BPromise(function(_0x4fd2c8,_0x36e8b0){return db[_0x007a('0x9')]['find'](_[_0x007a('0xa')](_0x2a7ed6,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x5e8fd8){return checkLicense(_0x5e8fd8,null);})[_0x007a('0xb')](function(_0x7271a7){_0x4fd2c8(_0x7271a7);return;})[_0x007a('0xc')](function(_0x2e1f57){_0x36e8b0(_0x2e1f57);});});}function checkLicense(_0x3364e5,_0x2f82bc){if(!_0x3364e5){demoLicense[_0x007a('0xd')]=_0x3364e5[_0x007a('0xe')];return demoLicense;}try{var _0x34d888=_0x2f82bc||_0x3364e5[_0x007a('0xf')];if(_[_0x007a('0x10')](_0x34d888)){throw new Error(_0x007a('0x11'));}var _0x135dba=_0x3364e5[_0x007a('0xe')];var _0x4be28f=_0x3364e5[_0x007a('0x12')];var _0x2e5b05=_0x135dba[_0x007a('0x13')]('-')[0x4];var _0x1734f3=_0x135dba[_0x007a('0x13')]('-')[0x0];var _0x13b825=encryptor[_0x007a('0x14')](_0x34d888,util['format'](_0x007a('0x15'),_0x2e5b05,_0x135dba,_0x1734f3));var _0x47a953=JSON[_0x007a('0x16')](_0x13b825);_0x47a953[_0x007a('0x17')]=![];_0x47a953['uuid']=_0x135dba;_0x47a953[_0x007a('0x18')]=hardware[_0x007a('0x19')]();if(_0x4be28f){var _0x55d4b8=encryptor['decryptString'](_0x4be28f);_0x47a953[_0x007a('0x1a')]=_0x55d4b8;_0x47a953[_0x007a('0x1b')]=moment(_0x55d4b8)[_0x007a('0x1c')](0x7,_0x007a('0x1d'))[_0x007a('0x1e')]();_0x47a953['grayReason']=_0x47a953[_0x007a('0xd')]!=_0x47a953[_0x007a('0x18')]?_0x007a('0x1f'):_0x007a('0x20');}return _0x47a953;}catch(_0x40ec43){breakingLicense[_0x007a('0xd')]=_0x3364e5['data1'];breakingLicense[_0x007a('0x21')]=_0x40ec43[_0x007a('0x21')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x41b37e,_0x32938c){getLicense()[_0x007a('0xb')](function(_0x1dbcc8){return db['User'][_0x007a('0x22')]({'attributes':[_0x007a('0x23'),[db[_0x007a('0x24')]['fn'](_0x007a('0x25'),db[_0x007a('0x24')][_0x007a('0x26')](_0x007a('0x23'))),_0x007a('0x27')]],'group':_0x007a('0x23'),'where':{'role':{'$or':[_0x007a('0x28'),_0x007a('0x29'),'telephone']}},'raw':!![]})[_0x007a('0xb')](function(_0x37ab6e){var _0x29ede9={'user':_0x1dbcc8[_0x007a('0x2a')]||0x0,'telephone':_0x1dbcc8[_0x007a('0x2b')]||0x0};_0x37ab6e[_0x007a('0x2c')](function(_0x13e387){var _0x216bcd=_0x13e387[_0x007a('0x23')]===_0x007a('0x28')?_0x007a('0x29'):_0x13e387[_0x007a('0x23')];_0x29ede9[_0x216bcd]-=_0x13e387['count'];if(_0x29ede9[_0x216bcd]<0x0)_0x29ede9[_0x216bcd]=0x0;});_0x41b37e(_0x29ede9);return;});})[_0x007a('0xc')](function(_0x2ea928){_0x32938c(_0x2ea928);});});}function checkUserLimits(_0x210d9d){return new BPromise(function(_0x75a269,_0x39e201){getLimits()[_0x007a('0xb')](function(_0x10f9f5){var _0x200897=_['pick'](_['countBy'](_0x210d9d,'role'),[_0x007a('0x28'),_0x007a('0x29'),_0x007a('0x2d')]);var _0x50ce1f=(_0x200897[_0x007a('0x28')]||0x0)+(_0x200897[_0x007a('0x29')]||0x0);var _0x31644c=_0x200897[_0x007a('0x2d')]||0x0;if(_0x50ce1f>_0x10f9f5[_0x007a('0x29')])return _0x39e201(_0x007a('0x2e'));if(_0x31644c>_0x10f9f5[_0x007a('0x2d')])return _0x39e201(_0x007a('0x2f'));return _0x75a269();})[_0x007a('0xc')](function(_0x1d778a){_0x39e201(_0x1d778a);});});}module[_0x007a('0x30')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index f0e7ae7..a730ff4 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 _0x5f2f=['exports','http://localhost:9000','myappanuglar-secret','app-id','secret'];(function(_0x4f0e93,_0x212ef4){var _0xf1bc12=function(_0x52ef8f){while(--_0x52ef8f){_0x4f0e93['push'](_0x4f0e93['shift']());}};_0xf1bc12(++_0x212ef4);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3981af,_0x8d69ca){_0x3981af=_0x3981af-0x0;var _0x10a097=_0x5f2f[_0x3981af];return _0x10a097;};'use strict';module[_0xf5f2('0x0')]={'DOMAIN':_0xf5f2('0x1'),'SESSION_SECRET':_0xf5f2('0x2'),'GOOGLE_ID':_0xf5f2('0x3'),'GOOGLE_SECRET':_0xf5f2('0x4'),'DEBUG':''}; \ No newline at end of file +var _0x0120=['secret','exports','http://localhost:9000','myappanuglar-secret','app-id'];(function(_0x11dfbc,_0xc311ba){var _0x5a374d=function(_0x1a64cb){while(--_0x1a64cb){_0x11dfbc['push'](_0x11dfbc['shift']());}};_0x5a374d(++_0xc311ba);}(_0x0120,0x6f));var _0x0012=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x0120[_0x580576];return _0x3f55a0;};'use strict';module[_0x0012('0x0')]={'DOMAIN':_0x0012('0x1'),'SESSION_SECRET':_0x0012('0x2'),'GOOGLE_ID':_0x0012('0x3'),'GOOGLE_SECRET':_0x0012('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 0449a38..35f522a 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xacc7=['xcally','format','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','exports','Logger','transports','File','%s-%s','error','info','Console','env','debugLevel','moment','winston','path','INFO','join','/var','log'];(function(_0x4fa360,_0x13dfa6){var _0x35845b=function(_0x8f7423){while(--_0x8f7423){_0x4fa360['push'](_0x4fa360['shift']());}};_0x35845b(++_0x13dfa6);}(_0xacc7,0x122));var _0x7acc=function(_0x491082,_0x28f78b){_0x491082=_0x491082-0x0;var _0x5797d9=_0xacc7[_0x491082];return _0x5797d9;};'use strict';var moment=require(_0x7acc('0x0'));var winston=require(_0x7acc('0x1'));var util=require('util');var path=require(_0x7acc('0x2'));var debugLevel=_0x7acc('0x3');function filename(_0xe47ff5,_0x4dc532){return path[_0x7acc('0x4')](_0x7acc('0x5'),_0x7acc('0x6'),_0x7acc('0x7'),util[_0x7acc('0x8')]('%s-%s.log',_0xe47ff5,_0x4dc532));}function formatter(_0x376a6a,_0x11e636){_0x11e636[_0x7acc('0x9')]=_0x11e636['message'][_0x7acc('0xa')](/@@{/g,_0x7acc('0xb'))[_0x7acc('0xa')](/}@@/g,_0x7acc('0xc'))[_0x7acc('0xa')](/@{/g,'{{')[_0x7acc('0xa')](/}@/g,'}}');return util[_0x7acc('0x8')](_0x7acc('0xd'),moment()[_0x7acc('0x8')](_0x7acc('0xe')),_0x11e636[_0x7acc('0xf')][_0x7acc('0x10')](),_0x376a6a,_0x11e636[_0x7acc('0x9')]);}module[_0x7acc('0x11')]=function(_0x31e923){return new winston[(_0x7acc('0x12'))]({'transports':[new winston[(_0x7acc('0x13'))][(_0x7acc('0x14'))]({'name':util['format'](_0x7acc('0x15'),_0x31e923,_0x7acc('0x16')),'filename':filename(_0x31e923,_0x7acc('0x16')),'level':_0x7acc('0x16'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x18de7b){return formatter(_0x31e923,_0x18de7b);}}),new winston[(_0x7acc('0x13'))][(_0x7acc('0x14'))]({'name':util[_0x7acc('0x8')](_0x7acc('0x15'),_0x31e923,_0x7acc('0x17')),'filename':filename(_0x31e923,_0x7acc('0x17')),'level':_0x7acc('0x17'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4631b7){return formatter(_0x31e923,_0x4631b7);}}),new winston[(_0x7acc('0x13'))][(_0x7acc('0x18'))]({'level':process[_0x7acc('0x19')][_0x7acc('0x1a')]||debugLevel,'json':![],'formatter':function(_0x4465ae){return formatter(_0x31e923,_0x4465ae);}})]});}; \ No newline at end of file +var _0x6c81=['Logger','transports','File','%s-%s','error','info','Console','env','moment','winston','util','path','INFO','join','/var','log','xcally','format','%s-%s.log','message','replace','{{{','}}}','YYYY-MM-DD\x20HH:mm:ss','level','exports'];(function(_0x2a123a,_0x1982ef){var _0x3ee4f0=function(_0x34d4e4){while(--_0x34d4e4){_0x2a123a['push'](_0x2a123a['shift']());}};_0x3ee4f0(++_0x1982ef);}(_0x6c81,0x10c));var _0x16c8=function(_0x4c4664,_0x506a85){_0x4c4664=_0x4c4664-0x0;var _0x2920cf=_0x6c81[_0x4c4664];return _0x2920cf;};'use strict';var moment=require(_0x16c8('0x0'));var winston=require(_0x16c8('0x1'));var util=require(_0x16c8('0x2'));var path=require(_0x16c8('0x3'));var debugLevel=_0x16c8('0x4');function filename(_0x1e683d,_0x5e984e){return path[_0x16c8('0x5')](_0x16c8('0x6'),_0x16c8('0x7'),_0x16c8('0x8'),util[_0x16c8('0x9')](_0x16c8('0xa'),_0x1e683d,_0x5e984e));}function formatter(_0x263299,_0x46a036){_0x46a036[_0x16c8('0xb')]=_0x46a036[_0x16c8('0xb')][_0x16c8('0xc')](/@@{/g,_0x16c8('0xd'))[_0x16c8('0xc')](/}@@/g,_0x16c8('0xe'))[_0x16c8('0xc')](/@{/g,'{{')[_0x16c8('0xc')](/}@/g,'}}');return util[_0x16c8('0x9')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x16c8('0x9')](_0x16c8('0xf')),_0x46a036[_0x16c8('0x10')]['toUpperCase'](),_0x263299,_0x46a036['message']);}module[_0x16c8('0x11')]=function(_0x59ef87){return new winston[(_0x16c8('0x12'))]({'transports':[new winston[(_0x16c8('0x13'))][(_0x16c8('0x14'))]({'name':util[_0x16c8('0x9')](_0x16c8('0x15'),_0x59ef87,'error'),'filename':filename(_0x59ef87,_0x16c8('0x16')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xb2bab8){return formatter(_0x59ef87,_0xb2bab8);}}),new winston[(_0x16c8('0x13'))]['File']({'name':util[_0x16c8('0x9')](_0x16c8('0x15'),_0x59ef87,'info'),'filename':filename(_0x59ef87,_0x16c8('0x17')),'level':_0x16c8('0x17'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1c2894){return formatter(_0x59ef87,_0x1c2894);}}),new winston[(_0x16c8('0x13'))][(_0x16c8('0x18'))]({'level':process[_0x16c8('0x19')]['debugLevel']||debugLevel,'json':![],'formatter':function(_0x40443f){return formatter(_0x59ef87,_0x40443f);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index fb7574b..bf4c77f 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 _0xe971=['../../services/email/index.js','routing','../../services/routing/index.js','xdr','exports','../../services/express/index.js','ami','join','../../services/ami/index.js','agi','../../services/agi/index.js','email'];(function(_0x3bfc2f,_0x434366){var _0x5bc30e=function(_0x28eb31){while(--_0x28eb31){_0x3bfc2f['push'](_0x3bfc2f['shift']());}};_0x5bc30e(++_0x434366);}(_0xe971,0x7d));var _0x1e97=function(_0x28f403,_0x36d287){_0x28f403=_0x28f403-0x0;var _0x384ab0=_0xe971[_0x28f403];return _0x384ab0;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':'express','script':path['join'](__dirname,_0x1e97('0x0'))},{'name':_0x1e97('0x1'),'script':path[_0x1e97('0x2')](__dirname,_0x1e97('0x3'))},{'name':_0x1e97('0x4'),'script':path[_0x1e97('0x2')](__dirname,_0x1e97('0x5'))},{'name':_0x1e97('0x6'),'script':path[_0x1e97('0x2')](__dirname,_0x1e97('0x7'))},{'name':_0x1e97('0x8'),'script':path['join'](__dirname,_0x1e97('0x9'))},{'name':_0x1e97('0xa'),'script':path['join'](__dirname,'../../services/xdr/index.js')}]};module[_0x1e97('0xb')]=config; \ No newline at end of file +var _0x280b=['routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','join','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x280b,0x18b));var _0xb280=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x280b[_0x19e35c];return _0x3e1fe8;};'use strict';var path=require(_0xb280('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path[_0xb280('0x1')](__dirname,_0xb280('0x2'))},{'name':_0xb280('0x3'),'script':path[_0xb280('0x1')](__dirname,_0xb280('0x4'))},{'name':_0xb280('0x5'),'script':path[_0xb280('0x1')](__dirname,_0xb280('0x6'))},{'name':_0xb280('0x7'),'script':path[_0xb280('0x1')](__dirname,'../../services/email/index.js')},{'name':_0xb280('0x8'),'script':path[_0xb280('0x1')](__dirname,_0xb280('0x9'))},{'name':_0xb280('0xa'),'script':path[_0xb280('0x1')](__dirname,_0xb280('0xb'))}]};module[_0xb280('0xc')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 3477551..5ef8535 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 _0xc19e=['describe','delete','dump','bluebird','./config','connect','connected','start','then','stop','disconnect','restart'];(function(_0x898b83,_0x17bd0e){var _0x1a1a32=function(_0x210a59){while(--_0x210a59){_0x898b83['push'](_0x898b83['shift']());}};_0x1a1a32(++_0x17bd0e);}(_0xc19e,0x13b));var _0xec19=function(_0x1da02e,_0x510ace){_0x1da02e=_0x1da02e-0x0;var _0x84d5a0=_0xc19e[_0x1da02e];return _0x84d5a0;};'use strict';var pm2=require('pm2');var BPromise=require(_0xec19('0x0'));var config=require(_0xec19('0x1'));function connect(){return new BPromise(function(_0x24a980,_0x36d318){return pm2[_0xec19('0x2')](function(_0x3940bd){if(_0x3940bd){return _0x36d318(_0x3940bd);}return _0x24a980(_0xec19('0x3'));});});};exports[_0xec19('0x4')]=function(_0x2a519b){return connect()[_0xec19('0x5')](function(){return new BPromise(function(_0x348381,_0x3fa30a){return pm2[_0xec19('0x4')](_0x2a519b,function(_0xcb3a24,_0x538040){if(_0xcb3a24){return _0x3fa30a(_0xcb3a24);}pm2['disconnect']();return _0x348381(_0x538040);});});});};exports['stop']=function(_0x4c8720){return connect()[_0xec19('0x5')](function(){return new BPromise(function(_0x52f6bf,_0x41e46c){return pm2[_0xec19('0x6')](_0x4c8720,function(_0x77e68a,_0x33e27b){if(_0x77e68a){return _0x41e46c(_0x77e68a);}pm2[_0xec19('0x7')]();return _0x52f6bf(_0x33e27b);});});});};exports[_0xec19('0x8')]=function(_0x575b2e){return connect()[_0xec19('0x5')](function(){return new BPromise(function(_0x1dfe75,_0xf30500){return pm2[_0xec19('0x8')](_0x575b2e,function(_0xf2e85e,_0x5b7518){if(_0xf2e85e){return _0xf30500(_0xf2e85e);}pm2[_0xec19('0x7')]();return _0x1dfe75(_0x5b7518);});});});};exports['list']=function(){return connect()[_0xec19('0x5')](function(){return new BPromise(function(_0x20cd63,_0x39da95){return pm2['list'](function(_0x5ac02e,_0x4f0c0a){if(_0x5ac02e){return _0x39da95(_0x5ac02e);}pm2[_0xec19('0x7')]();return _0x20cd63(_0x4f0c0a);});});});};exports[_0xec19('0x9')]=function(_0x768e9e){return connect()['then'](function(){return new BPromise(function(_0x3fa032,_0x33608d){return pm2[_0xec19('0x9')](_0x768e9e,function(_0x5319cb,_0x29afbb){if(_0x5319cb){return _0x33608d(_0x5319cb);}pm2[_0xec19('0x7')]();return _0x3fa032(_0x29afbb);});});});};exports[_0xec19('0xa')]=function(_0x1f14e8){return connect()[_0xec19('0x5')](function(){return new BPromise(function(_0x513708,_0x530b66){return pm2[_0xec19('0xa')](_0x1f14e8,function(_0x4abb8e,_0x481364){if(_0x4abb8e){return _0x530b66(_0x4abb8e);}pm2['disconnect']();return _0x513708(_0x481364);});});});};exports[_0xec19('0xb')]=function(){return connect()['then'](function(){return new BPromise(function(_0x9e4002,_0x435074){return pm2[_0xec19('0xb')](function(_0x159c3a){if(_0x159c3a){return _0x435074(_0x159c3a);}return _0x9e4002('saved');});});});}; \ No newline at end of file +var _0x8bd1=['saved','pm2','./config','connect','connected','then','start','disconnect','stop','restart','list','describe','delete','dump'];(function(_0xe88a16,_0x404b8d){var _0x1611fa=function(_0x54a690){while(--_0x54a690){_0xe88a16['push'](_0xe88a16['shift']());}};_0x1611fa(++_0x404b8d);}(_0x8bd1,0x197));var _0x18bd=function(_0xc8778c,_0x2958a8){_0xc8778c=_0xc8778c-0x0;var _0x2c95aa=_0x8bd1[_0xc8778c];return _0x2c95aa;};'use strict';var pm2=require(_0x18bd('0x0'));var BPromise=require('bluebird');var config=require(_0x18bd('0x1'));function connect(){return new BPromise(function(_0x59a3e8,_0x2e8e83){return pm2[_0x18bd('0x2')](function(_0x2c3bac){if(_0x2c3bac){return _0x2e8e83(_0x2c3bac);}return _0x59a3e8(_0x18bd('0x3'));});});};exports['start']=function(_0x1e4fd1){return connect()[_0x18bd('0x4')](function(){return new BPromise(function(_0x1254e4,_0x317f86){return pm2[_0x18bd('0x5')](_0x1e4fd1,function(_0x1450f4,_0x1a4351){if(_0x1450f4){return _0x317f86(_0x1450f4);}pm2[_0x18bd('0x6')]();return _0x1254e4(_0x1a4351);});});});};exports['stop']=function(_0x117ef1){return connect()['then'](function(){return new BPromise(function(_0xc790ba,_0x280719){return pm2[_0x18bd('0x7')](_0x117ef1,function(_0xd5f90d,_0x2b8a38){if(_0xd5f90d){return _0x280719(_0xd5f90d);}pm2[_0x18bd('0x6')]();return _0xc790ba(_0x2b8a38);});});});};exports[_0x18bd('0x8')]=function(_0x5cf9d4){return connect()[_0x18bd('0x4')](function(){return new BPromise(function(_0x4b8b42,_0x4e7699){return pm2[_0x18bd('0x8')](_0x5cf9d4,function(_0x361459,_0x14c77e){if(_0x361459){return _0x4e7699(_0x361459);}pm2[_0x18bd('0x6')]();return _0x4b8b42(_0x14c77e);});});});};exports['list']=function(){return connect()[_0x18bd('0x4')](function(){return new BPromise(function(_0x327999,_0x422ce5){return pm2[_0x18bd('0x9')](function(_0x2eb8af,_0x3a8cd7){if(_0x2eb8af){return _0x422ce5(_0x2eb8af);}pm2[_0x18bd('0x6')]();return _0x327999(_0x3a8cd7);});});});};exports[_0x18bd('0xa')]=function(_0x530e20){return connect()['then'](function(){return new BPromise(function(_0xff9c05,_0x5bd001){return pm2[_0x18bd('0xa')](_0x530e20,function(_0x1c8a2b,_0x1d0e20){if(_0x1c8a2b){return _0x5bd001(_0x1c8a2b);}pm2['disconnect']();return _0xff9c05(_0x1d0e20);});});});};exports[_0x18bd('0xb')]=function(_0x48c8ce){return connect()[_0x18bd('0x4')](function(){return new BPromise(function(_0x19acc5,_0x30b82c){return pm2['delete'](_0x48c8ce,function(_0xda35c3,_0x51b67d){if(_0xda35c3){return _0x30b82c(_0xda35c3);}pm2[_0x18bd('0x6')]();return _0x19acc5(_0x51b67d);});});});};exports[_0x18bd('0xc')]=function(){return connect()[_0x18bd('0x4')](function(){return new BPromise(function(_0x4accc8,_0x283de5){return pm2['dump'](function(_0x59d4b4){if(_0x59d4b4){return _0x283de5(_0x59d4b4);}return _0x4accc8(_0x18bd('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index c57d0f7..1ef4698 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 _0xd863=['length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','defaults','redis','localhost','socket.io-emitter','Setting','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract'];(function(_0x4c5f3e,_0x3c6f97){var _0x31ca51=function(_0x110c29){while(--_0x110c29){_0x4c5f3e['push'](_0x4c5f3e['shift']());}};_0x31ca51(++_0x3c6f97);}(_0xd863,0x1ce));var _0x3d86=function(_0x2e4a04,_0x2e8ee6){_0x2e4a04=_0x2e4a04-0x0;var _0x139b44=_0xd863[_0x2e4a04];return _0x139b44;};'use strict';var _=require(_0x3d86('0x0'));var moment=require(_0x3d86('0x1'));var Redis=require(_0x3d86('0x2'));var util=require(_0x3d86('0x3'));var config=require(_0x3d86('0x4'));var db=require(_0x3d86('0x5'))['db'];var logger=require(_0x3d86('0x6'))('schedule');config['redis']=_[_0x3d86('0x7')](config[_0x3d86('0x8')],{'host':_0x3d86('0x9'),'port':0x18eb});var io=require(_0x3d86('0xa'))(new Redis(config[_0x3d86('0x8')]));function closeInteractions(){var _0xf83f58=0x0;var _0x105f73=[];return db[_0x3d86('0xb')]['find']({'raw':!![],'attributes':['id',_0x3d86('0xc')],'where':{'id':0x1}})[_0x3d86('0xd')](function(_0x45c657){_0xf83f58=_0x45c657[_0x3d86('0xc')];if(_0xf83f58){return db[_0x3d86('0xe')][_0x3d86('0xf')]({'raw':!![],'attributes':['id',_0x3d86('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x3d86('0x11')](_0x45c657[_0x3d86('0xc')],'minutes')}}});}else{return[];}})['then'](function(_0x2546f2){if(_0x2546f2&&_0x2546f2[_0x3d86('0x12')]){_0x105f73=_[_0x3d86('0x13')](_0x2546f2||[],'id');logger[_0x3d86('0x14')](_0x3d86('0x15'),_0x105f73[_0x3d86('0x16')]());return db['ChatInteraction'][_0x3d86('0x17')]({'closeReason':'system','disposition':'timeout','closed':!![],'closedAt':moment()[_0x3d86('0x18')](_0x3d86('0x19'))},{'where':{'id':_0x105f73}});}})['then'](function(){if(_0x105f73&&_0x105f73['length']){logger[_0x3d86('0x14')](_0x3d86('0x1a'),_0x105f73['join']());for(var _0x3b4de7=0x0;_0x3b4de7<_0x105f73[_0x3d86('0x12')];_0x3b4de7++){io[_0x3d86('0x1b')](_0x3d86('0x1c'),{'id':_0x105f73[_0x3b4de7],'closed':!![]});}}})[_0x3d86('0x1d')](function(_0x1a9707){logger[_0x3d86('0x1e')]('[CHAT]\x20Error\x20closing\x20interactions',_0x1a9707?util['inspect'](_0x1a9707,{'showHidden':![],'depth':null}):'');});}exports[_0x3d86('0x1f')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x78ff=['chatInteraction:update','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','socket.io-emitter','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:'];(function(_0x3d905,_0x7b688d){var _0x3a990b=function(_0x5b79a6){while(--_0x5b79a6){_0x3d905['push'](_0x3d905['shift']());}};_0x3a990b(++_0x7b688d);}(_0x78ff,0x186));var _0xf78f=function(_0x30967f,_0x2f27d4){_0x30967f=_0x30967f-0x0;var _0x3ed03b=_0x78ff[_0x30967f];return _0x3ed03b;};'use strict';var _=require(_0xf78f('0x0'));var moment=require(_0xf78f('0x1'));var Redis=require(_0xf78f('0x2'));var util=require(_0xf78f('0x3'));var config=require(_0xf78f('0x4'));var db=require(_0xf78f('0x5'))['db'];var logger=require(_0xf78f('0x6'))(_0xf78f('0x7'));config[_0xf78f('0x8')]=_[_0xf78f('0x9')](config[_0xf78f('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xf78f('0xa'))(new Redis(config[_0xf78f('0x8')]));function closeInteractions(){var _0x32d2a1=0x0;var _0x24d502=[];return db['Setting'][_0xf78f('0xb')]({'raw':!![],'attributes':['id',_0xf78f('0xc')],'where':{'id':0x1}})[_0xf78f('0xd')](function(_0x2a739e){_0x32d2a1=_0x2a739e[_0xf78f('0xc')];if(_0x32d2a1){return db[_0xf78f('0xe')][_0xf78f('0xf')]({'raw':!![],'attributes':['id',_0xf78f('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xf78f('0x11')](_0x2a739e['chatTimeout'],_0xf78f('0x12'))}}});}else{return[];}})['then'](function(_0x31c99e){if(_0x31c99e&&_0x31c99e[_0xf78f('0x13')]){_0x24d502=_[_0xf78f('0x14')](_0x31c99e||[],'id');logger[_0xf78f('0x15')](_0xf78f('0x16'),_0x24d502[_0xf78f('0x17')]());return db['ChatInteraction'][_0xf78f('0x18')]({'closeReason':_0xf78f('0x19'),'disposition':_0xf78f('0x1a'),'closed':!![],'closedAt':moment()[_0xf78f('0x1b')](_0xf78f('0x1c'))},{'where':{'id':_0x24d502}});}})[_0xf78f('0xd')](function(){if(_0x24d502&&_0x24d502[_0xf78f('0x13')]){logger[_0xf78f('0x15')](_0xf78f('0x1d'),_0x24d502[_0xf78f('0x17')]());for(var _0x35a941=0x0;_0x35a941<_0x24d502['length'];_0x35a941++){io['emit'](_0xf78f('0x1e'),{'id':_0x24d502[_0x35a941],'closed':!![]});}}})['catch'](function(_0x55350b){logger[_0xf78f('0x1f')](_0xf78f('0x20'),_0x55350b?util[_0xf78f('0x21')](_0x55350b,{'showHidden':![],'depth':null}):'');});}exports[_0xf78f('0x22')]=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 2f5c0c0..62b65eb 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 _0xbed1=['http','info','email','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','pass','format','\x22%s\x22\x20<%s>','name','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','%s.%s','basename','extname','status','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','text','sendIfEmpty','request','SendMail','then','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','exec\x20custom\x20report\x20id:%s','CustomReportId','Schedule','findAll','MailServerOut','keys','map','keyBy','difference','length','toString','exists','stop','deleteJob','toRun','run\x20job','cron','active','isBetween','startAt','endAt','add','add\x20cron','stop\x20cron','update','update\x20cron','run','lodash','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','client'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0xbed1,0x148));var _0x1bed=function(_0x188703,_0x596b26){_0x188703=_0x188703-0x0;var _0x1a0c81=_0xbed1[_0x188703];return _0x1a0c81;};'use strict';var fs=require('fs');var util=require('util');var path=require('path');var _=require(_0x1bed('0x0'));var moment=require('moment');var CronJobManager=require(_0x1bed('0x1'));var jayson=require(_0x1bed('0x2'));var BPromise=require(_0x1bed('0x3'));var logger=require(_0x1bed('0x4'))(_0x1bed('0x5'));var db=require(_0x1bed('0x6'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x1bed('0x7')][_0x1bed('0x8')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0xe5b278,_0xe160a9){return function(){logger[_0x1bed('0x9')]('Try\x20to\x20send\x20a\x20mail\x20to',_0xe5b278[_0x1bed('0xa')]);var _0x3a9700=!![];var _0x13e806={'tls':{'rejectUnauthorized':![]}};if(_0xe5b278[_0x1bed('0xb')][_0x1bed('0xc')][_0x1bed('0xd')]){_0x13e806[_0x1bed('0xd')]=_0xe5b278[_0x1bed('0xb')]['Smtp'][_0x1bed('0xd')];}else{_0x13e806['host']=_0xe5b278['MailAccount'][_0x1bed('0xc')][_0x1bed('0xe')];_0x13e806['port']=_0xe5b278[_0x1bed('0xb')][_0x1bed('0xc')][_0x1bed('0xf')];_0x13e806[_0x1bed('0x10')]=_0xe5b278[_0x1bed('0xb')]['Smtp']['secure'];}if(_0xe5b278[_0x1bed('0xb')][_0x1bed('0xc')][_0x1bed('0x11')]){_0x13e806[_0x1bed('0x12')]={'user':_0xe5b278[_0x1bed('0xb')][_0x1bed('0xc')][_0x1bed('0x13')],'pass':_0xe5b278[_0x1bed('0xb')][_0x1bed('0xc')][_0x1bed('0x14')]};}var _0x191992={'account':_0x13e806,'message':{'from':util[_0x1bed('0x15')](_0x1bed('0x16'),_0xe5b278[_0x1bed('0xb')][_0x1bed('0x17')],_0xe5b278['MailAccount'][_0x1bed('0xa')]||_0xe5b278['MailAccount'][_0x1bed('0xc')]['user']),'to':_0xe5b278[_0x1bed('0xa')],'cc':_0xe5b278['cc'],'bcc':_0xe5b278[_0x1bed('0x18')],'subject':util[_0x1bed('0x15')](_0x1bed('0x19'),_0xe160a9[_0x1bed('0x17')],_0xe5b278[_0x1bed('0x1a')],_0xe5b278[_0x1bed('0x1b')])}};var _0x2ce002=path[_0x1bed('0x1c')](__dirname,_0x1bed('0x1d'));var _0x3fa95c=_0xe160a9['savename'];var _0x1ef6d9=util[_0x1bed('0x15')](_0x1bed('0x1e'),path[_0x1bed('0x1f')](_0xe160a9['savename'],path[_0x1bed('0x20')](_0xe160a9['savename'])),'zip');var _0x2c405c=path['join'](_0x2ce002,_0x3fa95c);var _0x7943df=path[_0x1bed('0x1c')](_0x2ce002,_0x1ef6d9);if(fs['existsSync'](_0x2c405c)){_0xe160a9[_0x1bed('0x21')]='Sent';_0x191992[_0x1bed('0x22')][_0x1bed('0x23')]=[{'filename':_0x3fa95c,'path':_0x2c405c}];_0x191992[_0x1bed('0x22')]['text']=util[_0x1bed('0x15')](_0x1bed('0x24'),JSON[_0x1bed('0x25')](_0xe160a9,null,0x2));}else if(fs['existsSync'](_0x7943df)){_0xe160a9['status']='Sent';_0x191992['message'][_0x1bed('0x23')]=[{'filename':_0x1ef6d9,'path':_0x7943df}];}else{_0x191992['message'][_0x1bed('0x26')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0xe5b278[_0x1bed('0x27')]){_0x3a9700=![];logger[_0x1bed('0x9')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x3a9700){return client[_0x1bed('0x28')](_0x1bed('0x29'),_0x191992)[_0x1bed('0x2a')](function(_0x3d8b9a){if(_0x3d8b9a[_0x1bed('0x2b')]){return logger['error'](_0x1bed('0x2c'),JSON[_0x1bed('0x25')](_0x3d8b9a));}return logger['info'](_0x1bed('0x2d'));})[_0x1bed('0x2e')](function(_0x412901){return logger[_0x1bed('0x2b')](_0x1bed('0x2c'),JSON[_0x1bed('0x25')](_0x412901));});}};}function handleError(){return function(_0x462a2e){return logger[_0x1bed('0x2b')](JSON[_0x1bed('0x25')](_0x462a2e));};}function handleResult(_0x3657b9){return function(_0x19b37b){logger[_0x1bed('0x9')](_0x1bed('0x2f'),JSON['stringify'](_0x19b37b));if(_0x3657b9[_0x1bed('0xb')]&&_0x3657b9[_0x1bed('0xb')]['Smtp']&&!_[_0x1bed('0x30')](_0x3657b9['email'])){setTimeout(handleSendEmail(_0x3657b9,_0x19b37b),0x3c*0x3e8);}};}function handleJob(_0x1e8292){return function(){try{if(_[_0x1bed('0x30')](_0x1e8292[_0x1bed('0x1a')])){return logger[_0x1bed('0x9')](_0x1bed('0x31'));}if(_['isNil'](_0x1e8292['subtractUnit'])){return logger[_0x1bed('0x9')](_0x1bed('0x32'));}var _0x9303e5={'startDate':moment()['subtract'](_0x1e8292['subtractNumber'],_0x1e8292['subtractUnit'])['format'](_0x1bed('0x33')),'endDate':moment()[_0x1bed('0x15')](_0x1bed('0x33')),'type':_0x1bed('0x34'),'output':_0x1e8292[_0x1bed('0x35')],'name':_0x1e8292[_0x1bed('0x17')]};if(!_[_0x1bed('0x30')](_0x1e8292[_0x1bed('0x36')])){logger[_0x1bed('0x9')](_0x1bed('0x37'),_0x1e8292['DefaultReportId']);return analyticDefaultReportController[_0x1bed('0x38')]({'id':_0x1e8292[_0x1bed('0x36')]},_0x9303e5)[_0x1bed('0x2a')](handleResult(_0x1e8292))[_0x1bed('0x2e')](handleError());}if(!_[_0x1bed('0x30')](_0x1e8292['CustomReportId'])){logger[_0x1bed('0x9')](_0x1bed('0x39'),_0x1e8292[_0x1bed('0x3a')]);return analyticCustomReportController[_0x1bed('0x38')]({'id':_0x1e8292[_0x1bed('0x3a')]},_0x9303e5)['then'](handleResult(_0x1e8292))['catch'](handleError());}}catch(_0x4ac6a4){logger['error'](JSON[_0x1bed('0x25')](_0x4ac6a4));}return logger[_0x1bed('0x9')]('no\x20report\x20id');};}function getJobs(_0xc309bb){var _0x554493={};if(_0xc309bb){_0x554493['id']=_0xc309bb;}return db[_0x1bed('0x3b')][_0x1bed('0x3c')]({'where':_0x554493,'include':[{'model':db[_0x1bed('0xb')],'attributes':['id',_0x1bed('0x17'),'email'],'include':[{'model':db[_0x1bed('0x3d')],'as':'Smtp'}]}]})['then'](function(_0xc871b2){var _0x542690=_[_0x1bed('0x3e')](manager['jobs']);var _0x4bfd09=_[_0x1bed('0x3f')](_0xc871b2,function(_0x3a43ea){return _0x3a43ea['id']['toString']();});var _0x1f3e61=_[_0x1bed('0x40')](_0xc871b2,function(_0x9a493b){return _0x9a493b['id']['toString']();});var _0x10d77b=_0xc309bb?_0x4bfd09:_[_0x1bed('0x41')](_0x4bfd09,_0x542690);var _0xc88d7a=_['intersection'](_0x4bfd09,_0x542690);var _0x10fa4e=_['difference'](_0x542690,_0x4bfd09);var _0x4dd9f5;var _0x275a98;for(_0x4dd9f5=0x0;_0x4dd9f5<_0x10fa4e[_0x1bed('0x42')]&&!_0xc309bb;_0x4dd9f5+=0x1){_0x275a98=_0x10fa4e[_0x4dd9f5][_0x1bed('0x43')]();if(manager[_0x1bed('0x44')](_0x275a98)){manager[_0x1bed('0x45')](_0x275a98);manager[_0x1bed('0x46')](_0x275a98);logger['info']('delete\x20cron',_0x275a98);}}logger[_0x1bed('0x9')](_0x1bed('0x47'),JSON[_0x1bed('0x25')](_0x10d77b));for(_0x4dd9f5=0x0;_0x4dd9f5<_0x10d77b[_0x1bed('0x42')];_0x4dd9f5+=0x1){_0x275a98=_0x10d77b[_0x4dd9f5][_0x1bed('0x43')]();logger['info']('index',_0x275a98);if(_0xc309bb){logger['info']('my\x20id',_0xc309bb);logger['info'](JSON['stringify'](_0x1f3e61[_0x275a98]));BPromise['resolve']()[_0x1bed('0x2a')](handleJob(_0x1f3e61[_0x275a98]));logger['info'](_0x1bed('0x48'),_0x1f3e61[_0x275a98][_0x1bed('0x17')],_0x1f3e61[_0x275a98][_0x1bed('0x49')]);}else if(_0x1f3e61[_0x275a98][_0x1bed('0x49')]&&_0x1f3e61[_0x275a98][_0x1bed('0x4a')]&&moment()[_0x1bed('0x4b')](_0x1f3e61[_0x275a98][_0x1bed('0x4c')],_0x1f3e61[_0x275a98][_0x1bed('0x4d')])){manager[_0x1bed('0x4e')](_0x275a98,_0x1f3e61[_0x275a98][_0x1bed('0x49')],handleJob(_0x1f3e61[_0x275a98]));manager['start'](_0x275a98);logger[_0x1bed('0x9')](_0x1bed('0x4f'),_0x1f3e61[_0x275a98][_0x1bed('0x17')],_0x1f3e61[_0x275a98]['cron']);}else if(manager[_0x1bed('0x44')](_0x275a98)){manager[_0x1bed('0x45')](_0x275a98);manager[_0x1bed('0x46')](_0x275a98);logger[_0x1bed('0x9')](_0x1bed('0x50'),_0x1f3e61[_0x275a98]['name'],_0x1f3e61[_0x275a98][_0x1bed('0x49')]);}}for(_0x4dd9f5=0x0,_0x275a98;_0x4dd9f5<_0xc88d7a[_0x1bed('0x42')]&&!_0xc309bb;_0x4dd9f5+=0x1){_0x275a98=_0xc88d7a[_0x4dd9f5][_0x1bed('0x43')]();if(manager[_0x1bed('0x44')](_0x275a98)){if(_0x1f3e61[_0x275a98][_0x1bed('0x49')]&&_0x1f3e61[_0x275a98][_0x1bed('0x4a')]&&moment()[_0x1bed('0x4b')](_0x1f3e61[_0x275a98]['startAt'],_0x1f3e61[_0x275a98][_0x1bed('0x4d')])){manager[_0x1bed('0x51')](_0x275a98,_0x1f3e61[_0x275a98][_0x1bed('0x49')],handleJob(_0x1f3e61[_0x275a98]));logger[_0x1bed('0x9')](_0x1bed('0x52'),_0x1f3e61[_0x275a98][_0x1bed('0x17')],_0x1f3e61[_0x275a98]['cron']);}else{manager[_0x1bed('0x45')](_0x275a98);manager[_0x1bed('0x46')](_0x275a98);logger['info'](_0x1bed('0x50'),_0x1f3e61[_0x275a98][_0x1bed('0x17')],_0x1f3e61[_0x275a98][_0x1bed('0x49')]);}}}})[_0x1bed('0x2e')](function(_0x3b1e08){logger[_0x1bed('0x2b')](JSON[_0x1bed('0x25')](_0x3b1e08));});}exports[_0x1bed('0x53')]=function(_0x1096b7){return getJobs(_0x1096b7);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x1a51=['exists','stop\x20cron','update','run','path','lodash','moment','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','format','name','subtractNumber','subtractUnit','join','savename','%s.%s','basename','extname','existsSync','status','Sent','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','request','SendMail','then','error','error\x20mail','stringify','catch','data','isNil','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','Schedule','findAll','keys','jobs','map','toString','keyBy','difference','intersection','length','stop','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','start','add\x20cron'];(function(_0x63c7ae,_0x1b7e20){var _0x434c9b=function(_0x399fc6){while(--_0x399fc6){_0x63c7ae['push'](_0x63c7ae['shift']());}};_0x434c9b(++_0x1b7e20);}(_0x1a51,0x112));var _0x11a5=function(_0xeae11a,_0x94e239){_0xeae11a=_0xeae11a-0x0;var _0x45c252=_0x1a51[_0xeae11a];return _0x45c252;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x11a5('0x0'));var _=require(_0x11a5('0x1'));var moment=require(_0x11a5('0x2'));var CronJobManager=require('cron-job-manager');var jayson=require(_0x11a5('0x3'));var BPromise=require(_0x11a5('0x4'));var logger=require(_0x11a5('0x5'))(_0x11a5('0x6'));var db=require(_0x11a5('0x7'))['db'];var analyticCustomReportController=require(_0x11a5('0x8'));var analyticDefaultReportController=require(_0x11a5('0x9'));var client=jayson[_0x11a5('0xa')][_0x11a5('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x4e0952,_0x3e01fa){return function(){logger['info'](_0x11a5('0xc'),_0x4e0952[_0x11a5('0xd')]);var _0x4aa667=!![];var _0x2756a3={'tls':{'rejectUnauthorized':![]}};if(_0x4e0952[_0x11a5('0xe')][_0x11a5('0xf')]['service']){_0x2756a3[_0x11a5('0x10')]=_0x4e0952[_0x11a5('0xe')][_0x11a5('0xf')][_0x11a5('0x10')];}else{_0x2756a3[_0x11a5('0x11')]=_0x4e0952[_0x11a5('0xe')][_0x11a5('0xf')]['host'];_0x2756a3['port']=_0x4e0952[_0x11a5('0xe')][_0x11a5('0xf')][_0x11a5('0x12')];_0x2756a3['secure']=_0x4e0952[_0x11a5('0xe')][_0x11a5('0xf')][_0x11a5('0x13')];}if(_0x4e0952[_0x11a5('0xe')][_0x11a5('0xf')][_0x11a5('0x14')]){_0x2756a3[_0x11a5('0x15')]={'user':_0x4e0952[_0x11a5('0xe')][_0x11a5('0xf')][_0x11a5('0x16')],'pass':_0x4e0952['MailAccount'][_0x11a5('0xf')]['pass']};}var _0x241291={'account':_0x2756a3,'message':{'from':util[_0x11a5('0x17')]('\x22%s\x22\x20<%s>',_0x4e0952['MailAccount'][_0x11a5('0x18')],_0x4e0952[_0x11a5('0xe')][_0x11a5('0xd')]||_0x4e0952[_0x11a5('0xe')]['Smtp'][_0x11a5('0x16')]),'to':_0x4e0952[_0x11a5('0xd')],'cc':_0x4e0952['cc'],'bcc':_0x4e0952['bcc'],'subject':util[_0x11a5('0x17')]('Report\x20%s\x20last\x20%s\x20%s',_0x3e01fa[_0x11a5('0x18')],_0x4e0952[_0x11a5('0x19')],_0x4e0952[_0x11a5('0x1a')])}};var _0x5c8878=path[_0x11a5('0x1b')](__dirname,'../../files/reports');var _0x4779f9=_0x3e01fa[_0x11a5('0x1c')];var _0x53e1df=util[_0x11a5('0x17')](_0x11a5('0x1d'),path[_0x11a5('0x1e')](_0x3e01fa[_0x11a5('0x1c')],path[_0x11a5('0x1f')](_0x3e01fa['savename'])),'zip');var _0x33c8d1=path['join'](_0x5c8878,_0x4779f9);var _0x2b7106=path[_0x11a5('0x1b')](_0x5c8878,_0x53e1df);if(fs[_0x11a5('0x20')](_0x33c8d1)){_0x3e01fa[_0x11a5('0x21')]=_0x11a5('0x22');_0x241291[_0x11a5('0x23')]['attachments']=[{'filename':_0x4779f9,'path':_0x33c8d1}];_0x241291[_0x11a5('0x23')][_0x11a5('0x24')]=util['format'](_0x11a5('0x25'),JSON['stringify'](_0x3e01fa,null,0x2));}else if(fs[_0x11a5('0x20')](_0x2b7106)){_0x3e01fa[_0x11a5('0x21')]=_0x11a5('0x22');_0x241291[_0x11a5('0x23')]['attachments']=[{'filename':_0x53e1df,'path':_0x2b7106}];}else{_0x241291[_0x11a5('0x23')][_0x11a5('0x24')]=_0x11a5('0x26');if(!_0x4e0952[_0x11a5('0x27')]){_0x4aa667=![];logger[_0x11a5('0x28')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x4aa667){return client[_0x11a5('0x29')](_0x11a5('0x2a'),_0x241291)[_0x11a5('0x2b')](function(_0xecc3ca){if(_0xecc3ca['error']){return logger[_0x11a5('0x2c')](_0x11a5('0x2d'),JSON[_0x11a5('0x2e')](_0xecc3ca));}return logger[_0x11a5('0x28')]('email\x20sent');})[_0x11a5('0x2f')](function(_0x400402){return logger['error'](_0x11a5('0x2d'),JSON['stringify'](_0x400402));});}};}function handleError(){return function(_0x541b22){return logger['error'](JSON['stringify'](_0x541b22));};}function handleResult(_0x3c5c48){return function(_0x5c8353){logger['info'](_0x11a5('0x30'),JSON[_0x11a5('0x2e')](_0x5c8353));if(_0x3c5c48[_0x11a5('0xe')]&&_0x3c5c48[_0x11a5('0xe')][_0x11a5('0xf')]&&!_[_0x11a5('0x31')](_0x3c5c48[_0x11a5('0xd')])){setTimeout(handleSendEmail(_0x3c5c48,_0x5c8353),0x3c*0x3e8);}};}function handleJob(_0x5eb66f){return function(){try{if(_[_0x11a5('0x31')](_0x5eb66f[_0x11a5('0x19')])){return logger[_0x11a5('0x28')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x11a5('0x31')](_0x5eb66f['subtractUnit'])){return logger['info'](_0x11a5('0x32'));}var _0x383160={'startDate':moment()[_0x11a5('0x33')](_0x5eb66f[_0x11a5('0x19')],_0x5eb66f[_0x11a5('0x1a')])[_0x11a5('0x17')](_0x11a5('0x34')),'endDate':moment()[_0x11a5('0x17')](_0x11a5('0x34')),'type':_0x11a5('0x35'),'output':_0x5eb66f[_0x11a5('0x36')],'name':_0x5eb66f[_0x11a5('0x18')]};if(!_[_0x11a5('0x31')](_0x5eb66f['DefaultReportId'])){logger[_0x11a5('0x28')](_0x11a5('0x37'),_0x5eb66f[_0x11a5('0x38')]);return analyticDefaultReportController[_0x11a5('0x39')]({'id':_0x5eb66f[_0x11a5('0x38')]},_0x383160)[_0x11a5('0x2b')](handleResult(_0x5eb66f))[_0x11a5('0x2f')](handleError());}if(!_['isNil'](_0x5eb66f[_0x11a5('0x3a')])){logger[_0x11a5('0x28')](_0x11a5('0x3b'),_0x5eb66f['CustomReportId']);return analyticCustomReportController[_0x11a5('0x39')]({'id':_0x5eb66f[_0x11a5('0x3a')]},_0x383160)['then'](handleResult(_0x5eb66f))['catch'](handleError());}}catch(_0x3f97a8){logger['error'](JSON['stringify'](_0x3f97a8));}return logger[_0x11a5('0x28')]('no\x20report\x20id');};}function getJobs(_0x305471){var _0x465ee6={};if(_0x305471){_0x465ee6['id']=_0x305471;}return db[_0x11a5('0x3c')][_0x11a5('0x3d')]({'where':_0x465ee6,'include':[{'model':db[_0x11a5('0xe')],'attributes':['id',_0x11a5('0x18'),_0x11a5('0xd')],'include':[{'model':db['MailServerOut'],'as':_0x11a5('0xf')}]}]})[_0x11a5('0x2b')](function(_0x38e92c){var _0x39677a=_[_0x11a5('0x3e')](manager[_0x11a5('0x3f')]);var _0x1d607d=_[_0x11a5('0x40')](_0x38e92c,function(_0x4e7f09){return _0x4e7f09['id'][_0x11a5('0x41')]();});var _0x50bed0=_[_0x11a5('0x42')](_0x38e92c,function(_0x1b656e){return _0x1b656e['id']['toString']();});var _0x323fa8=_0x305471?_0x1d607d:_[_0x11a5('0x43')](_0x1d607d,_0x39677a);var _0x30a7af=_[_0x11a5('0x44')](_0x1d607d,_0x39677a);var _0x217268=_['difference'](_0x39677a,_0x1d607d);var _0x3944c1;var _0x56a109;for(_0x3944c1=0x0;_0x3944c1<_0x217268[_0x11a5('0x45')]&&!_0x305471;_0x3944c1+=0x1){_0x56a109=_0x217268[_0x3944c1][_0x11a5('0x41')]();if(manager['exists'](_0x56a109)){manager[_0x11a5('0x46')](_0x56a109);manager[_0x11a5('0x47')](_0x56a109);logger['info'](_0x11a5('0x48'),_0x56a109);}}logger[_0x11a5('0x28')](_0x11a5('0x49'),JSON[_0x11a5('0x2e')](_0x323fa8));for(_0x3944c1=0x0;_0x3944c1<_0x323fa8['length'];_0x3944c1+=0x1){_0x56a109=_0x323fa8[_0x3944c1][_0x11a5('0x41')]();logger[_0x11a5('0x28')](_0x11a5('0x4a'),_0x56a109);if(_0x305471){logger[_0x11a5('0x28')](_0x11a5('0x4b'),_0x305471);logger[_0x11a5('0x28')](JSON[_0x11a5('0x2e')](_0x50bed0[_0x56a109]));BPromise[_0x11a5('0x4c')]()[_0x11a5('0x2b')](handleJob(_0x50bed0[_0x56a109]));logger[_0x11a5('0x28')](_0x11a5('0x4d'),_0x50bed0[_0x56a109][_0x11a5('0x18')],_0x50bed0[_0x56a109][_0x11a5('0x4e')]);}else if(_0x50bed0[_0x56a109][_0x11a5('0x4e')]&&_0x50bed0[_0x56a109][_0x11a5('0x4f')]&&moment()[_0x11a5('0x50')](_0x50bed0[_0x56a109][_0x11a5('0x51')],_0x50bed0[_0x56a109][_0x11a5('0x52')])){manager[_0x11a5('0x53')](_0x56a109,_0x50bed0[_0x56a109][_0x11a5('0x4e')],handleJob(_0x50bed0[_0x56a109]));manager[_0x11a5('0x54')](_0x56a109);logger[_0x11a5('0x28')](_0x11a5('0x55'),_0x50bed0[_0x56a109]['name'],_0x50bed0[_0x56a109][_0x11a5('0x4e')]);}else if(manager[_0x11a5('0x56')](_0x56a109)){manager[_0x11a5('0x46')](_0x56a109);manager[_0x11a5('0x47')](_0x56a109);logger['info'](_0x11a5('0x57'),_0x50bed0[_0x56a109][_0x11a5('0x18')],_0x50bed0[_0x56a109]['cron']);}}for(_0x3944c1=0x0,_0x56a109;_0x3944c1<_0x30a7af[_0x11a5('0x45')]&&!_0x305471;_0x3944c1+=0x1){_0x56a109=_0x30a7af[_0x3944c1]['toString']();if(manager[_0x11a5('0x56')](_0x56a109)){if(_0x50bed0[_0x56a109][_0x11a5('0x4e')]&&_0x50bed0[_0x56a109][_0x11a5('0x4f')]&&moment()[_0x11a5('0x50')](_0x50bed0[_0x56a109][_0x11a5('0x51')],_0x50bed0[_0x56a109]['endAt'])){manager[_0x11a5('0x58')](_0x56a109,_0x50bed0[_0x56a109][_0x11a5('0x4e')],handleJob(_0x50bed0[_0x56a109]));logger[_0x11a5('0x28')]('update\x20cron',_0x50bed0[_0x56a109]['name'],_0x50bed0[_0x56a109][_0x11a5('0x4e')]);}else{manager['stop'](_0x56a109);manager[_0x11a5('0x47')](_0x56a109);logger[_0x11a5('0x28')]('stop\x20cron',_0x50bed0[_0x56a109][_0x11a5('0x18')],_0x50bed0[_0x56a109]['cron']);}}}})[_0x11a5('0x2f')](function(_0x503276){logger[_0x11a5('0x2c')](JSON['stringify'](_0x503276));});}exports[_0x11a5('0x59')]=function(_0x1d01cc){return getJobs(_0x1d01cc);};exports[_0x11a5('0x54')]=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 df1ecbb..db41fc1 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 _0x7be1=['bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','transcribeName','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','fileText','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','then','results','length','transcripts','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','language','bucket','Transcript\x20not\x20available','sentimentAccountId','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Mixed','catch','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','IN_PROGRESS','Setting','Settings\x20not\x20available','transcribeAccountId','transcribeRegion','forEach','push','all','error','start','lodash','aws-sdk','request-promise'];(function(_0x59c1f2,_0xd59131){var _0xbdb888=function(_0x10ce3c){while(--_0x10ce3c){_0x59c1f2['push'](_0x59c1f2['shift']());}};_0xbdb888(++_0xd59131);}(_0x7be1,0x165));var _0x17be=function(_0x3bab18,_0x53d735){_0x3bab18=_0x3bab18-0x0;var _0x12585f=_0x7be1[_0x3bab18];return _0x12585f;};var _=require(_0x17be('0x0'));var AWS=require(_0x17be('0x1'));var rp=require(_0x17be('0x2'));var util=require('util');var BPromise=require(_0x17be('0x3'));var db=require(_0x17be('0x4'))['db'];var logger=require(_0x17be('0x5'))(_0x17be('0x6'));function getTranscriptionJob(_0x2bc9ed,_0x4b46fd,_0x4feea7,_0x55257a){return new Promise(function(_0x2fed12,_0x40f3f9){var _0x4f5b0c=new AWS[(_0x17be('0x7'))]({'accessKeyId':_0x4b46fd,'secretAccessKey':_0x2bc9ed,'region':_0x4feea7});_0x4f5b0c[_0x17be('0x8')]({'TranscriptionJobName':_0x55257a},function(_0x2c74b2,_0xfd9c5){if(_0x2c74b2){return _0x40f3f9(_0x2c74b2);}else{return _0x2fed12(_0xfd9c5);}});});}function sentiment(_0x4779a8,_0x16042b,_0x582848,_0x41e383,_0x589cdb){return new Promise(function(_0x3d23c3,_0x2c276e){var _0x520a49=new AWS[(_0x17be('0x9'))]({'accessKeyId':_0x16042b,'secretAccessKey':_0x4779a8,'region':_0x582848});_0x520a49[_0x17be('0xa')]({'Text':_0x41e383,'LanguageCode':_0x589cdb[_0x17be('0xb')](0x0,0x2)},function(_0x667ab3,_0x4ddc25){if(_0x667ab3){return _0x2c276e(_0x667ab3);}else{return _0x3d23c3(_0x4ddc25);}});});}function checkTranscribeJob(_0x431142,_0x52a62c,_0x40e3d5){var _0x4f4ad6;return new BPromise(function(_0x2af298,_0x1dff9e){logger[_0x17be('0xc')](util[_0x17be('0xd')](_0x17be('0xe'),_0x431142['id'],_0x431142['transcribeName']));return getTranscriptionJob(_0x40e3d5[_0x17be('0xf')],_0x40e3d5['data2'],_0x52a62c['transcribeRegion'],_0x431142[_0x17be('0x10')])['then'](function(_0x2a37ec){logger['info'](util[_0x17be('0xd')](_0x17be('0x11'),_0x431142['id'],_0x431142['transcribeName'],_0x2a37ec[_0x17be('0x12')]['TranscriptionJobStatus']));if(!_0x431142[_0x17be('0x13')]){switch(_0x2a37ec['TranscriptionJob'][_0x17be('0x14')]){case _0x17be('0x15'):var _0x416f81={'transcribeStatus':_0x2a37ec[_0x17be('0x12')][_0x17be('0x14')],'fileUri':_0x2a37ec['TranscriptionJob'][_0x17be('0x16')][_0x17be('0x17')]};logger[_0x17be('0xc')](util[_0x17be('0xd')]('[RECORDING:%d]\x20Get\x20transcript',_0x431142['id']));return rp({'uri':_0x2a37ec[_0x17be('0x12')]['Transcript']['TranscriptFileUri'],'json':!![]})[_0x17be('0x18')](function(_0x3ffd1e){logger[_0x17be('0xc')](util[_0x17be('0xd')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x431142['id']));if(_0x3ffd1e&&_0x3ffd1e[_0x17be('0x19')]&&_0x3ffd1e[_0x17be('0x19')]['transcripts']&&_0x3ffd1e[_0x17be('0x19')]['transcripts'][_0x17be('0x1a')]){_0x416f81[_0x17be('0x13')]='';for(var _0x47f00d=0x0;_0x47f00d<_0x3ffd1e[_0x17be('0x19')]['transcripts'][_0x17be('0x1a')];_0x47f00d++){_0x416f81['fileText']+=_0x3ffd1e['results'][_0x17be('0x1b')][_0x47f00d]['transcript']+'';}}return _0x431142[_0x17be('0x1c')](_0x416f81);})['then'](function(){logger[_0x17be('0xc')](util[_0x17be('0xd')](_0x17be('0x1d'),_0x431142['id']));if(!_0x431142[_0x17be('0x1e')]){throw new db[(_0x17be('0x1f'))][(_0x17be('0x20'))](_0x17be('0x21'));}if(!_0x52a62c[_0x17be('0x22')]||!_0x52a62c['sentimentAccountId']||!_0x52a62c[_0x17be('0x23')]||!_0x52a62c[_0x17be('0x24')]||!_0x52a62c[_0x17be('0x25')]){throw new db[(_0x17be('0x1f'))][(_0x17be('0x20'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x416f81[_0x17be('0x13')]){throw new Error(_0x17be('0x26'));}if(_0x52a62c[_0x17be('0x27')]===_0x40e3d5['id']){return _0x40e3d5;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings[_0x17be('0x27')]}});}})[_0x17be('0x18')](function(_0x57c5b2){if(!_0x57c5b2){throw new db[(_0x17be('0x1f'))]['ValidationError'](_0x17be('0x28'));}if(!_0x57c5b2[_0x17be('0xf')]||!_0x57c5b2[_0x17be('0x29')]){throw new db[(_0x17be('0x1f'))][(_0x17be('0x20'))](_0x17be('0x2a'));}_0x4f4ad6=_0x57c5b2;logger[_0x17be('0xc')](util[_0x17be('0xd')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x431142['id']));return sentiment(_0x4f4ad6[_0x17be('0xf')],_0x4f4ad6[_0x17be('0x29')],_0x52a62c['sentimentRegion'],_0x416f81[_0x17be('0x13')],_0x52a62c[_0x17be('0x24')]);})['then'](function(_0x2f0b81){logger['info'](util[_0x17be('0xd')](_0x17be('0x2b'),_0x431142['id']));return _0x431142['update']({'sentiment':_0x2f0b81[_0x17be('0x2c')],'sPositive':_0x2f0b81[_0x17be('0x2d')][_0x17be('0x2e')],'sNegative':_0x2f0b81[_0x17be('0x2d')][_0x17be('0x2f')],'sMixed':_0x2f0b81[_0x17be('0x2d')]['Mixed'],'sNeutral':_0x2f0b81[_0x17be('0x2d')][_0x17be('0x30')]});})['then'](function(){logger[_0x17be('0xc')](util['format'](_0x17be('0x1d'),_0x431142['id']));_0x2af298();});case _0x17be('0x31'):return _0x431142[_0x17be('0x1c')]({'transcribeStatus':'FAILED','failureReason':_0x2a37ec[_0x17be('0x12')][_0x17be('0x32')]})[_0x17be('0x18')](function(){logger[_0x17be('0xc')](util[_0x17be('0xd')](_0x17be('0x1d'),_0x431142['id']));_0x2af298();});default:logger[_0x17be('0xc')](util[_0x17be('0xd')](_0x17be('0x33'),_0x431142['id']));break;}}else{return BPromise['resolve']()['then'](function(){if(!_0x431142[_0x17be('0x1e')]){throw new db[(_0x17be('0x1f'))][(_0x17be('0x20'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x52a62c[_0x17be('0x22')]||!_0x52a62c[_0x17be('0x27')]||!_0x52a62c[_0x17be('0x23')]||!_0x52a62c['language']||!_0x52a62c[_0x17be('0x25')]){throw new db[(_0x17be('0x1f'))][(_0x17be('0x20'))](_0x17be('0x34'));}if(!_0x431142['fileText']){throw new Error(_0x17be('0x26'));}if(_0x52a62c['sentimentAccountId']===_0x40e3d5['id']){return _0x40e3d5;}else{return db[_0x17be('0x35')][_0x17be('0x36')]({'where':{'id':_settings[_0x17be('0x27')]}});}})[_0x17be('0x18')](function(_0x3812c6){if(!_0x3812c6){throw new db[(_0x17be('0x1f'))]['ValidationError'](_0x17be('0x28'));}if(!_0x3812c6[_0x17be('0xf')]||!_0x3812c6[_0x17be('0x29')]){throw new db[(_0x17be('0x1f'))][(_0x17be('0x20'))](_0x17be('0x2a'));}_0x4f4ad6=_0x3812c6;logger[_0x17be('0xc')](util[_0x17be('0xd')](_0x17be('0x37'),_0x431142['id']));return sentiment(_0x4f4ad6[_0x17be('0xf')],_0x4f4ad6[_0x17be('0x29')],_0x52a62c[_0x17be('0x23')],_0x431142['fileText'],_0x52a62c[_0x17be('0x24')]);})[_0x17be('0x18')](function(_0x380e6b){logger[_0x17be('0xc')](util[_0x17be('0xd')](_0x17be('0x2b'),_0x431142['id']));return _0x431142['update']({'sentiment':_0x380e6b[_0x17be('0x2c')],'sPositive':_0x380e6b[_0x17be('0x2d')][_0x17be('0x2e')],'sNegative':_0x380e6b[_0x17be('0x2d')][_0x17be('0x2f')],'sMixed':_0x380e6b[_0x17be('0x2d')][_0x17be('0x38')],'sNeutral':_0x380e6b[_0x17be('0x2d')][_0x17be('0x30')],'transcribeStatus':'COMPLETED'});})['then'](function(){logger[_0x17be('0xc')](util[_0x17be('0xd')](_0x17be('0x1d'),_0x431142['id']));_0x2af298();});}})[_0x17be('0x39')](function(_0x43be24){if(_0x43be24){if(!_0x43be24[_0x17be('0x3a')]||_0x43be24[_0x17be('0x3a')]!==_0x17be('0x3b')){logger['error'](util[_0x17be('0xd')](_0x17be('0x3c'),_0x431142['id']),util[_0x17be('0x3d')](_0x43be24,{'showHidden':![],'depth':null}));}}_0x2af298();});});}function checkTranscribe(){var _0x46f673;var _0x15b124;var _0x1619d3;return db['VoiceRecording']['findAll']({'where':{'transcribeStatus':_0x17be('0x3e')}})[_0x17be('0x18')](function(_0x38dc2f){if(!_0x38dc2f||!_0x38dc2f['length']){throw new db[(_0x17be('0x1f'))]['ValidationError']('No\x20transcribe\x20job\x20to\x20check');}_0x46f673=_0x38dc2f;return db[_0x17be('0x3f')][_0x17be('0x36')]({'where':{'id':0x1}});})[_0x17be('0x18')](function(_0x427cee){if(!_0x427cee){throw new db[(_0x17be('0x1f'))][(_0x17be('0x20'))](_0x17be('0x40'));}_0x15b124=_0x427cee;if(!_0x15b124[_0x17be('0x6')]||!_0x15b124[_0x17be('0x41')]||!_0x15b124[_0x17be('0x42')]||!_0x15b124[_0x17be('0x24')]||!_0x15b124['bucket']){throw new db[(_0x17be('0x1f'))]['ValidationError']('Transcribe\x20not\x20configured');}return db[_0x17be('0x35')][_0x17be('0x36')]({'where':{'id':_0x15b124[_0x17be('0x41')]}});})['then'](function(_0x32b4f8){if(!_0x32b4f8){throw new db[(_0x17be('0x1f'))][(_0x17be('0x20'))](_0x17be('0x28'));}if(!_0x32b4f8[_0x17be('0xf')]||!_0x32b4f8[_0x17be('0x29')]){throw new db[(_0x17be('0x1f'))][(_0x17be('0x20'))](_0x17be('0x2a'));}_0x1619d3=_0x32b4f8;var _0x15a5e5=[];_0x46f673[_0x17be('0x43')](function(_0x1bd9cd){_0x15a5e5[_0x17be('0x44')](checkTranscribeJob(_0x1bd9cd,_0x15b124,_0x1619d3));});return BPromise[_0x17be('0x45')](_0x15a5e5);})['catch'](function(_0x9fcd24){if(_0x9fcd24){if(!_0x9fcd24[_0x17be('0x3a')]||_0x9fcd24[_0x17be('0x3a')]!==_0x17be('0x3b')){logger[_0x17be('0x46')](util['inspect'](_0x9fcd24,{'showHidden':![],'depth':null}));}}});}exports[_0x17be('0x47')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x065e=['length','transcript','update','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','sentimentAccountId','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','Sentiment','Positive','SentimentScore','Negative','Mixed','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','tempSentiment','bucket','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','Transcribe\x20not\x20configured','transcribeAccountId','forEach','push','all','lodash','bluebird','../../mysqldb','../../config/logger','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','data2','transcribeRegion','transcribeName','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','fileText','TranscriptionJob','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts'];(function(_0x2e8660,_0x5ca0c2){var _0x3dc331=function(_0x20f7c1){while(--_0x20f7c1){_0x2e8660['push'](_0x2e8660['shift']());}};_0x3dc331(++_0x5ca0c2);}(_0x065e,0x1a7));var _0xe065=function(_0x326965,_0x3d62b5){_0x326965=_0x326965-0x0;var _0x34acb2=_0x065e[_0x326965];return _0x34acb2;};var _=require(_0xe065('0x0'));var AWS=require('aws-sdk');var rp=require('request-promise');var util=require('util');var BPromise=require(_0xe065('0x1'));var db=require(_0xe065('0x2'))['db'];var logger=require(_0xe065('0x3'))('transcribe');function getTranscriptionJob(_0x4964fa,_0x4610a3,_0x2f90aa,_0x5b099e){return new Promise(function(_0x10b45f,_0x1e7e69){var _0x189d72=new AWS['TranscribeService']({'accessKeyId':_0x4610a3,'secretAccessKey':_0x4964fa,'region':_0x2f90aa});_0x189d72[_0xe065('0x4')]({'TranscriptionJobName':_0x5b099e},function(_0x5afbd4,_0x273e22){if(_0x5afbd4){return _0x1e7e69(_0x5afbd4);}else{return _0x10b45f(_0x273e22);}});});}function sentiment(_0x2f072e,_0x3bacf3,_0x114497,_0x85001e,_0x531ebd){return new Promise(function(_0x43827c,_0x6c9117){var _0x3f59d3=new AWS[(_0xe065('0x5'))]({'accessKeyId':_0x3bacf3,'secretAccessKey':_0x2f072e,'region':_0x114497});_0x3f59d3[_0xe065('0x6')]({'Text':_0x85001e,'LanguageCode':_0x531ebd[_0xe065('0x7')](0x0,0x2)},function(_0x4f8c4e,_0x595907){if(_0x4f8c4e){return _0x6c9117(_0x4f8c4e);}else{return _0x43827c(_0x595907);}});});}function checkTranscribeJob(_0xd2fdc7,_0x13b697,_0xf5ab44){var _0x5bd30f;return new BPromise(function(_0x3aa3be,_0x40cc6b){logger[_0xe065('0x8')](util[_0xe065('0x9')](_0xe065('0xa'),_0xd2fdc7['id'],_0xd2fdc7['transcribeName']));return getTranscriptionJob(_0xf5ab44[_0xe065('0xb')],_0xf5ab44[_0xe065('0xc')],_0x13b697[_0xe065('0xd')],_0xd2fdc7[_0xe065('0xe')])[_0xe065('0xf')](function(_0x352206){logger[_0xe065('0x8')](util['format'](_0xe065('0x10'),_0xd2fdc7['id'],_0xd2fdc7[_0xe065('0xe')],_0x352206['TranscriptionJob'][_0xe065('0x11')]));if(!_0xd2fdc7[_0xe065('0x12')]){switch(_0x352206[_0xe065('0x13')][_0xe065('0x11')]){case _0xe065('0x14'):var _0x302adf={'transcribeStatus':_0x352206[_0xe065('0x13')]['TranscriptionJobStatus'],'fileUri':_0x352206[_0xe065('0x13')]['Transcript'][_0xe065('0x15')]};logger[_0xe065('0x8')](util['format'](_0xe065('0x16'),_0xd2fdc7['id']));return rp({'uri':_0x352206['TranscriptionJob'][_0xe065('0x17')][_0xe065('0x15')],'json':!![]})[_0xe065('0xf')](function(_0x110556){logger[_0xe065('0x8')](util[_0xe065('0x9')](_0xe065('0x18'),_0xd2fdc7['id']));if(_0x110556&&_0x110556[_0xe065('0x19')]&&_0x110556[_0xe065('0x19')]['transcripts']&&_0x110556[_0xe065('0x19')][_0xe065('0x1a')][_0xe065('0x1b')]){_0x302adf[_0xe065('0x12')]='';for(var _0x5e8b60=0x0;_0x5e8b60<_0x110556['results'][_0xe065('0x1a')]['length'];_0x5e8b60++){_0x302adf[_0xe065('0x12')]+=_0x110556[_0xe065('0x19')][_0xe065('0x1a')][_0x5e8b60][_0xe065('0x1c')]+'';}}return _0xd2fdc7[_0xe065('0x1d')](_0x302adf);})[_0xe065('0xf')](function(){logger[_0xe065('0x8')](util[_0xe065('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0xd2fdc7['id']));if(!_0xd2fdc7['tempSentiment']){throw new db[(_0xe065('0x1e'))][(_0xe065('0x1f'))](_0xe065('0x20'));}if(!_0x13b697[_0xe065('0x21')]||!_0x13b697['sentimentAccountId']||!_0x13b697[_0xe065('0x22')]||!_0x13b697['language']||!_0x13b697['bucket']){throw new db[(_0xe065('0x1e'))][(_0xe065('0x1f'))](_0xe065('0x23'));}if(!_0x302adf['fileText']){throw new Error(_0xe065('0x24'));}if(_0x13b697['sentimentAccountId']===_0xf5ab44['id']){return _0xf5ab44;}else{return db[_0xe065('0x25')][_0xe065('0x26')]({'where':{'id':_settings[_0xe065('0x27')]}});}})[_0xe065('0xf')](function(_0x58c49b){if(!_0x58c49b){throw new db[(_0xe065('0x1e'))]['ValidationError'](_0xe065('0x28'));}if(!_0x58c49b[_0xe065('0xb')]||!_0x58c49b['data2']){throw new db[(_0xe065('0x1e'))]['ValidationError'](_0xe065('0x29'));}_0x5bd30f=_0x58c49b;logger['info'](util[_0xe065('0x9')](_0xe065('0x2a'),_0xd2fdc7['id']));return sentiment(_0x5bd30f[_0xe065('0xb')],_0x5bd30f[_0xe065('0xc')],_0x13b697['sentimentRegion'],_0x302adf[_0xe065('0x12')],_0x13b697[_0xe065('0x2b')]);})[_0xe065('0xf')](function(_0x2532f8){logger[_0xe065('0x8')](util[_0xe065('0x9')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0xd2fdc7['id']));return _0xd2fdc7[_0xe065('0x1d')]({'sentiment':_0x2532f8[_0xe065('0x2c')],'sPositive':_0x2532f8['SentimentScore'][_0xe065('0x2d')],'sNegative':_0x2532f8[_0xe065('0x2e')][_0xe065('0x2f')],'sMixed':_0x2532f8[_0xe065('0x2e')][_0xe065('0x30')],'sNeutral':_0x2532f8[_0xe065('0x2e')][_0xe065('0x31')]});})['then'](function(){logger[_0xe065('0x8')](util['format'](_0xe065('0x32'),_0xd2fdc7['id']));_0x3aa3be();});case _0xe065('0x33'):return _0xd2fdc7[_0xe065('0x1d')]({'transcribeStatus':_0xe065('0x33'),'failureReason':_0x352206[_0xe065('0x13')][_0xe065('0x34')]})['then'](function(){logger[_0xe065('0x8')](util[_0xe065('0x9')](_0xe065('0x32'),_0xd2fdc7['id']));_0x3aa3be();});default:logger['info'](util[_0xe065('0x9')](_0xe065('0x35'),_0xd2fdc7['id']));break;}}else{return BPromise[_0xe065('0x36')]()[_0xe065('0xf')](function(){if(!_0xd2fdc7[_0xe065('0x37')]){throw new db['Sequelize'][(_0xe065('0x1f'))](_0xe065('0x20'));}if(!_0x13b697['sentiment']||!_0x13b697[_0xe065('0x27')]||!_0x13b697['sentimentRegion']||!_0x13b697[_0xe065('0x2b')]||!_0x13b697[_0xe065('0x38')]){throw new db['Sequelize'][(_0xe065('0x1f'))](_0xe065('0x23'));}if(!_0xd2fdc7['fileText']){throw new Error(_0xe065('0x24'));}if(_0x13b697[_0xe065('0x27')]===_0xf5ab44['id']){return _0xf5ab44;}else{return db[_0xe065('0x25')][_0xe065('0x26')]({'where':{'id':_settings[_0xe065('0x27')]}});}})[_0xe065('0xf')](function(_0x395cc2){if(!_0x395cc2){throw new db[(_0xe065('0x1e'))][(_0xe065('0x1f'))](_0xe065('0x28'));}if(!_0x395cc2[_0xe065('0xb')]||!_0x395cc2[_0xe065('0xc')]){throw new db[(_0xe065('0x1e'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x5bd30f=_0x395cc2;logger[_0xe065('0x8')](util[_0xe065('0x9')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0xd2fdc7['id']));return sentiment(_0x5bd30f[_0xe065('0xb')],_0x5bd30f[_0xe065('0xc')],_0x13b697[_0xe065('0x22')],_0xd2fdc7[_0xe065('0x12')],_0x13b697[_0xe065('0x2b')]);})[_0xe065('0xf')](function(_0x39440c){logger[_0xe065('0x8')](util[_0xe065('0x9')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0xd2fdc7['id']));return _0xd2fdc7[_0xe065('0x1d')]({'sentiment':_0x39440c[_0xe065('0x2c')],'sPositive':_0x39440c[_0xe065('0x2e')]['Positive'],'sNegative':_0x39440c[_0xe065('0x2e')][_0xe065('0x2f')],'sMixed':_0x39440c[_0xe065('0x2e')][_0xe065('0x30')],'sNeutral':_0x39440c['SentimentScore'][_0xe065('0x31')],'transcribeStatus':_0xe065('0x14')});})[_0xe065('0xf')](function(){logger[_0xe065('0x8')](util[_0xe065('0x9')](_0xe065('0x32'),_0xd2fdc7['id']));_0x3aa3be();});}})[_0xe065('0x39')](function(_0x50b031){if(_0x50b031){if(!_0x50b031[_0xe065('0x3a')]||_0x50b031[_0xe065('0x3a')]!==_0xe065('0x3b')){logger[_0xe065('0x3c')](util[_0xe065('0x9')](_0xe065('0x3d'),_0xd2fdc7['id']),util[_0xe065('0x3e')](_0x50b031,{'showHidden':![],'depth':null}));}}_0x3aa3be();});});}function checkTranscribe(){var _0x4c0b32;var _0x1b51f9;var _0x5a2360;return db[_0xe065('0x3f')][_0xe065('0x40')]({'where':{'transcribeStatus':_0xe065('0x41')}})['then'](function(_0xbc1ba5){if(!_0xbc1ba5||!_0xbc1ba5[_0xe065('0x1b')]){throw new db[(_0xe065('0x1e'))][(_0xe065('0x1f'))](_0xe065('0x42'));}_0x4c0b32=_0xbc1ba5;return db[_0xe065('0x43')][_0xe065('0x26')]({'where':{'id':0x1}});})[_0xe065('0xf')](function(_0x3095c8){if(!_0x3095c8){throw new db[(_0xe065('0x1e'))][(_0xe065('0x1f'))](_0xe065('0x44'));}_0x1b51f9=_0x3095c8;if(!_0x1b51f9[_0xe065('0x45')]||!_0x1b51f9['transcribeAccountId']||!_0x1b51f9['transcribeRegion']||!_0x1b51f9['language']||!_0x1b51f9[_0xe065('0x38')]){throw new db['Sequelize'][(_0xe065('0x1f'))](_0xe065('0x46'));}return db[_0xe065('0x25')]['findOne']({'where':{'id':_0x1b51f9[_0xe065('0x47')]}});})[_0xe065('0xf')](function(_0x5cce78){if(!_0x5cce78){throw new db[(_0xe065('0x1e'))][(_0xe065('0x1f'))](_0xe065('0x28'));}if(!_0x5cce78[_0xe065('0xb')]||!_0x5cce78[_0xe065('0xc')]){throw new db[(_0xe065('0x1e'))][(_0xe065('0x1f'))](_0xe065('0x29'));}_0x5a2360=_0x5cce78;var _0x43480d=[];_0x4c0b32[_0xe065('0x48')](function(_0x49a367){_0x43480d[_0xe065('0x49')](checkTranscribeJob(_0x49a367,_0x1b51f9,_0x5a2360));});return BPromise[_0xe065('0x4a')](_0x43480d);})[_0xe065('0x39')](function(_0x392778){if(_0x392778){if(!_0x392778['name']||_0x392778[_0xe065('0x3a')]!==_0xe065('0x3b')){logger[_0xe065('0x3c')](util[_0xe065('0x3e')](_0x392778,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index 61f873e..064ecb6 100644 --- a/server/config/schedule/whatsapp.js +++ b/server/config/schedule/whatsapp.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0f7b=['findAll','lastMsgAt','hours','then','join','system','format','YYYY-MM-DD\x20HH:mm:ss','length','info','emit','whatsappInteraction:update','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','../../config/environment','../../mysqldb','../logger','schedule','defaults','redis','localhost','socket.io-emitter','WhatsappInteraction'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x0f7b,0x1a5));var _0xb0f7=function(_0x307d86,_0x9264f2){_0x307d86=_0x307d86-0x0;var _0x361745=_0x0f7b[_0x307d86];return _0x361745;};'use strict';var _=require(_0xb0f7('0x0'));var moment=require(_0xb0f7('0x1'));var Redis=require('ioredis');var util=require('util');var config=require(_0xb0f7('0x2'));var db=require(_0xb0f7('0x3'))['db'];var logger=require(_0xb0f7('0x4'))(_0xb0f7('0x5'));config['redis']=_[_0xb0f7('0x6')](config[_0xb0f7('0x7')],{'host':_0xb0f7('0x8'),'port':0x18eb});var io=require(_0xb0f7('0x9'))(new Redis(config['redis']));function closeInteractions(){var _0x422195=[];return db[_0xb0f7('0xa')][_0xb0f7('0xb')]({'raw':!![],'attributes':['id',_0xb0f7('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0xb0f7('0xd'))}}})[_0xb0f7('0xe')](function(_0x166aa2){if(_0x166aa2&&_0x166aa2['length']){_0x422195=_['map'](_0x166aa2||[],'id');logger['info']('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x422195[_0xb0f7('0xf')]());return db[_0xb0f7('0xa')]['update']({'closeReason':_0xb0f7('0x10'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xb0f7('0x11')](_0xb0f7('0x12'))},{'where':{'id':_0x422195}});}})[_0xb0f7('0xe')](function(){if(_0x422195&&_0x422195[_0xb0f7('0x13')]){logger[_0xb0f7('0x14')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x422195['join']());for(var _0x44fc08=0x0;_0x44fc08<_0x422195[_0xb0f7('0x13')];_0x44fc08++){io[_0xb0f7('0x15')](_0xb0f7('0x16'),{'id':_0x422195[_0x44fc08],'closed':!![]});}}})[_0xb0f7('0x17')](function(_0x5c35b9){logger['error'](_0xb0f7('0x18'),_0x5c35b9?util[_0xb0f7('0x19')](_0x5c35b9,{'showHidden':![],'depth':null}):'');});}exports[_0xb0f7('0x1a')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xc22b=['schedule','defaults','redis','localhost','socket.io-emitter','lastMsgAt','subtract','then','length','map','info','join','system','format','YYYY-MM-DD\x20HH:mm:ss','emit','whatsappInteraction:update','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','ioredis','util','../../mysqldb','../logger'];(function(_0x48d6a3,_0x37c848){var _0x38bfa0=function(_0x3fba2e){while(--_0x3fba2e){_0x48d6a3['push'](_0x48d6a3['shift']());}};_0x38bfa0(++_0x37c848);}(_0xc22b,0x1c4));var _0xbc22=function(_0x44d339,_0x4563ca){_0x44d339=_0x44d339-0x0;var _0x10758b=_0xc22b[_0x44d339];return _0x10758b;};'use strict';var _=require('lodash');var moment=require('moment');var Redis=require(_0xbc22('0x0'));var util=require(_0xbc22('0x1'));var config=require('../../config/environment');var db=require(_0xbc22('0x2'))['db'];var logger=require(_0xbc22('0x3'))(_0xbc22('0x4'));config['redis']=_[_0xbc22('0x5')](config[_0xbc22('0x6')],{'host':_0xbc22('0x7'),'port':0x18eb});var io=require(_0xbc22('0x8'))(new Redis(config[_0xbc22('0x6')]));function closeInteractions(){var _0x1fc618=[];return db['WhatsappInteraction']['findAll']({'raw':!![],'attributes':['id',_0xbc22('0x9')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xbc22('0xa')](0x18,'hours')}}})[_0xbc22('0xb')](function(_0xcbc356){if(_0xcbc356&&_0xcbc356[_0xbc22('0xc')]){_0x1fc618=_[_0xbc22('0xd')](_0xcbc356||[],'id');logger[_0xbc22('0xe')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x1fc618[_0xbc22('0xf')]());return db['WhatsappInteraction']['update']({'closeReason':_0xbc22('0x10'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xbc22('0x11')](_0xbc22('0x12'))},{'where':{'id':_0x1fc618}});}})['then'](function(){if(_0x1fc618&&_0x1fc618[_0xbc22('0xc')]){logger[_0xbc22('0xe')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x1fc618[_0xbc22('0xf')]());for(var _0x2951bc=0x0;_0x2951bc<_0x1fc618[_0xbc22('0xc')];_0x2951bc++){io[_0xbc22('0x13')](_0xbc22('0x14'),{'id':_0x1fc618[_0x2951bc],'closed':!![]});}}})['catch'](function(_0x7f42a0){logger[_0xbc22('0x15')](_0xbc22('0x16'),_0x7f42a0?util[_0xbc22('0x17')](_0x7f42a0,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 6bcc08e..7304f60 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xea92=['CmHopper','destroy','bulkCreate','hopper1','contacts2','hopper2','util','../mysqldb','Biondo','innocenzo.biondo','@xcally.com','push','now','Innocenzo','CmContact','then','log','finished\x20populating','contacts1'];(function(_0x19213a,_0x246ac2){var _0xeaba49=function(_0x4a0a9c){while(--_0x4a0a9c){_0x19213a['push'](_0x19213a['shift']());}};_0xeaba49(++_0x246ac2);}(_0xea92,0x1bb));var _0x2ea9=function(_0x6eb858,_0x5ef123){_0x6eb858=_0x6eb858-0x0;var _0x46fc78=_0xea92[_0x6eb858];return _0x46fc78;};'use strict';var util=require(_0x2ea9('0x0'));var db=require(_0x2ea9('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x2ea9('0x2')+i,'phone':0xf879fb460+i,'email':_0x2ea9('0x3')+i+_0x2ea9('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x2ea9('0x5')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x2ea9('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x2ea9('0x5')]({'id':i,'firstName':_0x2ea9('0x7')+i,'lastName':_0x2ea9('0x2')+i,'phone':0xf879fb460+i,'email':_0x2ea9('0x3')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x2ea9('0x5')]({'id':i,'active':![],'scheduledat':Date[_0x2ea9('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x2ea9('0x6')](),'updatedAt':Date['now']()});}db[_0x2ea9('0x8')]['destroy']({'where':{}})[_0x2ea9('0x9')](function(){return db[_0x2ea9('0x8')]['bulkCreate'](contacts);})['then'](function(){console[_0x2ea9('0xa')](_0x2ea9('0xb'),_0x2ea9('0xc'));return db[_0x2ea9('0xd')][_0x2ea9('0xe')]({'where':{}});})['then'](function(){return db[_0x2ea9('0xd')][_0x2ea9('0xf')](hopper);})[_0x2ea9('0x9')](function(){console['log'](_0x2ea9('0xb'),_0x2ea9('0x10'));return db[_0x2ea9('0x8')][_0x2ea9('0xf')](contacts2);})[_0x2ea9('0x9')](function(){console[_0x2ea9('0xa')]('finished\x20populating',_0x2ea9('0x11'));return db['CmHopper']['bulkCreate'](hopper2);})[_0x2ea9('0x9')](function(){console[_0x2ea9('0xa')](_0x2ea9('0xb'),_0x2ea9('0x12'));})['catch'](function(_0xf30aba){console[_0x2ea9('0xa')](_0xf30aba);}); \ No newline at end of file +var _0x08c4=['push','Innocenzo','Biondo','@xcally.com','now','innocenzo.biondo','destroy','CmContact','bulkCreate','then','log','finished\x20populating','contacts1','CmHopper','contacts2','hopper2','util','../mysqldb'];(function(_0x25c326,_0x250137){var _0x762452=function(_0x50ce5e){while(--_0x50ce5e){_0x25c326['push'](_0x25c326['shift']());}};_0x762452(++_0x250137);}(_0x08c4,0x142));var _0x408c=function(_0x4e807b,_0x16a7d4){_0x4e807b=_0x4e807b-0x0;var _0x4354e4=_0x08c4[_0x4e807b];return _0x4354e4;};'use strict';var util=require(_0x408c('0x0'));var db=require(_0x408c('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x408c('0x2')]({'id':i,'firstName':_0x408c('0x3')+i,'lastName':_0x408c('0x4')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x408c('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x408c('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x408c('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x408c('0x6')](),'updatedAt':Date[_0x408c('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x408c('0x3')+i,'lastName':_0x408c('0x4')+i,'phone':0xf879fb460+i,'email':_0x408c('0x7')+i+_0x408c('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x408c('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x408c('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x408c('0x6')](),'updatedAt':Date[_0x408c('0x6')]()});}db['CmContact'][_0x408c('0x8')]({'where':{}})['then'](function(){return db[_0x408c('0x9')][_0x408c('0xa')](contacts);})[_0x408c('0xb')](function(){console[_0x408c('0xc')](_0x408c('0xd'),_0x408c('0xe'));return db[_0x408c('0xf')][_0x408c('0x8')]({'where':{}});})['then'](function(){return db[_0x408c('0xf')]['bulkCreate'](hopper);})[_0x408c('0xb')](function(){console[_0x408c('0xc')](_0x408c('0xd'),'hopper1');return db[_0x408c('0x9')][_0x408c('0xa')](contacts2);})[_0x408c('0xb')](function(){console['log'](_0x408c('0xd'),_0x408c('0x10'));return db[_0x408c('0xf')][_0x408c('0xa')](hopper2);})[_0x408c('0xb')](function(){console['log']('finished\x20populating',_0x408c('0x11'));})['catch'](function(_0xf1a0fa){console[_0x408c('0xc')](_0xf1a0fa);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index d0f7075..b1c1535 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf172=['actpass','then','log','catch','util','../mysqldb','push','format','%s%s','agent','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key'];(function(_0x2dc83f,_0x7a35a4){var _0x399d0e=function(_0x17f240){while(--_0x17f240){_0x2dc83f['push'](_0x2dc83f['shift']());}};_0x399d0e(++_0x7a35a4);}(_0xf172,0x180));var _0x2f17=function(_0x5b673a,_0x3e3de6){_0x5b673a=_0x5b673a-0x0;var _0x516953=_0xf172[_0x5b673a];return _0x516953;};'use strict';var util=require(_0x2f17('0x0'));var db=require(_0x2f17('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x2f17('0x2')]({'name':util[_0x2f17('0x3')](_0x2f17('0x4'),_0x2f17('0x5'),i),'fullname':util['format']('%s%s','agent',i),'email':util[_0x2f17('0x3')]('%s%s@xcally.com','agent',i),'role':_0x2f17('0x5'),'password':_0x2f17('0x6'),'internal':0xfa0+i,'type':_0x2f17('0x7'),'transport':[_0x2f17('0x8'),'ws',_0x2f17('0x9')],'disallow':[_0x2f17('0xa')],'allow':[_0x2f17('0xb')],'defaultuser':util[_0x2f17('0x3')](_0x2f17('0x4'),_0x2f17('0x5'),i),'encryption':_0x2f17('0xc'),'avpf':_0x2f17('0xc'),'force_avp':_0x2f17('0xc'),'icesupport':_0x2f17('0xc'),'dtlsenable':_0x2f17('0xc'),'dtlsverify':'no','dtlscertfile':_0x2f17('0xd'),'dtlsprivatekey':_0x2f17('0xe'),'dtlssetup':_0x2f17('0xf'),'callerid':util['format']('\x22%s\x22\x20<%s>',util['format'](_0x2f17('0x4'),_0x2f17('0x5'),i),0xfa0+i)});}db['User']['bulkCreate'](users)[_0x2f17('0x10')](function(){console[_0x2f17('0x11')]('add\x20user');})[_0x2f17('0x12')](function(_0x22d8f5){console[_0x2f17('0x11')](_0x22d8f5);}); \ No newline at end of file +var _0x17c6=['udp','wss','all','ulaw','yes','/etc/pki/tls/private/motion.key','actpass','User','bulkCreate','log','catch','util','../mysqldb','format','%s%s','agent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x17c6,0x7b));var _0x617c=function(_0x361ec9,_0x38de8f){_0x361ec9=_0x361ec9-0x0;var _0xa1e28c=_0x17c6[_0x361ec9];return _0xa1e28c;};'use strict';var util=require(_0x617c('0x0'));var db=require(_0x617c('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x617c('0x2')](_0x617c('0x3'),_0x617c('0x4'),i),'fullname':util[_0x617c('0x2')](_0x617c('0x3'),'agent',i),'email':util['format']('%s%s@xcally.com',_0x617c('0x4'),i),'role':'agent','password':'password','internal':0xfa0+i,'type':'friend','transport':[_0x617c('0x5'),'ws',_0x617c('0x6')],'disallow':[_0x617c('0x7')],'allow':[_0x617c('0x8')],'defaultuser':util['format'](_0x617c('0x3'),_0x617c('0x4'),i),'encryption':_0x617c('0x9'),'avpf':_0x617c('0x9'),'force_avp':'yes','icesupport':_0x617c('0x9'),'dtlsenable':_0x617c('0x9'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0x617c('0xa'),'dtlssetup':_0x617c('0xb'),'callerid':util[_0x617c('0x2')]('\x22%s\x22\x20<%s>',util[_0x617c('0x2')](_0x617c('0x3'),_0x617c('0x4'),i),0xfa0+i)});}db[_0x617c('0xc')][_0x617c('0xd')](users)['then'](function(){console[_0x617c('0xe')]('add\x20user');})[_0x617c('0xf')](function(_0x14ce32){console[_0x617c('0xe')](_0x14ce32);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index b7b7e42..e0c6905 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe75a=['MailQueues','OpenchannelQueues','WhatsappQueues','findAll','IvrCampaigns','UserProfileResource','map','where','role','format','%s:queue:%s','length','handshake','query','find','userProfileId','ChatInteraction','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','OpenchannelInteractions','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','SmsQueue','MailQueue','OpenchannelQueue','Trunk','Campaign','user','FaxQueues','FaxQueue','SmsQueues','WhatsappQueue','Trunks','getChatQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','user:%s','leave','removeChatInteractions','user_has_chat_interactions:remove','removeMailInteractions','emit','removeFaxInteractions','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','request','remoteAddress','remotePort','SocketIO\x20','nsp','address','disconnect','CONNECTED','util','bluebird','../mysqldb','./environment','Agents','User','name','telephone','agent','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues'];(function(_0xdf5462,_0x66522a){var _0x12bcb0=function(_0x467132){while(--_0x467132){_0xdf5462['push'](_0xdf5462['shift']());}};_0x12bcb0(++_0x66522a);}(_0xe75a,0x115));var _0xae75=function(_0x2aa48b,_0x5a4446){_0x2aa48b=_0x2aa48b-0x0;var _0x48caf8=_0xe75a[_0x2aa48b];return _0x48caf8;};'use strict';var _=require('lodash');var util=require(_0xae75('0x0'));var BPromise=require(_0xae75('0x1'));var db=require(_0xae75('0x2'))['db'];var config=require(_0xae75('0x3'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0xae75('0x4'),'model':db[_0xae75('0x5')],'attributes':['id',_0xae75('0x6'),'role'],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0xae75('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0xae75('0x6')]};var queryAgents={'raw':!![],'attributes':['id',_0xae75('0x6')],'where':{'role':_0xae75('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0xae75('0x9')],'where':{'type':_0xae75('0xa')}};function getAssociatedResources(_0x14712a,_0x2e526c,_0x5ef66c){return db[_0xae75('0xb')][_0xae75('0xc')]({'where':{'name':_0x14712a,'userProfileId':_0x2e526c},'raw':!![]})[_0xae75('0xd')](function(_0xf924a6){if(_0xf924a6){if(_0xf924a6[_0xae75('0xe')]){switch(_0x14712a){case _0xae75('0xf'):case _0xae75('0x10'):case'FaxQueues':case'SmsQueues':case _0xae75('0x11'):case _0xae75('0x12'):case _0xae75('0x13'):return db[_0x5ef66c][_0xae75('0x14')](queryQueues);case'Telephones':return db[_0x5ef66c][_0xae75('0x14')](queryTelephones);case'Trunks':return db[_0x5ef66c][_0xae75('0x14')](queryTrunks);case _0xae75('0x15'):return db[_0x5ef66c][_0xae75('0x14')](queryCampaigns);}}else{return db[_0xae75('0x16')][_0xae75('0x14')]({'attributes':['resourceId'],'where':{'sectionId':_0xf924a6['id']},'raw':!![]})[_0xae75('0xd')](function(_0xf27788){if(_0xf27788){var _0x24275c={'where':{'id':_[_0xae75('0x17')](_0xf27788,'resourceId')},'raw':!![]};switch(_0x5ef66c){case _0xae75('0x5'):_0x24275c[_0xae75('0x18')][_0xae75('0x19')]=_0xae75('0x7');break;case'Campaign':_0x24275c['where'][_0xae75('0x9')]='ivr';break;}return db[_0x5ef66c]['findAll'](_0x24275c);}else{return[];}});}}else{return[];}})['then'](function(_0x51c622){return _0x51c622;});}function joinOrLeaveQueues(_0x3d85c0,_0x537759,_0x155454,_0x2bdb10){_0x3d85c0[_0x537759](util[_0xae75('0x1a')](_0xae75('0x1b'),_0x155454,_0x2bdb10[_0xae75('0x6')]));if(_0x2bdb10[_0xae75('0x4')]){for(var _0x20ab8c=0x0;_0x20ab8c<_0x2bdb10['Agents'][_0xae75('0x1c')];_0x20ab8c+=0x1){_0x3d85c0[_0x537759](util[_0xae75('0x1a')]('user:%s',_0x2bdb10['Agents'][_0x20ab8c][_0xae75('0x6')]));}}}function joinOrLeave(_0x584b41,_0x2303ad,_0x155189){var _0x350ff9;if(_0x584b41[_0xae75('0x1d')][_0xae75('0x1e')]['id']){db[_0xae75('0x5')][_0xae75('0x1f')]({'attributes':['id',_0xae75('0x6'),_0xae75('0x19'),_0xae75('0x20')],'where':{'id':_0x584b41[_0xae75('0x1d')][_0xae75('0x1e')]['id']},'include':[{'model':db[_0xae75('0x21')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xae75('0x22')],'as':_0xae75('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0xae75('0x24')],'as':_0xae75('0x25'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0xae75('0x26'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0xae75('0x27'),'attributes':['id'],'raw':!![]}]})[_0xae75('0xd')](function(_0x3b5437){if(_0x3b5437){_0x350ff9=_0x3b5437;_0x584b41[_0x2303ad](util[_0xae75('0x1a')]('user:%s',_0x3b5437['name']));var _0x3d5838=[];switch(_0x3b5437[_0xae75('0x19')]){case _0xae75('0x28'):_0x584b41[_0x2303ad](_0xae75('0x29'));_0x584b41[_0x2303ad](_0xae75('0x2a'));if(queryQueues[_0xae75('0x2b')]('include')){delete queryQueues[_0xae75('0x2c')];}_0x3d5838[_0xae75('0x2d')](db[_0xae75('0x2e')]['findAll'](queryQueues));_0x3d5838[_0xae75('0x2d')](db[_0xae75('0x2f')][_0xae75('0x14')](queryQueues));_0x3d5838[_0xae75('0x2d')](db['FaxQueue'][_0xae75('0x14')](queryQueues));_0x3d5838[_0xae75('0x2d')](db[_0xae75('0x30')][_0xae75('0x14')](queryQueues));_0x3d5838[_0xae75('0x2d')](db[_0xae75('0x31')]['findAll'](queryQueues));_0x3d5838[_0xae75('0x2d')](db[_0xae75('0x32')][_0xae75('0x14')](queryQueues));_0x3d5838[_0xae75('0x2d')](db['WhatsappQueue'][_0xae75('0x14')](queryQueues));_0x3d5838['push'](db[_0xae75('0x5')]['findAll'](queryTelephones));_0x3d5838[_0xae75('0x2d')](db[_0xae75('0x33')][_0xae75('0x14')](queryTrunks));_0x3d5838[_0xae75('0x2d')](db[_0xae75('0x34')][_0xae75('0x14')](queryCampaigns));_0x3d5838[_0xae75('0x2d')](db[_0xae75('0x5')][_0xae75('0x14')](queryAgents));break;case _0xae75('0x35'):_0x584b41[_0x2303ad](_0xae75('0x29'));_0x584b41[_0x2303ad](_0xae75('0x2a'));_0x3d5838['push'](getAssociatedResources(_0xae75('0xf'),_0x3b5437[_0xae75('0x20')],_0xae75('0x2e')));_0x3d5838['push'](getAssociatedResources(_0xae75('0x10'),_0x3b5437[_0xae75('0x20')],_0xae75('0x2f')));_0x3d5838['push'](getAssociatedResources(_0xae75('0x36'),_0x3b5437[_0xae75('0x20')],_0xae75('0x37')));_0x3d5838[_0xae75('0x2d')](getAssociatedResources(_0xae75('0x38'),_0x3b5437['userProfileId'],_0xae75('0x30')));_0x3d5838[_0xae75('0x2d')](getAssociatedResources(_0xae75('0x11'),_0x3b5437['userProfileId'],_0xae75('0x31')));_0x3d5838['push'](getAssociatedResources(_0xae75('0x12'),_0x3b5437[_0xae75('0x20')],'OpenchannelQueue'));_0x3d5838[_0xae75('0x2d')](getAssociatedResources(_0xae75('0x13'),_0x3b5437[_0xae75('0x20')],_0xae75('0x39')));_0x3d5838[_0xae75('0x2d')](getAssociatedResources('Telephones',_0x3b5437[_0xae75('0x20')],_0xae75('0x5')));_0x3d5838[_0xae75('0x2d')](getAssociatedResources(_0xae75('0x3a'),_0x3b5437[_0xae75('0x20')],_0xae75('0x33')));_0x3d5838[_0xae75('0x2d')](getAssociatedResources(_0xae75('0x15'),_0x3b5437[_0xae75('0x20')],_0xae75('0x34')));_0x3d5838[_0xae75('0x2d')](db[_0xae75('0x5')][_0xae75('0x14')](queryAgents));break;case _0xae75('0x8'):_0x584b41[_0x2303ad]('voice:inbound');_0x584b41[_0x2303ad](_0xae75('0x2a'));_0x3d5838['push'](_0x3b5437['getVoiceQueues']({'attributes':['id',_0xae75('0x6')]}));_0x3d5838[_0xae75('0x2d')](_0x3b5437[_0xae75('0x3b')]({'attributes':['id',_0xae75('0x6')]}));_0x3d5838[_0xae75('0x2d')](_0x3b5437['getFaxQueues']({'attributes':['id',_0xae75('0x6')]}));_0x3d5838[_0xae75('0x2d')](_0x3b5437[_0xae75('0x3c')]({'attributes':['id',_0xae75('0x6')]}));_0x3d5838['push'](_0x3b5437['getMailQueues']({'attributes':['id',_0xae75('0x6')]}));_0x3d5838[_0xae75('0x2d')](_0x3b5437[_0xae75('0x3d')]({'attributes':['id',_0xae75('0x6')]}));_0x3d5838['push'](_0x3b5437[_0xae75('0x3e')]({'attributes':['id',_0xae75('0x6')]}));break;}return BPromise[_0xae75('0x3f')](_0x3d5838);}})[_0xae75('0xd')](function(_0xb7ded7){if(_0xb7ded7&&_0xb7ded7['length']){for(var _0x14bab3=0x0;_0x14bab3<_0xb7ded7['length'];_0x14bab3+=0x1){for(var _0x352b27=0x0;_0x352b27<_0xb7ded7[_0x14bab3]['length'];_0x352b27+=0x1){switch(_0x14bab3){case 0x0:joinOrLeaveQueues(_0x584b41,_0x2303ad,_0xae75('0x40'),_0xb7ded7[_0x14bab3][_0x352b27]);break;case 0x1:joinOrLeaveQueues(_0x584b41,_0x2303ad,_0xae75('0x41'),_0xb7ded7[_0x14bab3][_0x352b27]);break;case 0x2:joinOrLeaveQueues(_0x584b41,_0x2303ad,_0xae75('0x42'),_0xb7ded7[_0x14bab3][_0x352b27]);break;case 0x3:joinOrLeaveQueues(_0x584b41,_0x2303ad,_0xae75('0x43'),_0xb7ded7[_0x14bab3][_0x352b27]);break;case 0x4:joinOrLeaveQueues(_0x584b41,_0x2303ad,'mail',_0xb7ded7[_0x14bab3][_0x352b27]);break;case 0x5:joinOrLeaveQueues(_0x584b41,_0x2303ad,_0xae75('0x44'),_0xb7ded7[_0x14bab3][_0x352b27]);break;case 0x6:joinOrLeaveQueues(_0x584b41,_0x2303ad,_0xae75('0x45'),_0xb7ded7[_0x14bab3][_0x352b27]);break;case 0x7:if(_0x350ff9[_0xae75('0x19')]!==_0xae75('0x8'))_0x584b41[_0x2303ad](util['format'](_0xae75('0x46'),_0xb7ded7[_0x14bab3][_0x352b27][_0xae75('0x6')]));break;case 0x8:if(_0x350ff9['role']!=='agent')_0x584b41[_0x2303ad](util[_0xae75('0x1a')](_0xae75('0x47'),_0xb7ded7[_0x14bab3][_0x352b27][_0xae75('0x6')]));break;case 0x9:if(_0x350ff9[_0xae75('0x19')]!==_0xae75('0x8'))_0x584b41[_0x2303ad](util[_0xae75('0x1a')](_0xae75('0x48'),_0xb7ded7[_0x14bab3][_0x352b27]['type'],_0xb7ded7[_0x14bab3][_0x352b27][_0xae75('0x6')]));break;case 0xa:_0x584b41[_0x2303ad](util[_0xae75('0x1a')](_0xae75('0x49'),_0xb7ded7[_0x14bab3][_0x352b27]['name']));break;}}}}})[_0xae75('0xd')](function(){if(_0x2303ad===_0xae75('0x4a')){var _0x20fc3c=_[_0xae75('0x17')](_0x350ff9['ChatInteractions'],'id');return _0x350ff9[_0xae75('0x4b')](_0x20fc3c)[_0xae75('0xd')](function(){for(var _0x4f79ec=0x0;_0x4f79ec<_0x20fc3c['length'];_0x4f79ec+=0x1){_0x155189['emit'](_0xae75('0x4c'),{'ChatInteractionId':Number(_0x20fc3c[_0x4f79ec]),'UserId':Number(_0x350ff9['id'])});}});}})[_0xae75('0xd')](function(){if(_0x2303ad===_0xae75('0x4a')){var _0x370762=_[_0xae75('0x17')](_0x350ff9[_0xae75('0x23')],'id');return _0x350ff9[_0xae75('0x4d')](_0x370762)[_0xae75('0xd')](function(){for(var _0x209882=0x0;_0x209882<_0x370762['length'];_0x209882+=0x1){_0x155189[_0xae75('0x4e')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x370762[_0x209882]),'UserId':Number(_0x350ff9['id'])});}});}})['then'](function(){if(_0x2303ad===_0xae75('0x4a')){var _0x54d652=_[_0xae75('0x17')](_0x350ff9[_0xae75('0x25')],'id');return _0x350ff9[_0xae75('0x4f')](_0x54d652)[_0xae75('0xd')](function(){for(var _0x11fe8c=0x0;_0x11fe8c<_0x54d652[_0xae75('0x1c')];_0x11fe8c+=0x1){_0x155189['emit'](_0xae75('0x50'),{'FaxInteractionId':Number(_0x54d652[_0x11fe8c]),'UserId':Number(_0x350ff9['id'])});}});}})[_0xae75('0xd')](function(){if(_0x2303ad===_0xae75('0x4a')){var _0x5424d7=_['map'](_0x350ff9[_0xae75('0x51')],'id');return _0x350ff9[_0xae75('0x52')](_0x5424d7)[_0xae75('0xd')](function(){for(var _0x2201a6=0x0;_0x2201a6<_0x5424d7[_0xae75('0x1c')];_0x2201a6+=0x1){_0x155189[_0xae75('0x4e')](_0xae75('0x53'),{'SmsInteractionId':Number(_0x5424d7[_0x2201a6]),'UserId':Number(_0x350ff9['id'])});}});}})[_0xae75('0xd')](function(){if(_0x2303ad===_0xae75('0x4a')){var _0x476f71=_[_0xae75('0x17')](_0x350ff9[_0xae75('0x26')],'id');return _0x350ff9['removeOpenchannelInteractions'](_0x476f71)[_0xae75('0xd')](function(){for(var _0x310ee4=0x0;_0x310ee4<_0x476f71['length'];_0x310ee4+=0x1){_0x155189[_0xae75('0x4e')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x476f71[_0x310ee4]),'UserId':Number(_0x350ff9['id'])});}});}})[_0xae75('0xd')](function(){if(_0x2303ad===_0xae75('0x4a')){var _0x29e966=_['map'](_0x350ff9[_0xae75('0x27')],'id');return _0x350ff9['removeWhatsappInteractions'](_0x29e966)[_0xae75('0xd')](function(){for(var _0x4b53ac=0x0;_0x4b53ac<_0x29e966[_0xae75('0x1c')];_0x4b53ac+=0x1){_0x155189[_0xae75('0x4e')](_0xae75('0x54'),{'WhatsappInteractionId':Number(_0x29e966[_0x4b53ac]),'UserId':Number(_0x350ff9['id'])});}});}})[_0xae75('0x55')](function(_0x2f67ef){_0x584b41[_0xae75('0x56')](_0x2f67ef);});}}function onDisconnect(_0x4c4288,_0x5863f7){joinOrLeave(_0x4c4288,'leave',_0x5863f7);}function onConnect(_0x54b54a){joinOrLeave(_0x54b54a,_0xae75('0x57'));}exports[_0xae75('0x58')]=function(_0x5a086f){_0x5a086f['on'](_0xae75('0x59'),function(_0x4c8e03){_0x4c8e03['setMaxListeners'](0x0);_0x4c8e03['address']=_0x4c8e03[_0xae75('0x5a')][_0xae75('0x59')][_0xae75('0x5b')]+':'+_0x4c8e03['request'][_0xae75('0x59')][_0xae75('0x5c')];_0x4c8e03['connectedAt']=new Date();_0x4c8e03['log']=function(_0x74b0dc){console['log'](_0xae75('0x5d')+_0x4c8e03[_0xae75('0x5e')][_0xae75('0x6')]+'['+_0x4c8e03[_0xae75('0x5f')]+']',_0x74b0dc);};_0x4c8e03['on'](_0xae75('0x60'),function(){onDisconnect(_0x4c8e03,_0x5a086f);_0x4c8e03[_0xae75('0x56')]('DISCONNECTED');});onConnect(_0x4c8e03);_0x4c8e03[_0xae75('0x56')](_0xae75('0x61'));});}; \ No newline at end of file +var _0xd61c=['user:%s','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','hasOwnProperty','include','push','ChatQueue','SmsQueue','MailQueue','OpenchannelQueue','Trunk','user','voice:inbound','voice:outbound','VoiceQueue','ChatQueues','FaxQueues','FaxQueue','WhatsappQueues','WhatsappQueue','Trunks','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_fax_interactions:remove','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','setMaxListeners','address','request','connection','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','lodash','util','bluebird','./environment','Agents','User','name','role','agent','telephone','type','findOne','then','autoAssociation','VoiceQueues','SmsQueues','MailQueues','OpenchannelQueues','findAll','IvrCampaigns','UserProfileResource','resourceId','map','where','Campaign','ivr','%s:queue:%s','length','format'];(function(_0x18d3d2,_0x48809e){var _0x582ee2=function(_0xf047f9){while(--_0xf047f9){_0x18d3d2['push'](_0x18d3d2['shift']());}};_0x582ee2(++_0x48809e);}(_0xd61c,0xb1));var _0xcd61=function(_0x2a94a3,_0xadf636){_0x2a94a3=_0x2a94a3-0x0;var _0x3e6ef5=_0xd61c[_0x2a94a3];return _0x3e6ef5;};'use strict';var _=require(_0xcd61('0x0'));var util=require(_0xcd61('0x1'));var BPromise=require(_0xcd61('0x2'));var db=require('../mysqldb')['db'];var config=require(_0xcd61('0x3'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0xcd61('0x4'),'model':db[_0xcd61('0x5')],'attributes':['id',_0xcd61('0x6'),_0xcd61('0x7')],'raw':!![],'where':{'role':_0xcd61('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xcd61('0x6')],'where':{'role':_0xcd61('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0xcd61('0x6')]};var queryAgents={'raw':!![],'attributes':['id',_0xcd61('0x6')],'where':{'role':_0xcd61('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0xcd61('0xa')],'where':{'type':'ivr'}};function getAssociatedResources(_0x21b332,_0x7c613e,_0x411734){return db['UserProfileSection'][_0xcd61('0xb')]({'where':{'name':_0x21b332,'userProfileId':_0x7c613e},'raw':!![]})[_0xcd61('0xc')](function(_0x2e1a6b){if(_0x2e1a6b){if(_0x2e1a6b[_0xcd61('0xd')]){switch(_0x21b332){case _0xcd61('0xe'):case'ChatQueues':case'FaxQueues':case _0xcd61('0xf'):case _0xcd61('0x10'):case _0xcd61('0x11'):case'WhatsappQueues':return db[_0x411734][_0xcd61('0x12')](queryQueues);case'Telephones':return db[_0x411734]['findAll'](queryTelephones);case'Trunks':return db[_0x411734][_0xcd61('0x12')](queryTrunks);case _0xcd61('0x13'):return db[_0x411734][_0xcd61('0x12')](queryCampaigns);}}else{return db[_0xcd61('0x14')][_0xcd61('0x12')]({'attributes':[_0xcd61('0x15')],'where':{'sectionId':_0x2e1a6b['id']},'raw':!![]})[_0xcd61('0xc')](function(_0x11d8ed){if(_0x11d8ed){var _0x3c2f0c={'where':{'id':_[_0xcd61('0x16')](_0x11d8ed,_0xcd61('0x15'))},'raw':!![]};switch(_0x411734){case _0xcd61('0x5'):_0x3c2f0c[_0xcd61('0x17')][_0xcd61('0x7')]='telephone';break;case _0xcd61('0x18'):_0x3c2f0c[_0xcd61('0x17')][_0xcd61('0xa')]=_0xcd61('0x19');break;}return db[_0x411734][_0xcd61('0x12')](_0x3c2f0c);}else{return[];}});}}else{return[];}})['then'](function(_0x1b7903){return _0x1b7903;});}function joinOrLeaveQueues(_0x4ebfd6,_0xe32a7f,_0x477115,_0x3593cc){_0x4ebfd6[_0xe32a7f](util['format'](_0xcd61('0x1a'),_0x477115,_0x3593cc['name']));if(_0x3593cc[_0xcd61('0x4')]){for(var _0x4b8914=0x0;_0x4b8914<_0x3593cc[_0xcd61('0x4')][_0xcd61('0x1b')];_0x4b8914+=0x1){_0x4ebfd6[_0xe32a7f](util[_0xcd61('0x1c')](_0xcd61('0x1d'),_0x3593cc['Agents'][_0x4b8914]['name']));}}}function joinOrLeave(_0x858c43,_0x5c52c5,_0x5b9cac){var _0x2c9774;if(_0x858c43[_0xcd61('0x1e')][_0xcd61('0x1f')]['id']){db[_0xcd61('0x5')][_0xcd61('0x20')]({'attributes':['id',_0xcd61('0x6'),_0xcd61('0x7'),_0xcd61('0x21')],'where':{'id':_0x858c43[_0xcd61('0x1e')][_0xcd61('0x1f')]['id']},'include':[{'model':db[_0xcd61('0x22')],'as':_0xcd61('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0xcd61('0x24')],'as':_0xcd61('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xcd61('0x26')],'as':_0xcd61('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xcd61('0x28')],'as':_0xcd61('0x29'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0xcd61('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0xcd61('0x2b')],'as':_0xcd61('0x2c'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x5a849b){if(_0x5a849b){_0x2c9774=_0x5a849b;_0x858c43[_0x5c52c5](util[_0xcd61('0x1c')](_0xcd61('0x1d'),_0x5a849b[_0xcd61('0x6')]));var _0x68d602=[];switch(_0x5a849b[_0xcd61('0x7')]){case'admin':_0x858c43[_0x5c52c5]('voice:inbound');_0x858c43[_0x5c52c5]('voice:outbound');if(queryQueues[_0xcd61('0x2d')](_0xcd61('0x2e'))){delete queryQueues[_0xcd61('0x2e')];}_0x68d602[_0xcd61('0x2f')](db['VoiceQueue'][_0xcd61('0x12')](queryQueues));_0x68d602['push'](db[_0xcd61('0x30')][_0xcd61('0x12')](queryQueues));_0x68d602[_0xcd61('0x2f')](db['FaxQueue'][_0xcd61('0x12')](queryQueues));_0x68d602[_0xcd61('0x2f')](db[_0xcd61('0x31')]['findAll'](queryQueues));_0x68d602[_0xcd61('0x2f')](db[_0xcd61('0x32')][_0xcd61('0x12')](queryQueues));_0x68d602[_0xcd61('0x2f')](db[_0xcd61('0x33')]['findAll'](queryQueues));_0x68d602['push'](db['WhatsappQueue']['findAll'](queryQueues));_0x68d602[_0xcd61('0x2f')](db[_0xcd61('0x5')][_0xcd61('0x12')](queryTelephones));_0x68d602['push'](db[_0xcd61('0x34')]['findAll'](queryTrunks));_0x68d602['push'](db['Campaign']['findAll'](queryCampaigns));_0x68d602[_0xcd61('0x2f')](db[_0xcd61('0x5')]['findAll'](queryAgents));break;case _0xcd61('0x35'):_0x858c43[_0x5c52c5](_0xcd61('0x36'));_0x858c43[_0x5c52c5](_0xcd61('0x37'));_0x68d602['push'](getAssociatedResources('VoiceQueues',_0x5a849b[_0xcd61('0x21')],_0xcd61('0x38')));_0x68d602[_0xcd61('0x2f')](getAssociatedResources(_0xcd61('0x39'),_0x5a849b[_0xcd61('0x21')],_0xcd61('0x30')));_0x68d602[_0xcd61('0x2f')](getAssociatedResources(_0xcd61('0x3a'),_0x5a849b[_0xcd61('0x21')],_0xcd61('0x3b')));_0x68d602['push'](getAssociatedResources(_0xcd61('0xf'),_0x5a849b[_0xcd61('0x21')],_0xcd61('0x31')));_0x68d602[_0xcd61('0x2f')](getAssociatedResources(_0xcd61('0x10'),_0x5a849b[_0xcd61('0x21')],_0xcd61('0x32')));_0x68d602[_0xcd61('0x2f')](getAssociatedResources('OpenchannelQueues',_0x5a849b[_0xcd61('0x21')],'OpenchannelQueue'));_0x68d602[_0xcd61('0x2f')](getAssociatedResources(_0xcd61('0x3c'),_0x5a849b[_0xcd61('0x21')],_0xcd61('0x3d')));_0x68d602[_0xcd61('0x2f')](getAssociatedResources('Telephones',_0x5a849b['userProfileId'],_0xcd61('0x5')));_0x68d602[_0xcd61('0x2f')](getAssociatedResources(_0xcd61('0x3e'),_0x5a849b[_0xcd61('0x21')],_0xcd61('0x34')));_0x68d602[_0xcd61('0x2f')](getAssociatedResources(_0xcd61('0x13'),_0x5a849b['userProfileId'],_0xcd61('0x18')));_0x68d602[_0xcd61('0x2f')](db[_0xcd61('0x5')][_0xcd61('0x12')](queryAgents));break;case'agent':_0x858c43[_0x5c52c5](_0xcd61('0x36'));_0x858c43[_0x5c52c5]('voice:outbound');_0x68d602[_0xcd61('0x2f')](_0x5a849b['getVoiceQueues']({'attributes':['id',_0xcd61('0x6')]}));_0x68d602[_0xcd61('0x2f')](_0x5a849b['getChatQueues']({'attributes':['id',_0xcd61('0x6')]}));_0x68d602[_0xcd61('0x2f')](_0x5a849b[_0xcd61('0x3f')]({'attributes':['id',_0xcd61('0x6')]}));_0x68d602[_0xcd61('0x2f')](_0x5a849b[_0xcd61('0x40')]({'attributes':['id',_0xcd61('0x6')]}));_0x68d602[_0xcd61('0x2f')](_0x5a849b[_0xcd61('0x41')]({'attributes':['id',_0xcd61('0x6')]}));_0x68d602[_0xcd61('0x2f')](_0x5a849b[_0xcd61('0x42')]({'attributes':['id',_0xcd61('0x6')]}));_0x68d602[_0xcd61('0x2f')](_0x5a849b[_0xcd61('0x43')]({'attributes':['id',_0xcd61('0x6')]}));break;}return BPromise[_0xcd61('0x44')](_0x68d602);}})['then'](function(_0x4692ca){if(_0x4692ca&&_0x4692ca['length']){for(var _0x2cbda5=0x0;_0x2cbda5<_0x4692ca[_0xcd61('0x1b')];_0x2cbda5+=0x1){for(var _0x314be0=0x0;_0x314be0<_0x4692ca[_0x2cbda5][_0xcd61('0x1b')];_0x314be0+=0x1){switch(_0x2cbda5){case 0x0:joinOrLeaveQueues(_0x858c43,_0x5c52c5,_0xcd61('0x45'),_0x4692ca[_0x2cbda5][_0x314be0]);break;case 0x1:joinOrLeaveQueues(_0x858c43,_0x5c52c5,_0xcd61('0x46'),_0x4692ca[_0x2cbda5][_0x314be0]);break;case 0x2:joinOrLeaveQueues(_0x858c43,_0x5c52c5,_0xcd61('0x47'),_0x4692ca[_0x2cbda5][_0x314be0]);break;case 0x3:joinOrLeaveQueues(_0x858c43,_0x5c52c5,_0xcd61('0x48'),_0x4692ca[_0x2cbda5][_0x314be0]);break;case 0x4:joinOrLeaveQueues(_0x858c43,_0x5c52c5,_0xcd61('0x49'),_0x4692ca[_0x2cbda5][_0x314be0]);break;case 0x5:joinOrLeaveQueues(_0x858c43,_0x5c52c5,_0xcd61('0x4a'),_0x4692ca[_0x2cbda5][_0x314be0]);break;case 0x6:joinOrLeaveQueues(_0x858c43,_0x5c52c5,_0xcd61('0x4b'),_0x4692ca[_0x2cbda5][_0x314be0]);break;case 0x7:if(_0x2c9774[_0xcd61('0x7')]!==_0xcd61('0x8'))_0x858c43[_0x5c52c5](util[_0xcd61('0x1c')](_0xcd61('0x4c'),_0x4692ca[_0x2cbda5][_0x314be0][_0xcd61('0x6')]));break;case 0x8:if(_0x2c9774[_0xcd61('0x7')]!==_0xcd61('0x8'))_0x858c43[_0x5c52c5](util[_0xcd61('0x1c')]('trunk:%s',_0x4692ca[_0x2cbda5][_0x314be0][_0xcd61('0x6')]));break;case 0x9:if(_0x2c9774[_0xcd61('0x7')]!==_0xcd61('0x8'))_0x858c43[_0x5c52c5](util[_0xcd61('0x1c')](_0xcd61('0x4d'),_0x4692ca[_0x2cbda5][_0x314be0][_0xcd61('0xa')],_0x4692ca[_0x2cbda5][_0x314be0][_0xcd61('0x6')]));break;case 0xa:_0x858c43[_0x5c52c5](util[_0xcd61('0x1c')]('user:%s',_0x4692ca[_0x2cbda5][_0x314be0][_0xcd61('0x6')]));break;}}}}})[_0xcd61('0xc')](function(){if(_0x5c52c5===_0xcd61('0x4e')){var _0x33c5b9=_[_0xcd61('0x16')](_0x2c9774[_0xcd61('0x23')],'id');return _0x2c9774[_0xcd61('0x4f')](_0x33c5b9)[_0xcd61('0xc')](function(){for(var _0x57f449=0x0;_0x57f449<_0x33c5b9[_0xcd61('0x1b')];_0x57f449+=0x1){_0x5b9cac[_0xcd61('0x50')](_0xcd61('0x51'),{'ChatInteractionId':Number(_0x33c5b9[_0x57f449]),'UserId':Number(_0x2c9774['id'])});}});}})[_0xcd61('0xc')](function(){if(_0x5c52c5===_0xcd61('0x4e')){var _0x1793d4=_['map'](_0x2c9774[_0xcd61('0x25')],'id');return _0x2c9774[_0xcd61('0x52')](_0x1793d4)['then'](function(){for(var _0x204dbe=0x0;_0x204dbe<_0x1793d4['length'];_0x204dbe+=0x1){_0x5b9cac[_0xcd61('0x50')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x1793d4[_0x204dbe]),'UserId':Number(_0x2c9774['id'])});}});}})[_0xcd61('0xc')](function(){if(_0x5c52c5==='leave'){var _0x5df482=_[_0xcd61('0x16')](_0x2c9774[_0xcd61('0x27')],'id');return _0x2c9774['removeFaxInteractions'](_0x5df482)[_0xcd61('0xc')](function(){for(var _0x42d042=0x0;_0x42d042<_0x5df482[_0xcd61('0x1b')];_0x42d042+=0x1){_0x5b9cac[_0xcd61('0x50')](_0xcd61('0x53'),{'FaxInteractionId':Number(_0x5df482[_0x42d042]),'UserId':Number(_0x2c9774['id'])});}});}})[_0xcd61('0xc')](function(){if(_0x5c52c5==='leave'){var _0x364cd1=_[_0xcd61('0x16')](_0x2c9774[_0xcd61('0x29')],'id');return _0x2c9774['removeSmsInteractions'](_0x364cd1)['then'](function(){for(var _0x417ef9=0x0;_0x417ef9<_0x364cd1[_0xcd61('0x1b')];_0x417ef9+=0x1){_0x5b9cac[_0xcd61('0x50')](_0xcd61('0x54'),{'SmsInteractionId':Number(_0x364cd1[_0x417ef9]),'UserId':Number(_0x2c9774['id'])});}});}})['then'](function(){if(_0x5c52c5===_0xcd61('0x4e')){var _0x2c8c4a=_[_0xcd61('0x16')](_0x2c9774[_0xcd61('0x2a')],'id');return _0x2c9774[_0xcd61('0x55')](_0x2c8c4a)[_0xcd61('0xc')](function(){for(var _0x1c2068=0x0;_0x1c2068<_0x2c8c4a['length'];_0x1c2068+=0x1){_0x5b9cac[_0xcd61('0x50')](_0xcd61('0x56'),{'OpenchannelInteractionId':Number(_0x2c8c4a[_0x1c2068]),'UserId':Number(_0x2c9774['id'])});}});}})[_0xcd61('0xc')](function(){if(_0x5c52c5==='leave'){var _0x186e7d=_['map'](_0x2c9774[_0xcd61('0x2c')],'id');return _0x2c9774[_0xcd61('0x57')](_0x186e7d)[_0xcd61('0xc')](function(){for(var _0x5002fe=0x0;_0x5002fe<_0x186e7d['length'];_0x5002fe+=0x1){_0x5b9cac[_0xcd61('0x50')](_0xcd61('0x58'),{'WhatsappInteractionId':Number(_0x186e7d[_0x5002fe]),'UserId':Number(_0x2c9774['id'])});}});}})[_0xcd61('0x59')](function(_0x460152){_0x858c43[_0xcd61('0x5a')](_0x460152);});}}function onDisconnect(_0x361815,_0x5600ac){joinOrLeave(_0x361815,_0xcd61('0x4e'),_0x5600ac);}function onConnect(_0x14f10b){joinOrLeave(_0x14f10b,_0xcd61('0x5b'));}exports[_0xcd61('0x5c')]=function(_0x392e61){_0x392e61['on']('connection',function(_0x3a9462){_0x3a9462[_0xcd61('0x5d')](0x0);_0x3a9462[_0xcd61('0x5e')]=_0x3a9462[_0xcd61('0x5f')][_0xcd61('0x60')][_0xcd61('0x61')]+':'+_0x3a9462[_0xcd61('0x5f')][_0xcd61('0x60')][_0xcd61('0x62')];_0x3a9462[_0xcd61('0x63')]=new Date();_0x3a9462[_0xcd61('0x5a')]=function(_0x3e7cab){console['log'](_0xcd61('0x64')+_0x3a9462[_0xcd61('0x65')][_0xcd61('0x6')]+'['+_0x3a9462[_0xcd61('0x5e')]+']',_0x3e7cab);};_0x3a9462['on'](_0xcd61('0x66'),function(){onDisconnect(_0x3a9462,_0x392e61);_0x3a9462[_0xcd61('0x5a')]('DISCONNECTED');});onConnect(_0x3a9462);_0x3a9462['log']('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 375cc93..09a0041 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 _0xb635=['Fax','FaxInteraction','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','request','EventManager','then','Trigger,\x20%s','error','catch','get','event','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','query','Sequelize','QueryTypes','contact','find','UserId','name','fullname','email','interface','format','agent','incomingmessage','outgoingmessage','opened','SELECT','changed','closed','internal','SIP/%s','length','hasOwnProperty','model','hook','callback','channel','condition','jayson/promise','triggers','client','http','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','closedinteraction','ChatMessage','Sms','SmsInteraction','WhatsappInteraction','Whatsapp','WhatsappMessage','newmessage'];(function(_0x196dc5,_0x50be9d){var _0x56458e=function(_0x5bd98b){while(--_0x5bd98b){_0x196dc5['push'](_0x196dc5['shift']());}};_0x56458e(++_0x50be9d);}(_0xb635,0x125));var _0x5b63=function(_0x4ba971,_0x328ae6){_0x4ba971=_0x4ba971-0x0;var _0x1a2d01=_0xb635[_0x4ba971];return _0x1a2d01;};'use strict';var util=require('util');var db=require('../../mysqldb')['db'];var jayson=require(_0x5b63('0x0'));var logger=require('../logger')(_0x5b63('0x1'));var _=require('lodash');var client=jayson[_0x5b63('0x2')][_0x5b63('0x3')]({'port':0x232a});var triggers=[{'channel':_0x5b63('0x4'),'model':_0x5b63('0x5'),'event':_0x5b63('0x6'),'condition':_0x5b63('0x7'),'callback':afterCreate},{'channel':_0x5b63('0x4'),'model':_0x5b63('0x5'),'event':_0x5b63('0x8'),'condition':_0x5b63('0x9'),'callback':afterUpdate},{'channel':'Chat','model':_0x5b63('0xa'),'event':_0x5b63('0x6'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x5b63('0xb'),'model':_0x5b63('0xc'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':'Sms','model':'SmsInteraction','event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0x5b63('0xb'),'model':'SmsMessage','event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':'Whatsapp','model':_0x5b63('0xd'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0x5b63('0xe'),'model':_0x5b63('0xd'),'event':_0x5b63('0x8'),'condition':_0x5b63('0x9'),'callback':afterUpdate},{'channel':_0x5b63('0xe'),'model':_0x5b63('0xf'),'event':_0x5b63('0x6'),'condition':_0x5b63('0x10'),'callback':afterCreateMessage},{'channel':_0x5b63('0x11'),'model':_0x5b63('0x12'),'event':_0x5b63('0x6'),'condition':_0x5b63('0x7'),'callback':afterCreate},{'channel':'Fax','model':_0x5b63('0x12'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0x5b63('0x11'),'model':'FaxMessage','event':_0x5b63('0x6'),'condition':_0x5b63('0x10'),'callback':afterCreateMessage},{'channel':_0x5b63('0x13'),'model':'MailInteraction','event':_0x5b63('0x6'),'condition':_0x5b63('0x7'),'callback':afterCreate},{'channel':'Mail','model':_0x5b63('0x14'),'event':_0x5b63('0x8'),'condition':_0x5b63('0x9'),'callback':afterUpdate},{'channel':_0x5b63('0x13'),'model':_0x5b63('0x15'),'event':_0x5b63('0x6'),'condition':_0x5b63('0x10'),'callback':afterCreateMessage},{'channel':_0x5b63('0x16'),'model':_0x5b63('0x17'),'event':_0x5b63('0x6'),'condition':_0x5b63('0x7'),'callback':afterCreate},{'channel':_0x5b63('0x16'),'model':_0x5b63('0x17'),'event':_0x5b63('0x8'),'condition':_0x5b63('0x9'),'callback':afterUpdate},{'channel':'Openchannel','model':'OpenchannelMessage','event':_0x5b63('0x6'),'condition':_0x5b63('0x10'),'callback':afterCreateMessage}];function request(_0x1a400b){return client[_0x5b63('0x18')](_0x5b63('0x19'),_0x1a400b)[_0x5b63('0x1a')](function(_0x4bbb33){logger['info'](_0x5b63('0x1b'),'EventManager',_0x4bbb33);if(_0x4bbb33[_0x5b63('0x1c')]){if(_0x4bbb33[_0x5b63('0x1c')]['code']===0x1f4){logger[_0x5b63('0x1c')](_0x5b63('0x1b'),_0x5b63('0x19'),_0x4bbb33['error']);}}})[_0x5b63('0x1d')](function(_0x55a92c){logger['error']('Trigger,\x20%s',_0x5b63('0x19'),_0x55a92c);});}function afterCreateMessage(_0x59a46a,_0x329dfd){return function(_0x449bb9,_0x280923){_0x449bb9=_0x449bb9[_0x5b63('0x1e')]({'plain':!![]});_0x449bb9['channel']=_0x59a46a;_0x449bb9[_0x5b63('0x1f')]=_0x449bb9['direction'];var _0x3cc70c=_0x5b63('0x20')+_0x449bb9[_0x5b63('0x21')];return db[_0x5b63('0x22')][_0x5b63('0x23')](_0x3cc70c,{'type':db[_0x5b63('0x24')][_0x5b63('0x25')]['SELECT'],'raw':!![]})[_0x5b63('0x1a')](function(_0x4c8362){return _0x4c8362;})['then'](function(_0x19c866){if(_0x19c866){_0x449bb9[_0x5b63('0x26')]=_0x19c866[0x0];}if(_0x449bb9['UserId']){return db['User'][_0x5b63('0x27')]({'where':{'id':_0x449bb9[_0x5b63('0x28')]},'attributes':['id',_0x5b63('0x29'),_0x5b63('0x2a'),_0x5b63('0x2b'),'internal'],'raw':!![]})[_0x5b63('0x1a')](function(_0x1dca94){_0x449bb9[_0x5b63('0x2c')]=util[_0x5b63('0x2d')]('SIP/%s',_0x1dca94[_0x5b63('0x29')]);_0x449bb9['channel']=_0x59a46a;_0x449bb9[_0x5b63('0x2e')]=_0x1dca94;return request({'event':_0x5b63('0x2f'),'message':_0x449bb9});})[_0x5b63('0x1d')](function(_0x230797){console['error'](_0x230797);});}else{return request({'event':_0x5b63('0x30'),'message':_0x449bb9});}});};}function afterCreate(_0x513f97,_0x1c46b6){return function(_0x299d26,_0x12c736){_0x299d26=_0x299d26['get']({'plain':!![]});_0x299d26['channel']=_0x513f97;_0x299d26[_0x5b63('0x1f')]=_0x5b63('0x31');var _0x564dd2=_0x5b63('0x20')+_0x299d26[_0x5b63('0x21')];return db[_0x5b63('0x22')][_0x5b63('0x23')](_0x564dd2,{'type':db[_0x5b63('0x24')][_0x5b63('0x25')][_0x5b63('0x32')],'raw':!![]})[_0x5b63('0x1a')](function(_0x279977){return _0x279977;})['then'](function(_0x1b82fd){if(_0x1b82fd){_0x299d26[_0x5b63('0x26')]=_0x1b82fd[0x0];}return request({'event':_0x1c46b6,'message':_0x299d26});});};}function afterUpdate(_0x5716d0,_0xf0b564){return function(_0x65392a,_0x1a4cfd){if(_0x65392a[_0x5b63('0x33')](_0x5b63('0x34'))&&_0x65392a[_0x5b63('0x34')]){_0x65392a=_0x65392a[_0x5b63('0x1e')]({'plain':!![]});_0x65392a['channel']=_0x5716d0;_0x65392a['event']=_0x5b63('0x34');var _0x238b8d=_0x5b63('0x20')+_0x65392a['ContactId'];return db[_0x5b63('0x22')]['query'](_0x238b8d,{'type':db[_0x5b63('0x24')][_0x5b63('0x25')][_0x5b63('0x32')],'raw':!![]})[_0x5b63('0x1a')](function(_0x1b0b9e){return _0x1b0b9e;})[_0x5b63('0x1a')](function(_0x4ab4d9){if(_0x4ab4d9){_0x65392a[_0x5b63('0x26')]=_0x4ab4d9[0x0];}if(_0x65392a[_0x5b63('0x28')]){return db['User'][_0x5b63('0x27')]({'where':{'id':_0x65392a['UserId']},'attributes':['id',_0x5b63('0x29'),_0x5b63('0x2a'),_0x5b63('0x2b'),_0x5b63('0x35')],'raw':!![]})[_0x5b63('0x1a')](function(_0x147ea0){_0x65392a['interface']=util['format'](_0x5b63('0x36'),_0x147ea0[_0x5b63('0x29')]);_0x65392a[_0x5b63('0x2e')]=_0x147ea0;return request({'event':_0xf0b564,'message':_0x65392a});})[_0x5b63('0x1d')](function(_0xf87369){console['error'](_0xf87369);});}else{return request({'event':_0xf0b564,'message':_0x65392a});}});}};}exports['default']=function(){for(var _0x4e29c4=0x0;_0x4e29c4=_0x46aaf0[_0xa01c('0x16')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x44ebd0(_0x530f0a);})[_0xa01c('0x17')](function(_0x2bff80){_0x433b50(_0x2bff80);});});}; \ No newline at end of file +var _0x9d10=['User','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','./license/util','mail','sms','openchannel','getChannels','toLowerCase','includes','clearBlockUser','isUndefined','updateAttributes','getLicense','role','agent'];(function(_0x55dc36,_0x57d989){var _0x28f1e9=function(_0x3eb6f8){while(--_0x3eb6f8){_0x55dc36['push'](_0x55dc36['shift']());}};_0x28f1e9(++_0x57d989);}(_0x9d10,0xf6));var _0x09d1=function(_0x264c09,_0x5dd685){_0x264c09=_0x264c09-0x0;var _0x423abc=_0x9d10[_0x264c09];return _0x423abc;};'use strict';var _=require(_0x09d1('0x0'));var BPromise=require('bluebird');var db=require('../mysqldb')['db'];var util=require(_0x09d1('0x1'));var channels=['voice',_0x09d1('0x2'),'chat','fax',_0x09d1('0x3'),'whatsapp',_0x09d1('0x4')];exports[_0x09d1('0x5')]=function(){return channels;};exports['isValidChannel']=function(_0x37a5f7){_0x37a5f7=_0x37a5f7[_0x09d1('0x6')]();return _[_0x09d1('0x7')](channels,_0x37a5f7);};exports[_0x09d1('0x8')]=function(_0x50593c,_0x2c3124,_0x528175,_0x281472){var _0x3633b0={'loginAttempts':_0x2c3124,'blocked':_0x528175};if(!_[_0x09d1('0x9')](_0x281472)){_0x3633b0['blockedAt']=_0x281472;}return _0x50593c[_0x09d1('0xa')](_0x3633b0);};exports[_0x09d1('0xb')]=function(_0x3ddee0){return new BPromise(function(_0x4d4927,_0x3fbdb1){var _0x59fe1e=0x0;if(_0x3ddee0[_0x09d1('0xc')]!==_0x09d1('0xd')){_0x4d4927(_0x3ddee0);}db[_0x09d1('0xe')][_0x09d1('0xf')]({'where':{'role':_0x09d1('0xd'),'online':!![],'id':{'$ne':_0x3ddee0['id']}}})[_0x09d1('0x10')](function(_0x19a460){_0x59fe1e=_0x19a460;return util[_0x09d1('0xb')]();})['then'](function(_0x2e0b5c){if(_0x2e0b5c&&_0x2e0b5c[_0x09d1('0x11')]&&_0x59fe1e>=_0x2e0b5c[_0x09d1('0x11')]){throw Error(_0x09d1('0x12'));}_0x4d4927(_0x3ddee0);})[_0x09d1('0x13')](function(_0x5dd422){_0x3fbdb1(_0x5dd422);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index b35b889..22956b4 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xecb9=['exports','404','status','render','json','send'];(function(_0x49bdc4,_0x1e2507){var _0x1f7437=function(_0x25a9f9){while(--_0x25a9f9){_0x49bdc4['push'](_0x49bdc4['shift']());}};_0x1f7437(++_0x1e2507);}(_0xecb9,0x90));var _0x9ecb=function(_0x5100bc,_0x35e471){_0x5100bc=_0x5100bc-0x0;var _0x1d6ec6=_0xecb9[_0x5100bc];return _0x1d6ec6;};'use strict';module[_0x9ecb('0x0')][0x194]=function pageNotFound(_0x11813b,_0x22fbc9){var _0x26335b=_0x9ecb('0x1');var _0x40ec2a=0x194;var _0x4d88bf={'status':_0x40ec2a};_0x22fbc9[_0x9ecb('0x2')](_0x4d88bf[_0x9ecb('0x2')]);_0x22fbc9[_0x9ecb('0x3')](_0x26335b,{},function(_0x1110ac,_0x71b55c){if(_0x1110ac){return _0x22fbc9[_0x9ecb('0x2')](_0x4d88bf[_0x9ecb('0x2')])[_0x9ecb('0x4')](_0x4d88bf);}_0x22fbc9[_0x9ecb('0x5')](_0x71b55c);});}; \ No newline at end of file +var _0x422f=['status','render','json','404'];(function(_0x43941d,_0x45fd0d){var _0x27b82a=function(_0x21851e){while(--_0x21851e){_0x43941d['push'](_0x43941d['shift']());}};_0x27b82a(++_0x45fd0d);}(_0x422f,0x1c7));var _0xf422=function(_0x439a53,_0x51e060){_0x439a53=_0x439a53-0x0;var _0x2736e8=_0x422f[_0x439a53];return _0x2736e8;};'use strict';module['exports'][0x194]=function pageNotFound(_0x2f2781,_0x4c7d20){var _0x4566ff=_0xf422('0x0');var _0x55031a=0x194;var _0x23acfa={'status':_0x55031a};_0x4c7d20[_0xf422('0x1')](_0x23acfa[_0xf422('0x1')]);_0x4c7d20[_0xf422('0x2')](_0x4566ff,{},function(_0x16047c,_0x434f27){if(_0x16047c){return _0x4c7d20[_0xf422('0x1')](_0x23acfa[_0xf422('0x1')])[_0xf422('0x3')](_0x23acfa);}_0x4c7d20['send'](_0x434f27);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 8697663..699f37b 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x063d=['mysql','username','options','database','password','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailQueue','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','CmContact','CmHopper','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','../api/action/action.model','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','VoiceQueuesLog','Schedule','Tag','Template','../api/template/template.model','Integration','../api/integrationReport/integrationReport.model','AnalyticCustomReport','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','DeskField','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','Campaign','Migration','../api/migration/migration.model','Attachment','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','CloudProvider','../api/cloudProvider/cloudProvider.model','../api/teamVoiceQueue/teamVoiceQueue.model','hasOne','cascade','UserId','hasMany','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','OpenchannelInteraction','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotifications','userProfileId','Groups','chat_group_has_users','belongsToMany','cm_user_has_contacts','Lists','user_has_teams','user_has_mail_interactions','user_has_fax_interactions','SmsInteraction','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueue','MailQueues','ChatQueues','UserChatQueue','FaxQueues','SmsQueue','SmsQueues','OpenchannelQueues','WhatsappQueues','VoicePrefix','VoicePrefixes','ChatWebsites','user_has_chat_websites','FaxAccounts','MailAccount','OpenchannelAccount','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','Sound','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperHistories','Trunk','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','Agents','Teams','TeamVoiceQueue','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','VoiceCallReport','ContactId','MailAccountId','Imap','Smtp','Dispositions','Answers','Interactions','ListId','TemplateId','user_has_mail_accounts','MailInteractionId','Account','Contact','Owner','mail_interaction_has_tags','Tags','ThroughTags','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessage','ChatOfflineMessageId','restrict','TagId','Items','FaxAccountId','List','mandatoryDispositionPause','mandatoryDispositionPauseId','user_has_fax_accounts','FaxInteractionId','fax_interaction_has_tags','AttachmentId','UserFaxQueue','team_has_fax_queues','FaxQueueReport','Disposition','SmsAccountId','user_has_sms_accounts','sms_interaction_has_tags','Users','user_has_sms_interactions','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ChatApplication','ChatMessage','OpenchannelQueueReport','Agent','Queue','Website','chat_interaction_has_tags','user_has_chat_interactions','ChatInteractionId','team_has_chat_queues','ChatGroupId','Contacts','CompanyId','JscriptySessions','OwnerId','CampaignId','Automation','Condition','All','OneAll','Any','Actions','AutomationId','ParentId','Intervals','MailApplications','FaxApplications','DefaultReportId','CustomReportId','VoiceMusicOnHold','Mohs','cm_contact_has_tags','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','Trigger','AllConditions','AllCondition','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','AnalyticMetric','Fields','MetricId','Configurations','Subjects','SubjectId','DescriptionId','AccountId','Subject','Field','Variable','VariableId','FieldId','Descriptions','DeskAccount','int_desk_configuration_has_tags','Description','ZohoField','int_freshdesk_configuration_has_tags','ServicenowAccount','ServicenowField','Dynamics365Field','FromId','JscriptyQuestionReport','ProjectId','team_has_mail_queues','team_has_whatsapp_queues','HopperBlacks','SquareProjectId','campaigns_has_cm_lists','FromMailAccountId','FromAccount','FromUserId','ToUserId','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ChatTransferReport','FromChatWebsiteId','FromAgent','ToAgent','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','OpenchannelTransferReport','ToOpenchannelQueueId','ToOpenchannelAccountId','ToSmsQueueId','Queues','voice_queues_has_cm_lists','UserProfileSections','sectionId','WhatsappAccountId','WhatsappMessage','WhatsappInteractionId','FromWhatsappAccountId','ToQueueId','WhatsappQueueId','lodash','jstz','determine','sequelize','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','sequelizeHistory','defaultsDeep'];(function(_0x28a139,_0xa0c1d2){var _0x5547ed=function(_0x53e5b6){while(--_0x53e5b6){_0x28a139['push'](_0x28a139['shift']());}};_0x5547ed(++_0xa0c1d2);}(_0x063d,0x1d4));var _0xd063=function(_0x5221da,_0x20888b){_0x5221da=_0x5221da-0x0;var _0x590256=_0x063d[_0x5221da];return _0x590256;};'use strict';var config=require('../config/environment');var Sequelize=require('sequelize');var _=require(_0xd063('0x0'));var jstz=require(_0xd063('0x1'));var timezone=jstz[_0xd063('0x2')]();config[_0xd063('0x3')]=_['defaultsDeep'](config[_0xd063('0x3')],{'database':_0xd063('0x4'),'username':_0xd063('0x5'),'password':_0xd063('0x6'),'options':{'host':_0xd063('0x7'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0xd063('0x8')},'logging':![],'timezone':timezone[_0xd063('0x9')](),'define':{'charset':_0xd063('0xa'),'collate':'utf8_general_ci'}}});config[_0xd063('0xb')]=_[_0xd063('0xc')](config[_0xd063('0xb')],{'database':_0xd063('0x4'),'username':_0xd063('0x5'),'password':_0xd063('0x6'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xd063('0xd'),'dialectOptions':{'charset':_0xd063('0x8')},'logging':![],'timezone':timezone[_0xd063('0x9')](),'define':{'charset':_0xd063('0xa'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0xd063('0x3')][_0xd063('0xe')],config['sequelize']['password'],config[_0xd063('0x3')][_0xd063('0xf')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xd063('0xb')][_0xd063('0x10')],config[_0xd063('0xb')][_0xd063('0xe')],config[_0xd063('0xb')][_0xd063('0x11')],config['sequelizeHistory']['options'])};db[_0xd063('0x12')]=db['sequelize'][_0xd063('0x13')](_0xd063('0x14'));db[_0xd063('0x15')]=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0x16'));db[_0xd063('0x17')]=db['sequelize'][_0xd063('0x13')](_0xd063('0x18'));db[_0xd063('0x19')]=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0x1a'));db['VoiceMusicOnHold']=db[_0xd063('0x3')]['import'](_0xd063('0x1b'));db['VoiceQueue']=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0x1c'));db[_0xd063('0x1d')]=db['sequelize'][_0xd063('0x13')](_0xd063('0x1e'));db[_0xd063('0x1f')]=db['sequelize'][_0xd063('0x13')]('../api/screenRecording/screenRecording.model');db[_0xd063('0x20')]=db[_0xd063('0x3')]['import'](_0xd063('0x21'));db[_0xd063('0x22')]=db['sequelize'][_0xd063('0x13')](_0xd063('0x23'));db['VoiceCallReport']=db['sequelize'][_0xd063('0x13')]('../api/voiceCallReport/voiceCallReport.model');db[_0xd063('0x24')]=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0x25'));db[_0xd063('0x26')]=db[_0xd063('0x3')]['import'](_0xd063('0x27'));db[_0xd063('0x28')]=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0x29'));db[_0xd063('0x2a')]=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0x2b'));db['Trunk']=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0x2c'));db['VoiceTransferReport']=db['sequelize'][_0xd063('0x13')](_0xd063('0x2d'));db[_0xd063('0x2e')]=db['sequelize'][_0xd063('0x13')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0xd063('0x2f')]=db[_0xd063('0x3')]['import'](_0xd063('0x30'));db['UserChatQueue']=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0x31'));db[_0xd063('0x32')]=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0x33'));db['UserFaxQueue']=db['sequelize']['import'](_0xd063('0x34'));db[_0xd063('0x35')]=db[_0xd063('0x3')][_0xd063('0x13')]('../api/userSmsQueue/userSmsQueue.model');db[_0xd063('0x36')]=db['sequelize']['import']('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0xd063('0x37')]=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0x38'));db[_0xd063('0x39')]=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0x3a'));db[_0xd063('0x3b')]=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0x3c'));db['MailAccount']=db[_0xd063('0x3')][_0xd063('0x13')]('../api/mailAccount/mailAccount.model');db[_0xd063('0x3d')]=db[_0xd063('0x3')][_0xd063('0x13')]('../api/mailQueue/mailQueue.model');db[_0xd063('0x3e')]=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0x3f'));db[_0xd063('0x40')]=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0x41'));db[_0xd063('0x42')]=db['sequelize']['import'](_0xd063('0x43'));db[_0xd063('0x44')]=db['sequelize'][_0xd063('0x13')](_0xd063('0x45'));db[_0xd063('0x46')]=db[_0xd063('0x3')][_0xd063('0x13')]('../api/mailQueueReport/mailQueueReport.model');db[_0xd063('0x47')]=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0x48'));db[_0xd063('0x49')]=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0x4a'));db[_0xd063('0x4b')]=db[_0xd063('0x3')][_0xd063('0x13')]('../api/faxAccount/faxAccount.model');db[_0xd063('0x4c')]=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0x4d'));db[_0xd063('0x4e')]=db[_0xd063('0x3')]['import'](_0xd063('0x4f'));db[_0xd063('0x50')]=db[_0xd063('0x3')]['import'](_0xd063('0x51'));db[_0xd063('0x52')]=db[_0xd063('0x3')][_0xd063('0x13')]('../api/faxQueue/faxQueue.model');db['FaxQueueReport']=db[_0xd063('0x3')][_0xd063('0x13')]('../api/faxQueueReport/faxQueueReport.model');db[_0xd063('0x53')]=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0x54'));db[_0xd063('0x55')]=db['sequelize'][_0xd063('0x13')]('../api/smsApplication/smsApplication.model');db['SmsInteraction']=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0x56'));db[_0xd063('0x57')]=db[_0xd063('0x3')]['import']('../api/smsMessage/smsMessage.model');db['SmsQueue']=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0x58'));db['OpenchannelAccount']=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0x59'));db[_0xd063('0x5a')]=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0x5b'));db['OpenchannelInteraction']=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0x5c'));db[_0xd063('0x5d')]=db['sequelize'][_0xd063('0x13')](_0xd063('0x5e'));db[_0xd063('0x5f')]=db[_0xd063('0x3')]['import'](_0xd063('0x60'));db[_0xd063('0x61')]=db[_0xd063('0x3')][_0xd063('0x13')]('../api/chatWebsite/chatWebsite.model');db['OpenchannelQueueReport']=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0x62'));db['ChatApplication']=db['sequelize'][_0xd063('0x13')](_0xd063('0x63'));db[_0xd063('0x64')]=db['sequelize']['import'](_0xd063('0x65'));db['ChatMessage']=db['sequelize'][_0xd063('0x13')](_0xd063('0x66'));db['ChatOfflineMessage']=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0x67'));db[_0xd063('0x68')]=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0x69'));db[_0xd063('0x6a')]=db[_0xd063('0x3')][_0xd063('0x13')]('../api/chatGroup/chatGroup.model');db['ChatProactiveAction']=db['sequelize'][_0xd063('0x13')](_0xd063('0x6b'));db[_0xd063('0x6c')]=db[_0xd063('0x3')]['import']('../api/cmCompany/cmCompany.model');db[_0xd063('0x6d')]=db[_0xd063('0x3')][_0xd063('0x13')]('../api/cmContact/cmContact.model');db[_0xd063('0x6e')]=db[_0xd063('0x3')]['import']('../api/cmHopper/cmHopper.model');db[_0xd063('0x6f')]=db[_0xd063('0x3')]['import'](_0xd063('0x70'));db[_0xd063('0x71')]=db['sequelize'][_0xd063('0x13')](_0xd063('0x72'));db[_0xd063('0x73')]=db['sequelize'][_0xd063('0x13')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0xd063('0x74')]=db['sequelize']['import'](_0xd063('0x75'));db[_0xd063('0x76')]=db[_0xd063('0x3')][_0xd063('0x13')]('../api/cmCustomField/cmCustomField.model');db[_0xd063('0x77')]=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0x78'));db['Automation']=db['sequelize'][_0xd063('0x13')](_0xd063('0x79'));db[_0xd063('0x7a')]=db[_0xd063('0x3')]['import'](_0xd063('0x7b'));db['Disposition']=db['sequelize'][_0xd063('0x13')]('../api/disposition/disposition.model');db['Condition']=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0x7c'));db[_0xd063('0x7d')]=db['sequelize'][_0xd063('0x13')](_0xd063('0x7e'));db[_0xd063('0x7f')]=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0x80'));db['Cdr']=db[_0xd063('0x3')][_0xd063('0x13')]('../api/cdr/cdr.model');db[_0xd063('0x81')]=db[_0xd063('0x3')][_0xd063('0x13')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0xd063('0x82')]=db[_0xd063('0x3')][_0xd063('0x13')]('../api/schedule/schedule.model');db['Sound']=db[_0xd063('0x3')][_0xd063('0x13')]('../api/sound/sound.model');db[_0xd063('0x83')]=db['sequelize'][_0xd063('0x13')]('../api/tag/tag.model');db[_0xd063('0x84')]=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0x85'));db['Trigger']=db['sequelize'][_0xd063('0x13')]('../api/trigger/trigger.model');db['Variable']=db[_0xd063('0x3')][_0xd063('0x13')]('../api/variable/variable.model');db[_0xd063('0x86')]=db[_0xd063('0x3')][_0xd063('0x13')]('../api/integration/integration.model');db['IntegrationReport']=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0x87'));db[_0xd063('0x88')]=db[_0xd063('0x3')][_0xd063('0x13')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0xd063('0x89')]=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0x8a'));db[_0xd063('0x8b')]=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0x8c'));db['AnalyticMetric']=db['sequelize'][_0xd063('0x13')](_0xd063('0x8d'));db[_0xd063('0x8e')]=db['sequelize'][_0xd063('0x13')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0xd063('0x8f')]=db['sequelize'][_0xd063('0x13')](_0xd063('0x90'));db[_0xd063('0x91')]=db[_0xd063('0x3')]['import'](_0xd063('0x92'));db[_0xd063('0x93')]=db[_0xd063('0x3')][_0xd063('0x13')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0xd063('0x94')]=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0x95'));db[_0xd063('0x96')]=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0x97'));db[_0xd063('0x98')]=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0x99'));db[_0xd063('0x9a')]=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0x9b'));db['DeskAccount']=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0x9c'));db[_0xd063('0x9d')]=db[_0xd063('0x3')][_0xd063('0x13')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0xd063('0x9e')]=db[_0xd063('0x3')][_0xd063('0x13')]('../api/intDeskField/intDeskField.model');db[_0xd063('0x9f')]=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0xa0'));db[_0xd063('0xa1')]=db['sequelize']['import'](_0xd063('0xa2'));db['ZohoField']=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0xa3'));db[_0xd063('0xa4')]=db[_0xd063('0x3')]['import'](_0xd063('0xa5'));db[_0xd063('0xa6')]=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0xa7'));db[_0xd063('0xa8')]=db[_0xd063('0x3')][_0xd063('0x13')]('../api/intZendeskField/intZendeskField.model');db[_0xd063('0xa9')]=db[_0xd063('0x3')]['import'](_0xd063('0xaa'));db[_0xd063('0xab')]=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0xac'));db[_0xd063('0xad')]=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0xae'));db[_0xd063('0xaf')]=db['sequelize'][_0xd063('0x13')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0xd063('0xb0')]=db['sequelize']['import'](_0xd063('0xb1'));db[_0xd063('0xb2')]=db[_0xd063('0x3')]['import'](_0xd063('0xb3'));db['ServicenowAccount']=db['sequelize'][_0xd063('0x13')](_0xd063('0xb4'));db[_0xd063('0xb5')]=db['sequelize'][_0xd063('0x13')](_0xd063('0xb6'));db['ServicenowField']=db['sequelize'][_0xd063('0x13')](_0xd063('0xb7'));db[_0xd063('0xb8')]=db[_0xd063('0x3')]['import'](_0xd063('0xb9'));db[_0xd063('0xba')]=db[_0xd063('0x3')][_0xd063('0x13')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db['Dynamics365Field']=db['sequelize'][_0xd063('0x13')](_0xd063('0xbb'));db[_0xd063('0xbc')]=db[_0xd063('0x3')][_0xd063('0x13')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0xd063('0xbd')]=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0xbe'));db[_0xd063('0xbf')]=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0xc0'));db[_0xd063('0x86')]=db['sequelize'][_0xd063('0x13')]('../api/integration/integration.model');db['Network']=db['sequelize'][_0xd063('0x13')](_0xd063('0xc1'));db[_0xd063('0xc2')]=db['sequelize'][_0xd063('0x13')](_0xd063('0xc3'));db[_0xd063('0xc4')]=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0xc5'));db[_0xd063('0xc6')]=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0xc7'));db['JscriptyQuestionReport']=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0xc8'));db[_0xd063('0xc9')]=db['sequelize'][_0xd063('0x13')](_0xd063('0xca'));db[_0xd063('0xcb')]=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0xcc'));db['SquareReport']=db['sequelize'][_0xd063('0x13')](_0xd063('0xcd'));db[_0xd063('0xce')]=db['sequelize']['import'](_0xd063('0xcf'));db[_0xd063('0xd0')]=db[_0xd063('0x3')]['import'](_0xd063('0xd1'));db[_0xd063('0xd2')]=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0xd3'));db[_0xd063('0xd4')]=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0xd5'));db[_0xd063('0xd6')]=db[_0xd063('0x3')]['import'](_0xd063('0xd7'));db['SquareRecording']=db['sequelize'][_0xd063('0x13')](_0xd063('0xd8'));db['SquareMessage']=db[_0xd063('0x3')]['import'](_0xd063('0xd9'));db[_0xd063('0xda')]=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0xdb'));db[_0xd063('0xdc')]=db[_0xd063('0x3')][_0xd063('0x13')]('../api/license/license.model');db[_0xd063('0xdd')]=db[_0xd063('0x3')][_0xd063('0x13')]('../api/campaign/campaign.model');db[_0xd063('0xde')]=db[_0xd063('0x3')]['import'](_0xd063('0xdf'));db[_0xd063('0xe0')]=db[_0xd063('0x3')][_0xd063('0x13')]('../api/attachment/attachment.model');db[_0xd063('0xe1')]=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0xe2'));db[_0xd063('0xe3')]=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0xe4'));db['ChatTransferReport']=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0xe5'));db[_0xd063('0xe6')]=db[_0xd063('0x3')]['import'](_0xd063('0xe7'));db['OpenchannelTransferReport']=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0xe8'));db[_0xd063('0xe9')]=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0xea'));db[_0xd063('0xeb')]=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0xec'));db['VoicePrefix']=db['sequelize']['import']('../api/voicePrefix/voicePrefix.model');db[_0xd063('0xed')]=db[_0xd063('0x3')]['import'](_0xd063('0xee'));db[_0xd063('0xef')]=db[_0xd063('0x3')]['import'](_0xd063('0xf0'));db[_0xd063('0xf1')]=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0xf2'));db[_0xd063('0xf3')]=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0xf4'));db[_0xd063('0xf5')]=db[_0xd063('0x3')][_0xd063('0x13')]('../api/whatsappAccount/whatsappAccount.model');db[_0xd063('0xf6')]=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0xf7'));db[_0xd063('0xf8')]=db[_0xd063('0x3')]['import']('../api/whatsappInteraction/whatsappInteraction.model');db['WhatsappMessage']=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0xf9'));db[_0xd063('0xfa')]=db['sequelize']['import'](_0xd063('0xfb'));db[_0xd063('0xfc')]=db['sequelize']['import'](_0xd063('0xfd'));db[_0xd063('0xfe')]=db[_0xd063('0x3')][_0xd063('0x13')]('../api/whatsappQueue/whatsappQueue.model');db[_0xd063('0xff')]=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0x100'));db['TeamVoiceQueue']=db[_0xd063('0x3')][_0xd063('0x13')](_0xd063('0x101'));db[_0xd063('0x12')][_0xd063('0x102')](db[_0xd063('0x20')],{'as':'VoiceMail','onDelete':_0xd063('0x103'),'foreignKey':_0xd063('0x104')});db[_0xd063('0x12')][_0xd063('0x105')](db[_0xd063('0x1d')],{'as':'Recordings','foreignKey':_0xd063('0x104')});db[_0xd063('0x12')][_0xd063('0x105')](db[_0xd063('0x2e')],{'as':_0xd063('0x106'),'foreignKey':_0xd063('0x104')});db[_0xd063('0x12')][_0xd063('0x105')](db[_0xd063('0x19')],{'as':_0xd063('0x107'),'onDelete':_0xd063('0x103'),'hooks':!![]});db[_0xd063('0x12')][_0xd063('0x105')](db['CmHopperFinal'],{'as':_0xd063('0x108'),'foreignKey':_0xd063('0x104')});db[_0xd063('0x12')][_0xd063('0x105')](db['CmHopperHistory'],{'as':_0xd063('0x109'),'foreignKey':'UserId'});db['User'][_0xd063('0x105')](db[_0xd063('0x74')],{'as':_0xd063('0x74'),'foreignKey':_0xd063('0x104')});db[_0xd063('0x12')][_0xd063('0x105')](db[_0xd063('0x10a')],{'as':_0xd063('0x10b'),'foreignKey':_0xd063('0x104')});db[_0xd063('0x12')][_0xd063('0x105')](db[_0xd063('0x64')],{'as':_0xd063('0x10c'),'foreignKey':_0xd063('0x104')});db[_0xd063('0x12')][_0xd063('0x105')](db['SmsInteraction'],{'as':_0xd063('0x10d'),'foreignKey':_0xd063('0x104')});db[_0xd063('0x12')]['hasMany'](db[_0xd063('0x4e')],{'as':_0xd063('0x10e'),'foreignKey':_0xd063('0x104')});db['User'][_0xd063('0x105')](db['MailInteraction'],{'as':_0xd063('0x10f'),'foreignKey':_0xd063('0x104')});db[_0xd063('0x12')]['hasMany'](db[_0xd063('0xf8')],{'as':_0xd063('0x110'),'foreignKey':_0xd063('0x104')});db[_0xd063('0x12')][_0xd063('0x105')](db['UserNotification'],{'as':_0xd063('0x111'),'foreignKey':'SenderId'});db[_0xd063('0x12')]['belongsTo'](db[_0xd063('0xed')],{'as':_0xd063('0xed'),'foreignKey':_0xd063('0x112')});db[_0xd063('0x12')]['belongsToMany'](db[_0xd063('0x6a')],{'as':_0xd063('0x113'),'through':_0xd063('0x114')});db[_0xd063('0x12')][_0xd063('0x115')](db[_0xd063('0x6d')],{'as':'Contacts','through':_0xd063('0x116')});db[_0xd063('0x12')][_0xd063('0x115')](db[_0xd063('0xeb')],{'as':_0xd063('0x117'),'through':'cm_user_has_lists'});db[_0xd063('0x12')][_0xd063('0x115')](db[_0xd063('0xda')],{'through':_0xd063('0x118')});db['User'][_0xd063('0x115')](db['MailInteraction'],{'as':_0xd063('0x10f'),'through':_0xd063('0x119')});db['User'][_0xd063('0x115')](db['ChatInteraction'],{'as':'ChatInteractions','through':'user_has_chat_interactions'});db[_0xd063('0x12')]['belongsToMany'](db['FaxInteraction'],{'as':_0xd063('0x10e'),'through':_0xd063('0x11a')});db['User']['belongsToMany'](db[_0xd063('0x11b')],{'as':_0xd063('0x10d'),'through':'user_has_sms_interactions'});db['User'][_0xd063('0x115')](db[_0xd063('0x10a')],{'as':'OpenchannelInteractions','through':_0xd063('0x11c')});db[_0xd063('0x12')][_0xd063('0x115')](db['WhatsappInteraction'],{'as':_0xd063('0x110'),'through':_0xd063('0x11d')});db[_0xd063('0x12')][_0xd063('0x115')](db[_0xd063('0x11e')],{'as':'VoiceQueues','through':_0xd063('0x2f'),'required':![]});db[_0xd063('0x12')][_0xd063('0x115')](db[_0xd063('0x3d')],{'as':_0xd063('0x11f'),'through':_0xd063('0x32'),'required':![]});db[_0xd063('0x12')]['belongsToMany'](db[_0xd063('0x68')],{'as':_0xd063('0x120'),'through':_0xd063('0x121'),'required':![],'hooks':!![]});db[_0xd063('0x12')][_0xd063('0x115')](db[_0xd063('0x52')],{'as':_0xd063('0x122'),'through':'UserFaxQueue','required':![]});db['User'][_0xd063('0x115')](db[_0xd063('0x123')],{'as':_0xd063('0x124'),'through':_0xd063('0x35'),'required':![]});db[_0xd063('0x12')][_0xd063('0x115')](db[_0xd063('0x5f')],{'as':_0xd063('0x125'),'through':'UserOpenchannelQueue','required':![]});db['User'][_0xd063('0x115')](db[_0xd063('0xfe')],{'as':_0xd063('0x126'),'through':'UserWhatsappQueue','required':![]});db[_0xd063('0x12')][_0xd063('0x115')](db[_0xd063('0xeb')],{'through':'cm_user_has_lists'});db[_0xd063('0x12')][_0xd063('0x115')](db[_0xd063('0x127')],{'as':_0xd063('0x128'),'through':'user_has_voice_prefixes','required':![]});db[_0xd063('0x12')][_0xd063('0x115')](db['ChatWebsite'],{'as':_0xd063('0x129'),'through':_0xd063('0x12a')});db['User']['belongsToMany'](db[_0xd063('0x4b')],{'as':_0xd063('0x12b'),'through':'user_has_fax_accounts'});db[_0xd063('0x12')][_0xd063('0x115')](db[_0xd063('0x12c')],{'as':'MailAccounts','through':'user_has_mail_accounts'});db[_0xd063('0x12')][_0xd063('0x115')](db[_0xd063('0x12d')],{'as':_0xd063('0x12e'),'through':_0xd063('0x12f')});db[_0xd063('0x12')][_0xd063('0x115')](db[_0xd063('0x53')],{'as':_0xd063('0x130'),'through':'user_has_sms_accounts'});db[_0xd063('0x12')][_0xd063('0x115')](db['WhatsappAccount'],{'as':_0xd063('0x131'),'through':_0xd063('0x132')});db['User'][_0xd063('0x115')](db[_0xd063('0xd6')],{'as':_0xd063('0x133'),'through':_0xd063('0x134')});db[_0xd063('0x15')][_0xd063('0x105')](db['VoiceExtension'],{'as':_0xd063('0x135'),'onDelete':_0xd063('0x103'),'foreignKey':_0xd063('0x136')});db[_0xd063('0x17')][_0xd063('0x105')](db[_0xd063('0x19')],{'onDelete':_0xd063('0x103')});db[_0xd063('0x19')][_0xd063('0x105')](db[_0xd063('0x19')],{'as':_0xd063('0x137'),'onDelete':'cascade'});db['VoiceMusicOnHold']['belongsToMany'](db[_0xd063('0x138')],{'as':'Sounds','through':_0xd063('0x139')});db['VoiceQueue']['hasMany'](db[_0xd063('0x2e')],{'as':_0xd063('0x13a'),'foreignKey':_0xd063('0x13b')});db[_0xd063('0x11e')][_0xd063('0x105')](db[_0xd063('0x6e')],{'as':_0xd063('0x13c'),'foreignKey':_0xd063('0x13b')});db['VoiceQueue'][_0xd063('0x105')](db[_0xd063('0x71')],{'as':_0xd063('0x108'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0xd063('0x105')](db['CmHopperHistory'],{'as':_0xd063('0x13d'),'foreignKey':_0xd063('0x13b')});db[_0xd063('0x11e')][_0xd063('0x105')](db[_0xd063('0x74')],{'as':_0xd063('0x74'),'foreignKey':'VoiceQueueId'});db[_0xd063('0x11e')][_0xd063('0x105')](db[_0xd063('0x6f')],{'as':'HopperBlacks','foreignKey':_0xd063('0x13b')});db[_0xd063('0x11e')][_0xd063('0x105')](db[_0xd063('0xc9')],{'as':'JscriptySessions','foreignKey':_0xd063('0x13b')});db[_0xd063('0x11e')]['belongsTo'](db[_0xd063('0x13e')],{'as':_0xd063('0x13e'),'foreignKey':_0xd063('0x13f')});db[_0xd063('0x11e')][_0xd063('0x140')](db[_0xd063('0x13e')],{'as':_0xd063('0x141'),'foreignKey':_0xd063('0x142')});db[_0xd063('0x11e')][_0xd063('0x140')](db[_0xd063('0x7d')],{'as':_0xd063('0x7d'),'foreignKey':_0xd063('0x143')});db[_0xd063('0x11e')][_0xd063('0x140')](db[_0xd063('0x7f')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xd063('0x11e')][_0xd063('0x115')](db[_0xd063('0xeb')],{'as':_0xd063('0x117'),'through':'voice_queues_has_cm_lists'});db['VoiceQueue']['belongsToMany'](db[_0xd063('0x12')],{'as':_0xd063('0x144'),'through':_0xd063('0x2f')});db[_0xd063('0x11e')][_0xd063('0x115')](db['Team'],{'as':_0xd063('0x145'),'through':_0xd063('0x146')});db[_0xd063('0x11e')]['belongsToMany'](db[_0xd063('0xeb')],{'as':_0xd063('0x147'),'through':_0xd063('0x148')});db[_0xd063('0x1d')][_0xd063('0x140')](db['User'],{'as':_0xd063('0x12'),'foreignKey':'UserId'});db[_0xd063('0x1f')]['belongsTo'](db[_0xd063('0x12')],{'as':_0xd063('0x12'),'foreignKey':_0xd063('0x104')});db[_0xd063('0x20')]['hasMany'](db['VoiceMailMessage'],{'as':_0xd063('0x149'),'onDelete':_0xd063('0x103'),'foreignKey':_0xd063('0x14a'),'sourceKey':'mailbox'});db[_0xd063('0x22')][_0xd063('0x140')](db[_0xd063('0x20')],{'foreignKey':_0xd063('0x14a'),'targetKey':_0xd063('0x14b')});db[_0xd063('0x14c')][_0xd063('0x105')](db[_0xd063('0x28')],{'as':'QueueCalls','foreignKey':'uniqueid','constraints':![]});db['VoiceCallReport'][_0xd063('0x105')](db[_0xd063('0x26')],{'as':'AgentReports','foreignKey':'uniqueid','constraints':![]});db[_0xd063('0x14c')][_0xd063('0x140')](db[_0xd063('0x12')],{'as':'User','foreignKey':_0xd063('0x104')});db[_0xd063('0x14c')]['belongsTo'](db[_0xd063('0x6d')],{'as':'Contact','foreignKey':_0xd063('0x14d')});db[_0xd063('0x39')][_0xd063('0x140')](db[_0xd063('0x12c')],{'as':'MailAccount','foreignKey':_0xd063('0x14e')});db[_0xd063('0x3b')][_0xd063('0x140')](db[_0xd063('0x12c')],{'as':'MailAccount','foreignKey':'MailAccountId'});db['MailAccount']['hasOne'](db[_0xd063('0x39')],{'as':_0xd063('0x14f'),'onDelete':_0xd063('0x103')});db['MailAccount'][_0xd063('0x102')](db[_0xd063('0x3b')],{'as':_0xd063('0x150'),'onDelete':'cascade'});db[_0xd063('0x12c')][_0xd063('0x105')](db['Disposition'],{'as':_0xd063('0x151'),'foreignKey':_0xd063('0x14e'),'onDelete':_0xd063('0x103')});db[_0xd063('0x12c')][_0xd063('0x105')](db[_0xd063('0x7a')],{'as':_0xd063('0x152'),'foreignKey':_0xd063('0x14e')});db[_0xd063('0x12c')][_0xd063('0x105')](db[_0xd063('0x42')],{'as':'Messages','foreignKey':_0xd063('0x14e')});db['MailAccount'][_0xd063('0x105')](db['MailInteraction'],{'as':_0xd063('0x153')});db['MailAccount'][_0xd063('0x105')](db['MailApplication'],{'as':_0xd063('0x137')});db[_0xd063('0x12c')]['belongsTo'](db[_0xd063('0xeb')],{'as':'List','foreignKey':_0xd063('0x154')});db[_0xd063('0x12c')][_0xd063('0x140')](db[_0xd063('0x84')],{'as':_0xd063('0x84'),'foreignKey':_0xd063('0x155')});db[_0xd063('0x12c')][_0xd063('0x140')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db['MailAccount']['belongsToMany'](db[_0xd063('0x12')],{'as':_0xd063('0x144'),'through':_0xd063('0x156')});db[_0xd063('0x3d')]['belongsToMany'](db['User'],{'as':_0xd063('0x144'),'through':'UserMailQueue'});db[_0xd063('0x3d')]['belongsToMany'](db[_0xd063('0xda')],{'through':'team_has_mail_queues','as':_0xd063('0x145')});db[_0xd063('0x40')]['hasMany'](db['MailMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0xd063('0x157')});db[_0xd063('0x40')][_0xd063('0x140')](db[_0xd063('0x12c')],{'as':_0xd063('0x158'),'foreignKey':'MailAccountId'});db[_0xd063('0x40')][_0xd063('0x140')](db[_0xd063('0x6d')],{'as':_0xd063('0x159'),'foreignKey':_0xd063('0x14d')});db[_0xd063('0x40')][_0xd063('0x140')](db[_0xd063('0x12')],{'as':_0xd063('0x15a'),'foreignKey':_0xd063('0x104')});db[_0xd063('0x40')][_0xd063('0x115')](db[_0xd063('0x83')],{'through':_0xd063('0x15b'),'as':_0xd063('0x15c')});db['MailInteraction']['belongsToMany'](db[_0xd063('0x83')],{'through':_0xd063('0x15b'),'as':_0xd063('0x15d')});db[_0xd063('0x40')][_0xd063('0x115')](db[_0xd063('0x12')],{'as':'Users','through':_0xd063('0x119'),'foreignKey':_0xd063('0x157')});db['MailMessage'][_0xd063('0x105')](db[_0xd063('0xe0')],{'as':_0xd063('0x15e'),'onDelete':'cascade'});db['MailMessage'][_0xd063('0x140')](db[_0xd063('0x12')],{'as':_0xd063('0x12')});db[_0xd063('0x42')]['belongsTo'](db['CmContact'],{'onDelete':_0xd063('0x103'),'as':_0xd063('0x159')});db[_0xd063('0x42')][_0xd063('0x140')](db[_0xd063('0x40')],{'as':_0xd063('0x15f'),'foreignKey':_0xd063('0x157')});db[_0xd063('0x42')][_0xd063('0x140')](db[_0xd063('0x12c')],{'as':_0xd063('0x158'),'foreignKey':_0xd063('0x14e')});db[_0xd063('0x42')]['belongsTo'](db['ChatWebsite'],{'as':_0xd063('0x61'),'foreignKey':_0xd063('0x160')});db[_0xd063('0x42')][_0xd063('0x140')](db['ChatOfflineMessage'],{'as':_0xd063('0x161'),'foreignKey':_0xd063('0x162')});db[_0xd063('0x44')]['belongsTo'](db['User'],{'onDelete':'restrict'});db['MailApplication'][_0xd063('0x140')](db[_0xd063('0x3d')],{'onDelete':_0xd063('0x163')});db[_0xd063('0x44')][_0xd063('0x140')](db[_0xd063('0x12c')],{'onDelete':_0xd063('0x163')});db[_0xd063('0x44')][_0xd063('0x140')](db[_0xd063('0x7d')],{'onDelete':_0xd063('0x163'),'foreignKey':_0xd063('0x143')});db['MailApplication'][_0xd063('0x140')](db[_0xd063('0x83')],{'onDelete':_0xd063('0x163'),'foreignKey':_0xd063('0x164')});db[_0xd063('0x46')][_0xd063('0x140')](db['MailAccount'],{});db[_0xd063('0x46')][_0xd063('0x140')](db[_0xd063('0xeb')],{'as':'List','foreignKey':'ListId'});db[_0xd063('0x46')][_0xd063('0x140')](db['CmContact'],{'as':_0xd063('0x159'),'foreignKey':_0xd063('0x14d')});db['MailQueueReport']['belongsTo'](db[_0xd063('0x40')],{});db[_0xd063('0x46')][_0xd063('0x140')](db['MailMessage'],{});db['MailQueueReport']['belongsTo'](db[_0xd063('0x12')],{});db[_0xd063('0x46')][_0xd063('0x140')](db['MailQueue'],{});db[_0xd063('0x47')][_0xd063('0x105')](db[_0xd063('0x49')],{'as':_0xd063('0x165'),'onDelete':_0xd063('0x103')});db[_0xd063('0x4b')][_0xd063('0x105')](db['Disposition'],{'as':'Dispositions','foreignKey':_0xd063('0x166'),'onDelete':_0xd063('0x103')});db[_0xd063('0x4b')][_0xd063('0x105')](db[_0xd063('0x7a')],{'as':_0xd063('0x152'),'foreignKey':_0xd063('0x166')});db[_0xd063('0x4b')]['hasMany'](db[_0xd063('0x4e')],{'as':_0xd063('0x153')});db[_0xd063('0x4b')][_0xd063('0x105')](db['FaxApplication'],{'as':'Applications'});db[_0xd063('0x4b')]['hasMany'](db[_0xd063('0x19')],{'as':'Exntensions','onDelete':_0xd063('0x103')});db[_0xd063('0x4b')][_0xd063('0x105')](db[_0xd063('0x50')],{'as':'Messages'});db[_0xd063('0x4b')][_0xd063('0x140')](db[_0xd063('0x13e')],{'as':_0xd063('0x13e')});db['FaxAccount'][_0xd063('0x140')](db[_0xd063('0xeb')],{'as':_0xd063('0x167'),'foreignKey':'ListId'});db['FaxAccount']['belongsTo'](db[_0xd063('0x7f')],{'as':_0xd063('0x168'),'foreignKey':_0xd063('0x169')});db['FaxAccount']['belongsToMany'](db[_0xd063('0x12')],{'as':_0xd063('0x144'),'through':_0xd063('0x16a')});db[_0xd063('0x4c')][_0xd063('0x140')](db['User'],{'onDelete':_0xd063('0x163')});db[_0xd063('0x4c')]['belongsTo'](db['FaxQueue'],{'onDelete':'restrict'});db[_0xd063('0x4c')]['belongsTo'](db[_0xd063('0x4b')],{'onDelete':_0xd063('0x163')});db[_0xd063('0x4c')][_0xd063('0x140')](db['Tag'],{'onDelete':_0xd063('0x163'),'foreignKey':'TagId'});db[_0xd063('0x4e')][_0xd063('0x105')](db['FaxMessage'],{'as':_0xd063('0x149'),'onDelete':_0xd063('0x103'),'foreignKey':_0xd063('0x16b')});db[_0xd063('0x4e')][_0xd063('0x140')](db[_0xd063('0x4b')],{'as':_0xd063('0x158'),'foreignKey':_0xd063('0x166')});db['FaxInteraction'][_0xd063('0x140')](db[_0xd063('0x6d')],{'as':_0xd063('0x159'),'foreignKey':'ContactId'});db['FaxInteraction']['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0xd063('0x104')});db[_0xd063('0x4e')]['belongsToMany'](db[_0xd063('0x83')],{'through':'fax_interaction_has_tags','as':_0xd063('0x15c')});db[_0xd063('0x4e')]['belongsToMany'](db[_0xd063('0x83')],{'through':_0xd063('0x16c'),'as':_0xd063('0x15d')});db['FaxInteraction']['belongsToMany'](db[_0xd063('0x12')],{'as':'Users','through':_0xd063('0x11a'),'foreignKey':_0xd063('0x16b')});db[_0xd063('0x50')][_0xd063('0x140')](db['User'],{'onDelete':_0xd063('0x103'),'as':_0xd063('0x12')});db[_0xd063('0x50')][_0xd063('0x140')](db[_0xd063('0x4e')],{'as':_0xd063('0x15f'),'foreignKey':'FaxInteractionId'});db[_0xd063('0x50')][_0xd063('0x140')](db[_0xd063('0x6d')],{'onDelete':'cascade','as':'Contact'});db[_0xd063('0x50')][_0xd063('0x140')](db['Attachment'],{'as':'Attachment','foreignKey':_0xd063('0x16d')});db[_0xd063('0x50')][_0xd063('0x140')](db[_0xd063('0x4b')],{'as':_0xd063('0x158'),'foreignKey':_0xd063('0x166')});db[_0xd063('0x52')][_0xd063('0x115')](db['User'],{'as':'Agents','through':_0xd063('0x16e')});db[_0xd063('0x52')][_0xd063('0x115')](db[_0xd063('0xda')],{'through':_0xd063('0x16f'),'as':_0xd063('0x145')});db[_0xd063('0x170')][_0xd063('0x140')](db[_0xd063('0x4b')],{});db['FaxQueueReport'][_0xd063('0x140')](db['CmList'],{'as':_0xd063('0x167'),'foreignKey':'ListId'});db[_0xd063('0x170')][_0xd063('0x140')](db['CmContact'],{'as':_0xd063('0x159'),'foreignKey':_0xd063('0x14d')});db['FaxQueueReport'][_0xd063('0x140')](db[_0xd063('0x4e')],{});db[_0xd063('0x170')]['belongsTo'](db[_0xd063('0x50')],{});db[_0xd063('0x170')][_0xd063('0x140')](db[_0xd063('0x12')],{});db[_0xd063('0x170')][_0xd063('0x140')](db[_0xd063('0x52')],{});db[_0xd063('0x53')][_0xd063('0x105')](db[_0xd063('0x171')],{'as':_0xd063('0x151'),'foreignKey':_0xd063('0x172'),'onDelete':_0xd063('0x103')});db[_0xd063('0x53')][_0xd063('0x105')](db[_0xd063('0x7a')],{'as':_0xd063('0x152'),'foreignKey':_0xd063('0x172')});db[_0xd063('0x53')][_0xd063('0x105')](db[_0xd063('0x57')],{'as':_0xd063('0x149'),'foreignKey':_0xd063('0x172')});db[_0xd063('0x53')]['hasMany'](db['SmsInteraction'],{'as':_0xd063('0x153')});db['SmsAccount'][_0xd063('0x105')](db['SmsApplication'],{'as':_0xd063('0x137')});db[_0xd063('0x53')][_0xd063('0x140')](db[_0xd063('0xeb')],{'as':_0xd063('0x167'),'foreignKey':_0xd063('0x154')});db[_0xd063('0x53')]['belongsTo'](db[_0xd063('0x7f')],{'as':'mandatoryDispositionPause','foreignKey':_0xd063('0x169')});db[_0xd063('0x53')][_0xd063('0x115')](db[_0xd063('0x12')],{'as':_0xd063('0x144'),'through':_0xd063('0x173')});db[_0xd063('0x55')][_0xd063('0x140')](db[_0xd063('0x12')],{'onDelete':_0xd063('0x163')});db[_0xd063('0x55')][_0xd063('0x140')](db['SmsQueue'],{'onDelete':_0xd063('0x163')});db['SmsApplication'][_0xd063('0x140')](db[_0xd063('0x53')],{'onDelete':_0xd063('0x163')});db[_0xd063('0x55')][_0xd063('0x140')](db['Interval'],{'onDelete':_0xd063('0x163'),'foreignKey':'IntervalId'});db[_0xd063('0x55')]['belongsTo'](db[_0xd063('0x83')],{'onDelete':_0xd063('0x163'),'foreignKey':_0xd063('0x164')});db[_0xd063('0x11b')]['hasMany'](db[_0xd063('0x57')],{'as':_0xd063('0x149'),'onDelete':_0xd063('0x103'),'foreignKey':'SmsInteractionId'});db[_0xd063('0x11b')][_0xd063('0x140')](db[_0xd063('0x53')],{'as':'Account','foreignKey':'SmsAccountId'});db[_0xd063('0x11b')][_0xd063('0x140')](db[_0xd063('0x6d')],{'as':_0xd063('0x159'),'foreignKey':'ContactId'});db[_0xd063('0x11b')][_0xd063('0x140')](db[_0xd063('0x12')],{'as':_0xd063('0x15a'),'foreignKey':_0xd063('0x104')});db[_0xd063('0x11b')][_0xd063('0x115')](db[_0xd063('0x83')],{'through':_0xd063('0x174'),'as':_0xd063('0x15c')});db[_0xd063('0x11b')][_0xd063('0x115')](db[_0xd063('0x83')],{'through':_0xd063('0x174'),'as':'ThroughTags'});db[_0xd063('0x11b')]['belongsToMany'](db[_0xd063('0x12')],{'as':_0xd063('0x175'),'through':_0xd063('0x176'),'foreignKey':'SmsInteractionId'});db[_0xd063('0x57')][_0xd063('0x140')](db[_0xd063('0x12')],{'as':_0xd063('0x12')});db[_0xd063('0x57')][_0xd063('0x140')](db['CmContact'],{'onDelete':_0xd063('0x103'),'as':_0xd063('0x159')});db[_0xd063('0x57')][_0xd063('0x140')](db[_0xd063('0x11b')],{'onDelete':'cascade','as':_0xd063('0x15f'),'foreignKey':'SmsInteractionId'});db['SmsMessage'][_0xd063('0x140')](db[_0xd063('0x53')],{'as':'Account','foreignKey':'SmsAccountId'});db[_0xd063('0x123')]['belongsToMany'](db[_0xd063('0x12')],{'as':_0xd063('0x144'),'through':_0xd063('0x35'),'foreignKey':'SmsQueueId'});db[_0xd063('0x123')]['belongsToMany'](db[_0xd063('0xda')],{'through':_0xd063('0x177'),'as':'Teams'});db['OpenchannelAccount']['hasMany'](db[_0xd063('0x171')],{'as':_0xd063('0x151'),'foreignKey':'OpenchannelAccountId','onDelete':_0xd063('0x103')});db[_0xd063('0x12d')][_0xd063('0x105')](db[_0xd063('0x7a')],{'as':'Answers','foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0xd063('0x105')](db[_0xd063('0x10a')],{'as':'Interactions','foreignKey':_0xd063('0x178')});db[_0xd063('0x12d')][_0xd063('0x105')](db[_0xd063('0x5d')],{'as':_0xd063('0x149'),'foreignKey':'OpenchannelAccountId'});db[_0xd063('0x12d')][_0xd063('0x105')](db['OpenchannelApplication'],{'as':_0xd063('0x137'),'foreignKey':_0xd063('0x178')});db[_0xd063('0x12d')][_0xd063('0x140')](db[_0xd063('0xeb')],{'as':_0xd063('0x167'),'foreignKey':'ListId'});db[_0xd063('0x12d')][_0xd063('0x140')](db[_0xd063('0x7f')],{'as':'mandatoryDispositionPause','foreignKey':_0xd063('0x169')});db[_0xd063('0x12d')][_0xd063('0x115')](db[_0xd063('0x12')],{'as':_0xd063('0x144'),'through':_0xd063('0x12f')});db['OpenchannelApplication'][_0xd063('0x140')](db[_0xd063('0x12')],{'onDelete':'restrict'});db['OpenchannelApplication'][_0xd063('0x140')](db['OpenchannelQueue'],{'onDelete':_0xd063('0x163'),'foreignKey':_0xd063('0x179')});db[_0xd063('0x5a')]['belongsTo'](db[_0xd063('0x12d')],{'onDelete':_0xd063('0x163'),'foreignKey':_0xd063('0x178')});db[_0xd063('0x5a')][_0xd063('0x140')](db['Interval'],{'onDelete':_0xd063('0x163'),'foreignKey':_0xd063('0x143')});db[_0xd063('0x5a')][_0xd063('0x140')](db[_0xd063('0x83')],{'onDelete':_0xd063('0x163'),'foreignKey':_0xd063('0x164')});db[_0xd063('0x10a')][_0xd063('0x105')](db[_0xd063('0x5d')],{'as':'Messages','onDelete':_0xd063('0x103'),'foreignKey':_0xd063('0x17a')});db[_0xd063('0x10a')]['belongsTo'](db[_0xd063('0x12d')],{'as':_0xd063('0x158'),'foreignKey':_0xd063('0x178')});db[_0xd063('0x10a')][_0xd063('0x140')](db['CmContact'],{'as':_0xd063('0x159'),'foreignKey':_0xd063('0x14d')});db[_0xd063('0x10a')]['belongsTo'](db[_0xd063('0x12')],{'as':_0xd063('0x15a'),'foreignKey':_0xd063('0x104')});db[_0xd063('0x10a')][_0xd063('0x115')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0xd063('0x15c')});db[_0xd063('0x10a')][_0xd063('0x115')](db[_0xd063('0x83')],{'through':'openchannel_interaction_has_tags','as':_0xd063('0x15d')});db[_0xd063('0x10a')]['belongsToMany'](db[_0xd063('0x12')],{'as':'Users','through':_0xd063('0x11c'),'foreignKey':_0xd063('0x17a')});db[_0xd063('0x5d')][_0xd063('0x140')](db[_0xd063('0x12')],{'onDelete':'cascade','as':'User'});db['OpenchannelMessage'][_0xd063('0x140')](db[_0xd063('0x6d')],{'onDelete':_0xd063('0x103'),'as':_0xd063('0x159')});db[_0xd063('0x5d')]['belongsTo'](db[_0xd063('0x10a')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0xd063('0x17a')});db[_0xd063('0x5d')][_0xd063('0x140')](db[_0xd063('0xe0')],{'as':_0xd063('0xe0'),'foreignKey':_0xd063('0x16d')});db[_0xd063('0x5d')][_0xd063('0x140')](db[_0xd063('0x12d')],{'as':_0xd063('0x158'),'foreignKey':'OpenchannelAccountId'});db[_0xd063('0x5f')][_0xd063('0x115')](db['User'],{'as':_0xd063('0x144'),'through':'UserOpenchannelQueue','foreignKey':_0xd063('0x179')});db[_0xd063('0x5f')]['belongsToMany'](db[_0xd063('0xda')],{'through':_0xd063('0x17b'),'as':_0xd063('0x145')});db['ChatWebsite'][_0xd063('0x105')](db[_0xd063('0x171')],{'as':_0xd063('0x151'),'foreignKey':_0xd063('0x160'),'onDelete':_0xd063('0x103')});db['ChatWebsite'][_0xd063('0x105')](db[_0xd063('0x7a')],{'as':_0xd063('0x152'),'foreignKey':_0xd063('0x160')});db[_0xd063('0x61')][_0xd063('0x105')](db[_0xd063('0x17c')],{'as':'ProactiveActions'});db['ChatWebsite'][_0xd063('0x105')](db[_0xd063('0x64')],{'as':_0xd063('0x153')});db['ChatWebsite'][_0xd063('0x105')](db[_0xd063('0x17d')],{'as':_0xd063('0x137')});db[_0xd063('0x61')][_0xd063('0x105')](db[_0xd063('0x17e')],{'as':_0xd063('0x149')});db[_0xd063('0x61')][_0xd063('0x140')](db[_0xd063('0xeb')],{'as':_0xd063('0x167'),'foreignKey':'ListId'});db[_0xd063('0x61')][_0xd063('0x140')](db[_0xd063('0x7d')],{'as':_0xd063('0x7d'),'foreignKey':'IntervalId'});db[_0xd063('0x61')][_0xd063('0x140')](db['MailAccount'],{'as':_0xd063('0x12c'),'foreignKey':_0xd063('0x14e')});db['ChatWebsite'][_0xd063('0x140')](db[_0xd063('0x7f')],{'as':_0xd063('0x168'),'foreignKey':_0xd063('0x169')});db[_0xd063('0x61')][_0xd063('0x115')](db[_0xd063('0x12')],{'as':_0xd063('0x144'),'through':_0xd063('0x12a')});db[_0xd063('0x17f')][_0xd063('0x140')](db[_0xd063('0x12d')],{});db[_0xd063('0x17f')]['belongsTo'](db[_0xd063('0xeb')],{'as':_0xd063('0x167'),'foreignKey':_0xd063('0x154')});db['OpenchannelQueueReport'][_0xd063('0x140')](db[_0xd063('0x6d')],{'as':_0xd063('0x159'),'foreignKey':_0xd063('0x14d')});db[_0xd063('0x17f')][_0xd063('0x140')](db[_0xd063('0x10a')],{});db[_0xd063('0x17f')]['belongsTo'](db[_0xd063('0x5d')],{});db['OpenchannelQueueReport'][_0xd063('0x140')](db[_0xd063('0x12')],{});db[_0xd063('0x17f')][_0xd063('0x140')](db[_0xd063('0x5f')],{});db[_0xd063('0x17d')][_0xd063('0x140')](db[_0xd063('0x12')],{'as':_0xd063('0x180'),'foreignKey':_0xd063('0x104'),'onDelete':_0xd063('0x163')});db[_0xd063('0x17d')]['belongsTo'](db[_0xd063('0x68')],{'as':_0xd063('0x181'),'foreignKey':'ChatQueueId','onDelete':'restrict'});db[_0xd063('0x17d')][_0xd063('0x140')](db[_0xd063('0x61')],{'as':_0xd063('0x182'),'foreignKey':_0xd063('0x160'),'onDelete':'restrict'});db[_0xd063('0x17d')][_0xd063('0x140')](db[_0xd063('0x83')],{'onDelete':_0xd063('0x163'),'foreignKey':_0xd063('0x164')});db[_0xd063('0x64')][_0xd063('0x105')](db[_0xd063('0x17e')],{'as':_0xd063('0x149'),'onDelete':'cascade','foreignKey':'ChatInteractionId'});db[_0xd063('0x64')][_0xd063('0x140')](db[_0xd063('0x61')],{'as':_0xd063('0x158'),'foreignKey':_0xd063('0x160')});db[_0xd063('0x64')][_0xd063('0x140')](db[_0xd063('0x6d')],{'as':_0xd063('0x159'),'foreignKey':_0xd063('0x14d')});db['ChatInteraction'][_0xd063('0x140')](db[_0xd063('0x12')],{'as':_0xd063('0x15a'),'foreignKey':_0xd063('0x104')});db['ChatInteraction']['belongsToMany'](db[_0xd063('0x83')],{'through':_0xd063('0x183'),'as':'Tags'});db[_0xd063('0x64')]['belongsToMany'](db[_0xd063('0x83')],{'through':_0xd063('0x183'),'as':_0xd063('0x15d')});db[_0xd063('0x64')][_0xd063('0x115')](db[_0xd063('0x12')],{'as':'Users','through':_0xd063('0x184'),'foreignKey':'ChatInteractionId'});db['ChatMessage'][_0xd063('0x140')](db[_0xd063('0x12')],{'onDelete':'cascade','as':_0xd063('0x12')});db[_0xd063('0x17e')][_0xd063('0x140')](db['CmContact'],{'onDelete':'cascade','as':'Contact','foreignKey':_0xd063('0x14d')});db[_0xd063('0x17e')]['belongsTo'](db[_0xd063('0x64')],{'onDelete':'cascade','as':_0xd063('0x15f'),'foreignKey':_0xd063('0x185')});db[_0xd063('0x17e')][_0xd063('0x140')](db[_0xd063('0xe0')],{'as':_0xd063('0xe0'),'foreignKey':_0xd063('0x16d')});db[_0xd063('0x17e')][_0xd063('0x140')](db['ChatWebsite'],{'as':_0xd063('0x158'),'foreignKey':'ChatWebsiteId'});db[_0xd063('0x161')][_0xd063('0x105')](db['Attachment'],{'as':'Attachments','foreignKey':_0xd063('0x162'),'onDelete':'cascade','hooks':!![]});db[_0xd063('0x161')]['belongsTo'](db[_0xd063('0x6d')],{'onDelete':'cascade','as':'Contact','foreignKey':_0xd063('0x14d')});db['ChatOfflineMessage'][_0xd063('0x140')](db[_0xd063('0x61')],{'as':_0xd063('0x158'),'foreignKey':'ChatWebsiteId'});db['ChatQueue']['belongsToMany'](db['User'],{'as':_0xd063('0x144'),'through':_0xd063('0x121'),'hooks':!![]});db[_0xd063('0x68')][_0xd063('0x115')](db[_0xd063('0xda')],{'through':_0xd063('0x186'),'as':_0xd063('0x145')});db['ChatGroup'][_0xd063('0x105')](db[_0xd063('0xc4')],{'as':'Messages','foreignKey':_0xd063('0x187'),'onDelete':_0xd063('0x103')});db[_0xd063('0x6a')][_0xd063('0x115')](db['User'],{'as':_0xd063('0x13a'),'through':_0xd063('0x114')});db['ChatProactiveAction'][_0xd063('0x140')](db['ChatWebsite'],{'as':'Website','foreignKey':_0xd063('0x160')});db[_0xd063('0x6c')]['hasMany'](db[_0xd063('0x6d')],{'as':_0xd063('0x188'),'foreignKey':_0xd063('0x189')});db['CmContact'][_0xd063('0x105')](db['CmHopper'],{'as':'Hoppers','foreignKey':'ContactId'});db['CmContact']['hasMany'](db[_0xd063('0x71')],{'as':_0xd063('0x108'),'foreignKey':_0xd063('0x14d')});db[_0xd063('0x6d')][_0xd063('0x105')](db[_0xd063('0x73')],{'as':_0xd063('0x13d'),'foreignKey':_0xd063('0x14d')});db[_0xd063('0x6d')][_0xd063('0x105')](db[_0xd063('0x74')],{'as':_0xd063('0x74'),'foreignKey':_0xd063('0x14d')});db['CmContact'][_0xd063('0x105')](db[_0xd063('0xc9')],{'as':_0xd063('0x18a'),'foreignKey':'ContactId'});db['CmContact'][_0xd063('0x105')](db[_0xd063('0x10a')],{'as':'OpenchannelInteractions','foreignKey':_0xd063('0x14d'),'onDelete':_0xd063('0x163')});db[_0xd063('0x6d')][_0xd063('0x105')](db[_0xd063('0x64')],{'as':_0xd063('0x10c'),'foreignKey':_0xd063('0x14d'),'onDelete':_0xd063('0x163')});db[_0xd063('0x6d')][_0xd063('0x105')](db[_0xd063('0x11b')],{'as':_0xd063('0x10d'),'foreignKey':_0xd063('0x14d'),'onDelete':'restrict'});db[_0xd063('0x6d')][_0xd063('0x105')](db['FaxInteraction'],{'as':_0xd063('0x10e'),'foreignKey':_0xd063('0x14d'),'onDelete':_0xd063('0x163')});db[_0xd063('0x6d')][_0xd063('0x105')](db[_0xd063('0x40')],{'as':_0xd063('0x10f'),'foreignKey':_0xd063('0x14d'),'onDelete':'restrict'});db['CmContact'][_0xd063('0x140')](db[_0xd063('0x6c')],{'as':'Company','foreignKey':_0xd063('0x189')});db['CmContact']['belongsTo'](db[_0xd063('0xeb')],{'as':_0xd063('0x167'),'foreignKey':_0xd063('0x154'),'onDelete':'cascade'});db[_0xd063('0x6d')][_0xd063('0x115')](db['User'],{'as':_0xd063('0x175'),'through':_0xd063('0x116')});db['CmContact']['belongsToMany'](db[_0xd063('0x83')],{'as':_0xd063('0x15c'),'through':'cm_contact_has_tags'});db[_0xd063('0x6d')][_0xd063('0x115')](db[_0xd063('0x83')],{'through':'cm_contact_has_tags','as':_0xd063('0x15d')});db[_0xd063('0x6e')][_0xd063('0x140')](db[_0xd063('0x6d')],{'as':_0xd063('0x159'),'foreignKey':_0xd063('0x14d'),'onDelete':_0xd063('0x103')});db[_0xd063('0x6e')][_0xd063('0x140')](db[_0xd063('0xeb')],{'as':_0xd063('0x167'),'foreignKey':_0xd063('0x154'),'onDelete':_0xd063('0x103')});db[_0xd063('0x6e')][_0xd063('0x140')](db[_0xd063('0x12')],{'as':'Agent','foreignKey':_0xd063('0x104')});db['CmHopper']['belongsTo'](db['VoiceQueue'],{'as':_0xd063('0x181'),'foreignKey':_0xd063('0x13b'),'onDelete':_0xd063('0x103')});db['CmHopper'][_0xd063('0x140')](db['Campaign'],{'as':_0xd063('0xdd'),'foreignKey':'CampaignId','onDelete':_0xd063('0x103')});db[_0xd063('0x6e')]['belongsTo'](db[_0xd063('0x12')],{'as':_0xd063('0x15a'),'foreignKey':_0xd063('0x18b')});db[_0xd063('0x6f')]['belongsTo'](db[_0xd063('0x6d')],{'as':_0xd063('0x159'),'foreignKey':'ContactId','onDelete':_0xd063('0x103')});db['CmHopperBlack'][_0xd063('0x140')](db['CmList'],{'as':_0xd063('0x167'),'foreignKey':'ListId','onDelete':_0xd063('0x103')});db['CmHopperBlack'][_0xd063('0x140')](db['VoiceQueue'],{'as':_0xd063('0x181'),'foreignKey':_0xd063('0x13b'),'onDelete':_0xd063('0x103')});db['CmHopperBlack'][_0xd063('0x140')](db[_0xd063('0xdd')],{'as':_0xd063('0xdd'),'foreignKey':_0xd063('0x18c'),'onDelete':_0xd063('0x103')});db[_0xd063('0x18d')]['hasMany'](db[_0xd063('0x18e')],{'as':{'plural':_0xd063('0x18f'),'singular':_0xd063('0x190')},'foreignKey':'AutomationAllId','onDelete':_0xd063('0x103'),'hooks':!![]});db[_0xd063('0x18d')][_0xd063('0x105')](db['Condition'],{'as':{'plural':_0xd063('0x191'),'singular':'OneAny'},'foreignKey':'AutomationAnyId','onDelete':_0xd063('0x103'),'hooks':!![]});db['Automation'][_0xd063('0x105')](db[_0xd063('0x77')],{'as':_0xd063('0x192'),'foreignKey':_0xd063('0x193'),'onDelete':_0xd063('0x103'),'hooks':!![]});db[_0xd063('0x171')][_0xd063('0x105')](db[_0xd063('0x171')],{'as':_0xd063('0x151'),'foreignKey':_0xd063('0x194'),'onDelete':_0xd063('0x103')});db['Interval'][_0xd063('0x105')](db['Interval'],{'as':_0xd063('0x195'),'foreignKey':_0xd063('0x143'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0xd063('0x7d')][_0xd063('0x105')](db[_0xd063('0x19')],{'as':_0xd063('0x107'),'foreignKey':_0xd063('0x143'),'onDelete':_0xd063('0x163')});db[_0xd063('0x7d')][_0xd063('0x105')](db[_0xd063('0x44')],{'as':_0xd063('0x196'),'foreignKey':'IntervalId'});db[_0xd063('0x7d')]['hasMany'](db['ChatApplication'],{'as':'ChatApplications','foreignKey':'IntervalId'});db[_0xd063('0x7d')][_0xd063('0x105')](db['FaxApplication'],{'as':_0xd063('0x197'),'foreignKey':_0xd063('0x143')});db[_0xd063('0x7d')][_0xd063('0x105')](db[_0xd063('0x55')],{'as':'SmsApplications','foreignKey':_0xd063('0x143')});db[_0xd063('0x82')][_0xd063('0x140')](db[_0xd063('0x12c')],{});db['Schedule']['belongsTo'](db[_0xd063('0x89')],{'foreignKey':_0xd063('0x198')});db[_0xd063('0x82')][_0xd063('0x140')](db[_0xd063('0x88')],{'foreignKey':_0xd063('0x199')});db[_0xd063('0x138')][_0xd063('0x115')](db[_0xd063('0x19a')],{'as':_0xd063('0x19b'),'through':'moh_has_sounds','onDelete':_0xd063('0x163')});db[_0xd063('0x83')][_0xd063('0x115')](db[_0xd063('0x6d')],{'through':_0xd063('0x19c')});db[_0xd063('0x83')][_0xd063('0x115')](db['ChatInteraction'],{'through':_0xd063('0x183')});db[_0xd063('0x83')][_0xd063('0x115')](db[_0xd063('0x40')],{'through':_0xd063('0x15b')});db[_0xd063('0x83')]['belongsToMany'](db[_0xd063('0x11b')],{'through':_0xd063('0x174')});db[_0xd063('0x83')][_0xd063('0x115')](db['FaxInteraction'],{'through':_0xd063('0x16c')});db['Tag'][_0xd063('0x115')](db[_0xd063('0x10a')],{'through':_0xd063('0x19d')});db[_0xd063('0x83')][_0xd063('0x115')](db[_0xd063('0xf8')],{'through':_0xd063('0x19e')});db[_0xd063('0x19f')][_0xd063('0x105')](db['Condition'],{'as':{'plural':_0xd063('0x1a0'),'singular':_0xd063('0x1a1')},'foreignKey':'TriggerAllId','onDelete':_0xd063('0x103'),'hooks':!![]});db[_0xd063('0x19f')]['hasMany'](db['Condition'],{'as':{'plural':_0xd063('0x1a2'),'singular':_0xd063('0x1a3')},'foreignKey':_0xd063('0x1a4'),'onDelete':'cascade','hooks':!![]});db[_0xd063('0x19f')][_0xd063('0x105')](db[_0xd063('0x77')],{'as':_0xd063('0x192'),'foreignKey':_0xd063('0x1a5'),'onDelete':'cascade','hooks':!![]});db[_0xd063('0x88')]['hasMany'](db[_0xd063('0x8e')],{'as':'Fields','onDelete':_0xd063('0x103'),'foreignKey':_0xd063('0x199'),'hooks':!![]});db[_0xd063('0x89')][_0xd063('0x105')](db[_0xd063('0x8e')],{'as':'Fields','onDelete':_0xd063('0x103'),'foreignKey':_0xd063('0x198')});db[_0xd063('0x1a6')]['hasMany'](db['AnalyticFieldReport'],{'as':_0xd063('0x1a7'),'onDelete':_0xd063('0x103'),'foreignKey':_0xd063('0x1a8')});db[_0xd063('0x8e')]['belongsTo'](db[_0xd063('0x1a6')],{'foreignKey':'MetricId'});db['SalesforceAccount'][_0xd063('0x105')](db[_0xd063('0x93')],{'as':_0xd063('0x1a9'),'onDelete':_0xd063('0x103'),'foreignKey':'AccountId'});db[_0xd063('0x93')][_0xd063('0x105')](db[_0xd063('0x94')],{'as':_0xd063('0x1aa'),'onDelete':_0xd063('0x103'),'foreignKey':_0xd063('0x1ab')});db['SalesforceConfiguration'][_0xd063('0x105')](db[_0xd063('0x94')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0xd063('0x1ac')});db['SalesforceConfiguration'][_0xd063('0x105')](db[_0xd063('0x94')],{'as':_0xd063('0x1a7'),'onDelete':_0xd063('0x103'),'foreignKey':'FieldId'});db['SalesforceConfiguration'][_0xd063('0x140')](db[_0xd063('0x91')],{'as':_0xd063('0x158'),'foreignKey':_0xd063('0x1ad')});db[_0xd063('0x94')][_0xd063('0x105')](db[_0xd063('0x94')],{'as':_0xd063('0x1ae'),'foreignKey':'SubjectId'});db[_0xd063('0x94')][_0xd063('0x105')](db[_0xd063('0x94')],{'as':'Description','foreignKey':_0xd063('0x1ac')});db['SalesforceField'][_0xd063('0x105')](db['SalesforceField'],{'as':_0xd063('0x1af'),'foreignKey':'FieldId'});db[_0xd063('0x94')][_0xd063('0x140')](db[_0xd063('0x1b0')],{'as':_0xd063('0x1b0'),'foreignKey':_0xd063('0x1b1')});db[_0xd063('0x96')][_0xd063('0x105')](db[_0xd063('0x98')],{'as':'Configurations','onDelete':_0xd063('0x103'),'foreignKey':_0xd063('0x1ad')});db[_0xd063('0x98')][_0xd063('0x105')](db[_0xd063('0x9a')],{'as':_0xd063('0x1aa'),'onDelete':_0xd063('0x103'),'foreignKey':'SubjectId'});db[_0xd063('0x98')][_0xd063('0x105')](db[_0xd063('0x9a')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0xd063('0x1ac')});db[_0xd063('0x98')]['hasMany'](db[_0xd063('0x9a')],{'as':'Fields','onDelete':'cascade','foreignKey':_0xd063('0x1b2')});db[_0xd063('0x98')]['belongsTo'](db[_0xd063('0x96')],{'as':_0xd063('0x158'),'foreignKey':_0xd063('0x1ad')});db[_0xd063('0x9a')][_0xd063('0x105')](db[_0xd063('0x9a')],{'as':_0xd063('0x1ae'),'foreignKey':_0xd063('0x1ab')});db[_0xd063('0x9a')][_0xd063('0x105')](db['SugarcrmField'],{'as':'Description','foreignKey':_0xd063('0x1ac')});db[_0xd063('0x9a')][_0xd063('0x105')](db[_0xd063('0x9a')],{'as':_0xd063('0x1af'),'foreignKey':_0xd063('0x1b2')});db[_0xd063('0x9a')][_0xd063('0x140')](db[_0xd063('0x1b0')],{'as':_0xd063('0x1b0'),'foreignKey':_0xd063('0x1b1')});db['DeskAccount'][_0xd063('0x105')](db[_0xd063('0x9d')],{'as':_0xd063('0x1a9'),'onDelete':_0xd063('0x103'),'foreignKey':'AccountId'});db[_0xd063('0x9d')]['hasMany'](db['DeskField'],{'as':_0xd063('0x1aa'),'onDelete':_0xd063('0x103'),'foreignKey':_0xd063('0x1ab')});db['DeskConfiguration'][_0xd063('0x105')](db['DeskField'],{'as':_0xd063('0x1b3'),'onDelete':_0xd063('0x103'),'foreignKey':_0xd063('0x1ac')});db[_0xd063('0x9d')][_0xd063('0x105')](db[_0xd063('0x9e')],{'as':_0xd063('0x1a7'),'onDelete':'cascade','foreignKey':_0xd063('0x1b2')});db[_0xd063('0x9d')][_0xd063('0x140')](db[_0xd063('0x1b4')],{'as':_0xd063('0x158'),'foreignKey':'AccountId'});db['DeskConfiguration'][_0xd063('0x115')](db['Tag'],{'through':_0xd063('0x1b5')});db[_0xd063('0x9e')][_0xd063('0x105')](db[_0xd063('0x9e')],{'as':'Subject','foreignKey':'SubjectId'});db['DeskField'][_0xd063('0x105')](db[_0xd063('0x9e')],{'as':_0xd063('0x1b6'),'foreignKey':'DescriptionId'});db['DeskField'][_0xd063('0x105')](db['DeskField'],{'as':_0xd063('0x1af'),'foreignKey':'FieldId'});db[_0xd063('0x9e')][_0xd063('0x140')](db[_0xd063('0x1b0')],{'as':_0xd063('0x1b0'),'foreignKey':_0xd063('0x1b1')});db[_0xd063('0x9f')][_0xd063('0x105')](db[_0xd063('0xa1')],{'as':'Configurations','onDelete':_0xd063('0x103'),'foreignKey':_0xd063('0x1ad')});db[_0xd063('0xa1')][_0xd063('0x105')](db[_0xd063('0x1b7')],{'as':_0xd063('0x1aa'),'onDelete':_0xd063('0x103'),'foreignKey':_0xd063('0x1ab')});db[_0xd063('0xa1')][_0xd063('0x105')](db[_0xd063('0x1b7')],{'as':_0xd063('0x1b3'),'onDelete':_0xd063('0x103'),'foreignKey':_0xd063('0x1ac')});db[_0xd063('0xa1')]['hasMany'](db[_0xd063('0x1b7')],{'as':_0xd063('0x1a7'),'onDelete':_0xd063('0x103'),'foreignKey':'FieldId'});db[_0xd063('0xa1')][_0xd063('0x140')](db[_0xd063('0x9f')],{'as':_0xd063('0x158'),'foreignKey':_0xd063('0x1ad')});db[_0xd063('0x1b7')]['hasMany'](db[_0xd063('0x1b7')],{'as':'Subject','foreignKey':_0xd063('0x1ab')});db[_0xd063('0x1b7')][_0xd063('0x105')](db[_0xd063('0x1b7')],{'as':_0xd063('0x1b6'),'foreignKey':'DescriptionId'});db[_0xd063('0x1b7')][_0xd063('0x105')](db[_0xd063('0x1b7')],{'as':'Field','foreignKey':'FieldId'});db[_0xd063('0x1b7')][_0xd063('0x140')](db[_0xd063('0x1b0')],{'as':_0xd063('0x1b0'),'foreignKey':_0xd063('0x1b1')});db[_0xd063('0xa4')][_0xd063('0x105')](db[_0xd063('0xa6')],{'as':_0xd063('0x1a9'),'onDelete':_0xd063('0x103'),'foreignKey':_0xd063('0x1ad')});db[_0xd063('0xa6')][_0xd063('0x105')](db[_0xd063('0xa8')],{'as':_0xd063('0x1aa'),'foreignKey':'SubjectId'});db['ZendeskConfiguration'][_0xd063('0x105')](db[_0xd063('0xa8')],{'as':_0xd063('0x1b3'),'foreignKey':_0xd063('0x1ac')});db[_0xd063('0xa6')][_0xd063('0x105')](db[_0xd063('0xa8')],{'as':_0xd063('0x1a7'),'foreignKey':_0xd063('0x1b2')});db[_0xd063('0xa6')][_0xd063('0x140')](db['ZendeskAccount'],{'as':_0xd063('0x158'),'foreignKey':'AccountId'});db[_0xd063('0xa6')][_0xd063('0x115')](db['Tag'],{'through':'int_zendesk_configuration_has_tags'});db['ZendeskField'][_0xd063('0x105')](db[_0xd063('0xa8')],{'as':_0xd063('0x1ae'),'foreignKey':_0xd063('0x1ab')});db[_0xd063('0xa8')][_0xd063('0x105')](db[_0xd063('0xa8')],{'as':_0xd063('0x1b6'),'foreignKey':_0xd063('0x1ac')});db[_0xd063('0xa8')][_0xd063('0x105')](db[_0xd063('0xa8')],{'as':_0xd063('0x1af'),'foreignKey':'FieldId'});db['ZendeskField'][_0xd063('0x140')](db['Variable'],{'as':_0xd063('0x1b0'),'foreignKey':_0xd063('0x1b1')});db[_0xd063('0xa9')][_0xd063('0x105')](db['FreshdeskConfiguration'],{'as':_0xd063('0x1a9'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xd063('0xab')][_0xd063('0x105')](db[_0xd063('0xad')],{'as':_0xd063('0x1aa'),'onDelete':_0xd063('0x103'),'foreignKey':'SubjectId'});db[_0xd063('0xab')][_0xd063('0x105')](db[_0xd063('0xad')],{'as':_0xd063('0x1b3'),'onDelete':_0xd063('0x103'),'foreignKey':_0xd063('0x1ac')});db['FreshdeskConfiguration']['hasMany'](db[_0xd063('0xad')],{'as':_0xd063('0x1a7'),'onDelete':'cascade','foreignKey':_0xd063('0x1b2')});db['FreshdeskConfiguration']['belongsTo'](db[_0xd063('0xa9')],{'as':_0xd063('0x158'),'foreignKey':_0xd063('0x1ad')});db[_0xd063('0xab')][_0xd063('0x115')](db[_0xd063('0x83')],{'through':_0xd063('0x1b8')});db['FreshdeskField'][_0xd063('0x105')](db['FreshdeskField'],{'as':'Subject','foreignKey':_0xd063('0x1ab')});db[_0xd063('0xad')][_0xd063('0x105')](db['FreshdeskField'],{'as':'Description','foreignKey':_0xd063('0x1ac')});db[_0xd063('0xad')][_0xd063('0x105')](db[_0xd063('0xad')],{'as':_0xd063('0x1af'),'foreignKey':_0xd063('0x1b2')});db[_0xd063('0xad')][_0xd063('0x140')](db['Variable'],{'as':_0xd063('0x1b0'),'foreignKey':'VariableId'});db[_0xd063('0xaf')][_0xd063('0x105')](db[_0xd063('0xb0')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xd063('0x1ad')});db[_0xd063('0xb0')][_0xd063('0x105')](db[_0xd063('0xb2')],{'as':_0xd063('0x1aa'),'foreignKey':'SubjectId'});db[_0xd063('0xb0')][_0xd063('0x105')](db['VtigerField'],{'as':_0xd063('0x1b3'),'foreignKey':_0xd063('0x1ac')});db[_0xd063('0xb0')]['hasMany'](db[_0xd063('0xb2')],{'as':_0xd063('0x1a7'),'foreignKey':_0xd063('0x1b2')});db['VtigerConfiguration'][_0xd063('0x140')](db[_0xd063('0xaf')],{'as':_0xd063('0x158'),'foreignKey':_0xd063('0x1ad')});db[_0xd063('0xb2')][_0xd063('0x105')](db[_0xd063('0xb2')],{'as':'Subject','foreignKey':_0xd063('0x1ab')});db['VtigerField'][_0xd063('0x105')](db[_0xd063('0xb2')],{'as':_0xd063('0x1b6'),'foreignKey':_0xd063('0x1ac')});db['VtigerField'][_0xd063('0x105')](db['VtigerField'],{'as':_0xd063('0x1af'),'foreignKey':'FieldId'});db['VtigerField']['belongsTo'](db[_0xd063('0x1b0')],{'as':_0xd063('0x1b0'),'foreignKey':'VariableId'});db[_0xd063('0x1b9')][_0xd063('0x105')](db[_0xd063('0xb5')],{'as':'Configurations','onDelete':_0xd063('0x103'),'foreignKey':_0xd063('0x1ad')});db[_0xd063('0xb5')][_0xd063('0x105')](db['ServicenowField'],{'as':_0xd063('0x1aa'),'foreignKey':_0xd063('0x1ab')});db[_0xd063('0xb5')]['hasMany'](db['ServicenowField'],{'as':_0xd063('0x1b3'),'foreignKey':_0xd063('0x1ac')});db['ServicenowConfiguration'][_0xd063('0x105')](db[_0xd063('0x1ba')],{'as':_0xd063('0x1a7'),'foreignKey':_0xd063('0x1b2')});db[_0xd063('0xb5')][_0xd063('0x140')](db[_0xd063('0x1b9')],{'as':'Account','foreignKey':_0xd063('0x1ad')});db[_0xd063('0x1ba')][_0xd063('0x105')](db['ServicenowField'],{'as':'Subject','foreignKey':_0xd063('0x1ab')});db[_0xd063('0x1ba')][_0xd063('0x105')](db[_0xd063('0x1ba')],{'as':'Description','foreignKey':_0xd063('0x1ac')});db[_0xd063('0x1ba')][_0xd063('0x105')](db[_0xd063('0x1ba')],{'as':'Field','foreignKey':'FieldId'});db[_0xd063('0x1ba')][_0xd063('0x140')](db[_0xd063('0x1b0')],{'as':_0xd063('0x1b0'),'foreignKey':_0xd063('0x1b1')});db[_0xd063('0xb8')][_0xd063('0x105')](db[_0xd063('0xba')],{'as':'Configurations','onDelete':_0xd063('0x103'),'foreignKey':_0xd063('0x1ad')});db[_0xd063('0xba')][_0xd063('0x105')](db[_0xd063('0x1bb')],{'as':_0xd063('0x1aa'),'onDelete':_0xd063('0x103'),'foreignKey':_0xd063('0x1ab')});db['Dynamics365Configuration'][_0xd063('0x105')](db[_0xd063('0x1bb')],{'as':_0xd063('0x1b3'),'onDelete':'cascade','foreignKey':_0xd063('0x1ac')});db['Dynamics365Configuration'][_0xd063('0x105')](db[_0xd063('0x1bb')],{'as':_0xd063('0x1a7'),'onDelete':_0xd063('0x103'),'foreignKey':_0xd063('0x1b2')});db['Dynamics365Configuration'][_0xd063('0x140')](db[_0xd063('0xb8')],{'as':_0xd063('0x158'),'foreignKey':_0xd063('0x1ad')});db[_0xd063('0x1bb')][_0xd063('0x105')](db[_0xd063('0x1bb')],{'as':'Subject','foreignKey':'SubjectId'});db['Dynamics365Field'][_0xd063('0x105')](db[_0xd063('0x1bb')],{'as':'Description','foreignKey':_0xd063('0x1ac')});db[_0xd063('0x1bb')][_0xd063('0x105')](db[_0xd063('0x1bb')],{'as':_0xd063('0x1af'),'foreignKey':_0xd063('0x1b2')});db[_0xd063('0x1bb')][_0xd063('0x140')](db[_0xd063('0x1b0')],{'as':_0xd063('0x1b0'),'foreignKey':_0xd063('0x1b1')});db[_0xd063('0xbc')]['hasMany'](db['FreshsalesConfiguration'],{'as':_0xd063('0x1a9'),'onDelete':_0xd063('0x103'),'foreignKey':'AccountId'});db[_0xd063('0xbd')][_0xd063('0x105')](db[_0xd063('0xbf')],{'as':_0xd063('0x1aa'),'foreignKey':_0xd063('0x1ab')});db[_0xd063('0xbd')]['hasMany'](db[_0xd063('0xbf')],{'as':_0xd063('0x1b3'),'foreignKey':_0xd063('0x1ac')});db[_0xd063('0xbd')]['hasMany'](db['FreshsalesField'],{'as':_0xd063('0x1a7'),'foreignKey':'FieldId'});db['FreshsalesConfiguration'][_0xd063('0x140')](db[_0xd063('0xbc')],{'as':'Account','foreignKey':_0xd063('0x1ad')});db[_0xd063('0xbf')]['hasMany'](db[_0xd063('0xbf')],{'as':_0xd063('0x1ae'),'foreignKey':_0xd063('0x1ab')});db[_0xd063('0xbf')][_0xd063('0x105')](db[_0xd063('0xbf')],{'as':_0xd063('0x1b6'),'foreignKey':_0xd063('0x1ac')});db[_0xd063('0xbf')]['hasMany'](db[_0xd063('0xbf')],{'as':_0xd063('0x1af'),'foreignKey':'FieldId'});db[_0xd063('0xbf')][_0xd063('0x140')](db[_0xd063('0x1b0')],{'as':_0xd063('0x1b0'),'foreignKey':_0xd063('0x1b1')});db[_0xd063('0xc2')]['belongsTo'](db[_0xd063('0x61')],{});db[_0xd063('0xc2')][_0xd063('0x140')](db[_0xd063('0xeb')],{'as':_0xd063('0x167'),'foreignKey':_0xd063('0x154')});db[_0xd063('0xc2')]['belongsTo'](db['CmContact'],{'as':_0xd063('0x159'),'foreignKey':_0xd063('0x14d')});db[_0xd063('0xc2')]['belongsTo'](db[_0xd063('0x64')],{});db['ChatQueueReport']['belongsTo'](db[_0xd063('0x17e')],{});db[_0xd063('0xc2')][_0xd063('0x140')](db[_0xd063('0x12')],{});db['ChatQueueReport'][_0xd063('0x140')](db[_0xd063('0x68')],{});db[_0xd063('0xc4')][_0xd063('0x140')](db[_0xd063('0x12')],{'onDelete':'cascade','foreignKey':_0xd063('0x1bc')});db['ChatInternalMessage'][_0xd063('0x140')](db[_0xd063('0x12')],{'onDelete':_0xd063('0x103'),'foreignKey':'ToId'});db[_0xd063('0xc9')][_0xd063('0x105')](db[_0xd063('0x1bd')],{'foreignKey':'SessionId','onDelete':_0xd063('0x103')});db[_0xd063('0xc9')]['hasMany'](db[_0xd063('0xc6')],{'foreignKey':'SessionId','onDelete':_0xd063('0x103')});db[_0xd063('0xcb')][_0xd063('0x140')](db['SmsAccount'],{});db[_0xd063('0xcb')][_0xd063('0x140')](db[_0xd063('0xeb')],{'as':'List','foreignKey':'ListId'});db[_0xd063('0xcb')][_0xd063('0x140')](db[_0xd063('0x6d')],{'as':_0xd063('0x159'),'foreignKey':_0xd063('0x14d')});db[_0xd063('0xcb')][_0xd063('0x140')](db['SmsInteraction'],{});db[_0xd063('0xcb')][_0xd063('0x140')](db[_0xd063('0x57')],{});db['SmsQueueReport'][_0xd063('0x140')](db[_0xd063('0x12')],{});db[_0xd063('0xcb')]['belongsTo'](db[_0xd063('0x123')],{});db[_0xd063('0xd0')][_0xd063('0x105')](db[_0xd063('0xc9')],{'foreignKey':'ProjectId'});db[_0xd063('0xd0')][_0xd063('0x105')](db[_0xd063('0x1bd')],{'foreignKey':_0xd063('0x1be')});db[_0xd063('0xd0')][_0xd063('0x105')](db[_0xd063('0xc6')],{'foreignKey':'ProjectId'});db[_0xd063('0xd6')][_0xd063('0x115')](db[_0xd063('0x12')],{'as':_0xd063('0x175'),'through':_0xd063('0x134')});db['Team'][_0xd063('0x115')](db['User'],{'as':_0xd063('0x144'),'through':'user_has_teams'});db[_0xd063('0xda')][_0xd063('0x115')](db['VoiceQueue'],{'through':_0xd063('0x146'),'as':'VoiceQueues'});db[_0xd063('0xda')][_0xd063('0x115')](db[_0xd063('0x3d')],{'through':_0xd063('0x1bf'),'as':_0xd063('0x11f')});db['Team'][_0xd063('0x115')](db[_0xd063('0x68')],{'through':'team_has_chat_queues','as':_0xd063('0x120')});db[_0xd063('0xda')][_0xd063('0x115')](db[_0xd063('0x52')],{'through':_0xd063('0x16f'),'as':_0xd063('0x122')});db['Team'][_0xd063('0x115')](db[_0xd063('0x123')],{'through':_0xd063('0x177'),'as':_0xd063('0x124')});db[_0xd063('0xda')][_0xd063('0x115')](db['OpenchannelQueue'],{'through':_0xd063('0x17b'),'as':_0xd063('0x125')});db['Team']['belongsToMany'](db[_0xd063('0xfe')],{'through':_0xd063('0x1c0'),'as':_0xd063('0x126')});db[_0xd063('0xdd')][_0xd063('0x105')](db[_0xd063('0x6e')],{'as':_0xd063('0x13c'),'foreignKey':_0xd063('0x18c')});db[_0xd063('0xdd')]['hasMany'](db[_0xd063('0x71')],{'as':'HopperFinals','foreignKey':'CampaignId'});db[_0xd063('0xdd')]['hasMany'](db[_0xd063('0x73')],{'as':'HopperHistories','foreignKey':_0xd063('0x18c')});db[_0xd063('0xdd')][_0xd063('0x105')](db[_0xd063('0x6f')],{'as':_0xd063('0x1c1'),'foreignKey':'CampaignId'});db[_0xd063('0xdd')][_0xd063('0x140')](db[_0xd063('0x13e')],{'as':_0xd063('0x13e'),'foreignKey':_0xd063('0x13f')});db[_0xd063('0xdd')][_0xd063('0x140')](db[_0xd063('0x13e')],{'as':_0xd063('0x141'),'foreignKey':_0xd063('0x142')});db[_0xd063('0xdd')][_0xd063('0x140')](db[_0xd063('0x7d')],{'as':'Interval','foreignKey':_0xd063('0x143')});db['Campaign'][_0xd063('0x140')](db['SquareProject'],{'as':_0xd063('0xd6'),'foreignKey':_0xd063('0x1c2')});db[_0xd063('0xdd')][_0xd063('0x115')](db[_0xd063('0xeb')],{'as':_0xd063('0x117'),'through':_0xd063('0x1c3')});db['Campaign']['belongsToMany'](db[_0xd063('0xeb')],{'as':_0xd063('0x147'),'through':'campaigns_has_cm_blacklists'});db['Attachment']['belongsTo'](db['ChatOfflineMessage'],{'as':_0xd063('0x161'),'foreignKey':_0xd063('0x162')});db[_0xd063('0xe3')][_0xd063('0x140')](db[_0xd063('0x42')],{});db[_0xd063('0xe3')]['belongsTo'](db['MailInteraction'],{});db[_0xd063('0xe3')]['belongsTo'](db[_0xd063('0x12c')],{'foreignKey':_0xd063('0x1c4'),'as':_0xd063('0x1c5')});db[_0xd063('0xe3')][_0xd063('0x140')](db[_0xd063('0x12')],{'foreignKey':_0xd063('0x1c6'),'as':'FromAgent'});db['MailTransferReport'][_0xd063('0x140')](db['User'],{'foreignKey':_0xd063('0x1c7'),'as':'ToAgent'});db[_0xd063('0xe3')][_0xd063('0x140')](db[_0xd063('0x3d')],{'foreignKey':_0xd063('0x1c8'),'as':_0xd063('0x1c9')});db[_0xd063('0xe3')]['belongsTo'](db[_0xd063('0x12c')],{'foreignKey':_0xd063('0x1ca'),'as':_0xd063('0x1cb')});db['ChatTransferReport'][_0xd063('0x140')](db[_0xd063('0x17e')],{});db[_0xd063('0x1cc')]['belongsTo'](db[_0xd063('0x64')],{});db[_0xd063('0x1cc')]['belongsTo'](db[_0xd063('0x61')],{'foreignKey':_0xd063('0x1cd'),'as':_0xd063('0x1c5')});db['ChatTransferReport']['belongsTo'](db[_0xd063('0x12')],{'foreignKey':_0xd063('0x1c6'),'as':_0xd063('0x1ce')});db[_0xd063('0x1cc')][_0xd063('0x140')](db[_0xd063('0x12')],{'foreignKey':_0xd063('0x1c7'),'as':_0xd063('0x1cf')});db['ChatTransferReport'][_0xd063('0x140')](db[_0xd063('0x68')],{'foreignKey':'ToChatQueueId','as':'ToQueue'});db['ChatTransferReport'][_0xd063('0x140')](db[_0xd063('0x61')],{'foreignKey':_0xd063('0x1d0'),'as':'ToAccount'});db[_0xd063('0xe6')][_0xd063('0x140')](db['FaxMessage'],{});db['FaxTransferReport'][_0xd063('0x140')](db[_0xd063('0x4e')],{});db[_0xd063('0xe6')][_0xd063('0x140')](db[_0xd063('0x4b')],{'foreignKey':_0xd063('0x1d1'),'as':_0xd063('0x1c5')});db[_0xd063('0xe6')][_0xd063('0x140')](db[_0xd063('0x12')],{'foreignKey':_0xd063('0x1c6'),'as':_0xd063('0x1ce')});db[_0xd063('0xe6')][_0xd063('0x140')](db[_0xd063('0x12')],{'foreignKey':_0xd063('0x1c7'),'as':_0xd063('0x1cf')});db[_0xd063('0xe6')]['belongsTo'](db[_0xd063('0x52')],{'foreignKey':_0xd063('0x1d2'),'as':'ToQueue'});db['FaxTransferReport']['belongsTo'](db['FaxAccount'],{'foreignKey':'ToFaxAccountId','as':_0xd063('0x1cb')});db['OpenchannelTransferReport'][_0xd063('0x140')](db['OpenchannelMessage'],{});db[_0xd063('0x1d3')][_0xd063('0x140')](db['OpenchannelInteraction'],{});db['OpenchannelTransferReport'][_0xd063('0x140')](db[_0xd063('0x12d')],{'foreignKey':'FromOpenchannelAccountId','as':_0xd063('0x1c5')});db[_0xd063('0x1d3')]['belongsTo'](db[_0xd063('0x12')],{'foreignKey':_0xd063('0x1c6'),'as':_0xd063('0x1ce')});db['OpenchannelTransferReport'][_0xd063('0x140')](db['User'],{'foreignKey':'ToUserId','as':_0xd063('0x1cf')});db['OpenchannelTransferReport'][_0xd063('0x140')](db[_0xd063('0x5f')],{'foreignKey':_0xd063('0x1d4'),'as':'ToQueue'});db[_0xd063('0x1d3')][_0xd063('0x140')](db[_0xd063('0x12d')],{'foreignKey':_0xd063('0x1d5'),'as':_0xd063('0x1cb')});db[_0xd063('0xe9')][_0xd063('0x140')](db[_0xd063('0x57')],{});db['SmsTransferReport'][_0xd063('0x140')](db[_0xd063('0x11b')],{});db[_0xd063('0xe9')][_0xd063('0x140')](db[_0xd063('0x53')],{'foreignKey':'FromSmsAccountId','as':_0xd063('0x1c5')});db['SmsTransferReport'][_0xd063('0x140')](db[_0xd063('0x12')],{'foreignKey':_0xd063('0x1c6'),'as':_0xd063('0x1ce')});db[_0xd063('0xe9')]['belongsTo'](db['User'],{'foreignKey':_0xd063('0x1c7'),'as':'ToAgent'});db[_0xd063('0xe9')][_0xd063('0x140')](db['SmsQueue'],{'foreignKey':_0xd063('0x1d6'),'as':_0xd063('0x1c9')});db['SmsTransferReport'][_0xd063('0x140')](db[_0xd063('0x53')],{'foreignKey':'ToSmsAccountId','as':_0xd063('0x1cb')});db[_0xd063('0xeb')][_0xd063('0x105')](db['Disposition'],{'as':_0xd063('0x151'),'foreignKey':_0xd063('0x154'),'onDelete':_0xd063('0x103')});db[_0xd063('0xeb')][_0xd063('0x105')](db[_0xd063('0x76')],{'as':'CustomFields','foreignKey':_0xd063('0x154')});db[_0xd063('0xeb')][_0xd063('0x105')](db[_0xd063('0x6d')],{'as':_0xd063('0x188'),'onDelete':_0xd063('0x103'),'foreignKey':_0xd063('0x154')});db[_0xd063('0xeb')]['hasMany'](db[_0xd063('0x71')],{'as':'HopperFinals','foreignKey':_0xd063('0x154')});db['CmList'][_0xd063('0x105')](db[_0xd063('0x73')],{'as':_0xd063('0x109'),'foreignKey':_0xd063('0x154')});db[_0xd063('0xeb')][_0xd063('0x105')](db[_0xd063('0x74')],{'as':_0xd063('0x74'),'foreignKey':'ListId'});db[_0xd063('0xeb')][_0xd063('0x115')](db[_0xd063('0x11e')],{'as':_0xd063('0x1d7'),'through':_0xd063('0x1d8')});db[_0xd063('0xeb')]['belongsToMany'](db[_0xd063('0x12')],{'as':'Agents','through':'cm_user_has_lists'});db[_0xd063('0x127')][_0xd063('0x105')](db[_0xd063('0x19')],{'as':_0xd063('0x107'),'onDelete':_0xd063('0x103')});db[_0xd063('0x127')][_0xd063('0x115')](db[_0xd063('0x12')],{'as':'Agents','through':'user_has_voice_prefixes'});db[_0xd063('0xed')][_0xd063('0x105')](db[_0xd063('0x12')],{'as':_0xd063('0x175'),'foreignKey':_0xd063('0x112')});db[_0xd063('0xed')][_0xd063('0x105')](db[_0xd063('0xef')],{'as':_0xd063('0x1d9'),'foreignKey':_0xd063('0x112'),'onDelete':'cascade'});db[_0xd063('0xef')]['hasMany'](db[_0xd063('0xf1')],{'as':'Resources','foreignKey':_0xd063('0x1da'),'onDelete':_0xd063('0x103')});db[_0xd063('0xf5')][_0xd063('0x105')](db['Disposition'],{'as':_0xd063('0x151'),'foreignKey':_0xd063('0x1db'),'onDelete':_0xd063('0x103')});db[_0xd063('0xf5')][_0xd063('0x105')](db[_0xd063('0x7a')],{'as':_0xd063('0x152'),'foreignKey':_0xd063('0x1db')});db[_0xd063('0xf5')][_0xd063('0x105')](db[_0xd063('0x1dc')],{'as':_0xd063('0x149'),'foreignKey':'WhatsappAccountId'});db[_0xd063('0xf5')][_0xd063('0x105')](db[_0xd063('0xf8')],{'as':_0xd063('0x153')});db[_0xd063('0xf5')]['hasMany'](db[_0xd063('0xf6')],{'as':_0xd063('0x137')});db[_0xd063('0xf5')]['belongsTo'](db[_0xd063('0xeb')],{'as':_0xd063('0x167'),'foreignKey':'ListId'});db['WhatsappAccount'][_0xd063('0x140')](db['Pause'],{'as':_0xd063('0x168'),'foreignKey':_0xd063('0x169')});db[_0xd063('0xf5')][_0xd063('0x115')](db[_0xd063('0x12')],{'as':'Agents','through':_0xd063('0x132')});db[_0xd063('0xf6')][_0xd063('0x140')](db[_0xd063('0x12')],{'onDelete':'restrict'});db['WhatsappApplication'][_0xd063('0x140')](db[_0xd063('0xfe')],{'onDelete':_0xd063('0x163')});db['WhatsappApplication'][_0xd063('0x140')](db[_0xd063('0xf5')],{'onDelete':'restrict'});db[_0xd063('0xf6')]['belongsTo'](db[_0xd063('0x7d')],{'onDelete':_0xd063('0x163'),'foreignKey':_0xd063('0x143')});db[_0xd063('0xf6')]['belongsTo'](db['Tag'],{'onDelete':'restrict','foreignKey':_0xd063('0x164')});db[_0xd063('0xf8')][_0xd063('0x105')](db[_0xd063('0x1dc')],{'as':'Messages','onDelete':'cascade','foreignKey':_0xd063('0x1dd')});db['WhatsappInteraction'][_0xd063('0x140')](db[_0xd063('0xf5')],{'as':_0xd063('0x158'),'foreignKey':_0xd063('0x1db')});db[_0xd063('0xf8')][_0xd063('0x140')](db[_0xd063('0x6d')],{'as':_0xd063('0x159'),'foreignKey':_0xd063('0x14d')});db[_0xd063('0xf8')][_0xd063('0x140')](db[_0xd063('0x12')],{'as':'Owner','foreignKey':_0xd063('0x104')});db[_0xd063('0xf8')][_0xd063('0x115')](db[_0xd063('0x83')],{'through':_0xd063('0x19e'),'as':'Tags'});db[_0xd063('0xf8')][_0xd063('0x115')](db[_0xd063('0x83')],{'through':_0xd063('0x19e'),'as':_0xd063('0x15d')});db[_0xd063('0xf8')][_0xd063('0x115')](db[_0xd063('0x12')],{'as':_0xd063('0x175'),'through':_0xd063('0x11d'),'foreignKey':_0xd063('0x1dd')});db[_0xd063('0x1dc')][_0xd063('0x140')](db[_0xd063('0x12')],{'as':_0xd063('0x12')});db[_0xd063('0x1dc')][_0xd063('0x140')](db['CmContact'],{'onDelete':_0xd063('0x103'),'as':_0xd063('0x159')});db[_0xd063('0x1dc')]['belongsTo'](db[_0xd063('0xf8')],{'onDelete':_0xd063('0x103'),'as':_0xd063('0x15f'),'foreignKey':'WhatsappInteractionId'});db[_0xd063('0x1dc')][_0xd063('0x140')](db[_0xd063('0xf5')],{'as':'Account','foreignKey':_0xd063('0x1db')});db[_0xd063('0xfa')][_0xd063('0x140')](db[_0xd063('0xf5')],{});db[_0xd063('0xfa')][_0xd063('0x140')](db['CmList'],{'as':'List','foreignKey':_0xd063('0x154')});db['WhatsappQueueReport'][_0xd063('0x140')](db[_0xd063('0x6d')],{'as':_0xd063('0x159'),'foreignKey':_0xd063('0x14d')});db['WhatsappQueueReport']['belongsTo'](db[_0xd063('0xf8')],{});db['WhatsappQueueReport']['belongsTo'](db[_0xd063('0xfe')],{});db[_0xd063('0xfa')][_0xd063('0x140')](db[_0xd063('0x1dc')],{});db[_0xd063('0xfa')][_0xd063('0x140')](db[_0xd063('0x12')],{});db[_0xd063('0xfc')][_0xd063('0x140')](db[_0xd063('0x1dc')],{});db[_0xd063('0xfc')][_0xd063('0x140')](db['WhatsappInteraction'],{});db[_0xd063('0xfc')][_0xd063('0x140')](db[_0xd063('0xf5')],{'foreignKey':_0xd063('0x1de'),'as':_0xd063('0x1c5')});db[_0xd063('0xfc')][_0xd063('0x140')](db['WhatsappAccount'],{'foreignKey':'ToWhatsappAccountId','as':_0xd063('0x1cb')});db[_0xd063('0xfc')][_0xd063('0x140')](db[_0xd063('0xfe')],{'foreignKey':_0xd063('0x1df'),'as':_0xd063('0x1c9')});db[_0xd063('0xfc')][_0xd063('0x140')](db[_0xd063('0x12')],{'foreignKey':'FromUserId','as':_0xd063('0x1ce')});db[_0xd063('0xfc')][_0xd063('0x140')](db['User'],{'foreignKey':_0xd063('0x1c7'),'as':_0xd063('0x1cf')});db[_0xd063('0xfe')][_0xd063('0x115')](db[_0xd063('0x12')],{'as':'Agents','through':_0xd063('0x37'),'foreignKey':_0xd063('0x1e0')});db[_0xd063('0xfe')][_0xd063('0x115')](db[_0xd063('0xda')],{'through':'team_has_whatsapp_queues','as':_0xd063('0x145')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x8be2=['MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','SmsTransferReport','CmList','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','User','hasOne','UserId','hasMany','VoiceQueuesRt','Extensions','cascade','HopperFinals','ReportAgentPreview','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','WhatsappInteractions','UserNotification','UserNotifications','SenderId','belongsTo','userProfileId','chat_group_has_users','Contacts','cm_user_has_contacts','belongsToMany','Lists','cm_user_has_lists','user_has_teams','MailInteractions','user_has_mail_interactions','user_has_chat_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','UserVoiceQueue','MailQueue','ChatQueue','ChatQueues','FaxQueues','SmsQueue','VoicePrefixes','user_has_voice_prefixes','ChatWebsite','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperHistories','JscriptySessionReport','JscriptySessions','Trunk','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','mailboxuser','mailbox','VoiceMailMessage','VoiceCallReport','QueueCalls','AgentReports','uniqueid','Contact','ContactId','MailAccountId','Imap','Dispositions','CannedAnswer','Answers','Interactions','List','ListId','team_has_mail_queues','Messages','MailInteractionId','Account','mail_interaction_has_tags','ThroughTags','Users','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessageId','restrict','TagId','Dashboard','Items','Disposition','FaxMessage','mandatoryDispositionPause','FaxInteractionId','FaxAccountId','fax_interaction_has_tags','Tags','user_has_fax_interactions','FaxQueueReport','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelMessage','OpenchannelQueueId','OpenchannelInteractionId','Owner','openchannel_interaction_has_tags','team_has_openchannel_queues','ProactiveActions','ChatApplication','Agent','Queue','chat_interaction_has_tags','ChatInteractionId','AttachmentId','ChatGroupId','Website','CompanyId','CmCompany','Company','cm_contact_has_tags','CampaignId','OwnerId','Automation','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','MailApplications','ChatApplications','SmsApplications','CustomReportId','whatsapp_interaction_has_tags','Trigger','AllConditions','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','Fields','AnalyticMetric','MetricId','Configurations','Subjects','Descriptions','DescriptionId','AccountId','Subject','SubjectId','FieldId','Variable','VariableId','SugarcrmAccount','SugarcrmConfiguration','Description','Field','ZohoField','ZendeskField','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskField','int_freshdesk_configuration_has_tags','FromId','ToId','JscriptyQuestionReport','SessionId','ProjectId','user_has_square_projects','MailQueues','team_has_chat_queues','team_has_fax_queues','SmsQueues','team_has_whatsapp_queues','WhatsappQueues','HopperBlacks','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','FromAgent','ToChatWebsiteId','FromFaxAccountId','ToUserId','FromOpenchannelAccountId','FromSmsAccountId','ToSmsAccountId','CustomFields','Queues','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappApplication','user_has_whatsapp_accounts','WhatsappInteractionId','WhatsappQueueReport','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','exports','sequelize','lodash','defaultsDeep','motion2','xC@LL1234','127.0.0.1','mysql','utf8mb4','utf8','utf8_general_ci','sequelizeHistory','xcall','name','database','password','options','username','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','VoiceTransferReport','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','MailAccount','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','SmsMessage','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../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','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/trigger/trigger.model','../api/variable/variable.model','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmField','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','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/integration/integration.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model'];(function(_0x11c609,_0x1b828e){var _0x3497a0=function(_0xb11987){while(--_0xb11987){_0x11c609['push'](_0x11c609['shift']());}};_0x3497a0(++_0x1b828e);}(_0x8be2,0x10a));var _0x28be=function(_0x5c0a22,_0x3e0eb3){_0x5c0a22=_0x5c0a22-0x0;var _0x292d8e=_0x8be2[_0x5c0a22];return _0x292d8e;};'use strict';var config=require('../config/environment');var Sequelize=require(_0x28be('0x0'));var _=require(_0x28be('0x1'));var jstz=require('jstz');var timezone=jstz['determine']();config['sequelize']=_[_0x28be('0x2')](config[_0x28be('0x0')],{'database':_0x28be('0x3'),'username':'xcall','password':_0x28be('0x4'),'options':{'host':_0x28be('0x5'),'port':0xcea,'dialect':_0x28be('0x6'),'dialectOptions':{'charset':_0x28be('0x7')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x28be('0x8'),'collate':_0x28be('0x9')}}});config[_0x28be('0xa')]=_[_0x28be('0x2')](config[_0x28be('0xa')],{'database':_0x28be('0x3'),'username':_0x28be('0xb'),'password':_0x28be('0x4'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x28be('0x6'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x28be('0xc')](),'define':{'charset':_0x28be('0x8'),'collate':_0x28be('0x9')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x28be('0x0')][_0x28be('0xd')],config[_0x28be('0x0')]['username'],config[_0x28be('0x0')][_0x28be('0xe')],config[_0x28be('0x0')][_0x28be('0xf')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x28be('0xa')][_0x28be('0xd')],config['sequelizeHistory'][_0x28be('0x10')],config[_0x28be('0xa')][_0x28be('0xe')],config[_0x28be('0xa')][_0x28be('0xf')])};db['User']=db['sequelize'][_0x28be('0x11')](_0x28be('0x12'));db[_0x28be('0x13')]=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0x14'));db['VoiceContext']=db[_0x28be('0x0')]['import'](_0x28be('0x15'));db[_0x28be('0x16')]=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0x17'));db[_0x28be('0x18')]=db[_0x28be('0x0')][_0x28be('0x11')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0x28be('0x19')]=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0x1a'));db[_0x28be('0x1b')]=db['sequelize']['import'](_0x28be('0x1c'));db[_0x28be('0x1d')]=db[_0x28be('0x0')]['import'](_0x28be('0x1e'));db[_0x28be('0x1f')]=db[_0x28be('0x0')]['import'](_0x28be('0x20'));db['VoiceMailMessage']=db[_0x28be('0x0')][_0x28be('0x11')]('../api/voiceMailMessage/voiceMailMessage.model');db['VoiceCallReport']=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0x21'));db[_0x28be('0x22')]=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0x23'));db[_0x28be('0x24')]=db['sequelize']['import'](_0x28be('0x25'));db[_0x28be('0x26')]=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0x27'));db[_0x28be('0x28')]=db[_0x28be('0x0')][_0x28be('0x11')]('../api/memberReport/memberReport.model');db['Trunk']=db['sequelize'][_0x28be('0x11')]('../api/trunk/trunk.model');db[_0x28be('0x29')]=db[_0x28be('0x0')][_0x28be('0x11')]('../api/voiceTransferReport/voiceTransferReport.model');db[_0x28be('0x2a')]=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0x2b'));db['UserVoiceQueue']=db[_0x28be('0x0')]['import']('../api/userVoiceQueue/userVoiceQueue.model');db[_0x28be('0x2c')]=db[_0x28be('0x0')]['import'](_0x28be('0x2d'));db[_0x28be('0x2e')]=db['sequelize'][_0x28be('0x11')](_0x28be('0x2f'));db[_0x28be('0x30')]=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0x31'));db[_0x28be('0x32')]=db['sequelize'][_0x28be('0x11')](_0x28be('0x33'));db[_0x28be('0x34')]=db[_0x28be('0x0')][_0x28be('0x11')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x28be('0x35')]=db['sequelize']['import'](_0x28be('0x36'));db[_0x28be('0x37')]=db[_0x28be('0x0')]['import'](_0x28be('0x38'));db[_0x28be('0x39')]=db[_0x28be('0x0')][_0x28be('0x11')]('../api/mailServerOut/mailServerOut.model');db[_0x28be('0x3a')]=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0x3b'));db['MailQueue']=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0x3c'));db[_0x28be('0x3d')]=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0x3e'));db[_0x28be('0x3f')]=db[_0x28be('0x0')][_0x28be('0x11')]('../api/mailInteraction/mailInteraction.model');db[_0x28be('0x40')]=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0x41'));db[_0x28be('0x42')]=db['sequelize']['import']('../api/mailApplication/mailApplication.model');db[_0x28be('0x43')]=db['sequelize']['import'](_0x28be('0x44'));db['Dashboard']=db[_0x28be('0x0')]['import'](_0x28be('0x45'));db[_0x28be('0x46')]=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0x47'));db[_0x28be('0x48')]=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0x49'));db[_0x28be('0x4a')]=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0x4b'));db[_0x28be('0x4c')]=db[_0x28be('0x0')][_0x28be('0x11')]('../api/faxInteraction/faxInteraction.model');db['FaxMessage']=db[_0x28be('0x0')]['import'](_0x28be('0x4d'));db[_0x28be('0x4e')]=db[_0x28be('0x0')]['import'](_0x28be('0x4f'));db['FaxQueueReport']=db[_0x28be('0x0')]['import']('../api/faxQueueReport/faxQueueReport.model');db[_0x28be('0x50')]=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0x51'));db[_0x28be('0x52')]=db[_0x28be('0x0')][_0x28be('0x11')]('../api/smsApplication/smsApplication.model');db[_0x28be('0x53')]=db[_0x28be('0x0')][_0x28be('0x11')]('../api/smsInteraction/smsInteraction.model');db[_0x28be('0x54')]=db[_0x28be('0x0')][_0x28be('0x11')]('../api/smsMessage/smsMessage.model');db['SmsQueue']=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0x55'));db[_0x28be('0x56')]=db['sequelize']['import'](_0x28be('0x57'));db[_0x28be('0x58')]=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0x59'));db[_0x28be('0x5a')]=db[_0x28be('0x0')][_0x28be('0x11')]('../api/openchannelInteraction/openchannelInteraction.model');db['OpenchannelMessage']=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0x5b'));db[_0x28be('0x5c')]=db['sequelize']['import'](_0x28be('0x5d'));db['ChatWebsite']=db['sequelize']['import'](_0x28be('0x5e'));db[_0x28be('0x5f')]=db[_0x28be('0x0')]['import'](_0x28be('0x60'));db['ChatApplication']=db['sequelize'][_0x28be('0x11')](_0x28be('0x61'));db[_0x28be('0x62')]=db[_0x28be('0x0')]['import'](_0x28be('0x63'));db[_0x28be('0x64')]=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0x65'));db[_0x28be('0x66')]=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0x67'));db['ChatQueue']=db['sequelize'][_0x28be('0x11')](_0x28be('0x68'));db[_0x28be('0x69')]=db['sequelize'][_0x28be('0x11')](_0x28be('0x6a'));db[_0x28be('0x6b')]=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0x6c'));db['CmCompany']=db[_0x28be('0x0')]['import'](_0x28be('0x6d'));db[_0x28be('0x6e')]=db['sequelize'][_0x28be('0x11')](_0x28be('0x6f'));db[_0x28be('0x70')]=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0x71'));db[_0x28be('0x72')]=db[_0x28be('0x0')]['import'](_0x28be('0x73'));db[_0x28be('0x74')]=db['sequelize'][_0x28be('0x11')](_0x28be('0x75'));db[_0x28be('0x76')]=db['sequelize'][_0x28be('0x11')](_0x28be('0x77'));db['ReportAgentPreview']=db[_0x28be('0x0')][_0x28be('0x11')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0x28be('0x78')]=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0x79'));db[_0x28be('0x7a')]=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0x7b'));db['Automation']=db[_0x28be('0x0')][_0x28be('0x11')]('../api/automation/automation.model');db['CannedAnswer']=db[_0x28be('0x0')]['import'](_0x28be('0x7c'));db['Disposition']=db['sequelize'][_0x28be('0x11')](_0x28be('0x7d'));db[_0x28be('0x7e')]=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0x7f'));db[_0x28be('0x80')]=db['sequelize'][_0x28be('0x11')](_0x28be('0x81'));db[_0x28be('0x82')]=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0x83'));db[_0x28be('0x84')]=db['sequelize'][_0x28be('0x11')](_0x28be('0x85'));db['VoiceQueuesLog']=db['sequelize'][_0x28be('0x11')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x28be('0x86')]=db[_0x28be('0x0')]['import'](_0x28be('0x87'));db[_0x28be('0x88')]=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0x89'));db[_0x28be('0x8a')]=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0x8b'));db[_0x28be('0x8c')]=db[_0x28be('0x0')]['import']('../api/template/template.model');db['Trigger']=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0x8d'));db['Variable']=db['sequelize'][_0x28be('0x11')](_0x28be('0x8e'));db[_0x28be('0x8f')]=db[_0x28be('0x0')][_0x28be('0x11')]('../api/integration/integration.model');db[_0x28be('0x90')]=db['sequelize'][_0x28be('0x11')](_0x28be('0x91'));db[_0x28be('0x92')]=db[_0x28be('0x0')]['import'](_0x28be('0x93'));db[_0x28be('0x94')]=db[_0x28be('0x0')]['import'](_0x28be('0x95'));db['AnalyticExtractedReport']=db['sequelize'][_0x28be('0x11')](_0x28be('0x96'));db['AnalyticMetric']=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0x97'));db[_0x28be('0x98')]=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0x99'));db[_0x28be('0x9a')]=db['sequelize'][_0x28be('0x11')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0x28be('0x9b')]=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0x9c'));db[_0x28be('0x9d')]=db[_0x28be('0x0')]['import'](_0x28be('0x9e'));db[_0x28be('0x9f')]=db[_0x28be('0x0')][_0x28be('0x11')]('../api/intSalesforceField/intSalesforceField.model');db['SugarcrmAccount']=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0xa0'));db['SugarcrmConfiguration']=db[_0x28be('0x0')][_0x28be('0x11')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x28be('0xa1')]=db['sequelize'][_0x28be('0x11')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0x28be('0xa2')]=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0xa3'));db[_0x28be('0xa4')]=db['sequelize']['import'](_0x28be('0xa5'));db[_0x28be('0xa6')]=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0xa7'));db[_0x28be('0xa8')]=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0xa9'));db[_0x28be('0xaa')]=db[_0x28be('0x0')]['import'](_0x28be('0xab'));db['ZohoField']=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0xac'));db[_0x28be('0xad')]=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0xae'));db['ZendeskConfiguration']=db[_0x28be('0x0')]['import'](_0x28be('0xaf'));db['ZendeskField']=db[_0x28be('0x0')]['import'](_0x28be('0xb0'));db['FreshdeskAccount']=db['sequelize'][_0x28be('0x11')](_0x28be('0xb1'));db[_0x28be('0xb2')]=db[_0x28be('0x0')]['import'](_0x28be('0xb3'));db['FreshdeskField']=db['sequelize'][_0x28be('0x11')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0x28be('0xb4')]=db[_0x28be('0x0')]['import'](_0x28be('0xb5'));db[_0x28be('0xb6')]=db[_0x28be('0x0')]['import'](_0x28be('0xb7'));db[_0x28be('0xb8')]=db['sequelize'][_0x28be('0x11')]('../api/intVtigerField/intVtigerField.model');db[_0x28be('0xb9')]=db['sequelize'][_0x28be('0x11')](_0x28be('0xba'));db[_0x28be('0xbb')]=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0xbc'));db[_0x28be('0xbd')]=db[_0x28be('0x0')]['import'](_0x28be('0xbe'));db[_0x28be('0xbf')]=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0xc0'));db[_0x28be('0xc1')]=db[_0x28be('0x0')][_0x28be('0x11')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0x28be('0xc2')]=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0xc3'));db[_0x28be('0xc4')]=db[_0x28be('0x0')]['import'](_0x28be('0xc5'));db[_0x28be('0xc6')]=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0xc7'));db[_0x28be('0xc8')]=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0xc9'));db[_0x28be('0x8f')]=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0xca'));db[_0x28be('0xcb')]=db[_0x28be('0x0')]['import'](_0x28be('0xcc'));db[_0x28be('0xcd')]=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0xce'));db[_0x28be('0xcf')]=db['sequelize'][_0x28be('0x11')](_0x28be('0xd0'));db[_0x28be('0xd1')]=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0xd2'));db['JscriptyQuestionReport']=db['sequelize']['import'](_0x28be('0xd3'));db['JscriptySessionReport']=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0xd4'));db[_0x28be('0xd5')]=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0xd6'));db[_0x28be('0xd7')]=db[_0x28be('0x0')]['import']('../api/squareReport/squareReport.model');db['SquareDetailsReport']=db['sequelize'][_0x28be('0x11')]('../api/squareReportDetail/squareReportDetail.model');db[_0x28be('0xd8')]=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0xd9'));db['Setting']=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0xda'));db[_0x28be('0xdb')]=db['sequelize'][_0x28be('0x11')](_0x28be('0xdc'));db[_0x28be('0xdd')]=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0xde'));db['SquareRecording']=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0xdf'));db[_0x28be('0xe0')]=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0xe1'));db[_0x28be('0xe2')]=db['sequelize'][_0x28be('0x11')](_0x28be('0xe3'));db['License']=db[_0x28be('0x0')]['import'](_0x28be('0xe4'));db[_0x28be('0xe5')]=db['sequelize']['import'](_0x28be('0xe6'));db[_0x28be('0xe7')]=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0xe8'));db[_0x28be('0xe9')]=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0xea'));db[_0x28be('0xeb')]=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0xec'));db[_0x28be('0xed')]=db['sequelize'][_0x28be('0x11')](_0x28be('0xee'));db[_0x28be('0xef')]=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0xf0'));db[_0x28be('0xf1')]=db['sequelize'][_0x28be('0x11')](_0x28be('0xf2'));db[_0x28be('0xf3')]=db[_0x28be('0x0')][_0x28be('0x11')]('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0x28be('0xf4')]=db[_0x28be('0x0')]['import']('../api/smsTransferReport/smsTransferReport.model');db[_0x28be('0xf5')]=db[_0x28be('0x0')][_0x28be('0x11')]('../api/cmList/cmList.model');db[_0x28be('0xf6')]=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0xf7'));db[_0x28be('0xf8')]=db[_0x28be('0x0')]['import']('../api/userProfile/userProfile.model');db[_0x28be('0xf9')]=db['sequelize'][_0x28be('0x11')](_0x28be('0xfa'));db[_0x28be('0xfb')]=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0xfc'));db['UserNotification']=db['sequelize'][_0x28be('0x11')](_0x28be('0xfd'));db[_0x28be('0xfe')]=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0xff'));db['WhatsappApplication']=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0x100'));db[_0x28be('0x101')]=db[_0x28be('0x0')]['import'](_0x28be('0x102'));db[_0x28be('0x103')]=db[_0x28be('0x0')][_0x28be('0x11')]('../api/whatsappMessage/whatsappMessage.model');db['WhatsappQueueReport']=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0x104'));db['WhatsappTransferReport']=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0x105'));db[_0x28be('0x106')]=db[_0x28be('0x0')]['import'](_0x28be('0x107'));db[_0x28be('0x108')]=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0x109'));db[_0x28be('0x10a')]=db[_0x28be('0x0')][_0x28be('0x11')](_0x28be('0x10b'));db[_0x28be('0x10c')][_0x28be('0x10d')](db['VoiceMail'],{'as':_0x28be('0x1f'),'onDelete':'cascade','foreignKey':'UserId'});db[_0x28be('0x10c')]['hasMany'](db[_0x28be('0x1b')],{'as':'Recordings','foreignKey':_0x28be('0x10e')});db[_0x28be('0x10c')][_0x28be('0x10f')](db[_0x28be('0x2a')],{'as':_0x28be('0x110'),'foreignKey':'UserId'});db[_0x28be('0x10c')]['hasMany'](db[_0x28be('0x16')],{'as':_0x28be('0x111'),'onDelete':_0x28be('0x112'),'hooks':!![]});db[_0x28be('0x10c')][_0x28be('0x10f')](db[_0x28be('0x74')],{'as':_0x28be('0x113'),'foreignKey':_0x28be('0x10e')});db[_0x28be('0x10c')]['hasMany'](db[_0x28be('0x76')],{'as':'HopperHistory','foreignKey':_0x28be('0x10e')});db[_0x28be('0x10c')][_0x28be('0x10f')](db[_0x28be('0x114')],{'as':_0x28be('0x114'),'foreignKey':'UserId'});db[_0x28be('0x10c')]['hasMany'](db[_0x28be('0x5a')],{'as':_0x28be('0x115'),'foreignKey':_0x28be('0x10e')});db[_0x28be('0x10c')][_0x28be('0x10f')](db[_0x28be('0x62')],{'as':_0x28be('0x116'),'foreignKey':_0x28be('0x10e')});db[_0x28be('0x10c')][_0x28be('0x10f')](db[_0x28be('0x53')],{'as':_0x28be('0x117'),'foreignKey':'UserId'});db[_0x28be('0x10c')][_0x28be('0x10f')](db[_0x28be('0x4c')],{'as':_0x28be('0x118'),'foreignKey':_0x28be('0x10e')});db[_0x28be('0x10c')][_0x28be('0x10f')](db[_0x28be('0x3f')],{'as':'MailInteractions','foreignKey':_0x28be('0x10e')});db[_0x28be('0x10c')][_0x28be('0x10f')](db[_0x28be('0x101')],{'as':_0x28be('0x119'),'foreignKey':_0x28be('0x10e')});db[_0x28be('0x10c')][_0x28be('0x10f')](db[_0x28be('0x11a')],{'as':_0x28be('0x11b'),'foreignKey':_0x28be('0x11c')});db[_0x28be('0x10c')][_0x28be('0x11d')](db['UserProfile'],{'as':_0x28be('0xf8'),'foreignKey':_0x28be('0x11e')});db[_0x28be('0x10c')]['belongsToMany'](db[_0x28be('0x69')],{'as':'Groups','through':_0x28be('0x11f')});db['User']['belongsToMany'](db[_0x28be('0x6e')],{'as':_0x28be('0x120'),'through':_0x28be('0x121')});db[_0x28be('0x10c')][_0x28be('0x122')](db[_0x28be('0xf5')],{'as':_0x28be('0x123'),'through':_0x28be('0x124')});db[_0x28be('0x10c')][_0x28be('0x122')](db[_0x28be('0xe2')],{'through':_0x28be('0x125')});db['User'][_0x28be('0x122')](db[_0x28be('0x3f')],{'as':_0x28be('0x126'),'through':_0x28be('0x127')});db['User'][_0x28be('0x122')](db[_0x28be('0x62')],{'as':_0x28be('0x116'),'through':_0x28be('0x128')});db[_0x28be('0x10c')][_0x28be('0x122')](db['FaxInteraction'],{'as':_0x28be('0x118'),'through':'user_has_fax_interactions'});db['User']['belongsToMany'](db[_0x28be('0x53')],{'as':_0x28be('0x117'),'through':_0x28be('0x129')});db[_0x28be('0x10c')][_0x28be('0x122')](db[_0x28be('0x5a')],{'as':'OpenchannelInteractions','through':_0x28be('0x12a')});db[_0x28be('0x10c')][_0x28be('0x122')](db[_0x28be('0x101')],{'as':_0x28be('0x119'),'through':_0x28be('0x12b')});db[_0x28be('0x10c')][_0x28be('0x122')](db[_0x28be('0x19')],{'as':_0x28be('0x12c'),'through':_0x28be('0x12d'),'required':![]});db['User'][_0x28be('0x122')](db[_0x28be('0x12e')],{'as':'MailQueues','through':_0x28be('0x2e'),'required':![]});db['User'][_0x28be('0x122')](db[_0x28be('0x12f')],{'as':_0x28be('0x130'),'through':_0x28be('0x2c'),'required':![],'hooks':!![]});db['User'][_0x28be('0x122')](db[_0x28be('0x4e')],{'as':_0x28be('0x131'),'through':_0x28be('0x30'),'required':![]});db[_0x28be('0x10c')][_0x28be('0x122')](db[_0x28be('0x132')],{'as':'SmsQueues','through':'UserSmsQueue','required':![]});db[_0x28be('0x10c')][_0x28be('0x122')](db[_0x28be('0x5c')],{'as':'OpenchannelQueues','through':'UserOpenchannelQueue','required':![]});db['User']['belongsToMany'](db[_0x28be('0x106')],{'as':'WhatsappQueues','through':_0x28be('0x35'),'required':![]});db[_0x28be('0x10c')][_0x28be('0x122')](db[_0x28be('0xf5')],{'through':'cm_user_has_lists'});db['User'][_0x28be('0x122')](db[_0x28be('0xf6')],{'as':_0x28be('0x133'),'through':_0x28be('0x134'),'required':![]});db['User']['belongsToMany'](db[_0x28be('0x135')],{'as':_0x28be('0x136'),'through':_0x28be('0x137')});db[_0x28be('0x10c')][_0x28be('0x122')](db[_0x28be('0x48')],{'as':_0x28be('0x138'),'through':_0x28be('0x139')});db['User']['belongsToMany'](db[_0x28be('0x3a')],{'as':_0x28be('0x13a'),'through':_0x28be('0x13b')});db[_0x28be('0x10c')][_0x28be('0x122')](db[_0x28be('0x56')],{'as':_0x28be('0x13c'),'through':_0x28be('0x13d')});db[_0x28be('0x10c')]['belongsToMany'](db['SmsAccount'],{'as':_0x28be('0x13e'),'through':_0x28be('0x13f')});db[_0x28be('0x10c')]['belongsToMany'](db['WhatsappAccount'],{'as':_0x28be('0x140'),'through':'user_has_whatsapp_accounts'});db[_0x28be('0x10c')][_0x28be('0x122')](db[_0x28be('0xdd')],{'as':'SquareProjects','through':'user_has_square_projects'});db['VoiceChanSpy'][_0x28be('0x10f')](db[_0x28be('0x16')],{'as':_0x28be('0x141'),'onDelete':_0x28be('0x112'),'foreignKey':_0x28be('0x142')});db['VoiceContext'][_0x28be('0x10f')](db[_0x28be('0x16')],{'onDelete':_0x28be('0x112')});db[_0x28be('0x16')][_0x28be('0x10f')](db['VoiceExtension'],{'as':_0x28be('0x143'),'onDelete':_0x28be('0x112')});db['VoiceMusicOnHold'][_0x28be('0x122')](db[_0x28be('0x88')],{'as':_0x28be('0x144'),'through':_0x28be('0x145')});db['VoiceQueue'][_0x28be('0x10f')](db['UserVoiceQueueRt'],{'as':_0x28be('0x146'),'foreignKey':_0x28be('0x147')});db[_0x28be('0x19')]['hasMany'](db[_0x28be('0x70')],{'as':_0x28be('0x148'),'foreignKey':_0x28be('0x147')});db[_0x28be('0x19')][_0x28be('0x10f')](db[_0x28be('0x74')],{'as':_0x28be('0x113'),'foreignKey':_0x28be('0x147')});db[_0x28be('0x19')]['hasMany'](db[_0x28be('0x76')],{'as':_0x28be('0x149'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x28be('0x10f')](db[_0x28be('0x114')],{'as':_0x28be('0x114'),'foreignKey':'VoiceQueueId'});db[_0x28be('0x19')][_0x28be('0x10f')](db[_0x28be('0x72')],{'as':'HopperBlacks','foreignKey':_0x28be('0x147')});db[_0x28be('0x19')][_0x28be('0x10f')](db[_0x28be('0x14a')],{'as':_0x28be('0x14b'),'foreignKey':_0x28be('0x147')});db[_0x28be('0x19')]['belongsTo'](db[_0x28be('0x14c')],{'as':_0x28be('0x14c'),'foreignKey':_0x28be('0x14d')});db[_0x28be('0x19')][_0x28be('0x11d')](db[_0x28be('0x14c')],{'as':_0x28be('0x14e'),'foreignKey':_0x28be('0x14f')});db[_0x28be('0x19')][_0x28be('0x11d')](db['Interval'],{'as':_0x28be('0x80'),'foreignKey':_0x28be('0x150')});db[_0x28be('0x19')][_0x28be('0x11d')](db[_0x28be('0x82')],{'as':'mandatoryDispositionPause','foreignKey':_0x28be('0x151')});db['VoiceQueue']['belongsToMany'](db['CmList'],{'as':_0x28be('0x123'),'through':_0x28be('0x152')});db['VoiceQueue'][_0x28be('0x122')](db[_0x28be('0x10c')],{'as':_0x28be('0x153'),'through':_0x28be('0x12d')});db[_0x28be('0x19')]['belongsToMany'](db[_0x28be('0xe2')],{'as':_0x28be('0x154'),'through':_0x28be('0x10a')});db[_0x28be('0x19')][_0x28be('0x122')](db[_0x28be('0xf5')],{'as':_0x28be('0x155'),'through':_0x28be('0x156')});db[_0x28be('0x1b')][_0x28be('0x11d')](db[_0x28be('0x10c')],{'as':_0x28be('0x10c'),'foreignKey':'UserId'});db[_0x28be('0x1d')][_0x28be('0x11d')](db['User'],{'as':_0x28be('0x10c'),'foreignKey':_0x28be('0x10e')});db[_0x28be('0x1f')][_0x28be('0x10f')](db['VoiceMailMessage'],{'as':'Messages','onDelete':_0x28be('0x112'),'foreignKey':_0x28be('0x157'),'sourceKey':_0x28be('0x158')});db[_0x28be('0x159')][_0x28be('0x11d')](db['VoiceMail'],{'foreignKey':'mailboxuser','targetKey':_0x28be('0x158')});db[_0x28be('0x15a')][_0x28be('0x10f')](db[_0x28be('0x26')],{'as':_0x28be('0x15b'),'foreignKey':'uniqueid','constraints':![]});db['VoiceCallReport'][_0x28be('0x10f')](db[_0x28be('0x24')],{'as':_0x28be('0x15c'),'foreignKey':_0x28be('0x15d'),'constraints':![]});db[_0x28be('0x15a')][_0x28be('0x11d')](db['User'],{'as':_0x28be('0x10c'),'foreignKey':_0x28be('0x10e')});db[_0x28be('0x15a')][_0x28be('0x11d')](db[_0x28be('0x6e')],{'as':_0x28be('0x15e'),'foreignKey':_0x28be('0x15f')});db[_0x28be('0x37')][_0x28be('0x11d')](db[_0x28be('0x3a')],{'as':_0x28be('0x3a'),'foreignKey':_0x28be('0x160')});db['MailServerOut'][_0x28be('0x11d')](db[_0x28be('0x3a')],{'as':_0x28be('0x3a'),'foreignKey':_0x28be('0x160')});db[_0x28be('0x3a')][_0x28be('0x10d')](db[_0x28be('0x37')],{'as':_0x28be('0x161'),'onDelete':'cascade'});db['MailAccount'][_0x28be('0x10d')](db[_0x28be('0x39')],{'as':'Smtp','onDelete':_0x28be('0x112')});db[_0x28be('0x3a')]['hasMany'](db['Disposition'],{'as':_0x28be('0x162'),'foreignKey':_0x28be('0x160'),'onDelete':_0x28be('0x112')});db['MailAccount'][_0x28be('0x10f')](db[_0x28be('0x163')],{'as':_0x28be('0x164'),'foreignKey':_0x28be('0x160')});db[_0x28be('0x3a')]['hasMany'](db['MailMessage'],{'as':'Messages','foreignKey':_0x28be('0x160')});db[_0x28be('0x3a')][_0x28be('0x10f')](db[_0x28be('0x3f')],{'as':_0x28be('0x165')});db[_0x28be('0x3a')]['hasMany'](db[_0x28be('0x42')],{'as':_0x28be('0x143')});db['MailAccount'][_0x28be('0x11d')](db['CmList'],{'as':_0x28be('0x166'),'foreignKey':_0x28be('0x167')});db['MailAccount'][_0x28be('0x11d')](db[_0x28be('0x8c')],{'as':_0x28be('0x8c'),'foreignKey':'TemplateId'});db['MailAccount'][_0x28be('0x11d')](db[_0x28be('0x82')],{'as':'mandatoryDispositionPause','foreignKey':_0x28be('0x151')});db[_0x28be('0x3a')][_0x28be('0x122')](db['User'],{'as':_0x28be('0x153'),'through':_0x28be('0x13b')});db[_0x28be('0x12e')][_0x28be('0x122')](db[_0x28be('0x10c')],{'as':_0x28be('0x153'),'through':'UserMailQueue'});db['MailQueue'][_0x28be('0x122')](db[_0x28be('0xe2')],{'through':_0x28be('0x168'),'as':'Teams'});db['MailInteraction']['hasMany'](db['MailMessage'],{'as':_0x28be('0x169'),'onDelete':'cascade','foreignKey':_0x28be('0x16a')});db['MailInteraction']['belongsTo'](db['MailAccount'],{'as':_0x28be('0x16b'),'foreignKey':'MailAccountId'});db[_0x28be('0x3f')][_0x28be('0x11d')](db['CmContact'],{'as':_0x28be('0x15e'),'foreignKey':_0x28be('0x15f')});db[_0x28be('0x3f')][_0x28be('0x11d')](db[_0x28be('0x10c')],{'as':'Owner','foreignKey':'UserId'});db[_0x28be('0x3f')][_0x28be('0x122')](db[_0x28be('0x8a')],{'through':_0x28be('0x16c'),'as':'Tags'});db[_0x28be('0x3f')]['belongsToMany'](db[_0x28be('0x8a')],{'through':'mail_interaction_has_tags','as':_0x28be('0x16d')});db[_0x28be('0x3f')][_0x28be('0x122')](db[_0x28be('0x10c')],{'as':_0x28be('0x16e'),'through':_0x28be('0x127'),'foreignKey':_0x28be('0x16a')});db[_0x28be('0x40')]['hasMany'](db[_0x28be('0xe9')],{'as':_0x28be('0x16f'),'onDelete':_0x28be('0x112')});db[_0x28be('0x40')]['belongsTo'](db[_0x28be('0x10c')],{'as':_0x28be('0x10c')});db[_0x28be('0x40')][_0x28be('0x11d')](db[_0x28be('0x6e')],{'onDelete':_0x28be('0x112'),'as':_0x28be('0x15e')});db[_0x28be('0x40')][_0x28be('0x11d')](db[_0x28be('0x3f')],{'as':_0x28be('0x170'),'foreignKey':_0x28be('0x16a')});db[_0x28be('0x40')][_0x28be('0x11d')](db['MailAccount'],{'as':_0x28be('0x16b'),'foreignKey':_0x28be('0x160')});db[_0x28be('0x40')][_0x28be('0x11d')](db[_0x28be('0x135')],{'as':_0x28be('0x135'),'foreignKey':_0x28be('0x171')});db[_0x28be('0x40')][_0x28be('0x11d')](db[_0x28be('0x66')],{'as':_0x28be('0x66'),'foreignKey':_0x28be('0x172')});db[_0x28be('0x42')][_0x28be('0x11d')](db['User'],{'onDelete':_0x28be('0x173')});db[_0x28be('0x42')][_0x28be('0x11d')](db['MailQueue'],{'onDelete':_0x28be('0x173')});db[_0x28be('0x42')][_0x28be('0x11d')](db['MailAccount'],{'onDelete':'restrict'});db[_0x28be('0x42')]['belongsTo'](db[_0x28be('0x80')],{'onDelete':_0x28be('0x173'),'foreignKey':_0x28be('0x150')});db[_0x28be('0x42')][_0x28be('0x11d')](db[_0x28be('0x8a')],{'onDelete':_0x28be('0x173'),'foreignKey':_0x28be('0x174')});db['MailQueueReport'][_0x28be('0x11d')](db[_0x28be('0x3a')],{});db[_0x28be('0x43')][_0x28be('0x11d')](db[_0x28be('0xf5')],{'as':_0x28be('0x166'),'foreignKey':_0x28be('0x167')});db[_0x28be('0x43')][_0x28be('0x11d')](db[_0x28be('0x6e')],{'as':_0x28be('0x15e'),'foreignKey':_0x28be('0x15f')});db['MailQueueReport'][_0x28be('0x11d')](db[_0x28be('0x3f')],{});db[_0x28be('0x43')]['belongsTo'](db[_0x28be('0x40')],{});db['MailQueueReport'][_0x28be('0x11d')](db[_0x28be('0x10c')],{});db[_0x28be('0x43')][_0x28be('0x11d')](db[_0x28be('0x12e')],{});db[_0x28be('0x175')][_0x28be('0x10f')](db[_0x28be('0x46')],{'as':_0x28be('0x176'),'onDelete':_0x28be('0x112')});db[_0x28be('0x48')][_0x28be('0x10f')](db[_0x28be('0x177')],{'as':_0x28be('0x162'),'foreignKey':'FaxAccountId','onDelete':_0x28be('0x112')});db[_0x28be('0x48')][_0x28be('0x10f')](db[_0x28be('0x163')],{'as':'Answers','foreignKey':'FaxAccountId'});db[_0x28be('0x48')][_0x28be('0x10f')](db[_0x28be('0x4c')],{'as':_0x28be('0x165')});db[_0x28be('0x48')][_0x28be('0x10f')](db['FaxApplication'],{'as':_0x28be('0x143')});db[_0x28be('0x48')][_0x28be('0x10f')](db[_0x28be('0x16')],{'as':'Exntensions','onDelete':_0x28be('0x112')});db['FaxAccount'][_0x28be('0x10f')](db[_0x28be('0x178')],{'as':_0x28be('0x169')});db[_0x28be('0x48')][_0x28be('0x11d')](db[_0x28be('0x14c')],{'as':_0x28be('0x14c')});db['FaxAccount'][_0x28be('0x11d')](db[_0x28be('0xf5')],{'as':_0x28be('0x166'),'foreignKey':_0x28be('0x167')});db[_0x28be('0x48')][_0x28be('0x11d')](db[_0x28be('0x82')],{'as':_0x28be('0x179'),'foreignKey':_0x28be('0x151')});db[_0x28be('0x48')]['belongsToMany'](db[_0x28be('0x10c')],{'as':'Agents','through':_0x28be('0x139')});db[_0x28be('0x4a')][_0x28be('0x11d')](db[_0x28be('0x10c')],{'onDelete':_0x28be('0x173')});db[_0x28be('0x4a')][_0x28be('0x11d')](db[_0x28be('0x4e')],{'onDelete':'restrict'});db[_0x28be('0x4a')][_0x28be('0x11d')](db[_0x28be('0x48')],{'onDelete':_0x28be('0x173')});db[_0x28be('0x4a')][_0x28be('0x11d')](db[_0x28be('0x8a')],{'onDelete':_0x28be('0x173'),'foreignKey':_0x28be('0x174')});db[_0x28be('0x4c')][_0x28be('0x10f')](db[_0x28be('0x178')],{'as':_0x28be('0x169'),'onDelete':_0x28be('0x112'),'foreignKey':_0x28be('0x17a')});db['FaxInteraction'][_0x28be('0x11d')](db[_0x28be('0x48')],{'as':_0x28be('0x16b'),'foreignKey':_0x28be('0x17b')});db['FaxInteraction'][_0x28be('0x11d')](db[_0x28be('0x6e')],{'as':_0x28be('0x15e'),'foreignKey':_0x28be('0x15f')});db['FaxInteraction'][_0x28be('0x11d')](db[_0x28be('0x10c')],{'as':'Owner','foreignKey':_0x28be('0x10e')});db[_0x28be('0x4c')][_0x28be('0x122')](db[_0x28be('0x8a')],{'through':_0x28be('0x17c'),'as':_0x28be('0x17d')});db[_0x28be('0x4c')][_0x28be('0x122')](db['Tag'],{'through':_0x28be('0x17c'),'as':_0x28be('0x16d')});db[_0x28be('0x4c')][_0x28be('0x122')](db[_0x28be('0x10c')],{'as':'Users','through':_0x28be('0x17e'),'foreignKey':'FaxInteractionId'});db[_0x28be('0x178')][_0x28be('0x11d')](db['User'],{'onDelete':'cascade','as':_0x28be('0x10c')});db[_0x28be('0x178')][_0x28be('0x11d')](db[_0x28be('0x4c')],{'as':_0x28be('0x170'),'foreignKey':'FaxInteractionId'});db[_0x28be('0x178')][_0x28be('0x11d')](db[_0x28be('0x6e')],{'onDelete':'cascade','as':_0x28be('0x15e')});db['FaxMessage'][_0x28be('0x11d')](db['Attachment'],{'as':_0x28be('0xe9'),'foreignKey':'AttachmentId'});db[_0x28be('0x178')][_0x28be('0x11d')](db['FaxAccount'],{'as':_0x28be('0x16b'),'foreignKey':_0x28be('0x17b')});db[_0x28be('0x4e')]['belongsToMany'](db['User'],{'as':_0x28be('0x153'),'through':'UserFaxQueue'});db[_0x28be('0x4e')]['belongsToMany'](db[_0x28be('0xe2')],{'through':'team_has_fax_queues','as':_0x28be('0x154')});db[_0x28be('0x17f')]['belongsTo'](db[_0x28be('0x48')],{});db[_0x28be('0x17f')][_0x28be('0x11d')](db[_0x28be('0xf5')],{'as':_0x28be('0x166'),'foreignKey':'ListId'});db[_0x28be('0x17f')][_0x28be('0x11d')](db[_0x28be('0x6e')],{'as':_0x28be('0x15e'),'foreignKey':_0x28be('0x15f')});db[_0x28be('0x17f')][_0x28be('0x11d')](db[_0x28be('0x4c')],{});db['FaxQueueReport'][_0x28be('0x11d')](db['FaxMessage'],{});db[_0x28be('0x17f')]['belongsTo'](db[_0x28be('0x10c')],{});db['FaxQueueReport'][_0x28be('0x11d')](db[_0x28be('0x4e')],{});db[_0x28be('0x50')]['hasMany'](db['Disposition'],{'as':_0x28be('0x162'),'foreignKey':_0x28be('0x180'),'onDelete':_0x28be('0x112')});db[_0x28be('0x50')]['hasMany'](db[_0x28be('0x163')],{'as':'Answers','foreignKey':_0x28be('0x180')});db[_0x28be('0x50')][_0x28be('0x10f')](db['SmsMessage'],{'as':_0x28be('0x169'),'foreignKey':_0x28be('0x180')});db[_0x28be('0x50')][_0x28be('0x10f')](db[_0x28be('0x53')],{'as':_0x28be('0x165')});db[_0x28be('0x50')]['hasMany'](db['SmsApplication'],{'as':_0x28be('0x143')});db['SmsAccount'][_0x28be('0x11d')](db['CmList'],{'as':_0x28be('0x166'),'foreignKey':'ListId'});db['SmsAccount'][_0x28be('0x11d')](db[_0x28be('0x82')],{'as':'mandatoryDispositionPause','foreignKey':_0x28be('0x151')});db[_0x28be('0x50')]['belongsToMany'](db['User'],{'as':'Agents','through':'user_has_sms_accounts'});db[_0x28be('0x52')][_0x28be('0x11d')](db[_0x28be('0x10c')],{'onDelete':_0x28be('0x173')});db[_0x28be('0x52')]['belongsTo'](db['SmsQueue'],{'onDelete':_0x28be('0x173')});db[_0x28be('0x52')]['belongsTo'](db[_0x28be('0x50')],{'onDelete':_0x28be('0x173')});db['SmsApplication']['belongsTo'](db[_0x28be('0x80')],{'onDelete':_0x28be('0x173'),'foreignKey':_0x28be('0x150')});db['SmsApplication'][_0x28be('0x11d')](db[_0x28be('0x8a')],{'onDelete':_0x28be('0x173'),'foreignKey':_0x28be('0x174')});db['SmsInteraction']['hasMany'](db[_0x28be('0x54')],{'as':_0x28be('0x169'),'onDelete':_0x28be('0x112'),'foreignKey':_0x28be('0x181')});db[_0x28be('0x53')][_0x28be('0x11d')](db[_0x28be('0x50')],{'as':_0x28be('0x16b'),'foreignKey':_0x28be('0x180')});db[_0x28be('0x53')][_0x28be('0x11d')](db[_0x28be('0x6e')],{'as':_0x28be('0x15e'),'foreignKey':_0x28be('0x15f')});db[_0x28be('0x53')][_0x28be('0x11d')](db[_0x28be('0x10c')],{'as':'Owner','foreignKey':_0x28be('0x10e')});db[_0x28be('0x53')]['belongsToMany'](db[_0x28be('0x8a')],{'through':_0x28be('0x182'),'as':_0x28be('0x17d')});db[_0x28be('0x53')][_0x28be('0x122')](db[_0x28be('0x8a')],{'through':_0x28be('0x182'),'as':_0x28be('0x16d')});db[_0x28be('0x53')][_0x28be('0x122')](db[_0x28be('0x10c')],{'as':_0x28be('0x16e'),'through':_0x28be('0x129'),'foreignKey':_0x28be('0x181')});db[_0x28be('0x54')][_0x28be('0x11d')](db[_0x28be('0x10c')],{'as':_0x28be('0x10c')});db[_0x28be('0x54')]['belongsTo'](db[_0x28be('0x6e')],{'onDelete':'cascade','as':_0x28be('0x15e')});db['SmsMessage'][_0x28be('0x11d')](db[_0x28be('0x53')],{'onDelete':'cascade','as':_0x28be('0x170'),'foreignKey':_0x28be('0x181')});db[_0x28be('0x54')][_0x28be('0x11d')](db[_0x28be('0x50')],{'as':_0x28be('0x16b'),'foreignKey':_0x28be('0x180')});db['SmsQueue'][_0x28be('0x122')](db[_0x28be('0x10c')],{'as':_0x28be('0x153'),'through':_0x28be('0x32'),'foreignKey':_0x28be('0x183')});db[_0x28be('0x132')][_0x28be('0x122')](db[_0x28be('0xe2')],{'through':_0x28be('0x184'),'as':_0x28be('0x154')});db[_0x28be('0x56')][_0x28be('0x10f')](db[_0x28be('0x177')],{'as':_0x28be('0x162'),'foreignKey':_0x28be('0x185'),'onDelete':_0x28be('0x112')});db[_0x28be('0x56')][_0x28be('0x10f')](db[_0x28be('0x163')],{'as':'Answers','foreignKey':_0x28be('0x185')});db[_0x28be('0x56')][_0x28be('0x10f')](db['OpenchannelInteraction'],{'as':'Interactions','foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x28be('0x10f')](db[_0x28be('0x186')],{'as':'Messages','foreignKey':'OpenchannelAccountId'});db[_0x28be('0x56')]['hasMany'](db['OpenchannelApplication'],{'as':'Applications','foreignKey':_0x28be('0x185')});db[_0x28be('0x56')]['belongsTo'](db[_0x28be('0xf5')],{'as':'List','foreignKey':'ListId'});db[_0x28be('0x56')][_0x28be('0x11d')](db[_0x28be('0x82')],{'as':_0x28be('0x179'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x28be('0x56')]['belongsToMany'](db['User'],{'as':_0x28be('0x153'),'through':_0x28be('0x13d')});db[_0x28be('0x58')][_0x28be('0x11d')](db['User'],{'onDelete':_0x28be('0x173')});db['OpenchannelApplication'][_0x28be('0x11d')](db[_0x28be('0x5c')],{'onDelete':_0x28be('0x173'),'foreignKey':_0x28be('0x187')});db[_0x28be('0x58')][_0x28be('0x11d')](db[_0x28be('0x56')],{'onDelete':_0x28be('0x173'),'foreignKey':_0x28be('0x185')});db['OpenchannelApplication'][_0x28be('0x11d')](db[_0x28be('0x80')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x28be('0x58')][_0x28be('0x11d')](db['Tag'],{'onDelete':_0x28be('0x173'),'foreignKey':'TagId'});db[_0x28be('0x5a')][_0x28be('0x10f')](db[_0x28be('0x186')],{'as':_0x28be('0x169'),'onDelete':_0x28be('0x112'),'foreignKey':_0x28be('0x188')});db[_0x28be('0x5a')]['belongsTo'](db[_0x28be('0x56')],{'as':_0x28be('0x16b'),'foreignKey':'OpenchannelAccountId'});db[_0x28be('0x5a')][_0x28be('0x11d')](db[_0x28be('0x6e')],{'as':'Contact','foreignKey':_0x28be('0x15f')});db['OpenchannelInteraction'][_0x28be('0x11d')](db[_0x28be('0x10c')],{'as':_0x28be('0x189'),'foreignKey':_0x28be('0x10e')});db['OpenchannelInteraction']['belongsToMany'](db[_0x28be('0x8a')],{'through':_0x28be('0x18a'),'as':_0x28be('0x17d')});db['OpenchannelInteraction']['belongsToMany'](db[_0x28be('0x8a')],{'through':_0x28be('0x18a'),'as':'ThroughTags'});db[_0x28be('0x5a')]['belongsToMany'](db[_0x28be('0x10c')],{'as':_0x28be('0x16e'),'through':'user_has_openchannel_interactions','foreignKey':_0x28be('0x188')});db['OpenchannelMessage'][_0x28be('0x11d')](db[_0x28be('0x10c')],{'onDelete':_0x28be('0x112'),'as':_0x28be('0x10c')});db[_0x28be('0x186')][_0x28be('0x11d')](db[_0x28be('0x6e')],{'onDelete':'cascade','as':_0x28be('0x15e')});db['OpenchannelMessage'][_0x28be('0x11d')](db[_0x28be('0x5a')],{'onDelete':_0x28be('0x112'),'as':_0x28be('0x170'),'foreignKey':_0x28be('0x188')});db[_0x28be('0x186')][_0x28be('0x11d')](db[_0x28be('0xe9')],{'as':_0x28be('0xe9'),'foreignKey':'AttachmentId'});db['OpenchannelMessage'][_0x28be('0x11d')](db['OpenchannelAccount'],{'as':_0x28be('0x16b'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelQueue'][_0x28be('0x122')](db['User'],{'as':'Agents','through':_0x28be('0x34'),'foreignKey':'OpenchannelQueueId'});db[_0x28be('0x5c')][_0x28be('0x122')](db[_0x28be('0xe2')],{'through':_0x28be('0x18b'),'as':_0x28be('0x154')});db['ChatWebsite'][_0x28be('0x10f')](db[_0x28be('0x177')],{'as':_0x28be('0x162'),'foreignKey':_0x28be('0x171'),'onDelete':_0x28be('0x112')});db[_0x28be('0x135')][_0x28be('0x10f')](db[_0x28be('0x163')],{'as':_0x28be('0x164'),'foreignKey':_0x28be('0x171')});db[_0x28be('0x135')]['hasMany'](db['ChatProactiveAction'],{'as':_0x28be('0x18c')});db[_0x28be('0x135')][_0x28be('0x10f')](db[_0x28be('0x62')],{'as':'Interactions'});db[_0x28be('0x135')][_0x28be('0x10f')](db[_0x28be('0x18d')],{'as':_0x28be('0x143')});db[_0x28be('0x135')][_0x28be('0x10f')](db['ChatMessage'],{'as':_0x28be('0x169')});db[_0x28be('0x135')][_0x28be('0x11d')](db['CmList'],{'as':'List','foreignKey':_0x28be('0x167')});db[_0x28be('0x135')][_0x28be('0x11d')](db[_0x28be('0x80')],{'as':_0x28be('0x80'),'foreignKey':'IntervalId'});db['ChatWebsite'][_0x28be('0x11d')](db['MailAccount'],{'as':_0x28be('0x3a'),'foreignKey':'MailAccountId'});db[_0x28be('0x135')][_0x28be('0x11d')](db['Pause'],{'as':_0x28be('0x179'),'foreignKey':_0x28be('0x151')});db[_0x28be('0x135')][_0x28be('0x122')](db[_0x28be('0x10c')],{'as':_0x28be('0x153'),'through':_0x28be('0x137')});db[_0x28be('0x5f')][_0x28be('0x11d')](db[_0x28be('0x56')],{});db[_0x28be('0x5f')][_0x28be('0x11d')](db[_0x28be('0xf5')],{'as':_0x28be('0x166'),'foreignKey':'ListId'});db['OpenchannelQueueReport']['belongsTo'](db[_0x28be('0x6e')],{'as':_0x28be('0x15e'),'foreignKey':_0x28be('0x15f')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelInteraction'],{});db['OpenchannelQueueReport'][_0x28be('0x11d')](db[_0x28be('0x186')],{});db[_0x28be('0x5f')][_0x28be('0x11d')](db[_0x28be('0x10c')],{});db[_0x28be('0x5f')][_0x28be('0x11d')](db[_0x28be('0x5c')],{});db[_0x28be('0x18d')][_0x28be('0x11d')](db[_0x28be('0x10c')],{'as':_0x28be('0x18e'),'foreignKey':_0x28be('0x10e'),'onDelete':_0x28be('0x173')});db[_0x28be('0x18d')]['belongsTo'](db[_0x28be('0x12f')],{'as':_0x28be('0x18f'),'foreignKey':'ChatQueueId','onDelete':_0x28be('0x173')});db[_0x28be('0x18d')][_0x28be('0x11d')](db[_0x28be('0x135')],{'as':'Website','foreignKey':_0x28be('0x171'),'onDelete':_0x28be('0x173')});db[_0x28be('0x18d')][_0x28be('0x11d')](db['Tag'],{'onDelete':_0x28be('0x173'),'foreignKey':_0x28be('0x174')});db['ChatInteraction']['hasMany'](db['ChatMessage'],{'as':_0x28be('0x169'),'onDelete':_0x28be('0x112'),'foreignKey':'ChatInteractionId'});db[_0x28be('0x62')]['belongsTo'](db[_0x28be('0x135')],{'as':'Account','foreignKey':'ChatWebsiteId'});db['ChatInteraction'][_0x28be('0x11d')](db[_0x28be('0x6e')],{'as':_0x28be('0x15e'),'foreignKey':_0x28be('0x15f')});db[_0x28be('0x62')]['belongsTo'](db['User'],{'as':_0x28be('0x189'),'foreignKey':_0x28be('0x10e')});db[_0x28be('0x62')]['belongsToMany'](db['Tag'],{'through':'chat_interaction_has_tags','as':'Tags'});db[_0x28be('0x62')][_0x28be('0x122')](db[_0x28be('0x8a')],{'through':_0x28be('0x190'),'as':_0x28be('0x16d')});db['ChatInteraction'][_0x28be('0x122')](db[_0x28be('0x10c')],{'as':'Users','through':_0x28be('0x128'),'foreignKey':_0x28be('0x191')});db['ChatMessage'][_0x28be('0x11d')](db[_0x28be('0x10c')],{'onDelete':'cascade','as':_0x28be('0x10c')});db[_0x28be('0x64')][_0x28be('0x11d')](db['CmContact'],{'onDelete':_0x28be('0x112'),'as':_0x28be('0x15e'),'foreignKey':'ContactId'});db[_0x28be('0x64')][_0x28be('0x11d')](db['ChatInteraction'],{'onDelete':_0x28be('0x112'),'as':_0x28be('0x170'),'foreignKey':_0x28be('0x191')});db['ChatMessage'][_0x28be('0x11d')](db['Attachment'],{'as':'Attachment','foreignKey':_0x28be('0x192')});db[_0x28be('0x64')][_0x28be('0x11d')](db[_0x28be('0x135')],{'as':_0x28be('0x16b'),'foreignKey':_0x28be('0x171')});db[_0x28be('0x66')][_0x28be('0x10f')](db['Attachment'],{'as':_0x28be('0x16f'),'foreignKey':_0x28be('0x172'),'onDelete':_0x28be('0x112'),'hooks':!![]});db[_0x28be('0x66')][_0x28be('0x11d')](db['CmContact'],{'onDelete':_0x28be('0x112'),'as':_0x28be('0x15e'),'foreignKey':_0x28be('0x15f')});db[_0x28be('0x66')][_0x28be('0x11d')](db[_0x28be('0x135')],{'as':_0x28be('0x16b'),'foreignKey':_0x28be('0x171')});db[_0x28be('0x12f')][_0x28be('0x122')](db['User'],{'as':_0x28be('0x153'),'through':_0x28be('0x2c'),'hooks':!![]});db[_0x28be('0x12f')][_0x28be('0x122')](db[_0x28be('0xe2')],{'through':'team_has_chat_queues','as':_0x28be('0x154')});db[_0x28be('0x69')][_0x28be('0x10f')](db['ChatInternalMessage'],{'as':_0x28be('0x169'),'foreignKey':_0x28be('0x193'),'onDelete':_0x28be('0x112')});db[_0x28be('0x69')][_0x28be('0x122')](db[_0x28be('0x10c')],{'as':_0x28be('0x146'),'through':'chat_group_has_users'});db[_0x28be('0x6b')][_0x28be('0x11d')](db['ChatWebsite'],{'as':_0x28be('0x194'),'foreignKey':_0x28be('0x171')});db['CmCompany']['hasMany'](db[_0x28be('0x6e')],{'as':'Contacts','foreignKey':_0x28be('0x195')});db['CmContact'][_0x28be('0x10f')](db[_0x28be('0x70')],{'as':_0x28be('0x148'),'foreignKey':_0x28be('0x15f')});db[_0x28be('0x6e')][_0x28be('0x10f')](db['CmHopperFinal'],{'as':_0x28be('0x113'),'foreignKey':_0x28be('0x15f')});db['CmContact'][_0x28be('0x10f')](db[_0x28be('0x76')],{'as':_0x28be('0x149'),'foreignKey':_0x28be('0x15f')});db[_0x28be('0x6e')][_0x28be('0x10f')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':'ContactId'});db['CmContact'][_0x28be('0x10f')](db[_0x28be('0x14a')],{'as':_0x28be('0x14b'),'foreignKey':'ContactId'});db[_0x28be('0x6e')]['hasMany'](db[_0x28be('0x5a')],{'as':'OpenchannelInteractions','foreignKey':_0x28be('0x15f'),'onDelete':'restrict'});db['CmContact'][_0x28be('0x10f')](db['ChatInteraction'],{'as':_0x28be('0x116'),'foreignKey':'ContactId','onDelete':_0x28be('0x173')});db['CmContact'][_0x28be('0x10f')](db[_0x28be('0x53')],{'as':_0x28be('0x117'),'foreignKey':_0x28be('0x15f'),'onDelete':_0x28be('0x173')});db[_0x28be('0x6e')][_0x28be('0x10f')](db[_0x28be('0x4c')],{'as':_0x28be('0x118'),'foreignKey':_0x28be('0x15f'),'onDelete':_0x28be('0x173')});db['CmContact'][_0x28be('0x10f')](db[_0x28be('0x3f')],{'as':'MailInteractions','foreignKey':_0x28be('0x15f'),'onDelete':'restrict'});db['CmContact'][_0x28be('0x11d')](db[_0x28be('0x196')],{'as':_0x28be('0x197'),'foreignKey':_0x28be('0x195')});db[_0x28be('0x6e')][_0x28be('0x11d')](db[_0x28be('0xf5')],{'as':_0x28be('0x166'),'foreignKey':'ListId','onDelete':_0x28be('0x112')});db[_0x28be('0x6e')][_0x28be('0x122')](db[_0x28be('0x10c')],{'as':_0x28be('0x16e'),'through':'cm_user_has_contacts'});db['CmContact'][_0x28be('0x122')](db[_0x28be('0x8a')],{'as':_0x28be('0x17d'),'through':_0x28be('0x198')});db['CmContact']['belongsToMany'](db[_0x28be('0x8a')],{'through':_0x28be('0x198'),'as':_0x28be('0x16d')});db[_0x28be('0x70')][_0x28be('0x11d')](db['CmContact'],{'as':_0x28be('0x15e'),'foreignKey':_0x28be('0x15f'),'onDelete':_0x28be('0x112')});db[_0x28be('0x70')][_0x28be('0x11d')](db[_0x28be('0xf5')],{'as':_0x28be('0x166'),'foreignKey':'ListId','onDelete':_0x28be('0x112')});db[_0x28be('0x70')][_0x28be('0x11d')](db['User'],{'as':_0x28be('0x18e'),'foreignKey':_0x28be('0x10e')});db[_0x28be('0x70')][_0x28be('0x11d')](db[_0x28be('0x19')],{'as':_0x28be('0x18f'),'foreignKey':'VoiceQueueId','onDelete':_0x28be('0x112')});db[_0x28be('0x70')][_0x28be('0x11d')](db['Campaign'],{'as':_0x28be('0xe5'),'foreignKey':_0x28be('0x199'),'onDelete':_0x28be('0x112')});db[_0x28be('0x70')][_0x28be('0x11d')](db[_0x28be('0x10c')],{'as':'Owner','foreignKey':_0x28be('0x19a')});db[_0x28be('0x72')]['belongsTo'](db[_0x28be('0x6e')],{'as':_0x28be('0x15e'),'foreignKey':_0x28be('0x15f'),'onDelete':_0x28be('0x112')});db[_0x28be('0x72')]['belongsTo'](db[_0x28be('0xf5')],{'as':_0x28be('0x166'),'foreignKey':_0x28be('0x167'),'onDelete':_0x28be('0x112')});db[_0x28be('0x72')][_0x28be('0x11d')](db['VoiceQueue'],{'as':_0x28be('0x18f'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x28be('0x72')]['belongsTo'](db[_0x28be('0xe5')],{'as':_0x28be('0xe5'),'foreignKey':_0x28be('0x199'),'onDelete':'cascade'});db[_0x28be('0x19b')][_0x28be('0x10f')](db[_0x28be('0x7e')],{'as':{'plural':_0x28be('0x19c'),'singular':_0x28be('0x19d')},'foreignKey':_0x28be('0x19e'),'onDelete':'cascade','hooks':!![]});db[_0x28be('0x19b')]['hasMany'](db[_0x28be('0x7e')],{'as':{'plural':_0x28be('0x19f'),'singular':_0x28be('0x1a0')},'foreignKey':_0x28be('0x1a1'),'onDelete':_0x28be('0x112'),'hooks':!![]});db[_0x28be('0x19b')][_0x28be('0x10f')](db[_0x28be('0x7a')],{'as':_0x28be('0x1a2'),'foreignKey':_0x28be('0x1a3'),'onDelete':_0x28be('0x112'),'hooks':!![]});db['Disposition'][_0x28be('0x10f')](db[_0x28be('0x177')],{'as':_0x28be('0x162'),'foreignKey':_0x28be('0x1a4'),'onDelete':_0x28be('0x112')});db[_0x28be('0x80')][_0x28be('0x10f')](db['Interval'],{'as':'Intervals','foreignKey':_0x28be('0x150'),'onDelete':_0x28be('0x112'),'hooks':!![],'required':![]});db[_0x28be('0x80')][_0x28be('0x10f')](db[_0x28be('0x16')],{'as':_0x28be('0x111'),'foreignKey':_0x28be('0x150'),'onDelete':'restrict'});db['Interval'][_0x28be('0x10f')](db[_0x28be('0x42')],{'as':_0x28be('0x1a5'),'foreignKey':'IntervalId'});db[_0x28be('0x80')][_0x28be('0x10f')](db[_0x28be('0x18d')],{'as':_0x28be('0x1a6'),'foreignKey':_0x28be('0x150')});db[_0x28be('0x80')][_0x28be('0x10f')](db[_0x28be('0x4a')],{'as':'FaxApplications','foreignKey':'IntervalId'});db[_0x28be('0x80')][_0x28be('0x10f')](db[_0x28be('0x52')],{'as':_0x28be('0x1a7'),'foreignKey':_0x28be('0x150')});db['Schedule'][_0x28be('0x11d')](db[_0x28be('0x3a')],{});db[_0x28be('0x86')]['belongsTo'](db[_0x28be('0x94')],{'foreignKey':'DefaultReportId'});db[_0x28be('0x86')][_0x28be('0x11d')](db[_0x28be('0x92')],{'foreignKey':_0x28be('0x1a8')});db['Sound'][_0x28be('0x122')](db[_0x28be('0x18')],{'as':'Mohs','through':_0x28be('0x145'),'onDelete':'restrict'});db[_0x28be('0x8a')][_0x28be('0x122')](db[_0x28be('0x6e')],{'through':_0x28be('0x198')});db[_0x28be('0x8a')][_0x28be('0x122')](db[_0x28be('0x62')],{'through':_0x28be('0x190')});db[_0x28be('0x8a')]['belongsToMany'](db[_0x28be('0x3f')],{'through':_0x28be('0x16c')});db[_0x28be('0x8a')]['belongsToMany'](db[_0x28be('0x53')],{'through':_0x28be('0x182')});db[_0x28be('0x8a')]['belongsToMany'](db[_0x28be('0x4c')],{'through':_0x28be('0x17c')});db[_0x28be('0x8a')][_0x28be('0x122')](db[_0x28be('0x5a')],{'through':'openchannel_interaction_has_tags'});db[_0x28be('0x8a')][_0x28be('0x122')](db['WhatsappInteraction'],{'through':_0x28be('0x1a9')});db[_0x28be('0x1aa')][_0x28be('0x10f')](db[_0x28be('0x7e')],{'as':{'plural':_0x28be('0x1ab'),'singular':'AllCondition'},'foreignKey':'TriggerAllId','onDelete':'cascade','hooks':!![]});db[_0x28be('0x1aa')][_0x28be('0x10f')](db[_0x28be('0x7e')],{'as':{'plural':_0x28be('0x1ac'),'singular':_0x28be('0x1ad')},'foreignKey':_0x28be('0x1ae'),'onDelete':_0x28be('0x112'),'hooks':!![]});db[_0x28be('0x1aa')]['hasMany'](db['Action'],{'as':'Actions','foreignKey':_0x28be('0x1af'),'onDelete':_0x28be('0x112'),'hooks':!![]});db[_0x28be('0x92')][_0x28be('0x10f')](db[_0x28be('0x98')],{'as':'Fields','onDelete':_0x28be('0x112'),'foreignKey':'CustomReportId','hooks':!![]});db[_0x28be('0x94')]['hasMany'](db[_0x28be('0x98')],{'as':_0x28be('0x1b0'),'onDelete':_0x28be('0x112'),'foreignKey':'DefaultReportId'});db[_0x28be('0x1b1')][_0x28be('0x10f')](db['AnalyticFieldReport'],{'as':_0x28be('0x1b0'),'onDelete':_0x28be('0x112'),'foreignKey':_0x28be('0x1b2')});db[_0x28be('0x98')][_0x28be('0x11d')](db[_0x28be('0x1b1')],{'foreignKey':_0x28be('0x1b2')});db['SalesforceAccount']['hasMany'](db['SalesforceConfiguration'],{'as':_0x28be('0x1b3'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x28be('0x9d')][_0x28be('0x10f')](db[_0x28be('0x9f')],{'as':_0x28be('0x1b4'),'onDelete':_0x28be('0x112'),'foreignKey':'SubjectId'});db[_0x28be('0x9d')]['hasMany'](db[_0x28be('0x9f')],{'as':_0x28be('0x1b5'),'onDelete':_0x28be('0x112'),'foreignKey':_0x28be('0x1b6')});db[_0x28be('0x9d')][_0x28be('0x10f')](db['SalesforceField'],{'as':'Fields','onDelete':'cascade','foreignKey':'FieldId'});db[_0x28be('0x9d')][_0x28be('0x11d')](db[_0x28be('0x9b')],{'as':_0x28be('0x16b'),'foreignKey':_0x28be('0x1b7')});db[_0x28be('0x9f')]['hasMany'](db[_0x28be('0x9f')],{'as':_0x28be('0x1b8'),'foreignKey':_0x28be('0x1b9')});db[_0x28be('0x9f')][_0x28be('0x10f')](db['SalesforceField'],{'as':'Description','foreignKey':'DescriptionId'});db['SalesforceField'][_0x28be('0x10f')](db[_0x28be('0x9f')],{'as':'Field','foreignKey':_0x28be('0x1ba')});db[_0x28be('0x9f')][_0x28be('0x11d')](db[_0x28be('0x1bb')],{'as':_0x28be('0x1bb'),'foreignKey':_0x28be('0x1bc')});db[_0x28be('0x1bd')][_0x28be('0x10f')](db[_0x28be('0x1be')],{'as':_0x28be('0x1b3'),'onDelete':_0x28be('0x112'),'foreignKey':'AccountId'});db[_0x28be('0x1be')][_0x28be('0x10f')](db[_0x28be('0xa1')],{'as':_0x28be('0x1b4'),'onDelete':_0x28be('0x112'),'foreignKey':'SubjectId'});db[_0x28be('0x1be')]['hasMany'](db[_0x28be('0xa1')],{'as':_0x28be('0x1b5'),'onDelete':'cascade','foreignKey':_0x28be('0x1b6')});db['SugarcrmConfiguration'][_0x28be('0x10f')](db['SugarcrmField'],{'as':_0x28be('0x1b0'),'onDelete':_0x28be('0x112'),'foreignKey':_0x28be('0x1ba')});db[_0x28be('0x1be')][_0x28be('0x11d')](db[_0x28be('0x1bd')],{'as':'Account','foreignKey':_0x28be('0x1b7')});db[_0x28be('0xa1')]['hasMany'](db[_0x28be('0xa1')],{'as':_0x28be('0x1b8'),'foreignKey':'SubjectId'});db[_0x28be('0xa1')][_0x28be('0x10f')](db[_0x28be('0xa1')],{'as':_0x28be('0x1bf'),'foreignKey':_0x28be('0x1b6')});db['SugarcrmField'][_0x28be('0x10f')](db[_0x28be('0xa1')],{'as':_0x28be('0x1c0'),'foreignKey':'FieldId'});db[_0x28be('0xa1')][_0x28be('0x11d')](db[_0x28be('0x1bb')],{'as':_0x28be('0x1bb'),'foreignKey':_0x28be('0x1bc')});db[_0x28be('0xa2')][_0x28be('0x10f')](db[_0x28be('0xa4')],{'as':_0x28be('0x1b3'),'onDelete':_0x28be('0x112'),'foreignKey':_0x28be('0x1b7')});db[_0x28be('0xa4')][_0x28be('0x10f')](db[_0x28be('0xa6')],{'as':_0x28be('0x1b4'),'onDelete':_0x28be('0x112'),'foreignKey':'SubjectId'});db['DeskConfiguration']['hasMany'](db[_0x28be('0xa6')],{'as':_0x28be('0x1b5'),'onDelete':'cascade','foreignKey':_0x28be('0x1b6')});db[_0x28be('0xa4')]['hasMany'](db['DeskField'],{'as':_0x28be('0x1b0'),'onDelete':_0x28be('0x112'),'foreignKey':_0x28be('0x1ba')});db[_0x28be('0xa4')][_0x28be('0x11d')](db[_0x28be('0xa2')],{'as':_0x28be('0x16b'),'foreignKey':_0x28be('0x1b7')});db[_0x28be('0xa4')][_0x28be('0x122')](db[_0x28be('0x8a')],{'through':'int_desk_configuration_has_tags'});db[_0x28be('0xa6')][_0x28be('0x10f')](db[_0x28be('0xa6')],{'as':_0x28be('0x1b8'),'foreignKey':_0x28be('0x1b9')});db[_0x28be('0xa6')][_0x28be('0x10f')](db['DeskField'],{'as':_0x28be('0x1bf'),'foreignKey':_0x28be('0x1b6')});db[_0x28be('0xa6')][_0x28be('0x10f')](db['DeskField'],{'as':_0x28be('0x1c0'),'foreignKey':_0x28be('0x1ba')});db['DeskField'][_0x28be('0x11d')](db[_0x28be('0x1bb')],{'as':_0x28be('0x1bb'),'foreignKey':_0x28be('0x1bc')});db['ZohoAccount'][_0x28be('0x10f')](db['ZohoConfiguration'],{'as':_0x28be('0x1b3'),'onDelete':_0x28be('0x112'),'foreignKey':_0x28be('0x1b7')});db[_0x28be('0xaa')]['hasMany'](db[_0x28be('0x1c1')],{'as':'Subjects','onDelete':_0x28be('0x112'),'foreignKey':'SubjectId'});db['ZohoConfiguration'][_0x28be('0x10f')](db[_0x28be('0x1c1')],{'as':_0x28be('0x1b5'),'onDelete':_0x28be('0x112'),'foreignKey':'DescriptionId'});db['ZohoConfiguration'][_0x28be('0x10f')](db['ZohoField'],{'as':_0x28be('0x1b0'),'onDelete':_0x28be('0x112'),'foreignKey':_0x28be('0x1ba')});db[_0x28be('0xaa')][_0x28be('0x11d')](db['ZohoAccount'],{'as':_0x28be('0x16b'),'foreignKey':_0x28be('0x1b7')});db[_0x28be('0x1c1')][_0x28be('0x10f')](db[_0x28be('0x1c1')],{'as':_0x28be('0x1b8'),'foreignKey':_0x28be('0x1b9')});db['ZohoField']['hasMany'](db['ZohoField'],{'as':_0x28be('0x1bf'),'foreignKey':_0x28be('0x1b6')});db[_0x28be('0x1c1')][_0x28be('0x10f')](db[_0x28be('0x1c1')],{'as':_0x28be('0x1c0'),'foreignKey':_0x28be('0x1ba')});db['ZohoField'][_0x28be('0x11d')](db[_0x28be('0x1bb')],{'as':'Variable','foreignKey':_0x28be('0x1bc')});db[_0x28be('0xad')][_0x28be('0x10f')](db['ZendeskConfiguration'],{'as':'Configurations','onDelete':_0x28be('0x112'),'foreignKey':_0x28be('0x1b7')});db['ZendeskConfiguration'][_0x28be('0x10f')](db[_0x28be('0x1c2')],{'as':_0x28be('0x1b4'),'foreignKey':_0x28be('0x1b9')});db[_0x28be('0x1c3')][_0x28be('0x10f')](db[_0x28be('0x1c2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0x28be('0x1c3')][_0x28be('0x10f')](db[_0x28be('0x1c2')],{'as':_0x28be('0x1b0'),'foreignKey':'FieldId'});db[_0x28be('0x1c3')][_0x28be('0x11d')](db['ZendeskAccount'],{'as':_0x28be('0x16b'),'foreignKey':_0x28be('0x1b7')});db[_0x28be('0x1c3')][_0x28be('0x122')](db[_0x28be('0x8a')],{'through':_0x28be('0x1c4')});db[_0x28be('0x1c2')][_0x28be('0x10f')](db['ZendeskField'],{'as':_0x28be('0x1b8'),'foreignKey':_0x28be('0x1b9')});db['ZendeskField'][_0x28be('0x10f')](db[_0x28be('0x1c2')],{'as':'Description','foreignKey':_0x28be('0x1b6')});db[_0x28be('0x1c2')][_0x28be('0x10f')](db[_0x28be('0x1c2')],{'as':'Field','foreignKey':_0x28be('0x1ba')});db[_0x28be('0x1c2')][_0x28be('0x11d')](db[_0x28be('0x1bb')],{'as':_0x28be('0x1bb'),'foreignKey':_0x28be('0x1bc')});db[_0x28be('0x1c5')]['hasMany'](db[_0x28be('0xb2')],{'as':_0x28be('0x1b3'),'onDelete':_0x28be('0x112'),'foreignKey':_0x28be('0x1b7')});db['FreshdeskConfiguration']['hasMany'](db[_0x28be('0x1c6')],{'as':'Subjects','onDelete':_0x28be('0x112'),'foreignKey':_0x28be('0x1b9')});db[_0x28be('0xb2')]['hasMany'](db['FreshdeskField'],{'as':_0x28be('0x1b5'),'onDelete':'cascade','foreignKey':_0x28be('0x1b6')});db[_0x28be('0xb2')]['hasMany'](db[_0x28be('0x1c6')],{'as':_0x28be('0x1b0'),'onDelete':_0x28be('0x112'),'foreignKey':'FieldId'});db[_0x28be('0xb2')]['belongsTo'](db[_0x28be('0x1c5')],{'as':'Account','foreignKey':_0x28be('0x1b7')});db[_0x28be('0xb2')][_0x28be('0x122')](db['Tag'],{'through':_0x28be('0x1c7')});db[_0x28be('0x1c6')][_0x28be('0x10f')](db[_0x28be('0x1c6')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x28be('0x1c6')][_0x28be('0x10f')](db['FreshdeskField'],{'as':_0x28be('0x1bf'),'foreignKey':_0x28be('0x1b6')});db['FreshdeskField'][_0x28be('0x10f')](db[_0x28be('0x1c6')],{'as':_0x28be('0x1c0'),'foreignKey':'FieldId'});db[_0x28be('0x1c6')][_0x28be('0x11d')](db[_0x28be('0x1bb')],{'as':_0x28be('0x1bb'),'foreignKey':_0x28be('0x1bc')});db[_0x28be('0xb4')][_0x28be('0x10f')](db[_0x28be('0xb6')],{'as':_0x28be('0x1b3'),'onDelete':_0x28be('0x112'),'foreignKey':'AccountId'});db[_0x28be('0xb6')]['hasMany'](db[_0x28be('0xb8')],{'as':'Subjects','foreignKey':_0x28be('0x1b9')});db['VtigerConfiguration'][_0x28be('0x10f')](db[_0x28be('0xb8')],{'as':_0x28be('0x1b5'),'foreignKey':_0x28be('0x1b6')});db[_0x28be('0xb6')][_0x28be('0x10f')](db[_0x28be('0xb8')],{'as':_0x28be('0x1b0'),'foreignKey':_0x28be('0x1ba')});db['VtigerConfiguration'][_0x28be('0x11d')](db[_0x28be('0xb4')],{'as':_0x28be('0x16b'),'foreignKey':_0x28be('0x1b7')});db[_0x28be('0xb8')][_0x28be('0x10f')](db[_0x28be('0xb8')],{'as':_0x28be('0x1b8'),'foreignKey':_0x28be('0x1b9')});db[_0x28be('0xb8')]['hasMany'](db[_0x28be('0xb8')],{'as':_0x28be('0x1bf'),'foreignKey':_0x28be('0x1b6')});db['VtigerField']['hasMany'](db[_0x28be('0xb8')],{'as':_0x28be('0x1c0'),'foreignKey':_0x28be('0x1ba')});db[_0x28be('0xb8')]['belongsTo'](db[_0x28be('0x1bb')],{'as':_0x28be('0x1bb'),'foreignKey':'VariableId'});db[_0x28be('0xb9')][_0x28be('0x10f')](db['ServicenowConfiguration'],{'as':_0x28be('0x1b3'),'onDelete':'cascade','foreignKey':_0x28be('0x1b7')});db[_0x28be('0xbb')]['hasMany'](db[_0x28be('0xbd')],{'as':_0x28be('0x1b4'),'foreignKey':_0x28be('0x1b9')});db[_0x28be('0xbb')][_0x28be('0x10f')](db[_0x28be('0xbd')],{'as':_0x28be('0x1b5'),'foreignKey':_0x28be('0x1b6')});db[_0x28be('0xbb')][_0x28be('0x10f')](db[_0x28be('0xbd')],{'as':_0x28be('0x1b0'),'foreignKey':'FieldId'});db[_0x28be('0xbb')][_0x28be('0x11d')](db[_0x28be('0xb9')],{'as':'Account','foreignKey':_0x28be('0x1b7')});db[_0x28be('0xbd')][_0x28be('0x10f')](db[_0x28be('0xbd')],{'as':_0x28be('0x1b8'),'foreignKey':_0x28be('0x1b9')});db[_0x28be('0xbd')]['hasMany'](db[_0x28be('0xbd')],{'as':_0x28be('0x1bf'),'foreignKey':_0x28be('0x1b6')});db[_0x28be('0xbd')][_0x28be('0x10f')](db['ServicenowField'],{'as':_0x28be('0x1c0'),'foreignKey':'FieldId'});db[_0x28be('0xbd')]['belongsTo'](db['Variable'],{'as':_0x28be('0x1bb'),'foreignKey':_0x28be('0x1bc')});db[_0x28be('0xbf')][_0x28be('0x10f')](db[_0x28be('0xc1')],{'as':_0x28be('0x1b3'),'onDelete':'cascade','foreignKey':_0x28be('0x1b7')});db[_0x28be('0xc1')][_0x28be('0x10f')](db[_0x28be('0xc2')],{'as':_0x28be('0x1b4'),'onDelete':'cascade','foreignKey':_0x28be('0x1b9')});db[_0x28be('0xc1')][_0x28be('0x10f')](db[_0x28be('0xc2')],{'as':_0x28be('0x1b5'),'onDelete':_0x28be('0x112'),'foreignKey':'DescriptionId'});db[_0x28be('0xc1')][_0x28be('0x10f')](db[_0x28be('0xc2')],{'as':_0x28be('0x1b0'),'onDelete':_0x28be('0x112'),'foreignKey':'FieldId'});db[_0x28be('0xc1')][_0x28be('0x11d')](db[_0x28be('0xbf')],{'as':_0x28be('0x16b'),'foreignKey':'AccountId'});db[_0x28be('0xc2')][_0x28be('0x10f')](db[_0x28be('0xc2')],{'as':'Subject','foreignKey':_0x28be('0x1b9')});db[_0x28be('0xc2')][_0x28be('0x10f')](db[_0x28be('0xc2')],{'as':_0x28be('0x1bf'),'foreignKey':_0x28be('0x1b6')});db['Dynamics365Field']['hasMany'](db[_0x28be('0xc2')],{'as':_0x28be('0x1c0'),'foreignKey':_0x28be('0x1ba')});db[_0x28be('0xc2')][_0x28be('0x11d')](db[_0x28be('0x1bb')],{'as':_0x28be('0x1bb'),'foreignKey':_0x28be('0x1bc')});db['FreshsalesAccount']['hasMany'](db[_0x28be('0xc6')],{'as':'Configurations','onDelete':_0x28be('0x112'),'foreignKey':_0x28be('0x1b7')});db[_0x28be('0xc6')]['hasMany'](db['FreshsalesField'],{'as':_0x28be('0x1b4'),'foreignKey':_0x28be('0x1b9')});db['FreshsalesConfiguration'][_0x28be('0x10f')](db[_0x28be('0xc8')],{'as':_0x28be('0x1b5'),'foreignKey':'DescriptionId'});db[_0x28be('0xc6')][_0x28be('0x10f')](db['FreshsalesField'],{'as':_0x28be('0x1b0'),'foreignKey':_0x28be('0x1ba')});db[_0x28be('0xc6')][_0x28be('0x11d')](db[_0x28be('0xc4')],{'as':_0x28be('0x16b'),'foreignKey':_0x28be('0x1b7')});db['FreshsalesField']['hasMany'](db[_0x28be('0xc8')],{'as':_0x28be('0x1b8'),'foreignKey':_0x28be('0x1b9')});db[_0x28be('0xc8')][_0x28be('0x10f')](db['FreshsalesField'],{'as':_0x28be('0x1bf'),'foreignKey':_0x28be('0x1b6')});db[_0x28be('0xc8')][_0x28be('0x10f')](db[_0x28be('0xc8')],{'as':_0x28be('0x1c0'),'foreignKey':_0x28be('0x1ba')});db['FreshsalesField']['belongsTo'](db[_0x28be('0x1bb')],{'as':_0x28be('0x1bb'),'foreignKey':_0x28be('0x1bc')});db[_0x28be('0xcd')][_0x28be('0x11d')](db['ChatWebsite'],{});db[_0x28be('0xcd')]['belongsTo'](db[_0x28be('0xf5')],{'as':_0x28be('0x166'),'foreignKey':_0x28be('0x167')});db[_0x28be('0xcd')][_0x28be('0x11d')](db[_0x28be('0x6e')],{'as':'Contact','foreignKey':_0x28be('0x15f')});db['ChatQueueReport'][_0x28be('0x11d')](db['ChatInteraction'],{});db[_0x28be('0xcd')]['belongsTo'](db[_0x28be('0x64')],{});db[_0x28be('0xcd')][_0x28be('0x11d')](db[_0x28be('0x10c')],{});db['ChatQueueReport'][_0x28be('0x11d')](db['ChatQueue'],{});db[_0x28be('0xcf')]['belongsTo'](db[_0x28be('0x10c')],{'onDelete':_0x28be('0x112'),'foreignKey':_0x28be('0x1c8')});db['ChatInternalMessage'][_0x28be('0x11d')](db[_0x28be('0x10c')],{'onDelete':_0x28be('0x112'),'foreignKey':_0x28be('0x1c9')});db[_0x28be('0x14a')][_0x28be('0x10f')](db[_0x28be('0x1ca')],{'foreignKey':_0x28be('0x1cb'),'onDelete':_0x28be('0x112')});db[_0x28be('0x14a')][_0x28be('0x10f')](db['JscriptyAnswerReport'],{'foreignKey':_0x28be('0x1cb'),'onDelete':_0x28be('0x112')});db[_0x28be('0xd5')][_0x28be('0x11d')](db['SmsAccount'],{});db[_0x28be('0xd5')][_0x28be('0x11d')](db['CmList'],{'as':_0x28be('0x166'),'foreignKey':_0x28be('0x167')});db[_0x28be('0xd5')][_0x28be('0x11d')](db[_0x28be('0x6e')],{'as':_0x28be('0x15e'),'foreignKey':_0x28be('0x15f')});db[_0x28be('0xd5')][_0x28be('0x11d')](db[_0x28be('0x53')],{});db[_0x28be('0xd5')][_0x28be('0x11d')](db[_0x28be('0x54')],{});db[_0x28be('0xd5')][_0x28be('0x11d')](db[_0x28be('0x10c')],{});db[_0x28be('0xd5')][_0x28be('0x11d')](db[_0x28be('0x132')],{});db[_0x28be('0xd8')][_0x28be('0x10f')](db['JscriptySessionReport'],{'foreignKey':_0x28be('0x1cc')});db[_0x28be('0xd8')][_0x28be('0x10f')](db['JscriptyQuestionReport'],{'foreignKey':_0x28be('0x1cc')});db[_0x28be('0xd8')][_0x28be('0x10f')](db[_0x28be('0xd1')],{'foreignKey':_0x28be('0x1cc')});db[_0x28be('0xdd')][_0x28be('0x122')](db[_0x28be('0x10c')],{'as':_0x28be('0x16e'),'through':_0x28be('0x1cd')});db[_0x28be('0xe2')]['belongsToMany'](db[_0x28be('0x10c')],{'as':_0x28be('0x153'),'through':_0x28be('0x125')});db[_0x28be('0xe2')][_0x28be('0x122')](db[_0x28be('0x19')],{'through':'TeamVoiceQueue','as':'VoiceQueues'});db['Team'][_0x28be('0x122')](db[_0x28be('0x12e')],{'through':_0x28be('0x168'),'as':_0x28be('0x1ce')});db['Team']['belongsToMany'](db['ChatQueue'],{'through':_0x28be('0x1cf'),'as':_0x28be('0x130')});db['Team'][_0x28be('0x122')](db[_0x28be('0x4e')],{'through':_0x28be('0x1d0'),'as':'FaxQueues'});db[_0x28be('0xe2')][_0x28be('0x122')](db[_0x28be('0x132')],{'through':_0x28be('0x184'),'as':_0x28be('0x1d1')});db['Team'][_0x28be('0x122')](db['OpenchannelQueue'],{'through':'team_has_openchannel_queues','as':'OpenchannelQueues'});db[_0x28be('0xe2')][_0x28be('0x122')](db[_0x28be('0x106')],{'through':_0x28be('0x1d2'),'as':_0x28be('0x1d3')});db['Campaign'][_0x28be('0x10f')](db[_0x28be('0x70')],{'as':_0x28be('0x148'),'foreignKey':_0x28be('0x199')});db[_0x28be('0xe5')][_0x28be('0x10f')](db[_0x28be('0x74')],{'as':_0x28be('0x113'),'foreignKey':'CampaignId'});db['Campaign'][_0x28be('0x10f')](db[_0x28be('0x76')],{'as':_0x28be('0x149'),'foreignKey':'CampaignId'});db[_0x28be('0xe5')]['hasMany'](db['CmHopperBlack'],{'as':_0x28be('0x1d4'),'foreignKey':_0x28be('0x199')});db[_0x28be('0xe5')][_0x28be('0x11d')](db[_0x28be('0x14c')],{'as':'Trunk','foreignKey':_0x28be('0x14d')});db[_0x28be('0xe5')][_0x28be('0x11d')](db[_0x28be('0x14c')],{'as':'TrunkBackup','foreignKey':_0x28be('0x14f')});db['Campaign'][_0x28be('0x11d')](db['Interval'],{'as':_0x28be('0x80'),'foreignKey':_0x28be('0x150')});db['Campaign'][_0x28be('0x11d')](db[_0x28be('0xdd')],{'as':_0x28be('0xdd'),'foreignKey':_0x28be('0x1d5')});db[_0x28be('0xe5')][_0x28be('0x122')](db[_0x28be('0xf5')],{'as':'Lists','through':_0x28be('0x1d6')});db[_0x28be('0xe5')][_0x28be('0x122')](db[_0x28be('0xf5')],{'as':_0x28be('0x155'),'through':_0x28be('0x1d7')});db[_0x28be('0xe9')]['belongsTo'](db['ChatOfflineMessage'],{'as':_0x28be('0x66'),'foreignKey':_0x28be('0x172')});db[_0x28be('0xed')]['belongsTo'](db[_0x28be('0x40')],{});db[_0x28be('0xed')][_0x28be('0x11d')](db['MailInteraction'],{});db[_0x28be('0xed')][_0x28be('0x11d')](db[_0x28be('0x3a')],{'foreignKey':_0x28be('0x1d8'),'as':_0x28be('0x1d9')});db[_0x28be('0xed')]['belongsTo'](db[_0x28be('0x10c')],{'foreignKey':_0x28be('0x1da'),'as':'FromAgent'});db[_0x28be('0xed')]['belongsTo'](db[_0x28be('0x10c')],{'foreignKey':'ToUserId','as':_0x28be('0x1db')});db['MailTransferReport'][_0x28be('0x11d')](db[_0x28be('0x12e')],{'foreignKey':_0x28be('0x1dc'),'as':_0x28be('0x1dd')});db['MailTransferReport'][_0x28be('0x11d')](db[_0x28be('0x3a')],{'foreignKey':_0x28be('0x1de'),'as':_0x28be('0x1df')});db[_0x28be('0xef')]['belongsTo'](db[_0x28be('0x64')],{});db[_0x28be('0xef')][_0x28be('0x11d')](db[_0x28be('0x62')],{});db['ChatTransferReport']['belongsTo'](db[_0x28be('0x135')],{'foreignKey':_0x28be('0x1e0'),'as':_0x28be('0x1d9')});db[_0x28be('0xef')][_0x28be('0x11d')](db[_0x28be('0x10c')],{'foreignKey':'FromUserId','as':_0x28be('0x1e1')});db['ChatTransferReport'][_0x28be('0x11d')](db[_0x28be('0x10c')],{'foreignKey':'ToUserId','as':_0x28be('0x1db')});db['ChatTransferReport'][_0x28be('0x11d')](db['ChatQueue'],{'foreignKey':'ToChatQueueId','as':_0x28be('0x1dd')});db['ChatTransferReport'][_0x28be('0x11d')](db[_0x28be('0x135')],{'foreignKey':_0x28be('0x1e2'),'as':_0x28be('0x1df')});db['FaxTransferReport'][_0x28be('0x11d')](db[_0x28be('0x178')],{});db[_0x28be('0xf1')]['belongsTo'](db[_0x28be('0x4c')],{});db[_0x28be('0xf1')][_0x28be('0x11d')](db[_0x28be('0x48')],{'foreignKey':_0x28be('0x1e3'),'as':_0x28be('0x1d9')});db[_0x28be('0xf1')][_0x28be('0x11d')](db[_0x28be('0x10c')],{'foreignKey':_0x28be('0x1da'),'as':_0x28be('0x1e1')});db[_0x28be('0xf1')][_0x28be('0x11d')](db[_0x28be('0x10c')],{'foreignKey':_0x28be('0x1e4'),'as':_0x28be('0x1db')});db[_0x28be('0xf1')][_0x28be('0x11d')](db[_0x28be('0x4e')],{'foreignKey':'ToFaxQueueId','as':_0x28be('0x1dd')});db[_0x28be('0xf1')][_0x28be('0x11d')](db[_0x28be('0x48')],{'foreignKey':'ToFaxAccountId','as':_0x28be('0x1df')});db[_0x28be('0xf3')][_0x28be('0x11d')](db['OpenchannelMessage'],{});db[_0x28be('0xf3')][_0x28be('0x11d')](db[_0x28be('0x5a')],{});db[_0x28be('0xf3')][_0x28be('0x11d')](db[_0x28be('0x56')],{'foreignKey':_0x28be('0x1e5'),'as':_0x28be('0x1d9')});db[_0x28be('0xf3')][_0x28be('0x11d')](db[_0x28be('0x10c')],{'foreignKey':_0x28be('0x1da'),'as':_0x28be('0x1e1')});db[_0x28be('0xf3')][_0x28be('0x11d')](db[_0x28be('0x10c')],{'foreignKey':_0x28be('0x1e4'),'as':_0x28be('0x1db')});db[_0x28be('0xf3')][_0x28be('0x11d')](db[_0x28be('0x5c')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x28be('0xf3')][_0x28be('0x11d')](db[_0x28be('0x56')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db[_0x28be('0xf4')]['belongsTo'](db[_0x28be('0x54')],{});db[_0x28be('0xf4')][_0x28be('0x11d')](db[_0x28be('0x53')],{});db[_0x28be('0xf4')][_0x28be('0x11d')](db[_0x28be('0x50')],{'foreignKey':_0x28be('0x1e6'),'as':_0x28be('0x1d9')});db[_0x28be('0xf4')][_0x28be('0x11d')](db['User'],{'foreignKey':_0x28be('0x1da'),'as':'FromAgent'});db[_0x28be('0xf4')][_0x28be('0x11d')](db['User'],{'foreignKey':'ToUserId','as':_0x28be('0x1db')});db[_0x28be('0xf4')][_0x28be('0x11d')](db[_0x28be('0x132')],{'foreignKey':'ToSmsQueueId','as':'ToQueue'});db['SmsTransferReport']['belongsTo'](db[_0x28be('0x50')],{'foreignKey':_0x28be('0x1e7'),'as':_0x28be('0x1df')});db[_0x28be('0xf5')]['hasMany'](db[_0x28be('0x177')],{'as':_0x28be('0x162'),'foreignKey':_0x28be('0x167'),'onDelete':'cascade'});db[_0x28be('0xf5')][_0x28be('0x10f')](db[_0x28be('0x78')],{'as':_0x28be('0x1e8'),'foreignKey':_0x28be('0x167')});db[_0x28be('0xf5')][_0x28be('0x10f')](db[_0x28be('0x6e')],{'as':'Contacts','onDelete':_0x28be('0x112'),'foreignKey':_0x28be('0x167')});db[_0x28be('0xf5')]['hasMany'](db[_0x28be('0x74')],{'as':_0x28be('0x113'),'foreignKey':_0x28be('0x167')});db[_0x28be('0xf5')][_0x28be('0x10f')](db[_0x28be('0x76')],{'as':'HopperHistory','foreignKey':_0x28be('0x167')});db[_0x28be('0xf5')][_0x28be('0x10f')](db[_0x28be('0x114')],{'as':_0x28be('0x114'),'foreignKey':_0x28be('0x167')});db[_0x28be('0xf5')][_0x28be('0x122')](db[_0x28be('0x19')],{'as':_0x28be('0x1e9'),'through':'voice_queues_has_cm_lists'});db['CmList'][_0x28be('0x122')](db[_0x28be('0x10c')],{'as':'Agents','through':_0x28be('0x124')});db[_0x28be('0xf6')][_0x28be('0x10f')](db[_0x28be('0x16')],{'as':'Extensions','onDelete':'cascade'});db[_0x28be('0xf6')][_0x28be('0x122')](db[_0x28be('0x10c')],{'as':_0x28be('0x153'),'through':_0x28be('0x134')});db[_0x28be('0xf8')][_0x28be('0x10f')](db[_0x28be('0x10c')],{'as':_0x28be('0x16e'),'foreignKey':_0x28be('0x11e')});db[_0x28be('0xf8')][_0x28be('0x10f')](db[_0x28be('0xf9')],{'as':_0x28be('0x1ea'),'foreignKey':_0x28be('0x11e'),'onDelete':_0x28be('0x112')});db[_0x28be('0xf9')][_0x28be('0x10f')](db['UserProfileResource'],{'as':_0x28be('0x1eb'),'foreignKey':_0x28be('0x1ec'),'onDelete':_0x28be('0x112')});db[_0x28be('0xfe')][_0x28be('0x10f')](db[_0x28be('0x177')],{'as':_0x28be('0x162'),'foreignKey':_0x28be('0x1ed'),'onDelete':_0x28be('0x112')});db[_0x28be('0xfe')][_0x28be('0x10f')](db[_0x28be('0x163')],{'as':_0x28be('0x164'),'foreignKey':_0x28be('0x1ed')});db[_0x28be('0xfe')][_0x28be('0x10f')](db[_0x28be('0x103')],{'as':_0x28be('0x169'),'foreignKey':_0x28be('0x1ed')});db[_0x28be('0xfe')][_0x28be('0x10f')](db[_0x28be('0x101')],{'as':_0x28be('0x165')});db['WhatsappAccount']['hasMany'](db[_0x28be('0x1ee')],{'as':_0x28be('0x143')});db['WhatsappAccount'][_0x28be('0x11d')](db[_0x28be('0xf5')],{'as':_0x28be('0x166'),'foreignKey':_0x28be('0x167')});db[_0x28be('0xfe')][_0x28be('0x11d')](db[_0x28be('0x82')],{'as':_0x28be('0x179'),'foreignKey':_0x28be('0x151')});db['WhatsappAccount'][_0x28be('0x122')](db[_0x28be('0x10c')],{'as':_0x28be('0x153'),'through':_0x28be('0x1ef')});db[_0x28be('0x1ee')][_0x28be('0x11d')](db[_0x28be('0x10c')],{'onDelete':_0x28be('0x173')});db[_0x28be('0x1ee')][_0x28be('0x11d')](db[_0x28be('0x106')],{'onDelete':_0x28be('0x173')});db[_0x28be('0x1ee')][_0x28be('0x11d')](db['WhatsappAccount'],{'onDelete':_0x28be('0x173')});db[_0x28be('0x1ee')][_0x28be('0x11d')](db[_0x28be('0x80')],{'onDelete':_0x28be('0x173'),'foreignKey':_0x28be('0x150')});db[_0x28be('0x1ee')][_0x28be('0x11d')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x28be('0x174')});db[_0x28be('0x101')][_0x28be('0x10f')](db['WhatsappMessage'],{'as':_0x28be('0x169'),'onDelete':_0x28be('0x112'),'foreignKey':_0x28be('0x1f0')});db['WhatsappInteraction']['belongsTo'](db['WhatsappAccount'],{'as':'Account','foreignKey':_0x28be('0x1ed')});db[_0x28be('0x101')][_0x28be('0x11d')](db[_0x28be('0x6e')],{'as':'Contact','foreignKey':_0x28be('0x15f')});db['WhatsappInteraction'][_0x28be('0x11d')](db[_0x28be('0x10c')],{'as':_0x28be('0x189'),'foreignKey':'UserId'});db[_0x28be('0x101')][_0x28be('0x122')](db[_0x28be('0x8a')],{'through':_0x28be('0x1a9'),'as':_0x28be('0x17d')});db[_0x28be('0x101')][_0x28be('0x122')](db[_0x28be('0x8a')],{'through':_0x28be('0x1a9'),'as':_0x28be('0x16d')});db[_0x28be('0x101')][_0x28be('0x122')](db[_0x28be('0x10c')],{'as':_0x28be('0x16e'),'through':_0x28be('0x12b'),'foreignKey':_0x28be('0x1f0')});db[_0x28be('0x103')][_0x28be('0x11d')](db[_0x28be('0x10c')],{'as':_0x28be('0x10c')});db[_0x28be('0x103')][_0x28be('0x11d')](db['CmContact'],{'onDelete':_0x28be('0x112'),'as':_0x28be('0x15e')});db['WhatsappMessage'][_0x28be('0x11d')](db[_0x28be('0x101')],{'onDelete':_0x28be('0x112'),'as':_0x28be('0x170'),'foreignKey':_0x28be('0x1f0')});db['WhatsappMessage']['belongsTo'](db[_0x28be('0xfe')],{'as':_0x28be('0x16b'),'foreignKey':_0x28be('0x1ed')});db[_0x28be('0x1f1')][_0x28be('0x11d')](db[_0x28be('0xfe')],{});db[_0x28be('0x1f1')][_0x28be('0x11d')](db[_0x28be('0xf5')],{'as':_0x28be('0x166'),'foreignKey':_0x28be('0x167')});db[_0x28be('0x1f1')][_0x28be('0x11d')](db[_0x28be('0x6e')],{'as':'Contact','foreignKey':'ContactId'});db[_0x28be('0x1f1')][_0x28be('0x11d')](db[_0x28be('0x101')],{});db[_0x28be('0x1f1')]['belongsTo'](db[_0x28be('0x106')],{});db[_0x28be('0x1f1')][_0x28be('0x11d')](db[_0x28be('0x103')],{});db[_0x28be('0x1f1')]['belongsTo'](db[_0x28be('0x10c')],{});db[_0x28be('0x1f2')][_0x28be('0x11d')](db[_0x28be('0x103')],{});db['WhatsappTransferReport'][_0x28be('0x11d')](db['WhatsappInteraction'],{});db[_0x28be('0x1f2')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x28be('0x1f3'),'as':_0x28be('0x1d9')});db[_0x28be('0x1f2')][_0x28be('0x11d')](db[_0x28be('0xfe')],{'foreignKey':_0x28be('0x1f4'),'as':_0x28be('0x1df')});db[_0x28be('0x1f2')][_0x28be('0x11d')](db[_0x28be('0x106')],{'foreignKey':_0x28be('0x1f5'),'as':'ToQueue'});db[_0x28be('0x1f2')]['belongsTo'](db[_0x28be('0x10c')],{'foreignKey':_0x28be('0x1da'),'as':_0x28be('0x1e1')});db[_0x28be('0x1f2')]['belongsTo'](db[_0x28be('0x10c')],{'foreignKey':_0x28be('0x1e4'),'as':_0x28be('0x1db')});db['WhatsappQueue'][_0x28be('0x122')](db[_0x28be('0x10c')],{'as':'Agents','through':'UserWhatsappQueue','foreignKey':'WhatsappQueueId'});db[_0x28be('0x106')][_0x28be('0x122')](db['Team'],{'through':_0x28be('0x1d2'),'as':_0x28be('0x154')});module[_0x28be('0x1f6')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index e9d5f55..c84d09d 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x25b1=['/api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/webbar','/apidoc','static','/www','join','/demo','/snippet','root','snippet','3.0.0','/server/files/plugins','route','sendFile','get','appPath','/index.html','password','newPassword','apiKey','firstName','lastName','street','phone','mobile','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','accessToken','authToken','membername','calleridname','exten','clientEmail','privateKey','accesskeyid','secretaccesskey','key','pass','localstationid','dsn','registry','oldPassword','isArray','length','@@{','replace','}@@','includes','lodash','path','express','express-winston','util','./errors','./config/logger','auth','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','method','headers','x-forwarded-for','connection','url','statusCode','responseTime','user','name','role','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','remoteAddress','other','agent_name','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','/api/voice/queues','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','/api/voice/queues/reports','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','./api/faxInteraction','/api/fax/reports/queue','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','/api/chat/websites','./api/chatWebsite','/api/chat/applications','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','/api/cm/companies','./api/cmCompany','./api/cmContact','/api/cm/hopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/custom_fields','./api/cmCustomField','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','./api/disposition','/api/conditions','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','/api/schedules','./api/sound','/api/tags','./api/tag','/api/templates','./api/trigger','./api/variable','/api/integrations','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','/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/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZendeskAccount','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','./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/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/settings','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/teams','./api/team','/api/license','/api/campaigns','./api/campaign','/api/migrations','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','/api/whatsapp/accounts','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','./api/realtime','/api/auth/google'];(function(_0x65d6ff,_0x39c1b6){var _0xb3fb8c=function(_0x3a9856){while(--_0x3a9856){_0x65d6ff['push'](_0x65d6ff['shift']());}};_0xb3fb8c(++_0x39c1b6);}(_0x25b1,0x17a));var _0x125b=function(_0x40ab4a,_0x3f1951){_0x40ab4a=_0x40ab4a-0x0;var _0xcc760a=_0x25b1[_0x40ab4a];return _0xcc760a;};'use strict';var _=require(_0x125b('0x0'));var path=require(_0x125b('0x1'));var express=require(_0x125b('0x2'));var ewinston=require(_0x125b('0x3'));var util=require(_0x125b('0x4'));var errors=require(_0x125b('0x5'));var config=require('./config/environment');var logger=require(_0x125b('0x6'))('api');var authLogger=require(_0x125b('0x6'))(_0x125b('0x7'));exports['default']=function(_0x5956b6){_0x5956b6[_0x125b('0x8')](ewinston['logger']({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x1577dd,_0x2a258f){var _0x36b5bc=_0x125b('0x9');if(!_[_0x125b('0xa')](_0x1577dd[_0x125b('0xb')])){_0x36b5bc+='\x20body=%s';var _0x4ee8eb=_0x1577dd[_0x125b('0xb')];maskSensitiveData(_0x4ee8eb);}return util['format'](_0x36b5bc,_0x1577dd[_0x125b('0xc')],_0x1577dd[_0x125b('0xd')]['x-forwarded-for']?_0x1577dd[_0x125b('0xd')][_0x125b('0xe')]:_0x1577dd[_0x125b('0xf')]['remoteAddress']||_0x1577dd['ip'],_0x1577dd[_0x125b('0x10')],_0x2a258f[_0x125b('0x11')],_0x2a258f[_0x125b('0x12')],_0x1577dd[_0x125b('0x13')]?_0x1577dd[_0x125b('0x13')]['id']:null,_0x1577dd[_0x125b('0x13')]?_0x1577dd['user'][_0x125b('0x14')]:null,_0x1577dd[_0x125b('0x13')]?_0x1577dd['user'][_0x125b('0x15')]:null,_0x4ee8eb?util['inspect'](_0x4ee8eb,![],null):'');}}));_0x5956b6[_0x125b('0x8')](ewinston[_0x125b('0x16')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x33d731,_0x3b950b){var _0x542565=_0x125b('0x17');if(_0x33d731[_0x125b('0xb')]&&_0x33d731[_0x125b('0xb')][_0x125b('0x18')]&&_0x33d731[_0x125b('0xb')][_0x125b('0x19')]){_0x542565=_0x125b('0x1a');}return util[_0x125b('0x1b')](_0x542565,_0x33d731[_0x125b('0xc')],_0x33d731[_0x125b('0xd')][_0x125b('0xe')]?_0x33d731[_0x125b('0xd')][_0x125b('0xe')]:_0x33d731[_0x125b('0xf')][_0x125b('0x1c')]||_0x33d731['ip'],_0x33d731['url'],_0x3b950b[_0x125b('0x11')],_0x3b950b[_0x125b('0x12')],_0x33d731[_0x125b('0x13')]?_0x33d731[_0x125b('0x13')]['id']:null,_0x33d731[_0x125b('0x13')]?_0x33d731['user']['name']:null,_0x33d731[_0x125b('0x13')]?_0x33d731['user'][_0x125b('0x15')]:null,_0x33d731['body']&&_0x33d731[_0x125b('0xb')][_0x125b('0x18')]?_0x33d731[_0x125b('0xb')]['device']:_0x125b('0x1d'),_0x33d731[_0x125b('0xb')]&&_0x33d731[_0x125b('0xb')][_0x125b('0x19')]?_0x33d731[_0x125b('0xb')][_0x125b('0x19')]:'',_0x33d731[_0x125b('0xb')]&&_0x33d731['body'][_0x125b('0x1e')]?_0x33d731['body'][_0x125b('0x1e')]:'');},'ignoreRoute':function(_0x34c6d4){var _0x2c2049=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x2c2049['test'](_0x34c6d4[_0x125b('0x10')]);}}));_0x5956b6[_0x125b('0x8')](_0x125b('0x1f'),require(_0x125b('0x20')));_0x5956b6[_0x125b('0x8')](_0x125b('0x21'),require(_0x125b('0x22')));_0x5956b6[_0x125b('0x8')](_0x125b('0x23'),require('./api/voiceContext'));_0x5956b6[_0x125b('0x8')](_0x125b('0x24'),require(_0x125b('0x25')));_0x5956b6[_0x125b('0x8')](_0x125b('0x26'),require('./api/voiceMusicOnHold'));_0x5956b6[_0x125b('0x8')](_0x125b('0x27'),require('./api/voiceQueue'));_0x5956b6[_0x125b('0x8')](_0x125b('0x28'),require(_0x125b('0x29')));_0x5956b6[_0x125b('0x8')]('/api/screen/recordings',require(_0x125b('0x2a')));_0x5956b6[_0x125b('0x8')](_0x125b('0x2b'),require(_0x125b('0x2c')));_0x5956b6['use'](_0x125b('0x2d'),require(_0x125b('0x2e')));_0x5956b6['use'](_0x125b('0x2f'),require(_0x125b('0x30')));_0x5956b6[_0x125b('0x8')](_0x125b('0x31'),require(_0x125b('0x32')));_0x5956b6[_0x125b('0x8')]('/api/voice/agents/reports',require(_0x125b('0x33')));_0x5956b6[_0x125b('0x8')](_0x125b('0x34'),require('./api/voiceQueueReport'));_0x5956b6[_0x125b('0x8')](_0x125b('0x35'),require(_0x125b('0x36')));_0x5956b6['use'](_0x125b('0x37'),require(_0x125b('0x38')));_0x5956b6['use'](_0x125b('0x39'),require('./api/voiceTransferReport'));_0x5956b6[_0x125b('0x8')](_0x125b('0x3a'),require(_0x125b('0x3b')));_0x5956b6[_0x125b('0x8')](_0x125b('0x3c'),require(_0x125b('0x3d')));_0x5956b6['use'](_0x125b('0x3e'),require(_0x125b('0x3f')));_0x5956b6[_0x125b('0x8')](_0x125b('0x40'),require(_0x125b('0x41')));_0x5956b6[_0x125b('0x8')](_0x125b('0x42'),require(_0x125b('0x43')));_0x5956b6[_0x125b('0x8')]('/api/mail/messages',require(_0x125b('0x44')));_0x5956b6['use'](_0x125b('0x45'),require(_0x125b('0x46')));_0x5956b6[_0x125b('0x8')](_0x125b('0x47'),require(_0x125b('0x48')));_0x5956b6[_0x125b('0x8')]('/api/dashboards',require(_0x125b('0x49')));_0x5956b6[_0x125b('0x8')](_0x125b('0x4a'),require('./api/dashboardItem'));_0x5956b6['use'](_0x125b('0x4b'),require(_0x125b('0x4c')));_0x5956b6[_0x125b('0x8')](_0x125b('0x4d'),require(_0x125b('0x4e')));_0x5956b6['use']('/api/fax/interactions',require(_0x125b('0x4f')));_0x5956b6[_0x125b('0x8')]('/api/fax/messages',require('./api/faxMessage'));_0x5956b6['use']('/api/fax/queues',require('./api/faxQueue'));_0x5956b6[_0x125b('0x8')](_0x125b('0x50'),require('./api/faxQueueReport'));_0x5956b6[_0x125b('0x8')](_0x125b('0x51'),require(_0x125b('0x52')));_0x5956b6['use'](_0x125b('0x53'),require(_0x125b('0x54')));_0x5956b6['use'](_0x125b('0x55'),require(_0x125b('0x56')));_0x5956b6[_0x125b('0x8')](_0x125b('0x57'),require(_0x125b('0x58')));_0x5956b6[_0x125b('0x8')](_0x125b('0x59'),require(_0x125b('0x5a')));_0x5956b6[_0x125b('0x8')]('/api/openchannel/accounts',require(_0x125b('0x5b')));_0x5956b6['use'](_0x125b('0x5c'),require(_0x125b('0x5d')));_0x5956b6[_0x125b('0x8')](_0x125b('0x5e'),require('./api/openchannelInteraction'));_0x5956b6[_0x125b('0x8')](_0x125b('0x5f'),require('./api/openchannelMessage'));_0x5956b6[_0x125b('0x8')]('/api/openchannel/queues',require('./api/openchannelQueue'));_0x5956b6['use'](_0x125b('0x60'),require(_0x125b('0x61')));_0x5956b6[_0x125b('0x8')]('/api/openchannel/reports/queue',require('./api/openchannelQueueReport'));_0x5956b6['use'](_0x125b('0x62'),require('./api/chatApplication'));_0x5956b6[_0x125b('0x8')](_0x125b('0x63'),require(_0x125b('0x64')));_0x5956b6[_0x125b('0x8')](_0x125b('0x65'),require(_0x125b('0x66')));_0x5956b6[_0x125b('0x8')](_0x125b('0x67'),require('./api/chatOfflineMessage'));_0x5956b6['use'](_0x125b('0x68'),require(_0x125b('0x69')));_0x5956b6[_0x125b('0x8')](_0x125b('0x6a'),require(_0x125b('0x6b')));_0x5956b6[_0x125b('0x8')](_0x125b('0x6c'),require('./api/chatProactiveAction'));_0x5956b6[_0x125b('0x8')](_0x125b('0x6d'),require(_0x125b('0x6e')));_0x5956b6[_0x125b('0x8')]('/api/cm/contacts',require(_0x125b('0x6f')));_0x5956b6['use'](_0x125b('0x70'),require('./api/cmHopper'));_0x5956b6[_0x125b('0x8')](_0x125b('0x71'),require(_0x125b('0x72')));_0x5956b6[_0x125b('0x8')](_0x125b('0x73'),require(_0x125b('0x74')));_0x5956b6[_0x125b('0x8')]('/api/cm/hopper_history',require('./api/cmHopperHistory'));_0x5956b6['use'](_0x125b('0x75'),require(_0x125b('0x76')));_0x5956b6[_0x125b('0x8')]('/api/actions',require(_0x125b('0x77')));_0x5956b6[_0x125b('0x8')](_0x125b('0x78'),require(_0x125b('0x79')));_0x5956b6[_0x125b('0x8')](_0x125b('0x7a'),require(_0x125b('0x7b')));_0x5956b6[_0x125b('0x8')]('/api/dispositions',require(_0x125b('0x7c')));_0x5956b6[_0x125b('0x8')](_0x125b('0x7d'),require('./api/condition'));_0x5956b6['use']('/api/intervals',require('./api/interval'));_0x5956b6[_0x125b('0x8')](_0x125b('0x7e'),require(_0x125b('0x7f')));_0x5956b6[_0x125b('0x8')](_0x125b('0x80'),require(_0x125b('0x81')));_0x5956b6[_0x125b('0x8')](_0x125b('0x82'),require('./api/voiceQueuesLog'));_0x5956b6[_0x125b('0x8')](_0x125b('0x83'),require('./api/schedule'));_0x5956b6[_0x125b('0x8')]('/api/sounds',require(_0x125b('0x84')));_0x5956b6['use'](_0x125b('0x85'),require(_0x125b('0x86')));_0x5956b6[_0x125b('0x8')](_0x125b('0x87'),require('./api/template'));_0x5956b6[_0x125b('0x8')]('/api/triggers',require(_0x125b('0x88')));_0x5956b6[_0x125b('0x8')]('/api/variables',require(_0x125b('0x89')));_0x5956b6['use'](_0x125b('0x8a'),require('./api/integration'));_0x5956b6[_0x125b('0x8')](_0x125b('0x8b'),require(_0x125b('0x8c')));_0x5956b6[_0x125b('0x8')](_0x125b('0x8d'),require('./api/analyticCustomReport'));_0x5956b6[_0x125b('0x8')](_0x125b('0x8e'),require(_0x125b('0x8f')));_0x5956b6['use'](_0x125b('0x90'),require(_0x125b('0x91')));_0x5956b6[_0x125b('0x8')]('/api/analytics/metrics',require(_0x125b('0x92')));_0x5956b6[_0x125b('0x8')](_0x125b('0x93'),require(_0x125b('0x94')));_0x5956b6['use'](_0x125b('0x95'),require(_0x125b('0x96')));_0x5956b6[_0x125b('0x8')](_0x125b('0x97'),require(_0x125b('0x98')));_0x5956b6[_0x125b('0x8')]('/api/integrations/salesforce/configurations',require(_0x125b('0x99')));_0x5956b6[_0x125b('0x8')](_0x125b('0x9a'),require('./api/intSalesforceField'));_0x5956b6[_0x125b('0x8')](_0x125b('0x9b'),require(_0x125b('0x9c')));_0x5956b6['use'](_0x125b('0x9d'),require(_0x125b('0x9e')));_0x5956b6[_0x125b('0x8')](_0x125b('0x9f'),require(_0x125b('0xa0')));_0x5956b6[_0x125b('0x8')](_0x125b('0xa1'),require(_0x125b('0xa2')));_0x5956b6[_0x125b('0x8')]('/api/integrations/desk/configurations',require(_0x125b('0xa3')));_0x5956b6[_0x125b('0x8')](_0x125b('0xa4'),require(_0x125b('0xa5')));_0x5956b6[_0x125b('0x8')](_0x125b('0xa6'),require(_0x125b('0xa7')));_0x5956b6[_0x125b('0x8')](_0x125b('0xa8'),require(_0x125b('0xa9')));_0x5956b6[_0x125b('0x8')](_0x125b('0xaa'),require('./api/intZohoField'));_0x5956b6[_0x125b('0x8')]('/api/integrations/zendesk/accounts',require(_0x125b('0xab')));_0x5956b6[_0x125b('0x8')]('/api/integrations/zendesk/configurations',require(_0x125b('0xac')));_0x5956b6[_0x125b('0x8')](_0x125b('0xad'),require(_0x125b('0xae')));_0x5956b6[_0x125b('0x8')]('/api/integrations/freshdesk/accounts',require(_0x125b('0xaf')));_0x5956b6[_0x125b('0x8')](_0x125b('0xb0'),require('./api/intFreshdeskConfiguration'));_0x5956b6[_0x125b('0x8')](_0x125b('0xb1'),require(_0x125b('0xb2')));_0x5956b6[_0x125b('0x8')]('/api/integrations/vtiger/accounts',require('./api/intVtigerAccount'));_0x5956b6[_0x125b('0x8')]('/api/integrations/vtiger/configurations',require(_0x125b('0xb3')));_0x5956b6[_0x125b('0x8')](_0x125b('0xb4'),require(_0x125b('0xb5')));_0x5956b6['use'](_0x125b('0xb6'),require(_0x125b('0xb7')));_0x5956b6[_0x125b('0x8')](_0x125b('0xb8'),require('./api/intServicenowConfiguration'));_0x5956b6[_0x125b('0x8')](_0x125b('0xb9'),require(_0x125b('0xba')));_0x5956b6[_0x125b('0x8')]('/api/integrations/dynamics365/accounts',require(_0x125b('0xbb')));_0x5956b6[_0x125b('0x8')]('/api/integrations/dynamics365/configurations',require(_0x125b('0xbc')));_0x5956b6[_0x125b('0x8')](_0x125b('0xbd'),require('./api/intDynamics365Field'));_0x5956b6['use'](_0x125b('0xbe'),require(_0x125b('0xbf')));_0x5956b6[_0x125b('0x8')](_0x125b('0xc0'),require(_0x125b('0xc1')));_0x5956b6[_0x125b('0x8')]('/api/integrations/freshsales/fields',require('./api/intFreshsalesField'));_0x5956b6[_0x125b('0x8')](_0x125b('0xc2'),require(_0x125b('0xc3')));_0x5956b6['use'](_0x125b('0xc4'),require(_0x125b('0xc5')));_0x5956b6[_0x125b('0x8')](_0x125b('0xc6'),require(_0x125b('0xc7')));_0x5956b6['use']('/api/jscripty/answers/reports',require(_0x125b('0xc8')));_0x5956b6[_0x125b('0x8')](_0x125b('0xc9'),require(_0x125b('0xca')));_0x5956b6[_0x125b('0x8')](_0x125b('0xcb'),require(_0x125b('0xcc')));_0x5956b6[_0x125b('0x8')](_0x125b('0xcd'),require(_0x125b('0xce')));_0x5956b6[_0x125b('0x8')]('/api/square/reports',require(_0x125b('0xcf')));_0x5956b6['use'](_0x125b('0xd0'),require(_0x125b('0xd1')));_0x5956b6['use']('/api/jscripty/projects',require('./api/jscriptyProject'));_0x5956b6[_0x125b('0x8')](_0x125b('0xd2'),require('./api/setting'));_0x5956b6[_0x125b('0x8')](_0x125b('0xd3'),require(_0x125b('0xd4')));_0x5956b6['use'](_0x125b('0xd5'),require(_0x125b('0xd6')));_0x5956b6['use'](_0x125b('0xd7'),require(_0x125b('0xd8')));_0x5956b6[_0x125b('0x8')]('/api/square/messages',require('./api/squareMessage'));_0x5956b6[_0x125b('0x8')](_0x125b('0xd9'),require(_0x125b('0xda')));_0x5956b6[_0x125b('0x8')](_0x125b('0xdb'),require('./api/license'));_0x5956b6[_0x125b('0x8')](_0x125b('0xdc'),require(_0x125b('0xdd')));_0x5956b6[_0x125b('0x8')](_0x125b('0xde'),require('./api/migration'));_0x5956b6[_0x125b('0x8')]('/api/attachments',require(_0x125b('0xdf')));_0x5956b6['use'](_0x125b('0xe0'),require(_0x125b('0xe1')));_0x5956b6[_0x125b('0x8')](_0x125b('0xe2'),require(_0x125b('0xe3')));_0x5956b6[_0x125b('0x8')]('/api/chat/reports/transfer',require(_0x125b('0xe4')));_0x5956b6[_0x125b('0x8')](_0x125b('0xe5'),require('./api/faxTransferReport'));_0x5956b6[_0x125b('0x8')](_0x125b('0xe6'),require(_0x125b('0xe7')));_0x5956b6[_0x125b('0x8')](_0x125b('0xe8'),require(_0x125b('0xe9')));_0x5956b6[_0x125b('0x8')](_0x125b('0xea'),require(_0x125b('0xeb')));_0x5956b6[_0x125b('0x8')](_0x125b('0xec'),require('./api/voicePrefix'));_0x5956b6[_0x125b('0x8')](_0x125b('0xed'),require(_0x125b('0xee')));_0x5956b6[_0x125b('0x8')](_0x125b('0xef'),require(_0x125b('0xf0')));_0x5956b6[_0x125b('0x8')](_0x125b('0xf1'),require(_0x125b('0xf2')));_0x5956b6['use'](_0x125b('0xf3'),require('./api/userNotification'));_0x5956b6[_0x125b('0x8')](_0x125b('0xf4'),require('./api/whatsappAccount'));_0x5956b6['use'](_0x125b('0xf5'),require(_0x125b('0xf6')));_0x5956b6['use'](_0x125b('0xf7'),require(_0x125b('0xf8')));_0x5956b6['use'](_0x125b('0xf9'),require(_0x125b('0xfa')));_0x5956b6[_0x125b('0x8')](_0x125b('0xfb'),require(_0x125b('0xfc')));_0x5956b6[_0x125b('0x8')]('/api/whatsapp/reports/transfer',require('./api/whatsappTransferReport'));_0x5956b6[_0x125b('0x8')](_0x125b('0xfd'),require(_0x125b('0xfe')));_0x5956b6[_0x125b('0x8')]('/api/cloudProviders',require(_0x125b('0xff')));_0x5956b6[_0x125b('0x8')]('/api/realtime',require(_0x125b('0x100')));_0x5956b6[_0x125b('0x8')]('/api/auth/local',require('./api/authLocal'));_0x5956b6[_0x125b('0x8')](_0x125b('0x101'),require('./api/authGoogle'));_0x5956b6[_0x125b('0x8')](_0x125b('0x102'),require('./api/jira'));_0x5956b6['use'](_0x125b('0x103'),require(_0x125b('0x104')));_0x5956b6[_0x125b('0x8')](_0x125b('0x105'),require(_0x125b('0x106')));_0x5956b6['use'](_0x125b('0x107'),require(_0x125b('0x108')));_0x5956b6[_0x125b('0x8')](_0x125b('0x109'),require('./api/pm2'));_0x5956b6[_0x125b('0x8')]('/api/webbar',require(_0x125b('0x10a')));_0x5956b6[_0x125b('0x8')](_0x125b('0x10b'),express[_0x125b('0x10c')](path['join'](config['root'],_0x125b('0x10b'))));_0x5956b6[_0x125b('0x8')](_0x125b('0x10d'),express[_0x125b('0x10c')](path['join'](config['root'],_0x125b('0x10d'))));_0x5956b6[_0x125b('0x8')]('/demo',express['static'](path[_0x125b('0x10e')](config['root'],_0x125b('0x10f'))));_0x5956b6[_0x125b('0x8')](_0x125b('0x110'),express[_0x125b('0x10c')](path[_0x125b('0x10e')](config[_0x125b('0x111')],_0x125b('0x112'),_0x125b('0x113'))));_0x5956b6['use']('/plugins',express['static'](path['join'](config['root'],_0x125b('0x114'))));_0x5956b6[_0x125b('0x115')]('/:url(api|auth|components|app|bower_components|assets)/*')['get'](errors[0x194]);_0x5956b6[_0x125b('0x115')]('/*')['get'](function(_0x40bf28,_0x5bca12){_0x5bca12[_0x125b('0x116')](path['resolve'](_0x5956b6[_0x125b('0x117')](_0x125b('0x118'))+_0x125b('0x119')));});};var sensitiveFields=['username',_0x125b('0x11a'),_0x125b('0x11b'),_0x125b('0x11c'),_0x125b('0x11d'),_0x125b('0x11e'),_0x125b('0x11f'),_0x125b('0x120'),_0x125b('0x121'),'fax',_0x125b('0x122'),_0x125b('0x123'),_0x125b('0x124'),_0x125b('0x125'),_0x125b('0x126'),_0x125b('0x127'),_0x125b('0x128'),'token','channelSecret',_0x125b('0x129'),'accessTokenSecret',_0x125b('0x12a'),'consumerKey','consumerSecret',_0x125b('0x12b'),_0x125b('0x12c'),'calleridnum',_0x125b('0x12d'),'vidaooApiKey',_0x125b('0x12e'),_0x125b('0x12f'),_0x125b('0x130'),_0x125b('0x131'),_0x125b('0x132'),'user',_0x125b('0x133'),'accountSid',_0x125b('0x134'),_0x125b('0x135'),'secret',_0x125b('0x136'),_0x125b('0x137')];function maskSensitiveData(_0x4bc926){var _0x40bd7b=/(?!^)[\s\S](?!$)/g;if(!_['isPlainObject'](_0x4bc926))return;for(var _0x6a91ec in _0x4bc926){if(_[_0x125b('0x138')](_0x4bc926[_0x6a91ec])){for(var _0x48954d=0x0;_0x48954d<_0x4bc926[_0x6a91ec][_0x125b('0x139')];_0x48954d++){maskSensitiveData(_0x4bc926[_0x6a91ec][_0x48954d]);}}else if(_['isPlainObject'](_0x4bc926[_0x6a91ec])){maskSensitiveData(_0x4bc926[_0x6a91ec]);}else if(_['isString'](_0x4bc926[_0x6a91ec])){_0x4bc926[_0x6a91ec]=_0x4bc926[_0x6a91ec]['replace'](/{{{/g,_0x125b('0x13a'))[_0x125b('0x13b')](/}}}/g,_0x125b('0x13c'))[_0x125b('0x13b')](/{{/g,'@{')[_0x125b('0x13b')](/}}/g,'}@');if(_[_0x125b('0x13d')](sensitiveFields,_0x6a91ec)){_0x4bc926[_0x6a91ec]=_0x4bc926[_0x6a91ec][_0x125b('0x13b')](_0x40bd7b,'*');}}}} \ No newline at end of file +var _0x4b8a=['./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','/api/networks','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','/api/jscripty/projects','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/migrations','./api/migration','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','./api/openchannelTransferReport','./api/voicePrefix','/api/userProfiles','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','static','root','join','/www','/snippet','snippet','3.0.0','/plugins','/server/files/plugins','route','get','sendFile','resolve','/index.html','username','newPassword','firstName','phone','mobile','fax','email','clientId','clientSecret','securityToken','code','accessKey','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerSecret','membername','calleridname','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','key','accountSid','localstationid','dsn','secret','registry','oldPassword','length','isPlainObject','replace','@@{','}@@','includes','lodash','path','express','express-winston','./config/environment','./config/logger','auth','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','\x20body=%s','body','method','headers','x-forwarded-for','connection','url','user','name','role','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','remoteAddress','statusCode','responseTime','other','agent_name','test','/api/users','/api/voice/chanspy','./api/voiceChanSpy','./api/voiceContext','./api/voiceExtension','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','./api/voiceMail','/api/voice/mails/messages','./api/voiceCallReport','/api/voice/dials/reports','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','./api/memberReport','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailQueue','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','/api/dashboards','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','./api/smsApplication','/api/sms/interactions','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmContact','./api/cmHopper','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','./api/action','./api/automation','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','./api/integration','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/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/integrations/zendesk/accounts','./api/intZendeskAccount','./api/intZendeskConfiguration','/api/integrations/zendesk/fields'];(function(_0x40ddd9,_0x4dacc5){var _0x388d8e=function(_0x5dc39e){while(--_0x5dc39e){_0x40ddd9['push'](_0x40ddd9['shift']());}};_0x388d8e(++_0x4dacc5);}(_0x4b8a,0x98));var _0xa4b8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4b8a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa4b8('0x0'));var path=require(_0xa4b8('0x1'));var express=require(_0xa4b8('0x2'));var ewinston=require(_0xa4b8('0x3'));var util=require('util');var errors=require('./errors');var config=require(_0xa4b8('0x4'));var logger=require(_0xa4b8('0x5'))('api');var authLogger=require('./config/logger')(_0xa4b8('0x6'));exports[_0xa4b8('0x7')]=function(_0x634493){_0x634493[_0xa4b8('0x8')](ewinston[_0xa4b8('0x9')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x3f9083,_0x3bfede){var _0x2dd160=_0xa4b8('0xa');if(!_[_0xa4b8('0xb')](_0x3f9083['body'])){_0x2dd160+=_0xa4b8('0xc');var _0x42e3c8=_0x3f9083[_0xa4b8('0xd')];maskSensitiveData(_0x42e3c8);}return util['format'](_0x2dd160,_0x3f9083[_0xa4b8('0xe')],_0x3f9083[_0xa4b8('0xf')]['x-forwarded-for']?_0x3f9083[_0xa4b8('0xf')][_0xa4b8('0x10')]:_0x3f9083[_0xa4b8('0x11')]['remoteAddress']||_0x3f9083['ip'],_0x3f9083[_0xa4b8('0x12')],_0x3bfede['statusCode'],_0x3bfede['responseTime'],_0x3f9083[_0xa4b8('0x13')]?_0x3f9083[_0xa4b8('0x13')]['id']:null,_0x3f9083[_0xa4b8('0x13')]?_0x3f9083['user'][_0xa4b8('0x14')]:null,_0x3f9083[_0xa4b8('0x13')]?_0x3f9083[_0xa4b8('0x13')][_0xa4b8('0x15')]:null,_0x42e3c8?util['inspect'](_0x42e3c8,![],null):'');}}));_0x634493[_0xa4b8('0x8')](ewinston[_0xa4b8('0x9')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x3c4bbc,_0x587251){var _0x2bbadc=_0xa4b8('0x16');if(_0x3c4bbc[_0xa4b8('0xd')]&&_0x3c4bbc['body']['device']&&_0x3c4bbc[_0xa4b8('0xd')][_0xa4b8('0x17')]){_0x2bbadc=_0xa4b8('0x18');}return util['format'](_0x2bbadc,_0x3c4bbc['method'],_0x3c4bbc[_0xa4b8('0xf')][_0xa4b8('0x10')]?_0x3c4bbc[_0xa4b8('0xf')][_0xa4b8('0x10')]:_0x3c4bbc[_0xa4b8('0x11')][_0xa4b8('0x19')]||_0x3c4bbc['ip'],_0x3c4bbc['url'],_0x587251[_0xa4b8('0x1a')],_0x587251[_0xa4b8('0x1b')],_0x3c4bbc[_0xa4b8('0x13')]?_0x3c4bbc['user']['id']:null,_0x3c4bbc[_0xa4b8('0x13')]?_0x3c4bbc[_0xa4b8('0x13')][_0xa4b8('0x14')]:null,_0x3c4bbc[_0xa4b8('0x13')]?_0x3c4bbc['user'][_0xa4b8('0x15')]:null,_0x3c4bbc['body']&&_0x3c4bbc['body']['device']?_0x3c4bbc[_0xa4b8('0xd')]['device']:_0xa4b8('0x1c'),_0x3c4bbc[_0xa4b8('0xd')]&&_0x3c4bbc[_0xa4b8('0xd')][_0xa4b8('0x17')]?_0x3c4bbc['body'][_0xa4b8('0x17')]:'',_0x3c4bbc['body']&&_0x3c4bbc[_0xa4b8('0xd')][_0xa4b8('0x1d')]?_0x3c4bbc['body'][_0xa4b8('0x1d')]:'');},'ignoreRoute':function(_0x4f7cf4){var _0x433417=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x433417[_0xa4b8('0x1e')](_0x4f7cf4[_0xa4b8('0x12')]);}}));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x1f'),require('./api/user'));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x20'),require(_0xa4b8('0x21')));_0x634493[_0xa4b8('0x8')]('/api/voice/contexts',require(_0xa4b8('0x22')));_0x634493[_0xa4b8('0x8')]('/api/voice/extensions',require(_0xa4b8('0x23')));_0x634493['use']('/api/voice/mohs',require('./api/voiceMusicOnHold'));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x24'),require(_0xa4b8('0x25')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x26'),require('./api/voiceRecording'));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x27'),require(_0xa4b8('0x28')));_0x634493[_0xa4b8('0x8')]('/api/voice/mails',require(_0xa4b8('0x29')));_0x634493['use'](_0xa4b8('0x2a'),require('./api/voiceMailMessage'));_0x634493[_0xa4b8('0x8')]('/api/voice/calls/reports',require(_0xa4b8('0x2b')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x2c'),require('./api/voiceDialReport'));_0x634493['use'](_0xa4b8('0x2d'),require(_0xa4b8('0x2e')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x2f'),require(_0xa4b8('0x30')));_0x634493[_0xa4b8('0x8')]('/api/members/reports',require(_0xa4b8('0x31')));_0x634493[_0xa4b8('0x8')]('/api/trunks',require(_0xa4b8('0x32')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x33'),require(_0xa4b8('0x34')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x35'),require(_0xa4b8('0x36')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x37'),require('./api/mailAccount'));_0x634493[_0xa4b8('0x8')]('/api/mail/queues',require(_0xa4b8('0x38')));_0x634493[_0xa4b8('0x8')]('/api/mail/substatuses',require('./api/mailSubstatus'));_0x634493['use']('/api/mail/interactions',require('./api/mailInteraction'));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x39'),require(_0xa4b8('0x3a')));_0x634493['use'](_0xa4b8('0x3b'),require(_0xa4b8('0x3c')));_0x634493['use']('/api/mail/reports/queue',require(_0xa4b8('0x3d')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x3e'),require('./api/dashboard'));_0x634493[_0xa4b8('0x8')]('/api/dashboards/items',require('./api/dashboardItem'));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x3f'),require(_0xa4b8('0x40')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x41'),require(_0xa4b8('0x42')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x43'),require(_0xa4b8('0x44')));_0x634493[_0xa4b8('0x8')]('/api/fax/messages',require('./api/faxMessage'));_0x634493['use'](_0xa4b8('0x45'),require(_0xa4b8('0x46')));_0x634493['use']('/api/fax/reports/queue',require(_0xa4b8('0x47')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x48'),require('./api/smsAccount'));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x49'),require(_0xa4b8('0x4a')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x4b'),require('./api/smsInteraction'));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x4c'),require(_0xa4b8('0x4d')));_0x634493['use'](_0xa4b8('0x4e'),require(_0xa4b8('0x4f')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x50'),require('./api/openchannelAccount'));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x51'),require(_0xa4b8('0x52')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x53'),require(_0xa4b8('0x54')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x55'),require(_0xa4b8('0x56')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x57'),require(_0xa4b8('0x58')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x59'),require(_0xa4b8('0x5a')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x5b'),require(_0xa4b8('0x5c')));_0x634493['use'](_0xa4b8('0x5d'),require('./api/chatApplication'));_0x634493[_0xa4b8('0x8')]('/api/chat/interactions',require('./api/chatInteraction'));_0x634493['use'](_0xa4b8('0x5e'),require(_0xa4b8('0x5f')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x60'),require('./api/chatOfflineMessage'));_0x634493[_0xa4b8('0x8')]('/api/chat/queues',require(_0xa4b8('0x61')));_0x634493['use'](_0xa4b8('0x62'),require(_0xa4b8('0x63')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x64'),require(_0xa4b8('0x65')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x66'),require('./api/cmCompany'));_0x634493[_0xa4b8('0x8')]('/api/cm/contacts',require(_0xa4b8('0x67')));_0x634493['use']('/api/cm/hopper',require(_0xa4b8('0x68')));_0x634493[_0xa4b8('0x8')]('/api/cm/hopper_black',require(_0xa4b8('0x69')));_0x634493[_0xa4b8('0x8')]('/api/cm/hopper_final',require(_0xa4b8('0x6a')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x6b'),require('./api/cmHopperHistory'));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x6c'),require(_0xa4b8('0x6d')));_0x634493['use']('/api/actions',require(_0xa4b8('0x6e')));_0x634493[_0xa4b8('0x8')]('/api/automations',require(_0xa4b8('0x6f')));_0x634493[_0xa4b8('0x8')]('/api/canned_answers',require('./api/cannedAnswer'));_0x634493[_0xa4b8('0x8')]('/api/dispositions',require(_0xa4b8('0x70')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x71'),require(_0xa4b8('0x72')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x73'),require(_0xa4b8('0x74')));_0x634493['use'](_0xa4b8('0x75'),require(_0xa4b8('0x76')));_0x634493['use'](_0xa4b8('0x77'),require(_0xa4b8('0x78')));_0x634493['use'](_0xa4b8('0x79'),require(_0xa4b8('0x7a')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x7b'),require(_0xa4b8('0x7c')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x7d'),require(_0xa4b8('0x7e')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x7f'),require(_0xa4b8('0x80')));_0x634493['use'](_0xa4b8('0x81'),require(_0xa4b8('0x82')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x83'),require(_0xa4b8('0x84')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x85'),require(_0xa4b8('0x86')));_0x634493['use']('/api/integrations',require(_0xa4b8('0x87')));_0x634493[_0xa4b8('0x8')]('/api/integrations/reports',require(_0xa4b8('0x88')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x89'),require(_0xa4b8('0x8a')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x8b'),require(_0xa4b8('0x8c')));_0x634493[_0xa4b8('0x8')]('/api/analytics/extracted_reports',require(_0xa4b8('0x8d')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x8e'),require(_0xa4b8('0x8f')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x90'),require(_0xa4b8('0x91')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x92'),require(_0xa4b8('0x93')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x94'),require(_0xa4b8('0x95')));_0x634493[_0xa4b8('0x8')]('/api/integrations/salesforce/configurations',require(_0xa4b8('0x96')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x97'),require(_0xa4b8('0x98')));_0x634493['use']('/api/integrations/sugarcrm/accounts',require(_0xa4b8('0x99')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x9a'),require(_0xa4b8('0x9b')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x9c'),require(_0xa4b8('0x9d')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x9e'),require(_0xa4b8('0x9f')));_0x634493[_0xa4b8('0x8')]('/api/integrations/desk/configurations',require('./api/intDeskConfiguration'));_0x634493['use'](_0xa4b8('0xa0'),require(_0xa4b8('0xa1')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0xa2'),require(_0xa4b8('0xa3')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0xa4'),require(_0xa4b8('0xa5')));_0x634493['use'](_0xa4b8('0xa6'),require(_0xa4b8('0xa7')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0xa8'),require(_0xa4b8('0xa9')));_0x634493['use']('/api/integrations/zendesk/configurations',require(_0xa4b8('0xaa')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0xab'),require(_0xa4b8('0xac')));_0x634493['use'](_0xa4b8('0xad'),require('./api/intFreshdeskAccount'));_0x634493[_0xa4b8('0x8')](_0xa4b8('0xae'),require('./api/intFreshdeskConfiguration'));_0x634493[_0xa4b8('0x8')](_0xa4b8('0xaf'),require(_0xa4b8('0xb0')));_0x634493[_0xa4b8('0x8')]('/api/integrations/vtiger/accounts',require(_0xa4b8('0xb1')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0xb2'),require(_0xa4b8('0xb3')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0xb4'),require(_0xa4b8('0xb5')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0xb6'),require('./api/intServicenowAccount'));_0x634493[_0xa4b8('0x8')]('/api/integrations/servicenow/configurations',require(_0xa4b8('0xb7')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0xb8'),require(_0xa4b8('0xb9')));_0x634493[_0xa4b8('0x8')]('/api/integrations/dynamics365/accounts',require(_0xa4b8('0xba')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0xbb'),require(_0xa4b8('0xbc')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0xbd'),require('./api/intDynamics365Field'));_0x634493[_0xa4b8('0x8')](_0xa4b8('0xbe'),require(_0xa4b8('0xbf')));_0x634493['use'](_0xa4b8('0xc0'),require('./api/intFreshsalesConfiguration'));_0x634493[_0xa4b8('0x8')](_0xa4b8('0xc1'),require('./api/intFreshsalesField'));_0x634493[_0xa4b8('0x8')](_0xa4b8('0xc2'),require('./api/network'));_0x634493[_0xa4b8('0x8')](_0xa4b8('0xc3'),require(_0xa4b8('0xc4')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0xc5'),require(_0xa4b8('0xc6')));_0x634493['use'](_0xa4b8('0xc7'),require('./api/jscriptyAnswerReport'));_0x634493[_0xa4b8('0x8')](_0xa4b8('0xc8'),require(_0xa4b8('0xc9')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0xca'),require('./api/jscriptySessionReport'));_0x634493[_0xa4b8('0x8')](_0xa4b8('0xcb'),require(_0xa4b8('0xcc')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0xcd'),require('./api/squareReport'));_0x634493[_0xa4b8('0x8')](_0xa4b8('0xce'),require('./api/squareReportDetail'));_0x634493[_0xa4b8('0x8')](_0xa4b8('0xcf'),require('./api/jscriptyProject'));_0x634493['use']('/api/settings',require(_0xa4b8('0xd0')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0xd1'),require(_0xa4b8('0xd2')));_0x634493['use'](_0xa4b8('0xd3'),require(_0xa4b8('0xd4')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0xd5'),require(_0xa4b8('0xd6')));_0x634493[_0xa4b8('0x8')]('/api/square/messages',require(_0xa4b8('0xd7')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0xd8'),require(_0xa4b8('0xd9')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0xda'),require(_0xa4b8('0xdb')));_0x634493[_0xa4b8('0x8')]('/api/campaigns',require('./api/campaign'));_0x634493[_0xa4b8('0x8')](_0xa4b8('0xdc'),require(_0xa4b8('0xdd')));_0x634493[_0xa4b8('0x8')]('/api/attachments',require('./api/attachment'));_0x634493[_0xa4b8('0x8')](_0xa4b8('0xde'),require(_0xa4b8('0xdf')));_0x634493['use'](_0xa4b8('0xe0'),require(_0xa4b8('0xe1')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0xe2'),require(_0xa4b8('0xe3')));_0x634493['use'](_0xa4b8('0xe4'),require(_0xa4b8('0xe5')));_0x634493[_0xa4b8('0x8')]('/api/openchannel/reports/transfer',require(_0xa4b8('0xe6')));_0x634493[_0xa4b8('0x8')]('/api/sms/reports/transfer',require('./api/smsTransferReport'));_0x634493[_0xa4b8('0x8')]('/api/cm/lists',require('./api/cmList'));_0x634493['use']('/api/voice/prefixes',require(_0xa4b8('0xe7')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0xe8'),require('./api/userProfile'));_0x634493[_0xa4b8('0x8')](_0xa4b8('0xe9'),require(_0xa4b8('0xea')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0xeb'),require(_0xa4b8('0xec')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0xed'),require(_0xa4b8('0xee')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0xef'),require(_0xa4b8('0xf0')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0xf1'),require(_0xa4b8('0xf2')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0xf3'),require(_0xa4b8('0xf4')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0xf5'),require(_0xa4b8('0xf6')));_0x634493['use'](_0xa4b8('0xf7'),require(_0xa4b8('0xf8')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0xf9'),require(_0xa4b8('0xfa')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0xfb'),require(_0xa4b8('0xfc')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0xfd'),require(_0xa4b8('0xfe')));_0x634493['use'](_0xa4b8('0xff'),require('./api/realtime'));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x100'),require(_0xa4b8('0x101')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x102'),require(_0xa4b8('0x103')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x104'),require(_0xa4b8('0x105')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x106'),require(_0xa4b8('0x107')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x108'),require(_0xa4b8('0x109')));_0x634493[_0xa4b8('0x8')]('/api/system',require(_0xa4b8('0x10a')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x10b'),require(_0xa4b8('0x10c')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x10d'),require(_0xa4b8('0x10e')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x10f'),express[_0xa4b8('0x110')](path['join'](config[_0xa4b8('0x111')],'/apidoc')));_0x634493['use']('/www',express[_0xa4b8('0x110')](path[_0xa4b8('0x112')](config['root'],_0xa4b8('0x113'))));_0x634493['use']('/demo',express['static'](path[_0xa4b8('0x112')](config[_0xa4b8('0x111')],'/demo')));_0x634493[_0xa4b8('0x8')](_0xa4b8('0x114'),express[_0xa4b8('0x110')](path[_0xa4b8('0x112')](config['root'],_0xa4b8('0x115'),_0xa4b8('0x116'))));_0x634493['use'](_0xa4b8('0x117'),express[_0xa4b8('0x110')](path['join'](config[_0xa4b8('0x111')],_0xa4b8('0x118'))));_0x634493['route']('/:url(api|auth|components|app|bower_components|assets)/*')['get'](errors[0x194]);_0x634493[_0xa4b8('0x119')]('/*')[_0xa4b8('0x11a')](function(_0x359998,_0xd87651){_0xd87651[_0xa4b8('0x11b')](path[_0xa4b8('0x11c')](_0x634493[_0xa4b8('0x11a')]('appPath')+_0xa4b8('0x11d')));});};var sensitiveFields=[_0xa4b8('0x11e'),'password',_0xa4b8('0x11f'),'apiKey',_0xa4b8('0x120'),'lastName','street',_0xa4b8('0x121'),_0xa4b8('0x122'),_0xa4b8('0x123'),_0xa4b8('0x124'),_0xa4b8('0x125'),_0xa4b8('0x126'),_0xa4b8('0x127'),_0xa4b8('0x128'),_0xa4b8('0x129'),'tenantId',_0xa4b8('0x12a'),_0xa4b8('0x12b'),_0xa4b8('0x12c'),_0xa4b8('0x12d'),_0xa4b8('0x12e'),'consumerKey',_0xa4b8('0x12f'),_0xa4b8('0x130'),_0xa4b8('0x131'),'calleridnum',_0xa4b8('0x132'),_0xa4b8('0x133'),_0xa4b8('0x134'),_0xa4b8('0x135'),_0xa4b8('0x136'),'secretaccesskey',_0xa4b8('0x137'),_0xa4b8('0x13'),'pass',_0xa4b8('0x138'),_0xa4b8('0x139'),_0xa4b8('0x13a'),_0xa4b8('0x13b'),_0xa4b8('0x13c'),_0xa4b8('0x13d')];function maskSensitiveData(_0x218002){var _0x4bae0f=/(?!^)[\s\S](?!$)/g;if(!_['isPlainObject'](_0x218002))return;for(var _0x49c381 in _0x218002){if(_['isArray'](_0x218002[_0x49c381])){for(var _0x248b30=0x0;_0x248b30<_0x218002[_0x49c381][_0xa4b8('0x13e')];_0x248b30++){maskSensitiveData(_0x218002[_0x49c381][_0x248b30]);}}else if(_[_0xa4b8('0x13f')](_0x218002[_0x49c381])){maskSensitiveData(_0x218002[_0x49c381]);}else if(_['isString'](_0x218002[_0x49c381])){_0x218002[_0x49c381]=_0x218002[_0x49c381][_0xa4b8('0x140')](/{{{/g,_0xa4b8('0x141'))[_0xa4b8('0x140')](/}}}/g,_0xa4b8('0x142'))[_0xa4b8('0x140')](/{{/g,'@{')[_0xa4b8('0x140')](/}}/g,'}@');if(_[_0xa4b8('0x143')](sensitiveFields,_0x49c381)){_0x218002[_0x49c381]=_0x218002[_0x49c381][_0xa4b8('0x140')](_0x4bae0f,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 1f77af7..7f00cdb 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc1dc=['listen','merge','../api/user/user.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','port','rpc','localhost','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','../config/environment'];(function(_0x13f16b,_0x44d2b2){var _0x467e68=function(_0xc3b815){while(--_0xc3b815){_0x13f16b['push'](_0x13f16b['shift']());}};_0x467e68(++_0x44d2b2);}(_0xc1dc,0xcb));var _0xcc1d=function(_0x404caf,_0x33f84e){_0x404caf=_0x404caf-0x0;var _0x48d376=_0xc1dc[_0x404caf];return _0x48d376;};'use strict';var jayson=require(_0xcc1d('0x0'));var BPromise=require(_0xcc1d('0x1'));var _=require(_0xcc1d('0x2'));var config=require(_0xcc1d('0x3'));exports[_0xcc1d('0x4')]=function(){return new BPromise(function(_0x7ab83f,_0x613a23){var _0x1f0a9e={};_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require(_0xcc1d('0x6')));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require('../api/voiceExtension/voiceExtension.rpc'));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require('../api/voiceQueue/voiceQueue.rpc'));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require(_0xcc1d('0x7')));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require(_0xcc1d('0x8')));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require(_0xcc1d('0x9')));_0x1f0a9e=_['merge'](_0x1f0a9e,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require(_0xcc1d('0xa')));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require(_0xcc1d('0xb')));_0x1f0a9e=_['merge'](_0x1f0a9e,require(_0xcc1d('0xc')));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require(_0xcc1d('0xd')));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require(_0xcc1d('0xe')));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require(_0xcc1d('0xf')));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require('../api/mailQueue/mailQueue.rpc'));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require(_0xcc1d('0x10')));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require('../api/mailMessage/mailMessage.rpc'));_0x1f0a9e=_['merge'](_0x1f0a9e,require('../api/mailApplication/mailApplication.rpc'));_0x1f0a9e=_['merge'](_0x1f0a9e,require(_0xcc1d('0x11')));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require(_0xcc1d('0x12')));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require(_0xcc1d('0x13')));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require(_0xcc1d('0x14')));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require(_0xcc1d('0x15')));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require('../api/faxQueue/faxQueue.rpc'));_0x1f0a9e=_['merge'](_0x1f0a9e,require(_0xcc1d('0x16')));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require('../api/smsAccount/smsAccount.rpc'));_0x1f0a9e=_['merge'](_0x1f0a9e,require(_0xcc1d('0x17')));_0x1f0a9e=_['merge'](_0x1f0a9e,require('../api/smsMessage/smsMessage.rpc'));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require('../api/smsQueue/smsQueue.rpc'));_0x1f0a9e=_['merge'](_0x1f0a9e,require(_0xcc1d('0x18')));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require(_0xcc1d('0x19')));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require(_0xcc1d('0x1a')));_0x1f0a9e=_['merge'](_0x1f0a9e,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require(_0xcc1d('0x1b')));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require(_0xcc1d('0x1c')));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require(_0xcc1d('0x1d')));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require(_0xcc1d('0x1e')));_0x1f0a9e=_['merge'](_0x1f0a9e,require(_0xcc1d('0x1f')));_0x1f0a9e=_['merge'](_0x1f0a9e,require('../api/cmHopper/cmHopper.rpc'));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x1f0a9e=_['merge'](_0x1f0a9e,require(_0xcc1d('0x20')));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require(_0xcc1d('0x21')));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require('../api/interval/interval.rpc'));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require(_0xcc1d('0x22')));_0x1f0a9e=_['merge'](_0x1f0a9e,require(_0xcc1d('0x23')));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require('../api/template/template.rpc'));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require('../api/trigger/trigger.rpc'));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require(_0xcc1d('0x24')));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require(_0xcc1d('0x25')));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require(_0xcc1d('0x26')));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require(_0xcc1d('0x27')));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require(_0xcc1d('0x28')));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require(_0xcc1d('0x29')));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require(_0xcc1d('0x2a')));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x1f0a9e=_['merge'](_0x1f0a9e,require(_0xcc1d('0x2b')));_0x1f0a9e=_['merge'](_0x1f0a9e,require(_0xcc1d('0x2c')));_0x1f0a9e=_['merge'](_0x1f0a9e,require(_0xcc1d('0x2d')));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require(_0xcc1d('0x2e')));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require(_0xcc1d('0x2f')));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require(_0xcc1d('0x30')));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require(_0xcc1d('0x31')));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require(_0xcc1d('0x32')));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require(_0xcc1d('0x33')));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require(_0xcc1d('0x34')));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require(_0xcc1d('0x35')));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require(_0xcc1d('0x36')));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require(_0xcc1d('0x37')));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require(_0xcc1d('0x38')));_0x1f0a9e=_[_0xcc1d('0x5')](_0x1f0a9e,require(_0xcc1d('0x39')));_0x1f0a9e=_['merge'](_0x1f0a9e,require(_0xcc1d('0x3a')));var _0x3f785c=jayson[_0xcc1d('0x3b')](_0x1f0a9e)[_0xcc1d('0x3c')]();var _0x545743=config['rpc'][_0xcc1d('0x3d')]||config['port']+0x1;var _0xf58d48=config[_0xcc1d('0x3e')]['ip']||_0xcc1d('0x3f');_0x3f785c['on']('error',function(_0x5e6095){return _0x613a23(_0x5e6095);});_0x3f785c[_0xcc1d('0x4')](_0x545743,_0xf58d48,function(){console[_0xcc1d('0x40')](_0xcc1d('0x41'),_0xf58d48,_0x545743);require(_0xcc1d('0x42'))[_0xcc1d('0x43')]();return _0x7ab83f(_0xcc1d('0x44')+_0xf58d48+':'+_0x545743);});});}; \ No newline at end of file +var _0x24a6=['../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/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','../config/environment','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc'];(function(_0x359782,_0x512f11){var _0x47a806=function(_0x174bee){while(--_0x174bee){_0x359782['push'](_0x359782['shift']());}};_0x47a806(++_0x512f11);}(_0x24a6,0x19b));var _0x624a=function(_0x4e825a,_0x164a63){_0x4e825a=_0x4e825a-0x0;var _0x350d2f=_0x24a6[_0x4e825a];return _0x350d2f;};'use strict';var jayson=require(_0x624a('0x0'));var BPromise=require(_0x624a('0x1'));var _=require('lodash');var config=require(_0x624a('0x2'));exports['listen']=function(){return new BPromise(function(_0x2a1657,_0x499ba5){var _0x35fb32={};_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require(_0x624a('0x4')));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require(_0x624a('0x5')));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require(_0x624a('0x6')));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require(_0x624a('0x7')));_0x35fb32=_['merge'](_0x35fb32,require(_0x624a('0x8')));_0x35fb32=_['merge'](_0x35fb32,require(_0x624a('0x9')));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require(_0x624a('0xa')));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x35fb32=_['merge'](_0x35fb32,require(_0x624a('0xb')));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require(_0x624a('0xc')));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require(_0x624a('0xd')));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require(_0x624a('0xe')));_0x35fb32=_['merge'](_0x35fb32,require(_0x624a('0xf')));_0x35fb32=_['merge'](_0x35fb32,require(_0x624a('0x10')));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require(_0x624a('0x11')));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require(_0x624a('0x12')));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require('../api/mailMessage/mailMessage.rpc'));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require('../api/mailApplication/mailApplication.rpc'));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require(_0x624a('0x13')));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require(_0x624a('0x14')));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require(_0x624a('0x15')));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require(_0x624a('0x16')));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require(_0x624a('0x17')));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require('../api/faxQueue/faxQueue.rpc'));_0x35fb32=_['merge'](_0x35fb32,require(_0x624a('0x18')));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require(_0x624a('0x19')));_0x35fb32=_['merge'](_0x35fb32,require(_0x624a('0x1a')));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require(_0x624a('0x1b')));_0x35fb32=_['merge'](_0x35fb32,require(_0x624a('0x1c')));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require(_0x624a('0x1d')));_0x35fb32=_['merge'](_0x35fb32,require(_0x624a('0x1e')));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require(_0x624a('0x1f')));_0x35fb32=_['merge'](_0x35fb32,require(_0x624a('0x20')));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require(_0x624a('0x21')));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require('../api/chatInteraction/chatInteraction.rpc'));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require(_0x624a('0x22')));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require(_0x624a('0x23')));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require(_0x624a('0x24')));_0x35fb32=_['merge'](_0x35fb32,require('../api/cmHopper/cmHopper.rpc'));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x35fb32=_['merge'](_0x35fb32,require(_0x624a('0x25')));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require(_0x624a('0x26')));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x35fb32=_['merge'](_0x35fb32,require('../api/interval/interval.rpc'));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require(_0x624a('0x27')));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require(_0x624a('0x28')));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require(_0x624a('0x29')));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require(_0x624a('0x2a')));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require(_0x624a('0x2b')));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require(_0x624a('0x2c')));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require(_0x624a('0x2d')));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require(_0x624a('0x2e')));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require(_0x624a('0x2f')));_0x35fb32=_['merge'](_0x35fb32,require(_0x624a('0x30')));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require(_0x624a('0x31')));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require(_0x624a('0x32')));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require(_0x624a('0x33')));_0x35fb32=_['merge'](_0x35fb32,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require(_0x624a('0x34')));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require('../api/squareReport/squareReport.rpc'));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require(_0x624a('0x35')));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require('../api/setting/setting.rpc'));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require(_0x624a('0x36')));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require(_0x624a('0x37')));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require(_0x624a('0x38')));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require('../api/squareMessage/squareMessage.rpc'));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require('../api/campaign/campaign.rpc'));_0x35fb32=_['merge'](_0x35fb32,require(_0x624a('0x39')));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require('../api/plugin/plugin.rpc'));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require(_0x624a('0x3a')));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require(_0x624a('0x3b')));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require(_0x624a('0x3c')));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x35fb32=_[_0x624a('0x3')](_0x35fb32,require(_0x624a('0x3d')));var _0x843847=jayson[_0x624a('0x3e')](_0x35fb32)[_0x624a('0x3f')]();var _0xd1f00a=config[_0x624a('0x40')][_0x624a('0x41')]||config[_0x624a('0x41')]+0x1;var _0x41f72c=config[_0x624a('0x40')]['ip']||'localhost';_0x843847['on']('error',function(_0x2c2df4){return _0x499ba5(_0x2c2df4);});_0x843847[_0x624a('0x42')](_0xd1f00a,_0x41f72c,function(){console[_0x624a('0x43')](_0x624a('0x44'),_0x41f72c,_0xd1f00a);require(_0x624a('0x45'))[_0x624a('0x46')]();return _0x2a1657(_0x624a('0x47')+_0x41f72c+':'+_0xd1f00a);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index d97dcd0..8f110e3 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 _0xb334=['setTimeout','line','toLowerCase','hangup','emit','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','destroy','pipe','command','write','inherits','sendRequest','sync','answer','prototype','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','format','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','setPriority','HANGUP','setVariable','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','sayDigits','continueAt','extension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','exec','AGI','wait','WAIT','noop','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','util','lodash','events','./error','utf8'];(function(_0x64e58d,_0x3971c0){var _0x248f08=function(_0x2944dd){while(--_0x2944dd){_0x64e58d['push'](_0x64e58d['shift']());}};_0x248f08(++_0x3971c0);}(_0xb334,0x1bd));var _0x4b33=function(_0x1bc1b5,_0x1d82f5){_0x1bc1b5=_0x1bc1b5-0x0;var _0x2bb219=_0xb334[_0x1bc1b5];return _0x2bb219;};'use strict';var util=require(_0x4b33('0x0'));var _=require(_0x4b33('0x1'));var EventEmitter=require(_0x4b33('0x2'))['EventEmitter'];var AGIReply=require('./reply');var AGIError=require(_0x4b33('0x3'));function AGIChannel(_0x3432ff){var _0x38a00e=this,_0x22407b=new AGIReply(),_0x183e61=![],_0x56db5e={};EventEmitter['call'](_0x38a00e);_0x3432ff['setEncoding'](_0x4b33('0x4'));_0x3432ff[_0x4b33('0x5')](0x8*0x3c*0x3c*0x3e8);_0x22407b['setEncoding'](_0x4b33('0x4'));_0x22407b['on']('headers',function(_0x587846){for(var _0x4fd8b3 in _0x587846){_0x38a00e[_0x4fd8b3]=_0x587846[_0x4fd8b3];}_0x38a00e['emit']('ready');});_0x22407b['on'](_0x4b33('0x6'),function(_0x12522f){if(_0x12522f[_0x4b33('0x7')]()==_0x4b33('0x8')){_0x38a00e[_0x4b33('0x9')](_0x4b33('0x8'));return;}if(_0x12522f[_0x4b33('0xa')](0x0,0xb)==_0x4b33('0xb')){_0x183e61=!![];}if(_0x183e61){_0x56db5e['rx']+=_0x12522f+'\x0a';if(_0x12522f[_0x4b33('0xc')](_0x4b33('0xd'))!=-0x1){_0x183e61=![];}}else{_0x56db5e['rx']=_0x12522f;}if(_0x183e61){return;}if(typeof _0x56db5e['cb']==_0x4b33('0xe')){var _0x4495f4=_0x56db5e['rx'][_0x4b33('0xa')](0x0,0x3),_0x260fe2=null,_0x1746a8=null;_0x4495f4=parseInt(_0x4495f4);if(isNaN(_0x4495f4)){_0x56db5e['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x4b33('0xf')});return;}if(_0x4495f4!=0xc8){_0x56db5e['cb'](null,{'code':_0x4495f4,'result':-0x1,'extra':'KO'});return;}_0x260fe2=_0x56db5e['rx'][_0x4b33('0xa')](0x4)[_0x4b33('0x10')](_0x4b33('0x11'),'');if(_0x260fe2['indexOf']('\x20')!=-0x1){_0x260fe2=_0x260fe2[_0x4b33('0x12')](0x0,_0x260fe2['indexOf']('\x20'));}if(_[_0x4b33('0x13')](_0x260fe2,'-1')){_0x260fe2=parseInt(_0x260fe2);}_0x1746a8=_0x56db5e['rx'][_0x4b33('0x14')]('\x20');if(_0x1746a8['length']==0x3){_0x1746a8=_0x1746a8[0x2][_0x4b33('0xa')](0x1,_0x1746a8[0x2]['length']-0x1);}else if(_0x1746a8[_0x4b33('0x15')]>0x3){var _0x16fa36=/\((.+)\)/;var _0x16836d=_0x56db5e['rx'][_0x4b33('0x16')](_0x16fa36);if(_0x16836d){_0x1746a8=_0x16836d[0x1];}else{_0x1746a8=null;}}else{_0x1746a8=null;}_0x56db5e['cb'](null,{'code':_0x4495f4,'result':_0x260fe2,'extra':_0x1746a8});}});_0x3432ff['on']('error',function(_0xb76ea7){_0x38a00e[_0x4b33('0x9')](_0x4b33('0x17'),new AGIError(_0x4b33('0x18'),_0xb76ea7[_0x4b33('0x19')]));});_0x3432ff['on'](_0x4b33('0x1a'),function(){_0x38a00e[_0x4b33('0x9')](_0x4b33('0x1a'),new AGIError(_0x4b33('0x1b')));});_0x3432ff['on'](_0x4b33('0x1c'),function(){_0x38a00e[_0x4b33('0x9')](_0x4b33('0x1c'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x3432ff[_0x4b33('0x1d')]();});_0x3432ff[_0x4b33('0x1e')](_0x22407b);this[_0x4b33('0x1f')]=function(_0x28d534,_0x2fdc60){var _0x28d534=_0x28d534||'',_0x2fdc60=typeof _0x2fdc60==_0x4b33('0xe')?_0x2fdc60:new Function();_0x56db5e={'tx':_0x28d534,'rx':'','cb':_0x2fdc60};_0x3432ff[_0x4b33('0x20')](_0x28d534+'\x0a');},this[_0x4b33('0x1a')]=function(){_0x3432ff[_0x4b33('0x1d')]();};}util[_0x4b33('0x21')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x4b33('0x22')]=function(_0x3416a8){return this[_0x4b33('0x1f')][_0x4b33('0x23')](this,_0x3416a8);};AGIChannel['prototype'][_0x4b33('0x24')]=function(){return this[_0x4b33('0x22')]('ANSWER');};AGIChannel[_0x4b33('0x25')]['getData']=function(_0x42db96,_0x58d5eb,_0x422e40){_0x42db96=_0x42db96===undefined?_0x4b33('0x26'):_0x42db96;_0x58d5eb=_0x58d5eb===undefined?'5':_0x58d5eb;_0x422e40=_0x422e40===undefined?'1':_0x422e40;return this[_0x4b33('0x22')](util['format'](_0x4b33('0x27'),_0x42db96,_0x58d5eb*0x3e8,_0x422e40));};AGIChannel[_0x4b33('0x25')]['noop']=function(_0x322df8){_0x322df8=_0x322df8||_0x4b33('0x28');return this[_0x4b33('0x22')](util[_0x4b33('0x29')]('VERBOSE\x20\x22%s\x22',_0x322df8));};AGIChannel['prototype']['exec']=function(_0x16793d,_0x4733f7){if(_[_0x4b33('0x2a')](_0x4733f7)){return this[_0x4b33('0x22')](util[_0x4b33('0x29')](_0x4b33('0x2b'),_0x16793d,_0x4733f7[_0x4b33('0x2c')](',')));}return this[_0x4b33('0x22')](util[_0x4b33('0x29')](_0x4b33('0x2b'),_0x16793d,_0x4733f7));};AGIChannel[_0x4b33('0x25')][_0x4b33('0x2d')]=function(_0x18e843){return this[_0x4b33('0x22')](util[_0x4b33('0x29')](_0x4b33('0x2e'),_0x18e843));};AGIChannel[_0x4b33('0x25')][_0x4b33('0x2f')]=function(_0x45ed78){return this[_0x4b33('0x22')](util[_0x4b33('0x29')]('SET\x20EXTENSION\x20%s',_0x45ed78));};AGIChannel[_0x4b33('0x25')][_0x4b33('0x30')]=function(_0x138564){return this[_0x4b33('0x22')](util[_0x4b33('0x29')]('SET\x20PRIORITY\x20%s',_0x138564));};AGIChannel[_0x4b33('0x25')]['hangup']=function(){return this[_0x4b33('0x22')](_0x4b33('0x31'));};AGIChannel[_0x4b33('0x25')][_0x4b33('0x32')]=function(_0x505d66,_0x158d12){var _0x48d40d=_['isBoolean'](_0x158d12)||_[_0x4b33('0x33')](_0x158d12)?_0x158d12[_0x4b33('0x34')]():_0x158d12;return this[_0x4b33('0x22')](util[_0x4b33('0x29')](_0x4b33('0x35'),_0x505d66,_0x48d40d?_0x48d40d[_0x4b33('0x34')]()[_0x4b33('0x10')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x4b33('0x25')][_0x4b33('0x36')]=function(_0x160daf,_0x16c809){return this[_0x4b33('0x22')](util[_0x4b33('0x29')]('SAY\x20NUMBER\x20%s\x20%s',_0x160daf,_0x16c809));};AGIChannel[_0x4b33('0x25')][_0x4b33('0x37')]=function(_0x539d49,_0x1dd7c9){return this[_0x4b33('0x22')](util[_0x4b33('0x29')]('SAY\x20DIGITS\x20%s\x20%s',_0x539d49,_0x1dd7c9));};AGIChannel[_0x4b33('0x25')]['sayPhonetic']=function(_0x177344,_0xe16f69){return this[_0x4b33('0x22')](util[_0x4b33('0x29')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x177344,_0xe16f69));};AGIChannel['prototype'][_0x4b33('0x38')]=function(_0x34622b,_0x20d4dd,_0x40baed){_0x20d4dd=_0x20d4dd||this[_0x4b33('0x39')];_0x40baed=_0x40baed||0x1;this[_0x4b33('0x2d')](_0x34622b);this[_0x4b33('0x2f')](_0x20d4dd);this['setPriority'](_0x40baed);return this['noop'](util[_0x4b33('0x29')](_0x4b33('0x3a'),_0x34622b,_0x20d4dd,_0x40baed));};AGIChannel[_0x4b33('0x25')][_0x4b33('0x3b')]=function(_0x5ea0cc){return this[_0x4b33('0x22')](util['format'](_0x4b33('0x3c'),_0x5ea0cc));};AGIChannel['prototype'][_0x4b33('0x3d')]=function(_0x16c108,_0x4da649,_0x3b9d64,_0x466ce4,_0x36d85e,_0x343194){_0x4da649=_0x4da649||_0x4b33('0x3e');_0x3b9d64=_0x3b9d64||'';_0x466ce4=_0x466ce4===undefined?-0x1:_0x466ce4==='-1'?-0x1:_0x466ce4*0x3e8;_0x36d85e=_0x36d85e===undefined?'':'s='+_0x36d85e;_0x343194=_0x343194?_0x4b33('0x3f'):'';return this['sendRequest'](util[_0x4b33('0x29')](_0x4b33('0x40'),_0x16c108,_0x4da649,_0x3b9d64,_0x466ce4,_0x343194,_0x36d85e));};AGIChannel[_0x4b33('0x25')][_0x4b33('0x41')]=function(_0x1c0376,_0x121ced){_0x121ced=_0x121ced||'';return this[_0x4b33('0x22')](util[_0x4b33('0x29')](_0x4b33('0x42'),_0x1c0376,_0x121ced));};AGIChannel['prototype'][_0x4b33('0x43')]=function(_0x2426c2){return this[_0x4b33('0x44')](_0x4b33('0x45'),_0x2426c2);};AGIChannel[_0x4b33('0x25')][_0x4b33('0x46')]=function(_0x4485fc){return this[_0x4b33('0x44')](_0x4b33('0x47'),_0x4485fc);};AGIChannel[_0x4b33('0x25')][_0x4b33('0x17')]=function(_0x3e985c,_0x2c3176){this[_0x4b33('0x48')](util[_0x4b33('0x29')](_0x4b33('0x49'),_0x3e985c['id'],_0x3e985c[_0x4b33('0x4a')],_0x2c3176));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0xdb28=['isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setContext','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','streamFile','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','util','lodash','events','EventEmitter','./error','call','setEncoding','utf8','headers','emit','ready','toLowerCase','hangup','substring','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','substr','startsWith','split','length','match','error','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','write','inherits','sync','prototype','answer','sendRequest','ANSWER','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','join','EXEC\x20%s\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','HANGUP'];(function(_0x17a50b,_0x14fdd8){var _0xb4b92d=function(_0x3e177e){while(--_0x3e177e){_0x17a50b['push'](_0x17a50b['shift']());}};_0xb4b92d(++_0x14fdd8);}(_0xdb28,0x106));var _0x8db2=function(_0x4181ba,_0x43858e){_0x4181ba=_0x4181ba-0x0;var _0x1aca1b=_0xdb28[_0x4181ba];return _0x1aca1b;};'use strict';var util=require(_0x8db2('0x0'));var _=require(_0x8db2('0x1'));var EventEmitter=require(_0x8db2('0x2'))[_0x8db2('0x3')];var AGIReply=require('./reply');var AGIError=require(_0x8db2('0x4'));function AGIChannel(_0x11c26d){var _0xfcf49f=this,_0x4426fe=new AGIReply(),_0x11109e=![],_0x52bf99={};EventEmitter[_0x8db2('0x5')](_0xfcf49f);_0x11c26d[_0x8db2('0x6')]('utf8');_0x11c26d['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x4426fe[_0x8db2('0x6')](_0x8db2('0x7'));_0x4426fe['on'](_0x8db2('0x8'),function(_0x29f698){for(var _0x2f3f2f in _0x29f698){_0xfcf49f[_0x2f3f2f]=_0x29f698[_0x2f3f2f];}_0xfcf49f[_0x8db2('0x9')](_0x8db2('0xa'));});_0x4426fe['on']('line',function(_0x30dc90){if(_0x30dc90[_0x8db2('0xb')]()==_0x8db2('0xc')){_0xfcf49f['emit'](_0x8db2('0xc'));return;}if(_0x30dc90[_0x8db2('0xd')](0x0,0xb)=='520-Invalid'){_0x11109e=!![];}if(_0x11109e){_0x52bf99['rx']+=_0x30dc90+'\x0a';if(_0x30dc90[_0x8db2('0xe')](_0x8db2('0xf'))!=-0x1){_0x11109e=![];}}else{_0x52bf99['rx']=_0x30dc90;}if(_0x11109e){return;}if(typeof _0x52bf99['cb']==_0x8db2('0x10')){var _0x204f49=_0x52bf99['rx']['substring'](0x0,0x3),_0x37d017=null,_0x559fb1=null;_0x204f49=parseInt(_0x204f49);if(isNaN(_0x204f49)){_0x52bf99['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x8db2('0x11')});return;}if(_0x204f49!=0xc8){_0x52bf99['cb'](null,{'code':_0x204f49,'result':-0x1,'extra':'KO'});return;}_0x37d017=_0x52bf99['rx'][_0x8db2('0xd')](0x4)[_0x8db2('0x12')](_0x8db2('0x13'),'');if(_0x37d017[_0x8db2('0x14')]('\x20')!=-0x1){_0x37d017=_0x37d017[_0x8db2('0x15')](0x0,_0x37d017[_0x8db2('0x14')]('\x20'));}if(_[_0x8db2('0x16')](_0x37d017,'-1')){_0x37d017=parseInt(_0x37d017);}_0x559fb1=_0x52bf99['rx'][_0x8db2('0x17')]('\x20');if(_0x559fb1[_0x8db2('0x18')]==0x3){_0x559fb1=_0x559fb1[0x2]['substring'](0x1,_0x559fb1[0x2][_0x8db2('0x18')]-0x1);}else if(_0x559fb1[_0x8db2('0x18')]>0x3){var _0x48101e=/\((.+)\)/;var _0x2b3f73=_0x52bf99['rx'][_0x8db2('0x19')](_0x48101e);if(_0x2b3f73){_0x559fb1=_0x2b3f73[0x1];}else{_0x559fb1=null;}}else{_0x559fb1=null;}_0x52bf99['cb'](null,{'code':_0x204f49,'result':_0x37d017,'extra':_0x559fb1});}});_0x11c26d['on'](_0x8db2('0x1a'),function(_0x3fddc2){_0xfcf49f[_0x8db2('0x9')](_0x8db2('0x1a'),new AGIError('E_AGI_SOCKET_ERROR',_0x3fddc2['code']));});_0x11c26d['on'](_0x8db2('0x1b'),function(){_0xfcf49f[_0x8db2('0x9')](_0x8db2('0x1b'),new AGIError(_0x8db2('0x1c')));});_0x11c26d['on']('timeout',function(){_0xfcf49f[_0x8db2('0x9')](_0x8db2('0x1d'),new AGIError(_0x8db2('0x1e')));_0x11c26d[_0x8db2('0x1f')]();});_0x11c26d[_0x8db2('0x20')](_0x4426fe);this['command']=function(_0x124467,_0x3e30e6){var _0x124467=_0x124467||'',_0x3e30e6=typeof _0x3e30e6==_0x8db2('0x10')?_0x3e30e6:new Function();_0x52bf99={'tx':_0x124467,'rx':'','cb':_0x3e30e6};_0x11c26d[_0x8db2('0x21')](_0x124467+'\x0a');},this[_0x8db2('0x1b')]=function(){_0x11c26d['destroy']();};}util[_0x8db2('0x22')](AGIChannel,EventEmitter);AGIChannel['prototype']['sendRequest']=function(_0x52a9ca){return this['command'][_0x8db2('0x23')](this,_0x52a9ca);};AGIChannel[_0x8db2('0x24')][_0x8db2('0x25')]=function(){return this[_0x8db2('0x26')](_0x8db2('0x27'));};AGIChannel[_0x8db2('0x24')]['getData']=function(_0x3544ba,_0x372311,_0x430dd5){_0x3544ba=_0x3544ba===undefined?_0x8db2('0x28'):_0x3544ba;_0x372311=_0x372311===undefined?'5':_0x372311;_0x430dd5=_0x430dd5===undefined?'1':_0x430dd5;return this['sendRequest'](util[_0x8db2('0x29')](_0x8db2('0x2a'),_0x3544ba,_0x372311*0x3e8,_0x430dd5));};AGIChannel[_0x8db2('0x24')][_0x8db2('0x2b')]=function(_0xbe5ece){_0xbe5ece=_0xbe5ece||_0x8db2('0x2c');return this[_0x8db2('0x26')](util[_0x8db2('0x29')](_0x8db2('0x2d'),_0xbe5ece));};AGIChannel['prototype'][_0x8db2('0x2e')]=function(_0x50b28d,_0x59cb77){if(_[_0x8db2('0x2f')](_0x59cb77)){return this[_0x8db2('0x26')](util[_0x8db2('0x29')]('EXEC\x20%s\x20%s',_0x50b28d,_0x59cb77[_0x8db2('0x30')](',')));}return this['sendRequest'](util[_0x8db2('0x29')](_0x8db2('0x31'),_0x50b28d,_0x59cb77));};AGIChannel[_0x8db2('0x24')]['setContext']=function(_0x56e9c1){return this[_0x8db2('0x26')](util[_0x8db2('0x29')]('SET\x20CONTEXT\x20%s',_0x56e9c1));};AGIChannel['prototype'][_0x8db2('0x32')]=function(_0x5178f3){return this[_0x8db2('0x26')](util[_0x8db2('0x29')](_0x8db2('0x33'),_0x5178f3));};AGIChannel[_0x8db2('0x24')][_0x8db2('0x34')]=function(_0xae31b7){return this[_0x8db2('0x26')](util[_0x8db2('0x29')]('SET\x20PRIORITY\x20%s',_0xae31b7));};AGIChannel[_0x8db2('0x24')][_0x8db2('0xc')]=function(){return this['sendRequest'](_0x8db2('0x35'));};AGIChannel[_0x8db2('0x24')]['setVariable']=function(_0x4bf222,_0x3c1983){var _0x4a45dd=_[_0x8db2('0x36')](_0x3c1983)||_[_0x8db2('0x37')](_0x3c1983)?_0x3c1983[_0x8db2('0x38')]():_0x3c1983;return this[_0x8db2('0x26')](util['format'](_0x8db2('0x39'),_0x4bf222,_0x4a45dd?_0x4a45dd['toString']()[_0x8db2('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x8db2('0x24')][_0x8db2('0x3a')]=function(_0x4599c3,_0x50e88a){return this['sendRequest'](util[_0x8db2('0x29')](_0x8db2('0x3b'),_0x4599c3,_0x50e88a));};AGIChannel['prototype'][_0x8db2('0x3c')]=function(_0x24bcfe,_0x656dd2){return this['sendRequest'](util[_0x8db2('0x29')](_0x8db2('0x3d'),_0x24bcfe,_0x656dd2));};AGIChannel[_0x8db2('0x24')][_0x8db2('0x3e')]=function(_0x2e6f0c,_0x40d82a){return this[_0x8db2('0x26')](util[_0x8db2('0x29')](_0x8db2('0x3f'),_0x2e6f0c,_0x40d82a));};AGIChannel[_0x8db2('0x24')][_0x8db2('0x40')]=function(_0x20bf0b,_0x1d9025,_0x4a1c60){_0x1d9025=_0x1d9025||this[_0x8db2('0x41')];_0x4a1c60=_0x4a1c60||0x1;this[_0x8db2('0x42')](_0x20bf0b);this['setExtension'](_0x1d9025);this['setPriority'](_0x4a1c60);return this[_0x8db2('0x2b')](util['format'](_0x8db2('0x43'),_0x20bf0b,_0x1d9025,_0x4a1c60));};AGIChannel[_0x8db2('0x24')][_0x8db2('0x44')]=function(_0x307783){return this[_0x8db2('0x26')](util[_0x8db2('0x29')](_0x8db2('0x45'),_0x307783));};AGIChannel['prototype'][_0x8db2('0x46')]=function(_0x3d44de,_0x40c69e,_0x4a0b56,_0x482b26,_0x424c27,_0x1f4a82){_0x40c69e=_0x40c69e||_0x8db2('0x47');_0x4a0b56=_0x4a0b56||'';_0x482b26=_0x482b26===undefined?-0x1:_0x482b26==='-1'?-0x1:_0x482b26*0x3e8;_0x424c27=_0x424c27===undefined?'':'s='+_0x424c27;_0x1f4a82=_0x1f4a82?_0x8db2('0x48'):'';return this['sendRequest'](util[_0x8db2('0x29')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x3d44de,_0x40c69e,_0x4a0b56,_0x482b26,_0x1f4a82,_0x424c27));};AGIChannel[_0x8db2('0x24')][_0x8db2('0x49')]=function(_0x4c8812,_0x4d2164){_0x4d2164=_0x4d2164||'';return this['sendRequest'](util[_0x8db2('0x29')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x4c8812,_0x4d2164));};AGIChannel[_0x8db2('0x24')][_0x8db2('0x4a')]=function(_0x27b8eb){return this[_0x8db2('0x2e')](_0x8db2('0x4b'),_0x27b8eb);};AGIChannel[_0x8db2('0x24')][_0x8db2('0x4c')]=function(_0xab6bdd){return this[_0x8db2('0x2e')](_0x8db2('0x4d'),_0xab6bdd);};AGIChannel[_0x8db2('0x24')][_0x8db2('0x1a')]=function(_0x532180,_0x449109){this[_0x8db2('0x2b')](util[_0x8db2('0x29')](_0x8db2('0x4e'),_0x532180['id'],_0x532180['label'],_0x449109));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 5bba76f..99fbec1 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 _0xd29f=['Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push','format','message','name','exports','Undefined\x20error.'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xd29f,0x1df));var _0xfd29=function(_0x88249c,_0x24124e){_0x88249c=_0x88249c-0x0;var _0x951993=_0xd29f[_0x88249c];return _0x951993;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0xfd29('0x0'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0xfd29('0x1'),'E_AGI_SERVER_CLOSE':_0xfd29('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0xfd29('0x3'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0xfd29('0x4'),'E_AGI_SOCKET_CLOSE':_0xfd29('0x5'),'E_AGI_SOCKET_TIMEOUT':_0xfd29('0x6'),'E_AGI_COMMAND_EMPTY':_0xfd29('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xfd29('0x8'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x1fe610){var _0x1fe610=_0x1fe610||null,_0x1e4664=_0x1e4664||[],_0x5b07b0=0x1,_0x11e523='';if(!error[_0x1fe610]){_0x1fe610=_0xfd29('0x9');}_0x1e4664[_0xfd29('0xa')](error[_0x1fe610]);while(arguments[_0x5b07b0]){_0x1e4664[_0xfd29('0xa')](arguments[_0x5b07b0]);_0x5b07b0++;}_0x11e523=util[_0xfd29('0xb')]['apply'](util,_0x1e4664);this[_0xfd29('0xc')]=_0x11e523;this[_0xfd29('0xd')]=_0x1fe610;}module[_0xfd29('0xe')]=AGIError; \ No newline at end of file +var _0x3d20=['Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','name','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.'];(function(_0x505a49,_0x1be8cd){var _0x5d7378=function(_0x50b3cc){while(--_0x50b3cc){_0x505a49['push'](_0x505a49['shift']());}};_0x5d7378(++_0x1be8cd);}(_0x3d20,0x1dc));var _0x03d2=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0x3d20[_0x3de8a4];return _0x4635cf;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x03d2('0x0'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x03d2('0x1'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x03d2('0x2'),'E_AGI_SOCKET_ERROR':_0x03d2('0x3'),'E_AGI_SOCKET_CLOSE':_0x03d2('0x4'),'E_AGI_SOCKET_TIMEOUT':_0x03d2('0x5'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x03d2('0x6'),'E_AGI_IVR_ENTRY':_0x03d2('0x7')};function AGIError(_0x2b0ee1){var _0x2b0ee1=_0x2b0ee1||null,_0x42e050=_0x42e050||[],_0x43925c=0x1,_0x25c345='';if(!error[_0x2b0ee1]){_0x2b0ee1='E_AGI_UNDEFINED';}_0x42e050[_0x03d2('0x8')](error[_0x2b0ee1]);while(arguments[_0x43925c]){_0x42e050[_0x03d2('0x8')](arguments[_0x43925c]);_0x43925c++;}_0x25c345=util['format']['apply'](util,_0x42e050);this['message']=_0x25c345;this[_0x03d2('0x9')]=_0x2b0ee1;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index f5652ff..067e18b 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 _0x85ae=['vertices','edges','numberOfEdges','prototype','addVertex','addEdge','push','size','relations','getVertex','traverseBFS','no\x20vertex\x20found','info','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','agicommand','vswitch','default','target','invalid','default\x20on\x20switch\x20not\x20found','includes','condition\x20not\x20found','../../../config/logger','menu','getdigits','getsecretdigits'];(function(_0x2739a2,_0x3616f8){var _0x2af281=function(_0x53e350){while(--_0x53e350){_0x2739a2['push'](_0x2739a2['shift']());}};_0x2af281(++_0x3616f8);}(_0x85ae,0xb0));var _0xe85a=function(_0x4a5219,_0xce467c){_0x4a5219=_0x4a5219-0x0;var _0x63937d=_0x85ae[_0x4a5219];return _0x63937d;};'use strict';var _=require('lodash');var logger=require(_0xe85a('0x0'))('agi');var verticesWithRetry=[_0xe85a('0x1'),_0xe85a('0x2'),_0xe85a('0x3')];var Graph=function(){this[_0xe85a('0x4')]={};this[_0xe85a('0x5')]={};this[_0xe85a('0x6')]=0x0;};Graph[_0xe85a('0x7')][_0xe85a('0x8')]=function(_0x4275f0){this[_0xe85a('0x4')][_0x4275f0['id']]=_0x4275f0;this['edges'][_0x4275f0['id']]=[];};Graph[_0xe85a('0x7')][_0xe85a('0x9')]=function(_0x2e1452,_0x4829e3,_0x109f62){this[_0xe85a('0x5')][_0x2e1452][_0xe85a('0xa')]({'target':_0x4829e3,'condition':_0x109f62});this[_0xe85a('0x6')]+=0x1;};Graph[_0xe85a('0x7')][_0xe85a('0xb')]=function(){return _[_0xe85a('0xb')](this[_0xe85a('0x4')]);};Graph[_0xe85a('0x7')][_0xe85a('0xc')]=function(){return this[_0xe85a('0x6')];};Graph['prototype'][_0xe85a('0xd')]=function(_0x3c9dfe){return this[_0xe85a('0x4')][_0x3c9dfe];};Graph[_0xe85a('0x7')][_0xe85a('0xe')]=function(_0x3f4e9c,_0x102a7b){if(!this[_0xe85a('0x4')][_0x3f4e9c]){return logger['info'](_0xe85a('0xf'));}var _0x1069f6=_0x102a7b(this[_0xe85a('0x4')][_0x3f4e9c]);if(!_0x1069f6){return logger[_0xe85a('0x10')](_0xe85a('0x11'));}if(this[_0xe85a('0x5')][_0x3f4e9c][_0xe85a('0x12')]===0x0){return logger['info'](_0xe85a('0x13'));}for(var _0x2c1ad7=0x0,_0x2c085e=[],_0xb8f683=![];_0x2c1ad7\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','gotoc','context','extension','priority','code','result','response','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','clear','vertex','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','Project\x20%s\x20not\x20published','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]','./server','listening','connection','lodash','syncho','util','moment','../../config/environment','../../config/logger','agi','./rpc','./graph','./vertices','127.0.0.1','error','stack','log','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','isArray','length','target','addEdge','getSquareProject','then','createSquareReport','catch','indexOf','substring','inspect','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','close','evtHangup','hangup','production','start','joinAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x259216,_0x2f20d6){var _0x1250de=function(_0x24d86b){while(--_0x24d86b){_0x259216['push'](_0x259216['shift']());}};_0x1250de(++_0x2f20d6);}(_0x21a9,0xc8));var _0x921a=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x21a9[_0x4a9fb1];return _0x348672;};'use strict';var parser=require('xml2json');var _=require(_0x921a('0x0'));var syncho=require(_0x921a('0x1'));var util=require(_0x921a('0x2'));var moment=require(_0x921a('0x3'));var config=require(_0x921a('0x4'));var logger=require(_0x921a('0x5'))(_0x921a('0x6'));var utilLicense=require('../../config/license/util');var rpc=require(_0x921a('0x7'));var mailRpc=require('./mailRpc');var Graph=require(_0x921a('0x8'));var Vertices=require(_0x921a('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x921a('0x6')]=_['defaults'](config[_0x921a('0x6')],{'ip':_0x921a('0xa'),'port':0x11dd});function connectionHandler(_0x1e4362){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x1e4362);agiHandler(_0x1e4362);}catch(_0x5cc9bf){logger[_0x921a('0xb')](_0x5cc9bf[_0x921a('0xc')]);}});});}function listeningHandler(){console[_0x921a('0xd')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x921a('0x6')][_0x921a('0xe')]);logger[_0x921a('0xf')](util[_0x921a('0x10')](_0x921a('0x11'),config[_0x921a('0x6')]['ip'],config[_0x921a('0x6')][_0x921a('0xe')]));}function errorHandler(_0x451642){if(_0x451642&&_0x451642[_0x921a('0x12')]&&_0x451642[_0x921a('0x13')]){logger['error'](util[_0x921a('0x10')]('[%s]\x20%s',_0x451642[_0x921a('0x12')],_0x451642[_0x921a('0x13')]));}else{logger[_0x921a('0xb')](util[_0x921a('0x10')]('[ERROR]\x20%s',_0x451642[_0x921a('0xc')]));}}function closeHandler(){logger[_0x921a('0xf')](util[_0x921a('0x10')](_0x921a('0x14'),this[_0x921a('0x15')],this['calleridname'],this[_0x921a('0x16')],this['dnid'],this[_0x921a('0x17')]));try{createSquareReport(this);}catch(_0x2b112f){logger[_0x921a('0xb')](_0x2b112f['stack']);}}function timeoutHandler(){logger[_0x921a('0xf')](util[_0x921a('0x10')](_0x921a('0x18'),this[_0x921a('0x15')],this['calleridname'],this[_0x921a('0x16')],this[_0x921a('0x19')],this['uniqueid']));}function hangupHandler(){logger[_0x921a('0xf')](util[_0x921a('0x10')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x921a('0x15')],this['calleridname'],this[_0x921a('0x16')],this['dnid'],this['uniqueid']));this['evtHangup']=!![];}function getRoot(_0x2d0fd4){return parser[_0x921a('0x1a')](_0x2d0fd4,{'object':!![]})[_0x921a('0x1b')][_0x921a('0x1c')];}function addVertex(_0x374af2,_0x8bd0c1,_0x55e187){_0x8bd0c1[_0x921a('0x1d')]=_0x55e187;if(_0x8bd0c1[_0x921a('0x1e')](_0x921a('0x1f'))){_0x8bd0c1[_0x921a('0x20')]=parseInt(_0x8bd0c1[_0x921a('0x1f')],0xa);}_0x374af2[_0x921a('0x21')](_[_0x921a('0x22')](_0x8bd0c1,'mxCell'));}function initGraph(_0x51702a,_0x4b7a9e){var _0x2792b5=new Graph();for(var _0x2f6b34 in _0x51702a){if(_0x51702a[_0x921a('0x1e')](_0x2f6b34)){if(_[_0x921a('0x23')](_0x51702a[_0x2f6b34])){for(var _0x326e5c=0x0;_0x326e5c<_0x51702a[_0x2f6b34][_0x921a('0x24')];_0x326e5c+=0x1){addVertex(_0x2792b5,_0x51702a[_0x2f6b34][_0x326e5c],_0x2f6b34);}}else{addVertex(_0x2792b5,_0x51702a[_0x2f6b34],_0x2f6b34);}}}for(var _0x186e1b=0x0;_0x186e1b<_0x4b7a9e[_0x921a('0x24')];_0x186e1b+=0x1){if(_0x4b7a9e[_0x186e1b]['source']&&_0x4b7a9e[_0x186e1b][_0x921a('0x25')]){_0x2792b5[_0x921a('0x26')](_0x4b7a9e[_0x186e1b]['source'],_0x4b7a9e[_0x186e1b][_0x921a('0x25')],_0x4b7a9e[_0x186e1b]['value']);}}return _0x2792b5;}function getSquareProject(_0x593932,_0x5825db){rpc[_0x921a('0x27')](_0x593932)[_0x921a('0x28')](function(_0x3147ef){_0x5825db(null,_0x3147ef);})['catch'](function(_0x21a38c){_0x5825db(null,_0x21a38c);});}function createSquareReport(_0x7e2268,_0x4b4cea){rpc[_0x921a('0x29')](_0x7e2268)[_0x921a('0x28')](function(_0x45dc9c){if(_0x4b4cea){_0x4b4cea(null,_0x45dc9c);}})[_0x921a('0x2a')](function(_0xd9fd7a){if(_0x4b4cea){_0x4b4cea(null,_0xd9fd7a);}});}function setChannelVariables(_0x181631){for(var _0x2f329e in _0x181631){if(_0x181631[_0x921a('0x1e')](_0x2f329e)){if(_0x2f329e[_0x921a('0x2b')]('agi_')===0x0){_0x181631[_0x2f329e[_0x921a('0x2c')](0x4)]=_0x181631[_0x2f329e];delete _0x181631[_0x2f329e];}}}}function getLogFromObject(_0x352636){return util[_0x921a('0x2d')](_0x352636,{'showHidden':![],'depth':null});}function agiHandler(_0x138b84){var _0x14853a,_0xbf084a,_0x34b4fe,_0x297e72,_0x2f32eb;logger[_0x921a('0x2e')](_0x921a('0x2f'),JSON[_0x921a('0x30')](_0x138b84,null,0x2));logger[_0x921a('0xf')](util[_0x921a('0x10')](_0x921a('0x31'),_0x138b84[_0x921a('0x15')],_0x138b84[_0x921a('0x32')],_0x138b84[_0x921a('0x16')],_0x138b84[_0x921a('0x19')],_0x138b84[_0x921a('0x17')]));_0x138b84['on'](_0x921a('0xb'),errorHandler);_0x138b84['on'](_0x921a('0x33'),closeHandler);_0x138b84['on']('timeout',timeoutHandler);_0x138b84[_0x921a('0x34')]=![];_0x138b84['on'](_0x921a('0x35'),hangupHandler);var _0x4ab8c6=getSquareProject['sync'](null,_0x138b84[_0x921a('0x15')]);if(_0x4ab8c6){if(_0x4ab8c6[_0x921a('0x36')]){_0x14853a=getRoot(_0x4ab8c6[_0x921a('0x36')]);if(_0x14853a&&_0x14853a[_0x921a('0x37')]){logger[_0x921a('0x2e')](_0x921a('0x1c'),JSON['stringify'](_0x14853a,null,0x2));_0x138b84[_0x921a('0x38')]=moment()[_0x921a('0x10')](_0x921a('0x39'));_0xbf084a=initGraph(_['omit'](_0x14853a,_0x921a('0x3a')),_0x14853a[_0x921a('0x3a')]);_0x34b4fe=new Vertices(_0x138b84,rpc,mailRpc);logger[_0x921a('0xf')](util[_0x921a('0x10')](_0x921a('0x3b'),_0x138b84[_0x921a('0x15')],_0x138b84[_0x921a('0x32')],_0x138b84[_0x921a('0x16')],_0x138b84[_0x921a('0x19')],_0x138b84[_0x921a('0x17')]));_0xbf084a[_0x921a('0x3c')](_0x14853a['start']['id'],function(_0x2b31b3){try{_0x2b31b3=_0x34b4fe['clear'](_0x2b31b3);logger[_0x921a('0x2e')]('vertex',JSON[_0x921a('0x30')](_0x2b31b3,null,0x2));if(_0x2b31b3[_0x921a('0x1d')]===_0x921a('0x3d')){logger[_0x921a('0xf')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x138b84['context']=_0x2b31b3[_0x921a('0x3e')]||_0x138b84[_0x921a('0x3e')];_0x138b84['extension']=_0x2b31b3[_0x921a('0x3f')];_0x138b84[_0x921a('0x40')]=_0x2b31b3['priority']?_0x2b31b3['priority']-0x1:0x1;return null;}else if(_0x2b31b3&&_0x34b4fe[_0x2b31b3[_0x921a('0x1d')]]){_0x2f32eb=_0x34b4fe[_0x2b31b3[_0x921a('0x1d')]](_0x2b31b3);logger[_0x921a('0xf')]('response',JSON[_0x921a('0x30')](_0x2f32eb,null,0x2));if(_0x2f32eb&&_0x2f32eb[_0x921a('0x41')]===AGI_CODE_SUCCESS&&_0x2f32eb[_0x921a('0x42')]!==AGI_RESULT_ERROR&&!_0x138b84['evtHangup']){logger['debug'](_0x921a('0x43'),getLogFromObject(_0x2f32eb));return _[_0x921a('0x44')](_0x2f32eb[_0x921a('0x42')])?null:_0x2f32eb[_0x921a('0x42')][_0x921a('0x45')]();}else{logger[_0x921a('0xb')]('response',getLogFromObject(_0x2f32eb));return null;}}else{logger[_0x921a('0xb')](_0x921a('0x46'));return null;}}catch(_0x5bead3){logger['error'](_0x5bead3[_0x921a('0xc')]);return null;}});if(_0x14853a[_0x921a('0x47')]){logger['info'](util['format'](_0x921a('0x48'),_0x138b84[_0x921a('0x15')],_0x138b84[_0x921a('0x32')],_0x138b84['callerid'],_0x138b84[_0x921a('0x19')],_0x138b84['uniqueid']));_0xbf084a[_0x921a('0x3c')](_0x14853a[_0x921a('0x47')]['id'],function(_0x2cb1f0){try{_0x2cb1f0=_0x34b4fe[_0x921a('0x49')](_0x2cb1f0);logger[_0x921a('0x2e')](_0x921a('0x4a'),JSON[_0x921a('0x30')](_0x2cb1f0,null,0x2));if(_0x2cb1f0&&_0x34b4fe[_0x2cb1f0[_0x921a('0x1d')]]){_0x2f32eb=_0x34b4fe[_0x2cb1f0[_0x921a('0x1d')]](_0x2cb1f0);if(_0x2f32eb){logger['debug'](_0x921a('0x43'),getLogFromObject(_0x2f32eb));return _[_0x921a('0x44')](_0x2f32eb[_0x921a('0x42')])?null:_0x2f32eb[_0x921a('0x42')][_0x921a('0x45')]();}else{logger[_0x921a('0xb')](_0x921a('0x43'),getLogFromObject(_0x2f32eb));return null;}}else{logger[_0x921a('0xb')]('agicommand\x20not\x20found');return null;}}catch(_0x5d9b91){logger[_0x921a('0xb')](_0x5d9b91['stack']);return null;}});}logger[_0x921a('0xf')](util[_0x921a('0x10')](_0x921a('0x4b'),_0x138b84[_0x921a('0x15')],_0x138b84[_0x921a('0x32')],_0x138b84[_0x921a('0x16')],_0x138b84['dnid'],_0x138b84[_0x921a('0x17')]));logger[_0x921a('0xf')](util[_0x921a('0x10')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x138b84['context'],_0x138b84[_0x921a('0x3f')],parseInt(_0x138b84[_0x921a('0x40')],0xa)+0x1));_0x138b84[_0x921a('0x4c')](_0x138b84['context'],_0x138b84['extension'],parseInt(_0x138b84['priority'],0xa)+0x1);_0x138b84[_0x921a('0x33')]();}}else{logger[_0x921a('0xb')](util[_0x921a('0x10')](_0x921a('0x4d'),_0x138b84[_0x921a('0x15')]));_0x138b84[_0x921a('0x4c')](_0x138b84[_0x921a('0x3e')],_0x138b84['extension'],parseInt(_0x138b84[_0x921a('0x40')],0xa)+0x1);_0x138b84['close']();}}else{logger['error'](util[_0x921a('0x10')]('Project\x20%s\x20not\x20found',_0x138b84[_0x921a('0x15')]));_0x138b84['continueAt'](_0x138b84[_0x921a('0x3e')],_0x138b84[_0x921a('0x3f')],parseInt(_0x138b84[_0x921a('0x40')],0xa)+0x1);_0x138b84[_0x921a('0x33')]();}}function main(){var _0x337830;return utilLicense[_0x921a('0x4e')]()[_0x921a('0x28')](function(_0x175b3d){if(_0x175b3d){if(_0x175b3d[_0x921a('0x4f')]){if(_0x175b3d['callysquare']&&_0x175b3d[_0x921a('0x50')]>0x0){logger[_0x921a('0xf')](util[_0x921a('0x10')]('[LICENSE]\x20CHANNELS:\x20%s',_0x175b3d[_0x921a('0x50')]));_0x337830=_0x175b3d[_0x921a('0x50')];}else{logger['info'](_0x921a('0x51'));}}else{logger['info']('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x337830=-0x1;}}})[_0x921a('0x2a')](function(_0x17328b){logger['error'](_0x921a('0x52'),_0x17328b[_0x921a('0xc')]);})[_0x921a('0x47')](function(){var _0x13215d=require(_0x921a('0x53'))(config[_0x921a('0x6')]['port'],config['agi']['ip'],_0x337830);_0x13215d['on'](_0x921a('0xb'),errorHandler);_0x13215d['on'](_0x921a('0x54'),listeningHandler);_0x13215d['on'](_0x921a('0x55'),connectionHandler);_0x13215d['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0x0151=['createSquareReport','indexOf','agi_','substring','inspect','debug','variables','stringify','timeout','hangup','production','joinAt','YYYY-MM-DD\x20HH:mm:ss','omit','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','start','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','code','result','toString','response','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','vertex','isUndefined','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','close','continueAt','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','finally','./server','listening','connection','xml2json','lodash','syncho','moment','../../config/license/util','./rpc','./mailRpc','./graph','agi','defaults','nextTick','error','log','info','format','port','message','[%s]\x20%s','name','[ERROR]\x20%s','stack','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','root','agicommand','retry','mxCell','hasOwnProperty','length','source','addEdge','value','getSquareProject','then','catch'];(function(_0x2f3bc9,_0x12c525){var _0x1355a2=function(_0xf15fdf){while(--_0xf15fdf){_0x2f3bc9['push'](_0x2f3bc9['shift']());}};_0x1355a2(++_0x12c525);}(_0x0151,0x12e));var _0x1015=function(_0x462f44,_0x4946e7){_0x462f44=_0x462f44-0x0;var _0x3bad68=_0x0151[_0x462f44];return _0x3bad68;};'use strict';var parser=require(_0x1015('0x0'));var _=require(_0x1015('0x1'));var syncho=require(_0x1015('0x2'));var util=require('util');var moment=require(_0x1015('0x3'));var config=require('../../config/environment');var logger=require('../../config/logger')('agi');var utilLicense=require(_0x1015('0x4'));var rpc=require(_0x1015('0x5'));var mailRpc=require(_0x1015('0x6'));var Graph=require(_0x1015('0x7'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x1015('0x8')]=_[_0x1015('0x9')](config[_0x1015('0x8')],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x3636ee){process[_0x1015('0xa')](function(){syncho(function(){try{setChannelVariables(_0x3636ee);agiHandler(_0x3636ee);}catch(_0x4d8b9d){logger[_0x1015('0xb')](_0x4d8b9d['stack']);}});});}function listeningHandler(){console[_0x1015('0xc')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x1015('0x8')]['port']);logger[_0x1015('0xd')](util[_0x1015('0xe')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x1015('0x8')]['ip'],config[_0x1015('0x8')][_0x1015('0xf')]));}function errorHandler(_0xca2255){if(_0xca2255&&_0xca2255['name']&&_0xca2255[_0x1015('0x10')]){logger[_0x1015('0xb')](util[_0x1015('0xe')](_0x1015('0x11'),_0xca2255[_0x1015('0x12')],_0xca2255['message']));}else{logger[_0x1015('0xb')](util[_0x1015('0xe')](_0x1015('0x13'),_0xca2255[_0x1015('0x14')]));}}function closeHandler(){logger[_0x1015('0xd')](util[_0x1015('0xe')](_0x1015('0x15'),this[_0x1015('0x16')],this[_0x1015('0x17')],this[_0x1015('0x18')],this[_0x1015('0x19')],this[_0x1015('0x1a')]));try{createSquareReport(this);}catch(_0x557da9){logger[_0x1015('0xb')](_0x557da9['stack']);}}function timeoutHandler(){logger[_0x1015('0xd')](util['format'](_0x1015('0x1b'),this[_0x1015('0x16')],this[_0x1015('0x17')],this[_0x1015('0x18')],this[_0x1015('0x19')],this['uniqueid']));}function hangupHandler(){logger['info'](util[_0x1015('0xe')](_0x1015('0x1c'),this[_0x1015('0x16')],this[_0x1015('0x17')],this[_0x1015('0x18')],this[_0x1015('0x19')],this[_0x1015('0x1a')]));this[_0x1015('0x1d')]=!![];}function getRoot(_0x3ea10b){return parser['toJson'](_0x3ea10b,{'object':!![]})['mxGraphModel'][_0x1015('0x1e')];}function addVertex(_0x38a6e6,_0x2f4c90,_0x47928a){_0x2f4c90[_0x1015('0x1f')]=_0x47928a;if(_0x2f4c90['hasOwnProperty']('retry')){_0x2f4c90['maxRetry']=parseInt(_0x2f4c90[_0x1015('0x20')],0xa);}_0x38a6e6['addVertex'](_['omit'](_0x2f4c90,_0x1015('0x21')));}function initGraph(_0xe714de,_0x126f58){var _0x57b417=new Graph();for(var _0x2f3b78 in _0xe714de){if(_0xe714de[_0x1015('0x22')](_0x2f3b78)){if(_['isArray'](_0xe714de[_0x2f3b78])){for(var _0x597b09=0x0;_0x597b09<_0xe714de[_0x2f3b78][_0x1015('0x23')];_0x597b09+=0x1){addVertex(_0x57b417,_0xe714de[_0x2f3b78][_0x597b09],_0x2f3b78);}}else{addVertex(_0x57b417,_0xe714de[_0x2f3b78],_0x2f3b78);}}}for(var _0x371693=0x0;_0x371693<_0x126f58['length'];_0x371693+=0x1){if(_0x126f58[_0x371693][_0x1015('0x24')]&&_0x126f58[_0x371693]['target']){_0x57b417[_0x1015('0x25')](_0x126f58[_0x371693][_0x1015('0x24')],_0x126f58[_0x371693]['target'],_0x126f58[_0x371693][_0x1015('0x26')]);}}return _0x57b417;}function getSquareProject(_0x50c8df,_0xfa32ba){rpc[_0x1015('0x27')](_0x50c8df)[_0x1015('0x28')](function(_0x5f2518){_0xfa32ba(null,_0x5f2518);})[_0x1015('0x29')](function(_0x4d47bd){_0xfa32ba(null,_0x4d47bd);});}function createSquareReport(_0x2162c2,_0x20c639){rpc[_0x1015('0x2a')](_0x2162c2)[_0x1015('0x28')](function(_0x3e74a9){if(_0x20c639){_0x20c639(null,_0x3e74a9);}})['catch'](function(_0xed1f51){if(_0x20c639){_0x20c639(null,_0xed1f51);}});}function setChannelVariables(_0x1c6352){for(var _0xfeae9e in _0x1c6352){if(_0x1c6352[_0x1015('0x22')](_0xfeae9e)){if(_0xfeae9e[_0x1015('0x2b')](_0x1015('0x2c'))===0x0){_0x1c6352[_0xfeae9e[_0x1015('0x2d')](0x4)]=_0x1c6352[_0xfeae9e];delete _0x1c6352[_0xfeae9e];}}}}function getLogFromObject(_0x40d007){return util[_0x1015('0x2e')](_0x40d007,{'showHidden':![],'depth':null});}function agiHandler(_0x313fdb){var _0x2b9494,_0x4dcdee,_0x39de4d,_0x409078,_0x2e2cd3;logger[_0x1015('0x2f')](_0x1015('0x30'),JSON[_0x1015('0x31')](_0x313fdb,null,0x2));logger['info'](util[_0x1015('0xe')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x313fdb[_0x1015('0x16')],_0x313fdb[_0x1015('0x17')],_0x313fdb['callerid'],_0x313fdb[_0x1015('0x19')],_0x313fdb[_0x1015('0x1a')]));_0x313fdb['on'](_0x1015('0xb'),errorHandler);_0x313fdb['on']('close',closeHandler);_0x313fdb['on'](_0x1015('0x32'),timeoutHandler);_0x313fdb[_0x1015('0x1d')]=![];_0x313fdb['on'](_0x1015('0x33'),hangupHandler);var _0x54e237=getSquareProject['sync'](null,_0x313fdb[_0x1015('0x16')]);if(_0x54e237){if(_0x54e237[_0x1015('0x34')]){_0x2b9494=getRoot(_0x54e237['production']);if(_0x2b9494&&_0x2b9494['start']){logger['debug'](_0x1015('0x1e'),JSON[_0x1015('0x31')](_0x2b9494,null,0x2));_0x313fdb[_0x1015('0x35')]=moment()[_0x1015('0xe')](_0x1015('0x36'));_0x4dcdee=initGraph(_[_0x1015('0x37')](_0x2b9494,'mxCell'),_0x2b9494['mxCell']);_0x39de4d=new Vertices(_0x313fdb,rpc,mailRpc);logger[_0x1015('0xd')](util['format'](_0x1015('0x38'),_0x313fdb[_0x1015('0x16')],_0x313fdb[_0x1015('0x17')],_0x313fdb['callerid'],_0x313fdb['dnid'],_0x313fdb[_0x1015('0x1a')]));_0x4dcdee[_0x1015('0x39')](_0x2b9494[_0x1015('0x3a')]['id'],function(_0x40dfe0){try{_0x40dfe0=_0x39de4d['clear'](_0x40dfe0);logger[_0x1015('0x2f')]('vertex',JSON['stringify'](_0x40dfe0,null,0x2));if(_0x40dfe0['agicommand']===_0x1015('0x3b')){logger['info'](_0x1015('0x3c'));_0x313fdb[_0x1015('0x3d')]=_0x40dfe0['context']||_0x313fdb[_0x1015('0x3d')];_0x313fdb['extension']=_0x40dfe0[_0x1015('0x3e')];_0x313fdb[_0x1015('0x3f')]=_0x40dfe0[_0x1015('0x3f')]?_0x40dfe0['priority']-0x1:0x1;return null;}else if(_0x40dfe0&&_0x39de4d[_0x40dfe0[_0x1015('0x1f')]]){_0x2e2cd3=_0x39de4d[_0x40dfe0[_0x1015('0x1f')]](_0x40dfe0);logger[_0x1015('0xd')]('response',JSON['stringify'](_0x2e2cd3,null,0x2));if(_0x2e2cd3&&_0x2e2cd3[_0x1015('0x40')]===AGI_CODE_SUCCESS&&_0x2e2cd3[_0x1015('0x41')]!==AGI_RESULT_ERROR&&!_0x313fdb[_0x1015('0x1d')]){logger[_0x1015('0x2f')]('response',getLogFromObject(_0x2e2cd3));return _['isUndefined'](_0x2e2cd3[_0x1015('0x41')])?null:_0x2e2cd3[_0x1015('0x41')][_0x1015('0x42')]();}else{logger[_0x1015('0xb')](_0x1015('0x43'),getLogFromObject(_0x2e2cd3));return null;}}else{logger[_0x1015('0xb')](_0x1015('0x44'));return null;}}catch(_0x82409b){logger[_0x1015('0xb')](_0x82409b[_0x1015('0x14')]);return null;}});if(_0x2b9494['finally']){logger[_0x1015('0xd')](util[_0x1015('0xe')](_0x1015('0x45'),_0x313fdb[_0x1015('0x16')],_0x313fdb[_0x1015('0x17')],_0x313fdb[_0x1015('0x18')],_0x313fdb[_0x1015('0x19')],_0x313fdb[_0x1015('0x1a')]));_0x4dcdee[_0x1015('0x39')](_0x2b9494['finally']['id'],function(_0x36fda5){try{_0x36fda5=_0x39de4d['clear'](_0x36fda5);logger[_0x1015('0x2f')](_0x1015('0x46'),JSON[_0x1015('0x31')](_0x36fda5,null,0x2));if(_0x36fda5&&_0x39de4d[_0x36fda5[_0x1015('0x1f')]]){_0x2e2cd3=_0x39de4d[_0x36fda5[_0x1015('0x1f')]](_0x36fda5);if(_0x2e2cd3){logger[_0x1015('0x2f')](_0x1015('0x43'),getLogFromObject(_0x2e2cd3));return _[_0x1015('0x47')](_0x2e2cd3[_0x1015('0x41')])?null:_0x2e2cd3[_0x1015('0x41')][_0x1015('0x42')]();}else{logger[_0x1015('0xb')](_0x1015('0x43'),getLogFromObject(_0x2e2cd3));return null;}}else{logger[_0x1015('0xb')](_0x1015('0x44'));return null;}}catch(_0x4f1843){logger['error'](_0x4f1843[_0x1015('0x14')]);return null;}});}logger[_0x1015('0xd')](util[_0x1015('0xe')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x313fdb[_0x1015('0x16')],_0x313fdb[_0x1015('0x17')],_0x313fdb[_0x1015('0x18')],_0x313fdb[_0x1015('0x19')],_0x313fdb[_0x1015('0x1a')]));logger[_0x1015('0xd')](util[_0x1015('0xe')](_0x1015('0x48'),_0x313fdb[_0x1015('0x3d')],_0x313fdb[_0x1015('0x3e')],parseInt(_0x313fdb[_0x1015('0x3f')],0xa)+0x1));_0x313fdb['continueAt'](_0x313fdb[_0x1015('0x3d')],_0x313fdb[_0x1015('0x3e')],parseInt(_0x313fdb['priority'],0xa)+0x1);_0x313fdb[_0x1015('0x49')]();}}else{logger[_0x1015('0xb')](util[_0x1015('0xe')]('Project\x20%s\x20not\x20published',_0x313fdb[_0x1015('0x16')]));_0x313fdb[_0x1015('0x4a')](_0x313fdb['context'],_0x313fdb['extension'],parseInt(_0x313fdb['priority'],0xa)+0x1);_0x313fdb[_0x1015('0x49')]();}}else{logger[_0x1015('0xb')](util['format'](_0x1015('0x4b'),_0x313fdb['arg_1']));_0x313fdb[_0x1015('0x4a')](_0x313fdb[_0x1015('0x3d')],_0x313fdb['extension'],parseInt(_0x313fdb[_0x1015('0x3f')],0xa)+0x1);_0x313fdb['close']();}}function main(){var _0xfe3d89;return utilLicense[_0x1015('0x4c')]()['then'](function(_0x25dc9d){if(_0x25dc9d){if(_0x25dc9d[_0x1015('0x4d')]){if(_0x25dc9d[_0x1015('0x4e')]&&_0x25dc9d[_0x1015('0x4e')]>0x0){logger[_0x1015('0xd')](util['format']('[LICENSE]\x20CHANNELS:\x20%s',_0x25dc9d[_0x1015('0x4e')]));_0xfe3d89=_0x25dc9d[_0x1015('0x4e')];}else{logger['info'](_0x1015('0x4f'));}}else{logger['info'](_0x1015('0x50'));_0xfe3d89=-0x1;}}})[_0x1015('0x29')](function(_0xe1c05c){logger[_0x1015('0xb')](_0x1015('0x51'),_0xe1c05c[_0x1015('0x14')]);})[_0x1015('0x52')](function(){var _0x267f6f=require(_0x1015('0x53'))(config[_0x1015('0x8')][_0x1015('0xf')],config[_0x1015('0x8')]['ip'],_0xfe3d89);_0x267f6f['on'](_0x1015('0xb'),errorHandler);_0x267f6f['on'](_0x1015('0x54'),listeningHandler);_0x267f6f['on'](_0x1015('0x55'),connectionHandler);_0x267f6f['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 6002c1b..63dfd68 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 _0xb498=['bluebird','jayson/promise','client','http','then','error','message','sendMailMessage','SendMail'];(function(_0x4e3edf,_0x3e3226){var _0x1a2f12=function(_0x34f73e){while(--_0x34f73e){_0x4e3edf['push'](_0x4e3edf['shift']());}};_0x1a2f12(++_0x3e3226);}(_0xb498,0xea));var _0x8b49=function(_0x30aea2,_0xb9fd3d){_0x30aea2=_0x30aea2-0x0;var _0xb2188a=_0xb498[_0x30aea2];return _0xb2188a;};'use strict';var BPromise=require(_0x8b49('0x0'));var jayson=require(_0x8b49('0x1'));var client=jayson[_0x8b49('0x2')][_0x8b49('0x3')]({'port':0x232b});function request(_0x297097,_0x22f85b){return new BPromise(function(_0x50887c,_0x2d8026){return client['request'](_0x297097,_0x22f85b)[_0x8b49('0x4')](function(_0x358d38){if(_0x358d38[_0x8b49('0x5')]){return _0x2d8026(_0x358d38[_0x8b49('0x5')][_0x8b49('0x6')]);}else{return _0x50887c(_0x358d38['result']);}})['catch'](function(_0x1aa5ff){return _0x2d8026(_0x1aa5ff);});});}exports[_0x8b49('0x7')]=function(_0x2e71fe,_0x1ece24){return request(_0x8b49('0x8'),{'account':_0x2e71fe,'message':_0x1ece24});}; \ No newline at end of file +var _0xca0a=['result','sendMailMessage','SendMail','bluebird','jayson/promise','http','request','error','message'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0xca0a,0x6f));var _0xaca0=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xca0a[_0x5b78e8];return _0xf2c321;};'use strict';var BPromise=require(_0xaca0('0x0'));var jayson=require(_0xaca0('0x1'));var client=jayson['client'][_0xaca0('0x2')]({'port':0x232b});function request(_0x3a39e2,_0x525212){return new BPromise(function(_0x1721ae,_0x2f602f){return client[_0xaca0('0x3')](_0x3a39e2,_0x525212)['then'](function(_0x511644){if(_0x511644[_0xaca0('0x4')]){return _0x2f602f(_0x511644[_0xaca0('0x4')][_0xaca0('0x5')]);}else{return _0x1721ae(_0x511644[_0xaca0('0x6')]);}})['catch'](function(_0x32e843){return _0x2f602f(_0x32e843);});});}exports[_0xaca0('0x7')]=function(_0x204adb,_0x235614){return request(_0xaca0('0x8'),{'account':_0x204adb,'message':_0x235614});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 447afc1..4f9ca27 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 _0x0192=['headers','line','exports','util','call','_inBody','inherits','_transform','\x0d\x0a\x0d\x0a','toString','_localBuffer','substring','split','indexOf','slice','trim','length','emit'];(function(_0xad57ee,_0x2823a6){var _0x3eaea9=function(_0x185650){while(--_0x185650){_0xad57ee['push'](_0xad57ee['shift']());}};_0x3eaea9(++_0x2823a6);}(_0x0192,0x1c5));var _0x2019=function(_0x1e4abe,_0x652195){_0x1e4abe=_0x1e4abe-0x0;var _0x339d84=_0x0192[_0x1e4abe];return _0x339d84;};'use strict';var util=require(_0x2019('0x0'));var Transform=require('stream')['Transform'];function AGIReply(_0xaf57c8){Transform[_0x2019('0x1')](this,_0xaf57c8);this['_localBuffer']='';this[_0x2019('0x2')]=![];}util[_0x2019('0x3')](AGIReply,Transform);AGIReply['prototype'][_0x2019('0x4')]=function(_0x55dfd3,_0x39a798,_0x2f8c9a){var _0xc5f35d='\x0a',_0x5c39cd=['\x0a\x0a',_0x2019('0x5')],_0x10295f=-0x1,_0x59f7b5=-0x1,_0xbee346='',_0x53f66e=0x0,_0x390c73='',_0x57d02c='';this['_localBuffer']+=_0x55dfd3[_0x2019('0x6')]();_0x390c73=this[_0x2019('0x7')];if(!this[_0x2019('0x2')]){_0x53f66e=0x0;while(_0x5c39cd[_0x53f66e]){while((_0x59f7b5=_0x390c73['indexOf'](_0x5c39cd[_0x53f66e]))!=-0x1){_0xbee346=_0x5c39cd[_0x53f66e];_0x57d02c=_0x390c73[_0x2019('0x8')](0x0,_0x59f7b5);_0x390c73=_0x390c73[_0x2019('0x8')](_0x59f7b5+_0xbee346['length']);var _0x4a66d1=_0x57d02c[_0x2019('0x9')](_0xc5f35d),_0x394411=0x0,_0x1599f5={},_0x4c24bc='',_0x3fec68='',_0x51de66=-0x1;while(_0x4a66d1[_0x394411]){_0x51de66=_0x4a66d1[_0x394411][_0x2019('0xa')](':');if(_0x51de66!=-0x1){_0x4c24bc=_0x4a66d1[_0x394411][_0x2019('0xb')](0x0,_0x51de66)[_0x2019('0xc')]();_0x3fec68=_0x4a66d1[_0x394411][_0x2019('0xb')](_0x51de66+0x1)['trim']();if(_0x4c24bc[_0x2019('0xd')]>0x0){_0x1599f5[_0x4c24bc]=_0x3fec68;}}else{}_0x394411++;}this[_0x2019('0xe')](_0x2019('0xf'),_0x1599f5);this[_0x2019('0x2')]=!![];}_0x53f66e++;}this[_0x2019('0x7')]=_0x390c73;}else{while((_0x10295f=_0x390c73[_0x2019('0xa')](_0xc5f35d))!=-0x1){_0x57d02c=_0x390c73[_0x2019('0x8')](0x0,_0x10295f);this[_0x2019('0xe')](_0x2019('0x10'),_0x57d02c);_0x390c73=_0x390c73['substring'](_0x10295f+_0xc5f35d['length']);}this['_localBuffer']=_0x390c73;}_0x2f8c9a();};module[_0x2019('0x11')]=AGIReply; \ No newline at end of file +var _0x773c=['headers','line','util','stream','Transform','_localBuffer','prototype','_transform','\x0d\x0a\x0d\x0a','toString','_inBody','indexOf','substring','length','split','slice','trim','emit'];(function(_0x2bf02d,_0x3f74b7){var _0x1206e7=function(_0x316f2d){while(--_0x316f2d){_0x2bf02d['push'](_0x2bf02d['shift']());}};_0x1206e7(++_0x3f74b7);}(_0x773c,0x6e));var _0xc773=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x773c[_0x55f8b4];return _0x2475f9;};'use strict';var util=require(_0xc773('0x0'));var Transform=require(_0xc773('0x1'))[_0xc773('0x2')];function AGIReply(_0x713eea){Transform['call'](this,_0x713eea);this[_0xc773('0x3')]='';this['_inBody']=![];}util['inherits'](AGIReply,Transform);AGIReply[_0xc773('0x4')][_0xc773('0x5')]=function(_0x128824,_0x2fc1da,_0x454881){var _0x2f23f8='\x0a',_0x4bc0ea=['\x0a\x0a',_0xc773('0x6')],_0xa1cee1=-0x1,_0x49ce90=-0x1,_0x513615='',_0x33793a=0x0,_0x3b738e='',_0x54abb1='';this[_0xc773('0x3')]+=_0x128824[_0xc773('0x7')]();_0x3b738e=this[_0xc773('0x3')];if(!this[_0xc773('0x8')]){_0x33793a=0x0;while(_0x4bc0ea[_0x33793a]){while((_0x49ce90=_0x3b738e[_0xc773('0x9')](_0x4bc0ea[_0x33793a]))!=-0x1){_0x513615=_0x4bc0ea[_0x33793a];_0x54abb1=_0x3b738e['substring'](0x0,_0x49ce90);_0x3b738e=_0x3b738e[_0xc773('0xa')](_0x49ce90+_0x513615[_0xc773('0xb')]);var _0x4e9079=_0x54abb1[_0xc773('0xc')](_0x2f23f8),_0x4b0fd1=0x0,_0x3dc374={},_0xc242bf='',_0x3f858a='',_0x2bc5aa=-0x1;while(_0x4e9079[_0x4b0fd1]){_0x2bc5aa=_0x4e9079[_0x4b0fd1][_0xc773('0x9')](':');if(_0x2bc5aa!=-0x1){_0xc242bf=_0x4e9079[_0x4b0fd1][_0xc773('0xd')](0x0,_0x2bc5aa)['trim']();_0x3f858a=_0x4e9079[_0x4b0fd1][_0xc773('0xd')](_0x2bc5aa+0x1)[_0xc773('0xe')]();if(_0xc242bf[_0xc773('0xb')]>0x0){_0x3dc374[_0xc242bf]=_0x3f858a;}}else{}_0x4b0fd1++;}this[_0xc773('0xf')](_0xc773('0x10'),_0x3dc374);this['_inBody']=!![];}_0x33793a++;}this[_0xc773('0x3')]=_0x3b738e;}else{while((_0xa1cee1=_0x3b738e['indexOf'](_0x2f23f8))!=-0x1){_0x54abb1=_0x3b738e[_0xc773('0xa')](0x0,_0xa1cee1);this['emit'](_0xc773('0x11'),_0x54abb1);_0x3b738e=_0x3b738e['substring'](_0xa1cee1+_0x2f23f8['length']);}this['_localBuffer']=_0x3b738e;}_0x454881();};module['exports']=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 64378b9..73e4d37 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 _0xb925=['Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','agentLogin','agentPause','agentUnpause','UnpauseUser','agentLogout','bluebird','moment','lodash','util','jayson/promise','client','request','then','error','result','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','name','getVariableById','ShowSquareOdbc','dsn','getUserById','getSoundById','save_name','getIntervalById','ShowInterval'];(function(_0xe55288,_0x3439d4){var _0x4e47c1=function(_0x2adbfd){while(--_0x2adbfd){_0xe55288['push'](_0xe55288['shift']());}};_0x4e47c1(++_0x3439d4);}(_0xb925,0xbf));var _0x5b92=function(_0x2fd160,_0x53c0d6){_0x2fd160=_0x2fd160-0x0;var _0x5c2031=_0xb925[_0x2fd160];return _0x5c2031;};'use strict';var BPromise=require(_0x5b92('0x0'));var moment=require(_0x5b92('0x1'));var _=require(_0x5b92('0x2'));var util=require(_0x5b92('0x3'));var jayson=require(_0x5b92('0x4'));var client=jayson[_0x5b92('0x5')]['http']({'port':0x2329});function request(_0x2b743e,_0x2062ff){return new BPromise(function(_0x556c44,_0x1aaa30){return client[_0x5b92('0x6')](_0x2b743e,_0x2062ff)[_0x5b92('0x7')](function(_0x4fb371){if(_0x4fb371[_0x5b92('0x8')]){return _0x1aaa30(_0x4fb371[_0x5b92('0x8')]['message']);}else{return _0x556c44(_0x4fb371[_0x5b92('0x9')]);}})['catch'](function(_0x4c30d2){return _0x1aaa30(_0x4c30d2);});});}exports[_0x5b92('0xa')]=function(_0x2792cf){return request(_0x5b92('0xb'),{'options':{'raw':![],'where':{'name':_0x2792cf},'attributes':['production']}});};exports[_0x5b92('0xc')]=function(_0x4e9347){return request(_0x5b92('0xd'),{'options':{'raw':![],'where':{'id':_0x4e9347},'include':[{'model':_0x5b92('0xe'),'as':_0x5b92('0xf')}],'attributes':['id','name',_0x5b92('0x10')]}});};exports[_0x5b92('0x11')]=function(_0x152345){return request(_0x5b92('0xb'),{'options':{'where':{'id':_0x152345},'attributes':['name']}});};exports[_0x5b92('0x12')]=function(_0x3aa4a2){return request(_0x5b92('0x13'),{'options':{'where':{'id':_0x3aa4a2},'attributes':[_0x5b92('0x14')]}});};exports[_0x5b92('0x15')]=function(_0x2de112){return request('ShowVariable',{'options':{'where':{'id':_0x2de112},'attributes':['name']}});};exports['getSquareOdbcById']=function(_0x222116){return request(_0x5b92('0x16'),{'options':{'where':{'id':_0x222116},'attributes':[_0x5b92('0x17')]}});};exports[_0x5b92('0x18')]=function(_0x4a7f0d){return request('ShowUser',{'options':{'where':{'id':_0x4a7f0d},'attributes':[_0x5b92('0x14')]}});};exports['getTrunkById']=function(_0x3492e5){return request('ShowTrunk',{'options':{'where':{'id':_0x3492e5},'attributes':[_0x5b92('0x14')]}});};exports[_0x5b92('0x19')]=function(_0x2fec80){return request('ShowSound',{'options':{'where':{'id':_0x2fec80},'attributes':[_0x5b92('0x1a')]}});};exports[_0x5b92('0x1b')]=function(_0x5be739){return request(_0x5b92('0x1c'),{'options':{'raw':![],'where':{'id':_0x5be739},'include':[{'model':_0x5b92('0x1d'),'as':_0x5b92('0x1e')}]}});};exports[_0x5b92('0x1f')]=function(_0x355263){return request(_0x5b92('0x20'),{'options':{'where':{'id':_0x355263},'attributes':['id','name']}});};exports[_0x5b92('0x21')]=function(_0x4b2cb5){return request(_0x5b92('0x22'),{'body':_0x4b2cb5});};exports['createSquareDetailsReport']=function(_0x21679e){return request(_0x5b92('0x23'),{'body':_0x21679e});};exports[_0x5b92('0x24')]=function(_0x30e92c){return request(_0x5b92('0x25'),{'body':_['merge'](_0x30e92c,{'project_name':_0x30e92c[_0x5b92('0x26')],'prev_project_name':_0x30e92c[_0x5b92('0x27')]||'','is_subproject':_0x30e92c[_0x5b92('0x27')]?!![]:![],'leaveAt':moment()[_0x5b92('0x28')](_0x5b92('0x29'))})});};exports[_0x5b92('0x2a')]=function(_0x29ad5c){return request(_0x5b92('0x2b'),{'body':_0x29ad5c});};exports[_0x5b92('0x2c')]=function(_0x47c83f){return request(_0x5b92('0x2d'),{'body':_0x47c83f});};exports[_0x5b92('0x2e')]=function(_0x3c92db){return request(_0x5b92('0x2f'),{'options':{'raw':![],'where':{'phone':_0x3c92db[_0x5b92('0x30')],'ListId':_0x3c92db[_0x5b92('0x31')]}}})['then'](function(_0x5c3551){if(_0x5c3551){return _0x5c3551;}return request('CreateCmContact',{'body':_0x3c92db});});};exports['getPauseById']=function(_0x497f7e){return request('ShowPause',{'options':{'where':{'id':_0x497f7e},'attributes':[_0x5b92('0x14')]}});};exports[_0x5b92('0x32')]=function(_0x161e98,_0x3770a8){return request('LoginUser',{'body':{'interface':_0x3770a8},'options':{'where':_0x161e98}});};exports[_0x5b92('0x33')]=function(_0xc66888,_0x24de9a,_0x10953a){return request('PauseUser',{'body':{'type':_0x24de9a,'uniqueid':_0x10953a},'options':{'where':_0xc66888}});};exports[_0x5b92('0x34')]=function(_0x227bc2){return request(_0x5b92('0x35'),{'body':{},'options':{'where':_0x227bc2}});};exports[_0x5b92('0x36')]=function(_0x2d23a8){return request('LogoutUser',{'body':{},'options':{'where':_0x2d23a8}});}; \ No newline at end of file +var _0x573b=['CreateSquareReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','CreateSquareMessage','phone','ListId','CreateCmContact','getPauseById','agentLogin','UnpauseUser','agentLogout','LogoutUser','bluebird','lodash','client','request','then','error','message','result','catch','getSquareProject','ShowSquareProject','ShowMailAccount','name','email','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','getTrunkById','ShowTrunk','getSoundById','save_name','getIntervalById','ShowInterval','Interval','getSmsAccountById','ShowSmsAccount','CreateSquareDetailsReport','createSquareReport'];(function(_0x335e51,_0x3c63fb){var _0x11637f=function(_0x27e494){while(--_0x27e494){_0x335e51['push'](_0x335e51['shift']());}};_0x11637f(++_0x3c63fb);}(_0x573b,0xa3));var _0xb573=function(_0x5ef070,_0x37c972){_0x5ef070=_0x5ef070-0x0;var _0x54e96f=_0x573b[_0x5ef070];return _0x54e96f;};'use strict';var BPromise=require(_0xb573('0x0'));var moment=require('moment');var _=require(_0xb573('0x1'));var util=require('util');var jayson=require('jayson/promise');var client=jayson[_0xb573('0x2')]['http']({'port':0x2329});function request(_0x4aed6b,_0x4dda97){return new BPromise(function(_0x4b3f2c,_0x247a25){return client[_0xb573('0x3')](_0x4aed6b,_0x4dda97)[_0xb573('0x4')](function(_0x164ded){if(_0x164ded[_0xb573('0x5')]){return _0x247a25(_0x164ded[_0xb573('0x5')][_0xb573('0x6')]);}else{return _0x4b3f2c(_0x164ded[_0xb573('0x7')]);}})[_0xb573('0x8')](function(_0x20a6d2){return _0x247a25(_0x20a6d2);});});}exports[_0xb573('0x9')]=function(_0x2f7474){return request(_0xb573('0xa'),{'options':{'raw':![],'where':{'name':_0x2f7474},'attributes':['production']}});};exports['getMailAccountById']=function(_0xcd6dd8){return request(_0xb573('0xb'),{'options':{'raw':![],'where':{'id':_0xcd6dd8},'include':[{'model':'MailServerOut','as':'Smtp'}],'attributes':['id',_0xb573('0xc'),_0xb573('0xd')]}});};exports['getSquareProjectById']=function(_0x426c11){return request(_0xb573('0xa'),{'options':{'where':{'id':_0x426c11},'attributes':[_0xb573('0xc')]}});};exports[_0xb573('0xe')]=function(_0xa73ae0){return request(_0xb573('0xf'),{'options':{'where':{'id':_0xa73ae0},'attributes':['name']}});};exports[_0xb573('0x10')]=function(_0x5554b4){return request(_0xb573('0x11'),{'options':{'where':{'id':_0x5554b4},'attributes':[_0xb573('0xc')]}});};exports[_0xb573('0x12')]=function(_0x58abe1){return request(_0xb573('0x13'),{'options':{'where':{'id':_0x58abe1},'attributes':[_0xb573('0x14')]}});};exports[_0xb573('0x15')]=function(_0x88ffc1){return request('ShowUser',{'options':{'where':{'id':_0x88ffc1},'attributes':[_0xb573('0xc')]}});};exports[_0xb573('0x16')]=function(_0xd24f63){return request(_0xb573('0x17'),{'options':{'where':{'id':_0xd24f63},'attributes':[_0xb573('0xc')]}});};exports[_0xb573('0x18')]=function(_0x1d2f00){return request('ShowSound',{'options':{'where':{'id':_0x1d2f00},'attributes':[_0xb573('0x19')]}});};exports[_0xb573('0x1a')]=function(_0x132d66){return request(_0xb573('0x1b'),{'options':{'raw':![],'where':{'id':_0x132d66},'include':[{'model':_0xb573('0x1c'),'as':'Intervals'}]}});};exports[_0xb573('0x1d')]=function(_0x34ecdd){return request(_0xb573('0x1e'),{'options':{'where':{'id':_0x34ecdd},'attributes':['id','name']}});};exports['createSmsMessage']=function(_0x591944){return request('CreateSmsMessage',{'body':_0x591944});};exports['createSquareDetailsReport']=function(_0x362082){return request(_0xb573('0x1f'),{'body':_0x362082});};exports[_0xb573('0x20')]=function(_0x4127ca){return request(_0xb573('0x21'),{'body':_['merge'](_0x4127ca,{'project_name':_0x4127ca[_0xb573('0x22')],'prev_project_name':_0x4127ca[_0xb573('0x23')]||'','is_subproject':_0x4127ca[_0xb573('0x23')]?!![]:![],'leaveAt':moment()[_0xb573('0x24')](_0xb573('0x25'))})});};exports[_0xb573('0x26')]=function(_0x15a50d){return request('CreateSquareRecording',{'body':_0x15a50d});};exports[_0xb573('0x27')]=function(_0x1d26ff){return request(_0xb573('0x28'),{'body':_0x1d26ff});};exports['createCmContact']=function(_0x2511b2){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x2511b2[_0xb573('0x29')],'ListId':_0x2511b2[_0xb573('0x2a')]}}})[_0xb573('0x4')](function(_0x403bc4){if(_0x403bc4){return _0x403bc4;}return request(_0xb573('0x2b'),{'body':_0x2511b2});});};exports[_0xb573('0x2c')]=function(_0xbe55aa){return request('ShowPause',{'options':{'where':{'id':_0xbe55aa},'attributes':['name']}});};exports[_0xb573('0x2d')]=function(_0x37e12e,_0x51110b){return request('LoginUser',{'body':{'interface':_0x51110b},'options':{'where':_0x37e12e}});};exports['agentPause']=function(_0x29ca4e,_0x1e7357,_0x137b71){return request('PauseUser',{'body':{'type':_0x1e7357,'uniqueid':_0x137b71},'options':{'where':_0x29ca4e}});};exports['agentUnpause']=function(_0x607a77){return request(_0xb573('0x2e'),{'body':{},'options':{'where':_0x607a77}});};exports[_0xb573('0x2f')]=function(_0x3477a4){return request(_0xb573('0x30'),{'body':{},'options':{'where':_0x3477a4}});}; \ 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 8253de6..f4248ba 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 _0x78d3=['exports','./polly','./lex'];(function(_0x2c3406,_0x31e372){var _0x1e9dc5=function(_0x24e2ae){while(--_0x24e2ae){_0x2c3406['push'](_0x2c3406['shift']());}};_0x1e9dc5(++_0x31e372);}(_0x78d3,0x73));var _0x378d=function(_0x2e6dfb,_0x319a2b){_0x2e6dfb=_0x2e6dfb-0x0;var _0x54dece=_0x78d3[_0x2e6dfb];return _0x54dece;};var polly=require(_0x378d('0x0'));var lex=require(_0x378d('0x1'));module[_0x378d('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x3981=['./polly','exports'];(function(_0x59eee0,_0x56252f){var _0x3ec1c9=function(_0x4ecdaa){while(--_0x4ecdaa){_0x59eee0['push'](_0x59eee0['shift']());}};_0x3ec1c9(++_0x56252f);}(_0x3981,0x144));var _0x1398=function(_0x19e536,_0x15caa5){_0x19e536=_0x19e536-0x0;var _0x52b859=_0x3981[_0x19e536];return _0x52b859;};var polly=require(_0x1398('0x0'));var lex=require('./lex');module[_0x1398('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 0e82073..9201544 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 _0xee5b=['./lib/api'];(function(_0x1e923a,_0x30cbcc){var _0x5f4458=function(_0x2db4e4){while(--_0x2db4e4){_0x1e923a['push'](_0x1e923a['shift']());}};_0x5f4458(++_0x30cbcc);}(_0xee5b,0x1f4));var _0xbee5=function(_0x3ad75b,_0x3c5896){_0x3ad75b=_0x3ad75b-0x0;var _0x36a4fc=_0xee5b[_0x3ad75b];return _0x36a4fc;};'use strict';var lex=require(_0xbee5('0x0'));module['exports']=function(_0x7b2344,_0x203bba,_0x4f850a,_0x1893e4,_0x2b93c2,_0x2eb857){return lex(_0x7b2344,_0x203bba,_0x4f850a,_0x1893e4,_0x2b93c2,_0x2eb857);}; \ No newline at end of file +var _0x750a=['exports'];(function(_0x295340,_0x5d19f5){var _0x85c9bd=function(_0x567eb9){while(--_0x567eb9){_0x295340['push'](_0x295340['shift']());}};_0x85c9bd(++_0x5d19f5);}(_0x750a,0x140));var _0xa750=function(_0x3e8a14,_0x1c3c4f){_0x3e8a14=_0x3e8a14-0x0;var _0x7e9db9=_0x750a[_0x3e8a14];return _0x7e9db9;};'use strict';var lex=require('./lib/api');module[_0xa750('0x0')]=function(_0x5368b2,_0x499583,_0x139fa5,_0xeb020d,_0x1b459c,_0x19bd5f){return lex(_0x5368b2,_0x499583,_0x139fa5,_0xeb020d,_0x1b459c,_0x19bd5f);}; \ 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 dfa4ffe..8852d65 100644 --- a/server/services/agi/scripts/aws/lex/lib/api.js +++ b/server/services/agi/scripts/aws/lex/lib/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0x29ec56,_0x571c66){var _0x961180=function(_0x846792){while(--_0x846792){_0x29ec56['push'](_0x29ec56['shift']());}};_0x961180(++_0x571c66);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file +var _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0x34723b,_0x155298){var _0x1222c1=function(_0x501b31){while(--_0x501b31){_0x34723b['push'](_0x34723b['shift']());}};_0x1222c1(++_0x155298);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/polly/index.js b/server/services/agi/scripts/aws/polly/index.js index 87b08d5..3e39a4d 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 _0xd249=['./lib/api'];(function(_0x150f19,_0x2c7b95){var _0x15a55f=function(_0x5a1c45){while(--_0x5a1c45){_0x150f19['push'](_0x150f19['shift']());}};_0x15a55f(++_0x2c7b95);}(_0xd249,0x1b4));var _0x9d24=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xd249[_0xaa0309];return _0x5de7ce;};'use strict';var polly=require(_0x9d24('0x0'));module['exports']=function(_0x18c065,_0x23d5be,_0x3e61b6,_0x203758,_0x5eab2d,_0x33d53f,_0x580536){return polly(_0x18c065,_0x23d5be,_0x3e61b6,_0x203758,_0x5eab2d,_0x33d53f,_0x580536);}; \ No newline at end of file +var _0x5399=['./lib/api','exports'];(function(_0x1275a4,_0x42087e){var _0x47f26f=function(_0x57531c){while(--_0x57531c){_0x1275a4['push'](_0x1275a4['shift']());}};_0x47f26f(++_0x42087e);}(_0x5399,0xcc));var _0x9539=function(_0x39fd7e,_0x17607d){_0x39fd7e=_0x39fd7e-0x0;var _0x1d5746=_0x5399[_0x39fd7e];return _0x1d5746;};'use strict';var polly=require(_0x9539('0x0'));module[_0x9539('0x1')]=function(_0x279120,_0x46d50a,_0x3d4998,_0x4cb9c3,_0xe13e55,_0x132015,_0x45138f){return polly(_0x279120,_0x46d50a,_0x3d4998,_0x4cb9c3,_0xe13e55,_0x132015,_0x45138f);}; \ 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 7fac9dd..42aaad5 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 _0xce89=['Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','path','randomstring','writeFile','AudioStream'];(function(_0x1bd85d,_0xdc683f){var _0xd40669=function(_0x318648){while(--_0x318648){_0x1bd85d['push'](_0x1bd85d['shift']());}};_0xd40669(++_0xdc683f);}(_0xce89,0x17f));var _0x9ce8=function(_0x2c18a8,_0x24eaa5){_0x2c18a8=_0x2c18a8-0x0;var _0x1e009a=_0xce89[_0x2c18a8];return _0x1e009a;};'use strict';var fs=require('fs');var path=require(_0x9ce8('0x0'));var BPromise=require('bluebird');var rs=require(_0x9ce8('0x1'));var AWS=require('aws-sdk');function pollyResult(_0x3fa4ba,_0x330d3f,_0xd41331){return new BPromise(function(_0x918f91,_0xc44dc3){_0x3fa4ba['synthesizeSpeech'](_0x330d3f,function(_0x23d6ae,_0xf88bf4){if(_0x23d6ae){_0xc44dc3(_0x23d6ae);}else if(_0xf88bf4){if(_0xf88bf4['AudioStream']instanceof Buffer){fs[_0x9ce8('0x2')](_0xd41331,_0xf88bf4[_0x9ce8('0x3')],function(_0x46d468){if(_0x46d468){_0xc44dc3(_0x46d468);}else{_0x918f91();}});}else{_0xc44dc3(new Error(_0x9ce8('0x4')));}}else{_0xc44dc3(new Error(_0x9ce8('0x5')));}});});}module[_0x9ce8('0x6')]=function(_0x66c71c,_0x1a38ed,_0x4d10e6,_0x74fa29,_0x19bfbc,_0x2cf72d,_0x26f273){var _0x818f7c=new AWS[(_0x9ce8('0x7'))]({'accessKeyId':_0x66c71c,'secretAccessKey':_0x1a38ed,'region':_0x4d10e6});var _0x3c4b1d={'Text':_0x19bfbc,'TextType':_0x2cf72d||_0x9ce8('0x8'),'OutputFormat':'mp3','VoiceId':_0x74fa29};return pollyResult(_0x818f7c,_0x3c4b1d,_0x26f273);}; \ No newline at end of file +var _0x1943=['exports','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x18c7e5,_0x4d17a3){var _0x2d5940=function(_0x2a20e4){while(--_0x2a20e4){_0x18c7e5['push'](_0x18c7e5['shift']());}};_0x2d5940(++_0x4d17a3);}(_0x1943,0x110));var _0x3194=function(_0x4c9bf5,_0x4e0251){_0x4c9bf5=_0x4c9bf5-0x0;var _0x335c98=_0x1943[_0x4c9bf5];return _0x335c98;};'use strict';var fs=require('fs');var path=require(_0x3194('0x0'));var BPromise=require(_0x3194('0x1'));var rs=require(_0x3194('0x2'));var AWS=require(_0x3194('0x3'));function pollyResult(_0x55913f,_0x19f705,_0xdf4da){return new BPromise(function(_0x3e81e7,_0x2e9aaf){_0x55913f[_0x3194('0x4')](_0x19f705,function(_0x3ddf43,_0x327fd9){if(_0x3ddf43){_0x2e9aaf(_0x3ddf43);}else if(_0x327fd9){if(_0x327fd9[_0x3194('0x5')]instanceof Buffer){fs['writeFile'](_0xdf4da,_0x327fd9[_0x3194('0x5')],function(_0x16e3c0){if(_0x16e3c0){_0x2e9aaf(_0x16e3c0);}else{_0x3e81e7();}});}else{_0x2e9aaf(new Error(_0x3194('0x6')));}}else{_0x2e9aaf(new Error(_0x3194('0x7')));}});});}module[_0x3194('0x8')]=function(_0x33b728,_0xcd0e93,_0x188bfb,_0x2781e8,_0x3bb538,_0xbae746,_0x8013f0){var _0x300dff=new AWS['Polly']({'accessKeyId':_0x33b728,'secretAccessKey':_0xcd0e93,'region':_0x188bfb});var _0x5ef6d7={'Text':_0x3bb538,'TextType':_0xbae746||'text','OutputFormat':_0x3194('0x9'),'VoiceId':_0x2781e8};return pollyResult(_0x300dff,_0x5ef6d7,_0x8013f0);}; \ 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 498fc45..64c0a6d 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 _0xbc19=['./lib/api'];(function(_0x222fb3,_0x8ffafd){var _0x7ee839=function(_0x2385cb){while(--_0x2385cb){_0x222fb3['push'](_0x222fb3['shift']());}};_0x7ee839(++_0x8ffafd);}(_0xbc19,0x124));var _0x9bc1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbc19[_0x321bb2];return _0x9c12ed;};'use strict';var asr=require(_0x9bc1('0x0'));module['exports']=function(_0x153fcd,_0xecb074,_0x42bea3,_0x4a94c9){return asr(_0x153fcd,_0xecb074,_0x42bea3);}; \ No newline at end of file +var _0x4f0b=['./lib/api','exports'];(function(_0x45ce08,_0x59dcc7){var _0x23dff2=function(_0x1ad0e5){while(--_0x1ad0e5){_0x45ce08['push'](_0x45ce08['shift']());}};_0x23dff2(++_0x59dcc7);}(_0x4f0b,0x1a4));var _0xb4f0=function(_0x5324d1,_0x323a67){_0x5324d1=_0x5324d1-0x0;var _0x1efce3=_0x4f0b[_0x5324d1];return _0x1efce3;};'use strict';var asr=require(_0xb4f0('0x0'));module[_0xb4f0('0x1')]=function(_0x2442e5,_0x5931d5,_0x1ce15f,_0x360266){return asr(_0x2442e5,_0x5931d5,_0x1ce15f);}; \ 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 540187e..1705b15 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 _0x7aaf=['length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','POST','/v1/speech:recognize?key=','8000','url','https://speech.googleapis.com','exports','string'];(function(_0x8d3b4b,_0xd1db47){var _0x509753=function(_0x2e5ef8){while(--_0x2e5ef8){_0x8d3b4b['push'](_0x8d3b4b['shift']());}};_0x509753(++_0xd1db47);}(_0x7aaf,0x1eb));var _0xf7aa=function(_0x439fb8,_0x11ca62){_0x439fb8=_0x439fb8-0x0;var _0x1b09e1=_0x7aaf[_0x439fb8];return _0x1b09e1;};'use strict';var url=require(_0xf7aa('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0xf7aa('0x1');module[_0xf7aa('0x2')]=function(_0x551bfb,_0x4b942e,_0x35575f){return new BPromise(function(_0x573e43,_0x198d5c){var _0x5ee53a;if(typeof _0x551bfb!==_0xf7aa('0x3')||_0x551bfb[_0xf7aa('0x4')]===0x0){return _0x198d5c(_0xf7aa('0x5'));}if(typeof _0x4b942e!==_0xf7aa('0x3')||_0x4b942e['length']===0x0){return _0x198d5c(_0xf7aa('0x6'));}if(typeof _0x35575f!=='undefined'&&(typeof _0x35575f!=='string'||_0x35575f[_0xf7aa('0x4')]===0x0)){return _0x198d5c(_0xf7aa('0x7'));}try{_0x5ee53a=fs['readFileSync'](_0x551bfb)['toString']('base64');}catch(_0x3ee03f){return _0x198d5c(_0x3ee03f);}return _0x573e43({'method':_0xf7aa('0x8'),'uri':host+_0xf7aa('0x9')+_0x4b942e,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0xf7aa('0xa'),'languageCode':_0x35575f},'audio':{'content':_0x5ee53a}},'json':!![]});});}; \ No newline at end of file +var _0x430e=['8000','bluebird','https://speech.googleapis.com','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','readFileSync','toString','base64','POST','LINEAR16'];(function(_0x2d8ee7,_0x1c0ba4){var _0xadf168=function(_0x40773b){while(--_0x40773b){_0x2d8ee7['push'](_0x2d8ee7['shift']());}};_0xadf168(++_0x1c0ba4);}(_0x430e,0x105));var _0xe430=function(_0x1f75d4,_0x183581){_0x1f75d4=_0x1f75d4-0x0;var _0x72f2ca=_0x430e[_0x1f75d4];return _0x72f2ca;};'use strict';var url=require('url');var BPromise=require(_0xe430('0x0'));var fs=require('fs');var host=_0xe430('0x1');module['exports']=function(_0x85af5b,_0x253dfe,_0x36942f){return new BPromise(function(_0x1a9d61,_0x4a1cd1){var _0x3b9e89;if(typeof _0x85af5b!==_0xe430('0x2')||_0x85af5b[_0xe430('0x3')]===0x0){return _0x4a1cd1(_0xe430('0x4'));}if(typeof _0x253dfe!=='string'||_0x253dfe[_0xe430('0x3')]===0x0){return _0x4a1cd1(_0xe430('0x5'));}if(typeof _0x36942f!==_0xe430('0x6')&&(typeof _0x36942f!==_0xe430('0x2')||_0x36942f[_0xe430('0x3')]===0x0)){return _0x4a1cd1('lang\x20should\x20be\x20a\x20string');}try{_0x3b9e89=fs[_0xe430('0x7')](_0x85af5b)[_0xe430('0x8')](_0xe430('0x9'));}catch(_0x22ce49){return _0x4a1cd1(_0x22ce49);}return _0x1a9d61({'method':_0xe430('0xa'),'uri':host+'/v1/speech:recognize?key='+_0x253dfe,'body':{'config':{'encoding':_0xe430('0xb'),'sampleRateHertz':_0xe430('0xc'),'languageCode':_0x36942f},'audio':{'content':_0x3b9e89}},'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 59091a5..732a4fb 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 _0xda09=['./asr','exports'];(function(_0x1d5270,_0x461f18){var _0x3fbe67=function(_0x1dd90f){while(--_0x1dd90f){_0x1d5270['push'](_0x1d5270['shift']());}};_0x3fbe67(++_0x461f18);}(_0xda09,0x132));var _0x9da0=function(_0x56fa3f,_0x45251b){_0x56fa3f=_0x56fa3f-0x0;var _0x5cd780=_0xda09[_0x56fa3f];return _0x5cd780;};var asr=require(_0x9da0('0x0'));module[_0x9da0('0x1')]={'asr':asr}; \ No newline at end of file +var _0x4dcd=['./asr','exports'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x4dcd,0x17c));var _0xd4dc=function(_0x306ca2,_0x2497e4){_0x306ca2=_0x306ca2-0x0;var _0x291f41=_0x4dcd[_0x306ca2];return _0x291f41;};var asr=require(_0xd4dc('0x0'));module[_0xd4dc('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index f3d1c4f..d9c94fe 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 _0x45f9=['https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','download\x20error','pipe','end','data','start','resolve','generate','.wav','writeFileSync','then','unlink','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','audioContent','base64','writeFile','chmodSync','tmp','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','f.req=','jQ1olc','stringify','null','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','.mp3','asr','uri','results','alternatives','transcript','join','confidence','googleASR\x20transcription','catch','name','message','googleDialogflow','result','resolvedQuery','actionIncomplete','speech','score','status','metadata','isFallbackIntent','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','bluebird','http','https','md5','path','querystring','request-promise','randomstring','google-tts-api','url','parse','./sestek','./tilde','../../../config/logger','agi'];(function(_0x214a89,_0x5980c8){var _0x29efc3=function(_0x179b40){while(--_0x179b40){_0x214a89['push'](_0x214a89['shift']());}};_0x29efc3(++_0x5980c8);}(_0x45f9,0xf5));var _0x945f=function(_0x262371,_0x5877df){_0x262371=_0x262371-0x0;var _0x4eeb23=_0x45f9[_0x262371];return _0x4eeb23;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0x945f('0x0'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0x945f('0x1'));var https=require(_0x945f('0x2'));var md5=require(_0x945f('0x3'));var path=require(_0x945f('0x4'));var querystring=require(_0x945f('0x5'));var rp=require(_0x945f('0x6'));var rs=require(_0x945f('0x7'));var sox=require('sox');var tts=require(_0x945f('0x8'));var urlParse=require(_0x945f('0x9'))[_0x945f('0xa')];var util=require('util');var aws=require('./aws');var google=require('./google');var sestek=require(_0x945f('0xb'));var tilde=require(_0x945f('0xc'));var logger=require(_0x945f('0xd'))(_0x945f('0xe'));var ISPEECH_API=_0x945f('0xf');function downloadFile(_0x49c5d6,_0x5f2fcd){return new BPromise(function(_0x3cbc3b,_0x35af88){var _0x59b412=urlParse(_0x49c5d6);var _0x595b28=_0x59b412[_0x945f('0x10')]===_0x945f('0x11')?https:http;var _0x2e39af={'host':_0x59b412[_0x945f('0x12')],'path':_0x59b412[_0x945f('0x4')],'headers':{'user-agent':_0x945f('0x13')}};_0x595b28[_0x945f('0x14')](_0x2e39af,function(_0xc581be){if(_0xc581be['statusCode']!==0xc8){logger[_0x945f('0x15')](_0x945f('0x16')+_0x49c5d6+_0x945f('0x17')+_0xc581be[_0x945f('0x18')]+'\x20('+_0xc581be[_0x945f('0x19')]+')');_0x35af88(new Error(_0x945f('0x16')+_0x49c5d6+_0x945f('0x17')+_0xc581be[_0x945f('0x18')]+'\x20('+_0xc581be[_0x945f('0x19')]+')'));return;}var _0x426cbe=fs[_0x945f('0x1a')](_0x5f2fcd);_0x426cbe['on'](_0x945f('0x1b'),function(){logger[_0x945f('0x1c')](_0x945f('0x1d'));_0x426cbe[_0x945f('0x1e')](_0x3cbc3b);});_0x426cbe['on'](_0x945f('0x15'),function(_0x3e8b1d){fs['unlink'](_0x5f2fcd);logger[_0x945f('0x15')](_0x945f('0x1f'),_0x3e8b1d);_0x35af88(_0x3e8b1d);});_0xc581be[_0x945f('0x20')](_0x426cbe);})['on'](_0x945f('0x15'),function(_0x395cf9){logger[_0x945f('0x15')](_0x395cf9);_0x35af88(_0x395cf9);})[_0x945f('0x21')]();});}function uploadFile(_0x275bf3){return new BPromise(function(_0x5c77d4,_0x278f4b){var _0x458dfa=urlParse(_0x275bf3);var _0x1da64f=_0x458dfa[_0x945f('0x10')]===_0x945f('0x11')?https:http;var _0x41fda8={'host':_0x458dfa[_0x945f('0x12')],'path':_0x458dfa[_0x945f('0x4')],'headers':{'user-agent':'WHAT_EVER'}};_0x1da64f[_0x945f('0x14')](_0x41fda8,function(_0x2ee26a){if(_0x2ee26a[_0x945f('0x18')]!==0xc8){_0x278f4b(new Error(_0x945f('0x16')+_0x275bf3+_0x945f('0x17')+_0x2ee26a[_0x945f('0x18')]+'\x20('+_0x2ee26a[_0x945f('0x19')]+')'));return;}var _0x33535e='';_0x2ee26a['on'](_0x945f('0x22'),function(_0x1d58cb){_0x33535e+=_0x1d58cb;});_0x2ee26a['on']('end',function(){_0x5c77d4(_0x33535e);});})['on'](_0x945f('0x15'),function(_0x2a4a43){_0x278f4b(_0x2a4a43);})[_0x945f('0x21')]();});}function convertFile(_0x1d3d18,_0x3550bf){return new BPromise(function(_0x342c2d,_0x326706){var _0x3cfda9=sox['transcode'](_0x1d3d18,_0x3550bf,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3cfda9['on']('error',function(_0x5bf2e6){logger[_0x945f('0x15')]('error\x20convert',_0x5bf2e6);_0x326706(_0x5bf2e6);});_0x3cfda9['on'](_0x945f('0x21'),function(){logger[_0x945f('0x1c')]('finish\x20to\x20convert');_0x342c2d();});_0x3cfda9[_0x945f('0x23')]();});}function base64Decode(_0x59c49a,_0x597089){var _0x325b0f=path[_0x945f('0x24')](__dirname,'tmp',rs[_0x945f('0x25')](0x4)+_0x945f('0x26'));fs[_0x945f('0x27')](_0x325b0f,_0x59c49a,'base64');return convertFile(_0x325b0f,_0x597089)[_0x945f('0x28')](function(){try{fs[_0x945f('0x29')](_0x325b0f);fs['chmodSync'](_0x597089,_0x945f('0x2a'));}catch(_0x1ad18b){logger[_0x945f('0x15')](_0x1ad18b);}return _0x597089[_0x945f('0x2b')]('.')[0x0];});}function base64Encode(_0x3ec3f3){var _0x307407=fs[_0x945f('0x2c')](_0x3ec3f3);return new Buffer(_0x307407)[_0x945f('0x2d')]('base64');}exports[_0x945f('0x2e')]=function(_0x186da9,_0xaee91f,_0x191efe,_0x4f4b45,_0xf4e0ec,_0x3cb8ad){var _0x500379,_0x5d09ae;var _0x15c774=_0x945f('0x2f');var _0x2b85fa=_0x945f('0x30')+_0x186da9;var _0x3d5dc2={};if(_0xaee91f===_0x945f('0x31')){_0x3d5dc2[_0x945f('0x32')]={'ssml':_0x191efe};}else{_0x3d5dc2[_0x945f('0x32')]={'text':_0x191efe};};_0x3d5dc2[_0x945f('0x33')]={'languageCode':_0x4f4b45,'ssmlGender':_0xf4e0ec};_0x3d5dc2[_0x945f('0x34')]={'audioEncoding':_0x945f('0x35'),'sampleRateHertz':0x1f40};var _0xdd67fb={'url':_0x15c774+_0x945f('0x36')+_0x2b85fa,'method':_0x945f('0x37'),'json':!![],'body':_0x3d5dc2};return rp(_0xdd67fb)['then'](function(_0x5900ab){return new BPromise(function(_0x5c931d,_0x37e4f9){_0x500379=path[_0x945f('0x24')](__dirname,'tmp',rs[_0x945f('0x25')](0x4)+'.mp3');var _0x39c1c9=Buffer['from'](_0x5900ab[_0x945f('0x38')],_0x945f('0x39'));return fs[_0x945f('0x3a')](_0x500379,_0x39c1c9,function(_0x1b5dfe){_0x37e4f9(_0x1b5dfe);},function(_0x242ce5){fs[_0x945f('0x3b')](_0x500379,'777');_0x5c931d(_0x242ce5);});});})['then'](function(_0x465dfe){_0x5d09ae=path['resolve'](__dirname,_0x945f('0x3c'),rs[_0x945f('0x25')](0x4)+_0x945f('0x26'));return convertFile(_0x500379,_0x5d09ae);})['then'](function(){try{fs[_0x945f('0x29')](_0x500379);fs['chmodSync'](_0x5d09ae,_0x945f('0x2a'));}catch(_0x6ae5f6){logger[_0x945f('0x15')](_0x6ae5f6);}logger[_0x945f('0x1c')](_0x945f('0x3d'),_0x5d09ae[_0x945f('0x2b')]('.')[0x0]);return _0x5d09ae[_0x945f('0x2b')]('.')[0x0];});};exports[_0x945f('0x3e')]=function(_0x5cdea3,_0x3e50d7){var _0x5173ad=_0x945f('0x3f');var _0x34cff2,_0x2fe79b;var _0xdedec6;var _0x1c2ee0={'encoding':'utf8','method':_0x945f('0x37'),'timeout':0x2710,'url':_0x5173ad,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0x945f('0x40')+encodeURIComponent(JSON['stringify']([[[_0x945f('0x41'),JSON[_0x945f('0x42')]([_0x5cdea3,_0x3e50d7||'en',![],_0x945f('0x43')]),null,'generic']]]))};return rp(_0x1c2ee0)[_0x945f('0x28')](function(_0x16de40){try{_0xdedec6=eval(_0x16de40[_0x945f('0x44')](0x5))[0x0][0x2];}catch(_0x30a0e8){throw new Error(_0x945f('0x45')+_0x16de40[_0x945f('0x22')]);}if(!_0xdedec6){if(_0x5cdea3[_0x945f('0x46')]>0xc8){throw new Error(_0x945f('0x47'));}else{throw new Error(_0x945f('0x48')+_0x3e50d7+_0x945f('0x49'));}}try{_0xdedec6=eval(_0xdedec6)[0x0];}catch(_0x2ba45b){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x945f('0x22')]);}const _0x58dc13=_0xdedec6;_0x34cff2=path[_0x945f('0x24')](__dirname,_0x945f('0x3c'),rs[_0x945f('0x25')](0x4)+_0x945f('0x4a'));fs['writeFileSync'](_0x34cff2,_0xdedec6,{'encoding':_0x945f('0x39')});_0x2fe79b=path['resolve'](__dirname,_0x945f('0x3c'),rs['generate'](0x4)+_0x945f('0x26'));return convertFile(_0x34cff2,_0x2fe79b);})[_0x945f('0x28')](function(){try{fs[_0x945f('0x29')](_0x34cff2);fs[_0x945f('0x3b')](_0x2fe79b,'777');}catch(_0x5226b6){logger[_0x945f('0x15')](_0x5226b6);}logger['info']('goggleTTS\x20path',_0x2fe79b[_0x945f('0x2b')]('.')[0x0]);return _0x2fe79b['split']('.')[0x0];});};exports['googleASR']=function(_0x299e54,_0x69550d,_0x1cb003){return google[_0x945f('0x4b')](_0x299e54,_0x69550d,_0x1cb003)['then'](function(_0x30e71a){logger[_0x945f('0x1c')](_0x30e71a[_0x945f('0x4c')]);return rp(_0x30e71a);})[_0x945f('0x28')](function(_0x4c846c){var _0x58d476='';var _0x1ccf2b=0x0;try{fs[_0x945f('0x29')](_0x299e54);}catch(_0x21f0f7){logger[_0x945f('0x15')](_0x21f0f7);}if(_0x4c846c&&_0x4c846c[_0x945f('0x4d')]){_0x58d476=_0x4c846c[_0x945f('0x4d')]['map'](function(_0x4fe4ce){return _0x4fe4ce&&_0x4fe4ce[_0x945f('0x4e')][0x0]&&_0x4fe4ce[_0x945f('0x4e')][0x0][_0x945f('0x4f')]?_0x4fe4ce[_0x945f('0x4e')][0x0][_0x945f('0x4f')]:'';})[_0x945f('0x50')]('\x0a');_0x1ccf2b=_0x4c846c[_0x945f('0x4d')]['map'](function(_0x4a2191){return _0x4a2191&&_0x4a2191[_0x945f('0x4e')][0x0]&&_0x4a2191[_0x945f('0x4e')][0x0][_0x945f('0x51')]?_0x4a2191[_0x945f('0x4e')][0x0][_0x945f('0x51')]:0x0;})[_0x945f('0x50')]('\x0a');}logger['info'](_0x945f('0x52'),_0x58d476);logger['info']('googleASR\x20confidence',_0x1ccf2b);return{'transcript':_0x58d476,'confidence':_0x1ccf2b};})[_0x945f('0x53')](function(_0x427380){logger['error']('[%s]\x20%s:%s',_0x427380['statusCode'],_0x427380[_0x945f('0x54')],_0x427380[_0x945f('0x55')]);});};exports[_0x945f('0x56')]=function(_0x5831a2,_0x5ebcd7,_0x26208c,_0x501892){var _0x333d33=apiai(_0x5ebcd7,{'language':_0x501892||'en'});return _0x333d33['textRequest'](_0x26208c,{'sessionId':md5(_0x5831a2)})[_0x945f('0x28')](function(_0xb9ce6){logger[_0x945f('0x1c')](JSON[_0x945f('0x42')](_0xb9ce6));return{'source':_0xb9ce6[_0x945f('0x57')]['source'],'resolvedQuery':_0xb9ce6[_0x945f('0x57')][_0x945f('0x58')],'action':_0xb9ce6['result']['action'],'actionIncomplete':_0xb9ce6['result'][_0x945f('0x59')],'speech':_0xb9ce6[_0x945f('0x57')]['fulfillment'][_0x945f('0x5a')],'score':_0xb9ce6[_0x945f('0x57')][_0x945f('0x5b')],'statusCode':_0xb9ce6[_0x945f('0x5c')]['code'],'endConversation':_0xb9ce6['result'][_0x945f('0x5d')]['endConversation']||![],'isFallbackIntent':_0xb9ce6['result'][_0x945f('0x5d')][_0x945f('0x5e')]};});};exports['googleDialogflowV2']=function(_0x4ae341,_0x2444af,_0x4c05a1,_0x499fd0,_0x433016,_0x293636){var _0x37ab8c=_0x499fd0['replace'](/\\n/g,'\x0a');var _0x4dbd73={'credentials':{'private_key':_0x37ab8c,'client_email':_0x4c05a1}};var _0x15b1d4=new dialogflow[(_0x945f('0x5f'))](_0x4dbd73);var _0x585ef2=_0x15b1d4[_0x945f('0x60')](_0x2444af,md5(_0x4ae341));var _0x1fd739={'session':_0x585ef2,'queryInput':{'text':{'text':_0x433016,'languageCode':_0x293636}}};return _0x15b1d4[_0x945f('0x61')](_0x1fd739)[_0x945f('0x28')](function(_0x437c51){if(_0x437c51&&_0x437c51['length']){logger[_0x945f('0x1c')](_0x945f('0x62'),JSON[_0x945f('0x42')](_0x437c51));var _0xdfc22=_0x437c51[0x0];if(_0xdfc22){var _0xdc45df={'action':_0xdfc22[_0x945f('0x63')]['action'],'allRequiredParamsPresent':_0xdfc22[_0x945f('0x63')][_0x945f('0x64')],'endConversation':_0xdfc22['queryResult'][_0x945f('0x65')]&&_0xdfc22[_0x945f('0x63')][_0x945f('0x65')]['fields']?_0xdfc22[_0x945f('0x63')][_0x945f('0x65')]['fields']['end_conversation'][_0x945f('0x66')]:![],'fulfillmentText':_0xdfc22[_0x945f('0x63')][_0x945f('0x67')],'intentName':_0xdfc22[_0x945f('0x63')][_0x945f('0x68')][_0x945f('0x54')],'intentDisplayName':_0xdfc22['queryResult'][_0x945f('0x68')][_0x945f('0x69')],'isFallbackIntent':_0xdfc22[_0x945f('0x63')][_0x945f('0x68')][_0x945f('0x6a')],'languageCode':_0xdfc22[_0x945f('0x63')][_0x945f('0x6b')],'queryText':_0xdfc22[_0x945f('0x63')][_0x945f('0x6c')],'responseId':_0xdfc22[_0x945f('0x6d')],'score':_0xdfc22[_0x945f('0x63')][_0x945f('0x6e')],'speech':_0xdfc22[_0x945f('0x63')][_0x945f('0x67')],'providerResponse':JSON['stringify'](_0x437c51)};return _0xdc45df;}}});};exports[_0x945f('0x6f')]=function(_0x3ff1b8,_0x30257d,_0x1a60d9,_0x4f7b46){return tilde[_0x945f('0x4b')](_0x3ff1b8,_0x30257d,_0x1a60d9,_0x4f7b46)[_0x945f('0x28')](function(_0x51b738){try{fs[_0x945f('0x29')](_0x3ff1b8);}catch(_0x587278){logger['error'](_0x587278);}logger['info'](_0x945f('0x70'),_0x51b738[_0x945f('0x4f')]);logger[_0x945f('0x1c')](_0x945f('0x71'),_0x51b738[_0x945f('0x51')]);return _0x51b738;});};exports[_0x945f('0x72')]=function(_0x3b11e5,_0x126afe,_0x5ad866,_0x40e476,_0x38d60,_0x2e0025){var _0xe86d2a=path[_0x945f('0x24')](__dirname,_0x945f('0x3c'),rs[_0x945f('0x25')](0x4)+_0x945f('0x4a'));var _0x1614db;return aws[_0x945f('0x73')](_0x3b11e5,_0x126afe,_0x5ad866,_0x40e476,_0x38d60,_0x2e0025,_0xe86d2a)[_0x945f('0x28')](function(){_0x1614db=path[_0x945f('0x24')](__dirname,_0x945f('0x3c'),rs['generate'](0x4)+'.wav');return convertFile(_0xe86d2a,_0x1614db);})[_0x945f('0x28')](function(){try{fs[_0x945f('0x29')](_0xe86d2a);fs[_0x945f('0x3b')](_0x1614db,'777');}catch(_0x12a7cc){logger[_0x945f('0x15')](_0x12a7cc);}return _0x1614db[_0x945f('0x2b')]('.')[0x0];});};exports[_0x945f('0x74')]=function(_0x280acd,_0x109d6d,_0xa62df6,_0x4016f0,_0x38c4dc,_0x3a5bd9){return aws[_0x945f('0x75')](_0x280acd,_0x109d6d,_0xa62df6,_0x4016f0,_0x38c4dc,_0x3a5bd9)['then'](function(_0x471dfa){logger[_0x945f('0x1c')](JSON[_0x945f('0x42')](_0x471dfa));return _0x471dfa;});};exports[_0x945f('0x76')]=function(_0x3b5630,_0x3a91d9,_0x2fba88,_0x502372){var _0x1c93b0=util[_0x945f('0x77')](_0x945f('0x78'),ISPEECH_API,_0x3b5630,encodeURIComponent(_0x3a91d9),_0x2fba88,_0x502372);var _0x18102b=path[_0x945f('0x24')](__dirname,_0x945f('0x3c'),rs[_0x945f('0x25')](0x4)+_0x945f('0x4a'));var _0x10ddf3;return downloadFile(_0x1c93b0,_0x18102b)[_0x945f('0x28')](function(){_0x10ddf3=path[_0x945f('0x24')](__dirname,'tmp',rs[_0x945f('0x25')](0x4)+_0x945f('0x26'));return convertFile(_0x18102b,_0x10ddf3);})['then'](function(){try{fs[_0x945f('0x29')](_0x18102b);fs[_0x945f('0x3b')](_0x10ddf3,_0x945f('0x2a'));}catch(_0x39f025){logger[_0x945f('0x15')](_0x39f025);}return _0x10ddf3['split']('.')[0x0];});};exports['ispeechASR']=function(_0x12d89d,_0x455ae9,_0x36c164,_0xfd706b){var _0x3b705c=util['format'](_0x945f('0x79'),ISPEECH_API,_0x455ae9,_0x36c164,base64Encode(_0x12d89d),_0xfd706b?util[_0x945f('0x77')](_0x945f('0x7a'),encodeURIComponent(_0xfd706b)):'freeform=3');return uploadFile(_0x3b705c)[_0x945f('0x28')](function(_0x9ac1a9){return querystring[_0x945f('0xa')](_0x9ac1a9);});};exports['sestekNDA']=function(_0x42f913,_0x52fbe6){return sestek['nda'](_0x42f913,_0x52fbe6)[_0x945f('0x28')](function(_0x451c9c){logger[_0x945f('0x1c')](JSON['stringify'](_0x451c9c));var _0x5df69f={'speech':_0x451c9c[_0x945f('0x7b')],'action':_0x451c9c[_0x945f('0x7c')]?_0x451c9c['channelData'][_0x945f('0x7d')]:undefined,'actiondata':_0x451c9c['channelData']?_0x451c9c['channelData'][_0x945f('0x7e')]:undefined};if(_0x451c9c['channelData']&&_0x451c9c['channelData'][_0x945f('0x7f')]){return base64Decode(_0x451c9c[_0x945f('0x7c')][_0x945f('0x7f')][_0x945f('0x80')],path[_0x945f('0x24')](__dirname,_0x945f('0x3c'),rs['generate'](0x4)+'.wav'))[_0x945f('0x28')](function(_0x1ac500){_0x5df69f[_0x945f('0x81')]=_0x1ac500;return _0x5df69f;});}return _0x5df69f;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file +var _0x0631=['then','chmodSync','777','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','.mp3','audioContent','googleCloudTTS\x20path','split','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','slice','length','lang\x20\x22','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','goggleTTS\x20path','asr','uri','results','map','alternatives','transcript','confidence','join','googleASR\x20transcription','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','source','fulfillment','score','status','code','metadata','endConversation','googleDialogflowV2','replace','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','action','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','intent','displayName','isFallback','queryText','responseId','intentDetectionConfidence','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','model=%s','sestekNDA','nda','text','channelData','CustomActionData','AudioFromTts','Data','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','path','querystring','request-promise','randomstring','sox','google-tts-api','url','util','./google','./sestek','./tilde','../../../config/logger','agi','protocol','https:','host','WHAT_EVER','get','statusCode','error','\x20failed,\x20status\x20code\x20=\x20','statusMessage','request\x20to\x20','createWriteStream','finish','info','close','unlink','download\x20error','pipe','end','data','transcode','error\x20convert','finish\x20to\x20convert','resolve','tmp','generate','.wav','base64'];(function(_0xa69282,_0x3d470a){var _0x196882=function(_0x5c038c){while(--_0x5c038c){_0xa69282['push'](_0xa69282['shift']());}};_0x196882(++_0x3d470a);}(_0x0631,0x15e));var _0x1063=function(_0x43291d,_0x166561){_0x43291d=_0x43291d-0x0;var _0x6c48ff=_0x0631[_0x43291d];return _0x6c48ff;};'use strict';var apiai=require(_0x1063('0x0'));var BPromise=require(_0x1063('0x1'));var dialogflow=require(_0x1063('0x2'));var fs=require('fs');var http=require(_0x1063('0x3'));var https=require(_0x1063('0x4'));var md5=require(_0x1063('0x5'));var path=require(_0x1063('0x6'));var querystring=require(_0x1063('0x7'));var rp=require(_0x1063('0x8'));var rs=require(_0x1063('0x9'));var sox=require(_0x1063('0xa'));var tts=require(_0x1063('0xb'));var urlParse=require(_0x1063('0xc'))['parse'];var util=require(_0x1063('0xd'));var aws=require('./aws');var google=require(_0x1063('0xe'));var sestek=require(_0x1063('0xf'));var tilde=require(_0x1063('0x10'));var logger=require(_0x1063('0x11'))(_0x1063('0x12'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x3e1730,_0x25fa0a){return new BPromise(function(_0x5edb6e,_0xcd3075){var _0x278560=urlParse(_0x3e1730);var _0x203d94=_0x278560[_0x1063('0x13')]===_0x1063('0x14')?https:http;var _0x4dcabf={'host':_0x278560[_0x1063('0x15')],'path':_0x278560[_0x1063('0x6')],'headers':{'user-agent':_0x1063('0x16')}};_0x203d94[_0x1063('0x17')](_0x4dcabf,function(_0x396042){if(_0x396042[_0x1063('0x18')]!==0xc8){logger[_0x1063('0x19')]('request\x20to\x20'+_0x3e1730+_0x1063('0x1a')+_0x396042[_0x1063('0x18')]+'\x20('+_0x396042[_0x1063('0x1b')]+')');_0xcd3075(new Error(_0x1063('0x1c')+_0x3e1730+'\x20failed,\x20status\x20code\x20=\x20'+_0x396042['statusCode']+'\x20('+_0x396042[_0x1063('0x1b')]+')'));return;}var _0x5aabb4=fs[_0x1063('0x1d')](_0x25fa0a);_0x5aabb4['on'](_0x1063('0x1e'),function(){logger[_0x1063('0x1f')]('finish\x20download\x20file');_0x5aabb4[_0x1063('0x20')](_0x5edb6e);});_0x5aabb4['on'](_0x1063('0x19'),function(_0x12664a){fs[_0x1063('0x21')](_0x25fa0a);logger[_0x1063('0x19')](_0x1063('0x22'),_0x12664a);_0xcd3075(_0x12664a);});_0x396042[_0x1063('0x23')](_0x5aabb4);})['on'](_0x1063('0x19'),function(_0x33b695){logger[_0x1063('0x19')](_0x33b695);_0xcd3075(_0x33b695);})[_0x1063('0x24')]();});}function uploadFile(_0x6b446){return new BPromise(function(_0x101168,_0x3cbab8){var _0x53285c=urlParse(_0x6b446);var _0x445e6a=_0x53285c['protocol']===_0x1063('0x14')?https:http;var _0x4494a0={'host':_0x53285c[_0x1063('0x15')],'path':_0x53285c[_0x1063('0x6')],'headers':{'user-agent':_0x1063('0x16')}};_0x445e6a['get'](_0x4494a0,function(_0x380606){if(_0x380606[_0x1063('0x18')]!==0xc8){_0x3cbab8(new Error('request\x20to\x20'+_0x6b446+_0x1063('0x1a')+_0x380606[_0x1063('0x18')]+'\x20('+_0x380606[_0x1063('0x1b')]+')'));return;}var _0x11b78e='';_0x380606['on'](_0x1063('0x25'),function(_0x4e6507){_0x11b78e+=_0x4e6507;});_0x380606['on']('end',function(){_0x101168(_0x11b78e);});})['on'](_0x1063('0x19'),function(_0x519d19){_0x3cbab8(_0x519d19);})[_0x1063('0x24')]();});}function convertFile(_0x3b227a,_0x209e5a){return new BPromise(function(_0x3e855b,_0x80bb6b){var _0x3d486f=sox[_0x1063('0x26')](_0x3b227a,_0x209e5a,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3d486f['on'](_0x1063('0x19'),function(_0x242ca8){logger[_0x1063('0x19')](_0x1063('0x27'),_0x242ca8);_0x80bb6b(_0x242ca8);});_0x3d486f['on'](_0x1063('0x24'),function(){logger[_0x1063('0x1f')](_0x1063('0x28'));_0x3e855b();});_0x3d486f['start']();});}function base64Decode(_0x17d985,_0x5e7042){var _0x4f3add=path[_0x1063('0x29')](__dirname,_0x1063('0x2a'),rs[_0x1063('0x2b')](0x4)+_0x1063('0x2c'));fs['writeFileSync'](_0x4f3add,_0x17d985,_0x1063('0x2d'));return convertFile(_0x4f3add,_0x5e7042)[_0x1063('0x2e')](function(){try{fs[_0x1063('0x21')](_0x4f3add);fs[_0x1063('0x2f')](_0x5e7042,_0x1063('0x30'));}catch(_0x126026){logger[_0x1063('0x19')](_0x126026);}return _0x5e7042['split']('.')[0x0];});}function base64Encode(_0x56a26a){var _0x454561=fs[_0x1063('0x31')](_0x56a26a);return new Buffer(_0x454561)[_0x1063('0x32')](_0x1063('0x2d'));}exports[_0x1063('0x33')]=function(_0x4c16ad,_0x270285,_0x356e54,_0x465b27,_0x5395d5,_0x5da96a){var _0x319ed0,_0x56b984;var _0x5e89ac=_0x1063('0x34');var _0x1d4090=_0x1063('0x35')+_0x4c16ad;var _0x3ec467={};if(_0x270285===_0x1063('0x36')){_0x3ec467[_0x1063('0x37')]={'ssml':_0x356e54};}else{_0x3ec467[_0x1063('0x37')]={'text':_0x356e54};};_0x3ec467[_0x1063('0x38')]={'languageCode':_0x465b27,'ssmlGender':_0x5395d5};_0x3ec467[_0x1063('0x39')]={'audioEncoding':_0x1063('0x3a'),'sampleRateHertz':0x1f40};var _0xb9995b={'url':_0x5e89ac+_0x1063('0x3b')+_0x1d4090,'method':_0x1063('0x3c'),'json':!![],'body':_0x3ec467};return rp(_0xb9995b)['then'](function(_0x10239c){return new BPromise(function(_0x5b824b,_0x43fd21){_0x319ed0=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0x1063('0x3d'));var _0x5795c6=Buffer['from'](_0x10239c[_0x1063('0x3e')],_0x1063('0x2d'));return fs['writeFile'](_0x319ed0,_0x5795c6,function(_0x1c9793){_0x43fd21(_0x1c9793);},function(_0x4f77aa){fs[_0x1063('0x2f')](_0x319ed0,_0x1063('0x30'));_0x5b824b(_0x4f77aa);});});})['then'](function(_0x545f57){_0x56b984=path[_0x1063('0x29')](__dirname,_0x1063('0x2a'),rs[_0x1063('0x2b')](0x4)+_0x1063('0x2c'));return convertFile(_0x319ed0,_0x56b984);})[_0x1063('0x2e')](function(){try{fs[_0x1063('0x21')](_0x319ed0);fs['chmodSync'](_0x56b984,_0x1063('0x30'));}catch(_0x446955){logger['error'](_0x446955);}logger['info'](_0x1063('0x3f'),_0x56b984[_0x1063('0x40')]('.')[0x0]);return _0x56b984[_0x1063('0x40')]('.')[0x0];});};exports['googleTTS']=function(_0x42be51,_0x16a4d1){var _0x5f4e78='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x38bbc9,_0x23f0df;var _0x18a839;var _0x2f71ec={'encoding':'utf8','method':_0x1063('0x3c'),'timeout':0x2710,'url':_0x5f4e78,'headers':{'Content-Type':_0x1063('0x41')},'body':_0x1063('0x42')+encodeURIComponent(JSON[_0x1063('0x43')]([[[_0x1063('0x44'),JSON[_0x1063('0x43')]([_0x42be51,_0x16a4d1||'en',![],_0x1063('0x45')]),null,'generic']]]))};return rp(_0x2f71ec)[_0x1063('0x2e')](function(_0x4a1e35){try{_0x18a839=eval(_0x4a1e35[_0x1063('0x46')](0x5))[0x0][0x2];}catch(_0x42b6d9){throw new Error('parse\x20response\x20failed:\x0a'+_0x4a1e35[_0x1063('0x25')]);}if(!_0x18a839){if(_0x42be51[_0x1063('0x47')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0x1063('0x48')+_0x16a4d1+_0x1063('0x49'));}}try{_0x18a839=eval(_0x18a839)[0x0];}catch(_0xc57d11){throw new Error(_0x1063('0x4a')+res[_0x1063('0x25')]);}const _0x557a1b=_0x18a839;_0x38bbc9=path[_0x1063('0x29')](__dirname,'tmp',rs['generate'](0x4)+_0x1063('0x3d'));fs['writeFileSync'](_0x38bbc9,_0x18a839,{'encoding':'base64'});_0x23f0df=path[_0x1063('0x29')](__dirname,_0x1063('0x2a'),rs[_0x1063('0x2b')](0x4)+_0x1063('0x2c'));return convertFile(_0x38bbc9,_0x23f0df);})[_0x1063('0x2e')](function(){try{fs[_0x1063('0x21')](_0x38bbc9);fs['chmodSync'](_0x23f0df,_0x1063('0x30'));}catch(_0x3438d4){logger[_0x1063('0x19')](_0x3438d4);}logger['info'](_0x1063('0x4b'),_0x23f0df['split']('.')[0x0]);return _0x23f0df[_0x1063('0x40')]('.')[0x0];});};exports['googleASR']=function(_0x43b064,_0x19f770,_0xb2d4be){return google[_0x1063('0x4c')](_0x43b064,_0x19f770,_0xb2d4be)['then'](function(_0xbe3dd4){logger[_0x1063('0x1f')](_0xbe3dd4[_0x1063('0x4d')]);return rp(_0xbe3dd4);})['then'](function(_0xd31ff2){var _0xf9b506='';var _0x16f3a2=0x0;try{fs[_0x1063('0x21')](_0x43b064);}catch(_0x114058){logger['error'](_0x114058);}if(_0xd31ff2&&_0xd31ff2['results']){_0xf9b506=_0xd31ff2[_0x1063('0x4e')][_0x1063('0x4f')](function(_0x29b444){return _0x29b444&&_0x29b444[_0x1063('0x50')][0x0]&&_0x29b444['alternatives'][0x0][_0x1063('0x51')]?_0x29b444[_0x1063('0x50')][0x0][_0x1063('0x51')]:'';})['join']('\x0a');_0x16f3a2=_0xd31ff2['results'][_0x1063('0x4f')](function(_0x296660){return _0x296660&&_0x296660['alternatives'][0x0]&&_0x296660[_0x1063('0x50')][0x0][_0x1063('0x52')]?_0x296660['alternatives'][0x0][_0x1063('0x52')]:0x0;})[_0x1063('0x53')]('\x0a');}logger[_0x1063('0x1f')](_0x1063('0x54'),_0xf9b506);logger[_0x1063('0x1f')]('googleASR\x20confidence',_0x16f3a2);return{'transcript':_0xf9b506,'confidence':_0x16f3a2};})['catch'](function(_0x10ead0){logger['error'](_0x1063('0x55'),_0x10ead0[_0x1063('0x18')],_0x10ead0[_0x1063('0x56')],_0x10ead0[_0x1063('0x57')]);});};exports[_0x1063('0x58')]=function(_0x30bd2b,_0x3316f6,_0x1bcea2,_0x223b59){var _0xb5237=apiai(_0x3316f6,{'language':_0x223b59||'en'});return _0xb5237[_0x1063('0x59')](_0x1bcea2,{'sessionId':md5(_0x30bd2b)})[_0x1063('0x2e')](function(_0x3d94b6){logger[_0x1063('0x1f')](JSON[_0x1063('0x43')](_0x3d94b6));return{'source':_0x3d94b6[_0x1063('0x5a')][_0x1063('0x5b')],'resolvedQuery':_0x3d94b6[_0x1063('0x5a')]['resolvedQuery'],'action':_0x3d94b6['result']['action'],'actionIncomplete':_0x3d94b6[_0x1063('0x5a')]['actionIncomplete'],'speech':_0x3d94b6[_0x1063('0x5a')][_0x1063('0x5c')]['speech'],'score':_0x3d94b6['result'][_0x1063('0x5d')],'statusCode':_0x3d94b6[_0x1063('0x5e')][_0x1063('0x5f')],'endConversation':_0x3d94b6[_0x1063('0x5a')][_0x1063('0x60')][_0x1063('0x61')]||![],'isFallbackIntent':_0x3d94b6[_0x1063('0x5a')][_0x1063('0x60')]['isFallbackIntent']};});};exports[_0x1063('0x62')]=function(_0x52d009,_0x199e7d,_0x4fa835,_0x236ff6,_0x1fe26c,_0x5cd77a){var _0x5807df=_0x236ff6[_0x1063('0x63')](/\\n/g,'\x0a');var _0x265728={'credentials':{'private_key':_0x5807df,'client_email':_0x4fa835}};var _0x1c09f0=new dialogflow['SessionsClient'](_0x265728);var _0x5458b3=_0x1c09f0[_0x1063('0x64')](_0x199e7d,md5(_0x52d009));var _0x1f0d21={'session':_0x5458b3,'queryInput':{'text':{'text':_0x1fe26c,'languageCode':_0x5cd77a}}};return _0x1c09f0[_0x1063('0x65')](_0x1f0d21)['then'](function(_0x40f22c){if(_0x40f22c&&_0x40f22c[_0x1063('0x47')]){logger[_0x1063('0x1f')](_0x1063('0x66'),JSON[_0x1063('0x43')](_0x40f22c));var _0x36370a=_0x40f22c[0x0];if(_0x36370a){var _0x3e77d7={'action':_0x36370a[_0x1063('0x67')][_0x1063('0x68')],'allRequiredParamsPresent':_0x36370a[_0x1063('0x67')][_0x1063('0x69')],'endConversation':_0x36370a[_0x1063('0x67')][_0x1063('0x6a')]&&_0x36370a[_0x1063('0x67')][_0x1063('0x6a')]['fields']?_0x36370a[_0x1063('0x67')][_0x1063('0x6a')][_0x1063('0x6b')][_0x1063('0x6c')][_0x1063('0x6d')]:![],'fulfillmentText':_0x36370a[_0x1063('0x67')]['fulfillmentText'],'intentName':_0x36370a[_0x1063('0x67')]['intent'][_0x1063('0x56')],'intentDisplayName':_0x36370a[_0x1063('0x67')][_0x1063('0x6e')][_0x1063('0x6f')],'isFallbackIntent':_0x36370a['queryResult'][_0x1063('0x6e')][_0x1063('0x70')],'languageCode':_0x36370a[_0x1063('0x67')]['languageCode'],'queryText':_0x36370a[_0x1063('0x67')][_0x1063('0x71')],'responseId':_0x36370a[_0x1063('0x72')],'score':_0x36370a[_0x1063('0x67')][_0x1063('0x73')],'speech':_0x36370a[_0x1063('0x67')]['fulfillmentText'],'providerResponse':JSON[_0x1063('0x43')](_0x40f22c)};return _0x3e77d7;}}});};exports['tildeASR']=function(_0x8636ef,_0x417074,_0x4c8f6d,_0x1da454){return tilde['asr'](_0x8636ef,_0x417074,_0x4c8f6d,_0x1da454)[_0x1063('0x2e')](function(_0x91e4fd){try{fs['unlink'](_0x8636ef);}catch(_0x1d9034){logger['error'](_0x1d9034);}logger['info'](_0x1063('0x74'),_0x91e4fd['transcript']);logger['info'](_0x1063('0x75'),_0x91e4fd['confidence']);return _0x91e4fd;});};exports[_0x1063('0x76')]=function(_0x5b5b22,_0x399cf7,_0x176920,_0x314be6,_0x1e14ff,_0x58ed57){var _0xd6b880=path[_0x1063('0x29')](__dirname,'tmp',rs[_0x1063('0x2b')](0x4)+_0x1063('0x3d'));var _0x2167b7;return aws[_0x1063('0x77')](_0x5b5b22,_0x399cf7,_0x176920,_0x314be6,_0x1e14ff,_0x58ed57,_0xd6b880)[_0x1063('0x2e')](function(){_0x2167b7=path['resolve'](__dirname,_0x1063('0x2a'),rs['generate'](0x4)+'.wav');return convertFile(_0xd6b880,_0x2167b7);})['then'](function(){try{fs[_0x1063('0x21')](_0xd6b880);fs[_0x1063('0x2f')](_0x2167b7,_0x1063('0x30'));}catch(_0x2597dd){logger[_0x1063('0x19')](_0x2597dd);}return _0x2167b7['split']('.')[0x0];});};exports[_0x1063('0x78')]=function(_0x2f6f97,_0x5b1b8c,_0x1adefa,_0x2cd12c,_0x1c64b4,_0x37ad14){return aws['lex'](_0x2f6f97,_0x5b1b8c,_0x1adefa,_0x2cd12c,_0x1c64b4,_0x37ad14)[_0x1063('0x2e')](function(_0x5c4d53){logger['info'](JSON['stringify'](_0x5c4d53));return _0x5c4d53;});};exports['ispeechTTS']=function(_0x591a03,_0x25be32,_0x532f1b,_0x3a3d56){var _0x4def46=util[_0x1063('0x79')](_0x1063('0x7a'),ISPEECH_API,_0x591a03,encodeURIComponent(_0x25be32),_0x532f1b,_0x3a3d56);var _0x3b38a8=path['resolve'](__dirname,'tmp',rs[_0x1063('0x2b')](0x4)+_0x1063('0x3d'));var _0x1415b3;return downloadFile(_0x4def46,_0x3b38a8)['then'](function(){_0x1415b3=path[_0x1063('0x29')](__dirname,_0x1063('0x2a'),rs['generate'](0x4)+_0x1063('0x2c'));return convertFile(_0x3b38a8,_0x1415b3);})[_0x1063('0x2e')](function(){try{fs[_0x1063('0x21')](_0x3b38a8);fs['chmodSync'](_0x1415b3,_0x1063('0x30'));}catch(_0x1a4de6){logger[_0x1063('0x19')](_0x1a4de6);}return _0x1415b3[_0x1063('0x40')]('.')[0x0];});};exports['ispeechASR']=function(_0x4444f5,_0x590e4d,_0x272b73,_0x45fb6f){var _0x5e8dec=util[_0x1063('0x79')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x590e4d,_0x272b73,base64Encode(_0x4444f5),_0x45fb6f?util[_0x1063('0x79')](_0x1063('0x7b'),encodeURIComponent(_0x45fb6f)):'freeform=3');return uploadFile(_0x5e8dec)[_0x1063('0x2e')](function(_0x5ab1fc){return querystring['parse'](_0x5ab1fc);});};exports[_0x1063('0x7c')]=function(_0x1288f2,_0x2d5521){return sestek[_0x1063('0x7d')](_0x1288f2,_0x2d5521)[_0x1063('0x2e')](function(_0x3574f8){logger[_0x1063('0x1f')](JSON[_0x1063('0x43')](_0x3574f8));var _0x27d66f={'speech':_0x3574f8[_0x1063('0x7e')],'action':_0x3574f8[_0x1063('0x7f')]?_0x3574f8['channelData']['CustomAction']:undefined,'actiondata':_0x3574f8[_0x1063('0x7f')]?_0x3574f8[_0x1063('0x7f')][_0x1063('0x80')]:undefined};if(_0x3574f8['channelData']&&_0x3574f8[_0x1063('0x7f')]['AudioFromTts']){return base64Decode(_0x3574f8[_0x1063('0x7f')][_0x1063('0x81')][_0x1063('0x82')],path[_0x1063('0x29')](__dirname,_0x1063('0x2a'),rs['generate'](0x4)+_0x1063('0x2c')))[_0x1063('0x2e')](function(_0x9a16e4){_0x27d66f['audiofile']=_0x9a16e4;return _0x27d66f;});}return _0x27d66f;});};exports[_0x1063('0x83')]=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 d328261..41df3ae 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 _0xcca9=['./nda'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xcca9,0x1ee));var _0x9cca=function(_0x5e4ffa,_0x56154d){_0x5e4ffa=_0x5e4ffa-0x0;var _0x43a656=_0xcca9[_0x5e4ffa];return _0x43a656;};var nda=require(_0x9cca('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var _0x4598=['exports'];(function(_0x45d7e3,_0x30a49a){var _0x1fb60d=function(_0x177b90){while(--_0x177b90){_0x45d7e3['push'](_0x45d7e3['shift']());}};_0x1fb60d(++_0x30a49a);}(_0x4598,0xda));var _0x8459=function(_0x2f949b,_0x47d7be){_0x2f949b=_0x2f949b-0x0;var _0x8ed2cd=_0x4598[_0x2f949b];return _0x8ed2cd;};var nda=require('./nda');module[_0x8459('0x0')]={'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 4009f4c..c4d47fc 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 _0xb32d=['Nda','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','project','body','channelData','ProjectName','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','ndauth_url','/token','password','username','then','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message'];(function(_0x2da357,_0x1f9b2f){var _0x138fdd=function(_0xe3077d){while(--_0xe3077d){_0x2da357['push'](_0x2da357['shift']());}};_0x138fdd(++_0x1f9b2f);}(_0xb32d,0x1da));var _0xdb32=function(_0x495c52,_0x53c0cc){_0x495c52=_0x495c52-0x0;var _0x2b4bb2=_0xb32d[_0x495c52];return _0x2b4bb2;};'use strict';var rp=require(_0xdb32('0x0'));var url=require(_0xdb32('0x1'));var logger=require(_0xdb32('0x2'))(_0xdb32('0x3'));module[_0xdb32('0x4')]=function(_0x56a5af,_0x56bb98){var _0x2fe96e={'method':_0xdb32('0x5'),'uri':url['resolve'](_0x56bb98[_0xdb32('0x6')],_0xdb32('0x7')),'form':{'grant_type':_0xdb32('0x8'),'username':_0x56bb98[_0xdb32('0x9')],'password':_0x56bb98[_0xdb32('0x8')]},'json':!![]};return rp(_0x2fe96e)[_0xdb32('0xa')](function(_0x5bb076){var _0x3b0995={'method':_0xdb32('0x5'),'uri':url[_0xdb32('0xb')](_0x56bb98[_0xdb32('0xc')],_0xdb32('0xd')),'body':{'type':_0x56bb98[_0xdb32('0xe')]||_0xdb32('0xf'),'channelId':_0xdb32('0x10'),'conversation':{'id':_0x56a5af[_0xdb32('0x11')]},'from':{'id':_0x56a5af[_0xdb32('0x12')],'name':_0x56a5af[_0xdb32('0x13')]},'recipient':{'id':_0x56a5af[_0xdb32('0x14')],'name':_0x56a5af[_0xdb32('0x15')]},'text':_0x56bb98[_0xdb32('0x16')],'channelData':{}},'headers':{'Authorization':_0xdb32('0x17')+_0x5bb076[_0xdb32('0x18')]},'json':!![]};if(_0x56bb98[_0xdb32('0x19')]){_0x3b0995[_0xdb32('0x1a')][_0xdb32('0x1b')][_0xdb32('0x1c')]=_0x56bb98[_0xdb32('0x19')];}if(_0x56bb98['ndagenerate_audio']=='1'){_0x3b0995[_0xdb32('0x1a')][_0xdb32('0x1b')][_0xdb32('0x1d')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xdb32('0x1e')};}if(_0x56bb98[_0xdb32('0x1f')]){_0x3b0995['body'][_0xdb32('0x1b')][_0xdb32('0x20')]=_0x56bb98[_0xdb32('0x1f')];if(_0x56bb98['custom_action_data']){_0x3b0995['body']['channelData']['CustomActionData']=_0x56bb98[_0xdb32('0x21')];}}logger['info'](JSON[_0xdb32('0x22')](_0x3b0995));return rp(_0x3b0995);});}; \ No newline at end of file +var _0xa571=['calleridname','dnid','extension','access_token','project','body','ProjectName','AudioOutputSettings','audio/wav','custom_action','CustomAction','channelData','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','agi','resolve','/token','password','username','then','POST','ndassistant_url','ndaactivity_type','message','Nda','uniqueid','callerid'];(function(_0x56880d,_0x315eb5){var _0x3ebe18=function(_0x14fa9c){while(--_0x14fa9c){_0x56880d['push'](_0x56880d['shift']());}};_0x3ebe18(++_0x315eb5);}(_0xa571,0x107));var _0x1a57=function(_0x5f1aa,_0x497ad3){_0x5f1aa=_0x5f1aa-0x0;var _0x2d3350=_0xa571[_0x5f1aa];return _0x2d3350;};'use strict';var rp=require(_0x1a57('0x0'));var url=require(_0x1a57('0x1'));var logger=require(_0x1a57('0x2'))(_0x1a57('0x3'));module['exports']=function(_0x1a071f,_0x2eebaa){var _0x4d5f7a={'method':'POST','uri':url[_0x1a57('0x4')](_0x2eebaa['ndauth_url'],_0x1a57('0x5')),'form':{'grant_type':_0x1a57('0x6'),'username':_0x2eebaa[_0x1a57('0x7')],'password':_0x2eebaa[_0x1a57('0x6')]},'json':!![]};return rp(_0x4d5f7a)[_0x1a57('0x8')](function(_0x924873){var _0x5d9f45={'method':_0x1a57('0x9'),'uri':url[_0x1a57('0x4')](_0x2eebaa[_0x1a57('0xa')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x2eebaa[_0x1a57('0xb')]||_0x1a57('0xc'),'channelId':_0x1a57('0xd'),'conversation':{'id':_0x1a071f[_0x1a57('0xe')]},'from':{'id':_0x1a071f[_0x1a57('0xf')],'name':_0x1a071f[_0x1a57('0x10')]},'recipient':{'id':_0x1a071f[_0x1a57('0x11')],'name':_0x1a071f[_0x1a57('0x12')]},'text':_0x2eebaa['text'],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x924873[_0x1a57('0x13')]},'json':!![]};if(_0x2eebaa[_0x1a57('0x14')]){_0x5d9f45[_0x1a57('0x15')]['channelData'][_0x1a57('0x16')]=_0x2eebaa[_0x1a57('0x14')];}if(_0x2eebaa['ndagenerate_audio']=='1'){_0x5d9f45[_0x1a57('0x15')]['channelData'][_0x1a57('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x1a57('0x18')};}if(_0x2eebaa[_0x1a57('0x19')]){_0x5d9f45[_0x1a57('0x15')]['channelData'][_0x1a57('0x1a')]=_0x2eebaa['custom_action'];if(_0x2eebaa['custom_action_data']){_0x5d9f45[_0x1a57('0x15')][_0x1a57('0x1b')][_0x1a57('0x1c')]=_0x2eebaa['custom_action_data'];}}logger[_0x1a57('0x1d')](JSON[_0x1a57('0x1e')](_0x5d9f45));return rp(_0x5d9f45);});}; \ 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 8a64263..961ef34 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 _0x801b=['./lib/api','exports'];(function(_0x4d2775,_0x4f3f3c){var _0x39af44=function(_0x5e3028){while(--_0x5e3028){_0x4d2775['push'](_0x4d2775['shift']());}};_0x39af44(++_0x4f3f3c);}(_0x801b,0xf2));var _0xb801=function(_0x291839,_0x45a17c){_0x291839=_0x291839-0x0;var _0x346de3=_0x801b[_0x291839];return _0x346de3;};'use strict';var asr=require(_0xb801('0x0'));module[_0xb801('0x1')]=function(_0x5b0bab,_0x2136e7,_0x58b30b,_0x3b818e){return asr(_0x5b0bab,_0x2136e7,_0x58b30b,_0x3b818e);}; \ No newline at end of file +var _0x760a=['./lib/api','exports'];(function(_0x5ecadc,_0x1cf9f1){var _0x565037=function(_0x22908b){while(--_0x22908b){_0x5ecadc['push'](_0x5ecadc['shift']());}};_0x565037(++_0x1cf9f1);}(_0x760a,0x66));var _0xa760=function(_0x1a6eb6,_0x4a6fa9){_0x1a6eb6=_0x1a6eb6-0x0;var _0x191fb0=_0x760a[_0x1a6eb6];return _0x191fb0;};'use strict';var asr=require(_0xa760('0x0'));module[_0xa760('0x1')]=function(_0x392ace,_0x201290,_0x8ff2c7,_0x321a94){return asr(_0x392ace,_0x201290,_0x8ff2c7,_0x321a94);}; \ 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 940cf4a..098fd76 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 _0x0ca5=['info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','data','close','EOS','error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','lodash','moment','../../../../../../config/logger','agi','exports'];(function(_0x2df805,_0x8ae564){var _0x2c1a80=function(_0x3dba38){while(--_0x3dba38){_0x2df805['push'](_0x2df805['shift']());}};_0x2c1a80(++_0x8ae564);}(_0x0ca5,0x1a8));var _0x50ca=function(_0xed39cc,_0x4a63e4){_0xed39cc=_0xed39cc-0x0;var _0x1f7bd1=_0x0ca5[_0xed39cc];return _0x1f7bd1;};'use strict';var BPromise=require('bluebird');var _=require(_0x50ca('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x50ca('0x1'));var crypto=require('crypto');var logger=require(_0x50ca('0x2'))(_0x50ca('0x3'));module[_0x50ca('0x4')]=function(_0x52285d,_0x528421,_0x1bc259,_0x43f208){return new BPromise(function(_0xcf1366,_0xa68fb2){logger[_0x50ca('0x5')]('Tilde\x20URI',_0x43f208||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x2074e2=new WebSocket(_0x43f208||_0x50ca('0x6'),{'perMessageDeflate':![]});var _0x298b92='';var _0x3108a8='0';var _0xa595c='1';var _0x2ea768=_0x50ca('0x7');function _0x12593f(_0x40d0a2){var _0x21a8aa=crypto[_0x50ca('0x8')](_0x50ca('0x9'));_0x21a8aa[_0x50ca('0xa')](_0x40d0a2);return _0x21a8aa[_0x50ca('0xb')]('hex');}function _0x156640(){try{logger[_0x50ca('0x5')](_0x50ca('0xc'));var _0x31fafd=moment()[_0x50ca('0xd')]();var _0x47ab45=_0x12593f(_0x31fafd+_0x528421+_0x1bc259);_0x2074e2[_0x50ca('0xe')](JSON[_0x50ca('0xf')]({'appID':_0x528421,'timestamp':_0x31fafd,'appKey':_0x47ab45}));var _0x41c303=fs['createReadStream'](_0x52285d);_0x41c303['on'](_0x50ca('0x10'),function(_0x1cfbd4){_0x2074e2[_0x50ca('0xe')](_0x1cfbd4);});_0x41c303['on'](_0x50ca('0x11'),function(){_0x2074e2[_0x50ca('0xe')](_0x50ca('0x12'));});}catch(_0x5905a0){logger[_0x50ca('0x13')]('Tilde\x20ASR\x20send\x20error',JSON[_0x50ca('0xf')](_0x5905a0));_0x2074e2[_0x50ca('0x14')]();}}function _0x427eb2(_0x294f18){try{if(_0x294f18){var _0x9d623b=JSON[_0x50ca('0x15')](_0x294f18);switch(_0x9d623b[_0x50ca('0x16')]){case 0x0:if(_0x9d623b[_0x50ca('0x17')]){if(_0x9d623b['result'][_0x50ca('0x18')]){logger['info'](_0x50ca('0x19'),JSON['stringify'](_0x9d623b[_0x50ca('0x17')][_0x50ca('0x1a')]));_0x298b92=_0x9d623b['result'][_0x50ca('0x1a')][0x0][_0x50ca('0x1b')];_0x3108a8=_0x9d623b['result'][_0x50ca('0x1a')][0x0][_0x50ca('0x1c')];_0xa595c='0';_0x2ea768='Success.';_0x2074e2[_0x50ca('0x14')]();}}break;case 0x1:logger['info'](_0x50ca('0x7'));_0xa595c='1';_0x2ea768=_0x50ca('0x7');break;case 0x2:logger[_0x50ca('0x5')](_0x50ca('0x1d'));_0xa595c='2';_0x2ea768=_0x50ca('0x1d');break;case 0x9:logger[_0x50ca('0x5')](_0x50ca('0x1e'));_0xa595c='9';_0x2ea768='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0x50ca('0x5')]('Authentication\x20failed.');_0xa595c='10';_0x2ea768='Authentication\x20failed.';break;case 0xb:logger[_0x50ca('0x5')](_0x50ca('0x1f'));_0xa595c='11';_0x2ea768='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x5e510){logger[_0x50ca('0x13')](_0x50ca('0x20'),JSON[_0x50ca('0xf')](_0x5e510));_0x2074e2[_0x50ca('0x14')]();}}function _0x1c2b39(){logger[_0x50ca('0x5')](_0x50ca('0x21'));_0xcf1366({'transcript':_0x298b92,'confidence':_0x3108a8,'status':_0xa595c,'status_message':_0x2ea768});}function _0x4ee3b4(_0x30fbef){logger[_0x50ca('0x13')](_0x50ca('0x22'));if(!_[_0x50ca('0x23')](_0x30fbef)){logger[_0x50ca('0x13')](_[_0x50ca('0x24')](_0x30fbef)?JSON['stringify'](_0x30fbef):_0x30fbef);}}_0x2074e2['on'](_0x50ca('0x25'),_0x156640);_0x2074e2['on'](_0x50ca('0x26'),_0x427eb2);_0x2074e2['on'](_0x50ca('0x11'),_0x1c2b39);_0x2074e2['on'](_0x50ca('0x13'),_0x4ee3b4);});}; \ No newline at end of file +var _0x3c02=['wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','update','digest','send','stringify','createReadStream','data','close','EOS','error','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.','Close\x20Tilde\x20ASR\x20socket','open','message','bluebird','lodash','../../../../../../config/logger','agi','info','Tilde\x20URI'];(function(_0x4cddd1,_0x3b49c8){var _0x3edb96=function(_0x14339d){while(--_0x14339d){_0x4cddd1['push'](_0x4cddd1['shift']());}};_0x3edb96(++_0x3b49c8);}(_0x3c02,0x1c1));var _0x23c0=function(_0x43577c,_0x26f231){_0x43577c=_0x43577c-0x0;var _0x2b5ddd=_0x3c02[_0x43577c];return _0x2b5ddd;};'use strict';var BPromise=require(_0x23c0('0x0'));var _=require(_0x23c0('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require('crypto');var logger=require(_0x23c0('0x2'))(_0x23c0('0x3'));module['exports']=function(_0x1cac61,_0x1e8bf5,_0x130e47,_0x47bb0c){return new BPromise(function(_0x539ccb,_0x5852e9){logger[_0x23c0('0x4')](_0x23c0('0x5'),_0x47bb0c||_0x23c0('0x6'));var _0x36ddde=new WebSocket(_0x47bb0c||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x4211c3='';var _0x2f1e8a='0';var _0x28296c='1';var _0xcfc9a1=_0x23c0('0x7');function _0x59db28(_0x28f551){var _0x5a8781=crypto[_0x23c0('0x8')]('sha1');_0x5a8781[_0x23c0('0x9')](_0x28f551);return _0x5a8781[_0x23c0('0xa')]('hex');}function _0x5ca5e8(){try{logger[_0x23c0('0x4')]('Open\x20Tilde\x20ASR\x20socket');var _0x302334=moment()['unix']();var _0x30a0f1=_0x59db28(_0x302334+_0x1e8bf5+_0x130e47);_0x36ddde[_0x23c0('0xb')](JSON[_0x23c0('0xc')]({'appID':_0x1e8bf5,'timestamp':_0x302334,'appKey':_0x30a0f1}));var _0x3a346d=fs[_0x23c0('0xd')](_0x1cac61);_0x3a346d['on'](_0x23c0('0xe'),function(_0x35c3c8){_0x36ddde[_0x23c0('0xb')](_0x35c3c8);});_0x3a346d['on'](_0x23c0('0xf'),function(){_0x36ddde[_0x23c0('0xb')](_0x23c0('0x10'));});}catch(_0xfe015f){logger[_0x23c0('0x11')]('Tilde\x20ASR\x20send\x20error',JSON[_0x23c0('0xc')](_0xfe015f));_0x36ddde[_0x23c0('0x12')]();}}function _0x5b1ff3(_0x722cb2){try{if(_0x722cb2){var _0x533650=JSON[_0x23c0('0x13')](_0x722cb2);switch(_0x533650[_0x23c0('0x14')]){case 0x0:if(_0x533650[_0x23c0('0x15')]){if(_0x533650[_0x23c0('0x15')][_0x23c0('0x16')]){logger['info'](_0x23c0('0x17'),JSON[_0x23c0('0xc')](_0x533650[_0x23c0('0x15')][_0x23c0('0x18')]));_0x4211c3=_0x533650[_0x23c0('0x15')][_0x23c0('0x18')][0x0][_0x23c0('0x19')];_0x2f1e8a=_0x533650[_0x23c0('0x15')][_0x23c0('0x18')][0x0][_0x23c0('0x1a')];_0x28296c='0';_0xcfc9a1=_0x23c0('0x1b');_0x36ddde['terminate']();}}break;case 0x1:logger['info']('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x28296c='1';_0xcfc9a1=_0x23c0('0x7');break;case 0x2:logger[_0x23c0('0x4')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x28296c='2';_0xcfc9a1=_0x23c0('0x1c');break;case 0x9:logger[_0x23c0('0x4')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x28296c='9';_0xcfc9a1=_0x23c0('0x1d');break;case 0xa:logger[_0x23c0('0x4')](_0x23c0('0x1e'));_0x28296c='10';_0xcfc9a1=_0x23c0('0x1e');break;case 0xb:logger[_0x23c0('0x4')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x28296c='11';_0xcfc9a1=_0x23c0('0x1f');}}}catch(_0x2ddb2d){logger[_0x23c0('0x11')]('Tilde\x20ASR\x20parse\x20error',JSON[_0x23c0('0xc')](_0x2ddb2d));_0x36ddde[_0x23c0('0x12')]();}}function _0x5364e4(){logger[_0x23c0('0x4')](_0x23c0('0x20'));_0x539ccb({'transcript':_0x4211c3,'confidence':_0x2f1e8a,'status':_0x28296c,'status_message':_0xcfc9a1});}function _0x4f2821(_0x473b3f){logger['error']('Error\x20Tilde\x20ASR\x20socket');if(!_['isNil'](_0x473b3f)){logger[_0x23c0('0x11')](_['isObject'](_0x473b3f)?JSON[_0x23c0('0xc')](_0x473b3f):_0x473b3f);}}_0x36ddde['on'](_0x23c0('0x21'),_0x5ca5e8);_0x36ddde['on'](_0x23c0('0x22'),_0x5b1ff3);_0x36ddde['on']('close',_0x5364e4);_0x36ddde['on'](_0x23c0('0x11'),_0x4f2821);});}; \ 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 10cb4be..72203a5 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 asr=require('./asr');module['exports']={'asr':asr}; \ No newline at end of file +var _0xec5e=['./asr','exports'];(function(_0x526e07,_0x5aad89){var _0x2c9fc9=function(_0x319286){while(--_0x319286){_0x526e07['push'](_0x526e07['shift']());}};_0x2c9fc9(++_0x5aad89);}(_0xec5e,0x74));var _0xeec5=function(_0x56b984,_0x1a1fd0){_0x56b984=_0x56b984-0x0;var _0x32b63a=_0xec5e[_0x56b984];return _0x32b63a;};var asr=require(_0xeec5('0x0'));module[_0xeec5('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index dd7ba66..4a425ab 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 _0xe30d=['EventEmitter','./error','./channel','call','error','E_AGI_ARGUMENT_PORT','createServer','listening','emit','connection','getConnections','E_AGI_SERVER_ERROR','destroy','E_AGI_SERVER_MAXCONNECTION','code','close','E_AGI_SERVER_CLOSE','nextTick','exports'];(function(_0x240e46,_0x141d91){var _0x9bc15e=function(_0x2ab50e){while(--_0x2ab50e){_0x240e46['push'](_0x240e46['shift']());}};_0x9bc15e(++_0x141d91);}(_0xe30d,0xbe));var _0xde30=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe30d[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require('events')[_0xde30('0x0')];var AGIError=require(_0xde30('0x1'));var AGIChannel=require(_0xde30('0x2'));var AGIServer=function(_0x58b783,_0x425171,_0x2e8f1c){var _0x5d366a=this,_0x58b783=_0x58b783||0x11dd,_0x425171=_0x425171||'127.0.0.1',_0x57f59a=null,_0x16e294=0x0;EventEmitter[_0xde30('0x3')](_0x5d366a);function _0x567933(){if(!_0x58b783){_0x5d366a['emit'](_0xde30('0x4'),new AGIError(_0xde30('0x5')));return![];}_0x57f59a=net[_0xde30('0x6')]();_0x57f59a['listen'](_0x58b783,_0x425171);_0x57f59a['on'](_0xde30('0x7'),function(){_0x5d366a[_0xde30('0x8')](_0xde30('0x7'));});_0x57f59a['on'](_0xde30('0x9'),function(_0xdb052a){_0x57f59a[_0xde30('0xa')](function(_0x105737,_0xbcc54a){if(_0x105737){_0x5d366a[_0xde30('0x8')](_0xde30('0x4'),new AGIError(_0xde30('0xb'),_0x105737));}else if(_0x2e8f1c&&_0x2e8f1c<0x0){_0x5d366a[_0xde30('0x8')](_0xde30('0x4'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0xdb052a[_0xde30('0xc')]();}else if(_0x2e8f1c&&_0x2e8f1c>0x0&&_0x2e8f1c<_0xbcc54a){_0x16e294+=0x1;_0x5d366a[_0xde30('0x8')](_0xde30('0x4'),new AGIError(_0xde30('0xd'),_0x16e294));_0xdb052a[_0xde30('0xc')]();}else{var _0x12803a=new AGIChannel(_0xdb052a);_0x12803a['on']('ready',function(){_0x5d366a['emit'](_0xde30('0x9'),_0x12803a);});}});});_0x57f59a['on']('error',function(_0x524ba8){_0x5d366a[_0xde30('0x8')](_0xde30('0x4'),new AGIError(_0xde30('0xb'),_0x524ba8[_0xde30('0xe')]));});_0x57f59a['on'](_0xde30('0xf'),function(){_0x5d366a['emit'](_0xde30('0xf'),new AGIError(_0xde30('0x10')));});}process[_0xde30('0x11')](function(){_0x567933();});};util['inherits'](AGIServer,EventEmitter);module[_0xde30('0x12')]=function(_0x2f652e,_0x3cd129,_0x4b685a){return new AGIServer(_0x2f652e,_0x3cd129,_0x4b685a);}; \ No newline at end of file +var _0xd17d=['E_AGI_ARGUMENT_PORT','createServer','listen','listening','emit','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','net','events','EventEmitter','./error','127.0.0.1','call','error'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xd17d,0x75));var _0xdd17=function(_0x23648b,_0x32e7a3){_0x23648b=_0x23648b-0x0;var _0x2cd701=_0xd17d[_0x23648b];return _0x2cd701;};'use strict';var util=require(_0xdd17('0x0'));var net=require(_0xdd17('0x1'));var EventEmitter=require(_0xdd17('0x2'))[_0xdd17('0x3')];var AGIError=require(_0xdd17('0x4'));var AGIChannel=require('./channel');var AGIServer=function(_0x3503fd,_0x5879ed,_0x4e8ac7){var _0x4807e7=this,_0x3503fd=_0x3503fd||0x11dd,_0x5879ed=_0x5879ed||_0xdd17('0x5'),_0x30569a=null,_0x4332b3=0x0;EventEmitter[_0xdd17('0x6')](_0x4807e7);function _0x59737c(){if(!_0x3503fd){_0x4807e7['emit'](_0xdd17('0x7'),new AGIError(_0xdd17('0x8')));return![];}_0x30569a=net[_0xdd17('0x9')]();_0x30569a[_0xdd17('0xa')](_0x3503fd,_0x5879ed);_0x30569a['on'](_0xdd17('0xb'),function(){_0x4807e7[_0xdd17('0xc')]('listening');});_0x30569a['on'](_0xdd17('0xd'),function(_0xe776f8){_0x30569a[_0xdd17('0xe')](function(_0x53ffc1,_0x53c553){if(_0x53ffc1){_0x4807e7[_0xdd17('0xc')](_0xdd17('0x7'),new AGIError(_0xdd17('0xf'),_0x53ffc1));}else if(_0x4e8ac7&&_0x4e8ac7<0x0){_0x4807e7[_0xdd17('0xc')]('error',new AGIError(_0xdd17('0x10')));_0xe776f8[_0xdd17('0x11')]();}else if(_0x4e8ac7&&_0x4e8ac7>0x0&&_0x4e8ac7<_0x53c553){_0x4332b3+=0x1;_0x4807e7[_0xdd17('0xc')](_0xdd17('0x7'),new AGIError(_0xdd17('0x12'),_0x4332b3));_0xe776f8[_0xdd17('0x11')]();}else{var _0x69df43=new AGIChannel(_0xe776f8);_0x69df43['on']('ready',function(){_0x4807e7[_0xdd17('0xc')](_0xdd17('0xd'),_0x69df43);});}});});_0x30569a['on']('error',function(_0x52f17a){_0x4807e7[_0xdd17('0xc')](_0xdd17('0x7'),new AGIError(_0xdd17('0xf'),_0x52f17a[_0xdd17('0x13')]));});_0x30569a['on'](_0xdd17('0x14'),function(){_0x4807e7[_0xdd17('0xc')](_0xdd17('0x14'),new AGIError(_0xdd17('0x15')));});}process[_0xdd17('0x16')](function(){_0x59737c();});};util[_0xdd17('0x17')](AGIServer,EventEmitter);module[_0xdd17('0x18')]=function(_0x3a9a2a,_0x413ecf,_0x48c83c){return new AGIServer(_0x3a9a2a,_0x413ecf,_0x48c83c);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index b6fdaff..855f7ff 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 _0x9068=['%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','Executed\x20command\x20%s','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','password','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','sesteknda','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','opts','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','getSound','getData','response','maxdigit','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','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','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','GoogleASR\x20Result\x20%s','tildeasr','no\x20appid\x20configured','appsecret','tilde\x20%s\x20file\x20created','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','no\x20condition\x20configured','condition','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','no\x20interval\x20configured','getIntervals','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','agentLogin','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','math','operation','no\x20operation\x20configured','math\x20%s','forEach','%s[%s]','variable\x20%s[key]\x20set','menu','Enter\x20in\x20MENU\x20(%s)\x20block','file_id','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','no\x20file\x20audio\x20found','PLAYBACK','queue_id','no\x20queue\x20selected','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','no\x20url\x20configured','no\x20variable\x20selected\x20for\x20the\x20response','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','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','no\x20mail\x20account\x20configured','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','subject','service','host','port','secure','authentication','auth','pass','template_id','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20found','sms_text','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','yes','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','Executed\x20command\x20%s\x20%s','AGI','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','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','replaceAll','path','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawBody','getdigits','getsecretdigits','channel','rpc','mailRpc','getVariable','getVariableById','then','catch','getVoiceQueue','getVoiceQueueById','prototype','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUser','name','getTrunk','getTrunkById','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervalById','IntervalId','map','Intervals','interval','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','callback_priority','getPauseById','agentPause','agent','agentUnpause','agentLogout','internal','shellCommand','exec','trim','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','body','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','parse','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','googleASR','google_asr_language','tildeASR','appid','clone','hasOwnProperty','isString','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','split','extra','toString','result','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','getAndSetVariable','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20query\x20configured','query','replace','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0x9068,0xea));var _0x8906=function(_0x4d35c7,_0xb930e0){_0x4d35c7=_0x4d35c7-0x0;var _0x595121=_0x9068[_0x4d35c7];return _0x595121;};'use strict';var fs=require('fs');var path=require(_0x8906('0x0'));var util=require('util');var _=require(_0x8906('0x1'));var sh=require(_0x8906('0x2'));var odbc=require(_0x8906('0x3'))();var rs=require(_0x8906('0x4'));var moment=require(_0x8906('0x5'));var Mustache=require(_0x8906('0x6'));var rp=require(_0x8906('0x7'));var logger=require(_0x8906('0x8'))(_0x8906('0x9'));var config=require(_0x8906('0xa'));var scripts=require(_0x8906('0xb'));var FILES_PATH=_0x8906('0xc');var recursiveMapAttributes=['rawHeaders',_0x8906('0xd')];var verticesWithRetry=['menu',_0x8906('0xe'),_0x8906('0xf')];var AGIVertices=function(_0x2f5d57,_0x2cac31,_0x4afc75){this[_0x8906('0x10')]=_0x2f5d57;this[_0x8906('0x11')]=_0x2cac31;this[_0x8906('0x12')]=_0x4afc75;};AGIVertices['prototype'][_0x8906('0x13')]=function(_0x2bb09e,_0x2cca5d){this[_0x8906('0x11')][_0x8906('0x14')](_0x2bb09e)[_0x8906('0x15')](function(_0x423432){_0x2cca5d(null,_0x423432?_0x423432['name']:![]);})[_0x8906('0x16')](function(_0x5c7afc){_0x2cca5d(_0x5c7afc);});};AGIVertices['prototype'][_0x8906('0x17')]=function(_0x5cf111,_0x9a6a24){this[_0x8906('0x11')][_0x8906('0x18')](_0x5cf111)[_0x8906('0x15')](function(_0x394fd2){_0x9a6a24(null,_0x394fd2?_0x394fd2['name']:![]);})[_0x8906('0x16')](function(_0x20efaa){_0x9a6a24(_0x20efaa);});};AGIVertices[_0x8906('0x19')]['getSquareProject']=function(_0x3112d0,_0x28ea98){this[_0x8906('0x11')][_0x8906('0x1a')](_0x3112d0)['then'](function(_0x13f2e3){_0x28ea98(null,_0x13f2e3?_0x13f2e3['name']:![]);})[_0x8906('0x16')](function(_0x30b16f){_0x28ea98(_0x30b16f);});};AGIVertices[_0x8906('0x19')][_0x8906('0x1b')]=function(_0x1d078d,_0x261e16){this[_0x8906('0x11')][_0x8906('0x1c')](_0x1d078d)[_0x8906('0x15')](function(_0x2a067c){_0x261e16(null,_0x2a067c?_0x2a067c['dsn']:![]);})['catch'](function(_0x42ed94){_0x261e16(_0x42ed94);});};AGIVertices[_0x8906('0x19')][_0x8906('0x1d')]=function(_0x1e0e5a,_0x1fe95d){this[_0x8906('0x11')]['getUserById'](_0x1e0e5a)[_0x8906('0x15')](function(_0x2820d2){_0x1fe95d(null,_0x2820d2?_0x2820d2[_0x8906('0x1e')]:![]);})[_0x8906('0x16')](function(_0x4b7947){_0x1fe95d(_0x4b7947);});};AGIVertices[_0x8906('0x19')][_0x8906('0x1f')]=function(_0x333875,_0x1e69c5){this[_0x8906('0x11')][_0x8906('0x20')](_0x333875)[_0x8906('0x15')](function(_0x46aa63){_0x1e69c5(null,_0x46aa63?_0x46aa63['name']:![]);})['catch'](function(_0x229704){_0x1e69c5(_0x229704);});};AGIVertices[_0x8906('0x19')]['getSound']=function(_0x4eaa9,_0x31d62e){var _0x462cea=this;this['rpc'][_0x8906('0x21')](_0x4eaa9)[_0x8906('0x15')](function(_0x4a1b5d){_0x31d62e(null,_0x4a1b5d?_0x462cea[_0x8906('0x22')](_0x4a1b5d[_0x8906('0x23')]):![]);})[_0x8906('0x16')](function(_0x4381fc){_0x31d62e(_0x4381fc);});};AGIVertices[_0x8906('0x19')][_0x8906('0x24')]=function(_0x1c0390,_0x21b749){this[_0x8906('0x11')][_0x8906('0x25')](_0x1c0390)[_0x8906('0x15')](function(_0x429ae6){_0x21b749(null,_0x429ae6?_0x429ae6:![]);})[_0x8906('0x16')](function(_0x2c55a2){_0x21b749(_0x2c55a2);});};AGIVertices[_0x8906('0x19')][_0x8906('0x26')]=function(_0x3c2664,_0xb8f20b,_0x38415c){this['mailRpc'][_0x8906('0x26')](_0x3c2664,_0xb8f20b)[_0x8906('0x15')](function(){_0x38415c(null);})[_0x8906('0x16')](function(_0x4b14d8){_0x38415c(_0x4b14d8);});};AGIVertices[_0x8906('0x19')]['getIntervals']=function(_0x473ed6,_0x554aee){this[_0x8906('0x11')][_0x8906('0x27')](_0x473ed6)[_0x8906('0x15')](function(_0x249bb9){if(_0x249bb9){if(_0x249bb9[_0x8906('0x28')]){_0x554aee(null,[_0x249bb9['interval']]);}else{_0x554aee(null,_[_0x8906('0x29')](_0x249bb9[_0x8906('0x2a')],_0x8906('0x2b')));}}else{_0x554aee(null,![]);}})[_0x8906('0x16')](function(_0x36eadf){_0x554aee(_0x36eadf);});};AGIVertices[_0x8906('0x19')][_0x8906('0x22')]=function(_0x3a51c5){return util[_0x8906('0x2c')](_0x8906('0x2d'),FILES_PATH,_0x3a51c5);};AGIVertices[_0x8906('0x19')][_0x8906('0x2e')]=function(_0x356483,_0x5621a3,_0x2f7403){odbc[_0x8906('0x2f')](_0x356483,function(_0x1cf44e){if(_0x1cf44e){logger[_0x8906('0x30')](_0x8906('0x31'),_0x1cf44e);_0x2f7403(_0x1cf44e);}else{logger[_0x8906('0x32')]('ODBC\x20connection\x20successfully');odbc['query'](_0x5621a3,function(_0x4ee7d2,_0x3cb4ed){if(_0x4ee7d2){logger[_0x8906('0x32')]('Error\x20executing\x20query\x20%s',_0x5621a3);_0x2f7403(_0x4ee7d2);}else{logger[_0x8906('0x32')](_0x8906('0x33'),_0x5621a3);odbc['close'](function(_0x4f34fb){if(_0x4f34fb){logger[_0x8906('0x30')](_0x8906('0x34'),_0x4f34fb);}_0x2f7403(null,_0x3cb4ed);});}});}});};AGIVertices['prototype'][_0x8906('0x35')]=function(_0x4335de,_0x405f5c){this['rpc'][_0x8906('0x36')](_0x4335de)['then'](function(_0x52cfb2){_0x405f5c(null,_0x52cfb2?_0x52cfb2:![]);})[_0x8906('0x16')](function(_0x2a562f){_0x405f5c(_0x2a562f);});};AGIVertices[_0x8906('0x19')][_0x8906('0x37')]=function(_0x258700,_0x2817b2){this['rpc']['createSmsMessage'](_0x258700)[_0x8906('0x15')](function(_0x583e9e){_0x2817b2(null,_0x583e9e);})['catch'](function(_0x36c587){_0x2817b2(_0x36c587);});};AGIVertices[_0x8906('0x19')][_0x8906('0x38')]=function(_0x2a865c,_0x4b2b66,_0x5b307c){this[_0x8906('0x11')][_0x8906('0x38')]({'uniqueid':this[_0x8906('0x10')][_0x8906('0x39')],'node':_0x2a865c[_0x8906('0x3a')],'application':_0x2a865c[_0x8906('0x3b')],'data':_0x4b2b66||null,'project_name':this[_0x8906('0x10')][_0x8906('0x3c')],'callerid':this[_0x8906('0x10')][_0x8906('0x3d')]})[_0x8906('0x15')](function(_0x364680){if(_0x5b307c){_0x5b307c(null,_0x364680);}})[_0x8906('0x16')](function(_0x5e5d54){if(_0x5b307c){_0x5b307c(_0x5e5d54);}});};AGIVertices[_0x8906('0x19')]['createSquareRecording']=function(_0x42a946,_0x20a16d,_0x4abc2b,_0x13105d){this['rpc'][_0x8906('0x3e')]({'uniqueid':this['channel'][_0x8906('0x39')],'callerid':this[_0x8906('0x10')][_0x8906('0x3d')],'calleridname':this[_0x8906('0x10')][_0x8906('0x3f')],'context':this[_0x8906('0x10')][_0x8906('0x40')],'extension':this[_0x8906('0x10')][_0x8906('0x41')],'priority':this['channel']['priority'],'accountcode':this[_0x8906('0x10')][_0x8906('0x42')],'dnid':this[_0x8906('0x10')][_0x8906('0x43')],'projectName':this['channel'][_0x8906('0x3c')],'saveName':_0x20a16d,'filename':_0x42a946[_0x8906('0x44')]||_0x20a16d,'savePath':_0x4abc2b})[_0x8906('0x15')](function(_0x431208){_0x13105d(null,_0x431208);})[_0x8906('0x16')](function(_0x266585){_0x13105d(_0x266585);});};AGIVertices['prototype'][_0x8906('0x45')]=function(_0x4b6996,_0x5b5731,_0x27b045,_0x20c6c0,_0x352d0c){this[_0x8906('0x11')][_0x8906('0x45')]({'uniqueid':this['channel']['uniqueid'],'body':_0x4b6996,'direction':_0x5b5731,'providerName':_0x27b045,'providerResponse':_0x20c6c0})[_0x8906('0x15')](function(_0x150c6e){if(_0x352d0c){_0x352d0c(null,_0x150c6e);}})['catch'](function(_0x5d3790){if(_0x352d0c){_0x352d0c(_0x5d3790);}});};AGIVertices[_0x8906('0x19')][_0x8906('0x46')]=function(_0x5e01e4,_0x18c39d){this[_0x8906('0x11')][_0x8906('0x46')]({'firstName':_[_0x8906('0x47')](_0x5e01e4[_0x8906('0x1e')])||_[_0x8906('0x48')](_0x5e01e4[_0x8906('0x1e')])?_0x8906('0x49')+Math[_0x8906('0x4a')]():_0x5e01e4[_0x8906('0x1e')],'lastName':_['isEmpty'](_0x5e01e4[_0x8906('0x4b')])||_[_0x8906('0x48')](_0x5e01e4['lastName'])?null:_0x5e01e4[_0x8906('0x4b')],'phone':_0x5e01e4[_0x8906('0x4c')],'ListId':_0x5e01e4[_0x8906('0x4d')],'scheduledat':_0x5e01e4[_0x8906('0x4e')],'callbackUniqueid':this[_0x8906('0x10')][_0x8906('0x39')],'tags':_0x8906('0x4f'),'description':_0x8906('0x50')+_0x5e01e4[_0x8906('0x4e')]['toString'](),'priority':_0x5e01e4[_0x8906('0x51')]})[_0x8906('0x15')](function(_0x50b166){_0x18c39d(null,_0x50b166);})[_0x8906('0x16')](function(_0x3d4e61){_0x18c39d(_0x3d4e61);});};AGIVertices['prototype']['getPause']=function(_0x51a854,_0x41f26d){this['rpc'][_0x8906('0x52')](_0x51a854)[_0x8906('0x15')](function(_0x3b8ce9){_0x41f26d(null,_0x3b8ce9?_0x3b8ce9[_0x8906('0x1e')]:![]);})[_0x8906('0x16')](function(_0xf152ad){_0x41f26d(_0xf152ad);});};AGIVertices[_0x8906('0x19')][_0x8906('0x53')]=function(_0x526f4d,_0x5925c8,_0x53816d){var _0x28ccd6={'role':_0x8906('0x54')};_0x28ccd6[_0x526f4d]=this[_0x8906('0x10')][_0x8906('0x3d')];this['rpc']['agentPause'](_0x28ccd6,_0x5925c8,this['channel'][_0x8906('0x39')])[_0x8906('0x15')](function(_0x1b1971){_0x53816d(null,_[_0x8906('0x48')](_0x1b1971)?![]:!![]);})['catch'](function(_0x55eb0d){logger[_0x8906('0x30')](_0x55eb0d);_0x53816d(null,![]);});};AGIVertices[_0x8906('0x19')][_0x8906('0x55')]=function(_0x52d927,_0x9cf378){var _0x42a717={'role':_0x8906('0x54')};_0x42a717[_0x52d927]=this[_0x8906('0x10')][_0x8906('0x3d')];this[_0x8906('0x11')][_0x8906('0x55')](_0x42a717)['then'](function(_0x1bdcf9){_0x9cf378(null,_[_0x8906('0x48')](_0x1bdcf9)?![]:!![]);})[_0x8906('0x16')](function(_0x27f275){logger['error'](_0x27f275);_0x9cf378(null,![]);});};AGIVertices[_0x8906('0x19')][_0x8906('0x56')]=function(_0x37396d,_0xd8ae4e){var _0x3046af={'role':_0x8906('0x54')};_0x3046af[_0x37396d]=this['channel'][_0x8906('0x3d')];this[_0x8906('0x11')]['agentLogout'](_0x3046af)[_0x8906('0x15')](function(_0x213cf8){_0xd8ae4e(null,_['isNil'](_0x213cf8)?![]:!![]);})['catch'](function(_0x2cb671){logger[_0x8906('0x30')](_0x2cb671);_0xd8ae4e(null,![]);});};AGIVertices[_0x8906('0x19')]['agentLogin']=function(_0x3f96eb,_0x5cd9d7){var _0x4fbc45={'role':_0x8906('0x54')};_0x4fbc45[_0x3f96eb]=this['channel'][_0x8906('0x3d')];var _0xac9cfb=_0x3f96eb!=_0x8906('0x57')?util[_0x8906('0x2c')]('%s/%s@from-sip/n','LOCAL',this[_0x8906('0x10')][_0x8906('0x3d')]):undefined;this[_0x8906('0x11')]['agentLogin'](_0x4fbc45,_0xac9cfb)[_0x8906('0x15')](function(_0x35c510){_0x5cd9d7(null,_['isNil'](_0x35c510)?![]:!![]);})[_0x8906('0x16')](function(_0x37fd4a){logger[_0x8906('0x30')](_0x37fd4a);_0x5cd9d7(null,![]);});};AGIVertices[_0x8906('0x19')][_0x8906('0x58')]=function(_0x1bca17,_0x881afb){sh[_0x8906('0x59')](_[_0x8906('0x5a')](_0x1bca17),function(_0x4cae4b,_0x468e66){var _0x27dfde=_0x468e66['replace'](/(\r\n|\n|\r)/gm,'');_0x881afb(null,_0x27dfde);});};AGIVertices['prototype'][_0x8906('0x5b')]=function(_0x3a9310,_0x34b234){scripts[_0x8906('0x5b')](_0x3a9310[_0x8906('0x5c')],_0x3a9310[_0x8906('0x5d')]||_0x8906('0x5e'),_0x3a9310['text'],_0x3a9310[_0x8906('0x5f')]||'en-US',_0x3a9310[_0x8906('0x60')]||_0x8906('0x61'),_0x3a9310[_0x8906('0x62')]||_0x8906('0x63'))['then'](function(_0x4d58c8){_0x34b234(null,_0x4d58c8);})[_0x8906('0x16')](function(_0x5d5874){_0x34b234(_0x5d5874);});};AGIVertices[_0x8906('0x19')][_0x8906('0x64')]=function(_0x168715,_0x17704b){scripts[_0x8906('0x64')](_0x168715[_0x8906('0x5e')],_0x168715[_0x8906('0x65')]||'en',0x1)[_0x8906('0x15')](function(_0x155042){_0x17704b(null,_0x155042);})[_0x8906('0x16')](function(_0x2df720){_0x17704b(_0x2df720);});};AGIVertices[_0x8906('0x19')][_0x8906('0x66')]=function(_0x5d81e6,_0x3756bb){var _0x185761={'uri':_0x5d81e6[_0x8906('0x67')],'method':_0x5d81e6[_0x8906('0x68')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x5d81e6[_0x8906('0x69')])===_0x8906('0x6a')&&parseInt(_0x5d81e6[_0x8906('0x69')])>=0x1?parseInt(_0x5d81e6[_0x8906('0x69')])*0x3e8:0x5*0x3e8};if(_[_0x8906('0x6b')]([_0x8906('0x6c'),_0x8906('0x6d')],_0x185761[_0x8906('0x68')][_0x8906('0x6e')]())){try{_0x185761[_0x8906('0x6f')]=_0x5d81e6[_0x8906('0xd')]?JSON['parse'](_0x5d81e6[_0x8906('0xd')]):{};}catch(_0x102e0e){logger[_0x8906('0x30')](_0x8906('0x70'),_0x102e0e);}}try{_0x185761[_0x8906('0x71')]=_0x5d81e6[_0x8906('0x72')]?JSON[_0x8906('0x73')](_0x5d81e6[_0x8906('0x72')]):{};}catch(_0x42de67){logger[_0x8906('0x30')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x42de67);}if(_0x5d81e6[_0x8906('0x74')]){try{var _0x41d6cb=require(_0x5d81e6[_0x8906('0x74')])[_0x8906('0x75')](this,_0x185761);_0x185761[_0x8906('0x76')]=Mustache[_0x8906('0x77')](_0x5d81e6[_0x8906('0x67')],_0x41d6cb,{},['$$','$$']);if(_0x185761['headers']){_0x185761[_0x8906('0x71')]=JSON[_0x8906('0x73')](Mustache[_0x8906('0x77')](JSON[_0x8906('0x78')](_0x185761[_0x8906('0x71')]),_0x41d6cb,{},['$$','$$']));}if(_0x185761[_0x8906('0x6f')]){_0x185761['body']=JSON['parse'](Mustache[_0x8906('0x77')](JSON['stringify'](_0x185761['body']),_0x41d6cb,{},['$$','$$']));}}catch(_0x54ae22){logger[_0x8906('0x30')](_0x8906('0x79'),_0x54ae22);}}rp(_0x185761)['then'](function(_0x1d135d){var _0x423c07={'statusCode':_0x1d135d[_0x8906('0x7a')]||0xc8,'statusMessage':_0x1d135d[_0x8906('0x7b')]||'OK','headers':_0x1d135d[_0x8906('0x71')]||{},'body':_0x1d135d[_0x8906('0x6f')]||{}};_0x3756bb(null,_0x423c07);})[_0x8906('0x16')](function(_0x1a6460){var _0x1de4b1={'statusCode':_0x1a6460[_0x8906('0x7a')]||0x1f4,'statusMessage':_0x1a6460[_0x8906('0x7c')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x1a6460[_0x8906('0x7d')][_0x8906('0x71')]||{},'body':_0x1a6460[_0x8906('0x7d')][_0x8906('0x6f')]||{}};_0x3756bb(null,_0x1de4b1);});};AGIVertices[_0x8906('0x19')]['googleDialogflow']=function(_0x42f23c,_0x43317f){scripts[_0x8906('0x7e')](this[_0x8906('0x10')]['uniqueid'],_0x42f23c[_0x8906('0x7f')],_0x42f23c[_0x8906('0x5e')],_0x42f23c[_0x8906('0x80')]||'en')[_0x8906('0x15')](function(_0x4c8757){_0x43317f(null,_0x4c8757);})[_0x8906('0x16')](function(_0x281a4e){_0x43317f(_0x281a4e);});};AGIVertices[_0x8906('0x19')][_0x8906('0x81')]=function(_0x250e07,_0x981e3b){scripts[_0x8906('0x81')](this[_0x8906('0x10')][_0x8906('0x39')],_0x250e07[_0x8906('0x82')],_0x250e07[_0x8906('0x83')],_0x250e07[_0x8906('0x84')],_0x250e07[_0x8906('0x5e')],_0x250e07[_0x8906('0x85')]||'en')[_0x8906('0x15')](function(_0x5a9ae4){_0x981e3b(null,_0x5a9ae4);})['catch'](function(_0x1979c0){_0x981e3b(_0x1979c0);});};AGIVertices[_0x8906('0x19')]['sestekNDA']=function(_0x4095d3,_0x3c80ad){scripts['sestekNDA'](this['channel'],_0x4095d3)[_0x8906('0x15')](function(_0x284c1d){_0x3c80ad(null,_0x284c1d);})[_0x8906('0x16')](function(_0xdfa458){_0x3c80ad(_0xdfa458);});};AGIVertices[_0x8906('0x19')][_0x8906('0x86')]=function(_0x5afd00,_0x2e57f5){scripts[_0x8906('0x86')](_0x5afd00[_0x8906('0x7f')],_0x5afd00[_0x8906('0x5e')],_0x5afd00[_0x8906('0x87')]||_0x8906('0x88'),_0x5afd00[_0x8906('0x89')])[_0x8906('0x15')](function(_0x1a9509){_0x2e57f5(null,_0x1a9509);})[_0x8906('0x16')](function(_0x18fa33){_0x2e57f5(_0x18fa33);});};AGIVertices['prototype'][_0x8906('0x8a')]=function(_0x36729a,_0x3657d8,_0x1f95c3){scripts[_0x8906('0x8a')](_0x3657d8,_0x36729a['key'],_0x36729a['ispeech_asr_language']||_0x8906('0x88'),this[_0x8906('0x8b')](_0x36729a[_0x8906('0x8c')])?_0x36729a[_0x8906('0x8c')]:undefined)[_0x8906('0x15')](function(_0x1aad91){_0x1f95c3(null,_0x1aad91);})[_0x8906('0x16')](function(_0x2b6359){_0x1f95c3(_0x2b6359);});};AGIVertices[_0x8906('0x19')][_0x8906('0x8d')]=function(_0x27147e,_0x20acc2){scripts[_0x8906('0x8d')](_0x27147e[_0x8906('0x8e')],_0x27147e[_0x8906('0x8f')],_0x27147e[_0x8906('0x90')],_0x27147e[_0x8906('0x91')]||_0x8906('0x92'),_0x27147e[_0x8906('0x5e')],_0x27147e[_0x8906('0x93')]||'text')['then'](function(_0x4b1c38){_0x20acc2(null,_0x4b1c38);})[_0x8906('0x16')](function(_0x2e9a37){_0x20acc2(_0x2e9a37);});};AGIVertices['prototype'][_0x8906('0x94')]=function(_0x5ce224,_0x4ef525){scripts[_0x8906('0x94')](this[_0x8906('0x10')][_0x8906('0x39')],_0x5ce224[_0x8906('0x8e')],_0x5ce224['aws_secret_access_key'],_0x5ce224[_0x8906('0x95')],_0x5ce224[_0x8906('0x5e')],_0x5ce224['aws_bot_name'])['then'](function(_0x43dbba){_0x4ef525(null,_0x43dbba);})[_0x8906('0x16')](function(_0x2e8dec){_0x4ef525(_0x2e8dec);});};AGIVertices[_0x8906('0x19')][_0x8906('0x96')]=function(_0x36768a,_0x36df88,_0x3f8230){scripts[_0x8906('0x96')](_0x36df88,_0x36768a[_0x8906('0x7f')],_0x36768a[_0x8906('0x97')]||'en-US')['then'](function(_0x1bc3fe){_0x3f8230(null,_0x1bc3fe);})['catch'](function(_0x29d3c4){_0x3f8230(_0x29d3c4);});};AGIVertices[_0x8906('0x19')][_0x8906('0x98')]=function(_0x20397d,_0x87f2b8,_0x5e4217){scripts[_0x8906('0x98')](_0x87f2b8,_0x20397d[_0x8906('0x99')],_0x20397d['appsecret'],_0x20397d[_0x8906('0x76')])['then'](function(_0x556fab){_0x5e4217(null,_0x556fab);})['catch'](function(_0x5013fc){_0x5e4217(_0x5013fc);});};AGIVertices[_0x8906('0x19')]['clear']=function(_0x1df708){var _0x2c2599=_['includes'](verticesWithRetry,_0x1df708[_0x8906('0x3b')])?_0x1df708:_[_0x8906('0x9a')](_0x1df708);for(var _0x4e3499 in _0x2c2599){if(_0x2c2599[_0x8906('0x9b')](_0x4e3499)){if(_0x2c2599[_0x4e3499]&&_[_0x8906('0x9c')](_0x2c2599[_0x4e3499])){if(_[_0x8906('0x6b')](recursiveMapAttributes,_0x4e3499)){_0x2c2599[_0x4e3499]=this['replaceObjectAllVariables'](_0x2c2599[_0x4e3499]);}else{_0x2c2599[_0x4e3499]=this[_0x8906('0x9d')](_0x2c2599[_0x4e3499]);}}}}return _0x2c2599;};AGIVertices[_0x8906('0x19')][_0x8906('0x9e')]=function(_0x161f70){for(var _0x4f609a in _0x161f70){if(_0x161f70[_0x8906('0x9b')](_0x4f609a)){if(_[_0x8906('0x9f')](_0x161f70[_0x4f609a])){this['recursiveNodeIndex'](_0x161f70[_0x4f609a]);}else if(_[_0x8906('0xa0')](_0x161f70[_0x4f609a])){for(var _0x483cfa=0x0;_0x483cfa<_0x161f70[_0x4f609a][_0x8906('0xa1')];_0x483cfa++){this[_0x8906('0x9e')](_0x161f70[_0x4f609a][_0x483cfa]);}}else if(_['isString'](_0x161f70[_0x4f609a])){_0x161f70[_0x4f609a]=this['replaceAllVariables'](_0x161f70[_0x4f609a]);}}}};AGIVertices[_0x8906('0x19')]['saveRestApiResult']=function(_0x3ad789,_0x1be5eb){for(var _0x1485e8 in _0x3ad789){if(_0x3ad789[_0x8906('0x9b')](_0x1485e8)){if(_['isPlainObject'](_0x3ad789[_0x1485e8])){if(!_[_0x8906('0x47')](_0x3ad789[_0x1485e8])){this['saveRestApiResult'](_0x3ad789[_0x1485e8],util[_0x8906('0x2c')]('%s.%s',_0x1be5eb,_0x1485e8));}}else if(_['isArray'](_0x3ad789[_0x1485e8])){for(var _0x29c48f=0x0;_0x29c48f<_0x3ad789[_0x1485e8][_0x8906('0xa1')];_0x29c48f++){this[_0x8906('0xa2')](_0x3ad789[_0x1485e8][_0x29c48f],util['format'](_0x8906('0xa3'),_0x1be5eb,_0x1485e8+'['+_0x29c48f+']'));}}else{if(!_[_0x8906('0x48')](_0x3ad789[_0x1485e8])){this[_0x8906('0x10')][_0x8906('0xa4')](util['format'](_0x8906('0xa3'),_0x1be5eb,_0x1485e8),_0x3ad789[_0x1485e8]);}}}}};AGIVertices[_0x8906('0x19')]['replaceObjectAllVariables']=function(_0x563d27){try{var _0x28f564=JSON[_0x8906('0x73')](_0x563d27);this[_0x8906('0x9e')](_0x28f564);return JSON[_0x8906('0x78')](_0x28f564);}catch(_0x1f9c92){return this[_0x8906('0x9d')](_0x563d27);}};AGIVertices[_0x8906('0x19')][_0x8906('0x9d')]=function(_0x2ca540){var _0x13fd1d=_0x2ca540[_0x8906('0xa5')]('{');for(var _0x7a36ee=0x1;_0x7a36ee<_0x13fd1d[_0x8906('0xa1')];_0x7a36ee+=0x1){var _0xa28de=_0x13fd1d[_0x7a36ee][_0x8906('0xa5')]('}');if(_0xa28de[_0x8906('0xa1')]>0x1){_0x2ca540=_0x2ca540['replaceAll']('{'+_0xa28de[0x0]+'}',this[_0x8906('0x10')][_0x8906('0x13')](_0xa28de[0x0])[_0x8906('0xa6')]||_0xa28de[0x0]);}}if(_0x13fd1d[_0x8906('0xa1')]===0x1){return _0x2ca540[_0x8906('0xa7')]();}return this['replaceAllVariables'](_0x2ca540);};AGIVertices[_0x8906('0x19')]['getAndSetVariable']=function(_0x32cc16,_0xc8ebe1){var _0x1d1bc5=this[_0x8906('0x10')][_0x8906('0x13')](_0x32cc16);if(_0x1d1bc5[_0x8906('0xa8')]===-0x1){return _0x1d1bc5;}logger['info'](util[_0x8906('0x2c')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0xc8ebe1,_0x1d1bc5[_0x8906('0xa6')]));return this[_0x8906('0x10')][_0x8906('0xa4')](_0xc8ebe1,_0x1d1bc5['extra']);};AGIVertices[_0x8906('0x19')][_0x8906('0x8b')]=function(_0x1b4004){return _0x1b4004&&_0x1b4004!=='0'&&_0x1b4004!=='-1'&&_0x1b4004!=='';};AGIVertices[_0x8906('0x19')][_0x8906('0xa9')]=function(_0x26d683){this[_0x8906('0x38')]['sync'](this,_0x26d683,'-');_0x26d683[_0x8906('0xaa')]=_0x26d683['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x8906('0x19')][_0x8906('0xab')]=function(_0x20117e){logger[_0x8906('0x32')](util[_0x8906('0x2c')](_0x8906('0xac'),_0x20117e[_0x8906('0x3a')]));if(!this['isConfigured'](_0x20117e[_0x8906('0x5e')])){return this[_0x8906('0x10')][_0x8906('0xad')](_0x8906('0xae'));}var _0x261789='\x22'+_0x20117e[_0x8906('0x5e')]+'\x22';if(this[_0x8906('0x8b')](_0x20117e[_0x8906('0x7d')])){_0x261789+=','+_0x20117e[_0x8906('0x7d')];}var _0xb921e3=this['channel']['exec'](_0x8906('0xaf'),_0x261789);if(_0xb921e3[_0x8906('0xa8')]===-0x1){return _0xb921e3;}return this[_0x8906('0x10')][_0x8906('0xad')](util[_0x8906('0x2c')](_0x8906('0xb0'),_0x261789));};AGIVertices[_0x8906('0x19')][_0x8906('0xb1')]=function(_0x3f71bc){logger[_0x8906('0x32')](util[_0x8906('0x2c')](_0x8906('0xb2'),_0x3f71bc[_0x8906('0x3a')]));if(!this[_0x8906('0x8b')](_0x3f71bc[_0x8906('0xb3')])){return this[_0x8906('0x10')]['noop']('no\x20grammar\x20configured');}var _0x1d909e=_0x3f71bc['grammar'];if(this[_0x8906('0x8b')](_0x3f71bc[_0x8906('0x7d')])){_0x1d909e+=','+_0x3f71bc['options'];}var _0x1179b1=this[_0x8906('0x10')][_0x8906('0x59')](_0x8906('0xb4'),_0x1d909e);if(_0x1179b1[_0x8906('0xa8')]===-0x1){return _0x1179b1;}var _0x57202c=this[_0x8906('0xb5')](_0x8906('0xb6'),_0x8906('0xb7'));if(_0x57202c['result']===-0x1){return _0x57202c;}var _0x495f83=this[_0x8906('0xb5')](_0x8906('0xb8'),'MRCP_RECOG_TRANSCRIPT');if(_0x495f83[_0x8906('0xa8')]===-0x1){return _0x495f83;}var _0x1b9ab8=this[_0x8906('0xb5')](_0x8906('0xb9'),_0x8906('0xba'));if(_0x1b9ab8[_0x8906('0xa8')]===-0x1){return _0x1b9ab8;}return this['channel']['noop'](util['format'](_0x8906('0xbb'),_0x1d909e));};AGIVertices[_0x8906('0x19')]['agi']=function(_0x38eb36){logger[_0x8906('0x32')](util[_0x8906('0x2c')](_0x8906('0xbc'),_0x38eb36[_0x8906('0x3a')]));return this[_0x8906('0x10')][_0x8906('0x9')]([_0x38eb36[_0x8906('0xbd')],_0x38eb36[_0x8906('0xbe')]]);};AGIVertices[_0x8906('0x19')]['answer']=function(_0x7591fd){logger[_0x8906('0x32')](util['format'](_0x8906('0xbf'),_0x7591fd[_0x8906('0x3a')]));if(this[_0x8906('0x8b')](_0x7591fd[_0x8906('0x69')])){logger[_0x8906('0x32')](util[_0x8906('0x2c')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x7591fd[_0x8906('0x69')]));var _0x46943b=this[_0x8906('0x10')][_0x8906('0xc0')](_0x7591fd['timeout']);if(_0x46943b[_0x8906('0xa8')]===-0x1){return _0x46943b;}}return this[_0x8906('0x10')][_0x8906('0xc1')]();};AGIVertices[_0x8906('0x19')][_0x8906('0x4f')]=function(_0x2acc0b){logger[_0x8906('0x32')](util[_0x8906('0x2c')](_0x8906('0xc2'),_0x2acc0b[_0x8906('0x3a')]));if(!this[_0x8906('0x8b')](_0x2acc0b[_0x8906('0x4d')])){return this[_0x8906('0x10')][_0x8906('0x30')](_0x2acc0b,_0x8906('0xc3'));}_0x2acc0b[_0x8906('0x4e')]=moment();if(this[_0x8906('0x8b')](_0x2acc0b[_0x8906('0xc4')])){_0x2acc0b['scheduledAt']=moment()['add'](_0x2acc0b['delay'],_0x8906('0xc5'));}if(!this[_0x8906('0x8b')](_0x2acc0b[_0x8906('0x51')])){_0x2acc0b['callback_priority']=0x2;}this[_0x8906('0x46')][_0x8906('0x75')](this,_0x2acc0b);return this[_0x8906('0x10')][_0x8906('0xad')](util['format'](_0x8906('0xc6'),_0x2acc0b['phone'],_0x2acc0b[_0x8906('0x4d')],_0x2acc0b[_0x8906('0x4e')]));};AGIVertices[_0x8906('0x19')][_0x8906('0xc7')]=function(_0x5f00ed){logger[_0x8906('0x32')](util[_0x8906('0x2c')](_0x8906('0xc8'),_0x5f00ed['label']));var _0x180f5a=this['channel'][_0x8906('0x59')](_0x5f00ed[_0x8906('0xc9')],_0x5f00ed[_0x8906('0x7d')]);if(_0x180f5a[_0x8906('0xa8')]===-0x1){return _0x180f5a;}return this['channel'][_0x8906('0xad')](util[_0x8906('0x2c')]('Executed\x20command\x20%s\x20%s',_0x5f00ed[_0x8906('0xc9')],_0x5f00ed[_0x8906('0x7d')]));};AGIVertices['prototype'][_0x8906('0xca')]=function(_0x784e0f){logger['info'](util[_0x8906('0x2c')](_0x8906('0xcb'),_0x784e0f[_0x8906('0x3a')]));if(!this[_0x8906('0x8b')](_0x784e0f[_0x8906('0x5e')])){return this[_0x8906('0x10')][_0x8906('0xad')](_0x8906('0xae'));}var _0x13c5aa='\x22'+_0x784e0f['text']+'\x22';if(this[_0x8906('0x8b')](_0x784e0f[_0x8906('0x7d')])){_0x13c5aa+=','+_0x784e0f[_0x8906('0x7d')];}var _0x55466c=this[_0x8906('0x10')][_0x8906('0x59')](_0x8906('0xaf'),_0x13c5aa);if(_0x55466c[_0x8906('0xa8')]===-0x1){return _0x55466c;}return this[_0x8906('0x10')][_0x8906('0xad')](util[_0x8906('0x2c')](_0x8906('0xb0'),_0x13c5aa));};AGIVertices['prototype'][_0x8906('0xcc')]=function(_0x24ec5f){logger['info'](util[_0x8906('0x2c')](_0x8906('0xcd'),_0x24ec5f[_0x8906('0x3a')]));if(!this[_0x8906('0x8b')](_0x24ec5f[_0x8906('0x5e')])){return this[_0x8906('0x10')]['noop'](_0x8906('0xae'));}var _0x77f629='\x22'+_0x24ec5f[_0x8906('0x5e')]+'\x22';if(this[_0x8906('0x8b')](_0x24ec5f[_0x8906('0x7d')])){_0x77f629+=','+_0x24ec5f[_0x8906('0x7d')];}var _0x51e6ff=this[_0x8906('0x10')][_0x8906('0x59')](_0x8906('0xaf'),_0x77f629);if(_0x51e6ff['result']===-0x1){return _0x51e6ff;}return this[_0x8906('0x10')][_0x8906('0xad')](util['format'](_0x8906('0xb0'),_0x77f629));};AGIVertices[_0x8906('0x19')][_0x8906('0xce')]=function(_0x25749c){logger['info'](util['format'](_0x8906('0xcf'),_0x25749c['label']));if(!this[_0x8906('0x8b')](_0x25749c[_0x8906('0xb3')])){return this['channel']['noop'](_0x8906('0xd0'));}var _0x2af178=_0x25749c['grammar'];if(this[_0x8906('0x8b')](_0x25749c[_0x8906('0x7d')])){_0x2af178+=','+_0x25749c[_0x8906('0x7d')];}var _0xf4401f=this['channel']['exec']('MRCPRecog',_0x2af178);if(_0xf4401f[_0x8906('0xa8')]===-0x1){return _0xf4401f;}var _0x3c75fc=this[_0x8906('0xb5')]('RECOG_CONFIDENCE()',_0x8906('0xd1'));if(_0x3c75fc[_0x8906('0xa8')]===-0x1){return _0x3c75fc;}var _0x3c4b48=this[_0x8906('0xb5')](_0x8906('0xb8'),_0x8906('0xd2'));if(_0x3c4b48[_0x8906('0xa8')]===-0x1){return _0x3c4b48;}var _0x12934c=this[_0x8906('0xb5')](_0x8906('0xb9'),_0x8906('0xd3'));if(_0x12934c[_0x8906('0xa8')]===-0x1){return _0x12934c;}return this['channel']['noop'](util[_0x8906('0x2c')](_0x8906('0xbb'),_0x2af178));};AGIVertices[_0x8906('0x19')]['sestekasr']=function(_0x46746b){logger[_0x8906('0x32')](util[_0x8906('0x2c')](_0x8906('0xd4'),_0x46746b[_0x8906('0x3a')]));if(!this['isConfigured'](_0x46746b[_0x8906('0xb3')])){return this[_0x8906('0x10')]['noop'](_0x8906('0xd0'));}var _0x409b78=_0x46746b[_0x8906('0xb3')];if(this['isConfigured'](_0x46746b[_0x8906('0x7d')])){_0x409b78+=','+_0x46746b['options'];}var _0x1ca3b8=this[_0x8906('0x10')][_0x8906('0x59')](_0x8906('0xb4'),_0x409b78);if(_0x1ca3b8[_0x8906('0xa8')]===-0x1){return _0x1ca3b8;}var _0x13362f=this[_0x8906('0xb5')]('RECOG_CONFIDENCE()',_0x8906('0xd5'));if(_0x13362f['result']===-0x1){return _0x13362f;}var _0x48f4cb=this[_0x8906('0xb5')](_0x8906('0xb8'),_0x8906('0xd6'));if(_0x48f4cb[_0x8906('0xa8')]===-0x1){return _0x48f4cb;}var _0x2bde73=this[_0x8906('0xb5')](_0x8906('0xb9'),_0x8906('0xd7'));if(_0x2bde73[_0x8906('0xa8')]===-0x1){return _0x2bde73;}return this['channel'][_0x8906('0xad')](util[_0x8906('0x2c')]('Executed\x20command\x20MRCPRecog\x20%s',_0x409b78));};AGIVertices['prototype'][_0x8906('0xd8')]=function(_0x58ebe1){logger['info'](util[_0x8906('0x2c')](_0x8906('0xd9'),_0x58ebe1['label']));if(!this['isConfigured'](_0x58ebe1[_0x8906('0xda')])){return this[_0x8906('0x10')][_0x8906('0x30')](_0x58ebe1,_0x8906('0xdb'));}var _0x3cbebf=this[_0x8906('0x1b')][_0x8906('0x75')](this,_0x58ebe1[_0x8906('0xda')]);if(!_0x3cbebf){return this[_0x8906('0x10')][_0x8906('0x30')](_0x58ebe1,'no\x20odbc\x20database\x20found');}if(!this[_0x8906('0x8b')](_0x58ebe1['query'])){return this[_0x8906('0x10')][_0x8906('0x30')](_0x58ebe1,_0x8906('0xdc'));}var _0x3f3fa4=_0x58ebe1[_0x8906('0xdd')][_0x8906('0xde')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x8906('0xad')](util[_0x8906('0x2c')]('query:\x20%s',_0x3f3fa4));var _0x40f3db=this['getQueryOdbc'][_0x8906('0x75')](this,_0x3cbebf,_0x3f3fa4);this[_0x8906('0x38')][_0x8906('0x75')](this,_0x58ebe1,_0x3f3fa4);if(!this[_0x8906('0x8b')](_0x58ebe1[_0x8906('0xdf')])){return this[_0x8906('0x10')][_0x8906('0xad')](_0x8906('0xe0'));}var _0x2999ea=this[_0x8906('0x13')][_0x8906('0x75')](this,_0x58ebe1[_0x8906('0xdf')]);if(!_0x2999ea){return this[_0x8906('0x10')]['error'](_0x58ebe1,_0x8906('0xe1'));}var _0x58d7fc=this;_0x40f3db['forEach'](function(_0x3f0855,_0x52fcdb){Object['keys'](_0x3f0855)['forEach'](function(_0x1baea3){_0x58d7fc[_0x8906('0x10')][_0x8906('0xa4')](util[_0x8906('0x2c')](_0x8906('0xe2'),_0x2999ea,_0x52fcdb,_0x1baea3),_0x3f0855[_0x1baea3]);});});this['channel'][_0x8906('0xa4')](util[_0x8906('0x2c')](_0x8906('0xe3'),_0x2999ea),_0x40f3db[_0x8906('0xa1')]);return this[_0x8906('0x10')]['noop'](util['format'](_0x8906('0xe4'),_0x2999ea));};AGIVertices[_0x8906('0x19')][_0x8906('0xe5')]=function(_0x11b6b4){logger[_0x8906('0xe6')](util[_0x8906('0x2c')](_0x8906('0xe7'),_0x11b6b4[_0x8906('0x3a')]));if(!this['isConfigured'](_0x11b6b4[_0x8906('0xe8')])){return this[_0x8906('0x10')][_0x8906('0x30')](_0x11b6b4,_0x8906('0xe9'));}var _0x5a5f31=this['getUser'][_0x8906('0x75')](this,_0x11b6b4['sip_id']);if(!_0x5a5f31){return this[_0x8906('0x10')][_0x8906('0x30')](_0x11b6b4,_0x8906('0xea'));}var _0x49ddeb=this[_0x8906('0x10')]['exec']('DIAL',[util[_0x8906('0x2c')]('SIP/%s',_0x5a5f31),_0x11b6b4['timeout'],_0x11b6b4['opts'],_0x11b6b4[_0x8906('0x67')]]);if(_0x49ddeb[_0x8906('0xa8')]===-0x1){return _0x49ddeb;}return this[_0x8906('0x10')][_0x8906('0xad')](util[_0x8906('0x2c')](_0x8906('0xeb'),_0x8906('0xec')));};AGIVertices[_0x8906('0x19')][_0x8906('0xed')]=function(_0x294169){logger[_0x8906('0x32')](util[_0x8906('0x2c')](_0x8906('0xee'),_0x294169['label']));if(!this['isConfigured'](_0x294169[_0x8906('0x7f')])){return this[_0x8906('0x10')][_0x8906('0xad')]('no\x20key\x20configured');}if(!this['isConfigured'](_0x294169[_0x8906('0x5e')])){return this[_0x8906('0x10')][_0x8906('0xad')](_0x8906('0xae'));}this[_0x8906('0x10')][_0x8906('0xef')]=!![];this[_0x8906('0x38')](_0x294169);this[_0x8906('0x45')](_0x294169[_0x8906('0x5e')],'in','','');this[_0x8906('0x10')]['noop'](util[_0x8906('0x2c')](_0x8906('0xf0'),_0x294169[_0x8906('0x5e')]));var _0x64f5f4=this[_0x8906('0x7e')][_0x8906('0x75')](this,_0x294169);if(_0x64f5f4){for(var _0x49bf47 in _0x64f5f4){if(_0x64f5f4[_0x8906('0x9b')](_0x49bf47)){this['channel']['setVariable'](util['format'](_0x8906('0xf1'),_0x49bf47[_0x8906('0x6e')]()),_0x64f5f4[_0x49bf47]);}}this[_0x8906('0x45')](_0x64f5f4[_0x8906('0xf2')],_0x8906('0xf3'),_0x8906('0xed'),'');return this[_0x8906('0x10')][_0x8906('0xad')](util[_0x8906('0x2c')]('Dialogflow\x20Result\x20%s',_0x64f5f4[_0x8906('0xf2')]));}return this[_0x8906('0x10')]['error'](_0x294169,_0x8906('0xf4'));};AGIVertices[_0x8906('0x19')][_0x8906('0xf5')]=function(_0x799e43){logger[_0x8906('0x32')](util['format'](_0x8906('0xf6'),_0x799e43[_0x8906('0x3a')]));if(!this[_0x8906('0x8b')](_0x799e43[_0x8906('0x82')])){return this[_0x8906('0x10')][_0x8906('0xad')]('no\x20project_id\x20configured');}if(!this['isConfigured'](_0x799e43[_0x8906('0x83')])){return this[_0x8906('0x10')][_0x8906('0xad')]('no\x20client_email\x20configured');}if(!this['isConfigured'](_0x799e43[_0x8906('0x84')])){return this[_0x8906('0x10')][_0x8906('0xad')]('no\x20private_key\x20configured');}if(!this[_0x8906('0x8b')](_0x799e43[_0x8906('0x85')])){return this[_0x8906('0x10')][_0x8906('0xad')](_0x8906('0xf7'));}if(!this['isConfigured'](_0x799e43[_0x8906('0x5e')])){return this[_0x8906('0x10')][_0x8906('0xad')](_0x8906('0xae'));}this[_0x8906('0x10')][_0x8906('0xef')]=!![];this[_0x8906('0x38')](_0x799e43);this[_0x8906('0x45')](_0x799e43['text'],'in','','');this['channel'][_0x8906('0xad')](util[_0x8906('0x2c')](_0x8906('0xf8'),_0x799e43['text']));var _0x1b916a=this[_0x8906('0x81')][_0x8906('0x75')](this,_0x799e43);if(_0x1b916a){for(var _0x1035e3 in _0x1b916a){if(_0x1b916a[_0x8906('0x9b')](_0x1035e3)){if(_0x1035e3!=='providerResponse'){this[_0x8906('0x10')]['setVariable'](util[_0x8906('0x2c')]('DIALOGFLOW_%s',_0x1035e3['toUpperCase']()),_0x1b916a[_0x1035e3]);}}}this[_0x8906('0x45')](_0x1b916a['speech'],'out',_0x8906('0xf5'),_0x1b916a[_0x8906('0xf9')]);return this[_0x8906('0x10')][_0x8906('0xad')](util[_0x8906('0x2c')](_0x8906('0xfa'),_0x1b916a[_0x8906('0xf2')]));}return this[_0x8906('0x10')][_0x8906('0x30')](_0x799e43,_0x8906('0xfb'));};AGIVertices[_0x8906('0x19')]['sesteknda']=function(_0x5c390c){logger['info'](util[_0x8906('0x2c')](_0x8906('0xfc'),_0x5c390c[_0x8906('0x3a')]));if(!this[_0x8906('0x8b')](_0x5c390c[_0x8906('0xfd')])){return this['channel']['noop'](_0x8906('0xfe'));}if(!this[_0x8906('0x8b')](_0x5c390c[_0x8906('0xff')])){return this['channel'][_0x8906('0xad')]('no\x20username\x20configured');}if(!this['isConfigured'](_0x5c390c[_0x8906('0x100')])){return this[_0x8906('0x10')][_0x8906('0xad')](_0x8906('0x101'));}if(!this[_0x8906('0x8b')](_0x5c390c['ndassistant_url'])){return this[_0x8906('0x10')]['noop'](_0x8906('0xae'));}this[_0x8906('0x10')][_0x8906('0xef')]=!![];this[_0x8906('0x38')](_0x5c390c);this[_0x8906('0x45')](_0x5c390c['text'],'in','','');this[_0x8906('0x10')]['noop'](util['format'](_0x8906('0x102'),_0x5c390c[_0x8906('0x5e')]));var _0x530c96=this['sestekNDA'][_0x8906('0x75')](this,_0x5c390c);if(_0x530c96){for(var _0x509d28 in _0x530c96){if(_0x530c96['hasOwnProperty'](_0x509d28)){this[_0x8906('0x10')][_0x8906('0xa4')](util[_0x8906('0x2c')]('SESTEK_NDA_%s',_0x509d28[_0x8906('0x6e')]()),_0x530c96[_0x509d28]);}}this[_0x8906('0x45')](_0x530c96[_0x8906('0xf2')],'out',_0x8906('0x103'),'');if(_0x530c96[_0x8906('0x104')]){this[_0x8906('0x10')][_0x8906('0xad')](util[_0x8906('0x2c')](_0x8906('0x105'),_0x530c96[_0x8906('0x104')]));var _0xd791ea=this[_0x8906('0x10')][_0x8906('0x106')](_0x530c96[_0x8906('0x104')]);try{fs[_0x8906('0x107')](_0x530c96[_0x8906('0x104')]+'.wav');}catch(_0x5cb480){logger[_0x8906('0x30')](_0x5cb480);}return _0xd791ea;}else{return this[_0x8906('0x10')][_0x8906('0xad')](util[_0x8906('0x2c')]('SestekNDA\x20Result\x20%s',_0x530c96[_0x8906('0xf2')]));}}return this['channel'][_0x8906('0x30')](_0x5c390c,_0x8906('0x108'));};AGIVertices[_0x8906('0x19')]['end']=function(_0x42ddbb){logger[_0x8906('0x32')](util[_0x8906('0x2c')](_0x8906('0x109'),_0x42ddbb[_0x8906('0x3a')]));return this[_0x8906('0x10')]['noop']('end');};AGIVertices[_0x8906('0x19')][_0x8906('0x10a')]=function(_0x446dcf){logger[_0x8906('0x32')](util[_0x8906('0x2c')](_0x8906('0x10b'),_0x446dcf[_0x8906('0x3a')]));var _0x570ce5='';if(_0x446dcf[_0x8906('0x10c')]){if(!this['isConfigured'](_0x446dcf['trunk_id'])){return this[_0x8906('0x10')][_0x8906('0x30')](_0x446dcf,_0x8906('0x10d'));}else{var _0x528e0a=parseInt(_0x446dcf[_0x8906('0x10c')],0xa);if(isNaN(_0x528e0a)){_0x570ce5=_0x446dcf[_0x8906('0x10c')];}else{_0x570ce5=this[_0x8906('0x1f')][_0x8906('0x75')](this,_0x446dcf[_0x8906('0x10c')]);if(!_0x570ce5){return this['channel'][_0x8906('0x30')](_0x446dcf,_0x8906('0x10e'));}}}}else if(_0x446dcf[_0x8906('0x10f')]){_0x570ce5=_0x446dcf['trunk_name'];}else{return this[_0x8906('0x10')]['error'](_0x446dcf,_0x8906('0x10d'));}var _0x3b3f9d=this['channel'][_0x8906('0x59')](_0x8906('0xec'),[util['format']('SIP/%s/%s',_0x570ce5,_0x446dcf[_0x8906('0x4c')]),_0x446dcf[_0x8906('0x69')],_0x446dcf[_0x8906('0x110')],_0x446dcf[_0x8906('0x67')]]);if(_0x3b3f9d[_0x8906('0xa8')]===-0x1){return _0x3b3f9d;}return this[_0x8906('0x10')]['noop'](util[_0x8906('0x2c')](_0x8906('0xeb'),'DIAL'));};AGIVertices[_0x8906('0x19')][_0x8906('0x111')]=function(_0x3ca5f4){logger[_0x8906('0x32')](util[_0x8906('0x2c')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x3ca5f4['label']));return this[_0x8906('0x10')][_0x8906('0xad')](_0x8906('0x111'));};AGIVertices[_0x8906('0x19')][_0x8906('0xe')]=function(_0x428996){logger['info'](util[_0x8906('0x2c')](_0x8906('0x112'),_0x428996[_0x8906('0x3a')]));if(_0x428996[_0x8906('0xaa')]===0x0){return this[_0x8906('0xa9')](_0x428996);}_0x428996['retry']-=0x1;if(!this[_0x8906('0x8b')](_0x428996['file_id'])){return this[_0x8906('0x10')]['error'](_0x428996,_0x8906('0x113'));}var _0x2a6f13=this[_0x8906('0x114')][_0x8906('0x75')](this,_0x428996['file_id']);if(!_0x2a6f13){return this[_0x8906('0x10')][_0x8906('0x30')](_0x428996,'no\x20file\x20audio\x20found');}if(!this[_0x8906('0x8b')](_0x428996['variable_id'])){return this[_0x8906('0x10')]['error'](_0x8906('0xe0'));}var _0x268546=this['channel'][_0x8906('0x115')](_0x2a6f13,_0x428996[_0x8906('0x116')],_0x428996[_0x8906('0x117')]);var _0x2c04d7=_0x268546[_0x8906('0xa8')]?_0x268546['result']['toString']():'';logger[_0x8906('0x32')]('test',JSON['stringify'](_0x268546));if(_0x268546[_0x8906('0xa8')]===-0x1){this['createSquareDetailsReport'][_0x8906('0x75')](this,_0x428996,_0x2c04d7);return _0x268546;}else if(_0x268546[_0x8906('0xa6')]==='timeout'){_0x268546[_0x8906('0xa8')]=_0x2c04d7['length']>=parseInt(_0x428996[_0x8906('0x118')])?'x':'i';}else{_0x268546['result']=_0x2c04d7['length']>=parseInt(_0x428996[_0x8906('0x118')])&&_0x2c04d7[_0x8906('0xa1')]<=parseInt(_0x428996[_0x8906('0x117')])?'x':'i';}var _0x525074=this['getVariable'][_0x8906('0x75')](this,_0x428996[_0x8906('0xdf')]);if(!_0x525074){return this['channel'][_0x8906('0x30')](_0x428996,_0x8906('0xe1'));}this['channel'][_0x8906('0xa4')](_0x525074,_0x2c04d7);if(this[_0x8906('0x8b')](_0x428996[_0x8906('0x119')])){var _0x26b7b7=parseInt(_0x428996[_0x8906('0x119')],0xa);var _0x5eb246=rs[_0x8906('0x11a')]({'charset':'*','length':_0x26b7b7});var _0x25eac1=_0x2c04d7[_0x8906('0xa1')];if(_0x25eac1>0x0){if(_0x25eac1>_0x26b7b7){this[_0x8906('0x38')][_0x8906('0x75')](this,_0x428996,_0x428996[_0x8906('0x11b')]===_0x8906('0x11c')?_0x5eb246+_0x2c04d7[_0x8906('0x11d')](_0x26b7b7):_0x2c04d7[_0x8906('0x11d')](0x0,_0x25eac1-_0x26b7b7)+_0x5eb246);}else{this[_0x8906('0x38')][_0x8906('0x75')](this,_0x428996,rs[_0x8906('0x11a')]({'charset':'*','length':_0x25eac1}));}}else{this[_0x8906('0x38')][_0x8906('0x75')](this,_0x428996,'');}}else{this['createSquareDetailsReport'][_0x8906('0x75')](this,_0x428996,_0x2c04d7);}return _0x268546;};AGIVertices[_0x8906('0x19')]['getsecretdigits']=function(_0x246431){logger['info'](util[_0x8906('0x2c')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x246431[_0x8906('0x3a')]));return this[_0x8906('0xe')](_0x246431);};AGIVertices[_0x8906('0x19')]['goal']=function(_0xe66132){logger['info'](util[_0x8906('0x2c')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0xe66132[_0x8906('0x3a')]));this[_0x8906('0x38')][_0x8906('0x75')](this,_0xe66132,_0xe66132[_0x8906('0x11e')]);return this[_0x8906('0x10')][_0x8906('0xad')](util['format']('GOAL\x20%s',_0xe66132[_0x8906('0x11e')]));};AGIVertices[_0x8906('0x19')][_0x8906('0x11f')]=function(_0x15e74f){logger[_0x8906('0x32')](util[_0x8906('0x2c')](_0x8906('0x120'),_0x15e74f[_0x8906('0x3a')]));if(!this[_0x8906('0x8b')](_0x15e74f[_0x8906('0x8e')])||!this[_0x8906('0x8b')](_0x15e74f[_0x8906('0x8f')])){return this[_0x8906('0x10')][_0x8906('0xad')](_0x8906('0x121'));}if(!this['isConfigured'](_0x15e74f[_0x8906('0x5e')])){return this[_0x8906('0x10')]['noop'](_0x8906('0xae'));}this[_0x8906('0x10')][_0x8906('0xad')](util['format'](_0x8906('0x122'),_0x15e74f[_0x8906('0x5e')]));var _0x5820ff=this[_0x8906('0x8d')][_0x8906('0x75')](this,_0x15e74f);if(_0x5820ff){this['channel'][_0x8906('0xad')](util[_0x8906('0x2c')](_0x8906('0x123'),_0x5820ff));var _0x544e06=this[_0x8906('0x10')][_0x8906('0x106')](_0x5820ff);try{fs[_0x8906('0x107')](_0x5820ff+_0x8906('0x124'));}catch(_0x53bbd4){logger[_0x8906('0x30')](_0x53bbd4);}return _0x544e06;}return this[_0x8906('0x10')][_0x8906('0x30')](_0x15e74f,_0x8906('0x125'));};AGIVertices['prototype']['awslex']=function(_0x5ba4dc){logger['info'](util[_0x8906('0x2c')](_0x8906('0x126'),_0x5ba4dc[_0x8906('0x3a')]));if(!this[_0x8906('0x8b')](_0x5ba4dc[_0x8906('0x8e')])||!this[_0x8906('0x8b')](_0x5ba4dc[_0x8906('0x8f')])){return this[_0x8906('0x10')][_0x8906('0xad')](_0x8906('0x121'));}if(!this[_0x8906('0x8b')](_0x5ba4dc['aws_bot_name'])){return this[_0x8906('0x10')][_0x8906('0xad')](_0x8906('0x127'));}if(!this[_0x8906('0x8b')](_0x5ba4dc[_0x8906('0x5e')])){return this[_0x8906('0x10')][_0x8906('0xad')](_0x8906('0xae'));}this[_0x8906('0x10')][_0x8906('0xef')]=!![];this['createSquareDetailsReport'](_0x5ba4dc);this['createSquareMessage'](_0x5ba4dc['text'],'in','','');this['channel'][_0x8906('0xad')](util[_0x8906('0x2c')](_0x8906('0x128'),_0x5ba4dc['text']));var _0x37db7f=this['awsLex'][_0x8906('0x75')](this,_0x5ba4dc);if(_0x37db7f){for(var _0x32eeae in _0x37db7f){if(_0x37db7f[_0x8906('0x9b')](_0x32eeae)&&_[_0x8906('0x9c')](_0x37db7f[_0x32eeae])){this[_0x8906('0x10')]['setVariable'](util[_0x8906('0x2c')](_0x8906('0x129'),_0x32eeae[_0x8906('0x6e')]()),_0x37db7f[_0x32eeae]);}}if(_[_0x8906('0x48')](_0x37db7f[_0x8906('0x7c')])){return this[_0x8906('0x10')][_0x8906('0xad')](_0x8906('0x12a'));}else{this[_0x8906('0x45')](_0x37db7f[_0x8906('0x7c')],'out','amazonlex','');return this[_0x8906('0x10')][_0x8906('0xad')](util[_0x8906('0x2c')](_0x8906('0x12b'),_0x37db7f[_0x8906('0x7c')]));}}return this[_0x8906('0x10')]['error'](_0x5ba4dc,_0x8906('0x12c'));};AGIVertices['prototype'][_0x8906('0x12d')]=function(_0x2d52dc){logger['info'](util[_0x8906('0x2c')](_0x8906('0x12e'),_0x2d52dc['label'],_0x2d52dc[_0x8906('0x69')]));if(!this[_0x8906('0x8b')](_0x2d52dc[_0x8906('0x7f')])){return this[_0x8906('0x10')][_0x8906('0xad')](_0x8906('0x12f'));}var _0xa837fd=_0x8906('0x130');var _0x105fbb=util['format'](_0x8906('0x131'),FILES_PATH,rs[_0x8906('0x11a')](0x4));var _0x2a0b22=util[_0x8906('0x2c')](_0x8906('0xa3'),_0x105fbb,_0xa837fd);var _0x452b18=!![];if(_0x2d52dc[_0x8906('0x132')]===_0x8906('0x133')){_0x452b18=![];}var _0x441088=this[_0x8906('0x10')][_0x8906('0x134')](_0x105fbb,_0xa837fd,_0x2d52dc[_0x8906('0x135')],_0x2d52dc[_0x8906('0x69')],undefined,_0x452b18);if(_0x441088[_0x8906('0xa8')]!==-0x1){this[_0x8906('0x10')]['noop'](util['format']('google\x20%s\x20file\x20created',_0x2a0b22));var _0x1ef43e=this[_0x8906('0x96')]['sync'](this,_0x2d52dc,_0x2a0b22);if(_0x1ef43e){for(var _0x4d3d89 in _0x1ef43e){if(_0x1ef43e[_0x8906('0x9b')](_0x4d3d89)){this['channel']['setVariable'](util['format']('GOOGLE_ASR_%s',_0x4d3d89['toUpperCase']()),_0x1ef43e[_0x4d3d89]);}}return this[_0x8906('0x10')][_0x8906('0xad')](util['format'](_0x8906('0x136'),JSON[_0x8906('0x78')](_0x1ef43e)));}}return _0x441088;};AGIVertices[_0x8906('0x19')][_0x8906('0x137')]=function(_0x42b43b){logger[_0x8906('0x32')](util[_0x8906('0x2c')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x42b43b[_0x8906('0x3a')]));if(!this[_0x8906('0x8b')](_0x42b43b[_0x8906('0x99')])){return this[_0x8906('0x10')][_0x8906('0xad')](_0x8906('0x138'));}if(!this['isConfigured'](_0x42b43b[_0x8906('0x139')])){return this[_0x8906('0x10')][_0x8906('0xad')]('no\x20appsecret\x20configured');}var _0xde1aa8=_0x8906('0x130');var _0x2fd802=util[_0x8906('0x2c')](_0x8906('0x131'),FILES_PATH,rs[_0x8906('0x11a')](0x4));var _0x1ec685=util[_0x8906('0x2c')](_0x8906('0xa3'),_0x2fd802,_0xde1aa8);var _0x58b762=!![];if(_0x42b43b[_0x8906('0x132')]===_0x8906('0x133')){_0x58b762=![];}var _0x2c0539=this[_0x8906('0x10')][_0x8906('0x134')](_0x2fd802,_0xde1aa8,_0x42b43b['intKey'],_0x42b43b['timeout'],undefined,_0x58b762);if(_0x2c0539[_0x8906('0xa8')]!==-0x1){this[_0x8906('0x10')][_0x8906('0xad')](util['format'](_0x8906('0x13a'),_0x1ec685));var _0x526ef9=this[_0x8906('0x98')][_0x8906('0x75')](this,_0x42b43b,_0x1ec685);if(_0x526ef9){for(var _0x3d7e53 in _0x526ef9){if(_0x526ef9[_0x8906('0x9b')](_0x3d7e53)){this['channel'][_0x8906('0xa4')](util[_0x8906('0x2c')]('TILDE_ASR_%s',_0x3d7e53[_0x8906('0x6e')]()),_0x526ef9[_0x3d7e53]);}}return this[_0x8906('0x10')][_0x8906('0xad')](util[_0x8906('0x2c')]('TildeASR\x20Result\x20%s',JSON[_0x8906('0x78')](_0x526ef9)));}}return _0x2c0539;};AGIVertices[_0x8906('0x19')][_0x8906('0x13b')]=function(_0x46ccbc){logger[_0x8906('0x32')](util['format'](_0x8906('0x13c'),_0x46ccbc['label']));return this[_0x8906('0x10')][_0x8906('0x13d')](_0x46ccbc['context'],_0x46ccbc[_0x8906('0x41')],_0x46ccbc['priority']);};AGIVertices[_0x8906('0x19')][_0x8906('0x13e')]=function(_0x3e7bef){logger[_0x8906('0x32')](util['format']('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x3e7bef[_0x8906('0x3a')]));if(!this[_0x8906('0x8b')](_0x3e7bef['condition'])){return this[_0x8906('0x10')][_0x8906('0x30')](_0x3e7bef,_0x8906('0x13f'));}try{var _0x58d773=eval(_0x3e7bef[_0x8906('0x140')])?'true':_0x8906('0x141');this[_0x8906('0x10')]['noop'](util[_0x8906('0x2c')](_0x8906('0x142'),_0x3e7bef[_0x8906('0x140')],_0x58d773));return{'code':0xc8,'result':_0x58d773};}catch(_0x1576bc){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x8906('0x19')][_0x8906('0x143')]=function(_0x540526){logger[_0x8906('0x32')](util[_0x8906('0x2c')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x540526['label']));if(!this[_0x8906('0x8b')](_0x540526['interval_id'])){return this[_0x8906('0x10')][_0x8906('0x30')](_0x540526,_0x8906('0x144'));}var _0xe12671=this[_0x8906('0x145')][_0x8906('0x75')](this,_0x540526[_0x8906('0x146')]);if(!_0xe12671){return this['channel']['error'](_0x540526,_0x8906('0x147'));}for(var _0x4cd5a9=0x0;_0x4cd5a9<_0xe12671[_0x8906('0xa1')];_0x4cd5a9+=0x1){var _0x15200a=this[_0x8906('0x10')]['getVariable'](util[_0x8906('0x2c')](_0x8906('0x148'),_0xe12671[_0x4cd5a9]));if(_0x15200a[_0x8906('0xa8')]===-0x1){return _0x15200a;}logger[_0x8906('0x32')](util['format'](_0x8906('0x149'),_0xe12671[_0x4cd5a9],_0x15200a[_0x8906('0xa6')]));if(_0x15200a[_0x8906('0xa6')]===_0x8906('0x14a')){logger[_0x8906('0x32')](util[_0x8906('0x2c')](_0x8906('0x149'),_0xe12671[_0x4cd5a9],'true'));this[_0x8906('0x10')][_0x8906('0xad')](util[_0x8906('0x2c')](_0x8906('0x149'),_0xe12671[_0x4cd5a9],_0x8906('0x14a')));return{'code':0xc8,'result':_0x8906('0x14a')};}else{logger[_0x8906('0x32')](util[_0x8906('0x2c')]('IFTIME\x20%s\x20%s',_0xe12671[_0x4cd5a9],_0x8906('0x141')));this['channel'][_0x8906('0xad')](util[_0x8906('0x2c')](_0x8906('0x149'),_0xe12671[_0x4cd5a9],_0x8906('0x141')));}}return{'code':0xc8,'result':_0x8906('0x141')};};AGIVertices[_0x8906('0x19')][_0x8906('0x14b')]=function(_0x13e551){logger[_0x8906('0x32')](util[_0x8906('0x2c')](_0x8906('0x14c'),_0x13e551['label']));return this[_0x8906('0x10')][_0x8906('0x14b')]();};AGIVertices[_0x8906('0x19')][_0x8906('0x14d')]=function(_0x35d404){logger['info'](util[_0x8906('0x2c')](_0x8906('0x14e'),_0x35d404['label']));if(!this[_0x8906('0x8b')](_0x35d404[_0x8906('0x7f')])){return this[_0x8906('0x10')][_0x8906('0xad')]('no\x20key\x20configured');}var _0x2b1f79='wav';var _0x4c9cba=util[_0x8906('0x2c')](_0x8906('0x131'),FILES_PATH,rs['generate'](0x4));var _0x18bb97=util['format'](_0x8906('0xa3'),_0x4c9cba,_0x2b1f79);var _0x4cc8eb=!![];if(_0x35d404[_0x8906('0x132')]==='NOBEEP'){_0x4cc8eb=![];}var _0x431c2e=this[_0x8906('0x10')][_0x8906('0x134')](_0x4c9cba,_0x2b1f79,_0x35d404[_0x8906('0x135')],_0x35d404['timeout'],undefined,_0x4cc8eb);if(_0x431c2e['result']!==-0x1){this[_0x8906('0x10')][_0x8906('0xad')](util['format'](_0x8906('0x14f'),_0x18bb97));var _0x3c5176=this[_0x8906('0x8a')]['sync'](this,_0x35d404,_0x18bb97);if(_0x3c5176){for(var _0x2e7cf8 in _0x3c5176){if(_0x3c5176[_0x8906('0x9b')](_0x2e7cf8)){this[_0x8906('0x10')][_0x8906('0xa4')](util[_0x8906('0x2c')](_0x8906('0x150'),_0x2e7cf8[_0x8906('0x6e')]()),_0x3c5176[_0x2e7cf8]);}}return this['channel']['noop'](util['format']('IspeechASR\x20Result\x20%s',JSON[_0x8906('0x78')](_0x3c5176)));}}return _0x431c2e;};AGIVertices[_0x8906('0x19')][_0x8906('0x151')]=function(_0x23710e){logger[_0x8906('0x32')](util[_0x8906('0x2c')](_0x8906('0x152'),_0x23710e[_0x8906('0x3a')]));if(!this[_0x8906('0x8b')](_0x23710e[_0x8906('0x7f')])){return this[_0x8906('0x10')]['noop'](_0x8906('0x12f'));}if(!this[_0x8906('0x8b')](_0x23710e[_0x8906('0x5e')])){return this['channel'][_0x8906('0xad')](_0x8906('0xae'));}this[_0x8906('0x10')]['noop'](util['format'](_0x8906('0x153'),_0x23710e[_0x8906('0x5e')]));var _0x533731=this['ispeechTTS']['sync'](this,_0x23710e);if(_0x533731){this[_0x8906('0x10')][_0x8906('0xad')](util[_0x8906('0x2c')](_0x8906('0x14f'),_0x533731));var _0x1ddccc=this[_0x8906('0x10')][_0x8906('0x106')](_0x533731,_0x23710e['intKey']);try{fs[_0x8906('0x107')](_0x533731+_0x8906('0x124'));}catch(_0x512406){logger[_0x8906('0x30')](_0x512406);}return _0x1ddccc;}return this[_0x8906('0x10')][_0x8906('0x30')](_0x23710e,_0x8906('0x154'));};AGIVertices[_0x8906('0x19')][_0x8906('0x155')]=function(_0x20cdac){logger['info'](util[_0x8906('0x2c')](_0x8906('0x156'),_0x20cdac['label']));if(!this[_0x8906('0x8b')](_0x20cdac[_0x8906('0x157')])){return this[_0x8906('0x10')][_0x8906('0x30')](_0x20cdac,_0x8906('0x158'));}logger[_0x8906('0x32')](util[_0x8906('0x2c')](_0x8906('0x159'),this[_0x8906('0x10')][_0x8906('0x3d')],_0x20cdac[_0x8906('0x157')]));var _0x2c7904=this[_0x8906('0x15a')]['sync'](this,_0x20cdac[_0x8906('0x157')]);if(_0x2c7904){logger[_0x8906('0x32')](util[_0x8906('0x2c')](_0x8906('0x15b'),this['channel'][_0x8906('0x3d')],_0x20cdac[_0x8906('0x157')]));this[_0x8906('0x10')]['noop'](util[_0x8906('0x2c')](_0x8906('0x15b'),this[_0x8906('0x10')][_0x8906('0x3d')],_0x20cdac[_0x8906('0x157')]));return{'code':0xc8,'result':_0x8906('0x15c')};}else{logger['info'](util['format'](_0x8906('0x15d'),this[_0x8906('0x10')]['callerid'],_0x20cdac[_0x8906('0x157')]));this[_0x8906('0x10')][_0x8906('0xad')](util[_0x8906('0x2c')](_0x8906('0x15d'),this[_0x8906('0x10')][_0x8906('0x3d')],_0x20cdac[_0x8906('0x157')]));return{'code':0xc8,'result':_0x8906('0x15e')};}};AGIVertices[_0x8906('0x19')][_0x8906('0x15f')]=function(_0x5a1ad9){logger[_0x8906('0x32')](util['format']('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x5a1ad9[_0x8906('0x3a')]));if(!this['isConfigured'](_0x5a1ad9[_0x8906('0x157')])){return this[_0x8906('0x10')][_0x8906('0x30')](_0x5a1ad9,_0x8906('0x158'));}logger[_0x8906('0x32')](util[_0x8906('0x2c')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x8906('0x3d')],_0x5a1ad9[_0x8906('0x157')]));var _0x2c9394=this['agentLogout']['sync'](this,_0x5a1ad9[_0x8906('0x157')]);if(_0x2c9394){logger[_0x8906('0x32')](util['format'](_0x8906('0x15b'),this[_0x8906('0x10')][_0x8906('0x3d')],_0x5a1ad9[_0x8906('0x157')]));this['channel'][_0x8906('0xad')](util['format'](_0x8906('0x15b'),this[_0x8906('0x10')]['callerid'],_0x5a1ad9['findBy']));return{'code':0xc8,'result':_0x8906('0x15c')};}else{logger[_0x8906('0x32')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x8906('0x10')][_0x8906('0x3d')],_0x5a1ad9[_0x8906('0x157')]));this['channel']['noop'](util[_0x8906('0x2c')](_0x8906('0x15d'),this[_0x8906('0x10')][_0x8906('0x3d')],_0x5a1ad9['findBy']));return{'code':0xc8,'result':_0x8906('0x15e')};}};AGIVertices[_0x8906('0x19')][_0x8906('0x160')]=function(_0x5959f1){logger[_0x8906('0x32')](util['format']('Enter\x20in\x20MATH\x20(%s)\x20block',_0x5959f1[_0x8906('0x3a')]));if(!this[_0x8906('0x8b')](_0x5959f1[_0x8906('0x161')])){return this[_0x8906('0x10')][_0x8906('0x30')](_0x5959f1,_0x8906('0x162'));}this[_0x8906('0x10')][_0x8906('0xad')](util[_0x8906('0x2c')](_0x8906('0x163'),_0x5959f1[_0x8906('0x161')]));var _0x1bab22=eval(_0x5959f1[_0x8906('0x161')]);if(!this[_0x8906('0x8b')](_0x5959f1[_0x8906('0xdf')])){return this['channel'][_0x8906('0xad')](_0x8906('0xe0'));}var _0x2da153=this['getVariable'][_0x8906('0x75')](this,_0x5959f1['variable_id']);if(!_0x2da153){return this['channel'][_0x8906('0x30')](_0x5959f1,'no\x20variable\x20found');}if(_[_0x8906('0xa0')](_0x1bab22)){var _0x29f8d4=this;_0x1bab22[_0x8906('0x164')](function(_0x1dc7ac,_0x2894fb){_0x29f8d4[_0x8906('0x10')][_0x8906('0xa4')](util[_0x8906('0x2c')](_0x8906('0x165'),_0x2da153,_0x2894fb),_0x1dc7ac);});return this[_0x8906('0x10')][_0x8906('0xad')](util['format'](_0x8906('0x166'),_0x2da153));}else{return this[_0x8906('0x10')][_0x8906('0xa4')](_0x2da153,_0x1bab22);}};AGIVertices[_0x8906('0x19')][_0x8906('0x167')]=function(_0x5367f6){logger['info'](util[_0x8906('0x2c')](_0x8906('0x168'),_0x5367f6[_0x8906('0x3a')]));if(_0x5367f6[_0x8906('0xaa')]===0x0){return this[_0x8906('0xa9')](_0x5367f6);}_0x5367f6[_0x8906('0xaa')]-=0x1;if(!this['isConfigured'](_0x5367f6[_0x8906('0x169')])){return this[_0x8906('0x10')][_0x8906('0x30')](_0x5367f6,_0x8906('0x113'));}var _0x1aa177=this['getSound'][_0x8906('0x75')](this,_0x5367f6[_0x8906('0x169')]);if(!_0x1aa177){return this[_0x8906('0x10')][_0x8906('0x30')](_0x5367f6,'no\x20file\x20audio\x20found');}var _0x48bddb=this[_0x8906('0x10')][_0x8906('0x115')](_0x1aa177,_0x5367f6[_0x8906('0x116')],_0x5367f6['digit']);var _0x3413db=_0x48bddb[_0x8906('0xa8')];if(_0x48bddb[_0x8906('0xa8')]===-0x1){this['createSquareDetailsReport'][_0x8906('0x75')](this,_0x5367f6,'-1');return _0x48bddb;}else if(_0x48bddb['extra']===_0x8906('0x69')){_0x48bddb[_0x8906('0xa8')]=_0x48bddb[_0x8906('0xa8')]['length']>0x0?_0x48bddb[_0x8906('0xa8')]:'t';}else if(_[_0x8906('0x47')](_0x48bddb[_0x8906('0xa8')])){_0x48bddb['result']='#';_0x3413db='#';}if(!this['isConfigured'](_0x5367f6[_0x8906('0xdf')])){this[_0x8906('0x10')][_0x8906('0xad')](_0x8906('0xe0'));}else{var _0x540120=this['getVariable']['sync'](this,_0x5367f6[_0x8906('0xdf')]);if(!_0x540120){return this['channel']['error'](_0x5367f6,_0x8906('0xe1'));}this[_0x8906('0x10')]['setVariable'](_0x540120,_0x3413db);}this['createSquareDetailsReport'][_0x8906('0x75')](this,_0x5367f6,_0x3413db);return _0x48bddb;};AGIVertices[_0x8906('0x19')][_0x8906('0xad')]=function(_0x243810){logger[_0x8906('0x32')](util[_0x8906('0x2c')](_0x8906('0x16a'),_0x243810[_0x8906('0x3a')]));return this['channel'][_0x8906('0xad')](_0x243810[_0x8906('0x16b')]||_0x243810[_0x8906('0x3a')]);};AGIVertices[_0x8906('0x19')][_0x8906('0x16c')]=function(_0x57a5ac){logger['info'](util[_0x8906('0x2c')](_0x8906('0x16d'),_0x57a5ac[_0x8906('0x3a')]));if(!this[_0x8906('0x8b')](_0x57a5ac[_0x8906('0x157')])){return this[_0x8906('0x10')][_0x8906('0x30')](_0x57a5ac,_0x8906('0x158'));}logger[_0x8906('0x32')](util[_0x8906('0x2c')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x8906('0x10')]['callerid'],_0x57a5ac['findBy']));var _0x2d8541=this['getPause'][_0x8906('0x75')](this,_0x57a5ac['pause_id']);var _0x40d146=this['agentPause'][_0x8906('0x75')](this,_0x57a5ac['findBy'],_0x2d8541);if(_0x40d146){logger[_0x8906('0x32')](util[_0x8906('0x2c')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x8906('0x10')][_0x8906('0x3d')],_0x57a5ac[_0x8906('0x157')]));this[_0x8906('0x10')][_0x8906('0xad')](util[_0x8906('0x2c')](_0x8906('0x15b'),this[_0x8906('0x10')][_0x8906('0x3d')],_0x57a5ac['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0x8906('0x32')](util[_0x8906('0x2c')](_0x8906('0x15d'),this[_0x8906('0x10')][_0x8906('0x3d')],_0x57a5ac[_0x8906('0x157')]));this[_0x8906('0x10')][_0x8906('0xad')](util[_0x8906('0x2c')](_0x8906('0x15b'),this[_0x8906('0x10')][_0x8906('0x3d')],_0x57a5ac['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x8906('0x19')][_0x8906('0x16e')]=function(_0x149188){logger[_0x8906('0x32')](util['format'](_0x8906('0x16f'),_0x149188[_0x8906('0x3a')]));if(!this[_0x8906('0x8b')](_0x149188[_0x8906('0x169')])){return this[_0x8906('0x10')][_0x8906('0x30')](_0x149188,_0x8906('0x113'));}var _0x8604a=this[_0x8906('0x114')][_0x8906('0x75')](this,_0x149188[_0x8906('0x169')]);if(!_0x8604a){return this[_0x8906('0x10')]['error'](_0x149188,_0x8906('0x170'));}var _0x123053=this[_0x8906('0x10')]['exec'](_0x8906('0x171'),[_0x8604a,_0x149188[_0x8906('0x110')]]);if(_0x123053[_0x8906('0xa8')]===-0x1){return _0x123053;}return this['channel'][_0x8906('0xad')](util['format']('Executed\x20command\x20%s\x20%s',_0x8906('0x171'),_0x8604a));};AGIVertices[_0x8906('0x19')]['queue']=function(_0x5bc4ae){logger[_0x8906('0x32')](util['format']('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x5bc4ae[_0x8906('0x3a')]));if(!this[_0x8906('0x8b')](_0x5bc4ae[_0x8906('0x172')])){return this[_0x8906('0x10')][_0x8906('0x30')](_0x5bc4ae,_0x8906('0x173'));}var _0x3048bf='';var _0x32ce74=parseInt(_0x5bc4ae[_0x8906('0x172')],0xa);if(isNaN(_0x32ce74)){_0x3048bf=_0x5bc4ae[_0x8906('0x172')];}else{_0x3048bf=this[_0x8906('0x17')][_0x8906('0x75')](this,_0x5bc4ae[_0x8906('0x172')]);if(!_0x3048bf){return this['channel'][_0x8906('0x30')](_0x5bc4ae,'no\x20queue\x20found');}}var _0x401a2e='';if(this[_0x8906('0x8b')](_0x5bc4ae[_0x8906('0x169')])){var _0x5a260b=this[_0x8906('0x114')]['sync'](this,_0x5bc4ae[_0x8906('0x169')]);if(_0x5a260b){_0x401a2e=_0x5a260b;}}this['createSquareDetailsReport'][_0x8906('0x75')](this,_0x5bc4ae,_0x3048bf);if(_0x5bc4ae[_0x8906('0x110')][_0x8906('0x174')]('x')<0x0){_0x5bc4ae[_0x8906('0x110')]+='x';}if(_0x5bc4ae[_0x8906('0x110')]['indexOf']('X')<0x0){_0x5bc4ae[_0x8906('0x110')]+='X';}this[_0x8906('0x10')][_0x8906('0xa4')](_0x8906('0x175'),_0x3048bf?_0x3048bf[_0x8906('0x176')]():'');var _0x2695e6=this['channel'][_0x8906('0x59')](_0x8906('0x177'),[_0x3048bf,_0x5bc4ae['opts'],_0x5bc4ae[_0x8906('0x67')],_0x401a2e,_0x5bc4ae[_0x8906('0x69')],_0x5bc4ae[_0x8906('0x9')],_0x5bc4ae[_0x8906('0x178')],_0x5bc4ae[_0x8906('0x179')],'',_0x5bc4ae[_0x8906('0x17a')]]);if(_0x2695e6[_0x8906('0xa8')]===-0x1){return _0x2695e6;}return this[_0x8906('0x10')][_0x8906('0xad')](util[_0x8906('0x2c')]('Executed\x20command\x20%s\x20%s','QUEUE',_0x3048bf));};AGIVertices[_0x8906('0x19')]['record']=function(_0x4b0c8a){logger[_0x8906('0x32')](util[_0x8906('0x2c')](_0x8906('0x17b'),_0x4b0c8a[_0x8906('0x3a')]));var _0x3af4c7=_0x4b0c8a[_0x8906('0x17c')]||_0x8906('0x130');var _0x1066ee=util[_0x8906('0x2c')]('%s_%s',this[_0x8906('0x10')][_0x8906('0x39')],rs[_0x8906('0x11a')](0x5));var _0x531a7e=util[_0x8906('0x2c')](_0x8906('0x17d'),FILES_PATH,_0x1066ee,_0x3af4c7);var _0x394439=util[_0x8906('0x2c')](_0x8906('0x131'),FILES_PATH,_0x1066ee);this[_0x8906('0x3e')]['sync'](this,_0x4b0c8a,_0x1066ee,_0x531a7e);this[_0x8906('0x10')][_0x8906('0xa4')](_0x8906('0x17e'),_0x1066ee);logger[_0x8906('0x32')](_0x8906('0x17f'),_0x394439,_0x3af4c7,_0x4b0c8a[_0x8906('0x180')],_0x4b0c8a[_0x8906('0x69')]);return this['channel'][_0x8906('0x134')](_0x394439,_0x3af4c7,_0x4b0c8a[_0x8906('0x180')],_0x4b0c8a[_0x8906('0x69')],undefined,!![]);};AGIVertices['prototype'][_0x8906('0x181')]=function(_0x5a7f22){logger['info'](util['format']('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x5a7f22[_0x8906('0x3a')]));if(!this[_0x8906('0x8b')](_0x5a7f22[_0x8906('0x67')])){return this[_0x8906('0x10')][_0x8906('0xad')](_0x8906('0x182'));}var _0x13502a=this[_0x8906('0x66')][_0x8906('0x75')](this,_0x5a7f22);logger[_0x8906('0x32')](util[_0x8906('0x2c')]('Response:',util['inspect'](_0x13502a,{'showHidden':![],'depth':null})));if(!this[_0x8906('0x8b')](_0x5a7f22[_0x8906('0xdf')])){return this[_0x8906('0x10')][_0x8906('0xad')](_0x8906('0x183'));}var _0x20871a=this[_0x8906('0x13')]['sync'](this,_0x5a7f22['variable_id']);if(!_0x20871a){return this['channel'][_0x8906('0x30')](_0x5a7f22,_0x8906('0xe1'));}this[_0x8906('0x10')][_0x8906('0xa4')](util['format']('%s_STATUS_CODE',_0x20871a),_0x13502a[_0x8906('0x7a')]?_0x13502a[_0x8906('0x7a')]:_0x8906('0x184'));this['channel']['setVariable'](util[_0x8906('0x2c')]('%s_STATUS_MESSAGE',_0x20871a),_0x13502a[_0x8906('0x7b')]?_0x13502a[_0x8906('0x7b')]:'OK');if(_0x13502a[_0x8906('0x6f')]){try{this[_0x8906('0xa2')](_0x13502a[_0x8906('0x6f')],_0x20871a);}catch(_0x505607){logger['error'](util[_0x8906('0x2c')](_0x8906('0x185'),_0x20871a));}}return this[_0x8906('0x10')]['noop'](util[_0x8906('0x2c')](_0x8906('0xe4'),_0x20871a));};AGIVertices[_0x8906('0x19')][_0x8906('0x186')]=function(_0x59779d){logger['info'](util[_0x8906('0x2c')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x59779d['label']));return this[_0x8906('0x10')][_0x8906('0x187')](_0x59779d[_0x8906('0x188')][_0x8906('0xde')](/\s+/g,''),_0x59779d['escape_digits']);};AGIVertices[_0x8906('0x19')][_0x8906('0x189')]=function(_0x4d90e3){logger[_0x8906('0x32')](util[_0x8906('0x2c')](_0x8906('0x18a'),_0x4d90e3['label']));return this[_0x8906('0x10')][_0x8906('0x18b')](_0x4d90e3[_0x8906('0x6a')][_0x8906('0xde')](/\s+/g,''),_0x4d90e3[_0x8906('0x180')]);};AGIVertices[_0x8906('0x19')][_0x8906('0x18c')]=function(_0x395d8a){logger[_0x8906('0x32')](util['format'](_0x8906('0x18d'),_0x395d8a[_0x8906('0x3a')]));return this[_0x8906('0x10')][_0x8906('0x18e')](_0x395d8a[_0x8906('0x5e')],_0x395d8a['escape_digits']);};AGIVertices[_0x8906('0x19')][_0x8906('0x18f')]=function(_0x5cc09e){logger['info'](util['format'](_0x8906('0x190'),_0x5cc09e[_0x8906('0x3a')]));if(!this['isConfigured'](_0x5cc09e['account_id'])){return this[_0x8906('0x10')][_0x8906('0xad')](_0x8906('0x191'));}var _0x5cd28a=this['getMailAccount'][_0x8906('0x75')](this,_0x5cc09e[_0x8906('0x192')]);if(!_0x5cd28a||!_0x5cd28a[_0x8906('0x193')]){return this[_0x8906('0x10')][_0x8906('0x30')](_0x5cc09e,_0x8906('0x194'));}var _0x196a08={'from':util['format'](_0x8906('0x195'),_0x5cd28a[_0x8906('0x1e')],_0x5cd28a[_0x8906('0x196')]||_0x5cd28a['Smtp'][_0x8906('0x197')]),'to':_0x5cc09e['to']||'','cc':_0x5cc09e['cc']||'','bcc':_0x5cc09e['bcc']||'','subject':_0x5cc09e[_0x8906('0x198')],'html':_0x5cc09e[_0x8906('0x5e')],'text':_0x5cc09e[_0x8906('0x5e')]};var _0x4fa612={'tls':{'rejectUnauthorized':![]}};if(_0x5cd28a[_0x8906('0x193')][_0x8906('0x199')]){_0x4fa612[_0x8906('0x199')]=_0x5cd28a[_0x8906('0x193')][_0x8906('0x199')];}else{_0x4fa612[_0x8906('0x19a')]=_0x5cd28a[_0x8906('0x193')][_0x8906('0x19a')];_0x4fa612[_0x8906('0x19b')]=_0x5cd28a[_0x8906('0x193')][_0x8906('0x19b')];_0x4fa612['secure']=_0x5cd28a[_0x8906('0x193')][_0x8906('0x19c')];}if(_0x5cd28a[_0x8906('0x193')][_0x8906('0x19d')]){_0x4fa612[_0x8906('0x19e')]={'user':_0x5cd28a['Smtp'][_0x8906('0x197')],'pass':_0x5cd28a[_0x8906('0x193')][_0x8906('0x19f')]};}if(this[_0x8906('0x8b')](_0x5cc09e[_0x8906('0x1a0')])){}logger['debug']('sendMail\x20message',JSON[_0x8906('0x78')](_0x196a08));this[_0x8906('0x38')]['sync'](this,_0x5cc09e,_0x5cc09e[_0x8906('0x192')]);this['channel'][_0x8906('0xad')](util[_0x8906('0x2c')](_0x8906('0x1a1'),_0x5cd28a[_0x8906('0x1e')]));this[_0x8906('0x26')]['sync'](this,_0x4fa612,_0x196a08);return this[_0x8906('0x10')][_0x8906('0xad')](_0x8906('0x1a2'));};AGIVertices[_0x8906('0x19')][_0x8906('0x1a3')]=function(_0xba0588){logger['info'](util[_0x8906('0x2c')](_0x8906('0x1a4'),_0xba0588[_0x8906('0x3a')]));return this[_0x8906('0x10')][_0x8906('0xad')](_0x8906('0x1a5'));};AGIVertices[_0x8906('0x19')][_0x8906('0x1a6')]=function(_0x5c2e2e){logger[_0x8906('0x32')](util[_0x8906('0x2c')](_0x8906('0x1a7'),_0x5c2e2e[_0x8906('0x3a')]));if(!this[_0x8906('0x8b')](_0x5c2e2e['sms_account_id'])){return this[_0x8906('0x10')][_0x8906('0xad')]('no\x20sms\x20account\x20configured');}var _0x464476=this['getSmsAccount'][_0x8906('0x75')](this,_0x5c2e2e[_0x8906('0x1a8')]);if(!_0x464476){return this[_0x8906('0x10')][_0x8906('0x30')](_0x5c2e2e,_0x8906('0x1a9'));}var _0xa14721={'body':_0x5c2e2e[_0x8906('0x1aa')],'phone':_0x5c2e2e['to']||'','SmsAccountId':_0x464476['id']};logger['debug']('sendSMS\x20message',JSON[_0x8906('0x78')](_0xa14721));this[_0x8906('0x38')]['sync'](this,_0x5c2e2e,_0x5c2e2e[_0x8906('0x1a8')]);this[_0x8906('0x10')][_0x8906('0xad')](util[_0x8906('0x2c')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x464476[_0x8906('0x1e')]));this[_0x8906('0x37')][_0x8906('0x75')](this,_0xa14721);return this[_0x8906('0x10')][_0x8906('0xad')](_0x8906('0x1ab'));};AGIVertices[_0x8906('0x19')][_0x8906('0x1ac')]=function(_0x5f3781){logger[_0x8906('0x32')](util[_0x8906('0x2c')](_0x8906('0x1ad'),_0x5f3781[_0x8906('0x3a')]));if(!this[_0x8906('0x8b')](_0x5f3781[_0x8906('0xdf')])){return this[_0x8906('0x10')][_0x8906('0x30')](_0x5f3781,_0x8906('0x1ae'));}var _0x1671de=this['getVariable']['sync'](this,_0x5f3781[_0x8906('0xdf')]);if(!_0x1671de){return this[_0x8906('0x10')][_0x8906('0x30')](_0x5f3781,'no\x20variable\x20found');}return this[_0x8906('0x10')][_0x8906('0xa4')](_0x1671de,_0x5f3781[_0x8906('0x1af')]);};AGIVertices['prototype'][_0x8906('0x1b0')]=function(_0x3b8088){logger['info'](util[_0x8906('0x2c')]('Enter\x20in\x20START\x20(%s)\x20block',_0x3b8088['label']));this['channel']['noop']('START\x20CALLY\x20SQUARE');if(_0x3b8088[_0x8906('0xc1')]===_0x8906('0x1b1')){this[_0x8906('0x10')][_0x8906('0xad')]('Answer');return this[_0x8906('0x10')][_0x8906('0xc1')]();}return this[_0x8906('0x10')]['noop'](_0x8906('0x1b2'));};AGIVertices[_0x8906('0x19')][_0x8906('0x1b3')]=function(_0x406bdf){logger['info'](util[_0x8906('0x2c')](_0x8906('0x1b4'),_0x406bdf[_0x8906('0x3a')]));if(!this[_0x8906('0x8b')](_0x406bdf[_0x8906('0x1b5')])){return this[_0x8906('0x10')][_0x8906('0x30')](_0x406bdf,'no\x20subproject\x20selected');}var _0xcda94=this['getSquareProject'][_0x8906('0x75')](this,_0x406bdf['project_id']);if(!this['isConfigured'](_0xcda94)){return this[_0x8906('0x10')][_0x8906('0x30')](_0x406bdf,util['format']('no\x20subproject\x20found\x20with\x20id\x20%d',_0x406bdf[_0x8906('0x1b5')]));}if(_0xcda94===this[_0x8906('0x10')][_0x8906('0x3c')]){return this[_0x8906('0x10')]['error'](_0x406bdf,_0x8906('0x1b6'));}this[_0x8906('0x38')][_0x8906('0x75')](this,_0x406bdf,_0xcda94);var _0x254ea9=this['channel'][_0x8906('0x59')]('AGI',util[_0x8906('0x2c')](_0x8906('0x1b7'),config[_0x8906('0x9')][_0x8906('0x19a')]||_0x8906('0x1b8'),_0xcda94,this[_0x8906('0x10')][_0x8906('0x3c')]));if(_0x254ea9[_0x8906('0xa8')]===-0x1){return _0x254ea9;}return this['channel']['noop'](util[_0x8906('0x2c')](_0x8906('0x1b9'),_0x8906('0x1ba'),_0xcda94));};AGIVertices['prototype']['system']=function(_0x68f4ef){logger[_0x8906('0x32')](util[_0x8906('0x2c')](_0x8906('0x1bb'),_0x68f4ef['label']));var _0x573309=this['shellCommand'][_0x8906('0x75')](this,_0x68f4ef[_0x8906('0xbd')]);this[_0x8906('0x38')][_0x8906('0x75')](this,_0x68f4ef,_0x68f4ef['command']);if(this['isConfigured'](_0x68f4ef['variable_id'])){var _0xfaac0c=this[_0x8906('0x13')]['sync'](this,_0x68f4ef[_0x8906('0xdf')]);if(_0xfaac0c){this['channel'][_0x8906('0xa4')](_0xfaac0c,_0x573309);return this[_0x8906('0x10')][_0x8906('0xad')](util[_0x8906('0x2c')](_0x8906('0x1bc'),_0x68f4ef[_0x8906('0xbd')],_0xfaac0c));}}return this[_0x8906('0x10')][_0x8906('0xad')](util[_0x8906('0x2c')](_0x8906('0x1bd'),_0x68f4ef['command']));};AGIVertices[_0x8906('0x19')][_0x8906('0x1be')]=function(_0x59e308){logger[_0x8906('0x32')](util['format']('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x59e308[_0x8906('0x3a')]));_0x59e308[_0x8906('0x5e')]=_0x59e308[_0x8906('0x5e')][_0x8906('0xde')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x59e308[_0x8906('0x5c')])){return this[_0x8906('0x10')][_0x8906('0xad')]('no\x20apiKey\x20configured');}if(!this[_0x8906('0x8b')](_0x59e308[_0x8906('0x5e')])){return this['channel'][_0x8906('0xad')](_0x8906('0xae'));}this[_0x8906('0x10')][_0x8906('0xad')](util[_0x8906('0x2c')](_0x8906('0x1bf'),_0x59e308[_0x8906('0x5e')]));var _0x222af8=this[_0x8906('0x5b')][_0x8906('0x75')](this,_0x59e308);if(_0x222af8){this[_0x8906('0x10')][_0x8906('0xad')](util[_0x8906('0x2c')](_0x8906('0x1c0'),_0x222af8));var _0x30969b=this[_0x8906('0x10')]['streamFile'](_0x222af8);try{fs[_0x8906('0x107')](_0x222af8+'.wav');}catch(_0x2a848e){logger[_0x8906('0x30')](_0x2a848e);}return _0x30969b;}return this['channel'][_0x8906('0x30')](_0x59e308,_0x8906('0x1c1'));};AGIVertices['prototype'][_0x8906('0x1c2')]=function(_0x37f84b){logger[_0x8906('0x32')](util[_0x8906('0x2c')](_0x8906('0x1c3'),_0x37f84b[_0x8906('0x3a')]));_0x37f84b[_0x8906('0x5e')]=_0x37f84b[_0x8906('0x5e')][_0x8906('0xde')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x37f84b['text'])){return this[_0x8906('0x10')][_0x8906('0xad')](_0x8906('0xae'));}this[_0x8906('0x10')][_0x8906('0xad')](util[_0x8906('0x2c')](_0x8906('0x1c4'),_0x37f84b[_0x8906('0x5e')]));var _0x81bb8=this[_0x8906('0x64')]['sync'](this,_0x37f84b);if(_0x81bb8){this[_0x8906('0x10')][_0x8906('0xad')](util[_0x8906('0x2c')](_0x8906('0x1c5'),_0x81bb8));var _0x56687e=this[_0x8906('0x10')]['streamFile'](_0x81bb8);try{fs['unlink'](_0x81bb8+_0x8906('0x124'));}catch(_0x3b4592){logger[_0x8906('0x30')](_0x3b4592);}return _0x56687e;}return this[_0x8906('0x10')][_0x8906('0x30')](_0x37f84b,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x8906('0x19')]['unpause']=function(_0x2d1196){logger[_0x8906('0x32')](util['format']('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x2d1196[_0x8906('0x3a')]));if(!this['isConfigured'](_0x2d1196[_0x8906('0x157')])){return this[_0x8906('0x10')][_0x8906('0x30')](_0x2d1196,_0x8906('0x158'));}logger[_0x8906('0x32')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel']['callerid'],_0x2d1196[_0x8906('0x157')]));var _0x3956f6=this[_0x8906('0x55')][_0x8906('0x75')](this,_0x2d1196[_0x8906('0x157')]);if(_0x3956f6){logger[_0x8906('0x32')](util[_0x8906('0x2c')](_0x8906('0x15b'),this[_0x8906('0x10')][_0x8906('0x3d')],_0x2d1196[_0x8906('0x157')]));this[_0x8906('0x10')][_0x8906('0xad')](util['format'](_0x8906('0x15b'),this[_0x8906('0x10')]['callerid'],_0x2d1196[_0x8906('0x157')]));return{'code':0xc8,'result':_0x8906('0x15c')};}else{logger[_0x8906('0x32')](util[_0x8906('0x2c')](_0x8906('0x15d'),this['channel']['callerid'],_0x2d1196[_0x8906('0x157')]));this[_0x8906('0x10')][_0x8906('0xad')](util[_0x8906('0x2c')](_0x8906('0x15d'),this[_0x8906('0x10')]['callerid'],_0x2d1196['findBy']));return{'code':0xc8,'result':_0x8906('0x15e')};}};AGIVertices[_0x8906('0x19')][_0x8906('0x1c6')]=function(_0x2af95c){logger['info'](util[_0x8906('0x2c')](_0x8906('0x1c7'),_0x2af95c[_0x8906('0x3a')]));var _0x3fc939=this[_0x8906('0x10')][_0x8906('0x59')](_0x8906('0x1c8'),[_0x2af95c[_0x8906('0x1c9')],_0x2af95c[_0x8906('0x7d')]]);if(_0x3fc939[_0x8906('0xa8')]===-0x1){return _0x3fc939;}return this[_0x8906('0x10')][_0x8906('0xad')](util[_0x8906('0x2c')]('Executed\x20command\x20%s\x20%s',_0x8906('0x1c8'),_0x2af95c[_0x8906('0x1c9')]));};AGIVertices[_0x8906('0x19')][_0x8906('0x1ca')]=function(_0x4b4f99){logger[_0x8906('0x32')](util[_0x8906('0x2c')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x4b4f99['label']));if(!this[_0x8906('0x8b')](_0x4b4f99['variable_id'])){return this[_0x8906('0x10')]['error'](_0x4b4f99,'no\x20variable\x20selected');}var _0x22f1f9=this[_0x8906('0x13')]['sync'](this,_0x4b4f99['variable_id']);if(!_0x22f1f9){return this[_0x8906('0x10')][_0x8906('0x30')](_0x4b4f99,'no\x20variable\x20found');}var _0x9dc120=this['channel'][_0x8906('0x13')](_0x22f1f9);return{'code':0xc8,'result':_0x9dc120[_0x8906('0xa6')]?_0x9dc120[_0x8906('0xa6')]:'-'};};String[_0x8906('0x19')][_0x8906('0x1cb')]=function(_0x5accf8,_0x2c5306){return this[_0x8906('0xa5')](_0x5accf8)['join'](_0x2c5306);};module['exports']=AGIVertices; \ No newline at end of file +var _0xafd0=['first','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','GOAL\x20%s','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','%s/recordings/%s','beep','tilde\x20%s\x20file\x20created','tildeASR','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','extension','priority','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','true','EVAL\x20CONDITION\x20%s\x20%s','false','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeechASR','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20%s\x20file\x20created','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','operation','no\x20operation\x20configured','math\x20%s','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','file_id','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','getVoiceQueue','indexOf','XMCS-QUEUE','QUEUE','agi','macro','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','restAPI','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','200','%s_STATUS_MESSAGE','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','no\x20mail\x20account\x20configured','account_id','Smtp','email','user','subject','service','host','port','secure','authentication','auth','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','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','variable_value','start','answer','yes','Answer','Skipped\x20Answer','project_id','getSquareProject','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','no\x20variable\x20selected','split','exports','path','util','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','then','name','catch','getVoiceQueueById','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getTrunk','getSound','getSoundById','getSoundPath','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','context','dnid','file','createSquareMessage','createCmContact','isEmpty','callback_','random','lastName','phone','scheduledAt','Callback\x20scheduled\x20at\x20','getPause','agentPause','agent','isNil','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','url','timeout','number','POST','PUT','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','computedVariables','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','awsLex','aws_bot_name','googleASR','appid','appsecret','uri','clear','includes','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','replaceAll','extra','toString','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','retry','maxRetry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','result','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','no\x20grammar\x20configured','grammar','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','list_id','delay','add','minutes','callback_priority','sync','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','lumenvoxasr','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','replace','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','toUpperCase','speech','out','dialogflow','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','private_key','no\x20anguage\x20configured','providerResponse','DIALOGFLOW_%s','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','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\x20selected','no\x20trunk\x20found','trunk_name','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos'];(function(_0x4d61a6,_0x3d0c0b){var _0x3e271b=function(_0x3ad4a9){while(--_0x3ad4a9){_0x4d61a6['push'](_0x4d61a6['shift']());}};_0x3e271b(++_0x3d0c0b);}(_0xafd0,0xb3));var _0x0afd=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xafd0[_0x422905];return _0x33dc6c;};'use strict';var fs=require('fs');var path=require(_0x0afd('0x0'));var util=require(_0x0afd('0x1'));var _=require(_0x0afd('0x2'));var sh=require(_0x0afd('0x3'));var odbc=require(_0x0afd('0x4'))();var rs=require(_0x0afd('0x5'));var moment=require(_0x0afd('0x6'));var Mustache=require(_0x0afd('0x7'));var rp=require(_0x0afd('0x8'));var logger=require(_0x0afd('0x9'))('agi');var config=require('../../config/environment');var scripts=require(_0x0afd('0xa'));var FILES_PATH=_0x0afd('0xb');var recursiveMapAttributes=[_0x0afd('0xc'),_0x0afd('0xd')];var verticesWithRetry=[_0x0afd('0xe'),_0x0afd('0xf'),_0x0afd('0x10')];var AGIVertices=function(_0x58ae1d,_0x31a1ca,_0x59d231){this[_0x0afd('0x11')]=_0x58ae1d;this[_0x0afd('0x12')]=_0x31a1ca;this[_0x0afd('0x13')]=_0x59d231;};AGIVertices[_0x0afd('0x14')][_0x0afd('0x15')]=function(_0x4dfa90,_0x37fb3b){this[_0x0afd('0x12')]['getVariableById'](_0x4dfa90)[_0x0afd('0x16')](function(_0x306800){_0x37fb3b(null,_0x306800?_0x306800[_0x0afd('0x17')]:![]);})[_0x0afd('0x18')](function(_0x3d5a7d){_0x37fb3b(_0x3d5a7d);});};AGIVertices[_0x0afd('0x14')]['getVoiceQueue']=function(_0x1fae24,_0x3e497e){this[_0x0afd('0x12')][_0x0afd('0x19')](_0x1fae24)['then'](function(_0x542f66){_0x3e497e(null,_0x542f66?_0x542f66['name']:![]);})['catch'](function(_0x5f078f){_0x3e497e(_0x5f078f);});};AGIVertices[_0x0afd('0x14')]['getSquareProject']=function(_0x567d54,_0x29c936){this[_0x0afd('0x12')][_0x0afd('0x1a')](_0x567d54)[_0x0afd('0x16')](function(_0x384226){_0x29c936(null,_0x384226?_0x384226[_0x0afd('0x17')]:![]);})[_0x0afd('0x18')](function(_0x2935c9){_0x29c936(_0x2935c9);});};AGIVertices[_0x0afd('0x14')][_0x0afd('0x1b')]=function(_0x589b34,_0x534533){this[_0x0afd('0x12')][_0x0afd('0x1c')](_0x589b34)[_0x0afd('0x16')](function(_0x169066){_0x534533(null,_0x169066?_0x169066['dsn']:![]);})[_0x0afd('0x18')](function(_0x1c2e45){_0x534533(_0x1c2e45);});};AGIVertices[_0x0afd('0x14')][_0x0afd('0x1d')]=function(_0x528092,_0x45d221){this[_0x0afd('0x12')][_0x0afd('0x1e')](_0x528092)[_0x0afd('0x16')](function(_0x6070f2){_0x45d221(null,_0x6070f2?_0x6070f2[_0x0afd('0x17')]:![]);})[_0x0afd('0x18')](function(_0x4a8b6d){_0x45d221(_0x4a8b6d);});};AGIVertices['prototype'][_0x0afd('0x1f')]=function(_0x46d040,_0x38a8d2){this[_0x0afd('0x12')]['getTrunkById'](_0x46d040)[_0x0afd('0x16')](function(_0x351d0a){_0x38a8d2(null,_0x351d0a?_0x351d0a['name']:![]);})[_0x0afd('0x18')](function(_0x1cfc10){_0x38a8d2(_0x1cfc10);});};AGIVertices['prototype'][_0x0afd('0x20')]=function(_0x4f2ef9,_0xe94b6b){var _0x563b7a=this;this[_0x0afd('0x12')][_0x0afd('0x21')](_0x4f2ef9)['then'](function(_0x16bd5e){_0xe94b6b(null,_0x16bd5e?_0x563b7a[_0x0afd('0x22')](_0x16bd5e['save_name']):![]);})[_0x0afd('0x18')](function(_0xb0d400){_0xe94b6b(_0xb0d400);});};AGIVertices[_0x0afd('0x14')][_0x0afd('0x23')]=function(_0xd80be6,_0x477a3b){this['rpc'][_0x0afd('0x24')](_0xd80be6)['then'](function(_0x3c1a07){_0x477a3b(null,_0x3c1a07?_0x3c1a07:![]);})[_0x0afd('0x18')](function(_0x5e8b7d){_0x477a3b(_0x5e8b7d);});};AGIVertices['prototype'][_0x0afd('0x25')]=function(_0x1e7399,_0x22aebb,_0x4faa3d){this['mailRpc'][_0x0afd('0x25')](_0x1e7399,_0x22aebb)[_0x0afd('0x16')](function(){_0x4faa3d(null);})[_0x0afd('0x18')](function(_0x59e446){_0x4faa3d(_0x59e446);});};AGIVertices[_0x0afd('0x14')][_0x0afd('0x26')]=function(_0x10edb3,_0x158659){this[_0x0afd('0x12')][_0x0afd('0x27')](_0x10edb3)['then'](function(_0x22e875){if(_0x22e875){if(_0x22e875['IntervalId']){_0x158659(null,[_0x22e875[_0x0afd('0x28')]]);}else{_0x158659(null,_[_0x0afd('0x29')](_0x22e875[_0x0afd('0x2a')],_0x0afd('0x28')));}}else{_0x158659(null,![]);}})['catch'](function(_0x2bd3a4){_0x158659(_0x2bd3a4);});};AGIVertices[_0x0afd('0x14')][_0x0afd('0x22')]=function(_0x3b8393){return util[_0x0afd('0x2b')](_0x0afd('0x2c'),FILES_PATH,_0x3b8393);};AGIVertices[_0x0afd('0x14')][_0x0afd('0x2d')]=function(_0x21d5b8,_0x553f7a,_0xd74d80){odbc['open'](_0x21d5b8,function(_0x29ab97){if(_0x29ab97){logger[_0x0afd('0x2e')](_0x0afd('0x2f'),_0x29ab97);_0xd74d80(_0x29ab97);}else{logger[_0x0afd('0x30')](_0x0afd('0x31'));odbc[_0x0afd('0x32')](_0x553f7a,function(_0x3062fc,_0x2cc03e){if(_0x3062fc){logger[_0x0afd('0x30')](_0x0afd('0x33'),_0x553f7a);_0xd74d80(_0x3062fc);}else{logger[_0x0afd('0x30')](_0x0afd('0x34'),_0x553f7a);odbc[_0x0afd('0x35')](function(_0x52fb60){if(_0x52fb60){logger[_0x0afd('0x2e')](_0x0afd('0x36'),_0x52fb60);}_0xd74d80(null,_0x2cc03e);});}});}});};AGIVertices[_0x0afd('0x14')][_0x0afd('0x37')]=function(_0x2a4c1d,_0x537a9c){this[_0x0afd('0x12')][_0x0afd('0x38')](_0x2a4c1d)[_0x0afd('0x16')](function(_0x25db5c){_0x537a9c(null,_0x25db5c?_0x25db5c:![]);})[_0x0afd('0x18')](function(_0x3a0aea){_0x537a9c(_0x3a0aea);});};AGIVertices['prototype'][_0x0afd('0x39')]=function(_0x34544d,_0x2a8377){this[_0x0afd('0x12')][_0x0afd('0x39')](_0x34544d)[_0x0afd('0x16')](function(_0x17d080){_0x2a8377(null,_0x17d080);})[_0x0afd('0x18')](function(_0x572155){_0x2a8377(_0x572155);});};AGIVertices[_0x0afd('0x14')][_0x0afd('0x3a')]=function(_0x305eb0,_0x25da66,_0x1b2bbe){this[_0x0afd('0x12')][_0x0afd('0x3a')]({'uniqueid':this[_0x0afd('0x11')][_0x0afd('0x3b')],'node':_0x305eb0[_0x0afd('0x3c')],'application':_0x305eb0[_0x0afd('0x3d')],'data':_0x25da66||null,'project_name':this[_0x0afd('0x11')][_0x0afd('0x3e')],'callerid':this['channel'][_0x0afd('0x3f')]})['then'](function(_0x2b9567){if(_0x1b2bbe){_0x1b2bbe(null,_0x2b9567);}})['catch'](function(_0x35a5a7){if(_0x1b2bbe){_0x1b2bbe(_0x35a5a7);}});};AGIVertices[_0x0afd('0x14')][_0x0afd('0x40')]=function(_0x598bcf,_0x3d8974,_0x41d47a,_0x1be14a){this[_0x0afd('0x12')][_0x0afd('0x40')]({'uniqueid':this[_0x0afd('0x11')][_0x0afd('0x3b')],'callerid':this[_0x0afd('0x11')][_0x0afd('0x3f')],'calleridname':this[_0x0afd('0x11')]['calleridname'],'context':this[_0x0afd('0x11')][_0x0afd('0x41')],'extension':this[_0x0afd('0x11')]['extension'],'priority':this[_0x0afd('0x11')]['priority'],'accountcode':this[_0x0afd('0x11')]['accountcode'],'dnid':this[_0x0afd('0x11')][_0x0afd('0x42')],'projectName':this[_0x0afd('0x11')][_0x0afd('0x3e')],'saveName':_0x3d8974,'filename':_0x598bcf[_0x0afd('0x43')]||_0x3d8974,'savePath':_0x41d47a})[_0x0afd('0x16')](function(_0x1e9d0e){_0x1be14a(null,_0x1e9d0e);})['catch'](function(_0x3aebfa){_0x1be14a(_0x3aebfa);});};AGIVertices[_0x0afd('0x14')][_0x0afd('0x44')]=function(_0x30e451,_0x577198,_0x224cd2,_0x298edf,_0x59876c){this[_0x0afd('0x12')][_0x0afd('0x44')]({'uniqueid':this[_0x0afd('0x11')][_0x0afd('0x3b')],'body':_0x30e451,'direction':_0x577198,'providerName':_0x224cd2,'providerResponse':_0x298edf})[_0x0afd('0x16')](function(_0x2595ff){if(_0x59876c){_0x59876c(null,_0x2595ff);}})[_0x0afd('0x18')](function(_0x2bd5a8){if(_0x59876c){_0x59876c(_0x2bd5a8);}});};AGIVertices['prototype'][_0x0afd('0x45')]=function(_0x41d51b,_0x56c02b){this['rpc'][_0x0afd('0x45')]({'firstName':_[_0x0afd('0x46')](_0x41d51b[_0x0afd('0x17')])||_['isNil'](_0x41d51b[_0x0afd('0x17')])?_0x0afd('0x47')+Math[_0x0afd('0x48')]():_0x41d51b[_0x0afd('0x17')],'lastName':_[_0x0afd('0x46')](_0x41d51b[_0x0afd('0x49')])||_['isNil'](_0x41d51b[_0x0afd('0x49')])?null:_0x41d51b['lastName'],'phone':_0x41d51b[_0x0afd('0x4a')],'ListId':_0x41d51b['list_id'],'scheduledat':_0x41d51b[_0x0afd('0x4b')],'callbackUniqueid':this[_0x0afd('0x11')][_0x0afd('0x3b')],'tags':'callback','description':_0x0afd('0x4c')+_0x41d51b['scheduledAt']['toString'](),'priority':_0x41d51b['callback_priority']})['then'](function(_0x9476be){_0x56c02b(null,_0x9476be);})['catch'](function(_0x1a5711){_0x56c02b(_0x1a5711);});};AGIVertices[_0x0afd('0x14')][_0x0afd('0x4d')]=function(_0x494815,_0x959e46){this[_0x0afd('0x12')]['getPauseById'](_0x494815)[_0x0afd('0x16')](function(_0x75ad26){_0x959e46(null,_0x75ad26?_0x75ad26[_0x0afd('0x17')]:![]);})[_0x0afd('0x18')](function(_0x117c95){_0x959e46(_0x117c95);});};AGIVertices[_0x0afd('0x14')][_0x0afd('0x4e')]=function(_0x91192f,_0x1ca2c6,_0x29f82e){var _0x3e2fc8={'role':_0x0afd('0x4f')};_0x3e2fc8[_0x91192f]=this['channel'][_0x0afd('0x3f')];this[_0x0afd('0x12')]['agentPause'](_0x3e2fc8,_0x1ca2c6,this['channel'][_0x0afd('0x3b')])['then'](function(_0x412eaf){_0x29f82e(null,_[_0x0afd('0x50')](_0x412eaf)?![]:!![]);})[_0x0afd('0x18')](function(_0x2fb48c){logger[_0x0afd('0x2e')](_0x2fb48c);_0x29f82e(null,![]);});};AGIVertices[_0x0afd('0x14')][_0x0afd('0x51')]=function(_0x1da19a,_0x16e01c){var _0x226009={'role':_0x0afd('0x4f')};_0x226009[_0x1da19a]=this[_0x0afd('0x11')]['callerid'];this[_0x0afd('0x12')]['agentUnpause'](_0x226009)[_0x0afd('0x16')](function(_0x37b1f4){_0x16e01c(null,_[_0x0afd('0x50')](_0x37b1f4)?![]:!![]);})[_0x0afd('0x18')](function(_0x136e9d){logger[_0x0afd('0x2e')](_0x136e9d);_0x16e01c(null,![]);});};AGIVertices['prototype'][_0x0afd('0x52')]=function(_0x56a446,_0x3c2119){var _0x1a218e={'role':_0x0afd('0x4f')};_0x1a218e[_0x56a446]=this['channel'][_0x0afd('0x3f')];this[_0x0afd('0x12')]['agentLogout'](_0x1a218e)[_0x0afd('0x16')](function(_0x554d9f){_0x3c2119(null,_[_0x0afd('0x50')](_0x554d9f)?![]:!![]);})['catch'](function(_0x28c29f){logger['error'](_0x28c29f);_0x3c2119(null,![]);});};AGIVertices['prototype'][_0x0afd('0x53')]=function(_0x49fd26,_0x435633){var _0x3063d1={'role':_0x0afd('0x4f')};_0x3063d1[_0x49fd26]=this['channel'][_0x0afd('0x3f')];var _0x49f533=_0x49fd26!=_0x0afd('0x54')?util['format'](_0x0afd('0x55'),_0x0afd('0x56'),this[_0x0afd('0x11')]['callerid']):undefined;this[_0x0afd('0x12')][_0x0afd('0x53')](_0x3063d1,_0x49f533)[_0x0afd('0x16')](function(_0x4cbd94){_0x435633(null,_[_0x0afd('0x50')](_0x4cbd94)?![]:!![]);})[_0x0afd('0x18')](function(_0x308ced){logger[_0x0afd('0x2e')](_0x308ced);_0x435633(null,![]);});};AGIVertices['prototype'][_0x0afd('0x57')]=function(_0x3db67d,_0x2eeb18){sh[_0x0afd('0x58')](_[_0x0afd('0x59')](_0x3db67d),function(_0x16a76f,_0x40c13f){var _0x1ee59e=_0x40c13f['replace'](/(\r\n|\n|\r)/gm,'');_0x2eeb18(null,_0x1ee59e);});};AGIVertices[_0x0afd('0x14')]['googleCloudTTS']=function(_0x49fe1b,_0x3a5eb5){scripts[_0x0afd('0x5a')](_0x49fe1b[_0x0afd('0x5b')],_0x49fe1b[_0x0afd('0x5c')]||_0x0afd('0x5d'),_0x49fe1b[_0x0afd('0x5d')],_0x49fe1b['languageCode']||'en-US',_0x49fe1b[_0x0afd('0x5e')]||_0x0afd('0x5f'),_0x49fe1b[_0x0afd('0x60')]||_0x0afd('0x61'))['then'](function(_0x103f6b){_0x3a5eb5(null,_0x103f6b);})['catch'](function(_0x274f14){_0x3a5eb5(_0x274f14);});};AGIVertices[_0x0afd('0x14')][_0x0afd('0x62')]=function(_0x37b282,_0x5b4218){scripts[_0x0afd('0x62')](_0x37b282['text'],_0x37b282[_0x0afd('0x63')]||'en',0x1)[_0x0afd('0x16')](function(_0x2ad965){_0x5b4218(null,_0x2ad965);})[_0x0afd('0x18')](function(_0x53ef3a){_0x5b4218(_0x53ef3a);});};AGIVertices[_0x0afd('0x14')]['restAPI']=function(_0x3f8b87,_0x10c160){var _0x1433b7={'uri':_0x3f8b87[_0x0afd('0x64')],'method':_0x3f8b87['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x3f8b87[_0x0afd('0x65')])===_0x0afd('0x66')&&parseInt(_0x3f8b87[_0x0afd('0x65')])>=0x1?parseInt(_0x3f8b87[_0x0afd('0x65')])*0x3e8:0x5*0x3e8};if(_['includes']([_0x0afd('0x67'),_0x0afd('0x68')],_0x1433b7['method']['toUpperCase']())){try{_0x1433b7[_0x0afd('0x69')]=_0x3f8b87[_0x0afd('0xd')]?JSON[_0x0afd('0x6a')](_0x3f8b87['rawBody']):{};}catch(_0x10d395){logger['error'](_0x0afd('0x6b'),_0x10d395);}}try{_0x1433b7[_0x0afd('0x6c')]=_0x3f8b87[_0x0afd('0xc')]?JSON[_0x0afd('0x6a')](_0x3f8b87[_0x0afd('0xc')]):{};}catch(_0x147959){logger[_0x0afd('0x2e')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x147959);}if(_0x3f8b87[_0x0afd('0x6d')]){try{var _0x433b5a=require(_0x3f8b87[_0x0afd('0x6d')])['sync'](this,_0x1433b7);_0x1433b7['uri']=Mustache[_0x0afd('0x6e')](_0x3f8b87[_0x0afd('0x64')],_0x433b5a,{},['$$','$$']);if(_0x1433b7['headers']){_0x1433b7[_0x0afd('0x6c')]=JSON['parse'](Mustache[_0x0afd('0x6e')](JSON[_0x0afd('0x6f')](_0x1433b7[_0x0afd('0x6c')]),_0x433b5a,{},['$$','$$']));}if(_0x1433b7[_0x0afd('0x69')]){_0x1433b7[_0x0afd('0x69')]=JSON['parse'](Mustache['render'](JSON['stringify'](_0x1433b7[_0x0afd('0x69')]),_0x433b5a,{},['$$','$$']));}}catch(_0x2158ce){logger[_0x0afd('0x2e')](_0x0afd('0x70'),_0x2158ce);}}rp(_0x1433b7)[_0x0afd('0x16')](function(_0x28498a){var _0x328f16={'statusCode':_0x28498a[_0x0afd('0x71')]||0xc8,'statusMessage':_0x28498a[_0x0afd('0x72')]||'OK','headers':_0x28498a[_0x0afd('0x6c')]||{},'body':_0x28498a[_0x0afd('0x69')]||{}};_0x10c160(null,_0x328f16);})[_0x0afd('0x18')](function(_0x134048){var _0x1c2ab0={'statusCode':_0x134048[_0x0afd('0x71')]||0x1f4,'statusMessage':_0x134048[_0x0afd('0x73')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x134048['options'][_0x0afd('0x6c')]||{},'body':_0x134048[_0x0afd('0x74')][_0x0afd('0x69')]||{}};_0x10c160(null,_0x1c2ab0);});};AGIVertices[_0x0afd('0x14')][_0x0afd('0x75')]=function(_0x362b9e,_0x4eca84){scripts['googleDialogflow'](this[_0x0afd('0x11')][_0x0afd('0x3b')],_0x362b9e[_0x0afd('0x76')],_0x362b9e[_0x0afd('0x5d')],_0x362b9e[_0x0afd('0x77')]||'en')[_0x0afd('0x16')](function(_0x12b39e){_0x4eca84(null,_0x12b39e);})[_0x0afd('0x18')](function(_0x581f3b){_0x4eca84(_0x581f3b);});};AGIVertices[_0x0afd('0x14')][_0x0afd('0x78')]=function(_0x4c3565,_0x4faec9){scripts[_0x0afd('0x78')](this[_0x0afd('0x11')][_0x0afd('0x3b')],_0x4c3565[_0x0afd('0x79')],_0x4c3565[_0x0afd('0x7a')],_0x4c3565['private_key'],_0x4c3565[_0x0afd('0x5d')],_0x4c3565[_0x0afd('0x7b')]||'en')[_0x0afd('0x16')](function(_0x310404){_0x4faec9(null,_0x310404);})[_0x0afd('0x18')](function(_0x41cc68){_0x4faec9(_0x41cc68);});};AGIVertices['prototype'][_0x0afd('0x7c')]=function(_0x2d094a,_0x491311){scripts[_0x0afd('0x7c')](this[_0x0afd('0x11')],_0x2d094a)['then'](function(_0x42987b){_0x491311(null,_0x42987b);})[_0x0afd('0x18')](function(_0x52ff64){_0x491311(_0x52ff64);});};AGIVertices[_0x0afd('0x14')]['ispeechTTS']=function(_0x2ccfe8,_0x18cb87){scripts[_0x0afd('0x7d')](_0x2ccfe8[_0x0afd('0x76')],_0x2ccfe8['text'],_0x2ccfe8[_0x0afd('0x7e')]||_0x0afd('0x7f'),_0x2ccfe8['speed'])[_0x0afd('0x16')](function(_0x58c869){_0x18cb87(null,_0x58c869);})[_0x0afd('0x18')](function(_0x269967){_0x18cb87(_0x269967);});};AGIVertices[_0x0afd('0x14')]['ispeechASR']=function(_0x1757ae,_0x5cbb29,_0x141762){scripts['ispeechASR'](_0x5cbb29,_0x1757ae[_0x0afd('0x76')],_0x1757ae['ispeech_asr_language']||_0x0afd('0x7f'),this[_0x0afd('0x80')](_0x1757ae[_0x0afd('0x81')])?_0x1757ae[_0x0afd('0x81')]:undefined)[_0x0afd('0x16')](function(_0x6f3f89){_0x141762(null,_0x6f3f89);})[_0x0afd('0x18')](function(_0x196740){_0x141762(_0x196740);});};AGIVertices['prototype'][_0x0afd('0x82')]=function(_0x4d0ad6,_0x3c5f06){scripts[_0x0afd('0x82')](_0x4d0ad6[_0x0afd('0x83')],_0x4d0ad6[_0x0afd('0x84')],_0x4d0ad6[_0x0afd('0x85')],_0x4d0ad6['aws_polly_voice']||'Amy',_0x4d0ad6[_0x0afd('0x5d')],_0x4d0ad6['aws_text_type']||_0x0afd('0x5d'))[_0x0afd('0x16')](function(_0x52d924){_0x3c5f06(null,_0x52d924);})['catch'](function(_0x88cd30){_0x3c5f06(_0x88cd30);});};AGIVertices['prototype'][_0x0afd('0x86')]=function(_0x4fd17f,_0x59e25d){scripts[_0x0afd('0x86')](this['channel'][_0x0afd('0x3b')],_0x4fd17f[_0x0afd('0x83')],_0x4fd17f['aws_secret_access_key'],_0x4fd17f['aws_lex_region'],_0x4fd17f[_0x0afd('0x5d')],_0x4fd17f[_0x0afd('0x87')])['then'](function(_0x4ab707){_0x59e25d(null,_0x4ab707);})[_0x0afd('0x18')](function(_0xf27a40){_0x59e25d(_0xf27a40);});};AGIVertices[_0x0afd('0x14')]['googleASR']=function(_0x70f02e,_0x4eeb80,_0x32d1d1){scripts[_0x0afd('0x88')](_0x4eeb80,_0x70f02e['key'],_0x70f02e['google_asr_language']||_0x0afd('0x7f'))[_0x0afd('0x16')](function(_0x5304dd){_0x32d1d1(null,_0x5304dd);})[_0x0afd('0x18')](function(_0x1d5804){_0x32d1d1(_0x1d5804);});};AGIVertices[_0x0afd('0x14')]['tildeASR']=function(_0x9e9a62,_0x4ba904,_0x5a6b57){scripts['tildeASR'](_0x4ba904,_0x9e9a62[_0x0afd('0x89')],_0x9e9a62[_0x0afd('0x8a')],_0x9e9a62[_0x0afd('0x8b')])[_0x0afd('0x16')](function(_0x5d9405){_0x5a6b57(null,_0x5d9405);})[_0x0afd('0x18')](function(_0x338f19){_0x5a6b57(_0x338f19);});};AGIVertices[_0x0afd('0x14')][_0x0afd('0x8c')]=function(_0xbfb638){var _0x1ec208=_[_0x0afd('0x8d')](verticesWithRetry,_0xbfb638[_0x0afd('0x3d')])?_0xbfb638:_['clone'](_0xbfb638);for(var _0x1485e8 in _0x1ec208){if(_0x1ec208[_0x0afd('0x8e')](_0x1485e8)){if(_0x1ec208[_0x1485e8]&&_[_0x0afd('0x8f')](_0x1ec208[_0x1485e8])){if(_[_0x0afd('0x8d')](recursiveMapAttributes,_0x1485e8)){_0x1ec208[_0x1485e8]=this[_0x0afd('0x90')](_0x1ec208[_0x1485e8]);}else{_0x1ec208[_0x1485e8]=this[_0x0afd('0x91')](_0x1ec208[_0x1485e8]);}}}}return _0x1ec208;};AGIVertices[_0x0afd('0x14')][_0x0afd('0x92')]=function(_0x1fd0ec){for(var _0x297203 in _0x1fd0ec){if(_0x1fd0ec[_0x0afd('0x8e')](_0x297203)){if(_[_0x0afd('0x93')](_0x1fd0ec[_0x297203])){this[_0x0afd('0x92')](_0x1fd0ec[_0x297203]);}else if(_[_0x0afd('0x94')](_0x1fd0ec[_0x297203])){for(var _0x4037e7=0x0;_0x4037e7<_0x1fd0ec[_0x297203][_0x0afd('0x95')];_0x4037e7++){this['recursiveNodeIndex'](_0x1fd0ec[_0x297203][_0x4037e7]);}}else if(_[_0x0afd('0x8f')](_0x1fd0ec[_0x297203])){_0x1fd0ec[_0x297203]=this[_0x0afd('0x91')](_0x1fd0ec[_0x297203]);}}}};AGIVertices[_0x0afd('0x14')][_0x0afd('0x96')]=function(_0x39dc9f,_0xb55d48){for(var _0x58d38b in _0x39dc9f){if(_0x39dc9f[_0x0afd('0x8e')](_0x58d38b)){if(_[_0x0afd('0x93')](_0x39dc9f[_0x58d38b])){if(!_[_0x0afd('0x46')](_0x39dc9f[_0x58d38b])){this[_0x0afd('0x96')](_0x39dc9f[_0x58d38b],util[_0x0afd('0x2b')](_0x0afd('0x97'),_0xb55d48,_0x58d38b));}}else if(_['isArray'](_0x39dc9f[_0x58d38b])){for(var _0x1aed3d=0x0;_0x1aed3d<_0x39dc9f[_0x58d38b][_0x0afd('0x95')];_0x1aed3d++){this[_0x0afd('0x96')](_0x39dc9f[_0x58d38b][_0x1aed3d],util['format'](_0x0afd('0x97'),_0xb55d48,_0x58d38b+'['+_0x1aed3d+']'));}}else{if(!_[_0x0afd('0x50')](_0x39dc9f[_0x58d38b])){this[_0x0afd('0x11')][_0x0afd('0x98')](util[_0x0afd('0x2b')]('%s.%s',_0xb55d48,_0x58d38b),_0x39dc9f[_0x58d38b]);}}}}};AGIVertices[_0x0afd('0x14')][_0x0afd('0x90')]=function(_0x13f3c5){try{var _0x3ec9b2=JSON[_0x0afd('0x6a')](_0x13f3c5);this[_0x0afd('0x92')](_0x3ec9b2);return JSON[_0x0afd('0x6f')](_0x3ec9b2);}catch(_0x19d289){return this[_0x0afd('0x91')](_0x13f3c5);}};AGIVertices['prototype'][_0x0afd('0x91')]=function(_0x5c7449){var _0xab3555=_0x5c7449['split']('{');for(var _0x24eb0d=0x1;_0x24eb0d<_0xab3555[_0x0afd('0x95')];_0x24eb0d+=0x1){var _0x46eb29=_0xab3555[_0x24eb0d]['split']('}');if(_0x46eb29['length']>0x1){_0x5c7449=_0x5c7449[_0x0afd('0x99')]('{'+_0x46eb29[0x0]+'}',this['channel'][_0x0afd('0x15')](_0x46eb29[0x0])[_0x0afd('0x9a')]||_0x46eb29[0x0]);}}if(_0xab3555[_0x0afd('0x95')]===0x1){return _0x5c7449[_0x0afd('0x9b')]();}return this['replaceAllVariables'](_0x5c7449);};AGIVertices[_0x0afd('0x14')][_0x0afd('0x9c')]=function(_0x32d39d,_0x496cfa){var _0x4d6053=this[_0x0afd('0x11')][_0x0afd('0x15')](_0x32d39d);if(_0x4d6053['result']===-0x1){return _0x4d6053;}logger[_0x0afd('0x30')](util[_0x0afd('0x2b')](_0x0afd('0x9d'),_0x496cfa,_0x4d6053['extra']));return this[_0x0afd('0x11')][_0x0afd('0x98')](_0x496cfa,_0x4d6053['extra']);};AGIVertices['prototype'][_0x0afd('0x80')]=function(_0x5751ea){return _0x5751ea&&_0x5751ea!=='0'&&_0x5751ea!=='-1'&&_0x5751ea!=='';};AGIVertices[_0x0afd('0x14')]['maxRetry']=function(_0x16d537){this['createSquareDetailsReport']['sync'](this,_0x16d537,'-');_0x16d537[_0x0afd('0x9e')]=_0x16d537[_0x0afd('0x9f')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x0afd('0x14')]['mrcpsynth']=function(_0x2e7127){logger[_0x0afd('0x30')](util[_0x0afd('0x2b')](_0x0afd('0xa0'),_0x2e7127[_0x0afd('0x3c')]));if(!this[_0x0afd('0x80')](_0x2e7127['text'])){return this[_0x0afd('0x11')][_0x0afd('0xa1')](_0x0afd('0xa2'));}var _0x524c0b='\x22'+_0x2e7127[_0x0afd('0x5d')]+'\x22';if(this[_0x0afd('0x80')](_0x2e7127[_0x0afd('0x74')])){_0x524c0b+=','+_0x2e7127[_0x0afd('0x74')];}var _0x864e2b=this['channel'][_0x0afd('0x58')](_0x0afd('0xa3'),_0x524c0b);if(_0x864e2b[_0x0afd('0xa4')]===-0x1){return _0x864e2b;}return this['channel'][_0x0afd('0xa1')](util[_0x0afd('0x2b')](_0x0afd('0xa5'),_0x524c0b));};AGIVertices[_0x0afd('0x14')][_0x0afd('0xa6')]=function(_0x5f4825){logger[_0x0afd('0x30')](util[_0x0afd('0x2b')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x5f4825[_0x0afd('0x3c')]));if(!this[_0x0afd('0x80')](_0x5f4825['grammar'])){return this[_0x0afd('0x11')][_0x0afd('0xa1')](_0x0afd('0xa7'));}var _0x80cf5d=_0x5f4825[_0x0afd('0xa8')];if(this['isConfigured'](_0x5f4825[_0x0afd('0x74')])){_0x80cf5d+=','+_0x5f4825[_0x0afd('0x74')];}var _0x18e2f1=this[_0x0afd('0x11')]['exec']('MRCPRecog',_0x80cf5d);if(_0x18e2f1['result']===-0x1){return _0x18e2f1;}var _0x4f6412=this[_0x0afd('0x9c')](_0x0afd('0xa9'),_0x0afd('0xaa'));if(_0x4f6412[_0x0afd('0xa4')]===-0x1){return _0x4f6412;}var _0x3b6a28=this[_0x0afd('0x9c')]('RECOG_INPUT()',_0x0afd('0xab'));if(_0x3b6a28['result']===-0x1){return _0x3b6a28;}var _0x5b85ae=this[_0x0afd('0x9c')](_0x0afd('0xac'),_0x0afd('0xad'));if(_0x5b85ae[_0x0afd('0xa4')]===-0x1){return _0x5b85ae;}return this['channel'][_0x0afd('0xa1')](util[_0x0afd('0x2b')](_0x0afd('0xae'),_0x80cf5d));};AGIVertices[_0x0afd('0x14')]['agi']=function(_0x3ca252){logger['info'](util[_0x0afd('0x2b')](_0x0afd('0xaf'),_0x3ca252['label']));return this['channel']['agi']([_0x3ca252[_0x0afd('0xb0')],_0x3ca252[_0x0afd('0xb1')]]);};AGIVertices['prototype']['answer']=function(_0x17e779){logger[_0x0afd('0x30')](util[_0x0afd('0x2b')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x17e779['label']));if(this[_0x0afd('0x80')](_0x17e779[_0x0afd('0x65')])){logger['info'](util[_0x0afd('0x2b')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x17e779[_0x0afd('0x65')]));var _0x511922=this[_0x0afd('0x11')]['wait'](_0x17e779['timeout']);if(_0x511922[_0x0afd('0xa4')]===-0x1){return _0x511922;}}return this[_0x0afd('0x11')]['answer']();};AGIVertices[_0x0afd('0x14')]['callback']=function(_0x3325ea){logger[_0x0afd('0x30')](util[_0x0afd('0x2b')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x3325ea[_0x0afd('0x3c')]));if(!this['isConfigured'](_0x3325ea[_0x0afd('0xb2')])){return this[_0x0afd('0x11')][_0x0afd('0x2e')](_0x3325ea,'no\x20list\x20selected');}_0x3325ea[_0x0afd('0x4b')]=moment();if(this['isConfigured'](_0x3325ea[_0x0afd('0xb3')])){_0x3325ea[_0x0afd('0x4b')]=moment()[_0x0afd('0xb4')](_0x3325ea['delay'],_0x0afd('0xb5'));}if(!this[_0x0afd('0x80')](_0x3325ea[_0x0afd('0xb6')])){_0x3325ea['callback_priority']=0x2;}this['createCmContact'][_0x0afd('0xb7')](this,_0x3325ea);return this[_0x0afd('0x11')][_0x0afd('0xa1')](util[_0x0afd('0x2b')](_0x0afd('0xb8'),_0x3325ea[_0x0afd('0x4a')],_0x3325ea['list_id'],_0x3325ea['scheduledAt']));};AGIVertices[_0x0afd('0x14')][_0x0afd('0xb9')]=function(_0x4a0102){logger[_0x0afd('0x30')](util[_0x0afd('0x2b')](_0x0afd('0xba'),_0x4a0102[_0x0afd('0x3c')]));var _0x21073f=this[_0x0afd('0x11')][_0x0afd('0x58')](_0x4a0102['application'],_0x4a0102['options']);if(_0x21073f[_0x0afd('0xa4')]===-0x1){return _0x21073f;}return this['channel'][_0x0afd('0xa1')](util['format'](_0x0afd('0xbb'),_0x4a0102[_0x0afd('0xbc')],_0x4a0102['options']));};AGIVertices[_0x0afd('0x14')][_0x0afd('0xbd')]=function(_0x175744){logger[_0x0afd('0x30')](util['format'](_0x0afd('0xbe'),_0x175744[_0x0afd('0x3c')]));if(!this[_0x0afd('0x80')](_0x175744[_0x0afd('0x5d')])){return this['channel'][_0x0afd('0xa1')](_0x0afd('0xa2'));}var _0x114668='\x22'+_0x175744['text']+'\x22';if(this['isConfigured'](_0x175744[_0x0afd('0x74')])){_0x114668+=','+_0x175744['options'];}var _0x377bfd=this[_0x0afd('0x11')][_0x0afd('0x58')]('MRCPSynth',_0x114668);if(_0x377bfd[_0x0afd('0xa4')]===-0x1){return _0x377bfd;}return this['channel'][_0x0afd('0xa1')](util['format'](_0x0afd('0xa5'),_0x114668));};AGIVertices[_0x0afd('0x14')][_0x0afd('0xbf')]=function(_0x2265f8){logger[_0x0afd('0x30')](util['format']('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x2265f8['label']));if(!this['isConfigured'](_0x2265f8['text'])){return this[_0x0afd('0x11')]['noop'](_0x0afd('0xa2'));}var _0x312407='\x22'+_0x2265f8[_0x0afd('0x5d')]+'\x22';if(this[_0x0afd('0x80')](_0x2265f8[_0x0afd('0x74')])){_0x312407+=','+_0x2265f8[_0x0afd('0x74')];}var _0x79de8d=this[_0x0afd('0x11')][_0x0afd('0x58')](_0x0afd('0xa3'),_0x312407);if(_0x79de8d[_0x0afd('0xa4')]===-0x1){return _0x79de8d;}return this[_0x0afd('0x11')]['noop'](util[_0x0afd('0x2b')]('Executed\x20command\x20MRCPSynth\x20%s',_0x312407));};AGIVertices[_0x0afd('0x14')][_0x0afd('0xc0')]=function(_0x36e5bc){logger[_0x0afd('0x30')](util[_0x0afd('0x2b')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x36e5bc[_0x0afd('0x3c')]));if(!this[_0x0afd('0x80')](_0x36e5bc[_0x0afd('0xa8')])){return this[_0x0afd('0x11')][_0x0afd('0xa1')](_0x0afd('0xa7'));}var _0x35343e=_0x36e5bc['grammar'];if(this['isConfigured'](_0x36e5bc[_0x0afd('0x74')])){_0x35343e+=','+_0x36e5bc[_0x0afd('0x74')];}var _0x550ca2=this[_0x0afd('0x11')][_0x0afd('0x58')](_0x0afd('0xc1'),_0x35343e);if(_0x550ca2['result']===-0x1){return _0x550ca2;}var _0x1d89c1=this[_0x0afd('0x9c')](_0x0afd('0xa9'),_0x0afd('0xc2'));if(_0x1d89c1[_0x0afd('0xa4')]===-0x1){return _0x1d89c1;}var _0x296884=this[_0x0afd('0x9c')](_0x0afd('0xc3'),_0x0afd('0xc4'));if(_0x296884[_0x0afd('0xa4')]===-0x1){return _0x296884;}var _0x3e54ee=this[_0x0afd('0x9c')]('RECOG_INSTANCE()',_0x0afd('0xc5'));if(_0x3e54ee[_0x0afd('0xa4')]===-0x1){return _0x3e54ee;}return this['channel']['noop'](util[_0x0afd('0x2b')](_0x0afd('0xae'),_0x35343e));};AGIVertices[_0x0afd('0x14')]['sestekasr']=function(_0x3efed9){logger[_0x0afd('0x30')](util[_0x0afd('0x2b')](_0x0afd('0xc6'),_0x3efed9['label']));if(!this[_0x0afd('0x80')](_0x3efed9[_0x0afd('0xa8')])){return this[_0x0afd('0x11')][_0x0afd('0xa1')](_0x0afd('0xa7'));}var _0xf02aff=_0x3efed9[_0x0afd('0xa8')];if(this[_0x0afd('0x80')](_0x3efed9[_0x0afd('0x74')])){_0xf02aff+=','+_0x3efed9[_0x0afd('0x74')];}var _0x5e5a66=this[_0x0afd('0x11')][_0x0afd('0x58')](_0x0afd('0xc1'),_0xf02aff);if(_0x5e5a66[_0x0afd('0xa4')]===-0x1){return _0x5e5a66;}var _0x230d54=this[_0x0afd('0x9c')](_0x0afd('0xa9'),_0x0afd('0xc7'));if(_0x230d54[_0x0afd('0xa4')]===-0x1){return _0x230d54;}var _0x74f513=this[_0x0afd('0x9c')]('RECOG_INPUT()','SESTEK_ASR_TRANSCRIPT');if(_0x74f513['result']===-0x1){return _0x74f513;}var _0xd927f0=this[_0x0afd('0x9c')]('RECOG_INSTANCE()',_0x0afd('0xc8'));if(_0xd927f0[_0x0afd('0xa4')]===-0x1){return _0xd927f0;}return this[_0x0afd('0x11')][_0x0afd('0xa1')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0xf02aff));};AGIVertices[_0x0afd('0x14')]['database']=function(_0x31d776){logger[_0x0afd('0x30')](util[_0x0afd('0x2b')](_0x0afd('0xc9'),_0x31d776[_0x0afd('0x3c')]));if(!this[_0x0afd('0x80')](_0x31d776[_0x0afd('0xca')])){return this[_0x0afd('0x11')]['error'](_0x31d776,'no\x20database\x20selected');}var _0x23bdaa=this[_0x0afd('0x1b')][_0x0afd('0xb7')](this,_0x31d776[_0x0afd('0xca')]);if(!_0x23bdaa){return this[_0x0afd('0x11')][_0x0afd('0x2e')](_0x31d776,_0x0afd('0xcb'));}if(!this[_0x0afd('0x80')](_0x31d776[_0x0afd('0x32')])){return this[_0x0afd('0x11')][_0x0afd('0x2e')](_0x31d776,_0x0afd('0xcc'));}var _0x285960=_0x31d776[_0x0afd('0x32')][_0x0afd('0xcd')](/(\r\n|\n|\r)/gm,'\x20');this[_0x0afd('0x11')][_0x0afd('0xa1')](util['format'](_0x0afd('0xce'),_0x285960));var _0x334836=this['getQueryOdbc']['sync'](this,_0x23bdaa,_0x285960);this[_0x0afd('0x3a')][_0x0afd('0xb7')](this,_0x31d776,_0x285960);if(!this[_0x0afd('0x80')](_0x31d776['variable_id'])){return this['channel'][_0x0afd('0xa1')](_0x0afd('0xcf'));}var _0x5ad56b=this[_0x0afd('0x15')][_0x0afd('0xb7')](this,_0x31d776[_0x0afd('0xd0')]);if(!_0x5ad56b){return this['channel'][_0x0afd('0x2e')](_0x31d776,_0x0afd('0xd1'));}var _0x21c649=this;_0x334836[_0x0afd('0xd2')](function(_0x5a6ea9,_0x27d132){Object[_0x0afd('0xd3')](_0x5a6ea9)['forEach'](function(_0x577cb6){_0x21c649[_0x0afd('0x11')][_0x0afd('0x98')](util[_0x0afd('0x2b')](_0x0afd('0xd4'),_0x5ad56b,_0x27d132,_0x577cb6),_0x5a6ea9[_0x577cb6]);});});this['channel']['setVariable'](util['format'](_0x0afd('0xd5'),_0x5ad56b),_0x334836['length']);return this['channel'][_0x0afd('0xa1')](util[_0x0afd('0x2b')]('variable\x20%s\x20set',_0x5ad56b));};AGIVertices[_0x0afd('0x14')][_0x0afd('0xd6')]=function(_0x3bca37){logger[_0x0afd('0xd7')](util[_0x0afd('0x2b')](_0x0afd('0xd8'),_0x3bca37[_0x0afd('0x3c')]));if(!this['isConfigured'](_0x3bca37[_0x0afd('0xd9')])){return this[_0x0afd('0x11')][_0x0afd('0x2e')](_0x3bca37,'no\x20user\x20selected');}var _0x413bef=this[_0x0afd('0x1d')][_0x0afd('0xb7')](this,_0x3bca37[_0x0afd('0xd9')]);if(!_0x413bef){return this[_0x0afd('0x11')]['error'](_0x3bca37,_0x0afd('0xda'));}var _0x1c09a7=this[_0x0afd('0x11')][_0x0afd('0x58')](_0x0afd('0xdb'),[util[_0x0afd('0x2b')](_0x0afd('0xdc'),_0x413bef),_0x3bca37[_0x0afd('0x65')],_0x3bca37[_0x0afd('0xdd')],_0x3bca37['url']]);if(_0x1c09a7['result']===-0x1){return _0x1c09a7;}return this[_0x0afd('0x11')][_0x0afd('0xa1')](util[_0x0afd('0x2b')](_0x0afd('0xde'),_0x0afd('0xdb')));};AGIVertices[_0x0afd('0x14')]['dialogflow']=function(_0x377276){logger[_0x0afd('0x30')](util[_0x0afd('0x2b')](_0x0afd('0xdf'),_0x377276[_0x0afd('0x3c')]));if(!this['isConfigured'](_0x377276[_0x0afd('0x76')])){return this[_0x0afd('0x11')][_0x0afd('0xa1')](_0x0afd('0xe0'));}if(!this[_0x0afd('0x80')](_0x377276['text'])){return this[_0x0afd('0x11')][_0x0afd('0xa1')](_0x0afd('0xa2'));}this[_0x0afd('0x11')][_0x0afd('0xe1')]=!![];this['createSquareDetailsReport'](_0x377276);this[_0x0afd('0x44')](_0x377276[_0x0afd('0x5d')],'in','','');this[_0x0afd('0x11')][_0x0afd('0xa1')](util['format'](_0x0afd('0xe2'),_0x377276['text']));var _0x3ef829=this[_0x0afd('0x75')]['sync'](this,_0x377276);if(_0x3ef829){for(var _0x5d339e in _0x3ef829){if(_0x3ef829['hasOwnProperty'](_0x5d339e)){this[_0x0afd('0x11')][_0x0afd('0x98')](util[_0x0afd('0x2b')]('DIALOGFLOW_%s',_0x5d339e[_0x0afd('0xe3')]()),_0x3ef829[_0x5d339e]);}}this[_0x0afd('0x44')](_0x3ef829[_0x0afd('0xe4')],_0x0afd('0xe5'),_0x0afd('0xe6'),'');return this[_0x0afd('0x11')][_0x0afd('0xa1')](util['format'](_0x0afd('0xe7'),_0x3ef829[_0x0afd('0xe4')]));}return this[_0x0afd('0x11')][_0x0afd('0x2e')](_0x377276,_0x0afd('0xe8'));};AGIVertices[_0x0afd('0x14')]['dialogflowV2']=function(_0x18f90c){logger['info'](util[_0x0afd('0x2b')](_0x0afd('0xe9'),_0x18f90c[_0x0afd('0x3c')]));if(!this['isConfigured'](_0x18f90c[_0x0afd('0x79')])){return this[_0x0afd('0x11')]['noop'](_0x0afd('0xea'));}if(!this[_0x0afd('0x80')](_0x18f90c[_0x0afd('0x7a')])){return this[_0x0afd('0x11')]['noop'](_0x0afd('0xeb'));}if(!this[_0x0afd('0x80')](_0x18f90c[_0x0afd('0xec')])){return this[_0x0afd('0x11')][_0x0afd('0xa1')]('no\x20private_key\x20configured');}if(!this[_0x0afd('0x80')](_0x18f90c['dialogflowV2_language'])){return this[_0x0afd('0x11')][_0x0afd('0xa1')](_0x0afd('0xed'));}if(!this[_0x0afd('0x80')](_0x18f90c[_0x0afd('0x5d')])){return this[_0x0afd('0x11')]['noop'](_0x0afd('0xa2'));}this[_0x0afd('0x11')][_0x0afd('0xe1')]=!![];this['createSquareDetailsReport'](_0x18f90c);this[_0x0afd('0x44')](_0x18f90c[_0x0afd('0x5d')],'in','','');this[_0x0afd('0x11')][_0x0afd('0xa1')](util[_0x0afd('0x2b')]('Trying\x20DialogflowV2:\x20%s',_0x18f90c[_0x0afd('0x5d')]));var _0x3da567=this['googleDialogflowV2']['sync'](this,_0x18f90c);if(_0x3da567){for(var _0xb263e0 in _0x3da567){if(_0x3da567['hasOwnProperty'](_0xb263e0)){if(_0xb263e0!==_0x0afd('0xee')){this[_0x0afd('0x11')][_0x0afd('0x98')](util[_0x0afd('0x2b')](_0x0afd('0xef'),_0xb263e0['toUpperCase']()),_0x3da567[_0xb263e0]);}}}this[_0x0afd('0x44')](_0x3da567[_0x0afd('0xe4')],_0x0afd('0xe5'),'dialogflowV2',_0x3da567[_0x0afd('0xee')]);return this[_0x0afd('0x11')][_0x0afd('0xa1')](util[_0x0afd('0x2b')](_0x0afd('0xf0'),_0x3da567['speech']));}return this['channel'][_0x0afd('0x2e')](_0x18f90c,_0x0afd('0xf1'));};AGIVertices['prototype'][_0x0afd('0xf2')]=function(_0x5ac06f){logger[_0x0afd('0x30')](util[_0x0afd('0x2b')](_0x0afd('0xf3'),_0x5ac06f['label']));if(!this[_0x0afd('0x80')](_0x5ac06f[_0x0afd('0xf4')])){return this[_0x0afd('0x11')][_0x0afd('0xa1')](_0x0afd('0xf5'));}if(!this[_0x0afd('0x80')](_0x5ac06f['username'])){return this['channel']['noop'](_0x0afd('0xf6'));}if(!this[_0x0afd('0x80')](_0x5ac06f['password'])){return this['channel']['noop'](_0x0afd('0xf7'));}if(!this[_0x0afd('0x80')](_0x5ac06f['ndassistant_url'])){return this[_0x0afd('0x11')][_0x0afd('0xa1')](_0x0afd('0xa2'));}this[_0x0afd('0x11')]['bot']=!![];this[_0x0afd('0x3a')](_0x5ac06f);this[_0x0afd('0x44')](_0x5ac06f[_0x0afd('0x5d')],'in','','');this[_0x0afd('0x11')]['noop'](util['format'](_0x0afd('0xf8'),_0x5ac06f[_0x0afd('0x5d')]));var _0x2a70a7=this[_0x0afd('0x7c')][_0x0afd('0xb7')](this,_0x5ac06f);if(_0x2a70a7){for(var _0x2a5cbf in _0x2a70a7){if(_0x2a70a7[_0x0afd('0x8e')](_0x2a5cbf)){this[_0x0afd('0x11')]['setVariable'](util[_0x0afd('0x2b')](_0x0afd('0xf9'),_0x2a5cbf[_0x0afd('0xe3')]()),_0x2a70a7[_0x2a5cbf]);}}this[_0x0afd('0x44')](_0x2a70a7[_0x0afd('0xe4')],'out',_0x0afd('0xf2'),'');if(_0x2a70a7[_0x0afd('0xfa')]){this[_0x0afd('0x11')][_0x0afd('0xa1')](util[_0x0afd('0x2b')](_0x0afd('0xfb'),_0x2a70a7[_0x0afd('0xfa')]));var _0x2b6711=this['channel'][_0x0afd('0xfc')](_0x2a70a7[_0x0afd('0xfa')]);try{fs[_0x0afd('0xfd')](_0x2a70a7[_0x0afd('0xfa')]+_0x0afd('0xfe'));}catch(_0x4ff870){logger['error'](_0x4ff870);}return _0x2b6711;}else{return this[_0x0afd('0x11')]['noop'](util['format'](_0x0afd('0xff'),_0x2a70a7[_0x0afd('0xe4')]));}}return this['channel'][_0x0afd('0x2e')](_0x5ac06f,_0x0afd('0x100'));};AGIVertices[_0x0afd('0x14')][_0x0afd('0x101')]=function(_0x3758a2){logger['info'](util['format'](_0x0afd('0x102'),_0x3758a2[_0x0afd('0x3c')]));return this[_0x0afd('0x11')]['noop']('end');};AGIVertices['prototype']['ext_dial']=function(_0x1f2a56){logger['info'](util[_0x0afd('0x2b')](_0x0afd('0x103'),_0x1f2a56['label']));var _0x130f72='';if(_0x1f2a56[_0x0afd('0x104')]){if(!this[_0x0afd('0x80')](_0x1f2a56[_0x0afd('0x104')])){return this[_0x0afd('0x11')][_0x0afd('0x2e')](_0x1f2a56,_0x0afd('0x105'));}else{var _0x1d7e94=parseInt(_0x1f2a56[_0x0afd('0x104')],0xa);if(isNaN(_0x1d7e94)){_0x130f72=_0x1f2a56['trunk_id'];}else{_0x130f72=this[_0x0afd('0x1f')][_0x0afd('0xb7')](this,_0x1f2a56[_0x0afd('0x104')]);if(!_0x130f72){return this[_0x0afd('0x11')][_0x0afd('0x2e')](_0x1f2a56,_0x0afd('0x106'));}}}}else if(_0x1f2a56[_0x0afd('0x107')]){_0x130f72=_0x1f2a56[_0x0afd('0x107')];}else{return this['channel'][_0x0afd('0x2e')](_0x1f2a56,_0x0afd('0x105'));}var _0x10bb63=this[_0x0afd('0x11')][_0x0afd('0x58')](_0x0afd('0xdb'),[util['format']('SIP/%s/%s',_0x130f72,_0x1f2a56[_0x0afd('0x4a')]),_0x1f2a56['timeout'],_0x1f2a56[_0x0afd('0xdd')],_0x1f2a56[_0x0afd('0x64')]]);if(_0x10bb63[_0x0afd('0xa4')]===-0x1){return _0x10bb63;}return this[_0x0afd('0x11')][_0x0afd('0xa1')](util[_0x0afd('0x2b')]('Executed\x20command\x20%s','DIAL'));};AGIVertices['prototype'][_0x0afd('0x108')]=function(_0x4a6830){logger[_0x0afd('0x30')](util[_0x0afd('0x2b')](_0x0afd('0x109'),_0x4a6830[_0x0afd('0x3c')]));return this[_0x0afd('0x11')]['noop'](_0x0afd('0x108'));};AGIVertices[_0x0afd('0x14')]['getdigits']=function(_0x492483){logger[_0x0afd('0x30')](util[_0x0afd('0x2b')](_0x0afd('0x10a'),_0x492483[_0x0afd('0x3c')]));if(_0x492483[_0x0afd('0x9e')]===0x0){return this[_0x0afd('0x9f')](_0x492483);}_0x492483[_0x0afd('0x9e')]-=0x1;if(!this['isConfigured'](_0x492483['file_id'])){return this[_0x0afd('0x11')]['error'](_0x492483,'no\x20file\x20audio\x20selected');}var _0x1f86a8=this[_0x0afd('0x20')][_0x0afd('0xb7')](this,_0x492483['file_id']);if(!_0x1f86a8){return this['channel'][_0x0afd('0x2e')](_0x492483,'no\x20file\x20audio\x20found');}if(!this[_0x0afd('0x80')](_0x492483['variable_id'])){return this[_0x0afd('0x11')][_0x0afd('0x2e')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x5e5c39=this['channel']['getData'](_0x1f86a8,_0x492483[_0x0afd('0x10b')],_0x492483[_0x0afd('0x10c')]);var _0x20ca3e=_0x5e5c39[_0x0afd('0xa4')]?_0x5e5c39[_0x0afd('0xa4')][_0x0afd('0x9b')]():'';logger[_0x0afd('0x30')](_0x0afd('0x10d'),JSON[_0x0afd('0x6f')](_0x5e5c39));if(_0x5e5c39[_0x0afd('0xa4')]===-0x1){this[_0x0afd('0x3a')][_0x0afd('0xb7')](this,_0x492483,_0x20ca3e);return _0x5e5c39;}else if(_0x5e5c39['extra']===_0x0afd('0x65')){_0x5e5c39['result']=_0x20ca3e[_0x0afd('0x95')]>=parseInt(_0x492483[_0x0afd('0x10e')])?'x':'i';}else{_0x5e5c39[_0x0afd('0xa4')]=_0x20ca3e['length']>=parseInt(_0x492483['mindigit'])&&_0x20ca3e[_0x0afd('0x95')]<=parseInt(_0x492483[_0x0afd('0x10c')])?'x':'i';}var _0x378866=this[_0x0afd('0x15')][_0x0afd('0xb7')](this,_0x492483[_0x0afd('0xd0')]);if(!_0x378866){return this[_0x0afd('0x11')][_0x0afd('0x2e')](_0x492483,_0x0afd('0xd1'));}this['channel']['setVariable'](_0x378866,_0x20ca3e);if(this[_0x0afd('0x80')](_0x492483[_0x0afd('0x10f')])){var _0x4fa0ab=parseInt(_0x492483[_0x0afd('0x10f')],0xa);var _0x205956=rs[_0x0afd('0x110')]({'charset':'*','length':_0x4fa0ab});var _0x508b5d=_0x20ca3e[_0x0afd('0x95')];if(_0x508b5d>0x0){if(_0x508b5d>_0x4fa0ab){this[_0x0afd('0x3a')][_0x0afd('0xb7')](this,_0x492483,_0x492483[_0x0afd('0x111')]===_0x0afd('0x112')?_0x205956+_0x20ca3e['substr'](_0x4fa0ab):_0x20ca3e['substr'](0x0,_0x508b5d-_0x4fa0ab)+_0x205956);}else{this['createSquareDetailsReport'][_0x0afd('0xb7')](this,_0x492483,rs[_0x0afd('0x110')]({'charset':'*','length':_0x508b5d}));}}else{this[_0x0afd('0x3a')][_0x0afd('0xb7')](this,_0x492483,'');}}else{this['createSquareDetailsReport'][_0x0afd('0xb7')](this,_0x492483,_0x20ca3e);}return _0x5e5c39;};AGIVertices['prototype'][_0x0afd('0x10')]=function(_0x1c215b){logger[_0x0afd('0x30')](util[_0x0afd('0x2b')](_0x0afd('0x113'),_0x1c215b['label']));return this[_0x0afd('0xf')](_0x1c215b);};AGIVertices[_0x0afd('0x14')][_0x0afd('0x114')]=function(_0x2883f3){logger[_0x0afd('0x30')](util[_0x0afd('0x2b')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x2883f3[_0x0afd('0x3c')]));this[_0x0afd('0x3a')][_0x0afd('0xb7')](this,_0x2883f3,_0x2883f3['goalname']);return this[_0x0afd('0x11')][_0x0afd('0xa1')](util['format'](_0x0afd('0x115'),_0x2883f3[_0x0afd('0x116')]));};AGIVertices[_0x0afd('0x14')][_0x0afd('0x117')]=function(_0x50bcf5){logger[_0x0afd('0x30')](util[_0x0afd('0x2b')](_0x0afd('0x118'),_0x50bcf5[_0x0afd('0x3c')]));if(!this[_0x0afd('0x80')](_0x50bcf5[_0x0afd('0x83')])||!this[_0x0afd('0x80')](_0x50bcf5[_0x0afd('0x84')])){return this[_0x0afd('0x11')][_0x0afd('0xa1')](_0x0afd('0x119'));}if(!this['isConfigured'](_0x50bcf5[_0x0afd('0x5d')])){return this[_0x0afd('0x11')]['noop'](_0x0afd('0xa2'));}this[_0x0afd('0x11')][_0x0afd('0xa1')](util[_0x0afd('0x2b')](_0x0afd('0x11a'),_0x50bcf5[_0x0afd('0x5d')]));var _0x6c89d6=this[_0x0afd('0x82')]['sync'](this,_0x50bcf5);if(_0x6c89d6){this[_0x0afd('0x11')]['noop'](util[_0x0afd('0x2b')](_0x0afd('0x11b'),_0x6c89d6));var _0x40d931=this['channel'][_0x0afd('0xfc')](_0x6c89d6);try{fs[_0x0afd('0xfd')](_0x6c89d6+'.wav');}catch(_0x2aeedc){logger[_0x0afd('0x2e')](_0x2aeedc);}return _0x40d931;}return this['channel'][_0x0afd('0x2e')](_0x50bcf5,'aws\x20Polly\x20is\x20unreachable');};AGIVertices['prototype'][_0x0afd('0x11c')]=function(_0x5bb155){logger[_0x0afd('0x30')](util[_0x0afd('0x2b')](_0x0afd('0x11d'),_0x5bb155[_0x0afd('0x3c')]));if(!this[_0x0afd('0x80')](_0x5bb155[_0x0afd('0x83')])||!this[_0x0afd('0x80')](_0x5bb155[_0x0afd('0x84')])){return this[_0x0afd('0x11')][_0x0afd('0xa1')](_0x0afd('0x119'));}if(!this[_0x0afd('0x80')](_0x5bb155[_0x0afd('0x87')])){return this[_0x0afd('0x11')][_0x0afd('0xa1')](_0x0afd('0x11e'));}if(!this['isConfigured'](_0x5bb155[_0x0afd('0x5d')])){return this[_0x0afd('0x11')][_0x0afd('0xa1')]('no\x20text\x20configured');}this[_0x0afd('0x11')][_0x0afd('0xe1')]=!![];this[_0x0afd('0x3a')](_0x5bb155);this[_0x0afd('0x44')](_0x5bb155[_0x0afd('0x5d')],'in','','');this[_0x0afd('0x11')][_0x0afd('0xa1')](util[_0x0afd('0x2b')]('Trying\x20Amazon\x20Lex:\x20%s',_0x5bb155[_0x0afd('0x5d')]));var _0x3cbb72=this[_0x0afd('0x86')]['sync'](this,_0x5bb155);if(_0x3cbb72){for(var _0x1c4605 in _0x3cbb72){if(_0x3cbb72[_0x0afd('0x8e')](_0x1c4605)&&_[_0x0afd('0x8f')](_0x3cbb72[_0x1c4605])){this[_0x0afd('0x11')][_0x0afd('0x98')](util[_0x0afd('0x2b')](_0x0afd('0x11f'),_0x1c4605[_0x0afd('0xe3')]()),_0x3cbb72[_0x1c4605]);}}if(_[_0x0afd('0x50')](_0x3cbb72['message'])){return this[_0x0afd('0x11')][_0x0afd('0xa1')](_0x0afd('0x120'));}else{this['createSquareMessage'](_0x3cbb72['message'],_0x0afd('0xe5'),_0x0afd('0x121'),'');return this['channel'][_0x0afd('0xa1')](util[_0x0afd('0x2b')](_0x0afd('0x122'),_0x3cbb72[_0x0afd('0x73')]));}}return this[_0x0afd('0x11')][_0x0afd('0x2e')](_0x5bb155,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x0afd('0x14')]['googleasr']=function(_0x47bb18){logger[_0x0afd('0x30')](util['format'](_0x0afd('0x123'),_0x47bb18[_0x0afd('0x3c')],_0x47bb18[_0x0afd('0x65')]));if(!this[_0x0afd('0x80')](_0x47bb18[_0x0afd('0x76')])){return this['channel']['noop'](_0x0afd('0xe0'));}var _0x5baa53=_0x0afd('0x124');var _0x5003e5=util['format']('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x3fc1e7=util['format'](_0x0afd('0x97'),_0x5003e5,_0x5baa53);var _0x3732c5=!![];if(_0x47bb18['beep']===_0x0afd('0x125')){_0x3732c5=![];}var _0x36469a=this[_0x0afd('0x11')][_0x0afd('0x126')](_0x5003e5,_0x5baa53,_0x47bb18[_0x0afd('0x127')],_0x47bb18['timeout'],undefined,_0x3732c5);if(_0x36469a[_0x0afd('0xa4')]!==-0x1){this['channel'][_0x0afd('0xa1')](util['format'](_0x0afd('0x128'),_0x3fc1e7));var _0x4da1ac=this['googleASR'][_0x0afd('0xb7')](this,_0x47bb18,_0x3fc1e7);if(_0x4da1ac){for(var _0xa17c95 in _0x4da1ac){if(_0x4da1ac[_0x0afd('0x8e')](_0xa17c95)){this[_0x0afd('0x11')][_0x0afd('0x98')](util[_0x0afd('0x2b')](_0x0afd('0x129'),_0xa17c95['toUpperCase']()),_0x4da1ac[_0xa17c95]);}}return this[_0x0afd('0x11')][_0x0afd('0xa1')](util[_0x0afd('0x2b')](_0x0afd('0x12a'),JSON[_0x0afd('0x6f')](_0x4da1ac)));}}return _0x36469a;};AGIVertices[_0x0afd('0x14')][_0x0afd('0x12b')]=function(_0x100dfe){logger[_0x0afd('0x30')](util[_0x0afd('0x2b')](_0x0afd('0x12c'),_0x100dfe[_0x0afd('0x3c')]));if(!this[_0x0afd('0x80')](_0x100dfe[_0x0afd('0x89')])){return this[_0x0afd('0x11')][_0x0afd('0xa1')](_0x0afd('0x12d'));}if(!this[_0x0afd('0x80')](_0x100dfe[_0x0afd('0x8a')])){return this[_0x0afd('0x11')][_0x0afd('0xa1')](_0x0afd('0x12e'));}var _0x2fe845=_0x0afd('0x124');var _0x497137=util['format'](_0x0afd('0x12f'),FILES_PATH,rs['generate'](0x4));var _0x3df774=util[_0x0afd('0x2b')](_0x0afd('0x97'),_0x497137,_0x2fe845);var _0x5463cb=!![];if(_0x100dfe[_0x0afd('0x130')]===_0x0afd('0x125')){_0x5463cb=![];}var _0x2f9733=this[_0x0afd('0x11')][_0x0afd('0x126')](_0x497137,_0x2fe845,_0x100dfe[_0x0afd('0x127')],_0x100dfe['timeout'],undefined,_0x5463cb);if(_0x2f9733[_0x0afd('0xa4')]!==-0x1){this['channel'][_0x0afd('0xa1')](util[_0x0afd('0x2b')](_0x0afd('0x131'),_0x3df774));var _0x2af5f4=this[_0x0afd('0x132')][_0x0afd('0xb7')](this,_0x100dfe,_0x3df774);if(_0x2af5f4){for(var _0x22257d in _0x2af5f4){if(_0x2af5f4['hasOwnProperty'](_0x22257d)){this[_0x0afd('0x11')][_0x0afd('0x98')](util[_0x0afd('0x2b')]('TILDE_ASR_%s',_0x22257d['toUpperCase']()),_0x2af5f4[_0x22257d]);}}return this['channel'][_0x0afd('0xa1')](util['format'](_0x0afd('0x133'),JSON[_0x0afd('0x6f')](_0x2af5f4)));}}return _0x2f9733;};AGIVertices[_0x0afd('0x14')][_0x0afd('0x134')]=function(_0x2564f0){logger[_0x0afd('0x30')](util[_0x0afd('0x2b')](_0x0afd('0x135'),_0x2564f0['label']));return this['channel'][_0x0afd('0x136')](_0x2564f0[_0x0afd('0x41')],_0x2564f0[_0x0afd('0x137')],_0x2564f0[_0x0afd('0x138')]);};AGIVertices['prototype']['gotoif']=function(_0x87f77d){logger['info'](util['format'](_0x0afd('0x139'),_0x87f77d[_0x0afd('0x3c')]));if(!this['isConfigured'](_0x87f77d['condition'])){return this[_0x0afd('0x11')]['error'](_0x87f77d,_0x0afd('0x13a'));}try{var _0x390cf4=eval(_0x87f77d[_0x0afd('0x13b')])?_0x0afd('0x13c'):'false';this[_0x0afd('0x11')][_0x0afd('0xa1')](util[_0x0afd('0x2b')](_0x0afd('0x13d'),_0x87f77d[_0x0afd('0x13b')],_0x390cf4));return{'code':0xc8,'result':_0x390cf4};}catch(_0x56be2a){return{'code':0xc8,'result':_0x0afd('0x13e')};}};AGIVertices[_0x0afd('0x14')]['gotoiftime']=function(_0x518d7a){logger['info'](util[_0x0afd('0x2b')](_0x0afd('0x13f'),_0x518d7a[_0x0afd('0x3c')]));if(!this[_0x0afd('0x80')](_0x518d7a[_0x0afd('0x140')])){return this[_0x0afd('0x11')]['error'](_0x518d7a,'no\x20interval\x20configured');}var _0xe92c27=this[_0x0afd('0x26')][_0x0afd('0xb7')](this,_0x518d7a[_0x0afd('0x140')]);if(!_0xe92c27){return this[_0x0afd('0x11')][_0x0afd('0x2e')](_0x518d7a,_0x0afd('0x141'));}for(var _0x11ef57=0x0;_0x11ef57<_0xe92c27[_0x0afd('0x95')];_0x11ef57+=0x1){var _0x53898e=this[_0x0afd('0x11')][_0x0afd('0x15')](util[_0x0afd('0x2b')](_0x0afd('0x142'),_0xe92c27[_0x11ef57]));if(_0x53898e['result']===-0x1){return _0x53898e;}logger[_0x0afd('0x30')](util[_0x0afd('0x2b')](_0x0afd('0x143'),_0xe92c27[_0x11ef57],_0x53898e['extra']));if(_0x53898e[_0x0afd('0x9a')]===_0x0afd('0x13c')){logger[_0x0afd('0x30')](util['format'](_0x0afd('0x143'),_0xe92c27[_0x11ef57],_0x0afd('0x13c')));this[_0x0afd('0x11')][_0x0afd('0xa1')](util['format'](_0x0afd('0x143'),_0xe92c27[_0x11ef57],_0x0afd('0x13c')));return{'code':0xc8,'result':'true'};}else{logger[_0x0afd('0x30')](util[_0x0afd('0x2b')](_0x0afd('0x143'),_0xe92c27[_0x11ef57],_0x0afd('0x13e')));this[_0x0afd('0x11')][_0x0afd('0xa1')](util[_0x0afd('0x2b')](_0x0afd('0x143'),_0xe92c27[_0x11ef57],_0x0afd('0x13e')));}}return{'code':0xc8,'result':_0x0afd('0x13e')};};AGIVertices[_0x0afd('0x14')][_0x0afd('0x144')]=function(_0x1b60ff){logger[_0x0afd('0x30')](util[_0x0afd('0x2b')](_0x0afd('0x145'),_0x1b60ff[_0x0afd('0x3c')]));return this[_0x0afd('0x11')]['hangup']();};AGIVertices[_0x0afd('0x14')][_0x0afd('0x146')]=function(_0x427383){logger[_0x0afd('0x30')](util[_0x0afd('0x2b')](_0x0afd('0x147'),_0x427383['label']));if(!this[_0x0afd('0x80')](_0x427383[_0x0afd('0x76')])){return this[_0x0afd('0x11')][_0x0afd('0xa1')]('no\x20key\x20configured');}var _0x2b9f91=_0x0afd('0x124');var _0x34818c=util['format'](_0x0afd('0x12f'),FILES_PATH,rs[_0x0afd('0x110')](0x4));var _0x41f6c9=util[_0x0afd('0x2b')](_0x0afd('0x97'),_0x34818c,_0x2b9f91);var _0x52850a=!![];if(_0x427383[_0x0afd('0x130')]==='NOBEEP'){_0x52850a=![];}var _0x554269=this[_0x0afd('0x11')]['recordFile'](_0x34818c,_0x2b9f91,_0x427383[_0x0afd('0x127')],_0x427383[_0x0afd('0x65')],undefined,_0x52850a);if(_0x554269['result']!==-0x1){this[_0x0afd('0x11')][_0x0afd('0xa1')](util['format']('ispeech\x20%s\x20file\x20created',_0x41f6c9));var _0x540fe2=this[_0x0afd('0x148')][_0x0afd('0xb7')](this,_0x427383,_0x41f6c9);if(_0x540fe2){for(var _0x439eef in _0x540fe2){if(_0x540fe2[_0x0afd('0x8e')](_0x439eef)){this[_0x0afd('0x11')][_0x0afd('0x98')](util[_0x0afd('0x2b')]('ISPEECH_ASR_%s',_0x439eef[_0x0afd('0xe3')]()),_0x540fe2[_0x439eef]);}}return this['channel'][_0x0afd('0xa1')](util['format']('IspeechASR\x20Result\x20%s',JSON[_0x0afd('0x6f')](_0x540fe2)));}}return _0x554269;};AGIVertices[_0x0afd('0x14')][_0x0afd('0x149')]=function(_0x9a6bdc){logger[_0x0afd('0x30')](util[_0x0afd('0x2b')](_0x0afd('0x14a'),_0x9a6bdc['label']));if(!this['isConfigured'](_0x9a6bdc[_0x0afd('0x76')])){return this[_0x0afd('0x11')][_0x0afd('0xa1')]('no\x20key\x20configured');}if(!this[_0x0afd('0x80')](_0x9a6bdc[_0x0afd('0x5d')])){return this['channel']['noop'](_0x0afd('0xa2'));}this['channel'][_0x0afd('0xa1')](util[_0x0afd('0x2b')](_0x0afd('0x14b'),_0x9a6bdc[_0x0afd('0x5d')]));var _0x39a0af=this['ispeechTTS'][_0x0afd('0xb7')](this,_0x9a6bdc);if(_0x39a0af){this[_0x0afd('0x11')][_0x0afd('0xa1')](util[_0x0afd('0x2b')](_0x0afd('0x14c'),_0x39a0af));var _0x4007c3=this[_0x0afd('0x11')][_0x0afd('0xfc')](_0x39a0af,_0x9a6bdc[_0x0afd('0x127')]);try{fs[_0x0afd('0xfd')](_0x39a0af+'.wav');}catch(_0x873595){logger[_0x0afd('0x2e')](_0x873595);}return _0x4007c3;}return this[_0x0afd('0x11')]['error'](_0x9a6bdc,_0x0afd('0x14d'));};AGIVertices[_0x0afd('0x14')][_0x0afd('0x14e')]=function(_0x39f7b1){logger[_0x0afd('0x30')](util[_0x0afd('0x2b')](_0x0afd('0x14f'),_0x39f7b1['label']));if(!this[_0x0afd('0x80')](_0x39f7b1[_0x0afd('0x150')])){return this[_0x0afd('0x11')][_0x0afd('0x2e')](_0x39f7b1,_0x0afd('0x151'));}logger[_0x0afd('0x30')](util[_0x0afd('0x2b')](_0x0afd('0x152'),this['channel']['callerid'],_0x39f7b1['findBy']));var _0x423ed5=this['agentLogin'][_0x0afd('0xb7')](this,_0x39f7b1[_0x0afd('0x150')]);if(_0x423ed5){logger[_0x0afd('0x30')](util[_0x0afd('0x2b')](_0x0afd('0x153'),this[_0x0afd('0x11')][_0x0afd('0x3f')],_0x39f7b1[_0x0afd('0x150')]));this[_0x0afd('0x11')]['noop'](util[_0x0afd('0x2b')](_0x0afd('0x153'),this[_0x0afd('0x11')][_0x0afd('0x3f')],_0x39f7b1[_0x0afd('0x150')]));return{'code':0xc8,'result':_0x0afd('0x154')};}else{logger[_0x0afd('0x30')](util[_0x0afd('0x2b')](_0x0afd('0x155'),this[_0x0afd('0x11')][_0x0afd('0x3f')],_0x39f7b1[_0x0afd('0x150')]));this[_0x0afd('0x11')][_0x0afd('0xa1')](util[_0x0afd('0x2b')](_0x0afd('0x155'),this[_0x0afd('0x11')][_0x0afd('0x3f')],_0x39f7b1[_0x0afd('0x150')]));return{'code':0xc8,'result':_0x0afd('0x156')};}};AGIVertices['prototype']['logout']=function(_0x2d6235){logger['info'](util['format'](_0x0afd('0x157'),_0x2d6235[_0x0afd('0x3c')]));if(!this[_0x0afd('0x80')](_0x2d6235['findBy'])){return this[_0x0afd('0x11')][_0x0afd('0x2e')](_0x2d6235,_0x0afd('0x151'));}logger[_0x0afd('0x30')](util[_0x0afd('0x2b')](_0x0afd('0x152'),this[_0x0afd('0x11')][_0x0afd('0x3f')],_0x2d6235[_0x0afd('0x150')]));var _0x33876c=this[_0x0afd('0x52')][_0x0afd('0xb7')](this,_0x2d6235[_0x0afd('0x150')]);if(_0x33876c){logger['info'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x0afd('0x11')][_0x0afd('0x3f')],_0x2d6235['findBy']));this['channel'][_0x0afd('0xa1')](util[_0x0afd('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x2d6235[_0x0afd('0x150')]));return{'code':0xc8,'result':'success'};}else{logger[_0x0afd('0x30')](util[_0x0afd('0x2b')](_0x0afd('0x155'),this['channel']['callerid'],_0x2d6235[_0x0afd('0x150')]));this[_0x0afd('0x11')]['noop'](util['format'](_0x0afd('0x155'),this[_0x0afd('0x11')][_0x0afd('0x3f')],_0x2d6235[_0x0afd('0x150')]));return{'code':0xc8,'result':_0x0afd('0x156')};}};AGIVertices[_0x0afd('0x14')][_0x0afd('0x158')]=function(_0x160e8b){logger[_0x0afd('0x30')](util[_0x0afd('0x2b')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x160e8b[_0x0afd('0x3c')]));if(!this[_0x0afd('0x80')](_0x160e8b[_0x0afd('0x159')])){return this[_0x0afd('0x11')][_0x0afd('0x2e')](_0x160e8b,_0x0afd('0x15a'));}this['channel'][_0x0afd('0xa1')](util[_0x0afd('0x2b')](_0x0afd('0x15b'),_0x160e8b[_0x0afd('0x159')]));var _0x51fba8=eval(_0x160e8b[_0x0afd('0x159')]);if(!this[_0x0afd('0x80')](_0x160e8b[_0x0afd('0xd0')])){return this[_0x0afd('0x11')]['noop'](_0x0afd('0xcf'));}var _0x1c93d4=this[_0x0afd('0x15')][_0x0afd('0xb7')](this,_0x160e8b[_0x0afd('0xd0')]);if(!_0x1c93d4){return this['channel']['error'](_0x160e8b,_0x0afd('0xd1'));}if(_[_0x0afd('0x94')](_0x51fba8)){var _0x4625bb=this;_0x51fba8['forEach'](function(_0xd413dc,_0x3629d8){_0x4625bb[_0x0afd('0x11')][_0x0afd('0x98')](util[_0x0afd('0x2b')]('%s[%s]',_0x1c93d4,_0x3629d8),_0xd413dc);});return this[_0x0afd('0x11')][_0x0afd('0xa1')](util[_0x0afd('0x2b')]('variable\x20%s[key]\x20set',_0x1c93d4));}else{return this[_0x0afd('0x11')][_0x0afd('0x98')](_0x1c93d4,_0x51fba8);}};AGIVertices[_0x0afd('0x14')][_0x0afd('0xe')]=function(_0x256fe6){logger[_0x0afd('0x30')](util['format'](_0x0afd('0x15c'),_0x256fe6[_0x0afd('0x3c')]));if(_0x256fe6[_0x0afd('0x9e')]===0x0){return this['maxRetry'](_0x256fe6);}_0x256fe6[_0x0afd('0x9e')]-=0x1;if(!this[_0x0afd('0x80')](_0x256fe6['file_id'])){return this[_0x0afd('0x11')][_0x0afd('0x2e')](_0x256fe6,_0x0afd('0x15d'));}var _0x4940a9=this['getSound']['sync'](this,_0x256fe6['file_id']);if(!_0x4940a9){return this['channel']['error'](_0x256fe6,_0x0afd('0x15e'));}var _0x5985ef=this[_0x0afd('0x11')][_0x0afd('0x15f')](_0x4940a9,_0x256fe6[_0x0afd('0x10b')],_0x256fe6['digit']);var _0x3d2fd7=_0x5985ef[_0x0afd('0xa4')];if(_0x5985ef[_0x0afd('0xa4')]===-0x1){this['createSquareDetailsReport'][_0x0afd('0xb7')](this,_0x256fe6,'-1');return _0x5985ef;}else if(_0x5985ef[_0x0afd('0x9a')]==='timeout'){_0x5985ef[_0x0afd('0xa4')]=_0x5985ef[_0x0afd('0xa4')][_0x0afd('0x95')]>0x0?_0x5985ef['result']:'t';}else if(_[_0x0afd('0x46')](_0x5985ef[_0x0afd('0xa4')])){_0x5985ef['result']='#';_0x3d2fd7='#';}if(!this[_0x0afd('0x80')](_0x256fe6[_0x0afd('0xd0')])){this['channel'][_0x0afd('0xa1')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x513616=this[_0x0afd('0x15')][_0x0afd('0xb7')](this,_0x256fe6[_0x0afd('0xd0')]);if(!_0x513616){return this[_0x0afd('0x11')][_0x0afd('0x2e')](_0x256fe6,_0x0afd('0xd1'));}this['channel'][_0x0afd('0x98')](_0x513616,_0x3d2fd7);}this[_0x0afd('0x3a')]['sync'](this,_0x256fe6,_0x3d2fd7);return _0x5985ef;};AGIVertices['prototype'][_0x0afd('0xa1')]=function(_0x2b8a35){logger[_0x0afd('0x30')](util[_0x0afd('0x2b')](_0x0afd('0x160'),_0x2b8a35[_0x0afd('0x3c')]));return this[_0x0afd('0x11')][_0x0afd('0xa1')](_0x2b8a35[_0x0afd('0x161')]||_0x2b8a35[_0x0afd('0x3c')]);};AGIVertices[_0x0afd('0x14')][_0x0afd('0x162')]=function(_0x578a23){logger[_0x0afd('0x30')](util[_0x0afd('0x2b')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x578a23['label']));if(!this[_0x0afd('0x80')](_0x578a23[_0x0afd('0x150')])){return this[_0x0afd('0x11')][_0x0afd('0x2e')](_0x578a23,_0x0afd('0x151'));}logger[_0x0afd('0x30')](util[_0x0afd('0x2b')](_0x0afd('0x152'),this['channel'][_0x0afd('0x3f')],_0x578a23[_0x0afd('0x150')]));var _0x19e13d=this[_0x0afd('0x4d')][_0x0afd('0xb7')](this,_0x578a23[_0x0afd('0x163')]);var _0x469602=this[_0x0afd('0x4e')][_0x0afd('0xb7')](this,_0x578a23['findBy'],_0x19e13d);if(_0x469602){logger['info'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x0afd('0x11')][_0x0afd('0x3f')],_0x578a23[_0x0afd('0x150')]));this[_0x0afd('0x11')]['noop'](util[_0x0afd('0x2b')](_0x0afd('0x153'),this['channel'][_0x0afd('0x3f')],_0x578a23['findBy']));return{'code':0xc8,'result':_0x0afd('0x154')};}else{logger['info'](util[_0x0afd('0x2b')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x0afd('0x11')][_0x0afd('0x3f')],_0x578a23['findBy']));this['channel']['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x578a23[_0x0afd('0x150')]));return{'code':0xc8,'result':_0x0afd('0x156')};}};AGIVertices[_0x0afd('0x14')][_0x0afd('0x164')]=function(_0x10bfe2){logger[_0x0afd('0x30')](util[_0x0afd('0x2b')](_0x0afd('0x165'),_0x10bfe2['label']));if(!this[_0x0afd('0x80')](_0x10bfe2[_0x0afd('0x166')])){return this[_0x0afd('0x11')][_0x0afd('0x2e')](_0x10bfe2,_0x0afd('0x15d'));}var _0x4edb01=this[_0x0afd('0x20')][_0x0afd('0xb7')](this,_0x10bfe2[_0x0afd('0x166')]);if(!_0x4edb01){return this[_0x0afd('0x11')][_0x0afd('0x2e')](_0x10bfe2,'no\x20file\x20audio\x20found');}var _0x2b0b5f=this[_0x0afd('0x11')][_0x0afd('0x58')](_0x0afd('0x167'),[_0x4edb01,_0x10bfe2[_0x0afd('0xdd')]]);if(_0x2b0b5f[_0x0afd('0xa4')]===-0x1){return _0x2b0b5f;}return this[_0x0afd('0x11')][_0x0afd('0xa1')](util[_0x0afd('0x2b')](_0x0afd('0xbb'),_0x0afd('0x167'),_0x4edb01));};AGIVertices['prototype'][_0x0afd('0x168')]=function(_0x2c605c){logger[_0x0afd('0x30')](util[_0x0afd('0x2b')](_0x0afd('0x169'),_0x2c605c[_0x0afd('0x3c')]));if(!this[_0x0afd('0x80')](_0x2c605c[_0x0afd('0x16a')])){return this[_0x0afd('0x11')][_0x0afd('0x2e')](_0x2c605c,_0x0afd('0x16b'));}var _0x5100b9='';var _0x226ad6=parseInt(_0x2c605c['queue_id'],0xa);if(isNaN(_0x226ad6)){_0x5100b9=_0x2c605c[_0x0afd('0x16a')];}else{_0x5100b9=this[_0x0afd('0x16c')]['sync'](this,_0x2c605c[_0x0afd('0x16a')]);if(!_0x5100b9){return this[_0x0afd('0x11')][_0x0afd('0x2e')](_0x2c605c,'no\x20queue\x20found');}}var _0x2b698a='';if(this[_0x0afd('0x80')](_0x2c605c[_0x0afd('0x166')])){var _0xe14539=this[_0x0afd('0x20')][_0x0afd('0xb7')](this,_0x2c605c[_0x0afd('0x166')]);if(_0xe14539){_0x2b698a=_0xe14539;}}this['createSquareDetailsReport'][_0x0afd('0xb7')](this,_0x2c605c,_0x5100b9);if(_0x2c605c['opts'][_0x0afd('0x16d')]('x')<0x0){_0x2c605c['opts']+='x';}if(_0x2c605c['opts'][_0x0afd('0x16d')]('X')<0x0){_0x2c605c[_0x0afd('0xdd')]+='X';}this[_0x0afd('0x11')][_0x0afd('0x98')](_0x0afd('0x16e'),_0x5100b9?_0x5100b9['toLowerCase']():'');var _0x5d4855=this[_0x0afd('0x11')][_0x0afd('0x58')](_0x0afd('0x16f'),[_0x5100b9,_0x2c605c['opts'],_0x2c605c['url'],_0x2b698a,_0x2c605c[_0x0afd('0x65')],_0x2c605c[_0x0afd('0x170')],_0x2c605c[_0x0afd('0x171')],_0x2c605c['gosub'],'',_0x2c605c[_0x0afd('0x172')]]);if(_0x5d4855[_0x0afd('0xa4')]===-0x1){return _0x5d4855;}return this[_0x0afd('0x11')][_0x0afd('0xa1')](util['format'](_0x0afd('0xbb'),_0x0afd('0x16f'),_0x5100b9));};AGIVertices[_0x0afd('0x14')][_0x0afd('0x173')]=function(_0x5d0b67){logger[_0x0afd('0x30')](util[_0x0afd('0x2b')](_0x0afd('0x174'),_0x5d0b67['label']));var _0x4a72f8=_0x5d0b67[_0x0afd('0x175')]||_0x0afd('0x124');var _0x36bda5=util[_0x0afd('0x2b')](_0x0afd('0x176'),this['channel'][_0x0afd('0x3b')],rs[_0x0afd('0x110')](0x5));var _0x574941=util['format'](_0x0afd('0x177'),FILES_PATH,_0x36bda5,_0x4a72f8);var _0x5ae179=util[_0x0afd('0x2b')](_0x0afd('0x12f'),FILES_PATH,_0x36bda5);this[_0x0afd('0x40')][_0x0afd('0xb7')](this,_0x5d0b67,_0x36bda5,_0x574941);this[_0x0afd('0x11')][_0x0afd('0x98')](_0x0afd('0x178'),_0x36bda5);logger[_0x0afd('0x30')](_0x0afd('0x179'),_0x5ae179,_0x4a72f8,_0x5d0b67[_0x0afd('0x17a')],_0x5d0b67[_0x0afd('0x65')]);return this[_0x0afd('0x11')][_0x0afd('0x126')](_0x5ae179,_0x4a72f8,_0x5d0b67['escape_digits'],_0x5d0b67['timeout'],undefined,!![]);};AGIVertices[_0x0afd('0x14')][_0x0afd('0x17b')]=function(_0x4ba2be){logger[_0x0afd('0x30')](util[_0x0afd('0x2b')](_0x0afd('0x17c'),_0x4ba2be[_0x0afd('0x3c')]));if(!this[_0x0afd('0x80')](_0x4ba2be[_0x0afd('0x64')])){return this[_0x0afd('0x11')][_0x0afd('0xa1')](_0x0afd('0x17d'));}var _0x55175d=this[_0x0afd('0x17e')]['sync'](this,_0x4ba2be);logger[_0x0afd('0x30')](util[_0x0afd('0x2b')](_0x0afd('0x17f'),util[_0x0afd('0x180')](_0x55175d,{'showHidden':![],'depth':null})));if(!this[_0x0afd('0x80')](_0x4ba2be[_0x0afd('0xd0')])){return this['channel']['noop'](_0x0afd('0x181'));}var _0x4f4fec=this[_0x0afd('0x15')]['sync'](this,_0x4ba2be[_0x0afd('0xd0')]);if(!_0x4f4fec){return this[_0x0afd('0x11')][_0x0afd('0x2e')](_0x4ba2be,_0x0afd('0xd1'));}this[_0x0afd('0x11')]['setVariable'](util[_0x0afd('0x2b')]('%s_STATUS_CODE',_0x4f4fec),_0x55175d['statusCode']?_0x55175d['statusCode']:_0x0afd('0x182'));this['channel'][_0x0afd('0x98')](util['format'](_0x0afd('0x183'),_0x4f4fec),_0x55175d[_0x0afd('0x72')]?_0x55175d[_0x0afd('0x72')]:'OK');if(_0x55175d['body']){try{this[_0x0afd('0x96')](_0x55175d[_0x0afd('0x69')],_0x4f4fec);}catch(_0x4a1567){logger[_0x0afd('0x2e')](util[_0x0afd('0x2b')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x4f4fec));}}return this[_0x0afd('0x11')]['noop'](util[_0x0afd('0x2b')](_0x0afd('0x184'),_0x4f4fec));};AGIVertices[_0x0afd('0x14')][_0x0afd('0x185')]=function(_0x5df431){logger[_0x0afd('0x30')](util[_0x0afd('0x2b')](_0x0afd('0x186'),_0x5df431['label']));return this[_0x0afd('0x11')]['sayDigits'](_0x5df431[_0x0afd('0x187')][_0x0afd('0xcd')](/\s+/g,''),_0x5df431[_0x0afd('0x17a')]);};AGIVertices[_0x0afd('0x14')]['saynumber']=function(_0x1935e3){logger[_0x0afd('0x30')](util[_0x0afd('0x2b')](_0x0afd('0x188'),_0x1935e3[_0x0afd('0x3c')]));return this[_0x0afd('0x11')][_0x0afd('0x189')](_0x1935e3[_0x0afd('0x66')][_0x0afd('0xcd')](/\s+/g,''),_0x1935e3[_0x0afd('0x17a')]);};AGIVertices['prototype'][_0x0afd('0x18a')]=function(_0x1534b4){logger[_0x0afd('0x30')](util[_0x0afd('0x2b')](_0x0afd('0x18b'),_0x1534b4[_0x0afd('0x3c')]));return this[_0x0afd('0x11')][_0x0afd('0x18c')](_0x1534b4[_0x0afd('0x5d')],_0x1534b4[_0x0afd('0x17a')]);};AGIVertices[_0x0afd('0x14')]['sendMail']=function(_0x233e78){logger[_0x0afd('0x30')](util[_0x0afd('0x2b')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x233e78[_0x0afd('0x3c')]));if(!this['isConfigured'](_0x233e78['account_id'])){return this[_0x0afd('0x11')][_0x0afd('0xa1')](_0x0afd('0x18d'));}var _0x28c8dc=this[_0x0afd('0x23')]['sync'](this,_0x233e78[_0x0afd('0x18e')]);if(!_0x28c8dc||!_0x28c8dc[_0x0afd('0x18f')]){return this[_0x0afd('0x11')][_0x0afd('0x2e')](_0x233e78,'no\x20mail\x20account\x20found');}var _0x18adcc={'from':util[_0x0afd('0x2b')]('\x22%s\x22\x20<%s>',_0x28c8dc['name'],_0x28c8dc[_0x0afd('0x190')]||_0x28c8dc[_0x0afd('0x18f')][_0x0afd('0x191')]),'to':_0x233e78['to']||'','cc':_0x233e78['cc']||'','bcc':_0x233e78['bcc']||'','subject':_0x233e78[_0x0afd('0x192')],'html':_0x233e78[_0x0afd('0x5d')],'text':_0x233e78[_0x0afd('0x5d')]};var _0x447de6={'tls':{'rejectUnauthorized':![]}};if(_0x28c8dc['Smtp'][_0x0afd('0x193')]){_0x447de6[_0x0afd('0x193')]=_0x28c8dc[_0x0afd('0x18f')][_0x0afd('0x193')];}else{_0x447de6[_0x0afd('0x194')]=_0x28c8dc[_0x0afd('0x18f')]['host'];_0x447de6[_0x0afd('0x195')]=_0x28c8dc['Smtp'][_0x0afd('0x195')];_0x447de6[_0x0afd('0x196')]=_0x28c8dc[_0x0afd('0x18f')][_0x0afd('0x196')];}if(_0x28c8dc[_0x0afd('0x18f')][_0x0afd('0x197')]){_0x447de6[_0x0afd('0x198')]={'user':_0x28c8dc[_0x0afd('0x18f')][_0x0afd('0x191')],'pass':_0x28c8dc['Smtp']['pass']};}if(this[_0x0afd('0x80')](_0x233e78['template_id'])){}logger[_0x0afd('0xd7')](_0x0afd('0x199'),JSON['stringify'](_0x18adcc));this[_0x0afd('0x3a')][_0x0afd('0xb7')](this,_0x233e78,_0x233e78[_0x0afd('0x18e')]);this['channel'][_0x0afd('0xa1')](util['format'](_0x0afd('0x19a'),_0x28c8dc[_0x0afd('0x17')]));this[_0x0afd('0x25')][_0x0afd('0xb7')](this,_0x447de6,_0x18adcc);return this[_0x0afd('0x11')][_0x0afd('0xa1')](_0x0afd('0x19b'));};AGIVertices[_0x0afd('0x14')]['sendFax']=function(_0x46dc6e){logger['info'](util[_0x0afd('0x2b')](_0x0afd('0x19c'),_0x46dc6e[_0x0afd('0x3c')]));return this['channel']['noop'](_0x0afd('0x19d'));};AGIVertices[_0x0afd('0x14')]['sendSMS']=function(_0x5840d5){logger[_0x0afd('0x30')](util[_0x0afd('0x2b')](_0x0afd('0x19e'),_0x5840d5[_0x0afd('0x3c')]));if(!this[_0x0afd('0x80')](_0x5840d5[_0x0afd('0x19f')])){return this[_0x0afd('0x11')][_0x0afd('0xa1')](_0x0afd('0x1a0'));}var _0x157c97=this[_0x0afd('0x37')][_0x0afd('0xb7')](this,_0x5840d5[_0x0afd('0x19f')]);if(!_0x157c97){return this['channel'][_0x0afd('0x2e')](_0x5840d5,_0x0afd('0x1a1'));}var _0x158619={'body':_0x5840d5['sms_text'],'phone':_0x5840d5['to']||'','SmsAccountId':_0x157c97['id']};logger['debug'](_0x0afd('0x1a2'),JSON['stringify'](_0x158619));this['createSquareDetailsReport']['sync'](this,_0x5840d5,_0x5840d5[_0x0afd('0x19f')]);this[_0x0afd('0x11')][_0x0afd('0xa1')](util['format'](_0x0afd('0x1a3'),_0x157c97[_0x0afd('0x17')]));this['createSmsMessage'][_0x0afd('0xb7')](this,_0x158619);return this[_0x0afd('0x11')][_0x0afd('0xa1')](_0x0afd('0x1a4'));};AGIVertices[_0x0afd('0x14')]['set']=function(_0x147b03){logger[_0x0afd('0x30')](util[_0x0afd('0x2b')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x147b03['label']));if(!this[_0x0afd('0x80')](_0x147b03[_0x0afd('0xd0')])){return this[_0x0afd('0x11')][_0x0afd('0x2e')](_0x147b03,'no\x20variable\x20selected');}var _0x287123=this['getVariable'][_0x0afd('0xb7')](this,_0x147b03[_0x0afd('0xd0')]);if(!_0x287123){return this[_0x0afd('0x11')][_0x0afd('0x2e')](_0x147b03,_0x0afd('0xd1'));}return this[_0x0afd('0x11')][_0x0afd('0x98')](_0x287123,_0x147b03[_0x0afd('0x1a5')]);};AGIVertices[_0x0afd('0x14')][_0x0afd('0x1a6')]=function(_0x3e29c5){logger['info'](util[_0x0afd('0x2b')]('Enter\x20in\x20START\x20(%s)\x20block',_0x3e29c5[_0x0afd('0x3c')]));this[_0x0afd('0x11')][_0x0afd('0xa1')]('START\x20CALLY\x20SQUARE');if(_0x3e29c5[_0x0afd('0x1a7')]===_0x0afd('0x1a8')){this[_0x0afd('0x11')]['noop'](_0x0afd('0x1a9'));return this[_0x0afd('0x11')]['answer']();}return this[_0x0afd('0x11')][_0x0afd('0xa1')](_0x0afd('0x1aa'));};AGIVertices[_0x0afd('0x14')]['subproject']=function(_0x1bd432){logger['info'](util[_0x0afd('0x2b')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x1bd432[_0x0afd('0x3c')]));if(!this[_0x0afd('0x80')](_0x1bd432[_0x0afd('0x1ab')])){return this[_0x0afd('0x11')]['error'](_0x1bd432,'no\x20subproject\x20selected');}var _0x52685b=this[_0x0afd('0x1ac')][_0x0afd('0xb7')](this,_0x1bd432[_0x0afd('0x1ab')]);if(!this[_0x0afd('0x80')](_0x52685b)){return this[_0x0afd('0x11')]['error'](_0x1bd432,util[_0x0afd('0x2b')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x1bd432[_0x0afd('0x1ab')]));}if(_0x52685b===this['channel'][_0x0afd('0x3e')]){return this['channel'][_0x0afd('0x2e')](_0x1bd432,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this['createSquareDetailsReport']['sync'](this,_0x1bd432,_0x52685b);var _0x20095e=this[_0x0afd('0x11')][_0x0afd('0x58')](_0x0afd('0x1ad'),util[_0x0afd('0x2b')](_0x0afd('0x1ae'),config[_0x0afd('0x170')][_0x0afd('0x194')]||_0x0afd('0x1af'),_0x52685b,this[_0x0afd('0x11')]['arg_1']));if(_0x20095e[_0x0afd('0xa4')]===-0x1){return _0x20095e;}return this['channel'][_0x0afd('0xa1')](util[_0x0afd('0x2b')]('Executed\x20command\x20%s\x20%s',_0x0afd('0x1ad'),_0x52685b));};AGIVertices[_0x0afd('0x14')][_0x0afd('0x1b0')]=function(_0x5579a4){logger[_0x0afd('0x30')](util[_0x0afd('0x2b')](_0x0afd('0x1b1'),_0x5579a4[_0x0afd('0x3c')]));var _0x235a95=this[_0x0afd('0x57')]['sync'](this,_0x5579a4[_0x0afd('0xb0')]);this[_0x0afd('0x3a')]['sync'](this,_0x5579a4,_0x5579a4[_0x0afd('0xb0')]);if(this[_0x0afd('0x80')](_0x5579a4['variable_id'])){var _0x327d3a=this[_0x0afd('0x15')][_0x0afd('0xb7')](this,_0x5579a4[_0x0afd('0xd0')]);if(_0x327d3a){this[_0x0afd('0x11')]['setVariable'](_0x327d3a,_0x235a95);return this['channel'][_0x0afd('0xa1')](util[_0x0afd('0x2b')](_0x0afd('0x1b2'),_0x5579a4['command'],_0x327d3a));}}return this[_0x0afd('0x11')]['noop'](util[_0x0afd('0x2b')](_0x0afd('0x1b3'),_0x5579a4['command']));};AGIVertices[_0x0afd('0x14')][_0x0afd('0x1b4')]=function(_0x2ccbc8){logger[_0x0afd('0x30')](util[_0x0afd('0x2b')](_0x0afd('0x1b5'),_0x2ccbc8[_0x0afd('0x3c')]));_0x2ccbc8[_0x0afd('0x5d')]=_0x2ccbc8[_0x0afd('0x5d')][_0x0afd('0xcd')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x2ccbc8[_0x0afd('0x5b')])){return this[_0x0afd('0x11')][_0x0afd('0xa1')](_0x0afd('0x1b6'));}if(!this[_0x0afd('0x80')](_0x2ccbc8[_0x0afd('0x5d')])){return this[_0x0afd('0x11')]['noop'](_0x0afd('0xa2'));}this[_0x0afd('0x11')][_0x0afd('0xa1')](util[_0x0afd('0x2b')](_0x0afd('0x1b7'),_0x2ccbc8['text']));var _0xa58d4c=this[_0x0afd('0x5a')][_0x0afd('0xb7')](this,_0x2ccbc8);if(_0xa58d4c){this[_0x0afd('0x11')][_0x0afd('0xa1')](util[_0x0afd('0x2b')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0xa58d4c));var _0x32a38d=this[_0x0afd('0x11')][_0x0afd('0xfc')](_0xa58d4c);try{fs[_0x0afd('0xfd')](_0xa58d4c+'.wav');}catch(_0xdba118){logger[_0x0afd('0x2e')](_0xdba118);}return _0x32a38d;}return this[_0x0afd('0x11')]['error'](_0x2ccbc8,_0x0afd('0x1b8'));};AGIVertices['prototype'][_0x0afd('0x1b9')]=function(_0x1c574f){logger['info'](util[_0x0afd('0x2b')](_0x0afd('0x1ba'),_0x1c574f[_0x0afd('0x3c')]));_0x1c574f[_0x0afd('0x5d')]=_0x1c574f[_0x0afd('0x5d')][_0x0afd('0xcd')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x1c574f[_0x0afd('0x5d')])){return this[_0x0afd('0x11')]['noop']('no\x20text\x20configured');}this[_0x0afd('0x11')][_0x0afd('0xa1')](util['format'](_0x0afd('0x1bb'),_0x1c574f[_0x0afd('0x5d')]));var _0x586994=this[_0x0afd('0x62')]['sync'](this,_0x1c574f);if(_0x586994){this[_0x0afd('0x11')][_0x0afd('0xa1')](util[_0x0afd('0x2b')]('Google\x20TTS\x20%s\x20file\x20created',_0x586994));var _0x5627d7=this['channel'][_0x0afd('0xfc')](_0x586994);try{fs[_0x0afd('0xfd')](_0x586994+_0x0afd('0xfe'));}catch(_0xf12fc2){logger['error'](_0xf12fc2);}return _0x5627d7;}return this[_0x0afd('0x11')][_0x0afd('0x2e')](_0x1c574f,_0x0afd('0x1bc'));};AGIVertices['prototype']['unpause']=function(_0x201317){logger['info'](util['format'](_0x0afd('0x1bd'),_0x201317[_0x0afd('0x3c')]));if(!this['isConfigured'](_0x201317[_0x0afd('0x150')])){return this[_0x0afd('0x11')][_0x0afd('0x2e')](_0x201317,'no\x20find\x20by\x20configured');}logger['info'](util[_0x0afd('0x2b')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x0afd('0x11')]['callerid'],_0x201317[_0x0afd('0x150')]));var _0x3f5a12=this[_0x0afd('0x51')][_0x0afd('0xb7')](this,_0x201317['findBy']);if(_0x3f5a12){logger[_0x0afd('0x30')](util['format'](_0x0afd('0x153'),this[_0x0afd('0x11')][_0x0afd('0x3f')],_0x201317[_0x0afd('0x150')]));this[_0x0afd('0x11')][_0x0afd('0xa1')](util[_0x0afd('0x2b')](_0x0afd('0x153'),this[_0x0afd('0x11')]['callerid'],_0x201317[_0x0afd('0x150')]));return{'code':0xc8,'result':'success'};}else{logger[_0x0afd('0x30')](util[_0x0afd('0x2b')](_0x0afd('0x155'),this[_0x0afd('0x11')]['callerid'],_0x201317['findBy']));this[_0x0afd('0x11')][_0x0afd('0xa1')](util[_0x0afd('0x2b')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x0afd('0x11')][_0x0afd('0x3f')],_0x201317[_0x0afd('0x150')]));return{'code':0xc8,'result':_0x0afd('0x156')};}};AGIVertices['prototype']['voicemail']=function(_0x46d68e){logger['info'](util[_0x0afd('0x2b')](_0x0afd('0x1be'),_0x46d68e[_0x0afd('0x3c')]));var _0xc1b34d=this[_0x0afd('0x11')][_0x0afd('0x58')](_0x0afd('0x1bf'),[_0x46d68e[_0x0afd('0x1c0')],_0x46d68e[_0x0afd('0x74')]]);if(_0xc1b34d[_0x0afd('0xa4')]===-0x1){return _0xc1b34d;}return this[_0x0afd('0x11')][_0x0afd('0xa1')](util['format'](_0x0afd('0xbb'),_0x0afd('0x1bf'),_0x46d68e[_0x0afd('0x1c0')]));};AGIVertices[_0x0afd('0x14')][_0x0afd('0x1c1')]=function(_0x356f34){logger['info'](util[_0x0afd('0x2b')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x356f34[_0x0afd('0x3c')]));if(!this['isConfigured'](_0x356f34['variable_id'])){return this['channel'][_0x0afd('0x2e')](_0x356f34,_0x0afd('0x1c2'));}var _0x22967f=this['getVariable'][_0x0afd('0xb7')](this,_0x356f34['variable_id']);if(!_0x22967f){return this[_0x0afd('0x11')][_0x0afd('0x2e')](_0x356f34,_0x0afd('0xd1'));}var _0x25e943=this[_0x0afd('0x11')][_0x0afd('0x15')](_0x22967f);return{'code':0xc8,'result':_0x25e943[_0x0afd('0x9a')]?_0x25e943[_0x0afd('0x9a')]:'-'};};String[_0x0afd('0x14')]['replaceAll']=function(_0x1b8580,_0x9e14d){return this[_0x0afd('0x1c3')](_0x1b8580)['join'](_0x9e14d);};module[_0x0afd('0x1c4')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 41bf4d7..c871f12 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 _0x09d8=['attended','destlinkedid','acwTimeout','timer','stopAcw','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','lastPauseAt','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','message','[%s][TIMER][STOP][AGENT:%s]','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','syncBlindTransfer','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','util','lodash','moment','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','agentringnoanswer','syncAttendedTransfer','blindtransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]'];(function(_0x1e0ca5,_0x57fd4f){var _0x410923=function(_0x5bd94d){while(--_0x5bd94d){_0x1e0ca5['push'](_0x1e0ca5['shift']());}};_0x410923(++_0x57fd4f);}(_0x09d8,0x1d2));var _0x809d=function(_0x411090,_0x819927){_0x411090=_0x411090-0x0;var _0x3339f0=_0x09d8[_0x411090];return _0x3339f0;};'use strict';var util=require(_0x809d('0x0'));var _=require(_0x809d('0x1'));var moment=require(_0x809d('0x2'));var ami=require('../ami');var logger=require(_0x809d('0x3'))(_0x809d('0x4'));var RpcUser=require(_0x809d('0x5'));var RpcVoiceAgentReport=require(_0x809d('0x6'));function Acw(_0x1212fa){this[_0x809d('0x7')]=_0x1212fa[_0x809d('0x7')];this[_0x809d('0x8')]=_0x1212fa['agents'];this[_0x809d('0x9')]=_0x1212fa[_0x809d('0x9')];this[_0x809d('0xa')]={};ami['on'](_0x809d('0xb'),this[_0x809d('0xc')][_0x809d('0xd')](this));ami['on'](_0x809d('0xe'),this[_0x809d('0xf')]['bind'](this));ami['on'](_0x809d('0x10'),this['syncHangup'][_0x809d('0xd')](this));ami['on'](_0x809d('0x11'),this['syncAgentRingNoAnswer']['bind'](this));ami['on']('attendedtransfer',this[_0x809d('0x12')][_0x809d('0xd')](this));ami['on'](_0x809d('0x13'),this['syncBlindTransfer'][_0x809d('0xd')](this));ami['on'](_0x809d('0x14'),this[_0x809d('0x15')][_0x809d('0xd')](this));}function getDiff(_0x4e1b19){var _0x23fabe=moment()[_0x809d('0x16')](0x0);var _0x5e3912=moment(_0x4e1b19)[_0x809d('0x16')](0x0);return _0x23fabe[_0x809d('0x17')](_0x5e3912,_0x809d('0x18'));}Acw[_0x809d('0x19')][_0x809d('0x1a')]=function(_0x111123){try{var _0x16b17e=this;var _0x1142aa=this[_0x809d('0xa')][_0x111123][_0x809d('0x1b')];var _0x5ea257=this[_0x809d('0xa')][_0x111123]['queue'];var _0x5adf06=this[_0x809d('0x7')][_0x5ea257];var _0xefc455=![];var _0x2eb542=_0x809d('0x1c');if(_0x5adf06[_0x809d('0x1d')]){if(_0x5adf06[_0x809d('0x1e')][_0x809d('0x1f')]){_0xefc455=!![];_0x2eb542=_0x5adf06[_0x809d('0x1e')][_0x809d('0x1f')];}}ami[_0x809d('0x20')]({'action':'QueuePause','interface':_0x1142aa,'paused':!![],'reason':_0x2eb542})[_0x809d('0x21')](function(_0x5a6b3e){if(_0x16b17e[_0x809d('0x8')][_0x1142aa]){return RpcUser[_0x809d('0x22')](_0x16b17e[_0x809d('0x8')][_0x1142aa]['id'])['then'](function(_0x2bac47){if(_0x2bac47&&!_0x2bac47[_0x809d('0x23')]){logger[_0x809d('0x24')](_0x809d('0x25'),_0x111123,_0x1142aa,_0x5ea257);var _0x5d3836=_0x16b17e[_0x809d('0xa')][_0x111123][_0x809d('0x26')]&&_0x16b17e[_0x809d('0xa')][_0x111123][_0x809d('0x27')]?_0x16b17e[_0x809d('0xa')][_0x111123][_0x809d('0x27')]:_0x111123;return RpcUser['savePause'](_0x16b17e['agents'][_0x1142aa],_0x2eb542,_0x5d3836)[_0x809d('0x21')](function(_0x185f8a){if(!_0xefc455){_0x16b17e[_0x809d('0x9')][_0x1142aa]={};logger['info']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x111123,_0x16b17e[_0x809d('0x7')][_0x5ea257][_0x809d('0x28')],_0x1142aa,_0x5ea257);_0x16b17e['timers'][_0x1142aa][_0x809d('0x29')]=setTimeout(_0x16b17e[_0x809d('0x2a')]['bind'](_0x16b17e,_0x1142aa),_0x16b17e[_0x809d('0x7')][_0x5ea257][_0x809d('0x28')]*0x3e8);_0x16b17e['timers'][_0x1142aa]['lastPauseAt']=moment()['format'](_0x809d('0x2b'));_0x16b17e['timers'][_0x1142aa][_0x809d('0x2c')]=_0x111123;_0x16b17e[_0x809d('0x9')][_0x1142aa][_0x809d('0x2d')]=_0x5ea257;_0x16b17e[_0x809d('0x9')][_0x1142aa]['updateAcw']=function(){var _0x3722e0=getDiff(_0x16b17e['timers'][_0x1142aa][_0x809d('0x2e')]);clearTimeout(_0x16b17e['timers'][_0x1142aa][_0x809d('0x29')]);_0x16b17e[_0x809d('0x9')][_0x1142aa][_0x809d('0x29')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x3722e0},_0x16b17e[_0x809d('0x9')][_0x1142aa][_0x809d('0x2c')],_0x1142aa)[_0x809d('0x21')](function(_0xae7d91){logger[_0x809d('0x24')](_0x809d('0x2f'),_0x111123,_0x3722e0,_0xae7d91);})[_0x809d('0x30')](function(_0x3b2680){logger[_0x809d('0x31')](_0x809d('0x32'),_0x111123,_0x3b2680);});delete _0x16b17e[_0x809d('0x9')][_0x1142aa];};}});}else{logger[_0x809d('0x24')](_0x809d('0x33'),_0x111123,_0x1142aa,_0x5ea257);}});}})['catch'](function(_0x1d9666){logger[_0x809d('0x31')](_0x809d('0x34'),_0x111123,_0x16b17e[_0x809d('0x7')][_0x5ea257]['acwTimeout'],_0x1142aa,_0x5ea257);})[_0x809d('0x35')](function(){delete _0x16b17e[_0x809d('0xa')][_0x111123];});}catch(_0x2fbf79){logger['error']('[ACW][START]\x20%s',_0x2fbf79[_0x809d('0x36')]);}};Acw[_0x809d('0x19')][_0x809d('0x2a')]=function(_0xf02eaf){try{var _0x395764=this;if(_0x395764[_0x809d('0x9')][_0xf02eaf]){_0x395764[_0x809d('0x9')][_0xf02eaf][_0x809d('0x29')]=![];var _0x40a230=_0x395764[_0x809d('0x9')][_0xf02eaf][_0x809d('0x2c')];var _0x417d16=_0x395764['timers'][_0xf02eaf][_0x809d('0x2d')];var _0x664fb4=_0x395764[_0x809d('0x7')][_0x417d16]['acwTimeout'];logger['info'](_0x809d('0x37'),_0x40a230,_0xf02eaf);RpcUser['saveUnpause'](this[_0x809d('0x8')][_0xf02eaf]);RpcVoiceAgentReport[_0x809d('0x38')]({'acwtime':_0x664fb4,'agentacw':!![]},_0x40a230,_0xf02eaf)[_0x809d('0x21')](function(_0x24079a){logger[_0x809d('0x24')](_0x809d('0x2f'),_0x40a230,_0x664fb4,_0x24079a);})[_0x809d('0x30')](function(_0x5cb0df){logger[_0x809d('0x31')](_0x809d('0x32'),_0x40a230,_0x5cb0df);});}else{logger[_0x809d('0x31')](_0x809d('0x39'),_0xf02eaf);if(_0x395764[_0x809d('0x9')]){logger[_0x809d('0x24')](_0x809d('0x3a'),JSON[_0x809d('0x3b')](_0x395764['timers']));}}}catch(_0x375b8e){logger[_0x809d('0x31')](_0x809d('0x3c'),_0x375b8e[_0x809d('0x36')]);}};Acw[_0x809d('0x19')][_0x809d('0xc')]=function(_0x3f2f28){try{if(this[_0x809d('0x7')][_0x3f2f28[_0x809d('0x2d')]]&&(this['voiceQueues'][_0x3f2f28[_0x809d('0x2d')]][_0x809d('0x4')]||this['voiceQueues'][_0x3f2f28['queue']][_0x809d('0x1d')])){if(this[_0x809d('0x8')][_0x3f2f28[_0x809d('0x1b')]]){this[_0x809d('0xa')][_0x3f2f28['uniqueid']]={'queue':_0x3f2f28['queue'],'interface':_0x3f2f28[_0x809d('0x1b')],'destlinkedid':_0x3f2f28[_0x809d('0x27')]};}}}catch(_0x5ac1ba){logger['error'](_0x809d('0x3d'),_0x5ac1ba[_0x809d('0x36')]);}};Acw[_0x809d('0x19')][_0x809d('0x15')]=function(_0x312811){try{if(this[_0x809d('0x7')][_0x312811['queue']]&&(this[_0x809d('0x7')][_0x312811[_0x809d('0x2d')]][_0x809d('0x4')]||this[_0x809d('0x7')][_0x312811['queue']][_0x809d('0x1d')])){if(this[_0x809d('0x8')][_0x312811[_0x809d('0x1b')]]){this[_0x809d('0xa')][_0x312811[_0x809d('0x2c')]]={'queue':_0x312811[_0x809d('0x2d')],'interface':_0x312811[_0x809d('0x1b')]};}}}catch(_0x1f9f63){logger['error']('[ACW][syncAgentConnectPreview]\x20%s',_0x1f9f63['message']);}};Acw[_0x809d('0x19')]['syncHangupRequest']=function(_0x1c2315){try{if(this['channels'][_0x1c2315['uniqueid']]&&_[_0x809d('0x3e')](this[_0x809d('0xa')][_0x1c2315[_0x809d('0x2c')]][_0x809d('0x26')])){logger['info'](_0x809d('0x3f'),_0x1c2315[_0x809d('0x2c')]);this['startAcw'](_0x1c2315['uniqueid']);}else if(this[_0x809d('0xa')][_0x1c2315[_0x809d('0x40')]]&&_[_0x809d('0x3e')](this[_0x809d('0xa')][_0x1c2315['linkedid']][_0x809d('0x26')])){logger[_0x809d('0x24')](_0x809d('0x41'),_0x1c2315['linkedid']);this['startAcw'](_0x1c2315[_0x809d('0x40')]);}}catch(_0xba4383){logger[_0x809d('0x31')](_0x809d('0x42'),_0xba4383[_0x809d('0x36')]);}};Acw[_0x809d('0x19')]['syncHangup']=function(_0x53d6bc){try{if(this[_0x809d('0xa')][_0x53d6bc['uniqueid']]&&this[_0x809d('0xa')][_0x53d6bc['uniqueid']][_0x809d('0x26')]){logger[_0x809d('0x24')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x53d6bc[_0x809d('0x2c')]);this[_0x809d('0x1a')](_0x53d6bc[_0x809d('0x2c')]);}else if(this[_0x809d('0xa')][_0x53d6bc[_0x809d('0x40')]]&&this['channels'][_0x53d6bc[_0x809d('0x40')]]['attended']){logger[_0x809d('0x24')](_0x809d('0x43'),_0x53d6bc[_0x809d('0x40')]);this[_0x809d('0x1a')](_0x53d6bc[_0x809d('0x40')]);}}catch(_0x54aa6f){logger[_0x809d('0x31')](_0x809d('0x44'),_0x54aa6f[_0x809d('0x36')]);}};Acw[_0x809d('0x19')]['syncAttendedTransfer']=function(_0x1a9f73){try{if(!_[_0x809d('0x45')](this[_0x809d('0xa')][_0x1a9f73[_0x809d('0x46')]])){this[_0x809d('0x1a')](_0x1a9f73['transfereeuniqueid']);if(this[_0x809d('0xa')][_0x1a9f73['secondtransfereruniqueid']]){this[_0x809d('0xa')][_0x1a9f73[_0x809d('0x47')]]['attended']=!![];this[_0x809d('0xa')][_0x1a9f73[_0x809d('0x48')]]=this['channels'][_0x1a9f73[_0x809d('0x47')]];delete this['channels'][_0x1a9f73['secondtransfereruniqueid']];}}else if(!_['isNil'](this[_0x809d('0xa')][_0x1a9f73[_0x809d('0x48')]])){this[_0x809d('0x1a')](_0x1a9f73[_0x809d('0x48')]);if(this[_0x809d('0xa')][_0x1a9f73[_0x809d('0x49')]]){this[_0x809d('0xa')][_0x1a9f73[_0x809d('0x49')]][_0x809d('0x26')]=!![];this[_0x809d('0xa')][_0x1a9f73['transfereeuniqueid']]=this[_0x809d('0xa')][_0x1a9f73[_0x809d('0x49')]];delete this[_0x809d('0xa')][_0x1a9f73['origtransfereruniqueid']];}}}catch(_0x2d38a9){logger[_0x809d('0x31')](_0x809d('0x4a'),_0x2d38a9[_0x809d('0x36')]);}};Acw[_0x809d('0x19')][_0x809d('0x4b')]=function(_0xd8bf3c){try{if(this[_0x809d('0xa')][_0xd8bf3c['transfereruniqueid']]){logger[_0x809d('0x24')](_0x809d('0x4c'),JSON[_0x809d('0x3b')](_0xd8bf3c[_0x809d('0x4d')]));this['startAcw'](_0xd8bf3c[_0x809d('0x4d')]);}else if(this[_0x809d('0xa')][_0xd8bf3c['transfererlinkedid']]){logger[_0x809d('0x24')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x809d('0x3b')](_0xd8bf3c[_0x809d('0x4e')]));this['startAcw'](_0xd8bf3c['transfererlinkedid']);}}catch(_0x434330){logger[_0x809d('0x31')](_0x809d('0x4f'),_0x434330['message']);}};Acw[_0x809d('0x19')][_0x809d('0x50')]=function(_0x433c0f){try{if(this[_0x809d('0x7')][_0x433c0f[_0x809d('0x2d')]]&&this[_0x809d('0x7')][_0x433c0f['queue']][_0x809d('0x51')]==='all'){if(this['agents'][_0x433c0f['interface']]){logger['info'](_0x809d('0x52'),_0x433c0f[_0x809d('0x2c')],_0x433c0f[_0x809d('0x1b')],_0x433c0f[_0x809d('0x2d')]);return RpcUser['savePause'](this[_0x809d('0x8')][_0x433c0f[_0x809d('0x1b')]],_0x809d('0x53'),_0x433c0f['uniqueid']);}}}catch(_0x332bee){logger[_0x809d('0x31')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x332bee['message']);}};module['exports']=Acw; \ No newline at end of file +var _0x33f5=['[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','syncAgentConnect','[ACW][syncAgentConnect]\x20%s','syncHangupRequest','[%s][HANGUP:UNIQUEID]','linkedid','isUndefined','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','syncBlindTransfer','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','hanguprequest','bind','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','ACW','mandatoryDisposition','name','Action','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','queue','uniqueid'];(function(_0x487427,_0x50e508){var _0x2b6f48=function(_0x3eb061){while(--_0x3eb061){_0x487427['push'](_0x487427['shift']());}};_0x2b6f48(++_0x50e508);}(_0x33f5,0x1f1));var _0x533f=function(_0x3d7672,_0x4f2dc0){_0x3d7672=_0x3d7672-0x0;var _0x59f62d=_0x33f5[_0x3d7672];return _0x59f62d;};'use strict';var util=require(_0x533f('0x0'));var _=require(_0x533f('0x1'));var moment=require(_0x533f('0x2'));var ami=require(_0x533f('0x3'));var logger=require(_0x533f('0x4'))(_0x533f('0x5'));var RpcUser=require(_0x533f('0x6'));var RpcVoiceAgentReport=require(_0x533f('0x7'));function Acw(_0x25e216){this[_0x533f('0x8')]=_0x25e216[_0x533f('0x8')];this[_0x533f('0x9')]=_0x25e216[_0x533f('0x9')];this[_0x533f('0xa')]=_0x25e216[_0x533f('0xa')];this[_0x533f('0xb')]={};ami['on']('agentconnect',this['syncAgentConnect']['bind'](this));ami['on'](_0x533f('0xc'),this['syncHangupRequest'][_0x533f('0xd')](this));ami['on']('hangup',this[_0x533f('0xe')][_0x533f('0xd')](this));ami['on'](_0x533f('0xf'),this[_0x533f('0x10')][_0x533f('0xd')](this));ami['on'](_0x533f('0x11'),this[_0x533f('0x12')]['bind'](this));ami['on'](_0x533f('0x13'),this['syncBlindTransfer'][_0x533f('0xd')](this));ami['on'](_0x533f('0x14'),this[_0x533f('0x15')][_0x533f('0xd')](this));}function getDiff(_0x439e11){var _0x514767=moment()['milliseconds'](0x0);var _0x2f484e=moment(_0x439e11)[_0x533f('0x16')](0x0);return _0x514767[_0x533f('0x17')](_0x2f484e,_0x533f('0x18'));}Acw[_0x533f('0x19')][_0x533f('0x1a')]=function(_0x441bb3){try{var _0xf2e441=this;var _0x43c719=this['channels'][_0x441bb3][_0x533f('0x1b')];var _0x5e889d=this[_0x533f('0xb')][_0x441bb3]['queue'];var _0xc7eaf3=this[_0x533f('0x8')][_0x5e889d];var _0x40ae11=![];var _0x17e8dc=_0x533f('0x1c');if(_0xc7eaf3[_0x533f('0x1d')]){if(_0xc7eaf3['mandatoryDispositionPause'][_0x533f('0x1e')]){_0x40ae11=!![];_0x17e8dc=_0xc7eaf3['mandatoryDispositionPause']['name'];}}ami[_0x533f('0x1f')]({'action':_0x533f('0x20'),'interface':_0x43c719,'paused':!![],'reason':_0x17e8dc})[_0x533f('0x21')](function(_0x1aa596){if(_0xf2e441['agents'][_0x43c719]){return RpcUser[_0x533f('0x22')](_0xf2e441[_0x533f('0x9')][_0x43c719]['id'])['then'](function(_0x142eda){if(_0x142eda&&!_0x142eda[_0x533f('0x23')]){logger[_0x533f('0x24')](_0x533f('0x25'),_0x441bb3,_0x43c719,_0x5e889d);var _0x31089d=_0xf2e441[_0x533f('0xb')][_0x441bb3][_0x533f('0x26')]&&_0xf2e441[_0x533f('0xb')][_0x441bb3][_0x533f('0x27')]?_0xf2e441['channels'][_0x441bb3]['destlinkedid']:_0x441bb3;return RpcUser['savePause'](_0xf2e441[_0x533f('0x9')][_0x43c719],_0x17e8dc,_0x31089d)[_0x533f('0x21')](function(_0x2b10f0){if(!_0x40ae11){_0xf2e441['timers'][_0x43c719]={};logger['info'](_0x533f('0x28'),_0x441bb3,_0xf2e441['voiceQueues'][_0x5e889d][_0x533f('0x29')],_0x43c719,_0x5e889d);_0xf2e441[_0x533f('0xa')][_0x43c719][_0x533f('0x2a')]=setTimeout(_0xf2e441[_0x533f('0x2b')][_0x533f('0xd')](_0xf2e441,_0x43c719),_0xf2e441['voiceQueues'][_0x5e889d][_0x533f('0x29')]*0x3e8);_0xf2e441[_0x533f('0xa')][_0x43c719][_0x533f('0x2c')]=moment()[_0x533f('0x2d')](_0x533f('0x2e'));_0xf2e441['timers'][_0x43c719]['uniqueid']=_0x441bb3;_0xf2e441[_0x533f('0xa')][_0x43c719][_0x533f('0x2f')]=_0x5e889d;_0xf2e441[_0x533f('0xa')][_0x43c719]['updateAcw']=function(){var _0x1cc0d9=getDiff(_0xf2e441[_0x533f('0xa')][_0x43c719][_0x533f('0x2c')]);clearTimeout(_0xf2e441[_0x533f('0xa')][_0x43c719][_0x533f('0x2a')]);_0xf2e441[_0x533f('0xa')][_0x43c719][_0x533f('0x2a')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x1cc0d9},_0xf2e441[_0x533f('0xa')][_0x43c719][_0x533f('0x30')],_0x43c719)[_0x533f('0x21')](function(_0xbeae7f){logger[_0x533f('0x24')](_0x533f('0x31'),_0x441bb3,_0x1cc0d9,_0xbeae7f);})[_0x533f('0x32')](function(_0x38c47f){logger[_0x533f('0x33')](_0x533f('0x34'),_0x441bb3,_0x38c47f);});delete _0xf2e441[_0x533f('0xa')][_0x43c719];};}});}else{logger[_0x533f('0x24')](_0x533f('0x35'),_0x441bb3,_0x43c719,_0x5e889d);}});}})[_0x533f('0x32')](function(_0x2cc7ca){logger['error']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x441bb3,_0xf2e441['voiceQueues'][_0x5e889d][_0x533f('0x29')],_0x43c719,_0x5e889d);})[_0x533f('0x36')](function(){delete _0xf2e441['channels'][_0x441bb3];});}catch(_0x77ad3f){logger[_0x533f('0x33')]('[ACW][START]\x20%s',_0x77ad3f[_0x533f('0x37')]);}};Acw[_0x533f('0x19')]['stopAcw']=function(_0x1d5107){try{var _0x31951b=this;if(_0x31951b[_0x533f('0xa')][_0x1d5107]){_0x31951b[_0x533f('0xa')][_0x1d5107][_0x533f('0x2a')]=![];var _0x5834a3=_0x31951b[_0x533f('0xa')][_0x1d5107][_0x533f('0x30')];var _0x2f44d8=_0x31951b[_0x533f('0xa')][_0x1d5107][_0x533f('0x2f')];var _0x3e120d=_0x31951b[_0x533f('0x8')][_0x2f44d8]['acwTimeout'];logger[_0x533f('0x24')](_0x533f('0x38'),_0x5834a3,_0x1d5107);RpcUser[_0x533f('0x39')](this['agents'][_0x1d5107]);RpcVoiceAgentReport['update']({'acwtime':_0x3e120d,'agentacw':!![]},_0x5834a3,_0x1d5107)['then'](function(_0x37f1a1){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0x5834a3,_0x3e120d,_0x37f1a1);})['catch'](function(_0xdb45c9){logger[_0x533f('0x33')](_0x533f('0x34'),_0x5834a3,_0xdb45c9);});}else{logger[_0x533f('0x33')](_0x533f('0x3a'),_0x1d5107);if(_0x31951b[_0x533f('0xa')]){logger[_0x533f('0x24')](_0x533f('0x3b'),JSON[_0x533f('0x3c')](_0x31951b[_0x533f('0xa')]));}}}catch(_0x3cc66c){logger['error'](_0x533f('0x3d'),_0x3cc66c[_0x533f('0x37')]);}};Acw[_0x533f('0x19')][_0x533f('0x3e')]=function(_0x3256e3){try{if(this[_0x533f('0x8')][_0x3256e3[_0x533f('0x2f')]]&&(this[_0x533f('0x8')][_0x3256e3[_0x533f('0x2f')]][_0x533f('0x5')]||this['voiceQueues'][_0x3256e3[_0x533f('0x2f')]][_0x533f('0x1d')])){if(this[_0x533f('0x9')][_0x3256e3[_0x533f('0x1b')]]){this[_0x533f('0xb')][_0x3256e3['uniqueid']]={'queue':_0x3256e3['queue'],'interface':_0x3256e3[_0x533f('0x1b')],'destlinkedid':_0x3256e3[_0x533f('0x27')]};}}}catch(_0x525cb5){logger[_0x533f('0x33')](_0x533f('0x3f'),_0x525cb5[_0x533f('0x37')]);}};Acw[_0x533f('0x19')]['syncAgentConnectPreview']=function(_0x1ad955){try{if(this[_0x533f('0x8')][_0x1ad955[_0x533f('0x2f')]]&&(this[_0x533f('0x8')][_0x1ad955['queue']][_0x533f('0x5')]||this[_0x533f('0x8')][_0x1ad955[_0x533f('0x2f')]][_0x533f('0x1d')])){if(this['agents'][_0x1ad955['interface']]){this[_0x533f('0xb')][_0x1ad955['uniqueid']]={'queue':_0x1ad955[_0x533f('0x2f')],'interface':_0x1ad955[_0x533f('0x1b')]};}}}catch(_0x5dec22){logger[_0x533f('0x33')]('[ACW][syncAgentConnectPreview]\x20%s',_0x5dec22[_0x533f('0x37')]);}};Acw[_0x533f('0x19')][_0x533f('0x40')]=function(_0x5c9193){try{if(this[_0x533f('0xb')][_0x5c9193[_0x533f('0x30')]]&&_['isUndefined'](this['channels'][_0x5c9193[_0x533f('0x30')]][_0x533f('0x26')])){logger[_0x533f('0x24')](_0x533f('0x41'),_0x5c9193[_0x533f('0x30')]);this['startAcw'](_0x5c9193[_0x533f('0x30')]);}else if(this['channels'][_0x5c9193[_0x533f('0x42')]]&&_[_0x533f('0x43')](this[_0x533f('0xb')][_0x5c9193[_0x533f('0x42')]][_0x533f('0x26')])){logger[_0x533f('0x24')](_0x533f('0x44'),_0x5c9193[_0x533f('0x42')]);this['startAcw'](_0x5c9193[_0x533f('0x42')]);}}catch(_0x868787){logger['error'](_0x533f('0x45'),_0x868787['message']);}};Acw[_0x533f('0x19')]['syncHangup']=function(_0x170057){try{if(this['channels'][_0x170057['uniqueid']]&&this[_0x533f('0xb')][_0x170057['uniqueid']]['attended']){logger[_0x533f('0x24')](_0x533f('0x46'),_0x170057[_0x533f('0x30')]);this[_0x533f('0x1a')](_0x170057[_0x533f('0x30')]);}else if(this[_0x533f('0xb')][_0x170057[_0x533f('0x42')]]&&this['channels'][_0x170057[_0x533f('0x42')]][_0x533f('0x26')]){logger[_0x533f('0x24')](_0x533f('0x47'),_0x170057['linkedid']);this[_0x533f('0x1a')](_0x170057[_0x533f('0x42')]);}}catch(_0x6d5e88){logger['error'](_0x533f('0x48'),_0x6d5e88[_0x533f('0x37')]);}};Acw[_0x533f('0x19')][_0x533f('0x12')]=function(_0x30d27a){try{if(!_[_0x533f('0x49')](this['channels'][_0x30d27a[_0x533f('0x4a')]])){this[_0x533f('0x1a')](_0x30d27a[_0x533f('0x4a')]);if(this[_0x533f('0xb')][_0x30d27a[_0x533f('0x4b')]]){this[_0x533f('0xb')][_0x30d27a[_0x533f('0x4b')]][_0x533f('0x26')]=!![];this['channels'][_0x30d27a[_0x533f('0x4c')]]=this[_0x533f('0xb')][_0x30d27a[_0x533f('0x4b')]];delete this[_0x533f('0xb')][_0x30d27a[_0x533f('0x4b')]];}}else if(!_[_0x533f('0x49')](this[_0x533f('0xb')][_0x30d27a['transfertargetuniqueid']])){this[_0x533f('0x1a')](_0x30d27a[_0x533f('0x4c')]);if(this[_0x533f('0xb')][_0x30d27a['origtransfereruniqueid']]){this[_0x533f('0xb')][_0x30d27a[_0x533f('0x4d')]][_0x533f('0x26')]=!![];this[_0x533f('0xb')][_0x30d27a[_0x533f('0x4a')]]=this['channels'][_0x30d27a[_0x533f('0x4d')]];delete this[_0x533f('0xb')][_0x30d27a[_0x533f('0x4d')]];}}}catch(_0x279259){logger[_0x533f('0x33')](_0x533f('0x4e'),_0x279259[_0x533f('0x37')]);}};Acw[_0x533f('0x19')][_0x533f('0x4f')]=function(_0x3405f6){try{if(this[_0x533f('0xb')][_0x3405f6[_0x533f('0x50')]]){logger[_0x533f('0x24')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON['stringify'](_0x3405f6[_0x533f('0x50')]));this[_0x533f('0x1a')](_0x3405f6[_0x533f('0x50')]);}else if(this[_0x533f('0xb')][_0x3405f6[_0x533f('0x51')]]){logger['info'](_0x533f('0x52'),JSON[_0x533f('0x3c')](_0x3405f6[_0x533f('0x51')]));this[_0x533f('0x1a')](_0x3405f6[_0x533f('0x51')]);}}catch(_0x4cce9a){logger[_0x533f('0x33')](_0x533f('0x53'),_0x4cce9a[_0x533f('0x37')]);}};Acw[_0x533f('0x19')]['syncAgentRingNoAnswer']=function(_0x5d3c39){try{if(this[_0x533f('0x8')][_0x5d3c39[_0x533f('0x2f')]]&&this['voiceQueues'][_0x5d3c39[_0x533f('0x2f')]][_0x533f('0x54')]===_0x533f('0x55')){if(this[_0x533f('0x9')][_0x5d3c39[_0x533f('0x1b')]]){logger['info'](_0x533f('0x56'),_0x5d3c39[_0x533f('0x30')],_0x5d3c39['interface'],_0x5d3c39[_0x533f('0x2f')]);return RpcUser[_0x533f('0x57')](this[_0x533f('0x9')][_0x5d3c39[_0x533f('0x1b')]],_0x533f('0x58'),_0x5d3c39[_0x533f('0x30')]);}}}catch(_0x32307b){logger[_0x533f('0x33')](_0x533f('0x59'),_0x32307b[_0x533f('0x37')]);}};module[_0x533f('0x5a')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 97f5539..7f01c53 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 _0xaf53=['Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect','info','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','catch','exports','util','lodash','../../config/logger','../../config/environment','asterisk','port','username','password','keepConnected','Action','action','format'];(function(_0x3db05c,_0x2be283){var _0x3243e5=function(_0x576ff8){while(--_0x576ff8){_0x3db05c['push'](_0x3db05c['shift']());}};_0x3243e5(++_0x2be283);}(_0xaf53,0x18c));var _0x3af5=function(_0xe0b7b2,_0x4cda8c){_0xe0b7b2=_0xe0b7b2-0x0;var _0x4a84d6=_0xaf53[_0xe0b7b2];return _0x4a84d6;};'use strict';var Manager=require('asterisk-manager');var BPromise=require('bluebird');var moment=require('moment');var util=require(_0x3af5('0x0'));var _=require(_0x3af5('0x1'));var logger=require(_0x3af5('0x2'))('ami');var config=require(_0x3af5('0x3'));var ami=new Manager(config[_0x3af5('0x4')][_0x3af5('0x5')],config[_0x3af5('0x4')]['ip'],config[_0x3af5('0x4')][_0x3af5('0x6')],config['asterisk'][_0x3af5('0x7')],!![]);ami[_0x3af5('0x8')]();ami[_0x3af5('0x9')]=BPromise['promisify'](ami[_0x3af5('0xa')]);function error(_0x56074a){logger['error'](util[_0x3af5('0xb')](_0x3af5('0xc'),config['asterisk']['username'],config['asterisk']['ip'],config['asterisk'][_0x3af5('0x5')],util['inspect'](_0x56074a,![],null)));}function close(){logger[_0x3af5('0xd')](util[_0x3af5('0xb')](_0x3af5('0xe'),config[_0x3af5('0x4')][_0x3af5('0x6')],config[_0x3af5('0x4')]['ip'],config[_0x3af5('0x4')]['port']));}ami[_0x3af5('0xf')]=function(){return function(){return ami['Action']({'action':_0x3af5('0x10')});};};ami[_0x3af5('0x11')]=function(){return function(){return ami[_0x3af5('0x9')]({'action':'devicestatelist'});};};ami[_0x3af5('0x12')]=function(){return function(){return ami[_0x3af5('0x9')]({'action':_0x3af5('0x13')});};};ami[_0x3af5('0x14')]=function(){return function(){return ami[_0x3af5('0x9')]({'action':_0x3af5('0x15')});};};ami[_0x3af5('0x16')]=function(){return function(){return ami[_0x3af5('0x9')]({'action':'coreshowchannels'});};};function connect(_0x33e002){logger['info'](util[_0x3af5('0xb')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config['asterisk'][_0x3af5('0x6')],config['asterisk']['ip'],config[_0x3af5('0x4')][_0x3af5('0x5')]));ami['once'](_0x3af5('0xd'),error);ami[_0x3af5('0x17')](_0x3af5('0x18'),close);}ami['on'](_0x3af5('0x19'),connect);ami['on'](_0x3af5('0x1a'),function(_0x19f46b){logger['info'](util[_0x3af5('0xb')](_0x3af5('0x1b'),config['asterisk'][_0x3af5('0x6')],config[_0x3af5('0x4')]['ip'],config['asterisk'][_0x3af5('0x5')],util[_0x3af5('0x1c')](_0x19f46b,![],null)));});ami['on']('fullybooted',function(_0x555fbf){logger[_0x3af5('0x1d')](util[_0x3af5('0xb')](_0x3af5('0x1e'),config['asterisk']['username'],config[_0x3af5('0x4')]['ip'],config[_0x3af5('0x4')][_0x3af5('0x5')]));return BPromise['resolve']()[_0x3af5('0x1f')](ami[_0x3af5('0xf')]())[_0x3af5('0x1f')](ami[_0x3af5('0x11')]())[_0x3af5('0x1f')](ami[_0x3af5('0x12')]())['then'](ami[_0x3af5('0x14')]())[_0x3af5('0x1f')](ami[_0x3af5('0x16')]())[_0x3af5('0x20')](function(_0x5a4ffb){console['log'](_0x5a4ffb);});});ami[_0x3af5('0x17')](_0x3af5('0xd'),error);ami[_0x3af5('0x17')](_0x3af5('0x18'),close);module[_0x3af5('0x21')]=ami; \ No newline at end of file +var _0xbf7e=['coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','actionQueueSummary','catch','exports','asterisk-manager','bluebird','util','lodash','../../config/logger','ami','../../config/environment','asterisk','username','password','keepConnected','Action','promisify','action','error','port','inspect','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionCoreShowChannels'];(function(_0x202e89,_0x4cf280){var _0x44bea0=function(_0x336711){while(--_0x336711){_0x202e89['push'](_0x202e89['shift']());}};_0x44bea0(++_0x4cf280);}(_0xbf7e,0xa1));var _0xebf7=function(_0x14211c,_0x3e8970){_0x14211c=_0x14211c-0x0;var _0x38b718=_0xbf7e[_0x14211c];return _0x38b718;};'use strict';var Manager=require(_0xebf7('0x0'));var BPromise=require(_0xebf7('0x1'));var moment=require('moment');var util=require(_0xebf7('0x2'));var _=require(_0xebf7('0x3'));var logger=require(_0xebf7('0x4'))(_0xebf7('0x5'));var config=require(_0xebf7('0x6'));var ami=new Manager(config[_0xebf7('0x7')]['port'],config[_0xebf7('0x7')]['ip'],config[_0xebf7('0x7')][_0xebf7('0x8')],config[_0xebf7('0x7')][_0xebf7('0x9')],!![]);ami[_0xebf7('0xa')]();ami[_0xebf7('0xb')]=BPromise[_0xebf7('0xc')](ami[_0xebf7('0xd')]);function error(_0x41506e){logger[_0xebf7('0xe')](util['format']('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk'][_0xebf7('0x8')],config[_0xebf7('0x7')]['ip'],config['asterisk'][_0xebf7('0xf')],util[_0xebf7('0x10')](_0x41506e,![],null)));}function close(){logger[_0xebf7('0xe')](util['format']('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xebf7('0x7')]['username'],config['asterisk']['ip'],config['asterisk'][_0xebf7('0xf')]));}ami[_0xebf7('0x11')]=function(){return function(){return ami[_0xebf7('0xb')]({'action':_0xebf7('0x12')});};};ami[_0xebf7('0x13')]=function(){return function(){return ami[_0xebf7('0xb')]({'action':_0xebf7('0x14')});};};ami[_0xebf7('0x15')]=function(){return function(){return ami['Action']({'action':_0xebf7('0x16')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0xebf7('0xb')]({'action':'queuesummary'});};};ami[_0xebf7('0x17')]=function(){return function(){return ami[_0xebf7('0xb')]({'action':_0xebf7('0x18')});};};function connect(_0x58c108){logger[_0xebf7('0x19')](util['format'](_0xebf7('0x1a'),config[_0xebf7('0x7')][_0xebf7('0x8')],config[_0xebf7('0x7')]['ip'],config[_0xebf7('0x7')][_0xebf7('0xf')]));ami[_0xebf7('0x1b')]('error',error);ami[_0xebf7('0x1b')](_0xebf7('0x1c'),close);}ami['on'](_0xebf7('0x1d'),connect);ami['on']('shutdown',function(_0x33db4d){logger[_0xebf7('0x19')](util['format'](_0xebf7('0x1e'),config['asterisk'][_0xebf7('0x8')],config[_0xebf7('0x7')]['ip'],config[_0xebf7('0x7')]['port'],util[_0xebf7('0x10')](_0x33db4d,![],null)));});ami['on'](_0xebf7('0x1f'),function(_0x51e31e){logger[_0xebf7('0x19')](util['format'](_0xebf7('0x20'),config[_0xebf7('0x7')][_0xebf7('0x8')],config[_0xebf7('0x7')]['ip'],config['asterisk'][_0xebf7('0xf')]));return BPromise['resolve']()[_0xebf7('0x21')](ami[_0xebf7('0x11')]())['then'](ami['actionDeviceStateList']())[_0xebf7('0x21')](ami[_0xebf7('0x15')]())[_0xebf7('0x21')](ami[_0xebf7('0x22')]())[_0xebf7('0x21')](ami[_0xebf7('0x17')]())[_0xebf7('0x23')](function(_0x120135){console['log'](_0x120135);});});ami[_0xebf7('0x1b')](_0xebf7('0xe'),error);ami[_0xebf7('0x1b')](_0xebf7('0x1c'),close);module[_0xebf7('0x24')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 7220f1c..c8c0bf9 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 _0x9c44=['ami','client','http','Request','then','debug','rpc','memberReport','error','message','result','exports','../../config/logger'];(function(_0x3efb35,_0x7d8216){var _0x56cc99=function(_0x1f78ec){while(--_0x1f78ec){_0x3efb35['push'](_0x3efb35['shift']());}};_0x56cc99(++_0x7d8216);}(_0x9c44,0x178));var _0x49c4=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x9c44[_0x1969a7];return _0x3d665f;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var client=jayson[_0x49c4('0x2')][_0x49c4('0x3')]({'port':0x2329});client[_0x49c4('0x4')]=function(_0x2ad237,_0x4e0313){return new BPromise(function(_0x4941f1,_0x41a183){return client['request'](_0x2ad237,_0x4e0313)[_0x49c4('0x5')](function(_0x6030ae){logger[_0x49c4('0x6')](_0x49c4('0x7'),_0x49c4('0x8'),_0x2ad237,_0x4e0313,_0x6030ae);if(_0x6030ae['error']){logger[_0x49c4('0x9')](_0x49c4('0x7'),_0x49c4('0x8'),_0x2ad237,_0x6030ae[_0x49c4('0x9')]['message'],_0x4e0313);return _0x41a183(_0x6030ae['error'][_0x49c4('0xa')]);}else{return _0x4941f1(_0x6030ae[_0x49c4('0xb')]);}})['catch'](function(_0xb611a1){logger[_0x49c4('0x9')]('rpc','memberReport',_0x2ad237,_0xb611a1,_0x4e0313);return _0x41a183(_0xb611a1);});});};module[_0x49c4('0xc')]=client; \ No newline at end of file +var _0xa9e0=['result','catch','exports','jayson/promise','bluebird','../../config/logger','http','request','debug','rpc','error','message'];(function(_0xe9ce81,_0x4d48bb){var _0x27c089=function(_0x27a214){while(--_0x27a214){_0xe9ce81['push'](_0xe9ce81['shift']());}};_0x27c089(++_0x4d48bb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('ami');var client=jayson['client'][_0x0a9e('0x3')]({'port':0x2329});client['Request']=function(_0x333808,_0x432180){return new BPromise(function(_0x2ab90b,_0x991246){return client[_0x0a9e('0x4')](_0x333808,_0x432180)['then'](function(_0x219af0){logger[_0x0a9e('0x5')](_0x0a9e('0x6'),'memberReport',_0x333808,_0x432180,_0x219af0);if(_0x219af0['error']){logger[_0x0a9e('0x7')]('rpc','memberReport',_0x333808,_0x219af0[_0x0a9e('0x7')][_0x0a9e('0x8')],_0x432180);return _0x991246(_0x219af0[_0x0a9e('0x7')][_0x0a9e('0x8')]);}else{return _0x2ab90b(_0x219af0[_0x0a9e('0x9')]);}})[_0x0a9e('0xa')](function(_0x4a4c56){logger['error']('rpc','memberReport',_0x333808,_0x4a4c56,_0x432180);return _0x991246(_0x4a4c56);});});};module[_0x0a9e('0xb')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index eed8a72..37fc22a 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 _0x0dfb=['moment','isNil','string','voiceQueue','uniqueid','name','Contact','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','firstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','substring','dialCutDigit','getQueue','exports','util'];(function(_0x49d74f,_0x12854c){var _0x2e8188=function(_0x164808){while(--_0x164808){_0x49d74f['push'](_0x49d74f['shift']());}};_0x2e8188(++_0x12854c);}(_0x0dfb,0xe0));var _0xb0df=function(_0x1149ac,_0x404599){_0x1149ac=_0x1149ac-0x0;var _0x5c5c8c=_0x0dfb[_0x1149ac];return _0x5c5c8c;};'use strict';var util=require(_0xb0df('0x0'));var _=require('lodash');var moment=require(_0xb0df('0x1'));function checkNameSurname(_0x4ab6af,_0x5d9cb3,_0x3d0466){var _0x4a855b='';if(!_[_0xb0df('0x2')](_0x5d9cb3)&&_0xb0df('0x3')===typeof _0x5d9cb3){_0x4a855b+=_0x5d9cb3;}if(!_[_0xb0df('0x2')](_0x3d0466)&&_0xb0df('0x3')===typeof _0x3d0466){_0x4a855b+='\x20'+_0x3d0466;}if(_0x4a855b!==''){return _0x4a855b;}return _0x4ab6af;}function Action(_0x24fea3,_0x57d1d5,_0x1bb0e7){this[_0xb0df('0x4')]=_0x24fea3;this[_0xb0df('0x5')]=_0x1bb0e7||undefined;this[_0xb0df('0x6')]=checkNameSurname(_0x57d1d5[_0xb0df('0x7')]['phone'],_0x57d1d5[_0xb0df('0x7')]['firstName'],_0x57d1d5[_0xb0df('0x7')]['lastName']);this[_0xb0df('0x8')]=_0x57d1d5[_0xb0df('0x7')]['phone'];this[_0xb0df('0x9')]=_0x24fea3[_0xb0df('0x6')];this[_0xb0df('0xa')]=_0x57d1d5[_0xb0df('0xa')]||![];this['type']=_0x24fea3[_0xb0df('0xb')];this['dialQueueTimeout']=_0x24fea3[_0xb0df('0xc')]||0x3;this[_0xb0df('0xd')]=_0x57d1d5[_0xb0df('0xd')];this[_0xb0df('0xe')]=_0x57d1d5['countbusyretry'];this['countcongestionretry']=_0x57d1d5[_0xb0df('0xf')];this[_0xb0df('0x10')]=_0x57d1d5[_0xb0df('0x10')];this[_0xb0df('0x11')]=_0x57d1d5[_0xb0df('0x11')];this[_0xb0df('0x12')]=_0x57d1d5['countdropretry'];this[_0xb0df('0x13')]=_0x57d1d5[_0xb0df('0x13')];this[_0xb0df('0x14')]=_0x57d1d5[_0xb0df('0x14')];this[_0xb0df('0x15')]=_0x57d1d5[_0xb0df('0x15')];this[_0xb0df('0x16')]=_0x57d1d5[_0xb0df('0x16')];this[_0xb0df('0x17')]=_0x57d1d5[_0xb0df('0x17')];this['UserId']=_0x57d1d5[_0xb0df('0x18')];this[_0xb0df('0x19')]=_0x57d1d5[_0xb0df('0x19')];this[_0xb0df('0x1a')]=_0x57d1d5['CampaignId'];this[_0xb0df('0x1b')]=_0x57d1d5['id'];this['ContactFirstName']=_0x57d1d5[_0xb0df('0x7')][_0xb0df('0x1c')]||'';this[_0xb0df('0x1d')]=moment()[_0xb0df('0x1e')](_0xb0df('0x1f'));this['callback']=_0x57d1d5[_0xb0df('0x20')];this[_0xb0df('0x21')]=_0x57d1d5['callbackuniqueid'];this[_0xb0df('0x22')]=_0x57d1d5['callbackat'];this[_0xb0df('0x23')]=_0x57d1d5[_0xb0df('0x23')];this[_0xb0df('0x24')]='';this[_0xb0df('0x25')]='';}Action[_0xb0df('0x26')][_0xb0df('0x27')]=function(){return util[_0xb0df('0x1e')](_0xb0df('0x28'),this[_0xb0df('0x6')],this[_0xb0df('0x4')]['dialCutDigit']>0x0?this[_0xb0df('0x8')][_0xb0df('0x29')](this[_0xb0df('0x4')][_0xb0df('0x2a')]):this['number']);};Action[_0xb0df('0x26')][_0xb0df('0x2b')]=function(){return this[_0xb0df('0x9')];};module[_0xb0df('0x2c')]=Action; \ No newline at end of file +var _0x48d3=['isNil','string','voiceQueue','uniqueid','Contact','phone','firstName','lastName','number','queue','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','UserId','VoiceQueueId','CampaignId','ContactFirstName','starttime','format','callback','callbackat','recallme','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','getQueue','exports','util','lodash','moment'];(function(_0x31701d,_0x25897a){var _0x422109=function(_0x3ca953){while(--_0x3ca953){_0x31701d['push'](_0x31701d['shift']());}};_0x422109(++_0x25897a);}(_0x48d3,0xa5));var _0x348d=function(_0x533edb,_0x431845){_0x533edb=_0x533edb-0x0;var _0x13e589=_0x48d3[_0x533edb];return _0x13e589;};'use strict';var util=require(_0x348d('0x0'));var _=require(_0x348d('0x1'));var moment=require(_0x348d('0x2'));function checkNameSurname(_0x573404,_0x1cb2fd,_0x10df71){var _0x5f3e8f='';if(!_[_0x348d('0x3')](_0x1cb2fd)&&'string'===typeof _0x1cb2fd){_0x5f3e8f+=_0x1cb2fd;}if(!_['isNil'](_0x10df71)&&_0x348d('0x4')===typeof _0x10df71){_0x5f3e8f+='\x20'+_0x10df71;}if(_0x5f3e8f!==''){return _0x5f3e8f;}return _0x573404;}function Action(_0x39970d,_0x56c10a,_0x2fb490){this[_0x348d('0x5')]=_0x39970d;this[_0x348d('0x6')]=_0x2fb490||undefined;this['name']=checkNameSurname(_0x56c10a[_0x348d('0x7')][_0x348d('0x8')],_0x56c10a['Contact'][_0x348d('0x9')],_0x56c10a[_0x348d('0x7')][_0x348d('0xa')]);this[_0x348d('0xb')]=_0x56c10a[_0x348d('0x7')][_0x348d('0x8')];this[_0x348d('0xc')]=_0x39970d[_0x348d('0xd')];this['active']=_0x56c10a[_0x348d('0xe')]||![];this[_0x348d('0xf')]=_0x39970d[_0x348d('0xf')];this[_0x348d('0x10')]=_0x39970d[_0x348d('0x10')]||0x3;this[_0x348d('0x11')]=_0x56c10a[_0x348d('0x11')];this[_0x348d('0x12')]=_0x56c10a[_0x348d('0x12')];this['countcongestionretry']=_0x56c10a[_0x348d('0x13')];this['countnoanswerretry']=_0x56c10a[_0x348d('0x14')];this[_0x348d('0x15')]=_0x56c10a[_0x348d('0x15')];this[_0x348d('0x16')]=_0x56c10a['countdropretry'];this[_0x348d('0x17')]=_0x56c10a['countabandonedretry'];this[_0x348d('0x18')]=_0x56c10a[_0x348d('0x18')];this['countagentrejectretry']=_0x56c10a[_0x348d('0x19')];this[_0x348d('0x1a')]=_0x56c10a['ContactId'];this['ListId']=_0x56c10a['ListId'];this[_0x348d('0x1b')]=_0x56c10a[_0x348d('0x1b')];this[_0x348d('0x1c')]=_0x56c10a[_0x348d('0x1c')];this[_0x348d('0x1d')]=_0x56c10a[_0x348d('0x1d')];this['idHopper']=_0x56c10a['id'];this[_0x348d('0x1e')]=_0x56c10a[_0x348d('0x7')][_0x348d('0x9')]||'';this[_0x348d('0x1f')]=moment()[_0x348d('0x20')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x348d('0x21')]=_0x56c10a[_0x348d('0x21')];this['callbackuniqueid']=_0x56c10a['callbackuniqueid'];this[_0x348d('0x22')]=_0x56c10a[_0x348d('0x22')];this[_0x348d('0x23')]=_0x56c10a[_0x348d('0x23')];this['originatecalleridnum']='';this['originatecalleridname']='';}Action[_0x348d('0x24')][_0x348d('0x25')]=function(){return util[_0x348d('0x20')](_0x348d('0x26'),this['name'],this[_0x348d('0x5')]['dialCutDigit']>0x0?this[_0x348d('0xb')]['substring'](this[_0x348d('0x5')][_0x348d('0x27')]):this[_0x348d('0xb')]);};Action[_0x348d('0x24')][_0x348d('0x28')]=function(){return this[_0x348d('0xc')];};module[_0x348d('0x29')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 13d4f91..9fbdc96 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 _0xe7c1=['milliseconds','diff','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime','endtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','exports','lodash'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xe7c1,0x13a));var _0x1e7c=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xe7c1[_0x21a9d9];return _0x46adce;};'use strict';var util=require('util');var _=require(_0x1e7c('0x0'));var moment=require('moment');function getSeconds(_0x44eeb3,_0x22e0e0){var _0x2e354f=moment(_0x44eeb3)[_0x1e7c('0x1')](0x0);var _0x19399b=moment(_0x22e0e0)['milliseconds'](0x0);return _0x2e354f[_0x1e7c('0x2')](_0x19399b,'seconds');}function AgentComplete(_0x7f2cf6,_0x33635f){this[_0x1e7c('0x3')]=0x4;this[_0x1e7c('0x4')]=_0x1e7c('0x5');this[_0x1e7c('0x6')]=_0x7f2cf6['scheduledat'];this[_0x1e7c('0x7')]=_0x7f2cf6['type'];this[_0x1e7c('0x8')]=_0x7f2cf6[_0x1e7c('0x7')]===_0x1e7c('0x9')?'queue':_0x7f2cf6['type'];this[_0x1e7c('0xa')]=_0x7f2cf6[_0x1e7c('0xa')];this['countcongestionretry']=_0x7f2cf6[_0x1e7c('0xb')];this[_0x1e7c('0xc')]=_0x7f2cf6[_0x1e7c('0xc')];this[_0x1e7c('0xd')]=_0x7f2cf6[_0x1e7c('0xa')]+_0x7f2cf6[_0x1e7c('0xb')]+_0x7f2cf6[_0x1e7c('0xc')]+_0x7f2cf6['countnosuchnumberretry']+_0x7f2cf6[_0x1e7c('0xe')]+_0x7f2cf6[_0x1e7c('0xf')]+_0x7f2cf6[_0x1e7c('0x10')]+_0x7f2cf6[_0x1e7c('0x11')];this[_0x1e7c('0x12')]=_0x7f2cf6[_0x1e7c('0x12')];this[_0x1e7c('0xe')]=_0x7f2cf6['countdropretry'];this[_0x1e7c('0xf')]=_0x7f2cf6[_0x1e7c('0xf')];this[_0x1e7c('0x10')]=_0x7f2cf6[_0x1e7c('0x10')];this[_0x1e7c('0x11')]=_0x7f2cf6[_0x1e7c('0x11')];this[_0x1e7c('0x13')]=_0x33635f[_0x1e7c('0x13')];this[_0x1e7c('0x14')]=_0x7f2cf6[_0x1e7c('0x15')];this[_0x1e7c('0x16')]=_0x7f2cf6[_0x1e7c('0x17')];this[_0x1e7c('0x18')]=_0x7f2cf6[_0x1e7c('0x18')];this[_0x1e7c('0x19')]=_0x7f2cf6[_0x1e7c('0x19')];this[_0x1e7c('0x1a')]=_0x7f2cf6['answertime'];this['endtime']=moment()[_0x1e7c('0x1b')](_0x1e7c('0x1c'));this[_0x1e7c('0x1d')]=getSeconds(_0x7f2cf6[_0x1e7c('0x19')],_0x7f2cf6['starttime']);this['holdtime']=getSeconds(_0x7f2cf6[_0x1e7c('0x1a')],_0x7f2cf6[_0x1e7c('0x19')]);this[_0x1e7c('0x1e')]=getSeconds(this[_0x1e7c('0x1f')],_0x7f2cf6[_0x1e7c('0x1a')]);this['queue']=_0x33635f['queue'];this['membername']=_0x33635f[_0x1e7c('0x20')];this[_0x1e7c('0x21')]=_0x33635f['reason'];this[_0x1e7c('0x22')]=_0x7f2cf6[_0x1e7c('0x22')];this[_0x1e7c('0x23')]=_0x7f2cf6[_0x1e7c('0x23')];this['callbackat']=_0x7f2cf6[_0x1e7c('0x24')];this[_0x1e7c('0x25')]=_0x7f2cf6['recallme'];this[_0x1e7c('0x26')]=_0x7f2cf6[_0x1e7c('0x26')];this[_0x1e7c('0x27')]=_0x7f2cf6['ListId'];this['UserId']=_0x7f2cf6[_0x1e7c('0x28')];this['VoiceQueueId']=_0x7f2cf6[_0x1e7c('0x29')];this[_0x1e7c('0x2a')]=_0x7f2cf6['CampaignId'];this['originatecalleridnum']=_0x7f2cf6['originatecalleridnum']||'';this[_0x1e7c('0x2b')]=_0x7f2cf6[_0x1e7c('0x2b')]||'';}module[_0x1e7c('0x2c')]=AgentComplete; \ No newline at end of file +var _0xf42f=['seconds','state','statedesc','Answer','scheduledat','campaigntype','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','ringtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds'];(function(_0x4bcce2,_0x31940b){var _0x5cf6c7=function(_0x220461){while(--_0x220461){_0x4bcce2['push'](_0x4bcce2['shift']());}};_0x5cf6c7(++_0x31940b);}(_0xf42f,0xbc));var _0xff42=function(_0x213bbe,_0x3433a9){_0x213bbe=_0x213bbe-0x0;var _0x59a990=_0xf42f[_0x213bbe];return _0x59a990;};'use strict';var util=require(_0xff42('0x0'));var _=require(_0xff42('0x1'));var moment=require(_0xff42('0x2'));function getSeconds(_0xa87099,_0x59058e){var _0x24a954=moment(_0xa87099)[_0xff42('0x3')](0x0);var _0x5e64a3=moment(_0x59058e)['milliseconds'](0x0);return _0x24a954['diff'](_0x5e64a3,_0xff42('0x4'));}function AgentComplete(_0x581079,_0x4a71c6){this[_0xff42('0x5')]=0x4;this[_0xff42('0x6')]=_0xff42('0x7');this[_0xff42('0x8')]=_0x581079[_0xff42('0x8')];this['type']=_0x581079['type'];this[_0xff42('0x9')]=_0x581079[_0xff42('0xa')]===_0xff42('0xb')?_0xff42('0xc'):_0x581079[_0xff42('0xa')];this[_0xff42('0xd')]=_0x581079[_0xff42('0xd')];this['countcongestionretry']=_0x581079[_0xff42('0xe')];this[_0xff42('0xf')]=_0x581079[_0xff42('0xf')];this[_0xff42('0x10')]=_0x581079[_0xff42('0xd')]+_0x581079[_0xff42('0xe')]+_0x581079[_0xff42('0xf')]+_0x581079[_0xff42('0x11')]+_0x581079[_0xff42('0x12')]+_0x581079[_0xff42('0x13')]+_0x581079[_0xff42('0x14')]+_0x581079[_0xff42('0x15')];this['countnosuchnumberretry']=_0x581079['countnosuchnumberretry'];this['countdropretry']=_0x581079[_0xff42('0x12')];this[_0xff42('0x13')]=_0x581079[_0xff42('0x13')];this[_0xff42('0x14')]=_0x581079[_0xff42('0x14')];this[_0xff42('0x15')]=_0x581079['countagentrejectretry'];this[_0xff42('0x16')]=_0x4a71c6[_0xff42('0x16')];this[_0xff42('0x17')]=_0x581079[_0xff42('0x18')];this[_0xff42('0x19')]=_0x581079[_0xff42('0x1a')];this[_0xff42('0x1b')]=_0x581079[_0xff42('0x1b')];this[_0xff42('0x1c')]=_0x581079['responsetime'];this[_0xff42('0x1d')]=_0x581079[_0xff42('0x1d')];this[_0xff42('0x1e')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xff42('0x1f')]=getSeconds(_0x581079[_0xff42('0x1c')],_0x581079[_0xff42('0x1b')]);this[_0xff42('0x20')]=getSeconds(_0x581079[_0xff42('0x1d')],_0x581079[_0xff42('0x1c')]);this[_0xff42('0x21')]=getSeconds(this[_0xff42('0x1e')],_0x581079[_0xff42('0x1d')]);this['queue']=_0x4a71c6[_0xff42('0xc')];this[_0xff42('0x22')]=_0x4a71c6['membername'];this[_0xff42('0x23')]=_0x4a71c6[_0xff42('0x23')];this[_0xff42('0x24')]=_0x581079['callback'];this['callbackuniqueid']=_0x581079[_0xff42('0x25')];this[_0xff42('0x26')]=_0x581079[_0xff42('0x26')];this[_0xff42('0x27')]=_0x581079[_0xff42('0x27')];this[_0xff42('0x28')]=_0x581079[_0xff42('0x28')];this[_0xff42('0x29')]=_0x581079[_0xff42('0x29')];this[_0xff42('0x2a')]=_0x581079[_0xff42('0x2a')];this[_0xff42('0x2b')]=_0x581079[_0xff42('0x2b')];this[_0xff42('0x2c')]=_0x581079[_0xff42('0x2c')];this['originatecalleridnum']=_0x581079[_0xff42('0x2d')]||'';this['originatecalleridname']=_0x581079[_0xff42('0x2e')]||'';}module[_0xff42('0x2f')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 062d6a1..134d423 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 _0x9c5a=['countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x9f9a6,_0x2e3884){_0x9f9a6=_0x9f9a6-0x0;var _0xe947d0=_0x9c5a[_0x9f9a6];return _0xe947d0;};'use strict';var util=require(_0xa9c5('0x0'));var _=require(_0xa9c5('0x1'));var moment=require('moment');function getSeconds(_0x32ab4d,_0x1cd14d){var _0x1d0ee9=moment(_0x32ab4d)[_0xa9c5('0x2')](0x0);var _0x4f5552=moment(_0x1cd14d)[_0xa9c5('0x2')](0x0);return _0x1d0ee9[_0xa9c5('0x3')](_0x4f5552,'seconds');}function Final(_0x1e3c83){this['uniqueid']=_0x1e3c83[_0xa9c5('0x4')];this[_0xa9c5('0x5')]=_0x1e3c83['scheduledat'];this['type']=_0x1e3c83[_0xa9c5('0x6')];this[_0xa9c5('0x7')]=_0x1e3c83['type']===_0xa9c5('0x8')?_0xa9c5('0x9'):_0x1e3c83['type'];this[_0xa9c5('0xa')]=_0x1e3c83[_0xa9c5('0xa')];this['countcongestionretry']=_0x1e3c83['countcongestionretry'];this[_0xa9c5('0xb')]=_0x1e3c83[_0xa9c5('0xb')];this[_0xa9c5('0xc')]=_0x1e3c83[_0xa9c5('0xa')]+_0x1e3c83[_0xa9c5('0xd')]+_0x1e3c83[_0xa9c5('0xb')]+_0x1e3c83[_0xa9c5('0xe')]+_0x1e3c83[_0xa9c5('0xf')]+_0x1e3c83[_0xa9c5('0x10')]+_0x1e3c83[_0xa9c5('0x11')]+_0x1e3c83['countagentrejectretry'];this[_0xa9c5('0xe')]=_0x1e3c83[_0xa9c5('0xe')];this[_0xa9c5('0xf')]=_0x1e3c83[_0xa9c5('0xf')];this[_0xa9c5('0x10')]=_0x1e3c83[_0xa9c5('0x10')];this[_0xa9c5('0x11')]=_0x1e3c83[_0xa9c5('0x11')];this[_0xa9c5('0x12')]=_0x1e3c83[_0xa9c5('0x12')];this['queue']=_0x1e3c83[_0xa9c5('0x9')];this[_0xa9c5('0x13')]=_0x1e3c83[_0xa9c5('0x13')];this['calleridnum']=_0x1e3c83[_0xa9c5('0x14')];this[_0xa9c5('0x15')]=_0x1e3c83[_0xa9c5('0x15')];this[_0xa9c5('0x16')]=_0x1e3c83[_0xa9c5('0x16')];this[_0xa9c5('0x17')]=_0x1e3c83[_0xa9c5('0x16')];this[_0xa9c5('0x18')]=_0x1e3c83[_0xa9c5('0x18')]||0x0;this[_0xa9c5('0x19')]=_0x1e3c83[_0xa9c5('0x19')]||0x0;this[_0xa9c5('0x1a')]=_0x1e3c83['talktime']||0x0;this[_0xa9c5('0x1b')]=_0x1e3c83[_0xa9c5('0x1b')];this['callbackuniqueid']=_0x1e3c83['callbackuniqueid'];this[_0xa9c5('0x1c')]=_0x1e3c83[_0xa9c5('0x1c')];this[_0xa9c5('0x1d')]=_0x1e3c83[_0xa9c5('0x1d')];this[_0xa9c5('0x1e')]=_0x1e3c83[_0xa9c5('0x1e')];this['ListId']=_0x1e3c83['ListId'];this[_0xa9c5('0x1f')]=_0x1e3c83[_0xa9c5('0x1f')];this['VoiceQueueId']=_0x1e3c83[_0xa9c5('0x20')];this[_0xa9c5('0x21')]=_0x1e3c83[_0xa9c5('0x21')];this[_0xa9c5('0x22')]=_0x1e3c83[_0xa9c5('0x22')]||'';this[_0xa9c5('0x23')]=_0x1e3c83[_0xa9c5('0x23')]||'';}module['exports']=Final; \ No newline at end of file +var _0xaba6=['CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x1a30ea,_0x22bf39){var _0x36b8f2=function(_0x32fbbb){while(--_0x32fbbb){_0x1a30ea['push'](_0x1a30ea['shift']());}};_0x36b8f2(++_0x22bf39);}(_0xaba6,0xe2));var _0x6aba=function(_0x306fc1,_0x3d9e8f){_0x306fc1=_0x306fc1-0x0;var _0x524868=_0xaba6[_0x306fc1];return _0x524868;};'use strict';var util=require(_0x6aba('0x0'));var _=require(_0x6aba('0x1'));var moment=require('moment');function getSeconds(_0x4ddb2a,_0x5140ee){var _0x596c18=moment(_0x4ddb2a)[_0x6aba('0x2')](0x0);var _0x5e8543=moment(_0x5140ee)['milliseconds'](0x0);return _0x596c18[_0x6aba('0x3')](_0x5e8543,_0x6aba('0x4'));}function Final(_0x56627c){this['uniqueid']=_0x56627c['uniqueid'];this[_0x6aba('0x5')]=_0x56627c['scheduledat'];this[_0x6aba('0x6')]=_0x56627c[_0x6aba('0x6')];this['campaigntype']=_0x56627c[_0x6aba('0x6')]===_0x6aba('0x7')?'queue':_0x56627c[_0x6aba('0x6')];this[_0x6aba('0x8')]=_0x56627c[_0x6aba('0x8')];this[_0x6aba('0x9')]=_0x56627c[_0x6aba('0x9')];this[_0x6aba('0xa')]=_0x56627c[_0x6aba('0xa')];this['countglobal']=_0x56627c[_0x6aba('0x8')]+_0x56627c[_0x6aba('0x9')]+_0x56627c[_0x6aba('0xa')]+_0x56627c[_0x6aba('0xb')]+_0x56627c['countdropretry']+_0x56627c[_0x6aba('0xc')]+_0x56627c[_0x6aba('0xd')]+_0x56627c['countagentrejectretry'];this[_0x6aba('0xb')]=_0x56627c[_0x6aba('0xb')];this[_0x6aba('0xe')]=_0x56627c['countdropretry'];this[_0x6aba('0xc')]=_0x56627c[_0x6aba('0xc')];this[_0x6aba('0xd')]=_0x56627c['countmachineretry'];this[_0x6aba('0xf')]=_0x56627c[_0x6aba('0xf')];this[_0x6aba('0x10')]=_0x56627c[_0x6aba('0x10')];this[_0x6aba('0x11')]=_0x56627c[_0x6aba('0x11')];this[_0x6aba('0x12')]=_0x56627c['calleridnum'];this[_0x6aba('0x13')]=_0x56627c[_0x6aba('0x13')];this[_0x6aba('0x14')]=_0x56627c['responsetime'];this[_0x6aba('0x15')]=_0x56627c['responsetime'];this['ringtime']=_0x56627c[_0x6aba('0x16')]||0x0;this['holdtime']=_0x56627c[_0x6aba('0x17')]||0x0;this[_0x6aba('0x18')]=_0x56627c[_0x6aba('0x18')]||0x0;this[_0x6aba('0x19')]=_0x56627c[_0x6aba('0x19')];this[_0x6aba('0x1a')]=_0x56627c[_0x6aba('0x1a')];this['callbackat']=_0x56627c[_0x6aba('0x1b')];this[_0x6aba('0x1c')]=_0x56627c[_0x6aba('0x1c')];this[_0x6aba('0x1d')]=_0x56627c[_0x6aba('0x1d')];this[_0x6aba('0x1e')]=_0x56627c[_0x6aba('0x1e')];this[_0x6aba('0x1f')]=_0x56627c[_0x6aba('0x1f')];this[_0x6aba('0x20')]=_0x56627c[_0x6aba('0x20')];this[_0x6aba('0x21')]=_0x56627c[_0x6aba('0x21')];this[_0x6aba('0x22')]=_0x56627c[_0x6aba('0x22')]||'';this[_0x6aba('0x23')]=_0x56627c[_0x6aba('0x23')]||'';}module[_0x6aba('0x24')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 877bd09..45dfd59 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 _0x8da4=['uniqueid','calleridname','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','queue','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry'];(function(_0x103965,_0x1b794e){var _0x40c90b=function(_0x40ac51){while(--_0x40ac51){_0x103965['push'](_0x103965['shift']());}};_0x40c90b(++_0x1b794e);}(_0x8da4,0xcd));var _0x48da=function(_0xa7a6a1,_0x5a72eb){_0xa7a6a1=_0xa7a6a1-0x0;var _0x5abf41=_0x8da4[_0xa7a6a1];return _0x5abf41;};'use strict';var util=require(_0x48da('0x0'));var _=require(_0x48da('0x1'));var moment=require(_0x48da('0x2'));function getSeconds(_0x5bca87,_0xb2742f){var _0x5d6e48=moment(_0x5bca87)[_0x48da('0x3')](0x0);var _0x341f72=moment(_0xb2742f)['milliseconds'](0x0);return _0x5d6e48['diff'](_0x341f72,_0x48da('0x4'));}function Hangup(_0x1efa13,_0x4c2f36){this[_0x48da('0x5')]=0x4;this[_0x48da('0x6')]=_0x48da('0x7');this[_0x48da('0x8')]=_0x1efa13[_0x48da('0x8')];this[_0x48da('0x9')]=_0x1efa13[_0x48da('0x9')];this[_0x48da('0xa')]=_0x1efa13[_0x48da('0x9')]===_0x48da('0xb')?'queue':_0x1efa13['type'];this[_0x48da('0xc')]=_0x1efa13['countbusyretry'];this['countcongestionretry']=_0x1efa13[_0x48da('0xd')];this[_0x48da('0xe')]=_0x1efa13[_0x48da('0xe')];this['countglobal']=_0x1efa13['countbusyretry']+_0x1efa13[_0x48da('0xd')]+_0x1efa13['countnoanswerretry']+_0x1efa13[_0x48da('0xf')]+_0x1efa13[_0x48da('0x10')]+_0x1efa13[_0x48da('0x11')]+_0x1efa13[_0x48da('0x12')]+_0x1efa13[_0x48da('0x13')];this[_0x48da('0xf')]=_0x1efa13[_0x48da('0xf')];this['countdropretry']=_0x1efa13[_0x48da('0x10')];this[_0x48da('0x11')]=_0x1efa13[_0x48da('0x11')];this['countmachineretry']=_0x1efa13[_0x48da('0x12')];this[_0x48da('0x13')]=_0x1efa13['countagentrejectretry'];this[_0x48da('0x14')]=_0x4c2f36[_0x48da('0x14')];this[_0x48da('0x15')]=_0x1efa13['name'];this[_0x48da('0x16')]=_0x1efa13[_0x48da('0x17')];this['starttime']=_0x1efa13[_0x48da('0x18')];this[_0x48da('0x19')]=_0x1efa13[_0x48da('0x19')];this[_0x48da('0x1a')]=moment()[_0x48da('0x1b')](_0x48da('0x1c'));this[_0x48da('0x1d')]=getSeconds(_0x1efa13[_0x48da('0x19')],_0x1efa13['starttime']);this[_0x48da('0x1e')]=0x0;this[_0x48da('0x1f')]=getSeconds(this[_0x48da('0x1a')],_0x1efa13[_0x48da('0x19')]);this[_0x48da('0x20')]=_0x1efa13[_0x48da('0x20')];this['membername']=_0x48da('0x21');this[_0x48da('0x22')]=_0x4c2f36[_0x48da('0x23')];this[_0x48da('0x24')]=_0x1efa13['callback'];this[_0x48da('0x25')]=_0x1efa13['callbackuniqueid'];this[_0x48da('0x26')]=_0x1efa13[_0x48da('0x26')];this[_0x48da('0x27')]=_0x1efa13['recallme'];this['ContactId']=_0x1efa13['ContactId'];this[_0x48da('0x28')]=_0x1efa13[_0x48da('0x28')];this[_0x48da('0x29')]=_0x1efa13[_0x48da('0x29')];this[_0x48da('0x2a')]=_0x1efa13['VoiceQueueId'];this[_0x48da('0x2b')]=_0x1efa13[_0x48da('0x2b')];}module[_0x48da('0x2c')]=Hangup; \ No newline at end of file +var _0xcd7e=['calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','membername','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','moment','milliseconds','diff','seconds','statedesc','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid'];(function(_0x1ea4e9,_0x5ae469){var _0x12dbc4=function(_0x41bc48){while(--_0x41bc48){_0x1ea4e9['push'](_0x1ea4e9['shift']());}};_0x12dbc4(++_0x5ae469);}(_0xcd7e,0x126));var _0xecd7=function(_0x51d71a,_0x596fda){_0x51d71a=_0x51d71a-0x0;var _0xff01f1=_0xcd7e[_0x51d71a];return _0xff01f1;};'use strict';var util=require(_0xecd7('0x0'));var _=require('lodash');var moment=require(_0xecd7('0x1'));function getSeconds(_0x394490,_0x1fc36a){var _0x486e8a=moment(_0x394490)['milliseconds'](0x0);var _0x1c20a5=moment(_0x1fc36a)[_0xecd7('0x2')](0x0);return _0x486e8a[_0xecd7('0x3')](_0x1c20a5,_0xecd7('0x4'));}function Hangup(_0x4f90fe,_0x388dfe){this['state']=0x4;this[_0xecd7('0x5')]=_0xecd7('0x6');this[_0xecd7('0x7')]=_0x4f90fe[_0xecd7('0x7')];this['type']=_0x4f90fe[_0xecd7('0x8')];this['campaigntype']=_0x4f90fe[_0xecd7('0x8')]===_0xecd7('0x9')?_0xecd7('0xa'):_0x4f90fe[_0xecd7('0x8')];this[_0xecd7('0xb')]=_0x4f90fe[_0xecd7('0xb')];this[_0xecd7('0xc')]=_0x4f90fe[_0xecd7('0xc')];this[_0xecd7('0xd')]=_0x4f90fe[_0xecd7('0xd')];this[_0xecd7('0xe')]=_0x4f90fe['countbusyretry']+_0x4f90fe[_0xecd7('0xc')]+_0x4f90fe['countnoanswerretry']+_0x4f90fe[_0xecd7('0xf')]+_0x4f90fe[_0xecd7('0x10')]+_0x4f90fe['countabandonedretry']+_0x4f90fe[_0xecd7('0x11')]+_0x4f90fe[_0xecd7('0x12')];this[_0xecd7('0xf')]=_0x4f90fe['countnosuchnumberretry'];this[_0xecd7('0x10')]=_0x4f90fe[_0xecd7('0x10')];this[_0xecd7('0x13')]=_0x4f90fe[_0xecd7('0x13')];this[_0xecd7('0x11')]=_0x4f90fe['countmachineretry'];this['countagentrejectretry']=_0x4f90fe[_0xecd7('0x12')];this['uniqueid']=_0x388dfe[_0xecd7('0x14')];this[_0xecd7('0x15')]=_0x4f90fe[_0xecd7('0x16')];this[_0xecd7('0x17')]=_0x4f90fe[_0xecd7('0x18')];this['starttime']=_0x4f90fe[_0xecd7('0x19')];this[_0xecd7('0x1a')]=_0x4f90fe['responsetime'];this[_0xecd7('0x1b')]=moment()[_0xecd7('0x1c')](_0xecd7('0x1d'));this[_0xecd7('0x1e')]=getSeconds(_0x4f90fe[_0xecd7('0x1a')],_0x4f90fe[_0xecd7('0x19')]);this[_0xecd7('0x1f')]=0x0;this['talktime']=getSeconds(this[_0xecd7('0x1b')],_0x4f90fe[_0xecd7('0x1a')]);this[_0xecd7('0xa')]=_0x4f90fe[_0xecd7('0xa')];this[_0xecd7('0x20')]=_0xecd7('0x21');this[_0xecd7('0x22')]=_0x388dfe['cause-txt'];this['callback']=_0x4f90fe[_0xecd7('0x23')];this[_0xecd7('0x24')]=_0x4f90fe['callbackuniqueid'];this[_0xecd7('0x25')]=_0x4f90fe[_0xecd7('0x25')];this[_0xecd7('0x26')]=_0x4f90fe['recallme'];this[_0xecd7('0x27')]=_0x4f90fe[_0xecd7('0x27')];this[_0xecd7('0x28')]=_0x4f90fe[_0xecd7('0x28')];this['UserId']=_0x4f90fe[_0xecd7('0x29')];this[_0xecd7('0x2a')]=_0x4f90fe[_0xecd7('0x2a')];this[_0xecd7('0x2b')]=_0x4f90fe['CampaignId'];}module[_0xecd7('0x2c')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index efa1eae..ecabfd7 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 _0x2d07=['talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','starttime','responsetime','ringtime'];(function(_0x30ad27,_0x750e0f){var _0x42242a=function(_0x352f81){while(--_0x352f81){_0x30ad27['push'](_0x30ad27['shift']());}};_0x42242a(++_0x750e0f);}(_0x2d07,0x117));var _0x72d0=function(_0x11cd17,_0x489e02){_0x11cd17=_0x11cd17-0x0;var _0x3343ad=_0x2d07[_0x11cd17];return _0x3343ad;};'use strict';var util=require(_0x72d0('0x0'));var _=require(_0x72d0('0x1'));var moment=require(_0x72d0('0x2'));function getSeconds(_0x2af185,_0x1355a7){var _0x295b9a=moment(_0x2af185)[_0x72d0('0x3')](0x0);var _0x4d1734=moment(_0x1355a7)[_0x72d0('0x3')](0x0);return _0x295b9a[_0x72d0('0x4')](_0x4d1734,_0x72d0('0x5'));}function History(_0x1088fa){this[_0x72d0('0x6')]=_0x1088fa[_0x72d0('0x6')];this[_0x72d0('0x7')]=_0x1088fa[_0x72d0('0x7')]||undefined;this['type']=_0x1088fa[_0x72d0('0x8')];this['campaigntype']=_0x1088fa['type']==='outbound'?_0x72d0('0x9'):_0x1088fa[_0x72d0('0x8')];this[_0x72d0('0xa')]=_0x1088fa[_0x72d0('0xa')];this['countcongestionretry']=_0x1088fa[_0x72d0('0xb')];this[_0x72d0('0xc')]=_0x1088fa[_0x72d0('0xc')];this[_0x72d0('0xd')]=_0x1088fa[_0x72d0('0xa')]+_0x1088fa[_0x72d0('0xb')]+_0x1088fa[_0x72d0('0xc')]+_0x1088fa[_0x72d0('0xe')]+_0x1088fa[_0x72d0('0xf')]+_0x1088fa[_0x72d0('0x10')]+_0x1088fa[_0x72d0('0x11')]+_0x1088fa['countagentrejectretry'];this['countnosuchnumberretry']=_0x1088fa['countnosuchnumberretry'];this[_0x72d0('0xf')]=_0x1088fa[_0x72d0('0xf')];this[_0x72d0('0x10')]=_0x1088fa['countabandonedretry'];this[_0x72d0('0x11')]=_0x1088fa[_0x72d0('0x11')];this[_0x72d0('0x12')]=_0x1088fa[_0x72d0('0x12')];this['queue']=_0x1088fa[_0x72d0('0x9')];this[_0x72d0('0x13')]=_0x1088fa[_0x72d0('0x14')];this[_0x72d0('0x15')]=_0x1088fa['number'];this['starttime']=_0x1088fa[_0x72d0('0x16')];this[_0x72d0('0x17')]=_0x1088fa[_0x72d0('0x17')];this['endtime']=_0x1088fa[_0x72d0('0x17')];this[_0x72d0('0x18')]=getSeconds(_0x1088fa[_0x72d0('0x17')],_0x1088fa[_0x72d0('0x16')]);this['holdtime']=0x0;this[_0x72d0('0x19')]=0x0;this[_0x72d0('0x1a')]=_0x1088fa[_0x72d0('0x1a')];this['callbackuniqueid']=_0x1088fa[_0x72d0('0x1b')];this['callbackat']=_0x1088fa[_0x72d0('0x1c')];this[_0x72d0('0x1d')]=_0x1088fa[_0x72d0('0x1d')];this[_0x72d0('0x1e')]=_0x1088fa['ContactId'];this[_0x72d0('0x1f')]=_0x1088fa[_0x72d0('0x1f')];this[_0x72d0('0x20')]=_0x1088fa[_0x72d0('0x20')];this['VoiceQueueId']=_0x1088fa[_0x72d0('0x21')];this[_0x72d0('0x22')]=_0x1088fa[_0x72d0('0x22')];this[_0x72d0('0x23')]=_0x1088fa['originatecalleridnum']||'';this['originatecalleridname']=_0x1088fa[_0x72d0('0x24')]||'';}module[_0x72d0('0x25')]=History; \ No newline at end of file +var _0x0a85=['starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','number'];(function(_0x4f9a85,_0xffa20f){var _0x1f6c43=function(_0x1b3af7){while(--_0x1b3af7){_0x4f9a85['push'](_0x4f9a85['shift']());}};_0x1f6c43(++_0xffa20f);}(_0x0a85,0xd3));var _0x50a8=function(_0x568657,_0x2a5995){_0x568657=_0x568657-0x0;var _0x3cf122=_0x0a85[_0x568657];return _0x3cf122;};'use strict';var util=require(_0x50a8('0x0'));var _=require('lodash');var moment=require(_0x50a8('0x1'));function getSeconds(_0x9b67dd,_0x5e2dfd){var _0x45c734=moment(_0x9b67dd)[_0x50a8('0x2')](0x0);var _0x1a571a=moment(_0x5e2dfd)[_0x50a8('0x2')](0x0);return _0x45c734[_0x50a8('0x3')](_0x1a571a,_0x50a8('0x4'));}function History(_0x19c268){this[_0x50a8('0x5')]=_0x19c268[_0x50a8('0x5')];this[_0x50a8('0x6')]=_0x19c268[_0x50a8('0x6')]||undefined;this[_0x50a8('0x7')]=_0x19c268[_0x50a8('0x7')];this[_0x50a8('0x8')]=_0x19c268[_0x50a8('0x7')]===_0x50a8('0x9')?_0x50a8('0xa'):_0x19c268[_0x50a8('0x7')];this[_0x50a8('0xb')]=_0x19c268[_0x50a8('0xb')];this['countcongestionretry']=_0x19c268['countcongestionretry'];this[_0x50a8('0xc')]=_0x19c268['countnoanswerretry'];this[_0x50a8('0xd')]=_0x19c268[_0x50a8('0xb')]+_0x19c268[_0x50a8('0xe')]+_0x19c268[_0x50a8('0xc')]+_0x19c268[_0x50a8('0xf')]+_0x19c268[_0x50a8('0x10')]+_0x19c268[_0x50a8('0x11')]+_0x19c268[_0x50a8('0x12')]+_0x19c268[_0x50a8('0x13')];this[_0x50a8('0xf')]=_0x19c268[_0x50a8('0xf')];this[_0x50a8('0x10')]=_0x19c268[_0x50a8('0x10')];this[_0x50a8('0x11')]=_0x19c268[_0x50a8('0x11')];this[_0x50a8('0x12')]=_0x19c268['countmachineretry'];this[_0x50a8('0x13')]=_0x19c268[_0x50a8('0x13')];this['queue']=_0x19c268[_0x50a8('0xa')];this[_0x50a8('0x14')]=_0x19c268['name'];this[_0x50a8('0x15')]=_0x19c268[_0x50a8('0x16')];this[_0x50a8('0x17')]=_0x19c268[_0x50a8('0x17')];this[_0x50a8('0x18')]=_0x19c268[_0x50a8('0x18')];this[_0x50a8('0x19')]=_0x19c268[_0x50a8('0x18')];this[_0x50a8('0x1a')]=getSeconds(_0x19c268[_0x50a8('0x18')],_0x19c268[_0x50a8('0x17')]);this[_0x50a8('0x1b')]=0x0;this[_0x50a8('0x1c')]=0x0;this[_0x50a8('0x1d')]=_0x19c268[_0x50a8('0x1d')];this[_0x50a8('0x1e')]=_0x19c268[_0x50a8('0x1e')];this[_0x50a8('0x1f')]=_0x19c268['callbackat'];this[_0x50a8('0x20')]=_0x19c268[_0x50a8('0x20')];this['ContactId']=_0x19c268[_0x50a8('0x21')];this['ListId']=_0x19c268['ListId'];this['UserId']=_0x19c268[_0x50a8('0x22')];this[_0x50a8('0x23')]=_0x19c268[_0x50a8('0x23')];this[_0x50a8('0x24')]=_0x19c268[_0x50a8('0x24')];this[_0x50a8('0x25')]=_0x19c268['originatecalleridnum']||'';this['originatecalleridname']=_0x19c268[_0x50a8('0x26')]||'';}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 2cfc108..84742e7 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 _0xd3a8=['value','HANGUP','AMD','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','membername','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','[rescheduleContact][Machine]','HangupInAMD','[syncHangupInAMDIvr][createHistory]','ivrAnswerCallsDay','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr][createHistory]','outboundUnknownCallsDay','cause-txt','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','YYYY-MM-DD\x20HH:mm:ss','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','Drop','TIMEOUT','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','dropreason','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actionid','roundrobin','paused','stateinterface','locked','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','finally','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','INTERVAL_IS_EMPTY','Failure','\x20Intervals\x20is\x20empty\x20','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','interval','timezones','indexOf','true','all','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','power','dialPowerLevel','predictive','Queue','method\x20not\x20recognized','handleIvr','dialGlobalInterval','dialTimezone','[syncQueueSummary]','launchHandleIvr','[syncCampaigns]','\x5cw{0,','pow','replace','match','object','voiceQueue\x20is\x20undefine','Contact','phone','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','\x22%s,%s%s,,,%s\x22','dialer','ACTIVE','NONE','XMD-AMDINITIALSILENCE','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','%s%s','XMD-','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','dialCutDigit','trim','substring','from-sip','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','countcongestionretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','reason','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','Global','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','abandonmentRate','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','outboundQueuePauses','[CatchErlangB]','agentBusyFactor','busyFactor','[handlePredictive]','fail\x20to\x20scheduled\x20calls','UserId','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','actionOriginate','dialRecallMeTimeout','Agent','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','BLACKLIST','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','checkContactBlack','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','countReScheduled','[getContactDialer2]','tryOriginatePredictive','[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','----\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','util','bluebird','uuid','moment','md5','../preview/util/util','../../../config/environment/','booked','../../../config/logger','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','127.0.0.1','rrmemory','enqueue','tail','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','queuecallerabandon','syncQueueCallerAbandon','bind','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','message','name','NOT_ACTIVE','Interval','INTERVAL_IS_NULL','Intervals','\x20INTERVAL_IS_NULL','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','emit','type','outbound','strategy','answered','available','loggedIn','sumDuration','sumHoldTime','talking','total','unmanaged','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','voice:queue:%s','ivr','format','campaign:ivr:%s','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','isUndefined','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','---------------------------','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','preview','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','prototype','clearZombieChannels','[actions]','isNil','Action','channel','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','resolve','then','catch','[countReScheduled]\x20','checkIsBlackList','checkIsBlackListIvr','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','merge','pick','ContactId','ListId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','isSuccess','isTrunkReachable','SIP/%s','status','reachable','saveInDb','syncVarSet','uniqueid','exten','xcally-motion-dialer','dialAMDActive'];(function(_0x473680,_0x259710){var _0x205f93=function(_0x91a81d){while(--_0x91a81d){_0x473680['push'](_0x473680['shift']());}};_0x205f93(++_0x259710);}(_0xd3a8,0x135));var _0x8d3a=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xd3a8[_0x167cc1];return _0x10bc4b;};'use strict';var util=require(_0x8d3a('0x0'));var _=require('lodash');var BPromise=require(_0x8d3a('0x1'));var uuid=require(_0x8d3a('0x2'));var moment=require(_0x8d3a('0x3'));var rr=require('rr');var md5=require(_0x8d3a('0x4'));var Redis=require('ioredis');var ut=require(_0x8d3a('0x5'));var config=require(_0x8d3a('0x6'));var logger=require('../../../config/logger')('dialer');var loggerBooked=require('../../../config/logger')(_0x8d3a('0x7'));var loggerPredictive=require('../../../config/logger')('predictive');var loggerPredictiveCalls=require(_0x8d3a('0x8'))(_0x8d3a('0x9'));var loggerSyncQueueSummary=require(_0x8d3a('0x8'))(_0x8d3a('0xa'));var ami=require(_0x8d3a('0xb'));config[_0x8d3a('0xc')]=_[_0x8d3a('0xd')](config[_0x8d3a('0xc')],{'host':_0x8d3a('0xe'),'port':0x18eb});var io=require(_0x8d3a('0xf'))(new Redis(config[_0x8d3a('0xc')]));var cmHopper=require(_0x8d3a('0x10'));var cmHopperHistory=require(_0x8d3a('0x11'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require('../rpc/voiceQueueRt');var Action=require('./action');var History=require(_0x8d3a('0x12'));var Final=require(_0x8d3a('0x13'));var AgentComplete=require(_0x8d3a('0x14'));var QueueCallerAbandon=require(_0x8d3a('0x15'));var Hangup=require(_0x8d3a('0x16'));var ipAgi=process[_0x8d3a('0x17')]['XCALLY_IP_AGI']||_0x8d3a('0x18');var strategy={'rrmemory':_0x8d3a('0x19'),'roundrobin':'roundrobin'};var Sequence=function(){};Sequence['prototype'][_0x8d3a('0x1a')]=function(_0x560396){this[_0x8d3a('0x1b')]=this[_0x8d3a('0x1b')]?this[_0x8d3a('0x1b')]['finally'](_0x560396):_0x560396();};function Dialer(_0x33eefb,_0x483fea){this[_0x8d3a('0x1c')]=new Sequence();this['preview']=_0x483fea;this[_0x8d3a('0x1d')]=_0x33eefb[_0x8d3a('0x1d')];this[_0x8d3a('0x1e')]=_0x33eefb['campaigns'];this['agents']=_0x33eefb[_0x8d3a('0x1f')];this[_0x8d3a('0x20')]=_0x33eefb[_0x8d3a('0x20')];this[_0x8d3a('0x21')]=config[_0x8d3a('0x21')]||0x2;this['channels']={};this[_0x8d3a('0x22')]={};this[_0x8d3a('0x23')]={};this[_0x8d3a('0x24')]={};this[_0x8d3a('0x25')]={};this[_0x8d3a('0x26')]={};this[_0x8d3a('0x27')]={};this['ivrOriginated']={};this[_0x8d3a('0x28')]={};this[_0x8d3a('0x29')]={};ami['on'](_0x8d3a('0x2a'),this[_0x8d3a('0x2b')]['bind'](this));ami['on'](_0x8d3a('0x2c'),this[_0x8d3a('0x2d')][_0x8d3a('0x2e')](this));ami['on']('originateresponse',this[_0x8d3a('0x2f')][_0x8d3a('0x2e')](this));ami['on'](_0x8d3a('0x30'),this[_0x8d3a('0x31')][_0x8d3a('0x2e')](this));ami['on'](_0x8d3a('0x32'),this[_0x8d3a('0xa')]['bind'](this));ami['on'](_0x8d3a('0x33'),this[_0x8d3a('0x34')][_0x8d3a('0x2e')](this));ami['on'](_0x8d3a('0x35'),this[_0x8d3a('0x36')][_0x8d3a('0x2e')](this));ami['on']('varset',this['syncVarSet'][_0x8d3a('0x2e')](this));ami['on'](_0x8d3a('0x37'),this[_0x8d3a('0x38')][_0x8d3a('0x2e')](this));ami['on'](_0x8d3a('0x39'),this[_0x8d3a('0x3a')]['bind'](this));this[_0x8d3a('0x3b')]();this[_0x8d3a('0x3c')]();}function isNotNull(_0x18f710){return _0x18f710!==null&&!_['isUndefined'](_0x18f710);}function checkIsLoggedIn(_0x4349ad,_0x1b4530){return function(){if(_0x1b4530<=0x0){_0x4349ad[_0x8d3a('0x3d')]='AGENTS_NOT_LOGGED';throw _0x4349ad[_0x8d3a('0x3e')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x1b62e5){return _0x1b62e5;}function checkIsActive(_0x2a3aa8,_0x44dda3){return function(){if(!isActive(_0x44dda3)){_0x2a3aa8['message']=_0x8d3a('0x3f');throw _0x2a3aa8['name']+'\x20NOT\x20Active';}};}function checkInterval(_0x2367b7){return function(){if(!isNotNull(_0x2367b7[_0x8d3a('0x40')])){_0x2367b7['message']=_0x8d3a('0x41');throw _0x2367b7['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x2367b7[_0x8d3a('0x40')][_0x8d3a('0x42')])){_0x2367b7['message']=_0x8d3a('0x41');throw _0x2367b7[_0x8d3a('0x3e')]+_0x8d3a('0x43');}if(!isNotNull(_[_0x8d3a('0x44')](_0x2367b7[_0x8d3a('0x40')][_0x8d3a('0x42')]))){_0x2367b7[_0x8d3a('0x3d')]=_0x8d3a('0x41');throw _0x2367b7[_0x8d3a('0x3e')]+_0x8d3a('0x43');}};}function msgResponse(_0x5933de,_0x214ced,_0x2df8e1){return{'action':_0x5933de,'response':_0x214ced,'message':_0x2df8e1,'stack':_0x2df8e1};}function myreject(_0x4d136f){return function(_0x56383e){return _0x4d136f(msgResponse(_0x8d3a('0x45'),_0x8d3a('0x46'),JSON[_0x8d3a('0x47')](_0x56383e)));};}function getSeconds(_0x5730ee,_0x7253af){var _0x6efa53=moment(_0x5730ee)['milliseconds'](0x0);var _0x3d3250=moment(_0x7253af)[_0x8d3a('0x48')](0x0);return _0x6efa53[_0x8d3a('0x49')](_0x3d3250,_0x8d3a('0x4a'));}function emit(_0x2fd933,_0x43e0aa,_0x562cde){io['to'](_0x2fd933)[_0x8d3a('0x4b')](_0x43e0aa,_0x562cde);}function emitVoiceQueueSummary(_0x1ff0fa){if(_0x1ff0fa[_0x8d3a('0x4c')]===_0x8d3a('0x4d')){var _0x34c34b={'id':_0x1ff0fa['id'],'name':_0x1ff0fa[_0x8d3a('0x3e')],'strategy':_0x1ff0fa[_0x8d3a('0x4e')],'answered':_0x1ff0fa[_0x8d3a('0x4f')],'available':_0x1ff0fa[_0x8d3a('0x50')],'loggedIn':_0x1ff0fa[_0x8d3a('0x51')],'pTalking':_0x1ff0fa['pTalking'],'sumBillable':_0x1ff0fa['sumBillable'],'sumDuration':_0x1ff0fa[_0x8d3a('0x52')],'sumHoldTime':_0x1ff0fa[_0x8d3a('0x53')]||0x0,'talking':_0x1ff0fa[_0x8d3a('0x54')],'total':_0x1ff0fa[_0x8d3a('0x55')],'type':_0x1ff0fa[_0x8d3a('0x4c')],'unmanaged':_0x1ff0fa[_0x8d3a('0x56')],'abandoned':_0x1ff0fa['abandoned'],'waiting':_0x1ff0fa[_0x8d3a('0x57')],'loggedInDb':_0x1ff0fa[_0x8d3a('0x58')],'dialActive':_0x1ff0fa[_0x8d3a('0x59')],'dialMethod':_0x1ff0fa[_0x8d3a('0x5a')],'dialOriginateCallerIdName':_0x1ff0fa[_0x8d3a('0x5b')],'dialOriginateCallerIdNumber':_0x1ff0fa[_0x8d3a('0x5c')],'dialOriginateTimeout':_0x1ff0fa[_0x8d3a('0x5d')],'dialPrefix':_0x1ff0fa[_0x8d3a('0x5e')],'outboundAnswerAgiCallsDay':_0x1ff0fa[_0x8d3a('0x5f')],'outboundAnswerCallsDay':_0x1ff0fa[_0x8d3a('0x60')],'outboundBlacklistCallsDay':_0x1ff0fa[_0x8d3a('0x61')],'outboundBusyCallsDay':_0x1ff0fa[_0x8d3a('0x62')],'outboundCongestionCallsDay':_0x1ff0fa['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x1ff0fa[_0x8d3a('0x63')],'outboundDropCallsDayCallersExit':_0x1ff0fa[_0x8d3a('0x64')],'outboundDropCallsDayTimeout':_0x1ff0fa[_0x8d3a('0x65')],'outboundNoAnswerCallsDay':_0x1ff0fa['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x1ff0fa[_0x8d3a('0x66')],'outboundOriginateFailureCallsDay':_0x1ff0fa[_0x8d3a('0x67')],'outboundReCallsDay':_0x1ff0fa[_0x8d3a('0x68')],'outboundRejectCallsDay':_0x1ff0fa['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x1ff0fa['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x1ff0fa[_0x8d3a('0x69')],'predictiveIntervalAvgHoldtime':_0x1ff0fa[_0x8d3a('0x6a')],'predictiveIntervalAvgTalktime':_0x1ff0fa[_0x8d3a('0x6b')],'predictiveIntervalDroppedCallsCallersExit':_0x1ff0fa[_0x8d3a('0x6c')],'predictiveIntervalDroppedCallsTimeout':_0x1ff0fa[_0x8d3a('0x6d')],'predictiveIntervalErlangCalls':_0x1ff0fa['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x1ff0fa[_0x8d3a('0x6e')],'predictiveIntervalHitRate':_0x1ff0fa[_0x8d3a('0x6f')],'predictiveIntervalMultiplicativeFactor':_0x1ff0fa[_0x8d3a('0x70')],'predictiveIntervalPauses':_0x1ff0fa[_0x8d3a('0x71')],'predictiveIntervalAvailable':_0x1ff0fa['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x1ff0fa['predictiveIntervalTotalCalls'],'message':_0x1ff0fa['message'],'originated':_0x1ff0fa[_0x8d3a('0x72')],'erlangCalls':_0x1ff0fa[_0x8d3a('0x73')],'erlangCallToSecond':_0x1ff0fa[_0x8d3a('0x74')],'erlangAbandonmentRate':_0x1ff0fa[_0x8d3a('0x75')],'erlangBusyFactor':_0x1ff0fa[_0x8d3a('0x76')],'startPredictive':_0x1ff0fa[_0x8d3a('0x26')],'startProgressive':_0x1ff0fa['startProgressive']};if(_0x1ff0fa[_0x8d3a('0x77')]){_0x34c34b[_0x8d3a('0x77')]={'id':_0x1ff0fa['Trunk']['id'],'name':_0x1ff0fa[_0x8d3a('0x77')][_0x8d3a('0x3e')],'active':_0x1ff0fa[_0x8d3a('0x77')][_0x8d3a('0x78')],'callerid':_0x1ff0fa['Trunk'][_0x8d3a('0x79')]};}if(_0x1ff0fa[_0x8d3a('0x40')]){_0x34c34b[_0x8d3a('0x40')]={'id':_0x1ff0fa[_0x8d3a('0x40')]['id'],'name':_0x1ff0fa[_0x8d3a('0x40')][_0x8d3a('0x3e')]};}var _0x1ffb91=md5(JSON[_0x8d3a('0x47')](_0x34c34b));if(_0x1ff0fa[_0x8d3a('0x4')]!==_0x1ffb91){_0x1ff0fa[_0x8d3a('0x4')]=_0x1ffb91;emit(util['format'](_0x8d3a('0x7a'),_0x34c34b[_0x8d3a('0x3e')]),'voice_queue:save',_0x34c34b);}}}function emitCampaignSummary(_0x254680){if(_0x254680['type']===_0x8d3a('0x7b')){emit(util[_0x8d3a('0x7c')](_0x8d3a('0x7d'),_0x254680[_0x8d3a('0x3e')]),'campaign:save',_0x254680);}}function checkGetDataPredictive(_0x2d0d27){if(isNotNull(_0x2d0d27)&&!_[_0x8d3a('0x44')](_0x2d0d27)){loggerPredictive[_0x8d3a('0x7e')](_0x8d3a('0x7f'));loggerPredictive[_0x8d3a('0x7e')](_0x8d3a('0x80'),_0x2d0d27[_0x8d3a('0x81')]);loggerPredictive[_0x8d3a('0x7e')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2d0d27['predictiveIntervalAnsweredCalls']);loggerPredictive[_0x8d3a('0x7e')](_0x8d3a('0x82'),_0x2d0d27[_0x8d3a('0x6d')]);loggerPredictive['info'](_0x8d3a('0x83'),_0x2d0d27[_0x8d3a('0x6c')]);loggerPredictive['info'](_0x8d3a('0x84'),_0x2d0d27[_0x8d3a('0x6a')]);loggerPredictive[_0x8d3a('0x7e')](_0x8d3a('0x85'),_0x2d0d27[_0x8d3a('0x6b')]);loggerPredictive[_0x8d3a('0x7e')]('---------------------------');if(_0x2d0d27[_0x8d3a('0x81')]>0x0){if(!_[_0x8d3a('0x86')](_0x2d0d27[_0x8d3a('0x6b')])&&_0x2d0d27['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0x8d3a('0x7e')](_0x8d3a('0x87'));if(!_['isUndefined'](_0x2d0d27['predictiveIntervalAvgHoldtime'])&&_0x2d0d27[_0x8d3a('0x6a')]>0x0){return!![];}loggerPredictive[_0x8d3a('0x7e')](_0x8d3a('0x88'));}else{loggerPredictive['info']('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x8d3a('0x7e')](_0x8d3a('0x89'));}return![];}function mergeDataErlangB(_0x4f6114){return function(_0x1e7892){loggerPredictive[_0x8d3a('0x7e')](_0x8d3a('0x8a'));loggerPredictive[_0x8d3a('0x7e')](_0x8d3a('0x8b'),_0x1e7892['erlangCalls']);loggerPredictive[_0x8d3a('0x7e')](_0x8d3a('0x8c'),_0x1e7892[_0x8d3a('0x74')]);loggerPredictive[_0x8d3a('0x7e')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1e7892['erlangAbandonmentRate']);loggerPredictive['info'](_0x8d3a('0x8d'),_0x1e7892['erlangBusyFactor']);loggerPredictive[_0x8d3a('0x7e')](_0x8d3a('0x8e'),_0x1e7892['erlangAbandonmentRate']);loggerPredictive[_0x8d3a('0x7e')](_0x8d3a('0x8f'));_['merge'](_0x4f6114,_0x1e7892);};}function getDiff(_0x542561){var _0x136ae3=moment()[_0x8d3a('0x48')](0x0);var _0x377b5a=moment(_0x542561)[_0x8d3a('0x48')](0x0);return _0x136ae3[_0x8d3a('0x49')](_0x377b5a,'seconds');}function ifInterval(_0x5b276c,_0x5174a7){if(_[_0x8d3a('0x86')](_0x5174a7)){return![];}return getDiff(_0x5174a7)<_0x5b276c*0x3c;}function freeVariablesPredictive(_0x574ca1){if(isNotNull(_0x574ca1)){if(!_[_0x8d3a('0x86')](_0x574ca1[_0x8d3a('0x27')])){_0x574ca1[_0x8d3a('0x27')]=undefined;loggerPredictive[_0x8d3a('0x7e')](_0x574ca1['name'],_0x8d3a('0x90'));}if(!_[_0x8d3a('0x86')](_0x574ca1[_0x8d3a('0x26')])){_0x574ca1[_0x8d3a('0x26')]=undefined;loggerPredictive['info'](_0x574ca1[_0x8d3a('0x3e')],_0x8d3a('0x91'));}if(!_[_0x8d3a('0x86')](_0x574ca1['handlePredictive'])){clearInterval(_0x574ca1[_0x8d3a('0x92')]);_0x574ca1['handlePredictive']=undefined;loggerPredictive[_0x8d3a('0x7e')](_0x574ca1[_0x8d3a('0x3e')],_0x8d3a('0x93'));}}}function erlangb(_0x5c84c4,_0x330801){if(_0x330801===0x0){return 0x0;}var _0x3892fd=0x1;for(var _0x420ea8=0x1;_0x420ea8<=_0x330801;_0x420ea8+=0x1){_0x3892fd=0x1+_0x3892fd*_0x420ea8/_0x5c84c4;}return 0x1/_0x3892fd;}function isVoiceQueueOutbound(_0x2a6471){return _0x2a6471===_0x8d3a('0x4d');}function isNotPreview(_0x36a69b){return _0x36a69b!==_0x8d3a('0x94');}function isCampaignIvr(_0x27ca33){return _0x27ca33===_0x8d3a('0x7b');}function getCallerId(_0x1a5c3c,_0x18830c,_0x1241bb){if(!_[_0x8d3a('0x86')](_0x1241bb)&&typeof _0x1241bb===_0x8d3a('0x95')&&!_['isEmpty'](_0x1241bb)){if(!_[_0x8d3a('0x86')](_0x18830c)&&typeof _0x18830c===_0x8d3a('0x95')&&!_[_0x8d3a('0x44')](_0x18830c)){return util[_0x8d3a('0x7c')](_0x8d3a('0x96'),_0x18830c,_0x1241bb);}return util['format']('\x22%s\x22\x20<%s>',_0x1241bb,_0x1241bb);}if(!_[_0x8d3a('0x86')](_0x1a5c3c)&&typeof _0x1a5c3c==='string'&&!_[_0x8d3a('0x44')](_0x1a5c3c)){return _0x1a5c3c;}return _0x8d3a('0x97');}function loggerCatchQueueSummary(_0x225576,_0x2d321b){return function(_0x2f2cf9){freeVariablesPredictive(_0x2d321b);emitVoiceQueueSummary(_0x2d321b);emitCampaignSummary(_0x2d321b);loggerSyncQueueSummary[_0x8d3a('0x98')](_0x225576,util[_0x8d3a('0x99')](_0x2f2cf9,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x3554cc,_0x3a62bf){return function(_0x4f4a9c){loggerPredictive[_0x8d3a('0x98')](_0x3a62bf[_0x8d3a('0x3e')],_0x3554cc);loggerPredictive[_0x8d3a('0x98')](_0x4f4a9c[_0x8d3a('0x9a')]);freeVariablesPredictive(_0x3a62bf);};}function loggerCatch(_0x344bd9){return function(_0x5b46b6){logger[_0x8d3a('0x98')](_0x344bd9,util[_0x8d3a('0x99')](_0x5b46b6,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x4525f5){return _0x4525f5&&!_[_0x8d3a('0x86')](_0x4525f5)&&_0x4525f5[_0x8d3a('0x9b')]>0x0;}function decremetOriginate(_0x47a2ca){if(!_[_0x8d3a('0x86')](_0x47a2ca)&&_0x47a2ca!==null){if(typeof _0x47a2ca[_0x8d3a('0x72')]!==_0x8d3a('0x9c')){if(_0x47a2ca[_0x8d3a('0x72')]>0x0){_0x47a2ca[_0x8d3a('0x72')]-=0x1;}else{logger['error'](_0x8d3a('0x9d'));}}}else{logger[_0x8d3a('0x98')](_0x8d3a('0x9e'));}}function checkContactLowerLimitOriginate(_0x5c58bb,_0x4c78b9,_0x34c1cc){if(_0x4c78b9>_0x34c1cc){for(var _0x5b34e2=0x0;_0x5b34e2<_0x4c78b9-_0x34c1cc;_0x5b34e2+=0x1){decremetOriginate(_0x5c58bb);}}}function loggerGetContactDialer(_0x690c31,_0x134377,_0x2e451e){return function(_0x14621a){checkContactLowerLimitOriginate(_0x134377,_0x2e451e,0x0);logger['error'](_0x690c31,util[_0x8d3a('0x99')](_0x14621a,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x5814a9){return function(_0x1a5b1c){if(isNotNull(_0x1a5b1c)&&isNotNull(_0x1a5b1c[0x0])){if(_0x1a5b1c[0x0]['contactsRescheduled']>0x0){_0x5814a9['message']=_0x8d3a('0x9f');logger[_0x8d3a('0x7e')](_0x8d3a('0xa0')+_0x5814a9[_0x8d3a('0x3e')],_0x1a5b1c[0x0][_0x8d3a('0xa1')],_0x8d3a('0xa2'));}else{_0x5814a9[_0x8d3a('0x3d')]=_0x8d3a('0xa3');logger[_0x8d3a('0x7e')](_0x8d3a('0xa4')+_0x5814a9[_0x8d3a('0x3e')]);}}};}function notSendMessagesQueue(_0x341696){if(_0x341696[_0x8d3a('0xa5')]){freeVariablesPredictive(_0x341696);if(_0x341696[_0x8d3a('0x72')]===0x0&&_0x341696[_0x8d3a('0x54')]===0x0&&_0x341696['waiting']===0x0&&(_0x341696['pTalking']||0x0)===0x0){_0x341696[_0x8d3a('0xa5')]=![];_0x341696[_0x8d3a('0x50')]=0x0;_0x341696['message']=_0x8d3a('0x3f');loggerSyncQueueSummary[_0x8d3a('0x98')](_0x8d3a('0xa6'),_0x341696[_0x8d3a('0x3e')],_0x8d3a('0xa7'));}else{_0x341696[_0x8d3a('0x3d')]=_0x8d3a('0xa8');loggerSyncQueueSummary[_0x8d3a('0x98')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x341696['name'],_0x8d3a('0xa9'));}emitVoiceQueueSummary(_0x341696);}}function notSendMessagesCampaign(_0x5c943b){if(_0x5c943b[_0x8d3a('0xa5')]){if(_0x5c943b[_0x8d3a('0x72')]===0x0){_0x5c943b['sendMessageOneNotActive']=![];_0x5c943b[_0x8d3a('0x3d')]=_0x8d3a('0x3f');loggerSyncQueueSummary['error'](_0x8d3a('0xaa'),_0x5c943b[_0x8d3a('0x3e')],'is\x20not\x20active');}else{_0x5c943b[_0x8d3a('0x3d')]=_0x8d3a('0xa8');loggerSyncQueueSummary['error'](_0x8d3a('0xaa'),_0x5c943b['name'],'is\x20disactive');}emitCampaignSummary(_0x5c943b);}}function createObjHistory(_0x53dad1,_0x2bb930,_0x178250,_0x5496d4,_0xa0260c){_0x53dad1['message']=_0x178250;var _0x10993b=new Action(_0x53dad1,_0x2bb930);var _0x5ad004=new History(_0x10993b);_0x5ad004[_0x8d3a('0xab')]=_0x5496d4;_0x5ad004[_0x8d3a('0xac')]=_0xa0260c;_0x5ad004[_0x8d3a('0xad')]=_0x10993b[_0x8d3a('0xae')];return _0x5ad004;}Dialer[_0x8d3a('0xaf')][_0x8d3a('0x3c')]=function(){var _0x4cb8e5=this;setInterval(function(){_0x4cb8e5[_0x8d3a('0xb0')](_0x4cb8e5[_0x8d3a('0x24')],'[uniqueid]');_0x4cb8e5[_0x8d3a('0xb0')](_0x4cb8e5['actions'],_0x8d3a('0xb1'));},0x32c8);};Dialer['prototype'][_0x8d3a('0xb0')]=function(_0x318ead,_0x1e956d){var _0x29f8ac=this;for(var _0x16b702 in _0x318ead){if(typeof _0x318ead[_0x16b702]!=='undefined'){this[_0x8d3a('0x1c')]['enqueue'](function(){if(!_[_0x8d3a('0xb2')](_0x318ead[_0x16b702])){return ami[_0x8d3a('0xb3')]({'action':'status','channel':_0x318ead[_0x16b702][_0x8d3a('0xb4')]})['catch'](function(_0x5fa21e){if(_0x5fa21e['message']===_0x8d3a('0xb5')){setTimeout(function(){if(_0x318ead[_0x16b702]&&_0x318ead[_0x16b702][_0x8d3a('0x4c')]!=='ivr'){_0x29f8ac[_0x8d3a('0xb6')](_0x29f8ac[_0x8d3a('0x1d')][_0x318ead[_0x16b702][_0x8d3a('0xb7')]]);logger[_0x8d3a('0x98')](_0x8d3a('0xb8'),_0x1e956d,_0x16b702,_0x318ead[_0x16b702][_0x8d3a('0xb7')]);delete _0x318ead[_0x16b702];}if(_0x318ead[_0x16b702]&&_0x318ead[_0x16b702]['type']===_0x8d3a('0x7b')){_0x29f8ac[_0x8d3a('0xb6')](_0x29f8ac[_0x8d3a('0x1e')][_0x318ead[_0x16b702][_0x8d3a('0xb7')]]);logger[_0x8d3a('0x98')]('[Dialer][checkChannel][ivr]',_0x1e956d,_0x16b702,_0x318ead[_0x16b702]['queue']);delete _0x318ead[_0x16b702];}},0x2328);}});}});}}};Dialer[_0x8d3a('0xaf')]['countReScheduled']=function(_0x5221d3){return BPromise[_0x8d3a('0xb9')]()[_0x8d3a('0xba')](cmHopper['countReScheduled'](_0x5221d3))[_0x8d3a('0xbb')](loggerCatch(_0x8d3a('0xbc')));};Dialer[_0x8d3a('0xaf')][_0x8d3a('0xbd')]=function(_0x54c5f4){return BPromise[_0x8d3a('0xb9')]()[_0x8d3a('0xba')](cmHopperBlack[_0x8d3a('0xbd')](_0x54c5f4))[_0x8d3a('0xbb')](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0x8d3a('0xaf')]['checkIsBlackListIvr']=function(_0x3df1a4){return BPromise['resolve']()[_0x8d3a('0xba')](cmHopperBlack[_0x8d3a('0xbe')](_0x3df1a4))[_0x8d3a('0xbb')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0x8d3a('0xaf')][_0x8d3a('0xbf')]=function(_0x18af3b){return BPromise[_0x8d3a('0xb9')]()[_0x8d3a('0xba')](cmHopperHistory[_0x8d3a('0xc0')](_0x18af3b))[_0x8d3a('0xbb')](loggerCatch(_0x8d3a('0xc1')));};Dialer[_0x8d3a('0xaf')][_0x8d3a('0xc2')]=function(_0x50744c){return BPromise['resolve']()[_0x8d3a('0xba')](cmHopper[_0x8d3a('0xc2')](_0x50744c))['catch'](loggerCatch(_0x8d3a('0xc3')));};Dialer[_0x8d3a('0xaf')][_0x8d3a('0xc4')]=function(_0x5c9152,_0x19be2f,_0x76646d){return BPromise[_0x8d3a('0xb9')]()[_0x8d3a('0xba')](cmHopper[_0x8d3a('0xc4')](_0x5c9152,_0x19be2f,_0x76646d))[_0x8d3a('0xbb')](loggerCatch(_0x8d3a('0xc5')));};Dialer['prototype'][_0x8d3a('0xc6')]=function(_0x59003d,_0xd47d1c,_0x2432c1,_0x5d5444,_0x227f57){return BPromise[_0x8d3a('0xb9')]()[_0x8d3a('0xba')](cmHopper[_0x8d3a('0xc6')](_0x59003d,_0xd47d1c,_0x2432c1,_0x5d5444))['catch'](function(_0x3f2c56){_0x227f57[_0x8d3a('0xc7')]-=_0x2432c1;_0x227f57[_0x8d3a('0xc7')]=_0x227f57[_0x8d3a('0xc7')]>0x0?_0x227f57['temp']:0x0;loggerCatch(_0x8d3a('0xc8'))(_0x3f2c56);});};Dialer['prototype'][_0x8d3a('0xc9')]=function(_0x5d3910,_0x583ebc,_0x3640ac,_0x10ce9c){return BPromise[_0x8d3a('0xb9')]()[_0x8d3a('0xba')](cmHopper[_0x8d3a('0xc9')](_0x5d3910,_0x583ebc,_0x3640ac))[_0x8d3a('0xbb')](function(_0x4ee4f9){_0x10ce9c['temp']-=_0x583ebc;_0x10ce9c[_0x8d3a('0xc7')]=_0x10ce9c['temp']>0x0?_0x10ce9c[_0x8d3a('0xc7')]:0x0;loggerCatch('[getContactDialerIvr]\x20')(_0x4ee4f9);});};Dialer[_0x8d3a('0xaf')]['getVoiceQueueRtPauses']=function(_0x455aae){return BPromise[_0x8d3a('0xb9')]()['then'](voiceQueueRt[_0x8d3a('0xca')](_0x455aae))[_0x8d3a('0xbb')](loggerCatch(_0x8d3a('0xcb')));};Dialer[_0x8d3a('0xaf')][_0x8d3a('0xcc')]=function(_0x2ae62c){return BPromise[_0x8d3a('0xb9')]()[_0x8d3a('0xba')](cmHopper[_0x8d3a('0xcc')](_0x2ae62c))['catch'](loggerCatch(_0x8d3a('0xcd')));};Dialer[_0x8d3a('0xaf')][_0x8d3a('0xce')]=function(_0x12da42){return BPromise[_0x8d3a('0xb9')]()[_0x8d3a('0xba')](cmHopperHistory[_0x8d3a('0xce')](_0x12da42))[_0x8d3a('0xbb')](loggerCatch(_0x8d3a('0xcf')));};Dialer[_0x8d3a('0xaf')][_0x8d3a('0xb6')]=function(_0x3e1616){if(!_[_0x8d3a('0x86')](_0x3e1616)&&_0x3e1616!==null){if(typeof _0x3e1616[_0x8d3a('0x72')]!=='undefined'){if(_0x3e1616[_0x8d3a('0x72')]>0x0){_0x3e1616['originated']-=0x1;}else{logger[_0x8d3a('0x98')](_0x8d3a('0xd0'));}}}else{logger[_0x8d3a('0x98')](_0x8d3a('0xd1'));}};Dialer[_0x8d3a('0xaf')][_0x8d3a('0xd2')]=function(_0x39800b,_0x1250fe){var _0x3c888e=this;return function(_0x2918ca){_0x3c888e['updateOriginated'](_0x1250fe);logger['error'](_0x39800b,util[_0x8d3a('0x99')](_0x2918ca,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0x8d3a('0xd3')]=function(_0x4ec901,_0x3f313b,_0x1dbfdb){var _0x19b0b2={'state':0x19,'statedesc':'notFound'};this[_0x8d3a('0xb6')](_0x3f313b);this['saveInDb'](_[_0x8d3a('0xd4')](_0x19b0b2,_[_0x8d3a('0xd5')](_0x1dbfdb,[_0x8d3a('0xd6'),_0x8d3a('0xd7'),'UserId',_0x8d3a('0xd8'),_0x8d3a('0xd9')])),_0x8d3a('0xda'),'[emptyContact]');logger[_0x8d3a('0x98')](_0x4ec901);};Dialer[_0x8d3a('0xaf')][_0x8d3a('0xdb')]=function(_0x152195){return _0x152195==='Success';};Dialer[_0x8d3a('0xaf')][_0x8d3a('0xdc')]=function(_0x1b0d05){return!_[_0x8d3a('0x86')](_0x1b0d05)&&_0x1b0d05&&!_[_0x8d3a('0x86')](_0x1b0d05[_0x8d3a('0x3e')])&&!_['isUndefined'](_0x1b0d05['active'])&&_0x1b0d05[_0x8d3a('0x78')]&&(this['trunks'][util['format'](_0x8d3a('0xdd'),_0x1b0d05[_0x8d3a('0x3e')])][_0x8d3a('0xde')]===_0x8d3a('0xdf')||this[_0x8d3a('0x20')][util['format'](_0x8d3a('0xdd'),_0x1b0d05[_0x8d3a('0x3e')])]['status']==='unmonitored');};Dialer[_0x8d3a('0xaf')][_0x8d3a('0xe0')]=function(_0x5b41cc,_0x1cb63e,_0x107b75){this['createHistory'](_0x5b41cc)[_0x8d3a('0xbb')](loggerCatch(_0x1cb63e));this[_0x8d3a('0xcc')](_0x5b41cc)[_0x8d3a('0xbb')](loggerCatch(_0x107b75));};Dialer['prototype'][_0x8d3a('0xe1')]=function(_0x556b16){var _0x20d35b=this[_0x8d3a('0x24')][_0x556b16[_0x8d3a('0xe2')]];var _0x529aa7;if(!_[_0x8d3a('0xb2')](_0x556b16)&&!_[_0x8d3a('0xb2')](_0x556b16['variable'])&&!_[_0x8d3a('0xb2')](_0x556b16['variable']['amdstatus'])&&_0x556b16[_0x8d3a('0xe3')]===_0x8d3a('0xe4')&&_0x20d35b){if(_0x20d35b[_0x8d3a('0x4c')]!==_0x8d3a('0x7b')&&this[_0x8d3a('0x1d')][_0x20d35b[_0x8d3a('0xb7')]][_0x8d3a('0xe5')]&&_0x556b16[_0x8d3a('0xe6')]===_0x8d3a('0xe7')){delete this[_0x8d3a('0x24')][_0x556b16['uniqueid']];this['updateOriginated'](this[_0x8d3a('0x1d')][_0x20d35b[_0x8d3a('0xb7')]]);this[_0x8d3a('0x1d')][_0x20d35b['queue']][_0x8d3a('0x60')]+=0x1;this[_0x8d3a('0x1d')][_0x20d35b[_0x8d3a('0xb7')]][_0x8d3a('0x5f')]+=0x1;_0x529aa7=new Hangup(_0x20d35b,_0x556b16);_0x529aa7['state']=0x12;_0x529aa7[_0x8d3a('0xac')]='HangupInAMD';_0x529aa7['membername']=_0x8d3a('0xe8');ami['emit'](_0x8d3a('0xe9'),ut[_0x8d3a('0xea')](_0x529aa7,_0x8d3a('0xeb')));this[_0x8d3a('0xe0')](_0x529aa7,_0x8d3a('0xec'),_0x8d3a('0xed'));}if(_0x20d35b[_0x8d3a('0x4c')]!=='ivr'&&this[_0x8d3a('0x1d')][_0x20d35b[_0x8d3a('0xb7')]][_0x8d3a('0xe5')]&&_0x556b16[_0x8d3a('0xe6')]===_0x8d3a('0xee')){var _0x27cbfc=this;return new BPromise(function(_0x1dfc6f,_0xc725c3){delete _0x27cbfc[_0x8d3a('0x24')][_0x556b16[_0x8d3a('0xe2')]];_0x27cbfc[_0x8d3a('0xb6')](_0x27cbfc[_0x8d3a('0x1d')][_0x20d35b[_0x8d3a('0xb7')]]);_0x27cbfc[_0x8d3a('0x1d')][_0x20d35b[_0x8d3a('0xb7')]][_0x8d3a('0x60')]+=0x1;_0x27cbfc['voiceQueues'][_0x20d35b[_0x8d3a('0xb7')]][_0x8d3a('0x5f')]+=0x1;var _0xe48674=_0x27cbfc[_0x8d3a('0x1d')][_0x20d35b[_0x8d3a('0xb7')]];var _0x412e12=new Hangup(_0x20d35b,_0x556b16);_0x412e12[_0x8d3a('0xab')]=0x13;_0x412e12['statedesc']=_0x8d3a('0xef');_0x412e12[_0x8d3a('0xf0')]=_0x8d3a('0xe8');_0x412e12['countmachineretry']+=0x1;_0x412e12[_0x8d3a('0xf1')]+=0x1;_0x412e12[_0x8d3a('0xeb')]=!![];ami[_0x8d3a('0x4b')](_0x8d3a('0xe9'),ut[_0x8d3a('0xea')](_0x412e12,_0x8d3a('0xeb')));_0x27cbfc[_0x8d3a('0xce')](_0x412e12)[_0x8d3a('0xbb')](loggerCatch(_0x8d3a('0xf2')));if(_0x412e12[_0x8d3a('0xf3')]+_0x412e12['countcongestionretry']+_0x412e12[_0x8d3a('0xf4')]+_0x412e12[_0x8d3a('0xf5')]+_0x412e12[_0x8d3a('0xf6')]+_0x412e12[_0x8d3a('0xf7')]+_0x412e12[_0x8d3a('0xf8')]+_0x412e12[_0x8d3a('0xf9')]>=_0xe48674[_0x8d3a('0xfa')]){_0x27cbfc[_0x8d3a('0xfb')](_0x412e12,_0x1dfc6f,_0xc725c3,_0x8d3a('0xfc'));}else{if(_0x412e12[_0x8d3a('0xf8')]>=_0xe48674[_0x8d3a('0xfd')]){_0x27cbfc[_0x8d3a('0xfe')](_0x412e12,_0x1dfc6f,_0xc725c3,_0x8d3a('0xff'));}else{_0x27cbfc['rescheduleContact']({'active':![],'countmachineretry':_0x412e12[_0x8d3a('0xf8')],'scheduledat':moment()[_0x8d3a('0x100')](_0xe48674[_0x8d3a('0x101')],_0x8d3a('0x102'))[_0x8d3a('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x412e12['ContactId'],'ListId':_0x412e12[_0x8d3a('0xd7')],'VoiceQueueId':_0x412e12['VoiceQueueId']||undefined,'CampaignId':_0x412e12['CampaignId']||undefined})['catch'](loggerCatch(_0x8d3a('0x103')));_0x1dfc6f({'reschedule':0x1});}}});}if(_0x20d35b[_0x8d3a('0x4c')]===_0x8d3a('0x7b')&&this[_0x8d3a('0x1e')][_0x20d35b[_0x8d3a('0xb7')]][_0x8d3a('0xe5')]&&_0x556b16['value']===_0x8d3a('0xe7')){delete this['uniqueId'][_0x556b16[_0x8d3a('0xe2')]];this[_0x8d3a('0xb6')](this[_0x8d3a('0x1e')][_0x20d35b[_0x8d3a('0xb7')]]);_0x529aa7=new Hangup(_0x20d35b,_0x556b16);_0x529aa7[_0x8d3a('0xab')]=0x12;_0x529aa7[_0x8d3a('0xac')]=_0x8d3a('0x104');_0x529aa7[_0x8d3a('0xf0')]=_0x8d3a('0xe8');ami[_0x8d3a('0x4b')](_0x8d3a('0xe9'),ut[_0x8d3a('0xea')](_0x529aa7,'amd'));this['saveInDb'](_0x529aa7,_0x8d3a('0x105'),'[syncHangupInAMDIvr]');}if(_0x20d35b['type']===_0x8d3a('0x7b')&&this['campaigns'][_0x20d35b[_0x8d3a('0xb7')]]['dialAMDActive']&&_0x556b16[_0x8d3a('0xe6')]===_0x8d3a('0xee')){var _0x27cbfc=this;return new BPromise(function(_0x59a75e,_0x51d4c6){delete _0x27cbfc[_0x8d3a('0x24')][_0x556b16['uniqueid']];_0x27cbfc[_0x8d3a('0xb6')](_0x27cbfc[_0x8d3a('0x1e')][_0x20d35b[_0x8d3a('0xb7')]]);_0x27cbfc['campaigns'][_0x20d35b[_0x8d3a('0xb7')]][_0x8d3a('0x60')]+=0x1;_0x27cbfc[_0x8d3a('0x1e')][_0x20d35b[_0x8d3a('0xb7')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x135d78=_0x27cbfc[_0x8d3a('0x1e')][_0x20d35b[_0x8d3a('0xb7')]];var _0x378818=new Hangup(_0x20d35b,_0x556b16);_0x378818['state']=0x13;_0x378818['statedesc']=_0x8d3a('0xef');_0x378818[_0x8d3a('0xf0')]=_0x8d3a('0xe8');_0x378818[_0x8d3a('0xf8')]+=0x1;_0x378818['countglobal']+=0x1;_0x378818['amd']=!![];ami[_0x8d3a('0x4b')](_0x8d3a('0xe9'),ut['buildObj'](_0x378818,_0x8d3a('0xeb')));_0x27cbfc[_0x8d3a('0xce')](_0x378818)[_0x8d3a('0xbb')](loggerCatch(_0x8d3a('0xf2')));if(_0x378818[_0x8d3a('0xf3')]+_0x378818['countcongestionretry']+_0x378818[_0x8d3a('0xf4')]+_0x378818[_0x8d3a('0xf5')]+_0x378818[_0x8d3a('0xf6')]+_0x378818[_0x8d3a('0xf7')]+_0x378818[_0x8d3a('0xf8')]+_0x378818[_0x8d3a('0xf9')]>=_0x135d78['dialGlobalMaxRetry']){_0x27cbfc[_0x8d3a('0xfb')](_0x378818,_0x59a75e,_0x51d4c6,_0x8d3a('0xfc'));}else{if(_0x378818['countmachineretry']>=_0x135d78[_0x8d3a('0xfd')]){_0x27cbfc[_0x8d3a('0xfe')](_0x378818,_0x59a75e,_0x51d4c6,_0x8d3a('0xff'));}else{_0x27cbfc[_0x8d3a('0xc2')]({'active':![],'countmachineretry':_0x378818[_0x8d3a('0xf8')],'scheduledat':moment()[_0x8d3a('0x100')](_0x135d78['dialMachineRetryFrequency'],_0x8d3a('0x102'))[_0x8d3a('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x378818[_0x8d3a('0xd6')],'ListId':_0x378818[_0x8d3a('0xd7')],'VoiceQueueId':_0x378818[_0x8d3a('0xd8')]||undefined,'CampaignId':_0x378818[_0x8d3a('0xd9')]||undefined})[_0x8d3a('0xbb')](loggerCatch(_0x8d3a('0x103')));_0x59a75e({'reschedule':0x1});}}});}}};Dialer[_0x8d3a('0xaf')]['syncHangup']=function(_0xf09a45){var _0x3548ec=this[_0x8d3a('0x24')][_0xf09a45[_0x8d3a('0xe2')]];var _0xaecbc8=this;var _0x1db1ea;if(_0x3548ec&&_0x3548ec[_0x8d3a('0x4c')]===_0x8d3a('0x7b')){delete this['uniqueId'][_0xf09a45[_0x8d3a('0xe2')]];this[_0x8d3a('0xb6')](this[_0x8d3a('0x1e')][_0x3548ec[_0x8d3a('0xb7')]]);this[_0x8d3a('0x1e')][_0x3548ec[_0x8d3a('0xb7')]][_0x8d3a('0x106')]+=0x1;_0x1db1ea=new Hangup(_0x3548ec,_0xf09a45);this[_0x8d3a('0xce')](_0x1db1ea)[_0x8d3a('0xbb')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x8d3a('0xcc')](_0x1db1ea)['catch'](loggerCatch(_0x8d3a('0x107')));}if(_0x3548ec&&_0x3548ec[_0x8d3a('0x4c')]!==_0x8d3a('0x7b')&&isNotNull(this[_0x8d3a('0x1d')][_0x3548ec[_0x8d3a('0xb7')]][_0x8d3a('0x108')])){delete this[_0x8d3a('0x24')][_0xf09a45[_0x8d3a('0xe2')]];this[_0x8d3a('0xb6')](this[_0x8d3a('0x1d')][_0x3548ec[_0x8d3a('0xb7')]]);this[_0x8d3a('0x1d')][_0x3548ec['queue']]['outboundAnswerCallsDay']+=0x1;this[_0x8d3a('0x1d')][_0x3548ec[_0x8d3a('0xb7')]][_0x8d3a('0x5f')]+=0x1;_0x1db1ea=new Hangup(_0x3548ec,_0xf09a45);_0x1db1ea[_0x8d3a('0xab')]=0x10;_0x1db1ea[_0x8d3a('0xac')]=_0x8d3a('0x109');_0x1db1ea[_0x8d3a('0xf0')]=_0x8d3a('0x10a');this[_0x8d3a('0xce')](_0x1db1ea)[_0x8d3a('0xbb')](loggerCatch(_0x8d3a('0x10b')));this[_0x8d3a('0xcc')](_0x1db1ea)[_0x8d3a('0xbb')](loggerCatch(_0x8d3a('0x107')));}if(_0x3548ec&&_0x3548ec[_0x8d3a('0x4c')]!==_0x8d3a('0x7b')&&!isNotNull(this[_0x8d3a('0x1d')][_0x3548ec[_0x8d3a('0xb7')]][_0x8d3a('0x108')])){delete this[_0x8d3a('0x24')][_0xf09a45['uniqueid']];this[_0x8d3a('0xb6')](this[_0x8d3a('0x1d')][_0x3548ec['queue']]);this['voiceQueues'][_0x3548ec[_0x8d3a('0xb7')]][_0x8d3a('0x10c')]+=0x1;_0x1db1ea=new Hangup(_0x3548ec,_0xf09a45);_0x1db1ea['state']=0xc;_0x1db1ea[_0x8d3a('0xac')]=_0xf09a45[_0x8d3a('0x10d')];_0x1db1ea['membername']='Unknow';this[_0x8d3a('0xce')](_0x1db1ea)[_0x8d3a('0xbb')](loggerCatch(_0x8d3a('0x10b')));this['moveContactManagedDialer'](_0x1db1ea)[_0x8d3a('0xbb')](loggerCatch(_0x8d3a('0x107')));}};Dialer[_0x8d3a('0xaf')][_0x8d3a('0x31')]=function(_0x847fd3){var _0x39ed98=this['uniqueId'][_0x847fd3['uniqueid']];var _0x4bbd00=this;if(this['voiceQueues'][_0x847fd3[_0x8d3a('0xb7')]]){if(_0x39ed98&&_0x39ed98[_0x8d3a('0x4c')]!==_0x8d3a('0x7b')){delete this[_0x8d3a('0x24')][_0x847fd3[_0x8d3a('0xe2')]];this['voiceQueues'][_0x847fd3['queue']][_0x8d3a('0x60')]+=0x1;var _0x20f9d8=new AgentComplete(_0x39ed98,_0x847fd3);if(_0x847fd3['reason']==='agent'){_0x20f9d8[_0x8d3a('0x10e')]=this[_0x8d3a('0x1d')][_0x847fd3['queue']][_0x8d3a('0x10f')]&&this['voiceQueues'][_0x847fd3[_0x8d3a('0xb7')]][_0x8d3a('0x110')]?moment()['format'](_0x8d3a('0x111')):undefined;}this[_0x8d3a('0xce')](_0x20f9d8)['catch'](loggerCatch(_0x8d3a('0x112')));this[_0x8d3a('0xcc')](_0x20f9d8)[_0x8d3a('0xbb')](loggerCatch(_0x8d3a('0x113')));}}};Dialer[_0x8d3a('0xaf')][_0x8d3a('0x2b')]=function(_0x5a0e5c){if(this[_0x8d3a('0x1d')][_0x5a0e5c[_0x8d3a('0xb7')]]){if(this[_0x8d3a('0x24')][_0x5a0e5c['uniqueid']]&&this[_0x8d3a('0x24')][_0x5a0e5c['uniqueid']][_0x8d3a('0x4c')]!=='ivr'){this[_0x8d3a('0xb6')](this[_0x8d3a('0x1d')][_0x5a0e5c[_0x8d3a('0xb7')]]);this[_0x8d3a('0x24')][_0x5a0e5c['uniqueid']][_0x8d3a('0x114')]=moment()[_0x8d3a('0x7c')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer['prototype'][_0x8d3a('0x115')]=function(_0x29c3ad){this[_0x8d3a('0xce')](_0x29c3ad)[_0x8d3a('0xbb')](loggerCatch('[syncAgentComplete][createHistory]'));this['moveContactManagedDialer'](_0x29c3ad)[_0x8d3a('0xbb')](loggerCatch(_0x8d3a('0x116')));};Dialer['prototype'][_0x8d3a('0x2d')]=function(_0x4046ca){var _0x30308f=this['uniqueId'][_0x4046ca[_0x8d3a('0xe2')]];var _0xcfa363=this;if(this[_0x8d3a('0x1d')][_0x4046ca[_0x8d3a('0xb7')]]){if(_0x30308f&&_0x30308f['type']!==_0x8d3a('0x7b')){delete this['uniqueId'][_0x4046ca[_0x8d3a('0xe2')]];this[_0x8d3a('0xb6')](this[_0x8d3a('0x1d')][_0x4046ca['queue']]);_0x30308f[_0x8d3a('0x117')]=moment()['format'](_0x8d3a('0x111'));var _0x3467f7=new QueueCallerAbandon(_0x30308f,_0x4046ca);if(getSeconds(_0x30308f['droptime'],_0x30308f[_0x8d3a('0x118')])>=_0x30308f[_0x8d3a('0x119')]){this['voiceQueues'][_0x4046ca[_0x8d3a('0xb7')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x8d3a('0x1d')][_0x4046ca['queue']][_0x8d3a('0x65')]+=0x1;this[_0x8d3a('0x1d')][_0x4046ca[_0x8d3a('0xb7')]][_0x8d3a('0x6e')]+=0x1;_0x3467f7['state']=0xa;_0x3467f7[_0x8d3a('0xac')]=_0x8d3a('0x11a');_0x3467f7['dropreason']=_0x8d3a('0x11b');_0x3467f7[_0x8d3a('0x10e')]=this[_0x8d3a('0x1d')][_0x4046ca['queue']][_0x8d3a('0x10f')]?moment()[_0x8d3a('0x7c')](_0x8d3a('0x111')):undefined;_0x3467f7['countdropretry']+=0x1;_0x3467f7[_0x8d3a('0xf1')]+=0x1;if(_0x3467f7[_0x8d3a('0xf6')]>=this[_0x8d3a('0x1d')][_0x4046ca[_0x8d3a('0xb7')]][_0x8d3a('0x11c')]){this[_0x8d3a('0x115')](_0x3467f7);}else{this[_0x8d3a('0xc2')]({'active':![],'countdropretry':_0x3467f7['countdropretry'],'scheduledat':moment()[_0x8d3a('0x100')](this['voiceQueues'][_0x4046ca[_0x8d3a('0xb7')]][_0x8d3a('0x11d')],_0x8d3a('0x102'))[_0x8d3a('0x7c')](_0x8d3a('0x111')),'ContactId':_0x30308f[_0x8d3a('0xd6')],'ListId':_0x30308f[_0x8d3a('0xd7')],'VoiceQueueId':_0x30308f[_0x8d3a('0xd8')]||undefined,'CampaignId':_0x30308f[_0x8d3a('0xd9')]||undefined})[_0x8d3a('0xbb')](loggerCatch(_0x8d3a('0x11e')));var _0x599a7e=new History(_0x3467f7);_0x599a7e[_0x8d3a('0xab')]=0xa;_0x599a7e[_0x8d3a('0xac')]=_0x8d3a('0x11a');_0x599a7e[_0x8d3a('0xae')]=moment()[_0x8d3a('0x7c')](_0x8d3a('0x111'));_0x599a7e['endtime']=_0x599a7e[_0x8d3a('0xae')];_0x599a7e[_0x8d3a('0x11f')]=_0x3467f7[_0x8d3a('0x11f')];_0x599a7e[_0x8d3a('0x120')]=_0x3467f7[_0x8d3a('0x120')];this[_0x8d3a('0xce')](_0x599a7e)[_0x8d3a('0xbb')](loggerCatch(_0x8d3a('0x121')));}}else{this[_0x8d3a('0x1d')][_0x4046ca[_0x8d3a('0xb7')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x8d3a('0x1d')][_0x4046ca[_0x8d3a('0xb7')]][_0x8d3a('0x64')]+=0x1;_0x3467f7[_0x8d3a('0xab')]=0xb;_0x3467f7[_0x8d3a('0xac')]=_0x8d3a('0x122');_0x3467f7[_0x8d3a('0x123')]='CALLEREXIT';_0x3467f7[_0x8d3a('0xf7')]+=0x1;_0x3467f7[_0x8d3a('0xf1')]+=0x1;if(_0x3467f7[_0x8d3a('0xf7')]>=this[_0x8d3a('0x1d')][_0x4046ca[_0x8d3a('0xb7')]][_0x8d3a('0x124')]){this[_0x8d3a('0x115')](_0x3467f7);}else{this[_0x8d3a('0xc2')]({'active':![],'countabandonedretry':_0x3467f7[_0x8d3a('0xf7')],'scheduledat':moment()['add'](this[_0x8d3a('0x1d')][_0x4046ca['queue']][_0x8d3a('0x125')],_0x8d3a('0x102'))[_0x8d3a('0x7c')](_0x8d3a('0x111')),'ContactId':_0x30308f[_0x8d3a('0xd6')],'ListId':_0x30308f[_0x8d3a('0xd7')],'VoiceQueueId':_0x30308f[_0x8d3a('0xd8')]||undefined,'CampaignId':_0x30308f[_0x8d3a('0xd9')]||undefined})['catch'](loggerCatch(_0x8d3a('0x126')));var _0x599a7e=new History(_0x3467f7);_0x599a7e[_0x8d3a('0xab')]=0xb;_0x599a7e[_0x8d3a('0xac')]=_0x8d3a('0x122');_0x599a7e[_0x8d3a('0xae')]=moment()[_0x8d3a('0x7c')](_0x8d3a('0x111'));_0x599a7e[_0x8d3a('0xad')]=_0x599a7e['starttime'];_0x599a7e['calleridname']=_0x3467f7[_0x8d3a('0x11f')];_0x599a7e['calleridnum']=_0x3467f7[_0x8d3a('0x120')];this[_0x8d3a('0xce')](_0x599a7e)[_0x8d3a('0xbb')](loggerCatch(_0x8d3a('0x127')));}}}}};Dialer['prototype']['syncNewExten']=function(_0x4ef00b){if(this['actions'][_0x4ef00b[_0x8d3a('0xe2')]]){this['actions'][_0x4ef00b[_0x8d3a('0xe2')]][_0x8d3a('0xb4')]=_0x4ef00b[_0x8d3a('0xb4')];}if(this[_0x8d3a('0x24')][_0x4ef00b[_0x8d3a('0xe2')]]){this[_0x8d3a('0x24')][_0x4ef00b['uniqueid']][_0x8d3a('0xb4')]=_0x4ef00b[_0x8d3a('0xb4')];}};Dialer['prototype'][_0x8d3a('0x38')]=function(_0x283482){if(strategy[this[_0x8d3a('0x1d')][this[_0x8d3a('0x22')][_0x283482[_0x8d3a('0x128')]][_0x8d3a('0xb7')]][_0x8d3a('0x4e')]]===_0x8d3a('0x129')){if(this[_0x8d3a('0x22')][_0x283482['actionid']]&&_[_0x8d3a('0xb2')](this[_0x8d3a('0x22')][_0x283482[_0x8d3a('0x128')]]['locked'])&&_0x283482[_0x8d3a('0xde')]==='1'&&_0x283482[_0x8d3a('0x12a')]==='0'){if(this[_0x8d3a('0x1f')][_0x283482[_0x8d3a('0x12b')]]){if(!this['agents'][_0x283482[_0x8d3a('0x12b')]][_0x8d3a('0x12c')]){this[_0x8d3a('0x1f')][_0x283482['stateinterface']][_0x8d3a('0x12c')]=!![];this[_0x8d3a('0x22')][_0x283482[_0x8d3a('0x128')]][_0x8d3a('0x12c')]=!![];this[_0x8d3a('0x22')][_0x283482['actionid']]['stateinterface']=_0x283482['stateinterface'];}}}}else if((strategy[this[_0x8d3a('0x1d')][this[_0x8d3a('0x22')][_0x283482['actionid']][_0x8d3a('0xb7')]][_0x8d3a('0x4e')]]||_0x8d3a('0x19'))===_0x8d3a('0x19')){if(this[_0x8d3a('0x22')][_0x283482[_0x8d3a('0x128')]]){if(this[_0x8d3a('0x1f')][_0x283482['stateinterface']]){this[_0x8d3a('0x22')][_0x283482['actionid']][_0x8d3a('0x12b')]=_0x283482[_0x8d3a('0x12b')];if(_[_0x8d3a('0xb2')](this['queueBooked'][this['actions'][_0x283482['actionid']][_0x8d3a('0xb7')]])){this[_0x8d3a('0x28')][this[_0x8d3a('0x22')][_0x283482[_0x8d3a('0x128')]][_0x8d3a('0xb7')]]=[];}this['queueBooked'][this[_0x8d3a('0x22')][_0x283482[_0x8d3a('0x128')]][_0x8d3a('0xb7')]][_0x8d3a('0x12d')](_[_0x8d3a('0xd4')](_[_0x8d3a('0xd5')](this[_0x8d3a('0x22')][_0x283482['actionid']],[_0x8d3a('0x12e'),_0x8d3a('0x12b')]),{'status':_0x283482[_0x8d3a('0xde')],'paused':_0x283482[_0x8d3a('0x12a')]}));}}}};function unlockQueueStatus(_0x37ff40,_0x31396f){setTimeout(function(){if(_[_0x8d3a('0x86')](_0x37ff40[_0x8d3a('0x12f')])){loggerBooked['error'](_0x8d3a('0x130'),_0x31396f);}_0x37ff40[_0x8d3a('0x12f')]=!![];loggerBooked[_0x8d3a('0x7e')](_0x8d3a('0x131'),_0x31396f,JSON[_0x8d3a('0x47')](_[_0x8d3a('0xd5')](_0x37ff40,[_0x8d3a('0x3e'),_0x8d3a('0x12f')])));},0x1f3);}Dialer['prototype'][_0x8d3a('0x3a')]=function(_0x5f227a){var _0x3647ca=this;var _0x4aa618=_0x3647ca[_0x8d3a('0x1d')][_0x3647ca['actions'][_0x5f227a[_0x8d3a('0x128')]][_0x8d3a('0xb7')]];if(strategy[this[_0x8d3a('0x1d')][this[_0x8d3a('0x22')][_0x5f227a['actionid']][_0x8d3a('0xb7')]][_0x8d3a('0x4e')]]===_0x8d3a('0x129')){if(this[_0x8d3a('0x22')][_0x5f227a[_0x8d3a('0x128')]]&&this[_0x8d3a('0x22')][_0x5f227a[_0x8d3a('0x128')]][_0x8d3a('0x12b')]){this[_0x8d3a('0x94')][_0x8d3a('0x132')](this['actions'][_0x5f227a[_0x8d3a('0x128')]][_0x8d3a('0x12e')],this[_0x8d3a('0x22')][_0x5f227a[_0x8d3a('0x128')]]['stateinterface'])[_0x8d3a('0xbb')](function(_0x206cd9){logger[_0x8d3a('0x98')](_0x8d3a('0x133'),util[_0x8d3a('0x99')](_0x206cd9,{'showHidden':![],'depth':null}));})[_0x8d3a('0x134')](function(){_0x3647ca['updateOriginated'](_0x3647ca[_0x8d3a('0x1d')][_0x3647ca[_0x8d3a('0x22')][_0x5f227a[_0x8d3a('0x128')]][_0x8d3a('0xb7')]]);_0x3647ca[_0x8d3a('0x1f')][_0x3647ca[_0x8d3a('0x22')][_0x5f227a['actionid']][_0x8d3a('0x12b')]][_0x8d3a('0x12c')]=![];delete _0x3647ca['actions'][_0x5f227a[_0x8d3a('0x128')]];unlockQueueStatus(_0x4aa618);});}else{this[_0x8d3a('0xb6')](this[_0x8d3a('0x1d')][this[_0x8d3a('0x22')][_0x5f227a[_0x8d3a('0x128')]][_0x8d3a('0xb7')]]);this[_0x8d3a('0xc2')]({'active':![],'ContactId':this[_0x8d3a('0x22')][_0x5f227a[_0x8d3a('0x128')]][_0x8d3a('0xd6')],'ListId':this[_0x8d3a('0x22')][_0x5f227a[_0x8d3a('0x128')]][_0x8d3a('0xd7')],'VoiceQueueId':this['actions'][_0x5f227a[_0x8d3a('0x128')]][_0x8d3a('0xd8')]||undefined,'CampaignId':this['actions'][_0x5f227a['actionid']]['CampaignId']||undefined})['catch'](loggerCatch(_0x8d3a('0x135')));delete this[_0x8d3a('0x22')][_0x5f227a[_0x8d3a('0x128')]];unlockQueueStatus(_0x4aa618);}}else if((strategy[this[_0x8d3a('0x1d')][this['actions'][_0x5f227a[_0x8d3a('0x128')]][_0x8d3a('0xb7')]][_0x8d3a('0x4e')]]||'rrmemory')===_0x8d3a('0x19')){var _0x3e2328;if(this[_0x8d3a('0x22')][_0x5f227a[_0x8d3a('0x128')]]&&!_[_0x8d3a('0x44')](this[_0x8d3a('0x28')][this['actions'][_0x5f227a['actionid']]['queue']])){if(this[_0x8d3a('0x29')][_0x3647ca[_0x8d3a('0x22')][_0x5f227a['actionid']]['queue']]){this[_0x8d3a('0x29')][_0x3647ca[_0x8d3a('0x22')][_0x5f227a[_0x8d3a('0x128')]]['queue']]=this[_0x8d3a('0x29')][this[_0x8d3a('0x22')][_0x5f227a[_0x8d3a('0x128')]][_0x8d3a('0xb7')]]?this[_0x8d3a('0x29')][this[_0x8d3a('0x22')][_0x5f227a[_0x8d3a('0x128')]]['queue']]:this[_0x8d3a('0x28')][this['actions'][_0x5f227a['actionid']][_0x8d3a('0xb7')]]?this[_0x8d3a('0x28')][this[_0x8d3a('0x22')][_0x5f227a[_0x8d3a('0x128')]][_0x8d3a('0xb7')]][_0x8d3a('0x136')]||0x0:0x0;}this['queueBooked'][this[_0x8d3a('0x22')][_0x5f227a[_0x8d3a('0x128')]][_0x8d3a('0xb7')]]['_rr']=this[_0x8d3a('0x29')][this[_0x8d3a('0x22')][_0x5f227a[_0x8d3a('0x128')]][_0x8d3a('0xb7')]];for(var _0x380489=0x0;_0x380489=0x0;})[_0x8d3a('0xbb')](myreject(_0x22c7ef)));}}else{_0x53bc24[_0x8d3a('0x12d')](ami[_0x8d3a('0xb3')]({'action':_0x8d3a('0x14e'),'command':util['format'](_0x8d3a('0x14f'),_0x5934e7,!_['isUndefined'](config[_0x8d3a('0x151')][_0x309f14])?_0x309f14:'')})[_0x8d3a('0xba')](function(_0x208472){return _0x208472['content'][_0x8d3a('0x152')](_0x8d3a('0x153'))>=0x0;})[_0x8d3a('0xbb')](myreject(_0x22c7ef)));}BPromise[_0x8d3a('0x154')](_0x53bc24)[_0x8d3a('0xba')](function(_0x1d900c){var _0x241bdd=_['some'](_0x1d900c);if(_0x241bdd){return _0x53bb5e(_0x241bdd);}else{_0x49236e[_0x8d3a('0x3d')]=_0x45ecb0?_0x8d3a('0x155'):_0x8d3a('0x156');return _0x22c7ef(msgResponse('[ifTime][promiseAll]','Failure',_0x8d3a('0x157')+_0x45ecb0+'\x20'+_0x2eb8e5+_0x8d3a('0x158')+util[_0x8d3a('0x99')](_0x5934e7,{'showHidden':![],'depth':null})+_0x8d3a('0x159')+_0x309f14));}})['catch'](function(_0x54a9b7){return _0x22c7ef(msgResponse(_0x8d3a('0x146'),_0x8d3a('0x149'),JSON[_0x8d3a('0x47')](_0x54a9b7)));});});};Dialer[_0x8d3a('0xaf')][_0x8d3a('0x15a')]=function(_0x52a88b){var _0x478bd4=this;return function(){switch(_0x52a88b[_0x8d3a('0x5a')]){case _0x8d3a('0x15b'):freeVariablesPredictive(_0x52a88b);_0x478bd4[_0x8d3a('0x15c')](_0x52a88b,0x1);break;case _0x8d3a('0x15d'):freeVariablesPredictive(_0x52a88b);_0x478bd4['handlePower'](_0x52a88b,_0x52a88b[_0x8d3a('0x15e')]);break;case _0x8d3a('0x15f'):_0x478bd4['predictive'](_0x52a88b);break;case _0x8d3a('0x7'):freeVariablesPredictive(_0x52a88b);_0x478bd4['handlePower'](_0x52a88b,0x1);break;default:freeVariablesPredictive(_0x52a88b);logger[_0x8d3a('0x98')](_0x8d3a('0x160'),_0x52a88b[_0x8d3a('0x3e')],_0x8d3a('0x161'));}};};Dialer[_0x8d3a('0xaf')]['launchHandleIvr']=function(_0x2a7204){var _0x11b235=this;return function(){_0x11b235[_0x8d3a('0x162')](_0x2a7204);};};Dialer[_0x8d3a('0xaf')][_0x8d3a('0xa')]=function(_0x59e658){var _0x4d861d=this;if(isNotPreview(_0x59e658[_0x8d3a('0x5a')])){if(isVoiceQueueOutbound(_0x59e658[_0x8d3a('0x4c')])&&isActive(_0x59e658['dialActive'])){_0x59e658[_0x8d3a('0xa5')]=!![];BPromise[_0x8d3a('0xb9')]()[_0x8d3a('0xba')](checkIsLoggedIn(_0x59e658,_0x59e658[_0x8d3a('0x51')]))['then'](checkIsActive(_0x59e658,_0x59e658['dialActive']))[_0x8d3a('0xba')](checkInterval(_0x59e658))[_0x8d3a('0xba')](_0x4d861d[_0x8d3a('0x141')](_0x59e658))[_0x8d3a('0xba')](_0x4d861d[_0x8d3a('0x145')](_0x59e658[_0x8d3a('0x163')],_0x59e658[_0x8d3a('0x164')],_0x59e658[_0x8d3a('0x3e')],_0x59e658))[_0x8d3a('0xba')](_0x4d861d[_0x8d3a('0x147')](_0x59e658[_0x8d3a('0x40')],_0x59e658[_0x8d3a('0x164')],_0x59e658['name'],_0x59e658))[_0x8d3a('0xba')](_0x4d861d[_0x8d3a('0x15a')](_0x59e658))[_0x8d3a('0xbb')](loggerCatchQueueSummary(_0x8d3a('0x165'),_0x59e658));}else{notSendMessagesQueue(_0x59e658);}}else{freeVariablesPredictive(_0x59e658);}};Dialer['prototype'][_0x8d3a('0x140')]=function(){var _0xb3b6b4=this;var _0x2ee14f;for(var _0x443e31 in this[_0x8d3a('0x1e')]){if(typeof this[_0x8d3a('0x1e')][_0x443e31]!==_0x8d3a('0x9c')){_0x2ee14f=this['campaigns'][_0x443e31];if(isCampaignIvr(_0x2ee14f[_0x8d3a('0x4c')])&&isActive(_0x2ee14f[_0x8d3a('0x78')])){_0x2ee14f[_0x8d3a('0xa5')]=!![];BPromise[_0x8d3a('0xb9')]()[_0x8d3a('0xba')](checkIsActive(_0x2ee14f,_0x2ee14f['active']))[_0x8d3a('0xba')](checkInterval(_0x2ee14f))[_0x8d3a('0xba')](_0xb3b6b4[_0x8d3a('0x141')](_0x2ee14f))[_0x8d3a('0xba')](_0xb3b6b4[_0x8d3a('0x145')](_0x2ee14f[_0x8d3a('0x163')],_0x2ee14f[_0x8d3a('0x164')],_0x2ee14f[_0x8d3a('0x3e')],_0x2ee14f))['then'](_0xb3b6b4[_0x8d3a('0x147')](_0x2ee14f[_0x8d3a('0x40')],_0x2ee14f['dialTimezone'],_0x2ee14f[_0x8d3a('0x3e')],_0x2ee14f))[_0x8d3a('0xba')](_0xb3b6b4[_0x8d3a('0x166')](_0x2ee14f))[_0x8d3a('0xbb')](loggerCatchQueueSummary(_0x8d3a('0x167'),_0x2ee14f));}else{notSendMessagesCampaign(_0x2ee14f);}}}};function getCallerIdRandom(_0x4099a4,_0x57dd8e){var _0x21a121;var _0x28e0a1;var _0x2e45ec;if(_0x57dd8e<=0x0){_0x57dd8e=0x1;}_0x21a121=new RegExp(_0x8d3a('0x168')+_0x57dd8e+'}$');_0x28e0a1=Math[_0x8d3a('0x169')](0xa,_0x57dd8e-0x1);_0x2e45ec=Math[_0x8d3a('0x169')](0xa,_0x57dd8e)-0x1;return util[_0x8d3a('0x7c')]('%s',_[_0x8d3a('0x16a')](_0x4099a4,_0x21a121,_['random'](_0x28e0a1,_0x2e45ec)));}function extractCalleridName(_0x32620e){var _0x5f0c33=_0x32620e['match'](/"(.*?)"/);return _0x5f0c33?_0x5f0c33[0x1]:_0x32620e;}function extractCalleridNumber(_0x2f4db8){var _0x9750ce=_0x2f4db8[_0x8d3a('0x16b')](/<(.*?)>/);return _0x9750ce?_0x9750ce[0x1]:_0x2f4db8;}Dialer[_0x8d3a('0xaf')]['actionOriginate']=function(_0x5b8a16,_0xaabfb8){var _0x5d4507=this;var _0x2edadf=uuid['v4']();this[_0x8d3a('0x22')][_0x2edadf]=new Action(_0x5b8a16,_0xaabfb8,_0x2edadf);return new BPromise(function(_0x230b73,_0x558d6b){if(_[_0x8d3a('0x86')](_0x5b8a16)&&typeof _0x5b8a16!==_0x8d3a('0x16c')){return _0x558d6b(msgResponse('originate',_0x8d3a('0x149'),_0x8d3a('0x16d')));}if(_['isUndefined'](_0xaabfb8[_0x8d3a('0x16e')][_0x8d3a('0x16f')])||_0xaabfb8[_0x8d3a('0x16e')][_0x8d3a('0x16f')]===null){return _0x558d6b(msgResponse(_0x8d3a('0x170'),_0x8d3a('0x149'),_0x8d3a('0x171')));}var _0x484549={'XMD-CALLERID':_0x5d4507[_0x8d3a('0x22')][_0x2edadf][_0x8d3a('0x172')](),'XMD-AGI':_0x5b8a16['dialQueueProject']?util[_0x8d3a('0x7c')](_0x8d3a('0x173'),ipAgi,_0x5b8a16[_0x8d3a('0x108')]):'NONE','XMD-AGIAFTER':_0x5b8a16[_0x8d3a('0x10f')]?util[_0x8d3a('0x7c')]('\x22agi://%s/square,%s\x22',ipAgi,_0x5b8a16[_0x8d3a('0x10f')]):'NONE','XMD-QUEUE':_0x5b8a16[_0x8d3a('0x4c')]===_0x8d3a('0x4d')?util['format'](_0x8d3a('0x174'),_0x5b8a16[_0x8d3a('0x3e')],_0x5b8a16['dialQueueOptions']||'',_0x5b8a16['dialAgiAfterHangupAgent']?'c':'',_0x5b8a16['dialQueueTimeout']||0x3):'NONE','XMD-CONTACTID':_0xaabfb8[_0x8d3a('0xd6')],'XMD-CDRTYPE':_0x8d3a('0x175'),'CALLERID(all)':_0x5d4507[_0x8d3a('0x22')][_0x2edadf]['getCaller'](),'XMD-AMD':_0x5b8a16[_0x8d3a('0xe5')]?_0x8d3a('0x176'):_0x8d3a('0x177'),'XMD-DESTINATION':_0x8d3a('0xe4')};if(_0x5b8a16[_0x8d3a('0xe5')]){_0x484549[_0x8d3a('0x178')]=_0x5b8a16['dialAMDInitialSilence']||0x9c4;_0x484549['XMD-AMDGREETING']=_0x5b8a16['dialAMDGreeting']||0x5dc;_0x484549[_0x8d3a('0x179')]=_0x5b8a16[_0x8d3a('0x17a')]||0x320;_0x484549[_0x8d3a('0x17b')]=_0x5b8a16['dialAMDTotalAnalysisTime']||0x1388;_0x484549['XMD-AMDMINWORDLENGTH']=_0x5b8a16[_0x8d3a('0x17c')]||0x64;_0x484549[_0x8d3a('0x17d')]=_0x5b8a16[_0x8d3a('0x17e')]||0x32;_0x484549[_0x8d3a('0x17f')]=_0x5b8a16[_0x8d3a('0x180')]||0x3;_0x484549[_0x8d3a('0x181')]=_0x5b8a16[_0x8d3a('0x182')]||0x100;_0x484549[_0x8d3a('0x183')]=_0x5b8a16['dialAMDMaximumWordLength']||0x1388;}if(_0x5b8a16[_0x8d3a('0x4c')]==='outbound'){_0x484549[_0x8d3a('0x184')]=_0xaabfb8[_0x8d3a('0xd8')];}else{_0x484549[_0x8d3a('0x185')]=_0xaabfb8[_0x8d3a('0xd9')];}for(var _0x5b0ad6 in _0xaabfb8['Contact']){if(typeof _0xaabfb8[_0x8d3a('0x16e')][_0x5b0ad6]!==_0x8d3a('0x9c')){if(isNotNull(_0xaabfb8[_0x8d3a('0x16e')][_0x5b0ad6])&&_0x5b0ad6!=='id'&&_0x5b0ad6!==_0x8d3a('0x186')&&_0x5b0ad6!==_0x8d3a('0x187')&&_0x5b0ad6!=='updatedAt'){_0x484549[util[_0x8d3a('0x7c')](_0x8d3a('0x188'),_0x8d3a('0x189'),_['toUpper'](_0x5b0ad6))]=_0xaabfb8[_0x8d3a('0x16e')][_0x5b0ad6];}}}var _0x415dc5=_0x5d4507[_0x8d3a('0xdc')](_0x5b8a16[_0x8d3a('0x77')])?getCallerId(_0x5b8a16[_0x8d3a('0x77')][_0x8d3a('0x79')],_0x5b8a16[_0x8d3a('0x5b')],_0x5b8a16[_0x8d3a('0x18a')]>0x0?getCallerIdRandom(_0x5b8a16[_0x8d3a('0x5c')],_0x5b8a16[_0x8d3a('0x18a')]):_0x5b8a16['dialOriginateCallerIdNumber']):getCallerId(_[_0x8d3a('0xb2')](_0x5b8a16[_0x8d3a('0x142')])?_0x5b8a16[_0x8d3a('0x77')][_0x8d3a('0x79')]:_0x5b8a16['TrunkBackup'][_0x8d3a('0x79')],_0x5b8a16[_0x8d3a('0x5b')],_0x5b8a16[_0x8d3a('0x18a')]>0x0?getCallerIdRandom(_0x5b8a16['dialOriginateCallerIdNumber'],_0x5b8a16[_0x8d3a('0x18a')]):_0x5b8a16[_0x8d3a('0x5c')]);if(_0x415dc5){_0x484549[_0x8d3a('0x18b')]=_0x5d4507['actions'][_0x2edadf][_0x8d3a('0x18c')]=extractCalleridName(_0x415dc5);_0x484549[_0x8d3a('0x18d')]=_0x5d4507[_0x8d3a('0x22')][_0x2edadf][_0x8d3a('0x18e')]=extractCalleridNumber(_0x415dc5);}return ami[_0x8d3a('0xb3')]({'actionid':_0x2edadf,'action':_0x8d3a('0x170'),'channel':_0x5d4507[_0x8d3a('0xdc')](_0x5b8a16[_0x8d3a('0x77')])?util[_0x8d3a('0x7c')](_0x8d3a('0x18f'),_0x5b8a16[_0x8d3a('0x77')]['name'],isNotNull(_0x5b8a16['dialPrefix'])?_0x5b8a16[_0x8d3a('0x5e')]['trim']()||'':'',_0x5b8a16['dialCutDigit']>0x0?_0xaabfb8['Contact'][_0x8d3a('0x16f')]['substring'](_0x5b8a16[_0x8d3a('0x190')]):_0xaabfb8['Contact'][_0x8d3a('0x16f')]):util['format'](_0x8d3a('0x18f'),_[_0x8d3a('0xb2')](_0x5b8a16[_0x8d3a('0x142')])?_0x5b8a16[_0x8d3a('0x77')][_0x8d3a('0x3e')]:_0x5b8a16[_0x8d3a('0x142')][_0x8d3a('0x3e')],isNotNull(_0x5b8a16['dialPrefix'])?_0x5b8a16['dialPrefix'][_0x8d3a('0x191')]()||'':'',_0x5b8a16[_0x8d3a('0x190')]>0x0?_0xaabfb8[_0x8d3a('0x16e')][_0x8d3a('0x16f')][_0x8d3a('0x192')](_0x5b8a16[_0x8d3a('0x190')]):_0xaabfb8['Contact'][_0x8d3a('0x16f')]),'callerid':_0x415dc5,'Exten':_0x8d3a('0xe4'),'Context':_0x8d3a('0x193'),'Priority':'1','variable':_0x484549,'timeout':(_0x5b8a16[_0x8d3a('0x5d')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2edadf})[_0x8d3a('0xba')](function(_0x318fac){return _0x230b73(_0x318fac);})['catch'](function(_0x516392){_0x5b8a16['outboundOriginateFailureCallsDay']+=0x1;var _0x283a84=new History(_0x5d4507[_0x8d3a('0x22')][_0x2edadf]);logger['error'](util[_0x8d3a('0x7c')]('[originateError]:\x20%s',JSON[_0x8d3a('0x47')](_0x516392)));_0x283a84['state']=0xe;_0x283a84['statedesc']=_0x8d3a('0x194');_0x283a84[_0x8d3a('0xae')]=moment()[_0x8d3a('0x7c')](_0x8d3a('0x111'));_0x283a84[_0x8d3a('0xad')]=_0x283a84[_0x8d3a('0xae')];_0x5d4507[_0x8d3a('0xce')](_0x283a84)[_0x8d3a('0xbb')](loggerCatch(_0x8d3a('0x195')));_0x5d4507[_0x8d3a('0xcc')](_0x283a84)[_0x8d3a('0xbb')](loggerCatch(_0x8d3a('0x195')))['finally'](function(){delete _0x5d4507[_0x8d3a('0x22')][_0x2edadf];return _0x558d6b(msgResponse(_0x8d3a('0x170'),_0x8d3a('0x46'),_0x8d3a('0x196')));});});});};Dialer[_0x8d3a('0xaf')][_0x8d3a('0x2f')]=function(_0x2ff561){var _0xaf250f=this[_0x8d3a('0x22')][_0x2ff561[_0x8d3a('0x128')]];if(_0xaf250f){delete this[_0x8d3a('0x22')][_0x2ff561[_0x8d3a('0x128')]];_0xaf250f[_0x8d3a('0x118')]=moment()[_0x8d3a('0x7c')](_0x8d3a('0x111'));var _0xf7eba1=_0xaf250f['type']===_0x8d3a('0x7b')?this[_0x8d3a('0x1e')][_0xaf250f[_0x8d3a('0xb7')]]:this['voiceQueues'][_0xaf250f[_0x8d3a('0x197')]()];if(!this[_0x8d3a('0xdb')](_0x2ff561['response'])){this[_0x8d3a('0xb6')](_0xf7eba1);return this[_0x8d3a('0x198')](_0xaf250f,_0xf7eba1,_0x2ff561)[_0x8d3a('0xbb')](loggerCatch(_0x8d3a('0x199')));}this[_0x8d3a('0x24')][_0x2ff561[_0x8d3a('0xe2')]]=_0xaf250f;}};Dialer['prototype'][_0x8d3a('0x19a')]=function(_0x3a5769,_0x5c0824,_0x377d9a){var _0x2a15ac=new History(_0x5c0824);if(_0x2a15ac[_0x8d3a('0xf3')]+_0x2a15ac[_0x8d3a('0x19b')]+_0x2a15ac[_0x8d3a('0xf4')]+_0x2a15ac[_0x8d3a('0xf5')]+_0x2a15ac['countdropretry']+_0x2a15ac['countabandonedretry']+_0x2a15ac[_0x8d3a('0xf8')]+_0x2a15ac['countagentrejectretry']>=_0x377d9a[_0x8d3a('0xfa')]-0x1){return!![];}switch(_0x3a5769){case 0x3:if(_0x2a15ac[_0x8d3a('0xf4')]>=_0x377d9a[_0x8d3a('0x19c')]-0x1){return!![];}this[_0x8d3a('0xc2')]({'active':![],'countnoanswerretry':_0x2a15ac[_0x8d3a('0xf4')]+=0x1,'scheduledat':moment()[_0x8d3a('0x100')](_0x377d9a[_0x8d3a('0x19d')],_0x8d3a('0x102'))[_0x8d3a('0x7c')](_0x8d3a('0x111')),'ContactId':_0x2a15ac[_0x8d3a('0xd6')],'ListId':_0x2a15ac[_0x8d3a('0xd7')],'VoiceQueueId':_0x2a15ac['VoiceQueueId']||undefined,'CampaignId':_0x2a15ac['CampaignId']||undefined})[_0x8d3a('0xbb')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x2a15ac[_0x8d3a('0xf3')]>=_0x377d9a[_0x8d3a('0x19e')]-0x1){return!![];}this[_0x8d3a('0xc2')]({'active':![],'countbusyretry':_0x2a15ac[_0x8d3a('0xf3')]+=0x1,'scheduledat':moment()[_0x8d3a('0x100')](_0x377d9a[_0x8d3a('0x19f')],_0x8d3a('0x102'))[_0x8d3a('0x7c')](_0x8d3a('0x111')),'ContactId':_0x2a15ac[_0x8d3a('0xd6')],'ListId':_0x2a15ac[_0x8d3a('0xd7')],'VoiceQueueId':_0x2a15ac[_0x8d3a('0xd8')]||undefined,'CampaignId':_0x2a15ac[_0x8d3a('0xd9')]||undefined})[_0x8d3a('0xbb')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x2a15ac[_0x8d3a('0x19b')]>=_0x377d9a[_0x8d3a('0x1a0')]-0x1){return!![];}this[_0x8d3a('0xc2')]({'active':![],'countcongestionretry':_0x2a15ac[_0x8d3a('0x19b')]+=0x1,'scheduledat':moment()[_0x8d3a('0x100')](_0x377d9a[_0x8d3a('0x1a1')],_0x8d3a('0x102'))[_0x8d3a('0x7c')](_0x8d3a('0x111')),'ContactId':_0x2a15ac['ContactId'],'ListId':_0x2a15ac[_0x8d3a('0xd7')],'VoiceQueueId':_0x2a15ac['VoiceQueueId']||undefined,'CampaignId':_0x2a15ac[_0x8d3a('0xd9')]||undefined})[_0x8d3a('0xbb')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x2a15ac[_0x8d3a('0xf5')]>=_0x377d9a[_0x8d3a('0x1a2')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x2a15ac[_0x8d3a('0xf5')]+=0x1,'scheduledat':moment()['add'](_0x377d9a[_0x8d3a('0x1a3')],_0x8d3a('0x102'))[_0x8d3a('0x7c')](_0x8d3a('0x111')),'ContactId':_0x2a15ac[_0x8d3a('0xd6')],'ListId':_0x2a15ac[_0x8d3a('0xd7')],'VoiceQueueId':_0x2a15ac[_0x8d3a('0xd8')]||undefined,'CampaignId':_0x2a15ac[_0x8d3a('0xd9')]||undefined})[_0x8d3a('0xbb')](loggerCatch(_0x8d3a('0x1a4')));}break;case 0xa:if(_0x2a15ac[_0x8d3a('0xf6')]>=_0x377d9a['dialDropMaxRetry']-0x1){return!![];}this[_0x8d3a('0xc2')]({'active':![],'countdropretry':_0x2a15ac[_0x8d3a('0xf6')]+=0x1,'scheduledat':moment()[_0x8d3a('0x100')](_0x377d9a[_0x8d3a('0x11d')],_0x8d3a('0x102'))['format'](_0x8d3a('0x111')),'ContactId':_0x2a15ac[_0x8d3a('0xd6')],'ListId':_0x2a15ac[_0x8d3a('0xd7')],'VoiceQueueId':_0x2a15ac[_0x8d3a('0xd8')]||undefined,'CampaignId':_0x2a15ac[_0x8d3a('0xd9')]||undefined})[_0x8d3a('0xbb')](loggerCatch(_0x8d3a('0x11e')));break;case 0xb:if(_0x2a15ac[_0x8d3a('0xf7')]>=_0x377d9a[_0x8d3a('0x124')]-0x1){return!![];}this[_0x8d3a('0xc2')]({'active':![],'countabandonedretry':_0x2a15ac[_0x8d3a('0xf7')]+=0x1,'scheduledat':moment()[_0x8d3a('0x100')](_0x377d9a[_0x8d3a('0x125')],_0x8d3a('0x102'))['format'](_0x8d3a('0x111')),'ContactId':_0x2a15ac[_0x8d3a('0xd6')],'ListId':_0x2a15ac['ListId'],'VoiceQueueId':_0x2a15ac['VoiceQueueId']||undefined,'CampaignId':_0x2a15ac[_0x8d3a('0xd9')]||undefined})['catch'](loggerCatch(_0x8d3a('0x126')));break;case 0x13:if(_0x2a15ac[_0x8d3a('0xf8')]>=_0x377d9a[_0x8d3a('0xfd')]-0x1){return!![];}this[_0x8d3a('0xc2')]({'active':![],'countmachineretry':_0x2a15ac[_0x8d3a('0xf8')]+=0x1,'scheduledat':moment()[_0x8d3a('0x100')](_0x377d9a[_0x8d3a('0x101')],'minutes')[_0x8d3a('0x7c')](_0x8d3a('0x111')),'ContactId':_0x2a15ac[_0x8d3a('0xd6')],'ListId':_0x2a15ac[_0x8d3a('0xd7')],'VoiceQueueId':_0x2a15ac[_0x8d3a('0xd8')]||undefined,'CampaignId':_0x2a15ac['CampaignId']||undefined})['catch'](loggerCatch(_0x8d3a('0x103')));break;case 0x14:if(_0x2a15ac[_0x8d3a('0xf9')]>=_0x377d9a[_0x8d3a('0x1a5')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x2a15ac[_0x8d3a('0xf9')]+=0x1,'scheduledat':moment()['add'](_0x377d9a[_0x8d3a('0x1a6')],_0x8d3a('0x102'))[_0x8d3a('0x7c')](_0x8d3a('0x111')),'ContactId':_0x2a15ac[_0x8d3a('0xd6')],'ListId':_0x2a15ac[_0x8d3a('0xd7')],'VoiceQueueId':_0x2a15ac['VoiceQueueId']||undefined,'CampaignId':_0x2a15ac[_0x8d3a('0xd9')]||undefined})[_0x8d3a('0xbb')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer['prototype']['callProgressDetecting']=function(_0x39b1b1,_0x2f7fe8,_0x34d92e){var _0x5945a6=this;var _0x1be852=new History(_0x39b1b1);return new BPromise(function(_0x55fc32,_0x108d9a){if(_[_0x8d3a('0x86')](_0x2f7fe8)&&typeof _0x2f7fe8!==_0x8d3a('0x16c')){return _0x108d9a(msgResponse(_0x8d3a('0x1a7'),_0x8d3a('0x149'),_0x8d3a('0x1a8')));}if(_[_0x8d3a('0x86')](_0x34d92e)&&typeof _0x34d92e!=='object'){return _0x108d9a(msgResponse(_0x8d3a('0x1a7'),_0x8d3a('0x149'),_0x8d3a('0x1a9')));}switch(_0x34d92e[_0x8d3a('0x1aa')]){case'0':_0x2f7fe8[_0x8d3a('0x66')]+=0x1;_0x1be852[_0x8d3a('0xab')]=0x0;_0x1be852['statedesc']=_0x8d3a('0x1ab');_0x1be852[_0x8d3a('0xf5')]+=0x1;_0x1be852[_0x8d3a('0xf1')]+=0x1;ami[_0x8d3a('0x4b')](_0x8d3a('0x1ac'),ut[_0x8d3a('0xea')](_0x39b1b1,_0x8d3a('0x1ad')));_0x5945a6[_0x8d3a('0xce')](_0x1be852)[_0x8d3a('0xbb')](loggerCatch(_0x8d3a('0xf2')));if(_0x5945a6[_0x8d3a('0x19a')](0x0,_0x39b1b1,_0x2f7fe8)){if(_0x1be852['countnosuchnumberretry']>=_0x2f7fe8[_0x8d3a('0x1a2')]){_0x5945a6[_0x8d3a('0xfe')](_0x1be852,_0x55fc32,_0x108d9a,'reason\x200\x20no\x20such\x20number....');}else{_0x5945a6[_0x8d3a('0xfb')](_0x1be852,_0x55fc32,_0x108d9a,_0x8d3a('0x1ae'));}}break;case'3':_0x2f7fe8['outboundNoAnswerCallsDay']+=0x1;_0x1be852[_0x8d3a('0xab')]=0x3;_0x1be852[_0x8d3a('0xac')]=_0x8d3a('0x1af');_0x1be852[_0x8d3a('0xf4')]+=0x1;_0x1be852['countglobal']+=0x1;ami[_0x8d3a('0x4b')]('custom:agentnoanswer',ut['buildObj'](_0x39b1b1,_0x8d3a('0x1b0')));_0x5945a6[_0x8d3a('0xce')](_0x1be852)[_0x8d3a('0xbb')](loggerCatch(_0x8d3a('0x1b1')));if(_0x5945a6[_0x8d3a('0x19a')](0x3,_0x39b1b1,_0x2f7fe8)){if(_0x1be852[_0x8d3a('0xf4')]>=_0x2f7fe8['dialNoAnswerMaxRetry']){_0x5945a6[_0x8d3a('0xfe')](_0x1be852,_0x55fc32,_0x108d9a,_0x8d3a('0x1b2'));}else{_0x5945a6[_0x8d3a('0xfb')](_0x1be852,_0x55fc32,_0x108d9a,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x2f7fe8[_0x8d3a('0x62')]+=0x1;_0x1be852[_0x8d3a('0xab')]=0x5;_0x1be852['statedesc']=_0x8d3a('0x1b3');_0x1be852[_0x8d3a('0xf3')]+=0x1;_0x1be852[_0x8d3a('0xf1')]+=0x1;ami['emit'](_0x8d3a('0x1b4'),ut[_0x8d3a('0xea')](_0x39b1b1,_0x8d3a('0x1b5')));_0x5945a6[_0x8d3a('0xce')](_0x1be852)[_0x8d3a('0xbb')](loggerCatch(_0x8d3a('0x1b6')));if(_0x5945a6['checkRetriveMax'](0x5,_0x39b1b1,_0x2f7fe8)){if(_0x1be852['countbusyretry']>=_0x2f7fe8[_0x8d3a('0x19e')]){_0x5945a6[_0x8d3a('0xfe')](_0x1be852,_0x55fc32,_0x108d9a,_0x8d3a('0x1b7'));}else{_0x5945a6['stateGlobal'](_0x1be852,_0x55fc32,_0x108d9a,'reason\x205\x20busy');}}break;case'8':_0x2f7fe8[_0x8d3a('0x1b8')]+=0x1;_0x1be852[_0x8d3a('0xab')]=0x8;_0x1be852[_0x8d3a('0xac')]=_0x8d3a('0x1b9');_0x1be852[_0x8d3a('0x19b')]+=0x1;_0x1be852[_0x8d3a('0xf1')]+=0x1;ami[_0x8d3a('0x4b')]('custom:agentcongestion',ut['buildObj'](_0x39b1b1,'congestion'));_0x5945a6[_0x8d3a('0xce')](_0x1be852)[_0x8d3a('0xbb')](loggerCatch(_0x8d3a('0x1ba')));if(_0x5945a6[_0x8d3a('0x19a')](0x8,_0x39b1b1,_0x2f7fe8)){if(_0x1be852[_0x8d3a('0x19b')]>=_0x2f7fe8[_0x8d3a('0x1a0')]){_0x5945a6[_0x8d3a('0xfe')](_0x1be852,_0x55fc32,_0x108d9a,'reason\x208\x20congestion');}else{_0x5945a6[_0x8d3a('0xfb')](_0x1be852,_0x55fc32,_0x108d9a,_0x8d3a('0x1bb'));}}break;case'11':_0x2f7fe8[_0x8d3a('0x1bc')]+=0x1;_0x1be852[_0x8d3a('0xab')]=0xb;_0x1be852[_0x8d3a('0xac')]='Abandoned';_0x1be852[_0x8d3a('0xf7')]+=0x1;_0x1be852[_0x8d3a('0xf1')]+=0x1;_0x5945a6[_0x8d3a('0xce')](_0x1be852)['catch'](loggerCatch(_0x8d3a('0x127')));if(_0x5945a6['checkRetriveMax'](0xb,_0x39b1b1,_0x2f7fe8)){if(_0x1be852[_0x8d3a('0xf7')]>=_0x2f7fe8[_0x8d3a('0x124')]){_0x5945a6['createStateFinal'](_0x1be852,_0x55fc32,_0x108d9a,_0x8d3a('0x1bd'));}else{_0x5945a6[_0x8d3a('0xfb')](_0x1be852,_0x55fc32,_0x108d9a,_0x8d3a('0x1bd'));}}break;case'20':_0x2f7fe8[_0x8d3a('0x1be')]+=0x1;_0x1be852['state']=0x14;_0x1be852[_0x8d3a('0xac')]=_0x8d3a('0x1bf');_0x1be852[_0x8d3a('0xf9')]+=0x1;_0x1be852['countglobal']+=0x1;ami[_0x8d3a('0x4b')](_0x8d3a('0x1c0'),ut['buildObj'](_0x39b1b1,_0x8d3a('0x1c1')));_0x5945a6[_0x8d3a('0xce')](_0x1be852)[_0x8d3a('0xbb')](loggerCatch(_0x8d3a('0x1c2')));if(_0x5945a6[_0x8d3a('0x19a')](0x14,_0x39b1b1,_0x2f7fe8)){if(_0x1be852[_0x8d3a('0xf9')]>=_0x2f7fe8[_0x8d3a('0x1a5')]){_0x5945a6[_0x8d3a('0xfe')](_0x1be852,_0x55fc32,_0x108d9a,_0x8d3a('0x1c3'));}else{_0x5945a6[_0x8d3a('0xfb')](_0x1be852,_0x55fc32,_0x108d9a,_0x8d3a('0x1c3'));}}break;default:_0x2f7fe8['outboundUnknownCallsDay']+=0x1;_0x1be852[_0x8d3a('0xab')]=0xc;_0x1be852['statedesc']=_0x34d92e[_0x8d3a('0x1aa')];_0x5945a6[_0x8d3a('0xce')](_0x1be852)['catch'](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x5945a6[_0x8d3a('0x19a')](_0x34d92e['reason'],_0x39b1b1,_0x2f7fe8)){if(_0x1be852[_0x8d3a('0xf3')]+_0x1be852['countcongestionretry']+_0x1be852[_0x8d3a('0xf4')]+_0x1be852[_0x8d3a('0xf5')]+_0x1be852[_0x8d3a('0xf6')]+_0x1be852['countabandonedretry']+_0x1be852['countmachineretry']+_0x1be852['countagentrejectretry']>=_0x2f7fe8[_0x8d3a('0xfa')]){_0x5945a6[_0x8d3a('0xfb')](_0x1be852,_0x55fc32,_0x108d9a,_0x34d92e[_0x8d3a('0x1aa')]);}else{_0x5945a6[_0x8d3a('0xfe')](_0x1be852,_0x55fc32,_0x108d9a,_0x34d92e[_0x8d3a('0x1aa')]);}}}});};Dialer['prototype'][_0x8d3a('0xfb')]=function(_0x3dec7f,_0x1a7021,_0x3783f6,_0x1fafbb){var _0x2fdfc3=new Final(_0x3dec7f);_0x2fdfc3[_0x8d3a('0xab')]=0xf;_0x2fdfc3[_0x8d3a('0xac')]=_0x8d3a('0x1c4');this[_0x8d3a('0xfe')](_0x2fdfc3,_0x1a7021,_0x3783f6,_0x1fafbb);};Dialer['prototype'][_0x8d3a('0xfe')]=function(_0x459144,_0x24416f,_0x4f2869,_0x1303c7){this[_0x8d3a('0xcc')](_0x459144)['then'](function(){return _0x24416f(msgResponse(_0x8d3a('0x1a7'),'Success',_0x1303c7));})[_0x8d3a('0xbb')](function(){return _0x4f2869(msgResponse('[moveContactManagedDialer][0]',_0x8d3a('0x149'),_0x8d3a('0x1c5')));});};Dialer[_0x8d3a('0xaf')][_0x8d3a('0x15f')]=function(_0xe9eae4){var _0x31c3b6=_0xe9eae4[_0x8d3a('0x1c6')]/0x64;var _0x39e54e=_0xe9eae4[_0x8d3a('0x65')]/(_0xe9eae4[_0x8d3a('0x65')]+_0xe9eae4[_0x8d3a('0x60')]);var _0x124613=Math[_0x8d3a('0x1c7')](_0xe9eae4[_0x8d3a('0x1c8')]*(_0xe9eae4[_0x8d3a('0x1c9')]/0x64));var _0x18c8ac=Math[_0x8d3a('0x1c7')](_0xe9eae4['predictiveIntervalAvailable']*(_0xe9eae4['predictiveIntervalMinThreshold']/0x64));var _0x3e1563=_0xe9eae4[_0x8d3a('0x50')]+_0xe9eae4[_0x8d3a('0x54')];var _0x5b664f=Math[_0x8d3a('0x1ca')](_0xe9eae4['erlangCalls']*_0xe9eae4[_0x8d3a('0x75')]*_0xe9eae4[_0x8d3a('0x6f')]*_0xe9eae4['predictiveIntervalMultiplicativeFactor']);if(_[_0x8d3a('0x86')](_0xe9eae4[_0x8d3a('0x27')])){if(!_[_0x8d3a('0x86')](_0xe9eae4[_0x8d3a('0x26')])){_0xe9eae4[_0x8d3a('0x26')]=undefined;loggerPredictive[_0x8d3a('0x98')](_0x8d3a('0x1cb'),_0x8d3a('0x1cc'));}if(!_[_0x8d3a('0x86')](_0xe9eae4[_0x8d3a('0x92')])){loggerPredictive[_0x8d3a('0x98')](_0x8d3a('0x1cb'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0xe9eae4[_0x8d3a('0x92')]);_0xe9eae4[_0x8d3a('0x92')]=undefined;}_0xe9eae4[_0x8d3a('0x27')]=moment()[_0x8d3a('0x7c')](_0x8d3a('0x111'));loggerPredictive[_0x8d3a('0x7e')](_0xe9eae4['name'],_0x8d3a('0x1cd'),_0xe9eae4[_0x8d3a('0x27')]);this[_0x8d3a('0x15c')](_0xe9eae4,0x1);}else if(ifInterval(_0xe9eae4[_0x8d3a('0x1ce')],_0xe9eae4['startProgressive'])){this[_0x8d3a('0x15c')](_0xe9eae4,0x1);loggerPredictiveCalls[_0x8d3a('0x7e')](_0x8d3a('0x1cf'),_0xe9eae4[_0x8d3a('0x27')],_0xe9eae4[_0x8d3a('0x3e')]);_0xe9eae4['erlangCalls']=0x0;_0xe9eae4[_0x8d3a('0x6e')]=0x0;}else if(_0x31c3b6<_0x39e54e&&_0xe9eae4[_0x8d3a('0x1d0')]===_0x8d3a('0x1d1')){freeVariablesPredictive(_0xe9eae4);loggerPredictive[_0x8d3a('0x7e')](_0x8d3a('0x1d2'),'Dropped\x20calls\x20day',_0x39e54e,_0x8d3a('0x27'),_0xe9eae4[_0x8d3a('0x3e')]);}else if(_0x5b664f<_0xe9eae4['predictiveIntervalErlangCallsDroppedCalls']&&_0xe9eae4[_0x8d3a('0x1d0')]===_0x8d3a('0x1d1')){freeVariablesPredictive(_0xe9eae4);loggerPredictive['info'](_0x8d3a('0x1d3'),_0x8d3a('0x1d4'),_0x5b664f,_0x8d3a('0x1d5'),_0xe9eae4['predictiveIntervalErlangCallsDroppedCalls'],_0x8d3a('0x27'),_0xe9eae4[_0x8d3a('0x3e')]);}else if(!ifInterval(_0xe9eae4[_0x8d3a('0x1ce')],_0xe9eae4[_0x8d3a('0x27')])&&_[_0x8d3a('0x86')](_0xe9eae4[_0x8d3a('0x26')])&&!_[_0x8d3a('0x86')](_0xe9eae4['startProgressive'])){_0xe9eae4[_0x8d3a('0x26')]=moment()[_0x8d3a('0x7c')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x8d3a('0x7e')](_0xe9eae4[_0x8d3a('0x3e')],_0x8d3a('0x1d6'),_0xe9eae4[_0x8d3a('0x26')]);this[_0x8d3a('0xbf')](_0xe9eae4[_0x8d3a('0x1ce')])[_0x8d3a('0xba')](this[_0x8d3a('0x1d7')](_0xe9eae4))[_0x8d3a('0xba')](mergeDataErlangB(_0xe9eae4))[_0x8d3a('0xba')](this[_0x8d3a('0x1d8')](_0xe9eae4))[_0x8d3a('0xbb')](loggerCatchPredictive(_0x8d3a('0x1d9'),_0xe9eae4));}else if(!ifInterval(_0xe9eae4[_0x8d3a('0x1ce')],_0xe9eae4['startPredictive'])){_0xe9eae4[_0x8d3a('0x6e')]=0x0;_0xe9eae4[_0x8d3a('0x26')]=moment()[_0x8d3a('0x7c')](_0x8d3a('0x111'));loggerPredictive[_0x8d3a('0x7e')](_0xe9eae4['name'],'recalculate\x20predictive\x20at',_0xe9eae4[_0x8d3a('0x26')]);clearInterval(_0xe9eae4[_0x8d3a('0x92')]);_0xe9eae4[_0x8d3a('0x92')]=undefined;this['averageHandleTime'](_0xe9eae4[_0x8d3a('0x1ce')])['then'](this['getDataPredictive'](_0xe9eae4))[_0x8d3a('0xba')](mergeDataErlangB(_0xe9eae4))['then'](this['startMethodPredictive'](_0xe9eae4))['catch'](loggerCatchPredictive(_0x8d3a('0x1da'),_0xe9eae4));}else if(_0xe9eae4[_0x8d3a('0x1c8')]&&_0x3e1563<_0xe9eae4[_0x8d3a('0x1c8')]-_0x18c8ac){freeVariablesPredictive(_0xe9eae4);loggerPredictive[_0x8d3a('0x7e')](_0xe9eae4[_0x8d3a('0x3e')],_0x8d3a('0x1db'),_0x3e1563,_0x8d3a('0x1dc'),_0xe9eae4[_0x8d3a('0x1c8')],'-',_0x18c8ac,'=',_0xe9eae4['predictiveIntervalAvailable']-_0x18c8ac,')');}else if(_0xe9eae4[_0x8d3a('0x1c8')]&&_0x3e1563>_0xe9eae4[_0x8d3a('0x1c8')]+_0x124613){freeVariablesPredictive(_0xe9eae4);loggerPredictive[_0x8d3a('0x7e')](_0xe9eae4['name'],_0x8d3a('0x1db'),_0x3e1563,')\x20are\x20more\x20than\x20threshold\x20(',_0xe9eae4[_0x8d3a('0x1c8')],'+',_0x124613,'=',_0xe9eae4[_0x8d3a('0x1c8')]+_0x124613,')');}};Dialer[_0x8d3a('0xaf')][_0x8d3a('0x1d7')]=function(_0x3aeb30){var _0x457948=this;return function(_0x532ec6){return new BPromise(function(_0x46a2f0,_0x3f4909){_['merge'](_0x3aeb30,_0x532ec6[0x0]);if(checkGetDataPredictive(_0x532ec6[0x0])){var _0x263d05=_0x3aeb30[_0x8d3a('0x1c8')]=_0x3aeb30[_0x8d3a('0x54')]+_0x3aeb30['available'];var _0x52cd1f=_0x3aeb30[_0x8d3a('0x1ce')]*0x3c;var _0x4f5ab0=_0x532ec6[0x0][_0x8d3a('0x6b')]+_0x532ec6[0x0][_0x8d3a('0x6a')];var _0x821955=(_0x532ec6[0x0][_0x8d3a('0x69')]+_0x532ec6[0x0][_0x8d3a('0x6d')]+_0x532ec6[0x0][_0x8d3a('0x6c')])/_0x532ec6[0x0][_0x8d3a('0x81')];_0x3aeb30[_0x8d3a('0x6f')]=_0x821955>0x0?_0x821955:0x1;switch(_0x3aeb30[_0x8d3a('0x1d0')]){case _0x8d3a('0x1d1'):var _0x18c835=_0x3aeb30[_0x8d3a('0x1c6')]/0x64;return _0x457948[_0x8d3a('0x1dd')](_0x263d05,_0x52cd1f,_0x4f5ab0,_0x821955,_0x18c835)[_0x8d3a('0xba')](function(_0x55cc98){return _0x46a2f0(_0x55cc98);});case'agentBusyFactor':var _0x67fc6=_0x3aeb30[_0x8d3a('0x1c6')]/0x64;return _0x457948['busyFactor'](_0x263d05,_0x52cd1f,_0x4f5ab0,_0x821955,_0x67fc6)[_0x8d3a('0xba')](function(_0x46393a){return _0x46a2f0(_0x46393a);});default:return _0x3f4909(msgResponse(_0x8d3a('0x1de'),_0x8d3a('0x149'),_0x8d3a('0x1df')));}}else{return _0x3f4909(msgResponse(_0x8d3a('0x1de'),_0x8d3a('0x149'),_0x8d3a('0x1e0')));}});};};Dialer[_0x8d3a('0xaf')]['getDataPredictiveOld']=function(_0x2b322a){var _0x121d8d=this;return function(_0x38f25f){return new BPromise(function(_0x1bf95a,_0x370bd3){_[_0x8d3a('0xd4')](_0x2b322a,_0x38f25f[0x0]);if(checkGetDataPredictive(_0x38f25f[0x0])){loggerPredictive[_0x8d3a('0x7e')](JSON['stringify'](_0x38f25f[0x0]));if(_0x2b322a[_0x8d3a('0x1d0')]===_0x8d3a('0x1d1')){return _0x121d8d[_0x8d3a('0xca')](_0x2b322a['id'])[_0x8d3a('0xba')](function(_0x4312d4){var _0x354ee7=_0x2b322a[_0x8d3a('0x51')]-_0x4312d4[0x0][_0x8d3a('0x1e1')];var _0x244e3d=_0x2b322a[_0x8d3a('0x1ce')]*0x3c;var _0x5d69cf=_0x38f25f[0x0]['predictiveIntervalAvgTalktime']+_0x38f25f[0x0][_0x8d3a('0x6a')];var _0x3a56bf=(_0x38f25f[0x0][_0x8d3a('0x69')]+_0x38f25f[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x38f25f[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x38f25f[0x0][_0x8d3a('0x81')];var _0x4d2ebd=_0x2b322a[_0x8d3a('0x1c6')]/0x64;_0x2b322a[_0x8d3a('0x71')]=_0x4312d4[0x0][_0x8d3a('0x1e1')]||0x0;_0x2b322a[_0x8d3a('0x6f')]=_0x3a56bf>0x0?_0x3a56bf:0x1;return _0x121d8d['abandonmentRate'](_0x354ee7,_0x244e3d,_0x5d69cf,_0x3a56bf,_0x4d2ebd);})[_0x8d3a('0xba')](function(_0x12e865){return _0x1bf95a(_0x12e865);})[_0x8d3a('0xbb')](function(_0x21f938){return _0x370bd3(msgResponse(_0x8d3a('0x1e2'),_0x8d3a('0x149'),JSON[_0x8d3a('0x47')](_0x21f938)));});}if(_0x2b322a[_0x8d3a('0x1d0')]===_0x8d3a('0x1e3')){return _0x121d8d[_0x8d3a('0xca')](_0x2b322a['id'])[_0x8d3a('0xba')](function(_0xe78c76){var _0x34b05e=_0x2b322a[_0x8d3a('0x51')]-_0xe78c76[0x0]['outboundQueuePauses'];var _0x57bd61=_0x2b322a[_0x8d3a('0x1ce')]*0x3c;var _0x5d603f=_0x38f25f[0x0][_0x8d3a('0x6b')]+_0x38f25f[0x0][_0x8d3a('0x6a')];var _0x58da07=(_0x38f25f[0x0][_0x8d3a('0x69')]+_0x38f25f[0x0][_0x8d3a('0x6d')]+_0x38f25f[0x0][_0x8d3a('0x6c')])/_0x38f25f[0x0][_0x8d3a('0x81')];var _0x3cfca2=_0x2b322a[_0x8d3a('0x1c6')]/0x64;_0x2b322a[_0x8d3a('0x71')]=_0xe78c76[0x0]['outboundQueuePauses']||0x0;_0x2b322a[_0x8d3a('0x6f')]=_0x58da07>0x0?_0x58da07:0x1;return _0x121d8d[_0x8d3a('0x1e4')](_0x34b05e,_0x57bd61,_0x5d603f,_0x58da07,_0x3cfca2);})['then'](function(_0x244f6e){return _0x1bf95a(_0x244f6e);})['catch'](function(_0x177ad0){return _0x370bd3(msgResponse(_0x8d3a('0x1e2'),'Failure',JSON[_0x8d3a('0x47')](_0x177ad0)));});}}else{return _0x370bd3(msgResponse(_0x8d3a('0x1de'),_0x8d3a('0x149'),_0x8d3a('0x1e0')));}});};};Dialer[_0x8d3a('0xaf')][_0x8d3a('0x1d8')]=function(_0x6f69a2){var _0x233ffd=this;return function(){var _0x205007=0x0;var _0x940fb5=Math[_0x8d3a('0x1ca')](_0x6f69a2[_0x8d3a('0x74')]*0x3e8);if(_0x940fb5>0x0){_0x940fb5=_0x940fb5<0x64?0x64:_0x940fb5;loggerPredictive['info'](_0x6f69a2[_0x8d3a('0x3e')],'one\x20call\x20every:',_0x940fb5,_0x8d3a('0x48'));_0x6f69a2['handlePredictive']=setInterval(function(){_0x233ffd['handlePredictive'](_0x6f69a2);loggerPredictiveCalls[_0x8d3a('0x7e')](_0x8d3a('0x1e5'),_0x205007+=0x1);},_0x940fb5);}else{loggerPredictive[_0x8d3a('0x7e')](_0x6f69a2[_0x8d3a('0x3e')],_0x8d3a('0x1e6'));}};};Dialer[_0x8d3a('0xaf')]['checkContactBlack']=function(_0x1ebbe4,_0x65995d){var _0x3d9868=this;return function(_0x3aa160){if(_['isEmpty'](_0x3aa160)){if(_['isNil'](_0x65995d[_0x8d3a('0x1e7')])||!_0x65995d[_0x8d3a('0x1e8')]){if(_0x1ebbe4[_0x8d3a('0x5a')]===_0x8d3a('0x7')){_0x1ebbe4['queueStatusComplete']=_['isUndefined'](_0x1ebbe4[_0x8d3a('0x12f')])?!![]:_0x1ebbe4['queueStatusComplete'];var _0x2be110=uuid['v4']();_0x3d9868['actions'][_0x2be110]=new Action(_0x1ebbe4,_0x65995d,_0x2be110);loggerBooked[_0x8d3a('0x7e')](_0x8d3a('0x1e9'),_0x2be110,_0x8d3a('0x1ea'),JSON[_0x8d3a('0x47')](_0x1ebbe4[_0x8d3a('0x12f')]),_0x8d3a('0x1eb'),_0x1ebbe4[_0x8d3a('0x3e')]);if(_0x1ebbe4['queueStatusComplete']){_0x1ebbe4['queueStatusComplete']=![];_0x3d9868['queueBooked'][_0x3d9868[_0x8d3a('0x22')][_0x2be110][_0x8d3a('0xb7')]]=[];ami[_0x8d3a('0xb3')]({'actionid':_0x2be110,'action':_0x8d3a('0x1ec'),'queue':_0x1ebbe4[_0x8d3a('0x3e')]})['catch'](function(){_0x3d9868['updateOriginated'](_0x1ebbe4);_0x3d9868['rescheduleContact']({'active':![],'ContactId':_0x3d9868[_0x8d3a('0x22')][_0x2be110][_0x8d3a('0xd6')],'ListId':_0x3d9868[_0x8d3a('0x22')][_0x2be110]['ListId'],'VoiceQueueId':_0x3d9868['actions'][_0x2be110][_0x8d3a('0xd8')]||undefined,'CampaignId':_0x3d9868['actions'][_0x2be110]['CampaignId']||undefined})['catch'](loggerCatch(_0x8d3a('0x1ed')));delete _0x3d9868[_0x8d3a('0x22')][_0x2be110];});}else{loggerBooked[_0x8d3a('0x7e')](_0x8d3a('0x1ee'),JSON[_0x8d3a('0x47')](_0x1ebbe4[_0x8d3a('0x12f')]),_0x8d3a('0x1eb'),_0x1ebbe4[_0x8d3a('0x3e')]);_0x3d9868['updateOriginated'](_0x1ebbe4);_0x3d9868[_0x8d3a('0xc2')]({'active':![],'ContactId':_0x3d9868[_0x8d3a('0x22')][_0x2be110]['ContactId'],'ListId':_0x3d9868[_0x8d3a('0x22')][_0x2be110][_0x8d3a('0xd7')],'VoiceQueueId':_0x3d9868[_0x8d3a('0x22')][_0x2be110][_0x8d3a('0xd8')]||undefined,'CampaignId':_0x3d9868[_0x8d3a('0x22')][_0x2be110][_0x8d3a('0xd9')]||undefined})['catch'](loggerCatch(_0x8d3a('0x1ed')));delete _0x3d9868['actions'][_0x2be110];}}else{return _0x3d9868[_0x8d3a('0x1ef')](_0x1ebbe4,_0x65995d);}}else{if(getDiff(_0x65995d['scheduledat'])<_0x1ebbe4[_0x8d3a('0x1f0')]*0x3c){if(_0x65995d[_0x8d3a('0x1f1')]&&!_0x65995d[_0x8d3a('0x1f1')]['voicePause']){_0x3d9868[_0x8d3a('0x94')][_0x8d3a('0x132')](_0x65995d['id'])[_0x8d3a('0x134')](function(){_0x3d9868[_0x8d3a('0xb6')](_0x1ebbe4);});}else{_0x3d9868[_0x8d3a('0xc4')]({'active':![]},_0x65995d['id'],0x1)[_0x8d3a('0x134')](function(){_0x3d9868[_0x8d3a('0xb6')](_0x1ebbe4);});}}else{_0x1ebbe4[_0x8d3a('0x68')]+=0x1;_0x3d9868[_0x8d3a('0xb6')](_0x1ebbe4);if(_0x1ebbe4['dialRecallInQueue']){_0x3d9868[_0x8d3a('0xc2')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x65995d[_0x8d3a('0xd6')],'ListId':_0x65995d['ListId'],'VoiceQueueId':_0x65995d[_0x8d3a('0xd8')]||undefined,'CampaignId':_0x65995d[_0x8d3a('0xd9')]||undefined})[_0x8d3a('0xbb')](loggerCatch(_0x8d3a('0x1f2')));_0x3d9868[_0x8d3a('0xce')](createObjHistory(_0x1ebbe4,_0x65995d,_0x8d3a('0x1f3'),0x17,_0x8d3a('0x1f4')))[_0x8d3a('0xbb')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x3d9868[_0x8d3a('0xe0')](createObjHistory(_0x1ebbe4,_0x65995d,_0x8d3a('0x1f5'),0x16,_0x8d3a('0x1f6')),_0x8d3a('0x1f7'),'[Originate][HistoryRecallClose]');}}}}else{_0x1ebbe4[_0x8d3a('0x61')]+=0x1;_0x3d9868[_0x8d3a('0xe0')](createObjHistory(_0x1ebbe4,_0x65995d,_0x8d3a('0x1f8'),0xd,'Blacklist'),_0x8d3a('0x1f9'),_0x8d3a('0x1fa'));throw _0x8d3a('0x1fb');}};};Dialer[_0x8d3a('0xaf')]['handleIvr']=function(_0xe9213e){var _0x309465=this;var _0x5d345b=_0xe9213e['limitCalls']-_0xe9213e['originated']-_0xe9213e[_0x8d3a('0xc7')];emitCampaignSummary(_0xe9213e);if(_0x5d345b>0x0){if(_0x5d345b>this['maxNumberOriginate']){_0x5d345b=this[_0x8d3a('0x21')];}_0xe9213e[_0x8d3a('0xc7')]+=_0x5d345b;this[_0x8d3a('0xc9')](_0xe9213e['id'],_0x5d345b,_0xe9213e[_0x8d3a('0x1fc')],_0xe9213e)['then'](function(_0x2d72d3){_0xe9213e[_0x8d3a('0xc7')]-=_0x5d345b;_0xe9213e[_0x8d3a('0xc7')]=_0xe9213e[_0x8d3a('0xc7')]>0x0?_0xe9213e[_0x8d3a('0xc7')]:0x0;if(!checkContactEmpty(_0x2d72d3)){_0xe9213e[_0x8d3a('0x3d')]=_0x8d3a('0xa3');logger[_0x8d3a('0x7e')](_0x8d3a('0x1fd')+_0xe9213e[_0x8d3a('0x3e')]);}else{_0xe9213e[_0x8d3a('0x72')]+=_0x2d72d3[_0x8d3a('0x9b')];_0xe9213e[_0x8d3a('0x3d')]=_0x8d3a('0x1fe');for(var _0x51ca08=0x0;_0x51ca08<_0x2d72d3[_0x8d3a('0x9b')];_0x51ca08+=0x1){_0xe9213e[_0x8d3a('0x1ff')]+=0x1;if(_[_0x8d3a('0xb2')](_0x2d72d3[_0x51ca08])||_[_0x8d3a('0xb2')](_0x2d72d3[_0x51ca08][_0x8d3a('0x16e')])||_[_0x8d3a('0xb2')](_0x2d72d3[_0x51ca08][_0x8d3a('0x16e')][_0x8d3a('0x16f')])){_0x309465[_0x8d3a('0xd3')](_0x8d3a('0x200'),_0xe9213e,_0x2d72d3[_0x51ca08]);}else{_0x309465[_0x8d3a('0xbe')](_['pick'](_0x2d72d3[_0x51ca08],[_0x8d3a('0xd9'),_0x8d3a('0x201')]))[_0x8d3a('0xba')](_0x309465[_0x8d3a('0x202')](_0xe9213e,_0x2d72d3[_0x51ca08]))[_0x8d3a('0xbb')](_0x309465[_0x8d3a('0xd2')](_0x8d3a('0x203'),_0xe9213e));}}}})[_0x8d3a('0xbb')](loggerGetContactDialer(_0x8d3a('0x204'),_0xe9213e,_0x5d345b));}};Dialer[_0x8d3a('0xaf')][_0x8d3a('0x15c')]=function(_0x2f1680,_0x43c104){var _0x5574a5=this;var _0x5be739=[];var _0x1a3217=_0x43c104>=0x1?_0x43c104:0x1;if(_0x2f1680['dialMethod']==='booked'){_0x1a3217=0x1;}var _0x4f6444=Math[_0x8d3a('0x1ca')](_0x2f1680[_0x8d3a('0x50')]*_0x1a3217)-_0x2f1680[_0x8d3a('0x72')]-_0x2f1680[_0x8d3a('0xc7')];emitVoiceQueueSummary(_0x2f1680);if(_0x2f1680['dialLimitQueue']>0x0){var _0x32d6ed=_0x2f1680[_0x8d3a('0x205')]-_0x2f1680[_0x8d3a('0x72')]-_0x2f1680[_0x8d3a('0x54')]-_0x2f1680[_0x8d3a('0xc7')]-_0x2f1680['pTalking'];if(_0x4f6444>_0x32d6ed){_0x4f6444=_0x32d6ed;}}if(_0x4f6444>0x0){if(_0x2f1680[_0x8d3a('0x5a')]===_0x8d3a('0x7')){_0x4f6444=0x1;}if(_0x4f6444>this[_0x8d3a('0x21')]){_0x4f6444=this['maxNumberOriginate'];}_0x2f1680[_0x8d3a('0xc7')]+=_0x4f6444;for(var _0x1215e5 in this[_0x8d3a('0x1f')]){if(typeof this[_0x8d3a('0x1f')][_0x1215e5]!=='undefined'){if(this['agents'][_0x1215e5][_0x8d3a('0xab')]===_0x8d3a('0x206')&&this[_0x8d3a('0x1f')][_0x1215e5][_0x8d3a('0xde')]===_0x8d3a('0xdf')){_0x5be739[_0x8d3a('0x12d')](this[_0x8d3a('0x1f')][_0x1215e5]['id']);}}}this[_0x8d3a('0xc6')](_0x2f1680['id'],_0x5be739,_0x4f6444,_0x2f1680[_0x8d3a('0x1fc')],_0x2f1680)[_0x8d3a('0xba')](function(_0xd49226){_0x2f1680[_0x8d3a('0xc7')]-=_0x4f6444;_0x2f1680['temp']=_0x2f1680['temp']>0x0?_0x2f1680['temp']:0x0;if(!checkContactEmpty(_0xd49226)){_0x5574a5[_0x8d3a('0x207')](_0x2f1680)[_0x8d3a('0xba')](sendMessageReschedule(_0x2f1680))[_0x8d3a('0xbb')](loggerCatch('[countReScheduled]\x20'));}else{_0x2f1680[_0x8d3a('0x72')]+=_0xd49226[_0x8d3a('0x9b')];_0x2f1680[_0x8d3a('0x3d')]=_0x2f1680[_0x8d3a('0x5a')]===_0x8d3a('0x7')?_0x8d3a('0x176'):'RUNNING';for(var _0x50508c=0x0;_0x50508c<_0xd49226[_0x8d3a('0x9b')];_0x50508c+=0x1){if(_[_0x8d3a('0xb2')](_0xd49226[_0x50508c])||_[_0x8d3a('0xb2')](_0xd49226[_0x50508c][_0x8d3a('0x16e')])||_[_0x8d3a('0xb2')](_0xd49226[_0x50508c][_0x8d3a('0x16e')][_0x8d3a('0x16f')])){_0x5574a5[_0x8d3a('0xd3')](_0x8d3a('0x200'),_0x2f1680,_0xd49226[_0x50508c]);}else{_0x5574a5['checkIsBlackList'](_[_0x8d3a('0xd5')](_0xd49226[_0x50508c],[_0x8d3a('0xd8'),_0x8d3a('0x201')]))[_0x8d3a('0xba')](_0x5574a5[_0x8d3a('0x202')](_0x2f1680,_0xd49226[_0x50508c]))[_0x8d3a('0xbb')](_0x5574a5[_0x8d3a('0xd2')](_0x8d3a('0x200'),_0x2f1680));}}}})[_0x8d3a('0xbb')](loggerGetContactDialer(_0x8d3a('0x208'),_0x2f1680,_0x4f6444));}};Dialer['prototype'][_0x8d3a('0x92')]=function(_0x398d2e){if(_0x398d2e['dialLimitQueue']>0x0){var _0x4de223=_0x398d2e[_0x8d3a('0x205')]-_0x398d2e[_0x8d3a('0x72')]-_0x398d2e[_0x8d3a('0x54')];if(_0x4de223>0x0){this[_0x8d3a('0x209')](_0x398d2e);}else{loggerPredictiveCalls['info']('[handlePredictive][limitChannel]');}}else{this[_0x8d3a('0x209')](_0x398d2e);}};Dialer[_0x8d3a('0xaf')]['tryOriginatePredictive']=function(_0xc4052){var _0x43c289=this;var _0x57ae3d=[];_0xc4052['originated']+=0x1;for(var _0x1b9015 in this[_0x8d3a('0x1f')]){if(typeof this['agents'][_0x1b9015]!=='undefined'){if(this[_0x8d3a('0x1f')][_0x1b9015][_0x8d3a('0xab')]===_0x8d3a('0x206')&&this[_0x8d3a('0x1f')][_0x1b9015]['status']===_0x8d3a('0xdf')){_0x57ae3d[_0x8d3a('0x12d')](this['agents'][_0x1b9015]['id']);}}}this[_0x8d3a('0xc6')](_0xc4052['id'],_0x57ae3d,0x1,_0xc4052['dialOrderByScheduledAt'],_0xc4052)[_0x8d3a('0xba')](function(_0x4c594b){if(!checkContactEmpty(_0x4c594b)){checkContactLowerLimitOriginate(_0xc4052,0x1,0x0);_0x43c289['countReScheduled'](_0xc4052)[_0x8d3a('0xba')](sendMessageReschedule(_0xc4052))[_0x8d3a('0xbb')](loggerCatch(_0x8d3a('0xbc')));}else{_0xc4052['message']='RUNNING';if(_[_0x8d3a('0xb2')](_0x4c594b[0x0])||_[_0x8d3a('0xb2')](_0x4c594b[0x0]['Contact'])||_[_0x8d3a('0xb2')](_0x4c594b[0x0]['Contact'][_0x8d3a('0x16f')])){_0x43c289['emptyContact'](_0x8d3a('0x200'),_0xc4052,_0x4c594b[0x0]);}else{_0x43c289[_0x8d3a('0xbd')](_['pick'](_0x4c594b[0x0],[_0x8d3a('0xd8'),_0x8d3a('0x201')]))[_0x8d3a('0xba')](_0x43c289[_0x8d3a('0x202')](_0xc4052,_0x4c594b[0x0]))[_0x8d3a('0xbb')](_0x43c289[_0x8d3a('0xd2')](_0x8d3a('0x20a'),_0xc4052));}}})[_0x8d3a('0xbb')](loggerGetContactDialer(_0x8d3a('0x20b'),_0xc4052,0x1));emitVoiceQueueSummary(_0xc4052);};Dialer[_0x8d3a('0xaf')]['abandonmentRate']=function(_0x5dfdc3,_0x4a3534,_0x430c81,_0x4612bb,_0x24b033,_0x1abb8a){loggerPredictive[_0x8d3a('0x7e')](_0x8d3a('0x20c'));loggerPredictive[_0x8d3a('0x7e')](_0x8d3a('0x20d'),_0x5dfdc3);loggerPredictive[_0x8d3a('0x7e')](_0x8d3a('0x20e'),_0x4a3534);loggerPredictive[_0x8d3a('0x7e')](_0x8d3a('0x20f'),_0x430c81);loggerPredictive[_0x8d3a('0x7e')](_0x8d3a('0x210'),_0x4612bb);loggerPredictive[_0x8d3a('0x7e')](_0x8d3a('0x211'),_0x24b033);loggerPredictive[_0x8d3a('0x7e')](_0x8d3a('0x8f'));return new BPromise(function(_0x1ff953,_0x3f4e3c){if(_0x5dfdc3<=0x0||isNaN(_0x5dfdc3)){return _0x3f4e3c(msgResponse(_0x8d3a('0x212'),'Error','m\x20=\x20'+_0x5dfdc3));}if(_0x430c81<=0x0||isNaN(_0x430c81)){return _0x3f4e3c(msgResponse(_0x8d3a('0x212'),'Error',_0x8d3a('0x213')+_0x430c81));}if(_0x4612bb<=0x0||isNaN(_0x4612bb)){return _0x3f4e3c(msgResponse(_0x8d3a('0x212'),'Error','p\x20=\x20'+_0x4612bb));}if(_0x4a3534<=0x0||isNaN(_0x4a3534)){return _0x3f4e3c(msgResponse(_0x8d3a('0x212'),_0x8d3a('0x46'),'interval\x20=\x20'+_0x4a3534));}if(_0x24b033<=0x0||isNaN(_0x24b033)){return _0x3f4e3c(msgResponse(_0x8d3a('0x212'),_0x8d3a('0x46'),'Amax\x20=\x20'+_0x24b033));}_0x1abb8a=_0x1abb8a||0x0;var _0x21d0cf=0x1/_0x430c81;var _0x218ca9=0x0;var _0xc6dbb4=0x0;var _0x11969f=0x0;var _0x6a27da=0x0;for(var _0x256ce3=0x0;_0x11969f<_0x24b033;_0x256ce3+=0x1){_0xc6dbb4=_0x256ce3/_0x4a3534;_0x218ca9=(_0x4612bb*_0xc6dbb4+_0x1abb8a)/_0x21d0cf;_0x11969f=erlangb(_0x218ca9,_0x5dfdc3);_0x6a27da=_0x218ca9/_0x5dfdc3*(0x1-erlangb(_0x218ca9,_0x5dfdc3));}return _0x1ff953({'erlangCalls':_0x256ce3,'erlangCallToSecond':_0x4a3534/_0x256ce3,'erlangAbandonmentRate':_0x11969f,'erlangBusyFactor':_0x6a27da});});};Dialer[_0x8d3a('0xaf')]['busyFactor']=function(_0x322014,_0xbf0cd,_0x5854ef,_0x30f6d4,_0x141a4e,_0xb0f2c9){loggerPredictive['info'](_0x8d3a('0x214'));loggerPredictive[_0x8d3a('0x7e')](_0x8d3a('0x20d'),_0x322014);loggerPredictive[_0x8d3a('0x7e')](_0x8d3a('0x20e'),_0xbf0cd);loggerPredictive[_0x8d3a('0x7e')](_0x8d3a('0x20f'),_0x5854ef);loggerPredictive['info'](_0x8d3a('0x210'),_0x30f6d4);loggerPredictive[_0x8d3a('0x7e')](_0x8d3a('0x215'),_0x141a4e);loggerPredictive[_0x8d3a('0x7e')](_0x8d3a('0x8f'));return new BPromise(function(_0x27ca16,_0xc67c15){if(_0x322014<=0x0||isNaN(_0x322014)){return _0xc67c15(msgResponse('[busyFactor]',_0x8d3a('0x46'),_0x8d3a('0x216')+_0x322014));}if(_0x5854ef<=0x0||isNaN(_0x5854ef)){return _0xc67c15(msgResponse(_0x8d3a('0x217'),_0x8d3a('0x46'),_0x8d3a('0x213')+_0x5854ef));}if(_0x30f6d4<=0x0||isNaN(_0x30f6d4)){return _0xc67c15(msgResponse(_0x8d3a('0x217'),_0x8d3a('0x46'),'p\x20=\x20'+_0x30f6d4));}if(_0xbf0cd<=0x0||isNaN(_0xbf0cd)){return _0xc67c15(msgResponse(_0x8d3a('0x217'),_0x8d3a('0x46'),_0x8d3a('0x218')+_0xbf0cd));}if(_0x141a4e<=0x0||isNaN(_0x141a4e)){return _0xc67c15(msgResponse('[busyFactor]',_0x8d3a('0x46'),_0x8d3a('0x219')+_0x141a4e));}_0xb0f2c9=_0xb0f2c9||0x0;var _0x5ef265=0x1/_0x5854ef;var _0x56fcb4=0x0;var _0x3fff39=0x0;var _0x546b03=0x0;var _0x45398f=0x0;for(var _0x55cbde=0x0;_0x45398f<_0x141a4e;_0x55cbde+=0x1){_0x3fff39=_0x55cbde/_0xbf0cd;_0x56fcb4=(_0x30f6d4*_0x3fff39+_0xb0f2c9)/_0x5ef265;_0x546b03=erlangb(_0x56fcb4,_0x322014);_0x45398f=_0x56fcb4/_0x322014*(0x1-erlangb(_0x56fcb4,_0x322014));}return _0x27ca16({'erlangCalls':_0x55cbde,'erlangCallToSecond':_0xbf0cd/_0x55cbde,'erlangAbandonmentRate':_0x546b03,'erlangBusyFactor':_0x45398f});});};module[_0x8d3a('0x21a')]=Dialer; \ No newline at end of file +var _0x138d=['predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','Trunk','stringify','format','voice_queue:save','ivr','campaign:ivr:%s','info','-----\x20Stats\x20Predictive\x20---','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','---------------------------','isUndefined','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','clearing\x20variable\x20start\x20progressive','handlePredictive','clearing\x20variable\x20handle\x20predictive','outbound','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','originated','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','[getContactDialer2][Empty]','sendMessageOneNotActive','pTalking','available','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','clearZombieChannels','[actions]','isNil','Action','status','channel','catch','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','resolve','then','countReScheduled','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','merge','pick','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact]','isSuccess','active','reachable','SIP/%s','unmonitored','uniqueid','variable','amdstatus','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','buildObj','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','countglobal','amd','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','[syncHangupInAMDIvr]','custom:amd','[syncAgentComplete][createHistory][0]','dialMachineMaxRetry','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','Unknow','reason','agent','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dropreason','TIMEOUT','agiafterat','dialDropMaxRetry','add','dialDropRetryFrequency','[rescheduleContact][Drop]','Drop','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','syncQueueMember','actionid','paused','stateinterface','locked','queueBooked','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','run','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','ifTime','checkIfTimeIntervals','\x20Intervals\x20is\x20null\x20','Failure','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','push','command','iftime\x20%s,%s','interval','content','indexOf','true','some','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','progressive','handlePower','power','dialPowerLevel','Queue','launchHandleIvr','handleIvr','dialTimezone','checkDialMethod','checkIfTime','dialGlobalInterval','[syncCampaigns]','\x5cw{0,','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','Contact','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialQueueTimeout','getCaller','ACTIVE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','createdAt','updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','callerid','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','Error','originate\x20action\x20Error','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','countagentrejectretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','NoSuchNumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','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','reason\x2011\x20abandoned','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','outboundUnknownCallsDay','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','dialPredictiveOptimization','outboundQueuePauses','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','checkContactBlack','recallme','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','Agent','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','dialOrderByScheduledAt','AVAILABLE_CONTACTS_FINISHED','[getContactCampaign2][Empty]','RUNNING','[actionOriginate]\x20','[actionOriginateIvr]\x20','dialLimitQueue','Contact.phone','[getContactDialer2]','[handlePredictive][limitChannel]','tryOriginatePredictive','not_inuse','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','m\x20=\x20','interval\x20=\x20','Umin\x20=\x20','util','lodash','uuid','moment','md5','ioredis','../preview/util/util','../../../config/environment/','dialer','../../../config/logger','booked','predictive','predictiveCalls','../ami','redis','defaults','localhost','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./history','./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','uniqueId','startPredictive','startProgressive','queueBookedRR','queuecallerabandon','syncQueueCallerAbandon','bind','originateresponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummary','hangup','syncHangup','newexten','syncNewExten','varset','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','message','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','milliseconds','diff','seconds','emit','strategy','answered','loggedIn','sumBillable','sumDuration','sumHoldTime','talking','total','type','unmanaged','abandoned','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime'];(function(_0x168ecb,_0xd51f15){var _0x375aa8=function(_0x36a32f){while(--_0x36a32f){_0x168ecb['push'](_0x168ecb['shift']());}};_0x375aa8(++_0xd51f15);}(_0x138d,0x1ab));var _0xd138=function(_0x367995,_0x129ae2){_0x367995=_0x367995-0x0;var _0x22daa8=_0x138d[_0x367995];return _0x22daa8;};'use strict';var util=require(_0xd138('0x0'));var _=require(_0xd138('0x1'));var BPromise=require('bluebird');var uuid=require(_0xd138('0x2'));var moment=require(_0xd138('0x3'));var rr=require('rr');var md5=require(_0xd138('0x4'));var Redis=require(_0xd138('0x5'));var ut=require(_0xd138('0x6'));var config=require(_0xd138('0x7'));var logger=require('../../../config/logger')(_0xd138('0x8'));var loggerBooked=require(_0xd138('0x9'))(_0xd138('0xa'));var loggerPredictive=require('../../../config/logger')(_0xd138('0xb'));var loggerPredictiveCalls=require(_0xd138('0x9'))(_0xd138('0xc'));var loggerSyncQueueSummary=require('../../../config/logger')('syncQueueSummary');var ami=require(_0xd138('0xd'));config[_0xd138('0xe')]=_[_0xd138('0xf')](config['redis'],{'host':_0xd138('0x10'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var cmHopper=require(_0xd138('0x11'));var cmHopperHistory=require(_0xd138('0x12'));var cmHopperBlack=require(_0xd138('0x13'));var voiceQueueRt=require(_0xd138('0x14'));var Action=require('./action');var History=require(_0xd138('0x15'));var Final=require('./final');var AgentComplete=require(_0xd138('0x16'));var QueueCallerAbandon=require(_0xd138('0x17'));var Hangup=require(_0xd138('0x18'));var ipAgi=process[_0xd138('0x19')][_0xd138('0x1a')]||_0xd138('0x1b');var strategy={'rrmemory':_0xd138('0x1c'),'roundrobin':_0xd138('0x1d')};var Sequence=function(){};Sequence[_0xd138('0x1e')][_0xd138('0x1f')]=function(_0x44b99a){this[_0xd138('0x20')]=this['tail']?this[_0xd138('0x20')][_0xd138('0x21')](_0x44b99a):_0x44b99a();};function Dialer(_0x4d1496,_0x5b67bf){this['sequence']=new Sequence();this[_0xd138('0x22')]=_0x5b67bf;this[_0xd138('0x23')]=_0x4d1496['voiceQueues'];this[_0xd138('0x24')]=_0x4d1496[_0xd138('0x24')];this[_0xd138('0x25')]=_0x4d1496[_0xd138('0x25')];this['trunks']=_0x4d1496[_0xd138('0x26')];this[_0xd138('0x27')]=config[_0xd138('0x27')]||0x2;this[_0xd138('0x28')]={};this[_0xd138('0x29')]={};this[_0xd138('0x2a')]={};this[_0xd138('0x2b')]={};this['optionPredictive']={};this[_0xd138('0x2c')]={};this[_0xd138('0x2d')]={};this['ivrOriginated']={};this['queueBooked']={};this[_0xd138('0x2e')]={};ami['on']('agentconnect',this['syncAgentConnect']['bind'](this));ami['on'](_0xd138('0x2f'),this[_0xd138('0x30')][_0xd138('0x31')](this));ami['on'](_0xd138('0x32'),this['syncOriginateResponse'][_0xd138('0x31')](this));ami['on'](_0xd138('0x33'),this[_0xd138('0x34')][_0xd138('0x31')](this));ami['on'](_0xd138('0x35'),this[_0xd138('0x36')][_0xd138('0x31')](this));ami['on'](_0xd138('0x37'),this[_0xd138('0x38')][_0xd138('0x31')](this));ami['on'](_0xd138('0x39'),this[_0xd138('0x3a')]['bind'](this));ami['on'](_0xd138('0x3b'),this['syncVarSet'][_0xd138('0x31')](this));ami['on']('queuemember',this['syncQueueMember']['bind'](this));ami['on'](_0xd138('0x3c'),this[_0xd138('0x3d')][_0xd138('0x31')](this));this[_0xd138('0x3e')]();this['loopClearZombieChannels']();}function isNotNull(_0x43afcf){return _0x43afcf!==null&&!_['isUndefined'](_0x43afcf);}function checkIsLoggedIn(_0x355085,_0x2d60f4){return function(){if(_0x2d60f4<=0x0){_0x355085[_0xd138('0x3f')]='AGENTS_NOT_LOGGED';throw _0x355085[_0xd138('0x40')]+_0xd138('0x41');}};}function isActive(_0x4d0a10){return _0x4d0a10;}function checkIsActive(_0x2dffcc,_0x5e775b){return function(){if(!isActive(_0x5e775b)){_0x2dffcc[_0xd138('0x3f')]=_0xd138('0x42');throw _0x2dffcc[_0xd138('0x40')]+_0xd138('0x43');}};}function checkInterval(_0x337bdc){return function(){if(!isNotNull(_0x337bdc[_0xd138('0x44')])){_0x337bdc['message']=_0xd138('0x45');throw _0x337bdc[_0xd138('0x40')]+_0xd138('0x46');}if(!isNotNull(_0x337bdc['Interval'][_0xd138('0x47')])){_0x337bdc['message']=_0xd138('0x45');throw _0x337bdc['name']+_0xd138('0x46');}if(!isNotNull(_[_0xd138('0x48')](_0x337bdc[_0xd138('0x44')]['Intervals']))){_0x337bdc[_0xd138('0x3f')]='INTERVAL_IS_NULL';throw _0x337bdc[_0xd138('0x40')]+_0xd138('0x46');}};}function msgResponse(_0x5a0b21,_0x5207aa,_0x3753fb){return{'action':_0x5a0b21,'response':_0x5207aa,'message':_0x3753fb,'stack':_0x3753fb};}function myreject(_0x584929){return function(_0x3ff80e){return _0x584929(msgResponse(_0xd138('0x49'),'Error',JSON['stringify'](_0x3ff80e)));};}function getSeconds(_0x47f545,_0x544cc9){var _0x13f9fc=moment(_0x47f545)['milliseconds'](0x0);var _0x1a3c43=moment(_0x544cc9)[_0xd138('0x4a')](0x0);return _0x13f9fc[_0xd138('0x4b')](_0x1a3c43,_0xd138('0x4c'));}function emit(_0x16f946,_0x187acc,_0x2372f9){io['to'](_0x16f946)[_0xd138('0x4d')](_0x187acc,_0x2372f9);}function emitVoiceQueueSummary(_0x51d934){if(_0x51d934['type']==='outbound'){var _0x2fd523={'id':_0x51d934['id'],'name':_0x51d934[_0xd138('0x40')],'strategy':_0x51d934[_0xd138('0x4e')],'answered':_0x51d934[_0xd138('0x4f')],'available':_0x51d934['available'],'loggedIn':_0x51d934[_0xd138('0x50')],'pTalking':_0x51d934['pTalking'],'sumBillable':_0x51d934[_0xd138('0x51')],'sumDuration':_0x51d934[_0xd138('0x52')],'sumHoldTime':_0x51d934[_0xd138('0x53')]||0x0,'talking':_0x51d934[_0xd138('0x54')],'total':_0x51d934[_0xd138('0x55')],'type':_0x51d934[_0xd138('0x56')],'unmanaged':_0x51d934[_0xd138('0x57')],'abandoned':_0x51d934[_0xd138('0x58')],'waiting':_0x51d934[_0xd138('0x59')],'loggedInDb':_0x51d934['loggedInDb'],'dialActive':_0x51d934[_0xd138('0x5a')],'dialMethod':_0x51d934[_0xd138('0x5b')],'dialOriginateCallerIdName':_0x51d934[_0xd138('0x5c')],'dialOriginateCallerIdNumber':_0x51d934[_0xd138('0x5d')],'dialOriginateTimeout':_0x51d934[_0xd138('0x5e')],'dialPrefix':_0x51d934['dialPrefix'],'outboundAnswerAgiCallsDay':_0x51d934['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x51d934[_0xd138('0x5f')],'outboundBlacklistCallsDay':_0x51d934[_0xd138('0x60')],'outboundBusyCallsDay':_0x51d934[_0xd138('0x61')],'outboundCongestionCallsDay':_0x51d934[_0xd138('0x62')],'outboundDropCallsDayACS':_0x51d934[_0xd138('0x63')],'outboundDropCallsDayCallersExit':_0x51d934[_0xd138('0x64')],'outboundDropCallsDayTimeout':_0x51d934[_0xd138('0x65')],'outboundNoAnswerCallsDay':_0x51d934[_0xd138('0x66')],'outboundNoSuchCallsDay':_0x51d934[_0xd138('0x67')],'outboundOriginateFailureCallsDay':_0x51d934[_0xd138('0x68')],'outboundReCallsDay':_0x51d934[_0xd138('0x69')],'outboundRejectCallsDay':_0x51d934[_0xd138('0x6a')],'outboundUnknownCallsDay':_0x51d934['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x51d934[_0xd138('0x6b')],'predictiveIntervalAvgHoldtime':_0x51d934[_0xd138('0x6c')],'predictiveIntervalAvgTalktime':_0x51d934[_0xd138('0x6d')],'predictiveIntervalDroppedCallsCallersExit':_0x51d934['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x51d934[_0xd138('0x6e')],'predictiveIntervalErlangCalls':_0x51d934[_0xd138('0x6f')],'predictiveIntervalErlangCallsDroppedCalls':_0x51d934[_0xd138('0x70')],'predictiveIntervalHitRate':_0x51d934[_0xd138('0x71')],'predictiveIntervalMultiplicativeFactor':_0x51d934[_0xd138('0x72')],'predictiveIntervalPauses':_0x51d934[_0xd138('0x73')],'predictiveIntervalAvailable':_0x51d934['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x51d934[_0xd138('0x74')],'message':_0x51d934[_0xd138('0x3f')],'originated':_0x51d934['originated'],'erlangCalls':_0x51d934[_0xd138('0x75')],'erlangCallToSecond':_0x51d934['erlangCallToSecond'],'erlangAbandonmentRate':_0x51d934[_0xd138('0x76')],'erlangBusyFactor':_0x51d934[_0xd138('0x77')],'startPredictive':_0x51d934[_0xd138('0x2c')],'startProgressive':_0x51d934['startProgressive']};if(_0x51d934['Trunk']){_0x2fd523[_0xd138('0x78')]={'id':_0x51d934[_0xd138('0x78')]['id'],'name':_0x51d934[_0xd138('0x78')][_0xd138('0x40')],'active':_0x51d934[_0xd138('0x78')]['active'],'callerid':_0x51d934['Trunk']['callerid']};}if(_0x51d934[_0xd138('0x44')]){_0x2fd523[_0xd138('0x44')]={'id':_0x51d934[_0xd138('0x44')]['id'],'name':_0x51d934[_0xd138('0x44')]['name']};}var _0x5e9973=md5(JSON[_0xd138('0x79')](_0x2fd523));if(_0x51d934[_0xd138('0x4')]!==_0x5e9973){_0x51d934[_0xd138('0x4')]=_0x5e9973;emit(util[_0xd138('0x7a')]('voice:queue:%s',_0x2fd523[_0xd138('0x40')]),_0xd138('0x7b'),_0x2fd523);}}}function emitCampaignSummary(_0x148299){if(_0x148299['type']===_0xd138('0x7c')){emit(util[_0xd138('0x7a')](_0xd138('0x7d'),_0x148299['name']),'campaign:save',_0x148299);}}function checkGetDataPredictive(_0x5eb05c){if(isNotNull(_0x5eb05c)&&!_[_0xd138('0x48')](_0x5eb05c)){loggerPredictive[_0xd138('0x7e')](_0xd138('0x7f'));loggerPredictive[_0xd138('0x7e')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5eb05c[_0xd138('0x74')]);loggerPredictive[_0xd138('0x7e')](_0xd138('0x80'),_0x5eb05c[_0xd138('0x6b')]);loggerPredictive[_0xd138('0x7e')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5eb05c['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0xd138('0x7e')](_0xd138('0x81'),_0x5eb05c[_0xd138('0x82')]);loggerPredictive[_0xd138('0x7e')](_0xd138('0x83'),_0x5eb05c['predictiveIntervalAvgHoldtime']);loggerPredictive[_0xd138('0x7e')](_0xd138('0x84'),_0x5eb05c[_0xd138('0x6d')]);loggerPredictive[_0xd138('0x7e')](_0xd138('0x85'));if(_0x5eb05c[_0xd138('0x74')]>0x0){if(!_[_0xd138('0x86')](_0x5eb05c[_0xd138('0x6d')])&&_0x5eb05c[_0xd138('0x6d')]>0x0){return!![];}loggerPredictive['info'](_0xd138('0x87'));if(!_['isUndefined'](_0x5eb05c['predictiveIntervalAvgHoldtime'])&&_0x5eb05c[_0xd138('0x6c')]>0x0){return!![];}loggerPredictive['info']('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive['info'](_0xd138('0x88'));}}else{loggerPredictive[_0xd138('0x7e')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x815b0d){return function(_0x344252){loggerPredictive[_0xd138('0x7e')](_0xd138('0x89'));loggerPredictive[_0xd138('0x7e')](_0xd138('0x8a'),_0x344252[_0xd138('0x75')]);loggerPredictive[_0xd138('0x7e')](_0xd138('0x8b'),_0x344252[_0xd138('0x8c')]);loggerPredictive['info'](_0xd138('0x8d'),_0x344252['erlangAbandonmentRate']);loggerPredictive['info'](_0xd138('0x8e'),_0x344252[_0xd138('0x77')]);loggerPredictive[_0xd138('0x7e')](_0xd138('0x8d'),_0x344252['erlangAbandonmentRate']);loggerPredictive[_0xd138('0x7e')](_0xd138('0x85'));_['merge'](_0x815b0d,_0x344252);};}function getDiff(_0x7bcbdd){var _0x4ab5c3=moment()[_0xd138('0x4a')](0x0);var _0x4f18dc=moment(_0x7bcbdd)[_0xd138('0x4a')](0x0);return _0x4ab5c3[_0xd138('0x4b')](_0x4f18dc,_0xd138('0x4c'));}function ifInterval(_0x1f9ca5,_0x3e23f1){if(_[_0xd138('0x86')](_0x3e23f1)){return![];}return getDiff(_0x3e23f1)<_0x1f9ca5*0x3c;}function freeVariablesPredictive(_0x123612){if(isNotNull(_0x123612)){if(!_['isUndefined'](_0x123612[_0xd138('0x2d')])){_0x123612[_0xd138('0x2d')]=undefined;loggerPredictive[_0xd138('0x7e')](_0x123612[_0xd138('0x40')],_0xd138('0x8f'));}if(!_[_0xd138('0x86')](_0x123612['startPredictive'])){_0x123612['startPredictive']=undefined;loggerPredictive['info'](_0x123612[_0xd138('0x40')],'clearing\x20variable\x20start\x20predictive');}if(!_[_0xd138('0x86')](_0x123612[_0xd138('0x90')])){clearInterval(_0x123612[_0xd138('0x90')]);_0x123612['handlePredictive']=undefined;loggerPredictive[_0xd138('0x7e')](_0x123612['name'],_0xd138('0x91'));}}}function erlangb(_0x490bed,_0x38041a){if(_0x38041a===0x0){return 0x0;}var _0x15899f=0x1;for(var _0x293cf1=0x1;_0x293cf1<=_0x38041a;_0x293cf1+=0x1){_0x15899f=0x1+_0x15899f*_0x293cf1/_0x490bed;}return 0x1/_0x15899f;}function isVoiceQueueOutbound(_0x270fae){return _0x270fae===_0xd138('0x92');}function isNotPreview(_0x4da240){return _0x4da240!==_0xd138('0x22');}function isCampaignIvr(_0x38922c){return _0x38922c==='ivr';}function getCallerId(_0x42b483,_0x197fd4,_0x52e0fe){if(!_[_0xd138('0x86')](_0x52e0fe)&&typeof _0x52e0fe==='string'&&!_[_0xd138('0x48')](_0x52e0fe)){if(!_[_0xd138('0x86')](_0x197fd4)&&typeof _0x197fd4===_0xd138('0x93')&&!_['isEmpty'](_0x197fd4)){return util[_0xd138('0x7a')](_0xd138('0x94'),_0x197fd4,_0x52e0fe);}return util[_0xd138('0x7a')](_0xd138('0x94'),_0x52e0fe,_0x52e0fe);}if(!_[_0xd138('0x86')](_0x42b483)&&typeof _0x42b483===_0xd138('0x93')&&!_[_0xd138('0x48')](_0x42b483)){return _0x42b483;}return _0xd138('0x95');}function loggerCatchQueueSummary(_0x132283,_0x447d84){return function(_0x36f76e){freeVariablesPredictive(_0x447d84);emitVoiceQueueSummary(_0x447d84);emitCampaignSummary(_0x447d84);loggerSyncQueueSummary[_0xd138('0x96')](_0x132283,util[_0xd138('0x97')](_0x36f76e,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x263208,_0xb549cf){return function(_0x381fbc){loggerPredictive[_0xd138('0x96')](_0xb549cf['name'],_0x263208);loggerPredictive['error'](_0x381fbc[_0xd138('0x98')]);freeVariablesPredictive(_0xb549cf);};}function loggerCatch(_0x4b4a43){return function(_0x2c4732){logger[_0xd138('0x96')](_0x4b4a43,util[_0xd138('0x97')](_0x2c4732,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x2735dd){return _0x2735dd&&!_[_0xd138('0x86')](_0x2735dd)&&_0x2735dd[_0xd138('0x99')]>0x0;}function decremetOriginate(_0xc34c0d){if(!_[_0xd138('0x86')](_0xc34c0d)&&_0xc34c0d!==null){if(typeof _0xc34c0d[_0xd138('0x9a')]!==_0xd138('0x9b')){if(_0xc34c0d[_0xd138('0x9a')]>0x0){_0xc34c0d['originated']-=0x1;}else{logger['error'](_0xd138('0x9c'));}}}else{logger[_0xd138('0x96')](_0xd138('0x9d'));}}function checkContactLowerLimitOriginate(_0x1e4ac2,_0x345b55,_0x3d3a47){if(_0x345b55>_0x3d3a47){for(var _0x5ae060=0x0;_0x5ae060<_0x345b55-_0x3d3a47;_0x5ae060+=0x1){decremetOriginate(_0x1e4ac2);}}}function loggerGetContactDialer(_0x4c7ec4,_0x5d418f,_0x332cd6){return function(_0x5e793a){checkContactLowerLimitOriginate(_0x5d418f,_0x332cd6,0x0);logger[_0xd138('0x96')](_0x4c7ec4,util[_0xd138('0x97')](_0x5e793a,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x177d0c){return function(_0x27d24f){if(isNotNull(_0x27d24f)&&isNotNull(_0x27d24f[0x0])){if(_0x27d24f[0x0][_0xd138('0x9e')]>0x0){_0x177d0c['message']=_0xd138('0x9f');logger[_0xd138('0x7e')](_0xd138('0xa0')+_0x177d0c[_0xd138('0x40')],_0x27d24f[0x0]['contactsRescheduled'],_0xd138('0xa1'));}else{_0x177d0c[_0xd138('0x3f')]='AVAILABLE_CONTACTS_FINISHED';logger[_0xd138('0x7e')](_0xd138('0xa2')+_0x177d0c[_0xd138('0x40')]);}}};}function notSendMessagesQueue(_0x1376fd){if(_0x1376fd[_0xd138('0xa3')]){freeVariablesPredictive(_0x1376fd);if(_0x1376fd['originated']===0x0&&_0x1376fd[_0xd138('0x54')]===0x0&&_0x1376fd['waiting']===0x0&&(_0x1376fd[_0xd138('0xa4')]||0x0)===0x0){_0x1376fd['sendMessageOneNotActive']=![];_0x1376fd[_0xd138('0xa5')]=0x0;_0x1376fd[_0xd138('0x3f')]='NOT_ACTIVE';loggerSyncQueueSummary[_0xd138('0x96')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x1376fd[_0xd138('0x40')],_0xd138('0xa6'));}else{_0x1376fd[_0xd138('0x3f')]=_0xd138('0xa7');loggerSyncQueueSummary[_0xd138('0x96')](_0xd138('0xa8'),_0x1376fd[_0xd138('0x40')],_0xd138('0xa9'));}emitVoiceQueueSummary(_0x1376fd);}}function notSendMessagesCampaign(_0x8fa43a){if(_0x8fa43a[_0xd138('0xa3')]){if(_0x8fa43a[_0xd138('0x9a')]===0x0){_0x8fa43a[_0xd138('0xa3')]=![];_0x8fa43a[_0xd138('0x3f')]='NOT_ACTIVE';loggerSyncQueueSummary[_0xd138('0x96')](_0xd138('0xaa'),_0x8fa43a[_0xd138('0x40')],_0xd138('0xa6'));}else{_0x8fa43a[_0xd138('0x3f')]='IS_DISACTIVED';loggerSyncQueueSummary[_0xd138('0x96')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x8fa43a['name'],'is\x20disactive');}emitCampaignSummary(_0x8fa43a);}}function createObjHistory(_0x5ec7ce,_0x5b89bc,_0x1c5878,_0x2fada4,_0x1a20c8){_0x5ec7ce['message']=_0x1c5878;var _0x2a7d40=new Action(_0x5ec7ce,_0x5b89bc);var _0x393bb2=new History(_0x2a7d40);_0x393bb2[_0xd138('0xab')]=_0x2fada4;_0x393bb2[_0xd138('0xac')]=_0x1a20c8;_0x393bb2[_0xd138('0xad')]=_0x2a7d40[_0xd138('0xae')];return _0x393bb2;}Dialer[_0xd138('0x1e')]['loopClearZombieChannels']=function(){var _0xaffe24=this;setInterval(function(){_0xaffe24['clearZombieChannels'](_0xaffe24[_0xd138('0x2b')],'[uniqueid]');_0xaffe24[_0xd138('0xaf')](_0xaffe24['actions'],_0xd138('0xb0'));},0x32c8);};Dialer[_0xd138('0x1e')][_0xd138('0xaf')]=function(_0x236835,_0x1b5b6b){var _0x220eee=this;for(var _0x2b7248 in _0x236835){if(typeof _0x236835[_0x2b7248]!=='undefined'){this['sequence']['enqueue'](function(){if(!_[_0xd138('0xb1')](_0x236835[_0x2b7248])){return ami[_0xd138('0xb2')]({'action':_0xd138('0xb3'),'channel':_0x236835[_0x2b7248][_0xd138('0xb4')]})[_0xd138('0xb5')](function(_0x5caabe){if(_0x5caabe[_0xd138('0x3f')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x236835[_0x2b7248]&&_0x236835[_0x2b7248][_0xd138('0x56')]!==_0xd138('0x7c')){_0x220eee[_0xd138('0xb6')](_0x220eee['voiceQueues'][_0x236835[_0x2b7248][_0xd138('0xb7')]]);logger['error'](_0xd138('0xb8'),_0x1b5b6b,_0x2b7248,_0x236835[_0x2b7248][_0xd138('0xb7')]);delete _0x236835[_0x2b7248];}if(_0x236835[_0x2b7248]&&_0x236835[_0x2b7248][_0xd138('0x56')]===_0xd138('0x7c')){_0x220eee[_0xd138('0xb6')](_0x220eee[_0xd138('0x24')][_0x236835[_0x2b7248][_0xd138('0xb7')]]);logger[_0xd138('0x96')](_0xd138('0xb9'),_0x1b5b6b,_0x2b7248,_0x236835[_0x2b7248]['queue']);delete _0x236835[_0x2b7248];}},0x2328);}});}});}}};Dialer['prototype']['countReScheduled']=function(_0x322649){return BPromise[_0xd138('0xba')]()[_0xd138('0xbb')](cmHopper[_0xd138('0xbc')](_0x322649))[_0xd138('0xb5')](loggerCatch(_0xd138('0xbd')));};Dialer[_0xd138('0x1e')][_0xd138('0xbe')]=function(_0x19490a){return BPromise[_0xd138('0xba')]()['then'](cmHopperBlack[_0xd138('0xbe')](_0x19490a))[_0xd138('0xb5')](loggerCatch(_0xd138('0xbf')));};Dialer['prototype'][_0xd138('0xc0')]=function(_0x3a1503){return BPromise[_0xd138('0xba')]()['then'](cmHopperBlack['checkIsBlackListIvr'](_0x3a1503))[_0xd138('0xb5')](loggerCatch(_0xd138('0xc1')));};Dialer[_0xd138('0x1e')][_0xd138('0xc2')]=function(_0x2d8084){return BPromise['resolve']()[_0xd138('0xbb')](cmHopperHistory[_0xd138('0xc3')](_0x2d8084))[_0xd138('0xb5')](loggerCatch(_0xd138('0xc4')));};Dialer[_0xd138('0x1e')][_0xd138('0xc5')]=function(_0x1d536e){return BPromise[_0xd138('0xba')]()[_0xd138('0xbb')](cmHopper[_0xd138('0xc5')](_0x1d536e))[_0xd138('0xb5')](loggerCatch(_0xd138('0xc6')));};Dialer[_0xd138('0x1e')][_0xd138('0xc7')]=function(_0x1db360,_0x286a79,_0xd66c68){return BPromise[_0xd138('0xba')]()['then'](cmHopper[_0xd138('0xc7')](_0x1db360,_0x286a79,_0xd66c68))[_0xd138('0xb5')](loggerCatch(_0xd138('0xc8')));};Dialer[_0xd138('0x1e')][_0xd138('0xc9')]=function(_0x3c9e5f,_0x1f566c,_0x449608,_0x21310c,_0x1cd3ea){return BPromise[_0xd138('0xba')]()[_0xd138('0xbb')](cmHopper[_0xd138('0xc9')](_0x3c9e5f,_0x1f566c,_0x449608,_0x21310c))[_0xd138('0xb5')](function(_0xa9f8c2){_0x1cd3ea[_0xd138('0xca')]-=_0x449608;_0x1cd3ea['temp']=_0x1cd3ea['temp']>0x0?_0x1cd3ea[_0xd138('0xca')]:0x0;loggerCatch('[getContactDialer]\x20')(_0xa9f8c2);});};Dialer[_0xd138('0x1e')][_0xd138('0xcb')]=function(_0x3ac2e8,_0x9b0a4b,_0x4f102d,_0x40406d){return BPromise['resolve']()[_0xd138('0xbb')](cmHopper[_0xd138('0xcb')](_0x3ac2e8,_0x9b0a4b,_0x4f102d))[_0xd138('0xb5')](function(_0x7ab874){_0x40406d[_0xd138('0xca')]-=_0x9b0a4b;_0x40406d['temp']=_0x40406d[_0xd138('0xca')]>0x0?_0x40406d[_0xd138('0xca')]:0x0;loggerCatch(_0xd138('0xcc'))(_0x7ab874);});};Dialer[_0xd138('0x1e')][_0xd138('0xcd')]=function(_0xb50e92){return BPromise[_0xd138('0xba')]()[_0xd138('0xbb')](voiceQueueRt['getVoiceQueueRtPauses'](_0xb50e92))['catch'](loggerCatch(_0xd138('0xce')));};Dialer[_0xd138('0x1e')][_0xd138('0xcf')]=function(_0x270238){return BPromise[_0xd138('0xba')]()[_0xd138('0xbb')](cmHopper[_0xd138('0xcf')](_0x270238))[_0xd138('0xb5')](loggerCatch(_0xd138('0xd0')));};Dialer[_0xd138('0x1e')][_0xd138('0xd1')]=function(_0x4f61a9){return BPromise['resolve']()[_0xd138('0xbb')](cmHopperHistory[_0xd138('0xd1')](_0x4f61a9))[_0xd138('0xb5')](loggerCatch('[createHistory]\x20'));};Dialer[_0xd138('0x1e')][_0xd138('0xb6')]=function(_0x4d58ea){if(!_[_0xd138('0x86')](_0x4d58ea)&&_0x4d58ea!==null){if(typeof _0x4d58ea[_0xd138('0x9a')]!==_0xd138('0x9b')){if(_0x4d58ea['originated']>0x0){_0x4d58ea['originated']-=0x1;}else{logger[_0xd138('0x96')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0xd138('0x96')](_0xd138('0xd2'));}};Dialer[_0xd138('0x1e')][_0xd138('0xd3')]=function(_0x474879,_0x1768d8){var _0x5b979f=this;return function(_0x58b0ee){_0x5b979f[_0xd138('0xb6')](_0x1768d8);logger['error'](_0x474879,util['inspect'](_0x58b0ee,{'showHidden':![],'depth':null}));};};Dialer[_0xd138('0x1e')][_0xd138('0xd4')]=function(_0x34628e,_0x1fde3f,_0x21bc80){var _0x3e0f9a={'state':0x19,'statedesc':_0xd138('0xd5')};this[_0xd138('0xb6')](_0x1fde3f);this[_0xd138('0xd6')](_[_0xd138('0xd7')](_0x3e0f9a,_[_0xd138('0xd8')](_0x21bc80,[_0xd138('0xd9'),_0xd138('0xda'),_0xd138('0xdb'),_0xd138('0xdc'),_0xd138('0xdd')])),'[emptyContact][createHistory]',_0xd138('0xde'));logger[_0xd138('0x96')](_0x34628e);};Dialer[_0xd138('0x1e')][_0xd138('0xdf')]=function(_0x1df3d2){return _0x1df3d2==='Success';};Dialer[_0xd138('0x1e')]['isTrunkReachable']=function(_0x5e32c0){return!_[_0xd138('0x86')](_0x5e32c0)&&_0x5e32c0&&!_[_0xd138('0x86')](_0x5e32c0['name'])&&!_[_0xd138('0x86')](_0x5e32c0[_0xd138('0xe0')])&&_0x5e32c0[_0xd138('0xe0')]&&(this[_0xd138('0x26')][util['format']('SIP/%s',_0x5e32c0[_0xd138('0x40')])][_0xd138('0xb3')]===_0xd138('0xe1')||this[_0xd138('0x26')][util[_0xd138('0x7a')](_0xd138('0xe2'),_0x5e32c0[_0xd138('0x40')])][_0xd138('0xb3')]===_0xd138('0xe3'));};Dialer[_0xd138('0x1e')][_0xd138('0xd6')]=function(_0x1c54fd,_0x48a1d6,_0x308b5d){this['createHistory'](_0x1c54fd)[_0xd138('0xb5')](loggerCatch(_0x48a1d6));this[_0xd138('0xcf')](_0x1c54fd)[_0xd138('0xb5')](loggerCatch(_0x308b5d));};Dialer['prototype']['syncVarSet']=function(_0x4e4742){var _0x5c0453=this['uniqueId'][_0x4e4742[_0xd138('0xe4')]];var _0x67eded;if(!_[_0xd138('0xb1')](_0x4e4742)&&!_[_0xd138('0xb1')](_0x4e4742[_0xd138('0xe5')])&&!_[_0xd138('0xb1')](_0x4e4742[_0xd138('0xe5')][_0xd138('0xe6')])&&_0x4e4742['exten']===_0xd138('0xe7')&&_0x5c0453){if(_0x5c0453[_0xd138('0x56')]!==_0xd138('0x7c')&&this['voiceQueues'][_0x5c0453[_0xd138('0xb7')]][_0xd138('0xe8')]&&_0x4e4742[_0xd138('0xe9')]===_0xd138('0xea')){delete this['uniqueId'][_0x4e4742[_0xd138('0xe4')]];this[_0xd138('0xb6')](this['voiceQueues'][_0x5c0453[_0xd138('0xb7')]]);this[_0xd138('0x23')][_0x5c0453[_0xd138('0xb7')]][_0xd138('0x5f')]+=0x1;this[_0xd138('0x23')][_0x5c0453['queue']][_0xd138('0xeb')]+=0x1;_0x67eded=new Hangup(_0x5c0453,_0x4e4742);_0x67eded[_0xd138('0xab')]=0x12;_0x67eded[_0xd138('0xac')]=_0xd138('0xec');_0x67eded[_0xd138('0xed')]=_0xd138('0xee');ami[_0xd138('0x4d')]('custom:amd',ut[_0xd138('0xef')](_0x67eded,'amd'));this[_0xd138('0xd6')](_0x67eded,'[syncHangupInAMD][createHistory]',_0xd138('0xf0'));}if(_0x5c0453[_0xd138('0x56')]!==_0xd138('0x7c')&&this[_0xd138('0x23')][_0x5c0453[_0xd138('0xb7')]][_0xd138('0xe8')]&&_0x4e4742['value']===_0xd138('0xf1')){var _0x28010a=this;return new BPromise(function(_0x32d0fe,_0x84a98){delete _0x28010a['uniqueId'][_0x4e4742[_0xd138('0xe4')]];_0x28010a['updateOriginated'](_0x28010a[_0xd138('0x23')][_0x5c0453[_0xd138('0xb7')]]);_0x28010a[_0xd138('0x23')][_0x5c0453['queue']][_0xd138('0x5f')]+=0x1;_0x28010a[_0xd138('0x23')][_0x5c0453[_0xd138('0xb7')]][_0xd138('0xeb')]+=0x1;var _0x4a22e0=_0x28010a['voiceQueues'][_0x5c0453['queue']];var _0x3a89a0=new Hangup(_0x5c0453,_0x4e4742);_0x3a89a0['state']=0x13;_0x3a89a0[_0xd138('0xac')]=_0xd138('0xf2');_0x3a89a0[_0xd138('0xed')]=_0xd138('0xee');_0x3a89a0[_0xd138('0xf3')]+=0x1;_0x3a89a0[_0xd138('0xf4')]+=0x1;_0x3a89a0[_0xd138('0xf5')]=!![];ami['emit']('custom:amd',ut[_0xd138('0xef')](_0x3a89a0,_0xd138('0xf5')));_0x28010a[_0xd138('0xd1')](_0x3a89a0)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x3a89a0[_0xd138('0xf6')]+_0x3a89a0[_0xd138('0xf7')]+_0x3a89a0[_0xd138('0xf8')]+_0x3a89a0[_0xd138('0xf9')]+_0x3a89a0[_0xd138('0xfa')]+_0x3a89a0[_0xd138('0xfb')]+_0x3a89a0[_0xd138('0xf3')]+_0x3a89a0['countagentrejectretry']>=_0x4a22e0[_0xd138('0xfc')]){_0x28010a[_0xd138('0xfd')](_0x3a89a0,_0x32d0fe,_0x84a98,_0xd138('0xfe'));}else{if(_0x3a89a0[_0xd138('0xf3')]>=_0x4a22e0['dialMachineMaxRetry']){_0x28010a[_0xd138('0xff')](_0x3a89a0,_0x32d0fe,_0x84a98,_0xd138('0x100'));}else{_0x28010a['rescheduleContact']({'active':![],'countmachineretry':_0x3a89a0[_0xd138('0xf3')],'scheduledat':moment()['add'](_0x4a22e0[_0xd138('0x101')],_0xd138('0x102'))[_0xd138('0x7a')](_0xd138('0x103')),'ContactId':_0x3a89a0[_0xd138('0xd9')],'ListId':_0x3a89a0[_0xd138('0xda')],'VoiceQueueId':_0x3a89a0[_0xd138('0xdc')]||undefined,'CampaignId':_0x3a89a0[_0xd138('0xdd')]||undefined})[_0xd138('0xb5')](loggerCatch(_0xd138('0x104')));_0x32d0fe({'reschedule':0x1});}}});}if(_0x5c0453[_0xd138('0x56')]===_0xd138('0x7c')&&this[_0xd138('0x24')][_0x5c0453[_0xd138('0xb7')]][_0xd138('0xe8')]&&_0x4e4742[_0xd138('0xe9')]===_0xd138('0xea')){delete this[_0xd138('0x2b')][_0x4e4742[_0xd138('0xe4')]];this['updateOriginated'](this[_0xd138('0x24')][_0x5c0453[_0xd138('0xb7')]]);_0x67eded=new Hangup(_0x5c0453,_0x4e4742);_0x67eded['state']=0x12;_0x67eded[_0xd138('0xac')]=_0xd138('0xec');_0x67eded['membername']=_0xd138('0xee');ami[_0xd138('0x4d')]('custom:amd',ut[_0xd138('0xef')](_0x67eded,_0xd138('0xf5')));this[_0xd138('0xd6')](_0x67eded,'[syncHangupInAMDIvr][createHistory]',_0xd138('0x105'));}if(_0x5c0453[_0xd138('0x56')]==='ivr'&&this[_0xd138('0x24')][_0x5c0453[_0xd138('0xb7')]][_0xd138('0xe8')]&&_0x4e4742[_0xd138('0xe9')]===_0xd138('0xf1')){var _0x28010a=this;return new BPromise(function(_0x5ef2be,_0x268efe){delete _0x28010a[_0xd138('0x2b')][_0x4e4742['uniqueid']];_0x28010a['updateOriginated'](_0x28010a['campaigns'][_0x5c0453['queue']]);_0x28010a[_0xd138('0x24')][_0x5c0453['queue']][_0xd138('0x5f')]+=0x1;_0x28010a[_0xd138('0x24')][_0x5c0453[_0xd138('0xb7')]][_0xd138('0xeb')]+=0x1;var _0x48a882=_0x28010a[_0xd138('0x24')][_0x5c0453[_0xd138('0xb7')]];var _0x56fa73=new Hangup(_0x5c0453,_0x4e4742);_0x56fa73[_0xd138('0xab')]=0x13;_0x56fa73[_0xd138('0xac')]=_0xd138('0xf2');_0x56fa73[_0xd138('0xed')]=_0xd138('0xee');_0x56fa73[_0xd138('0xf3')]+=0x1;_0x56fa73[_0xd138('0xf4')]+=0x1;_0x56fa73[_0xd138('0xf5')]=!![];ami[_0xd138('0x4d')](_0xd138('0x106'),ut[_0xd138('0xef')](_0x56fa73,_0xd138('0xf5')));_0x28010a['createHistory'](_0x56fa73)['catch'](loggerCatch(_0xd138('0x107')));if(_0x56fa73[_0xd138('0xf6')]+_0x56fa73[_0xd138('0xf7')]+_0x56fa73['countnoanswerretry']+_0x56fa73[_0xd138('0xf9')]+_0x56fa73[_0xd138('0xfa')]+_0x56fa73[_0xd138('0xfb')]+_0x56fa73['countmachineretry']+_0x56fa73['countagentrejectretry']>=_0x48a882[_0xd138('0xfc')]){_0x28010a[_0xd138('0xfd')](_0x56fa73,_0x5ef2be,_0x268efe,'reason19\x20machine....');}else{if(_0x56fa73[_0xd138('0xf3')]>=_0x48a882[_0xd138('0x108')]){_0x28010a[_0xd138('0xff')](_0x56fa73,_0x5ef2be,_0x268efe,'reason\x2019\x20machine....');}else{_0x28010a[_0xd138('0xc5')]({'active':![],'countmachineretry':_0x56fa73[_0xd138('0xf3')],'scheduledat':moment()['add'](_0x48a882[_0xd138('0x101')],_0xd138('0x102'))[_0xd138('0x7a')](_0xd138('0x103')),'ContactId':_0x56fa73[_0xd138('0xd9')],'ListId':_0x56fa73[_0xd138('0xda')],'VoiceQueueId':_0x56fa73[_0xd138('0xdc')]||undefined,'CampaignId':_0x56fa73['CampaignId']||undefined})[_0xd138('0xb5')](loggerCatch(_0xd138('0x104')));_0x5ef2be({'reschedule':0x1});}}});}}};Dialer[_0xd138('0x1e')]['syncHangup']=function(_0x5600d5){var _0x3f1770=this[_0xd138('0x2b')][_0x5600d5['uniqueid']];var _0x186fde=this;var _0x314e2c;if(_0x3f1770&&_0x3f1770[_0xd138('0x56')]===_0xd138('0x7c')){delete this[_0xd138('0x2b')][_0x5600d5[_0xd138('0xe4')]];this[_0xd138('0xb6')](this['campaigns'][_0x3f1770[_0xd138('0xb7')]]);this['campaigns'][_0x3f1770['queue']][_0xd138('0x109')]+=0x1;_0x314e2c=new Hangup(_0x3f1770,_0x5600d5);this[_0xd138('0xd1')](_0x314e2c)[_0xd138('0xb5')](loggerCatch(_0xd138('0x10a')));this[_0xd138('0xcf')](_0x314e2c)[_0xd138('0xb5')](loggerCatch(_0xd138('0x10b')));}if(_0x3f1770&&_0x3f1770['type']!=='ivr'&&isNotNull(this[_0xd138('0x23')][_0x3f1770[_0xd138('0xb7')]][_0xd138('0x10c')])){delete this[_0xd138('0x2b')][_0x5600d5[_0xd138('0xe4')]];this[_0xd138('0xb6')](this[_0xd138('0x23')][_0x3f1770[_0xd138('0xb7')]]);this['voiceQueues'][_0x3f1770['queue']]['outboundAnswerCallsDay']+=0x1;this['voiceQueues'][_0x3f1770[_0xd138('0xb7')]][_0xd138('0xeb')]+=0x1;_0x314e2c=new Hangup(_0x3f1770,_0x5600d5);_0x314e2c[_0xd138('0xab')]=0x10;_0x314e2c[_0xd138('0xac')]='AnswerAGI';_0x314e2c['membername']='AGI';this[_0xd138('0xd1')](_0x314e2c)[_0xd138('0xb5')](loggerCatch(_0xd138('0x10a')));this['moveContactManagedDialer'](_0x314e2c)[_0xd138('0xb5')](loggerCatch(_0xd138('0x10b')));}if(_0x3f1770&&_0x3f1770[_0xd138('0x56')]!==_0xd138('0x7c')&&!isNotNull(this[_0xd138('0x23')][_0x3f1770[_0xd138('0xb7')]]['dialQueueProject'])){delete this['uniqueId'][_0x5600d5[_0xd138('0xe4')]];this[_0xd138('0xb6')](this[_0xd138('0x23')][_0x3f1770[_0xd138('0xb7')]]);this[_0xd138('0x23')][_0x3f1770[_0xd138('0xb7')]]['outboundUnknownCallsDay']+=0x1;_0x314e2c=new Hangup(_0x3f1770,_0x5600d5);_0x314e2c[_0xd138('0xab')]=0xc;_0x314e2c[_0xd138('0xac')]=_0x5600d5['cause-txt'];_0x314e2c[_0xd138('0xed')]=_0xd138('0x10d');this['createHistory'](_0x314e2c)[_0xd138('0xb5')](loggerCatch(_0xd138('0x10a')));this['moveContactManagedDialer'](_0x314e2c)['catch'](loggerCatch(_0xd138('0x10b')));}};Dialer['prototype'][_0xd138('0x34')]=function(_0x1e6119){var _0x152abe=this['uniqueId'][_0x1e6119['uniqueid']];var _0x24c471=this;if(this['voiceQueues'][_0x1e6119[_0xd138('0xb7')]]){if(_0x152abe&&_0x152abe['type']!==_0xd138('0x7c')){delete this[_0xd138('0x2b')][_0x1e6119[_0xd138('0xe4')]];this[_0xd138('0x23')][_0x1e6119['queue']][_0xd138('0x5f')]+=0x1;var _0x575472=new AgentComplete(_0x152abe,_0x1e6119);if(_0x1e6119[_0xd138('0x10e')]===_0xd138('0x10f')){_0x575472['agiafterat']=this[_0xd138('0x23')][_0x1e6119[_0xd138('0xb7')]][_0xd138('0x110')]&&this[_0xd138('0x23')][_0x1e6119['queue']][_0xd138('0x111')]?moment()[_0xd138('0x7a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0xd138('0xd1')](_0x575472)[_0xd138('0xb5')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0xd138('0xcf')](_0x575472)['catch'](loggerCatch(_0xd138('0x112')));}}};Dialer[_0xd138('0x1e')]['syncAgentConnect']=function(_0x3b8118){if(this[_0xd138('0x23')][_0x3b8118[_0xd138('0xb7')]]){if(this[_0xd138('0x2b')][_0x3b8118[_0xd138('0xe4')]]&&this[_0xd138('0x2b')][_0x3b8118[_0xd138('0xe4')]][_0xd138('0x56')]!==_0xd138('0x7c')){this[_0xd138('0xb6')](this[_0xd138('0x23')][_0x3b8118[_0xd138('0xb7')]]);this[_0xd138('0x2b')][_0x3b8118[_0xd138('0xe4')]][_0xd138('0x113')]=moment()[_0xd138('0x7a')](_0xd138('0x103'));}}};Dialer[_0xd138('0x1e')][_0xd138('0x114')]=function(_0x1aeb50){this[_0xd138('0xd1')](_0x1aeb50)[_0xd138('0xb5')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0xd138('0xcf')](_0x1aeb50)[_0xd138('0xb5')](loggerCatch(_0xd138('0x115')));};Dialer['prototype']['syncQueueCallerAbandon']=function(_0x4036a3){var _0xceb2a8=this['uniqueId'][_0x4036a3[_0xd138('0xe4')]];var _0x1fcee8=this;if(this['voiceQueues'][_0x4036a3[_0xd138('0xb7')]]){if(_0xceb2a8&&_0xceb2a8[_0xd138('0x56')]!==_0xd138('0x7c')){delete this[_0xd138('0x2b')][_0x4036a3['uniqueid']];this[_0xd138('0xb6')](this[_0xd138('0x23')][_0x4036a3['queue']]);_0xceb2a8[_0xd138('0x116')]=moment()[_0xd138('0x7a')](_0xd138('0x103'));var _0x5ee820=new QueueCallerAbandon(_0xceb2a8,_0x4036a3);if(getSeconds(_0xceb2a8[_0xd138('0x116')],_0xceb2a8[_0xd138('0x117')])>=_0xceb2a8['dialQueueTimeout']){this[_0xd138('0x23')][_0x4036a3['queue']][_0xd138('0x6e')]+=0x1;this['voiceQueues'][_0x4036a3['queue']][_0xd138('0x65')]+=0x1;this['voiceQueues'][_0x4036a3[_0xd138('0xb7')]][_0xd138('0x70')]+=0x1;_0x5ee820[_0xd138('0xab')]=0xa;_0x5ee820[_0xd138('0xac')]='Drop';_0x5ee820[_0xd138('0x118')]=_0xd138('0x119');_0x5ee820[_0xd138('0x11a')]=this['voiceQueues'][_0x4036a3[_0xd138('0xb7')]][_0xd138('0x110')]?moment()[_0xd138('0x7a')](_0xd138('0x103')):undefined;_0x5ee820[_0xd138('0xfa')]+=0x1;_0x5ee820[_0xd138('0xf4')]+=0x1;if(_0x5ee820['countdropretry']>=this[_0xd138('0x23')][_0x4036a3[_0xd138('0xb7')]][_0xd138('0x11b')]){this[_0xd138('0x114')](_0x5ee820);}else{this[_0xd138('0xc5')]({'active':![],'countdropretry':_0x5ee820[_0xd138('0xfa')],'scheduledat':moment()[_0xd138('0x11c')](this[_0xd138('0x23')][_0x4036a3['queue']][_0xd138('0x11d')],_0xd138('0x102'))[_0xd138('0x7a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xceb2a8[_0xd138('0xd9')],'ListId':_0xceb2a8[_0xd138('0xda')],'VoiceQueueId':_0xceb2a8[_0xd138('0xdc')]||undefined,'CampaignId':_0xceb2a8[_0xd138('0xdd')]||undefined})[_0xd138('0xb5')](loggerCatch(_0xd138('0x11e')));var _0x48eef7=new History(_0x5ee820);_0x48eef7[_0xd138('0xab')]=0xa;_0x48eef7[_0xd138('0xac')]=_0xd138('0x11f');_0x48eef7[_0xd138('0xae')]=moment()[_0xd138('0x7a')](_0xd138('0x103'));_0x48eef7[_0xd138('0xad')]=_0x48eef7[_0xd138('0xae')];_0x48eef7[_0xd138('0x120')]=_0x5ee820[_0xd138('0x120')];_0x48eef7['calleridnum']=_0x5ee820[_0xd138('0x121')];this[_0xd138('0xd1')](_0x48eef7)[_0xd138('0xb5')](loggerCatch(_0xd138('0x122')));}}else{this[_0xd138('0x23')][_0x4036a3[_0xd138('0xb7')]][_0xd138('0x82')]+=0x1;this[_0xd138('0x23')][_0x4036a3[_0xd138('0xb7')]][_0xd138('0x64')]+=0x1;_0x5ee820[_0xd138('0xab')]=0xb;_0x5ee820[_0xd138('0xac')]=_0xd138('0x123');_0x5ee820['dropreason']=_0xd138('0x124');_0x5ee820['countabandonedretry']+=0x1;_0x5ee820['countglobal']+=0x1;if(_0x5ee820[_0xd138('0xfb')]>=this[_0xd138('0x23')][_0x4036a3[_0xd138('0xb7')]][_0xd138('0x125')]){this[_0xd138('0x114')](_0x5ee820);}else{this[_0xd138('0xc5')]({'active':![],'countabandonedretry':_0x5ee820[_0xd138('0xfb')],'scheduledat':moment()['add'](this[_0xd138('0x23')][_0x4036a3[_0xd138('0xb7')]][_0xd138('0x126')],_0xd138('0x102'))['format'](_0xd138('0x103')),'ContactId':_0xceb2a8['ContactId'],'ListId':_0xceb2a8[_0xd138('0xda')],'VoiceQueueId':_0xceb2a8[_0xd138('0xdc')]||undefined,'CampaignId':_0xceb2a8[_0xd138('0xdd')]||undefined})[_0xd138('0xb5')](loggerCatch(_0xd138('0x127')));var _0x48eef7=new History(_0x5ee820);_0x48eef7['state']=0xb;_0x48eef7[_0xd138('0xac')]='Abandoned';_0x48eef7[_0xd138('0xae')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x48eef7[_0xd138('0xad')]=_0x48eef7['starttime'];_0x48eef7[_0xd138('0x120')]=_0x5ee820[_0xd138('0x120')];_0x48eef7[_0xd138('0x121')]=_0x5ee820[_0xd138('0x121')];this[_0xd138('0xd1')](_0x48eef7)[_0xd138('0xb5')](loggerCatch(_0xd138('0x128')));}}}}};Dialer[_0xd138('0x1e')][_0xd138('0x3a')]=function(_0xab518a){if(this['actions'][_0xab518a[_0xd138('0xe4')]]){this[_0xd138('0x29')][_0xab518a[_0xd138('0xe4')]][_0xd138('0xb4')]=_0xab518a[_0xd138('0xb4')];}if(this[_0xd138('0x2b')][_0xab518a[_0xd138('0xe4')]]){this[_0xd138('0x2b')][_0xab518a[_0xd138('0xe4')]][_0xd138('0xb4')]=_0xab518a['channel'];}};Dialer[_0xd138('0x1e')][_0xd138('0x129')]=function(_0x323c16){if(strategy[this[_0xd138('0x23')][this['actions'][_0x323c16[_0xd138('0x12a')]][_0xd138('0xb7')]][_0xd138('0x4e')]]==='roundrobin'){if(this[_0xd138('0x29')][_0x323c16[_0xd138('0x12a')]]&&_[_0xd138('0xb1')](this[_0xd138('0x29')][_0x323c16[_0xd138('0x12a')]]['locked'])&&_0x323c16[_0xd138('0xb3')]==='1'&&_0x323c16[_0xd138('0x12b')]==='0'){if(this[_0xd138('0x25')][_0x323c16[_0xd138('0x12c')]]){if(!this[_0xd138('0x25')][_0x323c16[_0xd138('0x12c')]][_0xd138('0x12d')]){this[_0xd138('0x25')][_0x323c16[_0xd138('0x12c')]][_0xd138('0x12d')]=!![];this[_0xd138('0x29')][_0x323c16[_0xd138('0x12a')]]['locked']=!![];this[_0xd138('0x29')][_0x323c16['actionid']][_0xd138('0x12c')]=_0x323c16['stateinterface'];}}}}else if((strategy[this[_0xd138('0x23')][this[_0xd138('0x29')][_0x323c16['actionid']][_0xd138('0xb7')]]['strategy']]||_0xd138('0x1c'))===_0xd138('0x1c')){if(this[_0xd138('0x29')][_0x323c16['actionid']]){if(this[_0xd138('0x25')][_0x323c16['stateinterface']]){this['actions'][_0x323c16[_0xd138('0x12a')]][_0xd138('0x12c')]=_0x323c16[_0xd138('0x12c')];if(_[_0xd138('0xb1')](this[_0xd138('0x12e')][this['actions'][_0x323c16[_0xd138('0x12a')]][_0xd138('0xb7')]])){this['queueBooked'][this[_0xd138('0x29')][_0x323c16[_0xd138('0x12a')]][_0xd138('0xb7')]]=[];}this[_0xd138('0x12e')][this['actions'][_0x323c16['actionid']][_0xd138('0xb7')]]['push'](_[_0xd138('0xd7')](_['pick'](this[_0xd138('0x29')][_0x323c16['actionid']],[_0xd138('0x12f'),'stateinterface']),{'status':_0x323c16[_0xd138('0xb3')],'paused':_0x323c16[_0xd138('0x12b')]}));}}}};function unlockQueueStatus(_0x74c131,_0x320bab){setTimeout(function(){if(_['isUndefined'](_0x74c131[_0xd138('0x130')])){loggerBooked[_0xd138('0x96')](_0xd138('0x131'),_0x320bab);}_0x74c131[_0xd138('0x130')]=!![];loggerBooked[_0xd138('0x7e')](_0xd138('0x132'),_0x320bab,JSON['stringify'](_[_0xd138('0xd8')](_0x74c131,['name',_0xd138('0x130')])));},0x1f3);}Dialer['prototype'][_0xd138('0x3d')]=function(_0x1d39f1){var _0xc10f25=this;var _0x4d6c33=_0xc10f25['voiceQueues'][_0xc10f25[_0xd138('0x29')][_0x1d39f1[_0xd138('0x12a')]][_0xd138('0xb7')]];if(strategy[this[_0xd138('0x23')][this['actions'][_0x1d39f1[_0xd138('0x12a')]][_0xd138('0xb7')]][_0xd138('0x4e')]]===_0xd138('0x1d')){if(this['actions'][_0x1d39f1[_0xd138('0x12a')]]&&this['actions'][_0x1d39f1[_0xd138('0x12a')]][_0xd138('0x12c')]){this['preview']['run'](this[_0xd138('0x29')][_0x1d39f1[_0xd138('0x12a')]][_0xd138('0x12f')],this[_0xd138('0x29')][_0x1d39f1[_0xd138('0x12a')]][_0xd138('0x12c')])[_0xd138('0xb5')](function(_0x1670d5){logger[_0xd138('0x96')](_0xd138('0x133'),util[_0xd138('0x97')](_0x1670d5,{'showHidden':![],'depth':null}));})[_0xd138('0x21')](function(){_0xc10f25[_0xd138('0xb6')](_0xc10f25[_0xd138('0x23')][_0xc10f25[_0xd138('0x29')][_0x1d39f1[_0xd138('0x12a')]][_0xd138('0xb7')]]);_0xc10f25[_0xd138('0x25')][_0xc10f25[_0xd138('0x29')][_0x1d39f1[_0xd138('0x12a')]]['stateinterface']]['locked']=![];delete _0xc10f25[_0xd138('0x29')][_0x1d39f1[_0xd138('0x12a')]];unlockQueueStatus(_0x4d6c33);});}else{this[_0xd138('0xb6')](this[_0xd138('0x23')][this[_0xd138('0x29')][_0x1d39f1[_0xd138('0x12a')]][_0xd138('0xb7')]]);this[_0xd138('0xc5')]({'active':![],'ContactId':this[_0xd138('0x29')][_0x1d39f1['actionid']][_0xd138('0xd9')],'ListId':this[_0xd138('0x29')][_0x1d39f1[_0xd138('0x12a')]]['ListId'],'VoiceQueueId':this[_0xd138('0x29')][_0x1d39f1['actionid']][_0xd138('0xdc')]||undefined,'CampaignId':this[_0xd138('0x29')][_0x1d39f1[_0xd138('0x12a')]][_0xd138('0xdd')]||undefined})[_0xd138('0xb5')](loggerCatch(_0xd138('0x134')));delete this[_0xd138('0x29')][_0x1d39f1[_0xd138('0x12a')]];unlockQueueStatus(_0x4d6c33);}}else if((strategy[this[_0xd138('0x23')][this[_0xd138('0x29')][_0x1d39f1[_0xd138('0x12a')]][_0xd138('0xb7')]][_0xd138('0x4e')]]||_0xd138('0x1c'))===_0xd138('0x1c')){var _0xac712d;if(this[_0xd138('0x29')][_0x1d39f1[_0xd138('0x12a')]]&&!_[_0xd138('0x48')](this[_0xd138('0x12e')][this[_0xd138('0x29')][_0x1d39f1[_0xd138('0x12a')]][_0xd138('0xb7')]])){if(this['queueBookedRR'][_0xc10f25[_0xd138('0x29')][_0x1d39f1[_0xd138('0x12a')]][_0xd138('0xb7')]]){this[_0xd138('0x2e')][_0xc10f25[_0xd138('0x29')][_0x1d39f1[_0xd138('0x12a')]][_0xd138('0xb7')]]=this[_0xd138('0x2e')][this[_0xd138('0x29')][_0x1d39f1[_0xd138('0x12a')]]['queue']]?this[_0xd138('0x2e')][this[_0xd138('0x29')][_0x1d39f1[_0xd138('0x12a')]]['queue']]:this[_0xd138('0x12e')][this[_0xd138('0x29')][_0x1d39f1[_0xd138('0x12a')]][_0xd138('0xb7')]]?this[_0xd138('0x12e')][this[_0xd138('0x29')][_0x1d39f1[_0xd138('0x12a')]][_0xd138('0xb7')]]['_rr']||0x0:0x0;}this[_0xd138('0x12e')][this['actions'][_0x1d39f1[_0xd138('0x12a')]][_0xd138('0xb7')]][_0xd138('0x135')]=this[_0xd138('0x2e')][this['actions'][_0x1d39f1[_0xd138('0x12a')]][_0xd138('0xb7')]];for(var _0x559fa4=0x0;_0x559fa4=0x0;})[_0xd138('0xb5')](myreject(_0x5d5456)));}}else{_0x53b20b[_0xd138('0x14c')](ami['Action']({'action':_0xd138('0x14d'),'command':util[_0xd138('0x7a')](_0xd138('0x14e'),_0x304556,!_[_0xd138('0x86')](config[_0xd138('0x14a')][_0x5af0b8])?_0x5af0b8:'')})[_0xd138('0xbb')](function(_0x43971d){return _0x43971d[_0xd138('0x150')][_0xd138('0x151')](_0xd138('0x152'))>=0x0;})[_0xd138('0xb5')](myreject(_0x5d5456)));}BPromise['all'](_0x53b20b)['then'](function(_0xc83b41){var _0x31c691=_[_0xd138('0x153')](_0xc83b41);if(_0x31c691){return _0x453dd4(_0x31c691);}else{_0x26e18f[_0xd138('0x3f')]=_0x218cac?'GLOBAL_INTERVAL_IS_OVERTIME':_0xd138('0x154');return _0x5d5456(msgResponse(_0xd138('0x155'),_0xd138('0x148'),_0xd138('0x156')+_0x218cac+'\x20'+_0x89c8c0+_0xd138('0x157')+util[_0xd138('0x97')](_0x304556,{'showHidden':![],'depth':null})+_0xd138('0x158')+_0x5af0b8));}})['catch'](function(_0x1f6d16){return _0x5d5456(msgResponse('ifTime',_0xd138('0x148'),JSON['stringify'](_0x1f6d16)));});});};Dialer[_0xd138('0x1e')]['checkDialMethod']=function(_0xdd1524){var _0x4f9ba9=this;return function(){switch(_0xdd1524[_0xd138('0x5b')]){case _0xd138('0x159'):freeVariablesPredictive(_0xdd1524);_0x4f9ba9[_0xd138('0x15a')](_0xdd1524,0x1);break;case _0xd138('0x15b'):freeVariablesPredictive(_0xdd1524);_0x4f9ba9[_0xd138('0x15a')](_0xdd1524,_0xdd1524[_0xd138('0x15c')]);break;case _0xd138('0xb'):_0x4f9ba9[_0xd138('0xb')](_0xdd1524);break;case _0xd138('0xa'):freeVariablesPredictive(_0xdd1524);_0x4f9ba9[_0xd138('0x15a')](_0xdd1524,0x1);break;default:freeVariablesPredictive(_0xdd1524);logger[_0xd138('0x96')](_0xd138('0x15d'),_0xdd1524[_0xd138('0x40')],'method\x20not\x20recognized');}};};Dialer[_0xd138('0x1e')][_0xd138('0x15e')]=function(_0x14d31b){var _0x30b16f=this;return function(){_0x30b16f[_0xd138('0x15f')](_0x14d31b);};};Dialer[_0xd138('0x1e')][_0xd138('0x36')]=function(_0x343443){var _0x44f177=this;if(isNotPreview(_0x343443[_0xd138('0x5b')])){if(isVoiceQueueOutbound(_0x343443[_0xd138('0x56')])&&isActive(_0x343443['dialActive'])){_0x343443[_0xd138('0xa3')]=!![];BPromise[_0xd138('0xba')]()['then'](checkIsLoggedIn(_0x343443,_0x343443[_0xd138('0x50')]))[_0xd138('0xbb')](checkIsActive(_0x343443,_0x343443[_0xd138('0x5a')]))[_0xd138('0xbb')](checkInterval(_0x343443))[_0xd138('0xbb')](_0x44f177['checkIsTrunkReachable'](_0x343443))[_0xd138('0xbb')](_0x44f177['checkIfTime'](_0x343443['dialGlobalInterval'],_0x343443[_0xd138('0x160')],_0x343443['name'],_0x343443))[_0xd138('0xbb')](_0x44f177[_0xd138('0x146')](_0x343443[_0xd138('0x44')],_0x343443[_0xd138('0x160')],_0x343443[_0xd138('0x40')],_0x343443))[_0xd138('0xbb')](_0x44f177[_0xd138('0x161')](_0x343443))[_0xd138('0xb5')](loggerCatchQueueSummary('[syncQueueSummary]',_0x343443));}else{notSendMessagesQueue(_0x343443);}}else{freeVariablesPredictive(_0x343443);}};Dialer[_0xd138('0x1e')][_0xd138('0x140')]=function(){var _0x2fc44d=this;var _0x57e478;for(var _0x4eff3a in this[_0xd138('0x24')]){if(typeof this[_0xd138('0x24')][_0x4eff3a]!==_0xd138('0x9b')){_0x57e478=this[_0xd138('0x24')][_0x4eff3a];if(isCampaignIvr(_0x57e478['type'])&&isActive(_0x57e478[_0xd138('0xe0')])){_0x57e478[_0xd138('0xa3')]=!![];BPromise[_0xd138('0xba')]()[_0xd138('0xbb')](checkIsActive(_0x57e478,_0x57e478['active']))[_0xd138('0xbb')](checkInterval(_0x57e478))[_0xd138('0xbb')](_0x2fc44d['checkIsTrunkReachable'](_0x57e478))[_0xd138('0xbb')](_0x2fc44d[_0xd138('0x162')](_0x57e478[_0xd138('0x163')],_0x57e478[_0xd138('0x160')],_0x57e478[_0xd138('0x40')],_0x57e478))['then'](_0x2fc44d[_0xd138('0x146')](_0x57e478[_0xd138('0x44')],_0x57e478[_0xd138('0x160')],_0x57e478['name'],_0x57e478))[_0xd138('0xbb')](_0x2fc44d[_0xd138('0x15e')](_0x57e478))['catch'](loggerCatchQueueSummary(_0xd138('0x164'),_0x57e478));}else{notSendMessagesCampaign(_0x57e478);}}}};function getCallerIdRandom(_0x5aa198,_0x51e64b){var _0x4429e9;var _0x5066d2;var _0xa976af;if(_0x51e64b<=0x0){_0x51e64b=0x1;}_0x4429e9=new RegExp(_0xd138('0x165')+_0x51e64b+'}$');_0x5066d2=Math['pow'](0xa,_0x51e64b-0x1);_0xa976af=Math['pow'](0xa,_0x51e64b)-0x1;return util[_0xd138('0x7a')]('%s',_['replace'](_0x5aa198,_0x4429e9,_[_0xd138('0x166')](_0x5066d2,_0xa976af)));}function extractCalleridName(_0x3ecdc8){var _0x575613=_0x3ecdc8[_0xd138('0x167')](/"(.*?)"/);return _0x575613?_0x575613[0x1]:_0x3ecdc8;}function extractCalleridNumber(_0x4837ca){var _0x14de94=_0x4837ca['match'](/<(.*?)>/);return _0x14de94?_0x14de94[0x1]:_0x4837ca;}Dialer[_0xd138('0x1e')][_0xd138('0x168')]=function(_0x4491b1,_0x18a5a8){var _0x2a7481=this;var _0x2087e9=uuid['v4']();this[_0xd138('0x29')][_0x2087e9]=new Action(_0x4491b1,_0x18a5a8,_0x2087e9);return new BPromise(function(_0x16f57a,_0x22b597){if(_['isUndefined'](_0x4491b1)&&typeof _0x4491b1!==_0xd138('0x169')){return _0x22b597(msgResponse(_0xd138('0x16a'),_0xd138('0x148'),_0xd138('0x16b')));}if(_['isUndefined'](_0x18a5a8['Contact'][_0xd138('0x16c')])||_0x18a5a8[_0xd138('0x16d')]['phone']===null){return _0x22b597(msgResponse('originate',_0xd138('0x148'),_0xd138('0x16e')));}var _0x4a1a57={'XMD-CALLERID':_0x2a7481[_0xd138('0x29')][_0x2087e9]['getCaller'](),'XMD-AGI':_0x4491b1[_0xd138('0x10c')]?util[_0xd138('0x7a')](_0xd138('0x16f'),ipAgi,_0x4491b1[_0xd138('0x10c')]):_0xd138('0x170'),'XMD-AGIAFTER':_0x4491b1[_0xd138('0x110')]?util['format'](_0xd138('0x16f'),ipAgi,_0x4491b1[_0xd138('0x110')]):_0xd138('0x170'),'XMD-QUEUE':_0x4491b1['type']===_0xd138('0x92')?util[_0xd138('0x7a')](_0xd138('0x171'),_0x4491b1[_0xd138('0x40')],_0x4491b1[_0xd138('0x172')]||'',_0x4491b1[_0xd138('0x111')]?'c':'',_0x4491b1[_0xd138('0x173')]||0x3):_0xd138('0x170'),'XMD-CONTACTID':_0x18a5a8[_0xd138('0xd9')],'XMD-CDRTYPE':_0xd138('0x8'),'CALLERID(all)':_0x2a7481[_0xd138('0x29')][_0x2087e9][_0xd138('0x174')](),'XMD-AMD':_0x4491b1[_0xd138('0xe8')]?_0xd138('0x175'):'NONE','XMD-DESTINATION':_0xd138('0xe7')};if(_0x4491b1['dialAMDActive']){_0x4a1a57['XMD-AMDINITIALSILENCE']=_0x4491b1[_0xd138('0x176')]||0x9c4;_0x4a1a57[_0xd138('0x177')]=_0x4491b1[_0xd138('0x178')]||0x5dc;_0x4a1a57[_0xd138('0x179')]=_0x4491b1[_0xd138('0x17a')]||0x320;_0x4a1a57['XMD-AMDTOTALANALYSISTIME']=_0x4491b1['dialAMDTotalAnalysisTime']||0x1388;_0x4a1a57[_0xd138('0x17b')]=_0x4491b1[_0xd138('0x17c')]||0x64;_0x4a1a57['XMD-AMDBETWEENWORDSSILENCE']=_0x4491b1[_0xd138('0x17d')]||0x32;_0x4a1a57[_0xd138('0x17e')]=_0x4491b1[_0xd138('0x17f')]||0x3;_0x4a1a57[_0xd138('0x180')]=_0x4491b1['dialAMDSilenceThreshold']||0x100;_0x4a1a57[_0xd138('0x181')]=_0x4491b1[_0xd138('0x182')]||0x1388;}if(_0x4491b1[_0xd138('0x56')]===_0xd138('0x92')){_0x4a1a57[_0xd138('0x183')]=_0x18a5a8[_0xd138('0xdc')];}else{_0x4a1a57['XMD-CAMPAIGNID']=_0x18a5a8[_0xd138('0xdd')];}for(var _0x3ff4da in _0x18a5a8[_0xd138('0x16d')]){if(typeof _0x18a5a8[_0xd138('0x16d')][_0x3ff4da]!=='undefined'){if(isNotNull(_0x18a5a8['Contact'][_0x3ff4da])&&_0x3ff4da!=='id'&&_0x3ff4da!=='tags'&&_0x3ff4da!==_0xd138('0x184')&&_0x3ff4da!==_0xd138('0x185')){_0x4a1a57[util[_0xd138('0x7a')](_0xd138('0x186'),_0xd138('0x187'),_[_0xd138('0x188')](_0x3ff4da))]=_0x18a5a8[_0xd138('0x16d')][_0x3ff4da];}}}var _0x52dfe4=_0x2a7481[_0xd138('0x141')](_0x4491b1[_0xd138('0x78')])?getCallerId(_0x4491b1[_0xd138('0x78')]['callerid'],_0x4491b1['dialOriginateCallerIdName'],_0x4491b1[_0xd138('0x189')]>0x0?getCallerIdRandom(_0x4491b1['dialOriginateCallerIdNumber'],_0x4491b1['dialRandomLastDigitCallerIdNumber']):_0x4491b1[_0xd138('0x5d')]):getCallerId(_['isNil'](_0x4491b1['TrunkBackup'])?_0x4491b1[_0xd138('0x78')][_0xd138('0x18a')]:_0x4491b1[_0xd138('0x142')][_0xd138('0x18a')],_0x4491b1['dialOriginateCallerIdName'],_0x4491b1[_0xd138('0x189')]>0x0?getCallerIdRandom(_0x4491b1['dialOriginateCallerIdNumber'],_0x4491b1[_0xd138('0x189')]):_0x4491b1[_0xd138('0x5d')]);if(_0x52dfe4){_0x4a1a57['XMD-ORIGINATECALLERIDNAME']=_0x2a7481[_0xd138('0x29')][_0x2087e9]['originatecalleridname']=extractCalleridName(_0x52dfe4);_0x4a1a57[_0xd138('0x18b')]=_0x2a7481['actions'][_0x2087e9][_0xd138('0x18c')]=extractCalleridNumber(_0x52dfe4);}return ami[_0xd138('0xb2')]({'actionid':_0x2087e9,'action':_0xd138('0x16a'),'channel':_0x2a7481[_0xd138('0x141')](_0x4491b1[_0xd138('0x78')])?util[_0xd138('0x7a')](_0xd138('0x18d'),_0x4491b1[_0xd138('0x78')][_0xd138('0x40')],isNotNull(_0x4491b1[_0xd138('0x18e')])?_0x4491b1[_0xd138('0x18e')][_0xd138('0x18f')]()||'':'',_0x4491b1[_0xd138('0x190')]>0x0?_0x18a5a8['Contact']['phone'][_0xd138('0x191')](_0x4491b1[_0xd138('0x190')]):_0x18a5a8['Contact']['phone']):util[_0xd138('0x7a')](_0xd138('0x18d'),_[_0xd138('0xb1')](_0x4491b1[_0xd138('0x142')])?_0x4491b1[_0xd138('0x78')][_0xd138('0x40')]:_0x4491b1[_0xd138('0x142')][_0xd138('0x40')],isNotNull(_0x4491b1['dialPrefix'])?_0x4491b1['dialPrefix'][_0xd138('0x18f')]()||'':'',_0x4491b1[_0xd138('0x190')]>0x0?_0x18a5a8[_0xd138('0x16d')][_0xd138('0x16c')][_0xd138('0x191')](_0x4491b1['dialCutDigit']):_0x18a5a8['Contact']['phone']),'callerid':_0x52dfe4,'Exten':_0xd138('0xe7'),'Context':_0xd138('0x192'),'Priority':'1','variable':_0x4a1a57,'timeout':(_0x4491b1['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x2087e9})[_0xd138('0xbb')](function(_0x2d214b){return _0x16f57a(_0x2d214b);})[_0xd138('0xb5')](function(_0x53e602){_0x4491b1[_0xd138('0x68')]+=0x1;var _0x3aa6f2=new History(_0x2a7481[_0xd138('0x29')][_0x2087e9]);logger[_0xd138('0x96')](util['format'](_0xd138('0x193'),JSON[_0xd138('0x79')](_0x53e602)));_0x3aa6f2[_0xd138('0xab')]=0xe;_0x3aa6f2[_0xd138('0xac')]=_0xd138('0x194');_0x3aa6f2[_0xd138('0xae')]=moment()[_0xd138('0x7a')](_0xd138('0x103'));_0x3aa6f2[_0xd138('0xad')]=_0x3aa6f2[_0xd138('0xae')];_0x2a7481[_0xd138('0xd1')](_0x3aa6f2)[_0xd138('0xb5')](loggerCatch(_0xd138('0x195')));_0x2a7481[_0xd138('0xcf')](_0x3aa6f2)[_0xd138('0xb5')](loggerCatch(_0xd138('0x195')))[_0xd138('0x21')](function(){delete _0x2a7481['actions'][_0x2087e9];return _0x22b597(msgResponse('originate',_0xd138('0x196'),_0xd138('0x197')));});});});};Dialer[_0xd138('0x1e')]['syncOriginateResponse']=function(_0x20f261){var _0x279acb=this[_0xd138('0x29')][_0x20f261[_0xd138('0x12a')]];if(_0x279acb){delete this['actions'][_0x20f261['actionid']];_0x279acb['responsetime']=moment()[_0xd138('0x7a')]('YYYY-MM-DD\x20HH:mm:ss');var _0x388d11=_0x279acb['type']===_0xd138('0x7c')?this['campaigns'][_0x279acb[_0xd138('0xb7')]]:this[_0xd138('0x23')][_0x279acb['getQueue']()];if(!this[_0xd138('0xdf')](_0x20f261[_0xd138('0x198')])){this[_0xd138('0xb6')](_0x388d11);return this[_0xd138('0x199')](_0x279acb,_0x388d11,_0x20f261)[_0xd138('0xb5')](loggerCatch(_0xd138('0x19a')));}this[_0xd138('0x2b')][_0x20f261[_0xd138('0xe4')]]=_0x279acb;}};Dialer[_0xd138('0x1e')][_0xd138('0x19b')]=function(_0x343880,_0x5ad9ec,_0x40e3bd){var _0x2e8cf7=new History(_0x5ad9ec);if(_0x2e8cf7['countbusyretry']+_0x2e8cf7[_0xd138('0xf7')]+_0x2e8cf7[_0xd138('0xf8')]+_0x2e8cf7[_0xd138('0xf9')]+_0x2e8cf7[_0xd138('0xfa')]+_0x2e8cf7[_0xd138('0xfb')]+_0x2e8cf7[_0xd138('0xf3')]+_0x2e8cf7[_0xd138('0x19c')]>=_0x40e3bd[_0xd138('0xfc')]-0x1){return!![];}switch(_0x343880){case 0x3:if(_0x2e8cf7['countnoanswerretry']>=_0x40e3bd[_0xd138('0x19d')]-0x1){return!![];}this[_0xd138('0xc5')]({'active':![],'countnoanswerretry':_0x2e8cf7[_0xd138('0xf8')]+=0x1,'scheduledat':moment()[_0xd138('0x11c')](_0x40e3bd[_0xd138('0x19e')],'minutes')[_0xd138('0x7a')](_0xd138('0x103')),'ContactId':_0x2e8cf7[_0xd138('0xd9')],'ListId':_0x2e8cf7[_0xd138('0xda')],'VoiceQueueId':_0x2e8cf7[_0xd138('0xdc')]||undefined,'CampaignId':_0x2e8cf7[_0xd138('0xdd')]||undefined})[_0xd138('0xb5')](loggerCatch(_0xd138('0x19f')));break;case 0x5:if(_0x2e8cf7[_0xd138('0xf6')]>=_0x40e3bd[_0xd138('0x1a0')]-0x1){return!![];}this[_0xd138('0xc5')]({'active':![],'countbusyretry':_0x2e8cf7['countbusyretry']+=0x1,'scheduledat':moment()[_0xd138('0x11c')](_0x40e3bd[_0xd138('0x1a1')],'minutes')[_0xd138('0x7a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2e8cf7[_0xd138('0xd9')],'ListId':_0x2e8cf7[_0xd138('0xda')],'VoiceQueueId':_0x2e8cf7[_0xd138('0xdc')]||undefined,'CampaignId':_0x2e8cf7[_0xd138('0xdd')]||undefined})[_0xd138('0xb5')](loggerCatch(_0xd138('0x1a2')));break;case 0x8:if(_0x2e8cf7[_0xd138('0xf7')]>=_0x40e3bd[_0xd138('0x1a3')]-0x1){return!![];}this[_0xd138('0xc5')]({'active':![],'countcongestionretry':_0x2e8cf7[_0xd138('0xf7')]+=0x1,'scheduledat':moment()[_0xd138('0x11c')](_0x40e3bd[_0xd138('0x1a4')],_0xd138('0x102'))[_0xd138('0x7a')](_0xd138('0x103')),'ContactId':_0x2e8cf7[_0xd138('0xd9')],'ListId':_0x2e8cf7[_0xd138('0xda')],'VoiceQueueId':_0x2e8cf7[_0xd138('0xdc')]||undefined,'CampaignId':_0x2e8cf7[_0xd138('0xdd')]||undefined})[_0xd138('0xb5')](loggerCatch(_0xd138('0x1a5')));break;case 0x0:if(_0x2e8cf7['countnosuchnumberretry']>=_0x40e3bd[_0xd138('0x1a6')]-0x1){return!![];}else{this[_0xd138('0xc5')]({'active':![],'countnosuchnumberretry':_0x2e8cf7['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0xd138('0x11c')](_0x40e3bd[_0xd138('0x1a7')],'minutes')[_0xd138('0x7a')](_0xd138('0x103')),'ContactId':_0x2e8cf7[_0xd138('0xd9')],'ListId':_0x2e8cf7['ListId'],'VoiceQueueId':_0x2e8cf7[_0xd138('0xdc')]||undefined,'CampaignId':_0x2e8cf7[_0xd138('0xdd')]||undefined})[_0xd138('0xb5')](loggerCatch(_0xd138('0x1a8')));}break;case 0xa:if(_0x2e8cf7[_0xd138('0xfa')]>=_0x40e3bd[_0xd138('0x11b')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0x2e8cf7['countdropretry']+=0x1,'scheduledat':moment()[_0xd138('0x11c')](_0x40e3bd[_0xd138('0x11d')],_0xd138('0x102'))[_0xd138('0x7a')](_0xd138('0x103')),'ContactId':_0x2e8cf7[_0xd138('0xd9')],'ListId':_0x2e8cf7['ListId'],'VoiceQueueId':_0x2e8cf7[_0xd138('0xdc')]||undefined,'CampaignId':_0x2e8cf7[_0xd138('0xdd')]||undefined})[_0xd138('0xb5')](loggerCatch(_0xd138('0x11e')));break;case 0xb:if(_0x2e8cf7['countabandonedretry']>=_0x40e3bd[_0xd138('0x125')]-0x1){return!![];}this[_0xd138('0xc5')]({'active':![],'countabandonedretry':_0x2e8cf7[_0xd138('0xfb')]+=0x1,'scheduledat':moment()['add'](_0x40e3bd[_0xd138('0x126')],_0xd138('0x102'))[_0xd138('0x7a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2e8cf7['ContactId'],'ListId':_0x2e8cf7[_0xd138('0xda')],'VoiceQueueId':_0x2e8cf7[_0xd138('0xdc')]||undefined,'CampaignId':_0x2e8cf7[_0xd138('0xdd')]||undefined})[_0xd138('0xb5')](loggerCatch(_0xd138('0x127')));break;case 0x13:if(_0x2e8cf7[_0xd138('0xf3')]>=_0x40e3bd[_0xd138('0x108')]-0x1){return!![];}this[_0xd138('0xc5')]({'active':![],'countmachineretry':_0x2e8cf7[_0xd138('0xf3')]+=0x1,'scheduledat':moment()[_0xd138('0x11c')](_0x40e3bd[_0xd138('0x101')],_0xd138('0x102'))[_0xd138('0x7a')](_0xd138('0x103')),'ContactId':_0x2e8cf7[_0xd138('0xd9')],'ListId':_0x2e8cf7[_0xd138('0xda')],'VoiceQueueId':_0x2e8cf7['VoiceQueueId']||undefined,'CampaignId':_0x2e8cf7[_0xd138('0xdd')]||undefined})[_0xd138('0xb5')](loggerCatch(_0xd138('0x104')));break;case 0x14:if(_0x2e8cf7[_0xd138('0x19c')]>=_0x40e3bd[_0xd138('0x1a9')]-0x1){return!![];}this[_0xd138('0xc5')]({'active':![],'countagentrejectretry':_0x2e8cf7[_0xd138('0x19c')]+=0x1,'scheduledat':moment()[_0xd138('0x11c')](_0x40e3bd[_0xd138('0x1aa')],_0xd138('0x102'))['format'](_0xd138('0x103')),'ContactId':_0x2e8cf7[_0xd138('0xd9')],'ListId':_0x2e8cf7[_0xd138('0xda')],'VoiceQueueId':_0x2e8cf7[_0xd138('0xdc')]||undefined,'CampaignId':_0x2e8cf7[_0xd138('0xdd')]||undefined})[_0xd138('0xb5')](loggerCatch(_0xd138('0x1ab')));break;default:return!![];}};Dialer[_0xd138('0x1e')][_0xd138('0x199')]=function(_0x1b4c5d,_0x1b5e4e,_0xde4ef8){var _0x13b215=this;var _0x1702de=new History(_0x1b4c5d);return new BPromise(function(_0x3e563a,_0x4f9e5a){if(_[_0xd138('0x86')](_0x1b5e4e)&&typeof _0x1b5e4e!==_0xd138('0x169')){return _0x4f9e5a(msgResponse('[callProgressDetecting]',_0xd138('0x148'),'entity\x20is\x20undefine'));}if(_[_0xd138('0x86')](_0xde4ef8)&&typeof _0xde4ef8!==_0xd138('0x169')){return _0x4f9e5a(msgResponse(_0xd138('0x1ac'),_0xd138('0x148'),'evt\x20is\x20undefine'));}switch(_0xde4ef8['reason']){case'0':_0x1b5e4e[_0xd138('0x67')]+=0x1;_0x1702de['state']=0x0;_0x1702de[_0xd138('0xac')]=_0xd138('0x1ad');_0x1702de[_0xd138('0xf9')]+=0x1;_0x1702de[_0xd138('0xf4')]+=0x1;ami[_0xd138('0x4d')]('custom:agentnosuchnumber',ut[_0xd138('0xef')](_0x1b4c5d,_0xd138('0x1ae')));_0x13b215[_0xd138('0xd1')](_0x1702de)['catch'](loggerCatch(_0xd138('0x107')));if(_0x13b215[_0xd138('0x19b')](0x0,_0x1b4c5d,_0x1b5e4e)){if(_0x1702de['countnosuchnumberretry']>=_0x1b5e4e[_0xd138('0x1a6')]){_0x13b215[_0xd138('0xff')](_0x1702de,_0x3e563a,_0x4f9e5a,_0xd138('0x1af'));}else{_0x13b215['stateGlobal'](_0x1702de,_0x3e563a,_0x4f9e5a,_0xd138('0x1af'));}}break;case'3':_0x1b5e4e[_0xd138('0x66')]+=0x1;_0x1702de[_0xd138('0xab')]=0x3;_0x1702de[_0xd138('0xac')]='NoAnswer';_0x1702de[_0xd138('0xf8')]+=0x1;_0x1702de['countglobal']+=0x1;ami[_0xd138('0x4d')](_0xd138('0x1b0'),ut[_0xd138('0xef')](_0x1b4c5d,_0xd138('0x1b1')));_0x13b215[_0xd138('0xd1')](_0x1702de)[_0xd138('0xb5')](loggerCatch(_0xd138('0x1b2')));if(_0x13b215[_0xd138('0x19b')](0x3,_0x1b4c5d,_0x1b5e4e)){if(_0x1702de[_0xd138('0xf8')]>=_0x1b5e4e['dialNoAnswerMaxRetry']){_0x13b215[_0xd138('0xff')](_0x1702de,_0x3e563a,_0x4f9e5a,_0xd138('0x1b3'));}else{_0x13b215[_0xd138('0xfd')](_0x1702de,_0x3e563a,_0x4f9e5a,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x1b5e4e[_0xd138('0x61')]+=0x1;_0x1702de[_0xd138('0xab')]=0x5;_0x1702de[_0xd138('0xac')]=_0xd138('0x1b4');_0x1702de[_0xd138('0xf6')]+=0x1;_0x1702de[_0xd138('0xf4')]+=0x1;ami['emit'](_0xd138('0x1b5'),ut[_0xd138('0xef')](_0x1b4c5d,'busy'));_0x13b215['createHistory'](_0x1702de)[_0xd138('0xb5')](loggerCatch(_0xd138('0x1b6')));if(_0x13b215['checkRetriveMax'](0x5,_0x1b4c5d,_0x1b5e4e)){if(_0x1702de[_0xd138('0xf6')]>=_0x1b5e4e[_0xd138('0x1a0')]){_0x13b215['createStateFinal'](_0x1702de,_0x3e563a,_0x4f9e5a,_0xd138('0x1b7'));}else{_0x13b215[_0xd138('0xfd')](_0x1702de,_0x3e563a,_0x4f9e5a,_0xd138('0x1b7'));}}break;case'8':_0x1b5e4e['outboundCongestionCallsDay']+=0x1;_0x1702de['state']=0x8;_0x1702de['statedesc']=_0xd138('0x1b8');_0x1702de[_0xd138('0xf7')]+=0x1;_0x1702de[_0xd138('0xf4')]+=0x1;ami[_0xd138('0x4d')](_0xd138('0x1b9'),ut['buildObj'](_0x1b4c5d,_0xd138('0x1ba')));_0x13b215[_0xd138('0xd1')](_0x1702de)[_0xd138('0xb5')](loggerCatch(_0xd138('0x1bb')));if(_0x13b215[_0xd138('0x19b')](0x8,_0x1b4c5d,_0x1b5e4e)){if(_0x1702de[_0xd138('0xf7')]>=_0x1b5e4e[_0xd138('0x1a3')]){_0x13b215[_0xd138('0xff')](_0x1702de,_0x3e563a,_0x4f9e5a,_0xd138('0x1bc'));}else{_0x13b215[_0xd138('0xfd')](_0x1702de,_0x3e563a,_0x4f9e5a,'reason\x208\x20congestion');}}break;case'11':_0x1b5e4e[_0xd138('0x1bd')]+=0x1;_0x1702de['state']=0xb;_0x1702de[_0xd138('0xac')]=_0xd138('0x123');_0x1702de[_0xd138('0xfb')]+=0x1;_0x1702de['countglobal']+=0x1;_0x13b215[_0xd138('0xd1')](_0x1702de)[_0xd138('0xb5')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x13b215[_0xd138('0x19b')](0xb,_0x1b4c5d,_0x1b5e4e)){if(_0x1702de[_0xd138('0xfb')]>=_0x1b5e4e[_0xd138('0x125')]){_0x13b215[_0xd138('0xff')](_0x1702de,_0x3e563a,_0x4f9e5a,'reason\x2011\x20abandoned');}else{_0x13b215[_0xd138('0xfd')](_0x1702de,_0x3e563a,_0x4f9e5a,_0xd138('0x1be'));}}break;case'20':_0x1b5e4e['outboundRejectCallsDay']+=0x1;_0x1702de[_0xd138('0xab')]=0x14;_0x1702de[_0xd138('0xac')]='AgentReject';_0x1702de['countagentrejectretry']+=0x1;_0x1702de[_0xd138('0xf4')]+=0x1;ami['emit']('custom:agentreject',ut[_0xd138('0xef')](_0x1b4c5d,'agentreject'));_0x13b215[_0xd138('0xd1')](_0x1702de)[_0xd138('0xb5')](loggerCatch(_0xd138('0x1bf')));if(_0x13b215[_0xd138('0x19b')](0x14,_0x1b4c5d,_0x1b5e4e)){if(_0x1702de[_0xd138('0x19c')]>=_0x1b5e4e[_0xd138('0x1a9')]){_0x13b215['createStateFinal'](_0x1702de,_0x3e563a,_0x4f9e5a,_0xd138('0x1c0'));}else{_0x13b215[_0xd138('0xfd')](_0x1702de,_0x3e563a,_0x4f9e5a,_0xd138('0x1c0'));}}break;default:_0x1b5e4e[_0xd138('0x1c1')]+=0x1;_0x1702de['state']=0xc;_0x1702de[_0xd138('0xac')]=_0xde4ef8[_0xd138('0x10e')];_0x13b215['createHistory'](_0x1702de)['catch'](loggerCatch(_0xd138('0x1c2')));if(_0x13b215[_0xd138('0x19b')](_0xde4ef8['reason'],_0x1b4c5d,_0x1b5e4e)){if(_0x1702de[_0xd138('0xf6')]+_0x1702de['countcongestionretry']+_0x1702de[_0xd138('0xf8')]+_0x1702de[_0xd138('0xf9')]+_0x1702de[_0xd138('0xfa')]+_0x1702de[_0xd138('0xfb')]+_0x1702de[_0xd138('0xf3')]+_0x1702de['countagentrejectretry']>=_0x1b5e4e[_0xd138('0xfc')]){_0x13b215[_0xd138('0xfd')](_0x1702de,_0x3e563a,_0x4f9e5a,_0xde4ef8['reason']);}else{_0x13b215[_0xd138('0xff')](_0x1702de,_0x3e563a,_0x4f9e5a,_0xde4ef8['reason']);}}}});};Dialer[_0xd138('0x1e')]['stateGlobal']=function(_0x33e387,_0x25bcac,_0x2f224d,_0x39ca7f){var _0x66fd84=new Final(_0x33e387);_0x66fd84['state']=0xf;_0x66fd84[_0xd138('0xac')]=_0xd138('0x1c3');this[_0xd138('0xff')](_0x66fd84,_0x25bcac,_0x2f224d,_0x39ca7f);};Dialer['prototype']['createStateFinal']=function(_0x238392,_0x339d43,_0xcf71d,_0x38b661){this[_0xd138('0xcf')](_0x238392)[_0xd138('0xbb')](function(){return _0x339d43(msgResponse('[callProgressDetecting]','Success',_0x38b661));})[_0xd138('0xb5')](function(){return _0xcf71d(msgResponse(_0xd138('0x1c4'),_0xd138('0x148'),_0xd138('0x1c5')));});};Dialer['prototype'][_0xd138('0xb')]=function(_0x23ad89){var _0x594f1=_0x23ad89[_0xd138('0x1c6')]/0x64;var _0x3f2371=_0x23ad89[_0xd138('0x65')]/(_0x23ad89[_0xd138('0x65')]+_0x23ad89['outboundAnswerCallsDay']);var _0x52631d=Math[_0xd138('0x1c7')](_0x23ad89[_0xd138('0x1c8')]*(_0x23ad89[_0xd138('0x1c9')]/0x64));var _0x512cd4=Math['round'](_0x23ad89[_0xd138('0x1c8')]*(_0x23ad89[_0xd138('0x1ca')]/0x64));var _0x4e59f0=_0x23ad89[_0xd138('0xa5')]+_0x23ad89[_0xd138('0x54')];var _0x86dc55=Math[_0xd138('0x1cb')](_0x23ad89[_0xd138('0x75')]*_0x23ad89['erlangAbandonmentRate']*_0x23ad89[_0xd138('0x71')]*_0x23ad89[_0xd138('0x72')]);if(_[_0xd138('0x86')](_0x23ad89[_0xd138('0x2d')])){if(!_[_0xd138('0x86')](_0x23ad89[_0xd138('0x2c')])){_0x23ad89['startPredictive']=undefined;loggerPredictive[_0xd138('0x96')](_0xd138('0x1cc'),_0xd138('0x1cd'));}if(!_[_0xd138('0x86')](_0x23ad89[_0xd138('0x90')])){loggerPredictive[_0xd138('0x96')](_0xd138('0x1cc'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x23ad89[_0xd138('0x90')]);_0x23ad89['handlePredictive']=undefined;}_0x23ad89['startProgressive']=moment()[_0xd138('0x7a')](_0xd138('0x103'));loggerPredictive[_0xd138('0x7e')](_0x23ad89[_0xd138('0x40')],_0xd138('0x1ce'),_0x23ad89[_0xd138('0x2d')]);this[_0xd138('0x15a')](_0x23ad89,0x1);}else if(ifInterval(_0x23ad89[_0xd138('0x1cf')],_0x23ad89['startProgressive'])){this['handlePower'](_0x23ad89,0x1);loggerPredictiveCalls[_0xd138('0x7e')](_0xd138('0x1d0'),_0x23ad89[_0xd138('0x2d')],_0x23ad89[_0xd138('0x40')]);_0x23ad89['erlangCalls']=0x0;_0x23ad89[_0xd138('0x70')]=0x0;}else if(_0x594f1<_0x3f2371&&_0x23ad89['dialPredictiveOptimization']===_0xd138('0x1d1')){freeVariablesPredictive(_0x23ad89);loggerPredictive[_0xd138('0x7e')](_0xd138('0x1d2'),'Dropped\x20calls\x20day',_0x3f2371,_0xd138('0x2d'),_0x23ad89[_0xd138('0x40')]);}else if(_0x86dc55<_0x23ad89['predictiveIntervalErlangCallsDroppedCalls']&&_0x23ad89['dialPredictiveOptimization']===_0xd138('0x1d1')){freeVariablesPredictive(_0x23ad89);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0xd138('0x1d3'),_0x86dc55,_0xd138('0x1d4'),_0x23ad89['predictiveIntervalErlangCallsDroppedCalls'],_0xd138('0x2d'),_0x23ad89['name']);}else if(!ifInterval(_0x23ad89[_0xd138('0x1cf')],_0x23ad89[_0xd138('0x2d')])&&_[_0xd138('0x86')](_0x23ad89['startPredictive'])&&!_['isUndefined'](_0x23ad89[_0xd138('0x2d')])){_0x23ad89[_0xd138('0x2c')]=moment()['format'](_0xd138('0x103'));loggerPredictive['info'](_0x23ad89[_0xd138('0x40')],_0xd138('0x1d5'),_0x23ad89[_0xd138('0x2c')]);this['averageHandleTime'](_0x23ad89['dialPredictiveInterval'])['then'](this[_0xd138('0x1d6')](_0x23ad89))[_0xd138('0xbb')](mergeDataErlangB(_0x23ad89))['then'](this[_0xd138('0x1d7')](_0x23ad89))['catch'](loggerCatchPredictive(_0xd138('0x1d8'),_0x23ad89));}else if(!ifInterval(_0x23ad89[_0xd138('0x1cf')],_0x23ad89['startPredictive'])){_0x23ad89[_0xd138('0x70')]=0x0;_0x23ad89['startPredictive']=moment()[_0xd138('0x7a')](_0xd138('0x103'));loggerPredictive[_0xd138('0x7e')](_0x23ad89[_0xd138('0x40')],'recalculate\x20predictive\x20at',_0x23ad89[_0xd138('0x2c')]);clearInterval(_0x23ad89[_0xd138('0x90')]);_0x23ad89[_0xd138('0x90')]=undefined;this[_0xd138('0xc2')](_0x23ad89[_0xd138('0x1cf')])['then'](this[_0xd138('0x1d6')](_0x23ad89))['then'](mergeDataErlangB(_0x23ad89))[_0xd138('0xbb')](this['startMethodPredictive'](_0x23ad89))[_0xd138('0xb5')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x23ad89));}else if(_0x23ad89[_0xd138('0x1c8')]&&_0x4e59f0<_0x23ad89[_0xd138('0x1c8')]-_0x512cd4){freeVariablesPredictive(_0x23ad89);loggerPredictive[_0xd138('0x7e')](_0x23ad89['name'],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x4e59f0,')\x20are\x20less\x20than\x20threshold\x20(',_0x23ad89['predictiveIntervalAvailable'],'-',_0x512cd4,'=',_0x23ad89[_0xd138('0x1c8')]-_0x512cd4,')');}else if(_0x23ad89[_0xd138('0x1c8')]&&_0x4e59f0>_0x23ad89[_0xd138('0x1c8')]+_0x52631d){freeVariablesPredictive(_0x23ad89);loggerPredictive[_0xd138('0x7e')](_0x23ad89[_0xd138('0x40')],_0xd138('0x1d9'),_0x4e59f0,_0xd138('0x1da'),_0x23ad89[_0xd138('0x1c8')],'+',_0x52631d,'=',_0x23ad89[_0xd138('0x1c8')]+_0x52631d,')');}};Dialer[_0xd138('0x1e')]['getDataPredictive']=function(_0x3c078d){var _0x64e3c6=this;return function(_0x4e10e2){return new BPromise(function(_0x1c0722,_0xafc0b7){_[_0xd138('0xd7')](_0x3c078d,_0x4e10e2[0x0]);if(checkGetDataPredictive(_0x4e10e2[0x0])){var _0x3cd29b=_0x3c078d[_0xd138('0x1c8')]=_0x3c078d[_0xd138('0x54')]+_0x3c078d[_0xd138('0xa5')];var _0x1524b3=_0x3c078d['dialPredictiveInterval']*0x3c;var _0x4cfbfb=_0x4e10e2[0x0][_0xd138('0x6d')]+_0x4e10e2[0x0][_0xd138('0x6c')];var _0x11dea8=(_0x4e10e2[0x0]['predictiveIntervalAnsweredCalls']+_0x4e10e2[0x0][_0xd138('0x6e')]+_0x4e10e2[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x4e10e2[0x0][_0xd138('0x74')];_0x3c078d[_0xd138('0x71')]=_0x11dea8>0x0?_0x11dea8:0x1;switch(_0x3c078d['dialPredictiveOptimization']){case _0xd138('0x1d1'):var _0x5bd82a=_0x3c078d[_0xd138('0x1c6')]/0x64;return _0x64e3c6[_0xd138('0x1db')](_0x3cd29b,_0x1524b3,_0x4cfbfb,_0x11dea8,_0x5bd82a)['then'](function(_0x3710b6){return _0x1c0722(_0x3710b6);});case _0xd138('0x1dc'):var _0x57ed80=_0x3c078d[_0xd138('0x1c6')]/0x64;return _0x64e3c6[_0xd138('0x1dd')](_0x3cd29b,_0x1524b3,_0x4cfbfb,_0x11dea8,_0x57ed80)[_0xd138('0xbb')](function(_0x261afc){return _0x1c0722(_0x261afc);});default:return _0xafc0b7(msgResponse(_0xd138('0x1de'),_0xd138('0x148'),_0xd138('0x1df')));}}else{return _0xafc0b7(msgResponse(_0xd138('0x1de'),'Failure',_0xd138('0x1e0')));}});};};Dialer[_0xd138('0x1e')][_0xd138('0x1e1')]=function(_0x2115e9){var _0x32d98c=this;return function(_0x322a3c){return new BPromise(function(_0x100176,_0x17d0c6){_['merge'](_0x2115e9,_0x322a3c[0x0]);if(checkGetDataPredictive(_0x322a3c[0x0])){loggerPredictive['info'](JSON[_0xd138('0x79')](_0x322a3c[0x0]));if(_0x2115e9[_0xd138('0x1e2')]===_0xd138('0x1d1')){return _0x32d98c[_0xd138('0xcd')](_0x2115e9['id'])[_0xd138('0xbb')](function(_0x7d647d){var _0x631c84=_0x2115e9[_0xd138('0x50')]-_0x7d647d[0x0][_0xd138('0x1e3')];var _0x3e36dc=_0x2115e9[_0xd138('0x1cf')]*0x3c;var _0x123243=_0x322a3c[0x0]['predictiveIntervalAvgTalktime']+_0x322a3c[0x0][_0xd138('0x6c')];var _0x4bd549=(_0x322a3c[0x0][_0xd138('0x6b')]+_0x322a3c[0x0][_0xd138('0x6e')]+_0x322a3c[0x0][_0xd138('0x82')])/_0x322a3c[0x0][_0xd138('0x74')];var _0xb2cee3=_0x2115e9[_0xd138('0x1c6')]/0x64;_0x2115e9[_0xd138('0x73')]=_0x7d647d[0x0][_0xd138('0x1e3')]||0x0;_0x2115e9[_0xd138('0x71')]=_0x4bd549>0x0?_0x4bd549:0x1;return _0x32d98c['abandonmentRate'](_0x631c84,_0x3e36dc,_0x123243,_0x4bd549,_0xb2cee3);})[_0xd138('0xbb')](function(_0x51dab2){return _0x100176(_0x51dab2);})[_0xd138('0xb5')](function(_0x517e57){return _0x17d0c6(msgResponse('[CatchErlangB]','Failure',JSON[_0xd138('0x79')](_0x517e57)));});}if(_0x2115e9['dialPredictiveOptimization']===_0xd138('0x1dc')){return _0x32d98c['getVoiceQueueRtPauses'](_0x2115e9['id'])['then'](function(_0x1da0c4){var _0x1adb54=_0x2115e9[_0xd138('0x50')]-_0x1da0c4[0x0][_0xd138('0x1e3')];var _0x2bcee7=_0x2115e9[_0xd138('0x1cf')]*0x3c;var _0x4fbaf7=_0x322a3c[0x0]['predictiveIntervalAvgTalktime']+_0x322a3c[0x0][_0xd138('0x6c')];var _0x2e9a46=(_0x322a3c[0x0]['predictiveIntervalAnsweredCalls']+_0x322a3c[0x0][_0xd138('0x6e')]+_0x322a3c[0x0][_0xd138('0x82')])/_0x322a3c[0x0][_0xd138('0x74')];var _0x1d5f7e=_0x2115e9[_0xd138('0x1c6')]/0x64;_0x2115e9[_0xd138('0x73')]=_0x1da0c4[0x0]['outboundQueuePauses']||0x0;_0x2115e9[_0xd138('0x71')]=_0x2e9a46>0x0?_0x2e9a46:0x1;return _0x32d98c['busyFactor'](_0x1adb54,_0x2bcee7,_0x4fbaf7,_0x2e9a46,_0x1d5f7e);})[_0xd138('0xbb')](function(_0x205fe8){return _0x100176(_0x205fe8);})[_0xd138('0xb5')](function(_0x1f2e59){return _0x17d0c6(msgResponse(_0xd138('0x1e4'),_0xd138('0x148'),JSON[_0xd138('0x79')](_0x1f2e59)));});}}else{return _0x17d0c6(msgResponse(_0xd138('0x1de'),_0xd138('0x148'),_0xd138('0x1e0')));}});};};Dialer[_0xd138('0x1e')]['startMethodPredictive']=function(_0x59359d){var _0x5d79ac=this;return function(){var _0x57dbef=0x0;var _0x5f495b=Math[_0xd138('0x1cb')](_0x59359d['erlangCallToSecond']*0x3e8);if(_0x5f495b>0x0){_0x5f495b=_0x5f495b<0x64?0x64:_0x5f495b;loggerPredictive[_0xd138('0x7e')](_0x59359d[_0xd138('0x40')],_0xd138('0x1e5'),_0x5f495b,_0xd138('0x4a'));_0x59359d[_0xd138('0x90')]=setInterval(function(){_0x5d79ac[_0xd138('0x90')](_0x59359d);loggerPredictiveCalls[_0xd138('0x7e')](_0xd138('0x1e6'),_0x57dbef+=0x1);},_0x5f495b);}else{loggerPredictive['info'](_0x59359d[_0xd138('0x40')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0xd138('0x1e')][_0xd138('0x1e7')]=function(_0x16f036,_0x53296a){var _0x431efb=this;return function(_0x333425){if(_[_0xd138('0x48')](_0x333425)){if(_['isNil'](_0x53296a[_0xd138('0xdb')])||!_0x53296a[_0xd138('0x1e8')]){if(_0x16f036[_0xd138('0x5b')]===_0xd138('0xa')){_0x16f036[_0xd138('0x130')]=_[_0xd138('0x86')](_0x16f036[_0xd138('0x130')])?!![]:_0x16f036[_0xd138('0x130')];var _0x1ac579=uuid['v4']();_0x431efb[_0xd138('0x29')][_0x1ac579]=new Action(_0x16f036,_0x53296a,_0x1ac579);loggerBooked[_0xd138('0x7e')]('[booked][checkContactBlack]',_0x1ac579,_0xd138('0x1e9'),JSON[_0xd138('0x79')](_0x16f036[_0xd138('0x130')]),_0xd138('0x1ea'),_0x16f036[_0xd138('0x40')]);if(_0x16f036[_0xd138('0x130')]){_0x16f036[_0xd138('0x130')]=![];_0x431efb[_0xd138('0x12e')][_0x431efb['actions'][_0x1ac579]['queue']]=[];ami['Action']({'actionid':_0x1ac579,'action':'queuestatus','queue':_0x16f036[_0xd138('0x40')]})[_0xd138('0xb5')](function(){_0x431efb['updateOriginated'](_0x16f036);_0x431efb[_0xd138('0xc5')]({'active':![],'ContactId':_0x431efb[_0xd138('0x29')][_0x1ac579][_0xd138('0xd9')],'ListId':_0x431efb[_0xd138('0x29')][_0x1ac579]['ListId'],'VoiceQueueId':_0x431efb[_0xd138('0x29')][_0x1ac579][_0xd138('0xdc')]||undefined,'CampaignId':_0x431efb[_0xd138('0x29')][_0x1ac579][_0xd138('0xdd')]||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x431efb[_0xd138('0x29')][_0x1ac579];});}else{loggerBooked[_0xd138('0x7e')]('[booked][checkContactBlack][else]',JSON[_0xd138('0x79')](_0x16f036[_0xd138('0x130')]),_0xd138('0x1ea'),_0x16f036[_0xd138('0x40')]);_0x431efb[_0xd138('0xb6')](_0x16f036);_0x431efb['rescheduleContact']({'active':![],'ContactId':_0x431efb[_0xd138('0x29')][_0x1ac579][_0xd138('0xd9')],'ListId':_0x431efb[_0xd138('0x29')][_0x1ac579][_0xd138('0xda')],'VoiceQueueId':_0x431efb[_0xd138('0x29')][_0x1ac579][_0xd138('0xdc')]||undefined,'CampaignId':_0x431efb[_0xd138('0x29')][_0x1ac579]['CampaignId']||undefined})[_0xd138('0xb5')](loggerCatch(_0xd138('0x1eb')));delete _0x431efb[_0xd138('0x29')][_0x1ac579];}}else{return _0x431efb['actionOriginate'](_0x16f036,_0x53296a);}}else{if(getDiff(_0x53296a[_0xd138('0x1ec')])<_0x16f036[_0xd138('0x1ed')]*0x3c){if(_0x53296a[_0xd138('0x1ee')]&&!_0x53296a['Agent'][_0xd138('0x1ef')]){_0x431efb[_0xd138('0x22')][_0xd138('0x13a')](_0x53296a['id'])[_0xd138('0x21')](function(){_0x431efb[_0xd138('0xb6')](_0x16f036);});}else{_0x431efb[_0xd138('0xc7')]({'active':![]},_0x53296a['id'],0x1)[_0xd138('0x21')](function(){_0x431efb[_0xd138('0xb6')](_0x16f036);});}}else{_0x16f036[_0xd138('0x69')]+=0x1;_0x431efb[_0xd138('0xb6')](_0x16f036);if(_0x16f036[_0xd138('0x1f0')]){_0x431efb[_0xd138('0xc5')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x53296a[_0xd138('0xd9')],'ListId':_0x53296a['ListId'],'VoiceQueueId':_0x53296a['VoiceQueueId']||undefined,'CampaignId':_0x53296a[_0xd138('0xdd')]||undefined})['catch'](loggerCatch(_0xd138('0x1f1')));_0x431efb[_0xd138('0xd1')](createObjHistory(_0x16f036,_0x53296a,_0xd138('0x1f2'),0x17,_0xd138('0x1f3')))[_0xd138('0xb5')](loggerCatch(_0xd138('0x1f4')));}else{_0x431efb[_0xd138('0xd6')](createObjHistory(_0x16f036,_0x53296a,'RECALLFAILEDTIMEOUT',0x16,_0xd138('0x1f5')),_0xd138('0x1f6'),'[Originate][HistoryRecallClose]');}}}}else{_0x16f036[_0xd138('0x60')]+=0x1;_0x431efb[_0xd138('0xd6')](createObjHistory(_0x16f036,_0x53296a,_0xd138('0x1f7'),0xd,_0xd138('0x1f8')),_0xd138('0x1f9'),_0xd138('0x1fa'));throw _0xd138('0x1fb');}};};Dialer[_0xd138('0x1e')][_0xd138('0x15f')]=function(_0x9c385e){var _0x37842e=this;var _0x59ff8f=_0x9c385e[_0xd138('0x1fc')]-_0x9c385e[_0xd138('0x9a')]-_0x9c385e[_0xd138('0xca')];emitCampaignSummary(_0x9c385e);if(_0x59ff8f>0x0){if(_0x59ff8f>this['maxNumberOriginate']){_0x59ff8f=this['maxNumberOriginate'];}_0x9c385e[_0xd138('0xca')]+=_0x59ff8f;this[_0xd138('0xcb')](_0x9c385e['id'],_0x59ff8f,_0x9c385e[_0xd138('0x1fd')],_0x9c385e)['then'](function(_0x55c6f8){_0x9c385e['temp']-=_0x59ff8f;_0x9c385e[_0xd138('0xca')]=_0x9c385e['temp']>0x0?_0x9c385e[_0xd138('0xca')]:0x0;if(!checkContactEmpty(_0x55c6f8)){_0x9c385e[_0xd138('0x3f')]=_0xd138('0x1fe');logger['info'](_0xd138('0x1ff')+_0x9c385e[_0xd138('0x40')]);}else{_0x9c385e[_0xd138('0x9a')]+=_0x55c6f8[_0xd138('0x99')];_0x9c385e[_0xd138('0x3f')]=_0xd138('0x200');for(var _0x185392=0x0;_0x185392<_0x55c6f8[_0xd138('0x99')];_0x185392+=0x1){_0x9c385e['ivrTotalCallsDays']+=0x1;if(_['isNil'](_0x55c6f8[_0x185392])||_[_0xd138('0xb1')](_0x55c6f8[_0x185392][_0xd138('0x16d')])||_[_0xd138('0xb1')](_0x55c6f8[_0x185392][_0xd138('0x16d')][_0xd138('0x16c')])){_0x37842e[_0xd138('0xd4')](_0xd138('0x201'),_0x9c385e,_0x55c6f8[_0x185392]);}else{_0x37842e['checkIsBlackListIvr'](_[_0xd138('0xd8')](_0x55c6f8[_0x185392],['CampaignId','Contact.phone']))[_0xd138('0xbb')](_0x37842e['checkContactBlack'](_0x9c385e,_0x55c6f8[_0x185392]))[_0xd138('0xb5')](_0x37842e[_0xd138('0xd3')](_0xd138('0x202'),_0x9c385e));}}}})[_0xd138('0xb5')](loggerGetContactDialer('[getContactCampaign2]',_0x9c385e,_0x59ff8f));}};Dialer['prototype'][_0xd138('0x15a')]=function(_0x2c1ae1,_0x3a153a){var _0x3312eb=this;var _0x5de9b9=[];var _0x5c504d=_0x3a153a>=0x1?_0x3a153a:0x1;if(_0x2c1ae1[_0xd138('0x5b')]===_0xd138('0xa')){_0x5c504d=0x1;}var _0x199187=Math[_0xd138('0x1cb')](_0x2c1ae1[_0xd138('0xa5')]*_0x5c504d)-_0x2c1ae1[_0xd138('0x9a')]-_0x2c1ae1[_0xd138('0xca')];emitVoiceQueueSummary(_0x2c1ae1);if(_0x2c1ae1[_0xd138('0x203')]>0x0){var _0x6b6456=_0x2c1ae1[_0xd138('0x203')]-_0x2c1ae1[_0xd138('0x9a')]-_0x2c1ae1[_0xd138('0x54')]-_0x2c1ae1['temp']-_0x2c1ae1[_0xd138('0xa4')];if(_0x199187>_0x6b6456){_0x199187=_0x6b6456;}}if(_0x199187>0x0){if(_0x2c1ae1['dialMethod']==='booked'){_0x199187=0x1;}if(_0x199187>this['maxNumberOriginate']){_0x199187=this[_0xd138('0x27')];}_0x2c1ae1['temp']+=_0x199187;for(var _0x24768c in this[_0xd138('0x25')]){if(typeof this[_0xd138('0x25')][_0x24768c]!==_0xd138('0x9b')){if(this[_0xd138('0x25')][_0x24768c][_0xd138('0xab')]==='not_inuse'&&this[_0xd138('0x25')][_0x24768c][_0xd138('0xb3')]===_0xd138('0xe1')){_0x5de9b9[_0xd138('0x14c')](this[_0xd138('0x25')][_0x24768c]['id']);}}}this['getContactDialer'](_0x2c1ae1['id'],_0x5de9b9,_0x199187,_0x2c1ae1[_0xd138('0x1fd')],_0x2c1ae1)[_0xd138('0xbb')](function(_0x3d6963){_0x2c1ae1[_0xd138('0xca')]-=_0x199187;_0x2c1ae1[_0xd138('0xca')]=_0x2c1ae1['temp']>0x0?_0x2c1ae1[_0xd138('0xca')]:0x0;if(!checkContactEmpty(_0x3d6963)){_0x3312eb[_0xd138('0xbc')](_0x2c1ae1)['then'](sendMessageReschedule(_0x2c1ae1))[_0xd138('0xb5')](loggerCatch(_0xd138('0xbd')));}else{_0x2c1ae1[_0xd138('0x9a')]+=_0x3d6963[_0xd138('0x99')];_0x2c1ae1['message']=_0x2c1ae1[_0xd138('0x5b')]===_0xd138('0xa')?_0xd138('0x175'):'RUNNING';for(var _0x14157f=0x0;_0x14157f<_0x3d6963[_0xd138('0x99')];_0x14157f+=0x1){if(_[_0xd138('0xb1')](_0x3d6963[_0x14157f])||_[_0xd138('0xb1')](_0x3d6963[_0x14157f][_0xd138('0x16d')])||_[_0xd138('0xb1')](_0x3d6963[_0x14157f]['Contact']['phone'])){_0x3312eb['emptyContact'](_0xd138('0x201'),_0x2c1ae1,_0x3d6963[_0x14157f]);}else{_0x3312eb['checkIsBlackList'](_[_0xd138('0xd8')](_0x3d6963[_0x14157f],[_0xd138('0xdc'),_0xd138('0x204')]))[_0xd138('0xbb')](_0x3312eb[_0xd138('0x1e7')](_0x2c1ae1,_0x3d6963[_0x14157f]))['catch'](_0x3312eb['loggerHandler'](_0xd138('0x201'),_0x2c1ae1));}}}})[_0xd138('0xb5')](loggerGetContactDialer(_0xd138('0x205'),_0x2c1ae1,_0x199187));}};Dialer[_0xd138('0x1e')]['handlePredictive']=function(_0x17a655){if(_0x17a655[_0xd138('0x203')]>0x0){var _0x24b408=_0x17a655[_0xd138('0x203')]-_0x17a655[_0xd138('0x9a')]-_0x17a655[_0xd138('0x54')];if(_0x24b408>0x0){this['tryOriginatePredictive'](_0x17a655);}else{loggerPredictiveCalls['info'](_0xd138('0x206'));}}else{this['tryOriginatePredictive'](_0x17a655);}};Dialer[_0xd138('0x1e')][_0xd138('0x207')]=function(_0x31054b){var _0x3c55fb=this;var _0x1d6dc5=[];_0x31054b['originated']+=0x1;for(var _0x1d6daf in this['agents']){if(typeof this[_0xd138('0x25')][_0x1d6daf]!==_0xd138('0x9b')){if(this[_0xd138('0x25')][_0x1d6daf]['state']===_0xd138('0x208')&&this['agents'][_0x1d6daf][_0xd138('0xb3')]===_0xd138('0xe1')){_0x1d6dc5[_0xd138('0x14c')](this[_0xd138('0x25')][_0x1d6daf]['id']);}}}this[_0xd138('0xc9')](_0x31054b['id'],_0x1d6dc5,0x1,_0x31054b['dialOrderByScheduledAt'],_0x31054b)[_0xd138('0xbb')](function(_0x2f91f9){if(!checkContactEmpty(_0x2f91f9)){checkContactLowerLimitOriginate(_0x31054b,0x1,0x0);_0x3c55fb[_0xd138('0xbc')](_0x31054b)[_0xd138('0xbb')](sendMessageReschedule(_0x31054b))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x31054b[_0xd138('0x3f')]=_0xd138('0x200');if(_[_0xd138('0xb1')](_0x2f91f9[0x0])||_[_0xd138('0xb1')](_0x2f91f9[0x0]['Contact'])||_[_0xd138('0xb1')](_0x2f91f9[0x0][_0xd138('0x16d')]['phone'])){_0x3c55fb['emptyContact'](_0xd138('0x201'),_0x31054b,_0x2f91f9[0x0]);}else{_0x3c55fb['checkIsBlackList'](_[_0xd138('0xd8')](_0x2f91f9[0x0],[_0xd138('0xdc'),_0xd138('0x204')]))[_0xd138('0xbb')](_0x3c55fb[_0xd138('0x1e7')](_0x31054b,_0x2f91f9[0x0]))[_0xd138('0xb5')](_0x3c55fb[_0xd138('0xd3')](_0xd138('0x209'),_0x31054b));}}})['catch'](loggerGetContactDialer(_0xd138('0x20a'),_0x31054b,0x1));emitVoiceQueueSummary(_0x31054b);};Dialer[_0xd138('0x1e')]['abandonmentRate']=function(_0x3717c9,_0x1bc040,_0x227a7f,_0x490f4e,_0x56ccd3,_0x21c634){loggerPredictive['info'](_0xd138('0x20b'));loggerPredictive['info'](_0xd138('0x20c'),_0x3717c9);loggerPredictive[_0xd138('0x7e')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1bc040);loggerPredictive[_0xd138('0x7e')](_0xd138('0x20d'),_0x227a7f);loggerPredictive[_0xd138('0x7e')](_0xd138('0x20e'),_0x490f4e);loggerPredictive['info'](_0xd138('0x20f'),_0x56ccd3);loggerPredictive[_0xd138('0x7e')]('---------------------------');return new BPromise(function(_0x562eda,_0x402ae0){if(_0x3717c9<=0x0||isNaN(_0x3717c9)){return _0x402ae0(msgResponse(_0xd138('0x210'),_0xd138('0x196'),'m\x20=\x20'+_0x3717c9));}if(_0x227a7f<=0x0||isNaN(_0x227a7f)){return _0x402ae0(msgResponse(_0xd138('0x210'),_0xd138('0x196'),_0xd138('0x211')+_0x227a7f));}if(_0x490f4e<=0x0||isNaN(_0x490f4e)){return _0x402ae0(msgResponse('[abandonmentRate]','Error',_0xd138('0x212')+_0x490f4e));}if(_0x1bc040<=0x0||isNaN(_0x1bc040)){return _0x402ae0(msgResponse(_0xd138('0x210'),_0xd138('0x196'),'interval\x20=\x20'+_0x1bc040));}if(_0x56ccd3<=0x0||isNaN(_0x56ccd3)){return _0x402ae0(msgResponse(_0xd138('0x210'),_0xd138('0x196'),'Amax\x20=\x20'+_0x56ccd3));}_0x21c634=_0x21c634||0x0;var _0x2cb426=0x1/_0x227a7f;var _0x5c8a0b=0x0;var _0x7e10f0=0x0;var _0x58c26d=0x0;var _0x4a8446=0x0;for(var _0x59ef26=0x0;_0x58c26d<_0x56ccd3;_0x59ef26+=0x1){_0x7e10f0=_0x59ef26/_0x1bc040;_0x5c8a0b=(_0x490f4e*_0x7e10f0+_0x21c634)/_0x2cb426;_0x58c26d=erlangb(_0x5c8a0b,_0x3717c9);_0x4a8446=_0x5c8a0b/_0x3717c9*(0x1-erlangb(_0x5c8a0b,_0x3717c9));}return _0x562eda({'erlangCalls':_0x59ef26,'erlangCallToSecond':_0x1bc040/_0x59ef26,'erlangAbandonmentRate':_0x58c26d,'erlangBusyFactor':_0x4a8446});});};Dialer['prototype'][_0xd138('0x1dd')]=function(_0x35dadb,_0x153b4a,_0x54f356,_0x924d4,_0x469422,_0x39a91e){loggerPredictive['info']('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0xd138('0x7e')](_0xd138('0x20c'),_0x35dadb);loggerPredictive[_0xd138('0x7e')](_0xd138('0x213'),_0x153b4a);loggerPredictive[_0xd138('0x7e')]('Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x54f356);loggerPredictive['info']('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x924d4);loggerPredictive[_0xd138('0x7e')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x469422);loggerPredictive[_0xd138('0x7e')](_0xd138('0x85'));return new BPromise(function(_0x1ce998,_0x203041){if(_0x35dadb<=0x0||isNaN(_0x35dadb)){return _0x203041(msgResponse(_0xd138('0x214'),'Error',_0xd138('0x215')+_0x35dadb));}if(_0x54f356<=0x0||isNaN(_0x54f356)){return _0x203041(msgResponse('[busyFactor]',_0xd138('0x196'),_0xd138('0x211')+_0x54f356));}if(_0x924d4<=0x0||isNaN(_0x924d4)){return _0x203041(msgResponse(_0xd138('0x214'),_0xd138('0x196'),_0xd138('0x212')+_0x924d4));}if(_0x153b4a<=0x0||isNaN(_0x153b4a)){return _0x203041(msgResponse(_0xd138('0x214'),'Error',_0xd138('0x216')+_0x153b4a));}if(_0x469422<=0x0||isNaN(_0x469422)){return _0x203041(msgResponse(_0xd138('0x214'),_0xd138('0x196'),_0xd138('0x217')+_0x469422));}_0x39a91e=_0x39a91e||0x0;var _0x103d2b=0x1/_0x54f356;var _0x5e4a30=0x0;var _0xcd4129=0x0;var _0x3fa96e=0x0;var _0x292d67=0x0;for(var _0x57217a=0x0;_0x292d67<_0x469422;_0x57217a+=0x1){_0xcd4129=_0x57217a/_0x153b4a;_0x5e4a30=(_0x924d4*_0xcd4129+_0x39a91e)/_0x103d2b;_0x3fa96e=erlangb(_0x5e4a30,_0x35dadb);_0x292d67=_0x5e4a30/_0x35dadb*(0x1-erlangb(_0x5e4a30,_0x35dadb));}return _0x1ce998({'erlangCalls':_0x57217a,'erlangCallToSecond':_0x153b4a/_0x57217a,'erlangAbandonmentRate':_0x3fa96e,'erlangBusyFactor':_0x292d67});});};module['exports']=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index beff416..c3566e7 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 _0x2e87=['starttime','responsetime','droptime','endtime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','moment','milliseconds','diff','seconds','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum'];(function(_0x2c5faf,_0x3d1268){var _0x42c8e1=function(_0x3e4912){while(--_0x3e4912){_0x2c5faf['push'](_0x2c5faf['shift']());}};_0x42c8e1(++_0x3d1268);}(_0x2e87,0x11e));var _0x72e8=function(_0x4cd690,_0x4797cc){_0x4cd690=_0x4cd690-0x0;var _0x4a74a9=_0x2e87[_0x4cd690];return _0x4a74a9;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x72e8('0x0'));function getSeconds(_0x58a24c,_0x4cd1c3){var _0x167bbc=moment(_0x58a24c)[_0x72e8('0x1')](0x0);var _0x512879=moment(_0x4cd1c3)[_0x72e8('0x1')](0x0);return _0x167bbc[_0x72e8('0x2')](_0x512879,_0x72e8('0x3'));}function QueueCallerAbandon(_0x449f00,_0x5c43f6){this[_0x72e8('0x4')]=_0x449f00[_0x72e8('0x4')];this[_0x72e8('0x5')]=_0x449f00[_0x72e8('0x5')];this['campaigntype']=_0x449f00[_0x72e8('0x5')]==='outbound'?_0x72e8('0x6'):_0x449f00[_0x72e8('0x5')];this['countbusyretry']=_0x449f00[_0x72e8('0x7')];this[_0x72e8('0x8')]=_0x449f00[_0x72e8('0x8')];this[_0x72e8('0x9')]=_0x449f00['countnoanswerretry'];this['countglobal']=_0x449f00[_0x72e8('0x7')]+_0x449f00[_0x72e8('0x8')]+_0x449f00['countnoanswerretry']+_0x449f00[_0x72e8('0xa')]+_0x449f00[_0x72e8('0xb')]+_0x449f00[_0x72e8('0xc')]+_0x449f00[_0x72e8('0xd')]+_0x449f00[_0x72e8('0xe')];this[_0x72e8('0xa')]=_0x449f00['countnosuchnumberretry'];this[_0x72e8('0xb')]=_0x449f00[_0x72e8('0xb')];this[_0x72e8('0xc')]=_0x449f00[_0x72e8('0xc')];this['countmachineretry']=_0x449f00[_0x72e8('0xd')];this[_0x72e8('0xe')]=_0x449f00['countagentrejectretry'];this[_0x72e8('0xf')]=_0x5c43f6[_0x72e8('0xf')];this['calleridname']=_0x449f00[_0x72e8('0x10')];this[_0x72e8('0x11')]=_0x449f00['number'];this[_0x72e8('0x12')]=_0x449f00[_0x72e8('0x12')];this['responsetime']=_0x449f00[_0x72e8('0x13')];this[_0x72e8('0x14')]=_0x449f00[_0x72e8('0x14')];this[_0x72e8('0x15')]=this[_0x72e8('0x14')];this['ringtime']=getSeconds(_0x449f00[_0x72e8('0x13')],_0x449f00[_0x72e8('0x12')]);this[_0x72e8('0x16')]=getSeconds(this[_0x72e8('0x14')],_0x449f00['responsetime']);this[_0x72e8('0x17')]=0x0;this[_0x72e8('0x6')]=_0x5c43f6[_0x72e8('0x6')];this[_0x72e8('0x18')]=_0x5c43f6[_0x72e8('0x19')];this['reason']=_0x5c43f6[_0x72e8('0x1a')];this[_0x72e8('0x1b')]=_0x449f00['callback'];this['callbackuniqueid']=_0x449f00[_0x72e8('0x1c')];this['callbackat']=_0x449f00[_0x72e8('0x1d')];this[_0x72e8('0x1e')]=_0x449f00[_0x72e8('0x1e')];this[_0x72e8('0x1f')]=_0x449f00[_0x72e8('0x1f')];this[_0x72e8('0x20')]=_0x449f00[_0x72e8('0x20')];this[_0x72e8('0x21')]=_0x449f00[_0x72e8('0x21')];this['VoiceQueueId']=_0x449f00[_0x72e8('0x22')];this[_0x72e8('0x23')]=_0x449f00[_0x72e8('0x23')];this[_0x72e8('0x24')]=_0x449f00['originatecalleridnum']||'';this[_0x72e8('0x25')]=_0x449f00[_0x72e8('0x25')]||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0x428b=['campaigntype','outbound','queue','countbusyretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','endtime','droptime','ringtime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','scheduledat','type'];(function(_0x212de5,_0xfe94a){var _0x3b655f=function(_0x4e3d85){while(--_0x4e3d85){_0x212de5['push'](_0x212de5['shift']());}};_0x3b655f(++_0xfe94a);}(_0x428b,0xd0));var _0xb428=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x428b[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0xb428('0x0'));var _=require(_0xb428('0x1'));var moment=require('moment');function getSeconds(_0x226280,_0x58a13e){var _0x9f5d85=moment(_0x226280)[_0xb428('0x2')](0x0);var _0x48663c=moment(_0x58a13e)['milliseconds'](0x0);return _0x9f5d85[_0xb428('0x3')](_0x48663c,_0xb428('0x4'));}function QueueCallerAbandon(_0x44d045,_0x5cfea7){this[_0xb428('0x5')]=_0x44d045[_0xb428('0x5')];this[_0xb428('0x6')]=_0x44d045[_0xb428('0x6')];this[_0xb428('0x7')]=_0x44d045['type']===_0xb428('0x8')?_0xb428('0x9'):_0x44d045[_0xb428('0x6')];this[_0xb428('0xa')]=_0x44d045[_0xb428('0xa')];this['countcongestionretry']=_0x44d045['countcongestionretry'];this['countnoanswerretry']=_0x44d045[_0xb428('0xb')];this[_0xb428('0xc')]=_0x44d045[_0xb428('0xa')]+_0x44d045['countcongestionretry']+_0x44d045[_0xb428('0xb')]+_0x44d045['countnosuchnumberretry']+_0x44d045['countdropretry']+_0x44d045[_0xb428('0xd')]+_0x44d045[_0xb428('0xe')]+_0x44d045[_0xb428('0xf')];this[_0xb428('0x10')]=_0x44d045[_0xb428('0x10')];this[_0xb428('0x11')]=_0x44d045['countdropretry'];this[_0xb428('0xd')]=_0x44d045[_0xb428('0xd')];this[_0xb428('0xe')]=_0x44d045['countmachineretry'];this[_0xb428('0xf')]=_0x44d045[_0xb428('0xf')];this['uniqueid']=_0x5cfea7[_0xb428('0x12')];this[_0xb428('0x13')]=_0x44d045[_0xb428('0x14')];this[_0xb428('0x15')]=_0x44d045['number'];this[_0xb428('0x16')]=_0x44d045[_0xb428('0x16')];this[_0xb428('0x17')]=_0x44d045[_0xb428('0x17')];this['droptime']=_0x44d045['droptime'];this[_0xb428('0x18')]=this[_0xb428('0x19')];this[_0xb428('0x1a')]=getSeconds(_0x44d045[_0xb428('0x17')],_0x44d045['starttime']);this[_0xb428('0x1b')]=getSeconds(this['droptime'],_0x44d045['responsetime']);this[_0xb428('0x1c')]=0x0;this[_0xb428('0x9')]=_0x5cfea7[_0xb428('0x9')];this[_0xb428('0x1d')]=_0x5cfea7[_0xb428('0x1e')];this[_0xb428('0x1f')]=_0x5cfea7[_0xb428('0x1f')];this[_0xb428('0x20')]=_0x44d045[_0xb428('0x20')];this['callbackuniqueid']=_0x44d045[_0xb428('0x21')];this['callbackat']=_0x44d045['callbackat'];this[_0xb428('0x22')]=_0x44d045['recallme'];this[_0xb428('0x23')]=_0x44d045[_0xb428('0x23')];this[_0xb428('0x24')]=_0x44d045[_0xb428('0x24')];this[_0xb428('0x25')]=_0x44d045[_0xb428('0x25')];this[_0xb428('0x26')]=_0x44d045[_0xb428('0x26')];this[_0xb428('0x27')]=_0x44d045[_0xb428('0x27')];this[_0xb428('0x28')]=_0x44d045[_0xb428('0x28')]||'';this[_0xb428('0x29')]=_0x44d045[_0xb428('0x29')]||'';}module[_0xb428('0x2a')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 5ec3658..0c925ed 100644 --- a/server/services/ami/fax/action.js +++ b/server/services/ami/fax/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['fax','localstationid','path','AttachmentId','exports','util','lodash','moment','channel','format','%s/%s/%s','tech','Trunk'];(function(_0x331167,_0x1f00d6){var _0x5247a1=function(_0x44e992){while(--_0x44e992){_0x331167['push'](_0x331167['shift']());}};_0x5247a1(++_0x1f00d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action; \ No newline at end of file +var _0xa9e0=['fax','localstationid','path','AttachmentId','exports','util','lodash','moment','channel','format','%s/%s/%s','tech','Trunk'];(function(_0x3c6a74,_0x21b1ff){var _0x1bcc75=function(_0x4a06c8){while(--_0x4a06c8){_0x3c6a74['push'](_0x3c6a74['shift']());}};_0x1bcc75(++_0x21b1ff);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 01356d6..65df98b 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 _0xe154=['syncNewchannel','context','hasOwnProperty','exten','localstationid','uniqueid','channel','name','\x20syncNewchannel\x20','info','syncVarSet','variable','value','prototype','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','fax','catch','error','stringify','\x20receiveFax\x20','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','variablesAction','execOriginate','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Empty\x20path','Is\x20Valid','exports','lodash','moment','path','tiff2pdf','./util/gs','../../../config/logger','../ami','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','channels','faxAccounts','trunks','actions','newchannel','bind','varset','newstate','syncNewState','newexten','syncNewExten','faxstatus','receivefax','syncHangup','originateresponse','syncOriginateResponse'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0xe154,0x143));var _0x4e15=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0xe154[_0x1f9f37];return _0x21c080;};'use strict';var util=require('util');var _=require(_0x4e15('0x0'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0x4e15('0x1'));var path=require(_0x4e15('0x2'));var tiff2pdf=require(_0x4e15('0x3'));var gs=require(_0x4e15('0x4'));var logger=require(_0x4e15('0x5'))('fax');var ami=require(_0x4e15('0x6'));var rpcDb=require('./rpcDb');var Channel=require(_0x4e15('0x7'));var ut=require(_0x4e15('0x8'));var Action=require(_0x4e15('0x9'));var faxAccount=require(_0x4e15('0xa'));var attachment=require(_0x4e15('0xb'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x5b4d30){this[_0x4e15('0xc')]={};this[_0x4e15('0xd')]=_0x5b4d30[_0x4e15('0xd')];this[_0x4e15('0xe')]=_0x5b4d30[_0x4e15('0xe')];this[_0x4e15('0xf')]={};ami['on'](_0x4e15('0x10'),this['syncNewchannel'][_0x4e15('0x11')](this));ami['on'](_0x4e15('0x12'),this['syncVarSet'][_0x4e15('0x11')](this));ami['on'](_0x4e15('0x13'),this[_0x4e15('0x14')]['bind'](this));ami['on'](_0x4e15('0x15'),this[_0x4e15('0x16')]['bind'](this));ami['on'](_0x4e15('0x17'),this['syncFaxStatus'][_0x4e15('0x11')](this));ami['on'](_0x4e15('0x18'),this['syncReceiveFax'][_0x4e15('0x11')](this));ami['on']('hangup',this[_0x4e15('0x19')][_0x4e15('0x11')](this));ami['on'](_0x4e15('0x1a'),this[_0x4e15('0x1b')][_0x4e15('0x11')](this));}Fax['prototype'][_0x4e15('0x1c')]=function(_0x3d163e){if(_0x3d163e[_0x4e15('0x1d')]==='from-voip-provider'){for(var _0x31dfaf in this[_0x4e15('0xd')]){if(this[_0x4e15('0xd')][_0x4e15('0x1e')](_0x31dfaf)){if(_0x3d163e[_0x4e15('0x1f')]===this[_0x4e15('0xd')][_0x31dfaf][_0x4e15('0x20')]){this[_0x4e15('0xc')][_0x3d163e['uniqueid']]={};this[_0x4e15('0xc')][_0x3d163e[_0x4e15('0x21')]][_0x4e15('0x22')]=_0x3d163e[_0x4e15('0x22')];this['channels'][_0x3d163e[_0x4e15('0x21')]]['id']=this[_0x4e15('0xd')][_0x31dfaf]['id'];this[_0x4e15('0xc')][_0x3d163e['uniqueid']][_0x4e15('0x23')]=this[_0x4e15('0xd')][_0x31dfaf][_0x4e15('0x23')];logger['info'](_0x3d163e[_0x4e15('0x21')],_0x4e15('0x24'));}}}}if(this[_0x4e15('0xf')][_0x3d163e[_0x4e15('0x21')]]){this[_0x4e15('0xc')][_0x3d163e[_0x4e15('0x21')]]={};this['channels'][_0x3d163e[_0x4e15('0x21')]]['channel']=_0x3d163e[_0x4e15('0x22')];logger[_0x4e15('0x25')](_0x3d163e[_0x4e15('0x21')],_0x4e15('0x24'));}};Fax['prototype'][_0x4e15('0x26')]=function(_0x117fe8){if(this[_0x4e15('0xc')][_0x117fe8[_0x4e15('0x21')]]){for(var _0x4b8b39 in _0x117fe8['variable']){if(_0x117fe8[_0x4e15('0x27')]['hasOwnProperty'](_0x4b8b39)){this['channels'][_0x117fe8[_0x4e15('0x21')]][_0x4b8b39]=_0x117fe8[_0x4e15('0x28')];}}}};Fax[_0x4e15('0x29')][_0x4e15('0x14')]=function(_0x462b04){if(this[_0x4e15('0xc')][_0x462b04[_0x4e15('0x21')]]){this['channels'][_0x462b04[_0x4e15('0x21')]][_0x4e15('0x2a')]=_0x462b04[_0x4e15('0x2a')];this[_0x4e15('0xc')][_0x462b04[_0x4e15('0x21')]][_0x4e15('0x2b')]=_0x462b04[_0x4e15('0x2b')];}};Fax[_0x4e15('0x29')][_0x4e15('0x16')]=function(_0x5f351c){if(this[_0x4e15('0xc')][_0x5f351c[_0x4e15('0x21')]]){for(var _0xb0c6e9 in _0x5f351c[_0x4e15('0x27')]){if(_0x5f351c['variable'][_0x4e15('0x1e')](_0xb0c6e9)){this[_0x4e15('0xc')][_0x5f351c[_0x4e15('0x21')]][_0xb0c6e9]=_0x5f351c['value'];}}}};Fax[_0x4e15('0x29')]['syncFaxStatus']=function(_0x101efb){if(this[_0x4e15('0xc')][_0x101efb[_0x4e15('0x21')]]){this[_0x4e15('0xc')][_0x101efb[_0x4e15('0x21')]][_0x4e15('0x2c')]=_0x101efb['operation'];this['channels'][_0x101efb['uniqueid']][_0x4e15('0x2d')]=_0x101efb[_0x4e15('0x2d')];this[_0x4e15('0xc')][_0x101efb['uniqueid']][_0x4e15('0x20')]=_0x101efb['localstationid'];this['channels'][_0x101efb['uniqueid']][_0x4e15('0x2e')]=_0x101efb[_0x4e15('0x2e')];logger[_0x4e15('0x25')](_0x101efb[_0x4e15('0x21')],_0x4e15('0x2f'));}};Fax[_0x4e15('0x29')][_0x4e15('0x30')]=function(_0x5e90cf){var _0x51e4d4=this;if(this[_0x4e15('0xc')][_0x5e90cf['uniqueid']]){var _0xf608dc=this[_0x4e15('0xc')][_0x5e90cf[_0x4e15('0x21')]]['id'];this[_0x4e15('0xc')][_0x5e90cf['uniqueid']][_0x4e15('0x31')]=_0x5e90cf['remotestationid'];this[_0x4e15('0xc')][_0x5e90cf[_0x4e15('0x21')]][_0x4e15('0x32')]=_0x5e90cf[_0x4e15('0x32')];this[_0x4e15('0xc')][_0x5e90cf[_0x4e15('0x21')]][_0x4e15('0x20')]=_0x5e90cf[_0x4e15('0x20')];this[_0x4e15('0xc')][_0x5e90cf[_0x4e15('0x21')]][_0x4e15('0x33')]=_0x5e90cf['resolution'];this['channels'][_0x5e90cf[_0x4e15('0x21')]][_0x4e15('0x34')]=_0x5e90cf[_0x4e15('0x34')];this[_0x4e15('0xc')][_0x5e90cf[_0x4e15('0x21')]][_0x4e15('0x2e')]=_0x5e90cf[_0x4e15('0x2e')];this['channels'][_0x5e90cf[_0x4e15('0x21')]][_0x4e15('0x35')]=_0x5e90cf['calleridnum'];if(this[_0x4e15('0xc')][_0x5e90cf[_0x4e15('0x21')]][_0x4e15('0x32')]>0x0){tiff2pdf(_0x5e90cf[_0x4e15('0x2e')],_0x4e15('0x36'),function(_0xd8c4a8){logger['info'](_0x5e90cf['uniqueid'],_0x4e15('0x37'),_0xd8c4a8[_0x4e15('0x38')]);attachment[_0x4e15('0x39')]({'name':path[_0x4e15('0x3a')](_0x5e90cf[_0x4e15('0x2e')])[_0x4e15('0x23')],'basename':path[_0x4e15('0x3a')](_0x5e90cf['filename'])[_0x4e15('0x23')]+_0x4e15('0x3b'),'type':_0x4e15('0x3c')})[_0x4e15('0x3d')](function(_0x1e43aa){faxAccount['notify'](_0xf608dc,{'from':_0x5e90cf[_0x4e15('0x35')],'mapKey':_0x4e15('0x3e'),'body':path[_0x4e15('0x3a')](_0x5e90cf[_0x4e15('0x2e')])[_0x4e15('0x23')]+_0x4e15('0x3b'),'AttachmentId':_0x1e43aa['id']})[_0x4e15('0x3f')](function(_0x1a1faf){logger[_0x4e15('0x40')](_0x5e90cf[_0x4e15('0x21')],'\x20notify\x20',JSON[_0x4e15('0x41')](_0x1a1faf));});})[_0x4e15('0x3f')](function(_0xcbfb6){logger[_0x4e15('0x40')](_0x5e90cf[_0x4e15('0x21')],_0x4e15('0x42'),JSON[_0x4e15('0x41')](_0xcbfb6));});});}logger[_0x4e15('0x25')](_0x5e90cf[_0x4e15('0x21')],'\x20receiveFax\x20');}};Fax[_0x4e15('0x29')][_0x4e15('0x1b')]=function(_0x58a05c){if(this[_0x4e15('0xf')][_0x58a05c[_0x4e15('0x21')]]){_['merge'](this['channels'][_0x58a05c['uniqueid']],_[_0x4e15('0x43')](_0x58a05c,[_0x4e15('0x44'),_0x4e15('0x45')]));}};function updateStatus(_0x291012){if(_0x291012[_0x4e15('0x46')]){faxMessage[_0x4e15('0x47')](_0x291012['AttachmentId'],{'failMessage':_0x4e15('0x48')})[_0x4e15('0x3d')](function(_0x47bdb0){ut[_0x4e15('0x49')](_0x4e15('0x4a'),_0x47bdb0);})[_0x4e15('0x3f')](function(_0x17d3af){ut[_0x4e15('0x49')]('[Fax][Message][Error][NoUpdate1]',_0x17d3af);});}else{ut['logger']('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x4e15('0x29')][_0x4e15('0x4b')]=function(_0x9725bc,_0x34925e,_0x47ed92){var _0x44ec68=this;var _0x3cd3aa={};if(_0x34925e){_0x3cd3aa={'read':_0x34925e};}else{_0x3cd3aa={'failMessage':_0x47ed92};}if(this[_0x4e15('0xf')][_0x9725bc][_0x4e15('0x46')]){faxMessage[_0x4e15('0x47')](this[_0x4e15('0xf')][_0x9725bc][_0x4e15('0x46')],_0x3cd3aa)[_0x4e15('0x3d')](function(_0x28857f){ut[_0x4e15('0x49')](_0x4e15('0x4c'),_0x28857f);})[_0x4e15('0x3f')](function(_0x4ba2e5){ut[_0x4e15('0x49')](_0x4e15('0x4d'),_0x4ba2e5);})[_0x4e15('0x4e')](function(){delete _0x44ec68[_0x4e15('0xc')][_0x9725bc];delete _0x44ec68['actions'][_0x9725bc];});}else{ut[_0x4e15('0x49')](_0x4e15('0x4f'));delete this[_0x4e15('0xc')][_0x9725bc];delete this['actions'][_0x9725bc];}};Fax[_0x4e15('0x29')]['syncHangup']=function(_0x41a6e8){var _0x43d01a=this;if(this[_0x4e15('0xc')][_0x41a6e8[_0x4e15('0x21')]]){if(this[_0x4e15('0xf')][_0x41a6e8['uniqueid']]){this[_0x4e15('0xc')][_0x41a6e8[_0x4e15('0x21')]]['id']=this[_0x4e15('0xf')][_0x41a6e8['uniqueid']]['id'];this[_0x4e15('0xc')][_0x41a6e8['uniqueid']][_0x4e15('0x23')]=this['actions'][_0x41a6e8[_0x4e15('0x21')]]['name'];}logger[_0x4e15('0x25')](_0x41a6e8[_0x4e15('0x21')],this[_0x4e15('0xf')][_0x41a6e8[_0x4e15('0x21')]]?'\x20hangup\x20sendFile\x20':_0x4e15('0x50'),JSON[_0x4e15('0x41')](this[_0x4e15('0xc')][_0x41a6e8['uniqueid']]));if(this[_0x4e15('0xf')][_0x41a6e8['uniqueid']]){if(this[_0x4e15('0xc')][_0x41a6e8[_0x4e15('0x21')]][_0x4e15('0x51')]>0x0&&this[_0x4e15('0xc')][_0x41a6e8[_0x4e15('0x21')]][_0x4e15('0x17')]===_0x4e15('0x52')){this[_0x4e15('0x4b')](_0x41a6e8[_0x4e15('0x21')],!![]);}else{this[_0x4e15('0x4b')](_0x41a6e8['uniqueid'],![],this['channels'][_0x41a6e8[_0x4e15('0x21')]][_0x4e15('0x53')]?_0x4e15('0x54')+this[_0x4e15('0xc')][_0x41a6e8[_0x4e15('0x21')]][_0x4e15('0x53')]:_0x4e15('0x55'));}}}};Fax[_0x4e15('0x29')]['send']=function(_0x1e7207){var _0x3e56be=this;return new BPromise(function(_0x1bf58d,_0x3317a7){_0x3e56be['execOriginate'](_0x1e7207,_0x3e56be['faxAccounts'][_0x1e7207[_0x4e15('0x56')]])[_0x4e15('0x3d')](function(_0x14d827){ut[_0x4e15('0x49')](_0x4e15('0x57'),_0x14d827);_0x1bf58d(ut['message'](_0x4e15('0x58')));})['catch'](function(_0x27027b){ut[_0x4e15('0x49')](_0x4e15('0x59'),_0x27027b);updateStatus(_0x1e7207);_0x3317a7(ut[_0x4e15('0x38')](_0x4e15('0x5a')));});});};Fax['prototype'][_0x4e15('0x5b')]=function(_0x2515c7){var _0x4d2dcc=this;return new BPromise(function(_0x296a88,_0x35bff4){var _0x37caf1=_0x4d2dcc[_0x4e15('0x5c')](_0x4d2dcc[_0x4e15('0xd')][_0x2515c7['FaxAccountId']][_0x4e15('0x5d')],_0x2515c7);if(_0x37caf1[_0x4e15('0x5e')]){_0x296a88(ut[_0x4e15('0x38')](_0x4e15('0x5f')));}else{_0x35bff4(ut[_0x4e15('0x38')](_0x37caf1['message']));}});};function originate(_0x67da97,_0x1893db,_0x2c86e0){return new BPromise(function(_0x4ebbca,_0x24cc0a){if(_0x2c86e0){var _0xc04057=util[_0x4e15('0x60')](_0x4e15('0x61'),path[_0x4e15('0x3a')](_0x67da97[_0x4e15('0x2')])[_0x4e15('0x23')],_0x67da97[_0x4e15('0x2')]);gs[_0x4e15('0x62')](_0xc04057)[_0x4e15('0x3d')](function(){_0x67da97[_0x4e15('0x2')]=util['format'](_0x4e15('0x63'),path[_0x4e15('0x3a')](_0x67da97[_0x4e15('0x2')])['dir'],path[_0x4e15('0x3a')](_0x67da97[_0x4e15('0x2')])[_0x4e15('0x23')]);_0x1893db['XMF-PATH']=_0x67da97[_0x4e15('0x2')];ut[_0x4e15('0x49')]('Convert\x20pdf\x20to\x20tif','');ami['Action'](ut[_0x4e15('0x64')](_0x67da97,_0x1893db))['then'](function(_0x44771b){_0x4ebbca(_0x44771b);})['catch'](function(_0x15e78c){_0x24cc0a(_0x15e78c);});})['catch'](function(_0x54372a){_0x24cc0a(_0x54372a);});}else{ami['Action'](ut[_0x4e15('0x64')](_0x67da97,_0x1893db))[_0x4e15('0x3d')](function(_0x10b6c9){_0x4ebbca(_0x10b6c9);})['catch'](function(_0x4dff1a){_0x24cc0a(_0x4dff1a);});}});}Fax[_0x4e15('0x29')][_0x4e15('0x65')]=function(_0x1b5414,_0x5918ef){var _0x1f90ca=this;return new BPromise(function(_0x17622d,_0x3c300e){var _0x3c6acf=uuid['v4']();var _0x5ad9b7=ut[_0x4e15('0x66')](_0x1b5414,_0x5918ef);_0x1f90ca['actions'][_0x3c6acf]=new Action(_0x3c6acf,_0x5918ef,_0x1b5414);var _0x2b7187=_0x1f90ca[_0x4e15('0xf')][_0x3c6acf];if(path['parse'](_0x1b5414['path'])[_0x4e15('0x67')]===_0x4e15('0x3b')){originate(_0x2b7187,_0x5ad9b7,!![])['then'](function(_0x27ecd5){_0x17622d(_0x27ecd5);})['catch'](function(_0x3e4c74){_0x3c300e(_0x3e4c74);});}else{originate(_0x2b7187,_0x5ad9b7,![])[_0x4e15('0x3d')](function(_0xdb76d6){_0x17622d(_0xdb76d6);})[_0x4e15('0x3f')](function(_0x250780){_0x3c300e(_0x250780);});}});};Fax[_0x4e15('0x29')][_0x4e15('0x68')]=function(_0x535d4f){return!_['isNil'](_0x535d4f)&&!_['isNil'](_0x535d4f[_0x4e15('0x23')])&&!_[_0x4e15('0x69')](_0x535d4f[_0x4e15('0x6a')])&&_0x535d4f[_0x4e15('0x6a')]&&!_[_0x4e15('0x69')](this[_0x4e15('0xe')][util[_0x4e15('0x60')](_0x4e15('0x6b'),_0x535d4f[_0x4e15('0x23')])])&&!_[_0x4e15('0x69')](this[_0x4e15('0xe')][util[_0x4e15('0x60')]('SIP/%s',_0x535d4f['name'])][_0x4e15('0x2d')])&&(this[_0x4e15('0xe')][util[_0x4e15('0x60')]('SIP/%s',_0x535d4f[_0x4e15('0x23')])]['status']===_0x4e15('0x6c')||this[_0x4e15('0xe')][util[_0x4e15('0x60')](_0x4e15('0x6b'),_0x535d4f[_0x4e15('0x23')])][_0x4e15('0x2d')]===_0x4e15('0x6d'));};Fax['prototype'][_0x4e15('0x5c')]=function(_0x4c4c03,_0x19d98e){if(!this[_0x4e15('0x68')](_0x4c4c03)){ut[_0x4e15('0x49')](_0x4e15('0x6e'),_[_0x4e15('0x69')](_0x4c4c03)?'':_0x4c4c03[_0x4e15('0x23')]+_0x4e15('0x6f'));return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_[_0x4e15('0x69')](_0x19d98e[_0x4e15('0x3e')])){ut[_0x4e15('0x49')](_0x4e15('0x70'),JSON[_0x4e15('0x41')](_0x19d98e));return{'isValid':![],'message':_0x4e15('0x71')};}if(_['isNil'](_0x19d98e['path'])){ut[_0x4e15('0x49')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0x4e15('0x41')](_0x19d98e));return{'isValid':![],'message':_0x4e15('0x72')};}return{'isValid':!![],'message':_0x4e15('0x73')};};module[_0x4e15('0x74')]=Fax; \ No newline at end of file +var _0x9659=['[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','update','[Fax][Message][NoUpdate1]','finally','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','isValid','Trunk\x20Reachable','format','execute','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','variablesAction','Action','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','util','bluebird','uuid','moment','path','../../../config/logger','fax','../ami','../rpc/faxAccount','../rpc/attachment','channels','faxAccounts','trunks','syncNewchannel','bind','syncVarSet','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','syncHangup','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','channel','uniqueid','info','\x20syncNewchannel\x20','actions','variable','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','name','.pdf','then','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','reason','AttachmentId','SENDING\x20FAILED\x20','logger'];(function(_0xa64ae4,_0x221235){var _0xee872c=function(_0x2d1296){while(--_0x2d1296){_0xa64ae4['push'](_0xa64ae4['shift']());}};_0xee872c(++_0x221235);}(_0x9659,0x180));var _0x9965=function(_0x5cedf1,_0x9f7f15){_0x5cedf1=_0x5cedf1-0x0;var _0x2ab252=_0x9659[_0x5cedf1];return _0x2ab252;};'use strict';var util=require(_0x9965('0x0'));var _=require('lodash');var BPromise=require(_0x9965('0x1'));var uuid=require(_0x9965('0x2'));var moment=require(_0x9965('0x3'));var path=require(_0x9965('0x4'));var tiff2pdf=require('tiff2pdf');var gs=require('./util/gs');var logger=require(_0x9965('0x5'))(_0x9965('0x6'));var ami=require(_0x9965('0x7'));var rpcDb=require('./rpcDb');var Channel=require('./channel');var ut=require('./util/util');var Action=require('./action');var faxAccount=require(_0x9965('0x8'));var attachment=require(_0x9965('0x9'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x1701fc){this[_0x9965('0xa')]={};this[_0x9965('0xb')]=_0x1701fc[_0x9965('0xb')];this[_0x9965('0xc')]=_0x1701fc[_0x9965('0xc')];this['actions']={};ami['on']('newchannel',this[_0x9965('0xd')][_0x9965('0xe')](this));ami['on']('varset',this[_0x9965('0xf')][_0x9965('0xe')](this));ami['on']('newstate',this[_0x9965('0x10')][_0x9965('0xe')](this));ami['on'](_0x9965('0x11'),this[_0x9965('0x12')]['bind'](this));ami['on'](_0x9965('0x13'),this[_0x9965('0x14')]['bind'](this));ami['on'](_0x9965('0x15'),this[_0x9965('0x16')]['bind'](this));ami['on']('hangup',this[_0x9965('0x17')][_0x9965('0xe')](this));ami['on']('originateresponse',this[_0x9965('0x18')][_0x9965('0xe')](this));}Fax[_0x9965('0x19')][_0x9965('0xd')]=function(_0x482a9d){if(_0x482a9d[_0x9965('0x1a')]===_0x9965('0x1b')){for(var _0x1e62c2 in this[_0x9965('0xb')]){if(this[_0x9965('0xb')][_0x9965('0x1c')](_0x1e62c2)){if(_0x482a9d[_0x9965('0x1d')]===this[_0x9965('0xb')][_0x1e62c2][_0x9965('0x1e')]){this['channels'][_0x482a9d['uniqueid']]={};this[_0x9965('0xa')][_0x482a9d['uniqueid']]['channel']=_0x482a9d[_0x9965('0x1f')];this[_0x9965('0xa')][_0x482a9d[_0x9965('0x20')]]['id']=this['faxAccounts'][_0x1e62c2]['id'];this[_0x9965('0xa')][_0x482a9d[_0x9965('0x20')]]['name']=this[_0x9965('0xb')][_0x1e62c2]['name'];logger[_0x9965('0x21')](_0x482a9d[_0x9965('0x20')],_0x9965('0x22'));}}}}if(this[_0x9965('0x23')][_0x482a9d['uniqueid']]){this[_0x9965('0xa')][_0x482a9d[_0x9965('0x20')]]={};this[_0x9965('0xa')][_0x482a9d[_0x9965('0x20')]][_0x9965('0x1f')]=_0x482a9d[_0x9965('0x1f')];logger[_0x9965('0x21')](_0x482a9d[_0x9965('0x20')],_0x9965('0x22'));}};Fax[_0x9965('0x19')][_0x9965('0xf')]=function(_0x21a1b5){if(this[_0x9965('0xa')][_0x21a1b5[_0x9965('0x20')]]){for(var _0x46a193 in _0x21a1b5[_0x9965('0x24')]){if(_0x21a1b5[_0x9965('0x24')][_0x9965('0x1c')](_0x46a193)){this[_0x9965('0xa')][_0x21a1b5[_0x9965('0x20')]][_0x46a193]=_0x21a1b5[_0x9965('0x25')];}}}};Fax[_0x9965('0x19')][_0x9965('0x10')]=function(_0x57cd07){if(this[_0x9965('0xa')][_0x57cd07['uniqueid']]){this[_0x9965('0xa')][_0x57cd07[_0x9965('0x20')]][_0x9965('0x26')]=_0x57cd07[_0x9965('0x26')];this['channels'][_0x57cd07['uniqueid']][_0x9965('0x27')]=_0x57cd07[_0x9965('0x27')];}};Fax['prototype'][_0x9965('0x12')]=function(_0x2f0b30){if(this['channels'][_0x2f0b30[_0x9965('0x20')]]){for(var _0x38e1ef in _0x2f0b30[_0x9965('0x24')]){if(_0x2f0b30[_0x9965('0x24')]['hasOwnProperty'](_0x38e1ef)){this[_0x9965('0xa')][_0x2f0b30[_0x9965('0x20')]][_0x38e1ef]=_0x2f0b30[_0x9965('0x25')];}}}};Fax[_0x9965('0x19')][_0x9965('0x14')]=function(_0x594efc){if(this[_0x9965('0xa')][_0x594efc[_0x9965('0x20')]]){this[_0x9965('0xa')][_0x594efc['uniqueid']][_0x9965('0x28')]=_0x594efc[_0x9965('0x28')];this[_0x9965('0xa')][_0x594efc[_0x9965('0x20')]][_0x9965('0x29')]=_0x594efc[_0x9965('0x29')];this[_0x9965('0xa')][_0x594efc['uniqueid']]['localstationid']=_0x594efc['localstationid'];this['channels'][_0x594efc[_0x9965('0x20')]]['filename']=_0x594efc[_0x9965('0x2a')];logger[_0x9965('0x21')](_0x594efc[_0x9965('0x20')],_0x9965('0x2b'));}};Fax[_0x9965('0x19')]['syncReceiveFax']=function(_0x111677){var _0x264c44=this;if(this[_0x9965('0xa')][_0x111677[_0x9965('0x20')]]){var _0x37ccb8=this['channels'][_0x111677[_0x9965('0x20')]]['id'];this['channels'][_0x111677['uniqueid']][_0x9965('0x2c')]=_0x111677['remotestationid'];this[_0x9965('0xa')][_0x111677['uniqueid']][_0x9965('0x2d')]=_0x111677['pagestransferred'];this[_0x9965('0xa')][_0x111677[_0x9965('0x20')]]['localstationid']=_0x111677[_0x9965('0x1e')];this[_0x9965('0xa')][_0x111677[_0x9965('0x20')]]['resolution']=_0x111677[_0x9965('0x2e')];this[_0x9965('0xa')][_0x111677[_0x9965('0x20')]][_0x9965('0x2f')]=_0x111677['transferrate'];this[_0x9965('0xa')][_0x111677[_0x9965('0x20')]][_0x9965('0x2a')]=_0x111677['filename'];this[_0x9965('0xa')][_0x111677[_0x9965('0x20')]][_0x9965('0x30')]=_0x111677[_0x9965('0x30')];if(this[_0x9965('0xa')][_0x111677[_0x9965('0x20')]][_0x9965('0x2d')]>0x0){tiff2pdf(_0x111677[_0x9965('0x2a')],_0x9965('0x31'),function(_0x5c164d){logger['info'](_0x111677[_0x9965('0x20')],_0x9965('0x32'),_0x5c164d[_0x9965('0x33')]);attachment[_0x9965('0x34')]({'name':path[_0x9965('0x35')](_0x111677[_0x9965('0x2a')])[_0x9965('0x36')],'basename':path[_0x9965('0x35')](_0x111677[_0x9965('0x2a')])['name']+_0x9965('0x37'),'type':'application/pdf'})[_0x9965('0x38')](function(_0x22e86a){faxAccount['notify'](_0x37ccb8,{'from':_0x111677[_0x9965('0x30')],'mapKey':'fax','body':path[_0x9965('0x35')](_0x111677[_0x9965('0x2a')])['name']+'.pdf','AttachmentId':_0x22e86a['id']})[_0x9965('0x39')](function(_0x1c3970){logger[_0x9965('0x3a')](_0x111677[_0x9965('0x20')],_0x9965('0x3b'),JSON[_0x9965('0x3c')](_0x1c3970));});})[_0x9965('0x39')](function(_0x1273a1){logger[_0x9965('0x3a')](_0x111677['uniqueid'],'\x20receiveFax\x20',JSON[_0x9965('0x3c')](_0x1273a1));});});}logger[_0x9965('0x21')](_0x111677['uniqueid'],_0x9965('0x3d'));}};Fax[_0x9965('0x19')]['syncOriginateResponse']=function(_0x51ace7){if(this[_0x9965('0x23')][_0x51ace7['uniqueid']]){_[_0x9965('0x3e')](this[_0x9965('0xa')][_0x51ace7[_0x9965('0x20')]],_[_0x9965('0x3f')](_0x51ace7,['response',_0x9965('0x40')]));}};function updateStatus(_0x4c83e9){if(_0x4c83e9[_0x9965('0x41')]){faxMessage['update'](_0x4c83e9['AttachmentId'],{'failMessage':_0x9965('0x42')})[_0x9965('0x38')](function(_0x1f3518){ut[_0x9965('0x43')](_0x9965('0x44'),_0x1f3518);})[_0x9965('0x39')](function(_0xf86974){ut[_0x9965('0x43')](_0x9965('0x45'),_0xf86974);});}else{ut[_0x9965('0x43')](_0x9965('0x46'));}}Fax['prototype'][_0x9965('0x47')]=function(_0x9f4bf2,_0x32bde7,_0x3f4e47){var _0x2c16cf=this;var _0x36a3fb={};if(_0x32bde7){_0x36a3fb={'read':_0x32bde7};}else{_0x36a3fb={'failMessage':_0x3f4e47};}if(this[_0x9965('0x23')][_0x9f4bf2][_0x9965('0x41')]){faxMessage[_0x9965('0x48')](this[_0x9965('0x23')][_0x9f4bf2][_0x9965('0x41')],_0x36a3fb)[_0x9965('0x38')](function(_0x2060f7){ut[_0x9965('0x43')]('[Fax][Message][Updated]',_0x2060f7);})[_0x9965('0x39')](function(_0x2ffbdf){ut[_0x9965('0x43')](_0x9965('0x49'),_0x2ffbdf);})[_0x9965('0x4a')](function(){delete _0x2c16cf[_0x9965('0xa')][_0x9f4bf2];delete _0x2c16cf['actions'][_0x9f4bf2];});}else{ut[_0x9965('0x43')]('[Fax][Message][NoUpdate2]');delete this[_0x9965('0xa')][_0x9f4bf2];delete this[_0x9965('0x23')][_0x9f4bf2];}};Fax['prototype'][_0x9965('0x17')]=function(_0x8cf77f){var _0x22cdf5=this;if(this[_0x9965('0xa')][_0x8cf77f[_0x9965('0x20')]]){if(this['actions'][_0x8cf77f[_0x9965('0x20')]]){this[_0x9965('0xa')][_0x8cf77f[_0x9965('0x20')]]['id']=this[_0x9965('0x23')][_0x8cf77f['uniqueid']]['id'];this['channels'][_0x8cf77f['uniqueid']][_0x9965('0x36')]=this[_0x9965('0x23')][_0x8cf77f[_0x9965('0x20')]]['name'];}logger[_0x9965('0x21')](_0x8cf77f[_0x9965('0x20')],this['actions'][_0x8cf77f[_0x9965('0x20')]]?_0x9965('0x4b'):_0x9965('0x4c'),JSON['stringify'](this[_0x9965('0xa')][_0x8cf77f[_0x9965('0x20')]]));if(this[_0x9965('0x23')][_0x8cf77f[_0x9965('0x20')]]){if(this[_0x9965('0xa')][_0x8cf77f[_0x9965('0x20')]]['faxpages']>0x0&&this[_0x9965('0xa')][_0x8cf77f[_0x9965('0x20')]][_0x9965('0x13')]===_0x9965('0x4d')){this[_0x9965('0x47')](_0x8cf77f[_0x9965('0x20')],!![]);}else{this['updateStatus'](_0x8cf77f[_0x9965('0x20')],![],this[_0x9965('0xa')][_0x8cf77f[_0x9965('0x20')]][_0x9965('0x4e')]?_0x9965('0x4f')+this[_0x9965('0xa')][_0x8cf77f[_0x9965('0x20')]][_0x9965('0x4e')]:_0x9965('0x50'));}}}};Fax['prototype'][_0x9965('0x51')]=function(_0x243a90){var _0x331610=this;return new BPromise(function(_0x2e0133,_0x3afc61){_0x331610[_0x9965('0x52')](_0x243a90,_0x331610[_0x9965('0xb')][_0x243a90[_0x9965('0x53')]])[_0x9965('0x38')](function(_0x9f39b8){ut[_0x9965('0x43')](_0x9965('0x54'),_0x9f39b8);_0x2e0133(ut[_0x9965('0x33')](_0x9965('0x55')));})[_0x9965('0x39')](function(_0x56ff8f){ut[_0x9965('0x43')](_0x9965('0x56'),_0x56ff8f);updateStatus(_0x243a90);_0x3afc61(ut[_0x9965('0x33')](_0x9965('0x57')));});});};Fax[_0x9965('0x19')][_0x9965('0x58')]=function(_0x2a0266){var _0x220f7f=this;return new BPromise(function(_0x4b6651,_0x2f6a07){var _0xb47fe5=_0x220f7f[_0x9965('0x59')](_0x220f7f['faxAccounts'][_0x2a0266['FaxAccountId']]['Trunk'],_0x2a0266);if(_0xb47fe5[_0x9965('0x5a')]){_0x4b6651(ut['message'](_0x9965('0x5b')));}else{_0x2f6a07(ut[_0x9965('0x33')](_0xb47fe5['message']));}});};function originate(_0x491a96,_0x940239,_0x36aa9f){return new BPromise(function(_0x2ffdfd,_0x5dd72c){if(_0x36aa9f){var _0x19d289=util[_0x9965('0x5c')]('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0x9965('0x35')](_0x491a96[_0x9965('0x4')])[_0x9965('0x36')],_0x491a96[_0x9965('0x4')]);gs[_0x9965('0x5d')](_0x19d289)['then'](function(){_0x491a96[_0x9965('0x4')]=util['format']('%s/%s.tif',path['parse'](_0x491a96[_0x9965('0x4')])[_0x9965('0x5e')],path['parse'](_0x491a96['path'])[_0x9965('0x36')]);_0x940239[_0x9965('0x5f')]=_0x491a96[_0x9965('0x4')];ut['logger'](_0x9965('0x60'),'');ami['Action'](ut[_0x9965('0x61')](_0x491a96,_0x940239))[_0x9965('0x38')](function(_0x3ac6d0){_0x2ffdfd(_0x3ac6d0);})[_0x9965('0x39')](function(_0x888791){_0x5dd72c(_0x888791);});})[_0x9965('0x39')](function(_0x1fa145){_0x5dd72c(_0x1fa145);});}else{ami[_0x9965('0x62')](ut[_0x9965('0x61')](_0x491a96,_0x940239))[_0x9965('0x38')](function(_0x46a8bb){_0x2ffdfd(_0x46a8bb);})['catch'](function(_0x57ad46){_0x5dd72c(_0x57ad46);});}});}Fax[_0x9965('0x19')][_0x9965('0x52')]=function(_0x1fcae0,_0x5b47b2){var _0x2359e4=this;return new BPromise(function(_0x20fcf6,_0xc8d53b){var _0x56d7c2=uuid['v4']();var _0x21eecd=ut['addVariables'](_0x1fcae0,_0x5b47b2);_0x2359e4[_0x9965('0x23')][_0x56d7c2]=new Action(_0x56d7c2,_0x5b47b2,_0x1fcae0);var _0x2ea451=_0x2359e4['actions'][_0x56d7c2];if(path[_0x9965('0x35')](_0x1fcae0[_0x9965('0x4')])['ext']===_0x9965('0x37')){originate(_0x2ea451,_0x21eecd,!![])[_0x9965('0x38')](function(_0x1bed75){_0x20fcf6(_0x1bed75);})[_0x9965('0x39')](function(_0xc52a65){_0xc8d53b(_0xc52a65);});}else{originate(_0x2ea451,_0x21eecd,![])[_0x9965('0x38')](function(_0x5a0fbb){_0x20fcf6(_0x5a0fbb);})[_0x9965('0x39')](function(_0x250557){_0xc8d53b(_0x250557);});}});};Fax[_0x9965('0x19')][_0x9965('0x63')]=function(_0x3d13c0){return!_['isNil'](_0x3d13c0)&&!_[_0x9965('0x64')](_0x3d13c0[_0x9965('0x36')])&&!_[_0x9965('0x64')](_0x3d13c0['active'])&&_0x3d13c0[_0x9965('0x65')]&&!_['isNil'](this[_0x9965('0xc')][util['format'](_0x9965('0x66'),_0x3d13c0[_0x9965('0x36')])])&&!_[_0x9965('0x64')](this[_0x9965('0xc')][util['format'](_0x9965('0x66'),_0x3d13c0[_0x9965('0x36')])][_0x9965('0x29')])&&(this[_0x9965('0xc')][util['format'](_0x9965('0x66'),_0x3d13c0[_0x9965('0x36')])][_0x9965('0x29')]===_0x9965('0x67')||this[_0x9965('0xc')][util[_0x9965('0x5c')]('SIP/%s',_0x3d13c0[_0x9965('0x36')])][_0x9965('0x29')]===_0x9965('0x68'));};Fax[_0x9965('0x19')][_0x9965('0x59')]=function(_0x473617,_0x464b4b){if(!this[_0x9965('0x63')](_0x473617)){ut[_0x9965('0x43')](_0x9965('0x69'),_[_0x9965('0x64')](_0x473617)?'':_0x473617[_0x9965('0x36')]+_0x9965('0x6a'));return{'isValid':![],'message':_0x9965('0x6b')};}if(_[_0x9965('0x64')](_0x464b4b[_0x9965('0x6')])){ut[_0x9965('0x43')](_0x9965('0x6c'),JSON[_0x9965('0x3c')](_0x464b4b));return{'isValid':![],'message':_0x9965('0x6d')};}if(_[_0x9965('0x64')](_0x464b4b[_0x9965('0x4')])){ut[_0x9965('0x43')](_0x9965('0x6e'),JSON['stringify'](_0x464b4b));return{'isValid':![],'message':_0x9965('0x6f')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x9965('0x70')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 826c2c0..255184c 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 _0xb7f7=['then','catch','util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','inspect','notify','resolve'];(function(_0x469a3c,_0x5ebc10){var _0x968f4=function(_0x22403b){while(--_0x22403b){_0x469a3c['push'](_0x469a3c['shift']());}};_0x968f4(++_0x5ebc10);}(_0xb7f7,0x136));var _0x7b7f=function(_0x486be1,_0x3fdf5e){_0x486be1=_0x486be1-0x0;var _0x586fa1=_0xb7f7[_0x486be1];return _0x586fa1;};'use strict';var util=require(_0x7b7f('0x0'));var BPromise=require(_0x7b7f('0x1'));var logger=require(_0x7b7f('0x2'))(_0x7b7f('0x3'));var _=require(_0x7b7f('0x4'));var faxAccount=require(_0x7b7f('0x5'));function loggerCatch(_0x342977){return function(_0x19b885){logger['error'](_0x342977,util[_0x7b7f('0x6')](_0x19b885,{'showHidden':![],'depth':null}));};}exports[_0x7b7f('0x7')]=function(_0x44b50c,_0x38bb7e){return BPromise[_0x7b7f('0x8')]()[_0x7b7f('0x9')](faxAccount[_0x7b7f('0x7')](_0x44b50c,_0x38bb7e))[_0x7b7f('0xa')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0x50bc=['../../../config/logger','preview','lodash','error','inspect','notify','resolve','then','catch','util'];(function(_0x483052,_0x519d3e){var _0x2fd5d5=function(_0x55bfcd){while(--_0x55bfcd){_0x483052['push'](_0x483052['shift']());}};_0x2fd5d5(++_0x519d3e);}(_0x50bc,0xbd));var _0xc50b=function(_0x12c411,_0x576727){_0x12c411=_0x12c411-0x0;var _0x13a6ed=_0x50bc[_0x12c411];return _0x13a6ed;};'use strict';var util=require(_0xc50b('0x0'));var BPromise=require('bluebird');var logger=require(_0xc50b('0x1'))(_0xc50b('0x2'));var _=require(_0xc50b('0x3'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x1d5a40){return function(_0x256b02){logger[_0xc50b('0x4')](_0x1d5a40,util[_0xc50b('0x5')](_0x256b02,{'showHidden':![],'depth':null}));};}exports[_0xc50b('0x6')]=function(_0x3b7314,_0x16e5bd){return BPromise[_0xc50b('0x7')]()[_0xc50b('0x8')](faxAccount[_0xc50b('0x6')](_0x3b7314,_0x16e5bd))[_0xc50b('0x9')](loggerCatch('[Notify]\x20'));}; \ 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 2b2ec42..4d81e6d 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 _0x934b=['inspect','util','../../../../config/logger','fax','bluebird','child_process','exec','info','Exec\x20gs','\x20Error\x20:'];(function(_0x2280f1,_0x3f253e){var _0x351fbb=function(_0x33b0d0){while(--_0x33b0d0){_0x2280f1['push'](_0x2280f1['shift']());}};_0x351fbb(++_0x3f253e);}(_0x934b,0xdd));var _0xb934=function(_0x2cb122,_0x5684a0){_0x2cb122=_0x2cb122-0x0;var _0x21af56=_0x934b[_0x2cb122];return _0x21af56;};'use strict';var util=require(_0xb934('0x0'));var logger=require(_0xb934('0x1'))(_0xb934('0x2'));var BPromise=require(_0xb934('0x3'));var exec=require(_0xb934('0x4'))[_0xb934('0x5')];exports['execute']=function(_0x420b90){return new BPromise(function(_0xad126a,_0x4779fa){exec(_0x420b90,function(_0x143760,_0x53b67b,_0x248fe2){logger['info']('Exec\x20gs',_0x53b67b);if(_0x143760){logger[_0xb934('0x6')](_0xb934('0x7'),_0xb934('0x8'),util[_0xb934('0x9')](_0x143760,{'showHidden':![],'depth':null}),_0x53b67b,_0x248fe2);_0x4779fa(_0x143760);}_0xad126a(_0x53b67b);});});}; \ No newline at end of file +var _0x41e7=['Exec\x20gs','\x20Error\x20:','util','fax','bluebird','child_process','exec','execute','info'];(function(_0x43776a,_0x4eb74c){var _0x18eb8f=function(_0x319afb){while(--_0x319afb){_0x43776a['push'](_0x43776a['shift']());}};_0x18eb8f(++_0x4eb74c);}(_0x41e7,0x18e));var _0x741e=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x41e7[_0x432682];return _0x463d05;};'use strict';var util=require(_0x741e('0x0'));var logger=require('../../../../config/logger')(_0x741e('0x1'));var BPromise=require(_0x741e('0x2'));var exec=require(_0x741e('0x3'))[_0x741e('0x4')];exports[_0x741e('0x5')]=function(_0x1480cb){return new BPromise(function(_0x28529d,_0x1357d8){exec(_0x1480cb,function(_0x1f6f91,_0x22ba53,_0x4461cc){logger[_0x741e('0x6')](_0x741e('0x7'),_0x22ba53);if(_0x1f6f91){logger['info'](_0x741e('0x7'),_0x741e('0x8'),util['inspect'](_0x1f6f91,{'showHidden':![],'depth':null}),_0x22ba53,_0x4461cc);_0x1357d8(_0x1f6f91);}_0x28529d(_0x22ba53);});});}; \ 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 5daffa1..bd9c189 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 _0xb7d1=['message','logger','info','inspect','addVariables','headerinfo','minrate','maxrate','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','channel','xcally-motion-fax','from-sip','format','\x22%s\x22\x20<%s>','lodash','moment','../../../../config/logger','fax'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0xb7d1,0x1b6));var _0x1b7d=function(_0x44466c,_0x574597){_0x44466c=_0x44466c-0x0;var _0x102acd=_0xb7d1[_0x44466c];return _0x102acd;};'use strict';var util=require('util');var _=require(_0x1b7d('0x0'));var moment=require(_0x1b7d('0x1'));var logger=require(_0x1b7d('0x2'))(_0x1b7d('0x3'));exports[_0x1b7d('0x4')]=function(_0x29f509){return{'message':_0x29f509};};exports[_0x1b7d('0x5')]=function(_0x448a11,_0x1aa2e8){logger[_0x1b7d('0x6')](_0x448a11,util[_0x1b7d('0x7')](_0x1aa2e8,{'showHidden':![],'depth':null}));};exports[_0x1b7d('0x8')]=function(_0x148f9e,_0x6897a1){var _0x4f9a28={'XMF-ECM':_0x6897a1['ecm'],'XMF-HEADERINFO':_0x6897a1[_0x1b7d('0x9')],'XMF-MINRATE':_0x6897a1[_0x1b7d('0xa')],'XMF-MAXRATE':_0x6897a1[_0x1b7d('0xb')],'XMF-MODEM':util['format'](_0x1b7d('0xc'),_0x6897a1[_0x1b7d('0xd')]),'XMF-GATEWAY':_0x6897a1[_0x1b7d('0xe')],'XMF-FAXDETECT':_0x6897a1[_0x1b7d('0xf')],'XMF-T38TIMEOUT':_0x6897a1[_0x1b7d('0x10')],'XMF-LOCALSTATIONID':_0x6897a1[_0x1b7d('0x11')],'XMF-PATH':_0x148f9e[_0x1b7d('0x12')]};return _0x4f9a28;};exports[_0x1b7d('0x13')]=function(_0x295a41,_0x2cb1ca){return{'actionid':_0x295a41[_0x1b7d('0x14')],'action':'originate','channel':_0x295a41[_0x1b7d('0x15')],'Exten':_0x1b7d('0x16'),'Context':_0x1b7d('0x17'),'Priority':'1','callerid':util[_0x1b7d('0x18')](_0x1b7d('0x19'),_0x295a41[_0x1b7d('0x9')]?_0x295a41[_0x1b7d('0x9')]:'',_0x295a41[_0x1b7d('0x11')]),'variable':_0x2cb1ca,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x295a41[_0x1b7d('0x14')]};}; \ No newline at end of file +var _0x6720=['logger','inspect','ecm','minrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','headerinfo','util','moment','fax','message'];(function(_0x49e29b,_0x45b68a){var _0x1e4e27=function(_0x179597){while(--_0x179597){_0x49e29b['push'](_0x49e29b['shift']());}};_0x1e4e27(++_0x45b68a);}(_0x6720,0x86));var _0x0672=function(_0x434f0f,_0x58db40){_0x434f0f=_0x434f0f-0x0;var _0x381ed8=_0x6720[_0x434f0f];return _0x381ed8;};'use strict';var util=require(_0x0672('0x0'));var _=require('lodash');var moment=require(_0x0672('0x1'));var logger=require('../../../../config/logger')(_0x0672('0x2'));exports[_0x0672('0x3')]=function(_0x249367){return{'message':_0x249367};};exports[_0x0672('0x4')]=function(_0x34af0d,_0x22b1b3){logger['info'](_0x34af0d,util[_0x0672('0x5')](_0x22b1b3,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x5f176e,_0x6d7780){var _0x27557f={'XMF-ECM':_0x6d7780[_0x0672('0x6')],'XMF-HEADERINFO':_0x6d7780['headerinfo'],'XMF-MINRATE':_0x6d7780[_0x0672('0x7')],'XMF-MAXRATE':_0x6d7780['maxrate'],'XMF-MODEM':util[_0x0672('0x8')](_0x0672('0x9'),_0x6d7780[_0x0672('0xa')]),'XMF-GATEWAY':_0x6d7780[_0x0672('0xb')],'XMF-FAXDETECT':_0x6d7780[_0x0672('0xc')],'XMF-T38TIMEOUT':_0x6d7780[_0x0672('0xd')],'XMF-LOCALSTATIONID':_0x6d7780[_0x0672('0xe')],'XMF-PATH':_0x5f176e[_0x0672('0xf')]};return _0x27557f;};exports[_0x0672('0x10')]=function(_0x2db590,_0x433250){return{'actionid':_0x2db590['uniqueid'],'action':_0x0672('0x11'),'channel':_0x2db590[_0x0672('0x12')],'Exten':_0x0672('0x13'),'Context':_0x0672('0x14'),'Priority':'1','callerid':util[_0x0672('0x8')](_0x0672('0x15'),_0x2db590[_0x0672('0x16')]?_0x2db590[_0x0672('0x16')]:'',_0x2db590[_0x0672('0xe')]),'variable':_0x433250,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x2db590['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 6e5aabf..c060a6b 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 _0x4425=['getDeskAccounts','initDeskAccounts','initZohoAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','initDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','resolve','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','initCampaignHopperHistory','initVoiceCallReports','catch','log','listen','bluebird','util','moment','./server','./realtime','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','get','hour','then','initAgents','getTelephones','initTelephones','initTrunks','getVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts'];(function(_0x38bb1c,_0x1ae84e){var _0x4aab62=function(_0x45020f){while(--_0x45020f){_0x38bb1c['push'](_0x38bb1c['shift']());}};_0x4aab62(++_0x1ae84e);}(_0x4425,0x19b));var _0x5442=function(_0x372c1c,_0x15c86d){_0x372c1c=_0x372c1c-0x0;var _0x4b480c=_0x4425[_0x372c1c];return _0x4b480c;};'use strict';var BPromise=require(_0x5442('0x0'));var util=require(_0x5442('0x1'));var moment=require(_0x5442('0x2'));var server=require(_0x5442('0x3'));var Realtime=require(_0x5442('0x4'));var Report=require('./report');var Acw=require(_0x5442('0x5'));var Trigger=require(_0x5442('0x6'));var Dialer=require(_0x5442('0x7'));var Preview=require(_0x5442('0x8'));var Fax=require(_0x5442('0x9'));var user=require(_0x5442('0xa'));var voiceQueue=require(_0x5442('0xb'));var voiceQueueReport=require(_0x5442('0xc'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x5442('0xd'));var trigger=require(_0x5442('0xe'));var template=require(_0x5442('0xf'));var cmHopperHistory=require(_0x5442('0x10'));var campaign=require(_0x5442('0x11'));var voiceExtension=require(_0x5442('0x12'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x5442('0x13'));var salesforce=require(_0x5442('0x14'));var sugarcrm=require(_0x5442('0x15'));var freshdesk=require(_0x5442('0x16'));var desk=require('./rpc/integrations/desk');var zoho=require(_0x5442('0x17'));var vtiger=require(_0x5442('0x18'));var freshsales=require(_0x5442('0x19'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x5442('0x1a'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x5442('0x1b')](_0x5442('0x1c'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x5442('0x1b')](_0x5442('0x1c'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0x5442('0x1d')](user['getAgents']())[_0x5442('0x1d')](realtime[_0x5442('0x1e')]())[_0x5442('0x1d')](user[_0x5442('0x1f')]())[_0x5442('0x1d')](realtime[_0x5442('0x20')]())[_0x5442('0x1d')](trunk['getTrunks']())[_0x5442('0x1d')](realtime[_0x5442('0x21')]())[_0x5442('0x1d')](voiceQueue[_0x5442('0x22')]())[_0x5442('0x1d')](realtime['initVoiceQueues']())[_0x5442('0x1d')](trigger[_0x5442('0x23')]())['then'](realtime[_0x5442('0x24')]())['then'](template[_0x5442('0x25')]())['then'](realtime[_0x5442('0x26')]())['then'](zendesk[_0x5442('0x27')]())[_0x5442('0x1d')](realtime[_0x5442('0x28')]())['then'](salesforce[_0x5442('0x29')]())[_0x5442('0x1d')](realtime[_0x5442('0x2a')]())['then'](sugarcrm['getSugarcrmAccounts']())[_0x5442('0x1d')](realtime[_0x5442('0x2b')]())['then'](freshdesk['getFreshdeskAccounts']())[_0x5442('0x1d')](realtime['initFreshdeskAccounts']())['then'](desk[_0x5442('0x2c')]())['then'](realtime[_0x5442('0x2d')]())['then'](zoho['getZohoAccounts']())[_0x5442('0x1d')](realtime[_0x5442('0x2e')]())[_0x5442('0x1d')](vtiger['getVtigerAccounts']())[_0x5442('0x1d')](realtime[_0x5442('0x2f')]())['then'](freshsales[_0x5442('0x30')]())[_0x5442('0x1d')](realtime[_0x5442('0x31')]())['then'](servicenow[_0x5442('0x32')]())['then'](realtime[_0x5442('0x33')]())[_0x5442('0x1d')](dynamics365['getDynamics365Accounts']())[_0x5442('0x1d')](realtime[_0x5442('0x34')]())['then'](campaign[_0x5442('0x35')]())[_0x5442('0x1d')](realtime['initCampaigns']())[_0x5442('0x1d')](voiceExtension[_0x5442('0x36')]())[_0x5442('0x1d')](realtime[_0x5442('0x37')]())[_0x5442('0x1d')](faxAccount['getFaxAccounts']())['then'](realtime['initFaxAccounts']())['then'](function(){return realtime;});}function initParams(){return BPromise[_0x5442('0x38')]()[_0x5442('0x1d')](voiceQueueReport['getVoiceQueueReports']())[_0x5442('0x1d')](realtime[_0x5442('0x39')]())['then'](cmHopperHistory[_0x5442('0x3a')]())['then'](realtime[_0x5442('0x3b')]())[_0x5442('0x1d')](cmHopperHistory['getCampaignHopperHistory']())[_0x5442('0x1d')](realtime[_0x5442('0x3c')]())[_0x5442('0x1d')](voiceCallReport['getVoiceCallReports']())[_0x5442('0x1d')](realtime[_0x5442('0x3d')]())['then'](function(_0x52d23d){})[_0x5442('0x3e')](function(_0x40cb38){console[_0x5442('0x3f')](_0x40cb38);});}function main(){return server[_0x5442('0x40')](realtime,preview,fax)[_0x5442('0x1d')](function(_0x3a4fe7){return initRealtime();})['then'](function(){return initParams();})[_0x5442('0x1d')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x5442('0x3e')](function(_0x5c8ddb){console[_0x5442('0x3f')](_0x5c8ddb);});}main(); \ No newline at end of file +var _0x98df=['getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','listen','sync','bluebird','util','moment','./server','./report','./trigger','./dialer','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','hour','get','then','initAgents','getTelephones','initTelephones','getTrunks','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts'];(function(_0xeedc37,_0x471981){var _0x3a4bcd=function(_0x43984e){while(--_0x43984e){_0xeedc37['push'](_0xeedc37['shift']());}};_0x3a4bcd(++_0x471981);}(_0x98df,0x1e1));var _0xf98d=function(_0x45030e,_0x32b6b8){_0x45030e=_0x45030e-0x0;var _0x4df3be=_0x98df[_0x45030e];return _0x4df3be;};'use strict';var BPromise=require(_0xf98d('0x0'));var util=require(_0xf98d('0x1'));var moment=require(_0xf98d('0x2'));var server=require(_0xf98d('0x3'));var Realtime=require('./realtime');var Report=require(_0xf98d('0x4'));var Acw=require('./acw');var Trigger=require(_0xf98d('0x5'));var Dialer=require(_0xf98d('0x6'));var Preview=require(_0xf98d('0x7'));var Fax=require(_0xf98d('0x8'));var user=require('./rpc/user');var voiceQueue=require(_0xf98d('0x9'));var voiceQueueReport=require(_0xf98d('0xa'));var voiceCallReport=require(_0xf98d('0xb'));var trunk=require(_0xf98d('0xc'));var trigger=require(_0xf98d('0xd'));var template=require(_0xf98d('0xe'));var cmHopperHistory=require(_0xf98d('0xf'));var campaign=require(_0xf98d('0x10'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0xf98d('0x11'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0xf98d('0x12'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require('./rpc/integrations/freshdesk');var desk=require('./rpc/integrations/desk');var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0xf98d('0x13'));var freshsales=require(_0xf98d('0x14'));var servicenow=require(_0xf98d('0x15'));var dynamics365=require(_0xf98d('0x16'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0xf98d('0x17'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xf98d('0x18')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0xf98d('0x19')](user['getAgents']())[_0xf98d('0x19')](realtime[_0xf98d('0x1a')]())[_0xf98d('0x19')](user[_0xf98d('0x1b')]())['then'](realtime[_0xf98d('0x1c')]())[_0xf98d('0x19')](trunk[_0xf98d('0x1d')]())[_0xf98d('0x19')](realtime['initTrunks']())[_0xf98d('0x19')](voiceQueue['getVoiceQueues']())[_0xf98d('0x19')](realtime['initVoiceQueues']())['then'](trigger[_0xf98d('0x1e')]())['then'](realtime[_0xf98d('0x1f')]())[_0xf98d('0x19')](template[_0xf98d('0x20')]())[_0xf98d('0x19')](realtime[_0xf98d('0x21')]())[_0xf98d('0x19')](zendesk[_0xf98d('0x22')]())[_0xf98d('0x19')](realtime[_0xf98d('0x23')]())[_0xf98d('0x19')](salesforce[_0xf98d('0x24')]())[_0xf98d('0x19')](realtime['initSalesforceAccounts']())[_0xf98d('0x19')](sugarcrm[_0xf98d('0x25')]())[_0xf98d('0x19')](realtime['initSugarcrmAccounts']())['then'](freshdesk[_0xf98d('0x26')]())['then'](realtime['initFreshdeskAccounts']())['then'](desk['getDeskAccounts']())[_0xf98d('0x19')](realtime['initDeskAccounts']())[_0xf98d('0x19')](zoho[_0xf98d('0x27')]())[_0xf98d('0x19')](realtime[_0xf98d('0x28')]())[_0xf98d('0x19')](vtiger[_0xf98d('0x29')]())[_0xf98d('0x19')](realtime[_0xf98d('0x2a')]())[_0xf98d('0x19')](freshsales[_0xf98d('0x2b')]())[_0xf98d('0x19')](realtime['initFreshsalesAccounts']())[_0xf98d('0x19')](servicenow[_0xf98d('0x2c')]())[_0xf98d('0x19')](realtime[_0xf98d('0x2d')]())[_0xf98d('0x19')](dynamics365[_0xf98d('0x2e')]())[_0xf98d('0x19')](realtime[_0xf98d('0x2f')]())[_0xf98d('0x19')](campaign[_0xf98d('0x30')]())['then'](realtime['initCampaigns']())[_0xf98d('0x19')](voiceExtension[_0xf98d('0x31')]())['then'](realtime[_0xf98d('0x32')]())[_0xf98d('0x19')](faxAccount[_0xf98d('0x33')]())[_0xf98d('0x19')](realtime[_0xf98d('0x34')]())[_0xf98d('0x19')](function(){return realtime;});}function initParams(){return BPromise[_0xf98d('0x35')]()[_0xf98d('0x19')](voiceQueueReport[_0xf98d('0x36')]())[_0xf98d('0x19')](realtime[_0xf98d('0x37')]())[_0xf98d('0x19')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0xf98d('0x19')](realtime[_0xf98d('0x38')]())[_0xf98d('0x19')](cmHopperHistory[_0xf98d('0x39')]())[_0xf98d('0x19')](realtime[_0xf98d('0x3a')]())[_0xf98d('0x19')](voiceCallReport[_0xf98d('0x3b')]())['then'](realtime[_0xf98d('0x3c')]())[_0xf98d('0x19')](function(_0x367bce){})[_0xf98d('0x3d')](function(_0x52ef40){console[_0xf98d('0x3e')](_0x52ef40);});}function main(){return server[_0xf98d('0x3f')](realtime,preview,fax)[_0xf98d('0x19')](function(_0x4fe453){return initRealtime();})[_0xf98d('0x19')](function(){return initParams();})[_0xf98d('0x19')](function(){report[_0xf98d('0x40')]();setInterval(initRealtime,0x1388);})[_0xf98d('0x3d')](function(_0x2ae262){console['log'](_0x2ae262);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index d33e3de..c3c0e24 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 _0xe706=['address','phone','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','updateStatusRealtime','not_inuse','inuse','talking','format','interface','stringify','md5','user:%s','emit','user:presence','lodash','util','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status'];(function(_0x541855,_0x2d7fb1){var _0x4de0c2=function(_0x1ae869){while(--_0x1ae869){_0x541855['push'](_0x541855['shift']());}};_0x4de0c2(++_0x2d7fb1);}(_0xe706,0xa3));var _0x6e70=function(_0x4b416c,_0x53ef9e){_0x4b416c=_0x4b416c-0x0;var _0x2037fa=_0xe706[_0x4b416c];return _0x2037fa;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var md5=require('md5');var Redis=require(_0x6e70('0x3'));var config=require(_0x6e70('0x4'));config[_0x6e70('0x5')]=_[_0x6e70('0x6')](config[_0x6e70('0x5')],{'host':_0x6e70('0x7'),'port':0x18eb});var io=require(_0x6e70('0x8'))(new Redis(config[_0x6e70('0x5')]));function Agent(_0x1b0389){this['id']=_0x1b0389['id']||0x0;this[_0x6e70('0x9')]=_0x1b0389[_0x6e70('0x9')]||'';this[_0x6e70('0xa')]=_0x1b0389[_0x6e70('0xa')]||'';this[_0x6e70('0xb')]=_0x1b0389[_0x6e70('0xb')]||'';this[_0x6e70('0xc')]=_0x1b0389[_0x6e70('0xc')]||'';this[_0x6e70('0xd')]=_0x6e70('0xe');this[_0x6e70('0xf')]=0x0;this[_0x6e70('0x10')]=_0x6e70('0xe');this[_0x6e70('0x11')]='';this[_0x6e70('0x12')]='';this['mobile']='';this['interface']='';this[_0x6e70('0x13')]=_0x1b0389[_0x6e70('0x13')]||![];this[_0x6e70('0x14')]=_0x6e70('0xe');this[_0x6e70('0x15')]=0x0;this[_0x6e70('0x16')]='';this[_0x6e70('0x17')]='';this[_0x6e70('0x18')]=![];this['local']=![];this['md5']='';}Agent['prototype'][_0x6e70('0x19')]=function(_0x5a37a6){var _0x53aed0;if(_0x5a37a6&&_0x5a37a6[_0x6e70('0xd')]){_0x53aed0=_0x5a37a6[_0x6e70('0xd')]['toLowerCase']();switch(_0x53aed0){case _0x6e70('0x1a'):_0x53aed0='idle';break;case _0x6e70('0x1b'):_0x53aed0=_0x6e70('0x1c');break;}}if(_0x53aed0&&this['voiceStatus']!==_0x53aed0||_0x5a37a6['statePause']){this[_0x6e70('0x15')]=_['toNumber'](moment()[_0x6e70('0x1d')]('x'));}if(_0x53aed0){this[_0x6e70('0x14')]=_0x53aed0;}var _0x53acdc={'id':this['id'],'name':this['name'],'email':this[_0x6e70('0xa')],'accountcode':this[_0x6e70('0xb')],'fullname':this[_0x6e70('0xc')],'state':this[_0x6e70('0xd')],'stateTime':this[_0x6e70('0xf')],'status':this[_0x6e70('0x10')],'address':this[_0x6e70('0x11')],'online':this[_0x6e70('0x13')],'voiceStatus':this[_0x6e70('0x14')],'voiceStatusTime':this[_0x6e70('0x15')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x6e70('0x17')],'interface':this[_0x6e70('0x1e')],'onhold':this[_0x6e70('0x18')]};var _0x502b2d=md5(JSON[_0x6e70('0x1f')](_0x53acdc));if(this[_0x6e70('0x20')]!==_0x502b2d){this[_0x6e70('0x20')]=_0x502b2d;io['to'](util['format'](_0x6e70('0x21'),_0x53acdc['name']))['emit']('user:save',_0x53acdc);io[_0x6e70('0x22')](_0x6e70('0x23'),_0x53acdc);}};module['exports']=Agent; \ No newline at end of file +var _0xedd9=['phone','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','prototype','updateStatusRealtime','state','toLowerCase','idle','inuse','talking','statePause','toNumber','interface','format','user:%s','user:save','emit','user:presence','exports','util','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','unknown','status'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xedd9,0xfc));var _0x9edd=function(_0x58ae23,_0x529357){_0x58ae23=_0x58ae23-0x0;var _0x148de4=_0xedd9[_0x58ae23];return _0x148de4;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var md5=require(_0x9edd('0x2'));var Redis=require(_0x9edd('0x3'));var config=require(_0x9edd('0x4'));config[_0x9edd('0x5')]=_[_0x9edd('0x6')](config[_0x9edd('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x9edd('0x7'))(new Redis(config[_0x9edd('0x5')]));function Agent(_0x268f9e){this['id']=_0x268f9e['id']||0x0;this[_0x9edd('0x8')]=_0x268f9e['name']||'';this[_0x9edd('0x9')]=_0x268f9e['email']||'';this[_0x9edd('0xa')]=_0x268f9e[_0x9edd('0xa')]||'';this[_0x9edd('0xb')]=_0x268f9e[_0x9edd('0xb')]||'';this['state']=_0x9edd('0xc');this['stateTime']=0x0;this[_0x9edd('0xd')]=_0x9edd('0xc');this['address']='';this[_0x9edd('0xe')]='';this[_0x9edd('0xf')]='';this['interface']='';this[_0x9edd('0x10')]=_0x268f9e[_0x9edd('0x10')]||![];this[_0x9edd('0x11')]=_0x9edd('0xc');this[_0x9edd('0x12')]=0x0;this[_0x9edd('0x13')]='';this[_0x9edd('0x14')]='';this[_0x9edd('0x15')]=![];this['local']=![];this[_0x9edd('0x2')]='';}Agent[_0x9edd('0x16')][_0x9edd('0x17')]=function(_0x4d9a7){var _0x13b6b6;if(_0x4d9a7&&_0x4d9a7[_0x9edd('0x18')]){_0x13b6b6=_0x4d9a7[_0x9edd('0x18')][_0x9edd('0x19')]();switch(_0x13b6b6){case'not_inuse':_0x13b6b6=_0x9edd('0x1a');break;case _0x9edd('0x1b'):_0x13b6b6=_0x9edd('0x1c');break;}}if(_0x13b6b6&&this['voiceStatus']!==_0x13b6b6||_0x4d9a7[_0x9edd('0x1d')]){this[_0x9edd('0x12')]=_[_0x9edd('0x1e')](moment()['format']('x'));}if(_0x13b6b6){this[_0x9edd('0x11')]=_0x13b6b6;}var _0x5d879c={'id':this['id'],'name':this[_0x9edd('0x8')],'email':this[_0x9edd('0x9')],'accountcode':this['accountcode'],'fullname':this['fullname'],'state':this[_0x9edd('0x18')],'stateTime':this['stateTime'],'status':this[_0x9edd('0xd')],'address':this['address'],'online':this['online'],'voiceStatus':this[_0x9edd('0x11')],'voiceStatusTime':this[_0x9edd('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x9edd('0x1f')],'onhold':this[_0x9edd('0x15')]};var _0x477878=md5(JSON['stringify'](_0x5d879c));if(this[_0x9edd('0x2')]!==_0x477878){this[_0x9edd('0x2')]=_0x477878;io['to'](util[_0x9edd('0x20')](_0x9edd('0x21'),_0x5d879c[_0x9edd('0x8')]))['emit'](_0x9edd('0x22'),_0x5d879c);io[_0x9edd('0x23')](_0x9edd('0x24'),_0x5d879c);}};module[_0x9edd('0x25')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 34d3460..01fd772 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 _0x4ff4=['dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','type','campaign','temp','ivrAnswerCallsDay','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','name'];(function(_0x3685f5,_0x4efffe){var _0x380431=function(_0x16a925){while(--_0x16a925){_0x3685f5['push'](_0x3685f5['shift']());}};_0x380431(++_0x4efffe);}(_0x4ff4,0xd2));var _0x44ff=function(_0x1f27df,_0x4f1a64){_0x1f27df=_0x1f27df-0x0;var _0x286ee2=_0x4ff4[_0x1f27df];return _0x286ee2;};'use strict';function Campaign(_0x25d21f){this['id']=_0x25d21f['id']||0x0;this['name']=_0x25d21f['name']||'';this[_0x44ff('0x0')]=_0x25d21f[_0x44ff('0x0')]||_0x44ff('0x1');this['originated']=0x0;this[_0x44ff('0x2')]=0x0;this[_0x44ff('0x3')]=0x0;this[_0x44ff('0x4')]=0x0;this['message']='';this[_0x44ff('0x5')]=!![];this[_0x44ff('0x6')]=_0x25d21f[_0x44ff('0x6')];this[_0x44ff('0x7')]=_0x25d21f['limitCalls'];this[_0x44ff('0x8')]=_0x25d21f['dialTimezone']||null;this[_0x44ff('0x9')]=_0x25d21f[_0x44ff('0x9')]?_0x25d21f[_0x44ff('0x9')]:null;this['dialOriginateCallerIdName']=_0x25d21f[_0x44ff('0xa')];this[_0x44ff('0xb')]=_0x25d21f[_0x44ff('0xb')];this['dialOriginateTimeout']=_0x25d21f[_0x44ff('0xc')]||0x1e;this[_0x44ff('0xd')]=_0x25d21f['dialCongestionMaxRetry'];this[_0x44ff('0xe')]=_0x25d21f[_0x44ff('0xe')];this[_0x44ff('0xf')]=_0x25d21f[_0x44ff('0xf')];this[_0x44ff('0x10')]=_0x25d21f[_0x44ff('0x10')];this[_0x44ff('0x11')]=_0x25d21f[_0x44ff('0x11')];this['dialNoAnswerRetryFrequency']=_0x25d21f['dialNoAnswerRetryFrequency'];this[_0x44ff('0x12')]=_0x25d21f[_0x44ff('0x12')];this[_0x44ff('0x13')]=_0x25d21f[_0x44ff('0x13')]||0x3;this[_0x44ff('0x14')]=_0x25d21f[_0x44ff('0x14')]||0x96;this['dialDropMaxRetry']=_0x25d21f[_0x44ff('0x15')]||0x3;this[_0x44ff('0x16')]=_0x25d21f[_0x44ff('0x16')]||0x96;this[_0x44ff('0x17')]=_0x25d21f['dialAbandonedMaxRetry']||0x3;this[_0x44ff('0x18')]=_0x25d21f[_0x44ff('0x18')]||0x96;this[_0x44ff('0x19')]=_0x25d21f[_0x44ff('0x19')]||0x3;this[_0x44ff('0x1a')]=_0x25d21f[_0x44ff('0x1a')]||0x96;this[_0x44ff('0x1b')]=_0x25d21f[_0x44ff('0x1b')]||0x3;this[_0x44ff('0x1c')]=_0x25d21f['dialAgentRejectRetryFrequency']||0x96;this[_0x44ff('0x1d')]=_0x25d21f[_0x44ff('0x1d')]||_0x44ff('0x1e');this[_0x44ff('0x1f')]=_0x25d21f[_0x44ff('0x1f')]||undefined;this[_0x44ff('0x20')]=_0x25d21f[_0x44ff('0x20')]||undefined;this[_0x44ff('0x21')]=_0x25d21f[_0x44ff('0x21')]||undefined;this['TrunkBackup']=_0x25d21f[_0x44ff('0x22')]?_0x25d21f['TrunkBackup']:undefined;this[_0x44ff('0x23')]=_0x25d21f[_0x44ff('0x23')]?_0x25d21f[_0x44ff('0x23')]:undefined;this[_0x44ff('0x24')]=_0x25d21f[_0x44ff('0x24')]?_0x25d21f[_0x44ff('0x24')]:undefined;this[_0x44ff('0x25')]=_0x25d21f[_0x44ff('0x25')]?_0x25d21f[_0x44ff('0x25')]:undefined;this[_0x44ff('0x26')]=_0x25d21f[_0x44ff('0x25')]?_0x25d21f[_0x44ff('0x25')][_0x44ff('0x27')]:undefined;this[_0x44ff('0x28')]=_0x25d21f[_0x44ff('0x28')]||![];this['dialAMDInitialSilence']=_0x25d21f[_0x44ff('0x29')];this[_0x44ff('0x2a')]=_0x25d21f[_0x44ff('0x2a')];this[_0x44ff('0x2b')]=_0x25d21f[_0x44ff('0x2b')];this['dialAMDTotalAnalysisTime']=_0x25d21f['dialAMDTotalAnalysisTime'];this[_0x44ff('0x2c')]=_0x25d21f[_0x44ff('0x2c')];this[_0x44ff('0x2d')]=_0x25d21f[_0x44ff('0x2d')];this[_0x44ff('0x2e')]=_0x25d21f[_0x44ff('0x2e')];this[_0x44ff('0x2f')]=_0x25d21f[_0x44ff('0x2f')];this[_0x44ff('0x30')]=_0x25d21f['dialAMDMaximumWordLength'];}module[_0x44ff('0x31')]=Campaign; \ No newline at end of file +var _0xed20=['dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','originated','temp','ivrAnswerCallsDay','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber'];(function(_0x3f49b7,_0x31db4e){var _0x1ca716=function(_0x51be02){while(--_0x51be02){_0x3f49b7['push'](_0x3f49b7['shift']());}};_0x1ca716(++_0x31db4e);}(_0xed20,0x10f));var _0x0ed2=function(_0x178b23,_0x278d25){_0x178b23=_0x178b23-0x0;var _0x363184=_0xed20[_0x178b23];return _0x363184;};'use strict';function Campaign(_0xc3252e){this['id']=_0xc3252e['id']||0x0;this[_0x0ed2('0x0')]=_0xc3252e[_0x0ed2('0x0')]||'';this[_0x0ed2('0x1')]=_0xc3252e['type']||_0x0ed2('0x2');this[_0x0ed2('0x3')]=0x0;this[_0x0ed2('0x4')]=0x0;this[_0x0ed2('0x5')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0x0ed2('0x6')]='';this[_0x0ed2('0x7')]=!![];this[_0x0ed2('0x8')]=_0xc3252e[_0x0ed2('0x8')];this[_0x0ed2('0x9')]=_0xc3252e[_0x0ed2('0x9')];this['dialTimezone']=_0xc3252e[_0x0ed2('0xa')]||null;this[_0x0ed2('0xb')]=_0xc3252e['dialGlobalInterval']?_0xc3252e[_0x0ed2('0xb')]:null;this[_0x0ed2('0xc')]=_0xc3252e[_0x0ed2('0xc')];this['dialOriginateCallerIdNumber']=_0xc3252e['dialOriginateCallerIdNumber'];this[_0x0ed2('0xd')]=_0xc3252e['dialOriginateTimeout']||0x1e;this['dialCongestionMaxRetry']=_0xc3252e[_0x0ed2('0xe')];this[_0x0ed2('0xf')]=_0xc3252e['dialCongestionRetryFrequency'];this['dialBusyMaxRetry']=_0xc3252e[_0x0ed2('0x10')];this['dialBusyRetryFrequency']=_0xc3252e[_0x0ed2('0x11')];this['dialNoAnswerMaxRetry']=_0xc3252e[_0x0ed2('0x12')];this[_0x0ed2('0x13')]=_0xc3252e[_0x0ed2('0x13')];this[_0x0ed2('0x14')]=_0xc3252e[_0x0ed2('0x14')];this[_0x0ed2('0x15')]=_0xc3252e[_0x0ed2('0x15')]||0x3;this[_0x0ed2('0x16')]=_0xc3252e[_0x0ed2('0x16')]||0x96;this[_0x0ed2('0x17')]=_0xc3252e[_0x0ed2('0x17')]||0x3;this[_0x0ed2('0x18')]=_0xc3252e['dialDropRetryFrequency']||0x96;this[_0x0ed2('0x19')]=_0xc3252e[_0x0ed2('0x19')]||0x3;this[_0x0ed2('0x1a')]=_0xc3252e[_0x0ed2('0x1a')]||0x96;this[_0x0ed2('0x1b')]=_0xc3252e['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0xc3252e[_0x0ed2('0x1c')]||0x96;this[_0x0ed2('0x1d')]=_0xc3252e['dialAgentRejectMaxRetry']||0x3;this[_0x0ed2('0x1e')]=_0xc3252e['dialAgentRejectRetryFrequency']||0x96;this[_0x0ed2('0x1f')]=_0xc3252e[_0x0ed2('0x1f')]||_0x0ed2('0x20');this['dialPrefix']=_0xc3252e[_0x0ed2('0x21')]||undefined;this[_0x0ed2('0x22')]=_0xc3252e[_0x0ed2('0x22')]||undefined;this[_0x0ed2('0x23')]=_0xc3252e[_0x0ed2('0x23')]||undefined;this['TrunkBackup']=_0xc3252e[_0x0ed2('0x24')]?_0xc3252e[_0x0ed2('0x24')]:undefined;this[_0x0ed2('0x25')]=_0xc3252e[_0x0ed2('0x25')]?_0xc3252e[_0x0ed2('0x25')]:undefined;this[_0x0ed2('0x26')]=_0xc3252e[_0x0ed2('0x26')]?_0xc3252e['Interval']:undefined;this[_0x0ed2('0x27')]=_0xc3252e[_0x0ed2('0x27')]?_0xc3252e[_0x0ed2('0x27')]:undefined;this[_0x0ed2('0x28')]=_0xc3252e[_0x0ed2('0x27')]?_0xc3252e[_0x0ed2('0x27')][_0x0ed2('0x0')]:undefined;this[_0x0ed2('0x29')]=_0xc3252e[_0x0ed2('0x29')]||![];this[_0x0ed2('0x2a')]=_0xc3252e[_0x0ed2('0x2a')];this['dialAMDGreeting']=_0xc3252e[_0x0ed2('0x2b')];this[_0x0ed2('0x2c')]=_0xc3252e['dialAMDAfterGreetingSilence'];this[_0x0ed2('0x2d')]=_0xc3252e[_0x0ed2('0x2d')];this[_0x0ed2('0x2e')]=_0xc3252e[_0x0ed2('0x2e')];this[_0x0ed2('0x2f')]=_0xc3252e[_0x0ed2('0x2f')];this['dialAMDMaximumNumberOfWords']=_0xc3252e[_0x0ed2('0x30')];this[_0x0ed2('0x31')]=_0xc3252e['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0xc3252e[_0x0ed2('0x32')];}module['exports']=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 7faa03a..03bd327 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 _0x4f2f=['calleridnum','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','exten','answered','answertime','endtime','unmanaged','lastapplication','lastdata','billableseconds','holdtime','type','tag','monitors','transfercalleridnum','transferType','mohtime','destinationchannel'];(function(_0x1dac7a,_0x1828ce){var _0x4cb363=function(_0x80f6de){while(--_0x80f6de){_0x1dac7a['push'](_0x1dac7a['shift']());}};_0x4cb363(++_0x1828ce);}(_0x4f2f,0x1cb));var _0xf4f2=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0x4f2f[_0xc67528];return _0x38e26d;};'use strict';function Channel(){this['starttime']=null;this['channel']='';this[_0xf4f2('0x0')]='';this[_0xf4f2('0x1')]=0x0;this['calleridname']='';this[_0xf4f2('0x2')]=undefined;this[_0xf4f2('0x3')]=undefined;this[_0xf4f2('0x4')]=0x0;this[_0xf4f2('0x5')]='';this[_0xf4f2('0x6')]=0x0;this[_0xf4f2('0x7')]=0x0;this[_0xf4f2('0x8')]=0x0;this[_0xf4f2('0x9')]=![];this[_0xf4f2('0xa')]=null;this[_0xf4f2('0xb')]=null;this[_0xf4f2('0xc')]=![];this['abandoned']=![];this[_0xf4f2('0xd')]='';this[_0xf4f2('0xe')]='';this['duration']=0x0;this[_0xf4f2('0xf')]=0x0;this[_0xf4f2('0x10')]=0x0;this[_0xf4f2('0x11')]=null;this[_0xf4f2('0x12')]=null;this['disposition']=null;this['monitor']=![];this['monitorFilename']=null;this['queue']=null;this[_0xf4f2('0x13')]=[];this[_0xf4f2('0x14')]=undefined;this['transferconnectedlinenum']=undefined;this[_0xf4f2('0x15')]=undefined;this[_0xf4f2('0x16')]=0x0;}module['exports']=Channel; \ No newline at end of file +var _0xa742=['calleridname','accountcode','uniqueid','linkedid','exten','answered','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','billableseconds','tag','disposition','monitor','monitorFilename','monitors','exports','calleridnum'];(function(_0x82d015,_0x523e8b){var _0x5c5851=function(_0x3f631a){while(--_0x3f631a){_0x82d015['push'](_0x82d015['shift']());}};_0x5c5851(++_0x523e8b);}(_0xa742,0xc7));var _0x2a74=function(_0x39b068,_0x2020eb){_0x39b068=_0x39b068-0x0;var _0x50d794=_0xa742[_0x39b068];return _0x50d794;};'use strict';function Channel(){this['starttime']=null;this['channel']='';this['destinationchannel']='';this[_0x2a74('0x0')]=0x0;this[_0x2a74('0x1')]='';this['connectedlinenum']=undefined;this['connectedlinename']=undefined;this[_0x2a74('0x2')]=0x0;this['context']='';this[_0x2a74('0x3')]=0x0;this[_0x2a74('0x4')]=0x0;this[_0x2a74('0x5')]=0x0;this[_0x2a74('0x6')]=![];this[_0x2a74('0x7')]=null;this[_0x2a74('0x8')]=null;this[_0x2a74('0x9')]=![];this[_0x2a74('0xa')]=![];this[_0x2a74('0xb')]='';this[_0x2a74('0xc')]='';this['duration']=0x0;this[_0x2a74('0xd')]=0x0;this['holdtime']=0x0;this['type']=null;this[_0x2a74('0xe')]=null;this[_0x2a74('0xf')]=null;this[_0x2a74('0x10')]=![];this[_0x2a74('0x11')]=null;this['queue']=null;this[_0x2a74('0x12')]=[];this['transfercalleridnum']=undefined;this['transferconnectedlinenum']=undefined;this['transferType']=undefined;this['mohtime']=0x0;}module[_0x2a74('0x13')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 892d5e7..8ecb999 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 _0x7b72=['Configurations','exports','name','username','remoteUri','authType','password','consumerSecret','token','tokenSecret','type','serverUrl'];(function(_0x307ba8,_0x12ccfc){var _0x13b523=function(_0x44f28c){while(--_0x44f28c){_0x307ba8['push'](_0x307ba8['shift']());}};_0x13b523(++_0x12ccfc);}(_0x7b72,0x146));var _0x27b7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7b72[_0x3dd15e];return _0x231fd0;};'use strict';function DeskAccount(_0x1b9480){this['id']=_0x1b9480['id']||0x0;this['name']=_0x1b9480[_0x27b7('0x0')]||'';this[_0x27b7('0x1')]=_0x1b9480['username']||'';this[_0x27b7('0x2')]=_0x1b9480[_0x27b7('0x2')]||'';this[_0x27b7('0x3')]=_0x1b9480[_0x27b7('0x3')]||'';this[_0x27b7('0x4')]=_0x1b9480[_0x27b7('0x4')]||'';this['consumerKey']=_0x1b9480['consumerKey']||'';this[_0x27b7('0x5')]=_0x1b9480['consumerSecret']||'';this[_0x27b7('0x6')]=_0x1b9480[_0x27b7('0x6')]||'';this[_0x27b7('0x7')]=_0x1b9480[_0x27b7('0x7')]||'';this[_0x27b7('0x8')]=_0x1b9480[_0x27b7('0x8')]||'';this[_0x27b7('0x9')]=_0x1b9480[_0x27b7('0x9')]||'';this['Configurations']=_0x1b9480[_0x27b7('0xa')]||{};}module[_0x27b7('0xb')]=DeskAccount; \ No newline at end of file +var _0x5256=['serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerSecret','token','type'];(function(_0x2cfbd2,_0x43cd76){var _0x2dccc8=function(_0x496926){while(--_0x496926){_0x2cfbd2['push'](_0x2cfbd2['shift']());}};_0x2dccc8(++_0x43cd76);}(_0x5256,0x1dc));var _0x6525=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x5256[_0x4fde08];return _0x12e725;};'use strict';function DeskAccount(_0x437772){this['id']=_0x437772['id']||0x0;this[_0x6525('0x0')]=_0x437772['name']||'';this[_0x6525('0x1')]=_0x437772[_0x6525('0x1')]||'';this[_0x6525('0x2')]=_0x437772[_0x6525('0x2')]||'';this[_0x6525('0x3')]=_0x437772[_0x6525('0x3')]||'';this[_0x6525('0x4')]=_0x437772['password']||'';this['consumerKey']=_0x437772['consumerKey']||'';this[_0x6525('0x5')]=_0x437772[_0x6525('0x5')]||'';this[_0x6525('0x6')]=_0x437772[_0x6525('0x6')]||'';this['tokenSecret']=_0x437772['tokenSecret']||'';this['type']=_0x437772[_0x6525('0x7')]||'';this['serverUrl']=_0x437772[_0x6525('0x8')]||'';this['Configurations']=_0x437772[_0x6525('0x9')]||{};}module[_0x6525('0xa')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 7a2aab0..c899a51 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 _0x5c00=['clientId','clientSecret','serverUrl','Configurations','name','username','password','remoteUri','tenantId'];(function(_0x2e8880,_0x1e6790){var _0x1e75dc=function(_0x32f001){while(--_0x32f001){_0x2e8880['push'](_0x2e8880['shift']());}};_0x1e75dc(++_0x1e6790);}(_0x5c00,0x17e));var _0x05c0=function(_0x23929d,_0x2d8984){_0x23929d=_0x23929d-0x0;var _0x52d817=_0x5c00[_0x23929d];return _0x52d817;};'use strict';function Dynamics365Account(_0x29fe0e){this['id']=_0x29fe0e['id']||0x0;this[_0x05c0('0x0')]=_0x29fe0e[_0x05c0('0x0')]||'';this['username']=_0x29fe0e[_0x05c0('0x1')]||'';this['password']=_0x29fe0e[_0x05c0('0x2')]||'';this[_0x05c0('0x3')]=_0x29fe0e[_0x05c0('0x3')]||'';this[_0x05c0('0x4')]=_0x29fe0e['tenantId']||'';this[_0x05c0('0x5')]=_0x29fe0e[_0x05c0('0x5')]||'';this[_0x05c0('0x6')]=_0x29fe0e[_0x05c0('0x6')]||{};this['serverUrl']=_0x29fe0e[_0x05c0('0x7')]||'';this[_0x05c0('0x8')]=_0x29fe0e[_0x05c0('0x8')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0xac4a=['clientId','clientSecret','serverUrl','Configurations','name','username','password','remoteUri','tenantId'];(function(_0x5ef37b,_0x166e27){var _0x2a10fa=function(_0x8ed29d){while(--_0x8ed29d){_0x5ef37b['push'](_0x5ef37b['shift']());}};_0x2a10fa(++_0x166e27);}(_0xac4a,0x13f));var _0xaac4=function(_0x156c84,_0x4abfbd){_0x156c84=_0x156c84-0x0;var _0x4df256=_0xac4a[_0x156c84];return _0x4df256;};'use strict';function Dynamics365Account(_0x5d2081){this['id']=_0x5d2081['id']||0x0;this[_0xaac4('0x0')]=_0x5d2081[_0xaac4('0x0')]||'';this[_0xaac4('0x1')]=_0x5d2081[_0xaac4('0x1')]||'';this[_0xaac4('0x2')]=_0x5d2081['password']||'';this['remoteUri']=_0x5d2081[_0xaac4('0x3')]||'';this[_0xaac4('0x4')]=_0x5d2081[_0xaac4('0x4')]||'';this['clientId']=_0x5d2081[_0xaac4('0x5')]||'';this['clientSecret']=_0x5d2081[_0xaac4('0x6')]||{};this['serverUrl']=_0x5d2081[_0xaac4('0x7')]||'';this[_0xaac4('0x8')]=_0x5d2081['Configurations']||{};}module['exports']=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index d3cb521..c109fe5 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 _0xfdb8=['faxdetect','t38timeout','SIP','Trunk','ListId','key','name','description','ecm','headerinfo','localstationid','minrate','v17,v27,v29','gateway'];(function(_0x44e78e,_0x5f2ba5){var _0xff1bb2=function(_0x1dc6a8){while(--_0x1dc6a8){_0x44e78e['push'](_0x44e78e['shift']());}};_0xff1bb2(++_0x5f2ba5);}(_0xfdb8,0x13a));var _0x8fdb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfdb8[_0x3dd15e];return _0x231fd0;};'use strict';function FaxAccount(_0x14aa78){this['id']=_0x14aa78['id']||0x0;this[_0x8fdb('0x0')]=_0x14aa78[_0x8fdb('0x0')]||'';this[_0x8fdb('0x1')]=_0x14aa78[_0x8fdb('0x1')];this[_0x8fdb('0x2')]=_0x14aa78[_0x8fdb('0x2')];this[_0x8fdb('0x3')]=_0x14aa78[_0x8fdb('0x3')];this[_0x8fdb('0x4')]=_0x14aa78['localstationid'];this[_0x8fdb('0x5')]=_0x14aa78[_0x8fdb('0x5')]||0x960;this['maxrate']=_0x14aa78['maxrate']||0x3840;this['modem']=_0x14aa78['modem']||_0x8fdb('0x6');this[_0x8fdb('0x7')]=_0x14aa78[_0x8fdb('0x7')]||'no';this[_0x8fdb('0x8')]=_0x14aa78['faxdetect']||'no';this['t38timeout']=_0x14aa78[_0x8fdb('0x9')]||0x1388;this['tech']=_0x14aa78['tech']||_0x8fdb('0xa');this['Trunk']=_0x14aa78['Trunk']?_0x14aa78[_0x8fdb('0xb')]:undefined;this['ListId']=_0x14aa78[_0x8fdb('0xc')];this[_0x8fdb('0xd')]=_0x14aa78['key'];}module['exports']=FaxAccount; \ No newline at end of file +var _0xfe5f=['faxdetect','t38timeout','tech','Trunk','ListId','key','exports','description','ecm','headerinfo','minrate','maxrate','modem','gateway'];(function(_0x21d2a6,_0x44c6cc){var _0x3a5b9f=function(_0x49353f){while(--_0x49353f){_0x21d2a6['push'](_0x21d2a6['shift']());}};_0x3a5b9f(++_0x44c6cc);}(_0xfe5f,0x173));var _0xffe5=function(_0x366ef5,_0x2315be){_0x366ef5=_0x366ef5-0x0;var _0xa5b318=_0xfe5f[_0x366ef5];return _0xa5b318;};'use strict';function FaxAccount(_0x26e7a3){this['id']=_0x26e7a3['id']||0x0;this['name']=_0x26e7a3['name']||'';this['description']=_0x26e7a3[_0xffe5('0x0')];this[_0xffe5('0x1')]=_0x26e7a3['ecm'];this[_0xffe5('0x2')]=_0x26e7a3[_0xffe5('0x2')];this['localstationid']=_0x26e7a3['localstationid'];this[_0xffe5('0x3')]=_0x26e7a3[_0xffe5('0x3')]||0x960;this[_0xffe5('0x4')]=_0x26e7a3[_0xffe5('0x4')]||0x3840;this[_0xffe5('0x5')]=_0x26e7a3['modem']||'v17,v27,v29';this[_0xffe5('0x6')]=_0x26e7a3[_0xffe5('0x6')]||'no';this[_0xffe5('0x7')]=_0x26e7a3['faxdetect']||'no';this[_0xffe5('0x8')]=_0x26e7a3[_0xffe5('0x8')]||0x1388;this[_0xffe5('0x9')]=_0x26e7a3[_0xffe5('0x9')]||'SIP';this[_0xffe5('0xa')]=_0x26e7a3['Trunk']?_0x26e7a3[_0xffe5('0xa')]:undefined;this[_0xffe5('0xb')]=_0x26e7a3[_0xffe5('0xb')];this[_0xffe5('0xc')]=_0x26e7a3['key'];}module[_0xffe5('0xd')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index b7935bb..f94f3ca 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 _0xede2=['remoteUri','serverUrl','Configurations','username','apiKey'];(function(_0xe3e8f2,_0x5ab367){var _0xa22585=function(_0x57c975){while(--_0x57c975){_0xe3e8f2['push'](_0xe3e8f2['shift']());}};_0xa22585(++_0x5ab367);}(_0xede2,0x8f));var _0x2ede=function(_0x433b08,_0xd2aa1d){_0x433b08=_0x433b08-0x0;var _0x6e1221=_0xede2[_0x433b08];return _0x6e1221;};'use strict';function FreshdeskAccount(_0x2e74c8){this['id']=_0x2e74c8['id']||0x0;this['name']=_0x2e74c8['name']||'';this['username']=_0x2e74c8[_0x2ede('0x0')]||'';this[_0x2ede('0x1')]=_0x2e74c8['token']||'';this['remoteUri']=_0x2e74c8[_0x2ede('0x2')]||'';this['serverUrl']=_0x2e74c8[_0x2ede('0x3')]||'';this[_0x2ede('0x4')]=_0x2e74c8[_0x2ede('0x4')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0xe1f1=['Configurations','exports','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x142e18,_0x4c10b1){var _0x417418=function(_0x14fd72){while(--_0x14fd72){_0x142e18['push'](_0x142e18['shift']());}};_0x417418(++_0x4c10b1);}(_0xe1f1,0x112));var _0x1e1f=function(_0x30bebc,_0x51dc2e){_0x30bebc=_0x30bebc-0x0;var _0x23b499=_0xe1f1[_0x30bebc];return _0x23b499;};'use strict';function FreshdeskAccount(_0x5c143e){this['id']=_0x5c143e['id']||0x0;this[_0x1e1f('0x0')]=_0x5c143e[_0x1e1f('0x0')]||'';this[_0x1e1f('0x1')]=_0x5c143e[_0x1e1f('0x1')]||'';this[_0x1e1f('0x2')]=_0x5c143e[_0x1e1f('0x3')]||'';this[_0x1e1f('0x4')]=_0x5c143e[_0x1e1f('0x4')]||'';this['serverUrl']=_0x5c143e[_0x1e1f('0x5')]||'';this[_0x1e1f('0x6')]=_0x5c143e[_0x1e1f('0x6')]||{};}module[_0x1e1f('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 552f83c..4210ee8 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 _0x885a=['username','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x4e6fb2,_0x3cf23e){var _0x2f1636=function(_0x53c7eb){while(--_0x53c7eb){_0x4e6fb2['push'](_0x4e6fb2['shift']());}};_0x2f1636(++_0x3cf23e);}(_0x885a,0x180));var _0xa885=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x885a[_0x413feb];return _0x40ee88;};'use strict';function FreshsalesAccount(_0x30ab1d){this['id']=_0x30ab1d['id']||0x0;this[_0xa885('0x0')]=_0x30ab1d[_0xa885('0x0')]||'';this[_0xa885('0x1')]=_0x30ab1d[_0xa885('0x1')]||'';this['apiKey']=_0x30ab1d[_0xa885('0x2')]||'';this[_0xa885('0x3')]=_0x30ab1d[_0xa885('0x3')]||'';this[_0xa885('0x4')]=_0x30ab1d[_0xa885('0x4')]||'';this[_0xa885('0x5')]=_0x30ab1d['Configurations']||{};}module[_0xa885('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0x565f=['username','apiKey','token','remoteUri','serverUrl','exports','name'];(function(_0x139b85,_0x5e0691){var _0x1e833f=function(_0xc97932){while(--_0xc97932){_0x139b85['push'](_0x139b85['shift']());}};_0x1e833f(++_0x5e0691);}(_0x565f,0x68));var _0xf565=function(_0x4f0d3e,_0x3fee4b){_0x4f0d3e=_0x4f0d3e-0x0;var _0x4436e5=_0x565f[_0x4f0d3e];return _0x4436e5;};'use strict';function FreshsalesAccount(_0x4f81e0){this['id']=_0x4f81e0['id']||0x0;this[_0xf565('0x0')]=_0x4f81e0[_0xf565('0x0')]||'';this[_0xf565('0x1')]=_0x4f81e0['username']||'';this[_0xf565('0x2')]=_0x4f81e0[_0xf565('0x3')]||'';this[_0xf565('0x4')]=_0x4f81e0[_0xf565('0x4')]||'';this[_0xf565('0x5')]=_0x4f81e0['serverUrl']||'';this['Configurations']=_0x4f81e0['Configurations']||{};}module[_0xf565('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 b14a127..834a627 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 _0xc600=['queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','context','exten','holdtime','assigned','lastAssignedTo','mohtime','variables','exports','inbound','uniqueid','calleridname','queue','queuecallerjoinAt','position','count'];(function(_0x53a318,_0x2c3d8d){var _0x249db4=function(_0x29cd49){while(--_0x29cd49){_0x53a318['push'](_0x53a318['shift']());}};_0x249db4(++_0x2c3d8d);}(_0xc600,0x131));var _0x0c60=function(_0x516e3f,_0x3573d8){_0x516e3f=_0x516e3f-0x0;var _0x1525b2=_0xc600[_0x516e3f];return _0x1525b2;};'use strict';function QueueReport(){this['type']=_0x0c60('0x0');this[_0x0c60('0x1')]='';this['calleridnum']='';this[_0x0c60('0x2')]='';this[_0x0c60('0x3')]='';this[_0x0c60('0x4')]=null;this['queuecallerleaveAt']=null;this[_0x0c60('0x5')]=0x1;this[_0x0c60('0x6')]=0x1;this[_0x0c60('0x7')]=![];this[_0x0c60('0x8')]=null;this[_0x0c60('0x9')]=![];this['queuecallercompleteAt']=null;this[_0x0c60('0xa')]=![];this[_0x0c60('0xb')]=null;this[_0x0c60('0xc')]=0x1;this[_0x0c60('0xd')]='';this[_0x0c60('0xe')]='';this[_0x0c60('0xf')]='';this['accountcode']='';this[_0x0c60('0x10')]='';this[_0x0c60('0x11')]='';this['priority']='';this[_0x0c60('0x12')]=0x0;this[_0x0c60('0x13')]=![];this[_0x0c60('0x14')]='';this[_0x0c60('0x15')]=0x0;this[_0x0c60('0x16')]={};}module[_0x0c60('0x17')]=QueueReport; \ No newline at end of file +var _0x6463=['exten','priority','holdtime','assigned','lastAssignedTo','mohtime','exports','inbound','uniqueid','calleridnum','calleridname','queuecallerjoinAt','position','count','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','originalposition','channel','connectedlinename','accountcode','context'];(function(_0x4e1a49,_0x4da738){var _0x136aae=function(_0x3ffd93){while(--_0x3ffd93){_0x4e1a49['push'](_0x4e1a49['shift']());}};_0x136aae(++_0x4da738);}(_0x6463,0xb7));var _0x3646=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6463[_0x3dd15e];return _0x231fd0;};'use strict';function QueueReport(){this['type']=_0x3646('0x0');this[_0x3646('0x1')]='';this[_0x3646('0x2')]='';this[_0x3646('0x3')]='';this['queue']='';this[_0x3646('0x4')]=null;this['queuecallerleaveAt']=null;this[_0x3646('0x5')]=0x1;this[_0x3646('0x6')]=0x1;this[_0x3646('0x7')]=![];this['queuecallerabandonAt']=null;this[_0x3646('0x8')]=![];this[_0x3646('0x9')]=null;this['queuecallerexit']=![];this['queuecallerexitAt']=null;this[_0x3646('0xa')]=0x1;this[_0x3646('0xb')]='';this['connectedlinenum']='';this[_0x3646('0xc')]='';this[_0x3646('0xd')]='';this[_0x3646('0xe')]='';this[_0x3646('0xf')]='';this[_0x3646('0x10')]='';this[_0x3646('0x11')]=0x0;this[_0x3646('0x12')]=![];this[_0x3646('0x13')]='';this[_0x3646('0x14')]=0x0;this['variables']={};}module[_0x3646('0x15')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 6d6805f..94b15cb 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 _0xd4bf=['type','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0xd4bf,0x1b1));var _0xfd4b=function(_0x2f0a84,_0x462775){_0x2f0a84=_0x2f0a84-0x0;var _0x124901=_0xd4bf[_0x2f0a84];return _0x124901;};'use strict';function SalesforceAccount(_0x48ad74){this['id']=_0x48ad74['id']||0x0;this[_0xfd4b('0x0')]=_0x48ad74[_0xfd4b('0x0')]||'';this['username']=_0x48ad74[_0xfd4b('0x1')]||'';this[_0xfd4b('0x2')]=_0x48ad74['remoteUri']||'';this[_0xfd4b('0x3')]=_0x48ad74[_0xfd4b('0x3')]||'';this[_0xfd4b('0x4')]=_0x48ad74['clientId']||'';this[_0xfd4b('0x5')]=_0x48ad74['clientSecret']||'';this[_0xfd4b('0x6')]=_0x48ad74[_0xfd4b('0x6')]||'';this[_0xfd4b('0x7')]=_0x48ad74[_0xfd4b('0x7')]||'integrationTab';this[_0xfd4b('0x8')]=_0x48ad74['serverUrl']||'';this[_0xfd4b('0x9')]=_0x48ad74[_0xfd4b('0x9')]||{};}module[_0xfd4b('0xa')]=SalesforceAccount; \ No newline at end of file +var _0xf0f1=['password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','name','username','remoteUri'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xf0f1,0x110));var _0x1f0f=function(_0x483102,_0x54e93d){_0x483102=_0x483102-0x0;var _0x5cc885=_0xf0f1[_0x483102];return _0x5cc885;};'use strict';function SalesforceAccount(_0x325b29){this['id']=_0x325b29['id']||0x0;this[_0x1f0f('0x0')]=_0x325b29[_0x1f0f('0x0')]||'';this[_0x1f0f('0x1')]=_0x325b29['username']||'';this['remoteUri']=_0x325b29[_0x1f0f('0x2')]||'';this['password']=_0x325b29[_0x1f0f('0x3')]||'';this['clientId']=_0x325b29[_0x1f0f('0x4')]||'';this[_0x1f0f('0x5')]=_0x325b29[_0x1f0f('0x5')]||'';this['securityToken']=_0x325b29[_0x1f0f('0x6')]||'';this[_0x1f0f('0x7')]=_0x325b29[_0x1f0f('0x7')]||_0x1f0f('0x8');this[_0x1f0f('0x9')]=_0x325b29[_0x1f0f('0x9')]||'';this[_0x1f0f('0xa')]=_0x325b29['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 998a388..e70e96e 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 _0x2db7=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2db7,0x127));var _0x72db=function(_0x4e81fb,_0x23fe7e){_0x4e81fb=_0x4e81fb-0x0;var _0x304dc7=_0x2db7[_0x4e81fb];return _0x304dc7;};'use strict';function ServicenowAccount(_0x10324c){this['id']=_0x10324c['id']||0x0;this['name']=_0x10324c[_0x72db('0x0')]||'';this['username']=_0x10324c[_0x72db('0x1')]||'';this[_0x72db('0x2')]=_0x10324c[_0x72db('0x2')]||'';this[_0x72db('0x3')]=_0x10324c[_0x72db('0x3')]||'';this[_0x72db('0x4')]=_0x10324c[_0x72db('0x4')]||'';this[_0x72db('0x5')]=_0x10324c[_0x72db('0x5')]||{};}module[_0x72db('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x8d9a=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x49ebe9,_0x1856c0){var _0x2fdabf=function(_0x3ac6b1){while(--_0x3ac6b1){_0x49ebe9['push'](_0x49ebe9['shift']());}};_0x2fdabf(++_0x1856c0);}(_0x8d9a,0xd4));var _0xa8d9=function(_0x33943a,_0x420a9c){_0x33943a=_0x33943a-0x0;var _0x48d707=_0x8d9a[_0x33943a];return _0x48d707;};'use strict';function ServicenowAccount(_0x296ab0){this['id']=_0x296ab0['id']||0x0;this[_0xa8d9('0x0')]=_0x296ab0['name']||'';this[_0xa8d9('0x1')]=_0x296ab0[_0xa8d9('0x1')]||'';this['password']=_0x296ab0[_0xa8d9('0x2')]||'';this[_0xa8d9('0x3')]=_0x296ab0[_0xa8d9('0x3')]||'';this[_0xa8d9('0x4')]=_0x296ab0['serverUrl']||'';this[_0xa8d9('0x5')]=_0x296ab0[_0xa8d9('0x5')]||{};}module[_0xa8d9('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 d660365..5395caa 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 _0x2d44=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x34892f,_0x115ee6){var _0x107185=function(_0x196ec7){while(--_0x196ec7){_0x34892f['push'](_0x34892f['shift']());}};_0x107185(++_0x115ee6);}(_0x2d44,0xd7));var _0x42d4=function(_0x39f607,_0x32a99e){_0x39f607=_0x39f607-0x0;var _0x496f2d=_0x2d44[_0x39f607];return _0x496f2d;};'use strict';function SugarcrmAccount(_0x2394d5){this['id']=_0x2394d5['id']||0x0;this[_0x42d4('0x0')]=_0x2394d5['name']||'';this[_0x42d4('0x1')]=_0x2394d5[_0x42d4('0x1')]||'';this['password']=_0x2394d5[_0x42d4('0x2')]||'';this[_0x42d4('0x3')]=_0x2394d5['remoteUri']||'';this[_0x42d4('0x4')]=_0x2394d5[_0x42d4('0x4')]||'';this[_0x42d4('0x5')]=_0x2394d5[_0x42d4('0x5')]||{};}module[_0x42d4('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0xb9a7=['name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x4d21ff,_0x19d202){var _0x22b554=function(_0x4473c5){while(--_0x4473c5){_0x4d21ff['push'](_0x4d21ff['shift']());}};_0x22b554(++_0x19d202);}(_0xb9a7,0x66));var _0x7b9a=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xb9a7[_0x36c5b0];return _0xf19333;};'use strict';function SugarcrmAccount(_0x3b47c5){this['id']=_0x3b47c5['id']||0x0;this[_0x7b9a('0x0')]=_0x3b47c5[_0x7b9a('0x0')]||'';this[_0x7b9a('0x1')]=_0x3b47c5[_0x7b9a('0x1')]||'';this[_0x7b9a('0x2')]=_0x3b47c5[_0x7b9a('0x2')]||'';this[_0x7b9a('0x3')]=_0x3b47c5[_0x7b9a('0x3')]||'';this[_0x7b9a('0x4')]=_0x3b47c5[_0x7b9a('0x4')]||'';this[_0x7b9a('0x5')]=_0x3b47c5[_0x7b9a('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 77995af..43747c2 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 _0x4a5b=['unknown','stateTime','address','exports','name','accountcode'];(function(_0x3ea79f,_0x48176a){var _0x4096d3=function(_0x171055){while(--_0x171055){_0x3ea79f['push'](_0x3ea79f['shift']());}};_0x4096d3(++_0x48176a);}(_0x4a5b,0xe8));var _0xb4a5=function(_0x5016f3,_0x3d4ecb){_0x5016f3=_0x5016f3-0x0;var _0x5bae1d=_0x4a5b[_0x5016f3];return _0x5bae1d;};'use strict';function Telephone(_0x5a82aa){this['id']=_0x5a82aa['id']||0x0;this[_0xb4a5('0x0')]=_0x5a82aa[_0xb4a5('0x0')]||'';this[_0xb4a5('0x1')]=_0x5a82aa[_0xb4a5('0x1')]||'';this['state']=_0xb4a5('0x2');this[_0xb4a5('0x3')]=0x0;this['status']='unknown';this[_0xb4a5('0x4')]='';}module[_0xb4a5('0x5')]=Telephone; \ No newline at end of file +var _0xaf1d=['state','unknown','status','address','exports','name','accountcode'];(function(_0x2939ca,_0x244f7e){var _0x4bf440=function(_0x564d48){while(--_0x564d48){_0x2939ca['push'](_0x2939ca['shift']());}};_0x4bf440(++_0x244f7e);}(_0xaf1d,0x9f));var _0xdaf1=function(_0xec458a,_0x5eeb0c){_0xec458a=_0xec458a-0x0;var _0x5a54b3=_0xaf1d[_0xec458a];return _0x5a54b3;};'use strict';function Telephone(_0x36c863){this['id']=_0x36c863['id']||0x0;this[_0xdaf1('0x0')]=_0x36c863[_0xdaf1('0x0')]||'';this[_0xdaf1('0x1')]=_0x36c863['accountcode']||'';this[_0xdaf1('0x2')]=_0xdaf1('0x3');this['stateTime']=0x0;this[_0xdaf1('0x4')]=_0xdaf1('0x3');this[_0xdaf1('0x5')]='';}module[_0xdaf1('0x6')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 089ed09..f54e3ef 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['exports','name'];(function(_0x5908e1,_0x570799){var _0x47bffa=function(_0x4eea49){while(--_0x4eea49){_0x5908e1['push'](_0x5908e1['shift']());}};_0x47bffa(++_0x570799);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xb10b=['name','html'];(function(_0x3bb38a,_0x1e7163){var _0xc2952d=function(_0x350b31){while(--_0x350b31){_0x3bb38a['push'](_0x3bb38a['shift']());}};_0xc2952d(++_0x1e7163);}(_0xb10b,0x12a));var _0xbb10=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0xb10b[_0x4fde08];return _0x12e725;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 744536e..95e6283 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 _0xb7e7=['Actions','exports','name','channel','status','AllConditions','AnyConditions'];(function(_0x9ae07c,_0x4cba11){var _0x837b1f=function(_0x4f30a7){while(--_0x4f30a7){_0x9ae07c['push'](_0x9ae07c['shift']());}};_0x837b1f(++_0x4cba11);}(_0xb7e7,0x121));var _0x7b7e=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xb7e7[_0x3ab9ee];return _0x82ee88;};'use strict';function Trigger(_0x2e5e07){this['id']=_0x2e5e07['id']||0x0;this['name']=_0x2e5e07[_0x7b7e('0x0')]||'';this['channel']=_0x2e5e07[_0x7b7e('0x1')]||'voice';this[_0x7b7e('0x2')]=_0x2e5e07['status']||![];this[_0x7b7e('0x3')]=_0x2e5e07[_0x7b7e('0x3')]||[];this[_0x7b7e('0x4')]=_0x2e5e07['AnyConditions']||[];this['Actions']=_0x2e5e07[_0x7b7e('0x5')]||[];}module[_0x7b7e('0x6')]=Trigger; \ No newline at end of file +var _0xda3f=['Actions','name','status','AllConditions','AnyConditions'];(function(_0x21cfc7,_0x8bb2b7){var _0x51bb17=function(_0x5dbddd){while(--_0x5dbddd){_0x21cfc7['push'](_0x21cfc7['shift']());}};_0x51bb17(++_0x8bb2b7);}(_0xda3f,0xec));var _0xfda3=function(_0x38b26e,_0x11cbb0){_0x38b26e=_0x38b26e-0x0;var _0x39eb19=_0xda3f[_0x38b26e];return _0x39eb19;};'use strict';function Trigger(_0x33f0ce){this['id']=_0x33f0ce['id']||0x0;this[_0xfda3('0x0')]=_0x33f0ce[_0xfda3('0x0')]||'';this['channel']=_0x33f0ce['channel']||'voice';this[_0xfda3('0x1')]=_0x33f0ce['status']||![];this[_0xfda3('0x2')]=_0x33f0ce[_0xfda3('0x2')]||[];this['AnyConditions']=_0x33f0ce[_0xfda3('0x3')]||[];this[_0xfda3('0x4')]=_0x33f0ce['Actions']||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index a3e3eb8..20ba8cf 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 _0xd93c=['active','name','state','unknown','stateTime','status','registry','split','host','refresh','stateRegistry','registrationtime','address','defaultuser','exports'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0xd93c,0x69));var _0xcd93=function(_0x7173e2,_0x42551c){_0x7173e2=_0x7173e2-0x0;var _0x3d812f=_0xd93c[_0x7173e2];return _0x3d812f;};'use strict';function Trunk(_0x28be3d){this['id']=_0x28be3d['id']||0x0;this[_0xcd93('0x0')]=_0x28be3d['active']||![];this[_0xcd93('0x1')]=_0x28be3d[_0xcd93('0x1')]||'';this[_0xcd93('0x2')]=_0xcd93('0x3');this[_0xcd93('0x4')]=0x0;this[_0xcd93('0x5')]=_0xcd93('0x3');this[_0xcd93('0x6')]=_0x28be3d[_0xcd93('0x6')]&&_0x28be3d['registry']['indexOf'](':')?_0x28be3d[_0xcd93('0x6')][_0xcd93('0x7')](':')[0x0]:'';this[_0xcd93('0x8')]='';this['port']='';this['domain']='';this['domainport']='';this[_0xcd93('0x9')]='';this[_0xcd93('0xa')]=_0xcd93('0x3');this[_0xcd93('0xb')]='';this[_0xcd93('0xc')]='';this[_0xcd93('0xd')]=_0x28be3d['defaultuser']||'';}module[_0xcd93('0xe')]=Trunk; \ No newline at end of file +var _0xca02=['address','defaultuser','exports','active','name','unknown','status','registry','indexOf','split','host','domain','refresh','stateRegistry','registrationtime'];(function(_0x4db1df,_0x26d2a2){var _0x140232=function(_0x1a783b){while(--_0x1a783b){_0x4db1df['push'](_0x4db1df['shift']());}};_0x140232(++_0x26d2a2);}(_0xca02,0x1d4));var _0x2ca0=function(_0x31e665,_0x44fa3f){_0x31e665=_0x31e665-0x0;var _0x3d258a=_0xca02[_0x31e665];return _0x3d258a;};'use strict';function Trunk(_0x207f54){this['id']=_0x207f54['id']||0x0;this[_0x2ca0('0x0')]=_0x207f54[_0x2ca0('0x0')]||![];this[_0x2ca0('0x1')]=_0x207f54['name']||'';this['state']=_0x2ca0('0x2');this['stateTime']=0x0;this[_0x2ca0('0x3')]=_0x2ca0('0x2');this[_0x2ca0('0x4')]=_0x207f54[_0x2ca0('0x4')]&&_0x207f54['registry'][_0x2ca0('0x5')](':')?_0x207f54[_0x2ca0('0x4')][_0x2ca0('0x6')](':')[0x0]:'';this[_0x2ca0('0x7')]='';this['port']='';this[_0x2ca0('0x8')]='';this['domainport']='';this[_0x2ca0('0x9')]='';this[_0x2ca0('0xa')]=_0x2ca0('0x2');this[_0x2ca0('0xb')]='';this[_0x2ca0('0xc')]='';this[_0x2ca0('0xd')]=_0x207f54[_0x2ca0('0xd')]||'';}module[_0x2ca0('0xe')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 488ca0c..5fd4c45 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 _0xc07a=['exports','exten','recordingFormat','mandatoryDisposition'];(function(_0x35e06d,_0xad434c){var _0x1b7a39=function(_0x40efcb){while(--_0x40efcb){_0x35e06d['push'](_0x35e06d['shift']());}};_0x1b7a39(++_0xad434c);}(_0xc07a,0x1d9));var _0xac07=function(_0x403833,_0x2b4869){_0x403833=_0x403833-0x0;var _0x1e659a=_0xc07a[_0x403833];return _0x1e659a;};'use strict';function voiceExtension(_0x397423){this['id']=_0x397423['id']||0x0;this[_0xac07('0x0')]=_0x397423[_0xac07('0x0')]||'';this[_0xac07('0x1')]=_0x397423[_0xac07('0x1')]||'none';this[_0xac07('0x2')]=_0x397423[_0xac07('0x2')]||![];}module[_0xac07('0x3')]=voiceExtension; \ No newline at end of file +var _0xc0f8=['recordingFormat','mandatoryDisposition','exten'];(function(_0x1fcc5a,_0x4b2dcf){var _0x4612ba=function(_0x860ea){while(--_0x860ea){_0x1fcc5a['push'](_0x1fcc5a['shift']());}};_0x4612ba(++_0x4b2dcf);}(_0xc0f8,0xad));var _0x8c0f=function(_0x2f8807,_0x280d1b){_0x2f8807=_0x2f8807-0x0;var _0x5635d1=_0xc0f8[_0x2f8807];return _0x5635d1;};'use strict';function voiceExtension(_0x1f6e48){this['id']=_0x1f6e48['id']||0x0;this['exten']=_0x1f6e48[_0x8c0f('0x0')]||'';this[_0x8c0f('0x1')]=_0x1f6e48[_0x8c0f('0x1')]||'none';this[_0x8c0f('0x2')]=_0x1f6e48[_0x8c0f('0x2')]||![];}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 04f7742..2a537cc 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 _0x14a0=['startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDispositionPause','exports','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','wav49','gsm','rrmemory','name','monitor_format','type','answered','sumHoldTime','sumBillable','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay'];(function(_0x2b3f81,_0x2d75a4){var _0x15ccff=function(_0x1738f0){while(--_0x1738f0){_0x2b3f81['push'](_0x2b3f81['shift']());}};_0x15ccff(++_0x2d75a4);}(_0x14a0,0x8e));var _0x014a=function(_0x3ace3d,_0x371b58){_0x3ace3d=_0x3ace3d-0x0;var _0x490103=_0x14a0[_0x3ace3d];return _0x490103;};'use strict';var statusDesc=['unknown',_0x014a('0x0'),_0x014a('0x1'),_0x014a('0x2'),_0x014a('0x3'),_0x014a('0x4'),_0x014a('0x5'),_0x014a('0x6'),'onhold'];var monitorFormat={'wav':'wav','wav49':_0x014a('0x7'),'gsm':_0x014a('0x8')};var strategy={'rrmemory':_0x014a('0x9'),'roundrobin':'roundrobin'};function VoiceQueue(_0x5a61ac){this['id']=_0x5a61ac['id']||0x0;this[_0x014a('0xa')]=_0x5a61ac[_0x014a('0xa')]||'';this[_0x014a('0xb')]=_0x5a61ac['monitor_format']||'';this['type']=_0x5a61ac[_0x014a('0xc')]||'inbound';this['waiting']=0x0;this['talking']=0x0;this['total']=0x0;this[_0x014a('0xd')]=0x0;this['sumDuration']=0x0;this[_0x014a('0xe')]=0x0;this[_0x014a('0xf')]=0x0;this['unmanaged']=0x0;this[_0x014a('0x10')]=0x0;this[_0x014a('0x11')]=0x0;this[_0x014a('0x12')]=0x0;this[_0x014a('0x13')]=_0x5a61ac[_0x014a('0x13')]||![];this[_0x014a('0x14')]=_0x5a61ac[_0x014a('0x14')]||0xa;this[_0x014a('0x15')]=_0x5a61ac[_0x014a('0x15')]||'no';this[_0x014a('0x16')]=!![];this[_0x014a('0x17')]='';this[_0x014a('0x18')]=0x0;this['temp']=0x0;this[_0x014a('0x19')]=_0x5a61ac[_0x014a('0x19')]||null;this['dialGlobalInterval']=_0x5a61ac[_0x014a('0x1a')]?_0x5a61ac[_0x014a('0x1a')]:null;this['dialActive']=_0x5a61ac[_0x014a('0x1b')];this[_0x014a('0x1c')]=_0x5a61ac[_0x014a('0x1c')]||_0x014a('0x1d');this[_0x014a('0x1e')]=_0x5a61ac[_0x014a('0x1e')]||0x0;this[_0x014a('0x1f')]=_0x5a61ac[_0x014a('0x1f')]||0x0;this[_0x014a('0x20')]=_0x5a61ac[_0x014a('0x20')]||0x1;this[_0x014a('0x21')]=_0x5a61ac[_0x014a('0x21')]||_0x014a('0x22');this[_0x014a('0x23')]=_0x5a61ac['dialPredictiveOptimizationPercentage']||0.03;this[_0x014a('0x24')]=_0x5a61ac[_0x014a('0x24')]||0x258;this[_0x014a('0x25')]=_0x5a61ac[_0x014a('0x25')]||_0x014a('0x26');this[_0x014a('0x27')]=_0x5a61ac[_0x014a('0x27')]||_0x014a('0x26');this[_0x014a('0x28')]=_0x5a61ac['dialOriginateTimeout']||0x1e;this[_0x014a('0x29')]=_0x5a61ac['dialQueueOptions']||_0x014a('0x2a');this[_0x014a('0x2b')]=_0x5a61ac[_0x014a('0x2b')]||0x3;this[_0x014a('0x2c')]=_0x5a61ac[_0x014a('0x2c')]||undefined;this[_0x014a('0x2d')]=_0x5a61ac[_0x014a('0x2d')]||0x3;this[_0x014a('0x2e')]=_0x5a61ac[_0x014a('0x2e')]||0x96;this['dialBusyMaxRetry']=_0x5a61ac[_0x014a('0x2f')]||0x3;this['dialBusyRetryFrequency']=_0x5a61ac[_0x014a('0x30')]||0x96;this[_0x014a('0x31')]=_0x5a61ac['dialNoAnswerMaxRetry']||0x3;this['dialNoAnswerRetryFrequency']=_0x5a61ac[_0x014a('0x32')]||0x96;this[_0x014a('0x33')]=_0x5a61ac[_0x014a('0x33')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x5a61ac[_0x014a('0x34')]||0x96;this[_0x014a('0x35')]=_0x5a61ac['dialDropMaxRetry']||0x3;this[_0x014a('0x36')]=_0x5a61ac[_0x014a('0x36')]||0x96;this['dialAbandonedMaxRetry']=_0x5a61ac['dialAbandonedMaxRetry']||0x3;this[_0x014a('0x37')]=_0x5a61ac[_0x014a('0x37')]||0x96;this[_0x014a('0x38')]=_0x5a61ac[_0x014a('0x38')]||0x3;this['dialMachineRetryFrequency']=_0x5a61ac[_0x014a('0x39')]||0x96;this[_0x014a('0x3a')]=_0x5a61ac[_0x014a('0x3a')]||0x3;this[_0x014a('0x3b')]=_0x5a61ac[_0x014a('0x3b')]||0x96;this[_0x014a('0x3c')]=_0x5a61ac[_0x014a('0x3c')]||0x4;this[_0x014a('0x3d')]=_0x5a61ac[_0x014a('0x3d')]?_0x5a61ac[_0x014a('0x3d')]:undefined;this[_0x014a('0x3e')]=_0x5a61ac['TrunkBackup']?_0x5a61ac[_0x014a('0x3e')]:undefined;this[_0x014a('0x3f')]=_0x5a61ac[_0x014a('0x3f')]||undefined;this[_0x014a('0x40')]=_0x5a61ac[_0x014a('0x40')]?_0x5a61ac[_0x014a('0x40')]:undefined;this[_0x014a('0x41')]=_0x5a61ac['dialOrderByScheduledAt']||_0x014a('0x42');this[_0x014a('0x43')]=_0x5a61ac['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x014a('0x44')]=_0x5a61ac[_0x014a('0x44')]||undefined;this[_0x014a('0x45')]=strategy[_0x5a61ac[_0x014a('0x45')]]||_0x014a('0x9');this[_0x014a('0x46')]=!![];this[_0x014a('0x47')]=_0x5a61ac[_0x014a('0x47')]||![];this['dialAMDInitialSilence']=_0x5a61ac[_0x014a('0x48')];this[_0x014a('0x49')]=_0x5a61ac[_0x014a('0x49')];this[_0x014a('0x4a')]=_0x5a61ac['dialAMDAfterGreetingSilence'];this[_0x014a('0x4b')]=_0x5a61ac[_0x014a('0x4b')];this[_0x014a('0x4c')]=_0x5a61ac[_0x014a('0x4c')];this[_0x014a('0x4d')]=_0x5a61ac[_0x014a('0x4d')];this[_0x014a('0x4e')]=_0x5a61ac[_0x014a('0x4e')];this[_0x014a('0x4f')]=_0x5a61ac['dialAMDSilenceThreshold'];this[_0x014a('0x50')]=_0x5a61ac['dialAMDMaximumWordLength'];this[_0x014a('0x51')]=0x0;this[_0x014a('0x52')]=0x0;this[_0x014a('0x53')]=_0x5a61ac[_0x014a('0x53')];this[_0x014a('0x54')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x014a('0x55')]=0x0;this[_0x014a('0x56')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x014a('0x57')]=0x0;this[_0x014a('0x58')]=0x0;this[_0x014a('0x59')]=0x0;this[_0x014a('0x5a')]=0x0;this[_0x014a('0x5b')]=0x0;this[_0x014a('0x5c')]=0x0;this[_0x014a('0x5d')]=0x0;this[_0x014a('0x5e')]=0x0;this[_0x014a('0x5f')]=0x0;this['startProgressive']=undefined;this[_0x014a('0x60')]=undefined;this[_0x014a('0x61')]=undefined;this[_0x014a('0x62')]=1.05;this[_0x014a('0x63')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x014a('0x64')]=0x0;this[_0x014a('0x65')]=0x0;this[_0x014a('0x66')]=0x0;this[_0x014a('0x67')]=0x0;this[_0x014a('0x68')]=0x0;this[_0x014a('0x69')]=0x0;this['predictiveIntervalMaxThreshold']=_0x5a61ac[_0x014a('0x6a')]||0x14;this[_0x014a('0x6b')]=_0x5a61ac['dialPredictiveIntervalMaxThreshold']||0xa;this[_0x014a('0x6c')]=0x0;this[_0x014a('0x6d')]=0x0;this[_0x014a('0x6e')]=0x1;this['erlangCalls']=0x0;this[_0x014a('0x6f')]=0x0;this['erlangAbandonmentRate']=0x0;this['erlangBusyFactor']=0x0;this[_0x014a('0x70')]=_0x5a61ac[_0x014a('0x70')]||0x1e;this['dialRecallInQueue']=_0x5a61ac[_0x014a('0x71')]||![];this[_0x014a('0x72')]=_0x5a61ac[_0x014a('0x72')]||undefined;this[_0x014a('0x73')]=_0x5a61ac[_0x014a('0x73')]||![];this[_0x014a('0x74')]=_0x5a61ac['dialAgiAfterHangupAgent']||![];this[_0x014a('0xb')]=monitorFormat[_0x5a61ac[_0x014a('0xb')]]?monitorFormat[_0x5a61ac[_0x014a('0xb')]]:undefined;this['mandatoryDisposition']=_0x5a61ac['mandatoryDisposition']||![];this[_0x014a('0x75')]=_0x5a61ac['mandatoryDispositionPause']?_0x5a61ac['mandatoryDispositionPause']:undefined;}module[_0x014a('0x76')]=VoiceQueue; \ No newline at end of file +var _0x65e8=['wav','wav49','gsm','rrmemory','roundrobin','monitor_format','type','inbound','waiting','talking','total','sumDuration','sumHoldTime','sumBillable','abandoned','loggedIn','acw','acwTimeout','autopause','sendMessageOneNotActive','message','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','unknown','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold'];(function(_0x4aed2f,_0x3b8b94){var _0x3118d3=function(_0x1d8832){while(--_0x1d8832){_0x4aed2f['push'](_0x4aed2f['shift']());}};_0x3118d3(++_0x3b8b94);}(_0x65e8,0x1d4));var _0x865e=function(_0x387ff5,_0x51d326){_0x387ff5=_0x387ff5-0x0;var _0x2ea324=_0x65e8[_0x387ff5];return _0x2ea324;};'use strict';var statusDesc=[_0x865e('0x0'),'not_inuse',_0x865e('0x1'),_0x865e('0x2'),_0x865e('0x3'),_0x865e('0x4'),_0x865e('0x5'),_0x865e('0x6'),_0x865e('0x7')];var monitorFormat={'wav':_0x865e('0x8'),'wav49':_0x865e('0x9'),'gsm':_0x865e('0xa')};var strategy={'rrmemory':_0x865e('0xb'),'roundrobin':_0x865e('0xc')};function VoiceQueue(_0x53dfc8){this['id']=_0x53dfc8['id']||0x0;this['name']=_0x53dfc8['name']||'';this['monitor_format']=_0x53dfc8[_0x865e('0xd')]||'';this['type']=_0x53dfc8[_0x865e('0xe')]||_0x865e('0xf');this[_0x865e('0x10')]=0x0;this[_0x865e('0x11')]=0x0;this[_0x865e('0x12')]=0x0;this['answered']=0x0;this[_0x865e('0x13')]=0x0;this[_0x865e('0x14')]=0x0;this[_0x865e('0x15')]=0x0;this['unmanaged']=0x0;this[_0x865e('0x16')]=0x0;this[_0x865e('0x17')]=0x0;this['available']=0x0;this[_0x865e('0x18')]=_0x53dfc8[_0x865e('0x18')]||![];this[_0x865e('0x19')]=_0x53dfc8[_0x865e('0x19')]||0xa;this[_0x865e('0x1a')]=_0x53dfc8['autopause']||'no';this[_0x865e('0x1b')]=!![];this[_0x865e('0x1c')]='';this['originated']=0x0;this[_0x865e('0x1d')]=0x0;this[_0x865e('0x1e')]=_0x53dfc8[_0x865e('0x1e')]||null;this['dialGlobalInterval']=_0x53dfc8[_0x865e('0x1f')]?_0x53dfc8[_0x865e('0x1f')]:null;this[_0x865e('0x20')]=_0x53dfc8[_0x865e('0x20')];this[_0x865e('0x21')]=_0x53dfc8[_0x865e('0x21')]||'progressive';this['dialLimitChannel']=_0x53dfc8[_0x865e('0x22')]||0x0;this[_0x865e('0x23')]=_0x53dfc8[_0x865e('0x23')]||0x0;this[_0x865e('0x24')]=_0x53dfc8[_0x865e('0x24')]||0x1;this[_0x865e('0x25')]=_0x53dfc8['dialPredictiveOptimization']||_0x865e('0x26');this[_0x865e('0x27')]=_0x53dfc8['dialPredictiveOptimizationPercentage']||0.03;this[_0x865e('0x28')]=_0x53dfc8[_0x865e('0x28')]||0x258;this[_0x865e('0x29')]=_0x53dfc8[_0x865e('0x29')]||'anonymous';this[_0x865e('0x2a')]=_0x53dfc8[_0x865e('0x2a')]||_0x865e('0x2b');this['dialOriginateTimeout']=_0x53dfc8[_0x865e('0x2c')]||0x1e;this[_0x865e('0x2d')]=_0x53dfc8[_0x865e('0x2d')]||_0x865e('0x2e');this[_0x865e('0x2f')]=_0x53dfc8[_0x865e('0x2f')]||0x3;this[_0x865e('0x30')]=_0x53dfc8[_0x865e('0x30')]||undefined;this[_0x865e('0x31')]=_0x53dfc8[_0x865e('0x31')]||0x3;this['dialCongestionRetryFrequency']=_0x53dfc8[_0x865e('0x32')]||0x96;this[_0x865e('0x33')]=_0x53dfc8[_0x865e('0x33')]||0x3;this[_0x865e('0x34')]=_0x53dfc8[_0x865e('0x34')]||0x96;this[_0x865e('0x35')]=_0x53dfc8['dialNoAnswerMaxRetry']||0x3;this[_0x865e('0x36')]=_0x53dfc8[_0x865e('0x36')]||0x96;this[_0x865e('0x37')]=_0x53dfc8[_0x865e('0x37')]||0x3;this[_0x865e('0x38')]=_0x53dfc8[_0x865e('0x38')]||0x96;this['dialDropMaxRetry']=_0x53dfc8[_0x865e('0x39')]||0x3;this[_0x865e('0x3a')]=_0x53dfc8[_0x865e('0x3a')]||0x96;this[_0x865e('0x3b')]=_0x53dfc8['dialAbandonedMaxRetry']||0x3;this[_0x865e('0x3c')]=_0x53dfc8[_0x865e('0x3c')]||0x96;this['dialMachineMaxRetry']=_0x53dfc8['dialMachineMaxRetry']||0x3;this[_0x865e('0x3d')]=_0x53dfc8[_0x865e('0x3d')]||0x96;this[_0x865e('0x3e')]=_0x53dfc8[_0x865e('0x3e')]||0x3;this[_0x865e('0x3f')]=_0x53dfc8[_0x865e('0x3f')]||0x96;this[_0x865e('0x40')]=_0x53dfc8[_0x865e('0x40')]||0x4;this[_0x865e('0x41')]=_0x53dfc8['Trunk']?_0x53dfc8['Trunk']:undefined;this[_0x865e('0x42')]=_0x53dfc8['TrunkBackup']?_0x53dfc8[_0x865e('0x42')]:undefined;this['dialPrefix']=_0x53dfc8[_0x865e('0x43')]||undefined;this[_0x865e('0x44')]=_0x53dfc8[_0x865e('0x44')]?_0x53dfc8['Interval']:undefined;this[_0x865e('0x45')]=_0x53dfc8[_0x865e('0x45')]||_0x865e('0x46');this[_0x865e('0x47')]=_0x53dfc8['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x865e('0x48')]=_0x53dfc8['dialCutDigit']||undefined;this[_0x865e('0x49')]=strategy[_0x53dfc8[_0x865e('0x49')]]||_0x865e('0xb');this[_0x865e('0x4a')]=!![];this[_0x865e('0x4b')]=_0x53dfc8['dialAMDActive']||![];this[_0x865e('0x4c')]=_0x53dfc8[_0x865e('0x4c')];this[_0x865e('0x4d')]=_0x53dfc8['dialAMDGreeting'];this[_0x865e('0x4e')]=_0x53dfc8[_0x865e('0x4e')];this[_0x865e('0x4f')]=_0x53dfc8['dialAMDTotalAnalysisTime'];this[_0x865e('0x50')]=_0x53dfc8[_0x865e('0x50')];this['dialAMDBetweenWordsSilence']=_0x53dfc8[_0x865e('0x51')];this['dialAMDMaximumNumberOfWords']=_0x53dfc8[_0x865e('0x52')];this['dialAMDSilenceThreshold']=_0x53dfc8[_0x865e('0x53')];this[_0x865e('0x54')]=_0x53dfc8[_0x865e('0x54')];this[_0x865e('0x55')]=0x0;this[_0x865e('0x56')]=0x0;this[_0x865e('0x57')]=_0x53dfc8[_0x865e('0x57')];this['outboundAnswerCallsDay']=0x0;this[_0x865e('0x58')]=0x0;this[_0x865e('0x59')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0x865e('0x5a')]=0x0;this[_0x865e('0x5b')]=0x0;this[_0x865e('0x5c')]=0x0;this['outboundBlacklistCallsDay']=0x0;this['outboundOriginateFailureCallsDay']=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x865e('0x5d')]=0x0;this[_0x865e('0x5e')]=0x0;this[_0x865e('0x5f')]=0x0;this[_0x865e('0x60')]=0x0;this[_0x865e('0x61')]=undefined;this[_0x865e('0x62')]=undefined;this[_0x865e('0x63')]=undefined;this[_0x865e('0x64')]=1.05;this[_0x865e('0x65')]=0x0;this[_0x865e('0x66')]=0x0;this[_0x865e('0x67')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x865e('0x68')]=0x0;this[_0x865e('0x69')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0x865e('0x6a')]=0x0;this['predictiveIntervalMaxThreshold']=_0x53dfc8[_0x865e('0x6b')]||0x14;this[_0x865e('0x6c')]=_0x53dfc8['dialPredictiveIntervalMaxThreshold']||0xa;this['predictiveIntervalErlangCalls']=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this['predictiveIntervalHitRate']=0x1;this['erlangCalls']=0x0;this[_0x865e('0x6d')]=0x0;this[_0x865e('0x6e')]=0x0;this[_0x865e('0x6f')]=0x0;this['dialRecallMeTimeout']=_0x53dfc8[_0x865e('0x70')]||0x1e;this[_0x865e('0x71')]=_0x53dfc8[_0x865e('0x71')]||![];this[_0x865e('0x72')]=_0x53dfc8[_0x865e('0x72')]||undefined;this[_0x865e('0x73')]=_0x53dfc8['dialAgiAfterHangupClient']||![];this['dialAgiAfterHangupAgent']=_0x53dfc8[_0x865e('0x74')]||![];this[_0x865e('0xd')]=monitorFormat[_0x53dfc8[_0x865e('0xd')]]?monitorFormat[_0x53dfc8[_0x865e('0xd')]]:undefined;this[_0x865e('0x75')]=_0x53dfc8[_0x865e('0x75')]||![];this[_0x865e('0x76')]=_0x53dfc8[_0x865e('0x76')]?_0x53dfc8[_0x865e('0x76')]: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 c52365f..21393cc 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 _0x3ed2=['serverUrl','Configurations','exports','name','username','accessKey','remoteUri'];(function(_0x209fa8,_0xafe96){var _0x245989=function(_0x2a1052){while(--_0x2a1052){_0x209fa8['push'](_0x209fa8['shift']());}};_0x245989(++_0xafe96);}(_0x3ed2,0x153));var _0x23ed=function(_0xba6b88,_0x4f1e92){_0xba6b88=_0xba6b88-0x0;var _0x575135=_0x3ed2[_0xba6b88];return _0x575135;};'use strict';function VtigerAccount(_0x1b695e){this['id']=_0x1b695e['id']||0x0;this['name']=_0x1b695e[_0x23ed('0x0')]||'';this[_0x23ed('0x1')]=_0x1b695e['username']||'';this[_0x23ed('0x2')]=_0x1b695e[_0x23ed('0x2')]||'';this[_0x23ed('0x3')]=_0x1b695e[_0x23ed('0x3')]||'';this[_0x23ed('0x4')]=_0x1b695e[_0x23ed('0x4')]||'';this[_0x23ed('0x5')]=_0x1b695e['Configurations']||{};}module[_0x23ed('0x6')]=VtigerAccount; \ No newline at end of file +var _0x28b9=['serverUrl','Configurations','exports','name','remoteUri'];(function(_0x21acc5,_0xbac59){var _0x5322c2=function(_0x2c0aa0){while(--_0x2c0aa0){_0x21acc5['push'](_0x21acc5['shift']());}};_0x5322c2(++_0xbac59);}(_0x28b9,0xad));var _0x928b=function(_0x583829,_0x188b0e){_0x583829=_0x583829-0x0;var _0x34d994=_0x28b9[_0x583829];return _0x34d994;};'use strict';function VtigerAccount(_0x4a8715){this['id']=_0x4a8715['id']||0x0;this['name']=_0x4a8715[_0x928b('0x0')]||'';this['username']=_0x4a8715['username']||'';this['accessKey']=_0x4a8715['accessKey']||'';this[_0x928b('0x1')]=_0x4a8715[_0x928b('0x1')]||'';this[_0x928b('0x2')]=_0x4a8715[_0x928b('0x2')]||'';this['Configurations']=_0x4a8715[_0x928b('0x3')]||{};}module[_0x928b('0x4')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 631b6ac..1fa104f 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 _0xa244=['serverUrl','Configurations','name','password','token','remoteUri','authType','type'];(function(_0x290046,_0x348b66){var _0x24737e=function(_0x42c003){while(--_0x42c003){_0x290046['push'](_0x290046['shift']());}};_0x24737e(++_0x348b66);}(_0xa244,0x1b2));var _0x4a24=function(_0x5cf75a,_0x8c598c){_0x5cf75a=_0x5cf75a-0x0;var _0x5f9be3=_0xa244[_0x5cf75a];return _0x5f9be3;};'use strict';function ZendeskAccount(_0x3666d5){this['id']=_0x3666d5['id']||0x0;this[_0x4a24('0x0')]=_0x3666d5[_0x4a24('0x0')]||'';this['username']=_0x3666d5['username']||'';this[_0x4a24('0x1')]=_0x3666d5[_0x4a24('0x1')]||'';this['token']=_0x3666d5[_0x4a24('0x2')]||'';this[_0x4a24('0x3')]=_0x3666d5[_0x4a24('0x3')]||'';this['authType']=_0x3666d5[_0x4a24('0x4')]||'';this[_0x4a24('0x5')]=_0x3666d5['type']||'integrationTab';this[_0x4a24('0x6')]=_0x3666d5[_0x4a24('0x6')]||'';this[_0x4a24('0x7')]=_0x3666d5['Configurations']||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0xcaaf=['type','integrationTab','serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType'];(function(_0x23a634,_0x3de173){var _0x54ca29=function(_0x1abe8a){while(--_0x1abe8a){_0x23a634['push'](_0x23a634['shift']());}};_0x54ca29(++_0x3de173);}(_0xcaaf,0x9f));var _0xfcaa=function(_0x3e60bc,_0x1796dd){_0x3e60bc=_0x3e60bc-0x0;var _0x5c17bd=_0xcaaf[_0x3e60bc];return _0x5c17bd;};'use strict';function ZendeskAccount(_0x54d7a6){this['id']=_0x54d7a6['id']||0x0;this['name']=_0x54d7a6[_0xfcaa('0x0')]||'';this[_0xfcaa('0x1')]=_0x54d7a6[_0xfcaa('0x1')]||'';this['password']=_0x54d7a6[_0xfcaa('0x2')]||'';this[_0xfcaa('0x3')]=_0x54d7a6[_0xfcaa('0x3')]||'';this['remoteUri']=_0x54d7a6[_0xfcaa('0x4')]||'';this[_0xfcaa('0x5')]=_0x54d7a6[_0xfcaa('0x5')]||'';this[_0xfcaa('0x6')]=_0x54d7a6[_0xfcaa('0x6')]||_0xfcaa('0x7');this[_0xfcaa('0x8')]=_0x54d7a6[_0xfcaa('0x8')]||'';this['Configurations']=_0x54d7a6[_0xfcaa('0x9')]||{};}module[_0xfcaa('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index ef5e575..cb77ec0 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 _0x4b29=['clientSecret','serverUrl','code','refreshToken','Configurations','name','description','host','zone','clientId'];(function(_0x393c6b,_0x5ea45c){var _0xaac874=function(_0x5c4cc2){while(--_0x5c4cc2){_0x393c6b['push'](_0x393c6b['shift']());}};_0xaac874(++_0x5ea45c);}(_0x4b29,0x69));var _0x94b2=function(_0x23cf88,_0x13378c){_0x23cf88=_0x23cf88-0x0;var _0x53d581=_0x4b29[_0x23cf88];return _0x53d581;};'use strict';function ZohoAccount(_0x1e80e9){this['id']=_0x1e80e9['id']||0x0;this['name']=_0x1e80e9[_0x94b2('0x0')]||'';this[_0x94b2('0x1')]=_0x1e80e9[_0x94b2('0x1')]||'';this[_0x94b2('0x2')]=_0x1e80e9[_0x94b2('0x2')]||'';this[_0x94b2('0x3')]=_0x1e80e9[_0x94b2('0x3')]||'';this[_0x94b2('0x4')]=_0x1e80e9[_0x94b2('0x4')]||'';this[_0x94b2('0x5')]=_0x1e80e9[_0x94b2('0x5')]||'';this['serverUrl']=_0x1e80e9[_0x94b2('0x6')]||'';this[_0x94b2('0x7')]=_0x1e80e9[_0x94b2('0x7')]||'';this['refreshToken']=_0x1e80e9[_0x94b2('0x8')]||'';this['Configurations']=_0x1e80e9[_0x94b2('0x9')]||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0x4b76=['refreshToken','Configurations','name','description','host','zone','clientId','clientSecret','serverUrl','code'];(function(_0x234ae1,_0x42bdd6){var _0x227ba0=function(_0x1f6531){while(--_0x1f6531){_0x234ae1['push'](_0x234ae1['shift']());}};_0x227ba0(++_0x42bdd6);}(_0x4b76,0xfc));var _0x64b7=function(_0x5d4a9c,_0x2eeab4){_0x5d4a9c=_0x5d4a9c-0x0;var _0x37c76e=_0x4b76[_0x5d4a9c];return _0x37c76e;};'use strict';function ZohoAccount(_0x4bc1b0){this['id']=_0x4bc1b0['id']||0x0;this['name']=_0x4bc1b0[_0x64b7('0x0')]||'';this['description']=_0x4bc1b0[_0x64b7('0x1')]||'';this['host']=_0x4bc1b0[_0x64b7('0x2')]||'';this[_0x64b7('0x3')]=_0x4bc1b0[_0x64b7('0x3')]||'';this['clientId']=_0x4bc1b0[_0x64b7('0x4')]||'';this[_0x64b7('0x5')]=_0x4bc1b0[_0x64b7('0x5')]||'';this[_0x64b7('0x6')]=_0x4bc1b0['serverUrl']||'';this[_0x64b7('0x7')]=_0x4bc1b0[_0x64b7('0x7')]||'';this[_0x64b7('0x8')]=_0x4bc1b0[_0x64b7('0x8')]||'';this[_0x64b7('0x9')]=_0x4bc1b0[_0x64b7('0x9')]||{};}module['exports']=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index b793bcd..02a9680 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 _0x8491=['firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','util','lodash','string','isNil','uniqueid','idContact','name','type','campaigntype','Agent','channelAgent','format','SIP/%s','membername','calleridname','Contact','phone'];(function(_0x2389bc,_0x167cd2){var _0x170548=function(_0x2da7f2){while(--_0x2da7f2){_0x2389bc['push'](_0x2389bc['shift']());}};_0x170548(++_0x167cd2);}(_0x8491,0x184));var _0x1849=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x8491[_0x45783c];return _0x1161da;};'use strict';var util=require(_0x1849('0x0'));var _=require(_0x1849('0x1'));var moment=require('moment');function checkNameSurname(_0x4c2f60,_0x3ab6f5,_0x38548c){var _0xaaf2f6='';if(!_['isNil'](_0x3ab6f5)&&_0x1849('0x2')===typeof _0x3ab6f5){_0xaaf2f6+=_0x3ab6f5;}if(!_[_0x1849('0x3')](_0x38548c)&&_0x1849('0x2')===typeof _0x38548c){_0xaaf2f6+='\x20'+_0x38548c;}if(_0xaaf2f6!==''){return _0xaaf2f6;}return _0x4c2f60;}function Action(_0xc0c414,_0x32a794,_0x54ab39,_0x1e4e9d,_0x5ba8fb){this[_0x1849('0x4')]=_0x54ab39||undefined;this[_0x1849('0x5')]=_0xc0c414['id'];this['queue']=_0x32a794[_0x1849('0x6')];this['type']=_0x32a794[_0x1849('0x7')];this[_0x1849('0x8')]='queue';this['dialAnswer']=![];this['membername']=_[_0x1849('0x3')](_0xc0c414[_0x1849('0x9')])?undefined:_0xc0c414[_0x1849('0x9')][_0x1849('0x6')];this[_0x1849('0xa')]=this['membername']?util[_0x1849('0xb')](_0x1849('0xc'),this[_0x1849('0xd')]):_0x1e4e9d||undefined;this[_0x1849('0xe')]=checkNameSurname(_0xc0c414[_0x1849('0xf')][_0x1849('0x10')],_0xc0c414[_0x1849('0xf')][_0x1849('0x11')],_0xc0c414['Contact'][_0x1849('0x12')]);this['active']=_0xc0c414[_0x1849('0x13')]||![];this[_0x1849('0x14')]=_0xc0c414[_0x1849('0xf')][_0x1849('0x10')];this[_0x1849('0x15')]=_0xc0c414[_0x1849('0x15')];this['countbusyretry']=_0xc0c414[_0x1849('0x16')]||0x0;this['countcongestionretry']=_0xc0c414[_0x1849('0x17')]||0x0;this[_0x1849('0x18')]=_0xc0c414['countnoanswerretry']||0x0;this[_0x1849('0x19')]=(_0xc0c414[_0x1849('0x16')]||0x0)+(_0xc0c414[_0x1849('0x17')]||0x0)+(_0xc0c414[_0x1849('0x18')]||0x0)+(_0xc0c414[_0x1849('0x1a')]||0x0)+(_0xc0c414[_0x1849('0x1b')]||0x0)+(_0xc0c414['countabandonedretry']||0x0)+(_0xc0c414[_0x1849('0x1c')]||0x0)+(_0xc0c414[_0x1849('0x1d')]||0x0);this[_0x1849('0x1a')]=_0xc0c414[_0x1849('0x1a')]||0x0;this[_0x1849('0x1b')]=_0xc0c414['countdropretry']||0x0;this['countabandonedretry']=_0xc0c414[_0x1849('0x1e')]||0x0;this[_0x1849('0x1c')]=_0xc0c414[_0x1849('0x1c')]||0x0;this[_0x1849('0x1d')]=_0xc0c414[_0x1849('0x1d')]||0x0;this['callback']=_0xc0c414[_0x1849('0x1f')];this[_0x1849('0x20')]=_0xc0c414['callbackuniqueid'];this['callbackat']=_0xc0c414[_0x1849('0x21')];this['recallme']=_0xc0c414[_0x1849('0x22')];this[_0x1849('0x23')]=_0xc0c414[_0x1849('0x23')];this['ListId']=_0xc0c414[_0x1849('0x24')];this['UserId']=_['isNil'](_0xc0c414[_0x1849('0x9')])?_0xc0c414['UserId']:_0xc0c414[_0x1849('0x9')]['id'];this['VoiceQueueId']=_0xc0c414[_0x1849('0x25')];this[_0x1849('0x26')]='';this[_0x1849('0x27')]='';}Action[_0x1849('0x28')][_0x1849('0x29')]=function(){return util[_0x1849('0xb')](_0x1849('0x2a'),this[_0x1849('0xe')],this[_0x1849('0x2b')]);};module[_0x1849('0x2c')]=Action; \ No newline at end of file +var _0x7d36=['countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','util','lodash','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone','firstName','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0xda55b2,_0x294a11){var _0x15b75c=function(_0x38b4be){while(--_0x38b4be){_0xda55b2['push'](_0xda55b2['shift']());}};_0x15b75c(++_0x294a11);}(_0x7d36,0x1a8));var _0x67d3=function(_0x3bc277,_0xa61e44){_0x3bc277=_0x3bc277-0x0;var _0x2ff270=_0x7d36[_0x3bc277];return _0x2ff270;};'use strict';var util=require(_0x67d3('0x0'));var _=require(_0x67d3('0x1'));var moment=require(_0x67d3('0x2'));function checkNameSurname(_0x225893,_0x4e794e,_0x12e60){var _0x710587='';if(!_[_0x67d3('0x3')](_0x4e794e)&&'string'===typeof _0x4e794e){_0x710587+=_0x4e794e;}if(!_[_0x67d3('0x3')](_0x12e60)&&_0x67d3('0x4')===typeof _0x12e60){_0x710587+='\x20'+_0x12e60;}if(_0x710587!==''){return _0x710587;}return _0x225893;}function Action(_0x5c1503,_0x41034b,_0x14d523,_0x5633a0,_0xdc244b){this[_0x67d3('0x5')]=_0x14d523||undefined;this[_0x67d3('0x6')]=_0x5c1503['id'];this[_0x67d3('0x7')]=_0x41034b[_0x67d3('0x8')];this[_0x67d3('0x9')]=_0x41034b[_0x67d3('0x9')];this[_0x67d3('0xa')]=_0x67d3('0x7');this[_0x67d3('0xb')]=![];this[_0x67d3('0xc')]=_['isNil'](_0x5c1503[_0x67d3('0xd')])?undefined:_0x5c1503[_0x67d3('0xd')]['name'];this[_0x67d3('0xe')]=this[_0x67d3('0xc')]?util[_0x67d3('0xf')](_0x67d3('0x10'),this[_0x67d3('0xc')]):_0x5633a0||undefined;this[_0x67d3('0x11')]=checkNameSurname(_0x5c1503[_0x67d3('0x12')][_0x67d3('0x13')],_0x5c1503[_0x67d3('0x12')][_0x67d3('0x14')],_0x5c1503[_0x67d3('0x12')]['lastName']);this['active']=_0x5c1503['active']||![];this[_0x67d3('0x15')]=_0x5c1503[_0x67d3('0x12')][_0x67d3('0x13')];this[_0x67d3('0x16')]=_0x5c1503['scheduledat'];this[_0x67d3('0x17')]=_0x5c1503[_0x67d3('0x17')]||0x0;this[_0x67d3('0x18')]=_0x5c1503[_0x67d3('0x18')]||0x0;this[_0x67d3('0x19')]=_0x5c1503['countnoanswerretry']||0x0;this[_0x67d3('0x1a')]=(_0x5c1503[_0x67d3('0x17')]||0x0)+(_0x5c1503['countcongestionretry']||0x0)+(_0x5c1503[_0x67d3('0x19')]||0x0)+(_0x5c1503[_0x67d3('0x1b')]||0x0)+(_0x5c1503['countdropretry']||0x0)+(_0x5c1503[_0x67d3('0x1c')]||0x0)+(_0x5c1503[_0x67d3('0x1d')]||0x0)+(_0x5c1503['countagentrejectretry']||0x0);this[_0x67d3('0x1b')]=_0x5c1503[_0x67d3('0x1b')]||0x0;this[_0x67d3('0x1e')]=_0x5c1503[_0x67d3('0x1e')]||0x0;this['countabandonedretry']=_0x5c1503[_0x67d3('0x1c')]||0x0;this['countmachineretry']=_0x5c1503[_0x67d3('0x1d')]||0x0;this[_0x67d3('0x1f')]=_0x5c1503[_0x67d3('0x1f')]||0x0;this[_0x67d3('0x20')]=_0x5c1503[_0x67d3('0x20')];this[_0x67d3('0x21')]=_0x5c1503[_0x67d3('0x21')];this[_0x67d3('0x22')]=_0x5c1503[_0x67d3('0x22')];this[_0x67d3('0x23')]=_0x5c1503[_0x67d3('0x23')];this['ContactId']=_0x5c1503['ContactId'];this[_0x67d3('0x24')]=_0x5c1503[_0x67d3('0x24')];this[_0x67d3('0x25')]=_[_0x67d3('0x3')](_0x5c1503['Agent'])?_0x5c1503[_0x67d3('0x25')]:_0x5c1503[_0x67d3('0xd')]['id'];this[_0x67d3('0x26')]=_0x5c1503[_0x67d3('0x26')];this[_0x67d3('0x27')]='';this[_0x67d3('0x28')]='';}Action[_0x67d3('0x29')][_0x67d3('0x2a')]=function(){return util[_0x67d3('0xf')](_0x67d3('0x2b'),this[_0x67d3('0x11')],this[_0x67d3('0x2c')]);};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 3862cee..57f56ce 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 _0x861a=['SIP/%s','status','reachable','unmonitored','execRun','unlock','getContactPreview','recallme','validateContact','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','ACTIVE','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','phone','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','addVariables','merge','toLowerVariables','variablesAction','channelAgent','destconnectedlinenum','calleridnum','user:%s','user:agentconnect','accountcode','[originated][increment]','OriginateError','syncOriginateResponse','actionid','logLookAgent','clone','responsetime','YYYY-MM-DD\x20HH:mm:ss','isFailure','response','unlockContact','custom:agentringnoanswer','rejected','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','variables','filterKey','variable','addVariable','keys','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','bluebird','moment','ioredis','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','agents','clockClearZombieChannels','originateresponse','bind','hangup','syncHangup','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','name','strategy','answered','available','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','Interval','md5','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_presence:remove','sendMessageOneNotActive','pTalking','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','hasOwnProperty','booked','clearZombieChannels','setMessage','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','actions','originated:\x20','stringify','queue','pTalking:\x20','dialAnswer','pick','UserId','VoiceQueueId','Action','channel','catch','No\x20such\x20channel','updateOriginated','loggerError','[Dialer][checkChannel][pTalking][Preview]','size','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','run','logger2','[RecallMe]','disableContact','starttime','logCustomer','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','loggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','linkedid','ANSWER','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','acw','custom:agentConnectPreview','buildAcw','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','BUSY','countbusyretry','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','dialBusyRetryFrequency','activeContact','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerMaxRetry','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','countagentrejectretry','AgentReject','custom:agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','countmachineretry','cause-txt','dialstatus','[callProgressDetectingCustomer][hangupInAMD]','custom:amd','[callProgressDetectingCustomer][machine]','decrementTalkink','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','object','reason','createAgentHistory','logAgent','[callProgressDetectingAgent][logNoAnswer]','Busy','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x861a,0x1b1));var _0xa861=function(_0x142566,_0x3b9a4a){_0x142566=_0x142566-0x0;var _0x3c41e3=_0x861a[_0x142566];return _0x3c41e3;};'use strict';var util=require(_0xa861('0x0'));var _=require('lodash');var BPromise=require(_0xa861('0x1'));var uuid=require('uuid');var moment=require(_0xa861('0x2'));var md5=require('md5');var Redis=require(_0xa861('0x3'));var config=require('../../../config/environment');var logger=require(_0xa861('0x4'))(_0xa861('0x5'));var loggerAction=require(_0xa861('0x4'))(_0xa861('0x6'));var ami=require(_0xa861('0x7'));var rpcDb=require(_0xa861('0x8'));var Action=require(_0xa861('0x9'));var ut=require(_0xa861('0xa'));config[_0xa861('0xb')]=_[_0xa861('0xc')](config[_0xa861('0xb')],{'host':_0xa861('0xd'),'port':0x18eb});var io=require(_0xa861('0xe'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0xa861('0xf')][_0xa861('0x10')]=function(_0x10d2d6){this[_0xa861('0x11')]=this[_0xa861('0x11')]?this['tail'][_0xa861('0x12')](_0x10d2d6):_0x10d2d6();};function Preview(_0x112b69){this[_0xa861('0x13')]=new Sequence();this[_0xa861('0x14')]=_0x112b69[_0xa861('0x15')];this[_0xa861('0x16')]=_0x112b69[_0xa861('0x16')];this['actions']={};this[_0xa861('0x17')]=_0x112b69[_0xa861('0x17')];this[_0xa861('0x18')]=0x0;ami['on'](_0xa861('0x19'),this['syncOriginateResponse'][_0xa861('0x1a')](this));ami['on'](_0xa861('0x1b'),this[_0xa861('0x1c')][_0xa861('0x1a')](this));ami['on']('hanguprequest',this[_0xa861('0x1d')][_0xa861('0x1a')](this));ami['on'](_0xa861('0x1e'),this[_0xa861('0x1f')][_0xa861('0x1a')](this));ami['on'](_0xa861('0x20'),this[_0xa861('0x21')][_0xa861('0x1a')](this));ami['on']('varset',this[_0xa861('0x22')][_0xa861('0x1a')](this));ami['on'](_0xa861('0x23'),this[_0xa861('0x24')][_0xa861('0x1a')](this));ami['on'](_0xa861('0x25'),this[_0xa861('0x26')]['bind'](this));this[_0xa861('0x27')](this[_0xa861('0x14')]);}function emit(_0x556af4,_0x507181,_0x36cb76){io['to'](_0x556af4)[_0xa861('0x28')](_0x507181,_0x36cb76);}function emitCampaignPreview(_0x18d731){if(_0x18d731[_0xa861('0x29')]===_0xa861('0x2a')){var _0x3e2067={'id':_0x18d731['id'],'name':_0x18d731[_0xa861('0x2b')],'strategy':_0x18d731[_0xa861('0x2c')],'answered':_0x18d731[_0xa861('0x2d')],'available':_0x18d731[_0xa861('0x2e')],'loggedIn':_0x18d731['loggedIn'],'pTalking':_0x18d731['pTalking'],'sumBillable':_0x18d731[_0xa861('0x2f')],'sumDuration':_0x18d731[_0xa861('0x30')],'sumHoldTime':_0x18d731[_0xa861('0x31')]||0x0,'talking':_0x18d731[_0xa861('0x32')],'total':_0x18d731[_0xa861('0x33')],'type':_0x18d731[_0xa861('0x29')],'unmanaged':_0x18d731[_0xa861('0x34')],'abandoned':_0x18d731[_0xa861('0x35')],'waiting':_0x18d731[_0xa861('0x36')],'loggedInDb':_0x18d731[_0xa861('0x37')],'dialActive':_0x18d731[_0xa861('0x38')],'dialMethod':_0x18d731[_0xa861('0x39')],'dialOriginateCallerIdName':_0x18d731['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x18d731[_0xa861('0x3a')],'dialOriginateTimeout':_0x18d731[_0xa861('0x3b')],'dialPrefix':_0x18d731[_0xa861('0x3c')],'outboundAnswerAgiCallsDay':_0x18d731['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x18d731[_0xa861('0x3d')],'outboundBlacklistCallsDay':_0x18d731[_0xa861('0x3e')],'outboundBusyCallsDay':_0x18d731[_0xa861('0x3f')],'outboundCongestionCallsDay':_0x18d731[_0xa861('0x40')],'outboundDropCallsDayACS':_0x18d731['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x18d731[_0xa861('0x41')],'outboundDropCallsDayTimeout':_0x18d731[_0xa861('0x42')],'outboundNoAnswerCallsDay':_0x18d731[_0xa861('0x43')],'outboundNoSuchCallsDay':_0x18d731['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x18d731[_0xa861('0x44')],'outboundReCallsDay':_0x18d731[_0xa861('0x45')],'outboundRejectCallsDay':_0x18d731[_0xa861('0x46')],'outboundUnknownCallsDay':_0x18d731[_0xa861('0x47')],'outboundAbandonedCallsDay':_0x18d731[_0xa861('0x48')],'predictiveIntervalAnsweredCalls':_0x18d731[_0xa861('0x49')],'predictiveIntervalAvgHoldtime':_0x18d731[_0xa861('0x4a')],'predictiveIntervalAvgTalktime':_0x18d731[_0xa861('0x4b')],'predictiveIntervalDroppedCallsCallersExit':_0x18d731['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x18d731[_0xa861('0x4c')],'predictiveIntervalErlangCalls':_0x18d731[_0xa861('0x4d')],'predictiveIntervalErlangCallsDroppedCalls':_0x18d731['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x18d731[_0xa861('0x4e')],'predictiveIntervalMultiplicativeFactor':_0x18d731[_0xa861('0x4f')],'predictiveIntervalPauses':_0x18d731[_0xa861('0x50')],'predictiveIntervalAvailable':_0x18d731[_0xa861('0x51')],'predictiveIntervalTotalCalls':_0x18d731[_0xa861('0x52')],'message':_0x18d731[_0xa861('0x53')],'originated':_0x18d731[_0xa861('0x54')],'erlangCalls':_0x18d731['erlangCalls'],'erlangCallToSecond':_0x18d731[_0xa861('0x55')],'erlangAbandonmentRate':_0x18d731[_0xa861('0x56')],'erlangBusyFactor':_0x18d731[_0xa861('0x57')],'startPredictive':_0x18d731[_0xa861('0x58')],'startProgressive':_0x18d731['startProgressive']};if(_0x18d731[_0xa861('0x59')]){_0x3e2067[_0xa861('0x59')]={'id':_0x18d731[_0xa861('0x59')]['id'],'name':_0x18d731[_0xa861('0x59')][_0xa861('0x2b')],'active':_0x18d731[_0xa861('0x59')][_0xa861('0x5a')],'callerid':_0x18d731['Trunk']['callerid']};}if(_0x18d731[_0xa861('0x5b')]){_0x3e2067[_0xa861('0x5b')]={'id':_0x18d731[_0xa861('0x5b')]['id'],'name':_0x18d731[_0xa861('0x5b')][_0xa861('0x2b')]};}var _0xcb818a=md5(JSON['stringify'](_0x3e2067));if(_0x18d731[_0xa861('0x5c')]!==_0xcb818a){_0x18d731[_0xa861('0x5c')]=_0xcb818a;emit(util[_0xa861('0x5d')](_0xa861('0x5e'),_0x3e2067[_0xa861('0x2b')]),_0xa861('0x5f'),_0x3e2067);}}}function emitVoiceQueueChannelRemove(_0x565acf){logger[_0xa861('0x60')](_0xa861('0x61'),JSON['stringify'](_0x565acf));emit(util[_0xa861('0x5d')]('voice:queue:%s',_0x565acf[_0xa861('0x2b')]),'voice_queue_channel:remove',_0x565acf);io['emit'](_0xa861('0x62'),_0x565acf);}function notSendMessagesQueue(_0x25ccd5){if(_0x25ccd5[_0xa861('0x63')]){if(_0x25ccd5[_0xa861('0x54')]===0x0&&_0x25ccd5[_0xa861('0x64')]===0x0){_0x25ccd5[_0xa861('0x63')]=![];_0x25ccd5['available']=0x0;_0x25ccd5['paused']=0x0;_0x25ccd5[_0xa861('0x53')]=_0xa861('0x65');ut[_0xa861('0x66')](_0xa861('0x67'),_0x25ccd5[_0xa861('0x2b')]+_0xa861('0x68'));}else{_0x25ccd5['message']=_0xa861('0x69');ut['logger'](_0xa861('0x67'),_0x25ccd5[_0xa861('0x2b')]+_0xa861('0x6a'));}emitCampaignPreview(_0x25ccd5);}}Preview['prototype'][_0xa861('0x27')]=function(){var _0x24d6ed=this;setInterval(function(){_0x24d6ed[_0xa861('0x6b')]();},0x7cf);};Preview[_0xa861('0xf')][_0xa861('0x6b')]=function(){var _0x136306=this['campaignsPreview'];this[_0xa861('0x18')]+=0x1;for(var _0x463e55 in _0x136306){if(_0x136306[_0xa861('0x6c')](_0x463e55)&&(_0x136306[_0x463e55][_0xa861('0x39')]==='preview'||_0x136306[_0x463e55]['dialMethod']===_0xa861('0x6d'))&&_0x136306[_0x463e55][_0xa861('0x29')]===_0xa861('0x2a')){if(this[_0xa861('0x18')]>0x7){this[_0xa861('0x18')]=0x0;this[_0xa861('0x6e')]();}}if(_0x136306['hasOwnProperty'](_0x463e55)&&_0x136306[_0x463e55][_0xa861('0x39')]==='preview'&&_0x136306[_0x463e55]['type']==='outbound'){if(_0x136306[_0x463e55][_0xa861('0x38')]){this[_0xa861('0x6f')](_0x136306[_0x463e55]);this[_0xa861('0x70')](_0x136306[_0x463e55]);}else{notSendMessagesQueue(_0x136306[_0x463e55]);}}}};Preview['prototype'][_0xa861('0x71')]=function(_0x50349e){var _0xd010=this;this[_0xa861('0x13')]['enqueue'](function(){if(!_[_0xa861('0x72')](_0xd010['actions'][_0x50349e])){loggerAction[_0xa861('0x60')](_0xa861('0x73'),_0x50349e,_0xa861('0x74'),_0xd010[_0xa861('0x75')][_0x50349e]['queue'],_0xa861('0x76'),JSON[_0xa861('0x77')](_0xd010[_0xa861('0x14')][_0xd010[_0xa861('0x75')][_0x50349e][_0xa861('0x78')]][_0xa861('0x54')]),_0xa861('0x79'),JSON[_0xa861('0x77')](_0xd010[_0xa861('0x14')][_0xd010[_0xa861('0x75')][_0x50349e][_0xa861('0x78')]]['pTalking']),JSON['stringify'](_0xd010[_0xa861('0x75')][_0x50349e][_0xa861('0x7a')]),JSON[_0xa861('0x77')](_[_0xa861('0x7b')](_0xd010['actions'][_0x50349e],['contactId',_0xa861('0x7c'),_0xa861('0x7d'),'ListId'])));return ami[_0xa861('0x7e')]({'action':'status','channel':_0xd010[_0xa861('0x75')][_0x50349e][_0xa861('0x7f')]})[_0xa861('0x80')](function(_0x57a9ab){if(_0x57a9ab[_0xa861('0x53')]===_0xa861('0x81')){setTimeout(function(){if(_0xd010[_0xa861('0x75')][_0x50349e]){ut[_0xa861('0x82')](_0xd010['campaignsPreview'][_0xd010[_0xa861('0x75')][_0x50349e][_0xa861('0x78')]],'[clearZombieChannel]');if(_0xd010[_0xa861('0x75')][_0x50349e][_0xa861('0x7a')]===!![]){ut['decrementTalkink'](_0xd010[_0xa861('0x14')][_0xd010['actions'][_0x50349e][_0xa861('0x78')]],'[clearZombieChannel]');ut[_0xa861('0x83')](_0xa861('0x84')+_0x50349e,_0xd010['actions'][_0x50349e]['queue']);}ut[_0xa861('0x83')]('[Dialer][checkChannel][Preview]'+_0x50349e,_0xd010[_0xa861('0x75')][_0x50349e][_0xa861('0x78')]);delete _0xd010['actions'][_0x50349e];}},0x2328);}});}});};Preview[_0xa861('0xf')]['clearZombieChannels']=function(){var _0xc0c039=this;loggerAction[_0xa861('0x60')]('[action]',_[_0xa861('0x85')](this[_0xa861('0x75')]));for(var _0x3729e5 in this[_0xa861('0x75')]){if(_0xc0c039[_0xa861('0x75')][_0xa861('0x6c')](_0x3729e5)){_0xc0c039[_0xa861('0x71')](_0x3729e5);}}};Preview['prototype'][_0xa861('0x70')]=function(_0x38a3aa){var _0x2981c9=this;rpcDb[_0xa861('0x86')](_0x38a3aa['id'],ut[_0xa861('0x87')](this[_0xa861('0x17')]))[_0xa861('0x88')](function(_0x24f54a){if(!_[_0xa861('0x72')](_0x24f54a)){for(var _0x2de737=0x0;_0x2de737<_0x24f54a[_0xa861('0x89')];_0x2de737+=0x1){if(ut[_0xa861('0x8a')](_0x24f54a[_0x2de737][_0xa861('0x8b')])<_0x38a3aa[_0xa861('0x8c')]*0x3c){if(_0x24f54a[_0x2de737]['Agent']&&!_0x24f54a[_0x2de737][_0xa861('0x8d')]['voicePause']){_0x2981c9[_0xa861('0x8e')](_0x24f54a[_0x2de737]['id'])['then'](ut[_0xa861('0x8f')](_0xa861('0x90')))[_0xa861('0x80')](ut[_0xa861('0x8f')]('[RecallMe]'));}else{rpcDb[_0xa861('0x91')](_0x24f54a[_0x2de737]['id']);}}else{var _0x4ae179=new Action(_0x24f54a[_0x2de737],_0x38a3aa);_0x4ae179[_0xa861('0x92')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x38a3aa[_0xa861('0x45')]+=0x1;ut[_0xa861('0x93')](_0x4ae179,0x17,'RecallInQueue');if(_0x38a3aa[_0xa861('0x94')]){rpcDb[_0xa861('0x95')](ut[_0xa861('0x96')](_0x24f54a[_0x2de737]));rpcDb[_0xa861('0x97')](_0x4ae179,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0xa861('0x93')](_0x4ae179,0x16,_0xa861('0x98'));rpcDb[_0xa861('0x97')](_0x4ae179,_0xa861('0x99'));rpcDb[_0xa861('0x9a')](_0x4ae179,_0xa861('0x99'));}}}}})[_0xa861('0x80')](ut['logger2'](_0xa861('0x9b')));};Preview[_0xa861('0xf')][_0xa861('0x6f')]=function(_0x251d9e){_0x251d9e[_0xa861('0x63')]=!![];if(ut['IsNotLoggedIn'](_0x251d9e[_0xa861('0x9c')])){_0x251d9e['message']=_0xa861('0x9d');}else if(!ut[_0xa861('0x9e')](_0x251d9e[_0xa861('0x38')])){_0x251d9e[_0xa861('0x53')]=_0xa861('0x65');}else if(!this[_0xa861('0x9f')](_0x251d9e['Trunk'])){if(!this[_0xa861('0x9f')](_0x251d9e[_0xa861('0xa0')])){_0x251d9e['message']='TRUNK_IS_NOT_REACHABLE';}else{_0x251d9e[_0xa861('0x53')]='ACTIVE';}}else{_0x251d9e[_0xa861('0x53')]='ACTIVE';}emitCampaignPreview(_0x251d9e);};Preview[_0xa861('0xf')][_0xa861('0xa1')]=function(_0xac8f09,_0x52de61,_0x5bab47){var _0x59dfc1=this;var _0x1ba827=this[_0xa861('0x75')][_0x52de61];var _0x3b90e7=this[_0xa861('0x14')][_0x1ba827[_0xa861('0x78')]];var _0x4b3109;if(_0x3b90e7){switch(_0x5bab47){case'1':_0x3b90e7[_0xa861('0xa2')]+=0x1;_0x1ba827[_0xa861('0xa3')]+=0x1;_0x1ba827[_0xa861('0xa4')]=ut[_0xa861('0xa5')](_0x1ba827);ut[_0xa861('0x93')](_0x1ba827,0x0,_0xa861('0xa6'));ami[_0xa861('0x28')](_0xa861('0xa7'),ut[_0xa861('0xa8')](_0x1ba827,_0xa861('0xa9')));rpcDb[_0xa861('0x97')](_0x1ba827,_0xa861('0xaa'));if(ut[_0xa861('0xa5')](_0x1ba827)>=_0x3b90e7[_0xa861('0xab')]){_0x4b3109=ut[_0xa861('0xac')](_0x1ba827,0xf,_0xa861('0xad'));rpcDb[_0xa861('0x9a')](_0x4b3109,_0xa861('0xae'));}else{if(_0x1ba827[_0xa861('0xa3')]>=_0x3b90e7[_0xa861('0xaf')]){rpcDb['createCustomerFinal'](_0x1ba827,_0xa861('0xae'));}else{rpcDb[_0xa861('0xb0')](ut[_0xa861('0xb1')](_0x1ba827,'countnosuchnumberretry',_0x3b90e7[_0xa861('0xb2')]),_0x1ba827[_0xa861('0xb3')],_0x1ba827['activeContact']);}}delete this[_0xa861('0x75')][_0xac8f09[_0xa861('0xb4')]];break;case _0xa861('0xb5'):var _0x460dd7=moment()[_0xa861('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x1ba827['responsetime']=_0x460dd7;_0x1ba827[_0xa861('0xb6')]=_0x460dd7;_0x1ba827['dialAnswer']=!![];_0x3b90e7[_0xa861('0x64')]+=0x1;logger[_0xa861('0x60')](_0xa861('0xb7'),_0x1ba827[_0xa861('0xb8')],_0xa861('0xb9'),_0x3b90e7[_0xa861('0x2b')],_0xa861('0x79'),_0x3b90e7[_0xa861('0x64')]);ami['emit'](_0xa861('0xba'),ut[_0xa861('0xa8')](_0x1ba827,'connect',this['campaignsPreview'][_0x1ba827[_0xa861('0x78')]]));if(_0x3b90e7[_0xa861('0xbb')]){ami[_0xa861('0x28')](_0xa861('0xbc'),ut[_0xa861('0xbd')](_0x1ba827));}break;case'16':ami[_0xa861('0x28')]('custom:agentcomplete',ut[_0xa861('0xa8')](_0x1ba827,_0xa861('0xbe'),this[_0xa861('0x14')][_0x1ba827['queue']]));emitVoiceQueueChannelRemove(ut[_0xa861('0xa8')](_0x1ba827,_0xa861('0xbe')));_0x3b90e7['outboundAnswerCallsDay']+=0x1;_0x3b90e7[_0xa861('0x33')]+=0x1;_0x3b90e7[_0xa861('0x2d')]+=0x1;ut['decrementTalkink'](_0x3b90e7,_0xa861('0xbf'));_0x1ba827[_0xa861('0xa4')]=ut['totalGlobal'](_0x1ba827);ut['logCustomer'](_0x1ba827,0x4,_0xa861('0xc0'));rpcDb[_0xa861('0x97')](_0x1ba827,_0xa861('0xc1'));rpcDb['createCustomerFinal'](_0x1ba827,_0xa861('0xc2'));rpcDb[_0xa861('0xc3')](_0x1ba827);_0x3b90e7[_0xa861('0x30')]+=_0x1ba827[_0xa861('0xc4')];_0x3b90e7[_0xa861('0x2f')]+=_0x1ba827[_0xa861('0xc4')];logger['info'](_0xa861('0xc5'),_0x1ba827[_0xa861('0xb8')],'\x20Queue',_0x3b90e7[_0xa861('0x2b')],_0xa861('0x79'),_0x3b90e7[_0xa861('0x64')]);delete this[_0xa861('0x75')][_0xac8f09[_0xa861('0xb4')]];break;case _0xa861('0xc6'):_0x3b90e7[_0xa861('0x3f')]+=0x1;_0x1ba827[_0xa861('0xc7')]+=0x1;_0x1ba827['countglobal']=ut['totalGlobal'](_0x1ba827);ut['logCustomer'](_0x1ba827,0x5,'Busy');ami[_0xa861('0x28')](_0xa861('0xc8'),ut[_0xa861('0xa8')](_0x1ba827,_0xa861('0xc9')));rpcDb['createCustomerHistory'](_0x1ba827,_0xa861('0xca'));if(ut[_0xa861('0xa5')](_0x1ba827)>=_0x3b90e7['dialGlobalMaxRetry']){_0x4b3109=ut[_0xa861('0xac')](_0x1ba827,0xf,_0xa861('0xad'));rpcDb['createCustomerFinal'](_0x4b3109,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x1ba827['countbusyretry']>=_0x3b90e7['dialBusyMaxRetry']){rpcDb['createCustomerFinal'](_0x1ba827,_0xa861('0xca'));}else{rpcDb[_0xa861('0xb0')](ut[_0xa861('0xb1')](_0x1ba827,_0xa861('0xc7'),_0x3b90e7[_0xa861('0xcb')]),_0x1ba827[_0xa861('0xb3')],_0x1ba827[_0xa861('0xcc')]);}}break;case _0xa861('0xcd'):_0x3b90e7[_0xa861('0x43')]+=0x1;_0x1ba827[_0xa861('0xce')]+=0x1;_0x1ba827['countglobal']=ut[_0xa861('0xa5')](_0x1ba827);ut[_0xa861('0x93')](_0x1ba827,0x3,_0xa861('0xcf'));ami[_0xa861('0x28')](_0xa861('0xd0'),ut['buildObj'](_0x1ba827,_0xa861('0xd1')));rpcDb[_0xa861('0x97')](_0x1ba827,_0xa861('0xd2'));if(ut[_0xa861('0xa5')](_0x1ba827)>=_0x3b90e7[_0xa861('0xab')]){_0x4b3109=ut['cloneAction'](_0x1ba827,0xf,_0xa861('0xad'));rpcDb['createCustomerFinal'](_0x4b3109,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x1ba827[_0xa861('0xce')]>=_0x3b90e7[_0xa861('0xd3')]){rpcDb[_0xa861('0x9a')](_0x1ba827,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0xa861('0xb0')](ut[_0xa861('0xb1')](_0x1ba827,_0xa861('0xce'),_0x3b90e7['dialNoAnswerRetryFrequency']),_0x1ba827[_0xa861('0xb3')],_0x1ba827[_0xa861('0xcc')]);}}break;case _0xa861('0xd4'):_0x3b90e7[_0xa861('0x40')]+=0x1;_0x1ba827[_0xa861('0xd5')]+=0x1;_0x1ba827[_0xa861('0xa4')]=ut['totalGlobal'](_0x1ba827);ut['logCustomer'](_0x1ba827,0x8,_0xa861('0xd6'));ami[_0xa861('0x28')](_0xa861('0xd7'),ut[_0xa861('0xa8')](_0x1ba827,_0xa861('0xd8')));rpcDb[_0xa861('0x97')](_0x1ba827,_0xa861('0xd9'));if(ut[_0xa861('0xa5')](_0x1ba827)>=_0x3b90e7[_0xa861('0xab')]){_0x4b3109=ut[_0xa861('0xac')](_0x1ba827,0xf,_0xa861('0xad'));rpcDb['createCustomerFinal'](_0x4b3109,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x1ba827[_0xa861('0xd5')]>=_0x3b90e7[_0xa861('0xda')]){rpcDb[_0xa861('0x9a')](_0x1ba827,_0xa861('0xd9'));}else{rpcDb['rescheduleContact'](ut[_0xa861('0xb1')](_0x1ba827,_0xa861('0xd5'),_0x3b90e7[_0xa861('0xcb')]),_0x1ba827[_0xa861('0xb3')],_0x1ba827['activeContact']);}}break;case'CANCEL':_0x3b90e7[_0xa861('0x46')]+=0x1;_0x1ba827[_0xa861('0xdb')]+=0x1;_0x1ba827[_0xa861('0xa4')]=ut[_0xa861('0xa5')](_0x1ba827);ut[_0xa861('0x93')](_0x1ba827,0x14,_0xa861('0xdc'));ami[_0xa861('0x28')](_0xa861('0xdd'),ut['buildObj'](_0x1ba827,'agentreject'));rpcDb[_0xa861('0x97')](_0x1ba827,_0xa861('0xde'));if(ut[_0xa861('0xa5')](_0x1ba827)>=_0x3b90e7['dialGlobalMaxRetry']){_0x4b3109=ut[_0xa861('0xac')](_0x1ba827,0x14,'AgentReject');rpcDb['createCustomerFinal'](_0x4b3109,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x1ba827[_0xa861('0xdb')]>=_0x3b90e7['dialAgentRejectMaxRetry']){rpcDb[_0xa861('0x9a')](_0x1ba827,_0xa861('0xdf'));}else{rpcDb['rescheduleContact'](ut[_0xa861('0xb1')](_0x1ba827,_0xa861('0xdb'),_0x3b90e7[_0xa861('0xe0')]),_0x1ba827[_0xa861('0xb3')],_0x1ba827['activeContact']);}}break;case _0xa861('0xe1'):_0x3b90e7[_0xa861('0x48')]+=0x1;_0x1ba827[_0xa861('0xe2')]+=0x1;_0x1ba827[_0xa861('0xa4')]=ut['totalGlobal'](_0x1ba827);ut[_0xa861('0x93')](_0x1ba827,0xb,_0xa861('0xe3'));rpcDb['createCustomerHistory'](_0x1ba827,_0xa861('0xe4'));if(ut['totalGlobal'](_0x1ba827)>=_0x3b90e7['dialGlobalMaxRetry']){_0x4b3109=ut[_0xa861('0xac')](_0x1ba827,0xf,'Global');rpcDb[_0xa861('0x9a')](_0x4b3109,_0xa861('0xe4'));}else{if(_0x1ba827[_0xa861('0xe5')]>=_0x3b90e7['dialAbandonedMaxRety']){rpcDb[_0xa861('0x9a')](_0x1ba827,_0xa861('0xe4'));}else{rpcDb[_0xa861('0xb0')](ut['scheduledAt'](_0x1ba827,_0xa861('0xe2'),_0x3b90e7['dialAbandonedRetryFrequency']),_0x1ba827['unlockAgent'],_0x1ba827[_0xa861('0xcc')]);}}break;case'18':_0x3b90e7['outboundUnknownCallsDay']+=0x1;_0x1ba827[_0xa861('0xe6')]+=0x1;_0x1ba827['countglobal']=ut['totalGlobal'](_0x1ba827);ut['logCustomer'](_0x1ba827,0x12,_0xac8f09[_0xa861('0xe7')]||_0xac8f09[_0xa861('0xe8')]);ami['emit']('custom:amd',ut[_0xa861('0xa8')](_0x1ba827,'amd'));rpcDb['createCustomerHistory'](_0x1ba827,'[callProgressDetectingCustomer][hangupInAMD]');if(ut[_0xa861('0xa5')](_0x1ba827)>=_0x3b90e7[_0xa861('0xab')]){_0x4b3109=ut[_0xa861('0xac')](_0x1ba827,0xf,'Global');rpcDb['createCustomerFinal'](_0x4b3109,_0xa861('0xe9'));}else{rpcDb['createCustomerFinal'](_0x1ba827,_0xa861('0xe9'));}delete this[_0xa861('0x75')][_0xac8f09['linkedid']];break;case'19':_0x3b90e7['outboundUnknownCallsDay']+=0x1;_0x1ba827['countglobal']=ut[_0xa861('0xa5')](_0x1ba827);ut[_0xa861('0x93')](_0x1ba827,0x13,_0xac8f09['cause-txt']||_0xac8f09[_0xa861('0xe8')]);ami[_0xa861('0x28')](_0xa861('0xea'),ut[_0xa861('0xa8')](_0x1ba827,'amd'));rpcDb['createCustomerHistory'](_0x1ba827,_0xa861('0xeb'));if(ut[_0xa861('0xa5')](_0x1ba827)>=_0x3b90e7[_0xa861('0xab')]){_0x4b3109=ut[_0xa861('0xac')](_0x1ba827,0xf,_0xa861('0xad'));rpcDb['createCustomerFinal'](_0x4b3109,'[callProgressDetectingCustomer][machine]');}else{rpcDb['createCustomerFinal'](_0x1ba827,_0xa861('0xeb'));}delete this['actions'][_0xac8f09['linkedid']];break;default:if(_0x1ba827['dialAnswer']){ut[_0xa861('0xec')](_0x3b90e7,_0xa861('0xed'));ut[_0xa861('0x83')](_0xa861('0xee')+_0x3b90e7[_0xa861('0x2b')],_0xac8f09);}_0x3b90e7[_0xa861('0x47')]+=0x1;_0x1ba827[_0xa861('0xa4')]=ut[_0xa861('0xa5')](_0x1ba827);ut[_0xa861('0x93')](_0x1ba827,0xc,_0xac8f09[_0xa861('0xe7')]||_0xac8f09[_0xa861('0xe8')]);rpcDb['createCustomerHistory'](_0x1ba827,_0xa861('0xef'));if(ut[_0xa861('0xa5')](_0x1ba827)>=_0x3b90e7[_0xa861('0xab')]){_0x4b3109=ut[_0xa861('0xac')](_0x1ba827,0xf,_0xa861('0xad'));rpcDb[_0xa861('0x9a')](_0x4b3109,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0xa861('0x9a')](_0x1ba827,_0xa861('0xf0'));}delete this[_0xa861('0x75')][_0xac8f09[_0xa861('0xb4')]];}if(!(_0x1ba827[_0xa861('0x7a')]&&_0x5bab47==='16')){ut[_0xa861('0x82')](_0x3b90e7,_0xa861('0xf1'));logger[_0xa861('0x60')](_0xa861('0xf2'),_0x1ba827['uniqueid'],_0xa861('0xb9'),_0x3b90e7['name'],_0xa861('0x76'),_0x3b90e7[_0xa861('0x54')]);}if(_0x5bab47!==_0xa861('0xb5')){delete this[_0xa861('0x75')][_0xac8f09[_0xa861('0xb4')]];delete this[_0xa861('0x75')][_0xac8f09[_0xa861('0xf3')]];}}};Preview['prototype']['callProgressDetectingAgent']=function(_0x4ff73c,_0x2cdb56,_0xeeb0f1){if(_['isUndefined'](_0x2cdb56)&&_0xa861('0xf4')!==typeof _0x2cdb56){return;}if(_['isUndefined'](_0xeeb0f1)&&'object'!==typeof _0xeeb0f1){return;}switch(_0xeeb0f1[_0xa861('0xf5')]){case'0':ut['logAgent'](_0x4ff73c,0x0,'NoSuchNumber');rpcDb[_0xa861('0xf6')](_0x4ff73c,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0xa861('0xf7')](_0x4ff73c,0x3,_0xa861('0xcf'));rpcDb[_0xa861('0xf6')](_0x4ff73c,_0xa861('0xf8'));break;case'5':ut['logAgent'](_0x4ff73c,0x5,_0xa861('0xf9'));rpcDb[_0xa861('0xf6')](_0x4ff73c,_0xa861('0xfa'));break;case'8':ut[_0xa861('0xf7')](_0x4ff73c,0x8,'Congestion');rpcDb['createAgentHistory'](_0x4ff73c,_0xa861('0xfb'));break;case'22':ut[_0xa861('0xf7')](_0x4ff73c,0x16,_0xa861('0xfc'));rpcDb['createAgentHistory'](_0x4ff73c,_0xa861('0xfd'));break;default:ut[_0xa861('0xf7')](_0x4ff73c,0xc,_0xeeb0f1[_0xa861('0xf5')]);rpcDb[_0xa861('0xf6')](_0x4ff73c,_0xa861('0xfb'));}ut[_0xa861('0x82')](_0x2cdb56,_0xa861('0xfe'));logger['info'](_0xa861('0xff'),_0x4ff73c[_0xa861('0xb8')],'\x20Queue',_0x2cdb56['name'],_0xa861('0x76'),_0x2cdb56[_0xa861('0x54')]);delete this[_0xa861('0x75')][_0x4ff73c[_0xa861('0xb8')]];};Preview[_0xa861('0xf')][_0xa861('0x100')]=function(_0xf36760,_0x30be2d,_0x341b76,_0xa08c79,_0x3aac31){var _0x5957b7=this;return new BPromise(function(_0x1423d7,_0x54c342){if(_['isNil'](_0x30be2d)||_[_0xa861('0x72')](_0x30be2d[_0xa861('0x101')])||_[_0xa861('0x72')](_0x30be2d[_0xa861('0x101')]['phone'])||_['isNil'](_0x30be2d[_0xa861('0x7d')])){_0x54c342(ut[_0xa861('0x53')](_0xa861('0x102'),_0xa08c79,_0x3aac31));return;}var _0x3783d2=uuid['v4']();var _0x1ecdad=_0x5957b7['campaignsPreview'][_0x30be2d[_0xa861('0x74')][_0xa861('0x2b')]];var _0x1f038b=_0x341b76?_0x5957b7[_0xa861('0x17')][_0x341b76]['id']:undefined;_0x5957b7[_0xa861('0x75')][_0x3783d2]=new Action(_0x30be2d,_0x1ecdad,_0x3783d2,_0x341b76,_0x1f038b);var _0x59c0df=_0x5957b7['actions'][_0x3783d2];_0x59c0df[_0xa861('0xb3')]=_0xa08c79;_0x59c0df[_0xa861('0xcc')]=_0x3aac31;_0x59c0df[_0xa861('0x103')]=_0x341b76;if(_[_0xa861('0x104')](_0xf36760)){_0x5957b7[_0xa861('0x105')](_0x59c0df,_0x1ecdad,_0x30be2d,_0x341b76)[_0xa861('0x88')](function(_0x44d7a1){logger[_0xa861('0x60')]('[Preview][execCall][success]',_0xa861('0x106')+_0x59c0df[_0xa861('0x78')]+_0xa861('0x107')+_0x59c0df[_0xa861('0x108')],JSON[_0xa861('0x77')](_0x44d7a1));ami[_0xa861('0x28')](_0xa861('0x109'),ut[_0xa861('0xa8')](_0x59c0df,_0xa861('0x10a'),_0x5957b7['campaignsPreview'][_0x59c0df[_0xa861('0x78')]]));_0x1423d7(ut[_0xa861('0x53')](_0xa861('0x10b')));})[_0xa861('0x80')](function(_0x2bd9bf){ut[_0xa861('0x66')](_0xa861('0x10c'),_0x2bd9bf);_0x54c342(ut[_0xa861('0x53')](_0xa861('0x10d'),_0xa08c79,_0x3aac31));});}else{_0x1ecdad['outboundBlacklistCallsDay']+=0x1;ut[_0xa861('0x10e')](_0x59c0df);rpcDb['createHistory'](_0x59c0df,_0xa861('0x10f'));delete _0x5957b7['actions'][_0x3783d2];_0x54c342(ut[_0xa861('0x53')](_0xa861('0x110'),_0xa08c79,_0x3aac31));}});};Preview[_0xa861('0xf')]['isTrunkReachable']=function(_0x514e23){return!_[_0xa861('0x72')](_0x514e23)&&!_[_0xa861('0x72')](_0x514e23[_0xa861('0x2b')])&&!_[_0xa861('0x72')](_0x514e23[_0xa861('0x5a')])&&_0x514e23[_0xa861('0x5a')]&&!_[_0xa861('0x72')](this[_0xa861('0x16')][util[_0xa861('0x5d')](_0xa861('0x111'),_0x514e23['name'])])&&!_[_0xa861('0x72')](this['trunks'][util['format'](_0xa861('0x111'),_0x514e23[_0xa861('0x2b')])][_0xa861('0x112')])&&(this[_0xa861('0x16')][util[_0xa861('0x5d')]('SIP/%s',_0x514e23[_0xa861('0x2b')])][_0xa861('0x112')]===_0xa861('0x113')||this[_0xa861('0x16')][util[_0xa861('0x5d')]('SIP/%s',_0x514e23[_0xa861('0x2b')])][_0xa861('0x112')]===_0xa861('0x114'));};Preview['prototype'][_0xa861('0x8e')]=function(_0x59e82a,_0xa18afc){var _0x1e7f09=this;return new BPromise(function(_0x284fdf,_0x27a395){_0x1e7f09[_0xa861('0x115')](_0x59e82a,_0xa18afc)['then'](function(_0x4cacc8){_0x284fdf(_['pick'](_0x4cacc8,[_0xa861('0x53')]));})[_0xa861('0x80')](function(_0x27a8aa){if(_0x27a8aa[_0xa861('0x116')]){rpcDb['unlockContact'](_0x59e82a);}if(_0x27a8aa[_0xa861('0x5a')]){rpcDb[_0xa861('0x91')](_0x59e82a);}_0x27a395(_['pick'](_0x27a8aa,[_0xa861('0x53')]));});});};Preview[_0xa861('0xf')][_0xa861('0x115')]=function(_0x555ceb,_0x1976b2){var _0x1b542c=this;return new BPromise(function(_0x4bcd5d,_0x158783){var _0x3e0844,_0x4b439f;rpcDb[_0xa861('0x117')](_0x555ceb)[_0xa861('0x88')](function(_0x9a8e0d){if(!_['isNil'](_0x9a8e0d[0x0])){_0x4b439f=_0x9a8e0d[0x0][_0xa861('0x118')]?![]:!![];_0x3e0844=_0x9a8e0d[0x0][_0xa861('0x118')]?!![]:![];_0x3e0844=_0x1976b2?!![]:_0x3e0844;}var _0x57f5c8=_0x1b542c[_0xa861('0x119')](_0x9a8e0d);if(_0x57f5c8['isValid']){rpcDb['checkIsBlackList'](_['pick'](_0x9a8e0d[0x0],[_0xa861('0x7d'),_0xa861('0x11a')]))[_0xa861('0x88')](function(_0x589d8f){_0x1b542c['checkInBlack'](_0x589d8f,_0x9a8e0d[0x0],_0x1976b2,_0x4b439f,_0x3e0844)[_0xa861('0x88')](function(_0x436efb){_0x4bcd5d(_0x436efb);})[_0xa861('0x80')](function(_0x3f7d4f){_0x158783(_0x3f7d4f);});})[_0xa861('0x80')](function(_0x509363){ut[_0xa861('0x66')](_0xa861('0x11b'),_0x509363);_0x158783(ut['message'](_0xa861('0x11c'),_0x4b439f,_0x3e0844));});}else{_0x158783(ut[_0xa861('0x53')](_0x57f5c8[_0xa861('0x53')],_0x4b439f,_0x3e0844));}})[_0xa861('0x80')](function(_0x17fd0a){ut['logger'](_0xa861('0x11d'),_0x17fd0a);_0x158783(ut[_0xa861('0x53')](_0xa861('0x11c'),![],!![]));});});};Preview['prototype'][_0xa861('0x119')]=function(_0x42a0f2){if(_[_0xa861('0x72')](_0x42a0f2)||_[_0xa861('0x104')](_0x42a0f2)||!_[_0xa861('0x72')](_0x42a0f2[0x0]['Agent'])&&_[_0xa861('0x72')](_0x42a0f2[0x0][_0xa861('0x8d')]['name'])){ut[_0xa861('0x66')](_0xa861('0x11e'),_0x42a0f2);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x22f5f3=this[_0xa861('0x14')][_0x42a0f2[0x0][_0xa861('0x74')][_0xa861('0x2b')]];_0x22f5f3['message']=_0xa861('0x11f');if(_[_0xa861('0x72')](_0x22f5f3)){ut[_0xa861('0x66')]('[Preview][validateContact][Empty\x20Campaign]',_0x22f5f3);return{'isValid':![],'message':_0xa861('0x120')};}if(!this[_0xa861('0x9f')](_0x22f5f3['Trunk'])){ut[_0xa861('0x66')](_0xa861('0x121'),'campaign\x20Name:\x20'+_0x22f5f3[_0xa861('0x2b')]+_0xa861('0x122'));if(!this['isTrunkReachable'](_0x22f5f3['TrunkBackup'])){ut[_0xa861('0x66')](_0xa861('0x121'),_0x22f5f3['name']+_0xa861('0x123'));return{'isValid':![],'message':_0xa861('0x124')};}}if(!ut[_0xa861('0x9e')](_0x22f5f3[_0xa861('0x38')])){ut[_0xa861('0x66')](_0xa861('0x125'),_0x22f5f3[_0xa861('0x2b')]+_0xa861('0x126'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x22f5f3[_0xa861('0x2b')]+_0xa861('0x126')};}return{'isValid':!![],'message':_0xa861('0x127')};};Preview[_0xa861('0xf')][_0xa861('0x105')]=function(_0x57db9f,_0x1b79fd,_0x4b34e1,_0x3e8ddd){var _0x310177=this;return new BPromise(function(_0x2f4ea7,_0x1e0300){var _0x1ba16e=_0x57db9f[_0xa861('0xb8')];var _0x2245f6=_0x310177['isTrunkReachable'](_0x1b79fd[_0xa861('0x59')])?util[_0xa861('0x5d')](_0xa861('0x128'),_0x1b79fd[_0xa861('0x59')][_0xa861('0x2b')],_['isNil'](_0x1b79fd[_0xa861('0x3c')])?'':_0x1b79fd[_0xa861('0x3c')][_0xa861('0x129')]()||'',_0x1b79fd[_0xa861('0x12a')]>0x0?_0x4b34e1[_0xa861('0x101')]['phone'][_0xa861('0x12b')](_0x1b79fd[_0xa861('0x12a')]):_0x4b34e1[_0xa861('0x101')][_0xa861('0x12c')]):util[_0xa861('0x5d')](_0xa861('0x128'),_[_0xa861('0x72')](_0x1b79fd[_0xa861('0xa0')])?_0x1b79fd[_0xa861('0x59')][_0xa861('0x2b')]:_0x1b79fd[_0xa861('0xa0')][_0xa861('0x2b')],_['isNil'](_0x1b79fd['dialPrefix'])?'':_0x1b79fd['dialPrefix'][_0xa861('0x129')]()||'',_0x1b79fd[_0xa861('0x12a')]>0x0?_0x4b34e1[_0xa861('0x101')][_0xa861('0x12c')][_0xa861('0x12b')](_0x1b79fd[_0xa861('0x12a')]):_0x4b34e1['Contact']['phone']);var _0x3fa21e=_0x310177[_0xa861('0x9f')](_0x1b79fd['Trunk'])?ut[_0xa861('0x12d')](_0x1b79fd[_0xa861('0x59')][_0xa861('0x12e')],_0x1b79fd[_0xa861('0x12f')],_0x1b79fd[_0xa861('0x130')]>0x0?ut['getCallerIdRandom'](_0x1b79fd[_0xa861('0x3a')],_0x1b79fd[_0xa861('0x130')]):_0x1b79fd[_0xa861('0x3a')]):ut[_0xa861('0x12d')](_['isNil'](_0x1b79fd[_0xa861('0xa0')])?_0x1b79fd['Trunk'][_0xa861('0x12e')]:_0x1b79fd[_0xa861('0xa0')][_0xa861('0x12e')],_0x1b79fd[_0xa861('0x12f')],_0x1b79fd[_0xa861('0x130')]>0x0?ut['getCallerIdRandom'](_0x1b79fd[_0xa861('0x3a')],_0x1b79fd[_0xa861('0x130')]):_0x1b79fd[_0xa861('0x3a')]);if(_0x3fa21e){_0x57db9f[_0xa861('0x131')]=ut[_0xa861('0x132')](_0x3fa21e);_0x57db9f[_0xa861('0x133')]=ut['extractCalleridNumber'](_0x3fa21e);}var _0x26952f=ut[_0xa861('0x134')](_0x1b79fd,_0x4b34e1,_0x2245f6,_0x3fa21e,_0x1ba16e,_0x57db9f);_[_0xa861('0x135')](_0x57db9f,ut[_0xa861('0x136')](_0x26952f));_0x57db9f[_0xa861('0x92')]=moment()[_0xa861('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0xa861('0x7e')](ut[_0xa861('0x137')](_0x57db9f,_0x1b79fd,_0x26952f,_0x57db9f[_0xa861('0xcc')],_0x3e8ddd))[_0xa861('0x88')](function(_0x4b3593){var _0x5472fe=_0x57db9f[_0xa861('0x138')];if(!_[_0xa861('0x72')](_0x5472fe)){if(!_[_0xa861('0x72')](_0x310177[_0xa861('0x17')][_0x5472fe])){_0x310177['agents'][_0x5472fe][_0xa861('0x139')]=_0x57db9f[_0xa861('0x13a')];emit(util[_0xa861('0x5d')](_0xa861('0x13b'),_0x310177[_0xa861('0x17')][_0x5472fe][_0xa861('0x2b')]),_0xa861('0x13c'),{'destaccountcode':_0x310177['agents'][_0x5472fe][_0xa861('0x13d')],'destconnectedlinenum':_0x57db9f[_0xa861('0x13a')]});}}_0x1b79fd[_0xa861('0x54')]+=0x1;logger[_0xa861('0x60')](_0xa861('0x13e'),_0x1ba16e,_0xa861('0xb9'),_0x1b79fd[_0xa861('0x2b')],_0xa861('0x76'),_0x1b79fd[_0xa861('0x54')]);_0x2f4ea7(_0x4b3593);})[_0xa861('0x80')](function(_0x18aff4){ut['logAgent'](_0x57db9f,0xe,_0xa861('0x13f'));rpcDb[_0xa861('0xf6')](_0x57db9f,'[originateFailure][logOriginateFailure]');_0x1e0300(_0x18aff4);});});};Preview[_0xa861('0xf')][_0xa861('0x21')]=function(_0x22e0d4){if(this['actions'][_0x22e0d4[_0xa861('0xb4')]]){this['actions'][_0x22e0d4[_0xa861('0xb4')]][_0xa861('0x7f')]=_0x22e0d4[_0xa861('0x7f')];}};Preview['prototype'][_0xa861('0x140')]=function(_0x5a051a){var _0x4d4755=this;var _0x29d005=this['actions'][_0x5a051a[_0xa861('0x141')]];if(_0x29d005){if(_0x29d005['lookAgent']&&this[_0xa861('0x17')][_0x29d005[_0xa861('0x103')]]){ut[_0xa861('0x142')](_0x29d005,this['agents'][_0x29d005[_0xa861('0x103')]][_0xa861('0x2b')],this[_0xa861('0x17')][_0x29d005[_0xa861('0x103')]]['id']);}var _0x3809d1=_[_0xa861('0x143')](_0x29d005);_0x3809d1[_0xa861('0x144')]=moment()['format'](_0xa861('0x145'));var _0x881297=_0x4d4755[_0xa861('0x14')][_0x29d005[_0xa861('0x78')]];if(ut[_0xa861('0x146')](_0x5a051a[_0xa861('0x147')])){if(_0x29d005[_0xa861('0xb3')]){rpcDb[_0xa861('0x148')](_0x29d005['idContact']);}if(_0x29d005[_0xa861('0xcc')]){rpcDb[_0xa861('0x91')](_0x29d005['idContact']);}ami[_0xa861('0x28')](_0xa861('0x149'),ut[_0xa861('0xa8')](_0x29d005,_0xa861('0x14a'),this[_0xa861('0x14')][_0x29d005[_0xa861('0x78')]]));this[_0xa861('0x14b')](_0x3809d1,_0x881297,_0x5a051a);}else{_0x29d005[_0xa861('0x92')]=moment()[_0xa861('0x5d')](_0xa861('0x145'));ut[_0xa861('0xf7')](_0x3809d1,0x4,_0xa861('0xc0'));rpcDb[_0xa861('0xf6')](_0x3809d1,_0xa861('0x14c'));}}};Preview['prototype'][_0xa861('0x1c')]=function(_0x350095){var _0x1fd677=this;var _0x503ab4=this[_0xa861('0x75')][_0x350095[_0xa861('0xb4')]];var _0x1d471f;if(_0x503ab4){_0x1d471f=this[_0xa861('0x14')][_0x503ab4[_0xa861('0x78')]];logger[_0xa861('0x60')](_0xa861('0x14d'),_0x350095[_0xa861('0xb4')],'\x20Queue',_0x1d471f[_0xa861('0x2b')],_0xa861('0x79'),_0x1d471f[_0xa861('0x64')]);}if(this[_0xa861('0x75')][_0x350095[_0xa861('0xb4')]]&&_0x350095[_0xa861('0xb4')]!==_0x350095[_0xa861('0xb8')]){if(_0x350095[_0xa861('0x14e')]==='16'&&this['actions'][_0x350095[_0xa861('0xb4')]]['dialAnswer']){this[_0xa861('0xa1')](_0x350095,_0x350095[_0xa861('0xb4')],_0x350095[_0xa861('0x14e')]);}else if(this[_0xa861('0x75')][_0x350095[_0xa861('0xb4')]]['dialAnswer']){logger['info']('[syncHangup][talking][cause]',_0x350095['linkedid'],_0x350095['cause'],_0xa861('0xb9'),_0x1d471f['name'],_0xa861('0x79'),_0x1d471f[_0xa861('0x64')]);this[_0xa861('0xa1')](_0x350095,_0x350095['linkedid'],_0x350095[_0xa861('0x14e')]);}}else if(_0x503ab4&&_['isNil'](_0x503ab4[_0xa861('0x14f')])&&_0x1d471f[_0xa861('0x150')]&&_0x350095[_0xa861('0xb4')]===_0x350095['uniqueid']&&_[_0xa861('0x72')](_0x350095[_0xa861('0xf5')])&&_0x350095[_0xa861('0x14e')]==='16'&&_0x350095[_0xa861('0x151')]==='6'&&_['isUndefined'](_0x503ab4[_0xa861('0x152')])){if(_0x503ab4[_0xa861('0xb3')]){rpcDb[_0xa861('0x148')](_0x503ab4[_0xa861('0x108')]);}if(_0x503ab4[_0xa861('0xcc')]){rpcDb[_0xa861('0x91')](_0x503ab4[_0xa861('0x108')]);}_0x350095[_0xa861('0xf5')]='22';this[_0xa861('0x14b')](_0x503ab4,_0x1d471f,_0x350095);}else if(_0x503ab4&&_0x503ab4['transfer']){if(_0x350095['cause']==='16'&&this['actions'][_0x350095[_0xa861('0xb4')]][_0xa861('0x7a')]){logger[_0xa861('0x60')](_0xa861('0x153'),_0x350095[_0xa861('0xb4')],_0x350095[_0xa861('0x14e')],_0xa861('0xb9'),_0x1d471f[_0xa861('0x2b')],_0xa861('0x79'),_0x1d471f['pTalking']);this[_0xa861('0xa1')](_0x350095,_0x350095['linkedid'],_0x350095[_0xa861('0x14e')]);}else if(this['actions'][_0x350095[_0xa861('0xb4')]][_0xa861('0x7a')]){logger['info']('[syncHangup][talking][cause]',_0x350095['linkedid'],_0x350095[_0xa861('0x14e')],_0xa861('0xb9'),_0x1d471f[_0xa861('0x2b')],_0xa861('0x79'),_0x1d471f[_0xa861('0x64')]);this[_0xa861('0xa1')](_0x350095,_0x350095[_0xa861('0xb4')],_0x350095[_0xa861('0x14e')]);}}};Preview[_0xa861('0xf')][_0xa861('0x1f')]=function(_0x11f646){if(this[_0xa861('0x75')][_0x11f646['destlinkedid']]&&_0x11f646['destlinkedid']!==_0x11f646[_0xa861('0x154')]){this[_0xa861('0xa1')](_0x11f646,_0x11f646[_0xa861('0xf3')],_0x11f646[_0xa861('0xe8')]);}};Preview[_0xa861('0xf')]['syncHangupRequest']=function(_0x4e90d3){if(this[_0xa861('0x75')][_0x4e90d3[_0xa861('0xb4')]]&&_0x4e90d3[_0xa861('0xb4')]!==_0x4e90d3[_0xa861('0xb8')]&&!this[_0xa861('0x75')][_0x4e90d3['linkedid']][_0xa861('0x7a')]){if(_0x4e90d3[_0xa861('0x14e')]==='1'){this[_0xa861('0xa1')](_0x4e90d3,_0x4e90d3[_0xa861('0xb4')],_0x4e90d3[_0xa861('0x14e')]);}}};Preview[_0xa861('0xf')]['addVariable']=function(_0xcec90f,_0x2b2607,_0x48e195){if(this[_0xa861('0x75')][_0xcec90f]){if(_[_0xa861('0x72')](this[_0xa861('0x75')][_0xcec90f][_0xa861('0x155')])){this[_0xa861('0x75')][_0xcec90f][_0xa861('0x155')]={};}this[_0xa861('0x75')][_0xcec90f][_0xa861('0x155')][_0x2b2607]=_0x48e195;}};Preview[_0xa861('0xf')][_0xa861('0x22')]=function(_0x1ca5df){try{if(!_[_0xa861('0x72')](_0x1ca5df)){if(ut[_0xa861('0x156')](_['keys'](_0x1ca5df[_0xa861('0x157')])[0x0])){this[_0xa861('0x158')](_0x1ca5df[_0xa861('0xb8')],_[_0xa861('0x159')](_0x1ca5df[_0xa861('0x157')])[0x0],_0x1ca5df[_0xa861('0x15a')]);}}}catch(_0x252296){logger[_0xa861('0x15b')](_0xa861('0x15c'),util[_0xa861('0x15d')](_0x252296,{'showHidden':![],'depth':null}));}};Preview[_0xa861('0xf')][_0xa861('0x24')]=function(_0x59f84f){if(_0x59f84f){if(this['actions'][_0x59f84f['transfertargetlinkedid']]){this['actions'][_0x59f84f[_0xa861('0x15e')]][_0xa861('0x152')]=!![];}}};Preview['prototype'][_0xa861('0x26')]=function(_0x3a0994){if(_0x3a0994){if(this[_0xa861('0x75')][_0x3a0994[_0xa861('0x15f')]]){this[_0xa861('0x75')][_0x3a0994[_0xa861('0x15f')]][_0xa861('0x152')]=!![];}}};module[_0xa861('0x160')]=Preview; \ No newline at end of file +var _0x5862=['dialRandomLastDigitCallerIdNumber','originatecalleridname','extractCalleridName','addVariables','merge','toLowerVariables','destconnectedlinenum','user:%s','user:agentconnect','calleridnum','[originated][increment]','OriginateError','actionid','lookAgent','responsetime','isFailure','response','custom:agentringnoanswer','rejected','Answer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','[syncHangup][talking][cause]','cause','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','variables','syncVarSet','filterKey','variable','keys','transfertargetlinkedid','transfererlinkedid','exports','util','uuid','moment','md5','../../../config/environment','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','redis','localhost','prototype','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','syncOriginateResponse','bind','hangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','emit','outbound','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','type','abandoned','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','name','stringify','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','voice_queue_channel:remove','voice_queue_presence:remove','paused','message','NOT_ACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','preview','booked','clearZombieChannels','setMessage','recallMe','isNil','[clearZombieChannels][talking]','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','status','channel','catch','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','hasOwnProperty','clearZombieChannel','agentReadyId','then','length','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','[RecallMe]','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','sendMessageOneNotActive','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','callProgressDetectingCustomer','countnosuchnumberretry','totalGlobal','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','createCustomerFinal','rescheduleContact','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','ANSWER','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','countglobal','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','[syncHangup][talking][decrement]','linkedid','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','scheduledAt','dialBusyRetryFrequency','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','dialstatus','[callProgressDetectingCustomer][hangupInAMD]','custom:amd','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','NoSuchNumber','[callProgressDetectingAgent][logNoSuch]','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','Congestion','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','Queue','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Calling','logger','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','Call\x20unsuccessful','isEmpty','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','trim','dialCutDigit','substring','SIP/%s/%s%s','getCallerId','getCallerIdRandom'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x5862,0x17e));var _0x2586=function(_0x575d3d,_0x1b92d7){_0x575d3d=_0x575d3d-0x0;var _0x49e231=_0x5862[_0x575d3d];return _0x49e231;};'use strict';var util=require(_0x2586('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0x2586('0x1'));var moment=require(_0x2586('0x2'));var md5=require(_0x2586('0x3'));var Redis=require('ioredis');var config=require(_0x2586('0x4'));var logger=require(_0x2586('0x5'))('preview');var loggerAction=require(_0x2586('0x5'))(_0x2586('0x6'));var ami=require(_0x2586('0x7'));var rpcDb=require(_0x2586('0x8'));var Action=require(_0x2586('0x9'));var ut=require(_0x2586('0xa'));config[_0x2586('0xb')]=_['defaults'](config[_0x2586('0xb')],{'host':_0x2586('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2586('0xb')]));var Sequence=function(){};Sequence[_0x2586('0xd')]['enqueue']=function(_0x1aa56e){this['tail']=this[_0x2586('0xe')]?this[_0x2586('0xe')][_0x2586('0xf')](_0x1aa56e):_0x1aa56e();};function Preview(_0xa75e69){this[_0x2586('0x10')]=new Sequence();this[_0x2586('0x11')]=_0xa75e69[_0x2586('0x12')];this[_0x2586('0x13')]=_0xa75e69[_0x2586('0x13')];this[_0x2586('0x14')]={};this[_0x2586('0x15')]=_0xa75e69['agents'];this[_0x2586('0x16')]=0x0;ami['on']('originateresponse',this[_0x2586('0x17')][_0x2586('0x18')](this));ami['on'](_0x2586('0x19'),this['syncHangup']['bind'](this));ami['on'](_0x2586('0x1a'),this[_0x2586('0x1b')][_0x2586('0x18')](this));ami['on'](_0x2586('0x1c'),this[_0x2586('0x1d')]['bind'](this));ami['on'](_0x2586('0x1e'),this[_0x2586('0x1f')][_0x2586('0x18')](this));ami['on']('varset',this['syncVarSet'][_0x2586('0x18')](this));ami['on'](_0x2586('0x20'),this[_0x2586('0x21')][_0x2586('0x18')](this));ami['on']('blindtransfer',this[_0x2586('0x22')]['bind'](this));this[_0x2586('0x23')](this[_0x2586('0x11')]);}function emit(_0x12efce,_0x32279f,_0x3c0eb7){io['to'](_0x12efce)[_0x2586('0x24')](_0x32279f,_0x3c0eb7);}function emitCampaignPreview(_0x313d8a){if(_0x313d8a['type']===_0x2586('0x25')){var _0xce3dde={'id':_0x313d8a['id'],'name':_0x313d8a['name'],'strategy':_0x313d8a[_0x2586('0x26')],'answered':_0x313d8a[_0x2586('0x27')],'available':_0x313d8a[_0x2586('0x28')],'loggedIn':_0x313d8a[_0x2586('0x29')],'pTalking':_0x313d8a[_0x2586('0x2a')],'sumBillable':_0x313d8a[_0x2586('0x2b')],'sumDuration':_0x313d8a[_0x2586('0x2c')],'sumHoldTime':_0x313d8a[_0x2586('0x2d')]||0x0,'talking':_0x313d8a[_0x2586('0x2e')],'total':_0x313d8a[_0x2586('0x2f')],'type':_0x313d8a[_0x2586('0x30')],'unmanaged':_0x313d8a['unmanaged'],'abandoned':_0x313d8a[_0x2586('0x31')],'waiting':_0x313d8a['waiting'],'loggedInDb':_0x313d8a['loggedInDb'],'dialActive':_0x313d8a[_0x2586('0x32')],'dialMethod':_0x313d8a[_0x2586('0x33')],'dialOriginateCallerIdName':_0x313d8a[_0x2586('0x34')],'dialOriginateCallerIdNumber':_0x313d8a[_0x2586('0x35')],'dialOriginateTimeout':_0x313d8a[_0x2586('0x36')],'dialPrefix':_0x313d8a[_0x2586('0x37')],'outboundAnswerAgiCallsDay':_0x313d8a['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x313d8a[_0x2586('0x38')],'outboundBlacklistCallsDay':_0x313d8a[_0x2586('0x39')],'outboundBusyCallsDay':_0x313d8a[_0x2586('0x3a')],'outboundCongestionCallsDay':_0x313d8a[_0x2586('0x3b')],'outboundDropCallsDayACS':_0x313d8a['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x313d8a['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x313d8a[_0x2586('0x3c')],'outboundNoAnswerCallsDay':_0x313d8a['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x313d8a[_0x2586('0x3d')],'outboundOriginateFailureCallsDay':_0x313d8a[_0x2586('0x3e')],'outboundReCallsDay':_0x313d8a[_0x2586('0x3f')],'outboundRejectCallsDay':_0x313d8a[_0x2586('0x40')],'outboundUnknownCallsDay':_0x313d8a[_0x2586('0x41')],'outboundAbandonedCallsDay':_0x313d8a['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x313d8a[_0x2586('0x42')],'predictiveIntervalAvgHoldtime':_0x313d8a[_0x2586('0x43')],'predictiveIntervalAvgTalktime':_0x313d8a[_0x2586('0x44')],'predictiveIntervalDroppedCallsCallersExit':_0x313d8a[_0x2586('0x45')],'predictiveIntervalDroppedCallsTimeout':_0x313d8a[_0x2586('0x46')],'predictiveIntervalErlangCalls':_0x313d8a[_0x2586('0x47')],'predictiveIntervalErlangCallsDroppedCalls':_0x313d8a['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x313d8a[_0x2586('0x48')],'predictiveIntervalMultiplicativeFactor':_0x313d8a['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x313d8a[_0x2586('0x49')],'predictiveIntervalAvailable':_0x313d8a[_0x2586('0x4a')],'predictiveIntervalTotalCalls':_0x313d8a['predictiveIntervalTotalCalls'],'message':_0x313d8a['message'],'originated':_0x313d8a[_0x2586('0x4b')],'erlangCalls':_0x313d8a[_0x2586('0x4c')],'erlangCallToSecond':_0x313d8a[_0x2586('0x4d')],'erlangAbandonmentRate':_0x313d8a['erlangAbandonmentRate'],'erlangBusyFactor':_0x313d8a[_0x2586('0x4e')],'startPredictive':_0x313d8a[_0x2586('0x4f')],'startProgressive':_0x313d8a[_0x2586('0x50')]};if(_0x313d8a['Trunk']){_0xce3dde[_0x2586('0x51')]={'id':_0x313d8a[_0x2586('0x51')]['id'],'name':_0x313d8a[_0x2586('0x51')]['name'],'active':_0x313d8a['Trunk'][_0x2586('0x52')],'callerid':_0x313d8a[_0x2586('0x51')][_0x2586('0x53')]};}if(_0x313d8a['Interval']){_0xce3dde[_0x2586('0x54')]={'id':_0x313d8a['Interval']['id'],'name':_0x313d8a['Interval'][_0x2586('0x55')]};}var _0x110a2c=md5(JSON[_0x2586('0x56')](_0xce3dde));if(_0x313d8a['md5']!==_0x110a2c){_0x313d8a[_0x2586('0x3')]=_0x110a2c;emit(util['format'](_0x2586('0x57'),_0xce3dde[_0x2586('0x55')]),_0x2586('0x58'),_0xce3dde);}}}function emitVoiceQueueChannelRemove(_0x23d9e2){logger[_0x2586('0x59')](_0x2586('0x5a'),JSON['stringify'](_0x23d9e2));emit(util[_0x2586('0x5b')](_0x2586('0x57'),_0x23d9e2['name']),_0x2586('0x5c'),_0x23d9e2);io[_0x2586('0x24')](_0x2586('0x5d'),_0x23d9e2);}function notSendMessagesQueue(_0x409215){if(_0x409215['sendMessageOneNotActive']){if(_0x409215[_0x2586('0x4b')]===0x0&&_0x409215[_0x2586('0x2a')]===0x0){_0x409215['sendMessageOneNotActive']=![];_0x409215[_0x2586('0x28')]=0x0;_0x409215[_0x2586('0x5e')]=0x0;_0x409215[_0x2586('0x5f')]=_0x2586('0x60');ut['logger'](_0x2586('0x61'),_0x409215[_0x2586('0x55')]+_0x2586('0x62'));}else{_0x409215['message']=_0x2586('0x63');ut['logger'](_0x2586('0x61'),_0x409215[_0x2586('0x55')]+_0x2586('0x64'));}emitCampaignPreview(_0x409215);}}Preview[_0x2586('0xd')]['loopCampaigns']=function(){var _0x40cf07=this;setInterval(function(){_0x40cf07['syncCampaigns']();},0x7cf);};Preview[_0x2586('0xd')][_0x2586('0x65')]=function(){var _0x32c4d6=this[_0x2586('0x11')];this['clockClearZombieChannels']+=0x1;for(var _0x5de44a in _0x32c4d6){if(_0x32c4d6['hasOwnProperty'](_0x5de44a)&&(_0x32c4d6[_0x5de44a][_0x2586('0x33')]===_0x2586('0x66')||_0x32c4d6[_0x5de44a][_0x2586('0x33')]===_0x2586('0x67'))&&_0x32c4d6[_0x5de44a][_0x2586('0x30')]===_0x2586('0x25')){if(this[_0x2586('0x16')]>0x7){this['clockClearZombieChannels']=0x0;this[_0x2586('0x68')]();}}if(_0x32c4d6['hasOwnProperty'](_0x5de44a)&&_0x32c4d6[_0x5de44a][_0x2586('0x33')]===_0x2586('0x66')&&_0x32c4d6[_0x5de44a][_0x2586('0x30')]===_0x2586('0x25')){if(_0x32c4d6[_0x5de44a]['dialActive']){this[_0x2586('0x69')](_0x32c4d6[_0x5de44a]);this[_0x2586('0x6a')](_0x32c4d6[_0x5de44a]);}else{notSendMessagesQueue(_0x32c4d6[_0x5de44a]);}}}};Preview[_0x2586('0xd')]['clearZombieChannel']=function(_0x4d1700){var _0x54730a=this;this[_0x2586('0x10')]['enqueue'](function(){if(!_[_0x2586('0x6b')](_0x54730a[_0x2586('0x14')][_0x4d1700])){loggerAction[_0x2586('0x59')](_0x2586('0x6c'),_0x4d1700,'Queue',_0x54730a[_0x2586('0x14')][_0x4d1700][_0x2586('0x6d')],_0x2586('0x6e'),JSON[_0x2586('0x56')](_0x54730a['campaignsPreview'][_0x54730a[_0x2586('0x14')][_0x4d1700][_0x2586('0x6d')]][_0x2586('0x4b')]),_0x2586('0x6f'),JSON[_0x2586('0x56')](_0x54730a[_0x2586('0x11')][_0x54730a['actions'][_0x4d1700][_0x2586('0x6d')]][_0x2586('0x2a')]),JSON[_0x2586('0x56')](_0x54730a[_0x2586('0x14')][_0x4d1700][_0x2586('0x70')]),JSON[_0x2586('0x56')](_[_0x2586('0x71')](_0x54730a['actions'][_0x4d1700],[_0x2586('0x72'),_0x2586('0x73'),_0x2586('0x74'),_0x2586('0x75')])));return ami['Action']({'action':_0x2586('0x76'),'channel':_0x54730a[_0x2586('0x14')][_0x4d1700][_0x2586('0x77')]})[_0x2586('0x78')](function(_0x56746e){if(_0x56746e[_0x2586('0x5f')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x54730a['actions'][_0x4d1700]){ut[_0x2586('0x79')](_0x54730a[_0x2586('0x11')][_0x54730a[_0x2586('0x14')][_0x4d1700][_0x2586('0x6d')]],_0x2586('0x7a'));if(_0x54730a[_0x2586('0x14')][_0x4d1700][_0x2586('0x70')]===!![]){ut[_0x2586('0x7b')](_0x54730a[_0x2586('0x11')][_0x54730a[_0x2586('0x14')][_0x4d1700]['queue']],_0x2586('0x7a'));ut[_0x2586('0x7c')](_0x2586('0x7d')+_0x4d1700,_0x54730a[_0x2586('0x14')][_0x4d1700][_0x2586('0x6d')]);}ut['loggerError'](_0x2586('0x7e')+_0x4d1700,_0x54730a[_0x2586('0x14')][_0x4d1700][_0x2586('0x6d')]);delete _0x54730a[_0x2586('0x14')][_0x4d1700];}},0x2328);}});}});};Preview[_0x2586('0xd')][_0x2586('0x68')]=function(){var _0x16ee7a=this;loggerAction['info'](_0x2586('0x7f'),_['size'](this[_0x2586('0x14')]));for(var _0x1a0d9e in this[_0x2586('0x14')]){if(_0x16ee7a[_0x2586('0x14')][_0x2586('0x80')](_0x1a0d9e)){_0x16ee7a[_0x2586('0x81')](_0x1a0d9e);}}};Preview[_0x2586('0xd')][_0x2586('0x6a')]=function(_0x1d509c){var _0x194391=this;rpcDb['getContactRecallMe'](_0x1d509c['id'],ut[_0x2586('0x82')](this[_0x2586('0x15')]))[_0x2586('0x83')](function(_0x275389){if(!_[_0x2586('0x6b')](_0x275389)){for(var _0x156908=0x0;_0x156908<_0x275389[_0x2586('0x84')];_0x156908+=0x1){if(ut['getDiff'](_0x275389[_0x156908][_0x2586('0x85')])<_0x1d509c[_0x2586('0x86')]*0x3c){if(_0x275389[_0x156908][_0x2586('0x87')]&&!_0x275389[_0x156908]['Agent'][_0x2586('0x88')]){_0x194391[_0x2586('0x89')](_0x275389[_0x156908]['id'])[_0x2586('0x83')](ut['logger2'](_0x2586('0x8a')))['catch'](ut[_0x2586('0x8b')](_0x2586('0x8a')));}else{rpcDb[_0x2586('0x8c')](_0x275389[_0x156908]['id']);}}else{var _0x398611=new Action(_0x275389[_0x156908],_0x1d509c);_0x398611[_0x2586('0x8d')]=moment()[_0x2586('0x5b')](_0x2586('0x8e'));_0x1d509c[_0x2586('0x3f')]+=0x1;ut[_0x2586('0x8f')](_0x398611,0x17,'RecallInQueue');if(_0x1d509c['dialRecallInQueue']){rpcDb['rescheduleContactInQueue'](ut[_0x2586('0x90')](_0x275389[_0x156908]));rpcDb[_0x2586('0x91')](_0x398611,_0x2586('0x92'));}else{ut[_0x2586('0x8f')](_0x398611,0x16,_0x2586('0x93'));rpcDb[_0x2586('0x91')](_0x398611,_0x2586('0x94'));rpcDb['createCustomerFinal'](_0x398611,_0x2586('0x94'));}}}}})[_0x2586('0x78')](ut[_0x2586('0x8b')](_0x2586('0x95')));};Preview['prototype'][_0x2586('0x69')]=function(_0x3bfb13){_0x3bfb13[_0x2586('0x96')]=!![];if(ut['IsNotLoggedIn'](_0x3bfb13[_0x2586('0x29')])){_0x3bfb13[_0x2586('0x5f')]=_0x2586('0x97');}else if(!ut[_0x2586('0x98')](_0x3bfb13[_0x2586('0x32')])){_0x3bfb13[_0x2586('0x5f')]=_0x2586('0x60');}else if(!this[_0x2586('0x99')](_0x3bfb13['Trunk'])){if(!this['isTrunkReachable'](_0x3bfb13[_0x2586('0x9a')])){_0x3bfb13[_0x2586('0x5f')]=_0x2586('0x9b');}else{_0x3bfb13[_0x2586('0x5f')]='ACTIVE';}}else{_0x3bfb13['message']='ACTIVE';}emitCampaignPreview(_0x3bfb13);};Preview[_0x2586('0xd')][_0x2586('0x9c')]=function(_0x37191f,_0x1bc6ca,_0x3bfbfd){var _0x1fde07=this;var _0x36e140=this['actions'][_0x1bc6ca];var _0x439b97=this[_0x2586('0x11')][_0x36e140[_0x2586('0x6d')]];var _0x34f5c4;if(_0x439b97){switch(_0x3bfbfd){case'1':_0x439b97[_0x2586('0x3d')]+=0x1;_0x36e140[_0x2586('0x9d')]+=0x1;_0x36e140['countglobal']=ut[_0x2586('0x9e')](_0x36e140);ut[_0x2586('0x8f')](_0x36e140,0x0,'NoSuchNumber');ami[_0x2586('0x24')]('custom:agentnosuchnumber',ut[_0x2586('0x9f')](_0x36e140,_0x2586('0xa0')));rpcDb['createCustomerHistory'](_0x36e140,_0x2586('0xa1'));if(ut[_0x2586('0x9e')](_0x36e140)>=_0x439b97[_0x2586('0xa2')]){_0x34f5c4=ut[_0x2586('0xa3')](_0x36e140,0xf,_0x2586('0xa4'));rpcDb['createCustomerFinal'](_0x34f5c4,_0x2586('0xa5'));}else{if(_0x36e140['countnosuchnumberretry']>=_0x439b97[_0x2586('0xa6')]){rpcDb[_0x2586('0xa7')](_0x36e140,_0x2586('0xa5'));}else{rpcDb[_0x2586('0xa8')](ut['scheduledAt'](_0x36e140,_0x2586('0x9d'),_0x439b97[_0x2586('0xa9')]),_0x36e140[_0x2586('0xaa')],_0x36e140[_0x2586('0xab')]);}}delete this[_0x2586('0x14')][_0x37191f['linkedid']];break;case _0x2586('0xac'):var _0x3b0308=moment()['format'](_0x2586('0x8e'));_0x36e140['responsetime']=_0x3b0308;_0x36e140[_0x2586('0xad')]=_0x3b0308;_0x36e140['dialAnswer']=!![];_0x439b97['pTalking']+=0x1;logger[_0x2586('0x59')](_0x2586('0xae'),_0x36e140[_0x2586('0xaf')],_0x2586('0xb0'),_0x439b97[_0x2586('0x55')],'pTalking:\x20',_0x439b97[_0x2586('0x2a')]);ami['emit'](_0x2586('0xb1'),ut[_0x2586('0x9f')](_0x36e140,_0x2586('0xb2'),this[_0x2586('0x11')][_0x36e140[_0x2586('0x6d')]]));if(_0x439b97[_0x2586('0xb3')]){ami[_0x2586('0x24')](_0x2586('0xb4'),ut[_0x2586('0xb5')](_0x36e140));}break;case'16':ami[_0x2586('0x24')](_0x2586('0xb6'),ut[_0x2586('0x9f')](_0x36e140,_0x2586('0xb7'),this[_0x2586('0x11')][_0x36e140[_0x2586('0x6d')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x36e140,_0x2586('0xb7')));_0x439b97[_0x2586('0x38')]+=0x1;_0x439b97[_0x2586('0x2f')]+=0x1;_0x439b97['answered']+=0x1;ut['decrementTalkink'](_0x439b97,'[16]');_0x36e140[_0x2586('0xb8')]=ut['totalGlobal'](_0x36e140);ut[_0x2586('0x8f')](_0x36e140,0x4,'Answer');rpcDb[_0x2586('0x91')](_0x36e140,_0x2586('0xb9'));rpcDb['createCustomerFinal'](_0x36e140,_0x2586('0xba'));rpcDb['crateCustomerReportQueue'](_0x36e140);_0x439b97[_0x2586('0x2c')]+=_0x36e140['talktime'];_0x439b97[_0x2586('0x2b')]+=_0x36e140[_0x2586('0xbb')];logger[_0x2586('0x59')](_0x2586('0xbc'),_0x36e140[_0x2586('0xaf')],_0x2586('0xb0'),_0x439b97[_0x2586('0x55')],_0x2586('0x6f'),_0x439b97[_0x2586('0x2a')]);delete this[_0x2586('0x14')][_0x37191f[_0x2586('0xbd')]];break;case'BUSY':_0x439b97[_0x2586('0x3a')]+=0x1;_0x36e140[_0x2586('0xbe')]+=0x1;_0x36e140[_0x2586('0xb8')]=ut[_0x2586('0x9e')](_0x36e140);ut[_0x2586('0x8f')](_0x36e140,0x5,_0x2586('0xbf'));ami[_0x2586('0x24')](_0x2586('0xc0'),ut[_0x2586('0x9f')](_0x36e140,_0x2586('0xc1')));rpcDb[_0x2586('0x91')](_0x36e140,_0x2586('0xc2'));if(ut[_0x2586('0x9e')](_0x36e140)>=_0x439b97[_0x2586('0xa2')]){_0x34f5c4=ut['cloneAction'](_0x36e140,0xf,_0x2586('0xa4'));rpcDb[_0x2586('0xa7')](_0x34f5c4,_0x2586('0xc3'));}else{if(_0x36e140[_0x2586('0xbe')]>=_0x439b97[_0x2586('0xc4')]){rpcDb[_0x2586('0xa7')](_0x36e140,_0x2586('0xc2'));}else{rpcDb[_0x2586('0xa8')](ut[_0x2586('0xc5')](_0x36e140,_0x2586('0xbe'),_0x439b97[_0x2586('0xc6')]),_0x36e140[_0x2586('0xaa')],_0x36e140[_0x2586('0xab')]);}}break;case _0x2586('0xc7'):_0x439b97[_0x2586('0xc8')]+=0x1;_0x36e140[_0x2586('0xc9')]+=0x1;_0x36e140['countglobal']=ut[_0x2586('0x9e')](_0x36e140);ut['logCustomer'](_0x36e140,0x3,_0x2586('0xca'));ami[_0x2586('0x24')]('custom:agentnoanswer',ut[_0x2586('0x9f')](_0x36e140,'noanswer'));rpcDb[_0x2586('0x91')](_0x36e140,_0x2586('0xcb'));if(ut[_0x2586('0x9e')](_0x36e140)>=_0x439b97[_0x2586('0xa2')]){_0x34f5c4=ut['cloneAction'](_0x36e140,0xf,_0x2586('0xa4'));rpcDb[_0x2586('0xa7')](_0x34f5c4,_0x2586('0xcc'));}else{if(_0x36e140[_0x2586('0xc9')]>=_0x439b97[_0x2586('0xcd')]){rpcDb[_0x2586('0xa7')](_0x36e140,_0x2586('0xcb'));}else{rpcDb[_0x2586('0xa8')](ut[_0x2586('0xc5')](_0x36e140,'countnoanswerretry',_0x439b97[_0x2586('0xce')]),_0x36e140[_0x2586('0xaa')],_0x36e140[_0x2586('0xab')]);}}break;case'CONGESTION':_0x439b97['outboundCongestionCallsDay']+=0x1;_0x36e140['countcongestionretry']+=0x1;_0x36e140[_0x2586('0xb8')]=ut['totalGlobal'](_0x36e140);ut[_0x2586('0x8f')](_0x36e140,0x8,'Congestion');ami['emit'](_0x2586('0xcf'),ut['buildObj'](_0x36e140,_0x2586('0xd0')));rpcDb['createCustomerHistory'](_0x36e140,_0x2586('0xd1'));if(ut['totalGlobal'](_0x36e140)>=_0x439b97[_0x2586('0xa2')]){_0x34f5c4=ut[_0x2586('0xa3')](_0x36e140,0xf,_0x2586('0xa4'));rpcDb[_0x2586('0xa7')](_0x34f5c4,_0x2586('0xd2'));}else{if(_0x36e140[_0x2586('0xd3')]>=_0x439b97[_0x2586('0xd4')]){rpcDb['createCustomerFinal'](_0x36e140,_0x2586('0xd1'));}else{rpcDb['rescheduleContact'](ut[_0x2586('0xc5')](_0x36e140,_0x2586('0xd3'),_0x439b97[_0x2586('0xc6')]),_0x36e140['unlockAgent'],_0x36e140['activeContact']);}}break;case _0x2586('0xd5'):_0x439b97['outboundRejectCallsDay']+=0x1;_0x36e140[_0x2586('0xd6')]+=0x1;_0x36e140['countglobal']=ut[_0x2586('0x9e')](_0x36e140);ut['logCustomer'](_0x36e140,0x14,_0x2586('0xd7'));ami['emit'](_0x2586('0xd8'),ut[_0x2586('0x9f')](_0x36e140,_0x2586('0xd9')));rpcDb[_0x2586('0x91')](_0x36e140,'[syncHangupRequest][logAgentReject]');if(ut[_0x2586('0x9e')](_0x36e140)>=_0x439b97[_0x2586('0xa2')]){_0x34f5c4=ut[_0x2586('0xa3')](_0x36e140,0x14,_0x2586('0xd7'));rpcDb[_0x2586('0xa7')](_0x34f5c4,_0x2586('0xda'));}else{if(_0x36e140[_0x2586('0xd6')]>=_0x439b97[_0x2586('0xdb')]){rpcDb['createCustomerFinal'](_0x36e140,_0x2586('0xda'));}else{rpcDb['rescheduleContact'](ut[_0x2586('0xc5')](_0x36e140,_0x2586('0xd6'),_0x439b97[_0x2586('0xdc')]),_0x36e140[_0x2586('0xaa')],_0x36e140['activeContact']);}}break;case _0x2586('0xdd'):_0x439b97[_0x2586('0xde')]+=0x1;_0x36e140[_0x2586('0xdf')]+=0x1;_0x36e140[_0x2586('0xb8')]=ut[_0x2586('0x9e')](_0x36e140);ut['logCustomer'](_0x36e140,0xb,_0x2586('0xe0'));rpcDb[_0x2586('0x91')](_0x36e140,_0x2586('0xe1'));if(ut[_0x2586('0x9e')](_0x36e140)>=_0x439b97[_0x2586('0xa2')]){_0x34f5c4=ut[_0x2586('0xa3')](_0x36e140,0xf,_0x2586('0xa4'));rpcDb['createCustomerFinal'](_0x34f5c4,_0x2586('0xe1'));}else{if(_0x36e140['countabandonedetry']>=_0x439b97[_0x2586('0xe2')]){rpcDb[_0x2586('0xa7')](_0x36e140,_0x2586('0xe1'));}else{rpcDb[_0x2586('0xa8')](ut[_0x2586('0xc5')](_0x36e140,_0x2586('0xdf'),_0x439b97['dialAbandonedRetryFrequency']),_0x36e140[_0x2586('0xaa')],_0x36e140[_0x2586('0xab')]);}}break;case'18':_0x439b97['outboundUnknownCallsDay']+=0x1;_0x36e140[_0x2586('0xe3')]+=0x1;_0x36e140[_0x2586('0xb8')]=ut[_0x2586('0x9e')](_0x36e140);ut[_0x2586('0x8f')](_0x36e140,0x12,_0x37191f[_0x2586('0xe4')]||_0x37191f[_0x2586('0xe5')]);ami[_0x2586('0x24')]('custom:amd',ut[_0x2586('0x9f')](_0x36e140,'amd'));rpcDb[_0x2586('0x91')](_0x36e140,_0x2586('0xe6'));if(ut[_0x2586('0x9e')](_0x36e140)>=_0x439b97[_0x2586('0xa2')]){_0x34f5c4=ut[_0x2586('0xa3')](_0x36e140,0xf,'Global');rpcDb[_0x2586('0xa7')](_0x34f5c4,_0x2586('0xe6'));}else{rpcDb[_0x2586('0xa7')](_0x36e140,_0x2586('0xe6'));}delete this[_0x2586('0x14')][_0x37191f[_0x2586('0xbd')]];break;case'19':_0x439b97['outboundUnknownCallsDay']+=0x1;_0x36e140[_0x2586('0xb8')]=ut[_0x2586('0x9e')](_0x36e140);ut[_0x2586('0x8f')](_0x36e140,0x13,_0x37191f[_0x2586('0xe4')]||_0x37191f[_0x2586('0xe5')]);ami[_0x2586('0x24')](_0x2586('0xe7'),ut[_0x2586('0x9f')](_0x36e140,'amd'));rpcDb['createCustomerHistory'](_0x36e140,'[callProgressDetectingCustomer][machine]');if(ut['totalGlobal'](_0x36e140)>=_0x439b97[_0x2586('0xa2')]){_0x34f5c4=ut['cloneAction'](_0x36e140,0xf,'Global');rpcDb[_0x2586('0xa7')](_0x34f5c4,'[callProgressDetectingCustomer][machine]');}else{rpcDb['createCustomerFinal'](_0x36e140,_0x2586('0xe8'));}delete this[_0x2586('0x14')][_0x37191f['linkedid']];break;default:if(_0x36e140[_0x2586('0x70')]){ut[_0x2586('0x7b')](_0x439b97,'[default]');ut[_0x2586('0x7c')](_0x2586('0xe9')+_0x439b97['name'],_0x37191f);}_0x439b97['outboundUnknownCallsDay']+=0x1;_0x36e140[_0x2586('0xb8')]=ut[_0x2586('0x9e')](_0x36e140);ut['logCustomer'](_0x36e140,0xc,_0x37191f['cause-txt']||_0x37191f['dialstatus']);rpcDb['createCustomerHistory'](_0x36e140,_0x2586('0xea'));if(ut[_0x2586('0x9e')](_0x36e140)>=_0x439b97[_0x2586('0xa2')]){_0x34f5c4=ut[_0x2586('0xa3')](_0x36e140,0xf,_0x2586('0xa4'));rpcDb[_0x2586('0xa7')](_0x34f5c4,_0x2586('0xeb'));}else{rpcDb[_0x2586('0xa7')](_0x36e140,_0x2586('0xeb'));}delete this['actions'][_0x37191f['linkedid']];}if(!(_0x36e140[_0x2586('0x70')]&&_0x3bfbfd==='16')){ut[_0x2586('0x79')](_0x439b97,_0x2586('0xec'));logger['info'](_0x2586('0xed'),_0x36e140[_0x2586('0xaf')],_0x2586('0xb0'),_0x439b97[_0x2586('0x55')],_0x2586('0x6e'),_0x439b97[_0x2586('0x4b')]);}if(_0x3bfbfd!==_0x2586('0xac')){delete this[_0x2586('0x14')][_0x37191f[_0x2586('0xbd')]];delete this[_0x2586('0x14')][_0x37191f[_0x2586('0xee')]];}}};Preview[_0x2586('0xd')][_0x2586('0xef')]=function(_0xe80a4f,_0x25c852,_0x349b32){if(_[_0x2586('0xf0')](_0x25c852)&&_0x2586('0xf1')!==typeof _0x25c852){return;}if(_[_0x2586('0xf0')](_0x349b32)&&_0x2586('0xf1')!==typeof _0x349b32){return;}switch(_0x349b32[_0x2586('0xf2')]){case'0':ut[_0x2586('0xf3')](_0xe80a4f,0x0,_0x2586('0xf4'));rpcDb['createAgentHistory'](_0xe80a4f,_0x2586('0xf5'));break;case'3':ut[_0x2586('0xf3')](_0xe80a4f,0x3,_0x2586('0xca'));rpcDb[_0x2586('0xf6')](_0xe80a4f,_0x2586('0xf7'));break;case'5':ut[_0x2586('0xf3')](_0xe80a4f,0x5,_0x2586('0xbf'));rpcDb[_0x2586('0xf6')](_0xe80a4f,_0x2586('0xf8'));break;case'8':ut[_0x2586('0xf3')](_0xe80a4f,0x8,_0x2586('0xf9'));rpcDb[_0x2586('0xf6')](_0xe80a4f,_0x2586('0xfa'));break;case'22':ut['logAgent'](_0xe80a4f,0x16,_0x2586('0xfb'));rpcDb['createAgentHistory'](_0xe80a4f,_0x2586('0xfc'));break;default:ut['logAgent'](_0xe80a4f,0xc,_0x349b32['reason']);rpcDb['createAgentHistory'](_0xe80a4f,'[callProgressDetectingAgent][logCongestion]');}ut[_0x2586('0x79')](_0x25c852,_0x2586('0xfd'));logger[_0x2586('0x59')](_0x2586('0xfe'),_0xe80a4f[_0x2586('0xaf')],_0x2586('0xb0'),_0x25c852[_0x2586('0x55')],_0x2586('0x6e'),_0x25c852[_0x2586('0x4b')]);delete this[_0x2586('0x14')][_0xe80a4f[_0x2586('0xaf')]];};Preview[_0x2586('0xd')][_0x2586('0xff')]=function(_0x42edc3,_0x2cdf67,_0x271bcd,_0x18eff9,_0x943120){var _0x5a9fe0=this;return new BPromise(function(_0x7de389,_0x502fd8){if(_['isNil'](_0x2cdf67)||_['isNil'](_0x2cdf67[_0x2586('0x100')])||_[_0x2586('0x6b')](_0x2cdf67[_0x2586('0x100')][_0x2586('0x101')])||_['isNil'](_0x2cdf67[_0x2586('0x74')])){_0x502fd8(ut[_0x2586('0x5f')](_0x2586('0x102'),_0x18eff9,_0x943120));return;}var _0x2c5dcb=uuid['v4']();var _0x3c2fcc=_0x5a9fe0[_0x2586('0x11')][_0x2cdf67[_0x2586('0x103')][_0x2586('0x55')]];var _0x4041cb=_0x271bcd?_0x5a9fe0['agents'][_0x271bcd]['id']:undefined;_0x5a9fe0[_0x2586('0x14')][_0x2c5dcb]=new Action(_0x2cdf67,_0x3c2fcc,_0x2c5dcb,_0x271bcd,_0x4041cb);var _0x183b82=_0x5a9fe0['actions'][_0x2c5dcb];_0x183b82['unlockAgent']=_0x18eff9;_0x183b82['activeContact']=_0x943120;_0x183b82['lookAgent']=_0x271bcd;if(_['isEmpty'](_0x42edc3)){_0x5a9fe0[_0x2586('0x104')](_0x183b82,_0x3c2fcc,_0x2cdf67,_0x271bcd)['then'](function(_0x5e1eb5){logger['info'](_0x2586('0x105'),_0x2586('0x106')+_0x183b82[_0x2586('0x6d')]+_0x2586('0x107')+_0x183b82[_0x2586('0x108')],JSON[_0x2586('0x56')](_0x5e1eb5));ami[_0x2586('0x24')](_0x2586('0x109'),ut[_0x2586('0x9f')](_0x183b82,_0x2586('0x10a'),_0x5a9fe0[_0x2586('0x11')][_0x183b82[_0x2586('0x6d')]]));_0x7de389(ut['message'](_0x2586('0x10b')));})[_0x2586('0x78')](function(_0xa0a7ba){ut[_0x2586('0x10c')](_0x2586('0x10d'),_0xa0a7ba);_0x502fd8(ut[_0x2586('0x5f')](_0x2586('0x10e'),_0x18eff9,_0x943120));});}else{_0x3c2fcc[_0x2586('0x39')]+=0x1;ut[_0x2586('0x10f')](_0x183b82);rpcDb[_0x2586('0x110')](_0x183b82,_0x2586('0x111'));delete _0x5a9fe0['actions'][_0x2c5dcb];_0x502fd8(ut[_0x2586('0x5f')](_0x2586('0x112'),_0x18eff9,_0x943120));}});};Preview[_0x2586('0xd')]['isTrunkReachable']=function(_0x301ee4){return!_['isNil'](_0x301ee4)&&!_[_0x2586('0x6b')](_0x301ee4[_0x2586('0x55')])&&!_['isNil'](_0x301ee4[_0x2586('0x52')])&&_0x301ee4[_0x2586('0x52')]&&!_[_0x2586('0x6b')](this['trunks'][util[_0x2586('0x5b')]('SIP/%s',_0x301ee4[_0x2586('0x55')])])&&!_[_0x2586('0x6b')](this['trunks'][util[_0x2586('0x5b')]('SIP/%s',_0x301ee4[_0x2586('0x55')])][_0x2586('0x76')])&&(this[_0x2586('0x13')][util[_0x2586('0x5b')](_0x2586('0x113'),_0x301ee4[_0x2586('0x55')])]['status']===_0x2586('0x114')||this[_0x2586('0x13')][util[_0x2586('0x5b')](_0x2586('0x113'),_0x301ee4['name'])][_0x2586('0x76')]===_0x2586('0x115'));};Preview[_0x2586('0xd')]['run']=function(_0x53d5dc,_0x574a07){var _0x45787b=this;return new BPromise(function(_0x3cb116,_0x57a60a){_0x45787b[_0x2586('0x116')](_0x53d5dc,_0x574a07)['then'](function(_0x35423f){_0x3cb116(_[_0x2586('0x71')](_0x35423f,[_0x2586('0x5f')]));})['catch'](function(_0x5bbb8f){if(_0x5bbb8f[_0x2586('0x117')]){rpcDb[_0x2586('0x118')](_0x53d5dc);}if(_0x5bbb8f[_0x2586('0x52')]){rpcDb[_0x2586('0x8c')](_0x53d5dc);}_0x57a60a(_['pick'](_0x5bbb8f,[_0x2586('0x5f')]));});});};Preview[_0x2586('0xd')][_0x2586('0x116')]=function(_0x1882a8,_0x29a748){var _0x2e79d5=this;return new BPromise(function(_0x162a36,_0x6956a8){var _0x1347f2,_0x48106b;rpcDb['getContactPreview'](_0x1882a8)[_0x2586('0x83')](function(_0x5674ac){if(!_[_0x2586('0x6b')](_0x5674ac[0x0])){_0x48106b=_0x5674ac[0x0]['recallme']?![]:!![];_0x1347f2=_0x5674ac[0x0][_0x2586('0x119')]?!![]:![];_0x1347f2=_0x29a748?!![]:_0x1347f2;}var _0x251e1f=_0x2e79d5[_0x2586('0x11a')](_0x5674ac);if(_0x251e1f[_0x2586('0x11b')]){rpcDb[_0x2586('0x11c')](_[_0x2586('0x71')](_0x5674ac[0x0],['VoiceQueueId',_0x2586('0x11d')]))['then'](function(_0x35dc11){_0x2e79d5['checkInBlack'](_0x35dc11,_0x5674ac[0x0],_0x29a748,_0x48106b,_0x1347f2)[_0x2586('0x83')](function(_0x5a1b81){_0x162a36(_0x5a1b81);})['catch'](function(_0x3b2cb0){_0x6956a8(_0x3b2cb0);});})[_0x2586('0x78')](function(_0x58f8f3){ut['logger']('[Preview][checkIsBlackList]',_0x58f8f3);_0x6956a8(ut['message']('Call\x20unsuccessful',_0x48106b,_0x1347f2));});}else{_0x6956a8(ut[_0x2586('0x5f')](_0x251e1f[_0x2586('0x5f')],_0x48106b,_0x1347f2));}})[_0x2586('0x78')](function(_0x26d6f6){ut[_0x2586('0x10c')]('[Preview][getContactPreview]',_0x26d6f6);_0x6956a8(ut['message'](_0x2586('0x11e'),![],!![]));});});};Preview[_0x2586('0xd')][_0x2586('0x11a')]=function(_0x503189){if(_[_0x2586('0x6b')](_0x503189)||_[_0x2586('0x11f')](_0x503189)||!_[_0x2586('0x6b')](_0x503189[0x0][_0x2586('0x87')])&&_[_0x2586('0x6b')](_0x503189[0x0][_0x2586('0x87')][_0x2586('0x55')])){ut['logger'](_0x2586('0x120'),_0x503189);return{'isValid':![],'message':_0x2586('0x121')};}var _0x49546b=this['campaignsPreview'][_0x503189[0x0][_0x2586('0x103')][_0x2586('0x55')]];_0x49546b[_0x2586('0x5f')]='ACTIVE';if(_[_0x2586('0x6b')](_0x49546b)){ut['logger'](_0x2586('0x122'),_0x49546b);return{'isValid':![],'message':_0x2586('0x123')};}if(!this[_0x2586('0x99')](_0x49546b['Trunk'])){ut[_0x2586('0x10c')](_0x2586('0x124'),_0x2586('0x125')+_0x49546b[_0x2586('0x55')]+_0x2586('0x126'));if(!this[_0x2586('0x99')](_0x49546b[_0x2586('0x9a')])){ut[_0x2586('0x10c')](_0x2586('0x124'),_0x49546b[_0x2586('0x55')]+_0x2586('0x127'));return{'isValid':![],'message':_0x2586('0x128')};}}if(!ut[_0x2586('0x98')](_0x49546b['dialActive'])){ut[_0x2586('0x10c')](_0x2586('0x129'),_0x49546b['name']+_0x2586('0x12a'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x49546b[_0x2586('0x55')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x2586('0x12b')};};Preview[_0x2586('0xd')][_0x2586('0x104')]=function(_0x2db984,_0x5153cf,_0x47e0f6,_0x3bec4f){var _0x3376f3=this;return new BPromise(function(_0x22da7c,_0x37b533){var _0x5956b1=_0x2db984[_0x2586('0xaf')];var _0x1e9bee=_0x3376f3[_0x2586('0x99')](_0x5153cf[_0x2586('0x51')])?util['format']('SIP/%s/%s%s',_0x5153cf[_0x2586('0x51')][_0x2586('0x55')],_[_0x2586('0x6b')](_0x5153cf['dialPrefix'])?'':_0x5153cf[_0x2586('0x37')][_0x2586('0x12c')]()||'',_0x5153cf[_0x2586('0x12d')]>0x0?_0x47e0f6[_0x2586('0x100')][_0x2586('0x101')][_0x2586('0x12e')](_0x5153cf['dialCutDigit']):_0x47e0f6[_0x2586('0x100')][_0x2586('0x101')]):util['format'](_0x2586('0x12f'),_[_0x2586('0x6b')](_0x5153cf[_0x2586('0x9a')])?_0x5153cf[_0x2586('0x51')][_0x2586('0x55')]:_0x5153cf[_0x2586('0x9a')]['name'],_[_0x2586('0x6b')](_0x5153cf[_0x2586('0x37')])?'':_0x5153cf[_0x2586('0x37')][_0x2586('0x12c')]()||'',_0x5153cf[_0x2586('0x12d')]>0x0?_0x47e0f6[_0x2586('0x100')][_0x2586('0x101')]['substring'](_0x5153cf[_0x2586('0x12d')]):_0x47e0f6[_0x2586('0x100')][_0x2586('0x101')]);var _0x4760ee=_0x3376f3[_0x2586('0x99')](_0x5153cf[_0x2586('0x51')])?ut[_0x2586('0x130')](_0x5153cf[_0x2586('0x51')][_0x2586('0x53')],_0x5153cf[_0x2586('0x34')],_0x5153cf['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x2586('0x131')](_0x5153cf['dialOriginateCallerIdNumber'],_0x5153cf[_0x2586('0x132')]):_0x5153cf[_0x2586('0x35')]):ut[_0x2586('0x130')](_[_0x2586('0x6b')](_0x5153cf['TrunkBackup'])?_0x5153cf[_0x2586('0x51')][_0x2586('0x53')]:_0x5153cf[_0x2586('0x9a')][_0x2586('0x53')],_0x5153cf[_0x2586('0x34')],_0x5153cf[_0x2586('0x132')]>0x0?ut[_0x2586('0x131')](_0x5153cf[_0x2586('0x35')],_0x5153cf[_0x2586('0x132')]):_0x5153cf[_0x2586('0x35')]);if(_0x4760ee){_0x2db984[_0x2586('0x133')]=ut[_0x2586('0x134')](_0x4760ee);_0x2db984['originatecalleridnum']=ut['extractCalleridNumber'](_0x4760ee);}var _0x2123c7=ut[_0x2586('0x135')](_0x5153cf,_0x47e0f6,_0x1e9bee,_0x4760ee,_0x5956b1,_0x2db984);_[_0x2586('0x136')](_0x2db984,ut[_0x2586('0x137')](_0x2123c7));_0x2db984['starttime']=moment()[_0x2586('0x5b')]('YYYY-MM-DD\x20HH:mm:ss');ami['Action'](ut['variablesAction'](_0x2db984,_0x5153cf,_0x2123c7,_0x2db984[_0x2586('0xab')],_0x3bec4f))['then'](function(_0x13ea11){var _0x4353e8=_0x2db984['channelAgent'];if(!_[_0x2586('0x6b')](_0x4353e8)){if(!_[_0x2586('0x6b')](_0x3376f3[_0x2586('0x15')][_0x4353e8])){_0x3376f3[_0x2586('0x15')][_0x4353e8][_0x2586('0x138')]=_0x2db984['calleridnum'];emit(util[_0x2586('0x5b')](_0x2586('0x139'),_0x3376f3['agents'][_0x4353e8]['name']),_0x2586('0x13a'),{'destaccountcode':_0x3376f3[_0x2586('0x15')][_0x4353e8]['accountcode'],'destconnectedlinenum':_0x2db984[_0x2586('0x13b')]});}}_0x5153cf['originated']+=0x1;logger[_0x2586('0x59')](_0x2586('0x13c'),_0x5956b1,_0x2586('0xb0'),_0x5153cf[_0x2586('0x55')],'originated:\x20',_0x5153cf['originated']);_0x22da7c(_0x13ea11);})[_0x2586('0x78')](function(_0x545a2c){ut[_0x2586('0xf3')](_0x2db984,0xe,_0x2586('0x13d'));rpcDb[_0x2586('0xf6')](_0x2db984,'[originateFailure][logOriginateFailure]');_0x37b533(_0x545a2c);});});};Preview[_0x2586('0xd')][_0x2586('0x1f')]=function(_0xc672e3){if(this[_0x2586('0x14')][_0xc672e3['linkedid']]){this[_0x2586('0x14')][_0xc672e3['linkedid']][_0x2586('0x77')]=_0xc672e3[_0x2586('0x77')];}};Preview['prototype'][_0x2586('0x17')]=function(_0x5b4942){var _0x2aabd8=this;var _0x1ad9e6=this[_0x2586('0x14')][_0x5b4942[_0x2586('0x13e')]];if(_0x1ad9e6){if(_0x1ad9e6[_0x2586('0x13f')]&&this[_0x2586('0x15')][_0x1ad9e6[_0x2586('0x13f')]]){ut['logLookAgent'](_0x1ad9e6,this[_0x2586('0x15')][_0x1ad9e6[_0x2586('0x13f')]][_0x2586('0x55')],this[_0x2586('0x15')][_0x1ad9e6[_0x2586('0x13f')]]['id']);}var _0x2fc449=_['clone'](_0x1ad9e6);_0x2fc449[_0x2586('0x140')]=moment()['format'](_0x2586('0x8e'));var _0x262ace=_0x2aabd8[_0x2586('0x11')][_0x1ad9e6[_0x2586('0x6d')]];if(ut[_0x2586('0x141')](_0x5b4942[_0x2586('0x142')])){if(_0x1ad9e6[_0x2586('0xaa')]){rpcDb['unlockContact'](_0x1ad9e6[_0x2586('0x108')]);}if(_0x1ad9e6[_0x2586('0xab')]){rpcDb[_0x2586('0x8c')](_0x1ad9e6[_0x2586('0x108')]);}ami[_0x2586('0x24')](_0x2586('0x143'),ut[_0x2586('0x9f')](_0x1ad9e6,_0x2586('0x144'),this[_0x2586('0x11')][_0x1ad9e6['queue']]));this[_0x2586('0xef')](_0x2fc449,_0x262ace,_0x5b4942);}else{_0x1ad9e6[_0x2586('0x8d')]=moment()['format'](_0x2586('0x8e'));ut[_0x2586('0xf3')](_0x2fc449,0x4,_0x2586('0x145'));rpcDb[_0x2586('0xf6')](_0x2fc449,_0x2586('0x146'));}}};Preview[_0x2586('0xd')]['syncHangup']=function(_0x298a43){var _0x47240c=this;var _0x5cb798=this[_0x2586('0x14')][_0x298a43['linkedid']];var _0x22c8eb;if(_0x5cb798){_0x22c8eb=this[_0x2586('0x11')][_0x5cb798[_0x2586('0x6d')]];logger[_0x2586('0x59')](_0x2586('0x147'),_0x298a43[_0x2586('0xbd')],_0x2586('0xb0'),_0x22c8eb[_0x2586('0x55')],_0x2586('0x6f'),_0x22c8eb[_0x2586('0x2a')]);}if(this[_0x2586('0x14')][_0x298a43['linkedid']]&&_0x298a43[_0x2586('0xbd')]!==_0x298a43['uniqueid']){if(_0x298a43['cause']==='16'&&this[_0x2586('0x14')][_0x298a43[_0x2586('0xbd')]][_0x2586('0x70')]){this[_0x2586('0x9c')](_0x298a43,_0x298a43[_0x2586('0xbd')],_0x298a43['cause']);}else if(this[_0x2586('0x14')][_0x298a43[_0x2586('0xbd')]]['dialAnswer']){logger[_0x2586('0x59')](_0x2586('0x148'),_0x298a43[_0x2586('0xbd')],_0x298a43[_0x2586('0x149')],'\x20Queue',_0x22c8eb[_0x2586('0x55')],_0x2586('0x6f'),_0x22c8eb['pTalking']);this[_0x2586('0x9c')](_0x298a43,_0x298a43[_0x2586('0xbd')],_0x298a43[_0x2586('0x149')]);}}else if(_0x5cb798&&_[_0x2586('0x6b')](_0x5cb798['statedesc'])&&_0x22c8eb[_0x2586('0x14a')]&&_0x298a43[_0x2586('0xbd')]===_0x298a43['uniqueid']&&_[_0x2586('0x6b')](_0x298a43[_0x2586('0xf2')])&&_0x298a43[_0x2586('0x149')]==='16'&&_0x298a43[_0x2586('0x14b')]==='6'&&_['isUndefined'](_0x5cb798[_0x2586('0x14c')])){if(_0x5cb798[_0x2586('0xaa')]){rpcDb[_0x2586('0x118')](_0x5cb798[_0x2586('0x108')]);}if(_0x5cb798[_0x2586('0xab')]){rpcDb[_0x2586('0x8c')](_0x5cb798[_0x2586('0x108')]);}_0x298a43[_0x2586('0xf2')]='22';this[_0x2586('0xef')](_0x5cb798,_0x22c8eb,_0x298a43);}else if(_0x5cb798&&_0x5cb798['transfer']){if(_0x298a43[_0x2586('0x149')]==='16'&&this[_0x2586('0x14')][_0x298a43[_0x2586('0xbd')]][_0x2586('0x70')]){logger[_0x2586('0x59')](_0x2586('0x14d'),_0x298a43[_0x2586('0xbd')],_0x298a43[_0x2586('0x149')],_0x2586('0xb0'),_0x22c8eb[_0x2586('0x55')],_0x2586('0x6f'),_0x22c8eb[_0x2586('0x2a')]);this[_0x2586('0x9c')](_0x298a43,_0x298a43[_0x2586('0xbd')],_0x298a43['cause']);}else if(this[_0x2586('0x14')][_0x298a43[_0x2586('0xbd')]][_0x2586('0x70')]){logger[_0x2586('0x59')](_0x2586('0x148'),_0x298a43['linkedid'],_0x298a43[_0x2586('0x149')],_0x2586('0xb0'),_0x22c8eb[_0x2586('0x55')],_0x2586('0x6f'),_0x22c8eb[_0x2586('0x2a')]);this['callProgressDetectingCustomer'](_0x298a43,_0x298a43[_0x2586('0xbd')],_0x298a43[_0x2586('0x149')]);}}};Preview[_0x2586('0xd')]['syncDialEnd']=function(_0x5ac684){if(this[_0x2586('0x14')][_0x5ac684[_0x2586('0xee')]]&&_0x5ac684[_0x2586('0xee')]!==_0x5ac684[_0x2586('0x14e')]){this[_0x2586('0x9c')](_0x5ac684,_0x5ac684[_0x2586('0xee')],_0x5ac684[_0x2586('0xe5')]);}};Preview[_0x2586('0xd')]['syncHangupRequest']=function(_0x59a2c9){if(this[_0x2586('0x14')][_0x59a2c9[_0x2586('0xbd')]]&&_0x59a2c9['linkedid']!==_0x59a2c9['uniqueid']&&!this['actions'][_0x59a2c9[_0x2586('0xbd')]]['dialAnswer']){if(_0x59a2c9['cause']==='1'){this['callProgressDetectingCustomer'](_0x59a2c9,_0x59a2c9[_0x2586('0xbd')],_0x59a2c9[_0x2586('0x149')]);}}};Preview[_0x2586('0xd')][_0x2586('0x14f')]=function(_0x389f51,_0x2d81f5,_0x3a3c58){if(this[_0x2586('0x14')][_0x389f51]){if(_[_0x2586('0x6b')](this[_0x2586('0x14')][_0x389f51][_0x2586('0x150')])){this[_0x2586('0x14')][_0x389f51]['variables']={};}this[_0x2586('0x14')][_0x389f51][_0x2586('0x150')][_0x2d81f5]=_0x3a3c58;}};Preview[_0x2586('0xd')][_0x2586('0x151')]=function(_0x866b9){try{if(!_[_0x2586('0x6b')](_0x866b9)){if(ut[_0x2586('0x152')](_['keys'](_0x866b9[_0x2586('0x153')])[0x0])){this[_0x2586('0x14f')](_0x866b9[_0x2586('0xaf')],_[_0x2586('0x154')](_0x866b9['variable'])[0x0],_0x866b9['value']);}}}catch(_0x1cf0a3){logger['error']('[syncVarSet][Preview]',util['inspect'](_0x1cf0a3,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0x2586('0x21')]=function(_0x4b7082){if(_0x4b7082){if(this[_0x2586('0x14')][_0x4b7082[_0x2586('0x155')]]){this[_0x2586('0x14')][_0x4b7082[_0x2586('0x155')]][_0x2586('0x14c')]=!![];}}};Preview['prototype'][_0x2586('0x22')]=function(_0x2b39cf){if(_0x2b39cf){if(this[_0x2586('0x14')][_0x2b39cf['transfererlinkedid']]){this['actions'][_0x2b39cf[_0x2586('0x156')]][_0x2586('0x14c')]=!![];}}};module[_0x2586('0x157')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 471eadb..39cb74e 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 _0xc68e=['create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','lodash','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','inspect','resolve','then','createHistory','[createHistory]\x20','catch','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','connectedlinename','membername','context','exten','xcally-motion-preview','holdtime','lastAssignedTo','queuecallerexitreason','COMPLETED'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xc68e,0x187));var _0xec68=function(_0x17604e,_0x152e6a){_0x17604e=_0x17604e-0x0;var _0x5ef976=_0xc68e[_0x17604e];return _0x5ef976;};'use strict';var util=require(_0xec68('0x0'));var BPromise=require(_0xec68('0x1'));var logger=require('../../../config/logger')('preview');var _=require(_0xec68('0x2'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0xec68('0x3'));var cmHopperHistory=require(_0xec68('0x4'));var cmHopperBlack=require(_0xec68('0x5'));var voiceQueueRt=require(_0xec68('0x6'));var agentReportPreview=require(_0xec68('0x7'));var voiceQueueReport=require(_0xec68('0x8'));function loggerCatch(_0x157688){return function(_0x47a538){logger['error'](_0x157688,util[_0xec68('0x9')](_0x47a538,{'showHidden':![],'depth':null}));};}function create(_0x20ea79){return BPromise[_0xec68('0xa')]()[_0xec68('0xb')](cmHopperHistory[_0xec68('0xc')](_0x20ea79))['catch'](loggerCatch(_0xec68('0xd')));}function createAgent(_0x31d56a){return BPromise[_0xec68('0xa')]()[_0xec68('0xb')](agentReportPreview[_0xec68('0xc')](_0x31d56a))[_0xec68('0xe')](loggerCatch(_0xec68('0xd')));}function moveContact(_0x5c1ba5){return BPromise[_0xec68('0xa')]()[_0xec68('0xb')](cmHopper['moveContactManagedDialer'](_0x5c1ba5,!![]))[_0xec68('0xe')](loggerCatch(_0xec68('0xf')));}exports[_0xec68('0x10')]=function(_0x401f23){return BPromise[_0xec68('0xa')]()[_0xec68('0xb')](cmHopperBlack['checkIsBlackList'](_0x401f23))[_0xec68('0xe')](loggerCatch(_0xec68('0x11')));};exports[_0xec68('0x12')]=function(_0x597953){return BPromise['resolve']()[_0xec68('0xb')](cmHopper[_0xec68('0x12')](_0x597953))[_0xec68('0xe')](loggerCatch('[getContactPreview]\x20'));};exports[_0xec68('0xc')]=function(_0x3c2102,_0x4343c2){create(_0x3c2102)[_0xec68('0xe')](loggerCatch(_0x4343c2));moveContact(_0x3c2102)[_0xec68('0xe')](loggerCatch(_0x4343c2));};exports[_0xec68('0x13')]=function(_0x534494,_0x4be6e4){createAgent(_0x534494)[_0xec68('0xe')](loggerCatch(_0x4be6e4));};exports[_0xec68('0x14')]=function(_0x266239,_0x1f9267){create(_0x266239)[_0xec68('0xe')](loggerCatch(_0x1f9267));};exports[_0xec68('0x15')]=function(_0x1ec621,_0x20f9bc){moveContact(_0x1ec621)[_0xec68('0xe')](loggerCatch(_0x20f9bc));};exports[_0xec68('0x16')]=function(_0x40a2a1,_0x29e787,_0x49a495){if(_0x29e787){_0x40a2a1[_0xec68('0x17')]=null;}if(_0x49a495){_0x40a2a1[_0xec68('0x18')]=![];}return BPromise['resolve']()['then'](cmHopper[_0xec68('0x16')](_0x40a2a1))['catch'](loggerCatch(_0xec68('0x19')));};exports[_0xec68('0x1a')]=function(_0x51feb0){return BPromise[_0xec68('0xa')]()[_0xec68('0xb')](cmHopper[_0xec68('0x1a')](_0x51feb0))['catch'](loggerCatch('[countReScheduled]\x20'));};exports[_0xec68('0x1b')]=function(_0x20da4a){return BPromise['resolve']()[_0xec68('0xb')](cmHopper[_0xec68('0x1b')]({'UserId':null},_0x20da4a,0x1))['catch'](loggerCatch(_0xec68('0x1c')));};exports[_0xec68('0x1d')]=function(_0x2225af){return BPromise[_0xec68('0xa')]()[_0xec68('0xb')](cmHopper['unlockContact']({'active':![]},_0x2225af,0x1))[_0xec68('0xe')](loggerCatch(_0xec68('0x1e')));};exports[_0xec68('0x1f')]=function(_0x40bb9f){var _0x50f86d={};_0x50f86d[_0xec68('0x20')]=_0x40bb9f[_0xec68('0x20')];_0x50f86d[_0xec68('0x21')]=_0x40bb9f[_0xec68('0x21')];_0x50f86d['calleridnum']=_0x40bb9f['calleridnum'];_0x50f86d[_0xec68('0x22')]=_0x40bb9f[_0xec68('0x22')];_0x50f86d[_0xec68('0x23')]=_0x40bb9f[_0xec68('0x23')];_0x50f86d[_0xec68('0x24')]=_0x40bb9f[_0xec68('0x25')];_0x50f86d['queuecallerleaveAt']=_0x40bb9f[_0xec68('0x25')];_0x50f86d[_0xec68('0x26')]=0x1;_0x50f86d[_0xec68('0x27')]=_0x40bb9f['endtime'];_0x50f86d[_0xec68('0x28')]=_0x40bb9f[_0xec68('0x29')];_0x50f86d[_0xec68('0x2a')]='from-sip';_0x50f86d[_0xec68('0x2b')]=_0xec68('0x2c');_0x50f86d[_0xec68('0x2d')]=0x0;_0x50f86d['assigned']=0x1;_0x50f86d[_0xec68('0x2e')]=_0x40bb9f['membername'];_0x50f86d[_0xec68('0x2f')]=_0xec68('0x30');return BPromise['resolve']()[_0xec68('0xb')](voiceQueueReport[_0xec68('0x31')](_0x50f86d))['catch'](loggerCatch(_0xec68('0x32')));};exports[_0xec68('0x33')]=function(_0x30e49c,_0x227f19){return BPromise['resolve']()[_0xec68('0xb')](cmHopper[_0xec68('0x33')](_0x30e49c,_0x227f19))[_0xec68('0xe')](loggerCatch(_0xec68('0x34')));};exports[_0xec68('0x35')]=function(_0x4656af){return BPromise[_0xec68('0xa')]()[_0xec68('0xb')](cmHopper['rescheduleContact'](_0x4656af,!![],!![]))['catch'](loggerCatch(_0xec68('0x36')));}; \ No newline at end of file +var _0xd7ff=['unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/voiceQueueReport','error','then','createHistory','catch','[createHistory]\x20','resolve','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20'];(function(_0x289c9d,_0x1ebe22){var _0x503847=function(_0x4b0a6b){while(--_0x4b0a6b){_0x289c9d['push'](_0x289c9d['shift']());}};_0x503847(++_0x1ebe22);}(_0xd7ff,0x8f));var _0xfd7f=function(_0x53f049,_0x56af0b){_0x53f049=_0x53f049-0x0;var _0x1bf6ef=_0xd7ff[_0x53f049];return _0x1bf6ef;};'use strict';var util=require('util');var BPromise=require(_0xfd7f('0x0'));var logger=require(_0xfd7f('0x1'))(_0xfd7f('0x2'));var _=require(_0xfd7f('0x3'));var cmHopper=require(_0xfd7f('0x4'));var cmHopperFinal=require(_0xfd7f('0x5'));var cmHopperHistory=require(_0xfd7f('0x6'));var cmHopperBlack=require(_0xfd7f('0x7'));var voiceQueueRt=require(_0xfd7f('0x8'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0xfd7f('0x9'));function loggerCatch(_0x251e11){return function(_0x3bc7fa){logger[_0xfd7f('0xa')](_0x251e11,util['inspect'](_0x3bc7fa,{'showHidden':![],'depth':null}));};}function create(_0xe85cb6){return BPromise['resolve']()[_0xfd7f('0xb')](cmHopperHistory[_0xfd7f('0xc')](_0xe85cb6))[_0xfd7f('0xd')](loggerCatch(_0xfd7f('0xe')));}function createAgent(_0x497766){return BPromise[_0xfd7f('0xf')]()[_0xfd7f('0xb')](agentReportPreview[_0xfd7f('0xc')](_0x497766))[_0xfd7f('0xd')](loggerCatch(_0xfd7f('0xe')));}function moveContact(_0x259844){return BPromise[_0xfd7f('0xf')]()[_0xfd7f('0xb')](cmHopper[_0xfd7f('0x10')](_0x259844,!![]))[_0xfd7f('0xd')](loggerCatch(_0xfd7f('0x11')));}exports[_0xfd7f('0x12')]=function(_0x1c7e73){return BPromise[_0xfd7f('0xf')]()['then'](cmHopperBlack[_0xfd7f('0x12')](_0x1c7e73))['catch'](loggerCatch('[checkIsBlackList]\x20'));};exports['getContactPreview']=function(_0x4e7356){return BPromise[_0xfd7f('0xf')]()[_0xfd7f('0xb')](cmHopper['getContactPreview'](_0x4e7356))[_0xfd7f('0xd')](loggerCatch('[getContactPreview]\x20'));};exports[_0xfd7f('0xc')]=function(_0xf7fa5e,_0x15c9ca){create(_0xf7fa5e)[_0xfd7f('0xd')](loggerCatch(_0x15c9ca));moveContact(_0xf7fa5e)[_0xfd7f('0xd')](loggerCatch(_0x15c9ca));};exports[_0xfd7f('0x13')]=function(_0xc106fb,_0x5d9c75){createAgent(_0xc106fb)[_0xfd7f('0xd')](loggerCatch(_0x5d9c75));};exports[_0xfd7f('0x14')]=function(_0x19be1b,_0x57c002){create(_0x19be1b)[_0xfd7f('0xd')](loggerCatch(_0x57c002));};exports[_0xfd7f('0x15')]=function(_0x490971,_0x54fc9e){moveContact(_0x490971)[_0xfd7f('0xd')](loggerCatch(_0x54fc9e));};exports[_0xfd7f('0x16')]=function(_0x13ab55,_0x1e8037,_0x484f60){if(_0x1e8037){_0x13ab55[_0xfd7f('0x17')]=null;}if(_0x484f60){_0x13ab55[_0xfd7f('0x18')]=![];}return BPromise[_0xfd7f('0xf')]()[_0xfd7f('0xb')](cmHopper['rescheduleContact'](_0x13ab55))[_0xfd7f('0xd')](loggerCatch(_0xfd7f('0x19')));};exports[_0xfd7f('0x1a')]=function(_0x4265db){return BPromise[_0xfd7f('0xf')]()[_0xfd7f('0xb')](cmHopper[_0xfd7f('0x1a')](_0x4265db))[_0xfd7f('0xd')](loggerCatch(_0xfd7f('0x1b')));};exports[_0xfd7f('0x1c')]=function(_0x2c6ea9){return BPromise['resolve']()[_0xfd7f('0xb')](cmHopper[_0xfd7f('0x1c')]({'UserId':null},_0x2c6ea9,0x1))[_0xfd7f('0xd')](loggerCatch(_0xfd7f('0x1d')));};exports[_0xfd7f('0x1e')]=function(_0x398237){return BPromise[_0xfd7f('0xf')]()[_0xfd7f('0xb')](cmHopper[_0xfd7f('0x1c')]({'active':![]},_0x398237,0x1))[_0xfd7f('0xd')](loggerCatch(_0xfd7f('0x1f')));};exports[_0xfd7f('0x20')]=function(_0x2b155c){var _0x11aa77={};_0x11aa77['type']=_0x2b155c[_0xfd7f('0x21')];_0x11aa77[_0xfd7f('0x22')]=_0x2b155c[_0xfd7f('0x22')];_0x11aa77[_0xfd7f('0x23')]=_0x2b155c[_0xfd7f('0x23')];_0x11aa77[_0xfd7f('0x24')]=_0x2b155c['calleridname'];_0x11aa77[_0xfd7f('0x25')]=_0x2b155c[_0xfd7f('0x25')];_0x11aa77[_0xfd7f('0x26')]=_0x2b155c[_0xfd7f('0x27')];_0x11aa77[_0xfd7f('0x28')]=_0x2b155c[_0xfd7f('0x27')];_0x11aa77['queuecallercomplete']=0x1;_0x11aa77['queuecallercompleteAt']=_0x2b155c[_0xfd7f('0x29')];_0x11aa77[_0xfd7f('0x2a')]=_0x2b155c[_0xfd7f('0x2b')];_0x11aa77[_0xfd7f('0x2c')]=_0xfd7f('0x2d');_0x11aa77[_0xfd7f('0x2e')]=_0xfd7f('0x2f');_0x11aa77[_0xfd7f('0x30')]=0x0;_0x11aa77[_0xfd7f('0x31')]=0x1;_0x11aa77['lastAssignedTo']=_0x2b155c[_0xfd7f('0x2b')];_0x11aa77[_0xfd7f('0x32')]=_0xfd7f('0x33');return BPromise[_0xfd7f('0xf')]()[_0xfd7f('0xb')](voiceQueueReport[_0xfd7f('0x34')](_0x11aa77))['catch'](loggerCatch(_0xfd7f('0x35')));};exports['getContactRecallMe']=function(_0xeaa1c,_0x4b452f){return BPromise[_0xfd7f('0xf')]()[_0xfd7f('0xb')](cmHopper[_0xfd7f('0x36')](_0xeaa1c,_0x4b452f))[_0xfd7f('0xd')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0xfd7f('0x37')]=function(_0x36ef83){return BPromise[_0xfd7f('0xf')]()[_0xfd7f('0xb')](cmHopper[_0xfd7f('0x16')](_0x36ef83,!![],!![]))[_0xfd7f('0xd')](loggerCatch(_0xfd7f('0x38')));}; \ 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 c4134cd..2130b5a 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 _0x97f5=['push','filterKey','idContact','type','dialAnswer','callbackat','recallme','UserId','sipcallid','xmd-voicequeueid','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitter','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','extractCalleridName','match','extractCalleridNumber','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','seconds','loggerCatch','error','inspect','logger','loggerError','logger2','message','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','createdAt','updatedAt','XMD-','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','endtime','logAgent','responsetime','ringtime','logLookAgent','membername','starttime','talktime','answertime','isFailure','Failure','variablesAction','RECALL','uniqueid','originate','channelAgent','xcally-motion-preview','from-sip','totalGlobal','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','buildObj','lastevent','queue','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','status','reachable'];(function(_0x19e08e,_0x178f46){var _0x14c229=function(_0x791b3b){while(--_0x791b3b){_0x19e08e['push'](_0x19e08e['shift']());}};_0x14c229(++_0x178f46);}(_0x97f5,0x1bf));var _0x597f=function(_0x5be26e,_0x115470){_0x5be26e=_0x5be26e-0x0;var _0x1675a2=_0x97f5[_0x5be26e];return _0x1675a2;};'use strict';var util=require(_0x597f('0x0'));var _=require(_0x597f('0x1'));var moment=require(_0x597f('0x2'));var logger=require(_0x597f('0x3'))(_0x597f('0x4'));var ipAgi=process[_0x597f('0x5')][_0x597f('0x6')]||_0x597f('0x7');function getSeconds(_0x2598c2,_0x4ec630){var _0xcdc56f=moment(_0x2598c2)[_0x597f('0x8')](0x0);var _0x4327f0=moment(_0x4ec630)[_0x597f('0x8')](0x0);return _0xcdc56f['diff'](_0x4327f0,_0x597f('0x9'));}exports[_0x597f('0xa')]=function(_0x1f29cf){return function(_0x11fa2b){logger[_0x597f('0xb')](_0x1f29cf,util[_0x597f('0xc')](_0x11fa2b,{'showHidden':![],'depth':null}));};};exports[_0x597f('0xd')]=function(_0xdaf6df,_0xa579ad){logger['info'](_0xdaf6df,util['inspect'](_0xa579ad,{'showHidden':![],'depth':null}));};exports[_0x597f('0xe')]=function(_0x338f79,_0xc7671d){logger[_0x597f('0xb')](_0x338f79,util[_0x597f('0xc')](_0xc7671d,{'showHidden':![],'depth':null}));};exports[_0x597f('0xf')]=function(_0x4f8a1c){return function(_0x22cbb6){logger['info'](_0x4f8a1c,util[_0x597f('0xc')](_0x22cbb6,{'showHidden':![],'depth':null}));};};exports[_0x597f('0x10')]=function(_0x549834,_0x12a6a3,_0x1c3553){return{'message':_0x549834,'unlock':_0x12a6a3,'active':_0x1c3553};};exports['getCallerId']=function(_0x2d1957,_0xe45d47,_0xc03301){if(!_[_0x597f('0x11')](_0xc03301)&&_0x597f('0x12')===typeof _0xc03301&&!_[_0x597f('0x13')](_0xc03301)){if(!_[_0x597f('0x11')](_0xe45d47)&&_0x597f('0x12')===typeof _0xe45d47&&!_[_0x597f('0x13')](_0xe45d47)){return util[_0x597f('0x14')](_0x597f('0x15'),_0xe45d47,_0xc03301);}return util[_0x597f('0x14')](_0x597f('0x15'),_0xc03301,_0xc03301);}if(!_[_0x597f('0x11')](_0x2d1957)&&_0x597f('0x12')===typeof _0x2d1957&&!_[_0x597f('0x13')](_0x2d1957)){return _0x2d1957;}return _0x597f('0x16');};exports[_0x597f('0x17')]=function(_0x5d382f){if(_[_0x597f('0x18')](_0x5d382f)){return![];}return _0x5d382f;};exports[_0x597f('0x19')]=function(_0x487ac4,_0x4a21e9,_0x16f9e3,_0x2f30e1,_0x1b30eb,_0x57cf2c){var _0x389b60={'XMD-QUEUE':_0x4a21e9[_0x597f('0x1a')]?_0x4a21e9[_0x597f('0x1a')][_0x597f('0x1b')]:'','XMD-CALLERID':_0x2f30e1,'XMD-CALLERID-PREVIEW':_0x57cf2c?util['format'](_0x597f('0x15'),_0x57cf2c[_0x597f('0x1c')],_0x57cf2c[_0x597f('0x1d')]):_0x2f30e1,'XMD-DIALID':_0x1b30eb,'XMD-CONTACTID':_0x4a21e9[_0x597f('0x1e')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x2f30e1,'XMD-VOICEQUEUEID':_0x4a21e9[_0x597f('0x1f')],'XMD-DIALCHANNEL':_0x16f9e3,'XMD-DIALTIMEOUT':_0x487ac4[_0x597f('0x20')]||0x1e,'XMD-DIALOPTIONS':util[_0x597f('0x14')](_0x597f('0x21'),_0x487ac4['dialQueueProject2']?'g':'',_[_0x597f('0x13')](_0x487ac4[_0x597f('0x22')])?'':_0x597f('0x23')),'XMD-DIALURL':_0x487ac4[_0x597f('0x24')]||'','XMD-AGI':_0x487ac4[_0x597f('0x25')]?util[_0x597f('0x14')](_0x597f('0x26'),ipAgi,_0x487ac4[_0x597f('0x25')]):_0x597f('0x27'),'XMD-AGIAFTER':_0x487ac4['dialQueueProject2']?util[_0x597f('0x14')]('\x22agi://%s/square,%s\x22',ipAgi,_0x487ac4['dialQueueProject2']):_0x597f('0x27'),'XMD-ORIGINATECALLERIDNUM':_0x57cf2c?_0x57cf2c[_0x597f('0x28')]:'','XMD-ORIGINATECALLERIDNAME':_0x57cf2c?_0x57cf2c[_0x597f('0x29')]:'','XMD-DESTINATION':'xcally-motion-preview'};if(!_[_0x597f('0x13')](_0x487ac4['monitor_format'])){_0x389b60[util[_0x597f('0x14')]('%s',_0x597f('0x2a'))]=_0x487ac4[_0x597f('0x22')];_0x389b60[util['format']('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x1b30eb;}if(_0x4a21e9&&_0x4a21e9[_0x597f('0x2b')]){for(var _0x2b6dce in _0x4a21e9[_0x597f('0x2b')]){if(_0x4a21e9[_0x597f('0x2b')][_0x597f('0x2c')](_0x2b6dce)){if(!_[_0x597f('0x18')](_0x4a21e9['Contact'][_0x2b6dce])&&_0x2b6dce!=='id'&&_0x2b6dce!=='tags'&&_0x2b6dce!==_0x597f('0x2d')&&_0x2b6dce!==_0x597f('0x2e')){_0x389b60[util['format']('%s%s',_0x597f('0x2f'),_['toUpper'](_0x2b6dce))]=_0x4a21e9[_0x597f('0x2b')][_0x2b6dce];}}}}return _0x389b60;};exports['toLowerVariables']=function(_0x50d659){var _0x470ee1={};for(var _0x3dd22d in _0x50d659){if(_0x50d659[_0x597f('0x2c')](_0x3dd22d)){_0x470ee1[util[_0x597f('0x14')]('%s',_[_0x597f('0x30')](_0x3dd22d))]=_0x50d659[_0x3dd22d];}}return{'variables':_0x470ee1};};exports['updateOriginated']=function(_0x3fa250,_0x4d1cac){if(!_[_0x597f('0x18')](_0x3fa250)){if(_0x3fa250[_0x597f('0x2c')](_0x597f('0x31'))){if(_0x3fa250[_0x597f('0x31')]>0x0){_0x3fa250[_0x597f('0x31')]-=0x1;}else{logger[_0x597f('0xb')](_0x597f('0x32'),_0x4d1cac);}}}else{logger['error'](_0x597f('0x33'),_0x4d1cac);}};exports[_0x597f('0x34')]=function(_0x349f18){var _0x170d03=moment()[_0x597f('0x14')](_0x597f('0x35'));_0x349f18[_0x597f('0x36')]=0xd;_0x349f18[_0x597f('0x37')]=_0x597f('0x38');_0x349f18['starttime']=_0x170d03;_0x349f18['responsetime']=_0x170d03;_0x349f18[_0x597f('0x39')]=_0x170d03;};exports[_0x597f('0x3a')]=function(_0x97a28f,_0x1cfeb9,_0x4788){var _0x137cdd=moment()[_0x597f('0x14')](_0x597f('0x35'));_0x97a28f[_0x597f('0x36')]=_0x1cfeb9;_0x97a28f[_0x597f('0x37')]=_0x4788;_0x97a28f[_0x597f('0x3b')]=_0x137cdd;_0x97a28f[_0x597f('0x3c')]=getSeconds(_0x97a28f[_0x597f('0x3b')],_0x97a28f['starttime']);};exports[_0x597f('0x3d')]=function(_0x2143b2,_0x466e67,_0x2b136a){_0x2143b2[_0x597f('0x3e')]=_0x466e67;_0x2143b2['UserId']=_0x2b136a;};exports['logCustomer']=function(_0x245b2c,_0x424186,_0x30b66c){var _0x4eba29=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x245b2c[_0x597f('0x36')]=_0x424186;_0x245b2c[_0x597f('0x37')]=_0x30b66c;_0x245b2c['responsetime']=_0x245b2c['responsetime']?_0x245b2c[_0x597f('0x3b')]:_0x4eba29;_0x245b2c['endtime']=_0x245b2c[_0x597f('0x39')]?_0x245b2c['endtime']:_0x4eba29;_0x245b2c[_0x597f('0x3c')]=getSeconds(_0x245b2c['responsetime']||0x0,_0x245b2c[_0x597f('0x3f')]||0x0);_0x245b2c[_0x597f('0x40')]=_0x245b2c[_0x597f('0x41')]?getSeconds(_0x245b2c['endtime'],_0x245b2c[_0x597f('0x41')]):0x0;};exports[_0x597f('0x42')]=function(_0x22b914){return _0x22b914===_0x597f('0x43');};exports[_0x597f('0x44')]=function(_0x393899,_0x5957b5,_0x472407,_0x36228d,_0x43573e){var _0x498291=_0x36228d?_0x597f('0x45'):_0x393899[_0x597f('0x1c')];_0x498291=_0x43573e?'BOOKED':_0x498291;return{'actionid':_0x393899[_0x597f('0x46')],'action':_0x597f('0x47'),'channel':_0x393899[_0x597f('0x48')],'callerid':util['format']('\x22%s\x22\x20<%s>',_0x498291,_0x393899[_0x597f('0x1d')]),'Exten':_0x597f('0x49'),'Context':_0x597f('0x4a'),'Priority':'1','variable':_0x472407,'timeout':(_0x5957b5['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x393899[_0x597f('0x46')]};};exports[_0x597f('0x4b')]=function(_0x2f0772){return _0x2f0772['countbusyretry']+_0x2f0772[_0x597f('0x4c')]+_0x2f0772[_0x597f('0x4d')]+_0x2f0772[_0x597f('0x4e')]+_0x2f0772[_0x597f('0x4f')];};exports[_0x597f('0x50')]=function(_0x173dd6){var _0x5ead0b=_[_0x597f('0x51')](_0x173dd6);_0x5ead0b[_0x597f('0x36')]=0xf;_0x5ead0b[_0x597f('0x37')]=_0x597f('0x52');return _0x5ead0b;};exports[_0x597f('0x53')]=function(_0x551669,_0x3223d2,_0x4475ca){var _0x3a4b01={};_0x3a4b01[_0x3223d2]=_0x551669[_0x3223d2];_0x3a4b01[_0x597f('0x54')]=![];_0x3a4b01[_0x597f('0x55')]=moment()[_0x597f('0x56')](_0x4475ca,_0x597f('0x57'))[_0x597f('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x3a4b01['ContactId']=_0x551669[_0x597f('0x1e')];_0x3a4b01[_0x597f('0x58')]=_0x551669[_0x597f('0x58')];_0x3a4b01[_0x597f('0x1f')]=_0x551669['VoiceQueueId']||undefined;return _0x3a4b01;};exports[_0x597f('0x59')]=function(_0x702566,_0x519841){if(!_['isNil'](_0x702566)){if(_0x702566[_0x597f('0x5a')]>0x0){_0x702566[_0x597f('0x5a')]-=0x1;}else{logger['error'](_0x519841,_0x597f('0x5b'));}}else{logger[_0x597f('0xb')](_0x519841,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports['IsNotLoggedIn']=function(_0x179d2f){if(_0x179d2f<=0x0){return!![];}return![];};exports[_0x597f('0x5c')]=function(_0x182a51,_0x271d3d,_0x1914b6){_0x182a51[_0x597f('0x5d')]=_0x271d3d;_0x182a51[_0x597f('0x1b')]=_0x182a51[_0x597f('0x5e')];_0x182a51['interface']=_0x182a51[_0x597f('0x48')];if(_0x1914b6){_0x182a51[_0x597f('0x5f')]=_0x1914b6[_0x597f('0x5f')];}return _0x182a51;};exports[_0x597f('0x60')]=function(_0x1ccec9){var _0x144d28={};_0x144d28[_0x597f('0x5e')]=_0x1ccec9[_0x597f('0x5e')];_0x144d28['interface']=_0x1ccec9[_0x597f('0x48')];_0x144d28[_0x597f('0x46')]=_0x1ccec9[_0x597f('0x46')];return _0x144d28;};exports[_0x597f('0x61')]=function(_0x281384){var _0x2edb98=[];for(var _0x594f04 in _0x281384){if(_0x281384[_0x597f('0x2c')](_0x594f04)){if(!_['isNil'](_0x281384[_0x594f04])&&_0x281384[_0x594f04][_0x597f('0x36')]===_0x597f('0x62')&&_0x281384[_0x594f04][_0x597f('0x63')]===_0x597f('0x64')){_0x2edb98[_0x597f('0x65')](_0x281384[_0x594f04]['id']);}}}return _0x2edb98;};exports['getDiff']=function(_0x42528c){var _0x28b651=moment()[_0x597f('0x8')](0x0);var _0x2689be=moment(_0x42528c)[_0x597f('0x8')](0x0);return _0x28b651['diff'](_0x2689be,_0x597f('0x9'));};exports['createBody']=function(_0x4fa4d8){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x4fa4d8['ContactId'],'ListId':_0x4fa4d8[_0x597f('0x58')],'VoiceQueueId':_0x4fa4d8[_0x597f('0x1f')]||undefined,'CampaignId':_0x4fa4d8['CampaignId']||undefined};};exports[_0x597f('0x66')]=function(_0x2b8dee){if(_0x2b8dee===_0x597f('0x46')||_0x2b8dee===_0x597f('0x67')||_0x2b8dee===_0x597f('0x5e')||_0x2b8dee===_0x597f('0x68')||_0x2b8dee==='campaigntype'||_0x2b8dee===_0x597f('0x69')||_0x2b8dee==='membername'||_0x2b8dee===_0x597f('0x48')||_0x2b8dee===_0x597f('0x1c')||_0x2b8dee===_0x597f('0x54')||_0x2b8dee===_0x597f('0x1d')||_0x2b8dee===_0x597f('0x55')||_0x2b8dee==='countbusyretry'||_0x2b8dee===_0x597f('0x4c')||_0x2b8dee===_0x597f('0x4d')||_0x2b8dee==='countglobal'||_0x2b8dee==='callback'||_0x2b8dee==='callbackuniqueid'||_0x2b8dee===_0x597f('0x6a')||_0x2b8dee===_0x597f('0x6b')||_0x2b8dee==='ContactId'||_0x2b8dee===_0x597f('0x58')||_0x2b8dee===_0x597f('0x6c')||_0x2b8dee==='VoiceQueueId'||_0x2b8dee===_0x597f('0x6d')||_0x2b8dee===_0x597f('0x6e')||_0x2b8dee==='xmd-queue'||_0x2b8dee===_0x597f('0x6f')||_0x2b8dee===_0x597f('0x70')||_0x2b8dee===_0x597f('0x71')||_0x2b8dee===_0x597f('0x72')||_0x2b8dee===_0x597f('0x73')||_0x2b8dee===_0x597f('0x74')||_0x2b8dee===_0x597f('0x75')||_0x2b8dee===_0x597f('0x76')||_0x2b8dee===_0x597f('0x77')||_0x2b8dee===_0x597f('0x78')||_0x2b8dee===_0x597f('0x79')||_0x2b8dee===_0x597f('0x7a')||_0x2b8dee===_0x597f('0x7b')||_0x2b8dee===_0x597f('0x7c')||_0x2b8dee==='rtpaudioqosjitter'||_0x2b8dee==='rtpaudioqosjitterbridged'||_0x2b8dee===_0x597f('0x7d')||_0x2b8dee===_0x597f('0x7e')||_0x2b8dee===_0x597f('0x7f')||_0x2b8dee===_0x597f('0x80')||_0x2b8dee===_0x597f('0x7b')||_0x2b8dee===_0x597f('0x7c')||_0x2b8dee===_0x597f('0x81')||_0x2b8dee==='rtpaudioqosjitterbridged'||_0x2b8dee===_0x597f('0x7d')||_0x2b8dee===_0x597f('0x7e')||_0x2b8dee===_0x597f('0x7f')||_0x2b8dee===_0x597f('0x80')||_0x2b8dee===_0x597f('0x82')||_0x2b8dee==='bridgepvtcallid'||_0x2b8dee===_0x597f('0x36')||_0x2b8dee===_0x597f('0x37')){return![];}return!![];};exports[_0x597f('0x83')]=function(_0x25f3cc,_0x3db99d){var _0x49c3f6,_0x2e9be8,_0x179c82;if(_0x3db99d<=0x0){_0x3db99d=0x1;}_0x49c3f6=new RegExp(_0x597f('0x84')+_0x3db99d+'}$');_0x2e9be8=Math['pow'](0xa,_0x3db99d-0x1);_0x179c82=Math[_0x597f('0x85')](0xa,_0x3db99d)-0x1;return util['format']('%s',_['replace'](_0x25f3cc,_0x49c3f6,_['random'](_0x2e9be8,_0x179c82)));};exports[_0x597f('0x86')]=function(_0x30a345){var _0x24e892=_0x30a345[_0x597f('0x87')](/"(.*?)"/);return _0x24e892?_0x24e892[0x1]:_0x30a345;};exports[_0x597f('0x88')]=function(_0x509900){var _0x57a1a9=_0x509900[_0x597f('0x87')](/<(.*?)>/);return _0x57a1a9?_0x57a1a9[0x1]:_0x509900;}; \ No newline at end of file +var _0x4211=['name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','%s%s','XMD-','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','ringtime','logLookAgent','membername','UserId','talktime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','from-sip','timeout','totalGlobal','countcongestionretry','countagentrejectretry','cloneAction','add','YYYY-MM-DD\x20HH:mm:ss','ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','lastevent','queue','channelAgent','mandatoryDisposition','buildAcw','interface','agentReadyId','not_inuse','status','reachable','push','getDiff','diff','createBody','CampaignId','filterKey','idContact','type','dialAnswer','active','scheduledat','countbusyretry','countnoanswerretry','countglobal','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialchannel','xmd-contactid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosrtt','bridgepvtcallid','getCallerIdRandom','pow','replace','random','match','extractCalleridNumber','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','seconds','loggerCatch','error','inspect','logger','loggerError','logger2','info','message','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','isActive','isNil','Queue'];(function(_0x2b885f,_0x250da5){var _0x21ce09=function(_0xa996d8){while(--_0xa996d8){_0x2b885f['push'](_0x2b885f['shift']());}};_0x21ce09(++_0x250da5);}(_0x4211,0x104));var _0x1421=function(_0x2f7e37,_0x3d977a){_0x2f7e37=_0x2f7e37-0x0;var _0x265027=_0x4211[_0x2f7e37];return _0x265027;};'use strict';var util=require(_0x1421('0x0'));var _=require(_0x1421('0x1'));var moment=require(_0x1421('0x2'));var logger=require(_0x1421('0x3'))(_0x1421('0x4'));var ipAgi=process[_0x1421('0x5')][_0x1421('0x6')]||_0x1421('0x7');function getSeconds(_0x53f55c,_0xca144d){var _0x5e691f=moment(_0x53f55c)['milliseconds'](0x0);var _0x136d7c=moment(_0xca144d)[_0x1421('0x8')](0x0);return _0x5e691f['diff'](_0x136d7c,_0x1421('0x9'));}exports[_0x1421('0xa')]=function(_0x571f09){return function(_0x4d143e){logger[_0x1421('0xb')](_0x571f09,util[_0x1421('0xc')](_0x4d143e,{'showHidden':![],'depth':null}));};};exports[_0x1421('0xd')]=function(_0xa8c90e,_0x5d9a41){logger['info'](_0xa8c90e,util[_0x1421('0xc')](_0x5d9a41,{'showHidden':![],'depth':null}));};exports[_0x1421('0xe')]=function(_0x545423,_0x4cf93d){logger['error'](_0x545423,util[_0x1421('0xc')](_0x4cf93d,{'showHidden':![],'depth':null}));};exports[_0x1421('0xf')]=function(_0x505020){return function(_0x37f254){logger[_0x1421('0x10')](_0x505020,util['inspect'](_0x37f254,{'showHidden':![],'depth':null}));};};exports[_0x1421('0x11')]=function(_0x16b416,_0x236323,_0x2bc022){return{'message':_0x16b416,'unlock':_0x236323,'active':_0x2bc022};};exports['getCallerId']=function(_0xc3748c,_0x2ebc08,_0xe05768){if(!_[_0x1421('0x12')](_0xe05768)&&_0x1421('0x13')===typeof _0xe05768&&!_[_0x1421('0x14')](_0xe05768)){if(!_[_0x1421('0x12')](_0x2ebc08)&&_0x1421('0x13')===typeof _0x2ebc08&&!_[_0x1421('0x14')](_0x2ebc08)){return util[_0x1421('0x15')](_0x1421('0x16'),_0x2ebc08,_0xe05768);}return util[_0x1421('0x15')](_0x1421('0x16'),_0xe05768,_0xe05768);}if(!_['isUndefined'](_0xc3748c)&&_0x1421('0x13')===typeof _0xc3748c&&!_[_0x1421('0x14')](_0xc3748c)){return _0xc3748c;}return'\x22\x22\x20<>';};exports[_0x1421('0x17')]=function(_0x3ea017){if(_[_0x1421('0x18')](_0x3ea017)){return![];}return _0x3ea017;};exports['addVariables']=function(_0x13e980,_0x54baee,_0x331c92,_0x4d7e11,_0x2a3ffa,_0x1db417){var _0x4e74b1={'XMD-QUEUE':_0x54baee[_0x1421('0x19')]?_0x54baee[_0x1421('0x19')][_0x1421('0x1a')]:'','XMD-CALLERID':_0x4d7e11,'XMD-CALLERID-PREVIEW':_0x1db417?util[_0x1421('0x15')](_0x1421('0x16'),_0x1db417[_0x1421('0x1b')],_0x1db417[_0x1421('0x1c')]):_0x4d7e11,'XMD-DIALID':_0x2a3ffa,'XMD-CONTACTID':_0x54baee[_0x1421('0x1d')],'XMD-CDRTYPE':_0x1421('0x1e'),'CALLERID(all)':_0x4d7e11,'XMD-VOICEQUEUEID':_0x54baee[_0x1421('0x1f')],'XMD-DIALCHANNEL':_0x331c92,'XMD-DIALTIMEOUT':_0x13e980[_0x1421('0x20')]||0x1e,'XMD-DIALOPTIONS':util[_0x1421('0x15')](_0x1421('0x21'),_0x13e980[_0x1421('0x22')]?'g':'',_[_0x1421('0x14')](_0x13e980[_0x1421('0x23')])?'':_0x1421('0x24')),'XMD-DIALURL':_0x13e980[_0x1421('0x25')]||'','XMD-AGI':_0x13e980[_0x1421('0x26')]?util[_0x1421('0x15')](_0x1421('0x27'),ipAgi,_0x13e980['dialQueueProject']):_0x1421('0x28'),'XMD-AGIAFTER':_0x13e980[_0x1421('0x22')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x13e980['dialQueueProject2']):_0x1421('0x28'),'XMD-ORIGINATECALLERIDNUM':_0x1db417?_0x1db417[_0x1421('0x29')]:'','XMD-ORIGINATECALLERIDNAME':_0x1db417?_0x1db417[_0x1421('0x2a')]:'','XMD-DESTINATION':_0x1421('0x2b')};if(!_[_0x1421('0x14')](_0x13e980['monitor_format'])){_0x4e74b1[util[_0x1421('0x15')]('%s',_0x1421('0x2c'))]=_0x13e980[_0x1421('0x23')];_0x4e74b1[util[_0x1421('0x15')]('%s',_0x1421('0x2d'))]=_0x2a3ffa;}if(_0x54baee&&_0x54baee[_0x1421('0x2e')]){for(var _0x101173 in _0x54baee[_0x1421('0x2e')]){if(_0x54baee['Contact'][_0x1421('0x2f')](_0x101173)){if(!_[_0x1421('0x18')](_0x54baee[_0x1421('0x2e')][_0x101173])&&_0x101173!=='id'&&_0x101173!==_0x1421('0x30')&&_0x101173!==_0x1421('0x31')&&_0x101173!=='updatedAt'){_0x4e74b1[util['format'](_0x1421('0x32'),_0x1421('0x33'),_['toUpper'](_0x101173))]=_0x54baee[_0x1421('0x2e')][_0x101173];}}}}return _0x4e74b1;};exports[_0x1421('0x34')]=function(_0x2a57e9){var _0x16d5e3={};for(var _0xaed0e4 in _0x2a57e9){if(_0x2a57e9[_0x1421('0x2f')](_0xaed0e4)){_0x16d5e3[util[_0x1421('0x15')]('%s',_[_0x1421('0x35')](_0xaed0e4))]=_0x2a57e9[_0xaed0e4];}}return{'variables':_0x16d5e3};};exports[_0x1421('0x36')]=function(_0x253d13,_0x738774){if(!_[_0x1421('0x18')](_0x253d13)){if(_0x253d13[_0x1421('0x2f')](_0x1421('0x37'))){if(_0x253d13[_0x1421('0x37')]>0x0){_0x253d13[_0x1421('0x37')]-=0x1;}else{logger[_0x1421('0xb')](_0x1421('0x38'),_0x738774);}}}else{logger[_0x1421('0xb')](_0x1421('0x39'),_0x738774);}};exports['logBlacklist']=function(_0x4dae20){var _0x2b549a=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4dae20[_0x1421('0x3a')]=0xd;_0x4dae20[_0x1421('0x3b')]=_0x1421('0x3c');_0x4dae20[_0x1421('0x3d')]=_0x2b549a;_0x4dae20[_0x1421('0x3e')]=_0x2b549a;_0x4dae20[_0x1421('0x3f')]=_0x2b549a;};exports[_0x1421('0x40')]=function(_0x32ec98,_0x2041b6,_0x194af6){var _0x1e9a27=moment()[_0x1421('0x15')]('YYYY-MM-DD\x20HH:mm:ss');_0x32ec98[_0x1421('0x3a')]=_0x2041b6;_0x32ec98[_0x1421('0x3b')]=_0x194af6;_0x32ec98[_0x1421('0x3e')]=_0x1e9a27;_0x32ec98[_0x1421('0x41')]=getSeconds(_0x32ec98['responsetime'],_0x32ec98[_0x1421('0x3d')]);};exports[_0x1421('0x42')]=function(_0x5dec65,_0x166643,_0x2a60b1){_0x5dec65[_0x1421('0x43')]=_0x166643;_0x5dec65[_0x1421('0x44')]=_0x2a60b1;};exports['logCustomer']=function(_0x2c750d,_0x3d46e7,_0x2c2574){var _0x2b9cbb=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2c750d[_0x1421('0x3a')]=_0x3d46e7;_0x2c750d[_0x1421('0x3b')]=_0x2c2574;_0x2c750d[_0x1421('0x3e')]=_0x2c750d['responsetime']?_0x2c750d[_0x1421('0x3e')]:_0x2b9cbb;_0x2c750d[_0x1421('0x3f')]=_0x2c750d['endtime']?_0x2c750d[_0x1421('0x3f')]:_0x2b9cbb;_0x2c750d['ringtime']=getSeconds(_0x2c750d[_0x1421('0x3e')]||0x0,_0x2c750d[_0x1421('0x3d')]||0x0);_0x2c750d[_0x1421('0x45')]=_0x2c750d[_0x1421('0x46')]?getSeconds(_0x2c750d[_0x1421('0x3f')],_0x2c750d[_0x1421('0x46')]):0x0;};exports[_0x1421('0x47')]=function(_0x1a9cd4){return _0x1a9cd4===_0x1421('0x48');};exports[_0x1421('0x49')]=function(_0x124f79,_0x375402,_0x12f571,_0x3259b2,_0x438209){var _0x1514a0=_0x3259b2?_0x1421('0x4a'):_0x124f79['calleridname'];_0x1514a0=_0x438209?_0x1421('0x4b'):_0x1514a0;return{'actionid':_0x124f79[_0x1421('0x4c')],'action':_0x1421('0x4d'),'channel':_0x124f79['channelAgent'],'callerid':util[_0x1421('0x15')](_0x1421('0x16'),_0x1514a0,_0x124f79[_0x1421('0x1c')]),'Exten':_0x1421('0x2b'),'Context':_0x1421('0x4e'),'Priority':'1','variable':_0x12f571,'timeout':(_0x375402[_0x1421('0x4f')]||0x1e)*0x3e8,'async':!![],'channelid':_0x124f79[_0x1421('0x4c')]};};exports[_0x1421('0x50')]=function(_0x4f2bc1){return _0x4f2bc1['countbusyretry']+_0x4f2bc1[_0x1421('0x51')]+_0x4f2bc1['countnoanswerretry']+_0x4f2bc1[_0x1421('0x52')]+_0x4f2bc1['countnosuchnumberretry'];};exports[_0x1421('0x53')]=function(_0x26f0a2){var _0x56ccf5=_['clone'](_0x26f0a2);_0x56ccf5[_0x1421('0x3a')]=0xf;_0x56ccf5[_0x1421('0x3b')]='Global';return _0x56ccf5;};exports['scheduledAt']=function(_0x12f548,_0x2af6ea,_0x3dae96){var _0x11c6e6={};_0x11c6e6[_0x2af6ea]=_0x12f548[_0x2af6ea];_0x11c6e6['active']=![];_0x11c6e6['scheduledat']=moment()[_0x1421('0x54')](_0x3dae96,'minutes')['format'](_0x1421('0x55'));_0x11c6e6['ContactId']=_0x12f548[_0x1421('0x1d')];_0x11c6e6[_0x1421('0x56')]=_0x12f548[_0x1421('0x56')];_0x11c6e6['VoiceQueueId']=_0x12f548[_0x1421('0x1f')]||undefined;return _0x11c6e6;};exports['decrementTalkink']=function(_0xf4e457,_0xe893f5){if(!_[_0x1421('0x18')](_0xf4e457)){if(_0xf4e457[_0x1421('0x57')]>0x0){_0xf4e457[_0x1421('0x57')]-=0x1;}else{logger[_0x1421('0xb')](_0xe893f5,_0x1421('0x58'));}}else{logger[_0x1421('0xb')](_0xe893f5,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x1421('0x59')]=function(_0x48d7e1){if(_0x48d7e1<=0x0){return!![];}return![];};exports['buildObj']=function(_0x5956bf,_0x2ab507,_0x2d9888){_0x5956bf[_0x1421('0x5a')]=_0x2ab507;_0x5956bf[_0x1421('0x1a')]=_0x5956bf[_0x1421('0x5b')];_0x5956bf['interface']=_0x5956bf[_0x1421('0x5c')];if(_0x2d9888){_0x5956bf[_0x1421('0x5d')]=_0x2d9888[_0x1421('0x5d')];}return _0x5956bf;};exports[_0x1421('0x5e')]=function(_0x352860){var _0x493f24={};_0x493f24[_0x1421('0x5b')]=_0x352860[_0x1421('0x5b')];_0x493f24[_0x1421('0x5f')]=_0x352860[_0x1421('0x5c')];_0x493f24[_0x1421('0x4c')]=_0x352860['uniqueid'];return _0x493f24;};exports[_0x1421('0x60')]=function(_0x13b074){var _0x10fa9b=[];for(var _0x486696 in _0x13b074){if(_0x13b074[_0x1421('0x2f')](_0x486696)){if(!_[_0x1421('0x18')](_0x13b074[_0x486696])&&_0x13b074[_0x486696][_0x1421('0x3a')]===_0x1421('0x61')&&_0x13b074[_0x486696][_0x1421('0x62')]===_0x1421('0x63')){_0x10fa9b[_0x1421('0x64')](_0x13b074[_0x486696]['id']);}}}return _0x10fa9b;};exports[_0x1421('0x65')]=function(_0x1bc75e){var _0x3e53c5=moment()[_0x1421('0x8')](0x0);var _0x600866=moment(_0x1bc75e)['milliseconds'](0x0);return _0x3e53c5[_0x1421('0x66')](_0x600866,_0x1421('0x9'));};exports[_0x1421('0x67')]=function(_0x3826a1){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x3826a1['ContactId'],'ListId':_0x3826a1[_0x1421('0x56')],'VoiceQueueId':_0x3826a1['VoiceQueueId']||undefined,'CampaignId':_0x3826a1[_0x1421('0x68')]||undefined};};exports[_0x1421('0x69')]=function(_0x1c90df){if(_0x1c90df===_0x1421('0x4c')||_0x1c90df===_0x1421('0x6a')||_0x1c90df===_0x1421('0x5b')||_0x1c90df===_0x1421('0x6b')||_0x1c90df==='campaigntype'||_0x1c90df===_0x1421('0x6c')||_0x1c90df===_0x1421('0x43')||_0x1c90df===_0x1421('0x5c')||_0x1c90df===_0x1421('0x1b')||_0x1c90df===_0x1421('0x6d')||_0x1c90df===_0x1421('0x1c')||_0x1c90df===_0x1421('0x6e')||_0x1c90df===_0x1421('0x6f')||_0x1c90df===_0x1421('0x51')||_0x1c90df===_0x1421('0x70')||_0x1c90df===_0x1421('0x71')||_0x1c90df==='callback'||_0x1c90df===_0x1421('0x72')||_0x1c90df===_0x1421('0x73')||_0x1c90df===_0x1421('0x74')||_0x1c90df===_0x1421('0x1d')||_0x1c90df==='ListId'||_0x1c90df===_0x1421('0x44')||_0x1c90df===_0x1421('0x1f')||_0x1c90df===_0x1421('0x75')||_0x1c90df===_0x1421('0x76')||_0x1c90df===_0x1421('0x77')||_0x1c90df===_0x1421('0x78')||_0x1c90df===_0x1421('0x79')||_0x1c90df===_0x1421('0x7a')||_0x1c90df===_0x1421('0x7b')||_0x1c90df==='xmd-dialoptions'||_0x1c90df==='xmd-dialid'||_0x1c90df===_0x1421('0x7c')||_0x1c90df===_0x1421('0x7d')||_0x1c90df==='xmd-cdrtype'||_0x1c90df==='xmd-callerid'||_0x1c90df===_0x1421('0x7e')||_0x1c90df===_0x1421('0x7f')||_0x1c90df===_0x1421('0x80')||_0x1c90df===_0x1421('0x81')||_0x1c90df===_0x1421('0x82')||_0x1c90df===_0x1421('0x83')||_0x1c90df===_0x1421('0x84')||_0x1c90df===_0x1421('0x85')||_0x1c90df==='rtpaudioqosrtt'||_0x1c90df===_0x1421('0x86')||_0x1c90df===_0x1421('0x80')||_0x1c90df===_0x1421('0x81')||_0x1c90df===_0x1421('0x82')||_0x1c90df==='rtpaudioqosjitterbridged'||_0x1c90df===_0x1421('0x84')||_0x1c90df===_0x1421('0x85')||_0x1c90df===_0x1421('0x87')||_0x1c90df==='rtpaudioqosrttbridged'||_0x1c90df==='bridgepeer'||_0x1c90df===_0x1421('0x88')||_0x1c90df===_0x1421('0x3a')||_0x1c90df==='statedesc'){return![];}return!![];};exports[_0x1421('0x89')]=function(_0xa93ec8,_0x4802f5){var _0x5cab5c,_0x1925ae,_0x1f3f3e;if(_0x4802f5<=0x0){_0x4802f5=0x1;}_0x5cab5c=new RegExp('\x5cw{0,'+_0x4802f5+'}$');_0x1925ae=Math[_0x1421('0x8a')](0xa,_0x4802f5-0x1);_0x1f3f3e=Math[_0x1421('0x8a')](0xa,_0x4802f5)-0x1;return util['format']('%s',_[_0x1421('0x8b')](_0xa93ec8,_0x5cab5c,_[_0x1421('0x8c')](_0x1925ae,_0x1f3f3e)));};exports['extractCalleridName']=function(_0x64704d){var _0x2de352=_0x64704d[_0x1421('0x8d')](/"(.*?)"/);return _0x2de352?_0x2de352[0x1]:_0x64704d;};exports[_0x1421('0x8e')]=function(_0x330ad5){var _0xd5e867=_0x330ad5[_0x1421('0x8d')](/<(.*?)>/);return _0xd5e867?_0xd5e867[0x1]:_0x330ad5;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index a0e5fd5..715e58f 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 _0x4616=['queueremove','reload','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','boolean'];(function(_0x58298c,_0x34db70){var _0xc42a1b=function(_0xb96d9){while(--_0xb96d9){_0x58298c['push'](_0x58298c['shift']());}};_0xc42a1b(++_0x34db70);}(_0x4616,0x176));var _0x6461=function(_0x1d5966,_0x196f2d){_0x1d5966=_0x1d5966-0x0;var _0x261bd5=_0x4616[_0x1d5966];return _0x261bd5;};'use strict';exports[_0x6461('0x0')]={'queue':{'type':_0x6461('0x1'),'required':!![]},'interface':{'type':_0x6461('0x1'),'required':!![]},'membername':{'type':_0x6461('0x1'),'required':!![]},'penalty':{'type':_0x6461('0x2'),'required':![]},'paused':{'type':_0x6461('0x3'),'required':![]}};exports[_0x6461('0x4')]={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0x6461('0x1'),'required':!![]},'paused':{'type':_0x6461('0x3')},'reason':{'type':_0x6461('0x1'),'required':![]}};exports[_0x6461('0x5')]={'module':{'type':_0x6461('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x6461('0x1'),'required':!![]}};exports[_0x6461('0x6')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x6461('0x1')},'format':{'type':_0x6461('0x1')},'mixmonitorid':{'type':_0x6461('0x1')}};exports[_0x6461('0x7')]={'uniqueid':{'type':_0x6461('0x1'),'required':!![]}};exports[_0x6461('0x8')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0x6461('0x1')}}; \ No newline at end of file +var _0x17b1=['queueremove','queuepause','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','boolean'];(function(_0x1bced6,_0x36eb58){var _0x123d05=function(_0x58ce52){while(--_0x58ce52){_0x1bced6['push'](_0x1bced6['shift']());}};_0x123d05(++_0x36eb58);}(_0x17b1,0x10a));var _0x117b=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0x17b1[_0x3740fe];return _0x55492b;};'use strict';exports[_0x117b('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x117b('0x1'),'required':!![]},'membername':{'type':_0x117b('0x1'),'required':!![]},'penalty':{'type':_0x117b('0x2'),'required':![]},'paused':{'type':_0x117b('0x3'),'required':![]}};exports[_0x117b('0x4')]={'queue':{'type':_0x117b('0x1'),'required':!![]},'interface':{'type':_0x117b('0x1'),'required':!![]}};exports[_0x117b('0x5')]={'interface':{'type':'string','required':!![]},'paused':{'type':_0x117b('0x3')},'reason':{'type':_0x117b('0x1'),'required':![]}};exports['reload']={'module':{'type':_0x117b('0x1'),'required':![]}};exports[_0x117b('0x6')]={'uniqueid':{'type':_0x117b('0x1'),'required':!![]}};exports[_0x117b('0x7')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':'string'},'format':{'type':_0x117b('0x1')},'mixmonitorid':{'type':_0x117b('0x1')}};exports[_0x117b('0x8')]={'uniqueid':{'type':_0x117b('0x1'),'required':!![]}};exports[_0x117b('0x9')]={'uniqueid':{'type':_0x117b('0x1'),'required':!![]},'exten':{'type':_0x117b('0x1'),'required':!![]},'context':{'type':_0x117b('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 6396515..fd5de4a 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 _0xfe0e=['SIP/%s','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','queueStatusComplete','prototype','mergeFromDatabase','agents','length','interface','isUndefined','initTelephones','telephones','initTrunks','initVoiceQueues','initTriggers','initTemplates','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','deskAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','uniqueid','queuecallerexit','diff','seconds','queuecallercompleteAt','queuecallerjoinAt','queuecallercomplete','queuecallerleaveAt','initVoiceCallReports','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initCampaignHopperHistory','bluebird','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/vtigerAccount','../model/servicenowAccount','../model/freshsalesAccount','../model/faxAccount','trunks','voiceQueues','triggers','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','name','isNil','format'];(function(_0x456e0c,_0x40824e){var _0x132987=function(_0x159cd6){while(--_0x159cd6){_0x456e0c['push'](_0x456e0c['shift']());}};_0x132987(++_0x40824e);}(_0xfe0e,0x10d));var _0xefe0=function(_0x4bd882,_0x350341){_0x4bd882=_0x4bd882-0x0;var _0x2f0513=_0xfe0e[_0x4bd882];return _0x2f0513;};'use strict';var BPromise=require(_0xefe0('0x0'));var util=require('util');var _=require('lodash');var moment=require(_0xefe0('0x1'));var Agent=require(_0xefe0('0x2'));var Telephone=require(_0xefe0('0x3'));var Trunk=require(_0xefe0('0x4'));var VoiceQueue=require(_0xefe0('0x5'));var Trigger=require('../model/trigger');var Template=require(_0xefe0('0x6'));var Campaign=require(_0xefe0('0x7'));var VoiceExtension=require(_0xefe0('0x8'));var ZendeskAccount=require(_0xefe0('0x9'));var SalesforceAccount=require(_0xefe0('0xa'));var FreshdeskAccount=require(_0xefe0('0xb'));var SugarcrmAccount=require(_0xefe0('0xc'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xefe0('0xd'));var ServicenowAccount=require(_0xefe0('0xe'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require(_0xefe0('0xf'));var FaxAccount=require(_0xefe0('0x10'));var Realtime=function(){this['agents']={};this['telephones']={};this[_0xefe0('0x11')]={};this[_0xefe0('0x12')]={};this[_0xefe0('0x13')]={};this[_0xefe0('0x14')]={};this[_0xefe0('0x15')]={};this[_0xefe0('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xefe0('0x17')]={};this[_0xefe0('0x18')]={};this[_0xefe0('0x19')]={};this[_0xefe0('0x1a')]={};this[_0xefe0('0x1b')]={};this[_0xefe0('0x1c')]={};this[_0xefe0('0x1d')]={};this['salesforceAccounts']={};this['sugarcrmAccounts']={};this['freshdeskAccounts']={};this['zohoAccounts']={};this['deskAccounts']={};this[_0xefe0('0x1e')]={};this[_0xefe0('0x1f')]={};this[_0xefe0('0x20')]={};this[_0xefe0('0x21')]={};this[_0xefe0('0x22')]={};};function freeIsNotKey(_0x1526b9,_0x1cf6e7,_0x5cd820){var _0x3c3d74=_[_0xefe0('0x23')](_0x1526b9,function(_0x49cf06,_0x6efc0){return _0x49cf06[_0x5cd820];});for(var _0xba6c4a in _0x1cf6e7){if(_0x1cf6e7[_0xefe0('0x24')](_0xba6c4a)){if(!_0x3c3d74[_0xba6c4a]){delete _0x1cf6e7[_0xba6c4a];}}}}function freeIsNotKeySip(_0x102a4d,_0xbb5ccd){var _0x3906d1=_[_0xefe0('0x23')](_0x102a4d,function(_0x1dceb2,_0x2c7cff){return util['format']('SIP/%s',_0x1dceb2[_0xefe0('0x25')]);});for(var _0x5a8cd0 in _0xbb5ccd){if(_0xbb5ccd[_0xefe0('0x24')](_0x5a8cd0)){if(!_0x3906d1[_0x5a8cd0]){delete _0xbb5ccd[_0x5a8cd0];}}}}function freeIsNotKeyAgent(_0x3ce5bb,_0x1b3227){var _0x399d54=_[_0xefe0('0x23')](_0x3ce5bb,function(_0xd87e3f,_0x4dc380){var _0x517e6a=_[_0xefe0('0x26')](_0xd87e3f['interface'])?util[_0xefe0('0x27')](_0xefe0('0x28'),_0xd87e3f[_0xefe0('0x25')]):_0xd87e3f['interface'];return _0x517e6a;});for(var _0x1789e0 in _0x1b3227){if(_0x1b3227['hasOwnProperty'](_0x1789e0)){if(!_0x399d54[_0x1789e0]){delete _0x1b3227[_0x1789e0];}}}}function clearVoiceCallReports(_0x4a0afe){_0x4a0afe[_0xefe0('0x29')]=0x0;_0x4a0afe[_0xefe0('0x2a')]=0x0;_0x4a0afe[_0xefe0('0x2b')]=0x0;_0x4a0afe[_0xefe0('0x2c')]=0x0;_0x4a0afe[_0xefe0('0x2d')]=0x0;}function clearCampaigns(_0x20cbbb){if(!_[_0xefe0('0x2e')](_0x20cbbb)){for(var _0x36b56e in _0x20cbbb){if(_0x20cbbb[_0xefe0('0x24')](_0x36b56e)){_0x20cbbb[_0x36b56e][_0xefe0('0x2f')]=0x0;_0x20cbbb[_0x36b56e]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x19d917){if(!_[_0xefe0('0x2e')](_0x19d917)){for(var _0x2189f1 in _0x19d917){if(_0x19d917['hasOwnProperty'](_0x2189f1)){_0x19d917[_0x2189f1]['total']=0x0;_0x19d917[_0x2189f1][_0xefe0('0x2a')]=0x0;_0x19d917[_0x2189f1][_0xefe0('0x30')]=0x0;_0x19d917[_0x2189f1][_0xefe0('0x31')]=0x0;_0x19d917[_0x2189f1][_0xefe0('0x2b')]=0x0;_0x19d917[_0x2189f1]['sumDuration']=0x0;_0x19d917[_0x2189f1][_0xefe0('0x2d')]=0x0;_0x19d917[_0x2189f1][_0xefe0('0x32')]=0x0;_0x19d917[_0x2189f1][_0xefe0('0x33')]=0x0;_0x19d917[_0x2189f1][_0xefe0('0x34')]=0x0;_0x19d917[_0x2189f1][_0xefe0('0x35')]=0x0;_0x19d917[_0x2189f1]['outboundNoSuchCallsDay']=0x0;_0x19d917[_0x2189f1]['outboundUnknownCallsDay']=0x0;_0x19d917[_0x2189f1][_0xefe0('0x36')]=0x0;_0x19d917[_0x2189f1][_0xefe0('0x37')]=0x0;_0x19d917[_0x2189f1][_0xefe0('0x38')]=0x0;_0x19d917[_0x2189f1][_0xefe0('0x39')]=0x0;_0x19d917[_0x2189f1][_0xefe0('0x3a')]=0x0;_0x19d917[_0x2189f1]['outboundReCallsDay']=0x0;_0x19d917[_0x2189f1][_0xefe0('0x32')]=0x0;_0x19d917[_0x2189f1]['outboundAnswerCallsDay']=0x0;_0x19d917[_0x2189f1][_0xefe0('0x3b')]=!![];}}}}Realtime[_0xefe0('0x3c')][_0xefe0('0x3d')]=function(_0x219e1f,_0x31c2ad){for(var _0x47bd8 in _0x31c2ad){if(_0x219e1f[_0xefe0('0x24')](_0x47bd8)){_0x219e1f[_0x47bd8]=_0x31c2ad[_0x47bd8];}}};Realtime[_0xefe0('0x3c')]['initAgents']=function(){var _0x5c5b4d=this;return function(_0x1e5a47){if(_0x1e5a47){freeIsNotKeyAgent(_0x1e5a47,_0x5c5b4d[_0xefe0('0x3e')]);for(var _0x1cb346=0x0,_0x11c020={},_0x45c607={};_0x1cb346<_0x1e5a47[_0xefe0('0x3f')];_0x1cb346+=0x1){_0x11c020=_0x1e5a47[_0x1cb346];var _0x2f5a06=_['isNil'](_0x11c020[_0xefe0('0x40')])?util[_0xefe0('0x27')](_0xefe0('0x28'),_0x11c020[_0xefe0('0x25')]):_0x11c020[_0xefe0('0x40')];if(_[_0xefe0('0x41')](_0x5c5b4d[_0xefe0('0x3e')][_0x2f5a06])){_0x5c5b4d[_0xefe0('0x3e')][_0x2f5a06]=new Agent(_0x11c020);}else{_0x5c5b4d['mergeFromDatabase'](_0x5c5b4d[_0xefe0('0x3e')][_0x2f5a06],_0x11c020);}}}return _0x5c5b4d[_0xefe0('0x3e')];};};Realtime[_0xefe0('0x3c')][_0xefe0('0x42')]=function(){var _0x3e95b3=this;return function(_0x177049){if(_0x177049){freeIsNotKeySip(_0x177049,_0x3e95b3[_0xefe0('0x43')]);for(var _0xb91228=0x0,_0x1a4793={},_0x2c3e0e={};_0xb91228<_0x177049['length'];_0xb91228+=0x1){_0x1a4793=_0x177049[_0xb91228];if(_['isUndefined'](_0x3e95b3[_0xefe0('0x43')][util[_0xefe0('0x27')]('SIP/%s',_0x1a4793[_0xefe0('0x25')])])){_0x3e95b3['telephones'][util['format'](_0xefe0('0x28'),_0x1a4793['name'])]=new Telephone(_0x1a4793);}else{_0x3e95b3[_0xefe0('0x3d')](_0x3e95b3[_0xefe0('0x43')][util[_0xefe0('0x27')](_0xefe0('0x28'),_0x1a4793[_0xefe0('0x25')])],_0x1a4793);}}}return _0x3e95b3[_0xefe0('0x43')];};};Realtime['prototype'][_0xefe0('0x44')]=function(){var _0x3138b5=this;return function(_0x9d7659){if(_0x9d7659){freeIsNotKeySip(_0x9d7659,_0x3138b5[_0xefe0('0x11')]);for(var _0x3f764d=0x0,_0x57b996={},_0x28bad2={};_0x3f764d<_0x9d7659[_0xefe0('0x3f')];_0x3f764d+=0x1){_0x57b996=_0x9d7659[_0x3f764d];if(_[_0xefe0('0x41')](_0x3138b5['trunks'][util['format'](_0xefe0('0x28'),_0x57b996[_0xefe0('0x25')])])){_0x3138b5[_0xefe0('0x11')][util[_0xefe0('0x27')](_0xefe0('0x28'),_0x57b996[_0xefe0('0x25')])]=new Trunk(_0x57b996);}else{_0x3138b5['mergeFromDatabase'](_0x3138b5[_0xefe0('0x11')][util['format'](_0xefe0('0x28'),_0x57b996['name'])],_0x57b996);}}}return _0x3138b5['trunks'];};};Realtime[_0xefe0('0x3c')][_0xefe0('0x45')]=function(){var _0x226934=this;return function(_0x111ca2){if(_0x111ca2){freeIsNotKey(_0x111ca2,_0x226934[_0xefe0('0x12')],_0xefe0('0x25'));for(var _0x4fe6b1=0x0,_0x219c5b={},_0x1426b1={};_0x4fe6b1<_0x111ca2[_0xefe0('0x3f')];_0x4fe6b1+=0x1){_0x219c5b=_0x111ca2[_0x4fe6b1];if(_[_0xefe0('0x41')](_0x226934[_0xefe0('0x12')][_0x219c5b[_0xefe0('0x25')]])){_0x226934[_0xefe0('0x12')][_0x219c5b[_0xefe0('0x25')]]=new VoiceQueue(_0x219c5b);}else{_0x226934[_0xefe0('0x3d')](_0x226934[_0xefe0('0x12')][_0x219c5b[_0xefe0('0x25')]],_0x219c5b);}}}return _0x226934['voiceQueues'];};};Realtime[_0xefe0('0x3c')][_0xefe0('0x46')]=function(){var _0x2fed39=this;return function(_0x300237){if(_0x300237){freeIsNotKey(_0x300237,_0x2fed39[_0xefe0('0x13')],'id');for(var _0x23b945=0x0,_0xbdc625={},_0x15eb80={};_0x23b945<_0x300237[_0xefe0('0x3f')];_0x23b945+=0x1){_0xbdc625=_0x300237[_0x23b945];if(_[_0xefe0('0x41')](_0x2fed39['triggers'][_0xbdc625['id']])){_0x2fed39[_0xefe0('0x13')][_0xbdc625['id']]=new Trigger(_0xbdc625);}else{_0x2fed39[_0xefe0('0x3d')](_0x2fed39[_0xefe0('0x13')][_0xbdc625['id']],_0xbdc625);}}}return _0x2fed39[_0xefe0('0x13')];};};Realtime['prototype'][_0xefe0('0x47')]=function(){var _0xd3c660=this;return function(_0x5f41cb){if(_0x5f41cb){freeIsNotKey(_0x5f41cb,_0xd3c660[_0xefe0('0x15')],'id');for(var _0x2477c7=0x0,_0x5bd613={},_0x4ce9e7={};_0x2477c7<_0x5f41cb[_0xefe0('0x3f')];_0x2477c7+=0x1){_0x5bd613=_0x5f41cb[_0x2477c7];if(_[_0xefe0('0x41')](_0xd3c660[_0xefe0('0x15')][_0x5bd613['id']])){_0xd3c660[_0xefe0('0x15')][_0x5bd613['id']]=new Template(_0x5bd613);}else{_0xd3c660['mergeFromDatabase'](_0xd3c660[_0xefe0('0x15')][_0x5bd613['id']],_0x5bd613);}}}return _0xd3c660[_0xefe0('0x15')];};};Realtime[_0xefe0('0x3c')]['initZendeskAccounts']=function(){var _0x5853b5=this;return function(_0x3842f9){if(_0x3842f9){freeIsNotKey(_0x3842f9,_0x5853b5[_0xefe0('0x1d')],'id');for(var _0x47e646=0x0,_0x495e2c={},_0x8391d2={};_0x47e646<_0x3842f9[_0xefe0('0x3f')];_0x47e646+=0x1){_0x495e2c=_0x3842f9[_0x47e646];if(_[_0xefe0('0x41')](_0x5853b5[_0xefe0('0x1d')][_0x495e2c['id']])){_0x5853b5[_0xefe0('0x1d')][_0x495e2c['id']]=new ZendeskAccount(_0x495e2c);}else{_0x5853b5[_0xefe0('0x3d')](_0x5853b5[_0xefe0('0x1d')][_0x495e2c['id']],_0x495e2c);}}}return _0x5853b5[_0xefe0('0x1d')];};};Realtime[_0xefe0('0x3c')][_0xefe0('0x48')]=function(){var _0x1e7f3b=this;return function(_0x3e3d72){if(_0x3e3d72){freeIsNotKey(_0x3e3d72,_0x1e7f3b[_0xefe0('0x49')],'id');for(var _0x183f76=0x0,_0x510590={},_0x68eb8f={};_0x183f76<_0x3e3d72[_0xefe0('0x3f')];_0x183f76+=0x1){_0x510590=_0x3e3d72[_0x183f76];if(_['isUndefined'](_0x1e7f3b[_0xefe0('0x49')][_0x510590['id']])){_0x1e7f3b[_0xefe0('0x49')][_0x510590['id']]=new SalesforceAccount(_0x510590);}else{_0x1e7f3b[_0xefe0('0x3d')](_0x1e7f3b[_0xefe0('0x49')][_0x510590['id']],_0x510590);}}}return _0x1e7f3b[_0xefe0('0x49')];};};Realtime[_0xefe0('0x3c')][_0xefe0('0x4a')]=function(){var _0x1be9af=this;return function(_0x42f9e0){if(_0x42f9e0){freeIsNotKey(_0x42f9e0,_0x1be9af[_0xefe0('0x4b')],'id');for(var _0x50208b=0x0,_0x3e206e={},_0x20ec93={};_0x50208b<_0x42f9e0[_0xefe0('0x3f')];_0x50208b+=0x1){_0x3e206e=_0x42f9e0[_0x50208b];if(_[_0xefe0('0x41')](_0x1be9af[_0xefe0('0x4b')][_0x3e206e['id']])){_0x1be9af['freshdeskAccounts'][_0x3e206e['id']]=new FreshdeskAccount(_0x3e206e);}else{_0x1be9af[_0xefe0('0x3d')](_0x1be9af['freshdeskAccounts'][_0x3e206e['id']],_0x3e206e);}}}return _0x1be9af['freshdeskAccounts'];};};Realtime[_0xefe0('0x3c')][_0xefe0('0x4c')]=function(){var _0x1340c3=this;return function(_0x424ee6){if(_0x424ee6){freeIsNotKey(_0x424ee6,_0x1340c3[_0xefe0('0x4d')],'id');for(var _0x1758fa=0x0,_0x2af78b={},_0x573956={};_0x1758fa<_0x424ee6[_0xefe0('0x3f')];_0x1758fa+=0x1){_0x2af78b=_0x424ee6[_0x1758fa];if(_[_0xefe0('0x41')](_0x1340c3[_0xefe0('0x4d')][_0x2af78b['id']])){_0x1340c3['zohoAccounts'][_0x2af78b['id']]=new ZohoAccount(_0x2af78b);}else{_0x1340c3['mergeFromDatabase'](_0x1340c3[_0xefe0('0x4d')][_0x2af78b['id']],_0x2af78b);}}}return _0x1340c3['zohoAccounts'];};};Realtime[_0xefe0('0x3c')][_0xefe0('0x4e')]=function(){var _0x52182e=this;return function(_0x28f486){if(_0x28f486){freeIsNotKey(_0x28f486,_0x52182e[_0xefe0('0x4f')],'id');for(var _0x141078=0x0,_0x513568={},_0xcc97c6={};_0x141078<_0x28f486[_0xefe0('0x3f')];_0x141078+=0x1){_0x513568=_0x28f486[_0x141078];if(_[_0xefe0('0x41')](_0x52182e['deskAccounts'][_0x513568['id']])){_0x52182e[_0xefe0('0x4f')][_0x513568['id']]=new DeskAccount(_0x513568);}else{_0x52182e['mergeFromDatabase'](_0x52182e[_0xefe0('0x4f')][_0x513568['id']],_0x513568);}}}return _0x52182e['deskAccounts'];};};Realtime[_0xefe0('0x3c')]['initSugarcrmAccounts']=function(){var _0x58ebd0=this;return function(_0x21c060){if(_0x21c060){freeIsNotKey(_0x21c060,_0x58ebd0[_0xefe0('0x50')],'id');for(var _0x26fc6b=0x0,_0x4c6868={},_0x25360f={};_0x26fc6b<_0x21c060[_0xefe0('0x3f')];_0x26fc6b+=0x1){_0x4c6868=_0x21c060[_0x26fc6b];if(_[_0xefe0('0x41')](_0x58ebd0[_0xefe0('0x50')][_0x4c6868['id']])){_0x58ebd0[_0xefe0('0x50')][_0x4c6868['id']]=new SugarcrmAccount(_0x4c6868);}else{_0x58ebd0['mergeFromDatabase'](_0x58ebd0[_0xefe0('0x50')][_0x4c6868['id']],_0x4c6868);}}}return _0x58ebd0[_0xefe0('0x50')];};};Realtime[_0xefe0('0x3c')][_0xefe0('0x51')]=function(){var _0x2e69bd=this;return function(_0x5b583d){if(_0x5b583d){freeIsNotKey(_0x5b583d,_0x2e69bd['vtigerAccounts'],'id');for(var _0x38cb67=0x0,_0x25aec2={},_0x2eea9b={};_0x38cb67<_0x5b583d[_0xefe0('0x3f')];_0x38cb67+=0x1){_0x25aec2=_0x5b583d[_0x38cb67];if(_[_0xefe0('0x41')](_0x2e69bd['vtigerAccounts'][_0x25aec2['id']])){_0x2e69bd[_0xefe0('0x1e')][_0x25aec2['id']]=new VtigerAccount(_0x25aec2);}else{_0x2e69bd[_0xefe0('0x3d')](_0x2e69bd[_0xefe0('0x1e')][_0x25aec2['id']],_0x25aec2);}}}return _0x2e69bd['vtigerAccounts'];};};Realtime[_0xefe0('0x3c')][_0xefe0('0x52')]=function(){var _0x4afd80=this;return function(_0x1eec27){if(_0x1eec27){freeIsNotKey(_0x1eec27,_0x4afd80[_0xefe0('0x1f')],'id');for(var _0x41d2d8=0x0,_0x516be0={},_0x4fafd4={};_0x41d2d8<_0x1eec27[_0xefe0('0x3f')];_0x41d2d8+=0x1){_0x516be0=_0x1eec27[_0x41d2d8];if(_[_0xefe0('0x41')](_0x4afd80['servicenowAccounts'][_0x516be0['id']])){_0x4afd80[_0xefe0('0x1f')][_0x516be0['id']]=new ServicenowAccount(_0x516be0);}else{_0x4afd80[_0xefe0('0x3d')](_0x4afd80['servicenowAccounts'][_0x516be0['id']],_0x516be0);}}}return _0x4afd80[_0xefe0('0x1f')];};};Realtime[_0xefe0('0x3c')][_0xefe0('0x53')]=function(){var _0x1c9297=this;return function(_0x200c7b){if(_0x200c7b){freeIsNotKey(_0x200c7b,_0x1c9297[_0xefe0('0x20')],'id');for(var _0x347020=0x0,_0x2f3178={},_0x4abf13={};_0x347020<_0x200c7b[_0xefe0('0x3f')];_0x347020+=0x1){_0x2f3178=_0x200c7b[_0x347020];if(_['isUndefined'](_0x1c9297[_0xefe0('0x20')][_0x2f3178['id']])){_0x1c9297[_0xefe0('0x20')][_0x2f3178['id']]=new Dynamics365Account(_0x2f3178);}else{_0x1c9297[_0xefe0('0x3d')](_0x1c9297[_0xefe0('0x20')][_0x2f3178['id']],_0x2f3178);}}}return _0x1c9297['dynamics365Accounts'];};};Realtime[_0xefe0('0x3c')]['initFreshsalesAccounts']=function(){var _0x541a35=this;return function(_0x43497a){if(_0x43497a){freeIsNotKey(_0x43497a,_0x541a35['freshsalesAccounts'],'id');for(var _0x59cdcf=0x0,_0xa964cd={},_0x50a37a={};_0x59cdcf<_0x43497a[_0xefe0('0x3f')];_0x59cdcf+=0x1){_0xa964cd=_0x43497a[_0x59cdcf];if(_['isUndefined'](_0x541a35[_0xefe0('0x21')][_0xa964cd['id']])){_0x541a35['freshsalesAccounts'][_0xa964cd['id']]=new FreshsalesAccount(_0xa964cd);}else{_0x541a35['mergeFromDatabase'](_0x541a35[_0xefe0('0x21')][_0xa964cd['id']],_0xa964cd);}}}return _0x541a35['freshsalesAccounts'];};};Realtime['prototype'][_0xefe0('0x54')]=function(){var _0x235d8d=this;return function(_0x4cdd21){for(var _0x43325a=0x0;_0x43325a<_0x4cdd21[_0xefe0('0x3f')];_0x43325a+=0x1){_[_0xefe0('0x55')](_0x235d8d[_0xefe0('0x12')][_0x4cdd21[_0x43325a][_0xefe0('0x25')]],_0x4cdd21[_0x43325a]);}return _0x235d8d[_0xefe0('0x12')];};};Realtime['prototype'][_0xefe0('0x56')]=function(){var _0x5563ac=this;return function(_0x16afea){clearVoiceQueues(_0x5563ac[_0xefe0('0x12')]);if(_0x16afea){_0x16afea=_['groupBy'](_0x16afea,_0xefe0('0x57'));for(var _0x481bc3 in _0x16afea){if(_0x16afea['hasOwnProperty'](_0x481bc3)){var _0x3dc4eb={};for(var _0x1db8b7=0x0;_0x1db8b7<_0x16afea[_0x481bc3]['length'];_0x1db8b7+=0x1){var _0xf4e6c4=_0x16afea[_0x481bc3][_0x1db8b7]['queue'];if(_0x5563ac[_0xefe0('0x12')][_0xf4e6c4]){if(_0x16afea[_0x481bc3][_0x1db8b7][_0xefe0('0x58')]){_0x5563ac[_0xefe0('0x12')][_0xf4e6c4][_0xefe0('0x30')]+=0x1;}if(_0x16afea[_0x481bc3][_0x1db8b7]['queuecallerabandon']){_0x5563ac[_0xefe0('0x12')][_0xf4e6c4][_0xefe0('0x31')]+=0x1;}_0x5563ac['voiceQueues'][_0xf4e6c4]['sumHoldTime']+=moment(_0x16afea[_0x481bc3][_0x1db8b7]['queuecallerleaveAt'])[_0xefe0('0x59')](moment(_0x16afea[_0x481bc3][_0x1db8b7]['queuecallerjoinAt']),_0xefe0('0x5a'))||0x0;if(_0x1db8b7===_0x16afea[_0x481bc3][_0xefe0('0x3f')]-0x1){_0x5563ac['voiceQueues'][_0xf4e6c4][_0xefe0('0x2c')]+=moment(_0x16afea[_0x481bc3][_0x1db8b7][_0xefe0('0x5b')]||_0x16afea[_0x481bc3][_0x1db8b7]['queuecallerabandonAt']||_0x16afea[_0x481bc3][_0x1db8b7]['queuecallerexitAt'])[_0xefe0('0x59')](moment(_0x16afea[_0x481bc3][_0x1db8b7][_0xefe0('0x5c')]),_0xefe0('0x5a'))||0x0;_0x5563ac[_0xefe0('0x12')][_0xf4e6c4]['total']+=0x1;if(_0x16afea[_0x481bc3][_0x1db8b7][_0xefe0('0x5d')]){_0x5563ac[_0xefe0('0x12')][_0xf4e6c4][_0xefe0('0x2a')]+=0x1;_0x5563ac['voiceQueues'][_0xf4e6c4][_0xefe0('0x2d')]+=moment(_0x16afea[_0x481bc3][_0x1db8b7][_0xefe0('0x5b')])[_0xefe0('0x59')](moment(_0x16afea[_0x481bc3][_0x1db8b7][_0xefe0('0x5e')]),'seconds')||0x0;}}else{_0x5563ac[_0xefe0('0x12')][_0xf4e6c4][_0xefe0('0x2c')]+=_0x5563ac[_0xefe0('0x12')][_0xf4e6c4][_0xefe0('0x2b')]||0x0;}}}}}}return _0x5563ac[_0xefe0('0x12')];};};Realtime['prototype'][_0xefe0('0x5f')]=function(){var _0x50bfc8=this;return function(_0xc34cda){clearVoiceCallReports(_0x50bfc8[_0xefe0('0x16')]);if(_0xc34cda){for(var _0x3b7032=0x0;_0x3b7032<_0xc34cda[_0xefe0('0x3f')];_0x3b7032+=0x1){_0x50bfc8[_0xefe0('0x16')][_0xefe0('0x29')]+=0x1;_0x50bfc8[_0xefe0('0x16')][_0xefe0('0x2c')]+=_0xc34cda[_0x3b7032][_0xefe0('0x60')];if(_0xc34cda[_0x3b7032]['disposition']===_0xefe0('0x61')){_0x50bfc8[_0xefe0('0x16')][_0xefe0('0x2a')]+=0x1;_0x50bfc8[_0xefe0('0x16')][_0xefe0('0x2b')]+=_0xc34cda[_0x3b7032][_0xefe0('0x60')]-_0xc34cda[_0x3b7032][_0xefe0('0x62')]||0x0;_0x50bfc8[_0xefe0('0x16')]['sumBillable']+=_0xc34cda[_0x3b7032]['billableseconds'];}}}return _0x50bfc8[_0xefe0('0x16')];};};Realtime[_0xefe0('0x3c')][_0xefe0('0x63')]=function(){var _0x25a573=this;return function(_0x23ff12){if(_0x23ff12){freeIsNotKey(_0x23ff12,_0x25a573[_0xefe0('0x14')],_0xefe0('0x25'));for(var _0x44b74e=0x0,_0x3850c8={};_0x44b74e<_0x23ff12[_0xefe0('0x3f')];_0x44b74e+=0x1){_0x3850c8=_0x23ff12[_0x44b74e];if(_[_0xefe0('0x41')](_0x25a573['campaigns'][_0x3850c8[_0xefe0('0x25')]])){_0x25a573[_0xefe0('0x14')][_0x3850c8['name']]=new Campaign(_0x3850c8);}else{_0x25a573[_0xefe0('0x3d')](_0x25a573[_0xefe0('0x14')][_0x3850c8[_0xefe0('0x25')]],_0x3850c8);_0x25a573[_0xefe0('0x14')][_0x3850c8['name']][_0xefe0('0x64')]=_0x3850c8[_0xefe0('0x65')]?_0x3850c8[_0xefe0('0x65')][_0xefe0('0x25')]:undefined;}}}return _0x25a573[_0xefe0('0x14')];};};Realtime['prototype']['initVoiceExtensions']=function(){var _0x4faae4=this;return function(_0x38b792){if(_0x38b792){freeIsNotKey(_0x38b792,_0x4faae4['voiceExtensions'],'id');for(var _0x50531a=0x0,_0x2014c5={};_0x50531a<_0x38b792[_0xefe0('0x3f')];_0x50531a+=0x1){_0x2014c5=_0x38b792[_0x50531a];if(_['isUndefined'](_0x4faae4[_0xefe0('0x17')][_0x2014c5['id']])){_0x4faae4[_0xefe0('0x17')][_0x2014c5['id']]=new VoiceExtension(_0x2014c5);}else{_0x4faae4[_0xefe0('0x3d')](_0x4faae4['voiceExtensions'][_0x2014c5['id']],_0x2014c5);}}}return _0x4faae4['voiceExtensions'];};};Realtime['prototype'][_0xefe0('0x66')]=function(){var _0x20d0f6=this;return function(_0x497be8){clearCampaigns(_0x20d0f6[_0xefe0('0x14')]);for(var _0x2e1162=0x0;_0x2e1162<_0x497be8[_0xefe0('0x3f')];_0x2e1162+=0x1){_[_0xefe0('0x55')](_0x20d0f6[_0xefe0('0x14')][_0x497be8[_0x2e1162][_0xefe0('0x25')]],_0x497be8[_0x2e1162]);}return _0x20d0f6[_0xefe0('0x14')];};};Realtime[_0xefe0('0x3c')]['initFaxAccounts']=function(){var _0x1d87f9=this;return function(_0x385c6d){if(_0x385c6d){freeIsNotKey(_0x385c6d,_0x1d87f9[_0xefe0('0x22')],'id');for(var _0x55a4db=0x0,_0x568e46={},_0x32057a={};_0x55a4db<_0x385c6d[_0xefe0('0x3f')];_0x55a4db+=0x1){_0x568e46=_0x385c6d[_0x55a4db];if(_[_0xefe0('0x41')](_0x1d87f9[_0xefe0('0x22')][_0x568e46['id']])){_0x1d87f9[_0xefe0('0x22')][_0x568e46['id']]=new FaxAccount(_0x568e46);}else{_0x1d87f9[_0xefe0('0x3d')](_0x1d87f9[_0xefe0('0x22')][_0x568e46['id']],_0x568e46);}}}return _0x1d87f9['faxAccounts'];};};module['exports']=Realtime; \ No newline at end of file +var _0xd117=['../model/voiceExtension','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','voiceExtensions','channels','queueChannels','outboundChannels','timers','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','mapKeys','format','SIP/%s','name','hasOwnProperty','isNil','interface','total','sumBillable','ivrTotalCallsDays','ivrAnswerCallsDay','isEmpty','unmanaged','abandoned','sumHoldTime','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','mergeFromDatabase','prototype','initAgents','isUndefined','initTelephones','initTrunks','length','initVoiceQueues','initTriggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initZohoAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','merge','queue','queuecallerabandon','queuecallerleaveAt','queuecallercompleteAt','diff','seconds','queuecallercomplete','answered','outbound','duration','disposition','ANSWERED','billableseconds','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','faxAccounts','exports','util','lodash','moment','../model/telephone','../model/trunk','../model/voiceQueue','../model/template','../model/campaign'];(function(_0xe59cff,_0x1a7dbe){var _0x26e8c1=function(_0x6a95cc){while(--_0x6a95cc){_0xe59cff['push'](_0xe59cff['shift']());}};_0x26e8c1(++_0x1a7dbe);}(_0xd117,0x198));var _0x7d11=function(_0x6eb02d,_0x20bdf5){_0x6eb02d=_0x6eb02d-0x0;var _0xb756de=_0xd117[_0x6eb02d];return _0xb756de;};'use strict';var BPromise=require('bluebird');var util=require(_0x7d11('0x0'));var _=require(_0x7d11('0x1'));var moment=require(_0x7d11('0x2'));var Agent=require('../model/agent');var Telephone=require(_0x7d11('0x3'));var Trunk=require(_0x7d11('0x4'));var VoiceQueue=require(_0x7d11('0x5'));var Trigger=require('../model/trigger');var Template=require(_0x7d11('0x6'));var Campaign=require(_0x7d11('0x7'));var VoiceExtension=require(_0x7d11('0x8'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0x7d11('0x9'));var FreshdeskAccount=require(_0x7d11('0xa'));var SugarcrmAccount=require(_0x7d11('0xb'));var ZohoAccount=require(_0x7d11('0xc'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0x7d11('0xd'));var ServicenowAccount=require(_0x7d11('0xe'));var Dynamics365Account=require(_0x7d11('0xf'));var FreshsalesAccount=require(_0x7d11('0x10'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0x7d11('0x11')]={};this[_0x7d11('0x12')]={};this[_0x7d11('0x13')]={};this[_0x7d11('0x14')]={};this[_0x7d11('0x15')]={};this[_0x7d11('0x16')]={};this[_0x7d11('0x17')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x7d11('0x18')]={};this[_0x7d11('0x19')]={};this[_0x7d11('0x1a')]={};this[_0x7d11('0x1b')]={};this[_0x7d11('0x1c')]={};this['settings']={};this[_0x7d11('0x1d')]={};this[_0x7d11('0x1e')]={};this[_0x7d11('0x1f')]={};this[_0x7d11('0x20')]={};this[_0x7d11('0x21')]={};this[_0x7d11('0x22')]={};this['vtigerAccounts']={};this[_0x7d11('0x23')]={};this[_0x7d11('0x24')]={};this[_0x7d11('0x25')]={};this['faxAccounts']={};};function freeIsNotKey(_0x1a6442,_0x262197,_0x175d8e){var _0x3a7bc4=_['mapKeys'](_0x1a6442,function(_0x505402,_0x524637){return _0x505402[_0x175d8e];});for(var _0x48a11a in _0x262197){if(_0x262197['hasOwnProperty'](_0x48a11a)){if(!_0x3a7bc4[_0x48a11a]){delete _0x262197[_0x48a11a];}}}}function freeIsNotKeySip(_0x3d5578,_0x545844){var _0x147efb=_[_0x7d11('0x26')](_0x3d5578,function(_0x241378,_0x396a70){return util[_0x7d11('0x27')](_0x7d11('0x28'),_0x241378[_0x7d11('0x29')]);});for(var _0x4cce92 in _0x545844){if(_0x545844[_0x7d11('0x2a')](_0x4cce92)){if(!_0x147efb[_0x4cce92]){delete _0x545844[_0x4cce92];}}}}function freeIsNotKeyAgent(_0x5f5c2c,_0x29f1e4){var _0x532fa0=_[_0x7d11('0x26')](_0x5f5c2c,function(_0x49fcf2,_0xcd2b32){var _0x50acfc=_[_0x7d11('0x2b')](_0x49fcf2[_0x7d11('0x2c')])?util[_0x7d11('0x27')](_0x7d11('0x28'),_0x49fcf2[_0x7d11('0x29')]):_0x49fcf2[_0x7d11('0x2c')];return _0x50acfc;});for(var _0x466b9a in _0x29f1e4){if(_0x29f1e4[_0x7d11('0x2a')](_0x466b9a)){if(!_0x532fa0[_0x466b9a]){delete _0x29f1e4[_0x466b9a];}}}}function clearVoiceCallReports(_0x325e2a){_0x325e2a[_0x7d11('0x2d')]=0x0;_0x325e2a['answered']=0x0;_0x325e2a['sumHoldTime']=0x0;_0x325e2a['sumDuration']=0x0;_0x325e2a[_0x7d11('0x2e')]=0x0;}function clearCampaigns(_0x41394e){if(!_['isEmpty'](_0x41394e)){for(var _0x3d2a59 in _0x41394e){if(_0x41394e[_0x7d11('0x2a')](_0x3d2a59)){_0x41394e[_0x3d2a59][_0x7d11('0x2f')]=0x0;_0x41394e[_0x3d2a59][_0x7d11('0x30')]=0x0;}}}}function clearVoiceQueues(_0x457273){if(!_[_0x7d11('0x31')](_0x457273)){for(var _0x2f0034 in _0x457273){if(_0x457273[_0x7d11('0x2a')](_0x2f0034)){_0x457273[_0x2f0034][_0x7d11('0x2d')]=0x0;_0x457273[_0x2f0034]['answered']=0x0;_0x457273[_0x2f0034][_0x7d11('0x32')]=0x0;_0x457273[_0x2f0034][_0x7d11('0x33')]=0x0;_0x457273[_0x2f0034][_0x7d11('0x34')]=0x0;_0x457273[_0x2f0034][_0x7d11('0x35')]=0x0;_0x457273[_0x2f0034]['sumBillable']=0x0;_0x457273[_0x2f0034][_0x7d11('0x36')]=0x0;_0x457273[_0x2f0034][_0x7d11('0x37')]=0x0;_0x457273[_0x2f0034][_0x7d11('0x38')]=0x0;_0x457273[_0x2f0034][_0x7d11('0x39')]=0x0;_0x457273[_0x2f0034][_0x7d11('0x3a')]=0x0;_0x457273[_0x2f0034]['outboundUnknownCallsDay']=0x0;_0x457273[_0x2f0034][_0x7d11('0x3b')]=0x0;_0x457273[_0x2f0034][_0x7d11('0x3c')]=0x0;_0x457273[_0x2f0034][_0x7d11('0x3d')]=0x0;_0x457273[_0x2f0034][_0x7d11('0x3e')]=0x0;_0x457273[_0x2f0034][_0x7d11('0x3f')]=0x0;_0x457273[_0x2f0034][_0x7d11('0x40')]=0x0;_0x457273[_0x2f0034][_0x7d11('0x36')]=0x0;_0x457273[_0x2f0034][_0x7d11('0x41')]=0x0;_0x457273[_0x2f0034]['queueStatusComplete']=!![];}}}}Realtime['prototype'][_0x7d11('0x42')]=function(_0x3a9bad,_0x1a8db2){for(var _0xc5ff94 in _0x1a8db2){if(_0x3a9bad['hasOwnProperty'](_0xc5ff94)){_0x3a9bad[_0xc5ff94]=_0x1a8db2[_0xc5ff94];}}};Realtime[_0x7d11('0x43')][_0x7d11('0x44')]=function(){var _0xfc68e7=this;return function(_0x3acc2e){if(_0x3acc2e){freeIsNotKeyAgent(_0x3acc2e,_0xfc68e7[_0x7d11('0x11')]);for(var _0x3e93c=0x0,_0x434d16={},_0x4537a7={};_0x3e93c<_0x3acc2e['length'];_0x3e93c+=0x1){_0x434d16=_0x3acc2e[_0x3e93c];var _0x2513b1=_[_0x7d11('0x2b')](_0x434d16[_0x7d11('0x2c')])?util['format'](_0x7d11('0x28'),_0x434d16[_0x7d11('0x29')]):_0x434d16[_0x7d11('0x2c')];if(_[_0x7d11('0x45')](_0xfc68e7[_0x7d11('0x11')][_0x2513b1])){_0xfc68e7[_0x7d11('0x11')][_0x2513b1]=new Agent(_0x434d16);}else{_0xfc68e7[_0x7d11('0x42')](_0xfc68e7[_0x7d11('0x11')][_0x2513b1],_0x434d16);}}}return _0xfc68e7[_0x7d11('0x11')];};};Realtime[_0x7d11('0x43')][_0x7d11('0x46')]=function(){var _0x59d22f=this;return function(_0x1c7c03){if(_0x1c7c03){freeIsNotKeySip(_0x1c7c03,_0x59d22f[_0x7d11('0x12')]);for(var _0x58b01e=0x0,_0xa57bd1={},_0x1fd682={};_0x58b01e<_0x1c7c03['length'];_0x58b01e+=0x1){_0xa57bd1=_0x1c7c03[_0x58b01e];if(_[_0x7d11('0x45')](_0x59d22f[_0x7d11('0x12')][util['format'](_0x7d11('0x28'),_0xa57bd1[_0x7d11('0x29')])])){_0x59d22f['telephones'][util['format'](_0x7d11('0x28'),_0xa57bd1['name'])]=new Telephone(_0xa57bd1);}else{_0x59d22f[_0x7d11('0x42')](_0x59d22f[_0x7d11('0x12')][util[_0x7d11('0x27')]('SIP/%s',_0xa57bd1[_0x7d11('0x29')])],_0xa57bd1);}}}return _0x59d22f['telephones'];};};Realtime[_0x7d11('0x43')][_0x7d11('0x47')]=function(){var _0x5cd359=this;return function(_0x808782){if(_0x808782){freeIsNotKeySip(_0x808782,_0x5cd359['trunks']);for(var _0x292b89=0x0,_0x2d12b5={},_0x2454a0={};_0x292b89<_0x808782[_0x7d11('0x48')];_0x292b89+=0x1){_0x2d12b5=_0x808782[_0x292b89];if(_[_0x7d11('0x45')](_0x5cd359[_0x7d11('0x13')][util[_0x7d11('0x27')](_0x7d11('0x28'),_0x2d12b5[_0x7d11('0x29')])])){_0x5cd359[_0x7d11('0x13')][util[_0x7d11('0x27')](_0x7d11('0x28'),_0x2d12b5[_0x7d11('0x29')])]=new Trunk(_0x2d12b5);}else{_0x5cd359[_0x7d11('0x42')](_0x5cd359[_0x7d11('0x13')][util[_0x7d11('0x27')](_0x7d11('0x28'),_0x2d12b5[_0x7d11('0x29')])],_0x2d12b5);}}}return _0x5cd359[_0x7d11('0x13')];};};Realtime[_0x7d11('0x43')][_0x7d11('0x49')]=function(){var _0x2062e2=this;return function(_0x4a8b4d){if(_0x4a8b4d){freeIsNotKey(_0x4a8b4d,_0x2062e2[_0x7d11('0x14')],_0x7d11('0x29'));for(var _0x1c1d77=0x0,_0x10e5aa={},_0x36e6c1={};_0x1c1d77<_0x4a8b4d[_0x7d11('0x48')];_0x1c1d77+=0x1){_0x10e5aa=_0x4a8b4d[_0x1c1d77];if(_['isUndefined'](_0x2062e2[_0x7d11('0x14')][_0x10e5aa[_0x7d11('0x29')]])){_0x2062e2[_0x7d11('0x14')][_0x10e5aa[_0x7d11('0x29')]]=new VoiceQueue(_0x10e5aa);}else{_0x2062e2[_0x7d11('0x42')](_0x2062e2[_0x7d11('0x14')][_0x10e5aa[_0x7d11('0x29')]],_0x10e5aa);}}}return _0x2062e2[_0x7d11('0x14')];};};Realtime[_0x7d11('0x43')][_0x7d11('0x4a')]=function(){var _0x52656a=this;return function(_0x10b1e6){if(_0x10b1e6){freeIsNotKey(_0x10b1e6,_0x52656a[_0x7d11('0x15')],'id');for(var _0x18bcfb=0x0,_0x48a415={},_0x72e3c4={};_0x18bcfb<_0x10b1e6[_0x7d11('0x48')];_0x18bcfb+=0x1){_0x48a415=_0x10b1e6[_0x18bcfb];if(_['isUndefined'](_0x52656a['triggers'][_0x48a415['id']])){_0x52656a[_0x7d11('0x15')][_0x48a415['id']]=new Trigger(_0x48a415);}else{_0x52656a['mergeFromDatabase'](_0x52656a[_0x7d11('0x15')][_0x48a415['id']],_0x48a415);}}}return _0x52656a[_0x7d11('0x15')];};};Realtime['prototype'][_0x7d11('0x4b')]=function(){var _0x4799d3=this;return function(_0x5044d4){if(_0x5044d4){freeIsNotKey(_0x5044d4,_0x4799d3[_0x7d11('0x17')],'id');for(var _0x9f2365=0x0,_0x1750af={},_0x12c9b9={};_0x9f2365<_0x5044d4['length'];_0x9f2365+=0x1){_0x1750af=_0x5044d4[_0x9f2365];if(_[_0x7d11('0x45')](_0x4799d3[_0x7d11('0x17')][_0x1750af['id']])){_0x4799d3['templates'][_0x1750af['id']]=new Template(_0x1750af);}else{_0x4799d3[_0x7d11('0x42')](_0x4799d3[_0x7d11('0x17')][_0x1750af['id']],_0x1750af);}}}return _0x4799d3[_0x7d11('0x17')];};};Realtime[_0x7d11('0x43')][_0x7d11('0x4c')]=function(){var _0x1f8d7e=this;return function(_0x3cd7f6){if(_0x3cd7f6){freeIsNotKey(_0x3cd7f6,_0x1f8d7e['zendeskAccounts'],'id');for(var _0x431801=0x0,_0x3efb95={},_0xcd2239={};_0x431801<_0x3cd7f6['length'];_0x431801+=0x1){_0x3efb95=_0x3cd7f6[_0x431801];if(_[_0x7d11('0x45')](_0x1f8d7e[_0x7d11('0x1d')][_0x3efb95['id']])){_0x1f8d7e[_0x7d11('0x1d')][_0x3efb95['id']]=new ZendeskAccount(_0x3efb95);}else{_0x1f8d7e[_0x7d11('0x42')](_0x1f8d7e[_0x7d11('0x1d')][_0x3efb95['id']],_0x3efb95);}}}return _0x1f8d7e[_0x7d11('0x1d')];};};Realtime[_0x7d11('0x43')][_0x7d11('0x4d')]=function(){var _0x145599=this;return function(_0x28388c){if(_0x28388c){freeIsNotKey(_0x28388c,_0x145599['salesforceAccounts'],'id');for(var _0x9b80a4=0x0,_0x38115e={},_0x213633={};_0x9b80a4<_0x28388c[_0x7d11('0x48')];_0x9b80a4+=0x1){_0x38115e=_0x28388c[_0x9b80a4];if(_[_0x7d11('0x45')](_0x145599[_0x7d11('0x1e')][_0x38115e['id']])){_0x145599[_0x7d11('0x1e')][_0x38115e['id']]=new SalesforceAccount(_0x38115e);}else{_0x145599[_0x7d11('0x42')](_0x145599['salesforceAccounts'][_0x38115e['id']],_0x38115e);}}}return _0x145599[_0x7d11('0x1e')];};};Realtime['prototype']['initFreshdeskAccounts']=function(){var _0x24a240=this;return function(_0x3a2af0){if(_0x3a2af0){freeIsNotKey(_0x3a2af0,_0x24a240[_0x7d11('0x20')],'id');for(var _0x5eabc8=0x0,_0x4a261a={},_0x120fda={};_0x5eabc8<_0x3a2af0[_0x7d11('0x48')];_0x5eabc8+=0x1){_0x4a261a=_0x3a2af0[_0x5eabc8];if(_[_0x7d11('0x45')](_0x24a240['freshdeskAccounts'][_0x4a261a['id']])){_0x24a240[_0x7d11('0x20')][_0x4a261a['id']]=new FreshdeskAccount(_0x4a261a);}else{_0x24a240[_0x7d11('0x42')](_0x24a240[_0x7d11('0x20')][_0x4a261a['id']],_0x4a261a);}}}return _0x24a240['freshdeskAccounts'];};};Realtime['prototype'][_0x7d11('0x4e')]=function(){var _0x37a2b3=this;return function(_0x21443f){if(_0x21443f){freeIsNotKey(_0x21443f,_0x37a2b3[_0x7d11('0x21')],'id');for(var _0x62af84=0x0,_0x105285={},_0x5769d4={};_0x62af84<_0x21443f['length'];_0x62af84+=0x1){_0x105285=_0x21443f[_0x62af84];if(_[_0x7d11('0x45')](_0x37a2b3[_0x7d11('0x21')][_0x105285['id']])){_0x37a2b3[_0x7d11('0x21')][_0x105285['id']]=new ZohoAccount(_0x105285);}else{_0x37a2b3['mergeFromDatabase'](_0x37a2b3['zohoAccounts'][_0x105285['id']],_0x105285);}}}return _0x37a2b3[_0x7d11('0x21')];};};Realtime[_0x7d11('0x43')]['initDeskAccounts']=function(){var _0x31b01a=this;return function(_0x51cd51){if(_0x51cd51){freeIsNotKey(_0x51cd51,_0x31b01a[_0x7d11('0x22')],'id');for(var _0x3f83b4=0x0,_0x418942={},_0x40f433={};_0x3f83b4<_0x51cd51[_0x7d11('0x48')];_0x3f83b4+=0x1){_0x418942=_0x51cd51[_0x3f83b4];if(_[_0x7d11('0x45')](_0x31b01a[_0x7d11('0x22')][_0x418942['id']])){_0x31b01a[_0x7d11('0x22')][_0x418942['id']]=new DeskAccount(_0x418942);}else{_0x31b01a[_0x7d11('0x42')](_0x31b01a[_0x7d11('0x22')][_0x418942['id']],_0x418942);}}}return _0x31b01a[_0x7d11('0x22')];};};Realtime[_0x7d11('0x43')]['initSugarcrmAccounts']=function(){var _0x4da266=this;return function(_0xb23659){if(_0xb23659){freeIsNotKey(_0xb23659,_0x4da266[_0x7d11('0x1f')],'id');for(var _0x1c345f=0x0,_0xdd432c={},_0xeb7ca3={};_0x1c345f<_0xb23659[_0x7d11('0x48')];_0x1c345f+=0x1){_0xdd432c=_0xb23659[_0x1c345f];if(_[_0x7d11('0x45')](_0x4da266[_0x7d11('0x1f')][_0xdd432c['id']])){_0x4da266[_0x7d11('0x1f')][_0xdd432c['id']]=new SugarcrmAccount(_0xdd432c);}else{_0x4da266[_0x7d11('0x42')](_0x4da266[_0x7d11('0x1f')][_0xdd432c['id']],_0xdd432c);}}}return _0x4da266[_0x7d11('0x1f')];};};Realtime[_0x7d11('0x43')][_0x7d11('0x4f')]=function(){var _0x3795d7=this;return function(_0x4ae5a9){if(_0x4ae5a9){freeIsNotKey(_0x4ae5a9,_0x3795d7[_0x7d11('0x50')],'id');for(var _0x22227a=0x0,_0x1629d1={},_0x5bd469={};_0x22227a<_0x4ae5a9[_0x7d11('0x48')];_0x22227a+=0x1){_0x1629d1=_0x4ae5a9[_0x22227a];if(_[_0x7d11('0x45')](_0x3795d7[_0x7d11('0x50')][_0x1629d1['id']])){_0x3795d7[_0x7d11('0x50')][_0x1629d1['id']]=new VtigerAccount(_0x1629d1);}else{_0x3795d7[_0x7d11('0x42')](_0x3795d7[_0x7d11('0x50')][_0x1629d1['id']],_0x1629d1);}}}return _0x3795d7[_0x7d11('0x50')];};};Realtime[_0x7d11('0x43')][_0x7d11('0x51')]=function(){var _0x1d8ccd=this;return function(_0x20f68a){if(_0x20f68a){freeIsNotKey(_0x20f68a,_0x1d8ccd[_0x7d11('0x23')],'id');for(var _0x2dd448=0x0,_0x2ed0f5={},_0x129fea={};_0x2dd448<_0x20f68a[_0x7d11('0x48')];_0x2dd448+=0x1){_0x2ed0f5=_0x20f68a[_0x2dd448];if(_[_0x7d11('0x45')](_0x1d8ccd['servicenowAccounts'][_0x2ed0f5['id']])){_0x1d8ccd[_0x7d11('0x23')][_0x2ed0f5['id']]=new ServicenowAccount(_0x2ed0f5);}else{_0x1d8ccd[_0x7d11('0x42')](_0x1d8ccd['servicenowAccounts'][_0x2ed0f5['id']],_0x2ed0f5);}}}return _0x1d8ccd[_0x7d11('0x23')];};};Realtime[_0x7d11('0x43')][_0x7d11('0x52')]=function(){var _0xe3e5f2=this;return function(_0x16522d){if(_0x16522d){freeIsNotKey(_0x16522d,_0xe3e5f2['dynamics365Accounts'],'id');for(var _0x41553d=0x0,_0x810c15={},_0x378cb5={};_0x41553d<_0x16522d[_0x7d11('0x48')];_0x41553d+=0x1){_0x810c15=_0x16522d[_0x41553d];if(_[_0x7d11('0x45')](_0xe3e5f2[_0x7d11('0x24')][_0x810c15['id']])){_0xe3e5f2[_0x7d11('0x24')][_0x810c15['id']]=new Dynamics365Account(_0x810c15);}else{_0xe3e5f2[_0x7d11('0x42')](_0xe3e5f2[_0x7d11('0x24')][_0x810c15['id']],_0x810c15);}}}return _0xe3e5f2['dynamics365Accounts'];};};Realtime[_0x7d11('0x43')][_0x7d11('0x53')]=function(){var _0x5d3e50=this;return function(_0x57150c){if(_0x57150c){freeIsNotKey(_0x57150c,_0x5d3e50[_0x7d11('0x25')],'id');for(var _0x548190=0x0,_0x33a988={},_0x11fcea={};_0x548190<_0x57150c[_0x7d11('0x48')];_0x548190+=0x1){_0x33a988=_0x57150c[_0x548190];if(_[_0x7d11('0x45')](_0x5d3e50['freshsalesAccounts'][_0x33a988['id']])){_0x5d3e50[_0x7d11('0x25')][_0x33a988['id']]=new FreshsalesAccount(_0x33a988);}else{_0x5d3e50[_0x7d11('0x42')](_0x5d3e50[_0x7d11('0x25')][_0x33a988['id']],_0x33a988);}}}return _0x5d3e50['freshsalesAccounts'];};};Realtime[_0x7d11('0x43')]['initVoiceQueueHopperHistory']=function(){var _0x46054a=this;return function(_0x471a28){for(var _0x1d27ba=0x0;_0x1d27ba<_0x471a28[_0x7d11('0x48')];_0x1d27ba+=0x1){_[_0x7d11('0x54')](_0x46054a['voiceQueues'][_0x471a28[_0x1d27ba][_0x7d11('0x29')]],_0x471a28[_0x1d27ba]);}return _0x46054a['voiceQueues'];};};Realtime['prototype']['initVoiceQueueReports']=function(){var _0xb9563e=this;return function(_0x3d839c){clearVoiceQueues(_0xb9563e['voiceQueues']);if(_0x3d839c){_0x3d839c=_['groupBy'](_0x3d839c,'uniqueid');for(var _0x482cf0 in _0x3d839c){if(_0x3d839c[_0x7d11('0x2a')](_0x482cf0)){var _0x2fc19e={};for(var _0x1504dc=0x0;_0x1504dc<_0x3d839c[_0x482cf0][_0x7d11('0x48')];_0x1504dc+=0x1){var _0xeec7af=_0x3d839c[_0x482cf0][_0x1504dc][_0x7d11('0x55')];if(_0xb9563e[_0x7d11('0x14')][_0xeec7af]){if(_0x3d839c[_0x482cf0][_0x1504dc]['queuecallerexit']){_0xb9563e[_0x7d11('0x14')][_0xeec7af][_0x7d11('0x32')]+=0x1;}if(_0x3d839c[_0x482cf0][_0x1504dc][_0x7d11('0x56')]){_0xb9563e['voiceQueues'][_0xeec7af][_0x7d11('0x33')]+=0x1;}_0xb9563e['voiceQueues'][_0xeec7af][_0x7d11('0x34')]+=moment(_0x3d839c[_0x482cf0][_0x1504dc][_0x7d11('0x57')])['diff'](moment(_0x3d839c[_0x482cf0][_0x1504dc]['queuecallerjoinAt']),'seconds')||0x0;if(_0x1504dc===_0x3d839c[_0x482cf0][_0x7d11('0x48')]-0x1){_0xb9563e[_0x7d11('0x14')][_0xeec7af][_0x7d11('0x35')]+=moment(_0x3d839c[_0x482cf0][_0x1504dc][_0x7d11('0x58')]||_0x3d839c[_0x482cf0][_0x1504dc]['queuecallerabandonAt']||_0x3d839c[_0x482cf0][_0x1504dc]['queuecallerexitAt'])[_0x7d11('0x59')](moment(_0x3d839c[_0x482cf0][_0x1504dc]['queuecallerjoinAt']),_0x7d11('0x5a'))||0x0;_0xb9563e['voiceQueues'][_0xeec7af]['total']+=0x1;if(_0x3d839c[_0x482cf0][_0x1504dc][_0x7d11('0x5b')]){_0xb9563e['voiceQueues'][_0xeec7af][_0x7d11('0x5c')]+=0x1;_0xb9563e['voiceQueues'][_0xeec7af][_0x7d11('0x2e')]+=moment(_0x3d839c[_0x482cf0][_0x1504dc][_0x7d11('0x58')])[_0x7d11('0x59')](moment(_0x3d839c[_0x482cf0][_0x1504dc][_0x7d11('0x57')]),_0x7d11('0x5a'))||0x0;}}else{_0xb9563e[_0x7d11('0x14')][_0xeec7af]['sumDuration']+=_0xb9563e[_0x7d11('0x14')][_0xeec7af]['sumHoldTime']||0x0;}}}}}}return _0xb9563e[_0x7d11('0x14')];};};Realtime[_0x7d11('0x43')]['initVoiceCallReports']=function(){var _0x34d647=this;return function(_0x8fd90b){clearVoiceCallReports(_0x34d647['outbound']);if(_0x8fd90b){for(var _0x52b4af=0x0;_0x52b4af<_0x8fd90b[_0x7d11('0x48')];_0x52b4af+=0x1){_0x34d647[_0x7d11('0x5d')][_0x7d11('0x2d')]+=0x1;_0x34d647[_0x7d11('0x5d')]['sumDuration']+=_0x8fd90b[_0x52b4af][_0x7d11('0x5e')];if(_0x8fd90b[_0x52b4af][_0x7d11('0x5f')]===_0x7d11('0x60')){_0x34d647['outbound'][_0x7d11('0x5c')]+=0x1;_0x34d647['outbound'][_0x7d11('0x34')]+=_0x8fd90b[_0x52b4af]['duration']-_0x8fd90b[_0x52b4af][_0x7d11('0x61')]||0x0;_0x34d647['outbound'][_0x7d11('0x2e')]+=_0x8fd90b[_0x52b4af][_0x7d11('0x61')];}}}return _0x34d647[_0x7d11('0x5d')];};};Realtime[_0x7d11('0x43')]['initCampaigns']=function(){var _0xe472d2=this;return function(_0x3744cc){if(_0x3744cc){freeIsNotKey(_0x3744cc,_0xe472d2[_0x7d11('0x16')],'name');for(var _0x4a8b06=0x0,_0x46892c={};_0x4a8b06<_0x3744cc[_0x7d11('0x48')];_0x4a8b06+=0x1){_0x46892c=_0x3744cc[_0x4a8b06];if(_[_0x7d11('0x45')](_0xe472d2[_0x7d11('0x16')][_0x46892c[_0x7d11('0x29')]])){_0xe472d2[_0x7d11('0x16')][_0x46892c['name']]=new Campaign(_0x46892c);}else{_0xe472d2['mergeFromDatabase'](_0xe472d2[_0x7d11('0x16')][_0x46892c[_0x7d11('0x29')]],_0x46892c);_0xe472d2[_0x7d11('0x16')][_0x46892c['name']][_0x7d11('0x62')]=_0x46892c[_0x7d11('0x63')]?_0x46892c[_0x7d11('0x63')][_0x7d11('0x29')]:undefined;}}}return _0xe472d2[_0x7d11('0x16')];};};Realtime[_0x7d11('0x43')][_0x7d11('0x64')]=function(){var _0x36a2c9=this;return function(_0xd44298){if(_0xd44298){freeIsNotKey(_0xd44298,_0x36a2c9[_0x7d11('0x18')],'id');for(var _0x25ebcd=0x0,_0x3d4d2c={};_0x25ebcd<_0xd44298['length'];_0x25ebcd+=0x1){_0x3d4d2c=_0xd44298[_0x25ebcd];if(_[_0x7d11('0x45')](_0x36a2c9[_0x7d11('0x18')][_0x3d4d2c['id']])){_0x36a2c9[_0x7d11('0x18')][_0x3d4d2c['id']]=new VoiceExtension(_0x3d4d2c);}else{_0x36a2c9[_0x7d11('0x42')](_0x36a2c9[_0x7d11('0x18')][_0x3d4d2c['id']],_0x3d4d2c);}}}return _0x36a2c9[_0x7d11('0x18')];};};Realtime['prototype'][_0x7d11('0x65')]=function(){var _0x446924=this;return function(_0x46f848){clearCampaigns(_0x446924[_0x7d11('0x16')]);for(var _0x3aed0b=0x0;_0x3aed0b<_0x46f848[_0x7d11('0x48')];_0x3aed0b+=0x1){_[_0x7d11('0x54')](_0x446924['campaigns'][_0x46f848[_0x3aed0b][_0x7d11('0x29')]],_0x46f848[_0x3aed0b]);}return _0x446924[_0x7d11('0x16')];};};Realtime['prototype']['initFaxAccounts']=function(){var _0x22e907=this;return function(_0xb47925){if(_0xb47925){freeIsNotKey(_0xb47925,_0x22e907[_0x7d11('0x66')],'id');for(var _0x28dcff=0x0,_0x3235fe={},_0x3f64cf={};_0x28dcff<_0xb47925[_0x7d11('0x48')];_0x28dcff+=0x1){_0x3235fe=_0xb47925[_0x28dcff];if(_[_0x7d11('0x45')](_0x22e907[_0x7d11('0x66')][_0x3235fe['id']])){_0x22e907[_0x7d11('0x66')][_0x3235fe['id']]=new FaxAccount(_0x3235fe);}else{_0x22e907[_0x7d11('0x42')](_0x22e907[_0x7d11('0x66')][_0x3235fe['id']],_0x3235fe);}}}return _0x22e907[_0x7d11('0x66')];};};module[_0x7d11('0x67')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 8645302..eface49 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 _0x8185=['uniqueid','create','monitor','createdAt','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','startsWith','substring','indexOf','mobile','phone','lastIndexOf','attendedTransfer','exports','moment','util','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceDialReport','./userReport','realtime','telephones','sync','xdr','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','prototype','findAgent','accountcode','name','find','agents','interface','format','connectedlinenum','assigned','lastAssignedTo','isNil','SIP/%s','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','match','destination','exten','type','lastapplication','queue','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridnum','channel','originatecalleridnum','disposition','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid'];(function(_0x353ebb,_0x2c2768){var _0x2f4c08=function(_0x47a4db){while(--_0x47a4db){_0x353ebb['push'](_0x353ebb['shift']());}};_0x2f4c08(++_0x2c2768);}(_0x8185,0x15d));var _0x5818=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x8185[_0x4ff09b];return _0x3f5c2e;};'use strict';var _=require('lodash');var moment=require(_0x5818('0x0'));var util=require(_0x5818('0x1'));var config=require('../../../config/environment');var ami=require(_0x5818('0x2'));var RpcVoiceAgentReport=require(_0x5818('0x3'));var RpcVoiceCallReport=require(_0x5818('0x4'));var RpcVoiceDialReport=require(_0x5818('0x5'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x5818('0x6'));var RpcVoiceRecording=require(_0x5818('0x7'));var RpcVoiceTransferReport=require(_0x5818('0x8'));var VoiceQueueReport=require(_0x5818('0x9'));var VoiceCallReport=require(_0x5818('0xa'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0x5818('0xb'));var UserReport=require(_0x5818('0xc'));function Report(_0x1fed39){this[_0x5818('0xd')]=_0x1fed39;this['agents']=_0x1fed39['agents'];this[_0x5818('0xe')]=_0x1fed39['telephones'];}Report['prototype'][_0x5818('0xf')]=function(_0xfe2b3d){var _0x471122=new VoiceQueueReport(this[_0x5818('0xd')]);var _0x481aa9=new VoiceAgentReport(this[_0x5818('0xd')]);var _0x45991b=new VoiceDialReport(this['realtime']);var _0x500c2d=new VoiceCallReport(this[_0x5818('0xd')]);var _0x5715db=new UserReport(this[_0x5818('0xd')]);if(config[_0x5818('0x10')]&&config[_0x5818('0x10')]['disabled']){ami['on'](_0x5818('0x11'),this[_0x5818('0x12')][_0x5818('0x13')](this));ami['on'](_0x5818('0x14'),this[_0x5818('0x15')][_0x5818('0x13')](this));ami['on']('custom:voiceAgentReport',this[_0x5818('0x16')][_0x5818('0x13')](this));ami['on'](_0x5818('0x17'),this[_0x5818('0x18')][_0x5818('0x13')](this));ami['on'](_0x5818('0x19'),this[_0x5818('0x1a')][_0x5818('0x13')](this));ami['on']('attendedtransfer',this['attendedTransfer']['bind'](this));}};Report[_0x5818('0x1b')][_0x5818('0x1c')]=function(_0x1a98b8){var _0x2b5f62;_0x2b5f62=_['find'](this['agents'],function(_0x24990b){return _0x24990b[_0x5818('0x1d')]==_0x1a98b8||_0x24990b[_0x5818('0x1e')]==_0x1a98b8;});if(_['isNil'](_0x2b5f62)){var _0x2b8aff=_[_0x5818('0x1f')](this['telephones'],function(_0x5a564d){return _0x5a564d[_0x5818('0x1d')]==_0x1a98b8||_0x5a564d[_0x5818('0x1e')]==_0x1a98b8;});if(_0x2b8aff){_0x2b5f62=_[_0x5818('0x1f')](this[_0x5818('0x20')],function(_0x57ac5a){return _0x57ac5a[_0x5818('0x21')]==util[_0x5818('0x22')]('SIP/%s',_0x2b8aff['name']);});}}return _0x2b5f62;};Report[_0x5818('0x1b')][_0x5818('0x12')]=function(_0x34b8fc){for(var _0x568eb5=0x0;_0x568eb5<_0x34b8fc['length'];_0x568eb5+=0x1){var _0x5c3b41=this[_0x5818('0x1c')](_0x34b8fc[_0x568eb5][_0x5818('0x23')]);if(_0x5c3b41){_0x34b8fc[_0x568eb5]['accountcode']=_0x5c3b41[_0x5818('0x1d')];_0x34b8fc[_0x568eb5][_0x5818('0x24')]=!![];_0x34b8fc[_0x568eb5][_0x5818('0x25')]=_0x5c3b41['name'];_0x34b8fc[_0x568eb5][_0x5818('0x21')]=_[_0x5818('0x26')](_0x5c3b41[_0x5818('0x21')])?util['format'](_0x5818('0x27'),_0x5c3b41[_0x5818('0x1e')]):_0x5c3b41[_0x5818('0x21')];if(_0x34b8fc[_0x568eb5][_0x5818('0x28')]){_0x34b8fc[_0x568eb5][_0x5818('0x29')]=moment()['format'](_0x5818('0x2a'));}if(_0x34b8fc[_0x568eb5][_0x5818('0x2b')]){_0x34b8fc[_0x568eb5][_0x5818('0x2c')]=moment()[_0x5818('0x22')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0x5818('0x12')](_0x34b8fc[_0x568eb5]);}RpcVoiceQueueReport['create'](_0x34b8fc[_0x568eb5]);}};function extractCalleridNumber(_0x11acd6){var _0x3187db=_0x11acd6[_0x5818('0x2d')](/<(.*?)>/);return _0x3187db?_0x3187db[0x1]:_0x11acd6;}Report[_0x5818('0x1b')][_0x5818('0x15')]=function(_0x10c61f){_0x10c61f[_0x5818('0x2e')]=_0x10c61f['destination']||_0x10c61f[_0x5818('0x2f')];if(_0x10c61f[_0x5818('0x30')]=='dialer'){_0x10c61f[_0x5818('0x31')]=_0x5818('0x32');_0x10c61f[_0x5818('0x33')]=_0x10c61f['queue'];if(_0x10c61f[_0x5818('0x34')]==_0x5818('0x35')){_0x10c61f['accountcode']='';_0x10c61f[_0x5818('0x2e')]=extractCalleridNumber(_0x10c61f[_0x5818('0x36')]);}else if(_0x10c61f[_0x5818('0x34')]==_0x5818('0x37')){if(_0x10c61f[_0x5818('0x2e')]==_0x5818('0x38')){_0x10c61f[_0x5818('0x2e')]=extractCalleridNumber(_0x10c61f['calleridpreview']);_0x10c61f[_0x5818('0x39')]=_0x10c61f['originatecalleridnum'];_0x10c61f['destinationchannel']=[_0x10c61f[_0x5818('0x3a')],_0x10c61f[_0x5818('0x3a')]=_0x10c61f['destinationchannel']][0x0];_0x10c61f[_0x5818('0x36')]=_0x10c61f['calleridpreview'];}else{_0x10c61f[_0x5818('0x2e')]=_0x10c61f[_0x5818('0x39')];_0x10c61f[_0x5818('0x39')]=_0x10c61f[_0x5818('0x3b')];if(_0x10c61f[_0x5818('0x3c')]=='ANSWERED'){_0x10c61f[_0x5818('0x1d')]=_0x10c61f['connectedlinenum'];}else{_0x10c61f['accountcode']='';}}}}else{_0x10c61f[_0x5818('0x36')]=util[_0x5818('0x22')](_0x5818('0x3d'),_0x10c61f[_0x5818('0x3e')],_0x10c61f[_0x5818('0x39')]);}if(RpcVoiceTransferReport[_0x5818('0x3f')][_0x10c61f['linkedid']]){var _0x2e5a87=RpcVoiceTransferReport[_0x5818('0x3f')][_0x10c61f[_0x5818('0x40')]];_0x2e5a87[_0x5818('0x41')]=_0x10c61f[_0x5818('0x42')];RpcVoiceTransferReport[_0x5818('0x1a')](_0x2e5a87);delete RpcVoiceTransferReport[_0x5818('0x3f')][_0x10c61f[_0x5818('0x40')]];}RpcVoiceCallReport[_0x5818('0x43')](_0x10c61f);if(_0x10c61f[_0x5818('0x44')]){for(var _0x3a2f06=0x0;_0x3a2f06<_0x10c61f['monitors']['length'];_0x3a2f06+=0x1){_0x10c61f['monitorFilename']=_0x10c61f['monitors'][_0x3a2f06]['filename'];_0x10c61f[_0x5818('0x45')]=_0x10c61f['monitors'][_0x3a2f06][_0x5818('0x45')];if(_0x10c61f[_0x5818('0x2f')]=='xcally-motion-preview'){_0x10c61f['calleridnum']=_0x10c61f[_0x5818('0x23')];_0x10c61f['calleridname']=_0x10c61f[_0x5818('0x46')];_0x10c61f[_0x5818('0x23')]=_0x10c61f['accountcode'];_0x10c61f[_0x5818('0x46')]=_0x10c61f[_0x5818('0x47')];_0x10c61f[_0x5818('0x2f')]=_0x10c61f[_0x5818('0x3b')];}else if(_0x10c61f[_0x5818('0x2f')]==_0x5818('0x48')){_0x10c61f['calleridnum']=_0x10c61f[_0x5818('0x2e')];_0x10c61f[_0x5818('0x2f')]=_0x10c61f[_0x5818('0x3b')];}RpcVoiceRecording['create'](_0x10c61f);}}};Report[_0x5818('0x1b')][_0x5818('0x16')]=function(_0x3a8a9e){if(_[_0x5818('0x49')](_0x3a8a9e)){_0x3a8a9e[_0x5818('0x4a')](function(_0x369096){RpcVoiceAgentReport[_0x5818('0x43')](_0x369096);});}else{RpcVoiceAgentReport[_0x5818('0x43')](_0x3a8a9e);}};Report[_0x5818('0x1b')][_0x5818('0x18')]=function(_0x36b4e6){RpcVoiceDialReport[_0x5818('0x43')](_0x36b4e6);var _0x845d2c;var _0x534787;var _0x2a4370=_0x36b4e6[_0x5818('0x3a')];if(_[_0x5818('0x4b')](_0x2a4370,'Local')){_0x534787=_0x2a4370[_0x5818('0x4c')](_0x2a4370[_0x5818('0x4d')]('/')+0x1,_0x2a4370[_0x5818('0x4d')]('@'));_0x845d2c=_[_0x5818('0x1f')](this['agents'],function(_0xc7f614){return _0xc7f614[_0x5818('0x4e')]==_0x534787||_0xc7f614[_0x5818('0x4f')]==_0x534787||_0xc7f614['accountcode']==_0x534787;});}else{_0x534787=_0x2a4370[_0x5818('0x4c')](_0x2a4370[_0x5818('0x4d')]('/')+0x1,_0x2a4370[_0x5818('0x50')]('-'));_0x845d2c=this['findAgent'](_0x534787);}if(_0x845d2c){_0x36b4e6['interface']=_['isNil'](_0x845d2c[_0x5818('0x21')])?util[_0x5818('0x22')](_0x5818('0x27'),_0x845d2c['name']):_0x845d2c[_0x5818('0x21')];_0x36b4e6[_0x5818('0x47')]=_0x845d2c['name'];_0x36b4e6['accountcode']=_0x845d2c[_0x5818('0x1d')];RpcMemberReport[_0x5818('0x18')](_0x36b4e6);}};Report[_0x5818('0x1b')][_0x5818('0x1a')]=function(_0xbaccdd){RpcVoiceTransferReport['transfers'][_0xbaccdd['transfererlinkedid']]=_0xbaccdd;};Report[_0x5818('0x1b')][_0x5818('0x51')]=function(_0x32d289){RpcVoiceTransferReport['attendedTransfer'](_0x32d289);};module[_0x5818('0x52')]=Report; \ No newline at end of file +var _0x86cb=['destination','exten','type','dialer','queue','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','channel','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','blindTransfer','monitor','monitorFilename','monitors','filename','createdAt','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','startsWith','Local','substring','indexOf','mobile','phone','transfererlinkedid','attendedTransfer','exports','moment','util','../../../config/environment','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceTransferReport','./userReport','realtime','agents','telephones','sync','xdr','disabled','voiceQueueReport','bind','custom:voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','prototype','findAgent','name','find','accountcode','interface','length','connectedlinenum','assigned','lastAssignedTo','isNil','format','SIP/%s','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','voiceCallReport'];(function(_0x2e2568,_0x3f4818){var _0x58c455=function(_0x272a58){while(--_0x272a58){_0x2e2568['push'](_0x2e2568['shift']());}};_0x58c455(++_0x3f4818);}(_0x86cb,0x182));var _0xb86c=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x86cb[_0x4a53d];return _0x27410e;};'use strict';var _=require('lodash');var moment=require(_0xb86c('0x0'));var util=require(_0xb86c('0x1'));var config=require(_0xb86c('0x2'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0xb86c('0x3'));var RpcVoiceCallReport=require(_0xb86c('0x4'));var RpcVoiceDialReport=require(_0xb86c('0x5'));var RpcMemberReport=require(_0xb86c('0x6'));var RpcVoiceQueueReport=require(_0xb86c('0x7'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0xb86c('0x8'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0xb86c('0x9'));function Report(_0x9232ff){this[_0xb86c('0xa')]=_0x9232ff;this[_0xb86c('0xb')]=_0x9232ff[_0xb86c('0xb')];this[_0xb86c('0xc')]=_0x9232ff[_0xb86c('0xc')];}Report['prototype'][_0xb86c('0xd')]=function(_0x5f33e0){var _0x27695c=new VoiceQueueReport(this['realtime']);var _0x41412d=new VoiceAgentReport(this['realtime']);var _0x3c734e=new VoiceDialReport(this['realtime']);var _0xbd6bc5=new VoiceCallReport(this[_0xb86c('0xa')]);var _0x1ed260=new UserReport(this[_0xb86c('0xa')]);if(config[_0xb86c('0xe')]&&config['xdr'][_0xb86c('0xf')]){ami['on']('custom:voiceQueueReport',this[_0xb86c('0x10')][_0xb86c('0x11')](this));ami['on'](_0xb86c('0x12'),this['voiceCallReport']['bind'](this));ami['on'](_0xb86c('0x13'),this[_0xb86c('0x14')][_0xb86c('0x11')](this));ami['on'](_0xb86c('0x15'),this[_0xb86c('0x16')]['bind'](this));ami['on'](_0xb86c('0x17'),this['blindTransfer'][_0xb86c('0x11')](this));ami['on']('attendedtransfer',this['attendedTransfer']['bind'](this));}};Report[_0xb86c('0x18')][_0xb86c('0x19')]=function(_0x319bfb){var _0x2fdb0e;_0x2fdb0e=_['find'](this[_0xb86c('0xb')],function(_0x44a64e){return _0x44a64e['accountcode']==_0x319bfb||_0x44a64e[_0xb86c('0x1a')]==_0x319bfb;});if(_['isNil'](_0x2fdb0e)){var _0x526e33=_[_0xb86c('0x1b')](this['telephones'],function(_0x58b20e){return _0x58b20e[_0xb86c('0x1c')]==_0x319bfb||_0x58b20e['name']==_0x319bfb;});if(_0x526e33){_0x2fdb0e=_[_0xb86c('0x1b')](this[_0xb86c('0xb')],function(_0x19bb7b){return _0x19bb7b[_0xb86c('0x1d')]==util['format']('SIP/%s',_0x526e33['name']);});}}return _0x2fdb0e;};Report[_0xb86c('0x18')][_0xb86c('0x10')]=function(_0x1ed308){for(var _0x4c46ba=0x0;_0x4c46ba<_0x1ed308[_0xb86c('0x1e')];_0x4c46ba+=0x1){var _0x27fa85=this[_0xb86c('0x19')](_0x1ed308[_0x4c46ba][_0xb86c('0x1f')]);if(_0x27fa85){_0x1ed308[_0x4c46ba][_0xb86c('0x1c')]=_0x27fa85[_0xb86c('0x1c')];_0x1ed308[_0x4c46ba][_0xb86c('0x20')]=!![];_0x1ed308[_0x4c46ba][_0xb86c('0x21')]=_0x27fa85[_0xb86c('0x1a')];_0x1ed308[_0x4c46ba][_0xb86c('0x1d')]=_[_0xb86c('0x22')](_0x27fa85[_0xb86c('0x1d')])?util[_0xb86c('0x23')](_0xb86c('0x24'),_0x27fa85[_0xb86c('0x1a')]):_0x27fa85['interface'];if(_0x1ed308[_0x4c46ba][_0xb86c('0x25')]){_0x1ed308[_0x4c46ba][_0xb86c('0x26')]=moment()['format'](_0xb86c('0x27'));}if(_0x1ed308[_0x4c46ba][_0xb86c('0x28')]){_0x1ed308[_0x4c46ba][_0xb86c('0x29')]=moment()[_0xb86c('0x23')](_0xb86c('0x27'));}RpcMemberReport[_0xb86c('0x10')](_0x1ed308[_0x4c46ba]);}RpcVoiceQueueReport[_0xb86c('0x2a')](_0x1ed308[_0x4c46ba]);}};function extractCalleridNumber(_0x65b3dd){var _0x5dfd7e=_0x65b3dd['match'](/<(.*?)>/);return _0x5dfd7e?_0x5dfd7e[0x1]:_0x65b3dd;}Report['prototype'][_0xb86c('0x2b')]=function(_0x515677){_0x515677[_0xb86c('0x2c')]=_0x515677[_0xb86c('0x2c')]||_0x515677[_0xb86c('0x2d')];if(_0x515677[_0xb86c('0x2e')]==_0xb86c('0x2f')){_0x515677['lastapplication']=_0xb86c('0x30');_0x515677['lastdata']=_0x515677['queue'];if(_0x515677[_0xb86c('0x31')]==_0xb86c('0x32')){_0x515677[_0xb86c('0x1c')]='';_0x515677[_0xb86c('0x2c')]=extractCalleridNumber(_0x515677[_0xb86c('0x33')]);}else if(_0x515677[_0xb86c('0x31')]==_0xb86c('0x34')){if(_0x515677[_0xb86c('0x2c')]==_0xb86c('0x35')){_0x515677['destination']=extractCalleridNumber(_0x515677[_0xb86c('0x36')]);_0x515677[_0xb86c('0x37')]=_0x515677[_0xb86c('0x38')];_0x515677[_0xb86c('0x39')]=[_0x515677[_0xb86c('0x3a')],_0x515677[_0xb86c('0x3a')]=_0x515677['destinationchannel']][0x0];_0x515677[_0xb86c('0x33')]=_0x515677[_0xb86c('0x36')];}else{_0x515677[_0xb86c('0x2c')]=_0x515677[_0xb86c('0x37')];_0x515677[_0xb86c('0x37')]=_0x515677[_0xb86c('0x38')];if(_0x515677['disposition']==_0xb86c('0x3b')){_0x515677[_0xb86c('0x1c')]=_0x515677[_0xb86c('0x1f')];}else{_0x515677[_0xb86c('0x1c')]='';}}}}else{_0x515677['callerid']=util['format'](_0xb86c('0x3c'),_0x515677[_0xb86c('0x3d')],_0x515677['calleridnum']);}if(RpcVoiceTransferReport[_0xb86c('0x3e')][_0x515677[_0xb86c('0x3f')]]){var _0x4bf3dc=RpcVoiceTransferReport[_0xb86c('0x3e')][_0x515677['linkedid']];_0x4bf3dc[_0xb86c('0x40')]=_0x515677[_0xb86c('0x41')];RpcVoiceTransferReport[_0xb86c('0x42')](_0x4bf3dc);delete RpcVoiceTransferReport[_0xb86c('0x3e')][_0x515677[_0xb86c('0x3f')]];}RpcVoiceCallReport[_0xb86c('0x2a')](_0x515677);if(_0x515677[_0xb86c('0x43')]){for(var _0x447a32=0x0;_0x447a32<_0x515677['monitors'][_0xb86c('0x1e')];_0x447a32+=0x1){_0x515677[_0xb86c('0x44')]=_0x515677[_0xb86c('0x45')][_0x447a32][_0xb86c('0x46')];_0x515677[_0xb86c('0x47')]=_0x515677[_0xb86c('0x45')][_0x447a32][_0xb86c('0x47')];if(_0x515677[_0xb86c('0x2d')]==_0xb86c('0x35')){_0x515677['calleridnum']=_0x515677[_0xb86c('0x1f')];_0x515677[_0xb86c('0x3d')]=_0x515677[_0xb86c('0x48')];_0x515677[_0xb86c('0x1f')]=_0x515677['accountcode'];_0x515677['connectedlinename']=_0x515677[_0xb86c('0x49')];_0x515677[_0xb86c('0x2d')]=_0x515677[_0xb86c('0x38')];}else if(_0x515677[_0xb86c('0x2d')]==_0xb86c('0x4a')){_0x515677[_0xb86c('0x37')]=_0x515677['destination'];_0x515677[_0xb86c('0x2d')]=_0x515677[_0xb86c('0x38')];}RpcVoiceRecording[_0xb86c('0x2a')](_0x515677);}}};Report[_0xb86c('0x18')]['voiceAgentReport']=function(_0x2d6359){if(_[_0xb86c('0x4b')](_0x2d6359)){_0x2d6359[_0xb86c('0x4c')](function(_0x39c273){RpcVoiceAgentReport[_0xb86c('0x2a')](_0x39c273);});}else{RpcVoiceAgentReport['create'](_0x2d6359);}};Report['prototype'][_0xb86c('0x16')]=function(_0x41bb35){RpcVoiceDialReport['create'](_0x41bb35);var _0x566a61;var _0x29023d;var _0x1ae9a4=_0x41bb35[_0xb86c('0x3a')];if(_[_0xb86c('0x4d')](_0x1ae9a4,_0xb86c('0x4e'))){_0x29023d=_0x1ae9a4[_0xb86c('0x4f')](_0x1ae9a4[_0xb86c('0x50')]('/')+0x1,_0x1ae9a4[_0xb86c('0x50')]('@'));_0x566a61=_[_0xb86c('0x1b')](this[_0xb86c('0xb')],function(_0x4f6b7e){return _0x4f6b7e[_0xb86c('0x51')]==_0x29023d||_0x4f6b7e[_0xb86c('0x52')]==_0x29023d||_0x4f6b7e[_0xb86c('0x1c')]==_0x29023d;});}else{_0x29023d=_0x1ae9a4[_0xb86c('0x4f')](_0x1ae9a4[_0xb86c('0x50')]('/')+0x1,_0x1ae9a4['lastIndexOf']('-'));_0x566a61=this[_0xb86c('0x19')](_0x29023d);}if(_0x566a61){_0x41bb35['interface']=_[_0xb86c('0x22')](_0x566a61['interface'])?util[_0xb86c('0x23')](_0xb86c('0x24'),_0x566a61[_0xb86c('0x1a')]):_0x566a61[_0xb86c('0x1d')];_0x41bb35[_0xb86c('0x49')]=_0x566a61[_0xb86c('0x1a')];_0x41bb35[_0xb86c('0x1c')]=_0x566a61['accountcode'];RpcMemberReport[_0xb86c('0x16')](_0x41bb35);}};Report[_0xb86c('0x18')][_0xb86c('0x42')]=function(_0x6b6b95){RpcVoiceTransferReport[_0xb86c('0x3e')][_0x6b6b95[_0xb86c('0x53')]]=_0x6b6b95;};Report[_0xb86c('0x18')][_0xb86c('0x54')]=function(_0x233be0){RpcVoiceTransferReport[_0xb86c('0x54')](_0x233be0);};module[_0xb86c('0x55')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 38e7f21..2f3596a 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 _0x83e5=['accountcode','stateTime','updateStatusRealtime','peerstatus','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','status','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','moment','util','ioredis','bluebird','../../../config/logger','../ami','defaults','redis','localhost','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','syncDeviceState','syncPeerStatus','resolve','actionSipShowRegistry','catch','error','inspect','then','actionDeviceStateList','[userReport][devicestatelist]','actionSipPeerStatus','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','state','debug','[userReport][registry]','find','username','stateRegistry','merge','omit','event','actionid','format','name','trunk:save','device','[userReport][devicestatechange]','local','toLowerCase','toNumber','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','trunk:%s','substring','indexOf','mobile','phone'];(function(_0x57d6b2,_0x5c41aa){var _0x30fc38=function(_0x54ee89){while(--_0x54ee89){_0x57d6b2['push'](_0x57d6b2['shift']());}};_0x30fc38(++_0x5c41aa);}(_0x83e5,0x9b));var _0x583e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x83e5[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x583e('0x0'));var moment=require(_0x583e('0x1'));var util=require(_0x583e('0x2'));var Redis=require(_0x583e('0x3'));var BPromise=require(_0x583e('0x4'));var config=require('../../../config/environment');var logger=require(_0x583e('0x5'))('ami');var ami=require(_0x583e('0x6'));config['redis']=_[_0x583e('0x7')](config[_0x583e('0x8')],{'host':_0x583e('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function UserReport(_0x4c6a1c){this[_0x583e('0xa')]=_0x4c6a1c['trunks'];this[_0x583e('0xb')]=_0x4c6a1c[_0x583e('0xb')];this[_0x583e('0xc')]=_0x4c6a1c[_0x583e('0xc')];ami['on'](_0x583e('0xd'),this[_0x583e('0xe')][_0x583e('0xf')](this));ami['on'](_0x583e('0x10'),this[_0x583e('0xe')][_0x583e('0xf')](this));ami['on'](_0x583e('0x11'),this[_0x583e('0x12')][_0x583e('0xf')](this));ami['on']('peerstatus',this[_0x583e('0x13')]['bind'](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise[_0x583e('0x14')]()['then'](ami[_0x583e('0x15')]())[_0x583e('0x16')](function(_0x951010){logger[_0x583e('0x17')]('[userReport][sipshowregistry]',util[_0x583e('0x18')](_0x951010,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x583e('0x14')]()[_0x583e('0x19')](ami[_0x583e('0x1a')]())[_0x583e('0x16')](function(_0x43c260){logger[_0x583e('0x17')](_0x583e('0x1b'),util[_0x583e('0x18')](_0x43c260,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x583e('0x14')]()['then'](ami[_0x583e('0x1c')]())[_0x583e('0x16')](function(_0x58c78b){logger[_0x583e('0x17')]('[userReport][sippeerstatus]',util[_0x583e('0x18')](_0x58c78b,{'showHidden':![],'depth':null}));});}UserReport[_0x583e('0x1d')]['syncRealtimeShow']=function(){setInterval(function(){BPromise[_0x583e('0x14')]()[_0x583e('0x19')](showSipRegistrations())[_0x583e('0x19')](listDeviceStates())['then'](showPeersStatus());},0x32c8);};UserReport[_0x583e('0x1d')][_0x583e('0x1e')]=function(_0x33b98d){return _0x33b98d!==null&&!_[_0x583e('0x1f')](_0x33b98d);};UserReport['prototype'][_0x583e('0x20')]=function(_0x3d8d38,_0x43ec26,_0x5e28f0){io['to'](_0x3d8d38)[_0x583e('0x20')](_0x43ec26,_0x5e28f0);};UserReport[_0x583e('0x1d')][_0x583e('0xe')]=function(_0x53f332){try{if(this[_0x583e('0x1e')](_0x53f332)){logger[_0x583e('0x21')](_0x583e('0x22'),_0x53f332['username'],_0x53f332[_0x583e('0x23')]);logger[_0x583e('0x24')](_0x583e('0x25'),util[_0x583e('0x18')](_0x53f332,{'showHidden':![],'depth':null}));var _0xb2b4cb=_[_0x583e('0x26')](this[_0x583e('0xa')],{'defaultuser':_0x53f332[_0x583e('0x27')]});if(_0xb2b4cb){_0x53f332[_0x583e('0x28')]=_0x53f332[_0x583e('0x23')];_[_0x583e('0x29')](_0xb2b4cb,_[_0x583e('0x2a')](_0x53f332,[_0x583e('0x2b'),_0x583e('0x2c'),_0x583e('0x27'),_0x583e('0x23')]));logger['debug']('[userReport][registry]\x20sending\x20trunk:save\x20event:',util[_0x583e('0x18')](_0xb2b4cb,{'showHidden':![],'depth':null}));this[_0x583e('0x20')](util[_0x583e('0x2d')]('trunk:%s',_0xb2b4cb[_0x583e('0x2e')]),_0x583e('0x2f'),_0xb2b4cb);}}}catch(_0x4fb1e3){logger[_0x583e('0x17')](_0x583e('0x25'),util[_0x583e('0x18')](_0x4fb1e3,{'showHidden':![],'depth':null}));}};UserReport[_0x583e('0x1d')]['syncDeviceState']=function(_0x440fcf){try{if(this[_0x583e('0x1e')](_0x440fcf)){logger['info']('[userReport][devicestatechange]\x20device:%s\x20state:%s',_0x440fcf[_0x583e('0x30')],_0x440fcf[_0x583e('0x23')]);logger[_0x583e('0x24')](_0x583e('0x31'),util[_0x583e('0x18')](_0x440fcf,{'showHidden':![],'depth':null}));if(this['agents'][_0x440fcf['device']]){if(!this[_0x583e('0xb')][_0x440fcf[_0x583e('0x30')]][_0x583e('0x32')]||_0x440fcf['state'][_0x583e('0x33')]()=='inuse'){this[_0x583e('0xb')][_0x440fcf[_0x583e('0x30')]][_0x583e('0x32')]=![];if(this['agents'][_0x440fcf['device']][_0x583e('0x23')]!==_0x440fcf[_0x583e('0x23')][_0x583e('0x33')]()){this['agents'][_0x440fcf[_0x583e('0x30')]]['stateTime']=_['toNumber'](moment()[_0x583e('0x2d')]('x'));}this[_0x583e('0xb')][_0x440fcf[_0x583e('0x30')]][_0x583e('0x23')]=_0x440fcf[_0x583e('0x23')]['toLowerCase']();this[_0x583e('0xb')][_0x440fcf['device']]['updateStatusRealtime'](_0x440fcf);}}else if(this[_0x583e('0xc')][_0x440fcf[_0x583e('0x30')]]){if(this[_0x583e('0xc')][_0x440fcf[_0x583e('0x30')]][_0x583e('0x23')]!==_0x440fcf[_0x583e('0x23')]['toLowerCase']()){this[_0x583e('0xc')][_0x440fcf[_0x583e('0x30')]]['stateTime']=_[_0x583e('0x34')](moment()[_0x583e('0x2d')]('x'));}this[_0x583e('0xc')][_0x440fcf[_0x583e('0x30')]]['state']=_0x440fcf['state'][_0x583e('0x33')]();logger[_0x583e('0x24')](_0x583e('0x35'),util[_0x583e('0x18')](this[_0x583e('0xc')][_0x440fcf[_0x583e('0x30')]],{'showHidden':![],'depth':null}));this[_0x583e('0x20')](util[_0x583e('0x2d')](_0x583e('0x36'),this[_0x583e('0xc')][_0x440fcf['device']]['name']),_0x583e('0x37'),this[_0x583e('0xc')][_0x440fcf[_0x583e('0x30')]]);}else if(this['trunks'][_0x440fcf[_0x583e('0x30')]]){if(this[_0x583e('0xa')][_0x440fcf[_0x583e('0x30')]][_0x583e('0x23')]!==_0x440fcf[_0x583e('0x23')]['toLowerCase']()){this[_0x583e('0xa')][_0x440fcf[_0x583e('0x30')]]['stateTime']=_['toNumber'](moment()['format']('x'));}this[_0x583e('0xa')][_0x440fcf[_0x583e('0x30')]][_0x583e('0x23')]=_0x440fcf[_0x583e('0x23')][_0x583e('0x33')]();logger[_0x583e('0x24')]('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util[_0x583e('0x18')](this[_0x583e('0xa')][_0x440fcf[_0x583e('0x30')]],{'showHidden':![],'depth':null}));this[_0x583e('0x20')](util['format'](_0x583e('0x38'),this[_0x583e('0xa')][_0x440fcf['device']]['name']),_0x583e('0x2f'),this[_0x583e('0xa')][_0x440fcf[_0x583e('0x30')]]);}else if(_['startsWith'](_0x440fcf['device'],'Local')){var _0x227e11=_0x440fcf[_0x583e('0x30')];var _0x2af437=_0x227e11[_0x583e('0x39')](_0x227e11[_0x583e('0x3a')]('/')+0x1,_0x227e11[_0x583e('0x3a')]('@'));var _0x1c2073=_[_0x583e('0x26')](this['agents'],function(_0x951476){return _0x951476[_0x583e('0x3b')]==_0x2af437||_0x951476[_0x583e('0x3c')]==_0x2af437||_0x951476[_0x583e('0x3d')]==_0x2af437;});if(_0x1c2073){if(_0x1c2073[_0x583e('0x23')]!==_0x440fcf['state'][_0x583e('0x33')]()){_0x1c2073[_0x583e('0x3e')]=_['toNumber'](moment()[_0x583e('0x2d')]('x'));}_0x1c2073[_0x583e('0x23')]=_0x440fcf[_0x583e('0x23')]['toLowerCase']();_0x1c2073['local']=!![];_0x1c2073[_0x583e('0x3f')](_0x440fcf);}}}}catch(_0x37d7bc){logger[_0x583e('0x17')](_0x583e('0x31'),util[_0x583e('0x18')](_0x37d7bc,{'showHidden':![],'depth':null}));}};UserReport[_0x583e('0x1d')][_0x583e('0x13')]=function(_0x186a7c){try{if(this[_0x583e('0x1e')](_0x186a7c)&&this[_0x583e('0x1e')](_0x186a7c[_0x583e('0x40')])){logger[_0x583e('0x21')](_0x583e('0x41'),_0x186a7c[_0x583e('0x42')],_0x186a7c[_0x583e('0x43')],_0x186a7c['peerstatus']);logger['debug'](_0x583e('0x44'),util[_0x583e('0x18')](_0x186a7c,{'showHidden':![],'depth':null}));if(this[_0x583e('0xb')][_0x186a7c['peer']]){if(!this[_0x583e('0xb')][_0x186a7c[_0x583e('0x42')]][_0x583e('0x32')]||_0x186a7c[_0x583e('0x40')]['toLowerCase']()=='registered'){this[_0x583e('0xb')][_0x186a7c['peer']][_0x583e('0x32')]=![];this['agents'][_0x186a7c['peer']][_0x583e('0x45')]=_0x186a7c[_0x583e('0x40')][_0x583e('0x33')]();this[_0x583e('0xb')][_0x186a7c['peer']][_0x583e('0x43')]=_0x186a7c[_0x583e('0x43')];this[_0x583e('0xb')][_0x186a7c[_0x583e('0x42')]][_0x583e('0x3f')](_0x186a7c);}}else if(this[_0x583e('0xc')][_0x186a7c[_0x583e('0x42')]]){this['telephones'][_0x186a7c[_0x583e('0x42')]][_0x583e('0x45')]=_0x186a7c[_0x583e('0x40')]['toLowerCase']();this['telephones'][_0x186a7c[_0x583e('0x42')]][_0x583e('0x43')]=_0x186a7c[_0x583e('0x43')];logger[_0x583e('0x24')]('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util[_0x583e('0x18')](this[_0x583e('0xc')][_0x186a7c[_0x583e('0x42')]],{'showHidden':![],'depth':null}));this[_0x583e('0x20')](util[_0x583e('0x2d')](_0x583e('0x36'),this[_0x583e('0xc')][_0x186a7c[_0x583e('0x42')]][_0x583e('0x2e')]),'telephone:save',this[_0x583e('0xc')][_0x186a7c['peer']]);}else if(this[_0x583e('0xa')][_0x186a7c[_0x583e('0x42')]]){this['trunks'][_0x186a7c[_0x583e('0x42')]][_0x583e('0x45')]=_0x186a7c[_0x583e('0x40')][_0x583e('0x33')]();this['trunks'][_0x186a7c[_0x583e('0x42')]][_0x583e('0x43')]=_0x186a7c['address'];logger[_0x583e('0x24')](_0x583e('0x46'),util[_0x583e('0x18')](this['trunks'][_0x186a7c[_0x583e('0x42')]],{'showHidden':![],'depth':null}));this[_0x583e('0x20')](util[_0x583e('0x2d')]('trunk:%s',this[_0x583e('0xa')][_0x186a7c['peer']][_0x583e('0x2e')]),'trunk:save',this['trunks'][_0x186a7c[_0x583e('0x42')]]);}}}catch(_0x3a6cf5){logger[_0x583e('0x17')](_0x583e('0x44'),util[_0x583e('0x18')](_0x3a6cf5,{'showHidden':![],'depth':null}));}};module[_0x583e('0x47')]=UserReport; \ No newline at end of file +var _0xe991=['peerstatus','resolve','then','catch','error','[userReport][sipshowregistry]','inspect','actionDeviceStateList','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined','emit','[userReport][registry]\x20registry:%s\x20state:%s','username','[userReport][registry]','find','stateRegistry','state','merge','omit','actionid','debug','format','name','trunk:save','syncDeviceState','info','device','[userReport][devicestatechange]','toLowerCase','inuse','stateTime','toNumber','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','trunk:%s','startsWith','Local','substring','indexOf','mobile','accountcode','updateStatusRealtime','peer','[userReport][peerstatus]','local','registered','status','address','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','telephone:%s','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','moment','util','ioredis','bluebird','../../../config/environment','ami','redis','defaults','localhost','trunks','agents','telephones','syncRegistry','bind','registry','devicestatechange'];(function(_0x29f66b,_0x4e037c){var _0x543906=function(_0x121c6f){while(--_0x121c6f){_0x29f66b['push'](_0x29f66b['shift']());}};_0x543906(++_0x4e037c);}(_0xe991,0x1ef));var _0x1e99=function(_0x5a845b,_0x6b32f4){_0x5a845b=_0x5a845b-0x0;var _0x509e05=_0xe991[_0x5a845b];return _0x509e05;};'use strict';var _=require('lodash');var moment=require(_0x1e99('0x0'));var util=require(_0x1e99('0x1'));var Redis=require(_0x1e99('0x2'));var BPromise=require(_0x1e99('0x3'));var config=require(_0x1e99('0x4'));var logger=require('../../../config/logger')(_0x1e99('0x5'));var ami=require('../ami');config[_0x1e99('0x6')]=_[_0x1e99('0x7')](config['redis'],{'host':_0x1e99('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function UserReport(_0x22482c){this[_0x1e99('0x9')]=_0x22482c[_0x1e99('0x9')];this[_0x1e99('0xa')]=_0x22482c[_0x1e99('0xa')];this[_0x1e99('0xb')]=_0x22482c[_0x1e99('0xb')];ami['on']('registryentry',this[_0x1e99('0xc')][_0x1e99('0xd')](this));ami['on'](_0x1e99('0xe'),this[_0x1e99('0xc')][_0x1e99('0xd')](this));ami['on'](_0x1e99('0xf'),this['syncDeviceState'][_0x1e99('0xd')](this));ami['on'](_0x1e99('0x10'),this['syncPeerStatus'][_0x1e99('0xd')](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise[_0x1e99('0x11')]()[_0x1e99('0x12')](ami['actionSipShowRegistry']())[_0x1e99('0x13')](function(_0x4ea305){logger[_0x1e99('0x14')](_0x1e99('0x15'),util[_0x1e99('0x16')](_0x4ea305,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x1e99('0x11')]()[_0x1e99('0x12')](ami[_0x1e99('0x17')]())[_0x1e99('0x13')](function(_0x5502d8){logger['error'](_0x1e99('0x18'),util['inspect'](_0x5502d8,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise['resolve']()[_0x1e99('0x12')](ami[_0x1e99('0x19')]())[_0x1e99('0x13')](function(_0x1d91cf){logger['error'](_0x1e99('0x1a'),util[_0x1e99('0x16')](_0x1d91cf,{'showHidden':![],'depth':null}));});}UserReport[_0x1e99('0x1b')]['syncRealtimeShow']=function(){setInterval(function(){BPromise[_0x1e99('0x11')]()[_0x1e99('0x12')](showSipRegistrations())['then'](listDeviceStates())['then'](showPeersStatus());},0x32c8);};UserReport[_0x1e99('0x1b')][_0x1e99('0x1c')]=function(_0x1720d0){return _0x1720d0!==null&&!_[_0x1e99('0x1d')](_0x1720d0);};UserReport[_0x1e99('0x1b')][_0x1e99('0x1e')]=function(_0x353667,_0x5af4ef,_0xd8c67b){io['to'](_0x353667)[_0x1e99('0x1e')](_0x5af4ef,_0xd8c67b);};UserReport[_0x1e99('0x1b')][_0x1e99('0xc')]=function(_0x1846af){try{if(this[_0x1e99('0x1c')](_0x1846af)){logger['info'](_0x1e99('0x1f'),_0x1846af[_0x1e99('0x20')],_0x1846af['state']);logger['debug'](_0x1e99('0x21'),util[_0x1e99('0x16')](_0x1846af,{'showHidden':![],'depth':null}));var _0x18eade=_[_0x1e99('0x22')](this['trunks'],{'defaultuser':_0x1846af[_0x1e99('0x20')]});if(_0x18eade){_0x1846af[_0x1e99('0x23')]=_0x1846af[_0x1e99('0x24')];_[_0x1e99('0x25')](_0x18eade,_[_0x1e99('0x26')](_0x1846af,['event',_0x1e99('0x27'),_0x1e99('0x20'),'state']));logger[_0x1e99('0x28')]('[userReport][registry]\x20sending\x20trunk:save\x20event:',util['inspect'](_0x18eade,{'showHidden':![],'depth':null}));this[_0x1e99('0x1e')](util[_0x1e99('0x29')]('trunk:%s',_0x18eade[_0x1e99('0x2a')]),_0x1e99('0x2b'),_0x18eade);}}}catch(_0x5e84c5){logger[_0x1e99('0x14')](_0x1e99('0x21'),util[_0x1e99('0x16')](_0x5e84c5,{'showHidden':![],'depth':null}));}};UserReport[_0x1e99('0x1b')][_0x1e99('0x2c')]=function(_0x2bdcbf){try{if(this[_0x1e99('0x1c')](_0x2bdcbf)){logger[_0x1e99('0x2d')]('[userReport][devicestatechange]\x20device:%s\x20state:%s',_0x2bdcbf[_0x1e99('0x2e')],_0x2bdcbf[_0x1e99('0x24')]);logger[_0x1e99('0x28')](_0x1e99('0x2f'),util[_0x1e99('0x16')](_0x2bdcbf,{'showHidden':![],'depth':null}));if(this[_0x1e99('0xa')][_0x2bdcbf['device']]){if(!this['agents'][_0x2bdcbf[_0x1e99('0x2e')]]['local']||_0x2bdcbf[_0x1e99('0x24')][_0x1e99('0x30')]()==_0x1e99('0x31')){this['agents'][_0x2bdcbf[_0x1e99('0x2e')]]['local']=![];if(this['agents'][_0x2bdcbf['device']]['state']!==_0x2bdcbf[_0x1e99('0x24')][_0x1e99('0x30')]()){this[_0x1e99('0xa')][_0x2bdcbf[_0x1e99('0x2e')]][_0x1e99('0x32')]=_[_0x1e99('0x33')](moment()[_0x1e99('0x29')]('x'));}this[_0x1e99('0xa')][_0x2bdcbf[_0x1e99('0x2e')]][_0x1e99('0x24')]=_0x2bdcbf['state']['toLowerCase']();this[_0x1e99('0xa')][_0x2bdcbf[_0x1e99('0x2e')]]['updateStatusRealtime'](_0x2bdcbf);}}else if(this['telephones'][_0x2bdcbf[_0x1e99('0x2e')]]){if(this['telephones'][_0x2bdcbf[_0x1e99('0x2e')]][_0x1e99('0x24')]!==_0x2bdcbf[_0x1e99('0x24')][_0x1e99('0x30')]()){this[_0x1e99('0xb')][_0x2bdcbf[_0x1e99('0x2e')]][_0x1e99('0x32')]=_['toNumber'](moment()[_0x1e99('0x29')]('x'));}this['telephones'][_0x2bdcbf[_0x1e99('0x2e')]][_0x1e99('0x24')]=_0x2bdcbf[_0x1e99('0x24')][_0x1e99('0x30')]();logger['debug'](_0x1e99('0x34'),util[_0x1e99('0x16')](this[_0x1e99('0xb')][_0x2bdcbf['device']],{'showHidden':![],'depth':null}));this['emit'](util[_0x1e99('0x29')]('telephone:%s',this['telephones'][_0x2bdcbf[_0x1e99('0x2e')]][_0x1e99('0x2a')]),_0x1e99('0x35'),this[_0x1e99('0xb')][_0x2bdcbf[_0x1e99('0x2e')]]);}else if(this['trunks'][_0x2bdcbf[_0x1e99('0x2e')]]){if(this['trunks'][_0x2bdcbf[_0x1e99('0x2e')]][_0x1e99('0x24')]!==_0x2bdcbf[_0x1e99('0x24')][_0x1e99('0x30')]()){this['trunks'][_0x2bdcbf[_0x1e99('0x2e')]][_0x1e99('0x32')]=_[_0x1e99('0x33')](moment()[_0x1e99('0x29')]('x'));}this[_0x1e99('0x9')][_0x2bdcbf[_0x1e99('0x2e')]][_0x1e99('0x24')]=_0x2bdcbf[_0x1e99('0x24')][_0x1e99('0x30')]();logger[_0x1e99('0x28')](_0x1e99('0x36'),util[_0x1e99('0x16')](this[_0x1e99('0x9')][_0x2bdcbf[_0x1e99('0x2e')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x1e99('0x29')](_0x1e99('0x37'),this[_0x1e99('0x9')][_0x2bdcbf[_0x1e99('0x2e')]][_0x1e99('0x2a')]),_0x1e99('0x2b'),this[_0x1e99('0x9')][_0x2bdcbf[_0x1e99('0x2e')]]);}else if(_[_0x1e99('0x38')](_0x2bdcbf['device'],_0x1e99('0x39'))){var _0x225e95=_0x2bdcbf[_0x1e99('0x2e')];var _0x15e3c6=_0x225e95[_0x1e99('0x3a')](_0x225e95[_0x1e99('0x3b')]('/')+0x1,_0x225e95[_0x1e99('0x3b')]('@'));var _0x521715=_['find'](this['agents'],function(_0x551c59){return _0x551c59[_0x1e99('0x3c')]==_0x15e3c6||_0x551c59['phone']==_0x15e3c6||_0x551c59[_0x1e99('0x3d')]==_0x15e3c6;});if(_0x521715){if(_0x521715['state']!==_0x2bdcbf[_0x1e99('0x24')][_0x1e99('0x30')]()){_0x521715[_0x1e99('0x32')]=_[_0x1e99('0x33')](moment()[_0x1e99('0x29')]('x'));}_0x521715[_0x1e99('0x24')]=_0x2bdcbf['state'][_0x1e99('0x30')]();_0x521715['local']=!![];_0x521715[_0x1e99('0x3e')](_0x2bdcbf);}}}}catch(_0xe22c79){logger['error'](_0x1e99('0x2f'),util[_0x1e99('0x16')](_0xe22c79,{'showHidden':![],'depth':null}));}};UserReport[_0x1e99('0x1b')]['syncPeerStatus']=function(_0x1dc703){try{if(this[_0x1e99('0x1c')](_0x1dc703)&&this[_0x1e99('0x1c')](_0x1dc703[_0x1e99('0x10')])){logger['info']('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x1dc703[_0x1e99('0x3f')],_0x1dc703['address'],_0x1dc703[_0x1e99('0x10')]);logger[_0x1e99('0x28')](_0x1e99('0x40'),util[_0x1e99('0x16')](_0x1dc703,{'showHidden':![],'depth':null}));if(this[_0x1e99('0xa')][_0x1dc703[_0x1e99('0x3f')]]){if(!this[_0x1e99('0xa')][_0x1dc703[_0x1e99('0x3f')]][_0x1e99('0x41')]||_0x1dc703[_0x1e99('0x10')][_0x1e99('0x30')]()==_0x1e99('0x42')){this[_0x1e99('0xa')][_0x1dc703['peer']][_0x1e99('0x41')]=![];this['agents'][_0x1dc703['peer']][_0x1e99('0x43')]=_0x1dc703[_0x1e99('0x10')][_0x1e99('0x30')]();this[_0x1e99('0xa')][_0x1dc703[_0x1e99('0x3f')]][_0x1e99('0x44')]=_0x1dc703[_0x1e99('0x44')];this[_0x1e99('0xa')][_0x1dc703['peer']][_0x1e99('0x3e')](_0x1dc703);}}else if(this['telephones'][_0x1dc703[_0x1e99('0x3f')]]){this['telephones'][_0x1dc703[_0x1e99('0x3f')]]['status']=_0x1dc703[_0x1e99('0x10')][_0x1e99('0x30')]();this[_0x1e99('0xb')][_0x1dc703[_0x1e99('0x3f')]]['address']=_0x1dc703[_0x1e99('0x44')];logger['debug'](_0x1e99('0x45'),util[_0x1e99('0x16')](this[_0x1e99('0xb')][_0x1dc703[_0x1e99('0x3f')]],{'showHidden':![],'depth':null}));this[_0x1e99('0x1e')](util['format'](_0x1e99('0x46'),this[_0x1e99('0xb')][_0x1dc703[_0x1e99('0x3f')]][_0x1e99('0x2a')]),_0x1e99('0x35'),this['telephones'][_0x1dc703[_0x1e99('0x3f')]]);}else if(this[_0x1e99('0x9')][_0x1dc703[_0x1e99('0x3f')]]){this['trunks'][_0x1dc703['peer']]['status']=_0x1dc703['peerstatus'][_0x1e99('0x30')]();this[_0x1e99('0x9')][_0x1dc703[_0x1e99('0x3f')]]['address']=_0x1dc703[_0x1e99('0x44')];logger['debug'](_0x1e99('0x47'),util['inspect'](this[_0x1e99('0x9')][_0x1dc703[_0x1e99('0x3f')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x1e99('0x29')]('trunk:%s',this[_0x1e99('0x9')][_0x1dc703[_0x1e99('0x3f')]]['name']),_0x1e99('0x2b'),this['trunks'][_0x1dc703[_0x1e99('0x3f')]]);}}}catch(_0x3fc311){logger[_0x1e99('0x14')]('[userReport][peerstatus]',util[_0x1e99('0x16')](_0x3fc311,{'showHidden':![],'depth':null}));}};module[_0x1e99('0x48')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index d63edc2..54b007c 100644 --- a/server/services/ami/report/voiceAgentReport.js +++ b/server/services/ami/report/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['redis','defaults','localhost','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','uniqueid','YYYY-MM-DD\x20HH:mm:ss','queue','mandatoryDisposition','type','inbound','merge','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','voiceChannels','routealias','interface','pick','destconnectedlinenum','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:%s','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answered_elsewhere','[%s][voiceAgentReport][agentconnect]','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','error','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','agentringnoanswer','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','reason','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','agent','talktime','acw','acwtime','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]','lodash','moment','util','../../../config/logger','../ami'];(function(_0x2920d3,_0x32dda1){var _0x3474f0=function(_0x56746c){while(--_0x56746c){_0x2920d3['push'](_0x2920d3['shift']());}};_0x3474f0(++_0x32dda1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'use strict';var _=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x0a9e('0x3'))('ami');var ami=require(_0x0a9e('0x4'));config[_0x0a9e('0x5')]=_[_0x0a9e('0x6')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x5')]));function VoiceAgentReport(_0x441e3a){this[_0x0a9e('0x8')]={};this['voiceChannels']=_0x441e3a['channels'];this[_0x0a9e('0x9')]=_0x441e3a['voiceQueues'];this['agents']=_0x441e3a[_0x0a9e('0xa')];this[_0x0a9e('0xb')]={};ami['on'](_0x0a9e('0xc'),this[_0x0a9e('0xd')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0xf'),this['syncAgentConnect']['bind'](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x10'),this[_0x0a9e('0x11')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x12'),this[_0x0a9e('0x13')]['bind'](this));ami['on'](_0x0a9e('0x14'),this[_0x0a9e('0x15')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0xe')](this));ami['on']('musiconholdstart',this[_0x0a9e('0x18')]['bind'](this));ami['on'](_0x0a9e('0x19'),this['syncMusicOnHoldStop'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x1a'),this['syncAttendedTransfer'][_0x0a9e('0xe')](this));ami['on']('blindtransfer',this[_0x0a9e('0x1b')][_0x0a9e('0xe')](this));}VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1d')]=function(_0x31b1ca,_0x2eb11f,_0x530eb7){io['to'](_0x31b1ca)[_0x0a9e('0x1d')](_0x2eb11f,_0x530eb7);};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1e')]=function(_0x1c696a){return _0x1c696a!==null&&!_[_0x0a9e('0x1f')](_0x1c696a);};VoiceAgentReport['prototype'][_0x0a9e('0xd')]=function(_0x155cce){try{if(this['isNotNull'](_0x155cce)){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x155cce['uniqueid'],_0x155cce[_0x0a9e('0x21')],_0x155cce[_0x0a9e('0x22')]);logger[_0x0a9e('0x23')](_0x0a9e('0x24'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x155cce,{'showHidden':![],'depth':null}));if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]]={};}if(_[_0x0a9e('0x1f')](this['channels'][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]={'agentcalledAt':moment()['format'](_0x0a9e('0x27')),'lastevent':'called','mandatoryDisposition':this[_0x0a9e('0x9')][_0x155cce['queue']]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x29')]||![]:![],'type':this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x2a')]||'inbound':_0x0a9e('0x2b'),'variables':this[_0x0a9e('0xb')][_0x155cce[_0x0a9e('0x26')]]};}_[_0x0a9e('0x2c')](this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],_[_0x0a9e('0x2d')](_0x155cce,[_0x0a9e('0x2e'),_0x0a9e('0x2f')]));logger[_0x0a9e('0x23')](_0x0a9e('0x30'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x31'),this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]);logger['debug'](_0x0a9e('0x32'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x33')]('user:%s',_0x155cce[_0x0a9e('0x21')]),'user:called',this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]);}}catch(_0x3f3d41){logger['error'](_0x0a9e('0x34'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x3f3d41,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncAgentConnect']=function(_0x54135e){try{if(this[_0x0a9e('0x1e')](_0x54135e)){if(this['channels'][_0x54135e[_0x0a9e('0x26')]]){logger[_0x0a9e('0x23')](_0x0a9e('0x35'),_0x54135e[_0x0a9e('0x26')],util['inspect'](_0x54135e,{'showHidden':![],'depth':null}));for(var _0x31916f in this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]]){if(this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x31916f)){if(_0x54135e[_0x0a9e('0x22')]===_0x31916f){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x54135e[_0x0a9e('0x26')],_0x54135e[_0x0a9e('0x21')],_0x54135e['destuniqueid']);this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x37')]=moment()[_0x0a9e('0x33')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x38')]=_0x54135e['connectedlinename'];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x39')]=_0x54135e['connectedlinenum'];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3a')]=_0x54135e[_0x0a9e('0x3a')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3b')]=_0x54135e[_0x0a9e('0x3b')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3c')]=_0x54135e[_0x0a9e('0x3c')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3d')]='connect';if(this['voiceChannels'][this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x26')]]){var _0x315881=this[_0x0a9e('0x3e')][this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x26')]][_0x0a9e('0x3f')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3f')]=_0x315881;_0x54135e['routealias']=_0x315881;}_[_0x0a9e('0x2c')](this[_0x0a9e('0xa')][_0x54135e[_0x0a9e('0x40')]],_[_0x0a9e('0x41')](_0x54135e,[_0x0a9e('0x28'),_0x0a9e('0x42'),_0x0a9e('0x3f')]));logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:',_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami['emit'](_0x0a9e('0x43'),this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]]);logger[_0x0a9e('0x23')](_0x0a9e('0x44'),_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x33')](_0x0a9e('0x45'),_0x54135e[_0x0a9e('0x21')]),_0x0a9e('0x46'),this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x54135e[_0x0a9e('0x22')]]);}else if(!this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['agentringnoanswer']&&!this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')](_0x0a9e('0x47'),_0x54135e[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x21')],_0x31916f);this['channels'][_0x54135e['uniqueid']][_0x31916f]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x48')]=moment()['format'](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['answeredelsewheredestinationuniqueid']=_0x54135e[_0x0a9e('0x22')];this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f]['answeredelsewheremembername']=_0x54135e[_0x0a9e('0x21')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f]['lastevent']=_0x0a9e('0x49');this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['reason']=_0x0a9e('0x49');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')]('custom:agentansweredelsewhere',this['channels'][_0x54135e['uniqueid']][_0x31916f]);}}}}}}catch(_0x2da03c){logger['error'](_0x0a9e('0x4a'),_0x54135e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2da03c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x4b')]=function(_0x272738){try{if(this[_0x0a9e('0x1e')](_0x272738)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x272738[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x272738,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]]&&this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']]){logger[_0x0a9e('0x20')](_0x0a9e('0x4c'),_0x272738['uniqueid'],_0x272738[_0x0a9e('0x21')],_0x272738['destuniqueid']);this[_0x0a9e('0x8')][_0x272738['uniqueid']][_0x272738['destuniqueid']]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x272738['uniqueid']][_0x272738[_0x0a9e('0x22')]][_0x0a9e('0x48')]=moment()[_0x0a9e('0x33')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']][_0x0a9e('0x3d')]='rejected';this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738[_0x0a9e('0x22')]]['reason']=_0x0a9e('0x4d');logger[_0x0a9e('0x23')](_0x0a9e('0x4e'),_0x272738[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x4f'),this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738[_0x0a9e('0x22')]]);}}}catch(_0x4d4a35){logger[_0x0a9e('0x50')](_0x0a9e('0x51'),_0x272738[_0x0a9e('0x26')],util['inspect'](_0x4d4a35,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncQueueCallerAbandon']=function(_0x5211e3){try{if(this[_0x0a9e('0x1e')](_0x5211e3)){logger[_0x0a9e('0x23')](_0x0a9e('0x52'),_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x5211e3,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]]){for(var _0x54a37d in this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x54a37d)&&!this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x53')]&&!this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d]['agentcomplete']){logger[_0x0a9e('0x20')](_0x0a9e('0x54'),_0x5211e3[_0x0a9e('0x26')],this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x21')],_0x54a37d);this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x53')]=!![];this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x48')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x3d')]=_0x0a9e('0x55');this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x56')]=_0x0a9e('0x55');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x5211e3['uniqueid']][_0x54a37d],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')]('custom:agentqueuecallerabandon',this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d]);}}}}}catch(_0x4c46c1){logger[_0x0a9e('0x50')](_0x0a9e('0x57'),_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4c46c1,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x13')]=function(_0x2e9552){try{if(this[_0x0a9e('0x1e')](_0x2e9552)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcomplete]\x20event:',_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2e9552,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]]){for(var _0x4abc8f in this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x4abc8f)){if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x37')]&&!this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')](_0x0a9e('0x58'),_0x2e9552[_0x0a9e('0x26')],this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x21')],_0x4abc8f);this[_0x0a9e('0x8')][_0x2e9552['uniqueid']][_0x4abc8f][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x59')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]['lastevent']=_0x0a9e('0x5a');this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x56')]=_0x2e9552['reason']==_0x0a9e('0x5b')?_0x0a9e('0x5c'):_0x2e9552[_0x0a9e('0x56')];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x5d')]=_0x2e9552[_0x0a9e('0x5d')];if(this['voiceQueues'][_0x2e9552[_0x0a9e('0x28')]]&&this[_0x0a9e('0x9')][_0x2e9552[_0x0a9e('0x28')]][_0x0a9e('0x5e')]){this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x5f')]=this['voiceQueues'][_0x2e9552[_0x0a9e('0x28')]]['acwTimeout'];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x60')]=!![];}this[_0x0a9e('0xa')][_0x2e9552['interface']]=_['omit'](this[_0x0a9e('0xa')][_0x2e9552[_0x0a9e('0x40')]],[_0x0a9e('0x28'),'destconnectedlinenum']);logger[_0x0a9e('0x23')](_0x0a9e('0x61'),_0x2e9552['uniqueid'],util['inspect'](this[_0x0a9e('0x8')][_0x2e9552['uniqueid']][_0x4abc8f],{'showHidden':![],'depth':null}));ami['emit']('custom:agentcomplete',this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]);logger[_0x0a9e('0x23')](_0x0a9e('0x62'),_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f],{'showHidden':![],'depth':null}));this['emit'](util[_0x0a9e('0x33')](_0x0a9e('0x45'),_0x2e9552[_0x0a9e('0x21')]),_0x0a9e('0x63'),this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]);}}}}}}catch(_0x32f761){logger[_0x0a9e('0x50')]('[%s][voiceAgentReport][agentcomplete]',_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x32f761,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x15')]=function(_0x255e49){try{if(this[_0x0a9e('0x1e')](_0x255e49)){logger[_0x0a9e('0x23')](_0x0a9e('0x64'),_0x255e49['uniqueid'],util[_0x0a9e('0x25')](_0x255e49,{'showHidden':![],'depth':null}));this[_0x0a9e('0x65')](_0x255e49['uniqueid'],_[_0x0a9e('0x66')](_0x255e49[_0x0a9e('0x67')])[0x0],_0x255e49[_0x0a9e('0x68')]);if(this['channels'][_0x255e49[_0x0a9e('0x26')]]){for(var _0x52ec10 in this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x52ec10)){logger[_0x0a9e('0x20')](_0x0a9e('0x69'),_0x255e49[_0x0a9e('0x26')],_0x52ec10,_['keys'](_0x255e49[_0x0a9e('0x67')])[0x0],_0x255e49[_0x0a9e('0x68')]);if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')])){this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')]={};}this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')]=this[_0x0a9e('0xb')][_0x255e49['uniqueid']];}}}}}catch(_0xc81b64){logger[_0x0a9e('0x50')](_0x0a9e('0x6a'),_0x255e49[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xc81b64,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x65')]=function(_0x1756c7,_0x5ce99d,_0x23b447){var _0x5e725e=[_0x0a9e('0x6b'),_0x0a9e('0x6c'),_0x0a9e('0x6d'),_0x0a9e('0x6e'),'rtpaudioqosloss',_0x0a9e('0x6f'),'rtpaudioqosrtt',_0x0a9e('0x70'),_0x0a9e('0x71'),'sipuri',_0x0a9e('0x72'),_0x0a9e('0x73'),_0x0a9e('0x74'),'memberdynamic','memberinterface',_0x0a9e('0x75'),_0x0a9e('0x21'),_0x0a9e('0x76'),_0x0a9e('0x77')];if(!_[_0x0a9e('0x78')](_0x5ce99d)&&!_[_0x0a9e('0x79')](_0x5e725e,_0x5ce99d)){if(_[_0x0a9e('0x1f')](this[_0x0a9e('0xb')][_0x1756c7])){this[_0x0a9e('0xb')][_0x1756c7]={};}this['variables'][_0x1756c7][_0x5ce99d]=_0x23b447;}};VoiceAgentReport[_0x0a9e('0x1c')]['syncHangup']=function(_0x287324){try{if(this[_0x0a9e('0x1e')](_0x287324)){logger[_0x0a9e('0x23')](_0x0a9e('0x7a'),_0x287324[_0x0a9e('0x26')],util['inspect'](_0x287324,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]){for(var _0x2791c5 in this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]){if(this['channels'][_0x287324['uniqueid']][_0x0a9e('0x36')](_0x2791c5)){if(this['channels'][_0x287324[_0x0a9e('0x26')]][_0x2791c5][_0x0a9e('0x56')]==_0x0a9e('0x5b')&&this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]][_0x2791c5][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x287324[_0x0a9e('0x26')],_0x2791c5);this['channels'][_0x287324[_0x0a9e('0x26')]][_0x2791c5]['agentcompleteAt']=moment()[_0x0a9e('0x33')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger['debug'](_0x0a9e('0x7b'),_0x287324[_0x0a9e('0x26')],util['inspect'](_[_0x0a9e('0x7c')](this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]),{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x7d'),_['values'](this['channels'][_0x287324[_0x0a9e('0x26')]]));delete this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]];}if(this[_0x0a9e('0xb')][_0x287324[_0x0a9e('0x26')]]){delete this['variables'][_0x287324[_0x0a9e('0x26')]];}}}catch(_0xadce3d){logger['error'](_0x0a9e('0x7e'),_0x287324[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xadce3d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x7f')]=function(_0x23b39e){try{if(this[_0x0a9e('0x1e')](_0x23b39e)){logger[_0x0a9e('0x23')](_0x0a9e('0x80'),_0x23b39e[_0x0a9e('0x26')],util['inspect'](_0x23b39e,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]]){for(var _0x2ada60 in this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]]){if(this['channels'][_0x23b39e['transfereeuniqueid']][_0x0a9e('0x36')](_0x2ada60)){if(_0x23b39e[_0x0a9e('0x82')]===_0x2ada60){logger[_0x0a9e('0x20')](_0x0a9e('0x83'),_0x23b39e[_0x0a9e('0x26')],this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x21')],_0x2ada60);var _0x3450ae=moment();this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x23b39e['transfereeuniqueid']][_0x2ada60][_0x0a9e('0x59')]=moment()[_0x0a9e('0x33')](_0x0a9e('0x27'));this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60]['lastevent']=_0x0a9e('0x5a');this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x56')]=_0x0a9e('0x5b');this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x5d')]=_0x3450ae[_0x0a9e('0x84')](this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x37')],_0x0a9e('0x85'));}}}}if(this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x86')]]){var _0x248368=this['channels'][_0x23b39e['secondtransfereruniqueid']];this[_0x0a9e('0x8')][_0x23b39e['secondtransfereruniqueid']]=this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]];this['channels'][_0x23b39e[_0x0a9e('0x81')]]=_0x248368;}}}catch(_0xe2b083){logger[_0x0a9e('0x50')](_0x0a9e('0x87'),_0x23b39e['uniqueid'],util[_0x0a9e('0x25')](_0xe2b083,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1b')]=function(_0x34a791){try{if(this['isNotNull'](_0x34a791)){logger[_0x0a9e('0x23')](_0x0a9e('0x88'),_0x34a791[_0x0a9e('0x26')],util['inspect'](_0x34a791,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]]){for(var _0x17b29d in this['channels'][_0x34a791[_0x0a9e('0x81')]]){if(this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x0a9e('0x36')](_0x17b29d)){if(_0x34a791[_0x0a9e('0x89')]===_0x17b29d){logger['info'](_0x0a9e('0x8a'),_0x34a791[_0x0a9e('0x26')],this['channels'][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x21')],_0x17b29d);var _0x1f6f1c=moment();this['channels'][_0x34a791['transfereeuniqueid']][_0x17b29d]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d]['agentcompleteAt']=_0x1f6f1c;this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x3d')]='complete';this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x56')]=_0x0a9e('0x5b');this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x5d')]=_0x1f6f1c[_0x0a9e('0x84')](this[_0x0a9e('0x8')][_0x34a791['transfereeuniqueid']][_0x17b29d][_0x0a9e('0x37')],'seconds');}}}}}}catch(_0x138cf5){logger[_0x0a9e('0x50')](_0x0a9e('0x8b'),_0x34a791[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x138cf5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncMusicOnHoldStart']=function(_0x1a0314){var _0x33da81='';try{if(this[_0x0a9e('0x1e')](_0x1a0314)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x1a0314[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x1a0314,{'showHidden':![],'depth':null}));if(_0x1a0314[_0x0a9e('0x8c')]){_0x33da81=_0x1a0314[_0x0a9e('0x8c')][_0x0a9e('0x8d')](0x0,_0x1a0314[_0x0a9e('0x8c')][_0x0a9e('0x8e')]('-'));if(this[_0x0a9e('0xa')][_0x33da81]){logger[_0x0a9e('0x20')](_0x0a9e('0x8f'),_0x1a0314['uniqueid'],_0x33da81);this[_0x0a9e('0xa')][_0x33da81][_0x0a9e('0x90')]=!![];}}}}catch(_0x2ff265){logger[_0x0a9e('0x50')](_0x0a9e('0x91'),_0x1a0314[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2ff265,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncMusicOnHoldStop']=function(_0x3b581c){var _0xd2391='';try{if(this[_0x0a9e('0x1e')](_0x3b581c)){logger['debug'](_0x0a9e('0x92'),_0x3b581c[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x3b581c,{'showHidden':![],'depth':null}));if(_0x3b581c[_0x0a9e('0x8c')]){_0xd2391=_0x3b581c[_0x0a9e('0x8c')][_0x0a9e('0x8d')](0x0,_0x3b581c[_0x0a9e('0x8c')][_0x0a9e('0x8e')]('-'));if(this[_0x0a9e('0xa')][_0xd2391]){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x3b581c[_0x0a9e('0x26')],_0xd2391);this[_0x0a9e('0xa')][_0xd2391][_0x0a9e('0x90')]=![];}}}}catch(_0x3db98f){logger[_0x0a9e('0x50')](_0x0a9e('0x93'),_0x3b581c['uniqueid'],util[_0x0a9e('0x25')](_0x3db98f,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file +var _0xa9e0=['redis','defaults','localhost','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','uniqueid','YYYY-MM-DD\x20HH:mm:ss','queue','mandatoryDisposition','type','inbound','merge','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','voiceChannels','routealias','interface','pick','destconnectedlinenum','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:%s','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answered_elsewhere','[%s][voiceAgentReport][agentconnect]','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','error','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','agentringnoanswer','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','reason','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','agent','talktime','acw','acwtime','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]','lodash','moment','util','../../../config/logger','../ami'];(function(_0x5a8b6d,_0x337e77){var _0x4f1ecb=function(_0x43456e){while(--_0x43456e){_0x5a8b6d['push'](_0x5a8b6d['shift']());}};_0x4f1ecb(++_0x337e77);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x0a9e('0x3'))('ami');var ami=require(_0x0a9e('0x4'));config[_0x0a9e('0x5')]=_[_0x0a9e('0x6')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x5')]));function VoiceAgentReport(_0x441e3a){this[_0x0a9e('0x8')]={};this['voiceChannels']=_0x441e3a['channels'];this[_0x0a9e('0x9')]=_0x441e3a['voiceQueues'];this['agents']=_0x441e3a[_0x0a9e('0xa')];this[_0x0a9e('0xb')]={};ami['on'](_0x0a9e('0xc'),this[_0x0a9e('0xd')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0xf'),this['syncAgentConnect']['bind'](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x10'),this[_0x0a9e('0x11')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x12'),this[_0x0a9e('0x13')]['bind'](this));ami['on'](_0x0a9e('0x14'),this[_0x0a9e('0x15')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0xe')](this));ami['on']('musiconholdstart',this[_0x0a9e('0x18')]['bind'](this));ami['on'](_0x0a9e('0x19'),this['syncMusicOnHoldStop'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x1a'),this['syncAttendedTransfer'][_0x0a9e('0xe')](this));ami['on']('blindtransfer',this[_0x0a9e('0x1b')][_0x0a9e('0xe')](this));}VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1d')]=function(_0x31b1ca,_0x2eb11f,_0x530eb7){io['to'](_0x31b1ca)[_0x0a9e('0x1d')](_0x2eb11f,_0x530eb7);};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1e')]=function(_0x1c696a){return _0x1c696a!==null&&!_[_0x0a9e('0x1f')](_0x1c696a);};VoiceAgentReport['prototype'][_0x0a9e('0xd')]=function(_0x155cce){try{if(this['isNotNull'](_0x155cce)){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x155cce['uniqueid'],_0x155cce[_0x0a9e('0x21')],_0x155cce[_0x0a9e('0x22')]);logger[_0x0a9e('0x23')](_0x0a9e('0x24'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x155cce,{'showHidden':![],'depth':null}));if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]]={};}if(_[_0x0a9e('0x1f')](this['channels'][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]={'agentcalledAt':moment()['format'](_0x0a9e('0x27')),'lastevent':'called','mandatoryDisposition':this[_0x0a9e('0x9')][_0x155cce['queue']]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x29')]||![]:![],'type':this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x2a')]||'inbound':_0x0a9e('0x2b'),'variables':this[_0x0a9e('0xb')][_0x155cce[_0x0a9e('0x26')]]};}_[_0x0a9e('0x2c')](this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],_[_0x0a9e('0x2d')](_0x155cce,[_0x0a9e('0x2e'),_0x0a9e('0x2f')]));logger[_0x0a9e('0x23')](_0x0a9e('0x30'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x31'),this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]);logger['debug'](_0x0a9e('0x32'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x33')]('user:%s',_0x155cce[_0x0a9e('0x21')]),'user:called',this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]);}}catch(_0x3f3d41){logger['error'](_0x0a9e('0x34'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x3f3d41,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncAgentConnect']=function(_0x54135e){try{if(this[_0x0a9e('0x1e')](_0x54135e)){if(this['channels'][_0x54135e[_0x0a9e('0x26')]]){logger[_0x0a9e('0x23')](_0x0a9e('0x35'),_0x54135e[_0x0a9e('0x26')],util['inspect'](_0x54135e,{'showHidden':![],'depth':null}));for(var _0x31916f in this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]]){if(this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x31916f)){if(_0x54135e[_0x0a9e('0x22')]===_0x31916f){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x54135e[_0x0a9e('0x26')],_0x54135e[_0x0a9e('0x21')],_0x54135e['destuniqueid']);this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x37')]=moment()[_0x0a9e('0x33')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x38')]=_0x54135e['connectedlinename'];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x39')]=_0x54135e['connectedlinenum'];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3a')]=_0x54135e[_0x0a9e('0x3a')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3b')]=_0x54135e[_0x0a9e('0x3b')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3c')]=_0x54135e[_0x0a9e('0x3c')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3d')]='connect';if(this['voiceChannels'][this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x26')]]){var _0x315881=this[_0x0a9e('0x3e')][this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x26')]][_0x0a9e('0x3f')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3f')]=_0x315881;_0x54135e['routealias']=_0x315881;}_[_0x0a9e('0x2c')](this[_0x0a9e('0xa')][_0x54135e[_0x0a9e('0x40')]],_[_0x0a9e('0x41')](_0x54135e,[_0x0a9e('0x28'),_0x0a9e('0x42'),_0x0a9e('0x3f')]));logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:',_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami['emit'](_0x0a9e('0x43'),this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]]);logger[_0x0a9e('0x23')](_0x0a9e('0x44'),_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x33')](_0x0a9e('0x45'),_0x54135e[_0x0a9e('0x21')]),_0x0a9e('0x46'),this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x54135e[_0x0a9e('0x22')]]);}else if(!this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['agentringnoanswer']&&!this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')](_0x0a9e('0x47'),_0x54135e[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x21')],_0x31916f);this['channels'][_0x54135e['uniqueid']][_0x31916f]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x48')]=moment()['format'](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['answeredelsewheredestinationuniqueid']=_0x54135e[_0x0a9e('0x22')];this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f]['answeredelsewheremembername']=_0x54135e[_0x0a9e('0x21')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f]['lastevent']=_0x0a9e('0x49');this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['reason']=_0x0a9e('0x49');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')]('custom:agentansweredelsewhere',this['channels'][_0x54135e['uniqueid']][_0x31916f]);}}}}}}catch(_0x2da03c){logger['error'](_0x0a9e('0x4a'),_0x54135e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2da03c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x4b')]=function(_0x272738){try{if(this[_0x0a9e('0x1e')](_0x272738)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x272738[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x272738,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]]&&this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']]){logger[_0x0a9e('0x20')](_0x0a9e('0x4c'),_0x272738['uniqueid'],_0x272738[_0x0a9e('0x21')],_0x272738['destuniqueid']);this[_0x0a9e('0x8')][_0x272738['uniqueid']][_0x272738['destuniqueid']]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x272738['uniqueid']][_0x272738[_0x0a9e('0x22')]][_0x0a9e('0x48')]=moment()[_0x0a9e('0x33')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']][_0x0a9e('0x3d')]='rejected';this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738[_0x0a9e('0x22')]]['reason']=_0x0a9e('0x4d');logger[_0x0a9e('0x23')](_0x0a9e('0x4e'),_0x272738[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x4f'),this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738[_0x0a9e('0x22')]]);}}}catch(_0x4d4a35){logger[_0x0a9e('0x50')](_0x0a9e('0x51'),_0x272738[_0x0a9e('0x26')],util['inspect'](_0x4d4a35,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncQueueCallerAbandon']=function(_0x5211e3){try{if(this[_0x0a9e('0x1e')](_0x5211e3)){logger[_0x0a9e('0x23')](_0x0a9e('0x52'),_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x5211e3,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]]){for(var _0x54a37d in this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x54a37d)&&!this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x53')]&&!this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d]['agentcomplete']){logger[_0x0a9e('0x20')](_0x0a9e('0x54'),_0x5211e3[_0x0a9e('0x26')],this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x21')],_0x54a37d);this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x53')]=!![];this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x48')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x3d')]=_0x0a9e('0x55');this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x56')]=_0x0a9e('0x55');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x5211e3['uniqueid']][_0x54a37d],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')]('custom:agentqueuecallerabandon',this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d]);}}}}}catch(_0x4c46c1){logger[_0x0a9e('0x50')](_0x0a9e('0x57'),_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4c46c1,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x13')]=function(_0x2e9552){try{if(this[_0x0a9e('0x1e')](_0x2e9552)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcomplete]\x20event:',_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2e9552,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]]){for(var _0x4abc8f in this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x4abc8f)){if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x37')]&&!this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')](_0x0a9e('0x58'),_0x2e9552[_0x0a9e('0x26')],this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x21')],_0x4abc8f);this[_0x0a9e('0x8')][_0x2e9552['uniqueid']][_0x4abc8f][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x59')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]['lastevent']=_0x0a9e('0x5a');this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x56')]=_0x2e9552['reason']==_0x0a9e('0x5b')?_0x0a9e('0x5c'):_0x2e9552[_0x0a9e('0x56')];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x5d')]=_0x2e9552[_0x0a9e('0x5d')];if(this['voiceQueues'][_0x2e9552[_0x0a9e('0x28')]]&&this[_0x0a9e('0x9')][_0x2e9552[_0x0a9e('0x28')]][_0x0a9e('0x5e')]){this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x5f')]=this['voiceQueues'][_0x2e9552[_0x0a9e('0x28')]]['acwTimeout'];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x60')]=!![];}this[_0x0a9e('0xa')][_0x2e9552['interface']]=_['omit'](this[_0x0a9e('0xa')][_0x2e9552[_0x0a9e('0x40')]],[_0x0a9e('0x28'),'destconnectedlinenum']);logger[_0x0a9e('0x23')](_0x0a9e('0x61'),_0x2e9552['uniqueid'],util['inspect'](this[_0x0a9e('0x8')][_0x2e9552['uniqueid']][_0x4abc8f],{'showHidden':![],'depth':null}));ami['emit']('custom:agentcomplete',this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]);logger[_0x0a9e('0x23')](_0x0a9e('0x62'),_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f],{'showHidden':![],'depth':null}));this['emit'](util[_0x0a9e('0x33')](_0x0a9e('0x45'),_0x2e9552[_0x0a9e('0x21')]),_0x0a9e('0x63'),this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]);}}}}}}catch(_0x32f761){logger[_0x0a9e('0x50')]('[%s][voiceAgentReport][agentcomplete]',_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x32f761,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x15')]=function(_0x255e49){try{if(this[_0x0a9e('0x1e')](_0x255e49)){logger[_0x0a9e('0x23')](_0x0a9e('0x64'),_0x255e49['uniqueid'],util[_0x0a9e('0x25')](_0x255e49,{'showHidden':![],'depth':null}));this[_0x0a9e('0x65')](_0x255e49['uniqueid'],_[_0x0a9e('0x66')](_0x255e49[_0x0a9e('0x67')])[0x0],_0x255e49[_0x0a9e('0x68')]);if(this['channels'][_0x255e49[_0x0a9e('0x26')]]){for(var _0x52ec10 in this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x52ec10)){logger[_0x0a9e('0x20')](_0x0a9e('0x69'),_0x255e49[_0x0a9e('0x26')],_0x52ec10,_['keys'](_0x255e49[_0x0a9e('0x67')])[0x0],_0x255e49[_0x0a9e('0x68')]);if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')])){this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')]={};}this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')]=this[_0x0a9e('0xb')][_0x255e49['uniqueid']];}}}}}catch(_0xc81b64){logger[_0x0a9e('0x50')](_0x0a9e('0x6a'),_0x255e49[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xc81b64,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x65')]=function(_0x1756c7,_0x5ce99d,_0x23b447){var _0x5e725e=[_0x0a9e('0x6b'),_0x0a9e('0x6c'),_0x0a9e('0x6d'),_0x0a9e('0x6e'),'rtpaudioqosloss',_0x0a9e('0x6f'),'rtpaudioqosrtt',_0x0a9e('0x70'),_0x0a9e('0x71'),'sipuri',_0x0a9e('0x72'),_0x0a9e('0x73'),_0x0a9e('0x74'),'memberdynamic','memberinterface',_0x0a9e('0x75'),_0x0a9e('0x21'),_0x0a9e('0x76'),_0x0a9e('0x77')];if(!_[_0x0a9e('0x78')](_0x5ce99d)&&!_[_0x0a9e('0x79')](_0x5e725e,_0x5ce99d)){if(_[_0x0a9e('0x1f')](this[_0x0a9e('0xb')][_0x1756c7])){this[_0x0a9e('0xb')][_0x1756c7]={};}this['variables'][_0x1756c7][_0x5ce99d]=_0x23b447;}};VoiceAgentReport[_0x0a9e('0x1c')]['syncHangup']=function(_0x287324){try{if(this[_0x0a9e('0x1e')](_0x287324)){logger[_0x0a9e('0x23')](_0x0a9e('0x7a'),_0x287324[_0x0a9e('0x26')],util['inspect'](_0x287324,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]){for(var _0x2791c5 in this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]){if(this['channels'][_0x287324['uniqueid']][_0x0a9e('0x36')](_0x2791c5)){if(this['channels'][_0x287324[_0x0a9e('0x26')]][_0x2791c5][_0x0a9e('0x56')]==_0x0a9e('0x5b')&&this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]][_0x2791c5][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x287324[_0x0a9e('0x26')],_0x2791c5);this['channels'][_0x287324[_0x0a9e('0x26')]][_0x2791c5]['agentcompleteAt']=moment()[_0x0a9e('0x33')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger['debug'](_0x0a9e('0x7b'),_0x287324[_0x0a9e('0x26')],util['inspect'](_[_0x0a9e('0x7c')](this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]),{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x7d'),_['values'](this['channels'][_0x287324[_0x0a9e('0x26')]]));delete this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]];}if(this[_0x0a9e('0xb')][_0x287324[_0x0a9e('0x26')]]){delete this['variables'][_0x287324[_0x0a9e('0x26')]];}}}catch(_0xadce3d){logger['error'](_0x0a9e('0x7e'),_0x287324[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xadce3d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x7f')]=function(_0x23b39e){try{if(this[_0x0a9e('0x1e')](_0x23b39e)){logger[_0x0a9e('0x23')](_0x0a9e('0x80'),_0x23b39e[_0x0a9e('0x26')],util['inspect'](_0x23b39e,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]]){for(var _0x2ada60 in this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]]){if(this['channels'][_0x23b39e['transfereeuniqueid']][_0x0a9e('0x36')](_0x2ada60)){if(_0x23b39e[_0x0a9e('0x82')]===_0x2ada60){logger[_0x0a9e('0x20')](_0x0a9e('0x83'),_0x23b39e[_0x0a9e('0x26')],this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x21')],_0x2ada60);var _0x3450ae=moment();this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x23b39e['transfereeuniqueid']][_0x2ada60][_0x0a9e('0x59')]=moment()[_0x0a9e('0x33')](_0x0a9e('0x27'));this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60]['lastevent']=_0x0a9e('0x5a');this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x56')]=_0x0a9e('0x5b');this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x5d')]=_0x3450ae[_0x0a9e('0x84')](this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x37')],_0x0a9e('0x85'));}}}}if(this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x86')]]){var _0x248368=this['channels'][_0x23b39e['secondtransfereruniqueid']];this[_0x0a9e('0x8')][_0x23b39e['secondtransfereruniqueid']]=this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]];this['channels'][_0x23b39e[_0x0a9e('0x81')]]=_0x248368;}}}catch(_0xe2b083){logger[_0x0a9e('0x50')](_0x0a9e('0x87'),_0x23b39e['uniqueid'],util[_0x0a9e('0x25')](_0xe2b083,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1b')]=function(_0x34a791){try{if(this['isNotNull'](_0x34a791)){logger[_0x0a9e('0x23')](_0x0a9e('0x88'),_0x34a791[_0x0a9e('0x26')],util['inspect'](_0x34a791,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]]){for(var _0x17b29d in this['channels'][_0x34a791[_0x0a9e('0x81')]]){if(this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x0a9e('0x36')](_0x17b29d)){if(_0x34a791[_0x0a9e('0x89')]===_0x17b29d){logger['info'](_0x0a9e('0x8a'),_0x34a791[_0x0a9e('0x26')],this['channels'][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x21')],_0x17b29d);var _0x1f6f1c=moment();this['channels'][_0x34a791['transfereeuniqueid']][_0x17b29d]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d]['agentcompleteAt']=_0x1f6f1c;this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x3d')]='complete';this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x56')]=_0x0a9e('0x5b');this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x5d')]=_0x1f6f1c[_0x0a9e('0x84')](this[_0x0a9e('0x8')][_0x34a791['transfereeuniqueid']][_0x17b29d][_0x0a9e('0x37')],'seconds');}}}}}}catch(_0x138cf5){logger[_0x0a9e('0x50')](_0x0a9e('0x8b'),_0x34a791[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x138cf5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncMusicOnHoldStart']=function(_0x1a0314){var _0x33da81='';try{if(this[_0x0a9e('0x1e')](_0x1a0314)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x1a0314[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x1a0314,{'showHidden':![],'depth':null}));if(_0x1a0314[_0x0a9e('0x8c')]){_0x33da81=_0x1a0314[_0x0a9e('0x8c')][_0x0a9e('0x8d')](0x0,_0x1a0314[_0x0a9e('0x8c')][_0x0a9e('0x8e')]('-'));if(this[_0x0a9e('0xa')][_0x33da81]){logger[_0x0a9e('0x20')](_0x0a9e('0x8f'),_0x1a0314['uniqueid'],_0x33da81);this[_0x0a9e('0xa')][_0x33da81][_0x0a9e('0x90')]=!![];}}}}catch(_0x2ff265){logger[_0x0a9e('0x50')](_0x0a9e('0x91'),_0x1a0314[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2ff265,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncMusicOnHoldStop']=function(_0x3b581c){var _0xd2391='';try{if(this[_0x0a9e('0x1e')](_0x3b581c)){logger['debug'](_0x0a9e('0x92'),_0x3b581c[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x3b581c,{'showHidden':![],'depth':null}));if(_0x3b581c[_0x0a9e('0x8c')]){_0xd2391=_0x3b581c[_0x0a9e('0x8c')][_0x0a9e('0x8d')](0x0,_0x3b581c[_0x0a9e('0x8c')][_0x0a9e('0x8e')]('-'));if(this[_0x0a9e('0xa')][_0xd2391]){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x3b581c[_0x0a9e('0x26')],_0xd2391);this[_0x0a9e('0xa')][_0xd2391][_0x0a9e('0x90')]=![];}}}}catch(_0x3db98f){logger[_0x0a9e('0x50')](_0x0a9e('0x93'),_0x3b581c['uniqueid'],util[_0x0a9e('0x25')](_0x3db98f,{'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 b93018a..7b071a7 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 _0xc053=['unavailable','ringinuse','onhold','set','queue','agi','dial','voicemail','NO\x20ANSWER','FAILED','ANSWERED','defaults','redis','localhost','socket.io-emitter','channels','agents','coreshowchannel','bind','newexten','syncNewExten','newchannel','syncNewChannel','newstate','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','isUndefined','emit','calleridname','debug','[%s][voiceCallReport][newcallerid]\x20event:','uniqueid','linkedid','merge','keys','context','channel','exten','split','destconnectedlinenum','format','user:%s','name','user:agentconnect','connectedlinenum','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','pick','from-sip','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','CDR(routeAlias)','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','subtract','duration','seconds','includes','lastapplication','lastdata','cdr(','match','[%s][voiceCallReport][newexten]','syncNewState','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','channelstate','answered','holdtime','calleridnum','xcally-motion-preview','connectedlinename','destinationchannel','membername','routealias','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','accountcode','syncMixMonitorFilename','monitor','endsWith','replace','.wav49','.WAV','monitorFilename','monitors','push','rec','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','callerid','xmd-cdrtype','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','parse','sipcallid','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20reason:%s','endtime','diff','answertime','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','resolve','then','undefined','isEmpty','getSettings','stopRecordingOnTransfer','Action','StopMixMonitor','catch','event','blindTransfers','type','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','[%s][voiceCallReport][hangup]','syncAttendedTransfer','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','some','ATTENDED','transferType','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','BlindTransfer','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','isNil','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','bluebird','lodash','moment','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','../rpc/setting','busy'];(function(_0x31b0da,_0x5ba110){var _0x378994=function(_0x37a976){while(--_0x37a976){_0x31b0da['push'](_0x31b0da['shift']());}};_0x378994(++_0x5ba110);}(_0xc053,0xc2));var _0x3c05=function(_0x5db720,_0x1d6bdd){_0x5db720=_0x5db720-0x0;var _0x2ab3e2=_0xc053[_0x5db720];return _0x2ab3e2;};'use strict';var BPromise=require(_0x3c05('0x0'));var _=require(_0x3c05('0x1'));var moment=require(_0x3c05('0x2'));var util=require(_0x3c05('0x3'));var path=require(_0x3c05('0x4'));var Redis=require(_0x3c05('0x5'));var config=require(_0x3c05('0x6'));var logger=require(_0x3c05('0x7'))(_0x3c05('0x8'));var ami=require(_0x3c05('0x9'));var Channel=require(_0x3c05('0xa'));var RpcSetting=require(_0x3c05('0xb'));var statusDesc=['unknown','not_inuse','inuse',_0x3c05('0xc'),'invalid',_0x3c05('0xd'),'ringing',_0x3c05('0xe'),_0x3c05('0xf')];var applications=[_0x3c05('0x10'),_0x3c05('0x11'),_0x3c05('0x12'),_0x3c05('0x13'),'playback',_0x3c05('0x14')];var dispositions=[_0x3c05('0x15'),_0x3c05('0x16'),_0x3c05('0x16'),_0x3c05('0x15'),_0x3c05('0x15'),_0x3c05('0x15'),_0x3c05('0x17'),'BUSY',_0x3c05('0x16'),_0x3c05('0x16'),_0x3c05('0x16')];var actions={};config['redis']=_[_0x3c05('0x18')](config[_0x3c05('0x19')],{'host':_0x3c05('0x1a'),'port':0x18eb});var io=require(_0x3c05('0x1b'))(new Redis(config[_0x3c05('0x19')]));function VoiceCallReport(_0x2542c5){this[_0x3c05('0x1c')]=_0x2542c5[_0x3c05('0x1c')];this['agents']=_0x2542c5[_0x3c05('0x1d')];this['blindTransfers']={};ami['on'](_0x3c05('0x1e'),this['syncNewExten'][_0x3c05('0x1f')](this));ami['on'](_0x3c05('0x20'),this[_0x3c05('0x21')]['bind'](this));ami['on'](_0x3c05('0x22'),this[_0x3c05('0x23')][_0x3c05('0x1f')](this));ami['on'](_0x3c05('0x24'),this['syncNewState'][_0x3c05('0x1f')](this));ami['on']('varset',this[_0x3c05('0x25')][_0x3c05('0x1f')](this));ami['on'](_0x3c05('0x26'),this[_0x3c05('0x27')][_0x3c05('0x1f')](this));ami['on'](_0x3c05('0x28'),this[_0x3c05('0x29')]['bind'](this));ami['on'](_0x3c05('0x2a'),this['syncAttendedTransfer'][_0x3c05('0x1f')](this));ami['on'](_0x3c05('0x2b'),this[_0x3c05('0x2c')]['bind'](this));ami['on'](_0x3c05('0x2d'),this[_0x3c05('0x2e')][_0x3c05('0x1f')](this));ami['on'](_0x3c05('0x2f'),this[_0x3c05('0x30')][_0x3c05('0x1f')](this));try{logger[_0x3c05('0x31')](_0x3c05('0x32'));ami['actionCoreShowChannels']();}catch(_0x2deab7){logger[_0x3c05('0x33')](_0x3c05('0x34'),util[_0x3c05('0x35')](_0x2deab7,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x3c05('0x36')][_0x3c05('0x37')]=function(_0x3f562a){return _0x3f562a!==null&&!_[_0x3c05('0x38')](_0x3f562a);};VoiceCallReport[_0x3c05('0x36')][_0x3c05('0x39')]=function(_0x39381e,_0x7965c3,_0x3bd1dc){io['to'](_0x39381e)[_0x3c05('0x39')](_0x7965c3,_0x3bd1dc);};VoiceCallReport[_0x3c05('0x36')][_0x3c05('0x29')]=function(_0x170d5f){try{if(this[_0x3c05('0x37')](_0x170d5f)){logger[_0x3c05('0x31')]('[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s',_0x170d5f['uniqueid'],_0x170d5f[_0x3c05('0x3a')],_0x170d5f['calleridnum']);logger[_0x3c05('0x3b')](_0x3c05('0x3c'),_0x170d5f[_0x3c05('0x3d')],util['inspect'](_0x170d5f,{'showHidden':![],'depth':null}));if(_0x170d5f['uniqueid']===_0x170d5f[_0x3c05('0x3e')]){if(!_[_0x3c05('0x38')](this[_0x3c05('0x1c')][_0x170d5f['uniqueid']])){_[_0x3c05('0x3f')](this['channels'][_0x170d5f[_0x3c05('0x3d')]],_['pick'](_0x170d5f,_[_0x3c05('0x40')](this[_0x3c05('0x1c')][_0x170d5f['uniqueid']])));}}if(_0x170d5f[_0x3c05('0x41')]==='from-sip'){if(this[_0x3c05('0x1d')][_0x170d5f[_0x3c05('0x42')]['split']('-')[0x0]]){if(_0x170d5f[_0x3c05('0x43')]=='xcally-motion-preview'){this[_0x3c05('0x1d')][_0x170d5f[_0x3c05('0x42')][_0x3c05('0x44')]('-')[0x0]][_0x3c05('0x45')]=_0x170d5f['connectedlinenum'];this[_0x3c05('0x39')](util[_0x3c05('0x46')](_0x3c05('0x47'),this['agents'][_0x170d5f[_0x3c05('0x42')][_0x3c05('0x44')]('-')[0x0]][_0x3c05('0x48')]),_0x3c05('0x49'),{'destaccountcode':this[_0x3c05('0x1d')][_0x170d5f['channel'][_0x3c05('0x44')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x170d5f[_0x3c05('0x4a')]});}}}}}catch(_0x1f02e0){logger['error'](_0x3c05('0x4b'),_0x170d5f[_0x3c05('0x3d')],util[_0x3c05('0x35')](_0x1f02e0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3c05('0x36')][_0x3c05('0x23')]=function(_0x545cda){try{if(this[_0x3c05('0x37')](_0x545cda)){logger['debug'](_0x3c05('0x4c'),_0x545cda['uniqueid'],util[_0x3c05('0x35')](_0x545cda,{'showHidden':![],'depth':null}));if(_0x545cda[_0x3c05('0x3d')]===_0x545cda['linkedid']&&_0x545cda['channel']!=_0x3c05('0x4d')){if(_[_0x3c05('0x38')](this['channels'][_0x545cda[_0x3c05('0x3d')]])){logger[_0x3c05('0x31')](_0x3c05('0x4e'),_0x545cda[_0x3c05('0x3d')],_0x545cda[_0x3c05('0x41')],_0x545cda[_0x3c05('0x43')]);this['channels'][_0x545cda[_0x3c05('0x3d')]]=new Channel();this[_0x3c05('0x1c')][_0x545cda[_0x3c05('0x3d')]][_0x3c05('0x4f')]=moment()[_0x3c05('0x46')](_0x3c05('0x50'));this[_0x3c05('0x1c')][_0x545cda[_0x3c05('0x3d')]][_0x3c05('0x51')]=dispositions[_['toNumber'](_0x545cda['channelstate'])];_[_0x3c05('0x3f')](this[_0x3c05('0x1c')][_0x545cda[_0x3c05('0x3d')]],_[_0x3c05('0x52')](_0x545cda,_['keys'](this[_0x3c05('0x1c')][_0x545cda['uniqueid']])));if(_0x545cda[_0x3c05('0x41')]===_0x3c05('0x53')){if(this['agents'][_0x545cda[_0x3c05('0x42')][_0x3c05('0x44')]('-')[0x0]]){if(_['isUndefined'](this[_0x3c05('0x1d')][_0x545cda['channel'][_0x3c05('0x44')]('-')[0x0]][_0x3c05('0x45')])){this[_0x3c05('0x1d')][_0x545cda[_0x3c05('0x42')][_0x3c05('0x44')]('-')[0x0]][_0x3c05('0x45')]=_0x545cda[_0x3c05('0x43')];logger[_0x3c05('0x3b')](_0x3c05('0x54'),_0x545cda[_0x3c05('0x3d')],util['inspect']({'destaccountcode':this[_0x3c05('0x1d')][_0x545cda[_0x3c05('0x42')][_0x3c05('0x44')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x545cda['exten']},{'showHidden':![],'depth':null}));this['emit'](util[_0x3c05('0x46')]('user:%s',this['agents'][_0x545cda[_0x3c05('0x42')]['split']('-')[0x0]][_0x3c05('0x48')]),_0x3c05('0x49'),{'destaccountcode':this[_0x3c05('0x1d')][_0x545cda['channel'][_0x3c05('0x44')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x545cda[_0x3c05('0x43')]});}}}}}}}catch(_0x193927){logger[_0x3c05('0x33')](_0x3c05('0x55'),_0x545cda['uniqueid'],util[_0x3c05('0x35')](_0x193927,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3c05('0x36')]['syncNewExten']=function(_0x2d1e2e){try{if(this[_0x3c05('0x37')](_0x2d1e2e)){logger[_0x3c05('0x3b')](_0x3c05('0x56'),_0x2d1e2e[_0x3c05('0x3d')],util[_0x3c05('0x35')](_0x2d1e2e,{'showHidden':![],'depth':null}));if(_0x2d1e2e['uniqueid']===_0x2d1e2e[_0x3c05('0x3e')]&&_0x2d1e2e[_0x3c05('0x43')]!='h'&&_0x2d1e2e[_0x3c05('0x42')]!=_0x3c05('0x4d')){_0x2d1e2e['application']=_0x2d1e2e[_0x3c05('0x57')][_0x3c05('0x58')]();_0x2d1e2e[_0x3c05('0x59')]=_0x2d1e2e[_0x3c05('0x5a')]&&_0x2d1e2e[_0x3c05('0x5a')]['startsWith'](_0x3c05('0x5b'))?_0x2d1e2e[_0x3c05('0x5a')]:(_0x2d1e2e[_0x3c05('0x5a')]||_0x2d1e2e['applicationdata'])[_0x3c05('0x58')]();logger[_0x3c05('0x31')](_0x3c05('0x5c'),_0x2d1e2e['uniqueid'],_0x2d1e2e[_0x3c05('0x57')],_0x2d1e2e['applicationdata']);if(_[_0x3c05('0x38')](this[_0x3c05('0x1c')][_0x2d1e2e[_0x3c05('0x3d')]])){this[_0x3c05('0x1c')][_0x2d1e2e[_0x3c05('0x3d')]]=new Channel();this[_0x3c05('0x1c')][_0x2d1e2e['uniqueid']][_0x3c05('0x4f')]=_0x2d1e2e['duration']?moment()[_0x3c05('0x5d')](moment[_0x3c05('0x5e')](_0x2d1e2e[_0x3c05('0x5e')])[_0x3c05('0x5f')](),_0x3c05('0x5f'))[_0x3c05('0x46')](_0x3c05('0x50')):moment()[_0x3c05('0x46')](_0x3c05('0x50'));this[_0x3c05('0x1c')][_0x2d1e2e[_0x3c05('0x3d')]][_0x3c05('0x51')]=_0x3c05('0x15');}_[_0x3c05('0x3f')](this[_0x3c05('0x1c')][_0x2d1e2e[_0x3c05('0x3d')]],_[_0x3c05('0x52')](_0x2d1e2e,_[_0x3c05('0x40')](this[_0x3c05('0x1c')][_0x2d1e2e[_0x3c05('0x3d')]])));if(_[_0x3c05('0x60')](applications,_0x2d1e2e[_0x3c05('0x57')])){this[_0x3c05('0x1c')][_0x2d1e2e['uniqueid']][_0x3c05('0x61')]=_0x2d1e2e[_0x3c05('0x57')];this['channels'][_0x2d1e2e['uniqueid']][_0x3c05('0x62')]=_0x2d1e2e[_0x3c05('0x59')];if(_0x2d1e2e[_0x3c05('0x57')]===_0x3c05('0x10')&&_['startsWith'](_0x2d1e2e[_0x3c05('0x59')][_0x3c05('0x58')](),_0x3c05('0x63'))){var _0xf08ec3=_0x2d1e2e[_0x3c05('0x59')][_0x3c05('0x44')]('=');var _0x3ebaaa=_0xf08ec3[0x0][_0x3c05('0x58')]()[_0x3c05('0x64')](/cdr\((.*)\)/);if(_0x3ebaaa){this['channels'][_0x2d1e2e['uniqueid']][_0x3ebaaa[0x1]]=_0xf08ec3[0x1];}}else if(_0x2d1e2e['application']===_0x3c05('0x11')){this[_0x3c05('0x1c')][_0x2d1e2e[_0x3c05('0x3d')]][_0x3c05('0x11')]=_0x2d1e2e[_0x3c05('0x59')][_0x3c05('0x44')](',')[0x0];}}}}}catch(_0x374743){logger[_0x3c05('0x33')](_0x3c05('0x65'),_0x2d1e2e[_0x3c05('0x3d')],util[_0x3c05('0x35')](_0x374743,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x3c05('0x66')]=function(_0x22635d){try{if(this[_0x3c05('0x37')](_0x22635d)){logger[_0x3c05('0x31')](_0x3c05('0x67'),_0x22635d[_0x3c05('0x3d')],_0x22635d[_0x3c05('0x3e')],_0x22635d['calleridname'],_0x22635d['calleridnum']);logger[_0x3c05('0x3b')](_0x3c05('0x68'),_0x22635d[_0x3c05('0x3d')],util['inspect'](_0x22635d,{'showHidden':![],'depth':null}));if(_0x22635d[_0x3c05('0x3d')]!==_0x22635d[_0x3c05('0x3e')]){if(this[_0x3c05('0x1c')][_0x22635d['linkedid']]){if(_0x22635d[_0x3c05('0x69')]==='6'){if(!this['channels'][_0x22635d[_0x3c05('0x3e')]][_0x3c05('0x6a')]){var _0x28a93e=moment();this[_0x3c05('0x1c')][_0x22635d['linkedid']]['answered']=!![];this[_0x3c05('0x1c')][_0x22635d[_0x3c05('0x3e')]]['answertime']=_0x28a93e[_0x3c05('0x46')](_0x3c05('0x50'));if(this[_0x3c05('0x1c')][_0x22635d[_0x3c05('0x3e')]][_0x3c05('0x4f')]){this['channels'][_0x22635d['linkedid']][_0x3c05('0x6b')]=_0x28a93e['diff'](this['channels'][_0x22635d[_0x3c05('0x3e')]]['starttime'],'seconds');}}this[_0x3c05('0x1c')][_0x22635d[_0x3c05('0x3e')]][_0x3c05('0x3e')]=_0x22635d[_0x3c05('0x3d')];if(_0x22635d[_0x3c05('0x6c')]!==_0x3c05('0x6d')){this[_0x3c05('0x1c')][_0x22635d[_0x3c05('0x3e')]][_0x3c05('0x4a')]=_0x22635d[_0x3c05('0x6c')];}this['channels'][_0x22635d['linkedid']][_0x3c05('0x6e')]=_0x22635d[_0x3c05('0x3a')];this['channels'][_0x22635d[_0x3c05('0x3e')]][_0x3c05('0x6f')]=_0x22635d[_0x3c05('0x42')];this[_0x3c05('0x1c')][_0x22635d[_0x3c05('0x3e')]][_0x3c05('0x51')]=dispositions[_['toNumber'](_0x22635d[_0x3c05('0x69')])];if(this[_0x3c05('0x1d')][_0x22635d[_0x3c05('0x42')][_0x3c05('0x44')]('-')[0x0]]){this[_0x3c05('0x1c')][_0x22635d[_0x3c05('0x3e')]]['UserId']=this[_0x3c05('0x1d')][_0x22635d['channel'][_0x3c05('0x44')]('-')[0x0]]['id'];this[_0x3c05('0x1c')][_0x22635d['linkedid']]['membername']=this['agents'][_0x22635d[_0x3c05('0x42')][_0x3c05('0x44')]('-')[0x0]][_0x3c05('0x48')];}}}}else{if(this[_0x3c05('0x1c')][_0x22635d['uniqueid']]){if(_0x22635d[_0x3c05('0x69')]==='6'){if(this[_0x3c05('0x1d')][_0x22635d[_0x3c05('0x42')][_0x3c05('0x44')]('-')[0x0]]){this[_0x3c05('0x1c')][_0x22635d[_0x3c05('0x3d')]]['UserId']=this['agents'][_0x22635d[_0x3c05('0x42')][_0x3c05('0x44')]('-')[0x0]]['id'];this['channels'][_0x22635d[_0x3c05('0x3d')]][_0x3c05('0x70')]=this[_0x3c05('0x1d')][_0x22635d['channel'][_0x3c05('0x44')]('-')[0x0]][_0x3c05('0x48')];}}}}if(_0x22635d[_0x3c05('0x69')]==='6'&&_0x22635d[_0x3c05('0x41')]===_0x3c05('0x53')){if(this[_0x3c05('0x1d')][_0x22635d[_0x3c05('0x42')][_0x3c05('0x44')]('-')[0x0]]){this[_0x3c05('0x1d')][_0x22635d[_0x3c05('0x42')][_0x3c05('0x44')]('-')[0x0]][_0x3c05('0x45')]=_0x22635d[_0x3c05('0x43')];var _0xbc812b;if(this[_0x3c05('0x1c')][_0x22635d[_0x3c05('0x3d')]])_0xbc812b=this['channels'][_0x22635d[_0x3c05('0x3d')]][_0x3c05('0x71')];else if(this['channels'][_0x22635d['linkedid']])_0xbc812b=this['channels'][_0x22635d['linkedid']][_0x3c05('0x71')];logger[_0x3c05('0x3b')](_0x3c05('0x72'),_0x22635d[_0x3c05('0x3d')],util[_0x3c05('0x35')]({'destaccountcode':this[_0x3c05('0x1d')][_0x22635d[_0x3c05('0x42')][_0x3c05('0x44')]('-')[0x0]][_0x3c05('0x73')],'destconnectedlinenum':_0x22635d['exten'],'routealias':_0xbc812b},{'showHidden':![],'depth':null}));this[_0x3c05('0x39')](util[_0x3c05('0x46')](_0x3c05('0x47'),this[_0x3c05('0x1d')][_0x22635d[_0x3c05('0x42')][_0x3c05('0x44')]('-')[0x0]]['name']),_0x3c05('0x49'),{'destaccountcode':this[_0x3c05('0x1d')][_0x22635d[_0x3c05('0x42')][_0x3c05('0x44')]('-')[0x0]][_0x3c05('0x73')],'destconnectedlinenum':_0x22635d['exten'],'routealias':_0xbc812b});}}}}catch(_0x50b979){logger[_0x3c05('0x33')]('[%s][voiceCallReport][newstate]',_0x22635d[_0x3c05('0x3d')],util['inspect'](_0x50b979,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3c05('0x36')][_0x3c05('0x74')]=function(_0x5f4623,_0x567507){try{if(this[_0x3c05('0x1c')][_0x5f4623]){logger[_0x3c05('0x31')]('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0x5f4623,_0x567507);this[_0x3c05('0x1c')][_0x5f4623][_0x3c05('0x75')]=!![];if(_[_0x3c05('0x76')](_0x567507,'.wav49')){_0x567507=_0x567507[_0x3c05('0x77')](_0x3c05('0x78'),_0x3c05('0x79'));}this[_0x3c05('0x1c')][_0x5f4623][_0x3c05('0x7a')]=_0x567507;var _0x41729a=_['find'](this[_0x3c05('0x1c')][_0x5f4623][_0x3c05('0x7b')],{'filename':_0x567507});if(_['isNil'](_0x41729a)){this[_0x3c05('0x1c')][_0x5f4623][_0x3c05('0x7b')][_0x3c05('0x7c')]({'filename':_0x567507,'createdAt':moment()[_0x3c05('0x46')](_0x3c05('0x50')),'mixmonitorid':'','status':_0x3c05('0x7d')});}}}catch(_0x5d34ee){logger[_0x3c05('0x33')]('[%s][voiceCallReport][mixMonitorFilename]',_0x5f4623,util[_0x3c05('0x35')](_0x5d34ee,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3c05('0x36')][_0x3c05('0x25')]=function(_0x4ff6bc){try{if(this[_0x3c05('0x37')](_0x4ff6bc)){logger[_0x3c05('0x3b')](_0x3c05('0x7e'),_0x4ff6bc[_0x3c05('0x3d')],util[_0x3c05('0x35')](_0x4ff6bc,{'showHidden':![],'depth':null}));if(this[_0x3c05('0x1c')][_0x4ff6bc['uniqueid']]&&_0x4ff6bc[_0x3c05('0x42')]!=_0x3c05('0x4d')){if(this[_0x3c05('0x37')](_0x4ff6bc['variable'])){if(this[_0x3c05('0x37')](_0x4ff6bc[_0x3c05('0x7f')][_0x3c05('0x80')])){logger['info'](_0x3c05('0x81'),_0x4ff6bc[_0x3c05('0x3d')],_0x4ff6bc[_0x3c05('0x82')]);this[_0x3c05('0x74')](_0x4ff6bc[_0x3c05('0x3d')],_0x4ff6bc['value']);}else if(this['isNotNull'](_0x4ff6bc[_0x3c05('0x7f')][_0x3c05('0x83')])){logger[_0x3c05('0x31')](_0x3c05('0x84'),_0x4ff6bc[_0x3c05('0x3d')],_0x4ff6bc['value']);this[_0x3c05('0x1c')][_0x4ff6bc[_0x3c05('0x3d')]][_0x3c05('0x6c')]=_0x4ff6bc[_0x3c05('0x82')];}else if(this[_0x3c05('0x37')](_0x4ff6bc[_0x3c05('0x7f')][_0x3c05('0x85')])){logger[_0x3c05('0x31')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x4ff6bc[_0x3c05('0x3d')],_0x4ff6bc[_0x3c05('0x82')]);this[_0x3c05('0x1c')][_0x4ff6bc[_0x3c05('0x3d')]][_0x3c05('0x86')]=_0x4ff6bc[_0x3c05('0x82')];}else if(this[_0x3c05('0x37')](_0x4ff6bc[_0x3c05('0x7f')][_0x3c05('0x87')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x4ff6bc[_0x3c05('0x3d')],_0x4ff6bc[_0x3c05('0x82')]);this['channels'][_0x4ff6bc['uniqueid']]['type']=_0x4ff6bc[_0x3c05('0x82')];}else if(this[_0x3c05('0x37')](_0x4ff6bc[_0x3c05('0x7f')][_0x3c05('0x88')])){logger[_0x3c05('0x31')]('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x4ff6bc[_0x3c05('0x3d')],_0x4ff6bc[_0x3c05('0x82')][_0x3c05('0x44')](',')[0x0]);this[_0x3c05('0x1c')][_0x4ff6bc[_0x3c05('0x3d')]][_0x3c05('0x11')]=_0x4ff6bc['value'][_0x3c05('0x44')](',')[0x0];}else if(this[_0x3c05('0x37')](_0x4ff6bc['variable']['xmd-originatecalleridnum'])){logger['info'](_0x3c05('0x89'),_0x4ff6bc[_0x3c05('0x3d')],_0x4ff6bc['value']);this['channels'][_0x4ff6bc[_0x3c05('0x3d')]][_0x3c05('0x8a')]=_0x4ff6bc[_0x3c05('0x82')];}else if(this[_0x3c05('0x37')](_0x4ff6bc['variable'][_0x3c05('0x8b')])){logger[_0x3c05('0x31')](_0x3c05('0x8c'),_0x4ff6bc[_0x3c05('0x3d')],_0x4ff6bc[_0x3c05('0x82')]);this[_0x3c05('0x1c')][_0x4ff6bc[_0x3c05('0x3d')]][_0x3c05('0x8d')]=_0x4ff6bc[_0x3c05('0x82')];}else if(this[_0x3c05('0x37')](_0x4ff6bc[_0x3c05('0x7f')]['xmd-callerid-preview'])){logger[_0x3c05('0x31')](_0x3c05('0x8e'),_0x4ff6bc[_0x3c05('0x3d')],_0x4ff6bc[_0x3c05('0x82')]);this['channels'][_0x4ff6bc[_0x3c05('0x3d')]][_0x3c05('0x8f')]=_0x4ff6bc[_0x3c05('0x82')];}else if(this[_0x3c05('0x37')](_0x4ff6bc['variable']['xmcs-queue'])){logger['info'](_0x3c05('0x90'),_0x4ff6bc['uniqueid'],_0x4ff6bc['value']);this[_0x3c05('0x1c')][_0x4ff6bc[_0x3c05('0x3d')]][_0x3c05('0x11')]=_0x4ff6bc[_0x3c05('0x82')];}else if(this[_0x3c05('0x37')](_0x4ff6bc[_0x3c05('0x7f')]['sipcallid'])){logger[_0x3c05('0x31')](_0x3c05('0x91'),_0x4ff6bc['uniqueid'],_0x4ff6bc['value']);this['channels'][_0x4ff6bc[_0x3c05('0x3d')]]['sipcalluniqueid']=_0x4ff6bc[_0x3c05('0x82')];}}}else if(this[_0x3c05('0x37')](_0x4ff6bc[_0x3c05('0x7f')][_0x3c05('0x80')])){if(_0x4ff6bc[_0x3c05('0x82')]){var _0x1c9bc2=path[_0x3c05('0x92')](_0x4ff6bc['value'])[_0x3c05('0x48')];logger[_0x3c05('0x31')](_0x3c05('0x81'),_0x1c9bc2,_0x4ff6bc[_0x3c05('0x82')]);this[_0x3c05('0x74')](_0x1c9bc2,_0x4ff6bc[_0x3c05('0x82')]);}}else if(this[_0x3c05('0x1c')][_0x4ff6bc[_0x3c05('0x3e')]]){if(this[_0x3c05('0x37')](_0x4ff6bc['variable'])){if(this[_0x3c05('0x37')](_0x4ff6bc['variable'][_0x3c05('0x93')])){logger[_0x3c05('0x31')](_0x3c05('0x91'),_0x4ff6bc['linkedid'],_0x4ff6bc[_0x3c05('0x82')]);this['channels'][_0x4ff6bc['linkedid']][_0x3c05('0x94')]=_0x4ff6bc['value'];}}}}}catch(_0x310be7){logger[_0x3c05('0x33')](_0x3c05('0x95'),_0x4ff6bc[_0x3c05('0x3d')],util[_0x3c05('0x35')](_0x310be7,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3c05('0x36')]['syncHangup']=function(_0x24b4f3){try{if(this[_0x3c05('0x37')](_0x24b4f3)){logger[_0x3c05('0x3b')]('[%s][voiceCallReport][hangup]\x20event:',_0x24b4f3[_0x3c05('0x3d')],util[_0x3c05('0x35')](_0x24b4f3,{'showHidden':![],'depth':null}));if(this[_0x3c05('0x1c')][_0x24b4f3[_0x3c05('0x3d')]]){logger[_0x3c05('0x31')](_0x3c05('0x96'),_0x24b4f3['uniqueid'],_0x24b4f3['cause-txt']);var _0x1094cd=moment();this[_0x3c05('0x1c')][_0x24b4f3[_0x3c05('0x3d')]][_0x3c05('0x97')]=_0x1094cd['format'](_0x3c05('0x50'));this['channels'][_0x24b4f3[_0x3c05('0x3d')]][_0x3c05('0x5e')]=_0x1094cd[_0x3c05('0x98')](this[_0x3c05('0x1c')][_0x24b4f3[_0x3c05('0x3d')]][_0x3c05('0x4f')],_0x3c05('0x5f'));if(this['channels'][_0x24b4f3[_0x3c05('0x3d')]][_0x3c05('0x6a')]){this[_0x3c05('0x1c')][_0x24b4f3[_0x3c05('0x3d')]]['billableseconds']=_0x1094cd[_0x3c05('0x98')](this[_0x3c05('0x1c')][_0x24b4f3[_0x3c05('0x3d')]][_0x3c05('0x99')],_0x3c05('0x5f'));this['channels'][_0x24b4f3[_0x3c05('0x3d')]][_0x3c05('0x6b')]=this[_0x3c05('0x1c')][_0x24b4f3[_0x3c05('0x3d')]][_0x3c05('0x5e')]-this[_0x3c05('0x1c')][_0x24b4f3['uniqueid']][_0x3c05('0x9a')];}if(_0x24b4f3[_0x3c05('0x41')]===_0x3c05('0x53')){if(this[_0x3c05('0x1d')][_0x24b4f3['channel'][_0x3c05('0x44')]('-')[0x0]]){this[_0x3c05('0x1d')][_0x24b4f3[_0x3c05('0x42')]['split']('-')[0x0]]=_[_0x3c05('0x9b')](this[_0x3c05('0x1d')][_0x24b4f3['channel'][_0x3c05('0x44')]('-')[0x0]],[_0x3c05('0x45')]);logger[_0x3c05('0x3b')](_0x3c05('0x9c'),_0x24b4f3[_0x3c05('0x3d')],util['inspect']({'id':this[_0x3c05('0x1d')][_0x24b4f3['channel'][_0x3c05('0x44')]('-')[0x0]]['id'],'destaccountcode':this[_0x3c05('0x1d')][_0x24b4f3[_0x3c05('0x42')]['split']('-')[0x0]][_0x3c05('0x73')]},{'showHidden':![],'depth':null}));this[_0x3c05('0x39')](util['format']('user:%s',this[_0x3c05('0x1d')][_0x24b4f3[_0x3c05('0x42')]['split']('-')[0x0]][_0x3c05('0x48')]),_0x3c05('0x9d'),{'id':this['agents'][_0x24b4f3[_0x3c05('0x42')][_0x3c05('0x44')]('-')[0x0]]['id'],'destaccountcode':this[_0x3c05('0x1d')][_0x24b4f3[_0x3c05('0x42')][_0x3c05('0x44')]('-')[0x0]][_0x3c05('0x73')]});}}var _0x308be5=this;Promise[_0x3c05('0x9e')]()[_0x3c05('0x9f')](function(){var _0x36f056=_0x308be5[_0x3c05('0x1c')][_0x24b4f3[_0x3c05('0x3d')]];if(typeof _0x36f056['transferType']===_0x3c05('0xa0'))return;if(_[_0x3c05('0xa1')](_0x36f056['monitors']))return;return RpcSetting[_0x3c05('0xa2')]()['then'](function(_0x55e0b9){if(!_0x55e0b9[_0x3c05('0xa3')])return;return Promise['resolve']()[_0x3c05('0x9f')](function(){return ami[_0x3c05('0xa4')]({'action':_0x3c05('0xa5'),'channel':_0x36f056[_0x3c05('0x42')]})[_0x3c05('0xa6')](function(){});})[_0x3c05('0x9f')](function(){return ami[_0x3c05('0xa4')]({'action':'StopMixMonitor','channel':_0x36f056[_0x3c05('0x6f')]})[_0x3c05('0xa6')](function(){})['finally'](function(){var _0x143e10=_0x308be5[_0x3c05('0x1d')][_0x36f056['destinationchannel'][_0x3c05('0x44')]('-')[0x0]];if(!_0x143e10)return;io[_0x3c05('0x39')]('webbar:stopmonitors',{'agentId':_0x143e10['id'],'uniqueid':_0x36f056[_0x3c05('0x3d')]});});});});})['then'](function(){if(_0x24b4f3[_0x3c05('0xa7')]==='BlindTransfer'){_0x308be5[_0x3c05('0xa8')][_0x24b4f3[_0x3c05('0x3d')]]=_0x308be5[_0x3c05('0x1c')][_0x24b4f3[_0x3c05('0x3d')]];}else{if(_0x308be5['channels'][_0x24b4f3[_0x3c05('0x3d')]][_0x3c05('0xa9')]===_0x3c05('0xaa')&&_0x308be5[_0x3c05('0xa8')][_0x24b4f3[_0x3c05('0x3d')]]){_0x308be5[_0x3c05('0x1c')][_0x24b4f3[_0x3c05('0x3d')]][_0x3c05('0x3d')]=[_0x308be5[_0x3c05('0x1c')][_0x24b4f3[_0x3c05('0x3d')]]['linkedid'],_0x308be5['channels'][_0x24b4f3[_0x3c05('0x3d')]][_0x3c05('0x3e')]=_0x308be5['channels'][_0x24b4f3[_0x3c05('0x3d')]][_0x3c05('0x3d')]][0x0];delete _0x308be5[_0x3c05('0xa8')][_0x24b4f3['uniqueid']];}}logger[_0x3c05('0x3b')](_0x3c05('0xab'),_0x24b4f3[_0x3c05('0x3d')],util[_0x3c05('0x35')](_0x308be5[_0x3c05('0x1c')][_0x24b4f3[_0x3c05('0x3d')]],{'showHidden':![],'depth':null}));ami[_0x3c05('0x39')]('custom:voiceCallReport',_0x308be5[_0x3c05('0x1c')][_0x24b4f3[_0x3c05('0x3d')]]);delete _0x308be5[_0x3c05('0x1c')][_0x24b4f3['uniqueid']];});}}}catch(_0x20eb19){logger['error'](_0x3c05('0xac'),_0x24b4f3[_0x3c05('0x3d')],util[_0x3c05('0x35')](_0x20eb19,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3c05('0x36')][_0x3c05('0xad')]=function(_0x151743){try{if(this[_0x3c05('0x37')](_0x151743)){logger[_0x3c05('0x31')](_0x3c05('0xae'),_0x151743[_0x3c05('0x3d')],_0x151743[_0x3c05('0xaf')],_0x151743[_0x3c05('0xb0')]);logger[_0x3c05('0x3b')](_0x3c05('0xb1'),_0x151743['uniqueid'],util['inspect'](_0x151743,{'showHidden':![],'depth':null}));if(this[_0x3c05('0x1c')][_0x151743[_0x3c05('0xb2')]]){this[_0x3c05('0x1c')][_0x151743[_0x3c05('0xb2')]][_0x3c05('0xb3')]=_0x151743[_0x3c05('0xaf')];this[_0x3c05('0x1c')][_0x151743[_0x3c05('0xb2')]]['transferconnectedlinenum']=_0x151743[_0x3c05('0xb0')];if(this['channels'][_0x151743[_0x3c05('0xb4')]]){var _0x45595e=this[_0x3c05('0x1c')][_0x151743[_0x3c05('0xb4')]];this[_0x3c05('0x1c')][_0x151743[_0x3c05('0xb4')]]=this[_0x3c05('0x1c')][_0x151743[_0x3c05('0xb2')]];this[_0x3c05('0x1c')][_0x151743[_0x3c05('0xb2')]]=_0x45595e;}}else if(this[_0x3c05('0x1c')][_0x151743[_0x3c05('0xb5')]]){this[_0x3c05('0x1c')][_0x151743[_0x3c05('0xb5')]][_0x3c05('0xb3')]=_0x151743[_0x3c05('0xaf')];this[_0x3c05('0x1c')][_0x151743[_0x3c05('0xb5')]]['transferconnectedlinenum']=_0x151743['transfertargetcalleridnum'];if(this[_0x3c05('0x1c')][_0x151743[_0x3c05('0xb6')]]){var _0x45595e=this[_0x3c05('0x1c')][_0x151743[_0x3c05('0xb6')]];this[_0x3c05('0x1c')][_0x151743['origtransfereruniqueid']]=this[_0x3c05('0x1c')][_0x151743[_0x3c05('0xb5')]];this[_0x3c05('0x1c')][_0x151743[_0x3c05('0xb5')]]=_0x45595e;}}if((this[_0x3c05('0x1c')][_0x151743[_0x3c05('0xb6')]]||this['channels'][_0x151743[_0x3c05('0xb7')]])&&this['channels'][_0x151743['secondtransfereruniqueid']]){var _0x5bdf49=_[_0x3c05('0xb8')]([this[_0x3c05('0x1c')][_0x151743[_0x3c05('0xb6')]],this[_0x3c05('0x1c')][_0x151743[_0x3c05('0xb7')]],this[_0x3c05('0x1c')][_0x151743[_0x3c05('0xb4')]]],function(_0x4a81b5){return _0x4a81b5&&_0x4a81b5['type']==='outbound'&&_0x4a81b5['routeid'];});if(_0x5bdf49){if(this[_0x3c05('0x1c')][_0x151743[_0x3c05('0xb6')]])this['channels'][_0x151743[_0x3c05('0xb6')]]['transferType']=_0x3c05('0xb9');if(this[_0x3c05('0x1c')][_0x151743[_0x3c05('0xb7')]])this['channels'][_0x151743['origtransfererlinkedid']][_0x3c05('0xba')]=_0x3c05('0xb9');this['channels'][_0x151743[_0x3c05('0xb4')]]['transferType']=_0x3c05('0xb9');}}}}catch(_0x524ab7){logger[_0x3c05('0x33')](_0x3c05('0xbb'),_0x151743['uniqueid'],util[_0x3c05('0x35')](_0x524ab7,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3c05('0x36')][_0x3c05('0x2c')]=function(_0x2a8cdf){try{if(this[_0x3c05('0x37')](_0x2a8cdf)){logger[_0x3c05('0x31')](_0x3c05('0xbc'),_0x2a8cdf[_0x3c05('0x3d')],_0x2a8cdf[_0x3c05('0xbd')],_0x2a8cdf[_0x3c05('0xbe')]);logger[_0x3c05('0x3b')](_0x3c05('0xbf'),_0x2a8cdf['uniqueid'],util['inspect'](_0x2a8cdf,{'showHidden':![],'depth':null}));if(this[_0x3c05('0x1c')][_0x2a8cdf['transfereeuniqueid']]){this['channels'][_0x2a8cdf[_0x3c05('0xb2')]][_0x3c05('0xb3')]=_0x2a8cdf[_0x3c05('0xbd')];this[_0x3c05('0x1c')][_0x2a8cdf['transfereeuniqueid']]['transferconnectedlinenum']=_0x2a8cdf[_0x3c05('0xbe')];this['channels'][_0x2a8cdf['transfereeuniqueid']][_0x3c05('0xba')]=_0x3c05('0xc0');this[_0x3c05('0x27')]({'event':_0x3c05('0xc1'),'uniqueid':_0x2a8cdf['transfereeuniqueid'],'context':_0x2a8cdf[_0x3c05('0x41')],'channel':_0x2a8cdf[_0x3c05('0xc2')]});}else{this['channels'][_0x2a8cdf['transfereruniqueid']][_0x3c05('0xba')]=_0x3c05('0xc0');}}}catch(_0x3b1f0f){logger[_0x3c05('0x33')](_0x3c05('0xc3'),_0x2a8cdf[_0x3c05('0x3d')],util[_0x3c05('0x35')](_0x3b1f0f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3c05('0x36')]['syncMusicOnHoldStart']=function(_0x570196){try{if(this['isNotNull'](_0x570196)){logger['debug'](_0x3c05('0xc4'),_0x570196[_0x3c05('0x3d')],util['inspect'](_0x570196,{'showHidden':![],'depth':null}));if(this[_0x3c05('0x1c')][_0x570196[_0x3c05('0x3d')]]){if(!_[_0x3c05('0xc5')](this[_0x3c05('0x1c')][_0x570196['uniqueid']][_0x3c05('0x99')])){this[_0x3c05('0x1c')][_0x570196[_0x3c05('0x3d')]][_0x3c05('0xc6')]=moment()[_0x3c05('0x46')](_0x3c05('0x50'));logger['info'](_0x3c05('0xc7'),_0x570196[_0x3c05('0x3d')],this[_0x3c05('0x1c')][_0x570196[_0x3c05('0x3d')]][_0x3c05('0xc6')]);}}}}catch(_0x2d94a5){logger['error'](_0x3c05('0xc8'),_0x570196['uniqueid'],util[_0x3c05('0x35')](_0x2d94a5,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x3c05('0x30')]=function(_0x157d34){try{if(this[_0x3c05('0x37')](_0x157d34)){logger[_0x3c05('0x3b')](_0x3c05('0xc9'),_0x157d34[_0x3c05('0x3d')],util[_0x3c05('0x35')](_0x157d34,{'showHidden':![],'depth':null}));if(this[_0x3c05('0x1c')][_0x157d34['uniqueid']]){if(!_[_0x3c05('0xc5')](this['channels'][_0x157d34[_0x3c05('0x3d')]][_0x3c05('0xc6')])){this[_0x3c05('0x1c')][_0x157d34[_0x3c05('0x3d')]][_0x3c05('0xca')]+=moment()[_0x3c05('0xcb')](0x0)[_0x3c05('0x98')](this[_0x3c05('0x1c')][_0x157d34[_0x3c05('0x3d')]][_0x3c05('0xc6')],_0x3c05('0x5f'));logger[_0x3c05('0x31')](_0x3c05('0xcc'),_0x157d34['uniqueid'],this[_0x3c05('0x1c')][_0x157d34[_0x3c05('0x3d')]][_0x3c05('0xca')]);delete this['channels'][_0x157d34[_0x3c05('0x3d')]][_0x3c05('0xc6')];}}}}catch(_0x66fb8b){logger[_0x3c05('0x33')](_0x3c05('0xcd'),_0x157d34[_0x3c05('0x3d')],util['inspect'](_0x66fb8b,{'showHidden':![],'depth':null}));}};module[_0x3c05('0xce')]=VoiceCallReport; \ No newline at end of file +var _0x277e=['redis','defaults','localhost','channels','agents','blindTransfers','syncNewExten','bind','newexten','newchannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','isUndefined','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','calleridname','calleridnum','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','merge','uniqueid','pick','keys','context','from-sip','channel','split','exten','xcally-motion-preview','connectedlinenum','user:%s','name','user:agentconnect','accountcode','error','[%s][voiceCallReport][newcallerid]','syncNewChannel','starttime','format','YYYY-MM-DD\x20HH:mm:ss','toNumber','channelstate','destconnectedlinenum','[%s][voiceCallReport][newchannel]','debug','[%s][voiceCallReport][newexten]\x20event:','OutgoingSpoolFailed','application','toLowerCase','applicationdata','startsWith','CDR(routeAlias)','appdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','seconds','disposition','includes','lastapplication','lastdata','cdr(','match','[%s][voiceCallReport][newstate]\x20event:','answered','diff','connectedlinename','UserId','membername','routealias','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','monitorFilename','find','push','rec','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','value','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','syncMixMonitorFilename','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','billableseconds','answertime','holdtime','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','resolve','then','transferType','undefined','isEmpty','getSettings','Action','StopMixMonitor','catch','destinationchannel','webbar:stopmonitors','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','some','ATTENDED','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','transfererchannel','transfereruniqueid','[%s][voiceCallReport][blindtransfer]','isNil','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','mohtime','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','moment','path','ioredis','../../../config/environment','../../../config/logger','../model/channel','../rpc/setting','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','set','queue','agi','playback','voicemail','NO\x20ANSWER','FAILED','BUSY'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x277e,0x169));var _0xe277=function(_0x1e92d8,_0x36ac0b){_0x1e92d8=_0x1e92d8-0x0;var _0x5089d1=_0x277e[_0x1e92d8];return _0x5089d1;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var moment=require(_0xe277('0x0'));var util=require('util');var path=require(_0xe277('0x1'));var Redis=require(_0xe277('0x2'));var config=require(_0xe277('0x3'));var logger=require(_0xe277('0x4'))('ami');var ami=require('../ami');var Channel=require(_0xe277('0x5'));var RpcSetting=require(_0xe277('0x6'));var statusDesc=[_0xe277('0x7'),_0xe277('0x8'),_0xe277('0x9'),_0xe277('0xa'),_0xe277('0xb'),_0xe277('0xc'),_0xe277('0xd'),_0xe277('0xe'),'onhold'];var applications=[_0xe277('0xf'),_0xe277('0x10'),_0xe277('0x11'),'dial',_0xe277('0x12'),_0xe277('0x13')];var dispositions=[_0xe277('0x14'),_0xe277('0x15'),_0xe277('0x15'),'NO\x20ANSWER','NO\x20ANSWER',_0xe277('0x14'),'ANSWERED',_0xe277('0x16'),'FAILED',_0xe277('0x15'),_0xe277('0x15')];var actions={};config[_0xe277('0x17')]=_[_0xe277('0x18')](config[_0xe277('0x17')],{'host':_0xe277('0x19'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe277('0x17')]));function VoiceCallReport(_0x226c65){this[_0xe277('0x1a')]=_0x226c65['channels'];this[_0xe277('0x1b')]=_0x226c65['agents'];this[_0xe277('0x1c')]={};ami['on']('coreshowchannel',this[_0xe277('0x1d')][_0xe277('0x1e')](this));ami['on'](_0xe277('0x1f'),this['syncNewExten'][_0xe277('0x1e')](this));ami['on'](_0xe277('0x20'),this['syncNewChannel'][_0xe277('0x1e')](this));ami['on'](_0xe277('0x21'),this[_0xe277('0x22')][_0xe277('0x1e')](this));ami['on'](_0xe277('0x23'),this[_0xe277('0x24')]['bind'](this));ami['on'](_0xe277('0x25'),this[_0xe277('0x26')][_0xe277('0x1e')](this));ami['on'](_0xe277('0x27'),this['syncNewCallerId']['bind'](this));ami['on'](_0xe277('0x28'),this[_0xe277('0x29')][_0xe277('0x1e')](this));ami['on'](_0xe277('0x2a'),this[_0xe277('0x2b')][_0xe277('0x1e')](this));ami['on'](_0xe277('0x2c'),this[_0xe277('0x2d')][_0xe277('0x1e')](this));ami['on']('musiconholdstop',this[_0xe277('0x2e')][_0xe277('0x1e')](this));try{logger[_0xe277('0x2f')](_0xe277('0x30'));ami[_0xe277('0x31')]();}catch(_0x1c9c71){logger['error'](_0xe277('0x32'),util[_0xe277('0x33')](_0x1c9c71,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xe277('0x34')][_0xe277('0x35')]=function(_0x568bc2){return _0x568bc2!==null&&!_[_0xe277('0x36')](_0x568bc2);};VoiceCallReport[_0xe277('0x34')]['emit']=function(_0x4d4a2d,_0x573765,_0x291542){io['to'](_0x4d4a2d)[_0xe277('0x37')](_0x573765,_0x291542);};VoiceCallReport[_0xe277('0x34')]['syncNewCallerId']=function(_0x512293){try{if(this['isNotNull'](_0x512293)){logger[_0xe277('0x2f')](_0xe277('0x38'),_0x512293['uniqueid'],_0x512293[_0xe277('0x39')],_0x512293[_0xe277('0x3a')]);logger['debug'](_0xe277('0x3b'),_0x512293['uniqueid'],util[_0xe277('0x33')](_0x512293,{'showHidden':![],'depth':null}));if(_0x512293['uniqueid']===_0x512293[_0xe277('0x3c')]){if(!_[_0xe277('0x36')](this[_0xe277('0x1a')][_0x512293['uniqueid']])){_[_0xe277('0x3d')](this[_0xe277('0x1a')][_0x512293[_0xe277('0x3e')]],_[_0xe277('0x3f')](_0x512293,_[_0xe277('0x40')](this[_0xe277('0x1a')][_0x512293[_0xe277('0x3e')]])));}}if(_0x512293[_0xe277('0x41')]===_0xe277('0x42')){if(this[_0xe277('0x1b')][_0x512293[_0xe277('0x43')][_0xe277('0x44')]('-')[0x0]]){if(_0x512293[_0xe277('0x45')]==_0xe277('0x46')){this[_0xe277('0x1b')][_0x512293[_0xe277('0x43')][_0xe277('0x44')]('-')[0x0]]['destconnectedlinenum']=_0x512293[_0xe277('0x47')];this[_0xe277('0x37')](util['format'](_0xe277('0x48'),this[_0xe277('0x1b')][_0x512293[_0xe277('0x43')]['split']('-')[0x0]][_0xe277('0x49')]),_0xe277('0x4a'),{'destaccountcode':this['agents'][_0x512293[_0xe277('0x43')][_0xe277('0x44')]('-')[0x0]][_0xe277('0x4b')],'destconnectedlinenum':_0x512293[_0xe277('0x47')]});}}}}}catch(_0x3e658){logger[_0xe277('0x4c')](_0xe277('0x4d'),_0x512293[_0xe277('0x3e')],util[_0xe277('0x33')](_0x3e658,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xe277('0x4e')]=function(_0x277df9){try{if(this['isNotNull'](_0x277df9)){logger['debug']('[%s][voiceCallReport][newchannel]\x20event:',_0x277df9['uniqueid'],util['inspect'](_0x277df9,{'showHidden':![],'depth':null}));if(_0x277df9[_0xe277('0x3e')]===_0x277df9[_0xe277('0x3c')]&&_0x277df9[_0xe277('0x43')]!='OutgoingSpoolFailed'){if(_[_0xe277('0x36')](this[_0xe277('0x1a')][_0x277df9[_0xe277('0x3e')]])){logger[_0xe277('0x2f')]('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x277df9[_0xe277('0x3e')],_0x277df9[_0xe277('0x41')],_0x277df9[_0xe277('0x45')]);this[_0xe277('0x1a')][_0x277df9['uniqueid']]=new Channel();this[_0xe277('0x1a')][_0x277df9[_0xe277('0x3e')]][_0xe277('0x4f')]=moment()[_0xe277('0x50')](_0xe277('0x51'));this['channels'][_0x277df9['uniqueid']]['disposition']=dispositions[_[_0xe277('0x52')](_0x277df9[_0xe277('0x53')])];_[_0xe277('0x3d')](this[_0xe277('0x1a')][_0x277df9[_0xe277('0x3e')]],_[_0xe277('0x3f')](_0x277df9,_['keys'](this['channels'][_0x277df9['uniqueid']])));if(_0x277df9[_0xe277('0x41')]===_0xe277('0x42')){if(this[_0xe277('0x1b')][_0x277df9['channel'][_0xe277('0x44')]('-')[0x0]]){if(_[_0xe277('0x36')](this[_0xe277('0x1b')][_0x277df9[_0xe277('0x43')][_0xe277('0x44')]('-')[0x0]]['destconnectedlinenum'])){this[_0xe277('0x1b')][_0x277df9[_0xe277('0x43')][_0xe277('0x44')]('-')[0x0]][_0xe277('0x54')]=_0x277df9['exten'];logger['debug']('[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:',_0x277df9['uniqueid'],util[_0xe277('0x33')]({'destaccountcode':this[_0xe277('0x1b')][_0x277df9[_0xe277('0x43')][_0xe277('0x44')]('-')[0x0]][_0xe277('0x4b')],'destconnectedlinenum':_0x277df9[_0xe277('0x45')]},{'showHidden':![],'depth':null}));this[_0xe277('0x37')](util[_0xe277('0x50')](_0xe277('0x48'),this[_0xe277('0x1b')][_0x277df9['channel'][_0xe277('0x44')]('-')[0x0]][_0xe277('0x49')]),_0xe277('0x4a'),{'destaccountcode':this[_0xe277('0x1b')][_0x277df9[_0xe277('0x43')][_0xe277('0x44')]('-')[0x0]][_0xe277('0x4b')],'destconnectedlinenum':_0x277df9['exten']});}}}}}}}catch(_0x3c8133){logger[_0xe277('0x4c')](_0xe277('0x55'),_0x277df9[_0xe277('0x3e')],util[_0xe277('0x33')](_0x3c8133,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xe277('0x34')][_0xe277('0x1d')]=function(_0x16b37c){try{if(this[_0xe277('0x35')](_0x16b37c)){logger[_0xe277('0x56')](_0xe277('0x57'),_0x16b37c['uniqueid'],util[_0xe277('0x33')](_0x16b37c,{'showHidden':![],'depth':null}));if(_0x16b37c[_0xe277('0x3e')]===_0x16b37c[_0xe277('0x3c')]&&_0x16b37c[_0xe277('0x45')]!='h'&&_0x16b37c[_0xe277('0x43')]!=_0xe277('0x58')){_0x16b37c[_0xe277('0x59')]=_0x16b37c[_0xe277('0x59')][_0xe277('0x5a')]();_0x16b37c[_0xe277('0x5b')]=_0x16b37c['appdata']&&_0x16b37c['appdata'][_0xe277('0x5c')](_0xe277('0x5d'))?_0x16b37c[_0xe277('0x5e')]:(_0x16b37c['appdata']||_0x16b37c[_0xe277('0x5b')])[_0xe277('0x5a')]();logger[_0xe277('0x2f')](_0xe277('0x5f'),_0x16b37c[_0xe277('0x3e')],_0x16b37c[_0xe277('0x59')],_0x16b37c[_0xe277('0x5b')]);if(_['isUndefined'](this[_0xe277('0x1a')][_0x16b37c[_0xe277('0x3e')]])){this[_0xe277('0x1a')][_0x16b37c[_0xe277('0x3e')]]=new Channel();this[_0xe277('0x1a')][_0x16b37c[_0xe277('0x3e')]][_0xe277('0x4f')]=_0x16b37c[_0xe277('0x60')]?moment()['subtract'](moment[_0xe277('0x60')](_0x16b37c[_0xe277('0x60')])[_0xe277('0x61')](),_0xe277('0x61'))[_0xe277('0x50')](_0xe277('0x51')):moment()[_0xe277('0x50')](_0xe277('0x51'));this[_0xe277('0x1a')][_0x16b37c[_0xe277('0x3e')]][_0xe277('0x62')]=_0xe277('0x14');}_['merge'](this[_0xe277('0x1a')][_0x16b37c[_0xe277('0x3e')]],_['pick'](_0x16b37c,_[_0xe277('0x40')](this['channels'][_0x16b37c[_0xe277('0x3e')]])));if(_[_0xe277('0x63')](applications,_0x16b37c[_0xe277('0x59')])){this[_0xe277('0x1a')][_0x16b37c[_0xe277('0x3e')]][_0xe277('0x64')]=_0x16b37c['application'];this[_0xe277('0x1a')][_0x16b37c[_0xe277('0x3e')]][_0xe277('0x65')]=_0x16b37c[_0xe277('0x5b')];if(_0x16b37c[_0xe277('0x59')]===_0xe277('0xf')&&_[_0xe277('0x5c')](_0x16b37c['applicationdata'][_0xe277('0x5a')](),_0xe277('0x66'))){var _0x445c8d=_0x16b37c[_0xe277('0x5b')][_0xe277('0x44')]('=');var _0x56890a=_0x445c8d[0x0][_0xe277('0x5a')]()[_0xe277('0x67')](/cdr\((.*)\)/);if(_0x56890a){this[_0xe277('0x1a')][_0x16b37c[_0xe277('0x3e')]][_0x56890a[0x1]]=_0x445c8d[0x1];}}else if(_0x16b37c[_0xe277('0x59')]===_0xe277('0x10')){this[_0xe277('0x1a')][_0x16b37c['uniqueid']][_0xe277('0x10')]=_0x16b37c[_0xe277('0x5b')][_0xe277('0x44')](',')[0x0];}}}}}catch(_0x4af8ea){logger[_0xe277('0x4c')]('[%s][voiceCallReport][newexten]',_0x16b37c[_0xe277('0x3e')],util['inspect'](_0x4af8ea,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewState']=function(_0x16a73f){try{if(this['isNotNull'](_0x16a73f)){logger[_0xe277('0x2f')]('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x16a73f[_0xe277('0x3e')],_0x16a73f[_0xe277('0x3c')],_0x16a73f[_0xe277('0x39')],_0x16a73f[_0xe277('0x3a')]);logger[_0xe277('0x56')](_0xe277('0x68'),_0x16a73f[_0xe277('0x3e')],util[_0xe277('0x33')](_0x16a73f,{'showHidden':![],'depth':null}));if(_0x16a73f['uniqueid']!==_0x16a73f[_0xe277('0x3c')]){if(this['channels'][_0x16a73f[_0xe277('0x3c')]]){if(_0x16a73f[_0xe277('0x53')]==='6'){if(!this['channels'][_0x16a73f[_0xe277('0x3c')]][_0xe277('0x69')]){var _0x46fb80=moment();this[_0xe277('0x1a')][_0x16a73f['linkedid']][_0xe277('0x69')]=!![];this[_0xe277('0x1a')][_0x16a73f[_0xe277('0x3c')]]['answertime']=_0x46fb80['format'](_0xe277('0x51'));if(this[_0xe277('0x1a')][_0x16a73f[_0xe277('0x3c')]][_0xe277('0x4f')]){this['channels'][_0x16a73f['linkedid']]['holdtime']=_0x46fb80[_0xe277('0x6a')](this[_0xe277('0x1a')][_0x16a73f[_0xe277('0x3c')]][_0xe277('0x4f')],_0xe277('0x61'));}}this['channels'][_0x16a73f[_0xe277('0x3c')]][_0xe277('0x3c')]=_0x16a73f[_0xe277('0x3e')];if(_0x16a73f[_0xe277('0x3a')]!=='xcally-motion-preview'){this['channels'][_0x16a73f[_0xe277('0x3c')]]['connectedlinenum']=_0x16a73f[_0xe277('0x3a')];}this[_0xe277('0x1a')][_0x16a73f[_0xe277('0x3c')]][_0xe277('0x6b')]=_0x16a73f['calleridname'];this[_0xe277('0x1a')][_0x16a73f[_0xe277('0x3c')]]['destinationchannel']=_0x16a73f['channel'];this[_0xe277('0x1a')][_0x16a73f[_0xe277('0x3c')]]['disposition']=dispositions[_[_0xe277('0x52')](_0x16a73f[_0xe277('0x53')])];if(this['agents'][_0x16a73f[_0xe277('0x43')][_0xe277('0x44')]('-')[0x0]]){this[_0xe277('0x1a')][_0x16a73f[_0xe277('0x3c')]][_0xe277('0x6c')]=this[_0xe277('0x1b')][_0x16a73f[_0xe277('0x43')][_0xe277('0x44')]('-')[0x0]]['id'];this[_0xe277('0x1a')][_0x16a73f['linkedid']][_0xe277('0x6d')]=this[_0xe277('0x1b')][_0x16a73f[_0xe277('0x43')][_0xe277('0x44')]('-')[0x0]][_0xe277('0x49')];}}}}else{if(this[_0xe277('0x1a')][_0x16a73f[_0xe277('0x3e')]]){if(_0x16a73f['channelstate']==='6'){if(this[_0xe277('0x1b')][_0x16a73f['channel'][_0xe277('0x44')]('-')[0x0]]){this[_0xe277('0x1a')][_0x16a73f[_0xe277('0x3e')]][_0xe277('0x6c')]=this['agents'][_0x16a73f[_0xe277('0x43')][_0xe277('0x44')]('-')[0x0]]['id'];this[_0xe277('0x1a')][_0x16a73f[_0xe277('0x3e')]][_0xe277('0x6d')]=this['agents'][_0x16a73f[_0xe277('0x43')][_0xe277('0x44')]('-')[0x0]][_0xe277('0x49')];}}}}if(_0x16a73f[_0xe277('0x53')]==='6'&&_0x16a73f[_0xe277('0x41')]===_0xe277('0x42')){if(this[_0xe277('0x1b')][_0x16a73f[_0xe277('0x43')][_0xe277('0x44')]('-')[0x0]]){this[_0xe277('0x1b')][_0x16a73f['channel'][_0xe277('0x44')]('-')[0x0]]['destconnectedlinenum']=_0x16a73f[_0xe277('0x45')];var _0x5ac68e;if(this[_0xe277('0x1a')][_0x16a73f[_0xe277('0x3e')]])_0x5ac68e=this[_0xe277('0x1a')][_0x16a73f[_0xe277('0x3e')]][_0xe277('0x6e')];else if(this[_0xe277('0x1a')][_0x16a73f[_0xe277('0x3c')]])_0x5ac68e=this['channels'][_0x16a73f['linkedid']][_0xe277('0x6e')];logger[_0xe277('0x56')](_0xe277('0x6f'),_0x16a73f['uniqueid'],util[_0xe277('0x33')]({'destaccountcode':this[_0xe277('0x1b')][_0x16a73f[_0xe277('0x43')][_0xe277('0x44')]('-')[0x0]][_0xe277('0x4b')],'destconnectedlinenum':_0x16a73f[_0xe277('0x45')],'routealias':_0x5ac68e},{'showHidden':![],'depth':null}));this['emit'](util[_0xe277('0x50')](_0xe277('0x48'),this[_0xe277('0x1b')][_0x16a73f[_0xe277('0x43')]['split']('-')[0x0]]['name']),'user:agentconnect',{'destaccountcode':this[_0xe277('0x1b')][_0x16a73f[_0xe277('0x43')][_0xe277('0x44')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x16a73f['exten'],'routealias':_0x5ac68e});}}}}catch(_0x326c50){logger[_0xe277('0x4c')](_0xe277('0x70'),_0x16a73f[_0xe277('0x3e')],util[_0xe277('0x33')](_0x326c50,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xe277('0x34')]['syncMixMonitorFilename']=function(_0x5cf8a4,_0x3f9b10){try{if(this[_0xe277('0x1a')][_0x5cf8a4]){logger[_0xe277('0x2f')](_0xe277('0x71'),_0x5cf8a4,_0x3f9b10);this[_0xe277('0x1a')][_0x5cf8a4][_0xe277('0x72')]=!![];if(_[_0xe277('0x73')](_0x3f9b10,_0xe277('0x74'))){_0x3f9b10=_0x3f9b10['replace'](_0xe277('0x74'),'.WAV');}this[_0xe277('0x1a')][_0x5cf8a4][_0xe277('0x75')]=_0x3f9b10;var _0x857a8b=_[_0xe277('0x76')](this[_0xe277('0x1a')][_0x5cf8a4]['monitors'],{'filename':_0x3f9b10});if(_['isNil'](_0x857a8b)){this[_0xe277('0x1a')][_0x5cf8a4]['monitors'][_0xe277('0x77')]({'filename':_0x3f9b10,'createdAt':moment()[_0xe277('0x50')](_0xe277('0x51')),'mixmonitorid':'','status':_0xe277('0x78')});}}}catch(_0x582f75){logger[_0xe277('0x4c')]('[%s][voiceCallReport][mixMonitorFilename]',_0x5cf8a4,util[_0xe277('0x33')](_0x582f75,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xe277('0x34')][_0xe277('0x24')]=function(_0x235fb1){try{if(this[_0xe277('0x35')](_0x235fb1)){logger['debug'](_0xe277('0x79'),_0x235fb1[_0xe277('0x3e')],util['inspect'](_0x235fb1,{'showHidden':![],'depth':null}));if(this[_0xe277('0x1a')][_0x235fb1['uniqueid']]&&_0x235fb1[_0xe277('0x43')]!=_0xe277('0x58')){if(this[_0xe277('0x35')](_0x235fb1['variable'])){if(this['isNotNull'](_0x235fb1[_0xe277('0x7a')][_0xe277('0x7b')])){logger[_0xe277('0x2f')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x235fb1[_0xe277('0x3e')],_0x235fb1[_0xe277('0x7c')]);this['syncMixMonitorFilename'](_0x235fb1[_0xe277('0x3e')],_0x235fb1[_0xe277('0x7c')]);}else if(this[_0xe277('0x35')](_0x235fb1[_0xe277('0x7a')]['xmd-phone'])){logger[_0xe277('0x2f')]('[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s',_0x235fb1['uniqueid'],_0x235fb1['value']);this[_0xe277('0x1a')][_0x235fb1['uniqueid']]['calleridnum']=_0x235fb1['value'];}else if(this[_0xe277('0x35')](_0x235fb1[_0xe277('0x7a')][_0xe277('0x7d')])){logger['info'](_0xe277('0x7e'),_0x235fb1[_0xe277('0x3e')],_0x235fb1['value']);this[_0xe277('0x1a')][_0x235fb1[_0xe277('0x3e')]][_0xe277('0x7f')]=_0x235fb1['value'];}else if(this['isNotNull'](_0x235fb1[_0xe277('0x7a')]['xmd-cdrtype'])){logger[_0xe277('0x2f')]('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x235fb1['uniqueid'],_0x235fb1[_0xe277('0x7c')]);this[_0xe277('0x1a')][_0x235fb1[_0xe277('0x3e')]]['type']=_0x235fb1[_0xe277('0x7c')];}else if(this[_0xe277('0x35')](_0x235fb1[_0xe277('0x7a')]['xmd-queue'])){logger['info'](_0xe277('0x80'),_0x235fb1['uniqueid'],_0x235fb1['value'][_0xe277('0x44')](',')[0x0]);this[_0xe277('0x1a')][_0x235fb1[_0xe277('0x3e')]][_0xe277('0x10')]=_0x235fb1['value'][_0xe277('0x44')](',')[0x0];}else if(this[_0xe277('0x35')](_0x235fb1['variable'][_0xe277('0x81')])){logger[_0xe277('0x2f')]('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x235fb1['uniqueid'],_0x235fb1['value']);this[_0xe277('0x1a')][_0x235fb1['uniqueid']]['originatecalleridnum']=_0x235fb1[_0xe277('0x7c')];}else if(this[_0xe277('0x35')](_0x235fb1[_0xe277('0x7a')]['xmd-destination'])){logger[_0xe277('0x2f')](_0xe277('0x82'),_0x235fb1[_0xe277('0x3e')],_0x235fb1[_0xe277('0x7c')]);this[_0xe277('0x1a')][_0x235fb1[_0xe277('0x3e')]]['destination']=_0x235fb1['value'];}else if(this[_0xe277('0x35')](_0x235fb1[_0xe277('0x7a')]['xmd-callerid-preview'])){logger[_0xe277('0x2f')](_0xe277('0x83'),_0x235fb1[_0xe277('0x3e')],_0x235fb1[_0xe277('0x7c')]);this['channels'][_0x235fb1[_0xe277('0x3e')]]['calleridpreview']=_0x235fb1[_0xe277('0x7c')];}else if(this[_0xe277('0x35')](_0x235fb1[_0xe277('0x7a')][_0xe277('0x84')])){logger[_0xe277('0x2f')](_0xe277('0x85'),_0x235fb1['uniqueid'],_0x235fb1[_0xe277('0x7c')]);this[_0xe277('0x1a')][_0x235fb1[_0xe277('0x3e')]]['queue']=_0x235fb1['value'];}else if(this[_0xe277('0x35')](_0x235fb1['variable'][_0xe277('0x86')])){logger[_0xe277('0x2f')](_0xe277('0x87'),_0x235fb1[_0xe277('0x3e')],_0x235fb1[_0xe277('0x7c')]);this[_0xe277('0x1a')][_0x235fb1['uniqueid']][_0xe277('0x88')]=_0x235fb1[_0xe277('0x7c')];}}}else if(this['isNotNull'](_0x235fb1[_0xe277('0x7a')][_0xe277('0x7b')])){if(_0x235fb1['value']){var _0x3e39a3=path[_0xe277('0x89')](_0x235fb1[_0xe277('0x7c')])[_0xe277('0x49')];logger['info']('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x3e39a3,_0x235fb1[_0xe277('0x7c')]);this[_0xe277('0x8a')](_0x3e39a3,_0x235fb1[_0xe277('0x7c')]);}}else if(this[_0xe277('0x1a')][_0x235fb1[_0xe277('0x3c')]]){if(this['isNotNull'](_0x235fb1[_0xe277('0x7a')])){if(this[_0xe277('0x35')](_0x235fb1[_0xe277('0x7a')]['sipcallid'])){logger[_0xe277('0x2f')](_0xe277('0x87'),_0x235fb1[_0xe277('0x3c')],_0x235fb1['value']);this[_0xe277('0x1a')][_0x235fb1[_0xe277('0x3c')]][_0xe277('0x8b')]=_0x235fb1['value'];}}}}}catch(_0xf9559c){logger[_0xe277('0x4c')](_0xe277('0x8c'),_0x235fb1[_0xe277('0x3e')],util['inspect'](_0xf9559c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xe277('0x34')][_0xe277('0x26')]=function(_0x26b26d){try{if(this[_0xe277('0x35')](_0x26b26d)){logger[_0xe277('0x56')](_0xe277('0x8d'),_0x26b26d[_0xe277('0x3e')],util['inspect'](_0x26b26d,{'showHidden':![],'depth':null}));if(this[_0xe277('0x1a')][_0x26b26d[_0xe277('0x3e')]]){logger[_0xe277('0x2f')](_0xe277('0x8e'),_0x26b26d[_0xe277('0x3e')],_0x26b26d[_0xe277('0x8f')]);var _0x14b5cf=moment();this[_0xe277('0x1a')][_0x26b26d['uniqueid']]['endtime']=_0x14b5cf['format'](_0xe277('0x51'));this[_0xe277('0x1a')][_0x26b26d[_0xe277('0x3e')]][_0xe277('0x60')]=_0x14b5cf['diff'](this[_0xe277('0x1a')][_0x26b26d[_0xe277('0x3e')]]['starttime'],_0xe277('0x61'));if(this['channels'][_0x26b26d[_0xe277('0x3e')]][_0xe277('0x69')]){this['channels'][_0x26b26d[_0xe277('0x3e')]][_0xe277('0x90')]=_0x14b5cf[_0xe277('0x6a')](this[_0xe277('0x1a')][_0x26b26d[_0xe277('0x3e')]][_0xe277('0x91')],_0xe277('0x61'));this[_0xe277('0x1a')][_0x26b26d[_0xe277('0x3e')]][_0xe277('0x92')]=this[_0xe277('0x1a')][_0x26b26d[_0xe277('0x3e')]][_0xe277('0x60')]-this[_0xe277('0x1a')][_0x26b26d['uniqueid']][_0xe277('0x90')];}if(_0x26b26d['context']===_0xe277('0x42')){if(this[_0xe277('0x1b')][_0x26b26d[_0xe277('0x43')][_0xe277('0x44')]('-')[0x0]]){this['agents'][_0x26b26d[_0xe277('0x43')][_0xe277('0x44')]('-')[0x0]]=_['omit'](this[_0xe277('0x1b')][_0x26b26d[_0xe277('0x43')][_0xe277('0x44')]('-')[0x0]],['destconnectedlinenum']);logger[_0xe277('0x56')](_0xe277('0x93'),_0x26b26d[_0xe277('0x3e')],util[_0xe277('0x33')]({'id':this[_0xe277('0x1b')][_0x26b26d['channel'][_0xe277('0x44')]('-')[0x0]]['id'],'destaccountcode':this[_0xe277('0x1b')][_0x26b26d[_0xe277('0x43')][_0xe277('0x44')]('-')[0x0]][_0xe277('0x4b')]},{'showHidden':![],'depth':null}));this['emit'](util[_0xe277('0x50')](_0xe277('0x48'),this[_0xe277('0x1b')][_0x26b26d['channel'][_0xe277('0x44')]('-')[0x0]][_0xe277('0x49')]),'user:agentcomplete',{'id':this[_0xe277('0x1b')][_0x26b26d[_0xe277('0x43')][_0xe277('0x44')]('-')[0x0]]['id'],'destaccountcode':this[_0xe277('0x1b')][_0x26b26d[_0xe277('0x43')][_0xe277('0x44')]('-')[0x0]][_0xe277('0x4b')]});}}var _0x4a1a48=this;Promise[_0xe277('0x94')]()[_0xe277('0x95')](function(){var _0x4923d8=_0x4a1a48[_0xe277('0x1a')][_0x26b26d['uniqueid']];if(typeof _0x4923d8[_0xe277('0x96')]===_0xe277('0x97'))return;if(_[_0xe277('0x98')](_0x4923d8['monitors']))return;return RpcSetting[_0xe277('0x99')]()[_0xe277('0x95')](function(_0x588b62){if(!_0x588b62['stopRecordingOnTransfer'])return;return Promise[_0xe277('0x94')]()[_0xe277('0x95')](function(){return ami[_0xe277('0x9a')]({'action':_0xe277('0x9b'),'channel':_0x4923d8['channel']})[_0xe277('0x9c')](function(){});})[_0xe277('0x95')](function(){return ami[_0xe277('0x9a')]({'action':'StopMixMonitor','channel':_0x4923d8[_0xe277('0x9d')]})[_0xe277('0x9c')](function(){})['finally'](function(){var _0x54216b=_0x4a1a48[_0xe277('0x1b')][_0x4923d8['destinationchannel']['split']('-')[0x0]];if(!_0x54216b)return;io[_0xe277('0x37')](_0xe277('0x9e'),{'agentId':_0x54216b['id'],'uniqueid':_0x4923d8[_0xe277('0x3e')]});});});});})[_0xe277('0x95')](function(){if(_0x26b26d[_0xe277('0x9f')]===_0xe277('0xa0')){_0x4a1a48['blindTransfers'][_0x26b26d['uniqueid']]=_0x4a1a48[_0xe277('0x1a')][_0x26b26d[_0xe277('0x3e')]];}else{if(_0x4a1a48[_0xe277('0x1a')][_0x26b26d[_0xe277('0x3e')]]['type']===_0xe277('0xa1')&&_0x4a1a48[_0xe277('0x1c')][_0x26b26d[_0xe277('0x3e')]]){_0x4a1a48[_0xe277('0x1a')][_0x26b26d[_0xe277('0x3e')]][_0xe277('0x3e')]=[_0x4a1a48[_0xe277('0x1a')][_0x26b26d['uniqueid']][_0xe277('0x3c')],_0x4a1a48[_0xe277('0x1a')][_0x26b26d[_0xe277('0x3e')]][_0xe277('0x3c')]=_0x4a1a48[_0xe277('0x1a')][_0x26b26d['uniqueid']][_0xe277('0x3e')]][0x0];delete _0x4a1a48[_0xe277('0x1c')][_0x26b26d['uniqueid']];}}logger[_0xe277('0x56')](_0xe277('0xa2'),_0x26b26d[_0xe277('0x3e')],util['inspect'](_0x4a1a48[_0xe277('0x1a')][_0x26b26d['uniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0xe277('0xa3'),_0x4a1a48[_0xe277('0x1a')][_0x26b26d[_0xe277('0x3e')]]);delete _0x4a1a48['channels'][_0x26b26d[_0xe277('0x3e')]];});}}}catch(_0x1c4321){logger[_0xe277('0x4c')](_0xe277('0xa4'),_0x26b26d['uniqueid'],util['inspect'](_0x1c4321,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xe277('0x29')]=function(_0x51ef9f){try{if(this[_0xe277('0x35')](_0x51ef9f)){logger[_0xe277('0x2f')](_0xe277('0xa5'),_0x51ef9f['uniqueid'],_0x51ef9f['origtransferercalleridnum'],_0x51ef9f['transfertargetcalleridnum']);logger[_0xe277('0x56')]('[%s][voiceCallReport][attendedtransfer]\x20event:',_0x51ef9f[_0xe277('0x3e')],util['inspect'](_0x51ef9f,{'showHidden':![],'depth':null}));if(this[_0xe277('0x1a')][_0x51ef9f[_0xe277('0xa6')]]){this[_0xe277('0x1a')][_0x51ef9f[_0xe277('0xa6')]][_0xe277('0xa7')]=_0x51ef9f[_0xe277('0xa8')];this[_0xe277('0x1a')][_0x51ef9f[_0xe277('0xa6')]][_0xe277('0xa9')]=_0x51ef9f['transfertargetcalleridnum'];if(this[_0xe277('0x1a')][_0x51ef9f[_0xe277('0xaa')]]){var _0x587af5=this['channels'][_0x51ef9f[_0xe277('0xaa')]];this[_0xe277('0x1a')][_0x51ef9f[_0xe277('0xaa')]]=this['channels'][_0x51ef9f[_0xe277('0xa6')]];this[_0xe277('0x1a')][_0x51ef9f[_0xe277('0xa6')]]=_0x587af5;}}else if(this[_0xe277('0x1a')][_0x51ef9f[_0xe277('0xab')]]){this[_0xe277('0x1a')][_0x51ef9f['transfertargetuniqueid']]['transfercalleridnum']=_0x51ef9f[_0xe277('0xa8')];this[_0xe277('0x1a')][_0x51ef9f[_0xe277('0xab')]][_0xe277('0xa9')]=_0x51ef9f['transfertargetcalleridnum'];if(this[_0xe277('0x1a')][_0x51ef9f[_0xe277('0xac')]]){var _0x587af5=this[_0xe277('0x1a')][_0x51ef9f[_0xe277('0xac')]];this[_0xe277('0x1a')][_0x51ef9f[_0xe277('0xac')]]=this['channels'][_0x51ef9f[_0xe277('0xab')]];this['channels'][_0x51ef9f[_0xe277('0xab')]]=_0x587af5;}}if((this[_0xe277('0x1a')][_0x51ef9f['origtransfereruniqueid']]||this[_0xe277('0x1a')][_0x51ef9f[_0xe277('0xad')]])&&this[_0xe277('0x1a')][_0x51ef9f[_0xe277('0xaa')]]){var _0x2002e4=_[_0xe277('0xae')]([this['channels'][_0x51ef9f['origtransfereruniqueid']],this[_0xe277('0x1a')][_0x51ef9f[_0xe277('0xad')]],this['channels'][_0x51ef9f['secondtransfereruniqueid']]],function(_0xf4902e){return _0xf4902e&&_0xf4902e['type']===_0xe277('0xa1')&&_0xf4902e['routeid'];});if(_0x2002e4){if(this[_0xe277('0x1a')][_0x51ef9f[_0xe277('0xac')]])this[_0xe277('0x1a')][_0x51ef9f[_0xe277('0xac')]][_0xe277('0x96')]=_0xe277('0xaf');if(this[_0xe277('0x1a')][_0x51ef9f[_0xe277('0xad')]])this[_0xe277('0x1a')][_0x51ef9f[_0xe277('0xad')]][_0xe277('0x96')]=_0xe277('0xaf');this[_0xe277('0x1a')][_0x51ef9f['secondtransfereruniqueid']][_0xe277('0x96')]=_0xe277('0xaf');}}}}catch(_0x137f08){logger[_0xe277('0x4c')](_0xe277('0xb0'),_0x51ef9f[_0xe277('0x3e')],util[_0xe277('0x33')](_0x137f08,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xe277('0x34')][_0xe277('0x2b')]=function(_0x4cdad4){try{if(this[_0xe277('0x35')](_0x4cdad4)){logger['info'](_0xe277('0xb1'),_0x4cdad4[_0xe277('0x3e')],_0x4cdad4[_0xe277('0xb2')],_0x4cdad4['extension']);logger['debug'](_0xe277('0xb3'),_0x4cdad4[_0xe277('0x3e')],util[_0xe277('0x33')](_0x4cdad4,{'showHidden':![],'depth':null}));if(this['channels'][_0x4cdad4[_0xe277('0xa6')]]){this['channels'][_0x4cdad4[_0xe277('0xa6')]][_0xe277('0xa7')]=_0x4cdad4[_0xe277('0xb2')];this[_0xe277('0x1a')][_0x4cdad4['transfereeuniqueid']][_0xe277('0xa9')]=_0x4cdad4['extension'];this['channels'][_0x4cdad4[_0xe277('0xa6')]][_0xe277('0x96')]=_0xe277('0xb4');this[_0xe277('0x26')]({'event':'BlindTransfer','uniqueid':_0x4cdad4[_0xe277('0xa6')],'context':_0x4cdad4[_0xe277('0x41')],'channel':_0x4cdad4[_0xe277('0xb5')]});}else{this[_0xe277('0x1a')][_0x4cdad4[_0xe277('0xb6')]]['transferType']=_0xe277('0xb4');}}}catch(_0x18259b){logger[_0xe277('0x4c')](_0xe277('0xb7'),_0x4cdad4[_0xe277('0x3e')],util[_0xe277('0x33')](_0x18259b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xe277('0x34')][_0xe277('0x2d')]=function(_0x41365e){try{if(this['isNotNull'](_0x41365e)){logger[_0xe277('0x56')]('[%s][voiceCallReport][musiconholdstart]\x20event:',_0x41365e[_0xe277('0x3e')],util[_0xe277('0x33')](_0x41365e,{'showHidden':![],'depth':null}));if(this[_0xe277('0x1a')][_0x41365e['uniqueid']]){if(!_[_0xe277('0xb8')](this[_0xe277('0x1a')][_0x41365e['uniqueid']]['answertime'])){this[_0xe277('0x1a')][_0x41365e[_0xe277('0x3e')]][_0xe277('0xb9')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');logger[_0xe277('0x2f')](_0xe277('0xba'),_0x41365e[_0xe277('0x3e')],this['channels'][_0x41365e['uniqueid']][_0xe277('0xb9')]);}}}}catch(_0x15af8d){logger[_0xe277('0x4c')](_0xe277('0xbb'),_0x41365e['uniqueid'],util['inspect'](_0x15af8d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xe277('0x34')][_0xe277('0x2e')]=function(_0x4158c5){try{if(this[_0xe277('0x35')](_0x4158c5)){logger[_0xe277('0x56')]('[%s][voiceCallReport][musiconholdstop]\x20event:',_0x4158c5['uniqueid'],util[_0xe277('0x33')](_0x4158c5,{'showHidden':![],'depth':null}));if(this[_0xe277('0x1a')][_0x4158c5[_0xe277('0x3e')]]){if(!_[_0xe277('0xb8')](this[_0xe277('0x1a')][_0x4158c5[_0xe277('0x3e')]][_0xe277('0xb9')])){this[_0xe277('0x1a')][_0x4158c5['uniqueid']][_0xe277('0xbc')]+=moment()['milliseconds'](0x0)[_0xe277('0x6a')](this[_0xe277('0x1a')][_0x4158c5[_0xe277('0x3e')]][_0xe277('0xb9')],_0xe277('0x61'));logger[_0xe277('0x2f')](_0xe277('0xbd'),_0x4158c5[_0xe277('0x3e')],this[_0xe277('0x1a')][_0x4158c5[_0xe277('0x3e')]][_0xe277('0xbc')]);delete this[_0xe277('0x1a')][_0x4158c5['uniqueid']][_0xe277('0xb9')];}}}}catch(_0x4fa9b5){logger[_0xe277('0x4c')](_0xe277('0xbe'),_0x4158c5[_0xe277('0x3e')],util[_0xe277('0x33')](_0x4fa9b5,{'showHidden':![],'depth':null}));}};module[_0xe277('0xbf')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 5804e0a..977a9fb 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 _0x9231=['[%s][voiceDialReport][hangup]','[%s][voiceDialReport][newexten]\x20event:','application','toLowerCase','set','applicationdata','appdata','startsWith','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','split','match','[%s][voiceDialReport][newexten]','exports','lodash','moment','util','../../../config/environment','../../../config/logger','ami','../ami','localhost','redis','channels','outbound','syncDialBegin','bind','dialend','syncDialEnd','varset','newexten','syncNewExten','hangup','syncHangup','prototype','isNotNull','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','merge','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','event','privilege','info','membername','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','applications','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','format','lastevent','connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','syncVarSet','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','outboundrouteid','isUndefined','value','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','error','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosjitter','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','variables','endtime','diff','complete','total','answered','holdtime','seconds','billableseconds','sumHoldTime','sumDuration','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','voice_outbound_channel:remove','linkedid'];(function(_0x3a8db5,_0x31cff7){var _0x2c03cd=function(_0x47dba0){while(--_0x47dba0){_0x3a8db5['push'](_0x3a8db5['shift']());}};_0x2c03cd(++_0x31cff7);}(_0x9231,0x82));var _0x1923=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9231[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1923('0x0'));var moment=require(_0x1923('0x1'));var util=require(_0x1923('0x2'));var Redis=require('ioredis');var config=require(_0x1923('0x3'));var logger=require(_0x1923('0x4'))(_0x1923('0x5'));var ami=require(_0x1923('0x6'));config['redis']=_['defaults'](config['redis'],{'host':_0x1923('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1923('0x8')]));function VoiceDialReport(_0x51430e){this[_0x1923('0x9')]=_0x51430e['outboundChannels'];this[_0x1923('0xa')]=_0x51430e[_0x1923('0xa')];this['applications']={};this['variables']={};ami['on']('dialbegin',this[_0x1923('0xb')][_0x1923('0xc')](this));ami['on'](_0x1923('0xd'),this[_0x1923('0xe')]['bind'](this));ami['on'](_0x1923('0xf'),this['syncVarSet']['bind'](this));ami['on'](_0x1923('0x10'),this[_0x1923('0x11')]['bind'](this));ami['on'](_0x1923('0x12'),this[_0x1923('0x13')]['bind'](this));}VoiceDialReport[_0x1923('0x14')][_0x1923('0x15')]=function(_0x232d10){return _0x232d10!==null&&!_['isUndefined'](_0x232d10);};VoiceDialReport['prototype']['emit']=function(_0x10f934,_0x340bfa,_0x4b2b89){io['to'](_0x10f934)[_0x1923('0x16')](_0x340bfa,_0x4b2b89);};VoiceDialReport[_0x1923('0x14')][_0x1923('0xb')]=function(_0x185786){try{if(this['isNotNull'](_0x185786)){logger[_0x1923('0x17')](_0x1923('0x18'),_0x185786[_0x1923('0x19')],util[_0x1923('0x1a')](_0x185786,{'showHidden':![],'depth':null}));if(this['channels'][_0x185786[_0x1923('0x19')]]){_[_0x1923('0x1b')](this[_0x1923('0x9')][_0x185786['uniqueid']],{'starttime':moment()['format'](_0x1923('0x1c')),'lastevent':_0x1923('0x1d'),'interface':_0x185786[_0x1923('0x1e')][_0x1923('0x1f')](0x0,_0x185786['channel'][_0x1923('0x20')]('-')),'membername':_0x185786[_0x1923('0x1e')][_0x1923('0x1f')](_0x185786[_0x1923('0x1e')]['lastIndexOf']('/')+0x1,_0x185786['channel'][_0x1923('0x20')]('-'))},_[_0x1923('0x21')](_0x185786,[_0x1923('0x22'),_0x1923('0x23')]));logger[_0x1923('0x24')]('[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called',_0x185786['uniqueid'],this['channels'][_0x185786[_0x1923('0x19')]][_0x1923('0x25')],this[_0x1923('0x9')][_0x185786['uniqueid']]['interface']);logger[_0x1923('0x17')](_0x1923('0x26'),_0x185786[_0x1923('0x19')],util[_0x1923('0x1a')](this[_0x1923('0x9')][_0x185786[_0x1923('0x19')]],{'showHidden':![],'depth':null}));if(this[_0x1923('0x27')][_0x185786['uniqueid']])_[_0x1923('0x1b')](this[_0x1923('0x9')][_0x185786[_0x1923('0x19')]],this[_0x1923('0x27')][_0x185786['uniqueid']]);this[_0x1923('0x16')](_0x1923('0x28'),_0x1923('0x29'),this[_0x1923('0x9')][_0x185786[_0x1923('0x19')]]);logger[_0x1923('0x17')](_0x1923('0x2a'),_0x185786[_0x1923('0x19')],util[_0x1923('0x1a')](this[_0x1923('0x9')][_0x185786[_0x1923('0x19')]],{'showHidden':![],'depth':null}));ami[_0x1923('0x16')](_0x1923('0x2b'),this['channels'][_0x185786['uniqueid']]);}}}catch(_0x207eb5){logger['error'](_0x1923('0x2c'),_0x185786['uniqueid'],util['inspect'](_0x207eb5,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x1923('0x14')][_0x1923('0xe')]=function(_0x342f51){try{if(this['isNotNull'](_0x342f51)){logger[_0x1923('0x17')](_0x1923('0x2d'),_0x342f51['uniqueid'],util[_0x1923('0x1a')](_0x342f51,{'showHidden':![],'depth':null}));if(this['channels'][_0x342f51['uniqueid']]){this['channels'][_0x342f51[_0x1923('0x19')]][_0x1923('0x2e')]=_0x342f51[_0x1923('0x2e')];if(_0x342f51[_0x1923('0x2e')]===_0x1923('0x2f')){this[_0x1923('0x9')][_0x342f51[_0x1923('0x19')]][_0x1923('0x30')]=_0x342f51[_0x1923('0x30')];this[_0x1923('0x9')][_0x342f51[_0x1923('0x19')]][_0x1923('0x31')]=_0x342f51[_0x1923('0x31')];this['channels'][_0x342f51['uniqueid']][_0x1923('0x32')]=moment()[_0x1923('0x33')](_0x1923('0x1c'));this[_0x1923('0x9')][_0x342f51[_0x1923('0x19')]][_0x1923('0x34')]=_0x1923('0x35');logger[_0x1923('0x24')]('[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect',_0x342f51[_0x1923('0x19')],_0x342f51[_0x1923('0x1e')]['substring'](_0x342f51['channel'][_0x1923('0x20')]('/')+0x1,_0x342f51[_0x1923('0x1e')][_0x1923('0x20')]('-')));logger[_0x1923('0x17')](_0x1923('0x36'),_0x342f51[_0x1923('0x19')],util[_0x1923('0x1a')](this[_0x1923('0x9')][_0x342f51[_0x1923('0x19')]],{'showHidden':![],'depth':null}));ami[_0x1923('0x16')](_0x1923('0x37'),this['channels'][_0x342f51[_0x1923('0x19')]]);}logger[_0x1923('0x17')](_0x1923('0x38'),_0x342f51[_0x1923('0x19')],util['inspect'](this[_0x1923('0x9')][_0x342f51[_0x1923('0x19')]],{'showHidden':![],'depth':null}));this[_0x1923('0x16')](_0x1923('0x28'),'voice_outbound_channel:save',this[_0x1923('0x9')][_0x342f51[_0x1923('0x19')]]);}}}catch(_0x1f9d70){logger['error'](_0x1923('0x39'),_0x342f51[_0x1923('0x19')],util[_0x1923('0x1a')](_0x1f9d70,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x1923('0x14')][_0x1923('0x3a')]=function(_0x159b2e){try{if(this[_0x1923('0x15')](_0x159b2e)){logger['debug'](_0x1923('0x3b'),_0x159b2e['uniqueid'],util[_0x1923('0x1a')](_0x159b2e,{'showHidden':![],'depth':null}));this[_0x1923('0x3c')](_0x159b2e[_0x1923('0x19')],_[_0x1923('0x3d')](_0x159b2e[_0x1923('0x3e')])[0x0],_0x159b2e['value']);if(this[_0x1923('0x15')](_0x159b2e[_0x1923('0x3e')])&&this[_0x1923('0x15')](_0x159b2e[_0x1923('0x3e')][_0x1923('0x3f')])){if(_[_0x1923('0x40')](this[_0x1923('0x9')][_0x159b2e[_0x1923('0x19')]])){this[_0x1923('0x9')][_0x159b2e[_0x1923('0x19')]]={'routeId':_0x159b2e[_0x1923('0x41')],'variables':this['variables'][_0x159b2e[_0x1923('0x19')]]};logger[_0x1923('0x24')]('[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s',_0x159b2e[_0x1923('0x19')],_0x159b2e[_0x1923('0x3e')][_0x1923('0x3f')],_[_0x1923('0x3d')](_0x159b2e['variable'])[0x0],_0x159b2e['value']);logger[_0x1923('0x17')](_0x1923('0x42'),_0x159b2e[_0x1923('0x19')],util[_0x1923('0x1a')](this['channels'][_0x159b2e[_0x1923('0x19')]],{'showHidden':![],'depth':null}));this[_0x1923('0x16')]('voice:outbound','voice_outbound_channel:save',this[_0x1923('0x9')][_0x159b2e['uniqueid']]);}}}}catch(_0x38fcb7){logger[_0x1923('0x43')](_0x1923('0x44'),_0x159b2e['uniqueid'],util['inspect'](_0x38fcb7,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x1923('0x3c')]=function(_0x1ff297,_0x29c249,_0x3493f5){var _0x2a6395=[_0x1923('0x45'),'rtpaudioqosbridged',_0x1923('0x46'),'rtpaudioqosjitterbridged','rtpaudioqosloss',_0x1923('0x47'),_0x1923('0x48'),_0x1923('0x49'),_0x1923('0x4a'),_0x1923('0x4b'),_0x1923('0x4c'),_0x1923('0x4d'),_0x1923('0x4e'),_0x1923('0x4f'),_0x1923('0x50'),_0x1923('0x51'),_0x1923('0x25'),_0x1923('0x52'),_0x1923('0x53')];if(!_[_0x1923('0x54')](_0x29c249)&&!_['includes'](_0x2a6395,_0x29c249)){if(_[_0x1923('0x40')](this[_0x1923('0x55')][_0x1ff297])){this[_0x1923('0x55')][_0x1ff297]={};}this[_0x1923('0x55')][_0x1ff297][_0x29c249]=_0x3493f5;}};VoiceDialReport[_0x1923('0x14')][_0x1923('0x13')]=function(_0x405504){try{if(this[_0x1923('0x15')](_0x405504)){logger['debug']('[%s][voiceDialReport][hangup]\x20event:',_0x405504['uniqueid'],util[_0x1923('0x1a')](_0x405504,{'showHidden':![],'depth':null}));if(this[_0x1923('0x9')][_0x405504[_0x1923('0x19')]]){logger['info']('[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete',_0x405504[_0x1923('0x19')],_0x405504['cause-txt']);this[_0x1923('0x9')][_0x405504['uniqueid']][_0x1923('0x56')]=moment()[_0x1923('0x33')](_0x1923('0x1c'));this[_0x1923('0x9')][_0x405504[_0x1923('0x19')]]['duration']=moment(this[_0x1923('0x9')][_0x405504[_0x1923('0x19')]][_0x1923('0x56')])[_0x1923('0x57')](this['channels'][_0x405504[_0x1923('0x19')]]['starttime'],'seconds');this[_0x1923('0x9')][_0x405504[_0x1923('0x19')]][_0x1923('0x34')]=_0x1923('0x58');this[_0x1923('0xa')][_0x1923('0x59')]+=0x1;if(this[_0x1923('0x9')][_0x405504[_0x1923('0x19')]][_0x1923('0x32')]){this['outbound'][_0x1923('0x5a')]+=0x1;this[_0x1923('0x9')][_0x405504['uniqueid']][_0x1923('0x5b')]=moment(this[_0x1923('0x9')][_0x405504[_0x1923('0x19')]][_0x1923('0x32')])['diff'](this[_0x1923('0x9')][_0x405504['uniqueid']]['starttime'],_0x1923('0x5c'));this[_0x1923('0x9')][_0x405504['uniqueid']][_0x1923('0x5d')]=moment(this['channels'][_0x405504[_0x1923('0x19')]][_0x1923('0x56')])[_0x1923('0x57')](this[_0x1923('0x9')][_0x405504[_0x1923('0x19')]]['answertime'],_0x1923('0x5c'));this['outbound'][_0x1923('0x5e')]+=this[_0x1923('0x9')][_0x405504['uniqueid']][_0x1923('0x5b')]||0x0;this[_0x1923('0xa')]['sumBillable']+=this[_0x1923('0x9')][_0x405504['uniqueid']][_0x1923('0x5d')];}this[_0x1923('0xa')][_0x1923('0x5f')]+=this[_0x1923('0x9')][_0x405504[_0x1923('0x19')]]['duration'];logger['debug']('[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:',_0x405504[_0x1923('0x19')],util[_0x1923('0x1a')](this[_0x1923('0x9')][_0x405504[_0x1923('0x19')]],{'showHidden':![],'depth':null}));ami[_0x1923('0x16')](_0x1923('0x60'),this['channels'][_0x405504[_0x1923('0x19')]]);logger[_0x1923('0x17')](_0x1923('0x61'),_0x405504[_0x1923('0x19')],util['inspect'](this[_0x1923('0x9')][_0x405504['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x1923('0x16')]('custom:dialend',this[_0x1923('0x9')][_0x405504[_0x1923('0x19')]]);logger[_0x1923('0x17')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:',_0x405504[_0x1923('0x19')],util[_0x1923('0x1a')](this['channels'][_0x405504[_0x1923('0x19')]],{'showHidden':![],'depth':null}));this[_0x1923('0x16')](_0x1923('0x28'),_0x1923('0x62'),this[_0x1923('0xa')]);logger[_0x1923('0x24')](_0x1923('0x63'),JSON['stringify'](this['channels'][_0x405504['uniqueid']]));logger[_0x1923('0x17')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:',_0x405504['uniqueid'],util['inspect'](this[_0x1923('0x9')][_0x405504[_0x1923('0x19')]],{'showHidden':![],'depth':null}));this['emit'](_0x1923('0x28'),_0x1923('0x64'),this[_0x1923('0x9')][_0x405504[_0x1923('0x19')]]);delete this['channels'][_0x405504[_0x1923('0x19')]];}else if(this[_0x1923('0x9')][_0x405504[_0x1923('0x65')]]){this[_0x1923('0x9')][_0x405504['linkedid']][_0x1923('0x19')]=this[_0x1923('0x9')][_0x405504[_0x1923('0x65')]]['destuniqueid'];}if(this['variables'][_0x405504['uniqueid']]){delete this[_0x1923('0x55')][_0x405504[_0x1923('0x19')]];}}}catch(_0x35d2ad){logger['error'](_0x1923('0x66'),_0x405504[_0x1923('0x19')],util['inspect'](_0x35d2ad,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x1923('0x14')][_0x1923('0x11')]=function(_0x361546){try{if(this['isNotNull'](_0x361546)){logger[_0x1923('0x17')](_0x1923('0x67'),_0x361546[_0x1923('0x19')],util['inspect'](_0x361546,{'showHidden':![],'depth':null}));if(_0x361546[_0x1923('0x68')][_0x1923('0x69')]()===_0x1923('0x6a')){_0x361546[_0x1923('0x6b')]=(_0x361546[_0x1923('0x6c')]||_0x361546[_0x1923('0x6b')])[_0x1923('0x69')]();if(_[_0x1923('0x6d')](_0x361546[_0x1923('0x6b')],_0x1923('0x6e'))){if(_['isUndefined'](this['applications'][_0x361546['uniqueid']]))this[_0x1923('0x27')][_0x361546[_0x1923('0x19')]]={};logger['info'](_0x1923('0x6f'),_0x361546['uniqueid'],_0x361546['application'],_0x361546['applicationdata']);var _0x56ddf4=_0x361546[_0x1923('0x6b')][_0x1923('0x70')]('=');var _0x153268=_0x56ddf4[0x0][_0x1923('0x71')](/cdr\((.*)\)/);if(_0x153268)this[_0x1923('0x27')][_0x361546[_0x1923('0x19')]][_0x153268[0x1]]=_0x56ddf4[0x1];}}}}catch(_0x2eb3ab){logger[_0x1923('0x43')](_0x1923('0x72'),_0x361546['uniqueid'],util[_0x1923('0x1a')](_0x2eb3ab,{'showHidden':![],'depth':null}));}};module[_0x1923('0x73')]=VoiceDialReport; \ No newline at end of file +var _0x7f7a=['rtpaudioqosrttbridged','sipcallid','sipuri','bridgepvtcallid','membercalls','memberdynamic','memberlastcall','memberrealtime','isNil','includes','[%s][voiceDialReport][hangup]\x20event:','endtime','duration','seconds','total','answered','holdtime','diff','starttime','billableseconds','sumHoldTime','sumBillable','sumDuration','custom:voiceDialReport','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','application','toLowerCase','set','applicationdata','appdata','startsWith','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','match','exports','lodash','../../../config/environment','ami','../ami','redis','defaults','socket.io-emitter','channels','outboundChannels','outbound','applications','variables','syncDialBegin','bind','dialend','syncDialEnd','varset','syncVarSet','newexten','syncNewExten','hangup','syncHangup','isUndefined','emit','prototype','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','format','YYYY-MM-DD\x20HH:mm:ss','called','substring','lastIndexOf','channel','omit','event','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','merge','voice:outbound','voice_outbound_channel:save','error','[%s][voiceDialReport][dialbegin]','isNotNull','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','value','outboundrouteid','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt'];(function(_0x575d81,_0x51e538){var _0x3cb9d5=function(_0x3c1753){while(--_0x3c1753){_0x575d81['push'](_0x575d81['shift']());}};_0x3cb9d5(++_0x51e538);}(_0x7f7a,0x191));var _0xa7f7=function(_0x491093,_0x4cc775){_0x491093=_0x491093-0x0;var _0x5f0fc8=_0x7f7a[_0x491093];return _0x5f0fc8;};'use strict';var _=require(_0xa7f7('0x0'));var moment=require('moment');var util=require('util');var Redis=require('ioredis');var config=require(_0xa7f7('0x1'));var logger=require('../../../config/logger')(_0xa7f7('0x2'));var ami=require(_0xa7f7('0x3'));config[_0xa7f7('0x4')]=_[_0xa7f7('0x5')](config[_0xa7f7('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xa7f7('0x6'))(new Redis(config[_0xa7f7('0x4')]));function VoiceDialReport(_0xf11d28){this[_0xa7f7('0x7')]=_0xf11d28[_0xa7f7('0x8')];this[_0xa7f7('0x9')]=_0xf11d28[_0xa7f7('0x9')];this[_0xa7f7('0xa')]={};this[_0xa7f7('0xb')]={};ami['on']('dialbegin',this[_0xa7f7('0xc')][_0xa7f7('0xd')](this));ami['on'](_0xa7f7('0xe'),this[_0xa7f7('0xf')]['bind'](this));ami['on'](_0xa7f7('0x10'),this[_0xa7f7('0x11')][_0xa7f7('0xd')](this));ami['on'](_0xa7f7('0x12'),this[_0xa7f7('0x13')]['bind'](this));ami['on'](_0xa7f7('0x14'),this[_0xa7f7('0x15')][_0xa7f7('0xd')](this));}VoiceDialReport['prototype']['isNotNull']=function(_0x7ef45f){return _0x7ef45f!==null&&!_[_0xa7f7('0x16')](_0x7ef45f);};VoiceDialReport['prototype'][_0xa7f7('0x17')]=function(_0x2c3884,_0x37acea,_0x164b35){io['to'](_0x2c3884)[_0xa7f7('0x17')](_0x37acea,_0x164b35);};VoiceDialReport[_0xa7f7('0x18')][_0xa7f7('0xc')]=function(_0x405e6d){try{if(this['isNotNull'](_0x405e6d)){logger[_0xa7f7('0x19')](_0xa7f7('0x1a'),_0x405e6d[_0xa7f7('0x1b')],util[_0xa7f7('0x1c')](_0x405e6d,{'showHidden':![],'depth':null}));if(this[_0xa7f7('0x7')][_0x405e6d[_0xa7f7('0x1b')]]){_['merge'](this['channels'][_0x405e6d[_0xa7f7('0x1b')]],{'starttime':moment()[_0xa7f7('0x1d')](_0xa7f7('0x1e')),'lastevent':_0xa7f7('0x1f'),'interface':_0x405e6d['channel'][_0xa7f7('0x20')](0x0,_0x405e6d['channel'][_0xa7f7('0x21')]('-')),'membername':_0x405e6d[_0xa7f7('0x22')]['substring'](_0x405e6d[_0xa7f7('0x22')][_0xa7f7('0x21')]('/')+0x1,_0x405e6d[_0xa7f7('0x22')]['lastIndexOf']('-'))},_[_0xa7f7('0x23')](_0x405e6d,[_0xa7f7('0x24'),_0xa7f7('0x25')]));logger[_0xa7f7('0x26')](_0xa7f7('0x27'),_0x405e6d[_0xa7f7('0x1b')],this[_0xa7f7('0x7')][_0x405e6d[_0xa7f7('0x1b')]][_0xa7f7('0x28')],this['channels'][_0x405e6d[_0xa7f7('0x1b')]][_0xa7f7('0x29')]);logger[_0xa7f7('0x19')]('[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:',_0x405e6d['uniqueid'],util[_0xa7f7('0x1c')](this[_0xa7f7('0x7')][_0x405e6d[_0xa7f7('0x1b')]],{'showHidden':![],'depth':null}));if(this[_0xa7f7('0xa')][_0x405e6d[_0xa7f7('0x1b')]])_[_0xa7f7('0x2a')](this['channels'][_0x405e6d['uniqueid']],this[_0xa7f7('0xa')][_0x405e6d[_0xa7f7('0x1b')]]);this[_0xa7f7('0x17')](_0xa7f7('0x2b'),_0xa7f7('0x2c'),this[_0xa7f7('0x7')][_0x405e6d[_0xa7f7('0x1b')]]);logger[_0xa7f7('0x19')]('[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:',_0x405e6d[_0xa7f7('0x1b')],util[_0xa7f7('0x1c')](this[_0xa7f7('0x7')][_0x405e6d[_0xa7f7('0x1b')]],{'showHidden':![],'depth':null}));ami[_0xa7f7('0x17')]('custom:dialbegin',this[_0xa7f7('0x7')][_0x405e6d[_0xa7f7('0x1b')]]);}}}catch(_0x1cb0f9){logger[_0xa7f7('0x2d')](_0xa7f7('0x2e'),_0x405e6d[_0xa7f7('0x1b')],util[_0xa7f7('0x1c')](_0x1cb0f9,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xa7f7('0x18')]['syncDialEnd']=function(_0x1a1d45){try{if(this[_0xa7f7('0x2f')](_0x1a1d45)){logger[_0xa7f7('0x19')]('[%s][voiceDialReport][dialend]\x20event:',_0x1a1d45[_0xa7f7('0x1b')],util[_0xa7f7('0x1c')](_0x1a1d45,{'showHidden':![],'depth':null}));if(this[_0xa7f7('0x7')][_0x1a1d45['uniqueid']]){this[_0xa7f7('0x7')][_0x1a1d45[_0xa7f7('0x1b')]][_0xa7f7('0x30')]=_0x1a1d45[_0xa7f7('0x30')];if(_0x1a1d45['dialstatus']===_0xa7f7('0x31')){this[_0xa7f7('0x7')][_0x1a1d45['uniqueid']][_0xa7f7('0x32')]=_0x1a1d45[_0xa7f7('0x32')];this['channels'][_0x1a1d45['uniqueid']][_0xa7f7('0x33')]=_0x1a1d45[_0xa7f7('0x33')];this[_0xa7f7('0x7')][_0x1a1d45['uniqueid']][_0xa7f7('0x34')]=moment()[_0xa7f7('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x1a1d45[_0xa7f7('0x1b')]][_0xa7f7('0x35')]=_0xa7f7('0x36');logger[_0xa7f7('0x26')](_0xa7f7('0x37'),_0x1a1d45[_0xa7f7('0x1b')],_0x1a1d45[_0xa7f7('0x22')][_0xa7f7('0x20')](_0x1a1d45[_0xa7f7('0x22')][_0xa7f7('0x21')]('/')+0x1,_0x1a1d45[_0xa7f7('0x22')]['lastIndexOf']('-')));logger['debug'](_0xa7f7('0x38'),_0x1a1d45[_0xa7f7('0x1b')],util['inspect'](this[_0xa7f7('0x7')][_0x1a1d45['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xa7f7('0x17')](_0xa7f7('0x39'),this['channels'][_0x1a1d45[_0xa7f7('0x1b')]]);}logger[_0xa7f7('0x19')](_0xa7f7('0x3a'),_0x1a1d45['uniqueid'],util[_0xa7f7('0x1c')](this['channels'][_0x1a1d45[_0xa7f7('0x1b')]],{'showHidden':![],'depth':null}));this['emit'](_0xa7f7('0x2b'),_0xa7f7('0x2c'),this[_0xa7f7('0x7')][_0x1a1d45[_0xa7f7('0x1b')]]);}}}catch(_0x2f1710){logger['error'](_0xa7f7('0x3b'),_0x1a1d45[_0xa7f7('0x1b')],util[_0xa7f7('0x1c')](_0x2f1710,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xa7f7('0x18')][_0xa7f7('0x11')]=function(_0x1692cd){try{if(this[_0xa7f7('0x2f')](_0x1692cd)){logger[_0xa7f7('0x19')](_0xa7f7('0x3c'),_0x1692cd['uniqueid'],util[_0xa7f7('0x1c')](_0x1692cd,{'showHidden':![],'depth':null}));this[_0xa7f7('0x3d')](_0x1692cd['uniqueid'],_[_0xa7f7('0x3e')](_0x1692cd[_0xa7f7('0x3f')])[0x0],_0x1692cd[_0xa7f7('0x40')]);if(this[_0xa7f7('0x2f')](_0x1692cd['variable'])&&this['isNotNull'](_0x1692cd[_0xa7f7('0x3f')][_0xa7f7('0x41')])){if(_[_0xa7f7('0x16')](this[_0xa7f7('0x7')][_0x1692cd['uniqueid']])){this['channels'][_0x1692cd[_0xa7f7('0x1b')]]={'routeId':_0x1692cd[_0xa7f7('0x40')],'variables':this['variables'][_0x1692cd[_0xa7f7('0x1b')]]};logger[_0xa7f7('0x26')](_0xa7f7('0x42'),_0x1692cd[_0xa7f7('0x1b')],_0x1692cd['variable'][_0xa7f7('0x41')],_[_0xa7f7('0x3e')](_0x1692cd[_0xa7f7('0x3f')])[0x0],_0x1692cd[_0xa7f7('0x40')]);logger[_0xa7f7('0x19')](_0xa7f7('0x43'),_0x1692cd['uniqueid'],util['inspect'](this[_0xa7f7('0x7')][_0x1692cd[_0xa7f7('0x1b')]],{'showHidden':![],'depth':null}));this[_0xa7f7('0x17')](_0xa7f7('0x2b'),_0xa7f7('0x2c'),this[_0xa7f7('0x7')][_0x1692cd[_0xa7f7('0x1b')]]);}}}}catch(_0x5df9b5){logger['error'](_0xa7f7('0x44'),_0x1692cd[_0xa7f7('0x1b')],util[_0xa7f7('0x1c')](_0x5df9b5,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xa7f7('0x3d')]=function(_0x16117c,_0x5611f2,_0x751ec0){var _0x3a56c0=[_0xa7f7('0x45'),'rtpaudioqosbridged',_0xa7f7('0x46'),_0xa7f7('0x47'),_0xa7f7('0x48'),_0xa7f7('0x49'),_0xa7f7('0x4a'),_0xa7f7('0x4b'),_0xa7f7('0x4c'),_0xa7f7('0x4d'),'bridgepeer',_0xa7f7('0x4e'),_0xa7f7('0x4f'),_0xa7f7('0x50'),'memberinterface',_0xa7f7('0x51'),_0xa7f7('0x28'),'memberpenalty',_0xa7f7('0x52')];if(!_[_0xa7f7('0x53')](_0x5611f2)&&!_[_0xa7f7('0x54')](_0x3a56c0,_0x5611f2)){if(_[_0xa7f7('0x16')](this[_0xa7f7('0xb')][_0x16117c])){this[_0xa7f7('0xb')][_0x16117c]={};}this['variables'][_0x16117c][_0x5611f2]=_0x751ec0;}};VoiceDialReport[_0xa7f7('0x18')][_0xa7f7('0x15')]=function(_0x142b66){try{if(this[_0xa7f7('0x2f')](_0x142b66)){logger['debug'](_0xa7f7('0x55'),_0x142b66[_0xa7f7('0x1b')],util[_0xa7f7('0x1c')](_0x142b66,{'showHidden':![],'depth':null}));if(this['channels'][_0x142b66[_0xa7f7('0x1b')]]){logger[_0xa7f7('0x26')]('[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete',_0x142b66['uniqueid'],_0x142b66['cause-txt']);this[_0xa7f7('0x7')][_0x142b66[_0xa7f7('0x1b')]][_0xa7f7('0x56')]=moment()[_0xa7f7('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x142b66['uniqueid']][_0xa7f7('0x57')]=moment(this['channels'][_0x142b66[_0xa7f7('0x1b')]][_0xa7f7('0x56')])['diff'](this['channels'][_0x142b66['uniqueid']]['starttime'],_0xa7f7('0x58'));this[_0xa7f7('0x7')][_0x142b66['uniqueid']][_0xa7f7('0x35')]='complete';this[_0xa7f7('0x9')][_0xa7f7('0x59')]+=0x1;if(this[_0xa7f7('0x7')][_0x142b66[_0xa7f7('0x1b')]]['answertime']){this[_0xa7f7('0x9')][_0xa7f7('0x5a')]+=0x1;this[_0xa7f7('0x7')][_0x142b66['uniqueid']][_0xa7f7('0x5b')]=moment(this[_0xa7f7('0x7')][_0x142b66['uniqueid']][_0xa7f7('0x34')])[_0xa7f7('0x5c')](this['channels'][_0x142b66['uniqueid']][_0xa7f7('0x5d')],_0xa7f7('0x58'));this['channels'][_0x142b66[_0xa7f7('0x1b')]][_0xa7f7('0x5e')]=moment(this['channels'][_0x142b66[_0xa7f7('0x1b')]][_0xa7f7('0x56')])[_0xa7f7('0x5c')](this[_0xa7f7('0x7')][_0x142b66['uniqueid']][_0xa7f7('0x34')],'seconds');this[_0xa7f7('0x9')][_0xa7f7('0x5f')]+=this[_0xa7f7('0x7')][_0x142b66['uniqueid']][_0xa7f7('0x5b')]||0x0;this[_0xa7f7('0x9')][_0xa7f7('0x60')]+=this[_0xa7f7('0x7')][_0x142b66[_0xa7f7('0x1b')]][_0xa7f7('0x5e')];}this[_0xa7f7('0x9')][_0xa7f7('0x61')]+=this[_0xa7f7('0x7')][_0x142b66[_0xa7f7('0x1b')]][_0xa7f7('0x57')];logger[_0xa7f7('0x19')]('[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:',_0x142b66[_0xa7f7('0x1b')],util[_0xa7f7('0x1c')](this[_0xa7f7('0x7')][_0x142b66[_0xa7f7('0x1b')]],{'showHidden':![],'depth':null}));ami[_0xa7f7('0x17')](_0xa7f7('0x62'),this[_0xa7f7('0x7')][_0x142b66[_0xa7f7('0x1b')]]);logger[_0xa7f7('0x19')]('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0x142b66['uniqueid'],util[_0xa7f7('0x1c')](this['channels'][_0x142b66[_0xa7f7('0x1b')]],{'showHidden':![],'depth':null}));ami[_0xa7f7('0x17')](_0xa7f7('0x63'),this[_0xa7f7('0x7')][_0x142b66[_0xa7f7('0x1b')]]);logger[_0xa7f7('0x19')](_0xa7f7('0x64'),_0x142b66[_0xa7f7('0x1b')],util[_0xa7f7('0x1c')](this['channels'][_0x142b66[_0xa7f7('0x1b')]],{'showHidden':![],'depth':null}));this[_0xa7f7('0x17')](_0xa7f7('0x2b'),_0xa7f7('0x65'),this[_0xa7f7('0x9')]);logger[_0xa7f7('0x26')](_0xa7f7('0x66'),JSON[_0xa7f7('0x67')](this[_0xa7f7('0x7')][_0x142b66['uniqueid']]));logger[_0xa7f7('0x19')](_0xa7f7('0x68'),_0x142b66['uniqueid'],util[_0xa7f7('0x1c')](this['channels'][_0x142b66[_0xa7f7('0x1b')]],{'showHidden':![],'depth':null}));this['emit']('voice:outbound',_0xa7f7('0x69'),this[_0xa7f7('0x7')][_0x142b66['uniqueid']]);delete this[_0xa7f7('0x7')][_0x142b66[_0xa7f7('0x1b')]];}else if(this[_0xa7f7('0x7')][_0x142b66[_0xa7f7('0x6a')]]){this[_0xa7f7('0x7')][_0x142b66[_0xa7f7('0x6a')]][_0xa7f7('0x1b')]=this[_0xa7f7('0x7')][_0x142b66[_0xa7f7('0x6a')]][_0xa7f7('0x6b')];}if(this[_0xa7f7('0xb')][_0x142b66[_0xa7f7('0x1b')]]){delete this['variables'][_0x142b66[_0xa7f7('0x1b')]];}}}catch(_0x42c231){logger[_0xa7f7('0x2d')](_0xa7f7('0x6c'),_0x142b66[_0xa7f7('0x1b')],util[_0xa7f7('0x1c')](_0x42c231,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xa7f7('0x18')][_0xa7f7('0x13')]=function(_0x329b83){try{if(this[_0xa7f7('0x2f')](_0x329b83)){logger[_0xa7f7('0x19')]('[%s][voiceDialReport][newexten]\x20event:',_0x329b83[_0xa7f7('0x1b')],util[_0xa7f7('0x1c')](_0x329b83,{'showHidden':![],'depth':null}));if(_0x329b83[_0xa7f7('0x6d')][_0xa7f7('0x6e')]()===_0xa7f7('0x6f')){_0x329b83[_0xa7f7('0x70')]=(_0x329b83[_0xa7f7('0x71')]||_0x329b83['applicationdata'])['toLowerCase']();if(_[_0xa7f7('0x72')](_0x329b83[_0xa7f7('0x70')],_0xa7f7('0x73'))){if(_[_0xa7f7('0x16')](this[_0xa7f7('0xa')][_0x329b83[_0xa7f7('0x1b')]]))this['applications'][_0x329b83[_0xa7f7('0x1b')]]={};logger[_0xa7f7('0x26')](_0xa7f7('0x74'),_0x329b83[_0xa7f7('0x1b')],_0x329b83[_0xa7f7('0x6d')],_0x329b83[_0xa7f7('0x70')]);var _0x1ab296=_0x329b83['applicationdata']['split']('=');var _0x1d7458=_0x1ab296[0x0][_0xa7f7('0x75')](/cdr\((.*)\)/);if(_0x1d7458)this['applications'][_0x329b83['uniqueid']][_0x1d7458[0x1]]=_0x1ab296[0x1];}}}}catch(_0x87c78f){logger[_0xa7f7('0x2d')]('[%s][voiceDialReport][newexten]',_0x329b83[_0xa7f7('0x1b')],util[_0xa7f7('0x1c')](_0x87c78f,{'showHidden':![],'depth':null}));}};module[_0xa7f7('0x76')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 035e5e9..166d9db 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 _0x2b84=['secondtransfereruniqueid','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','ATTENDEDTRANSFER','transfertype','origtransfereruniqueid','switch','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','context','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstop]','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','mohtime','application','applicationdata','split','match','[%s][voiceQueueReport][newexten]','exports','lodash','util','md5','ioredis','../../../config/environment','ami','../ami','../model/queueReport','redis','defaults','localhost','socket.io-emitter','prototype','tail','finally','sequence','queueReports','agents','channels','queueChannels','voiceQueues','flagQueueSummary','campaigns','variables','queuesummary','bind','queuesummarycomplete','syncQueueSummaryComplete','queuecallerjoin','syncQueueCallerJoin','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','varset','syncVarSet','hangup','syncHangup','syncFullyBooted','syncNewExten','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','isEmpty','hasOwnProperty','originated','talking','pTalking','unlockRR','clearZombieChannels','enqueue','isNil','Action','status','catch','message','inspect','error','[%s][voiceQueueReport][checkQueueReport]','[%s][voiceQueueReport][checkVariables]','clearQueueReport','emitVoiceQueueChannelRemove','clearqueuereport','emit','emitVoiceQueueChannelSave','debug',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','format','voice:queue:%s','voice_queue_channel:save','voice_queue_presence:save','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:remove\x20event:','name','voice_queue_channel:remove','type','inbound','answered','loggedIn','sumDuration','sumHoldTime','total','waiting','Trunk','active','callerid','Interval','stringify',']\x20sending\x20voice_queue:save\x20event:','isNotNull','isUndefined','loopQueueShow','queues','[voiceQueueReport][queues]','[voiceQueueReport][queuesummary]','syncQueueSummary','queue','[voiceQueueReport][queuesummary]\x20event:','info','callers','available','toNumber','loggedin','emitVoiceQueueSummary','[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:','custom:queuesummary','[%s][voiceQueueReport][queuecallerjoin]','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','routealias','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','keys','syncQueueCallerAbandon','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','queuecallerabandon','connectedlinenum','connectedlinename','[%s][voiceQueueReport][agentconnect]','queuecallercomplete','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','assigned','membername','queuecallerexit','queuecallerexitAt','transfer','reason','queuecallerexitreason','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','channel','toLowerCase','local/','linkedid','add','seconds','transferexten','destexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][varset]','addVariable','variable','value','queuestatus','timeout','queuecallerleaveAt','queueposition','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','[%s][voiceQueueReport][hangup]','length','unmanaged','diff','milliseconds','sumBillable','lastevent','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','cause-txt','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','ATTENDED'];(function(_0x56bb4f,_0x41c772){var _0x275daf=function(_0x3b885f){while(--_0x3b885f){_0x56bb4f['push'](_0x56bb4f['shift']());}};_0x275daf(++_0x41c772);}(_0x2b84,0x105));var _0x42b8=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x2b84[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0x42b8('0x0'));var moment=require('moment');var util=require(_0x42b8('0x1'));var md5=require(_0x42b8('0x2'));var Redis=require(_0x42b8('0x3'));var config=require(_0x42b8('0x4'));var logger=require('../../../config/logger')(_0x42b8('0x5'));var ami=require(_0x42b8('0x6'));var QueueReport=require(_0x42b8('0x7'));config[_0x42b8('0x8')]=_[_0x42b8('0x9')](config[_0x42b8('0x8')],{'host':_0x42b8('0xa'),'port':0x18eb});var io=require(_0x42b8('0xb'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x42b8('0xc')]['enqueue']=function(_0x213fec){this['tail']=this['tail']?this[_0x42b8('0xd')][_0x42b8('0xe')](_0x213fec):_0x213fec();};function VoiceQueueReport(_0x2e59e8){this[_0x42b8('0xf')]=new Sequence();this[_0x42b8('0x10')]={};this['agents']=_0x2e59e8[_0x42b8('0x11')];this[_0x42b8('0x12')]=_0x2e59e8[_0x42b8('0x13')];this['voiceQueues']=_0x2e59e8[_0x42b8('0x14')];this[_0x42b8('0x15')]=!![];this[_0x42b8('0x16')]=_0x2e59e8['campaigns'];this[_0x42b8('0x17')]={};ami['on'](_0x42b8('0x18'),this['syncQueueSummary'][_0x42b8('0x19')](this));ami['on'](_0x42b8('0x1a'),this[_0x42b8('0x1b')][_0x42b8('0x19')](this));ami['on'](_0x42b8('0x1c'),this[_0x42b8('0x1d')][_0x42b8('0x19')](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon'][_0x42b8('0x19')](this));ami['on'](_0x42b8('0x1e'),this[_0x42b8('0x1f')]['bind'](this));ami['on'](_0x42b8('0x20'),this[_0x42b8('0x21')]['bind'](this));ami['on'](_0x42b8('0x22'),this[_0x42b8('0x23')][_0x42b8('0x19')](this));ami['on'](_0x42b8('0x24'),this[_0x42b8('0x25')][_0x42b8('0x19')](this));ami['on'](_0x42b8('0x26'),this[_0x42b8('0x27')][_0x42b8('0x19')](this));ami['on']('fullybooted',this[_0x42b8('0x28')][_0x42b8('0x19')](this));ami['on']('newexten',this[_0x42b8('0x29')][_0x42b8('0x19')](this));ami['on'](_0x42b8('0x2a'),this[_0x42b8('0x2b')][_0x42b8('0x19')](this));ami['on'](_0x42b8('0x2c'),this[_0x42b8('0x2d')][_0x42b8('0x19')](this));ami['on'](_0x42b8('0x2e'),this[_0x42b8('0x2f')][_0x42b8('0x19')](this));ami['on'](_0x42b8('0x30'),this[_0x42b8('0x31')][_0x42b8('0x19')](this));this[_0x42b8('0x32')]();this['loopQueueShow']();}function clearChannels(_0x1b9a47){if(!_[_0x42b8('0x33')](_0x1b9a47)){for(var _0x7eca17 in _0x1b9a47){if(_0x1b9a47[_0x42b8('0x34')](_0x7eca17)){delete _0x1b9a47[_0x7eca17];}}}}function clearCampaigns(_0x668e64){if(!_[_0x42b8('0x33')](_0x668e64)){for(var _0x296470 in _0x668e64){if(_0x668e64[_0x42b8('0x34')](_0x296470)){_0x668e64[_0x296470][_0x42b8('0x35')]=0x0;}}}}function clearVoiceQueues(_0x11ff3c){if(!_[_0x42b8('0x33')](_0x11ff3c)){for(var _0x4db3e9 in _0x11ff3c){if(_0x11ff3c['hasOwnProperty'](_0x4db3e9)){_0x11ff3c[_0x4db3e9][_0x42b8('0x35')]=0x0;_0x11ff3c[_0x4db3e9][_0x42b8('0x36')]=0x0;_0x11ff3c[_0x4db3e9][_0x42b8('0x37')]=0x0;_0x11ff3c[_0x4db3e9]['waiting']=0x0;_0x11ff3c[_0x4db3e9]['queueStatusComplete']=!![];}}}}function clearAgentBooked(_0x12d16d){if(!_[_0x42b8('0x33')](_0x12d16d)){for(var _0x2508fa in _0x12d16d){if(_0x12d16d['hasOwnProperty'](_0x2508fa)){_0x12d16d[_0x2508fa][_0x42b8('0x38')]=!![];}}}}VoiceQueueReport[_0x42b8('0xc')][_0x42b8('0x39')]=function(){var _0x3a3872=this;for(var _0x23e7d4 in this[_0x42b8('0x12')]){if(this[_0x42b8('0x12')][_0x42b8('0x34')](_0x23e7d4)&&!this[_0x42b8('0x12')][_0x23e7d4]['switch']){this[_0x42b8('0xf')][_0x42b8('0x3a')](function(){if(!_[_0x42b8('0x3b')](_0x3a3872[_0x42b8('0x12')][_0x23e7d4])){return ami[_0x42b8('0x3c')]({'action':_0x42b8('0x3d'),'channel':_0x3a3872[_0x42b8('0x12')][_0x23e7d4]['channel']})[_0x42b8('0x3e')](function(_0x3006ff){if(_0x3006ff[_0x42b8('0x3f')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x3a3872[_0x42b8('0x12')][_0x23e7d4]){delete _0x3a3872['channels'][_0x23e7d4];logger['error']('[%s][voiceQueueReport][checkChannel]',_0x23e7d4,util[_0x42b8('0x40')](_0x3006ff,{'showHidden':![],'depth':null}));}if(_0x3a3872[_0x42b8('0x10')][_0x23e7d4]){delete _0x3a3872[_0x42b8('0x10')][_0x23e7d4];logger[_0x42b8('0x41')](_0x42b8('0x42'),_0x23e7d4,util[_0x42b8('0x40')](_0x3006ff,{'showHidden':![],'depth':null}));}if(_0x3a3872[_0x42b8('0x17')][_0x23e7d4]){delete _0x3a3872[_0x42b8('0x17')][_0x23e7d4];logger[_0x42b8('0x41')](_0x42b8('0x43'),_0x23e7d4,util[_0x42b8('0x40')](_0x3006ff,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport['prototype'][_0x42b8('0x28')]=function(){logger[_0x42b8('0x41')]('[FullyBooted]\x20clear\x20realtime');clearChannels(this['channels']);this[_0x42b8('0x44')](this[_0x42b8('0x10')]);clearAgentBooked(this[_0x42b8('0x11')]);clearVoiceQueues(this[_0x42b8('0x14')]);clearCampaigns(this[_0x42b8('0x16')]);};VoiceQueueReport[_0x42b8('0xc')]['clearQueueReport']=function(_0x4afeb7){var _0x390d62=this;if(!_[_0x42b8('0x33')](_0x4afeb7)){for(var _0x29a948 in _0x4afeb7){if(_0x4afeb7[_0x42b8('0x34')](_0x29a948)){_0x390d62[_0x42b8('0x45')](_0x4afeb7[_0x29a948],_0x42b8('0x46'));delete _0x4afeb7[_0x29a948];}}}};VoiceQueueReport['prototype'][_0x42b8('0x47')]=function(_0x18c31d,_0x1c44bf,_0x1b0777){io['to'](_0x18c31d)[_0x42b8('0x47')](_0x1c44bf,_0x1b0777);};VoiceQueueReport['prototype'][_0x42b8('0x48')]=function(_0x31d906,_0x50fcfe){logger[_0x42b8('0x49')]('[%s][voiceQueueReport]['+_0x50fcfe+_0x42b8('0x4a'),_0x31d906[_0x42b8('0x4b')],util[_0x42b8('0x40')](_0x31d906,{'showHidden':![],'depth':null}));this['emit'](util[_0x42b8('0x4c')](_0x42b8('0x4d'),_0x31d906['name']),_0x42b8('0x4e'),_0x31d906);io['emit'](_0x42b8('0x4f'),_0x31d906);};VoiceQueueReport[_0x42b8('0xc')]['emitVoiceQueueChannelRemove']=function(_0x38542d,_0x46bfa7){logger[_0x42b8('0x49')](_0x42b8('0x50')+_0x46bfa7+_0x42b8('0x51'),_0x38542d[_0x42b8('0x4b')],util[_0x42b8('0x40')](_0x38542d,{'showHidden':![],'depth':null}));this[_0x42b8('0x47')](util[_0x42b8('0x4c')](_0x42b8('0x4d'),_0x38542d[_0x42b8('0x52')]),_0x42b8('0x53'),_0x38542d);io[_0x42b8('0x47')]('voice_queue_presence:remove',_0x38542d);};VoiceQueueReport[_0x42b8('0xc')]['emitVoiceQueueSummary']=function(_0x1e3ea4,_0x4338fd){if(_0x1e3ea4[_0x42b8('0x54')]===_0x42b8('0x55')){var _0x250745={'id':_0x1e3ea4['id'],'name':_0x1e3ea4['name'],'strategy':_0x1e3ea4['strategy'],'answered':_0x1e3ea4[_0x42b8('0x56')],'available':_0x1e3ea4['available'],'loggedIn':_0x1e3ea4[_0x42b8('0x57')],'pTalking':_0x1e3ea4[_0x42b8('0x37')],'sumBillable':_0x1e3ea4['sumBillable'],'sumDuration':_0x1e3ea4[_0x42b8('0x58')],'sumHoldTime':_0x1e3ea4[_0x42b8('0x59')]||0x0,'talking':_0x1e3ea4[_0x42b8('0x36')],'total':_0x1e3ea4[_0x42b8('0x5a')],'type':_0x1e3ea4['type'],'unmanaged':_0x1e3ea4['unmanaged'],'abandoned':_0x1e3ea4['abandoned'],'waiting':_0x1e3ea4[_0x42b8('0x5b')]};if(_0x1e3ea4[_0x42b8('0x5c')]){_0x250745[_0x42b8('0x5c')]={'id':_0x1e3ea4[_0x42b8('0x5c')]['id'],'name':_0x1e3ea4[_0x42b8('0x5c')][_0x42b8('0x52')],'active':_0x1e3ea4['Trunk'][_0x42b8('0x5d')],'callerid':_0x1e3ea4[_0x42b8('0x5c')][_0x42b8('0x5e')]};}if(_0x1e3ea4['Interval']){_0x250745[_0x42b8('0x5f')]={'id':_0x1e3ea4[_0x42b8('0x5f')]['id'],'name':_0x1e3ea4[_0x42b8('0x5f')][_0x42b8('0x52')]};}var _0x56f6fa=md5(JSON[_0x42b8('0x60')](_0x250745));if(_0x1e3ea4['md5']!==_0x56f6fa){_0x1e3ea4[_0x42b8('0x2')]=_0x56f6fa;logger[_0x42b8('0x49')]('[voiceQueueReport]['+_0x4338fd+_0x42b8('0x61'),util[_0x42b8('0x40')](_0x250745,{'showHidden':![],'depth':null}));this[_0x42b8('0x47')](util[_0x42b8('0x4c')](_0x42b8('0x4d'),_0x250745[_0x42b8('0x52')]),'voice_queue:save',_0x250745);}}};VoiceQueueReport['prototype'][_0x42b8('0x62')]=function(_0x26dfcc){return _0x26dfcc!==null&&!_[_0x42b8('0x63')](_0x26dfcc);};VoiceQueueReport[_0x42b8('0xc')][_0x42b8('0x64')]=function(){var _0x4fef11=this;setInterval(function(){_0x4fef11['clearZombieChannels']();ami[_0x42b8('0x3c')]({'action':_0x42b8('0x65')})[_0x42b8('0x3e')](function(_0x311245){logger[_0x42b8('0x41')](_0x42b8('0x66'),util['inspect'](_0x311245,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport['prototype']['loopQueueSummary']=function(){var _0x5efe01=this;setInterval(function(){if(_0x5efe01[_0x42b8('0x15')]){return ami[_0x42b8('0x3c')]({'action':_0x42b8('0x18')})['then'](function(_0x5ed1de){_0x5efe01['flagQueueSummary']=![];})[_0x42b8('0x3e')](function(_0x4c9ec2){logger[_0x42b8('0x41')](_0x42b8('0x67'),util[_0x42b8('0x40')](_0x4c9ec2,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport['prototype'][_0x42b8('0x68')]=function(_0x2d2b93){try{if(this[_0x42b8('0x62')](_0x2d2b93)&&this[_0x42b8('0x62')](_0x2d2b93[_0x42b8('0x69')])){logger[_0x42b8('0x49')](_0x42b8('0x6a'),util[_0x42b8('0x40')](_0x2d2b93,{'showHidden':![],'depth':null}));if(this['voiceQueues'][_0x2d2b93[_0x42b8('0x69')]]){logger[_0x42b8('0x6b')]('[voiceQueueReport][queuesummary]\x20name:%s',_0x2d2b93[_0x42b8('0x69')]);var _0x19ec3e=_['countBy'](this[_0x42b8('0x12')],'queue')[_0x2d2b93['queue']]||0x0;var _0x21c227=_0x19ec3e-_0x2d2b93[_0x42b8('0x6c')];if(this[_0x42b8('0x14')][_0x2d2b93[_0x42b8('0x69')]]['waiting']!==_['toNumber'](_0x2d2b93[_0x42b8('0x6c')])||this[_0x42b8('0x14')][_0x2d2b93[_0x42b8('0x69')]][_0x42b8('0x57')]!==_['toNumber'](_0x2d2b93['loggedin'])||this[_0x42b8('0x14')][_0x2d2b93[_0x42b8('0x69')]][_0x42b8('0x6d')]!==_[_0x42b8('0x6e')](_0x2d2b93[_0x42b8('0x6d')])||this['voiceQueues'][_0x2d2b93[_0x42b8('0x69')]]['talking']!==_0x21c227){this[_0x42b8('0x14')][_0x2d2b93['queue']][_0x42b8('0x5b')]=_[_0x42b8('0x6e')](_0x2d2b93[_0x42b8('0x6c')]);this['voiceQueues'][_0x2d2b93[_0x42b8('0x69')]][_0x42b8('0x57')]=_[_0x42b8('0x6e')](_0x2d2b93[_0x42b8('0x6f')]);this[_0x42b8('0x14')][_0x2d2b93[_0x42b8('0x69')]]['available']=_[_0x42b8('0x6e')](_0x2d2b93[_0x42b8('0x6d')]);this[_0x42b8('0x14')][_0x2d2b93[_0x42b8('0x69')]][_0x42b8('0x36')]=_0x21c227>0x0?_0x21c227:0x0;this[_0x42b8('0x14')][_0x2d2b93[_0x42b8('0x69')]][_0x42b8('0x36')]=this[_0x42b8('0x14')][_0x2d2b93[_0x42b8('0x69')]][_0x42b8('0x36')]>_[_0x42b8('0x6e')](_0x2d2b93[_0x42b8('0x6f')])?_['toNumber'](_0x2d2b93[_0x42b8('0x6f')]):this[_0x42b8('0x14')][_0x2d2b93[_0x42b8('0x69')]]['talking'];this[_0x42b8('0x70')](this[_0x42b8('0x14')][_0x2d2b93['queue']],_0x42b8('0x18'));}logger[_0x42b8('0x49')](_0x42b8('0x71'),util[_0x42b8('0x40')](this[_0x42b8('0x14')][_0x2d2b93[_0x42b8('0x69')]],{'showHidden':![],'depth':null}));ami[_0x42b8('0x47')](_0x42b8('0x72'),this[_0x42b8('0x14')][_0x2d2b93[_0x42b8('0x69')]]);}}}catch(_0x3e2d34){logger[_0x42b8('0x41')](_0x42b8('0x67'),util[_0x42b8('0x40')](_0x3e2d34,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x42b8('0xc')][_0x42b8('0x1b')]=function(_0x365f9e){logger[_0x42b8('0x49')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0x42b8('0x40')](_0x365f9e,{'showHidden':![],'depth':null}));this[_0x42b8('0x15')]=!![];};VoiceQueueReport[_0x42b8('0xc')][_0x42b8('0x1d')]=function(_0x1ade51){try{if(this[_0x42b8('0x62')](_0x1ade51)){logger[_0x42b8('0x49')](_0x42b8('0x73'),_0x1ade51[_0x42b8('0x4b')],util[_0x42b8('0x40')](_0x1ade51,{'showHidden':![],'depth':null}));if(_[_0x42b8('0x63')](this['queueReports'][_0x1ade51[_0x42b8('0x4b')]]))this[_0x42b8('0x10')][_0x1ade51[_0x42b8('0x4b')]]=[];if(_[_0x42b8('0x63')](this[_0x42b8('0x12')][_0x1ade51[_0x42b8('0x4b')]]))this[_0x42b8('0x12')][_0x1ade51[_0x42b8('0x4b')]]={};var _0x144293=new QueueReport();_0x144293[_0x42b8('0x52')]=_0x1ade51['queue'];_0x144293[_0x42b8('0x54')]=this[_0x42b8('0x14')][_0x144293['name']]&&this[_0x42b8('0x14')][_0x144293[_0x42b8('0x52')]]['type']?this[_0x42b8('0x14')][_0x144293[_0x42b8('0x52')]][_0x42b8('0x54')]||_0x42b8('0x55'):_0x42b8('0x55');_0x144293[_0x42b8('0x69')]=_0x1ade51['queue'];_0x144293[_0x42b8('0x74')]=moment()[_0x42b8('0x4c')](_0x42b8('0x75'));_0x144293[_0x42b8('0x76')]=_0x1ade51[_0x42b8('0x76')];_0x144293[_0x42b8('0x77')]=_0x1ade51[_0x42b8('0x77')];_0x144293[_0x42b8('0x4b')]=_0x1ade51['uniqueid'];_0x144293[_0x42b8('0x78')]=this[_0x42b8('0x12')][_0x1ade51[_0x42b8('0x4b')]]['routealias'];logger[_0x42b8('0x6b')](_0x42b8('0x79'),_0x144293[_0x42b8('0x52')],_0x144293[_0x42b8('0x54')]);_['merge'](_0x144293,_['pick'](_0x1ade51,_[_0x42b8('0x7a')](_0x144293)));this[_0x42b8('0x10')][_0x1ade51[_0x42b8('0x4b')]]['push'](_0x144293);this[_0x42b8('0x12')][_0x1ade51[_0x42b8('0x4b')]]=_0x144293;this['emitVoiceQueueChannelSave'](_0x144293,_0x42b8('0x1c'));}}catch(_0x4d1c68){logger['error'](_0x42b8('0x73'),_0x1ade51[_0x42b8('0x4b')],util[_0x42b8('0x40')](_0x4d1c68,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x42b8('0xc')][_0x42b8('0x7b')]=function(_0x4060a1){try{if(this[_0x42b8('0x62')](_0x4060a1)){logger['debug'](_0x42b8('0x7c'),_0x4060a1[_0x42b8('0x4b')],util['inspect'](_0x4060a1,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x4060a1[_0x42b8('0x4b')]]){var _0x4f38bc=_[_0x42b8('0x7d')](this[_0x42b8('0x10')][_0x4060a1['uniqueid']]);_0x4f38bc['queuecallercomplete']=![];_0x4f38bc[_0x42b8('0x7e')]=null;_0x4f38bc[_0x42b8('0x7f')]=_0x4060a1[_0x42b8('0x7f')];_0x4f38bc['originalposition']=_0x4060a1[_0x42b8('0x80')];_0x4f38bc['queuecallerabandon']=!![];_0x4f38bc[_0x42b8('0x81')]=moment()['format'](_0x42b8('0x75'));_0x4f38bc['queuecallerexitreason']='ABANDONED';_0x4f38bc[_0x42b8('0x82')]=null;logger[_0x42b8('0x6b')](_0x42b8('0x83'),_0x4f38bc['name'],_0x4f38bc[_0x42b8('0x54')]);this['channels'][_0x4060a1['uniqueid']]=_0x4f38bc;this[_0x42b8('0x45')](_0x4f38bc,_0x42b8('0x84'));}}}catch(_0x41f14c){logger[_0x42b8('0x41')]('[%s][voiceQueueReport][queuecallerabandon]',_0x4060a1[_0x42b8('0x4b')],util[_0x42b8('0x40')](_0x41f14c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x42b8('0xc')][_0x42b8('0x1f')]=function(_0x2c2799){try{if(this[_0x42b8('0x62')](_0x2c2799)){logger[_0x42b8('0x49')]('[%s][voiceQueueReport][queuecallerleave]',_0x2c2799[_0x42b8('0x4b')],util[_0x42b8('0x40')](_0x2c2799,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x2c2799['uniqueid']]){var _0x43a772=_['last'](this['queueReports'][_0x2c2799[_0x42b8('0x4b')]]);_0x43a772['queuecallerleaveAt']=moment()[_0x42b8('0x4c')](_0x42b8('0x75'));_0x43a772[_0x42b8('0x85')]=_0x2c2799[_0x42b8('0x85')];_0x43a772[_0x42b8('0x86')]=_0x2c2799[_0x42b8('0x86')];logger[_0x42b8('0x6b')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x43a772[_0x42b8('0x52')],_0x43a772[_0x42b8('0x54')],_0x2c2799[_0x42b8('0x85')],_0x2c2799[_0x42b8('0x86')]);this['channels'][_0x2c2799[_0x42b8('0x4b')]]=_0x43a772;this[_0x42b8('0x48')](_0x43a772,_0x42b8('0x1e'));}}}catch(_0x380a74){logger[_0x42b8('0x41')]('[%s][voiceQueueReport][queuecallerleave]',_0x2c2799[_0x42b8('0x4b')],util['inspect'](_0x380a74,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x42b8('0xc')][_0x42b8('0x23')]=function(_0x7a2d0d){try{if(this[_0x42b8('0x62')](_0x7a2d0d)){logger['debug'](_0x42b8('0x87'),_0x7a2d0d['uniqueid'],util['inspect'](_0x7a2d0d,{'showHidden':![],'depth':null}));if(this[_0x42b8('0x10')][_0x7a2d0d[_0x42b8('0x4b')]]){var _0x341676=_['last'](this[_0x42b8('0x10')][_0x7a2d0d[_0x42b8('0x4b')]]);_0x341676[_0x42b8('0x88')]=!![];_0x341676['queuecallerexitreason']=_0x42b8('0x89');logger[_0x42b8('0x6b')](_0x42b8('0x8a'),_0x341676['name'],_0x341676[_0x42b8('0x54')]);}}}catch(_0x3895a9){logger['error'](_0x42b8('0x87'),_0x7a2d0d[_0x42b8('0x4b')],util[_0x42b8('0x40')](_0x3895a9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x42b8('0xc')][_0x42b8('0x21')]=function(_0x4bb0f5){try{if(this[_0x42b8('0x62')](_0x4bb0f5)){logger[_0x42b8('0x49')](_0x42b8('0x8b'),_0x4bb0f5['uniqueid'],util['inspect'](_0x4bb0f5,{'showHidden':![],'depth':null}));if(this[_0x42b8('0x10')][_0x4bb0f5[_0x42b8('0x4b')]]){var _0x29e44d=_['last'](this[_0x42b8('0x10')][_0x4bb0f5[_0x42b8('0x4b')]]);_0x29e44d['queuecallerabandon']=![];_0x29e44d['queuecallerabandonAt']=null;_0x29e44d[_0x42b8('0x8c')]=!![];_0x29e44d[_0x42b8('0x82')]=_0x4bb0f5[_0x42b8('0x8d')];_0x29e44d[_0x42b8('0x7f')]=_0x4bb0f5[_0x42b8('0x7f')];_0x29e44d[_0x42b8('0x88')]=!![];_0x29e44d[_0x42b8('0x8e')]=![];_0x29e44d[_0x42b8('0x8f')]=null;if(!_0x29e44d[_0x42b8('0x90')]){if(_0x4bb0f5[_0x42b8('0x91')]==_0x42b8('0x90')){_0x29e44d[_0x42b8('0x92')]=_0x42b8('0x93');logger['info'](_0x42b8('0x94'),_0x29e44d[_0x42b8('0x52')],_0x29e44d['type']);}else{if(_[_0x42b8('0x95')](_0x4bb0f5[_0x42b8('0x96')][_0x42b8('0x97')](),_0x42b8('0x98'))){if(this['queueReports'][_0x4bb0f5['linkedid']]){var _0x3ff5ba=_[_0x42b8('0x7d')](this[_0x42b8('0x10')][_0x4bb0f5[_0x42b8('0x99')]]);_0x3ff5ba['queuecallercomplete']=![];_0x3ff5ba[_0x42b8('0x8e')]=!![];_0x3ff5ba[_0x42b8('0x8f')]=moment(_0x29e44d[_0x42b8('0x74')])[_0x42b8('0x9a')](_0x4bb0f5[_0x42b8('0x7f')],_0x42b8('0x9b'))[_0x42b8('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');_0x3ff5ba[_0x42b8('0x92')]='FORWARDTRANSFER';_0x3ff5ba[_0x42b8('0x90')]=!![];_0x3ff5ba['transfertype']='FORWARD';_0x3ff5ba[_0x42b8('0x9c')]=_0x4bb0f5[_0x42b8('0x9d')];_0x3ff5ba[_0x42b8('0x9e')]=_0x4bb0f5[_0x42b8('0x4b')];logger[_0x42b8('0x6b')](_0x42b8('0x9f'),_0x3ff5ba[_0x42b8('0x52')],_0x3ff5ba[_0x42b8('0x54')]);var _0x5560e8=this[_0x42b8('0x10')][_0x4bb0f5[_0x42b8('0x99')]];this[_0x42b8('0x10')][_0x4bb0f5['linkedid']]=this[_0x42b8('0x10')][_0x4bb0f5[_0x42b8('0x4b')]];this[_0x42b8('0x10')][_0x4bb0f5[_0x42b8('0x4b')]]=_0x5560e8;}}else{_0x29e44d[_0x42b8('0x92')]=_0x42b8('0xa0')+_0x4bb0f5[_0x42b8('0x91')][_0x42b8('0xa1')]();logger[_0x42b8('0x6b')](_0x42b8('0xa2'),_0x29e44d[_0x42b8('0x52')],_0x29e44d[_0x42b8('0x54')],_0x29e44d[_0x42b8('0x92')]);}}}this['channels'][_0x4bb0f5['uniqueid']]=_0x29e44d;this[_0x42b8('0x45')](_0x29e44d,_0x42b8('0x20'));}}}catch(_0x12ed31){logger[_0x42b8('0x41')](_0x42b8('0x8b'),_0x4bb0f5[_0x42b8('0x4b')],util[_0x42b8('0x40')](_0x12ed31,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x42b8('0xc')][_0x42b8('0x25')]=function(_0x3a575c){try{if(this['isNotNull'](_0x3a575c)){logger['debug'](_0x42b8('0xa3'),_0x3a575c[_0x42b8('0x4b')],util['inspect'](_0x3a575c,{'showHidden':![],'depth':null}));this[_0x42b8('0xa4')](_0x3a575c[_0x42b8('0x4b')],_[_0x42b8('0x7a')](_0x3a575c[_0x42b8('0xa5')])[0x0],_0x3a575c[_0x42b8('0xa6')]);if(this[_0x42b8('0x10')][_0x3a575c['uniqueid']]){var _0x5e56b8=_[_0x42b8('0x7d')](this['queueReports'][_0x3a575c[_0x42b8('0x4b')]]);if(_0x5e56b8){if(this['isNotNull'](_0x3a575c[_0x42b8('0xa5')])&&this[_0x42b8('0x62')](_0x3a575c[_0x42b8('0xa5')][_0x42b8('0xa7')])){switch(_0x3a575c[_0x42b8('0xa6')]){case'CONTINUE':_0x5e56b8[_0x42b8('0x8e')]=![];_0x5e56b8['queuecallerexitAt']=null;break;case'TIMEOUT':_0x5e56b8['lastevent']=_0x42b8('0xa8');_0x5e56b8[_0x42b8('0x8e')]=!![];_0x5e56b8['queuecallerexitAt']=moment()[_0x42b8('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');_0x5e56b8[_0x42b8('0xa9')]=moment()[_0x42b8('0x4c')](_0x42b8('0x75'));logger[_0x42b8('0x49')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x3a575c['uniqueid'],util[_0x42b8('0x40')](_0x5e56b8,{'showHidden':![],'depth':null}));ami[_0x42b8('0x47')]('custom:timeout',_0x5e56b8);break;default:_0x5e56b8[_0x42b8('0x8e')]=!![];_0x5e56b8['queuecallerexitAt']=moment()[_0x42b8('0x4c')](_0x42b8('0x75'));_0x5e56b8[_0x42b8('0xa9')]=moment()['format'](_0x42b8('0x75'));}_0x5e56b8[_0x42b8('0x84')]=![];_0x5e56b8[_0x42b8('0x81')]=null;_0x5e56b8['queuecallerexitreason']=_0x3a575c[_0x42b8('0xa6')];this[_0x42b8('0x12')][_0x3a575c['uniqueid']]=_0x5e56b8;this[_0x42b8('0x45')](_0x5e56b8,'varset');}else if(this['isNotNull'](_0x3a575c[_0x42b8('0xa5')])&&this['isNotNull'](_0x3a575c[_0x42b8('0xa5')][_0x42b8('0xaa')])){if(!_0x5e56b8[_0x42b8('0x84')]){_0x5e56b8[_0x42b8('0x8e')]=!![];_0x5e56b8[_0x42b8('0x8f')]=moment()['format'](_0x42b8('0x75'));_0x5e56b8[_0x42b8('0x92')]='EXITWITHKEY';_0x5e56b8[_0x42b8('0xa9')]=moment()['format'](_0x42b8('0x75'));this[_0x42b8('0x12')][_0x3a575c['uniqueid']]=_0x5e56b8;}}logger[_0x42b8('0x6b')](_0x42b8('0xab'),_0x3a575c['uniqueid'],_0x5e56b8['name'],_0x5e56b8[_0x42b8('0x54')],_['keys'](_0x3a575c['variable'])[0x0],_0x3a575c[_0x42b8('0xa6')]);_0x5e56b8[_0x42b8('0x17')]=this['variables'][_0x3a575c[_0x42b8('0x4b')]];}}}}catch(_0x23607c){logger[_0x42b8('0x41')]('[%s][voiceQueueReport][varset]',_0x3a575c[_0x42b8('0x4b')],util[_0x42b8('0x40')](_0x23607c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x42b8('0xc')][_0x42b8('0xa4')]=function(_0x4c587f,_0x4d4162,_0x3b4cd4){var _0x5012c9=[_0x42b8('0xac'),_0x42b8('0xad'),_0x42b8('0xae'),_0x42b8('0xaf'),_0x42b8('0xb0'),_0x42b8('0xb1'),_0x42b8('0xb2'),_0x42b8('0xb3'),_0x42b8('0xb4'),_0x42b8('0xb5'),_0x42b8('0xb6'),_0x42b8('0xb7'),_0x42b8('0xb8'),'memberdynamic',_0x42b8('0xb9'),_0x42b8('0xba'),_0x42b8('0x8d'),_0x42b8('0xbb'),_0x42b8('0xbc')];if(!_[_0x42b8('0x3b')](_0x4d4162)&&!_[_0x42b8('0xbd')](_0x5012c9,_0x4d4162)){if(_['isUndefined'](this['variables'][_0x4c587f])){this['variables'][_0x4c587f]={};}this['variables'][_0x4c587f][_0x4d4162]=_0x3b4cd4;}};VoiceQueueReport['prototype'][_0x42b8('0x27')]=function(_0x59b131){try{if(this[_0x42b8('0x62')](_0x59b131)){logger['debug'](_0x42b8('0xbe'),_0x59b131['uniqueid'],util[_0x42b8('0x40')](_0x59b131,{'showHidden':![],'depth':null}));if(this[_0x42b8('0x10')][_0x59b131[_0x42b8('0x4b')]]){for(var _0x48512a=0x0,_0x47fc42={};_0x48512a0x0?_0x2e6f57:0x0;this[_0x14bd('0xf')][_0xbeccdc[_0x14bd('0x67')]]['talking']=this[_0x14bd('0xf')][_0xbeccdc[_0x14bd('0x67')]][_0x14bd('0x52')]>_[_0x14bd('0x6c')](_0xbeccdc[_0x14bd('0x6d')])?_[_0x14bd('0x6c')](_0xbeccdc[_0x14bd('0x6d')]):this[_0x14bd('0xf')][_0xbeccdc[_0x14bd('0x67')]][_0x14bd('0x52')];this['emitVoiceQueueSummary'](this[_0x14bd('0xf')][_0xbeccdc['queue']],_0x14bd('0x13'));}logger[_0x14bd('0x42')](_0x14bd('0x6e'),util[_0x14bd('0x3a')](this[_0x14bd('0xf')][_0xbeccdc[_0x14bd('0x67')]],{'showHidden':![],'depth':null}));ami[_0x14bd('0x40')]('custom:queuesummary',this[_0x14bd('0xf')][_0xbeccdc[_0x14bd('0x67')]]);}}}catch(_0x1549f4){logger[_0x14bd('0x3b')](_0x14bd('0x65'),util[_0x14bd('0x3a')](_0x1549f4,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueSummaryComplete']=function(_0x2b03a8){logger[_0x14bd('0x42')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0x14bd('0x3a')](_0x2b03a8,{'showHidden':![],'depth':null}));this['flagQueueSummary']=!![];};VoiceQueueReport[_0x14bd('0x9')]['syncQueueCallerJoin']=function(_0x20ccc0){try{if(this[_0x14bd('0x5f')](_0x20ccc0)){logger[_0x14bd('0x42')](_0x14bd('0x6f'),_0x20ccc0[_0x14bd('0x48')],util[_0x14bd('0x3a')](_0x20ccc0,{'showHidden':![],'depth':null}));if(_[_0x14bd('0x60')](this[_0x14bd('0xc')][_0x20ccc0[_0x14bd('0x48')]]))this['queueReports'][_0x20ccc0[_0x14bd('0x48')]]=[];if(_['isUndefined'](this[_0x14bd('0x2f')][_0x20ccc0['uniqueid']]))this['channels'][_0x20ccc0[_0x14bd('0x48')]]={};var _0x54a25e=new QueueReport();_0x54a25e[_0x14bd('0x44')]=_0x20ccc0[_0x14bd('0x67')];_0x54a25e[_0x14bd('0x54')]=this[_0x14bd('0xf')][_0x54a25e['name']]&&this['voiceQueues'][_0x54a25e[_0x14bd('0x44')]][_0x14bd('0x54')]?this[_0x14bd('0xf')][_0x54a25e[_0x14bd('0x44')]][_0x14bd('0x54')]||_0x14bd('0x4c'):_0x14bd('0x4c');_0x54a25e[_0x14bd('0x67')]=_0x20ccc0[_0x14bd('0x67')];_0x54a25e[_0x14bd('0x70')]=moment()[_0x14bd('0x43')](_0x14bd('0x71'));_0x54a25e[_0x14bd('0x72')]=_0x20ccc0[_0x14bd('0x72')];_0x54a25e[_0x14bd('0x73')]=_0x20ccc0['count'];_0x54a25e['uniqueid']=_0x20ccc0[_0x14bd('0x48')];_0x54a25e[_0x14bd('0x74')]=this[_0x14bd('0x2f')][_0x20ccc0[_0x14bd('0x48')]][_0x14bd('0x74')];logger[_0x14bd('0x75')](_0x14bd('0x76'),_0x54a25e[_0x14bd('0x44')],_0x54a25e[_0x14bd('0x54')]);_[_0x14bd('0x77')](_0x54a25e,_[_0x14bd('0x78')](_0x20ccc0,_[_0x14bd('0x79')](_0x54a25e)));this[_0x14bd('0xc')][_0x20ccc0['uniqueid']]['push'](_0x54a25e);this[_0x14bd('0x2f')][_0x20ccc0[_0x14bd('0x48')]]=_0x54a25e;this[_0x14bd('0x41')](_0x54a25e,_0x14bd('0x16'));}}catch(_0x1b2853){logger[_0x14bd('0x3b')](_0x14bd('0x6f'),_0x20ccc0[_0x14bd('0x48')],util[_0x14bd('0x3a')](_0x1b2853,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x14bd('0x9')][_0x14bd('0x7a')]=function(_0x362827){try{if(this[_0x14bd('0x5f')](_0x362827)){logger[_0x14bd('0x42')]('[%s][voiceQueueReport][queuecallerabandon]',_0x362827[_0x14bd('0x48')],util[_0x14bd('0x3a')](_0x362827,{'showHidden':![],'depth':null}));if(this[_0x14bd('0xc')][_0x362827[_0x14bd('0x48')]]){var _0x4e6c9d=_[_0x14bd('0x7b')](this[_0x14bd('0xc')][_0x362827[_0x14bd('0x48')]]);_0x4e6c9d[_0x14bd('0x7c')]=![];_0x4e6c9d[_0x14bd('0x7d')]=null;_0x4e6c9d['holdtime']=_0x362827[_0x14bd('0x7e')];_0x4e6c9d[_0x14bd('0x7f')]=_0x362827[_0x14bd('0x7f')];_0x4e6c9d['queuecallerabandon']=!![];_0x4e6c9d[_0x14bd('0x80')]=moment()[_0x14bd('0x43')]('YYYY-MM-DD\x20HH:mm:ss');_0x4e6c9d[_0x14bd('0x81')]=_0x14bd('0x82');_0x4e6c9d[_0x14bd('0x83')]=null;logger[_0x14bd('0x75')](_0x14bd('0x84'),_0x4e6c9d[_0x14bd('0x44')],_0x4e6c9d[_0x14bd('0x54')]);this[_0x14bd('0x2f')][_0x362827[_0x14bd('0x48')]]=_0x4e6c9d;this['emitVoiceQueueChannelRemove'](_0x4e6c9d,_0x14bd('0x18'));}}}catch(_0x31233f){logger[_0x14bd('0x3b')](_0x14bd('0x85'),_0x362827[_0x14bd('0x48')],util['inspect'](_0x31233f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x14bd('0x9')][_0x14bd('0x1a')]=function(_0x317dd8){try{if(this[_0x14bd('0x5f')](_0x317dd8)){logger[_0x14bd('0x42')](_0x14bd('0x86'),_0x317dd8['uniqueid'],util[_0x14bd('0x3a')](_0x317dd8,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x317dd8[_0x14bd('0x48')]]){var _0x4ad6b3=_[_0x14bd('0x7b')](this['queueReports'][_0x317dd8[_0x14bd('0x48')]]);_0x4ad6b3[_0x14bd('0x87')]=moment()[_0x14bd('0x43')](_0x14bd('0x71'));_0x4ad6b3[_0x14bd('0x88')]=_0x317dd8[_0x14bd('0x88')];_0x4ad6b3[_0x14bd('0x89')]=_0x317dd8['connectedlinename'];logger[_0x14bd('0x75')](_0x14bd('0x8a'),_0x4ad6b3[_0x14bd('0x44')],_0x4ad6b3[_0x14bd('0x54')],_0x317dd8['connectedlinenum'],_0x317dd8[_0x14bd('0x89')]);this[_0x14bd('0x2f')][_0x317dd8[_0x14bd('0x48')]]=_0x4ad6b3;this[_0x14bd('0x41')](_0x4ad6b3,_0x14bd('0x19'));}}}catch(_0x4cb326){logger[_0x14bd('0x3b')](_0x14bd('0x86'),_0x317dd8[_0x14bd('0x48')],util[_0x14bd('0x3a')](_0x4cb326,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x14bd('0x9')][_0x14bd('0x1d')]=function(_0x209106){try{if(this['isNotNull'](_0x209106)){logger['debug'](_0x14bd('0x8b'),_0x209106[_0x14bd('0x48')],util[_0x14bd('0x3a')](_0x209106,{'showHidden':![],'depth':null}));if(this[_0x14bd('0xc')][_0x209106[_0x14bd('0x48')]]){var _0x2bcab4=_[_0x14bd('0x7b')](this[_0x14bd('0xc')][_0x209106[_0x14bd('0x48')]]);_0x2bcab4[_0x14bd('0x7c')]=!![];_0x2bcab4[_0x14bd('0x81')]=_0x14bd('0x8c');logger['info'](_0x14bd('0x8d'),_0x2bcab4[_0x14bd('0x44')],_0x2bcab4['type']);}}}catch(_0x3d3470){logger[_0x14bd('0x3b')]('[%s][voiceQueueReport][agentconnect]',_0x209106[_0x14bd('0x48')],util[_0x14bd('0x3a')](_0x3d3470,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x14bd('0x9')]['syncAgentComplete']=function(_0x4254c6){try{if(this[_0x14bd('0x5f')](_0x4254c6)){logger['debug'](_0x14bd('0x8e'),_0x4254c6[_0x14bd('0x48')],util['inspect'](_0x4254c6,{'showHidden':![],'depth':null}));if(this[_0x14bd('0xc')][_0x4254c6[_0x14bd('0x48')]]){var _0x49cb77=_['last'](this[_0x14bd('0xc')][_0x4254c6[_0x14bd('0x48')]]);_0x49cb77['queuecallerabandon']=![];_0x49cb77[_0x14bd('0x80')]=null;_0x49cb77['assigned']=!![];_0x49cb77['lastAssignedTo']=_0x4254c6[_0x14bd('0x8f')];_0x49cb77[_0x14bd('0x7e')]=_0x4254c6['holdtime'];_0x49cb77['queuecallercomplete']=!![];_0x49cb77[_0x14bd('0x90')]=![];_0x49cb77[_0x14bd('0x91')]=null;if(!_0x49cb77[_0x14bd('0x92')]){if(_0x4254c6[_0x14bd('0x93')]==_0x14bd('0x92')){_0x49cb77['queuecallerexitreason']='COMPLETED';logger[_0x14bd('0x75')](_0x14bd('0x94'),_0x49cb77['name'],_0x49cb77[_0x14bd('0x54')]);}else{if(_[_0x14bd('0x95')](_0x4254c6[_0x14bd('0x35')]['toLowerCase'](),_0x14bd('0x96'))){if(this[_0x14bd('0xc')][_0x4254c6[_0x14bd('0x97')]]){var _0x1dd79c=_['last'](this[_0x14bd('0xc')][_0x4254c6[_0x14bd('0x97')]]);_0x1dd79c[_0x14bd('0x7c')]=![];_0x1dd79c[_0x14bd('0x90')]=!![];_0x1dd79c[_0x14bd('0x91')]=moment(_0x49cb77[_0x14bd('0x70')])[_0x14bd('0x98')](_0x4254c6[_0x14bd('0x7e')],_0x14bd('0x99'))[_0x14bd('0x43')](_0x14bd('0x71'));_0x1dd79c[_0x14bd('0x81')]=_0x14bd('0x9a');_0x1dd79c['transfer']=!![];_0x1dd79c[_0x14bd('0x9b')]='FORWARD';_0x1dd79c[_0x14bd('0x9c')]=_0x4254c6[_0x14bd('0x9d')];_0x1dd79c[_0x14bd('0x9e')]=_0x4254c6['uniqueid'];logger[_0x14bd('0x75')](_0x14bd('0x9f'),_0x1dd79c[_0x14bd('0x44')],_0x1dd79c[_0x14bd('0x54')]);var _0x4d750e=this[_0x14bd('0xc')][_0x4254c6['linkedid']];this['queueReports'][_0x4254c6['linkedid']]=this['queueReports'][_0x4254c6[_0x14bd('0x48')]];this['queueReports'][_0x4254c6[_0x14bd('0x48')]]=_0x4d750e;}}else{_0x49cb77['queuecallerexitreason']='COMPLETEDBY'+_0x4254c6['reason'][_0x14bd('0xa0')]();logger[_0x14bd('0x75')](_0x14bd('0xa1'),_0x49cb77[_0x14bd('0x44')],_0x49cb77['type'],_0x49cb77[_0x14bd('0x81')]);}}}this[_0x14bd('0x2f')][_0x4254c6[_0x14bd('0x48')]]=_0x49cb77;this[_0x14bd('0x3f')](_0x49cb77,_0x14bd('0x1b'));}}}catch(_0x2106ec){logger[_0x14bd('0x3b')](_0x14bd('0x8e'),_0x4254c6[_0x14bd('0x48')],util[_0x14bd('0x3a')](_0x2106ec,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x14bd('0xa2')]=function(_0x41d88e){try{if(this[_0x14bd('0x5f')](_0x41d88e)){logger['debug'](_0x14bd('0xa3'),_0x41d88e['uniqueid'],util[_0x14bd('0x3a')](_0x41d88e,{'showHidden':![],'depth':null}));this[_0x14bd('0xa4')](_0x41d88e[_0x14bd('0x48')],_[_0x14bd('0x79')](_0x41d88e['variable'])[0x0],_0x41d88e[_0x14bd('0xa5')]);if(this['queueReports'][_0x41d88e['uniqueid']]){var _0x434fc5=_['last'](this[_0x14bd('0xc')][_0x41d88e[_0x14bd('0x48')]]);if(_0x434fc5){if(this[_0x14bd('0x5f')](_0x41d88e['variable'])&&this[_0x14bd('0x5f')](_0x41d88e['variable'][_0x14bd('0xa6')])){switch(_0x41d88e[_0x14bd('0xa5')]){case'CONTINUE':_0x434fc5[_0x14bd('0x90')]=![];_0x434fc5['queuecallerexitAt']=null;break;case _0x14bd('0xa7'):_0x434fc5['lastevent']=_0x14bd('0xa8');_0x434fc5[_0x14bd('0x90')]=!![];_0x434fc5[_0x14bd('0x91')]=moment()[_0x14bd('0x43')](_0x14bd('0x71'));_0x434fc5[_0x14bd('0x87')]=moment()[_0x14bd('0x43')](_0x14bd('0x71'));logger['debug'](_0x14bd('0xa9'),_0x41d88e[_0x14bd('0x48')],util[_0x14bd('0x3a')](_0x434fc5,{'showHidden':![],'depth':null}));ami['emit'](_0x14bd('0xaa'),_0x434fc5);break;default:_0x434fc5[_0x14bd('0x90')]=!![];_0x434fc5[_0x14bd('0x91')]=moment()[_0x14bd('0x43')](_0x14bd('0x71'));_0x434fc5[_0x14bd('0x87')]=moment()[_0x14bd('0x43')](_0x14bd('0x71'));}_0x434fc5[_0x14bd('0x18')]=![];_0x434fc5[_0x14bd('0x80')]=null;_0x434fc5[_0x14bd('0x81')]=_0x41d88e['value'];this['channels'][_0x41d88e[_0x14bd('0x48')]]=_0x434fc5;this['emitVoiceQueueChannelRemove'](_0x434fc5,'varset');}else if(this[_0x14bd('0x5f')](_0x41d88e[_0x14bd('0xab')])&&this[_0x14bd('0x5f')](_0x41d88e[_0x14bd('0xab')]['queueposition'])){if(!_0x434fc5[_0x14bd('0x18')]){_0x434fc5[_0x14bd('0x90')]=!![];_0x434fc5[_0x14bd('0x91')]=moment()[_0x14bd('0x43')]('YYYY-MM-DD\x20HH:mm:ss');_0x434fc5[_0x14bd('0x81')]=_0x14bd('0xac');_0x434fc5[_0x14bd('0x87')]=moment()[_0x14bd('0x43')](_0x14bd('0x71'));this['channels'][_0x41d88e[_0x14bd('0x48')]]=_0x434fc5;}}logger[_0x14bd('0x75')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x41d88e['uniqueid'],_0x434fc5[_0x14bd('0x44')],_0x434fc5[_0x14bd('0x54')],_['keys'](_0x41d88e[_0x14bd('0xab')])[0x0],_0x41d88e[_0x14bd('0xa5')]);_0x434fc5['variables']=this[_0x14bd('0x12')][_0x41d88e[_0x14bd('0x48')]];}}}}catch(_0x41729f){logger['error']('[%s][voiceQueueReport][varset]',_0x41d88e[_0x14bd('0x48')],util[_0x14bd('0x3a')](_0x41729f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x14bd('0x9')][_0x14bd('0xa4')]=function(_0x1cc191,_0x1082bc,_0x569d5b){var _0x48ad47=[_0x14bd('0xad'),'rtpaudioqosbridged',_0x14bd('0xae'),_0x14bd('0xaf'),_0x14bd('0xb0'),_0x14bd('0xb1'),_0x14bd('0xb2'),_0x14bd('0xb3'),_0x14bd('0xb4'),'sipuri',_0x14bd('0xb5'),_0x14bd('0xb6'),_0x14bd('0xb7'),_0x14bd('0xb8'),_0x14bd('0xb9'),'memberlastcall','membername',_0x14bd('0xba'),_0x14bd('0xbb')];if(!_['isNil'](_0x1082bc)&&!_[_0x14bd('0xbc')](_0x48ad47,_0x1082bc)){if(_['isUndefined'](this[_0x14bd('0x12')][_0x1cc191])){this[_0x14bd('0x12')][_0x1cc191]={};}this[_0x14bd('0x12')][_0x1cc191][_0x1082bc]=_0x569d5b;}};VoiceQueueReport['prototype'][_0x14bd('0xbd')]=function(_0x1a144e){try{if(this['isNotNull'](_0x1a144e)){logger[_0x14bd('0x42')]('[%s][voiceQueueReport][hangup]',_0x1a144e[_0x14bd('0x48')],util[_0x14bd('0x3a')](_0x1a144e,{'showHidden':![],'depth':null}));if(this[_0x14bd('0xc')][_0x1a144e[_0x14bd('0x48')]]){for(var _0x4d501a=0x0,_0x370bcb={};_0x4d501a=0x0?moment(_0x1fa046[_0xd3b6('0x1a')])[_0xd3b6('0xe')](_0x1fa046[_0xd3b6('0x19')],_0xd3b6('0xf')):null,'data1':_0xd3b6('0x1b'),'data2':_0x1fa046[_0xd3b6('0x14')],'data3':_0x1fa046['exten'],'data4':_0x1fa046[_0xd3b6('0x1c')]||null,'role':_0xd3b6('0x13'),'internal':_0x1fa046['accountcode']?_['toNumber'](_0x1fa046[_0xd3b6('0x14')]):undefined,'uniqueid':_0x1fa046[_0xd3b6('0x16')]},'log':_0xd3b6('0x5')});}; \ No newline at end of file +var _0x6347=['dialstring','lodash','util','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','lastAssignedTo','isNil','interface','format','SIP/%s','TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','agent','toNumber','uniqueid','starttime','endtime','outbound','accountcode'];(function(_0x14f450,_0x421eb4){var _0x47eaa7=function(_0x15d74b){while(--_0x15d74b){_0x14f450['push'](_0x14f450['shift']());}};_0x47eaa7(++_0x421eb4);}(_0x6347,0x151));var _0x7634=function(_0x8bb265,_0x18c4d6){_0x8bb265=_0x8bb265-0x0;var _0x317630=_0x6347[_0x8bb265];return _0x317630;};'use strict';var moment=require('moment');var _=require(_0x7634('0x0'));var util=require(_0x7634('0x1'));var client=require(_0x7634('0x2'));exports[_0x7634('0x3')]=function(_0x1ac2d0){var _0x3cc020=_0x1ac2d0[_0x7634('0x4')]||_0x1ac2d0[_0x7634('0x5')];return client[_0x7634('0x6')](_0x7634('0x7'),{'body':{'channel':_0x7634('0x8'),'membername':_0x1ac2d0[_0x7634('0x9')],'interface':_[_0x7634('0xa')](_0x1ac2d0[_0x7634('0xb')])?util[_0x7634('0xc')](_0x7634('0xd'),_0x1ac2d0[_0x7634('0x9')]):_0x1ac2d0[_0x7634('0xb')],'type':_0x7634('0xe'),'enterAt':_0x1ac2d0[_0x7634('0xf')],'exitAt':_0x3cc020,'duration':moment(_0x3cc020)[_0x7634('0x10')](_0x1ac2d0[_0x7634('0xf')],_0x7634('0x11')),'data1':_0x7634('0x12'),'data2':_0x1ac2d0[_0x7634('0x13')],'data3':_0x1ac2d0['exten'],'data4':null,'data5':_0x1ac2d0['queue'],'role':_0x7634('0x14'),'internal':_0x1ac2d0['accountcode']?_[_0x7634('0x15')](_0x1ac2d0['accountcode']):undefined,'uniqueid':_0x1ac2d0[_0x7634('0x16')]},'log':'CreateMemberReport'});};exports['voiceDialReport']=function(_0x5332e9){return client[_0x7634('0x6')](_0x7634('0x7'),{'body':{'channel':'voice','membername':_0x5332e9['membername'],'interface':_0x5332e9[_0x7634('0xb')],'type':'TALKING','enterAt':_0x5332e9[_0x7634('0x17')],'exitAt':_0x5332e9[_0x7634('0x18')],'duration':moment(_0x5332e9['endtime'])[_0x7634('0x10')](_0x5332e9['starttime'],'seconds')>=0x0?moment(_0x5332e9[_0x7634('0x18')])[_0x7634('0x10')](_0x5332e9['starttime'],_0x7634('0x11')):null,'data1':_0x7634('0x19'),'data2':_0x5332e9[_0x7634('0x1a')],'data3':_0x5332e9['exten'],'data4':_0x5332e9[_0x7634('0x1b')]||null,'role':_0x7634('0x14'),'internal':_0x5332e9[_0x7634('0x1a')]?_['toNumber'](_0x5332e9[_0x7634('0x1a')]):undefined,'uniqueid':_0x5332e9[_0x7634('0x16')]},'log':'CreateMemberReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 53d5d7e..65df485 100644 --- a/server/services/ami/rpc/setting.js +++ b/server/services/ami/rpc/setting.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd485=['ShowSetting','stopRecordingOnTransfer','getSettings','Request'];(function(_0x1fca70,_0xb36545){var _0x37f059=function(_0x17be43){while(--_0x17be43){_0x1fca70['push'](_0x1fca70['shift']());}};_0x37f059(++_0xb36545);}(_0xd485,0x1e6));var _0x5d48=function(_0x495647,_0x1c2dc4){_0x495647=_0x495647-0x0;var _0x2e60e9=_0xd485[_0x495647];return _0x2e60e9;};'use strict';var client=require('../client');exports[_0x5d48('0x0')]=function(){return client[_0x5d48('0x1')](_0x5d48('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x5d48('0x3')]},'log':'GetSettings'});}; \ No newline at end of file +var _0x0d98=['getSettings','Request','../client'];(function(_0x156927,_0x5e3e66){var _0x1845c1=function(_0x2402da){while(--_0x2402da){_0x156927['push'](_0x156927['shift']());}};_0x1845c1(++_0x5e3e66);}(_0x0d98,0x149));var _0x80d9=function(_0x2aec1d,_0x219bcd){_0x2aec1d=_0x2aec1d-0x0;var _0x543f1d=_0x0d98[_0x2aec1d];return _0x543f1d;};'use strict';var client=require(_0x80d9('0x0'));exports[_0x80d9('0x1')]=function(){return client[_0x80d9('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer']},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index ee79f0f..a52f116 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 _0x15ec=['Request','GetTemplate','name','html','getTemplates'];(function(_0x593a5d,_0x11e5e3){var _0x282edd=function(_0x348b5f){while(--_0x348b5f){_0x593a5d['push'](_0x593a5d['shift']());}};_0x282edd(++_0x11e5e3);}(_0x15ec,0x16c));var _0xc15e=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0x15ec[_0x5e36d1];return _0x950b9e;};'use strict';var client=require('../client');exports[_0xc15e('0x0')]=function(_0x9a19d6){return function(_0x272df9){return client[_0xc15e('0x1')](_0xc15e('0x2'),{'options':{'raw':!![],'attributes':['id',_0xc15e('0x3'),_0xc15e('0x4')]},'log':_0xc15e('0x2')});};}; \ No newline at end of file +var _0xf866=['../client','GetTemplate','name','html'];(function(_0x8eed38,_0x23d1f4){var _0x577c10=function(_0x1a4f8f){while(--_0x1a4f8f){_0x8eed38['push'](_0x8eed38['shift']());}};_0x577c10(++_0x23d1f4);}(_0xf866,0xb8));var _0x6f86=function(_0x532ffa,_0x482e7c){_0x532ffa=_0x532ffa-0x0;var _0x1f6af6=_0xf866[_0x532ffa];return _0x1f6af6;};'use strict';var client=require(_0x6f86('0x0'));exports['getTemplates']=function(_0x29b76f){return function(_0x15e377){return client['Request'](_0x6f86('0x1'),{'options':{'raw':!![],'attributes':['id',_0x6f86('0x2'),_0x6f86('0x3')]},'log':_0x6f86('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 8f675b5..5c1e7a4 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 _0xef14=['../client','GetTrigger','status','Condition','field','value','AnyConditions','operator','Action','Actions','action','data1','data2','data3','data4'];(function(_0x25bbc4,_0x2e21c0){var _0x4036a5=function(_0x14eff9){while(--_0x14eff9){_0x25bbc4['push'](_0x25bbc4['shift']());}};_0x4036a5(++_0x2e21c0);}(_0xef14,0xb4));var _0x4ef1=function(_0x30036a,_0x19189d){_0x30036a=_0x30036a-0x0;var _0x33da5a=_0xef14[_0x30036a];return _0x33da5a;};'use strict';var client=require(_0x4ef1('0x0'));exports['getTriggers']=function(_0x8a0154){return function(_0xa2e3ec){return client['Request'](_0x4ef1('0x1'),{'options':{'raw':![],'attributes':['id','name','channel',_0x4ef1('0x2')],'include':[{'model':_0x4ef1('0x3'),'as':'AllConditions','attributes':['id',_0x4ef1('0x4'),'operator',_0x4ef1('0x5')]},{'model':_0x4ef1('0x3'),'as':_0x4ef1('0x6'),'attributes':['id',_0x4ef1('0x4'),_0x4ef1('0x7'),_0x4ef1('0x5')]},{'model':_0x4ef1('0x8'),'as':_0x4ef1('0x9'),'attributes':['id',_0x4ef1('0xa'),_0x4ef1('0xb'),_0x4ef1('0xc'),_0x4ef1('0xd'),_0x4ef1('0xe'),'data5','data6','data7']}]},'log':_0x4ef1('0x1')});};}; \ No newline at end of file +var _0x6207=['action','data1','data2','data3','data4','data6','data7','../client','Request','GetTrigger','channel','status','Condition','AllConditions','field','operator','value','AnyConditions','Action','Actions'];(function(_0x46969e,_0x21d12d){var _0x28a9b8=function(_0xbcf0c9){while(--_0xbcf0c9){_0x46969e['push'](_0x46969e['shift']());}};_0x28a9b8(++_0x21d12d);}(_0x6207,0xf7));var _0x7620=function(_0x378320,_0x131938){_0x378320=_0x378320-0x0;var _0x299e4d=_0x6207[_0x378320];return _0x299e4d;};'use strict';var client=require(_0x7620('0x0'));exports['getTriggers']=function(_0x3e5f1a){return function(_0xfa8309){return client[_0x7620('0x1')](_0x7620('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x7620('0x3'),_0x7620('0x4')],'include':[{'model':_0x7620('0x5'),'as':_0x7620('0x6'),'attributes':['id',_0x7620('0x7'),_0x7620('0x8'),_0x7620('0x9')]},{'model':_0x7620('0x5'),'as':_0x7620('0xa'),'attributes':['id','field','operator',_0x7620('0x9')]},{'model':_0x7620('0xb'),'as':_0x7620('0xc'),'attributes':['id',_0x7620('0xd'),_0x7620('0xe'),_0x7620('0xf'),_0x7620('0x10'),_0x7620('0x11'),'data5',_0x7620('0x12'),_0x7620('0x13')]}]},'log':_0x7620('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 2c6afa4..fe8416c 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 _0x025c=['name','registry','defaultuser','getTrunks','Request','GetTrunk'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x025c,0x1ad));var _0xc025=function(_0x13c696,_0x5cf0e7){_0x13c696=_0x13c696-0x0;var _0x154cce=_0x025c[_0x13c696];return _0x154cce;};'use strict';var client=require('../client');exports[_0xc025('0x0')]=function(_0x223862){return function(_0x21f881){return client[_0xc025('0x1')](_0xc025('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xc025('0x3'),_0xc025('0x4'),_0xc025('0x5')]},'log':_0xc025('0x2')});};}; \ No newline at end of file +var _0x851e=['registry','defaultuser','../client','getTrunks','GetTrunk','name'];(function(_0x327f74,_0x132a92){var _0xae34bf=function(_0x3b0a94){while(--_0x3b0a94){_0x327f74['push'](_0x327f74['shift']());}};_0xae34bf(++_0x132a92);}(_0x851e,0x1e8));var _0xe851=function(_0x1ba3f0,_0x3b220d){_0x1ba3f0=_0x1ba3f0-0x0;var _0x53064d=_0x851e[_0x1ba3f0];return _0x53064d;};'use strict';var client=require(_0xe851('0x0'));exports[_0xe851('0x1')]=function(_0x2bc74b){return function(_0x536c19){return client['Request'](_0xe851('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xe851('0x3'),_0xe851('0x4'),_0xe851('0x5')]},'log':_0xe851('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index c78671b..4637f86 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 _0xa9e0=['agent','lastPauseAt','interface','../client','getAgents','Request','name','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','phone','mobile','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'lastPauseAt',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'interface']},'log':'getAgents'});};};exports[_0x0a9e('0xc')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0x0a9e('0xd')},'attributes':['id',_0x0a9e('0x3'),_0x0a9e('0x4'),_0x0a9e('0xe')]},'log':_0x0a9e('0xc')});};};exports[_0x0a9e('0xf')]=function(_0x4a4c56,_0x50dfb2,_0x527cdd){return client['Request'](_0x0a9e('0x10'),{'body':{'type':_0x50dfb2,'uniqueid':_0x527cdd},'options':{'where':{'id':_0x4a4c56['id']}},'log':_0x0a9e('0xf')});};exports[_0x0a9e('0x11')]=function(_0x26d672){return client[_0x0a9e('0x2')](_0x0a9e('0x12'),{'body':{},'options':{'where':{'id':_0x26d672['id']}},'log':'savePause'});};exports[_0x0a9e('0x13')]=function(_0x239b12){return client[_0x0a9e('0x2')](_0x0a9e('0x14'),{'options':{'raw':![],'where':{'role':_0x0a9e('0x15'),'id':_0x239b12},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),'fullname',_0x0a9e('0x6'),'lastLoginAt',_0x0a9e('0x8'),_0x0a9e('0x16'),'voicePause',_0x0a9e('0x17')]},'log':'getAgent'});}; \ No newline at end of file +var _0xcb91=['UnpauseUser','getAgent','ShowUser','email','lastPauseAt','Request','GetUser','agent','name','accountcode','fullname','lastLoginAt','pauseType','voicePause','phone','interface','getAgents','internal','getTelephones','savePause','PauseUser'];(function(_0x25a7b7,_0x146dad){var _0x5be49f=function(_0x21ccce){while(--_0x21ccce){_0x25a7b7['push'](_0x25a7b7['shift']());}};_0x5be49f(++_0x146dad);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x478c8a,_0x9afc92){_0x478c8a=_0x478c8a-0x0;var _0x3b6b3e=_0xcb91[_0x478c8a];return _0x3b6b3e;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2')},'attributes':['id',_0x1cb9('0x3'),'email',_0x1cb9('0x4'),_0x1cb9('0x5'),'online',_0x1cb9('0x6'),_0x1cb9('0x7'),'lastPauseAt',_0x1cb9('0x8'),_0x1cb9('0x9'),'mobile',_0x1cb9('0xa')]},'log':_0x1cb9('0xb')});};};exports['getTelephones']=function(){return function(){return client[_0x1cb9('0x0')]('GetUser',{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x4'),_0x1cb9('0xc')]},'log':_0x1cb9('0xd')});};};exports[_0x1cb9('0xe')]=function(_0x50ce71,_0x9b58f1,_0x44a6b4){return client[_0x1cb9('0x0')](_0x1cb9('0xf'),{'body':{'type':_0x9b58f1,'uniqueid':_0x44a6b4},'options':{'where':{'id':_0x50ce71['id']}},'log':_0x1cb9('0xe')});};exports['saveUnpause']=function(_0x5e3c19){return client['Request'](_0x1cb9('0x10'),{'body':{},'options':{'where':{'id':_0x5e3c19['id']}},'log':_0x1cb9('0xe')});};exports[_0x1cb9('0x11')]=function(_0x1c714f){return client['Request'](_0x1cb9('0x12'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2'),'id':_0x1c714f},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x13'),_0x1cb9('0x4'),'fullname','online',_0x1cb9('0x6'),_0x1cb9('0x7'),_0x1cb9('0x14'),_0x1cb9('0x8'),_0x1cb9('0xa')]},'log':_0x1cb9('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 42186e2..12d4ac0 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 _0x2dfe=['CreateVoiceAgentReport','update','Request','UpdateVoiceAgentReport','create'];(function(_0x530495,_0x21655f){var _0x280803=function(_0x121742){while(--_0x121742){_0x530495['push'](_0x530495['shift']());}};_0x280803(++_0x21655f);}(_0x2dfe,0x18f));var _0xe2df=function(_0x5a7425,_0xdb4aba){_0x5a7425=_0x5a7425-0x0;var _0x32b1fb=_0x2dfe[_0x5a7425];return _0x32b1fb;};'use strict';var client=require('../client');exports[_0xe2df('0x0')]=function(_0x1e1dc9){return client['Request'](_0xe2df('0x1'),{'body':_0x1e1dc9,'log':_0xe2df('0x1')});};exports[_0xe2df('0x2')]=function(_0x9968fc,_0x414502,_0x386f58){return client[_0xe2df('0x3')](_0xe2df('0x4'),{'body':_0x9968fc,'options':{'where':{'uniqueid':_0x414502,'interface':_0x386f58,'agentcomplete':!![]}},'log':_0xe2df('0x4')});}; \ No newline at end of file +var _0x749e=['UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport','update'];(function(_0x4a90c1,_0x3ca12d){var _0x126ccc=function(_0x54a79){while(--_0x54a79){_0x4a90c1['push'](_0x4a90c1['shift']());}};_0x126ccc(++_0x3ca12d);}(_0x749e,0x175));var _0xe749=function(_0x335efe,_0x2a5a0f){_0x335efe=_0x335efe-0x0;var _0x43c25d=_0x749e[_0x335efe];return _0x43c25d;};'use strict';var client=require(_0xe749('0x0'));exports[_0xe749('0x1')]=function(_0x2b0db7){return client[_0xe749('0x2')](_0xe749('0x3'),{'body':_0x2b0db7,'log':_0xe749('0x3')});};exports[_0xe749('0x4')]=function(_0x520d0d,_0x552fc3,_0x591a70){return client[_0xe749('0x2')](_0xe749('0x5'),{'body':_0x520d0d,'options':{'where':{'uniqueid':_0x552fc3,'interface':_0x591a70,'agentcomplete':!![]}},'log':_0xe749('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 4ae0799..751e378 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 _0xfdac=['duration','billableseconds','GetVoiceCallReports','moment','lodash','../client','create','Request','CreateVoiceCallReport','merge','context','callerid','DOCUMENTATION','getVoiceCallReports','outbound','format','endOf','day','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfdac,0xae));var _0xcfda=function(_0x4ef8bd,_0x2565e1){_0x4ef8bd=_0x4ef8bd-0x0;var _0x2e5c3b=_0xfdac[_0x4ef8bd];return _0x2e5c3b;};'use strict';var moment=require(_0xcfda('0x0'));var util=require('util');var _=require(_0xcfda('0x1'));var client=require(_0xcfda('0x2'));exports[_0xcfda('0x3')]=function(_0x4d9be0){return client[_0xcfda('0x4')](_0xcfda('0x5'),{'body':_[_0xcfda('0x6')](_0x4d9be0,{'source':_0x4d9be0['calleridnum'],'destinationcontext':_0x4d9be0[_0xcfda('0x7')],'callerid':_0x4d9be0[_0xcfda('0x8')],'amaflags':_0xcfda('0x9')}),'log':_0xcfda('0x5')});};exports[_0xcfda('0xa')]=function(){return function(){return client[_0xcfda('0x4')]('GetVoiceCallReport',{'options':{'where':{'type':[_0xcfda('0xb')],'createdAt':{'$between':[moment()['startOf']('day')[_0xcfda('0xc')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xcfda('0xd')](_0xcfda('0xe'))['format'](_0xcfda('0xf'))]}},'attributes':['type','disposition',_0xcfda('0x10'),_0xcfda('0x11')]},'log':_0xcfda('0x12')});};}; \ No newline at end of file +var _0x6919=['Request','CreateVoiceCallReport','merge','calleridnum','context','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create'];(function(_0x106d21,_0x126060){var _0x5d386e=function(_0x121811){while(--_0x121811){_0x106d21['push'](_0x106d21['shift']());}};_0x5d386e(++_0x126060);}(_0x6919,0x164));var _0x9691=function(_0x4dbdda,_0x11f07c){_0x4dbdda=_0x4dbdda-0x0;var _0x1acbf1=_0x6919[_0x4dbdda];return _0x1acbf1;};'use strict';var moment=require(_0x9691('0x0'));var util=require(_0x9691('0x1'));var _=require(_0x9691('0x2'));var client=require(_0x9691('0x3'));exports[_0x9691('0x4')]=function(_0x21fa42){return client[_0x9691('0x5')](_0x9691('0x6'),{'body':_[_0x9691('0x7')](_0x21fa42,{'source':_0x21fa42[_0x9691('0x8')],'destinationcontext':_0x21fa42[_0x9691('0x9')],'callerid':_0x21fa42['callerid'],'amaflags':'DOCUMENTATION'}),'log':_0x9691('0x6')});};exports[_0x9691('0xa')]=function(){return function(){return client[_0x9691('0x5')](_0x9691('0xb'),{'options':{'where':{'type':[_0x9691('0xc')],'createdAt':{'$between':[moment()[_0x9691('0xd')](_0x9691('0xe'))[_0x9691('0xf')](_0x9691('0x10')),moment()['endOf']('day')[_0x9691('0xf')](_0x9691('0x10'))]}},'attributes':['type','disposition','duration',_0x9691('0x11')]},'log':_0x9691('0x12')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 4966891..ea4a0cd 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 _0xc05d=['Request','CreateVoiceDialReport','../client','create'];(function(_0x239ab1,_0x27a846){var _0x27e92d=function(_0x1b9cae){while(--_0x1b9cae){_0x239ab1['push'](_0x239ab1['shift']());}};_0x27e92d(++_0x27a846);}(_0xc05d,0xd2));var _0xdc05=function(_0x1066f6,_0x55f1ad){_0x1066f6=_0x1066f6-0x0;var _0x2f716e=_0xc05d[_0x1066f6];return _0x2f716e;};'use strict';var client=require(_0xdc05('0x0'));exports[_0xdc05('0x1')]=function(_0x2bf14f){return client[_0xdc05('0x2')](_0xdc05('0x3'),{'body':_0x2bf14f,'log':_0xdc05('0x3')});}; \ No newline at end of file +var _0x9a22=['Request','CreateVoiceDialReport','../client'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x9a22,0x101));var _0x29a2=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x9a22[_0x2763f2];return _0x3ef471;};'use strict';var client=require(_0x29a2('0x0'));exports['create']=function(_0x59f5aa){return client[_0x29a2('0x1')](_0x29a2('0x2'),{'body':_0x59f5aa,'log':_0x29a2('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 19ddbfa..74cc37a 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 _0x34b2=['exten','recordingFormat','../client','getVoiceExtensions','Request','GetVoiceExtension'];(function(_0x340749,_0x3425c6){var _0x214288=function(_0xf9a20){while(--_0xf9a20){_0x340749['push'](_0x340749['shift']());}};_0x214288(++_0x3425c6);}(_0x34b2,0x11c));var _0x234b=function(_0x470d17,_0x32e508){_0x470d17=_0x470d17-0x0;var _0xd6558d=_0x34b2[_0x470d17];return _0xd6558d;};'use strict';var client=require(_0x234b('0x0'));exports[_0x234b('0x1')]=function(){return function(){return client[_0x234b('0x2')](_0x234b('0x3'),{'options':{'raw':!![],'attributes':['id',_0x234b('0x4'),_0x234b('0x5')],'where':{'VoiceExtensionId':null}},'log':_0x234b('0x1')});};}; \ No newline at end of file +var _0x559a=['getVoiceExtensions','GetVoiceExtension','exten','recordingFormat','../client'];(function(_0x3fd6e6,_0x514f1e){var _0x1f44e2=function(_0x5b8ccb){while(--_0x5b8ccb){_0x3fd6e6['push'](_0x3fd6e6['shift']());}};_0x1f44e2(++_0x514f1e);}(_0x559a,0xb3));var _0xa559=function(_0x5a212c,_0x47f06e){_0x5a212c=_0x5a212c-0x0;var _0x450c0b=_0x559a[_0x5a212c];return _0x450c0b;};'use strict';var client=require(_0xa559('0x0'));exports[_0xa559('0x1')]=function(){return function(){return client['Request'](_0xa559('0x2'),{'options':{'raw':!![],'attributes':['id',_0xa559('0x3'),_0xa559('0x4')],'where':{'VoiceExtensionId':null}},'log':_0xa559('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 3f16fd0..3a15783 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 _0xa7e7=['Request','autopause','monitor_format','dialMethod','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalInterval','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMinThreshold','Trunk','name','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0xa7e7,0x111));var _0x7a7e=function(_0x2f4460,_0x11c1f3){_0x2f4460=_0x2f4460-0x0;var _0x4ffa03=_0xa7e7[_0x2f4460];return _0x4ffa03;};'use strict';var client=require(_0x7a7e('0x0'));exports[_0x7a7e('0x1')]=function(){return function(){return client[_0x7a7e('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id','name','acw','acwTimeout',_0x7a7e('0x3'),_0x7a7e('0x4'),'type','dialActive',_0x7a7e('0x5'),'dialLimitChannel','dialLimitQueue',_0x7a7e('0x6'),_0x7a7e('0x7'),'dialPredictiveOptimizationPercentage',_0x7a7e('0x8'),_0x7a7e('0x9'),_0x7a7e('0xa'),_0x7a7e('0xb'),'dialQueueOptions','dialQueueTimeout',_0x7a7e('0xc'),_0x7a7e('0xd'),'dialCongestionRetryFrequency',_0x7a7e('0xe'),'dialBusyRetryFrequency',_0x7a7e('0xf'),_0x7a7e('0x10'),'dialGlobalMaxRetry','dialTimezone',_0x7a7e('0x11'),'dialPrefix',_0x7a7e('0x12'),_0x7a7e('0x13'),_0x7a7e('0x14'),_0x7a7e('0x15'),_0x7a7e('0x16'),_0x7a7e('0x17'),_0x7a7e('0x18'),_0x7a7e('0x19'),_0x7a7e('0x1a'),_0x7a7e('0x1b'),_0x7a7e('0x1c'),_0x7a7e('0x1d'),_0x7a7e('0x1e'),_0x7a7e('0x1f'),_0x7a7e('0x20'),_0x7a7e('0x21'),'dialAgiAfterHangupClient',_0x7a7e('0x22'),_0x7a7e('0x4'),'strategy',_0x7a7e('0x23'),'dialCutDigit',_0x7a7e('0x24'),_0x7a7e('0x25'),'dialDropMaxRetry',_0x7a7e('0x26'),'dialAbandonedMaxRetry',_0x7a7e('0x27'),_0x7a7e('0x28'),_0x7a7e('0x29'),'dialAgentRejectMaxRetry',_0x7a7e('0x2a'),_0x7a7e('0x2b'),'dialPredictiveIntervalMaxThreshold',_0x7a7e('0x2c')],'include':[{'model':_0x7a7e('0x2d'),'as':'Trunk','attributes':['id',_0x7a7e('0x2e'),_0x7a7e('0x2f'),_0x7a7e('0x30')]},{'model':_0x7a7e('0x31'),'as':_0x7a7e('0x32'),'attributes':['id',_0x7a7e('0x2e')]},{'model':_0x7a7e('0x2d'),'as':_0x7a7e('0x33'),'attributes':['id',_0x7a7e('0x2e'),_0x7a7e('0x2f'),_0x7a7e('0x30')]},{'model':_0x7a7e('0x34'),'as':_0x7a7e('0x34'),'attributes':['id','name'],'include':[{'model':_0x7a7e('0x34'),'as':_0x7a7e('0x35'),'attributes':['id',_0x7a7e('0x2e'),_0x7a7e('0x36')]}]}]},'log':_0x7a7e('0x1')});};}; \ No newline at end of file +var _0x73b6=['dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialQueueProject2','monitor_format','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','Pause','mandatoryDispositionPause','Interval','Intervals','interval','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence'];(function(_0x1e48b3,_0x3150bc){var _0x295fae=function(_0x58b33a){while(--_0x58b33a){_0x1e48b3['push'](_0x1e48b3['shift']());}};_0x295fae(++_0x3150bc);}(_0x73b6,0x96));var _0x673b=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0x73b6[_0x36dfbd];return _0x4ecad9;};'use strict';var client=require('../client');exports[_0x673b('0x0')]=function(){return function(){return client[_0x673b('0x1')](_0x673b('0x2'),{'options':{'raw':![],'attributes':['id',_0x673b('0x3'),_0x673b('0x4'),_0x673b('0x5'),'autopause','monitor_format','type','dialActive',_0x673b('0x6'),_0x673b('0x7'),_0x673b('0x8'),_0x673b('0x9'),_0x673b('0xa'),'dialPredictiveOptimizationPercentage',_0x673b('0xb'),_0x673b('0xc'),_0x673b('0xd'),_0x673b('0xe'),_0x673b('0xf'),'dialQueueTimeout',_0x673b('0x10'),_0x673b('0x11'),_0x673b('0x12'),_0x673b('0x13'),_0x673b('0x14'),'dialNoAnswerMaxRetry',_0x673b('0x15'),_0x673b('0x16'),_0x673b('0x17'),_0x673b('0x18'),_0x673b('0x19'),_0x673b('0x1a'),_0x673b('0x1b'),'dialAMDInitialSilence',_0x673b('0x1c'),_0x673b('0x1d'),'dialAMDTotalAnalysisTime','dialAMDMinWordLength',_0x673b('0x1e'),_0x673b('0x1f'),_0x673b('0x20'),_0x673b('0x21'),_0x673b('0x22'),'dialRecallMeTimeout','dialRecallInQueue',_0x673b('0x23'),_0x673b('0x24'),'dialAgiAfterHangupClient',_0x673b('0x25'),_0x673b('0x26'),_0x673b('0x27'),_0x673b('0x28'),_0x673b('0x29'),_0x673b('0x2a'),'dialNoSuchNumberRetryFrequency',_0x673b('0x2b'),_0x673b('0x2c'),_0x673b('0x2d'),_0x673b('0x2e'),_0x673b('0x2f'),'dialMachineRetryFrequency','dialAgentRejectMaxRetry',_0x673b('0x30'),_0x673b('0x31'),_0x673b('0x32'),_0x673b('0x33')],'include':[{'model':_0x673b('0x34'),'as':_0x673b('0x34'),'attributes':['id',_0x673b('0x3'),_0x673b('0x35'),_0x673b('0x36')]},{'model':_0x673b('0x37'),'as':_0x673b('0x38'),'attributes':['id',_0x673b('0x3')]},{'model':_0x673b('0x34'),'as':'TrunkBackup','attributes':['id','name',_0x673b('0x35'),_0x673b('0x36')]},{'model':_0x673b('0x39'),'as':_0x673b('0x39'),'attributes':['id',_0x673b('0x3')],'include':[{'model':_0x673b('0x39'),'as':_0x673b('0x3a'),'attributes':['id','name',_0x673b('0x3b')]}]}]},'log':_0x673b('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 3ba2058..1ba134a 100644 --- a/server/services/ami/rpc/voiceQueueReport.js +++ b/server/services/ami/rpc/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['queuecallerexit','queuecallerexitAt','moment','lodash','../client','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt'];(function(_0x4f5133,_0x574671){var _0x378878=function(_0x2e81e2){while(--_0x2e81e2){_0x4f5133['push'](_0x4f5133['shift']());}};_0x378878(++_0x574671);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'use strict';var moment=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var client=require(_0x0a9e('0x2'));exports['create']=function(_0x550fbc){return client[_0x0a9e('0x3')]('CreateVoiceQueueReport',{'body':_0x550fbc,'log':_0x0a9e('0x4')});};exports[_0x0a9e('0x5')]=function(){return function(){return client[_0x0a9e('0x3')](_0x0a9e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0a9e('0x7')]('day')[_0x0a9e('0x8')](_0x0a9e('0x9')),moment()[_0x0a9e('0xa')]('day')['format'](_0x0a9e('0x9'))]}},'attributes':['uniqueid','queue',_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file +var _0xa9e0=['queuecallerexit','queuecallerexitAt','moment','lodash','../client','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt'];(function(_0x8a34fa,_0x5e3c51){var _0xe1c15c=function(_0x403155){while(--_0x403155){_0x8a34fa['push'](_0x8a34fa['shift']());}};_0xe1c15c(++_0x5e3c51);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var moment=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var client=require(_0x0a9e('0x2'));exports['create']=function(_0x550fbc){return client[_0x0a9e('0x3')]('CreateVoiceQueueReport',{'body':_0x550fbc,'log':_0x0a9e('0x4')});};exports[_0x0a9e('0x5')]=function(){return function(){return client[_0x0a9e('0x3')](_0x0a9e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0a9e('0x7')]('day')[_0x0a9e('0x8')](_0x0a9e('0x9')),moment()[_0x0a9e('0xa')]('day')['format'](_0x0a9e('0x9'))]}},'attributes':['uniqueid','queue',_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 259755f..dd2f10a 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 _0x451e=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses','Request'];(function(_0x19c3da,_0x3c7ac4){var _0x5a28c1=function(_0xe43a13){while(--_0xe43a13){_0x19c3da['push'](_0x19c3da['shift']());}};_0x5a28c1(++_0x3c7ac4);}(_0x451e,0x85));var _0xe451=function(_0x275cf7,_0xfbb597){_0x275cf7=_0x275cf7-0x0;var _0x38a722=_0x451e[_0x275cf7];return _0x38a722;};'use strict';var client=require(_0xe451('0x0'));exports[_0xe451('0x1')]=function(_0x4b1fdb){return function(){return client[_0xe451('0x2')](_0xe451('0x3'),{'options':{'where':{'VoiceQueueId':_0x4b1fdb,'paused':!![]},'raw':!![]},'log':_0xe451('0x1')});};}; \ No newline at end of file +var _0xcb89=['../client','getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0xcb89,0x19c));var _0x9cb8=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xcb89[_0x51020b];return _0x371e47;};'use strict';var client=require(_0x9cb8('0x0'));exports[_0x9cb8('0x1')]=function(_0x1a6bfa){return function(){return client[_0x9cb8('0x2')](_0x9cb8('0x3'),{'options':{'where':{'VoiceQueueId':_0x1a6bfa,'paused':!![]},'raw':!![]},'log':_0x9cb8('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 886d2bf..eec2677 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x17b984,_0x59477e){var _0x5c810d=function(_0xccf69a){while(--_0xccf69a){_0x17b984['push'](_0x17b984['shift']());}};_0x5c810d(++_0x59477e);}(_0x7a54,0x106));var _0x47a5=function(_0x1a6a58,_0x42e629){_0x1a6a58=_0x1a6a58-0x0;var _0x5d9f06=_0x7a54[_0x1a6a58];return _0x5d9f06;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x3c9f37,_0x229cbd){var _0x6e1dc6=function(_0x402681){while(--_0x402681){_0x3c9f37['push'](_0x3c9f37['shift']());}};_0x6e1dc6(++_0x229cbd);}(_0x7a54,0x106));var _0x47a5=function(_0x4400e5,_0x1338cb){_0x4400e5=_0x4400e5-0x0;var _0x31dac5=_0x7a54[_0x4400e5];return _0x31dac5;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index ed93afa..f67f965 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 _0x2873=['origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereelinkedid','isexternal','context','extension','blind','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten'];(function(_0x438c0e,_0x3b76fc){var _0x2b144b=function(_0x20026a){while(--_0x20026a){_0x438c0e['push'](_0x438c0e['shift']());}};_0x2b144b(++_0x3b76fc);}(_0x2873,0x159));var _0x3287=function(_0x2d5016,_0xb57c1){_0x2d5016=_0x2d5016-0x0;var _0x516752=_0x2873[_0x2d5016];return _0x516752;};'use strict';var client=require(_0x3287('0x0'));exports[_0x3287('0x1')]={};exports[_0x3287('0x2')]=function(_0x2fb512){return client[_0x3287('0x3')](_0x3287('0x4'),{'body':{'result':_0x2fb512[_0x3287('0x5')],'transfererchannel':_0x2fb512[_0x3287('0x6')],'transferercalleridnum':_0x2fb512[_0x3287('0x7')],'transferercalleridname':_0x2fb512[_0x3287('0x8')],'transfererconnectedlinenum':_0x2fb512[_0x3287('0x9')],'transfererconnectedlinename':_0x2fb512[_0x3287('0xa')],'transfereraccountcode':_0x2fb512[_0x3287('0xb')],'transferercontext':_0x2fb512[_0x3287('0xc')],'transfererexten':_0x2fb512['transfererexten'],'transfererlinkedid':_0x2fb512[_0x3287('0xd')],'transfereechannel':_0x2fb512['transfereechannel'],'transfereecalleridnum':_0x2fb512[_0x3287('0xe')],'transfereecalleridname':_0x2fb512[_0x3287('0xf')],'transfereeconnectedlinenum':_0x2fb512[_0x3287('0x10')],'transfereeconnectedlinename':_0x2fb512[_0x3287('0x11')],'transfereeaccountcode':_0x2fb512[_0x3287('0x12')],'transfereecontext':_0x2fb512['transfereecontext'],'transfereeexten':_0x2fb512['transfereeexten'],'transfereelinkedid':_0x2fb512[_0x3287('0x13')],'isexternal':_0x2fb512[_0x3287('0x14')],'context':_0x2fb512[_0x3287('0x15')],'extension':_0x2fb512[_0x3287('0x16')],'type':_0x3287('0x17')},'log':'CreateVoiceTransferReport'});};exports['attendedTransfer']=function(_0x44c77e){return client[_0x3287('0x3')](_0x3287('0x4'),{'body':{'result':_0x44c77e[_0x3287('0x5')],'transfererchannel':_0x44c77e[_0x3287('0x18')],'transferercalleridnum':_0x44c77e[_0x3287('0x19')],'transferercalleridname':_0x44c77e['origtransferercalleridname'],'transfererconnectedlinenum':_0x44c77e[_0x3287('0x1a')],'transfererconnectedlinename':_0x44c77e[_0x3287('0x1b')],'transfereraccountcode':_0x44c77e['origtransfereraccountcode'],'transferercontext':_0x44c77e[_0x3287('0x1c')],'transfererexten':_0x44c77e[_0x3287('0x1d')],'transfererlinkedid':_0x44c77e[_0x3287('0x1e')],'transfereechannel':_0x44c77e['transfertargetchannel'],'transfereecalleridnum':_0x44c77e['transfertargetcalleridnum'],'transfereecalleridname':_0x44c77e['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x44c77e['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x44c77e[_0x3287('0x1f')],'transfereeaccountcode':_0x44c77e[_0x3287('0x20')],'transfereecontext':_0x44c77e[_0x3287('0x21')],'transfereeexten':_0x44c77e[_0x3287('0x22')],'transfereelinkedid':_0x44c77e['transfertargetlinkedid'],'isexternal':_0x44c77e['isexternal'],'context':_0x44c77e[_0x3287('0x23')],'extension':_0x44c77e[_0x3287('0x24')],'type':_0x3287('0x25')},'log':_0x3287('0x4')});}; \ No newline at end of file +var _0xbe98=['transfereraccountcode','transferercontext','transfererexten','transfereechannel','transfereecalleridnum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','extension','blind','attendedTransfer','result','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','origtransfererexten','attended','../client','blindTransfer','Request','CreateVoiceTransferReport','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename'];(function(_0x2431d6,_0x25189a){var _0x4d0f9b=function(_0x52cd84){while(--_0x52cd84){_0x2431d6['push'](_0x2431d6['shift']());}};_0x4d0f9b(++_0x25189a);}(_0xbe98,0x1cb));var _0x8be9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbe98[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x8be9('0x0'));exports['transfers']={};exports[_0x8be9('0x1')]=function(_0x1b2e7b){return client[_0x8be9('0x2')](_0x8be9('0x3'),{'body':{'result':_0x1b2e7b['result'],'transfererchannel':_0x1b2e7b[_0x8be9('0x4')],'transferercalleridnum':_0x1b2e7b[_0x8be9('0x5')],'transferercalleridname':_0x1b2e7b[_0x8be9('0x6')],'transfererconnectedlinenum':_0x1b2e7b[_0x8be9('0x7')],'transfererconnectedlinename':_0x1b2e7b[_0x8be9('0x8')],'transfereraccountcode':_0x1b2e7b[_0x8be9('0x9')],'transferercontext':_0x1b2e7b[_0x8be9('0xa')],'transfererexten':_0x1b2e7b[_0x8be9('0xb')],'transfererlinkedid':_0x1b2e7b['transfererlinkedid'],'transfereechannel':_0x1b2e7b[_0x8be9('0xc')],'transfereecalleridnum':_0x1b2e7b[_0x8be9('0xd')],'transfereecalleridname':_0x1b2e7b['transfereecalleridname'],'transfereeconnectedlinenum':_0x1b2e7b['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x1b2e7b[_0x8be9('0xe')],'transfereeaccountcode':_0x1b2e7b[_0x8be9('0xf')],'transfereecontext':_0x1b2e7b[_0x8be9('0x10')],'transfereeexten':_0x1b2e7b[_0x8be9('0x11')],'transfereelinkedid':_0x1b2e7b[_0x8be9('0x12')],'isexternal':_0x1b2e7b[_0x8be9('0x13')],'context':_0x1b2e7b['context'],'extension':_0x1b2e7b[_0x8be9('0x14')],'type':_0x8be9('0x15')},'log':_0x8be9('0x3')});};exports[_0x8be9('0x16')]=function(_0x578b57){return client['Request'](_0x8be9('0x3'),{'body':{'result':_0x578b57[_0x8be9('0x17')],'transfererchannel':_0x578b57[_0x8be9('0x18')],'transferercalleridnum':_0x578b57[_0x8be9('0x19')],'transferercalleridname':_0x578b57[_0x8be9('0x1a')],'transfererconnectedlinenum':_0x578b57[_0x8be9('0x1b')],'transfererconnectedlinename':_0x578b57[_0x8be9('0x1c')],'transfereraccountcode':_0x578b57[_0x8be9('0x1d')],'transferercontext':_0x578b57[_0x8be9('0x1e')],'transfererexten':_0x578b57['secondtransfererexten'],'transfererlinkedid':_0x578b57['origtransfererlinkedid'],'transfereechannel':_0x578b57[_0x8be9('0x1f')],'transfereecalleridnum':_0x578b57[_0x8be9('0x20')],'transfereecalleridname':_0x578b57['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x578b57[_0x8be9('0x21')],'transfereeconnectedlinename':_0x578b57[_0x8be9('0x22')],'transfereeaccountcode':_0x578b57['transfertargetaccountcode'],'transfereecontext':_0x578b57[_0x8be9('0x23')],'transfereeexten':_0x578b57[_0x8be9('0x24')],'transfereelinkedid':_0x578b57['transfertargetlinkedid'],'isexternal':_0x578b57['isexternal'],'context':_0x578b57['origtransferercontext'],'extension':_0x578b57[_0x8be9('0x25')],'type':_0x8be9('0x26')},'log':_0x8be9('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 67981c9..ea76ec6 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 _0xe944=['waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','omit','values','channels','voicechannel','map','find','uniqueid','%s.%s','filename','format','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','rec','mixmonitorid','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','channel','destinationchannel','StopMixMonitor','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelredirect','Redirect','context','telephones','trunks','outboundChannels','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','server','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','validate','../../../config/environment','listen','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','isConnected','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','catch','error','message','Command','content','voiceQueues','hasOwnProperty','answered','available','loggedIn','pTalking','sumDuration','sumHoldTime','talking','total','type','unmanaged','abandoned'];(function(_0x12292c,_0x4d82fd){var _0x1a22f3=function(_0xb5a452){while(--_0xb5a452){_0x12292c['push'](_0x12292c['shift']());}};_0x1a22f3(++_0x4d82fd);}(_0xe944,0x174));var _0x4e94=function(_0x284d11,_0x81274f){_0x284d11=_0x284d11-0x0;var _0x1f2b1c=_0xe944[_0x284d11];return _0x1f2b1c;};'use strict';var _=require(_0x4e94('0x0'));var util=require('util');var jayson=require('jayson/promise');var schema=require(_0x4e94('0x1'));var BPromise=require('bluebird');var moment=require('moment');var config=require(_0x4e94('0x2'));var properties=require('../properties');var ami=require('../ami');exports[_0x4e94('0x3')]=function(_0xe47674,_0x27bbd9,_0xbb43ae){return new BPromise(function(_0x4d00e5,_0x44a2cd){var _0x28a1fd={'QueuePause':function(_0x175b42){return new Promise(function(_0x32bb46,_0x5a5823){var _0x43d946=util['format'](_0x4e94('0x4'),_0x4e94('0x5'),_0x175b42[_0x4e94('0x6')]);if(_0xe47674[_0x4e94('0x7')]&&_0xe47674['timers'][_0x43d946]&&_0xe47674[_0x4e94('0x7')][_0x43d946][_0x4e94('0x8')]){_0xe47674[_0x4e94('0x7')][_0x43d946][_0x4e94('0x9')]();}if(_0xe47674[_0x4e94('0xa')][_0x43d946]){_0xe47674[_0x4e94('0xa')][_0x43d946][_0x4e94('0xb')]({'statePause':_0x175b42['pause']?!![]:![]});}_0x32bb46({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x132129){var _0x1b4eac=this;return new Promise(function(_0x3d5449,_0x17f844){if(ami[_0x4e94('0xc')]()==![]){return _0x17f844(_0x1b4eac['error'](0x1f4,[config[_0x4e94('0xd')]['ip'],config[_0x4e94('0xd')][_0x4e94('0xe')],_0x4e94('0xf')][_0x4e94('0x10')]('\x20')));}_0x132129=_[_0x4e94('0x11')](_0x132129,_[_0x4e94('0x12')](properties[_0x4e94('0x13')]));_0x132129[_0x4e94('0x14')]=_0x4e94('0x15');return ami[_0x4e94('0x16')](_0x132129)[_0x4e94('0x17')](function(_0x5b4abf){_0x3d5449({'code':0xc8,'message':_0x5b4abf['message']});})[_0x4e94('0x18')](function(_0x950aba){_0x17f844(_0x1b4eac[_0x4e94('0x19')](0x1f5,_0x950aba[_0x4e94('0x1a')]));});});},'Command':function(_0x39e9d6){var _0x4ddddf=this;return new Promise(function(_0x2af7e1,_0x354818){if(ami[_0x4e94('0xc')]()==![]){return _0x354818(_0x4ddddf[_0x4e94('0x19')](0x1f4,[config['asterisk']['ip'],config[_0x4e94('0xd')]['username'],_0x4e94('0xf')][_0x4e94('0x10')]('\x20')));}_0x39e9d6=_['pick'](_0x39e9d6,'command');_0x39e9d6[_0x4e94('0x14')]=_0x4e94('0x1b');return ami[_0x4e94('0x16')](_0x39e9d6)[_0x4e94('0x17')](function(_0x2c93de){_0x2af7e1({'code':0xc8,'message':_0x2c93de[_0x4e94('0x1c')]});})[_0x4e94('0x18')](function(_0x1ea50b){_0x354818(_0x4ddddf['error'](0x1f5,_0x1ea50b[_0x4e94('0x1a')]));});});},'VoiceQueues':function(_0x1d3873){return new Promise(function(_0x2e71cb,_0x57178a){var _0x2b9e93=[];for(var _0x567cd8 in _0xe47674['voiceQueues']){if(_0xe47674[_0x4e94('0x1d')][_0x4e94('0x1e')](_0x567cd8)){var _0x4a0f22=_0xe47674[_0x4e94('0x1d')][_0x567cd8];var _0x2cb397={'id':_0x4a0f22['id'],'name':_0x4a0f22[_0x4e94('0x6')],'strategy':_0x4a0f22['strategy'],'answered':_0x4a0f22[_0x4e94('0x1f')],'available':_0x4a0f22[_0x4e94('0x20')],'loggedIn':_0x4a0f22[_0x4e94('0x21')],'pTalking':_0x4a0f22[_0x4e94('0x22')],'sumBillable':_0x4a0f22['sumBillable'],'sumDuration':_0x4a0f22[_0x4e94('0x23')],'sumHoldTime':_0x4a0f22[_0x4e94('0x24')]||0x0,'talking':_0x4a0f22[_0x4e94('0x25')],'total':_0x4a0f22[_0x4e94('0x26')],'type':_0x4a0f22[_0x4e94('0x27')],'unmanaged':_0x4a0f22[_0x4e94('0x28')],'abandoned':_0x4a0f22[_0x4e94('0x29')],'waiting':_0x4a0f22[_0x4e94('0x2a')],'loggedInDb':_0x4a0f22[_0x4e94('0x2b')]};if(_0x4a0f22['type']===_0x4e94('0x2c')){_0x2cb397[_0x4e94('0x2d')]=_0x4a0f22[_0x4e94('0x2d')];_0x2cb397[_0x4e94('0x2e')]=_0x4a0f22[_0x4e94('0x2e')];_0x2cb397[_0x4e94('0x2f')]=_0x4a0f22[_0x4e94('0x2f')];_0x2cb397['dialOriginateCallerIdNumber']=_0x4a0f22[_0x4e94('0x30')];_0x2cb397[_0x4e94('0x31')]=_0x4a0f22['dialOriginateTimeout'];_0x2cb397[_0x4e94('0x32')]=_0x4a0f22[_0x4e94('0x32')];_0x2cb397[_0x4e94('0x33')]=_0x4a0f22['temp'];_0x2cb397['outboundAnswerAgiCallsDay']=_0x4a0f22[_0x4e94('0x34')];_0x2cb397['outboundAnswerCallsDay']=_0x4a0f22[_0x4e94('0x35')];_0x2cb397[_0x4e94('0x36')]=_0x4a0f22[_0x4e94('0x36')];_0x2cb397[_0x4e94('0x37')]=_0x4a0f22[_0x4e94('0x37')];_0x2cb397[_0x4e94('0x38')]=_0x4a0f22[_0x4e94('0x38')];_0x2cb397[_0x4e94('0x39')]=_0x4a0f22[_0x4e94('0x39')];_0x2cb397['outboundDropCallsDayCallersExit']=_0x4a0f22[_0x4e94('0x3a')];_0x2cb397[_0x4e94('0x3b')]=_0x4a0f22[_0x4e94('0x3b')];_0x2cb397['outboundNoAnswerCallsDay']=_0x4a0f22[_0x4e94('0x3c')];_0x2cb397[_0x4e94('0x3d')]=_0x4a0f22[_0x4e94('0x3d')];_0x2cb397[_0x4e94('0x3e')]=_0x4a0f22[_0x4e94('0x3e')];_0x2cb397[_0x4e94('0x3f')]=_0x4a0f22[_0x4e94('0x3f')];_0x2cb397[_0x4e94('0x40')]=_0x4a0f22[_0x4e94('0x40')];_0x2cb397[_0x4e94('0x41')]=_0x4a0f22[_0x4e94('0x41')];_0x2cb397[_0x4e94('0x42')]=_0x4a0f22[_0x4e94('0x42')];_0x2cb397[_0x4e94('0x43')]=_0x4a0f22['predictiveIntervalAvgHoldtime'];_0x2cb397[_0x4e94('0x44')]=_0x4a0f22[_0x4e94('0x44')];_0x2cb397['predictiveIntervalDroppedCallsCallersExit']=_0x4a0f22[_0x4e94('0x45')];_0x2cb397['predictiveIntervalDroppedCallsTimeout']=_0x4a0f22['predictiveIntervalDroppedCallsTimeout'];_0x2cb397[_0x4e94('0x46')]=_0x4a0f22['predictiveIntervalErlangCalls'];_0x2cb397[_0x4e94('0x47')]=_0x4a0f22[_0x4e94('0x47')];_0x2cb397[_0x4e94('0x48')]=_0x4a0f22[_0x4e94('0x48')];_0x2cb397['predictiveIntervalMultiplicativeFactor']=_0x4a0f22[_0x4e94('0x49')];_0x2cb397[_0x4e94('0x4a')]=_0x4a0f22[_0x4e94('0x4a')];_0x2cb397[_0x4e94('0x4b')]=_0x4a0f22['predictiveIntervalAvailable'];_0x2cb397[_0x4e94('0x4c')]=_0x4a0f22[_0x4e94('0x4c')];_0x2cb397[_0x4e94('0x1a')]=_0x4a0f22[_0x4e94('0x1a')];_0x2cb397[_0x4e94('0x4d')]=_0x4a0f22[_0x4e94('0x4d')];_0x2cb397['erlangCalls']=_0x4a0f22[_0x4e94('0x4e')];_0x2cb397[_0x4e94('0x4f')]=_0x4a0f22[_0x4e94('0x4f')];_0x2cb397['erlangAbandonmentRate']=_0x4a0f22[_0x4e94('0x50')];_0x2cb397[_0x4e94('0x51')]=_0x4a0f22['erlangBusyFactor'];_0x2cb397[_0x4e94('0x52')]=_0x4a0f22[_0x4e94('0x52')];_0x2cb397[_0x4e94('0x53')]=_0x4a0f22['startProgressive'];}if(_0x4a0f22['Trunk']){_0x2cb397[_0x4e94('0x54')]={'id':_0x4a0f22[_0x4e94('0x54')]['id'],'name':_0x4a0f22[_0x4e94('0x54')]['name'],'active':_0x4a0f22[_0x4e94('0x54')][_0x4e94('0x55')],'callerid':_0x4a0f22[_0x4e94('0x54')][_0x4e94('0x56')]};}if(_0x4a0f22[_0x4e94('0x57')]){_0x2cb397[_0x4e94('0x57')]={'id':_0x4a0f22['Interval']['id'],'name':_0x4a0f22[_0x4e94('0x57')]['name']};}_0x2b9e93[_0x4e94('0x58')](_0x2cb397);}}_0x2e71cb({'count':_0x2b9e93[_0x4e94('0x59')],'rows':_0x2b9e93});});},'UpdateVoiceQueue':function(_0x485fd6){return new Promise(function(_0x274f20,_0x57fe25){var _0x28a2f8=_['find'](_0xe47674[_0x4e94('0x1d')],{'id':parseInt(_0x485fd6['id'])});var _0x273f5f=_[_0x4e94('0x5a')](_0x485fd6,['id']);if(_0x28a2f8){for(var _0x3e88ab in _0x273f5f){if(typeof _0x273f5f[_0x3e88ab]!=='undefined'&&typeof _0x28a2f8[_0x3e88ab]!=='undefined'){_0x28a2f8[_0x3e88ab]=_0x273f5f[_0x3e88ab];}}_0x274f20(_0x28a2f8);}else{_0x57fe25();}});},'VoiceChannels':function(_0x1e9a22){return new Promise(function(_0x21fea5,_0x3c6866){var _0x3dfe12=_[_0x4e94('0x5b')](_0xe47674[_0x4e94('0x5c')]);_0x21fea5({'count':_0x3dfe12[_0x4e94('0x59')],'rows':_0x3dfe12});});},'VoiceChannelMixMonitor':function(_0x2f2649){var _0x51a3a2=this;return new Promise(function(_0x539fb4,_0x434726){if(ami[_0x4e94('0xc')]()==![]){return _0x434726(_0x51a3a2[_0x4e94('0x19')](0x1f4,[config[_0x4e94('0xd')]['ip'],config['asterisk'][_0x4e94('0xe')],_0x4e94('0xf')]['join']('\x20')));}var _0x506023=schema(properties[_0x4e94('0x5d')])[_0x4e94('0x1')](_0x2f2649);if(_0x506023[_0x4e94('0x59')]>0x0){return _0x434726(_0x51a3a2['error'](0x1f4,_[_0x4e94('0x5e')](_0x506023,_0x4e94('0x1a'))['join'](',\x20')));}var _0x1e0307=_[_0x4e94('0x5f')](_0xe47674[_0x4e94('0x5c')],{'uniqueid':_0x2f2649[_0x4e94('0x60')]});if(_0x1e0307&&_0x1e0307['channel']){var _0x275766=util['format'](_0x4e94('0x61'),_0x2f2649[_0x4e94('0x62')]||_0x2f2649[_0x4e94('0x60')],_0x2f2649[_0x4e94('0x63')]||_0x4e94('0x64'));return ami['Action']({'action':_0x4e94('0x65'),'channel':_0x1e0307['channel'],'file':_0x275766,'options':_0x4e94('0x66')})[_0x4e94('0x17')](function(_0x5c80ab){var _0x416a4a=_[_0x4e94('0x5f')](_0x1e0307[_0x4e94('0x67')],{'filename':_0x4e94('0x68')+_0x275766['toLowerCase']()});if(_[_0x4e94('0x69')](_0x416a4a)){_0x1e0307['monitors'][_0x4e94('0x58')]({'filename':_0x4e94('0x68')+_0x275766[_0x4e94('0x6a')](),'createdAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x5c80ab['mixmonitorid'],'status':_0x4e94('0x6b')});}else{_0x416a4a[_0x4e94('0x6c')]=_0x5c80ab[_0x4e94('0x6c')];_0x416a4a[_0x4e94('0x6d')]=_0x4e94('0x6b');}_0x539fb4({'code':0xc8,'message':[_0x2f2649[_0x4e94('0x60')],_0x4e94('0x6e'),_0x5c80ab['mixmonitorid']][_0x4e94('0x10')]('\x20'),'mixmonitorid':_0x5c80ab[_0x4e94('0x6c')]});})[_0x4e94('0x18')](function(_0x288348){_0x434726(_0x51a3a2[_0x4e94('0x19')](0x1f5,[_0x2f2649[_0x4e94('0x60')],_0x288348[_0x4e94('0x1a')][_0x4e94('0x6a')]()][_0x4e94('0x10')]('\x20')));});}else{return _0x434726(_0x51a3a2[_0x4e94('0x19')](0x1f5,_0x4e94('0x6f')));}});},'VoiceChannelStopMixMonitor':function(_0x3e82ff){var _0x8b2786=this;return new Promise(function(_0x1b70c9,_0x3962ea){if(ami[_0x4e94('0xc')]()==![]){return _0x3962ea(_0x8b2786['error'](0x1f4,[config[_0x4e94('0xd')]['ip'],config[_0x4e94('0xd')][_0x4e94('0xe')],_0x4e94('0xf')][_0x4e94('0x10')]('\x20')));}var _0x41eaee=schema(properties[_0x4e94('0x5d')])['validate'](_0x3e82ff);if(_0x41eaee[_0x4e94('0x59')]>0x0){return _0x3962ea(_0x8b2786[_0x4e94('0x19')](0x1f4,_[_0x4e94('0x5e')](_0x41eaee,_0x4e94('0x1a'))[_0x4e94('0x10')](',\x20')));}var _0x2f3f55=_[_0x4e94('0x5f')](_0xe47674['channels'],{'uniqueid':_0x3e82ff['uniqueid']});if(_0x2f3f55){return BPromise[_0x4e94('0x70')]()[_0x4e94('0x17')](function(){if(_0x2f3f55['channel']){return ami[_0x4e94('0x16')]({'action':'StopMixMonitor','channel':_0x2f3f55[_0x4e94('0x71')],'mixmonitorid':_0x3e82ff[_0x4e94('0x6c')]})[_0x4e94('0x18')](function(_0x9238f1){});}})['then'](function(){if(_0x2f3f55[_0x4e94('0x72')]){return ami[_0x4e94('0x16')]({'action':_0x4e94('0x73'),'channel':_0x2f3f55[_0x4e94('0x72')],'mixmonitorid':_0x3e82ff[_0x4e94('0x6c')]})[_0x4e94('0x18')](function(_0x5b68f1){});}})[_0x4e94('0x17')](function(_0x5e27af){var _0x33f24f=_[_0x4e94('0x5f')](_0x2f3f55['monitors'],{'mixmonitorid':_0x3e82ff[_0x4e94('0x6c')]});if(_0x33f24f){_0x33f24f['status']=_0x4e94('0x74');}})[_0x4e94('0x17')](function(){var _0x5d142a=util[_0x4e94('0x63')]('%s.%s',_0x3e82ff[_0x4e94('0x62')]||_0x3e82ff[_0x4e94('0x60')],_0x3e82ff[_0x4e94('0x63')]||_0x4e94('0x64'));var _0x5084bf=_[_0x4e94('0x5f')](_0x2f3f55['monitors'],{'filename':_0x4e94('0x68')+_0x5d142a[_0x4e94('0x6a')]()});if(_0x5084bf){_0x5084bf[_0x4e94('0x6d')]='stop';}})[_0x4e94('0x17')](function(){_0x1b70c9({'code':0xc8,'message':[_0x3e82ff['uniqueid'],_0x4e94('0x75')][_0x4e94('0x10')]('\x20')});})[_0x4e94('0x18')](function(_0x38eed3){_0x3962ea(_0x8b2786[_0x4e94('0x19')](0x1f5,[_0x3e82ff[_0x4e94('0x60')],_0x38eed3[_0x4e94('0x1a')][_0x4e94('0x6a')]()]['join']('\x20')));});}else{return _0x3962ea(_0x8b2786['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x4e635c){return new Promise(function(_0x5a821d,_0x466d6d){var _0x5ea750=_[_0x4e94('0x5b')](_0xe47674[_0x4e94('0x76')]);_0x5a821d({'count':_0x5ea750['length'],'rows':_0x5ea750});});},'VoiceQueuesChannel':function(_0x9d49a9){var _0x59350d=this;return new Promise(function(_0x41e4f7,_0xfec183){var _0x3a3a7c=schema(properties[_0x4e94('0x77')])['validate'](_0x9d49a9);if(_0x3a3a7c[_0x4e94('0x59')]>0x0){return _0xfec183(_0x59350d[_0x4e94('0x19')](0x1f4,_[_0x4e94('0x5e')](_0x3a3a7c,_0x4e94('0x1a'))[_0x4e94('0x10')](',\x20')));}var _0x1655d0=_[_0x4e94('0x5f')](_0xe47674[_0x4e94('0x76')],{'uniqueid':_0x9d49a9[_0x4e94('0x60')]});if(_0x1655d0){_0x41e4f7(_0x1655d0);}else{return _0xfec183(_0x59350d[_0x4e94('0x19')](0x1f5,_0x4e94('0x6f')));}});},'VoiceQueuesChannelHangup':function(_0x2b8abf){var _0xfdd142=this;return new Promise(function(_0x4ae8d3,_0xa5e82b){if(ami['isConnected']()==![]){return _0xa5e82b(_0xfdd142[_0x4e94('0x19')](0x1f4,[config[_0x4e94('0xd')]['ip'],config[_0x4e94('0xd')][_0x4e94('0xe')],_0x4e94('0xf')]['join']('\x20')));}var _0x433a2f=schema(properties['voicequeuechannelhangup'])['validate'](_0x2b8abf);if(_0x433a2f[_0x4e94('0x59')]>0x0){return _0xa5e82b(_0xfdd142['error'](0x1f4,_[_0x4e94('0x5e')](_0x433a2f,_0x4e94('0x1a'))['join'](',\x20')));}var _0x63e77a=_[_0x4e94('0x5f')](_0xe47674[_0x4e94('0x76')],{'uniqueid':_0x2b8abf['uniqueid']});if(_0x63e77a&&_0x63e77a[_0x4e94('0x71')]){return ami[_0x4e94('0x16')]({'action':'Hangup','channel':_0x63e77a['channel']})[_0x4e94('0x17')](function(_0x13decc){_0x4ae8d3({'code':0xc8,'message':[_0x2b8abf[_0x4e94('0x60')],_0x13decc[_0x4e94('0x1a')][_0x4e94('0x6a')]()][_0x4e94('0x10')]('\x20')});})['catch'](function(_0x2e709c){_0xa5e82b(_0xfdd142[_0x4e94('0x19')](0x1f5,[_0x2b8abf[_0x4e94('0x60')],_0x2e709c[_0x4e94('0x1a')][_0x4e94('0x6a')]()][_0x4e94('0x10')]('\x20')));});}else{return _0xa5e82b(_0xfdd142[_0x4e94('0x19')](0x1f5,_0x4e94('0x6f')));}});},'VoiceQueuesChannelRedirect':function(_0x41e436){var _0x329aaa=this;return new Promise(function(_0x3ce9b8,_0x3db86c){if(ami[_0x4e94('0xc')]()==![]){return _0x3db86c(_0x329aaa[_0x4e94('0x19')](0x1f4,[config[_0x4e94('0xd')]['ip'],config[_0x4e94('0xd')][_0x4e94('0xe')],_0x4e94('0xf')]['join']('\x20')));}var _0x476e40=schema(properties[_0x4e94('0x78')])[_0x4e94('0x1')](_0x41e436);if(_0x476e40[_0x4e94('0x59')]>0x0){return _0x3db86c(_0x329aaa[_0x4e94('0x19')](0x1f4,_[_0x4e94('0x5e')](_0x476e40,_0x4e94('0x1a'))['join'](',\x20')));}var _0x524a86=_['find'](_0xe47674[_0x4e94('0x76')],{'uniqueid':_0x41e436[_0x4e94('0x60')]});if(_0x524a86&&_0x524a86[_0x4e94('0x71')]){return ami['Action']({'action':_0x4e94('0x79'),'channel':_0x524a86[_0x4e94('0x71')],'exten':_0x41e436['exten'],'context':_0x41e436[_0x4e94('0x7a')]||_0x524a86[_0x4e94('0x7a')],'priority':0x1})[_0x4e94('0x17')](function(_0x55264f){_0x3ce9b8({'code':0xc8,'message':[_0x41e436[_0x4e94('0x60')],_0x55264f[_0x4e94('0x1a')][_0x4e94('0x6a')]()][_0x4e94('0x10')]('\x20')});})[_0x4e94('0x18')](function(_0x30ee52){_0x3db86c(_0x329aaa[_0x4e94('0x19')](0x1f5,[_0x41e436[_0x4e94('0x60')],_0x30ee52['message'][_0x4e94('0x6a')]()]['join']('\x20')));});}else{return _0x3db86c(_0x329aaa['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x348a80){return new Promise(function(_0x5ed8e2,_0x30c24d){var _0x2758bd=_['values'](_0xe47674[_0x4e94('0xa')]);_0x5ed8e2({'count':_0x2758bd['length'],'rows':_0x2758bd});});},'Telephones':function(_0x2ce52f){return new Promise(function(_0x2475e7,_0x49dbf4){var _0x5ac8f3=_[_0x4e94('0x5b')](_0xe47674[_0x4e94('0x7b')]);_0x2475e7({'count':_0x5ac8f3[_0x4e94('0x59')],'rows':_0x5ac8f3});});},'Trunks':function(_0x130e0b){return new Promise(function(_0x46de56,_0x46ad0b){var _0x4bdba1=_[_0x4e94('0x5b')](_0xe47674[_0x4e94('0x7c')]);_0x46de56({'count':_0x4bdba1['length'],'rows':_0x4bdba1});});},'OutboundChannels':function(_0x26ddde){return new Promise(function(_0x49d92c,_0x22dc50){var _0x5d4b99=_[_0x4e94('0x5b')](_0xe47674[_0x4e94('0x7d')]);_0x49d92c({'count':_0x5d4b99['length'],'rows':_0x5d4b99});});},'Outbound':function(_0xecd1dd){return new Promise(function(_0x1e6f05,_0x34b061){_0x1e6f05(_0xe47674[_0x4e94('0x2c')]);});},'Campaigns':function(_0x101d12){return new Promise(function(_0x2d608f,_0x2062fb){var _0x5de6c4=_[_0x4e94('0x5b')](_0xe47674['campaigns']);_0x2d608f({'count':_0x5de6c4['length'],'rows':_0x5de6c4});});},'VoiceQueuesPreview':function(_0x57a532){var _0x51f805=this;return new Promise(function(_0x281298,_0x3b1742){_0x27bbd9[_0x4e94('0x7e')](_0x57a532['id'])[_0x4e94('0x17')](function(_0x55abd3){_0x281298({'code':0xc8,'message':_0x55abd3[_0x4e94('0x1a')]});})[_0x4e94('0x18')](function(_0x1bf9cb){_0x3b1742(_0x51f805[_0x4e94('0x19')](0x1f4,_0x1bf9cb['message']));});});},'EventManager':function(_0x5cf225){var _0x16a4d3=this;return new Promise(function(_0x1e2a33,_0x59fc39){if(!_0x5cf225[_0x4e94('0x7f')]){return _0x59fc39(_0x16a4d3[_0x4e94('0x19')](0x1f4,_0x4e94('0x80')));}ami[_0x4e94('0x81')](_0x4e94('0x82')+_0x5cf225[_0x4e94('0x7f')],_0x5cf225[_0x4e94('0x1a')]);_0x1e2a33({'code':0xc8,'message':_0x5cf225});});},'FaxAccounts':function(_0x457340){return new Promise(function(_0x5a1a4d,_0x434ec3){var _0x5af973=_[_0x4e94('0x5b')](_0xe47674[_0x4e94('0x83')]);_0x5a1a4d({'count':_0x5af973[_0x4e94('0x59')],'rows':_0x5af973});});},'SendFax':function(_0x2ebc1e){var _0x47a570=this;return new Promise(function(_0x25fffe,_0x228bd3){_0xbb43ae[_0x4e94('0x84')](_0x2ebc1e)[_0x4e94('0x17')](function(_0x373379){_0x25fffe({'code':0xc8,'message':_0x373379[_0x4e94('0x1a')]});})['catch'](function(_0x14f4ef){_0x228bd3(_0x47a570[_0x4e94('0x19')](0x1f4,_0x14f4ef[_0x4e94('0x1a')]));});});},'CheckAfterSend':function(_0x20104a){var _0x13058b=this;return new Promise(function(_0x148664,_0x51f162){_0xbb43ae[_0x4e94('0x85')](_0x20104a)[_0x4e94('0x17')](function(_0x2c838e){_0x148664({'code':0xc8,'message':_0x2c838e[_0x4e94('0x1a')]});})[_0x4e94('0x18')](function(_0x473700){_0x51f162(_0x13058b[_0x4e94('0x19')](0x1f4,_0x473700[_0x4e94('0x1a')]));});});}};var _0x22d2ec=jayson[_0x4e94('0x86')](_0x28a1fd)['http']();_0x22d2ec['on'](_0x4e94('0x19'),function(_0x1e710c){return _0x44a2cd(_0x1e710c);});_0x22d2ec['listen'](0x232a,_0x4e94('0x87'),function(){console[_0x4e94('0x88')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x4d00e5(_0x4e94('0x89')+0x232a);});});}; \ No newline at end of file +var _0x5fab=['talking','total','type','unmanaged','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','name','push','length','find','omit','undefined','values','channels','ami\x20disconnected','voicechannel','map','uniqueid','channel','%s.%s','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','exten','context','trunks','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','send','checkAfterSend','server','http','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','validate','bluebird','moment','../../../config/environment','../properties','../ami','listen','format','%s/%s','timers','timer','updateAcw','agents','updateStatusRealtime','QueuePause','isConnected','error','asterisk','username','pick','keys','module','action','then','message','catch','join','Command','Action','content','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime'];(function(_0x417baa,_0x3923d0){var _0x42724f=function(_0x276146){while(--_0x276146){_0x417baa['push'](_0x417baa['shift']());}};_0x42724f(++_0x3923d0);}(_0x5fab,0x177));var _0xb5fa=function(_0x20feae,_0x31e753){_0x20feae=_0x20feae-0x0;var _0x5c3dd2=_0x5fab[_0x20feae];return _0x5c3dd2;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var jayson=require('jayson/promise');var schema=require(_0xb5fa('0x2'));var BPromise=require(_0xb5fa('0x3'));var moment=require(_0xb5fa('0x4'));var config=require(_0xb5fa('0x5'));var properties=require(_0xb5fa('0x6'));var ami=require(_0xb5fa('0x7'));exports[_0xb5fa('0x8')]=function(_0x4341d3,_0x10361d,_0x44df89){return new BPromise(function(_0x4a0249,_0x5d70f6){var _0x2e3804={'QueuePause':function(_0x1aec3e){return new Promise(function(_0x9c7bce,_0x56d018){var _0x410eff=util[_0xb5fa('0x9')](_0xb5fa('0xa'),'SIP',_0x1aec3e['name']);if(_0x4341d3[_0xb5fa('0xb')]&&_0x4341d3[_0xb5fa('0xb')][_0x410eff]&&_0x4341d3[_0xb5fa('0xb')][_0x410eff][_0xb5fa('0xc')]){_0x4341d3[_0xb5fa('0xb')][_0x410eff][_0xb5fa('0xd')]();}if(_0x4341d3[_0xb5fa('0xe')][_0x410eff]){_0x4341d3[_0xb5fa('0xe')][_0x410eff][_0xb5fa('0xf')]({'statePause':_0x1aec3e['pause']?!![]:![]});}_0x9c7bce({'code':0xc8,'message':_0xb5fa('0x10')});});},'Reload':function(_0x3dad4d){var _0x56e8b0=this;return new Promise(function(_0x116849,_0x577af0){if(ami[_0xb5fa('0x11')]()==![]){return _0x577af0(_0x56e8b0[_0xb5fa('0x12')](0x1f4,[config[_0xb5fa('0x13')]['ip'],config[_0xb5fa('0x13')][_0xb5fa('0x14')],'ami\x20disconnected']['join']('\x20')));}_0x3dad4d=_[_0xb5fa('0x15')](_0x3dad4d,_[_0xb5fa('0x16')](properties[_0xb5fa('0x17')]));_0x3dad4d[_0xb5fa('0x18')]='Reload';return ami['Action'](_0x3dad4d)[_0xb5fa('0x19')](function(_0x1f7f05){_0x116849({'code':0xc8,'message':_0x1f7f05[_0xb5fa('0x1a')]});})[_0xb5fa('0x1b')](function(_0x324ba5){_0x577af0(_0x56e8b0[_0xb5fa('0x12')](0x1f5,_0x324ba5[_0xb5fa('0x1a')]));});});},'Command':function(_0x21f4f4){var _0xc14dc4=this;return new Promise(function(_0x368cb1,_0x3c8d53){if(ami[_0xb5fa('0x11')]()==![]){return _0x3c8d53(_0xc14dc4['error'](0x1f4,[config[_0xb5fa('0x13')]['ip'],config['asterisk'][_0xb5fa('0x14')],'ami\x20disconnected'][_0xb5fa('0x1c')]('\x20')));}_0x21f4f4=_[_0xb5fa('0x15')](_0x21f4f4,'command');_0x21f4f4[_0xb5fa('0x18')]=_0xb5fa('0x1d');return ami[_0xb5fa('0x1e')](_0x21f4f4)['then'](function(_0x32a85c){_0x368cb1({'code':0xc8,'message':_0x32a85c[_0xb5fa('0x1f')]});})[_0xb5fa('0x1b')](function(_0x542348){_0x3c8d53(_0xc14dc4[_0xb5fa('0x12')](0x1f5,_0x542348['message']));});});},'VoiceQueues':function(_0x106c4b){return new Promise(function(_0x264591,_0x11053a){var _0x543edf=[];for(var _0x2dbd22 in _0x4341d3[_0xb5fa('0x20')]){if(_0x4341d3[_0xb5fa('0x20')][_0xb5fa('0x21')](_0x2dbd22)){var _0x568870=_0x4341d3['voiceQueues'][_0x2dbd22];var _0x5bdf11={'id':_0x568870['id'],'name':_0x568870['name'],'strategy':_0x568870[_0xb5fa('0x22')],'answered':_0x568870[_0xb5fa('0x23')],'available':_0x568870[_0xb5fa('0x24')],'loggedIn':_0x568870[_0xb5fa('0x25')],'pTalking':_0x568870[_0xb5fa('0x26')],'sumBillable':_0x568870[_0xb5fa('0x27')],'sumDuration':_0x568870[_0xb5fa('0x28')],'sumHoldTime':_0x568870[_0xb5fa('0x29')]||0x0,'talking':_0x568870[_0xb5fa('0x2a')],'total':_0x568870[_0xb5fa('0x2b')],'type':_0x568870[_0xb5fa('0x2c')],'unmanaged':_0x568870[_0xb5fa('0x2d')],'abandoned':_0x568870[_0xb5fa('0x2e')],'waiting':_0x568870[_0xb5fa('0x2f')],'loggedInDb':_0x568870[_0xb5fa('0x30')]};if(_0x568870[_0xb5fa('0x2c')]===_0xb5fa('0x31')){_0x5bdf11[_0xb5fa('0x32')]=_0x568870[_0xb5fa('0x32')];_0x5bdf11[_0xb5fa('0x33')]=_0x568870[_0xb5fa('0x33')];_0x5bdf11[_0xb5fa('0x34')]=_0x568870[_0xb5fa('0x34')];_0x5bdf11[_0xb5fa('0x35')]=_0x568870['dialOriginateCallerIdNumber'];_0x5bdf11[_0xb5fa('0x36')]=_0x568870['dialOriginateTimeout'];_0x5bdf11['dialPrefix']=_0x568870['dialPrefix'];_0x5bdf11[_0xb5fa('0x37')]=_0x568870['temp'];_0x5bdf11[_0xb5fa('0x38')]=_0x568870['outboundAnswerAgiCallsDay'];_0x5bdf11['outboundAnswerCallsDay']=_0x568870[_0xb5fa('0x39')];_0x5bdf11[_0xb5fa('0x3a')]=_0x568870['outboundBlacklistCallsDay'];_0x5bdf11['outboundBusyCallsDay']=_0x568870[_0xb5fa('0x3b')];_0x5bdf11[_0xb5fa('0x3c')]=_0x568870[_0xb5fa('0x3c')];_0x5bdf11['outboundDropCallsDayACS']=_0x568870[_0xb5fa('0x3d')];_0x5bdf11[_0xb5fa('0x3e')]=_0x568870['outboundDropCallsDayCallersExit'];_0x5bdf11[_0xb5fa('0x3f')]=_0x568870[_0xb5fa('0x3f')];_0x5bdf11[_0xb5fa('0x40')]=_0x568870['outboundNoAnswerCallsDay'];_0x5bdf11[_0xb5fa('0x41')]=_0x568870[_0xb5fa('0x41')];_0x5bdf11[_0xb5fa('0x42')]=_0x568870['outboundOriginateFailureCallsDay'];_0x5bdf11[_0xb5fa('0x43')]=_0x568870[_0xb5fa('0x43')];_0x5bdf11[_0xb5fa('0x44')]=_0x568870[_0xb5fa('0x44')];_0x5bdf11['outboundUnknownCallsDay']=_0x568870['outboundUnknownCallsDay'];_0x5bdf11['predictiveIntervalAnsweredCalls']=_0x568870['predictiveIntervalAnsweredCalls'];_0x5bdf11['predictiveIntervalAvgHoldtime']=_0x568870['predictiveIntervalAvgHoldtime'];_0x5bdf11[_0xb5fa('0x45')]=_0x568870['predictiveIntervalAvgTalktime'];_0x5bdf11[_0xb5fa('0x46')]=_0x568870[_0xb5fa('0x46')];_0x5bdf11[_0xb5fa('0x47')]=_0x568870[_0xb5fa('0x47')];_0x5bdf11[_0xb5fa('0x48')]=_0x568870[_0xb5fa('0x48')];_0x5bdf11['predictiveIntervalErlangCallsDroppedCalls']=_0x568870['predictiveIntervalErlangCallsDroppedCalls'];_0x5bdf11['predictiveIntervalHitRate']=_0x568870[_0xb5fa('0x49')];_0x5bdf11['predictiveIntervalMultiplicativeFactor']=_0x568870[_0xb5fa('0x4a')];_0x5bdf11['predictiveIntervalPauses']=_0x568870['predictiveIntervalPauses'];_0x5bdf11[_0xb5fa('0x4b')]=_0x568870[_0xb5fa('0x4b')];_0x5bdf11[_0xb5fa('0x4c')]=_0x568870[_0xb5fa('0x4c')];_0x5bdf11[_0xb5fa('0x1a')]=_0x568870[_0xb5fa('0x1a')];_0x5bdf11[_0xb5fa('0x4d')]=_0x568870[_0xb5fa('0x4d')];_0x5bdf11[_0xb5fa('0x4e')]=_0x568870[_0xb5fa('0x4e')];_0x5bdf11['erlangCallToSecond']=_0x568870[_0xb5fa('0x4f')];_0x5bdf11['erlangAbandonmentRate']=_0x568870[_0xb5fa('0x50')];_0x5bdf11[_0xb5fa('0x51')]=_0x568870[_0xb5fa('0x51')];_0x5bdf11[_0xb5fa('0x52')]=_0x568870[_0xb5fa('0x52')];_0x5bdf11[_0xb5fa('0x53')]=_0x568870[_0xb5fa('0x53')];}if(_0x568870[_0xb5fa('0x54')]){_0x5bdf11['Trunk']={'id':_0x568870[_0xb5fa('0x54')]['id'],'name':_0x568870[_0xb5fa('0x54')]['name'],'active':_0x568870[_0xb5fa('0x54')]['active'],'callerid':_0x568870[_0xb5fa('0x54')][_0xb5fa('0x55')]};}if(_0x568870['Interval']){_0x5bdf11['Interval']={'id':_0x568870[_0xb5fa('0x56')]['id'],'name':_0x568870[_0xb5fa('0x56')][_0xb5fa('0x57')]};}_0x543edf[_0xb5fa('0x58')](_0x5bdf11);}}_0x264591({'count':_0x543edf[_0xb5fa('0x59')],'rows':_0x543edf});});},'UpdateVoiceQueue':function(_0x28261c){return new Promise(function(_0x10f354,_0x125a5c){var _0x499d36=_[_0xb5fa('0x5a')](_0x4341d3[_0xb5fa('0x20')],{'id':parseInt(_0x28261c['id'])});var _0x4e0fe7=_[_0xb5fa('0x5b')](_0x28261c,['id']);if(_0x499d36){for(var _0x2c378a in _0x4e0fe7){if(typeof _0x4e0fe7[_0x2c378a]!==_0xb5fa('0x5c')&&typeof _0x499d36[_0x2c378a]!==_0xb5fa('0x5c')){_0x499d36[_0x2c378a]=_0x4e0fe7[_0x2c378a];}}_0x10f354(_0x499d36);}else{_0x125a5c();}});},'VoiceChannels':function(_0x30d0d4){return new Promise(function(_0x27d900,_0x1e1c2){var _0x33eb2c=_[_0xb5fa('0x5d')](_0x4341d3[_0xb5fa('0x5e')]);_0x27d900({'count':_0x33eb2c[_0xb5fa('0x59')],'rows':_0x33eb2c});});},'VoiceChannelMixMonitor':function(_0x2bafe4){var _0x6ae261=this;return new Promise(function(_0x23be4c,_0x42a359){if(ami[_0xb5fa('0x11')]()==![]){return _0x42a359(_0x6ae261['error'](0x1f4,[config['asterisk']['ip'],config[_0xb5fa('0x13')]['username'],_0xb5fa('0x5f')][_0xb5fa('0x1c')]('\x20')));}var _0x5404f6=schema(properties[_0xb5fa('0x60')])[_0xb5fa('0x2')](_0x2bafe4);if(_0x5404f6[_0xb5fa('0x59')]>0x0){return _0x42a359(_0x6ae261[_0xb5fa('0x12')](0x1f4,_[_0xb5fa('0x61')](_0x5404f6,_0xb5fa('0x1a'))['join'](',\x20')));}var _0x27a651=_['find'](_0x4341d3[_0xb5fa('0x5e')],{'uniqueid':_0x2bafe4[_0xb5fa('0x62')]});if(_0x27a651&&_0x27a651[_0xb5fa('0x63')]){var _0x51f96a=util[_0xb5fa('0x9')](_0xb5fa('0x64'),_0x2bafe4['filename']||_0x2bafe4['uniqueid'],_0x2bafe4[_0xb5fa('0x9')]||_0xb5fa('0x65'));return ami[_0xb5fa('0x1e')]({'action':_0xb5fa('0x66'),'channel':_0x27a651[_0xb5fa('0x63')],'file':_0x51f96a,'options':_0xb5fa('0x67')})[_0xb5fa('0x19')](function(_0x3b092a){var _0x1c1f1b=_[_0xb5fa('0x5a')](_0x27a651[_0xb5fa('0x68')],{'filename':_0xb5fa('0x69')+_0x51f96a[_0xb5fa('0x6a')]()});if(_[_0xb5fa('0x6b')](_0x1c1f1b)){_0x27a651[_0xb5fa('0x68')][_0xb5fa('0x58')]({'filename':_0xb5fa('0x69')+_0x51f96a[_0xb5fa('0x6a')](),'createdAt':moment()['format'](_0xb5fa('0x6c')),'mixmonitorid':_0x3b092a[_0xb5fa('0x6d')],'status':_0xb5fa('0x6e')});}else{_0x1c1f1b[_0xb5fa('0x6d')]=_0x3b092a[_0xb5fa('0x6d')];_0x1c1f1b[_0xb5fa('0x6f')]=_0xb5fa('0x6e');}_0x23be4c({'code':0xc8,'message':[_0x2bafe4[_0xb5fa('0x62')],_0xb5fa('0x70'),_0x3b092a[_0xb5fa('0x6d')]]['join']('\x20'),'mixmonitorid':_0x3b092a['mixmonitorid']});})[_0xb5fa('0x1b')](function(_0x264732){_0x42a359(_0x6ae261[_0xb5fa('0x12')](0x1f5,[_0x2bafe4['uniqueid'],_0x264732[_0xb5fa('0x1a')][_0xb5fa('0x6a')]()][_0xb5fa('0x1c')]('\x20')));});}else{return _0x42a359(_0x6ae261[_0xb5fa('0x12')](0x1f5,_0xb5fa('0x71')));}});},'VoiceChannelStopMixMonitor':function(_0x9d12f1){var _0x2e7286=this;return new Promise(function(_0x4f82f0,_0x7bcd09){if(ami[_0xb5fa('0x11')]()==![]){return _0x7bcd09(_0x2e7286['error'](0x1f4,[config[_0xb5fa('0x13')]['ip'],config[_0xb5fa('0x13')]['username'],_0xb5fa('0x5f')][_0xb5fa('0x1c')]('\x20')));}var _0x2d8b19=schema(properties[_0xb5fa('0x60')])[_0xb5fa('0x2')](_0x9d12f1);if(_0x2d8b19[_0xb5fa('0x59')]>0x0){return _0x7bcd09(_0x2e7286[_0xb5fa('0x12')](0x1f4,_[_0xb5fa('0x61')](_0x2d8b19,_0xb5fa('0x1a'))[_0xb5fa('0x1c')](',\x20')));}var _0xfb88cc=_[_0xb5fa('0x5a')](_0x4341d3[_0xb5fa('0x5e')],{'uniqueid':_0x9d12f1[_0xb5fa('0x62')]});if(_0xfb88cc){return BPromise[_0xb5fa('0x72')]()[_0xb5fa('0x19')](function(){if(_0xfb88cc[_0xb5fa('0x63')]){return ami[_0xb5fa('0x1e')]({'action':_0xb5fa('0x73'),'channel':_0xfb88cc[_0xb5fa('0x63')],'mixmonitorid':_0x9d12f1[_0xb5fa('0x6d')]})[_0xb5fa('0x1b')](function(_0x488563){});}})[_0xb5fa('0x19')](function(){if(_0xfb88cc[_0xb5fa('0x74')]){return ami[_0xb5fa('0x1e')]({'action':'StopMixMonitor','channel':_0xfb88cc[_0xb5fa('0x74')],'mixmonitorid':_0x9d12f1[_0xb5fa('0x6d')]})['catch'](function(_0x44fd4a){});}})[_0xb5fa('0x19')](function(_0x5c25f6){var _0x571bb9=_['find'](_0xfb88cc[_0xb5fa('0x68')],{'mixmonitorid':_0x9d12f1[_0xb5fa('0x6d')]});if(_0x571bb9){_0x571bb9[_0xb5fa('0x6f')]='stop';}})[_0xb5fa('0x19')](function(){var _0x30d53b=util[_0xb5fa('0x9')](_0xb5fa('0x64'),_0x9d12f1['filename']||_0x9d12f1['uniqueid'],_0x9d12f1['format']||_0xb5fa('0x65'));var _0x28a5f1=_[_0xb5fa('0x5a')](_0xfb88cc['monitors'],{'filename':_0xb5fa('0x69')+_0x30d53b[_0xb5fa('0x6a')]()});if(_0x28a5f1){_0x28a5f1[_0xb5fa('0x6f')]=_0xb5fa('0x75');}})[_0xb5fa('0x19')](function(){_0x4f82f0({'code':0xc8,'message':[_0x9d12f1[_0xb5fa('0x62')],_0xb5fa('0x76')][_0xb5fa('0x1c')]('\x20')});})[_0xb5fa('0x1b')](function(_0x371d23){_0x7bcd09(_0x2e7286[_0xb5fa('0x12')](0x1f5,[_0x9d12f1[_0xb5fa('0x62')],_0x371d23[_0xb5fa('0x1a')][_0xb5fa('0x6a')]()][_0xb5fa('0x1c')]('\x20')));});}else{return _0x7bcd09(_0x2e7286['error'](0x1f5,_0xb5fa('0x71')));}});},'VoiceQueuesChannels':function(_0x5a6f74){return new Promise(function(_0x47193c,_0x209213){var _0x37975d=_[_0xb5fa('0x5d')](_0x4341d3[_0xb5fa('0x77')]);_0x47193c({'count':_0x37975d['length'],'rows':_0x37975d});});},'VoiceQueuesChannel':function(_0x1585cd){var _0x589c29=this;return new Promise(function(_0x77a831,_0x3ab924){var _0x118a0e=schema(properties[_0xb5fa('0x78')])['validate'](_0x1585cd);if(_0x118a0e['length']>0x0){return _0x3ab924(_0x589c29['error'](0x1f4,_[_0xb5fa('0x61')](_0x118a0e,_0xb5fa('0x1a'))[_0xb5fa('0x1c')](',\x20')));}var _0x32e329=_[_0xb5fa('0x5a')](_0x4341d3[_0xb5fa('0x77')],{'uniqueid':_0x1585cd['uniqueid']});if(_0x32e329){_0x77a831(_0x32e329);}else{return _0x3ab924(_0x589c29[_0xb5fa('0x12')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x4ca73e){var _0x234b95=this;return new Promise(function(_0x4cba86,_0x5d11bb){if(ami['isConnected']()==![]){return _0x5d11bb(_0x234b95[_0xb5fa('0x12')](0x1f4,[config['asterisk']['ip'],config[_0xb5fa('0x13')][_0xb5fa('0x14')],_0xb5fa('0x5f')]['join']('\x20')));}var _0x5cac2e=schema(properties[_0xb5fa('0x79')])[_0xb5fa('0x2')](_0x4ca73e);if(_0x5cac2e['length']>0x0){return _0x5d11bb(_0x234b95[_0xb5fa('0x12')](0x1f4,_[_0xb5fa('0x61')](_0x5cac2e,_0xb5fa('0x1a'))[_0xb5fa('0x1c')](',\x20')));}var _0x4e6432=_[_0xb5fa('0x5a')](_0x4341d3[_0xb5fa('0x77')],{'uniqueid':_0x4ca73e[_0xb5fa('0x62')]});if(_0x4e6432&&_0x4e6432[_0xb5fa('0x63')]){return ami[_0xb5fa('0x1e')]({'action':_0xb5fa('0x7a'),'channel':_0x4e6432[_0xb5fa('0x63')]})['then'](function(_0x1e707a){_0x4cba86({'code':0xc8,'message':[_0x4ca73e['uniqueid'],_0x1e707a[_0xb5fa('0x1a')][_0xb5fa('0x6a')]()]['join']('\x20')});})[_0xb5fa('0x1b')](function(_0x212d4e){_0x5d11bb(_0x234b95[_0xb5fa('0x12')](0x1f5,[_0x4ca73e[_0xb5fa('0x62')],_0x212d4e[_0xb5fa('0x1a')][_0xb5fa('0x6a')]()][_0xb5fa('0x1c')]('\x20')));});}else{return _0x5d11bb(_0x234b95[_0xb5fa('0x12')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x10f6b9){var _0x3b8d77=this;return new Promise(function(_0x2c5357,_0x20ffa1){if(ami['isConnected']()==![]){return _0x20ffa1(_0x3b8d77['error'](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0xb5fa('0x14')],_0xb5fa('0x5f')][_0xb5fa('0x1c')]('\x20')));}var _0x188e66=schema(properties['voicequeuechannelredirect'])['validate'](_0x10f6b9);if(_0x188e66[_0xb5fa('0x59')]>0x0){return _0x20ffa1(_0x3b8d77['error'](0x1f4,_[_0xb5fa('0x61')](_0x188e66,_0xb5fa('0x1a'))[_0xb5fa('0x1c')](',\x20')));}var _0xfbd3ee=_['find'](_0x4341d3[_0xb5fa('0x77')],{'uniqueid':_0x10f6b9['uniqueid']});if(_0xfbd3ee&&_0xfbd3ee[_0xb5fa('0x63')]){return ami[_0xb5fa('0x1e')]({'action':'Redirect','channel':_0xfbd3ee['channel'],'exten':_0x10f6b9[_0xb5fa('0x7b')],'context':_0x10f6b9[_0xb5fa('0x7c')]||_0xfbd3ee[_0xb5fa('0x7c')],'priority':0x1})[_0xb5fa('0x19')](function(_0x20d6b5){_0x2c5357({'code':0xc8,'message':[_0x10f6b9[_0xb5fa('0x62')],_0x20d6b5[_0xb5fa('0x1a')][_0xb5fa('0x6a')]()][_0xb5fa('0x1c')]('\x20')});})[_0xb5fa('0x1b')](function(_0x316a06){_0x20ffa1(_0x3b8d77[_0xb5fa('0x12')](0x1f5,[_0x10f6b9[_0xb5fa('0x62')],_0x316a06['message']['toLowerCase']()][_0xb5fa('0x1c')]('\x20')));});}else{return _0x20ffa1(_0x3b8d77['error'](0x1f5,_0xb5fa('0x71')));}});},'Agents':function(_0x18528c){return new Promise(function(_0x502946,_0x226e02){var _0x15f50f=_['values'](_0x4341d3[_0xb5fa('0xe')]);_0x502946({'count':_0x15f50f[_0xb5fa('0x59')],'rows':_0x15f50f});});},'Telephones':function(_0x4b9d03){return new Promise(function(_0x138c60,_0x3a59ed){var _0x367593=_['values'](_0x4341d3['telephones']);_0x138c60({'count':_0x367593[_0xb5fa('0x59')],'rows':_0x367593});});},'Trunks':function(_0x1a24a2){return new Promise(function(_0x3b5e1d,_0x3d18a9){var _0x397830=_[_0xb5fa('0x5d')](_0x4341d3[_0xb5fa('0x7d')]);_0x3b5e1d({'count':_0x397830[_0xb5fa('0x59')],'rows':_0x397830});});},'OutboundChannels':function(_0xe0f5a0){return new Promise(function(_0x1a4465,_0x497903){var _0x53b29e=_[_0xb5fa('0x5d')](_0x4341d3[_0xb5fa('0x7e')]);_0x1a4465({'count':_0x53b29e[_0xb5fa('0x59')],'rows':_0x53b29e});});},'Outbound':function(_0x18498d){return new Promise(function(_0x5c64ae,_0x2c93c7){_0x5c64ae(_0x4341d3[_0xb5fa('0x31')]);});},'Campaigns':function(_0x1797e4){return new Promise(function(_0x525fe3,_0xcd2b08){var _0xea65=_[_0xb5fa('0x5d')](_0x4341d3[_0xb5fa('0x7f')]);_0x525fe3({'count':_0xea65['length'],'rows':_0xea65});});},'VoiceQueuesPreview':function(_0x1175da){var _0x4646aa=this;return new Promise(function(_0x17438e,_0x229101){_0x10361d[_0xb5fa('0x80')](_0x1175da['id'])[_0xb5fa('0x19')](function(_0x36014a){_0x17438e({'code':0xc8,'message':_0x36014a[_0xb5fa('0x1a')]});})[_0xb5fa('0x1b')](function(_0x32d4da){_0x229101(_0x4646aa[_0xb5fa('0x12')](0x1f4,_0x32d4da[_0xb5fa('0x1a')]));});});},'EventManager':function(_0x26d371){var _0x245f63=this;return new Promise(function(_0x308533,_0x5528f8){if(!_0x26d371[_0xb5fa('0x81')]){return _0x5528f8(_0x245f63[_0xb5fa('0x12')](0x1f4,_0xb5fa('0x82')));}ami[_0xb5fa('0x83')](_0xb5fa('0x84')+_0x26d371[_0xb5fa('0x81')],_0x26d371[_0xb5fa('0x1a')]);_0x308533({'code':0xc8,'message':_0x26d371});});},'FaxAccounts':function(_0x440669){return new Promise(function(_0x512e21,_0x49f429){var _0x3203e8=_['values'](_0x4341d3['faxAccounts']);_0x512e21({'count':_0x3203e8[_0xb5fa('0x59')],'rows':_0x3203e8});});},'SendFax':function(_0x27dbe8){var _0x2faf23=this;return new Promise(function(_0x4d607d,_0x3e3b94){_0x44df89[_0xb5fa('0x85')](_0x27dbe8)[_0xb5fa('0x19')](function(_0x4972fd){_0x4d607d({'code':0xc8,'message':_0x4972fd[_0xb5fa('0x1a')]});})[_0xb5fa('0x1b')](function(_0x4f4649){_0x3e3b94(_0x2faf23[_0xb5fa('0x12')](0x1f4,_0x4f4649[_0xb5fa('0x1a')]));});});},'CheckAfterSend':function(_0x3791e7){var _0xf15d5c=this;return new Promise(function(_0x39e9ae,_0x40f10f){_0x44df89[_0xb5fa('0x86')](_0x3791e7)['then'](function(_0x2c6212){_0x39e9ae({'code':0xc8,'message':_0x2c6212[_0xb5fa('0x1a')]});})[_0xb5fa('0x1b')](function(_0x320eda){_0x40f10f(_0xf15d5c['error'](0x1f4,_0x320eda['message']));});});}};var _0x181ad8=jayson[_0xb5fa('0x87')](_0x2e3804)[_0xb5fa('0x88')]();_0x181ad8['on'](_0xb5fa('0x12'),function(_0x4eb5a0){return _0x5d70f6(_0x4eb5a0);});_0x181ad8['listen'](0x232a,'127.0.0.1',function(){console['log'](_0xb5fa('0x89'),0x232a);return _0x4a0249(_0xb5fa('0x8a')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index e168954..09ece46 100644 --- a/server/services/ami/trigger/cmContact/index.js +++ b/server/services/ami/trigger/cmContact/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xed12=['data3','split','phone','$or','map','routeId','lastName','mobile','createdAt','scheduledAt','union','resolve','then','isEmpty','uniqueid','info','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','destcalleridnum','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','calleridnum','firstName','format','name','trigger:%s','toLowerCase','length','lodash','bluebird','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','localhost','socket.io-emitter','[CM][%s][%s]','emit','exec','data1','data2','xmd-contactid','ListId'];(function(_0x6d8bb9,_0x1fe019){var _0x46bc45=function(_0x1d1a79){while(--_0x1d1a79){_0x6d8bb9['push'](_0x6d8bb9['shift']());}};_0x46bc45(++_0x1fe019);}(_0xed12,0xfd));var _0x2ed1=function(_0x57cc5a,_0x342f76){_0x57cc5a=_0x57cc5a-0x0;var _0x4d82df=_0xed12[_0x57cc5a];return _0x4d82df;};'use strict';var _=require(_0x2ed1('0x0'));var BPromise=require(_0x2ed1('0x1'));var Redis=require('ioredis');var util=require(_0x2ed1('0x2'));var config=require(_0x2ed1('0x3'));var logger=require(_0x2ed1('0x4'))(_0x2ed1('0x5'));var cmContactRpc=require(_0x2ed1('0x6'));config[_0x2ed1('0x7')]=_['defaults'](config[_0x2ed1('0x7')],{'host':_0x2ed1('0x8'),'port':0x18eb});var io=require(_0x2ed1('0x9'))(new Redis(config[_0x2ed1('0x7')]));function emit(_0x35a7b0,_0x362aae,_0x46f363,_0x57facc,_0x30fd7b){logger['info'](_0x2ed1('0xa'),_0x35a7b0,_0x362aae['id'],_0x46f363,_0x57facc,JSON['stringify'](_0x30fd7b));io['to'](_0x46f363)[_0x2ed1('0xb')](_0x57facc,_0x30fd7b);}exports[_0x2ed1('0xc')]=function(_0x5a6a8d,_0x2e1228,_0x5787e3,_0x245640){var _0x4130a8,_0x3382fb;var _0x2e0733={};var _0x2cf09e=Number(_0x5787e3[_0x2ed1('0xd')]);var _0x2e6ac1=_0x5787e3[_0x2ed1('0xe')]?Boolean(Number(_0x5787e3[_0x2ed1('0xe')])):![];var _0xe8aa10;if(_0x245640[_0x2ed1('0xf')]){_0x2e0733['id']=_0x245640['xmd-contactid'];}if(!_0x2e0733['id']){_0x2e0733[_0x2ed1('0x10')]=_0x2cf09e;_0xe8aa10=_0x5787e3['data3']&&_0x5787e3[_0x2ed1('0x11')]!=='0'?_0x5787e3['data3'][_0x2ed1('0x12')](','):[_0x2ed1('0x13')];_0x2e0733[_0x2ed1('0x14')]=_[_0x2ed1('0x15')](_0xe8aa10,function(_0x3d3daf){var _0x507580={};_0x507580[_0x3d3daf]=_0x245640[_0x2ed1('0x16')]?_0x245640['destcalleridnum']:_0x245640['calleridnum'];return _0x507580;});}var _0x2c4f5a=['id','firstName',_0x2ed1('0x17'),_0x2ed1('0x13'),_0x2ed1('0x18'),'fax',_0x2ed1('0x10'),_0x2ed1('0x19'),_0x2ed1('0x1a'),'updatedAt'];var _0x14c543=_[_0x2ed1('0x1b')](_0x2c4f5a,_0xe8aa10);BPromise[_0x2ed1('0x1c')]()['then'](cmContactRpc['getContacts']({'attributes':_0x14c543,'where':_0x2e0733}))[_0x2ed1('0x1d')](function(_0x17ebbb){_0x3382fb=_0x17ebbb;if(!_[_0x2ed1('0x1e')](_0x3382fb)){if(_0x3382fb['length']===0x1){_0x4130a8=_0x3382fb[0x0];logger['info']('[CM][%s][%s]\x20Contact\x20found:%s',_0x245640[_0x2ed1('0x1f')],_0x2e1228['id'],_0x4130a8['id']);}else{logger[_0x2ed1('0x20')](_0x2ed1('0x21'),_0x245640['uniqueid'],_0x2e1228['id'],_[_0x2ed1('0x15')](_0x3382fb,'id')[_0x2ed1('0x22')](','));}return;}else{logger[_0x2ed1('0x20')](_0x2ed1('0x23'),_0x245640['uniqueid'],_0x2e1228['id']);var _0x120854={'ListId':_0x2cf09e};var _0x47feb5=_0x5787e3[_0x2ed1('0x24')]&&_0x5787e3[_0x2ed1('0x24')]!=='0'?_0x5787e3[_0x2ed1('0x24')]:_0x2ed1('0x13');if(_0x2e6ac1){logger['info'](_0x2ed1('0x25'),_0x245640['uniqueid'],_0x2e1228['id']);_0x120854[_0x47feb5]=_[_0x2ed1('0x26')](_0x245640['routeId'])?_0x245640['calleridnum']:_0x245640[_0x2ed1('0x27')];if(_['isNil'](_0x245640[_0x2ed1('0x16')])){_0x120854['firstName']=_0x245640[_0x2ed1('0x28')]&&_0x245640[_0x2ed1('0x28')]!==_0x2ed1('0x29')?_0x245640['calleridname']:_0x2ed1('0x2a');}else{_0x120854['firstName']=_0x245640['destcalleridname']&&_0x245640[_0x2ed1('0x2b')]!==_0x2ed1('0x29')?_0x245640[_0x2ed1('0x2b')]:_0x2ed1('0x2a');}return BPromise['resolve']()['then'](cmContactRpc[_0x2ed1('0x2c')](_0x120854))[_0x2ed1('0x1d')](function(_0x52ade0){_0x4130a8=_0x52ade0;_0x3382fb[_0x2ed1('0x2d')](_0x52ade0);if(_0x4130a8){logger[_0x2ed1('0x20')](_0x2ed1('0x2e'),_0x245640[_0x2ed1('0x1f')],_0x2e1228['id'],_0x4130a8['id']);}return;});}else{logger[_0x2ed1('0x20')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x245640['uniqueid'],_0x2e1228['id']);_0x120854[_0x47feb5]=_['isNil'](_0x245640[_0x2ed1('0x16')])?_0x245640[_0x2ed1('0x2f')]:_0x245640[_0x2ed1('0x27')];if(_[_0x2ed1('0x26')](_0x245640[_0x2ed1('0x16')])){_0x120854[_0x2ed1('0x30')]=_0x245640[_0x2ed1('0x28')]&&_0x245640[_0x2ed1('0x28')]!==_0x2ed1('0x29')?_0x245640[_0x2ed1('0x28')]:_0x2ed1('0x2a');}else{_0x120854[_0x2ed1('0x30')]=_0x245640[_0x2ed1('0x2b')]&&_0x245640['destcalleridname']!==_0x2ed1('0x29')?_0x245640[_0x2ed1('0x2b')]:_0x2ed1('0x2a');}_0x4130a8=_0x120854;_0x3382fb[_0x2ed1('0x2d')](_0x120854);return;}}})['then'](function(){if(_0x5a6a8d){emit(_0x245640[_0x2ed1('0x1f')],_0x2e1228,util[_0x2ed1('0x31')]('user:%s',_0x5a6a8d[_0x2ed1('0x32')]),util[_0x2ed1('0x31')](_0x2ed1('0x33'),_0x5787e3['action'][_0x2ed1('0x34')]()),{'evt':_['merge'](_0x245640,{'autoCreate':_0x2e6ac1}),'contact':_0x4130a8===undefined?{}:_0x4130a8,'contacts':_0x3382fb[_0x2ed1('0x35')]===0x0?undefined:_0x3382fb});}});}; \ No newline at end of file +var _0x33b5=['../../../../config/logger','trigger','../../rpc/cmContact','defaults','redis','localhost','socket.io-emitter','info','stringify','emit','data2','xmd-contactid','data3','split','phone','$or','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','fax','ListId','createdAt','updatedAt','getContacts','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','map','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridname','','Unknown','destcalleridname','createContact','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','push','format','name','action','toLowerCase','merge','ioredis','util'];(function(_0xd73d53,_0x598443){var _0x560148=function(_0x3c8918){while(--_0x3c8918){_0xd73d53['push'](_0xd73d53['shift']());}};_0x560148(++_0x598443);}(_0x33b5,0x163));var _0x533b=function(_0x1ae26d,_0x461edd){_0x1ae26d=_0x1ae26d-0x0;var _0x419037=_0x33b5[_0x1ae26d];return _0x419037;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var Redis=require(_0x533b('0x0'));var util=require(_0x533b('0x1'));var config=require('../../../../config/environment');var logger=require(_0x533b('0x2'))(_0x533b('0x3'));var cmContactRpc=require(_0x533b('0x4'));config['redis']=_[_0x533b('0x5')](config[_0x533b('0x6')],{'host':_0x533b('0x7'),'port':0x18eb});var io=require(_0x533b('0x8'))(new Redis(config[_0x533b('0x6')]));function emit(_0x39e777,_0x575741,_0x102b43,_0xc8c15b,_0x4f593b){logger[_0x533b('0x9')]('[CM][%s][%s]',_0x39e777,_0x575741['id'],_0x102b43,_0xc8c15b,JSON[_0x533b('0xa')](_0x4f593b));io['to'](_0x102b43)[_0x533b('0xb')](_0xc8c15b,_0x4f593b);}exports['exec']=function(_0x39440f,_0x20ed29,_0x967394,_0x282d17){var _0xc92ee5,_0x55bd52;var _0x1c5ec7={};var _0x4e6833=Number(_0x967394['data1']);var _0x4ebccc=_0x967394[_0x533b('0xc')]?Boolean(Number(_0x967394[_0x533b('0xc')])):![];var _0x45ee6b;if(_0x282d17[_0x533b('0xd')]){_0x1c5ec7['id']=_0x282d17['xmd-contactid'];}if(!_0x1c5ec7['id']){_0x1c5ec7['ListId']=_0x4e6833;_0x45ee6b=_0x967394[_0x533b('0xe')]&&_0x967394[_0x533b('0xe')]!=='0'?_0x967394[_0x533b('0xe')][_0x533b('0xf')](','):[_0x533b('0x10')];_0x1c5ec7[_0x533b('0x11')]=_['map'](_0x45ee6b,function(_0x269bd4){var _0x1995dc={};_0x1995dc[_0x269bd4]=_0x282d17[_0x533b('0x12')]?_0x282d17[_0x533b('0x13')]:_0x282d17[_0x533b('0x14')];return _0x1995dc;});}var _0x5be312=['id',_0x533b('0x15'),_0x533b('0x16'),_0x533b('0x10'),_0x533b('0x17'),_0x533b('0x18'),_0x533b('0x19'),_0x533b('0x1a'),'scheduledAt',_0x533b('0x1b')];var _0x512e46=_['union'](_0x5be312,_0x45ee6b);BPromise['resolve']()['then'](cmContactRpc[_0x533b('0x1c')]({'attributes':_0x512e46,'where':_0x1c5ec7}))[_0x533b('0x1d')](function(_0x16da47){_0x55bd52=_0x16da47;if(!_[_0x533b('0x1e')](_0x55bd52)){if(_0x55bd52[_0x533b('0x1f')]===0x1){_0xc92ee5=_0x55bd52[0x0];logger[_0x533b('0x9')](_0x533b('0x20'),_0x282d17['uniqueid'],_0x20ed29['id'],_0xc92ee5['id']);}else{logger['info']('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x282d17[_0x533b('0x21')],_0x20ed29['id'],_[_0x533b('0x22')](_0x55bd52,'id')['join'](','));}return;}else{logger[_0x533b('0x9')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x282d17[_0x533b('0x21')],_0x20ed29['id']);var _0x33f95e={'ListId':_0x4e6833};var _0x1e93cd=_0x967394[_0x533b('0x23')]&&_0x967394[_0x533b('0x23')]!=='0'?_0x967394[_0x533b('0x23')]:_0x533b('0x10');if(_0x4ebccc){logger[_0x533b('0x9')](_0x533b('0x24'),_0x282d17['uniqueid'],_0x20ed29['id']);_0x33f95e[_0x1e93cd]=_[_0x533b('0x25')](_0x282d17[_0x533b('0x12')])?_0x282d17[_0x533b('0x14')]:_0x282d17[_0x533b('0x13')];if(_[_0x533b('0x25')](_0x282d17[_0x533b('0x12')])){_0x33f95e['firstName']=_0x282d17[_0x533b('0x26')]&&_0x282d17[_0x533b('0x26')]!==_0x533b('0x27')?_0x282d17['calleridname']:_0x533b('0x28');}else{_0x33f95e[_0x533b('0x15')]=_0x282d17[_0x533b('0x29')]&&_0x282d17[_0x533b('0x29')]!==_0x533b('0x27')?_0x282d17[_0x533b('0x29')]:_0x533b('0x28');}return BPromise['resolve']()[_0x533b('0x1d')](cmContactRpc[_0x533b('0x2a')](_0x33f95e))['then'](function(_0x32f634){_0xc92ee5=_0x32f634;_0x55bd52['push'](_0x32f634);if(_0xc92ee5){logger[_0x533b('0x9')](_0x533b('0x2b'),_0x282d17[_0x533b('0x21')],_0x20ed29['id'],_0xc92ee5['id']);}return;});}else{logger[_0x533b('0x9')](_0x533b('0x2c'),_0x282d17[_0x533b('0x21')],_0x20ed29['id']);_0x33f95e[_0x1e93cd]=_['isNil'](_0x282d17['routeId'])?_0x282d17['calleridnum']:_0x282d17[_0x533b('0x13')];if(_[_0x533b('0x25')](_0x282d17[_0x533b('0x12')])){_0x33f95e['firstName']=_0x282d17[_0x533b('0x26')]&&_0x282d17[_0x533b('0x26')]!==_0x533b('0x27')?_0x282d17['calleridname']:_0x533b('0x28');}else{_0x33f95e[_0x533b('0x15')]=_0x282d17[_0x533b('0x29')]&&_0x282d17[_0x533b('0x29')]!==''?_0x282d17[_0x533b('0x29')]:_0x533b('0x28');}_0xc92ee5=_0x33f95e;_0x55bd52[_0x533b('0x2d')](_0x33f95e);return;}}})['then'](function(){if(_0x39440f){emit(_0x282d17[_0x533b('0x21')],_0x20ed29,util[_0x533b('0x2e')]('user:%s',_0x39440f[_0x533b('0x2f')]),util[_0x533b('0x2e')]('trigger:%s',_0x967394[_0x533b('0x30')][_0x533b('0x31')]()),{'evt':_[_0x533b('0x32')](_0x282d17,{'autoCreate':_0x4ebccc}),'contact':_0xc92ee5===undefined?{}:_0xc92ee5,'contacts':_0x55bd52[_0x533b('0x1f')]===0x0?undefined:_0x55bd52});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 6340c5a..95c94cb 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 _0x1fc5=['popup','TemplateId','data2','render','html','uri','buildUri','isNil','data3','data4','uriLocation','800','data5','windowHeight','600','winApplication','winArguments','user:%s','name','trigger:%s:%s','format','trigger:%s','exec','integration','queue','routeId','urlforward','script','parse','query','search','replace','AllConditions','every','checkConditions','channel','AnyConditions','some','field','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','message','event','agent','membername','lastevent','exports','util','lodash','url','mustache','./integration','./script','../../../config/environment','trigger','../ami','redis','defaults','localhost','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','bind','custom:agentconnect','custom:agentringnoanswer','syncCustomEvent','custom:agentcomplete','custom:agentnosuchnumber','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:incomingmessage','custom:acceptmessage','custom:rejectmessage','prototype','emit','info','stringify','clone','checkTriggers','interface','hasOwnProperty','status','checkTrigger','merge','variables','Actions','length','action','toLowerCase','contactmanager','motionbar','browser','data1'];(function(_0xf51c06,_0x388e5b){var _0x1d5420=function(_0x5e077b){while(--_0x5e077b){_0xf51c06['push'](_0xf51c06['shift']());}};_0x1d5420(++_0x388e5b);}(_0x1fc5,0x199));var _0x51fc=function(_0x3f317e,_0x772970){_0x3f317e=_0x3f317e-0x0;var _0x1392a2=_0x1fc5[_0x3f317e];return _0x1392a2;};'use strict';var util=require(_0x51fc('0x0'));var _=require(_0x51fc('0x1'));var url=require(_0x51fc('0x2'));var Mustache=require(_0x51fc('0x3'));var Redis=require('ioredis');var urlforward=require('./urlforward');var integration=require(_0x51fc('0x4'));var cmContact=require('./cmContact');var script=require(_0x51fc('0x5'));var config=require(_0x51fc('0x6'));var logger=require('../../../config/logger')(_0x51fc('0x7'));var ami=require(_0x51fc('0x8'));config[_0x51fc('0x9')]=_[_0x51fc('0xa')](config['redis'],{'host':_0x51fc('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x51fc('0x9')]));var operators={'equals':function(_0x1afd3e,_0x516122){return _0x1afd3e==_0x516122;},'not_equals':function(_0x293e65,_0x151f9b){return _0x293e65!=_0x151f9b;}};var barAndWebActions=['popup',_0x51fc('0x2'),_0x51fc('0xc')];function Trigger(_0x5f179d){this[_0x51fc('0xd')]=_0x5f179d['triggers'];this[_0x51fc('0xe')]=_0x5f179d[_0x51fc('0xe')];this['voiceQueues']=_0x5f179d[_0x51fc('0xf')];this[_0x51fc('0x10')]=_0x5f179d[_0x51fc('0x10')];this[_0x51fc('0x11')]=_0x5f179d[_0x51fc('0x11')];this[_0x51fc('0x12')]=_0x5f179d[_0x51fc('0x12')];this[_0x51fc('0x13')]=_0x5f179d[_0x51fc('0x13')];this[_0x51fc('0x14')]=_0x5f179d[_0x51fc('0x14')];this[_0x51fc('0x15')]=_0x5f179d[_0x51fc('0x15')];this[_0x51fc('0x16')]=_0x5f179d[_0x51fc('0x16')];this[_0x51fc('0x17')]=_0x5f179d['deskAccounts'];this[_0x51fc('0x18')]=_0x5f179d[_0x51fc('0x18')];this[_0x51fc('0x19')]=_0x5f179d[_0x51fc('0x19')];this['dynamics365Accounts']=_0x5f179d[_0x51fc('0x1a')];this[_0x51fc('0x1b')]=_0x5f179d[_0x51fc('0x1b')];this[_0x51fc('0x1c')]={'zendesk':this[_0x51fc('0x12')],'salesforce':this[_0x51fc('0x14')],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this[_0x51fc('0x15')],'zoho':this[_0x51fc('0x16')],'desk':this[_0x51fc('0x17')],'vtiger':this[_0x51fc('0x18')],'dynamics365':this[_0x51fc('0x1a')],'freshsales':this['freshsalesAccounts'],'servicenow':this[_0x51fc('0x19')]};ami['on']('custom:agentcalled',this['syncCustomEvent'][_0x51fc('0x1d')](this));ami['on'](_0x51fc('0x1e'),this['syncCustomEvent'][_0x51fc('0x1d')](this));ami['on'](_0x51fc('0x1f'),this[_0x51fc('0x20')][_0x51fc('0x1d')](this));ami['on'](_0x51fc('0x21'),this[_0x51fc('0x20')]['bind'](this));ami['on'](_0x51fc('0x22'),this[_0x51fc('0x20')]['bind'](this));ami['on']('custom:agentnoanswer',this[_0x51fc('0x20')][_0x51fc('0x1d')](this));ami['on'](_0x51fc('0x23'),this[_0x51fc('0x20')][_0x51fc('0x1d')](this));ami['on'](_0x51fc('0x24'),this[_0x51fc('0x20')][_0x51fc('0x1d')](this));ami['on'](_0x51fc('0x25'),this[_0x51fc('0x20')][_0x51fc('0x1d')](this));ami['on']('custom:amd',this[_0x51fc('0x20')][_0x51fc('0x1d')](this));ami['on'](_0x51fc('0x26'),this[_0x51fc('0x20')][_0x51fc('0x1d')](this));ami['on'](_0x51fc('0x27'),this[_0x51fc('0x20')]['bind'](this));ami['on'](_0x51fc('0x28'),this[_0x51fc('0x29')][_0x51fc('0x1d')](this));ami['on'](_0x51fc('0x2a'),this[_0x51fc('0x29')][_0x51fc('0x1d')](this));ami['on'](_0x51fc('0x2b'),this[_0x51fc('0x29')]['bind'](this));ami['on']('custom:newinteraction',this[_0x51fc('0x20')][_0x51fc('0x1d')](this));ami['on']('custom:closedinteraction',this[_0x51fc('0x20')]['bind'](this));ami['on'](_0x51fc('0x2c'),this[_0x51fc('0x20')][_0x51fc('0x1d')](this));ami['on']('custom:outgoingmessage',this[_0x51fc('0x20')]['bind'](this));ami['on'](_0x51fc('0x2d'),this[_0x51fc('0x20')][_0x51fc('0x1d')](this));ami['on'](_0x51fc('0x2e'),this[_0x51fc('0x20')][_0x51fc('0x1d')](this));}Trigger[_0x51fc('0x2f')][_0x51fc('0x30')]=function(_0x45086a,_0x31947f,_0xaa573){logger[_0x51fc('0x31')](_0x45086a,_0x31947f,JSON[_0x51fc('0x32')](_0xaa573));io['to'](_0x45086a)[_0x51fc('0x30')](_0x31947f,_0xaa573);};Trigger[_0x51fc('0x2f')]['syncCustomEvent']=function(_0x3faf93){var _0x49a886=_[_0x51fc('0x33')](_0x3faf93);this[_0x51fc('0x34')](_0x49a886);};Trigger['prototype'][_0x51fc('0x29')]=function(_0x13e5dc){if(this['agents'][_0x13e5dc[_0x51fc('0x35')]]){this['syncCustomEvent'](_0x13e5dc);}};Trigger[_0x51fc('0x2f')][_0x51fc('0x34')]=function(_0x1e95c5){var _0x12e25f;for(var _0x222b97 in this[_0x51fc('0xd')]){if(this['triggers'][_0x51fc('0x36')](_0x222b97)){if(this[_0x51fc('0xd')][_0x222b97][_0x51fc('0x37')]){_0x12e25f=this[_0x51fc('0x38')](this[_0x51fc('0xd')][_0x222b97],_0x1e95c5);if(_0x12e25f){_[_0x51fc('0x39')](_0x1e95c5,_0x1e95c5[_0x51fc('0x3a')]);for(var _0x5084b9=0x0,_0x235bc0,_0x489acb,_0x68f0e4;_0x5084b90x0){_0x55ad0f=_[_0xf326('0x25')](_0x581531,_0x1617d2);}return _0x55ad0f;}function getCustomFields(_0x1ae23a,_0x2fa28e){var _0x5dbe63=[];var _0xc115d9={'custom_fields':{}};if(_0x1ae23a[_0xf326('0x26')]>0x0){_['forEach'](_0x1ae23a,function(_0x225776){if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776[_0xf326('0x2a')])&&_0x225776[_0xf326('0x2b')]&&!_0x225776[_0xf326('0x2c')]){_0xc115d9[_0x225776[_0xf326('0x2b')][_0xf326('0x2d')]()]=_0x225776[_0xf326('0x2e')]['toString']();}else if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776['type'])&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x225776['content'][_0xf326('0x31')]();}else if(_0x225776[_0xf326('0x2a')]===_0xf326('0x32')&&_0x225776[_0xf326('0x33')]&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776[_0xf326('0x33')]]&&(_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x2fa28e[_0x225776[_0xf326('0x33')]][_0xf326('0x31')]());}else if(_0x225776['type']===_0xf326('0x34')&&_0x225776['Variable']&&_0x225776[_0xf326('0x35')]['name']&&_0x225776['idField']&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776['Variable'][_0xf326('0x36')]['toLowerCase']()]&&(_0xc115d9[_0xf326('0x30')][_0x225776[_0xf326('0x2f')]]=_0x2fa28e[_0x225776[_0xf326('0x35')]['name'][_0xf326('0x2d')]()][_0xf326('0x31')]());}});}if(_0xc115d9['priority']){_0xc115d9[_0xf326('0x37')]=Number(_0xc115d9[_0xf326('0x37')]);}return _0xc115d9;}function getTicket(_0x40fa7a,_0xaf65e0,_0x51076c,_0x2c4416,_0xb1ef35){logger[_0xf326('0xb')](_0xf326('0x38'));var _0x1d88ed=_['merge']({'subject':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3a')],_0xb1ef35,'\x20'),'type':'phone','status':'new','labels':[_0xf326('0x3b'),'Motion','CTI'][_0xf326('0x3c')](getTags(_0x2c4416['Tags'],_0xf326('0x36'))),'description':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a'),'_links':{'assigned_user':{'href':util[_0xf326('0x13')]('/api/v2/users/%d',_0xaf65e0['id']),'class':_0xf326('0x3e')}},'message':{'direction':'in','body':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a')}},getCustomFields(_0x2c4416[_0xf326('0x3f')],_0xb1ef35));return request({'uri':util[_0xf326('0x13')](_0xf326('0x40'),_0x40fa7a[_0xf326('0x16')],_0x51076c['id']),'method':_0xf326('0x23'),'body':_0x1d88ed});}exports[_0xf326('0x41')]=function(_0x1227d3,_0x361776,_0x2bab13,_0x50d63f,_0x1b6126,_0x1637dc){var _0x2ed1a7,_0x270288;_0x1637dc[_0xf326('0x16')]=intUtil[_0xf326('0x42')](_0x1637dc['remoteUri']);_0x1637dc[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x1637dc['serverUrl']);if(_0x1b6126&&_0x1b6126[_0xf326('0x44')]){logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x46'));_0x361776[_0xf326('0x47')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1637dc[_0xf326('0x43')],_0x361776[_0xf326('0x48')],md5(_0x361776['uniqueid']));}else{_0x361776['recordingURL']='';}headers[_0xf326('0x49')]=getAuth(_0x1637dc);return getUser(_0x1637dc,_0x50d63f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x5b3705){_0x2ed1a7=_0x5b3705;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2ed1a7['id']);return getEndUser(_0x1637dc,_0x361776[_0xf326('0x4c')],_0x361776[_0xf326('0x4d')]);})[_0xf326('0xe')](function(_0x2d9bba){_0x270288=_0x2d9bba;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x270288['id']);return getTicket(_0x1637dc,_0x2ed1a7,_0x270288,_0x2bab13,_0x361776);})[_0xf326('0xe')](function(_0x27ced1){if(_0x27ced1){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x27ced1['id']);switch(_0x1637dc[_0xf326('0x2a')]){case'integrationTab':logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x51'));emit(util[_0xf326('0x13')]('user:%s',_0x50d63f[_0xf326('0x36')]),_0xf326('0x52'),{'recordId':_0x27ced1['id']});break;case _0xf326('0x53'):logger[_0xf326('0xb')]('[QUEUE]',_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x50d63f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x27ced1['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x45'),_0xf326('0x58'));}}})['catch'](function(_0x102fba){console[_0xf326('0x57')](_0x102fba);logger[_0xf326('0x57')]('[QUEUE]',JSON['stringify'](_0x102fba));});};exports[_0xf326('0x59')]=function(_0x5b4832,_0x1cf58f,_0x554277,_0x458e5f,_0x7ee57,_0x28c959,_0x25e091){var _0x212594,_0x35d3c8;_0x28c959[_0xf326('0x16')]=intUtil['stripTrailingSlash'](_0x28c959[_0xf326('0x16')]);_0x28c959[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28c959['serverUrl']);if(_0x25e091&&_0x25e091[_0xf326('0x5a')]&&_0x25e091[_0xf326('0x5a')]!==_0xf326('0x5b')){logger[_0xf326('0xb')](_0xf326('0x5c'),'Recording\x20is\x20enabled!');_0x1cf58f[_0xf326('0x47')]=util[_0xf326('0x13')](_0xf326('0x5d'),_0x28c959[_0xf326('0x43')],_0x1cf58f['uniqueid'],md5(_0x1cf58f[_0xf326('0x48')]));}headers[_0xf326('0x49')]=getAuth(_0x28c959);return getUser(_0x28c959,_0x458e5f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x4d3b9e){_0x212594=_0x4d3b9e;logger['info'](_0xf326('0x4b'),_0x212594['id']);return getEndUser(_0x28c959,_0x1cf58f[_0xf326('0x5e')],_0x1cf58f['destcalleridnum']);})[_0xf326('0xe')](function(_0x29de71){_0x35d3c8=_0x29de71;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x35d3c8['id']);return getTicket(_0x28c959,_0x212594,_0x35d3c8,_0x554277,_0x1cf58f);})['then'](function(_0xb1c18c){if(_0xb1c18c){logger['info']('Ticket\x20created!');logger[_0xf326('0xb')]('The\x20Ticket\x20ID\x20is:',_0xb1c18c['id']);switch(_0x28c959[_0xf326('0x2a')]){case _0xf326('0x5f'):logger[_0xf326('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),'trigger:desk:display',{'recordId':_0xb1c18c['id']});break;case _0xf326('0x53'):logger['info'](_0xf326('0x45'),_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util[_0xf326('0x13')](_0xf326('0x60'),_0x28c959[_0xf326('0x16')],_0xb1c18c['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x5c'),_0xf326('0x58'));}}})[_0xf326('0x61')](function(_0x4ca1b8){logger[_0xf326('0x57')]('[OUTBOUND]',JSON[_0xf326('0x62')](_0x4ca1b8));});};exports[_0xf326('0x63')]=function(_0x5e858d,_0x2b770c,_0x5283da,_0x3255b2,_0xd55246,_0x28f3cb){var _0x2d45c9,_0x31b6dd;_0x28f3cb['remoteUri']=intUtil['stripTrailingSlash'](_0x28f3cb[_0xf326('0x16')]);_0x28f3cb[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28f3cb[_0xf326('0x43')]);if(_0xd55246&&_0xd55246[_0xf326('0x44')]){logger['info']('['+_0x2b770c[_0xf326('0x64')][_0xf326('0x65')]()+']','Recording\x20is\x20enabled!');_0x2b770c['recordingURL']=util['format'](_0xf326('0x5d'),_0x28f3cb[_0xf326('0x43')],_0x2b770c[_0xf326('0x48')],md5(_0x2b770c[_0xf326('0x48')]));}else{_0x2b770c[_0xf326('0x47')]='';}headers[_0xf326('0x49')]=getAuth(_0x28f3cb);return getUser(_0x28f3cb)[_0xf326('0xe')](function(_0x4b9013){_0x2d45c9=_0x4b9013;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2d45c9['id']);return getEndUser(_0x28f3cb,_0x2b770c[_0xf326('0x4c')],_0x2b770c[_0xf326('0x4d')]);})['then'](function(_0x3717fe){_0x31b6dd=_0x3717fe;logger['info']('The\x20Enduser\x20ID\x20is:',_0x31b6dd['id']);return getTicket(_0x28f3cb,_0x2d45c9,_0x31b6dd,_0x5283da,_0x2b770c);})[_0xf326('0xe')](function(_0x540fa0){if(_0x540fa0){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x540fa0['id']);}})[_0xf326('0x61')](function(_0x541491){logger['error']('['+_0x2b770c['lastevent'][_0xf326('0x65')]()+']',JSON[_0xf326('0x62')](_0x541491));});}; \ No newline at end of file +var _0x5fc3=['map','forEach','includes','string','picklist','nameField','customField','toLowerCase','content','type','custom_fields','variable','variableName','idField','Variable','name','priority','Creating\x20new\x20ticket...','merge','getString','phone','new','xCALLY','Motion','CTI','concat','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','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','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','recordingURL','The\x20User\x20ID\x20is:','destcalleridnum','Ticket\x20created!','[OUTBOUND]','unmanaged','lastevent','Recording\x20is\x20enabled!','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','emit','application/json','info','Getting\x20agent\x20with\x20email','%s/users','remoteUri','total_entries','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','format','%s/users/me','debug','stringify','authType','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','then','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','length'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5774be,_0x2259d3){_0x5774be=_0x5774be-0x0;var _0x4914b4=_0x5fc3[_0x5774be];return _0x4914b4;};'use strict';var _=require(_0x35fc('0x0'));var rp=require(_0x35fc('0x1'));var md5=require('md5');var util=require(_0x35fc('0x2'));var Redis=require(_0x35fc('0x3'));var intUtil=require(_0x35fc('0x4'));var config=require(_0x35fc('0x5'));var logger=require(_0x35fc('0x6'))('desk');config[_0x35fc('0x7')]=_[_0x35fc('0x8')](config[_0x35fc('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x35fc('0x7')]));function emit(_0x508b32,_0x16e153,_0x27524f){io['to'](_0x508b32)[_0x35fc('0x9')](_0x16e153,_0x27524f);}var headers={'Content-Type':_0x35fc('0xa'),'Accept':_0x35fc('0xa')};function getUser(_0xf9d3a6,_0x2051ab){if(intUtil['validateEmail'](_0x2051ab)===!![]){logger[_0x35fc('0xb')](_0x35fc('0xc'),_0x2051ab);return request({'uri':util['format'](_0x35fc('0xd'),_0xf9d3a6[_0x35fc('0xe')])})['then'](function(_0xda83fb){if(_0xda83fb[_0x35fc('0xf')]){return _['find'](_0xda83fb['_embedded'][_0x35fc('0x10')],{'email':_0x2051ab});}})['then'](function(_0x397738){if(_0x397738){logger[_0x35fc('0xb')](_0x35fc('0x11'));return _0x397738;}else{logger[_0x35fc('0xb')](_0x35fc('0x12'));return request({'uri':util['format']('%s/users/me',_0xf9d3a6['remoteUri'])});}});}else{logger['info'](_0x35fc('0x13'));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x15'),_0xf9d3a6[_0x35fc('0xe')])});}}function request(_0x227a49){logger[_0x35fc('0x16')]('[HTTP]',JSON[_0x35fc('0x17')](_0x227a49));return rp(_[_0x35fc('0x8')](_0x227a49,{'method':'GET','headers':headers,'json':!![]}));}function getAuth(_0x41e165){var _0x363e47;if(_0x41e165[_0x35fc('0x18')]==='basic'){_0x363e47=util[_0x35fc('0x14')](_0x35fc('0x19'),_0x41e165[_0x35fc('0x1a')],_0x41e165['password']);}else if(_0x41e165[_0x35fc('0x18')]===_0x35fc('0x1b')){_0x363e47=util[_0x35fc('0x14')](_0x35fc('0x1c'),_0x41e165[_0x35fc('0x1a')],_0x41e165[_0x35fc('0x1b')]);}return util[_0x35fc('0x14')](_0x35fc('0x1d'),new Buffer(_0x363e47)[_0x35fc('0x1e')](_0x35fc('0x1f')));}function getEndUser(_0x5bd2b8,_0x323aee,_0xd5399f){logger[_0x35fc('0xb')](_0x35fc('0x20'),_0xd5399f);return request({'uri':util[_0x35fc('0x14')]('%s/customers/search',_0x5bd2b8[_0x35fc('0xe')]),'qs':{'phone':_0xd5399f}})[_0x35fc('0x21')](function(_0x561bf8){if(_0x561bf8[_0x35fc('0xf')]){logger[_0x35fc('0xb')](_0x35fc('0x22'));return _0x561bf8['_embedded'][_0x35fc('0x10')][0x0];}else{logger['info'](_0x35fc('0x23'));return request({'uri':util[_0x35fc('0x14')]('%s/customers',_0x5bd2b8['remoteUri']),'method':_0x35fc('0x24'),'body':{'first_name':_0x323aee,'title':_0x323aee,'phone_numbers':[{'type':'work','value':_0xd5399f}]}});}});}function getTags(_0x274208,_0x1a5d92){var _0x57001c=[];if(_0x274208&&_0x274208[_0x35fc('0x25')]>0x0){_0x57001c=_[_0x35fc('0x26')](_0x274208,_0x1a5d92);}return _0x57001c;}function getCustomFields(_0x383837,_0x9f3c8a){var _0x3735da=[];var _0x134dfa={'custom_fields':{}};if(_0x383837[_0x35fc('0x25')]>0x0){_[_0x35fc('0x27')](_0x383837,function(_0x54aedc){if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc['type'])&&_0x54aedc[_0x35fc('0x2b')]&&!_0x54aedc[_0x35fc('0x2c')]){_0x134dfa[_0x54aedc[_0x35fc('0x2b')][_0x35fc('0x2d')]()]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc[_0x35fc('0x2f')])&&_0x54aedc['idField']&&_0x54aedc['customField']){_0x134dfa[_0x35fc('0x30')][_0x54aedc['idField']]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_0x54aedc[_0x35fc('0x2f')]===_0x35fc('0x31')&&_0x54aedc[_0x35fc('0x32')]&&_0x54aedc[_0x35fc('0x33')]&&_0x54aedc['customField']){_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]][_0x35fc('0x1e')]());}else if(_0x54aedc[_0x35fc('0x2f')]==='customVariable'&&_0x54aedc[_0x35fc('0x34')]&&_0x54aedc[_0x35fc('0x34')][_0x35fc('0x35')]&&_0x54aedc['idField']&&_0x54aedc[_0x35fc('0x2c')]){_0x9f3c8a[_0x54aedc['Variable'][_0x35fc('0x35')][_0x35fc('0x2d')]()]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc['Variable']['name']['toLowerCase']()][_0x35fc('0x1e')]());}});}if(_0x134dfa['priority']){_0x134dfa[_0x35fc('0x36')]=Number(_0x134dfa['priority']);}return _0x134dfa;}function getTicket(_0x9c6b65,_0x1f2d66,_0x2ca9ac,_0x22b724,_0x1c10e0){logger[_0x35fc('0xb')](_0x35fc('0x37'));var _0x4ec0dc=_[_0x35fc('0x38')]({'subject':intUtil[_0x35fc('0x39')](_0x22b724['Subjects'],_0x1c10e0,'\x20'),'type':_0x35fc('0x3a'),'status':_0x35fc('0x3b'),'labels':[_0x35fc('0x3c'),_0x35fc('0x3d'),_0x35fc('0x3e')][_0x35fc('0x3f')](getTags(_0x22b724['Tags'],_0x35fc('0x35'))),'description':intUtil[_0x35fc('0x39')](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0x35fc('0x41'),_0x1f2d66['id']),'class':_0x35fc('0x42')}},'message':{'direction':'in','body':intUtil['getString'](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a')}},getCustomFields(_0x22b724[_0x35fc('0x43')],_0x1c10e0));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x44'),_0x9c6b65[_0x35fc('0xe')],_0x2ca9ac['id']),'method':_0x35fc('0x24'),'body':_0x4ec0dc});}exports[_0x35fc('0x45')]=function(_0x3ec51f,_0x5a7e9e,_0x596e83,_0x210d5d,_0x36fcf9,_0x4fdc6d){var _0x5c2e5c,_0x4ff202;_0x4fdc6d[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x4fdc6d['remoteUri']);_0x4fdc6d[_0x35fc('0x47')]=intUtil[_0x35fc('0x46')](_0x4fdc6d[_0x35fc('0x47')]);if(_0x36fcf9&&_0x36fcf9[_0x35fc('0x48')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x5a7e9e['recordingURL']=util['format'](_0x35fc('0x49'),_0x4fdc6d[_0x35fc('0x47')],_0x5a7e9e['uniqueid'],md5(_0x5a7e9e[_0x35fc('0x4a')]));}else{_0x5a7e9e['recordingURL']='';}headers[_0x35fc('0x4b')]=getAuth(_0x4fdc6d);return getUser(_0x4fdc6d,_0x210d5d[_0x35fc('0x4c')])[_0x35fc('0x21')](function(_0x2de5d1){_0x5c2e5c=_0x2de5d1;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x5c2e5c['id']);return getEndUser(_0x4fdc6d,_0x5a7e9e[_0x35fc('0x4d')],_0x5a7e9e[_0x35fc('0x4e')]);})['then'](function(_0x18181b){_0x4ff202=_0x18181b;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x4ff202['id']);return getTicket(_0x4fdc6d,_0x5c2e5c,_0x4ff202,_0x596e83,_0x5a7e9e);})[_0x35fc('0x21')](function(_0x5bc8c3){if(_0x5bc8c3){logger[_0x35fc('0xb')]('Ticket\x20created!');logger['info'](_0x35fc('0x50'),_0x5bc8c3['id']);switch(_0x4fdc6d[_0x35fc('0x2f')]){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x53'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d['name']),_0x35fc('0x55'),{'recordId':_0x5bc8c3['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d[_0x35fc('0x35')]),_0x35fc('0x58'),{'uri':util[_0x35fc('0x14')](_0x35fc('0x59'),_0x5bc8c3['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x52'),_0x35fc('0x5b'));}}})['catch'](function(_0x553ed6){console[_0x35fc('0x5a')](_0x553ed6);logger[_0x35fc('0x5a')](_0x35fc('0x52'),JSON[_0x35fc('0x17')](_0x553ed6));});};exports[_0x35fc('0x5c')]=function(_0x3e6494,_0x4a4798,_0x4f024c,_0x388521,_0x19b2ce,_0x395d63,_0x38bc78){var _0x5b2595,_0x467980;_0x395d63[_0x35fc('0xe')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0xe')]);_0x395d63[_0x35fc('0x47')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0x47')]);if(_0x38bc78&&_0x38bc78[_0x35fc('0x5d')]&&_0x38bc78[_0x35fc('0x5d')]!==_0x35fc('0x5e')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4a4798[_0x35fc('0x5f')]=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x395d63[_0x35fc('0x47')],_0x4a4798[_0x35fc('0x4a')],md5(_0x4a4798[_0x35fc('0x4a')]));}headers[_0x35fc('0x4b')]=getAuth(_0x395d63);return getUser(_0x395d63,_0x388521[_0x35fc('0x4c')])['then'](function(_0x2d9d45){_0x5b2595=_0x2d9d45;logger[_0x35fc('0xb')](_0x35fc('0x60'),_0x5b2595['id']);return getEndUser(_0x395d63,_0x4a4798['destcalleridname'],_0x4a4798[_0x35fc('0x61')]);})[_0x35fc('0x21')](function(_0x47fb1a){_0x467980=_0x47fb1a;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x467980['id']);return getTicket(_0x395d63,_0x5b2595,_0x467980,_0x4f024c,_0x4a4798);})[_0x35fc('0x21')](function(_0x1c4c33){if(_0x1c4c33){logger[_0x35fc('0xb')](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x1c4c33['id']);switch(_0x395d63['type']){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:desk:display',{'recordId':_0x1c4c33['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:browser:url',{'uri':util['format']('%s/agent/tickets/%s',_0x395d63[_0x35fc('0xe')],_0x1c4c33['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x63'),_0x35fc('0x5b'));}}})['catch'](function(_0x458eb8){logger[_0x35fc('0x5a')](_0x35fc('0x63'),JSON[_0x35fc('0x17')](_0x458eb8));});};exports[_0x35fc('0x64')]=function(_0x1d0e53,_0x27071b,_0x2127e0,_0x462ceb,_0x4c3ace,_0x35d7c8){var _0x47c75f,_0xfbd737;_0x35d7c8[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x35d7c8[_0x35fc('0xe')]);_0x35d7c8['serverUrl']=intUtil[_0x35fc('0x46')](_0x35d7c8['serverUrl']);if(_0x4c3ace&&_0x4c3ace['monitor_format']){logger['info']('['+_0x27071b[_0x35fc('0x65')]['toUpperCase']()+']',_0x35fc('0x66'));_0x27071b['recordingURL']=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x35d7c8[_0x35fc('0x47')],_0x27071b[_0x35fc('0x4a')],md5(_0x27071b[_0x35fc('0x4a')]));}else{_0x27071b[_0x35fc('0x5f')]='';}headers['Authorization']=getAuth(_0x35d7c8);return getUser(_0x35d7c8)[_0x35fc('0x21')](function(_0x1e2214){_0x47c75f=_0x1e2214;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x47c75f['id']);return getEndUser(_0x35d7c8,_0x27071b[_0x35fc('0x4d')],_0x27071b[_0x35fc('0x4e')]);})[_0x35fc('0x21')](function(_0x3c1b56){_0xfbd737=_0x3c1b56;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0xfbd737['id']);return getTicket(_0x35d7c8,_0x47c75f,_0xfbd737,_0x2127e0,_0x27071b);})[_0x35fc('0x21')](function(_0x4464d5){if(_0x4464d5){logger['info'](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x4464d5['id']);}})['catch'](function(_0x1c88d8){logger[_0x35fc('0x5a')]('['+_0x27071b['lastevent']['toUpperCase']()+']',JSON[_0x35fc('0x17')](_0x1c88d8));});}; \ 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 b20f9f6..8842416 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 _0x7f4e=['unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId',']\x20Call\x20direction:\x20%s','inspect','lodash','request-promise','util','md5','../../../../config/logger','../../../../config/environment','redis','defaults','socket.io-emitter','POST','clientId','password','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','Bearer\x20','value','isNil','validateEmail','email','userEmail','isdisabled',']\x20Agent\x20found\x20','systemuserid','userId','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','length','internalemailaddress','toLowerCase','outbound','destcalleridnum','contacts','/systemusers(','4.0','headers','odata-entityid','lastIndexOf','enduserId','calleridnum','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','%2b','telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','includes','string','picklist','type','nameField','idField','substring','indexOf','content','ticketType','assign','Subjects','getString','Descriptions','/contacts(','Fields','phonecall','phonecalls','callDirection','queue','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','emit','remoteUri','serverUrl','stripTrailingSlash'];(function(_0x14e1cb,_0xd3465e){var _0x18a337=function(_0x3b97f3){while(--_0x3b97f3){_0x14e1cb['push'](_0x14e1cb['shift']());}};_0x18a337(++_0xd3465e);}(_0x7f4e,0x1a0));var _0xe7f4=function(_0x38b0ad,_0x3ec52f){_0x38b0ad=_0x38b0ad-0x0;var _0x4d2405=_0x7f4e[_0x38b0ad];return _0x4d2405;};'use strict';var _=require(_0xe7f4('0x0'));var BPromise=require('bluebird');var rp=require(_0xe7f4('0x1'));var util=require(_0xe7f4('0x2'));var intUtil=require('./util');var md5=require(_0xe7f4('0x3'));var Redis=require('ioredis');var logger=require(_0xe7f4('0x4'))('dynamics365');var config=require(_0xe7f4('0x5'));config[_0xe7f4('0x6')]=_[_0xe7f4('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xe7f4('0x8'))(new Redis(config[_0xe7f4('0x6')]));function getAuthToken(_0x37e877,_0x1641da,_0x627fef){var _0x549488={'method':_0xe7f4('0x9'),'uri':_0x1641da,'form':{'client_id':_0x37e877[_0xe7f4('0xa')],'resource':_0x37e877['remoteUri'],'username':_0x37e877['username'],'password':_0x37e877['password'],'grant_type':_0xe7f4('0xb'),'client_secret':_0x37e877['clientSecret']},'json':!![]};return rp(_0x549488)[_0xe7f4('0xc')](function(_0x11dd68){return _0x11dd68[_0xe7f4('0xd')];})[_0xe7f4('0xe')](function(_0x3453b2){logger[_0xe7f4('0xf')]('['+[_0x627fef[_0xe7f4('0x10')]()]+_0xe7f4('0x11'));return _0x3453b2[_0xe7f4('0x12')];});}function getUser(_0x564169,_0x2aaf80,_0x48df3d,_0x7e7228,_0xf0aaab,_0x1b8009){return new BPromise(function(_0x1b5479,_0x3905f9){return getAuthToken(_0x2aaf80,_0x7e7228,_0x1b8009)[_0xe7f4('0xc')](function(_0x3fc64c){var _0xf83ec3={'method':_0xe7f4('0x13'),'uri':_0xf0aaab+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0xe7f4('0x14')+_0x3fc64c,'OData-Version':'4.0'},'json':!![]};return rp(_0xf83ec3);})['then'](function(_0x45cb95){var _0x3fcc06=_0x45cb95[_0xe7f4('0x15')];var _0x35e793=![];var _0x1cb448=null;if(!_[_0xe7f4('0x16')](_0x48df3d)){if(intUtil[_0xe7f4('0x17')](_0x48df3d[_0xe7f4('0x18')])){_0x564169[_0xe7f4('0x19')]=_0x48df3d[_0xe7f4('0x18')];for(_0x1cb448=0x0;_0x1cb448<_0x3fcc06['length'];_0x1cb448++){if(_0x3fcc06[_0x1cb448]['internalemailaddress']===_0x48df3d[_0xe7f4('0x18')]&&!_0x3fcc06[_0x1cb448][_0xe7f4('0x1a')]){_0x35e793=!![];logger['info']('['+[_0x1b8009[_0xe7f4('0x10')]()]+_0xe7f4('0x1b')+_0x3fcc06[_0x1cb448][_0xe7f4('0x1c')]+'!');_0x564169[_0xe7f4('0x1d')]=_0x3fcc06[_0x1cb448][_0xe7f4('0x1c')];}}}}if(!_0x35e793){logger[_0xe7f4('0x1e')]('['+[_0x1b8009['toUpperCase']()]+_0xe7f4('0x1f'));_0x564169['userEmail']=_0x2aaf80[_0xe7f4('0x20')];for(_0x1cb448=0x0;_0x1cb448<_0x3fcc06[_0xe7f4('0x21')];_0x1cb448++){if(_0x3fcc06[_0x1cb448][_0xe7f4('0x22')]===_0x2aaf80['username']){_0x564169[_0xe7f4('0x1d')]=_0x3fcc06[_0x1cb448][_0xe7f4('0x1c')];}}}_0x1b5479(_0x564169);})['catch'](function(_0x2ba4d1){_0x3905f9(_0x2ba4d1[_0xe7f4('0x12')]);});});}function createEndUser(_0x5b3598,_0x588898,_0x2a7378,_0x116bcb,_0x31d386,_0x2b1ea1){return new BPromise(function(_0x1eee0f,_0x2b042f){return getAuthToken(_0x588898,_0x2a7378,_0x2b1ea1)['then'](function(_0x1c724e){var _0x103351=_0x2b1ea1[_0xe7f4('0x23')]()===_0xe7f4('0x24')?_0x31d386[_0xe7f4('0x25')]:_0x31d386['calleridnum'];var _0x158a72={'method':'POST','uri':_0x116bcb+_0xe7f4('0x26'),'body':{'telephone1':_0x103351,'fullname':_0x103351,'firstname':_0x103351,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xe7f4('0x27')+_0x5b3598[_0xe7f4('0x1d')]+')'},'headers':{'Authorization':_0xe7f4('0x14')+_0x1c724e,'OData-Version':_0xe7f4('0x28')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x158a72);})[_0xe7f4('0xc')](function(_0x57c376){var _0x5ea7ef=_0x57c376[_0xe7f4('0x29')][_0xe7f4('0x2a')];var _0x1b1f4f=_0x5ea7ef['substring'](_0x5ea7ef[_0xe7f4('0x2b')]('(')+0x1,_0x5ea7ef[_0xe7f4('0x2b')](')'));_0x5b3598[_0xe7f4('0x2c')]=_0x1b1f4f;_0x1eee0f(_0x5b3598);})[_0xe7f4('0xe')](function(_0x2d0942){_0x2b042f(_0x2d0942['message']);});});}function getEndUser(_0x31b026,_0x4f145d,_0x52fcd4,_0x26307f,_0x4252c1,_0x400dd9){return new BPromise(function(_0x112e50,_0x2fc0d3){var _0x41befc=_0x400dd9['toLowerCase']()==='outbound'?_0x4252c1[_0xe7f4('0x25')]:_0x4252c1[_0xe7f4('0x2d')];return getAuthToken(_0x4f145d,_0x52fcd4,_0x400dd9)[_0xe7f4('0xc')](function(_0x1b8020){var _0x555761={'method':_0xe7f4('0x13'),'uri':_0x26307f+_0xe7f4('0x2e')+_0x41befc['replace']('+',_0xe7f4('0x2f'))+'\x27','headers':{'Authorization':_0xe7f4('0x14')+_0x1b8020,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x555761);})['then'](function(_0x31f827){var _0x216af8=null;if(_0x31f827){var _0x189381=_0x31f827['value'];var _0x572ba2=![];for(_0x216af8=0x0;_0x216af8<_0x189381[_0xe7f4('0x21')];_0x216af8++){if(_0x189381[_0x216af8][_0xe7f4('0x30')]===_0x41befc){_0x572ba2=!![];_0x31b026[_0xe7f4('0x2c')]=_0x189381[_0x216af8][_0xe7f4('0x31')];}}if(_0x572ba2){_0x112e50(_0x31b026);}else{return createEndUser(_0x31b026,_0x4f145d,_0x52fcd4,_0x26307f,_0x4252c1,_0x400dd9)[_0xe7f4('0xc')](function(_0x4502af){logger[_0xe7f4('0x1e')]('['+[_0x400dd9[_0xe7f4('0x10')]()]+_0xe7f4('0x32'),_0x4502af[_0xe7f4('0x2c')]);_0x112e50(_0x4502af);});}}else{return createEndUser(_0x31b026,_0x4f145d,_0x52fcd4,_0x26307f,_0x4252c1,_0x400dd9)['then'](function(_0x17ec64){logger['info']('['+[_0x400dd9['toUpperCase']()]+_0xe7f4('0x33'),_0x17ec64[_0xe7f4('0x2c')]);_0x112e50(_0x17ec64);});}});});}function getCustomFields(_0x524103,_0x1efda8,_0x50ddfc){var _0x4d8c5d={};if(_0x524103[_0xe7f4('0x21')]>0x0){_[_0xe7f4('0x34')](_0x524103,function(_0x590da5){if(_[_0xe7f4('0x35')]([_0xe7f4('0x36'),_0xe7f4('0x37')],_0x590da5[_0xe7f4('0x38')])&&_0x590da5[_0xe7f4('0x39')]&&!_0x590da5['customField']){var _0x2d4212=_0x590da5[_0xe7f4('0x3a')]['toLowerCase']();var _0x2ec93c=_0x2d4212[_0xe7f4('0x3b')](0x0,_0x2d4212[_0xe7f4('0x3c')]('_'));var _0x587266=_0x2d4212[_0xe7f4('0x3b')](_0x2d4212[_0xe7f4('0x3c')]('_')+0x1);if(_0x2ec93c===_0x50ddfc){_0x4d8c5d[_0x587266]=_0x590da5[_0xe7f4('0x3d')];}}});}return _0x4d8c5d;}function getTicket(_0x42ec5c,_0x34bd40,_0x36fe41,_0x2ae2d1,_0x48e4f4,_0x34879b,_0x417f63){return new BPromise(function(_0x39b09d,_0x49758d){var _0x336866;return getAuthToken(_0x34bd40,_0x36fe41,_0x417f63)[_0xe7f4('0xc')](function(_0x5cc5b4){if(_0x34879b[_0xe7f4('0x3e')]==='incident'){_0x336866={'method':'POST','uri':_0x2ae2d1+'incidents','body':Object[_0xe7f4('0x3f')]({},{'title':intUtil['getString'](_0x34879b[_0xe7f4('0x40')],_0x48e4f4,'\x20'),'description':intUtil[_0xe7f4('0x41')](_0x34879b[_0xe7f4('0x42')],_0x48e4f4,'\x0a'),'customerid_contact@odata.bind':_0xe7f4('0x43')+_0x42ec5c[_0xe7f4('0x2c')]+')','ownerid@odata.bind':_0xe7f4('0x27')+_0x42ec5c[_0xe7f4('0x1d')]+')','caseorigincode':'1'},getCustomFields(_0x34879b[_0xe7f4('0x44')],_0x48e4f4,_0x34879b['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x5cc5b4,'OData-Version':_0xe7f4('0x28')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x34879b[_0xe7f4('0x3e')]===_0xe7f4('0x45')){_0x336866={'method':'POST','uri':_0x2ae2d1+_0xe7f4('0x46'),'body':Object[_0xe7f4('0x3f')]({},{'subject':intUtil[_0xe7f4('0x41')](_0x34879b[_0xe7f4('0x40')],_0x48e4f4,'\x20'),'phonenumber':String(_0x48e4f4['calleridnum']),'description':intUtil[_0xe7f4('0x41')](_0x34879b[_0xe7f4('0x42')],_0x48e4f4,'\x0a'),'regardingobjectid_contact@odata.bind':'/contacts('+_0x42ec5c[_0xe7f4('0x2c')]+')','ownerid@odata.bind':_0xe7f4('0x27')+_0x42ec5c[_0xe7f4('0x1d')]+')','directioncode':_0x42ec5c['callDirection']==='queue'?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0xe7f4('0x27')+_0x42ec5c[_0xe7f4('0x1d')]+')','participationtypemask':_0x42ec5c[_0xe7f4('0x47')]===_0xe7f4('0x48')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x42ec5c[_0xe7f4('0x2c')]+')','participationtypemask':_0x42ec5c['callDirection']===_0xe7f4('0x48')?0x1:0x2}]},getCustomFields(_0x34879b[_0xe7f4('0x44')],_0x48e4f4,_0x34879b[_0xe7f4('0x3e')])),'headers':{'Authorization':_0xe7f4('0x14')+_0x5cc5b4,'OData-Version':_0xe7f4('0x28')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x336866);})[_0xe7f4('0xc')](function(_0xe7dd97){var _0x91d8c2=_0xe7dd97[_0xe7f4('0x29')][_0xe7f4('0x2a')];var _0xb56d9b=_0x91d8c2[_0xe7f4('0x3b')](_0x91d8c2[_0xe7f4('0x2b')]('(')+0x1,_0x91d8c2['lastIndexOf'](')'));_0x42ec5c['ticketId']=_0xb56d9b;_0x39b09d(_0x42ec5c);})[_0xe7f4('0xe')](function(_0x581962){_0x49758d(_0x581962[_0xe7f4('0x12')]);});});}function emit(_0x3303b9,_0x347f5f,_0xb0522d,_0x4bd187){var _0x216f6b={'uri':util['format'](_0xe7f4('0x49'),_0x3303b9,_0xb0522d,_0x4bd187)};io['to'](util[_0xe7f4('0x4a')]('user:%s',_0x347f5f))[_0xe7f4('0x4b')]('trigger:browser:url',_0x216f6b);}exports['cs']=function(_0x2aecb3,_0x11b668,_0x380f64,_0x871eec,_0x1b83e9,_0x26dc23,_0x42fe2b,_0x44e93a){var _0x401d05={};_0x26dc23[_0xe7f4('0x4c')]=intUtil['stripTrailingSlash'](_0x26dc23[_0xe7f4('0x4c')]);_0x26dc23[_0xe7f4('0x4d')]=intUtil[_0xe7f4('0x4e')](_0x26dc23[_0xe7f4('0x4d')]);_0x401d05['callDirection']=_0x44e93a===_0xe7f4('0x48')||_0x44e93a===_0xe7f4('0x4f')?_0xe7f4('0x48'):_0xe7f4('0x24');var _0x35c0cd=util['format'](_0xe7f4('0x50'),_0x26dc23[_0xe7f4('0x4c')]);var _0x397760=util[_0xe7f4('0x4a')](_0xe7f4('0x51'),_0x26dc23[_0xe7f4('0x52')]);var _0x122a0f=util[_0xe7f4('0x4a')](_0xe7f4('0x53'),_0x26dc23[_0xe7f4('0x4d')],_0x11b668[_0xe7f4('0x54')],md5(_0x11b668[_0xe7f4('0x54')]));if(_0x1b83e9&&_0x1b83e9[_0xe7f4('0x55')]){logger[_0xe7f4('0x1e')](_0xe7f4('0x56'),_0xe7f4('0x57'));_0x11b668[_0xe7f4('0x58')]=_0x122a0f;}else if(_0x42fe2b&&_0x42fe2b[_0xe7f4('0x59')]&&_0x42fe2b[_0xe7f4('0x59')]!==_0xe7f4('0x5a')){logger['info']('[OUTBOUND]',_0xe7f4('0x57'));_0x11b668[_0xe7f4('0x58')]=_0x122a0f;}else{_0x11b668['recordingURL']='';}return getUser(_0x401d05,_0x26dc23,_0x871eec,_0x397760,_0x35c0cd,_0x44e93a)[_0xe7f4('0xc')](function(_0x2ac449){logger[_0xe7f4('0x1e')]('['+_0x44e93a[_0xe7f4('0x10')]()+_0xe7f4('0x5b'),_0x2ac449['userId']);logger[_0xe7f4('0x1e')]('['+_0x44e93a[_0xe7f4('0x10')]()+_0xe7f4('0x5c'),_0x2ac449[_0xe7f4('0x19')]);return getEndUser(_0x2ac449,_0x26dc23,_0x397760,_0x35c0cd,_0x11b668,_0x44e93a);})[_0xe7f4('0xc')](function(_0x48f57b){logger[_0xe7f4('0x1e')]('['+_0x44e93a[_0xe7f4('0x10')]()+_0xe7f4('0x5d'),_0x48f57b['enduserId']);logger[_0xe7f4('0x1e')]('['+_0x44e93a[_0xe7f4('0x10')]()+_0xe7f4('0x5e'),_0x11b668[_0xe7f4('0x2d')]);return getTicket(_0x48f57b,_0x26dc23,_0x397760,_0x35c0cd,_0x11b668,_0x380f64,_0x44e93a);})[_0xe7f4('0xc')](function(_0x2ec02f){logger[_0xe7f4('0x1e')](util[_0xe7f4('0x4a')]('['+_0x44e93a['toUpperCase']()+_0xe7f4('0x5f'),_0x380f64[_0xe7f4('0x3e')],_0x2ec02f[_0xe7f4('0x60')]));logger['info'](util[_0xe7f4('0x4a')]('['+_0x44e93a[_0xe7f4('0x10')]()+_0xe7f4('0x61'),_0x44e93a));if(_0x44e93a!==_0xe7f4('0x4f')){logger[_0xe7f4('0x1e')]('['+_0x44e93a[_0xe7f4('0x10')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x26dc23[_0xe7f4('0x4c')],_0x871eec['name'],_0x380f64[_0xe7f4('0x3e')],_0x2ec02f['ticketId']);}})[_0xe7f4('0xe')](function(_0x1f048a){logger['error']('['+_0x44e93a['toUpperCase']()+']\x20Error\x20running\x20Dynamics365\x20integration',util[_0xe7f4('0x62')](_0x1f048a,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x1371=['%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:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','unmanaged','name','error',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','request-promise','md5','ioredis','dynamics365','../../../../config/environment','defaults','redis','localhost','clientId','remoteUri','clientSecret','then','access_token','catch','toUpperCase','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','length','toLowerCase','outbound','destcalleridnum','contacts','/systemusers(','headers','odata-entityid','lastIndexOf','enduserId','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','picklist','type','nameField','idField','substring','indexOf','content','ticketType','incident','POST','incidents','getString','Subjects','Descriptions','/contacts(','phonecalls','calleridnum','callDirection','queue','Fields','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','trigger:browser:url','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','tenantId'];(function(_0x40b1c7,_0x576357){var _0x128542=function(_0x204e20){while(--_0x204e20){_0x40b1c7['push'](_0x40b1c7['shift']());}};_0x128542(++_0x576357);}(_0x1371,0x1ac));var _0x1137=function(_0x58fe4e,_0x589216){_0x58fe4e=_0x58fe4e-0x0;var _0x32e22e=_0x1371[_0x58fe4e];return _0x32e22e;};'use strict';var _=require(_0x1137('0x0'));var BPromise=require(_0x1137('0x1'));var rp=require(_0x1137('0x2'));var util=require('util');var intUtil=require('./util');var md5=require(_0x1137('0x3'));var Redis=require(_0x1137('0x4'));var logger=require('../../../../config/logger')(_0x1137('0x5'));var config=require(_0x1137('0x6'));config['redis']=_[_0x1137('0x7')](config[_0x1137('0x8')],{'host':_0x1137('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1137('0x8')]));function getAuthToken(_0x40a486,_0x388f5c,_0x2bdefa){var _0xf12f0a={'method':'POST','uri':_0x388f5c,'form':{'client_id':_0x40a486[_0x1137('0xa')],'resource':_0x40a486[_0x1137('0xb')],'username':_0x40a486['username'],'password':_0x40a486['password'],'grant_type':'password','client_secret':_0x40a486[_0x1137('0xc')]},'json':!![]};return rp(_0xf12f0a)[_0x1137('0xd')](function(_0xe38f9b){return _0xe38f9b[_0x1137('0xe')];})[_0x1137('0xf')](function(_0x5bba6e){logger['error']('['+[_0x2bdefa[_0x1137('0x10')]()]+']\x20Wrong\x20credentials!');return _0x5bba6e[_0x1137('0x11')];});}function getUser(_0x22c2b9,_0x2e3571,_0x30a915,_0x53857e,_0x39fd6b,_0x104b48){return new BPromise(function(_0x3f97c3,_0x1ccfb){return getAuthToken(_0x2e3571,_0x53857e,_0x104b48)['then'](function(_0x262f9c){var _0x3f2d0c={'method':_0x1137('0x12'),'uri':_0x39fd6b+_0x1137('0x13'),'headers':{'Authorization':_0x1137('0x14')+_0x262f9c,'OData-Version':_0x1137('0x15')},'json':!![]};return rp(_0x3f2d0c);})[_0x1137('0xd')](function(_0xa3d548){var _0x36d026=_0xa3d548[_0x1137('0x16')];var _0x547146=![];var _0x37a120=null;if(!_[_0x1137('0x17')](_0x30a915)){if(intUtil[_0x1137('0x18')](_0x30a915[_0x1137('0x19')])){_0x22c2b9[_0x1137('0x1a')]=_0x30a915[_0x1137('0x19')];for(_0x37a120=0x0;_0x37a120<_0x36d026['length'];_0x37a120++){if(_0x36d026[_0x37a120][_0x1137('0x1b')]===_0x30a915[_0x1137('0x19')]&&!_0x36d026[_0x37a120][_0x1137('0x1c')]){_0x547146=!![];logger[_0x1137('0x1d')]('['+[_0x104b48['toUpperCase']()]+_0x1137('0x1e')+_0x36d026[_0x37a120][_0x1137('0x1f')]+'!');_0x22c2b9[_0x1137('0x20')]=_0x36d026[_0x37a120][_0x1137('0x1f')];}}}}if(!_0x547146){logger['info']('['+[_0x104b48['toUpperCase']()]+_0x1137('0x21'));_0x22c2b9[_0x1137('0x1a')]=_0x2e3571[_0x1137('0x22')];for(_0x37a120=0x0;_0x37a120<_0x36d026[_0x1137('0x23')];_0x37a120++){if(_0x36d026[_0x37a120][_0x1137('0x1b')]===_0x2e3571[_0x1137('0x22')]){_0x22c2b9[_0x1137('0x20')]=_0x36d026[_0x37a120][_0x1137('0x1f')];}}}_0x3f97c3(_0x22c2b9);})['catch'](function(_0x54474e){_0x1ccfb(_0x54474e[_0x1137('0x11')]);});});}function createEndUser(_0x27122c,_0x39c545,_0xacccf6,_0x177ac7,_0x4c45c2,_0x329cb0){return new BPromise(function(_0x2addb0,_0x54c777){return getAuthToken(_0x39c545,_0xacccf6,_0x329cb0)[_0x1137('0xd')](function(_0x433c6c){var _0x163143=_0x329cb0[_0x1137('0x24')]()===_0x1137('0x25')?_0x4c45c2[_0x1137('0x26')]:_0x4c45c2['calleridnum'];var _0x52352f={'method':'POST','uri':_0x177ac7+_0x1137('0x27'),'body':{'telephone1':_0x163143,'fullname':_0x163143,'firstname':_0x163143,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x1137('0x28')+_0x27122c['userId']+')'},'headers':{'Authorization':'Bearer\x20'+_0x433c6c,'OData-Version':_0x1137('0x15')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x52352f);})[_0x1137('0xd')](function(_0x54766a){var _0x176bf9=_0x54766a[_0x1137('0x29')][_0x1137('0x2a')];var _0x532b65=_0x176bf9['substring'](_0x176bf9['lastIndexOf']('(')+0x1,_0x176bf9[_0x1137('0x2b')](')'));_0x27122c[_0x1137('0x2c')]=_0x532b65;_0x2addb0(_0x27122c);})['catch'](function(_0x5a4a6f){_0x54c777(_0x5a4a6f[_0x1137('0x11')]);});});}function getEndUser(_0x383f67,_0x181894,_0x1ae928,_0x4409f5,_0x23ac06,_0x330b71){return new BPromise(function(_0x5c1a1f,_0x5774ed){var _0x397532=_0x330b71[_0x1137('0x24')]()===_0x1137('0x25')?_0x23ac06[_0x1137('0x26')]:_0x23ac06['calleridnum'];return getAuthToken(_0x181894,_0x1ae928,_0x330b71)[_0x1137('0xd')](function(_0xe4936){var _0x1816af={'method':'GET','uri':_0x4409f5+_0x1137('0x2d')+_0x397532[_0x1137('0x2e')]('+',_0x1137('0x2f'))+'\x27','headers':{'Authorization':_0x1137('0x14')+_0xe4936,'If-None-Match':null,'OData-Version':_0x1137('0x15')},'json':!![]};return rp(_0x1816af);})['then'](function(_0x15f7f7){var _0x43b183=null;if(_0x15f7f7){var _0x2ec19a=_0x15f7f7[_0x1137('0x16')];var _0x378fd3=![];for(_0x43b183=0x0;_0x43b183<_0x2ec19a[_0x1137('0x23')];_0x43b183++){if(_0x2ec19a[_0x43b183][_0x1137('0x30')]===_0x397532){_0x378fd3=!![];_0x383f67['enduserId']=_0x2ec19a[_0x43b183][_0x1137('0x31')];}}if(_0x378fd3){_0x5c1a1f(_0x383f67);}else{return createEndUser(_0x383f67,_0x181894,_0x1ae928,_0x4409f5,_0x23ac06,_0x330b71)[_0x1137('0xd')](function(_0x570acd){logger[_0x1137('0x1d')]('['+[_0x330b71[_0x1137('0x10')]()]+_0x1137('0x32'),_0x570acd['enduserId']);_0x5c1a1f(_0x570acd);});}}else{return createEndUser(_0x383f67,_0x181894,_0x1ae928,_0x4409f5,_0x23ac06,_0x330b71)[_0x1137('0xd')](function(_0x287fa8){logger[_0x1137('0x1d')]('['+[_0x330b71[_0x1137('0x10')]()]+_0x1137('0x33'),_0x287fa8['enduserId']);_0x5c1a1f(_0x287fa8);});}});});}function getCustomFields(_0x3d9d3e,_0x1aacaa,_0x4e3321){var _0x11f8a3={};if(_0x3d9d3e[_0x1137('0x23')]>0x0){_[_0x1137('0x34')](_0x3d9d3e,function(_0xde024d){if(_['includes'](['string',_0x1137('0x35')],_0xde024d[_0x1137('0x36')])&&_0xde024d[_0x1137('0x37')]&&!_0xde024d['customField']){var _0x4e5d60=_0xde024d[_0x1137('0x38')][_0x1137('0x24')]();var _0x5d16ac=_0x4e5d60[_0x1137('0x39')](0x0,_0x4e5d60[_0x1137('0x3a')]('_'));var _0x3a3aa2=_0x4e5d60['substring'](_0x4e5d60[_0x1137('0x3a')]('_')+0x1);if(_0x5d16ac===_0x4e3321){_0x11f8a3[_0x3a3aa2]=_0xde024d[_0x1137('0x3b')];}}});}return _0x11f8a3;}function getTicket(_0x272d15,_0x169b1b,_0xb0109e,_0x2b723e,_0x174d9a,_0xab786d,_0x4b3189){return new BPromise(function(_0x5dde5c,_0x73d282){var _0x4f2383;return getAuthToken(_0x169b1b,_0xb0109e,_0x4b3189)[_0x1137('0xd')](function(_0x4284e5){if(_0xab786d[_0x1137('0x3c')]===_0x1137('0x3d')){_0x4f2383={'method':_0x1137('0x3e'),'uri':_0x2b723e+_0x1137('0x3f'),'body':Object['assign']({},{'title':intUtil[_0x1137('0x40')](_0xab786d[_0x1137('0x41')],_0x174d9a,'\x20'),'description':intUtil[_0x1137('0x40')](_0xab786d[_0x1137('0x42')],_0x174d9a,'\x0a'),'customerid_contact@odata.bind':_0x1137('0x43')+_0x272d15[_0x1137('0x2c')]+')','ownerid@odata.bind':'/systemusers('+_0x272d15[_0x1137('0x20')]+')','caseorigincode':'1'},getCustomFields(_0xab786d['Fields'],_0x174d9a,_0xab786d['ticketType'])),'headers':{'Authorization':_0x1137('0x14')+_0x4284e5,'OData-Version':_0x1137('0x15')},'json':!![],'resolveWithFullResponse':!![]};}if(_0xab786d[_0x1137('0x3c')]==='phonecall'){_0x4f2383={'method':_0x1137('0x3e'),'uri':_0x2b723e+_0x1137('0x44'),'body':Object['assign']({},{'subject':intUtil[_0x1137('0x40')](_0xab786d['Subjects'],_0x174d9a,'\x20'),'phonenumber':String(_0x174d9a[_0x1137('0x45')]),'description':intUtil[_0x1137('0x40')](_0xab786d['Descriptions'],_0x174d9a,'\x0a'),'regardingobjectid_contact@odata.bind':_0x1137('0x43')+_0x272d15[_0x1137('0x2c')]+')','ownerid@odata.bind':'/systemusers('+_0x272d15['userId']+')','directioncode':_0x272d15[_0x1137('0x46')]===_0x1137('0x47')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x1137('0x28')+_0x272d15['userId']+')','participationtypemask':_0x272d15[_0x1137('0x46')]===_0x1137('0x47')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x272d15[_0x1137('0x2c')]+')','participationtypemask':_0x272d15['callDirection']===_0x1137('0x47')?0x1:0x2}]},getCustomFields(_0xab786d[_0x1137('0x48')],_0x174d9a,_0xab786d[_0x1137('0x3c')])),'headers':{'Authorization':'Bearer\x20'+_0x4284e5,'OData-Version':_0x1137('0x15')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x4f2383);})['then'](function(_0x137fb6){var _0x58c30b=_0x137fb6[_0x1137('0x29')][_0x1137('0x2a')];var _0x24ceba=_0x58c30b[_0x1137('0x39')](_0x58c30b[_0x1137('0x2b')]('(')+0x1,_0x58c30b[_0x1137('0x2b')](')'));_0x272d15[_0x1137('0x49')]=_0x24ceba;_0x5dde5c(_0x272d15);})[_0x1137('0xf')](function(_0x12c71e){_0x73d282(_0x12c71e['message']);});});}function emit(_0x5489a2,_0xcae5a7,_0x59730f,_0x2d5c0d){var _0x6821b1={'uri':util[_0x1137('0x4a')](_0x1137('0x4b'),_0x5489a2,_0x59730f,_0x2d5c0d)};io['to'](util[_0x1137('0x4a')](_0x1137('0x4c'),_0xcae5a7))['emit'](_0x1137('0x4d'),_0x6821b1);}exports['cs']=function(_0x5b600e,_0x49e4f5,_0x5b46f9,_0x1c0f80,_0x4630e3,_0x45f4db,_0x596222,_0x9392c2){var _0xe8f8d9={};_0x45f4db[_0x1137('0xb')]=intUtil[_0x1137('0x4e')](_0x45f4db[_0x1137('0xb')]);_0x45f4db['serverUrl']=intUtil[_0x1137('0x4e')](_0x45f4db[_0x1137('0x4f')]);_0xe8f8d9['callDirection']=_0x9392c2===_0x1137('0x47')||_0x9392c2==='unmanaged'?_0x1137('0x47'):_0x1137('0x25');var _0x4daa30=util[_0x1137('0x4a')](_0x1137('0x50'),_0x45f4db[_0x1137('0xb')]);var _0x106fe4=util['format']('https://login.microsoftonline.com/%s/oauth2/token',_0x45f4db[_0x1137('0x51')]);var _0x4d2ee0=util[_0x1137('0x4a')](_0x1137('0x52'),_0x45f4db['serverUrl'],_0x49e4f5[_0x1137('0x53')],md5(_0x49e4f5[_0x1137('0x53')]));if(_0x4630e3&&_0x4630e3[_0x1137('0x54')]){logger[_0x1137('0x1d')](_0x1137('0x55'),_0x1137('0x56'));_0x49e4f5[_0x1137('0x57')]=_0x4d2ee0;}else if(_0x596222&&_0x596222[_0x1137('0x58')]&&_0x596222[_0x1137('0x58')]!==_0x1137('0x59')){logger[_0x1137('0x1d')](_0x1137('0x5a'),_0x1137('0x56'));_0x49e4f5[_0x1137('0x57')]=_0x4d2ee0;}else{_0x49e4f5[_0x1137('0x57')]='';}return getUser(_0xe8f8d9,_0x45f4db,_0x1c0f80,_0x106fe4,_0x4daa30,_0x9392c2)[_0x1137('0xd')](function(_0x2b58d3){logger[_0x1137('0x1d')]('['+_0x9392c2[_0x1137('0x10')]()+_0x1137('0x5b'),_0x2b58d3[_0x1137('0x20')]);logger[_0x1137('0x1d')]('['+_0x9392c2[_0x1137('0x10')]()+_0x1137('0x5c'),_0x2b58d3['userEmail']);return getEndUser(_0x2b58d3,_0x45f4db,_0x106fe4,_0x4daa30,_0x49e4f5,_0x9392c2);})[_0x1137('0xd')](function(_0x99dce8){logger[_0x1137('0x1d')]('['+_0x9392c2[_0x1137('0x10')]()+_0x1137('0x5d'),_0x99dce8[_0x1137('0x2c')]);logger[_0x1137('0x1d')]('['+_0x9392c2[_0x1137('0x10')]()+_0x1137('0x5e'),_0x49e4f5[_0x1137('0x45')]);return getTicket(_0x99dce8,_0x45f4db,_0x106fe4,_0x4daa30,_0x49e4f5,_0x5b46f9,_0x9392c2);})[_0x1137('0xd')](function(_0x32fe22){logger[_0x1137('0x1d')](util[_0x1137('0x4a')]('['+_0x9392c2[_0x1137('0x10')]()+_0x1137('0x5f'),_0x5b46f9['ticketType'],_0x32fe22['ticketId']));logger[_0x1137('0x1d')](util[_0x1137('0x4a')]('['+_0x9392c2[_0x1137('0x10')]()+_0x1137('0x60'),_0x9392c2));if(_0x9392c2!==_0x1137('0x61')){logger[_0x1137('0x1d')]('['+_0x9392c2['toUpperCase']()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x45f4db[_0x1137('0xb')],_0x1c0f80[_0x1137('0x62')],_0x5b46f9[_0x1137('0x3c')],_0x32fe22['ticketId']);}})[_0x1137('0xf')](function(_0x2aff3b){logger[_0x1137('0x63')]('['+_0x9392c2['toUpperCase']()+_0x1137('0x64'),util[_0x1137('0x65')](_0x2aff3b,{'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 db7be2e..d5f7133 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 _0xfade=['%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','defaults','GET','map','string','picklist','type','nameField','customField','content','includes','idField','variable','variableName','push','customVariable','Variable','name','toLowerCase','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','toUpperCase','lastevent','lodash','md5','util','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','custom_fields','mapValues','keyBy','format','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','length','Agent\x20found!','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0xfade,0x148));var _0xefad=function(_0x566943,_0x73d1a0){_0x566943=_0x566943-0x0;var _0x5e36ce=_0xfade[_0x566943];return _0x5e36ce;};'use strict';var _=require(_0xefad('0x0'));var rp=require('request-promise');var md5=require(_0xefad('0x1'));var util=require(_0xefad('0x2'));var Redis=require('ioredis');var intUtil=require(_0xefad('0x3'));var config=require(_0xefad('0x4'));var logger=require(_0xefad('0x5'))(_0xefad('0x6'));config[_0xefad('0x7')]=_['defaults'](config[_0xefad('0x7')],{'host':_0xefad('0x8'),'port':0x18eb});var io=require(_0xefad('0x9'))(new Redis(config['redis']));var headers={'Content-Type':_0xefad('0xa'),'Accept':_0xefad('0xa')};function emit(_0x27aa36,_0x3f149f,_0x5a5dd6){io['to'](_0x27aa36)[_0xefad('0xb')](_0x3f149f,_0x5a5dd6);}function getTicket(_0x46012f,_0x28a55e,_0x295104,_0x29b091,_0x32a4a8){logger[_0xefad('0xc')](_0xefad('0xd'));var _0x3a8630=_[_0xefad('0xe')]({'responder_id':_0x28a55e['id'],'requester_id':_0x295104['id'],'name':util['format'](_0xefad('0xf'),_0x32a4a8[_0xefad('0x10')]),'phone':_0x32a4a8[_0xefad('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xefad('0x12')](_0x29b091[_0xefad('0x13')],_0x32a4a8,'\x20'),'description':intUtil[_0xefad('0x12')](_0x29b091[_0xefad('0x14')],_0x32a4a8,_0xefad('0x15')),'tags':getTags(_0x29b091[_0xefad('0x16')],'name')},getCustomFields(_0x29b091['Fields'],_0x32a4a8));_0x3a8630[_0xefad('0x17')]=_[_0xefad('0x18')](_[_0xefad('0x19')](_0x3a8630[_0xefad('0x17')],'id'),'value');return request({'uri':util[_0xefad('0x1a')](_0xefad('0x1b'),_0x46012f[_0xefad('0x1c')]),'method':_0xefad('0x1d'),'body':_0x3a8630})[_0xefad('0x1e')](function(_0x220439){logger[_0xefad('0xc')](_0xefad('0x1f'));return _0x220439;});}function getUser(_0x4bfd2f,_0xa70f42){if(intUtil['validateEmail'](_0xa70f42)){return request({'uri':util[_0xefad('0x1a')]('%s/api/v2/agents',_0x4bfd2f['remoteUri']),'qs':{'email':_0xa70f42}})[_0xefad('0x1e')](function(_0x30bd40){if(_0x30bd40[_0xefad('0x20')]){logger['info'](_0xefad('0x21'));return _['find'](_0x30bd40,function(_0x31b1c0){return _0x31b1c0[_0xefad('0x22')][_0xefad('0x23')]===_0xa70f42;});}else{logger['info'](_0xefad('0x24'));return request({'uri':util['format'](_0xefad('0x25'),_0x4bfd2f['remoteUri'])})[_0xefad('0x1e')](function(_0x398bf7){logger[_0xefad('0xc')](_0xefad('0x26'));return _0x398bf7;});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xefad('0x1a')](_0xefad('0x25'),_0x4bfd2f['remoteUri'])})[_0xefad('0x1e')](function(_0xb16910){logger[_0xefad('0xc')](_0xefad('0x26'));return _0xb16910;});}}function getEndUser(_0xdae882,_0x304826,_0x1bc54c){logger['info'](_0xefad('0x27'),_0x1bc54c);return request({'uri':util['format'](_0xefad('0x28'),_0xdae882['remoteUri']),'qs':{'phone':_0x1bc54c}})[_0xefad('0x1e')](function(_0x1dc695){if(_0x1dc695[_0xefad('0x20')]){logger[_0xefad('0xc')](_0xefad('0x29'));return _['find'](_0x1dc695,{'phone':_0x1bc54c});}else{logger['info'](_0xefad('0x2a'));return request({'uri':util['format'](_0xefad('0x28'),_0xdae882[_0xefad('0x1c')]),'method':'POST','body':{'name':_0x304826,'phone':_0x1bc54c}})[_0xefad('0x1e')](function(_0xf692cf){logger[_0xefad('0xc')](_0xefad('0x2b'));return _0xf692cf;});}});}function getAuth(_0x21a973){return util[_0xefad('0x1a')](_0xefad('0x2c'),new Buffer(_0x21a973['apiKey']+':X')[_0xefad('0x2d')](_0xefad('0x2e')));}function request(_0x378479){logger[_0xefad('0x2f')](_0xefad('0x30'),JSON[_0xefad('0x31')](_0x378479));return rp(_[_0xefad('0x32')](_0x378479,{'method':_0xefad('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x107774,_0x55531e){var _0x4c4ceb=[];if(_0x107774&&_0x107774[_0xefad('0x20')]>0x0){_0x4c4ceb=_[_0xefad('0x34')](_0x107774,_0x55531e);}return _0x4c4ceb;}function getCustomFields(_0x4faba1,_0x3bfc5d){var _0x26b415=[];var _0x550eb8={'custom_fields':[]};if(_0x4faba1[_0xefad('0x20')]>0x0){_['forEach'](_0x4faba1,function(_0x447b33){if(_['includes']([_0xefad('0x35'),_0xefad('0x36')],_0x447b33[_0xefad('0x37')])&&_0x447b33[_0xefad('0x38')]&&!_0x447b33[_0xefad('0x39')]){_0x550eb8[_0x447b33[_0xefad('0x38')]['toLowerCase']()]=_0x447b33[_0xefad('0x3a')][_0xefad('0x2d')]();}else if(_[_0xefad('0x3b')]([_0xefad('0x35'),_0xefad('0x36')],_0x447b33[_0xefad('0x37')])&&_0x447b33['idField']&&_0x447b33[_0xefad('0x39')]){_0x550eb8[_0xefad('0x17')]['push']({'id':_0x447b33[_0xefad('0x3c')],'value':_0x447b33['content'][_0xefad('0x2d')]()});}else if(_0x447b33[_0xefad('0x37')]===_0xefad('0x3d')&&_0x447b33[_0xefad('0x3e')]&&_0x447b33['idField']&&_0x447b33['customField']){_0x3bfc5d[_0x447b33[_0xefad('0x3e')]]&&_0x550eb8[_0xefad('0x17')][_0xefad('0x3f')]({'id':_0x447b33['idField'],'value':_0x3bfc5d[_0x447b33[_0xefad('0x3e')]][_0xefad('0x2d')]()});}else if(_0x447b33['type']===_0xefad('0x40')&&_0x447b33[_0xefad('0x41')]&&_0x447b33[_0xefad('0x41')][_0xefad('0x42')]&&_0x447b33[_0xefad('0x3c')]&&_0x447b33[_0xefad('0x39')]){_0x3bfc5d[_0x447b33[_0xefad('0x41')][_0xefad('0x42')][_0xefad('0x43')]()]&&_0x550eb8[_0xefad('0x17')][_0xefad('0x3f')]({'id':_0x447b33[_0xefad('0x3c')],'value':_0x3bfc5d[_0x447b33[_0xefad('0x41')][_0xefad('0x42')][_0xefad('0x43')]()]['toString']()});}});}return _0x550eb8;}exports[_0xefad('0x44')]=function(_0xed6fac,_0x3084f1,_0x64744a,_0x4011dc,_0x5006cf,_0x1dcde6){var _0x48ae6a,_0x2ccf4e;_0x1dcde6[_0xefad('0x1c')]=intUtil[_0xefad('0x45')](_0x1dcde6['remoteUri']);_0x1dcde6[_0xefad('0x46')]=intUtil['stripTrailingSlash'](_0x1dcde6[_0xefad('0x46')]);if(_0x5006cf&&_0x5006cf['monitor_format']){logger[_0xefad('0xc')](_0xefad('0x47'),_0xefad('0x48'));_0x3084f1[_0xefad('0x49')]=util[_0xefad('0x1a')](_0xefad('0x4a'),_0x1dcde6[_0xefad('0x46')],_0x3084f1[_0xefad('0x4b')],md5(_0x3084f1[_0xefad('0x4b')]));}else{_0x3084f1[_0xefad('0x49')]='';}headers[_0xefad('0x4c')]=getAuth(_0x1dcde6);return getUser(_0x1dcde6,_0x4011dc[_0xefad('0x23')])[_0xefad('0x1e')](function(_0x223afa){_0x48ae6a=_0x223afa;logger['info'](_0xefad('0x4d'),_0x48ae6a['id']);return getEndUser(_0x1dcde6,_0x3084f1[_0xefad('0x10')],_0x3084f1['calleridnum']);})[_0xefad('0x1e')](function(_0xcc17ef){_0x2ccf4e=_0xcc17ef;logger[_0xefad('0xc')](_0xefad('0x4e'),_0x2ccf4e['id']);return getTicket(_0x1dcde6,_0x48ae6a,_0x2ccf4e,_0x64744a,_0x3084f1);})['then'](function(_0x581ecd){if(_0x581ecd&&_0x581ecd['id']){logger['info']('Ticket\x20created!');logger[_0xefad('0xc')](_0xefad('0x4f'),_0x581ecd['id']);logger['info']('[QUEUE]',_0xefad('0x50'));emit(util[_0xefad('0x1a')](_0xefad('0x51'),_0x4011dc[_0xefad('0x42')]),_0xefad('0x52'),{'uri':util['format'](_0xefad('0x53'),_0x1dcde6['remoteUri'],_0x581ecd['id'])});}})[_0xefad('0x54')](function(_0x42d9eb){logger['error']('[QUEUE]',JSON[_0xefad('0x31')](_0x42d9eb));});};exports[_0xefad('0x55')]=function(_0x4e70ff,_0x40272c,_0x263429,_0xabcb05,_0x57fab0,_0x1dc6e5,_0x1d3073){var _0x42ecdd,_0x40f174;_0x1dc6e5[_0xefad('0x1c')]=intUtil['stripTrailingSlash'](_0x1dc6e5['remoteUri']);_0x1dc6e5['serverUrl']=intUtil[_0xefad('0x45')](_0x1dc6e5[_0xefad('0x46')]);if(_0x1d3073&&_0x1d3073['recordingFormat']&&_0x1d3073[_0xefad('0x56')]!==_0xefad('0x57')){logger['info'](_0xefad('0x58'),_0xefad('0x48'));_0x40272c[_0xefad('0x49')]=util[_0xefad('0x1a')](_0xefad('0x4a'),_0x1dc6e5[_0xefad('0x46')],_0x40272c['uniqueid'],md5(_0x40272c[_0xefad('0x4b')]));}headers['Authorization']=getAuth(_0x1dc6e5);return getUser(_0x1dc6e5,_0xabcb05[_0xefad('0x23')])['then'](function(_0x3a4e66){_0x42ecdd=_0x3a4e66;logger[_0xefad('0xc')](_0xefad('0x4d'),_0x42ecdd['id']);return getEndUser(_0x1dc6e5,_0x40272c[_0xefad('0x59')],_0x40272c['destcalleridnum']);})[_0xefad('0x1e')](function(_0x4c4621){_0x40f174=_0x4c4621;logger[_0xefad('0xc')]('The\x20Enduser\x20ID\x20is:',_0x40f174['id']);return getTicket(_0x1dc6e5,_0x42ecdd,_0x40f174,_0x263429,_0x40272c);})[_0xefad('0x1e')](function(_0x58b229){if(_0x58b229&&_0x58b229['id']){logger['info']('Ticket\x20created!');logger[_0xefad('0xc')](_0xefad('0x4f'),_0x58b229['id']);logger[_0xefad('0xc')](_0xefad('0x58'),_0xefad('0x50'));emit(util['format']('user:%s',_0xabcb05[_0xefad('0x42')]),_0xefad('0x52'),{'uri':util['format'](_0xefad('0x53'),_0x1dc6e5['remoteUri'],_0x58b229['id'])});}})[_0xefad('0x54')](function(_0x3ba66b){logger['error'](_0xefad('0x58'),JSON[_0xefad('0x31')](_0x3ba66b));});};exports['unmanaged']=function(_0x166c37,_0x5a332f,_0x2d983f,_0x5af4ac,_0x3aee06,_0x474ab8){var _0xcf555b,_0x1950ef;_0x474ab8[_0xefad('0x1c')]=intUtil['stripTrailingSlash'](_0x474ab8[_0xefad('0x1c')]);_0x474ab8[_0xefad('0x46')]=intUtil['stripTrailingSlash'](_0x474ab8['serverUrl']);if(_0x3aee06&&_0x3aee06['monitor_format']){logger[_0xefad('0xc')]('['+_0x5a332f['lastevent'][_0xefad('0x5a')]()+']',_0xefad('0x48'));_0x5a332f[_0xefad('0x49')]=util['format'](_0xefad('0x4a'),_0x474ab8[_0xefad('0x46')],_0x5a332f[_0xefad('0x4b')],md5(_0x5a332f[_0xefad('0x4b')]));}else{_0x5a332f[_0xefad('0x49')]='';}headers['Authorization']=getAuth(_0x474ab8);return getUser(_0x474ab8,'')['then'](function(_0x4c93a9){_0xcf555b=_0x4c93a9;logger['info'](_0xefad('0x4d'),_0xcf555b['id']);return getEndUser(_0x474ab8,_0x5a332f['calleridname'],_0x5a332f[_0xefad('0x11')]);})[_0xefad('0x1e')](function(_0x221b45){_0x1950ef=_0x221b45;logger[_0xefad('0xc')](_0xefad('0x4e'),_0x1950ef['id']);return getTicket(_0x474ab8,_0xcf555b,_0x1950ef,_0x2d983f,_0x5a332f);})[_0xefad('0x1e')](function(_0x13165a){if(_0x13165a){logger['info']('Ticket\x20created!');logger[_0xefad('0xc')](_0xefad('0x4f'),_0x13165a['id']);}})[_0xefad('0x54')](function(_0x1a027d){logger['error']('['+_0x5a332f[_0xefad('0x5b')][_0xefad('0x5a')]()+']',JSON[_0xefad('0x31')](_0x1a027d));});}; \ No newline at end of file +var _0x5f09=['util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','defaults','redis','localhost','info','format','Caller\x20-\x20%s','calleridnum','getString','Subjects','
','Tags','name','custom_fields','keyBy','value','%s/api/v2/tickets','POST','then','Ticket\x20created!','remoteUri','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20created.','apiKey','base64','debug','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','type','customField','nameField','toLowerCase','toString','idField','push','content','variable','variableName','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','Authorization','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','%s/helpdesk/tickets/%d','lastevent','lodash','request-promise','md5'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x5f09,0x161));var _0x95f0=function(_0x1b9bbb,_0x360985){_0x1b9bbb=_0x1b9bbb-0x0;var _0x35686d=_0x5f09[_0x1b9bbb];return _0x35686d;};'use strict';var _=require(_0x95f0('0x0'));var rp=require(_0x95f0('0x1'));var md5=require(_0x95f0('0x2'));var util=require(_0x95f0('0x3'));var Redis=require(_0x95f0('0x4'));var intUtil=require(_0x95f0('0x5'));var config=require(_0x95f0('0x6'));var logger=require(_0x95f0('0x7'))(_0x95f0('0x8'));config['redis']=_[_0x95f0('0x9')](config[_0x95f0('0xa')],{'host':_0x95f0('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var headers={'Content-Type':'application/json','Accept':'application/json'};function emit(_0x19f3f8,_0x243e23,_0x794003){io['to'](_0x19f3f8)['emit'](_0x243e23,_0x794003);}function getTicket(_0x2797f6,_0x30d972,_0x3f099a,_0x3866eb,_0x5b7571){logger[_0x95f0('0xc')]('Creating\x20new\x20ticket...');var _0x588d7a=_['merge']({'responder_id':_0x30d972['id'],'requester_id':_0x3f099a['id'],'name':util[_0x95f0('0xd')](_0x95f0('0xe'),_0x5b7571['calleridname']),'phone':_0x5b7571[_0x95f0('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x95f0('0x10')](_0x3866eb[_0x95f0('0x11')],_0x5b7571,'\x20'),'description':intUtil[_0x95f0('0x10')](_0x3866eb['Descriptions'],_0x5b7571,_0x95f0('0x12')),'tags':getTags(_0x3866eb[_0x95f0('0x13')],_0x95f0('0x14'))},getCustomFields(_0x3866eb['Fields'],_0x5b7571));_0x588d7a[_0x95f0('0x15')]=_['mapValues'](_[_0x95f0('0x16')](_0x588d7a[_0x95f0('0x15')],'id'),_0x95f0('0x17'));return request({'uri':util['format'](_0x95f0('0x18'),_0x2797f6['remoteUri']),'method':_0x95f0('0x19'),'body':_0x588d7a})[_0x95f0('0x1a')](function(_0x5c8ac1){logger[_0x95f0('0xc')](_0x95f0('0x1b'));return _0x5c8ac1;});}function getUser(_0x11e077,_0x40128a){if(intUtil['validateEmail'](_0x40128a)){return request({'uri':util[_0x95f0('0xd')]('%s/api/v2/agents',_0x11e077[_0x95f0('0x1c')]),'qs':{'email':_0x40128a}})[_0x95f0('0x1a')](function(_0x57c89e){if(_0x57c89e[_0x95f0('0x1d')]){logger[_0x95f0('0xc')](_0x95f0('0x1e'));return _[_0x95f0('0x1f')](_0x57c89e,function(_0x5f91af){return _0x5f91af[_0x95f0('0x20')][_0x95f0('0x21')]===_0x40128a;});}else{logger[_0x95f0('0xc')](_0x95f0('0x22'));return request({'uri':util[_0x95f0('0xd')](_0x95f0('0x23'),_0x11e077[_0x95f0('0x1c')])})[_0x95f0('0x1a')](function(_0x521fb0){logger[_0x95f0('0xc')]('Admin\x20account\x20selected.');return _0x521fb0;});}});}else{logger[_0x95f0('0xc')](_0x95f0('0x24'));return request({'uri':util[_0x95f0('0xd')](_0x95f0('0x23'),_0x11e077[_0x95f0('0x1c')])})[_0x95f0('0x1a')](function(_0xd8d93f){logger[_0x95f0('0xc')]('Admin\x20account\x20selected.');return _0xd8d93f;});}}function getEndUser(_0x2a9969,_0x7e9ead,_0x39dbcb){logger[_0x95f0('0xc')](_0x95f0('0x25'),_0x39dbcb);return request({'uri':util[_0x95f0('0xd')](_0x95f0('0x26'),_0x2a9969[_0x95f0('0x1c')]),'qs':{'phone':_0x39dbcb}})[_0x95f0('0x1a')](function(_0x34654c){if(_0x34654c[_0x95f0('0x1d')]){logger[_0x95f0('0xc')]('Enduser\x20found!');return _[_0x95f0('0x1f')](_0x34654c,{'phone':_0x39dbcb});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x95f0('0xd')](_0x95f0('0x26'),_0x2a9969[_0x95f0('0x1c')]),'method':_0x95f0('0x19'),'body':{'name':_0x7e9ead,'phone':_0x39dbcb}})[_0x95f0('0x1a')](function(_0x2464e1){logger[_0x95f0('0xc')](_0x95f0('0x27'));return _0x2464e1;});}});}function getAuth(_0x5c2a1d){return util[_0x95f0('0xd')]('Basic\x20%s',new Buffer(_0x5c2a1d[_0x95f0('0x28')]+':X')['toString'](_0x95f0('0x29')));}function request(_0x4b3ec2){logger[_0x95f0('0x2a')](_0x95f0('0x2b'),JSON[_0x95f0('0x2c')](_0x4b3ec2));return rp(_[_0x95f0('0x9')](_0x4b3ec2,{'method':_0x95f0('0x2d'),'headers':headers,'json':!![]}));}function getTags(_0x7c84d3,_0x57f079){var _0x4a71b1=[];if(_0x7c84d3&&_0x7c84d3[_0x95f0('0x1d')]>0x0){_0x4a71b1=_[_0x95f0('0x2e')](_0x7c84d3,_0x57f079);}return _0x4a71b1;}function getCustomFields(_0x5b1c83,_0x43a48e){var _0x363d6e=[];var _0x513cf1={'custom_fields':[]};if(_0x5b1c83[_0x95f0('0x1d')]>0x0){_[_0x95f0('0x2f')](_0x5b1c83,function(_0x15729c){if(_[_0x95f0('0x30')]([_0x95f0('0x31'),_0x95f0('0x32')],_0x15729c[_0x95f0('0x33')])&&_0x15729c['nameField']&&!_0x15729c[_0x95f0('0x34')]){_0x513cf1[_0x15729c[_0x95f0('0x35')][_0x95f0('0x36')]()]=_0x15729c['content'][_0x95f0('0x37')]();}else if(_['includes']([_0x95f0('0x31'),'picklist'],_0x15729c[_0x95f0('0x33')])&&_0x15729c[_0x95f0('0x38')]&&_0x15729c['customField']){_0x513cf1[_0x95f0('0x15')][_0x95f0('0x39')]({'id':_0x15729c['idField'],'value':_0x15729c[_0x95f0('0x3a')][_0x95f0('0x37')]()});}else if(_0x15729c[_0x95f0('0x33')]===_0x95f0('0x3b')&&_0x15729c[_0x95f0('0x3c')]&&_0x15729c[_0x95f0('0x38')]&&_0x15729c['customField']){_0x43a48e[_0x15729c['variableName']]&&_0x513cf1[_0x95f0('0x15')][_0x95f0('0x39')]({'id':_0x15729c[_0x95f0('0x38')],'value':_0x43a48e[_0x15729c[_0x95f0('0x3c')]][_0x95f0('0x37')]()});}else if(_0x15729c[_0x95f0('0x33')]==='customVariable'&&_0x15729c['Variable']&&_0x15729c[_0x95f0('0x3d')][_0x95f0('0x14')]&&_0x15729c[_0x95f0('0x38')]&&_0x15729c[_0x95f0('0x34')]){_0x43a48e[_0x15729c['Variable']['name'][_0x95f0('0x36')]()]&&_0x513cf1[_0x95f0('0x15')][_0x95f0('0x39')]({'id':_0x15729c[_0x95f0('0x38')],'value':_0x43a48e[_0x15729c['Variable']['name'][_0x95f0('0x36')]()]['toString']()});}});}return _0x513cf1;}exports[_0x95f0('0x3e')]=function(_0x4d10f5,_0x46e287,_0x3837de,_0x51dfb8,_0x6ee126,_0x14012f){var _0x2f2e4e,_0x89fe92;_0x14012f['remoteUri']=intUtil[_0x95f0('0x3f')](_0x14012f[_0x95f0('0x1c')]);_0x14012f[_0x95f0('0x40')]=intUtil[_0x95f0('0x3f')](_0x14012f['serverUrl']);if(_0x6ee126&&_0x6ee126[_0x95f0('0x41')]){logger[_0x95f0('0xc')](_0x95f0('0x42'),'Recording\x20is\x20enabled!');_0x46e287[_0x95f0('0x43')]=util[_0x95f0('0xd')](_0x95f0('0x44'),_0x14012f[_0x95f0('0x40')],_0x46e287[_0x95f0('0x45')],md5(_0x46e287[_0x95f0('0x45')]));}else{_0x46e287['recordingURL']='';}headers['Authorization']=getAuth(_0x14012f);return getUser(_0x14012f,_0x51dfb8[_0x95f0('0x21')])[_0x95f0('0x1a')](function(_0x34e095){_0x2f2e4e=_0x34e095;logger[_0x95f0('0xc')]('The\x20User\x20ID\x20is:',_0x2f2e4e['id']);return getEndUser(_0x14012f,_0x46e287[_0x95f0('0x46')],_0x46e287[_0x95f0('0xf')]);})['then'](function(_0x3680d4){_0x89fe92=_0x3680d4;logger[_0x95f0('0xc')](_0x95f0('0x47'),_0x89fe92['id']);return getTicket(_0x14012f,_0x2f2e4e,_0x89fe92,_0x3837de,_0x46e287);})[_0x95f0('0x1a')](function(_0x4940f9){if(_0x4940f9&&_0x4940f9['id']){logger[_0x95f0('0xc')](_0x95f0('0x1b'));logger[_0x95f0('0xc')]('The\x20Ticket\x20ID\x20is:',_0x4940f9['id']);logger[_0x95f0('0xc')]('[QUEUE]',_0x95f0('0x48'));emit(util[_0x95f0('0xd')](_0x95f0('0x49'),_0x51dfb8['name']),_0x95f0('0x4a'),{'uri':util[_0x95f0('0xd')]('%s/helpdesk/tickets/%d',_0x14012f[_0x95f0('0x1c')],_0x4940f9['id'])});}})[_0x95f0('0x4b')](function(_0x9a7375){logger[_0x95f0('0x4c')](_0x95f0('0x42'),JSON[_0x95f0('0x2c')](_0x9a7375));});};exports[_0x95f0('0x4d')]=function(_0x31160b,_0x58c929,_0x16a112,_0x591b05,_0xff7de9,_0x1daa5d,_0x25fee7){var _0x48d0ef,_0x38ded2;_0x1daa5d[_0x95f0('0x1c')]=intUtil['stripTrailingSlash'](_0x1daa5d[_0x95f0('0x1c')]);_0x1daa5d[_0x95f0('0x40')]=intUtil[_0x95f0('0x3f')](_0x1daa5d[_0x95f0('0x40')]);if(_0x25fee7&&_0x25fee7[_0x95f0('0x4e')]&&_0x25fee7[_0x95f0('0x4e')]!==_0x95f0('0x4f')){logger[_0x95f0('0xc')](_0x95f0('0x50'),_0x95f0('0x51'));_0x58c929[_0x95f0('0x43')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1daa5d[_0x95f0('0x40')],_0x58c929[_0x95f0('0x45')],md5(_0x58c929[_0x95f0('0x45')]));}headers[_0x95f0('0x52')]=getAuth(_0x1daa5d);return getUser(_0x1daa5d,_0x591b05[_0x95f0('0x21')])[_0x95f0('0x1a')](function(_0x4e92dd){_0x48d0ef=_0x4e92dd;logger[_0x95f0('0xc')](_0x95f0('0x53'),_0x48d0ef['id']);return getEndUser(_0x1daa5d,_0x58c929[_0x95f0('0x54')],_0x58c929[_0x95f0('0x55')]);})[_0x95f0('0x1a')](function(_0xa38680){_0x38ded2=_0xa38680;logger[_0x95f0('0xc')]('The\x20Enduser\x20ID\x20is:',_0x38ded2['id']);return getTicket(_0x1daa5d,_0x48d0ef,_0x38ded2,_0x16a112,_0x58c929);})[_0x95f0('0x1a')](function(_0x22be9d){if(_0x22be9d&&_0x22be9d['id']){logger[_0x95f0('0xc')](_0x95f0('0x1b'));logger[_0x95f0('0xc')](_0x95f0('0x56'),_0x22be9d['id']);logger[_0x95f0('0xc')](_0x95f0('0x50'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x95f0('0x49'),_0x591b05[_0x95f0('0x14')]),_0x95f0('0x4a'),{'uri':util[_0x95f0('0xd')](_0x95f0('0x57'),_0x1daa5d[_0x95f0('0x1c')],_0x22be9d['id'])});}})[_0x95f0('0x4b')](function(_0x13a68d){logger['error'](_0x95f0('0x50'),JSON[_0x95f0('0x2c')](_0x13a68d));});};exports['unmanaged']=function(_0x761289,_0x5b3fa9,_0x2d3c56,_0xf10142,_0x5d0458,_0x243b59){var _0x2ec044,_0x4c4782;_0x243b59[_0x95f0('0x1c')]=intUtil['stripTrailingSlash'](_0x243b59[_0x95f0('0x1c')]);_0x243b59['serverUrl']=intUtil[_0x95f0('0x3f')](_0x243b59['serverUrl']);if(_0x5d0458&&_0x5d0458[_0x95f0('0x41')]){logger[_0x95f0('0xc')]('['+_0x5b3fa9['lastevent']['toUpperCase']()+']',_0x95f0('0x51'));_0x5b3fa9['recordingURL']=util[_0x95f0('0xd')](_0x95f0('0x44'),_0x243b59[_0x95f0('0x40')],_0x5b3fa9[_0x95f0('0x45')],md5(_0x5b3fa9['uniqueid']));}else{_0x5b3fa9[_0x95f0('0x43')]='';}headers[_0x95f0('0x52')]=getAuth(_0x243b59);return getUser(_0x243b59,'')[_0x95f0('0x1a')](function(_0x944ae4){_0x2ec044=_0x944ae4;logger[_0x95f0('0xc')](_0x95f0('0x53'),_0x2ec044['id']);return getEndUser(_0x243b59,_0x5b3fa9[_0x95f0('0x46')],_0x5b3fa9[_0x95f0('0xf')]);})['then'](function(_0x4217de){_0x4c4782=_0x4217de;logger[_0x95f0('0xc')](_0x95f0('0x47'),_0x4c4782['id']);return getTicket(_0x243b59,_0x2ec044,_0x4c4782,_0x2d3c56,_0x5b3fa9);})[_0x95f0('0x1a')](function(_0x474a78){if(_0x474a78){logger[_0x95f0('0xc')](_0x95f0('0x1b'));logger['info'](_0x95f0('0x56'),_0x474a78['id']);}})['catch'](function(_0x594e2b){logger[_0x95f0('0x4c')]('['+_0x5b3fa9[_0x95f0('0x58')]['toUpperCase']()+']',JSON['stringify'](_0x594e2b));});}; \ 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 cd27eb3..7ec0752 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 _0x4809=['POST','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','Contact','ticketId','task','Task\x20created:','user:%s','emit','trigger:browser:url','remoteUri','serverUrl','stripTrailingSlash','outbound','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','lodash','request-promise','md5','moment','bluebird','ioredis','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','/api/selector/owners','info','users','length','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','error','toUpperCase','message','GET','headers','then','agentEmail','Getting\x20user\x20with\x20email','userEmail','email','userId','User\x20found:','Admin\x20selected','catch','/api/lookup?q=','&f=','&entities=contact','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','contactNumber','Contact\x20found\x20mobile_number:','endUserId','work_number','Contact\x20created:'];(function(_0x3474ac,_0x22d0f7){var _0x5345ec=function(_0x45056e){while(--_0x45056e){_0x3474ac['push'](_0x3474ac['shift']());}};_0x5345ec(++_0x22d0f7);}(_0x4809,0xc8));var _0x9480=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0x4809[_0xef8146];return _0x5a6cb0;};'use strict';var _=require(_0x9480('0x0'));var rp=require(_0x9480('0x1'));var md5=require(_0x9480('0x2'));var util=require('util');var moment=require(_0x9480('0x3'));var Promise=require(_0x9480('0x4'));var Redis=require(_0x9480('0x5'));var intUtil=require('./util');var config=require(_0x9480('0x6'));var logger=require(_0x9480('0x7'))(_0x9480('0x8'));config[_0x9480('0x9')]=_[_0x9480('0xa')](config['redis'],{'host':_0x9480('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9480('0x9')]));function getAdminId(_0xb21b02,_0x2cbfa8,_0x30ef91,_0x238496){return new Promise(function(_0x1a5a92,_0x52db55){var _0x3391e0=![];var _0x4cb831={'method':'GET','uri':_0x238496+_0x9480('0xc'),'json':!![]};_0x4cb831['headers']=_0x30ef91;logger[_0x9480('0xd')]('Getting\x20admin\x20information');return rp(_0x4cb831)['then'](function(_0x5a834c){if(_0x5a834c){var _0x569652=_0x5a834c[_0x9480('0xe')];var _0x4fe914=null;for(_0x4fe914=0x0;_0x4fe914<_0x569652[_0x9480('0xf')];_0x4fe914++){if(_0x569652[_0x4fe914]['email']===_0xb21b02[_0x9480('0x10')]){_0xb21b02[_0x9480('0x11')]=_0x569652[_0x4fe914]['id'];_0x3391e0=!![];}}if(_0x3391e0){logger['info'](_0x9480('0x12'),_0xb21b02[_0x9480('0x11')]);_0x1a5a92(_0xb21b02);}else{_0x52db55({'statusCode':0x194,'message':_0x9480('0x13')});}}else{_0x52db55({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})['catch'](function(_0x4adb11){logger[_0x9480('0x14')]('['+[_0x2cbfa8[_0x9480('0x15')]()]+']',_0x4adb11[_0x9480('0x16')]);_0x52db55(_0x4adb11);});});}function getUser(_0x5b5ae9,_0x4ebbac,_0x11ad00){return function(_0x97f49){return new Promise(function(_0x5b66b1,_0x496258){var _0x5bd90e={'method':_0x9480('0x17'),'uri':_0x11ad00+'/api/selector/owners','json':!![]};_0x5bd90e[_0x9480('0x18')]=_0x4ebbac;logger['info']('Getting\x20user\x20list');return rp(_0x5bd90e)[_0x9480('0x19')](function(_0x403390){if(_0x403390){var _0x65e5a8=_0x403390[_0x9480('0xe')];var _0x41b2bf=![];var _0x35b970=null;if(_0x97f49[_0x9480('0x1a')]!==null){logger['info'](_0x9480('0x1b'),_0x97f49[_0x9480('0x1a')]);_0x97f49[_0x9480('0x1c')]=_0x97f49['agentEmail'];for(_0x35b970=0x0;_0x35b970<_0x65e5a8['length'];_0x35b970++){if(_0x65e5a8[_0x35b970][_0x9480('0x1d')]===_0x97f49['agentEmail']){_0x41b2bf=!![];_0x97f49[_0x9480('0x1e')]=_0x65e5a8[_0x35b970]['id'];logger[_0x9480('0xd')](_0x9480('0x1f'),_0x97f49[_0x9480('0x1e')]);}}}if(!_0x41b2bf){logger[_0x9480('0xd')](_0x9480('0x20'));_0x97f49[_0x9480('0x1c')]=_0x97f49[_0x9480('0x10')];_0x97f49[_0x9480('0x1e')]=_0x97f49[_0x9480('0x11')];_0x41b2bf=!![];}if(_0x41b2bf){_0x5b66b1(_0x97f49);}else{_0x496258({'statusCode':0x194,'message':_0x9480('0x13')});}}else{_0x496258({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x9480('0x21')](function(_0x4d3bee){logger[_0x9480('0x14')]('['+[_0x5b5ae9['toUpperCase']()]+']',_0x4d3bee['message']);_0x496258(_0x4d3bee);});});};}function searchContact(_0x3caa29,_0x3e748d,_0x42f151,_0x6b0d2e){return new Promise(function(_0x43e77f,_0x2740dd){var _0x3d48f7={'method':_0x9480('0x17'),'headers':_0x3e748d,'uri':_0x3caa29+_0x9480('0x22')+_0x6b0d2e+_0x9480('0x23')+_0x42f151+_0x9480('0x24'),'json':!![]};rp(_0x3d48f7)[_0x9480('0x19')](function(_0x260ef2){var _0x4b37a3=_[_0x9480('0x25')](_0x260ef2[_0x9480('0x26')][_0x9480('0x26')],[_0x42f151,_0x6b0d2e]);_0x43e77f(_0x4b37a3);})[_0x9480('0x21')](function(_0x40d5fe){_0x2740dd(_0x40d5fe);});});}function getEndUser(_0x5008f1,_0x2ad01e,_0x73608e){return function(_0x3b6c1c){return new Promise(function(_0x3ffcdd,_0x14ffe5){logger[_0x9480('0xd')](util['format'](_0x9480('0x27'),_0x3b6c1c['contactNumber']));searchContact(_0x73608e,_0x2ad01e,_0x9480('0x28'),_0x3b6c1c[_0x9480('0x29')])[_0x9480('0x19')](function(_0x51c3c0){if(_0x51c3c0){_0x3b6c1c['endUserId']=_0x51c3c0['id'];logger[_0x9480('0xd')](_0x9480('0x2a'),_0x3b6c1c[_0x9480('0x2b')]);return _0x3ffcdd(_0x3b6c1c);}searchContact(_0x73608e,_0x2ad01e,_0x9480('0x2c'),_0x3b6c1c[_0x9480('0x29')])[_0x9480('0x19')](function(_0x1f85fc){if(_0x1f85fc){_0x3b6c1c[_0x9480('0x2b')]=_0x1f85fc['id'];logger[_0x9480('0xd')]('Contact\x20found\x20work_number:',_0x3b6c1c[_0x9480('0x2b')]);return _0x3ffcdd(_0x3b6c1c);}createEndUser(_0x3b6c1c,_0x5008f1,_0x2ad01e,_0x73608e)[_0x9480('0x19')](function(_0x28d0c8){logger[_0x9480('0xd')](_0x9480('0x2d'),_0x28d0c8['endUserId']);return _0x3ffcdd(_0x28d0c8);});});})[_0x9480('0x21')](function(_0x52de77){_0x14ffe5(_0x52de77);});});};}function createEndUser(_0xe5c1d6,_0x2139d7,_0xac2817,_0x43a6be){return new Promise(function(_0x1baddc,_0x48ffe9){var _0x537cfb=moment();var _0x268294={'method':_0x9480('0x2e'),'uri':_0x43a6be+_0x9480('0x2f'),'body':{'contact':{'last_name':_0xe5c1d6[_0x9480('0x29')],'work_number':_0xe5c1d6[_0x9480('0x29')],'mobile_number':_0xe5c1d6[_0x9480('0x29')],'owner_id':_0xe5c1d6['userId'],'created_at':_0x537cfb[_0x9480('0x30')](_0x9480('0x31'))}},'json':!![]};_0x268294['headers']=_0xac2817;logger[_0x9480('0xd')](_0x9480('0x32'));return rp(_0x268294)['then'](function(_0x21e86a){_0xe5c1d6[_0x9480('0x2b')]=_0x21e86a[_0x9480('0x33')]['id'];_0x1baddc(_0xe5c1d6);})[_0x9480('0x21')](function(_0x23d440){logger[_0x9480('0x14')]('['+[_0x2139d7[_0x9480('0x15')]()]+']',_0x23d440[_0x9480('0x16')]);_0x48ffe9(_0x23d440['message']);});});}function getTicket(_0x3375cf,_0x18282e,_0x3b0b63,_0x142577,_0x71e856){return function(_0x4c4ef0){logger[_0x9480('0xd')](_0x9480('0x34'));return new Promise(function(_0x195d73,_0x33c7fe){var _0xd7a424=moment();var _0x47f6c0={'method':_0x9480('0x2e'),'uri':_0x3b0b63+_0x9480('0x35'),'body':{'title':intUtil[_0x9480('0x36')](_0x142577[_0x9480('0x37')],_0x71e856,'\x20'),'description':intUtil[_0x9480('0x36')](_0x142577[_0x9480('0x38')],_0x71e856,'\x0a'),'owner_id':_0x4c4ef0[_0x9480('0x1e')],'creater_id':_0x4c4ef0[_0x9480('0x11')],'targetable_id':_0x4c4ef0[_0x9480('0x2b')],'targetable_type':_0x9480('0x39'),'created_at':_0xd7a424[_0x9480('0x30')](_0x9480('0x31')),'due_date':_0xd7a424['add'](0x1e,'m')[_0x9480('0x30')](_0x9480('0x31'))},'json':!![]};_0x47f6c0[_0x9480('0x18')]=_0x18282e;return rp(_0x47f6c0)[_0x9480('0x19')](function(_0x13e00f){_0x4c4ef0[_0x9480('0x3a')]=_0x13e00f[_0x9480('0x3b')]['id'];logger[_0x9480('0xd')](_0x9480('0x3c'),_0x4c4ef0[_0x9480('0x3a')]);_0x195d73(_0x4c4ef0);})[_0x9480('0x21')](function(_0x2e09c6){logger[_0x9480('0x14')]('['+[_0x3375cf['toUpperCase']()]+']',_0x2e09c6['message']);_0x33c7fe(_0x2e09c6['message']);});});};}function emit(_0x270676,_0x277172,_0x48b287){var _0xbb7ce2={'uri':_0x270676+'/contacts/'+_0x48b287};io['to'](util[_0x9480('0x30')](_0x9480('0x3d'),_0x277172))[_0x9480('0x3e')](_0x9480('0x3f'),_0xbb7ce2);}exports['cs']=function(_0x2e990b,_0x42a696,_0x5c8ad6,_0x4d9541,_0x16a664,_0x55c49e,_0xa41a18,_0x321773){var _0x30575d={};var _0x57c33f={'Authorization':'Token\x20token='+_0x55c49e['apiKey']};_0x55c49e[_0x9480('0x40')]=intUtil['stripTrailingSlash'](_0x55c49e[_0x9480('0x40')]);_0x55c49e[_0x9480('0x41')]=intUtil[_0x9480('0x42')](_0x55c49e[_0x9480('0x41')]);var _0x1fc748=_0x55c49e['remoteUri'];_0x30575d['adminEmail']=_0x55c49e['username'];_0x30575d[_0x9480('0x29')]=_0x321773['toLowerCase']()===_0x9480('0x43')?_0x42a696['destcalleridnum']:_0x42a696[_0x9480('0x44')];_0x30575d[_0x9480('0x45')]=_0x321773===_0x9480('0x46')||_0x321773==='unmanaged'?_0x9480('0x46'):'outbound';if(_0x4d9541){_0x30575d[_0x9480('0x1a')]=_0x4d9541['email'];}var _0x2e151a=util[_0x9480('0x30')](_0x9480('0x47'),_0x55c49e[_0x9480('0x41')],_0x42a696[_0x9480('0x48')],md5(_0x42a696[_0x9480('0x48')]));if(_0x16a664&&_0x16a664[_0x9480('0x49')]){logger[_0x9480('0xd')]('[QUEUE]',_0x9480('0x4a'));_0x42a696[_0x9480('0x4b')]=_0x2e151a;}else if(_0xa41a18&&_0xa41a18[_0x9480('0x4c')]&&_0xa41a18[_0x9480('0x4c')]!==_0x9480('0x4d')){logger[_0x9480('0xd')]('[OUTBOUND]',_0x9480('0x4a'));_0x42a696[_0x9480('0x4b')]=_0x2e151a;}else{_0x42a696[_0x9480('0x4b')]='';}return getAdminId(_0x30575d,_0x321773,_0x57c33f,_0x1fc748)[_0x9480('0x19')](getUser(_0x321773,_0x57c33f,_0x1fc748))[_0x9480('0x19')](getEndUser(_0x321773,_0x57c33f,_0x1fc748))[_0x9480('0x19')](getTicket(_0x321773,_0x57c33f,_0x1fc748,_0x5c8ad6,_0x42a696))['then'](function(_0x577066){logger[_0x9480('0xd')](util[_0x9480('0x30')](_0x9480('0x4e'),_0x577066[_0x9480('0x3a')]));if(_0x321773!==_0x9480('0x4f')){logger[_0x9480('0xd')]('['+[_0x321773[_0x9480('0x15')]()]+']',_0x9480('0x50'));emit(_0x1fc748,_0x4d9541[_0x9480('0x51')],_0x577066[_0x9480('0x2b')]);}})[_0x9480('0x21')](function(_0x3c7a6e){logger['error']('['+[_0x321773[_0x9480('0x15')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util['inspect'](_0x3c7a6e,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xb521=['Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','message','Getting\x20user\x20list','then','agentEmail','userEmail','userId','User\x20found:','Admin\x20selected','error','&f=','&entities=contact','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','POST','/api/tasks','getString','Subjects','Descriptions','Contact','task','Task\x20created:','ticketId','/contacts/','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','serverUrl','stripTrailingSlash','username','toLowerCase','calleridnum','callDirection','queue','unmanaged','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','md5','util','bluebird','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','socket.io-emitter','GET','headers','Getting\x20admin\x20information','users','length','email','adminEmail','adminId','info'];(function(_0x3fceca,_0x12a387){var _0x5bb09a=function(_0x5f54b4){while(--_0x5f54b4){_0x3fceca['push'](_0x3fceca['shift']());}};_0x5bb09a(++_0x12a387);}(_0xb521,0x97));var _0x1b52=function(_0x1f30c5,_0x327099){_0x1f30c5=_0x1f30c5-0x0;var _0x5c18ff=_0xb521[_0x1f30c5];return _0x5c18ff;};'use strict';var _=require(_0x1b52('0x0'));var rp=require(_0x1b52('0x1'));var md5=require(_0x1b52('0x2'));var util=require(_0x1b52('0x3'));var moment=require('moment');var Promise=require(_0x1b52('0x4'));var Redis=require('ioredis');var intUtil=require(_0x1b52('0x5'));var config=require(_0x1b52('0x6'));var logger=require(_0x1b52('0x7'))(_0x1b52('0x8'));config[_0x1b52('0x9')]=_[_0x1b52('0xa')](config[_0x1b52('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x1b52('0xb'))(new Redis(config[_0x1b52('0x9')]));function getAdminId(_0x5cf30f,_0x3eacde,_0x467214,_0x20a3e5){return new Promise(function(_0x58f643,_0x26fbee){var _0x2af1fe=![];var _0x39289b={'method':_0x1b52('0xc'),'uri':_0x20a3e5+'/api/selector/owners','json':!![]};_0x39289b[_0x1b52('0xd')]=_0x467214;logger['info'](_0x1b52('0xe'));return rp(_0x39289b)['then'](function(_0xc92364){if(_0xc92364){var _0x4d9d65=_0xc92364[_0x1b52('0xf')];var _0x4c3236=null;for(_0x4c3236=0x0;_0x4c3236<_0x4d9d65[_0x1b52('0x10')];_0x4c3236++){if(_0x4d9d65[_0x4c3236][_0x1b52('0x11')]===_0x5cf30f[_0x1b52('0x12')]){_0x5cf30f[_0x1b52('0x13')]=_0x4d9d65[_0x4c3236]['id'];_0x2af1fe=!![];}}if(_0x2af1fe){logger[_0x1b52('0x14')](_0x1b52('0x15'),_0x5cf30f[_0x1b52('0x13')]);_0x58f643(_0x5cf30f);}else{_0x26fbee({'statusCode':0x194,'message':_0x1b52('0x16')});}}else{_0x26fbee({'statusCode':0x194,'message':_0x1b52('0x16')});}})[_0x1b52('0x17')](function(_0x5e4c5d){logger['error']('['+[_0x3eacde[_0x1b52('0x18')]()]+']',_0x5e4c5d[_0x1b52('0x19')]);_0x26fbee(_0x5e4c5d);});});}function getUser(_0x1a4cf1,_0x41ad97,_0x309c8){return function(_0x23bd71){return new Promise(function(_0x5355d0,_0x61b612){var _0x4cf4ff={'method':'GET','uri':_0x309c8+'/api/selector/owners','json':!![]};_0x4cf4ff[_0x1b52('0xd')]=_0x41ad97;logger[_0x1b52('0x14')](_0x1b52('0x1a'));return rp(_0x4cf4ff)[_0x1b52('0x1b')](function(_0xac649){if(_0xac649){var _0x345612=_0xac649[_0x1b52('0xf')];var _0x5d5c02=![];var _0x566f6f=null;if(_0x23bd71[_0x1b52('0x1c')]!==null){logger[_0x1b52('0x14')]('Getting\x20user\x20with\x20email',_0x23bd71['agentEmail']);_0x23bd71[_0x1b52('0x1d')]=_0x23bd71[_0x1b52('0x1c')];for(_0x566f6f=0x0;_0x566f6f<_0x345612['length'];_0x566f6f++){if(_0x345612[_0x566f6f][_0x1b52('0x11')]===_0x23bd71[_0x1b52('0x1c')]){_0x5d5c02=!![];_0x23bd71[_0x1b52('0x1e')]=_0x345612[_0x566f6f]['id'];logger['info'](_0x1b52('0x1f'),_0x23bd71[_0x1b52('0x1e')]);}}}if(!_0x5d5c02){logger[_0x1b52('0x14')](_0x1b52('0x20'));_0x23bd71['userEmail']=_0x23bd71[_0x1b52('0x12')];_0x23bd71[_0x1b52('0x1e')]=_0x23bd71[_0x1b52('0x13')];_0x5d5c02=!![];}if(_0x5d5c02){_0x5355d0(_0x23bd71);}else{_0x61b612({'statusCode':0x194,'message':_0x1b52('0x16')});}}else{_0x61b612({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x1b52('0x17')](function(_0x2f2314){logger[_0x1b52('0x21')]('['+[_0x1a4cf1[_0x1b52('0x18')]()]+']',_0x2f2314[_0x1b52('0x19')]);_0x61b612(_0x2f2314);});});};}function searchContact(_0x519c0e,_0x4c0d52,_0x4c3ebb,_0x30cfe8){return new Promise(function(_0x3f72cb,_0x49300e){var _0x1493c1={'method':_0x1b52('0xc'),'headers':_0x4c0d52,'uri':_0x519c0e+'/api/lookup?q='+_0x30cfe8+_0x1b52('0x22')+_0x4c3ebb+_0x1b52('0x23'),'json':!![]};rp(_0x1493c1)[_0x1b52('0x1b')](function(_0x46680a){var _0x3a3a6e=_['find'](_0x46680a[_0x1b52('0x24')]['contacts'],[_0x4c3ebb,_0x30cfe8]);_0x3f72cb(_0x3a3a6e);})[_0x1b52('0x17')](function(_0x3b29f9){_0x49300e(_0x3b29f9);});});}function getEndUser(_0x4da8af,_0x72af3f,_0x1b9fba){return function(_0x35e92b){return new Promise(function(_0x4b918e,_0x544b73){logger[_0x1b52('0x14')](util[_0x1b52('0x25')](_0x1b52('0x26'),_0x35e92b[_0x1b52('0x27')]));searchContact(_0x1b9fba,_0x72af3f,_0x1b52('0x28'),_0x35e92b[_0x1b52('0x27')])[_0x1b52('0x1b')](function(_0x54873f){if(_0x54873f){_0x35e92b[_0x1b52('0x29')]=_0x54873f['id'];logger[_0x1b52('0x14')](_0x1b52('0x2a'),_0x35e92b['endUserId']);return _0x4b918e(_0x35e92b);}searchContact(_0x1b9fba,_0x72af3f,_0x1b52('0x2b'),_0x35e92b['contactNumber'])[_0x1b52('0x1b')](function(_0x36502e){if(_0x36502e){_0x35e92b[_0x1b52('0x29')]=_0x36502e['id'];logger[_0x1b52('0x14')](_0x1b52('0x2c'),_0x35e92b[_0x1b52('0x29')]);return _0x4b918e(_0x35e92b);}createEndUser(_0x35e92b,_0x4da8af,_0x72af3f,_0x1b9fba)[_0x1b52('0x1b')](function(_0x55f918){logger['info'](_0x1b52('0x2d'),_0x55f918[_0x1b52('0x29')]);return _0x4b918e(_0x55f918);});});})[_0x1b52('0x17')](function(_0x29569a){_0x544b73(_0x29569a);});});};}function createEndUser(_0x4df20b,_0x5a164c,_0x33bd2b,_0x24a301){return new Promise(function(_0x508214,_0x28ce6c){var _0x2403e7=moment();var _0xa1ea={'method':'POST','uri':_0x24a301+_0x1b52('0x2e'),'body':{'contact':{'last_name':_0x4df20b[_0x1b52('0x27')],'work_number':_0x4df20b[_0x1b52('0x27')],'mobile_number':_0x4df20b[_0x1b52('0x27')],'owner_id':_0x4df20b[_0x1b52('0x1e')],'created_at':_0x2403e7[_0x1b52('0x25')](_0x1b52('0x2f'))}},'json':!![]};_0xa1ea[_0x1b52('0xd')]=_0x33bd2b;logger[_0x1b52('0x14')](_0x1b52('0x30'));return rp(_0xa1ea)[_0x1b52('0x1b')](function(_0x5063d8){_0x4df20b[_0x1b52('0x29')]=_0x5063d8[_0x1b52('0x31')]['id'];_0x508214(_0x4df20b);})[_0x1b52('0x17')](function(_0x2dce5b){logger[_0x1b52('0x21')]('['+[_0x5a164c[_0x1b52('0x18')]()]+']',_0x2dce5b['message']);_0x28ce6c(_0x2dce5b['message']);});});}function getTicket(_0x5ef70c,_0x295d14,_0x3905a3,_0x2283ac,_0x4e7160){return function(_0x55495c){logger[_0x1b52('0x14')](_0x1b52('0x32'));return new Promise(function(_0x295946,_0x53177c){var _0x144c91=moment();var _0x34470a={'method':_0x1b52('0x33'),'uri':_0x3905a3+_0x1b52('0x34'),'body':{'title':intUtil[_0x1b52('0x35')](_0x2283ac[_0x1b52('0x36')],_0x4e7160,'\x20'),'description':intUtil[_0x1b52('0x35')](_0x2283ac[_0x1b52('0x37')],_0x4e7160,'\x0a'),'owner_id':_0x55495c[_0x1b52('0x1e')],'creater_id':_0x55495c[_0x1b52('0x13')],'targetable_id':_0x55495c[_0x1b52('0x29')],'targetable_type':_0x1b52('0x38'),'created_at':_0x144c91[_0x1b52('0x25')](_0x1b52('0x2f')),'due_date':_0x144c91['add'](0x1e,'m')[_0x1b52('0x25')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x34470a[_0x1b52('0xd')]=_0x295d14;return rp(_0x34470a)[_0x1b52('0x1b')](function(_0x544a97){_0x55495c['ticketId']=_0x544a97[_0x1b52('0x39')]['id'];logger['info'](_0x1b52('0x3a'),_0x55495c[_0x1b52('0x3b')]);_0x295946(_0x55495c);})[_0x1b52('0x17')](function(_0x5960c4){logger[_0x1b52('0x21')]('['+[_0x5ef70c[_0x1b52('0x18')]()]+']',_0x5960c4[_0x1b52('0x19')]);_0x53177c(_0x5960c4[_0x1b52('0x19')]);});});};}function emit(_0x532756,_0x5ddf2c,_0x1e2a51){var _0x31bda2={'uri':_0x532756+_0x1b52('0x3c')+_0x1e2a51};io['to'](util[_0x1b52('0x25')]('user:%s',_0x5ddf2c))[_0x1b52('0x3d')](_0x1b52('0x3e'),_0x31bda2);}exports['cs']=function(_0x30e7e8,_0x4c4db3,_0x10a460,_0x40d9f0,_0x5c551c,_0x10b073,_0x43e309,_0x3b249c){var _0x151222={};var _0x142710={'Authorization':_0x1b52('0x3f')+_0x10b073[_0x1b52('0x40')]};_0x10b073[_0x1b52('0x41')]=intUtil['stripTrailingSlash'](_0x10b073[_0x1b52('0x41')]);_0x10b073[_0x1b52('0x42')]=intUtil[_0x1b52('0x43')](_0x10b073[_0x1b52('0x42')]);var _0x2f66e5=_0x10b073[_0x1b52('0x41')];_0x151222[_0x1b52('0x12')]=_0x10b073[_0x1b52('0x44')];_0x151222[_0x1b52('0x27')]=_0x3b249c[_0x1b52('0x45')]()==='outbound'?_0x4c4db3['destcalleridnum']:_0x4c4db3[_0x1b52('0x46')];_0x151222[_0x1b52('0x47')]=_0x3b249c===_0x1b52('0x48')||_0x3b249c===_0x1b52('0x49')?'queue':_0x1b52('0x4a');if(_0x40d9f0){_0x151222['agentEmail']=_0x40d9f0['email'];}var _0x5417ca=util['format'](_0x1b52('0x4b'),_0x10b073[_0x1b52('0x42')],_0x4c4db3['uniqueid'],md5(_0x4c4db3['uniqueid']));if(_0x5c551c&&_0x5c551c[_0x1b52('0x4c')]){logger[_0x1b52('0x14')]('[QUEUE]',_0x1b52('0x4d'));_0x4c4db3[_0x1b52('0x4e')]=_0x5417ca;}else if(_0x43e309&&_0x43e309[_0x1b52('0x4f')]&&_0x43e309[_0x1b52('0x4f')]!==_0x1b52('0x50')){logger[_0x1b52('0x14')](_0x1b52('0x51'),_0x1b52('0x4d'));_0x4c4db3[_0x1b52('0x4e')]=_0x5417ca;}else{_0x4c4db3[_0x1b52('0x4e')]='';}return getAdminId(_0x151222,_0x3b249c,_0x142710,_0x2f66e5)['then'](getUser(_0x3b249c,_0x142710,_0x2f66e5))[_0x1b52('0x1b')](getEndUser(_0x3b249c,_0x142710,_0x2f66e5))[_0x1b52('0x1b')](getTicket(_0x3b249c,_0x142710,_0x2f66e5,_0x10a460,_0x4c4db3))[_0x1b52('0x1b')](function(_0x4d0b74){logger[_0x1b52('0x14')](util[_0x1b52('0x25')](_0x1b52('0x52'),_0x4d0b74['ticketId']));if(_0x3b249c!==_0x1b52('0x49')){logger[_0x1b52('0x14')]('['+[_0x3b249c[_0x1b52('0x18')]()]+']',_0x1b52('0x53'));emit(_0x2f66e5,_0x40d9f0[_0x1b52('0x54')],_0x4d0b74[_0x1b52('0x29')]);}})['catch'](function(_0x4f7ecc){logger[_0x1b52('0x21')]('['+[_0x3b249c[_0x1b52('0x18')]()]+_0x1b52('0x55'),util['inspect'](_0x4f7ecc,{'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 a9f51f6..a82bb24 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 _0xa731=['util','./zendesk','./salesforce','./freshdesk','./desk','./servicenow','./dynamics365','./freshsales','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','servicenow','exec','includes','toLowerCase','data1','data2','find','data3','queue','outbound','log','EVENT\x20UNKNOWN','unmanaged','zendesk','freshsales','dynamics365','../../../../config/logger','error','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','format','%s\x20account\x20#%s\x20not\x20found','lodash'];(function(_0x222fb1,_0x292a6a){var _0xc9a114=function(_0x320592){while(--_0x320592){_0x222fb1['push'](_0x222fb1['shift']());}};_0xc9a114(++_0x292a6a);}(_0xa731,0x1bb));var _0x1a73=function(_0x1b2b86,_0x5032b7){_0x1b2b86=_0x1b2b86-0x0;var _0x2e8a8b=_0xa731[_0x1b2b86];return _0x2e8a8b;};'use strict';var _=require(_0x1a73('0x0'));var util=require(_0x1a73('0x1'));var zendesk=require(_0x1a73('0x2'));var salesforce=require(_0x1a73('0x3'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x1a73('0x4'));var zoho=require('./zoho');var desk=require(_0x1a73('0x5'));var vtiger=require('./vtiger');var servicenow=require(_0x1a73('0x6'));var dynamics365=require(_0x1a73('0x7'));var freshsales=require(_0x1a73('0x8'));var integrations=['zendesk',_0x1a73('0x9'),_0x1a73('0xa'),_0x1a73('0xb'),_0x1a73('0xc'),_0x1a73('0xd'),_0x1a73('0xe'),'dynamics365','freshsales',_0x1a73('0xf')];exports[_0x1a73('0x10')]=function(_0x4d429a,_0x4a5bbc,_0x5ded12,_0xc6e4f4,_0x2f427c,_0x492d68){if(_0x5ded12){if(_[_0x1a73('0x11')](integrations,_0x4d429a['data1'][_0x1a73('0x12')]())){try{var _0x40ccb2=null;var _0x590ed9='';var _0xf5043a=_0x5ded12[_0x4d429a[_0x1a73('0x13')][_0x1a73('0x12')]()];if(_0xf5043a){var _0x4e3335=_0xf5043a[_0x4d429a[_0x1a73('0x14')]];if(_0x4e3335){var _0x1a8891=_[_0x1a73('0x15')](_0x4e3335['Configurations'],{'id':parseInt(_0x4d429a[_0x1a73('0x16')],0xa)});if(_0x1a8891){if(_0xc6e4f4){if(_0x2f427c&&_0x4a5bbc[_0x1a73('0x17')]){_0x590ed9=_0x1a73('0x17');}else if(_0x4a5bbc['routeId']){_0x590ed9=_0x1a73('0x18');}else{console[_0x1a73('0x19')](_0x1a73('0x1a'),_0x4a5bbc);}}else{_0x590ed9=_0x1a73('0x1b');}switch(_0x4d429a[_0x1a73('0x13')][_0x1a73('0x12')]()){case _0x1a73('0x1c'):zendesk[_0x590ed9](_0x4d429a,_0x4a5bbc,_0x1a8891,_0xc6e4f4,_0x2f427c,_0x4e3335,_0x492d68);break;case _0x1a73('0x9'):salesforce[_0x590ed9](_0x4d429a,_0x4a5bbc,_0x1a8891,_0xc6e4f4,_0x2f427c,_0x4e3335,_0x492d68);break;case'sugarcrm':sugarcrm[_0x590ed9](_0x4d429a,_0x4a5bbc,_0x1a8891,_0xc6e4f4,_0x2f427c,_0x4e3335,_0x492d68);break;case'freshdesk':freshdesk[_0x590ed9](_0x4d429a,_0x4a5bbc,_0x1a8891,_0xc6e4f4,_0x2f427c,_0x4e3335,_0x492d68);break;case'zoho':zoho[_0x590ed9](_0x4d429a,_0x4a5bbc,_0x1a8891,_0xc6e4f4,_0x2f427c,_0x4e3335,_0x492d68);break;case _0x1a73('0xd'):desk[_0x590ed9](_0x4d429a,_0x4a5bbc,_0x1a8891,_0xc6e4f4,_0x2f427c,_0x4e3335,_0x492d68);break;case _0x1a73('0xe'):vtiger[_0x590ed9](_0x4d429a,_0x4a5bbc,_0x1a8891,_0xc6e4f4,_0x2f427c,_0x4e3335,_0x492d68);break;case _0x1a73('0x1d'):freshsales['cs'](_0x4d429a,_0x4a5bbc,_0x1a8891,_0xc6e4f4,_0x2f427c,_0x4e3335,_0x492d68,_0x590ed9);break;case'servicenow':servicenow['cs'](_0x4d429a,_0x4a5bbc,_0x1a8891,_0xc6e4f4,_0x2f427c,_0x4e3335,_0x492d68,_0x590ed9);break;case _0x1a73('0x1e'):dynamics365['cs'](_0x4d429a,_0x4a5bbc,_0x1a8891,_0xc6e4f4,_0x2f427c,_0x4e3335,_0x492d68,_0x590ed9);break;default:console[_0x1a73('0x19')]('unknown\x20integration');}}else{_0x40ccb2=require(_0x1a73('0x1f'))(_0x4d429a[_0x1a73('0x13')][_0x1a73('0x12')]());_0x40ccb2[_0x1a73('0x20')](_0x1a73('0x21'),util['format'](_0x1a73('0x22'),_0x4d429a[_0x1a73('0x13')][_0x1a73('0x12')](),_0x4d429a[_0x1a73('0x16')]));}}else{_0x40ccb2=require(_0x1a73('0x1f'))(_0x4d429a[_0x1a73('0x13')]['toLowerCase']());_0x40ccb2[_0x1a73('0x20')](_0x1a73('0x21'),util[_0x1a73('0x23')](_0x1a73('0x24'),_0x4d429a[_0x1a73('0x13')][_0x1a73('0x12')](),_0x4d429a[_0x1a73('0x14')]));}}else{}}catch(_0x1d5009){console[_0x1a73('0x20')](_0x1d5009);}}}}; \ No newline at end of file +var _0xab1b=['unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20account\x20#%s\x20not\x20found','data2','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./freshsales','salesforce','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','find','Configurations','data3','queue','routeId','log','EVENT\x20UNKNOWN','unmanaged','sugarcrm'];(function(_0x5bb2ee,_0x231aa0){var _0x455fa5=function(_0x175b24){while(--_0x175b24){_0x5bb2ee['push'](_0x5bb2ee['shift']());}};_0x455fa5(++_0x231aa0);}(_0xab1b,0x6d));var _0xbab1=function(_0x1e48e8,_0x4b7301){_0x1e48e8=_0x1e48e8-0x0;var _0x13bec2=_0xab1b[_0x1e48e8];return _0x13bec2;};'use strict';var _=require('lodash');var util=require('util');var zendesk=require('./zendesk');var salesforce=require(_0xbab1('0x0'));var sugarcrm=require(_0xbab1('0x1'));var freshdesk=require(_0xbab1('0x2'));var zoho=require(_0xbab1('0x3'));var desk=require(_0xbab1('0x4'));var vtiger=require('./vtiger');var servicenow=require('./servicenow');var dynamics365=require('./dynamics365');var freshsales=require(_0xbab1('0x5'));var integrations=['zendesk',_0xbab1('0x6'),'sugarcrm',_0xbab1('0x7'),_0xbab1('0x8'),_0xbab1('0x9'),_0xbab1('0xa'),_0xbab1('0xb'),_0xbab1('0xc'),_0xbab1('0xd')];exports[_0xbab1('0xe')]=function(_0x60a5c8,_0x56d993,_0x3ed284,_0x3b49b9,_0x43acbf,_0x59bd51){if(_0x3ed284){if(_[_0xbab1('0xf')](integrations,_0x60a5c8[_0xbab1('0x10')][_0xbab1('0x11')]())){try{var _0x3389a9=null;var _0xe35f51='';var _0x57e3bf=_0x3ed284[_0x60a5c8[_0xbab1('0x10')][_0xbab1('0x11')]()];if(_0x57e3bf){var _0x8f2d0a=_0x57e3bf[_0x60a5c8['data2']];if(_0x8f2d0a){var _0x594b02=_[_0xbab1('0x12')](_0x8f2d0a[_0xbab1('0x13')],{'id':parseInt(_0x60a5c8[_0xbab1('0x14')],0xa)});if(_0x594b02){if(_0x3b49b9){if(_0x43acbf&&_0x56d993[_0xbab1('0x15')]){_0xe35f51=_0xbab1('0x15');}else if(_0x56d993[_0xbab1('0x16')]){_0xe35f51='outbound';}else{console[_0xbab1('0x17')](_0xbab1('0x18'),_0x56d993);}}else{_0xe35f51=_0xbab1('0x19');}switch(_0x60a5c8['data1'][_0xbab1('0x11')]()){case'zendesk':zendesk[_0xe35f51](_0x60a5c8,_0x56d993,_0x594b02,_0x3b49b9,_0x43acbf,_0x8f2d0a,_0x59bd51);break;case _0xbab1('0x6'):salesforce[_0xe35f51](_0x60a5c8,_0x56d993,_0x594b02,_0x3b49b9,_0x43acbf,_0x8f2d0a,_0x59bd51);break;case _0xbab1('0x1a'):sugarcrm[_0xe35f51](_0x60a5c8,_0x56d993,_0x594b02,_0x3b49b9,_0x43acbf,_0x8f2d0a,_0x59bd51);break;case _0xbab1('0x7'):freshdesk[_0xe35f51](_0x60a5c8,_0x56d993,_0x594b02,_0x3b49b9,_0x43acbf,_0x8f2d0a,_0x59bd51);break;case _0xbab1('0x8'):zoho[_0xe35f51](_0x60a5c8,_0x56d993,_0x594b02,_0x3b49b9,_0x43acbf,_0x8f2d0a,_0x59bd51);break;case'desk':desk[_0xe35f51](_0x60a5c8,_0x56d993,_0x594b02,_0x3b49b9,_0x43acbf,_0x8f2d0a,_0x59bd51);break;case'vtiger':vtiger[_0xe35f51](_0x60a5c8,_0x56d993,_0x594b02,_0x3b49b9,_0x43acbf,_0x8f2d0a,_0x59bd51);break;case _0xbab1('0xc'):freshsales['cs'](_0x60a5c8,_0x56d993,_0x594b02,_0x3b49b9,_0x43acbf,_0x8f2d0a,_0x59bd51,_0xe35f51);break;case _0xbab1('0xd'):servicenow['cs'](_0x60a5c8,_0x56d993,_0x594b02,_0x3b49b9,_0x43acbf,_0x8f2d0a,_0x59bd51,_0xe35f51);break;case _0xbab1('0xb'):dynamics365['cs'](_0x60a5c8,_0x56d993,_0x594b02,_0x3b49b9,_0x43acbf,_0x8f2d0a,_0x59bd51,_0xe35f51);break;default:console['log'](_0xbab1('0x1b'));}}else{_0x3389a9=require(_0xbab1('0x1c'))(_0x60a5c8['data1'][_0xbab1('0x11')]());_0x3389a9[_0xbab1('0x1d')]('[EXEC]',util['format']('%s\x20configuration\x20#%s\x20not\x20found',_0x60a5c8[_0xbab1('0x10')][_0xbab1('0x11')](),_0x60a5c8[_0xbab1('0x14')]));}}else{_0x3389a9=require(_0xbab1('0x1c'))(_0x60a5c8['data1'][_0xbab1('0x11')]());_0x3389a9['error'](_0xbab1('0x1e'),util[_0xbab1('0x1f')](_0xbab1('0x20'),_0x60a5c8[_0xbab1('0x10')]['toLowerCase'](),_0x60a5c8[_0xbab1('0x21')]));}}else{}}catch(_0x167f75){console[_0xbab1('0x1d')](_0x167f75);}}}}; \ 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 d774b62..85b8886 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 _0x6f2e=['Name','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','forEach','includes','string','picklist','idField','variable','variableName','customVariable','Variable','name','toString','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','catch','outbound','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','lastevent','toUpperCase','calleridname',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','moment','bluebird','jsforce','util','ioredis','./util','../../../../config/logger','salesforce','redis','defaults','localhost','emit','assign','getString','Subjects','Descriptions','ticketType','Task','utc','IsReminderSet','endUserType','contact','WhoId','account','WhatId','Case','AccountId','lead','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','User','find','execute','then','length','Email','Agent\x20%s\x20found.','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','moduleSearch','contact_lead','additionalSearchContact','merge','$or','cloneDeep','additionalSearchLead','Lead','additionalSearchAccount','Account','Contact','first'];(function(_0x23cfdb,_0x2a58ea){var _0x454abe=function(_0x8a181f){while(--_0x8a181f){_0x23cfdb['push'](_0x23cfdb['shift']());}};_0x454abe(++_0x2a58ea);}(_0x6f2e,0x149));var _0xe6f2=function(_0x4b764a,_0x398215){_0x4b764a=_0x4b764a-0x0;var _0xe2ff=_0x6f2e[_0x4b764a];return _0xe2ff;};'use strict';var _=require('lodash');var rp=require('request-promise');var moment=require(_0xe6f2('0x0'));var BPromise=require(_0xe6f2('0x1'));var md5=require('md5');var jsforce=require(_0xe6f2('0x2'));var util=require(_0xe6f2('0x3'));var Redis=require(_0xe6f2('0x4'));var intUtil=require(_0xe6f2('0x5'));var config=require('../../../../config/environment');var logger=require(_0xe6f2('0x6'))(_0xe6f2('0x7'));config[_0xe6f2('0x8')]=_[_0xe6f2('0x9')](config[_0xe6f2('0x8')],{'host':_0xe6f2('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe6f2('0x8')]));function emit(_0x234f95,_0x461cdb,_0x2662d4){io['to'](_0x234f95)[_0xe6f2('0xb')](_0x461cdb,_0x2662d4);}function getTicket(_0x59f11e,_0x10b13c,_0x50d6cf,_0x46597d,_0x2a5c8e,_0x4eddb4,_0x159b32,_0x1b2f80){var _0x184de5=Object[_0xe6f2('0xc')]({},{'OwnerId':_0x10b13c['id'],'Subject':intUtil[_0xe6f2('0xd')](_0x46597d[_0xe6f2('0xe')],_0x2a5c8e,'\x20'),'Description':intUtil['getString'](_0x46597d[_0xe6f2('0xf')],_0x2a5c8e,'\x0a')},getCustomFields(_0x4eddb4,_0x2a5c8e));if(_0x50d6cf){if(_0x46597d[_0xe6f2('0x10')]===_0xe6f2('0x11')){_0x184de5['ActivityDate']=moment[_0xe6f2('0x12')]();_0x184de5[_0xe6f2('0x13')]=![];_0x184de5['IsRecurrence']=![];if(_0x50d6cf[_0xe6f2('0x14')]===_0xe6f2('0x15')||_0x50d6cf[_0xe6f2('0x14')]==='lead'){_0x184de5[_0xe6f2('0x16')]=_0x50d6cf['id'];}else if(_0x50d6cf[_0xe6f2('0x14')]===_0xe6f2('0x17')){_0x184de5[_0xe6f2('0x18')]=_0x50d6cf['id'];}}else if(_0x46597d[_0xe6f2('0x10')]===_0xe6f2('0x19')){if(_0x50d6cf[_0xe6f2('0x14')]===_0xe6f2('0x15')){_0x184de5['ContactId']=_0x50d6cf['id'];}else if(_0x50d6cf[_0xe6f2('0x14')]===_0xe6f2('0x17')){_0x184de5[_0xe6f2('0x1a')]=_0x50d6cf['id'];}else if(_0x50d6cf[_0xe6f2('0x14')]===_0xe6f2('0x1b')&&_0x46597d[_0xe6f2('0x1c')]){_0x184de5[_0x46597d[_0xe6f2('0x1c')]]=_0x50d6cf['id'];}else{logger[_0xe6f2('0x1d')](_0xe6f2('0x1e'));}}}return _0x159b32[_0xe6f2('0x1f')](_0x46597d[_0xe6f2('0x10')])[_0xe6f2('0x20')](_0x184de5);}function getUser(_0x2a28fd,_0x594c3e,_0x2d0a0c){if(!_[_0xe6f2('0x21')](_0x594c3e)&&intUtil['validateEmail'](_0x594c3e)){var _0x5068f5={'Email':_0x594c3e};var _0x1fac1b={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x2d0a0c['sobject'](_0xe6f2('0x22'))[_0xe6f2('0x23')](_0x5068f5,_0x1fac1b)[_0xe6f2('0x24')]()[_0xe6f2('0x25')](function(_0x4b0364){if(_0x4b0364[_0xe6f2('0x26')]){var _0x34a5d9=_[_0xe6f2('0x23')](_0x4b0364,function(_0x590e6e){return _0x590e6e[_0xe6f2('0x27')]===_0x594c3e;});if(_0x34a5d9){logger[_0xe6f2('0x1d')](_0xe6f2('0x28'),_0x594c3e);return BPromise[_0xe6f2('0x29')]({'id':_0x34a5d9['Id'],'name':_0x34a5d9['Name']});}}else{logger[_0xe6f2('0x1d')](_0xe6f2('0x2a'),_0x594c3e);return _0x2d0a0c[_0xe6f2('0x2b')]()[_0xe6f2('0x25')](function(_0x125f54){return BPromise[_0xe6f2('0x29')]({'id':_0x125f54[_0xe6f2('0x2c')],'name':_0x125f54[_0xe6f2('0x2d')]});});}});}else{logger[_0xe6f2('0x1d')](_0xe6f2('0x2a'),_0x594c3e);return _0x2d0a0c['identity']()['then'](function(_0x463fd4){return BPromise[_0xe6f2('0x29')]({'id':_0x463fd4[_0xe6f2('0x2c')],'name':_0x463fd4[_0xe6f2('0x2d')]});});}}function getEndUser(_0xa9235b,_0x12f44c,_0x1d3320,_0x50d2eb,_0x113e22){var _0x4cc8aa={'$or':{'Phone':_0x50d2eb}};var _0x447ecb={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xe6f2('0x29')]()[_0xe6f2('0x25')](function(){logger[_0xe6f2('0x1d')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x50d2eb,_0x12f44c[_0xe6f2('0x2e')]);switch(_0x12f44c['moduleSearch']){case _0xe6f2('0x2f'):var _0x262d5a=_['cloneDeep'](_0x4cc8aa);if(_0x12f44c[_0xe6f2('0x30')]){var _0xe90ab6={};_0xe90ab6[_0x12f44c[_0xe6f2('0x30')]]=_0x50d2eb;_[_0xe6f2('0x31')](_0x262d5a[_0xe6f2('0x32')],_0xe90ab6);}return _0x113e22['sobject']('Contact')[_0xe6f2('0x23')](_0x262d5a,_0x447ecb)[_0xe6f2('0x24')]()[_0xe6f2('0x25')](function(_0x557796){if(_0x557796&&_0x557796[_0xe6f2('0x26')]){return _0x557796;}else{var _0x22a25e=_[_0xe6f2('0x33')](_0x4cc8aa);if(_0x12f44c[_0xe6f2('0x34')]){var _0x53c306={};_0x53c306[_0x12f44c[_0xe6f2('0x34')]]=_0x50d2eb;_['merge'](_0x22a25e[_0xe6f2('0x32')],_0x53c306);}return _0x113e22[_0xe6f2('0x1f')](_0xe6f2('0x35'))[_0xe6f2('0x23')](_0x22a25e,_0x447ecb);}});case'account_contact_lead':var _0x1083c2=_[_0xe6f2('0x33')](_0x4cc8aa);if(_0x12f44c[_0xe6f2('0x36')]){var _0xe90ab6={};_0xe90ab6[_0x12f44c['additionalSearchAccount']]=_0x50d2eb;_[_0xe6f2('0x31')](_0x1083c2[_0xe6f2('0x32')],_0xe90ab6);}return _0x113e22[_0xe6f2('0x1f')](_0xe6f2('0x37'))[_0xe6f2('0x23')](_0x1083c2,_0x447ecb)[_0xe6f2('0x24')]()[_0xe6f2('0x25')](function(_0x2a378d){if(_0x2a378d&&_0x2a378d[_0xe6f2('0x26')]){return _0x2a378d;}else{var _0x520532=_[_0xe6f2('0x33')](_0x4cc8aa);if(_0x12f44c[_0xe6f2('0x30')]){var _0xd4159c={};_0xd4159c[_0x12f44c['additionalSearchContact']]=_0x50d2eb;_[_0xe6f2('0x31')](_0x520532[_0xe6f2('0x32')],_0xd4159c);}return _0x113e22[_0xe6f2('0x1f')](_0xe6f2('0x38'))[_0xe6f2('0x23')](_0x520532,_0x447ecb)[_0xe6f2('0x25')](function(_0x5c51c5){if(_0x5c51c5&&_0x5c51c5[_0xe6f2('0x26')]){return _0x5c51c5;}else{var _0x34d0f7=_[_0xe6f2('0x33')](_0x4cc8aa);if(_0x12f44c[_0xe6f2('0x34')]){var _0x15097c={};_0x15097c[_0x12f44c['additionalSearchLead']]=_0x50d2eb;_[_0xe6f2('0x31')](_0x34d0f7[_0xe6f2('0x32')],_0x15097c);}return _0x113e22[_0xe6f2('0x1f')](_0xe6f2('0x35'))[_0xe6f2('0x23')](_0x34d0f7,_0x447ecb);}});}});case'contact':var _0x262d5a=_[_0xe6f2('0x33')](_0x4cc8aa);if(_0x12f44c[_0xe6f2('0x30')]){var _0xe90ab6={};_0xe90ab6[_0x12f44c[_0xe6f2('0x30')]]=_0x50d2eb;_[_0xe6f2('0x31')](_0x262d5a[_0xe6f2('0x32')],_0xe90ab6);}return _0x113e22['sobject'](_0xe6f2('0x38'))[_0xe6f2('0x23')](_0x262d5a,_0x447ecb)[_0xe6f2('0x24')]();case _0xe6f2('0x1b'):var _0x42bc33=_[_0xe6f2('0x33')](_0x4cc8aa);if(_0x12f44c[_0xe6f2('0x34')]){var _0xe90ab6={};_0xe90ab6[_0x12f44c[_0xe6f2('0x34')]]=_0x50d2eb;_[_0xe6f2('0x31')](_0x42bc33['$or'],_0xe90ab6);}return _0x113e22[_0xe6f2('0x1f')]('Lead')[_0xe6f2('0x23')](_0x42bc33,_0x447ecb);case _0xe6f2('0x17'):var _0x1083c2=_[_0xe6f2('0x33')](_0x4cc8aa);if(_0x12f44c[_0xe6f2('0x36')]){var _0xe90ab6={};_0xe90ab6[_0x12f44c[_0xe6f2('0x36')]]=_0x50d2eb;_[_0xe6f2('0x31')](_0x1083c2[_0xe6f2('0x32')],_0xe90ab6);}return _0x113e22['sobject'](_0xe6f2('0x37'))[_0xe6f2('0x23')](_0x1083c2,_0x447ecb);default:return null;}})[_0xe6f2('0x25')](function(_0x1e49fa){if(_0x1e49fa&&_0x1e49fa['length']){var _0x5228ec=_[_0xe6f2('0x39')](_0x1e49fa);if(_0x5228ec){return BPromise[_0xe6f2('0x29')]({'id':_0x5228ec['Id'],'name':_0x5228ec[_0xe6f2('0x3a')],'phone':_0x5228ec[_0xe6f2('0x3b')],'endUserType':_0x5228ec[_0xe6f2('0x3c')][_0xe6f2('0x3d')][_0xe6f2('0x3e')]()});}}})[_0xe6f2('0x25')](function(_0x28ef2b){if(_0x28ef2b){logger[_0xe6f2('0x1d')](_0xe6f2('0x3f'),_0x28ef2b['endUserType'],_0x50d2eb);return BPromise['resolve'](_0x28ef2b);}else{logger['info'](_0xe6f2('0x40'),_0x50d2eb);var _0x520e0d={'Phone':_0x50d2eb};if(_0x12f44c['moduleCreate']){if(_0x12f44c[_0xe6f2('0x41')]===_0xe6f2('0x15')){logger[_0xe6f2('0x1d')](_0xe6f2('0x42'),_0x50d2eb,_0x12f44c[_0xe6f2('0x41')]);_0x520e0d[_0xe6f2('0x43')]=_0x1d3320!==_0xe6f2('0x44')?_0x1d3320:util[_0xe6f2('0x45')](_0xe6f2('0x46'),_0x50d2eb);}else if(_0x12f44c['moduleCreate']==='lead'){logger['info'](_0xe6f2('0x42'),_0x50d2eb,_0x12f44c['moduleCreate']);_0x520e0d['LastName']=_0x1d3320!==''?_0x1d3320:util['format'](_0xe6f2('0x46'),_0x50d2eb);_0x520e0d[_0xe6f2('0x47')]=_0xe6f2('0x48');}else if(_0x12f44c[_0xe6f2('0x41')]===_0xe6f2('0x17')){logger[_0xe6f2('0x1d')](_0xe6f2('0x42'),_0x50d2eb,_0x12f44c[_0xe6f2('0x41')]);_0x520e0d[_0xe6f2('0x3a')]=_0x1d3320!==_0xe6f2('0x44')?_0x1d3320:util[_0xe6f2('0x45')](_0xe6f2('0x46'),_0x50d2eb);}else{return null;}}return _0x113e22[_0xe6f2('0x1f')](_[_0xe6f2('0x49')](_0x12f44c[_0xe6f2('0x41')]))[_0xe6f2('0x20')](_0x520e0d)[_0xe6f2('0x25')](function(_0x420a2d){return BPromise[_0xe6f2('0x29')]({'id':_0x420a2d['id'],'endUserType':_0x12f44c[_0xe6f2('0x41')]});});}});}function getCustomFields(_0x688b01,_0x3bf4ac){var _0x7224df={};if(_0x688b01[_0xe6f2('0x26')]>0x0){_[_0xe6f2('0x4a')](_0x688b01,function(_0x99bd97){if(_[_0xe6f2('0x4b')]([_0xe6f2('0x4c'),_0xe6f2('0x4d')],_0x99bd97[_0xe6f2('0x3d')])&&_0x99bd97[_0xe6f2('0x4e')]){_0x7224df[_0x99bd97['idField']]=_0x99bd97['content']['toString']();}else if(_0x99bd97['type']===_0xe6f2('0x4f')&&_0x99bd97[_0xe6f2('0x50')]&&_0x99bd97[_0xe6f2('0x4e')]){_0x3bf4ac[_0x99bd97[_0xe6f2('0x50')]]&&(_0x7224df[_0x99bd97[_0xe6f2('0x4e')]]=_0x3bf4ac[_0x99bd97[_0xe6f2('0x50')]]['toString']());}else if(_0x99bd97['type']===_0xe6f2('0x51')&&_0x99bd97[_0xe6f2('0x52')]&&_0x99bd97[_0xe6f2('0x52')][_0xe6f2('0x53')]&&_0x99bd97[_0xe6f2('0x4e')]){_0x3bf4ac[_0x99bd97[_0xe6f2('0x52')]['name'][_0xe6f2('0x3e')]()]&&(_0x7224df[_0x99bd97['idField']]=_0x3bf4ac[_0x99bd97[_0xe6f2('0x52')][_0xe6f2('0x53')][_0xe6f2('0x3e')]()][_0xe6f2('0x54')]());}});}return _0x7224df;}function getConnection(_0x5a643c){var _0x39cafa=_0x5a643c['password']['concat'](_0x5a643c[_0xe6f2('0x55')]);var _0x366f90=new jsforce[(_0xe6f2('0x56'))]({'oauth2':{'loginUrl':_0x5a643c[_0xe6f2('0x57')]||_0xe6f2('0x58'),'clientId':_0x5a643c[_0xe6f2('0x59')],'clientSecret':_0x5a643c[_0xe6f2('0x5a')]}});return _0x366f90['login'](_0x5a643c[_0xe6f2('0x5b')],_0x39cafa)['then'](function(){logger[_0xe6f2('0x1d')](_0xe6f2('0x5c'));return _0x366f90;});}exports[_0xe6f2('0x5d')]=function(_0x5f1600,_0x2dcc89,_0x584235,_0x275e6a,_0x76513b,_0x21faf4){var _0x3be2b8,_0x186b45,_0x5c7443,_0x2a14da;_0x21faf4[_0xe6f2('0x5e')]=intUtil[_0xe6f2('0x5f')](_0x21faf4['serverUrl']);_0x21faf4[_0xe6f2('0x57')]=intUtil[_0xe6f2('0x5f')](_0x21faf4[_0xe6f2('0x57')]);if(_0x76513b&&_0x76513b['monitor_format']){logger[_0xe6f2('0x1d')](_0xe6f2('0x60'),_0xe6f2('0x61'));_0x2dcc89[_0xe6f2('0x62')]=util[_0xe6f2('0x45')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x21faf4[_0xe6f2('0x5e')],_0x2dcc89[_0xe6f2('0x63')],md5(_0x2dcc89[_0xe6f2('0x63')]));}else{_0x2dcc89['recordingURL']='';}return getConnection(_0x21faf4)['then'](function(_0x354ade){_0x2a14da=_0x354ade;return getUser(_0x21faf4,_0x275e6a[_0xe6f2('0x64')],_0x2a14da);})[_0xe6f2('0x25')](function(_0x8bc990){_0x3be2b8=_0x8bc990;return getEndUser(_0x21faf4,_0x584235,_0x2dcc89['calleridname'],_0x2dcc89[_0xe6f2('0x65')],_0x2a14da);})[_0xe6f2('0x25')](function(_0x4d97c4){_0x186b45=_0x4d97c4;return getTicket(_0x21faf4,_0x3be2b8,_0x186b45,_0x584235,_0x2dcc89,_0x584235[_0xe6f2('0x66')],_0x2a14da,_0xe6f2('0x5d'));})[_0xe6f2('0x25')](function(_0x178692){_0x5c7443=_0x178692;logger[_0xe6f2('0x1d')](_0xe6f2('0x67'),_0x5c7443['id']);logger[_0xe6f2('0x1d')](_0xe6f2('0x68'),_0x5c7443['id'],_0x275e6a[_0xe6f2('0x53')],_0x21faf4['type']);switch(_0x21faf4[_0xe6f2('0x3d')]){case _0xe6f2('0x69'):emit(util['format'](_0xe6f2('0x6a'),_0x275e6a[_0xe6f2('0x53')]),'trigger:salesforce:display',{'recordId':_0x5c7443['id']});break;case _0xe6f2('0x6b'):emit(util[_0xe6f2('0x45')](_0xe6f2('0x6a'),_0x275e6a[_0xe6f2('0x53')]),_0xe6f2('0x6c'),{'uri':util[_0xe6f2('0x45')](_0xe6f2('0x6d'),_0x2a14da[_0xe6f2('0x6e')],_0x5c7443['id'])});break;default:logger[_0xe6f2('0x6f')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0xe6f2('0x70')](function(_0x2a7ce9){logger[_0xe6f2('0x6f')]('[QUEUE]',_0x2a7ce9);});};exports[_0xe6f2('0x71')]=function(_0x11d7e7,_0x42e4c7,_0x2b1256,_0x27946c,_0x1c0c31,_0x3855e5,_0x25e3c7){var _0x5702c2,_0x44fbac,_0x3dfd34,_0x38216a;_0x3855e5[_0xe6f2('0x5e')]=intUtil[_0xe6f2('0x5f')](_0x3855e5['serverUrl']);_0x3855e5[_0xe6f2('0x57')]=intUtil[_0xe6f2('0x5f')](_0x3855e5[_0xe6f2('0x57')]);if(_0x25e3c7&&_0x25e3c7[_0xe6f2('0x72')]&&_0x25e3c7[_0xe6f2('0x72')]!==_0xe6f2('0x73')){logger[_0xe6f2('0x1d')]('[OUTBOUND]',_0xe6f2('0x61'));_0x42e4c7[_0xe6f2('0x62')]=util[_0xe6f2('0x45')](_0xe6f2('0x74'),_0x3855e5[_0xe6f2('0x5e')],_0x42e4c7[_0xe6f2('0x63')],md5(_0x42e4c7[_0xe6f2('0x63')]));}return getConnection(_0x3855e5)[_0xe6f2('0x25')](function(_0xf4d37f){_0x38216a=_0xf4d37f;return getUser(_0x3855e5,_0x27946c[_0xe6f2('0x64')],_0x38216a);})[_0xe6f2('0x25')](function(_0x13a8dd){_0x5702c2=_0x13a8dd;return getEndUser(_0x3855e5,_0x2b1256,_0x42e4c7[_0xe6f2('0x75')],_0x42e4c7[_0xe6f2('0x76')],_0x38216a);})[_0xe6f2('0x25')](function(_0x527989){_0x44fbac=_0x527989;return getTicket(_0x3855e5,_0x5702c2,_0x44fbac,_0x2b1256,_0x42e4c7,_0x2b1256[_0xe6f2('0x66')],_0x38216a,'outbound');})[_0xe6f2('0x25')](function(_0x546b13){_0x3dfd34=_0x546b13;logger['info'](_0xe6f2('0x77'),_0x3dfd34['id']);logger[_0xe6f2('0x1d')](_0xe6f2('0x78'),_0x3dfd34['id'],_0x27946c[_0xe6f2('0x53')],_0x3855e5[_0xe6f2('0x3d')]);switch(_0x3855e5[_0xe6f2('0x3d')]){case _0xe6f2('0x69'):emit(util[_0xe6f2('0x45')](_0xe6f2('0x6a'),_0x27946c[_0xe6f2('0x53')]),_0xe6f2('0x79'),{'recordId':_0x3dfd34['id']});break;case _0xe6f2('0x6b'):emit(util[_0xe6f2('0x45')]('user:%s',_0x27946c[_0xe6f2('0x53')]),_0xe6f2('0x6c'),{'uri':util['format'](_0xe6f2('0x6d'),_0x38216a['instanceUrl'],_0x3dfd34['id'])});break;default:logger['error'](_0xe6f2('0x7a'),_0xe6f2('0x7b'));}})[_0xe6f2('0x70')](function(_0x44badf){logger[_0xe6f2('0x6f')](_0xe6f2('0x7a'),_0x44badf);});};exports['unmanaged']=function(_0x587b4c,_0x366d50,_0x5ee759,_0x1f60d2,_0x56d6b6,_0x585400){var _0x2a6084,_0x51f18d,_0x38493c,_0x5601ce;_0x585400[_0xe6f2('0x5e')]=intUtil[_0xe6f2('0x5f')](_0x585400[_0xe6f2('0x5e')]);_0x585400[_0xe6f2('0x57')]=intUtil[_0xe6f2('0x5f')](_0x585400[_0xe6f2('0x57')]);if(_0x56d6b6&&_0x56d6b6['monitor_format']){logger[_0xe6f2('0x1d')]('['+_0x366d50[_0xe6f2('0x7c')][_0xe6f2('0x7d')]()+']',_0xe6f2('0x61'));_0x366d50['recordingURL']=util['format'](_0xe6f2('0x74'),_0x585400[_0xe6f2('0x5e')],_0x366d50[_0xe6f2('0x63')],md5(_0x366d50['uniqueid']));}else{_0x366d50['recordingURL']='';}return getConnection(_0x585400)['then'](function(_0x4f90a0){_0x5601ce=_0x4f90a0;if(!_[_0xe6f2('0x21')](_0x1f60d2)){return getUser(_0x585400,_0x1f60d2['name'],_0x5601ce);}else{return getUser(_0x585400,null,_0x5601ce);}})[_0xe6f2('0x25')](function(_0x16e445){_0x2a6084=_0x16e445;return getEndUser(_0x585400,_0x5ee759,_0x366d50[_0xe6f2('0x7e')],_0x366d50[_0xe6f2('0x65')],_0x5601ce);})[_0xe6f2('0x25')](function(_0x482eaa){_0x51f18d=_0x482eaa;return getTicket(_0x585400,_0x2a6084,_0x51f18d,_0x5ee759,_0x366d50,_0x5ee759[_0xe6f2('0x66')],_0x5601ce);})[_0xe6f2('0x25')](function(_0x511571){_0x38493c=_0x511571;logger['info']('['+_0x366d50[_0xe6f2('0x7c')]['toUpperCase']()+_0xe6f2('0x7f'),_0x38493c['id']);logger[_0xe6f2('0x1d')]('['+_0x366d50[_0xe6f2('0x7c')][_0xe6f2('0x7d')]()+_0xe6f2('0x80'),_0x585400[_0xe6f2('0x3d')]);})[_0xe6f2('0x70')](function(_0x2e6750){logger[_0xe6f2('0x6f')]('['+_0x366d50[_0xe6f2('0x7c')]['toUpperCase']()+']',_0x2e6750);});}; \ No newline at end of file +var _0xd29f=['Email','resolve','Name','identity','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','additionalSearchContact','merge','$or','Contact','cloneDeep','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','length','execute','Account','first','Phone','attributes','type','toLowerCase','moduleCreate','LastName','format','Caller\x20-\x20%s','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','','Company','No\x20Company','upperFirst','forEach','includes','string','picklist','idField','content','toString','variableName','customVariable','Variable','name','concat','securityToken','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','newTab','user:%s','%s/%s/e','instanceUrl','error','catch','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','moment','bluebird','md5','ioredis','./util','../../../../config/environment','salesforce','redis','localhost','socket.io-emitter','emit','getString','Subjects','ticketType','Task','utc','IsReminderSet','IsRecurrence','endUserType','contact','account','WhatId','Case','ContactId','AccountId','lead','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','User','then','find'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xd29f,0x15c));var _0xfd29=function(_0x4cbdb7,_0x1b82f6){_0x4cbdb7=_0x4cbdb7-0x0;var _0x4ecb18=_0xd29f[_0x4cbdb7];return _0x4ecb18;};'use strict';var _=require(_0xfd29('0x0'));var rp=require('request-promise');var moment=require(_0xfd29('0x1'));var BPromise=require(_0xfd29('0x2'));var md5=require(_0xfd29('0x3'));var jsforce=require('jsforce');var util=require('util');var Redis=require(_0xfd29('0x4'));var intUtil=require(_0xfd29('0x5'));var config=require(_0xfd29('0x6'));var logger=require('../../../../config/logger')(_0xfd29('0x7'));config[_0xfd29('0x8')]=_['defaults'](config[_0xfd29('0x8')],{'host':_0xfd29('0x9'),'port':0x18eb});var io=require(_0xfd29('0xa'))(new Redis(config[_0xfd29('0x8')]));function emit(_0x9af59a,_0x2af1df,_0x5db793){io['to'](_0x9af59a)[_0xfd29('0xb')](_0x2af1df,_0x5db793);}function getTicket(_0x59136d,_0x38c4ae,_0x52438a,_0x1f1dfb,_0x1e78aa,_0x4d1b27,_0x178a8c,_0x51e5b1){var _0x2bccd5=Object['assign']({},{'OwnerId':_0x38c4ae['id'],'Subject':intUtil[_0xfd29('0xc')](_0x1f1dfb[_0xfd29('0xd')],_0x1e78aa,'\x20'),'Description':intUtil['getString'](_0x1f1dfb['Descriptions'],_0x1e78aa,'\x0a')},getCustomFields(_0x4d1b27,_0x1e78aa));if(_0x52438a){if(_0x1f1dfb[_0xfd29('0xe')]===_0xfd29('0xf')){_0x2bccd5['ActivityDate']=moment[_0xfd29('0x10')]();_0x2bccd5[_0xfd29('0x11')]=![];_0x2bccd5[_0xfd29('0x12')]=![];if(_0x52438a[_0xfd29('0x13')]===_0xfd29('0x14')||_0x52438a[_0xfd29('0x13')]==='lead'){_0x2bccd5['WhoId']=_0x52438a['id'];}else if(_0x52438a[_0xfd29('0x13')]===_0xfd29('0x15')){_0x2bccd5[_0xfd29('0x16')]=_0x52438a['id'];}}else if(_0x1f1dfb['ticketType']===_0xfd29('0x17')){if(_0x52438a['endUserType']===_0xfd29('0x14')){_0x2bccd5[_0xfd29('0x18')]=_0x52438a['id'];}else if(_0x52438a['endUserType']==='account'){_0x2bccd5[_0xfd29('0x19')]=_0x52438a['id'];}else if(_0x52438a['endUserType']===_0xfd29('0x1a')&&_0x1f1dfb[_0xfd29('0x1b')]){_0x2bccd5[_0x1f1dfb[_0xfd29('0x1b')]]=_0x52438a['id'];}else{logger[_0xfd29('0x1c')](_0xfd29('0x1d'));}}}return _0x178a8c[_0xfd29('0x1e')](_0x1f1dfb['ticketType'])[_0xfd29('0x1f')](_0x2bccd5);}function getUser(_0x1e13e6,_0x1b426c,_0x4d64e7){if(!_[_0xfd29('0x20')](_0x1b426c)&&intUtil['validateEmail'](_0x1b426c)){var _0xb034ac={'Email':_0x1b426c};var _0x338b9d={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x4d64e7['sobject'](_0xfd29('0x21'))['find'](_0xb034ac,_0x338b9d)['execute']()[_0xfd29('0x22')](function(_0x384547){if(_0x384547['length']){var _0x4f1fcf=_[_0xfd29('0x23')](_0x384547,function(_0x49cd71){return _0x49cd71[_0xfd29('0x24')]===_0x1b426c;});if(_0x4f1fcf){logger[_0xfd29('0x1c')]('Agent\x20%s\x20found.',_0x1b426c);return BPromise[_0xfd29('0x25')]({'id':_0x4f1fcf['Id'],'name':_0x4f1fcf[_0xfd29('0x26')]});}}else{logger[_0xfd29('0x1c')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x1b426c);return _0x4d64e7[_0xfd29('0x27')]()[_0xfd29('0x22')](function(_0x5566de){return BPromise[_0xfd29('0x25')]({'id':_0x5566de[_0xfd29('0x28')],'name':_0x5566de[_0xfd29('0x29')]});});}});}else{logger[_0xfd29('0x1c')](_0xfd29('0x2a'),_0x1b426c);return _0x4d64e7[_0xfd29('0x27')]()[_0xfd29('0x22')](function(_0x53d0b8){return BPromise[_0xfd29('0x25')]({'id':_0x53d0b8['user_id'],'name':_0x53d0b8['display_name']});});}}function getEndUser(_0x39cd78,_0x2cbcf2,_0x2a0c06,_0x11fa6b,_0x4c13a2){var _0x5dcdb8={'$or':{'Phone':_0x11fa6b}};var _0x32f731={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xfd29('0x25')]()[_0xfd29('0x22')](function(){logger[_0xfd29('0x1c')](_0xfd29('0x2b'),_0x11fa6b,_0x2cbcf2[_0xfd29('0x2c')]);switch(_0x2cbcf2[_0xfd29('0x2c')]){case _0xfd29('0x2d'):var _0x2acc43=_['cloneDeep'](_0x5dcdb8);if(_0x2cbcf2[_0xfd29('0x2e')]){var _0x4229d1={};_0x4229d1[_0x2cbcf2[_0xfd29('0x2e')]]=_0x11fa6b;_[_0xfd29('0x2f')](_0x2acc43[_0xfd29('0x30')],_0x4229d1);}return _0x4c13a2['sobject'](_0xfd29('0x31'))['find'](_0x2acc43,_0x32f731)['execute']()[_0xfd29('0x22')](function(_0x1714e7){if(_0x1714e7&&_0x1714e7['length']){return _0x1714e7;}else{var _0x1ef227=_[_0xfd29('0x32')](_0x5dcdb8);if(_0x2cbcf2['additionalSearchLead']){var _0x572ed2={};_0x572ed2[_0x2cbcf2[_0xfd29('0x33')]]=_0x11fa6b;_['merge'](_0x1ef227[_0xfd29('0x30')],_0x572ed2);}return _0x4c13a2['sobject'](_0xfd29('0x34'))['find'](_0x1ef227,_0x32f731);}});case _0xfd29('0x35'):var _0x15bd44=_['cloneDeep'](_0x5dcdb8);if(_0x2cbcf2[_0xfd29('0x36')]){var _0x4229d1={};_0x4229d1[_0x2cbcf2[_0xfd29('0x36')]]=_0x11fa6b;_[_0xfd29('0x2f')](_0x15bd44[_0xfd29('0x30')],_0x4229d1);}return _0x4c13a2[_0xfd29('0x1e')]('Account')[_0xfd29('0x23')](_0x15bd44,_0x32f731)['execute']()['then'](function(_0x5f5520){if(_0x5f5520&&_0x5f5520[_0xfd29('0x37')]){return _0x5f5520;}else{var _0x5d6d63=_[_0xfd29('0x32')](_0x5dcdb8);if(_0x2cbcf2[_0xfd29('0x2e')]){var _0x437566={};_0x437566[_0x2cbcf2[_0xfd29('0x2e')]]=_0x11fa6b;_[_0xfd29('0x2f')](_0x5d6d63['$or'],_0x437566);}return _0x4c13a2[_0xfd29('0x1e')](_0xfd29('0x31'))[_0xfd29('0x23')](_0x5d6d63,_0x32f731)['then'](function(_0x215da1){if(_0x215da1&&_0x215da1[_0xfd29('0x37')]){return _0x215da1;}else{var _0x4222f2=_[_0xfd29('0x32')](_0x5dcdb8);if(_0x2cbcf2[_0xfd29('0x33')]){var _0x5a4be4={};_0x5a4be4[_0x2cbcf2['additionalSearchLead']]=_0x11fa6b;_[_0xfd29('0x2f')](_0x4222f2[_0xfd29('0x30')],_0x5a4be4);}return _0x4c13a2[_0xfd29('0x1e')]('Lead')['find'](_0x4222f2,_0x32f731);}});}});case _0xfd29('0x14'):var _0x2acc43=_['cloneDeep'](_0x5dcdb8);if(_0x2cbcf2[_0xfd29('0x2e')]){var _0x4229d1={};_0x4229d1[_0x2cbcf2['additionalSearchContact']]=_0x11fa6b;_[_0xfd29('0x2f')](_0x2acc43['$or'],_0x4229d1);}return _0x4c13a2[_0xfd29('0x1e')](_0xfd29('0x31'))[_0xfd29('0x23')](_0x2acc43,_0x32f731)[_0xfd29('0x38')]();case'lead':var _0x2165e7=_[_0xfd29('0x32')](_0x5dcdb8);if(_0x2cbcf2['additionalSearchLead']){var _0x4229d1={};_0x4229d1[_0x2cbcf2[_0xfd29('0x33')]]=_0x11fa6b;_[_0xfd29('0x2f')](_0x2165e7[_0xfd29('0x30')],_0x4229d1);}return _0x4c13a2[_0xfd29('0x1e')](_0xfd29('0x34'))[_0xfd29('0x23')](_0x2165e7,_0x32f731);case'account':var _0x15bd44=_[_0xfd29('0x32')](_0x5dcdb8);if(_0x2cbcf2['additionalSearchAccount']){var _0x4229d1={};_0x4229d1[_0x2cbcf2[_0xfd29('0x36')]]=_0x11fa6b;_[_0xfd29('0x2f')](_0x15bd44[_0xfd29('0x30')],_0x4229d1);}return _0x4c13a2[_0xfd29('0x1e')](_0xfd29('0x39'))[_0xfd29('0x23')](_0x15bd44,_0x32f731);default:return null;}})[_0xfd29('0x22')](function(_0x4df45a){if(_0x4df45a&&_0x4df45a[_0xfd29('0x37')]){var _0x132fac=_[_0xfd29('0x3a')](_0x4df45a);if(_0x132fac){return BPromise[_0xfd29('0x25')]({'id':_0x132fac['Id'],'name':_0x132fac[_0xfd29('0x26')],'phone':_0x132fac[_0xfd29('0x3b')],'endUserType':_0x132fac[_0xfd29('0x3c')][_0xfd29('0x3d')][_0xfd29('0x3e')]()});}}})[_0xfd29('0x22')](function(_0x5ac591){if(_0x5ac591){logger[_0xfd29('0x1c')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x5ac591[_0xfd29('0x13')],_0x11fa6b);return BPromise[_0xfd29('0x25')](_0x5ac591);}else{logger[_0xfd29('0x1c')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x11fa6b);var _0x4af926={'Phone':_0x11fa6b};if(_0x2cbcf2[_0xfd29('0x3f')]){if(_0x2cbcf2[_0xfd29('0x3f')]===_0xfd29('0x14')){logger[_0xfd29('0x1c')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x11fa6b,_0x2cbcf2['moduleCreate']);_0x4af926[_0xfd29('0x40')]=_0x2a0c06!==''?_0x2a0c06:util[_0xfd29('0x41')](_0xfd29('0x42'),_0x11fa6b);}else if(_0x2cbcf2[_0xfd29('0x3f')]==='lead'){logger[_0xfd29('0x1c')](_0xfd29('0x43'),_0x11fa6b,_0x2cbcf2[_0xfd29('0x3f')]);_0x4af926['LastName']=_0x2a0c06!==_0xfd29('0x44')?_0x2a0c06:util['format'](_0xfd29('0x42'),_0x11fa6b);_0x4af926[_0xfd29('0x45')]=_0xfd29('0x46');}else if(_0x2cbcf2[_0xfd29('0x3f')]===_0xfd29('0x15')){logger[_0xfd29('0x1c')](_0xfd29('0x43'),_0x11fa6b,_0x2cbcf2[_0xfd29('0x3f')]);_0x4af926[_0xfd29('0x26')]=_0x2a0c06!==_0xfd29('0x44')?_0x2a0c06:util[_0xfd29('0x41')]('Caller\x20-\x20%s',_0x11fa6b);}else{return null;}}return _0x4c13a2[_0xfd29('0x1e')](_[_0xfd29('0x47')](_0x2cbcf2[_0xfd29('0x3f')]))[_0xfd29('0x1f')](_0x4af926)[_0xfd29('0x22')](function(_0x2ad9a9){return BPromise[_0xfd29('0x25')]({'id':_0x2ad9a9['id'],'endUserType':_0x2cbcf2[_0xfd29('0x3f')]});});}});}function getCustomFields(_0x2ef5a2,_0x42069e){var _0x1cd875={};if(_0x2ef5a2[_0xfd29('0x37')]>0x0){_[_0xfd29('0x48')](_0x2ef5a2,function(_0x46c6bf){if(_[_0xfd29('0x49')]([_0xfd29('0x4a'),_0xfd29('0x4b')],_0x46c6bf[_0xfd29('0x3d')])&&_0x46c6bf[_0xfd29('0x4c')]){_0x1cd875[_0x46c6bf[_0xfd29('0x4c')]]=_0x46c6bf[_0xfd29('0x4d')][_0xfd29('0x4e')]();}else if(_0x46c6bf[_0xfd29('0x3d')]==='variable'&&_0x46c6bf[_0xfd29('0x4f')]&&_0x46c6bf[_0xfd29('0x4c')]){_0x42069e[_0x46c6bf[_0xfd29('0x4f')]]&&(_0x1cd875[_0x46c6bf[_0xfd29('0x4c')]]=_0x42069e[_0x46c6bf[_0xfd29('0x4f')]]['toString']());}else if(_0x46c6bf[_0xfd29('0x3d')]===_0xfd29('0x50')&&_0x46c6bf[_0xfd29('0x51')]&&_0x46c6bf[_0xfd29('0x51')][_0xfd29('0x52')]&&_0x46c6bf[_0xfd29('0x4c')]){_0x42069e[_0x46c6bf[_0xfd29('0x51')][_0xfd29('0x52')][_0xfd29('0x3e')]()]&&(_0x1cd875[_0x46c6bf[_0xfd29('0x4c')]]=_0x42069e[_0x46c6bf[_0xfd29('0x51')]['name'][_0xfd29('0x3e')]()]['toString']());}});}return _0x1cd875;}function getConnection(_0x65fa6a){var _0x18e73e=_0x65fa6a['password'][_0xfd29('0x53')](_0x65fa6a[_0xfd29('0x54')]);var _0x49a243=new jsforce['Connection']({'oauth2':{'loginUrl':_0x65fa6a[_0xfd29('0x55')]||_0xfd29('0x56'),'clientId':_0x65fa6a[_0xfd29('0x57')],'clientSecret':_0x65fa6a[_0xfd29('0x58')]}});return _0x49a243[_0xfd29('0x59')](_0x65fa6a[_0xfd29('0x5a')],_0x18e73e)[_0xfd29('0x22')](function(){logger[_0xfd29('0x1c')](_0xfd29('0x5b'));return _0x49a243;});}exports[_0xfd29('0x5c')]=function(_0x35081a,_0x38b82c,_0x2b3ec8,_0x49f91e,_0x449009,_0x4b23bd){var _0x334e04,_0x3751e6,_0x1ab146,_0x593c54;_0x4b23bd[_0xfd29('0x5d')]=intUtil[_0xfd29('0x5e')](_0x4b23bd[_0xfd29('0x5d')]);_0x4b23bd[_0xfd29('0x55')]=intUtil[_0xfd29('0x5e')](_0x4b23bd[_0xfd29('0x55')]);if(_0x449009&&_0x449009[_0xfd29('0x5f')]){logger[_0xfd29('0x1c')](_0xfd29('0x60'),_0xfd29('0x61'));_0x38b82c[_0xfd29('0x62')]=util[_0xfd29('0x41')](_0xfd29('0x63'),_0x4b23bd[_0xfd29('0x5d')],_0x38b82c[_0xfd29('0x64')],md5(_0x38b82c[_0xfd29('0x64')]));}else{_0x38b82c[_0xfd29('0x62')]='';}return getConnection(_0x4b23bd)[_0xfd29('0x22')](function(_0x46c5d8){_0x593c54=_0x46c5d8;return getUser(_0x4b23bd,_0x49f91e[_0xfd29('0x65')],_0x593c54);})[_0xfd29('0x22')](function(_0x22e013){_0x334e04=_0x22e013;return getEndUser(_0x4b23bd,_0x2b3ec8,_0x38b82c['calleridname'],_0x38b82c[_0xfd29('0x66')],_0x593c54);})[_0xfd29('0x22')](function(_0x4535b2){_0x3751e6=_0x4535b2;return getTicket(_0x4b23bd,_0x334e04,_0x3751e6,_0x2b3ec8,_0x38b82c,_0x2b3ec8[_0xfd29('0x67')],_0x593c54,_0xfd29('0x5c'));})[_0xfd29('0x22')](function(_0x58aaad){_0x1ab146=_0x58aaad;logger[_0xfd29('0x1c')](_0xfd29('0x68'),_0x1ab146['id']);logger[_0xfd29('0x1c')](_0xfd29('0x69'),_0x1ab146['id'],_0x49f91e[_0xfd29('0x52')],_0x4b23bd['type']);switch(_0x4b23bd[_0xfd29('0x3d')]){case'integrationTab':emit(util[_0xfd29('0x41')]('user:%s',_0x49f91e[_0xfd29('0x52')]),_0xfd29('0x6a'),{'recordId':_0x1ab146['id']});break;case _0xfd29('0x6b'):emit(util[_0xfd29('0x41')](_0xfd29('0x6c'),_0x49f91e[_0xfd29('0x52')]),'trigger:browser:url',{'uri':util['format'](_0xfd29('0x6d'),_0x593c54[_0xfd29('0x6e')],_0x1ab146['id'])});break;default:logger[_0xfd29('0x6f')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0xfd29('0x70')](function(_0x577329){logger[_0xfd29('0x6f')](_0xfd29('0x60'),_0x577329);});};exports[_0xfd29('0x71')]=function(_0x126fff,_0x2f0e87,_0x3ddbdd,_0x52028b,_0x4030d2,_0x37c81b,_0x5ee64e){var _0x2de800,_0x513db8,_0x1fad78,_0x69536;_0x37c81b['serverUrl']=intUtil['stripTrailingSlash'](_0x37c81b['serverUrl']);_0x37c81b['remoteUri']=intUtil[_0xfd29('0x5e')](_0x37c81b[_0xfd29('0x55')]);if(_0x5ee64e&&_0x5ee64e['recordingFormat']&&_0x5ee64e[_0xfd29('0x72')]!==_0xfd29('0x73')){logger['info'](_0xfd29('0x74'),'Recording\x20is\x20enabled!');_0x2f0e87[_0xfd29('0x62')]=util[_0xfd29('0x41')](_0xfd29('0x63'),_0x37c81b[_0xfd29('0x5d')],_0x2f0e87['uniqueid'],md5(_0x2f0e87[_0xfd29('0x64')]));}return getConnection(_0x37c81b)['then'](function(_0x1f7312){_0x69536=_0x1f7312;return getUser(_0x37c81b,_0x52028b[_0xfd29('0x65')],_0x69536);})[_0xfd29('0x22')](function(_0x5b874a){_0x2de800=_0x5b874a;return getEndUser(_0x37c81b,_0x3ddbdd,_0x2f0e87[_0xfd29('0x75')],_0x2f0e87[_0xfd29('0x76')],_0x69536);})['then'](function(_0x3db176){_0x513db8=_0x3db176;return getTicket(_0x37c81b,_0x2de800,_0x513db8,_0x3ddbdd,_0x2f0e87,_0x3ddbdd[_0xfd29('0x67')],_0x69536,_0xfd29('0x71'));})[_0xfd29('0x22')](function(_0x2b0d5a){_0x1fad78=_0x2b0d5a;logger[_0xfd29('0x1c')](_0xfd29('0x77'),_0x1fad78['id']);logger[_0xfd29('0x1c')](_0xfd29('0x78'),_0x1fad78['id'],_0x52028b[_0xfd29('0x52')],_0x37c81b[_0xfd29('0x3d')]);switch(_0x37c81b[_0xfd29('0x3d')]){case _0xfd29('0x79'):emit(util[_0xfd29('0x41')](_0xfd29('0x6c'),_0x52028b[_0xfd29('0x52')]),_0xfd29('0x6a'),{'recordId':_0x1fad78['id']});break;case _0xfd29('0x6b'):emit(util[_0xfd29('0x41')]('user:%s',_0x52028b[_0xfd29('0x52')]),'trigger:browser:url',{'uri':util[_0xfd29('0x41')](_0xfd29('0x6d'),_0x69536[_0xfd29('0x6e')],_0x1fad78['id'])});break;default:logger[_0xfd29('0x6f')](_0xfd29('0x74'),_0xfd29('0x7a'));}})[_0xfd29('0x70')](function(_0x7075b6){logger['error']('[OUTBOUND]',_0x7075b6);});};exports[_0xfd29('0x7b')]=function(_0x3db0ae,_0x140082,_0x1bfdc4,_0x295467,_0x9242cd,_0x473463){var _0x3ea08a,_0x5878ca,_0xf4c850,_0x37a128;_0x473463[_0xfd29('0x5d')]=intUtil[_0xfd29('0x5e')](_0x473463[_0xfd29('0x5d')]);_0x473463[_0xfd29('0x55')]=intUtil[_0xfd29('0x5e')](_0x473463[_0xfd29('0x55')]);if(_0x9242cd&&_0x9242cd[_0xfd29('0x5f')]){logger[_0xfd29('0x1c')]('['+_0x140082[_0xfd29('0x7c')][_0xfd29('0x7d')]()+']',_0xfd29('0x61'));_0x140082[_0xfd29('0x62')]=util[_0xfd29('0x41')](_0xfd29('0x63'),_0x473463[_0xfd29('0x5d')],_0x140082[_0xfd29('0x64')],md5(_0x140082[_0xfd29('0x64')]));}else{_0x140082[_0xfd29('0x62')]='';}return getConnection(_0x473463)[_0xfd29('0x22')](function(_0x33e6bc){_0x37a128=_0x33e6bc;if(!_[_0xfd29('0x20')](_0x295467)){return getUser(_0x473463,_0x295467['name'],_0x37a128);}else{return getUser(_0x473463,null,_0x37a128);}})['then'](function(_0x5d5d0a){_0x3ea08a=_0x5d5d0a;return getEndUser(_0x473463,_0x1bfdc4,_0x140082['calleridname'],_0x140082[_0xfd29('0x66')],_0x37a128);})[_0xfd29('0x22')](function(_0x14318e){_0x5878ca=_0x14318e;return getTicket(_0x473463,_0x3ea08a,_0x5878ca,_0x1bfdc4,_0x140082,_0x1bfdc4[_0xfd29('0x67')],_0x37a128);})[_0xfd29('0x22')](function(_0x3f0299){_0xf4c850=_0x3f0299;logger[_0xfd29('0x1c')]('['+_0x140082[_0xfd29('0x7c')]['toUpperCase']()+_0xfd29('0x7e'),_0xf4c850['id']);logger['info']('['+_0x140082[_0xfd29('0x7c')][_0xfd29('0x7d')]()+_0xfd29('0x7f'),_0x473463[_0xfd29('0x3d')]);})[_0xfd29('0x70')](function(_0x57a350){logger[_0xfd29('0x6f')]('['+_0x140082[_0xfd29('0x7c')][_0xfd29('0x7d')]()+']',_0x57a350);});}; \ 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 be46bfa..b690bd6 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 _0x4081=['getString','Subjects','Descriptions','Fields','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','push','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','queue','unmanaged','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','none','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','defaults','localhost','socket.io-emitter','redis','sys_user?sysparm_query=user_name%3Dadmin','then','length','adminId','result','info','catch','error','toUpperCase','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','GET','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','active','true','sys_id','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','user','endUserNumber','],\x20EndUser\x20schema','endUserId','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','includes','string','picklist','type','nameField','customField','toLowerCase','toString','idField','content','variable','variableName','Variable','name','outbound','incident','assign'];(function(_0x2c07a7,_0x138e87){var _0xca89c1=function(_0x53fac8){while(--_0x53fac8){_0x2c07a7['push'](_0x2c07a7['shift']());}};_0xca89c1(++_0x138e87);}(_0x4081,0x168));var _0x1408=function(_0x3d5127,_0x513b0e){_0x3d5127=_0x3d5127-0x0;var _0x3286c5=_0x4081[_0x3d5127];return _0x3286c5;};'use strict';var _=require(_0x1408('0x0'));var Promise=require('bluebird');var rp=require(_0x1408('0x1'));var util=require(_0x1408('0x2'));var md5=require('md5');var Redis=require(_0x1408('0x3'));var intUtil=require(_0x1408('0x4'));var config=require(_0x1408('0x5'));var logger=require(_0x1408('0x6'))(_0x1408('0x7'));config['redis']=_[_0x1408('0x8')](config['redis'],{'host':_0x1408('0x9'),'port':0x18eb});var io=require(_0x1408('0xa'))(new Redis(config[_0x1408('0xb')]));function getAdminUser(_0x550b26,_0x1ce5d1,_0x4448cc,_0x2614a0,_0x361ea2,_0x260d60){return new Promise(function(_0x47ada2,_0x1a3b64){var _0x43b64d={'method':'GET','uri':_0x2614a0+_0x1408('0xc')+'&'+_0x361ea2+'&'+_0x260d60,'auth':_0x1ce5d1,'json':!![]};return rp(_0x43b64d)[_0x1408('0xd')](function(_0x58557a){if(_0x58557a['result'][_0x1408('0xe')]>0x0){_0x4448cc[_0x1408('0xf')]=_0x58557a[_0x1408('0x10')][0x0]['sys_id'];}logger[_0x1408('0x11')]('['+[_0x550b26['toUpperCase']()]+'],\x20getAdminUser\x20crm',_0x4448cc);_0x47ada2(_0x4448cc);})[_0x1408('0x12')](function(_0x919fe3){logger[_0x1408('0x13')]('['+[_0x550b26[_0x1408('0x14')]()]+']',_0x919fe3[_0x1408('0x15')]);_0x1a3b64(_0x919fe3[_0x1408('0x15')]);});});}function getUser(_0x195b4a,_0x3968d1,_0x314732,_0x5cdc8a,_0x5b49f0){return function(_0x3b3d06){logger['info']('['+[_0x195b4a[_0x1408('0x14')]()]+_0x1408('0x16'),_0x3b3d06);return new Promise(function(_0x5d92c9,_0x5e8ea3){if(intUtil[_0x1408('0x17')](_0x3b3d06[_0x1408('0x18')])){var _0x3e42fb={'method':_0x1408('0x19'),'uri':_0x314732+_0x1408('0x1a')+_0x3b3d06[_0x1408('0x18')]+'&'+_0x5cdc8a+'&'+_0x5b49f0,'auth':_0x3968d1,'json':!![]};logger[_0x1408('0x11')]('['+[_0x195b4a[_0x1408('0x14')]()]+_0x1408('0x1b'),_0x3e42fb);return rp(_0x3e42fb)[_0x1408('0xd')](function(_0x5c84c0){logger[_0x1408('0x11')]('['+[_0x195b4a[_0x1408('0x14')]()]+'],\x20getUser\x20entity',_0x5c84c0);if(_0x5c84c0['result']['length']>0x0&&String(_0x5c84c0['result'][0x0][_0x1408('0x1c')])===_0x1408('0x1d')){_0x3b3d06['userId']=_0x5c84c0[_0x1408('0x10')][0x0][_0x1408('0x1e')];}else{_0x3b3d06[_0x1408('0x1f')]=_0x3b3d06['adminId'];_0x3b3d06[_0x1408('0x18')]=_0x3b3d06[_0x1408('0x20')];}logger[_0x1408('0x11')]('['+[_0x195b4a['toUpperCase']()]+_0x1408('0x21'),_0x3b3d06);_0x5d92c9(_0x3b3d06);})['catch'](function(_0x480c15){logger[_0x1408('0x13')]('['+[_0x195b4a[_0x1408('0x14')]()]+']',_0x480c15[_0x1408('0x15')]);_0x5e8ea3(_0x480c15[_0x1408('0x15')]);});}else{logger[_0x1408('0x11')]('['+[_0x195b4a[_0x1408('0x14')]()]+_0x1408('0x22'));_0x3b3d06[_0x1408('0x1f')]=_0x3b3d06[_0x1408('0xf')];_0x3b3d06[_0x1408('0x18')]=_0x3b3d06[_0x1408('0x20')];_0x5d92c9(_0x3b3d06);}});};}function createEndUser(_0x18dc27,_0x3cf7bb,_0x5c38f2,_0x597106,_0x1db35b){logger[_0x1408('0x11')]('['+[_0x18dc27['toUpperCase']()]+_0x1408('0x23'),_0x5c38f2);return new Promise(function(_0x514aca,_0x2e1264){var _0x20ffb9={'method':_0x1408('0x24'),'uri':_0x597106+'sys_user?'+_0x1db35b,'body':{'user_name':_0x5c38f2['endUserNumber'],'roles':_0x1408('0x25'),'first_name':_0x5c38f2[_0x1408('0x26')],'active':_0x1408('0x1d'),'date_format':'System','phone':_0x5c38f2['endUserNumber']},'auth':_0x3cf7bb,'json':!![]};return rp(_0x20ffb9)[_0x1408('0xd')](function(_0x4a9e05){logger[_0x1408('0x11')]('['+[_0x18dc27[_0x1408('0x14')]()]+_0x1408('0x27'),_0x4a9e05[_0x1408('0x10')]);_0x5c38f2[_0x1408('0x28')]=_0x4a9e05[_0x1408('0x10')][_0x1408('0x1e')];_0x514aca(_0x5c38f2);})[_0x1408('0x12')](function(_0x590b7c){logger['error']('['+[_0x18dc27[_0x1408('0x14')]()]+']',_0x590b7c[_0x1408('0x15')]);_0x2e1264(_0x590b7c[_0x1408('0x15')]);});});}function getEndUser(_0x329b57,_0x57aedc,_0x41f674,_0x15d51c,_0x1db5ba){return function(_0x28bd27){logger[_0x1408('0x11')]('['+[_0x329b57[_0x1408('0x14')]()]+'],\x20getEndUser\x20input\x20crm',_0x28bd27);return new Promise(function(_0x25bb8c,_0x3d9cf9){var _0x4f235f={'method':_0x1408('0x19'),'uri':_0x41f674+_0x1408('0x29')+_0x28bd27[_0x1408('0x26')]+'&'+_0x15d51c+'&'+_0x1db5ba,'auth':_0x57aedc,'json':!![]};return rp(_0x4f235f)[_0x1408('0xd')](function(_0x130e1c){if(_0x130e1c[_0x1408('0x10')][_0x1408('0xe')]>0x0){_0x28bd27[_0x1408('0x28')]=_0x130e1c['result'][0x0][_0x1408('0x1e')];logger[_0x1408('0x11')]('['+[_0x329b57[_0x1408('0x14')]()]+_0x1408('0x2a'),_0x28bd27);_0x25bb8c(_0x28bd27);}else{return createEndUser(_0x329b57,_0x57aedc,_0x28bd27,_0x41f674,_0x15d51c)['then'](function(_0x57487e){logger[_0x1408('0x11')]('['+[_0x329b57['toUpperCase']()]+'],\x20createEndUser\x20crm',_0x57487e);_0x25bb8c(_0x57487e);});}})['catch'](function(_0x275e80){logger['error']('['+[_0x329b57[_0x1408('0x14')]()]+']',_0x275e80[_0x1408('0x15')]);_0x3d9cf9(_0x275e80[_0x1408('0x15')]);});});};}function getCustomFields(_0x1f42f3,_0x252e48){var _0x1d918c={};if(_0x1f42f3[_0x1408('0xe')]>0x0){_['forEach'](_0x1f42f3,function(_0x482cf2){if(_[_0x1408('0x2b')]([_0x1408('0x2c'),_0x1408('0x2d')],_0x482cf2[_0x1408('0x2e')])&&_0x482cf2[_0x1408('0x2f')]&&!_0x482cf2[_0x1408('0x30')]){_0x1d918c[_0x482cf2[_0x1408('0x2f')][_0x1408('0x31')]()]=_0x482cf2['content'][_0x1408('0x32')]();}else if(_[_0x1408('0x2b')]([_0x1408('0x2c'),_0x1408('0x2d')],_0x482cf2[_0x1408('0x2e')])&&_0x482cf2[_0x1408('0x33')]&&_0x482cf2['customField']){_0x1d918c[_0x482cf2[_0x1408('0x33')][_0x1408('0x31')]()]=_0x482cf2[_0x1408('0x34')]['toString']();}else if(_0x482cf2['type']===_0x1408('0x35')&&_0x482cf2[_0x1408('0x36')]&&_0x482cf2[_0x1408('0x33')]&&_0x482cf2[_0x1408('0x30')]){_0x1d918c[_0x482cf2[_0x1408('0x33')]['toLowerCase']()]=_0x252e48[_0x482cf2[_0x1408('0x36')]][_0x1408('0x32')]();}else if(_0x482cf2[_0x1408('0x2e')]==='customVariable'&&_0x482cf2[_0x1408('0x37')]&&_0x482cf2[_0x1408('0x37')][_0x1408('0x38')]&&_0x482cf2['idField']&&_0x482cf2['customField']){_0x1d918c[_0x482cf2[_0x1408('0x33')][_0x1408('0x31')]()]=_0x252e48[_0x482cf2['Variable'][_0x1408('0x38')][_0x1408('0x31')]()]['toString']();}});}return _0x1d918c;}function getTicket(_0x245fb8,_0x453e0c,_0x5c1df7,_0x33d4e0,_0x21bfa0,_0x381c98){return function(_0x52d7ee){logger[_0x1408('0x11')]('['+[_0x245fb8[_0x1408('0x14')]()]+']\x20getTicket\x20input\x20crm',_0x52d7ee);return new Promise(function(_0x3b40bc,_0x899cc9){var _0xcebe48=_0x245fb8[_0x1408('0x31')]()===_0x1408('0x39')?_0x52d7ee[_0x1408('0x1f')]:_0x52d7ee['endUserId'];var _0x13f6c4={'method':_0x1408('0x24'),'uri':_0x5c1df7+_0x1408('0x3a')+'?'+_0x381c98,'body':Object[_0x1408('0x3b')]({},{'active':_0x1408('0x1d'),'caller_id':_0xcebe48,'assigned_to':_0x52d7ee[_0x1408('0x1f')],'short_description':intUtil[_0x1408('0x3c')](_0x33d4e0[_0x1408('0x3d')],_0x21bfa0,'\x20'),'description':intUtil['getString'](_0x33d4e0[_0x1408('0x3e')],_0x21bfa0,'\x0a')},getCustomFields(_0x33d4e0[_0x1408('0x3f')],_0x21bfa0)),'auth':_0x453e0c,'json':!![]};return rp(_0x13f6c4)[_0x1408('0xd')](function(_0x2efd3a){logger['info']('['+[_0x245fb8[_0x1408('0x14')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x2efd3a[_0x1408('0x10')]);_0x52d7ee[_0x1408('0x40')]=_0x2efd3a['result'][_0x1408('0x1e')];_0x52d7ee[_0x1408('0x41')]=_0x2efd3a['result'][_0x1408('0x42')];logger['info']('['+[_0x245fb8[_0x1408('0x14')]()]+_0x1408('0x43'),_0x52d7ee);_0x3b40bc(_0x52d7ee);})[_0x1408('0x12')](function(_0x110f60){logger[_0x1408('0x13')]('['+[_0x245fb8[_0x1408('0x14')]()]+']',_0x110f60[_0x1408('0x15')]);_0x899cc9(_0x110f60[_0x1408('0x15')]);});});};}function createRemoteTag(_0x1847bb,_0x15aaea,_0x30213c,_0x28a08e){return new Promise(function(_0x1b8fa0,_0x3785f1){var _0x2f051c={'method':'POST','uri':_0x30213c+'label'+'?'+_0x28a08e,'body':{'short_description':_0x1847bb,'global':!![],'active':!![],'name':_0x1847bb},'auth':_0x15aaea,'json':!![]};return rp(_0x2f051c)[_0x1408('0xd')](function(_0x26be4b){var _0x4e394b=_0x26be4b['result'][_0x1408('0x1e')];_0x1b8fa0(_0x4e394b);});});}function getRemoteTag(_0x1bc08a,_0x492002,_0x13213f,_0x21ca7e,_0x1ad0da){return new Promise(function(_0x47a954,_0x1a18a1){var _0x567a8d={'method':'GET','uri':_0x13213f+_0x1408('0x44')+_0x1408('0x45')+_0x1bc08a+'&'+_0x21ca7e,'auth':_0x492002,'json':!![]};return rp(_0x567a8d)[_0x1408('0xd')](function(_0x211fdf){if(_0x211fdf[_0x1408('0x10')][_0x1408('0xe')]>0x0){var _0xa9ee47=_0x211fdf[_0x1408('0x10')][0x0][_0x1408('0x1e')];_0x47a954(_0xa9ee47);}else{return createRemoteTag(_0x1bc08a,_0x492002,_0x13213f,_0x21ca7e)[_0x1408('0xd')](function(_0x3c4b23){_0x47a954(_0x3c4b23);});}});});}function assignTagToIncident(_0x3032b3,_0x1067ef,_0x55c9bf,_0x2cb88d,_0x4bb9c8){return new Promise(function(_0x33582a,_0x488a7f){var _0x15eb8a={'method':_0x1408('0x24'),'uri':_0x55c9bf+_0x1408('0x46')+'?'+_0x4bb9c8,'body':{'label':_0x3032b3,'table':_0x1408('0x3a'),'id_type':_0x1408('0x47'),'table_key':_0x2cb88d[_0x1408('0x40')],'title':'Incident\x20-\x20'+_0x2cb88d['ticketNumber'],'id_display':_0x2cb88d[_0x1408('0x41')]},'auth':_0x1067ef,'json':!![]};return rp(_0x15eb8a)['then'](function(_0x4bb2d7){_0x33582a();})[_0x1408('0x12')](function(){_0x33582a();});});}function manageTags(_0x159b33,_0x2dd09e,_0x1ecec7,_0x5ee482,_0x53088c,_0x447b01,_0x184512){return new Promise(function(_0x353786,_0x2164a6){var _0x40709c=[];_0x2dd09e['forEach'](function(_0x532b9e){_0x40709c[_0x1408('0x48')](getRemoteTag(_0x532b9e,_0x1ecec7,_0x5ee482,_0x447b01,_0x184512));});return Promise['all'](_0x40709c)[_0x1408('0xd')](function(_0x7709bc){if(_0x7709bc[_0x1408('0xe')]){logger[_0x1408('0x11')]('['+[_0x159b33[_0x1408('0x14')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x7709bc);var _0x342c10=[];_0x7709bc['forEach'](function(_0x38db16){_0x342c10['push'](assignTagToIncident(_0x38db16,_0x1ecec7,_0x5ee482,_0x53088c,_0x447b01));});return Promise[_0x1408('0x49')](_0x342c10)[_0x1408('0xd')](function(){_0x353786();})[_0x1408('0x12')](function(){_0x353786();});}else{_0x353786();}});});}function getTags(_0x181f76,_0xa419a6,_0x1d084d,_0x34efd4,_0x374fca,_0x5dc9fb){return function(_0xa07698){return new Promise(function(_0x40e8d5,_0x3f1bcb){var _0x4f89c2=[];var _0x362b27=_0x34efd4[_0x1408('0x4a')];if(_0x362b27&&_0x362b27[_0x1408('0xe')]>0x0){_0x4f89c2=_[_0x1408('0x4b')](_0x362b27,_0x1408('0x38'));}if(_0x4f89c2[_0x1408('0xe')]>0x0){return manageTags(_0x181f76,_0x4f89c2,_0xa419a6,_0x1d084d,_0xa07698,_0x374fca,_0x5dc9fb)[_0x1408('0xd')](function(){_0x40e8d5(_0xa07698);});}else{_0x40e8d5(_0xa07698);}});};}function emit(_0x55bcb4,_0x967438,_0xb80904){var _0x33a2cc=_0x1408('0x4c')+_0x1408('0x4d')+_0x1408('0x4e')+_0x1408('0x4f');var _0x117b14={'uri':_0x55bcb4+_0x1408('0x50')+_0xb80904+_0x33a2cc};io['to'](util[_0x1408('0x51')](_0x1408('0x52'),_0x967438))[_0x1408('0x53')](_0x1408('0x54'),_0x117b14);}exports['cs']=function(_0x9855ae,_0x9763b1,_0x318d8f,_0x582c43,_0x1bf298,_0x3bafbb,_0xa17884,_0x1cdf3d){var _0x698778={};var _0x327be9={'user':_0x3bafbb['username'],'pass':_0x3bafbb['password']};var _0x22182e='sysparm_limit=1';var _0x96b5b4='sysparm_display_value=true';_0x3bafbb[_0x1408('0x55')]=intUtil[_0x1408('0x56')](_0x3bafbb[_0x1408('0x55')]);_0x3bafbb[_0x1408('0x57')]=intUtil[_0x1408('0x56')](_0x3bafbb[_0x1408('0x57')]);var _0x183b5c=util[_0x1408('0x51')](_0x1408('0x58'),_0x3bafbb[_0x1408('0x55')]);_0x698778['userEmail']=!_[_0x1408('0x59')](_0x582c43)?_0x582c43[_0x1408('0x5a')]:null;_0x698778['adminEmail']=_0x3bafbb[_0x1408('0x5a')];_0x698778[_0x1408('0x26')]=_0x1cdf3d[_0x1408('0x31')]()===_0x1408('0x39')?_0x9763b1[_0x1408('0x5b')]:_0x9763b1[_0x1408('0x5c')];_0x698778['callDirection']=_0x1cdf3d===_0x1408('0x5d')||_0x1cdf3d===_0x1408('0x5e')?_0x1408('0x5d'):_0x1408('0x39');var _0xc79582=util[_0x1408('0x51')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3bafbb[_0x1408('0x57')],_0x9763b1['uniqueid'],md5(_0x9763b1[_0x1408('0x5f')]));if(_0x1bf298&&_0x1bf298[_0x1408('0x60')]){logger[_0x1408('0x11')](_0x1408('0x61'),_0x1408('0x62'));_0x9763b1[_0x1408('0x63')]=_0xc79582;}else if(_0xa17884&&_0xa17884['recordingFormat']&&_0xa17884['recordingFormat']!==_0x1408('0x64')){logger[_0x1408('0x11')]('[OUTBOUND]',_0x1408('0x62'));_0x9763b1[_0x1408('0x63')]=_0xc79582;}else{_0x9763b1[_0x1408('0x63')]='';}return getAdminUser(_0x1cdf3d,_0x327be9,_0x698778,_0x183b5c,_0x96b5b4,_0x22182e)[_0x1408('0xd')](getUser(_0x1cdf3d,_0x327be9,_0x183b5c,_0x96b5b4,_0x22182e))[_0x1408('0xd')](getEndUser(_0x1cdf3d,_0x327be9,_0x183b5c,_0x96b5b4,_0x22182e))[_0x1408('0xd')](getTicket(_0x1cdf3d,_0x327be9,_0x183b5c,_0x318d8f,_0x9763b1,_0x96b5b4))['then'](function(_0xca8463){logger[_0x1408('0x11')](util['format'](_0x1408('0x65'),_0xca8463[_0x1408('0x40')]));logger[_0x1408('0x11')](util[_0x1408('0x51')](_0x1408('0x66'),_0x1cdf3d));if(_0x1cdf3d!==_0x1408('0x5e')){logger[_0x1408('0x11')]('['+[_0x1cdf3d[_0x1408('0x14')]()]+']',_0x1408('0x67'));emit(_0x3bafbb['remoteUri'],_0x582c43[_0x1408('0x38')],_0xca8463[_0x1408('0x40')]);}})[_0x1408('0x12')](function(_0x4bba4c){logger[_0x1408('0x13')]('['+[_0x1cdf3d[_0x1408('0x14')]()]+_0x1408('0x68'),util['inspect'](_0x4bba4c,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x833d=['username','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','email','adminEmail','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','localhost','socket.io-emitter','GET','then','result','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','POST','endUserNumber','user','System','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','length','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','idField','variable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','Incident','Incident\x20-\x20','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','format','user:%s','emit','trigger:browser:url'];(function(_0x7d1b89,_0x58faa5){var _0x435a5b=function(_0x358473){while(--_0x358473){_0x7d1b89['push'](_0x7d1b89['shift']());}};_0x435a5b(++_0x58faa5);}(_0x833d,0x15e));var _0xd833=function(_0x3fef0b,_0x5c010d){_0x3fef0b=_0x3fef0b-0x0;var _0x163d38=_0x833d[_0x3fef0b];return _0x163d38;};'use strict';var _=require(_0xd833('0x0'));var Promise=require(_0xd833('0x1'));var rp=require(_0xd833('0x2'));var util=require(_0xd833('0x3'));var md5=require('md5');var Redis=require(_0xd833('0x4'));var intUtil=require(_0xd833('0x5'));var config=require(_0xd833('0x6'));var logger=require(_0xd833('0x7'))(_0xd833('0x8'));config[_0xd833('0x9')]=_['defaults'](config[_0xd833('0x9')],{'host':_0xd833('0xa'),'port':0x18eb});var io=require(_0xd833('0xb'))(new Redis(config[_0xd833('0x9')]));function getAdminUser(_0x355666,_0x1c85cb,_0x344149,_0x1ae76e,_0x169aa2,_0xc1b902){return new Promise(function(_0x1e954d,_0x2bd370){var _0x2a382e={'method':_0xd833('0xc'),'uri':_0x1ae76e+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x169aa2+'&'+_0xc1b902,'auth':_0x1c85cb,'json':!![]};return rp(_0x2a382e)[_0xd833('0xd')](function(_0x3d86cc){if(_0x3d86cc[_0xd833('0xe')]['length']>0x0){_0x344149[_0xd833('0xf')]=_0x3d86cc[_0xd833('0xe')][0x0][_0xd833('0x10')];}logger[_0xd833('0x11')]('['+[_0x355666[_0xd833('0x12')]()]+_0xd833('0x13'),_0x344149);_0x1e954d(_0x344149);})[_0xd833('0x14')](function(_0x4e275b){logger[_0xd833('0x15')]('['+[_0x355666[_0xd833('0x12')]()]+']',_0x4e275b[_0xd833('0x16')]);_0x2bd370(_0x4e275b[_0xd833('0x16')]);});});}function getUser(_0x185ad5,_0x15defc,_0x3ef5ce,_0x421a5d,_0x4bab41){return function(_0x5ec002){logger['info']('['+[_0x185ad5[_0xd833('0x12')]()]+_0xd833('0x17'),_0x5ec002);return new Promise(function(_0x3c8491,_0x330c84){if(intUtil[_0xd833('0x18')](_0x5ec002[_0xd833('0x19')])){var _0x9c5508={'method':_0xd833('0xc'),'uri':_0x3ef5ce+_0xd833('0x1a')+_0x5ec002[_0xd833('0x19')]+'&'+_0x421a5d+'&'+_0x4bab41,'auth':_0x15defc,'json':!![]};logger[_0xd833('0x11')]('['+[_0x185ad5[_0xd833('0x12')]()]+_0xd833('0x1b'),_0x9c5508);return rp(_0x9c5508)[_0xd833('0xd')](function(_0x50cf9a){logger[_0xd833('0x11')]('['+[_0x185ad5[_0xd833('0x12')]()]+_0xd833('0x1c'),_0x50cf9a);if(_0x50cf9a[_0xd833('0xe')]['length']>0x0&&String(_0x50cf9a[_0xd833('0xe')][0x0][_0xd833('0x1d')])===_0xd833('0x1e')){_0x5ec002[_0xd833('0x1f')]=_0x50cf9a['result'][0x0][_0xd833('0x10')];}else{_0x5ec002['userId']=_0x5ec002[_0xd833('0xf')];_0x5ec002['userEmail']=_0x5ec002['adminEmail'];}logger[_0xd833('0x11')]('['+[_0x185ad5[_0xd833('0x12')]()]+_0xd833('0x20'),_0x5ec002);_0x3c8491(_0x5ec002);})[_0xd833('0x14')](function(_0x31ce58){logger[_0xd833('0x15')]('['+[_0x185ad5['toUpperCase']()]+']',_0x31ce58[_0xd833('0x16')]);_0x330c84(_0x31ce58[_0xd833('0x16')]);});}else{logger['info']('['+[_0x185ad5[_0xd833('0x12')]()]+_0xd833('0x21'));_0x5ec002[_0xd833('0x1f')]=_0x5ec002[_0xd833('0xf')];_0x5ec002[_0xd833('0x19')]=_0x5ec002['adminEmail'];_0x3c8491(_0x5ec002);}});};}function createEndUser(_0x1ce7d4,_0x5674a7,_0x2b98a1,_0x3460ce,_0xb36cb5){logger[_0xd833('0x11')]('['+[_0x1ce7d4[_0xd833('0x12')]()]+'],\x20createEndUser\x20input\x20crm',_0x2b98a1);return new Promise(function(_0x29ac66,_0x5b30e9){var _0x520a06={'method':_0xd833('0x22'),'uri':_0x3460ce+'sys_user?'+_0xb36cb5,'body':{'user_name':_0x2b98a1[_0xd833('0x23')],'roles':_0xd833('0x24'),'first_name':_0x2b98a1[_0xd833('0x23')],'active':_0xd833('0x1e'),'date_format':_0xd833('0x25'),'phone':_0x2b98a1[_0xd833('0x23')]},'auth':_0x5674a7,'json':!![]};return rp(_0x520a06)[_0xd833('0xd')](function(_0x1477fe){logger[_0xd833('0x11')]('['+[_0x1ce7d4[_0xd833('0x12')]()]+'],\x20EndUser\x20schema',_0x1477fe[_0xd833('0xe')]);_0x2b98a1[_0xd833('0x26')]=_0x1477fe[_0xd833('0xe')][_0xd833('0x10')];_0x29ac66(_0x2b98a1);})['catch'](function(_0x1b5797){logger['error']('['+[_0x1ce7d4[_0xd833('0x12')]()]+']',_0x1b5797[_0xd833('0x16')]);_0x5b30e9(_0x1b5797['message']);});});}function getEndUser(_0x209d1d,_0x57f728,_0x1ac772,_0x8a6660,_0x3fb5ef){return function(_0x4bcf33){logger[_0xd833('0x11')]('['+[_0x209d1d['toUpperCase']()]+_0xd833('0x27'),_0x4bcf33);return new Promise(function(_0x251663,_0x38a722){var _0xc71679={'method':_0xd833('0xc'),'uri':_0x1ac772+_0xd833('0x28')+_0x4bcf33[_0xd833('0x23')]+'&'+_0x8a6660+'&'+_0x3fb5ef,'auth':_0x57f728,'json':!![]};return rp(_0xc71679)[_0xd833('0xd')](function(_0x27ce7d){if(_0x27ce7d['result'][_0xd833('0x29')]>0x0){_0x4bcf33[_0xd833('0x26')]=_0x27ce7d['result'][0x0]['sys_id'];logger['info']('['+[_0x209d1d[_0xd833('0x12')]()]+_0xd833('0x2a'),_0x4bcf33);_0x251663(_0x4bcf33);}else{return createEndUser(_0x209d1d,_0x57f728,_0x4bcf33,_0x1ac772,_0x8a6660)[_0xd833('0xd')](function(_0x34ee98){logger[_0xd833('0x11')]('['+[_0x209d1d[_0xd833('0x12')]()]+_0xd833('0x2b'),_0x34ee98);_0x251663(_0x34ee98);});}})[_0xd833('0x14')](function(_0x8a4b15){logger[_0xd833('0x15')]('['+[_0x209d1d[_0xd833('0x12')]()]+']',_0x8a4b15['message']);_0x38a722(_0x8a4b15[_0xd833('0x16')]);});});};}function getCustomFields(_0x324494,_0x5dbe83){var _0x180255={};if(_0x324494['length']>0x0){_[_0xd833('0x2c')](_0x324494,function(_0x170357){if(_[_0xd833('0x2d')]([_0xd833('0x2e'),_0xd833('0x2f')],_0x170357[_0xd833('0x30')])&&_0x170357[_0xd833('0x31')]&&!_0x170357[_0xd833('0x32')]){_0x180255[_0x170357[_0xd833('0x31')][_0xd833('0x33')]()]=_0x170357[_0xd833('0x34')][_0xd833('0x35')]();}else if(_['includes']([_0xd833('0x2e'),_0xd833('0x2f')],_0x170357[_0xd833('0x30')])&&_0x170357[_0xd833('0x36')]&&_0x170357[_0xd833('0x32')]){_0x180255[_0x170357[_0xd833('0x36')][_0xd833('0x33')]()]=_0x170357[_0xd833('0x34')]['toString']();}else if(_0x170357['type']===_0xd833('0x37')&&_0x170357['variableName']&&_0x170357['idField']&&_0x170357[_0xd833('0x32')]){_0x180255[_0x170357[_0xd833('0x36')]['toLowerCase']()]=_0x5dbe83[_0x170357['variableName']]['toString']();}else if(_0x170357[_0xd833('0x30')]==='customVariable'&&_0x170357[_0xd833('0x38')]&&_0x170357[_0xd833('0x38')][_0xd833('0x39')]&&_0x170357[_0xd833('0x36')]&&_0x170357[_0xd833('0x32')]){_0x180255[_0x170357['idField'][_0xd833('0x33')]()]=_0x5dbe83[_0x170357[_0xd833('0x38')]['name'][_0xd833('0x33')]()]['toString']();}});}return _0x180255;}function getTicket(_0x356cb6,_0x2460d5,_0x552641,_0x1adcb8,_0x5d5235,_0x5684e2){return function(_0x309c03){logger[_0xd833('0x11')]('['+[_0x356cb6[_0xd833('0x12')]()]+_0xd833('0x3a'),_0x309c03);return new Promise(function(_0x25da29,_0x45b4ab){var _0x3deea2=_0x356cb6[_0xd833('0x33')]()===_0xd833('0x3b')?_0x309c03[_0xd833('0x1f')]:_0x309c03[_0xd833('0x26')];var _0x159e44={'method':_0xd833('0x22'),'uri':_0x552641+_0xd833('0x3c')+'?'+_0x5684e2,'body':Object[_0xd833('0x3d')]({},{'active':_0xd833('0x1e'),'caller_id':_0x3deea2,'assigned_to':_0x309c03['userId'],'short_description':intUtil[_0xd833('0x3e')](_0x1adcb8['Subjects'],_0x5d5235,'\x20'),'description':intUtil['getString'](_0x1adcb8[_0xd833('0x3f')],_0x5d5235,'\x0a')},getCustomFields(_0x1adcb8[_0xd833('0x40')],_0x5d5235)),'auth':_0x2460d5,'json':!![]};return rp(_0x159e44)[_0xd833('0xd')](function(_0x412f46){logger[_0xd833('0x11')]('['+[_0x356cb6[_0xd833('0x12')]()]+_0xd833('0x41'),_0x412f46['result']);_0x309c03[_0xd833('0x42')]=_0x412f46[_0xd833('0xe')][_0xd833('0x10')];_0x309c03[_0xd833('0x43')]=_0x412f46['result']['number'];logger[_0xd833('0x11')]('['+[_0x356cb6['toUpperCase']()]+_0xd833('0x44'),_0x309c03);_0x25da29(_0x309c03);})['catch'](function(_0x448d46){logger['error']('['+[_0x356cb6['toUpperCase']()]+']',_0x448d46[_0xd833('0x16')]);_0x45b4ab(_0x448d46[_0xd833('0x16')]);});});};}function createRemoteTag(_0x2c3054,_0x4925e1,_0x613f12,_0x1e6e7a){return new Promise(function(_0x5e6084,_0xc85063){var _0x2e13c7={'method':_0xd833('0x22'),'uri':_0x613f12+_0xd833('0x45')+'?'+_0x1e6e7a,'body':{'short_description':_0x2c3054,'global':!![],'active':!![],'name':_0x2c3054},'auth':_0x4925e1,'json':!![]};return rp(_0x2e13c7)[_0xd833('0xd')](function(_0x86cae1){var _0xa79488=_0x86cae1[_0xd833('0xe')]['sys_id'];_0x5e6084(_0xa79488);});});}function getRemoteTag(_0x1d24d5,_0x1fc3b3,_0x5206c6,_0xb8f61d,_0x1c5404){return new Promise(function(_0x3cf5ed,_0x419a11){var _0x2863a5={'method':_0xd833('0xc'),'uri':_0x5206c6+_0xd833('0x45')+_0xd833('0x46')+_0x1d24d5+'&'+_0xb8f61d,'auth':_0x1fc3b3,'json':!![]};return rp(_0x2863a5)['then'](function(_0x73425b){if(_0x73425b[_0xd833('0xe')][_0xd833('0x29')]>0x0){var _0x9fc5a4=_0x73425b[_0xd833('0xe')][0x0][_0xd833('0x10')];_0x3cf5ed(_0x9fc5a4);}else{return createRemoteTag(_0x1d24d5,_0x1fc3b3,_0x5206c6,_0xb8f61d)[_0xd833('0xd')](function(_0x52f61d){_0x3cf5ed(_0x52f61d);});}});});}function assignTagToIncident(_0x5d2ab6,_0x46f6a8,_0x50794a,_0x4514f2,_0x3be3b1){return new Promise(function(_0x19f2ff,_0x4d0ad4){var _0x3c6d67={'method':_0xd833('0x22'),'uri':_0x50794a+'label_entry'+'?'+_0x3be3b1,'body':{'label':_0x5d2ab6,'table':_0xd833('0x3c'),'id_type':_0xd833('0x47'),'table_key':_0x4514f2[_0xd833('0x42')],'title':_0xd833('0x48')+_0x4514f2[_0xd833('0x43')],'id_display':_0x4514f2['ticketNumber']},'auth':_0x46f6a8,'json':!![]};return rp(_0x3c6d67)['then'](function(_0x490945){_0x19f2ff();})[_0xd833('0x14')](function(){_0x19f2ff();});});}function manageTags(_0x4a2a37,_0x2c33e3,_0xf4d1cd,_0x50cd4f,_0x342c39,_0x191105,_0x5ceef0){return new Promise(function(_0x12a6e1,_0x339e4f){var _0x55a0a4=[];_0x2c33e3[_0xd833('0x2c')](function(_0x5059b7){_0x55a0a4['push'](getRemoteTag(_0x5059b7,_0xf4d1cd,_0x50cd4f,_0x191105,_0x5ceef0));});return Promise[_0xd833('0x49')](_0x55a0a4)['then'](function(_0x2526e0){if(_0x2526e0[_0xd833('0x29')]){logger['info']('['+[_0x4a2a37[_0xd833('0x12')]()]+_0xd833('0x4a'),_0x2526e0);var _0x38c656=[];_0x2526e0[_0xd833('0x2c')](function(_0x2c64dc){_0x38c656[_0xd833('0x4b')](assignTagToIncident(_0x2c64dc,_0xf4d1cd,_0x50cd4f,_0x342c39,_0x191105));});return Promise['all'](_0x38c656)[_0xd833('0xd')](function(){_0x12a6e1();})[_0xd833('0x14')](function(){_0x12a6e1();});}else{_0x12a6e1();}});});}function getTags(_0x279d0b,_0x18723a,_0x2ecd23,_0x5ca64d,_0x4b9741,_0x4c00ef){return function(_0x55916b){return new Promise(function(_0x48066c,_0xa3c78b){var _0x85568f=[];var _0xd4c8a6=_0x5ca64d[_0xd833('0x4c')];if(_0xd4c8a6&&_0xd4c8a6['length']>0x0){_0x85568f=_[_0xd833('0x4d')](_0xd4c8a6,_0xd833('0x39'));}if(_0x85568f[_0xd833('0x29')]>0x0){return manageTags(_0x279d0b,_0x85568f,_0x18723a,_0x2ecd23,_0x55916b,_0x4b9741,_0x4c00ef)[_0xd833('0xd')](function(){_0x48066c(_0x55916b);});}else{_0x48066c(_0x55916b);}});};}function emit(_0x5c3246,_0xd24780,_0x24a01d){var _0x201707=_0xd833('0x4e')+_0xd833('0x4f')+_0xd833('0x50')+_0xd833('0x51');var _0xef679e={'uri':_0x5c3246+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x24a01d+_0x201707};io['to'](util[_0xd833('0x52')](_0xd833('0x53'),_0xd24780))[_0xd833('0x54')](_0xd833('0x55'),_0xef679e);}exports['cs']=function(_0x1e2a66,_0x2123d5,_0x4d8277,_0x15acad,_0x43a557,_0x3afaf6,_0x2bc790,_0x184414){var _0x49946d={};var _0x444643={'user':_0x3afaf6[_0xd833('0x56')],'pass':_0x3afaf6['password']};var _0x80d6c9='sysparm_limit=1';var _0x40acb9='sysparm_display_value=true';_0x3afaf6[_0xd833('0x57')]=intUtil[_0xd833('0x58')](_0x3afaf6[_0xd833('0x57')]);_0x3afaf6['serverUrl']=intUtil[_0xd833('0x58')](_0x3afaf6[_0xd833('0x59')]);var _0x33b52d=util[_0xd833('0x52')](_0xd833('0x5a'),_0x3afaf6[_0xd833('0x57')]);_0x49946d[_0xd833('0x19')]=!_['isNil'](_0x15acad)?_0x15acad[_0xd833('0x5b')]:null;_0x49946d[_0xd833('0x5c')]=_0x3afaf6[_0xd833('0x5b')];_0x49946d[_0xd833('0x23')]=_0x184414[_0xd833('0x33')]()===_0xd833('0x3b')?_0x2123d5[_0xd833('0x5d')]:_0x2123d5[_0xd833('0x5e')];_0x49946d[_0xd833('0x5f')]=_0x184414===_0xd833('0x60')||_0x184414==='unmanaged'?_0xd833('0x60'):_0xd833('0x3b');var _0x5b93b4=util[_0xd833('0x52')](_0xd833('0x61'),_0x3afaf6[_0xd833('0x59')],_0x2123d5[_0xd833('0x62')],md5(_0x2123d5[_0xd833('0x62')]));if(_0x43a557&&_0x43a557[_0xd833('0x63')]){logger[_0xd833('0x11')](_0xd833('0x64'),'Recording\x20is\x20enabled!');_0x2123d5[_0xd833('0x65')]=_0x5b93b4;}else if(_0x2bc790&&_0x2bc790[_0xd833('0x66')]&&_0x2bc790[_0xd833('0x66')]!==_0xd833('0x67')){logger[_0xd833('0x11')](_0xd833('0x68'),'Recording\x20is\x20enabled!');_0x2123d5[_0xd833('0x65')]=_0x5b93b4;}else{_0x2123d5['recordingURL']='';}return getAdminUser(_0x184414,_0x444643,_0x49946d,_0x33b52d,_0x40acb9,_0x80d6c9)[_0xd833('0xd')](getUser(_0x184414,_0x444643,_0x33b52d,_0x40acb9,_0x80d6c9))['then'](getEndUser(_0x184414,_0x444643,_0x33b52d,_0x40acb9,_0x80d6c9))['then'](getTicket(_0x184414,_0x444643,_0x33b52d,_0x4d8277,_0x2123d5,_0x40acb9))[_0xd833('0xd')](function(_0x42b9f6){logger[_0xd833('0x11')](util[_0xd833('0x52')]('The\x20ticket\x20ID\x20is:\x20%s',_0x42b9f6['ticketId']));logger['info'](util[_0xd833('0x52')]('call\x20direction:\x20%s',_0x184414));if(_0x184414!==_0xd833('0x69')){logger[_0xd833('0x11')]('['+[_0x184414[_0xd833('0x12')]()]+']',_0xd833('0x6a'));emit(_0x3afaf6[_0xd833('0x57')],_0x15acad[_0xd833('0x39')],_0x42b9f6[_0xd833('0x42')]);}})['catch'](function(_0x311e34){logger['error']('['+[_0x184414['toUpperCase']()]+_0xd833('0x6b'),util[_0xd833('0x6c')](_0x311e34,{'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 d3a92be..dbf36c2 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 _0xbb30=['util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','POST','emit','info','name','created_by','Descriptions','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','direction','length','forEach','variableName','set_entry','JSON','format','Basic\x20%s','apiKey','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','entry_list','find','user_name','value','Agent\x20found!','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','resolve','Searching\x20enduser\x20with\x20phone','stringify','Contacts','phone_home','then','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','debug','[HTTP]','merge','map','type','string','nameField','customField','content','toString','idField','custom_fields','push','variable','customVariable','Variable','toLowerCase','login','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','set_relationship','remoteUri','stripTrailingSlash','serverUrl','uri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','trigger:browser:url','catch','error','outbound','%s/service/v4_1/rest.php','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridnum','Fields','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','toUpperCase','isNil','The\x20User\x20ID\x20is:','lastevent','lodash','request-promise','md5'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xbb30,0xe7));var _0x0bb3=function(_0x39be65,_0x1bf309){_0x39be65=_0x39be65-0x0;var _0x4f35a8=_0xbb30[_0x39be65];return _0x4f35a8;};'use strict';var _=require(_0x0bb3('0x0'));var rp=require(_0x0bb3('0x1'));var BPromise=require('bluebird');var md5=require(_0x0bb3('0x2'));var util=require(_0x0bb3('0x3'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x0bb3('0x4'));var logger=require(_0x0bb3('0x5'))(_0x0bb3('0x6'));config[_0x0bb3('0x7')]=_[_0x0bb3('0x8')](config['redis'],{'host':_0x0bb3('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0bb3('0x7')]));var def={'method':_0x0bb3('0xa'),'json':!![]};function emit(_0x184ff2,_0x26564b,_0x21ef40){io['to'](_0x184ff2)[_0x0bb3('0xb')](_0x26564b,_0x21ef40);}function getTicket(_0x31acfc,_0x27e482,_0x183157,_0x4573e5,_0x472ddd,_0x34b71b,_0x42b057,_0x40fbd6){logger[_0x0bb3('0xc')]('Creating\x20new\x20ticket...');var _0x131bd2=new Date();var _0x453a4b=[{'name':_0x0bb3('0xd'),'value':intUtil['getString'](_0x4573e5['Subjects'],_0x472ddd,'\x20')},{'name':'assigned_user_id','value':_0x27e482['id']},{'name':_0x0bb3('0xe'),'value':_0x27e482['id']},{'name':'description','value':intUtil['getString'](_0x4573e5[_0x0bb3('0xf')],_0x472ddd,'\x0a')},{'name':_0x0bb3('0x10'),'value':_0x131bd2[_0x0bb3('0x11')]()[_0x0bb3('0x12')](0x0,0x13)[_0x0bb3('0x13')]('T','\x20')},{'name':_0x0bb3('0x14'),'value':'0'},{'name':_0x0bb3('0x15'),'value':'15'},{'name':_0x0bb3('0x16'),'value':_0x183157['id']},{'name':'parent_type','value':'Contacts'},{'name':'parent_name','value':_0x183157[_0x0bb3('0xd')]},{'name':_0x0bb3('0x17'),'value':_0x40fbd6}];if(_0x34b71b[_0x0bb3('0x18')]){_[_0x0bb3('0x19')](_0x34b71b,function(_0x4053b1){if(_0x472ddd[_0x4053b1['variableName']]){_0x453a4b['push']({'name':_0x4053b1['idField'],'value':_0x472ddd[_0x4053b1[_0x0bb3('0x1a')]]});}});}return request({'form':{'method':_0x0bb3('0x1b'),'input_type':_0x0bb3('0x1c'),'response_type':_0x0bb3('0x1c'),'rest_data':JSON['stringify']({'session':_0x42b057['id'],'module_name':'Calls','name_value_list':_0x453a4b})}});}function getAuth(_0x27ec03){return util[_0x0bb3('0x1d')](_0x0bb3('0x1e'),new Buffer(_0x27ec03[_0x0bb3('0x1f')]+':X')['toString']('base64'));}function getServerInfo(_0x180152){return request({'form':{'method':'get_server_info','input_type':'JSON','response_type':_0x0bb3('0x1c'),'rest_data':JSON['stringify']({'session':_0x180152['id']})}});}function getUser(_0x3f8abb,_0x44f7c1,_0x20d73d){if(!_['isNil'](_0x44f7c1)){logger[_0x0bb3('0xc')](_0x0bb3('0x20'),_0x44f7c1);return request({'form':{'method':_0x0bb3('0x21'),'input_type':_0x0bb3('0x1c'),'response_type':_0x0bb3('0x1c'),'rest_data':JSON['stringify']({'session':_0x20d73d['id'],'module_name':_0x0bb3('0x22'),'query':util[_0x0bb3('0x1d')](_0x0bb3('0x23'),_0x44f7c1),'order_by':'','offset':'0','select_fields':['id',_0x0bb3('0xd'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x4e2886){if(_0x4e2886[_0x0bb3('0x24')][_0x0bb3('0x18')]){var _0x1c3d0a=_[_0x0bb3('0x25')](_0x4e2886[_0x0bb3('0x24')],function(_0x874aa7){return _0x874aa7['name_value_list'][_0x0bb3('0x26')][_0x0bb3('0x27')]===_0x44f7c1;});if(_0x1c3d0a){logger['info'](_0x0bb3('0x28'));return BPromise['resolve']({'id':_0x1c3d0a[_0x0bb3('0x29')]['id'][_0x0bb3('0x27')],'name':_0x1c3d0a[_0x0bb3('0x29')][_0x0bb3('0xd')][_0x0bb3('0x27')]});}}logger['info'](_0x0bb3('0x2a'));return BPromise['resolve']({'id':_0x20d73d['name_value_list'][_0x0bb3('0x2b')]['value'],'name':_0x20d73d['name_value_list'][_0x0bb3('0x26')][_0x0bb3('0x27')]});});}else{logger[_0x0bb3('0xc')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x0bb3('0x2c')]({'id':_0x20d73d[_0x0bb3('0x29')][_0x0bb3('0x2b')]['value'],'name':_0x20d73d[_0x0bb3('0x29')][_0x0bb3('0x26')][_0x0bb3('0x27')]});}}function getEndUser(_0x558624,_0x1bf5e3,_0xb7e6be,_0x55638e){logger[_0x0bb3('0xc')](_0x0bb3('0x2d'),_0xb7e6be);return request({'form':{'method':_0x0bb3('0x21'),'input_type':_0x0bb3('0x1c'),'response_type':_0x0bb3('0x1c'),'rest_data':JSON[_0x0bb3('0x2e')]({'session':_0x55638e['id'],'module_name':_0x0bb3('0x2f'),'query':util[_0x0bb3('0x1d')]('contacts.phone_home\x20=\x20\x22%s\x22',_0xb7e6be),'order_by':'','offset':'0','select_fields':['id',_0x0bb3('0xd'),_0x0bb3('0x30')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x0bb3('0x31')](function(_0xa75ccd){if(_0xa75ccd[_0x0bb3('0x24')]['length']){var _0x14aa66=_[_0x0bb3('0x25')](_0xa75ccd[_0x0bb3('0x24')],function(_0x4e34f6){return _0x4e34f6[_0x0bb3('0x29')][_0x0bb3('0x30')][_0x0bb3('0x27')]===_0xb7e6be;});if(_0x14aa66){logger[_0x0bb3('0xc')](_0x0bb3('0x32'));return BPromise[_0x0bb3('0x2c')]({'id':_0x14aa66[_0x0bb3('0x29')]['id'][_0x0bb3('0x27')],'name':_0x14aa66[_0x0bb3('0x29')][_0x0bb3('0xd')][_0x0bb3('0x27')],'phone':_0x14aa66['name_value_list']['phone_home'][_0x0bb3('0x27')]});}}else{logger[_0x0bb3('0xc')](_0x0bb3('0x33'));return request({'form':{'method':_0x0bb3('0x1b'),'input_type':_0x0bb3('0x1c'),'response_type':_0x0bb3('0x1c'),'rest_data':JSON[_0x0bb3('0x2e')]({'session':_0x55638e['id'],'module_name':_0x0bb3('0x2f'),'name_value_list':[{'name':_0x0bb3('0x34'),'value':_0x1bf5e3!==_0x0bb3('0x35')?_0x1bf5e3:util[_0x0bb3('0x1d')](_0x0bb3('0x36'),_0xb7e6be)},{'name':_0x0bb3('0x30'),'value':_0xb7e6be}]})}})['then'](function(_0x431c20){logger['info']('Enduser\x20created.');return BPromise[_0x0bb3('0x2c')]({'id':_0x431c20['id'],'name':_0x431c20[_0x0bb3('0x24')]['first_name'][_0x0bb3('0x27')],'phone':_0x431c20[_0x0bb3('0x24')][_0x0bb3('0x30')]['value']});});}});}function request(_0x27e86d){logger[_0x0bb3('0x37')](_0x0bb3('0x38'),JSON[_0x0bb3('0x2e')](_0x27e86d));return rp(_[_0x0bb3('0x39')](def,_0x27e86d));}function getTags(_0x3ac006,_0x3f68dc){var _0x23fd11=[];if(_0x3ac006&&_0x3ac006[_0x0bb3('0x18')]>0x0){_0x23fd11=_[_0x0bb3('0x3a')](_0x3ac006,_0x3f68dc);}return _0x23fd11;}function getCustomFields(_0x141c43,_0x5c985){var _0x53567d=[];var _0x5e72a3={'custom_fields':[]};if(_0x141c43['length']>0x0){_[_0x0bb3('0x19')](_0x141c43,function(_0x518df8){if(_0x518df8[_0x0bb3('0x3b')]===_0x0bb3('0x3c')&&_0x518df8[_0x0bb3('0x3d')]&&!_0x518df8[_0x0bb3('0x3e')]){_0x5e72a3[_0x518df8[_0x0bb3('0x3d')]['toLowerCase']()]=_0x518df8[_0x0bb3('0x3f')][_0x0bb3('0x40')]();}else if(_0x518df8[_0x0bb3('0x3b')]===_0x0bb3('0x3c')&&_0x518df8[_0x0bb3('0x41')]&&_0x518df8[_0x0bb3('0x3e')]){_0x5e72a3[_0x0bb3('0x42')][_0x0bb3('0x43')]({'id':_0x518df8['idField'],'value':_0x518df8[_0x0bb3('0x3f')][_0x0bb3('0x40')]()});}else if(_0x518df8['type']===_0x0bb3('0x44')&&_0x518df8[_0x0bb3('0x1a')]&&_0x518df8[_0x0bb3('0x41')]&&_0x518df8[_0x0bb3('0x3e')]){_0x5c985[_0x518df8[_0x0bb3('0x1a')]]&&_0x5e72a3[_0x0bb3('0x42')]['push']({'id':_0x518df8[_0x0bb3('0x41')],'value':_0x5c985[_0x518df8[_0x0bb3('0x1a')]][_0x0bb3('0x40')]()});}else if(_0x518df8[_0x0bb3('0x3b')]===_0x0bb3('0x45')&&_0x518df8[_0x0bb3('0x46')]&&_0x518df8[_0x0bb3('0x46')][_0x0bb3('0xd')]&&_0x518df8[_0x0bb3('0x41')]&&_0x518df8['customField']){_0x5c985[_0x518df8['Variable'][_0x0bb3('0xd')][_0x0bb3('0x47')]()]&&_0x5e72a3[_0x0bb3('0x42')][_0x0bb3('0x43')]({'id':_0x518df8[_0x0bb3('0x41')],'value':_0x5c985[_0x518df8[_0x0bb3('0x46')][_0x0bb3('0xd')][_0x0bb3('0x47')]()]['toString']()});}});}return _0x5e72a3;}function getConnection(_0x277e7d){return request({'method':_0x0bb3('0xa'),'form':{'method':_0x0bb3('0x48'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x0bb3('0x2e')]({'user_auth':{'user_name':_0x277e7d['username'],'password':_0x277e7d[_0x0bb3('0x49')],'encryption':_0x0bb3('0x4a')},'application':_0x0bb3('0x4b')})}})['then'](function(_0x48a9bb){var _0x1c8751=_0x48a9bb;if(_0x1c8751['id']){def[_0x0bb3('0x4c')]=_0x1c8751['id'];return BPromise[_0x0bb3('0x2c')](_0x1c8751);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x277e7d['id']));}});}function setRelationship(_0x6bb2dd,_0x5e4238,_0x37eb60,_0x4edad6){return request({'form':{'method':_0x0bb3('0x4d'),'input_type':_0x0bb3('0x1c'),'response_type':_0x0bb3('0x1c'),'rest_data':JSON[_0x0bb3('0x2e')]({'session':_0x6bb2dd['id'],'module_name':'Calls','module_id':_0x37eb60['id'],'link_field_name':_0x4edad6,'related_ids':[_0x5e4238['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x18d9f8,_0x514fa2,_0x286a75,_0x5b39e2,_0x232830,_0x2cbe33){var _0x24b0e8,_0xe04fcf,_0x253c0e,_0x5f0225;_0x2cbe33[_0x0bb3('0x4e')]=intUtil[_0x0bb3('0x4f')](_0x2cbe33[_0x0bb3('0x4e')]);_0x2cbe33[_0x0bb3('0x50')]=intUtil[_0x0bb3('0x4f')](_0x2cbe33['serverUrl']);def[_0x0bb3('0x51')]=util['format']('%s/service/v4_1/rest.php',_0x2cbe33[_0x0bb3('0x4e')]);if(_0x232830&&_0x232830[_0x0bb3('0x52')]){logger[_0x0bb3('0xc')](_0x0bb3('0x53'),_0x0bb3('0x54'));_0x514fa2[_0x0bb3('0x55')]=util[_0x0bb3('0x1d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2cbe33[_0x0bb3('0x50')],_0x514fa2[_0x0bb3('0x56')],md5(_0x514fa2[_0x0bb3('0x56')]));}else{_0x514fa2[_0x0bb3('0x55')]='';}return getConnection(_0x2cbe33)['then'](function(_0x53c565){_0x5f0225=_0x53c565;return getUser(_0x2cbe33,_0x5b39e2[_0x0bb3('0xd')],_0x5f0225);})['then'](function(_0x3588c6){_0x24b0e8=_0x3588c6;logger[_0x0bb3('0xc')]('The\x20User\x20ID\x20is:',_0x24b0e8['id']);return getEndUser(_0x2cbe33,_0x514fa2[_0x0bb3('0x57')],_0x514fa2[_0x0bb3('0x58')],_0x5f0225);})[_0x0bb3('0x31')](function(_0x7ce4a2){_0xe04fcf=_0x7ce4a2;logger[_0x0bb3('0xc')](_0x0bb3('0x59'),_0xe04fcf['id']);return getTicket(_0x2cbe33,_0x24b0e8,_0xe04fcf,_0x286a75,_0x514fa2,_0x286a75['Fields'],_0x5f0225,_0x0bb3('0x5a'));})[_0x0bb3('0x31')](function(_0x5bbeff){_0x253c0e=_0x5bbeff;logger[_0x0bb3('0xc')](_0x0bb3('0x5b'));logger[_0x0bb3('0xc')](_0x0bb3('0x5c'),_0x253c0e['id']);return setRelationship(_0x5f0225,_0x24b0e8,_0x253c0e,_0x0bb3('0x5d'));})[_0x0bb3('0x31')](function(){return setRelationship(_0x5f0225,_0xe04fcf,_0x253c0e,_0x0bb3('0x5e'));})[_0x0bb3('0x31')](function(){return getServerInfo(_0x5f0225);})[_0x0bb3('0x31')](function(_0x29133c){var _0x2ac48c=parseInt(_0x29133c[_0x0bb3('0x5f')][_0x0bb3('0x60')](0x0));var _0x36afd9=util[_0x0bb3('0x1d')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x2cbe33[_0x0bb3('0x4e')],_0x253c0e['id']);if(_0x2ac48c>0x6){_0x36afd9=util[_0x0bb3('0x1d')](_0x0bb3('0x61'),_0x2cbe33[_0x0bb3('0x4e')],_0x253c0e['id']);}logger['info'](_0x0bb3('0x53'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x0bb3('0x1d')](_0x0bb3('0x62'),_0x5b39e2['name']),_0x0bb3('0x63'),{'uri':_0x36afd9});})[_0x0bb3('0x64')](function(_0x1196bf){logger[_0x0bb3('0x65')](_0x0bb3('0x53'),JSON[_0x0bb3('0x2e')](_0x1196bf));});};exports[_0x0bb3('0x66')]=function(_0x57ada7,_0x1b0622,_0x3969a3,_0x4dd5b6,_0x521bd4,_0x4c300d,_0x1392b5){var _0x5f5356,_0xbce591,_0x573bde,_0x4c596d;_0x4c300d['remoteUri']=intUtil['stripTrailingSlash'](_0x4c300d['remoteUri']);_0x4c300d['serverUrl']=intUtil[_0x0bb3('0x4f')](_0x4c300d[_0x0bb3('0x50')]);def[_0x0bb3('0x51')]=util[_0x0bb3('0x1d')](_0x0bb3('0x67'),_0x4c300d[_0x0bb3('0x4e')]);if(_0x1392b5&&_0x1392b5[_0x0bb3('0x68')]&&_0x1392b5[_0x0bb3('0x68')]!==_0x0bb3('0x69')){logger[_0x0bb3('0xc')]('[OUTBOUND]',_0x0bb3('0x54'));_0x1b0622[_0x0bb3('0x55')]=util[_0x0bb3('0x1d')](_0x0bb3('0x6a'),_0x4c300d[_0x0bb3('0x50')],_0x1b0622[_0x0bb3('0x56')],md5(_0x1b0622[_0x0bb3('0x56')]));}return getConnection(_0x4c300d)[_0x0bb3('0x31')](function(_0xea8351){_0x4c596d=_0xea8351;return getUser(_0x4c300d,_0x4dd5b6[_0x0bb3('0xd')],_0x4c596d);})['then'](function(_0x210a9f){_0x5f5356=_0x210a9f;logger['info']('The\x20User\x20ID\x20is:',_0x5f5356['id']);return getEndUser(_0x4c300d,_0x1b0622['destcalleridname'],_0x1b0622[_0x0bb3('0x6b')],_0x4c596d);})[_0x0bb3('0x31')](function(_0x314198){_0xbce591=_0x314198;logger[_0x0bb3('0xc')](_0x0bb3('0x59'),_0xbce591['id']);return getTicket(_0x4c300d,_0x5f5356,_0xbce591,_0x3969a3,_0x1b0622,_0x3969a3[_0x0bb3('0x6c')],_0x4c596d,'Outbound');})[_0x0bb3('0x31')](function(_0x1687f8){_0x573bde=_0x1687f8;logger[_0x0bb3('0xc')](_0x0bb3('0x5b'));logger[_0x0bb3('0xc')](_0x0bb3('0x5c'),_0x573bde['id']);return setRelationship(_0x4c596d,_0x5f5356,_0x573bde,_0x0bb3('0x5d'));})['then'](function(){return setRelationship(_0x4c596d,_0xbce591,_0x573bde,'contacts');})[_0x0bb3('0x31')](function(){return getServerInfo(_0x4c596d);})['then'](function(_0x4bd046){var _0x3d1a70=parseInt(_0x4bd046[_0x0bb3('0x5f')][_0x0bb3('0x60')](0x0));var _0x2047e0=util['format'](_0x0bb3('0x6d'),_0x4c300d[_0x0bb3('0x4e')],_0x573bde['id']);if(_0x3d1a70>0x6){_0x2047e0=util[_0x0bb3('0x1d')](_0x0bb3('0x61'),_0x4c300d[_0x0bb3('0x4e')],_0x573bde['id']);}logger[_0x0bb3('0xc')](_0x0bb3('0x6e'),_0x0bb3('0x6f'));emit(util[_0x0bb3('0x1d')](_0x0bb3('0x62'),_0x4dd5b6['name']),_0x0bb3('0x63'),{'uri':_0x2047e0});})[_0x0bb3('0x64')](function(_0x472fa5){logger['error']('[OUTBOUND]',JSON['stringify'](_0x472fa5));});};exports[_0x0bb3('0x70')]=function(_0x5afb42,_0x2de024,_0x5e3317,_0x3e1d5e,_0x198848,_0x30178a){var _0x339cf1,_0x3d9724,_0x4bfe51,_0xffa4d0;_0x30178a[_0x0bb3('0x4e')]=intUtil[_0x0bb3('0x4f')](_0x30178a[_0x0bb3('0x4e')]);_0x30178a[_0x0bb3('0x50')]=intUtil[_0x0bb3('0x4f')](_0x30178a[_0x0bb3('0x50')]);def['uri']=util[_0x0bb3('0x1d')](_0x0bb3('0x67'),_0x30178a[_0x0bb3('0x4e')]);if(_0x198848&&_0x198848['monitor_format']){logger[_0x0bb3('0xc')]('['+_0x2de024['lastevent'][_0x0bb3('0x71')]()+']','Recording\x20is\x20enabled!');_0x2de024[_0x0bb3('0x55')]=util[_0x0bb3('0x1d')](_0x0bb3('0x6a'),_0x30178a[_0x0bb3('0x50')],_0x2de024[_0x0bb3('0x56')],md5(_0x2de024[_0x0bb3('0x56')]));}else{_0x2de024[_0x0bb3('0x55')]='';}return getConnection(_0x30178a)['then'](function(_0x3788f8){_0xffa4d0=_0x3788f8;if(!_[_0x0bb3('0x72')](_0x3e1d5e)){return getUser(_0x30178a,_0x3e1d5e[_0x0bb3('0xd')],_0xffa4d0);}else{return getUser(_0x30178a,null,_0xffa4d0);}})['then'](function(_0xe025d4){_0x339cf1=_0xe025d4;logger[_0x0bb3('0xc')](_0x0bb3('0x73'),_0x339cf1['id']);return getEndUser(_0x30178a,_0x2de024[_0x0bb3('0x57')],_0x2de024[_0x0bb3('0x58')],_0xffa4d0);})['then'](function(_0x38b551){_0x3d9724=_0x38b551;logger[_0x0bb3('0xc')](_0x0bb3('0x59'),_0x3d9724['id']);return getTicket(_0x30178a,_0x339cf1,_0x3d9724,_0x5e3317,_0x2de024,_0x5e3317[_0x0bb3('0x6c')],_0xffa4d0,'Inbound');})[_0x0bb3('0x31')](function(_0x1c2214){_0x4bfe51=_0x1c2214;logger['info'](_0x0bb3('0x5b'));logger[_0x0bb3('0xc')](_0x0bb3('0x5c'),_0x4bfe51['id']);return setRelationship(_0xffa4d0,_0x339cf1,_0x4bfe51,_0x0bb3('0x5d'));})[_0x0bb3('0x31')](function(){return setRelationship(_0xffa4d0,_0x3d9724,_0x4bfe51,'contacts');})[_0x0bb3('0x31')](function(){return getServerInfo(_0xffa4d0);})[_0x0bb3('0x64')](function(_0x237c6b){logger['error']('['+_0x2de024[_0x0bb3('0x74')][_0x0bb3('0x71')]()+']',JSON[_0x0bb3('0x2e')](_0x237c6b));});}; \ No newline at end of file +var _0x9566=['debug','merge','map','forEach','type','string','nameField','customField','toLowerCase','content','variable','customVariable','Variable','custom_fields','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','recordingURL','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Inbound','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','user:%s','trigger:browser:url','error','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','Outbound','Ticket\x20created!','users','version','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','lastevent','calleridnum','Fields','The\x20Ticket\x20ID\x20is:','catch','toUpperCase','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','info','name','getString','assigned_user_id','description','Descriptions','date_start','slice','replace','duration_hours','duration_minutes','parent_id','Contacts','direction','variableName','push','idField','set_entry','JSON','stringify','format','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','length','find','value','Agent\x20found!','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','user_name','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','first_name','','Caller\x20-\x20%s','Enduser\x20created.'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x9566,0x1ae));var _0x6956=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x9566[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x6956('0x0'));var rp=require(_0x6956('0x1'));var BPromise=require(_0x6956('0x2'));var md5=require(_0x6956('0x3'));var util=require('util');var Redis=require(_0x6956('0x4'));var intUtil=require(_0x6956('0x5'));var config=require(_0x6956('0x6'));var logger=require('../../../../config/logger')(_0x6956('0x7'));config[_0x6956('0x8')]=_[_0x6956('0x9')](config[_0x6956('0x8')],{'host':_0x6956('0xa'),'port':0x18eb});var io=require(_0x6956('0xb'))(new Redis(config[_0x6956('0x8')]));var def={'method':_0x6956('0xc'),'json':!![]};function emit(_0x1d906b,_0x5b198c,_0xa8f546){io['to'](_0x1d906b)['emit'](_0x5b198c,_0xa8f546);}function getTicket(_0x4bafc5,_0x22192a,_0x29d6e0,_0x5c59ba,_0x4b82f7,_0x2d2876,_0x29caf2,_0x3db32b){logger[_0x6956('0xd')]('Creating\x20new\x20ticket...');var _0x282228=new Date();var _0x43c40b=[{'name':_0x6956('0xe'),'value':intUtil[_0x6956('0xf')](_0x5c59ba['Subjects'],_0x4b82f7,'\x20')},{'name':_0x6956('0x10'),'value':_0x22192a['id']},{'name':'created_by','value':_0x22192a['id']},{'name':_0x6956('0x11'),'value':intUtil[_0x6956('0xf')](_0x5c59ba[_0x6956('0x12')],_0x4b82f7,'\x0a')},{'name':_0x6956('0x13'),'value':_0x282228['toISOString']()[_0x6956('0x14')](0x0,0x13)[_0x6956('0x15')]('T','\x20')},{'name':_0x6956('0x16'),'value':'0'},{'name':_0x6956('0x17'),'value':'15'},{'name':_0x6956('0x18'),'value':_0x29d6e0['id']},{'name':'parent_type','value':_0x6956('0x19')},{'name':'parent_name','value':_0x29d6e0['name']},{'name':_0x6956('0x1a'),'value':_0x3db32b}];if(_0x2d2876['length']){_['forEach'](_0x2d2876,function(_0x42ca7f){if(_0x4b82f7[_0x42ca7f[_0x6956('0x1b')]]){_0x43c40b[_0x6956('0x1c')]({'name':_0x42ca7f[_0x6956('0x1d')],'value':_0x4b82f7[_0x42ca7f['variableName']]});}});}return request({'form':{'method':_0x6956('0x1e'),'input_type':'JSON','response_type':_0x6956('0x1f'),'rest_data':JSON[_0x6956('0x20')]({'session':_0x29caf2['id'],'module_name':'Calls','name_value_list':_0x43c40b})}});}function getAuth(_0x514902){return util[_0x6956('0x21')]('Basic\x20%s',new Buffer(_0x514902[_0x6956('0x22')]+':X')[_0x6956('0x23')](_0x6956('0x24')));}function getServerInfo(_0x963173){return request({'form':{'method':_0x6956('0x25'),'input_type':_0x6956('0x1f'),'response_type':_0x6956('0x1f'),'rest_data':JSON[_0x6956('0x20')]({'session':_0x963173['id']})}});}function getUser(_0x3d66ac,_0x3f54de,_0x507578){if(!_[_0x6956('0x26')](_0x3f54de)){logger[_0x6956('0xd')](_0x6956('0x27'),_0x3f54de);return request({'form':{'method':_0x6956('0x28'),'input_type':'JSON','response_type':_0x6956('0x1f'),'rest_data':JSON[_0x6956('0x20')]({'session':_0x507578['id'],'module_name':_0x6956('0x29'),'query':util['format'](_0x6956('0x2a'),_0x3f54de),'order_by':'','offset':'0','select_fields':['id','name','user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x6956('0x2b')](function(_0xdf6a53){if(_0xdf6a53[_0x6956('0x2c')][_0x6956('0x2d')]){var _0x4e84a8=_[_0x6956('0x2e')](_0xdf6a53['entry_list'],function(_0x1abfe4){return _0x1abfe4['name_value_list']['user_name'][_0x6956('0x2f')]===_0x3f54de;});if(_0x4e84a8){logger['info'](_0x6956('0x30'));return BPromise['resolve']({'id':_0x4e84a8[_0x6956('0x31')]['id']['value'],'name':_0x4e84a8[_0x6956('0x31')][_0x6956('0xe')][_0x6956('0x2f')]});}}logger[_0x6956('0xd')](_0x6956('0x32'));return BPromise[_0x6956('0x33')]({'id':_0x507578[_0x6956('0x31')][_0x6956('0x34')]['value'],'name':_0x507578[_0x6956('0x31')][_0x6956('0x35')][_0x6956('0x2f')]});});}else{logger[_0x6956('0xd')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x6956('0x33')]({'id':_0x507578[_0x6956('0x31')][_0x6956('0x34')]['value'],'name':_0x507578[_0x6956('0x31')][_0x6956('0x35')][_0x6956('0x2f')]});}}function getEndUser(_0x466096,_0x105330,_0x1b5274,_0x667008){logger[_0x6956('0xd')](_0x6956('0x36'),_0x1b5274);return request({'form':{'method':_0x6956('0x28'),'input_type':_0x6956('0x1f'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x667008['id'],'module_name':_0x6956('0x19'),'query':util['format'](_0x6956('0x37'),_0x1b5274),'order_by':'','offset':'0','select_fields':['id',_0x6956('0xe'),_0x6956('0x38')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x288801){if(_0x288801[_0x6956('0x2c')][_0x6956('0x2d')]){var _0x4bf854=_[_0x6956('0x2e')](_0x288801[_0x6956('0x2c')],function(_0x3225f4){return _0x3225f4[_0x6956('0x31')][_0x6956('0x38')]['value']===_0x1b5274;});if(_0x4bf854){logger['info'](_0x6956('0x39'));return BPromise[_0x6956('0x33')]({'id':_0x4bf854[_0x6956('0x31')]['id'][_0x6956('0x2f')],'name':_0x4bf854[_0x6956('0x31')][_0x6956('0xe')][_0x6956('0x2f')],'phone':_0x4bf854['name_value_list'][_0x6956('0x38')][_0x6956('0x2f')]});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x6956('0x1e'),'input_type':_0x6956('0x1f'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x667008['id'],'module_name':_0x6956('0x19'),'name_value_list':[{'name':_0x6956('0x3a'),'value':_0x105330!==_0x6956('0x3b')?_0x105330:util[_0x6956('0x21')](_0x6956('0x3c'),_0x1b5274)},{'name':_0x6956('0x38'),'value':_0x1b5274}]})}})['then'](function(_0x2c1841){logger['info'](_0x6956('0x3d'));return BPromise[_0x6956('0x33')]({'id':_0x2c1841['id'],'name':_0x2c1841[_0x6956('0x2c')][_0x6956('0x3a')][_0x6956('0x2f')],'phone':_0x2c1841[_0x6956('0x2c')][_0x6956('0x38')][_0x6956('0x2f')]});});}});}function request(_0x390d46){logger[_0x6956('0x3e')]('[HTTP]',JSON['stringify'](_0x390d46));return rp(_[_0x6956('0x3f')](def,_0x390d46));}function getTags(_0x56333b,_0x555d1a){var _0x6be6de=[];if(_0x56333b&&_0x56333b['length']>0x0){_0x6be6de=_[_0x6956('0x40')](_0x56333b,_0x555d1a);}return _0x6be6de;}function getCustomFields(_0x10bdc2,_0x4b46d3){var _0x7415ab=[];var _0x56c947={'custom_fields':[]};if(_0x10bdc2[_0x6956('0x2d')]>0x0){_[_0x6956('0x41')](_0x10bdc2,function(_0x383852){if(_0x383852[_0x6956('0x42')]===_0x6956('0x43')&&_0x383852[_0x6956('0x44')]&&!_0x383852[_0x6956('0x45')]){_0x56c947[_0x383852[_0x6956('0x44')][_0x6956('0x46')]()]=_0x383852[_0x6956('0x47')][_0x6956('0x23')]();}else if(_0x383852['type']===_0x6956('0x43')&&_0x383852[_0x6956('0x1d')]&&_0x383852['customField']){_0x56c947['custom_fields'][_0x6956('0x1c')]({'id':_0x383852['idField'],'value':_0x383852['content'][_0x6956('0x23')]()});}else if(_0x383852[_0x6956('0x42')]===_0x6956('0x48')&&_0x383852['variableName']&&_0x383852['idField']&&_0x383852[_0x6956('0x45')]){_0x4b46d3[_0x383852[_0x6956('0x1b')]]&&_0x56c947['custom_fields'][_0x6956('0x1c')]({'id':_0x383852[_0x6956('0x1d')],'value':_0x4b46d3[_0x383852[_0x6956('0x1b')]][_0x6956('0x23')]()});}else if(_0x383852[_0x6956('0x42')]===_0x6956('0x49')&&_0x383852[_0x6956('0x4a')]&&_0x383852['Variable']['name']&&_0x383852[_0x6956('0x1d')]&&_0x383852[_0x6956('0x45')]){_0x4b46d3[_0x383852[_0x6956('0x4a')][_0x6956('0xe')]['toLowerCase']()]&&_0x56c947[_0x6956('0x4b')][_0x6956('0x1c')]({'id':_0x383852[_0x6956('0x1d')],'value':_0x4b46d3[_0x383852[_0x6956('0x4a')][_0x6956('0xe')][_0x6956('0x46')]()]['toString']()});}});}return _0x56c947;}function getConnection(_0x1470ea){return request({'method':'POST','form':{'method':'login','input_type':_0x6956('0x1f'),'response_type':_0x6956('0x1f'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x1470ea[_0x6956('0x4c')],'password':_0x1470ea[_0x6956('0x4d')],'encryption':_0x6956('0x4e')},'application':_0x6956('0x4f')})}})[_0x6956('0x2b')](function(_0x26151c){var _0x14feec=_0x26151c;if(_0x14feec['id']){def[_0x6956('0x50')]=_0x14feec['id'];return BPromise[_0x6956('0x33')](_0x14feec);}else{throw new Error(util[_0x6956('0x21')](_0x6956('0x51'),_0x1470ea['id']));}});}function setRelationship(_0x56d3bc,_0x437221,_0x5a8e32,_0x479618){return request({'form':{'method':_0x6956('0x52'),'input_type':_0x6956('0x1f'),'response_type':_0x6956('0x1f'),'rest_data':JSON['stringify']({'session':_0x56d3bc['id'],'module_name':_0x6956('0x53'),'module_id':_0x5a8e32['id'],'link_field_name':_0x479618,'related_ids':[_0x437221['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x6956('0x54')]=function(_0x238bd5,_0x5d7cd0,_0x4cf219,_0x165b14,_0x40f29b,_0x4f3917){var _0x5538b7,_0xb57001,_0x236b0d,_0xef0cd6;_0x4f3917[_0x6956('0x55')]=intUtil['stripTrailingSlash'](_0x4f3917[_0x6956('0x55')]);_0x4f3917['serverUrl']=intUtil[_0x6956('0x56')](_0x4f3917[_0x6956('0x57')]);def[_0x6956('0x58')]=util[_0x6956('0x21')](_0x6956('0x59'),_0x4f3917[_0x6956('0x55')]);if(_0x40f29b&&_0x40f29b[_0x6956('0x5a')]){logger[_0x6956('0xd')](_0x6956('0x5b'),_0x6956('0x5c'));_0x5d7cd0['recordingURL']=util[_0x6956('0x21')](_0x6956('0x5d'),_0x4f3917[_0x6956('0x57')],_0x5d7cd0['uniqueid'],md5(_0x5d7cd0['uniqueid']));}else{_0x5d7cd0[_0x6956('0x5e')]='';}return getConnection(_0x4f3917)[_0x6956('0x2b')](function(_0x17d710){_0xef0cd6=_0x17d710;return getUser(_0x4f3917,_0x165b14[_0x6956('0xe')],_0xef0cd6);})[_0x6956('0x2b')](function(_0x1060d8){_0x5538b7=_0x1060d8;logger[_0x6956('0xd')](_0x6956('0x5f'),_0x5538b7['id']);return getEndUser(_0x4f3917,_0x5d7cd0[_0x6956('0x60')],_0x5d7cd0['calleridnum'],_0xef0cd6);})[_0x6956('0x2b')](function(_0x2dca20){_0xb57001=_0x2dca20;logger[_0x6956('0xd')](_0x6956('0x61'),_0xb57001['id']);return getTicket(_0x4f3917,_0x5538b7,_0xb57001,_0x4cf219,_0x5d7cd0,_0x4cf219['Fields'],_0xef0cd6,_0x6956('0x62'));})[_0x6956('0x2b')](function(_0x193c43){_0x236b0d=_0x193c43;logger[_0x6956('0xd')]('Ticket\x20created!');logger[_0x6956('0xd')]('The\x20Ticket\x20ID\x20is:',_0x236b0d['id']);return setRelationship(_0xef0cd6,_0x5538b7,_0x236b0d,'users');})['then'](function(){return setRelationship(_0xef0cd6,_0xb57001,_0x236b0d,_0x6956('0x63'));})[_0x6956('0x2b')](function(){return getServerInfo(_0xef0cd6);})[_0x6956('0x2b')](function(_0x54e7e8){var _0x1fe0d8=parseInt(_0x54e7e8['version'][_0x6956('0x64')](0x0));var _0x11935d=util[_0x6956('0x21')](_0x6956('0x65'),_0x4f3917[_0x6956('0x55')],_0x236b0d['id']);if(_0x1fe0d8>0x6){_0x11935d=util[_0x6956('0x21')](_0x6956('0x66'),_0x4f3917['remoteUri'],_0x236b0d['id']);}logger[_0x6956('0xd')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x6956('0x21')](_0x6956('0x67'),_0x165b14[_0x6956('0xe')]),_0x6956('0x68'),{'uri':_0x11935d});})['catch'](function(_0xcfa1c5){logger[_0x6956('0x69')](_0x6956('0x5b'),JSON[_0x6956('0x20')](_0xcfa1c5));});};exports[_0x6956('0x6a')]=function(_0x47a028,_0x5e2817,_0x29a196,_0x577db1,_0x5cc014,_0x27a817,_0x3ebd06){var _0x460ed1,_0x1dcadd,_0x44cce9,_0x25e05c;_0x27a817[_0x6956('0x55')]=intUtil[_0x6956('0x56')](_0x27a817[_0x6956('0x55')]);_0x27a817[_0x6956('0x57')]=intUtil[_0x6956('0x56')](_0x27a817['serverUrl']);def[_0x6956('0x58')]=util[_0x6956('0x21')]('%s/service/v4_1/rest.php',_0x27a817[_0x6956('0x55')]);if(_0x3ebd06&&_0x3ebd06[_0x6956('0x6b')]&&_0x3ebd06[_0x6956('0x6b')]!==_0x6956('0x6c')){logger[_0x6956('0xd')](_0x6956('0x6d'),_0x6956('0x5c'));_0x5e2817[_0x6956('0x5e')]=util[_0x6956('0x21')](_0x6956('0x5d'),_0x27a817[_0x6956('0x57')],_0x5e2817[_0x6956('0x6e')],md5(_0x5e2817[_0x6956('0x6e')]));}return getConnection(_0x27a817)[_0x6956('0x2b')](function(_0x509710){_0x25e05c=_0x509710;return getUser(_0x27a817,_0x577db1[_0x6956('0xe')],_0x25e05c);})['then'](function(_0x5ddd1d){_0x460ed1=_0x5ddd1d;logger['info'](_0x6956('0x5f'),_0x460ed1['id']);return getEndUser(_0x27a817,_0x5e2817['destcalleridname'],_0x5e2817['destcalleridnum'],_0x25e05c);})[_0x6956('0x2b')](function(_0x381117){_0x1dcadd=_0x381117;logger['info']('The\x20Enduser\x20ID\x20is:',_0x1dcadd['id']);return getTicket(_0x27a817,_0x460ed1,_0x1dcadd,_0x29a196,_0x5e2817,_0x29a196['Fields'],_0x25e05c,_0x6956('0x6f'));})[_0x6956('0x2b')](function(_0x4048b7){_0x44cce9=_0x4048b7;logger[_0x6956('0xd')](_0x6956('0x70'));logger[_0x6956('0xd')]('The\x20Ticket\x20ID\x20is:',_0x44cce9['id']);return setRelationship(_0x25e05c,_0x460ed1,_0x44cce9,_0x6956('0x71'));})['then'](function(){return setRelationship(_0x25e05c,_0x1dcadd,_0x44cce9,_0x6956('0x63'));})[_0x6956('0x2b')](function(){return getServerInfo(_0x25e05c);})['then'](function(_0x455135){var _0x5ed6c8=parseInt(_0x455135[_0x6956('0x72')][_0x6956('0x64')](0x0));var _0x3ff59a=util[_0x6956('0x21')](_0x6956('0x65'),_0x27a817[_0x6956('0x55')],_0x44cce9['id']);if(_0x5ed6c8>0x6){_0x3ff59a=util[_0x6956('0x21')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x27a817[_0x6956('0x55')],_0x44cce9['id']);}logger[_0x6956('0xd')]('[OUTBOUND]',_0x6956('0x73'));emit(util[_0x6956('0x21')](_0x6956('0x67'),_0x577db1[_0x6956('0xe')]),_0x6956('0x68'),{'uri':_0x3ff59a});})['catch'](function(_0x7c5fd7){logger[_0x6956('0x69')]('[OUTBOUND]',JSON[_0x6956('0x20')](_0x7c5fd7));});};exports[_0x6956('0x74')]=function(_0x40c2b4,_0x241f8d,_0x233093,_0x26c4e4,_0x4d3102,_0x1d2f03){var _0x2ae655,_0x1a50ad,_0x50e929,_0x5541a3;_0x1d2f03['remoteUri']=intUtil['stripTrailingSlash'](_0x1d2f03[_0x6956('0x55')]);_0x1d2f03[_0x6956('0x57')]=intUtil[_0x6956('0x56')](_0x1d2f03[_0x6956('0x57')]);def[_0x6956('0x58')]=util[_0x6956('0x21')](_0x6956('0x59'),_0x1d2f03[_0x6956('0x55')]);if(_0x4d3102&&_0x4d3102[_0x6956('0x5a')]){logger[_0x6956('0xd')]('['+_0x241f8d[_0x6956('0x75')]['toUpperCase']()+']',_0x6956('0x5c'));_0x241f8d[_0x6956('0x5e')]=util[_0x6956('0x21')](_0x6956('0x5d'),_0x1d2f03[_0x6956('0x57')],_0x241f8d[_0x6956('0x6e')],md5(_0x241f8d['uniqueid']));}else{_0x241f8d[_0x6956('0x5e')]='';}return getConnection(_0x1d2f03)['then'](function(_0x544fcf){_0x5541a3=_0x544fcf;if(!_[_0x6956('0x26')](_0x26c4e4)){return getUser(_0x1d2f03,_0x26c4e4[_0x6956('0xe')],_0x5541a3);}else{return getUser(_0x1d2f03,null,_0x5541a3);}})[_0x6956('0x2b')](function(_0x256ec8){_0x2ae655=_0x256ec8;logger[_0x6956('0xd')](_0x6956('0x5f'),_0x2ae655['id']);return getEndUser(_0x1d2f03,_0x241f8d[_0x6956('0x60')],_0x241f8d[_0x6956('0x76')],_0x5541a3);})[_0x6956('0x2b')](function(_0x181f4d){_0x1a50ad=_0x181f4d;logger[_0x6956('0xd')](_0x6956('0x61'),_0x1a50ad['id']);return getTicket(_0x1d2f03,_0x2ae655,_0x1a50ad,_0x233093,_0x241f8d,_0x233093[_0x6956('0x77')],_0x5541a3,'Inbound');})['then'](function(_0x45bc6b){_0x50e929=_0x45bc6b;logger[_0x6956('0xd')](_0x6956('0x70'));logger[_0x6956('0xd')](_0x6956('0x78'),_0x50e929['id']);return setRelationship(_0x5541a3,_0x2ae655,_0x50e929,_0x6956('0x71'));})['then'](function(){return setRelationship(_0x5541a3,_0x1a50ad,_0x50e929,_0x6956('0x63'));})[_0x6956('0x2b')](function(){return getServerInfo(_0x5541a3);})[_0x6956('0x79')](function(_0x3f3e04){logger[_0x6956('0x69')]('['+_0x241f8d[_0x6956('0x75')][_0x6956('0x7a')]()+']',JSON[_0x6956('0x20')](_0x3f3e04));});}; \ 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 35639c2..9c70623 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 _0x509a=['toString','Variable','name','toLowerCase','keyValue','keyType','%s:\x20%s','key','format','customVariable','join','stripTrailingSlash','slice','substring','lastIndexOf','isNil','test','util','type','string','push','variable','variableName'];(function(_0x5224b9,_0x195fcb){var _0x363bcc=function(_0x3d219a){while(--_0x3d219a){_0x5224b9['push'](_0x5224b9['shift']());}};_0x363bcc(++_0x195fcb);}(_0x509a,0x198));var _0xa509=function(_0x101116,_0xe71b75){_0x101116=_0x101116-0x0;var _0x25d117=_0x509a[_0x101116];return _0x25d117;};'use strict';var _=require('lodash');var util=require(_0xa509('0x0'));exports['getString']=function(_0x4e324d,_0x50d51f,_0x524fe6){var _0x16df14=[];if(_0x4e324d['length']>0x0){var _0x1b7300=_['sortBy'](_0x4e324d,['id']);for(var _0x44284a=0x0;_0x44284a<_0x1b7300['length'];_0x44284a++){var _0xd63db3=_0x1b7300[_0x44284a];if(_0xd63db3[_0xa509('0x1')]===_0xa509('0x2')){_0x16df14[_0xa509('0x3')](_0xd63db3['content']);}else if(_0xd63db3['type']===_0xa509('0x4')&&_0xd63db3[_0xa509('0x5')]){_0x50d51f[_0xd63db3[_0xa509('0x5')]]&&_0x16df14['push'](_0x50d51f[_0xd63db3[_0xa509('0x5')]][_0xa509('0x6')]());}else if(_0xd63db3[_0xa509('0x1')]==='customVariable'&&_0xd63db3[_0xa509('0x7')]&&_0xd63db3[_0xa509('0x7')][_0xa509('0x8')]){_0x50d51f[_0xd63db3[_0xa509('0x7')][_0xa509('0x8')][_0xa509('0x9')]()]&&_0x16df14['push'](_0x50d51f[_0xd63db3[_0xa509('0x7')]['name'][_0xa509('0x9')]()][_0xa509('0x6')]());}else if(_0xd63db3[_0xa509('0x1')]===_0xa509('0xa')){if(_0xd63db3[_0xa509('0xb')]==='string'&&_0xd63db3['key']){_0x16df14[_0xa509('0x3')](util['format'](_0xa509('0xc'),_0xd63db3[_0xa509('0xd')],_0xd63db3['keyContent']));}else if(_0xd63db3[_0xa509('0xb')]===_0xa509('0x4')&&_0xd63db3[_0xa509('0x5')]&&_0xd63db3['key']){_0x50d51f[_0xd63db3[_0xa509('0x5')]]&&_0x16df14[_0xa509('0x3')](util[_0xa509('0xe')](_0xa509('0xc'),_0xd63db3[_0xa509('0xd')],_0x50d51f[_0xd63db3[_0xa509('0x5')]]));}else if(_0xd63db3[_0xa509('0xb')]===_0xa509('0xf')&&_0xd63db3[_0xa509('0x7')]&&_0xd63db3[_0xa509('0x7')]['name']&&_0xd63db3[_0xa509('0xd')]){_0x50d51f[_0xd63db3[_0xa509('0x7')][_0xa509('0x8')]['toLowerCase']()]&&_0x16df14[_0xa509('0x3')](util[_0xa509('0xe')](_0xa509('0xc'),_0xd63db3['key'],_0x50d51f[_0xd63db3['Variable'][_0xa509('0x8')][_0xa509('0x9')]()]));}}}}return _0x16df14[_0xa509('0x10')](_0x524fe6);};exports[_0xa509('0x11')]=function(_0x40632d){var _0x408e3a=_0x40632d[_0xa509('0x12')](-0x1);if(_0x408e3a==='/'){_0x40632d=_0x40632d[_0xa509('0x13')](0x0,_0x40632d[_0xa509('0x14')](_0x408e3a));}return _0x40632d;};exports['validateEmail']=function(_0xb73e79){if(!_[_0xa509('0x15')](_0xb73e79)&&_0xb73e79!==''){var _0x1d1ed1=/^(([^<>()\[\]\\.,;:\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 _0x1d1ed1[_0xa509('0x16')](String(_0xb73e79)[_0xa509('0x9')]());}else{return![];}}; \ No newline at end of file +var _0xf5a8=['toString','type','Variable','name','toLowerCase','keyType','key','format','%s:\x20%s','customVariable','join','slice','lastIndexOf','validateEmail','isNil','lodash','util','getString','length','sortBy','push','variable','variableName'];(function(_0x1e37f3,_0x135e5c){var _0x46e3d5=function(_0x3c99b7){while(--_0x3c99b7){_0x1e37f3['push'](_0x1e37f3['shift']());}};_0x46e3d5(++_0x135e5c);}(_0xf5a8,0x13a));var _0x8f5a=function(_0x1f83ac,_0x8016fc){_0x1f83ac=_0x1f83ac-0x0;var _0x1985de=_0xf5a8[_0x1f83ac];return _0x1985de;};'use strict';var _=require(_0x8f5a('0x0'));var util=require(_0x8f5a('0x1'));exports[_0x8f5a('0x2')]=function(_0x4f62ad,_0x30e0f0,_0x52ea32){var _0x32c795=[];if(_0x4f62ad[_0x8f5a('0x3')]>0x0){var _0x6eb771=_[_0x8f5a('0x4')](_0x4f62ad,['id']);for(var _0x4ac99e=0x0;_0x4ac99e<_0x6eb771['length'];_0x4ac99e++){var _0xdf60c0=_0x6eb771[_0x4ac99e];if(_0xdf60c0['type']==='string'){_0x32c795[_0x8f5a('0x5')](_0xdf60c0['content']);}else if(_0xdf60c0['type']===_0x8f5a('0x6')&&_0xdf60c0[_0x8f5a('0x7')]){_0x30e0f0[_0xdf60c0[_0x8f5a('0x7')]]&&_0x32c795[_0x8f5a('0x5')](_0x30e0f0[_0xdf60c0['variableName']][_0x8f5a('0x8')]());}else if(_0xdf60c0[_0x8f5a('0x9')]==='customVariable'&&_0xdf60c0[_0x8f5a('0xa')]&&_0xdf60c0[_0x8f5a('0xa')][_0x8f5a('0xb')]){_0x30e0f0[_0xdf60c0['Variable'][_0x8f5a('0xb')][_0x8f5a('0xc')]()]&&_0x32c795['push'](_0x30e0f0[_0xdf60c0[_0x8f5a('0xa')]['name']['toLowerCase']()][_0x8f5a('0x8')]());}else if(_0xdf60c0[_0x8f5a('0x9')]==='keyValue'){if(_0xdf60c0[_0x8f5a('0xd')]==='string'&&_0xdf60c0[_0x8f5a('0xe')]){_0x32c795[_0x8f5a('0x5')](util[_0x8f5a('0xf')](_0x8f5a('0x10'),_0xdf60c0[_0x8f5a('0xe')],_0xdf60c0['keyContent']));}else if(_0xdf60c0[_0x8f5a('0xd')]==='variable'&&_0xdf60c0[_0x8f5a('0x7')]&&_0xdf60c0['key']){_0x30e0f0[_0xdf60c0['variableName']]&&_0x32c795[_0x8f5a('0x5')](util[_0x8f5a('0xf')](_0x8f5a('0x10'),_0xdf60c0[_0x8f5a('0xe')],_0x30e0f0[_0xdf60c0['variableName']]));}else if(_0xdf60c0[_0x8f5a('0xd')]===_0x8f5a('0x11')&&_0xdf60c0[_0x8f5a('0xa')]&&_0xdf60c0[_0x8f5a('0xa')]['name']&&_0xdf60c0[_0x8f5a('0xe')]){_0x30e0f0[_0xdf60c0['Variable']['name'][_0x8f5a('0xc')]()]&&_0x32c795[_0x8f5a('0x5')](util[_0x8f5a('0xf')](_0x8f5a('0x10'),_0xdf60c0['key'],_0x30e0f0[_0xdf60c0[_0x8f5a('0xa')]['name'][_0x8f5a('0xc')]()]));}}}}return _0x32c795[_0x8f5a('0x12')](_0x52ea32);};exports['stripTrailingSlash']=function(_0x601560){var _0x41d892=_0x601560[_0x8f5a('0x13')](-0x1);if(_0x41d892==='/'){_0x601560=_0x601560['substring'](0x0,_0x601560[_0x8f5a('0x14')](_0x41d892));}return _0x601560;};exports[_0x8f5a('0x15')]=function(_0x3afcfd){if(!_[_0x8f5a('0x16')](_0x3afcfd)&&_0x3afcfd!==''){var _0x21053f=/^(([^<>()\[\]\\.,;:\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 _0x21053f['test'](String(_0x3afcfd)[_0x8f5a('0xc')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 1364487..4b10277 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x8133ca,_0x3b2efc){var _0x225e17=function(_0xeab268){while(--_0xeab268){_0x8133ca['push'](_0x8133ca['shift']());}};_0x225e17(++_0x3b2efc);}(_0xe706,0xa3));var _0x6e70=function(_0x2edb9f,_0x36fad0){_0x2edb9f=_0x2edb9f-0x0;var _0x4e5979=_0xe706[_0x2edb9f];return _0x4e5979;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file +var _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x3ec92e,_0x5b1813){var _0x4a6eb4=function(_0x41354f){while(--_0x41354f){_0x3ec92e['push'](_0x3ec92e['shift']());}};_0x4a6eb4(++_0x5b1813);}(_0xe706,0xa3));var _0x6e70=function(_0x583a7a,_0x4c8def){_0x583a7a=_0x583a7a-0x0;var _0x514434=_0xe706[_0x583a7a];return _0x514434;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 8398457..490a5aa 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 _0x1ec4=['Searching\x20enduser\x20with\x20phone','end-user','length','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','defaults','GET','forEach','includes','string','picklist','nameField','customField','toLowerCase','content','type','custom_fields','variable','variableName','idField','Variable','queue','serverUrl','stripTrailingSlash','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','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','replace','error','Zendesk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','newTab','%s/agent/tickets/%s','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','monitor_format','lastevent','\x20Error\x20running\x20Zendesk\x20integration','inspect','lodash','request-promise','util','ioredis','./util','../../../../config/environment','zendesk','redis','localhost','socket.io-emitter','emit','application/json','%s/tickets.json','POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','info','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','format','count','Agent\x20found!','find','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','remoteUri','Admin\x20account\x20selected.','user'];(function(_0x26c831,_0x11990f){var _0x110345=function(_0x2890fa){while(--_0x2890fa){_0x26c831['push'](_0x26c831['shift']());}};_0x110345(++_0x11990f);}(_0x1ec4,0x19e));var _0x41ec=function(_0x588061,_0x2c1481){_0x588061=_0x588061-0x0;var _0x14136e=_0x1ec4[_0x588061];return _0x14136e;};'use strict';var _=require(_0x41ec('0x0'));var rp=require(_0x41ec('0x1'));var md5=require('md5');var util=require(_0x41ec('0x2'));var Redis=require(_0x41ec('0x3'));var intUtil=require(_0x41ec('0x4'));var config=require(_0x41ec('0x5'));var logger=require('../../../../config/logger')(_0x41ec('0x6'));config[_0x41ec('0x7')]=_['defaults'](config[_0x41ec('0x7')],{'host':_0x41ec('0x8'),'port':0x18eb});var io=require(_0x41ec('0x9'))(new Redis(config['redis']));function emit(_0x2d72a,_0x18b3d4,_0x4e0188){io['to'](_0x2d72a)[_0x41ec('0xa')](_0x18b3d4,_0x4e0188);}var headers={'Content-Type':_0x41ec('0xb'),'Accept':'application/json'};function getTicket(_0x24a55e,_0x544728,_0x143f52,_0x65201d,_0x2b3326){logger['info']('Creating\x20new\x20ticket...');return request({'uri':util['format'](_0x41ec('0xc'),_0x24a55e['remoteUri']),'method':_0x41ec('0xd'),'body':{'ticket':_[_0x41ec('0xe')]({'requester_id':_0x143f52['id'],'submitter_id':_0x544728?_0x544728['id']:undefined,'assignee_id':_0x544728?_0x544728['id']:undefined,'tags':getTags(_0x65201d[_0x41ec('0xf')],_0x41ec('0x10')),'subject':intUtil[_0x41ec('0x11')](_0x65201d[_0x41ec('0x12')],_0x2b3326,'\x20'),'description':intUtil[_0x41ec('0x11')](_0x65201d['Descriptions'],_0x2b3326,'\x0a'),'comment':{'public':![],'body':intUtil[_0x41ec('0x11')](_0x65201d[_0x41ec('0x13')],_0x2b3326,'\x0a')}},getCustomFields(_0x65201d[_0x41ec('0x14')],_0x2b3326))}})[_0x41ec('0x15')](function(_0x1f7ae1){logger[_0x41ec('0x16')](_0x41ec('0x17'));return _0x1f7ae1[_0x41ec('0x18')];});}function getUser(_0x5536ab,_0x360d56){if(intUtil[_0x41ec('0x19')](_0x360d56)){logger[_0x41ec('0x16')](_0x41ec('0x1a'),_0x360d56);return request({'uri':util['format'](_0x41ec('0x1b'),_0x5536ab['remoteUri']),'qs':{'query':util[_0x41ec('0x1c')]('type:user\x20role:agent\x20email:%s',_0x360d56)}})[_0x41ec('0x15')](function(_0x2fa6db){if(_0x2fa6db[_0x41ec('0x1d')]){logger[_0x41ec('0x16')](_0x41ec('0x1e'));return _[_0x41ec('0x1f')](_0x2fa6db[_0x41ec('0x20')],{'email':_0x360d56,'role':'agent'});}else{logger[_0x41ec('0x16')](_0x41ec('0x21'));return request({'uri':util[_0x41ec('0x1c')](_0x41ec('0x22'),_0x5536ab[_0x41ec('0x23')])})[_0x41ec('0x15')](function(_0x3a91fc){logger[_0x41ec('0x16')](_0x41ec('0x24'));return _0x3a91fc[_0x41ec('0x25')];});}});}else{logger[_0x41ec('0x16')](_0x41ec('0x21'));return request({'uri':util[_0x41ec('0x1c')](_0x41ec('0x22'),_0x5536ab[_0x41ec('0x23')])})['then'](function(_0x21ec8a){logger[_0x41ec('0x16')](_0x41ec('0x24'));return _0x21ec8a[_0x41ec('0x25')];});}}function getEndUser(_0x32c996,_0x3586e8,_0x45a2a9){logger[_0x41ec('0x16')](_0x41ec('0x26'),_0x45a2a9);return request({'uri':util[_0x41ec('0x1c')](_0x41ec('0x1b'),_0x32c996[_0x41ec('0x23')]),'qs':{'query':util[_0x41ec('0x1c')]('type:user\x20role:end-user\x20phone:%s',_0x45a2a9)}})[_0x41ec('0x15')](function(_0x2185b3){var _0x142e90;if(_0x2185b3['results']['length']){_0x2185b3[_0x41ec('0x20')]=_['filter'](_0x2185b3[_0x41ec('0x20')],{'suspended':![],'role':_0x41ec('0x27')});if(_0x2185b3['results'][_0x41ec('0x28')]){_0x142e90=_[_0x41ec('0x29')](_0x2185b3[_0x41ec('0x20')]);}}if(_0x142e90){logger['info']('Enduser\x20found!');return _0x142e90;}else{logger['info'](_0x41ec('0x2a'));return request({'uri':util[_0x41ec('0x1c')](_0x41ec('0x2b'),_0x32c996[_0x41ec('0x23')]),'method':_0x41ec('0xd'),'body':{'user':{'role':_0x41ec('0x27'),'name':util[_0x41ec('0x1c')](_0x41ec('0x2c'),_0x3586e8||_0x45a2a9),'phone':_0x45a2a9}}})[_0x41ec('0x15')](function(_0x3862bb){logger[_0x41ec('0x16')](_0x41ec('0x2d'));return _0x3862bb[_0x41ec('0x25')];});}});}function getAuth(_0x129342){var _0x5caaa0;if(_0x129342[_0x41ec('0x2e')]===_0x41ec('0x2f')){_0x5caaa0=util[_0x41ec('0x1c')](_0x41ec('0x30'),_0x129342[_0x41ec('0x31')],_0x129342[_0x41ec('0x2f')]);}else if(_0x129342[_0x41ec('0x2e')]===_0x41ec('0x32')){_0x5caaa0=util[_0x41ec('0x1c')](_0x41ec('0x33'),_0x129342[_0x41ec('0x31')],_0x129342[_0x41ec('0x32')]);}return util['format'](_0x41ec('0x34'),new Buffer(_0x5caaa0)[_0x41ec('0x35')](_0x41ec('0x36')));}function request(_0x10ff7b){logger[_0x41ec('0x37')](_0x41ec('0x38'),JSON[_0x41ec('0x39')](_0x10ff7b));return rp(_[_0x41ec('0x3a')](_0x10ff7b,{'method':_0x41ec('0x3b'),'headers':headers,'json':!![]}));}function getTags(_0x44a3cd,_0x4abce1){var _0x4621e8=[];if(_0x44a3cd&&_0x44a3cd['length']>0x0){_0x4621e8=_['map'](_0x44a3cd,_0x4abce1);}return _0x4621e8;}function getCustomFields(_0x4a50ff,_0x1494bb){var _0x308967=[];var _0x4ac247={'custom_fields':[]};if(_0x4a50ff[_0x41ec('0x28')]>0x0){_[_0x41ec('0x3c')](_0x4a50ff,function(_0x16cbc4){if(_[_0x41ec('0x3d')]([_0x41ec('0x3e'),_0x41ec('0x3f')],_0x16cbc4['type'])&&_0x16cbc4[_0x41ec('0x40')]&&!_0x16cbc4[_0x41ec('0x41')]){_0x4ac247[_0x16cbc4['nameField'][_0x41ec('0x42')]()]=_0x16cbc4[_0x41ec('0x43')][_0x41ec('0x35')]();}else if(_[_0x41ec('0x3d')]([_0x41ec('0x3e'),'picklist'],_0x16cbc4[_0x41ec('0x44')])&&_0x16cbc4['idField']&&_0x16cbc4['customField']){_0x4ac247[_0x41ec('0x45')]['push']({'id':_0x16cbc4['idField'],'value':_0x16cbc4[_0x41ec('0x43')][_0x41ec('0x35')]()});}else if(_0x16cbc4[_0x41ec('0x44')]===_0x41ec('0x46')&&_0x16cbc4[_0x41ec('0x47')]&&_0x16cbc4[_0x41ec('0x48')]&&_0x16cbc4['customField']){_0x1494bb[_0x16cbc4[_0x41ec('0x47')]]&&_0x4ac247[_0x41ec('0x45')]['push']({'id':_0x16cbc4[_0x41ec('0x48')],'value':_0x1494bb[_0x16cbc4[_0x41ec('0x47')]][_0x41ec('0x35')]()});}else if(_0x16cbc4[_0x41ec('0x44')]==='customVariable'&&_0x16cbc4[_0x41ec('0x49')]&&_0x16cbc4['Variable'][_0x41ec('0x10')]&&_0x16cbc4[_0x41ec('0x48')]&&_0x16cbc4[_0x41ec('0x41')]){_0x1494bb[_0x16cbc4[_0x41ec('0x49')][_0x41ec('0x10')]['toLowerCase']()]&&_0x4ac247[_0x41ec('0x45')]['push']({'id':_0x16cbc4[_0x41ec('0x48')],'value':_0x1494bb[_0x16cbc4[_0x41ec('0x49')][_0x41ec('0x10')][_0x41ec('0x42')]()][_0x41ec('0x35')]()});}});}return _0x4ac247;}exports[_0x41ec('0x4a')]=function(_0x525732,_0x4483c3,_0x318b26,_0x56c8d0,_0x30f18f,_0x37350e){var _0x2d86c1,_0x31c7fc;_0x37350e[_0x41ec('0x23')]=intUtil['stripTrailingSlash'](_0x37350e[_0x41ec('0x23')]);_0x37350e[_0x41ec('0x4b')]=intUtil[_0x41ec('0x4c')](_0x37350e[_0x41ec('0x4b')]);if(_0x30f18f&&_0x30f18f['monitor_format']){logger['info']('[QUEUE]',_0x41ec('0x4d'));_0x4483c3[_0x41ec('0x4e')]=util[_0x41ec('0x1c')](_0x41ec('0x4f'),_0x37350e[_0x41ec('0x4b')],_0x4483c3[_0x41ec('0x50')],md5(_0x4483c3['uniqueid']));}else{_0x4483c3[_0x41ec('0x4e')]='';}headers[_0x41ec('0x51')]=getAuth(_0x37350e);return getUser(_0x37350e,_0x56c8d0[_0x41ec('0x52')])['then'](function(_0x3d20f2){_0x2d86c1=_0x3d20f2;logger[_0x41ec('0x16')](_0x41ec('0x53'),_0x2d86c1['id']);return getEndUser(_0x37350e,_0x4483c3[_0x41ec('0x54')],_0x4483c3[_0x41ec('0x55')]);})[_0x41ec('0x15')](function(_0x33088a){_0x31c7fc=_0x33088a;logger['info'](_0x41ec('0x56'),_0x31c7fc['id']);return getTicket(_0x37350e,_0x2d86c1,_0x31c7fc,_0x318b26,_0x4483c3);})[_0x41ec('0x15')](function(_0x2830e8){if(_0x2830e8){logger[_0x41ec('0x16')](_0x41ec('0x57'),_0x2830e8['id']);switch(_0x37350e[_0x41ec('0x44')]){case _0x41ec('0x58'):logger['info'](_0x41ec('0x59'),_0x41ec('0x5a'));return request({'uri':util[_0x41ec('0x1c')](_0x41ec('0x5b'),_0x37350e[_0x41ec('0x23')],_0x2d86c1['id'],_0x2830e8['id']),'method':_0x41ec('0xd')});case'newTab':logger[_0x41ec('0x16')](_0x41ec('0x59'),_0x41ec('0x5c'));emit(util['format'](_0x41ec('0x5d'),_0x56c8d0['name']),_0x41ec('0x5e'),{'uri':util[_0x41ec('0x1c')]('%s/agent/tickets/%s',_0x37350e[_0x41ec('0x23')][_0x41ec('0x5f')]('/api/v2',''),_0x2830e8['id'])});break;default:logger[_0x41ec('0x60')](_0x41ec('0x59'),_0x41ec('0x61'));}}})['catch'](function(_0x46ac50){logger['error']('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x46ac50,{'showHidden':!![],'depth':null}));});};exports[_0x41ec('0x62')]=function(_0x3a2079,_0x26ed2e,_0x2bfc0b,_0x3e76ef,_0x3d19bc,_0x22c78c,_0x179738){var _0x34be71,_0x65b62d;_0x22c78c[_0x41ec('0x23')]=intUtil[_0x41ec('0x4c')](_0x22c78c[_0x41ec('0x23')]);_0x22c78c['serverUrl']=intUtil['stripTrailingSlash'](_0x22c78c[_0x41ec('0x4b')]);if(_0x179738&&_0x179738[_0x41ec('0x63')]&&_0x179738[_0x41ec('0x63')]!==_0x41ec('0x64')){logger[_0x41ec('0x16')](_0x41ec('0x65'),_0x41ec('0x4d'));_0x26ed2e['recordingURL']=util[_0x41ec('0x1c')](_0x41ec('0x4f'),_0x22c78c[_0x41ec('0x4b')],_0x26ed2e[_0x41ec('0x50')],md5(_0x26ed2e[_0x41ec('0x50')]));}headers[_0x41ec('0x51')]=getAuth(_0x22c78c);return getUser(_0x22c78c,_0x3e76ef[_0x41ec('0x52')])[_0x41ec('0x15')](function(_0x2313c3){_0x34be71=_0x2313c3;logger[_0x41ec('0x16')](_0x41ec('0x53'),_0x34be71['id']);return getEndUser(_0x22c78c,_0x26ed2e[_0x41ec('0x66')],_0x26ed2e[_0x41ec('0x67')]);})[_0x41ec('0x15')](function(_0x2bc88a){_0x65b62d=_0x2bc88a;logger[_0x41ec('0x16')](_0x41ec('0x56'),_0x65b62d['id']);return getTicket(_0x22c78c,_0x34be71,_0x65b62d,_0x2bfc0b,_0x26ed2e);})[_0x41ec('0x15')](function(_0x367a7e){if(_0x367a7e){logger[_0x41ec('0x16')]('The\x20Ticket\x20ID\x20is:',_0x367a7e['id']);switch(_0x22c78c['type']){case'integrationTab':logger['info'](_0x41ec('0x65'),_0x41ec('0x5a'));return request({'uri':util[_0x41ec('0x1c')](_0x41ec('0x5b'),_0x22c78c[_0x41ec('0x23')],_0x34be71['id'],_0x367a7e['id']),'method':_0x41ec('0xd')});case _0x41ec('0x68'):logger[_0x41ec('0x16')](_0x41ec('0x65'),_0x41ec('0x5c'));emit(util[_0x41ec('0x1c')](_0x41ec('0x5d'),_0x3e76ef[_0x41ec('0x10')]),'trigger:browser:url',{'uri':util['format'](_0x41ec('0x69'),_0x22c78c[_0x41ec('0x23')][_0x41ec('0x5f')]('/api/v2',''),_0x367a7e['id'])});break;default:logger['error'](_0x41ec('0x65'),_0x41ec('0x61'));}}})[_0x41ec('0x6a')](function(_0x5279e6){logger[_0x41ec('0x60')](_0x41ec('0x6b'),util['inspect'](_0x5279e6,{'showHidden':!![],'depth':null}));});};exports[_0x41ec('0x6c')]=function(_0x409eba,_0x64e8f8,_0x1ad13f,_0x1654a9,_0x25b3e6,_0x3feb0d){var _0x1dd3ae,_0x3227c2;_0x3feb0d['remoteUri']=intUtil['stripTrailingSlash'](_0x3feb0d[_0x41ec('0x23')]);_0x3feb0d['serverUrl']=intUtil[_0x41ec('0x4c')](_0x3feb0d[_0x41ec('0x4b')]);if(_0x25b3e6&&_0x25b3e6[_0x41ec('0x6d')]){logger[_0x41ec('0x16')]('['+_0x64e8f8[_0x41ec('0x6e')]['toUpperCase']()+']',_0x41ec('0x4d'));_0x64e8f8[_0x41ec('0x4e')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3feb0d[_0x41ec('0x4b')],_0x64e8f8[_0x41ec('0x50')],md5(_0x64e8f8['uniqueid']));}else{_0x64e8f8['recordingURL']='';}headers['Authorization']=getAuth(_0x3feb0d);return getUser(_0x3feb0d)[_0x41ec('0x15')](function(_0x280607){_0x1dd3ae=_0x280607;logger[_0x41ec('0x16')](_0x41ec('0x53'),_0x1dd3ae['id']);return getEndUser(_0x3feb0d,_0x64e8f8[_0x41ec('0x54')],_0x64e8f8[_0x41ec('0x55')]);})[_0x41ec('0x15')](function(_0x538cf4){_0x3227c2=_0x538cf4;logger['info'](_0x41ec('0x56'),_0x3227c2['id']);return getTicket(_0x3feb0d,_0x1dd3ae,_0x3227c2,_0x1ad13f,_0x64e8f8);})[_0x41ec('0x15')](function(_0x39684d){if(_0x39684d){logger[_0x41ec('0x16')]('The\x20Ticket\x20ID\x20is:',_0x39684d['id']);}})['catch'](function(_0x5c6111){logger[_0x41ec('0x60')]('['+_0x64e8f8[_0x41ec('0x6e')]['toUpperCase']()+']'+_0x41ec('0x6f'),util[_0x41ec('0x70')](_0x5c6111,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x6035=['emit','application/json','info','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','then','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','Agent\x20found!','find','results','agent','%s/users/me.json','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','Basic\x20%s','toString','base64','debug','stringify','defaults','GET','includes','picklist','type','nameField','customField','toLowerCase','content','string','idField','custom_fields','variable','variableName','push','customVariable','Variable','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:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','user:%s','trigger:browser:url','%s/agent/tickets/%s','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','replace','error','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','util','../../../../config/environment','../../../../config/logger','zendesk','redis','localhost'];(function(_0x310a1b,_0x4c9129){var _0xdea206=function(_0x1f1e8d){while(--_0x1f1e8d){_0x310a1b['push'](_0x310a1b['shift']());}};_0xdea206(++_0x4c9129);}(_0x6035,0x1a7));var _0x5603=function(_0x3ae3d7,_0x3b31de){_0x3ae3d7=_0x3ae3d7-0x0;var _0x3218ca=_0x6035[_0x3ae3d7];return _0x3218ca;};'use strict';var _=require(_0x5603('0x0'));var rp=require(_0x5603('0x1'));var md5=require(_0x5603('0x2'));var util=require(_0x5603('0x3'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x5603('0x4'));var logger=require(_0x5603('0x5'))(_0x5603('0x6'));config['redis']=_['defaults'](config[_0x5603('0x7')],{'host':_0x5603('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5603('0x7')]));function emit(_0x2d40a1,_0x53cfa8,_0x219523){io['to'](_0x2d40a1)[_0x5603('0x9')](_0x53cfa8,_0x219523);}var headers={'Content-Type':_0x5603('0xa'),'Accept':_0x5603('0xa')};function getTicket(_0x30164f,_0x54850b,_0x4ac508,_0x182a3e,_0x1ef5bf){logger[_0x5603('0xb')]('Creating\x20new\x20ticket...');return request({'uri':util[_0x5603('0xc')](_0x5603('0xd'),_0x30164f[_0x5603('0xe')]),'method':_0x5603('0xf'),'body':{'ticket':_[_0x5603('0x10')]({'requester_id':_0x4ac508['id'],'submitter_id':_0x54850b?_0x54850b['id']:undefined,'assignee_id':_0x54850b?_0x54850b['id']:undefined,'tags':getTags(_0x182a3e[_0x5603('0x11')],_0x5603('0x12')),'subject':intUtil[_0x5603('0x13')](_0x182a3e[_0x5603('0x14')],_0x1ef5bf,'\x20'),'description':intUtil[_0x5603('0x13')](_0x182a3e[_0x5603('0x15')],_0x1ef5bf,'\x0a'),'comment':{'public':![],'body':intUtil[_0x5603('0x13')](_0x182a3e['Descriptions'],_0x1ef5bf,'\x0a')}},getCustomFields(_0x182a3e['Fields'],_0x1ef5bf))}})[_0x5603('0x16')](function(_0x20da85){logger['info']('Ticket\x20created!');return _0x20da85['ticket'];});}function getUser(_0xc4baf3,_0x57e862){if(intUtil[_0x5603('0x17')](_0x57e862)){logger[_0x5603('0xb')](_0x5603('0x18'),_0x57e862);return request({'uri':util[_0x5603('0xc')](_0x5603('0x19'),_0xc4baf3[_0x5603('0xe')]),'qs':{'query':util[_0x5603('0xc')](_0x5603('0x1a'),_0x57e862)}})[_0x5603('0x16')](function(_0x3dc551){if(_0x3dc551['count']){logger['info'](_0x5603('0x1b'));return _[_0x5603('0x1c')](_0x3dc551[_0x5603('0x1d')],{'email':_0x57e862,'role':_0x5603('0x1e')});}else{logger[_0x5603('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x5603('0xc')](_0x5603('0x1f'),_0xc4baf3[_0x5603('0xe')])})[_0x5603('0x16')](function(_0x5ac4e8){logger[_0x5603('0xb')]('Admin\x20account\x20selected.');return _0x5ac4e8[_0x5603('0x20')];});}});}else{logger[_0x5603('0xb')](_0x5603('0x21'));return request({'uri':util['format'](_0x5603('0x1f'),_0xc4baf3[_0x5603('0xe')])})[_0x5603('0x16')](function(_0x56366d){logger[_0x5603('0xb')]('Admin\x20account\x20selected.');return _0x56366d['user'];});}}function getEndUser(_0x156aec,_0x3a7804,_0xcf4a62){logger['info'](_0x5603('0x22'),_0xcf4a62);return request({'uri':util[_0x5603('0xc')](_0x5603('0x19'),_0x156aec[_0x5603('0xe')]),'qs':{'query':util[_0x5603('0xc')](_0x5603('0x23'),_0xcf4a62)}})[_0x5603('0x16')](function(_0x104983){var _0x142cc0;if(_0x104983[_0x5603('0x1d')][_0x5603('0x24')]){_0x104983['results']=_['filter'](_0x104983['results'],{'suspended':![],'role':_0x5603('0x25')});if(_0x104983['results'][_0x5603('0x24')]){_0x142cc0=_[_0x5603('0x26')](_0x104983[_0x5603('0x1d')]);}}if(_0x142cc0){logger[_0x5603('0xb')](_0x5603('0x27'));return _0x142cc0;}else{logger[_0x5603('0xb')](_0x5603('0x28'));return request({'uri':util[_0x5603('0xc')](_0x5603('0x29'),_0x156aec[_0x5603('0xe')]),'method':_0x5603('0xf'),'body':{'user':{'role':_0x5603('0x25'),'name':util[_0x5603('0xc')](_0x5603('0x2a'),_0x3a7804||_0xcf4a62),'phone':_0xcf4a62}}})[_0x5603('0x16')](function(_0x51bbc7){logger['info'](_0x5603('0x2b'));return _0x51bbc7[_0x5603('0x20')];});}});}function getAuth(_0x65c7c7){var _0x4ff8b0;if(_0x65c7c7[_0x5603('0x2c')]===_0x5603('0x2d')){_0x4ff8b0=util[_0x5603('0xc')](_0x5603('0x2e'),_0x65c7c7[_0x5603('0x2f')],_0x65c7c7[_0x5603('0x2d')]);}else if(_0x65c7c7[_0x5603('0x2c')]===_0x5603('0x30')){_0x4ff8b0=util[_0x5603('0xc')]('%s/token:%s',_0x65c7c7[_0x5603('0x2f')],_0x65c7c7['token']);}return util[_0x5603('0xc')](_0x5603('0x31'),new Buffer(_0x4ff8b0)[_0x5603('0x32')](_0x5603('0x33')));}function request(_0x5f4646){logger[_0x5603('0x34')]('[HTTP]',JSON[_0x5603('0x35')](_0x5f4646));return rp(_[_0x5603('0x36')](_0x5f4646,{'method':_0x5603('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x9b5dd9,_0x57ccad){var _0x4fdcb5=[];if(_0x9b5dd9&&_0x9b5dd9[_0x5603('0x24')]>0x0){_0x4fdcb5=_['map'](_0x9b5dd9,_0x57ccad);}return _0x4fdcb5;}function getCustomFields(_0x374862,_0x53b727){var _0x380952=[];var _0x24f8df={'custom_fields':[]};if(_0x374862[_0x5603('0x24')]>0x0){_['forEach'](_0x374862,function(_0x2174c1){if(_[_0x5603('0x38')](['string',_0x5603('0x39')],_0x2174c1[_0x5603('0x3a')])&&_0x2174c1[_0x5603('0x3b')]&&!_0x2174c1[_0x5603('0x3c')]){_0x24f8df[_0x2174c1[_0x5603('0x3b')][_0x5603('0x3d')]()]=_0x2174c1[_0x5603('0x3e')][_0x5603('0x32')]();}else if(_[_0x5603('0x38')]([_0x5603('0x3f'),_0x5603('0x39')],_0x2174c1['type'])&&_0x2174c1[_0x5603('0x40')]&&_0x2174c1[_0x5603('0x3c')]){_0x24f8df[_0x5603('0x41')]['push']({'id':_0x2174c1[_0x5603('0x40')],'value':_0x2174c1[_0x5603('0x3e')][_0x5603('0x32')]()});}else if(_0x2174c1[_0x5603('0x3a')]===_0x5603('0x42')&&_0x2174c1[_0x5603('0x43')]&&_0x2174c1[_0x5603('0x40')]&&_0x2174c1[_0x5603('0x3c')]){_0x53b727[_0x2174c1[_0x5603('0x43')]]&&_0x24f8df[_0x5603('0x41')][_0x5603('0x44')]({'id':_0x2174c1[_0x5603('0x40')],'value':_0x53b727[_0x2174c1[_0x5603('0x43')]]['toString']()});}else if(_0x2174c1[_0x5603('0x3a')]===_0x5603('0x45')&&_0x2174c1[_0x5603('0x46')]&&_0x2174c1[_0x5603('0x46')]['name']&&_0x2174c1[_0x5603('0x40')]&&_0x2174c1[_0x5603('0x3c')]){_0x53b727[_0x2174c1['Variable'][_0x5603('0x12')]['toLowerCase']()]&&_0x24f8df[_0x5603('0x41')][_0x5603('0x44')]({'id':_0x2174c1[_0x5603('0x40')],'value':_0x53b727[_0x2174c1[_0x5603('0x46')][_0x5603('0x12')][_0x5603('0x3d')]()]['toString']()});}});}return _0x24f8df;}exports['queue']=function(_0x262c99,_0x51b114,_0xa27b3b,_0x119d65,_0x5b25a4,_0x11eb31){var _0xb1c064,_0x34aa70;_0x11eb31[_0x5603('0xe')]=intUtil[_0x5603('0x47')](_0x11eb31[_0x5603('0xe')]);_0x11eb31[_0x5603('0x48')]=intUtil[_0x5603('0x47')](_0x11eb31[_0x5603('0x48')]);if(_0x5b25a4&&_0x5b25a4[_0x5603('0x49')]){logger[_0x5603('0xb')](_0x5603('0x4a'),_0x5603('0x4b'));_0x51b114[_0x5603('0x4c')]=util[_0x5603('0xc')](_0x5603('0x4d'),_0x11eb31[_0x5603('0x48')],_0x51b114[_0x5603('0x4e')],md5(_0x51b114['uniqueid']));}else{_0x51b114[_0x5603('0x4c')]='';}headers[_0x5603('0x4f')]=getAuth(_0x11eb31);return getUser(_0x11eb31,_0x119d65[_0x5603('0x50')])[_0x5603('0x16')](function(_0x3d53e4){_0xb1c064=_0x3d53e4;logger[_0x5603('0xb')](_0x5603('0x51'),_0xb1c064['id']);return getEndUser(_0x11eb31,_0x51b114[_0x5603('0x52')],_0x51b114[_0x5603('0x53')]);})[_0x5603('0x16')](function(_0x38de21){_0x34aa70=_0x38de21;logger[_0x5603('0xb')](_0x5603('0x54'),_0x34aa70['id']);return getTicket(_0x11eb31,_0xb1c064,_0x34aa70,_0xa27b3b,_0x51b114);})[_0x5603('0x16')](function(_0x592a25){if(_0x592a25){logger[_0x5603('0xb')]('The\x20Ticket\x20ID\x20is:',_0x592a25['id']);switch(_0x11eb31['type']){case _0x5603('0x55'):logger[_0x5603('0xb')](_0x5603('0x4a'),_0x5603('0x56'));return request({'uri':util[_0x5603('0xc')](_0x5603('0x57'),_0x11eb31[_0x5603('0xe')],_0xb1c064['id'],_0x592a25['id']),'method':'POST'});case _0x5603('0x58'):logger[_0x5603('0xb')](_0x5603('0x4a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x5603('0xc')](_0x5603('0x59'),_0x119d65['name']),_0x5603('0x5a'),{'uri':util[_0x5603('0xc')](_0x5603('0x5b'),_0x11eb31[_0x5603('0xe')]['replace'](_0x5603('0x5c'),''),_0x592a25['id'])});break;default:logger['error'](_0x5603('0x4a'),_0x5603('0x5d'));}}})[_0x5603('0x5e')](function(_0x2a9dd4){logger['error'](_0x5603('0x5f'),util[_0x5603('0x60')](_0x2a9dd4,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x4f0a98,_0x51bc35,_0x4596a0,_0xddd7e9,_0x1db326,_0x24c71b,_0x1552a0){var _0x1df959,_0x377b37;_0x24c71b[_0x5603('0xe')]=intUtil[_0x5603('0x47')](_0x24c71b[_0x5603('0xe')]);_0x24c71b[_0x5603('0x48')]=intUtil[_0x5603('0x47')](_0x24c71b[_0x5603('0x48')]);if(_0x1552a0&&_0x1552a0[_0x5603('0x61')]&&_0x1552a0['recordingFormat']!=='none'){logger[_0x5603('0xb')](_0x5603('0x62'),'Recording\x20is\x20enabled!');_0x51bc35['recordingURL']=util[_0x5603('0xc')](_0x5603('0x4d'),_0x24c71b[_0x5603('0x48')],_0x51bc35['uniqueid'],md5(_0x51bc35[_0x5603('0x4e')]));}headers[_0x5603('0x4f')]=getAuth(_0x24c71b);return getUser(_0x24c71b,_0xddd7e9[_0x5603('0x50')])['then'](function(_0xa34e1f){_0x1df959=_0xa34e1f;logger[_0x5603('0xb')](_0x5603('0x51'),_0x1df959['id']);return getEndUser(_0x24c71b,_0x51bc35[_0x5603('0x63')],_0x51bc35[_0x5603('0x64')]);})['then'](function(_0x116027){_0x377b37=_0x116027;logger[_0x5603('0xb')]('The\x20Enduser\x20ID\x20is:',_0x377b37['id']);return getTicket(_0x24c71b,_0x1df959,_0x377b37,_0x4596a0,_0x51bc35);})['then'](function(_0x6f03f1){if(_0x6f03f1){logger[_0x5603('0xb')](_0x5603('0x65'),_0x6f03f1['id']);switch(_0x24c71b[_0x5603('0x3a')]){case _0x5603('0x55'):logger[_0x5603('0xb')](_0x5603('0x62'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x5603('0xc')](_0x5603('0x57'),_0x24c71b[_0x5603('0xe')],_0x1df959['id'],_0x6f03f1['id']),'method':_0x5603('0xf')});case _0x5603('0x58'):logger[_0x5603('0xb')](_0x5603('0x62'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x5603('0xc')](_0x5603('0x59'),_0xddd7e9['name']),_0x5603('0x5a'),{'uri':util[_0x5603('0xc')](_0x5603('0x5b'),_0x24c71b[_0x5603('0xe')][_0x5603('0x66')]('/api/v2',''),_0x6f03f1['id'])});break;default:logger['error'](_0x5603('0x62'),_0x5603('0x5d'));}}})[_0x5603('0x5e')](function(_0x40a2cc){logger[_0x5603('0x67')](_0x5603('0x68'),util[_0x5603('0x60')](_0x40a2cc,{'showHidden':!![],'depth':null}));});};exports[_0x5603('0x69')]=function(_0x125090,_0x13b495,_0x61fe72,_0x2f69db,_0xfe483c,_0x2060cb){var _0x277ba4,_0x3e6fb0;_0x2060cb['remoteUri']=intUtil[_0x5603('0x47')](_0x2060cb[_0x5603('0xe')]);_0x2060cb[_0x5603('0x48')]=intUtil[_0x5603('0x47')](_0x2060cb[_0x5603('0x48')]);if(_0xfe483c&&_0xfe483c['monitor_format']){logger[_0x5603('0xb')]('['+_0x13b495[_0x5603('0x6a')]['toUpperCase']()+']',_0x5603('0x4b'));_0x13b495[_0x5603('0x4c')]=util[_0x5603('0xc')](_0x5603('0x4d'),_0x2060cb[_0x5603('0x48')],_0x13b495[_0x5603('0x4e')],md5(_0x13b495['uniqueid']));}else{_0x13b495[_0x5603('0x4c')]='';}headers['Authorization']=getAuth(_0x2060cb);return getUser(_0x2060cb)[_0x5603('0x16')](function(_0x223e2a){_0x277ba4=_0x223e2a;logger['info'](_0x5603('0x51'),_0x277ba4['id']);return getEndUser(_0x2060cb,_0x13b495[_0x5603('0x52')],_0x13b495[_0x5603('0x53')]);})['then'](function(_0x23fca0){_0x3e6fb0=_0x23fca0;logger[_0x5603('0xb')](_0x5603('0x54'),_0x3e6fb0['id']);return getTicket(_0x2060cb,_0x277ba4,_0x3e6fb0,_0x61fe72,_0x13b495);})[_0x5603('0x16')](function(_0x491e4f){if(_0x491e4f){logger[_0x5603('0xb')](_0x5603('0x65'),_0x491e4f['id']);}})['catch'](function(_0x4a9deb){logger[_0x5603('0x67')]('['+_0x13b495[_0x5603('0x6a')][_0x5603('0x6b')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x5603('0x60')](_0x4a9deb,{'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 4a64d65..d2e7da1 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 _0x9bb4=['administrator','Subject','getString','Subjects','Description','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','starttime','lastevent','called','Call_Result','Called','connect','Answered','rejected','Rejected','Abandoned','Timeout','Call_Start_Time','agentcalledAt','Inbound','merge','Fields','/crm/v2/Calls','SUCCESS','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','/api/voice/recordings/','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','[OUTBOUND]','/downloads?type=uniqueid&token=','uniqueid','zoho.eu','destcalleridname','Outbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','Recording\x20is\x20enabled!','toUpperCase','lodash','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','zoho','redis','defaults','socket.io-emitter','[HTTP]','stringify','forEach','includes','string','picklist','type','idField','content','toString','variableName','customVariable','Variable','toLowerCase','name','indexOf','split','isNil','expires_in','access_token','zone','https://accounts.zoho.eu','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','add','catch','error','stack','info','Search\x20user','format','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Using\x20the\x20admin\x20account!','profile','Administrator','user','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','data','enduserType','POST','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','then','code','details','Error:\x20','log','CREATE\x20ERROR','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','contact','nothing','Owner'];(function(_0x4d74f1,_0x4475c7){var _0x49ee45=function(_0x459f05){while(--_0x459f05){_0x4d74f1['push'](_0x4d74f1['shift']());}};_0x49ee45(++_0x4475c7);}(_0x9bb4,0xd5));var _0x49bb=function(_0x139f96,_0x216c30){_0x139f96=_0x139f96-0x0;var _0x55f5df=_0x9bb4[_0x139f96];return _0x55f5df;};'use strict';var _=require(_0x49bb('0x0'));var rp=require(_0x49bb('0x1'));var md5=require(_0x49bb('0x2'));var util=require(_0x49bb('0x3'));var intUtil=require(_0x49bb('0x4'));var moment=require(_0x49bb('0x5'));var Redis=require(_0x49bb('0x6'));var BPromise=require(_0x49bb('0x7'));var config=require(_0x49bb('0x8'));var logger=require('../../../../config/logger')(_0x49bb('0x9'));config[_0x49bb('0xa')]=_[_0x49bb('0xb')](config[_0x49bb('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x49bb('0xc'))(new Redis(config[_0x49bb('0xa')]));function emit(_0x1a4094,_0x2967d4,_0x22a3df){io['to'](_0x1a4094)['emit'](_0x2967d4,_0x22a3df);}function request(_0x6ba4a2){logger['debug'](_0x49bb('0xd'),JSON[_0x49bb('0xe')](_0x6ba4a2));return rp(_0x6ba4a2);}function getCustomFields(_0x561e59,_0x2de0ba){var _0x4e7f06={};if(_0x561e59['length']>0x0){_[_0x49bb('0xf')](_0x561e59,function(_0x589fff){if(_[_0x49bb('0x10')]([_0x49bb('0x11'),_0x49bb('0x12')],_0x589fff[_0x49bb('0x13')])&&_0x589fff[_0x49bb('0x14')]){_0x4e7f06[_0x589fff[_0x49bb('0x14')]]=_0x589fff[_0x49bb('0x15')][_0x49bb('0x16')]();}else if(_0x589fff[_0x49bb('0x13')]==='variable'&&_0x589fff[_0x49bb('0x17')]&&_0x589fff['idField']&&_0x2de0ba[_0x589fff[_0x49bb('0x17')]]){_0x4e7f06[_0x589fff[_0x49bb('0x14')]]=_0x2de0ba[_0x589fff[_0x49bb('0x17')]][_0x49bb('0x16')]();}else if(_0x589fff[_0x49bb('0x13')]===_0x49bb('0x18')&&_0x589fff[_0x49bb('0x19')]&&_0x589fff[_0x49bb('0x19')]['name']&&_0x589fff[_0x49bb('0x14')]&&_0x2de0ba[_0x589fff[_0x49bb('0x19')]['name'][_0x49bb('0x1a')]()]){_0x4e7f06[_0x589fff[_0x49bb('0x14')]]=_0x2de0ba[_0x589fff['Variable'][_0x49bb('0x1b')][_0x49bb('0x1a')]()]['toString']();}});}return _0x4e7f06;}function getName(_0x1a9894){if(_0x1a9894[_0x49bb('0x1c')]('\x20')>0x0){var _0x586085=_0x1a9894[_0x49bb('0x1d')](/ (.+)/);if(_0x586085[0x1]){return _0x586085;}}return[_0x1a9894,_0x1a9894];}var accountsTokens={};function getAccessToken(_0x5387ed){return new Promise(function(_0x1728e9,_0x5cdd62){if(!_['isNil'](accountsTokens[_0x5387ed['id']])&&!_[_0x49bb('0x1e')](accountsTokens[_0x5387ed['id']]['access_token'])){if(moment()['isBefore'](accountsTokens[_0x5387ed['id']][_0x49bb('0x1f')])){_0x1728e9(accountsTokens[_0x5387ed['id']][_0x49bb('0x20')]);}}var _0x1a76b6;switch(_0x5387ed[_0x49bb('0x21')]){case'US':_0x1a76b6='https://accounts.zoho.com';break;case'AU':_0x1a76b6='https://accounts.zoho.com.au';break;case'EU':_0x1a76b6='https://accounts.zoho.eu';break;case'IN':_0x1a76b6='https://accounts.zoho.in';break;case'CN':_0x1a76b6='https://accounts.zoho.com.cn';break;default:_0x1a76b6=_0x49bb('0x22');break;}var _0x570847={'method':'POST','uri':_0x1a76b6+_0x49bb('0x23'),'qs':{'refresh_token':_0x5387ed[_0x49bb('0x24')],'client_id':_0x5387ed[_0x49bb('0x25')],'client_secret':_0x5387ed[_0x49bb('0x26')],'grant_type':_0x49bb('0x27')},'json':!![]};return rp(_0x570847)['then'](function(_0x323be7){accountsTokens[_0x5387ed['id']]={'access_token':_0x323be7[_0x49bb('0x20')],'expires_in':moment()[_0x49bb('0x28')](_0x323be7[_0x49bb('0x1f')],'seconds')};_0x1728e9(_0x323be7[_0x49bb('0x20')]);})[_0x49bb('0x29')](function(_0x3985a6){logger[_0x49bb('0x2a')]('Failing\x20creating\x20the\x20access_token',_0x3985a6[_0x49bb('0x2b')]);_0x5cdd62(_0x3985a6);});});}function getUser(_0x3207e9,_0x3ab8a8,_0x3a6ed8,_0x5383a3){logger[_0x49bb('0x2c')](_0x49bb('0x2d'));return request({'method':'GET','uri':util[_0x49bb('0x2e')]('https://www.zohoapis.%s/crm/v2/users',_0x3ab8a8),'qs':{'type':_0x49bb('0x2f')},'headers':{'Authorization':_0x49bb('0x30')+_0x3207e9},'json':!![]})['then'](function(_0x2dc42f){if(_0x2dc42f[_0x49bb('0x31')]){var _0x521e09=-0x1;if(_[_0x49bb('0x32')](_0x2dc42f[_0x49bb('0x31')])){if(!_[_0x49bb('0x1e')](_0x5383a3)){_0x521e09=_[_0x49bb('0x33')](_0x2dc42f[_0x49bb('0x31')],function(_0x976791){return _0x976791[_0x49bb('0x34')]===_0x5383a3;});}if(_0x521e09>=0x0){logger[_0x49bb('0x2c')]('Agent\x20found!');}else{logger[_0x49bb('0x2c')](_0x49bb('0x35'));_0x521e09=_[_0x49bb('0x33')](_0x2dc42f[_0x49bb('0x31')],function(_0x4a7303){return _0x4a7303[_0x49bb('0x36')]['name']===_0x49bb('0x37');});}return _0x2dc42f['users'][_0x521e09];}else{if(_0x2dc42f[_0x49bb('0x38')]['profile'][_0x49bb('0x1b')]===_0x49bb('0x37')){logger['info']('Using\x20the\x20admin\x20account!');user=_0x2dc42f['user'];return user;}else{logger['error']('The\x20failing\x20result\x20is',JSON[_0x49bb('0xe')](_0x2dc42f));throw new Error(_0x49bb('0x39')+JSON[_0x49bb('0xe')](_0x2dc42f));}}}else{logger[_0x49bb('0x2a')](_0x49bb('0x3a'),JSON[_0x49bb('0xe')](_0x2dc42f));throw new Error(_0x49bb('0x39')+JSON['stringify'](_0x2dc42f));}})['catch'](function(_0x43297f){console[_0x49bb('0x2a')](_0x43297f);});}function getZohoUser(_0x583e72,_0x4270d6){return new BPromise(function(_0x33e652,_0x5b0310){request(_0x583e72)['then'](function(_0x36227f){var _0x50e7de=null;if(_0x36227f){_0x50e7de=_0x36227f[_0x49bb('0x3b')][0x0];_0x50e7de[_0x49bb('0x3c')]=_0x4270d6;}_0x33e652(_0x50e7de);})[_0x49bb('0x29')](function(_0xa2a63c){_0x5b0310(_0xa2a63c);});});}function createEndUser(_0x46a07c,_0x72d90e,_0x4084a2,_0x6d7077,_0x783852,_0x1ce71d){var _0x4084a2=getName(_0x4084a2);return request({'method':_0x49bb('0x3d'),'uri':_0x49bb('0x3e')+_0x72d90e+_0x49bb('0x3f')+_[_0x49bb('0x40')](_0x1ce71d[_0x49bb('0x41')])+'s','body':{'data':[{'Last_Name':_0x4084a2[0x1],'First_Name':_0x4084a2[0x0],'Phone':_0x6d7077,'Owner':{'name':!_[_0x49bb('0x1e')](_0x783852[_0x49bb('0x42')][_0x49bb('0x1b')])?_0x783852[_0x49bb('0x42')][_0x49bb('0x1b')]:!_[_0x49bb('0x1e')](_0x783852[_0x49bb('0x43')])?_0x783852['first_name']+'\x20'+_0x783852[_0x49bb('0x44')]:_0x783852['last_name'],'id':_0x783852['id']}}]},'headers':{'Authorization':_0x49bb('0x30')+_0x46a07c},'json':!![]})[_0x49bb('0x45')](function(_0x310d2f){if(_0x310d2f&&_0x310d2f[_0x49bb('0x3b')][0x0][_0x49bb('0x46')]==='SUCCESS'){var _0x445e15=_0x310d2f[_0x49bb('0x3b')][0x0][_0x49bb('0x47')];_0x445e15[_0x49bb('0x3c')]=_[_0x49bb('0x40')](_0x1ce71d['moduleCreate'])+'s';return _0x445e15;}logger[_0x49bb('0x2a')](_0x49bb('0x3a'),JSON[_0x49bb('0xe')](data));throw new Error(_0x49bb('0x48')+JSON['stringify'](data));})['catch'](function(_0x89303f){console[_0x49bb('0x49')](_0x49bb('0x4a'),_0x89303f);});}function getEndUser(_0x1e9203,_0x3e691b,_0xeaf3ba,_0x4e9835,_0x2ff751,_0x56b67d,_0x380c37){var _0x202180={'method':'GET','uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1e9203},'json':!![]};switch(_0x380c37['moduleSearch']){case'contact_lead':_0x202180[_0x49bb('0x4b')]=_0x49bb('0x3e')+_0x3e691b+_0x49bb('0x4c')+_0x2ff751+'))';return getZohoUser(_0x202180,_0x49bb('0x4d'))['then'](function(_0x5d077a){if(_0x5d077a)return _0x5d077a;_0x202180[_0x49bb('0x4b')]=_0x49bb('0x3e')+_0x3e691b+_0x49bb('0x4e')+_0x2ff751+'))';return getZohoUser(_0x202180,_0x49bb('0x4f'))['then'](function(_0x3b0f01){if(_0x3b0f01)return _0x3b0f01;if(_0x380c37[_0x49bb('0x41')]!='nothing'){return createEndUser(_0x1e9203,_0x3e691b,_0x4e9835,_0x2ff751,_0x56b67d,_0x380c37);}else{return{};}});});break;case _0x49bb('0x50'):_0x202180[_0x49bb('0x4b')]=_0x49bb('0x3e')+_0x3e691b+_0x49bb('0x4c')+_0x2ff751+'))';return getZohoUser(_0x202180,_0x49bb('0x4d'))['then'](function(_0xf75233){if(_0xf75233)return _0xf75233;if(_0x380c37[_0x49bb('0x41')]!=_0x49bb('0x51')){return createEndUser(_0x1e9203,_0x3e691b,_0x4e9835,_0x2ff751,_0x56b67d,_0x380c37);}else{return{};}});break;case'lead':_0x202180[_0x49bb('0x4b')]=_0x49bb('0x3e')+_0x3e691b+_0x49bb('0x4e')+_0x2ff751+'))';return getZohoUser(_0x202180,_0x49bb('0x4f'))[_0x49bb('0x45')](function(_0x5d15ac){if(_0x5d15ac)return _0x5d15ac;if(_0x380c37[_0x49bb('0x41')]!=_0x49bb('0x51')){return createEndUser(_0x1e9203,_0x3e691b,_0x4e9835,_0x2ff751,_0x56b67d,_0x380c37);}else{return{};}});break;}}function getCall(_0xfae9ab,_0x1fdfca,_0x412f3b,_0xfe69c8,_0x113ba6,_0x28570b,_0xf7c5fa,_0x3c86ea){logger[_0x49bb('0x2c')]('Creating\x20new\x20call...');var _0x39d363={};_0x39d363[_0x49bb('0x52')]={'name':!_[_0x49bb('0x1e')](_0xfe69c8[_0x49bb('0x42')][_0x49bb('0x1b')])&&!_[_0x49bb('0x1e')](_0xfe69c8[_0x49bb('0x36')][_0x49bb('0x1b')])&&_0xfe69c8[_0x49bb('0x36')][_0x49bb('0x1b')]===_0x49bb('0x53')?_0xfe69c8[_0x49bb('0x42')][_0x49bb('0x1b')]:!_[_0x49bb('0x1e')](_0xfe69c8[_0x49bb('0x43')])?_0xfe69c8[_0x49bb('0x43')]+'\x20'+_0xfe69c8[_0x49bb('0x44')]:_0xfe69c8[_0x49bb('0x44')],'id':_0xfe69c8['id']};_0x39d363[_0x49bb('0x54')]=intUtil[_0x49bb('0x55')](_0x28570b[_0x49bb('0x56')],_0xf7c5fa,'\x20');_0x39d363[_0x49bb('0x57')]=intUtil[_0x49bb('0x55')](_0x28570b['Descriptions'],_0xf7c5fa,'\x0a');if(_0x113ba6[_0x49bb('0x3c')]===_0x49bb('0x4d')){_0x39d363[_0x49bb('0x58')]={'name':!_[_0x49bb('0x1e')](_0x113ba6[_0x49bb('0x59')])?_0x113ba6[_0x49bb('0x59')]:!_[_0x49bb('0x1e')](_0x113ba6[_0x49bb('0x5a')])?_0x113ba6[_0x49bb('0x5a')]+'\x20'+_0x113ba6[_0x49bb('0x5b')]:_0x113ba6['Last_Name'],'id':_0x113ba6['id']};}if(_0x113ba6['enduserType']==='Leads'){_0x39d363[_0x49bb('0x5c')]={'name':!_['isNil'](_0x113ba6[_0x49bb('0x59')])?_0x113ba6[_0x49bb('0x59')]:!_[_0x49bb('0x1e')](_0x113ba6[_0x49bb('0x5a')])?_0x113ba6[_0x49bb('0x5a')]+'\x20'+_0x113ba6[_0x49bb('0x5b')]:_0x113ba6[_0x49bb('0x5b')],'id':_0x113ba6['id']};_0x39d363[_0x49bb('0x5d')]=_['startCase'](_0x113ba6[_0x49bb('0x3c')]);}if(_0xf7c5fa[_0x49bb('0x5e')]){_0x39d363[_0x49bb('0x5f')]=moment[_0x49bb('0x60')](parseInt(_0xf7c5fa[_0x49bb('0x5e')])*0x3e8)[_0x49bb('0x2e')](_0x49bb('0x61'));}else if(_0xf7c5fa[_0x49bb('0x62')]&&_0xf7c5fa['endtime']){_0x39d363[_0x49bb('0x5f')]=moment[_0x49bb('0x60')](moment(_0xf7c5fa[_0x49bb('0x63')],_0x49bb('0x64'))['diff'](moment(_0xf7c5fa[_0x49bb('0x65')],_0x49bb('0x64'))))['format'](_0x49bb('0x61'));}switch(_0xf7c5fa[_0x49bb('0x66')]){case _0x49bb('0x67'):_0x39d363[_0x49bb('0x68')]=_0x49bb('0x69');break;case'complete':case _0x49bb('0x6a'):_0x39d363[_0x49bb('0x68')]=_0x49bb('0x6b');break;case _0x49bb('0x6c'):_0x39d363[_0x49bb('0x68')]=_0x49bb('0x6d');break;case'abandoned':_0x39d363[_0x49bb('0x68')]=_0x49bb('0x6e');break;case'timeout':_0x39d363['Call_Result']=_0x49bb('0x6f');default:}_0x39d363[_0x49bb('0x70')]=(_0x3c86ea==='outbound'?moment(_0xf7c5fa[_0x49bb('0x65')])[_0x49bb('0x2e')]('YYYY-MM-DDTHH:mm:ss'):moment(_0xf7c5fa[_0x49bb('0x71')])[_0x49bb('0x2e')](_0x49bb('0x64')))||moment()['format'](_0x49bb('0x64'));_0x39d363['Call_Type']=_0x3c86ea||_0x49bb('0x72');_0x39d363=_[_0x49bb('0x73')](_0x39d363,getCustomFields(_0x28570b[_0x49bb('0x74')],_0xf7c5fa));return request({'method':_0x49bb('0x3d'),'uri':_0x49bb('0x3e')+_0x1fdfca+_0x49bb('0x75'),'headers':{'Authorization':_0x49bb('0x30')+_0xfae9ab},'body':{'data':[_0x39d363]},'json':!![]})[_0x49bb('0x45')](function(_0xcc062f){if(_0xcc062f&&_0xcc062f['data'][0x0][_0x49bb('0x46')]===_0x49bb('0x76')){logger[_0x49bb('0x2c')](_0x49bb('0x77'));return{'id':_0xcc062f['data'][0x0][_0x49bb('0x47')]['id']};}})[_0x49bb('0x29')](function(_0x50caa1){logger[_0x49bb('0x2c')](_0x49bb('0x78'),_0x50caa1['stack']);console[_0x49bb('0x49')](_0x49bb('0x78'),_0x50caa1);});}exports[_0x49bb('0x79')]=function(_0x1fe623,_0x18db13,_0x1223dd,_0x2d4707,_0x91f39a,_0x51a2df){var _0xbadfd5,_0x30bdf5,_0x1ad19f;_0x51a2df[_0x49bb('0x7a')]=intUtil[_0x49bb('0x7b')](_0x51a2df[_0x49bb('0x7a')]);_0x51a2df[_0x49bb('0x7c')]=intUtil['stripTrailingSlash'](_0x51a2df[_0x49bb('0x7c')]);if(_0x91f39a&&_0x91f39a[_0x49bb('0x7d')]){logger[_0x49bb('0x2c')](_0x49bb('0x7e'),'Recording\x20is\x20enabled!');_0x18db13[_0x49bb('0x7f')]=_0x51a2df['serverUrl']+_0x49bb('0x80')+_0x18db13['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x18db13['uniqueid']);}else{_0x18db13[_0x49bb('0x7f')]='';}var _0x209458=_0x51a2df['host']==='zoho.eu'?'eu':_0x49bb('0x81');return getAccessToken(_0x51a2df)[_0x49bb('0x45')](function(_0x279b3d){_0x1ad19f=_0x279b3d;return getUser(_0x1ad19f,_0x209458,_0x51a2df,_0x2d4707[_0x49bb('0x34')]);})[_0x49bb('0x45')](function(_0x1a98e7){_0xbadfd5=_0x1a98e7;logger[_0x49bb('0x2c')](_0x49bb('0x82'),_0xbadfd5['id']);return getEndUser(_0x1ad19f,_0x209458,_0x51a2df,_0x18db13[_0x49bb('0x83')],_0x18db13[_0x49bb('0x84')],_0xbadfd5,_0x1223dd);})[_0x49bb('0x45')](function(_0x49096d){_0x30bdf5=_0x49096d;return getCall(_0x1ad19f,_0x209458,_0x51a2df,_0xbadfd5,_0x30bdf5,_0x1223dd,_0x18db13,_0x49bb('0x72'));})[_0x49bb('0x45')](function(_0x218148){if(_0x218148){logger[_0x49bb('0x2c')](_0x49bb('0x85'),_0x218148['id']);logger[_0x49bb('0x2c')](_0x49bb('0x7e'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x49bb('0x2e')](_0x49bb('0x86'),_0x2d4707['name']),_0x49bb('0x87'),{'uri':_0x49bb('0x88')+_0x51a2df['host']+_0x49bb('0x89')+_0x218148['id']});}})[_0x49bb('0x29')](function(_0x37f97b){logger[_0x49bb('0x2a')](_0x49bb('0x7e'),JSON[_0x49bb('0xe')](_0x37f97b));});};exports['outbound']=function(_0x5bfd03,_0x48485b,_0x38cd3a,_0x1499b6,_0x395714,_0x2c3fae,_0xdc5ad3){var _0x205470,_0xc7016a,_0x136726;_0x2c3fae[_0x49bb('0x7a')]=intUtil[_0x49bb('0x7b')](_0x2c3fae[_0x49bb('0x7a')]);_0x2c3fae[_0x49bb('0x7c')]=intUtil[_0x49bb('0x7b')](_0x2c3fae[_0x49bb('0x7c')]);if(_0xdc5ad3&&_0xdc5ad3['recordingFormat']&&_0xdc5ad3[_0x49bb('0x8a')]!=='none'){logger[_0x49bb('0x2c')](_0x49bb('0x8b'),'Recording\x20is\x20enabled!');_0x48485b['recordingURL']=_0x2c3fae[_0x49bb('0x7c')]+_0x49bb('0x80')+_0x48485b['uniqueid']+_0x49bb('0x8c')+md5(_0x48485b[_0x49bb('0x8d')]);}var _0x172467=_0x2c3fae[_0x49bb('0x7a')]===_0x49bb('0x8e')?'eu':_0x49bb('0x81');return getAccessToken(_0x2c3fae)[_0x49bb('0x45')](function(_0xa6972f){_0x136726=_0xa6972f;return getUser(_0x136726,_0x172467,_0x2c3fae,_0x1499b6['email']);})[_0x49bb('0x45')](function(_0x5d19c8){_0x205470=_0x5d19c8;logger[_0x49bb('0x2c')](_0x49bb('0x82'),_0x205470['id']);return getEndUser(_0x136726,_0x172467,_0x2c3fae,_0x48485b[_0x49bb('0x8f')],_0x48485b['destcalleridnum'],_0x205470,_0x38cd3a);})[_0x49bb('0x45')](function(_0x1381a1){_0xc7016a=_0x1381a1;return getCall(_0x136726,_0x172467,_0x2c3fae,_0x205470,_0xc7016a,_0x38cd3a,_0x48485b,_0x49bb('0x90'));})[_0x49bb('0x45')](function(_0xa8d0d3){if(_0xa8d0d3){logger['info'](_0x49bb('0x85'),_0xa8d0d3['id']);logger[_0x49bb('0x2c')](_0x49bb('0x8b'),_0x49bb('0x91'));emit(util[_0x49bb('0x2e')](_0x49bb('0x86'),_0x1499b6[_0x49bb('0x1b')]),_0x49bb('0x87'),{'uri':_0x49bb('0x88')+_0x2c3fae[_0x49bb('0x7a')]+_0x49bb('0x89')+_0xa8d0d3['id']});}})['catch'](function(_0x134c79){logger[_0x49bb('0x2a')](_0x49bb('0x8b'),JSON[_0x49bb('0xe')](_0x134c79));});};exports['unmanaged']=function(_0x2e1500,_0x58057c,_0x1e7c88,_0x544d39,_0xd45405,_0x3dd939){var _0x19f4ad,_0x2b953a,_0x5d4c93;_0x3dd939[_0x49bb('0x7a')]=intUtil[_0x49bb('0x7b')](_0x3dd939[_0x49bb('0x7a')]);_0x3dd939[_0x49bb('0x7c')]=intUtil[_0x49bb('0x7b')](_0x3dd939['serverUrl']);if(_0xd45405&&_0xd45405[_0x49bb('0x7d')]){logger[_0x49bb('0x2c')]('['+_0x58057c[_0x49bb('0x66')]['toUpperCase']()+']',_0x49bb('0x92'));_0x58057c[_0x49bb('0x7f')]=_0x3dd939['serverUrl']+'/api/voice/recordings/'+_0x58057c[_0x49bb('0x8d')]+_0x49bb('0x8c')+md5(_0x58057c[_0x49bb('0x8d')]);}else{_0x58057c[_0x49bb('0x7f')]='';}var _0x570f73=_0x3dd939[_0x49bb('0x7a')]===_0x49bb('0x8e')?'eu':'com';return getAccessToken(_0x3dd939)[_0x49bb('0x45')](function(_0x208e1b){_0x5d4c93=_0x208e1b;return getUser(_0x5d4c93,_0x570f73,_0x3dd939);})[_0x49bb('0x45')](function(_0x4157ae){_0x19f4ad=_0x4157ae;logger[_0x49bb('0x2c')]('The\x20User\x20ID\x20is:',_0x19f4ad['id']);return getEndUser(_0x5d4c93,_0x570f73,_0x3dd939,_0x58057c[_0x49bb('0x83')],_0x58057c['calleridnum'],_0x19f4ad,_0x1e7c88);})[_0x49bb('0x45')](function(_0x4a636a){_0x2b953a=_0x4a636a;return getCall(_0x5d4c93,_0x570f73,_0x3dd939,_0x19f4ad,_0x2b953a,_0x1e7c88,_0x58057c,_0x49bb('0x72'));})[_0x49bb('0x45')](function(_0x955781){if(_0x955781){logger[_0x49bb('0x2c')](_0x49bb('0x85'),_0x955781['id']);}})[_0x49bb('0x29')](function(_0x120bf2){logger['error']('['+_0x58057c[_0x49bb('0x66')][_0x49bb('0x93')]()+']',JSON['stringify'](_0x120bf2));});}; \ No newline at end of file +var _0xdd86=['err','stack','queue','host','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/downloads?type=uniqueid&token=','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','/api/voice/recordings/','destcalleridname','destcalleridnum','Outbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','unmanaged','Inbound','toUpperCase','lodash','request-promise','md5','./util','moment','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','localhost','socket.io-emitter','emit','[HTTP]','stringify','length','forEach','includes','string','picklist','type','idField','content','toString','variable','variableName','Variable','name','toLowerCase','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientId','refresh_token','then','Failing\x20creating\x20the\x20access_token','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','isArrayLikeObject','users','findIndex','email','Agent\x20found!','profile','Administrator','Using\x20the\x20admin\x20account!','user','error','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','data','enduserType','catch','POST','https://www.zohoapis.','/crm/v2/','startCase','role','first_name','last_name','details','moduleCreate','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','/crm/v2/Contacts/search?criteria=((Phone:equals:','nothing','lead','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','$se_module','Call_Duration','utc','talktime','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','lastevent','called','Call_Result','Called','complete','Rejected','abandoned','timeout','Call_Start_Time','outbound','agentcalledAt','merge','Fields','code','SUCCESS','Call\x20created!'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdd86,0x15d));var _0x6dd8=function(_0x5d5a5e,_0x3e6054){_0x5d5a5e=_0x5d5a5e-0x0;var _0x35a912=_0xdd86[_0x5d5a5e];return _0x35a912;};'use strict';var _=require(_0x6dd8('0x0'));var rp=require(_0x6dd8('0x1'));var md5=require(_0x6dd8('0x2'));var util=require('util');var intUtil=require(_0x6dd8('0x3'));var moment=require(_0x6dd8('0x4'));var Redis=require('ioredis');var BPromise=require(_0x6dd8('0x5'));var config=require(_0x6dd8('0x6'));var logger=require(_0x6dd8('0x7'))(_0x6dd8('0x8'));config[_0x6dd8('0x9')]=_['defaults'](config[_0x6dd8('0x9')],{'host':_0x6dd8('0xa'),'port':0x18eb});var io=require(_0x6dd8('0xb'))(new Redis(config[_0x6dd8('0x9')]));function emit(_0x3e139f,_0x40a062,_0xbe08f8){io['to'](_0x3e139f)[_0x6dd8('0xc')](_0x40a062,_0xbe08f8);}function request(_0x5de94c){logger['debug'](_0x6dd8('0xd'),JSON[_0x6dd8('0xe')](_0x5de94c));return rp(_0x5de94c);}function getCustomFields(_0x169a27,_0x4b1259){var _0x5cdc15={};if(_0x169a27[_0x6dd8('0xf')]>0x0){_[_0x6dd8('0x10')](_0x169a27,function(_0x209900){if(_[_0x6dd8('0x11')]([_0x6dd8('0x12'),_0x6dd8('0x13')],_0x209900[_0x6dd8('0x14')])&&_0x209900[_0x6dd8('0x15')]){_0x5cdc15[_0x209900['idField']]=_0x209900[_0x6dd8('0x16')][_0x6dd8('0x17')]();}else if(_0x209900[_0x6dd8('0x14')]===_0x6dd8('0x18')&&_0x209900[_0x6dd8('0x19')]&&_0x209900[_0x6dd8('0x15')]&&_0x4b1259[_0x209900[_0x6dd8('0x19')]]){_0x5cdc15[_0x209900[_0x6dd8('0x15')]]=_0x4b1259[_0x209900['variableName']][_0x6dd8('0x17')]();}else if(_0x209900[_0x6dd8('0x14')]==='customVariable'&&_0x209900[_0x6dd8('0x1a')]&&_0x209900['Variable'][_0x6dd8('0x1b')]&&_0x209900[_0x6dd8('0x15')]&&_0x4b1259[_0x209900[_0x6dd8('0x1a')]['name'][_0x6dd8('0x1c')]()]){_0x5cdc15[_0x209900['idField']]=_0x4b1259[_0x209900[_0x6dd8('0x1a')][_0x6dd8('0x1b')]['toLowerCase']()]['toString']();}});}return _0x5cdc15;}function getName(_0xc3fb){if(_0xc3fb['indexOf']('\x20')>0x0){var _0x155729=_0xc3fb[_0x6dd8('0x1d')](/ (.+)/);if(_0x155729[0x1]){return _0x155729;}}return[_0xc3fb,_0xc3fb];}var accountsTokens={};function getAccessToken(_0x15a3b5){return new Promise(function(_0x415e8c,_0x39fa16){if(!_[_0x6dd8('0x1e')](accountsTokens[_0x15a3b5['id']])&&!_[_0x6dd8('0x1e')](accountsTokens[_0x15a3b5['id']][_0x6dd8('0x1f')])){if(moment()[_0x6dd8('0x20')](accountsTokens[_0x15a3b5['id']][_0x6dd8('0x21')])){_0x415e8c(accountsTokens[_0x15a3b5['id']]['access_token']);}}var _0x1edc47;switch(_0x15a3b5[_0x6dd8('0x22')]){case'US':_0x1edc47=_0x6dd8('0x23');break;case'AU':_0x1edc47=_0x6dd8('0x24');break;case'EU':_0x1edc47=_0x6dd8('0x25');break;case'IN':_0x1edc47=_0x6dd8('0x26');break;case'CN':_0x1edc47=_0x6dd8('0x27');break;default:_0x1edc47=_0x6dd8('0x25');break;}var _0x3503e0={'method':'POST','uri':_0x1edc47+_0x6dd8('0x28'),'qs':{'refresh_token':_0x15a3b5[_0x6dd8('0x29')],'client_id':_0x15a3b5[_0x6dd8('0x2a')],'client_secret':_0x15a3b5['clientSecret'],'grant_type':_0x6dd8('0x2b')},'json':!![]};return rp(_0x3503e0)[_0x6dd8('0x2c')](function(_0xe2bead){accountsTokens[_0x15a3b5['id']]={'access_token':_0xe2bead[_0x6dd8('0x1f')],'expires_in':moment()['add'](_0xe2bead[_0x6dd8('0x21')],'seconds')};_0x415e8c(_0xe2bead['access_token']);})['catch'](function(_0x58efc6){logger['error'](_0x6dd8('0x2d'),_0x58efc6['stack']);_0x39fa16(_0x58efc6);});});}function getUser(_0x330144,_0x2107df,_0x1ff206,_0x51ac5e){logger[_0x6dd8('0x2e')](_0x6dd8('0x2f'));return request({'method':_0x6dd8('0x30'),'uri':util[_0x6dd8('0x31')](_0x6dd8('0x32'),_0x2107df),'qs':{'type':_0x6dd8('0x33')},'headers':{'Authorization':_0x6dd8('0x34')+_0x330144},'json':!![]})[_0x6dd8('0x2c')](function(_0x5e884d){if(_0x5e884d['users']){var _0x4aee48=-0x1;if(_[_0x6dd8('0x35')](_0x5e884d[_0x6dd8('0x36')])){if(!_[_0x6dd8('0x1e')](_0x51ac5e)){_0x4aee48=_[_0x6dd8('0x37')](_0x5e884d[_0x6dd8('0x36')],function(_0x3f529a){return _0x3f529a[_0x6dd8('0x38')]===_0x51ac5e;});}if(_0x4aee48>=0x0){logger[_0x6dd8('0x2e')](_0x6dd8('0x39'));}else{logger['info']('Using\x20the\x20admin\x20account!');_0x4aee48=_[_0x6dd8('0x37')](_0x5e884d['users'],function(_0x489cc4){return _0x489cc4[_0x6dd8('0x3a')][_0x6dd8('0x1b')]===_0x6dd8('0x3b');});}return _0x5e884d[_0x6dd8('0x36')][_0x4aee48];}else{if(_0x5e884d['user']['profile'][_0x6dd8('0x1b')]===_0x6dd8('0x3b')){logger[_0x6dd8('0x2e')](_0x6dd8('0x3c'));user=_0x5e884d[_0x6dd8('0x3d')];return user;}else{logger[_0x6dd8('0x3e')]('The\x20failing\x20result\x20is',JSON[_0x6dd8('0xe')](_0x5e884d));throw new Error(_0x6dd8('0x3f')+JSON[_0x6dd8('0xe')](_0x5e884d));}}}else{logger[_0x6dd8('0x3e')](_0x6dd8('0x40'),JSON[_0x6dd8('0xe')](_0x5e884d));throw new Error(_0x6dd8('0x3f')+JSON[_0x6dd8('0xe')](_0x5e884d));}})['catch'](function(_0x52ae17){console[_0x6dd8('0x3e')](_0x52ae17);});}function getZohoUser(_0x1c44b5,_0x2e4193){return new BPromise(function(_0x5950f9,_0x3624bc){request(_0x1c44b5)['then'](function(_0x4b852f){var _0x205d44=null;if(_0x4b852f){_0x205d44=_0x4b852f[_0x6dd8('0x41')][0x0];_0x205d44[_0x6dd8('0x42')]=_0x2e4193;}_0x5950f9(_0x205d44);})[_0x6dd8('0x43')](function(_0x5af5eb){_0x3624bc(_0x5af5eb);});});}function createEndUser(_0x1088c6,_0x5e8fe2,_0x3ceff2,_0x4763e8,_0x2a3858,_0x86d2c7){var _0x3ceff2=getName(_0x3ceff2);return request({'method':_0x6dd8('0x44'),'uri':_0x6dd8('0x45')+_0x5e8fe2+_0x6dd8('0x46')+_[_0x6dd8('0x47')](_0x86d2c7['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x3ceff2[0x1],'First_Name':_0x3ceff2[0x0],'Phone':_0x4763e8,'Owner':{'name':!_[_0x6dd8('0x1e')](_0x2a3858[_0x6dd8('0x48')][_0x6dd8('0x1b')])?_0x2a3858[_0x6dd8('0x48')][_0x6dd8('0x1b')]:!_[_0x6dd8('0x1e')](_0x2a3858[_0x6dd8('0x49')])?_0x2a3858[_0x6dd8('0x49')]+'\x20'+_0x2a3858[_0x6dd8('0x4a')]:_0x2a3858[_0x6dd8('0x4a')],'id':_0x2a3858['id']}}]},'headers':{'Authorization':_0x6dd8('0x34')+_0x1088c6},'json':!![]})[_0x6dd8('0x2c')](function(_0x551f0e){if(_0x551f0e&&_0x551f0e[_0x6dd8('0x41')][0x0]['code']==='SUCCESS'){var _0xa31043=_0x551f0e[_0x6dd8('0x41')][0x0][_0x6dd8('0x4b')];_0xa31043[_0x6dd8('0x42')]=_[_0x6dd8('0x47')](_0x86d2c7[_0x6dd8('0x4c')])+'s';return _0xa31043;}logger[_0x6dd8('0x3e')](_0x6dd8('0x40'),JSON[_0x6dd8('0xe')](data));throw new Error(_0x6dd8('0x4d')+JSON[_0x6dd8('0xe')](data));})[_0x6dd8('0x43')](function(_0x4219ad){console[_0x6dd8('0x4e')](_0x6dd8('0x4f'),_0x4219ad);});}function getEndUser(_0x4ede2c,_0x1cb8c9,_0x63df02,_0xcd5cd8,_0x2fe7ff,_0x40c267,_0x1e2a99){var _0x12757e={'method':_0x6dd8('0x30'),'uri':'','headers':{'Authorization':_0x6dd8('0x34')+_0x4ede2c},'json':!![]};switch(_0x1e2a99[_0x6dd8('0x50')]){case _0x6dd8('0x51'):_0x12757e[_0x6dd8('0x52')]=_0x6dd8('0x45')+_0x1cb8c9+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x2fe7ff+'))';return getZohoUser(_0x12757e,_0x6dd8('0x53'))['then'](function(_0x52012b){if(_0x52012b)return _0x52012b;_0x12757e[_0x6dd8('0x52')]=_0x6dd8('0x45')+_0x1cb8c9+_0x6dd8('0x54')+_0x2fe7ff+'))';return getZohoUser(_0x12757e,_0x6dd8('0x55'))['then'](function(_0x5a4225){if(_0x5a4225)return _0x5a4225;if(_0x1e2a99[_0x6dd8('0x4c')]!='nothing'){return createEndUser(_0x4ede2c,_0x1cb8c9,_0xcd5cd8,_0x2fe7ff,_0x40c267,_0x1e2a99);}else{return{};}});});break;case'contact':_0x12757e[_0x6dd8('0x52')]=_0x6dd8('0x45')+_0x1cb8c9+_0x6dd8('0x56')+_0x2fe7ff+'))';return getZohoUser(_0x12757e,_0x6dd8('0x53'))[_0x6dd8('0x2c')](function(_0x4eb3ce){if(_0x4eb3ce)return _0x4eb3ce;if(_0x1e2a99['moduleCreate']!=_0x6dd8('0x57')){return createEndUser(_0x4ede2c,_0x1cb8c9,_0xcd5cd8,_0x2fe7ff,_0x40c267,_0x1e2a99);}else{return{};}});break;case _0x6dd8('0x58'):_0x12757e[_0x6dd8('0x52')]=_0x6dd8('0x45')+_0x1cb8c9+_0x6dd8('0x54')+_0x2fe7ff+'))';return getZohoUser(_0x12757e,'Leads')[_0x6dd8('0x2c')](function(_0x56be62){if(_0x56be62)return _0x56be62;if(_0x1e2a99[_0x6dd8('0x4c')]!=_0x6dd8('0x57')){return createEndUser(_0x4ede2c,_0x1cb8c9,_0xcd5cd8,_0x2fe7ff,_0x40c267,_0x1e2a99);}else{return{};}});break;}}function getCall(_0x203162,_0x22b9e6,_0x54af4b,_0x46fdef,_0x2e163b,_0x468c7f,_0x156808,_0x211953){logger[_0x6dd8('0x2e')](_0x6dd8('0x59'));var _0x133dae={};_0x133dae[_0x6dd8('0x5a')]={'name':!_['isNil'](_0x46fdef[_0x6dd8('0x48')]['name'])&&!_[_0x6dd8('0x1e')](_0x46fdef['profile'][_0x6dd8('0x1b')])&&_0x46fdef[_0x6dd8('0x3a')]['name']===_0x6dd8('0x5b')?_0x46fdef[_0x6dd8('0x48')][_0x6dd8('0x1b')]:!_[_0x6dd8('0x1e')](_0x46fdef[_0x6dd8('0x49')])?_0x46fdef[_0x6dd8('0x49')]+'\x20'+_0x46fdef[_0x6dd8('0x4a')]:_0x46fdef[_0x6dd8('0x4a')],'id':_0x46fdef['id']};_0x133dae[_0x6dd8('0x5c')]=intUtil[_0x6dd8('0x5d')](_0x468c7f[_0x6dd8('0x5e')],_0x156808,'\x20');_0x133dae['Description']=intUtil[_0x6dd8('0x5d')](_0x468c7f[_0x6dd8('0x5f')],_0x156808,'\x0a');if(_0x2e163b[_0x6dd8('0x42')]===_0x6dd8('0x53')){_0x133dae[_0x6dd8('0x60')]={'name':!_[_0x6dd8('0x1e')](_0x2e163b['Full_Name'])?_0x2e163b[_0x6dd8('0x61')]:!_[_0x6dd8('0x1e')](_0x2e163b[_0x6dd8('0x62')])?_0x2e163b[_0x6dd8('0x62')]+'\x20'+_0x2e163b[_0x6dd8('0x63')]:_0x2e163b[_0x6dd8('0x63')],'id':_0x2e163b['id']};}if(_0x2e163b[_0x6dd8('0x42')]==='Leads'){_0x133dae['What_Id']={'name':!_[_0x6dd8('0x1e')](_0x2e163b['Full_Name'])?_0x2e163b[_0x6dd8('0x61')]:!_[_0x6dd8('0x1e')](_0x2e163b[_0x6dd8('0x62')])?_0x2e163b[_0x6dd8('0x62')]+'\x20'+_0x2e163b[_0x6dd8('0x63')]:_0x2e163b[_0x6dd8('0x63')],'id':_0x2e163b['id']};_0x133dae[_0x6dd8('0x64')]=_['startCase'](_0x2e163b[_0x6dd8('0x42')]);}if(_0x156808['talktime']){_0x133dae[_0x6dd8('0x65')]=moment[_0x6dd8('0x66')](parseInt(_0x156808[_0x6dd8('0x67')])*0x3e8)[_0x6dd8('0x31')](_0x6dd8('0x68'));}else if(_0x156808[_0x6dd8('0x69')]&&_0x156808[_0x6dd8('0x6a')]){_0x133dae[_0x6dd8('0x65')]=moment[_0x6dd8('0x66')](moment(_0x156808[_0x6dd8('0x6a')],_0x6dd8('0x6b'))[_0x6dd8('0x6c')](moment(_0x156808['starttime'],_0x6dd8('0x6b'))))[_0x6dd8('0x31')](_0x6dd8('0x68'));}switch(_0x156808[_0x6dd8('0x6d')]){case _0x6dd8('0x6e'):_0x133dae[_0x6dd8('0x6f')]=_0x6dd8('0x70');break;case _0x6dd8('0x71'):case'connect':_0x133dae[_0x6dd8('0x6f')]='Answered';break;case'rejected':_0x133dae[_0x6dd8('0x6f')]=_0x6dd8('0x72');break;case _0x6dd8('0x73'):_0x133dae['Call_Result']='Abandoned';break;case _0x6dd8('0x74'):_0x133dae[_0x6dd8('0x6f')]='Timeout';default:}_0x133dae[_0x6dd8('0x75')]=(_0x211953===_0x6dd8('0x76')?moment(_0x156808['starttime'])[_0x6dd8('0x31')](_0x6dd8('0x6b')):moment(_0x156808[_0x6dd8('0x77')])[_0x6dd8('0x31')](_0x6dd8('0x6b')))||moment()['format'](_0x6dd8('0x6b'));_0x133dae['Call_Type']=_0x211953||'Inbound';_0x133dae=_[_0x6dd8('0x78')](_0x133dae,getCustomFields(_0x468c7f[_0x6dd8('0x79')],_0x156808));return request({'method':_0x6dd8('0x44'),'uri':_0x6dd8('0x45')+_0x22b9e6+'/crm/v2/Calls','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x203162},'body':{'data':[_0x133dae]},'json':!![]})[_0x6dd8('0x2c')](function(_0x20df2c){if(_0x20df2c&&_0x20df2c[_0x6dd8('0x41')][0x0][_0x6dd8('0x7a')]===_0x6dd8('0x7b')){logger['info'](_0x6dd8('0x7c'));return{'id':_0x20df2c[_0x6dd8('0x41')][0x0]['details']['id']};}})['catch'](function(_0x12abe1){logger[_0x6dd8('0x2e')](_0x6dd8('0x7d'),_0x12abe1[_0x6dd8('0x7e')]);console[_0x6dd8('0x4e')](_0x6dd8('0x7d'),_0x12abe1);});}exports[_0x6dd8('0x7f')]=function(_0x3b50d8,_0x47ae3f,_0x117d6d,_0x20cd87,_0x56ae35,_0xa8264c){var _0x5c0235,_0xbf62a5,_0x59945b;_0xa8264c[_0x6dd8('0x80')]=intUtil['stripTrailingSlash'](_0xa8264c[_0x6dd8('0x80')]);_0xa8264c[_0x6dd8('0x81')]=intUtil[_0x6dd8('0x82')](_0xa8264c['serverUrl']);if(_0x56ae35&&_0x56ae35[_0x6dd8('0x83')]){logger[_0x6dd8('0x2e')](_0x6dd8('0x84'),_0x6dd8('0x85'));_0x47ae3f[_0x6dd8('0x86')]=_0xa8264c[_0x6dd8('0x81')]+'/api/voice/recordings/'+_0x47ae3f['uniqueid']+_0x6dd8('0x87')+md5(_0x47ae3f[_0x6dd8('0x88')]);}else{_0x47ae3f[_0x6dd8('0x86')]='';}var _0x146726=_0xa8264c['host']===_0x6dd8('0x89')?'eu':_0x6dd8('0x8a');return getAccessToken(_0xa8264c)[_0x6dd8('0x2c')](function(_0x1b5356){_0x59945b=_0x1b5356;return getUser(_0x59945b,_0x146726,_0xa8264c,_0x20cd87[_0x6dd8('0x38')]);})['then'](function(_0x49ffff){_0x5c0235=_0x49ffff;logger[_0x6dd8('0x2e')](_0x6dd8('0x8b'),_0x5c0235['id']);return getEndUser(_0x59945b,_0x146726,_0xa8264c,_0x47ae3f[_0x6dd8('0x8c')],_0x47ae3f[_0x6dd8('0x8d')],_0x5c0235,_0x117d6d);})[_0x6dd8('0x2c')](function(_0x2e9bb7){_0xbf62a5=_0x2e9bb7;return getCall(_0x59945b,_0x146726,_0xa8264c,_0x5c0235,_0xbf62a5,_0x117d6d,_0x47ae3f,'Inbound');})[_0x6dd8('0x2c')](function(_0x5473f8){if(_0x5473f8){logger['info'](_0x6dd8('0x8e'),_0x5473f8['id']);logger[_0x6dd8('0x2e')](_0x6dd8('0x84'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x6dd8('0x31')]('user:%s',_0x20cd87[_0x6dd8('0x1b')]),_0x6dd8('0x8f'),{'uri':_0x6dd8('0x90')+_0xa8264c[_0x6dd8('0x80')]+_0x6dd8('0x91')+_0x5473f8['id']});}})[_0x6dd8('0x43')](function(_0x319cde){logger[_0x6dd8('0x3e')]('[QUEUE]',JSON[_0x6dd8('0xe')](_0x319cde));});};exports[_0x6dd8('0x76')]=function(_0x2e8430,_0x52403a,_0x5e0a27,_0x46ada2,_0x798363,_0x4b7c9e,_0x194f59){var _0x321d4e,_0x14ec67,_0x4dc1bd;_0x4b7c9e['host']=intUtil['stripTrailingSlash'](_0x4b7c9e['host']);_0x4b7c9e[_0x6dd8('0x81')]=intUtil[_0x6dd8('0x82')](_0x4b7c9e[_0x6dd8('0x81')]);if(_0x194f59&&_0x194f59[_0x6dd8('0x92')]&&_0x194f59[_0x6dd8('0x92')]!==_0x6dd8('0x93')){logger[_0x6dd8('0x2e')](_0x6dd8('0x94'),'Recording\x20is\x20enabled!');_0x52403a[_0x6dd8('0x86')]=_0x4b7c9e[_0x6dd8('0x81')]+_0x6dd8('0x95')+_0x52403a['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x52403a['uniqueid']);}var _0x2e7f1d=_0x4b7c9e[_0x6dd8('0x80')]===_0x6dd8('0x89')?'eu':_0x6dd8('0x8a');return getAccessToken(_0x4b7c9e)[_0x6dd8('0x2c')](function(_0x3786a2){_0x4dc1bd=_0x3786a2;return getUser(_0x4dc1bd,_0x2e7f1d,_0x4b7c9e,_0x46ada2[_0x6dd8('0x38')]);})['then'](function(_0xb7bfd4){_0x321d4e=_0xb7bfd4;logger[_0x6dd8('0x2e')]('The\x20User\x20ID\x20is:',_0x321d4e['id']);return getEndUser(_0x4dc1bd,_0x2e7f1d,_0x4b7c9e,_0x52403a[_0x6dd8('0x96')],_0x52403a[_0x6dd8('0x97')],_0x321d4e,_0x5e0a27);})[_0x6dd8('0x2c')](function(_0x3e4eb7){_0x14ec67=_0x3e4eb7;return getCall(_0x4dc1bd,_0x2e7f1d,_0x4b7c9e,_0x321d4e,_0x14ec67,_0x5e0a27,_0x52403a,_0x6dd8('0x98'));})[_0x6dd8('0x2c')](function(_0x3503ef){if(_0x3503ef){logger[_0x6dd8('0x2e')](_0x6dd8('0x8e'),_0x3503ef['id']);logger['info'](_0x6dd8('0x94'),_0x6dd8('0x99'));emit(util[_0x6dd8('0x31')](_0x6dd8('0x9a'),_0x46ada2[_0x6dd8('0x1b')]),_0x6dd8('0x8f'),{'uri':_0x6dd8('0x90')+_0x4b7c9e[_0x6dd8('0x80')]+_0x6dd8('0x91')+_0x3503ef['id']});}})[_0x6dd8('0x43')](function(_0x3b1d89){logger['error']('[OUTBOUND]',JSON['stringify'](_0x3b1d89));});};exports[_0x6dd8('0x9b')]=function(_0x403c4d,_0x531d09,_0x1e2343,_0x3d9b5a,_0x653f02,_0x39c73a){var _0x48ad03,_0x57423f,_0x544f09;_0x39c73a[_0x6dd8('0x80')]=intUtil[_0x6dd8('0x82')](_0x39c73a['host']);_0x39c73a[_0x6dd8('0x81')]=intUtil[_0x6dd8('0x82')](_0x39c73a[_0x6dd8('0x81')]);if(_0x653f02&&_0x653f02[_0x6dd8('0x83')]){logger[_0x6dd8('0x2e')]('['+_0x531d09['lastevent']['toUpperCase']()+']',_0x6dd8('0x85'));_0x531d09[_0x6dd8('0x86')]=_0x39c73a[_0x6dd8('0x81')]+_0x6dd8('0x95')+_0x531d09[_0x6dd8('0x88')]+_0x6dd8('0x87')+md5(_0x531d09[_0x6dd8('0x88')]);}else{_0x531d09[_0x6dd8('0x86')]='';}var _0x2def32=_0x39c73a[_0x6dd8('0x80')]===_0x6dd8('0x89')?'eu':_0x6dd8('0x8a');return getAccessToken(_0x39c73a)[_0x6dd8('0x2c')](function(_0x12f9ba){_0x544f09=_0x12f9ba;return getUser(_0x544f09,_0x2def32,_0x39c73a);})[_0x6dd8('0x2c')](function(_0x3274a0){_0x48ad03=_0x3274a0;logger[_0x6dd8('0x2e')](_0x6dd8('0x8b'),_0x48ad03['id']);return getEndUser(_0x544f09,_0x2def32,_0x39c73a,_0x531d09[_0x6dd8('0x8c')],_0x531d09[_0x6dd8('0x8d')],_0x48ad03,_0x1e2343);})[_0x6dd8('0x2c')](function(_0x33762a){_0x57423f=_0x33762a;return getCall(_0x544f09,_0x2def32,_0x39c73a,_0x48ad03,_0x57423f,_0x1e2343,_0x531d09,_0x6dd8('0x9c'));})[_0x6dd8('0x2c')](function(_0x41f72c){if(_0x41f72c){logger['info'](_0x6dd8('0x8e'),_0x41f72c['id']);}})[_0x6dd8('0x43')](function(_0x28fae8){logger[_0x6dd8('0x3e')]('['+_0x531d09[_0x6dd8('0x6d')][_0x6dd8('0x9d')]()+']',JSON[_0x6dd8('0xe')](_0x28fae8));});}; \ 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 45c9314..c73d204 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 _0xab19=['shelljs','mustache','../../../../config/logger','trigger','data2','Script','data3','render','exec','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s'];(function(_0x35a274,_0x98b399){var _0x40d905=function(_0x5c8455){while(--_0x5c8455){_0x35a274['push'](_0x35a274['shift']());}};_0x40d905(++_0x98b399);}(_0xab19,0x82));var _0x9ab1=function(_0x2862d8,_0x2b13b8){_0x2862d8=_0x2862d8-0x0;var _0x26e32b=_0xab19[_0x2862d8];return _0x26e32b;};'use strict';var util=require('util');var sh=require(_0x9ab1('0x0'));var Mustache=require(_0x9ab1('0x1'));var logger=require(_0x9ab1('0x2'))(_0x9ab1('0x3'));exports['exec']=function(_0x3628aa,_0x4433da){var _0x268a7e=_0x3628aa[_0x9ab1('0x4')]?_0x3628aa[_0x9ab1('0x4')]:_0x9ab1('0x5');var _0x3f2cb9=_0x3628aa[_0x9ab1('0x6')]?Mustache[_0x9ab1('0x7')](_0x3628aa[_0x9ab1('0x6')],_0x4433da):_0x4433da;sh[_0x9ab1('0x8')](_0x3f2cb9,function(_0x42b61c,_0x5137ea,_0x172d8e){if(_0x42b61c!==0x0){logger[_0x9ab1('0x9')](util[_0x9ab1('0xa')](_0x9ab1('0xb'),_0x268a7e,_0x3f2cb9,_0x42b61c,_0x172d8e));}else{logger['info'](util[_0x9ab1('0xa')](_0x9ab1('0xc'),_0x268a7e,_0x3f2cb9,_0x5137ea));}});}; \ No newline at end of file +var _0x73d4=['shelljs','mustache','data2','Script','render','format','%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'];(function(_0x20ceb7,_0x121580){var _0x34d505=function(_0x11aa04){while(--_0x11aa04){_0x20ceb7['push'](_0x20ceb7['shift']());}};_0x34d505(++_0x121580);}(_0x73d4,0x1e9));var _0x473d=function(_0x257e8f,_0xdc7fc9){_0x257e8f=_0x257e8f-0x0;var _0x2d8b1e=_0x73d4[_0x257e8f];return _0x2d8b1e;};'use strict';var util=require(_0x473d('0x0'));var sh=require(_0x473d('0x1'));var Mustache=require(_0x473d('0x2'));var logger=require('../../../../config/logger')('trigger');exports['exec']=function(_0x2c809a,_0x4913df){var _0x75497c=_0x2c809a[_0x473d('0x3')]?_0x2c809a[_0x473d('0x3')]:_0x473d('0x4');var _0x122b1d=_0x2c809a['data3']?Mustache[_0x473d('0x5')](_0x2c809a['data3'],_0x4913df):_0x4913df;sh['exec'](_0x122b1d,function(_0x1f9c19,_0x578df8,_0x5b7c71){if(_0x1f9c19!==0x0){logger['error'](util[_0x473d('0x6')](_0x473d('0x7'),_0x75497c,_0x122b1d,_0x1f9c19,_0x5b7c71));}else{logger[_0x473d('0x8')](util['format'](_0x473d('0x9'),_0x75497c,_0x122b1d,_0x578df8));}});}; \ 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 b177e91..3ed0322 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 _0x5f72=['parse','error','stack','toUpperCase','GET','DELETE','POST','PUT','data7','body','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then','isNil','info','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','lodash','mustache','../../../../config/logger','trigger','data1','render','data2','data5','number','headers','data6'];(function(_0x3a8c8f,_0x567295){var _0x4d8b4a=function(_0x42a96e){while(--_0x42a96e){_0x3a8c8f['push'](_0x3a8c8f['shift']());}};_0x4d8b4a(++_0x567295);}(_0x5f72,0x1e2));var _0x25f7=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x5f72[_0x2d7f0e];return _0x110b07;};'use strict';var rp=require(_0x25f7('0x0'));var util=require(_0x25f7('0x1'));var _=require(_0x25f7('0x2'));var Mustache=require(_0x25f7('0x3'));var logger=require(_0x25f7('0x4'))(_0x25f7('0x5'));exports['exec']=function(_0x146121,_0x366f2f){var _0x34ec2b,_0x19bace;var _0x33cf26={'method':_0x146121[_0x25f7('0x6')]['toUpperCase'](),'uri':Mustache[_0x25f7('0x7')](_0x146121[_0x25f7('0x8')],_0x366f2f),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x146121[_0x25f7('0x9')])===_0x25f7('0xa')&&parseInt(_0x146121[_0x25f7('0x9')])>=0x1&&parseInt(_0x146121[_0x25f7('0x9')])<=0xa?parseInt(_0x146121[_0x25f7('0x9')])*0x3e8:0x5*0x3e8};try{_0x33cf26[_0x25f7('0xb')]=_0x146121[_0x25f7('0xc')]?JSON[_0x25f7('0xd')](Mustache['render'](_0x146121['data6'],_0x366f2f)):{};}catch(_0x327b37){logger[_0x25f7('0xe')](_0x327b37[_0x25f7('0xf')]);}switch(_0x146121[_0x25f7('0x6')][_0x25f7('0x10')]()){case _0x25f7('0x11'):case _0x25f7('0x12'):_0x34ec2b=null;_0x33cf26['qs']=_0x366f2f;break;case _0x25f7('0x13'):case _0x25f7('0x14'):if(_0x146121[_0x25f7('0x15')]){try{_0x34ec2b=JSON[_0x25f7('0xd')](Mustache[_0x25f7('0x7')](_0x146121[_0x25f7('0x15')],_0x366f2f));_0x33cf26[_0x25f7('0x16')]=_0x34ec2b;}catch(_0x3a8077){logger[_0x25f7('0xe')](_0x3a8077[_0x25f7('0xf')]);logger[_0x25f7('0xe')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x34ec2b=_0x366f2f;_0x33cf26[_0x25f7('0x16')]=_0x34ec2b;}break;}logger['info'](util[_0x25f7('0x17')](_0x25f7('0x18'),_0x146121[_0x25f7('0x6')],_0x146121[_0x25f7('0x8')],JSON['stringify'](_0x33cf26)));rp(_0x33cf26)[_0x25f7('0x19')](function(_0x265519){_0x34ec2b=!_[_0x25f7('0x1a')](_0x34ec2b)?',\x20request\x20body:\x20'+_0x34ec2b:'';_0x19bace=typeof _0x265519[_0x25f7('0x16')]==='object'?JSON['stringify'](_0x265519['body']):_0x265519[_0x25f7('0x16')];logger[_0x25f7('0x1b')](util[_0x25f7('0x17')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x146121[_0x25f7('0x6')],_0x146121['data2'],_0x265519[_0x25f7('0x1c')],_0x19bace));})[_0x25f7('0x1d')](function(_0x2ef9b8){logger[_0x25f7('0xe')](util['format'](_0x25f7('0x1e'),_0x146121[_0x25f7('0x6')],_0x146121[_0x25f7('0x8')],_0x2ef9b8[_0x25f7('0x1c')],_0x2ef9b8[_0x25f7('0x1f')],_0x2ef9b8[_0x25f7('0x20')]));});}; \ No newline at end of file +var _0x9e41=['toUpperCase','GET','DELETE','POST','parse','data7','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then',',\x20request\x20body:\x20','body','info','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','mustache','../../../../config/logger','trigger','exec','render','data5','number','data6','data1'];(function(_0x4f60d4,_0x3dd8b5){var _0x10b527=function(_0x387199){while(--_0x387199){_0x4f60d4['push'](_0x4f60d4['shift']());}};_0x10b527(++_0x3dd8b5);}(_0x9e41,0xf5));var _0x19e4=function(_0xd7f9dc,_0x55991b){_0xd7f9dc=_0xd7f9dc-0x0;var _0x1be26d=_0x9e41[_0xd7f9dc];return _0x1be26d;};'use strict';var rp=require(_0x19e4('0x0'));var util=require(_0x19e4('0x1'));var _=require('lodash');var Mustache=require(_0x19e4('0x2'));var logger=require(_0x19e4('0x3'))(_0x19e4('0x4'));exports[_0x19e4('0x5')]=function(_0x34b767,_0x2da0e1){var _0x4de110,_0xe49e8f;var _0x56461d={'method':_0x34b767['data1']['toUpperCase'](),'uri':Mustache[_0x19e4('0x6')](_0x34b767['data2'],_0x2da0e1),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x34b767[_0x19e4('0x7')])===_0x19e4('0x8')&&parseInt(_0x34b767[_0x19e4('0x7')])>=0x1&&parseInt(_0x34b767[_0x19e4('0x7')])<=0xa?parseInt(_0x34b767[_0x19e4('0x7')])*0x3e8:0x5*0x3e8};try{_0x56461d['headers']=_0x34b767['data6']?JSON['parse'](Mustache[_0x19e4('0x6')](_0x34b767[_0x19e4('0x9')],_0x2da0e1)):{};}catch(_0x3f7e00){logger['error'](_0x3f7e00['stack']);}switch(_0x34b767[_0x19e4('0xa')][_0x19e4('0xb')]()){case _0x19e4('0xc'):case _0x19e4('0xd'):_0x4de110=null;_0x56461d['qs']=_0x2da0e1;break;case _0x19e4('0xe'):case'PUT':if(_0x34b767['data7']){try{_0x4de110=JSON[_0x19e4('0xf')](Mustache[_0x19e4('0x6')](_0x34b767[_0x19e4('0x10')],_0x2da0e1));_0x56461d['body']=_0x4de110;}catch(_0x40bac4){logger[_0x19e4('0x11')](_0x40bac4['stack']);logger[_0x19e4('0x11')](_0x19e4('0x12'));}}else{_0x4de110=_0x2da0e1;_0x56461d['body']=_0x4de110;}break;}logger['info'](util[_0x19e4('0x13')](_0x19e4('0x14'),_0x34b767[_0x19e4('0xa')],_0x34b767[_0x19e4('0x15')],JSON[_0x19e4('0x16')](_0x56461d)));rp(_0x56461d)[_0x19e4('0x17')](function(_0x504961){_0x4de110=!_['isNil'](_0x4de110)?_0x19e4('0x18')+_0x4de110:'';_0xe49e8f=typeof _0x504961['body']==='object'?JSON[_0x19e4('0x16')](_0x504961['body']):_0x504961[_0x19e4('0x19')];logger[_0x19e4('0x1a')](util[_0x19e4('0x13')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x34b767[_0x19e4('0xa')],_0x34b767['data2'],_0x504961[_0x19e4('0x1b')],_0xe49e8f));})[_0x19e4('0x1c')](function(_0x4b17a5){logger[_0x19e4('0x11')](util[_0x19e4('0x13')](_0x19e4('0x1d'),_0x34b767[_0x19e4('0xa')],_0x34b767[_0x19e4('0x15')],_0x4b17a5[_0x19e4('0x1b')],_0x4b17a5[_0x19e4('0x1e')],_0x4b17a5[_0x19e4('0x1f')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 499c605..ce6b453 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 _0x1776=['then','rpc','routing','error','message','result','catch','exports','../../config/logger','client','http','Request','request'];(function(_0x45fc52,_0x41b4dc){var _0x310d2f=function(_0x10e490){while(--_0x10e490){_0x45fc52['push'](_0x45fc52['shift']());}};_0x310d2f(++_0x41b4dc);}(_0x1776,0x15a));var _0x6177=function(_0xd12328,_0x31a737){_0xd12328=_0xd12328-0x0;var _0x5a3614=_0x1776[_0xd12328];return _0x5a3614;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x6177('0x0'))('routing');var client=jayson[_0x6177('0x1')][_0x6177('0x2')]({'port':0x2329});client[_0x6177('0x3')]=function(_0x8fe3a6,_0x1b4472){return new BPromise(function(_0x4862fb,_0x30afad){return client[_0x6177('0x4')](_0x8fe3a6,_0x1b4472)[_0x6177('0x5')](function(_0x4fa67c){logger['debug'](_0x6177('0x6'),_0x6177('0x7'),_0x8fe3a6,_0x1b4472,_0x4fa67c);if(_0x4fa67c[_0x6177('0x8')]){logger[_0x6177('0x8')](_0x6177('0x6'),_0x6177('0x7'),_0x8fe3a6,_0x4fa67c['error']['message'],_0x1b4472);return _0x30afad(_0x4fa67c['error'][_0x6177('0x9')]);}else{return _0x4862fb(_0x4fa67c[_0x6177('0xa')]);}})[_0x6177('0xb')](function(_0x33949f){logger[_0x6177('0x8')](_0x6177('0x6'),_0x6177('0x7'),_0x8fe3a6,_0x33949f,_0x1b4472);return _0x30afad(_0x33949f);});});};module[_0x6177('0xc')]=client; \ No newline at end of file +var _0x7aa3=['rpc','error','message','result','exports','bluebird','routing','http','request','then'];(function(_0x21eaef,_0x2eec5f){var _0x2bef17=function(_0x178517){while(--_0x178517){_0x21eaef['push'](_0x21eaef['shift']());}};_0x2bef17(++_0x2eec5f);}(_0x7aa3,0xc3));var _0x37aa=function(_0x5d37ee,_0x4decaf){_0x5d37ee=_0x5d37ee-0x0;var _0x198424=_0x7aa3[_0x5d37ee];return _0x198424;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x37aa('0x0'));var logger=require('../../config/logger')(_0x37aa('0x1'));var client=jayson['client'][_0x37aa('0x2')]({'port':0x2329});client['Request']=function(_0x3e32e3,_0x43ddcf){return new BPromise(function(_0x1b077e,_0x2e50a1){return client[_0x37aa('0x3')](_0x3e32e3,_0x43ddcf)[_0x37aa('0x4')](function(_0x440fc6){logger['debug'](_0x37aa('0x5'),_0x37aa('0x1'),_0x3e32e3,_0x43ddcf,_0x440fc6);if(_0x440fc6['error']){logger['error'](_0x37aa('0x5'),_0x37aa('0x1'),_0x3e32e3,_0x440fc6[_0x37aa('0x6')][_0x37aa('0x7')],_0x43ddcf);return _0x2e50a1(_0x440fc6[_0x37aa('0x6')][_0x37aa('0x7')]);}else{return _0x1b077e(_0x440fc6[_0x37aa('0x8')]);}})['catch'](function(_0x3a558e){logger[_0x37aa('0x6')](_0x37aa('0x5'),_0x37aa('0x1'),_0x3e32e3,_0x3a558e,_0x43ddcf);return _0x2e50a1(_0x3a558e);});});};module[_0x37aa('0x9')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 5037898..2e81e6d 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 _0x57e4=['refresh','mailAccounts','listen','getSettings','log','bluebird','./realtime','./lib/email','./rpc/setting','resolve','then','initMailAccounts'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x57e4,0x1e5));var _0x457e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x57e4[_0x14add3];return _0x4a174f;};'use strict';var BPromise=require(_0x457e('0x0'));var server=require('./server');var Realtime=require(_0x457e('0x1'));var EmailChannel=require(_0x457e('0x2'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0x457e('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x457e('0x4')]()[_0x457e('0x5')](mailAccount['getMailAccounts']())[_0x457e('0x5')](realtime[_0x457e('0x6')]())[_0x457e('0x5')](function(){email[_0x457e('0x7')](realtime[_0x457e('0x8')]);return realtime;});}function main(){return server[_0x457e('0x9')](realtime,email)[_0x457e('0x5')](function(){return initRealtime();})[_0x457e('0x5')](function(){return setting[_0x457e('0xa')]();})[_0x457e('0x5')](function(_0x54abeb){return setInterval(initRealtime,_0x54abeb['loginMailFrequency']*0x3e8);})['catch'](function(_0xdc95c4){console[_0x457e('0xb')](_0xdc95c4);});}main(); \ No newline at end of file +var _0x9267=['catch','log','bluebird','./server','./realtime','./rpc/mailAccount','./rpc/setting','resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','getSettings','loginMailFrequency'];(function(_0x338f73,_0x1945c8){var _0x163fdf=function(_0x4cd033){while(--_0x4cd033){_0x338f73['push'](_0x338f73['shift']());}};_0x163fdf(++_0x1945c8);}(_0x9267,0x11f));var _0x7926=function(_0x3e5229,_0x667a9e){_0x3e5229=_0x3e5229-0x0;var _0x54bdc4=_0x9267[_0x3e5229];return _0x54bdc4;};'use strict';var BPromise=require(_0x7926('0x0'));var server=require(_0x7926('0x1'));var Realtime=require(_0x7926('0x2'));var EmailChannel=require('./lib/email');var mailAccount=require(_0x7926('0x3'));var setting=require(_0x7926('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x7926('0x5')]()[_0x7926('0x6')](mailAccount[_0x7926('0x7')]())[_0x7926('0x6')](realtime[_0x7926('0x8')]())[_0x7926('0x6')](function(){email[_0x7926('0x9')](realtime[_0x7926('0xa')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0x7926('0x6')](function(){return initRealtime();})[_0x7926('0x6')](function(){return setting[_0x7926('0xb')]();})[_0x7926('0x6')](function(_0x276c8d){return setInterval(initRealtime,_0x276c8d[_0x7926('0xc')]*0x3e8);})[_0x7926('0xd')](function(_0x1b9611){console[_0x7926('0xe')](_0x1b9611);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 2f7ca60..b110795 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 _0xc88d=['total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','imapAccounts','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','disabled','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','status','sendMail','send','verifySmtp','Smtp','smtp','verify','verified','exports','lodash','moment','bluebird','md5','../../../config/environment','email','redis','localhost','socket.io-emitter','./imap','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','prototype','emit','name','active','Imap','messageStatus'];(function(_0x199b49,_0x30e997){var _0x4f8f47=function(_0x2bd076){while(--_0x2bd076){_0x199b49['push'](_0x199b49['shift']());}};_0x4f8f47(++_0x30e997);}(_0xc88d,0x13c));var _0xdc88=function(_0x549e01,_0x557c28){_0x549e01=_0x549e01-0x0;var _0x4523c5=_0xc88d[_0x549e01];return _0x4523c5;};'use strict';var _=require(_0xdc88('0x0'));var moment=require(_0xdc88('0x1'));var BPromise=require(_0xdc88('0x2'));var md5=require(_0xdc88('0x3'));var Redis=require('ioredis');var config=require(_0xdc88('0x4'));var logger=require('../../../config/logger')(_0xdc88('0x5'));config[_0xdc88('0x6')]=_['defaults'](config[_0xdc88('0x6')],{'host':_0xdc88('0x7'),'port':0x18eb});var io=require(_0xdc88('0x8'))(new Redis(config[_0xdc88('0x6')]));var EmailImap=require(_0xdc88('0x9'));var EmailSmtp=require('./smtp');var mailAccount=require(_0xdc88('0xa'));var md5Accounts={};function EmailChannel(_0x3b1ca3){logger[_0xdc88('0xb')](_0xdc88('0xc'));this[_0xdc88('0xd')]=_0x3b1ca3[_0xdc88('0xd')];this['imapAccounts']={};this['smtp']=new EmailSmtp();}EmailChannel[_0xdc88('0xe')][_0xdc88('0xf')]=function(_0x1b6173){var _0xddde17=this[_0xdc88('0xd')][_0x1b6173];var _0x56c5a0={'id':_0xddde17['id'],'name':_0xddde17[_0xdc88('0x10')],'key':_0xddde17['key'],'active':_0xddde17[_0xdc88('0x11')],'Imap':{'status':_0xddde17[_0xdc88('0x12')]['status'],'messageStatus':_0xddde17['Imap'][_0xdc88('0x13')],'total':_0xddde17['Imap'][_0xdc88('0x14')]}};if(_[_0xdc88('0x15')](md5Accounts[_0x1b6173])){md5Accounts[_0x1b6173]={};}var _0x48894b=md5(JSON[_0xdc88('0x16')](_0x56c5a0));if(md5Accounts[_0x1b6173][_0xdc88('0x3')]!==_0x48894b){md5Accounts[_0x1b6173][_0xdc88('0x3')]=_0x48894b;io[_0xdc88('0xf')](_0xdc88('0x17'),_0x56c5a0);}};EmailChannel['prototype'][_0xdc88('0x18')]=function(_0x91eb29){for(var _0x36b009 in _0x91eb29){if(_0x91eb29[_0xdc88('0x19')](_0x36b009)){if(_0x91eb29[_0x36b009]['Imap']&&_0x91eb29[_0x36b009][_0xdc88('0x11')]){var _0x3f61eb=_0x91eb29[_0x36b009][_0xdc88('0x12')];if(!this[_0xdc88('0x1a')][_0xdc88('0x19')](_0x3f61eb['id'])){this[_0xdc88('0x1a')][_0x3f61eb['id']]=new EmailImap(_0x3f61eb,_0x91eb29[_0x36b009][_0xdc88('0x5')]);this['imapAccounts'][_0x3f61eb['id']]['on'](_0xdc88('0x1b'),this[_0xdc88('0x1c')][_0xdc88('0x1d')](this,_0x36b009));this['imapAccounts'][_0x3f61eb['id']]['on'](_0xdc88('0x5'),this[_0xdc88('0x1e')][_0xdc88('0x1d')](this,_0x36b009));this['imapAccounts'][_0x3f61eb['id']]['on'](_0xdc88('0x1f'),this[_0xdc88('0x20')]['bind'](this,_0x36b009));this[_0xdc88('0x1a')][_0x3f61eb['id']]['on'](_0xdc88('0x21'),this[_0xdc88('0x22')][_0xdc88('0x1d')](this,_0x36b009));}}else{if(_[_0xdc88('0x15')](this[_0xdc88('0xd')][_0x36b009][_0xdc88('0x12')])){this[_0xdc88('0xd')][_0x36b009][_0xdc88('0x12')]={};}this[_0xdc88('0xd')][_0x36b009][_0xdc88('0x12')]['status']=_0xdc88('0x23');this[_0xdc88('0xd')][_0x36b009][_0xdc88('0x12')][_0xdc88('0x13')]='';this['emit'](_0x36b009);}}}};EmailChannel[_0xdc88('0xe')]['handleImapBox']=function(_0x468325,_0x25f6eb){if(this[_0xdc88('0xd')][_0x468325]){this[_0xdc88('0xd')][_0x468325][_0xdc88('0x12')]['status']='connected';this[_0xdc88('0xd')][_0x468325]['Imap'][_0xdc88('0x13')]=_0x25f6eb[_0xdc88('0x10')];if(_0x25f6eb[_0xdc88('0x24')]){this[_0xdc88('0xd')][_0x468325][_0xdc88('0x12')]['total']=_0x25f6eb[_0xdc88('0x24')][_0xdc88('0x14')];}return this[_0xdc88('0xf')](_0x468325);}};EmailChannel[_0xdc88('0xe')][_0xdc88('0x1e')]=function(_0x5de1fd,_0x55d2a6){logger['info'](_0xdc88('0x25'),_0x55d2a6[_0xdc88('0x26')],_0x55d2a6[_0xdc88('0x27')],_0x55d2a6[_0xdc88('0x28')],_0x5de1fd);if(this[_0xdc88('0xd')][_0x5de1fd]){return mailAccount[_0xdc88('0x29')](_0x5de1fd,_0x55d2a6)[_0xdc88('0x2a')](function(_0x40331f){if(_0x40331f){logger['info'](_0xdc88('0x2b'));}})[_0xdc88('0x2c')](function(_0x280a17){logger[_0xdc88('0x21')](_0xdc88('0x2d'),JSON[_0xdc88('0x16')](_0x280a17));});}};EmailChannel['prototype']['handleImapEnd']=function(_0x29e27c){if(this['mailAccounts'][_0x29e27c]&&this[_0xdc88('0xd')][_0x29e27c][_0xdc88('0x12')]){if(this['imapAccounts'][this[_0xdc88('0xd')][_0x29e27c][_0xdc88('0x12')]['id']]){delete this['imapAccounts'][this[_0xdc88('0xd')][_0x29e27c][_0xdc88('0x12')]['id']];}this[_0xdc88('0xd')][_0x29e27c][_0xdc88('0x12')][_0xdc88('0x2e')]=moment();this[_0xdc88('0xf')](_0x29e27c);}};EmailChannel[_0xdc88('0xe')]['handleImapError']=function(_0x319263,_0x124448){if(this[_0xdc88('0xd')][_0x319263]){this[_0xdc88('0xd')][_0x319263][_0xdc88('0x12')][_0xdc88('0x2f')]=_0xdc88('0x21');this['mailAccounts'][_0x319263]['Imap']['messageStatus']=_0x124448;return this[_0xdc88('0xf')](_0x319263);}};EmailChannel['prototype'][_0xdc88('0x30')]=function(_0x556c16,_0x32aeae){return this['smtp'][_0xdc88('0x31')](_0x556c16,_0x32aeae);};EmailChannel[_0xdc88('0xe')][_0xdc88('0x32')]=function(_0x46d5ac){var _0x44ad7d=this;if(this[_0xdc88('0xd')][_0x46d5ac['id']]){if(_[_0xdc88('0x15')](this[_0xdc88('0xd')][_0x46d5ac['id']][_0xdc88('0x33')])){this[_0xdc88('0xd')][_0x46d5ac['id']]['Smtp']={};}this[_0xdc88('0xd')][_0x46d5ac['id']][_0xdc88('0x33')][_0xdc88('0x2e')]=moment();return new BPromise(function(_0x7962e5,_0x2c3614){return _0x44ad7d[_0xdc88('0x34')][_0xdc88('0x35')](_0x46d5ac)['then'](function(_0x2ee8b9){_0x44ad7d['mailAccounts'][_0x46d5ac['id']][_0xdc88('0x33')][_0xdc88('0x2f')]=_0xdc88('0x36');_0x44ad7d[_0xdc88('0xd')][_0x46d5ac['id']][_0xdc88('0x33')][_0xdc88('0x13')]='';_0x44ad7d[_0xdc88('0xf')](_0x46d5ac['id']);_0x7962e5(_0x2ee8b9);})[_0xdc88('0x2c')](function(_0x428261){_0x44ad7d[_0xdc88('0xd')][_0x46d5ac['id']][_0xdc88('0x33')][_0xdc88('0x2f')]=_0xdc88('0x21');_0x44ad7d[_0xdc88('0xd')][_0x46d5ac['id']][_0xdc88('0x33')]['messageStatus']=_0x428261;_0x44ad7d[_0xdc88('0xf')](_0x46d5ac['id']);_0x2c3614(_0x428261);});});}return this[_0xdc88('0x34')][_0xdc88('0x35')](_0x46d5ac);};module[_0xdc88('0x37')]=EmailChannel; \ No newline at end of file +var _0xd962=['hasOwnProperty','box','handleImapBox','bind','end','handleImapEnd','error','handleImapError','isNil','disabled','connected','messages','handleImapEmail','firstName','from','notify','then','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','smtp','Smtp','verify','verified','catch','exports','lodash','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','prototype','name','active','Imap','status','messageStatus','total','stringify','emit','mailAccount:update','refresh'];(function(_0x3d86f2,_0x4af539){var _0x1e1f76=function(_0x46fb5e){while(--_0x46fb5e){_0x3d86f2['push'](_0x3d86f2['shift']());}};_0x1e1f76(++_0x4af539);}(_0xd962,0x12e));var _0x2d96=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0xd962[_0xc0a3d3];return _0x3386e8;};'use strict';var _=require(_0x2d96('0x0'));var moment=require('moment');var BPromise=require(_0x2d96('0x1'));var md5=require(_0x2d96('0x2'));var Redis=require(_0x2d96('0x3'));var config=require(_0x2d96('0x4'));var logger=require(_0x2d96('0x5'))(_0x2d96('0x6'));config[_0x2d96('0x7')]=_['defaults'](config['redis'],{'host':_0x2d96('0x8'),'port':0x18eb});var io=require(_0x2d96('0x9'))(new Redis(config[_0x2d96('0x7')]));var EmailImap=require(_0x2d96('0xa'));var EmailSmtp=require(_0x2d96('0xb'));var mailAccount=require(_0x2d96('0xc'));var md5Accounts={};function EmailChannel(_0x522335){logger[_0x2d96('0xd')](_0x2d96('0xe'));this[_0x2d96('0xf')]=_0x522335[_0x2d96('0xf')];this[_0x2d96('0x10')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0x2d96('0x11')]['emit']=function(_0x16122c){var _0x308199=this[_0x2d96('0xf')][_0x16122c];var _0x4b50ce={'id':_0x308199['id'],'name':_0x308199[_0x2d96('0x12')],'key':_0x308199['key'],'active':_0x308199[_0x2d96('0x13')],'Imap':{'status':_0x308199[_0x2d96('0x14')][_0x2d96('0x15')],'messageStatus':_0x308199[_0x2d96('0x14')][_0x2d96('0x16')],'total':_0x308199[_0x2d96('0x14')][_0x2d96('0x17')]}};if(_['isNil'](md5Accounts[_0x16122c])){md5Accounts[_0x16122c]={};}var _0x5ca2bb=md5(JSON[_0x2d96('0x18')](_0x4b50ce));if(md5Accounts[_0x16122c][_0x2d96('0x2')]!==_0x5ca2bb){md5Accounts[_0x16122c][_0x2d96('0x2')]=_0x5ca2bb;io[_0x2d96('0x19')](_0x2d96('0x1a'),_0x4b50ce);}};EmailChannel[_0x2d96('0x11')][_0x2d96('0x1b')]=function(_0x59d877){for(var _0x17fe79 in _0x59d877){if(_0x59d877[_0x2d96('0x1c')](_0x17fe79)){if(_0x59d877[_0x17fe79][_0x2d96('0x14')]&&_0x59d877[_0x17fe79][_0x2d96('0x13')]){var _0x469f21=_0x59d877[_0x17fe79]['Imap'];if(!this['imapAccounts'][_0x2d96('0x1c')](_0x469f21['id'])){this[_0x2d96('0x10')][_0x469f21['id']]=new EmailImap(_0x469f21,_0x59d877[_0x17fe79][_0x2d96('0x6')]);this[_0x2d96('0x10')][_0x469f21['id']]['on'](_0x2d96('0x1d'),this[_0x2d96('0x1e')]['bind'](this,_0x17fe79));this[_0x2d96('0x10')][_0x469f21['id']]['on'](_0x2d96('0x6'),this['handleImapEmail'][_0x2d96('0x1f')](this,_0x17fe79));this[_0x2d96('0x10')][_0x469f21['id']]['on'](_0x2d96('0x20'),this[_0x2d96('0x21')][_0x2d96('0x1f')](this,_0x17fe79));this[_0x2d96('0x10')][_0x469f21['id']]['on'](_0x2d96('0x22'),this[_0x2d96('0x23')][_0x2d96('0x1f')](this,_0x17fe79));}}else{if(_[_0x2d96('0x24')](this[_0x2d96('0xf')][_0x17fe79][_0x2d96('0x14')])){this[_0x2d96('0xf')][_0x17fe79][_0x2d96('0x14')]={};}this[_0x2d96('0xf')][_0x17fe79][_0x2d96('0x14')][_0x2d96('0x15')]=_0x2d96('0x25');this['mailAccounts'][_0x17fe79]['Imap']['messageStatus']='';this[_0x2d96('0x19')](_0x17fe79);}}}};EmailChannel[_0x2d96('0x11')][_0x2d96('0x1e')]=function(_0x2b2dfc,_0x5c169f){if(this[_0x2d96('0xf')][_0x2b2dfc]){this[_0x2d96('0xf')][_0x2b2dfc][_0x2d96('0x14')][_0x2d96('0x15')]=_0x2d96('0x26');this[_0x2d96('0xf')][_0x2b2dfc][_0x2d96('0x14')][_0x2d96('0x16')]=_0x5c169f[_0x2d96('0x12')];if(_0x5c169f['messages']){this['mailAccounts'][_0x2b2dfc]['Imap']['total']=_0x5c169f[_0x2d96('0x27')][_0x2d96('0x17')];}return this[_0x2d96('0x19')](_0x2b2dfc);}};EmailChannel[_0x2d96('0x11')][_0x2d96('0x28')]=function(_0x35c950,_0x3b8fdb){logger['info']('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x3b8fdb[_0x2d96('0x29')],_0x3b8fdb['lastName'],_0x3b8fdb[_0x2d96('0x2a')],_0x35c950);if(this[_0x2d96('0xf')][_0x35c950]){return mailAccount[_0x2d96('0x2b')](_0x35c950,_0x3b8fdb)[_0x2d96('0x2c')](function(_0x5ef479){if(_0x5ef479){logger[_0x2d96('0xd')](_0x2d96('0x2d'));}})['catch'](function(_0x41521c){logger[_0x2d96('0x22')](_0x2d96('0x2e'),JSON[_0x2d96('0x18')](_0x41521c));});}};EmailChannel[_0x2d96('0x11')][_0x2d96('0x21')]=function(_0x6a5ca3){if(this['mailAccounts'][_0x6a5ca3]&&this[_0x2d96('0xf')][_0x6a5ca3]['Imap']){if(this['imapAccounts'][this[_0x2d96('0xf')][_0x6a5ca3]['Imap']['id']]){delete this[_0x2d96('0x10')][this['mailAccounts'][_0x6a5ca3][_0x2d96('0x14')]['id']];}this[_0x2d96('0xf')][_0x6a5ca3]['Imap'][_0x2d96('0x2f')]=moment();this[_0x2d96('0x19')](_0x6a5ca3);}};EmailChannel['prototype'][_0x2d96('0x23')]=function(_0x5118d5,_0x561fdc){if(this[_0x2d96('0xf')][_0x5118d5]){this[_0x2d96('0xf')][_0x5118d5][_0x2d96('0x14')][_0x2d96('0x15')]=_0x2d96('0x22');this[_0x2d96('0xf')][_0x5118d5][_0x2d96('0x14')][_0x2d96('0x16')]=_0x561fdc;return this['emit'](_0x5118d5);}};EmailChannel[_0x2d96('0x11')][_0x2d96('0x30')]=function(_0xa5d096,_0xea5cc9){return this[_0x2d96('0x31')]['send'](_0xa5d096,_0xea5cc9);};EmailChannel[_0x2d96('0x11')]['verifySmtp']=function(_0x52572c){var _0x553dbb=this;if(this[_0x2d96('0xf')][_0x52572c['id']]){if(_['isNil'](this[_0x2d96('0xf')][_0x52572c['id']][_0x2d96('0x32')])){this['mailAccounts'][_0x52572c['id']][_0x2d96('0x32')]={};}this[_0x2d96('0xf')][_0x52572c['id']][_0x2d96('0x32')][_0x2d96('0x2f')]=moment();return new BPromise(function(_0x3ab794,_0x341320){return _0x553dbb['smtp'][_0x2d96('0x33')](_0x52572c)[_0x2d96('0x2c')](function(_0x4862f0){_0x553dbb[_0x2d96('0xf')][_0x52572c['id']][_0x2d96('0x32')]['status']=_0x2d96('0x34');_0x553dbb[_0x2d96('0xf')][_0x52572c['id']]['Smtp'][_0x2d96('0x16')]='';_0x553dbb['emit'](_0x52572c['id']);_0x3ab794(_0x4862f0);})[_0x2d96('0x35')](function(_0x416426){_0x553dbb[_0x2d96('0xf')][_0x52572c['id']]['Smtp'][_0x2d96('0x15')]='error';_0x553dbb[_0x2d96('0xf')][_0x52572c['id']][_0x2d96('0x32')]['messageStatus']=_0x416426;_0x553dbb[_0x2d96('0x19')](_0x52572c['id']);_0x341320(_0x416426);});});}return this[_0x2d96('0x31')]['verify'](_0x52572c);};module[_0x2d96('0x36')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 133e902..800d210 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 _0xd20e=['closeBox','body','attributes','handleMessageEnd','handleMessageBody','handleSimpleParser','handleMessageAttributes','parser','textCode','exports','path','util','imap','lodash','mailparser','simpleParser','Iconv','events','./utils','../../../config/logger','email','account','getAccount','once','ready','handleReady','bind','handleEnd','error','handleError','inherits','prototype','connTimeout','authTimeout','isNil','service','user','host','port','tls','autotls','required','getHost','openBox','mailbox','emit','box','readUnseen','handleCloseBox','end','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd'];(function(_0x52bcb3,_0x4dac20){var _0x3020b7=function(_0x22a452){while(--_0x22a452){_0x52bcb3['push'](_0x52bcb3['shift']());}};_0x3020b7(++_0x4dac20);}(_0xd20e,0xbb));var _0xed20=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xd20e[_0x82129b];return _0x2ae5dc;};'use strict';var fs=require('fs');var path=require(_0xed20('0x0'));var util=require(_0xed20('0x1'));var Imap=require(_0xed20('0x2'));var _=require(_0xed20('0x3'));var rs=require('randomstring');var simpleParser=require(_0xed20('0x4'))[_0xed20('0x5')];var Iconv=require('iconv')[_0xed20('0x6')];var EventEmitter=require(_0xed20('0x7'))['EventEmitter'];var utils=require(_0xed20('0x8'));var logger=require(_0xed20('0x9'))(_0xed20('0xa'));function EmailImap(_0x4a2795,_0x14caf3){this['mailbox']='INBOX';this[_0xed20('0xb')]=this[_0xed20('0xc')](_0x4a2795,_0x14caf3);this[_0xed20('0x2')]=new Imap(this['account']);this[_0xed20('0x2')][_0xed20('0xd')](_0xed20('0xe'),this[_0xed20('0xf')][_0xed20('0x10')](this));this['imap'][_0xed20('0xd')]('end',this[_0xed20('0x11')][_0xed20('0x10')](this));this[_0xed20('0x2')]['on'](_0xed20('0x12'),this[_0xed20('0x13')][_0xed20('0x10')](this));this[_0xed20('0x2')]['connect']();}util[_0xed20('0x14')](EmailImap,EventEmitter);EmailImap[_0xed20('0x15')][_0xed20('0xc')]=function(_0x112767,_0x483275){var _0x5124cc={'connTimeout':_0x112767['connTimeout']?_0x112767[_0xed20('0x16')]*0x3e8:0x2710,'authTimeout':_0x112767[_0xed20('0x17')]?_0x112767[_0xed20('0x17')]*0x3e8:0x1388};if(_[_0xed20('0x18')](_0x112767[_0xed20('0x19')])){if(_0x112767['authentication']){_0x5124cc[_0xed20('0x1a')]=_0x112767[_0xed20('0x1a')];_0x5124cc['password']=_0x112767['password'];}_0x5124cc[_0xed20('0x1b')]=_0x112767[_0xed20('0x1b')];_0x5124cc['port']=_0x112767[_0xed20('0x1c')]||0x3e1;if(_0x112767[_0xed20('0x1d')]){_0x5124cc[_0xed20('0x1d')]=!![];}else{_0x5124cc[_0xed20('0x1d')]=![];_0x5124cc[_0xed20('0x1e')]=_0xed20('0x1f');}}else{_0x5124cc[_0xed20('0x1a')]=_0x112767['user'];_0x5124cc['password']=_0x112767['password'];_0x5124cc['host']=utils[_0xed20('0x20')](_0x112767['service']);_0x5124cc[_0xed20('0x1c')]=0x3e1;_0x5124cc[_0xed20('0x1d')]=!![];}_0x5124cc[_0xed20('0xa')]=_0x483275||_0x112767['user']||'anonymous@xcally.com';return _0x5124cc;};EmailImap['prototype'][_0xed20('0xf')]=function(){this[_0xed20('0x2')][_0xed20('0x21')](this[_0xed20('0x22')],![],this['handleOpenBox']['bind'](this));};EmailImap[_0xed20('0x15')]['handleOpenBox']=function(_0x490a0c,_0x147383){if(_0x490a0c){this[_0xed20('0x13')](_0x490a0c,!![]);}else{this[_0xed20('0x23')](_0xed20('0x24'),_0x147383);this[_0xed20('0x25')]();}};EmailImap[_0xed20('0x15')][_0xed20('0x26')]=function(_0x5582ef){if(_0x5582ef){this['handleError'](_0x5582ef,!![]);}else{this[_0xed20('0x2')][_0xed20('0x27')]();}};EmailImap[_0xed20('0x15')]['readUnseen']=function(){this['imap'][_0xed20('0x28')]([_0xed20('0x29')],this[_0xed20('0x2a')][_0xed20('0x10')](this));};EmailImap['prototype'][_0xed20('0x2a')]=function(_0x19357d,_0x4239ab){if(_0x19357d){this[_0xed20('0x13')](_0x19357d,!![]);}else{if(_0x4239ab[_0xed20('0x2b')]){try{var _0x4d1500=this[_0xed20('0x2')][_0xed20('0x2c')](_0x4239ab,{'bodies':'','markSeen':!![]});_0x4d1500['on'](_0xed20('0x2d'),this[_0xed20('0x2e')]['bind'](this));_0x4d1500[_0xed20('0xd')](_0xed20('0x12'),this[_0xed20('0x2f')][_0xed20('0x10')](this));_0x4d1500[_0xed20('0xd')]('end',this[_0xed20('0x30')][_0xed20('0x10')](this));}catch(_0x38c172){logger[_0xed20('0x12')](_0x38c172);}}else{this[_0xed20('0x2')][_0xed20('0x31')](!![],this[_0xed20('0x26')][_0xed20('0x10')](this));}}};EmailImap[_0xed20('0x15')]['handleFetchMessage']=function(_0xbe3e7c,_0x29cb24){_0xbe3e7c['on'](_0xed20('0x32'),this['handleMessageBody'][_0xed20('0x10')](this));_0xbe3e7c[_0xed20('0xd')](_0xed20('0x33'),this['handleMessageAttributes']['bind'](this));_0xbe3e7c['once'](_0xed20('0x27'),this[_0xed20('0x34')][_0xed20('0x10')](this));};EmailImap[_0xed20('0x15')][_0xed20('0x35')]=function(_0x2b32e8,_0x1e249a){simpleParser(_0x2b32e8,{'Iconv':Iconv},this[_0xed20('0x36')]['bind'](this));};EmailImap[_0xed20('0x15')][_0xed20('0x37')]=function(_0x1b12f5){};EmailImap[_0xed20('0x15')][_0xed20('0x34')]=function(){};EmailImap['prototype'][_0xed20('0x36')]=function(_0x345a90,_0x564767){if(_0x345a90){logger[_0xed20('0x12')](_0x345a90);}else{var _0x52988f=this;utils[_0xed20('0x38')](this[_0xed20('0xb')],_0x564767,function(_0x14cba3){_0x52988f[_0xed20('0x23')](_0xed20('0xa'),_0x14cba3);});}};EmailImap[_0xed20('0x15')][_0xed20('0x30')]=function(){this[_0xed20('0x2')][_0xed20('0x31')](!![],this[_0xed20('0x26')]['bind'](this));};EmailImap[_0xed20('0x15')][_0xed20('0x2f')]=function(_0x32c842){this[_0xed20('0x13')](_0x32c842);this[_0xed20('0x2')][_0xed20('0x31')](!![],this[_0xed20('0x26')][_0xed20('0x10')](this));};EmailImap['prototype']['handleEnd']=function(){this['emit'](_0xed20('0x27'));};EmailImap[_0xed20('0x15')][_0xed20('0x13')]=function(_0x4c226d,_0x2b3edd){logger[_0xed20('0x12')]('handleError',this[_0xed20('0xb')][_0xed20('0xa')],JSON['stringify'](_0x4c226d));var _0x1df49c='';if(_0x4c226d){if(_0x4c226d[_0xed20('0x39')]){_0x1df49c=_0x4c226d[_0xed20('0x39')];}else{for(var _0x56993e in _0x4c226d){if(_0x4c226d['hasOwnProperty'](_0x56993e)){_0x1df49c+=_['upperFirst'](_0x56993e)+':\x20'+_0x4c226d[_0x56993e]+'\x0a';}}}}if(_0x2b3edd){this[_0xed20('0x2')]['end']();}else{this[_0xed20('0x23')](_0xed20('0x12'),_0x1df49c);this[_0xed20('0x23')](_0xed20('0x27'));}};module[_0xed20('0x3a')]=EmailImap; \ No newline at end of file +var _0x9c28=['service','user','password','host','port','tls','autotls','anonymous@xcally.com','prototype','mailbox','handleOpenBox','handleError','box','readUnseen','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','handleCloseBox','attributes','handleMessageAttributes','handleSimpleParser','handleMessageEnd','parser','emit','handleEnd','stringify','textCode','upperFirst','path','util','imap','randomstring','mailparser','simpleParser','iconv','Iconv','EventEmitter','./utils','../../../config/logger','email','account','getAccount','ready','handleReady','bind','once','end','error','connect','inherits','connTimeout','authTimeout'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x9c28,0x1f2));var _0x89c2=function(_0xbbd5cc,_0x5c72d5){_0xbbd5cc=_0xbbd5cc-0x0;var _0x1d7c29=_0x9c28[_0xbbd5cc];return _0x1d7c29;};'use strict';var fs=require('fs');var path=require(_0x89c2('0x0'));var util=require(_0x89c2('0x1'));var Imap=require(_0x89c2('0x2'));var _=require('lodash');var rs=require(_0x89c2('0x3'));var simpleParser=require(_0x89c2('0x4'))[_0x89c2('0x5')];var Iconv=require(_0x89c2('0x6'))[_0x89c2('0x7')];var EventEmitter=require('events')[_0x89c2('0x8')];var utils=require(_0x89c2('0x9'));var logger=require(_0x89c2('0xa'))(_0x89c2('0xb'));function EmailImap(_0x4b159f,_0x196256){this['mailbox']='INBOX';this[_0x89c2('0xc')]=this[_0x89c2('0xd')](_0x4b159f,_0x196256);this[_0x89c2('0x2')]=new Imap(this[_0x89c2('0xc')]);this['imap']['once'](_0x89c2('0xe'),this[_0x89c2('0xf')][_0x89c2('0x10')](this));this[_0x89c2('0x2')][_0x89c2('0x11')](_0x89c2('0x12'),this['handleEnd'][_0x89c2('0x10')](this));this['imap']['on'](_0x89c2('0x13'),this['handleError'][_0x89c2('0x10')](this));this[_0x89c2('0x2')][_0x89c2('0x14')]();}util[_0x89c2('0x15')](EmailImap,EventEmitter);EmailImap['prototype'][_0x89c2('0xd')]=function(_0x4e775e,_0x201964){var _0x1b830b={'connTimeout':_0x4e775e[_0x89c2('0x16')]?_0x4e775e[_0x89c2('0x16')]*0x3e8:0x2710,'authTimeout':_0x4e775e[_0x89c2('0x17')]?_0x4e775e[_0x89c2('0x17')]*0x3e8:0x1388};if(_['isNil'](_0x4e775e[_0x89c2('0x18')])){if(_0x4e775e['authentication']){_0x1b830b[_0x89c2('0x19')]=_0x4e775e['user'];_0x1b830b[_0x89c2('0x1a')]=_0x4e775e[_0x89c2('0x1a')];}_0x1b830b[_0x89c2('0x1b')]=_0x4e775e[_0x89c2('0x1b')];_0x1b830b[_0x89c2('0x1c')]=_0x4e775e[_0x89c2('0x1c')]||0x3e1;if(_0x4e775e[_0x89c2('0x1d')]){_0x1b830b[_0x89c2('0x1d')]=!![];}else{_0x1b830b[_0x89c2('0x1d')]=![];_0x1b830b[_0x89c2('0x1e')]='required';}}else{_0x1b830b[_0x89c2('0x19')]=_0x4e775e[_0x89c2('0x19')];_0x1b830b['password']=_0x4e775e[_0x89c2('0x1a')];_0x1b830b[_0x89c2('0x1b')]=utils['getHost'](_0x4e775e['service']);_0x1b830b['port']=0x3e1;_0x1b830b[_0x89c2('0x1d')]=!![];}_0x1b830b[_0x89c2('0xb')]=_0x201964||_0x4e775e[_0x89c2('0x19')]||_0x89c2('0x1f');return _0x1b830b;};EmailImap[_0x89c2('0x20')]['handleReady']=function(){this['imap']['openBox'](this[_0x89c2('0x21')],![],this[_0x89c2('0x22')]['bind'](this));};EmailImap[_0x89c2('0x20')][_0x89c2('0x22')]=function(_0x4369e6,_0x3aed07){if(_0x4369e6){this[_0x89c2('0x23')](_0x4369e6,!![]);}else{this['emit'](_0x89c2('0x24'),_0x3aed07);this[_0x89c2('0x25')]();}};EmailImap[_0x89c2('0x20')]['handleCloseBox']=function(_0x80086a){if(_0x80086a){this[_0x89c2('0x23')](_0x80086a,!![]);}else{this[_0x89c2('0x2')][_0x89c2('0x12')]();}};EmailImap[_0x89c2('0x20')][_0x89c2('0x25')]=function(){this[_0x89c2('0x2')]['search']([_0x89c2('0x26')],this[_0x89c2('0x27')][_0x89c2('0x10')](this));};EmailImap['prototype'][_0x89c2('0x27')]=function(_0x326a52,_0x35c008){if(_0x326a52){this[_0x89c2('0x23')](_0x326a52,!![]);}else{if(_0x35c008[_0x89c2('0x28')]){try{var _0x53f2c5=this['imap'][_0x89c2('0x29')](_0x35c008,{'bodies':'','markSeen':!![]});_0x53f2c5['on'](_0x89c2('0x2a'),this[_0x89c2('0x2b')][_0x89c2('0x10')](this));_0x53f2c5[_0x89c2('0x11')]('error',this[_0x89c2('0x2c')]['bind'](this));_0x53f2c5[_0x89c2('0x11')](_0x89c2('0x12'),this[_0x89c2('0x2d')][_0x89c2('0x10')](this));}catch(_0x39d668){logger[_0x89c2('0x13')](_0x39d668);}}else{this[_0x89c2('0x2')][_0x89c2('0x2e')](!![],this[_0x89c2('0x2f')][_0x89c2('0x10')](this));}}};EmailImap[_0x89c2('0x20')][_0x89c2('0x2b')]=function(_0x5f0bcb,_0x2223ad){_0x5f0bcb['on']('body',this['handleMessageBody']['bind'](this));_0x5f0bcb[_0x89c2('0x11')](_0x89c2('0x30'),this[_0x89c2('0x31')][_0x89c2('0x10')](this));_0x5f0bcb['once'](_0x89c2('0x12'),this['handleMessageEnd'][_0x89c2('0x10')](this));};EmailImap[_0x89c2('0x20')]['handleMessageBody']=function(_0x2a91dc,_0x46e419){simpleParser(_0x2a91dc,{'Iconv':Iconv},this[_0x89c2('0x32')][_0x89c2('0x10')](this));};EmailImap[_0x89c2('0x20')]['handleMessageAttributes']=function(_0x574323){};EmailImap[_0x89c2('0x20')][_0x89c2('0x33')]=function(){};EmailImap[_0x89c2('0x20')][_0x89c2('0x32')]=function(_0x3a915a,_0x2cedfd){if(_0x3a915a){logger[_0x89c2('0x13')](_0x3a915a);}else{var _0x3ae512=this;utils[_0x89c2('0x34')](this[_0x89c2('0xc')],_0x2cedfd,function(_0x23c619){_0x3ae512[_0x89c2('0x35')]('email',_0x23c619);});}};EmailImap[_0x89c2('0x20')]['handleFetchEnd']=function(){this[_0x89c2('0x2')][_0x89c2('0x2e')](!![],this[_0x89c2('0x2f')][_0x89c2('0x10')](this));};EmailImap[_0x89c2('0x20')][_0x89c2('0x2c')]=function(_0x1d0675){this[_0x89c2('0x23')](_0x1d0675);this[_0x89c2('0x2')][_0x89c2('0x2e')](!![],this[_0x89c2('0x2f')]['bind'](this));};EmailImap[_0x89c2('0x20')][_0x89c2('0x36')]=function(){this[_0x89c2('0x35')](_0x89c2('0x12'));};EmailImap['prototype'][_0x89c2('0x23')]=function(_0x103bf4,_0x3adc66){logger[_0x89c2('0x13')]('handleError',this[_0x89c2('0xc')][_0x89c2('0xb')],JSON[_0x89c2('0x37')](_0x103bf4));var _0x4715ef='';if(_0x103bf4){if(_0x103bf4[_0x89c2('0x38')]){_0x4715ef=_0x103bf4['textCode'];}else{for(var _0x4b7e3 in _0x103bf4){if(_0x103bf4['hasOwnProperty'](_0x4b7e3)){_0x4715ef+=_[_0x89c2('0x39')](_0x4b7e3)+':\x20'+_0x103bf4[_0x4b7e3]+'\x0a';}}}}if(_0x3adc66){this[_0x89c2('0x2')][_0x89c2('0x12')]();}else{this['emit'](_0x89c2('0x13'),_0x4715ef);this[_0x89c2('0x35')](_0x89c2('0x12'));}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 31cfbdc..909df8a 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 _0xda00=['compile','toString','verify','Not\x20verifired','exports','nodemailer','bluebird','nodemailer-plugin-inline-base64','prototype','send','createTransport','use'];(function(_0x4c445a,_0x4ee80f){var _0x2f611c=function(_0x4f3699){while(--_0x4f3699){_0x4c445a['push'](_0x4c445a['shift']());}};_0x2f611c(++_0x4ee80f);}(_0xda00,0x65));var _0x0da0=function(_0xb77fdd,_0x553822){_0xb77fdd=_0xb77fdd-0x0;var _0x5734ca=_0xda00[_0xb77fdd];return _0x5734ca;};'use strict';var nodemailer=require(_0x0da0('0x0'));var BPromise=require(_0x0da0('0x1'));var inlineBase64=require(_0x0da0('0x2'));function EmailSmtp(){}EmailSmtp[_0x0da0('0x3')][_0x0da0('0x4')]=function(_0x2985ea,_0x32565f){return new BPromise(function(_0x54ebd0,_0x13b705){var _0x2a2088=nodemailer[_0x0da0('0x5')](_0x2985ea);_0x2a2088[_0x0da0('0x6')](_0x0da0('0x7'),inlineBase64());_0x2a2088['sendMail'](_0x32565f,function(_0x17c6f1,_0x4c4de8){if(_0x17c6f1){_0x13b705(_0x17c6f1[_0x0da0('0x8')]());}else{_0x54ebd0(_0x4c4de8);}});});};EmailSmtp[_0x0da0('0x3')][_0x0da0('0x9')]=function(_0x329607){return new BPromise(function(_0x4351ba,_0x2ce7ae){var _0x11d692=nodemailer['createTransport'](_0x329607);_0x11d692[_0x0da0('0x9')](function(_0x237b82,_0x1d5073){if(_0x237b82){_0x2ce7ae(_0x237b82['toString']());}else{if(_0x1d5073){_0x4351ba(_0x1d5073);}else{_0x2ce7ae(_0x0da0('0xa'));}}});});};module[_0x0da0('0xb')]=EmailSmtp; \ No newline at end of file +var _0xd0da=['prototype','send','use','compile','sendMail','toString','verify','Not\x20verifired','exports','nodemailer','bluebird'];(function(_0x33f4b2,_0x578118){var _0x5bfbdb=function(_0x441f1a){while(--_0x441f1a){_0x33f4b2['push'](_0x33f4b2['shift']());}};_0x5bfbdb(++_0x578118);}(_0xd0da,0xda));var _0xad0d=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0xd0da[_0xd09668];return _0x68726;};'use strict';var nodemailer=require(_0xad0d('0x0'));var BPromise=require(_0xad0d('0x1'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0xad0d('0x2')][_0xad0d('0x3')]=function(_0x1efaf6,_0x3d1422){return new BPromise(function(_0x3244e4,_0x34187d){var _0x10de92=nodemailer['createTransport'](_0x1efaf6);_0x10de92[_0xad0d('0x4')](_0xad0d('0x5'),inlineBase64());_0x10de92[_0xad0d('0x6')](_0x3d1422,function(_0x336bb2,_0x1e1ab3){if(_0x336bb2){_0x34187d(_0x336bb2[_0xad0d('0x7')]());}else{_0x3244e4(_0x1e1ab3);}});});};EmailSmtp[_0xad0d('0x2')][_0xad0d('0x8')]=function(_0x4acc36){return new BPromise(function(_0x3f062e,_0x411860){var _0x528421=nodemailer['createTransport'](_0x4acc36);_0x528421[_0xad0d('0x8')](function(_0x51b840,_0x25e239){if(_0x51b840){_0x411860(_0x51b840[_0xad0d('0x7')]());}else{if(_0x25e239){_0x3f062e(_0x25e239);}else{_0x411860(_0xad0d('0x9'));}}});});};module[_0xad0d('0xa')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 8420962..f3cd400 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 _0x57ca=['_SRC','_IMG','\x20[Attachment:\x20','\x20]','body','Empty\x20message

','Attachments','Data','getHost','gmail','imap.gmail.com','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','moment','randomstring','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','substring','split','length','slice','join','isEmpty','html','test','replace','includes','0x1?_0x2ed4c6[_0xa57c('0x11')](0x0,-0x1)[_0xa57c('0x12')]('\x20'):_0x13dad8[_0xa57c('0xd')];}return'Anonymous';}function getLastName(_0x2644a1){var _0x546cde=_[_0xa57c('0x7')](_0x2644a1[_0xa57c('0x8')]);if(_0x546cde&&_0x546cde[_0xa57c('0xd')]){var _0x3821d2=_0x546cde[_0xa57c('0xd')][_0xa57c('0xf')](/\s+/);return _0x3821d2[_0xa57c('0x10')]>0x1?_0x3821d2['pop']():'';}return'';}function getMails(_0x26607a,_0xdf7ff6){var _0x261725='';for(var _0x5a6024=0x0;_0x5a6024<_0xdf7ff6[_0xa57c('0x8')]['length'];_0x5a6024+=0x1){if(_0xdf7ff6[_0xa57c('0x8')][_0x5a6024][_0xa57c('0x9')]!==_0x26607a){if(!_[_0xa57c('0x13')](_0x261725)){_0x261725+=',';}_0x261725+=_0xdf7ff6[_0xa57c('0x8')][_0x5a6024][_0xa57c('0xd')]||_0xdf7ff6[_0xa57c('0x8')][_0x5a6024][_0xa57c('0x9')]||'';_0x261725+='\x20<';_0x261725+=_0xdf7ff6[_0xa57c('0x8')][_0x5a6024]['address']?_0xdf7ff6[_0xa57c('0x8')][_0x5a6024]['address']:'anonymous'+random[_0xa57c('0xb')](0x6)+_0xa57c('0xc');_0x261725+='>';}}return _0x261725;}function parseEmail(_0x3eee75,_0x23bec0,_0x49242c){if(_0x23bec0[_0xa57c('0x14')]){var _0x25715f=/)<[^<]*)*<\/script>/gi;while(_0x25715f[_0xa57c('0x15')](_0x23bec0[_0xa57c('0x14')])){_0x23bec0[_0xa57c('0x14')]=_0x23bec0[_0xa57c('0x14')][_0xa57c('0x16')](_0x25715f,'');}if(_0x23bec0[_0xa57c('0x14')][_0xa57c('0x17')](_0xa57c('0x18'))){var _0x382a26=[];_0x23bec0[_0xa57c('0x19')][_0xa57c('0x1a')](_0x10a33d=>{_0x382a26[_0xa57c('0x1b')](_0x10a33d['filename']);});var _0x2db443=/]+>/g;var _0x5226d0=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x27884d=_0x23bec0[_0xa57c('0x14')][_0xa57c('0x16')](_0x5226d0,_0xa57c('0x1c'));var _0x8ee1c0=_0x27884d[_0xa57c('0x16')](_0x2db443,_0xa57c('0x1d'));for(let _0x1d59c2=0x0;_0x1d59c2<_0x382a26['length'];_0x1d59c2++){var _0x3b7364=_0x8ee1c0['replace']('_IMG',_0xa57c('0x1e')+_0x382a26[_0x1d59c2]+_0xa57c('0x1f'));_0x8ee1c0=_0x3b7364;}_0x23bec0['html']=_0x8ee1c0;}_0x49242c[_0xa57c('0x20')]=_0x23bec0[_0xa57c('0x14')];}else{_0x49242c[_0xa57c('0x20')]=_0x23bec0['textAsHtml'];}if(_0x49242c[_0xa57c('0x20')]){_0x49242c['body']=_0x49242c[_0xa57c('0x20')]['replace'](/0x0){var _0x5af5e9=[_0xa57c('0x2f'),_0xa57c('0x30'),_0xa57c('0x31')];for(var _0x2206a3=0x0;_0x2206a3<_0x23bec0[_0xa57c('0x2e')][_0xa57c('0x10')];_0x2206a3++){var _0x5d210b=_[_0xa57c('0x32')](_0x5af5e9,_0x23bec0['headerLines'][_0x2206a3]['line']);if(_0x5d210b>=0x0){_0x49242c['isAutoreply']=!![];}}}return _0x49242c;}exports['parser']=function(_0x588199,_0x39b20f,_0x32ed25){var _0x26d5e1={'from':getAddress(_0x39b20f['from']),'firstName':getFirstName(_0x39b20f['from']),'lastName':getLastName(_0x39b20f['from']),'mapKey':_0xa57c('0x5'),'message':{'from':getMails(_0x588199[_0xa57c('0x5')],_0x39b20f[_0xa57c('0x33')]),'to':_0x588199[_0xa57c('0x5')],'cc':'','subject':_0x39b20f[_0xa57c('0x34')]||'','messageId':_0x39b20f[_0xa57c('0x35')],'inReplyTo':_0x39b20f['inReplyTo'],'sentAt':moment(_0x39b20f[_0xa57c('0x36')])[_0xa57c('0x29')](_0xa57c('0x37')),'attach':![],'attachments':[]}};if(!_0x39b20f[_0xa57c('0x14')]&&!_0x39b20f[_0xa57c('0x38')]){var _0x3fe390=_['filter'](_0x39b20f[_0xa57c('0x19')],{'contentType':_0xa57c('0x39')});if(_0x3fe390[_0xa57c('0x10')]){logger[_0xa57c('0x3a')](util[_0xa57c('0x29')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x39b20f[_0xa57c('0x35')]));tnef[_0xa57c('0x3b')](_[_0xa57c('0x3c')](_0x3fe390)[_0xa57c('0x2d')],function(_0x7ba8ab,_0x11fccc){if(_0x11fccc){_0x39b20f['html']=_0x11fccc[_0xa57c('0x3d')]||_0xa57c('0x3e');if(_0x11fccc[_0xa57c('0x3f')]){for(var _0x44ea0a=0x0;_0x44ea0a<_0x11fccc[_0xa57c('0x3f')][_0xa57c('0x10')];_0x44ea0a++){var _0x57533e=_0x11fccc['Attachments'][_0x44ea0a];_0x26d5e1['message']['attachments'][_0xa57c('0x1b')]({'filename':_0x57533e['Title'],'content':Buffer[_0xa57c('0x33')](_0x57533e[_0xa57c('0x40')])});}}}_0x32ed25(parseEmail(_0x588199,_0x39b20f,_0x26d5e1));});}else{_0x39b20f['html']=_0xa57c('0x3e');_0x32ed25(parseEmail(_0x588199,_0x39b20f,_0x26d5e1));}}else{_0x32ed25(parseEmail(_0x588199,_0x39b20f,_0x26d5e1));}};exports[_0xa57c('0x41')]=function(_0x368e87){switch(_0x368e87){case _0xa57c('0x42'):return _0xa57c('0x43');case'yahoo':return _0xa57c('0x44');case _0xa57c('0x45'):return _0xa57c('0x46');case _0xa57c('0x47'):return _0xa57c('0x48');}return'127.0.0.1';}; \ No newline at end of file +var _0x0295=['includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','Attachments','Title','Data','getHost','imap.gmail.com','imap.mail.yahoo.com','hotmail','outlook.office365.com','lodash','path','../../../config/logger','email','../../../config/environment','head','value','address','name','substring','indexOf','length','slice','split','pop','isEmpty','anonymous','generate','@xcally.com','html','test','replace'];(function(_0x4c3977,_0x2bfd63){var _0x1f3df9=function(_0x22ac3d){while(--_0x22ac3d){_0x4c3977['push'](_0x4c3977['shift']());}};_0x1f3df9(++_0x2bfd63);}(_0x0295,0x1f0));var _0x5029=function(_0x4aaff3,_0x18b012){_0x4aaff3=_0x4aaff3-0x0;var _0x3a20f3=_0x0295[_0x4aaff3];return _0x3a20f3;};'use strict';var _=require(_0x5029('0x0'));var moment=require('moment');var random=require('randomstring');var fs=require('fs');var path=require(_0x5029('0x1'));var util=require('util');var tnef=require('node-tnef');var logger=require(_0x5029('0x2'))(_0x5029('0x3'));var config=require(_0x5029('0x4'));function getAddress(_0x3d0af1){var _0x170504=_[_0x5029('0x5')](_0x3d0af1[_0x5029('0x6')]);return _0x170504&&_0x170504[_0x5029('0x7')]?_0x170504[_0x5029('0x7')]:'anonymous'+random['generate'](0x6)+'@xcally.com';}function getFirstName(_0xf4459b){var _0x4fef7a=_[_0x5029('0x5')](_0xf4459b['value']);if(_0x4fef7a&&_0x4fef7a[_0x5029('0x8')]){if(_0x4fef7a['name']==_0x4fef7a[_0x5029('0x7')]){return _0x4fef7a[_0x5029('0x8')][_0x5029('0x9')](0x0,_0x4fef7a['name'][_0x5029('0xa')]('@'));}var _0xbf61f=_0x4fef7a[_0x5029('0x8')]['split'](/\s+/);return _0xbf61f[_0x5029('0xb')]>0x1?_0xbf61f[_0x5029('0xc')](0x0,-0x1)['join']('\x20'):_0x4fef7a['name'];}return'Anonymous';}function getLastName(_0x4aebb6){var _0x2484ac=_[_0x5029('0x5')](_0x4aebb6[_0x5029('0x6')]);if(_0x2484ac&&_0x2484ac[_0x5029('0x8')]){var _0x2c0b33=_0x2484ac[_0x5029('0x8')][_0x5029('0xd')](/\s+/);return _0x2c0b33[_0x5029('0xb')]>0x1?_0x2c0b33[_0x5029('0xe')]():'';}return'';}function getMails(_0x326923,_0x457c73){var _0x353cba='';for(var _0x3786b5=0x0;_0x3786b5<_0x457c73[_0x5029('0x6')][_0x5029('0xb')];_0x3786b5+=0x1){if(_0x457c73['value'][_0x3786b5][_0x5029('0x7')]!==_0x326923){if(!_[_0x5029('0xf')](_0x353cba)){_0x353cba+=',';}_0x353cba+=_0x457c73[_0x5029('0x6')][_0x3786b5][_0x5029('0x8')]||_0x457c73[_0x5029('0x6')][_0x3786b5][_0x5029('0x7')]||'';_0x353cba+='\x20<';_0x353cba+=_0x457c73[_0x5029('0x6')][_0x3786b5]['address']?_0x457c73[_0x5029('0x6')][_0x3786b5]['address']:_0x5029('0x10')+random[_0x5029('0x11')](0x6)+_0x5029('0x12');_0x353cba+='>';}}return _0x353cba;}function parseEmail(_0x3cf0fb,_0x4b5854,_0x47ecca){if(_0x4b5854[_0x5029('0x13')]){var _0x4a49b6=/)<[^<]*)*<\/script>/gi;while(_0x4a49b6[_0x5029('0x14')](_0x4b5854[_0x5029('0x13')])){_0x4b5854[_0x5029('0x13')]=_0x4b5854[_0x5029('0x13')][_0x5029('0x15')](_0x4a49b6,'');}if(_0x4b5854[_0x5029('0x13')][_0x5029('0x16')](_0x5029('0x17'))){var _0x3e857d=[];_0x4b5854['attachments']['forEach'](_0x49f347=>{_0x3e857d[_0x5029('0x18')](_0x49f347[_0x5029('0x19')]);});var _0x51093c=/]+>/g;var _0x5727e9=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x181da0=_0x4b5854[_0x5029('0x13')][_0x5029('0x15')](_0x5727e9,'_SRC');var _0x2c501f=_0x181da0[_0x5029('0x15')](_0x51093c,'_IMG');for(let _0x2b6d99=0x0;_0x2b6d99<_0x3e857d[_0x5029('0xb')];_0x2b6d99++){var _0x16ad8b=_0x2c501f['replace'](_0x5029('0x1a'),_0x5029('0x1b')+_0x3e857d[_0x2b6d99]+_0x5029('0x1c'));_0x2c501f=_0x16ad8b;}_0x4b5854['html']=_0x2c501f;}_0x47ecca[_0x5029('0x1d')]=_0x4b5854[_0x5029('0x13')];}else{_0x47ecca['body']=_0x4b5854[_0x5029('0x1e')];}if(_0x47ecca[_0x5029('0x1d')]){_0x47ecca[_0x5029('0x1d')]=_0x47ecca[_0x5029('0x1d')][_0x5029('0x15')](/0x0){var _0x52572a=[_0x5029('0x32'),'X-Auto-Response-Suppress:\x20All',_0x5029('0x33')];for(var _0x5653cb=0x0;_0x5653cb<_0x4b5854[_0x5029('0x31')][_0x5029('0xb')];_0x5653cb++){var _0x24a18d=_[_0x5029('0xa')](_0x52572a,_0x4b5854[_0x5029('0x31')][_0x5653cb][_0x5029('0x34')]);if(_0x24a18d>=0x0){_0x47ecca[_0x5029('0x35')]=!![];}}}return _0x47ecca;}exports[_0x5029('0x36')]=function(_0x2ae047,_0x5a3e4d,_0x103dfb){var _0x236455={'from':getAddress(_0x5a3e4d[_0x5029('0x37')]),'firstName':getFirstName(_0x5a3e4d[_0x5029('0x37')]),'lastName':getLastName(_0x5a3e4d[_0x5029('0x37')]),'mapKey':_0x5029('0x3'),'message':{'from':getMails(_0x2ae047['email'],_0x5a3e4d[_0x5029('0x37')]),'to':_0x2ae047[_0x5029('0x3')],'cc':'','subject':_0x5a3e4d[_0x5029('0x38')]||'','messageId':_0x5a3e4d[_0x5029('0x39')],'inReplyTo':_0x5a3e4d[_0x5029('0x3a')],'sentAt':moment(_0x5a3e4d['date'])[_0x5029('0x28')](_0x5029('0x3b')),'attach':![],'attachments':[]}};if(!_0x5a3e4d[_0x5029('0x13')]&&!_0x5a3e4d[_0x5029('0x1e')]){var _0xfbfbb2=_[_0x5029('0x3c')](_0x5a3e4d[_0x5029('0x24')],{'contentType':_0x5029('0x3d')});if(_0xfbfbb2[_0x5029('0xb')]){logger['info'](util[_0x5029('0x28')](_0x5029('0x3e'),_0x5a3e4d[_0x5029('0x39')]));tnef[_0x5029('0x3f')](_['first'](_0xfbfbb2)['content'],function(_0x17a515,_0x6185aa){if(_0x6185aa){_0x5a3e4d[_0x5029('0x13')]=_0x6185aa[_0x5029('0x40')]||_0x5029('0x41');if(_0x6185aa[_0x5029('0x42')]){for(var _0x2bb7fc=0x0;_0x2bb7fc<_0x6185aa[_0x5029('0x42')][_0x5029('0xb')];_0x2bb7fc++){var _0x2790e4=_0x6185aa[_0x5029('0x42')][_0x2bb7fc];_0x236455[_0x5029('0x20')][_0x5029('0x24')][_0x5029('0x18')]({'filename':_0x2790e4[_0x5029('0x43')],'content':Buffer[_0x5029('0x37')](_0x2790e4[_0x5029('0x44')])});}}}_0x103dfb(parseEmail(_0x2ae047,_0x5a3e4d,_0x236455));});}else{_0x5a3e4d[_0x5029('0x13')]=_0x5029('0x41');_0x103dfb(parseEmail(_0x2ae047,_0x5a3e4d,_0x236455));}}else{_0x103dfb(parseEmail(_0x2ae047,_0x5a3e4d,_0x236455));}};exports[_0x5029('0x45')]=function(_0x1d0a38){switch(_0x1d0a38){case'gmail':return _0x5029('0x46');case'yahoo':return _0x5029('0x47');case _0x5029('0x48'):return'imap-mail.outlook.com';case'outlook365':return _0x5029('0x49');}return'127.0.0.1';}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index afb8d85..90dc063 100644 --- a/server/services/email/model/mailAccount.js +++ b/server/services/email/model/mailAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1fa4=['exports','lodash','name','Service','key','SERV','active','Imap','Smtp'];(function(_0x3507fc,_0x2ca11b){var _0x394cde=function(_0x3bbca4){while(--_0x3bbca4){_0x3507fc['push'](_0x3507fc['shift']());}};_0x394cde(++_0x2ca11b);}(_0x1fa4,0x133));var _0x41fa=function(_0x57ff59,_0x4b9327){_0x57ff59=_0x57ff59-0x0;var _0x58e63f=_0x1fa4[_0x57ff59];return _0x58e63f;};'use strict';var _=require(_0x41fa('0x0'));function MailAccount(_0x1c7bd5){this['id']=_0x1c7bd5['id']||0x0;this[_0x41fa('0x1')]=_0x1c7bd5['name']||_0x41fa('0x2');this['key']=_0x1c7bd5[_0x41fa('0x3')]||_0x41fa('0x4');this[_0x41fa('0x5')]=_0x1c7bd5[_0x41fa('0x5')]||![];this[_0x41fa('0x6')]=_0x1c7bd5[_0x41fa('0x6')]||[];this[_0x41fa('0x7')]=_0x1c7bd5['Smtp']||[];}module[_0x41fa('0x8')]=MailAccount; \ No newline at end of file +var _0xbdcd=['Smtp','exports','lodash','name','key','SERV','active','Imap'];(function(_0x5161fc,_0x37c5f6){var _0x38490b=function(_0x49ebd8){while(--_0x49ebd8){_0x5161fc['push'](_0x5161fc['shift']());}};_0x38490b(++_0x37c5f6);}(_0xbdcd,0xaa));var _0xdbdc=function(_0x153c6a,_0x2a217a){_0x153c6a=_0x153c6a-0x0;var _0xce898f=_0xbdcd[_0x153c6a];return _0xce898f;};'use strict';var _=require(_0xdbdc('0x0'));function MailAccount(_0x27164f){this['id']=_0x27164f['id']||0x0;this[_0xdbdc('0x1')]=_0x27164f[_0xdbdc('0x1')]||'Service';this[_0xdbdc('0x2')]=_0x27164f[_0xdbdc('0x2')]||_0xdbdc('0x3');this['active']=_0x27164f[_0xdbdc('0x4')]||![];this[_0xdbdc('0x5')]=_0x27164f[_0xdbdc('0x5')]||[];this['Smtp']=_0x27164f[_0xdbdc('0x6')]||[];}module[_0xdbdc('0x7')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index c025411..c443d0d 100644 --- a/server/services/email/realtime/index.js +++ b/server/services/email/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3467=['exports','lodash','../model/mailAccount','prototype','hasOwnProperty','initMailAccounts','mailAccounts','isUndefined','merge'];(function(_0x2796c4,_0x5331e2){var _0x51ce70=function(_0x338db8){while(--_0x338db8){_0x2796c4['push'](_0x2796c4['shift']());}};_0x51ce70(++_0x5331e2);}(_0x3467,0x1ba));var _0x7346=function(_0x5353d8,_0x350279){_0x5353d8=_0x5353d8-0x0;var _0x362bab=_0x3467[_0x5353d8];return _0x362bab;};'use strict';var _=require(_0x7346('0x0'));var MailAccount=require(_0x7346('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x2d9e9c,_0x2271a1,_0x4a4cfa){var _0x399e82=_['mapKeys'](_0x2d9e9c,function(_0x594505,_0x66892d){return _0x594505[_0x4a4cfa];});for(var _0x4fe253 in _0x2271a1){if(_0x2271a1['hasOwnProperty'](_0x4fe253)){if(!_0x399e82[_0x4fe253]){delete _0x2271a1[_0x4fe253];}}}}Realtime[_0x7346('0x2')]['mergeFromDatabase']=function(_0x4d984f,_0x14725c){for(var _0x4bed0c in _0x14725c){if(_0x4d984f[_0x7346('0x3')](_0x4bed0c)){_0x4d984f[_0x4bed0c]=_0x14725c[_0x4bed0c];}}};Realtime[_0x7346('0x2')][_0x7346('0x4')]=function(){var _0x4a5dda=this;return function(_0x2732c6){if(_0x2732c6){freeIsNotKey(_0x2732c6,_0x4a5dda[_0x7346('0x5')],'id');for(var _0x145f9b=0x0,_0x4213c5={},_0x4d4972={};_0x145f9b<_0x2732c6['length'];_0x145f9b+=0x1){_0x4213c5=_0x2732c6[_0x145f9b];if(_[_0x7346('0x6')](_0x4a5dda[_0x7346('0x5')][_0x4213c5['id']])){_0x4a5dda[_0x7346('0x5')][_0x4213c5['id']]=new MailAccount(_0x4213c5);}else{_[_0x7346('0x7')](_0x4a5dda['mailAccounts'][_0x4213c5['id']],_0x4213c5);}}}return _0x4a5dda[_0x7346('0x5')];};};module[_0x7346('0x8')]=Realtime; \ No newline at end of file +var _0xb1c3=['hasOwnProperty','initMailAccounts','merge','lodash','../model/mailAccount','mailAccounts','mapKeys','prototype'];(function(_0x29f866,_0x325482){var _0x1697de=function(_0x278556){while(--_0x278556){_0x29f866['push'](_0x29f866['shift']());}};_0x1697de(++_0x325482);}(_0xb1c3,0xfb));var _0x3b1c=function(_0x2e0794,_0x227e78){_0x2e0794=_0x2e0794-0x0;var _0x1c50d5=_0xb1c3[_0x2e0794];return _0x1c50d5;};'use strict';var _=require(_0x3b1c('0x0'));var MailAccount=require(_0x3b1c('0x1'));var Realtime=function(){this[_0x3b1c('0x2')]={};};function freeIsNotKey(_0x144d2c,_0x15e0c4,_0x98ea31){var _0x328ced=_[_0x3b1c('0x3')](_0x144d2c,function(_0x5c4b28,_0x438783){return _0x5c4b28[_0x98ea31];});for(var _0x47e3b2 in _0x15e0c4){if(_0x15e0c4['hasOwnProperty'](_0x47e3b2)){if(!_0x328ced[_0x47e3b2]){delete _0x15e0c4[_0x47e3b2];}}}}Realtime[_0x3b1c('0x4')]['mergeFromDatabase']=function(_0x30439b,_0x171f29){for(var _0x147fac in _0x171f29){if(_0x30439b[_0x3b1c('0x5')](_0x147fac)){_0x30439b[_0x147fac]=_0x171f29[_0x147fac];}}};Realtime['prototype'][_0x3b1c('0x6')]=function(){var _0x586e3c=this;return function(_0x317969){if(_0x317969){freeIsNotKey(_0x317969,_0x586e3c['mailAccounts'],'id');for(var _0x3d78f3=0x0,_0x38dba5={},_0x3414ec={};_0x3d78f3<_0x317969['length'];_0x3d78f3+=0x1){_0x38dba5=_0x317969[_0x3d78f3];if(_['isUndefined'](_0x586e3c[_0x3b1c('0x2')][_0x38dba5['id']])){_0x586e3c[_0x3b1c('0x2')][_0x38dba5['id']]=new MailAccount(_0x38dba5);}else{_[_0x3b1c('0x7')](_0x586e3c[_0x3b1c('0x2')][_0x38dba5['id']],_0x38dba5);}}}return _0x586e3c[_0x3b1c('0x2')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 33c0433..d2c9d25 100644 --- a/server/services/email/rpc/mailAccount.js +++ b/server/services/email/rpc/mailAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1be0=['Request','GetMailAccount','name','email','active','key','ListId','MailServerIn','Imap','getMailAccount','notify','NotifyMailAccount','getMailAccounts'];(function(_0x3f14d5,_0x45021d){var _0x392e9d=function(_0x388bdf){while(--_0x388bdf){_0x3f14d5['push'](_0x3f14d5['shift']());}};_0x392e9d(++_0x45021d);}(_0x1be0,0x16b));var _0x01be=function(_0xdb9395,_0xd424ea){_0xdb9395=_0xdb9395-0x0;var _0x257a2d=_0x1be0[_0xdb9395];return _0x257a2d;};'use strict';var client=require('../client');exports[_0x01be('0x0')]=function(){return function(){return client[_0x01be('0x1')](_0x01be('0x2'),{'options':{'attributes':['id',_0x01be('0x3'),'service',_0x01be('0x4'),_0x01be('0x5'),_0x01be('0x6'),_0x01be('0x7'),'TemplateId'],'raw':![],'include':[{'model':_0x01be('0x8'),'as':_0x01be('0x9')},{'model':'MailServerOut','as':'Smtp'}]},'log':_0x01be('0xa')});};};exports[_0x01be('0xb')]=function(_0xbad158,_0x478a41){return client[_0x01be('0x1')](_0x01be('0xc'),{'account':{'id':_0xbad158},'body':_0x478a41,'log':_0x01be('0xc')});}; \ No newline at end of file +var _0x51d7=['ListId','TemplateId','MailServerIn','Imap','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','service','email','active','key'];(function(_0x29bcb1,_0x33b683){var _0x32a7ed=function(_0x1e9fdf){while(--_0x1e9fdf){_0x29bcb1['push'](_0x29bcb1['shift']());}};_0x32a7ed(++_0x33b683);}(_0x51d7,0xcf));var _0x751d=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x51d7[_0x40a045];return _0x1a687c;};'use strict';var client=require(_0x751d('0x0'));exports[_0x751d('0x1')]=function(){return function(){return client[_0x751d('0x2')](_0x751d('0x3'),{'options':{'attributes':['id',_0x751d('0x4'),_0x751d('0x5'),_0x751d('0x6'),_0x751d('0x7'),_0x751d('0x8'),_0x751d('0x9'),_0x751d('0xa')],'raw':![],'include':[{'model':_0x751d('0xb'),'as':_0x751d('0xc')},{'model':_0x751d('0xd'),'as':_0x751d('0xe')}]},'log':_0x751d('0xf')});};};exports[_0x751d('0x10')]=function(_0x18370c,_0x110ac8){return client[_0x751d('0x2')](_0x751d('0x11'),{'account':{'id':_0x18370c},'body':_0x110ac8,'log':_0x751d('0x11')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 44e2dfc..031a08d 100644 --- a/server/services/email/rpc/setting.js +++ b/server/services/email/rpc/setting.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x78eb=['loginMailFrequency','getSettings'];(function(_0x19044f,_0x35a8f7){var _0x2c3507=function(_0x452940){while(--_0x452940){_0x19044f['push'](_0x19044f['shift']());}};_0x2c3507(++_0x35a8f7);}(_0x78eb,0xc7));var _0xb78e=function(_0x3cf6e4,_0x53f6ac){_0x3cf6e4=_0x3cf6e4-0x0;var _0x3a3743=_0x78eb[_0x3cf6e4];return _0x3a3743;};'use strict';var client=require('../client');exports[_0xb78e('0x0')]=function(){return client['Request']('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xb78e('0x1')]},'log':'GetSettings'});}; \ No newline at end of file +var _0x2f12=['GetSettings','../client','getSettings','Request','ShowSetting','loginMailFrequency'];(function(_0x35c5be,_0x1ce11d){var _0x362b23=function(_0x29df44){while(--_0x29df44){_0x35c5be['push'](_0x35c5be['shift']());}};_0x362b23(++_0x1ce11d);}(_0x2f12,0x1bd));var _0x22f1=function(_0x5dc3ce,_0x5057c1){_0x5dc3ce=_0x5dc3ce-0x0;var _0x1de35c=_0x2f12[_0x5dc3ce];return _0x1de35c;};'use strict';var client=require(_0x22f1('0x0'));exports[_0x22f1('0x1')]=function(){return client[_0x22f1('0x2')](_0x22f1('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x22f1('0x4')]},'log':_0x22f1('0x5')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 426a609..b810112 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file diff --git a/server/services/express/index.js b/server/services/express/index.js index eef9a30..e5098c7 100644 --- a/server/services/express/index.js +++ b/server/services/express/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb53f=['defaults','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','once','listening','express','sticky-session','ioredis','../../config/environment','createServer','timeout','port','socket.io','websocket','polling','redis'];(function(_0x3f033f,_0x1f9737){var _0x3f3f8d=function(_0x4d41b6){while(--_0x4d41b6){_0x3f033f['push'](_0x3f033f['shift']());}};_0x3f3f8d(++_0x1f9737);}(_0xb53f,0xc7));var _0xfb53=function(_0x3b60e6,_0x57c8ee){_0x3b60e6=_0x3b60e6-0x0;var _0x3625d8=_0xb53f[_0x3b60e6];return _0x3625d8;};'use strict';var _=require('lodash');var http=require('http');var express=require(_0xfb53('0x0'));var sticky=require(_0xfb53('0x1'));var Redis=require(_0xfb53('0x2'));var config=require(_0xfb53('0x3'));var app=express();var server=http[_0xfb53('0x4')](app);server[_0xfb53('0x5')]=0xdbba0;if(sticky['listen'](server,config[_0xfb53('0x6')])){var socketio=require(_0xfb53('0x7'))(server,{'transports':[_0xfb53('0x8'),_0xfb53('0x9')]});config[_0xfb53('0xa')]=_[_0xfb53('0xb')](config['redis'],{'host':_0xfb53('0xc'),'port':0x18eb});socketio[_0xfb53('0xd')](require(_0xfb53('0xe'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0xfb53('0xa')])}));require(_0xfb53('0xf'))[_0xfb53('0x10')]();require(_0xfb53('0x11'))[_0xfb53('0x10')](socketio);require(_0xfb53('0x12'))[_0xfb53('0x10')](app);require('../../routes')[_0xfb53('0x10')](app);}else{server[_0xfb53('0x13')](_0xfb53('0x14'),function(){console['log']('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0xfb53('0x6')]);});}exports=module['exports']=app; \ No newline at end of file +var _0xbb73=['log','exports','lodash','http','express','sticky-session','ioredis','../../config/environment','createServer','timeout','port','socket.io','websocket','polling','redis','defaults','localhost','adapter','socket.io-redis','../../config/socketio','default','../../config/express','../../routes','listening'];(function(_0x59cc2f,_0x40ad99){var _0x136c14=function(_0x423385){while(--_0x423385){_0x59cc2f['push'](_0x59cc2f['shift']());}};_0x136c14(++_0x40ad99);}(_0xbb73,0x1e2));var _0x3bb7=function(_0x641860,_0x2a61f3){_0x641860=_0x641860-0x0;var _0x5a1da7=_0xbb73[_0x641860];return _0x5a1da7;};'use strict';var _=require(_0x3bb7('0x0'));var http=require(_0x3bb7('0x1'));var express=require(_0x3bb7('0x2'));var sticky=require(_0x3bb7('0x3'));var Redis=require(_0x3bb7('0x4'));var config=require(_0x3bb7('0x5'));var app=express();var server=http[_0x3bb7('0x6')](app);server[_0x3bb7('0x7')]=0xdbba0;if(sticky['listen'](server,config[_0x3bb7('0x8')])){var socketio=require(_0x3bb7('0x9'))(server,{'transports':[_0x3bb7('0xa'),_0x3bb7('0xb')]});config[_0x3bb7('0xc')]=_[_0x3bb7('0xd')](config['redis'],{'host':_0x3bb7('0xe'),'port':0x18eb});socketio[_0x3bb7('0xf')](require(_0x3bb7('0x10'))({'pubClient':new Redis(config[_0x3bb7('0xc')]),'subClient':new Redis(config['redis'])}));require('../../config/triggers')['default']();require(_0x3bb7('0x11'))[_0x3bb7('0x12')](socketio);require(_0x3bb7('0x13'))['default'](app);require(_0x3bb7('0x14'))['default'](app);}else{server['once'](_0x3bb7('0x15'),function(){console[_0x3bb7('0x16')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0x3bb7('0x8')]);});}exports=module[_0x3bb7('0x17')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index c223371..b2c3262 100644 --- a/server/services/routing/client.js +++ b/server/services/routing/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7654=['bluebird','../../config/logger','routing','request','then','error','message','result','catch','rpc','jayson/promise'];(function(_0x164e11,_0x1cdde0){var _0x3075d4=function(_0x1ffe8a){while(--_0x1ffe8a){_0x164e11['push'](_0x164e11['shift']());}};_0x3075d4(++_0x1cdde0);}(_0x7654,0xa4));var _0x4765=function(_0x4ffef3,_0x1a489f){_0x4ffef3=_0x4ffef3-0x0;var _0x5b1dfe=_0x7654[_0x4ffef3];return _0x5b1dfe;};'use strict';var jayson=require(_0x4765('0x0'));var BPromise=require(_0x4765('0x1'));var logger=require(_0x4765('0x2'))(_0x4765('0x3'));var client=jayson['client']['http']({'port':0x2329});client['Request']=function(_0x43b11f,_0x223f2f){return new BPromise(function(_0x1c9ab0,_0xdc16c8){return client[_0x4765('0x4')](_0x43b11f,_0x223f2f)[_0x4765('0x5')](function(_0x1d0205){logger['debug']('rpc',_0x4765('0x3'),_0x43b11f,_0x223f2f,_0x1d0205);if(_0x1d0205[_0x4765('0x6')]){logger[_0x4765('0x6')]('rpc',_0x4765('0x3'),_0x43b11f,_0x1d0205[_0x4765('0x6')]['message'],_0x223f2f);return _0xdc16c8(_0x1d0205[_0x4765('0x6')][_0x4765('0x7')]);}else{return _0x1c9ab0(_0x1d0205[_0x4765('0x8')]);}})[_0x4765('0x9')](function(_0xeaf46){logger[_0x4765('0x6')](_0x4765('0xa'),_0x4765('0x3'),_0x43b11f,_0xeaf46,_0x223f2f);return _0xdc16c8(_0xeaf46);});});};module['exports']=client; \ No newline at end of file +var _0x7fc9=['http','Request','request','then','debug','rpc','error','routing','message','result','catch','exports','jayson/promise','bluebird','client'];(function(_0x21294f,_0x1e03a5){var _0x32de9b=function(_0x5be1c2){while(--_0x5be1c2){_0x21294f['push'](_0x21294f['shift']());}};_0x32de9b(++_0x1e03a5);}(_0x7fc9,0x84));var _0x97fc=function(_0x3efe87,_0x35ad48){_0x3efe87=_0x3efe87-0x0;var _0x56a4cc=_0x7fc9[_0x3efe87];return _0x56a4cc;};'use strict';var jayson=require(_0x97fc('0x0'));var BPromise=require(_0x97fc('0x1'));var logger=require('../../config/logger')('routing');var client=jayson[_0x97fc('0x2')][_0x97fc('0x3')]({'port':0x2329});client[_0x97fc('0x4')]=function(_0x48877f,_0x2da52c){return new BPromise(function(_0x393ea8,_0x4f802e){return client[_0x97fc('0x5')](_0x48877f,_0x2da52c)[_0x97fc('0x6')](function(_0x17580d){logger[_0x97fc('0x7')](_0x97fc('0x8'),'routing',_0x48877f,_0x2da52c,_0x17580d);if(_0x17580d[_0x97fc('0x9')]){logger[_0x97fc('0x9')](_0x97fc('0x8'),_0x97fc('0xa'),_0x48877f,_0x17580d['error']['message'],_0x2da52c);return _0x4f802e(_0x17580d[_0x97fc('0x9')][_0x97fc('0xb')]);}else{return _0x393ea8(_0x17580d[_0x97fc('0xc')]);}})[_0x97fc('0xd')](function(_0x31df33){logger[_0x97fc('0x9')](_0x97fc('0x8'),_0x97fc('0xa'),_0x48877f,_0x31df33,_0x2da52c);return _0x4f802e(_0x31df33);});});};module[_0x97fc('0xe')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 9c58818..a068c10 100644 --- a/server/services/routing/index.js +++ b/server/services/routing/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x532d=['getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','initWhatsappQueues','listen','catch','log','./server','./realtime','./rpc/user','./rpc/chatQueue','./rpc/mailQueue','./rpc/whatsappQueue','resolve','then','getAgents','getIntervals','initIntervals','getOpenchannelQueues'];(function(_0x25178c,_0xe2ab28){var _0xa55a9=function(_0x55d3ed){while(--_0x55d3ed){_0x25178c['push'](_0x25178c['shift']());}};_0xa55a9(++_0xe2ab28);}(_0x532d,0x114));var _0xd532=function(_0x2300c7,_0x255f74){_0x2300c7=_0x2300c7-0x0;var _0x23f720=_0x532d[_0x2300c7];return _0x23f720;};'use strict';var BPromise=require('bluebird');var server=require(_0xd532('0x0'));var Realtime=require(_0xd532('0x1'));var user=require(_0xd532('0x2'));var interval=require('./rpc/interval');var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0xd532('0x3'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0xd532('0x4'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0xd532('0x5'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xd532('0x6')]()[_0xd532('0x7')](user[_0xd532('0x8')]())[_0xd532('0x7')](realtime['initAgents']())['then'](interval[_0xd532('0x9')]())['then'](realtime[_0xd532('0xa')]())[_0xd532('0x7')](openchannelQueue[_0xd532('0xb')]())['then'](realtime['initOpenchannelQueues']())[_0xd532('0x7')](chatQueue[_0xd532('0xc')]())[_0xd532('0x7')](realtime[_0xd532('0xd')]())[_0xd532('0x7')](smsQueue[_0xd532('0xe')]())[_0xd532('0x7')](realtime[_0xd532('0xf')]())[_0xd532('0x7')](mailQueue[_0xd532('0x10')]())[_0xd532('0x7')](realtime[_0xd532('0x11')]())['then'](faxQueue[_0xd532('0x12')]())['then'](realtime[_0xd532('0x13')]())[_0xd532('0x7')](whatsappQueue['getWhatsappQueues']())[_0xd532('0x7')](realtime[_0xd532('0x14')]())[_0xd532('0x7')](function(){return realtime;});}function main(){return server[_0xd532('0x15')](realtime)[_0xd532('0x7')](function(_0x5dd230){return initRealtime();})[_0xd532('0x7')](function(_0x48cb1a){return setInterval(initRealtime,0x1388);})[_0xd532('0x16')](function(_0x1cdbf4){console[_0xd532('0x17')](_0x1cdbf4);});}main(); \ No newline at end of file +var _0xe824=['getSmsQueues','initSmsQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','catch','log','bluebird','./server','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','resolve','then','getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues'];(function(_0x4db40c,_0x5aebda){var _0x572a4b=function(_0x4cb854){while(--_0x4cb854){_0x4db40c['push'](_0x4db40c['shift']());}};_0x572a4b(++_0x5aebda);}(_0xe824,0x133));var _0x4e82=function(_0x347ffb,_0x156d2b){_0x347ffb=_0x347ffb-0x0;var _0x330474=_0xe824[_0x347ffb];return _0x330474;};'use strict';var BPromise=require(_0x4e82('0x0'));var server=require(_0x4e82('0x1'));var Realtime=require('./realtime');var user=require(_0x4e82('0x2'));var interval=require(_0x4e82('0x3'));var openchannelQueue=require(_0x4e82('0x4'));var chatQueue=require(_0x4e82('0x5'));var smsQueue=require(_0x4e82('0x6'));var mailQueue=require(_0x4e82('0x7'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0x4e82('0x8')]()[_0x4e82('0x9')](user[_0x4e82('0xa')]())['then'](realtime[_0x4e82('0xb')]())[_0x4e82('0x9')](interval[_0x4e82('0xc')]())[_0x4e82('0x9')](realtime[_0x4e82('0xd')]())[_0x4e82('0x9')](openchannelQueue[_0x4e82('0xe')]())[_0x4e82('0x9')](realtime[_0x4e82('0xf')]())[_0x4e82('0x9')](chatQueue[_0x4e82('0x10')]())['then'](realtime[_0x4e82('0x11')]())[_0x4e82('0x9')](smsQueue[_0x4e82('0x12')]())[_0x4e82('0x9')](realtime[_0x4e82('0x13')]())[_0x4e82('0x9')](mailQueue['getMailQueues']())[_0x4e82('0x9')](realtime['initMailQueues']())[_0x4e82('0x9')](faxQueue['getFaxQueues']())[_0x4e82('0x9')](realtime[_0x4e82('0x14')]())[_0x4e82('0x9')](whatsappQueue[_0x4e82('0x15')]())[_0x4e82('0x9')](realtime[_0x4e82('0x16')]())[_0x4e82('0x9')](function(){return realtime;});}function main(){return server['listen'](realtime)['then'](function(_0xed7ecc){return initRealtime();})[_0x4e82('0x9')](function(_0x2dead3){return setInterval(initRealtime,0x1388);})[_0x4e82('0x17')](function(_0x44c601){console[_0x4e82('0x18')](_0x44c601);});}main(); \ No newline at end of file diff --git a/server/services/routing/lib/rule-engine.js b/server/services/routing/lib/rule-engine.js index d0bdb1e..6a09e2d 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['turn','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','exports','lodash','util','events','isNil','register','ignoreFactChanges','inherits','init','rules','activeRules','concat','prototype','sync','filter','orderBy','asc','execute','clone','consequence','ruleRef','name','index_','nextTick','push','call','isEqual','restart','length','condition','matchPath','noop','findRules'];(function(_0x2bed1e,_0x550556){var _0x1232f8=function(_0x24f7d7){while(--_0x24f7d7){_0x2bed1e['push'](_0x2bed1e['shift']());}};_0x1232f8(++_0x550556);}(_0x7a54,0x106));var _0x47a5=function(_0x306a6d,_0x4e3255){_0x306a6d=_0x306a6d-0x0;var _0x533f5a=_0x7a54[_0x306a6d];return _0x533f5a;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var EventEmitter=require(_0x47a5('0x2'))['EventEmitter'];function RuleEngine(_0x1d33e,_0x4086cd){this['init']();if(!_[_0x47a5('0x3')](_0x1d33e)){this[_0x47a5('0x4')](_0x1d33e);}if(_0x4086cd){this[_0x47a5('0x5')]=_0x4086cd[_0x47a5('0x5')];}return this;}util[_0x47a5('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x47a5('0x7')]=function(_0x59199c){this[_0x47a5('0x8')]=[];this[_0x47a5('0x9')]=[];};RuleEngine['prototype'][_0x47a5('0x4')]=function(_0x5077f3){if(Array['isArray'](_0x5077f3)){this['rules']=this[_0x47a5('0x8')][_0x47a5('0xa')](_0x5077f3);}else if(_0x5077f3!==null&&_['isObject'](_0x5077f3)){this[_0x47a5('0x8')]['push'](_0x5077f3);}this['sync']();};RuleEngine[_0x47a5('0xb')][_0x47a5('0xc')]=function(){this[_0x47a5('0x9')]=this[_0x47a5('0x8')][_0x47a5('0xd')](function(_0xd308b8){if(_[_0x47a5('0x3')](_0xd308b8['on'])){_0xd308b8['on']=!![];}if(_0xd308b8['on']===!![]){return _0xd308b8;}});this['activeRules']=_[_0x47a5('0xe')](this[_0x47a5('0x9')],['p'],[_0x47a5('0xf')]);};RuleEngine[_0x47a5('0xb')][_0x47a5('0x10')]=function(_0x620ee9,_0x3c6c46){var _0x190faa=![];_0x620ee9['result']=!![];var _0x362359=_[_0x47a5('0x11')](_0x620ee9);var _0x3b001e=_[_0x47a5('0x11')](_0x620ee9);var _0x1ef44c=this['activeRules'];var _0x549de3=[];var _0x138bc0=this['ignoreFactChanges'];(function FnRuleLoop(_0x5247fd){var _0x423a81={'rules':function(){return _0x1ef44c;},'rule':function(){return _0x1ef44c[_0x5247fd];},'when':function(_0xaf70a6){if(_0xaf70a6){var _0x2ce454=_0x1ef44c[_0x5247fd][_0x47a5('0x12')];_0x2ce454[_0x47a5('0x13')]=_0x1ef44c[_0x5247fd]['id']||_0x1ef44c[_0x5247fd][_0x47a5('0x14')]||_0x47a5('0x15')+_0x5247fd;process[_0x47a5('0x16')](function(){_0x549de3[_0x47a5('0x17')](_0x2ce454['ruleRef']);_0x2ce454[_0x47a5('0x18')](_0x362359,_0x423a81);});}else{process[_0x47a5('0x16')](function(){_0x423a81['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190faa=!![];return FnRuleLoop(0x0);},'next':function(_0x2b0360){if(!_0x138bc0&&!_[_0x47a5('0x19')](_0x3b001e,_0x362359)){_0x3b001e=_[_0x47a5('0x11')](_0x362359);process['nextTick'](function(){_0x423a81[_0x47a5('0x1a')]();});}else{process[_0x47a5('0x16')](function(){if(_[_0x47a5('0x3')](_0x2b0360)){return FnRuleLoop(_0x5247fd+0x1);}else{return FnRuleLoop(_0x2b0360);}});}}};if(_0x5247fd<_0x1ef44c[_0x47a5('0x1b')]&&_0x190faa===![]){var _0x5ef1b1=_0x1ef44c[_0x5247fd][_0x47a5('0x1c')];_0x5ef1b1[_0x47a5('0x18')](_0x362359,_0x423a81);}else{process['nextTick'](function(){_0x362359[_0x47a5('0x1d')]=_0x549de3;return _0x3c6c46?_0x3c6c46(_0x362359):_[_0x47a5('0x1e')]();});}}(0x0));};RuleEngine[_0x47a5('0xb')][_0x47a5('0x1f')]=function(_0x3abd6a){if(_['isNil'](_0x3abd6a)){return this['rules'];}else{var _0x136745=_['matches'](_0x3abd6a);return _[_0x47a5('0xd')](this['rules'],_0x136745);}};RuleEngine[_0x47a5('0xb')][_0x47a5('0x20')]=function(_0x36ad34,_0x1dac65){var _0x21f296=_0x36ad34==='on'||_0x36ad34==='ON'?!![]:![];var _0x3ba0b7=this[_0x47a5('0x1f')](_0x1dac65);for(var _0x136b14=0x0,_0x16631f=_0x3ba0b7[_0x47a5('0x1b')];_0x136b14<_0x16631f;_0x136b14+=0x1){_0x3ba0b7[_0x136b14]['on']=_0x21f296;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x21')]=function(_0x528582,_0x243210){_0x528582=parseInt(_0x528582,0xa);var _0x51833b=this[_0x47a5('0x1f')](_0x243210);for(var _0x9ac908=0x0,_0x16901f=_0x51833b['length'];_0x9ac908<_0x16901f;_0x9ac908+=0x1){_0x51833b[_0x9ac908][_0x47a5('0x22')]=_0x528582;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x23')]=function(){var _0x51cc81=this['rules'];if(_0x51cc81 instanceof Array){_0x51cc81=_0x51cc81[_0x47a5('0x24')](function(_0xfb5ddb){_0xfb5ddb['condition']=_0xfb5ddb['condition'][_0x47a5('0x25')]();_0xfb5ddb[_0x47a5('0x12')]=_0xfb5ddb['consequence'][_0x47a5('0x25')]();return _0xfb5ddb;});}else if(!_['isNil'](_0x51cc81)){_0x51cc81[_0x47a5('0x1c')]=_0x51cc81[_0x47a5('0x1c')]['toString']();_0x51cc81['consequence']=_0x51cc81[_0x47a5('0x12')]['toString']();}return _0x51cc81;};RuleEngine[_0x47a5('0xb')][_0x47a5('0x26')]=function(_0xf269a8){this['init']();if(_[_0x47a5('0x27')](_0xf269a8)){_0xf269a8=JSON['parse'](_0xf269a8);}if(_0xf269a8 instanceof Array){_0xf269a8=_0xf269a8['map'](function(_0x65542e){_0x65542e['condition']=eval('('+_0x65542e[_0x47a5('0x1c')]+')');_0x65542e['consequence']=eval('('+_0x65542e[_0x47a5('0x12')]+')');return _0x65542e;});}else if(_0xf269a8!==null&&typeof _0xf269a8==_0x47a5('0x28')){_0xf269a8[_0x47a5('0x1c')]=eval('('+_0xf269a8[_0x47a5('0x1c')]+')');_0xf269a8[_0x47a5('0x12')]=eval('('+_0xf269a8[_0x47a5('0x12')]+')');}this[_0x47a5('0x4')](_0xf269a8);};module[_0x47a5('0x29')]=RuleEngine; \ No newline at end of file +var _0x1261=['isNil','register','ignoreFactChanges','activeRules','prototype','isArray','rules','concat','isObject','push','sync','filter','orderBy','asc','result','clone','name','nextTick','ruleRef','isEqual','restart','length','condition','noop','findRules','matches','turn','prioritize','priority','toString','consequence','fromJSON','isString','parse','map','object','exports','util','events','EventEmitter','init'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x1261,0x144));var _0x1126=function(_0x4d0be7,_0xe3a0d0){_0x4d0be7=_0x4d0be7-0x0;var _0x2a4910=_0x1261[_0x4d0be7];return _0x2a4910;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var EventEmitter=require(_0x1126('0x1'))[_0x1126('0x2')];function RuleEngine(_0x331a2c,_0x39b786){this[_0x1126('0x3')]();if(!_[_0x1126('0x4')](_0x331a2c)){this[_0x1126('0x5')](_0x331a2c);}if(_0x39b786){this[_0x1126('0x6')]=_0x39b786[_0x1126('0x6')];}return this;}util['inherits'](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x1126('0x3')]=function(_0x907180){this['rules']=[];this[_0x1126('0x7')]=[];};RuleEngine[_0x1126('0x8')][_0x1126('0x5')]=function(_0x3abb0b){if(Array[_0x1126('0x9')](_0x3abb0b)){this['rules']=this[_0x1126('0xa')][_0x1126('0xb')](_0x3abb0b);}else if(_0x3abb0b!==null&&_[_0x1126('0xc')](_0x3abb0b)){this['rules'][_0x1126('0xd')](_0x3abb0b);}this['sync']();};RuleEngine['prototype'][_0x1126('0xe')]=function(){this['activeRules']=this[_0x1126('0xa')][_0x1126('0xf')](function(_0xd26a32){if(_[_0x1126('0x4')](_0xd26a32['on'])){_0xd26a32['on']=!![];}if(_0xd26a32['on']===!![]){return _0xd26a32;}});this[_0x1126('0x7')]=_[_0x1126('0x10')](this[_0x1126('0x7')],['p'],[_0x1126('0x11')]);};RuleEngine[_0x1126('0x8')]['execute']=function(_0x5de9a7,_0x1af673){var _0x154e20=![];_0x5de9a7[_0x1126('0x12')]=!![];var _0x4be0c6=_[_0x1126('0x13')](_0x5de9a7);var _0x4794a7=_[_0x1126('0x13')](_0x5de9a7);var _0x42f379=this[_0x1126('0x7')];var _0x4e1c97=[];var _0x245cd7=this[_0x1126('0x6')];(function FnRuleLoop(_0x4a7b49){var _0x4d2b38={'rules':function(){return _0x42f379;},'rule':function(){return _0x42f379[_0x4a7b49];},'when':function(_0x22ae0b){if(_0x22ae0b){var _0x2b2487=_0x42f379[_0x4a7b49]['consequence'];_0x2b2487['ruleRef']=_0x42f379[_0x4a7b49]['id']||_0x42f379[_0x4a7b49][_0x1126('0x14')]||'index_'+_0x4a7b49;process[_0x1126('0x15')](function(){_0x4e1c97[_0x1126('0xd')](_0x2b2487[_0x1126('0x16')]);_0x2b2487['call'](_0x4be0c6,_0x4d2b38);});}else{process[_0x1126('0x15')](function(){_0x4d2b38['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x154e20=!![];return FnRuleLoop(0x0);},'next':function(_0x56efeb){if(!_0x245cd7&&!_[_0x1126('0x17')](_0x4794a7,_0x4be0c6)){_0x4794a7=_[_0x1126('0x13')](_0x4be0c6);process[_0x1126('0x15')](function(){_0x4d2b38[_0x1126('0x18')]();});}else{process['nextTick'](function(){if(_[_0x1126('0x4')](_0x56efeb)){return FnRuleLoop(_0x4a7b49+0x1);}else{return FnRuleLoop(_0x56efeb);}});}}};if(_0x4a7b49<_0x42f379[_0x1126('0x19')]&&_0x154e20===![]){var _0x48a08d=_0x42f379[_0x4a7b49][_0x1126('0x1a')];_0x48a08d['call'](_0x4be0c6,_0x4d2b38);}else{process['nextTick'](function(){_0x4be0c6['matchPath']=_0x4e1c97;return _0x1af673?_0x1af673(_0x4be0c6):_[_0x1126('0x1b')]();});}}(0x0));};RuleEngine[_0x1126('0x8')][_0x1126('0x1c')]=function(_0x34bcf1){if(_[_0x1126('0x4')](_0x34bcf1)){return this[_0x1126('0xa')];}else{var _0xea0971=_[_0x1126('0x1d')](_0x34bcf1);return _['filter'](this[_0x1126('0xa')],_0xea0971);}};RuleEngine[_0x1126('0x8')][_0x1126('0x1e')]=function(_0x5ddf63,_0x541bc9){var _0xeb7d89=_0x5ddf63==='on'||_0x5ddf63==='ON'?!![]:![];var _0x39bf0e=this['findRules'](_0x541bc9);for(var _0x2fb797=0x0,_0x23d2bc=_0x39bf0e['length'];_0x2fb797<_0x23d2bc;_0x2fb797+=0x1){_0x39bf0e[_0x2fb797]['on']=_0xeb7d89;}this[_0x1126('0xe')]();};RuleEngine['prototype'][_0x1126('0x1f')]=function(_0x4bd50b,_0x771bb8){_0x4bd50b=parseInt(_0x4bd50b,0xa);var _0x583ce6=this[_0x1126('0x1c')](_0x771bb8);for(var _0x5f2611=0x0,_0x5252e0=_0x583ce6['length'];_0x5f2611<_0x5252e0;_0x5f2611+=0x1){_0x583ce6[_0x5f2611][_0x1126('0x20')]=_0x4bd50b;}this[_0x1126('0xe')]();};RuleEngine[_0x1126('0x8')]['toJSON']=function(){var _0x2a3055=this[_0x1126('0xa')];if(_0x2a3055 instanceof Array){_0x2a3055=_0x2a3055['map'](function(_0x3dd50e){_0x3dd50e[_0x1126('0x1a')]=_0x3dd50e[_0x1126('0x1a')][_0x1126('0x21')]();_0x3dd50e['consequence']=_0x3dd50e['consequence'][_0x1126('0x21')]();return _0x3dd50e;});}else if(!_[_0x1126('0x4')](_0x2a3055)){_0x2a3055[_0x1126('0x1a')]=_0x2a3055[_0x1126('0x1a')]['toString']();_0x2a3055[_0x1126('0x22')]=_0x2a3055[_0x1126('0x22')][_0x1126('0x21')]();}return _0x2a3055;};RuleEngine[_0x1126('0x8')][_0x1126('0x23')]=function(_0x5df232){this[_0x1126('0x3')]();if(_[_0x1126('0x24')](_0x5df232)){_0x5df232=JSON[_0x1126('0x25')](_0x5df232);}if(_0x5df232 instanceof Array){_0x5df232=_0x5df232[_0x1126('0x26')](function(_0x5c019d){_0x5c019d['condition']=eval('('+_0x5c019d[_0x1126('0x1a')]+')');_0x5c019d[_0x1126('0x22')]=eval('('+_0x5c019d['consequence']+')');return _0x5c019d;});}else if(_0x5df232!==null&&typeof _0x5df232==_0x1126('0x27')){_0x5df232[_0x1126('0x1a')]=eval('('+_0x5df232[_0x1126('0x1a')]+')');_0x5df232['consequence']=eval('('+_0x5df232['consequence']+')');}this[_0x1126('0x5')](_0x5df232);};module[_0x1126('0x28')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 06ab844..5f35dd6 100644 --- a/server/services/routing/mailRpc/index.js +++ b/server/services/routing/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb580=['error','result','catch','sendMailMessage','SendMail','bluebird','client','http','request','then'];(function(_0x169bb3,_0x1b604d){var _0xc18611=function(_0x29a07b){while(--_0x29a07b){_0x169bb3['push'](_0x169bb3['shift']());}};_0xc18611(++_0x1b604d);}(_0xb580,0xf5));var _0x0b58=function(_0xfc74b1,_0x47a0f2){_0xfc74b1=_0xfc74b1-0x0;var _0x3888e7=_0xb580[_0xfc74b1];return _0x3888e7;};'use strict';var BPromise=require(_0x0b58('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x0b58('0x1')][_0x0b58('0x2')]({'port':0x232b});function request(_0x125eec,_0x4e58c1){return new BPromise(function(_0x155c27,_0x3c166a){return client[_0x0b58('0x3')](_0x125eec,_0x4e58c1)[_0x0b58('0x4')](function(_0x52ffcc){if(_0x52ffcc[_0x0b58('0x5')]){return _0x3c166a(_0x52ffcc['error']['message']);}else{return _0x155c27(_0x52ffcc[_0x0b58('0x6')]);}})[_0x0b58('0x7')](function(_0x859d5c){return _0x3c166a(_0x859d5c);});});}exports[_0x0b58('0x8')]=function(_0x5d7548,_0x7e7a9a){return request(_0x0b58('0x9'),{'account':_0x5d7548,'message':_0x7e7a9a});}; \ No newline at end of file +var _0xe579=['sendMailMessage','SendMail','jayson/promise','client','request','then','error','message','result','catch'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0xe579,0x1c4));var _0x9e57=function(_0xad7a34,_0x522fa2){_0xad7a34=_0xad7a34-0x0;var _0x33d357=_0xe579[_0xad7a34];return _0x33d357;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x9e57('0x0'));var client=jayson[_0x9e57('0x1')]['http']({'port':0x232b});function request(_0x18efae,_0x221723){return new BPromise(function(_0x1a8fd0,_0xf5065){return client[_0x9e57('0x2')](_0x18efae,_0x221723)[_0x9e57('0x3')](function(_0x1e8629){if(_0x1e8629[_0x9e57('0x4')]){return _0xf5065(_0x1e8629[_0x9e57('0x4')][_0x9e57('0x5')]);}else{return _0x1a8fd0(_0x1e8629[_0x9e57('0x6')]);}})[_0x9e57('0x7')](function(_0x4ee440){return _0xf5065(_0x4ee440);});});}exports[_0x9e57('0x8')]=function(_0x315651,_0x1194a3){return request(_0x9e57('0x9'),{'account':_0x315651,'message':_0x1194a3});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 6351f5f..e14cfad 100644 --- a/server/services/routing/model/agent.js +++ b/server/services/routing/model/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe5fc=['smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','working','idle','openchannel','fax','sms','whatsapp','length','Status','StatusTime','toNumber','format','mailStatusTime','openchannelStatusTime','emit','user:save','exports','lodash','md5','ioredis','../../../config/environment','localhost','redis','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0xe5fc,0x109));var _0xce5f=function(_0x31cf16,_0x163296){_0x31cf16=_0x31cf16-0x0;var _0x4b6975=_0xe5fc[_0x31cf16];return _0x4b6975;};'use strict';var _=require(_0xce5f('0x0'));var moment=require('moment');var md5=require(_0xce5f('0x1'));var Redis=require(_0xce5f('0x2'));var config=require(_0xce5f('0x3'));config['redis']=_['defaults'](config['redis'],{'host':_0xce5f('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xce5f('0x5')]));function Agent(_0x36d18c){this['id']=_0x36d18c['id']||0x0;this[_0xce5f('0x6')]=_0x36d18c[_0xce5f('0x6')]||'';this[_0xce5f('0x7')]=_0x36d18c[_0xce5f('0x7')]||!![];this[_0xce5f('0x8')]=_0x36d18c[_0xce5f('0x8')]||![];this['chatPause']=_0x36d18c[_0xce5f('0x9')]||![];this[_0xce5f('0xa')]=_0x36d18c[_0xce5f('0xa')]||![];this[_0xce5f('0xb')]=_0x36d18c[_0xce5f('0xb')]||![];this[_0xce5f('0xc')]=_0x36d18c[_0xce5f('0xc')]||![];this['openchannelPause']=_0x36d18c[_0xce5f('0xd')]||![];this[_0xce5f('0xe')]=_0xce5f('0xf');this[_0xce5f('0x10')]=0x0;this[_0xce5f('0x11')]=_0x36d18c[_0xce5f('0x11')]||0x0;this[_0xce5f('0x12')]=0x0;this[_0xce5f('0x13')]=_0xce5f('0xf');this['mailStatusTime']=0x0;this['mailCapacity']=_0x36d18c['mailCapacity']||0x0;this[_0xce5f('0x14')]=0x0;this[_0xce5f('0x15')]=_0xce5f('0xf');this[_0xce5f('0x16')]=0x0;this['faxCapacity']=_0x36d18c[_0xce5f('0x17')]||0x0;this[_0xce5f('0x18')]=0x0;this[_0xce5f('0x19')]=_0xce5f('0xf');this[_0xce5f('0x1a')]=0x0;this[_0xce5f('0x1b')]=_0x36d18c[_0xce5f('0x1b')]||0x0;this[_0xce5f('0x1c')]=0x0;this[_0xce5f('0x1d')]=_0xce5f('0xf');this[_0xce5f('0x1e')]=0x0;this[_0xce5f('0x1f')]=_0x36d18c[_0xce5f('0x1f')]||0x0;this[_0xce5f('0x20')]=0x0;this[_0xce5f('0x21')]=_0xce5f('0xf');this['openchannelStatusTime']=0x0;this['openchannelCapacity']=_0x36d18c['openchannelCapacity']||0x0;this[_0xce5f('0x22')]=0x0;this[_0xce5f('0x23')]=![];this[_0xce5f('0x24')]=undefined;this[_0xce5f('0x1')]='';this[_0xce5f('0x25')]();}Agent[_0xce5f('0x26')][_0xce5f('0x27')]=function(_0x41586f){if(this[_0x41586f+_0xce5f('0x28')]>0x0){if(this[_0x41586f+'Capacity']>0x0&&this[_0x41586f+_0xce5f('0x28')]>=this[_0x41586f+_0xce5f('0x29')]){return'maxcapacity';}else{return _0xce5f('0x2a');}}else{return _0xce5f('0x2b');}};Agent[_0xce5f('0x26')][_0xce5f('0x25')]=function(){var _0x2bed6d=['mail','chat',_0xce5f('0x2c'),_0xce5f('0x2d'),_0xce5f('0x2e'),_0xce5f('0x2f')];for(var _0x48f715=0x0;_0x48f715<_0x2bed6d[_0xce5f('0x30')];_0x48f715+=0x1){var _0x32cb28=this[_0xce5f('0x27')](_0x2bed6d[_0x48f715]);if(this[_0x2bed6d[_0x48f715]+_0xce5f('0x31')]!==_0x32cb28){this[_0x2bed6d[_0x48f715]+_0xce5f('0x32')]=_[_0xce5f('0x33')](moment()[_0xce5f('0x34')]('x'));}this[_0x2bed6d[_0x48f715]+_0xce5f('0x31')]=_0x32cb28;}var _0x17ee78={'id':this['id'],'name':this[_0xce5f('0x6')],'online':this['online'],'voicePause':this[_0xce5f('0x8')],'chatPause':this[_0xce5f('0x9')],'mailPause':this[_0xce5f('0xa')],'smsPause':this[_0xce5f('0xc')],'faxPause':this[_0xce5f('0xb')],'openchannelPause':this[_0xce5f('0xd')],'chatStatus':this[_0xce5f('0xe')],'chatStatusTime':this[_0xce5f('0x10')],'chatCapacity':this[_0xce5f('0x11')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0xce5f('0x35')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0xce5f('0x14')],'faxStatus':this[_0xce5f('0x15')],'faxStatusTime':this[_0xce5f('0x16')],'faxCapacity':this[_0xce5f('0x17')],'faxCurrentCapacity':this[_0xce5f('0x18')],'smsStatus':this[_0xce5f('0x19')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0xce5f('0x1c')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0xce5f('0x1e')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0xce5f('0x36')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0xce5f('0x23')],'busyQueue':this['busyQueue']};var _0x164dac=md5(JSON['stringify'](_0x17ee78));if(this[_0xce5f('0x1')]!==_0x164dac){this[_0xce5f('0x1')]=_0x164dac;io[_0xce5f('0x37')](_0xce5f('0x38'),_0x17ee78);}};module[_0xce5f('0x39')]=Agent; \ No newline at end of file +var _0xc80e=['chatStatus','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','unknown','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busyQueue','updateRealtime','prototype','CurrentCapacity','maxcapacity','working','idle','chat','openchannel','fax','sms','whatsapp','length','getChannelStatus','Status','StatusTime','toNumber','openchannelStatusTime','busy','stringify','emit','user:save','exports','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xc80e,0x12b));var _0xec80=function(_0xbcb4bf,_0x5296ed){_0xbcb4bf=_0xbcb4bf-0x0;var _0x3932b3=_0xc80e[_0xbcb4bf];return _0x3932b3;};'use strict';var _=require('lodash');var moment=require(_0xec80('0x0'));var md5=require(_0xec80('0x1'));var Redis=require(_0xec80('0x2'));var config=require(_0xec80('0x3'));config[_0xec80('0x4')]=_[_0xec80('0x5')](config[_0xec80('0x4')],{'host':_0xec80('0x6'),'port':0x18eb});var io=require(_0xec80('0x7'))(new Redis(config[_0xec80('0x4')]));function Agent(_0x2e0649){this['id']=_0x2e0649['id']||0x0;this[_0xec80('0x8')]=_0x2e0649[_0xec80('0x8')]||'';this['online']=_0x2e0649[_0xec80('0x9')]||!![];this['voicePause']=_0x2e0649[_0xec80('0xa')]||![];this[_0xec80('0xb')]=_0x2e0649[_0xec80('0xb')]||![];this[_0xec80('0xc')]=_0x2e0649[_0xec80('0xc')]||![];this[_0xec80('0xd')]=_0x2e0649[_0xec80('0xd')]||![];this[_0xec80('0xe')]=_0x2e0649[_0xec80('0xe')]||![];this[_0xec80('0xf')]=_0x2e0649[_0xec80('0xf')]||![];this[_0xec80('0x10')]='unknown';this[_0xec80('0x11')]=0x0;this[_0xec80('0x12')]=_0x2e0649[_0xec80('0x12')]||0x0;this[_0xec80('0x13')]=0x0;this[_0xec80('0x14')]=_0xec80('0x15');this[_0xec80('0x16')]=0x0;this[_0xec80('0x17')]=_0x2e0649['mailCapacity']||0x0;this[_0xec80('0x18')]=0x0;this[_0xec80('0x19')]=_0xec80('0x15');this[_0xec80('0x1a')]=0x0;this['faxCapacity']=_0x2e0649[_0xec80('0x1b')]||0x0;this[_0xec80('0x1c')]=0x0;this[_0xec80('0x1d')]='unknown';this[_0xec80('0x1e')]=0x0;this[_0xec80('0x1f')]=_0x2e0649[_0xec80('0x1f')]||0x0;this[_0xec80('0x20')]=0x0;this[_0xec80('0x21')]=_0xec80('0x15');this[_0xec80('0x22')]=0x0;this[_0xec80('0x23')]=_0x2e0649[_0xec80('0x23')]||0x0;this[_0xec80('0x24')]=0x0;this[_0xec80('0x25')]=_0xec80('0x15');this['openchannelStatusTime']=0x0;this[_0xec80('0x26')]=_0x2e0649[_0xec80('0x26')]||0x0;this[_0xec80('0x27')]=0x0;this['busy']=![];this[_0xec80('0x28')]=undefined;this[_0xec80('0x1')]='';this[_0xec80('0x29')]();}Agent[_0xec80('0x2a')]['getChannelStatus']=function(_0x3e1288){if(this[_0x3e1288+'CurrentCapacity']>0x0){if(this[_0x3e1288+'Capacity']>0x0&&this[_0x3e1288+_0xec80('0x2b')]>=this[_0x3e1288+'Capacity']){return _0xec80('0x2c');}else{return _0xec80('0x2d');}}else{return _0xec80('0x2e');}};Agent[_0xec80('0x2a')]['updateRealtime']=function(){var _0x32b4dc=['mail',_0xec80('0x2f'),_0xec80('0x30'),_0xec80('0x31'),_0xec80('0x32'),_0xec80('0x33')];for(var _0x448c6a=0x0;_0x448c6a<_0x32b4dc[_0xec80('0x34')];_0x448c6a+=0x1){var _0x55adb6=this[_0xec80('0x35')](_0x32b4dc[_0x448c6a]);if(this[_0x32b4dc[_0x448c6a]+_0xec80('0x36')]!==_0x55adb6){this[_0x32b4dc[_0x448c6a]+_0xec80('0x37')]=_[_0xec80('0x38')](moment()['format']('x'));}this[_0x32b4dc[_0x448c6a]+'Status']=_0x55adb6;}var _0x41e614={'id':this['id'],'name':this[_0xec80('0x8')],'online':this[_0xec80('0x9')],'voicePause':this[_0xec80('0xa')],'chatPause':this[_0xec80('0xb')],'mailPause':this[_0xec80('0xc')],'smsPause':this[_0xec80('0xe')],'faxPause':this[_0xec80('0xd')],'openchannelPause':this[_0xec80('0xf')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0xec80('0x11')],'chatCapacity':this[_0xec80('0x12')],'chatCurrentCapacity':this[_0xec80('0x13')],'mailStatus':this[_0xec80('0x14')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0xec80('0x17')],'mailCurrentCapacity':this[_0xec80('0x18')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0xec80('0x1a')],'faxCapacity':this[_0xec80('0x1b')],'faxCurrentCapacity':this[_0xec80('0x1c')],'smsStatus':this[_0xec80('0x1d')],'smsStatusTime':this[_0xec80('0x1e')],'smsCapacity':this[_0xec80('0x1f')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0xec80('0x21')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0xec80('0x24')],'openchannelStatus':this[_0xec80('0x25')],'openchannelStatusTime':this[_0xec80('0x39')],'openchannelCapacity':this[_0xec80('0x26')],'openchannelCurrentCapacity':this[_0xec80('0x27')],'busy':this[_0xec80('0x3a')],'busyQueue':this[_0xec80('0x28')]};var _0x20413f=md5(JSON[_0xec80('0x3b')](_0x41e614));if(this[_0xec80('0x1')]!==_0x20413f){this[_0xec80('0x1')]=_0x20413f;io[_0xec80('0x3c')](_0xec80('0x3d'),_0x41e614);}};module[_0xec80('0x3e')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 49b084a..35c98c6 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 _0xa9b5=['paused','length','online','available','stringify','format','chat:queue:%s','emit','chat_queue:save','lodash','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','map','_rr','prototype','loggedIn'];(function(_0x2f163c,_0x27bd79){var _0x3dd996=function(_0x274ff5){while(--_0x274ff5){_0x2f163c['push'](_0x2f163c['shift']());}};_0x3dd996(++_0x27bd79);}(_0xa9b5,0x9f));var _0x5a9b=function(_0x5e08cc,_0x1ac054){_0x5e08cc=_0x5e08cc-0x0;var _0x5ecfb4=_0xa9b5[_0x5e08cc];return _0x5ecfb4;};'use strict';var _=require(_0x5a9b('0x0'));var md5=require('md5');var util=require(_0x5a9b('0x1'));var Redis=require(_0x5a9b('0x2'));var config=require(_0x5a9b('0x3'));config[_0x5a9b('0x4')]=_[_0x5a9b('0x5')](config[_0x5a9b('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x5a9b('0x6'))(new Redis(config[_0x5a9b('0x4')]));function ChatQueue(_0x359d45){this['id']=_0x359d45['id']||0x0;this[_0x5a9b('0x7')]=_0x359d45[_0x5a9b('0x7')]||'';this[_0x5a9b('0x8')]=_0x359d45[_0x5a9b('0x8')]||0xa;this[_0x5a9b('0x9')]=_0x359d45['strategy']||_0x5a9b('0xa');this[_0x5a9b('0xb')]=_0x359d45[_0x5a9b('0xb')];this[_0x5a9b('0xc')]={};this[_0x5a9b('0xd')]=0x0;this[_0x5a9b('0xe')]='';this[_0x5a9b('0xf')]();this[_0x5a9b('0x10')]();}ChatQueue['prototype'][_0x5a9b('0xf')]=function(){var _0x55f68f=this['mapAgentsId']['_rr'];this['mapAgentsId']=_[_0x5a9b('0x11')](this['Agents'],'id');this[_0x5a9b('0xc')][_0x5a9b('0x12')]=_0x55f68f;};ChatQueue[_0x5a9b('0x13')][_0x5a9b('0x10')]=function(){this[_0x5a9b('0x14')]=0x0;this[_0x5a9b('0x15')]=0x0;for(var _0x19710d=0x0;_0x19710d=0x0?this['available']:0x0;var _0x145b4d={'id':this['id'],'available':this[_0x5a9b('0x18')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0x5a9b('0xd')]};var _0x58886f=md5(JSON[_0x5a9b('0x19')](_0x145b4d));if(this[_0x5a9b('0xe')]!==_0x58886f){this[_0x5a9b('0xe')]=_0x58886f;io['to'](util[_0x5a9b('0x1a')](_0x5a9b('0x1b'),_0x145b4d[_0x5a9b('0x7')]))[_0x5a9b('0x1c')](_0x5a9b('0x1d'),_0x145b4d);}};module['exports']=ChatQueue; \ No newline at end of file +var _0xd61c=['lodash','md5','ioredis','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','length','online','paused','available','format','chat:queue:%s','chat_queue:save','exports'];(function(_0x2cb7c7,_0x376fb9){var _0x35f193=function(_0x26ddc5){while(--_0x26ddc5){_0x2cb7c7['push'](_0x2cb7c7['shift']());}};_0x35f193(++_0x376fb9);}(_0xd61c,0x10e));var _0xcd61=function(_0x5b1ce3,_0x2ba865){_0x5b1ce3=_0x5b1ce3-0x0;var _0x55002b=_0xd61c[_0x5b1ce3];return _0x55002b;};'use strict';var _=require(_0xcd61('0x0'));var md5=require(_0xcd61('0x1'));var util=require('util');var Redis=require(_0xcd61('0x2'));var config=require('../../../config/environment');config['redis']=_[_0xcd61('0x3')](config[_0xcd61('0x4')],{'host':_0xcd61('0x5'),'port':0x18eb});var io=require(_0xcd61('0x6'))(new Redis(config['redis']));function ChatQueue(_0x1d8da7){this['id']=_0x1d8da7['id']||0x0;this[_0xcd61('0x7')]=_0x1d8da7[_0xcd61('0x7')]||'';this[_0xcd61('0x8')]=_0x1d8da7[_0xcd61('0x8')]||0xa;this[_0xcd61('0x9')]=_0x1d8da7[_0xcd61('0x9')]||'beepall';this[_0xcd61('0xa')]=_0x1d8da7[_0xcd61('0xa')];this[_0xcd61('0xb')]={};this[_0xcd61('0xc')]=0x0;this[_0xcd61('0x1')]='';this[_0xcd61('0xd')]();this['updateRealtime']();}ChatQueue[_0xcd61('0xe')]['updateRouting']=function(){var _0x1b64c5=this[_0xcd61('0xb')][_0xcd61('0xf')];this[_0xcd61('0xb')]=_[_0xcd61('0x10')](this[_0xcd61('0xa')],'id');this['mapAgentsId'][_0xcd61('0xf')]=_0x1b64c5;};ChatQueue['prototype'][_0xcd61('0x11')]=function(){this[_0xcd61('0x12')]=0x0;this['paused']=0x0;for(var _0x5c1a80=0x0;_0x5c1a80=0x0?this[_0xcd61('0x16')]:0x0;var _0x2630a5={'id':this['id'],'available':this['available'],'loggedIn':this[_0xcd61('0x12')],'name':this[_0xcd61('0x7')],'paused':this[_0xcd61('0x15')],'waiting':this[_0xcd61('0xc')]};var _0x3a6684=md5(JSON['stringify'](_0x2630a5));if(this['md5']!==_0x3a6684){this[_0xcd61('0x1')]=_0x3a6684;io['to'](util[_0xcd61('0x17')](_0xcd61('0x18'),_0x2630a5[_0xcd61('0x7')]))['emit'](_0xcd61('0x19'),_0x2630a5);}};module[_0xcd61('0x1a')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index bf5748b..3169cd9 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 _0x61fc=['updateRealtime','loggedIn','paused','online','available','stringify','format','fax:queue:%s','ioredis','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','waiting','md5','updateRouting','mapAgentsId','map','prototype'];(function(_0x556c57,_0x75b1e7){var _0x28eb05=function(_0x2af766){while(--_0x2af766){_0x556c57['push'](_0x556c57['shift']());}};_0x28eb05(++_0x75b1e7);}(_0x61fc,0x1a6));var _0xc61f=function(_0x31224b,_0x4dfd2f){_0x31224b=_0x31224b-0x0;var _0x5ceb02=_0x61fc[_0x31224b];return _0x5ceb02;};'use strict';var _=require('lodash');var md5=require('md5');var util=require('util');var Redis=require(_0xc61f('0x0'));var config=require('../../../config/environment');config[_0xc61f('0x1')]=_[_0xc61f('0x2')](config['redis'],{'host':_0xc61f('0x3'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function FaxQueue(_0x277c70){this['id']=_0x277c70['id']||0x0;this[_0xc61f('0x4')]=_0x277c70[_0xc61f('0x4')]||'';this[_0xc61f('0x5')]=_0x277c70['timeout']||0xa;this[_0xc61f('0x6')]=_0x277c70[_0xc61f('0x6')]||_0xc61f('0x7');this['Agents']=_0x277c70[_0xc61f('0x8')];this['mapAgentsId']={};this[_0xc61f('0x9')]=0x0;this[_0xc61f('0xa')]='';this[_0xc61f('0xb')]();this['updateRealtime']();}FaxQueue['prototype'][_0xc61f('0xb')]=function(){var _0x4d514d=this['mapAgentsId']['_rr'];this[_0xc61f('0xc')]=_[_0xc61f('0xd')](this[_0xc61f('0x8')],'id');this[_0xc61f('0xc')]['_rr']=_0x4d514d;};FaxQueue[_0xc61f('0xe')][_0xc61f('0xf')]=function(){this[_0xc61f('0x10')]=0x0;this[_0xc61f('0x11')]=0x0;for(var _0x12202c=0x0;_0x12202c=0x0?this[_0xc61f('0x13')]:0x0;var _0x3c6da1={'id':this['id'],'available':this[_0xc61f('0x13')],'loggedIn':this[_0xc61f('0x10')],'name':this[_0xc61f('0x4')],'paused':this[_0xc61f('0x11')],'waiting':this['waiting']};var _0x17dff7=md5(JSON[_0xc61f('0x14')](_0x3c6da1));if(this[_0xc61f('0xa')]!==_0x17dff7){this[_0xc61f('0xa')]=_0x17dff7;io['to'](util[_0xc61f('0x15')](_0xc61f('0x16'),_0x3c6da1['name']))['emit']('fax_queue:save',_0x3c6da1);}};module['exports']=FaxQueue; \ No newline at end of file +var _0x7526=['Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','faxPause','available','name','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','timeout','strategy'];(function(_0x49222f,_0x22b660){var _0x3fcce7=function(_0x235967){while(--_0x235967){_0x49222f['push'](_0x49222f['shift']());}};_0x3fcce7(++_0x22b660);}(_0x7526,0x16f));var _0x6752=function(_0x3fcc95,_0x1ed39c){_0x3fcc95=_0x3fcc95-0x0;var _0x41e712=_0x7526[_0x3fcc95];return _0x41e712;};'use strict';var _=require('lodash');var md5=require(_0x6752('0x0'));var util=require(_0x6752('0x1'));var Redis=require(_0x6752('0x2'));var config=require(_0x6752('0x3'));config['redis']=_[_0x6752('0x4')](config[_0x6752('0x5')],{'host':_0x6752('0x6'),'port':0x18eb});var io=require(_0x6752('0x7'))(new Redis(config[_0x6752('0x5')]));function FaxQueue(_0x35f154){this['id']=_0x35f154['id']||0x0;this['name']=_0x35f154['name']||'';this['timeout']=_0x35f154[_0x6752('0x8')]||0xa;this[_0x6752('0x9')]=_0x35f154[_0x6752('0x9')]||'beepall';this['Agents']=_0x35f154[_0x6752('0xa')];this[_0x6752('0xb')]={};this[_0x6752('0xc')]=0x0;this[_0x6752('0x0')]='';this[_0x6752('0xd')]();this[_0x6752('0xe')]();}FaxQueue[_0x6752('0xf')][_0x6752('0xd')]=function(){var _0x19c1bd=this[_0x6752('0xb')][_0x6752('0x10')];this[_0x6752('0xb')]=_[_0x6752('0x11')](this[_0x6752('0xa')],'id');this[_0x6752('0xb')][_0x6752('0x10')]=_0x19c1bd;};FaxQueue['prototype'][_0x6752('0xe')]=function(){this[_0x6752('0x12')]=0x0;this[_0x6752('0x13')]=0x0;for(var _0x40ec93=0x0;_0x40ec93=0x0?this[_0x6752('0x15')]:0x0;var _0x3ddf9a={'id':this['id'],'available':this[_0x6752('0x15')],'loggedIn':this[_0x6752('0x12')],'name':this[_0x6752('0x16')],'paused':this[_0x6752('0x13')],'waiting':this[_0x6752('0xc')]};var _0x475e19=md5(JSON[_0x6752('0x17')](_0x3ddf9a));if(this['md5']!==_0x475e19){this[_0x6752('0x0')]=_0x475e19;io['to'](util[_0x6752('0x18')](_0x6752('0x19'),_0x3ddf9a[_0x6752('0x16')]))[_0x6752('0x1a')](_0x6752('0x1b'),_0x3ddf9a);}};module[_0x6752('0x1c')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 87f47d9..f68b3d7 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 _0xb2b5=['name','Intervals'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb2b5,0xd0));var _0x5b2b=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xb2b5[_0x1928c9];return _0x51b5fb;};'use strict';function Interval(_0x3bf477){this['id']=_0x3bf477['id']||0x0;this[_0x5b2b('0x0')]=_0x3bf477[_0x5b2b('0x0')]||'';this[_0x5b2b('0x1')]=_0x3bf477[_0x5b2b('0x1')]||{};}module['exports']=Interval; \ No newline at end of file +var _0xa888=['exports','name'];(function(_0x2a9e6f,_0x216211){var _0x1159d1=function(_0x86dcc0){while(--_0x86dcc0){_0x2a9e6f['push'](_0x2a9e6f['shift']());}};_0x1159d1(++_0x216211);}(_0xa888,0x1c3));var _0x8a88=function(_0x116a12,_0xf700c3){_0x116a12=_0x116a12-0x0;var _0x24eb79=_0xa888[_0x116a12];return _0x24eb79;};'use strict';function Interval(_0x27ce4a){this['id']=_0x27ce4a['id']||0x0;this[_0x8a88('0x0')]=_0x27ce4a[_0x8a88('0x0')]||'';this['Intervals']=_0x27ce4a['Intervals']||{};}module[_0x8a88('0x1')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index ce2d060..e26a1f3 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 _0xf472=['mailPause','available','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','md5','util','../../../config/environment','defaults','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','map','loggedIn','paused','length','online'];(function(_0x13157f,_0x44e85f){var _0x38def9=function(_0x1226de){while(--_0x1226de){_0x13157f['push'](_0x13157f['shift']());}};_0x38def9(++_0x44e85f);}(_0xf472,0xcc));var _0x2f47=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xf472[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var md5=require(_0x2f47('0x0'));var util=require(_0x2f47('0x1'));var Redis=require('ioredis');var config=require(_0x2f47('0x2'));config['redis']=_[_0x2f47('0x3')](config[_0x2f47('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x2f47('0x5'))(new Redis(config[_0x2f47('0x4')]));function MailQueue(_0x1b169c){this['id']=_0x1b169c['id']||0x0;this[_0x2f47('0x6')]=_0x1b169c['name']||'';this[_0x2f47('0x7')]=_0x1b169c[_0x2f47('0x7')]||0xa;this[_0x2f47('0x8')]=_0x1b169c[_0x2f47('0x8')]||_0x2f47('0x9');this['Agents']=_0x1b169c[_0x2f47('0xa')];this[_0x2f47('0xb')]={};this['waiting']=0x0;this[_0x2f47('0x0')]='';this[_0x2f47('0xc')]();this[_0x2f47('0xd')]();}MailQueue[_0x2f47('0xe')]['updateRouting']=function(){var _0x27d6d1=this[_0x2f47('0xb')]['_rr'];this[_0x2f47('0xb')]=_[_0x2f47('0xf')](this[_0x2f47('0xa')],'id');this['mapAgentsId']['_rr']=_0x27d6d1;};MailQueue[_0x2f47('0xe')][_0x2f47('0xd')]=function(){this[_0x2f47('0x10')]=0x0;this[_0x2f47('0x11')]=0x0;for(var _0x54bad7=0x0;_0x54bad7=0x0?this['available']:0x0;var _0x2b7544={'id':this['id'],'available':this['available'],'loggedIn':this[_0x2f47('0x10')],'name':this[_0x2f47('0x6')],'paused':this[_0x2f47('0x11')],'waiting':this['waiting']};var _0x1d86ab=md5(JSON[_0x2f47('0x16')](_0x2b7544));if(this[_0x2f47('0x0')]!==_0x1d86ab){this['md5']=_0x1d86ab;io['to'](util[_0x2f47('0x17')](_0x2f47('0x18'),_0x2b7544[_0x2f47('0x6')]))[_0x2f47('0x19')](_0x2f47('0x1a'),_0x2b7544);}};module[_0x2f47('0x1b')]=MailQueue; \ No newline at end of file +var _0x9af6=['../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','mailPause','available','stringify','format','mail:queue:%s','emit','exports','lodash','md5','util','ioredis'];(function(_0x117a89,_0x3254bc){var _0x482496=function(_0x5131fc){while(--_0x5131fc){_0x117a89['push'](_0x117a89['shift']());}};_0x482496(++_0x3254bc);}(_0x9af6,0xb0));var _0x69af=function(_0x55d842,_0xea4a4e){_0x55d842=_0x55d842-0x0;var _0x29d837=_0x9af6[_0x55d842];return _0x29d837;};'use strict';var _=require(_0x69af('0x0'));var md5=require(_0x69af('0x1'));var util=require(_0x69af('0x2'));var Redis=require(_0x69af('0x3'));var config=require(_0x69af('0x4'));config[_0x69af('0x5')]=_[_0x69af('0x6')](config[_0x69af('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x69af('0x7'))(new Redis(config[_0x69af('0x5')]));function MailQueue(_0x360bc7){this['id']=_0x360bc7['id']||0x0;this['name']=_0x360bc7[_0x69af('0x8')]||'';this[_0x69af('0x9')]=_0x360bc7[_0x69af('0x9')]||0xa;this[_0x69af('0xa')]=_0x360bc7[_0x69af('0xa')]||_0x69af('0xb');this[_0x69af('0xc')]=_0x360bc7[_0x69af('0xc')];this[_0x69af('0xd')]={};this[_0x69af('0xe')]=0x0;this[_0x69af('0x1')]='';this[_0x69af('0xf')]();this[_0x69af('0x10')]();}MailQueue['prototype'][_0x69af('0xf')]=function(){var _0x22970c=this[_0x69af('0xd')]['_rr'];this['mapAgentsId']=_[_0x69af('0x11')](this[_0x69af('0xc')],'id');this[_0x69af('0xd')][_0x69af('0x12')]=_0x22970c;};MailQueue[_0x69af('0x13')]['updateRealtime']=function(){this[_0x69af('0x14')]=0x0;this[_0x69af('0x15')]=0x0;for(var _0x8bc69c=0x0;_0x8bc69c=0x0?this[_0x69af('0x18')]:0x0;var _0x36741d={'id':this['id'],'available':this['available'],'loggedIn':this[_0x69af('0x14')],'name':this[_0x69af('0x8')],'paused':this['paused'],'waiting':this[_0x69af('0xe')]};var _0x25f34d=md5(JSON[_0x69af('0x19')](_0x36741d));if(this[_0x69af('0x1')]!==_0x25f34d){this[_0x69af('0x1')]=_0x25f34d;io['to'](util[_0x69af('0x1a')](_0x69af('0x1b'),_0x36741d[_0x69af('0x8')]))[_0x69af('0x1c')]('mail_queue:save',_0x36741d);}};module[_0x69af('0x1d')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 8557a61..c278457 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 _0x814b=['prototype','map','_rr','loggedIn','paused','length','online','openchannelPause','available','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x4bbf17,_0x2ceb34){var _0x1d35b3=function(_0x4199d3){while(--_0x4199d3){_0x4bbf17['push'](_0x4bbf17['shift']());}};_0x1d35b3(++_0x2ceb34);}(_0x814b,0x1a2));var _0xb814=function(_0x30e004,_0x46f8c2){_0x30e004=_0x30e004-0x0;var _0x5ca247=_0x814b[_0x30e004];return _0x5ca247;};'use strict';var _=require(_0xb814('0x0'));var md5=require(_0xb814('0x1'));var util=require(_0xb814('0x2'));var Redis=require(_0xb814('0x3'));var config=require(_0xb814('0x4'));config[_0xb814('0x5')]=_['defaults'](config[_0xb814('0x5')],{'host':_0xb814('0x6'),'port':0x18eb});var io=require(_0xb814('0x7'))(new Redis(config[_0xb814('0x5')]));function OpenchannelQueue(_0x44931c){this['id']=_0x44931c['id']||0x0;this[_0xb814('0x8')]=_0x44931c['name']||'';this[_0xb814('0x9')]=_0x44931c[_0xb814('0x9')]||0xa;this['strategy']=_0x44931c[_0xb814('0xa')]||_0xb814('0xb');this[_0xb814('0xc')]=_0x44931c[_0xb814('0xc')];this[_0xb814('0xd')]={};this[_0xb814('0xe')]=0x0;this[_0xb814('0x1')]='';this[_0xb814('0xf')]();this[_0xb814('0x10')]();}OpenchannelQueue[_0xb814('0x11')][_0xb814('0xf')]=function(){var _0x4b5f14=this[_0xb814('0xd')]['_rr'];this[_0xb814('0xd')]=_[_0xb814('0x12')](this[_0xb814('0xc')],'id');this[_0xb814('0xd')][_0xb814('0x13')]=_0x4b5f14;};OpenchannelQueue[_0xb814('0x11')][_0xb814('0x10')]=function(){this[_0xb814('0x14')]=0x0;this[_0xb814('0x15')]=0x0;for(var _0x2ab627=0x0;_0x2ab627=0x0?this['available']:0x0;var _0x270598={'id':this['id'],'available':this[_0xb814('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb814('0xe')]};var _0x4d5276=md5(JSON['stringify'](_0x270598));if(this[_0xb814('0x1')]!==_0x4d5276){this[_0xb814('0x1')]=_0x4d5276;io['to'](util[_0xb814('0x1a')]('openchannel:queue:%s',_0x270598[_0xb814('0x8')]))['emit'](_0xb814('0x1b'),_0x270598);}};module[_0xb814('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _0x1261=['available','stringify','openchannel:queue:%s','openchannel_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','map','_rr','updateRealtime','loggedIn','paused','length','online'];(function(_0x590851,_0x496bee){var _0x3b0115=function(_0x5140cc){while(--_0x5140cc){_0x590851['push'](_0x590851['shift']());}};_0x3b0115(++_0x496bee);}(_0x1261,0x144));var _0x1126=function(_0x4cd846,_0x4a0f50){_0x4cd846=_0x4cd846-0x0;var _0x2f2a7d=_0x1261[_0x4cd846];return _0x2f2a7d;};'use strict';var _=require('lodash');var md5=require(_0x1126('0x0'));var util=require(_0x1126('0x1'));var Redis=require(_0x1126('0x2'));var config=require(_0x1126('0x3'));config[_0x1126('0x4')]=_[_0x1126('0x5')](config[_0x1126('0x4')],{'host':_0x1126('0x6'),'port':0x18eb});var io=require(_0x1126('0x7'))(new Redis(config[_0x1126('0x4')]));function OpenchannelQueue(_0x5a2189){this['id']=_0x5a2189['id']||0x0;this['name']=_0x5a2189[_0x1126('0x8')]||'';this[_0x1126('0x9')]=_0x5a2189['timeout']||0xa;this[_0x1126('0xa')]=_0x5a2189[_0x1126('0xa')]||_0x1126('0xb');this[_0x1126('0xc')]=_0x5a2189[_0x1126('0xc')];this['mapAgentsId']={};this[_0x1126('0xd')]=0x0;this[_0x1126('0x0')]='';this[_0x1126('0xe')]();this['updateRealtime']();}OpenchannelQueue[_0x1126('0xf')]['updateRouting']=function(){var _0x52ef15=this[_0x1126('0x10')]['_rr'];this[_0x1126('0x10')]=_[_0x1126('0x11')](this[_0x1126('0xc')],'id');this[_0x1126('0x10')][_0x1126('0x12')]=_0x52ef15;};OpenchannelQueue[_0x1126('0xf')][_0x1126('0x13')]=function(){this[_0x1126('0x14')]=0x0;this[_0x1126('0x15')]=0x0;for(var _0x53a8f0=0x0;_0x53a8f0=0x0?this['available']:0x0;var _0x4d2b38={'id':this['id'],'available':this[_0x1126('0x18')],'loggedIn':this[_0x1126('0x14')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x1126('0xd')]};var _0x58b109=md5(JSON[_0x1126('0x19')](_0x4d2b38));if(this[_0x1126('0x0')]!==_0x58b109){this[_0x1126('0x0')]=_0x58b109;io['to'](util['format'](_0x1126('0x1a'),_0x4d2b38['name']))['emit'](_0x1126('0x1b'),_0x4d2b38);}};module[_0x1126('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 2feae3e..584fbd1 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 _0xad36=['localhost','socket.io-emitter','name','timeout','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','online','smsPause','paused','available','format','sms:queue:%s','emit','sms_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults'];(function(_0x5cdb75,_0x30a987){var _0x3f80d7=function(_0xc6a50){while(--_0xc6a50){_0x5cdb75['push'](_0x5cdb75['shift']());}};_0x3f80d7(++_0x30a987);}(_0xad36,0x11c));var _0x6ad3=function(_0x5bcbbc,_0x15c389){_0x5bcbbc=_0x5bcbbc-0x0;var _0x127e2b=_0xad36[_0x5bcbbc];return _0x127e2b;};'use strict';var _=require('lodash');var md5=require(_0x6ad3('0x0'));var util=require(_0x6ad3('0x1'));var Redis=require(_0x6ad3('0x2'));var config=require(_0x6ad3('0x3'));config[_0x6ad3('0x4')]=_[_0x6ad3('0x5')](config[_0x6ad3('0x4')],{'host':_0x6ad3('0x6'),'port':0x18eb});var io=require(_0x6ad3('0x7'))(new Redis(config['redis']));function SmsQueue(_0x2053e8){this['id']=_0x2053e8['id']||0x0;this[_0x6ad3('0x8')]=_0x2053e8[_0x6ad3('0x8')]||'';this[_0x6ad3('0x9')]=_0x2053e8['timeout']||0xa;this['strategy']=_0x2053e8['strategy']||'beepall';this[_0x6ad3('0xa')]=_0x2053e8[_0x6ad3('0xa')];this[_0x6ad3('0xb')]={};this[_0x6ad3('0xc')]=0x0;this[_0x6ad3('0x0')]='';this[_0x6ad3('0xd')]();this[_0x6ad3('0xe')]();}SmsQueue[_0x6ad3('0xf')][_0x6ad3('0xd')]=function(){var _0x4a47d0=this[_0x6ad3('0xb')][_0x6ad3('0x10')];this[_0x6ad3('0xb')]=_[_0x6ad3('0x11')](this[_0x6ad3('0xa')],'id');this[_0x6ad3('0xb')][_0x6ad3('0x10')]=_0x4a47d0;};SmsQueue[_0x6ad3('0xf')]['updateRealtime']=function(){this[_0x6ad3('0x12')]=0x0;this['paused']=0x0;for(var _0x14418f=0x0;_0x14418f=0x0?this['available']:0x0;var _0x358243={'id':this['id'],'available':this['available'],'loggedIn':this[_0x6ad3('0x12')],'name':this[_0x6ad3('0x8')],'paused':this[_0x6ad3('0x16')],'waiting':this[_0x6ad3('0xc')]};var _0x5b20b1=md5(JSON['stringify'](_0x358243));if(this[_0x6ad3('0x0')]!==_0x5b20b1){this[_0x6ad3('0x0')]=_0x5b20b1;io['to'](util[_0x6ad3('0x18')](_0x6ad3('0x19'),_0x358243[_0x6ad3('0x8')]))[_0x6ad3('0x1a')](_0x6ad3('0x1b'),_0x358243);}};module[_0x6ad3('0x1c')]=SmsQueue; \ No newline at end of file +var _0x089f=['available','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','updateRealtime','loggedIn','paused','length','online'];(function(_0x3cfa39,_0x3d922e){var _0x1c7247=function(_0x522eb3){while(--_0x522eb3){_0x3cfa39['push'](_0x3cfa39['shift']());}};_0x1c7247(++_0x3d922e);}(_0x089f,0x1c7));var _0xf089=function(_0x26df4b,_0x396639){_0x26df4b=_0x26df4b-0x0;var _0x58228e=_0x089f[_0x26df4b];return _0x58228e;};'use strict';var _=require('lodash');var md5=require(_0xf089('0x0'));var util=require(_0xf089('0x1'));var Redis=require(_0xf089('0x2'));var config=require(_0xf089('0x3'));config[_0xf089('0x4')]=_['defaults'](config[_0xf089('0x4')],{'host':_0xf089('0x5'),'port':0x18eb});var io=require(_0xf089('0x6'))(new Redis(config['redis']));function SmsQueue(_0x92f133){this['id']=_0x92f133['id']||0x0;this[_0xf089('0x7')]=_0x92f133[_0xf089('0x7')]||'';this['timeout']=_0x92f133[_0xf089('0x8')]||0xa;this[_0xf089('0x9')]=_0x92f133[_0xf089('0x9')]||'beepall';this[_0xf089('0xa')]=_0x92f133[_0xf089('0xa')];this[_0xf089('0xb')]={};this[_0xf089('0xc')]=0x0;this[_0xf089('0x0')]='';this[_0xf089('0xd')]();this['updateRealtime']();}SmsQueue[_0xf089('0xe')][_0xf089('0xd')]=function(){var _0x292556=this['mapAgentsId'][_0xf089('0xf')];this[_0xf089('0xb')]=_['map'](this['Agents'],'id');this[_0xf089('0xb')][_0xf089('0xf')]=_0x292556;};SmsQueue['prototype'][_0xf089('0x10')]=function(){this[_0xf089('0x11')]=0x0;this[_0xf089('0x12')]=0x0;for(var _0x337673=0x0;_0x337673=0x0?this[_0xf089('0x15')]:0x0;var _0x4e714a={'id':this['id'],'available':this[_0xf089('0x15')],'loggedIn':this[_0xf089('0x11')],'name':this['name'],'paused':this[_0xf089('0x12')],'waiting':this[_0xf089('0xc')]};var _0x5eadfe=md5(JSON[_0xf089('0x16')](_0x4e714a));if(this[_0xf089('0x0')]!==_0x5eadfe){this[_0xf089('0x0')]=_0x5eadfe;io['to'](util[_0xf089('0x17')](_0xf089('0x18'),_0x4e714a[_0xf089('0x7')]))[_0xf089('0x19')](_0xf089('0x1a'),_0x4e714a);}};module[_0xf089('0x1b')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index bd7b532..0c5b962 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 _0x11f5=['updateRouting','map','loggedIn','paused','length','online','available','stringify','format','whatsapp:queue:%s','emit','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRealtime'];(function(_0x5ba3bc,_0x10d04e){var _0x471714=function(_0x5f5030){while(--_0x5f5030){_0x5ba3bc['push'](_0x5ba3bc['shift']());}};_0x471714(++_0x10d04e);}(_0x11f5,0xae));var _0x511f=function(_0x5c3ea6,_0xd7159d){_0x5c3ea6=_0x5c3ea6-0x0;var _0x42f486=_0x11f5[_0x5c3ea6];return _0x42f486;};'use strict';var _=require(_0x511f('0x0'));var md5=require(_0x511f('0x1'));var util=require(_0x511f('0x2'));var Redis=require(_0x511f('0x3'));var config=require(_0x511f('0x4'));config[_0x511f('0x5')]=_[_0x511f('0x6')](config[_0x511f('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x511f('0x7'))(new Redis(config[_0x511f('0x5')]));function WhatsappQueue(_0x2af2f5){this['id']=_0x2af2f5['id']||0x0;this[_0x511f('0x8')]=_0x2af2f5[_0x511f('0x8')]||'';this[_0x511f('0x9')]=_0x2af2f5['timeout']||0xa;this[_0x511f('0xa')]=_0x2af2f5[_0x511f('0xa')]||'beepall';this[_0x511f('0xb')]=_0x2af2f5[_0x511f('0xb')];this[_0x511f('0xc')]={};this[_0x511f('0xd')]=0x0;this[_0x511f('0x1')]='';this['updateRouting']();this[_0x511f('0xe')]();}WhatsappQueue['prototype'][_0x511f('0xf')]=function(){var _0x569390=this[_0x511f('0xc')]['_rr'];this['mapAgentsId']=_[_0x511f('0x10')](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x569390;};WhatsappQueue['prototype'][_0x511f('0xe')]=function(){this[_0x511f('0x11')]=0x0;this[_0x511f('0x12')]=0x0;for(var _0x1b4b8b=0x0;_0x1b4b8b=0x0?this[_0x511f('0x15')]:0x0;var _0x3129a5={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x511f('0x8')],'paused':this[_0x511f('0x12')],'waiting':this[_0x511f('0xd')]};var _0x2ae262=md5(JSON[_0x511f('0x16')](_0x3129a5));if(this['md5']!==_0x2ae262){this['md5']=_0x2ae262;io['to'](util[_0x511f('0x17')](_0x511f('0x18'),_0x3129a5[_0x511f('0x8')]))[_0x511f('0x19')]('whatsapp_queue:save',_0x3129a5);}};module[_0x511f('0x1a')]=WhatsappQueue; \ No newline at end of file +var _0xdd78=['beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','paused','length','online','loggedIn','whatsappPause','available','waiting','stringify','format','whatsapp:queue:%s','emit','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy'];(function(_0x1d855c,_0x18e088){var _0x3fcac9=function(_0x291e74){while(--_0x291e74){_0x1d855c['push'](_0x1d855c['shift']());}};_0x3fcac9(++_0x18e088);}(_0xdd78,0xc1));var _0x8dd7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd78[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8dd7('0x0'));var md5=require(_0x8dd7('0x1'));var util=require('util');var Redis=require(_0x8dd7('0x2'));var config=require(_0x8dd7('0x3'));config[_0x8dd7('0x4')]=_[_0x8dd7('0x5')](config[_0x8dd7('0x4')],{'host':_0x8dd7('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8dd7('0x4')]));function WhatsappQueue(_0x273681){this['id']=_0x273681['id']||0x0;this[_0x8dd7('0x7')]=_0x273681[_0x8dd7('0x7')]||'';this[_0x8dd7('0x8')]=_0x273681[_0x8dd7('0x8')]||0xa;this[_0x8dd7('0x9')]=_0x273681['strategy']||_0x8dd7('0xa');this[_0x8dd7('0xb')]=_0x273681[_0x8dd7('0xb')];this[_0x8dd7('0xc')]={};this['waiting']=0x0;this[_0x8dd7('0x1')]='';this[_0x8dd7('0xd')]();this[_0x8dd7('0xe')]();}WhatsappQueue[_0x8dd7('0xf')][_0x8dd7('0xd')]=function(){var _0x6f3028=this['mapAgentsId'][_0x8dd7('0x10')];this[_0x8dd7('0xc')]=_[_0x8dd7('0x11')](this[_0x8dd7('0xb')],'id');this[_0x8dd7('0xc')][_0x8dd7('0x10')]=_0x6f3028;};WhatsappQueue[_0x8dd7('0xf')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x8dd7('0x12')]=0x0;for(var _0x5e02a0=0x0;_0x5e02a0=0x0?this[_0x8dd7('0x17')]:0x0;var _0x1cb2bf={'id':this['id'],'available':this[_0x8dd7('0x17')],'loggedIn':this[_0x8dd7('0x15')],'name':this[_0x8dd7('0x7')],'paused':this[_0x8dd7('0x12')],'waiting':this[_0x8dd7('0x18')]};var _0x12b7a2=md5(JSON[_0x8dd7('0x19')](_0x1cb2bf));if(this[_0x8dd7('0x1')]!==_0x12b7a2){this[_0x8dd7('0x1')]=_0x12b7a2;io['to'](util[_0x8dd7('0x1a')](_0x8dd7('0x1b'),_0x1cb2bf[_0x8dd7('0x7')]))[_0x8dd7('0x1c')]('whatsapp_queue:save',_0x1cb2bf);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index bc9f7ad..b30bba4 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x4c74e0,_0x29a949){var _0x41a4da=function(_0x34bd4c){while(--_0x34bd4c){_0x4c74e0['push'](_0x4c74e0['shift']());}};_0x41a4da(++_0x29a949);}(_0xb10b,0x12a));var _0xbb10=function(_0x27ebc2,_0x5a63d3){_0x27ebc2=_0x27ebc2-0x0;var _0x5aba33=_0xb10b[_0x27ebc2];return _0x5aba33;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 4fcbc84..d8c3b2f 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 _0xe50f=['Request','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','update'];(function(_0x498e22,_0x205f2f){var _0x308d3f=function(_0x20d6f5){while(--_0x20d6f5){_0x498e22['push'](_0x498e22['shift']());}};_0x308d3f(++_0x205f2f);}(_0xe50f,0xd1));var _0xfe50=function(_0x34bd04,_0x29bd83){_0x34bd04=_0x34bd04-0x0;var _0x4a6d7a=_0xe50f[_0x34bd04];return _0x4a6d7a;};'use strict';var client=require('../client');exports[_0xfe50('0x0')]=function(_0x350f8b,_0x3ed4c4){return client[_0xfe50('0x1')]('UpdateChatInteraction',{'body':_0x3ed4c4,'options':{'where':{'id':_0x350f8b}},'log':'updateChatInteraction'});};exports[_0xfe50('0x2')]=function(_0x448cc1,_0x4175d0){return client[_0xfe50('0x1')](_0xfe50('0x3'),{'body':_0x4175d0,'options':{'where':{'id':_0x448cc1}},'log':_0xfe50('0x4')});}; \ No newline at end of file +var _0xd3a3=['addTagsToChatInteraction','../client','Request','UpdateChatInteraction','AddTagsToChatInteraction'];(function(_0x6f7c64,_0x4a8555){var _0x16753a=function(_0xbb964c){while(--_0xbb964c){_0x6f7c64['push'](_0x6f7c64['shift']());}};_0x16753a(++_0x4a8555);}(_0xd3a3,0x16e));var _0x3d3a=function(_0x3c9481,_0x326b97){_0x3c9481=_0x3c9481-0x0;var _0xdcf12b=_0xd3a3[_0x3c9481];return _0xdcf12b;};'use strict';var client=require(_0x3d3a('0x0'));exports['update']=function(_0x352f0d,_0x1a819b){return client[_0x3d3a('0x1')](_0x3d3a('0x2'),{'body':_0x1a819b,'options':{'where':{'id':_0x352f0d}},'log':'updateChatInteraction'});};exports['addTags']=function(_0x1385ee,_0x2c3d67){return client[_0x3d3a('0x1')](_0x3d3a('0x3'),{'body':_0x2c3d67,'options':{'where':{'id':_0x1385ee}},'log':_0x3d3a('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 371f211..c6e75b5 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 _0x85b1=['create','Request','CreateChatMessage','createChatMessage'];(function(_0x3a0a35,_0x245ff6){var _0x38608a=function(_0x309273){while(--_0x309273){_0x3a0a35['push'](_0x3a0a35['shift']());}};_0x38608a(++_0x245ff6);}(_0x85b1,0x1c4));var _0x185b=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0x85b1[_0x38537f];return _0x141e23;};'use strict';var client=require('../client');exports[_0x185b('0x0')]=function(_0x121625){return client[_0x185b('0x1')](_0x185b('0x2'),{'body':_0x121625,'log':_0x185b('0x3')});}; \ No newline at end of file +var _0x40b2=['Request','CreateChatMessage','createChatMessage','create'];(function(_0x19a49f,_0x444d74){var _0x5351ae=function(_0x58b1ed){while(--_0x58b1ed){_0x19a49f['push'](_0x19a49f['shift']());}};_0x5351ae(++_0x444d74);}(_0x40b2,0xf3));var _0x240b=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x40b2[_0xbca1b1];return _0x4e1686;};'use strict';var client=require('../client');exports[_0x240b('0x0')]=function(_0x26a8d3){return client[_0x240b('0x1')](_0x240b('0x2'),{'body':_0x26a8d3,'log':_0x240b('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index a96001a..6a3a8dd 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 _0x573a=['timeout','strategy','User','chatPause','../client','getChatQueues','GetChatQueue','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x573a,0x124));var _0xa573=function(_0x4a6cf8,_0x5534ef){_0x4a6cf8=_0x4a6cf8-0x0;var _0x22205e=_0x573a[_0x4a6cf8];return _0x22205e;};'use strict';var client=require(_0xa573('0x0'));exports[_0xa573('0x1')]=function(){return function(){return client['Request'](_0xa573('0x2'),{'options':{'raw':![],'attributes':['id',_0xa573('0x3'),_0xa573('0x4'),_0xa573('0x5')],'include':[{'model':_0xa573('0x6'),'as':'Agents','attributes':['id',_0xa573('0x3'),'online',_0xa573('0x7')]}]},'log':_0xa573('0x1')});};}; \ No newline at end of file +var _0xc6ab=['GetChatQueue','name','User','Agents','online','chatPause','../client','getChatQueues','Request'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc6ab,0x96));var _0xbc6a=function(_0x36549b,_0x4c00c6){_0x36549b=_0x36549b-0x0;var _0x2473a8=_0xc6ab[_0x36549b];return _0x2473a8;};'use strict';var client=require(_0xbc6a('0x0'));exports[_0xbc6a('0x1')]=function(){return function(){return client[_0xbc6a('0x2')](_0xbc6a('0x3'),{'options':{'raw':![],'attributes':['id',_0xbc6a('0x4'),'timeout','strategy'],'include':[{'model':_0xbc6a('0x5'),'as':_0xbc6a('0x6'),'attributes':['id',_0xbc6a('0x4'),_0xbc6a('0x7'),_0xbc6a('0x8')]}]},'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 f7be2e3..1f11499 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 _0x7dc2=['DESC','Request','CreateChatQueueReport','UpdateChatQueueReport'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x7dc2,0x19d));var _0x27dc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7dc2[_0x20a584];return _0x4b41a8;};'use strict';var client=require('../client');exports['create']=function(_0xf99173){return client[_0x27dc('0x0')](_0x27dc('0x1'),{'body':_0xf99173,'log':_0x27dc('0x1')});};exports['update']=function(_0x15d70c,_0x29ba23){return client['Request'](_0x27dc('0x2'),{'body':_0x29ba23,'options':{'where':{'uniqueid':_0x15d70c},'order':[['id',_0x27dc('0x3')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0xe13e=['UpdateChatQueueReport','DESC','Request','CreateChatQueueReport','update'];(function(_0xda89b1,_0x38d580){var _0x250a7f=function(_0x1eab0a){while(--_0x1eab0a){_0xda89b1['push'](_0xda89b1['shift']());}};_0x250a7f(++_0x38d580);}(_0xe13e,0xde));var _0xee13=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe13e[_0x321bb2];return _0x9c12ed;};'use strict';var client=require('../client');exports['create']=function(_0x4df8d5){return client[_0xee13('0x0')](_0xee13('0x1'),{'body':_0x4df8d5,'log':_0xee13('0x1')});};exports[_0xee13('0x2')]=function(_0x2513f3,_0x7a275f){return client[_0xee13('0x0')](_0xee13('0x3'),{'body':_0x7a275f,'options':{'where':{'uniqueid':_0x2513f3},'order':[['id',_0xee13('0x4')]],'limit':0x1},'log':_0xee13('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 2a6ffcd..51239ce 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x14363e,_0x4f0e0d){var _0x17c56d=function(_0x1c7bac){while(--_0x1c7bac){_0x14363e['push'](_0x14363e['shift']());}};_0x17c56d(++_0x4f0e0d);}(_0x7a54,0x106));var _0x47a5=function(_0x1b5408,_0xb7717d){_0x1b5408=_0x1b5408-0x0;var _0x2eaaaf=_0x7a54[_0x1b5408];return _0x2eaaaf;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x569caa,_0x5174ce){var _0x44cb5a=function(_0x456df4){while(--_0x456df4){_0x569caa['push'](_0x569caa['shift']());}};_0x44cb5a(++_0x5174ce);}(_0x7a54,0x106));var _0x47a5=function(_0x21eb25,_0x53449f){_0x21eb25=_0x21eb25-0x0;var _0x481d67=_0x7a54[_0x21eb25];return _0x481d67;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 0fa1b77..1e32189 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 _0x9368=['Request','CreateFaxMessage','createFaxMessage','../client','create'];(function(_0x22cfc0,_0x2d2e76){var _0x24c57a=function(_0x5293ed){while(--_0x5293ed){_0x22cfc0['push'](_0x22cfc0['shift']());}};_0x24c57a(++_0x2d2e76);}(_0x9368,0x19d));var _0x8936=function(_0x2a56ad,_0x2b94bf){_0x2a56ad=_0x2a56ad-0x0;var _0x425175=_0x9368[_0x2a56ad];return _0x425175;};'use strict';var client=require(_0x8936('0x0'));exports[_0x8936('0x1')]=function(_0x2bc8be){return client[_0x8936('0x2')](_0x8936('0x3'),{'body':_0x2bc8be,'log':_0x8936('0x4')});}; \ No newline at end of file +var _0x7469=['CreateFaxMessage','createFaxMessage','create'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0x7469,0xfb));var _0x9746=function(_0x143c06,_0x265452){_0x143c06=_0x143c06-0x0;var _0x593839=_0x7469[_0x143c06];return _0x593839;};'use strict';var client=require('../client');exports[_0x9746('0x0')]=function(_0xce07b0){return client['Request'](_0x9746('0x1'),{'body':_0xce07b0,'log':_0x9746('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 761a643..6fdd51c 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 _0x0ac1=['Agents','../client','getFaxQueues','Request','GetFaxQueue','name','strategy','User'];(function(_0x4334af,_0x21e066){var _0xec5be0=function(_0x1ee788){while(--_0x1ee788){_0x4334af['push'](_0x4334af['shift']());}};_0xec5be0(++_0x21e066);}(_0x0ac1,0xe9));var _0x10ac=function(_0x189750,_0x33064c){_0x189750=_0x189750-0x0;var _0x4dfa84=_0x0ac1[_0x189750];return _0x4dfa84;};'use strict';var client=require(_0x10ac('0x0'));exports[_0x10ac('0x1')]=function(){return function(){return client[_0x10ac('0x2')](_0x10ac('0x3'),{'options':{'raw':![],'attributes':['id',_0x10ac('0x4'),'timeout',_0x10ac('0x5')],'include':[{'model':_0x10ac('0x6'),'as':_0x10ac('0x7'),'attributes':['id',_0x10ac('0x4'),'online','faxPause']}]},'log':_0x10ac('0x1')});};}; \ No newline at end of file +var _0xbfd4=['GetFaxQueue','name','timeout','strategy','User','Agents','../client','getFaxQueues','Request'];(function(_0x579d59,_0x149541){var _0x30b4b2=function(_0x16cd42){while(--_0x16cd42){_0x579d59['push'](_0x579d59['shift']());}};_0x30b4b2(++_0x149541);}(_0xbfd4,0x15c));var _0x4bfd=function(_0x4f8d8a,_0x5f58bb){_0x4f8d8a=_0x4f8d8a-0x0;var _0x263290=_0xbfd4[_0x4f8d8a];return _0x263290;};'use strict';var client=require(_0x4bfd('0x0'));exports[_0x4bfd('0x1')]=function(){return function(){return client[_0x4bfd('0x2')](_0x4bfd('0x3'),{'options':{'raw':![],'attributes':['id',_0x4bfd('0x4'),_0x4bfd('0x5'),_0x4bfd('0x6')],'include':[{'model':_0x4bfd('0x7'),'as':_0x4bfd('0x8'),'attributes':['id',_0x4bfd('0x4'),'online','faxPause']}]},'log':'getFaxQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 256f1dc..509e4c8 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 _0x0e2e=['DESC','Request','CreateFaxQueueReport','UpdateFaxQueueReport'];(function(_0x4549cd,_0x9b08c){var _0x1efe57=function(_0x5c6a02){while(--_0x5c6a02){_0x4549cd['push'](_0x4549cd['shift']());}};_0x1efe57(++_0x9b08c);}(_0x0e2e,0x135));var _0xe0e2=function(_0x5ce1e0,_0x54922b){_0x5ce1e0=_0x5ce1e0-0x0;var _0xff7bb1=_0x0e2e[_0x5ce1e0];return _0xff7bb1;};'use strict';var client=require('../client');exports['create']=function(_0x4d9ec8){return client[_0xe0e2('0x0')](_0xe0e2('0x1'),{'body':_0x4d9ec8,'log':_0xe0e2('0x1')});};exports['update']=function(_0x4e5ecb,_0x54e0c7){return client[_0xe0e2('0x0')](_0xe0e2('0x2'),{'body':_0x54e0c7,'options':{'where':{'uniqueid':_0x4e5ecb},'order':[['id',_0xe0e2('0x3')]],'limit':0x1},'log':_0xe0e2('0x2')});}; \ No newline at end of file +var _0xed87=['Request','CreateFaxQueueReport','UpdateFaxQueueReport','DESC','../client','create'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0xed87,0xfa));var _0x7ed8=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xed87[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0x7ed8('0x0'));exports[_0x7ed8('0x1')]=function(_0x101cc1){return client[_0x7ed8('0x2')](_0x7ed8('0x3'),{'body':_0x101cc1,'log':_0x7ed8('0x3')});};exports['update']=function(_0x15a279,_0x46df07){return client[_0x7ed8('0x2')](_0x7ed8('0x4'),{'body':_0x46df07,'options':{'where':{'uniqueid':_0x15a279},'order':[['id',_0x7ed8('0x5')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 2a40c36..ad87672 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 _0xdcb2=['interval','../client','getIntervals','Interval','Intervals'];(function(_0x1cf794,_0x4cd3d9){var _0x305614=function(_0x30013f){while(--_0x30013f){_0x1cf794['push'](_0x1cf794['shift']());}};_0x305614(++_0x4cd3d9);}(_0xdcb2,0x196));var _0x2dcb=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xdcb2[_0x6c993a];return _0x27f547;};'use strict';var client=require(_0x2dcb('0x0'));exports[_0x2dcb('0x1')]=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x2dcb('0x2'),'as':_0x2dcb('0x3'),'attributes':['id','name',_0x2dcb('0x4')]}]},'log':_0x2dcb('0x1')});};}; \ No newline at end of file +var _0x6fc1=['Intervals','getIntervals','Request','GetInterval','name','Interval'];(function(_0x5149b0,_0x3b3ecb){var _0x33b3eb=function(_0x26ddc7){while(--_0x26ddc7){_0x5149b0['push'](_0x5149b0['shift']());}};_0x33b3eb(++_0x3b3ecb);}(_0x6fc1,0x1e1));var _0x16fc=function(_0x1cb7c8,_0x3744af){_0x1cb7c8=_0x1cb7c8-0x0;var _0x3cc25c=_0x6fc1[_0x1cb7c8];return _0x3cc25c;};'use strict';var client=require('../client');exports[_0x16fc('0x0')]=function(){return function(){return client[_0x16fc('0x1')](_0x16fc('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x16fc('0x3')],'include':[{'model':_0x16fc('0x4'),'as':_0x16fc('0x5'),'attributes':['id',_0x16fc('0x3'),'interval']}]},'log':_0x16fc('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 59dc60a..b6d6dd7 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 _0x3de3=['../client','UpdateMailInteraction','updateMailInteraction','addTags','Request','AddTagsToMailInteraction'];(function(_0x518c1d,_0x4b218b){var _0x1667fa=function(_0x55cae8){while(--_0x55cae8){_0x518c1d['push'](_0x518c1d['shift']());}};_0x1667fa(++_0x4b218b);}(_0x3de3,0x1ce));var _0x33de=function(_0x52c009,_0x5e4bb3){_0x52c009=_0x52c009-0x0;var _0x259d63=_0x3de3[_0x52c009];return _0x259d63;};'use strict';var client=require(_0x33de('0x0'));exports['update']=function(_0x19d1ba,_0x100783){return client['Request'](_0x33de('0x1'),{'body':_0x100783,'options':{'where':{'id':_0x19d1ba}},'log':_0x33de('0x2')});};exports[_0x33de('0x3')]=function(_0xbdd404,_0x56b413){return client[_0x33de('0x4')](_0x33de('0x5'),{'body':_0x56b413,'options':{'where':{'id':_0xbdd404}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x36ee=['updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','Request','UpdateMailInteraction'];(function(_0x1d3c03,_0x1a47d7){var _0x28a315=function(_0x335d6e){while(--_0x335d6e){_0x1d3c03['push'](_0x1d3c03['shift']());}};_0x28a315(++_0x1a47d7);}(_0x36ee,0xe8));var _0xe36e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x36ee[_0x2dafbe];return _0x58a45a;};'use strict';var client=require('../client');exports['update']=function(_0x34e33c,_0x521ff3){return client[_0xe36e('0x0')](_0xe36e('0x1'),{'body':_0x521ff3,'options':{'where':{'id':_0x34e33c}},'log':_0xe36e('0x2')});};exports[_0xe36e('0x3')]=function(_0x567a84,_0x1118af){return client[_0xe36e('0x0')](_0xe36e('0x4'),{'body':_0x1118af,'options':{'where':{'id':_0x567a84}},'log':_0xe36e('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 56444ae..4303f42 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 _0x96d6=['CreateMailMessage','createMailMessage','../client','create','Request'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x96d6,0x1b0));var _0x696d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x96d6[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0x696d('0x0'));exports[_0x696d('0x1')]=function(_0x55630b){return client[_0x696d('0x2')](_0x696d('0x3'),{'body':_0x55630b,'log':_0x696d('0x4')});}; \ No newline at end of file +var _0x2d63=['../client','create','Request','CreateMailMessage','createMailMessage'];(function(_0xc7ed29,_0x515330){var _0xf8da19=function(_0x1bd99c){while(--_0x1bd99c){_0xc7ed29['push'](_0xc7ed29['shift']());}};_0xf8da19(++_0x515330);}(_0x2d63,0xeb));var _0x32d6=function(_0x20b03b,_0x3e218c){_0x20b03b=_0x20b03b-0x0;var _0x19f53b=_0x2d63[_0x20b03b];return _0x19f53b;};'use strict';var client=require(_0x32d6('0x0'));exports[_0x32d6('0x1')]=function(_0x70e2c1){return client[_0x32d6('0x2')](_0x32d6('0x3'),{'body':_0x70e2c1,'log':_0x32d6('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 175acf1..ba01435 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 _0x810f=['timeout','User','Agents','mailPause','../client','getMailQueues','Request','name'];(function(_0x3a78a0,_0x44985f){var _0x48e917=function(_0x1e428c){while(--_0x1e428c){_0x3a78a0['push'](_0x3a78a0['shift']());}};_0x48e917(++_0x44985f);}(_0x810f,0x114));var _0xf810=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0x810f[_0x2fc012];return _0x2891f9;};'use strict';var client=require(_0xf810('0x0'));exports[_0xf810('0x1')]=function(){return function(){return client[_0xf810('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0xf810('0x3'),_0xf810('0x4'),'strategy'],'include':[{'model':_0xf810('0x5'),'as':_0xf810('0x6'),'attributes':['id',_0xf810('0x3'),'online',_0xf810('0x7')]}]},'log':_0xf810('0x1')});};}; \ No newline at end of file +var _0x1454=['timeout','online','mailPause','getMailQueues','name'];(function(_0x1e03a6,_0xf0349){var _0x295b64=function(_0x1ad0a5){while(--_0x1ad0a5){_0x1e03a6['push'](_0x1e03a6['shift']());}};_0x295b64(++_0xf0349);}(_0x1454,0x17a));var _0x4145=function(_0x1e9475,_0x5ec333){_0x1e9475=_0x1e9475-0x0;var _0x14c4ff=_0x1454[_0x1e9475];return _0x14c4ff;};'use strict';var client=require('../client');exports[_0x4145('0x0')]=function(){return function(){return client['Request']('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x4145('0x1'),_0x4145('0x2'),'strategy'],'include':[{'model':'User','as':'Agents','attributes':['id',_0x4145('0x1'),_0x4145('0x3'),_0x4145('0x4')]}]},'log':_0x4145('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 34d7913..dd02cf8 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 _0xdbb9=['../client','create','Request','CreateMailQueueReport','update','UpdateMailQueueReport'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0xdbb9,0x192));var _0x9dbb=function(_0x4987c1,_0x317168){_0x4987c1=_0x4987c1-0x0;var _0x3cb78b=_0xdbb9[_0x4987c1];return _0x3cb78b;};'use strict';var client=require(_0x9dbb('0x0'));exports[_0x9dbb('0x1')]=function(_0x26eb69){return client[_0x9dbb('0x2')](_0x9dbb('0x3'),{'body':_0x26eb69,'log':_0x9dbb('0x3')});};exports[_0x9dbb('0x4')]=function(_0x52607b,_0x30567a){return client['Request'](_0x9dbb('0x5'),{'body':_0x30567a,'options':{'where':{'uniqueid':_0x52607b},'order':[['id','DESC']],'limit':0x1},'log':_0x9dbb('0x5')});}; \ No newline at end of file +var _0xe754=['DESC','../client','create','Request','CreateMailQueueReport','update','UpdateMailQueueReport'];(function(_0x4a88ef,_0x47b00b){var _0x223767=function(_0x2d1f2b){while(--_0x2d1f2b){_0x4a88ef['push'](_0x4a88ef['shift']());}};_0x223767(++_0x47b00b);}(_0xe754,0x12e));var _0x4e75=function(_0x16129d,_0x5329c5){_0x16129d=_0x16129d-0x0;var _0x34f1c4=_0xe754[_0x16129d];return _0x34f1c4;};'use strict';var client=require(_0x4e75('0x0'));exports[_0x4e75('0x1')]=function(_0x400d1b){return client[_0x4e75('0x2')](_0x4e75('0x3'),{'body':_0x400d1b,'log':_0x4e75('0x3')});};exports[_0x4e75('0x4')]=function(_0x387b16,_0x2addf0){return client[_0x4e75('0x2')](_0x4e75('0x5'),{'body':_0x2addf0,'options':{'where':{'uniqueid':_0x387b16},'order':[['id',_0x4e75('0x6')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 3a0b611..12a4234 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 _0x28ff=['Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','addTagsToChatInteraction','update'];(function(_0x35b45d,_0x4ef323){var _0xc4a81b=function(_0x1dae41){while(--_0x1dae41){_0x35b45d['push'](_0x35b45d['shift']());}};_0xc4a81b(++_0x4ef323);}(_0x28ff,0x77));var _0xf28f=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x28ff[_0x618414];return _0x21c19a;};'use strict';var client=require('../client');exports[_0xf28f('0x0')]=function(_0x418241,_0x5df0c2){return client[_0xf28f('0x1')](_0xf28f('0x2'),{'body':_0x5df0c2,'options':{'where':{'id':_0x418241}},'log':_0xf28f('0x3')});};exports[_0xf28f('0x4')]=function(_0x4d8fd6,_0x2a7f48){return client['Request']('AddTagsToOpenchannelInteraction',{'body':_0x2a7f48,'options':{'where':{'id':_0x4d8fd6}},'log':_0xf28f('0x5')});}; \ No newline at end of file +var _0x6c3d=['Request','AddTagsToOpenchannelInteraction','UpdateOpenchannelInteraction','updateOpenchannelInteraction'];(function(_0x108d5f,_0x33f82d){var _0x456ea3=function(_0x228200){while(--_0x228200){_0x108d5f['push'](_0x108d5f['shift']());}};_0x456ea3(++_0x33f82d);}(_0x6c3d,0xc6));var _0xd6c3=function(_0x14d5f8,_0x3701d3){_0x14d5f8=_0x14d5f8-0x0;var _0x18c78d=_0x6c3d[_0x14d5f8];return _0x18c78d;};'use strict';var client=require('../client');exports['update']=function(_0x58023a,_0x48fe9a){return client['Request'](_0xd6c3('0x0'),{'body':_0x48fe9a,'options':{'where':{'id':_0x58023a}},'log':_0xd6c3('0x1')});};exports['addTags']=function(_0x489ff2,_0x2f2e88){return client[_0xd6c3('0x2')](_0xd6c3('0x3'),{'body':_0x2f2e88,'options':{'where':{'id':_0x489ff2}},'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 bc78da2..076e40e 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 _0xc93c=['createOpenchannelMessage','CreateOpenchannelMessage'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0xc93c,0x1d5));var _0xcc93=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0xc93c[_0x565c49];return _0x20ca34;};'use strict';var client=require('../client');exports['create']=function(_0x2754d9){return client['Request'](_0xcc93('0x0'),{'body':_0x2754d9,'log':_0xcc93('0x1')});}; \ No newline at end of file +var _0xee87=['create','Request','createOpenchannelMessage'];(function(_0x221980,_0x495f1a){var _0x2a7dca=function(_0x29cd25){while(--_0x29cd25){_0x221980['push'](_0x221980['shift']());}};_0x2a7dca(++_0x495f1a);}(_0xee87,0xb1));var _0x7ee8=function(_0x486287,_0xebcdc3){_0x486287=_0x486287-0x0;var _0x24466c=_0xee87[_0x486287];return _0x24466c;};'use strict';var client=require('../client');exports[_0x7ee8('0x0')]=function(_0x2a31eb){return client[_0x7ee8('0x1')]('CreateOpenchannelMessage',{'body':_0x2a31eb,'log':_0x7ee8('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 88ddc13..9a4a06a 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 _0x0b25=['openchannelPause','../client','getOpenchannelQueues','GetOpenchannelQueue','name','timeout','strategy','User','Agents','online'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x0b25,0x10f));var _0x50b2=function(_0x13137e,_0x29c0f3){_0x13137e=_0x13137e-0x0;var _0x346261=_0x0b25[_0x13137e];return _0x346261;};'use strict';var client=require(_0x50b2('0x0'));exports[_0x50b2('0x1')]=function(){return function(){return client['Request'](_0x50b2('0x2'),{'options':{'raw':![],'attributes':['id',_0x50b2('0x3'),_0x50b2('0x4'),_0x50b2('0x5')],'include':[{'model':_0x50b2('0x6'),'as':_0x50b2('0x7'),'attributes':['id',_0x50b2('0x3'),_0x50b2('0x8'),_0x50b2('0x9')]}]},'log':_0x50b2('0x1')});};}; \ No newline at end of file +var _0x3fbd=['openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','User','online'];(function(_0xfd5f37,_0x24a79c){var _0x11bd01=function(_0x4ae9bd){while(--_0x4ae9bd){_0xfd5f37['push'](_0xfd5f37['shift']());}};_0x11bd01(++_0x24a79c);}(_0x3fbd,0x1e9));var _0xd3fb=function(_0x3fdb7d,_0x1ce46d){_0x3fdb7d=_0x3fdb7d-0x0;var _0x5ddcf9=_0x3fbd[_0x3fdb7d];return _0x5ddcf9;};'use strict';var client=require(_0xd3fb('0x0'));exports[_0xd3fb('0x1')]=function(){return function(){return client[_0xd3fb('0x2')](_0xd3fb('0x3'),{'options':{'raw':![],'attributes':['id',_0xd3fb('0x4'),'timeout','strategy'],'include':[{'model':_0xd3fb('0x5'),'as':'Agents','attributes':['id',_0xd3fb('0x4'),_0xd3fb('0x6'),_0xd3fb('0x7')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 11863d0..2b9a931 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 _0xe075=['Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','create'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0xe075,0x143));var _0x5e07=function(_0xe6225c,_0x32a86e){_0xe6225c=_0xe6225c-0x0;var _0x4f7f14=_0xe075[_0xe6225c];return _0x4f7f14;};'use strict';var client=require('../client');exports[_0x5e07('0x0')]=function(_0x1b50ff){return client[_0x5e07('0x1')](_0x5e07('0x2'),{'body':_0x1b50ff,'log':_0x5e07('0x2')});};exports[_0x5e07('0x3')]=function(_0x1c2e03,_0x219b35){return client[_0x5e07('0x1')](_0x5e07('0x4'),{'body':_0x219b35,'options':{'where':{'uniqueid':_0x1c2e03},'order':[['id',_0x5e07('0x5')]],'limit':0x1},'log':_0x5e07('0x4')});}; \ No newline at end of file +var _0x8acc=['CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client','create','Request'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x8acc,0x9e));var _0xc8ac=function(_0x1f89af,_0x3aa904){_0x1f89af=_0x1f89af-0x0;var _0x5b550c=_0x8acc[_0x1f89af];return _0x5b550c;};'use strict';var client=require(_0xc8ac('0x0'));exports[_0xc8ac('0x1')]=function(_0xe08394){return client[_0xc8ac('0x2')](_0xc8ac('0x3'),{'body':_0xe08394,'log':_0xc8ac('0x3')});};exports[_0xc8ac('0x4')]=function(_0x403a5b,_0x302f97){return client[_0xc8ac('0x2')](_0xc8ac('0x5'),{'body':_0x302f97,'options':{'where':{'uniqueid':_0x403a5b},'order':[['id',_0xc8ac('0x6')]],'limit':0x1},'log':_0xc8ac('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index c4deaea..c801f48 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 _0x330c=['../client','update','UpdateSmsInteraction','updateSmsInteraction','addTags','Request'];(function(_0x122075,_0x11b5bd){var _0x3c9e09=function(_0x701fc9){while(--_0x701fc9){_0x122075['push'](_0x122075['shift']());}};_0x3c9e09(++_0x11b5bd);}(_0x330c,0x186));var _0xc330=function(_0x2d83b4,_0x1a39f9){_0x2d83b4=_0x2d83b4-0x0;var _0x335321=_0x330c[_0x2d83b4];return _0x335321;};'use strict';var client=require(_0xc330('0x0'));exports[_0xc330('0x1')]=function(_0x38be68,_0x3fadcd){return client['Request'](_0xc330('0x2'),{'body':_0x3fadcd,'options':{'where':{'id':_0x38be68}},'log':_0xc330('0x3')});};exports[_0xc330('0x4')]=function(_0x207daa,_0x3852b2){return client[_0xc330('0x5')]('AddTagsToSmsInteraction',{'body':_0x3852b2,'options':{'where':{'id':_0x207daa}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0x56a6=['addTagsToSmsInteraction','../client','update','updateSmsInteraction','addTags','Request','AddTagsToSmsInteraction'];(function(_0x2f57b2,_0xa8e91a){var _0x5ace77=function(_0x59c00a){while(--_0x59c00a){_0x2f57b2['push'](_0x2f57b2['shift']());}};_0x5ace77(++_0xa8e91a);}(_0x56a6,0x17b));var _0x656a=function(_0xb6738d,_0x171e77){_0xb6738d=_0xb6738d-0x0;var _0x57c369=_0x56a6[_0xb6738d];return _0x57c369;};'use strict';var client=require(_0x656a('0x0'));exports[_0x656a('0x1')]=function(_0xe679b,_0xaa8734){return client['Request']('UpdateSmsInteraction',{'body':_0xaa8734,'options':{'where':{'id':_0xe679b}},'log':_0x656a('0x2')});};exports[_0x656a('0x3')]=function(_0x67844b,_0x4d764b){return client[_0x656a('0x4')](_0x656a('0x5'),{'body':_0x4d764b,'options':{'where':{'id':_0x67844b}},'log':_0x656a('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 36d33fd..be7d2a2 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 _0xce56=['create','Request','createSmsMessage','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xce56,0x173));var _0x6ce5=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xce56[_0x387777];return _0x3f84c0;};'use strict';var client=require(_0x6ce5('0x0'));exports[_0x6ce5('0x1')]=function(_0x3a50d8){return client[_0x6ce5('0x2')]('CreateSmsMessage',{'body':_0x3a50d8,'log':_0x6ce5('0x3')});}; \ No newline at end of file +var _0xef7e=['CreateSmsMessage','createSmsMessage','../client','create','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xef7e,0x14c));var _0xeef7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xef7e[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0xeef7('0x0'));exports[_0xeef7('0x1')]=function(_0x15fc15){return client[_0xeef7('0x2')](_0xeef7('0x3'),{'body':_0x15fc15,'log':_0xeef7('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index a2773ac..51de49e 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 _0x9c44=['Request','GetSmsQueue','name','timeout','strategy','User','online','getSmsQueues'];(function(_0x1348cc,_0x2508c1){var _0x3a1b9e=function(_0x546282){while(--_0x546282){_0x1348cc['push'](_0x1348cc['shift']());}};_0x3a1b9e(++_0x2508c1);}(_0x9c44,0x178));var _0x49c4=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9c44[_0x2641f9];return _0x585741;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'attributes':['id',_0x49c4('0x2'),_0x49c4('0x3'),_0x49c4('0x4')],'include':[{'model':_0x49c4('0x5'),'as':'Agents','attributes':['id','name',_0x49c4('0x6'),'smsPause']}]},'log':_0x49c4('0x7')});};}; \ No newline at end of file +var _0x70e0=['User','Agents','online','../client','getSmsQueues','Request','timeout','strategy'];(function(_0x3bd52b,_0xbbc735){var _0x1e5b89=function(_0x29ccc3){while(--_0x29ccc3){_0x3bd52b['push'](_0x3bd52b['shift']());}};_0x1e5b89(++_0xbbc735);}(_0x70e0,0x17b));var _0x070e=function(_0x15e5a,_0x30501e){_0x15e5a=_0x15e5a-0x0;var _0x335b2e=_0x70e0[_0x15e5a];return _0x335b2e;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x070e('0x3'),_0x070e('0x4')],'include':[{'model':_0x070e('0x5'),'as':_0x070e('0x6'),'attributes':['id','name',_0x070e('0x7'),'smsPause']}]},'log':_0x070e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 6aba249..8270dd1 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 _0x9c44=['Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0xceaa50,_0x32ef96){var _0x4338e5=function(_0x4140ea){while(--_0x4140ea){_0xceaa50['push'](_0xceaa50['shift']());}};_0x4338e5(++_0x32ef96);}(_0x9c44,0x178));var _0x49c4=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x9c44[_0x5f09c5];return _0x426ad9;};'use strict';var client=require('../client');exports['create']=function(_0x1ffbbf){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'body':_0x1ffbbf,'log':_0x49c4('0x1')});};exports[_0x49c4('0x2')]=function(_0x2ad237,_0x4e0313){return client['Request'](_0x49c4('0x3'),{'body':_0x4e0313,'options':{'where':{'uniqueid':_0x2ad237},'order':[['id','DESC']],'limit':0x1},'log':_0x49c4('0x3')});}; \ No newline at end of file +var _0x3e74=['CreateSmsQueueReport','UpdateSmsQueueReport','DESC','../client','Request'];(function(_0xf43598,_0x499e9c){var _0x3c82d6=function(_0x4b127a){while(--_0x4b127a){_0xf43598['push'](_0xf43598['shift']());}};_0x3c82d6(++_0x499e9c);}(_0x3e74,0x175));var _0x43e7=function(_0x4aa64e,_0x563bd1){_0x4aa64e=_0x4aa64e-0x0;var _0x51ba3f=_0x3e74[_0x4aa64e];return _0x51ba3f;};'use strict';var client=require(_0x43e7('0x0'));exports['create']=function(_0x349480){return client[_0x43e7('0x1')](_0x43e7('0x2'),{'body':_0x349480,'log':'CreateSmsQueueReport'});};exports['update']=function(_0xc58479,_0x4f9bbe){return client[_0x43e7('0x1')](_0x43e7('0x3'),{'body':_0x4f9bbe,'options':{'where':{'uniqueid':_0xc58479},'order':[['id',_0x43e7('0x4')]],'limit':0x1},'log':_0x43e7('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 44b6e2e..ca06599 100644 --- a/server/services/routing/rpc/user.js +++ b/server/services/routing/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x13e3fb,_0x8936ee){var _0xde1dab=function(_0x229686){while(--_0x229686){_0x13e3fb['push'](_0x13e3fb['shift']());}};_0xde1dab(++_0x8936ee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file +var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x3fd305,_0x173da3){var _0x1fb255=function(_0x2195bc){while(--_0x2195bc){_0x3fd305['push'](_0x3fd305['shift']());}};_0x1fb255(++_0x173da3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index 41b9161..3a93dbc 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 _0xbd0a=['Request','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','updateWhatsappInteraction','addTags'];(function(_0x303da0,_0x4ee513){var _0x586aa6=function(_0x11bed6){while(--_0x11bed6){_0x303da0['push'](_0x303da0['shift']());}};_0x586aa6(++_0x4ee513);}(_0xbd0a,0x1b9));var _0xabd0=function(_0x3cc2d7,_0x2512d9){_0x3cc2d7=_0x3cc2d7-0x0;var _0x27e324=_0xbd0a[_0x3cc2d7];return _0x27e324;};'use strict';var client=require(_0xabd0('0x0'));exports['update']=function(_0x3b0fc0,_0x48c569){return client['Request']('UpdateWhatsappInteraction',{'body':_0x48c569,'options':{'where':{'id':_0x3b0fc0}},'log':_0xabd0('0x1')});};exports[_0xabd0('0x2')]=function(_0x41e52b,_0x3d1138){return client[_0xabd0('0x3')](_0xabd0('0x4'),{'body':_0x3d1138,'options':{'where':{'id':_0x41e52b}},'log':_0xabd0('0x5')});}; \ No newline at end of file +var _0xfdbd=['addTags','addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction'];(function(_0x41b9c7,_0x104f8d){var _0x8fa24d=function(_0x3e62bf){while(--_0x3e62bf){_0x41b9c7['push'](_0x41b9c7['shift']());}};_0x8fa24d(++_0x104f8d);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x1a8bbc,_0x17a086){_0x1a8bbc=_0x1a8bbc-0x0;var _0x212fc2=_0xfdbd[_0x1a8bbc];return _0x212fc2;};'use strict';var client=require(_0xdfdb('0x0'));exports[_0xdfdb('0x1')]=function(_0x270b19,_0x47b4ce){return client[_0xdfdb('0x2')](_0xdfdb('0x3'),{'body':_0x47b4ce,'options':{'where':{'id':_0x270b19}},'log':_0xdfdb('0x4')});};exports[_0xdfdb('0x5')]=function(_0x330ad3,_0x5945e0){return client[_0xdfdb('0x2')]('AddTagsToWhatsappInteraction',{'body':_0x5945e0,'options':{'where':{'id':_0x330ad3}},'log':_0xdfdb('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index fa94016..889f39b 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 _0x5270=['../client','create','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x9cdcc4,_0xb56f6a){var _0x3000da=function(_0xae4dd9){while(--_0xae4dd9){_0x9cdcc4['push'](_0x9cdcc4['shift']());}};_0x3000da(++_0xb56f6a);}(_0x5270,0x138));var _0x0527=function(_0x771fef,_0xab570b){_0x771fef=_0x771fef-0x0;var _0x156dd7=_0x5270[_0x771fef];return _0x156dd7;};'use strict';var client=require(_0x0527('0x0'));exports[_0x0527('0x1')]=function(_0x42adc9){return client['Request'](_0x0527('0x2'),{'body':_0x42adc9,'log':_0x0527('0x3')});}; \ No newline at end of file +var _0xcf03=['../client','create','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x212938,_0x530130){var _0x39ab36=function(_0x3089ce){while(--_0x3089ce){_0x212938['push'](_0x212938['shift']());}};_0x39ab36(++_0x530130);}(_0xcf03,0x78));var _0x3cf0=function(_0x3f2000,_0x51b91b){_0x3f2000=_0x3f2000-0x0;var _0x1edae8=_0xcf03[_0x3f2000];return _0x1edae8;};'use strict';var client=require(_0x3cf0('0x0'));exports[_0x3cf0('0x1')]=function(_0x4e2e00){return client['Request'](_0x3cf0('0x2'),{'body':_0x4e2e00,'log':_0x3cf0('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index d9fe5e9..3cd920b 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 _0x958e=['../client','Request','GetWhatsappQueue','name','timeout','strategy','User','Agents'];(function(_0x505151,_0x1dd542){var _0x1cb91a=function(_0x1dc766){while(--_0x1dc766){_0x505151['push'](_0x505151['shift']());}};_0x1cb91a(++_0x1dd542);}(_0x958e,0x1d0));var _0xe958=function(_0x1f47c1,_0x316389){_0x1f47c1=_0x1f47c1-0x0;var _0x2f9a53=_0x958e[_0x1f47c1];return _0x2f9a53;};'use strict';var client=require(_0xe958('0x0'));exports['getWhatsappQueues']=function(){return function(){return client[_0xe958('0x1')](_0xe958('0x2'),{'options':{'raw':![],'attributes':['id',_0xe958('0x3'),_0xe958('0x4'),_0xe958('0x5')],'include':[{'model':_0xe958('0x6'),'as':_0xe958('0x7'),'attributes':['id',_0xe958('0x3'),'online','whatsappPause']}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0xe6d0=['GetWhatsappQueue','name','timeout','strategy','online','whatsappPause','../client','getWhatsappQueues','Request'];(function(_0x2bf13b,_0x4f0eb3){var _0x5c8d71=function(_0x5c1f0b){while(--_0x5c1f0b){_0x2bf13b['push'](_0x2bf13b['shift']());}};_0x5c8d71(++_0x4f0eb3);}(_0xe6d0,0xb1));var _0x0e6d=function(_0x1c5fea,_0x1d9986){_0x1c5fea=_0x1c5fea-0x0;var _0x5aff66=_0xe6d0[_0x1c5fea];return _0x5aff66;};'use strict';var client=require(_0x0e6d('0x0'));exports[_0x0e6d('0x1')]=function(){return function(){return client[_0x0e6d('0x2')](_0x0e6d('0x3'),{'options':{'raw':![],'attributes':['id',_0x0e6d('0x4'),_0x0e6d('0x5'),_0x0e6d('0x6')],'include':[{'model':'User','as':'Agents','attributes':['id','name',_0x0e6d('0x7'),_0x0e6d('0x8')]}]},'log':_0x0e6d('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 2b08b7b..d021682 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 _0x5882=['DESC','../client','Request','CreateWhatsappQueueReport','update'];(function(_0xe8129c,_0x2fb03c){var _0x709fc5=function(_0xb8e0c6){while(--_0xb8e0c6){_0xe8129c['push'](_0xe8129c['shift']());}};_0x709fc5(++_0x2fb03c);}(_0x5882,0x150));var _0x2588=function(_0x4ae10c,_0x21abc1){_0x4ae10c=_0x4ae10c-0x0;var _0x4bf924=_0x5882[_0x4ae10c];return _0x4bf924;};'use strict';var client=require(_0x2588('0x0'));exports['create']=function(_0x5252c3){return client[_0x2588('0x1')](_0x2588('0x2'),{'body':_0x5252c3,'log':_0x2588('0x2')});};exports[_0x2588('0x3')]=function(_0x1267a5,_0x56d9d8){return client[_0x2588('0x1')]('UpdateWhatsappQueueReport',{'body':_0x56d9d8,'options':{'where':{'uniqueid':_0x1267a5},'order':[['id',_0x2588('0x4')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0x34ca=['CreateWhatsappQueueReport','UpdateWhatsappQueueReport','../client','Request'];(function(_0x1597d0,_0x66a5d0){var _0x46f2c9=function(_0x7a40f8){while(--_0x7a40f8){_0x1597d0['push'](_0x1597d0['shift']());}};_0x46f2c9(++_0x66a5d0);}(_0x34ca,0x1a6));var _0xa34c=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x34ca[_0x278e3c];return _0x3e2d9b;};'use strict';var client=require(_0xa34c('0x0'));exports['create']=function(_0x2cef3f){return client[_0xa34c('0x1')](_0xa34c('0x2'),{'body':_0x2cef3f,'log':_0xa34c('0x2')});};exports['update']=function(_0x492279,_0x3fd6ce){return client[_0xa34c('0x1')](_0xa34c('0x3'),{'body':_0x3fd6ce,'options':{'where':{'uniqueid':_0x492279},'order':[['id','DESC']],'limit':0x1},'log':_0xa34c('0x3')});}; \ 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 4ae6e03..fa31686 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 _0x2111=['name','toLowerCase','consequence','length','error','map','message','stop','agents','timeout','atimeout','channel','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','rules','complete','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','format'];(function(_0x2174e1,_0x3f8e6a){var _0x2c0439=function(_0x50dee0){while(--_0x50dee0){_0x2174e1['push'](_0x2174e1['shift']());}};_0x2c0439(++_0x3f8e6a);}(_0x2111,0x11e));var _0x1211=function(_0x67f95e,_0x3ca797){_0x67f95e=_0x67f95e-0x0;var _0x538f5a=_0x2111[_0x67f95e];return _0x538f5a;};'use strict';var schema=require(_0x1211('0x0'));var _=require(_0x1211('0x1'));var util=require(_0x1211('0x2'));var seqqueue=require(_0x1211('0x3'));var logger=require(_0x1211('0x4'))(_0x1211('0x5'));var strategy=require(_0x1211('0x6'));var queue=schema({'name':{'type':'string','required':!![],'message':_0x1211('0x7')},'timeout':{'type':'number','message':_0x1211('0x8')}});function writeLog(_0x2e2f48,_0x357af7,_0x28b70e){return logger[_0x1211('0x9')](util[_0x1211('0xa')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x2e2f48,_0x357af7[_0x1211('0xb')],_0x28b70e));}function handleFindAgent(_0x2f73ea){return function(_0x566786){return _0x566786[_0x1211('0xb')][_0x1211('0xc')]()===_0x2f73ea[_0x1211('0xc')]();};}exports[_0x1211('0xd')]=function(_0x4e6913,_0x323ad7,_0x34ec08,_0x42a6a7){return function(_0x468cd5){try{var _0x2fac6b={'name':_0x323ad7[0x0],'timeout':_0x323ad7[0x1]};var _0x20d8b2=queue['validate'](_0x2fac6b,{'typecast':!![]});if(_0x20d8b2[_0x1211('0xe')]){logger[_0x1211('0xf')]('[%s][AGENT]\x20%s',_0x4e6913,_[_0x1211('0x10')](_0x20d8b2,_0x1211('0x11'))['join'](',\x20'));_0x468cd5[_0x1211('0x12')]();}else{var _0x53b28b=_['find'](_0x34ec08[_0x1211('0x13')],handleFindAgent(_0x2fac6b[_0x1211('0xb')]));if(_0x53b28b){var _0x26e8a9=(_0x2fac6b[_0x1211('0x14')]||0xa)*0x3e8;var _0x1c8fce,_0x425050;var _0x28295b=seqqueue['createQueue'](_0x26e8a9);_0x28295b['id']=_0x4e6913;_0x28295b[_0x1211('0x15')]=_0x26e8a9;_0x28295b[_0x1211('0x16')]=_0x42a6a7['channel'];writeLog(_0x4e6913,_0x53b28b,util['format']('START:%s',_0x26e8a9));_0x34ec08['rules'][_0x4e6913]['on'](_0x1211('0x17'),function(){logger[_0x1211('0x9')](_0x1211('0x18'),_0x4e6913);clearTimeout(_0x425050);_0x425050=undefined;_0x28295b[_0x1211('0x19')]();if(_0x34ec08['rules'][_0x4e6913]){delete _0x34ec08[_0x1211('0x1a')][_0x4e6913];}_0x468cd5[_0x1211('0x12')]();});_0x34ec08['rules'][_0x4e6913]['on'](_0x1211('0x1b'),function(){if(_0x34ec08[_0x1211('0x1a')][_0x4e6913]){delete _0x34ec08[_0x1211('0x1a')][_0x4e6913];}});_0x425050=setTimeout(function(){logger[_0x1211('0x9')]('[%s][AGENT]\x20ROUTING\x20END',_0x4e6913);clearTimeout(_0x425050);_0x28295b[_0x1211('0x19')]();_0x468cd5['next']();},_0x26e8a9);strategy[_0x1211('0x1c')](_0x28295b,_0x53b28b,_0x34ec08,_0x42a6a7);}else{logger['error'](_0x1211('0x1d'),_0x4e6913,_0x2fac6b[_0x1211('0xb')]);_0x468cd5[_0x1211('0x12')]();}}}catch(_0x23a938){console[_0x1211('0x1e')](_0x23a938);logger[_0x1211('0xf')](_0x1211('0x1f'),_0x4e6913,_0x23a938[_0x1211('0x20')]);_0x468cd5[_0x1211('0x12')]();}};}; \ No newline at end of file +var _0x4e29=['agents','createQueue','atimeout','channel','format','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','[%s][AGENT]\x20ROUTING\x20END','next','agent','stop','log','stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','message','join'];(function(_0x2d506b,_0x4c63d6){var _0x93d68a=function(_0x3e6375){while(--_0x3e6375){_0x2d506b['push'](_0x2d506b['shift']());}};_0x93d68a(++_0x4c63d6);}(_0x4e29,0x127));var _0x94e2=function(_0x574617,_0x42eccc){_0x574617=_0x574617-0x0;var _0x29de90=_0x4e29[_0x574617];return _0x29de90;};'use strict';var schema=require(_0x94e2('0x0'));var _=require(_0x94e2('0x1'));var util=require(_0x94e2('0x2'));var seqqueue=require(_0x94e2('0x3'));var logger=require(_0x94e2('0x4'))(_0x94e2('0x5'));var strategy=require(_0x94e2('0x6'));var queue=schema({'name':{'type':'string','required':!![],'message':_0x94e2('0x7')},'timeout':{'type':_0x94e2('0x8'),'message':_0x94e2('0x9')}});function writeLog(_0x550d2a,_0x5abd87,_0x5a23cd){return logger[_0x94e2('0xa')](util['format']('[%s][AGENT][NAME:%s][STATUS:%s]',_0x550d2a,_0x5abd87[_0x94e2('0xb')],_0x5a23cd));}function handleFindAgent(_0x440f09){return function(_0x33a6da){return _0x33a6da['name'][_0x94e2('0xc')]()===_0x440f09[_0x94e2('0xc')]();};}exports[_0x94e2('0xd')]=function(_0x471dfb,_0x59866c,_0x575276,_0x27727c){return function(_0x53dbe8){try{var _0x5efeac={'name':_0x59866c[0x0],'timeout':_0x59866c[0x1]};var _0x5058a8=queue[_0x94e2('0x0')](_0x5efeac,{'typecast':!![]});if(_0x5058a8[_0x94e2('0xe')]){logger[_0x94e2('0xf')](_0x94e2('0x10'),_0x471dfb,_[_0x94e2('0x11')](_0x5058a8,_0x94e2('0x12'))[_0x94e2('0x13')](',\x20'));_0x53dbe8['stop']();}else{var _0x1af092=_['find'](_0x575276[_0x94e2('0x14')],handleFindAgent(_0x5efeac['name']));if(_0x1af092){var _0x3a1241=(_0x5efeac['timeout']||0xa)*0x3e8;var _0x4a0e54,_0x453af8;var _0x1a280=seqqueue[_0x94e2('0x15')](_0x3a1241);_0x1a280['id']=_0x471dfb;_0x1a280[_0x94e2('0x16')]=_0x3a1241;_0x1a280[_0x94e2('0x17')]=_0x27727c[_0x94e2('0x17')];writeLog(_0x471dfb,_0x1af092,util[_0x94e2('0x18')]('START:%s',_0x3a1241));_0x575276[_0x94e2('0x19')][_0x471dfb]['on'](_0x94e2('0x1a'),function(){logger[_0x94e2('0xa')](_0x94e2('0x1b'),_0x471dfb);clearTimeout(_0x453af8);_0x453af8=undefined;_0x1a280[_0x94e2('0x1c')]();if(_0x575276[_0x94e2('0x19')][_0x471dfb]){delete _0x575276[_0x94e2('0x19')][_0x471dfb];}_0x53dbe8['stop']();});_0x575276['rules'][_0x471dfb]['on']('complete',function(){if(_0x575276[_0x94e2('0x19')][_0x471dfb]){delete _0x575276[_0x94e2('0x19')][_0x471dfb];}});_0x453af8=setTimeout(function(){logger['info'](_0x94e2('0x1d'),_0x471dfb);clearTimeout(_0x453af8);_0x1a280[_0x94e2('0x1c')]();_0x53dbe8[_0x94e2('0x1e')]();},_0x3a1241);strategy[_0x94e2('0x1f')](_0x1a280,_0x1af092,_0x575276,_0x27727c);}else{logger[_0x94e2('0xf')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x471dfb,_0x5efeac[_0x94e2('0xb')]);_0x53dbe8[_0x94e2('0x20')]();}}}catch(_0x43fdd5){console[_0x94e2('0x21')](_0x43fdd5);logger['error']('[%s][QUEUE]\x20%s',_0x471dfb,_0x43fdd5[_0x94e2('0x22')]);_0x53dbe8['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index 8be5296..1fb5876 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 _0x8cbc=['Failed','lodash','moment','aws-sdk','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','channel','sms','whatsapp','phone','interaction','ChatWebsiteId','account','upperFirst','AccountId','created','isEmpty','body','getMustacheRender','create','then','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','postText','providerName','amazonlex','providerResponse','Message','dialogState'];(function(_0x315b61,_0x4bb11e){var _0x3521e8=function(_0x5e6389){while(--_0x5e6389){_0x315b61['push'](_0x315b61['shift']());}};_0x3521e8(++_0x4bb11e);}(_0x8cbc,0xf1));var _0xc8cb=function(_0x438922,_0x13057b){_0x438922=_0x438922-0x0;var _0x41b976=_0x8cbc[_0x438922];return _0x41b976;};'use strict';var _=require(_0xc8cb('0x0'));var moment=require(_0xc8cb('0x1'));var AWS=require(_0xc8cb('0x2'));var utils=require('./utils');var logger=require(_0xc8cb('0x3'))(_0xc8cb('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xc8cb('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xc8cb('0x6'))};exports[_0xc8cb('0x7')]=function(_0x102c18,_0x3beb09){return function(_0x56fa9d){try{if(!_[_0xc8cb('0x8')](this['interaction'][_0xc8cb('0x9')])){logger[_0xc8cb('0xa')](_0xc8cb('0xb'),_0x102c18,_0xc8cb('0xc'));return _0x56fa9d[_0xc8cb('0xd')]();}var _0xbd24c1={'ContactId':this[_0xc8cb('0xe')]['id'],'sentAt':moment()['format'](_0xc8cb('0xf')),'direction':'out'};if(this[_0xc8cb('0x10')]===_0xc8cb('0x11')||this['channel']===_0xc8cb('0x12')){_0xbd24c1[_0xc8cb('0x13')]=this[_0xc8cb('0x14')][_0xc8cb('0x13')];}var _0x1d2eed=this[_0xc8cb('0x10')];if(_0x1d2eed==='chat'){_0xbd24c1[_0xc8cb('0x15')]=this[_0xc8cb('0x16')]['id'];}else{_0xbd24c1[_[_0xc8cb('0x17')](_0x1d2eed)+_0xc8cb('0x18')]=this['account']['id'];}_0xbd24c1[_[_0xc8cb('0x17')](_0x1d2eed)+'InteractionId']=this[_0xc8cb('0x14')]['id'];if(this[_0xc8cb('0x14')][_0xc8cb('0x19')]){var _0xc55729=_0x3beb09[0x4];if(!_[_0xc8cb('0x1a')](_0xc55729)){_0xbd24c1[_0xc8cb('0x1b')]=utils[_0xc8cb('0x1c')](_0xc55729,this);return rpc[_0x1d2eed+'Message'][_0xc8cb('0x1d')](_0xbd24c1)[_0xc8cb('0x1e')](function(_0x216f90){logger['info'](_0xc8cb('0xb'),_0x102c18,_0xbd24c1[_0xc8cb('0x1b')]);})[_0xc8cb('0x1f')](function(_0x53a322){logger[_0xc8cb('0x20')](_0xc8cb('0xb'),_0x102c18,JSON[_0xc8cb('0x21')](_0x53a322));})[_0xc8cb('0x22')](function(){logger[_0xc8cb('0xa')](_0xc8cb('0x23'),_0x102c18);_0x56fa9d[_0xc8cb('0x24')]();});}else{logger['info'](_0xc8cb('0x25'),_0x102c18);_0x56fa9d[_0xc8cb('0x24')]();}}else{var _0x2aad54=this;var _0xcb1c1e=new AWS[(_0xc8cb('0x26'))]({'accessKeyId':_0x3beb09[0x0],'secretAccessKey':_0x3beb09[0x1],'region':_0x3beb09[0x2]});var _0x3e5163={'botAlias':_0xc8cb('0x27'),'botName':_0x3beb09[0x3],'inputText':this[_0xc8cb('0x28')][_0xc8cb('0x1b')],'userId':this[_0xc8cb('0x10')]+':'+this['interaction']['id']['toString']()};_0xcb1c1e[_0xc8cb('0x29')](_0x3e5163,function(_0x4ea648,_0x5d7910){if(_0x4ea648){logger['error']('[%s][AMAZONLEX]\x20%s',_0x102c18,_0x4ea648[_0xc8cb('0x28')]);_0x56fa9d['next']();}else if(_0x5d7910&&_0x5d7910[_0xc8cb('0x28')]){_0x2aad54[_0xc8cb('0x1b')]['amazonlex']=_0x5d7910;_0xbd24c1['body']=_0x5d7910['message'];_0xbd24c1[_0xc8cb('0x2a')]=_0xc8cb('0x2b');_0xbd24c1[_0xc8cb('0x2c')]=JSON['stringify'](_0x5d7910);return rpc[_0x1d2eed+_0xc8cb('0x2d')][_0xc8cb('0x1d')](_0xbd24c1)[_0xc8cb('0x1e')](function(_0x562f83){logger[_0xc8cb('0xa')](_0xc8cb('0xb'),_0x102c18,_0xbd24c1[_0xc8cb('0x1b')]);if(_0x5d7910[_0xc8cb('0x2e')]==_0xc8cb('0x2f')){_0x56fa9d[_0xc8cb('0xd')]();}else{_0x56fa9d[_0xc8cb('0x24')]();}})[_0xc8cb('0x1f')](function(_0xeb3e1b){logger['error'](_0xc8cb('0xb'),_0x102c18,JSON[_0xc8cb('0x21')](_0xeb3e1b));_0x56fa9d[_0xc8cb('0xd')]();});}else{_0x56fa9d[_0xc8cb('0xd')]();}});}}catch(_0x5cf9ff){logger['error'](_0xc8cb('0xb'),_0x102c18,JSON[_0xc8cb('0x21')](_0x5cf9ff));_0x56fa9d['stop']();}};}; \ No newline at end of file +var _0x945d=['phone','channel','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','getMustacheRender','Message','create','then','[%s][AMAZONLEX]\x20%s','body','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','$LATEST','message','providerName','providerResponse','dialogState','catch','moment','aws-sdk','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','consequence','interaction','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','whatsapp'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x945d,0x1dd));var _0xd945=function(_0x563e54,_0x276263){_0x563e54=_0x563e54-0x0;var _0x409c80=_0x945d[_0x563e54];return _0x409c80;};'use strict';var _=require('lodash');var moment=require(_0xd945('0x0'));var AWS=require(_0xd945('0x1'));var utils=require('./utils');var logger=require(_0xd945('0x2'))(_0xd945('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xd945('0x4')),'mailMessage':require(_0xd945('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xd945('0x6'))};exports[_0xd945('0x7')]=function(_0x427338,_0x5f1276){return function(_0x4b6d32){try{if(!_['isNil'](this[_0xd945('0x8')]['UserId'])){logger[_0xd945('0x9')]('[%s][AMAZONLEX]\x20%s',_0x427338,_0xd945('0xa'));return _0x4b6d32[_0xd945('0xb')]();}var _0x23c3b0={'ContactId':this[_0xd945('0xc')]['id'],'sentAt':moment()[_0xd945('0xd')](_0xd945('0xe')),'direction':_0xd945('0xf')};if(this['channel']===_0xd945('0x10')||this['channel']===_0xd945('0x11')){_0x23c3b0[_0xd945('0x12')]=this[_0xd945('0x8')][_0xd945('0x12')];}var _0x1b69c9=this[_0xd945('0x13')];if(_0x1b69c9==='chat'){_0x23c3b0[_0xd945('0x14')]=this[_0xd945('0x15')]['id'];}else{_0x23c3b0[_[_0xd945('0x16')](_0x1b69c9)+_0xd945('0x17')]=this[_0xd945('0x15')]['id'];}_0x23c3b0[_[_0xd945('0x16')](_0x1b69c9)+_0xd945('0x18')]=this['interaction']['id'];if(this[_0xd945('0x8')][_0xd945('0x19')]){var _0x66a8f4=_0x5f1276[0x4];if(!_[_0xd945('0x1a')](_0x66a8f4)){_0x23c3b0['body']=utils[_0xd945('0x1b')](_0x66a8f4,this);return rpc[_0x1b69c9+_0xd945('0x1c')][_0xd945('0x1d')](_0x23c3b0)[_0xd945('0x1e')](function(_0x39ab47){logger[_0xd945('0x9')](_0xd945('0x1f'),_0x427338,_0x23c3b0[_0xd945('0x20')]);})['catch'](function(_0x594394){logger[_0xd945('0x21')]('[%s][AMAZONLEX]\x20%s',_0x427338,JSON[_0xd945('0x22')](_0x594394));})[_0xd945('0x23')](function(){logger[_0xd945('0x9')](_0xd945('0x24'),_0x427338);_0x4b6d32[_0xd945('0x25')]();});}else{logger[_0xd945('0x9')](_0xd945('0x26'),_0x427338);_0x4b6d32[_0xd945('0x25')]();}}else{var _0x4f8679=this;var _0x403251=new AWS['LexRuntime']({'accessKeyId':_0x5f1276[0x0],'secretAccessKey':_0x5f1276[0x1],'region':_0x5f1276[0x2]});var _0x32aec6={'botAlias':_0xd945('0x27'),'botName':_0x5f1276[0x3],'inputText':this[_0xd945('0x28')][_0xd945('0x20')],'userId':this[_0xd945('0x13')]+':'+this[_0xd945('0x8')]['id']['toString']()};_0x403251['postText'](_0x32aec6,function(_0x499765,_0x171327){if(_0x499765){logger['error']('[%s][AMAZONLEX]\x20%s',_0x427338,_0x499765[_0xd945('0x28')]);_0x4b6d32['next']();}else if(_0x171327&&_0x171327[_0xd945('0x28')]){_0x4f8679[_0xd945('0x20')]['amazonlex']=_0x171327;_0x23c3b0[_0xd945('0x20')]=_0x171327['message'];_0x23c3b0[_0xd945('0x29')]='amazonlex';_0x23c3b0[_0xd945('0x2a')]=JSON['stringify'](_0x171327);return rpc[_0x1b69c9+_0xd945('0x1c')][_0xd945('0x1d')](_0x23c3b0)[_0xd945('0x1e')](function(_0x432c21){logger[_0xd945('0x9')](_0xd945('0x1f'),_0x427338,_0x23c3b0[_0xd945('0x20')]);if(_0x171327[_0xd945('0x2b')]=='Failed'){_0x4b6d32[_0xd945('0xb')]();}else{_0x4b6d32[_0xd945('0x25')]();}})[_0xd945('0x2c')](function(_0x2d3a53){logger['error'](_0xd945('0x1f'),_0x427338,JSON['stringify'](_0x2d3a53));_0x4b6d32[_0xd945('0xb')]();});}else{_0x4b6d32[_0xd945('0xb')]();}});}}catch(_0x1697a8){logger[_0xd945('0x21')](_0xd945('0x1f'),_0x427338,JSON[_0xd945('0x22')](_0x1697a8));_0x4b6d32[_0xd945('0x25')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index c1b8e5c..d3db731 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 _0xb950=['finally','update','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','info','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','out','getMustacheRender','from','message','phone','subject','startsWith','Re:\x20','ChatWebsiteId','account','upperFirst','InteractionId','Message','Smtp','service','host','port','secure','auth','user','pass','inReplyTo','messageId','html','','replace','','headers','auto-replied','All','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','[RPC][%s][AUTOREPLY]\x20%s','resolve','Interaction','error','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s'];(function(_0x1850f1,_0x2a420b){var _0x572b94=function(_0x85f179){while(--_0x85f179){_0x1850f1['push'](_0x1850f1['shift']());}};_0x572b94(++_0x2a420b);}(_0xb950,0x12f));var _0x0b95=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xb950[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require(_0x0b95('0x0'));var moment=require('moment');var utils=require(_0x0b95('0x1'));var logger=require(_0x0b95('0x2'))(_0x0b95('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x0b95('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x0b95('0x5')),'chatInteraction':require(_0x0b95('0x6')),'openchannelInteraction':require(_0x0b95('0x7')),'mailInteraction':require(_0x0b95('0x8')),'smsInteraction':require(_0x0b95('0x9')),'faxInteraction':require(_0x0b95('0xa')),'whatsappInteraction':require(_0x0b95('0xb'))};var mailRpc=require(_0x0b95('0xc'));exports[_0x0b95('0xd')]=function(_0x1a71b0,_0x5de559,_0x48013e,_0x25498e){return function(_0x4e9d11){try{var _0x310c8c=this[_0x0b95('0xe')];if(_0x310c8c===_0x0b95('0xf')&&_0x25498e[_0x0b95('0x10')]['isAutoreply']){logger['info'](_0x0b95('0x11'),_0x1a71b0,_0x0b95('0x12'));return _0x4e9d11[_0x0b95('0x13')]();}if(_0x5de559[0x0]==='1'&&(_[_0x0b95('0x14')](this[_0x0b95('0x15')][_0x0b95('0x16')])||!this[_0x0b95('0x15')]['created'])){logger['info'](_0x0b95('0x11'),_0x1a71b0,_0x0b95('0x17'));return _0x4e9d11[_0x0b95('0x13')]();}if(_0x5de559[0x0]==='2'&&this[_0x0b95('0x15')][_0x0b95('0x18')]){logger[_0x0b95('0x19')](_0x0b95('0x1a'),_0x1a71b0,_0x0b95('0x1b'));return _0x4e9d11[_0x0b95('0x13')]();}var _0x15bd45={'ContactId':this[_0x0b95('0x1c')]['id'],'sentAt':moment()[_0x0b95('0x1d')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x0b95('0x1e')};if(this[_0x0b95('0xe')]===_0x0b95('0xf')){_0x15bd45[_0x0b95('0x10')]=utils[_0x0b95('0x1f')](_0x5de559[0x2],this);}else{_0x15bd45[_0x0b95('0x10')]=utils['getMustacheRender'](_0x5de559[0x1],this);}if(this['message']){_0x15bd45['to']=this['message'][_0x0b95('0x20')]||'';if(this[_0x0b95('0xe')]===_0x0b95('0xf')&&_0x5de559[0x1]==='1'){_0x15bd45['cc']=this['message']['cc']||'';}_0x15bd45[_0x0b95('0x20')]=this[_0x0b95('0x21')]['to']||'';_0x15bd45[_0x0b95('0x22')]=this['message'][_0x0b95('0x22')]||'';_0x15bd45['read']=!![];if(this['message'][_0x0b95('0x23')]){_0x15bd45['subject']='';_0x15bd45['subject']+=_[_0x0b95('0x24')](this[_0x0b95('0x21')][_0x0b95('0x23')],'Re:')?'':_0x0b95('0x25');_0x15bd45[_0x0b95('0x23')]+=this[_0x0b95('0x21')][_0x0b95('0x23')];}}if(this[_0x0b95('0xe')]==='chat'){_0x15bd45[_0x0b95('0x26')]=this[_0x0b95('0x27')]['id'];}else{_0x15bd45[_[_0x0b95('0x28')](this[_0x0b95('0xe')])+'AccountId']=this[_0x0b95('0x27')]['id'];}_0x15bd45[_[_0x0b95('0x28')](this[_0x0b95('0xe')])+_0x0b95('0x29')]=this[_0x0b95('0x15')]['id'];var _0x46c569=this[_0x0b95('0x15')];if(rpc[this['channel']+_0x0b95('0x2a')]){if(this[_0x0b95('0xe')]===_0x0b95('0xf')){var _0x2ce28b={'tls':{'rejectUnauthorized':![]}};if(this['account'][_0x0b95('0x2b')][_0x0b95('0x2c')]){_0x2ce28b[_0x0b95('0x2c')]=this[_0x0b95('0x27')]['Smtp'][_0x0b95('0x2c')];}else{_0x2ce28b['host']=this[_0x0b95('0x27')][_0x0b95('0x2b')][_0x0b95('0x2d')];_0x2ce28b[_0x0b95('0x2e')]=this[_0x0b95('0x27')]['Smtp'][_0x0b95('0x2e')];_0x2ce28b[_0x0b95('0x2f')]=this[_0x0b95('0x27')][_0x0b95('0x2b')][_0x0b95('0x2f')];}if(this[_0x0b95('0x27')][_0x0b95('0x2b')]['authentication']){_0x2ce28b[_0x0b95('0x30')]={'user':this[_0x0b95('0x27')][_0x0b95('0x2b')][_0x0b95('0x31')],'pass':this[_0x0b95('0x27')][_0x0b95('0x2b')][_0x0b95('0x32')]};}_0x15bd45[_0x0b95('0x33')]=this[_0x0b95('0x21')][_0x0b95('0x34')];_0x15bd45[_0x0b95('0x35')]=_0x0b95('0x36')+_[_0x0b95('0x37')](_0x15bd45[_0x0b95('0x10')],_0x0b95('0x38'),_0x0b95('0x39'))+_0x0b95('0x3a');_0x15bd45[_0x0b95('0x3b')]={'Auto-Submitted':_0x0b95('0x3c'),'X-Auto-Response-Suppress':_0x0b95('0x3d'),'Precedence':'auto_reply'};return mailRpc['sendMailMessage'](_0x2ce28b,_0x15bd45)[_0x0b95('0x3e')](function(_0x48d3e6){logger[_0x0b95('0x19')](_0x0b95('0x3f'),_0x1a71b0);_0x15bd45[_0x0b95('0x34')]=_0x48d3e6[_0x0b95('0x21')]['messageId'];return rpc[_0x310c8c+_0x0b95('0x2a')][_0x0b95('0x40')](_0x15bd45);})[_0x0b95('0x3e')](function(_0x63f0b8){logger[_0x0b95('0x19')](_0x0b95('0x11'),_0x1a71b0,JSON[_0x0b95('0x41')](_0x63f0b8));})[_0x0b95('0x42')](function(_0x1fece8){logger['error'](_0x0b95('0x43'),_0x1a71b0,JSON[_0x0b95('0x41')](_0x1fece8));})['finally'](function(){Promise[_0x0b95('0x44')]()[_0x0b95('0x3e')](function(){if(_0x5de559[0x0]!=='2'||_0x46c569[_0x0b95('0x18')])return;return rpc[_0x310c8c+_0x0b95('0x45')]['update'](_0x46c569['id'],{'autoreplyExecuted':!![]})[_0x0b95('0x3e')](function(_0x308cac){logger['info'](_0x0b95('0x1a'),_0x1a71b0,JSON[_0x0b95('0x41')](_0x308cac));})[_0x0b95('0x42')](function(_0x58a928){logger[_0x0b95('0x46')](_0x0b95('0x47'),_0x1a71b0,JSON[_0x0b95('0x41')](_0x58a928));});})[_0x0b95('0x3e')](function(){_0x4e9d11[_0x0b95('0x13')]();});});}else{return rpc[this['channel']+_0x0b95('0x2a')][_0x0b95('0x40')](_0x15bd45)[_0x0b95('0x3e')](function(_0x2bd6d7){logger[_0x0b95('0x19')]('[%s][AUTOREPLY]\x20%s',_0x1a71b0,_0x15bd45[_0x0b95('0x10')]);})[_0x0b95('0x42')](function(_0x287dc8){logger[_0x0b95('0x46')](_0x0b95('0x11'),_0x1a71b0,JSON[_0x0b95('0x41')](_0x287dc8));})[_0x0b95('0x48')](function(){Promise['resolve']()[_0x0b95('0x3e')](function(){if(_0x5de559[0x0]!=='2'||_0x46c569[_0x0b95('0x18')])return;return rpc[_0x310c8c+_0x0b95('0x45')][_0x0b95('0x49')](_0x46c569['id'],{'autoreplyExecuted':!![]})[_0x0b95('0x3e')](function(_0x1ea7bb){logger[_0x0b95('0x19')](_0x0b95('0x1a'),_0x1a71b0,JSON[_0x0b95('0x41')](_0x1ea7bb));})[_0x0b95('0x42')](function(_0x6a83a){logger[_0x0b95('0x46')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x1a71b0,JSON['stringify'](_0x6a83a));});})['then'](function(){_0x4e9d11['next']();});});}}}catch(_0x33ab62){logger[_0x0b95('0x46')]('[%s][AUTOREPLY]\x20%s',_0x1a71b0,JSON[_0x0b95('0x41')](_0x33ab62));_0x4e9d11[_0x0b95('0x4a')]();}};}; \ No newline at end of file +var _0x3f7c=['YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','body','message','phone','subject','startsWith','Re:','Re:\x20','account','upperFirst','AccountId','InteractionId','Message','service','host','Smtp','port','secure','authentication','auth','pass','inReplyTo','html','','replace','','headers','auto-replied','All','auto_reply','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','create','catch','error','[RPC][%s][AUTOREPLY]\x20%s','stringify','finally','resolve','autoreplyExecuted','Interaction','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','moment','./utils','routing','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','channel','mail','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','isNil','interaction','created','Autoreply\x20already\x20sent','next','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format'];(function(_0x38e651,_0x1a482b){var _0x5669a3=function(_0x121247){while(--_0x121247){_0x38e651['push'](_0x38e651['shift']());}};_0x5669a3(++_0x1a482b);}(_0x3f7c,0x7c));var _0xc3f7=function(_0x3d336e,_0x5f3b34){_0x3d336e=_0x3d336e-0x0;var _0x916e60=_0x3f7c[_0x3d336e];return _0x916e60;};'use strict';var _=require(_0xc3f7('0x0'));var moment=require(_0xc3f7('0x1'));var utils=require(_0xc3f7('0x2'));var logger=require('../../../../config/logger')(_0xc3f7('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xc3f7('0x4')),'smsMessage':require(_0xc3f7('0x5')),'faxMessage':require(_0xc3f7('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require(_0xc3f7('0x7')),'faxInteraction':require(_0xc3f7('0x8')),'whatsappInteraction':require(_0xc3f7('0x9'))};var mailRpc=require(_0xc3f7('0xa'));exports['consequence']=function(_0x1926d1,_0x50e434,_0x2cae32,_0x3eb80a){return function(_0x5b7126){try{var _0x1357de=this[_0xc3f7('0xb')];if(_0x1357de===_0xc3f7('0xc')&&_0x3eb80a['body'][_0xc3f7('0xd')]){logger[_0xc3f7('0xe')](_0xc3f7('0xf'),_0x1926d1,_0xc3f7('0x10'));return _0x5b7126['next']();}if(_0x50e434[0x0]==='1'&&(_[_0xc3f7('0x11')](this[_0xc3f7('0x12')]['created'])||!this[_0xc3f7('0x12')][_0xc3f7('0x13')])){logger[_0xc3f7('0xe')](_0xc3f7('0xf'),_0x1926d1,_0xc3f7('0x14'));return _0x5b7126[_0xc3f7('0x15')]();}if(_0x50e434[0x0]==='2'&&this[_0xc3f7('0x12')]['autoreplyExecuted']){logger[_0xc3f7('0xe')](_0xc3f7('0x16'),_0x1926d1,_0xc3f7('0x17'));return _0x5b7126[_0xc3f7('0x15')]();}var _0x31984e={'ContactId':this[_0xc3f7('0x18')]['id'],'sentAt':moment()[_0xc3f7('0x19')](_0xc3f7('0x1a')),'direction':_0xc3f7('0x1b')};if(this[_0xc3f7('0xb')]===_0xc3f7('0xc')){_0x31984e['body']=utils[_0xc3f7('0x1c')](_0x50e434[0x2],this);}else{_0x31984e[_0xc3f7('0x1d')]=utils['getMustacheRender'](_0x50e434[0x1],this);}if(this[_0xc3f7('0x1e')]){_0x31984e['to']=this['message']['from']||'';if(this[_0xc3f7('0xb')]===_0xc3f7('0xc')&&_0x50e434[0x1]==='1'){_0x31984e['cc']=this['message']['cc']||'';}_0x31984e['from']=this[_0xc3f7('0x1e')]['to']||'';_0x31984e[_0xc3f7('0x1f')]=this[_0xc3f7('0x1e')][_0xc3f7('0x1f')]||'';_0x31984e['read']=!![];if(this[_0xc3f7('0x1e')][_0xc3f7('0x20')]){_0x31984e['subject']='';_0x31984e['subject']+=_[_0xc3f7('0x21')](this['message'][_0xc3f7('0x20')],_0xc3f7('0x22'))?'':_0xc3f7('0x23');_0x31984e[_0xc3f7('0x20')]+=this[_0xc3f7('0x1e')][_0xc3f7('0x20')];}}if(this[_0xc3f7('0xb')]==='chat'){_0x31984e['ChatWebsiteId']=this[_0xc3f7('0x24')]['id'];}else{_0x31984e[_[_0xc3f7('0x25')](this[_0xc3f7('0xb')])+_0xc3f7('0x26')]=this[_0xc3f7('0x24')]['id'];}_0x31984e[_[_0xc3f7('0x25')](this['channel'])+_0xc3f7('0x27')]=this['interaction']['id'];var _0x215723=this[_0xc3f7('0x12')];if(rpc[this[_0xc3f7('0xb')]+_0xc3f7('0x28')]){if(this[_0xc3f7('0xb')]==='mail'){var _0x38dca4={'tls':{'rejectUnauthorized':![]}};if(this['account']['Smtp']['service']){_0x38dca4[_0xc3f7('0x29')]=this['account']['Smtp']['service'];}else{_0x38dca4[_0xc3f7('0x2a')]=this[_0xc3f7('0x24')][_0xc3f7('0x2b')][_0xc3f7('0x2a')];_0x38dca4[_0xc3f7('0x2c')]=this[_0xc3f7('0x24')]['Smtp'][_0xc3f7('0x2c')];_0x38dca4[_0xc3f7('0x2d')]=this[_0xc3f7('0x24')][_0xc3f7('0x2b')][_0xc3f7('0x2d')];}if(this[_0xc3f7('0x24')][_0xc3f7('0x2b')][_0xc3f7('0x2e')]){_0x38dca4[_0xc3f7('0x2f')]={'user':this[_0xc3f7('0x24')][_0xc3f7('0x2b')]['user'],'pass':this[_0xc3f7('0x24')][_0xc3f7('0x2b')][_0xc3f7('0x30')]};}_0x31984e[_0xc3f7('0x31')]=this[_0xc3f7('0x1e')]['messageId'];_0x31984e[_0xc3f7('0x32')]=_0xc3f7('0x33')+_[_0xc3f7('0x34')](_0x31984e[_0xc3f7('0x1d')],_0xc3f7('0x35'),']+(>|$)/g,''),'priorityTrue':_0x481a39[0x1],'priorityFalse':_0x481a39[0x2]};var _0x215572=gotoif[_0x2f65('0x0')](_0x2bd8ba,{'typecast':!![]});if(_0x215572[_0x2f65('0xe')]){logger[_0x2f65('0xf')]('[%s][GOTOIF]\x20%s',_0x3e9225,_[_0x2f65('0x10')](_0x215572,_0x2f65('0x11'))['join'](',\x20'));_0xdac10b[_0x2f65('0x12')]();}else{try{var _0x8ff7fa=eval('('+_0x2bd8ba['condition']+')');var _0x3d023e=_0x8ff7fa?_0x2bd8ba[_0x2f65('0x13')]:_0x2bd8ba['priorityFalse'];logger['info'](_0x2f65('0x14'),_0x3e9225,_0x2bd8ba[_0x2f65('0x15')],_0x8ff7fa,_0x3d023e||'next');if(_0x3d023e){var _0x34e292=_[_0x2f65('0x16')](_0xdac10b[_0x2f65('0x17')](),{'p':_0x3d023e});if(_0x34e292>=0x0){logger['info'](_0x2f65('0x18'),_0x3e9225,_0x3d023e||'next',_0x34e292);_0xdac10b[_0x2f65('0x19')](_0x34e292);}else{logger['info'](_0x2f65('0x1a'),_0x3e9225,_0x3d023e||_0x2f65('0x19'));_0xdac10b[_0x2f65('0x12')]();}}else{_0xdac10b[_0x2f65('0x19')]();}}catch(_0x4f6596){logger[_0x2f65('0xf')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x3e9225,_0x4f6596[_0x2f65('0x11')]);_0xdac10b['stop']();}}}catch(_0x16c4ec){logger['error'](_0x2f65('0x1b'),_0x3e9225,JSON[_0x2f65('0x1c')](_0x16c4ec));_0xdac10b['stop']();}};}; \ No newline at end of file +var _0x4a23=['[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','message','join','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4a23,0x112));var _0x34a2=function(_0x244e3c,_0x1fb86){_0x244e3c=_0x244e3c-0x0;var _0x18efd0=_0x4a23[_0x244e3c];return _0x18efd0;};'use strict';var schema=require(_0x34a2('0x0'));var _=require(_0x34a2('0x1'));var htmlToText=require(_0x34a2('0x2'));var utils=require(_0x34a2('0x3'));var logger=require(_0x34a2('0x4'))(_0x34a2('0x5'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0x34a2('0x6')},'priorityTrue':{'type':_0x34a2('0x7'),'message':_0x34a2('0x8')},'priorityFalse':{'type':_0x34a2('0x7'),'message':'priority\x20false\x20is\x20a\x20number'}});exports['consequence']=function(_0x2bf992,_0x3979ee){return function(_0x5a08e8){try{var _0x346572={'condition':htmlToText[_0x34a2('0x9')](utils[_0x34a2('0xa')](_0x3979ee[0x0],this),{'wordwrap':![]})[_0x34a2('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x3979ee[0x1],'priorityFalse':_0x3979ee[0x2]};var _0x4240fc=gotoif[_0x34a2('0x0')](_0x346572,{'typecast':!![]});if(_0x4240fc[_0x34a2('0xc')]){logger[_0x34a2('0xd')](_0x34a2('0xe'),_0x2bf992,_[_0x34a2('0xf')](_0x4240fc,_0x34a2('0x10'))[_0x34a2('0x11')](',\x20'));_0x5a08e8['stop']();}else{try{var _0x401641=eval('('+_0x346572[_0x34a2('0x12')]+')');var _0x55ea0d=_0x401641?_0x346572[_0x34a2('0x13')]:_0x346572[_0x34a2('0x14')];logger[_0x34a2('0x15')](_0x34a2('0x16'),_0x2bf992,_0x346572[_0x34a2('0x12')],_0x401641,_0x55ea0d||_0x34a2('0x17'));if(_0x55ea0d){var _0x3a892b=_['findIndex'](_0x5a08e8[_0x34a2('0x18')](),{'p':_0x55ea0d});if(_0x3a892b>=0x0){logger[_0x34a2('0x15')](_0x34a2('0x19'),_0x2bf992,_0x55ea0d||_0x34a2('0x17'),_0x3a892b);_0x5a08e8[_0x34a2('0x17')](_0x3a892b);}else{logger['info'](_0x34a2('0x1a'),_0x2bf992,_0x55ea0d||_0x34a2('0x17'));_0x5a08e8[_0x34a2('0x1b')]();}}else{_0x5a08e8[_0x34a2('0x17')]();}}catch(_0x826c24){logger[_0x34a2('0xd')](_0x34a2('0x1c'),_0x2bf992,_0x826c24[_0x34a2('0x10')]);_0x5a08e8['stop']();}}}catch(_0x1ba23f){logger[_0x34a2('0xd')](_0x34a2('0xe'),_0x2bf992,JSON[_0x34a2('0x1d')](_0x1ba23f));_0x5a08e8[_0x34a2('0x1b')]();}};}; \ 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 acd5476..4d76b37 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 _0x2726=['stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20%s','lodash','../../../../config/logger','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','error','map','message'];(function(_0x3911a1,_0x241182){var _0x32ecfe=function(_0x2c31da){while(--_0x2c31da){_0x3911a1['push'](_0x3911a1['shift']());}};_0x32ecfe(++_0x241182);}(_0x2726,0xe6));var _0x6272=function(_0x3e69ae,_0x366e8d){_0x3e69ae=_0x3e69ae-0x0;var _0x3d7f42=_0x2726[_0x3e69ae];return _0x3d7f42;};'use strict';var schema=require('validate');var _=require(_0x6272('0x0'));var logger=require(_0x6272('0x1'))('routing');var gotop=schema({'priority':{'type':_0x6272('0x2'),'required':!![],'message':_0x6272('0x3')}});exports['consequence']=function(_0x54ff3e,_0x368525){return function(_0x1ba901){try{var _0x2846d6={'priority':_0x368525[0x0]};var _0x486801=gotop['validate'](_0x2846d6,{'typecast':!![]});if(_0x486801[_0x6272('0x4')]){logger[_0x6272('0x5')]('[%s][GOTOP]\x20%s',_0x54ff3e,_[_0x6272('0x6')](_0x486801,_0x6272('0x7'))['join'](',\x20'));_0x1ba901[_0x6272('0x8')]();}else{logger[_0x6272('0x9')](_0x6272('0xa'),_0x54ff3e,_0x2846d6['priority']);if(_0x2846d6[_0x6272('0xb')]){var _0x4c645c=_[_0x6272('0xc')](_0x1ba901[_0x6272('0xd')](),{'p':_0x2846d6[_0x6272('0xb')]});if(_0x4c645c>=0x0){logger[_0x6272('0x9')](_0x6272('0xe'),_0x54ff3e,_0x2846d6['priority']||'next',_0x4c645c);_0x1ba901[_0x6272('0xf')](_0x4c645c);}else{logger['info']('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x54ff3e,_0x2846d6[_0x6272('0xb')]||_0x6272('0xf'));_0x1ba901[_0x6272('0x8')]();}}else{_0x1ba901[_0x6272('0xf')]();}}}catch(_0x23cc55){logger[_0x6272('0x5')](_0x6272('0x10'),_0x54ff3e,JSON['stringify'](_0x23cc55));_0x1ba901[_0x6272('0x8')]();}};}; \ No newline at end of file +var _0xba57=['findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','validate','lodash','../../../../config/logger','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','map','message','join','stop','info','priority'];(function(_0xd599da,_0x29aa43){var _0x4bc8db=function(_0x417770){while(--_0x417770){_0xd599da['push'](_0xd599da['shift']());}};_0x4bc8db(++_0x29aa43);}(_0xba57,0x11d));var _0x7ba5=function(_0x3b0b83,_0x50557e){_0x3b0b83=_0x3b0b83-0x0;var _0x33426f=_0xba57[_0x3b0b83];return _0x33426f;};'use strict';var schema=require(_0x7ba5('0x0'));var _=require(_0x7ba5('0x1'));var logger=require(_0x7ba5('0x2'))(_0x7ba5('0x3'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x7ba5('0x4')}});exports[_0x7ba5('0x5')]=function(_0x5186d4,_0x14d5c3){return function(_0x3c9421){try{var _0x56cc35={'priority':_0x14d5c3[0x0]};var _0x528d77=gotop[_0x7ba5('0x0')](_0x56cc35,{'typecast':!![]});if(_0x528d77[_0x7ba5('0x6')]){logger[_0x7ba5('0x7')](_0x7ba5('0x8'),_0x5186d4,_[_0x7ba5('0x9')](_0x528d77,_0x7ba5('0xa'))[_0x7ba5('0xb')](',\x20'));_0x3c9421[_0x7ba5('0xc')]();}else{logger[_0x7ba5('0xd')]('[%s][GOTOP]\x20priority\x20%s',_0x5186d4,_0x56cc35[_0x7ba5('0xe')]);if(_0x56cc35[_0x7ba5('0xe')]){var _0x1d29d7=_[_0x7ba5('0xf')](_0x3c9421[_0x7ba5('0x10')](),{'p':_0x56cc35[_0x7ba5('0xe')]});if(_0x1d29d7>=0x0){logger[_0x7ba5('0xd')](_0x7ba5('0x11'),_0x5186d4,_0x56cc35[_0x7ba5('0xe')]||_0x7ba5('0x12'),_0x1d29d7);_0x3c9421['next'](_0x1d29d7);}else{logger[_0x7ba5('0xd')](_0x7ba5('0x13'),_0x5186d4,_0x56cc35[_0x7ba5('0xe')]||_0x7ba5('0x12'));_0x3c9421['stop']();}}else{_0x3c9421['next']();}}}catch(_0x5d0021){logger[_0x7ba5('0x7')](_0x7ba5('0x8'),_0x5186d4,JSON['stringify'](_0x5d0021));_0x3c9421[_0x7ba5('0xc')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index 3a48489..ed5e5ea 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 _0x9a0b=['../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender','contact','channel','ChatWebsiteId','account','AccountId','InteractionId','Message','then','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage'];(function(_0x1cc394,_0x9b9f79){var _0x2e5aba=function(_0x5d0470){while(--_0x5d0470){_0x1cc394['push'](_0x1cc394['shift']());}};_0x2e5aba(++_0x9b9f79);}(_0x9a0b,0x1f3));var _0xb9a0=function(_0x3faf62,_0x2a8c44){_0x3faf62=_0x3faf62-0x0;var _0xa07e46=_0x9a0b[_0x3faf62];return _0xa07e46;};'use strict';var _=require('lodash');var utils=require(_0xb9a0('0x0'));var logger=require(_0xb9a0('0x1'))(_0xb9a0('0x2'));var rpc={'chatMessage':require(_0xb9a0('0x3')),'openchannelMessage':require(_0xb9a0('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xb9a0('0x5')),'faxMessage':require(_0xb9a0('0x6')),'whatsappMessage':require(_0xb9a0('0x7'))};exports['consequence']=function(_0x5d288f,_0x1c5732){return function(_0x2dee36){try{var _0x7b462e={'body':utils[_0xb9a0('0x8')](_0x1c5732[0x0],this),'ContactId':this[_0xb9a0('0x9')]['id']};if(this[_0xb9a0('0xa')]==='chat'){_0x7b462e[_0xb9a0('0xb')]=this[_0xb9a0('0xc')]['id'];}else{_0x7b462e[_['upperFirst'](this[_0xb9a0('0xa')])+_0xb9a0('0xd')]=this[_0xb9a0('0xc')]['id'];}_0x7b462e[_['upperFirst'](this['channel'])+_0xb9a0('0xe')]=this['interaction']['id'];if(rpc[this[_0xb9a0('0xa')]+'Message']){return rpc[this[_0xb9a0('0xa')]+_0xb9a0('0xf')]['create'](_0x7b462e)[_0xb9a0('0x10')](function(_0x6449df){logger['info'](_0xb9a0('0x11'),_0x5d288f,_0x7b462e[_0xb9a0('0x12')]);_0x2dee36[_0xb9a0('0x13')]();})[_0xb9a0('0x14')](function(_0xc9be75){logger[_0xb9a0('0x15')](_0xb9a0('0x11'),_0x5d288f,JSON[_0xb9a0('0x16')](_0xc9be75));_0x2dee36[_0xb9a0('0x17')]();});}}catch(_0x238d51){logger['error'](_0xb9a0('0x11'),_0x5d288f,JSON['stringify'](_0x238d51));_0x2dee36[_0xb9a0('0x17')]();}};}; \ No newline at end of file +var _0x0f13=['../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','InteractionId','interaction','Message','create','then','body','next','error','[%s][MESSAGE]\x20%s','stringify','stop','lodash','./utils'];(function(_0x2d0725,_0x516af5){var _0x35be5c=function(_0x145f1a){while(--_0x145f1a){_0x2d0725['push'](_0x2d0725['shift']());}};_0x35be5c(++_0x516af5);}(_0x0f13,0x16a));var _0x30f1=function(_0x384a89,_0x2bc7fd){_0x384a89=_0x384a89-0x0;var _0x5d7772=_0x0f13[_0x384a89];return _0x5d7772;};'use strict';var _=require(_0x30f1('0x0'));var utils=require(_0x30f1('0x1'));var logger=require(_0x30f1('0x2'))('routing');var rpc={'chatMessage':require(_0x30f1('0x3')),'openchannelMessage':require(_0x30f1('0x4')),'mailMessage':require(_0x30f1('0x5')),'smsMessage':require(_0x30f1('0x6')),'faxMessage':require(_0x30f1('0x7')),'whatsappMessage':require(_0x30f1('0x8'))};exports[_0x30f1('0x9')]=function(_0x5be0ab,_0x3d96dc){return function(_0x4a99f0){try{var _0x2355fa={'body':utils[_0x30f1('0xa')](_0x3d96dc[0x0],this),'ContactId':this[_0x30f1('0xb')]['id']};if(this[_0x30f1('0xc')]===_0x30f1('0xd')){_0x2355fa[_0x30f1('0xe')]=this[_0x30f1('0xf')]['id'];}else{_0x2355fa[_['upperFirst'](this[_0x30f1('0xc')])+'AccountId']=this[_0x30f1('0xf')]['id'];}_0x2355fa[_[_0x30f1('0x10')](this[_0x30f1('0xc')])+_0x30f1('0x11')]=this[_0x30f1('0x12')]['id'];if(rpc[this[_0x30f1('0xc')]+_0x30f1('0x13')]){return rpc[this[_0x30f1('0xc')]+_0x30f1('0x13')][_0x30f1('0x14')](_0x2355fa)[_0x30f1('0x15')](function(_0x5e7cee){logger['info']('[%s][MESSAGE]\x20%s',_0x5be0ab,_0x2355fa[_0x30f1('0x16')]);_0x4a99f0[_0x30f1('0x17')]();})['catch'](function(_0x1a9042){logger[_0x30f1('0x18')](_0x30f1('0x19'),_0x5be0ab,JSON[_0x30f1('0x1a')](_0x1a9042));_0x4a99f0[_0x30f1('0x1b')]();});}}catch(_0x1eeb73){logger['error']('[%s][MESSAGE]\x20%s',_0x5be0ab,JSON[_0x30f1('0x1a')](_0x1eeb73));_0x4a99f0['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 9cc5e5f..7591176 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 _0x7181=['getMustacheRender','next','error','[%s][NOOP]\x20%s','stop','./utils','routing','consequence','info'];(function(_0x122fe6,_0x4ac758){var _0x36b7d2=function(_0x12fca2){while(--_0x12fca2){_0x122fe6['push'](_0x122fe6['shift']());}};_0x36b7d2(++_0x4ac758);}(_0x7181,0x11c));var _0x1718=function(_0x227901,_0x1d8fca){_0x227901=_0x227901-0x0;var _0x5a55e4=_0x7181[_0x227901];return _0x5a55e4;};'use strict';var utils=require(_0x1718('0x0'));var logger=require('../../../../config/logger')(_0x1718('0x1'));exports[_0x1718('0x2')]=function(_0x19b8b6,_0x3e8062){return function(_0x379a2a){try{logger[_0x1718('0x3')]('[%s][NOOP]\x20%s',_0x19b8b6,utils[_0x1718('0x4')](_0x3e8062[0x0],this));_0x379a2a[_0x1718('0x5')]();}catch(_0x28fb62){logger[_0x1718('0x6')](_0x1718('0x7'),_0x19b8b6,JSON['stringify'](_0x28fb62));_0x379a2a[_0x1718('0x8')]();}};}; \ No newline at end of file +var _0x26d7=['consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stop','./utils','../../../../config/logger','routing'];(function(_0x42bcc0,_0x571f1c){var _0xb90582=function(_0x128d51){while(--_0x128d51){_0x42bcc0['push'](_0x42bcc0['shift']());}};_0xb90582(++_0x571f1c);}(_0x26d7,0x1dd));var _0x726d=function(_0x3cc8fe,_0x2eb916){_0x3cc8fe=_0x3cc8fe-0x0;var _0x87fa6a=_0x26d7[_0x3cc8fe];return _0x87fa6a;};'use strict';var utils=require(_0x726d('0x0'));var logger=require(_0x726d('0x1'))(_0x726d('0x2'));exports[_0x726d('0x3')]=function(_0x2b26ac,_0x4278f8){return function(_0x3860c9){try{logger[_0x726d('0x4')](_0x726d('0x5'),_0x2b26ac,utils[_0x726d('0x6')](_0x4278f8[0x0],this));_0x3860c9[_0x726d('0x7')]();}catch(_0x421894){logger[_0x726d('0x8')](_0x726d('0x5'),_0x2b26ac,JSON['stringify'](_0x421894));_0x3860c9[_0x726d('0x9')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index d3f0bd9..8d02eb6 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 _0x5420=['strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','validate','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','socket.io-emitter','account','queue','from','joinAt','emit','clone','queue_id','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','../../rpc/openchannelQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','number','YYYY-MM-DD\x20HH:mm:ss','list','upperFirst','channel','QueueId','interaction','MessageId','message','WebsiteId','name','QueueReport','catch','error','create\x20queue\x20report','waiting','accepted','info','[%s][STOP:QUEUE][NAME:%s]','body','[%s][END:QUEUE][NAME:%s]','update','update\x20queue\x20report','toLowerCase','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','timeout','atimeout','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','complete','[%s][QUEUE]\x20APPLICATION\x20END','next'];(function(_0x3fbb64,_0x25c75e){var _0x3ed7d6=function(_0x564bb1){while(--_0x564bb1){_0x3fbb64['push'](_0x3fbb64['shift']());}};_0x3ed7d6(++_0x25c75e);}(_0x5420,0x1ba));var _0x0542=function(_0x8e144b,_0x36ffc0){_0x8e144b=_0x8e144b-0x0;var _0x3e4c93=_0x5420[_0x8e144b];return _0x3e4c93;};'use strict';var schema=require(_0x0542('0x0'));var _=require('lodash');var util=require(_0x0542('0x1'));var seqqueue=require(_0x0542('0x2'));var moment=require(_0x0542('0x3'));var Redis=require(_0x0542('0x4'));var config=require(_0x0542('0x5'));var logger=require(_0x0542('0x6'))(_0x0542('0x7'));var strategy=require(_0x0542('0x8'));config[_0x0542('0x9')]=_[_0x0542('0xa')](config[_0x0542('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x0542('0xb'))(new Redis(config['redis']));var attributes=['id','queue_id',_0x0542('0xc'),_0x0542('0xd'),_0x0542('0xe'),_0x0542('0xf')];function emit(_0x5be8f3,_0x5b87f8,_0x3ebab5){io['to'](_0x5be8f3)[_0x0542('0x10')](_0x5b87f8,_0x3ebab5);}function emitChannelQueueInteraction(_0x511403,_0x2bf3df,_0x538775,_0x5324e4,_0x229a5d,_0x45ae7c,_0x35232c,_0x5eb300){var _0x1a7276=_[_0x0542('0x11')](_0x538775);_0x1a7276[_0x0542('0x12')]=_0x5eb300;_0x1a7276[_0x0542('0xd')]=_0x2bf3df;_0x1a7276[_0x0542('0xc')]=_0x5324e4;_0x1a7276['id']=_0x229a5d;if(_0x45ae7c){_0x35232c[util['format'](_0x0542('0x13'),_0x511403)][_0x229a5d]=_[_0x0542('0x14')](_0x1a7276,attributes);}else{delete _0x35232c[util[_0x0542('0x15')](_0x0542('0x13'),_0x511403)][_0x229a5d];}emit(util[_0x0542('0x15')](_0x0542('0x16'),_0x511403,_0x2bf3df),util[_0x0542('0x15')](_0x0542('0x17'),_0x511403,_0x45ae7c?'save':_0x0542('0x18')),_[_0x0542('0x14')](_0x1a7276,attributes));}var rpc={'openchannelQueueReport':require(_0x0542('0x19')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x0542('0x1a')),'whatsappQueueReport':require(_0x0542('0x1b'))};var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x0542('0x1c'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x35f281,_0x5aad2c,_0xfe7b04,_0x16b1d7){if(_0x35f281&&_0x5aad2c&&_0xfe7b04){_0x5aad2c['waiting']+=0x1;var _0x14d210={'uniqueid':_0x35f281,'from':_0xfe7b04['body']?_0xfe7b04['body'][_0x0542('0xe')]:'','joinAt':moment()['format'](_0x0542('0x1d')),'ContactId':_0xfe7b04['contact']?_0xfe7b04['contact']['id']:null,'ListId':_0xfe7b04[_0x0542('0x1e')]?_0xfe7b04[_0x0542('0x1e')]['id']:null};_0x14d210[_[_0x0542('0x1f')](_0xfe7b04[_0x0542('0x20')])+_0x0542('0x21')]=_0x5aad2c['id']||null;_0x14d210[_[_0x0542('0x1f')](_0xfe7b04[_0x0542('0x20')])+'InteractionId']=_0xfe7b04[_0x0542('0x22')]?_0xfe7b04['interaction']['id']:null;_0x14d210[_[_0x0542('0x1f')](_0xfe7b04[_0x0542('0x20')])+_0x0542('0x23')]=_0xfe7b04[_0x0542('0x24')]?_0xfe7b04[_0x0542('0x24')]['id']:null;_0x14d210[_[_0x0542('0x1f')](_0xfe7b04[_0x0542('0x20')])+(_0xfe7b04[_0x0542('0x20')]!=='chat'?'AccountId':_0x0542('0x25'))]=_0xfe7b04[_0x0542('0xc')]?_0xfe7b04['account']['id']:null;logger['info'](util[_0x0542('0x15')]('[%s][START:QUEUE][NAME:%s]',_0x35f281,_0x5aad2c['name']));emitChannelQueueInteraction(_0xfe7b04[_0x0542('0x20')],_0x5aad2c[_0x0542('0x26')],_0x14d210,_0xfe7b04[_0x0542('0xc')]['name'],_0xfe7b04[_0x0542('0x24')]['id'],!![],_0x16b1d7,_0x5aad2c['id']);if(rpc[_0xfe7b04[_0x0542('0x20')]+_0x0542('0x27')]){return rpc[_0xfe7b04['channel']+_0x0542('0x27')]['create'](_0x14d210)[_0x0542('0x28')](function(_0x1b9b28){logger[_0x0542('0x29')](_0x0542('0x2a'));});}}}function stopRouting(_0x33363e,_0x5790a3,_0x4889b7,_0xe8be21){if(_0x33363e&&_0x5790a3){_0x5790a3[_0x0542('0x2b')]-=0x1;var _0xf775c5={'leaveAt':moment()[_0x0542('0x15')](_0x0542('0x1d')),'acceptAt':moment()[_0x0542('0x15')](_0x0542('0x1d')),'reason':_0x0542('0x2c')};logger[_0x0542('0x2d')](util[_0x0542('0x15')](_0x0542('0x2e'),_0x33363e,_0x5790a3['name']));emitChannelQueueInteraction(_0x4889b7['channel'],_0x5790a3['name'],_0x4889b7[_0x0542('0x2f')],_0x4889b7['account'][_0x0542('0x26')],_0x4889b7[_0x0542('0x24')]['id'],![],_0xe8be21,_0x5790a3['id']);if(rpc[_0x4889b7[_0x0542('0x20')]+'QueueReport']){return rpc[_0x4889b7[_0x0542('0x20')]+_0x0542('0x27')]['update'](_0x33363e,_0xf775c5)[_0x0542('0x28')](function(_0x594287){logger['error']('update\x20queue\x20report');});}}}function endRouting(_0x182dab,_0x421133,_0x3d9b8b,_0x24549e){if(_0x182dab&&_0x421133){_0x421133[_0x0542('0x2b')]-=0x1;var _0x48bc87={'leaveAt':moment()[_0x0542('0x15')](_0x0542('0x1d')),'exitAt':moment()[_0x0542('0x15')](_0x0542('0x1d')),'reason':'timeout'};logger[_0x0542('0x2d')](util[_0x0542('0x15')](_0x0542('0x30'),_0x182dab,_0x421133[_0x0542('0x26')]));emitChannelQueueInteraction(_0x3d9b8b[_0x0542('0x20')],_0x421133[_0x0542('0x26')],_0x3d9b8b['body'],_0x3d9b8b[_0x0542('0xc')][_0x0542('0x26')],_0x3d9b8b[_0x0542('0x24')]['id'],![],_0x24549e);if(rpc[_0x3d9b8b[_0x0542('0x20')]+'QueueReport']){return rpc[_0x3d9b8b['channel']+_0x0542('0x27')][_0x0542('0x31')](_0x182dab,_0x48bc87)[_0x0542('0x28')](function(_0x1eaf3d){logger[_0x0542('0x29')](_0x0542('0x32'));});}}}function handleFindQueue(_0x4a34dd){return function(_0x13d7e0){return _0x13d7e0[_0x0542('0x26')][_0x0542('0x33')]()===_0x4a34dd[_0x0542('0x33')]();};}exports['consequence']=function(_0x2752ab,_0xc96ca0,_0x28ceba,_0x25b92e){return function(_0x5a36af){try{var _0x432782={'name':_0xc96ca0[0x0],'timeout':_0xc96ca0[0x1]};var _0x407865=queue[_0x0542('0x0')](_0x432782,{'typecast':!![]});if(_0x407865[_0x0542('0x34')]){logger['error'](_0x0542('0x35'),_0x2752ab,_[_0x0542('0x36')](_0x407865,_0x0542('0x24'))[_0x0542('0x37')](',\x20'));_0x5a36af[_0x0542('0x38')]();}else{var _0x4dec3d=_[_0x0542('0x39')](_0x28ceba[_0x25b92e[_0x0542('0x20')]+_0x0542('0x3a')],handleFindQueue(_0x432782[_0x0542('0x26')]));if(_0x4dec3d){startRouting(_0x2752ab,_0x4dec3d,_0x25b92e,_0x28ceba);var _0x1e835e=(_0x4dec3d[_0x0542('0x3b')]||0xa)*0x3e8;var _0x3c60ff=(_0x432782[_0x0542('0x3b')]||0x14)*0x3e8;var _0x3dc3bf,_0x4018ee;if(_0x1e835e>_0x3c60ff){_0x3c60ff=_0x1e835e;}var _0x5d6513=seqqueue['createQueue'](_0x1e835e);_0x5d6513['id']=_0x2752ab;_0x5d6513[_0x0542('0x3c')]=_0x1e835e;_0x5d6513[_0x0542('0x3d')]=_0x3c60ff;_0x5d6513[_0x0542('0x20')]=_0x25b92e[_0x0542('0x20')];_0x28ceba['rules'][_0x2752ab]['on'](_0x0542('0x3e'),function(){logger[_0x0542('0x2d')](_0x0542('0x3f'),_0x2752ab);stopRouting(_0x2752ab,_0x4dec3d,_0x25b92e,_0x28ceba);clearTimeout(_0x3dc3bf);_0x3dc3bf=undefined;_0x5d6513[_0x0542('0x40')](!![]);if(_0x28ceba[_0x0542('0x41')][_0x2752ab]){delete _0x28ceba[_0x0542('0x41')][_0x2752ab];}_0x5a36af['stop']();});_0x28ceba[_0x0542('0x41')][_0x2752ab]['on'](_0x0542('0x42'),function(){if(_0x28ceba[_0x0542('0x41')][_0x2752ab]){delete _0x28ceba[_0x0542('0x41')][_0x2752ab];}});_0x3dc3bf=setTimeout(function(){logger[_0x0542('0x2d')](_0x0542('0x43'),_0x2752ab);endRouting(_0x2752ab,_0x4dec3d,_0x25b92e,_0x28ceba);clearTimeout(_0x3dc3bf);_0x5d6513[_0x0542('0x40')](!![]);_0x5a36af[_0x0542('0x44')]();},_0x3c60ff);switch(_0x4dec3d[_0x0542('0x45')]){case _0x0542('0x46'):strategy[_0x0542('0x46')](_0x5d6513,_0x4dec3d,_0x28ceba,_0x25b92e);break;default:strategy['beepall'](_0x5d6513,_0x4dec3d,_0x28ceba,_0x25b92e);}}else{logger[_0x0542('0x29')](_0x0542('0x47'),_0x2752ab,_0x432782[_0x0542('0x26')]);_0x5a36af[_0x0542('0x38')]();}}}catch(_0x3d88e5){console[_0x0542('0x48')](_0x3d88e5);logger[_0x0542('0x29')](_0x0542('0x35'),_0x2752ab,_0x3d88e5['stack']);_0x5a36af['stop']();}};}; \ No newline at end of file +var _0x3ef0=['update','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','atimeout','qtimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','complete','[%s][QUEUE]\x20APPLICATION\x20END','close','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','localhost','socket.io-emitter','queue_id','queue','from','emit','clone','account','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','interaction','MessageId','message','chat','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]'];(function(_0x5eb64e,_0x238cc3){var _0x172cd5=function(_0x47bac3){while(--_0x47bac3){_0x5eb64e['push'](_0x5eb64e['shift']());}};_0x172cd5(++_0x238cc3);}(_0x3ef0,0x141));var _0x03ef=function(_0x20ff73,_0x16d2b6){_0x20ff73=_0x20ff73-0x0;var _0xd7abc5=_0x3ef0[_0x20ff73];return _0xd7abc5;};'use strict';var schema=require(_0x03ef('0x0'));var _=require('lodash');var util=require('util');var seqqueue=require('seq-queue');var moment=require(_0x03ef('0x1'));var Redis=require(_0x03ef('0x2'));var config=require(_0x03ef('0x3'));var logger=require(_0x03ef('0x4'))(_0x03ef('0x5'));var strategy=require(_0x03ef('0x6'));config['redis']=_['defaults'](config['redis'],{'host':_0x03ef('0x7'),'port':0x18eb});var io=require(_0x03ef('0x8'))(new Redis(config['redis']));var attributes=['id',_0x03ef('0x9'),'account',_0x03ef('0xa'),_0x03ef('0xb'),'joinAt'];function emit(_0x579304,_0x2be1bb,_0x2bd1bc){io['to'](_0x579304)[_0x03ef('0xc')](_0x2be1bb,_0x2bd1bc);}function emitChannelQueueInteraction(_0x12d575,_0x27548a,_0x439264,_0x4b59a2,_0x3f6281,_0x5ee416,_0x38972c,_0x32d820){var _0x12d9af=_[_0x03ef('0xd')](_0x439264);_0x12d9af[_0x03ef('0x9')]=_0x32d820;_0x12d9af[_0x03ef('0xa')]=_0x27548a;_0x12d9af[_0x03ef('0xe')]=_0x4b59a2;_0x12d9af['id']=_0x3f6281;if(_0x5ee416){_0x38972c[util[_0x03ef('0xf')](_0x03ef('0x10'),_0x12d575)][_0x3f6281]=_['pick'](_0x12d9af,attributes);}else{delete _0x38972c[util[_0x03ef('0xf')](_0x03ef('0x10'),_0x12d575)][_0x3f6281];}emit(util[_0x03ef('0xf')](_0x03ef('0x11'),_0x12d575,_0x27548a),util[_0x03ef('0xf')](_0x03ef('0x12'),_0x12d575,_0x5ee416?_0x03ef('0x13'):_0x03ef('0x14')),_[_0x03ef('0x15')](_0x12d9af,attributes));}var rpc={'openchannelQueueReport':require(_0x03ef('0x16')),'mailQueueReport':require(_0x03ef('0x17')),'chatQueueReport':require(_0x03ef('0x18')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x03ef('0x19')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x03ef('0x1a'),'message':_0x03ef('0x1b')}});function startRouting(_0x4fd689,_0x527d28,_0x3c1684,_0x2cda78){if(_0x4fd689&&_0x527d28&&_0x3c1684){_0x527d28[_0x03ef('0x1c')]+=0x1;var _0x2efdf7={'uniqueid':_0x4fd689,'from':_0x3c1684[_0x03ef('0x1d')]?_0x3c1684[_0x03ef('0x1d')][_0x03ef('0xb')]:'','joinAt':moment()[_0x03ef('0xf')](_0x03ef('0x1e')),'ContactId':_0x3c1684[_0x03ef('0x1f')]?_0x3c1684[_0x03ef('0x1f')]['id']:null,'ListId':_0x3c1684[_0x03ef('0x20')]?_0x3c1684[_0x03ef('0x20')]['id']:null};_0x2efdf7[_[_0x03ef('0x21')](_0x3c1684[_0x03ef('0x22')])+_0x03ef('0x23')]=_0x527d28['id']||null;_0x2efdf7[_[_0x03ef('0x21')](_0x3c1684['channel'])+'InteractionId']=_0x3c1684[_0x03ef('0x24')]?_0x3c1684[_0x03ef('0x24')]['id']:null;_0x2efdf7[_[_0x03ef('0x21')](_0x3c1684['channel'])+_0x03ef('0x25')]=_0x3c1684['message']?_0x3c1684[_0x03ef('0x26')]['id']:null;_0x2efdf7[_[_0x03ef('0x21')](_0x3c1684['channel'])+(_0x3c1684[_0x03ef('0x22')]!==_0x03ef('0x27')?'AccountId':_0x03ef('0x28'))]=_0x3c1684[_0x03ef('0xe')]?_0x3c1684[_0x03ef('0xe')]['id']:null;logger[_0x03ef('0x29')](util[_0x03ef('0xf')](_0x03ef('0x2a'),_0x4fd689,_0x527d28['name']));emitChannelQueueInteraction(_0x3c1684['channel'],_0x527d28[_0x03ef('0x2b')],_0x2efdf7,_0x3c1684[_0x03ef('0xe')][_0x03ef('0x2b')],_0x3c1684[_0x03ef('0x26')]['id'],!![],_0x2cda78,_0x527d28['id']);if(rpc[_0x3c1684['channel']+_0x03ef('0x2c')]){return rpc[_0x3c1684['channel']+_0x03ef('0x2c')][_0x03ef('0x2d')](_0x2efdf7)[_0x03ef('0x2e')](function(_0x500805){logger[_0x03ef('0x2f')](_0x03ef('0x30'));});}}}function stopRouting(_0x1c2e10,_0x3b2673,_0x39faa1,_0x2ba5a5){if(_0x1c2e10&&_0x3b2673){_0x3b2673[_0x03ef('0x1c')]-=0x1;var _0x4ffb16={'leaveAt':moment()[_0x03ef('0xf')](_0x03ef('0x1e')),'acceptAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x03ef('0x31')};logger[_0x03ef('0x29')](util[_0x03ef('0xf')](_0x03ef('0x32'),_0x1c2e10,_0x3b2673['name']));emitChannelQueueInteraction(_0x39faa1['channel'],_0x3b2673['name'],_0x39faa1[_0x03ef('0x1d')],_0x39faa1['account'][_0x03ef('0x2b')],_0x39faa1['message']['id'],![],_0x2ba5a5,_0x3b2673['id']);if(rpc[_0x39faa1[_0x03ef('0x22')]+_0x03ef('0x2c')]){return rpc[_0x39faa1[_0x03ef('0x22')]+_0x03ef('0x2c')]['update'](_0x1c2e10,_0x4ffb16)[_0x03ef('0x2e')](function(_0x1f498a){logger[_0x03ef('0x2f')](_0x03ef('0x33'));});}}}function endRouting(_0x5e18cc,_0x201980,_0x5abab8,_0x598fa5){if(_0x5e18cc&&_0x201980){_0x201980[_0x03ef('0x1c')]-=0x1;var _0x1edaa4={'leaveAt':moment()[_0x03ef('0xf')](_0x03ef('0x1e')),'exitAt':moment()[_0x03ef('0xf')](_0x03ef('0x1e')),'reason':_0x03ef('0x34')};logger[_0x03ef('0x29')](util[_0x03ef('0xf')](_0x03ef('0x35'),_0x5e18cc,_0x201980['name']));emitChannelQueueInteraction(_0x5abab8[_0x03ef('0x22')],_0x201980[_0x03ef('0x2b')],_0x5abab8[_0x03ef('0x1d')],_0x5abab8[_0x03ef('0xe')][_0x03ef('0x2b')],_0x5abab8[_0x03ef('0x26')]['id'],![],_0x598fa5);if(rpc[_0x5abab8[_0x03ef('0x22')]+'QueueReport']){return rpc[_0x5abab8[_0x03ef('0x22')]+'QueueReport'][_0x03ef('0x36')](_0x5e18cc,_0x1edaa4)[_0x03ef('0x2e')](function(_0x3fa1d0){logger[_0x03ef('0x2f')](_0x03ef('0x33'));});}}}function handleFindQueue(_0x4f91de){return function(_0x5d276b){return _0x5d276b[_0x03ef('0x2b')]['toLowerCase']()===_0x4f91de['toLowerCase']();};}exports[_0x03ef('0x37')]=function(_0xa3b2a3,_0x1bbf09,_0xbdcb09,_0x23c6d9){return function(_0x4fcfe4){try{var _0x2cded5={'name':_0x1bbf09[0x0],'timeout':_0x1bbf09[0x1]};var _0x27036a=queue[_0x03ef('0x0')](_0x2cded5,{'typecast':!![]});if(_0x27036a[_0x03ef('0x38')]){logger['error'](_0x03ef('0x39'),_0xa3b2a3,_[_0x03ef('0x3a')](_0x27036a,_0x03ef('0x26'))[_0x03ef('0x3b')](',\x20'));_0x4fcfe4[_0x03ef('0x3c')]();}else{var _0x17c9ca=_[_0x03ef('0x3d')](_0xbdcb09[_0x23c6d9[_0x03ef('0x22')]+_0x03ef('0x3e')],handleFindQueue(_0x2cded5['name']));if(_0x17c9ca){startRouting(_0xa3b2a3,_0x17c9ca,_0x23c6d9,_0xbdcb09);var _0x3898dd=(_0x17c9ca['timeout']||0xa)*0x3e8;var _0x52e086=(_0x2cded5[_0x03ef('0x34')]||0x14)*0x3e8;var _0x48afad,_0x462e39;if(_0x3898dd>_0x52e086){_0x52e086=_0x3898dd;}var _0x310ba9=seqqueue['createQueue'](_0x3898dd);_0x310ba9['id']=_0xa3b2a3;_0x310ba9[_0x03ef('0x3f')]=_0x3898dd;_0x310ba9[_0x03ef('0x40')]=_0x52e086;_0x310ba9[_0x03ef('0x22')]=_0x23c6d9['channel'];_0xbdcb09[_0x03ef('0x41')][_0xa3b2a3]['on']('end',function(){logger[_0x03ef('0x29')](_0x03ef('0x42'),_0xa3b2a3);stopRouting(_0xa3b2a3,_0x17c9ca,_0x23c6d9,_0xbdcb09);clearTimeout(_0x48afad);_0x48afad=undefined;_0x310ba9['close'](!![]);if(_0xbdcb09['rules'][_0xa3b2a3]){delete _0xbdcb09[_0x03ef('0x41')][_0xa3b2a3];}_0x4fcfe4[_0x03ef('0x3c')]();});_0xbdcb09[_0x03ef('0x41')][_0xa3b2a3]['on'](_0x03ef('0x43'),function(){if(_0xbdcb09[_0x03ef('0x41')][_0xa3b2a3]){delete _0xbdcb09['rules'][_0xa3b2a3];}});_0x48afad=setTimeout(function(){logger[_0x03ef('0x29')](_0x03ef('0x44'),_0xa3b2a3);endRouting(_0xa3b2a3,_0x17c9ca,_0x23c6d9,_0xbdcb09);clearTimeout(_0x48afad);_0x310ba9[_0x03ef('0x45')](!![]);_0x4fcfe4['next']();},_0x52e086);switch(_0x17c9ca[_0x03ef('0x46')]){case'rrmemory':strategy[_0x03ef('0x47')](_0x310ba9,_0x17c9ca,_0xbdcb09,_0x23c6d9);break;default:strategy[_0x03ef('0x48')](_0x310ba9,_0x17c9ca,_0xbdcb09,_0x23c6d9);}}else{logger[_0x03ef('0x2f')](_0x03ef('0x49'),_0xa3b2a3,_0x2cded5[_0x03ef('0x2b')]);_0x4fcfe4[_0x03ef('0x3c')]();}}}catch(_0x42e96b){console['log'](_0x42e96b);logger[_0x03ef('0x2f')](_0x03ef('0x39'),_0xa3b2a3,_0x42e96b[_0x03ef('0x4a')]);_0x4fcfe4[_0x03ef('0x3c')]();}};}; \ 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 73775fc..e70789d 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 _0xd088=['TIMEOUT','exports','uuid','./util','routing','notificationId','squeue','agent','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','push','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','realtime','forcedOwnership','agents','channel','busy','showNotification','writeLog',':FORCED','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','STOP'];(function(_0x2aba7b,_0x4b4b7f){var _0x61b120=function(_0x303aaf){while(--_0x303aaf){_0x2aba7b['push'](_0x2aba7b['shift']());}};_0x61b120(++_0x4b4b7f);}(_0xd088,0x188));var _0x8d08=function(_0x46cf89,_0x476a07){_0x46cf89=_0x46cf89-0x0;var _0x328b63=_0xd088[_0x46cf89];return _0x328b63;};'use strict';var _=require('lodash');var uuid=require(_0x8d08('0x0'));var util=require(_0x8d08('0x1'));var logger=require('../../../../../config/logger')(_0x8d08('0x2'));var Agent=function(_0x3c5f18,_0x5ac450,_0x1727c6,_0x4ea987){this[_0x8d08('0x3')]=uuid['v4']();this[_0x8d08('0x4')]=_0x3c5f18;this[_0x8d08('0x5')]=_0x5ac450;this['realtime']=_0x1727c6;this[_0x8d08('0x2')]=_0x4ea987;this[_0x8d08('0x4')]['push'](this[_0x8d08('0x6')][_0x8d08('0x7')](this),this[_0x8d08('0x8')][_0x8d08('0x7')](this));this[_0x8d08('0x4')]['on'](_0x8d08('0x9'),this[_0x8d08('0x8')]['bind'](this));this[_0x8d08('0x4')]['on'](_0x8d08('0xa'),this[_0x8d08('0xb')][_0x8d08('0x7')](this));};Agent[_0x8d08('0xc')][_0x8d08('0xd')]=function(){this[_0x8d08('0x4')][_0x8d08('0xd')](this[_0x8d08('0x6')]['bind'](this),this[_0x8d08('0x8')]['bind'](this));};Agent[_0x8d08('0xc')][_0x8d08('0xb')]=function(){this[_0x8d08('0x8')](!![]);};Agent[_0x8d08('0xc')][_0x8d08('0x6')]=function(_0x349173){logger[_0x8d08('0xe')](_0x8d08('0xf'),this[_0x8d08('0x4')]['id'],this[_0x8d08('0x5')]['id']);if(_[_0x8d08('0x10')](this[_0x8d08('0x11')]['agents'][this[_0x8d08('0x5')]['id']])){logger[_0x8d08('0xe')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x8d08('0x4')]['id'],this[_0x8d08('0x5')]['id']);setTimeout(this[_0x8d08('0xd')][_0x8d08('0x7')](this),0x3e8);}else{if(this['routing'][_0x8d08('0x12')]||util['isAgentAvailable'](this[_0x8d08('0x4')]['id'],this['realtime'][_0x8d08('0x13')][this[_0x8d08('0x5')]['id']],this[_0x8d08('0x4')][_0x8d08('0x14')],![])){this[_0x8d08('0x11')][_0x8d08('0x13')][this[_0x8d08('0x5')]['id']][_0x8d08('0x15')]=!![];this['realtime'][_0x8d08('0x13')][this[_0x8d08('0x5')]['id']]['busyQueue']=undefined;util[_0x8d08('0x16')](this['notificationId'],this[_0x8d08('0x4')]['id'],this[_0x8d08('0x11')][_0x8d08('0x13')][this[_0x8d08('0x5')]['id']],null,this[_0x8d08('0x2')]);util[_0x8d08('0x17')](this['squeue']['id'],this[_0x8d08('0x11')][_0x8d08('0x13')][this['agent']['id']],'RINGING'+(this['routing'][_0x8d08('0x12')]?_0x8d08('0x18'):''));}else{logger[_0x8d08('0xe')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0x8d08('0x4')]['id'],this[_0x8d08('0x5')]['id']);setTimeout(this[_0x8d08('0xd')][_0x8d08('0x7')](this),0x3e8);}}};Agent[_0x8d08('0xc')][_0x8d08('0x8')]=function(_0x345c8d){if(_[_0x8d08('0x10')](this[_0x8d08('0x11')]['agents'][this[_0x8d08('0x5')]['id']])){return logger['info'](_0x8d08('0x19'),this['squeue']['id'],this[_0x8d08('0x5')]['id']);}else{logger['info'](_0x8d08('0x1a'),this['squeue']['id'],this[_0x8d08('0x5')]['id']);util['hideNotification'](this[_0x8d08('0x3')],this[_0x8d08('0x4')]['id'],this[_0x8d08('0x11')][_0x8d08('0x13')][this[_0x8d08('0x5')]['id']],null,this[_0x8d08('0x2')]);this['realtime'][_0x8d08('0x13')][this['agent']['id']][_0x8d08('0x15')]=![];this[_0x8d08('0x11')][_0x8d08('0x13')][this[_0x8d08('0x5')]['id']]['busyQueue']=undefined;util[_0x8d08('0x17')](this['squeue']['id'],this[_0x8d08('0x11')][_0x8d08('0x13')][this[_0x8d08('0x5')]['id']],_0x345c8d?_0x8d08('0x1b'):_0x8d08('0x1c'));}if(!_0x345c8d){setTimeout(this[_0x8d08('0xd')]['bind'](this),0x3e8);}};function agent(_0x184620,_0x36e349,_0x32addc,_0x5b5405){return new Agent(_0x184620,_0x36e349,_0x32addc,_0x5b5405);}module[_0x8d08('0x1d')]=agent; \ No newline at end of file +var _0x2b4e=['realtime','push','handleRun','bind','handleTimeout','drained','handleDrained','prototype','info','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','agents','channel','busy','notificationId','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busyQueue','writeLog','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','squeue','agent'];(function(_0x3a6731,_0x3cf5f7){var _0x68e232=function(_0x56b190){while(--_0x56b190){_0x3a6731['push'](_0x3a6731['shift']());}};_0x68e232(++_0x3cf5f7);}(_0x2b4e,0x99));var _0xe2b4=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x2b4e[_0x21549c];return _0x426cbd;};'use strict';var _=require(_0xe2b4('0x0'));var uuid=require(_0xe2b4('0x1'));var util=require(_0xe2b4('0x2'));var logger=require(_0xe2b4('0x3'))(_0xe2b4('0x4'));var Agent=function(_0x261dd4,_0x560b64,_0x4fe3c1,_0x4badf3){this['notificationId']=uuid['v4']();this[_0xe2b4('0x5')]=_0x261dd4;this[_0xe2b4('0x6')]=_0x560b64;this[_0xe2b4('0x7')]=_0x4fe3c1;this[_0xe2b4('0x4')]=_0x4badf3;this[_0xe2b4('0x5')][_0xe2b4('0x8')](this[_0xe2b4('0x9')][_0xe2b4('0xa')](this),this[_0xe2b4('0xb')][_0xe2b4('0xa')](this));this[_0xe2b4('0x5')]['on']('timeout',this[_0xe2b4('0xb')][_0xe2b4('0xa')](this));this['squeue']['on'](_0xe2b4('0xc'),this[_0xe2b4('0xd')][_0xe2b4('0xa')](this));};Agent[_0xe2b4('0xe')]['push']=function(){this[_0xe2b4('0x5')]['push'](this['handleRun'][_0xe2b4('0xa')](this),this[_0xe2b4('0xb')]['bind'](this));};Agent[_0xe2b4('0xe')][_0xe2b4('0xd')]=function(){this[_0xe2b4('0xb')](!![]);};Agent[_0xe2b4('0xe')][_0xe2b4('0x9')]=function(_0x9346a8){logger['info']('[%s][AGENT]\x20try\x20with\x20%s',this[_0xe2b4('0x5')]['id'],this['agent']['id']);if(_['isNil'](this[_0xe2b4('0x7')]['agents'][this[_0xe2b4('0x6')]['id']])){logger[_0xe2b4('0xf')](_0xe2b4('0x10'),this[_0xe2b4('0x5')]['id'],this[_0xe2b4('0x6')]['id']);setTimeout(this['push'][_0xe2b4('0xa')](this),0x3e8);}else{if(this[_0xe2b4('0x4')][_0xe2b4('0x11')]||util[_0xe2b4('0x12')](this[_0xe2b4('0x5')]['id'],this['realtime'][_0xe2b4('0x13')][this[_0xe2b4('0x6')]['id']],this['squeue'][_0xe2b4('0x14')],![])){this[_0xe2b4('0x7')][_0xe2b4('0x13')][this[_0xe2b4('0x6')]['id']][_0xe2b4('0x15')]=!![];this[_0xe2b4('0x7')][_0xe2b4('0x13')][this[_0xe2b4('0x6')]['id']]['busyQueue']=undefined;util['showNotification'](this[_0xe2b4('0x16')],this[_0xe2b4('0x5')]['id'],this[_0xe2b4('0x7')][_0xe2b4('0x13')][this[_0xe2b4('0x6')]['id']],null,this[_0xe2b4('0x4')]);util['writeLog'](this[_0xe2b4('0x5')]['id'],this[_0xe2b4('0x7')][_0xe2b4('0x13')][this[_0xe2b4('0x6')]['id']],_0xe2b4('0x17')+(this[_0xe2b4('0x4')][_0xe2b4('0x11')]?':FORCED':''));}else{logger[_0xe2b4('0xf')](_0xe2b4('0x18'),this['squeue']['id'],this[_0xe2b4('0x6')]['id']);setTimeout(this[_0xe2b4('0x8')]['bind'](this),0x3e8);}}};Agent[_0xe2b4('0xe')][_0xe2b4('0xb')]=function(_0x333c5e){if(_[_0xe2b4('0x19')](this[_0xe2b4('0x7')][_0xe2b4('0x13')][this['agent']['id']])){return logger[_0xe2b4('0xf')](_0xe2b4('0x10'),this[_0xe2b4('0x5')]['id'],this[_0xe2b4('0x6')]['id']);}else{logger[_0xe2b4('0xf')](_0xe2b4('0x1a'),this[_0xe2b4('0x5')]['id'],this[_0xe2b4('0x6')]['id']);util[_0xe2b4('0x1b')](this['notificationId'],this[_0xe2b4('0x5')]['id'],this[_0xe2b4('0x7')][_0xe2b4('0x13')][this[_0xe2b4('0x6')]['id']],null,this['routing']);this['realtime'][_0xe2b4('0x13')][this[_0xe2b4('0x6')]['id']][_0xe2b4('0x15')]=![];this[_0xe2b4('0x7')][_0xe2b4('0x13')][this[_0xe2b4('0x6')]['id']][_0xe2b4('0x1c')]=undefined;util[_0xe2b4('0x1d')](this[_0xe2b4('0x5')]['id'],this[_0xe2b4('0x7')]['agents'][this['agent']['id']],_0x333c5e?'STOP':_0xe2b4('0x1e'));}if(!_0x333c5e){setTimeout(this[_0xe2b4('0x8')][_0xe2b4('0xa')](this),0x3e8);}};function agent(_0x377025,_0x4755c4,_0x10c8f1,_0x56f16b){return new Agent(_0x377025,_0x4755c4,_0x10c8f1,_0x56f16b);}module[_0xe2b4('0x1f')]=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 a929448..0651da6 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 _0xc090=['squeue','queue','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','isNil','Agents','length','agents','info','isAgentAvailable','realtime','channel','writeLog','RINGING','busy','busyQueue','notificationId','push','[%s][QUEUE]\x20EMPTY','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','TIMEOUT','lodash','uuid','./util','../../../../../config/logger','routing'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc090,0x112));var _0x0c09=function(_0x232c42,_0x3f186e){_0x232c42=_0x232c42-0x0;var _0x4e793c=_0xc090[_0x232c42];return _0x4e793c;};'use strict';var _=require(_0x0c09('0x0'));var uuid=require(_0x0c09('0x1'));var util=require(_0x0c09('0x2'));var logger=require(_0x0c09('0x3'))(_0x0c09('0x4'));var Beepall=function(_0x1b296d,_0x289436,_0x260c36,_0x11984f){this['notificationId']=uuid['v4']();this[_0x0c09('0x5')]=_0x1b296d;this[_0x0c09('0x6')]=_0x289436;this['realtime']=_0x260c36;this['routing']=_0x11984f;this[_0x0c09('0x5')]['push'](this[_0x0c09('0x7')][_0x0c09('0x8')](this),this[_0x0c09('0x9')]['bind'](this));this[_0x0c09('0x5')]['on'](_0x0c09('0xa'),this['handleTimeout'][_0x0c09('0x8')](this));this['squeue']['on'](_0x0c09('0xb'),this[_0x0c09('0xc')][_0x0c09('0x8')](this));};Beepall[_0x0c09('0xd')]['push']=function(){this['squeue']['push'](this[_0x0c09('0x7')]['bind'](this),this['handleTimeout'][_0x0c09('0x8')](this));};Beepall['prototype'][_0x0c09('0xc')]=function(_0x877018){this[_0x0c09('0x9')](!![]);};Beepall[_0x0c09('0xd')][_0x0c09('0x7')]=function(_0x342daa){var _0x28ea3c=!![];if(!_[_0x0c09('0xe')](this[_0x0c09('0x6')])&&!_[_0x0c09('0xe')](this['queue'][_0x0c09('0xf')])&&this[_0x0c09('0x6')][_0x0c09('0xf')][_0x0c09('0x10')]>0x0){for(var _0x20ad8a=0x0,_0x14995e;_0x20ad8a0x0){for(var _0x4be341=0x0,_0x3c996d;_0x4be3410x0&&_0x476a14[_0x4e07e1+_0x8488('0x23')]>=_0x476a14[_0x4e07e1+_0x8488('0x24')]){writeLog(_0x5123d0,_0x476a14,_0x4e07e1[_0x8488('0x25')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x8488('0x26')]=function(_0x38c137,_0xf9720e,_0x3df1f9,_0x460001,_0x27f5cf){return sendNotification(!![],_0x38c137,_0xf9720e,_0x3df1f9,_0x460001,_0x27f5cf);};exports[_0x8488('0x27')]=function(_0x296b6c,_0x368f9c,_0x1d9317,_0x888b24,_0x58d0cc){return sendNotification(![],_0x296b6c,_0x368f9c,_0x1d9317,_0x888b24,_0x58d0cc);};exports['writeLog']=writeLog; \ No newline at end of file +var _0x8ace=['\x20MAXCAPACITY','showNotification','hideNotification','writeLog','lodash','util','../utils','mustache','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','format','user:%s','name','user:save','\x20interaction','account','notificationSound','notificationShake','body','queue','msg','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','emit','notification:%s','save','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x52684f,_0xff73fc){_0x52684f=_0x52684f-0x0;var _0x4a55f0=_0x8ace[_0x52684f];return _0x4a55f0;};'use strict';var _=require(_0xe8ac('0x0'));var util=require(_0xe8ac('0x1'));var utils=require(_0xe8ac('0x2'));var Mustache=require(_0xe8ac('0x3'));var Redis=require(_0xe8ac('0x4'));var config=require(_0xe8ac('0x5'));var logger=require(_0xe8ac('0x6'))(_0xe8ac('0x7'));config[_0xe8ac('0x8')]=_[_0xe8ac('0x9')](config[_0xe8ac('0x8')],{'host':_0xe8ac('0xa'),'port':0x18eb});var io=require(_0xe8ac('0xb'))(new Redis(config[_0xe8ac('0x8')]));function emit(_0x4eb087,_0x2d56f0,_0x1357ed){io['to'](_0x4eb087)['emit'](_0x2d56f0,_0x1357ed);}function sendNotification(_0x5c83e1,_0x4644ef,_0x513793,_0x1b5467,_0x271fdb,_0x19d9c8){io['to'](util[_0xe8ac('0xc')](_0xe8ac('0xd'),_0x1b5467[_0xe8ac('0xe')]))['emit'](_0xe8ac('0xf'),_0x1b5467);var _0x2e3b25=_0x19d9c8||{};var _0x1f71ff=_0x513793['split']('.');var _0x15b0cf={'uniqueid':_0x4644ef,'channel':_0x1f71ff[0x0],'id':_0x1f71ff[0x1],'title':_0x1f71ff[0x0]+_0xe8ac('0x10'),'interactionId':_0x1f71ff[0x2],'queue':_0x271fdb?_0x271fdb['name']:null,'sound':_0x2e3b25[_0xe8ac('0x11')][_0xe8ac('0x12')],'shake':_0x2e3b25[_0xe8ac('0x11')][_0xe8ac('0x13')]};try{if(!_0x2e3b25[_0xe8ac('0x14')]){_0x2e3b25[_0xe8ac('0x14')]={};}if(_0x271fdb){_0x2e3b25[_0xe8ac('0x14')][_0xe8ac('0x15')]=_0x271fdb;}else if(_0x2e3b25[_0xe8ac('0x14')][_0xe8ac('0x15')]){delete _0x2e3b25['body'][_0xe8ac('0x15')];}_0x15b0cf[_0xe8ac('0x16')]=utils['getMustacheRender'](_0x2e3b25[_0xe8ac('0x11')][_0xe8ac('0x17')],_0x2e3b25);}catch(_0x1421df){_0x15b0cf[_0xe8ac('0x16')]=_0xe8ac('0x18');logger[_0xe8ac('0x19')](util['format']('[%s][QUEUE]\x20%s',_0x4644ef,_0x1421df['message']));}io['to'](util[_0xe8ac('0xc')](_0xe8ac('0xd'),_0x1b5467['name']))[_0xe8ac('0x1a')](util['format'](_0xe8ac('0x1b'),_0x5c83e1?_0xe8ac('0x1c'):'remove'),_0x15b0cf);}function writeLog(_0x6258f8,_0x169929,_0x13aa7c){return logger[_0xe8ac('0x1d')](util['format'](_0xe8ac('0x1e'),_0x6258f8,_0x169929['name'],_0x13aa7c));}exports[_0xe8ac('0x1f')]=function(_0x3933d2,_0x3c3a78,_0x252440,_0x36108c){if(_0x3c3a78[_0xe8ac('0x20')]){writeLog(_0x3933d2,_0x3c3a78,_0xe8ac('0x21'));return![];}if(!_0x3c3a78['online']){writeLog(_0x3933d2,_0x3c3a78,_0xe8ac('0x22'));return![];}if(_0x3c3a78[_0x252440+_0xe8ac('0x23')]){writeLog(_0x3933d2,_0x3c3a78,_0xe8ac('0x24'));return![];}if(_0x36108c&&_0x3c3a78[_0xe8ac('0x25')](_0x252440+_0xe8ac('0x26'))&&_0x3c3a78[_0xe8ac('0x25')](_0x252440+_0xe8ac('0x27'))){if(_0x3c3a78[_0x252440+_0xe8ac('0x26')]>0x0&&_0x3c3a78[_0x252440+_0xe8ac('0x27')]>=_0x3c3a78[_0x252440+'Capacity']){writeLog(_0x3933d2,_0x3c3a78,_0x252440['toUpperCase']()+_0xe8ac('0x28'));return![];}}return!![];};exports[_0xe8ac('0x29')]=function(_0x59512c,_0x2a78c6,_0x5948aa,_0x54f94c,_0x4c1d08){return sendNotification(!![],_0x59512c,_0x2a78c6,_0x5948aa,_0x54f94c,_0x4c1d08);};exports[_0xe8ac('0x2a')]=function(_0x41294e,_0x3798c5,_0x5d7562,_0x156550,_0x41ffe8){return sendNotification(![],_0x41294e,_0x3798c5,_0x5d7562,_0x156550,_0x41ffe8);};exports[_0xe8ac('0x2b')]=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 8304854..ab52fab 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 _0xab5b=['replace','isNil','isEmpty','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','validate','shelljs','./utils','../../../../config/logger','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','[%s][SYSTEM]\x20%s','map','message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim'];(function(_0x56e4ee,_0x5c2a5e){var _0x331c5a=function(_0x5c9f4a){while(--_0x5c9f4a){_0x56e4ee['push'](_0x56e4ee['shift']());}};_0x331c5a(++_0x5c2a5e);}(_0xab5b,0x11a));var _0xbab5=function(_0x3a41a8,_0x1e25b9){_0x3a41a8=_0x3a41a8-0x0;var _0x19dfeb=_0xab5b[_0x3a41a8];return _0x19dfeb;};'use strict';var schema=require(_0xbab5('0x0'));var sh=require(_0xbab5('0x1'));var _=require('lodash');var utils=require(_0xbab5('0x2'));var logger=require(_0xbab5('0x3'))('routing');var system=schema({'command':{'type':'string','required':!![],'message':_0xbab5('0x4')}});exports['consequence']=function(_0xa320ef,_0x2fe469){return function(_0x438e9b){try{var _0x214f8c={'command':_0x2fe469[0x0]};var _0xae91d9=system['validate'](_0x214f8c,{'typecast':!![]});if(_0xae91d9[_0xbab5('0x5')]){logger[_0xbab5('0x6')](_0xbab5('0x7'),_0xa320ef,_[_0xbab5('0x8')](_0xae91d9,_0xbab5('0x9'))['join'](',\x20'));logger[_0xbab5('0xa')](_0xbab5('0xb'),_0xa320ef);_0x438e9b[_0xbab5('0xc')]();}else{var _0x4c9350=this;var _0x226c55=utils[_0xbab5('0xd')](_0x2fe469[0x0],this);logger['info'](_0xbab5('0xe'),_0xa320ef,_0x226c55);sh[_0xbab5('0xf')](_[_0xbab5('0x10')](_0x226c55),function(_0x42c629,_0x5d0665){logger[_0xbab5('0xa')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0xa320ef,_0x42c629);if(_0x42c629==0x0){var _0x332b0e=_0x5d0665[_0xbab5('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0xbab5('0x12')](_0x2fe469[0x1])||_[_0xbab5('0x13')](_0x2fe469[0x1])){logger[_0xbab5('0xa')]('[%s][SYSTEM]\x20no\x20variable',_0xa320ef);_0x4c9350[_0xbab5('0x14')][_0x2fe469[0x1]]=_0x332b0e;}else{logger[_0xbab5('0xa')](_0xbab5('0x15'),_0xa320ef,_0x2fe469[0x1],_0x332b0e);_0x4c9350[_0xbab5('0x14')][_0x2fe469[0x1]]=_0x332b0e;}}_0x438e9b[_0xbab5('0xc')]();});}}catch(_0xea96d){logger[_0xbab5('0x6')](_0xbab5('0x7'),_0xa320ef,_[_0xbab5('0x16')](_0xea96d)?JSON['stringify'](_0xea96d):_0xea96d);logger[_0xbab5('0xa')](_0xbab5('0xb'),_0xa320ef);_0x438e9b[_0xbab5('0xc')]();}};}; \ No newline at end of file +var _0x440f=['length','[%s][SYSTEM]\x20%s','map','message','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','info','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','error','isObject','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence'];(function(_0x487120,_0x4ad17b){var _0x477379=function(_0x4db1ac){while(--_0x4db1ac){_0x487120['push'](_0x487120['shift']());}};_0x477379(++_0x4ad17b);}(_0x440f,0xfc));var _0xf440=function(_0x3b5850,_0x268526){_0x3b5850=_0x3b5850-0x0;var _0x5c1aa9=_0x440f[_0x3b5850];return _0x5c1aa9;};'use strict';var schema=require(_0xf440('0x0'));var sh=require(_0xf440('0x1'));var _=require(_0xf440('0x2'));var utils=require(_0xf440('0x3'));var logger=require(_0xf440('0x4'))(_0xf440('0x5'));var system=schema({'command':{'type':_0xf440('0x6'),'required':!![],'message':_0xf440('0x7')}});exports[_0xf440('0x8')]=function(_0x10edf,_0x4e4a7d){return function(_0x28454f){try{var _0x29a1fb={'command':_0x4e4a7d[0x0]};var _0x3c7015=system[_0xf440('0x0')](_0x29a1fb,{'typecast':!![]});if(_0x3c7015[_0xf440('0x9')]){logger['error'](_0xf440('0xa'),_0x10edf,_[_0xf440('0xb')](_0x3c7015,_0xf440('0xc'))[_0xf440('0xd')](',\x20'));logger['info'](_0xf440('0xe'),_0x10edf);_0x28454f[_0xf440('0xf')]();}else{var _0x39b559=this;var _0xc60919=utils['getMustacheRender'](_0x4e4a7d[0x0],this);logger['info'](_0xf440('0x10'),_0x10edf,_0xc60919);sh[_0xf440('0x11')](_[_0xf440('0x12')](_0xc60919),function(_0x47d84c,_0x25487c){logger['info'](_0xf440('0x13'),_0x10edf,_0x47d84c);if(_0x47d84c==0x0){var _0x20c382=_0x25487c[_0xf440('0x14')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x4e4a7d[0x1])||_[_0xf440('0x15')](_0x4e4a7d[0x1])){logger[_0xf440('0x16')](_0xf440('0x17'),_0x10edf);_0x39b559[_0xf440('0x18')][_0x4e4a7d[0x1]]=_0x20c382;}else{logger[_0xf440('0x16')](_0xf440('0x19'),_0x10edf,_0x4e4a7d[0x1],_0x20c382);_0x39b559['body'][_0x4e4a7d[0x1]]=_0x20c382;}}_0x28454f[_0xf440('0xf')]();});}}catch(_0x1436ce){logger[_0xf440('0x1a')](_0xf440('0xa'),_0x10edf,_[_0xf440('0x1b')](_0x1436ce)?JSON[_0xf440('0x1c')](_0x1436ce):_0x1436ce);logger[_0xf440('0x16')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x10edf);_0x28454f['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index 54b80bc..81e1cc7 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 _0x897d=['addTags','interaction','info','error','stringify','finally','isObject','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','number','consequence','validate','length','[%s][TAG]\x20%s','map','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','Interaction','channel'];(function(_0x44b3f6,_0x2f0b79){var _0x4a6207=function(_0x5835fb){while(--_0x5835fb){_0x44b3f6['push'](_0x44b3f6['shift']());}};_0x4a6207(++_0x2f0b79);}(_0x897d,0xa8));var _0xd897=function(_0x31f384,_0x3d5492){_0x31f384=_0x31f384-0x0;var _0xcfc069=_0x897d[_0x31f384];return _0xcfc069;};'use strict';var schema=require('validate');var _=require('lodash');var rpc={'chatInteraction':require(_0xd897('0x0')),'openchannelInteraction':require(_0xd897('0x1')),'smsInteraction':require(_0xd897('0x2')),'mailInteraction':require(_0xd897('0x3')),'faxInteraction':require(_0xd897('0x4')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0xd897('0x5'))('routing');var tag=schema({'tag':{'type':_0xd897('0x6'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xd897('0x7')]=function(_0x6ed565,_0x446ddd,_0x5ba6a3,_0x2e0f43){return function(_0x3d306c){try{var _0x16462c={'tag':_0x446ddd[0x0]};var _0x268ef8=tag[_0xd897('0x8')](_0x16462c,{'typecast':!![]});if(_0x268ef8[_0xd897('0x9')]){logger['error'](_0xd897('0xa'),_0x6ed565,_[_0xd897('0xb')](_0x268ef8,'message')['join'](',\x20'));logger['info'](_0xd897('0xc'),_0x6ed565);_0x3d306c[_0xd897('0xd')]();}else{var _0x374c2a={'ids':[_0x446ddd[0x0]]};if(rpc[_0x2e0f43['channel']+_0xd897('0xe')]){rpc[_0x2e0f43[_0xd897('0xf')]+_0xd897('0xe')][_0xd897('0x10')](_0x2e0f43[_0xd897('0x11')]['id'],_0x374c2a)['then'](function(_0x4602f5){logger[_0xd897('0x12')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x6ed565,_0x446ddd[0x1],_0x2e0f43[_0xd897('0xf')],_0x2e0f43[_0xd897('0x11')]['id']);})['catch'](function(_0x59ee40){logger[_0xd897('0x13')]('[%s][TAG]\x20%s',_0x6ed565,JSON[_0xd897('0x14')](_0x59ee40));logger[_0xd897('0x12')](_0xd897('0xc'),_0x6ed565);})[_0xd897('0x15')](function(){_0x3d306c[_0xd897('0xd')]();});}}}catch(_0x465f77){logger['error'](_0xd897('0xa'),_0x6ed565,_[_0xd897('0x16')](_0x465f77)?JSON[_0xd897('0x14')](_0x465f77):_0x465f77);logger[_0xd897('0x12')](_0xd897('0xc'),_0x6ed565);_0x3d306c['next']();}};}; \ No newline at end of file +var _0x580c=['[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','channel','catch','stringify','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','error','[%s][TAG]\x20%s','message','join','info'];(function(_0x51ae70,_0x49aee9){var _0xedcc22=function(_0x4562c5){while(--_0x4562c5){_0x51ae70['push'](_0x51ae70['shift']());}};_0xedcc22(++_0x49aee9);}(_0x580c,0x1f2));var _0xc580=function(_0x428621,_0x51c065){_0x428621=_0x428621-0x0;var _0x365fe6=_0x580c[_0x428621];return _0x365fe6;};'use strict';var schema=require(_0xc580('0x0'));var _=require(_0xc580('0x1'));var rpc={'chatInteraction':require(_0xc580('0x2')),'openchannelInteraction':require(_0xc580('0x3')),'smsInteraction':require(_0xc580('0x4')),'mailInteraction':require(_0xc580('0x5')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0xc580('0x6'))(_0xc580('0x7'));var tag=schema({'tag':{'type':_0xc580('0x8'),'required':!![],'message':_0xc580('0x9')}});exports['consequence']=function(_0x22609b,_0x311acb,_0xa20bbb,_0x4f0423){return function(_0x816e0a){try{var _0x35b53e={'tag':_0x311acb[0x0]};var _0x5a40f4=tag[_0xc580('0x0')](_0x35b53e,{'typecast':!![]});if(_0x5a40f4['length']){logger[_0xc580('0xa')](_0xc580('0xb'),_0x22609b,_['map'](_0x5a40f4,_0xc580('0xc'))[_0xc580('0xd')](',\x20'));logger[_0xc580('0xe')](_0xc580('0xf'),_0x22609b);_0x816e0a[_0xc580('0x10')]();}else{var _0x3a14e2={'ids':[_0x311acb[0x0]]};if(rpc[_0x4f0423['channel']+_0xc580('0x11')]){rpc[_0x4f0423['channel']+_0xc580('0x11')][_0xc580('0x12')](_0x4f0423[_0xc580('0x13')]['id'],_0x3a14e2)[_0xc580('0x14')](function(_0xbd9d31){logger[_0xc580('0xe')](_0xc580('0x15'),_0x22609b,_0x311acb[0x1],_0x4f0423[_0xc580('0x16')],_0x4f0423[_0xc580('0x13')]['id']);})[_0xc580('0x17')](function(_0x57589f){logger[_0xc580('0xa')](_0xc580('0xb'),_0x22609b,JSON[_0xc580('0x18')](_0x57589f));logger['info'](_0xc580('0xf'),_0x22609b);})[_0xc580('0x19')](function(){_0x816e0a[_0xc580('0x10')]();});}}}catch(_0xac65c7){logger[_0xc580('0xa')]('[%s][TAG]\x20%s',_0x22609b,_[_0xc580('0x1a')](_0xac65c7)?JSON['stringify'](_0xac65c7):_0xac65c7);logger['info'](_0xc580('0xf'),_0x22609b);_0x816e0a[_0xc580('0x10')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index 9bf8925..5f5c194 100644 --- a/server/services/routing/server/applications/tvox.js +++ b/server/services/routing/server/applications/tvox.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7401=['stringify','utf8','then','parse','result','channelId=','&serviceId=','&sessionId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','error','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','request-promise','../../../../config/logger','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','title','method'];(function(_0x41d447,_0x5b2f4a){var _0xe80678=function(_0x5eae65){while(--_0x5eae65){_0x41d447['push'](_0x41d447['shift']());}};_0xe80678(++_0x5b2f4a);}(_0x7401,0x17c));var _0x1740=function(_0x199b52,_0x351532){_0x199b52=_0x199b52-0x0;var _0x238415=_0x7401[_0x199b52];return _0x238415;};'use strict';var rp=require(_0x1740('0x0'));var logger=require(_0x1740('0x1'))('routing');var arr=[];exports['consequence']=function(_0x549a8c,_0x84cb4d){return function(_0x24bce8){var _0xc965cb=_0x84cb4d[0xa];var _0x35bb60=_0x84cb4d[0xb];var _0x5bb316=_0x84cb4d[0xc];var _0x38a3d3=_0x84cb4d[0xd];var _0x2ffaab=_0x84cb4d[0xe];var _0x98aedc=_0x84cb4d[0xf][_0x1740('0x2')](/\n/g,_0x1740('0x3'));var _0x443080=_0x84cb4d[0x10][_0x1740('0x2')](/\n/g,'\x20');if(!arr[_0x1740('0x4')](_0x35bb60)){arr[_0x1740('0x5')](_0x35bb60);var _0x57ee40=_0x84cb4d[0x3];var _0x2f0016=_0x84cb4d[0x4];var _0x5c0306=_0x84cb4d[0x1];var _0x52c20f=_0x84cb4d[0x0];var _0x3ee322={};_0x3ee322[_0x1740('0x6')]=_0x84cb4d[0x8]+_0x1740('0x7')+_0x5bb316+'|'+_0xc965cb+'|'+_0x38a3d3+'|'+_0x35bb60+'|'+_0x2ffaab;_0x3ee322['urlOnRing']=_0x84cb4d[0x7]+_0x1740('0x7')+_0x5bb316+'|'+_0xc965cb+'|'+_0x38a3d3+'|'+_0x35bb60+'|'+_0x2ffaab+'|'+_0x98aedc+'|'+_0x443080;_0x3ee322[_0x1740('0x8')]=_0x84cb4d[0x9];var _0x293302={};_0x293302['jsonrpc']='2.0';_0x293302[_0x1740('0x9')]='login';var _0x187510=[];_0x187510[_0x1740('0x5')](_0x84cb4d[0x2]);_0x187510['push'](_0x84cb4d[0x5]);_0x187510[_0x1740('0x5')](_0x84cb4d[0x6]);_0x293302['params']=_0x187510;_0x293302['id']=0x1;var _0x27f800=JSON[_0x1740('0xa')](_0x293302);var _0x3efc16={'encoding':_0x1740('0xb'),'method':'POST','timeout':0x2710,'url':_0x57ee40,'headers':{'Content-Type':'application/json-rpc'},'body':_0x27f800};return rp(_0x3efc16)[_0x1740('0xc')](function(_0x4974fa){const _0x2093aa=JSON[_0x1740('0xd')](_0x4974fa);if(!_0x2093aa[_0x1740('0xe')]['logged']){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x14b283=_0x35bb60;var _0x14b9c5=_0x1740('0xf')+_0x5c0306+_0x1740('0x10')+_0x52c20f+_0x1740('0x11')+_0x14b283+_0x1740('0x12')+JSON['stringify'](_0x3ee322);var _0x424662=_0x2f0016+'?'+_0x14b9c5;return rp(_0x424662);})[_0x1740('0xc')](function(_0x29cc57){logger[_0x1740('0x13')](_0x1740('0x14'),_0x549a8c,_0x29cc57);_0x24bce8[_0x1740('0x15')]();})['catch'](function(_0x29dcc5){logger[_0x1740('0x16')](_0x1740('0x17'),_0x549a8c,_[_0x1740('0x18')](_0x29dcc5)?JSON[_0x1740('0xa')](_0x29dcc5):_0x29dcc5);_0x24bce8[_0x1740('0x15')]();});}else{logger[_0x1740('0x13')](_0x1740('0x19'),_0x549a8c);_0x24bce8['next']();}};}; \ No newline at end of file +var _0x11b8=['error','[%s][TVOX]\x20%s','stop','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','replace','\x20-\x20','push','?params=','urlOnRing','title','2.0','method','params','utf8','application/json-rpc','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','&sessionId=','&data=','stringify','info'];(function(_0x1e765a,_0x4a7c55){var _0x5bc8a1=function(_0x8dbd4d){while(--_0x8dbd4d){_0x1e765a['push'](_0x1e765a['shift']());}};_0x5bc8a1(++_0x4a7c55);}(_0x11b8,0xf8));var _0x811b=function(_0x256027,_0x572634){_0x256027=_0x256027-0x0;var _0xf4cfa2=_0x11b8[_0x256027];return _0xf4cfa2;};'use strict';var rp=require(_0x811b('0x0'));var logger=require(_0x811b('0x1'))('routing');var arr=[];exports['consequence']=function(_0x3002ed,_0x377db5){return function(_0x41c9cf){var _0x52e049=_0x377db5[0xa];var _0xded2a=_0x377db5[0xb];var _0x229e8a=_0x377db5[0xc];var _0x104e46=_0x377db5[0xd];var _0x4453d5=_0x377db5[0xe];var _0x1f8d70=_0x377db5[0xf][_0x811b('0x2')](/\n/g,_0x811b('0x3'));var _0x2d47e6=_0x377db5[0x10][_0x811b('0x2')](/\n/g,'\x20');if(!arr['includes'](_0xded2a)){arr[_0x811b('0x4')](_0xded2a);var _0x565206=_0x377db5[0x3];var _0x34b113=_0x377db5[0x4];var _0x6111ee=_0x377db5[0x1];var _0x386341=_0x377db5[0x0];var _0x3633ac={};_0x3633ac['urlOnAnswer']=_0x377db5[0x8]+_0x811b('0x5')+_0x229e8a+'|'+_0x52e049+'|'+_0x104e46+'|'+_0xded2a+'|'+_0x4453d5;_0x3633ac[_0x811b('0x6')]=_0x377db5[0x7]+_0x811b('0x5')+_0x229e8a+'|'+_0x52e049+'|'+_0x104e46+'|'+_0xded2a+'|'+_0x4453d5+'|'+_0x1f8d70+'|'+_0x2d47e6;_0x3633ac[_0x811b('0x7')]=_0x377db5[0x9];var _0x18ec33={};_0x18ec33['jsonrpc']=_0x811b('0x8');_0x18ec33[_0x811b('0x9')]='login';var _0x5e9ffd=[];_0x5e9ffd[_0x811b('0x4')](_0x377db5[0x2]);_0x5e9ffd[_0x811b('0x4')](_0x377db5[0x5]);_0x5e9ffd[_0x811b('0x4')](_0x377db5[0x6]);_0x18ec33[_0x811b('0xa')]=_0x5e9ffd;_0x18ec33['id']=0x1;var _0x584a2a=JSON['stringify'](_0x18ec33);var _0x16b9c9={'encoding':_0x811b('0xb'),'method':'POST','timeout':0x2710,'url':_0x565206,'headers':{'Content-Type':_0x811b('0xc')},'body':_0x584a2a};return rp(_0x16b9c9)[_0x811b('0xd')](function(_0x4e6c2f){const _0x44f7f2=JSON[_0x811b('0xe')](_0x4e6c2f);if(!_0x44f7f2[_0x811b('0xf')][_0x811b('0x10')]){throw new Error(_0x811b('0x11'));}var _0x461516=_0xded2a;var _0x113a98='channelId='+_0x6111ee+'&serviceId='+_0x386341+_0x811b('0x12')+_0x461516+_0x811b('0x13')+JSON[_0x811b('0x14')](_0x3633ac);var _0x11d77d=_0x34b113+'?'+_0x113a98;return rp(_0x11d77d);})[_0x811b('0xd')](function(_0x59135e){logger[_0x811b('0x15')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x3002ed,_0x59135e);_0x41c9cf['stop']();})['catch'](function(_0x4c291a){logger[_0x811b('0x16')](_0x811b('0x17'),_0x3002ed,_['isObject'](_0x4c291a)?JSON[_0x811b('0x14')](_0x4c291a):_0x4c291a);_0x41c9cf[_0x811b('0x18')]();});}else{logger[_0x811b('0x15')](_0x811b('0x19'),_0x3002ed);_0x41c9cf[_0x811b('0x1a')]();}};}; \ 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 cc2ffd4..8865524 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x45caf6,_0x4f14ba){var _0x248aab=function(_0x11e5bc){while(--_0x11e5bc){_0x45caf6['push'](_0x45caf6['shift']());}};_0x248aab(++_0x4f14ba);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file +var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x3d951f,_0x585c72){var _0x10e119=function(_0x4215fa){while(--_0x4215fa){_0x3d951f['push'](_0x3d951f['shift']());}};_0x10e119(++_0x585c72);}(_0xe706,0xa3));var _0x6e70=function(_0x5f2acc,_0x47fcfd){_0x5f2acc=_0x5f2acc-0x0;var _0x1ec79c=_0xe706[_0x5f2acc];return _0x1ec79c;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index ea81582..010d27c 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 _0x5db8=['../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','isNil','IntervalId','map','Intervals','interval','listen','rules','channel','message','interaction','applications','isArray','length','join','app','.js','toLowerCase','autoreply','appdata','split','mail','push','slice','dialogflow','dialogflowv2','amazonlex','tag','tvox','account','notificationTemplate','ChatWebsiteId','ContactId','./interval','intervals','./applications/','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','agent','agents','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','busyQueue','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','chatQueues','available','name','paused','waiting','mailQueues','loggedIn','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','bluebird','uuid','./applications/utils','routing'];(function(_0x102243,_0x2b4dde){var _0x1d302c=function(_0x50c1fb){while(--_0x50c1fb){_0x102243['push'](_0x102243['shift']());}};_0x1d302c(++_0x2b4dde);}(_0x5db8,0xbb));var _0x85db=function(_0x599c44,_0x2fb16e){_0x599c44=_0x599c44-0x0;var _0x1d6cf6=_0x5db8[_0x599c44];return _0x1d6cf6;};'use strict';var _=require(_0x85db('0x0'));var util=require(_0x85db('0x1'));var path=require(_0x85db('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0x85db('0x3'));var uuid=require(_0x85db('0x4'));var utils=require(_0x85db('0x5'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x85db('0x6'));var rpc={'openchannelQueueReport':require(_0x85db('0x7')),'mailQueueReport':require(_0x85db('0x8')),'chatQueueReport':require(_0x85db('0x9')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x85db('0xa'))};var RuleEngine=require(_0x85db('0xb'));function getId(_0xc6fd00,_0x308988,_0x59a522){return util[_0x85db('0xc')]('%s.%s.%s',_0xc6fd00,_0x308988||0x0,_0x59a522||0x0);}function getIntervals(_0x18e5d1,_0x27819d){var _0x42c287=[];if(!_[_0x85db('0xd')](_0x27819d['IntervalId'])&&!_['isNil'](_0x18e5d1[_0x27819d['IntervalId']])&&!_[_0x85db('0xd')](_0x18e5d1[_0x27819d[_0x85db('0xe')]]['Intervals'])){_0x42c287=_[_0x85db('0xf')](_0x18e5d1[_0x27819d['IntervalId']][_0x85db('0x10')],_0x85db('0x11'));}else if(!_[_0x85db('0xd')](_0x27819d[_0x85db('0x11')])){_0x42c287=[_0x27819d[_0x85db('0x11')]];}return _0x42c287;}exports[_0x85db('0x12')]=function(_0x2b7507){_0x2b7507[_0x85db('0x13')]={};return new BPromise(function(_0x3ca181,_0x415281){var _0x1e9dec={'Start':function(_0x270fd7){var _0x2be61d=this;return new Promise(function(_0x5ccfef,_0x27bd65){if(_0x270fd7){try{var _0x175622=[];var _0x11e7da=getId(_0x270fd7[_0x85db('0x14')],_0x270fd7[_0x85db('0x15')]?_0x270fd7[_0x85db('0x15')]['id']:0x0,_0x270fd7[_0x85db('0x16')]?_0x270fd7['interaction']['id']:0x0);if(_0x270fd7[_0x85db('0x17')]&&_[_0x85db('0x18')](_0x270fd7[_0x85db('0x17')])&&_0x270fd7[_0x85db('0x17')][_0x85db('0x19')]){for(var _0x2bc9a4=0x0;_0x2bc9a4<_0x270fd7[_0x85db('0x17')][_0x85db('0x19')];_0x2bc9a4+=0x1){var _0x2b8f30=_0x270fd7[_0x85db('0x17')][_0x2bc9a4];if(fs['existsSync'](path[_0x85db('0x1a')](__dirname,_0x85db('0x17'),_0x2b8f30[_0x85db('0x1b')]+_0x85db('0x1c')))){var _0x44c122=[];switch(_0x2b8f30[_0x85db('0x1b')][_0x85db('0x1d')]()){case _0x85db('0x1e'):var _0x4e2755=_0x2b8f30[_0x85db('0x1f')][_0x85db('0x20')](',');if(_0x270fd7[_0x85db('0x14')]===_0x85db('0x21')){_0x44c122[_0x85db('0x22')](_0x4e2755[0x0]);_0x44c122[_0x85db('0x22')](_0x4e2755[0x1]);_0x44c122['push'](_0x4e2755[_0x85db('0x23')](0x2,_0x4e2755[_0x85db('0x19')])[_0x85db('0x1a')](','));}else{_0x44c122['push'](_0x4e2755[0x0]);_0x44c122['push'](_0x4e2755['slice'](0x1,_0x4e2755[_0x85db('0x19')])[_0x85db('0x1a')](','));}break;case _0x85db('0x24'):var _0x51b748=_0x2b8f30[_0x85db('0x1f')][_0x85db('0x20')](',');_0x44c122[_0x85db('0x22')](_0x51b748[0x0]);_0x44c122['push'](_0x51b748[0x1]);_0x44c122['push'](_0x51b748[_0x85db('0x23')](0x2,_0x51b748[_0x85db('0x19')])[_0x85db('0x1a')](','));break;case _0x85db('0x25'):var _0x397afc=_0x2b8f30[_0x85db('0x1f')][_0x85db('0x20')](',');_0x44c122[_0x85db('0x22')](_0x397afc[0x0]);_0x44c122[_0x85db('0x22')](_0x397afc[0x1]);_0x44c122[_0x85db('0x22')](_0x397afc[0x2]);_0x44c122['push'](_0x397afc[0x3]);_0x44c122['push'](_0x397afc[_0x85db('0x23')](0x4,_0x397afc['length'])[_0x85db('0x1a')](','));break;case _0x85db('0x26'):var _0x5abdb7=_0x2b8f30[_0x85db('0x1f')][_0x85db('0x20')](',');_0x44c122[_0x85db('0x22')](_0x5abdb7[0x0]);_0x44c122[_0x85db('0x22')](_0x5abdb7[0x1]);_0x44c122['push'](_0x5abdb7[0x2]);_0x44c122[_0x85db('0x22')](_0x5abdb7[0x3]);_0x44c122[_0x85db('0x22')](_0x5abdb7[_0x85db('0x23')](0x4,_0x5abdb7[_0x85db('0x19')])[_0x85db('0x1a')](','));break;case'message':_0x44c122[_0x85db('0x22')](_0x2b8f30[_0x85db('0x1f')]);break;case _0x85db('0x27'):_0x44c122[_0x85db('0x22')](_0x2b8f30['TagId']);_0x44c122[_0x85db('0x22')](_0x2b8f30[_0x85db('0x1f')]);break;case _0x85db('0x28'):var _0x536398=utils['getMustacheRender'](_0x270fd7[_0x85db('0x29')][_0x85db('0x2a')],_0x270fd7);var _0x4980b7=_0x2b8f30[_0x85db('0x1f')][_0x85db('0x20')](',');_0x44c122[_0x85db('0x22')](_0x4980b7[0x0]);_0x44c122[_0x85db('0x22')](_0x4980b7[0x1]);_0x44c122[_0x85db('0x22')](_0x4980b7[0x2]);_0x44c122[_0x85db('0x22')](_0x4980b7[0x3]);_0x44c122[_0x85db('0x22')](_0x4980b7[0x4]);_0x44c122[_0x85db('0x22')](_0x4980b7[0x5]);_0x44c122[_0x85db('0x22')](_0x4980b7[0x6]);_0x44c122[_0x85db('0x22')](_0x4980b7[0x7]);_0x44c122[_0x85db('0x22')](_0x4980b7[0x8]);_0x44c122[_0x85db('0x22')](_0x4980b7[0x9]);_0x44c122['push'](_0x4980b7[0xa]);_0x44c122[_0x85db('0x22')](_0x270fd7[_0x85db('0x16')]['id']);_0x44c122[_0x85db('0x22')](_0x270fd7[_0x85db('0x15')]['id']);_0x44c122['push'](_0x2b8f30[_0x85db('0x2b')]);_0x44c122[_0x85db('0x22')](_0x270fd7[_0x85db('0x16')][_0x85db('0x2c')]);_0x44c122['push'](_0x270fd7['body']['body']);_0x44c122['push'](_0x536398);break;default:_0x44c122=_['isNil'](_0x2b8f30[_0x85db('0x1f')])?[]:_0x2b8f30[_0x85db('0x1f')][_0x85db('0x20')](',');}var _0x17f649={'id':util[_0x85db('0xc')]('%s:%s:%s',_0x11e7da,_0x2b8f30['id'],_0x2b8f30['app']),'condition':require(_0x85db('0x2d'))['condition'](_0x11e7da,getIntervals(_0x2b7507[_0x85db('0x2e')],_0x2b8f30),_0x2b7507),'consequence':require(_0x85db('0x2f')+_0x2b8f30['app'])['consequence'](_0x11e7da,_0x44c122,_0x2b7507,_0x270fd7),'p':_0x2b8f30[_0x85db('0x30')]||0x0};logger[_0x85db('0x31')](_0x85db('0x32'),_0x17f649['id'],_0x85db('0x33'),getIntervals(_0x2b7507[_0x85db('0x2e')],_0x2b8f30)['join'](_0x85db('0x34')));_0x175622[_0x85db('0x22')](_0x17f649);}else{logger[_0x85db('0x35')]('Please\x20create\x20a\x20new\x20file\x20under',path['join'](__dirname,'applications',_0x2b8f30[_0x85db('0x1b')]+_0x85db('0x1c')));}}_0x2b7507[_0x85db('0x13')][_0x11e7da]=new RuleEngine(_0x175622);_0x2b7507['rules'][_0x11e7da]['execute'](_0x270fd7,function(_0x3e4dbc){logger['info'](_0x85db('0x36'),JSON[_0x85db('0x37')](_0x3e4dbc[_0x85db('0x38')]));if(_0x2b7507['rules'][_0x11e7da]){_0x2b7507[_0x85db('0x13')][_0x11e7da][_0x85db('0x39')](_0x85db('0x3a'));}});return _0x5ccfef({'code':0xc8,'message':_0x270fd7});}else{logger[_0x85db('0x31')](_0x85db('0x3b'));return _0x5ccfef({'code':0xc8,'message':_0x270fd7});}}catch(_0x1670fd){logger[_0x85db('0x35')](_0x1670fd[_0x85db('0x3c')]);return _0x27bd65(_0x2be61d[_0x85db('0x35')](0x1f4,_0x1670fd));}}return _0x27bd65('routing\x20is\x20empty');});},'AcceptMessage':function(_0x16a25f){var _0x1b9ab8=this;return new Promise(function(_0x30c7a0,_0x16d6b3){if(_0x16a25f[_0x85db('0x3d')]&&_0x16a25f[_0x85db('0x3d')]['id']){if(_0x2b7507['agents'][_0x16a25f[_0x85db('0x3d')]['id']]){_0x2b7507[_0x85db('0x3e')][_0x16a25f[_0x85db('0x3d')]['id']]['busy']=![];_0x2b7507['agents'][_0x16a25f[_0x85db('0x3d')]['id']]['busyQueue']=undefined;}}if(_0x16a25f[_0x85db('0x15')]&&_0x16a25f[_0x85db('0x15')]['id']){try{var _0x24afcd=getId(_0x16a25f[_0x85db('0x14')],_0x16a25f[_0x85db('0x15')]?_0x16a25f['message']['id']:0x0,_0x16a25f['interaction']?_0x16a25f[_0x85db('0x16')]['id']:0x0);if(_0x2b7507[_0x85db('0x13')][_0x24afcd]){_0x2b7507[_0x85db('0x13')][_0x24afcd][_0x85db('0x39')](_0x85db('0x3f'));if(rpc[_0x16a25f[_0x85db('0x14')]+_0x85db('0x40')]){rpc[_0x16a25f[_0x85db('0x14')]+_0x85db('0x40')][_0x85db('0x41')](_0x24afcd,{'UserId':_0x16a25f['message'][_0x85db('0x42')]})[_0x85db('0x43')](function(_0x54abf5){logger['error'](_0x85db('0x44'));});}}return _0x30c7a0({'code':0xc8,'message':_0x16a25f});}catch(_0x306be6){logger['error'](_0x306be6['stack']);return _0x16d6b3(_0x1b9ab8[_0x85db('0x35')](0x1f4,_0x306be6));}}logger[_0x85db('0x35')]('message\x20is\x20empty');return _0x16d6b3(_0x1b9ab8[_0x85db('0x35')](0x1f4,_0x85db('0x45')));});},'RejectMessage':function(_0x29df9e){var _0xd3cedb=this;return new Promise(function(_0x12b822,_0x2cddad){if(_0x29df9e[_0x85db('0x3d')]&&_0x29df9e[_0x85db('0x3d')]['id']){try{if(_0x2b7507[_0x85db('0x3e')][_0x29df9e[_0x85db('0x3d')]['id']]){_0x2b7507['agents'][_0x29df9e['agent']['id']][_0x85db('0x46')]=![];_0x2b7507[_0x85db('0x3e')][_0x29df9e[_0x85db('0x3d')]['id']][_0x85db('0x47')]=undefined;}return _0x12b822({'code':0xc8,'message':_0x29df9e});}catch(_0x2b77ce){logger[_0x85db('0x35')](_0x2b77ce[_0x85db('0x3c')]);return _0x2cddad(_0xd3cedb[_0x85db('0x35')](0x1f4,_0x2b77ce));}}logger[_0x85db('0x35')](_0x85db('0x45'));return _0x2cddad(_0xd3cedb[_0x85db('0x35')](0x1f4,_0x85db('0x45')));});},'AbandonInteraction':function(_0x198dad){var _0x425e61=this;return new Promise(function(_0x4b4742,_0x3df8ed){if(_0x198dad[_0x85db('0x14')]&&_0x198dad['interaction']&&_0x198dad[_0x85db('0x16')]['id']){try{var _0x40a009=getId(_0x198dad[_0x85db('0x14')],_0x198dad[_0x85db('0x15')]?_0x198dad[_0x85db('0x15')]['id']:0x0,_0x198dad[_0x85db('0x16')]?_0x198dad[_0x85db('0x16')]['id']:0x0);if(_0x2b7507['rules'][_0x40a009]){_0x2b7507[_0x85db('0x13')][_0x40a009][_0x85db('0x39')]('end');}return _0x4b4742({'code':0xc8,'message':_0x198dad});}catch(_0x5b38c6){logger[_0x85db('0x35')](_0x5b38c6['stack']);return _0x3df8ed(_0x425e61[_0x85db('0x35')](0x1f4,_0x5b38c6));}}logger[_0x85db('0x35')](_0x85db('0x45'));return _0x3df8ed(_0x425e61[_0x85db('0x35')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x247da4){var _0x5c634d=this;return new Promise(function(_0x5b950d,_0x493ab3){if(_0x2b7507[_0x85db('0x3e')][_0x85db('0x48')](_0x247da4['id'])){for(var _0x4fdec2 in _0x247da4[_0x85db('0x49')]){if(_0x247da4[_0x85db('0x49')]['hasOwnProperty'](_0x4fdec2)){if(_0x2b7507[_0x85db('0x3e')][_0x247da4['id']][_0x85db('0x48')](_0x4fdec2+_0x85db('0x4a'))){_0x2b7507[_0x85db('0x3e')][_0x247da4['id']][_0x4fdec2+_0x85db('0x4a')]=parseInt(_0x247da4[_0x85db('0x49')][_0x4fdec2],0xa);}}}_0x2b7507['agents'][_0x247da4['id']][_0x85db('0x4b')]();return _0x5b950d({'code':0xc8,'message':_0x2b7507[_0x85db('0x3e')][_0x247da4['id']]});}else{return _0x493ab3(_0x5c634d[_0x85db('0x35')](0x1f4,_0x85db('0x4c')));}});},'Agents':function(_0xff3b97){return new Promise(function(_0xfacd9e,_0x1c26a7){var _0x2b9da3=_['values'](_0x2b7507['agents']);_0xfacd9e({'count':_0x2b9da3['length'],'rows':_0x2b9da3});});},'ChatQueues':function(_0x4e5e2a){return new Promise(function(_0x16aac9,_0x38f37f){var _0x88626d=[];for(var _0x239027 in _0x2b7507[_0x85db('0x4d')]){if(_0x2b7507[_0x85db('0x4d')]['hasOwnProperty'](_0x239027)){var _0x367ebe=_0x2b7507[_0x85db('0x4d')][_0x239027];var _0x11bc25={'id':_0x367ebe['id'],'available':_0x367ebe[_0x85db('0x4e')],'loggedIn':_0x367ebe['loggedIn'],'name':_0x367ebe[_0x85db('0x4f')],'paused':_0x367ebe[_0x85db('0x50')],'waiting':_0x367ebe[_0x85db('0x51')]};_0x88626d[_0x85db('0x22')](_0x11bc25);}}_0x16aac9({'count':_0x88626d[_0x85db('0x19')],'rows':_0x88626d});});},'MailQueues':function(_0x2a7f1e){return new Promise(function(_0x4604e7,_0x2af26e){var _0x357a98=[];for(var _0x22559c in _0x2b7507['mailQueues']){if(_0x2b7507[_0x85db('0x52')][_0x85db('0x48')](_0x22559c)){var _0x40ccc6=_0x2b7507[_0x85db('0x52')][_0x22559c];var _0x1c37f4={'id':_0x40ccc6['id'],'available':_0x40ccc6['available'],'loggedIn':_0x40ccc6[_0x85db('0x53')],'name':_0x40ccc6[_0x85db('0x4f')],'paused':_0x40ccc6[_0x85db('0x50')],'waiting':_0x40ccc6[_0x85db('0x51')]};_0x357a98[_0x85db('0x22')](_0x1c37f4);}}_0x4604e7({'count':_0x357a98['length'],'rows':_0x357a98});});},'OpenchannelQueues':function(_0x1a9f92){return new Promise(function(_0x4213c3,_0x176e51){var _0x58ff0f=[];for(var _0xee1099 in _0x2b7507[_0x85db('0x54')]){if(_0x2b7507[_0x85db('0x54')]['hasOwnProperty'](_0xee1099)){var _0xbf277e=_0x2b7507[_0x85db('0x54')][_0xee1099];var _0x5b516d={'id':_0xbf277e['id'],'available':_0xbf277e[_0x85db('0x4e')],'loggedIn':_0xbf277e[_0x85db('0x53')],'name':_0xbf277e[_0x85db('0x4f')],'paused':_0xbf277e[_0x85db('0x50')],'waiting':_0xbf277e[_0x85db('0x51')]};_0x58ff0f[_0x85db('0x22')](_0x5b516d);}}_0x4213c3({'count':_0x58ff0f[_0x85db('0x19')],'rows':_0x58ff0f});});},'SmsQueues':function(_0xd96523){return new Promise(function(_0x22a37a,_0x27aa32){var _0xa4d981=[];for(var _0x3e81b6 in _0x2b7507[_0x85db('0x55')]){if(_0x2b7507[_0x85db('0x55')][_0x85db('0x48')](_0x3e81b6)){var _0x4da42e=_0x2b7507[_0x85db('0x55')][_0x3e81b6];var _0x2f7f7a={'id':_0x4da42e['id'],'available':_0x4da42e[_0x85db('0x4e')],'loggedIn':_0x4da42e[_0x85db('0x53')],'name':_0x4da42e['name'],'paused':_0x4da42e['paused'],'waiting':_0x4da42e[_0x85db('0x51')]};_0xa4d981['push'](_0x2f7f7a);}}_0x22a37a({'count':_0xa4d981[_0x85db('0x19')],'rows':_0xa4d981});});},'FaxQueues':function(_0x45cfd2){return new Promise(function(_0x3fc37e,_0x59bca4){var _0xf556b5=[];for(var _0x377eb6 in _0x2b7507[_0x85db('0x56')]){if(_0x2b7507[_0x85db('0x56')]['hasOwnProperty'](_0x377eb6)){var _0x28e203=_0x2b7507['faxQueues'][_0x377eb6];var _0x145c78={'id':_0x28e203['id'],'available':_0x28e203[_0x85db('0x4e')],'loggedIn':_0x28e203[_0x85db('0x53')],'name':_0x28e203[_0x85db('0x4f')],'paused':_0x28e203[_0x85db('0x50')],'waiting':_0x28e203[_0x85db('0x51')]};_0xf556b5[_0x85db('0x22')](_0x145c78);}}_0x3fc37e({'count':_0xf556b5[_0x85db('0x19')],'rows':_0xf556b5});});},'WhatsappQueues':function(_0x15895e){return new Promise(function(_0x1c57ca,_0x16df89){var _0x33440a=[];for(var _0x4369bd in _0x2b7507['whatsappQueues']){if(_0x2b7507[_0x85db('0x57')]['hasOwnProperty'](_0x4369bd)){var _0x2aeb7d=_0x2b7507[_0x85db('0x57')][_0x4369bd];var _0x4c1b81={'id':_0x2aeb7d['id'],'available':_0x2aeb7d[_0x85db('0x4e')],'loggedIn':_0x2aeb7d[_0x85db('0x53')],'name':_0x2aeb7d[_0x85db('0x4f')],'paused':_0x2aeb7d['paused'],'waiting':_0x2aeb7d[_0x85db('0x51')]};_0x33440a['push'](_0x4c1b81);}}_0x1c57ca({'count':_0x33440a[_0x85db('0x19')],'rows':_0x33440a});});},'ChatQueuesWaitingInteractions':function(_0x58382d){return new Promise(function(_0x2b6490,_0x2e68cc){var _0x542be6=_[_0x85db('0x58')](_0x2b7507[_0x85db('0x59')]);_0x2b6490({'count':_0x542be6[_0x85db('0x19')],'rows':_0x542be6});});},'MailQueuesWaitingInteractions':function(_0x23fb0f){return new Promise(function(_0x3dc1ab,_0x249e03){var _0x520315=_[_0x85db('0x58')](_0x2b7507[_0x85db('0x5a')]);_0x3dc1ab({'count':_0x520315[_0x85db('0x19')],'rows':_0x520315});});},'OpenchannelQueuesWaitingInteractions':function(_0x598e01){return new Promise(function(_0x3c92b3,_0x2c6f48){var _0x388fa4=_[_0x85db('0x58')](_0x2b7507[_0x85db('0x5b')]);_0x3c92b3({'count':_0x388fa4[_0x85db('0x19')],'rows':_0x388fa4});});},'SmsQueuesWaitingInteractions':function(_0x13fd5){return new Promise(function(_0x308537,_0x37d815){var _0x3cd417=_[_0x85db('0x58')](_0x2b7507['smsQueuesWaitingInteractions']);_0x308537({'count':_0x3cd417[_0x85db('0x19')],'rows':_0x3cd417});});},'FaxQueuesWaitingInteractions':function(_0x9c32f1){return new Promise(function(_0xdcb072,_0x53f137){var _0x17df73=_['values'](_0x2b7507[_0x85db('0x5c')]);_0xdcb072({'count':_0x17df73['length'],'rows':_0x17df73});});},'WhatsappQueuesWaitingInteractions':function(_0x1cbd17){return new Promise(function(_0x48425e,_0xdedf9e){var _0x5c6028=_[_0x85db('0x58')](_0x2b7507[_0x85db('0x5d')]);_0x48425e({'count':_0x5c6028['length'],'rows':_0x5c6028});});}};var _0x565d66=jayson['server'](_0x1e9dec)['http']();_0x565d66['on'](_0x85db('0x35'),function(_0x10352e){logger[_0x85db('0x35')](JSON[_0x85db('0x37')](_0x10352e));return _0x415281(_0x10352e);});_0x565d66[_0x85db('0x12')](0x232c,_0x85db('0x5e'),function(){console['log'](_0x85db('0x5f'),0x232c);return _0x3ca181(_0x85db('0x60')+0x232c);});});}; \ No newline at end of file +var _0x5ff3=['../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','isNil','IntervalId','map','Intervals','interval','listen','rules','channel','message','interaction','isArray','applications','length','existsSync','join','app','toLowerCase','autoreply','appdata','split','mail','push','slice','dialogflow','dialogflowv2','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','ContactId','body','%s:%s:%s','./interval','condition','./applications/','consequence','priority','info','Push\x20new\x20rule','\x20|\x20','error','.js','execute','stringify','matchPath','emit','complete','stack','agent','agents','busy','busyQueue','end','QueueReport','update','UserId','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','loggedIn','waiting','mailQueues','available','name','paused','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','jayson/promise','uuid','./applications/utils','../../../config/environment','../../../config/logger','../rpc/openchannelQueueReport'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x5ff3,0x17d));var _0x35ff=function(_0x596a87,_0x2fc9c2){_0x596a87=_0x596a87-0x0;var _0x3b8c72=_0x5ff3[_0x596a87];return _0x3b8c72;};'use strict';var _=require('lodash');var util=require(_0x35ff('0x0'));var path=require('path');var fs=require('fs');var jayson=require(_0x35ff('0x1'));var BPromise=require('bluebird');var uuid=require(_0x35ff('0x2'));var utils=require(_0x35ff('0x3'));var config=require(_0x35ff('0x4'));var logger=require(_0x35ff('0x5'))('routing');var rpc={'openchannelQueueReport':require(_0x35ff('0x6')),'mailQueueReport':require(_0x35ff('0x7')),'chatQueueReport':require(_0x35ff('0x8')),'smsQueueReport':require(_0x35ff('0x9')),'faxQueueReport':require(_0x35ff('0xa')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x35ff('0xb'));function getId(_0x4c9fab,_0x2e7470,_0xfcec34){return util[_0x35ff('0xc')]('%s.%s.%s',_0x4c9fab,_0x2e7470||0x0,_0xfcec34||0x0);}function getIntervals(_0x20647e,_0x59ec4f){var _0x1cd2c6=[];if(!_[_0x35ff('0xd')](_0x59ec4f['IntervalId'])&&!_['isNil'](_0x20647e[_0x59ec4f[_0x35ff('0xe')]])&&!_['isNil'](_0x20647e[_0x59ec4f['IntervalId']]['Intervals'])){_0x1cd2c6=_[_0x35ff('0xf')](_0x20647e[_0x59ec4f[_0x35ff('0xe')]][_0x35ff('0x10')],_0x35ff('0x11'));}else if(!_['isNil'](_0x59ec4f[_0x35ff('0x11')])){_0x1cd2c6=[_0x59ec4f[_0x35ff('0x11')]];}return _0x1cd2c6;}exports[_0x35ff('0x12')]=function(_0x4d1d41){_0x4d1d41[_0x35ff('0x13')]={};return new BPromise(function(_0xbdd133,_0x254975){var _0x3e24dd={'Start':function(_0x438199){var _0x3dff65=this;return new Promise(function(_0x2d4a88,_0x28def2){if(_0x438199){try{var _0x30b5bf=[];var _0x2f3456=getId(_0x438199[_0x35ff('0x14')],_0x438199[_0x35ff('0x15')]?_0x438199[_0x35ff('0x15')]['id']:0x0,_0x438199[_0x35ff('0x16')]?_0x438199[_0x35ff('0x16')]['id']:0x0);if(_0x438199['applications']&&_[_0x35ff('0x17')](_0x438199[_0x35ff('0x18')])&&_0x438199[_0x35ff('0x18')][_0x35ff('0x19')]){for(var _0x567bcb=0x0;_0x567bcb<_0x438199['applications'][_0x35ff('0x19')];_0x567bcb+=0x1){var _0x194eeb=_0x438199['applications'][_0x567bcb];if(fs[_0x35ff('0x1a')](path[_0x35ff('0x1b')](__dirname,_0x35ff('0x18'),_0x194eeb[_0x35ff('0x1c')]+'.js'))){var _0x3d60b4=[];switch(_0x194eeb['app'][_0x35ff('0x1d')]()){case _0x35ff('0x1e'):var _0x29cd2e=_0x194eeb[_0x35ff('0x1f')][_0x35ff('0x20')](',');if(_0x438199[_0x35ff('0x14')]===_0x35ff('0x21')){_0x3d60b4['push'](_0x29cd2e[0x0]);_0x3d60b4[_0x35ff('0x22')](_0x29cd2e[0x1]);_0x3d60b4[_0x35ff('0x22')](_0x29cd2e['slice'](0x2,_0x29cd2e[_0x35ff('0x19')])['join'](','));}else{_0x3d60b4['push'](_0x29cd2e[0x0]);_0x3d60b4[_0x35ff('0x22')](_0x29cd2e[_0x35ff('0x23')](0x1,_0x29cd2e[_0x35ff('0x19')])[_0x35ff('0x1b')](','));}break;case _0x35ff('0x24'):var _0x546ec0=_0x194eeb[_0x35ff('0x1f')][_0x35ff('0x20')](',');_0x3d60b4[_0x35ff('0x22')](_0x546ec0[0x0]);_0x3d60b4['push'](_0x546ec0[0x1]);_0x3d60b4[_0x35ff('0x22')](_0x546ec0[_0x35ff('0x23')](0x2,_0x546ec0[_0x35ff('0x19')])[_0x35ff('0x1b')](','));break;case _0x35ff('0x25'):var _0x61b554=_0x194eeb[_0x35ff('0x1f')][_0x35ff('0x20')](',');_0x3d60b4[_0x35ff('0x22')](_0x61b554[0x0]);_0x3d60b4['push'](_0x61b554[0x1]);_0x3d60b4[_0x35ff('0x22')](_0x61b554[0x2]);_0x3d60b4['push'](_0x61b554[0x3]);_0x3d60b4[_0x35ff('0x22')](_0x61b554[_0x35ff('0x23')](0x4,_0x61b554[_0x35ff('0x19')])[_0x35ff('0x1b')](','));break;case'amazonlex':var _0x182b71=_0x194eeb['appdata'][_0x35ff('0x20')](',');_0x3d60b4[_0x35ff('0x22')](_0x182b71[0x0]);_0x3d60b4['push'](_0x182b71[0x1]);_0x3d60b4['push'](_0x182b71[0x2]);_0x3d60b4[_0x35ff('0x22')](_0x182b71[0x3]);_0x3d60b4[_0x35ff('0x22')](_0x182b71['slice'](0x4,_0x182b71[_0x35ff('0x19')])[_0x35ff('0x1b')](','));break;case'message':_0x3d60b4[_0x35ff('0x22')](_0x194eeb[_0x35ff('0x1f')]);break;case _0x35ff('0x26'):_0x3d60b4[_0x35ff('0x22')](_0x194eeb[_0x35ff('0x27')]);_0x3d60b4[_0x35ff('0x22')](_0x194eeb[_0x35ff('0x1f')]);break;case _0x35ff('0x28'):var _0x35a3c7=utils[_0x35ff('0x29')](_0x438199[_0x35ff('0x2a')][_0x35ff('0x2b')],_0x438199);var _0x41b48d=_0x194eeb['appdata'][_0x35ff('0x20')](',');_0x3d60b4['push'](_0x41b48d[0x0]);_0x3d60b4[_0x35ff('0x22')](_0x41b48d[0x1]);_0x3d60b4[_0x35ff('0x22')](_0x41b48d[0x2]);_0x3d60b4[_0x35ff('0x22')](_0x41b48d[0x3]);_0x3d60b4[_0x35ff('0x22')](_0x41b48d[0x4]);_0x3d60b4[_0x35ff('0x22')](_0x41b48d[0x5]);_0x3d60b4['push'](_0x41b48d[0x6]);_0x3d60b4[_0x35ff('0x22')](_0x41b48d[0x7]);_0x3d60b4[_0x35ff('0x22')](_0x41b48d[0x8]);_0x3d60b4[_0x35ff('0x22')](_0x41b48d[0x9]);_0x3d60b4[_0x35ff('0x22')](_0x41b48d[0xa]);_0x3d60b4[_0x35ff('0x22')](_0x438199['interaction']['id']);_0x3d60b4[_0x35ff('0x22')](_0x438199[_0x35ff('0x15')]['id']);_0x3d60b4[_0x35ff('0x22')](_0x194eeb['ChatWebsiteId']);_0x3d60b4['push'](_0x438199[_0x35ff('0x16')][_0x35ff('0x2c')]);_0x3d60b4[_0x35ff('0x22')](_0x438199[_0x35ff('0x2d')][_0x35ff('0x2d')]);_0x3d60b4[_0x35ff('0x22')](_0x35a3c7);break;default:_0x3d60b4=_[_0x35ff('0xd')](_0x194eeb[_0x35ff('0x1f')])?[]:_0x194eeb['appdata']['split'](',');}var _0x550c09={'id':util[_0x35ff('0xc')](_0x35ff('0x2e'),_0x2f3456,_0x194eeb['id'],_0x194eeb[_0x35ff('0x1c')]),'condition':require(_0x35ff('0x2f'))[_0x35ff('0x30')](_0x2f3456,getIntervals(_0x4d1d41['intervals'],_0x194eeb),_0x4d1d41),'consequence':require(_0x35ff('0x31')+_0x194eeb[_0x35ff('0x1c')])[_0x35ff('0x32')](_0x2f3456,_0x3d60b4,_0x4d1d41,_0x438199),'p':_0x194eeb[_0x35ff('0x33')]||0x0};logger[_0x35ff('0x34')](_0x35ff('0x35'),_0x550c09['id'],'on\x20interval',getIntervals(_0x4d1d41['intervals'],_0x194eeb)[_0x35ff('0x1b')](_0x35ff('0x36')));_0x30b5bf[_0x35ff('0x22')](_0x550c09);}else{logger[_0x35ff('0x37')]('Please\x20create\x20a\x20new\x20file\x20under',path['join'](__dirname,_0x35ff('0x18'),_0x194eeb[_0x35ff('0x1c')]+_0x35ff('0x38')));}}_0x4d1d41[_0x35ff('0x13')][_0x2f3456]=new RuleEngine(_0x30b5bf);_0x4d1d41[_0x35ff('0x13')][_0x2f3456][_0x35ff('0x39')](_0x438199,function(_0x346758){logger['info']('Applications\x20executed',JSON[_0x35ff('0x3a')](_0x346758[_0x35ff('0x3b')]));if(_0x4d1d41[_0x35ff('0x13')][_0x2f3456]){_0x4d1d41['rules'][_0x2f3456][_0x35ff('0x3c')](_0x35ff('0x3d'));}});return _0x2d4a88({'code':0xc8,'message':_0x438199});}else{logger['info']('No\x20applications\x20to\x20execute');return _0x2d4a88({'code':0xc8,'message':_0x438199});}}catch(_0x14a44f){logger['error'](_0x14a44f[_0x35ff('0x3e')]);return _0x28def2(_0x3dff65[_0x35ff('0x37')](0x1f4,_0x14a44f));}}return _0x28def2('routing\x20is\x20empty');});},'AcceptMessage':function(_0x2ecbb8){var _0x4b1b86=this;return new Promise(function(_0x53c3c7,_0x20f4c4){if(_0x2ecbb8[_0x35ff('0x3f')]&&_0x2ecbb8[_0x35ff('0x3f')]['id']){if(_0x4d1d41[_0x35ff('0x40')][_0x2ecbb8[_0x35ff('0x3f')]['id']]){_0x4d1d41[_0x35ff('0x40')][_0x2ecbb8[_0x35ff('0x3f')]['id']][_0x35ff('0x41')]=![];_0x4d1d41[_0x35ff('0x40')][_0x2ecbb8[_0x35ff('0x3f')]['id']][_0x35ff('0x42')]=undefined;}}if(_0x2ecbb8[_0x35ff('0x15')]&&_0x2ecbb8['message']['id']){try{var _0xfac535=getId(_0x2ecbb8[_0x35ff('0x14')],_0x2ecbb8[_0x35ff('0x15')]?_0x2ecbb8[_0x35ff('0x15')]['id']:0x0,_0x2ecbb8['interaction']?_0x2ecbb8['interaction']['id']:0x0);if(_0x4d1d41[_0x35ff('0x13')][_0xfac535]){_0x4d1d41['rules'][_0xfac535][_0x35ff('0x3c')](_0x35ff('0x43'));if(rpc[_0x2ecbb8[_0x35ff('0x14')]+_0x35ff('0x44')]){rpc[_0x2ecbb8[_0x35ff('0x14')]+_0x35ff('0x44')][_0x35ff('0x45')](_0xfac535,{'UserId':_0x2ecbb8[_0x35ff('0x15')][_0x35ff('0x46')]})['catch'](function(_0x48e22b){logger[_0x35ff('0x37')]('error\x20update\x20queue\x20report');});}}return _0x53c3c7({'code':0xc8,'message':_0x2ecbb8});}catch(_0x309fe1){logger[_0x35ff('0x37')](_0x309fe1[_0x35ff('0x3e')]);return _0x20f4c4(_0x4b1b86[_0x35ff('0x37')](0x1f4,_0x309fe1));}}logger[_0x35ff('0x37')](_0x35ff('0x47'));return _0x20f4c4(_0x4b1b86[_0x35ff('0x37')](0x1f4,_0x35ff('0x47')));});},'RejectMessage':function(_0xc93bcf){var _0x5b8f52=this;return new Promise(function(_0x3aa649,_0x39b65f){if(_0xc93bcf[_0x35ff('0x3f')]&&_0xc93bcf[_0x35ff('0x3f')]['id']){try{if(_0x4d1d41['agents'][_0xc93bcf['agent']['id']]){_0x4d1d41['agents'][_0xc93bcf[_0x35ff('0x3f')]['id']][_0x35ff('0x41')]=![];_0x4d1d41[_0x35ff('0x40')][_0xc93bcf['agent']['id']][_0x35ff('0x42')]=undefined;}return _0x3aa649({'code':0xc8,'message':_0xc93bcf});}catch(_0x5943fc){logger[_0x35ff('0x37')](_0x5943fc['stack']);return _0x39b65f(_0x5b8f52[_0x35ff('0x37')](0x1f4,_0x5943fc));}}logger[_0x35ff('0x37')](_0x35ff('0x47'));return _0x39b65f(_0x5b8f52[_0x35ff('0x37')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x497b38){var _0x2be86b=this;return new Promise(function(_0x52e0b7,_0x241263){if(_0x497b38[_0x35ff('0x14')]&&_0x497b38['interaction']&&_0x497b38[_0x35ff('0x16')]['id']){try{var _0x567be6=getId(_0x497b38[_0x35ff('0x14')],_0x497b38[_0x35ff('0x15')]?_0x497b38[_0x35ff('0x15')]['id']:0x0,_0x497b38[_0x35ff('0x16')]?_0x497b38[_0x35ff('0x16')]['id']:0x0);if(_0x4d1d41[_0x35ff('0x13')][_0x567be6]){_0x4d1d41['rules'][_0x567be6]['emit'](_0x35ff('0x43'));}return _0x52e0b7({'code':0xc8,'message':_0x497b38});}catch(_0x340ed8){logger['error'](_0x340ed8[_0x35ff('0x3e')]);return _0x241263(_0x2be86b[_0x35ff('0x37')](0x1f4,_0x340ed8));}}logger['error'](_0x35ff('0x47'));return _0x241263(_0x2be86b[_0x35ff('0x37')](0x1f4,_0x35ff('0x47')));});},'AgentCapacity':function(_0x4580b5){var _0xa658b8=this;return new Promise(function(_0x585941,_0x4af4cb){if(_0x4d1d41['agents'][_0x35ff('0x48')](_0x4580b5['id'])){for(var _0x5cc611 in _0x4580b5[_0x35ff('0x49')]){if(_0x4580b5['capacity'][_0x35ff('0x48')](_0x5cc611)){if(_0x4d1d41[_0x35ff('0x40')][_0x4580b5['id']][_0x35ff('0x48')](_0x5cc611+_0x35ff('0x4a'))){_0x4d1d41[_0x35ff('0x40')][_0x4580b5['id']][_0x5cc611+_0x35ff('0x4a')]=parseInt(_0x4580b5['capacity'][_0x5cc611],0xa);}}}_0x4d1d41[_0x35ff('0x40')][_0x4580b5['id']][_0x35ff('0x4b')]();return _0x585941({'code':0xc8,'message':_0x4d1d41['agents'][_0x4580b5['id']]});}else{return _0x4af4cb(_0xa658b8[_0x35ff('0x37')](0x1f4,_0x35ff('0x4c')));}});},'Agents':function(_0x2caee5){return new Promise(function(_0xc1dfec,_0x3aeea1){var _0x17e37a=_[_0x35ff('0x4d')](_0x4d1d41[_0x35ff('0x40')]);_0xc1dfec({'count':_0x17e37a[_0x35ff('0x19')],'rows':_0x17e37a});});},'ChatQueues':function(_0x59a4d7){return new Promise(function(_0x33f6c2,_0x33f8e7){var _0x36e8d1=[];for(var _0x2f9107 in _0x4d1d41[_0x35ff('0x4e')]){if(_0x4d1d41[_0x35ff('0x4e')]['hasOwnProperty'](_0x2f9107)){var _0x27433f=_0x4d1d41[_0x35ff('0x4e')][_0x2f9107];var _0xd286b5={'id':_0x27433f['id'],'available':_0x27433f['available'],'loggedIn':_0x27433f[_0x35ff('0x4f')],'name':_0x27433f['name'],'paused':_0x27433f['paused'],'waiting':_0x27433f[_0x35ff('0x50')]};_0x36e8d1[_0x35ff('0x22')](_0xd286b5);}}_0x33f6c2({'count':_0x36e8d1['length'],'rows':_0x36e8d1});});},'MailQueues':function(_0x42c1e3){return new Promise(function(_0x305f15,_0x36e334){var _0x974edb=[];for(var _0x3a8026 in _0x4d1d41[_0x35ff('0x51')]){if(_0x4d1d41[_0x35ff('0x51')][_0x35ff('0x48')](_0x3a8026)){var _0x1f9c70=_0x4d1d41[_0x35ff('0x51')][_0x3a8026];var _0x32befe={'id':_0x1f9c70['id'],'available':_0x1f9c70[_0x35ff('0x52')],'loggedIn':_0x1f9c70[_0x35ff('0x4f')],'name':_0x1f9c70[_0x35ff('0x53')],'paused':_0x1f9c70[_0x35ff('0x54')],'waiting':_0x1f9c70[_0x35ff('0x50')]};_0x974edb['push'](_0x32befe);}}_0x305f15({'count':_0x974edb[_0x35ff('0x19')],'rows':_0x974edb});});},'OpenchannelQueues':function(_0x229ca2){return new Promise(function(_0x52836d,_0x392192){var _0x44321f=[];for(var _0x4ab942 in _0x4d1d41['openchannelQueues']){if(_0x4d1d41[_0x35ff('0x55')]['hasOwnProperty'](_0x4ab942)){var _0x3f87a6=_0x4d1d41[_0x35ff('0x55')][_0x4ab942];var _0x256db1={'id':_0x3f87a6['id'],'available':_0x3f87a6[_0x35ff('0x52')],'loggedIn':_0x3f87a6[_0x35ff('0x4f')],'name':_0x3f87a6[_0x35ff('0x53')],'paused':_0x3f87a6[_0x35ff('0x54')],'waiting':_0x3f87a6[_0x35ff('0x50')]};_0x44321f[_0x35ff('0x22')](_0x256db1);}}_0x52836d({'count':_0x44321f['length'],'rows':_0x44321f});});},'SmsQueues':function(_0x33d816){return new Promise(function(_0x47aa3c,_0x249d3e){var _0x5232b6=[];for(var _0x461c90 in _0x4d1d41[_0x35ff('0x56')]){if(_0x4d1d41[_0x35ff('0x56')][_0x35ff('0x48')](_0x461c90)){var _0x334912=_0x4d1d41['smsQueues'][_0x461c90];var _0x2efec7={'id':_0x334912['id'],'available':_0x334912[_0x35ff('0x52')],'loggedIn':_0x334912['loggedIn'],'name':_0x334912['name'],'paused':_0x334912[_0x35ff('0x54')],'waiting':_0x334912[_0x35ff('0x50')]};_0x5232b6['push'](_0x2efec7);}}_0x47aa3c({'count':_0x5232b6[_0x35ff('0x19')],'rows':_0x5232b6});});},'FaxQueues':function(_0x2f4c76){return new Promise(function(_0x29fac0,_0x57651d){var _0x1c5878=[];for(var _0x4152d9 in _0x4d1d41[_0x35ff('0x57')]){if(_0x4d1d41['faxQueues'][_0x35ff('0x48')](_0x4152d9)){var _0x3aa87f=_0x4d1d41[_0x35ff('0x57')][_0x4152d9];var _0x419346={'id':_0x3aa87f['id'],'available':_0x3aa87f[_0x35ff('0x52')],'loggedIn':_0x3aa87f['loggedIn'],'name':_0x3aa87f[_0x35ff('0x53')],'paused':_0x3aa87f[_0x35ff('0x54')],'waiting':_0x3aa87f[_0x35ff('0x50')]};_0x1c5878[_0x35ff('0x22')](_0x419346);}}_0x29fac0({'count':_0x1c5878[_0x35ff('0x19')],'rows':_0x1c5878});});},'WhatsappQueues':function(_0x3a5a51){return new Promise(function(_0x2b292b,_0x580541){var _0x37d751=[];for(var _0x1ec20e in _0x4d1d41[_0x35ff('0x58')]){if(_0x4d1d41[_0x35ff('0x58')][_0x35ff('0x48')](_0x1ec20e)){var _0x20f3ee=_0x4d1d41[_0x35ff('0x58')][_0x1ec20e];var _0x4bd7ec={'id':_0x20f3ee['id'],'available':_0x20f3ee[_0x35ff('0x52')],'loggedIn':_0x20f3ee['loggedIn'],'name':_0x20f3ee[_0x35ff('0x53')],'paused':_0x20f3ee[_0x35ff('0x54')],'waiting':_0x20f3ee[_0x35ff('0x50')]};_0x37d751[_0x35ff('0x22')](_0x4bd7ec);}}_0x2b292b({'count':_0x37d751[_0x35ff('0x19')],'rows':_0x37d751});});},'ChatQueuesWaitingInteractions':function(_0x58695e){return new Promise(function(_0x5c6a0e,_0x2332d6){var _0x5372f3=_[_0x35ff('0x4d')](_0x4d1d41[_0x35ff('0x59')]);_0x5c6a0e({'count':_0x5372f3[_0x35ff('0x19')],'rows':_0x5372f3});});},'MailQueuesWaitingInteractions':function(_0x24b043){return new Promise(function(_0x2b9867,_0x13fb06){var _0x28b90e=_['values'](_0x4d1d41[_0x35ff('0x5a')]);_0x2b9867({'count':_0x28b90e['length'],'rows':_0x28b90e});});},'OpenchannelQueuesWaitingInteractions':function(_0x14a477){return new Promise(function(_0x4ee366,_0x16b60c){var _0x385248=_[_0x35ff('0x4d')](_0x4d1d41['openchannelQueuesWaitingInteractions']);_0x4ee366({'count':_0x385248['length'],'rows':_0x385248});});},'SmsQueuesWaitingInteractions':function(_0x8e891c){return new Promise(function(_0x26267f,_0x4aa6c7){var _0xf9c766=_[_0x35ff('0x4d')](_0x4d1d41['smsQueuesWaitingInteractions']);_0x26267f({'count':_0xf9c766[_0x35ff('0x19')],'rows':_0xf9c766});});},'FaxQueuesWaitingInteractions':function(_0x34abde){return new Promise(function(_0x471878,_0x9c339a){var _0x1069bf=_[_0x35ff('0x4d')](_0x4d1d41[_0x35ff('0x5b')]);_0x471878({'count':_0x1069bf[_0x35ff('0x19')],'rows':_0x1069bf});});},'WhatsappQueuesWaitingInteractions':function(_0x5cce62){return new Promise(function(_0x1305e1,_0x298566){var _0x5a4cff=_[_0x35ff('0x4d')](_0x4d1d41['whatsappQueuesWaitingInteractions']);_0x1305e1({'count':_0x5a4cff[_0x35ff('0x19')],'rows':_0x5a4cff});});}};var _0x4fd616=jayson[_0x35ff('0x5c')](_0x3e24dd)[_0x35ff('0x5d')]();_0x4fd616['on'](_0x35ff('0x37'),function(_0x2fa388){logger[_0x35ff('0x37')](JSON[_0x35ff('0x3a')](_0x2fa388));return _0x254975(_0x2fa388);});_0x4fd616['listen'](0x232c,_0x35ff('0x5e'),function(){console['log'](_0x35ff('0x5f'),0x232c);return _0xbdd133(_0x35ff('0x60')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 0261605..4bfb6c3 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 _0x87b7=['catch','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','push','format','iftime\x20%s','true','[%s][INTERVAL]\x20%s','some','info','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','jayson/promise','lodash','client','request','then','error','message'];(function(_0x741d19,_0x4c825d){var _0x4d8806=function(_0x296815){while(--_0x296815){_0x741d19['push'](_0x741d19['shift']());}};_0x4d8806(++_0x4c825d);}(_0x87b7,0x191));var _0x787b=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x87b7[_0x39096d];return _0x13da4f;};'use strict';var util=require('util');var BPromise=require('bluebird');var jayson=require(_0x787b('0x0'));var _=require(_0x787b('0x1'));var logger=require('../../../config/logger')('routing');var client=jayson[_0x787b('0x2')]['http']({'port':0x232a});function request(_0x45eb44,_0x15fc70){return new BPromise(function(_0x1b5e52,_0x3a36e3){return client[_0x787b('0x3')](_0x45eb44,_0x15fc70)[_0x787b('0x4')](function(_0x3f8e6b){if(_0x3f8e6b['error']){return _0x3a36e3(_0x3f8e6b[_0x787b('0x5')][_0x787b('0x6')]);}else{return _0x1b5e52(_0x3f8e6b['result']);}})[_0x787b('0x7')](function(_0x32893a){return _0x3a36e3(_0x32893a);});});}exports['condition']=function(_0x15bab3,_0x55fb89,_0x1b432c){return function(_0x2ad12e){if(_0x1b432c['rules']&&!_0x1b432c[_0x787b('0x8')][_0x15bab3]){logger['info'](_0x787b('0x9'),_0x15bab3);return _0x2ad12e['stop']();}var _0x1cc708=[];for(var _0x590fa8=0x0;_0x590fa8<_0x55fb89[_0x787b('0xa')];_0x590fa8+=0x1){_0x1cc708[_0x787b('0xb')](request('Command',{'command':util[_0x787b('0xc')](_0x787b('0xd'),_0x55fb89[_0x590fa8])})[_0x787b('0x4')](function(_0x330dc8){return _0x330dc8&&_0x330dc8[_0x787b('0x6')]&&_0x330dc8[_0x787b('0x6')]['indexOf'](_0x787b('0xe'))>=0x0?!![]:![];})['catch'](function(_0x586b15){logger[_0x787b('0x5')](_0x787b('0xf'),_0x15bab3,_0x55fb89[_0x590fa8]);}));}BPromise['all'](_0x1cc708)[_0x787b('0x4')](function(_0x120d71){var _0x4a88d1=_[_0x787b('0x10')](_0x120d71);logger[_0x787b('0x11')](_0x787b('0x12'),_0x15bab3,_0x55fb89[_0x787b('0x13')](_0x787b('0x14')),_0x4a88d1);_0x2ad12e[_0x787b('0x15')](_0x4a88d1);})['catch'](function(_0x41cec1){console[_0x787b('0x16')](_0x41cec1);logger[_0x787b('0x5')]('[%s][INTERVAL]\x20%s\x20%s',_0x15bab3,_0x55fb89['join'](_0x787b('0x14')),_0x41cec1[_0x787b('0x17')]);_0x2ad12e['stop']();});};}; \ No newline at end of file +var _0x6108=['length','push','Command','format','iftime\x20%s','indexOf','true','catch','[%s][INTERVAL]\x20%s','all','join','when','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','stop','jayson/promise','lodash','http','request','then','error','message','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6108,0x91));var _0x8610=function(_0x1206bd,_0x1e92d5){_0x1206bd=_0x1206bd-0x0;var _0x34de19=_0x6108[_0x1206bd];return _0x34de19;};'use strict';var util=require('util');var BPromise=require('bluebird');var jayson=require(_0x8610('0x0'));var _=require(_0x8610('0x1'));var logger=require('../../../config/logger')('routing');var client=jayson['client'][_0x8610('0x2')]({'port':0x232a});function request(_0x1eec53,_0x5a2104){return new BPromise(function(_0x46400,_0x1a477d){return client[_0x8610('0x3')](_0x1eec53,_0x5a2104)[_0x8610('0x4')](function(_0x3e7bbb){if(_0x3e7bbb['error']){return _0x1a477d(_0x3e7bbb[_0x8610('0x5')][_0x8610('0x6')]);}else{return _0x46400(_0x3e7bbb['result']);}})['catch'](function(_0x262e35){return _0x1a477d(_0x262e35);});});}exports[_0x8610('0x7')]=function(_0x331882,_0x3d7353,_0x4cb9f8){return function(_0x3f8bce){if(_0x4cb9f8[_0x8610('0x8')]&&!_0x4cb9f8[_0x8610('0x8')][_0x331882]){logger[_0x8610('0x9')](_0x8610('0xa'),_0x331882);return _0x3f8bce['stop']();}var _0x544f03=[];for(var _0x35e903=0x0;_0x35e903<_0x3d7353[_0x8610('0xb')];_0x35e903+=0x1){_0x544f03[_0x8610('0xc')](request(_0x8610('0xd'),{'command':util[_0x8610('0xe')](_0x8610('0xf'),_0x3d7353[_0x35e903])})['then'](function(_0x136488){return _0x136488&&_0x136488['message']&&_0x136488[_0x8610('0x6')][_0x8610('0x10')](_0x8610('0x11'))>=0x0?!![]:![];})[_0x8610('0x12')](function(_0x87bc05){logger[_0x8610('0x5')](_0x8610('0x13'),_0x331882,_0x3d7353[_0x35e903]);}));}BPromise[_0x8610('0x14')](_0x544f03)[_0x8610('0x4')](function(_0xccf1b3){var _0x52d466=_['some'](_0xccf1b3);logger[_0x8610('0x9')]('[%s][INTERVAL]\x20%s\x20%s',_0x331882,_0x3d7353[_0x8610('0x15')]('\x20|\x20'),_0x52d466);_0x3f8bce[_0x8610('0x16')](_0x52d466);})[_0x8610('0x12')](function(_0x4b1724){console['log'](_0x4b1724);logger[_0x8610('0x5')](_0x8610('0x17'),_0x331882,_0x3d7353['join'](_0x8610('0x18')),_0x4b1724['stack']);_0x3f8bce[_0x8610('0x19')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 43d4864..52477e0 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 _0xbf6e=['[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','membername','interface','calleridnum','connectedlinenum','lastevent','then','type','agentacw','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','destuniqueid','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','reason','holdtime','talktime','push','queuecallerabandon','includes','[%s][agents][queuecallerabandon]','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','ringtime','forIn','answered_elsewhere','answeredelsewheredestinationuniqueid','isNil','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcomplete','agentcompleteAt','diffTime','complete','blindtransfer','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','transferexten','transferuniqueid','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','ATTENDED','transfertargetuniqueid','[%s][agents][attendedtransfer]','hangup','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','agent','[%s][agents][hangup]','./utils','info','format'];(function(_0xe7318d,_0x1e81d0){var _0x47ea64=function(_0x5adc0f){while(--_0x5adc0f){_0xe7318d['push'](_0xe7318d['shift']());}};_0x47ea64(++_0x1e81d0);}(_0xbf6e,0x149));var _0xebf6=function(_0x389723,_0x413288){_0x389723=_0x389723-0x0;var _0x9bdfe5=_0xbf6e[_0x389723];return _0x9bdfe5;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xebf6('0x0'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x2b658d,_0x14bf01){utils[_0xebf6('0x1')](util[_0xebf6('0x2')](_0xebf6('0x3'),_0x2b658d[_0xebf6('0x4')],_0x2b658d['channel'],_0x2b658d[_0xebf6('0x5')],_0x2b658d[_0xebf6('0x6')],_0x2b658d[_0xebf6('0x7')],_0x2b658d[_0xebf6('0x8')],_0x2b658d[_0xebf6('0x9')],_0x2b658d[_0xebf6('0xa')]));if(_0x2b658d[_0xebf6('0x5')]){utils['getVoiceQueueByName'](_0x2b658d[_0xebf6('0x5')])[_0xebf6('0xb')](function(_0x12ed12){if(_0x12ed12){_0x2b658d['type']=_0x12ed12[_0xebf6('0xc')];_0x2b658d[_0xebf6('0xd')]=_0x2b658d['agentcomplete']?_0x12ed12[_0xebf6('0xe')]:![];_0x2b658d[_0xebf6('0xf')]=_0x2b658d[_0xebf6('0xd')]?_0x12ed12[_0xebf6('0x10')]:0x0;}utils[_0xebf6('0x11')](_0xebf6('0x12'),_0x2b658d);});}else{utils['request'](_0xebf6('0x12'),_0x2b658d);}if(_0x14bf01){delete transfers[_0x2b658d[_0xebf6('0x4')]];}else{delete agents[_0x2b658d['destuniqueid']];}}exports[_0xebf6('0x13')]=function(_0x101a6c){try{utils[_0xebf6('0x14')](util[_0xebf6('0x2')](_0xebf6('0x15'),_0x101a6c['uniqueid']),_0x101a6c);agents[_0x101a6c['destuniqueid']]=_0x101a6c;agents[_0x101a6c['destuniqueid']][_0xebf6('0x16')]=utils[_0xebf6('0x17')]();agents[_0x101a6c['destuniqueid']][_0xebf6('0xa')]=_0xebf6('0x18');agents[_0x101a6c[_0xebf6('0x19')]][_0xebf6('0x9')]=null;agents[_0x101a6c[_0xebf6('0x19')]][_0xebf6('0x1a')]=null;utils[_0xebf6('0x1')](util[_0xebf6('0x2')](_0xebf6('0x1b'),_0x101a6c[_0xebf6('0x4')],agents[_0x101a6c['destuniqueid']]['membername'],_0x101a6c[_0xebf6('0x19')]));}catch(_0x38c9e3){utils[_0xebf6('0x1c')](util[_0xebf6('0x2')](_0xebf6('0x15'),_0x101a6c[_0xebf6('0x4')]),_0x38c9e3);}};exports[_0xebf6('0x1d')]=function(_0x80f523){try{if(!_['isNil'](agents[_0x80f523[_0xebf6('0x19')]])){utils[_0xebf6('0x14')](util[_0xebf6('0x2')](_0xebf6('0x1e'),_0x80f523[_0xebf6('0x4')]),_0x80f523);utils[_0xebf6('0x1')](util[_0xebf6('0x2')](_0xebf6('0x1f'),_0x80f523[_0xebf6('0x4')],agents[_0x80f523[_0xebf6('0x19')]][_0xebf6('0x6')],_0x80f523[_0xebf6('0x19')]));agents[_0x80f523[_0xebf6('0x19')]][_0xebf6('0x1d')]=!![];agents[_0x80f523[_0xebf6('0x19')]][_0xebf6('0x20')]=utils[_0xebf6('0x17')]();agents[_0x80f523[_0xebf6('0x19')]][_0xebf6('0xa')]='timeout';agents[_0x80f523['destuniqueid']][_0xebf6('0x21')]='timeout';agents[_0x80f523[_0xebf6('0x19')]][_0xebf6('0x22')]=_0x80f523['ringtime']?parseInt(_0x80f523['ringtime'])/0x3e8:0x0;agents[_0x80f523[_0xebf6('0x19')]][_0xebf6('0x23')]=0x0;unanswered[_0xebf6('0x24')](_0x80f523[_0xebf6('0x19')]);}}catch(_0xedaaeb){utils[_0xebf6('0x1c')](util[_0xebf6('0x2')](_0xebf6('0x1e'),_0x80f523['uniqueid']),_0xedaaeb);}};exports[_0xebf6('0x25')]=function(_0x78cdf0){try{_['forIn'](agents,function(_0x2fe3ee,_0x28bbea){if(_0x2fe3ee['uniqueid']==_0x78cdf0[_0xebf6('0x4')]&&!_[_0xebf6('0x26')](unanswered,_0x2fe3ee[_0xebf6('0x19')])){utils[_0xebf6('0x14')](util[_0xebf6('0x2')](_0xebf6('0x27'),_0x78cdf0['uniqueid']),_0x78cdf0);utils[_0xebf6('0x1')](util[_0xebf6('0x2')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x78cdf0['uniqueid'],_0x2fe3ee[_0xebf6('0x6')],_0x2fe3ee[_0xebf6('0x19')]));_0x2fe3ee['agentringnoanswer']=!![];_0x2fe3ee[_0xebf6('0x20')]=utils[_0xebf6('0x17')]();_0x2fe3ee['lastevent']=_0xebf6('0x28');_0x2fe3ee[_0xebf6('0x21')]=_0xebf6('0x28');_0x2fe3ee['holdtime']=_0x78cdf0[_0xebf6('0x22')];_0x2fe3ee[_0xebf6('0x23')]=0x0;writeDB(_0x2fe3ee);}});}catch(_0xed3a5b){utils[_0xebf6('0x1c')](util['format']('[%s][agents][queuecallerabandon]',_0x78cdf0[_0xebf6('0x4')]),_0xed3a5b);}};exports[_0xebf6('0x29')]=function(_0x562f76){try{if(agents[_0x562f76[_0xebf6('0x19')]]){utils[_0xebf6('0x14')](util['format'](_0xebf6('0x2a'),_0x562f76[_0xebf6('0x4')]),_0x562f76);utils[_0xebf6('0x1')](util[_0xebf6('0x2')](_0xebf6('0x2b'),_0x562f76['uniqueid'],agents[_0x562f76[_0xebf6('0x19')]]['membername'],_0x562f76[_0xebf6('0x19')]));agents[_0x562f76['destuniqueid']][_0xebf6('0x2c')]=utils[_0xebf6('0x17')]();agents[_0x562f76[_0xebf6('0x19')]][_0xebf6('0x9')]=_0x562f76[_0xebf6('0x9')];agents[_0x562f76[_0xebf6('0x19')]]['connectedlinename']=_0x562f76[_0xebf6('0x1a')];agents[_0x562f76[_0xebf6('0x19')]][_0xebf6('0x22')]=_0x562f76[_0xebf6('0x2d')];agents[_0x562f76[_0xebf6('0x19')]][_0xebf6('0xa')]='connect';_[_0xebf6('0x2e')](agents,function(_0x2782a5,_0x3f8502){if(_0x2782a5[_0xebf6('0x19')]!=_0x562f76[_0xebf6('0x19')]&&_0x2782a5[_0xebf6('0x4')]==_0x562f76['uniqueid']){_0x2782a5['talktime']=0x0;_0x2782a5['holdtime']=_0x562f76[_0xebf6('0x2d')];_0x2782a5[_0xebf6('0x1d')]=!![];_0x2782a5[_0xebf6('0x20')]=utils['now']();_0x2782a5[_0xebf6('0xa')]=_0xebf6('0x2f');_0x2782a5[_0xebf6('0x21')]='answered_elsewhere';_0x2782a5[_0xebf6('0x30')]=_0x562f76[_0xebf6('0x19')];_0x2782a5['answeredelsewheremembername']=_0x562f76[_0xebf6('0x6')];writeDB(_0x2782a5);}});}}catch(_0x1de50e){utils[_0xebf6('0x1c')](util['format'](_0xebf6('0x2a'),_0x562f76['uniqueid']),_0x1de50e);}};exports['agentcomplete']=function(_0x256552){try{if(!_[_0xebf6('0x31')](agents[_0x256552[_0xebf6('0x19')]])){utils[_0xebf6('0x14')](util['format'](_0xebf6('0x32'),_0x256552['uniqueid']),_0x256552);utils[_0xebf6('0x1')](util[_0xebf6('0x2')](_0xebf6('0x33'),_0x256552[_0xebf6('0x4')],agents[_0x256552[_0xebf6('0x19')]]['membername'],_0x256552['destuniqueid']));agents[_0x256552[_0xebf6('0x19')]][_0xebf6('0x34')]=!![];agents[_0x256552[_0xebf6('0x19')]][_0xebf6('0x35')]=utils['now']();agents[_0x256552[_0xebf6('0x19')]][_0xebf6('0x23')]=utils[_0xebf6('0x36')](agents[_0x256552[_0xebf6('0x19')]][_0xebf6('0x35')],agents[_0x256552[_0xebf6('0x19')]][_0xebf6('0x2c')]);agents[_0x256552['destuniqueid']][_0xebf6('0x21')]=_0x256552[_0xebf6('0x21')];agents[_0x256552[_0xebf6('0x19')]][_0xebf6('0xa')]=_0xebf6('0x37');writeDB(agents[_0x256552[_0xebf6('0x19')]]);}}catch(_0x250cf4){utils['error'](util[_0xebf6('0x2')]('[%s][agents][agentcomplete]',_0x256552[_0xebf6('0x4')]),_0x250cf4);}};exports[_0xebf6('0x38')]=function(_0x5d84ac){try{if(!_[_0xebf6('0x31')](agents[_0x5d84ac['transfereruniqueid']])){utils[_0xebf6('0x14')](util[_0xebf6('0x2')](_0xebf6('0x39'),_0x5d84ac[_0xebf6('0x4')]),_0x5d84ac);utils[_0xebf6('0x1')](util['format'](_0xebf6('0x3a'),_0x5d84ac[_0xebf6('0x4')],agents[_0x5d84ac['transfereruniqueid']][_0xebf6('0x6')],agents[_0x5d84ac[_0xebf6('0x3b')]][_0xebf6('0x4')]));agents[_0x5d84ac[_0xebf6('0x3b')]][_0xebf6('0x3c')]=!![];agents[_0x5d84ac['transfereruniqueid']][_0xebf6('0x3d')]=_0xebf6('0x3e');agents[_0x5d84ac[_0xebf6('0x3b')]][_0xebf6('0x3f')]=_0x5d84ac['extension'];agents[_0x5d84ac[_0xebf6('0x3b')]][_0xebf6('0x40')]=agents[_0x5d84ac[_0xebf6('0x3b')]][_0xebf6('0x4')];}}catch(_0x16abac){utils[_0xebf6('0x1c')](util[_0xebf6('0x2')](_0xebf6('0x39'),_0x5d84ac[_0xebf6('0x4')]),_0x16abac);}};exports['attendedtransfer']=function(_0x22c3ad){try{utils[_0xebf6('0x14')](util[_0xebf6('0x2')]('[%s][agents][attendedtransfer]',_0x22c3ad[_0xebf6('0x41')]),_0x22c3ad);if(_0x22c3ad['origtransfereruniqueid']==_0x22c3ad['origtransfererlinkedid']){if(!_[_0xebf6('0x31')](agents[_0x22c3ad[_0xebf6('0x42')]])){utils[_0xebf6('0x1')](util[_0xebf6('0x2')](_0xebf6('0x43'),_0x22c3ad['origtransfereruniqueid'],agents[_0x22c3ad[_0xebf6('0x42')]]['membername']));agents[_0x22c3ad['secondtransfereruniqueid']]['transfer']=!![];agents[_0x22c3ad[_0xebf6('0x42')]][_0xebf6('0x3d')]='ATTENDED';agents[_0x22c3ad[_0xebf6('0x42')]][_0xebf6('0x3f')]=_0x22c3ad[_0xebf6('0x44')];agents[_0x22c3ad[_0xebf6('0x42')]][_0xebf6('0x40')]=_0x22c3ad[_0xebf6('0x41')];}if(_0x22c3ad[_0xebf6('0x45')]&&agents[_0x22c3ad['transfereeuniqueid']]){agents[_0x22c3ad[_0xebf6('0x45')]][_0xebf6('0x46')]=0x1;transfers[_0x22c3ad[_0xebf6('0x45')]]=_[_0xebf6('0x47')](agents[_0x22c3ad[_0xebf6('0x45')]]);transfers[_0x22c3ad[_0xebf6('0x45')]]['calleridnum']=agents[_0x22c3ad[_0xebf6('0x42')]][_0xebf6('0x8')];transfers[_0x22c3ad[_0xebf6('0x45')]][_0xebf6('0x48')]=agents[_0x22c3ad[_0xebf6('0x42')]][_0xebf6('0x48')];transfers[_0x22c3ad['transfereeuniqueid']][_0xebf6('0x16')]=utils[_0xebf6('0x17')]();transfers[_0x22c3ad[_0xebf6('0x45')]][_0xebf6('0x2c')]=utils[_0xebf6('0x17')]();transfers[_0x22c3ad['transfereeuniqueid']][_0xebf6('0x22')]=0x0;transfers[_0x22c3ad[_0xebf6('0x45')]][_0xebf6('0x46')]=0x2;}}else if(_0x22c3ad[_0xebf6('0x42')]==_0x22c3ad[_0xebf6('0x49')]){if(!_[_0xebf6('0x31')](agents[_0x22c3ad[_0xebf6('0x41')]])){utils[_0xebf6('0x1')](util[_0xebf6('0x2')](_0xebf6('0x43'),_0x22c3ad[_0xebf6('0x41')],agents[_0x22c3ad['origtransfereruniqueid']][_0xebf6('0x6')]));agents[_0x22c3ad[_0xebf6('0x41')]][_0xebf6('0x3c')]=!![];agents[_0x22c3ad[_0xebf6('0x41')]][_0xebf6('0x3d')]=_0xebf6('0x4a');agents[_0x22c3ad['origtransfereruniqueid']][_0xebf6('0x3f')]=_0x22c3ad['secondtransfererexten'];agents[_0x22c3ad[_0xebf6('0x41')]][_0xebf6('0x40')]=_0x22c3ad[_0xebf6('0x42')];}if(_0x22c3ad[_0xebf6('0x4b')]&&agents[_0x22c3ad[_0xebf6('0x4b')]]){agents[_0x22c3ad[_0xebf6('0x4b')]][_0xebf6('0x46')]=0x1;transfers[_0x22c3ad['transfertargetuniqueid']]=_['clone'](agents[_0x22c3ad[_0xebf6('0x4b')]]);transfers[_0x22c3ad[_0xebf6('0x4b')]]['calleridnum']=agents[_0x22c3ad[_0xebf6('0x41')]][_0xebf6('0x8')];transfers[_0x22c3ad['transfertargetuniqueid']][_0xebf6('0x48')]=agents[_0x22c3ad[_0xebf6('0x41')]]['calleridname'];transfers[_0x22c3ad[_0xebf6('0x4b')]][_0xebf6('0x16')]=utils[_0xebf6('0x17')]();transfers[_0x22c3ad[_0xebf6('0x4b')]][_0xebf6('0x2c')]=utils[_0xebf6('0x17')]();transfers[_0x22c3ad[_0xebf6('0x4b')]]['holdtime']=0x0;transfers[_0x22c3ad[_0xebf6('0x4b')]][_0xebf6('0x46')]=0x2;}}}catch(_0x26d338){utils[_0xebf6('0x1c')](util[_0xebf6('0x2')](_0xebf6('0x4c'),_0x22c3ad[_0xebf6('0x41')]),_0x26d338);}};exports[_0xebf6('0x4d')]=function(_0x3bc43){try{utils[_0xebf6('0x14')](util['format']('[%s][agents][hangup]',_0x3bc43[_0xebf6('0x4')]),_0x3bc43);if(agents[_0x3bc43[_0xebf6('0x4')]]&&agents[_0x3bc43[_0xebf6('0x4')]][_0xebf6('0x21')]==='timeout'){if(_0x3bc43[_0xebf6('0x4e')]==='21'){agents[_0x3bc43[_0xebf6('0x4')]][_0xebf6('0x21')]=_0xebf6('0x4f');agents[_0x3bc43['uniqueid']]['lastevent']='rejected';}utils[_0xebf6('0x1')](util[_0xebf6('0x2')](_0xebf6('0x50'),_0x3bc43[_0xebf6('0x4')],agents[_0x3bc43[_0xebf6('0x4')]][_0xebf6('0x6')],agents[_0x3bc43[_0xebf6('0x4')]][_0xebf6('0x21')],agents[_0x3bc43['uniqueid']][_0xebf6('0xa')]));writeDB(agents[_0x3bc43[_0xebf6('0x4')]]);var _0x50169c=unanswered['indexOf'](_0x3bc43[_0xebf6('0x4')]);if(_0x50169c>-0x1){unanswered['splice'](_0x50169c,0x1);}}if(transfers[_0x3bc43[_0xebf6('0x4')]]){transfers[_0x3bc43[_0xebf6('0x4')]][_0xebf6('0x34')]=!![];transfers[_0x3bc43['uniqueid']][_0xebf6('0x35')]=utils[_0xebf6('0x17')]();transfers[_0x3bc43[_0xebf6('0x4')]][_0xebf6('0x23')]=utils[_0xebf6('0x36')](transfers[_0x3bc43[_0xebf6('0x4')]]['agentcompleteAt'],transfers[_0x3bc43[_0xebf6('0x4')]][_0xebf6('0x2c')]);transfers[_0x3bc43['uniqueid']][_0xebf6('0x21')]=_0xebf6('0x51');transfers[_0x3bc43[_0xebf6('0x4')]]['lastevent']=_0xebf6('0x37');utils[_0xebf6('0x1')](util['format'](_0xebf6('0x50'),_0x3bc43[_0xebf6('0x4')],transfers[_0x3bc43[_0xebf6('0x4')]][_0xebf6('0x6')],transfers[_0x3bc43[_0xebf6('0x4')]][_0xebf6('0x21')],transfers[_0x3bc43[_0xebf6('0x4')]][_0xebf6('0xa')]));writeDB(transfers[_0x3bc43[_0xebf6('0x4')]],!![]);}if(agents[_0x3bc43[_0xebf6('0x4')]]&&agents[_0x3bc43[_0xebf6('0x4')]][_0xebf6('0x2c')]){agents[_0x3bc43[_0xebf6('0x4')]]['agentcomplete']=!![];agents[_0x3bc43[_0xebf6('0x4')]][_0xebf6('0x35')]=utils[_0xebf6('0x17')]();agents[_0x3bc43[_0xebf6('0x4')]][_0xebf6('0x23')]=utils[_0xebf6('0x36')](agents[_0x3bc43[_0xebf6('0x4')]][_0xebf6('0x35')],agents[_0x3bc43[_0xebf6('0x4')]][_0xebf6('0x2c')]);agents[_0x3bc43['uniqueid']]['reason']=agents[_0x3bc43[_0xebf6('0x4')]]['transfer']?_0xebf6('0x3c'):_0xebf6('0x51');agents[_0x3bc43[_0xebf6('0x4')]][_0xebf6('0xa')]=_0xebf6('0x37');utils['info'](util[_0xebf6('0x2')](_0xebf6('0x50'),_0x3bc43['uniqueid'],agents[_0x3bc43[_0xebf6('0x4')]][_0xebf6('0x6')],agents[_0x3bc43[_0xebf6('0x4')]][_0xebf6('0x21')],agents[_0x3bc43[_0xebf6('0x4')]]['lastevent']));writeDB(agents[_0x3bc43['uniqueid']]);}}catch(_0x1b245d){utils[_0xebf6('0x1c')](util[_0xebf6('0x2')](_0xebf6('0x52'),_0x3bc43[_0xebf6('0x4')]),_0x1b245d);}}; \ No newline at end of file +var _0x0972=['clone','calleridname','[%s][agents][attendedtransfer]','hangup','[%s][agents][hangup]','timeout','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','util','info','format','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','isNil','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswer','agentringnoanswerAt','lastevent','reason','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','holdtime','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connect','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','agentconnectAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfertype','transferexten','extension','transferuniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfereruniqueid','secondtransfereruniqueid','transfer','origtransfererexten','transfereeuniqueid','agententerreason','secondtransfererlinkedid','ATTENDED','secondtransfererexten','transfertargetuniqueid'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0972,0x64));var _0x2097=function(_0x3d0b6a,_0x4a338c){_0x3d0b6a=_0x3d0b6a-0x0;var _0x38656e=_0x0972[_0x3d0b6a];return _0x38656e;};'use strict';var _=require('lodash');var util=require(_0x2097('0x0'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x1c7a40,_0x4ec7aa){utils[_0x2097('0x1')](util[_0x2097('0x2')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x1c7a40[_0x2097('0x3')],_0x1c7a40[_0x2097('0x4')],_0x1c7a40[_0x2097('0x5')],_0x1c7a40[_0x2097('0x6')],_0x1c7a40[_0x2097('0x7')],_0x1c7a40[_0x2097('0x8')],_0x1c7a40[_0x2097('0x9')],_0x1c7a40['lastevent']));if(_0x1c7a40[_0x2097('0x5')]){utils[_0x2097('0xa')](_0x1c7a40[_0x2097('0x5')])[_0x2097('0xb')](function(_0x3b8fac){if(_0x3b8fac){_0x1c7a40['type']=_0x3b8fac[_0x2097('0xc')];_0x1c7a40[_0x2097('0xd')]=_0x1c7a40[_0x2097('0xe')]?_0x3b8fac[_0x2097('0xf')]:![];_0x1c7a40[_0x2097('0x10')]=_0x1c7a40[_0x2097('0xd')]?_0x3b8fac[_0x2097('0x11')]:0x0;}utils[_0x2097('0x12')](_0x2097('0x13'),_0x1c7a40);});}else{utils[_0x2097('0x12')](_0x2097('0x13'),_0x1c7a40);}if(_0x4ec7aa){delete transfers[_0x1c7a40[_0x2097('0x3')]];}else{delete agents[_0x1c7a40[_0x2097('0x14')]];}}exports[_0x2097('0x15')]=function(_0x24ca42){try{utils[_0x2097('0x16')](util[_0x2097('0x2')](_0x2097('0x17'),_0x24ca42[_0x2097('0x3')]),_0x24ca42);agents[_0x24ca42[_0x2097('0x14')]]=_0x24ca42;agents[_0x24ca42['destuniqueid']][_0x2097('0x18')]=utils[_0x2097('0x19')]();agents[_0x24ca42['destuniqueid']]['lastevent']='called';agents[_0x24ca42[_0x2097('0x14')]]['connectedlinenum']=null;agents[_0x24ca42[_0x2097('0x14')]][_0x2097('0x1a')]=null;utils[_0x2097('0x1')](util[_0x2097('0x2')](_0x2097('0x1b'),_0x24ca42['uniqueid'],agents[_0x24ca42[_0x2097('0x14')]][_0x2097('0x6')],_0x24ca42[_0x2097('0x14')]));}catch(_0x34654a){utils[_0x2097('0x1c')](util[_0x2097('0x2')](_0x2097('0x17'),_0x24ca42[_0x2097('0x3')]),_0x34654a);}};exports['agentringnoanswer']=function(_0x4d957e){try{if(!_[_0x2097('0x1d')](agents[_0x4d957e['destuniqueid']])){utils[_0x2097('0x16')](util[_0x2097('0x2')]('[%s][agents][agentringnoanswer]',_0x4d957e[_0x2097('0x3')]),_0x4d957e);utils['info'](util[_0x2097('0x2')](_0x2097('0x1e'),_0x4d957e[_0x2097('0x3')],agents[_0x4d957e[_0x2097('0x14')]][_0x2097('0x6')],_0x4d957e[_0x2097('0x14')]));agents[_0x4d957e['destuniqueid']][_0x2097('0x1f')]=!![];agents[_0x4d957e['destuniqueid']][_0x2097('0x20')]=utils[_0x2097('0x19')]();agents[_0x4d957e[_0x2097('0x14')]][_0x2097('0x21')]='timeout';agents[_0x4d957e[_0x2097('0x14')]][_0x2097('0x22')]='timeout';agents[_0x4d957e[_0x2097('0x14')]]['holdtime']=_0x4d957e[_0x2097('0x23')]?parseInt(_0x4d957e['ringtime'])/0x3e8:0x0;agents[_0x4d957e[_0x2097('0x14')]][_0x2097('0x24')]=0x0;unanswered[_0x2097('0x25')](_0x4d957e[_0x2097('0x14')]);}}catch(_0x410afa){utils[_0x2097('0x1c')](util[_0x2097('0x2')]('[%s][agents][agentringnoanswer]',_0x4d957e[_0x2097('0x3')]),_0x410afa);}};exports[_0x2097('0x26')]=function(_0x5cce55){try{_[_0x2097('0x27')](agents,function(_0x41487d,_0x59fb84){if(_0x41487d['uniqueid']==_0x5cce55[_0x2097('0x3')]&&!_[_0x2097('0x28')](unanswered,_0x41487d[_0x2097('0x14')])){utils[_0x2097('0x16')](util[_0x2097('0x2')](_0x2097('0x29'),_0x5cce55['uniqueid']),_0x5cce55);utils[_0x2097('0x1')](util['format'](_0x2097('0x2a'),_0x5cce55[_0x2097('0x3')],_0x41487d[_0x2097('0x6')],_0x41487d[_0x2097('0x14')]));_0x41487d[_0x2097('0x1f')]=!![];_0x41487d[_0x2097('0x20')]=utils[_0x2097('0x19')]();_0x41487d[_0x2097('0x21')]=_0x2097('0x2b');_0x41487d['reason']=_0x2097('0x2b');_0x41487d[_0x2097('0x2c')]=_0x5cce55[_0x2097('0x2c')];_0x41487d['talktime']=0x0;writeDB(_0x41487d);}});}catch(_0x3d97ee){utils[_0x2097('0x1c')](util[_0x2097('0x2')](_0x2097('0x29'),_0x5cce55['uniqueid']),_0x3d97ee);}};exports['agentconnect']=function(_0x5689f6){try{if(agents[_0x5689f6[_0x2097('0x14')]]){utils[_0x2097('0x16')](util[_0x2097('0x2')](_0x2097('0x2d'),_0x5689f6[_0x2097('0x3')]),_0x5689f6);utils[_0x2097('0x1')](util['format'](_0x2097('0x2e'),_0x5689f6[_0x2097('0x3')],agents[_0x5689f6[_0x2097('0x14')]][_0x2097('0x6')],_0x5689f6[_0x2097('0x14')]));agents[_0x5689f6[_0x2097('0x14')]]['agentconnectAt']=utils[_0x2097('0x19')]();agents[_0x5689f6[_0x2097('0x14')]][_0x2097('0x9')]=_0x5689f6['connectedlinenum'];agents[_0x5689f6['destuniqueid']][_0x2097('0x1a')]=_0x5689f6[_0x2097('0x1a')];agents[_0x5689f6[_0x2097('0x14')]][_0x2097('0x2c')]=_0x5689f6[_0x2097('0x23')];agents[_0x5689f6[_0x2097('0x14')]][_0x2097('0x21')]=_0x2097('0x2f');_[_0x2097('0x27')](agents,function(_0x3bfb5c,_0x337979){if(_0x3bfb5c[_0x2097('0x14')]!=_0x5689f6['destuniqueid']&&_0x3bfb5c[_0x2097('0x3')]==_0x5689f6[_0x2097('0x3')]){_0x3bfb5c[_0x2097('0x24')]=0x0;_0x3bfb5c['holdtime']=_0x5689f6[_0x2097('0x23')];_0x3bfb5c[_0x2097('0x1f')]=!![];_0x3bfb5c[_0x2097('0x20')]=utils[_0x2097('0x19')]();_0x3bfb5c[_0x2097('0x21')]=_0x2097('0x30');_0x3bfb5c[_0x2097('0x22')]=_0x2097('0x30');_0x3bfb5c['answeredelsewheredestinationuniqueid']=_0x5689f6[_0x2097('0x14')];_0x3bfb5c[_0x2097('0x31')]=_0x5689f6[_0x2097('0x6')];writeDB(_0x3bfb5c);}});}}catch(_0x3288ae){utils[_0x2097('0x1c')](util[_0x2097('0x2')](_0x2097('0x2d'),_0x5689f6[_0x2097('0x3')]),_0x3288ae);}};exports['agentcomplete']=function(_0x3fc3fe){try{if(!_['isNil'](agents[_0x3fc3fe[_0x2097('0x14')]])){utils[_0x2097('0x16')](util[_0x2097('0x2')](_0x2097('0x32'),_0x3fc3fe[_0x2097('0x3')]),_0x3fc3fe);utils['info'](util[_0x2097('0x2')](_0x2097('0x33'),_0x3fc3fe[_0x2097('0x3')],agents[_0x3fc3fe[_0x2097('0x14')]][_0x2097('0x6')],_0x3fc3fe['destuniqueid']));agents[_0x3fc3fe[_0x2097('0x14')]][_0x2097('0xe')]=!![];agents[_0x3fc3fe[_0x2097('0x14')]][_0x2097('0x34')]=utils[_0x2097('0x19')]();agents[_0x3fc3fe[_0x2097('0x14')]][_0x2097('0x24')]=utils[_0x2097('0x35')](agents[_0x3fc3fe['destuniqueid']][_0x2097('0x34')],agents[_0x3fc3fe[_0x2097('0x14')]][_0x2097('0x36')]);agents[_0x3fc3fe[_0x2097('0x14')]]['reason']=_0x3fc3fe['reason'];agents[_0x3fc3fe['destuniqueid']][_0x2097('0x21')]=_0x2097('0x37');writeDB(agents[_0x3fc3fe['destuniqueid']]);}}catch(_0x10577d){utils[_0x2097('0x1c')](util['format']('[%s][agents][agentcomplete]',_0x3fc3fe[_0x2097('0x3')]),_0x10577d);}};exports[_0x2097('0x38')]=function(_0x1b4de6){try{if(!_['isNil'](agents[_0x1b4de6[_0x2097('0x39')]])){utils[_0x2097('0x16')](util['format'](_0x2097('0x3a'),_0x1b4de6[_0x2097('0x3')]),_0x1b4de6);utils[_0x2097('0x1')](util[_0x2097('0x2')](_0x2097('0x3b'),_0x1b4de6['uniqueid'],agents[_0x1b4de6['transfereruniqueid']][_0x2097('0x6')],agents[_0x1b4de6[_0x2097('0x39')]][_0x2097('0x3')]));agents[_0x1b4de6['transfereruniqueid']]['transfer']=!![];agents[_0x1b4de6[_0x2097('0x39')]][_0x2097('0x3c')]='blind';agents[_0x1b4de6[_0x2097('0x39')]][_0x2097('0x3d')]=_0x1b4de6[_0x2097('0x3e')];agents[_0x1b4de6[_0x2097('0x39')]][_0x2097('0x3f')]=agents[_0x1b4de6['transfereruniqueid']][_0x2097('0x3')];}}catch(_0x228b60){utils[_0x2097('0x1c')](util['format'](_0x2097('0x3a'),_0x1b4de6[_0x2097('0x3')]),_0x228b60);}};exports['attendedtransfer']=function(_0x12ba76){try{utils['debug'](util[_0x2097('0x2')]('[%s][agents][attendedtransfer]',_0x12ba76['origtransfereruniqueid']),_0x12ba76);if(_0x12ba76['origtransfereruniqueid']==_0x12ba76[_0x2097('0x40')]){if(!_['isNil'](agents[_0x12ba76['secondtransfereruniqueid']])){utils[_0x2097('0x1')](util['format'](_0x2097('0x41'),_0x12ba76[_0x2097('0x42')],agents[_0x12ba76['secondtransfereruniqueid']][_0x2097('0x6')]));agents[_0x12ba76[_0x2097('0x43')]][_0x2097('0x44')]=!![];agents[_0x12ba76[_0x2097('0x43')]][_0x2097('0x3c')]='ATTENDED';agents[_0x12ba76[_0x2097('0x43')]]['transferexten']=_0x12ba76[_0x2097('0x45')];agents[_0x12ba76[_0x2097('0x43')]][_0x2097('0x3f')]=_0x12ba76['origtransfereruniqueid'];}if(_0x12ba76[_0x2097('0x46')]&&agents[_0x12ba76[_0x2097('0x46')]]){agents[_0x12ba76[_0x2097('0x46')]][_0x2097('0x47')]=0x1;transfers[_0x12ba76[_0x2097('0x46')]]=_['clone'](agents[_0x12ba76['transfereeuniqueid']]);transfers[_0x12ba76[_0x2097('0x46')]][_0x2097('0x8')]=agents[_0x12ba76['secondtransfereruniqueid']]['calleridnum'];transfers[_0x12ba76['transfereeuniqueid']]['calleridname']=agents[_0x12ba76[_0x2097('0x43')]]['calleridname'];transfers[_0x12ba76[_0x2097('0x46')]][_0x2097('0x18')]=utils['now']();transfers[_0x12ba76[_0x2097('0x46')]][_0x2097('0x36')]=utils[_0x2097('0x19')]();transfers[_0x12ba76[_0x2097('0x46')]][_0x2097('0x2c')]=0x0;transfers[_0x12ba76[_0x2097('0x46')]][_0x2097('0x47')]=0x2;}}else if(_0x12ba76[_0x2097('0x43')]==_0x12ba76[_0x2097('0x48')]){if(!_['isNil'](agents[_0x12ba76[_0x2097('0x42')]])){utils[_0x2097('0x1')](util[_0x2097('0x2')](_0x2097('0x41'),_0x12ba76[_0x2097('0x42')],agents[_0x12ba76[_0x2097('0x42')]]['membername']));agents[_0x12ba76[_0x2097('0x42')]][_0x2097('0x44')]=!![];agents[_0x12ba76[_0x2097('0x42')]][_0x2097('0x3c')]=_0x2097('0x49');agents[_0x12ba76['origtransfereruniqueid']][_0x2097('0x3d')]=_0x12ba76[_0x2097('0x4a')];agents[_0x12ba76['origtransfereruniqueid']]['transferuniqueid']=_0x12ba76['secondtransfereruniqueid'];}if(_0x12ba76[_0x2097('0x4b')]&&agents[_0x12ba76[_0x2097('0x4b')]]){agents[_0x12ba76[_0x2097('0x4b')]][_0x2097('0x47')]=0x1;transfers[_0x12ba76[_0x2097('0x4b')]]=_[_0x2097('0x4c')](agents[_0x12ba76[_0x2097('0x4b')]]);transfers[_0x12ba76[_0x2097('0x4b')]][_0x2097('0x8')]=agents[_0x12ba76['origtransfereruniqueid']]['calleridnum'];transfers[_0x12ba76[_0x2097('0x4b')]][_0x2097('0x4d')]=agents[_0x12ba76[_0x2097('0x42')]][_0x2097('0x4d')];transfers[_0x12ba76[_0x2097('0x4b')]][_0x2097('0x18')]=utils['now']();transfers[_0x12ba76[_0x2097('0x4b')]][_0x2097('0x36')]=utils[_0x2097('0x19')]();transfers[_0x12ba76[_0x2097('0x4b')]]['holdtime']=0x0;transfers[_0x12ba76['transfertargetuniqueid']][_0x2097('0x47')]=0x2;}}}catch(_0x345a12){utils['error'](util[_0x2097('0x2')](_0x2097('0x4e'),_0x12ba76[_0x2097('0x42')]),_0x345a12);}};exports[_0x2097('0x4f')]=function(_0x1f824f){try{utils[_0x2097('0x16')](util[_0x2097('0x2')](_0x2097('0x50'),_0x1f824f['uniqueid']),_0x1f824f);if(agents[_0x1f824f[_0x2097('0x3')]]&&agents[_0x1f824f[_0x2097('0x3')]]['reason']===_0x2097('0x51')){if(_0x1f824f[_0x2097('0x52')]==='21'){agents[_0x1f824f[_0x2097('0x3')]][_0x2097('0x22')]=_0x2097('0x53');agents[_0x1f824f[_0x2097('0x3')]][_0x2097('0x21')]=_0x2097('0x53');}utils[_0x2097('0x1')](util[_0x2097('0x2')](_0x2097('0x54'),_0x1f824f['uniqueid'],agents[_0x1f824f[_0x2097('0x3')]][_0x2097('0x6')],agents[_0x1f824f[_0x2097('0x3')]][_0x2097('0x22')],agents[_0x1f824f[_0x2097('0x3')]]['lastevent']));writeDB(agents[_0x1f824f[_0x2097('0x3')]]);var _0x2a950f=unanswered[_0x2097('0x55')](_0x1f824f['uniqueid']);if(_0x2a950f>-0x1){unanswered[_0x2097('0x56')](_0x2a950f,0x1);}}if(transfers[_0x1f824f['uniqueid']]){transfers[_0x1f824f[_0x2097('0x3')]]['agentcomplete']=!![];transfers[_0x1f824f[_0x2097('0x3')]]['agentcompleteAt']=utils[_0x2097('0x19')]();transfers[_0x1f824f['uniqueid']][_0x2097('0x24')]=utils[_0x2097('0x35')](transfers[_0x1f824f[_0x2097('0x3')]][_0x2097('0x34')],transfers[_0x1f824f[_0x2097('0x3')]]['agentconnectAt']);transfers[_0x1f824f[_0x2097('0x3')]][_0x2097('0x22')]=_0x2097('0x57');transfers[_0x1f824f[_0x2097('0x3')]][_0x2097('0x21')]=_0x2097('0x37');utils[_0x2097('0x1')](util[_0x2097('0x2')](_0x2097('0x54'),_0x1f824f[_0x2097('0x3')],transfers[_0x1f824f[_0x2097('0x3')]][_0x2097('0x6')],transfers[_0x1f824f[_0x2097('0x3')]][_0x2097('0x22')],transfers[_0x1f824f[_0x2097('0x3')]][_0x2097('0x21')]));writeDB(transfers[_0x1f824f['uniqueid']],!![]);}if(agents[_0x1f824f[_0x2097('0x3')]]&&agents[_0x1f824f['uniqueid']]['agentconnectAt']){agents[_0x1f824f[_0x2097('0x3')]][_0x2097('0xe')]=!![];agents[_0x1f824f[_0x2097('0x3')]]['agentcompleteAt']=utils[_0x2097('0x19')]();agents[_0x1f824f[_0x2097('0x3')]][_0x2097('0x24')]=utils[_0x2097('0x35')](agents[_0x1f824f['uniqueid']][_0x2097('0x34')],agents[_0x1f824f['uniqueid']][_0x2097('0x36')]);agents[_0x1f824f[_0x2097('0x3')]][_0x2097('0x22')]=agents[_0x1f824f[_0x2097('0x3')]]['transfer']?_0x2097('0x44'):_0x2097('0x57');agents[_0x1f824f[_0x2097('0x3')]]['lastevent']=_0x2097('0x37');utils[_0x2097('0x1')](util[_0x2097('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x1f824f[_0x2097('0x3')],agents[_0x1f824f[_0x2097('0x3')]][_0x2097('0x6')],agents[_0x1f824f[_0x2097('0x3')]][_0x2097('0x22')],agents[_0x1f824f[_0x2097('0x3')]]['lastevent']));writeDB(agents[_0x1f824f['uniqueid']]);}}catch(_0xc7481d){utils[_0x2097('0x1c')](util[_0x2097('0x2')](_0x2097('0x50'),_0x1f824f[_0x2097('0x3')]),_0xc7481d);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 84b70cf..69ea638 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 _0x9f41=['origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','userfield','_attended','transfertargetchannel','origtransfererchannel','[%s][calls][attendedtransfer]','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][varset]','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','variable','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','\x22\x20<','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][newexten]','appdata','application','toLowerCase','startsWith','cdr','split','substring','lastIndexOf','includes','execif','lodash','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','membername','interface','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','context','calleridnum','exten','now','error','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','destinationchannel','answertime','disposition','toNumber','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','starttime','diffTime','localtwolinkedid'];(function(_0xafe7,_0x14bc7b){var _0x392838=function(_0x52c117){while(--_0x52c117){_0xafe7['push'](_0xafe7['shift']());}};_0x392838(++_0x14bc7b);}(_0x9f41,0x9d));var _0x19f4=function(_0x44e7d4,_0x313236){_0x44e7d4=_0x44e7d4-0x0;var _0x2d8aea=_0x9f41[_0x44e7d4];return _0x2d8aea;};'use strict';var _=require(_0x19f4('0x0'));var util=require('util');var utils=require(_0x19f4('0x1'));var transfers=require(_0x19f4('0x2'));var dispositions=[_0x19f4('0x3'),_0x19f4('0x4'),_0x19f4('0x4'),_0x19f4('0x3'),'NO\x20ANSWER',_0x19f4('0x3'),_0x19f4('0x5'),_0x19f4('0x6'),_0x19f4('0x4'),_0x19f4('0x4'),'FAILED'];var channels={};function writeDB(_0x4ab20d){var _0x2eb4f0;if(transfers[_0x19f4('0x7')][_0x4ab20d[_0x19f4('0x8')]]){_0x2eb4f0=_0x4ab20d[_0x19f4('0x8')];_0x4ab20d[_0x19f4('0x8')]=transfers[_0x19f4('0x7')][_0x4ab20d[_0x19f4('0x8')]][_0x19f4('0x9')];}utils[_0x19f4('0xa')](util[_0x19f4('0xb')](_0x19f4('0xc'),_0x4ab20d[_0x19f4('0x8')],_0x4ab20d[_0x19f4('0xd')],_0x4ab20d['queue'],_0x4ab20d[_0x19f4('0xe')],_0x4ab20d[_0x19f4('0xf')],_0x4ab20d['calleridnum'],_0x4ab20d[_0x19f4('0x10')],_0x4ab20d[_0x19f4('0x11')]));if(_0x4ab20d[_0x19f4('0x12')]){utils[_0x19f4('0x13')](_0x4ab20d[_0x19f4('0x12')])[_0x19f4('0x14')](function(_0x3755aa){if(_0x3755aa){_0x4ab20d[_0x19f4('0x15')]=_0x3755aa['id'];}utils[_0x19f4('0x16')](_0x19f4('0x17'),_0x4ab20d);});}else{utils[_0x19f4('0x16')](_0x19f4('0x17'),_0x4ab20d);}if(channels[_0x4ab20d[_0x19f4('0x8')]]){delete channels[_0x4ab20d[_0x19f4('0x8')]];}else if(_0x2eb4f0&&channels[_0x2eb4f0]){delete transfers['blinds'][_0x2eb4f0];delete channels[_0x2eb4f0];}}exports[_0x19f4('0x18')]=function(_0x42c80e){try{utils[_0x19f4('0x19')](util[_0x19f4('0xb')](_0x19f4('0x1a'),_0x42c80e[_0x19f4('0x8')]),_0x42c80e);if(_0x42c80e['uniqueid']==_0x42c80e[_0x19f4('0x1b')]&&_0x42c80e[_0x19f4('0xd')]!=_0x19f4('0x1c')){utils[_0x19f4('0xa')](util[_0x19f4('0xb')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x42c80e['uniqueid'],_0x42c80e[_0x19f4('0x1d')],_0x42c80e['exten']));channels[_0x42c80e['uniqueid']]={'uniqueid':_0x42c80e['uniqueid'],'accountcode':_0x42c80e['accountcode'],'source':_0x42c80e[_0x19f4('0x1e')],'destination':_0x42c80e[_0x19f4('0x1f')],'destinationcontext':_0x42c80e[_0x19f4('0x1d')],'channel':_0x42c80e[_0x19f4('0xd')],'starttime':utils[_0x19f4('0x20')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':'DOCUMENTATION'};}}catch(_0x19bf40){utils[_0x19f4('0x21')](util['format']('[%s][calls][newchannel]',_0x42c80e['uniqueid']),_0x19bf40);}};exports[_0x19f4('0x22')]=function(_0x3ae7b9){try{utils[_0x19f4('0x19')](util[_0x19f4('0xb')](_0x19f4('0x23'),_0x3ae7b9[_0x19f4('0x8')]),_0x3ae7b9);if(!_[_0x19f4('0x24')](channels[_0x3ae7b9[_0x19f4('0x8')]])&&_0x3ae7b9[_0x19f4('0x25')]==0x6){utils[_0x19f4('0xa')](util['format'](_0x19f4('0x26'),_0x3ae7b9[_0x19f4('0x8')],_0x3ae7b9[_0x19f4('0x1d')],_0x3ae7b9['channel']));if(_[_0x19f4('0x24')](channels[_0x3ae7b9['uniqueid']]['systemanswertime'])){channels[_0x3ae7b9['uniqueid']][_0x19f4('0x27')]=utils[_0x19f4('0x20')]();}}else if(!_[_0x19f4('0x24')](channels[_0x3ae7b9['linkedid']])&&_0x3ae7b9[_0x19f4('0x25')]==0x6&&_0x3ae7b9[_0x19f4('0x1d')]!='transfer'){utils[_0x19f4('0xa')](util[_0x19f4('0xb')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x3ae7b9[_0x19f4('0x8')],_0x3ae7b9[_0x19f4('0x1b')],_0x3ae7b9[_0x19f4('0x1d')],_0x3ae7b9[_0x19f4('0xd')]));channels[_0x3ae7b9[_0x19f4('0x1b')]]['accountcode']=_0x3ae7b9[_0x19f4('0x12')];channels[_0x3ae7b9['linkedid']][_0x19f4('0x28')]=_0x3ae7b9[_0x19f4('0xd')];if(_[_0x19f4('0x24')](channels[_0x3ae7b9[_0x19f4('0x1b')]][_0x19f4('0x29')])){channels[_0x3ae7b9[_0x19f4('0x1b')]][_0x19f4('0x29')]=utils[_0x19f4('0x20')]();}channels[_0x3ae7b9[_0x19f4('0x1b')]][_0x19f4('0x2a')]=dispositions[_[_0x19f4('0x2b')](_0x3ae7b9[_0x19f4('0x25')])]||'ANSWERED';}}catch(_0x74194){utils[_0x19f4('0x21')](util[_0x19f4('0xb')](_0x19f4('0x23'),_0x3ae7b9[_0x19f4('0x8')]),_0x74194);}};exports['hangup']=function(_0x435ce9){try{if(!_[_0x19f4('0x24')](channels[_0x435ce9['uniqueid']])){utils[_0x19f4('0x19')](util[_0x19f4('0xb')](_0x19f4('0x2c'),_0x435ce9[_0x19f4('0x8')]),_0x435ce9);if(_['isNil'](channels[_0x435ce9[_0x19f4('0x8')]]['callerid'])){channels[_0x435ce9['uniqueid']][_0x19f4('0x2d')]=_0x435ce9[_0x19f4('0x2e')]+'\x20<'+_0x435ce9[_0x19f4('0x1e')]+'>';}utils[_0x19f4('0xa')](util[_0x19f4('0xb')](_0x19f4('0x2f'),_0x435ce9[_0x19f4('0x8')],channels[_0x435ce9[_0x19f4('0x8')]][_0x19f4('0x2d')],_0x435ce9[_0x19f4('0x30')]));channels[_0x435ce9['uniqueid']][_0x19f4('0x31')]=utils[_0x19f4('0x20')]();channels[_0x435ce9['uniqueid']]['duration']=utils['diffTime'](channels[_0x435ce9[_0x19f4('0x8')]][_0x19f4('0x31')],channels[_0x435ce9[_0x19f4('0x8')]][_0x19f4('0x32')]);channels[_0x435ce9[_0x19f4('0x8')]]['billableseconds']=channels[_0x435ce9[_0x19f4('0x8')]]['answertime']?utils[_0x19f4('0x33')](channels[_0x435ce9[_0x19f4('0x8')]][_0x19f4('0x31')],channels[_0x435ce9[_0x19f4('0x8')]][_0x19f4('0x29')]):0x0;writeDB(channels[_0x435ce9[_0x19f4('0x8')]]);}}catch(_0x508930){utils[_0x19f4('0x21')](util['format'](_0x19f4('0x2c'),_0x435ce9[_0x19f4('0x8')]),_0x508930);}};exports['attendedtransfer']=function(_0x1e95a9){try{if(!_[_0x19f4('0x24')](channels[_0x1e95a9[_0x19f4('0x34')]])){utils[_0x19f4('0x19')](util[_0x19f4('0xb')]('[%s][calls][attendedtransfer]',_0x1e95a9[_0x19f4('0x35')]),_0x1e95a9);if(channels[_0x1e95a9[_0x19f4('0x34')]][_0x19f4('0xd')]==_0x1e95a9[_0x19f4('0x36')]){utils[_0x19f4('0xa')](util[_0x19f4('0xb')](_0x19f4('0x37'),_0x1e95a9['origtransfereruniqueid'],_0x1e95a9[_0x19f4('0x34')],_0x1e95a9['secondtransfererchannel']));channels[_0x1e95a9[_0x19f4('0x34')]][_0x19f4('0x28')]=_0x1e95a9['secondtransfererchannel'];channels[_0x1e95a9[_0x19f4('0x34')]][_0x19f4('0x38')]=_0x19f4('0x39');}else if(channels[_0x1e95a9[_0x19f4('0x34')]][_0x19f4('0xd')]=_0x1e95a9[_0x19f4('0x3a')]){utils[_0x19f4('0xa')](util['format'](_0x19f4('0x37'),_0x1e95a9['origtransfereruniqueid'],_0x1e95a9['localtwolinkedid'],_0x1e95a9[_0x19f4('0x3b')]));channels[_0x1e95a9[_0x19f4('0x34')]][_0x19f4('0x28')]=_0x1e95a9['origtransfererchannel'];channels[_0x1e95a9['localtwolinkedid']][_0x19f4('0x38')]=_0x19f4('0x39');}}}catch(_0x529f1b){utils[_0x19f4('0x21')](util[_0x19f4('0xb')](_0x19f4('0x3c'),_0x1e95a9[_0x19f4('0x35')]),_0x529f1b);}};exports['musiconholdstart']=function(_0x582f33){try{if(!_[_0x19f4('0x24')](channels[_0x582f33[_0x19f4('0x8')]])){utils['debug'](util[_0x19f4('0xb')](_0x19f4('0x3d'),_0x582f33[_0x19f4('0x8')]),_0x582f33);channels[_0x582f33[_0x19f4('0x8')]]['musiconholdstartAt']=utils[_0x19f4('0x20')]();utils[_0x19f4('0xa')](util[_0x19f4('0xb')](_0x19f4('0x3e'),_0x582f33[_0x19f4('0x8')],channels[_0x582f33[_0x19f4('0x8')]][_0x19f4('0x3f')]));}}catch(_0x13c375){utils[_0x19f4('0x21')](util[_0x19f4('0xb')](_0x19f4('0x3d'),_0x582f33['uniqueid']),_0x13c375);}};exports[_0x19f4('0x40')]=function(_0x1f3f11){try{if(!_[_0x19f4('0x24')](channels[_0x1f3f11[_0x19f4('0x8')]])){utils['debug'](util['format'](_0x19f4('0x41'),_0x1f3f11[_0x19f4('0x8')]),_0x1f3f11);if(!_['isNil'](channels[_0x1f3f11[_0x19f4('0x8')]][_0x19f4('0x3f')])){channels[_0x1f3f11[_0x19f4('0x8')]][_0x19f4('0x42')]+=utils[_0x19f4('0x33')](utils[_0x19f4('0x20')](),channels[_0x1f3f11['uniqueid']][_0x19f4('0x3f')]);utils[_0x19f4('0xa')](util[_0x19f4('0xb')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x1f3f11[_0x19f4('0x8')],channels[_0x1f3f11[_0x19f4('0x8')]][_0x19f4('0x42')]));delete channels[_0x1f3f11[_0x19f4('0x8')]]['musiconholdstartAt'];}}}catch(_0x1f235b){utils[_0x19f4('0x21')](util[_0x19f4('0xb')](_0x19f4('0x41'),_0x1f3f11['uniqueid']),_0x1f235b);}};exports['varset']=function(_0x4f55a1){try{if(!_[_0x19f4('0x24')](channels[_0x4f55a1[_0x19f4('0x8')]])){utils[_0x19f4('0x19')](util[_0x19f4('0xb')](_0x19f4('0x43'),_0x4f55a1[_0x19f4('0x8')]),_0x4f55a1);if(!_[_0x19f4('0x24')](_0x4f55a1['variable'][_0x19f4('0x44')])){utils[_0x19f4('0xa')](util[_0x19f4('0xb')](_0x19f4('0x45'),_0x4f55a1[_0x19f4('0x8')],_0x4f55a1[_0x19f4('0x46')]));channels[_0x4f55a1[_0x19f4('0x8')]][_0x19f4('0x47')]=_0x4f55a1[_0x19f4('0x46')];}if(!_[_0x19f4('0x24')](_0x4f55a1[_0x19f4('0x48')][_0x19f4('0x49')])){utils[_0x19f4('0xa')](util[_0x19f4('0xb')](_0x19f4('0x4a'),_0x4f55a1[_0x19f4('0x8')],_0x4f55a1[_0x19f4('0x46')]));channels[_0x4f55a1[_0x19f4('0x8')]]['destination']=_0x4f55a1[_0x19f4('0x46')];channels[_0x4f55a1[_0x19f4('0x8')]][_0x19f4('0x2d')]='\x22'+_0x4f55a1[_0x19f4('0x46')]+_0x19f4('0x4b')+_0x4f55a1[_0x19f4('0x46')]+'>';}if(!_[_0x19f4('0x24')](_0x4f55a1[_0x19f4('0x48')][_0x19f4('0x4c')])||!_[_0x19f4('0x24')](_0x4f55a1[_0x19f4('0x48')]['xmd-callerid'])){utils[_0x19f4('0xa')](util[_0x19f4('0xb')](_0x19f4('0x4d'),_0x4f55a1[_0x19f4('0x8')],!_['isNil'](_0x4f55a1[_0x19f4('0x48')]['xmd-callerid-preview'])?'xmd-callerid-preview':_0x19f4('0x4e'),_0x4f55a1[_0x19f4('0x46')]));channels[_0x4f55a1['uniqueid']][_0x19f4('0x2d')]=_0x4f55a1[_0x19f4('0x46')];}if(!_[_0x19f4('0x24')](_0x4f55a1[_0x19f4('0x48')][_0x19f4('0x4f')])||!_['isNil'](_0x4f55a1[_0x19f4('0x48')][_0x19f4('0x50')])){utils[_0x19f4('0xa')](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x4f55a1[_0x19f4('0x8')],!_[_0x19f4('0x24')](_0x4f55a1[_0x19f4('0x48')]['xmd-queue'])?'xmd-queue':_0x19f4('0x50'),_0x4f55a1['value']));channels[_0x4f55a1['uniqueid']][_0x19f4('0x51')]=_0x19f4('0x52');channels[_0x4f55a1[_0x19f4('0x8')]][_0x19f4('0x53')]=_0x4f55a1['value'];channels[_0x4f55a1[_0x19f4('0x8')]][_0x19f4('0x54')]=!![];}if(!_['isNil'](_0x4f55a1['variable'][_0x19f4('0x55')])){utils['info'](util['format'](_0x19f4('0x56'),_0x4f55a1[_0x19f4('0x8')],_0x4f55a1['value']));channels[_0x4f55a1['uniqueid']][_0x19f4('0x57')]=_0x4f55a1['value'];}if(!_[_0x19f4('0x24')](_0x4f55a1[_0x19f4('0x48')]['xmd-cdrtype'])){utils[_0x19f4('0xa')](util[_0x19f4('0xb')](_0x19f4('0x58'),_0x4f55a1[_0x19f4('0x8')],_0x4f55a1['value']));channels[_0x4f55a1[_0x19f4('0x8')]][_0x19f4('0x59')]=_0x4f55a1[_0x19f4('0x46')];}if(!_[_0x19f4('0x24')](_0x4f55a1[_0x19f4('0x48')][_0x19f4('0x5a')])){utils['info'](util[_0x19f4('0xb')](_0x19f4('0x5b'),_0x4f55a1['uniqueid'],_0x4f55a1[_0x19f4('0x46')]));channels[_0x4f55a1[_0x19f4('0x8')]][_0x19f4('0x5c')]=_0x4f55a1[_0x19f4('0x46')];}if(!_[_0x19f4('0x24')](_0x4f55a1[_0x19f4('0x48')][_0x19f4('0x5d')])){utils[_0x19f4('0xa')](util[_0x19f4('0xb')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x4f55a1[_0x19f4('0x8')],_0x4f55a1[_0x19f4('0x46')]));channels[_0x4f55a1[_0x19f4('0x8')]][_0x19f4('0x5d')]=_0x4f55a1[_0x19f4('0x46')];}}}catch(_0x77b95f){utils[_0x19f4('0x21')](util[_0x19f4('0xb')]('[%s][calls][varset]',_0x4f55a1[_0x19f4('0x8')]),_0x77b95f);}};exports['newexten']=function(_0x3d7d0e){try{if(!_['isNil'](channels[_0x3d7d0e[_0x19f4('0x8')]])){utils[_0x19f4('0x19')](util[_0x19f4('0xb')](_0x19f4('0x5e'),_0x3d7d0e[_0x19f4('0x8')]),_0x3d7d0e);utils[_0x19f4('0xa')](util[_0x19f4('0xb')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x3d7d0e[_0x19f4('0x8')],_0x3d7d0e['application'],_0x3d7d0e[_0x19f4('0x5f')]));if(_0x3d7d0e[_0x19f4('0x60')][_0x19f4('0x61')]()=='set'&&_[_0x19f4('0x62')](_0x3d7d0e[_0x19f4('0x5f')][_0x19f4('0x61')](),_0x19f4('0x63'))){var _0x269b29=_0x3d7d0e[_0x19f4('0x5f')][_0x19f4('0x64')]('=');var _0x7ba1bf=_0x269b29[0x0][_0x19f4('0x65')](_0x269b29[0x0][_0x19f4('0x66')]('(')+0x1,_0x269b29[0x0][_0x19f4('0x66')](')'));var _0x4d58b4=_0x269b29[0x1];channels[_0x3d7d0e[_0x19f4('0x8')]][_0x7ba1bf]=_0x4d58b4;}if(!_[_0x19f4('0x67')](['hangup','noop',_0x19f4('0x68'),'set','gotoif'],_0x3d7d0e[_0x19f4('0x60')][_0x19f4('0x61')]())){channels[_0x3d7d0e[_0x19f4('0x8')]][_0x19f4('0x51')]=_0x3d7d0e[_0x19f4('0x60')];channels[_0x3d7d0e['uniqueid']][_0x19f4('0x53')]=_0x3d7d0e[_0x19f4('0x5f')];}}}catch(_0x43c838){utils[_0x19f4('0x21')](util[_0x19f4('0xb')](_0x19f4('0x5e'),_0x3d7d0e[_0x19f4('0x8')]),_0x43c838);}}; \ No newline at end of file +var _0x06b7=['isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','transfer','answertime','disposition','toNumber','ANSWERED','hangup','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','billableseconds','[%s][calls][hangup]','[%s][calls][attendedtransfer]','localtwolinkedid','transfereechannel','origtransfereruniqueid','secondtransfererchannel','destinationchannel','userfield','_attended','transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','value','source','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','Queue','lastdata','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','cdr','split','substring','lastIndexOf','includes','noop','gotoif','./utils','./transfers.controller','NO\x20ANSWER','FAILED','BUSY','blinds','uniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','interface','lastevent','accountcode','then','UserId','CreateVoiceCallReport','request','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','calleridnum','exten','channel','DOCUMENTATION','error','newstate','[%s][calls][newstate]'];(function(_0x50282e,_0x3ccdcc){var _0x3dedb2=function(_0x3b2cc6){while(--_0x3b2cc6){_0x50282e['push'](_0x50282e['shift']());}};_0x3dedb2(++_0x3ccdcc);}(_0x06b7,0x194));var _0x706b=function(_0x427eed,_0x69d704){_0x427eed=_0x427eed-0x0;var _0x3187bb=_0x06b7[_0x427eed];return _0x3187bb;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x706b('0x0'));var transfers=require(_0x706b('0x1'));var dispositions=[_0x706b('0x2'),'FAILED',_0x706b('0x3'),_0x706b('0x2'),_0x706b('0x2'),_0x706b('0x2'),'ANSWERED',_0x706b('0x4'),'FAILED',_0x706b('0x3'),_0x706b('0x3')];var channels={};function writeDB(_0x654bdd){var _0x8b618;if(transfers[_0x706b('0x5')][_0x654bdd[_0x706b('0x6')]]){_0x8b618=_0x654bdd['uniqueid'];_0x654bdd[_0x706b('0x6')]=transfers['blinds'][_0x654bdd[_0x706b('0x6')]]['transfereeuniqueid'];}utils[_0x706b('0x7')](util[_0x706b('0x8')](_0x706b('0x9'),_0x654bdd[_0x706b('0x6')],_0x654bdd['channel'],_0x654bdd[_0x706b('0xa')],_0x654bdd['membername'],_0x654bdd[_0x706b('0xb')],_0x654bdd['calleridnum'],_0x654bdd['connectedlinenum'],_0x654bdd[_0x706b('0xc')]));if(_0x654bdd[_0x706b('0xd')]){utils['getUserByInternal'](_0x654bdd[_0x706b('0xd')])[_0x706b('0xe')](function(_0x2be9af){if(_0x2be9af){_0x654bdd[_0x706b('0xf')]=_0x2be9af['id'];}utils['request'](_0x706b('0x10'),_0x654bdd);});}else{utils[_0x706b('0x11')](_0x706b('0x10'),_0x654bdd);}if(channels[_0x654bdd[_0x706b('0x6')]]){delete channels[_0x654bdd[_0x706b('0x6')]];}else if(_0x8b618&&channels[_0x8b618]){delete transfers[_0x706b('0x5')][_0x8b618];delete channels[_0x8b618];}}exports[_0x706b('0x12')]=function(_0x113076){try{utils[_0x706b('0x13')](util['format'](_0x706b('0x14'),_0x113076['uniqueid']),_0x113076);if(_0x113076['uniqueid']==_0x113076[_0x706b('0x15')]&&_0x113076['channel']!=_0x706b('0x16')){utils['info'](util['format'](_0x706b('0x17'),_0x113076[_0x706b('0x6')],_0x113076[_0x706b('0x18')],_0x113076['exten']));channels[_0x113076['uniqueid']]={'uniqueid':_0x113076[_0x706b('0x6')],'accountcode':_0x113076[_0x706b('0xd')],'source':_0x113076[_0x706b('0x19')],'destination':_0x113076[_0x706b('0x1a')],'destinationcontext':_0x113076[_0x706b('0x18')],'channel':_0x113076[_0x706b('0x1b')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x706b('0x2'),'amaflags':_0x706b('0x1c')};}}catch(_0x3ca144){utils[_0x706b('0x1d')](util[_0x706b('0x8')](_0x706b('0x14'),_0x113076[_0x706b('0x6')]),_0x3ca144);}};exports[_0x706b('0x1e')]=function(_0x143bd0){try{utils[_0x706b('0x13')](util[_0x706b('0x8')](_0x706b('0x1f'),_0x143bd0['uniqueid']),_0x143bd0);if(!_[_0x706b('0x20')](channels[_0x143bd0[_0x706b('0x6')]])&&_0x143bd0[_0x706b('0x21')]==0x6){utils[_0x706b('0x7')](util[_0x706b('0x8')](_0x706b('0x22'),_0x143bd0['uniqueid'],_0x143bd0[_0x706b('0x18')],_0x143bd0['channel']));if(_[_0x706b('0x20')](channels[_0x143bd0[_0x706b('0x6')]][_0x706b('0x23')])){channels[_0x143bd0[_0x706b('0x6')]][_0x706b('0x23')]=utils[_0x706b('0x24')]();}}else if(!_[_0x706b('0x20')](channels[_0x143bd0[_0x706b('0x15')]])&&_0x143bd0[_0x706b('0x21')]==0x6&&_0x143bd0[_0x706b('0x18')]!=_0x706b('0x25')){utils[_0x706b('0x7')](util[_0x706b('0x8')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x143bd0[_0x706b('0x6')],_0x143bd0['linkedid'],_0x143bd0[_0x706b('0x18')],_0x143bd0['channel']));channels[_0x143bd0[_0x706b('0x15')]][_0x706b('0xd')]=_0x143bd0['accountcode'];channels[_0x143bd0['linkedid']]['destinationchannel']=_0x143bd0['channel'];if(_['isNil'](channels[_0x143bd0[_0x706b('0x15')]][_0x706b('0x26')])){channels[_0x143bd0[_0x706b('0x15')]][_0x706b('0x26')]=utils[_0x706b('0x24')]();}channels[_0x143bd0[_0x706b('0x15')]][_0x706b('0x27')]=dispositions[_[_0x706b('0x28')](_0x143bd0['channelstate'])]||_0x706b('0x29');}}catch(_0x3774bc){utils[_0x706b('0x1d')](util['format'](_0x706b('0x1f'),_0x143bd0[_0x706b('0x6')]),_0x3774bc);}};exports[_0x706b('0x2a')]=function(_0x503e81){try{if(!_[_0x706b('0x20')](channels[_0x503e81['uniqueid']])){utils[_0x706b('0x13')](util['format']('[%s][calls][hangup]',_0x503e81['uniqueid']),_0x503e81);if(_[_0x706b('0x20')](channels[_0x503e81[_0x706b('0x6')]]['callerid'])){channels[_0x503e81['uniqueid']][_0x706b('0x2b')]=_0x503e81[_0x706b('0x2c')]+'\x20<'+_0x503e81[_0x706b('0x19')]+'>';}utils[_0x706b('0x7')](util[_0x706b('0x8')](_0x706b('0x2d'),_0x503e81[_0x706b('0x6')],channels[_0x503e81[_0x706b('0x6')]][_0x706b('0x2b')],_0x503e81[_0x706b('0x2e')]));channels[_0x503e81[_0x706b('0x6')]][_0x706b('0x2f')]=utils[_0x706b('0x24')]();channels[_0x503e81[_0x706b('0x6')]][_0x706b('0x30')]=utils[_0x706b('0x31')](channels[_0x503e81['uniqueid']][_0x706b('0x2f')],channels[_0x503e81[_0x706b('0x6')]][_0x706b('0x32')]);channels[_0x503e81[_0x706b('0x6')]][_0x706b('0x33')]=channels[_0x503e81[_0x706b('0x6')]][_0x706b('0x26')]?utils[_0x706b('0x31')](channels[_0x503e81[_0x706b('0x6')]][_0x706b('0x2f')],channels[_0x503e81[_0x706b('0x6')]][_0x706b('0x26')]):0x0;writeDB(channels[_0x503e81[_0x706b('0x6')]]);}}catch(_0x38ceaa){utils['error'](util['format'](_0x706b('0x34'),_0x503e81[_0x706b('0x6')]),_0x38ceaa);}};exports['attendedtransfer']=function(_0x39f13f){try{if(!_['isNil'](channels[_0x39f13f['localtwolinkedid']])){utils[_0x706b('0x13')](util[_0x706b('0x8')](_0x706b('0x35'),_0x39f13f['origtransfereruniqueid']),_0x39f13f);if(channels[_0x39f13f[_0x706b('0x36')]]['channel']==_0x39f13f[_0x706b('0x37')]){utils[_0x706b('0x7')](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x39f13f[_0x706b('0x38')],_0x39f13f[_0x706b('0x36')],_0x39f13f[_0x706b('0x39')]));channels[_0x39f13f[_0x706b('0x36')]][_0x706b('0x3a')]=_0x39f13f[_0x706b('0x39')];channels[_0x39f13f['localtwolinkedid']][_0x706b('0x3b')]=_0x706b('0x3c');}else if(channels[_0x39f13f['localtwolinkedid']][_0x706b('0x1b')]=_0x39f13f[_0x706b('0x3d')]){utils[_0x706b('0x7')](util['format'](_0x706b('0x3e'),_0x39f13f['origtransfereruniqueid'],_0x39f13f[_0x706b('0x36')],_0x39f13f[_0x706b('0x3f')]));channels[_0x39f13f[_0x706b('0x36')]][_0x706b('0x3a')]=_0x39f13f[_0x706b('0x3f')];channels[_0x39f13f[_0x706b('0x36')]]['userfield']='_attended';}}}catch(_0x471156){utils[_0x706b('0x1d')](util[_0x706b('0x8')](_0x706b('0x35'),_0x39f13f[_0x706b('0x38')]),_0x471156);}};exports['musiconholdstart']=function(_0x359685){try{if(!_['isNil'](channels[_0x359685[_0x706b('0x6')]])){utils[_0x706b('0x13')](util[_0x706b('0x8')](_0x706b('0x40'),_0x359685[_0x706b('0x6')]),_0x359685);channels[_0x359685['uniqueid']][_0x706b('0x41')]=utils['now']();utils[_0x706b('0x7')](util['format'](_0x706b('0x42'),_0x359685[_0x706b('0x6')],channels[_0x359685[_0x706b('0x6')]][_0x706b('0x41')]));}}catch(_0xd0c0b4){utils[_0x706b('0x1d')](util[_0x706b('0x8')](_0x706b('0x40'),_0x359685[_0x706b('0x6')]),_0xd0c0b4);}};exports[_0x706b('0x43')]=function(_0x5927ec){try{if(!_['isNil'](channels[_0x5927ec[_0x706b('0x6')]])){utils[_0x706b('0x13')](util['format'](_0x706b('0x44'),_0x5927ec[_0x706b('0x6')]),_0x5927ec);if(!_[_0x706b('0x20')](channels[_0x5927ec[_0x706b('0x6')]]['musiconholdstartAt'])){channels[_0x5927ec['uniqueid']][_0x706b('0x45')]+=utils['diffTime'](utils[_0x706b('0x24')](),channels[_0x5927ec[_0x706b('0x6')]][_0x706b('0x41')]);utils[_0x706b('0x7')](util['format'](_0x706b('0x46'),_0x5927ec[_0x706b('0x6')],channels[_0x5927ec[_0x706b('0x6')]][_0x706b('0x45')]));delete channels[_0x5927ec['uniqueid']][_0x706b('0x41')];}}}catch(_0x48cfa0){utils['error'](util['format']('[%s][calls][musiconholdstop]',_0x5927ec['uniqueid']),_0x48cfa0);}};exports[_0x706b('0x47')]=function(_0x564f9e){try{if(!_[_0x706b('0x20')](channels[_0x564f9e[_0x706b('0x6')]])){utils[_0x706b('0x13')](util[_0x706b('0x8')](_0x706b('0x48'),_0x564f9e[_0x706b('0x6')]),_0x564f9e);if(!_[_0x706b('0x20')](_0x564f9e[_0x706b('0x49')][_0x706b('0x4a')])){utils[_0x706b('0x7')](util['format']('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x564f9e[_0x706b('0x6')],_0x564f9e[_0x706b('0x4b')]));channels[_0x564f9e['uniqueid']][_0x706b('0x4c')]=_0x564f9e[_0x706b('0x4b')];}if(!_[_0x706b('0x20')](_0x564f9e[_0x706b('0x49')]['xmd-phone'])){utils['info'](util[_0x706b('0x8')](_0x706b('0x4d'),_0x564f9e[_0x706b('0x6')],_0x564f9e[_0x706b('0x4b')]));channels[_0x564f9e[_0x706b('0x6')]]['destination']=_0x564f9e[_0x706b('0x4b')];channels[_0x564f9e['uniqueid']][_0x706b('0x2b')]='\x22'+_0x564f9e['value']+_0x706b('0x4e')+_0x564f9e['value']+'>';}if(!_[_0x706b('0x20')](_0x564f9e[_0x706b('0x49')]['xmd-callerid-preview'])||!_['isNil'](_0x564f9e[_0x706b('0x49')]['xmd-callerid'])){utils[_0x706b('0x7')](util[_0x706b('0x8')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x564f9e['uniqueid'],!_[_0x706b('0x20')](_0x564f9e[_0x706b('0x49')][_0x706b('0x4f')])?'xmd-callerid-preview':_0x706b('0x50'),_0x564f9e['value']));channels[_0x564f9e[_0x706b('0x6')]][_0x706b('0x2b')]=_0x564f9e[_0x706b('0x4b')];}if(!_['isNil'](_0x564f9e['variable'][_0x706b('0x51')])||!_[_0x706b('0x20')](_0x564f9e[_0x706b('0x49')][_0x706b('0x52')])){utils[_0x706b('0x7')](util['format'](_0x706b('0x53'),_0x564f9e[_0x706b('0x6')],!_['isNil'](_0x564f9e['variable']['xmd-queue'])?_0x706b('0x51'):_0x706b('0x52'),_0x564f9e[_0x706b('0x4b')]));channels[_0x564f9e[_0x706b('0x6')]]['lastapplication']=_0x706b('0x54');channels[_0x564f9e['uniqueid']][_0x706b('0x55')]=_0x564f9e['value'];channels[_0x564f9e[_0x706b('0x6')]][_0x706b('0xa')]=!![];}if(!_[_0x706b('0x20')](_0x564f9e['variable']['xmd-contactid'])){utils[_0x706b('0x7')](util[_0x706b('0x8')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x564f9e[_0x706b('0x6')],_0x564f9e[_0x706b('0x4b')]));channels[_0x564f9e[_0x706b('0x6')]][_0x706b('0x56')]=_0x564f9e[_0x706b('0x4b')];}if(!_[_0x706b('0x20')](_0x564f9e[_0x706b('0x49')][_0x706b('0x57')])){utils['info'](util[_0x706b('0x8')](_0x706b('0x58'),_0x564f9e[_0x706b('0x6')],_0x564f9e[_0x706b('0x4b')]));channels[_0x564f9e[_0x706b('0x6')]][_0x706b('0x59')]=_0x564f9e['value'];}if(!_[_0x706b('0x20')](_0x564f9e['variable']['outboundrouteid'])){utils[_0x706b('0x7')](util[_0x706b('0x8')](_0x706b('0x5a'),_0x564f9e[_0x706b('0x6')],_0x564f9e[_0x706b('0x4b')]));channels[_0x564f9e[_0x706b('0x6')]][_0x706b('0x5b')]=_0x564f9e[_0x706b('0x4b')];}if(!_['isNil'](_0x564f9e[_0x706b('0x49')][_0x706b('0x5c')])){utils[_0x706b('0x7')](util[_0x706b('0x8')](_0x706b('0x5d'),_0x564f9e[_0x706b('0x6')],_0x564f9e[_0x706b('0x4b')]));channels[_0x564f9e[_0x706b('0x6')]]['sipcallid']=_0x564f9e['value'];}}}catch(_0x5b9558){utils[_0x706b('0x1d')](util[_0x706b('0x8')](_0x706b('0x48'),_0x564f9e['uniqueid']),_0x5b9558);}};exports[_0x706b('0x5e')]=function(_0x15bd4a){try{if(!_['isNil'](channels[_0x15bd4a[_0x706b('0x6')]])){utils[_0x706b('0x13')](util['format'](_0x706b('0x5f'),_0x15bd4a[_0x706b('0x6')]),_0x15bd4a);utils[_0x706b('0x7')](util[_0x706b('0x8')](_0x706b('0x60'),_0x15bd4a[_0x706b('0x6')],_0x15bd4a[_0x706b('0x61')],_0x15bd4a['appdata']));if(_0x15bd4a['application'][_0x706b('0x62')]()==_0x706b('0x63')&&_[_0x706b('0x64')](_0x15bd4a[_0x706b('0x65')][_0x706b('0x62')](),_0x706b('0x66'))){var _0x23ee7f=_0x15bd4a[_0x706b('0x65')][_0x706b('0x67')]('=');var _0x24f053=_0x23ee7f[0x0][_0x706b('0x68')](_0x23ee7f[0x0][_0x706b('0x69')]('(')+0x1,_0x23ee7f[0x0]['lastIndexOf'](')'));var _0x31fc22=_0x23ee7f[0x1];channels[_0x15bd4a['uniqueid']][_0x24f053]=_0x31fc22;}if(!_[_0x706b('0x6a')]([_0x706b('0x2a'),_0x706b('0x6b'),'execif',_0x706b('0x63'),_0x706b('0x6c')],_0x15bd4a['application'][_0x706b('0x62')]())){channels[_0x15bd4a[_0x706b('0x6')]]['lastapplication']=_0x15bd4a['application'];channels[_0x15bd4a[_0x706b('0x6')]]['lastdata']=_0x15bd4a[_0x706b('0x65')];}}}catch(_0x38e9c1){utils['error'](util['format'](_0x706b('0x5f'),_0x15bd4a[_0x706b('0x6')]),_0x38e9c1);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 4a2ec97..b2ed276 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 _0x0ba4=['[core]\x20fullybooted','error','close','managerevent','./utils','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x0ba4,0xf4));var _0x40ba=function(_0x8a30cf,_0x40f19b){_0x8a30cf=_0x8a30cf-0x0;var _0x20f439=_0x0ba4[_0x8a30cf];return _0x20f439;};'use strict';var utils=require(_0x40ba('0x0'));exports['connect']=function(){utils[_0x40ba('0x1')](_0x40ba('0x2'));};exports[_0x40ba('0x3')]=function(){utils[_0x40ba('0x1')](_0x40ba('0x4'));};exports[_0x40ba('0x5')]=function(){utils['info'](_0x40ba('0x6'));};exports[_0x40ba('0x7')]=function(_0x2c61c7){utils[_0x40ba('0x7')]('[core]\x20error',_0x2c61c7);};exports[_0x40ba('0x8')]=function(){utils[_0x40ba('0x1')]('[core]\x20close');};exports[_0x40ba('0x9')]=function(_0x5bb268){}; \ No newline at end of file +var _0x3728=['close','[core]\x20close','managerevent','connect','[core]\x20connected','shutdown','info','fullybooted','error','[core]\x20error'];(function(_0x50fbce,_0x201c9e){var _0x4df582=function(_0x1c3e80){while(--_0x1c3e80){_0x50fbce['push'](_0x50fbce['shift']());}};_0x4df582(++_0x201c9e);}(_0x3728,0x125));var _0x8372=function(_0x53618b,_0x50a348){_0x53618b=_0x53618b-0x0;var _0x98e4b4=_0x3728[_0x53618b];return _0x98e4b4;};'use strict';var utils=require('./utils');exports[_0x8372('0x0')]=function(){utils['info'](_0x8372('0x1'));};exports[_0x8372('0x2')]=function(){utils[_0x8372('0x3')]('[core]\x20shutdown');};exports[_0x8372('0x4')]=function(){utils[_0x8372('0x3')]('[core]\x20fullybooted');};exports[_0x8372('0x5')]=function(_0x467593){utils[_0x8372('0x5')](_0x8372('0x6'),_0x467593);};exports[_0x8372('0x7')]=function(){utils[_0x8372('0x3')](_0x8372('0x8'));};exports[_0x8372('0x9')]=function(_0x2db596){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index e35a0c3..7c4db0c 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 _0x29a7=['application','toLowerCase','set','startsWith','appdata','cdr(routeid)','error','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','assign','starttime','now','lastevent','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','endtime','holdtime','diffTime','util','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','dialstatus','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s'];(function(_0x455ed5,_0xab57cc){var _0x481ac4=function(_0x4e2e61){while(--_0x4e2e61){_0x455ed5['push'](_0x455ed5['shift']());}};_0x481ac4(++_0xab57cc);}(_0x29a7,0x11d));var _0x729a=function(_0x3af619,_0x53662){_0x3af619=_0x3af619-0x0;var _0x5d3375=_0x29a7[_0x3af619];return _0x5d3375;};'use strict';var _=require('lodash');var util=require(_0x729a('0x0'));var utils=require('./utils');var dials={};function writeDB(_0x53c2e0){utils[_0x729a('0x1')](util[_0x729a('0x2')](_0x729a('0x3'),_0x53c2e0[_0x729a('0x4')],_0x53c2e0[_0x729a('0x5')],_0x53c2e0[_0x729a('0x6')],_0x53c2e0[_0x729a('0x7')],_0x53c2e0['connectedlinenum'],_0x53c2e0[_0x729a('0x8')]));utils[_0x729a('0x9')](_0x729a('0xa'),_0x53c2e0);delete dials[_0x53c2e0[_0x729a('0x4')]];}exports[_0x729a('0xb')]=function(_0x2b2c50){try{utils[_0x729a('0xc')](util[_0x729a('0x2')](_0x729a('0xd'),_0x2b2c50['uniqueid']),_0x2b2c50);utils[_0x729a('0x1')](util[_0x729a('0x2')](_0x729a('0xe'),_0x2b2c50['uniqueid'],_0x2b2c50[_0x729a('0xf')],_0x2b2c50['appdata']));if(_0x2b2c50[_0x729a('0xf')][_0x729a('0x10')]()==_0x729a('0x11')&&_[_0x729a('0x12')](_0x2b2c50[_0x729a('0x13')][_0x729a('0x10')](),_0x729a('0x14'))){var _0x1f26c4=_0x2b2c50['appdata']['split']('=');dials[_0x2b2c50[_0x729a('0x4')]]={'routeId':_0x1f26c4[0x1]};}}catch(_0x32d6f0){utils[_0x729a('0x15')](util[_0x729a('0x2')]('[%s][dials][newexten]',_0x2b2c50['uniqueid']),_0x32d6f0);}};exports['varset']=function(_0x3b6ea0){try{utils[_0x729a('0xc')](util['format'](_0x729a('0x16'),_0x3b6ea0[_0x729a('0x4')]),_0x3b6ea0);if(!_[_0x729a('0x17')](_0x3b6ea0[_0x729a('0x18')][_0x729a('0x19')])){utils['info'](util['format'](_0x729a('0x1a'),_0x3b6ea0[_0x729a('0x4')],_0x3b6ea0[_0x729a('0x1b')]));dials[_0x3b6ea0['uniqueid']]={'routeId':_0x3b6ea0[_0x729a('0x1b')]};}}catch(_0x439ed9){utils[_0x729a('0x15')](util['format'](_0x729a('0x16'),_0x3b6ea0[_0x729a('0x4')]),_0x439ed9);}};exports['dialbegin']=function(_0x59a1bf){try{if(!_[_0x729a('0x17')](dials[_0x59a1bf[_0x729a('0x4')]])){utils['debug'](util[_0x729a('0x2')]('[%s][dials][dialbegin]',_0x59a1bf[_0x729a('0x4')]),_0x59a1bf);dials[_0x59a1bf[_0x729a('0x4')]]=_[_0x729a('0x1c')](dials[_0x59a1bf[_0x729a('0x4')]],_0x59a1bf);dials[_0x59a1bf[_0x729a('0x4')]][_0x729a('0x1d')]=utils[_0x729a('0x1e')]();dials[_0x59a1bf[_0x729a('0x4')]][_0x729a('0x1f')]='called';utils[_0x729a('0x1')](util[_0x729a('0x2')](_0x729a('0x20'),_0x59a1bf[_0x729a('0x4')],dials[_0x59a1bf[_0x729a('0x4')]][_0x729a('0x1d')]));}}catch(_0x42d44c){utils[_0x729a('0x15')](util[_0x729a('0x2')]('[%s][dials][dialbegin]',_0x59a1bf[_0x729a('0x4')]),_0x42d44c);}};exports[_0x729a('0x21')]=function(_0x2ccc17){try{if(!_[_0x729a('0x17')](dials[_0x2ccc17[_0x729a('0x4')]])){utils[_0x729a('0xc')](util[_0x729a('0x2')](_0x729a('0x22'),_0x2ccc17['uniqueid']),_0x2ccc17);dials[_0x2ccc17[_0x729a('0x4')]][_0x729a('0x8')]=_0x2ccc17[_0x729a('0x8')];if(_0x2ccc17[_0x729a('0x8')]==_0x729a('0x23')){dials[_0x2ccc17['uniqueid']]=_[_0x729a('0x1c')](dials[_0x2ccc17[_0x729a('0x4')]],_0x2ccc17);dials[_0x2ccc17[_0x729a('0x4')]][_0x729a('0x24')]=utils['now']();dials[_0x2ccc17['uniqueid']]['lastevent']=_0x729a('0x25');utils[_0x729a('0x1')](util['format'](_0x729a('0x26'),_0x2ccc17[_0x729a('0x4')],_0x2ccc17['dialstatus'],dials[_0x2ccc17[_0x729a('0x4')]]['answertime']));}else{utils[_0x729a('0x1')](util[_0x729a('0x2')](_0x729a('0x27'),_0x2ccc17[_0x729a('0x4')],_0x2ccc17['dialstatus']));}}}catch(_0x3815e7){utils[_0x729a('0x15')](util[_0x729a('0x2')](_0x729a('0x22'),_0x2ccc17['uniqueid']),_0x3815e7);}};exports[_0x729a('0x28')]=function(_0x318bd1){try{if(!_[_0x729a('0x17')](dials[_0x318bd1['uniqueid']])){utils[_0x729a('0xc')](util[_0x729a('0x2')](_0x729a('0x29'),_0x318bd1[_0x729a('0x4')]),_0x318bd1);utils[_0x729a('0x1')](util[_0x729a('0x2')](_0x729a('0x2a'),_0x318bd1[_0x729a('0x4')],_0x318bd1['calleridnum'],_0x318bd1[_0x729a('0x2b')],_0x318bd1[_0x729a('0x2c')]));dials[_0x318bd1['uniqueid']]=_[_0x729a('0x1c')](dials[_0x318bd1['uniqueid']],{'endtime':utils['now'](),'lastevent':_0x729a('0x2d')});dials[_0x318bd1[_0x729a('0x4')]][_0x729a('0x2e')]=utils['diffTime'](dials[_0x318bd1[_0x729a('0x4')]][_0x729a('0x2f')],dials[_0x318bd1[_0x729a('0x4')]][_0x729a('0x1d')]);dials[_0x318bd1[_0x729a('0x4')]][_0x729a('0x30')]=utils['diffTime'](dials[_0x318bd1[_0x729a('0x4')]][_0x729a('0x24')]||dials[_0x318bd1['uniqueid']]['endtime'],dials[_0x318bd1[_0x729a('0x4')]][_0x729a('0x1d')]);dials[_0x318bd1[_0x729a('0x4')]]['billableseconds']=dials[_0x318bd1[_0x729a('0x4')]]['answertime']?utils[_0x729a('0x31')](dials[_0x318bd1[_0x729a('0x4')]][_0x729a('0x2f')],dials[_0x318bd1['uniqueid']][_0x729a('0x24')]):0x0;writeDB(dials[_0x318bd1[_0x729a('0x4')]]);}}catch(_0x3a65ab){utils[_0x729a('0x15')](util[_0x729a('0x2')](_0x729a('0x29'),_0x318bd1[_0x729a('0x4')]),_0x3a65ab);}}; \ No newline at end of file +var _0x0b2c=['holdtime','billableseconds','lodash','./utils','uniqueid','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','format','[%s][dials][newexten]','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','startsWith','appdata','cdr(routeid)','split','error','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][varset]','dialbegin','[%s][dials][dialbegin]','assign','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','dialend','[%s][dials][dialend]','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','calleridname','cause-txt','complete','duration','diffTime','endtime'];(function(_0x29f80e,_0x9027ff){var _0x5c7eaa=function(_0x48ec7c){while(--_0x48ec7c){_0x29f80e['push'](_0x29f80e['shift']());}};_0x5c7eaa(++_0x9027ff);}(_0x0b2c,0x1df));var _0xc0b2=function(_0x1b8880,_0x371d21){_0x1b8880=_0x1b8880-0x0;var _0x368422=_0x0b2c[_0x1b8880];return _0x368422;};'use strict';var _=require(_0xc0b2('0x0'));var util=require('util');var utils=require(_0xc0b2('0x1'));var dials={};function writeDB(_0xc7ffca){utils['info'](util['format']('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0xc7ffca[_0xc0b2('0x2')],_0xc7ffca['channel'],_0xc7ffca[_0xc0b2('0x3')],_0xc7ffca[_0xc0b2('0x4')],_0xc7ffca[_0xc0b2('0x5')],_0xc7ffca[_0xc0b2('0x6')]));utils[_0xc0b2('0x7')](_0xc0b2('0x8'),_0xc7ffca);delete dials[_0xc7ffca[_0xc0b2('0x2')]];}exports[_0xc0b2('0x9')]=function(_0x283b73){try{utils[_0xc0b2('0xa')](util[_0xc0b2('0xb')](_0xc0b2('0xc'),_0x283b73['uniqueid']),_0x283b73);utils[_0xc0b2('0xd')](util[_0xc0b2('0xb')](_0xc0b2('0xe'),_0x283b73['uniqueid'],_0x283b73['application'],_0x283b73['appdata']));if(_0x283b73[_0xc0b2('0xf')][_0xc0b2('0x10')]()=='set'&&_[_0xc0b2('0x11')](_0x283b73[_0xc0b2('0x12')]['toLowerCase'](),_0xc0b2('0x13'))){var _0x235bda=_0x283b73['appdata'][_0xc0b2('0x14')]('=');dials[_0x283b73[_0xc0b2('0x2')]]={'routeId':_0x235bda[0x1]};}}catch(_0x53e591){utils[_0xc0b2('0x15')](util[_0xc0b2('0xb')]('[%s][dials][newexten]',_0x283b73[_0xc0b2('0x2')]),_0x53e591);}};exports['varset']=function(_0x48f572){try{utils[_0xc0b2('0xa')](util[_0xc0b2('0xb')]('[%s][dials][varset]',_0x48f572[_0xc0b2('0x2')]),_0x48f572);if(!_[_0xc0b2('0x16')](_0x48f572[_0xc0b2('0x17')][_0xc0b2('0x18')])){utils[_0xc0b2('0xd')](util[_0xc0b2('0xb')](_0xc0b2('0x19'),_0x48f572[_0xc0b2('0x2')],_0x48f572[_0xc0b2('0x1a')]));dials[_0x48f572[_0xc0b2('0x2')]]={'routeId':_0x48f572[_0xc0b2('0x1a')]};}}catch(_0x348ce8){utils['error'](util[_0xc0b2('0xb')](_0xc0b2('0x1b'),_0x48f572['uniqueid']),_0x348ce8);}};exports[_0xc0b2('0x1c')]=function(_0x2efbeb){try{if(!_[_0xc0b2('0x16')](dials[_0x2efbeb[_0xc0b2('0x2')]])){utils[_0xc0b2('0xa')](util[_0xc0b2('0xb')](_0xc0b2('0x1d'),_0x2efbeb[_0xc0b2('0x2')]),_0x2efbeb);dials[_0x2efbeb[_0xc0b2('0x2')]]=_[_0xc0b2('0x1e')](dials[_0x2efbeb[_0xc0b2('0x2')]],_0x2efbeb);dials[_0x2efbeb[_0xc0b2('0x2')]]['starttime']=utils[_0xc0b2('0x1f')]();dials[_0x2efbeb[_0xc0b2('0x2')]][_0xc0b2('0x20')]=_0xc0b2('0x21');utils['info'](util['format'](_0xc0b2('0x22'),_0x2efbeb[_0xc0b2('0x2')],dials[_0x2efbeb[_0xc0b2('0x2')]][_0xc0b2('0x23')]));}}catch(_0x1b7ce6){utils['error'](util[_0xc0b2('0xb')](_0xc0b2('0x1d'),_0x2efbeb[_0xc0b2('0x2')]),_0x1b7ce6);}};exports[_0xc0b2('0x24')]=function(_0x4c998d){try{if(!_[_0xc0b2('0x16')](dials[_0x4c998d[_0xc0b2('0x2')]])){utils['debug'](util['format'](_0xc0b2('0x25'),_0x4c998d[_0xc0b2('0x2')]),_0x4c998d);dials[_0x4c998d['uniqueid']][_0xc0b2('0x6')]=_0x4c998d[_0xc0b2('0x6')];if(_0x4c998d[_0xc0b2('0x6')]==_0xc0b2('0x26')){dials[_0x4c998d[_0xc0b2('0x2')]]=_[_0xc0b2('0x1e')](dials[_0x4c998d['uniqueid']],_0x4c998d);dials[_0x4c998d[_0xc0b2('0x2')]][_0xc0b2('0x27')]=utils['now']();dials[_0x4c998d[_0xc0b2('0x2')]][_0xc0b2('0x20')]=_0xc0b2('0x28');utils['info'](util[_0xc0b2('0xb')](_0xc0b2('0x29'),_0x4c998d[_0xc0b2('0x2')],_0x4c998d[_0xc0b2('0x6')],dials[_0x4c998d[_0xc0b2('0x2')]][_0xc0b2('0x27')]));}else{utils[_0xc0b2('0xd')](util[_0xc0b2('0xb')](_0xc0b2('0x2a'),_0x4c998d[_0xc0b2('0x2')],_0x4c998d['dialstatus']));}}}catch(_0x3911f2){utils[_0xc0b2('0x15')](util[_0xc0b2('0xb')](_0xc0b2('0x25'),_0x4c998d['uniqueid']),_0x3911f2);}};exports[_0xc0b2('0x2b')]=function(_0x57cbaf){try{if(!_['isNil'](dials[_0x57cbaf[_0xc0b2('0x2')]])){utils[_0xc0b2('0xa')](util[_0xc0b2('0xb')](_0xc0b2('0x2c'),_0x57cbaf[_0xc0b2('0x2')]),_0x57cbaf);utils['info'](util[_0xc0b2('0xb')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x57cbaf['uniqueid'],_0x57cbaf[_0xc0b2('0x4')],_0x57cbaf[_0xc0b2('0x2d')],_0x57cbaf[_0xc0b2('0x2e')]));dials[_0x57cbaf[_0xc0b2('0x2')]]=_[_0xc0b2('0x1e')](dials[_0x57cbaf[_0xc0b2('0x2')]],{'endtime':utils[_0xc0b2('0x1f')](),'lastevent':_0xc0b2('0x2f')});dials[_0x57cbaf[_0xc0b2('0x2')]][_0xc0b2('0x30')]=utils[_0xc0b2('0x31')](dials[_0x57cbaf[_0xc0b2('0x2')]][_0xc0b2('0x32')],dials[_0x57cbaf[_0xc0b2('0x2')]]['starttime']);dials[_0x57cbaf[_0xc0b2('0x2')]][_0xc0b2('0x33')]=utils[_0xc0b2('0x31')](dials[_0x57cbaf[_0xc0b2('0x2')]]['answertime']||dials[_0x57cbaf[_0xc0b2('0x2')]][_0xc0b2('0x32')],dials[_0x57cbaf[_0xc0b2('0x2')]][_0xc0b2('0x23')]);dials[_0x57cbaf[_0xc0b2('0x2')]][_0xc0b2('0x34')]=dials[_0x57cbaf[_0xc0b2('0x2')]][_0xc0b2('0x27')]?utils['diffTime'](dials[_0x57cbaf[_0xc0b2('0x2')]][_0xc0b2('0x32')],dials[_0x57cbaf['uniqueid']]['answertime']):0x0;writeDB(dials[_0x57cbaf[_0xc0b2('0x2')]]);}}catch(_0x16fc36){utils[_0xc0b2('0x15')](util[_0xc0b2('0xb')](_0xc0b2('0x2c'),_0x57cbaf['uniqueid']),_0x16fc36);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index eeec363..ea2c12a 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 _0x17c8=['[%s][index][dialend]','../../config/environment','./utils','asterisk','port','username','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','connect','shutdown','fullybooted','error','close','managerevent','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','[%s][index][agentringnoanswer]','[%s][index][agentconnect]','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','dialbegin','[%s]dialbegin','dialend'];(function(_0xc218e6,_0x310656){var _0x4d202e=function(_0x2053bf){while(--_0x2053bf){_0xc218e6['push'](_0xc218e6['shift']());}};_0x4d202e(++_0x310656);}(_0x17c8,0x141));var _0x817c=function(_0x38715b,_0x364d45){_0x38715b=_0x38715b-0x0;var _0x24b586=_0x17c8[_0x38715b];return _0x24b586;};var AsteriskManager=require('asterisk-manager');var config=require(_0x817c('0x0'));var utils=require(_0x817c('0x1'));var util=require('util');var ami=new AsteriskManager(config[_0x817c('0x2')][_0x817c('0x3')],config['asterisk']['ip'],config[_0x817c('0x2')][_0x817c('0x4')],config[_0x817c('0x2')]['password'],!![]);ami[_0x817c('0x5')]();if(config[_0x817c('0x6')]&&config['xdr'][_0x817c('0x7')]){utils[_0x817c('0x8')](_0x817c('0x9'));}else{var agents=require(_0x817c('0xa'));var calls=require(_0x817c('0xb'));var queues=require(_0x817c('0xc'));var recordings=require(_0x817c('0xd'));var members=require(_0x817c('0xe'));var dials=require('./dials.controller');var transfers=require('./transfers.controller');var core=require('./core.controller');ami['on'](_0x817c('0xf'),core[_0x817c('0xf')]);ami['on']('shutdown',core[_0x817c('0x10')]);ami['on']('fullybooted',core[_0x817c('0x11')]);ami['on'](_0x817c('0x12'),core[_0x817c('0x12')]);ami['on'](_0x817c('0x13'),core[_0x817c('0x13')]);ami['on'](_0x817c('0x14'),core[_0x817c('0x14')]);ami['on']('devicestatechange',function(_0x5adbd0){try{utils[_0x817c('0x15')](util[_0x817c('0x16')](_0x817c('0x17'),_0x5adbd0[_0x817c('0x18')]),_0x5adbd0);members['devicestatechange'](_0x5adbd0);}catch(_0x493903){utils[_0x817c('0x12')](util[_0x817c('0x16')]('[%s][index][devicestatechange]',_0x5adbd0[_0x817c('0x18')]),_0x493903);}});ami['on'](_0x817c('0x19'),function(_0x27c026){try{utils[_0x817c('0x15')](util[_0x817c('0x16')](_0x817c('0x1a'),_0x27c026[_0x817c('0x1b')]),_0x27c026);agents[_0x817c('0x19')](_0x27c026);}catch(_0x1a5e9a){utils[_0x817c('0x12')](util[_0x817c('0x16')](_0x817c('0x1a'),_0x27c026['uniqueid']),_0x1a5e9a);}});ami['on']('agentringnoanswer',function(_0x442916){try{utils[_0x817c('0x15')](util[_0x817c('0x16')](_0x817c('0x1c'),_0x442916[_0x817c('0x1b')]),_0x442916);agents['agentringnoanswer'](_0x442916);}catch(_0x49adf1){utils[_0x817c('0x12')](util[_0x817c('0x16')](_0x817c('0x1c'),_0x442916['uniqueid']),_0x49adf1);}});ami['on']('agentconnect',function(_0x158a0b){try{utils[_0x817c('0x15')](util[_0x817c('0x16')](_0x817c('0x1d'),_0x158a0b['uniqueid']),_0x158a0b);agents[_0x817c('0x1e')](_0x158a0b);queues[_0x817c('0x1e')](_0x158a0b);}catch(_0x3c7f43){utils[_0x817c('0x12')](util[_0x817c('0x16')](_0x817c('0x1d'),_0x158a0b['uniqueid']),_0x3c7f43);}});ami['on'](_0x817c('0x1f'),function(_0x2723e0){try{utils[_0x817c('0x15')](util[_0x817c('0x16')]('[%s][index][agentcomplete]',_0x2723e0[_0x817c('0x1b')]),_0x2723e0);agents[_0x817c('0x1f')](_0x2723e0);queues[_0x817c('0x1f')](_0x2723e0);members['agentcomplete'](_0x2723e0);}catch(_0x5d2505){utils[_0x817c('0x12')](util[_0x817c('0x16')](_0x817c('0x20'),_0x2723e0['uniqueid']),_0x5d2505);}});ami['on'](_0x817c('0x21'),function(_0x5d2019){try{utils['debug'](util[_0x817c('0x16')](_0x817c('0x22'),_0x5d2019[_0x817c('0x1b')]),_0x5d2019);agents[_0x817c('0x21')](_0x5d2019);queues['queuecallerabandon'](_0x5d2019);}catch(_0x5acbf0){utils[_0x817c('0x12')](util[_0x817c('0x16')]('[%s][index][queuecallerabandon]',_0x5d2019[_0x817c('0x1b')]),_0x5acbf0);}});ami['on'](_0x817c('0x23'),function(_0x251219){try{utils[_0x817c('0x15')](util[_0x817c('0x16')](_0x817c('0x24'),_0x251219[_0x817c('0x1b')]),_0x251219);queues[_0x817c('0x23')](_0x251219);recordings[_0x817c('0x23')](_0x251219);}catch(_0x1eba9b){utils[_0x817c('0x12')](util[_0x817c('0x16')]('[%s][index][queuecallerjoin]',_0x251219[_0x817c('0x1b')]),_0x1eba9b);}});ami['on'](_0x817c('0x25'),function(_0x48857e){try{utils['debug'](util['format'](_0x817c('0x26'),_0x48857e[_0x817c('0x1b')]),_0x48857e);queues[_0x817c('0x25')](_0x48857e);}catch(_0x4a0b2c){utils[_0x817c('0x12')](util[_0x817c('0x16')]('[%s][index][queuecallerleave]',_0x48857e[_0x817c('0x1b')]),_0x4a0b2c);}});ami['on'](_0x817c('0x27'),function(_0x53be31){try{utils[_0x817c('0x15')](util[_0x817c('0x16')]('[%s][index][musiconholdstart]',_0x53be31[_0x817c('0x1b')]),_0x53be31);queues[_0x817c('0x27')](_0x53be31);calls[_0x817c('0x27')](_0x53be31);}catch(_0x226585){utils[_0x817c('0x12')](util['format'](_0x817c('0x28'),_0x53be31['uniqueid']),_0x226585);}});ami['on'](_0x817c('0x29'),function(_0x62a9dd){try{utils[_0x817c('0x15')](util[_0x817c('0x16')](_0x817c('0x2a'),_0x62a9dd[_0x817c('0x1b')]),_0x62a9dd);queues[_0x817c('0x29')](_0x62a9dd);calls[_0x817c('0x29')](_0x62a9dd);}catch(_0x34f80e){utils[_0x817c('0x12')](util[_0x817c('0x16')](_0x817c('0x2a'),_0x62a9dd[_0x817c('0x1b')]),_0x34f80e);}});ami['on'](_0x817c('0x2b'),function(_0x234fc5){try{utils['debug'](util[_0x817c('0x16')](_0x817c('0x2c'),_0x234fc5[_0x817c('0x1b')]),_0x234fc5);calls[_0x817c('0x2b')](_0x234fc5);recordings[_0x817c('0x2b')](_0x234fc5);}catch(_0x5a705f){utils[_0x817c('0x12')](util['format']('[%s][index][newstate]',_0x234fc5[_0x817c('0x1b')]),_0x5a705f);}});ami['on'](_0x817c('0x2d'),function(_0x2dd33a){try{utils[_0x817c('0x15')](util[_0x817c('0x16')](_0x817c('0x2e'),_0x2dd33a[_0x817c('0x1b')]),_0x2dd33a);calls[_0x817c('0x2d')](_0x2dd33a);recordings[_0x817c('0x2d')](_0x2dd33a);dials[_0x817c('0x2d')](_0x2dd33a);agents[_0x817c('0x2d')](_0x2dd33a);queues[_0x817c('0x2d')](_0x2dd33a);}catch(_0x589a8f){utils[_0x817c('0x12')](util[_0x817c('0x16')](_0x817c('0x2e'),_0x2dd33a[_0x817c('0x1b')]),_0x589a8f);}});ami['on'](_0x817c('0x2f'),function(_0xb1d382){try{utils[_0x817c('0x15')](util[_0x817c('0x16')](_0x817c('0x30'),_0xb1d382['uniqueid']),_0xb1d382);members[_0x817c('0x2f')](_0xb1d382);}catch(_0x5ed7c2){utils[_0x817c('0x12')](util[_0x817c('0x16')]('[%s][index][cdr]',_0xb1d382[_0x817c('0x1b')]),_0x5ed7c2);}});ami['on'](_0x817c('0x31'),function(_0x241df3){try{utils[_0x817c('0x15')](util['format'](_0x817c('0x32'),_0x241df3[_0x817c('0x1b')]),_0x241df3);queues[_0x817c('0x31')](_0x241df3);agents['blindtransfer'](_0x241df3);transfers[_0x817c('0x31')](_0x241df3);}catch(_0x2ba891){utils['error'](util[_0x817c('0x16')](_0x817c('0x32'),_0x241df3[_0x817c('0x1b')]),_0x2ba891);}});ami['on'](_0x817c('0x33'),function(_0x1f63ad){try{utils['debug'](util['format'](_0x817c('0x34'),_0x1f63ad[_0x817c('0x35')]),_0x1f63ad);queues[_0x817c('0x33')](_0x1f63ad);transfers['attendedtransfer'](_0x1f63ad);agents[_0x817c('0x33')](_0x1f63ad);calls[_0x817c('0x33')](_0x1f63ad);}catch(_0xe9e7a6){utils[_0x817c('0x12')](util[_0x817c('0x16')](_0x817c('0x34'),_0x1f63ad[_0x817c('0x35')]),_0xe9e7a6);}});ami['on']('varset',function(_0x2f3a79){try{utils['debug'](util['format']('[%s][index][varset]',_0x2f3a79[_0x817c('0x1b')]),_0x2f3a79);queues[_0x817c('0x36')](_0x2f3a79);recordings[_0x817c('0x36')](_0x2f3a79);calls[_0x817c('0x36')](_0x2f3a79);dials['varset'](_0x2f3a79);}catch(_0x345975){utils[_0x817c('0x12')](util[_0x817c('0x16')]('[%s][index][varset]',_0x2f3a79[_0x817c('0x1b')]),_0x345975);}});ami['on'](_0x817c('0x37'),function(_0x22fc0c){try{utils[_0x817c('0x15')](util[_0x817c('0x16')](_0x817c('0x38'),_0x22fc0c[_0x817c('0x1b')]),_0x22fc0c);calls['newexten'](_0x22fc0c);recordings[_0x817c('0x37')](_0x22fc0c);dials[_0x817c('0x37')](_0x22fc0c);}catch(_0x38203b){utils[_0x817c('0x12')](util[_0x817c('0x16')](_0x817c('0x38'),_0x22fc0c[_0x817c('0x1b')]),_0x38203b);}});ami['on'](_0x817c('0x39'),function(_0x32a718){try{utils['debug'](util[_0x817c('0x16')](_0x817c('0x3a'),_0x32a718[_0x817c('0x1b')]),_0x32a718);calls[_0x817c('0x39')](_0x32a718);recordings['newchannel'](_0x32a718);}catch(_0x46e7d2){utils['error'](util['format']('[%s][index][newchannel]',_0x32a718[_0x817c('0x1b')]),_0x46e7d2);}});ami['on']('dialbegin',function(_0xab2f91){try{utils[_0x817c('0x15')](util['format'](_0x817c('0x3b'),_0xab2f91[_0x817c('0x1b')]),_0xab2f91);dials[_0x817c('0x3c')](_0xab2f91);}catch(_0x23605d){utils[_0x817c('0x12')](util[_0x817c('0x16')](_0x817c('0x3d'),_0xab2f91['uniqueid']),_0x23605d);}});ami['on'](_0x817c('0x3e'),function(_0x4b49c9){try{utils[_0x817c('0x15')](util[_0x817c('0x16')](_0x817c('0x3f'),_0x4b49c9[_0x817c('0x1b')]),_0x4b49c9);dials[_0x817c('0x3e')](_0x4b49c9);}catch(_0x50e074){utils['error'](util['format'](_0x817c('0x3f'),_0x4b49c9[_0x817c('0x1b')]),_0x50e074);}});} \ No newline at end of file +var _0x56e9=['agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','[%s][index][dialend]','../../config/environment','./utils','util','asterisk','username','password','xdr','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','[%s][index][agentcalled]','uniqueid','agentcalled'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x56e9,0x1a9));var _0x956e=function(_0x514835,_0x95fcdf){_0x514835=_0x514835-0x0;var _0x44c151=_0x56e9[_0x514835];return _0x44c151;};var AsteriskManager=require('asterisk-manager');var config=require(_0x956e('0x0'));var utils=require(_0x956e('0x1'));var util=require(_0x956e('0x2'));var ami=new AsteriskManager(config[_0x956e('0x3')]['port'],config[_0x956e('0x3')]['ip'],config[_0x956e('0x3')][_0x956e('0x4')],config[_0x956e('0x3')][_0x956e('0x5')],!![]);ami['keepConnected']();if(config[_0x956e('0x6')]&&config[_0x956e('0x6')]['disabled']){utils['info'](_0x956e('0x7'));}else{var agents=require(_0x956e('0x8'));var calls=require(_0x956e('0x9'));var queues=require(_0x956e('0xa'));var recordings=require(_0x956e('0xb'));var members=require(_0x956e('0xc'));var dials=require(_0x956e('0xd'));var transfers=require(_0x956e('0xe'));var core=require(_0x956e('0xf'));ami['on'](_0x956e('0x10'),core[_0x956e('0x10')]);ami['on'](_0x956e('0x11'),core[_0x956e('0x11')]);ami['on']('fullybooted',core[_0x956e('0x12')]);ami['on'](_0x956e('0x13'),core[_0x956e('0x13')]);ami['on'](_0x956e('0x14'),core[_0x956e('0x14')]);ami['on']('managerevent',core[_0x956e('0x15')]);ami['on'](_0x956e('0x16'),function(_0x689255){try{utils[_0x956e('0x17')](util[_0x956e('0x18')]('[%s][index][devicestatechange]',_0x689255['device']),_0x689255);members[_0x956e('0x16')](_0x689255);}catch(_0x482572){utils[_0x956e('0x13')](util['format'](_0x956e('0x19'),_0x689255[_0x956e('0x1a')]),_0x482572);}});ami['on']('agentcalled',function(_0xf4f6df){try{utils['debug'](util[_0x956e('0x18')](_0x956e('0x1b'),_0xf4f6df[_0x956e('0x1c')]),_0xf4f6df);agents[_0x956e('0x1d')](_0xf4f6df);}catch(_0x1d4ff1){utils[_0x956e('0x13')](util[_0x956e('0x18')](_0x956e('0x1b'),_0xf4f6df[_0x956e('0x1c')]),_0x1d4ff1);}});ami['on'](_0x956e('0x1e'),function(_0xaec346){try{utils[_0x956e('0x17')](util[_0x956e('0x18')](_0x956e('0x1f'),_0xaec346[_0x956e('0x1c')]),_0xaec346);agents['agentringnoanswer'](_0xaec346);}catch(_0x4758b0){utils['error'](util[_0x956e('0x18')]('[%s][index][agentringnoanswer]',_0xaec346[_0x956e('0x1c')]),_0x4758b0);}});ami['on'](_0x956e('0x20'),function(_0x5a35f0){try{utils['debug'](util[_0x956e('0x18')](_0x956e('0x21'),_0x5a35f0[_0x956e('0x1c')]),_0x5a35f0);agents[_0x956e('0x20')](_0x5a35f0);queues['agentconnect'](_0x5a35f0);}catch(_0x24ab07){utils['error'](util['format'](_0x956e('0x21'),_0x5a35f0[_0x956e('0x1c')]),_0x24ab07);}});ami['on'](_0x956e('0x22'),function(_0x26697f){try{utils[_0x956e('0x17')](util[_0x956e('0x18')](_0x956e('0x23'),_0x26697f[_0x956e('0x1c')]),_0x26697f);agents[_0x956e('0x22')](_0x26697f);queues[_0x956e('0x22')](_0x26697f);members['agentcomplete'](_0x26697f);}catch(_0x869501){utils[_0x956e('0x13')](util[_0x956e('0x18')](_0x956e('0x23'),_0x26697f[_0x956e('0x1c')]),_0x869501);}});ami['on'](_0x956e('0x24'),function(_0x46629b){try{utils[_0x956e('0x17')](util[_0x956e('0x18')]('[%s][index][queuecallerabandon]',_0x46629b[_0x956e('0x1c')]),_0x46629b);agents[_0x956e('0x24')](_0x46629b);queues[_0x956e('0x24')](_0x46629b);}catch(_0x277209){utils[_0x956e('0x13')](util[_0x956e('0x18')](_0x956e('0x25'),_0x46629b[_0x956e('0x1c')]),_0x277209);}});ami['on'](_0x956e('0x26'),function(_0x389c91){try{utils[_0x956e('0x17')](util['format'](_0x956e('0x27'),_0x389c91['uniqueid']),_0x389c91);queues[_0x956e('0x26')](_0x389c91);recordings[_0x956e('0x26')](_0x389c91);}catch(_0x5c028d){utils[_0x956e('0x13')](util['format'](_0x956e('0x27'),_0x389c91[_0x956e('0x1c')]),_0x5c028d);}});ami['on'](_0x956e('0x28'),function(_0x29d707){try{utils[_0x956e('0x17')](util[_0x956e('0x18')]('[%s][index][queuecallerleave]',_0x29d707[_0x956e('0x1c')]),_0x29d707);queues['queuecallerleave'](_0x29d707);}catch(_0x24b99e){utils['error'](util[_0x956e('0x18')]('[%s][index][queuecallerleave]',_0x29d707[_0x956e('0x1c')]),_0x24b99e);}});ami['on'](_0x956e('0x29'),function(_0x4a4b0d){try{utils[_0x956e('0x17')](util[_0x956e('0x18')](_0x956e('0x2a'),_0x4a4b0d[_0x956e('0x1c')]),_0x4a4b0d);queues[_0x956e('0x29')](_0x4a4b0d);calls[_0x956e('0x29')](_0x4a4b0d);}catch(_0x3078dd){utils[_0x956e('0x13')](util['format'](_0x956e('0x2a'),_0x4a4b0d[_0x956e('0x1c')]),_0x3078dd);}});ami['on']('musiconholdstop',function(_0x5e5ad5){try{utils[_0x956e('0x17')](util['format'](_0x956e('0x2b'),_0x5e5ad5[_0x956e('0x1c')]),_0x5e5ad5);queues[_0x956e('0x2c')](_0x5e5ad5);calls[_0x956e('0x2c')](_0x5e5ad5);}catch(_0x43e631){utils[_0x956e('0x13')](util[_0x956e('0x18')](_0x956e('0x2b'),_0x5e5ad5[_0x956e('0x1c')]),_0x43e631);}});ami['on'](_0x956e('0x2d'),function(_0x39b9b2){try{utils['debug'](util['format'](_0x956e('0x2e'),_0x39b9b2['uniqueid']),_0x39b9b2);calls[_0x956e('0x2d')](_0x39b9b2);recordings[_0x956e('0x2d')](_0x39b9b2);}catch(_0x3cc5d2){utils[_0x956e('0x13')](util[_0x956e('0x18')](_0x956e('0x2e'),_0x39b9b2[_0x956e('0x1c')]),_0x3cc5d2);}});ami['on'](_0x956e('0x2f'),function(_0x24f36d){try{utils[_0x956e('0x17')](util[_0x956e('0x18')]('[%s][index][hangup]',_0x24f36d['uniqueid']),_0x24f36d);calls[_0x956e('0x2f')](_0x24f36d);recordings[_0x956e('0x2f')](_0x24f36d);dials[_0x956e('0x2f')](_0x24f36d);agents['hangup'](_0x24f36d);queues[_0x956e('0x2f')](_0x24f36d);}catch(_0x2a4f1e){utils[_0x956e('0x13')](util[_0x956e('0x18')](_0x956e('0x30'),_0x24f36d['uniqueid']),_0x2a4f1e);}});ami['on'](_0x956e('0x31'),function(_0x36c3cf){try{utils['debug'](util[_0x956e('0x18')](_0x956e('0x32'),_0x36c3cf[_0x956e('0x1c')]),_0x36c3cf);members[_0x956e('0x31')](_0x36c3cf);}catch(_0x370de4){utils[_0x956e('0x13')](util['format'](_0x956e('0x32'),_0x36c3cf[_0x956e('0x1c')]),_0x370de4);}});ami['on'](_0x956e('0x33'),function(_0x4dfc6d){try{utils[_0x956e('0x17')](util['format']('[%s][index][blindtransfer]',_0x4dfc6d[_0x956e('0x1c')]),_0x4dfc6d);queues[_0x956e('0x33')](_0x4dfc6d);agents[_0x956e('0x33')](_0x4dfc6d);transfers['blindtransfer'](_0x4dfc6d);}catch(_0x531bd8){utils['error'](util['format'](_0x956e('0x34'),_0x4dfc6d[_0x956e('0x1c')]),_0x531bd8);}});ami['on'](_0x956e('0x35'),function(_0x25fcc3){try{utils['debug'](util['format'](_0x956e('0x36'),_0x25fcc3['origtransfereruniqueid']),_0x25fcc3);queues[_0x956e('0x35')](_0x25fcc3);transfers[_0x956e('0x35')](_0x25fcc3);agents[_0x956e('0x35')](_0x25fcc3);calls['attendedtransfer'](_0x25fcc3);}catch(_0x465f5e){utils[_0x956e('0x13')](util['format'](_0x956e('0x36'),_0x25fcc3['origtransfereruniqueid']),_0x465f5e);}});ami['on'](_0x956e('0x37'),function(_0x4cef17){try{utils[_0x956e('0x17')](util[_0x956e('0x18')](_0x956e('0x38'),_0x4cef17['uniqueid']),_0x4cef17);queues['varset'](_0x4cef17);recordings[_0x956e('0x37')](_0x4cef17);calls['varset'](_0x4cef17);dials[_0x956e('0x37')](_0x4cef17);}catch(_0x5e9afb){utils[_0x956e('0x13')](util[_0x956e('0x18')](_0x956e('0x38'),_0x4cef17[_0x956e('0x1c')]),_0x5e9afb);}});ami['on'](_0x956e('0x39'),function(_0x53c56c){try{utils[_0x956e('0x17')](util[_0x956e('0x18')](_0x956e('0x3a'),_0x53c56c[_0x956e('0x1c')]),_0x53c56c);calls[_0x956e('0x39')](_0x53c56c);recordings[_0x956e('0x39')](_0x53c56c);dials['newexten'](_0x53c56c);}catch(_0x160971){utils['error'](util['format']('[%s][index][newexten]',_0x53c56c[_0x956e('0x1c')]),_0x160971);}});ami['on'](_0x956e('0x3b'),function(_0x2e032b){try{utils[_0x956e('0x17')](util[_0x956e('0x18')](_0x956e('0x3c'),_0x2e032b[_0x956e('0x1c')]),_0x2e032b);calls[_0x956e('0x3b')](_0x2e032b);recordings[_0x956e('0x3b')](_0x2e032b);}catch(_0x34673a){utils[_0x956e('0x13')](util[_0x956e('0x18')]('[%s][index][newchannel]',_0x2e032b[_0x956e('0x1c')]),_0x34673a);}});ami['on'](_0x956e('0x3d'),function(_0x2360ed){try{utils[_0x956e('0x17')](util[_0x956e('0x18')](_0x956e('0x3e'),_0x2360ed['uniqueid']),_0x2360ed);dials['dialbegin'](_0x2360ed);}catch(_0x1607da){utils[_0x956e('0x13')](util[_0x956e('0x18')](_0x956e('0x3f'),_0x2360ed[_0x956e('0x1c')]),_0x1607da);}});ami['on']('dialend',function(_0x382263){try{utils[_0x956e('0x17')](util[_0x956e('0x18')]('[%s][index][dialend]',_0x382263[_0x956e('0x1c')]),_0x382263);dials['dialend'](_0x382263);}catch(_0x101fab){utils[_0x956e('0x13')](util[_0x956e('0x18')](_0x956e('0x40'),_0x382263['uniqueid']),_0x101fab);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 333c32a..49a6387 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 _0x6c42=['[%s][members][devicestatechange]','device','info','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','isNil','duration','diffTime','exitAt','enterAt','[%s][members][agentcomplete]','assign','queue','cdr','[%s][members][cdr]','data1','data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','util','Local/_attended@transfer','format','uniqueid','channel','data2','membername','type','interface','getUserByInterface','name','internal','request','getUserByName','split','then','CreateMemberReport','[%s][members][writeDB]','some','startsWith','devicestatechange','debug'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x6c42,0xd0));var _0x26c4=function(_0x2e3dfc,_0x454d6c){_0x2e3dfc=_0x2e3dfc-0x0;var _0x4b1245=_0x6c42[_0x2e3dfc];return _0x4b1245;};'use strict';var _=require('lodash');var util=require(_0x26c4('0x0'));var utils=require('./utils');var members={};var exclude=[_0x26c4('0x1'),'Queue:'];function writeDB(_0x7870cd){utils['info'](util[_0x26c4('0x2')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x7870cd[_0x26c4('0x3')],_0x7870cd['interface'],_0x7870cd[_0x26c4('0x4')],_0x7870cd[_0x26c4('0x5')],_0x7870cd[_0x26c4('0x6')],_0x7870cd[_0x26c4('0x7')]));if(_0x7870cd[_0x26c4('0x8')]){utils[_0x26c4('0x9')](_0x7870cd[_0x26c4('0x8')])['then'](function(_0x3c2e1e){if(_0x3c2e1e){_0x7870cd['membername']=_0x3c2e1e[_0x26c4('0xa')];_0x7870cd[_0x26c4('0xb')]=_0x3c2e1e[_0x26c4('0xb')];utils[_0x26c4('0xc')]('CreateMemberReport',_0x7870cd);}else{utils[_0x26c4('0xd')](_0x7870cd['interface'][_0x26c4('0xe')]('/')[0x1])[_0x26c4('0xf')](function(_0x4fb65b){if(_0x4fb65b){_0x7870cd[_0x26c4('0x6')]=_0x4fb65b['name'];_0x7870cd[_0x26c4('0xb')]=_0x4fb65b['internal'];utils[_0x26c4('0xc')](_0x26c4('0x10'),_0x7870cd);}});}})['catch'](function(_0x1f1c60){utils['error'](util[_0x26c4('0x2')](_0x26c4('0x11'),_0x7870cd[_0x26c4('0x3')]),_0x1f1c60);});}delete members[_0x7870cd[_0x26c4('0x8')]];}function startsWith(_0x24dca8,_0x30e278){return _[_0x26c4('0x12')](_0x24dca8,function(_0x204897){return _[_0x26c4('0x13')](_0x30e278,_0x204897);});}exports[_0x26c4('0x14')]=function(_0x32ceb1){try{utils[_0x26c4('0x15')](util['format'](_0x26c4('0x16'),members[_0x32ceb1['device']]?members[_0x32ceb1[_0x26c4('0x17')]][_0x26c4('0x3')]:_0x32ceb1['device']),_0x32ceb1);utils[_0x26c4('0x18')](util['format'](_0x26c4('0x19'),members[_0x32ceb1[_0x26c4('0x17')]]?members[_0x32ceb1[_0x26c4('0x17')]][_0x26c4('0x3')]:_0x32ceb1[_0x26c4('0x17')],_0x32ceb1[_0x26c4('0x1a')],_0x32ceb1['device']));switch(_0x32ceb1[_0x26c4('0x1a')]){case _0x26c4('0x1b'):case _0x26c4('0x1c'):if(!startsWith(exclude,_0x32ceb1[_0x26c4('0x17')])){members[_0x32ceb1[_0x26c4('0x17')]]={'channel':_0x26c4('0x1d'),'interface':_0x32ceb1[_0x26c4('0x17')],'type':_0x26c4('0x1e'),'enterAt':utils[_0x26c4('0x1f')](),'role':'agent'};}break;case'NOT_INUSE':if(!_[_0x26c4('0x20')](members[_0x32ceb1[_0x26c4('0x17')]])){members[_0x32ceb1[_0x26c4('0x17')]]['exitAt']=utils['now']();members[_0x32ceb1[_0x26c4('0x17')]][_0x26c4('0x21')]=utils[_0x26c4('0x22')](members[_0x32ceb1[_0x26c4('0x17')]][_0x26c4('0x23')],members[_0x32ceb1[_0x26c4('0x17')]][_0x26c4('0x24')]);if(members[_0x32ceb1[_0x26c4('0x17')]]['uniqueid']){writeDB(members[_0x32ceb1['device']]);}}break;default:break;}}catch(_0x2b8370){utils['error'](util[_0x26c4('0x2')](_0x26c4('0x16'),members[_0x32ceb1[_0x26c4('0x17')]]?members[_0x32ceb1[_0x26c4('0x17')]]['uniqueid']:_0x32ceb1[_0x26c4('0x17')]),_0x2b8370);}};exports['agentcomplete']=function(_0x109965){try{if(!_['isNil'](members[_0x109965[_0x26c4('0x8')]])){utils['debug'](util[_0x26c4('0x2')](_0x26c4('0x25'),_0x109965['uniqueid']),_0x109965);utils['info'](util['format']('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x109965[_0x26c4('0x3')],_0x109965[_0x26c4('0x8')],_0x109965['queue']));members[_0x109965[_0x26c4('0x8')]]=_[_0x26c4('0x26')](members[_0x109965[_0x26c4('0x8')]],{'data4':_0x109965[_0x26c4('0x27')],'uniqueid':_0x109965[_0x26c4('0x3')]});}}catch(_0x47fc50){utils['error'](util[_0x26c4('0x2')](_0x26c4('0x25'),_0x109965[_0x26c4('0x3')]),_0x47fc50);}};exports[_0x26c4('0x28')]=function(_0x3bc53f){try{utils[_0x26c4('0x15')](util['format'](_0x26c4('0x29'),_0x3bc53f['uniqueid']),_0x3bc53f);if(_0x3bc53f[_0x26c4('0x4')]){var _0x1d074d=_0x3bc53f[_0x26c4('0x4')][_0x26c4('0xe')]('-')[0x0];if(!_['isNil'](members[_0x1d074d])){members[_0x1d074d]=_[_0x26c4('0x26')](members[_0x1d074d],{'data1':members[_0x1d074d][_0x26c4('0x2a')]||_0x3bc53f[_0x26c4('0x7')],'data2':members[_0x1d074d]['data2']||_0x3bc53f['source'],'data3':members[_0x1d074d][_0x26c4('0x2b')]||_0x3bc53f['destination'],'uniqueid':members[_0x1d074d][_0x26c4('0x3')]||_0x3bc53f[_0x26c4('0x3')]});utils['info'](util['format'](_0x26c4('0x2c'),_0x3bc53f[_0x26c4('0x3')],members[_0x1d074d]['data1'],members[_0x1d074d]['data2'],members[_0x1d074d][_0x26c4('0x2b')]));if(members[_0x1d074d][_0x26c4('0x23')]){writeDB(members[_0x1d074d]);}}}if(_0x3bc53f[_0x26c4('0x2d')]){var _0x369942=_0x3bc53f[_0x26c4('0x2d')][_0x26c4('0xe')]('-')[0x0];if(!_[_0x26c4('0x20')](members[_0x369942])){members[_0x369942]=_[_0x26c4('0x26')](members[_0x369942],{'data1':members[_0x369942]['data1']||_0x3bc53f[_0x26c4('0x7')],'data2':members[_0x369942][_0x26c4('0x5')]||_0x3bc53f['source'],'data3':members[_0x369942][_0x26c4('0x2b')]||_0x3bc53f['destination'],'uniqueid':members[_0x369942][_0x26c4('0x3')]||_0x3bc53f[_0x26c4('0x3')]});utils['info'](util[_0x26c4('0x2')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x3bc53f[_0x26c4('0x3')],members[_0x369942][_0x26c4('0x2a')],members[_0x369942][_0x26c4('0x5')],members[_0x369942][_0x26c4('0x2b')]));if(members[_0x369942][_0x26c4('0x23')]){writeDB(members[_0x369942]);}}}}catch(_0x323ffd){utils['error'](util[_0x26c4('0x2')](_0x26c4('0x29'),_0x3bc53f[_0x26c4('0x3')]),_0x323ffd);}}; \ No newline at end of file +var _0x217a=['then','internal','request','CreateMemberReport','getUserByName','split','name','catch','error','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','diffTime','enterAt','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','channel','data1','type','source','data3','destinationchannel','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','util','./utils','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','data2','membername','getUserByInterface'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x217a,0x1ac));var _0xa217=function(_0x440f68,_0x2b9fb1){_0x440f68=_0x440f68-0x0;var _0xca972e=_0x217a[_0x440f68];return _0xca972e;};'use strict';var _=require(_0xa217('0x0'));var util=require(_0xa217('0x1'));var utils=require(_0xa217('0x2'));var members={};var exclude=['Local/_attended@transfer',_0xa217('0x3')];function writeDB(_0x3d012b){utils[_0xa217('0x4')](util[_0xa217('0x5')](_0xa217('0x6'),_0x3d012b[_0xa217('0x7')],_0x3d012b[_0xa217('0x8')],_0x3d012b['channel'],_0x3d012b[_0xa217('0x9')],_0x3d012b[_0xa217('0xa')],_0x3d012b['type']));if(_0x3d012b[_0xa217('0x8')]){utils[_0xa217('0xb')](_0x3d012b[_0xa217('0x8')])[_0xa217('0xc')](function(_0x1165b9){if(_0x1165b9){_0x3d012b['membername']=_0x1165b9['name'];_0x3d012b[_0xa217('0xd')]=_0x1165b9['internal'];utils[_0xa217('0xe')](_0xa217('0xf'),_0x3d012b);}else{utils[_0xa217('0x10')](_0x3d012b[_0xa217('0x8')][_0xa217('0x11')]('/')[0x1])['then'](function(_0xb203f9){if(_0xb203f9){_0x3d012b['membername']=_0xb203f9[_0xa217('0x12')];_0x3d012b[_0xa217('0xd')]=_0xb203f9[_0xa217('0xd')];utils[_0xa217('0xe')](_0xa217('0xf'),_0x3d012b);}});}})[_0xa217('0x13')](function(_0x7fa7fc){utils[_0xa217('0x14')](util['format'](_0xa217('0x15'),_0x3d012b[_0xa217('0x7')]),_0x7fa7fc);});}delete members[_0x3d012b['interface']];}function startsWith(_0x2e2b9f,_0x1aa6a7){return _[_0xa217('0x16')](_0x2e2b9f,function(_0x302421){return _[_0xa217('0x17')](_0x1aa6a7,_0x302421);});}exports[_0xa217('0x18')]=function(_0x2fae47){try{utils[_0xa217('0x19')](util['format'](_0xa217('0x1a'),members[_0x2fae47['device']]?members[_0x2fae47[_0xa217('0x1b')]]['uniqueid']:_0x2fae47[_0xa217('0x1b')]),_0x2fae47);utils['info'](util[_0xa217('0x5')](_0xa217('0x1c'),members[_0x2fae47[_0xa217('0x1b')]]?members[_0x2fae47[_0xa217('0x1b')]][_0xa217('0x7')]:_0x2fae47[_0xa217('0x1b')],_0x2fae47['state'],_0x2fae47[_0xa217('0x1b')]));switch(_0x2fae47[_0xa217('0x1d')]){case _0xa217('0x1e'):case _0xa217('0x1f'):if(!startsWith(exclude,_0x2fae47[_0xa217('0x1b')])){members[_0x2fae47['device']]={'channel':_0xa217('0x20'),'interface':_0x2fae47[_0xa217('0x1b')],'type':_0xa217('0x21'),'enterAt':utils[_0xa217('0x22')](),'role':_0xa217('0x23')};}break;case _0xa217('0x24'):if(!_[_0xa217('0x25')](members[_0x2fae47[_0xa217('0x1b')]])){members[_0x2fae47['device']][_0xa217('0x26')]=utils[_0xa217('0x22')]();members[_0x2fae47[_0xa217('0x1b')]]['duration']=utils[_0xa217('0x27')](members[_0x2fae47['device']][_0xa217('0x26')],members[_0x2fae47[_0xa217('0x1b')]][_0xa217('0x28')]);if(members[_0x2fae47[_0xa217('0x1b')]]['uniqueid']){writeDB(members[_0x2fae47[_0xa217('0x1b')]]);}}break;default:break;}}catch(_0x31e5df){utils[_0xa217('0x14')](util[_0xa217('0x5')]('[%s][members][devicestatechange]',members[_0x2fae47[_0xa217('0x1b')]]?members[_0x2fae47[_0xa217('0x1b')]]['uniqueid']:_0x2fae47[_0xa217('0x1b')]),_0x31e5df);}};exports[_0xa217('0x29')]=function(_0x143021){try{if(!_[_0xa217('0x25')](members[_0x143021[_0xa217('0x8')]])){utils['debug'](util[_0xa217('0x5')](_0xa217('0x2a'),_0x143021[_0xa217('0x7')]),_0x143021);utils['info'](util[_0xa217('0x5')](_0xa217('0x2b'),_0x143021[_0xa217('0x7')],_0x143021['interface'],_0x143021[_0xa217('0x2c')]));members[_0x143021[_0xa217('0x8')]]=_[_0xa217('0x2d')](members[_0x143021[_0xa217('0x8')]],{'data4':_0x143021[_0xa217('0x2c')],'uniqueid':_0x143021[_0xa217('0x7')]});}}catch(_0x2e8958){utils[_0xa217('0x14')](util[_0xa217('0x5')](_0xa217('0x2a'),_0x143021[_0xa217('0x7')]),_0x2e8958);}};exports[_0xa217('0x2e')]=function(_0x3c5c50){try{utils['debug'](util[_0xa217('0x5')](_0xa217('0x2f'),_0x3c5c50[_0xa217('0x7')]),_0x3c5c50);if(_0x3c5c50['channel']){var _0x436400=_0x3c5c50[_0xa217('0x30')][_0xa217('0x11')]('-')[0x0];if(!_[_0xa217('0x25')](members[_0x436400])){members[_0x436400]=_['assign'](members[_0x436400],{'data1':members[_0x436400][_0xa217('0x31')]||_0x3c5c50[_0xa217('0x32')],'data2':members[_0x436400][_0xa217('0x9')]||_0x3c5c50[_0xa217('0x33')],'data3':members[_0x436400][_0xa217('0x34')]||_0x3c5c50['destination'],'uniqueid':members[_0x436400]['uniqueid']||_0x3c5c50[_0xa217('0x7')]});utils['info'](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x3c5c50['uniqueid'],members[_0x436400][_0xa217('0x31')],members[_0x436400][_0xa217('0x9')],members[_0x436400]['data3']));if(members[_0x436400]['exitAt']){writeDB(members[_0x436400]);}}}if(_0x3c5c50[_0xa217('0x35')]){var _0x1e4cf6=_0x3c5c50[_0xa217('0x35')][_0xa217('0x11')]('-')[0x0];if(!_[_0xa217('0x25')](members[_0x1e4cf6])){members[_0x1e4cf6]=_[_0xa217('0x2d')](members[_0x1e4cf6],{'data1':members[_0x1e4cf6][_0xa217('0x31')]||_0x3c5c50[_0xa217('0x32')],'data2':members[_0x1e4cf6]['data2']||_0x3c5c50[_0xa217('0x33')],'data3':members[_0x1e4cf6][_0xa217('0x34')]||_0x3c5c50['destination'],'uniqueid':members[_0x1e4cf6]['uniqueid']||_0x3c5c50[_0xa217('0x7')]});utils[_0xa217('0x4')](util[_0xa217('0x5')](_0xa217('0x36'),_0x3c5c50[_0xa217('0x7')],members[_0x1e4cf6]['data1'],members[_0x1e4cf6][_0xa217('0x9')],members[_0x1e4cf6][_0xa217('0x34')]));if(members[_0x1e4cf6]['exitAt']){writeDB(members[_0x1e4cf6]);}}}}catch(_0xf9e7af){utils['error'](util[_0xa217('0x5')](_0xa217('0x2f'),_0x3c5c50['uniqueid']),_0xf9e7af);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index b759961..5b241a5 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 _0x954b=['[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','ATTENDED','origtransfererexten','transferuniqueid','ATTENDEDTRANSFER','origtransfererlinkedid','clone','transfertargetuniqueid','calleridname','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','./utils','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','queue','calleridnum','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]','uniqueid','format','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','error','hangup','debug','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','now','queuecallerexitreason','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','variable','queuestatus','CONTINUE','queuecallerabandonAt','value','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','isNil','queueposition','queuecallerexitAt','EXITWITHKEY','ABANDONED','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','count','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','lastAssignedTo','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','transferexten','extension','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid'];(function(_0x170772,_0x1f1ee7){var _0x3ef69c=function(_0x4cde12){while(--_0x4cde12){_0x170772['push'](_0x170772['shift']());}};_0x3ef69c(++_0x1f1ee7);}(_0x954b,0x1b1));var _0xb954=function(_0x5f2098,_0x47308b){_0x5f2098=_0x5f2098-0x0;var _0x18af32=_0x954b[_0x5f2098];return _0x18af32;};'use strict';var _=require(_0xb954('0x0'));var util=require('util');var utils=require(_0xb954('0x1'));var queues={};function writeDB(_0x58c13d){utils[_0xb954('0x2')](util['format'](_0xb954('0x3'),_0x58c13d['uniqueid'],_0x58c13d['channel'],_0x58c13d[_0xb954('0x4')],_0x58c13d['lastAssignedTo'],_0x58c13d[_0xb954('0x5')],_0x58c13d['accountcode'],_0x58c13d['queuecallerexitreason']));if(_0x58c13d[_0xb954('0x4')]){utils[_0xb954('0x6')](_0x58c13d[_0xb954('0x4')])['then'](function(_0x56eee4){if(_0x56eee4){_0x58c13d[_0xb954('0x7')]=_0x56eee4[_0xb954('0x7')];}utils[_0xb954('0x8')](_0xb954('0x9'),_0x58c13d);});}else{utils[_0xb954('0x8')](_0xb954('0x9'),_0x58c13d);}if(_0x58c13d[_0xb954('0xa')]){delete queues[_0x58c13d[_0xb954('0xa')]];}else{delete queues[_0x58c13d['uniqueid']];}}exports[_0xb954('0xb')]=function(_0x8942de){try{utils['debug'](util['format'](_0xb954('0xc'),_0x8942de[_0xb954('0xd')]),_0x8942de);utils['info'](util[_0xb954('0xe')](_0xb954('0xf'),_0x8942de[_0xb954('0xd')],_0x8942de[_0xb954('0x4')],_0x8942de[_0xb954('0x10')]));queues[_0x8942de['uniqueid']]=_[_0xb954('0x11')](_0x8942de,{'originalposition':_0x8942de[_0xb954('0x10')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x2c8ae0){utils[_0xb954('0x12')](util[_0xb954('0xe')](_0xb954('0xc'),_0x8942de[_0xb954('0xd')]),_0x2c8ae0);}};exports[_0xb954('0x13')]=function(_0x331046){try{if(!_['isNil'](queues[_0x331046[_0xb954('0xd')]])){utils[_0xb954('0x14')](util[_0xb954('0xe')](_0xb954('0x15'),_0x331046[_0xb954('0xd')]),_0x331046);if(queues[_0x331046['uniqueid']][_0xb954('0x16')]){if(!queues[_0x331046['uniqueid']][_0xb954('0x17')]&&!queues[_0x331046[_0xb954('0xd')]][_0xb954('0x18')]){queues[_0x331046[_0xb954('0xd')]][_0xb954('0x19')]=!![];queues[_0x331046[_0xb954('0xd')]][_0xb954('0x1a')]=utils[_0xb954('0x1b')]();queues[_0x331046['uniqueid']][_0xb954('0x1c')]='COMPLETEDBYAGENT';}utils[_0xb954('0x2')](util['format']('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x331046[_0xb954('0xd')],queues[_0x331046[_0xb954('0xd')]]['name'],queues[_0x331046[_0xb954('0xd')]][_0xb954('0x1c')]));writeDB(queues[_0x331046[_0xb954('0xd')]]);}else if(queues[_0x331046[_0xb954('0xd')]][_0xb954('0xa')]){utils[_0xb954('0x2')](util[_0xb954('0xe')](_0xb954('0x1d'),_0x331046[_0xb954('0xd')],queues[_0x331046[_0xb954('0xd')]][_0xb954('0x1e')],queues[_0x331046[_0xb954('0xd')]][_0xb954('0xa')]));queues[queues[_0x331046[_0xb954('0xd')]][_0xb954('0xa')]]=queues[_0x331046[_0xb954('0xd')]];queues[queues[_0x331046[_0xb954('0xd')]][_0xb954('0xa')]][_0xb954('0x1f')]=0x2;delete queues[_0x331046[_0xb954('0xd')]];}}}catch(_0x18e023){utils[_0xb954('0x12')](util[_0xb954('0xe')](_0xb954('0x15'),_0x331046['uniqueid']),_0x18e023);}};exports[_0xb954('0x20')]=function(_0x5dbe42){try{utils[_0xb954('0x14')](util[_0xb954('0xe')](_0xb954('0x21'),_0x5dbe42[_0xb954('0xd')]),_0x5dbe42);if(!_['isNil'](_0x5dbe42[_0xb954('0x22')][_0xb954('0x23')])&&_0x5dbe42['value']['toUpperCase']()!==_0xb954('0x24')){if(!_['isNil'](queues[_0x5dbe42['uniqueid']])){queues[_0x5dbe42['uniqueid']][_0xb954('0x17')]=![];queues[_0x5dbe42[_0xb954('0xd')]][_0xb954('0x25')]=null;queues[_0x5dbe42['uniqueid']][_0xb954('0x18')]=!![];queues[_0x5dbe42['uniqueid']]['queuecallerexitAt']=utils['now']();queues[_0x5dbe42[_0xb954('0xd')]][_0xb954('0x1c')]=_0x5dbe42[_0xb954('0x26')][_0xb954('0x27')]();utils['info'](util['format'](_0xb954('0x28'),_0x5dbe42[_0xb954('0xd')],queues[_0x5dbe42['uniqueid']]['name'],_0x5dbe42['value'],queues[_0x5dbe42[_0xb954('0xd')]][_0xb954('0x1c')]));writeDB(queues[_0x5dbe42[_0xb954('0xd')]]);}}else if(!_[_0xb954('0x29')](_0x5dbe42[_0xb954('0x22')][_0xb954('0x2a')])){if(!_[_0xb954('0x29')](queues[_0x5dbe42[_0xb954('0xd')]])&&!queues[_0x5dbe42['uniqueid']][_0xb954('0x17')]){queues[_0x5dbe42[_0xb954('0xd')]][_0xb954('0x17')]=![];queues[_0x5dbe42['uniqueid']][_0xb954('0x25')]=null;queues[_0x5dbe42['uniqueid']][_0xb954('0x18')]=!![];queues[_0x5dbe42[_0xb954('0xd')]][_0xb954('0x2b')]=utils[_0xb954('0x1b')]();queues[_0x5dbe42[_0xb954('0xd')]][_0xb954('0x1c')]=_0xb954('0x2c');utils[_0xb954('0x2')](util[_0xb954('0xe')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x5dbe42['uniqueid'],queues[_0x5dbe42[_0xb954('0xd')]][_0xb954('0x1e')],_0x5dbe42[_0xb954('0x26')],queues[_0x5dbe42['uniqueid']][_0xb954('0x1c')]));}}}catch(_0x3a0361){utils[_0xb954('0x12')](util[_0xb954('0xe')](_0xb954('0x21'),_0x5dbe42[_0xb954('0xd')]),_0x3a0361);}};exports[_0xb954('0x17')]=function(_0x2d83a0){try{if(!_[_0xb954('0x29')](queues[_0x2d83a0[_0xb954('0xd')]])){utils[_0xb954('0x14')](util['format']('[%s][queues][queuecallerabandon]',_0x2d83a0[_0xb954('0xd')]),_0x2d83a0);queues[_0x2d83a0[_0xb954('0xd')]][_0xb954('0x18')]=![];queues[_0x2d83a0[_0xb954('0xd')]]['queuecallerexitAt']=null;queues[_0x2d83a0['uniqueid']][_0xb954('0x17')]=!![];queues[_0x2d83a0[_0xb954('0xd')]][_0xb954('0x25')]=utils[_0xb954('0x1b')]();queues[_0x2d83a0[_0xb954('0xd')]]['queuecallerexitreason']=_0xb954('0x2d');utils[_0xb954('0x2')](util[_0xb954('0xe')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x2d83a0['uniqueid'],queues[_0x2d83a0[_0xb954('0xd')]][_0xb954('0x1e')],queues[_0x2d83a0[_0xb954('0xd')]]['queuecallerexitreason']));}}catch(_0x402bda){utils[_0xb954('0x12')](util[_0xb954('0xe')](_0xb954('0x2e'),_0x2d83a0['uniqueid']),_0x402bda);}};exports[_0xb954('0x2f')]=function(_0x289d06){try{if(!_['isNil'](queues[_0x289d06['uniqueid']])){utils[_0xb954('0x14')](util['format'](_0xb954('0x30'),_0x289d06[_0xb954('0xd')]),_0x289d06);utils[_0xb954('0x2')](util['format'](_0xb954('0x31'),_0x289d06[_0xb954('0xd')],queues[_0x289d06['uniqueid']][_0xb954('0x1e')],_0x289d06[_0xb954('0x32')],_0x289d06[_0xb954('0x33')]));queues[_0x289d06[_0xb954('0xd')]]['queuecallerleave']=!![];queues[_0x289d06[_0xb954('0xd')]]['queuecallerleaveAt']=utils['now']();queues[_0x289d06['uniqueid']]['holdtime']=utils['diffTime'](queues[_0x289d06[_0xb954('0xd')]]['queuecallerleaveAt'],queues[_0x289d06[_0xb954('0xd')]]['queuecallerjoinAt']);queues[_0x289d06[_0xb954('0xd')]][_0xb954('0x10')]=_0x289d06['position'];queues[_0x289d06['uniqueid']]['count']=_0x289d06[_0xb954('0x34')];queues[_0x289d06['uniqueid']][_0xb954('0x32')]=_0x289d06['connectedlinenum'];queues[_0x289d06[_0xb954('0xd')]][_0xb954('0x33')]=_0x289d06[_0xb954('0x33')];}}catch(_0x12c66c){utils['error'](util[_0xb954('0xe')](_0xb954('0x30'),_0x289d06[_0xb954('0xd')]),_0x12c66c);}};exports['agentconnect']=function(_0x488ae7){try{if(!_[_0xb954('0x29')](queues[_0x488ae7[_0xb954('0xd')]])){utils[_0xb954('0x14')](util['format'](_0xb954('0x35'),_0x488ae7[_0xb954('0xd')]),_0x488ae7);utils[_0xb954('0x2')](util['format'](_0xb954('0x36'),_0x488ae7[_0xb954('0xd')],queues[_0x488ae7[_0xb954('0xd')]]['name'],_0x488ae7[_0xb954('0x37')],_0x488ae7[_0xb954('0x38')]));queues[_0x488ae7[_0xb954('0xd')]]['queuecallerabandon']=![];queues[_0x488ae7[_0xb954('0xd')]][_0xb954('0x17')]=![];queues[_0x488ae7[_0xb954('0xd')]][_0xb954('0x25')]=null;queues[_0x488ae7[_0xb954('0xd')]][_0xb954('0x18')]=![];queues[_0x488ae7['uniqueid']][_0xb954('0x1c')]=null;queues[_0x488ae7['uniqueid']]['queuecallerexitAt']=null;queues[_0x488ae7[_0xb954('0xd')]][_0xb954('0x39')]=!![];queues[_0x488ae7[_0xb954('0xd')]]['accountcode']=_0x488ae7[_0xb954('0x38')];queues[_0x488ae7[_0xb954('0xd')]][_0xb954('0x3a')]=_0x488ae7[_0xb954('0x37')];}}catch(_0x51adb2){utils[_0xb954('0x12')](util[_0xb954('0xe')]('[%s][queues][agentconnect]',_0x488ae7[_0xb954('0xd')]),_0x51adb2);}};exports[_0xb954('0x3b')]=function(_0x1462aa){try{if(!_[_0xb954('0x29')](queues[_0x1462aa[_0xb954('0xd')]])){if(queues[_0x1462aa[_0xb954('0xd')]][_0xb954('0x16')]){utils[_0xb954('0x14')](util[_0xb954('0xe')](_0xb954('0x3c'),_0x1462aa['uniqueid']),_0x1462aa);queues[_0x1462aa['uniqueid']][_0xb954('0x17')]=![];queues[_0x1462aa[_0xb954('0xd')]][_0xb954('0x17')]=![];queues[_0x1462aa[_0xb954('0xd')]]['queuecallerabandonAt']=null;queues[_0x1462aa['uniqueid']][_0xb954('0x18')]=![];queues[_0x1462aa['uniqueid']][_0xb954('0x2b')]=null;queues[_0x1462aa[_0xb954('0xd')]][_0xb954('0x39')]=!![];queues[_0x1462aa[_0xb954('0xd')]][_0xb954('0x3a')]=_0x1462aa[_0xb954('0x37')];queues[_0x1462aa[_0xb954('0xd')]][_0xb954('0x19')]=!![];queues[_0x1462aa[_0xb954('0xd')]][_0xb954('0x1a')]=utils['now']();if(_0x1462aa[_0xb954('0x3d')]==_0xb954('0x3e')){if(!queues[_0x1462aa[_0xb954('0xd')]]['transfer']){queues[_0x1462aa[_0xb954('0xd')]][_0xb954('0x1c')]=_0xb954('0x3f');}}else{queues[_0x1462aa[_0xb954('0xd')]][_0xb954('0x1c')]=_0xb954('0x40')+_0x1462aa[_0xb954('0x3d')][_0xb954('0x27')]();}utils[_0xb954('0x2')](util[_0xb954('0xe')](_0xb954('0x41'),_0x1462aa[_0xb954('0xd')],queues[_0x1462aa[_0xb954('0xd')]]['name'],_0x1462aa[_0xb954('0x37')],queues[_0x1462aa['uniqueid']][_0xb954('0x1c')]));writeDB(queues[_0x1462aa['uniqueid']]);}}}catch(_0x41349e){utils[_0xb954('0x12')](util[_0xb954('0xe')](_0xb954('0x3c'),_0x1462aa[_0xb954('0xd')]),_0x41349e);}};exports[_0xb954('0x42')]=function(_0x11d674){try{if(!_[_0xb954('0x29')](queues[_0x11d674['transfereeuniqueid']])){utils[_0xb954('0x14')](util[_0xb954('0xe')](_0xb954('0x43'),_0x11d674[_0xb954('0xd')]),_0x11d674);queues[_0x11d674[_0xb954('0x44')]][_0xb954('0x3e')]=!![];queues[_0x11d674['transfereeuniqueid']][_0xb954('0x45')]='BLIND';queues[_0x11d674[_0xb954('0x44')]][_0xb954('0x46')]=_0x11d674[_0xb954('0x47')];queues[_0x11d674['transfereeuniqueid']]['transferuniqueid']=_0x11d674[_0xb954('0x44')];queues[_0x11d674[_0xb954('0x44')]][_0xb954('0x1c')]=_0xb954('0x48');utils[_0xb954('0x2')](util[_0xb954('0xe')](_0xb954('0x49'),_0x11d674[_0xb954('0xd')],queues[_0x11d674[_0xb954('0x44')]][_0xb954('0x1e')],_0x11d674[_0xb954('0x44')],_0x11d674[_0xb954('0x47')]));}}catch(_0x33573a){utils[_0xb954('0x12')](util[_0xb954('0xe')](_0xb954('0x43'),_0x11d674[_0xb954('0xd')]),_0x33573a);}};exports[_0xb954('0x4a')]=function(_0x28da22){try{utils[_0xb954('0x14')](util[_0xb954('0xe')](_0xb954('0x4b'),_0x28da22[_0xb954('0x4c')]),_0x28da22);if(_0x28da22[_0xb954('0x4c')]==_0x28da22['origtransfererlinkedid']){if(!_[_0xb954('0x29')](queues[_0x28da22['secondtransfererlinkedid']])){utils[_0xb954('0x2')](util['format'](_0xb954('0x4d'),_0x28da22[_0xb954('0x4c')],queues[_0x28da22[_0xb954('0x4e')]][_0xb954('0x1e')],_0x28da22['origtransfererexten']));queues[_0x28da22[_0xb954('0x4e')]][_0xb954('0x3e')]=!![];queues[_0x28da22[_0xb954('0x4e')]][_0xb954('0x45')]=_0xb954('0x4f');queues[_0x28da22[_0xb954('0x4e')]][_0xb954('0x46')]=_0x28da22[_0xb954('0x50')];queues[_0x28da22[_0xb954('0x4e')]][_0xb954('0x51')]=_0x28da22[_0xb954('0x4c')];queues[_0x28da22['secondtransfererlinkedid']]['queuecallerexitreason']=_0xb954('0x52');}if(!_[_0xb954('0x29')](queues[_0x28da22[_0xb954('0x53')]])){if(_0x28da22['transfereelinkedid']&&queues[_0x28da22['transfereelinkedid']]){queues[_0x28da22['transfereelinkedid']][_0xb954('0x1f')]=0x1;queues[_0x28da22[_0xb954('0x44')]]=_[_0xb954('0x54')](queues[_0x28da22['transfereelinkedid']]);queues[_0x28da22[_0xb954('0x44')]]['transfereduniqueid']=_0x28da22[_0xb954('0x55')];queues[_0x28da22['transfereeuniqueid']][_0xb954('0x1f')]=0x2;queues[_0x28da22[_0xb954('0x44')]][_0xb954('0x5')]=queues[_0x28da22[_0xb954('0x4e')]]['calleridnum'];queues[_0x28da22['transfereeuniqueid']][_0xb954('0x56')]=queues[_0x28da22[_0xb954('0x4e')]][_0xb954('0x56')];queues[_0x28da22[_0xb954('0x44')]]['queuecallerjoinAt']=utils['now']();queues[_0x28da22[_0xb954('0x44')]]['queuecallerleaveAt']=utils[_0xb954('0x1b')]();queues[_0x28da22['transfereeuniqueid']][_0xb954('0x57')]=0x0;queues[_0x28da22['transfereeuniqueid']][_0xb954('0x58')]=0x0;utils[_0xb954('0x2')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x28da22[_0xb954('0x4c')],queues[_0x28da22[_0xb954('0x44')]][_0xb954('0x1e')],queues[_0x28da22[_0xb954('0x44')]]['calleridnum'],queues[_0x28da22[_0xb954('0x44')]]['calleridname']));}else{utils['info'](util[_0xb954('0xe')](_0xb954('0x59'),_0x28da22[_0xb954('0x4c')],queues[_0x28da22[_0xb954('0x53')]][_0xb954('0x1e')],_0x28da22[_0xb954('0x4e')]));queues[_0x28da22[_0xb954('0x53')]][_0xb954('0xa')]=_0x28da22[_0xb954('0x4e')];}}}else if(_0x28da22[_0xb954('0x5a')]==_0x28da22[_0xb954('0x4e')]){if(!_[_0xb954('0x29')](queues[_0x28da22['origtransfererlinkedid']])){utils[_0xb954('0x2')](util[_0xb954('0xe')](_0xb954('0x5b'),_0x28da22[_0xb954('0x4c')],queues[_0x28da22['origtransfererlinkedid']][_0xb954('0x1e')],_0x28da22[_0xb954('0x5a')],_0x28da22['secondtransfererexten']));queues[_0x28da22['origtransfererlinkedid']][_0xb954('0x3e')]=!![];queues[_0x28da22['origtransfererlinkedid']][_0xb954('0x45')]=_0xb954('0x4f');queues[_0x28da22[_0xb954('0x53')]][_0xb954('0x46')]=_0x28da22[_0xb954('0x5c')];queues[_0x28da22[_0xb954('0x53')]][_0xb954('0x51')]=_0x28da22[_0xb954('0x5a')];queues[_0x28da22[_0xb954('0x53')]][_0xb954('0x1c')]=_0xb954('0x52');}if(!_[_0xb954('0x29')](queues[_0x28da22[_0xb954('0x4e')]])){if(_0x28da22['transfertargetlinkedid']&&queues[_0x28da22['transfertargetlinkedid']]){queues[_0x28da22[_0xb954('0x5d')]][_0xb954('0x1f')]=0x1;queues[_0x28da22[_0xb954('0x55')]]=_[_0xb954('0x54')](queues[_0x28da22['transfertargetlinkedid']]);queues[_0x28da22['transfertargetuniqueid']][_0xb954('0xa')]=_0x28da22[_0xb954('0x55')];queues[_0x28da22[_0xb954('0x55')]][_0xb954('0x1f')]=0x2;queues[_0x28da22[_0xb954('0x55')]][_0xb954('0x5')]=queues[_0x28da22[_0xb954('0x53')]][_0xb954('0x5')];queues[_0x28da22['transfertargetuniqueid']][_0xb954('0x56')]=queues[_0x28da22['origtransfererlinkedid']][_0xb954('0x56')];queues[_0x28da22[_0xb954('0x55')]]['queuecallerjoinAt']=utils[_0xb954('0x1b')]();queues[_0x28da22['transfertargetuniqueid']][_0xb954('0x16')]=utils['now']();queues[_0x28da22[_0xb954('0x55')]][_0xb954('0x57')]=0x0;queues[_0x28da22['transfertargetuniqueid']][_0xb954('0x58')]=0x0;utils[_0xb954('0x2')](util['format'](_0xb954('0x5e'),_0x28da22[_0xb954('0x4c')],queues[_0x28da22[_0xb954('0x55')]][_0xb954('0x1e')],queues[_0x28da22[_0xb954('0x55')]][_0xb954('0xa')],queues[_0x28da22[_0xb954('0x55')]][_0xb954('0x5')],queues[_0x28da22[_0xb954('0x55')]][_0xb954('0x56')]));}else{utils[_0xb954('0x2')](util[_0xb954('0xe')](_0xb954('0x59'),_0x28da22[_0xb954('0x4c')],queues[_0x28da22[_0xb954('0x4e')]][_0xb954('0x1e')],_0x28da22[_0xb954('0x53')]));queues[_0x28da22[_0xb954('0x4e')]][_0xb954('0xa')]=_0x28da22[_0xb954('0x53')];}}}}catch(_0x2de309){utils['error'](util['format'](_0xb954('0x4b'),_0x28da22[_0xb954('0x4c')]),_0x2de309);}};exports[_0xb954('0x5f')]=function(_0x58cfc3){try{if(!_[_0xb954('0x29')](queues[_0x58cfc3['uniqueid']])){utils[_0xb954('0x14')](util[_0xb954('0xe')](_0xb954('0x60'),_0x58cfc3[_0xb954('0xd')]),_0x58cfc3);queues[_0x58cfc3['uniqueid']][_0xb954('0x61')]=utils[_0xb954('0x1b')]();utils[_0xb954('0x2')](util[_0xb954('0xe')](_0xb954('0x62'),_0x58cfc3['uniqueid'],queues[_0x58cfc3[_0xb954('0xd')]][_0xb954('0x1e')],queues[_0x58cfc3[_0xb954('0xd')]]['musiconholdstartAt']));}}catch(_0x25aa80){utils[_0xb954('0x12')](util[_0xb954('0xe')]('[%s][queues][musiconholdstart]',_0x58cfc3[_0xb954('0xd')]),_0x25aa80);}};exports['musiconholdstop']=function(_0x3b6978){try{if(!_[_0xb954('0x29')](queues[_0x3b6978[_0xb954('0xd')]])){if(!_[_0xb954('0x29')](queues[_0x3b6978['uniqueid']][_0xb954('0x61')])){utils[_0xb954('0x14')](util[_0xb954('0xe')]('[%s][queues][musiconholdstop]',_0x3b6978[_0xb954('0xd')]),_0x3b6978);queues[_0x3b6978[_0xb954('0xd')]][_0xb954('0x58')]+=utils[_0xb954('0x63')](utils['now'](),queues[_0x3b6978['uniqueid']][_0xb954('0x61')]);utils[_0xb954('0x2')](util[_0xb954('0xe')](_0xb954('0x64'),_0x3b6978[_0xb954('0xd')],queues[_0x3b6978[_0xb954('0xd')]][_0xb954('0x1e')],queues[_0x3b6978[_0xb954('0xd')]]['mohtime']));delete queues[_0x3b6978[_0xb954('0xd')]][_0xb954('0x61')];}}}catch(_0x5d9924){utils[_0xb954('0x12')](util[_0xb954('0xe')](_0xb954('0x65'),_0x3b6978[_0xb954('0xd')]),_0x5d9924);}}; \ No newline at end of file +var _0x7312=['musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','util','./utils','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','format','[%s][queues][queuecallerjoin]','position','assign','now','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerexit','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','error','varset','[%s][queues][varset]','variable','queuestatus','value','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerabandon','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleave','holdtime','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','[%s][queues][agentcomplete]','queuecallercomplete','queuecallercompleteAt','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','calleridname','queuecallerjoinAt','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]','[%s][queues][musiconholdstart]'];(function(_0x54a479,_0x1b321d){var _0x2474ab=function(_0x428755){while(--_0x428755){_0x54a479['push'](_0x54a479['shift']());}};_0x2474ab(++_0x1b321d);}(_0x7312,0x14d));var _0x2731=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0x7312[_0x176329];return _0x31997c;};'use strict';var _=require(_0x2731('0x0'));var util=require(_0x2731('0x1'));var utils=require(_0x2731('0x2'));var queues={};function writeDB(_0xf2e040){utils[_0x2731('0x3')](util['format'](_0x2731('0x4'),_0xf2e040[_0x2731('0x5')],_0xf2e040[_0x2731('0x6')],_0xf2e040[_0x2731('0x7')],_0xf2e040[_0x2731('0x8')],_0xf2e040[_0x2731('0x9')],_0xf2e040[_0x2731('0xa')],_0xf2e040[_0x2731('0xb')]));if(_0xf2e040[_0x2731('0x7')]){utils[_0x2731('0xc')](_0xf2e040[_0x2731('0x7')])[_0x2731('0xd')](function(_0x4cd300){if(_0x4cd300){_0xf2e040['type']=_0x4cd300[_0x2731('0xe')];}utils[_0x2731('0xf')](_0x2731('0x10'),_0xf2e040);});}else{utils[_0x2731('0xf')](_0x2731('0x10'),_0xf2e040);}if(_0xf2e040[_0x2731('0x11')]){delete queues[_0xf2e040[_0x2731('0x11')]];}else{delete queues[_0xf2e040[_0x2731('0x5')]];}}exports[_0x2731('0x12')]=function(_0x5d9303){try{utils[_0x2731('0x13')](util[_0x2731('0x14')](_0x2731('0x15'),_0x5d9303[_0x2731('0x5')]),_0x5d9303);utils['info'](util[_0x2731('0x14')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x5d9303[_0x2731('0x5')],_0x5d9303[_0x2731('0x7')],_0x5d9303[_0x2731('0x16')]));queues[_0x5d9303['uniqueid']]=_[_0x2731('0x17')](_0x5d9303,{'originalposition':_0x5d9303[_0x2731('0x16')],'queuecallerjoinAt':utils[_0x2731('0x18')](),'mohtime':0x0});}catch(_0x54fa26){utils['error'](util[_0x2731('0x14')](_0x2731('0x15'),_0x5d9303[_0x2731('0x5')]),_0x54fa26);}};exports[_0x2731('0x19')]=function(_0x1fe1ff){try{if(!_[_0x2731('0x1a')](queues[_0x1fe1ff[_0x2731('0x5')]])){utils[_0x2731('0x13')](util[_0x2731('0x14')](_0x2731('0x1b'),_0x1fe1ff[_0x2731('0x5')]),_0x1fe1ff);if(queues[_0x1fe1ff[_0x2731('0x5')]][_0x2731('0x1c')]){if(!queues[_0x1fe1ff['uniqueid']]['queuecallerabandon']&&!queues[_0x1fe1ff[_0x2731('0x5')]][_0x2731('0x1d')]){queues[_0x1fe1ff[_0x2731('0x5')]]['queuecallercomplete']=!![];queues[_0x1fe1ff[_0x2731('0x5')]]['queuecallercompleteAt']=utils['now']();queues[_0x1fe1ff[_0x2731('0x5')]]['queuecallerexitreason']=_0x2731('0x1e');}utils[_0x2731('0x3')](util[_0x2731('0x14')](_0x2731('0x1f'),_0x1fe1ff['uniqueid'],queues[_0x1fe1ff[_0x2731('0x5')]][_0x2731('0x20')],queues[_0x1fe1ff[_0x2731('0x5')]][_0x2731('0xb')]));writeDB(queues[_0x1fe1ff[_0x2731('0x5')]]);}else if(queues[_0x1fe1ff['uniqueid']][_0x2731('0x11')]){utils[_0x2731('0x3')](util[_0x2731('0x14')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x1fe1ff[_0x2731('0x5')],queues[_0x1fe1ff[_0x2731('0x5')]][_0x2731('0x20')],queues[_0x1fe1ff['uniqueid']][_0x2731('0x11')]));queues[queues[_0x1fe1ff[_0x2731('0x5')]][_0x2731('0x11')]]=queues[_0x1fe1ff[_0x2731('0x5')]];queues[queues[_0x1fe1ff[_0x2731('0x5')]][_0x2731('0x11')]][_0x2731('0x21')]=0x2;delete queues[_0x1fe1ff[_0x2731('0x5')]];}}}catch(_0x1dd804){utils[_0x2731('0x22')](util[_0x2731('0x14')](_0x2731('0x1b'),_0x1fe1ff['uniqueid']),_0x1dd804);}};exports[_0x2731('0x23')]=function(_0x196d83){try{utils[_0x2731('0x13')](util[_0x2731('0x14')](_0x2731('0x24'),_0x196d83[_0x2731('0x5')]),_0x196d83);if(!_[_0x2731('0x1a')](_0x196d83[_0x2731('0x25')][_0x2731('0x26')])&&_0x196d83[_0x2731('0x27')]['toUpperCase']()!=='CONTINUE'){if(!_[_0x2731('0x1a')](queues[_0x196d83[_0x2731('0x5')]])){queues[_0x196d83[_0x2731('0x5')]]['queuecallerabandon']=![];queues[_0x196d83[_0x2731('0x5')]][_0x2731('0x28')]=null;queues[_0x196d83[_0x2731('0x5')]][_0x2731('0x1d')]=!![];queues[_0x196d83[_0x2731('0x5')]][_0x2731('0x29')]=utils[_0x2731('0x18')]();queues[_0x196d83[_0x2731('0x5')]][_0x2731('0xb')]=_0x196d83['value']['toUpperCase']();utils[_0x2731('0x3')](util[_0x2731('0x14')](_0x2731('0x2a'),_0x196d83[_0x2731('0x5')],queues[_0x196d83[_0x2731('0x5')]][_0x2731('0x20')],_0x196d83[_0x2731('0x27')],queues[_0x196d83['uniqueid']][_0x2731('0xb')]));writeDB(queues[_0x196d83[_0x2731('0x5')]]);}}else if(!_[_0x2731('0x1a')](_0x196d83[_0x2731('0x25')][_0x2731('0x2b')])){if(!_[_0x2731('0x1a')](queues[_0x196d83[_0x2731('0x5')]])&&!queues[_0x196d83[_0x2731('0x5')]][_0x2731('0x2c')]){queues[_0x196d83[_0x2731('0x5')]][_0x2731('0x2c')]=![];queues[_0x196d83['uniqueid']][_0x2731('0x28')]=null;queues[_0x196d83[_0x2731('0x5')]][_0x2731('0x1d')]=!![];queues[_0x196d83['uniqueid']][_0x2731('0x29')]=utils['now']();queues[_0x196d83[_0x2731('0x5')]]['queuecallerexitreason']=_0x2731('0x2d');utils['info'](util['format'](_0x2731('0x2e'),_0x196d83[_0x2731('0x5')],queues[_0x196d83['uniqueid']][_0x2731('0x20')],_0x196d83[_0x2731('0x27')],queues[_0x196d83['uniqueid']][_0x2731('0xb')]));}}}catch(_0x5d565e){utils['error'](util['format']('[%s][queues][varset]',_0x196d83[_0x2731('0x5')]),_0x5d565e);}};exports['queuecallerabandon']=function(_0x17e037){try{if(!_['isNil'](queues[_0x17e037[_0x2731('0x5')]])){utils[_0x2731('0x13')](util[_0x2731('0x14')](_0x2731('0x2f'),_0x17e037[_0x2731('0x5')]),_0x17e037);queues[_0x17e037[_0x2731('0x5')]][_0x2731('0x1d')]=![];queues[_0x17e037['uniqueid']]['queuecallerexitAt']=null;queues[_0x17e037[_0x2731('0x5')]][_0x2731('0x2c')]=!![];queues[_0x17e037['uniqueid']][_0x2731('0x28')]=utils[_0x2731('0x18')]();queues[_0x17e037['uniqueid']][_0x2731('0xb')]=_0x2731('0x30');utils['info'](util[_0x2731('0x14')](_0x2731('0x31'),_0x17e037[_0x2731('0x5')],queues[_0x17e037[_0x2731('0x5')]][_0x2731('0x20')],queues[_0x17e037['uniqueid']][_0x2731('0xb')]));}}catch(_0x1538b2){utils[_0x2731('0x22')](util[_0x2731('0x14')](_0x2731('0x2f'),_0x17e037[_0x2731('0x5')]),_0x1538b2);}};exports['queuecallerleave']=function(_0x32f1b8){try{if(!_['isNil'](queues[_0x32f1b8[_0x2731('0x5')]])){utils[_0x2731('0x13')](util['format'](_0x2731('0x32'),_0x32f1b8[_0x2731('0x5')]),_0x32f1b8);utils['info'](util['format'](_0x2731('0x33'),_0x32f1b8[_0x2731('0x5')],queues[_0x32f1b8['uniqueid']][_0x2731('0x20')],_0x32f1b8[_0x2731('0x34')],_0x32f1b8[_0x2731('0x35')]));queues[_0x32f1b8[_0x2731('0x5')]][_0x2731('0x36')]=!![];queues[_0x32f1b8[_0x2731('0x5')]][_0x2731('0x1c')]=utils[_0x2731('0x18')]();queues[_0x32f1b8[_0x2731('0x5')]][_0x2731('0x37')]=utils['diffTime'](queues[_0x32f1b8[_0x2731('0x5')]]['queuecallerleaveAt'],queues[_0x32f1b8[_0x2731('0x5')]]['queuecallerjoinAt']);queues[_0x32f1b8[_0x2731('0x5')]][_0x2731('0x16')]=_0x32f1b8['position'];queues[_0x32f1b8[_0x2731('0x5')]][_0x2731('0x38')]=_0x32f1b8[_0x2731('0x38')];queues[_0x32f1b8[_0x2731('0x5')]][_0x2731('0x34')]=_0x32f1b8['connectedlinenum'];queues[_0x32f1b8[_0x2731('0x5')]][_0x2731('0x35')]=_0x32f1b8[_0x2731('0x35')];}}catch(_0x577502){utils[_0x2731('0x22')](util[_0x2731('0x14')]('[%s][queues][queuecallerleave]',_0x32f1b8[_0x2731('0x5')]),_0x577502);}};exports[_0x2731('0x39')]=function(_0x5c1821){try{if(!_['isNil'](queues[_0x5c1821[_0x2731('0x5')]])){utils[_0x2731('0x13')](util[_0x2731('0x14')](_0x2731('0x3a'),_0x5c1821[_0x2731('0x5')]),_0x5c1821);utils['info'](util[_0x2731('0x14')](_0x2731('0x3b'),_0x5c1821[_0x2731('0x5')],queues[_0x5c1821[_0x2731('0x5')]]['name'],_0x5c1821[_0x2731('0x3c')],_0x5c1821[_0x2731('0x3d')]));queues[_0x5c1821[_0x2731('0x5')]][_0x2731('0x2c')]=![];queues[_0x5c1821[_0x2731('0x5')]]['queuecallerabandon']=![];queues[_0x5c1821[_0x2731('0x5')]][_0x2731('0x28')]=null;queues[_0x5c1821[_0x2731('0x5')]][_0x2731('0x1d')]=![];queues[_0x5c1821[_0x2731('0x5')]][_0x2731('0xb')]=null;queues[_0x5c1821['uniqueid']][_0x2731('0x29')]=null;queues[_0x5c1821[_0x2731('0x5')]][_0x2731('0x3e')]=!![];queues[_0x5c1821['uniqueid']][_0x2731('0xa')]=_0x5c1821['destaccountcode'];queues[_0x5c1821[_0x2731('0x5')]][_0x2731('0x8')]=_0x5c1821[_0x2731('0x3c')];}}catch(_0x185fe2){utils[_0x2731('0x22')](util[_0x2731('0x14')](_0x2731('0x3a'),_0x5c1821[_0x2731('0x5')]),_0x185fe2);}};exports['agentcomplete']=function(_0x53d8d6){try{if(!_[_0x2731('0x1a')](queues[_0x53d8d6['uniqueid']])){if(queues[_0x53d8d6[_0x2731('0x5')]]['queuecallerleaveAt']){utils['debug'](util[_0x2731('0x14')](_0x2731('0x3f'),_0x53d8d6[_0x2731('0x5')]),_0x53d8d6);queues[_0x53d8d6[_0x2731('0x5')]][_0x2731('0x2c')]=![];queues[_0x53d8d6[_0x2731('0x5')]][_0x2731('0x2c')]=![];queues[_0x53d8d6[_0x2731('0x5')]][_0x2731('0x28')]=null;queues[_0x53d8d6['uniqueid']][_0x2731('0x1d')]=![];queues[_0x53d8d6[_0x2731('0x5')]][_0x2731('0x29')]=null;queues[_0x53d8d6[_0x2731('0x5')]][_0x2731('0x3e')]=!![];queues[_0x53d8d6[_0x2731('0x5')]][_0x2731('0x8')]=_0x53d8d6[_0x2731('0x3c')];queues[_0x53d8d6[_0x2731('0x5')]][_0x2731('0x40')]=!![];queues[_0x53d8d6[_0x2731('0x5')]][_0x2731('0x41')]=utils[_0x2731('0x18')]();if(_0x53d8d6[_0x2731('0x42')]==_0x2731('0x43')){if(!queues[_0x53d8d6[_0x2731('0x5')]][_0x2731('0x43')]){queues[_0x53d8d6[_0x2731('0x5')]][_0x2731('0xb')]=_0x2731('0x44');}}else{queues[_0x53d8d6[_0x2731('0x5')]][_0x2731('0xb')]=_0x2731('0x45')+_0x53d8d6['reason']['toUpperCase']();}utils[_0x2731('0x3')](util[_0x2731('0x14')](_0x2731('0x46'),_0x53d8d6['uniqueid'],queues[_0x53d8d6[_0x2731('0x5')]][_0x2731('0x20')],_0x53d8d6[_0x2731('0x3c')],queues[_0x53d8d6[_0x2731('0x5')]][_0x2731('0xb')]));writeDB(queues[_0x53d8d6['uniqueid']]);}}}catch(_0x4b3052){utils[_0x2731('0x22')](util[_0x2731('0x14')](_0x2731('0x3f'),_0x53d8d6[_0x2731('0x5')]),_0x4b3052);}};exports[_0x2731('0x47')]=function(_0x280756){try{if(!_['isNil'](queues[_0x280756[_0x2731('0x48')]])){utils['debug'](util['format'](_0x2731('0x49'),_0x280756['uniqueid']),_0x280756);queues[_0x280756[_0x2731('0x48')]][_0x2731('0x43')]=!![];queues[_0x280756[_0x2731('0x48')]][_0x2731('0x4a')]=_0x2731('0x4b');queues[_0x280756[_0x2731('0x48')]][_0x2731('0x4c')]=_0x280756[_0x2731('0x4d')];queues[_0x280756[_0x2731('0x48')]][_0x2731('0x4e')]=_0x280756[_0x2731('0x48')];queues[_0x280756['transfereeuniqueid']][_0x2731('0xb')]=_0x2731('0x4f');utils[_0x2731('0x3')](util[_0x2731('0x14')](_0x2731('0x50'),_0x280756[_0x2731('0x5')],queues[_0x280756[_0x2731('0x48')]]['name'],_0x280756[_0x2731('0x48')],_0x280756[_0x2731('0x4d')]));}}catch(_0x3a3057){utils[_0x2731('0x22')](util[_0x2731('0x14')](_0x2731('0x49'),_0x280756[_0x2731('0x5')]),_0x3a3057);}};exports[_0x2731('0x51')]=function(_0x5e289e){try{utils[_0x2731('0x13')](util[_0x2731('0x14')]('[%s][queues][attendedtransfer]',_0x5e289e[_0x2731('0x52')]),_0x5e289e);if(_0x5e289e['origtransfereruniqueid']==_0x5e289e[_0x2731('0x53')]){if(!_[_0x2731('0x1a')](queues[_0x5e289e[_0x2731('0x54')]])){utils['info'](util[_0x2731('0x14')](_0x2731('0x55'),_0x5e289e[_0x2731('0x52')],queues[_0x5e289e[_0x2731('0x54')]]['name'],_0x5e289e[_0x2731('0x56')]));queues[_0x5e289e['secondtransfererlinkedid']]['transfer']=!![];queues[_0x5e289e[_0x2731('0x54')]][_0x2731('0x4a')]=_0x2731('0x57');queues[_0x5e289e['secondtransfererlinkedid']][_0x2731('0x4c')]=_0x5e289e[_0x2731('0x56')];queues[_0x5e289e['secondtransfererlinkedid']][_0x2731('0x4e')]=_0x5e289e['origtransfereruniqueid'];queues[_0x5e289e[_0x2731('0x54')]]['queuecallerexitreason']=_0x2731('0x58');}if(!_[_0x2731('0x1a')](queues[_0x5e289e['origtransfererlinkedid']])){if(_0x5e289e[_0x2731('0x59')]&&queues[_0x5e289e['transfereelinkedid']]){queues[_0x5e289e[_0x2731('0x59')]][_0x2731('0x21')]=0x1;queues[_0x5e289e[_0x2731('0x48')]]=_[_0x2731('0x5a')](queues[_0x5e289e[_0x2731('0x59')]]);queues[_0x5e289e[_0x2731('0x48')]][_0x2731('0x11')]=_0x5e289e['transfertargetuniqueid'];queues[_0x5e289e[_0x2731('0x48')]]['queuecallerenterreason']=0x2;queues[_0x5e289e['transfereeuniqueid']][_0x2731('0x9')]=queues[_0x5e289e[_0x2731('0x54')]]['calleridnum'];queues[_0x5e289e['transfereeuniqueid']][_0x2731('0x5b')]=queues[_0x5e289e[_0x2731('0x54')]][_0x2731('0x5b')];queues[_0x5e289e[_0x2731('0x48')]][_0x2731('0x5c')]=utils[_0x2731('0x18')]();queues[_0x5e289e[_0x2731('0x48')]]['queuecallerleaveAt']=utils[_0x2731('0x18')]();queues[_0x5e289e[_0x2731('0x48')]][_0x2731('0x37')]=0x0;queues[_0x5e289e[_0x2731('0x48')]][_0x2731('0x5d')]=0x0;utils[_0x2731('0x3')](util[_0x2731('0x14')](_0x2731('0x5e'),_0x5e289e[_0x2731('0x52')],queues[_0x5e289e['transfereeuniqueid']][_0x2731('0x20')],queues[_0x5e289e['transfereeuniqueid']][_0x2731('0x9')],queues[_0x5e289e['transfereeuniqueid']][_0x2731('0x5b')]));}else{utils[_0x2731('0x3')](util['format'](_0x2731('0x5f'),_0x5e289e[_0x2731('0x52')],queues[_0x5e289e[_0x2731('0x53')]][_0x2731('0x20')],_0x5e289e[_0x2731('0x54')]));queues[_0x5e289e[_0x2731('0x53')]][_0x2731('0x11')]=_0x5e289e['secondtransfererlinkedid'];}}}else if(_0x5e289e[_0x2731('0x60')]==_0x5e289e[_0x2731('0x54')]){if(!_[_0x2731('0x1a')](queues[_0x5e289e[_0x2731('0x53')]])){utils[_0x2731('0x3')](util[_0x2731('0x14')](_0x2731('0x61'),_0x5e289e[_0x2731('0x52')],queues[_0x5e289e[_0x2731('0x53')]][_0x2731('0x20')],_0x5e289e[_0x2731('0x60')],_0x5e289e[_0x2731('0x62')]));queues[_0x5e289e[_0x2731('0x53')]][_0x2731('0x43')]=!![];queues[_0x5e289e[_0x2731('0x53')]]['transfertype']=_0x2731('0x57');queues[_0x5e289e['origtransfererlinkedid']][_0x2731('0x4c')]=_0x5e289e['secondtransfererexten'];queues[_0x5e289e[_0x2731('0x53')]][_0x2731('0x4e')]=_0x5e289e[_0x2731('0x60')];queues[_0x5e289e[_0x2731('0x53')]]['queuecallerexitreason']=_0x2731('0x58');}if(!_[_0x2731('0x1a')](queues[_0x5e289e['secondtransfererlinkedid']])){if(_0x5e289e[_0x2731('0x63')]&&queues[_0x5e289e[_0x2731('0x63')]]){queues[_0x5e289e[_0x2731('0x63')]][_0x2731('0x21')]=0x1;queues[_0x5e289e[_0x2731('0x64')]]=_[_0x2731('0x5a')](queues[_0x5e289e['transfertargetlinkedid']]);queues[_0x5e289e[_0x2731('0x64')]][_0x2731('0x11')]=_0x5e289e['transfertargetuniqueid'];queues[_0x5e289e[_0x2731('0x64')]][_0x2731('0x21')]=0x2;queues[_0x5e289e[_0x2731('0x64')]][_0x2731('0x9')]=queues[_0x5e289e[_0x2731('0x53')]][_0x2731('0x9')];queues[_0x5e289e[_0x2731('0x64')]][_0x2731('0x5b')]=queues[_0x5e289e[_0x2731('0x53')]]['calleridname'];queues[_0x5e289e[_0x2731('0x64')]]['queuecallerjoinAt']=utils[_0x2731('0x18')]();queues[_0x5e289e[_0x2731('0x64')]]['queuecallerleaveAt']=utils[_0x2731('0x18')]();queues[_0x5e289e['transfertargetuniqueid']][_0x2731('0x37')]=0x0;queues[_0x5e289e['transfertargetuniqueid']]['mohtime']=0x0;utils[_0x2731('0x3')](util[_0x2731('0x14')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x5e289e[_0x2731('0x52')],queues[_0x5e289e[_0x2731('0x64')]][_0x2731('0x20')],queues[_0x5e289e[_0x2731('0x64')]][_0x2731('0x11')],queues[_0x5e289e[_0x2731('0x64')]][_0x2731('0x9')],queues[_0x5e289e[_0x2731('0x64')]]['calleridname']));}else{utils[_0x2731('0x3')](util[_0x2731('0x14')](_0x2731('0x5f'),_0x5e289e[_0x2731('0x52')],queues[_0x5e289e[_0x2731('0x54')]][_0x2731('0x20')],_0x5e289e[_0x2731('0x53')]));queues[_0x5e289e[_0x2731('0x54')]][_0x2731('0x11')]=_0x5e289e['origtransfererlinkedid'];}}}}catch(_0x18489d){utils[_0x2731('0x22')](util[_0x2731('0x14')](_0x2731('0x65'),_0x5e289e[_0x2731('0x52')]),_0x18489d);}};exports['musiconholdstart']=function(_0x4bbd4d){try{if(!_[_0x2731('0x1a')](queues[_0x4bbd4d[_0x2731('0x5')]])){utils[_0x2731('0x13')](util[_0x2731('0x14')](_0x2731('0x66'),_0x4bbd4d[_0x2731('0x5')]),_0x4bbd4d);queues[_0x4bbd4d[_0x2731('0x5')]][_0x2731('0x67')]=utils[_0x2731('0x18')]();utils[_0x2731('0x3')](util[_0x2731('0x14')](_0x2731('0x68'),_0x4bbd4d['uniqueid'],queues[_0x4bbd4d['uniqueid']][_0x2731('0x20')],queues[_0x4bbd4d[_0x2731('0x5')]]['musiconholdstartAt']));}}catch(_0x53bba8){utils['error'](util[_0x2731('0x14')](_0x2731('0x66'),_0x4bbd4d[_0x2731('0x5')]),_0x53bba8);}};exports[_0x2731('0x69')]=function(_0x279684){try{if(!_[_0x2731('0x1a')](queues[_0x279684['uniqueid']])){if(!_['isNil'](queues[_0x279684[_0x2731('0x5')]][_0x2731('0x67')])){utils['debug'](util[_0x2731('0x14')]('[%s][queues][musiconholdstop]',_0x279684[_0x2731('0x5')]),_0x279684);queues[_0x279684[_0x2731('0x5')]][_0x2731('0x5d')]+=utils[_0x2731('0x6a')](utils[_0x2731('0x18')](),queues[_0x279684['uniqueid']]['musiconholdstartAt']);utils[_0x2731('0x3')](util[_0x2731('0x14')](_0x2731('0x6b'),_0x279684[_0x2731('0x5')],queues[_0x279684[_0x2731('0x5')]][_0x2731('0x20')],queues[_0x279684[_0x2731('0x5')]]['mohtime']));delete queues[_0x279684['uniqueid']][_0x2731('0x67')];}}}catch(_0x3f7896){utils[_0x2731('0x22')](util['format'](_0x2731('0x6c'),_0x279684[_0x2731('0x5')]),_0x3f7896);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 6bd7bb4..f2dd297 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 _0x3696=['debug','[%s][recordings][newstate]','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','linkedid','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.wav49','replace','.WAV','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]','application','appdata','toLowerCase','set','startsWith','cdr','split','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','getUserByInternal','accountcode','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','[%s][recordings][newchannel]','context','exten','channel','error','newstate'];(function(_0x459a0a,_0x25c46f){var _0x4ab46c=function(_0x451a6a){while(--_0x451a6a){_0x459a0a['push'](_0x459a0a['shift']());}};_0x4ab46c(++_0x25c46f);}(_0x3696,0x1bf));var _0x6369=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x3696[_0x4b7895];return _0x264180;};'use strict';var _=require(_0x6369('0x0'));var util=require(_0x6369('0x1'));var utils=require(_0x6369('0x2'));var recordings={};function writeDB(_0x3768d2){utils[_0x6369('0x3')](util[_0x6369('0x4')](_0x6369('0x5'),_0x3768d2[_0x6369('0x6')]));if(_0x3768d2['accountcode']){utils[_0x6369('0x7')](_0x3768d2[_0x6369('0x8')])[_0x6369('0x9')](function(_0x5c9076){if(_0x5c9076){_0x3768d2[_0x6369('0xa')]=_0x5c9076[_0x6369('0xb')];_0x3768d2[_0x6369('0xc')]=_0x5c9076['id'];}utils[_0x6369('0xd')](_0x6369('0xe'),_0x3768d2);});}else{utils[_0x6369('0xd')]('CreateVoiceRecording',_0x3768d2);}}exports[_0x6369('0xf')]=function(_0x2e7822){try{utils['debug'](util[_0x6369('0x4')](_0x6369('0x10'),_0x2e7822[_0x6369('0x6')]),_0x2e7822);if(_0x2e7822[_0x6369('0x6')]==_0x2e7822['linkedid']){utils[_0x6369('0x3')](util[_0x6369('0x4')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x2e7822[_0x6369('0x6')],_0x2e7822[_0x6369('0x11')],_0x2e7822['exten']));recordings[_0x2e7822[_0x6369('0x6')]]={'uniqueid':_0x2e7822[_0x6369('0x6')],'accountcode':_0x2e7822[_0x6369('0x8')],'exten':_0x2e7822[_0x6369('0x12')],'context':_0x2e7822[_0x6369('0x11')],'channel':_0x2e7822[_0x6369('0x13')],'monitors':[]};}}catch(_0x89014c){utils[_0x6369('0x14')](util[_0x6369('0x4')](_0x6369('0x10'),_0x2e7822[_0x6369('0x6')]),_0x89014c);}};exports[_0x6369('0x15')]=function(_0x54a48a){try{utils[_0x6369('0x16')](util[_0x6369('0x4')](_0x6369('0x17'),_0x54a48a['uniqueid']),_0x54a48a);if(!_[_0x6369('0x18')](recordings[_0x54a48a['uniqueid']])&&_0x54a48a['channelstate']==0x6){utils[_0x6369('0x3')](util[_0x6369('0x4')](_0x6369('0x19'),_0x54a48a['uniqueid'],_0x54a48a[_0x6369('0x11')],_0x54a48a['channel']));}else if(!_[_0x6369('0x18')](recordings[_0x54a48a['linkedid']])&&_0x54a48a[_0x6369('0x1a')]==0x6&&_0x54a48a[_0x6369('0x11')]!=_0x6369('0x1b')){utils[_0x6369('0x3')](util[_0x6369('0x4')](_0x6369('0x1c'),_0x54a48a[_0x6369('0x6')],_0x54a48a[_0x6369('0x1d')],_0x54a48a[_0x6369('0x11')],_0x54a48a[_0x6369('0x13')]));recordings[_0x54a48a[_0x6369('0x1d')]][_0x6369('0x8')]=_0x54a48a[_0x6369('0x8')];}}catch(_0x100fb9){utils[_0x6369('0x14')](util['format']('[%s][recordings][newstate]',_0x54a48a[_0x6369('0x6')]),_0x100fb9);}};exports[_0x6369('0x1e')]=function(_0x48afdd){try{if(!_[_0x6369('0x18')](_0x48afdd[_0x6369('0x1f')])&&!_['isNil'](_0x48afdd['variable'][_0x6369('0x20')])){utils['debug'](util[_0x6369('0x4')](_0x6369('0x21'),_0x48afdd['uniqueid']),_0x48afdd);utils[_0x6369('0x3')](util[_0x6369('0x4')](_0x6369('0x22'),_0x48afdd[_0x6369('0x6')],_0x48afdd[_0x6369('0x1f')],_0x48afdd[_0x6369('0x23')]));if(_['endsWith'](_0x48afdd[_0x6369('0x23')],_0x6369('0x24'))){_0x48afdd[_0x6369('0x23')]=_0x48afdd['value'][_0x6369('0x25')](_0x6369('0x24'),_0x6369('0x26'));}if(recordings[_0x48afdd['linkedid']]){var _0x6c54a4=_['find'](recordings[_0x48afdd[_0x6369('0x1d')]]['monitors'],{'value':_0x48afdd[_0x6369('0x23')]});if(_[_0x6369('0x18')](_0x6c54a4)){recordings[_0x48afdd[_0x6369('0x1d')]][_0x6369('0x27')][_0x6369('0x28')]({'value':_0x48afdd[_0x6369('0x23')]});}}}}catch(_0x38a49a){utils[_0x6369('0x14')](util['format'](_0x6369('0x21'),_0x48afdd[_0x6369('0x6')]),_0x38a49a);}};exports[_0x6369('0x29')]=function(_0x5edfad){try{if(!_[_0x6369('0x18')](recordings[_0x5edfad[_0x6369('0x6')]])){utils[_0x6369('0x16')](util[_0x6369('0x4')](_0x6369('0x2a'),_0x5edfad[_0x6369('0x6')]),_0x5edfad);utils[_0x6369('0x3')](util[_0x6369('0x4')](_0x6369('0x2b'),_0x5edfad[_0x6369('0x6')],_0x5edfad[_0x6369('0x2c')],_0x5edfad['calleridname'],_0x5edfad[_0x6369('0x2d')]));recordings[_0x5edfad[_0x6369('0x6')]][_0x6369('0x2c')]=_0x5edfad[_0x6369('0x2c')];recordings[_0x5edfad['uniqueid']][_0x6369('0x2e')]=_0x5edfad[_0x6369('0x2e')];recordings[_0x5edfad[_0x6369('0x6')]][_0x6369('0x2f')]=_0x5edfad[_0x6369('0x2f')];recordings[_0x5edfad['uniqueid']][_0x6369('0x30')]=_0x5edfad[_0x6369('0x30')];if(recordings[_0x5edfad[_0x6369('0x6')]][_0x6369('0x31')]==_0x6369('0x32')&&recordings[_0x5edfad[_0x6369('0x6')]][_0x6369('0x8')]){recordings[_0x5edfad[_0x6369('0x6')]]['connectedlinenum']=recordings[_0x5edfad[_0x6369('0x6')]][_0x6369('0x8')];recordings[_0x5edfad['uniqueid']]['connectedlinename']='';}recordings[_0x5edfad[_0x6369('0x6')]][_0x6369('0x27')][_0x6369('0x33')](function(_0x38c258){var _0x112b4f=_[_0x6369('0x34')](recordings[_0x5edfad[_0x6369('0x6')]]);_0x112b4f['value']=_0x38c258[_0x6369('0x23')];writeDB(_0x112b4f);});delete recordings[_0x5edfad[_0x6369('0x6')]];}}catch(_0x4e5fa7){utils[_0x6369('0x14')](util[_0x6369('0x4')](_0x6369('0x2a'),_0x5edfad[_0x6369('0x6')]),_0x4e5fa7);}};exports[_0x6369('0x35')]=function(_0x8775eb){try{if(!_[_0x6369('0x18')](recordings[_0x8775eb[_0x6369('0x6')]])){utils[_0x6369('0x16')](util[_0x6369('0x4')](_0x6369('0x36'),_0x8775eb[_0x6369('0x6')]),_0x8775eb);utils['info'](util['format']('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x8775eb['uniqueid'],_0x8775eb[_0x6369('0x37')],_0x8775eb[_0x6369('0x38')]));if(_0x8775eb[_0x6369('0x37')][_0x6369('0x39')]()==_0x6369('0x3a')&&_[_0x6369('0x3b')](_0x8775eb['appdata'][_0x6369('0x39')](),_0x6369('0x3c'))){var _0x5bdb45=_0x8775eb[_0x6369('0x38')][_0x6369('0x3d')]('=');var _0x212af2=_0x5bdb45[0x0]['substring'](_0x5bdb45[0x0][_0x6369('0x3e')]('(')+0x1,_0x5bdb45[0x0][_0x6369('0x3e')](')'));var _0x28c5b9=_0x5bdb45[0x1];recordings[_0x8775eb[_0x6369('0x6')]][_0x212af2]=_0x28c5b9;}}}catch(_0x52745b){utils['error'](util['format'](_0x6369('0x36'),_0x8775eb[_0x6369('0x6')]),_0x52745b);}};exports[_0x6369('0x3f')]=function(_0x52b373){try{if(!_[_0x6369('0x18')](recordings[_0x52b373[_0x6369('0x6')]])){utils[_0x6369('0x16')](util[_0x6369('0x4')](_0x6369('0x40'),_0x52b373['uniqueid']),_0x52b373);utils['info'](util[_0x6369('0x4')](_0x6369('0x41'),_0x52b373['uniqueid'],_0x52b373['queue']));recordings[_0x52b373[_0x6369('0x6')]][_0x6369('0x42')]=_0x52b373[_0x6369('0x42')];}}catch(_0x2109e2){utils[_0x6369('0x14')](util['format'](_0x6369('0x40'),_0x52b373[_0x6369('0x6')]),_0x2109e2);}}; \ No newline at end of file +var _0x6706=['queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','util','./utils','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','UserId','request','CreateVoiceRecording','newchannel','[%s][recordings][newchannel]','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','channel','newstate','debug','isNil','channelstate','info','[%s][recordings][newstate]\x20context:%s\x20channel:%s','context','linkedid','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','[%s][recordings][newstate]','varset','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','variable','value','endsWith','.wav49','replace','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf'];(function(_0x24b4c6,_0xcd0d22){var _0x11a549=function(_0x271747){while(--_0x271747){_0x24b4c6['push'](_0x24b4c6['shift']());}};_0x11a549(++_0xcd0d22);}(_0x6706,0x114));var _0x6670=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6706[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x6670('0x0'));var utils=require(_0x6670('0x1'));var recordings={};function writeDB(_0x11fd1b){utils['info'](util[_0x6670('0x2')](_0x6670('0x3'),_0x11fd1b[_0x6670('0x4')]));if(_0x11fd1b[_0x6670('0x5')]){utils[_0x6670('0x6')](_0x11fd1b[_0x6670('0x5')])[_0x6670('0x7')](function(_0x347fa0){if(_0x347fa0){_0x11fd1b['membername']=_0x347fa0['name'];_0x11fd1b[_0x6670('0x8')]=_0x347fa0['id'];}utils[_0x6670('0x9')]('CreateVoiceRecording',_0x11fd1b);});}else{utils[_0x6670('0x9')](_0x6670('0xa'),_0x11fd1b);}}exports[_0x6670('0xb')]=function(_0x30449c){try{utils['debug'](util[_0x6670('0x2')](_0x6670('0xc'),_0x30449c[_0x6670('0x4')]),_0x30449c);if(_0x30449c[_0x6670('0x4')]==_0x30449c['linkedid']){utils['info'](util[_0x6670('0x2')](_0x6670('0xd'),_0x30449c[_0x6670('0x4')],_0x30449c['context'],_0x30449c[_0x6670('0xe')]));recordings[_0x30449c[_0x6670('0x4')]]={'uniqueid':_0x30449c[_0x6670('0x4')],'accountcode':_0x30449c[_0x6670('0x5')],'exten':_0x30449c[_0x6670('0xe')],'context':_0x30449c['context'],'channel':_0x30449c[_0x6670('0xf')],'monitors':[]};}}catch(_0x5cf7ed){utils['error'](util[_0x6670('0x2')](_0x6670('0xc'),_0x30449c[_0x6670('0x4')]),_0x5cf7ed);}};exports[_0x6670('0x10')]=function(_0x561be3){try{utils[_0x6670('0x11')](util['format']('[%s][recordings][newstate]',_0x561be3[_0x6670('0x4')]),_0x561be3);if(!_[_0x6670('0x12')](recordings[_0x561be3[_0x6670('0x4')]])&&_0x561be3[_0x6670('0x13')]==0x6){utils[_0x6670('0x14')](util[_0x6670('0x2')](_0x6670('0x15'),_0x561be3['uniqueid'],_0x561be3[_0x6670('0x16')],_0x561be3[_0x6670('0xf')]));}else if(!_[_0x6670('0x12')](recordings[_0x561be3[_0x6670('0x17')]])&&_0x561be3[_0x6670('0x13')]==0x6&&_0x561be3[_0x6670('0x16')]!='transfer'){utils['info'](util[_0x6670('0x2')](_0x6670('0x18'),_0x561be3[_0x6670('0x4')],_0x561be3[_0x6670('0x17')],_0x561be3[_0x6670('0x16')],_0x561be3[_0x6670('0xf')]));recordings[_0x561be3['linkedid']][_0x6670('0x5')]=_0x561be3[_0x6670('0x5')];}}catch(_0x584efb){utils[_0x6670('0x19')](util[_0x6670('0x2')](_0x6670('0x1a'),_0x561be3[_0x6670('0x4')]),_0x584efb);}};exports[_0x6670('0x1b')]=function(_0x267c0c){try{if(!_[_0x6670('0x12')](_0x267c0c['variable'])&&!_[_0x6670('0x12')](_0x267c0c['variable'][_0x6670('0x1c')])){utils[_0x6670('0x11')](util[_0x6670('0x2')](_0x6670('0x1d'),_0x267c0c[_0x6670('0x4')]),_0x267c0c);utils['info'](util['format'](_0x6670('0x1e'),_0x267c0c[_0x6670('0x4')],_0x267c0c[_0x6670('0x1f')],_0x267c0c[_0x6670('0x20')]));if(_[_0x6670('0x21')](_0x267c0c[_0x6670('0x20')],_0x6670('0x22'))){_0x267c0c[_0x6670('0x20')]=_0x267c0c['value'][_0x6670('0x23')]('.wav49',_0x6670('0x24'));}if(recordings[_0x267c0c['linkedid']]){var _0x2d07d4=_[_0x6670('0x25')](recordings[_0x267c0c[_0x6670('0x17')]][_0x6670('0x26')],{'value':_0x267c0c['value']});if(_[_0x6670('0x12')](_0x2d07d4)){recordings[_0x267c0c['linkedid']][_0x6670('0x26')][_0x6670('0x27')]({'value':_0x267c0c[_0x6670('0x20')]});}}}}catch(_0x72c60b){utils[_0x6670('0x19')](util[_0x6670('0x2')]('[%s][recordings][varset]',_0x267c0c['uniqueid']),_0x72c60b);}};exports[_0x6670('0x28')]=function(_0x887ccb){try{if(!_['isNil'](recordings[_0x887ccb[_0x6670('0x4')]])){utils['debug'](util['format'](_0x6670('0x29'),_0x887ccb['uniqueid']),_0x887ccb);utils[_0x6670('0x14')](util[_0x6670('0x2')](_0x6670('0x2a'),_0x887ccb['uniqueid'],_0x887ccb[_0x6670('0x2b')],_0x887ccb['calleridname'],_0x887ccb[_0x6670('0x2c')]));recordings[_0x887ccb[_0x6670('0x4')]][_0x6670('0x2b')]=_0x887ccb[_0x6670('0x2b')];recordings[_0x887ccb['uniqueid']]['calleridname']=_0x887ccb[_0x6670('0x2d')];recordings[_0x887ccb['uniqueid']][_0x6670('0x2e')]=_0x887ccb['connectedlinenum'];recordings[_0x887ccb[_0x6670('0x4')]][_0x6670('0x2f')]=_0x887ccb[_0x6670('0x2f')];if(recordings[_0x887ccb['uniqueid']][_0x6670('0x30')]==_0x6670('0x31')&&recordings[_0x887ccb[_0x6670('0x4')]][_0x6670('0x5')]){recordings[_0x887ccb[_0x6670('0x4')]][_0x6670('0x2e')]=recordings[_0x887ccb['uniqueid']][_0x6670('0x5')];recordings[_0x887ccb[_0x6670('0x4')]][_0x6670('0x2f')]='';}recordings[_0x887ccb[_0x6670('0x4')]][_0x6670('0x26')][_0x6670('0x32')](function(_0x624167){var _0x1add69=_[_0x6670('0x33')](recordings[_0x887ccb['uniqueid']]);_0x1add69[_0x6670('0x20')]=_0x624167[_0x6670('0x20')];writeDB(_0x1add69);});delete recordings[_0x887ccb[_0x6670('0x4')]];}}catch(_0x317c5c){utils[_0x6670('0x19')](util[_0x6670('0x2')]('[%s][recordings][hangup]',_0x887ccb[_0x6670('0x4')]),_0x317c5c);}};exports[_0x6670('0x34')]=function(_0x1e975d){try{if(!_[_0x6670('0x12')](recordings[_0x1e975d[_0x6670('0x4')]])){utils['debug'](util[_0x6670('0x2')](_0x6670('0x35'),_0x1e975d[_0x6670('0x4')]),_0x1e975d);utils[_0x6670('0x14')](util[_0x6670('0x2')](_0x6670('0x36'),_0x1e975d[_0x6670('0x4')],_0x1e975d[_0x6670('0x37')],_0x1e975d[_0x6670('0x38')]));if(_0x1e975d[_0x6670('0x37')][_0x6670('0x39')]()==_0x6670('0x3a')&&_[_0x6670('0x3b')](_0x1e975d[_0x6670('0x38')][_0x6670('0x39')](),_0x6670('0x3c'))){var _0x3c03fc=_0x1e975d[_0x6670('0x38')][_0x6670('0x3d')]('=');var _0x47c432=_0x3c03fc[0x0][_0x6670('0x3e')](_0x3c03fc[0x0][_0x6670('0x3f')]('(')+0x1,_0x3c03fc[0x0][_0x6670('0x3f')](')'));var _0x4f5331=_0x3c03fc[0x1];recordings[_0x1e975d['uniqueid']][_0x47c432]=_0x4f5331;}}}catch(_0x3c5cf8){utils[_0x6670('0x19')](util['format']('[%s][recordings][newexten]',_0x1e975d[_0x6670('0x4')]),_0x3c5cf8);}};exports[_0x6670('0x40')]=function(_0xd6c8b2){try{if(!_['isNil'](recordings[_0xd6c8b2[_0x6670('0x4')]])){utils[_0x6670('0x11')](util['format'](_0x6670('0x41'),_0xd6c8b2[_0x6670('0x4')]),_0xd6c8b2);utils[_0x6670('0x14')](util[_0x6670('0x2')](_0x6670('0x42'),_0xd6c8b2['uniqueid'],_0xd6c8b2[_0x6670('0x43')]));recordings[_0xd6c8b2['uniqueid']][_0x6670('0x43')]=_0xd6c8b2['queue'];}}catch(_0x5201e3){utils[_0x6670('0x19')](util['format']('[%s][recordings][queuecallerjoin]',_0xd6c8b2[_0x6670('0x4')]),_0x5201e3);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index dbcf6c8..c57af2a 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 _0xb2d4=['type','attended','origtransfereruniqueid','uniqueid','CreateVoiceTransferReport','blinds','blindtransfer','format','[%s][transfers][blindtransfer]','transferercalleridnum','transferercalleridname','transfereecalleridname','blind','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','util','info','[%s][transfers][writeDB]\x20type:%s'];(function(_0x5a2285,_0x3212d1){var _0x48f6ed=function(_0x322127){while(--_0x322127){_0x5a2285['push'](_0x5a2285['shift']());}};_0x48f6ed(++_0x3212d1);}(_0xb2d4,0x1d1));var _0x4b2d=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xb2d4[_0x33032e];return _0x13316b;};'use strict';var _=require('lodash');var util=require(_0x4b2d('0x0'));var utils=require('./utils');function writeDB(_0xa17313){utils[_0x4b2d('0x1')](util['format'](_0x4b2d('0x2'),_0xa17313[_0x4b2d('0x3')]===_0x4b2d('0x4')?_0xa17313[_0x4b2d('0x5')]:_0xa17313[_0x4b2d('0x6')],_0xa17313[_0x4b2d('0x3')]));utils['request'](_0x4b2d('0x7'),_0xa17313);}exports[_0x4b2d('0x8')]={};exports[_0x4b2d('0x9')]=function(_0x25d32b){try{utils['debug'](util[_0x4b2d('0xa')](_0x4b2d('0xb'),_0x25d32b[_0x4b2d('0x6')]),_0x25d32b);utils[_0x4b2d('0x1')](util[_0x4b2d('0xa')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x25d32b['uniqueid'],_0x25d32b[_0x4b2d('0xc')],_0x25d32b[_0x4b2d('0xd')],_0x25d32b['transfereecalleridnum'],_0x25d32b[_0x4b2d('0xe')]));_0x25d32b[_0x4b2d('0x3')]=_0x4b2d('0xf');exports['blinds'][_0x25d32b['transfereruniqueid']]=_0x25d32b;writeDB(_0x25d32b);}catch(_0x29da35){utils[_0x4b2d('0x10')](util[_0x4b2d('0xa')](_0x4b2d('0xb'),_0x25d32b[_0x4b2d('0x6')]),_0x29da35);}};exports[_0x4b2d('0x11')]=function(_0x301a7e){try{utils['debug'](util[_0x4b2d('0xa')](_0x4b2d('0x12'),_0x301a7e[_0x4b2d('0x5')]),_0x301a7e);utils['info'](util[_0x4b2d('0xa')](_0x4b2d('0x13'),_0x301a7e[_0x4b2d('0x5')],_0x301a7e[_0x4b2d('0x14')],_0x301a7e[_0x4b2d('0x15')],_0x301a7e[_0x4b2d('0x16')],_0x301a7e[_0x4b2d('0x17')]));_0x301a7e=_[_0x4b2d('0x18')](_0x301a7e,{'transfererchannel':_0x301a7e[_0x4b2d('0x19')],'transferercalleridnum':_0x301a7e[_0x4b2d('0x14')],'transferercalleridname':_0x301a7e[_0x4b2d('0x15')],'transfererconnectedlinenum':_0x301a7e['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x301a7e[_0x4b2d('0x1a')],'transfereraccountcode':_0x301a7e['origtransfereraccountcode'],'transferercontext':_0x301a7e[_0x4b2d('0x1b')],'transfererexten':_0x301a7e[_0x4b2d('0x1c')],'transfererlinkedid':_0x301a7e[_0x4b2d('0x1d')],'context':_0x301a7e[_0x4b2d('0x1e')],'extension':_0x301a7e[_0x4b2d('0x1f')],'type':_0x4b2d('0x4')});if(_[_0x4b2d('0x20')](_0x301a7e[_0x4b2d('0x21')])){_0x301a7e=_[_0x4b2d('0x18')](_0x301a7e,{'transfereechannel':_0x301a7e[_0x4b2d('0x22')],'transfereecalleridnum':_0x301a7e[_0x4b2d('0x16')],'transfereecalleridname':_0x301a7e[_0x4b2d('0x17')],'transfereeconnectedlinenum':_0x301a7e[_0x4b2d('0x23')],'transfereeconnectedlinename':_0x301a7e['transfertargetconnectedlinename'],'transfereeaccountcode':_0x301a7e[_0x4b2d('0x24')],'transfereecontext':_0x301a7e[_0x4b2d('0x25')],'transfereeexten':_0x301a7e[_0x4b2d('0x26')],'transfereelinkedid':_0x301a7e['transfertargetlinkedid']});}writeDB(_0x301a7e);}catch(_0x5d3ba9){utils[_0x4b2d('0x10')](util['format']('[%s][transfers][attendedtransfer]',_0x301a7e[_0x4b2d('0x5')]),_0x5d3ba9);}}; \ No newline at end of file +var _0xc348=['[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','origtransfereruniqueid','uniqueid','CreateVoiceTransferReport','blinds','debug','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','transfereecalleridname','blind','error','[%s][transfers][blindtransfer]','attendedtransfer'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xc348,0x17d));var _0x8c34=function(_0x43777d,_0x4322f2){_0x43777d=_0x43777d-0x0;var _0x5d5ac2=_0xc348[_0x43777d];return _0x5d5ac2;};'use strict';var _=require(_0x8c34('0x0'));var util=require(_0x8c34('0x1'));var utils=require(_0x8c34('0x2'));function writeDB(_0x4660e3){utils[_0x8c34('0x3')](util[_0x8c34('0x4')](_0x8c34('0x5'),_0x4660e3['type']==='attended'?_0x4660e3[_0x8c34('0x6')]:_0x4660e3[_0x8c34('0x7')],_0x4660e3['type']));utils['request'](_0x8c34('0x8'),_0x4660e3);}exports[_0x8c34('0x9')]={};exports['blindtransfer']=function(_0x5bfec){try{utils[_0x8c34('0xa')](util[_0x8c34('0x4')]('[%s][transfers][blindtransfer]',_0x5bfec[_0x8c34('0x7')]),_0x5bfec);utils[_0x8c34('0x3')](util[_0x8c34('0x4')](_0x8c34('0xb'),_0x5bfec[_0x8c34('0x7')],_0x5bfec[_0x8c34('0xc')],_0x5bfec['transferercalleridname'],_0x5bfec[_0x8c34('0xd')],_0x5bfec[_0x8c34('0xe')]));_0x5bfec['type']=_0x8c34('0xf');exports['blinds'][_0x5bfec['transfereruniqueid']]=_0x5bfec;writeDB(_0x5bfec);}catch(_0x2b2349){utils[_0x8c34('0x10')](util['format'](_0x8c34('0x11'),_0x5bfec[_0x8c34('0x7')]),_0x2b2349);}};exports[_0x8c34('0x12')]=function(_0x476b56){try{utils[_0x8c34('0xa')](util[_0x8c34('0x4')](_0x8c34('0x13'),_0x476b56['origtransfereruniqueid']),_0x476b56);utils['info'](util[_0x8c34('0x4')](_0x8c34('0x14'),_0x476b56[_0x8c34('0x6')],_0x476b56[_0x8c34('0x15')],_0x476b56['origtransferercalleridname'],_0x476b56[_0x8c34('0x16')],_0x476b56[_0x8c34('0x17')]));_0x476b56=_[_0x8c34('0x18')](_0x476b56,{'transfererchannel':_0x476b56[_0x8c34('0x19')],'transferercalleridnum':_0x476b56['origtransferercalleridnum'],'transferercalleridname':_0x476b56[_0x8c34('0x1a')],'transfererconnectedlinenum':_0x476b56[_0x8c34('0x1b')],'transfererconnectedlinename':_0x476b56[_0x8c34('0x1c')],'transfereraccountcode':_0x476b56[_0x8c34('0x1d')],'transferercontext':_0x476b56['secondtransferercontext'],'transfererexten':_0x476b56[_0x8c34('0x1e')],'transfererlinkedid':_0x476b56[_0x8c34('0x1f')],'context':_0x476b56[_0x8c34('0x20')],'extension':_0x476b56[_0x8c34('0x21')],'type':'attended'});if(_[_0x8c34('0x22')](_0x476b56[_0x8c34('0x23')])){_0x476b56=_[_0x8c34('0x18')](_0x476b56,{'transfereechannel':_0x476b56['transfertargetchannel'],'transfereecalleridnum':_0x476b56[_0x8c34('0x16')],'transfereecalleridname':_0x476b56[_0x8c34('0x17')],'transfereeconnectedlinenum':_0x476b56[_0x8c34('0x24')],'transfereeconnectedlinename':_0x476b56[_0x8c34('0x25')],'transfereeaccountcode':_0x476b56['transfertargetaccountcode'],'transfereecontext':_0x476b56['transfertargetcontext'],'transfereeexten':_0x476b56[_0x8c34('0x26')],'transfereelinkedid':_0x476b56[_0x8c34('0x27')]});}writeDB(_0x476b56);}catch(_0x47d075){utils[_0x8c34('0x10')](util['format']('[%s][transfers][attendedtransfer]',_0x476b56['origtransfereruniqueid']),_0x47d075);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index c1b3ffc..bcb92bc 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 _0x3c81=['GetVoiceQueue','type','acw','acwTimeout','addTime','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','util','client','http','../../config/logger','debug','inspect','error','request','catch','[utils][request]\x20name:%s','GetUser','internal','name','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','info','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','then','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]'];(function(_0x2f45c0,_0x50ca87){var _0x3bf10a=function(_0x167624){while(--_0x167624){_0x2f45c0['push'](_0x2f45c0['shift']());}};_0x3bf10a(++_0x50ca87);}(_0x3c81,0x1e5));var _0x13c8=function(_0x5dd0c0,_0xc2085f){_0x5dd0c0=_0x5dd0c0-0x0;var _0x21efdc=_0x3c81[_0x5dd0c0];return _0x21efdc;};'use strict';var BPromise=require(_0x13c8('0x0'));var jayson=require(_0x13c8('0x1'));var moment=require('moment');var util=require(_0x13c8('0x2'));var client=jayson[_0x13c8('0x3')][_0x13c8('0x4')]({'port':0x2329});var logger=require(_0x13c8('0x5'))('xdr');exports['info']=function(_0x1a652a,_0x37195b){logger['info'](_0x1a652a,_0x37195b?util['inspect'](_0x37195b,{'showHidden':![],'depth':null}):'');};exports[_0x13c8('0x6')]=function(_0x1867c8,_0x35c35f){logger[_0x13c8('0x6')](_0x1867c8,_0x35c35f?util[_0x13c8('0x7')](_0x35c35f,{'showHidden':![],'depth':null}):'');};exports[_0x13c8('0x8')]=function(_0x29a5dd,_0x2bce6c){logger[_0x13c8('0x8')](_0x29a5dd,_0x2bce6c?util[_0x13c8('0x7')](_0x2bce6c,{'showHidden':![],'depth':null}):'');};exports[_0x13c8('0x9')]=function(_0x2fc7c6,_0x1a5492){return client[_0x13c8('0x9')](_0x2fc7c6,{'body':_0x1a5492})['then'](function(_0x1005b9){logger['debug']('[utils][request]\x20name:%s',_0x2fc7c6,_0x1005b9?util[_0x13c8('0x7')](_0x1005b9,{'showHidden':![],'depth':null}):'');})[_0x13c8('0xa')](function(_0x1fd13d){logger[_0x13c8('0x8')](_0x13c8('0xb'),_0x2fc7c6,_0x1fd13d?util['inspect'](_0x1fd13d,{'showHidden':![],'depth':null}):'');});};function getUser(_0x4b3836){return client[_0x13c8('0x9')](_0x13c8('0xc'),{'options':{'raw':!![],'attributes':['id',_0x13c8('0xd'),_0x13c8('0xe'),'interface'],'where':_0x4b3836,'limit':0x1}})['then'](function(_0x37f7cc){logger[_0x13c8('0x6')](_0x13c8('0xf'),JSON[_0x13c8('0x10')](_0x4b3836),_0x37f7cc?util[_0x13c8('0x7')](_0x37f7cc,{'showHidden':![],'depth':null}):'');return _0x37f7cc[_0x13c8('0x11')][_0x13c8('0x12')]?_0x37f7cc[_0x13c8('0x11')][0x0]:null;});}exports[_0x13c8('0x13')]=function(_0x3f202d){return new BPromise(function(_0x1fc78a,_0x5567a6){if(_0x3f202d){return getUser({'internal':_0x3f202d})['then'](function(_0x36a52d){logger[_0x13c8('0x14')](_0x13c8('0x15'),_0x3f202d,_0x36a52d?_0x13c8('0x16'):_0x13c8('0x17'));return _0x1fc78a(_0x36a52d);})[_0x13c8('0xa')](function(_0x4b38ca){logger[_0x13c8('0x8')](_0x13c8('0x18'),_0x4b38ca?util[_0x13c8('0x7')](_0x4b38ca,{'showHidden':![],'depth':null}):'');return _0x1fc78a(null);});}return _0x1fc78a(null);});};exports[_0x13c8('0x19')]=function(_0x42abed){return new BPromise(function(_0x22889e,_0x2a0c2f){if(_0x42abed){return getUser({'interface':_0x42abed})[_0x13c8('0x1a')](function(_0x50d0af){logger[_0x13c8('0x14')](_0x13c8('0x1b'),_0x42abed,_0x50d0af?'found':_0x13c8('0x17'));return _0x22889e(_0x50d0af);})[_0x13c8('0xa')](function(_0x1281d5){logger[_0x13c8('0x8')](_0x13c8('0x1c'),_0x1281d5?util['inspect'](_0x1281d5,{'showHidden':![],'depth':null}):'');return _0x22889e(null);});}return _0x22889e(null);});};exports[_0x13c8('0x1d')]=function(_0x52393d){return new BPromise(function(_0x2113f1,_0xd02b40){if(_0x52393d){return getUser({'name':_0x52393d})[_0x13c8('0x1a')](function(_0x509133){logger[_0x13c8('0x14')](_0x13c8('0x1e'),_0x52393d,_0x509133?_0x13c8('0x16'):_0x13c8('0x17'));return _0x2113f1(_0x509133);})[_0x13c8('0xa')](function(_0x382704){logger[_0x13c8('0x8')](_0x13c8('0x1f'),_0x382704?util[_0x13c8('0x7')](_0x382704,{'showHidden':![],'depth':null}):'');return _0x2113f1(null);});}return _0x2113f1(null);});};exports['getVoiceQueueByName']=function(_0x34c11a){return new BPromise(function(_0x16d3e8,_0x16adef){if(_0x34c11a){return client['request'](_0x13c8('0x20'),{'options':{'raw':!![],'attributes':['id',_0x13c8('0xe'),_0x13c8('0x21'),_0x13c8('0x22'),_0x13c8('0x23')],'where':{'name':_0x34c11a},'limit':0x1}})[_0x13c8('0x1a')](function(_0x202a3d){logger[_0x13c8('0x6')]('[utils][getVoiceQueueByName]\x20name:%s',_0x34c11a,_0x202a3d?util['inspect'](_0x202a3d,{'showHidden':![],'depth':null}):'');logger[_0x13c8('0x14')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x34c11a,_0x202a3d?_0x13c8('0x16'):'notfound');return _0x16d3e8(_0x202a3d[_0x13c8('0x11')]['length']?_0x202a3d[_0x13c8('0x11')][0x0]:null);})[_0x13c8('0xa')](function(_0x557443){logger['error']('[utils][getVoiceQueueByName]',_0x557443?util[_0x13c8('0x7')](_0x557443,{'showHidden':![],'depth':null}):'');return _0x16d3e8(null);});}return _0x16d3e8(null);});};exports[_0x13c8('0x24')]=function(_0x357657,_0x40141a){return moment(_0x357657)['add'](_0x40141a,_0x13c8('0x25'))[_0x13c8('0x26')](_0x13c8('0x27'));};exports[_0x13c8('0x28')]=function(_0x7d3166,_0x1afd65){return moment(_0x7d3166)[_0x13c8('0x29')](_0x1afd65,_0x13c8('0x25'))[_0x13c8('0x26')](_0x13c8('0x27'));};exports['diffTime']=function(_0x4853bc,_0x52024a){return moment(_0x4853bc)[_0x13c8('0x2a')](moment(_0x52024a),_0x13c8('0x25'));};exports[_0x13c8('0x2b')]=function(_0xcf6edf,_0x184194){return parseInt(_0xcf6edf,0xa)+parseInt(_0x184194,0xa);};exports[_0x13c8('0x2c')]=function(){return moment()[_0x13c8('0x26')](_0x13c8('0x27'));};exports['isAfter']=function(_0x5811e9,_0x419650){if(_0x419650){return moment(_0x5811e9)[_0x13c8('0x2d')](_0x419650);}return!![];};exports[_0x13c8('0x2e')]=function(_0x152e98,_0x9d96d5){if(_0x9d96d5){return moment(_0x152e98)[_0x13c8('0x2e')](_0x9d96d5);}else if(_0x152e98){return!![];}return![];}; \ No newline at end of file +var _0x4b36=['sumTime','isAfter','isBefore','bluebird','moment','util','client','http','../../config/logger','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','name','interface','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff'];(function(_0x56c490,_0x488303){var _0x2c3bf9=function(_0xd8a18f){while(--_0xd8a18f){_0x56c490['push'](_0x56c490['shift']());}};_0x2c3bf9(++_0x488303);}(_0x4b36,0xcb));var _0x64b3=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x4b36[_0x5d4607];return _0x5e4a86;};'use strict';var BPromise=require(_0x64b3('0x0'));var jayson=require('jayson/promise');var moment=require(_0x64b3('0x1'));var util=require(_0x64b3('0x2'));var client=jayson[_0x64b3('0x3')][_0x64b3('0x4')]({'port':0x2329});var logger=require(_0x64b3('0x5'))(_0x64b3('0x6'));exports[_0x64b3('0x7')]=function(_0x35462d,_0x54d190){logger[_0x64b3('0x7')](_0x35462d,_0x54d190?util[_0x64b3('0x8')](_0x54d190,{'showHidden':![],'depth':null}):'');};exports[_0x64b3('0x9')]=function(_0x4facfd,_0x2fa542){logger[_0x64b3('0x9')](_0x4facfd,_0x2fa542?util[_0x64b3('0x8')](_0x2fa542,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x308bda,_0x23b71a){logger[_0x64b3('0xa')](_0x308bda,_0x23b71a?util['inspect'](_0x23b71a,{'showHidden':![],'depth':null}):'');};exports[_0x64b3('0xb')]=function(_0x2677d8,_0x4125e3){return client[_0x64b3('0xb')](_0x2677d8,{'body':_0x4125e3})[_0x64b3('0xc')](function(_0x26c25a){logger[_0x64b3('0x9')](_0x64b3('0xd'),_0x2677d8,_0x26c25a?util[_0x64b3('0x8')](_0x26c25a,{'showHidden':![],'depth':null}):'');})[_0x64b3('0xe')](function(_0x35a89d){logger[_0x64b3('0xa')](_0x64b3('0xd'),_0x2677d8,_0x35a89d?util['inspect'](_0x35a89d,{'showHidden':![],'depth':null}):'');});};function getUser(_0x198a07){return client['request']('GetUser',{'options':{'raw':!![],'attributes':['id','internal',_0x64b3('0xf'),_0x64b3('0x10')],'where':_0x198a07,'limit':0x1}})[_0x64b3('0xc')](function(_0x3371bc){logger[_0x64b3('0x9')](_0x64b3('0x11'),JSON[_0x64b3('0x12')](_0x198a07),_0x3371bc?util[_0x64b3('0x8')](_0x3371bc,{'showHidden':![],'depth':null}):'');return _0x3371bc[_0x64b3('0x13')][_0x64b3('0x14')]?_0x3371bc[_0x64b3('0x13')][0x0]:null;});}exports[_0x64b3('0x15')]=function(_0x5edf44){return new BPromise(function(_0x4c2853,_0x24116c){if(_0x5edf44){return getUser({'internal':_0x5edf44})[_0x64b3('0xc')](function(_0x10a445){logger[_0x64b3('0x7')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x5edf44,_0x10a445?'found':_0x64b3('0x16'));return _0x4c2853(_0x10a445);})[_0x64b3('0xe')](function(_0x567829){logger[_0x64b3('0xa')](_0x64b3('0x17'),_0x567829?util[_0x64b3('0x8')](_0x567829,{'showHidden':![],'depth':null}):'');return _0x4c2853(null);});}return _0x4c2853(null);});};exports[_0x64b3('0x18')]=function(_0x9b2843){return new BPromise(function(_0x4bb4af,_0x1ea929){if(_0x9b2843){return getUser({'interface':_0x9b2843})[_0x64b3('0xc')](function(_0xdddf07){logger[_0x64b3('0x7')](_0x64b3('0x19'),_0x9b2843,_0xdddf07?_0x64b3('0x1a'):'notfound');return _0x4bb4af(_0xdddf07);})[_0x64b3('0xe')](function(_0x9d24b2){logger[_0x64b3('0xa')](_0x64b3('0x1b'),_0x9d24b2?util[_0x64b3('0x8')](_0x9d24b2,{'showHidden':![],'depth':null}):'');return _0x4bb4af(null);});}return _0x4bb4af(null);});};exports[_0x64b3('0x1c')]=function(_0x137931){return new BPromise(function(_0xcbd06a,_0x3832d9){if(_0x137931){return getUser({'name':_0x137931})[_0x64b3('0xc')](function(_0x49c530){logger['info'](_0x64b3('0x1d'),_0x137931,_0x49c530?_0x64b3('0x1a'):'notfound');return _0xcbd06a(_0x49c530);})[_0x64b3('0xe')](function(_0x2e0a0a){logger['error'](_0x64b3('0x1e'),_0x2e0a0a?util[_0x64b3('0x8')](_0x2e0a0a,{'showHidden':![],'depth':null}):'');return _0xcbd06a(null);});}return _0xcbd06a(null);});};exports[_0x64b3('0x1f')]=function(_0x3e49e7){return new BPromise(function(_0x5e4381,_0x2a5d01){if(_0x3e49e7){return client[_0x64b3('0xb')](_0x64b3('0x20'),{'options':{'raw':!![],'attributes':['id','name',_0x64b3('0x21'),_0x64b3('0x22'),_0x64b3('0x23')],'where':{'name':_0x3e49e7},'limit':0x1}})[_0x64b3('0xc')](function(_0x4a801a){logger[_0x64b3('0x9')](_0x64b3('0x24'),_0x3e49e7,_0x4a801a?util[_0x64b3('0x8')](_0x4a801a,{'showHidden':![],'depth':null}):'');logger['info'](_0x64b3('0x25'),_0x3e49e7,_0x4a801a?'found':_0x64b3('0x16'));return _0x5e4381(_0x4a801a[_0x64b3('0x13')]['length']?_0x4a801a[_0x64b3('0x13')][0x0]:null);})['catch'](function(_0x79483){logger[_0x64b3('0xa')](_0x64b3('0x26'),_0x79483?util[_0x64b3('0x8')](_0x79483,{'showHidden':![],'depth':null}):'');return _0x5e4381(null);});}return _0x5e4381(null);});};exports['addTime']=function(_0x130e44,_0x59a0fd){return moment(_0x130e44)[_0x64b3('0x27')](_0x59a0fd,_0x64b3('0x28'))[_0x64b3('0x29')](_0x64b3('0x2a'));};exports[_0x64b3('0x2b')]=function(_0x248b18,_0x192e01){return moment(_0x248b18)[_0x64b3('0x2c')](_0x192e01,_0x64b3('0x28'))[_0x64b3('0x29')](_0x64b3('0x2a'));};exports[_0x64b3('0x2d')]=function(_0x30d8af,_0xf7a2c6){return moment(_0x30d8af)[_0x64b3('0x2e')](moment(_0xf7a2c6),_0x64b3('0x28'));};exports[_0x64b3('0x2f')]=function(_0xaeb0fb,_0x1a390b){return parseInt(_0xaeb0fb,0xa)+parseInt(_0x1a390b,0xa);};exports['now']=function(){return moment()[_0x64b3('0x29')](_0x64b3('0x2a'));};exports[_0x64b3('0x30')]=function(_0x4b97c5,_0x5c815){if(_0x5c815){return moment(_0x4b97c5)['isAfter'](_0x5c815);}return!![];};exports['isBefore']=function(_0x15d11c,_0x30f25a){if(_0x30f25a){return moment(_0x15d11c)[_0x64b3('0x31')](_0x30f25a);}else if(_0x15d11c){return!![];}return![];}; \ No newline at end of file